Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/apps/asf2mkv/asf2mkv.cpp106
-rw-r--r--src/apps/asf2mkv/asf2mkv.h53
-rw-r--r--src/apps/asf2mkv/asf2mkv.rc219
-rw-r--r--src/apps/asf2mkv/asf2mkv.sln79
-rw-r--r--src/apps/asf2mkv/asf2mkv.vcproj315
-rw-r--r--src/apps/asf2mkv/asf2mkvDlg.cpp609
-rw-r--r--src/apps/asf2mkv/asf2mkvDlg.h111
-rw-r--r--src/apps/asf2mkv/res/asf2mkv.icobin0 -> 21630 bytes
-rw-r--r--src/apps/asf2mkv/res/asf2mkv.manifest22
-rw-r--r--src/apps/asf2mkv/res/asf2mkv.rc213
-rw-r--r--src/apps/asf2mkv/resource.h29
-rw-r--r--src/apps/asf2mkv/stdafx.cpp29
-rw-r--r--src/apps/asf2mkv/stdafx.h75
-rw-r--r--src/apps/mpcinfo/Resource.h16
-rw-r--r--src/apps/mpcinfo/doc/mpcinfo.txt72
-rw-r--r--src/apps/mpcinfo/mpcinfo.cpp288
-rw-r--r--src/apps/mpcinfo/mpcinfo.def13
-rw-r--r--src/apps/mpcinfo/mpcinfo.h48
-rw-r--r--src/apps/mpcinfo/mpcinfo.ncbbin0 -> 27648 bytes
-rw-r--r--src/apps/mpcinfo/mpcinfo.rc135
-rw-r--r--src/apps/mpcinfo/mpcinfo.sln21
-rw-r--r--src/apps/mpcinfo/mpcinfo.suobin0 -> 7680 bytes
-rw-r--r--src/apps/mpcinfo/mpcinfo.vcproj190
-rw-r--r--src/apps/mpcinfo/res/mpcinfo.rc213
-rw-r--r--src/apps/mpcinfo/stdafx.cpp28
-rw-r--r--src/apps/mpcinfo/stdafx.h73
-rw-r--r--src/apps/mplayerc/AuthDlg.cpp171
-rw-r--r--src/apps/mplayerc/AuthDlg.h57
-rw-r--r--src/apps/mplayerc/BaseGraph.cpp354
-rw-r--r--src/apps/mplayerc/BaseGraph.h255
-rw-r--r--src/apps/mplayerc/CShockwaveFlash.cpp35
-rw-r--r--src/apps/mplayerc/CShockwaveFlash.h462
-rw-r--r--src/apps/mplayerc/ChildView.cpp284
-rw-r--r--src/apps/mplayerc/ChildView.h65
-rw-r--r--src/apps/mplayerc/ComPropertyPage.cpp109
-rw-r--r--src/apps/mplayerc/ComPropertyPage.h52
-rw-r--r--src/apps/mplayerc/ComPropertySheet.cpp246
-rw-r--r--src/apps/mplayerc/ComPropertySheet.h61
-rw-r--r--src/apps/mplayerc/ConvertChapDlg.cpp92
-rw-r--r--src/apps/mplayerc/ConvertChapDlg.h45
-rw-r--r--src/apps/mplayerc/ConvertDlg.cpp1366
-rw-r--r--src/apps/mplayerc/ConvertDlg.h190
-rw-r--r--src/apps/mplayerc/ConvertPropsDlg.cpp202
-rw-r--r--src/apps/mplayerc/ConvertPropsDlg.h60
-rw-r--r--src/apps/mplayerc/ConvertResDlg.cpp125
-rw-r--r--src/apps/mplayerc/ConvertResDlg.h49
-rw-r--r--src/apps/mplayerc/D3DFont.cpp881
-rw-r--r--src/apps/mplayerc/D3DFont.h58
-rw-r--r--src/apps/mplayerc/DX7AllocatorPresenter.cpp1321
-rw-r--r--src/apps/mplayerc/DX7AllocatorPresenter.h40
-rw-r--r--src/apps/mplayerc/DX9AllocatorPresenter.cpp2447
-rw-r--r--src/apps/mplayerc/DX9AllocatorPresenter.h44
-rw-r--r--src/apps/mplayerc/Debug Unicode/d3dx9_28.dllbin0 -> 2323664 bytes
-rw-r--r--src/apps/mplayerc/DeinterlacerFilter.cpp123
-rw-r--r--src/apps/mplayerc/DeinterlacerFilter.h16
-rw-r--r--src/apps/mplayerc/FGFilter.cpp592
-rw-r--r--src/apps/mplayerc/FGFilter.h138
-rw-r--r--src/apps/mplayerc/FGManager.cpp1840
-rw-r--r--src/apps/mplayerc/FGManager.h164
-rw-r--r--src/apps/mplayerc/FakeFilterMapper2.cpp474
-rw-r--r--src/apps/mplayerc/FakeFilterMapper2.h124
-rw-r--r--src/apps/mplayerc/FavoriteAddDlg.cpp79
-rw-r--r--src/apps/mplayerc/FavoriteAddDlg.h52
-rw-r--r--src/apps/mplayerc/FavoriteOrganizeDlg.cpp284
-rw-r--r--src/apps/mplayerc/FavoriteOrganizeDlg.h65
-rw-r--r--src/apps/mplayerc/FileDropTarget.cpp78
-rw-r--r--src/apps/mplayerc/FileDropTarget.h63
-rw-r--r--src/apps/mplayerc/FloatEdit.cpp157
-rw-r--r--src/apps/mplayerc/FloatEdit.h66
-rw-r--r--src/apps/mplayerc/FullscreenWnd.cpp103
-rw-r--r--src/apps/mplayerc/FullscreenWnd.h32
-rw-r--r--src/apps/mplayerc/GoToDlg.cpp204
-rw-r--r--src/apps/mplayerc/GoToDlg.h56
-rw-r--r--src/apps/mplayerc/History.txt38
-rw-r--r--src/apps/mplayerc/IGraphBuilder2.h44
-rw-r--r--src/apps/mplayerc/IPinHook.cpp475
-rw-r--r--src/apps/mplayerc/IPinHook.h180
-rw-r--r--src/apps/mplayerc/IQTVideoSurface.h33
-rw-r--r--src/apps/mplayerc/ISDb.cpp89
-rw-r--r--src/apps/mplayerc/ISDb.h37
-rw-r--r--src/apps/mplayerc/KeyProvider.cpp53
-rw-r--r--src/apps/mplayerc/KeyProvider.h40
-rw-r--r--src/apps/mplayerc/LineNumberEdit.cpp971
-rw-r--r--src/apps/mplayerc/LineNumberEdit.h99
-rw-r--r--src/apps/mplayerc/MacrovisionKicker.cpp92
-rw-r--r--src/apps/mplayerc/MacrovisionKicker.h44
-rw-r--r--src/apps/mplayerc/MainFrm.cpp10265
-rw-r--r--src/apps/mplayerc/MainFrm.h693
-rw-r--r--src/apps/mplayerc/MediaFormats.cpp344
-rw-r--r--src/apps/mplayerc/MediaFormats.h90
-rw-r--r--src/apps/mplayerc/MediaTypesDlg.cpp340
-rw-r--r--src/apps/mplayerc/MediaTypesDlg.h59
-rw-r--r--src/apps/mplayerc/OpenCapDeviceDlg.cpp448
-rw-r--r--src/apps/mplayerc/OpenCapDeviceDlg.h58
-rw-r--r--src/apps/mplayerc/OpenDlg.cpp195
-rw-r--r--src/apps/mplayerc/OpenDlg.h58
-rw-r--r--src/apps/mplayerc/OpenFileDlg.cpp153
-rw-r--r--src/apps/mplayerc/OpenFileDlg.h59
-rw-r--r--src/apps/mplayerc/PPageAccelTbl.cpp962
-rw-r--r--src/apps/mplayerc/PPageAccelTbl.h85
-rw-r--r--src/apps/mplayerc/PPageAudioSwitcher.cpp338
-rw-r--r--src/apps/mplayerc/PPageAudioSwitcher.h80
-rw-r--r--src/apps/mplayerc/PPageBase.cpp102
-rw-r--r--src/apps/mplayerc/PPageBase.h49
-rw-r--r--src/apps/mplayerc/PPageCasimir.cpp204
-rw-r--r--src/apps/mplayerc/PPageCasimir.h68
-rw-r--r--src/apps/mplayerc/PPageDVD.cpp329
-rw-r--r--src/apps/mplayerc/PPageDVD.h67
-rw-r--r--src/apps/mplayerc/PPageExternalFilters.cpp731
-rw-r--r--src/apps/mplayerc/PPageExternalFilters.h84
-rw-r--r--src/apps/mplayerc/PPageFileInfoClip.cpp110
-rw-r--r--src/apps/mplayerc/PPageFileInfoClip.h58
-rw-r--r--src/apps/mplayerc/PPageFileInfoDetails.cpp309
-rw-r--r--src/apps/mplayerc/PPageFileInfoDetails.h63
-rw-r--r--src/apps/mplayerc/PPageFileInfoRes.cpp151
-rw-r--r--src/apps/mplayerc/PPageFileInfoRes.h60
-rw-r--r--src/apps/mplayerc/PPageFileInfoSheet.cpp79
-rw-r--r--src/apps/mplayerc/PPageFileInfoSheet.h51
-rw-r--r--src/apps/mplayerc/PPageFormats.cpp767
-rw-r--r--src/apps/mplayerc/PPageFormats.h86
-rw-r--r--src/apps/mplayerc/PPageInternalFilters.cpp292
-rw-r--r--src/apps/mplayerc/PPageInternalFilters.h74
-rw-r--r--src/apps/mplayerc/PPageLogo.cpp195
-rw-r--r--src/apps/mplayerc/PPageLogo.h60
-rw-r--r--src/apps/mplayerc/PPageOutput.cpp208
-rw-r--r--src/apps/mplayerc/PPageOutput.h63
-rw-r--r--src/apps/mplayerc/PPagePlayback.cpp210
-rw-r--r--src/apps/mplayerc/PPagePlayback.h73
-rw-r--r--src/apps/mplayerc/PPagePlayer.cpp180
-rw-r--r--src/apps/mplayerc/PPagePlayer.h68
-rw-r--r--src/apps/mplayerc/PPageSheet.cpp121
-rw-r--r--src/apps/mplayerc/PPageSheet.h92
-rw-r--r--src/apps/mplayerc/PPageSubDB.cpp117
-rw-r--r--src/apps/mplayerc/PPageSubDB.h50
-rw-r--r--src/apps/mplayerc/PPageSubStyle.cpp303
-rw-r--r--src/apps/mplayerc/PPageSubStyle.h114
-rw-r--r--src/apps/mplayerc/PPageSubtitles.cpp139
-rw-r--r--src/apps/mplayerc/PPageSubtitles.h61
-rw-r--r--src/apps/mplayerc/PPageTweaks.cpp139
-rw-r--r--src/apps/mplayerc/PPageTweaks.h65
-rw-r--r--src/apps/mplayerc/PPageWebServer.cpp255
-rw-r--r--src/apps/mplayerc/PPageWebServer.h70
-rw-r--r--src/apps/mplayerc/PixelShaderCompiler.cpp111
-rw-r--r--src/apps/mplayerc/PixelShaderCompiler.h64
-rw-r--r--src/apps/mplayerc/PlayerCaptureBar.cpp75
-rw-r--r--src/apps/mplayerc/PlayerCaptureBar.h49
-rw-r--r--src/apps/mplayerc/PlayerCaptureDialog.cpp1659
-rw-r--r--src/apps/mplayerc/PlayerCaptureDialog.h452
-rw-r--r--src/apps/mplayerc/PlayerInfoBar.cpp219
-rw-r--r--src/apps/mplayerc/PlayerInfoBar.h62
-rw-r--r--src/apps/mplayerc/PlayerListCtrl.cpp871
-rw-r--r--src/apps/mplayerc/PlayerListCtrl.h150
-rw-r--r--src/apps/mplayerc/PlayerPlaylistBar.cpp1405
-rw-r--r--src/apps/mplayerc/PlayerPlaylistBar.h118
-rw-r--r--src/apps/mplayerc/PlayerSeekBar.cpp304
-rw-r--r--src/apps/mplayerc/PlayerSeekBar.h73
-rw-r--r--src/apps/mplayerc/PlayerShaderEditorBar.cpp84
-rw-r--r--src/apps/mplayerc/PlayerShaderEditorBar.h52
-rw-r--r--src/apps/mplayerc/PlayerStatusBar.cpp374
-rw-r--r--src/apps/mplayerc/PlayerStatusBar.h71
-rw-r--r--src/apps/mplayerc/PlayerSubresyncBar.cpp1301
-rw-r--r--src/apps/mplayerc/PlayerSubresyncBar.h107
-rw-r--r--src/apps/mplayerc/PlayerToolBar.cpp276
-rw-r--r--src/apps/mplayerc/PlayerToolBar.h69
-rw-r--r--src/apps/mplayerc/Playlist.cpp272
-rw-r--r--src/apps/mplayerc/Playlist.h73
-rw-r--r--src/apps/mplayerc/PnSPresetsDlg.cpp247
-rw-r--r--src/apps/mplayerc/PnSPresetsDlg.h68
-rw-r--r--src/apps/mplayerc/QuicktimeGraph.cpp652
-rw-r--r--src/apps/mplayerc/QuicktimeGraph.h125
-rw-r--r--src/apps/mplayerc/RealMediaGraph.cpp714
-rw-r--r--src/apps/mplayerc/RealMediaGraph.h229
-rw-r--r--src/apps/mplayerc/RealMediaWindowlessSite.cpp710
-rw-r--r--src/apps/mplayerc/RealMediaWindowlessSite.h218
-rw-r--r--src/apps/mplayerc/RegFilterChooserDlg.cpp174
-rw-r--r--src/apps/mplayerc/RegFilterChooserDlg.h56
-rw-r--r--src/apps/mplayerc/Release Unicode/d3dx9_28.dllbin0 -> 2323664 bytes
-rw-r--r--src/apps/mplayerc/SaveDlg.cpp232
-rw-r--r--src/apps/mplayerc/SaveDlg.h61
-rw-r--r--src/apps/mplayerc/SaveTextFileDialog.cpp93
-rw-r--r--src/apps/mplayerc/SaveTextFileDialog.h56
-rw-r--r--src/apps/mplayerc/SaveThumbnailsDialog.cpp91
-rw-r--r--src/apps/mplayerc/SaveThumbnailsDialog.h50
-rw-r--r--src/apps/mplayerc/SelectMediaType.cpp101
-rw-r--r--src/apps/mplayerc/SelectMediaType.h55
-rw-r--r--src/apps/mplayerc/ShaderAutoCompleteDlg.cpp179
-rw-r--r--src/apps/mplayerc/ShaderAutoCompleteDlg.h33
-rw-r--r--src/apps/mplayerc/ShaderCombineDlg.cpp131
-rw-r--r--src/apps/mplayerc/ShaderCombineDlg.h38
-rw-r--r--src/apps/mplayerc/ShaderEditorDlg.cpp482
-rw-r--r--src/apps/mplayerc/ShaderEditorDlg.h81
-rw-r--r--src/apps/mplayerc/ShockwaveGraph.cpp232
-rw-r--r--src/apps/mplayerc/ShockwaveGraph.h79
-rw-r--r--src/apps/mplayerc/StaticLink.cpp171
-rw-r--r--src/apps/mplayerc/StaticLink.h81
-rw-r--r--src/apps/mplayerc/StatusLabel.cpp98
-rw-r--r--src/apps/mplayerc/StatusLabel.h47
-rw-r--r--src/apps/mplayerc/StdAfx.cpp27
-rw-r--r--src/apps/mplayerc/StdAfx.h68
-rw-r--r--src/apps/mplayerc/SubtitleDlDlg.cpp153
-rw-r--r--src/apps/mplayerc/SubtitleDlDlg.h42
-rw-r--r--src/apps/mplayerc/TextPassThruFilter.cpp249
-rw-r--r--src/apps/mplayerc/TextPassThruFilter.h46
-rw-r--r--src/apps/mplayerc/VMROSD.cpp302
-rw-r--r--src/apps/mplayerc/VMROSD.h89
-rw-r--r--src/apps/mplayerc/VolumeCtrl.cpp186
-rw-r--r--src/apps/mplayerc/VolumeCtrl.h51
-rw-r--r--src/apps/mplayerc/WebClientSocket.cpp727
-rw-r--r--src/apps/mplayerc/WebClientSocket.h44
-rw-r--r--src/apps/mplayerc/WebServer.cpp614
-rw-r--r--src/apps/mplayerc/WebServer.h50
-rw-r--r--src/apps/mplayerc/WebServerSocket.cpp22
-rw-r--r--src/apps/mplayerc/WebServerSocket.h15
-rw-r--r--src/apps/mplayerc/jpeg.cpp404
-rw-r--r--src/apps/mplayerc/jpeg.h59
-rw-r--r--src/apps/mplayerc/jpeg_tables.h233
-rw-r--r--src/apps/mplayerc/mplayerc.apsbin0 -> 1184196 bytes
-rw-r--r--src/apps/mplayerc/mplayerc.cpp2408
-rw-r--r--src/apps/mplayerc/mplayerc.h580
-rw-r--r--src/apps/mplayerc/mplayerc.ncbbin0 -> 8162304 bytes
-rw-r--r--src/apps/mplayerc/mplayerc.rc2825
-rw-r--r--src/apps/mplayerc/mplayerc.sln147
-rw-r--r--src/apps/mplayerc/mplayerc.suobin0 -> 38400 bytes
-rw-r--r--src/apps/mplayerc/mplayerc.vcproj1927
-rw-r--r--src/apps/mplayerc/mplayerc.vcproj.vspscc10
-rw-r--r--src/apps/mplayerc/mplayerc.vssscc10
-rw-r--r--src/apps/mplayerc/res/Icon_114.icobin0 -> 23558 bytes
-rw-r--r--src/apps/mplayerc/res/Icon_116.icobin0 -> 22486 bytes
-rw-r--r--src/apps/mplayerc/res/Icon_41.icobin0 -> 5854 bytes
-rw-r--r--src/apps/mplayerc/res/ani.avibin0 -> 14848 bytes
-rw-r--r--src/apps/mplayerc/res/authhdrpic.bmpbin0 -> 57654 bytes
-rw-r--r--src/apps/mplayerc/res/icon.icobin0 -> 1078 bytes
-rw-r--r--src/apps/mplayerc/res/logo.0.bmpbin0 -> 122 bytes
-rw-r--r--src/apps/mplayerc/res/logo.1.bmpbin0 -> 78934 bytes
-rw-r--r--src/apps/mplayerc/res/logo.2.bmpbin0 -> 117078 bytes
-rw-r--r--src/apps/mplayerc/res/logo.3.bmpbin0 -> 63554 bytes
-rw-r--r--src/apps/mplayerc/res/logo.4.bmpbin0 -> 91814 bytes
-rw-r--r--src/apps/mplayerc/res/logo.5.bmpbin0 -> 31402 bytes
-rw-r--r--src/apps/mplayerc/res/logo.6.bmpbin0 -> 163154 bytes
-rw-r--r--src/apps/mplayerc/res/logo.7.bmpbin0 -> 143406 bytes
-rw-r--r--src/apps/mplayerc/res/mono.bmpbin0 -> 1582 bytes
-rw-r--r--src/apps/mplayerc/res/mpc.pngbin0 -> 9145 bytes
-rw-r--r--src/apps/mplayerc/res/mplayerc.manifest23
-rw-r--r--src/apps/mplayerc/res/multi.icobin0 -> 766 bytes
-rw-r--r--src/apps/mplayerc/res/noaudio.bmpbin0 -> 1666 bytes
-rw-r--r--src/apps/mplayerc/res/onoff.bmpbin0 -> 358 bytes
-rw-r--r--src/apps/mplayerc/res/shaders/EdgeSharpen.psh63
-rw-r--r--src/apps/mplayerc/res/shaders/SharpenComplex.psh82
-rw-r--r--src/apps/mplayerc/res/shaders/contour.psh30
-rw-r--r--src/apps/mplayerc/res/shaders/deinterlace (blend).psh24
-rw-r--r--src/apps/mplayerc/res/shaders/emboss.psh30
-rw-r--r--src/apps/mplayerc/res/shaders/empty.psh19
-rw-r--r--src/apps/mplayerc/res/shaders/grayscale.psh19
-rw-r--r--src/apps/mplayerc/res/shaders/invert.psh19
-rw-r--r--src/apps/mplayerc/res/shaders/letterbox.psh25
-rw-r--r--src/apps/mplayerc/res/shaders/procamp.psh61
-rw-r--r--src/apps/mplayerc/res/shaders/resizer.psh105
-rw-r--r--src/apps/mplayerc/res/shaders/sharpen.psh30
-rw-r--r--src/apps/mplayerc/res/shaders/sphere.psh60
-rw-r--r--src/apps/mplayerc/res/shaders/spotlight.psh22
-rw-r--r--src/apps/mplayerc/res/shaders/wave.psh29
-rw-r--r--src/apps/mplayerc/res/single.icobin0 -> 766 bytes
-rw-r--r--src/apps/mplayerc/res/stereo.bmpbin0 -> 1834 bytes
-rw-r--r--src/apps/mplayerc/res/streamtypes.bmpbin0 -> 6966 bytes
-rw-r--r--src/apps/mplayerc/res/toolbar1.bmpbin0 -> 2038 bytes
-rw-r--r--src/apps/mplayerc/res/web/1pix.gifbin0 -> 43 bytes
-rw-r--r--src/apps/mplayerc/res/web/404.html10
-rw-r--r--src/apps/mplayerc/res/web/bottomside.pngbin0 -> 97 bytes
-rw-r--r--src/apps/mplayerc/res/web/browser.html28
-rw-r--r--src/apps/mplayerc/res/web/controlback.pngbin0 -> 148 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlbuttondecrate.pngbin0 -> 181 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlbuttonincrate.pngbin0 -> 174 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlbuttonpause.pngbin0 -> 143 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlbuttonplay.pngbin0 -> 237 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlbuttonskipback.pngbin0 -> 190 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlbuttonskipforward.pngbin0 -> 190 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlbuttonstep.pngbin0 -> 183 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlbuttonstop.pngbin0 -> 149 bytes
-rw-r--r--src/apps/mplayerc/res/web/controls.html1735
-rw-r--r--src/apps/mplayerc/res/web/controlvolumebar.pngbin0 -> 239 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlvolumegrip.pngbin0 -> 173 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlvolumeoff.pngbin0 -> 410 bytes
-rw-r--r--src/apps/mplayerc/res/web/controlvolumeon.pngbin0 -> 270 bytes
-rw-r--r--src/apps/mplayerc/res/web/default.css5
-rw-r--r--src/apps/mplayerc/res/web/headerback.pngbin0 -> 161 bytes
-rw-r--r--src/apps/mplayerc/res/web/headerclose.pngbin0 -> 1658 bytes
-rw-r--r--src/apps/mplayerc/res/web/headericon.pngbin0 -> 801 bytes
-rw-r--r--src/apps/mplayerc/res/web/index.html35
-rw-r--r--src/apps/mplayerc/res/web/leftbottomside.pngbin0 -> 180 bytes
-rw-r--r--src/apps/mplayerc/res/web/leftside.pngbin0 -> 151 bytes
-rw-r--r--src/apps/mplayerc/res/web/logo.pngbin0 -> 61474 bytes
-rw-r--r--src/apps/mplayerc/res/web/player.html303
-rw-r--r--src/apps/mplayerc/res/web/rightbottomside.pngbin0 -> 118 bytes
-rw-r--r--src/apps/mplayerc/res/web/rightside.pngbin0 -> 95 bytes
-rw-r--r--src/apps/mplayerc/res/web/seekbargrip.pngbin0 -> 158 bytes
-rw-r--r--src/apps/mplayerc/res/web/seekbarleft.pngbin0 -> 112 bytes
-rw-r--r--src/apps/mplayerc/res/web/seekbarmid.pngbin0 -> 100 bytes
-rw-r--r--src/apps/mplayerc/res/web/seekbarright.pngbin0 -> 107 bytes
-rw-r--r--src/apps/mplayerc/res/web/sliderback.gifbin0 -> 351 bytes
-rw-r--r--src/apps/mplayerc/res/web/sliderbar.gifbin0 -> 91 bytes
-rw-r--r--src/apps/mplayerc/res/web/slidergrip.gifbin0 -> 157 bytes
-rw-r--r--src/apps/mplayerc/res/web/vbg.GIFbin0 -> 228 bytes
-rw-r--r--src/apps/mplayerc/res/web/vbs.GIFbin0 -> 127 bytes
-rw-r--r--src/apps/mplayerc/resource.h758
-rw-r--r--src/apps/subresync/res/bitmap1.bmpbin0 -> 742 bytes
-rw-r--r--src/apps/subresync/res/bitmap2.bmpbin0 -> 378 bytes
-rw-r--r--src/apps/subresync/res/subresync.icobin0 -> 21630 bytes
-rw-r--r--src/apps/subresync/res/subresync.manifest22
-rw-r--r--src/apps/subresync/res/subresync.rc213
-rw-r--r--src/apps/subresync/resource.h56
-rw-r--r--src/apps/subresync/stdafx.cpp28
-rw-r--r--src/apps/subresync/stdafx.h63
-rw-r--r--src/apps/subresync/subresync.cpp98
-rw-r--r--src/apps/subresync/subresync.h53
-rw-r--r--src/apps/subresync/subresync.rc352
-rw-r--r--src/apps/subresync/subresync.sln21
-rw-r--r--src/apps/subresync/subresync.vcproj177
-rw-r--r--src/apps/subresync/subresyncDlg.cpp169
-rw-r--r--src/apps/subresync/subresyncDlg.h97
-rw-r--r--src/apps/vsconv/Resource.h20
-rw-r--r--src/apps/vsconv/res/vsconv.icobin0 -> 21630 bytes
-rw-r--r--src/apps/vsconv/res/vsconv.manifest22
-rw-r--r--src/apps/vsconv/res/vsconv.rc213
-rw-r--r--src/apps/vsconv/stdafx.cpp28
-rw-r--r--src/apps/vsconv/stdafx.h65
-rw-r--r--src/apps/vsconv/vsconv.cpp197
-rw-r--r--src/apps/vsconv/vsconv.h52
-rw-r--r--src/apps/vsconv/vsconv.rc199
-rw-r--r--src/apps/vsconv/vsconv.sln40
-rw-r--r--src/apps/vsconv/vsconv.vcproj321
-rw-r--r--src/apps/vsconv/vsconvDlg.cpp169
-rw-r--r--src/apps/vsconv/vsconvDlg.h52
-rw-r--r--src/apps/vsrip/VSRip.cpp82
-rw-r--r--src/apps/vsrip/VSRip.h52
-rw-r--r--src/apps/vsrip/VSRip.rc263
-rw-r--r--src/apps/vsrip/VSRip.sln53
-rw-r--r--src/apps/vsrip/VSRip.vcproj349
-rw-r--r--src/apps/vsrip/VSRipDlg.cpp312
-rw-r--r--src/apps/vsrip/VSRipDlg.h71
-rw-r--r--src/apps/vsrip/VSRipFileDlg.cpp112
-rw-r--r--src/apps/vsrip/VSRipFileDlg.h61
-rw-r--r--src/apps/vsrip/VSRipIndexingDlg.cpp179
-rw-r--r--src/apps/vsrip/VSRipIndexingDlg.h73
-rw-r--r--src/apps/vsrip/VSRipPGCDlg.cpp247
-rw-r--r--src/apps/vsrip/VSRipPGCDlg.h71
-rw-r--r--src/apps/vsrip/VSRipPage.cpp62
-rw-r--r--src/apps/vsrip/VSRipPage.h60
-rw-r--r--src/apps/vsrip/res/VSRip.icobin0 -> 21630 bytes
-rw-r--r--src/apps/vsrip/res/VSRip.manifest22
-rw-r--r--src/apps/vsrip/res/VSRip.rc213
-rw-r--r--src/apps/vsrip/resource.h37
-rw-r--r--src/apps/vsrip/stdafx.cpp28
-rw-r--r--src/apps/vsrip/stdafx.h64
-rw-r--r--src/decss/CSSauth.cpp328
-rw-r--r--src/decss/CSSauth.h5
-rw-r--r--src/decss/CSSscramble.cpp247
-rw-r--r--src/decss/CSSscramble.h8
-rw-r--r--src/decss/DeCSSInputPin.cpp350
-rw-r--r--src/decss/DeCSSInputPin.h50
-rw-r--r--src/decss/VobDec.cpp184
-rw-r--r--src/decss/VobDec.h21
-rw-r--r--src/decss/VobFile.cpp639
-rw-r--r--src/decss/VobFile.h87
-rw-r--r--src/decss/decss.h5
-rw-r--r--src/decss/decss.sln27
-rw-r--r--src/decss/decss.vcproj284
-rw-r--r--src/decss/decss.vcproj.vspscc10
-rw-r--r--src/decss/stdafx.cpp8
-rw-r--r--src/decss/stdafx.h18
-rw-r--r--src/decss/udf.cpp355
-rw-r--r--src/decss/udf.h265
-rw-r--r--src/dsutil/DSMPropertyBag.cpp382
-rw-r--r--src/dsutil/DSMPropertyBag.h169
-rw-r--r--src/dsutil/DSUtil.cpp2218
-rw-r--r--src/dsutil/DSUtil.h197
-rw-r--r--src/dsutil/FontInstaller.cpp94
-rw-r--r--src/dsutil/FontInstaller.h25
-rw-r--r--src/dsutil/MediaTypeEx.cpp641
-rw-r--r--src/dsutil/MediaTypeEx.h16
-rw-r--r--src/dsutil/MediaTypes.cpp381
-rw-r--r--src/dsutil/MediaTypes.h47
-rw-r--r--src/dsutil/NullRenderers.cpp158
-rw-r--r--src/dsutil/NullRenderers.h93
-rw-r--r--src/dsutil/a_yuv2rgb.asm1910
-rw-r--r--src/dsutil/a_yuvtable.asm612
-rw-r--r--src/dsutil/convert_a.asm263
-rw-r--r--src/dsutil/dsutil.sln27
-rw-r--r--src/dsutil/dsutil.vcproj399
-rw-r--r--src/dsutil/dsutil.vcproj.vspscc10
-rw-r--r--src/dsutil/stdafx.cpp29
-rw-r--r--src/dsutil/stdafx.h47
-rw-r--r--src/dsutil/text.cpp220
-rw-r--r--src/dsutil/text.h69
-rw-r--r--src/dsutil/vd.cpp1509
-rw-r--r--src/dsutil/vd.h42
-rw-r--r--src/filters/FilterApp.cpp52
-rw-r--r--src/filters/FilterApp.h33
-rw-r--r--src/filters/InternalPropertyPage.cpp312
-rw-r--r--src/filters/InternalPropertyPage.h119
-rw-r--r--src/filters/PinInfoWnd.cpp179
-rw-r--r--src/filters/PinInfoWnd.h59
-rw-r--r--src/filters/filters.h49
-rw-r--r--src/filters/filters.ncbbin0 -> 5409792 bytes
-rw-r--r--src/filters/filters.sln862
-rw-r--r--src/filters/filters.suobin0 -> 269312 bytes
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxer.cpp436
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxer.h109
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxer.sln40
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxer.vcproj270
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxerInputPin.cpp279
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxerInputPin.h85
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxerOutputPin.cpp476
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxerOutputPin.h65
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxerRelatedPin.cpp48
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxerRelatedPin.h43
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxer_vs2005.vcproj387
-rw-r--r--src/filters/muxer/basemuxer/BaseMuxer_vs2005.vcproj.POLUX.Casimir666.user121
-rw-r--r--src/filters/muxer/basemuxer/BitStream.cpp156
-rw-r--r--src/filters/muxer/basemuxer/BitStream.h57
-rw-r--r--src/filters/muxer/basemuxer/stdafx.cpp29
-rw-r--r--src/filters/muxer/basemuxer/stdafx.h48
-rw-r--r--src/filters/muxer/dsmmuxer/DSMMuxer.cpp451
-rw-r--r--src/filters/muxer/dsmmuxer/DSMMuxer.def7
-rw-r--r--src/filters/muxer/dsmmuxer/DSMMuxer.h56
-rw-r--r--src/filters/muxer/dsmmuxer/DSMMuxer.rc115
-rw-r--r--src/filters/muxer/dsmmuxer/DSMMuxer.sln94
-rw-r--r--src/filters/muxer/dsmmuxer/DSMMuxer.vcproj519
-rw-r--r--src/filters/muxer/dsmmuxer/DSMMuxer_vs2005.vcproj762
-rw-r--r--src/filters/muxer/dsmmuxer/DSMMuxer_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/muxer/dsmmuxer/resource.h15
-rw-r--r--src/filters/muxer/dsmmuxer/stdafx.cpp29
-rw-r--r--src/filters/muxer/dsmmuxer/stdafx.h47
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaFile.cpp862
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaFile.h387
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaMuxer.cpp1363
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaMuxer.def7
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaMuxer.h158
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaMuxer.rc115
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaMuxer.sln60
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaMuxer.vcproj526
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaMuxer_vs2005.vcproj773
-rw-r--r--src/filters/muxer/matroskamuxer/MatroskaMuxer_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/muxer/matroskamuxer/resource.h14
-rw-r--r--src/filters/muxer/matroskamuxer/stdafx.cpp29
-rw-r--r--src/filters/muxer/matroskamuxer/stdafx.h43
-rw-r--r--src/filters/muxer/wavdest/stdafx.cpp29
-rw-r--r--src/filters/muxer/wavdest/stdafx.h39
-rw-r--r--src/filters/muxer/wavdest/wavdest.cpp331
-rw-r--r--src/filters/muxer/wavdest/wavdest.def7
-rw-r--r--src/filters/muxer/wavdest/wavdest.h64
-rw-r--r--src/filters/muxer/wavdest/wavdest.sln39
-rw-r--r--src/filters/muxer/wavdest/wavdest.vcproj480
-rw-r--r--src/filters/muxer/wavdest/wavdest_vs2005.vcproj714
-rw-r--r--src/filters/muxer/wavdest/wavdest_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/avisplitter/AviFile.cpp525
-rw-r--r--src/filters/parser/avisplitter/AviFile.h53
-rw-r--r--src/filters/parser/avisplitter/AviReportWnd.cpp344
-rw-r--r--src/filters/parser/avisplitter/AviReportWnd.h47
-rw-r--r--src/filters/parser/avisplitter/AviSplitter.cpp854
-rw-r--r--src/filters/parser/avisplitter/AviSplitter.def7
-rw-r--r--src/filters/parser/avisplitter/AviSplitter.h86
-rw-r--r--src/filters/parser/avisplitter/AviSplitter.rc103
-rw-r--r--src/filters/parser/avisplitter/AviSplitter.sln73
-rw-r--r--src/filters/parser/avisplitter/AviSplitter.vcproj566
-rw-r--r--src/filters/parser/avisplitter/AviSplitter_vs2005.vcproj820
-rw-r--r--src/filters/parser/avisplitter/AviSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/avisplitter/resource.h14
-rw-r--r--src/filters/parser/avisplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/avisplitter/stdafx.h44
-rw-r--r--src/filters/parser/basesplitter/AsyncReader.cpp202
-rw-r--r--src/filters/parser/basesplitter/AsyncReader.h89
-rw-r--r--src/filters/parser/basesplitter/BaseSplitter.cpp1412
-rw-r--r--src/filters/parser/basesplitter/BaseSplitter.h373
-rw-r--r--src/filters/parser/basesplitter/BaseSplitterFile.cpp222
-rw-r--r--src/filters/parser/basesplitter/BaseSplitterFile.h62
-rw-r--r--src/filters/parser/basesplitter/BaseSplitterFileEx.cpp1108
-rw-r--r--src/filters/parser/basesplitter/BaseSplitterFileEx.h313
-rw-r--r--src/filters/parser/basesplitter/basesplitter.sln23
-rw-r--r--src/filters/parser/basesplitter/basesplitter.vcproj265
-rw-r--r--src/filters/parser/basesplitter/basesplitter_vs2005.vcproj380
-rw-r--r--src/filters/parser/basesplitter/basesplitter_vs2005.vcproj.POLUX.Casimir666.user121
-rw-r--r--src/filters/parser/basesplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/basesplitter/stdafx.h43
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitter.cpp616
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitter.def7
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitter.h80
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitter.rc103
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitter.sln115
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitter.vcproj570
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitterFile.cpp153
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitterFile.h26
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitter_vs2005.vcproj829
-rw-r--r--src/filters/parser/diracsplitter/DiracSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/diracsplitter/libdirac/AUTHORS36
-rw-r--r--src/filters/parser/diracsplitter/libdirac/COPYING1332
-rw-r--r--src/filters/parser/diracsplitter/libdirac/ChangeLog2235
-rw-r--r--src/filters/parser/diracsplitter/libdirac/ChangesForGuliverkli39
-rw-r--r--src/filters/parser/diracsplitter/libdirac/NEWS130
-rw-r--r--src/filters/parser/diracsplitter/libdirac/README326
-rw-r--r--src/filters/parser/diracsplitter/libdirac/README.developers406
-rw-r--r--src/filters/parser/diracsplitter/libdirac/TODO9
-rw-r--r--src/filters/parser/diracsplitter/libdirac/doc/dirac_bitstream.txt81
-rw-r--r--src/filters/parser/diracsplitter/libdirac/doc/dirac_doc_howto.txt48
-rw-r--r--src/filters/parser/diracsplitter/libdirac/doc/faq.htm216
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac.vcproj337
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/Makefile.am36
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/Makefile.in505
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/arith_codec.h643
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/arrays.h546
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/band_codec.cpp561
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/band_codec.h264
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/bit_manager.cpp422
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/bit_manager.h512
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/cmd_line.cpp77
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/cmd_line.h92
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/common.cpp440
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/common.h859
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/common_types.h65
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_assertions.cpp66
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_assertions.h80
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_types.h115
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/frame.cpp393
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/frame.h153
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/frame_buffer.cpp391
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/frame_buffer.h234
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/golomb.cpp211
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/golomb.h74
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/mot_comp.cpp597
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/mot_comp.h157
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/motion.cpp480
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/motion.h550
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/mv_codec.cpp972
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/mv_codec.h156
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/pic_io.cpp455
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/pic_io.h409
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/upconvert.cpp186
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/upconvert.h99
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/wavelet_utils.cpp614
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_common/wavelet_utils.h334
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/Makefile.am61
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/Makefile.in485
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/comp_decompress.cpp184
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/comp_decompress.h118
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/decoder_types.h63
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_cppparser.cpp453
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_cppparser.h211
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_parser.cpp272
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_parser.h194
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/frame_decompress.cpp223
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/frame_decompress.h146
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/seq_decompress.cpp258
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_decoder/seq_decompress.h174
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/Makefile.am69
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/Makefile.in478
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/comp_compress.cpp684
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/comp_compress.h112
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/dirac_encoder.cpp947
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/dirac_encoder.h508
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/frame_compress.cpp255
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/frame_compress.h133
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/quality_monitor.cpp269
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/quality_monitor.h133
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/seq_compress.cpp442
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_encoder/seq_compress.h219
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/Makefile.am27
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/Makefile.in484
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/block_match.cpp472
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/block_match.h175
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/downconvert.cpp199
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/downconvert.h94
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_mode_decn.cpp584
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_mode_decn.h163
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_subpel.cpp215
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_subpel.h116
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_utils.cpp470
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_utils.h518
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/motion_estimate.cpp242
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/motion_estimate.h108
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/pixel_match.cpp337
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_motionest/pixel_match.h144
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_vs2005.vcproj464
-rw-r--r--src/filters/parser/diracsplitter/libdirac/libdirac_vs2005.vcproj.POLUX.Casimir666.user65
-rw-r--r--src/filters/parser/diracsplitter/resource.h15
-rw-r--r--src/filters/parser/diracsplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/diracsplitter/stdafx.h62
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitter.cpp258
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitter.def7
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitter.h55
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitter.rc103
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitter.sln94
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitter.vcproj561
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitterFile.cpp397
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitterFile.h35
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitter_vs2005.vcproj813
-rw-r--r--src/filters/parser/dsmsplitter/DSMSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/dsmsplitter/resource.h14
-rw-r--r--src/filters/parser/dsmsplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/dsmsplitter/stdafx.h44
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaFile.cpp1177
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaFile.h454
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.cpp1301
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.def7
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.h124
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.rc103
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.sln81
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj558
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter_vs2005.vcproj812
-rw-r--r--src/filters/parser/matroskasplitter/MatroskaSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/matroskasplitter/resource.h14
-rw-r--r--src/filters/parser/matroskasplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/matroskasplitter/stdafx.h44
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Config/Ap4Config.h69
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries2
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Extra1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Extra.Old0
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Old0
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Repository1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Root1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4.h41
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Array.h152
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.cpp433
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.h344
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.cpp454
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.h84
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomSampleTable.cpp228
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomSampleTable.h91
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AvcCAtom.cpp46
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AvcCAtom.h57
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.cpp573
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.h154
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ChplAtom.cpp71
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ChplAtom.h62
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CmvdAtom.cpp67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CmvdAtom.h64
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.cpp153
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.h62
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Constants.h39
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ContainerAtom.cpp164
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ContainerAtom.h81
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CttsAtom.cpp115
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CttsAtom.h73
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataAtom.cpp52
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataAtom.h59
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.cpp177
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.h73
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DcomAtom.cpp46
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DcomAtom.h55
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Debug.cpp67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Debug.h51
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp165
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.h88
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp98
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Descriptor.cpp116
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Descriptor.h116
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp108
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.h50
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DrefAtom.cpp89
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DrefAtom.h56
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.cpp205
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.h78
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsdsAtom.cpp95
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsdsAtom.h61
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.cpp90
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.h65
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileByteStream.h90
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileWriter.cpp90
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileWriter.h58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FrmaAtom.cpp76
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FrmaAtom.h60
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtabAtom.cpp64
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtabAtom.h78
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtypAtom.cpp99
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtypAtom.h59
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.cpp110
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.h71
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.cpp323
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.h95
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HmhdAtom.cpp93
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HmhdAtom.h59
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.cpp96
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.h60
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Interfaces.h68
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.cpp106
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.h66
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.cpp716
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.h245
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4List.h474
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MdhdAtom.cpp172
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MdhdAtom.h76
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.cpp196
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.h71
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.cpp234
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.h70
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MvhdAtom.cpp182
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MvhdAtom.h80
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4NmhdAtom.cpp61
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4NmhdAtom.h51
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.cpp296
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.h72
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Results.h63
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.cpp93
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.h59
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.cpp638
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.h297
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SLConfigDescriptor.cpp54
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SLConfigDescriptor.h62
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Sample.cpp160
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Sample.h91
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.cpp266
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.h252
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.cpp1136
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.h368
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.cpp113
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.h58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.cpp120
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.h68
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.cpp100
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.h61
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SmhdAtom.cpp85
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SmhdAtom.h57
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.cpp151
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.h62
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StscAtom.cpp224
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StscAtom.h102
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.cpp190
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.h77
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StssAtom.cpp104
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StssAtom.h56
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StszAtom.cpp194
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StszAtom.h67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SttsAtom.cpp169
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SttsAtom.h77
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SyntheticSampleTable.cpp130
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SyntheticSampleTable.h79
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TimsAtom.cpp76
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TimsAtom.h60
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TkhdAtom.cpp187
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TkhdAtom.h105
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.cpp357
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.h115
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.cpp204
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.h85
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrefTypeAtom.cpp81
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrefTypeAtom.h58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Types.h67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UnknownDescriptor.cpp58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UnknownDescriptor.h60
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.cpp99
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.h57
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Utils.cpp335
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Utils.h103
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4VmhdAtom.cpp92
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/Ap4VmhdAtom.h58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries56
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Extra55
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Extra.Old0
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Old0
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Repository1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Root1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4AesBlockCipher.cpp1840
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4AesBlockCipher.h82
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp158
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.h47
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries2
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Extra1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Extra.Old0
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Old0
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Repository1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Root1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001.7zbin0 -> 80995 bytes
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/.cvsignore1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Aac2Mp4.mak43
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Bootstrap.mak16
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Codecs.exp10
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Codecs.mak35
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Core.exp10
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Core.mak93
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Crypto.exp10
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Crypto.mak36
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp42Aac.mak38
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Decrypt.mak38
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Dump.mak38
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Edit.mak38
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Encrypt.mak38
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Extract.mak38
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Info.mak37
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4RtpHintInfo.mak37
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Rules.mak76
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/SDK.mak50
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/System.exp10
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/System.mak36
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/TopLevel.mak128
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/any-sun-java/build.xml65
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/ppc-apple-macosx/AP4.xcode/project.pbxproj2644
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/ppc-apple-macosx/AP4.xcodeproj/project.pbxproj1888
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4.sln196
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4/AP4.vcproj155
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4/Ap4Lib.cpp0
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Aac2Mp4/Aac2Mp4.vcproj124
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Codecs/Codecs.vcproj162
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Core/Core.vcproj554
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Crypto/Crypto.vcproj173
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp42Aac/Mp42Aac.vcproj154
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Decrypt/Mp4Decrypt.vcproj124
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Dump/Mp4Dump.vcproj147
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Edit/Mp4Edit.vcproj136
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Encrypt/Mp4Encrypt.vcproj124
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Extract/Mp4Extract.vcproj124
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Info/Mp4Info.vcproj149
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4RtpHintInfo/Mp4RtpHintInfo.vcproj136
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Tag/Mp4Tag.vcproj130
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/System/System.vcproj187
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/make-sdk.sh20
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-cygwin/Local.mak67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-cygwin/Makefile1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/.cdtproject32
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/.project83
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/Local.mak67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/Makefile1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/README.eclipse5
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/README1
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Aac2Mp4/Aac2Mp4.cpp194
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp42Aac/Mp42Aac.cpp160
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Decrypt/Mp4Decrypt.cpp157
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Dump/Mp4Dump.cpp164
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Edit/Mp4Edit.cpp400
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Encrypt/Mp4Encrypt.cpp168
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Extract/Mp4Extract.cpp155
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Info/Mp4Info.cpp227
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4RtpHintInfo/Mp4RtpHintInfo.cpp146
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Tag/Mp4Tag.cpp85
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4AdtsParser.cpp303
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4AdtsParser.h105
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4BitStream.cpp250
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4BitStream.h292
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Config/Ap4Config.h67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4.h41
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Array.h152
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Atom.cpp433
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Atom.h311
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomFactory.cpp355
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomFactory.h83
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomSampleTable.cpp210
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomSampleTable.h89
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ByteStream.cpp536
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ByteStream.h152
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Constants.h39
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ContainerAtom.cpp164
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ContainerAtom.h81
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4CttsAtom.cpp115
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4CttsAtom.h73
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DataBuffer.cpp177
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DataBuffer.h73
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Debug.cpp67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Debug.h51
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp165
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderConfigDescriptor.h88
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp98
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Descriptor.cpp116
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Descriptor.h116
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DescriptorFactory.cpp108
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DescriptorFactory.h50
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DrefAtom.cpp88
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DrefAtom.h56
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsDescriptor.cpp205
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsDescriptor.h78
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsdsAtom.cpp95
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsdsAtom.h61
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4File.cpp90
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4File.h65
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileByteStream.h90
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileWriter.cpp90
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileWriter.h58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FrmaAtom.cpp76
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FrmaAtom.h60
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FtypAtom.cpp99
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FtypAtom.h59
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HdlrAtom.cpp110
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HdlrAtom.h68
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HintTrackReader.cpp323
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HintTrackReader.h95
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HmhdAtom.cpp93
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HmhdAtom.h59
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IkmsAtom.cpp96
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IkmsAtom.h60
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Interfaces.h68
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsfmAtom.cpp106
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsfmAtom.h66
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsmaCryp.cpp716
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsmaCryp.h245
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4List.h474
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MdhdAtom.cpp159
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MdhdAtom.h76
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MoovAtom.cpp116
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MoovAtom.h71
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Movie.cpp234
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Movie.h70
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MvhdAtom.cpp168
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MvhdAtom.h81
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4NmhdAtom.cpp61
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4NmhdAtom.h51
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Processor.cpp296
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Processor.h72
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Results.h63
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpAtom.cpp93
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpAtom.h59
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpHint.cpp638
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpHint.h297
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SLConfigDescriptor.cpp54
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SLConfigDescriptor.h62
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Sample.cpp160
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Sample.h88
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleDescription.cpp266
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleDescription.h250
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleEntry.cpp834
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleEntry.h288
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleTable.cpp113
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleTable.h58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SchmAtom.cpp120
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SchmAtom.h68
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SdpAtom.cpp100
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SdpAtom.h61
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SmhdAtom.cpp85
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SmhdAtom.h57
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StcoAtom.cpp151
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StcoAtom.h62
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StscAtom.cpp224
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StscAtom.h102
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StsdAtom.cpp189
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StsdAtom.h77
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StssAtom.cpp104
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StssAtom.h56
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StszAtom.cpp161
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StszAtom.h64
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SttsAtom.cpp168
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SttsAtom.h77
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SyntheticSampleTable.cpp130
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SyntheticSampleTable.h79
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TimsAtom.cpp76
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TimsAtom.h60
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TkhdAtom.cpp170
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TkhdAtom.h96
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Track.cpp325
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Track.h110
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrakAtom.cpp199
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrakAtom.h85
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrefTypeAtom.cpp81
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrefTypeAtom.h58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Types.h63
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UnknownDescriptor.cpp58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UnknownDescriptor.h60
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UrlAtom.cpp99
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UrlAtom.h57
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Utils.cpp302
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Utils.h101
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4VmhdAtom.cpp92
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4VmhdAtom.h58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4AesBlockCipher.cpp1837
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4AesBlockCipher.h82
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4StreamCipher.cpp158
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4StreamCipher.h47
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/.classpath6
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/.project17
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Atom.java130
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomFactory.java129
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomList.java43
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomParent.java7
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomUtils.java56
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AudioSampleEntry.java42
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ContainerAtom.java66
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/File.java22
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/HdlrAtom.java49
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/InvalidFormatException.java20
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Movie.java58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Mp4aSampleEntry.java10
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Mp4vSampleEntry.java10
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/MpegSampleEntry.java10
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/SampleEntry.java46
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/StsdAtom.java61
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Test.java26
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/TkhdAtom.java63
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Track.java64
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/TrakAtom.java19
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/UnknownAtom.java36
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/VideoSampleEntry.java69
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncaSampleEntry.java14
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncvSampleEntry.java14
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/IkmsAtom.java41
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/IsmaCryp.java5
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/SchmAtom.java58
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/System/StdC/Ap4StdCFileByteStream.cpp233
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Config/Ap4Config.h69
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Atom.h345
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomFactory.cpp456
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomFactory.h84
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomSampleTable.cpp266
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomSampleTable.h91
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AvcCAtom.cpp46
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AvcCAtom.h57
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ByteStream.cpp573
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ByteStream.h154
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ChplAtom.cpp71
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ChplAtom.h62
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CmvdAtom.cpp67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CmvdAtom.h64
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Co64Atom.cpp153
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Co64Atom.h62
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ContainerAtom.cpp164
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CttsAtom.cpp115
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CttsAtom.h73
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DataAtom.cpp52
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DataAtom.h59
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DcomAtom.cpp46
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DcomAtom.h55
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DrefAtom.cpp89
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4File.cpp90
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4FtabAtom.cpp64
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4FtabAtom.h78
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4HdlrAtom.cpp110
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4HdlrAtom.h71
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MdhdAtom.cpp172
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MdhdAtom.h76
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MoovAtom.cpp196
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Movie.cpp234
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Movie.h70
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MvhdAtom.cpp182
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MvhdAtom.h80
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Sample.cpp160
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Sample.h91
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleDescription.h252
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleEntry.cpp1141
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleEntry.h372
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StcoAtom.cpp152
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StscAtom.h105
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StsdAtom.cpp196
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StsdAtom.h80
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StssAtom.h56
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StszAtom.cpp194
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StszAtom.h70
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SttsAtom.cpp169
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SttsAtom.h80
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TkhdAtom.cpp187
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TkhdAtom.h105
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Track.cpp357
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Track.h115
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TrakAtom.cpp204
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TrakAtom.h85
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Types.h67
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Utils.cpp335
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Utils.h103
-rw-r--r--src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Crypto/Ap4AesBlockCipher.cpp1840
-rw-r--r--src/filters/parser/mp4splitter/Ap4AsyncReaderStream.cpp74
-rw-r--r--src/filters/parser/mp4splitter/Ap4AsyncReaderStream.h34
-rw-r--r--src/filters/parser/mp4splitter/MP4Splitter.cpp1307
-rw-r--r--src/filters/parser/mp4splitter/MP4Splitter.def7
-rw-r--r--src/filters/parser/mp4splitter/MP4Splitter.h59
-rw-r--r--src/filters/parser/mp4splitter/MP4Splitter.rc103
-rw-r--r--src/filters/parser/mp4splitter/MP4Splitter.vcproj1004
-rw-r--r--src/filters/parser/mp4splitter/MP4SplitterFile.cpp40
-rw-r--r--src/filters/parser/mp4splitter/MP4SplitterFile.h17
-rw-r--r--src/filters/parser/mp4splitter/MP4Splitter_vs2005.sln92
-rw-r--r--src/filters/parser/mp4splitter/MP4Splitter_vs2005.vcproj1400
-rw-r--r--src/filters/parser/mp4splitter/MP4Splitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/mp4splitter/readme.txt9
-rw-r--r--src/filters/parser/mp4splitter/resource.h14
-rw-r--r--src/filters/parser/mp4splitter/stdafx.cpp29
-rw-r--r--src/filters/parser/mp4splitter/stdafx.h44
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitter.cpp205
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitter.def7
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitter.h54
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitter.rc103
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitter.sln94
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitter.vcproj562
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitterFile.cpp345
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitterFile.h56
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitter_vs2005.vcproj815
-rw-r--r--src/filters/parser/mpasplitter/MpaSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/mpasplitter/resource.h15
-rw-r--r--src/filters/parser/mpasplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/mpasplitter/stdafx.h53
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitter.apsbin0 -> 18556 bytes
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitter.cpp731
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitter.def7
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitter.h76
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitter.rc103
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitter.sln94
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitter.vcproj558
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitterFile.cpp605
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitterFile.h109
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitter_vs2005.vcproj811
-rw-r--r--src/filters/parser/mpegsplitter/MpegSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/mpegsplitter/resource.h15
-rw-r--r--src/filters/parser/mpegsplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/mpegsplitter/stdafx.h51
-rw-r--r--src/filters/parser/nutsplitter/NutFile.cpp191
-rw-r--r--src/filters/parser/nutsplitter/NutFile.h124
-rw-r--r--src/filters/parser/nutsplitter/NutSplitter.cpp338
-rw-r--r--src/filters/parser/nutsplitter/NutSplitter.def7
-rw-r--r--src/filters/parser/nutsplitter/NutSplitter.h55
-rw-r--r--src/filters/parser/nutsplitter/NutSplitter.rc103
-rw-r--r--src/filters/parser/nutsplitter/NutSplitter.sln94
-rw-r--r--src/filters/parser/nutsplitter/NutSplitter.vcproj559
-rw-r--r--src/filters/parser/nutsplitter/NutSplitter_vs2005.vcproj814
-rw-r--r--src/filters/parser/nutsplitter/NutSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/nutsplitter/resource.h14
-rw-r--r--src/filters/parser/nutsplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/nutsplitter/stdafx.h51
-rw-r--r--src/filters/parser/oggsplitter/OggFile.cpp77
-rw-r--r--src/filters/parser/oggsplitter/OggFile.h76
-rw-r--r--src/filters/parser/oggsplitter/OggSplitter.cpp1046
-rw-r--r--src/filters/parser/oggsplitter/OggSplitter.def7
-rw-r--r--src/filters/parser/oggsplitter/OggSplitter.h153
-rw-r--r--src/filters/parser/oggsplitter/OggSplitter.rc103
-rw-r--r--src/filters/parser/oggsplitter/OggSplitter.sln94
-rw-r--r--src/filters/parser/oggsplitter/OggSplitter.vcproj559
-rw-r--r--src/filters/parser/oggsplitter/OggSplitter_vs2005.vcproj811
-rw-r--r--src/filters/parser/oggsplitter/OggSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/oggsplitter/resource.h14
-rw-r--r--src/filters/parser/oggsplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/oggsplitter/stdafx.h43
-rw-r--r--src/filters/parser/realmediasplitter/RealMediaSplitter.cpp2353
-rw-r--r--src/filters/parser/realmediasplitter/RealMediaSplitter.def7
-rw-r--r--src/filters/parser/realmediasplitter/RealMediaSplitter.h325
-rw-r--r--src/filters/parser/realmediasplitter/RealMediaSplitter.rc103
-rw-r--r--src/filters/parser/realmediasplitter/RealMediaSplitter.sln94
-rw-r--r--src/filters/parser/realmediasplitter/RealMediaSplitter.vcproj555
-rw-r--r--src/filters/parser/realmediasplitter/RealMediaSplitter_vs2005.vcproj814
-rw-r--r--src/filters/parser/realmediasplitter/RealMediaSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/realmediasplitter/resource.h14
-rw-r--r--src/filters/parser/realmediasplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/realmediasplitter/stdafx.h43
-rw-r--r--src/filters/parser/roqsplitter/RoQSplitter.cpp1005
-rw-r--r--src/filters/parser/roqsplitter/RoQSplitter.def7
-rw-r--r--src/filters/parser/roqsplitter/RoQSplitter.h124
-rw-r--r--src/filters/parser/roqsplitter/RoQSplitter.rc103
-rw-r--r--src/filters/parser/roqsplitter/RoQSplitter.sln94
-rw-r--r--src/filters/parser/roqsplitter/RoQSplitter.vcproj553
-rw-r--r--src/filters/parser/roqsplitter/RoQSplitter_vs2005.vcproj806
-rw-r--r--src/filters/parser/roqsplitter/RoQSplitter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/parser/roqsplitter/resource.h14
-rw-r--r--src/filters/parser/roqsplitter/stdafx.cpp29
-rw-r--r--src/filters/parser/roqsplitter/stdafx.h51
-rw-r--r--src/filters/parser/streamdrivethru/StreamDriveThru.cpp562
-rw-r--r--src/filters/parser/streamdrivethru/StreamDriveThru.def7
-rw-r--r--src/filters/parser/streamdrivethru/StreamDriveThru.h127
-rw-r--r--src/filters/parser/streamdrivethru/resource.h14
-rw-r--r--src/filters/parser/streamdrivethru/stdafx.cpp29
-rw-r--r--src/filters/parser/streamdrivethru/stdafx.h42
-rw-r--r--src/filters/parser/streamdrivethru/streamdrivethru.rc114
-rw-r--r--src/filters/parser/streamdrivethru/streamdrivethru.sln60
-rw-r--r--src/filters/parser/streamdrivethru/streamdrivethru.vcproj541
-rw-r--r--src/filters/parser/streamdrivethru/streamdrivethru_vs2005.vcproj794
-rw-r--r--src/filters/parser/streamdrivethru/streamdrivethru_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/reader/asyncreader/asyncio.cpp644
-rw-r--r--src/filters/reader/asyncreader/asyncio.h267
-rw-r--r--src/filters/reader/asyncreader/asyncrdr.cpp407
-rw-r--r--src/filters/reader/asyncreader/asyncrdr.h216
-rw-r--r--src/filters/reader/asyncreader/asyncreader.sln27
-rw-r--r--src/filters/reader/asyncreader/asyncreader.vcproj247
-rw-r--r--src/filters/reader/asyncreader/asyncreader_vs2005.vcproj359
-rw-r--r--src/filters/reader/asyncreader/asyncreader_vs2005.vcproj.POLUX.Casimir666.user121
-rw-r--r--src/filters/reader/asyncreader/stdafx.cpp8
-rw-r--r--src/filters/reader/asyncreader/stdafx.h13
-rw-r--r--src/filters/reader/cddareader/CDDAReader.cpp435
-rw-r--r--src/filters/reader/cddareader/CDDAReader.def7
-rw-r--r--src/filters/reader/cddareader/CDDAReader.h118
-rw-r--r--src/filters/reader/cddareader/cddareader.rc115
-rw-r--r--src/filters/reader/cddareader/cddareader.sln39
-rw-r--r--src/filters/reader/cddareader/cddareader.vcproj545
-rw-r--r--src/filters/reader/cddareader/cddareader_vs2005.vcproj795
-rw-r--r--src/filters/reader/cddareader/cddareader_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/reader/cddareader/resource.h14
-rw-r--r--src/filters/reader/cddareader/stdafx.cpp29
-rw-r--r--src/filters/reader/cddareader/stdafx.h42
-rw-r--r--src/filters/reader/cdxareader/CDXAReader.cpp536
-rw-r--r--src/filters/reader/cdxareader/CDXAReader.def7
-rw-r--r--src/filters/reader/cdxareader/CDXAReader.h87
-rw-r--r--src/filters/reader/cdxareader/cdxareader.rc103
-rw-r--r--src/filters/reader/cdxareader/cdxareader.sln39
-rw-r--r--src/filters/reader/cdxareader/cdxareader.vcproj544
-rw-r--r--src/filters/reader/cdxareader/cdxareader_vs2005.vcproj794
-rw-r--r--src/filters/reader/cdxareader/cdxareader_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/reader/cdxareader/resource.h14
-rw-r--r--src/filters/reader/cdxareader/stdafx.cpp29
-rw-r--r--src/filters/reader/cdxareader/stdafx.h42
-rw-r--r--src/filters/reader/udpreader/UDPReader.cpp434
-rw-r--r--src/filters/reader/udpreader/UDPReader.def7
-rw-r--r--src/filters/reader/udpreader/UDPReader.h89
-rw-r--r--src/filters/reader/udpreader/UDPReader.vcproj544
-rw-r--r--src/filters/reader/udpreader/resource.h14
-rw-r--r--src/filters/reader/udpreader/stdafx.cpp29
-rw-r--r--src/filters/reader/udpreader/stdafx.h43
-rw-r--r--src/filters/reader/udpreader/udpreader.rc116
-rw-r--r--src/filters/reader/udpreader/udpreader_vs2005.sln37
-rw-r--r--src/filters/reader/udpreader/udpreader_vs2005.vcproj803
-rw-r--r--src/filters/reader/udpreader/udpreader_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/reader/vtsreader/VTSReader.cpp216
-rw-r--r--src/filters/reader/vtsreader/VTSReader.def7
-rw-r--r--src/filters/reader/vtsreader/VTSReader.h70
-rw-r--r--src/filters/reader/vtsreader/resource.h14
-rw-r--r--src/filters/reader/vtsreader/stdafx.cpp29
-rw-r--r--src/filters/reader/vtsreader/stdafx.h41
-rw-r--r--src/filters/reader/vtsreader/vtsreader.rc116
-rw-r--r--src/filters/reader/vtsreader/vtsreader.sln60
-rw-r--r--src/filters/reader/vtsreader/vtsreader.vcproj544
-rw-r--r--src/filters/reader/vtsreader/vtsreader_vs2005.vcproj796
-rw-r--r--src/filters/reader/vtsreader/vtsreader_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/source/basesource/BaseSource.cpp188
-rw-r--r--src/filters/source/basesource/BaseSource.h127
-rw-r--r--src/filters/source/basesource/basesource.sln27
-rw-r--r--src/filters/source/basesource/basesource.vcproj245
-rw-r--r--src/filters/source/basesource/basesource_vs2005.vcproj355
-rw-r--r--src/filters/source/basesource/basesource_vs2005.vcproj.POLUX.Casimir666.user121
-rw-r--r--src/filters/source/basesource/stdafx.cpp29
-rw-r--r--src/filters/source/basesource/stdafx.h43
-rw-r--r--src/filters/source/d2vsource/D2VSource.cpp283
-rw-r--r--src/filters/source/d2vsource/D2VSource.def7
-rw-r--r--src/filters/source/d2vsource/D2VSource.h56
-rw-r--r--src/filters/source/d2vsource/MPEG2Dec.cpp4489
-rw-r--r--src/filters/source/d2vsource/MPEG2Dec.h304
-rw-r--r--src/filters/source/d2vsource/d2vsource.rc115
-rw-r--r--src/filters/source/d2vsource/d2vsource.sln39
-rw-r--r--src/filters/source/d2vsource/d2vsource.vcproj623
-rw-r--r--src/filters/source/d2vsource/d2vsource_vs2005.vcproj889
-rw-r--r--src/filters/source/d2vsource/d2vsource_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/source/d2vsource/idctfpu.cpp456
-rw-r--r--src/filters/source/d2vsource/idctmmx.asm738
-rw-r--r--src/filters/source/d2vsource/idctref.cpp362
-rw-r--r--src/filters/source/d2vsource/resource.h14
-rw-r--r--src/filters/source/d2vsource/stdafx.cpp8
-rw-r--r--src/filters/source/d2vsource/stdafx.h21
-rw-r--r--src/filters/source/dtsac3source/DTSAC3Source.cpp400
-rw-r--r--src/filters/source/dtsac3source/DTSAC3Source.def7
-rw-r--r--src/filters/source/dtsac3source/DTSAC3Source.h59
-rw-r--r--src/filters/source/dtsac3source/dtsac3source.rc115
-rw-r--r--src/filters/source/dtsac3source/dtsac3source.sln39
-rw-r--r--src/filters/source/dtsac3source/dtsac3source.vcproj540
-rw-r--r--src/filters/source/dtsac3source/dtsac3source_vs2005.vcproj790
-rw-r--r--src/filters/source/dtsac3source/dtsac3source_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/source/dtsac3source/resource.h14
-rw-r--r--src/filters/source/dtsac3source/stdafx.cpp29
-rw-r--r--src/filters/source/dtsac3source/stdafx.h42
-rw-r--r--src/filters/source/flicsource/FLICSource.cpp751
-rw-r--r--src/filters/source/flicsource/FLICSource.def7
-rw-r--r--src/filters/source/flicsource/FLICSource.h155
-rw-r--r--src/filters/source/flicsource/flicsource.rc115
-rw-r--r--src/filters/source/flicsource/flicsource.sln39
-rw-r--r--src/filters/source/flicsource/flicsource.vcproj544
-rw-r--r--src/filters/source/flicsource/flicsource_vs2005.vcproj797
-rw-r--r--src/filters/source/flicsource/flicsource_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/source/flicsource/resource.h14
-rw-r--r--src/filters/source/flicsource/stdafx.cpp29
-rw-r--r--src/filters/source/flicsource/stdafx.h42
-rw-r--r--src/filters/source/shoutcastsource/ShoutcastSource.cpp693
-rw-r--r--src/filters/source/shoutcastsource/ShoutcastSource.def7
-rw-r--r--src/filters/source/shoutcastsource/ShoutcastSource.h146
-rw-r--r--src/filters/source/shoutcastsource/resource.h14
-rw-r--r--src/filters/source/shoutcastsource/shoutcastsource.rc115
-rw-r--r--src/filters/source/shoutcastsource/shoutcastsource.sln52
-rw-r--r--src/filters/source/shoutcastsource/shoutcastsource.vcproj544
-rw-r--r--src/filters/source/shoutcastsource/shoutcastsource_vs2005.vcproj797
-rw-r--r--src/filters/source/shoutcastsource/shoutcastsource_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/source/shoutcastsource/stdafx.cpp29
-rw-r--r--src/filters/source/shoutcastsource/stdafx.h42
-rw-r--r--src/filters/source/subtitlesource/SubtitleSource.cpp785
-rw-r--r--src/filters/source/subtitlesource/SubtitleSource.def7
-rw-r--r--src/filters/source/subtitlesource/SubtitleSource.h151
-rw-r--r--src/filters/source/subtitlesource/resource.h14
-rw-r--r--src/filters/source/subtitlesource/stdafx.cpp29
-rw-r--r--src/filters/source/subtitlesource/stdafx.h42
-rw-r--r--src/filters/source/subtitlesource/subtitlesource.rc115
-rw-r--r--src/filters/source/subtitlesource/subtitlesource.sln52
-rw-r--r--src/filters/source/subtitlesource/subtitlesource.vcproj533
-rw-r--r--src/filters/source/subtitlesource/subtitlesource_vs2005.vcproj785
-rw-r--r--src/filters/source/subtitlesource/subtitlesource_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/stdafx.cpp29
-rw-r--r--src/filters/stdafx.h43
-rw-r--r--src/filters/switcher/audioswitcher/Audio.cpp314
-rw-r--r--src/filters/switcher/audioswitcher/Audio.h54
-rw-r--r--src/filters/switcher/audioswitcher/AudioSwitcher.cpp616
-rw-r--r--src/filters/switcher/audioswitcher/AudioSwitcher.def7
-rw-r--r--src/filters/switcher/audioswitcher/AudioSwitcher.h85
-rw-r--r--src/filters/switcher/audioswitcher/StreamSwitcher.cpp1295
-rw-r--r--src/filters/switcher/audioswitcher/StreamSwitcher.h279
-rw-r--r--src/filters/switcher/audioswitcher/audioswitcher.sln39
-rw-r--r--src/filters/switcher/audioswitcher/audioswitcher.vcproj502
-rw-r--r--src/filters/switcher/audioswitcher/audioswitcher_vs2005.vcproj740
-rw-r--r--src/filters/switcher/audioswitcher/audioswitcher_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/switcher/audioswitcher/stdafx.cpp29
-rw-r--r--src/filters/switcher/audioswitcher/stdafx.h42
-rw-r--r--src/filters/transform/QTDec/Copy (2) of QTDec.cpp485
-rw-r--r--src/filters/transform/QTDec/Copy (2) of QTDec.h45
-rw-r--r--src/filters/transform/QTDec/Copy of QTDec.cpp606
-rw-r--r--src/filters/transform/QTDec/Copy of QTDec.h48
-rw-r--r--src/filters/transform/QTDec/QTDec.cpp506
-rw-r--r--src/filters/transform/QTDec/QTDec.def7
-rw-r--r--src/filters/transform/QTDec/QTDec.h66
-rw-r--r--src/filters/transform/QTDec/QTDec.sln59
-rw-r--r--src/filters/transform/QTDec/QTDec.vcproj473
-rw-r--r--src/filters/transform/QTDec/stdafx.cpp29
-rw-r--r--src/filters/transform/QTDec/stdafx.h43
-rw-r--r--src/filters/transform/avi2ac3filter/AVI2AC3Filter.cpp521
-rw-r--r--src/filters/transform/avi2ac3filter/AVI2AC3Filter.def7
-rw-r--r--src/filters/transform/avi2ac3filter/AVI2AC3Filter.h66
-rw-r--r--src/filters/transform/avi2ac3filter/avi2ac3filter.rc115
-rw-r--r--src/filters/transform/avi2ac3filter/avi2ac3filter.sln39
-rw-r--r--src/filters/transform/avi2ac3filter/avi2ac3filter.vcproj540
-rw-r--r--src/filters/transform/avi2ac3filter/avi2ac3filter_vs2005.vcproj793
-rw-r--r--src/filters/transform/avi2ac3filter/avi2ac3filter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/transform/avi2ac3filter/resource.h14
-rw-r--r--src/filters/transform/avi2ac3filter/stdafx.cpp31
-rw-r--r--src/filters/transform/avi2ac3filter/stdafx.h42
-rw-r--r--src/filters/transform/basevideofilter/BaseVideoFilter.cpp666
-rw-r--r--src/filters/transform/basevideofilter/BaseVideoFilter.h92
-rw-r--r--src/filters/transform/basevideofilter/basevideofilter.sln28
-rw-r--r--src/filters/transform/basevideofilter/basevideofilter.vcproj247
-rw-r--r--src/filters/transform/basevideofilter/basevideofilter_vs2005.vcproj357
-rw-r--r--src/filters/transform/basevideofilter/basevideofilter_vs2005.vcproj.POLUX.Casimir666.user121
-rw-r--r--src/filters/transform/basevideofilter/stdafx.cpp29
-rw-r--r--src/filters/transform/basevideofilter/stdafx.h43
-rw-r--r--src/filters/transform/bufferfilter/BufferFilter.cpp352
-rw-r--r--src/filters/transform/bufferfilter/BufferFilter.def7
-rw-r--r--src/filters/transform/bufferfilter/BufferFilter.h101
-rw-r--r--src/filters/transform/bufferfilter/bufferfilter.sln39
-rw-r--r--src/filters/transform/bufferfilter/bufferfilter.vcproj490
-rw-r--r--src/filters/transform/bufferfilter/bufferfilter_vs2005.vcproj725
-rw-r--r--src/filters/transform/bufferfilter/bufferfilter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/transform/bufferfilter/stdafx.cpp29
-rw-r--r--src/filters/transform/bufferfilter/stdafx.h42
-rw-r--r--src/filters/transform/decssfilter/DeCSSFilter.cpp223
-rw-r--r--src/filters/transform/decssfilter/DeCSSFilter.def7
-rw-r--r--src/filters/transform/decssfilter/DeCSSFilter.h39
-rw-r--r--src/filters/transform/decssfilter/decssfilter.sln39
-rw-r--r--src/filters/transform/decssfilter/decssfilter.vcproj486
-rw-r--r--src/filters/transform/decssfilter/decssfilter_vs2005.vcproj721
-rw-r--r--src/filters/transform/decssfilter/decssfilter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/transform/decssfilter/stdafx.cpp29
-rw-r--r--src/filters/transform/decssfilter/stdafx.h42
-rw-r--r--src/filters/transform/mpadecfilter/IMpaDecFilter.h42
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecFilter.cpp1401
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecFilter.def7
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecFilter.h145
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecFilter.rc103
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecFilter.sln186
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecFilter.vcproj533
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecFilter_vs2005.vcproj778
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecFilter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecSettingsWnd.cpp213
-rw-r--r--src/filters/transform/mpadecfilter/MpaDecSettingsWnd.h100
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/AUTHORS22
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/COPYING340
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/ChangeLog97
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/HISTORY24
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/INSTALL58
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/NEWS46
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/README176
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/TODO12
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/doc/liba52.txt208
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/include/a52.h72
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/a52_internal.h120
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bit_allocate.c265
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bitstream.c95
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bitstream.h77
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/downmix.c655
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/imdct.c432
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/parse.c905
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/tables.h246
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/config.h124
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/inttypes.h15
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52.vcproj251
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52_vs2005.vcproj331
-rw-r--r--src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52_vs2005.vcproj.POLUX.Casimir666.user65
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/AUTHORS28
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/COPYING340
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/ChangeLog288
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/INSTALL58
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/NEWS10
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/README170
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/TODO28
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/doc/libdts.txt223
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/include/dts.h88
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/bitstream.h67
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_bitstream.c111
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_downmix.c691
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_internal.h203
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_parse.c1294
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables.h47
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_adpcm.h4122
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_fir.h2085
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_huffman.h1070
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_quantization.h86
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_vq.h2075
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/config.h145
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/inttypes.h11
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts.vcproj173
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts_vs2005.vcproj236
-rw-r--r--src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts_vs2005.vcproj.POLUX.Casimir666.user65
-rw-r--r--src/filters/transform/mpadecfilter/faad2/AUTHORS13
-rw-r--r--src/filters/transform/mpadecfilter/faad2/COPYING350
-rw-r--r--src/filters/transform/mpadecfilter/faad2/ChangeLog5
-rw-r--r--src/filters/transform/mpadecfilter/faad2/NEWS7
-rw-r--r--src/filters/transform/mpadecfilter/faad2/README122
-rw-r--r--src/filters/transform/mpadecfilter/faad2/TODO2
-rw-r--r--src/filters/transform/mpadecfilter/faad2/include/faad.h37
-rw-r--r--src/filters/transform/mpadecfilter/faad2/include/neaacdec.h257
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/analysis.h54
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/bits.c218
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/bits.h388
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/cfft.c1007
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/cfft.h58
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/cfft_tab.h1825
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb.h142
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_1.h183
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_10.h309
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_11.h412
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_2.h182
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_3.h193
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_4.h196
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_5.h193
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_6.h179
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_7.h159
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_8.h170
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_9.h369
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_sf.h273
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/common.c524
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/common.h445
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/decoder.c1140
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/decoder.h126
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/drc.c175
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/drc.h51
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/drm_dec.c967
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/drm_dec.h102
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/error.c71
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/error.h46
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/filtbank.c409
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/filtbank.h63
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/fixed.h271
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/hcr.c431
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/huffman.c561
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/huffman.h49
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ic_predict.c272
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ic_predict.h254
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/iq_table.h16460
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/is.c111
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/is.h69
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/kbd_win.h2299
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/libfaad.vcproj1020
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/libfaad_vs2005.vcproj1321
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/libfaad_vs2005.vcproj.POLUX.Casimir666.user65
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/lt_predict.c217
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/lt_predict.h68
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/mdct.c303
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/mdct.h50
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/mdct_tab.h3657
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/mp4.c296
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/mp4.h54
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ms.c79
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ms.h46
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/output.c562
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/output.h50
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/pns.c270
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/pns.h58
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.c2010
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.h153
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ps_syntax.c550
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ps_tables.h552
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/pulse.c60
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/pulse.h45
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/rvlc.c535
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/rvlc.h58
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dct.c2276
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dct.h54
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dec.c692
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dec.h255
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_e_nf.c512
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_e_nf.h52
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_fbt.c766
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_fbt.h57
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfadj.c1750
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfadj.h59
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfgen.c670
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfgen.h51
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_huff.c362
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_huff.h48
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_noise.h566
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf.c638
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf.h57
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf_c.h370
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_syntax.c885
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_syntax.h69
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_tf_grid.c263
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sbr_tf_grid.h49
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/sine_win.h4306
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/specrec.c1319
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/specrec.h51
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ssr.c177
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ssr.h61
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ssr_fb.c187
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ssr_fb.h55
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ssr_ipqf.c193
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ssr_ipqf.h48
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/ssr_win.h637
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/structs.h483
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/syntax.c2445
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/syntax.h130
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/tns.c311
-rw-r--r--src/filters/transform/mpadecfilter/faad2/libfaad/tns.h53
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/CHANGES321
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/COPYING340
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/COPYRIGHT21
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/CREDITS100
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/D.dat607
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/INSTALL183
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/Makefile.am140
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/Makefile.in792
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/README241
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/TODO70
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/VERSION7
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/aclocal.m44512
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/bit.c237
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/bit.h47
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/config.guess1391
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/config.h.in129
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/config.sub1492
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/configure11360
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/configure.ac432
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/decoder.c582
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/decoder.h91
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/depcomp464
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/fixed.c81
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/fixed.h484
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/frame.c502
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/frame.h118
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/global.h58
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/huffman.c3098
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/huffman.h66
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/imdct_l_arm.S1000
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/imdct_s.dat62
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/install-sh276
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/layer12.c510
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/layer12.h31
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/layer3.c2502
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/layer3.h30
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/libmad.list.in21
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/ltmain.sh5107
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/mad.h948
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/mad.h.sed36
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/minimad.c222
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/missing336
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/mkinstalldirs111
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/Makefile.am24
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/Makefile.in276
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/config.h130
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad.vcproj413
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad_vs2005.vcproj542
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad_vs2005.vcproj.POLUX.Casimir666.user65
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/mad.h948
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/qc_table.dat77
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/rq_table.dat8747
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/sf_table.dat106
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/stream.c160
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/stream.h107
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/synth.c857
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/synth.h69
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/timer.c485
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/timer.h100
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/version.c91
-rw-r--r--src/filters/transform/mpadecfilter/libmad-0.15.0b/version.h47
-rw-r--r--src/filters/transform/mpadecfilter/resource.h14
-rw-r--r--src/filters/transform/mpadecfilter/stdafx.cpp29
-rw-r--r--src/filters/transform/mpadecfilter/stdafx.h42
-rw-r--r--src/filters/transform/mpeg2decfilter/IMpeg2DecFilter.h55
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.cpp2179
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.def7
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.h292
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.rc103
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.sln102
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.vcproj566
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecFilter_vs2005.vcproj846
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecFilter_vs2005.vcproj.POLUX.Casimir666.user233
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecSettingsWnd.cpp217
-rw-r--r--src/filters/transform/mpeg2decfilter/Mpeg2DecSettingsWnd.h84
-rw-r--r--src/filters/transform/mpeg2decfilter/idct_mmx.objbin0 -> 10091 bytes
-rw-r--r--src/filters/transform/mpeg2decfilter/idct_sse2.cpp524
-rw-r--r--src/filters/transform/mpeg2decfilter/libmpeg2.cpp3740
-rw-r--r--src/filters/transform/mpeg2decfilter/libmpeg2.h403
-rw-r--r--src/filters/transform/mpeg2decfilter/mc_sse2.cpp645
-rw-r--r--src/filters/transform/mpeg2decfilter/motion_comp_mmx.objbin0 -> 8998 bytes
-rw-r--r--src/filters/transform/mpeg2decfilter/resource.h14
-rw-r--r--src/filters/transform/mpeg2decfilter/stdafx.cpp29
-rw-r--r--src/filters/transform/mpeg2decfilter/stdafx.h43
-rw-r--r--src/filters/transform/vsfilter/Copy.cpp561
-rw-r--r--src/filters/transform/vsfilter/DirectVobSub.cpp629
-rw-r--r--src/filters/transform/vsfilter/DirectVobSub.h124
-rw-r--r--src/filters/transform/vsfilter/DirectVobSubFilter.cpp1707
-rw-r--r--src/filters/transform/vsfilter/DirectVobSubFilter.h195
-rw-r--r--src/filters/transform/vsfilter/DirectVobSubPropPage.cpp1176
-rw-r--r--src/filters/transform/vsfilter/DirectVobSubPropPage.h207
-rw-r--r--src/filters/transform/vsfilter/IDirectVobSub.h291
-rw-r--r--src/filters/transform/vsfilter/StdAfx.cpp26
-rw-r--r--src/filters/transform/vsfilter/StdAfx.h57
-rw-r--r--src/filters/transform/vsfilter/StyleEditorDialog.cpp282
-rw-r--r--src/filters/transform/vsfilter/StyleEditorDialog.h116
-rw-r--r--src/filters/transform/vsfilter/Systray.cpp421
-rw-r--r--src/filters/transform/vsfilter/Systray.h24
-rw-r--r--src/filters/transform/vsfilter/TextInputPin.cpp46
-rw-r--r--src/filters/transform/vsfilter/TextInputPin.h40
-rw-r--r--src/filters/transform/vsfilter/VSFilter.cpp178
-rw-r--r--src/filters/transform/vsfilter/VSFilter.def10
-rw-r--r--src/filters/transform/vsfilter/VSFilter.h45
-rw-r--r--src/filters/transform/vsfilter/VSFilter.rc599
-rw-r--r--src/filters/transform/vsfilter/VSFilter.sln145
-rw-r--r--src/filters/transform/vsfilter/VSFilter.vcproj420
-rw-r--r--src/filters/transform/vsfilter/VSFilter_vs2005.sln200
-rw-r--r--src/filters/transform/vsfilter/VSFilter_vs2005.vcproj560
-rw-r--r--src/filters/transform/vsfilter/plugins.cpp716
-rw-r--r--src/filters/transform/vsfilter/res/Icon_147.icobin0 -> 894 bytes
-rw-r--r--src/filters/transform/vsfilter/res/VSFilter.manifest23
-rw-r--r--src/filters/transform/vsfilter/resource.h183
-rw-r--r--src/filters/transform/vsfilter/valami.cpp262
-rw-r--r--src/subpic/CoordGeom.cpp520
-rw-r--r--src/subpic/CoordGeom.h141
-rw-r--r--src/subpic/DX7SubPic.cpp293
-rw-r--r--src/subpic/DX7SubPic.h62
-rw-r--r--src/subpic/DX9SubPic.cpp357
-rw-r--r--src/subpic/DX9SubPic.h89
-rw-r--r--src/subpic/ISubPic.cpp861
-rw-r--r--src/subpic/ISubPic.h405
-rw-r--r--src/subpic/MemSubPic.cpp575
-rw-r--r--src/subpic/MemSubPic.h62
-rw-r--r--src/subpic/stdafx.cpp29
-rw-r--r--src/subpic/stdafx.h43
-rw-r--r--src/subpic/subpic.sln27
-rw-r--r--src/subpic/subpic.vcproj285
-rw-r--r--src/subpic/subpic.vcproj.vspscc10
-rw-r--r--src/subtitles/CCDecoder.cpp384
-rw-r--r--src/subtitles/CCDecoder.h48
-rw-r--r--src/subtitles/GFN.cpp173
-rw-r--r--src/subtitles/GFN.h29
-rw-r--r--src/subtitles/RTS.cpp2482
-rw-r--r--src/subtitles/RTS.h267
-rw-r--r--src/subtitles/Rasterizer.cpp957
-rw-r--r--src/subtitles/Rasterizer.h91
-rw-r--r--src/subtitles/SSF.cpp247
-rw-r--r--src/subtitles/SSF.h63
-rw-r--r--src/subtitles/STS.cpp3036
-rw-r--r--src/subtitles/STS.h189
-rw-r--r--src/subtitles/SubtitleInputPin.cpp344
-rw-r--r--src/subtitles/SubtitleInputPin.h53
-rw-r--r--src/subtitles/TextFile.cpp532
-rw-r--r--src/subtitles/TextFile.h78
-rw-r--r--src/subtitles/USFSubtitles.cpp772
-rw-r--r--src/subtitles/USFSubtitles.h68
-rw-r--r--src/subtitles/VobSubFile.cpp2368
-rw-r--r--src/subtitles/VobSubFile.h184
-rw-r--r--src/subtitles/VobSubFileRipper.cpp1259
-rw-r--r--src/subtitles/VobSubFileRipper.h193
-rw-r--r--src/subtitles/VobSubImage.cpp1188
-rw-r--r--src/subtitles/VobSubImage.h90
-rw-r--r--src/subtitles/libssf/Exception.cpp35
-rw-r--r--src/subtitles/libssf/Exception.h35
-rw-r--r--src/subtitles/libssf/File.cpp261
-rw-r--r--src/subtitles/libssf/File.h45
-rw-r--r--src/subtitles/libssf/Node.cpp488
-rw-r--r--src/subtitles/libssf/Node.h128
-rw-r--r--src/subtitles/libssf/NodeFactory.cpp167
-rw-r--r--src/subtitles/libssf/NodeFactory.h57
-rw-r--r--src/subtitles/libssf/Split.cpp51
-rw-r--r--src/subtitles/libssf/Split.h33
-rw-r--r--src/subtitles/libssf/Stream.cpp239
-rw-r--r--src/subtitles/libssf/Stream.h94
-rw-r--r--src/subtitles/libssf/Subtitle.cpp551
-rw-r--r--src/subtitles/libssf/Subtitle.h109
-rw-r--r--src/subtitles/libssf/SubtitleFile.cpp355
-rw-r--r--src/subtitles/libssf/SubtitleFile.h72
-rw-r--r--src/subtitles/libssf/demo/demo.ssa87
-rw-r--r--src/subtitles/libssf/demo/demo.ssf591
-rw-r--r--src/subtitles/libssf/docs/ssf-specs.txt586
-rw-r--r--src/subtitles/libssf/libssf.ncbbin0 -> 60416 bytes
-rw-r--r--src/subtitles/libssf/libssf.sln27
-rw-r--r--src/subtitles/libssf/libssf.suobin0 -> 8192 bytes
-rw-r--r--src/subtitles/libssf/libssf.vcproj299
-rw-r--r--src/subtitles/libssf/libssf.vcproj.old423
-rw-r--r--src/subtitles/libssf/stdafx.cpp29
-rw-r--r--src/subtitles/libssf/stdafx.h60
-rw-r--r--src/subtitles/stdafx.cpp29
-rw-r--r--src/subtitles/stdafx.h43
-rw-r--r--src/subtitles/subtitles.sln27
-rw-r--r--src/subtitles/subtitles.vcproj408
-rw-r--r--src/subtitles/subtitles.vcproj.vspscc10
-rw-r--r--src/ui/CmdUI/CmdUI.cpp208
-rw-r--r--src/ui/CmdUI/CmdUI.h67
-rw-r--r--src/ui/CmdUI/CmdUI.sln27
-rw-r--r--src/ui/CmdUI/CmdUI.vcproj240
-rw-r--r--src/ui/CmdUI/CmdUI.vcproj.vspscc10
-rw-r--r--src/ui/CmdUI/stdafx.cpp8
-rw-r--r--src/ui/CmdUI/stdafx.h19
-rw-r--r--src/ui/ResizableLib/Artistic-License.txt99
-rw-r--r--src/ui/ResizableLib/ResizableDialog.cpp161
-rw-r--r--src/ui/ResizableLib/ResizableDialog.h101
-rw-r--r--src/ui/ResizableLib/ResizableGrip.cpp310
-rw-r--r--src/ui/ResizableLib/ResizableGrip.h81
-rw-r--r--src/ui/ResizableLib/ResizableLayout.cpp518
-rw-r--r--src/ui/ResizableLib/ResizableLayout.h196
-rw-r--r--src/ui/ResizableLib/ResizableLib.sln27
-rw-r--r--src/ui/ResizableLib/ResizableLib.vcproj285
-rw-r--r--src/ui/ResizableLib/ResizableLib.vcproj.vspscc10
-rw-r--r--src/ui/ResizableLib/ResizableMinMax.cpp95
-rw-r--r--src/ui/ResizableLib/ResizableMinMax.h53
-rw-r--r--src/ui/ResizableLib/ResizableMsgSupport.h61
-rw-r--r--src/ui/ResizableLib/ResizableMsgSupport.inl56
-rw-r--r--src/ui/ResizableLib/ResizablePage.cpp78
-rw-r--r--src/ui/ResizableLib/ResizablePage.h78
-rw-r--r--src/ui/ResizableLib/ResizableSheet.cpp355
-rw-r--r--src/ui/ResizableLib/ResizableSheet.h114
-rw-r--r--src/ui/ResizableLib/ResizableState.cpp111
-rw-r--r--src/ui/ResizableLib/ResizableState.h38
-rw-r--r--src/ui/ResizableLib/stdafx.cpp9
-rw-r--r--src/ui/ResizableLib/stdafx.h21
-rw-r--r--src/ui/TreePropSheet/PropPageFrame.cpp195
-rw-r--r--src/ui/TreePropSheet/PropPageFrame.h306
-rw-r--r--src/ui/TreePropSheet/PropPageFrameDefault.cpp399
-rw-r--r--src/ui/TreePropSheet/PropPageFrameDefault.h119
-rw-r--r--src/ui/TreePropSheet/TreePropSheet.cpp989
-rw-r--r--src/ui/TreePropSheet/TreePropSheet.h483
-rw-r--r--src/ui/TreePropSheet/TreePropSheet.sln27
-rw-r--r--src/ui/TreePropSheet/TreePropSheet.vcproj264
-rw-r--r--src/ui/TreePropSheet/TreePropSheet.vcproj.vspscc10
-rw-r--r--src/ui/TreePropSheet/stdafx.cpp8
-rw-r--r--src/ui/TreePropSheet/stdafx.h18
-rw-r--r--src/ui/sizecbar/scbarcf.cpp234
-rw-r--r--src/ui/sizecbar/scbarcf.h78
-rw-r--r--src/ui/sizecbar/scbarg.cpp242
-rw-r--r--src/ui/sizecbar/scbarg.h113
-rw-r--r--src/ui/sizecbar/sizecbar.cpp1419
-rw-r--r--src/ui/sizecbar/sizecbar.h249
-rw-r--r--src/ui/sizecbar/sizecbar.sln27
-rw-r--r--src/ui/sizecbar/sizecbar.vcproj259
-rw-r--r--src/ui/sizecbar/sizecbar.vcproj.vspscc10
-rw-r--r--src/ui/sizecbar/stdafx.cpp8
-rw-r--r--src/ui/sizecbar/stdafx.h18
-rw-r--r--src/ui/ui.h10
-rw-r--r--src/ui/ui.sln63
-rw-r--r--src/ui/ui.suobin0 -> 24064 bytes
-rw-r--r--src/zlib/ChangeLog.txt481
-rw-r--r--src/zlib/Faq.txt100
-rw-r--r--src/zlib/Readme.txt147
-rw-r--r--src/zlib/ZLIB.DEF46
-rw-r--r--src/zlib/ZLIB.RC32
-rw-r--r--src/zlib/adler32.c48
-rw-r--r--src/zlib/algorithm.txt213
-rw-r--r--src/zlib/compress.c68
-rw-r--r--src/zlib/crc32.c162
-rw-r--r--src/zlib/deflate.c1350
-rw-r--r--src/zlib/deflate.h318
-rw-r--r--src/zlib/gzio.c875
-rw-r--r--src/zlib/infblock.c403
-rw-r--r--src/zlib/infblock.h39
-rw-r--r--src/zlib/infcodes.c251
-rw-r--r--src/zlib/infcodes.h27
-rw-r--r--src/zlib/inffast.c183
-rw-r--r--src/zlib/inffast.h17
-rw-r--r--src/zlib/inffixed.h151
-rw-r--r--src/zlib/inflate.c366
-rw-r--r--src/zlib/inftrees.c454
-rw-r--r--src/zlib/inftrees.h58
-rw-r--r--src/zlib/infutil.c87
-rw-r--r--src/zlib/infutil.h98
-rw-r--r--src/zlib/maketree.c85
-rw-r--r--src/zlib/minigzip.c320
-rw-r--r--src/zlib/trees.c1214
-rw-r--r--src/zlib/trees.h128
-rw-r--r--src/zlib/uncompr.c58
-rw-r--r--src/zlib/zconf.h279
-rw-r--r--src/zlib/zlib.h893
-rw-r--r--src/zlib/zlib.sln21
-rw-r--r--src/zlib/zlib.vcproj209
-rw-r--r--src/zlib/zutil.c225
-rw-r--r--src/zlib/zutil.h220
1781 files changed, 484362 insertions, 0 deletions
diff --git a/src/apps/asf2mkv/asf2mkv.cpp b/src/apps/asf2mkv/asf2mkv.cpp
new file mode 100644
index 000000000..d7fcc1e4d
--- /dev/null
+++ b/src/apps/asf2mkv/asf2mkv.cpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// asf2mkv.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "asf2mkv.h"
+#include "asf2mkvDlg.h"
+#include ".\asf2mkv.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+// Casf2mkvApp
+
+BEGIN_MESSAGE_MAP(Casf2mkvApp, CWinApp)
+ ON_COMMAND(ID_HELP, CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// Casf2mkvApp construction
+
+Casf2mkvApp::Casf2mkvApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+
+// The one and only Casf2mkvApp object
+
+Casf2mkvApp theApp;
+
+
+// Casf2mkvApp initialization
+
+BOOL Casf2mkvApp::InitInstance()
+{
+ // InitCommonControls() is required on Windows XP if an application
+ // manifest specifies use of ComCtl32.dll version 6 or later to enable
+ // visual styles. Otherwise, any window creation will fail.
+ InitCommonControls();
+
+ CWinApp::InitInstance();
+
+ // Standard initialization
+ // If you are not using these features and wish to reduce the size
+ // of your final executable, you should remove from the following
+ // the specific initialization routines you do not need
+ // Change the registry key under which our settings are stored
+ // TODO: You should modify this string to be something appropriate
+ // such as the name of your company or organization
+ SetRegistryKey(_T("Gabest"));
+
+ HRESULT hr;
+ if(FAILED(hr = OleInitialize(0)))
+ {
+ AfxMessageBox(_T("OleInitialize failed!"));
+ return FALSE;
+ }
+
+ Casf2mkvDlg dlg;
+ m_pMainWnd = &dlg;
+ INT_PTR nResponse = dlg.DoModal();
+ if (nResponse == IDOK)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with OK
+ }
+ else if (nResponse == IDCANCEL)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with Cancel
+ }
+
+ // Since the dialog has been closed, return FALSE so that we exit the
+ // application, rather than start the application's message pump.
+ return FALSE;
+}
+
+int Casf2mkvApp::ExitInstance()
+{
+ OleUninitialize();
+
+ return CWinApp::ExitInstance();
+}
diff --git a/src/apps/asf2mkv/asf2mkv.h b/src/apps/asf2mkv/asf2mkv.h
new file mode 100644
index 000000000..e6e49dbfb
--- /dev/null
+++ b/src/apps/asf2mkv/asf2mkv.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// asf2mkv.h : main header file for the PROJECT_NAME application
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+
+// Casf2mkvApp:
+// See asf2mkv.cpp for the implementation of this class
+//
+
+class Casf2mkvApp : public CWinApp
+{
+public:
+ Casf2mkvApp();
+
+// Overrides
+ public:
+ virtual BOOL InitInstance();
+
+// Implementation
+
+ DECLARE_MESSAGE_MAP()
+ virtual int ExitInstance();
+};
+
+extern Casf2mkvApp theApp; \ No newline at end of file
diff --git a/src/apps/asf2mkv/asf2mkv.rc b/src/apps/asf2mkv/asf2mkv.rc
new file mode 100644
index 000000000..4a4b4aa60
--- /dev/null
+++ b/src/apps/asf2mkv/asf2mkv.rc
@@ -0,0 +1,219 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\asf2mkv.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\asf2mkv.ico"
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "About asf2mkv"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
+ LTEXT "asf2mkv Version 1.01",IDC_STATIC,40,10,119,8,
+ SS_NOPREFIX
+ LTEXT "Copyright (C) 2003-2004",IDC_STATIC,40,25,119,8
+ DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP
+END
+
+IDD_ASF2MKV_DIALOG DIALOGEX 0, 0, 204, 167
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX |
+ WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_APPWINDOW
+CAPTION "asf2mkv"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "Record!",IDC_BUTTON1,147,146,50,14
+ CONTROL "",IDC_STATIC1,"Static",SS_BLACKRECT,7,7,190,119,
+ WS_EX_CLIENTEDGE
+ COMBOBOX IDC_COMBO1,7,129,190,91,CBS_DROPDOWN | CBS_AUTOHSCROLL |
+ CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Settings...",IDC_BUTTON2,95,146,50,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Records streaming windows media into the matroska container format."
+ VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "InternalName", "asf2mkv.exe"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2005 Gabest. All rights reserved."
+ VALUE "OriginalFilename", "asf2mkv.exe"
+ VALUE "ProductName", "asf2mkv recorder"
+ VALUE "ProductVersion", "1, 0, 0, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_ABOUTBOX, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 228
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 48
+ END
+
+ IDD_ASF2MKV_DIALOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 197
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 160
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_ABOUTBOX "&About asf2mkv..."
+ IDS_RECORD "Record!"
+ IDS_STOP "Stop"
+ IDS_TITLE "asf2mkv recorder"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\asf2mkv.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/apps/asf2mkv/asf2mkv.sln b/src/apps/asf2mkv/asf2mkv.sln
new file mode 100644
index 000000000..91947b933
--- /dev/null
+++ b/src/apps/asf2mkv/asf2mkv.sln
@@ -0,0 +1,79 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asf2mkv", "asf2mkv.vcproj", "{B4E3D650-306F-4F9B-A7DD-2F70C2F69007}"
+ ProjectSection(ProjectDependencies) = postProject
+ {03208025-D5C2-426A-B0FA-251D4338F30C} = {03208025-D5C2-426A-B0FA-251D4338F30C}
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} = {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F} = {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdUI", "..\..\ui\CmdUI\CmdUI.vcproj", "{03208025-D5C2-426A-B0FA-251D4338F30C}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResizableLib", "..\..\ui\ResizableLib\ResizableLib.vcproj", "{4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {B4E3D650-306F-4F9B-A7DD-2F70C2F69007}.Debug.ActiveCfg = Debug|Win32
+ {B4E3D650-306F-4F9B-A7DD-2F70C2F69007}.Debug.Build.0 = Debug|Win32
+ {B4E3D650-306F-4F9B-A7DD-2F70C2F69007}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {B4E3D650-306F-4F9B-A7DD-2F70C2F69007}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {B4E3D650-306F-4F9B-A7DD-2F70C2F69007}.Release.ActiveCfg = Release|Win32
+ {B4E3D650-306F-4F9B-A7DD-2F70C2F69007}.Release.Build.0 = Release|Win32
+ {B4E3D650-306F-4F9B-A7DD-2F70C2F69007}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {B4E3D650-306F-4F9B-A7DD-2F70C2F69007}.Release Unicode.Build.0 = Release Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug.ActiveCfg = Debug|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug.Build.0 = Debug|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release.ActiveCfg = Release|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release.Build.0 = Release|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode.Build.0 = Release Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug.ActiveCfg = Debug|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug.Build.0 = Debug|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release.ActiveCfg = Release|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release.Build.0 = Release|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}.Debug.ActiveCfg = Debug|Win32
+ {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}.Debug.Build.0 = Debug|Win32
+ {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}.Release.ActiveCfg = Release|Win32
+ {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}.Release.Build.0 = Release|Win32
+ {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {EAFA80A3-EF50-4D3F-AAC6-3D7CD873B90F}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/apps/asf2mkv/asf2mkv.vcproj b/src/apps/asf2mkv/asf2mkv.vcproj
new file mode 100644
index 000000000..07b623c7e
--- /dev/null
+++ b/src/apps/asf2mkv/asf2mkv.vcproj
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="asf2mkv"
+ ProjectGUID="{B4E3D650-306F-4F9B-A7DD-2F70C2F69007}"
+ Keyword="MFCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseD.lib filtersD.lib dsutilD.lib uiD.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="0"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib filtersR.lib dsutilR.lib uiR.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseDU.lib filtersDU.lib dsutilDU.lib uiDU.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="0"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseRU.lib filtersRU.lib dsutilRU.lib uiRU.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\asf2mkv.cpp">
+ </File>
+ <File
+ RelativePath=".\asf2mkvDlg.cpp">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\asf2mkv.h">
+ </File>
+ <File
+ RelativePath=".\asf2mkvDlg.h">
+ </File>
+ <File
+ RelativePath=".\Resource.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ <File
+ RelativePath=".\res\asf2mkv.ico">
+ </File>
+ <File
+ RelativePath=".\asf2mkv.rc">
+ </File>
+ <File
+ RelativePath=".\res\asf2mkv.rc2">
+ </File>
+ </Filter>
+ <File
+ RelativePath=".\res\asf2mkv.manifest">
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="RESOURCE_FILE"
+ Value="asf2mkv.rc"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/apps/asf2mkv/asf2mkvDlg.cpp b/src/apps/asf2mkv/asf2mkvDlg.cpp
new file mode 100644
index 000000000..cd0775abc
--- /dev/null
+++ b/src/apps/asf2mkv/asf2mkvDlg.cpp
@@ -0,0 +1,609 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// asf2mkvDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "asf2mkv.h"
+#include "asf2mkvDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#include <initguid.h>
+#include ".\asf2mkvdlg.h"
+
+// {6B6D0800-9ADA-11d0-A520-00A0D10129C0}
+DEFINE_GUID(CLSID_NetShowSource,
+0x6b6d0800, 0x9ada, 0x11d0, 0xa5, 0x20, 0x0, 0xa0, 0xd1, 0x1, 0x29, 0xc0);
+
+// CAboutDlg dialog used for App About
+
+class CAboutDlg : public CDialog
+{
+public:
+ CAboutDlg();
+
+// Dialog Data
+ enum { IDD = IDD_ABOUTBOX };
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+// Implementation
+protected:
+ DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+END_MESSAGE_MAP()
+
+// CUrlDropTarget
+
+BEGIN_MESSAGE_MAP(CUrlDropTarget, COleDropTarget)
+END_MESSAGE_MAP()
+
+DROPEFFECT CUrlDropTarget::OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+ return DROPEFFECT_NONE;
+}
+
+DROPEFFECT CUrlDropTarget::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+ UINT CF_URL = RegisterClipboardFormat(_T("UniformResourceLocator"));
+ return pDataObject->IsDataAvailable(CF_URL) ? DROPEFFECT_COPY : DROPEFFECT_NONE;
+}
+
+BOOL CUrlDropTarget::OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
+{
+ UINT CF_URL = RegisterClipboardFormat(_T("UniformResourceLocator"));
+
+ BOOL bResult = FALSE;
+
+ if(pDataObject->IsDataAvailable(CF_URL))
+ {
+ FORMATETC fmt = {CF_URL, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
+ if(HGLOBAL hGlobal = pDataObject->GetGlobalData(CF_URL, &fmt))
+ {
+ LPCSTR pText = (LPCSTR)GlobalLock(hGlobal);
+ if(AfxIsValidString(pText))
+ {
+ AfxGetMainWnd()->SendMessage(WM_OPENURL, 0, (LPARAM)pText);
+ GlobalUnlock(hGlobal);
+ bResult = TRUE;
+ }
+ }
+ }
+
+ return bResult;
+}
+
+DROPEFFECT CUrlDropTarget::OnDropEx(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point)
+{
+ return (DROPEFFECT)-1;
+}
+
+void CUrlDropTarget::OnDragLeave(CWnd* pWnd)
+{
+}
+
+DROPEFFECT CUrlDropTarget::OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point)
+{
+ return DROPEFFECT_NONE;
+}
+
+// Casf2mkvDlg dialog
+
+#define WM_GRAPHNOTIFY (WM_APP+1)
+
+Casf2mkvDlg::Casf2mkvDlg(CWnd* pParent /*=NULL*/)
+ : CResizableDialog(Casf2mkvDlg::IDD, pParent)
+ , m_fRecording(false)
+ , m_mru(0, _T("MRU"), _T("file%d"), 20, 10)
+{
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+}
+
+void Casf2mkvDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO1, m_combo);
+ DDX_Control(pDX, IDC_STATIC1, m_video);
+}
+
+
+void Casf2mkvDlg::SetupCombo()
+{
+ m_combo.ResetContent();
+ for(int i = 0; i < m_mru.GetSize(); i++)
+ if(!m_mru[i].IsEmpty())
+ m_combo.AddString(m_mru[i]);
+}
+
+void Casf2mkvDlg::SetVideoRect()
+{
+ if(pVW)
+ {
+ CRect r;
+ m_video.GetWindowRect(r);
+ r -= r.TopLeft();
+ pVW->SetWindowPosition(r.left, r.top, r.Width(), r.Height());
+ }
+}
+
+BEGIN_MESSAGE_MAP(Casf2mkvDlg, CResizableDialog)
+ ON_WM_SYSCOMMAND()
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ ON_MESSAGE(WM_GRAPHNOTIFY, OnGraphNotify)
+ ON_BN_CLICKED(IDC_BUTTON1, OnRecord)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateRecord)
+ ON_UPDATE_COMMAND_UI(IDC_COMBO1, OnUpdateFileName)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateSettings)
+ ON_UPDATE_COMMAND_UI(IDC_CHECK2, OnUpdateSettings)
+ ON_WM_SIZE()
+ ON_WM_TIMER()
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
+ ON_MESSAGE(WM_APP, OnUrlOpen)
+END_MESSAGE_MAP()
+
+
+// Casf2mkvDlg message handlers
+
+BOOL Casf2mkvDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ // Add "About..." menu item to system menu.
+
+ // IDM_ABOUTBOX must be in the system command range.
+ ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+ ASSERT(IDM_ABOUTBOX < 0xF000);
+
+ CMenu* pSysMenu = GetSystemMenu(FALSE);
+ if (pSysMenu != NULL)
+ {
+ CString strAboutMenu;
+ strAboutMenu.LoadString(IDS_ABOUTBOX);
+ if (!strAboutMenu.IsEmpty())
+ {
+ pSysMenu->AppendMenu(MF_SEPARATOR);
+ pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+ }
+ }
+
+ // Set the icon for this dialog. The framework does this automatically
+ // when the application's main window is not a dialog
+ SetIcon(m_hIcon, TRUE); // Set big icon
+ SetIcon(m_hIcon, FALSE); // Set small icon
+
+ // TODO: Add extra initialization here
+
+ AddAnchor(IDC_STATIC1, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_COMBO1, BOTTOM_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON1, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON2, BOTTOM_RIGHT);
+
+ m_mru.ReadList();
+ SetupCombo();
+
+ m_video.ModifyStyle(0, WS_CLIPCHILDREN);
+
+ SetWindowText(ResStr(IDS_TITLE));
+
+ m_urlDropTarget.Register(this);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+}
+
+BOOL Casf2mkvDlg::DestroyWindow()
+{
+ m_urlDropTarget.Revoke();
+
+ return __super::DestroyWindow();
+}
+
+void Casf2mkvDlg::OnSysCommand(UINT nID, LPARAM lParam)
+{
+ if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+ {
+ CAboutDlg dlgAbout;
+ dlgAbout.DoModal();
+ }
+ else
+ {
+ __super::OnSysCommand(nID, lParam);
+ }
+}
+
+// If you add a minimize button to your dialog, you will need the code below
+// to draw the icon. For MFC applications using the document/view model,
+// this is automatically done for you by the framework.
+
+void Casf2mkvDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // device context for painting
+
+ SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
+
+ // Center icon in client rectangle
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // Draw the icon
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ __super::OnPaint();
+ }
+}
+
+// The system calls this function to obtain the cursor to display while the user drags
+// the minimized window.
+HCURSOR Casf2mkvDlg::OnQueryDragIcon()
+{
+ return static_cast<HCURSOR>(m_hIcon);
+}
+
+
+LRESULT Casf2mkvDlg::OnGraphNotify(WPARAM wParam, LPARAM lParam)
+{
+ HRESULT hr = S_OK;
+
+ LONG evCode, evParam1, evParam2;
+ while(pME && SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0)))
+ {
+ hr = pME->FreeEventParams(evCode, evParam1, evParam2);
+
+ if(EC_COMPLETE == evCode)
+ {
+ if(m_fRecording)
+ {
+ OnRecord();
+ break;
+ }
+ }
+ }
+
+ return hr;
+}
+
+void Casf2mkvDlg::OnRecord()
+{
+ UpdateData();
+
+ HRESULT hr;
+
+ if(!m_fRecording)
+ {
+ m_fRecording = true;
+
+ UpdateDialogControls(this, FALSE);
+
+ hr = E_FAIL;
+
+ do
+ {
+ // i/o
+
+ CString src;
+ m_combo.GetWindowText(src);
+
+ CFileDialog fd(
+ FALSE, _T("mkv"), m_dst,
+ OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_EXPLORER|OFN_ENABLESIZING,
+ _T("Matroska file (*.mkv;*.mka)|*.mkv;*.mka||"),
+ this);
+ if(fd.DoModal() != IDOK) break;
+ m_dst = fd.GetPathName();
+
+ m_mru.Add(src);
+ m_mru.WriteList();
+ SetupCombo();
+ m_combo.SetWindowText(src);
+
+ if(src.Trim().IsEmpty() || m_dst.Trim().IsEmpty())
+ break;
+
+ // filer graph
+
+ if(FAILED(hr = pGB.CoCreateInstance(CLSID_FilterGraph)))
+ break;
+
+ pMC = pGB; pME = pGB; pMS = pGB; pVW = pGB; pBV = pGB;
+ if(!pMC || !pME || !pMS || !pVW || !pBV)
+ break;
+
+ if(FAILED(hr = pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0)))
+ break;
+
+ // windows media source filter
+
+ CComPtr<IBaseFilter> pSrc;
+ if(FAILED(hr = pSrc.CoCreateInstance(CLSID_NetShowSource))
+ || FAILED(hr = pGB->AddFilter(pSrc, CStringW(src)))
+ || FAILED(hr = CComQIPtr<IFileSourceFilter>(pSrc)->Load(CStringW(src), NULL)))
+ break;
+
+ // matroska muxer
+
+ CComPtr<IBaseFilter> pMux;
+ if(FAILED(hr = pMux.CoCreateInstance(__uuidof(CMatroskaMuxerFilter)))
+ && !(pMux = new CMatroskaMuxerFilter(NULL, NULL))
+ || FAILED(hr = pGB->AddFilter(pMux, L"Matroska Muxer")))
+ break;
+
+ BeginEnumPins(pSrc, pEP, pPin)
+ if(FAILED(hr = pGB->Connect(pPin, GetFirstDisconnectedPin(pMux, PINDIR_INPUT))))
+ break;
+ EndEnumPins
+
+ if(FAILED(hr))
+ break;
+
+ // file writer
+
+ CComPtr<IBaseFilter> pFW;
+ if(FAILED(hr = pFW.CoCreateInstance(CLSID_FileWriter))
+ || FAILED(hr = pGB->AddFilter(pFW, CStringW(m_dst)))
+ || FAILED(hr = CComQIPtr<IFileSinkFilter2>(pFW)->SetFileName(CStringW(m_dst), NULL))
+ || FAILED(hr = CComQIPtr<IFileSinkFilter2>(pFW)->SetMode(AM_FILE_OVERWRITE))
+ || FAILED(hr = pGB->Connect(GetFirstDisconnectedPin(pMux, PINDIR_OUTPUT), GetFirstDisconnectedPin(pFW, PINDIR_INPUT))))
+ break;
+
+ // insert inf. pin tee
+
+ BeginEnumPins(pMux, pEP, pPin)
+ {
+ PIN_DIRECTION dir;
+ CComPtr<IPin> pPinTo;
+ CMediaType mt;
+ if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_INPUT
+ || FAILED(pPin->ConnectedTo(&pPinTo))
+ || FAILED(pPin->ConnectionMediaType(&mt)))
+ continue;
+
+ // FIXME: the inf pin tee filter makes the video messed up, like when seeking
+ // onto a non-keyframe and starting to decode from that point. (audio seems to be ok)
+
+ CComPtr<IBaseFilter> pInfPinTee;
+ if(mt.majortype == MEDIATYPE_Video
+ || mt.majortype == MEDIATYPE_Audio)
+ {
+ if(FAILED(pGB->Disconnect(pPin))
+ || FAILED(pGB->Disconnect(pPinTo))
+ || FAILED(pInfPinTee.CoCreateInstance(CLSID_InfTee))
+ || FAILED(pGB->AddFilter(pInfPinTee, L"Infinite Pin Tee")))
+ continue;
+
+ if(FAILED(pGB->Connect(pPinTo, GetFirstDisconnectedPin(pInfPinTee, PINDIR_INPUT)))
+ || FAILED(pGB->Connect(GetFirstDisconnectedPin(pInfPinTee, PINDIR_OUTPUT), pPin)))
+ {
+ pGB->RemoveFilter(pInfPinTee);
+ pGB->ConnectDirect(pPinTo, pPin, NULL);
+ continue;
+ }
+ }
+
+ pPin = GetFirstDisconnectedPin(pInfPinTee, PINDIR_OUTPUT);
+
+ CComPtr<IBaseFilter> pRenderer;
+
+ if(mt.majortype == MEDIATYPE_Video)
+ {
+ if(SUCCEEDED(pRenderer.CoCreateInstance(CLSID_VideoRendererDefault))
+ || SUCCEEDED(pRenderer.CoCreateInstance(CLSID_VideoRenderer)))
+ pPinTo = ::GetFirstDisconnectedPin(pRenderer, PINDIR_INPUT);
+ }
+ else if(mt.majortype == MEDIATYPE_Audio)
+ {
+ if(SUCCEEDED(pRenderer.CoCreateInstance(CLSID_DSoundRender)))
+ pPinTo = ::GetFirstDisconnectedPin(pRenderer, PINDIR_INPUT);
+ }
+
+ if(pPin && pPinTo && pRenderer)
+ {
+ if(SUCCEEDED(pGB->AddFilter(pRenderer, L"Renderer"))
+ && FAILED(pGB->Connect(pPin, pPinTo)))
+ pGB->RemoveFilter(pRenderer);
+ }
+ }
+ EndEnumPins
+
+ // setup video window
+
+ if(SUCCEEDED(pVW->put_Owner((OAHWND)m_video.m_hWnd))
+ && SUCCEEDED(pVW->put_WindowStyle(WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN))
+ && SUCCEEDED(pVW->put_MessageDrain((OAHWND)m_hWnd)))
+ {
+ SetVideoRect();
+ }
+
+ // timer for polling the position
+
+ SetTimer(1, 500, NULL);
+
+ // go!
+
+ if(FAILED(hr = pMC->Run()))
+ break;
+
+ hr = S_OK;
+ }
+ while(false);
+
+ if(FAILED(hr)) OnRecord();
+ }
+ else
+ {
+ if(pMC) pMC->Stop();
+
+ pMC.Release(); pME.Release(); pMS.Release();
+ pVW.Release(); pBV.Release();
+ pGB.Release();
+
+ m_fRecording = false;
+
+ SetWindowText(ResStr(IDS_TITLE));
+ }
+}
+
+void Casf2mkvDlg::OnUpdateRecord(CCmdUI* pCmdUI)
+{
+ CString url;
+ m_combo.GetWindowText(url);
+ url.Trim();
+ pCmdUI->Enable(!url.IsEmpty());
+ pCmdUI->SetText(ResStr(!m_fRecording ? IDS_RECORD : IDS_STOP));
+}
+
+void Casf2mkvDlg::OnUpdateFileName(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!m_fRecording);
+}
+
+void Casf2mkvDlg::OnUpdateSettings(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!m_fRecording);
+}
+
+void Casf2mkvDlg::OnSize(UINT nType, int cx, int cy)
+{
+ CResizableDialog::OnSize(nType, cx, cy);
+
+ SetVideoRect();
+}
+
+void Casf2mkvDlg::OnTimer(UINT nIDEvent)
+{
+ if(nIDEvent == 1)
+ {
+ if(pMS)
+ {
+ REFERENCE_TIME rtPos = 0, rtDur = 0;
+ pMS->GetCurrentPosition(&rtPos);
+ pMS->GetDuration(&rtDur);
+
+ CString title;
+ if(rtDur > 0) title.Format(_T("%s (progress: %I64d%%)"), ResStr(IDS_TITLE), 100i64 * rtPos / rtDur);
+ else title = ResStr(IDS_TITLE) + _T(" (live)");
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if(CComQIPtr<IAMNetworkStatus, &IID_IAMNetworkStatus> pAMNS = pBF)
+ {
+ long BufferingProgress = 0;
+ if(SUCCEEDED(pAMNS->get_BufferingProgress(&BufferingProgress)) && BufferingProgress > 0)
+ {
+ CString str;
+ str.Format(_T(" (buffer: %d%%)"), BufferingProgress);
+ title += str;
+ }
+ break;
+ }
+ }
+ EndEnumFilters
+
+ SetWindowText(title);
+ }
+ }
+
+ CResizableDialog::OnTimer(nIDEvent);
+}
+
+void Casf2mkvDlg::OnBnClickedButton2()
+{
+ CComPtr<IBaseFilter> pBF;
+ pBF.CoCreateInstance(CLSID_NetShowSource);
+ if(pBF) ShowPPage(pBF, m_hWnd);
+}
+
+LRESULT Casf2mkvDlg::OnUrlOpen(WPARAM wParam, LPARAM lParam)
+{
+ m_combo.SetWindowText(CString((char*)lParam));
+ return 0;
+}
+
+//////////////////
+
+Casf2mkvDlg::CRecentFileAndURLList::CRecentFileAndURLList(UINT nStart, LPCTSTR lpszSection,
+ LPCTSTR lpszEntryFormat, int nSize,
+ int nMaxDispLen)
+ : CRecentFileList(nStart, lpszSection, lpszEntryFormat, nSize, nMaxDispLen)
+{
+}
+
+//#include <afximpl.h>
+extern BOOL AFXAPI AfxFullPath(LPTSTR lpszPathOut, LPCTSTR lpszFileIn);
+extern BOOL AFXAPI AfxComparePath(LPCTSTR lpszPath1, LPCTSTR lpszPath2);
+
+void Casf2mkvDlg::CRecentFileAndURLList::Add(LPCTSTR lpszPathName)
+{
+ ASSERT(m_arrNames != NULL);
+ ASSERT(lpszPathName != NULL);
+ ASSERT(AfxIsValidString(lpszPathName));
+
+ if(CString(lpszPathName).MakeLower().Find(_T("@device:")) >= 0)
+ return;
+
+ bool fURL = (CString(lpszPathName).Find(_T("://")) >= 0);
+
+ // fully qualify the path name
+ TCHAR szTemp[_MAX_PATH];
+ if(fURL) _tcscpy(szTemp, lpszPathName);
+ else AfxFullPath(szTemp, lpszPathName);
+
+ // update the MRU list, if an existing MRU string matches file name
+ int iMRU;
+ for (iMRU = 0; iMRU < m_nSize-1; iMRU++)
+ {
+ if((fURL && !_tcscmp(m_arrNames[iMRU], szTemp))
+ || AfxComparePath(m_arrNames[iMRU], szTemp))
+ break; // iMRU will point to matching entry
+ }
+ // move MRU strings before this one down
+ for (; iMRU > 0; iMRU--)
+ {
+ ASSERT(iMRU > 0);
+ ASSERT(iMRU < m_nSize);
+ m_arrNames[iMRU] = m_arrNames[iMRU-1];
+ }
+ // place this one at the beginning
+ m_arrNames[0] = szTemp;
+}
diff --git a/src/apps/asf2mkv/asf2mkvDlg.h b/src/apps/asf2mkv/asf2mkvDlg.h
new file mode 100644
index 000000000..c20117ccf
--- /dev/null
+++ b/src/apps/asf2mkv/asf2mkvDlg.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// asf2mkvDlg.h : header file
+//
+
+#pragma once
+
+#include <afxole.h>
+
+#define WM_OPENURL WM_APP
+
+class CUrlDropTarget : public COleDropTarget
+{
+public:
+ CUrlDropTarget() {}
+
+ DROPEFFECT OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+ DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+ BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+ DROPEFFECT OnDropEx(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point);
+ void OnDragLeave(CWnd* pWnd);
+ DROPEFFECT OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point);
+
+ DECLARE_MESSAGE_MAP()
+};
+
+// Casf2mkvDlg dialog
+class Casf2mkvDlg : public CResizableDialog
+{
+ CComPtr<IGraphBuilder> pGB;
+ CComQIPtr<IMediaControl> pMC;
+ CComQIPtr<IMediaEventEx> pME;
+ CComQIPtr<IMediaSeeking> pMS;
+ CComQIPtr<IVideoWindow> pVW;
+ CComQIPtr<IBasicVideo> pBV;
+
+ bool m_fRecording;
+ CString m_dst;
+
+ class CRecentFileAndURLList : public CRecentFileList
+ {
+ public:
+ CRecentFileAndURLList(UINT nStart, LPCTSTR lpszSection,
+ LPCTSTR lpszEntryFormat, int nSize,
+ int nMaxDispLen = AFX_ABBREV_FILENAME_LEN);
+
+ virtual void Add(LPCTSTR lpszPathName); // we have to override CRecentFileList::Add because the original version can't handle URLs
+ };
+
+ CRecentFileAndURLList m_mru;
+ void SetupCombo();
+
+ void SetVideoRect();
+
+ CUrlDropTarget m_urlDropTarget;
+
+// Construction
+public:
+ Casf2mkvDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ enum { IDD = IDD_ASF2MKV_DIALOG };
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+// Implementation
+protected:
+ HICON m_hIcon;
+
+ CComboBox m_combo;
+ CStatic m_video;
+
+ // Generated message map functions
+ virtual BOOL OnInitDialog();
+ virtual BOOL DestroyWindow();
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ afx_msg LRESULT OnGraphNotify(WPARAM wParam, LPARAM lParam);
+ afx_msg void OnRecord();
+ afx_msg void OnUpdateRecord(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateFileName(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateSettings(CCmdUI* pCmdUI);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnTimer(UINT nIDEvent);
+ afx_msg void OnBnClickedButton2();
+ afx_msg LRESULT OnUrlOpen(WPARAM wParam, LPARAM lParam);
+};
diff --git a/src/apps/asf2mkv/res/asf2mkv.ico b/src/apps/asf2mkv/res/asf2mkv.ico
new file mode 100644
index 000000000..8a84ca3d3
--- /dev/null
+++ b/src/apps/asf2mkv/res/asf2mkv.ico
Binary files differ
diff --git a/src/apps/asf2mkv/res/asf2mkv.manifest b/src/apps/asf2mkv/res/asf2mkv.manifest
new file mode 100644
index 000000000..b3f17a6fa
--- /dev/null
+++ b/src/apps/asf2mkv/res/asf2mkv.manifest
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="X86"
+ name="Microsoft.Windows.asf2mkv"
+ type="win32"
+/>
+<description>Your app description here</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="X86"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+</assembly>
diff --git a/src/apps/asf2mkv/res/asf2mkv.rc2 b/src/apps/asf2mkv/res/asf2mkv.rc2
new file mode 100644
index 000000000..acf1fad94
--- /dev/null
+++ b/src/apps/asf2mkv/res/asf2mkv.rc2
@@ -0,0 +1,13 @@
+//
+// asf2mkv.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/src/apps/asf2mkv/resource.h b/src/apps/asf2mkv/resource.h
new file mode 100644
index 000000000..d6b8350e2
--- /dev/null
+++ b/src/apps/asf2mkv/resource.h
@@ -0,0 +1,29 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by asf2mkv.rc
+//
+#define IDM_ABOUTBOX 0x0010
+#define IDD_ABOUTBOX 100
+#define IDS_ABOUTBOX 101
+#define IDD_ASF2MKV_DIALOG 102
+#define IDS_RECORD 102
+#define IDS_STOP 103
+#define IDS_TITLE 104
+#define IDR_MAINFRAME 128
+#define IDC_BUTTON1 1002
+#define IDC_STATIC1 1003
+#define IDC_COMBO1 1004
+#define IDC_CHECK1 1005
+#define IDC_BUTTON2 1006
+#define IDC_CHECK2 1007
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 129
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1008
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/apps/asf2mkv/stdafx.cpp b/src/apps/asf2mkv/stdafx.cpp
new file mode 100644
index 000000000..7dc1f46ff
--- /dev/null
+++ b/src/apps/asf2mkv/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+// stdafx.cpp : source file that includes just the standard includes
+// asf2mkv.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
diff --git a/src/apps/asf2mkv/stdafx.h b/src/apps/asf2mkv/stdafx.h
new file mode 100644
index 000000000..5afaba526
--- /dev/null
+++ b/src/apps/asf2mkv/stdafx.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <afxtempl.h>
+#include <afxdisp.h>
+#include <Shlwapi.h>
+#include <atlpath.h>
+#include <streams.h>
+#include <dvdmedia.h>
+
+#include "..\..\ui\ui.h"
+#include "..\..\DSUtil\DSUtil.h"
+#include "..\..\filters\filters.h"
+
+#define ResStr(id) CString(MAKEINTRESOURCE(id)) \ No newline at end of file
diff --git a/src/apps/mpcinfo/Resource.h b/src/apps/mpcinfo/Resource.h
new file mode 100644
index 000000000..ef473e336
--- /dev/null
+++ b/src/apps/mpcinfo/Resource.h
@@ -0,0 +1,16 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by mpcinfo.RC
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE 3000
+#define _APS_NEXT_CONTROL_VALUE 3000
+#define _APS_NEXT_SYMED_VALUE 3000
+#define _APS_NEXT_COMMAND_VALUE 32771
+#endif
+#endif
diff --git a/src/apps/mpcinfo/doc/mpcinfo.txt b/src/apps/mpcinfo/doc/mpcinfo.txt
new file mode 100644
index 000000000..22653f002
--- /dev/null
+++ b/src/apps/mpcinfo/doc/mpcinfo.txt
@@ -0,0 +1,72 @@
+MPCINFO.DLL by Gabest
+MPCINFO.TXT by Krofinzki
+
+The dll file reads information from Media Player Classic. Wich is a great player!
+It can be downloaded from: http://www.gabest.org/mpc.php
+
+This textfile explains how to use mpcinfo.dll with mIRC.
+
+
+Functions Explained:
+-------------------
+
+ file $dll(mpcinfo.dll,file,) returns:
+
+ File name, with path.
+ Use $nopath($dll(mpcinfo.dll,file,)) if you don't want the path
+
+
+ size $dll(mpcinfo.dll,size,) returns:
+
+ Size of the file being played (in bytes)
+
+
+ pos $dll(mpcinfo.dll,pos,) returns:
+
+ Current position of the playback in position/duration form
+
+ Example: 01:34/02:46
+
+
+ info $dll(mpcinfo.dll,info,)
+
+ All-in-one, "file, size, pos"
+
+
+ running $dll(mpcinfo.dll,running,) returns:
+
+ 0: File opened, state wrong
+ 1: File opened, state matching
+ 2: Nothing is opened, or mpc is not running
+
+
+ stopped $dll(mpcinfo.dll,stopped,) returns:
+
+ 0: File opened, state wrong
+ 1: File opened, state matching
+ 2: Nothing is opened, or mpc is not running
+
+
+ paused $dll(mpcinfo.dll,paused,) returns:
+
+ 0: File opened, state wrong
+ 1: File opened, state matching
+ 2: Nothing is opened, or mpc is not running
+
+
+Combined Example:
+----------------
+
+Add the following in remotes (Alt+R)
+
+alias mplayerc {
+ if ($dll(mpcinfo.dll,running,) != 2) {
+ if ($dll(mpcinfo.dll,file,) != $null) { me watches: $nopath($dll(mpcinfo.dll,file,)) ( $+ $dll(mpcinfo.dll,pos,) $+ ) Size: $round($calc($dll(mpcinfo.dll,size,) / 1024 / 1024 ),1) mb }
+ else { echo -a *** Couldn't retrive MplayerC information }
+ halt
+ }
+ else { echo -a *** Media Player Classic is not running }
+}
+
+Then type /mplayerc in mIRC (Also make sure your playing something in MPC :p)
+
diff --git a/src/apps/mpcinfo/mpcinfo.cpp b/src/apps/mpcinfo/mpcinfo.cpp
new file mode 100644
index 000000000..64293f639
--- /dev/null
+++ b/src/apps/mpcinfo/mpcinfo.cpp
@@ -0,0 +1,288 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// mpcinfo.cpp : Defines the initialization routines for the DLL.
+//
+
+#include "stdafx.h"
+#include "mpcinfo.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+//
+// Note!
+//
+// If this DLL is dynamically linked against the MFC
+// DLLs, any functions exported from this DLL which
+// call into MFC must have the AFX_MANAGE_STATE macro
+// added at the very beginning of the function.
+//
+// For example:
+//
+// extern "C" BOOL PASCAL EXPORT ExportedFunction()
+// {
+// AFX_MANAGE_STATE(AfxGetStaticModuleState());
+// // normal function body here
+// }
+//
+// It is very important that this macro appear in each
+// function, prior to any calls into MFC. This means that
+// it must appear as the first statement within the
+// function, even before any object variable declarations
+// as their constructors may generate calls into the MFC
+// DLL.
+//
+// Please see MFC Technical Notes 33 and 58 for additional
+// details.
+//
+
+// CmpcinfoApp
+
+BEGIN_MESSAGE_MAP(CmpcinfoApp, CWinApp)
+END_MESSAGE_MAP()
+
+
+// CmpcinfoApp construction
+
+CmpcinfoApp::CmpcinfoApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+
+// The one and only CmpcinfoApp object
+
+CmpcinfoApp theApp;
+
+
+// CmpcinfoApp initialization
+
+BOOL CmpcinfoApp::InitInstance()
+{
+ CWinApp::InitInstance();
+
+ return TRUE;
+}
+
+#include <dshow.h>
+#include <streams.h>
+#include <atlbase.h>
+
+static bool GetFilterGraph(IFilterGraph** ppFG)
+{
+ if(!ppFG) return(false);
+
+ CComPtr<IRunningObjectTable> pROT;
+ if(FAILED(GetRunningObjectTable(0, &pROT)))
+ return 1;
+
+ CComPtr<IEnumMoniker> pEM;
+ if(FAILED(pROT->EnumRunning(&pEM)))
+ return 1;
+
+ CComPtr<IBindCtx> pBindCtx;
+ CreateBindCtx(0, &pBindCtx);
+
+ for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL)
+ {
+ LPOLESTR pDispName = NULL;
+ if(FAILED(pMoniker->GetDisplayName(pBindCtx, NULL, &pDispName)))
+ continue;
+
+ CStringW strw(pDispName);
+
+ CComPtr<IMalloc> pMalloc;
+ if(FAILED(CoGetMalloc(1, &pMalloc)))
+ continue;
+ pMalloc->Free(pDispName);
+
+ if(strw.Find(L"(MPC)") < 0)
+ continue;
+
+ CComPtr<IUnknown> pUnk;
+ if(S_OK != pROT->GetObject(pMoniker, &pUnk))
+ continue;
+
+ CComQIPtr<IFilterGraph> pFG = pUnk;
+ if(!pFG)
+ continue;
+
+ *ppFG = pFG.Detach();
+
+ break;
+ }
+
+ return(!!*ppFG);
+}
+
+extern "C" int WINAPI file(HWND,HWND,char *data,char*,BOOL,BOOL)
+{
+ CComPtr<IFilterGraph> pFG;
+ if(!GetFilterGraph(&pFG))
+ return 1;
+
+ CString fn;
+
+ CComPtr<IEnumFilters> pEF;
+ if(FAILED(pFG->EnumFilters(&pEF)))
+ return 1;
+
+ ULONG cFetched = 0;
+ for(CComPtr<IBaseFilter> pBF; S_OK == pEF->Next(1, &pBF, &cFetched); pBF = NULL)
+ {
+ if(CComQIPtr<IFileSourceFilter> pFSF = pBF)
+ {
+ LPOLESTR pFileName = NULL;
+ AM_MEDIA_TYPE mt;
+ if(FAILED(pFSF->GetCurFile(&pFileName, &mt)))
+ continue;
+
+ fn = CStringW(pFileName);
+
+ CoTaskMemFree(pFileName);
+ FreeMediaType(mt);
+
+ break;
+ }
+ }
+
+ if(fn.IsEmpty())
+ return 1;
+
+ sprintf(data, _T("%s"), fn);
+
+ return 3;
+}
+
+extern "C" int WINAPI size(HWND,HWND,char *data,char*,BOOL,BOOL)
+{
+ if(file(0,0,data,0,0,0) != 3)
+ return 1;
+
+ CString fn = CStringA(data);
+ data[0] = 0;
+
+ HANDLE hFile = CreateFile(fn, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL);
+ if(hFile == INVALID_HANDLE_VALUE)
+ return 1;
+
+ LARGE_INTEGER size;
+ size.QuadPart = 0;
+ size.LowPart = GetFileSize(hFile, (DWORD*)&size.HighPart);
+
+ sprintf(data, _T("%I64d"), size.QuadPart);
+
+ CloseHandle(hFile);
+
+ return 3;
+}
+
+extern "C" int WINAPI pos(HWND,HWND,char *data,char*,BOOL,BOOL)
+{
+ CComPtr<IFilterGraph> pFG;
+ if(!GetFilterGraph(&pFG))
+ return 1;
+
+ CComQIPtr<IMediaSeeking> pMS = pFG;
+ REFERENCE_TIME pos, dur;
+ if(FAILED(pMS->GetCurrentPosition(&pos)) || FAILED(pMS->GetDuration(&dur)))
+ return 1;
+
+ if(dur > 10000000i64*60*60)
+ {
+ sprintf(data, _T("%02d:%02d:%02d/%02d:%02d:%02d"),
+ (int)(pos/10000000/60/60), (int)(pos/10000000/60)%60, (int)(pos/10000000)%60,
+ (int)(dur/10000000/60/60), (int)(dur/10000000/60)%60, (int)(dur/10000000)%60);
+ }
+ else
+ {
+ sprintf(data, _T("%02d:%02d/%02d:%02d"),
+ (int)(pos/10000000/60)%60, (int)(pos/10000000)%60,
+ (int)(dur/10000000/60)%60, (int)(dur/10000000)%60);
+ }
+
+ return 3;
+}
+
+extern "C" int WINAPI info(HWND,HWND,char *data,char*,BOOL,BOOL)
+{
+ CStringA ret;
+ if(file(0,0,data,0,0,0)!=3) return 1;
+ ret += data;
+ ret += ", ";
+ if(size(0,0,data,0,0,0)!=3) return 1;
+ ret += data;
+ ret += ", ";
+ if(pos(0,0,data,0,0,0)!=3) return 1;
+ ret += data;
+
+ strcpy(data, ret);
+
+ return 3;
+}
+
+extern "C" int WINAPI stopped(HWND,HWND,char *data,char*,BOOL,BOOL)
+{
+ sprintf(data, _T("2"));
+
+ CComPtr<IFilterGraph> pFG;
+ CComQIPtr<IMediaControl> pMC;
+ OAFilterState fs;
+ if(!GetFilterGraph(&pFG) || !(pMC = pFG) || FAILED(pMC->GetState(0, &fs)))
+ return 3;
+
+ sprintf(data, _T("%d"), fs == State_Stopped ? 1 : 0);
+
+ return 3;
+}
+
+extern "C" int WINAPI paused(HWND,HWND,char *data,char*,BOOL,BOOL)
+{
+ sprintf(data, _T("2"));
+
+ CComPtr<IFilterGraph> pFG;
+ CComQIPtr<IMediaControl> pMC;
+ OAFilterState fs;
+ if(!GetFilterGraph(&pFG) || !(pMC = pFG) || FAILED(pMC->GetState(0, &fs)))
+ return 3;
+
+ sprintf(data, _T("%d"), fs == State_Paused ? 1 : 0);
+
+ return 3;
+}
+
+extern "C" int WINAPI running(HWND,HWND,char *data,char*,BOOL,BOOL)
+{
+ sprintf(data, _T("2"));
+
+ CComPtr<IFilterGraph> pFG;
+ CComQIPtr<IMediaControl> pMC;
+ OAFilterState fs;
+ if(!GetFilterGraph(&pFG) || !(pMC = pFG) || FAILED(pMC->GetState(0, &fs)))
+ return 3;
+
+ sprintf(data, _T("%d"), fs == State_Running ? 1 : 0);
+
+ return 3;
+}
diff --git a/src/apps/mpcinfo/mpcinfo.def b/src/apps/mpcinfo/mpcinfo.def
new file mode 100644
index 000000000..ac51b673f
--- /dev/null
+++ b/src/apps/mpcinfo/mpcinfo.def
@@ -0,0 +1,13 @@
+; mpcinfo.def : Declares the module parameters for the DLL.
+
+LIBRARY "mpcinfo"
+
+EXPORTS
+ ; Explicit exports can go here
+ file
+ size
+ pos
+ info
+ stopped
+ paused
+ running \ No newline at end of file
diff --git a/src/apps/mpcinfo/mpcinfo.h b/src/apps/mpcinfo/mpcinfo.h
new file mode 100644
index 000000000..1693cdce1
--- /dev/null
+++ b/src/apps/mpcinfo/mpcinfo.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// mpcinfo.h : main header file for the mpcinfo DLL
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+
+// CmpcinfoApp
+// See mpcinfo.cpp for the implementation of this class
+//
+
+class CmpcinfoApp : public CWinApp
+{
+public:
+ CmpcinfoApp();
+
+// Overrides
+public:
+ virtual BOOL InitInstance();
+
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/src/apps/mpcinfo/mpcinfo.ncb b/src/apps/mpcinfo/mpcinfo.ncb
new file mode 100644
index 000000000..a35ff906a
--- /dev/null
+++ b/src/apps/mpcinfo/mpcinfo.ncb
Binary files differ
diff --git a/src/apps/mpcinfo/mpcinfo.rc b/src/apps/mpcinfo/mpcinfo.rc
new file mode 100644
index 000000000..7dd7e5740
--- /dev/null
+++ b/src/apps/mpcinfo/mpcinfo.rc
@@ -0,0 +1,135 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\mpcinfo.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "plugin dll for mirc"
+ VALUE "FileVersion", "1.0.0.0"
+ VALUE "InternalName", "mpcinfo.dll"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2005 Gabest. All rights reserved."
+ VALUE "OriginalFilename", "mpcinfo.dll"
+ VALUE "ProductName", "mpcinfo"
+ VALUE "ProductVersion", "1.0.0.0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\mpcinfo.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/apps/mpcinfo/mpcinfo.sln b/src/apps/mpcinfo/mpcinfo.sln
new file mode 100644
index 000000000..7d4123f10
--- /dev/null
+++ b/src/apps/mpcinfo/mpcinfo.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpcinfo", "mpcinfo.vcproj", "{AF754B6B-75F8-4A8A-9A98-2E34DB02D4A8}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {AF754B6B-75F8-4A8A-9A98-2E34DB02D4A8}.Debug.ActiveCfg = Debug|Win32
+ {AF754B6B-75F8-4A8A-9A98-2E34DB02D4A8}.Debug.Build.0 = Debug|Win32
+ {AF754B6B-75F8-4A8A-9A98-2E34DB02D4A8}.Release.ActiveCfg = Release|Win32
+ {AF754B6B-75F8-4A8A-9A98-2E34DB02D4A8}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/apps/mpcinfo/mpcinfo.suo b/src/apps/mpcinfo/mpcinfo.suo
new file mode 100644
index 000000000..9559d4194
--- /dev/null
+++ b/src/apps/mpcinfo/mpcinfo.suo
Binary files differ
diff --git a/src/apps/mpcinfo/mpcinfo.vcproj b/src/apps/mpcinfo/mpcinfo.vcproj
new file mode 100644
index 000000000..3d00b0643
--- /dev/null
+++ b/src/apps/mpcinfo/mpcinfo.vcproj
@@ -0,0 +1,190 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="mpcinfo"
+ ProjectGUID="{AF754B6B-75F8-4A8A-9A98-2E34DB02D4A8}"
+ Keyword="MFCDLLProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/mpcinfo.dll"
+ LinkIncremental="2"
+ ModuleDefinitionFile=".\mpcinfo.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ ImportLibrary="$(OutDir)/mpcinfo.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="delayimp.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/mpcinfo.dll"
+ LinkIncremental="1"
+ ModuleDefinitionFile=".\mpcinfo.def"
+ DelayLoadDLLs="oleacc.dll"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/mpcinfo.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="mpcinfo.cpp">
+ </File>
+ <File
+ RelativePath="mpcinfo.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="mpcinfo.h">
+ </File>
+ <File
+ RelativePath="Resource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath="mpcinfo.rc">
+ </File>
+ <File
+ RelativePath="res\mpcinfo.rc2">
+ </File>
+ </Filter>
+ <File
+ RelativePath="ReadMe.txt">
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/apps/mpcinfo/res/mpcinfo.rc2 b/src/apps/mpcinfo/res/mpcinfo.rc2
new file mode 100644
index 000000000..7dc6c48dc
--- /dev/null
+++ b/src/apps/mpcinfo/res/mpcinfo.rc2
@@ -0,0 +1,13 @@
+//
+// mpcinfo.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/src/apps/mpcinfo/stdafx.cpp b/src/apps/mpcinfo/stdafx.cpp
new file mode 100644
index 000000000..92b493be5
--- /dev/null
+++ b/src/apps/mpcinfo/stdafx.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// mpcinfo.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
diff --git a/src/apps/mpcinfo/stdafx.h b/src/apps/mpcinfo/stdafx.h
new file mode 100644
index 000000000..cf7d4edb4
--- /dev/null
+++ b/src/apps/mpcinfo/stdafx.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxole.h> // MFC OLE classes
+#include <afxodlgs.h> // MFC OLE dialog classes
+#include <afxdisp.h> // MFC Automation classes
+#endif // _AFX_NO_OLE_SUPPORT
+
+#ifndef _AFX_NO_DB_SUPPORT
+#include <afxdb.h> // MFC ODBC database classes
+#endif // _AFX_NO_DB_SUPPORT
+
+#ifndef _AFX_NO_DAO_SUPPORT
+#include <afxdao.h> // MFC DAO database classes
+#endif // _AFX_NO_DAO_SUPPORT
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
diff --git a/src/apps/mplayerc/AuthDlg.cpp b/src/apps/mplayerc/AuthDlg.cpp
new file mode 100644
index 000000000..204d67816
--- /dev/null
+++ b/src/apps/mplayerc/AuthDlg.cpp
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+// AuthDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "AuthDlg.h"
+
+// CAuthDlg dialog
+
+IMPLEMENT_DYNAMIC(CAuthDlg, CDialog)
+CAuthDlg::CAuthDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CAuthDlg::IDD, pParent)
+ , m_username(_T(""))
+ , m_password(_T(""))
+ , m_remember(FALSE)
+{
+}
+
+CAuthDlg::~CAuthDlg()
+{
+}
+
+void CAuthDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO1, m_usernamectrl);
+ DDX_Text(pDX, IDC_COMBO1, m_username);
+ DDX_Text(pDX, IDC_EDIT3, m_password);
+ DDX_Check(pDX, IDC_CHECK1, m_remember);
+}
+
+CString CAuthDlg::DEncrypt(CString str)
+{
+ for(int i = 0; i < str.GetLength(); i++)
+ str.SetAt(i, str[i]^5);
+ return str;
+}
+
+
+BEGIN_MESSAGE_MAP(CAuthDlg, CDialog)
+ ON_BN_CLICKED(IDOK, OnBnClickedOk)
+ ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
+ ON_EN_SETFOCUS(IDC_EDIT3, OnEnSetfocusEdit3)
+END_MESSAGE_MAP()
+
+
+// CAuthDlg message handlers
+
+BOOL CAuthDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ CWinApp* pApp = AfxGetApp();
+
+ if(pApp->m_pszRegistryKey)
+ {
+ CRegKey hSecKey(pApp->GetSectionKey(ResStr(IDS_R_LOGINS)));
+ if(hSecKey)
+ {
+ int i = 0;
+ TCHAR username[256], password[256];
+ while(1)
+ {
+ DWORD unlen = countof(username);
+ DWORD pwlen = sizeof(password);
+ DWORD type = REG_SZ;
+ if(ERROR_SUCCESS == RegEnumValue(
+ hSecKey, i++, username, &unlen, 0, &type, (BYTE*)password, &pwlen))
+ {
+ m_logins[username] = DEncrypt(password);
+ m_usernamectrl.AddString(username);
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ CAutoVectorPtr<TCHAR> buff;
+ buff.Allocate(32767/sizeof(TCHAR));
+
+ DWORD len = GetPrivateProfileSection(
+ ResStr(IDS_R_LOGINS), buff, 32767/sizeof(TCHAR), pApp->m_pszProfileName);
+
+ TCHAR* p = buff;
+ while(*p && len > 0)
+ {
+ CString str = p;
+ p += str.GetLength()+1;
+ len -= str.GetLength()+1;
+ CAtlList<CString> sl;
+ Explode(str, sl, '=', 2);
+ if(sl.GetCount() == 2)
+ {
+ m_logins[sl.GetHead()] = DEncrypt(sl.GetTail());
+ m_usernamectrl.AddString(sl.GetHead());
+ }
+ }
+ }
+
+ m_usernamectrl.SetFocus();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CAuthDlg::OnBnClickedOk()
+{
+ UpdateData();
+
+ if(!m_username.IsEmpty())
+ {
+ CWinApp* pApp = AfxGetApp();
+ pApp->WriteProfileString(ResStr(IDS_R_LOGINS), m_username, m_remember ? DEncrypt(m_password) : _T(""));
+ }
+
+ OnOK();
+}
+
+
+void CAuthDlg::OnCbnSelchangeCombo1()
+{
+ CString username;
+ m_usernamectrl.GetLBText(m_usernamectrl.GetCurSel(), username);
+
+ CString password;
+ if(m_logins.Lookup(username, password))
+ {
+ m_password = password;
+ m_remember = TRUE;
+ UpdateData(FALSE);
+ }
+}
+
+void CAuthDlg::OnEnSetfocusEdit3()
+{
+ UpdateData();
+
+ CString password;
+ if(m_logins.Lookup(m_username, password))
+ {
+ m_password = password;
+ m_remember = TRUE;
+ UpdateData(FALSE);
+ }
+}
diff --git a/src/apps/mplayerc/AuthDlg.h b/src/apps/mplayerc/AuthDlg.h
new file mode 100644
index 000000000..86e9b496c
--- /dev/null
+++ b/src/apps/mplayerc/AuthDlg.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxwin.h"
+
+
+// CAuthDlg dialog
+
+class CAuthDlg : public CDialog
+{
+ DECLARE_DYNAMIC(CAuthDlg)
+
+private:
+ CString DEncrypt(CString pw);
+ CMapStringToString m_logins;
+
+public:
+ CAuthDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~CAuthDlg();
+
+// Dialog Data
+ enum { IDD = IDD_AUTH_DLG };
+ CComboBox m_usernamectrl;
+ CString m_username;
+ CString m_password;
+ BOOL m_remember;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedOk();
+ afx_msg void OnCbnSelchangeCombo1();
+ afx_msg void OnEnSetfocusEdit3();
+};
diff --git a/src/apps/mplayerc/BaseGraph.cpp b/src/apps/mplayerc/BaseGraph.cpp
new file mode 100644
index 000000000..87a63200a
--- /dev/null
+++ b/src/apps/mplayerc/BaseGraph.cpp
@@ -0,0 +1,354 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "basegraph.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+//
+// CPlayerWindow
+//
+
+BOOL CPlayerWindow::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!CWnd::PreCreateWindow(cs))
+ return FALSE;
+
+ cs.style &= ~WS_BORDER;
+ cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
+ ::LoadCursor(NULL, IDC_HAND), NULL, NULL);
+
+ return TRUE;
+}
+
+BEGIN_MESSAGE_MAP(CPlayerWindow, CWnd)
+ ON_WM_ERASEBKGND()
+END_MESSAGE_MAP()
+
+BOOL CPlayerWindow::OnEraseBkgnd(CDC* pDC)
+{
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
+ {
+ if(!pChild->IsWindowVisible()) continue;
+
+ CRect r;
+ pChild->GetClientRect(&r);
+ pChild->MapWindowPoints(this, &r);
+ pDC->ExcludeClipRect(&r);
+ }
+
+ CRect r;
+ GetClientRect(&r);
+ pDC->FillSolidRect(&r, 0);
+
+ return TRUE;
+}
+
+//
+// CBaseGraph
+//
+
+CBaseGraph::CBaseGraph()
+ : CUnknown(NAME("CBaseGraph"), NULL)
+ , m_hNotifyWnd(NULL)
+{
+}
+
+CBaseGraph::~CBaseGraph()
+{
+}
+
+STDMETHODIMP CBaseGraph::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IFilterGraph)
+ QI(IGraphBuilder)
+ QI(IFilterGraph2)
+ QI(IGraphBuilder2)
+ QI(IMediaControl)
+ QI(IMediaSeeking)
+ QI(IMediaEventEx)
+ QI(IVideoWindow)
+ QI(IBasicVideo)
+ QI(IBasicAudio)
+ QI(IAMOpenProgress)
+ QI(IGraphEngine)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+void CBaseGraph::ClearMessageQueue()
+{
+ while(!m_msgqueue.IsEmpty())
+ {
+ GMSG msg = m_msgqueue.RemoveHead();
+ FreeEventParams(msg.m_lEventCode, msg.m_lParam1, msg.m_lParam2);
+ }
+}
+
+
+void CBaseGraph::NotifyEvent(long lEventCode, LONG_PTR lParam1, LONG_PTR lParam2)
+{
+ if(!m_hNotifyWnd) return;
+
+ GMSG msg;
+ msg.m_lEventCode = lEventCode;
+ msg.m_lParam1 = lParam1;
+ msg.m_lParam2 = lParam2;
+ m_msgqueue.AddTail(msg);
+
+ PostMessage((HWND)m_hNotifyWnd, m_lNotifyMsg, 0, m_lNotifyInstData);
+}
+
+// IDispatch
+STDMETHODIMP CBaseGraph::GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) {return E_NOTIMPL;}
+
+// IFilterGraph
+STDMETHODIMP CBaseGraph::AddFilter(IBaseFilter* pFilter, LPCWSTR pName) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::RemoveFilter(IBaseFilter* pFilter) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::EnumFilters(IEnumFilters** ppEnum) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::ConnectDirect(IPin* ppinOut, IPin* ppinIn, const AM_MEDIA_TYPE* pmt) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::Reconnect(IPin* ppin) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::Disconnect(IPin* ppin) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetDefaultSyncSource() {return E_NOTIMPL;}
+
+// IGraphBuilder
+STDMETHODIMP CBaseGraph::Connect(IPin* ppinOut, IPin* ppinIn) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::Render(IPin* ppinOut) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter) {*ppFilter = NULL; return RenderFile(lpcwstrFileName, NULL);}//E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetLogFile(DWORD_PTR hFile) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::Abort() {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::ShouldOperationContinue() {return E_NOTIMPL;}
+
+// IFilterGraph2
+STDMETHODIMP CBaseGraph::AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext) {return E_NOTIMPL;}
+
+// IGraphBuilder2
+STDMETHODIMP CBaseGraph::IsPinDirection(IPin* pPin, PIN_DIRECTION dir) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::IsPinConnected(IPin* pPin) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::ConnectFilter(IBaseFilter* pBF, IPin* pPinIn) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::ConnectFilter(IPin* pPinOut, IBaseFilter* pBF) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::NukeDownstream(IUnknown* pUnk) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::FindInterface(REFIID iid, void** ppv, BOOL bRemove) {return QueryInterface(iid, ppv);}
+STDMETHODIMP CBaseGraph::AddToROT() {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::RemoveFromROT() {return E_NOTIMPL;}
+
+// IMediaControl
+STDMETHODIMP CBaseGraph::Run() {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::Pause() {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::Stop() {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetState(LONG msTimeout, OAFilterState* pfs) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::RenderFile(BSTR strFilename) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::AddSourceFilter(BSTR strFilename, IDispatch** ppUnk) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_FilterCollection(IDispatch** ppUnk) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_RegFilterCollection(IDispatch** ppUnk) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::StopWhenReady() {return Stop();}
+
+// IMediaEvent
+STDMETHODIMP CBaseGraph::GetEventHandle(OAEVENT* hEvent) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetEvent(long* lEventCode, LONG_PTR* lParam1, LONG_PTR* lParam2, long msTimeout)
+{
+ if(m_msgqueue.IsEmpty()) return E_FAIL;
+
+ GMSG msg = m_msgqueue.RemoveHead();
+ if(lEventCode) *lEventCode = msg.m_lEventCode;
+ if(lParam1) *lParam1 = msg.m_lParam1;
+ if(lParam2) *lParam2 = msg.m_lParam2;
+
+ return S_OK;
+}
+STDMETHODIMP CBaseGraph::WaitForCompletion(long msTimeout, long* pEvCode) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::CancelDefaultHandling(long lEvCode) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::RestoreDefaultHandling(long lEvCode) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::FreeEventParams(long lEvCode, LONG_PTR lParam1, LONG_PTR lParam2)
+{
+ if(EC_BG_ERROR == lEvCode)
+ {
+ if(lParam1) CoTaskMemFree((void*)lParam1);
+ }
+
+ return S_OK;
+}
+
+// IMediaEventEx
+STDMETHODIMP CBaseGraph::SetNotifyWindow(OAHWND hwnd, long lMsg, LONG_PTR lInstanceData)
+{
+ m_hNotifyWnd = hwnd;
+ m_lNotifyMsg = lMsg;
+ m_lNotifyInstData = lInstanceData;
+
+ if(!IsWindow((HWND)m_hNotifyWnd))
+ {
+ m_hNotifyWnd = NULL;
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+STDMETHODIMP CBaseGraph::SetNotifyFlags(long lNoNotifyFlags) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetNotifyFlags(long* lplNoNotifyFlags) {return E_NOTIMPL;}
+
+// IMediaSeeking
+STDMETHODIMP CBaseGraph::GetCapabilities(DWORD* pCapabilities)
+{
+ return pCapabilities ? *pCapabilities = AM_SEEKING_CanSeekAbsolute|AM_SEEKING_CanGetCurrentPos|AM_SEEKING_CanGetDuration, S_OK : E_POINTER;
+}
+STDMETHODIMP CBaseGraph::CheckCapabilities(DWORD* pCapabilities)
+{
+ CheckPointer(pCapabilities, E_POINTER);
+
+ if(*pCapabilities == 0) return S_OK;
+
+ DWORD caps;
+ GetCapabilities(&caps);
+
+ DWORD caps2 = caps & *pCapabilities;
+
+ return caps2 == 0 ? E_FAIL : caps2 == *pCapabilities ? S_OK : S_FALSE;
+}
+STDMETHODIMP CBaseGraph::IsFormatSupported(const GUID* pFormat)
+{
+ return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;
+}
+STDMETHODIMP CBaseGraph::QueryPreferredFormat(GUID* pFormat)
+{
+ return GetTimeFormat(pFormat);
+}
+STDMETHODIMP CBaseGraph::GetTimeFormat(GUID* pFormat)
+{
+ return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;
+}
+STDMETHODIMP CBaseGraph::IsUsingTimeFormat(const GUID* pFormat)
+{
+ return IsFormatSupported(pFormat);
+}
+STDMETHODIMP CBaseGraph::SetTimeFormat(const GUID* pFormat)
+{
+ return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;
+}
+STDMETHODIMP CBaseGraph::GetDuration(LONGLONG* pDuration) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetStopPosition(LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetCurrentPosition(LONGLONG* pCurrent) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetRate(double dRate) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetRate(double* pdRate) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetPreroll(LONGLONG* pllPreroll) {return E_NOTIMPL;}
+
+// IVideoWindow
+STDMETHODIMP CBaseGraph::put_Caption(BSTR strCaption) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_Caption(BSTR* strCaption) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_WindowStyle(long WindowStyle) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_WindowStyle(long* WindowStyle) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_WindowStyleEx(long WindowStyleEx) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_WindowStyleEx(long* WindowStyleEx) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_AutoShow(long AutoShow) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_AutoShow(long* AutoShow) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_WindowState(long WindowState) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_WindowState(long* WindowState) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_BackgroundPalette(long BackgroundPalette) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_BackgroundPalette(long* pBackgroundPalette) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_Visible(long Visible) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_Visible(long* pVisible) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_Left(long Left) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_Left(long* pLeft) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_Width(long Width) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_Width(long* pWidth) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_Top(long Top) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_Top(long* pTop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_Height(long Height) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_Height(long* pHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_Owner(OAHWND Owner) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_Owner(OAHWND* Owner) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_MessageDrain(OAHWND Drain) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_MessageDrain(OAHWND* Drain) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_BorderColor(long* Color) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_BorderColor(long Color) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_FullScreenMode(long* FullScreenMode) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_FullScreenMode(long FullScreenMode) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetWindowForeground(long Focus) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::NotifyOwnerMessage(OAHWND hwnd, long uMsg, LONG_PTR wParam, LONG_PTR lParam) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetWindowPosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetWindowPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetMinIdealImageSize(long* pWidth, long* pHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetMaxIdealImageSize(long* pWidth, long* pHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetRestorePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::HideCursor(long HideCursor) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::IsCursorHidden(long* CursorHidden) {return E_NOTIMPL;}
+
+// IBasicVideo
+STDMETHODIMP CBaseGraph::get_AvgTimePerFrame(REFTIME* pAvgTimePerFrame) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_BitRate(long* pBitRate) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_BitErrorRate(long* pBitErrorRate) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_VideoWidth(long* pVideoWidth) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_VideoHeight(long* pVideoHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_SourceLeft(long SourceLeft) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_SourceLeft(long* pSourceLeft) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_SourceWidth(long SourceWidth) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_SourceWidth(long* pSourceWidth) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_SourceTop(long SourceTop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_SourceTop(long* pSourceTop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_SourceHeight(long SourceHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_SourceHeight(long* pSourceHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_DestinationLeft(long DestinationLeft) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_DestinationLeft(long* pDestinationLeft) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_DestinationWidth(long DestinationWidth) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_DestinationWidth(long* pDestinationWidth) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_DestinationTop(long DestinationTop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_DestinationTop(long* pDestinationTop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_DestinationHeight(long DestinationHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_DestinationHeight(long* pDestinationHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetSourcePosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetSourcePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetDefaultSourcePosition() {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetDestinationPosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetDestinationPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::SetDefaultDestinationPosition() {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetVideoSize(long* pWidth, long* pHeight) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetVideoPaletteEntries(long StartIndex, long Entries, long* pRetrieved, long* pPalette) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::GetCurrentImage(long* pBufferSize, long* pDIBImage) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::IsUsingDefaultSource() {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::IsUsingDefaultDestination() {return E_NOTIMPL;}
+
+// IBasicAudio
+STDMETHODIMP CBaseGraph::put_Volume(long lVolume) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_Volume(long* plVolume) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::put_Balance(long lBalance) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::get_Balance(long* plBalance) {return E_NOTIMPL;}
+
+// IAMOpenProgress
+STDMETHODIMP CBaseGraph::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent) {return E_NOTIMPL;}
+STDMETHODIMP CBaseGraph::AbortOperation() {return E_NOTIMPL;}
+
+// IGraphEngine
+STDMETHODIMP_(engine_t) CBaseGraph::GetEngine() {return DirectShow;}
+
diff --git a/src/apps/mplayerc/BaseGraph.h b/src/apps/mplayerc/BaseGraph.h
new file mode 100644
index 000000000..fd56597be
--- /dev/null
+++ b/src/apps/mplayerc/BaseGraph.h
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "IGraphBuilder2.h"
+
+class CPlayerWindow : public CWnd
+{
+public:
+ CPlayerWindow() {}
+
+protected:
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ DECLARE_MESSAGE_MAP()
+};
+
+typedef enum {DirectShow = 0, RealMedia, QuickTime, ShockWave} engine_t;
+
+[uuid("B110CDE5-6331-4118-8AAF-A870D6F7E2E4")]
+interface IGraphEngine : public IUnknown
+{
+ STDMETHOD_(engine_t, GetEngine) () = 0;
+};
+
+enum
+{
+ EC_BG_AUDIO_CHANGED = EC_USER+1,
+ EC_BG_ERROR
+};
+
+class CBaseGraph
+ : public CUnknown
+ , public IGraphBuilder2
+ , public IMediaControl
+ , public IMediaEventEx
+ , public IMediaSeeking
+ , public IVideoWindow
+ , public IBasicVideo
+ , public IBasicAudio
+ , public IAMOpenProgress
+ , public IGraphEngine
+{
+ OAHWND m_hNotifyWnd;
+ long m_lNotifyMsg;
+ LONG_PTR m_lNotifyInstData;
+
+ typedef struct {long m_lEventCode; LONG_PTR m_lParam1, m_lParam2;} GMSG;
+ CList<GMSG> m_msgqueue;
+
+protected:
+ void ClearMessageQueue();
+
+public:
+ CBaseGraph();
+ virtual ~CBaseGraph();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ void NotifyEvent(long lEventCode, LONG_PTR lParam1 = 0, LONG_PTR lParam2 = 0);
+
+protected:
+ // IDispatch
+ STDMETHODIMP GetTypeInfoCount(UINT* pctinfo);
+ STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo);
+ STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId);
+ STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr);
+
+ // IFilterGraph
+ STDMETHODIMP AddFilter(IBaseFilter* pFilter, LPCWSTR pName);
+ STDMETHODIMP RemoveFilter(IBaseFilter* pFilter);
+ STDMETHODIMP EnumFilters(IEnumFilters** ppEnum);
+ STDMETHODIMP FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter);
+ STDMETHODIMP ConnectDirect(IPin* ppinOut, IPin* ppinIn, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP Reconnect(IPin* ppin);
+ STDMETHODIMP Disconnect(IPin* ppin);
+ STDMETHODIMP SetDefaultSyncSource();
+
+ // IGraphBuilder
+ STDMETHODIMP Connect(IPin* ppinOut, IPin* ppinIn);
+ STDMETHODIMP Render(IPin* ppinOut);
+ STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
+ STDMETHODIMP AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter);
+ STDMETHODIMP SetLogFile(DWORD_PTR hFile);
+ STDMETHODIMP Abort();
+ STDMETHODIMP ShouldOperationContinue();
+
+ // IFilterGraph2
+ STDMETHODIMP AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter);
+ STDMETHODIMP ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext);
+
+ // IGraphBuilder2
+ STDMETHODIMP IsPinDirection(IPin* pPin, PIN_DIRECTION dir);
+ STDMETHODIMP IsPinConnected(IPin* pPin);
+ STDMETHODIMP ConnectFilter(IBaseFilter* pBF, IPin* pPinIn);
+ STDMETHODIMP ConnectFilter(IPin* pPinOut, IBaseFilter* pBF);
+ STDMETHODIMP ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP NukeDownstream(IUnknown* pUnk);
+ STDMETHODIMP FindInterface(REFIID iid, void** ppv, BOOL bRemove);
+ STDMETHODIMP AddToROT();
+ STDMETHODIMP RemoveFromROT();
+
+ // IMediaControl
+ STDMETHODIMP Run();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Stop();
+ STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
+ STDMETHODIMP RenderFile(BSTR strFilename);
+ STDMETHODIMP AddSourceFilter(BSTR strFilename, IDispatch** ppUnk);
+ STDMETHODIMP get_FilterCollection(IDispatch** ppUnk);
+ STDMETHODIMP get_RegFilterCollection(IDispatch** ppUnk);
+ STDMETHODIMP StopWhenReady();
+
+ // IMediaEvent
+ STDMETHODIMP GetEventHandle(OAEVENT* hEvent);
+ STDMETHODIMP GetEvent(long* lEventCode, LONG_PTR* lParam1, LONG_PTR* lParam2, long msTimeout);
+ STDMETHODIMP WaitForCompletion(long msTimeout, long* pEvCode);
+ STDMETHODIMP CancelDefaultHandling(long lEvCode);
+ STDMETHODIMP RestoreDefaultHandling(long lEvCode);
+ STDMETHODIMP FreeEventParams(long lEvCode, LONG_PTR lParam1, LONG_PTR lParam2);
+
+ // IMediaEventEx
+ STDMETHODIMP SetNotifyWindow(OAHWND hwnd, long lMsg, LONG_PTR lInstanceData);
+ STDMETHODIMP SetNotifyFlags(long lNoNotifyFlags);
+ STDMETHODIMP GetNotifyFlags(long* lplNoNotifyFlags);
+
+ // IMediaSeeking
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+
+ // IVideoWindow
+ STDMETHODIMP put_Caption(BSTR strCaption);
+ STDMETHODIMP get_Caption(BSTR* strCaption);
+ STDMETHODIMP put_WindowStyle(long WindowStyle);
+ STDMETHODIMP get_WindowStyle(long* WindowStyle);
+ STDMETHODIMP put_WindowStyleEx(long WindowStyleEx);
+ STDMETHODIMP get_WindowStyleEx(long* WindowStyleEx);
+ STDMETHODIMP put_AutoShow(long AutoShow);
+ STDMETHODIMP get_AutoShow(long* AutoShow);
+ STDMETHODIMP put_WindowState(long WindowState);
+ STDMETHODIMP get_WindowState(long* WindowState);
+ STDMETHODIMP put_BackgroundPalette(long BackgroundPalette);
+ STDMETHODIMP get_BackgroundPalette(long* pBackgroundPalette);
+ STDMETHODIMP put_Visible(long Visible);
+ STDMETHODIMP get_Visible(long* pVisible);
+ STDMETHODIMP put_Left(long Left);
+ STDMETHODIMP get_Left(long* pLeft);
+ STDMETHODIMP put_Width(long Width);
+ STDMETHODIMP get_Width(long* pWidth);
+ STDMETHODIMP put_Top(long Top);
+ STDMETHODIMP get_Top(long* pTop);
+ STDMETHODIMP put_Height(long Height);
+ STDMETHODIMP get_Height(long* pHeight);
+ STDMETHODIMP put_Owner(OAHWND Owner);
+ STDMETHODIMP get_Owner(OAHWND* Owner);
+ STDMETHODIMP put_MessageDrain(OAHWND Drain);
+ STDMETHODIMP get_MessageDrain(OAHWND* Drain);
+ STDMETHODIMP get_BorderColor(long* Color);
+ STDMETHODIMP put_BorderColor(long Color);
+ STDMETHODIMP get_FullScreenMode(long* FullScreenMode);
+ STDMETHODIMP put_FullScreenMode(long FullScreenMode);
+ STDMETHODIMP SetWindowForeground(long Focus);
+ STDMETHODIMP NotifyOwnerMessage(OAHWND hwnd, long uMsg, LONG_PTR wParam, LONG_PTR lParam);
+ STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
+ STDMETHODIMP GetWindowPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight);
+ STDMETHODIMP GetMinIdealImageSize(long* pWidth, long* pHeight);
+ STDMETHODIMP GetMaxIdealImageSize(long* pWidth, long* pHeight);
+ STDMETHODIMP GetRestorePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight);
+ STDMETHODIMP HideCursor(long HideCursor);
+ STDMETHODIMP IsCursorHidden(long* CursorHidden);
+
+ // IBasicVideo
+ STDMETHODIMP get_AvgTimePerFrame(REFTIME* pAvgTimePerFrame);
+ STDMETHODIMP get_BitRate(long* pBitRate);
+ STDMETHODIMP get_BitErrorRate(long* pBitErrorRate);
+ STDMETHODIMP get_VideoWidth(long* pVideoWidth);
+ STDMETHODIMP get_VideoHeight(long* pVideoHeight);
+ STDMETHODIMP put_SourceLeft(long SourceLeft);
+ STDMETHODIMP get_SourceLeft(long* pSourceLeft);
+ STDMETHODIMP put_SourceWidth(long SourceWidth);
+ STDMETHODIMP get_SourceWidth(long* pSourceWidth);
+ STDMETHODIMP put_SourceTop(long SourceTop);
+ STDMETHODIMP get_SourceTop(long* pSourceTop);
+ STDMETHODIMP put_SourceHeight(long SourceHeight);
+ STDMETHODIMP get_SourceHeight(long* pSourceHeight);
+ STDMETHODIMP put_DestinationLeft(long DestinationLeft);
+ STDMETHODIMP get_DestinationLeft(long* pDestinationLeft);
+ STDMETHODIMP put_DestinationWidth(long DestinationWidth);
+ STDMETHODIMP get_DestinationWidth(long* pDestinationWidth);
+ STDMETHODIMP put_DestinationTop(long DestinationTop);
+ STDMETHODIMP get_DestinationTop(long* pDestinationTop);
+ STDMETHODIMP put_DestinationHeight(long DestinationHeight);
+ STDMETHODIMP get_DestinationHeight(long* pDestinationHeight);
+ STDMETHODIMP SetSourcePosition(long Left, long Top, long Width, long Height);
+ STDMETHODIMP GetSourcePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight);
+ STDMETHODIMP SetDefaultSourcePosition();
+ STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
+ STDMETHODIMP GetDestinationPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight);
+ STDMETHODIMP SetDefaultDestinationPosition();
+ STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
+ STDMETHODIMP GetVideoPaletteEntries(long StartIndex, long Entries, long* pRetrieved, long* pPalette);
+ STDMETHODIMP GetCurrentImage(long* pBufferSize, long* pDIBImage);
+ STDMETHODIMP IsUsingDefaultSource();
+ STDMETHODIMP IsUsingDefaultDestination();
+
+ // IBasicAudio
+ STDMETHODIMP put_Volume(long lVolume);
+ STDMETHODIMP get_Volume(long* plVolume);
+ STDMETHODIMP put_Balance(long lBalance);
+ STDMETHODIMP get_Balance(long* plBalance);
+
+ // IAMOpenProgress
+ STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
+ STDMETHODIMP AbortOperation();
+
+ // IGraphEngine
+ STDMETHODIMP_(engine_t) GetEngine();
+};
+
diff --git a/src/apps/mplayerc/CShockwaveFlash.cpp b/src/apps/mplayerc/CShockwaveFlash.cpp
new file mode 100644
index 000000000..002a1249e
--- /dev/null
+++ b/src/apps/mplayerc/CShockwaveFlash.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// CShockwaveFlash.cpp : Definition of ActiveX Control wrapper class(es) created by Microsoft Visual C++
+
+
+#include "stdafx.h"
+#include "CShockwaveFlash.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CShockwaveFlash
+
+IMPLEMENT_DYNCREATE(CShockwaveFlash, CWnd)
+
+// CShockwaveFlash properties
+
+// CShockwaveFlash operations
diff --git a/src/apps/mplayerc/CShockwaveFlash.h b/src/apps/mplayerc/CShockwaveFlash.h
new file mode 100644
index 000000000..da084cffe
--- /dev/null
+++ b/src/apps/mplayerc/CShockwaveFlash.h
@@ -0,0 +1,462 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// CShockwaveFlash.h : Declaration of ActiveX Control wrapper class(es) created by Microsoft Visual C++
+
+#pragma once
+
+/////////////////////////////////////////////////////////////////////////////
+// CShockwaveFlash
+
+class CShockwaveFlash : public CWnd
+{
+protected:
+ DECLARE_DYNCREATE(CShockwaveFlash)
+public:
+ CLSID const& GetClsid()
+ {
+ static CLSID const clsid
+ = { 0xD27CDB6E, 0xAE6D, 0x11CF, { 0x96, 0xB8, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0 } };
+ return clsid;
+ }
+ virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
+ const RECT& rect, CWnd* pParentWnd, UINT nID,
+ CCreateContext* pContext = NULL)
+ {
+ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID);
+ }
+
+ BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
+ UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE,
+ BSTR bstrLicKey = NULL)
+ {
+ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID,
+ pPersist, bStorage, bstrLicKey);
+ }
+
+// Attributes
+public:
+
+// Operations
+public:
+
+ long get_ReadyState()
+ {
+ long result;
+ InvokeHelper(DISPID_READYSTATE, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ long get_TotalFrames()
+ {
+ long result;
+ InvokeHelper(0x7c, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ BOOL get_Playing()
+ {
+ BOOL result;
+ InvokeHelper(0x7d, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
+ return result;
+ }
+ void put_Playing(BOOL newValue)
+ {
+ static BYTE parms[] = VTS_BOOL ;
+ InvokeHelper(0x7d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ long get_Quality()
+ {
+ long result;
+ InvokeHelper(0x69, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ void put_Quality(long newValue)
+ {
+ static BYTE parms[] = VTS_I4 ;
+ InvokeHelper(0x69, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ long get_ScaleMode()
+ {
+ long result;
+ InvokeHelper(0x78, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ void put_ScaleMode(long newValue)
+ {
+ static BYTE parms[] = VTS_I4 ;
+ InvokeHelper(0x78, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ long get_AlignMode()
+ {
+ long result;
+ InvokeHelper(0x79, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ void put_AlignMode(long newValue)
+ {
+ static BYTE parms[] = VTS_I4 ;
+ InvokeHelper(0x79, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ long get_BackgroundColor()
+ {
+ long result;
+ InvokeHelper(0x7b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ void put_BackgroundColor(long newValue)
+ {
+ static BYTE parms[] = VTS_I4 ;
+ InvokeHelper(0x7b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ BOOL get_Loop()
+ {
+ BOOL result;
+ InvokeHelper(0x6a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
+ return result;
+ }
+ void put_Loop(BOOL newValue)
+ {
+ static BYTE parms[] = VTS_BOOL ;
+ InvokeHelper(0x6a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ CString get_Movie()
+ {
+ CString result;
+ InvokeHelper(0x66, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_Movie(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x66, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ long get_FrameNum()
+ {
+ long result;
+ InvokeHelper(0x6b, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ void put_FrameNum(long newValue)
+ {
+ static BYTE parms[] = VTS_I4 ;
+ InvokeHelper(0x6b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ void SetZoomRect(long left, long top, long right, long bottom)
+ {
+ static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 VTS_I4 ;
+ InvokeHelper(0x6d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, left, top, right, bottom);
+ }
+ void Zoom(long factor)
+ {
+ static BYTE parms[] = VTS_I4 ;
+ InvokeHelper(0x76, DISPATCH_METHOD, VT_EMPTY, NULL, parms, factor);
+ }
+ void Pan(long x, long y, long mode)
+ {
+ static BYTE parms[] = VTS_I4 VTS_I4 VTS_I4 ;
+ InvokeHelper(0x77, DISPATCH_METHOD, VT_EMPTY, NULL, parms, x, y, mode);
+ }
+ void Play()
+ {
+ InvokeHelper(0x70, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+ }
+ void Stop()
+ {
+ InvokeHelper(0x71, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+ }
+ void Back()
+ {
+ InvokeHelper(0x72, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+ }
+ void Forward()
+ {
+ InvokeHelper(0x73, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+ }
+ void Rewind()
+ {
+ InvokeHelper(0x74, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+ }
+ void StopPlay()
+ {
+ InvokeHelper(0x7e, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
+ }
+ void GotoFrame(long FrameNum)
+ {
+ static BYTE parms[] = VTS_I4 ;
+ InvokeHelper(0x7f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, FrameNum);
+ }
+ long CurrentFrame()
+ {
+ long result;
+ InvokeHelper(0x80, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ BOOL IsPlaying()
+ {
+ BOOL result;
+ InvokeHelper(0x81, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
+ return result;
+ }
+ long PercentLoaded()
+ {
+ long result;
+ InvokeHelper(0x82, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ BOOL FrameLoaded(long FrameNum)
+ {
+ BOOL result;
+ static BYTE parms[] = VTS_I4 ;
+ InvokeHelper(0x83, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms, FrameNum);
+ return result;
+ }
+ long FlashVersion()
+ {
+ long result;
+ InvokeHelper(0x84, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
+ return result;
+ }
+ CString get_WMode()
+ {
+ CString result;
+ InvokeHelper(0x85, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_WMode(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x85, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ CString get_SAlign()
+ {
+ CString result;
+ InvokeHelper(0x86, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_SAlign(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x86, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ BOOL get_Menu()
+ {
+ BOOL result;
+ InvokeHelper(0x87, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
+ return result;
+ }
+ void put_Menu(BOOL newValue)
+ {
+ static BYTE parms[] = VTS_BOOL ;
+ InvokeHelper(0x87, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ CString get_Base()
+ {
+ CString result;
+ InvokeHelper(0x88, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_Base(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x88, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ CString get_Scale()
+ {
+ CString result;
+ InvokeHelper(0x89, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_Scale(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x89, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ BOOL get_DeviceFont()
+ {
+ BOOL result;
+ InvokeHelper(0x8a, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
+ return result;
+ }
+ void put_DeviceFont(BOOL newValue)
+ {
+ static BYTE parms[] = VTS_BOOL ;
+ InvokeHelper(0x8a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ BOOL get_EmbedMovie()
+ {
+ BOOL result;
+ InvokeHelper(0x8b, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
+ return result;
+ }
+ void put_EmbedMovie(BOOL newValue)
+ {
+ static BYTE parms[] = VTS_BOOL ;
+ InvokeHelper(0x8b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ CString get_BGColor()
+ {
+ CString result;
+ InvokeHelper(0x8c, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_BGColor(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x8c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ CString get_Quality2()
+ {
+ CString result;
+ InvokeHelper(0x8d, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_Quality2(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x8d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ void LoadMovie(long layer, LPCTSTR url)
+ {
+ static BYTE parms[] = VTS_I4 VTS_BSTR ;
+ InvokeHelper(0x8e, DISPATCH_METHOD, VT_EMPTY, NULL, parms, layer, url);
+ }
+ void TGotoFrame(LPCTSTR target, long FrameNum)
+ {
+ static BYTE parms[] = VTS_BSTR VTS_I4 ;
+ InvokeHelper(0x8f, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, FrameNum);
+ }
+ void TGotoLabel(LPCTSTR target, LPCTSTR label)
+ {
+ static BYTE parms[] = VTS_BSTR VTS_BSTR ;
+ InvokeHelper(0x90, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, label);
+ }
+ long TCurrentFrame(LPCTSTR target)
+ {
+ long result;
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x91, DISPATCH_METHOD, VT_I4, (void*)&result, parms, target);
+ return result;
+ }
+ CString TCurrentLabel(LPCTSTR target)
+ {
+ CString result;
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x92, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, target);
+ return result;
+ }
+ void TPlay(LPCTSTR target)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x93, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target);
+ }
+ void TStopPlay(LPCTSTR target)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x94, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target);
+ }
+ void SetVariable(LPCTSTR name, LPCTSTR value)
+ {
+ static BYTE parms[] = VTS_BSTR VTS_BSTR ;
+ InvokeHelper(0x97, DISPATCH_METHOD, VT_EMPTY, NULL, parms, name, value);
+ }
+ CString GetVariable(LPCTSTR name)
+ {
+ CString result;
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x98, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, name);
+ return result;
+ }
+ void TSetProperty(LPCTSTR target, long property, LPCTSTR value)
+ {
+ static BYTE parms[] = VTS_BSTR VTS_I4 VTS_BSTR ;
+ InvokeHelper(0x99, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, property, value);
+ }
+ CString TGetProperty(LPCTSTR target, long property)
+ {
+ CString result;
+ static BYTE parms[] = VTS_BSTR VTS_I4 ;
+ InvokeHelper(0x9a, DISPATCH_METHOD, VT_BSTR, (void*)&result, parms, target, property);
+ return result;
+ }
+ void TCallFrame(LPCTSTR target, long FrameNum)
+ {
+ static BYTE parms[] = VTS_BSTR VTS_I4 ;
+ InvokeHelper(0x9b, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, FrameNum);
+ }
+ void TCallLabel(LPCTSTR target, LPCTSTR label)
+ {
+ static BYTE parms[] = VTS_BSTR VTS_BSTR ;
+ InvokeHelper(0x9c, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, label);
+ }
+ void TSetPropertyNum(LPCTSTR target, long property, double value)
+ {
+ static BYTE parms[] = VTS_BSTR VTS_I4 VTS_R8 ;
+ InvokeHelper(0x9d, DISPATCH_METHOD, VT_EMPTY, NULL, parms, target, property, value);
+ }
+ double TGetPropertyNum(LPCTSTR target, long property)
+ {
+ double result;
+ static BYTE parms[] = VTS_BSTR VTS_I4 ;
+ InvokeHelper(0x9e, DISPATCH_METHOD, VT_R8, (void*)&result, parms, target, property);
+ return result;
+ }
+ double TGetPropertyAsNumber(LPCTSTR target, long property)
+ {
+ double result;
+ static BYTE parms[] = VTS_BSTR VTS_I4 ;
+ InvokeHelper(0xac, DISPATCH_METHOD, VT_R8, (void*)&result, parms, target, property);
+ return result;
+ }
+ CString get_SWRemote()
+ {
+ CString result;
+ InvokeHelper(0x9f, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_SWRemote(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0x9f, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ CString get_FlashVars()
+ {
+ CString result;
+ InvokeHelper(0xaa, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_FlashVars(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0xaa, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+ CString get_AllowScriptAccess()
+ {
+ CString result;
+ InvokeHelper(0xab, DISPATCH_PROPERTYGET, VT_BSTR, (void*)&result, NULL);
+ return result;
+ }
+ void put_AllowScriptAccess(LPCTSTR newValue)
+ {
+ static BYTE parms[] = VTS_BSTR ;
+ InvokeHelper(0xab, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
+ }
+
+
+};
diff --git a/src/apps/mplayerc/ChildView.cpp b/src/apps/mplayerc/ChildView.cpp
new file mode 100644
index 000000000..c16641802
--- /dev/null
+++ b/src/apps/mplayerc/ChildView.cpp
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// ChildView.cpp : implementation of the CChildView class
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "ChildView.h"
+#include "MainFrm.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CChildView
+
+CChildView::CChildView() : m_vrect(0,0,0,0)
+{
+ m_lastlmdowntime = 0;
+ m_lastlmdownpoint.SetPoint(0, 0);
+
+ LoadLogo();
+}
+
+CChildView::~CChildView()
+{
+}
+
+BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!CWnd::PreCreateWindow(cs))
+ return FALSE;
+
+ cs.style &= ~WS_BORDER;
+ cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
+ ::LoadCursor(NULL, IDC_HAND), HBRUSH(COLOR_WINDOW+1), NULL);
+
+ return TRUE;
+}
+
+BOOL CChildView::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MYMOUSELAST)
+ {
+ CWnd* pParent = GetParent();
+ CPoint p(pMsg->lParam);
+ ::MapWindowPoints(pMsg->hwnd, pParent->m_hWnd, &p, 1);
+
+ bool fDblClick = false;
+
+ bool fInteractiveVideo = ((CMainFrame*)AfxGetMainWnd())->IsInteractiveVideo();
+/*
+ if(fInteractiveVideo)
+ {
+ if(pMsg->message == WM_LBUTTONDOWN)
+ {
+ if((pMsg->time - m_lastlmdowntime) <= GetDoubleClickTime()
+ && abs(pMsg->pt.x - m_lastlmdownpoint.x) <= GetSystemMetrics(SM_CXDOUBLECLK)
+ && abs(pMsg->pt.y - m_lastlmdownpoint.y) <= GetSystemMetrics(SM_CYDOUBLECLK))
+ {
+ fDblClick = true;
+ m_lastlmdowntime = 0;
+ m_lastlmdownpoint.SetPoint(0, 0);
+ }
+ else
+ {
+ m_lastlmdowntime = pMsg->time;
+ m_lastlmdownpoint = pMsg->pt;
+ }
+ }
+ else if(pMsg->message == WM_LBUTTONDBLCLK)
+ {
+ m_lastlmdowntime = pMsg->time;
+ m_lastlmdownpoint = pMsg->pt;
+ }
+ }
+*/
+ if((pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONUP || pMsg->message == WM_MOUSEMOVE)
+ && fInteractiveVideo)
+ {
+ if(pMsg->message == WM_MOUSEMOVE)
+ {
+ pParent->PostMessage(pMsg->message, pMsg->wParam, MAKELPARAM(p.x, p.y));
+ }
+
+ if(fDblClick)
+ {
+ pParent->PostMessage(WM_LBUTTONDOWN, pMsg->wParam, MAKELPARAM(p.x, p.y));
+ pParent->PostMessage(WM_LBUTTONDBLCLK, pMsg->wParam, MAKELPARAM(p.x, p.y));
+ }
+ }
+ else
+ {
+ pParent->PostMessage(pMsg->message, pMsg->wParam, MAKELPARAM(p.x, p.y));
+ return TRUE;
+ }
+ }
+
+ return CWnd::PreTranslateMessage(pMsg);
+}
+
+void CChildView::SetVideoRect(CRect r)
+{
+ m_vrect = r;
+
+ Invalidate();
+}
+
+void CChildView::LoadLogo()
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ CAutoLock cAutoLock(&m_csLogo);
+
+ m_logo.Destroy();
+
+ if(s.logoext)
+ {
+ if(AfxGetAppSettings().fXpOrBetter)
+ m_logo.Load(s.logofn);
+ else if(HANDLE h = LoadImage(NULL, s.logofn, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE))
+ m_logo.Attach((HBITMAP)h); // win9x bug: Inside Attach GetObject() will return all zeros in DIBSECTION and silly CImage uses that to init width, height, bpp, ... so we can't use CImage::Draw later
+ }
+
+ if(m_logo.IsNull())
+ {
+ m_logo.LoadFromResource(AfxGetInstanceHandle(), s.logoid);
+ }
+
+ if(m_hWnd) Invalidate();
+}
+
+CSize CChildView::GetLogoSize()
+{
+ CSize ret(0,0);
+ if(!m_logo.IsNull())
+ ret.SetSize(m_logo.GetWidth(), m_logo.GetHeight());
+ return ret;
+}
+
+IMPLEMENT_DYNAMIC(CChildView, CWnd)
+
+BEGIN_MESSAGE_MAP(CChildView, CWnd)
+ //{{AFX_MSG_MAP(CChildView)
+ ON_WM_PAINT()
+ ON_WM_ERASEBKGND()
+ ON_WM_SIZE()
+ ON_WM_WINDOWPOSCHANGED()
+ ON_COMMAND_EX(ID_PLAY_PLAYPAUSE, OnPlayPlayPauseStop)
+ ON_COMMAND_EX(ID_PLAY_PLAY, OnPlayPlayPauseStop)
+ ON_COMMAND_EX(ID_PLAY_PAUSE, OnPlayPlayPauseStop)
+ ON_COMMAND_EX(ID_PLAY_STOP, OnPlayPlayPauseStop)
+ ON_WM_SETCURSOR()
+ ON_WM_NCCALCSIZE()
+ ON_WM_NCPAINT()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CChildView message handlers
+
+void CChildView::OnPaint()
+{
+ CPaintDC dc(this); // device context for painting
+
+ ((CMainFrame*)GetParentFrame())->RepaintVideo();
+
+ // Do not call CWnd::OnPaint() for painting messages
+}
+
+BOOL CChildView::OnEraseBkgnd(CDC* pDC)
+{
+ CRect r;
+
+ CAutoLock cAutoLock(&m_csLogo);
+
+ if(((CMainFrame*)GetParentFrame())->IsSomethingLoaded())
+ {
+ pDC->ExcludeClipRect(m_vrect);
+ }
+ else if(!m_logo.IsNull() /*&& ((CMainFrame*)GetParentFrame())->IsPlaylistEmpty()*/)
+ {
+ BITMAP bm;
+ GetObject(m_logo, sizeof(bm), &bm);
+
+ GetClientRect(r);
+ int w = min(bm.bmWidth, r.Width());
+ int h = min(abs(bm.bmHeight), r.Height());
+// int w = min(m_logo.GetWidth(), r.Width());
+// int h = min(m_logo.GetHeight(), r.Height());
+ int x = (r.Width() - w) / 2;
+ int y = (r.Height() - h) / 2;
+ r = CRect(CPoint(x, y), CSize(w, h));
+
+ int oldmode = pDC->SetStretchBltMode(STRETCH_HALFTONE);
+ m_logo.StretchBlt(*pDC, r, CRect(0,0,bm.bmWidth,abs(bm.bmHeight)));
+// m_logo.Draw(*pDC, r);
+ pDC->SetStretchBltMode(oldmode);
+
+ pDC->ExcludeClipRect(r);
+ }
+
+ GetClientRect(r);
+ pDC->FillSolidRect(r, 0);
+
+ return TRUE;
+}
+
+void CChildView::OnSize(UINT nType, int cx, int cy)
+{
+ CWnd::OnSize(nType, cx, cy);
+
+ ((CMainFrame*)GetParentFrame())->MoveVideoWindow();
+}
+
+void CChildView::OnWindowPosChanged(WINDOWPOS* lpwndpos)
+{
+ CWnd::OnWindowPosChanged(lpwndpos);
+
+ ((CMainFrame*)GetParentFrame())->MoveVideoWindow();
+}
+
+BOOL CChildView::OnPlayPlayPauseStop(UINT nID)
+{
+ if(nID == ID_PLAY_STOP) SetVideoRect();
+ return FALSE;
+}
+
+BOOL CChildView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
+{
+ if(((CMainFrame*)GetParentFrame())->m_fHideCursor)
+ {
+ SetCursor(NULL);
+ return TRUE;
+ }
+
+ return CWnd::OnSetCursor(pWnd, nHitTest, message);
+}
+
+void CChildView::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp)
+{
+ if(!((CMainFrame*)GetParentFrame())->IsFrameLessWindow())
+ {
+ InflateRect(&lpncsp->rgrc[0], -1, -1);
+ }
+
+ CWnd::OnNcCalcSize(bCalcValidRects, lpncsp);
+}
+
+void CChildView::OnNcPaint()
+{
+ if(!((CMainFrame*)GetParentFrame())->IsFrameLessWindow())
+ {
+ CRect r;
+ GetWindowRect(r);
+ r.OffsetRect(-r.left, -r.top);
+
+ CWindowDC(this).Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
+ }
+}
+
diff --git a/src/apps/mplayerc/ChildView.h b/src/apps/mplayerc/ChildView.h
new file mode 100644
index 000000000..7b91ca90a
--- /dev/null
+++ b/src/apps/mplayerc/ChildView.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlimage.h>
+
+class CChildView : public CWnd
+{
+ CRect m_vrect;
+
+ DWORD m_lastlmdowntime;
+ CPoint m_lastlmdownpoint;
+
+ CCritSec m_csLogo;
+ CImage m_logo;
+
+public:
+ CChildView();
+ virtual ~CChildView();
+
+ DECLARE_DYNAMIC(CChildView)
+
+public:
+ void SetVideoRect(CRect r = CRect(0,0,0,0));
+ CRect GetVideoRect() {return(m_vrect);}
+
+ void LoadLogo();
+ CSize GetLogoSize();
+
+protected:
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ afx_msg void OnPaint();
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
+ afx_msg BOOL OnPlayPlayPauseStop(UINT nID);
+ afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+ afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
+ afx_msg void OnNcPaint();
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnSetFocus(CWnd* pOldWnd);
+};
diff --git a/src/apps/mplayerc/ComPropertyPage.cpp b/src/apps/mplayerc/ComPropertyPage.cpp
new file mode 100644
index 000000000..23df655a2
--- /dev/null
+++ b/src/apps/mplayerc/ComPropertyPage.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// ComPropertyPage.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "ComPropertyPage.h"
+#include "ComPropertySheet.h"
+
+
+// CComPropertyPage dialog
+
+IMPLEMENT_DYNAMIC(CComPropertyPage, CPropertyPage)
+CComPropertyPage::CComPropertyPage(IPropertyPage* pPage)
+ : CPropertyPage(CComPropertyPage::IDD), m_pPage(pPage)
+{
+ PROPPAGEINFO ppi;
+ m_pPage->GetPageInfo(&ppi);
+ m_pPSP->pszTitle = (m_strCaption = ppi.pszTitle);
+ m_psp.dwFlags |= PSP_USETITLE;
+}
+
+CComPropertyPage::~CComPropertyPage()
+{
+}
+
+void CComPropertyPage::DoDataExchange(CDataExchange* pDX)
+{
+ CPropertyPage::DoDataExchange(pDX);
+}
+
+BOOL CComPropertyPage::OnInitDialog()
+{
+ CPropertyPage::OnInitDialog();
+
+ CRect r;
+ PROPPAGEINFO ppi;
+ m_pPage->GetPageInfo(&ppi);
+ r = CRect(CPoint(0,0), ppi.size);
+ m_pPage->Activate(m_hWnd, r, FALSE);
+ m_pPage->Show(SW_SHOW);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CComPropertyPage::OnDestroy()
+{
+ CPropertyPage::OnDestroy();
+
+ m_pPage->Deactivate();
+}
+
+BOOL CComPropertyPage::OnSetActive()
+{
+ SetModified(S_OK == m_pPage->IsPageDirty());
+
+ CWnd* pParent = GetParent();
+ if(pParent->IsKindOf(RUNTIME_CLASS(CComPropertySheet)))
+ {
+ CComPropertySheet* pSheet = (CComPropertySheet*)pParent;
+ pSheet->OnActivated(this);
+ }
+
+ return CPropertyPage::OnSetActive();
+}
+
+BOOL CComPropertyPage::OnKillActive()
+{
+ SetModified(FALSE);
+
+ return CPropertyPage::OnKillActive();
+}
+
+
+BEGIN_MESSAGE_MAP(CComPropertyPage, CPropertyPage)
+ ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+
+// CComPropertyPage message handlers
+
+void CComPropertyPage::OnOK()
+{
+ if(S_OK == m_pPage->IsPageDirty()) m_pPage->Apply();
+ SetModified(FALSE);
+
+ CPropertyPage::OnOK();
+}
diff --git a/src/apps/mplayerc/ComPropertyPage.h b/src/apps/mplayerc/ComPropertyPage.h
new file mode 100644
index 000000000..e36ea6801
--- /dev/null
+++ b/src/apps/mplayerc/ComPropertyPage.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+
+// CComPropertyPage dialog
+
+class CComPropertyPage : public CPropertyPage
+{
+ DECLARE_DYNAMIC(CComPropertyPage)
+
+ CComPtr<IPropertyPage> m_pPage;
+
+public:
+ CComPropertyPage(IPropertyPage* pPage);
+ virtual ~CComPropertyPage();
+
+// Dialog Data
+ enum { IDD = IDD_COMPROPERTYPAGE };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnSetActive();
+ virtual BOOL OnKillActive();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ virtual BOOL OnInitDialog();
+ afx_msg void OnDestroy();
+ virtual void OnOK();
+};
+
diff --git a/src/apps/mplayerc/ComPropertySheet.cpp b/src/apps/mplayerc/ComPropertySheet.cpp
new file mode 100644
index 000000000..49cc664ed
--- /dev/null
+++ b/src/apps/mplayerc/ComPropertySheet.cpp
@@ -0,0 +1,246 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// ComPropertySheet.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "ComPropertySheet.h"
+#include "..\..\DSUtil\DSUtil.h"
+#include "..\..\filters\InternalPropertyPage.h"
+
+// CComPropertyPageSite
+
+class CComPropertyPageSite : public CUnknown, public IPropertyPageSite
+{
+ IComPropertyPageDirty* m_pPPD;
+
+public:
+ CComPropertyPageSite(IComPropertyPageDirty* pPPD) : CUnknown(NAME("CComPropertyPageSite"), NULL), m_pPPD(pPPD) {}
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
+ {
+ return
+ QI(IPropertyPageSite)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+ }
+
+ // IPropertyPageSite
+ STDMETHODIMP OnStatusChange(DWORD flags)
+ {
+ if(m_pPPD)
+ {
+ if(flags&PROPPAGESTATUS_DIRTY) m_pPPD->OnSetDirty(true);
+ if(flags&PROPPAGESTATUS_CLEAN) m_pPPD->OnSetDirty(false);
+ }
+ return S_OK;
+ }
+ STDMETHODIMP GetLocaleID(LCID* pLocaleID)
+ {
+ CheckPointer(pLocaleID, E_POINTER);
+ *pLocaleID = ::GetUserDefaultLCID();
+ return S_OK;
+ }
+ STDMETHODIMP GetPageContainer(IUnknown** ppUnk) {return E_NOTIMPL;}
+ STDMETHODIMP TranslateAccelerator(LPMSG pMsg) {return E_NOTIMPL;}
+};
+
+// CComPropertySheet
+
+IMPLEMENT_DYNAMIC(CComPropertySheet, CPropertySheet)
+CComPropertySheet::CComPropertySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
+ : CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
+{
+ m_pSite = new CComPropertyPageSite(this);
+ m_size.SetSize(0, 0);
+}
+
+CComPropertySheet::CComPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
+ : CPropertySheet(pszCaption, pParentWnd, iSelectPage)
+{
+ m_pSite = new CComPropertyPageSite(this);
+ m_size.SetSize(0, 0);
+}
+
+CComPropertySheet::~CComPropertySheet()
+{
+}
+
+int CComPropertySheet::AddPages(CComPtr<ISpecifyPropertyPages> pSPP)
+{
+ if(!pSPP) return(0);
+
+ CAUUID caGUID;
+ caGUID.pElems = NULL;
+ if(FAILED(pSPP->GetPages(&caGUID)))
+ return(0);
+
+ IUnknown* lpUnk = NULL;
+ if(FAILED(pSPP.QueryInterface(&lpUnk)))
+ return(0);
+
+ m_spp.AddTail(pSPP);
+
+ CComQIPtr<ISpecifyPropertyPages2> pSPP2 = pSPP;
+ CComQIPtr<IPersist> pPersist = pSPP;
+
+ ULONG nPages = 0;
+ for(ULONG i = 0; i < caGUID.cElems; i++)
+ {
+ CComPtr<IPropertyPage> pPage;
+
+ HRESULT hr = E_FAIL;
+
+ if(FAILED(hr) && !pPage && pSPP2)
+ {
+ hr = pSPP2->CreatePage(caGUID.pElems[i], &pPage);
+ }
+
+ if(FAILED(hr) && !pPage)
+ {
+ hr = pPage.CoCreateInstance(caGUID.pElems[i]);
+ }
+
+ if(FAILED(hr) && !pPage && pPersist)
+ {
+ hr = LoadExternalPropertyPage(pPersist, caGUID.pElems[i], &pPage);
+ }
+
+ if(SUCCEEDED(hr))
+ {
+ if(AddPage(pPage, lpUnk))
+ nPages++;
+ }
+ }
+
+ if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+ lpUnk->Release();
+
+ return(nPages);
+}
+
+bool CComPropertySheet::AddPage(IPropertyPage* pPage, IUnknown* pUnk)
+{
+ if(!pPage || !pUnk) return false;
+
+ HRESULT hr;
+ hr = pPage->SetPageSite(m_pSite);
+ hr = pPage->SetObjects(1, &pUnk);
+ PROPPAGEINFO ppi;
+ hr = pPage->GetPageInfo(&ppi);
+ m_size.cx = max(m_size.cx, ppi.size.cx);
+ m_size.cy = max(m_size.cy, ppi.size.cy);
+ CAutoPtr<CComPropertyPage> p(new CComPropertyPage(pPage));
+ __super::AddPage(p);
+ m_pages.AddTail(p);
+
+ return true;
+}
+
+void CComPropertySheet::OnActivated(CPropertyPage* pPage)
+{
+ if(!pPage) return;
+
+ CRect bounds(30000,30000,-30000,-30000);
+
+ CRect wr, cr;
+ GetWindowRect(wr);
+ GetClientRect(cr);
+ CSize ws = wr.Size(), cs = cr.Size();
+
+ CRect twr, tcr;
+ CTabCtrl* pTC = (CTabCtrl*)GetDlgItem(AFX_IDC_TAB_CONTROL);
+ pTC->GetWindowRect(twr);
+ pTC->GetClientRect(tcr);
+ CSize tws = twr.Size(), tcs = tcr.Size();
+
+ if(CWnd* pChild = pPage->GetWindow(GW_CHILD))
+ {
+ pChild->ModifyStyle(WS_CAPTION|WS_THICKFRAME, 0);
+ pChild->ModifyStyleEx(WS_EX_DLGMODALFRAME, WS_EX_CONTROLPARENT);
+
+ for(CWnd* pGrandChild = pChild->GetWindow(GW_CHILD); pGrandChild; pGrandChild = pGrandChild->GetNextWindow())
+ {
+ if(!(pGrandChild->GetStyle()&WS_VISIBLE)) continue;
+
+ CRect r;
+ pGrandChild->GetWindowRect(&r);
+ pChild->ScreenToClient(r);
+ bounds |= r;
+ }
+ }
+
+ bounds |= CRect(0,0,0,0);
+ bounds.SetRect(0, 0, bounds.right + max(bounds.left, 4), bounds.bottom + max(bounds.top, 4));
+
+ CRect r = CRect(CPoint(0,0), bounds.Size());
+ pTC->AdjustRect(TRUE, r);
+ r.SetRect(twr.TopLeft(), twr.TopLeft() + r.Size());
+ ScreenToClient(r);
+ pTC->MoveWindow(r);
+ pTC->ModifyStyle(TCS_MULTILINE, TCS_SINGLELINE);
+
+ CSize diff = r.Size() - tws;
+
+ if(!bounds.IsRectEmpty())
+ {
+ if(CWnd* pChild = pPage->GetWindow(GW_CHILD))
+ pChild->MoveWindow(bounds);
+ CRect r = twr;
+ pTC->AdjustRect(FALSE, r);
+ ScreenToClient(r);
+ pPage->MoveWindow(CRect(r.TopLeft(), bounds.Size()));
+ }
+
+ int _afxPropSheetButtons[] = { IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP };
+ for(int i = 0; i < countof(_afxPropSheetButtons); i++)
+ {
+ if(CWnd* pWnd = GetDlgItem(_afxPropSheetButtons[i]))
+ {
+ pWnd->GetWindowRect(r);
+ ScreenToClient(r);
+ pWnd->MoveWindow(CRect(r.TopLeft() + diff, r.Size()));
+ }
+ }
+
+ MoveWindow(CRect(wr.TopLeft(), ws + diff));
+
+ Invalidate();
+}
+
+
+BEGIN_MESSAGE_MAP(CComPropertySheet, CPropertySheet)
+END_MESSAGE_MAP()
+
+
+// CComPropertySheet message handlers
+
+BOOL CComPropertySheet::OnInitDialog()
+{
+ BOOL bResult = (BOOL)Default();//CPropertySheet::OnInitDialog();
+
+ if (!(GetStyle() & WS_CHILD))
+ CenterWindow();
+
+ return bResult;
+}
diff --git a/src/apps/mplayerc/ComPropertySheet.h b/src/apps/mplayerc/ComPropertySheet.h
new file mode 100644
index 000000000..faef4c89f
--- /dev/null
+++ b/src/apps/mplayerc/ComPropertySheet.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "ComPropertyPage.h"
+
+interface IComPropertyPageDirty
+{
+ virtual void OnSetDirty(bool fDirty) = 0;
+};
+
+// CComPropertySheet
+
+class CComPropertySheet : public CPropertySheet, public IComPropertyPageDirty
+{
+ DECLARE_DYNAMIC(CComPropertySheet)
+
+ CComPtr<IPropertyPageSite> m_pSite;
+ CInterfaceList<ISpecifyPropertyPages> m_spp;
+ CAutoPtrList<CComPropertyPage> m_pages;
+ CSize m_size;
+
+public:
+ CComPropertySheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
+ CComPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
+ virtual ~CComPropertySheet();
+
+ int AddPages(CComPtr<ISpecifyPropertyPages> pSPP);
+ bool AddPage(IPropertyPage* pPage, IUnknown* pUnk);
+
+ void OnActivated(CPropertyPage* pPage);
+
+ // IComPropertyPageDirty
+ void OnSetDirty(bool fDirty) {if(CPropertyPage* p = GetActivePage()) p->SetModified(fDirty);}
+
+ virtual BOOL OnInitDialog();
+
+protected:
+ DECLARE_MESSAGE_MAP()
+};
+
+
diff --git a/src/apps/mplayerc/ConvertChapDlg.cpp b/src/apps/mplayerc/ConvertChapDlg.cpp
new file mode 100644
index 000000000..b77c35bed
--- /dev/null
+++ b/src/apps/mplayerc/ConvertChapDlg.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// ConvertChapDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "ConvertChapDlg.h"
+
+// CConvertChapDlg dialog
+
+CConvertChapDlg::CConvertChapDlg(CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CConvertChapDlg::IDD, pParent)
+ , m_time(_T(""))
+ , m_name(_T(""))
+{
+}
+
+CConvertChapDlg::~CConvertChapDlg()
+{
+}
+
+void CConvertChapDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Text(pDX, IDC_EDIT1, m_time);
+ DDX_Text(pDX, IDC_EDIT2, m_name);
+}
+
+BEGIN_MESSAGE_MAP(CConvertChapDlg, CResizableDialog)
+ ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOK)
+END_MESSAGE_MAP()
+
+
+// CConvertChapDlg message handlers
+
+BOOL CConvertChapDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AddAnchor(IDC_EDIT1, TOP_LEFT);
+ AddAnchor(IDC_EDIT2, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDOK, BOTTOM_CENTER);
+ AddAnchor(IDCANCEL, BOTTOM_CENTER);
+
+ CRect r;
+ GetWindowRect(r);
+ CSize s = r.Size();
+ SetMinTrackSize(s);
+ s.cx = 1000;
+ SetMaxTrackSize(s);
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CConvertChapDlg::OnOK()
+{
+ UpdateData();
+
+ __super::OnOK();
+}
+
+void CConvertChapDlg::OnUpdateOK(CCmdUI* pCmdUI)
+{
+ CString str;
+ GetDlgItem(IDC_EDIT1)->GetWindowText(str);
+ int i;
+ pCmdUI->Enable(3 == _stscanf(str, _T("%d:%d:%d"), &i, &i, &i)
+ && GetDlgItem(IDC_EDIT2)->GetWindowTextLength() > 0);
+}
diff --git a/src/apps/mplayerc/ConvertChapDlg.h b/src/apps/mplayerc/ConvertChapDlg.h
new file mode 100644
index 000000000..71c989e89
--- /dev/null
+++ b/src/apps/mplayerc/ConvertChapDlg.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CConvertChapDlg dialog
+
+class CConvertChapDlg : public CResizableDialog
+{
+public:
+ CConvertChapDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~CConvertChapDlg();
+
+// Dialog Data
+ enum { IDD = IDD_CONVERTCHAP_DLG };
+ CString m_time;
+ CString m_name;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnUpdateOK(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/ConvertDlg.cpp b/src/apps/mplayerc/ConvertDlg.cpp
new file mode 100644
index 000000000..1867dbfad
--- /dev/null
+++ b/src/apps/mplayerc/ConvertDlg.cpp
@@ -0,0 +1,1366 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// ConvertDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <mmreg.h>
+#include "mplayerc.h"
+#include "..\..\filters\filters.h"
+#include "..\..\..\include\moreuuids.h"
+#include "FGManager.h"
+#include "ConvertPropsDlg.h"
+#include "ConvertResDlg.h"
+#include "ConvertChapDlg.h"
+#include "ConvertDlg.h"
+
+// TODO: subtitle source filter for vobsub
+
+// CConvertDlg dialog
+
+CConvertDlg::CConvertDlg(CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CConvertDlg::IDD, pParent)
+ , m_fn(_T(""))
+{
+}
+
+CConvertDlg::~CConvertDlg()
+{
+}
+
+void CConvertDlg::AddFile(CString fn)
+{
+ CString protocol;
+
+ int i = fn.Find(_T("://"));
+ if(i > 0)
+ {
+ CString url = fn.Mid(i);
+ CPath path(fn.Left(i));
+ path.StripPath();
+ protocol = (LPCTSTR)path;
+ fn = (LPCTSTR)path + url;
+ }
+
+ CComPtr<IBaseFilter> pBF;
+ if(FAILED(m_pGB->AddSourceFilter(CStringW(fn), CStringW(fn), &pBF)))
+ return;
+
+ int nConnected = 0;
+ BeginEnumPins(pBF, pEP, pPin)
+ if(S_OK == m_pGB->ConnectFilter(pPin, m_pMux)) nConnected++;
+ EndEnumPins
+ if(!nConnected) {MessageBeep(-1); DeleteFilter(pBF); return;}
+
+ if(m_tree.GetCount() == 0)
+ {
+ if(CComQIPtr<IDSMPropertyBag> pPB = m_pMux)
+ pPB->DelAllProperties();
+
+ CString ext(_T(".dsm"));
+
+ if(!protocol.IsEmpty())
+ {
+ m_fn = protocol + ext;
+ }
+ else
+ {
+ CPath p(fn);
+ if(ext.CompareNoCase(p.GetExtension()) == 0)
+ ext = _T(" (remuxed)") + ext;
+ p.RemoveExtension();
+ m_fn = (LPCTSTR)p + ext;
+ }
+
+ UpdateData(FALSE);
+ }
+
+ CTreeItemFile* t = new CTreeItemFile(fn, pBF, m_tree, NULL);
+
+ AddFilter(*t, pBF);
+
+ m_tree.Expand(*t, TVE_EXPAND);
+ m_tree.EnsureVisible(*t);
+}
+
+bool CConvertDlg::ConvertFile(LPCTSTR fn, IPin* pPin)
+{
+ OAFilterState fs;
+ if(!m_pMC || FAILED(m_pMC->GetState(0, &fs)) || fs != State_Stopped)
+ return false;
+
+ m_pGB->NukeDownstream(m_pMux);
+
+ CComPtr<IBaseFilter> pFW;
+ pFW.CoCreateInstance(CLSID_FileWriter);
+ CComQIPtr<IFileSinkFilter2> pFSF = pFW;
+
+ if(pPin)
+ {
+ CComQIPtr<IBaseMuxerRelatedPin> pRP = pPin;
+ if(!pRP) return false;
+
+ pPin = pRP->GetRelatedPin();
+ }
+ else
+ {
+ pPin = GetFirstPin(m_pMux, PINDIR_OUTPUT);
+ }
+
+ if(!pPin || !pFSF
+ || FAILED(m_pGB->AddFilter(pFW, NULL))
+ || FAILED(pFSF->SetFileName(CStringW(fn), NULL))
+ || FAILED(pFSF->SetMode(AM_FILE_OVERWRITE))
+ || FAILED(m_pGB->ConnectDirect(pPin, GetFirstPin(pFW), NULL)))
+ {
+ m_pGB->RemoveFilter(pFW);
+ return false;
+ }
+
+ if(m_pMS)
+ {
+ LONGLONG pos = 0;
+ m_pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ }
+
+ if(CComQIPtr<IDSMPropertyBag> pPB = m_pMux)
+ {
+ pPB->SetProperty(L"APPL", L"Media Player Classic");
+ }
+
+ if(CComQIPtr<IDSMResourceBag> pRB = m_pMux)
+ {
+ pRB->ResRemoveAll(0);
+ POSITION pos = m_pTIs.GetHeadPosition();
+ while(pos)
+ {
+ if(CTreeItemResource* t2 = dynamic_cast<CTreeItemResource*>((CTreeItem*)m_pTIs.GetNext(pos)))
+ pRB->ResAppend(
+ t2->m_res.name, t2->m_res.desc, t2->m_res.mime,
+ t2->m_res.data.GetData(), t2->m_res.data.GetCount(),
+ NULL);
+ }
+ }
+
+ if(CComQIPtr<IDSMChapterBag> pCB = m_pMux)
+ {
+ pCB->ChapRemoveAll();
+ POSITION pos = m_pTIs.GetHeadPosition();
+ while(pos)
+ {
+ if(CTreeItemChapter* t2 = dynamic_cast<CTreeItemChapter*>((CTreeItem*)m_pTIs.GetNext(pos)))
+ pCB->ChapAppend(t2->m_chap.rt, t2->m_chap.name);
+ }
+ }
+
+ if(FAILED(m_pMC->Run()))
+ return false;
+
+ m_tree.EnableWindow(FALSE);
+
+ return true;
+}
+
+void CConvertDlg::AddFilter(HTREEITEM hTIParent, IBaseFilter* pBFParent)
+{
+ BeginEnumPins(pBFParent, pEP, pPin)
+ {
+ CComPtr<IPin> pPinTo;
+ CComPtr<IBaseFilter> pBF;
+ if(S_OK != m_pGB->IsPinDirection(pPin, PINDIR_OUTPUT)
+ || FAILED(pPin->ConnectedTo(&pPinTo)) || !pPinTo
+ || !(pBF = GetFilterFromPin(pPinTo)))
+ continue;
+
+ CTreeItem* t = NULL;
+
+ if(pBF == m_pMux)
+ {
+ t = new CTreeItemPin(pPin, m_tree, hTIParent);
+ }
+ else
+ {
+ t = new CTreeItemFilter(pBF, m_tree, hTIParent);
+ AddFilter(*t, pBF);
+ }
+ }
+ EndEnumPins
+
+ if(CComQIPtr<IDSMPropertyBag> pPB = pBFParent)
+ {
+ ULONG props;
+ if(FAILED(pPB->CountProperties(&props)))
+ props = 0;
+
+ for(ULONG i = 0; i < props; i++)
+ {
+ PROPBAG2 PropBag;
+ memset(&PropBag, 0, sizeof(PropBag));
+ ULONG cPropertiesReturned = 0;
+ if(FAILED(pPB->GetPropertyInfo(i, 1, &PropBag, &cPropertiesReturned)))
+ continue;
+
+ HRESULT hr;
+ CComVariant var;
+ if(SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr)) && SUCCEEDED(hr))
+ {
+ CComQIPtr<IDSMPropertyBag> pPBMux = m_pMux;
+ CComBSTR value;
+ if(pPBMux && FAILED(pPBMux->GetProperty(PropBag.pstrName, &value)))
+ pPBMux->SetProperty(PropBag.pstrName, var.bstrVal);
+ }
+
+ CoTaskMemFree(PropBag.pstrName);
+ }
+ }
+
+ CTreeItem* t2 = new CTreeItemResourceFolder(m_tree, hTIParent);
+ if(CComQIPtr<IDSMResourceBag> pRB = pBFParent)
+ {
+ for(DWORD i = 0, cnt = pRB->ResGetCount(); i < cnt; i++)
+ {
+ CComBSTR name, mime, desc;
+ BYTE* pData = NULL;
+ DWORD len = 0;
+ if(FAILED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL)))
+ continue;
+
+ if(len > 0)
+ {
+ m_pTIs.AddTail(new CTreeItemResource(CDSMResource(name, desc, mime, pData, len), m_tree, *t2));
+ }
+
+ CoTaskMemFree(pData);
+ }
+ }
+ m_tree.Expand(*t2, TVE_EXPAND);
+
+ CTreeItem* t3 = new CTreeItemChapterFolder(m_tree, hTIParent);
+ if(CComQIPtr<IDSMChapterBag> pCB = pBFParent)
+ {
+ for(DWORD i = 0, cnt = pCB->ChapGetCount(); i < cnt; i++)
+ {
+ REFERENCE_TIME rt;
+ CComBSTR name;
+ if(FAILED(pCB->ChapGet(i, &rt, &name)))
+ continue;
+
+ m_pTIs.AddTail(new CTreeItemChapter(CDSMChapter(rt, name), m_tree, *t3));
+ }
+ }
+ m_tree.Expand(*t3, TVE_EXPAND);
+
+ m_tree.Expand(hTIParent, TVE_EXPAND);
+}
+
+void CConvertDlg::DeleteFilter(IBaseFilter* pBF)
+{
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ CComPtr<IPin> pPinTo;
+ CComPtr<IBaseFilter> pBF;
+ if(S_OK != m_pGB->IsPinDirection(pPin, PINDIR_OUTPUT)
+ || FAILED(pPin->ConnectedTo(&pPinTo)) || !pPinTo
+ || !(pBF = GetFilterFromPin(pPinTo)))
+ continue;
+
+ if(pBF != m_pMux) DeleteFilter(pBF);
+ }
+ EndEnumPins
+
+ m_pGB->RemoveFilter(pBF);
+}
+
+void CConvertDlg::DeleteItem(HTREEITEM hTI)
+{
+ if(!hTI) return;
+
+ DeleteChildren(hTI);
+
+ CTreeItem* t = (CTreeItem*)m_tree.GetItemData(hTI);
+ if(POSITION pos = m_pTIs.Find(t)) m_pTIs.RemoveAt(pos);
+ delete t;
+ m_tree.DeleteItem(hTI);
+}
+
+void CConvertDlg::DeleteChildren(HTREEITEM hTI)
+{
+ if(!hTI) return;
+
+ if(m_tree.ItemHasChildren(hTI))
+ {
+ HTREEITEM hChildItem = m_tree.GetChildItem(hTI);
+
+ while(hChildItem != NULL)
+ {
+ HTREEITEM hNextItem = m_tree.GetNextItem(hChildItem, TVGN_NEXT);
+ DeleteItem(hChildItem);
+ hChildItem = hNextItem;
+ }
+ }
+}
+
+HTREEITEM CConvertDlg::HitTest(CPoint& sp, CPoint& cp)
+{
+ sp = CPoint((LPARAM)GetMessagePos());
+ cp = sp;
+ m_tree.ScreenToClient(&cp);
+ UINT flags = 0;
+ HTREEITEM hTI = m_tree.HitTest(cp, &flags);
+ return hTI && (flags&TVHT_ONITEM) ? hTI : NULL;
+}
+
+void CConvertDlg::ShowPopup(CPoint p)
+{
+ CMenu m;
+ m.CreatePopupMenu();
+
+ int i = 1;
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_ADDFILE));
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_PROPERTIES));
+
+ switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this))
+ {
+ case 1:
+ {
+ CFileDialog fd(TRUE, NULL, m_fn,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_NOVALIDATE,
+ _T("Media files|*.*||"), this, 0);
+ if(fd.DoModal() == IDOK) AddFile(fd.GetPathName());
+ }
+ break;
+ case 2:
+ EditProperties(CComQIPtr<IDSMPropertyBag>(m_pMux));
+ break;
+ }
+}
+
+void CConvertDlg::ShowFilePopup(HTREEITEM hTI, CPoint p)
+{
+ CTreeItemFile* t = dynamic_cast<CTreeItemFile*>((CTreeItem*)m_tree.GetItemData(hTI));
+ ASSERT(t);
+
+ CMenu m;
+ m.CreatePopupMenu();
+
+ int i = 1;
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVE));
+
+ switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this))
+ {
+ case 1:
+ DeleteFilter(t->m_pBF);
+ DeleteItem(hTI);
+ break;
+ }
+}
+
+void CConvertDlg::ShowPinPopup(HTREEITEM hTI, CPoint p)
+{
+ CTreeItemPin* t = dynamic_cast<CTreeItemPin*>((CTreeItem*)m_tree.GetItemData(hTI));
+ ASSERT(t);
+
+ if(!t->m_pPin) return;
+
+ CComPtr<IPin> pPinTo;
+ t->m_pPin->ConnectedTo(&pPinTo);
+
+ CMediaType mt;
+ if(pPinTo) t->m_pPin->ConnectionMediaType(&mt);
+
+ CAtlArray<CMediaType> mts;
+ BeginEnumMediaTypes(t->m_pPin, pEMT, pmt)
+ mts.Add(*pmt);
+ EndEnumMediaTypes(pmt)
+
+ CMenu m;
+ m.CreatePopupMenu();
+
+ int i = 1, mtbase = 1000, mti = mtbase;
+
+ m.AppendMenu(MF_STRING, i++, !pPinTo ? ResStr(IDS_CONVERT_ENABLESTREAM) : ResStr(IDS_CONVERT_DISABLESTREAM));
+ m.AppendMenu(MF_STRING | (!pPinTo ? MF_GRAYED : 0), i++, ResStr(IDS_CONVERT_DEMUXSTREAM));
+
+ if(mts.GetCount() > 1)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ for(int i = 0; i < mts.GetCount(); i++)
+ m.AppendMenu(MF_STRING | (mts[i] == mt ? MF_CHECKED : 0), mti++, CMediaTypeEx(mts[i]).ToString());
+ }
+
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING | (!pPinTo ? MF_GRAYED : 0), i++, ResStr(IDS_CONVERT_PINPROPERTIES));
+
+ switch(i = (int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this))
+ {
+ case 1:
+ if(pPinTo) {m_pGB->Disconnect(pPinTo); m_pGB->Disconnect(t->m_pPin);}
+ else if(pPinTo = GetFirstDisconnectedPin(m_pMux, PINDIR_INPUT)) m_pGB->ConnectDirect(t->m_pPin, pPinTo, NULL);
+ t->Update();
+ break;
+ case 2:
+ {
+ UpdateData();
+
+ CString ext = _T("raw");
+
+ if(mt.subtype == MEDIASUBTYPE_AAC) ext = _T("aac");
+ else if(mt.subtype == MEDIASUBTYPE_MP3) ext = _T("mp3");
+ else if(mt.subtype == FOURCCMap(WAVE_FORMAT_MPEG)) ext = _T("m1a");
+ else if(mt.subtype == MEDIASUBTYPE_MPEG2_AUDIO) ext = _T("m2a");
+ else if(mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3 || mt.subtype == MEDIASUBTYPE_DOLBY_AC3) ext = _T("ac3");
+ else if(mt.subtype == MEDIASUBTYPE_WAVE_DTS || mt.subtype == MEDIASUBTYPE_DTS) ext = _T("dts");
+ else if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO) ext = _T("h264");
+ else if(mt.subtype == FOURCCMap('GEPJ') || mt.subtype == FOURCCMap('gepj')) ext = _T("jpg");
+ else if(mt.majortype == MEDIATYPE_Video && mt.subtype == MEDIASUBTYPE_MPEG2_VIDEO) ext = _T("m2v");
+ else if(mt.majortype == MEDIATYPE_Video && mt.subtype == MEDIASUBTYPE_MPEG1Payload) ext = _T("m1v");
+ else if(mt.subtype == MEDIASUBTYPE_UTF8 || mt.majortype == MEDIATYPE_Text) ext = _T("srt");
+ else if(mt.subtype == MEDIASUBTYPE_SSA) ext = _T("ssa");
+ else if(mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2) ext = _T("ass");
+// else if(mt.subtype == MEDIASUBTYPE_SSF) ext = _T("ssf");
+ else if(mt.subtype == MEDIASUBTYPE_VOBSUB) ext = _T("sub");
+ else if(mt.subtype == MEDIASUBTYPE_PCM || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE) || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT)) ext = _T("wav");
+ // TODO: else if...
+
+ CPath path(m_fn);
+ path.RenameExtension('.' + ext);
+
+ CFileDialog fd(FALSE, NULL, (LPCTSTR)path,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
+ _T("Media files|*.*||"), this, 0);
+ if(fd.DoModal() == IDOK)
+ {
+ if(!ConvertFile(fd.GetPathName(), pPinTo))
+ {
+ AfxMessageBox(_T("Failed to start conversion"));
+ }
+ }
+ }
+ break;
+ case 3:
+ EditProperties(CComQIPtr<IDSMPropertyBag>(pPinTo));
+ break;
+ default:
+ i -= mtbase;
+ if(i >= 0 && i < mts.GetCount())
+ {
+ if(pPinTo) {m_pGB->Disconnect(pPinTo); m_pGB->Disconnect(t->m_pPin);}
+ else {pPinTo = GetFirstDisconnectedPin(m_pMux, PINDIR_INPUT);}
+ HRESULT hr = m_pGB->ConnectDirect(t->m_pPin, pPinTo, &mts[i]);
+ if(FAILED(hr))
+ {
+ AfxMessageBox(_T("Reconnection attempt failed!"));
+ if(mt.majortype != GUID_NULL)
+ hr = m_pGB->ConnectDirect(t->m_pPin, pPinTo, &mt);
+ }
+ t->Update();
+ }
+ break;
+ }
+}
+
+void CConvertDlg::ShowResourceFolderPopup(HTREEITEM hTI, CPoint p)
+{
+ CTreeItemResourceFolder* t = dynamic_cast<CTreeItemResourceFolder*>((CTreeItem*)m_tree.GetItemData(hTI));
+ ASSERT(t);
+
+ CMenu m;
+ m.CreatePopupMenu();
+
+ int i = 1;
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_ADDRESOURCE));
+ if(m_tree.ItemHasChildren(*t))
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVEALL));
+ }
+
+ switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this))
+ {
+ case 1:
+ {
+ CFileDialog fd(TRUE, NULL, NULL,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
+ _T("All files|*.*||"), this, 0);
+ if(fd.DoModal() == IDOK)
+ {
+ CString fn = fd.GetPathName();
+ if(FILE* f = _tfopen(fn, _T("rb")))
+ {
+ CDSMResource res;
+
+ CPath path(fn);
+ path.StripPath();
+ res.name = (LPCTSTR)path;
+
+ CRegKey key;
+ TCHAR mime[256];
+ ULONG len = countof(mime);
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, path.GetExtension().MakeLower(), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(_T("Content Type"), mime, &len))
+ res.mime = mime;
+
+ CTreeItemResource* t = new CTreeItemResource(res, m_tree, hTI);
+ m_pTIs.AddTail(t);
+
+ if(EditResource(t))
+ {
+ fseek(f, 0, 2);
+ long size = ftell(f);
+ fseek(f, 0, 0);
+ t->m_res.data.SetCount(size);
+ for(BYTE* ptr = t->m_res.data.GetData(),* end = ptr + size;
+ size > 0 && end - ptr >= size && fread(ptr, min(size, 1024), 1, f) > 0;
+ ptr += 1024, size -= 1024);
+ fclose(f);
+ }
+ else
+ {
+ DeleteItem(*t);
+ }
+ }
+ else
+ {
+ AfxMessageBox(_T("Cannot open file!"));
+ }
+ }
+ }
+ break;
+ case 2:
+ DeleteChildren(hTI);
+ break;
+ }
+}
+
+void CConvertDlg::ShowResourcePopup(HTREEITEM hTI, CPoint p)
+{
+ CTreeItemResource* t = dynamic_cast<CTreeItemResource*>((CTreeItem*)m_tree.GetItemData(hTI));
+ ASSERT(t);
+
+ CMenu m;
+ m.CreatePopupMenu();
+
+ int i = 1;
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVE));
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_SAVEAS));
+ if(AfxGetAppSettings().fEnableWebServer) m.AppendMenu(MF_STRING, 1000, ResStr(IDS_CONVERT_LAUNCHINBROWSER));
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_RESOURCEPROPERTIES));
+
+ switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this))
+ {
+ case 1:
+ DeleteItem(*t);
+ break;
+ case 2:
+ {
+ CFileDialog fd(FALSE, NULL, CString(t->m_res.name),
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
+ _T("All files|*.*||"), this, 0);
+ if(fd.DoModal() == IDOK)
+ {
+ if(FILE* f = _tfopen(fd.GetPathName(), _T("wb")))
+ {
+ fwrite(t->m_res.data.GetData(), 1, t->m_res.data.GetCount(), f);
+ fclose(f);
+ }
+ }
+ }
+ break;
+ case 3:
+ EditResource(t);
+ break;
+ case 1000:
+ {
+ CString url;
+ url.Format(_T("http://localhost:%d/convres.html?id=%x"), AfxGetAppSettings().nWebServerPort, (DWORD)&t->m_res);
+ ShellExecute(NULL, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);
+ }
+ break;
+ }
+}
+
+bool CConvertDlg::EditProperties(IDSMPropertyBag* pPB)
+{
+ CConvertPropsDlg dlg(!!CComQIPtr<IPin>(pPB), this);
+
+ ULONG props;
+ if(FAILED(pPB->CountProperties(&props)))
+ props = 0;
+
+ for(ULONG i = 0; i < props; i++)
+ {
+ PROPBAG2 PropBag;
+ memset(&PropBag, 0, sizeof(PropBag));
+ ULONG cPropertiesReturned = 0;
+ if(FAILED(pPB->GetPropertyInfo(i, 1, &PropBag, &cPropertiesReturned)))
+ continue;
+
+ HRESULT hr;
+ CComVariant var;
+ if(SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr)) && SUCCEEDED(hr))
+ dlg.m_props[CString(PropBag.pstrName)] = CString(var);
+
+ CoTaskMemFree(PropBag.pstrName);
+ }
+
+ if(IDOK != dlg.DoModal())
+ return false;
+
+ pPB->DelAllProperties();
+
+ POSITION pos = dlg.m_props.GetStartPosition();
+ while(pos)
+ {
+ CString key, value;
+ dlg.m_props.GetNextAssoc(pos, key, value);
+ pPB->SetProperty(CStringW(key), CStringW(value));
+ }
+
+ return true;
+}
+
+bool CConvertDlg::EditResource(CTreeItemResource* t)
+{
+ CConvertResDlg dlg(this);
+
+ dlg.m_name = t->m_res.name;
+ dlg.m_mime = t->m_res.mime;
+ dlg.m_desc = t->m_res.desc;
+
+ if(IDOK != dlg.DoModal())
+ return false;
+
+ t->m_res.name = dlg.m_name;
+ t->m_res.mime = dlg.m_mime;
+ t->m_res.desc = dlg.m_desc;
+
+ t->Update();
+
+ return true;
+}
+
+void CConvertDlg::ShowChapterFolderPopup(HTREEITEM hTI, CPoint p)
+{
+ CTreeItemChapterFolder* t = dynamic_cast<CTreeItemChapterFolder*>((CTreeItem*)m_tree.GetItemData(hTI));
+ ASSERT(t);
+
+ CMenu m;
+ m.CreatePopupMenu();
+
+ int i = 1;
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_ADDCHAPTER));
+ if(m_tree.ItemHasChildren(*t))
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVEALL));
+ }
+
+ switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this))
+ {
+ case 1:
+ {
+ CDSMChapter chap;
+ CTreeItemChapter* t = new CTreeItemChapter(CDSMChapter(0, L""), m_tree, hTI);
+ m_pTIs.AddTail(t);
+ if(!EditChapter(t))
+ DeleteItem(*t);
+ }
+ break;
+ case 2:
+ DeleteChildren(hTI);
+ break;
+ }
+}
+
+void CConvertDlg::ShowChapterPopup(HTREEITEM hTI, CPoint p)
+{
+ CTreeItemChapter* t = dynamic_cast<CTreeItemChapter*>((CTreeItem*)m_tree.GetItemData(hTI));
+ ASSERT(t);
+
+ CMenu m;
+ m.CreatePopupMenu();
+
+ int i = 1;
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_REMOVE));
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING, i++, ResStr(IDS_CONVERT_CHAPTERPROPERTIES));
+
+ switch((int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this))
+ {
+ case 1:
+ DeleteItem(hTI);
+ break;
+ case 2:
+ EditChapter(t);
+ break;
+ }
+}
+
+bool CConvertDlg::EditChapter(CTreeItemChapter* t)
+{
+ CConvertChapDlg dlg(this);
+
+ int h = (int)(t->m_chap.rt/10000000/60/60);
+ int m = (int)(t->m_chap.rt/10000000/60%60);
+ int s = (int)(t->m_chap.rt/10000000%60);
+ int ms = (int)(t->m_chap.rt/10000%1000);
+
+ dlg.m_name = t->m_chap.name;
+ dlg.m_time.Format(_T("%02d:%02d:%02d.%03d"), h, m, s, ms);
+
+ if(IDOK != dlg.DoModal())
+ return false;
+
+ TCHAR c;
+ if(_stscanf(dlg.m_time, _T("%d%c%d%c%d%c%d"), &h, &c, &m, &c, &s, &c, &ms) != 7)
+ return false;
+
+ t->m_chap.name = dlg.m_name;
+ t->m_chap.rt = ((((__int64)h*60+m)*60+s)*1000+ms)*10000;
+
+ t->Update();
+
+ return true;
+}
+
+void CConvertDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_TREE1, m_tree);
+ DDX_Text(pDX, IDC_EDIT1, m_fn);
+}
+
+BOOL CConvertDlg::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE)
+ return TRUE;
+
+ return __super::PreTranslateMessage(pMsg);
+}
+
+BOOL CConvertDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), TRUE);
+ SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), FALSE);
+
+ AddAnchor(IDC_TREE1, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_EDIT1, BOTTOM_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON1, BOTTOM_RIGHT);
+ AddAnchor(IDC_HLINE, BOTTOM_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON2, BOTTOM_CENTER);
+ AddAnchor(IDC_BUTTON3, BOTTOM_CENTER);
+ AddAnchor(IDC_BUTTON4, BOTTOM_CENTER);
+
+ CSize s(400, 200);
+ SetMinTrackSize(s);
+
+ m_streamtypesbm.LoadBitmap(IDB_STREAMTYPES);
+ m_streamtypes.Create(16, 18, ILC_MASK|ILC_COLOR32, 0, 4);
+ m_streamtypes.Add(&m_streamtypesbm, 0xffffff);
+ m_tree.SetImageList(&m_streamtypes, TVSIL_NORMAL);
+
+ GetWindowText(m_title);
+ m_nIDEventStatus = SetTimer(1, 1000, NULL);
+
+ HRESULT hr;
+ m_pMux = new CDSMMuxerFilter(NULL, &hr, false, false);
+
+ m_pGB = new CFGManagerMuxer(_T("CFGManagerMuxer"), NULL);
+ m_pGB->AddToROT();
+
+ if(FAILED(m_pGB->AddFilter(m_pMux, L"Mux"))
+ || !(m_pMC = m_pGB) || !(m_pME = m_pGB) || !(m_pMS = m_pMux)
+ || FAILED(m_pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0)))
+ {
+ MessageBeep(-1);
+ SendMessage(WM_CLOSE);
+ return TRUE;
+ }
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CConvertDlg::OnOK()
+{
+}
+
+BEGIN_MESSAGE_MAP(CConvertDlg, CResizableDialog)
+ ON_MESSAGE(WM_GRAPHNOTIFY, OnGraphNotify)
+ ON_WM_DROPFILES()
+ ON_WM_CLOSE()
+ ON_NOTIFY(NM_CLICK, IDC_TREE1, OnNMClickTree1)
+ ON_NOTIFY(NM_RCLICK, IDC_TREE1, OnNMRclickTree1)
+ ON_NOTIFY(NM_DBLCLK, IDC_TREE1, OnNMDblclkTree1)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateButton1)
+ ON_WM_TIMER()
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateButton2)
+ ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON3, OnUpdateButton3)
+ ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton4)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON4, OnUpdateButton4)
+END_MESSAGE_MAP()
+
+// CConvertDlg message handlers
+
+LRESULT CConvertDlg::OnGraphNotify(WPARAM wParam, LPARAM lParam)
+{
+ HRESULT hr = S_OK;
+
+ LONG evCode, evParam1, evParam2;
+ while(m_pME && SUCCEEDED(m_pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0)))
+ {
+ hr = m_pME->FreeEventParams(evCode, evParam1, evParam2);
+
+ bool fStop = false;
+
+ if(EC_COMPLETE == evCode)
+ {
+ fStop = true;
+ }
+ else if(EC_ERRORABORT == evCode)
+ {
+ fStop = true;
+
+ CString errmsg;
+ LPVOID lpMsgBuf;
+ if(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL))
+ {
+ errmsg = (LPCTSTR)lpMsgBuf;
+ LocalFree(lpMsgBuf);
+ }
+
+ CString str;
+ str.Format(_T("Could not complete conversion, the output file is most likely unusable.\n\nError code: 0x%08x"), evParam1);
+ if(!errmsg.IsEmpty()) str += _T(" (") + errmsg + _T(")");
+ AfxMessageBox(str, MB_OK);
+ }
+
+ if(fStop && m_pMC)
+ {
+ m_pMC->Stop();
+ m_tree.EnableWindow(TRUE);
+ }
+ }
+
+ return hr;
+}
+
+void CConvertDlg::OnDropFiles(HDROP hDropInfo)
+{
+ for(int i = 0, j = DragQueryFile(hDropInfo, 0xffffffff, 0, 0); i < j; i++)
+ {
+ CString fn;
+ fn.ReleaseBufferSetLength(DragQueryFile(hDropInfo, i, fn.GetBuffer(MAX_PATH), MAX_PATH));
+
+ AddFile(fn);
+ }
+
+ __super::OnDropFiles(hDropInfo);
+}
+
+void CConvertDlg::OnClose()
+{
+ HTREEITEM hTI = m_tree.GetRootItem();
+ while(hTI)
+ {
+ HTREEITEM hTINext = m_tree.GetNextSiblingItem(hTI);
+ DeleteItem(hTI);
+ hTI = hTINext;
+ }
+
+ m_pGB->RemoveFromROT();
+ m_pGB = NULL;
+
+ __super::OnClose();
+}
+
+void CConvertDlg::OnNMClickTree1(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ CPoint sp, cp;
+ HTREEITEM hTI = HitTest(sp, cp);
+ if(!hTI) return;
+ m_tree.SelectItem(hTI);
+
+ *pResult = 0;
+}
+
+void CConvertDlg::OnNMRclickTree1(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ CPoint sp, cp;
+ HTREEITEM hTI = HitTest(sp, cp);
+
+ if(hTI)
+ {
+ m_tree.SelectItem(hTI);
+
+ CTreeItem* t = (CTreeItem*)m_tree.GetItemData(hTI);
+
+ if(dynamic_cast<CTreeItemPin*>(t))
+ ShowPinPopup(hTI, sp);
+ else if(dynamic_cast<CTreeItemFile*>(t))
+ ShowFilePopup(hTI, sp);
+ else if(dynamic_cast<CTreeItemResourceFolder*>(t))
+ ShowResourceFolderPopup(hTI, sp);
+ else if(dynamic_cast<CTreeItemResource*>(t))
+ ShowResourcePopup(hTI, sp);
+ else if(dynamic_cast<CTreeItemChapterFolder*>(t))
+ ShowChapterFolderPopup(hTI, sp);
+ else if(dynamic_cast<CTreeItemChapter*>(t))
+ ShowChapterPopup(hTI, sp);
+ }
+ else
+ {
+ ShowPopup(sp);
+ }
+
+ *pResult = 0;
+}
+
+void CConvertDlg::OnNMDblclkTree1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ CPoint sp, cp;
+ HTREEITEM hTI = HitTest(sp, cp);
+
+ if(hTI)
+ {
+ CTreeItem* t = (CTreeItem*)m_tree.GetItemData(hTI);
+
+ if(CTreeItemPin* t2 = dynamic_cast<CTreeItemPin*>(t))
+ {
+ CComPtr<IPin> pPinTo;
+ t2->m_pPin->ConnectedTo(&pPinTo);
+
+ if(CComQIPtr<IDSMPropertyBag> pPB = pPinTo)
+ EditProperties(pPB);
+ }
+ else if(CTreeItemResource* t2 = dynamic_cast<CTreeItemResource*>(t))
+ {
+ EditResource(t2);
+ }
+ else if(CTreeItemChapter* t2 = dynamic_cast<CTreeItemChapter*>(t))
+ {
+ EditChapter(t2);
+ }
+ }
+
+ *pResult = 0;
+}
+
+void CConvertDlg::OnBnClickedButton1()
+{
+ UpdateData();
+
+ CFileDialog fd(FALSE, _T(".dsm"), m_fn,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
+ _T("DirectShow Media file|*.dsm|All files|*.*|"), this, 0);
+
+ if(fd.DoModal() == IDOK)
+ {
+ m_fn = fd.GetPathName();
+ UpdateData(FALSE);
+ }
+}
+
+void CConvertDlg::OnUpdateButton1(CCmdUI* pCmdUI)
+{
+ OAFilterState fs;
+ pCmdUI->Enable(m_pMC && SUCCEEDED(m_pMC->GetState(0, &fs)) && fs == State_Stopped);
+}
+
+void CConvertDlg::OnTimer(UINT nIDEvent)
+{
+ if(nIDEvent == m_nIDEventStatus && m_pMS && m_pMC)
+ {
+ OAFilterState fs;
+ if(SUCCEEDED(m_pMC->GetState(0, &fs)) && fs != State_Stopped)
+ {
+ GUID tf;
+ m_pMS->GetTimeFormat(&tf);
+
+ REFERENCE_TIME rtCur, rtDur;
+ HRESULT hr = m_pMS->GetDuration(&rtDur);
+ m_pMS->GetCurrentPosition(&rtCur);
+
+ CString str;
+ if(hr == S_OK && rtDur != 0) str.Format(_T("%.2f%%"), 1.0 * (rtCur * 100) / rtDur);
+ else if(hr == S_OK && rtDur == 0) str = _T("Live");
+ else if(tf == TIME_FORMAT_BYTE) str.Format(_T("%.2fKB"), 1.0 * rtCur / 1024);
+ else if(tf == TIME_FORMAT_MEDIA_TIME) str.Format(_T("%02d:%02d:%02d"), int(rtCur/3600000000)%60, int(rtCur/60000000)%60, int(rtCur/1000000)%60);
+ else str = _T("Please Wait");
+
+ SetWindowText(_T("Converting - ") + str);
+ }
+ else
+ {
+ SetWindowText(m_title);
+ }
+ }
+
+ __super::OnTimer(nIDEvent);
+}
+
+void CConvertDlg::OnBnClickedButton2()
+{
+ OAFilterState fs;
+ if(FAILED(m_pMC->GetState(0, &fs)))
+ return;
+
+ if(fs != State_Stopped)
+ {
+ m_pMC->Run();
+ return;
+ }
+
+ UpdateData();
+
+ if(!ConvertFile(m_fn))
+ {
+ AfxMessageBox(_T("Failed to start conversion"));
+ }
+}
+
+void CConvertDlg::OnUpdateButton2(CCmdUI* pCmdUI)
+{
+ int nIn, nOut, nInC, nOutC;
+ CountPins(m_pMux, nIn, nOut, nInC, nOutC);
+
+ OAFilterState fs;
+ pCmdUI->Enable(nInC > 0 && GetDlgItem(IDC_EDIT1)->GetWindowTextLength() > 0
+ && m_pMS && m_pMC && SUCCEEDED(m_pMC->GetState(0, &fs)) && fs != State_Running);
+}
+
+void CConvertDlg::OnBnClickedButton3()
+{
+ if(m_pMC) m_pMC->Pause();
+}
+
+void CConvertDlg::OnUpdateButton3(CCmdUI* pCmdUI)
+{
+ OAFilterState fs;
+ pCmdUI->Enable(m_pMC && SUCCEEDED(m_pMC->GetState(0, &fs)) && fs == State_Running);
+}
+
+void CConvertDlg::OnBnClickedButton4()
+{
+ if(m_pMC) m_pMC->Stop();
+ m_tree.EnableWindow(TRUE);
+}
+
+void CConvertDlg::OnUpdateButton4(CCmdUI* pCmdUI)
+{
+ OAFilterState fs;
+ pCmdUI->Enable(m_pMC && SUCCEEDED(m_pMC->GetState(0, &fs)) && fs != State_Stopped);
+}
+
+//
+// CFilterTreeCtrl
+//
+
+CFilterTreeCtrl::CFilterTreeCtrl()
+{
+}
+
+void CFilterTreeCtrl::PreSubclassWindow()
+{
+ EnableToolTips(TRUE);
+
+ __super::PreSubclassWindow();
+}
+
+INT_PTR CFilterTreeCtrl::OnToolHitTest(CPoint p, TOOLINFO* pTI) const
+{
+ UINT nFlags;
+ HTREEITEM hTI = HitTest(p, &nFlags);
+ if(nFlags & TVHT_ONITEM)
+ {
+ CRect r;
+ GetItemRect(hTI, r, TRUE);
+ pTI->hwnd = m_hWnd;
+ pTI->uId = (UINT)hTI;
+ pTI->lpszText = LPSTR_TEXTCALLBACK;
+ pTI->rect = r;
+ return pTI->uId;
+ }
+
+ return -1;
+}
+
+BEGIN_MESSAGE_MAP(CFilterTreeCtrl, CTreeCtrl)
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipText)
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipText)
+END_MESSAGE_MAP()
+
+BOOL CFilterTreeCtrl::OnToolTipText(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
+{
+ TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
+ TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
+
+ UINT nID = pNMHDR->idFrom;
+
+ if(nID == (UINT)m_hWnd
+ && (pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND)
+ || pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND)))
+ return FALSE;
+
+ ::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, (LPARAM)(INT)1000);
+
+ HTREEITEM hTI = (HTREEITEM)nID;
+
+ CString str;
+ static CStringA m_strTipTextA;
+ static CStringW m_strTipTextW;
+
+ CConvertDlg::CTreeItem* t = (CConvertDlg::CTreeItem*)GetItemData(hTI);
+ if(!t || !t->ToolTip(str)) return FALSE;
+
+ m_strTipTextA = str;
+ m_strTipTextW = str;
+
+ if(pNMHDR->code == TTN_NEEDTEXTA) pTTTA->lpszText = (LPSTR)(LPCSTR)m_strTipTextA;
+ else pTTTW->lpszText = (LPWSTR)(LPCWSTR)m_strTipTextW;
+
+ *pResult = 0;
+
+ return TRUE; // message was handled
+}
+
+//
+// CConvertDlg::CTreeItem*
+//
+
+CConvertDlg::CTreeItem::CTreeItem(CTreeCtrl& tree, HTREEITEM hTIParent)
+ : m_tree(tree)
+{
+ m_hTI = m_tree.InsertItem(_T(""), hTIParent);
+ m_tree.SetItemData(m_hTI, (DWORD_PTR)this);
+ Update();
+}
+
+CConvertDlg::CTreeItem::~CTreeItem()
+{
+}
+
+void CConvertDlg::CTreeItem::SetLabel(LPCTSTR label)
+{
+ m_tree.SetItemText(m_hTI, label);
+}
+
+void CConvertDlg::CTreeItem::SetImage(int nImage, int nSelectedImage)
+{
+ m_tree.SetItemImage(m_hTI, nImage, nSelectedImage);
+}
+
+//
+
+CConvertDlg::CTreeItemFilter::CTreeItemFilter(IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent)
+ : CTreeItem(tree, hTIParent)
+ , m_pBF(pBF)
+{
+ Update();
+}
+
+void CConvertDlg::CTreeItemFilter::Update()
+{
+ SetLabel(CString(GetFilterName(m_pBF)));
+}
+
+//
+
+CConvertDlg::CTreeItemFile::CTreeItemFile(CString fn, IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent)
+ : CTreeItemFilter(pBF, tree, hTIParent)
+ , m_fn(fn)
+{
+ Update();
+}
+
+void CConvertDlg::CTreeItemFile::Update()
+{
+ CPath path = m_fn;
+ path.StripPath();
+ SetLabel(path);
+}
+
+bool CConvertDlg::CTreeItemFile::ToolTip(CString& str)
+{
+ str = m_fn;
+ return true;
+}
+
+//
+
+CConvertDlg::CTreeItemPin::CTreeItemPin(IPin* pPin, CTreeCtrl& tree, HTREEITEM hTIParent)
+ : CTreeItem(tree, hTIParent)
+ , m_pPin(pPin)
+{
+ Update();
+}
+
+void CConvertDlg::CTreeItemPin::Update()
+{
+ if(!m_pPin) {ASSERT(0); return;}
+
+ CString label = GetPinName(m_pPin);
+ if(!IsConnected()) label = _T("[D] ") + label;
+ SetLabel(label);
+
+ CMediaType mt;
+ if(S_OK == m_pPin->ConnectionMediaType(&mt))
+ {
+ if(mt.majortype == MEDIATYPE_Video) SetImage(1, 1);
+ else if(mt.majortype == MEDIATYPE_Audio) SetImage(2, 2);
+ else if(mt.majortype == MEDIATYPE_Text || mt.majortype == MEDIATYPE_Subtitle) SetImage(3, 3);
+ }
+}
+
+bool CConvertDlg::CTreeItemPin::ToolTip(CString& str)
+{
+ CMediaTypeEx mt;
+ if(FAILED(m_pPin->ConnectionMediaType(&mt))) return false;
+ str = mt.ToString(m_pPin);
+ return true;
+}
+
+bool CConvertDlg::CTreeItemPin::IsConnected()
+{
+ CComPtr<IPin> pPinTo;
+ return m_pPin && SUCCEEDED(m_pPin->ConnectedTo(&pPinTo)) && pPinTo;
+}
+
+//
+
+CConvertDlg::CTreeItemResourceFolder::CTreeItemResourceFolder(CTreeCtrl& tree, HTREEITEM hTIParent)
+ : CTreeItem(tree, hTIParent)
+{
+ Update();
+}
+
+void CConvertDlg::CTreeItemResourceFolder::Update()
+{
+ SetLabel(_T("Resources"));
+}
+
+bool CConvertDlg::CTreeItemResourceFolder::ToolTip(CString& str)
+{
+ if(!m_tree.ItemHasChildren(m_hTI))
+ return false;
+
+ int files = 0;
+ float size = 0;
+
+ HTREEITEM hChildItem = m_tree.GetChildItem(m_hTI);
+
+ while(hChildItem != NULL)
+ {
+ HTREEITEM hNextItem = m_tree.GetNextItem(hChildItem, TVGN_NEXT);
+ if(CTreeItemResource* t = dynamic_cast<CTreeItemResource*>((CTreeItem*)m_tree.GetItemData(hChildItem)))
+ size += t->m_res.data.GetCount(), files++;
+ hChildItem = hNextItem;
+ }
+
+ size /= 1024;
+ if(size < 1024) str.Format(_T("%d file(s), %.2f KB"), files, size);
+ else str.Format(_T("%d file(s), %.2f MB"), files, size/1024);
+
+ return true;
+}
+
+//
+
+CConvertDlg::CTreeItemResource::CTreeItemResource(const CDSMResource& res, CTreeCtrl& tree, HTREEITEM hTIParent)
+ : CTreeItem(tree, hTIParent)
+{
+ m_res = res;
+ Update();
+}
+
+CConvertDlg::CTreeItemResource::~CTreeItemResource()
+{
+}
+
+void CConvertDlg::CTreeItemResource::Update()
+{
+ SetLabel(CString(m_res.name));
+
+ CStringW mime = m_res.mime;
+ mime.Trim();
+ mime.MakeLower();
+ if(mime == L"application/x-truetype-font") SetImage(4, 4);
+ else if(mime.Find(L"text/") == 0) SetImage(5, 5);
+ else SetImage(6, 6);
+}
+
+bool CConvertDlg::CTreeItemResource::ToolTip(CString& str)
+{
+ if(!m_res.mime.IsEmpty()) str = CString(m_res.mime) + _T("\r\n\r\n");
+ if(!m_res.desc.IsEmpty()) str += CString(m_res.desc);
+ str.Trim();
+ return true;
+}
+
+//
+
+CConvertDlg::CTreeItemChapterFolder::CTreeItemChapterFolder(CTreeCtrl& tree, HTREEITEM hTIParent)
+ : CTreeItem(tree, hTIParent)
+{
+ Update();
+}
+
+void CConvertDlg::CTreeItemChapterFolder::Update()
+{
+ SetLabel(_T("Chapters"));
+}
+
+//
+
+CConvertDlg::CTreeItemChapter::CTreeItemChapter(const CDSMChapter& chap, CTreeCtrl& tree, HTREEITEM hTIParent)
+ : CTreeItem(tree, hTIParent)
+{
+ m_chap = chap;
+ Update();
+}
+
+void CConvertDlg::CTreeItemChapter::Update()
+{
+ REFERENCE_TIME rt = m_chap.rt;
+ rt /= 10000;
+ int ms = (int)(rt%1000);
+ rt /= 1000;
+ int s = (int)(rt%60);
+ rt /= 60;
+ int m = (int)(rt%60);
+ rt /= 60;
+ int h = (int)(rt);
+
+ CString label;
+ label.Format(_T("%02d:%02d:%02d.%03d - %s"), h, m, s, ms, CString(m_chap.name));
+ SetLabel(label);
+
+ SetImage(7, 7);
+}
diff --git a/src/apps/mplayerc/ConvertDlg.h b/src/apps/mplayerc/ConvertDlg.h
new file mode 100644
index 000000000..72bf7a271
--- /dev/null
+++ b/src/apps/mplayerc/ConvertDlg.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "IGraphBuilder2.h"
+#include "..\..\DSUtil\DSMPropertyBag.h"
+
+class CFilterTreeCtrl : public CTreeCtrl
+{
+public:
+ CFilterTreeCtrl();
+
+protected:
+ virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
+ virtual void PreSubclassWindow();
+
+public:
+ DECLARE_MESSAGE_MAP()
+ afx_msg BOOL OnToolTipText(UINT nID, NMHDR* pNMHDR, LRESULT* pResult);
+};
+
+// CConvertDlg dialog
+
+class CConvertDlg : public CResizableDialog
+{
+public:
+ class CTreeItem
+ {
+ protected:
+ CTreeCtrl& m_tree;
+ HTREEITEM m_hTI;
+
+ public:
+ CTreeItem(CTreeCtrl& tree, HTREEITEM hTIParent);
+ virtual ~CTreeItem();
+ virtual void Update() {}
+ virtual bool ToolTip(CString& str) {return false;}
+ void SetLabel(LPCTSTR label);
+ void SetImage(int nImage, int nSelectedImage);
+ operator HTREEITEM() {return m_hTI;}
+ };
+
+ class CTreeItemFilter : public CTreeItem
+ {
+ public:
+ CComPtr<IBaseFilter> m_pBF;
+ CTreeItemFilter(IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent);
+ void Update();
+ };
+
+ class CTreeItemFile : public CTreeItemFilter
+ {
+ public:
+ CString m_fn;
+ CTreeItemFile(CString fn, IBaseFilter* pBF, CTreeCtrl& tree, HTREEITEM hTIParent);
+ void Update();
+ bool ToolTip(CString& str);
+ };
+
+ class CTreeItemPin : public CTreeItem
+ {
+ public:
+ CComPtr<IPin> m_pPin;
+ CTreeItemPin(IPin* pPin, CTreeCtrl& tree, HTREEITEM hTIParent);
+ void Update();
+ bool ToolTip(CString& str);
+ bool IsConnected();
+ };
+
+ class CTreeItemResourceFolder : public CTreeItem
+ {
+ public:
+ CTreeItemResourceFolder(CTreeCtrl& tree, HTREEITEM hTIParent);
+ void Update();
+ bool ToolTip(CString& str);
+ };
+
+ class CTreeItemResource : public CTreeItem
+ {
+ public:
+ CDSMResource m_res;
+ CTreeItemResource(const CDSMResource& res, CTreeCtrl& tree, HTREEITEM hTIParent);
+ ~CTreeItemResource();
+ void Update();
+ bool ToolTip(CString& str);
+ };
+
+ class CTreeItemChapterFolder : public CTreeItem
+ {
+ public:
+ CTreeItemChapterFolder(CTreeCtrl& tree, HTREEITEM hTIParent);
+ void Update();
+ };
+
+ class CTreeItemChapter : public CTreeItem
+ {
+ public:
+ CDSMChapter m_chap;
+ CTreeItemChapter(const CDSMChapter& chap, CTreeCtrl& tree, HTREEITEM hTIParent);
+ void Update();
+ };
+
+private:
+ CComPtr<IGraphBuilder2> m_pGB;
+ CComPtr<IBaseFilter> m_pMux;
+ CComQIPtr<IMediaControl> m_pMC;
+ CComQIPtr<IMediaEventEx> m_pME;
+ CComQIPtr<IMediaSeeking> m_pMS;
+
+ CString m_title;
+ UINT m_nIDEventStatus;
+
+ CBitmap m_streamtypesbm;
+ CImageList m_streamtypes;
+
+ CList<CTreeItem*> m_pTIs;
+
+ void AddFile(CString fn);
+ bool ConvertFile(LPCTSTR fn, IPin* pPin = NULL);
+ void AddFilter(HTREEITEM hTI, IBaseFilter* pBF);
+ void DeleteFilter(IBaseFilter* pBF);
+ void DeleteItem(HTREEITEM hTI);
+ void DeleteChildren(HTREEITEM hTI);
+
+ HTREEITEM HitTest(CPoint& sp, CPoint& cp);
+
+ void ShowPopup(CPoint p);
+ void ShowFilePopup(HTREEITEM hTI, CPoint p);
+ void ShowPinPopup(HTREEITEM hTI, CPoint p);
+ void ShowResourceFolderPopup(HTREEITEM hTI, CPoint p);
+ void ShowResourcePopup(HTREEITEM hTI, CPoint p);
+ void ShowChapterFolderPopup(HTREEITEM hTI, CPoint p);
+ void ShowChapterPopup(HTREEITEM hTI, CPoint p);
+
+ bool EditProperties(IDSMPropertyBag* pPB);
+ bool EditResource(CTreeItemResource* t);
+ bool EditChapter(CTreeItemChapter* t);
+
+public:
+ CConvertDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~CConvertDlg();
+
+// Dialog Data
+ enum { IDD = IDD_CONVERT_DLG };
+ CFilterTreeCtrl m_tree;
+ CString m_fn;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg LRESULT OnGraphNotify(WPARAM wParam, LPARAM lParam);
+ afx_msg void OnDropFiles(HDROP hDropInfo);
+ afx_msg void OnClose();
+ afx_msg void OnNMClickTree1(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnNMRclickTree1(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnNMDblclkTree1(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnUpdateButton1(CCmdUI* pCmdUI);
+ afx_msg void OnTimer(UINT nIDEvent);
+ afx_msg void OnBnClickedButton2();
+ afx_msg void OnBnClickedButton3();
+ afx_msg void OnBnClickedButton4();
+ afx_msg void OnUpdateButton2(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateButton3(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateButton4(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/ConvertPropsDlg.cpp b/src/apps/mplayerc/ConvertPropsDlg.cpp
new file mode 100644
index 000000000..da420438f
--- /dev/null
+++ b/src/apps/mplayerc/ConvertPropsDlg.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// ConvertPropsDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "ConvertPropsDlg.h"
+
+
+// CConvertPropsDlg dialog
+
+CConvertPropsDlg::CConvertPropsDlg(bool fPin, CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CConvertPropsDlg::IDD, pParent)
+ , m_fPin(fPin)
+{
+}
+
+CConvertPropsDlg::~CConvertPropsDlg()
+{
+}
+
+void CConvertPropsDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO1, m_fcc);
+ DDX_Control(pDX, IDC_EDIT1, m_text);
+ DDX_Control(pDX, IDC_LIST1, m_list);
+}
+
+
+BEGIN_MESSAGE_MAP(CConvertPropsDlg, CResizableDialog)
+ ON_NOTIFY(NM_CLICK, IDC_LIST1, OnNMClickList1)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateButton1)
+ ON_CBN_EDITCHANGE(IDC_COMBO1, OnCbnEditchangeCombo1)
+ ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
+ ON_NOTIFY(LVN_KEYDOWN, IDC_LIST1, OnLvnKeydownList1)
+END_MESSAGE_MAP()
+
+
+// CConvertPropsDlg message handlers
+
+BOOL CConvertPropsDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AddAnchor(IDC_COMBO1, TOP_LEFT);
+ AddAnchor(IDC_EDIT1, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDC_BUTTON1, TOP_RIGHT);
+ AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDOK, BOTTOM_CENTER);
+ AddAnchor(IDCANCEL, BOTTOM_CENTER);
+
+ if(m_fPin)
+ {
+ m_fcc.AddString(_T("NAME"));
+ m_fcc.AddString(_T("LANG"));
+ m_fcc.AddString(_T("DESC"));
+ m_fcc.AddString(_T("SGRP"));
+ }
+ else
+ {
+ m_fcc.AddString(_T("TITL"));
+ m_fcc.AddString(_T("AUTH"));
+ m_fcc.AddString(_T("RTNG"));
+ m_fcc.AddString(_T("CPYR"));
+ m_fcc.AddString(_T("DESC"));
+ }
+
+ m_list.InsertColumn(0, _T("ID"), LVCFMT_LEFT, 75);
+ m_list.InsertColumn(1, _T("Text"), LVCFMT_LEFT, 280);
+
+ m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
+
+ POSITION pos = m_props.GetStartPosition();
+ while(pos)
+ {
+ CString key, value;
+ m_props.GetNextAssoc(pos, key, value);
+ SetItem(key, value);
+ }
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CConvertPropsDlg::SetItem(CString key, CString value)
+{
+ LVFINDINFO fi;
+ fi.flags = LVFI_STRING;
+ fi.psz = key;
+
+ int i = m_list.FindItem(&fi);
+ if(i < 0) i = m_list.InsertItem(m_list.GetItemCount(), _T(""));
+
+ key.Trim();
+ value.Trim();
+
+ if(value.IsEmpty())
+ {
+ m_list.DeleteItem(i);
+ return;
+ }
+
+ if(key == _T("LANG") && value.GetLength() != 3)
+ {
+ m_list.DeleteItem(i);
+ AfxMessageBox(_T("LANG has to be a three letter ISO 639-2 language code."), MB_OK);
+ return;
+ }
+
+ m_list.SetItemText(i, 0, key);
+ m_list.SetItemText(i, 1, value);
+}
+
+void CConvertPropsDlg::OnOK()
+{
+ m_props.RemoveAll();
+
+ for(int i = 0; i < m_list.GetItemCount(); i++)
+ m_props[m_list.GetItemText(i, 0)] = m_list.GetItemText(i, 1);
+
+ __super::OnOK();
+}
+
+void CConvertPropsDlg::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
+
+ if(lpnmlv->iItem >= 0)
+ {
+ m_fcc.SetWindowText(m_list.GetItemText(lpnmlv->iItem, 0));
+ m_text.SetWindowText(m_list.GetItemText(lpnmlv->iItem, 1));
+ }
+
+ *pResult = 0;
+}
+
+void CConvertPropsDlg::OnBnClickedButton1()
+{
+ CString key, value;
+ m_fcc.GetWindowText(key);
+ m_text.GetWindowText(value);
+ if(key.GetLength() != 4) {AfxMessageBox(_T("ID must be 4 characters long!"), MB_OK); return;}
+ SetItem(key, value);
+}
+
+void CConvertPropsDlg::OnUpdateButton1(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(GetDlgItem(IDC_EDIT1)->GetWindowTextLength() > 0);
+}
+
+void CConvertPropsDlg::OnCbnEditchangeCombo1()
+{
+ int i = m_fcc.GetCurSel();
+ if(i < 0) return;
+
+ CString key;
+ m_fcc.GetLBText(i, key);
+
+ LVFINDINFO fi;
+ fi.flags = LVFI_STRING;
+ fi.psz = key;
+
+ i = m_list.FindItem(&fi);
+ if(i > 0) m_text.SetWindowText(m_list.GetItemText(i, 1));
+}
+
+void CConvertPropsDlg::OnCbnSelchangeCombo1()
+{
+ OnCbnEditchangeCombo1();
+}
+
+void CConvertPropsDlg::OnLvnKeydownList1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ LPNMLVKEYDOWN pLVKeyDow = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
+
+ int i = m_fcc.GetCurSel();
+ if(i >= 0) m_list.DeleteItem(i);
+
+ *pResult = 0;
+}
diff --git a/src/apps/mplayerc/ConvertPropsDlg.h b/src/apps/mplayerc/ConvertPropsDlg.h
new file mode 100644
index 000000000..53824eed6
--- /dev/null
+++ b/src/apps/mplayerc/ConvertPropsDlg.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "..\..\DSUtil\DSMPropertyBag.h"
+#include "afxwin.h"
+#include "afxcmn.h"
+
+// CConvertPropsDlg dialog
+
+class CConvertPropsDlg : public CResizableDialog
+{
+private:
+ bool m_fPin;
+ void SetItem(CString key, CString value);
+
+public:
+ CConvertPropsDlg(bool fPin, CWnd* pParent = NULL); // standard constructor
+ virtual ~CConvertPropsDlg();
+
+ CAtlStringMap<> m_props;
+
+// Dialog Data
+ enum { IDD = IDD_CONVERTPROPS_DLG };
+ CComboBox m_fcc;
+ CEdit m_text;
+ CListCtrl m_list;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnUpdateButton1(CCmdUI* pCmdUI);
+ afx_msg void OnCbnEditchangeCombo1();
+ afx_msg void OnCbnSelchangeCombo1();
+ afx_msg void OnLvnKeydownList1(NMHDR *pNMHDR, LRESULT *pResult);
+};
diff --git a/src/apps/mplayerc/ConvertResDlg.cpp b/src/apps/mplayerc/ConvertResDlg.cpp
new file mode 100644
index 000000000..37d632801
--- /dev/null
+++ b/src/apps/mplayerc/ConvertResDlg.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// ConvertResDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "ConvertResDlg.h"
+
+// CConvertResDlg dialog
+
+CConvertResDlg::CConvertResDlg(CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CConvertResDlg::IDD, pParent)
+ , m_name(_T(""))
+ , m_desc(_T(""))
+{
+}
+
+CConvertResDlg::~CConvertResDlg()
+{
+}
+
+void CConvertResDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Text(pDX, IDC_EDIT3, m_name);
+ DDX_Text(pDX, IDC_COMBO1, m_mime);
+ DDX_Control(pDX, IDC_COMBO1, m_mimectrl);
+ DDX_Text(pDX, IDC_EDIT2, m_desc);
+}
+
+BOOL CConvertResDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AddAnchor(IDC_EDIT3, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDC_EDIT2, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDOK, BOTTOM_CENTER);
+ AddAnchor(IDCANCEL, BOTTOM_CENTER);
+
+ CRegKey key;
+ CString str(_T("MIME\\Database\\Content Type"));
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, str, KEY_READ))
+ {
+ CAtlStringMap<bool> mimes;
+
+ TCHAR buff[256];
+ DWORD len = countof(buff);
+ for(int i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len); i++, len = countof(buff))
+ {
+ CRegKey mime;
+ TCHAR ext[64];
+ ULONG len = countof(ext);
+ if(ERROR_SUCCESS == mime.Open(HKEY_CLASSES_ROOT, str + _T("\\") + buff, KEY_READ)
+ && ERROR_SUCCESS == mime.QueryStringValue(_T("Extension"), ext, &len))
+ {
+ CString mime = CString(buff).MakeLower();
+ mimes[mime] = true;
+ m_mimectrl.AddString(mime);
+ }
+ }
+
+ static TCHAR* moremimes[] =
+ {
+ _T("application/octet-stream"),
+ _T("application/zip"),
+ _T("application/rar"),
+ _T("application/x-truetype-font"),
+ };
+
+ for(int i = 0; i < countof(moremimes); i++)
+ if(!mimes.Lookup(moremimes[i]))
+ m_mimectrl.AddString(moremimes[i]);
+ }
+
+ m_desc.Replace(_T("\n"), _T("\r\n"));
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CConvertResDlg::OnOK()
+{
+ UpdateData();
+
+ m_name.Trim();
+ m_mime.Trim();
+ m_desc.Replace(_T("\r\n"), _T("\r"));
+ m_desc.Trim();
+
+ __super::OnOK();
+}
+
+BEGIN_MESSAGE_MAP(CConvertResDlg, CResizableDialog)
+ ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOK)
+END_MESSAGE_MAP()
+
+// CConvertResDlg message handlers
+
+void CConvertResDlg::OnUpdateOK(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(GetDlgItem(IDC_EDIT3)->GetWindowTextLength() > 0 && GetDlgItem(IDC_COMBO1)->GetWindowTextLength() > 0);
+}
diff --git a/src/apps/mplayerc/ConvertResDlg.h b/src/apps/mplayerc/ConvertResDlg.h
new file mode 100644
index 000000000..45d54b946
--- /dev/null
+++ b/src/apps/mplayerc/ConvertResDlg.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxwin.h"
+
+
+// CConvertResDlg dialog
+
+class CConvertResDlg : public CResizableDialog
+{
+public:
+ CConvertResDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~CConvertResDlg();
+
+// Dialog Data
+ enum { IDD = IDD_CONVERTRES_DLG };
+ CString m_name;
+ CString m_mime;
+ CComboBox m_mimectrl;
+ CString m_desc;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnUpdateOK(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/D3DFont.cpp b/src/apps/mplayerc/D3DFont.cpp
new file mode 100644
index 000000000..494797a0b
--- /dev/null
+++ b/src/apps/mplayerc/D3DFont.cpp
@@ -0,0 +1,881 @@
+#include "stdafx.h"
+#include <stdio.h>
+#include <tchar.h>
+#include <D3DX9.h>
+#include "D3DFont.h"
+//#include "D3DUtil.h"
+//#include "DXUtil.h"
+
+//-----------------------------------------------------------------------------
+// Miscellaneous helper functions
+//-----------------------------------------------------------------------------
+#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
+#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
+#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
+
+
+
+//-----------------------------------------------------------------------------
+// Custom vertex types for rendering text
+//-----------------------------------------------------------------------------
+#define MAX_NUM_VERTICES 50*6
+
+struct FONT2DVERTEX { D3DXVECTOR4 p; DWORD color; FLOAT tu, tv; };
+struct FONT3DVERTEX { D3DXVECTOR3 p; D3DXVECTOR3 n; FLOAT tu, tv; };
+
+#define D3DFVF_FONT2DVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)
+#define D3DFVF_FONT3DVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
+
+inline FONT2DVERTEX InitFont2DVertex( const D3DXVECTOR4& p, D3DCOLOR color,
+ FLOAT tu, FLOAT tv )
+{
+ FONT2DVERTEX v; v.p = p; v.color = color; v.tu = tu; v.tv = tv;
+ return v;
+}
+
+inline FONT3DVERTEX InitFont3DVertex( const D3DXVECTOR3& p, const D3DXVECTOR3& n,
+ FLOAT tu, FLOAT tv )
+{
+ FONT3DVERTEX v; v.p = p; v.n = n; v.tu = tu; v.tv = tv;
+ return v;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CD3DFont()
+// Desc: Font class constructor
+//-----------------------------------------------------------------------------
+CD3DFont::CD3DFont( const TCHAR* strFontName, DWORD dwHeight, DWORD dwFlags )
+{
+ _tcsncpy( m_strFontName, strFontName, sizeof(m_strFontName) / sizeof(TCHAR) );
+ m_strFontName[sizeof(m_strFontName) / sizeof(TCHAR) - 1] = _T('\0');
+ m_dwFontHeight = dwHeight;
+ m_dwFontFlags = dwFlags;
+ m_dwSpacing = 0;
+
+ m_pd3dDevice = NULL;
+ m_pTexture = NULL;
+ m_pVB = NULL;
+
+ m_pStateBlockSaved = NULL;
+ m_pStateBlockDrawText = NULL;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: ~CD3DFont()
+// Desc: Font class destructor
+//-----------------------------------------------------------------------------
+CD3DFont::~CD3DFont()
+{
+ InvalidateDeviceObjects();
+ DeleteDeviceObjects();
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: CreateGDIFont
+// Desc: Create a font based on the current state of related member variables
+// and return the handle (or null on error)
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::CreateGDIFont( HDC hDC, HFONT* pFont )
+{
+ // Create a font. By specifying ANTIALIASED_QUALITY, we might get an
+ // antialiased font, but this is not guaranteed.
+ INT nHeight = -MulDiv( m_dwFontHeight,
+ (INT)(GetDeviceCaps(hDC, LOGPIXELSY) * m_fTextScale),
+ 72 );
+ DWORD dwBold = (m_dwFontFlags & D3DFONT_BOLD) ? FW_BOLD : FW_NORMAL;
+ DWORD dwItalic = (m_dwFontFlags & D3DFONT_ITALIC) ? TRUE : FALSE;
+ *pFont = CreateFont( nHeight, 0, 0, 0, dwBold, dwItalic,
+ FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
+ CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY,
+ VARIABLE_PITCH, m_strFontName );
+
+ if( *pFont == NULL )
+ return E_FAIL;
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: PaintAlphabet
+// Desc: Paint the printable characters for the given GDI font onto the
+// provided device context. If the bMeasureOnly flag is set, no drawing
+// will occur.
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::PaintAlphabet( HDC hDC, BOOL bMeasureOnly )
+{
+ SIZE size;
+ TCHAR str[2] = _T("x"); // One-character, null-terminated string
+
+ // Calculate the spacing between characters based on line height
+ if( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) )
+ return E_FAIL;
+ m_dwSpacing = (DWORD) ceil(size.cy * 0.3f);
+
+ // Set the starting point for the drawing
+ DWORD x = m_dwSpacing;
+ DWORD y = 0;
+
+ // For each character, draw text on the DC and advance the current position
+ for( char c = 32; c < 127; c++ )
+ {
+ str[0] = c;
+ if( 0 == GetTextExtentPoint32( hDC, str, 1, &size ) )
+ return E_FAIL;
+
+ if( (DWORD)(x + size.cx + m_dwSpacing) > m_dwTexWidth )
+ {
+ x = m_dwSpacing;
+ y += size.cy + 1;
+ }
+
+ // Check to see if there's room to write the character here
+ if( y + size.cy > m_dwTexHeight )
+ return D3DERR_MOREDATA;
+
+ if( !bMeasureOnly )
+ {
+ // Perform the actual drawing
+ if( 0 == ExtTextOut( hDC, x+0, y+0, ETO_OPAQUE, NULL, str, 1, NULL ) )
+ return E_FAIL;
+
+ m_fTexCoords[c-32][0] = ((FLOAT)(x + 0 - m_dwSpacing))/m_dwTexWidth;
+ m_fTexCoords[c-32][1] = ((FLOAT)(y + 0 + 0 ))/m_dwTexHeight;
+ m_fTexCoords[c-32][2] = ((FLOAT)(x + size.cx + m_dwSpacing))/m_dwTexWidth;
+ m_fTexCoords[c-32][3] = ((FLOAT)(y + size.cy + 0 ))/m_dwTexHeight;
+ }
+
+ x += size.cx + (2 * m_dwSpacing);
+ }
+
+ return S_OK;
+}
+
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: InitDeviceObjects()
+// Desc: Initializes device-dependent objects, including the vertex buffer used
+// for rendering text and the texture map which stores the font image.
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::InitDeviceObjects( LPDIRECT3DDEVICE9 pd3dDevice )
+{
+ HRESULT hr = S_OK;
+ HFONT hFont = NULL;
+ HFONT hFontOld = NULL;
+ HDC hDC = NULL;
+ HBITMAP hbmBitmap = NULL;
+ HGDIOBJ hbmOld = NULL;
+
+ // Keep a local copy of the device
+ m_pd3dDevice = pd3dDevice;
+
+ // Assume we will draw fonts into texture without scaling unless the
+ // required texture size is found to be larger than the device max
+ m_fTextScale = 1.0f;
+
+ hDC = CreateCompatibleDC( NULL );
+ SetMapMode( hDC, MM_TEXT );
+
+ hr = CreateGDIFont( hDC, &hFont );
+ if( FAILED(hr) )
+ goto LCleanReturn;
+
+ hFontOld = (HFONT) SelectObject( hDC, hFont );
+
+ // Calculate the dimensions for the smallest power-of-two texture which
+ // can hold all the printable characters
+ m_dwTexWidth = m_dwTexHeight = 128;
+ while( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) )
+ {
+ m_dwTexWidth *= 2;
+ m_dwTexHeight *= 2;
+ }
+
+ if( FAILED(hr) )
+ goto LCleanReturn;
+
+ // If requested texture is too big, use a smaller texture and smaller font,
+ // and scale up when rendering.
+ D3DCAPS9 d3dCaps;
+ m_pd3dDevice->GetDeviceCaps( &d3dCaps );
+
+ if( m_dwTexWidth > d3dCaps.MaxTextureWidth )
+ {
+ m_fTextScale = (FLOAT)d3dCaps.MaxTextureWidth / (FLOAT)m_dwTexWidth;
+ m_dwTexWidth = m_dwTexHeight = d3dCaps.MaxTextureWidth;
+
+ bool bFirstRun = true; // Flag clear after first run
+
+ do
+ {
+ // If we've already tried fitting the new text, the scale is still
+ // too large. Reduce and try again.
+ if( !bFirstRun)
+ m_fTextScale *= 0.9f;
+
+ // The font has to be scaled to fit on the maximum texture size; our
+ // current font is too big and needs to be recreated to scale.
+ DeleteObject( SelectObject( hDC, hFontOld ) );
+
+ hr = CreateGDIFont( hDC, &hFont );
+ if( FAILED(hr) )
+ goto LCleanReturn;
+
+ hFontOld = (HFONT) SelectObject( hDC, hFont );
+
+ bFirstRun = false;
+ }
+ while( D3DERR_MOREDATA == ( hr = PaintAlphabet( hDC, true ) ) );
+ }
+
+
+ // Create a new texture for the font
+ hr = m_pd3dDevice->CreateTexture( m_dwTexWidth, m_dwTexHeight, 1,
+ 0, D3DFMT_A4R4G4B4,
+ D3DPOOL_MANAGED, &m_pTexture, NULL );
+ if( FAILED(hr) )
+ goto LCleanReturn;
+
+ // Prepare to create a bitmap
+ DWORD* pBitmapBits;
+ BITMAPINFO bmi;
+ ZeroMemory( &bmi.bmiHeader, sizeof(BITMAPINFOHEADER) );
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = (int)m_dwTexWidth;
+ bmi.bmiHeader.biHeight = -(int)m_dwTexHeight;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biCompression = BI_RGB;
+ bmi.bmiHeader.biBitCount = 32;
+
+ // Create a bitmap for the font
+ hbmBitmap = CreateDIBSection( hDC, &bmi, DIB_RGB_COLORS,
+ (void**)&pBitmapBits, NULL, 0 );
+
+ hbmOld = SelectObject( hDC, hbmBitmap );
+
+ // Set text properties
+ SetTextColor( hDC, RGB(255,255,255) );
+ SetBkColor( hDC, 0x00000000 );
+ SetTextAlign( hDC, TA_TOP );
+
+ // Paint the alphabet onto the selected bitmap
+ hr = PaintAlphabet( hDC, false );
+ if( FAILED(hr) )
+ goto LCleanReturn;
+
+ // Lock the surface and write the alpha values for the set pixels
+ D3DLOCKED_RECT d3dlr;
+ m_pTexture->LockRect( 0, &d3dlr, 0, 0 );
+ BYTE* pDstRow;
+ pDstRow = (BYTE*)d3dlr.pBits;
+ WORD* pDst16;
+ BYTE bAlpha; // 4-bit measure of pixel intensity
+ DWORD x, y;
+
+ for( y=0; y < m_dwTexHeight; y++ )
+ {
+ pDst16 = (WORD*)pDstRow;
+ for( x=0; x < m_dwTexWidth; x++ )
+ {
+ bAlpha = (BYTE)((pBitmapBits[m_dwTexWidth*y + x] & 0xff) >> 4);
+ if (bAlpha > 0)
+ {
+ *pDst16++ = (WORD) ((bAlpha << 12) | 0x0fff);
+ }
+ else
+ {
+ *pDst16++ = 0x0000;
+ }
+ }
+ pDstRow += d3dlr.Pitch;
+ }
+
+ hr = S_OK;
+
+ // Done updating texture, so clean up used objects
+LCleanReturn:
+ if( m_pTexture )
+ m_pTexture->UnlockRect(0);
+
+ SelectObject( hDC, hbmOld );
+ SelectObject( hDC, hFontOld );
+ DeleteObject( hbmBitmap );
+ DeleteObject( hFont );
+ DeleteDC( hDC );
+
+ return hr;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: RestoreDeviceObjects()
+// Desc:
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::RestoreDeviceObjects()
+{
+ HRESULT hr;
+
+ // Create vertex buffer for the letters
+ int vertexSize = max( sizeof(FONT2DVERTEX), sizeof(FONT3DVERTEX ) );
+ if( FAILED( hr = m_pd3dDevice->CreateVertexBuffer( MAX_NUM_VERTICES * vertexSize,
+ D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, 0,
+ D3DPOOL_DEFAULT, &m_pVB, NULL ) ) )
+ {
+ return hr;
+ }
+
+ bool bSupportsAlphaBlend = true;
+ LPDIRECT3D9 pd3d9 = NULL;
+ if( SUCCEEDED( m_pd3dDevice->GetDirect3D( &pd3d9 ) ) )
+ {
+ D3DCAPS9 Caps;
+ D3DDISPLAYMODE Mode;
+ LPDIRECT3DSURFACE9 pSurf = NULL;
+ D3DSURFACE_DESC Desc;
+ m_pd3dDevice->GetDeviceCaps( &Caps );
+ m_pd3dDevice->GetDisplayMode( 0, &Mode );
+ if( SUCCEEDED( m_pd3dDevice->GetRenderTarget( 0, &pSurf ) ) )
+ {
+ pSurf->GetDesc( &Desc );
+ if( FAILED( pd3d9->CheckDeviceFormat( Caps.AdapterOrdinal, Caps.DeviceType, Mode.Format,
+ D3DUSAGE_RENDERTARGET | D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING, D3DRTYPE_SURFACE,
+ Desc.Format ) ) )
+ {
+ bSupportsAlphaBlend = false;
+ }
+ SAFE_RELEASE( pSurf );
+ }
+ SAFE_RELEASE( pd3d9 );
+ }
+
+ // Create the state blocks for rendering text
+ for( UINT which=0; which<2; which++ )
+ {
+ m_pd3dDevice->BeginStateBlock();
+ m_pd3dDevice->SetTexture( 0, m_pTexture );
+
+ if ( D3DFONT_ZENABLE & m_dwFontFlags )
+ m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
+ else
+ m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
+
+ if( bSupportsAlphaBlend )
+ {
+ m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
+ m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
+ m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
+ }
+ else
+ {
+ m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
+ }
+ m_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
+ m_pd3dDevice->SetRenderState( D3DRS_ALPHAREF, 0x08 );
+ m_pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL );
+ m_pd3dDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
+ m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
+ m_pd3dDevice->SetRenderState( D3DRS_STENCILENABLE, FALSE );
+ m_pd3dDevice->SetRenderState( D3DRS_CLIPPING, TRUE );
+ m_pd3dDevice->SetRenderState( D3DRS_CLIPPLANEENABLE, FALSE );
+ m_pd3dDevice->SetRenderState( D3DRS_VERTEXBLEND, D3DVBF_DISABLE );
+ m_pd3dDevice->SetRenderState( D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE );
+ m_pd3dDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
+ m_pd3dDevice->SetRenderState( D3DRS_COLORWRITEENABLE,
+ D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN |
+ D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA );
+ m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
+ m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
+ m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
+ m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
+ m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
+ m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
+ m_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, 0 );
+ m_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
+ m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE );
+ m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
+ m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
+ m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
+ m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE );
+
+ if( which==0 )
+ m_pd3dDevice->EndStateBlock( &m_pStateBlockSaved );
+ else
+ m_pd3dDevice->EndStateBlock( &m_pStateBlockDrawText );
+ }
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: InvalidateDeviceObjects()
+// Desc: Destroys all device-dependent objects
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::InvalidateDeviceObjects()
+{
+ SAFE_RELEASE( m_pVB );
+ SAFE_RELEASE( m_pStateBlockSaved );
+ SAFE_RELEASE( m_pStateBlockDrawText );
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: DeleteDeviceObjects()
+// Desc: Destroys all device-dependent objects
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::DeleteDeviceObjects()
+{
+ SAFE_RELEASE( m_pTexture );
+ m_pd3dDevice = NULL;
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: GetTextExtent()
+// Desc: Get the dimensions of a text string
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::GetTextExtent( const TCHAR* strText, SIZE* pSize )
+{
+ if( NULL==strText || NULL==pSize )
+ return E_FAIL;
+
+ FLOAT fRowWidth = 0.0f;
+ FLOAT fRowHeight = (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight;
+ FLOAT fWidth = 0.0f;
+ FLOAT fHeight = fRowHeight;
+
+ while( *strText )
+ {
+ TCHAR c = *strText++;
+
+ if( c == _T('\n') )
+ {
+ fRowWidth = 0.0f;
+ fHeight += fRowHeight;
+ }
+
+ if( (c-32) < 0 || (c-32) >= 128-32 )
+ continue;
+
+ FLOAT tx1 = m_fTexCoords[c-32][0];
+ FLOAT tx2 = m_fTexCoords[c-32][2];
+
+ fRowWidth += (tx2-tx1)*m_dwTexWidth - 2*m_dwSpacing;
+
+ if( fRowWidth > fWidth )
+ fWidth = fRowWidth;
+ }
+
+ pSize->cx = (int)fWidth;
+ pSize->cy = (int)fHeight;
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: DrawTextScaled()
+// Desc: Draws scaled 2D text. Note that x and y are in viewport coordinates
+// (ranging from -1 to +1). fXScale and fYScale are the size fraction
+// relative to the entire viewport. For example, a fXScale of 0.25 is
+// 1/8th of the screen width. This allows you to output text at a fixed
+// fraction of the viewport, even if the screen or window size changes.
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
+ FLOAT fXScale, FLOAT fYScale, DWORD dwColor,
+ const TCHAR* strText, DWORD dwFlags )
+{
+ if( m_pd3dDevice == NULL )
+ return E_FAIL;
+
+ // Set up renderstate
+ m_pStateBlockSaved->Capture();
+ m_pStateBlockDrawText->Apply();
+ m_pd3dDevice->SetFVF( D3DFVF_FONT2DVERTEX );
+ m_pd3dDevice->SetPixelShader( NULL );
+ m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT2DVERTEX) );
+
+ // Set filter states
+ if( dwFlags & D3DFONT_FILTERED )
+ {
+ m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
+ m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
+ }
+
+ D3DVIEWPORT9 vp;
+ m_pd3dDevice->GetViewport( &vp );
+ FLOAT fLineHeight = ( m_fTexCoords[0][3] - m_fTexCoords[0][1] ) * m_dwTexHeight;
+
+ // Center the text block in the viewport
+ if( dwFlags & D3DFONT_CENTERED_X )
+ {
+ const TCHAR* strTextTmp = strText;
+ float xFinal = 0.0f;
+
+ while( *strTextTmp )
+ {
+ TCHAR c = *strTextTmp++;
+
+ if( c == _T('\n') )
+ break; // Isn't supported.
+ if( (c-32) < 0 || (c-32) >= 128-32 )
+ continue;
+
+ FLOAT tx1 = m_fTexCoords[c-32][0];
+ FLOAT tx2 = m_fTexCoords[c-32][2];
+
+ FLOAT w = (tx2-tx1)*m_dwTexWidth;
+
+ w *= (fXScale*vp.Height)/fLineHeight;
+
+ xFinal += w - (2 * m_dwSpacing) * (fXScale*vp.Height)/fLineHeight;
+ }
+
+ x = -xFinal/vp.Width;
+ }
+ if( dwFlags & D3DFONT_CENTERED_Y )
+ {
+ y = -fLineHeight/vp.Height;
+ }
+
+ FLOAT sx = (x+1.0f)*vp.Width/2;
+ FLOAT sy = (y+1.0f)*vp.Height/2;
+ FLOAT sz = z;
+ FLOAT rhw = 1.0f;
+
+ // Adjust for character spacing
+ sx -= m_dwSpacing * (fXScale*vp.Height)/fLineHeight;
+ FLOAT fStartX = sx;
+
+ // Fill vertex buffer
+ FONT2DVERTEX* pVertices;
+ DWORD dwNumTriangles = 0L;
+ m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
+
+ while( *strText )
+ {
+ TCHAR c = *strText++;
+
+ if( c == _T('\n') )
+ {
+ sx = fStartX;
+ sy += fYScale*vp.Height;
+ }
+
+ if( (c-32) < 0 || (c-32) >= 128-32 )
+ continue;
+
+ FLOAT tx1 = m_fTexCoords[c-32][0];
+ FLOAT ty1 = m_fTexCoords[c-32][1];
+ FLOAT tx2 = m_fTexCoords[c-32][2];
+ FLOAT ty2 = m_fTexCoords[c-32][3];
+
+ FLOAT w = (tx2-tx1)*m_dwTexWidth;
+ FLOAT h = (ty2-ty1)*m_dwTexHeight;
+
+ w *= (fXScale*vp.Height)/fLineHeight;
+ h *= (fYScale*vp.Height)/fLineHeight;
+
+ if( c != _T(' ') )
+ {
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+h-0.5f,sz,rhw), dwColor, tx1, ty2 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,sz,rhw), dwColor, tx1, ty1 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,sz,rhw), dwColor, tx2, ty2 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+0-0.5f,sz,rhw), dwColor, tx2, ty1 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,sz,rhw), dwColor, tx2, ty2 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,sz,rhw), dwColor, tx1, ty1 );
+ dwNumTriangles += 2;
+
+ if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) )
+ {
+ // Unlock, render, and relock the vertex buffer
+ m_pVB->Unlock();
+ m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
+ m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
+ dwNumTriangles = 0L;
+ }
+ }
+
+ sx += w - (2 * m_dwSpacing) * (fXScale*vp.Height)/fLineHeight;
+ }
+
+ // Unlock and render the vertex buffer
+ m_pVB->Unlock();
+ if( dwNumTriangles > 0 )
+ m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
+
+ // Restore the modified renderstates
+ m_pStateBlockSaved->Apply();
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: DrawText()
+// Desc: Draws 2D text. Note that sx and sy are in pixels
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::DrawText( FLOAT sx, FLOAT sy, DWORD dwColor,
+ const TCHAR* strText, DWORD dwFlags )
+{
+ if( m_pd3dDevice == NULL )
+ return E_FAIL;
+
+ // Setup renderstate
+ m_pStateBlockSaved->Capture();
+ m_pStateBlockDrawText->Apply();
+ m_pd3dDevice->SetFVF( D3DFVF_FONT2DVERTEX );
+ m_pd3dDevice->SetPixelShader( NULL );
+ m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT2DVERTEX) );
+
+ // Set filter states
+ if( dwFlags & D3DFONT_FILTERED )
+ {
+ m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
+ m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
+ }
+
+ // Center the text block in the viewport
+ if( dwFlags & D3DFONT_CENTERED_X )
+ {
+ D3DVIEWPORT9 vp;
+ m_pd3dDevice->GetViewport( &vp );
+ const TCHAR* strTextTmp = strText;
+ float xFinal = 0.0f;
+
+ while( *strTextTmp )
+ {
+ TCHAR c = *strTextTmp++;
+
+ if( c == _T('\n') )
+ break; // Isn't supported.
+ if( (c-32) < 0 || (c-32) >= 128-32 )
+ continue;
+
+ FLOAT tx1 = m_fTexCoords[c-32][0];
+ FLOAT tx2 = m_fTexCoords[c-32][2];
+
+ FLOAT w = (tx2-tx1) * m_dwTexWidth / m_fTextScale;
+
+ xFinal += w - (2 * m_dwSpacing);
+ }
+
+ sx = (vp.Width-xFinal)/2.0f;
+ }
+ if( dwFlags & D3DFONT_CENTERED_Y )
+ {
+ D3DVIEWPORT9 vp;
+ m_pd3dDevice->GetViewport( &vp );
+ float fLineHeight = ((m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight);
+ sy = (vp.Height-fLineHeight)/2;
+ }
+
+ // Adjust for character spacing
+ sx -= m_dwSpacing;
+ FLOAT fStartX = sx;
+
+ // Fill vertex buffer
+ FONT2DVERTEX* pVertices = NULL;
+ DWORD dwNumTriangles = 0;
+ m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
+
+ while( *strText )
+ {
+ TCHAR c = *strText++;
+
+ if( c == _T('\n') )
+ {
+ sx = fStartX;
+ sy += (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight;
+ }
+
+ if( (c-32) < 0 || (c-32) >= 128-32 )
+ continue;
+
+ FLOAT tx1 = m_fTexCoords[c-32][0];
+ FLOAT ty1 = m_fTexCoords[c-32][1];
+ FLOAT tx2 = m_fTexCoords[c-32][2];
+ FLOAT ty2 = m_fTexCoords[c-32][3];
+
+ FLOAT w = (tx2-tx1) * m_dwTexWidth / m_fTextScale;
+ FLOAT h = (ty2-ty1) * m_dwTexHeight / m_fTextScale;
+
+ if( c != _T(' ') )
+ {
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx1, ty2 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx2, ty2 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx2, ty1 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+w-0.5f,sy+h-0.5f,0.9f,1.0f), dwColor, tx2, ty2 );
+ *pVertices++ = InitFont2DVertex( D3DXVECTOR4(sx+0-0.5f,sy+0-0.5f,0.9f,1.0f), dwColor, tx1, ty1 );
+ dwNumTriangles += 2;
+
+ if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) )
+ {
+ // Unlock, render, and relock the vertex buffer
+ m_pVB->Unlock();
+ m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
+ pVertices = NULL;
+ m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
+ dwNumTriangles = 0L;
+ }
+ }
+
+ sx += w - (2 * m_dwSpacing);
+ }
+
+ // Unlock and render the vertex buffer
+ m_pVB->Unlock();
+ if( dwNumTriangles > 0 )
+ m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
+
+ // Restore the modified renderstates
+ m_pStateBlockSaved->Apply();
+
+ return S_OK;
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Name: Render3DText()
+// Desc: Renders 3D text
+//-----------------------------------------------------------------------------
+HRESULT CD3DFont::Render3DText( const TCHAR* strText, DWORD dwFlags )
+{
+ if( m_pd3dDevice == NULL )
+ return E_FAIL;
+
+ // Setup renderstate
+ m_pStateBlockSaved->Capture();
+ m_pStateBlockDrawText->Apply();
+ m_pd3dDevice->SetFVF( D3DFVF_FONT3DVERTEX );
+ m_pd3dDevice->SetPixelShader( NULL );
+ m_pd3dDevice->SetStreamSource( 0, m_pVB, 0, sizeof(FONT3DVERTEX) );
+
+ // Set filter states
+ if( dwFlags & D3DFONT_FILTERED )
+ {
+ m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
+ m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
+ }
+
+ // Position for each text element
+ FLOAT x = 0.0f;
+ FLOAT y = 0.0f;
+
+ // Center the text block at the origin (not the viewport)
+ if( dwFlags & D3DFONT_CENTERED_X )
+ {
+ SIZE sz;
+ GetTextExtent( strText, &sz );
+ x = -(((FLOAT)sz.cx)/10.0f)/2.0f;
+ }
+ if( dwFlags & D3DFONT_CENTERED_Y )
+ {
+ SIZE sz;
+ GetTextExtent( strText, &sz );
+ y = -(((FLOAT)sz.cy)/10.0f)/2.0f;
+ }
+
+ // Turn off culling for two-sided text
+ if( dwFlags & D3DFONT_TWOSIDED )
+ m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
+
+ // Adjust for character spacing
+ x -= m_dwSpacing / 10.0f;
+ FLOAT fStartX = x;
+ TCHAR c;
+
+ // Fill vertex buffer
+ FONT3DVERTEX* pVertices;
+ DWORD dwNumTriangles = 0L;
+ m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
+
+ while( (c = *strText++) != 0 )
+ {
+ if( c == '\n' )
+ {
+ x = fStartX;
+ y -= (m_fTexCoords[0][3]-m_fTexCoords[0][1])*m_dwTexHeight/10.0f;
+ }
+
+ if( (c-32) < 0 || (c-32) >= 128-32 )
+ continue;
+
+ FLOAT tx1 = m_fTexCoords[c-32][0];
+ FLOAT ty1 = m_fTexCoords[c-32][1];
+ FLOAT tx2 = m_fTexCoords[c-32][2];
+ FLOAT ty2 = m_fTexCoords[c-32][3];
+
+ FLOAT w = (tx2-tx1) * m_dwTexWidth / ( 10.0f * m_fTextScale );
+ FLOAT h = (ty2-ty1) * m_dwTexHeight / ( 10.0f * m_fTextScale );
+
+ if( c != _T(' ') )
+ {
+ *pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+0,y+0,0), D3DXVECTOR3(0,0,-1), tx1, ty2 );
+ *pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+0,y+h,0), D3DXVECTOR3(0,0,-1), tx1, ty1 );
+ *pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+w,y+0,0), D3DXVECTOR3(0,0,-1), tx2, ty2 );
+ *pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+w,y+h,0), D3DXVECTOR3(0,0,-1), tx2, ty1 );
+ *pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+w,y+0,0), D3DXVECTOR3(0,0,-1), tx2, ty2 );
+ *pVertices++ = InitFont3DVertex( D3DXVECTOR3(x+0,y+h,0), D3DXVECTOR3(0,0,-1), tx1, ty1 );
+ dwNumTriangles += 2;
+
+ if( dwNumTriangles*3 > (MAX_NUM_VERTICES-6) )
+ {
+ // Unlock, render, and relock the vertex buffer
+ m_pVB->Unlock();
+ m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
+ m_pVB->Lock( 0, 0, (void**)&pVertices, D3DLOCK_DISCARD );
+ dwNumTriangles = 0L;
+ }
+ }
+
+ x += w - (2 * m_dwSpacing) / 10.0f;
+ }
+
+ // Unlock and render the vertex buffer
+ m_pVB->Unlock();
+ if( dwNumTriangles > 0 )
+ m_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, dwNumTriangles );
+
+ // Restore the modified renderstates
+ m_pStateBlockSaved->Apply();
+
+ return S_OK;
+}
+
+
+
+
diff --git a/src/apps/mplayerc/D3DFont.h b/src/apps/mplayerc/D3DFont.h
new file mode 100644
index 000000000..751181959
--- /dev/null
+++ b/src/apps/mplayerc/D3DFont.h
@@ -0,0 +1,58 @@
+#pragma once
+
+// Font creation flags
+#define D3DFONT_BOLD 0x0001
+#define D3DFONT_ITALIC 0x0002
+#define D3DFONT_ZENABLE 0x0004
+
+// Font rendering flags
+#define D3DFONT_CENTERED_X 0x0001
+#define D3DFONT_CENTERED_Y 0x0002
+#define D3DFONT_TWOSIDED 0x0004
+#define D3DFONT_FILTERED 0x0008
+
+
+class CD3DFont
+{
+ TCHAR m_strFontName[80]; // Font properties
+ DWORD m_dwFontHeight;
+ DWORD m_dwFontFlags;
+
+ LPDIRECT3DDEVICE9 m_pd3dDevice; // A D3DDevice used for rendering
+ LPDIRECT3DTEXTURE9 m_pTexture; // The d3d texture for this font
+ LPDIRECT3DVERTEXBUFFER9 m_pVB; // VertexBuffer for rendering text
+ DWORD m_dwTexWidth; // Texture dimensions
+ DWORD m_dwTexHeight;
+ FLOAT m_fTextScale;
+ FLOAT m_fTexCoords[128-32][4];
+ DWORD m_dwSpacing; // Character pixel spacing per side
+
+ // Stateblocks for setting and restoring render states
+ LPDIRECT3DSTATEBLOCK9 m_pStateBlockSaved;
+ LPDIRECT3DSTATEBLOCK9 m_pStateBlockDrawText;
+
+ HRESULT CreateGDIFont( HDC hDC, HFONT* pFont );
+ HRESULT PaintAlphabet( HDC hDC, BOOL bMeasureOnly=FALSE );
+
+public:
+ // 2D and 3D text drawing functions
+ HRESULT DrawText( FLOAT x, FLOAT y, DWORD dwColor,
+ const TCHAR* strText, DWORD dwFlags=0L );
+ HRESULT DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
+ FLOAT fXScale, FLOAT fYScale, DWORD dwColor,
+ const TCHAR* strText, DWORD dwFlags=0L );
+ HRESULT Render3DText( const TCHAR* strText, DWORD dwFlags=0L );
+
+ // Function to get extent of text
+ HRESULT GetTextExtent( const TCHAR* strText, SIZE* pSize );
+
+ // Initializing and destroying device-dependent objects
+ HRESULT InitDeviceObjects( IDirect3DDevice9* pd3dDevice );
+ HRESULT RestoreDeviceObjects();
+ HRESULT InvalidateDeviceObjects();
+ HRESULT DeleteDeviceObjects();
+
+ // Constructor / destructor
+ CD3DFont( const TCHAR* strFontName, DWORD dwHeight, DWORD dwFlags=0L );
+ ~CD3DFont();
+};
diff --git a/src/apps/mplayerc/DX7AllocatorPresenter.cpp b/src/apps/mplayerc/DX7AllocatorPresenter.cpp
new file mode 100644
index 000000000..9b57feee0
--- /dev/null
+++ b/src/apps/mplayerc/DX7AllocatorPresenter.cpp
@@ -0,0 +1,1321 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "DX7AllocatorPresenter.h"
+#include <ddraw.h>
+#include <d3d.h>
+#include "..\..\SubPic\DX7SubPic.h"
+#include "..\..\..\include\RealMedia\pntypes.h"
+#include "..\..\..\include\RealMedia\pnwintyp.h"
+#include "..\..\..\include\RealMedia\pncom.h"
+#include "..\..\..\include\RealMedia\rmavsurf.h"
+#include "IQTVideoSurface.h"
+
+#include "IPinHook.h"
+
+bool IsVMR7InGraph(IFilterGraph* pFG)
+{
+ BeginEnumFilters(pFG, pEF, pBF)
+ if(CComQIPtr<IVMRWindowlessControl>(pBF)) return(true);
+ EndEnumFilters
+ return(false);
+}
+
+namespace DSObjects
+{
+
+class CDX7AllocatorPresenter
+ : public ISubPicAllocatorPresenterImpl
+{
+protected:
+ CSize m_ScreenSize;
+
+ CComPtr<IDirectDraw7> m_pDD;
+ CComQIPtr<IDirect3D7, &IID_IDirect3D7> m_pD3D;
+ CComPtr<IDirect3DDevice7> m_pD3DDev;
+
+ CComPtr<IDirectDrawSurface7> m_pPrimary, m_pBackBuffer;
+ CComPtr<IDirectDrawSurface7> m_pVideoTexture, m_pVideoSurface;
+
+ virtual HRESULT CreateDevice();
+ virtual HRESULT AllocSurfaces();
+ virtual void DeleteSurfaces();
+
+public:
+ CDX7AllocatorPresenter(HWND hWnd, HRESULT& hr);
+
+ // ISubPicAllocatorPresenter
+ STDMETHODIMP CreateRenderer(IUnknown** ppRenderer);
+ STDMETHODIMP_(bool) Paint(bool fAll);
+ STDMETHODIMP GetDIB(BYTE* lpDib, DWORD* size);
+};
+
+class CVMR7AllocatorPresenter
+ : public CDX7AllocatorPresenter
+ , public IVMRSurfaceAllocator
+ , public IVMRImagePresenter
+ , public IVMRWindowlessControl
+{
+ CComPtr<IVMRSurfaceAllocatorNotify> m_pIVMRSurfAllocNotify;
+ CComPtr<IVMRSurfaceAllocator> m_pSA;
+
+ HRESULT CreateDevice();
+ void DeleteSurfaces();
+
+ bool m_fUseInternalTimer;
+
+public:
+ CVMR7AllocatorPresenter(HWND hWnd, HRESULT& hr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicAllocatorPresenter
+ STDMETHODIMP CreateRenderer(IUnknown** ppRenderer);
+ STDMETHODIMP_(void) SetTime(REFERENCE_TIME rtNow);
+
+ // IVMRSurfaceAllocator
+ STDMETHODIMP AllocateSurface(DWORD_PTR dwUserID, VMRALLOCATIONINFO* lpAllocInfo, DWORD* lpdwBuffer, LPDIRECTDRAWSURFACE7* lplpSurface);
+ STDMETHODIMP FreeSurface(DWORD_PTR dwUserID);
+ STDMETHODIMP PrepareSurface(DWORD_PTR dwUserID, IDirectDrawSurface7* lpSurface, DWORD dwSurfaceFlags);
+ STDMETHODIMP AdviseNotify(IVMRSurfaceAllocatorNotify* lpIVMRSurfAllocNotify);
+
+ // IVMRImagePresenter
+ STDMETHODIMP StartPresenting(DWORD_PTR dwUserID);
+ STDMETHODIMP StopPresenting(DWORD_PTR dwUserID);
+ STDMETHODIMP PresentImage(DWORD_PTR dwUserID, VMRPRESENTATIONINFO* lpPresInfo);
+
+ // IVMRWindowlessControl
+ STDMETHODIMP GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight);
+ STDMETHODIMP GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight);
+ STDMETHODIMP GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight);
+ STDMETHODIMP SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect);
+ STDMETHODIMP GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect);
+ STDMETHODIMP GetAspectRatioMode(DWORD* lpAspectRatioMode);
+ STDMETHODIMP SetAspectRatioMode(DWORD AspectRatioMode);
+ STDMETHODIMP SetVideoClippingWindow(HWND hwnd);
+ STDMETHODIMP RepaintVideo(HWND hwnd, HDC hdc);
+ STDMETHODIMP DisplayModeChanged();
+ STDMETHODIMP GetCurrentImage(BYTE** lpDib);
+ STDMETHODIMP SetBorderColor(COLORREF Clr);
+ STDMETHODIMP GetBorderColor(COLORREF* lpClr);
+ STDMETHODIMP SetColorKey(COLORREF Clr);
+ STDMETHODIMP GetColorKey(COLORREF* lpClr);
+};
+
+class CRM7AllocatorPresenter
+ : public CDX7AllocatorPresenter
+ , public IRMAVideoSurface
+{
+ CComPtr<IDirectDrawSurface7> m_pVideoSurfaceOff;
+ CComPtr<IDirectDrawSurface7> m_pVideoSurfaceYUY2;
+
+ RMABitmapInfoHeader m_bitmapInfo;
+ RMABitmapInfoHeader m_lastBitmapInfo;
+
+protected:
+ HRESULT AllocSurfaces();
+ void DeleteSurfaces();
+
+public:
+ CRM7AllocatorPresenter(HWND hWnd, HRESULT& hr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IRMAVideoSurface
+ STDMETHODIMP Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect);
+ STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* pBitmapInfo);
+ STDMETHODIMP OptimizedBlt(UCHAR* pImageBits, REF(PNxRect) rDestRect, REF(PNxRect) rSrcRect);
+ STDMETHODIMP EndOptimizedBlt();
+ STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) ulType);
+ STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) ulType);
+};
+
+class CQT7AllocatorPresenter
+ : public CDX7AllocatorPresenter
+ , public IQTVideoSurface
+{
+ CComPtr<IDirectDrawSurface7> m_pVideoSurfaceOff;
+
+protected:
+ HRESULT AllocSurfaces();
+ void DeleteSurfaces();
+
+public:
+ CQT7AllocatorPresenter(HWND hWnd, HRESULT& hr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IQTVideoSurface
+ STDMETHODIMP BeginBlt(const BITMAP& bm);
+ STDMETHODIMP DoBlt(const BITMAP& bm);
+};
+
+}
+using namespace DSObjects;
+
+//
+
+HRESULT CreateAP7(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppAP)
+{
+ CheckPointer(ppAP, E_POINTER);
+
+ *ppAP = NULL;
+
+ HRESULT hr;
+ if(clsid == CLSID_VMR7AllocatorPresenter && !(*ppAP = new CVMR7AllocatorPresenter(hWnd, hr))
+ || clsid == CLSID_RM7AllocatorPresenter && !(*ppAP = new CRM7AllocatorPresenter(hWnd, hr))
+ || clsid == CLSID_QT7AllocatorPresenter && !(*ppAP = new CQT7AllocatorPresenter(hWnd, hr)))
+ return E_OUTOFMEMORY;
+
+ if(*ppAP == NULL)
+ return E_FAIL;
+
+ (*ppAP)->AddRef();
+
+ if(FAILED(hr))
+ {
+ (*ppAP)->Release();
+ *ppAP = NULL;
+ }
+
+ return hr;
+}
+
+//
+
+static HRESULT TextureBlt(CComPtr<IDirect3DDevice7> pD3DDev, CComPtr<IDirectDrawSurface7> pTexture, Vector dst[4], CRect src)
+{
+ if(!pTexture)
+ return E_POINTER;
+
+ HRESULT hr;
+
+ do
+ {
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ if(FAILED(hr = pTexture->GetSurfaceDesc(&ddsd)))
+ break;
+
+ float w = (float)ddsd.dwWidth;
+ float h = (float)ddsd.dwHeight;
+
+ struct
+ {
+ float x, y, z, rhw;
+ float tu, tv;
+ }
+ pVertices[] =
+ {
+ {(float)dst[0].x, (float)dst[0].y, (float)dst[0].z, 1.0f/(float)dst[0].z, (float)src.left / w, (float)src.top / h},
+ {(float)dst[1].x, (float)dst[1].y, (float)dst[1].z, 1.0f/(float)dst[1].z, (float)src.right / w, (float)src.top / h},
+ {(float)dst[2].x, (float)dst[2].y, (float)dst[2].z, 1.0f/(float)dst[2].z, (float)src.left / w, (float)src.bottom / h},
+ {(float)dst[3].x, (float)dst[3].y, (float)dst[3].z, 1.0f/(float)dst[3].z, (float)src.right / w, (float)src.bottom / h},
+ };
+
+ for(int i = 0; i < countof(pVertices); i++)
+ {
+ pVertices[i].x -= 0.5;
+ pVertices[i].y -= 0.5;
+ }
+
+ hr = pD3DDev->SetTexture(0, pTexture);
+
+ pD3DDev->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
+ pD3DDev->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);
+ pD3DDev->SetRenderState(D3DRENDERSTATE_BLENDENABLE, FALSE);
+ pD3DDev->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, FALSE);
+
+ pD3DDev->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_LINEAR);
+ pD3DDev->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTFN_LINEAR);
+ pD3DDev->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTFP_LINEAR);
+
+ pD3DDev->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP);
+
+ //
+
+ if(FAILED(hr = pD3DDev->BeginScene()))
+ break;
+
+ hr = pD3DDev->DrawPrimitive(D3DPT_TRIANGLESTRIP,
+ D3DFVF_XYZRHW | D3DFVF_TEX1,
+ pVertices, 4, D3DDP_WAIT);
+ pD3DDev->EndScene();
+
+ //
+
+ pD3DDev->SetTexture(0, NULL);
+
+ return S_OK;
+ }
+ while(0);
+
+ return E_FAIL;
+}
+
+//
+// CDX7AllocatorPresenter
+//
+
+CDX7AllocatorPresenter::CDX7AllocatorPresenter(HWND hWnd, HRESULT& hr)
+ : ISubPicAllocatorPresenterImpl(hWnd, hr)
+ , m_ScreenSize(0, 0)
+{
+ if(FAILED(hr)) return;
+
+ if(FAILED(hr = DirectDrawCreateEx(NULL, (VOID**)&m_pDD, IID_IDirectDraw7, NULL))
+ || FAILED(hr = m_pDD->SetCooperativeLevel(AfxGetMainWnd()->GetSafeHwnd(), DDSCL_NORMAL)))
+ return;
+
+ if(!(m_pD3D = m_pDD)) {hr = E_NOINTERFACE; return;}
+
+ hr = CreateDevice();
+}
+
+HRESULT CDX7AllocatorPresenter::CreateDevice()
+{
+ m_pD3DDev = NULL;
+
+ m_pPrimary = NULL;
+ m_pBackBuffer = NULL;
+
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ if(FAILED(m_pDD->GetDisplayMode(&ddsd))
+ || ddsd.ddpfPixelFormat.dwRGBBitCount <= 8)
+ return DDERR_INVALIDMODE;
+
+ m_ScreenSize.SetSize(ddsd.dwWidth, ddsd.dwHeight);
+
+ HRESULT hr;
+
+ // m_pPrimary
+
+ INITDDSTRUCT(ddsd);
+ ddsd.dwFlags = DDSD_CAPS;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+ if(FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pPrimary, NULL)))
+ return hr;
+
+ CComPtr<IDirectDrawClipper> pcClipper;
+ if(FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL)))
+ return hr;
+ pcClipper->SetHWnd(0, m_hWnd);
+ m_pPrimary->SetClipper(pcClipper);
+
+ // m_pBackBuffer
+
+ INITDDSTRUCT(ddsd);
+ ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
+ ddsd.ddsCaps.dwCaps = /*DDSCAPS_OFFSCREENPLAIN |*/ DDSCAPS_VIDEOMEMORY | DDSCAPS_3DDEVICE;
+ ddsd.dwWidth = m_ScreenSize.cx;
+ ddsd.dwHeight = m_ScreenSize.cy;
+ if(FAILED(hr = m_pDD->CreateSurface(&ddsd, &m_pBackBuffer, NULL)))
+ return hr;
+
+ pcClipper = NULL;
+ if(FAILED(hr = m_pDD->CreateClipper(0, &pcClipper, NULL)))
+ return hr;
+ BYTE rgnDataBuffer[1024];
+ HRGN hrgn = CreateRectRgn(0, 0, ddsd.dwWidth, ddsd.dwHeight);
+ GetRegionData(hrgn, sizeof(rgnDataBuffer), (RGNDATA*)rgnDataBuffer);
+ DeleteObject(hrgn);
+ pcClipper->SetClipList((RGNDATA*)rgnDataBuffer, 0);
+ m_pBackBuffer->SetClipper(pcClipper);
+
+ // m_pD3DDev
+
+ if(FAILED(hr = m_pD3D->CreateDevice(IID_IDirect3DHALDevice, m_pBackBuffer, &m_pD3DDev))) // this seems to fail if the desktop size is too large (width or height >2048)
+ return hr;
+
+ //
+
+ CComPtr<ISubPicProvider> pSubPicProvider;
+ if(m_pSubPicQueue) m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
+
+ CSize size;
+ switch(AfxGetAppSettings().nSPCMaxRes)
+ {
+ case 0: default: size = m_ScreenSize; break;
+ case 1: size.SetSize(1024, 768); break;
+ case 2: size.SetSize(800, 600); break;
+ case 3: size.SetSize(640, 480); break;
+ case 4: size.SetSize(512, 384); break;
+ case 5: size.SetSize(384, 288); break;
+ }
+
+ if(m_pAllocator)
+ {
+ m_pAllocator->ChangeDevice(m_pD3DDev);
+ }
+ else
+ {
+ m_pAllocator = new CDX7SubPicAllocator(m_pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex);
+ if(!m_pAllocator || FAILED(hr))
+ return E_FAIL;
+ }
+
+ hr = S_OK;
+ m_pSubPicQueue = AfxGetAppSettings().nSPCSize > 0
+ ? (ISubPicQueue*)new CSubPicQueue(AfxGetAppSettings().nSPCSize, m_pAllocator, &hr)
+ : (ISubPicQueue*)new CSubPicQueueNoThread(m_pAllocator, &hr);
+ if(!m_pSubPicQueue || FAILED(hr))
+ return E_FAIL;
+
+ if(pSubPicProvider) m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
+
+ return S_OK;
+}
+
+HRESULT CDX7AllocatorPresenter::AllocSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_pVideoTexture = NULL;
+ m_pVideoSurface = NULL;
+
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
+ ddsd.dwWidth = m_NativeVideoSize.cx;
+ ddsd.dwHeight = m_NativeVideoSize.cy;
+ ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ ddsd.ddpfPixelFormat.dwRGBBitCount = 32;
+ ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000;
+ ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00;
+ ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
+
+ if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D)
+ {
+ ddsd.ddsCaps.dwCaps |= DDSCAPS_TEXTURE;
+// ddsd.ddpfPixelFormat.dwFlags |= DDPF_ALPHAPIXELS;
+// ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000;
+ }
+
+ HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurface, NULL);
+ if(FAILED(hr))
+ {
+ // FIXME: eh, dx9 has no problem creating a 32bpp surface under a 16bpp desktop, but dx7 fails here (textures are ok)
+ DDSURFACEDESC2 ddsd2;
+ INITDDSTRUCT(ddsd2);
+ if(!(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D)
+ && SUCCEEDED(m_pDD->GetDisplayMode(&ddsd2))
+ && ddsd2.ddpfPixelFormat.dwRGBBitCount == 16)
+ {
+ ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
+ ddsd.ddpfPixelFormat.dwRBitMask = 0x0000F800;
+ ddsd.ddpfPixelFormat.dwGBitMask = 0x000007E0;
+ ddsd.ddpfPixelFormat.dwBBitMask = 0x0000001F;
+ hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurface, NULL);
+ }
+
+ if(FAILED(hr))
+ return hr;
+ }
+
+ if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D)
+ m_pVideoTexture = m_pVideoSurface;
+
+ DDBLTFX fx;
+ INITDDSTRUCT(fx);
+ fx.dwFillColor = 0;
+ hr = m_pVideoSurface->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
+
+ return S_OK;
+}
+
+void CDX7AllocatorPresenter::DeleteSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ m_pVideoTexture = NULL;
+ m_pVideoSurface = NULL;
+}
+
+// ISubPicAllocatorPresenter
+
+STDMETHODIMP CDX7AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP_(bool) CDX7AllocatorPresenter::Paint(bool fAll)
+{
+ CAutoLock cAutoLock(this);
+
+ if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
+ || m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0
+ || !m_pPrimary || !m_pBackBuffer || !m_pVideoSurface)
+ return(false);
+
+ HRESULT hr;
+
+ CRect rSrcVid(CPoint(0, 0), m_NativeVideoSize);
+ CRect rDstVid(m_VideoRect);
+
+ CRect rSrcPri(CPoint(0, 0), m_WindowRect.Size());
+ CRect rDstPri(m_WindowRect);
+ MapWindowRect(m_hWnd, HWND_DESKTOP, &rDstPri);
+
+ if(fAll)
+ {
+ // clear the backbuffer
+
+ CRect rl(0, 0, rDstVid.left, rSrcPri.bottom);
+ CRect rr(rDstVid.right, 0, rSrcPri.right, rSrcPri.bottom);
+ CRect rt(0, 0, rSrcPri.right, rDstVid.top);
+ CRect rb(0, rDstVid.bottom, rSrcPri.right, rSrcPri.bottom);
+
+ DDBLTFX fx;
+ INITDDSTRUCT(fx);
+ fx.dwFillColor = 0;
+ hr = m_pBackBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
+
+ // paint the video on the backbuffer
+
+ if(!rDstVid.IsRectEmpty())
+ {
+ if(m_pVideoTexture)
+ {
+ Vector v[4];
+ Transform(rDstVid, v);
+ hr = TextureBlt(m_pD3DDev, m_pVideoTexture, v, rSrcVid);
+ }
+ else
+ {
+ hr = m_pBackBuffer->Blt(rDstVid, m_pVideoSurface, rSrcVid, DDBLT_WAIT, NULL);
+ }
+ }
+
+ // paint the text on the backbuffer
+
+ AlphaBltSubPic(rSrcPri.Size());
+ }
+
+ // wait vsync
+
+ m_pDD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL);
+
+ // blt to the primary surface
+
+ hr = m_pPrimary->Blt(rDstPri, m_pBackBuffer, rSrcPri, DDBLT_WAIT, NULL);
+
+ if(hr == DDERR_SURFACELOST)
+ {
+ HRESULT hr = DDERR_WRONGMODE; // m_pDD->TestCooperativeLevel();
+
+ if(hr == DDERR_WRONGMODE)
+ {
+ DeleteSurfaces();
+ if(SUCCEEDED(CreateDevice()) || FAILED(hr = AllocSurfaces()))
+ return(true);
+ }
+
+ hr = S_OK;
+ }
+
+ return(true);
+}
+
+STDMETHODIMP CDX7AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
+{
+ CheckPointer(size, E_POINTER);
+
+ HRESULT hr;
+
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ if(FAILED(m_pVideoSurface->GetSurfaceDesc(&ddsd)))
+ return E_FAIL;
+
+ if(ddsd.ddpfPixelFormat.dwRGBBitCount != 16 && ddsd.ddpfPixelFormat.dwRGBBitCount != 32)
+ return E_FAIL;
+
+ DWORD required = sizeof(BITMAPINFOHEADER) + (ddsd.dwWidth*ddsd.dwHeight*32>>3);
+ if(!lpDib) {*size = required; return S_OK;}
+ if(*size < required) return E_OUTOFMEMORY;
+ *size = required;
+
+ INITDDSTRUCT(ddsd);
+ if(FAILED(hr = m_pVideoSurface->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_NOSYSLOCK, NULL)))
+ {
+ // TODO
+ return hr;
+ }
+
+ BITMAPINFOHEADER* bih = (BITMAPINFOHEADER*)lpDib;
+ memset(bih, 0, sizeof(BITMAPINFOHEADER));
+ bih->biSize = sizeof(BITMAPINFOHEADER);
+ bih->biWidth = ddsd.dwWidth;
+ bih->biHeight = ddsd.dwHeight;
+ bih->biBitCount = 32;
+ bih->biPlanes = 1;
+ bih->biSizeImage = bih->biWidth*bih->biHeight*bih->biBitCount>>3;
+
+ BitBltFromRGBToRGB(
+ bih->biWidth, bih->biHeight,
+ (BYTE*)(bih + 1), bih->biWidth*bih->biBitCount>>3, bih->biBitCount,
+ (BYTE*)ddsd.lpSurface + ddsd.lPitch*(ddsd.dwHeight-1), -(int)ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount);
+
+ m_pVideoSurface->Unlock(NULL);
+
+/*
+ BitBltFromRGBToRGB(
+ w, h,
+ (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount,
+ (BYTE*)bm.bmBits, bm.bmWidthBytes, bm.bmBitsPixel);
+ m_pVideoSurfaceOff->Unlock(NULL);
+ fOk = true;
+ }
+*/
+
+ return S_OK;
+}
+
+//
+// CVMR7AllocatorPresenter
+//
+
+#define MY_USER_ID 0x6ABE51
+
+CVMR7AllocatorPresenter::CVMR7AllocatorPresenter(HWND hWnd, HRESULT& hr)
+ : CDX7AllocatorPresenter(hWnd, hr)
+ , m_fUseInternalTimer(false)
+{
+ if(FAILED(hr))
+ return;
+
+ if(FAILED(hr = m_pSA.CoCreateInstance(CLSID_AllocPresenter)))
+ {
+ hr = E_FAIL;
+ return;
+ }
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IVMRSurfaceAllocator)
+ QI(IVMRImagePresenter)
+ QI(IVMRWindowlessControl)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CVMR7AllocatorPresenter::CreateDevice()
+{
+ HRESULT hr = __super::CreateDevice();
+ if(FAILED(hr)) return hr;
+
+ if(m_pIVMRSurfAllocNotify)
+ {
+ HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+ if(FAILED(hr = m_pIVMRSurfAllocNotify->ChangeDDrawDevice(m_pDD, hMonitor)))
+ return(false);
+ }
+
+ return hr;
+}
+
+void CVMR7AllocatorPresenter::DeleteSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ m_pSA->FreeSurface(MY_USER_ID);
+
+ __super::DeleteSurfaces();
+}
+
+// ISubPicAllocatorPresenter
+
+STDMETHODIMP CVMR7AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
+{
+ CheckPointer(ppRenderer, E_POINTER);
+
+ *ppRenderer = NULL;
+
+ HRESULT hr;
+
+ do
+ {
+ CComPtr<IBaseFilter> pBF;
+
+ if(FAILED(hr = pBF.CoCreateInstance(CLSID_VideoMixingRenderer)))
+ break;
+
+ CComQIPtr<IVMRFilterConfig> pConfig = pBF;
+ if(!pConfig)
+ break;
+
+ if(FAILED(hr = pConfig->SetRenderingMode(VMRMode_Renderless)))
+ break;
+
+ CComQIPtr<IVMRSurfaceAllocatorNotify> pSAN = pBF;
+ if(!pSAN)
+ break;
+
+ if(FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator*>(this)))
+ || FAILED(hr = AdviseNotify(pSAN)))
+ break;
+
+ CComPtr<IPin> pPin = GetFirstPin(pBF);
+ CComQIPtr<IMemInputPin> pMemInputPin = pPin;
+ m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);
+
+ *ppRenderer = (IUnknown*)pBF.Detach();
+
+ return S_OK;
+ }
+ while(0);
+
+ return E_FAIL;
+}
+
+STDMETHODIMP_(void) CVMR7AllocatorPresenter::SetTime(REFERENCE_TIME rtNow)
+{
+ __super::SetTime(rtNow);
+ m_fUseInternalTimer = false;
+}
+
+// IVMRSurfaceAllocator
+
+STDMETHODIMP CVMR7AllocatorPresenter::AllocateSurface(DWORD_PTR dwUserID, VMRALLOCATIONINFO* lpAllocInfo, DWORD* lpdwBuffer, LPDIRECTDRAWSURFACE7* lplpSurface)
+{
+ if(!lpAllocInfo || !lpdwBuffer || !lplpSurface)
+ return E_POINTER;
+
+ if(!m_pIVMRSurfAllocNotify)
+ return E_FAIL;
+
+ HRESULT hr;
+
+ DeleteSurfaces();
+
+ // HACK: yv12 will fail to blt onto the backbuffer anyway, but if we first
+ // allocate it and then let our FreeSurface callback call m_pSA->FreeSurface,
+ // then that might stall for about 30 seconds because of some unknown buggy code
+ // behind <ddraw surface>->Release()
+
+ if(lpAllocInfo->lpHdr->biBitCount < 16)
+ return E_FAIL;
+
+ hr = m_pSA->AllocateSurface(dwUserID, lpAllocInfo, lpdwBuffer, lplpSurface);
+ if(FAILED(hr))
+ return hr;
+
+ m_NativeVideoSize = CSize(abs(lpAllocInfo->lpHdr->biWidth), abs(lpAllocInfo->lpHdr->biHeight));
+ m_AspectRatio = m_NativeVideoSize;
+ int arx = lpAllocInfo->szAspectRatio.cx, ary = lpAllocInfo->szAspectRatio.cy;
+ if(arx > 0 && ary > 0) m_AspectRatio.SetSize(arx, ary);
+
+ if(FAILED(hr = AllocSurfaces()))
+ return hr;
+
+ // test if the colorspace is acceptable
+ if(FAILED(hr = m_pVideoSurface->Blt(NULL, *lplpSurface, NULL, DDBLT_WAIT, NULL)))
+ {
+ DeleteSurfaces();
+ return hr;
+ }
+
+ DDBLTFX fx;
+ INITDDSTRUCT(fx);
+ fx.dwFillColor = 0;
+ m_pVideoSurface->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
+
+ return hr;
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::FreeSurface(DWORD_PTR dwUserID)
+{
+ DeleteSurfaces();
+ return S_OK;
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::PrepareSurface(DWORD_PTR dwUserID, IDirectDrawSurface7* lpSurface, DWORD dwSurfaceFlags)
+{
+ if(!lpSurface)
+ return E_POINTER;
+
+ // FIXME: sometimes the msmpeg4/divx3/wmv decoder wants to reuse our
+ // surface (expects it to point to the same mem every time), and to avoid
+ // problems we can't call m_pSA->PrepareSurface (flips? clears?).
+ return S_OK;
+/*
+ return m_pSA->PrepareSurface(dwUserID, lpSurface, dwSurfaceFlags);
+*/
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify* lpIVMRSurfAllocNotify)
+{
+ CAutoLock cAutoLock(this);
+
+ m_pIVMRSurfAllocNotify = lpIVMRSurfAllocNotify;
+
+ HRESULT hr;
+ HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+ if(FAILED(hr = m_pIVMRSurfAllocNotify->SetDDrawDevice(m_pDD, hMonitor)))
+ return hr;
+
+ return m_pSA->AdviseNotify(lpIVMRSurfAllocNotify);
+}
+
+// IVMRImagePresenter
+
+STDMETHODIMP CVMR7AllocatorPresenter::StartPresenting(DWORD_PTR dwUserID)
+{
+ CAutoLock cAutoLock(this);
+
+ ASSERT(m_pD3DDev);
+
+ return m_pD3DDev ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::StopPresenting(DWORD_PTR dwUserID)
+{
+ return S_OK;
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMRPRESENTATIONINFO* lpPresInfo)
+{
+ HRESULT hr;
+
+ {
+ if(!lpPresInfo || !lpPresInfo->lpSurf)
+ return E_POINTER;
+
+ CAutoLock cAutoLock(this);
+
+ hr = m_pVideoSurface->Blt(NULL, lpPresInfo->lpSurf, NULL, DDBLT_WAIT, NULL);
+
+ if(lpPresInfo->rtEnd > lpPresInfo->rtStart)
+ {
+ REFERENCE_TIME rtTimePerFrame = lpPresInfo->rtEnd - lpPresInfo->rtStart;
+ m_fps = 10000000.0 / rtTimePerFrame;
+
+ if(m_pSubPicQueue)
+ {
+ m_pSubPicQueue->SetFPS(m_fps);
+
+ if(m_fUseInternalTimer)
+ {
+ __super::SetTime(g_tSegmentStart + g_tSampleStart);
+ }
+ }
+ }
+
+ CSize VideoSize = m_NativeVideoSize;
+ int arx = lpPresInfo->szAspectRatio.cx, ary = lpPresInfo->szAspectRatio.cy;
+ if(arx > 0 && ary > 0) VideoSize.cx = VideoSize.cy*arx/ary;
+ if(VideoSize != GetVideoSize())
+ {
+ m_AspectRatio.SetSize(arx, ary);
+ AfxGetApp()->m_pMainWnd->PostMessage(WM_REARRANGERENDERLESS);
+ }
+
+ Paint(true);
+
+ hr = S_OK;
+ }
+
+ return S_OK;
+}
+
+// IVMRWindowlessControl
+//
+// It is only implemented (partially) for the dvd navigator's
+// menu handling, which needs to know a few things about the
+// location of our window.
+
+STDMETHODIMP CVMR7AllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight)
+{
+ CSize vs = m_NativeVideoSize, ar = m_AspectRatio;
+ // DVD Nav. bug workaround fix
+ vs.cx = vs.cy * ar.cx / ar.cy;
+ if(lpWidth) *lpWidth = vs.cx;
+ if(lpHeight) *lpHeight = vs.cy;
+ if(lpARWidth) *lpARWidth = ar.cx;
+ if(lpARHeight) *lpARHeight = ar.cy;
+ return S_OK;
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;}
+STDMETHODIMP CVMR7AllocatorPresenter::GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;}
+STDMETHODIMP CVMR7AllocatorPresenter::SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect) {return E_NOTIMPL;} // we have our own method for this
+
+STDMETHODIMP CVMR7AllocatorPresenter::GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect)
+{
+ CopyRect(lpSRCRect, CRect(CPoint(0, 0), m_NativeVideoSize));
+ CopyRect(lpDSTRect, &m_VideoRect);
+ // DVD Nav. bug workaround fix
+ GetNativeVideoSize(&lpSRCRect->right, &lpSRCRect->bottom, NULL, NULL);
+ return S_OK;
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::GetAspectRatioMode(DWORD* lpAspectRatioMode)
+{
+ if(lpAspectRatioMode) *lpAspectRatioMode = AM_ARMODE_STRETCHED;
+ return S_OK;
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::SetAspectRatioMode(DWORD AspectRatioMode) {return E_NOTIMPL;}
+STDMETHODIMP CVMR7AllocatorPresenter::SetVideoClippingWindow(HWND hwnd) {return E_NOTIMPL;}
+STDMETHODIMP CVMR7AllocatorPresenter::RepaintVideo(HWND hwnd, HDC hdc) {return E_NOTIMPL;}
+STDMETHODIMP CVMR7AllocatorPresenter::DisplayModeChanged() {return E_NOTIMPL;}
+STDMETHODIMP CVMR7AllocatorPresenter::GetCurrentImage(BYTE** lpDib) {return E_NOTIMPL;}
+STDMETHODIMP CVMR7AllocatorPresenter::SetBorderColor(COLORREF Clr) {return E_NOTIMPL;}
+
+STDMETHODIMP CVMR7AllocatorPresenter::GetBorderColor(COLORREF* lpClr)
+{
+ if(lpClr) *lpClr = 0;
+ return S_OK;
+}
+
+STDMETHODIMP CVMR7AllocatorPresenter::SetColorKey(COLORREF Clr) {return E_NOTIMPL;}
+STDMETHODIMP CVMR7AllocatorPresenter::GetColorKey(COLORREF* lpClr) {return E_NOTIMPL;}
+
+//
+
+static HRESULT AllocDX7Surface(IDirectDraw7* pDD, CSize size, DWORD compression, int bpp, IDirectDrawSurface7** pSurface)
+{
+ if(!pDD || !pSurface || size.cx <= 0 || size.cy <= 0)
+ return E_POINTER;
+
+ *pSurface = NULL;
+
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY;
+ ddsd.dwWidth = size.cx;
+ ddsd.dwHeight = size.cy;
+ ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+
+ if(compression >= 0x1000)
+ {
+ ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
+ ddsd.ddpfPixelFormat.dwFourCC = compression;
+ }
+ else if((compression == 0 || compression == 3) && (bpp == 15 || bpp == 16 || bpp == 24 || bpp == 32))
+ {
+ ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ ddsd.ddpfPixelFormat.dwRGBBitCount = max(bpp, 16);
+ ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = (bpp == 16) ? 0x0000 : (bpp == 15) ? 0x8000 : 0xFF000000;
+ ddsd.ddpfPixelFormat.dwRBitMask = (bpp == 16) ? 0xf800 : (bpp == 15) ? 0x7c00 : 0x00FF0000;
+ ddsd.ddpfPixelFormat.dwGBitMask = (bpp == 16) ? 0x07e0 : (bpp == 15) ? 0x03e0 : 0x0000FF00;
+ ddsd.ddpfPixelFormat.dwBBitMask = (bpp == 16) ? 0x001F : (bpp == 15) ? 0x001F : 0x000000FF;
+ }
+
+ return pDD->CreateSurface(&ddsd, pSurface, NULL);
+}
+
+//
+// CRM7AllocatorPresenter
+//
+
+CRM7AllocatorPresenter::CRM7AllocatorPresenter(HWND hWnd, HRESULT& hr)
+ : CDX7AllocatorPresenter(hWnd, hr)
+{
+}
+
+STDMETHODIMP CRM7AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI2(IRMAVideoSurface)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CRM7AllocatorPresenter::AllocSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ m_pVideoSurfaceOff = NULL;
+ m_pVideoSurfaceYUY2 = NULL;
+
+ DDSURFACEDESC2 ddsd;
+ DDBLTFX fx;
+
+ INITDDSTRUCT(ddsd);
+ ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ ddsd.dwWidth = m_NativeVideoSize.cx;
+ ddsd.dwHeight = m_NativeVideoSize.cy;
+ ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ ddsd.ddpfPixelFormat.dwRGBBitCount = 32;
+ ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000;
+ ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000;
+ ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00;
+ ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
+
+ HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceOff, NULL);
+ if(FAILED(hr)) return E_FAIL;
+
+ INITDDSTRUCT(fx);
+ fx.dwFillColor = 0;
+ m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
+
+ INITDDSTRUCT(ddsd);
+ ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ ddsd.dwWidth = m_NativeVideoSize.cx;
+ ddsd.dwHeight = m_NativeVideoSize.cy;
+ ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
+ ddsd.ddpfPixelFormat.dwYUVBitCount = 16;
+ ddsd.ddpfPixelFormat.dwFourCC = '2YUY';
+
+ hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceYUY2, NULL);
+
+ if(FAILED(m_pVideoSurfaceOff->Blt(NULL, m_pVideoSurfaceYUY2, NULL, DDBLT_WAIT, NULL)))
+ m_pVideoSurfaceYUY2 = NULL;
+
+ if(m_pVideoSurfaceYUY2)
+ {
+ INITDDSTRUCT(fx);
+ fx.dwFillColor = 0x80108010;
+ m_pVideoSurfaceYUY2->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
+ }
+
+ return __super::AllocSurfaces();
+}
+
+void CRM7AllocatorPresenter::DeleteSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ m_pVideoSurfaceOff = NULL;
+ m_pVideoSurfaceYUY2 = NULL;
+
+ __super::DeleteSurfaces();
+}
+
+// IRMAVideoSurface
+
+STDMETHODIMP CRM7AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect)
+{
+ if(!m_pVideoSurface || !m_pVideoSurfaceOff)
+ return E_FAIL;
+
+ bool fRGB = false;
+ bool fYUY2 = false;
+
+ CRect src((RECT*)&inSrcRect), dst((RECT*)&inDestRect), src2(CPoint(0,0), src.Size());
+ if(src.Width() > dst.Width() || src.Height() > dst.Height())
+ return E_FAIL;
+
+ DDSURFACEDESC2 ddsd;
+
+ if(pBitmapInfo->biCompression == '024I')
+ {
+ DWORD pitch = pBitmapInfo->biWidth;
+ DWORD size = pitch*abs(pBitmapInfo->biHeight);
+
+ BYTE* y = pImageData + src.top*pitch + src.left;
+ BYTE* u = pImageData + size + src.top*(pitch/2) + src.left/2;
+ BYTE* v = pImageData + size + size/4 + src.top*(pitch/2) + src.left/2;
+
+ if(m_pVideoSurfaceYUY2)
+ {
+ INITDDSTRUCT(ddsd);
+ if(SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL)))
+ {
+ BitBltFromI420ToYUY2(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, y, u, v, pitch);
+ m_pVideoSurfaceYUY2->Unlock(src2);
+ fYUY2 = true;
+ }
+ }
+ else
+ {
+ INITDDSTRUCT(ddsd);
+ if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL)))
+ {
+ BitBltFromI420ToRGB(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, y, u, v, pitch);
+ m_pVideoSurfaceOff->Unlock(src2);
+ fRGB = true;
+ }
+ }
+ }
+ else if(pBitmapInfo->biCompression == '2YUY')
+ {
+ DWORD w = pBitmapInfo->biWidth;
+ DWORD h = abs(pBitmapInfo->biHeight);
+ DWORD pitch = pBitmapInfo->biWidth*2;
+
+ BYTE* yvyu = pImageData + src.top*pitch + src.left*2;
+
+ if(m_pVideoSurfaceYUY2)
+ {
+ INITDDSTRUCT(ddsd);
+ if(SUCCEEDED(m_pVideoSurfaceYUY2->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL)))
+ {
+ BitBltFromYUY2ToYUY2(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, yvyu, pitch);
+ m_pVideoSurfaceYUY2->Unlock(src2);
+ fYUY2 = true;
+ }
+ }
+ else
+ {
+ INITDDSTRUCT(ddsd);
+ if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL)))
+ {
+ BitBltFromYUY2ToRGB(src.Width(), src.Height(), (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, yvyu, pitch);
+ m_pVideoSurfaceOff->Unlock(src2);
+ fRGB = true;
+ }
+ }
+ }
+ else if(pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
+ || pBitmapInfo->biCompression == 'BGRA')
+ {
+ DWORD w = pBitmapInfo->biWidth;
+ DWORD h = abs(pBitmapInfo->biHeight);
+ DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3;
+
+ BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3);
+
+ INITDDSTRUCT(ddsd);
+ if(SUCCEEDED(m_pVideoSurfaceOff->Lock(src2, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL)))
+ {
+ BYTE* lpSurface = (BYTE*)ddsd.lpSurface;
+ if(pBitmapInfo->biHeight > 0) {lpSurface += ddsd.lPitch*(src.Height()-1); ddsd.lPitch = -ddsd.lPitch;}
+ BitBltFromRGBToRGB(src.Width(), src.Height(), lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount, rgb, pitch, pBitmapInfo->biBitCount);
+ fRGB = true;
+ m_pVideoSurfaceOff->Unlock(src2);
+ }
+ }
+
+ if(!fRGB && !fYUY2)
+ {
+ DDBLTFX fx;
+ INITDDSTRUCT(fx);
+ fx.dwFillColor = 0;
+ m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
+
+ HDC hDC;
+ if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC)))
+ {
+ CString str;
+ str.Format(_T("Sorry, this format is not supported"));
+
+ SetBkColor(hDC, 0);
+ SetTextColor(hDC, 0x404040);
+ TextOut(hDC, 10, 10, str, str.GetLength());
+
+ m_pVideoSurfaceOff->ReleaseDC(hDC);
+
+ fRGB = true;
+ }
+ }
+
+
+ HRESULT hr;
+
+ if(fRGB)
+ hr = m_pVideoSurface->Blt(dst, m_pVideoSurfaceOff, src2, DDBLT_WAIT, NULL);
+ if(fYUY2)
+ hr = m_pVideoSurface->Blt(dst, m_pVideoSurfaceYUY2, src2, DDBLT_WAIT, NULL);
+
+ Paint(true);
+
+ return PNR_OK;
+}
+
+STDMETHODIMP CRM7AllocatorPresenter::BeginOptimizedBlt(RMABitmapInfoHeader* pBitmapInfo)
+{
+ CAutoLock cAutoLock(this);
+ DeleteSurfaces();
+ m_NativeVideoSize = m_AspectRatio = CSize(pBitmapInfo->biWidth, abs(pBitmapInfo->biHeight));
+ if(FAILED(AllocSurfaces())) return E_FAIL;
+ return PNR_NOTIMPL;
+}
+
+STDMETHODIMP CRM7AllocatorPresenter::OptimizedBlt(UCHAR* pImageBits, REF(PNxRect) rDestRect, REF(PNxRect) rSrcRect)
+{
+ return PNR_NOTIMPL;
+}
+
+STDMETHODIMP CRM7AllocatorPresenter::EndOptimizedBlt()
+{
+ return PNR_NOTIMPL;
+}
+
+STDMETHODIMP CRM7AllocatorPresenter::GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) ulType)
+{
+ return PNR_NOTIMPL;
+}
+
+STDMETHODIMP CRM7AllocatorPresenter::GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) ulType)
+{
+ ulType = RMA_I420;
+ return PNR_OK;
+}
+
+//
+// CQT7AllocatorPresenter
+//
+
+CQT7AllocatorPresenter::CQT7AllocatorPresenter(HWND hWnd, HRESULT& hr)
+ : CDX7AllocatorPresenter(hWnd, hr)
+{
+}
+
+STDMETHODIMP CQT7AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IQTVideoSurface)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CQT7AllocatorPresenter::AllocSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ m_pVideoSurfaceOff = NULL;
+
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
+ ddsd.dwWidth = m_NativeVideoSize.cx;
+ ddsd.dwHeight = m_NativeVideoSize.cy;
+ ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ ddsd.ddpfPixelFormat.dwRGBBitCount = 32;
+ ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000;
+ ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000;
+ ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00;
+ ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
+
+ HRESULT hr = m_pDD->CreateSurface(&ddsd, &m_pVideoSurfaceOff, NULL);
+ if(FAILED(hr)) return E_FAIL;
+
+ DDBLTFX fx;
+ INITDDSTRUCT(fx);
+ fx.dwFillColor = 0;
+ m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
+
+ return __super::AllocSurfaces();
+}
+
+void CQT7AllocatorPresenter::DeleteSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ m_pVideoSurfaceOff = NULL;
+
+ __super::DeleteSurfaces();
+}
+
+// IQTVideoSurface
+
+STDMETHODIMP CQT7AllocatorPresenter::BeginBlt(const BITMAP& bm)
+{
+ CAutoLock cAutoLock(this);
+
+ DeleteSurfaces();
+
+ m_NativeVideoSize = m_AspectRatio = CSize(bm.bmWidth, abs(bm.bmHeight));
+
+ HRESULT hr;
+ if(FAILED(hr = AllocSurfaces()))
+ return hr;
+
+ return S_OK;
+}
+
+STDMETHODIMP CQT7AllocatorPresenter::DoBlt(const BITMAP& bm)
+{
+ if(!m_pVideoSurface || !m_pVideoSurfaceOff)
+ return E_FAIL;
+
+ bool fOk = false;
+
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ if(FAILED(m_pVideoSurfaceOff->GetSurfaceDesc(&ddsd)))
+ return E_FAIL;
+
+ int w = bm.bmWidth;
+ int h = abs(bm.bmHeight);
+ int bpp = bm.bmBitsPixel;
+
+ if((bpp == 16 || bpp == 24 || bpp == 32) && w == ddsd.dwWidth && h == ddsd.dwHeight)
+ {
+ INITDDSTRUCT(ddsd);
+ if(SUCCEEDED(m_pVideoSurfaceOff->Lock(NULL, &ddsd, DDLOCK_WAIT|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY, NULL)))
+ {
+ BitBltFromRGBToRGB(
+ w, h,
+ (BYTE*)ddsd.lpSurface, ddsd.lPitch, ddsd.ddpfPixelFormat.dwRGBBitCount,
+ (BYTE*)bm.bmBits, bm.bmWidthBytes, bm.bmBitsPixel);
+ m_pVideoSurfaceOff->Unlock(NULL);
+ fOk = true;
+ }
+ }
+
+ if(!fOk)
+ {
+ DDBLTFX fx;
+ INITDDSTRUCT(fx);
+ fx.dwFillColor = 0;
+ m_pVideoSurfaceOff->Blt(NULL, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
+
+ HDC hDC;
+ if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC)))
+ {
+ CString str;
+ str.Format(_T("Sorry, this format is not supported"));
+
+ SetBkColor(hDC, 0);
+ SetTextColor(hDC, 0x404040);
+ TextOut(hDC, 10, 10, str, str.GetLength());
+
+ m_pVideoSurfaceOff->ReleaseDC(hDC);
+
+ }
+ }
+
+ m_pVideoSurface->Blt(NULL, m_pVideoSurfaceOff, NULL, DDBLT_WAIT, NULL);
+
+ Paint(true);
+
+ return S_OK;
+}
diff --git a/src/apps/mplayerc/DX7AllocatorPresenter.h b/src/apps/mplayerc/DX7AllocatorPresenter.h
new file mode 100644
index 000000000..f209a257d
--- /dev/null
+++ b/src/apps/mplayerc/DX7AllocatorPresenter.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\SubPic\ISubPic.h"
+
+// {495CF191-810D-44c7-92C5-E7D46AE00F44}
+DEFINE_GUID(CLSID_VMR7AllocatorPresenter,
+0x495cf191, 0x810d, 0x44c7, 0x92, 0xc5, 0xe7, 0xd4, 0x6a, 0xe0, 0xf, 0x44);
+
+// {97B3462E-1752-4dfb-A038-271060BC7A94}
+DEFINE_GUID(CLSID_RM7AllocatorPresenter,
+0x97b3462e, 0x1752, 0x4dfb, 0xa0, 0x38, 0x27, 0x10, 0x60, 0xbc, 0x7a, 0x94);
+
+// {36CC5A71-441C-462a-9D10-48A19485938D}
+DEFINE_GUID(CLSID_QT7AllocatorPresenter,
+0x36cc5a71, 0x441c, 0x462a, 0x9d, 0x10, 0x48, 0xa1, 0x94, 0x85, 0x93, 0x8d);
+
+extern HRESULT CreateAP7(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppAP);
+
+extern bool IsVMR7InGraph(IFilterGraph* pFG);
diff --git a/src/apps/mplayerc/DX9AllocatorPresenter.cpp b/src/apps/mplayerc/DX9AllocatorPresenter.cpp
new file mode 100644
index 000000000..3daf39d25
--- /dev/null
+++ b/src/apps/mplayerc/DX9AllocatorPresenter.cpp
@@ -0,0 +1,2447 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\..\DSUtil\DSUtil.h"
+
+#include <Videoacc.h>
+
+#include <initguid.h>
+#include "DX9AllocatorPresenter.h"
+#include <d3d9.h>
+#include <d3dx9.h>
+#include <Vmr9.h>
+#include "..\..\SubPic\DX9SubPic.h"
+#include "..\..\..\include\RealMedia\pntypes.h"
+#include "..\..\..\include\RealMedia\pnwintyp.h"
+#include "..\..\..\include\RealMedia\pncom.h"
+#include "..\..\..\include\RealMedia\rmavsurf.h"
+#include "IQTVideoSurface.h"
+#include "..\..\..\include\moreuuids.h"
+
+#include "MacrovisionKicker.h"
+#include "IPinHook.h"
+
+#include "PixelShaderCompiler.h"
+#include "MainFrm.h"
+
+#define VMRBITMAP_UPDATE 0x80000000
+
+bool IsVMR9InGraph(IFilterGraph* pFG)
+{
+ BeginEnumFilters(pFG, pEF, pBF)
+ if(CComQIPtr<IVMRWindowlessControl9>(pBF)) return(true);
+ EndEnumFilters
+ return(false);
+}
+
+namespace DSObjects
+{
+
+class CDX9AllocatorPresenter
+ : public ISubPicAllocatorPresenterImpl
+{
+protected:
+ CSize m_ScreenSize;
+ bool m_fVMRSyncFix;
+
+ CComPtr<IDirect3D9> m_pD3D;
+ CComPtr<IDirect3DDevice9> m_pD3DDev;
+ CComPtr<IDirect3DTexture9> m_pVideoTexture[3];
+ CComPtr<IDirect3DSurface9> m_pVideoSurface[3];
+ CComPtr<IDirect3DTexture9> m_pOSDTexture;
+ CComPtr<IDirect3DSurface9> m_pOSDSurface;
+ CInterfaceList<IDirect3DPixelShader9> m_pPixelShaders;
+ CComPtr<IDirect3DPixelShader9> m_pResizerPixelShader[3]; // bl, bc1, bc2
+ CComPtr<IDirect3DTexture9> m_pResizerBicubic1stPass;
+ D3DTEXTUREFILTERTYPE m_filter;
+ D3DCAPS9 m_caps;
+
+ CAutoPtr<CPixelShaderCompiler> m_pPSC;
+
+ virtual HRESULT CreateDevice();
+ virtual HRESULT AllocSurfaces();
+ virtual void DeleteSurfaces();
+
+ UINT GetAdapter(IDirect3D9 *pD3D);
+
+ float m_bicubicA;
+ HRESULT InitResizers(float bicubicA);
+
+ HRESULT TextureCopy(CComPtr<IDirect3DTexture9> pTexture);
+ HRESULT TextureResize(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4], D3DTEXTUREFILTERTYPE filter);
+ HRESULT TextureResizeBilinear(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4]);
+ HRESULT TextureResizeBicubic1pass(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4]);
+ HRESULT TextureResizeBicubic2pass(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4]);
+
+ // Casimir666
+ int m_nTearingPos;
+ VMR9AlphaBitmap m_VMR9AlphaBitmap;
+ HRESULT AlphaBlt(RECT* pSrc, RECT* pDst, CComPtr<IDirect3DTexture9> pTexture);
+
+public:
+ CDX9AllocatorPresenter(HWND hWnd, HRESULT& hr);
+ ~CDX9AllocatorPresenter();
+
+ // ISubPicAllocatorPresenter
+ STDMETHODIMP CreateRenderer(IUnknown** ppRenderer);
+ STDMETHODIMP_(bool) Paint(bool fAll);
+ STDMETHODIMP GetDIB(BYTE* lpDib, DWORD* size);
+ STDMETHODIMP SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget);
+};
+
+class CVMR9AllocatorPresenter
+ : public CDX9AllocatorPresenter
+ , public IVMRSurfaceAllocator9
+ , public IVMRImagePresenter9
+ , public IVMRWindowlessControl9
+{
+protected:
+ CComPtr<IVMRSurfaceAllocatorNotify9> m_pIVMRSurfAllocNotify;
+ CInterfaceArray<IDirect3DSurface9> m_pSurfaces;
+
+ HRESULT CreateDevice();
+ void DeleteSurfaces();
+
+ bool m_fUseInternalTimer;
+ REFERENCE_TIME m_rtPrevStart;
+
+public:
+ CVMR9AllocatorPresenter(HWND hWnd, HRESULT& hr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicAllocatorPresenter
+ STDMETHODIMP CreateRenderer(IUnknown** ppRenderer);
+ STDMETHODIMP_(void) SetTime(REFERENCE_TIME rtNow);
+
+ // IVMRSurfaceAllocator9
+ STDMETHODIMP InitializeDevice(DWORD_PTR dwUserID, VMR9AllocationInfo* lpAllocInfo, DWORD* lpNumBuffers);
+ STDMETHODIMP TerminateDevice(DWORD_PTR dwID);
+ STDMETHODIMP GetSurface(DWORD_PTR dwUserID, DWORD SurfaceIndex, DWORD SurfaceFlags, IDirect3DSurface9** lplpSurface);
+ STDMETHODIMP AdviseNotify(IVMRSurfaceAllocatorNotify9* lpIVMRSurfAllocNotify);
+
+ // IVMRImagePresenter9
+ STDMETHODIMP StartPresenting(DWORD_PTR dwUserID);
+ STDMETHODIMP StopPresenting(DWORD_PTR dwUserID);
+ STDMETHODIMP PresentImage(DWORD_PTR dwUserID, VMR9PresentationInfo* lpPresInfo);
+
+ // IVMRWindowlessControl9
+ STDMETHODIMP GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight);
+ STDMETHODIMP GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight);
+ STDMETHODIMP GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight);
+ STDMETHODIMP SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect);
+ STDMETHODIMP GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect);
+ STDMETHODIMP GetAspectRatioMode(DWORD* lpAspectRatioMode);
+ STDMETHODIMP SetAspectRatioMode(DWORD AspectRatioMode);
+ STDMETHODIMP SetVideoClippingWindow(HWND hwnd);
+ STDMETHODIMP RepaintVideo(HWND hwnd, HDC hdc);
+ STDMETHODIMP DisplayModeChanged();
+ STDMETHODIMP GetCurrentImage(BYTE** lpDib);
+ STDMETHODIMP SetBorderColor(COLORREF Clr);
+ STDMETHODIMP GetBorderColor(COLORREF* lpClr);
+};
+
+class CRM9AllocatorPresenter
+ : public CDX9AllocatorPresenter
+ , public IRMAVideoSurface
+{
+ CComPtr<IDirect3DSurface9> m_pVideoSurfaceOff;
+ CComPtr<IDirect3DSurface9> m_pVideoSurfaceYUY2;
+
+ RMABitmapInfoHeader m_bitmapInfo;
+ RMABitmapInfoHeader m_lastBitmapInfo;
+
+protected:
+ HRESULT AllocSurfaces();
+ void DeleteSurfaces();
+
+public:
+ CRM9AllocatorPresenter(HWND hWnd, HRESULT& hr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IRMAVideoSurface
+ STDMETHODIMP Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect);
+ STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* pBitmapInfo);
+ STDMETHODIMP OptimizedBlt(UCHAR* pImageBits, REF(PNxRect) rDestRect, REF(PNxRect) rSrcRect);
+ STDMETHODIMP EndOptimizedBlt();
+ STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) ulType);
+ STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) ulType);
+};
+
+class CQT9AllocatorPresenter
+ : public CDX9AllocatorPresenter
+ , public IQTVideoSurface
+{
+ CComPtr<IDirect3DSurface9> m_pVideoSurfaceOff;
+
+protected:
+ HRESULT AllocSurfaces();
+ void DeleteSurfaces();
+
+public:
+ CQT9AllocatorPresenter(HWND hWnd, HRESULT& hr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IQTVideoSurface
+ STDMETHODIMP BeginBlt(const BITMAP& bm);
+ STDMETHODIMP DoBlt(const BITMAP& bm);
+};
+
+class CDXRAllocatorPresenter
+ : public ISubPicAllocatorPresenterImpl
+{
+ class CSubRenderCallback : public CUnknown, public ISubRenderCallback, public CCritSec
+ {
+ CDXRAllocatorPresenter* m_pDXRAP;
+
+ public:
+ CSubRenderCallback(CDXRAllocatorPresenter* pDXRAP)
+ : CUnknown(_T("CSubRender"), NULL)
+ , m_pDXRAP(pDXRAP)
+ {
+ }
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
+ {
+ return
+ QI(ISubRenderCallback)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+ }
+
+ void SetDXRAP(CDXRAllocatorPresenter* pDXRAP)
+ {
+ CAutoLock cAutoLock(this);
+ m_pDXRAP = pDXRAP;
+ }
+
+ // ISubRenderCallback
+
+ STDMETHODIMP SetDevice(IDirect3DDevice9* pD3DDev)
+ {
+ CAutoLock cAutoLock(this);
+ return m_pDXRAP ? m_pDXRAP->SetDevice(pD3DDev) : E_UNEXPECTED;
+ }
+
+ STDMETHODIMP Render(REFERENCE_TIME rtStart, int left, int top, int right, int bottom, int width, int height)
+ {
+ CAutoLock cAutoLock(this);
+ return m_pDXRAP ? m_pDXRAP->Render(rtStart, 0, 0, left, top, right, bottom, width, height) : E_UNEXPECTED;
+ }
+
+ // ISubRendererCallback2
+
+ STDMETHODIMP RenderEx(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, REFERENCE_TIME AvgTimePerFrame, int left, int top, int right, int bottom, int width, int height)
+ {
+ CAutoLock cAutoLock(this);
+ return m_pDXRAP ? m_pDXRAP->Render(rtStart, rtStop, AvgTimePerFrame, left, top, right, bottom, width, height) : E_UNEXPECTED;
+ }
+ };
+
+ CComPtr<IUnknown> m_pDXR;
+ CComPtr<ISubRenderCallback> m_pSRCB;
+
+public:
+ CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr);
+ virtual ~CDXRAllocatorPresenter();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT SetDevice(IDirect3DDevice9* pD3DDev);
+ HRESULT Render(
+ REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, REFERENCE_TIME atpf,
+ int left, int top, int bottom, int right, int width, int height);
+
+ // ISubPicAllocatorPresenter
+ STDMETHODIMP CreateRenderer(IUnknown** ppRenderer);
+ STDMETHODIMP_(void) SetPosition(RECT w, RECT v);
+ STDMETHODIMP_(SIZE) GetVideoSize(bool fCorrectAR);
+ STDMETHODIMP_(bool) Paint(bool fAll);
+ STDMETHODIMP GetDIB(BYTE* lpDib, DWORD* size);
+ STDMETHODIMP SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget);
+};
+
+}
+using namespace DSObjects;
+
+//
+
+HRESULT CreateAP9(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppAP)
+{
+ CheckPointer(ppAP, E_POINTER);
+
+ *ppAP = NULL;
+
+ HRESULT hr = E_FAIL;
+ if(clsid == CLSID_VMR9AllocatorPresenter && !(*ppAP = new CVMR9AllocatorPresenter(hWnd, hr))
+ || clsid == CLSID_RM9AllocatorPresenter && !(*ppAP = new CRM9AllocatorPresenter(hWnd, hr))
+ || clsid == CLSID_QT9AllocatorPresenter && !(*ppAP = new CQT9AllocatorPresenter(hWnd, hr))
+ || clsid == CLSID_DXRAllocatorPresenter && !(*ppAP = new CDXRAllocatorPresenter(hWnd, hr)))
+ return E_OUTOFMEMORY;
+
+ if(*ppAP == NULL)
+ return E_FAIL;
+
+ (*ppAP)->AddRef();
+
+ if(FAILED(hr))
+ {
+ (*ppAP)->Release();
+ *ppAP = NULL;
+ }
+
+ return hr;
+}
+
+//
+
+#pragma pack(push, 1)
+template<int texcoords>
+struct MYD3DVERTEX {float x, y, z, rhw; struct {float u, v;} t[texcoords];};
+#pragma pack(pop)
+
+template<int texcoords>
+static void AdjustQuad(MYD3DVERTEX<texcoords>* v, float dx, float dy)
+{
+ float offset = 0.5f;
+
+ for(int i = 0; i < 4; i++)
+ {
+ v[i].x -= offset;
+ v[i].y -= offset;
+
+ for(int j = 0; j < texcoords-1; j++)
+ {
+ v[i].t[j].u -= offset*dx;
+ v[i].t[j].v -= offset*dy;
+ }
+
+ if(texcoords > 1)
+ {
+ v[i].t[texcoords-1].u -= offset;
+ v[i].t[texcoords-1].v -= offset;
+ }
+ }
+}
+
+template<int texcoords>
+static HRESULT TextureBlt(CComPtr<IDirect3DDevice9> pD3DDev, MYD3DVERTEX<texcoords> v[4], D3DTEXTUREFILTERTYPE filter = D3DTEXF_LINEAR)
+{
+ if(!pD3DDev)
+ return E_POINTER;
+
+ DWORD FVF = 0;
+
+ switch(texcoords)
+ {
+ case 1: FVF = D3DFVF_TEX1; break;
+ case 2: FVF = D3DFVF_TEX2; break;
+ case 3: FVF = D3DFVF_TEX3; break;
+ case 4: FVF = D3DFVF_TEX4; break;
+ case 5: FVF = D3DFVF_TEX5; break;
+ case 6: FVF = D3DFVF_TEX6; break;
+ case 7: FVF = D3DFVF_TEX7; break;
+ case 8: FVF = D3DFVF_TEX8; break;
+ default: return E_FAIL;
+ }
+
+ HRESULT hr;
+
+ do
+ {
+ hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_RED);
+
+ for(int i = 0; i < texcoords; i++)
+ {
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_MAGFILTER, filter);
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_MINFILTER, filter);
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_MIPFILTER, filter);
+
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+ hr = pD3DDev->SetSamplerState(i, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+ }
+
+ //
+
+ if(FAILED(hr = pD3DDev->BeginScene()))
+ break;
+
+ hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | FVF);
+ // hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, v, sizeof(v[0]));
+
+ MYD3DVERTEX<texcoords> tmp = v[2]; v[2] = v[3]; v[3] = tmp;
+ hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, v, sizeof(v[0]));
+
+ hr = pD3DDev->EndScene();
+
+ //
+
+ for(int i = 0; i < texcoords; i++)
+ {
+ pD3DDev->SetTexture(i, NULL);
+ }
+
+ return S_OK;
+ }
+ while(0);
+
+ return E_FAIL;
+}
+
+// CDX9AllocatorPresenter
+
+CDX9AllocatorPresenter::CDX9AllocatorPresenter(HWND hWnd, HRESULT& hr)
+ : ISubPicAllocatorPresenterImpl(hWnd, hr)
+ , m_ScreenSize(0, 0)
+ , m_bicubicA(0)
+ , m_nTearingPos(0)
+{
+ if(FAILED(hr)) return;
+ m_pD3D.Attach(Direct3DCreate9(D3D_SDK_VERSION));
+ if(!m_pD3D) m_pD3D.Attach(Direct3DCreate9(D3D9b_SDK_VERSION));
+ if(!m_pD3D) {hr = E_FAIL; return;}
+
+ ZeroMemory(&m_VMR9AlphaBitmap, sizeof(m_VMR9AlphaBitmap));
+ hr = CreateDevice();
+}
+
+CDX9AllocatorPresenter::~CDX9AllocatorPresenter()
+{
+}
+
+HRESULT CDX9AllocatorPresenter::CreateDevice()
+{
+ m_pPSC.Free();
+ m_pD3DDev = NULL;
+
+ D3DDISPLAYMODE d3ddm;
+ HRESULT hr;
+ ZeroMemory(&d3ddm, sizeof(d3ddm));
+ if(FAILED(m_pD3D->GetAdapterDisplayMode(GetAdapter(m_pD3D), &d3ddm)))
+ return E_UNEXPECTED;
+
+ m_ScreenSize.SetSize(d3ddm.Width, d3ddm.Height);
+
+ D3DPRESENT_PARAMETERS pp;
+ ZeroMemory(&pp, sizeof(pp));
+
+
+ if (AfxGetAppSettings().fD3DFullscreen)
+ {
+ pp.Windowed = false;
+ pp.BackBufferWidth = d3ddm.Width;
+ pp.BackBufferHeight = d3ddm.Height;
+// pp.BackBufferCount = 3;
+ pp.SwapEffect = D3DSWAPEFFECT_COPY;
+ pp.Flags = D3DPRESENTFLAG_VIDEO;
+ pp.BackBufferFormat = d3ddm.Format;
+ pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
+
+ hr = m_pD3D->CreateDevice(
+ GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
+ &pp, &m_pD3DDev);
+ ASSERT (SUCCEEDED (hr));
+ }
+ else
+ {
+ pp.Windowed = TRUE;
+ pp.hDeviceWindow = m_hWnd;
+ pp.SwapEffect = D3DSWAPEFFECT_COPY;
+ pp.Flags = D3DPRESENTFLAG_VIDEO;
+ pp.BackBufferWidth = d3ddm.Width;
+ pp.BackBufferHeight = d3ddm.Height;
+ pp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
+
+ if(m_fVMRSyncFix = AfxGetMyApp()->m_s.fVMRSyncFix)
+ pp.Flags = D3DPRESENTFLAG_LOCKABLE_BACKBUFFER;
+
+ hr = m_pD3D->CreateDevice(
+ GetAdapter(m_pD3D), D3DDEVTYPE_HAL, m_hWnd,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
+ &pp, &m_pD3DDev);
+ }
+/*
+ HRESULT hr = m_pD3D->CreateDevice(
+ m_pD3D->GetAdapterCount()-1, D3DDEVTYPE_REF, m_hWnd,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED, //D3DCREATE_MANAGED
+ &pp, &m_pD3DDev);
+*/
+ if(FAILED(hr))
+ return hr;
+
+ m_pPSC.Attach(new CPixelShaderCompiler(m_pD3DDev, true));
+
+ //
+
+ m_filter = D3DTEXF_NONE;
+
+ ZeroMemory(&m_caps, sizeof(m_caps));
+ m_pD3DDev->GetDeviceCaps(&m_caps);
+
+ if((m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MINFLINEAR)
+ && (m_caps.StretchRectFilterCaps&D3DPTFILTERCAPS_MAGFLINEAR))
+ m_filter = D3DTEXF_LINEAR;
+
+ //
+
+ m_bicubicA = 0;
+
+ //
+
+ CComPtr<ISubPicProvider> pSubPicProvider;
+ if(m_pSubPicQueue) m_pSubPicQueue->GetSubPicProvider(&pSubPicProvider);
+
+ CSize size;
+ switch(AfxGetAppSettings().nSPCMaxRes)
+ {
+ case 0: default: size = m_ScreenSize; break;
+ case 1: size.SetSize(1024, 768); break;
+ case 2: size.SetSize(800, 600); break;
+ case 3: size.SetSize(640, 480); break;
+ case 4: size.SetSize(512, 384); break;
+ case 5: size.SetSize(384, 288); break;
+ }
+
+ if(m_pAllocator)
+ {
+ m_pAllocator->ChangeDevice(m_pD3DDev);
+ }
+ else
+ {
+ m_pAllocator = new CDX9SubPicAllocator(m_pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex);
+ if(!m_pAllocator)
+ return E_FAIL;
+ }
+
+ hr = S_OK;
+ m_pSubPicQueue = AfxGetAppSettings().nSPCSize > 0
+ ? (ISubPicQueue*)new CSubPicQueue(AfxGetAppSettings().nSPCSize, m_pAllocator, &hr)
+ : (ISubPicQueue*)new CSubPicQueueNoThread(m_pAllocator, &hr);
+ if(!m_pSubPicQueue || FAILED(hr))
+ return E_FAIL;
+
+ if(pSubPicProvider) m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
+
+ return S_OK;
+}
+
+HRESULT CDX9AllocatorPresenter::AllocSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ AppSettings& s = AfxGetAppSettings();
+
+ for(int i = 0; i < countof(m_pVideoTexture); i++)
+ {
+ m_pVideoTexture[i] = NULL;
+ m_pVideoSurface[i] = NULL;
+ }
+
+ m_pResizerBicubic1stPass = NULL;
+
+ HRESULT hr;
+
+ if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D || s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D)
+ {
+ int nTexturesNeeded = s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE3D ? countof(m_pVideoTexture) : 1;
+
+ for(int i = 0; i < nTexturesNeeded; i++)
+ {
+ if(FAILED(hr = m_pD3DDev->CreateTexture(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, 1,
+ D3DUSAGE_RENDERTARGET, /*D3DFMT_X8R8G8B8*/D3DFMT_A8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pVideoTexture[i], NULL)))
+ return hr;
+
+ if(FAILED(hr = m_pVideoTexture[i]->GetSurfaceLevel(0, &m_pVideoSurface[i])))
+ return hr;
+ }
+
+ if(s.iAPSurfaceUsage == VIDRNDT_AP_TEXTURE2D)
+ {
+ for(int i = 0; i < countof(m_pVideoTexture); i++)
+ {
+ m_pVideoTexture[i] = NULL;
+ }
+ }
+ }
+ else
+ {
+ if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy,
+ D3DFMT_X8R8G8B8/*D3DFMT_A8R8G8B8*/,
+ D3DPOOL_DEFAULT, &m_pVideoSurface[0], NULL)))
+ return hr;
+ }
+
+ hr = m_pD3DDev->ColorFill(m_pVideoSurface[0], NULL, 0);
+
+ return S_OK;
+}
+
+void CDX9AllocatorPresenter::DeleteSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ for(int i = 0; i < countof(m_pVideoTexture); i++)
+ {
+ m_pVideoTexture[i] = NULL;
+ m_pVideoSurface[i] = NULL;
+ }
+}
+
+UINT CDX9AllocatorPresenter::GetAdapter(IDirect3D9* pD3D)
+{
+ if(m_hWnd == NULL || pD3D == NULL)
+ return D3DADAPTER_DEFAULT;
+
+ HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+ if(hMonitor == NULL) return D3DADAPTER_DEFAULT;
+
+ for(UINT adp = 0, num_adp = pD3D->GetAdapterCount(); adp < num_adp; ++adp)
+ {
+ HMONITOR hAdpMon = pD3D->GetAdapterMonitor(adp);
+ if(hAdpMon == hMonitor) return adp;
+ }
+
+ return D3DADAPTER_DEFAULT;
+}
+
+// ISubPicAllocatorPresenter
+
+STDMETHODIMP CDX9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
+{
+ return E_NOTIMPL;
+}
+
+static bool ClipToSurface(IDirect3DSurface9* pSurface, CRect& s, CRect& d)
+{
+ D3DSURFACE_DESC d3dsd;
+ ZeroMemory(&d3dsd, sizeof(d3dsd));
+ if(FAILED(pSurface->GetDesc(&d3dsd)))
+ return(false);
+
+ int w = d3dsd.Width, h = d3dsd.Height;
+ int sw = s.Width(), sh = s.Height();
+ int dw = d.Width(), dh = d.Height();
+
+ if(d.left >= w || d.right < 0 || d.top >= h || d.bottom < 0
+ || sw <= 0 || sh <= 0 || dw <= 0 || dh <= 0)
+ {
+ s.SetRectEmpty();
+ d.SetRectEmpty();
+ return(true);
+ }
+
+ if(d.right > w) {s.right -= (d.right-w)*sw/dw; d.right = w;}
+ if(d.bottom > h) {s.bottom -= (d.bottom-h)*sh/dh; d.bottom = h;}
+ if(d.left < 0) {s.left += (0-d.left)*sw/dw; d.left = 0;}
+ if(d.top < 0) {s.top += (0-d.top)*sh/dh; d.top = 0;}
+
+ return(true);
+}
+
+HRESULT CDX9AllocatorPresenter::InitResizers(float bicubicA)
+{
+ HRESULT hr;
+
+ if(m_pResizerPixelShader[0] && m_bicubicA == 0 && bicubicA == 0
+ || m_pResizerPixelShader[1] && m_pResizerPixelShader[2] && m_bicubicA == bicubicA && m_pResizerBicubic1stPass)
+ return S_OK;
+
+ m_bicubicA = bicubicA;
+ m_pResizerBicubic1stPass = NULL;
+
+ for(int i = 0; i < countof(m_pResizerPixelShader); i++)
+ m_pResizerPixelShader[i] = NULL;
+
+ if(m_caps.PixelShaderVersion < D3DPS_VERSION(2, 0))
+ return E_FAIL;
+
+ LPCSTR pProfile = m_caps.PixelShaderVersion >= D3DPS_VERSION(3, 0) ? "ps_3_0" : "ps_2_0";
+
+ CStringA str;
+ if(!LoadResource(IDF_SHADER_RESIZER, str, _T("FILE")))
+ return E_FAIL;
+
+ CStringA A;
+ A.Format("(%f)", bicubicA);
+ str.Replace("_The_Value_Of_A_Is_Set_Here_", A);
+
+ LPCSTR pEntries[] = {"main_bilinear", "main_bicubic1pass", "main_bicubic2pass"};
+
+ ASSERT(countof(pEntries) == countof(m_pResizerPixelShader));
+
+ for(int i = 0; i < countof(pEntries); i++)
+ {
+ hr = m_pPSC->CompileShader(str, pEntries[i], pProfile, 0, &m_pResizerPixelShader[i]);
+ if(FAILED(hr)) return hr;
+ }
+
+ if(m_bicubicA)
+ {
+ if(FAILED(m_pD3DDev->CreateTexture(
+ min(max(2048, m_ScreenSize.cx), m_caps.MaxTextureWidth), m_NativeVideoSize.cy, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pResizerBicubic1stPass, NULL)))
+ {
+ ASSERT(0);
+ m_pResizerBicubic1stPass = NULL; // will do 1 pass then
+ }
+ }
+
+ return S_OK;
+}
+
+HRESULT CDX9AllocatorPresenter::TextureCopy(CComPtr<IDirect3DTexture9> pTexture)
+{
+ HRESULT hr;
+
+ D3DSURFACE_DESC desc;
+ if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc)))
+ return E_FAIL;
+
+ float w = (float)desc.Width;
+ float h = (float)desc.Height;
+
+ MYD3DVERTEX<1> v[] =
+ {
+ {0, 0, 0.5f, 2.0f, 0, 0},
+ {w, 0, 0.5f, 2.0f, 1, 0},
+ {0, h, 0.5f, 2.0f, 0, 1},
+ {w, h, 0.5f, 2.0f, 1, 1},
+ };
+
+ for(int i = 0; i < countof(v); i++)
+ {
+ v[i].x -= 0.5;
+ v[i].y -= 0.5;
+ }
+
+ hr = m_pD3DDev->SetTexture(0, pTexture);
+
+ return TextureBlt(m_pD3DDev, v, D3DTEXF_LINEAR);
+}
+
+HRESULT CDX9AllocatorPresenter::TextureResize(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4], D3DTEXTUREFILTERTYPE filter)
+{
+ HRESULT hr;
+
+ D3DSURFACE_DESC desc;
+ if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc)))
+ return E_FAIL;
+
+ float w = (float)desc.Width;
+ float h = (float)desc.Height;
+
+ float dx = 1.0f/w;
+ float dy = 1.0f/h;
+
+ MYD3DVERTEX<1> v[] =
+ {
+ {dst[0].x, dst[0].y, dst[0].z, 1.0f/dst[0].z, 0, 0},
+ {dst[1].x, dst[1].y, dst[1].z, 1.0f/dst[1].z, 1, 0},
+ {dst[2].x, dst[2].y, dst[2].z, 1.0f/dst[2].z, 0, 1},
+ {dst[3].x, dst[3].y, dst[3].z, 1.0f/dst[3].z, 1, 1},
+ };
+
+ AdjustQuad(v, dx, dy);
+
+ hr = m_pD3DDev->SetTexture(0, pTexture);
+
+ hr = m_pD3DDev->SetPixelShader(NULL);
+
+ hr = TextureBlt(m_pD3DDev, v, filter);
+
+ return hr;
+}
+
+HRESULT CDX9AllocatorPresenter::TextureResizeBilinear(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4])
+{
+ HRESULT hr;
+
+ D3DSURFACE_DESC desc;
+ if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc)))
+ return E_FAIL;
+
+ float w = (float)desc.Width;
+ float h = (float)desc.Height;
+
+ float dx = 1.0f/w;
+ float dy = 1.0f/h;
+
+ MYD3DVERTEX<5> v[] =
+ {
+ {dst[0].x, dst[0].y, dst[0].z, 1.0f/dst[0].z, 0, 0, 0+dx, 0, 0, 0+dy, 0+dx, 0+dy, 0, 0},
+ {dst[1].x, dst[1].y, dst[1].z, 1.0f/dst[1].z, 1, 0, 1+dx, 0, 1, 0+dy, 1+dx, 0+dy, w, 0},
+ {dst[2].x, dst[2].y, dst[2].z, 1.0f/dst[2].z, 0, 1, 0+dx, 1, 0, 1+dy, 0+dx, 1+dy, 0, h},
+ {dst[3].x, dst[3].y, dst[3].z, 1.0f/dst[3].z, 1, 1, 1+dx, 1, 1, 1+dy, 1+dx, 1+dy, w, h},
+ };
+
+ AdjustQuad(v, dx, dy);
+
+ hr = m_pD3DDev->SetTexture(0, pTexture);
+ hr = m_pD3DDev->SetTexture(1, pTexture);
+ hr = m_pD3DDev->SetTexture(2, pTexture);
+ hr = m_pD3DDev->SetTexture(3, pTexture);
+
+ hr = m_pD3DDev->SetPixelShader(m_pResizerPixelShader[0]);
+
+ hr = TextureBlt(m_pD3DDev, v, D3DTEXF_POINT);
+
+ //
+
+ m_pD3DDev->SetPixelShader(NULL);
+
+ return hr;
+}
+
+HRESULT CDX9AllocatorPresenter::TextureResizeBicubic1pass(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4])
+{
+ HRESULT hr;
+
+ D3DSURFACE_DESC desc;
+ if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc)))
+ return E_FAIL;
+
+ float w = (float)desc.Width;
+ float h = (float)desc.Height;
+
+ float dx = 1.0f/w;
+ float dy = 1.0f/h;
+
+ MYD3DVERTEX<2> v[] =
+ {
+ {dst[0].x, dst[0].y, dst[0].z, 1.0f/dst[0].z, 0, 0, 0, 0},
+ {dst[1].x, dst[1].y, dst[1].z, 1.0f/dst[1].z, 1, 0, w, 0},
+ {dst[2].x, dst[2].y, dst[2].z, 1.0f/dst[2].z, 0, 1, 0, h},
+ {dst[3].x, dst[3].y, dst[3].z, 1.0f/dst[3].z, 1, 1, w, h},
+ };
+
+ AdjustQuad(v, dx, dy);
+
+ hr = m_pD3DDev->SetTexture(0, pTexture);
+
+ float fConstData[][4] = {{w, h, 0, 0}, {1.0f / w, 1.0f / h, 0, 0}, {1.0f / w, 0, 0, 0}, {0, 1.0f / h, 0, 0}};
+ hr = m_pD3DDev->SetPixelShaderConstantF(0, (float*)fConstData, countof(fConstData));
+
+ hr = m_pD3DDev->SetPixelShader(m_pResizerPixelShader[1]);
+
+ hr = TextureBlt(m_pD3DDev, v, D3DTEXF_POINT);
+
+ m_pD3DDev->SetPixelShader(NULL);
+
+ return hr;
+}
+
+HRESULT CDX9AllocatorPresenter::TextureResizeBicubic2pass(CComPtr<IDirect3DTexture9> pTexture, Vector dst[4])
+{
+ // return TextureResizeBicubic1pass(pTexture, dst);
+
+ HRESULT hr;
+
+ // rotated?
+ if(dst[0].z != dst[1].z || dst[2].z != dst[3].z || dst[0].z != dst[3].z
+ || dst[0].y != dst[1].y || dst[0].x != dst[2].x || dst[2].y != dst[3].y || dst[1].x != dst[3].x)
+ return TextureResizeBicubic1pass(pTexture, dst);
+
+ D3DSURFACE_DESC desc;
+ if(!pTexture || FAILED(pTexture->GetLevelDesc(0, &desc)))
+ return E_FAIL;
+
+ float dx = 1.0f/desc.Width;
+
+ float w = (float)desc.Width;
+ float h = (float)desc.Height;
+
+ CRect dst1(0, 0, (int)(dst[3].x - dst[0].x), (int)h);
+
+ if(!m_pResizerBicubic1stPass || FAILED(m_pResizerBicubic1stPass->GetLevelDesc(0, &desc)))
+ return TextureResizeBicubic1pass(pTexture, dst);
+
+ float dy = 1.0f/desc.Height;
+
+ float dw = (float)dst1.Width() / desc.Width;
+ float dh = (float)dst1.Height() / desc.Height;
+
+ ASSERT(dst1.Height() == desc.Height);
+
+ if(dst1.Width() > desc.Width || dst1.Height() > desc.Height)
+ // if(dst1.Width() != desc.Width || dst1.Height() != desc.Height)
+ return TextureResizeBicubic1pass(pTexture, dst);
+
+ MYD3DVERTEX<5> vx[] =
+ {
+ {(float)dst1.left, (float)dst1.top, 0.5f, 2.0f, 0-dx, 0, 0, 0, 0+dx, 0, 0+dx*2, 0, 0, 0},
+ {(float)dst1.right, (float)dst1.top, 0.5f, 2.0f, 1-dx, 0, 1, 0, 1+dx, 0, 1+dx*2, 0, w, 0},
+ {(float)dst1.left, (float)dst1.bottom, 0.5f, 2.0f, 0-dx, 1, 0, 1, 0+dx, 1, 0+dx*2, 1, 0, 0},
+ {(float)dst1.right, (float)dst1.bottom, 0.5f, 2.0f, 1-dx, 1, 1, 1, 1+dx, 1, 1+dx*2, 1, w, 0},
+ };
+
+ AdjustQuad(vx, dx, 0);
+
+ MYD3DVERTEX<5> vy[] =
+ {
+ {dst[0].x, dst[0].y, dst[0].z, 1.0f/dst[0].z, 0, 0-dy, 0, 0, 0, 0+dy, 0, 0+dy*2, 0, 0},
+ {dst[1].x, dst[1].y, dst[1].z, 1.0f/dst[1].z, dw, 0-dy, dw, 0, dw, 0+dy, dw, 0+dy*2, 0, 0},
+ {dst[2].x, dst[2].y, dst[2].z, 1.0f/dst[2].z, 0, dh-dy, 0, dh, 0, dh+dy, 0, dh+dy*2, h, 0},
+ {dst[3].x, dst[3].y, dst[3].z, 1.0f/dst[3].z, dw, dh-dy, dw, dh, dw, dh+dy, dw, dh+dy*2, h, 0},
+ };
+
+ AdjustQuad(vy, 0, dy);
+
+ hr = m_pD3DDev->SetPixelShader(m_pResizerPixelShader[2]);
+
+ hr = m_pD3DDev->SetTexture(0, pTexture);
+ hr = m_pD3DDev->SetTexture(1, pTexture);
+ hr = m_pD3DDev->SetTexture(2, pTexture);
+ hr = m_pD3DDev->SetTexture(3, pTexture);
+
+ CComPtr<IDirect3DSurface9> pRTOld;
+ hr = m_pD3DDev->GetRenderTarget(0, &pRTOld);
+
+ CComPtr<IDirect3DSurface9> pRT;
+ hr = m_pResizerBicubic1stPass->GetSurfaceLevel(0, &pRT);
+ hr = m_pD3DDev->SetRenderTarget(0, pRT);
+
+ hr = TextureBlt(m_pD3DDev, vx, D3DTEXF_POINT);
+
+ hr = m_pD3DDev->SetTexture(0, m_pResizerBicubic1stPass);
+ hr = m_pD3DDev->SetTexture(1, m_pResizerBicubic1stPass);
+ hr = m_pD3DDev->SetTexture(2, m_pResizerBicubic1stPass);
+ hr = m_pD3DDev->SetTexture(3, m_pResizerBicubic1stPass);
+
+ hr = m_pD3DDev->SetRenderTarget(0, pRTOld);
+
+ hr = TextureBlt(m_pD3DDev, vy, D3DTEXF_POINT);
+
+ m_pD3DDev->SetPixelShader(NULL);
+
+ return hr;
+}
+
+HRESULT CDX9AllocatorPresenter::AlphaBlt(RECT* pSrc, RECT* pDst, CComPtr<IDirect3DTexture9> pTexture)
+{
+ if(!pSrc || !pDst)
+ return E_POINTER;
+
+ CRect src(*pSrc), dst(*pDst);
+
+ HRESULT hr;
+
+ do
+ {
+ D3DSURFACE_DESC d3dsd;
+ ZeroMemory(&d3dsd, sizeof(d3dsd));
+ if(FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/)
+ break;
+
+ float w = (float)d3dsd.Width;
+ float h = (float)d3dsd.Height;
+
+ struct
+ {
+ float x, y, z, rhw;
+ float tu, tv;
+ }
+ pVertices[] =
+ {
+ {(float)dst.left, (float)dst.top, 0.5f, 2.0f, (float)src.left / w, (float)src.top / h},
+ {(float)dst.right, (float)dst.top, 0.5f, 2.0f, (float)src.right / w, (float)src.top / h},
+ {(float)dst.left, (float)dst.bottom, 0.5f, 2.0f, (float)src.left / w, (float)src.bottom / h},
+ {(float)dst.right, (float)dst.bottom, 0.5f, 2.0f, (float)src.right / w, (float)src.bottom / h},
+ };
+/*
+ for(int i = 0; i < countof(pVertices); i++)
+ {
+ pVertices[i].x -= 0.5;
+ pVertices[i].y -= 0.5;
+ }
+*/
+
+ hr = m_pD3DDev->SetTexture(0, pTexture);
+
+ DWORD abe, sb, db;
+ hr = m_pD3DDev->GetRenderState(D3DRS_ALPHABLENDENABLE, &abe);
+ hr = m_pD3DDev->GetRenderState(D3DRS_SRCBLEND, &sb);
+ hr = m_pD3DDev->GetRenderState(D3DRS_DESTBLEND, &db);
+
+ hr = m_pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ hr = m_pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
+ hr = m_pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
+ hr = m_pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
+ hr = m_pD3DDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); // pre-multiplied src and ...
+ hr = m_pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_SRCALPHA); // ... inverse alpha channel for dst
+
+ hr = m_pD3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ hr = m_pD3DDev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+ hr = m_pD3DDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
+
+ hr = m_pD3DDev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
+ hr = m_pD3DDev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
+ hr = m_pD3DDev->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
+
+ hr = m_pD3DDev->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+ hr = m_pD3DDev->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+
+ /*//
+
+ D3DCAPS9 d3dcaps9;
+ hr = m_pD3DDev->GetDeviceCaps(&d3dcaps9);
+ if(d3dcaps9.AlphaCmpCaps & D3DPCMPCAPS_LESS)
+ {
+ hr = m_pD3DDev->SetRenderState(D3DRS_ALPHAREF, (DWORD)0x000000FE);
+ hr = m_pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
+ hr = m_pD3DDev->SetRenderState(D3DRS_ALPHAFUNC, D3DPCMPCAPS_LESS);
+ }
+
+ *///
+
+ hr = m_pD3DDev->SetPixelShader(NULL);
+
+ if(FAILED(hr = m_pD3DDev->BeginScene()))
+ break;
+
+ hr = m_pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
+ hr = m_pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pVertices, sizeof(pVertices[0]));
+
+ hr = m_pD3DDev->EndScene();
+
+ //
+
+ m_pD3DDev->SetTexture(0, NULL);
+
+ m_pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, abe);
+ m_pD3DDev->SetRenderState(D3DRS_SRCBLEND, sb);
+ m_pD3DDev->SetRenderState(D3DRS_DESTBLEND, db);
+
+ return S_OK;
+ }
+ while(0);
+
+ return E_FAIL;
+}
+
+
+STDMETHODIMP_(bool) CDX9AllocatorPresenter::Paint(bool fAll)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ CAutoLock cAutoLock(this);
+
+ if(m_WindowRect.right <= m_WindowRect.left || m_WindowRect.bottom <= m_WindowRect.top
+ || m_NativeVideoSize.cx <= 0 || m_NativeVideoSize.cy <= 0
+ || !m_pVideoSurface)
+ return(false);
+
+ HRESULT hr;
+
+ CRect rSrcVid(CPoint(0, 0), m_NativeVideoSize);
+ CRect rDstVid(m_VideoRect);
+
+ CRect rSrcPri(CPoint(0, 0), m_WindowRect.Size());
+ CRect rDstPri(m_WindowRect);
+
+ CComPtr<IDirect3DSurface9> pBackBuffer;
+ m_pD3DDev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer);
+
+ m_pD3DDev->SetRenderTarget(0, pBackBuffer);
+
+ if(fAll)
+ {
+ // clear the backbuffer
+
+ hr = m_pD3DDev->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1.0f, 0);
+
+ // paint the video on the backbuffer
+
+ if(!rDstVid.IsRectEmpty())
+ {
+ if(m_pVideoTexture[0])
+ {
+ CComPtr<IDirect3DTexture9> pVideoTexture = m_pVideoTexture[0];
+
+ if(m_pVideoTexture[1] && m_pVideoTexture[2] && !m_pPixelShaders.IsEmpty())
+ {
+ static __int64 counter = 0;
+ static long start = clock();
+
+ long stop = clock();
+ long diff = stop - start;
+
+ if(diff >= 10*60*CLOCKS_PER_SEC) start = stop; // reset after 10 min (ps float has its limits in both range and accuracy)
+
+ float fConstData[][4] =
+ {
+ {(float)m_NativeVideoSize.cx, (float)m_NativeVideoSize.cy, (float)(counter++), (float)diff / CLOCKS_PER_SEC},
+ {1.0f / m_NativeVideoSize.cx, 1.0f / m_NativeVideoSize.cy, 0, 0},
+ };
+
+ hr = m_pD3DDev->SetPixelShaderConstantF(0, (float*)fConstData, countof(fConstData));
+
+ CComPtr<IDirect3DSurface9> pRT;
+ hr = m_pD3DDev->GetRenderTarget(0, &pRT);
+
+ int src = 0, dst = 1;
+
+ POSITION pos = m_pPixelShaders.GetHeadPosition();
+ while(pos)
+ {
+ pVideoTexture = m_pVideoTexture[dst];
+
+ hr = m_pD3DDev->SetRenderTarget(0, m_pVideoSurface[dst]);
+ hr = m_pD3DDev->SetPixelShader(m_pPixelShaders.GetNext(pos));
+ TextureCopy(m_pVideoTexture[src]);
+
+ if(++src > 2) src = 1;
+ if(++dst > 2) dst = 1;
+ }
+
+ hr = m_pD3DDev->SetRenderTarget(0, pRT);
+ hr = m_pD3DDev->SetPixelShader(NULL);
+ }
+
+ Vector dst[4];
+ Transform(rDstVid, dst);
+
+ DWORD iDX9Resizer = s.iDX9Resizer;
+
+ float A = 0;
+
+ switch(iDX9Resizer)
+ {
+ case 3: A = -0.60f; break;
+ case 4: A = -0.75f; break;
+ case 5: A = -1.00f; break;
+ }
+
+ hr = InitResizers(A);
+
+ if(iDX9Resizer == 0 || iDX9Resizer == 1 || rSrcVid.Size() == rDstVid.Size() || FAILED(hr))
+ {
+ hr = TextureResize(pVideoTexture, dst, iDX9Resizer == 0 ? D3DTEXF_POINT : D3DTEXF_LINEAR);
+ }
+ else if(iDX9Resizer == 2)
+ {
+ hr = TextureResizeBilinear(pVideoTexture, dst);
+ }
+ else if(iDX9Resizer >= 3)
+ {
+ hr = TextureResizeBicubic2pass(pVideoTexture, dst);
+ }
+
+ }
+ else
+ {
+ if(pBackBuffer)
+ {
+ ClipToSurface(pBackBuffer, rSrcVid, rDstVid); // grrr
+ // IMPORTANT: rSrcVid has to be aligned on mod2 for yuy2->rgb conversion with StretchRect!!!
+ rSrcVid.left &= ~1; rSrcVid.right &= ~1;
+ rSrcVid.top &= ~1; rSrcVid.bottom &= ~1;
+ hr = m_pD3DDev->StretchRect(m_pVideoSurface[0], rSrcVid, pBackBuffer, rDstVid, m_filter);
+ }
+ }
+ }
+
+ // paint the text on the backbuffer
+
+ AlphaBltSubPic(rSrcPri.Size());
+ }
+
+ // Casimir666 : affichage de l'OSD
+ if (m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_UPDATE)
+ {
+ CRect rcSrc (m_VMR9AlphaBitmap.rSrc);
+ m_pOSDTexture = NULL;
+ m_pOSDSurface = NULL;
+ if ((m_VMR9AlphaBitmap.dwFlags & VMRBITMAP_DISABLE) == 0)
+ {
+ if(SUCCEEDED(hr = m_pD3DDev->CreateTexture(rcSrc.Width(), rcSrc.Height(), 1,
+ D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pOSDTexture, NULL)))
+ {
+ if (SUCCEEDED (hr = m_pOSDTexture->GetSurfaceLevel(0, &m_pOSDSurface)))
+ {
+ HBITMAP hBitmap = (HBITMAP)GetCurrentObject (m_VMR9AlphaBitmap.hdc, OBJ_BITMAP);
+ DIBSECTION info = {0};
+
+ ::GetObject(hBitmap, sizeof( DIBSECTION ), &info );
+ CRect rcBitmap (0, 0, info.dsBm.bmWidth, info.dsBm.bmHeight);
+
+ hr = D3DXLoadSurfaceFromMemory (m_pOSDSurface,
+ NULL,
+ NULL,
+ info.dsBm.bmBits,
+ D3DFMT_A8R8G8B8,
+ info.dsBm.bmWidthBytes,
+ NULL,
+ &rcBitmap,
+ D3DX_FILTER_NONE,
+ m_VMR9AlphaBitmap.clrSrcKey);
+ }
+ if (FAILED (hr))
+ {
+ m_pOSDTexture = NULL;
+ m_pOSDSurface = NULL;
+ }
+ }
+ }
+ m_VMR9AlphaBitmap.dwFlags ^= VMRBITMAP_UPDATE;
+
+ }
+ if (m_pOSDTexture) AlphaBlt(rSrcPri, rDstPri, m_pOSDTexture);
+
+ if(m_fVMRSyncFix)
+ {
+ D3DLOCKED_RECT lr;
+ if(SUCCEEDED(pBackBuffer->LockRect(&lr, NULL, 0)))
+ pBackBuffer->UnlockRect();
+ }
+
+ if (((CMainFrame*)AfxGetApp()->m_pMainWnd)->IsD3DFullScreenMode())
+ hr = m_pD3DDev->Present(NULL, NULL, NULL, NULL);
+ else
+ hr = m_pD3DDev->Present(rSrcPri, rDstPri, NULL, NULL);
+
+ bool fResetDevice = false;
+
+ if(hr == D3DERR_DEVICELOST && m_pD3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET)
+ {
+ fResetDevice = true;
+ }
+
+ D3DDEVICE_CREATION_PARAMETERS Parameters;
+ if(SUCCEEDED(m_pD3DDev->GetCreationParameters(&Parameters))
+ && m_pD3D->GetAdapterMonitor(Parameters.AdapterOrdinal) != m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D)))
+ {
+ fResetDevice = true;
+ }
+
+ if(fResetDevice)
+ {
+ DeleteSurfaces();
+ if(FAILED(hr = CreateDevice()) || FAILED(hr = AllocSurfaces()))
+ return false;
+ }
+
+ return(true);
+}
+
+STDMETHODIMP CDX9AllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
+{
+ CheckPointer(size, E_POINTER);
+
+ HRESULT hr;
+
+ D3DSURFACE_DESC desc;
+ memset(&desc, 0, sizeof(desc));
+ m_pVideoSurface[0]->GetDesc(&desc);
+
+ DWORD required = sizeof(BITMAPINFOHEADER) + (desc.Width * desc.Height * 32 >> 3);
+ if(!lpDib) {*size = required; return S_OK;}
+ if(*size < required) return E_OUTOFMEMORY;
+ *size = required;
+
+ CComPtr<IDirect3DSurface9> pSurface = m_pVideoSurface[0];
+ D3DLOCKED_RECT r;
+ if(FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY)))
+ {
+ pSurface = NULL;
+ if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pSurface, NULL))
+ || FAILED(hr = m_pD3DDev->GetRenderTargetData(m_pVideoSurface[0], pSurface))
+ || FAILED(hr = pSurface->LockRect(&r, NULL, D3DLOCK_READONLY)))
+ return hr;
+ }
+
+ BITMAPINFOHEADER* bih = (BITMAPINFOHEADER*)lpDib;
+ memset(bih, 0, sizeof(BITMAPINFOHEADER));
+ bih->biSize = sizeof(BITMAPINFOHEADER);
+ bih->biWidth = desc.Width;
+ bih->biHeight = desc.Height;
+ bih->biBitCount = 32;
+ bih->biPlanes = 1;
+ bih->biSizeImage = bih->biWidth * bih->biHeight * bih->biBitCount >> 3;
+
+ BitBltFromRGBToRGB(
+ bih->biWidth, bih->biHeight,
+ (BYTE*)(bih + 1), bih->biWidth*bih->biBitCount>>3, bih->biBitCount,
+ (BYTE*)r.pBits + r.Pitch*(desc.Height-1), -(int)r.Pitch, 32);
+
+ pSurface->UnlockRect();
+
+ return S_OK;
+}
+
+STDMETHODIMP CDX9AllocatorPresenter::SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget)
+{
+ CAutoLock cAutoLock(this);
+
+ if(!pSrcData && !pTarget)
+ {
+ m_pPixelShaders.RemoveAll();
+ m_pD3DDev->SetPixelShader(NULL);
+ return S_OK;
+ }
+
+ if(!pSrcData || !pTarget)
+ return E_INVALIDARG;
+
+ CComPtr<IDirect3DPixelShader9> pPixelShader;
+
+ HRESULT hr = m_pPSC->CompileShader(pSrcData, "main", pTarget, 0, &pPixelShader);
+ if(FAILED(hr)) return hr;
+
+ m_pPixelShaders.AddTail(pPixelShader);
+
+ Paint(true);
+
+ return S_OK;
+}
+
+//
+// CVMR9AllocatorPresenter
+//
+
+#define MY_USER_ID 0x6ABE51
+
+CVMR9AllocatorPresenter::CVMR9AllocatorPresenter(HWND hWnd, HRESULT& hr)
+ : CDX9AllocatorPresenter(hWnd, hr)
+ , m_fUseInternalTimer(false)
+ , m_rtPrevStart(-1)
+{
+}
+
+STDMETHODIMP CVMR9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IVMRSurfaceAllocator9)
+ QI(IVMRImagePresenter9)
+ QI(IVMRWindowlessControl9)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CVMR9AllocatorPresenter::CreateDevice()
+{
+ HRESULT hr = __super::CreateDevice();
+ if(FAILED(hr)) return hr;
+
+ if(m_pIVMRSurfAllocNotify)
+ {
+ HMONITOR hMonitor = m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D));
+ if(FAILED(hr = m_pIVMRSurfAllocNotify->ChangeD3DDevice(m_pD3DDev, hMonitor)))
+ return(false);
+ }
+
+ return hr;
+}
+
+void CVMR9AllocatorPresenter::DeleteSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ m_pSurfaces.RemoveAll();
+
+ return __super::DeleteSurfaces();
+}
+
+// ISubPicAllocatorPresenter
+
+class COuterVMR9
+ : public CUnknown
+ , public IVideoWindow
+ , public IBasicVideo2
+ , public IVMRWindowlessControl
+ , public IVMRMixerBitmap9
+{
+ CComPtr<IUnknown> m_pVMR;
+ VMR9AlphaBitmap* m_pVMR9AlphaBitmap;
+
+public:
+
+ COuterVMR9(const TCHAR* pName, LPUNKNOWN pUnk, VMR9AlphaBitmap* pVMR9AlphaBitmap) : CUnknown(pName, pUnk)
+ {
+ m_pVMR.CoCreateInstance(CLSID_VideoMixingRenderer9, GetOwner());
+ m_pVMR9AlphaBitmap = pVMR9AlphaBitmap;
+ }
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
+ {
+ HRESULT hr;
+
+ // Casimir666 : en mode Renderless faire l'incrustation à la place du VMR
+ if(riid == __uuidof(IVMRMixerBitmap9))
+ return GetInterface((IVMRMixerBitmap9*)this, ppv);
+
+ hr = m_pVMR ? m_pVMR->QueryInterface(riid, ppv) : E_NOINTERFACE;
+ if(m_pVMR && FAILED(hr))
+ {
+ if(riid == __uuidof(IVideoWindow))
+ return GetInterface((IVideoWindow*)this, ppv);
+ if(riid == __uuidof(IBasicVideo))
+ return GetInterface((IBasicVideo*)this, ppv);
+ if(riid == __uuidof(IBasicVideo2))
+ return GetInterface((IBasicVideo2*)this, ppv);
+/* if(riid == __uuidof(IVMRWindowlessControl))
+ return GetInterface((IVMRWindowlessControl*)this, ppv);
+*/
+ }
+
+ return SUCCEEDED(hr) ? hr : __super::NonDelegatingQueryInterface(riid, ppv);
+ }
+
+ // IVMRWindowlessControl
+
+ STDMETHODIMP GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight)
+ {
+ if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR)
+ {
+ return pWC9->GetNativeVideoSize(lpWidth, lpHeight, lpARWidth, lpARHeight);
+ }
+
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;}
+ STDMETHODIMP GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;}
+ STDMETHODIMP SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect) {return E_NOTIMPL;}
+ STDMETHODIMP GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect)
+ {
+ if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR)
+ {
+ return pWC9->GetVideoPosition(lpSRCRect, lpDSTRect);
+ }
+
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP GetAspectRatioMode(DWORD* lpAspectRatioMode)
+ {
+ if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR)
+ {
+ *lpAspectRatioMode = VMR_ARMODE_NONE;
+ return S_OK;
+ }
+
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP SetAspectRatioMode(DWORD AspectRatioMode) {return E_NOTIMPL;}
+ STDMETHODIMP SetVideoClippingWindow(HWND hwnd) {return E_NOTIMPL;}
+ STDMETHODIMP RepaintVideo(HWND hwnd, HDC hdc) {return E_NOTIMPL;}
+ STDMETHODIMP DisplayModeChanged() {return E_NOTIMPL;}
+ STDMETHODIMP GetCurrentImage(BYTE** lpDib) {return E_NOTIMPL;}
+ STDMETHODIMP SetBorderColor(COLORREF Clr) {return E_NOTIMPL;}
+ STDMETHODIMP GetBorderColor(COLORREF* lpClr) {return E_NOTIMPL;}
+ STDMETHODIMP SetColorKey(COLORREF Clr) {return E_NOTIMPL;}
+ STDMETHODIMP GetColorKey(COLORREF* lpClr) {return E_NOTIMPL;}
+
+ // IVideoWindow
+ STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) {return E_NOTIMPL;}
+ STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) {return E_NOTIMPL;}
+ STDMETHODIMP put_Caption(BSTR strCaption) {return E_NOTIMPL;}
+ STDMETHODIMP get_Caption(BSTR* strCaption) {return E_NOTIMPL;}
+ STDMETHODIMP put_WindowStyle(long WindowStyle) {return E_NOTIMPL;}
+ STDMETHODIMP get_WindowStyle(long* WindowStyle) {return E_NOTIMPL;}
+ STDMETHODIMP put_WindowStyleEx(long WindowStyleEx) {return E_NOTIMPL;}
+ STDMETHODIMP get_WindowStyleEx(long* WindowStyleEx) {return E_NOTIMPL;}
+ STDMETHODIMP put_AutoShow(long AutoShow) {return E_NOTIMPL;}
+ STDMETHODIMP get_AutoShow(long* AutoShow) {return E_NOTIMPL;}
+ STDMETHODIMP put_WindowState(long WindowState) {return E_NOTIMPL;}
+ STDMETHODIMP get_WindowState(long* WindowState) {return E_NOTIMPL;}
+ STDMETHODIMP put_BackgroundPalette(long BackgroundPalette) {return E_NOTIMPL;}
+ STDMETHODIMP get_BackgroundPalette(long* pBackgroundPalette) {return E_NOTIMPL;}
+ STDMETHODIMP put_Visible(long Visible) {return E_NOTIMPL;}
+ STDMETHODIMP get_Visible(long* pVisible) {return E_NOTIMPL;}
+ STDMETHODIMP put_Left(long Left) {return E_NOTIMPL;}
+ STDMETHODIMP get_Left(long* pLeft) {return E_NOTIMPL;}
+ STDMETHODIMP put_Width(long Width) {return E_NOTIMPL;}
+ STDMETHODIMP get_Width(long* pWidth)
+ {
+ if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR)
+ {
+ CRect s, d;
+ HRESULT hr = pWC9->GetVideoPosition(&s, &d);
+ *pWidth = d.Width();
+ return hr;
+ }
+
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP put_Top(long Top) {return E_NOTIMPL;}
+ STDMETHODIMP get_Top(long* pTop) {return E_NOTIMPL;}
+ STDMETHODIMP put_Height(long Height) {return E_NOTIMPL;}
+ STDMETHODIMP get_Height(long* pHeight)
+ {
+ if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR)
+ {
+ CRect s, d;
+ HRESULT hr = pWC9->GetVideoPosition(&s, &d);
+ *pHeight = d.Height();
+ return hr;
+ }
+
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP put_Owner(OAHWND Owner) {return E_NOTIMPL;}
+ STDMETHODIMP get_Owner(OAHWND* Owner) {return E_NOTIMPL;}
+ STDMETHODIMP put_MessageDrain(OAHWND Drain) {return E_NOTIMPL;}
+ STDMETHODIMP get_MessageDrain(OAHWND* Drain) {return E_NOTIMPL;}
+ STDMETHODIMP get_BorderColor(long* Color) {return E_NOTIMPL;}
+ STDMETHODIMP put_BorderColor(long Color) {return E_NOTIMPL;}
+ STDMETHODIMP get_FullScreenMode(long* FullScreenMode) {return E_NOTIMPL;}
+ STDMETHODIMP put_FullScreenMode(long FullScreenMode) {return E_NOTIMPL;}
+ STDMETHODIMP SetWindowForeground(long Focus) {return E_NOTIMPL;}
+ STDMETHODIMP NotifyOwnerMessage(OAHWND hwnd, long uMsg, LONG_PTR wParam, LONG_PTR lParam) {return E_NOTIMPL;}
+ STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;}
+ STDMETHODIMP GetWindowPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;}
+ STDMETHODIMP GetMinIdealImageSize(long* pWidth, long* pHeight) {return E_NOTIMPL;}
+ STDMETHODIMP GetMaxIdealImageSize(long* pWidth, long* pHeight) {return E_NOTIMPL;}
+ STDMETHODIMP GetRestorePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight) {return E_NOTIMPL;}
+ STDMETHODIMP HideCursor(long HideCursor) {return E_NOTIMPL;}
+ STDMETHODIMP IsCursorHidden(long* CursorHidden) {return E_NOTIMPL;}
+
+ // IBasicVideo2
+ STDMETHODIMP get_AvgTimePerFrame(REFTIME* pAvgTimePerFrame) {return E_NOTIMPL;}
+ STDMETHODIMP get_BitRate(long* pBitRate) {return E_NOTIMPL;}
+ STDMETHODIMP get_BitErrorRate(long* pBitErrorRate) {return E_NOTIMPL;}
+ STDMETHODIMP get_VideoWidth(long* pVideoWidth) {return E_NOTIMPL;}
+ STDMETHODIMP get_VideoHeight(long* pVideoHeight) {return E_NOTIMPL;}
+ STDMETHODIMP put_SourceLeft(long SourceLeft) {return E_NOTIMPL;}
+ STDMETHODIMP get_SourceLeft(long* pSourceLeft) {return E_NOTIMPL;}
+ STDMETHODIMP put_SourceWidth(long SourceWidth) {return E_NOTIMPL;}
+ STDMETHODIMP get_SourceWidth(long* pSourceWidth) {return E_NOTIMPL;}
+ STDMETHODIMP put_SourceTop(long SourceTop) {return E_NOTIMPL;}
+ STDMETHODIMP get_SourceTop(long* pSourceTop) {return E_NOTIMPL;}
+ STDMETHODIMP put_SourceHeight(long SourceHeight) {return E_NOTIMPL;}
+ STDMETHODIMP get_SourceHeight(long* pSourceHeight) {return E_NOTIMPL;}
+ STDMETHODIMP put_DestinationLeft(long DestinationLeft) {return E_NOTIMPL;}
+ STDMETHODIMP get_DestinationLeft(long* pDestinationLeft) {return E_NOTIMPL;}
+ STDMETHODIMP put_DestinationWidth(long DestinationWidth) {return E_NOTIMPL;}
+ STDMETHODIMP get_DestinationWidth(long* pDestinationWidth) {return E_NOTIMPL;}
+ STDMETHODIMP put_DestinationTop(long DestinationTop) {return E_NOTIMPL;}
+ STDMETHODIMP get_DestinationTop(long* pDestinationTop) {return E_NOTIMPL;}
+ STDMETHODIMP put_DestinationHeight(long DestinationHeight) {return E_NOTIMPL;}
+ STDMETHODIMP get_DestinationHeight(long* pDestinationHeight) {return E_NOTIMPL;}
+ STDMETHODIMP SetSourcePosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;}
+ STDMETHODIMP GetSourcePosition(long* pLeft, long* pTop, long* pWidth, long* pHeight)
+ {
+ // DVD Nav. bug workaround fix
+ {
+ *pLeft = *pTop = 0;
+ return GetVideoSize(pWidth, pHeight);
+ }
+/*
+ if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR)
+ {
+ CRect s, d;
+ HRESULT hr = pWC9->GetVideoPosition(&s, &d);
+ *pLeft = s.left;
+ *pTop = s.top;
+ *pWidth = s.Width();
+ *pHeight = s.Height();
+ return hr;
+ }
+*/
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP SetDefaultSourcePosition() {return E_NOTIMPL;}
+ STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height) {return E_NOTIMPL;}
+ STDMETHODIMP GetDestinationPosition(long* pLeft, long* pTop, long* pWidth, long* pHeight)
+ {
+ if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR)
+ {
+ CRect s, d;
+ HRESULT hr = pWC9->GetVideoPosition(&s, &d);
+ *pLeft = d.left;
+ *pTop = d.top;
+ *pWidth = d.Width();
+ *pHeight = d.Height();
+ return hr;
+ }
+
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP SetDefaultDestinationPosition() {return E_NOTIMPL;}
+ STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight)
+ {
+ if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR)
+ {
+ LONG aw, ah;
+// return pWC9->GetNativeVideoSize(pWidth, pHeight, &aw, &ah);
+ // DVD Nav. bug workaround fix
+ HRESULT hr = pWC9->GetNativeVideoSize(pWidth, pHeight, &aw, &ah);
+ *pWidth = *pHeight * aw / ah;
+ return hr;
+ }
+
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP GetVideoPaletteEntries(long StartIndex, long Entries, long* pRetrieved, long* pPalette) {return E_NOTIMPL;}
+ STDMETHODIMP GetCurrentImage(long* pBufferSize, long* pDIBImage) {return E_NOTIMPL;}
+ STDMETHODIMP IsUsingDefaultSource() {return E_NOTIMPL;}
+ STDMETHODIMP IsUsingDefaultDestination() {return E_NOTIMPL;}
+
+ STDMETHODIMP GetPreferredAspectRatio(long* plAspectX, long* plAspectY)
+ {
+ if(CComQIPtr<IVMRWindowlessControl9> pWC9 = m_pVMR)
+ {
+ LONG w, h;
+ return pWC9->GetNativeVideoSize(&w, &h, plAspectX, plAspectY);
+ }
+
+ return E_NOTIMPL;
+ }
+
+ // IVMRMixerBitmap9
+ STDMETHODIMP GetAlphaBitmapParameters(VMR9AlphaBitmap* pBmpParms)
+ {
+ CheckPointer(pBmpParms, E_POINTER);
+ memcpy (pBmpParms, m_pVMR9AlphaBitmap, sizeof(VMR9AlphaBitmap));
+ return S_OK;
+ }
+
+ STDMETHODIMP SetAlphaBitmap(const VMR9AlphaBitmap* pBmpParms)
+ {
+ CheckPointer(pBmpParms, E_POINTER);
+ memcpy (m_pVMR9AlphaBitmap, pBmpParms, sizeof(VMR9AlphaBitmap));
+ m_pVMR9AlphaBitmap->dwFlags |= VMRBITMAP_UPDATE;
+ return S_OK;
+ }
+
+ STDMETHODIMP UpdateAlphaBitmapParameters(const VMR9AlphaBitmap* pBmpParms)
+ {
+ CheckPointer(pBmpParms, E_POINTER);
+ memcpy (m_pVMR9AlphaBitmap, pBmpParms, sizeof(VMR9AlphaBitmap));
+ m_pVMR9AlphaBitmap->dwFlags |= VMRBITMAP_UPDATE;
+ return S_OK;
+ }
+};
+
+STDMETHODIMP CVMR9AllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
+{
+ CheckPointer(ppRenderer, E_POINTER);
+
+ *ppRenderer = NULL;
+
+ HRESULT hr;
+
+ do
+ {
+ CMacrovisionKicker* pMK = new CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;
+ pMK->SetInner((IUnknown*)(INonDelegatingUnknown*)new COuterVMR9(NAME("COuterVMR9"), pUnk, &m_VMR9AlphaBitmap));
+ CComQIPtr<IBaseFilter> pBF = pUnk;
+/*
+ CComQIPtr<IBaseFilter> pBF = (IUnknown*)(INonDelegatingUnknown*)new COuterVMR9(NAME("COuterVMR9"), NULL);
+ if(!pBF) pBF.CoCreateInstance(CLSID_VideoMixingRenderer9);
+*/
+
+ CComPtr<IPin> pPin = GetFirstPin(pBF);
+ CComQIPtr<IMemInputPin> pMemInputPin = pPin;
+ m_fUseInternalTimer = HookNewSegmentAndReceive((IPinC*)(IPin*)pPin, (IMemInputPinC*)(IMemInputPin*)pMemInputPin);
+/*
+if(CComQIPtr<IAMVideoAccelerator> pAMVA = pPin)
+ HookAMVideoAccelerator((IAMVideoAcceleratorC*)(IAMVideoAccelerator*)pAMVA);
+*/
+ CComQIPtr<IVMRFilterConfig9> pConfig = pBF;
+ if(!pConfig)
+ break;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ if(s.fVMR9MixerMode)
+ {
+ if(FAILED(hr = pConfig->SetNumberOfStreams(1)))
+ break;
+
+ if(s.fVMR9MixerYUV)
+ {
+ if(CComQIPtr<IVMRMixerControl9> pMC = pBF)
+ {
+ DWORD dwPrefs;
+ pMC->GetMixingPrefs(&dwPrefs);
+ dwPrefs &= ~MixerPref9_RenderTargetMask;
+ dwPrefs |= MixerPref9_RenderTargetYUV;
+ pMC->SetMixingPrefs(dwPrefs);
+ }
+ }
+ }
+
+ if(FAILED(hr = pConfig->SetRenderingMode(VMR9Mode_Renderless)))
+ break;
+
+ CComQIPtr<IVMRSurfaceAllocatorNotify9> pSAN = pBF;
+ if(!pSAN)
+ break;
+
+ if(FAILED(hr = pSAN->AdviseSurfaceAllocator(MY_USER_ID, static_cast<IVMRSurfaceAllocator9*>(this)))
+ || FAILED(hr = AdviseNotify(pSAN)))
+ break;
+
+ *ppRenderer = (IUnknown*)pBF.Detach();
+
+ return S_OK;
+ }
+ while(0);
+
+ return E_FAIL;
+}
+
+STDMETHODIMP_(void) CVMR9AllocatorPresenter::SetTime(REFERENCE_TIME rtNow)
+{
+ __super::SetTime(rtNow);
+ m_fUseInternalTimer = false;
+}
+
+// IVMRSurfaceAllocator9
+
+STDMETHODIMP CVMR9AllocatorPresenter::InitializeDevice(DWORD_PTR dwUserID, VMR9AllocationInfo* lpAllocInfo, DWORD* lpNumBuffers)
+{
+ if(!lpAllocInfo || !lpNumBuffers)
+ return E_POINTER;
+
+ if(!m_pIVMRSurfAllocNotify)
+ return E_FAIL;
+
+ if((GetAsyncKeyState(VK_CONTROL)&0x80000000))
+ if(lpAllocInfo->Format == '21VY' || lpAllocInfo->Format == '024I')
+ return E_FAIL;
+
+ DeleteSurfaces();
+
+ m_pSurfaces.SetCount(*lpNumBuffers);
+
+ int w = lpAllocInfo->dwWidth;
+ int h = abs((int)lpAllocInfo->dwHeight);
+
+ HRESULT hr;
+
+ if(lpAllocInfo->dwFlags & VMR9AllocFlag_3DRenderTarget)
+ lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface;
+
+ hr = m_pIVMRSurfAllocNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, &m_pSurfaces[0]);
+ if(FAILED(hr)) return hr;
+
+ m_NativeVideoSize = m_AspectRatio = CSize(w, h);
+ int arx = lpAllocInfo->szAspectRatio.cx, ary = lpAllocInfo->szAspectRatio.cy;
+ if(arx > 0 && ary > 0) m_AspectRatio.SetSize(arx, ary);
+
+ if(FAILED(hr = AllocSurfaces()))
+ return hr;
+
+ if(!(lpAllocInfo->dwFlags & VMR9AllocFlag_TextureSurface))
+ {
+ // test if the colorspace is acceptable
+ if(FAILED(hr = m_pD3DDev->StretchRect(m_pSurfaces[0], NULL, m_pVideoSurface[0], NULL, D3DTEXF_NONE)))
+ {
+ DeleteSurfaces();
+ return E_FAIL;
+ }
+ }
+
+ hr = m_pD3DDev->ColorFill(m_pVideoSurface[0], NULL, 0);
+
+ return hr;
+}
+
+STDMETHODIMP CVMR9AllocatorPresenter::TerminateDevice(DWORD_PTR dwUserID)
+{
+ DeleteSurfaces();
+ return S_OK;
+}
+
+STDMETHODIMP CVMR9AllocatorPresenter::GetSurface(DWORD_PTR dwUserID, DWORD SurfaceIndex, DWORD SurfaceFlags, IDirect3DSurface9** lplpSurface)
+{
+ if(!lplpSurface)
+ return E_POINTER;
+
+ if(SurfaceIndex >= m_pSurfaces.GetCount())
+ return E_FAIL;
+
+ CAutoLock cAutoLock(this);
+
+ (*lplpSurface = m_pSurfaces[SurfaceIndex])->AddRef();
+
+ return S_OK;
+}
+
+STDMETHODIMP CVMR9AllocatorPresenter::AdviseNotify(IVMRSurfaceAllocatorNotify9* lpIVMRSurfAllocNotify)
+{
+ CAutoLock cAutoLock(this);
+
+ m_pIVMRSurfAllocNotify = lpIVMRSurfAllocNotify;
+
+ HRESULT hr;
+ HMONITOR hMonitor = m_pD3D->GetAdapterMonitor(GetAdapter(m_pD3D));
+ if(FAILED(hr = m_pIVMRSurfAllocNotify->SetD3DDevice(m_pD3DDev, hMonitor)))
+ return hr;
+
+ return S_OK;
+}
+
+// IVMRImagePresenter9
+
+STDMETHODIMP CVMR9AllocatorPresenter::StartPresenting(DWORD_PTR dwUserID)
+{
+ CAutoLock cAutoLock(this);
+
+ ASSERT(m_pD3DDev);
+
+ return m_pD3DDev ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CVMR9AllocatorPresenter::StopPresenting(DWORD_PTR dwUserID)
+{
+ return S_OK;
+}
+
+STDMETHODIMP CVMR9AllocatorPresenter::PresentImage(DWORD_PTR dwUserID, VMR9PresentationInfo* lpPresInfo)
+{
+ CheckPointer(m_pIVMRSurfAllocNotify, E_UNEXPECTED);
+
+ HRESULT hr;
+
+ if(!lpPresInfo || !lpPresInfo->lpSurf)
+ return E_POINTER;
+
+ CAutoLock cAutoLock(this);
+
+ CComPtr<IDirect3DTexture9> pTexture;
+ lpPresInfo->lpSurf->GetContainer(IID_IDirect3DTexture9, (void**)&pTexture);
+
+ if(pTexture)
+ {
+ m_pVideoSurface[0] = lpPresInfo->lpSurf;
+ if(m_pVideoTexture[0]) m_pVideoTexture[0] = pTexture;
+ }
+ else
+ {
+ hr = m_pD3DDev->StretchRect(lpPresInfo->lpSurf, NULL, m_pVideoSurface[0], NULL, D3DTEXF_NONE);
+ }
+
+ if(lpPresInfo->rtEnd > lpPresInfo->rtStart)
+ {
+ REFERENCE_TIME rtTimePerFrame = lpPresInfo->rtEnd - lpPresInfo->rtStart;
+ m_fps = 10000000.0 / rtTimePerFrame;
+
+ if(m_pSubPicQueue)
+ {
+ m_pSubPicQueue->SetFPS(m_fps);
+
+ if(m_fUseInternalTimer)
+ {
+ __super::SetTime(g_tSegmentStart + g_tSampleStart);
+ }
+ }
+ }
+
+ CSize VideoSize = m_NativeVideoSize;
+ int arx = lpPresInfo->szAspectRatio.cx, ary = lpPresInfo->szAspectRatio.cy;
+ if(arx > 0 && ary > 0) VideoSize.cx = VideoSize.cy*arx/ary;
+ if(VideoSize != GetVideoSize())
+ {
+ m_AspectRatio.SetSize(arx, ary);
+ AfxGetApp()->m_pMainWnd->PostMessage(WM_REARRANGERENDERLESS);
+ }
+
+ // Tear test bars
+ if (AfxGetMyApp()->m_fTearingTest)
+ {
+ RECT rcTearing;
+
+ rcTearing.left = m_nTearingPos;
+ rcTearing.top = 0;
+ rcTearing.right = rcTearing.left + 4;
+ rcTearing.bottom = m_NativeVideoSize.cy;
+ m_pD3DDev->ColorFill (m_pVideoSurface[0], &rcTearing, D3DCOLOR_ARGB (255,255,0,0));
+
+ rcTearing.left = (rcTearing.right + 15) % m_NativeVideoSize.cx;
+ rcTearing.right = rcTearing.left + 4;
+ m_pD3DDev->ColorFill (m_pVideoSurface[0], &rcTearing, D3DCOLOR_ARGB (255,255,0,0));
+
+ m_nTearingPos = (m_nTearingPos + 7) % m_NativeVideoSize.cx;
+ }
+
+ Paint(true);
+
+ return S_OK;
+}
+
+// IVMRWindowlessControl9
+//
+// It is only implemented (partially) for the dvd navigator's
+// menu handling, which needs to know a few things about the
+// location of our window.
+
+STDMETHODIMP CVMR9AllocatorPresenter::GetNativeVideoSize(LONG* lpWidth, LONG* lpHeight, LONG* lpARWidth, LONG* lpARHeight)
+{
+ if(lpWidth) *lpWidth = m_NativeVideoSize.cx;
+ if(lpHeight) *lpHeight = m_NativeVideoSize.cy;
+ if(lpARWidth) *lpARWidth = m_AspectRatio.cx;
+ if(lpARHeight) *lpARHeight = m_AspectRatio.cy;
+ return S_OK;
+}
+STDMETHODIMP CVMR9AllocatorPresenter::GetMinIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;}
+STDMETHODIMP CVMR9AllocatorPresenter::GetMaxIdealVideoSize(LONG* lpWidth, LONG* lpHeight) {return E_NOTIMPL;}
+STDMETHODIMP CVMR9AllocatorPresenter::SetVideoPosition(const LPRECT lpSRCRect, const LPRECT lpDSTRect) {return E_NOTIMPL;} // we have our own method for this
+STDMETHODIMP CVMR9AllocatorPresenter::GetVideoPosition(LPRECT lpSRCRect, LPRECT lpDSTRect)
+{
+ CopyRect(lpSRCRect, CRect(CPoint(0, 0), m_NativeVideoSize));
+ CopyRect(lpDSTRect, &m_VideoRect);
+ return S_OK;
+}
+STDMETHODIMP CVMR9AllocatorPresenter::GetAspectRatioMode(DWORD* lpAspectRatioMode)
+{
+ if(lpAspectRatioMode) *lpAspectRatioMode = AM_ARMODE_STRETCHED;
+ return S_OK;
+}
+STDMETHODIMP CVMR9AllocatorPresenter::SetAspectRatioMode(DWORD AspectRatioMode) {return E_NOTIMPL;}
+STDMETHODIMP CVMR9AllocatorPresenter::SetVideoClippingWindow(HWND hwnd) {return E_NOTIMPL;}
+STDMETHODIMP CVMR9AllocatorPresenter::RepaintVideo(HWND hwnd, HDC hdc) {return E_NOTIMPL;}
+STDMETHODIMP CVMR9AllocatorPresenter::DisplayModeChanged() {return E_NOTIMPL;}
+STDMETHODIMP CVMR9AllocatorPresenter::GetCurrentImage(BYTE** lpDib) {return E_NOTIMPL;}
+STDMETHODIMP CVMR9AllocatorPresenter::SetBorderColor(COLORREF Clr) {return E_NOTIMPL;}
+STDMETHODIMP CVMR9AllocatorPresenter::GetBorderColor(COLORREF* lpClr)
+{
+ if(lpClr) *lpClr = 0;
+ return S_OK;
+}
+
+//
+// CRM9AllocatorPresenter
+//
+
+CRM9AllocatorPresenter::CRM9AllocatorPresenter(HWND hWnd, HRESULT& hr)
+ : CDX9AllocatorPresenter(hWnd, hr)
+{
+}
+
+STDMETHODIMP CRM9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI2(IRMAVideoSurface)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CRM9AllocatorPresenter::AllocSurfaces()
+{
+ CAutoLock cAutoLock(this);
+
+ m_pVideoSurfaceOff = NULL;
+ m_pVideoSurfaceYUY2 = NULL;
+
+ HRESULT hr;
+
+ if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL)))
+ return hr;
+
+ m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0);
+
+ if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_YUY2,
+ D3DPOOL_DEFAULT, &m_pVideoSurfaceYUY2, NULL)))
+ m_pVideoSurfaceYUY2 = NULL;
+
+ if(m_pVideoSurfaceYUY2)
+ {
+ m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0x80108010);
+ }
+
+ return __super::AllocSurfaces();
+}
+
+void CRM9AllocatorPresenter::DeleteSurfaces()
+{
+ CAutoLock cAutoLock(this);
+ m_pVideoSurfaceOff = NULL;
+ m_pVideoSurfaceYUY2 = NULL;
+ __super::DeleteSurfaces();
+}
+
+// IRMAVideoSurface
+
+STDMETHODIMP CRM9AllocatorPresenter::Blt(UCHAR* pImageData, RMABitmapInfoHeader* pBitmapInfo, REF(PNxRect) inDestRect, REF(PNxRect) inSrcRect)
+{
+ if(!m_pVideoSurface || !m_pVideoSurfaceOff)
+ return E_FAIL;
+
+ bool fRGB = false;
+ bool fYUY2 = false;
+
+ CRect src((RECT*)&inSrcRect), dst((RECT*)&inDestRect), src2(CPoint(0,0), src.Size());
+ if(src.Width() > dst.Width() || src.Height() > dst.Height())
+ return E_FAIL;
+
+ D3DSURFACE_DESC d3dsd;
+ ZeroMemory(&d3dsd, sizeof(d3dsd));
+ if(FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd)))
+ return E_FAIL;
+
+ int dbpp =
+ d3dsd.Format == D3DFMT_R8G8B8 || d3dsd.Format == D3DFMT_X8R8G8B8 || d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 :
+ d3dsd.Format == D3DFMT_R5G6B5 ? 16 : 0;
+
+ if(pBitmapInfo->biCompression == '024I')
+ {
+ DWORD pitch = pBitmapInfo->biWidth;
+ DWORD size = pitch*abs(pBitmapInfo->biHeight);
+
+ BYTE* y = pImageData + src.top*pitch + src.left;
+ BYTE* u = pImageData + size + src.top*(pitch/2) + src.left/2;
+ BYTE* v = pImageData + size + size/4 + src.top*(pitch/2) + src.left/2;
+
+ if(m_pVideoSurfaceYUY2)
+ {
+ D3DLOCKED_RECT r;
+ if(SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0)))
+ {
+ BitBltFromI420ToYUY2(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, y, u, v, pitch);
+ m_pVideoSurfaceYUY2->UnlockRect();
+ fYUY2 = true;
+ }
+ }
+ else
+ {
+ D3DLOCKED_RECT r;
+ if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0)))
+ {
+ BitBltFromI420ToRGB(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, dbpp, y, u, v, pitch);
+ m_pVideoSurfaceOff->UnlockRect();
+ fRGB = true;
+ }
+ }
+ }
+ else if(pBitmapInfo->biCompression == '2YUY')
+ {
+ DWORD w = pBitmapInfo->biWidth;
+ DWORD h = abs(pBitmapInfo->biHeight);
+ DWORD pitch = pBitmapInfo->biWidth*2;
+
+ BYTE* yvyu = pImageData + src.top*pitch + src.left*2;
+
+ if(m_pVideoSurfaceYUY2)
+ {
+ D3DLOCKED_RECT r;
+ if(SUCCEEDED(m_pVideoSurfaceYUY2->LockRect(&r, src2, 0)))
+ {
+ BitBltFromYUY2ToYUY2(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, yvyu, pitch);
+ m_pVideoSurfaceYUY2->UnlockRect();
+ fYUY2 = true;
+ }
+ }
+ else
+ {
+ D3DLOCKED_RECT r;
+ if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0)))
+ {
+ BitBltFromYUY2ToRGB(src.Width(), src.Height(), (BYTE*)r.pBits, r.Pitch, dbpp, yvyu, pitch);
+ m_pVideoSurfaceOff->UnlockRect();
+ fRGB = true;
+ }
+ }
+ }
+ else if(pBitmapInfo->biCompression == 0 || pBitmapInfo->biCompression == 3
+ || pBitmapInfo->biCompression == 'BGRA')
+ {
+ DWORD w = pBitmapInfo->biWidth;
+ DWORD h = abs(pBitmapInfo->biHeight);
+ DWORD pitch = pBitmapInfo->biWidth*pBitmapInfo->biBitCount>>3;
+
+ BYTE* rgb = pImageData + src.top*pitch + src.left*(pBitmapInfo->biBitCount>>3);
+
+ D3DLOCKED_RECT r;
+ if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, src2, 0)))
+ {
+ BYTE* pBits = (BYTE*)r.pBits;
+ if(pBitmapInfo->biHeight > 0) {pBits += r.Pitch*(src.Height()-1); r.Pitch = -r.Pitch;}
+ BitBltFromRGBToRGB(src.Width(), src.Height(), pBits, r.Pitch, dbpp, rgb, pitch, pBitmapInfo->biBitCount);
+ m_pVideoSurfaceOff->UnlockRect();
+ fRGB = true;
+ }
+ }
+
+ if(!fRGB && !fYUY2)
+ {
+ m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0);
+
+ HDC hDC;
+ if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC)))
+ {
+ CString str;
+ str.Format(_T("Sorry, this format is not supported"));
+
+ SetBkColor(hDC, 0);
+ SetTextColor(hDC, 0x404040);
+ TextOut(hDC, 10, 10, str, str.GetLength());
+
+ m_pVideoSurfaceOff->ReleaseDC(hDC);
+
+ fRGB = true;
+ }
+ }
+
+ HRESULT hr;
+
+ if(fRGB)
+ hr = m_pD3DDev->StretchRect(m_pVideoSurfaceOff, src2, m_pVideoSurface[0], dst, D3DTEXF_NONE);
+ if(fYUY2)
+ hr = m_pD3DDev->StretchRect(m_pVideoSurfaceYUY2, src2, m_pVideoSurface[0], dst, D3DTEXF_NONE);
+
+ Paint(true);
+
+ return PNR_OK;
+}
+
+STDMETHODIMP CRM9AllocatorPresenter::BeginOptimizedBlt(RMABitmapInfoHeader* pBitmapInfo)
+{
+ CAutoLock cAutoLock(this);
+ DeleteSurfaces();
+ m_NativeVideoSize = m_AspectRatio = CSize(pBitmapInfo->biWidth, abs(pBitmapInfo->biHeight));
+ if(FAILED(AllocSurfaces())) return E_FAIL;
+ return PNR_NOTIMPL;
+}
+
+STDMETHODIMP CRM9AllocatorPresenter::OptimizedBlt(UCHAR* pImageBits, REF(PNxRect) rDestRect, REF(PNxRect) rSrcRect)
+{
+ return PNR_NOTIMPL;
+}
+
+STDMETHODIMP CRM9AllocatorPresenter::EndOptimizedBlt()
+{
+ return PNR_NOTIMPL;
+}
+
+STDMETHODIMP CRM9AllocatorPresenter::GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) ulType)
+{
+ return PNR_NOTIMPL;
+}
+
+STDMETHODIMP CRM9AllocatorPresenter::GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) ulType)
+{
+ ulType = RMA_I420;
+ return PNR_OK;
+}
+
+//
+// CQT9AllocatorPresenter
+//
+
+CQT9AllocatorPresenter::CQT9AllocatorPresenter(HWND hWnd, HRESULT& hr)
+ : CDX9AllocatorPresenter(hWnd, hr)
+{
+}
+
+STDMETHODIMP CQT9AllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IQTVideoSurface)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CQT9AllocatorPresenter::AllocSurfaces()
+{
+ HRESULT hr;
+
+ m_pVideoSurfaceOff = NULL;
+
+ if(FAILED(hr = m_pD3DDev->CreateOffscreenPlainSurface(
+ m_NativeVideoSize.cx, m_NativeVideoSize.cy, D3DFMT_X8R8G8B8,
+ D3DPOOL_DEFAULT, &m_pVideoSurfaceOff, NULL)))
+ return hr;
+
+ return __super::AllocSurfaces();
+}
+
+void CQT9AllocatorPresenter::DeleteSurfaces()
+{
+ m_pVideoSurfaceOff = NULL;
+
+ __super::DeleteSurfaces();
+}
+
+// IQTVideoSurface
+
+STDMETHODIMP CQT9AllocatorPresenter::BeginBlt(const BITMAP& bm)
+{
+ CAutoLock cAutoLock(this);
+ DeleteSurfaces();
+ m_NativeVideoSize = m_AspectRatio = CSize(bm.bmWidth, abs(bm.bmHeight));
+ if(FAILED(AllocSurfaces())) return E_FAIL;
+ return S_OK;
+}
+
+STDMETHODIMP CQT9AllocatorPresenter::DoBlt(const BITMAP& bm)
+{
+ if(!m_pVideoSurface || !m_pVideoSurfaceOff)
+ return E_FAIL;
+
+ bool fOk = false;
+
+ D3DSURFACE_DESC d3dsd;
+ ZeroMemory(&d3dsd, sizeof(d3dsd));
+ if(FAILED(m_pVideoSurfaceOff->GetDesc(&d3dsd)))
+ return E_FAIL;
+
+ int w = bm.bmWidth;
+ int h = abs(bm.bmHeight);
+ int bpp = bm.bmBitsPixel;
+ int dbpp =
+ d3dsd.Format == D3DFMT_R8G8B8 || d3dsd.Format == D3DFMT_X8R8G8B8 || d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 :
+ d3dsd.Format == D3DFMT_R5G6B5 ? 16 : 0;
+
+ if((bpp == 16 || bpp == 24 || bpp == 32) && w == d3dsd.Width && h == d3dsd.Height)
+ {
+ D3DLOCKED_RECT r;
+ if(SUCCEEDED(m_pVideoSurfaceOff->LockRect(&r, NULL, 0)))
+ {
+ BitBltFromRGBToRGB(
+ w, h,
+ (BYTE*)r.pBits, r.Pitch, dbpp,
+ (BYTE*)bm.bmBits, bm.bmWidthBytes, bm.bmBitsPixel);
+ m_pVideoSurfaceOff->UnlockRect();
+ fOk = true;
+ }
+ }
+
+ if(!fOk)
+ {
+ m_pD3DDev->ColorFill(m_pVideoSurfaceOff, NULL, 0);
+
+ HDC hDC;
+ if(SUCCEEDED(m_pVideoSurfaceOff->GetDC(&hDC)))
+ {
+ CString str;
+ str.Format(_T("Sorry, this color format is not supported"));
+
+ SetBkColor(hDC, 0);
+ SetTextColor(hDC, 0x404040);
+ TextOut(hDC, 10, 10, str, str.GetLength());
+
+ m_pVideoSurfaceOff->ReleaseDC(hDC);
+ }
+ }
+
+ m_pD3DDev->StretchRect(m_pVideoSurfaceOff, NULL, m_pVideoSurface[0], NULL, D3DTEXF_NONE);
+
+ Paint(true);
+
+ return S_OK;
+}
+
+//
+// CDXRAllocatorPresenter
+//
+
+CDXRAllocatorPresenter::CDXRAllocatorPresenter(HWND hWnd, HRESULT& hr)
+ : ISubPicAllocatorPresenterImpl(hWnd, hr)
+{
+ if(FAILED(hr)) return;
+
+ hr = S_OK;
+}
+
+CDXRAllocatorPresenter::~CDXRAllocatorPresenter()
+{
+ if(m_pSRCB)
+ {
+ // nasty, but we have to let it know about our death somehow
+ ((CSubRenderCallback*)(ISubRenderCallback*)m_pSRCB)->SetDXRAP(NULL);
+ }
+
+ // the order is important here
+ m_pSubPicQueue = NULL;
+ m_pAllocator = NULL;
+ m_pDXR = NULL;
+}
+
+STDMETHODIMP CDXRAllocatorPresenter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+/*
+ if(riid == __uuidof(IVideoWindow))
+ return GetInterface((IVideoWindow*)this, ppv);
+ if(riid == __uuidof(IBasicVideo))
+ return GetInterface((IBasicVideo*)this, ppv);
+ if(riid == __uuidof(IBasicVideo2))
+ return GetInterface((IBasicVideo2*)this, ppv);
+*/
+/*
+ if(riid == __uuidof(IVMRWindowlessControl))
+ return GetInterface((IVMRWindowlessControl*)this, ppv);
+*/
+
+ if(riid != IID_IUnknown && m_pDXR)
+ {
+ if(SUCCEEDED(m_pDXR->QueryInterface(riid, ppv)))
+ return S_OK;
+ }
+
+ return __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CDXRAllocatorPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
+{
+ CheckPointer(pD3DDev, E_POINTER);
+
+ CSize size;
+ switch(AfxGetAppSettings().nSPCMaxRes)
+ {
+ // TODO: m_ScreenSize ?
+ // case 0: default: size = m_ScreenSize; break;
+ default:
+ case 1: size.SetSize(1024, 768); break;
+ case 2: size.SetSize(800, 600); break;
+ case 3: size.SetSize(640, 480); break;
+ case 4: size.SetSize(512, 384); break;
+ case 5: size.SetSize(384, 288); break;
+ }
+
+ if(m_pAllocator)
+ {
+ m_pAllocator->ChangeDevice(pD3DDev);
+ }
+ else
+ {
+ m_pAllocator = new CDX9SubPicAllocator(pD3DDev, size, AfxGetAppSettings().fSPCPow2Tex);
+ if(!m_pAllocator)
+ return E_FAIL;
+ }
+
+ HRESULT hr = S_OK;
+
+ m_pSubPicQueue = AfxGetAppSettings().nSPCSize > 0
+ ? (ISubPicQueue*)new CSubPicQueue(AfxGetAppSettings().nSPCSize, m_pAllocator, &hr)
+ : (ISubPicQueue*)new CSubPicQueueNoThread(m_pAllocator, &hr);
+ if(!m_pSubPicQueue || FAILED(hr))
+ return E_FAIL;
+
+ if(m_SubPicProvider) m_pSubPicQueue->SetSubPicProvider(m_SubPicProvider);
+
+ return S_OK;
+}
+
+HRESULT CDXRAllocatorPresenter::Render(
+ REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, REFERENCE_TIME atpf,
+ int left, int top, int right, int bottom, int width, int height)
+{
+ __super::SetPosition(CRect(0, 0, width, height), CRect(left, top, right, bottom)); // needed? should be already set by the player
+ SetTime(rtStart);
+ if(atpf > 0 && m_pSubPicQueue) m_pSubPicQueue->SetFPS(10000000.0 / atpf);
+ AlphaBltSubPic(CSize(width, height));
+ return S_OK;
+}
+
+// ISubPicAllocatorPresenter
+
+STDMETHODIMP CDXRAllocatorPresenter::CreateRenderer(IUnknown** ppRenderer)
+{
+ CheckPointer(ppRenderer, E_POINTER);
+
+ if(m_pDXR) return E_UNEXPECTED;
+ m_pDXR.CoCreateInstance(CLSID_DXR, GetOwner());
+ if(!m_pDXR) return E_FAIL;
+
+ CComQIPtr<ISubRender> pSR = m_pDXR;
+ if(!pSR) {m_pDXR = NULL; return E_FAIL;}
+
+ m_pSRCB = new CSubRenderCallback(this);
+ if(FAILED(pSR->SetCallback(m_pSRCB))) {m_pDXR = NULL; return E_FAIL;}
+
+ (*ppRenderer = this)->AddRef();
+
+ return S_OK;
+}
+
+STDMETHODIMP_(void) CDXRAllocatorPresenter::SetPosition(RECT w, RECT v)
+{
+ if(CComQIPtr<IBasicVideo> pBV = m_pDXR)
+ {
+ pBV->SetDefaultSourcePosition();
+ pBV->SetDestinationPosition(v.left, v.top, v.right - v.left, v.bottom - v.top);
+ }
+
+ if(CComQIPtr<IVideoWindow> pVW = m_pDXR)
+ {
+ pVW->SetWindowPosition(w.left, w.top, w.right - w.left, w.bottom - w.top);
+ }
+}
+
+STDMETHODIMP_(SIZE) CDXRAllocatorPresenter::GetVideoSize(bool fCorrectAR)
+{
+ SIZE size = {0, 0};
+
+ if(!fCorrectAR)
+ {
+ if(CComQIPtr<IBasicVideo> pBV = m_pDXR)
+ pBV->GetVideoSize(&size.cx, &size.cy);
+ }
+ else
+ {
+ if(CComQIPtr<IBasicVideo2> pBV2 = m_pDXR)
+ pBV2->GetPreferredAspectRatio(&size.cx, &size.cy);
+ }
+
+ return size;
+}
+
+STDMETHODIMP_(bool) CDXRAllocatorPresenter::Paint(bool fAll)
+{
+ return false; // TODO
+}
+
+STDMETHODIMP CDXRAllocatorPresenter::GetDIB(BYTE* lpDib, DWORD* size)
+{
+ HRESULT hr = E_NOTIMPL;
+ if(CComQIPtr<IBasicVideo> pBV = m_pDXR)
+ hr = pBV->GetCurrentImage((long*)size, (long*)lpDib);
+ return hr;
+}
+
+STDMETHODIMP CDXRAllocatorPresenter::SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget)
+{
+ return E_NOTIMPL; // TODO
+}
+
diff --git a/src/apps/mplayerc/DX9AllocatorPresenter.h b/src/apps/mplayerc/DX9AllocatorPresenter.h
new file mode 100644
index 000000000..0d6046408
--- /dev/null
+++ b/src/apps/mplayerc/DX9AllocatorPresenter.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\SubPic\ISubPic.h"
+
+// {4E4834FA-22C2-40e2-9446-F77DD05D245E}
+DEFINE_GUID(CLSID_VMR9AllocatorPresenter,
+0x4e4834fa, 0x22c2, 0x40e2, 0x94, 0x46, 0xf7, 0x7d, 0xd0, 0x5d, 0x24, 0x5e);
+
+// {A1542F93-EB53-4e11-8D34-05C57ABA9207}
+DEFINE_GUID(CLSID_RM9AllocatorPresenter,
+0xa1542f93, 0xeb53, 0x4e11, 0x8d, 0x34, 0x5, 0xc5, 0x7a, 0xba, 0x92, 0x7);
+
+// {622A4032-70CE-4040-8231-0F24F2886618}
+DEFINE_GUID(CLSID_QT9AllocatorPresenter,
+0x622a4032, 0x70ce, 0x4040, 0x82, 0x31, 0xf, 0x24, 0xf2, 0x88, 0x66, 0x18);
+
+// {B72EBDD4-831D-440f-A656-B48F5486CD82}
+DEFINE_GUID(CLSID_DXRAllocatorPresenter,
+0xb72ebdd4, 0x831d, 0x440f, 0xa6, 0x56, 0xb4, 0x8f, 0x54, 0x86, 0xcd, 0x82);
+
+extern HRESULT CreateAP9(const CLSID& clsid, HWND hWnd, ISubPicAllocatorPresenter** ppAP);
+
+extern bool IsVMR9InGraph(IFilterGraph* pFG);
diff --git a/src/apps/mplayerc/Debug Unicode/d3dx9_28.dll b/src/apps/mplayerc/Debug Unicode/d3dx9_28.dll
new file mode 100644
index 000000000..fde5bd447
--- /dev/null
+++ b/src/apps/mplayerc/Debug Unicode/d3dx9_28.dll
Binary files differ
diff --git a/src/apps/mplayerc/DeinterlacerFilter.cpp b/src/apps/mplayerc/DeinterlacerFilter.cpp
new file mode 100644
index 000000000..972b071aa
--- /dev/null
+++ b/src/apps/mplayerc/DeinterlacerFilter.cpp
@@ -0,0 +1,123 @@
+#include "stdafx.h"
+#include ".\deinterlacerfilter.h"
+#include "..\..\DSUtil\MediaTypes.h"
+#include "..\..\..\include\moreuuids.h"
+
+CDeinterlacerFilter::CDeinterlacerFilter(LPUNKNOWN punk, HRESULT* phr)
+ : CTransformFilter(NAME("CDeinterlacerFilter"), punk, __uuidof(CDeinterlacerFilter))
+{
+ if(phr) *phr = S_OK;
+}
+
+HRESULT CDeinterlacerFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
+{
+ return GetCLSID(pPin) == __uuidof(*this) ? E_FAIL : S_OK;
+}
+
+HRESULT CDeinterlacerFilter::CheckInputType(const CMediaType* mtIn)
+{
+ BITMAPINFOHEADER bih;
+ if(!ExtractBIH(mtIn, &bih) /*|| bih.biHeight <= 0*/ || bih.biHeight <= 288)
+ return E_FAIL;
+
+ return mtIn->subtype == MEDIASUBTYPE_YUY2 || mtIn->subtype == MEDIASUBTYPE_UYVY
+ || mtIn->subtype == MEDIASUBTYPE_I420 || mtIn->subtype == MEDIASUBTYPE_YV12 || mtIn->subtype == MEDIASUBTYPE_IYUV
+ ? S_OK
+ : E_FAIL;
+}
+
+HRESULT CDeinterlacerFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return mtIn->subtype == mtOut->subtype ? S_OK : E_FAIL;
+}
+
+HRESULT CDeinterlacerFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
+{
+ HRESULT hr;
+
+ AM_MEDIA_TYPE* pmt = NULL;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt = *pmt;
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(pIn->GetPointer(&pDataIn)) || !pDataIn)
+ return S_FALSE;
+
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut)) || !pDataOut)
+ return hr;
+
+ const CMediaType& mtIn = m_pInput->CurrentMediaType();
+ const CMediaType& mtOut = m_pOutput->CurrentMediaType();
+
+ BITMAPINFOHEADER bihIn, bihOut;
+ ExtractBIH(&mtIn, &bihIn);
+ ExtractBIH(&mtOut, &bihOut);
+
+ bool fInputFlipped = bihIn.biHeight >= 0 && bihIn.biCompression <= 3;
+ bool fOutputFlipped = bihOut.biHeight >= 0 && bihOut.biCompression <= 3;
+ bool fFlip = fInputFlipped != fOutputFlipped;
+
+ int bppIn = !(bihIn.biBitCount&7) ? bihIn.biBitCount : 8;
+ int bppOut = !(bihOut.biBitCount&7) ? bihOut.biBitCount : 8;
+ int pitchIn = bihIn.biWidth*bppIn>>3;
+ int pitchOut = bihOut.biWidth*bppOut>>3;
+ BYTE* pDataOut2 = pDataOut;
+ if(fFlip) {pDataOut2 += pitchOut*(bihIn.biHeight-1); pitchOut = -pitchOut;}
+
+ if(mtIn.subtype == MEDIASUBTYPE_YUY2 || mtIn.subtype == MEDIASUBTYPE_UYVY)
+ {
+ DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn);
+ }
+ else if(mtIn.subtype == MEDIASUBTYPE_I420 || mtIn.subtype == MEDIASUBTYPE_YV12 || mtIn.subtype == MEDIASUBTYPE_IYUV)
+ {
+ DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn);
+
+ int sizeIn = bihIn.biHeight*pitchIn, sizeOut = abs(bihOut.biHeight)*pitchOut;
+ pitchIn /= 2; pitchOut /= 2;
+ bihIn.biHeight /= 2;
+ pDataIn += sizeIn; pDataOut += sizeOut;
+ DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn);
+
+ pDataIn += sizeIn/4; pDataOut += sizeOut/4;
+ DeinterlaceBlend(pDataOut, pDataIn, pitchIn, bihIn.biHeight, pitchOut, pitchIn);
+ }
+
+ return S_OK;
+}
+
+HRESULT CDeinterlacerFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = bih.biSizeImage;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR;
+}
+
+HRESULT CDeinterlacerFilter::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+ *pmt = m_pInput->CurrentMediaType();
+ CorrectMediaType(pmt);
+ return S_OK;
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/DeinterlacerFilter.h b/src/apps/mplayerc/DeinterlacerFilter.h
new file mode 100644
index 000000000..d1c441ec6
--- /dev/null
+++ b/src/apps/mplayerc/DeinterlacerFilter.h
@@ -0,0 +1,16 @@
+#pragma once
+
+[uuid("96F3E0BE-1BA4-4E79-973D-191FE425C86B")]
+class CDeinterlacerFilter : public CTransformFilter
+{
+protected:
+ HRESULT CDeinterlacerFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
+public:
+ CDeinterlacerFilter(LPUNKNOWN punk, HRESULT* phr);
+};
diff --git a/src/apps/mplayerc/FGFilter.cpp b/src/apps/mplayerc/FGFilter.cpp
new file mode 100644
index 000000000..9e4ecff77
--- /dev/null
+++ b/src/apps/mplayerc/FGFilter.cpp
@@ -0,0 +1,592 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "FGFilter.h"
+#include "..\..\DSUtil\DSUtil.h"
+#include "DX7AllocatorPresenter.h"
+#include "DX9AllocatorPresenter.h"
+
+//
+// CFGFilter
+//
+
+CFGFilter::CFGFilter(const CLSID& clsid, CStringW name, UINT64 merit)
+ : m_clsid(clsid)
+ , m_name(name)
+{
+ m_merit.val = merit;
+}
+
+const CAtlList<GUID>& CFGFilter::GetTypes() const
+{
+ return m_types;
+}
+
+void CFGFilter::SetTypes(const CAtlList<GUID>& types)
+{
+ m_types.RemoveAll();
+ m_types.AddTailList(&types);
+}
+
+void CFGFilter::AddType(const GUID& majortype, const GUID& subtype)
+{
+ m_types.AddTail(majortype);
+ m_types.AddTail(subtype);
+}
+
+bool CFGFilter::CheckTypes(const CAtlArray<GUID>& types, bool fExactMatch)
+{
+ POSITION pos = m_types.GetHeadPosition();
+ while(pos)
+ {
+ const GUID& majortype = m_types.GetNext(pos);
+ if(!pos) {ASSERT(0); break;}
+ const GUID& subtype = m_types.GetNext(pos);
+
+ for(int i = 0, len = types.GetCount() & ~1; i < len; i += 2)
+ {
+ if(fExactMatch)
+ {
+ if(majortype == types[i] && majortype != GUID_NULL
+ && subtype == types[i+1] && subtype != GUID_NULL)
+ return true;
+ }
+ else
+ {
+ if((majortype == GUID_NULL || types[i] == GUID_NULL || majortype == types[i])
+ && (subtype == GUID_NULL || types[i+1] == GUID_NULL || subtype == types[i+1]))
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+//
+// CFGFilterRegistry
+//
+
+CFGFilterRegistry::CFGFilterRegistry(IMoniker* pMoniker, UINT64 merit)
+ : CFGFilter(GUID_NULL, L"", merit)
+ , m_pMoniker(pMoniker)
+{
+ if(!m_pMoniker) return;
+
+ LPOLESTR str = NULL;
+ if(FAILED(m_pMoniker->GetDisplayName(0, 0, &str))) return;
+ m_DisplayName = m_name = str;
+ CoTaskMemFree(str), str = NULL;
+
+ CComPtr<IPropertyBag> pPB;
+ if(SUCCEEDED(m_pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
+ {
+ CComVariant var;
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ {
+ m_name = var.bstrVal;
+ var.Clear();
+ }
+
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("CLSID")), &var, NULL)))
+ {
+ CLSIDFromString(var.bstrVal, &m_clsid);
+ var.Clear();
+ }
+
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
+ {
+ BSTR* pstr;
+ if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pstr)))
+ {
+ ExtractFilterData((BYTE*)pstr, var.parray->cbElements*(var.parray->rgsabound[0].cElements));
+ SafeArrayUnaccessData(var.parray);
+ }
+
+ var.Clear();
+ }
+ }
+
+ if(merit != MERIT64_DO_USE) m_merit.val = merit;
+}
+
+CFGFilterRegistry::CFGFilterRegistry(CStringW DisplayName, UINT64 merit)
+ : CFGFilter(GUID_NULL, L"", merit)
+ , m_DisplayName(DisplayName)
+{
+ if(m_DisplayName.IsEmpty()) return;
+
+ CComPtr<IBindCtx> pBC;
+ CreateBindCtx(0, &pBC);
+
+ ULONG chEaten;
+ if(S_OK != MkParseDisplayName(pBC, CComBSTR(m_DisplayName), &chEaten, &m_pMoniker))
+ return;
+
+ CComPtr<IPropertyBag> pPB;
+ if(SUCCEEDED(m_pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
+ {
+ CComVariant var;
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ {
+ m_name = var.bstrVal;
+ var.Clear();
+ }
+
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("CLSID")), &var, NULL)))
+ {
+ CLSIDFromString(var.bstrVal, &m_clsid);
+ var.Clear();
+ }
+
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
+ {
+ BSTR* pstr;
+ if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pstr)))
+ {
+ ExtractFilterData((BYTE*)pstr, var.parray->cbElements*(var.parray->rgsabound[0].cElements));
+ SafeArrayUnaccessData(var.parray);
+ }
+
+ var.Clear();
+ }
+ }
+
+ if(merit != MERIT64_DO_USE) m_merit.val = merit;
+}
+
+CFGFilterRegistry::CFGFilterRegistry(const CLSID& clsid, UINT64 merit)
+ : CFGFilter(clsid, L"", merit)
+{
+ if(m_clsid == GUID_NULL) return;
+
+ CString guid = CStringFromGUID(m_clsid);
+
+ CRegKey key;
+
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\") + guid, KEY_READ))
+ {
+ ULONG nChars = 0;
+ if(ERROR_SUCCESS == key.QueryStringValue(NULL, NULL, &nChars))
+ {
+ CString name;
+ if(ERROR_SUCCESS == key.QueryStringValue(NULL, name.GetBuffer(nChars), &nChars))
+ {
+ name.ReleaseBuffer(nChars);
+ m_name = name;
+ }
+ }
+
+ key.Close();
+ }
+
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\") + guid, KEY_READ))
+ {
+ ULONG nChars = 0;
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("FriendlyName"), NULL, &nChars))
+ {
+ CString name;
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("FriendlyName"), name.GetBuffer(nChars), &nChars))
+ {
+ name.ReleaseBuffer(nChars);
+ m_name = name;
+ }
+ }
+
+ ULONG nBytes = 0;
+ if(ERROR_SUCCESS == key.QueryBinaryValue(_T("FilterData"), NULL, &nBytes))
+ {
+ CAutoVectorPtr<BYTE> buff;
+ if(buff.Allocate(nBytes) && ERROR_SUCCESS == key.QueryBinaryValue(_T("FilterData"), buff, &nBytes))
+ {
+ ExtractFilterData(buff, nBytes);
+ }
+ }
+
+ key.Close();
+ }
+
+ if(merit != MERIT64_DO_USE) m_merit.val = merit;
+}
+
+HRESULT CFGFilterRegistry::Create(IBaseFilter** ppBF, IUnknown** ppUnk)
+{
+ CheckPointer(ppBF, E_POINTER);
+
+ if(ppUnk) *ppUnk = NULL;
+
+ HRESULT hr = E_FAIL;
+
+ if(m_pMoniker)
+ {
+ if(SUCCEEDED(hr = m_pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)ppBF)))
+ {
+ m_clsid = ::GetCLSID(*ppBF);
+ }
+ }
+ else if(m_clsid != GUID_NULL)
+ {
+ CComPtr<IBaseFilter> pBF;
+ if(FAILED(pBF.CoCreateInstance(m_clsid))) return E_FAIL;
+ *ppBF = pBF.Detach();
+ hr = S_OK;
+ }
+
+ return hr;
+};
+
+[uuid("97f7c4d4-547b-4a5f-8332-536430ad2e4d")]
+interface IAMFilterData : public IUnknown
+{
+ STDMETHOD (ParseFilterData) (BYTE* rgbFilterData, ULONG cb, BYTE** prgbRegFilter2) PURE;
+ STDMETHOD (CreateFilterData) (REGFILTER2* prf2, BYTE** prgbFilterData, ULONG* pcb) PURE;
+};
+
+void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len)
+{
+ CComPtr<IAMFilterData> pFD;
+ BYTE* ptr = NULL;
+
+ if(SUCCEEDED(pFD.CoCreateInstance(CLSID_FilterMapper2))
+ && SUCCEEDED(pFD->ParseFilterData(p, len, (BYTE**)&ptr)))
+ {
+ REGFILTER2* prf = (REGFILTER2*)*(DWORD*)ptr; // this is f*cked up
+
+ m_merit.mid = prf->dwMerit;
+
+ if(prf->dwVersion == 1)
+ {
+ for(UINT i = 0; i < prf->cPins; i++)
+ {
+ if(prf->rgPins[i].bOutput)
+ continue;
+
+ for(UINT j = 0; j < prf->rgPins[i].nMediaTypes; j++)
+ {
+ if(!prf->rgPins[i].lpMediaType[j].clsMajorType || !prf->rgPins[i].lpMediaType[j].clsMinorType)
+ break;
+
+ const REGPINTYPES& rpt = prf->rgPins[i].lpMediaType[j];
+ AddType(*rpt.clsMajorType, *rpt.clsMinorType);
+ }
+ }
+ }
+ else if(prf->dwVersion == 2)
+ {
+ for(UINT i = 0; i < prf->cPins2; i++)
+ {
+ if(prf->rgPins2[i].dwFlags&REG_PINFLAG_B_OUTPUT)
+ continue;
+
+ for(UINT j = 0; j < prf->rgPins2[i].nMediaTypes; j++)
+ {
+ if(!prf->rgPins2[i].lpMediaType[j].clsMajorType || !prf->rgPins2[i].lpMediaType[j].clsMinorType)
+ break;
+
+ const REGPINTYPES& rpt = prf->rgPins2[i].lpMediaType[j];
+ AddType(*rpt.clsMajorType, *rpt.clsMinorType);
+ }
+ }
+ }
+
+ CoTaskMemFree(prf);
+ }
+ else
+ {
+ BYTE* base = p;
+
+ #define ChkLen(size) if(p - base + size > (int)len) return;
+
+ ChkLen(4)
+ if(*(DWORD*)p != 0x00000002) return; // only version 2 supported, no samples found for 1
+ p += 4;
+
+ ChkLen(4)
+ m_merit.mid = *(DWORD*)p; p += 4;
+
+ m_types.RemoveAll();
+
+ ChkLen(8)
+ DWORD nPins = *(DWORD*)p; p += 8;
+ while(nPins-- > 0)
+ {
+ ChkLen(1)
+ BYTE n = *p-0x30; p++;
+
+ ChkLen(2)
+ WORD pi = *(WORD*)p; p += 2;
+ ASSERT(pi == 'ip');
+
+ ChkLen(1)
+ BYTE x33 = *p; p++;
+ ASSERT(x33 == 0x33);
+
+ ChkLen(8)
+ bool fOutput = !!(*p&REG_PINFLAG_B_OUTPUT);
+ p += 8;
+
+ ChkLen(12)
+ DWORD nTypes = *(DWORD*)p; p += 12;
+ while(nTypes-- > 0)
+ {
+ ChkLen(1)
+ BYTE n = *p-0x30; p++;
+
+ ChkLen(2)
+ WORD ty = *(WORD*)p; p += 2;
+ ASSERT(ty == 'yt');
+
+ ChkLen(5)
+ BYTE x33 = *p; p++;
+ ASSERT(x33 == 0x33);
+ p += 4;
+
+ ChkLen(8)
+ if(*(DWORD*)p < (p-base+8) || *(DWORD*)p >= len
+ || *(DWORD*)(p+4) < (p-base+8) || *(DWORD*)(p+4) >= len)
+ {
+ p += 8;
+ continue;
+ }
+
+ GUID majortype, subtype;
+ memcpy(&majortype, &base[*(DWORD*)p], sizeof(GUID)); p += 4;
+ if(!fOutput) AddType(majortype, subtype);
+ }
+ }
+
+ #undef ChkLen
+ }
+}
+
+//
+// CFGFilterFile
+//
+
+CFGFilterFile::CFGFilterFile(const CLSID& clsid, CString path, CStringW name, UINT64 merit)
+ : CFGFilter(clsid, name, merit)
+ , m_path(path)
+ , m_hInst(NULL)
+{
+}
+
+HRESULT CFGFilterFile::Create(IBaseFilter** ppBF, IUnknown** ppUnk)
+{
+ CheckPointer(ppBF, E_POINTER);
+
+ if(ppUnk) *ppUnk = NULL;
+
+ return LoadExternalFilter(m_path, m_clsid, ppBF);
+}
+
+//
+// CFGFilterVideoRenderer
+//
+
+CFGFilterVideoRenderer::CFGFilterVideoRenderer(HWND hWnd, const CLSID& clsid, CStringW name, UINT64 merit)
+ : CFGFilter(clsid, name, merit)
+ , m_hWnd(hWnd)
+{
+ AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
+}
+
+HRESULT CFGFilterVideoRenderer::Create(IBaseFilter** ppBF, IUnknown** ppUnk)
+{
+ CheckPointer(ppBF, E_POINTER);
+
+ HRESULT hr = S_OK;
+
+ CComPtr<ISubPicAllocatorPresenter> pCAP;
+
+ if(m_clsid == CLSID_VMR7AllocatorPresenter
+ || m_clsid == CLSID_VMR9AllocatorPresenter
+ || m_clsid == CLSID_DXRAllocatorPresenter)
+ {
+ if(SUCCEEDED(CreateAP7(m_clsid, m_hWnd, &pCAP))
+ || SUCCEEDED(CreateAP9(m_clsid, m_hWnd, &pCAP)))
+ {
+ CComPtr<IUnknown> pRenderer;
+ if(SUCCEEDED(hr = pCAP->CreateRenderer(&pRenderer)))
+ {
+ *ppBF = CComQIPtr<IBaseFilter>(pRenderer).Detach();
+ if(ppUnk) *ppUnk = (IUnknown*)pCAP.Detach();
+ }
+ }
+ }
+ else
+ {
+ CComPtr<IBaseFilter> pBF;
+ if(SUCCEEDED(pBF.CoCreateInstance(m_clsid)))
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(CComQIPtr<IMixerPinConfig, &IID_IMixerPinConfig> pMPC = pPin)
+ {
+ if(ppUnk) *ppUnk = pMPC.Detach();
+ break;
+ }
+ }
+ EndEnumPins
+
+ *ppBF = pBF.Detach();
+ }
+ }
+
+ if(!*ppBF) hr = E_FAIL;
+
+ return hr;
+}
+
+//
+// CFGFilterList
+//
+
+CFGFilterList::CFGFilterList()
+{
+}
+
+CFGFilterList::~CFGFilterList()
+{
+ RemoveAll();
+}
+
+void CFGFilterList::RemoveAll()
+{
+ while(!m_filters.IsEmpty())
+ {
+ const filter_t& f = m_filters.RemoveHead();
+ if(f.autodelete) delete f.pFGF;
+ }
+
+ m_sortedfilters.RemoveAll();
+}
+
+void CFGFilterList::Insert(CFGFilter* pFGF, int group, bool exactmatch, bool autodelete)
+{
+ if(CFGFilterRegistry* f1r = dynamic_cast<CFGFilterRegistry*>(pFGF))
+ {
+ POSITION pos = m_filters.GetHeadPosition();
+ while(pos)
+ {
+ filter_t& f2 = m_filters.GetNext(pos);
+
+ if(group != f2.group) continue;
+
+ if(CFGFilterRegistry* f2r = dynamic_cast<CFGFilterRegistry*>(f2.pFGF))
+ {
+ if(f1r->GetMoniker() && f2r->GetMoniker() && S_OK == f1r->GetMoniker()->IsEqual(f2r->GetMoniker())
+ || f1r->GetCLSID() != GUID_NULL && f1r->GetCLSID() == f2r->GetCLSID())
+ {
+ TRACE(_T("FGM: Inserting %d %d %016I64x '%s' NOT!\n"),
+ group, exactmatch, pFGF->GetMerit(),
+ pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName()));
+
+ if(autodelete) delete pFGF;
+ return;
+ }
+ }
+ }
+ }
+
+ POSITION pos = m_filters.GetHeadPosition();
+ while(pos)
+ {
+ if(m_filters.GetNext(pos).pFGF == pFGF)
+ {
+ TRACE(_T("FGM: Inserting %d %d %016I64x '%s' DUP!\n"),
+ group, exactmatch, pFGF->GetMerit(),
+ pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName()));
+
+ if(autodelete) delete pFGF;
+ return;
+ }
+ }
+
+ TRACE(_T("FGM: Inserting %d %d %016I64x '%s'\n"),
+ group, exactmatch, pFGF->GetMerit(),
+ pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName()));
+
+ filter_t f = {m_filters.GetCount(), pFGF, group, exactmatch, autodelete};
+ m_filters.AddTail(f);
+
+ m_sortedfilters.RemoveAll();
+}
+
+POSITION CFGFilterList::GetHeadPosition()
+{
+ if(m_sortedfilters.IsEmpty())
+ {
+ CAtlArray<filter_t> sort;
+ sort.SetCount(m_filters.GetCount());
+ POSITION pos = m_filters.GetHeadPosition();
+ for(int i = 0; pos; i++) sort[i] = m_filters.GetNext(pos);
+ qsort(&sort[0], sort.GetCount(), sizeof(sort[0]), filter_cmp);
+ for(size_t i = 0; i < sort.GetCount(); i++)
+ if(sort[i].pFGF->GetMerit() >= MERIT64_DO_USE)
+ m_sortedfilters.AddTail(sort[i].pFGF);
+ }
+
+ TRACE(_T("FGM: Sorting filters\n"));
+
+ POSITION pos = m_sortedfilters.GetHeadPosition();
+ while(pos)
+ {
+ CFGFilter* pFGF = m_sortedfilters.GetNext(pos);
+ TRACE(_T("FGM: - %016I64x '%s'\n"), pFGF->GetMerit(), pFGF->GetName().IsEmpty() ? CStringFromGUID(pFGF->GetCLSID()) : CString(pFGF->GetName()));
+ }
+
+ return m_sortedfilters.GetHeadPosition();
+}
+
+CFGFilter* CFGFilterList::GetNext(POSITION& pos)
+{
+ return m_sortedfilters.GetNext(pos);
+}
+
+int CFGFilterList::filter_cmp(const void* a, const void* b)
+{
+ filter_t* fa = (filter_t*)a;
+ filter_t* fb = (filter_t*)b;
+
+ if(fa->group < fb->group) return -1;
+ if(fa->group > fb->group) return +1;
+
+ if(fa->pFGF->GetCLSID() == fb->pFGF->GetCLSID())
+ {
+ CFGFilterFile* fgfa = dynamic_cast<CFGFilterFile*>(fa->pFGF);
+ CFGFilterFile* fgfb = dynamic_cast<CFGFilterFile*>(fb->pFGF);
+
+ if(fgfa && !fgfb) return -1;
+ if(!fgfa && fgfb) return +1;
+ }
+
+ if(fa->pFGF->GetMerit() > fb->pFGF->GetMerit()) return -1;
+ if(fa->pFGF->GetMerit() < fb->pFGF->GetMerit()) return +1;
+
+ if(fa->exactmatch && !fb->exactmatch) return -1;
+ if(!fa->exactmatch && fb->exactmatch) return +1;
+
+ if(fa->index < fb->index) return -1;
+ if(fa->index > fb->index) return +1;
+
+ return 0;
+}
diff --git a/src/apps/mplayerc/FGFilter.h b/src/apps/mplayerc/FGFilter.h
new file mode 100644
index 000000000..cae81c000
--- /dev/null
+++ b/src/apps/mplayerc/FGFilter.h
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#define MERIT64(merit) (((UINT64)(merit))<<16)
+#define MERIT64_DO_NOT_USE MERIT64(MERIT_DO_NOT_USE)
+#define MERIT64_DO_USE MERIT64(MERIT_DO_NOT_USE+1)
+#define MERIT64_UNLIKELY (MERIT64(MERIT_UNLIKELY))
+#define MERIT64_NORMAL (MERIT64(MERIT_NORMAL))
+#define MERIT64_PREFERRED (MERIT64(MERIT_PREFERRED))
+#define MERIT64_ABOVE_DSHOW (MERIT64(1)<<32)
+
+class CFGFilter
+{
+protected:
+ CLSID m_clsid;
+ CStringW m_name;
+ struct {union {UINT64 val; struct {UINT64 low:16, mid:32, high:16;};};} m_merit;
+ CAtlList<GUID> m_types;
+
+public:
+ CFGFilter(const CLSID& clsid, CStringW name = L"", UINT64 merit = MERIT64_DO_USE);
+ virtual ~CFGFilter() {}
+
+ CLSID GetCLSID() {return m_clsid;}
+ CStringW GetName() {return m_name;}
+ UINT64 GetMerit() {return m_merit.val;}
+ DWORD GetMeritForDirectShow() {return m_merit.mid;}
+ const CAtlList<GUID>& GetTypes() const;
+ void SetTypes(const CAtlList<GUID>& types);
+ void AddType(const GUID& majortype, const GUID& subtype);
+ bool CheckTypes(const CAtlArray<GUID>& types, bool fExactMatch);
+
+ CAtlList<CString> m_protocols, m_extensions, m_chkbytes; // TODO: subtype?
+
+ virtual HRESULT Create(IBaseFilter** ppBF, IUnknown** ppUnk) = 0;
+};
+
+class CFGFilterRegistry : public CFGFilter
+{
+protected:
+ CStringW m_DisplayName;
+ CComPtr<IMoniker> m_pMoniker;
+
+ void ExtractFilterData(BYTE* p, UINT len);
+
+public:
+ CFGFilterRegistry(IMoniker* pMoniker, UINT64 merit = MERIT64_DO_USE);
+ CFGFilterRegistry(CStringW DisplayName, UINT64 merit = MERIT64_DO_USE);
+ CFGFilterRegistry(const CLSID& clsid, UINT64 merit = MERIT64_DO_USE);
+
+ CStringW GetDisplayName() {return m_DisplayName;}
+ IMoniker* GetMoniker() {return m_pMoniker;}
+
+ HRESULT Create(IBaseFilter** ppBF, IUnknown** ppUnk);
+};
+
+template<class T>
+class CFGFilterInternal : public CFGFilter
+{
+public:
+ CFGFilterInternal(CStringW name = L"", UINT64 merit = MERIT64_DO_USE) : CFGFilter(__uuidof(T), name, merit) {}
+
+ HRESULT Create(IBaseFilter** ppBF, IUnknown** ppUnk)
+ {
+ CheckPointer(ppBF, E_POINTER);
+
+ if(ppUnk) *ppUnk = NULL;
+
+ HRESULT hr = S_OK;
+ CComPtr<IBaseFilter> pBF = new T(NULL, &hr);
+ if(FAILED(hr)) return hr;
+
+ *ppBF = pBF.Detach();
+
+ return hr;
+ }
+};
+
+class CFGFilterFile : public CFGFilter
+{
+protected:
+ CString m_path;
+ HINSTANCE m_hInst;
+
+public:
+ CFGFilterFile(const CLSID& clsid, CString path, CStringW name = L"", UINT64 merit = MERIT64_DO_USE);
+
+ HRESULT Create(IBaseFilter** ppBF, IUnknown** ppUnk);
+};
+
+class CFGFilterVideoRenderer : public CFGFilter
+{
+protected:
+ HWND m_hWnd;
+
+public:
+ CFGFilterVideoRenderer(HWND hWnd, const CLSID& clsid, CStringW name = L"", UINT64 merit = MERIT64_DO_USE);
+
+ HRESULT Create(IBaseFilter** ppBF, IUnknown** ppUnk);
+};
+
+class CFGFilterList
+{
+ struct filter_t {int index; CFGFilter* pFGF; int group; bool exactmatch, autodelete;};
+ static int filter_cmp(const void* a, const void* b);
+ CAtlList<filter_t> m_filters;
+ CAtlList<CFGFilter*> m_sortedfilters;
+
+public:
+ CFGFilterList();
+ virtual ~CFGFilterList();
+
+ void RemoveAll();
+ void Insert(CFGFilter* pFGF, int group, bool exactmatch = false, bool autodelete = true);
+
+ POSITION GetHeadPosition();
+ CFGFilter* GetNext(POSITION& pos);
+};
diff --git a/src/apps/mplayerc/FGManager.cpp b/src/apps/mplayerc/FGManager.cpp
new file mode 100644
index 000000000..aa8697dc4
--- /dev/null
+++ b/src/apps/mplayerc/FGManager.cpp
@@ -0,0 +1,1840 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "FGManager.h"
+#include "..\..\DSUtil\DSUtil.h"
+#include "..\..\Filters\Filters.h"
+#include "DX7AllocatorPresenter.h"
+#include "DX9AllocatorPresenter.h"
+#include "DeinterlacerFilter.h"
+#include <initguid.h>
+#include "..\..\..\include\moreuuids.h"
+#include <dmodshow.h>
+#include <D3d9.h>
+#include <Vmr9.h>
+
+//
+// CFGManager
+//
+
+CFGManager::CFGManager(LPCTSTR pName, LPUNKNOWN pUnk)
+ : CUnknown(pName, pUnk)
+ , m_dwRegister(0)
+{
+ m_pUnkInner.CoCreateInstance(CLSID_FilterGraph, GetOwner());
+ m_pFM.CoCreateInstance(CLSID_FilterMapper2);
+}
+
+CFGManager::~CFGManager()
+{
+ CAutoLock cAutoLock(this);
+ while(!m_source.IsEmpty()) delete m_source.RemoveHead();
+ while(!m_transform.IsEmpty()) delete m_transform.RemoveHead();
+ while(!m_override.IsEmpty()) delete m_override.RemoveHead();
+ m_pUnks.RemoveAll();
+ m_pUnkInner.Release();
+}
+
+STDMETHODIMP CFGManager::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IFilterGraph)
+ QI(IGraphBuilder)
+ QI(IFilterGraph2)
+ QI(IGraphBuilder2)
+ QI(IGraphBuilderDeadEnd)
+ m_pUnkInner && (riid != IID_IUnknown && SUCCEEDED(m_pUnkInner->QueryInterface(riid, ppv))) ? S_OK :
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+//
+
+void CFGManager::CStreamPath::Append(IBaseFilter* pBF, IPin* pPin)
+{
+ path_t p;
+ p.clsid = GetCLSID(pBF);
+ p.filter = GetFilterName(pBF);
+ p.pin = GetPinName(pPin);
+ AddTail(p);
+}
+
+bool CFGManager::CStreamPath::Compare(const CStreamPath& path)
+{
+ POSITION pos1 = GetHeadPosition();
+ POSITION pos2 = path.GetHeadPosition();
+
+ while(pos1 && pos2)
+ {
+ const path_t& p1 = GetNext(pos1);
+ const path_t& p2 = path.GetNext(pos2);
+
+ if(p1.filter != p2.filter) return true;
+ else if(p1.pin != p2.pin) return false;
+ }
+
+ return true;
+}
+
+//
+
+bool CFGManager::CheckBytes(HANDLE hFile, CString chkbytes)
+{
+ CAtlList<CString> sl;
+ Explode(chkbytes, sl, ',');
+
+ if(sl.GetCount() < 4)
+ return false;
+
+ ASSERT(!(sl.GetCount()&3));
+
+ LARGE_INTEGER size = {0, 0};
+ size.LowPart = GetFileSize(hFile, (DWORD*)&size.HighPart);
+
+ POSITION pos = sl.GetHeadPosition();
+ while(sl.GetCount() >= 4)
+ {
+ CString offsetstr = sl.RemoveHead();
+ CString cbstr = sl.RemoveHead();
+ CString maskstr = sl.RemoveHead();
+ CString valstr = sl.RemoveHead();
+
+ long cb = _ttol(cbstr);
+
+ if(offsetstr.IsEmpty() || cbstr.IsEmpty()
+ || valstr.IsEmpty() || (valstr.GetLength() & 1)
+ || cb*2 != valstr.GetLength())
+ return false;
+
+ LARGE_INTEGER offset;
+ offset.QuadPart = _ttoi64(offsetstr);
+ if(offset.QuadPart < 0) offset.QuadPart = size.QuadPart - offset.QuadPart;
+ SetFilePointer(hFile, offset.LowPart, &offset.HighPart, FILE_BEGIN);
+
+ // LAME
+ while(maskstr.GetLength() < valstr.GetLength())
+ maskstr += 'F';
+
+ CAtlArray<BYTE> mask, val;
+ CStringToBin(maskstr, mask);
+ CStringToBin(valstr, val);
+
+ for(size_t i = 0; i < val.GetCount(); i++)
+ {
+ BYTE b;
+ DWORD r;
+ if(!ReadFile(hFile, &b, 1, &r, NULL) || (b & mask[i]) != val[i])
+ return false;
+ }
+ }
+
+ return sl.IsEmpty();
+}
+
+HRESULT CFGManager::AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppBF)
+{
+ TRACE(_T("FGM: AddSourceFilter trying '%s'\n"), CStringFromGUID(pFGF->GetCLSID()));
+
+ CheckPointer(lpcwstrFileName, E_POINTER);
+ CheckPointer(ppBF, E_POINTER);
+
+ ASSERT(*ppBF == NULL);
+
+ HRESULT hr;
+
+ CComPtr<IBaseFilter> pBF;
+ CComPtr<IUnknown> pUnk;
+ if(FAILED(hr = pFGF->Create(&pBF, &pUnk)))
+ return hr;
+
+ CComQIPtr<IFileSourceFilter> pFSF = pBF;
+ if(!pFSF) return E_NOINTERFACE;
+
+ if(FAILED(hr = AddFilter(pBF, lpcwstrFilterName)))
+ return hr;
+
+ const AM_MEDIA_TYPE* pmt = NULL;
+
+ CMediaType mt;
+ const CAtlList<GUID>& types = pFGF->GetTypes();
+ if(types.GetCount() == 2 && (types.GetHead() != GUID_NULL || types.GetTail() != GUID_NULL))
+ {
+ mt.majortype = types.GetHead();
+ mt.subtype = types.GetTail();
+ pmt = &mt;
+ }
+
+ if(FAILED(hr = pFSF->Load(lpcwstrFileName, pmt)))
+ {
+ RemoveFilter(pBF);
+ return hr;
+ }
+
+ *ppBF = pBF.Detach();
+
+ if(pUnk) m_pUnks.AddTail(pUnk);
+
+ return S_OK;
+}
+
+// IFilterGraph
+
+STDMETHODIMP CFGManager::AddFilter(IBaseFilter* pFilter, LPCWSTR pName)
+{
+ CAutoLock cAutoLock(this);
+
+ HRESULT hr;
+
+ if(FAILED(hr = CComQIPtr<IFilterGraph2>(m_pUnkInner)->AddFilter(pFilter, pName)))
+ return hr;
+
+ // TODO
+ hr = pFilter->JoinFilterGraph(NULL, NULL);
+ hr = pFilter->JoinFilterGraph(this, pName);
+
+ return hr;
+}
+
+STDMETHODIMP CFGManager::RemoveFilter(IBaseFilter* pFilter)
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->RemoveFilter(pFilter);
+}
+
+STDMETHODIMP CFGManager::EnumFilters(IEnumFilters** ppEnum)
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->EnumFilters(ppEnum);
+}
+
+STDMETHODIMP CFGManager::FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter)
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->FindFilterByName(pName, ppFilter);
+}
+
+STDMETHODIMP CFGManager::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt)
+{
+ CAutoLock cAutoLock(this);
+
+ CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinIn);
+ CLSID clsid = GetCLSID(pBF);
+
+ // TODO: GetUpStreamFilter goes up on the first input pin only
+ for(CComPtr<IBaseFilter> pBFUS = GetFilterFromPin(pPinOut); pBFUS; pBFUS = GetUpStreamFilter(pBFUS))
+ {
+ if(pBFUS == pBF) return VFW_E_CIRCULAR_GRAPH;
+ if(GetCLSID(pBFUS) == clsid) return VFW_E_CANNOT_CONNECT;
+ }
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->ConnectDirect(pPinOut, pPinIn, pmt);
+}
+
+STDMETHODIMP CFGManager::Reconnect(IPin* ppin)
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->Reconnect(ppin);
+}
+
+STDMETHODIMP CFGManager::Disconnect(IPin* ppin)
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->Disconnect(ppin);
+}
+
+STDMETHODIMP CFGManager::SetDefaultSyncSource()
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->SetDefaultSyncSource();
+}
+
+// IGraphBuilder
+
+STDMETHODIMP CFGManager::Connect(IPin* pPinOut, IPin* pPinIn)
+{
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(pPinOut, E_POINTER);
+
+ HRESULT hr;
+
+ if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT)
+ || pPinIn && S_OK != IsPinDirection(pPinIn, PINDIR_INPUT))
+ return VFW_E_INVALID_DIRECTION;
+
+ if(S_OK == IsPinConnected(pPinOut)
+ || pPinIn && S_OK == IsPinConnected(pPinIn))
+ return VFW_E_ALREADY_CONNECTED;
+
+ bool fDeadEnd = true;
+
+ if(pPinIn)
+ {
+ // 1. Try a direct connection between the filters, with no intermediate filters
+
+ if(SUCCEEDED(hr = ConnectDirect(pPinOut, pPinIn, NULL)))
+ return hr;
+ }
+ else
+ {
+ // 1. Use IStreamBuilder
+
+ if(CComQIPtr<IStreamBuilder> pSB = pPinOut)
+ {
+ if(SUCCEEDED(hr = pSB->Render(pPinOut, this)))
+ return hr;
+
+ pSB->Backout(pPinOut, this);
+ }
+ }
+
+ // 2. Try cached filters
+
+ if(CComQIPtr<IGraphConfig> pGC = (IGraphBuilder2*)this)
+ {
+ BeginEnumCachedFilters(pGC, pEF, pBF)
+ {
+ if(pPinIn && GetFilterFromPin(pPinIn) == pBF)
+ continue;
+
+ hr = pGC->RemoveFilterFromCache(pBF);
+
+ // does RemoveFilterFromCache call AddFilter like AddFilterToCache calls RemoveFilter ?
+
+ if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL)))
+ {
+ if(!IsStreamEnd(pBF)) fDeadEnd = false;
+
+ if(SUCCEEDED(hr = ConnectFilter(pBF, pPinIn)))
+ return hr;
+ }
+
+ hr = pGC->AddFilterToCache(pBF);
+ }
+ EndEnumCachedFilters
+ }
+
+ // 3. Try filters in the graph
+
+ {
+ CInterfaceList<IBaseFilter> pBFs;
+
+ BeginEnumFilters(this, pEF, pBF)
+ {
+ if(pPinIn && GetFilterFromPin(pPinIn) == pBF
+ || GetFilterFromPin(pPinOut) == pBF)
+ continue;
+
+ // HACK: ffdshow - audio capture filter
+ if(GetCLSID(pPinOut) == GUIDFromCString(_T("{04FE9017-F873-410E-871E-AB91661A4EF7}"))
+ && GetCLSID(pBF) == GUIDFromCString(_T("{E30629D2-27E5-11CE-875D-00608CB78066}")))
+ continue;
+
+ pBFs.AddTail(pBF);
+ }
+ EndEnumFilters
+
+ POSITION pos = pBFs.GetHeadPosition();
+ while(pos)
+ {
+ IBaseFilter* pBF = pBFs.GetNext(pos);
+
+ if(SUCCEEDED(hr = ConnectFilterDirect(pPinOut, pBF, NULL)))
+ {
+ if(!IsStreamEnd(pBF)) fDeadEnd = false;
+
+ if(SUCCEEDED(hr = ConnectFilter(pBF, pPinIn)))
+ return hr;
+ }
+
+ EXECUTE_ASSERT(Disconnect(pPinOut));
+ }
+ }
+
+ // 4. Look up filters in the registry
+
+ {
+ CFGFilterList fl;
+
+ CAtlArray<GUID> types;
+ ExtractMediaTypes(pPinOut, types);
+
+ POSITION pos = m_transform.GetHeadPosition();
+ while(pos)
+ {
+ CFGFilter* pFGF = m_transform.GetNext(pos);
+ if(pFGF->GetMerit() < MERIT64_DO_USE || pFGF->CheckTypes(types, false))
+ fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true), false);
+ }
+
+ pos = m_override.GetHeadPosition();
+ while(pos)
+ {
+ CFGFilter* pFGF = m_override.GetNext(pos);
+ if(pFGF->GetMerit() < MERIT64_DO_USE || pFGF->CheckTypes(types, false))
+ fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true), false);
+ }
+
+ CComPtr<IEnumMoniker> pEM;
+ if(types.GetCount() > 0
+ && SUCCEEDED(m_pFM->EnumMatchingFilters(
+ &pEM, 0, FALSE, MERIT_DO_NOT_USE+1,
+ TRUE, types.GetCount()/2, types.GetData(), NULL, NULL, FALSE,
+ !!pPinIn, 0, NULL, NULL, NULL)))
+ {
+ for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL)
+ {
+ CFGFilterRegistry* pFGF = new CFGFilterRegistry(pMoniker);
+ fl.Insert(pFGF, 0, pFGF->CheckTypes(types, true));
+ }
+ }
+
+ pos = fl.GetHeadPosition();
+ while(pos)
+ {
+ CFGFilter* pFGF = fl.GetNext(pos);
+
+ TRACE(_T("FGM: Connecting '%s'\n"), pFGF->GetName());
+
+ CComPtr<IBaseFilter> pBF;
+ CComPtr<IUnknown> pUnk;
+ if(FAILED(pFGF->Create(&pBF, &pUnk)))
+ continue;
+
+ if(FAILED(hr = AddFilter(pBF, pFGF->GetName())))
+ continue;
+
+ hr = E_FAIL;
+
+ if(FAILED(hr))
+ {
+ hr = ConnectFilterDirect(pPinOut, pBF, NULL);
+ }
+/*
+ if(FAILED(hr))
+ {
+ if(types.GetCount() >= 2 && types[0] == MEDIATYPE_Stream && types[1] != GUID_NULL)
+ {
+ CMediaType mt;
+
+ mt.majortype = types[0];
+ mt.subtype = types[1];
+ mt.formattype = FORMAT_None;
+ if(FAILED(hr)) hr = ConnectFilterDirect(pPinOut, pBF, &mt);
+
+ mt.formattype = GUID_NULL;
+ if(FAILED(hr)) hr = ConnectFilterDirect(pPinOut, pBF, &mt);
+ }
+ }
+*/
+ if(SUCCEEDED(hr))
+ {
+ if(!IsStreamEnd(pBF)) fDeadEnd = false;
+
+ hr = ConnectFilter(pBF, pPinIn);
+
+ if(SUCCEEDED(hr))
+ {
+ if(pUnk) m_pUnks.AddTail(pUnk);
+
+ // maybe the application should do this...
+ if(CComQIPtr<IMixerPinConfig, &IID_IMixerPinConfig> pMPC = pUnk)
+ pMPC->SetAspectRatioMode(AM_ARMODE_STRETCHED);
+ if(CComQIPtr<IVMRAspectRatioControl> pARC = pBF)
+ pARC->SetAspectRatioMode(VMR_ARMODE_NONE);
+ if(CComQIPtr<IVMRAspectRatioControl9> pARC = pBF)
+ pARC->SetAspectRatioMode(VMR_ARMODE_NONE);
+ if(CComQIPtr<IVMRMixerControl9> pMC = pBF)
+ m_pUnks.AddTail (pMC);
+ if(CComQIPtr<IVMRMixerBitmap9> pMB = pBF)
+ m_pUnks.AddTail (pMB);
+
+ return hr;
+ }
+ }
+
+ EXECUTE_ASSERT(SUCCEEDED(RemoveFilter(pBF)));
+
+ TRACE(_T("FGM: Connecting '%s' FAILED!\n"), pFGF->GetName());
+ }
+ }
+
+ if(fDeadEnd)
+ {
+ CAutoPtr<CStreamDeadEnd> psde(new CStreamDeadEnd());
+ psde->AddTailList(&m_streampath);
+ BeginEnumMediaTypes(pPinOut, pEM, pmt)
+ psde->mts.AddTail(CMediaType(*pmt));
+ EndEnumMediaTypes(pmt)
+ m_deadends.Add(psde);
+ }
+
+ return pPinIn ? VFW_E_CANNOT_CONNECT : VFW_E_CANNOT_RENDER;
+}
+
+STDMETHODIMP CFGManager::Render(IPin* pPinOut)
+{
+ CAutoLock cAutoLock(this);
+
+ return RenderEx(pPinOut, 0, NULL);
+}
+
+STDMETHODIMP CFGManager::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList)
+{
+ CAutoLock cAutoLock(this);
+
+ m_streampath.RemoveAll();
+ m_deadends.RemoveAll();
+
+ HRESULT hr;
+
+ CComPtr<IBaseFilter> pBF;
+ if(FAILED(hr = AddSourceFilter(lpcwstrFile, lpcwstrFile, &pBF)))
+ return hr;
+
+ return ConnectFilter(pBF, NULL);
+}
+
+STDMETHODIMP CFGManager::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter)
+{
+ CAutoLock cAutoLock(this);
+
+ // TODO: use overrides
+
+ CheckPointer(lpcwstrFileName, E_POINTER);
+ CheckPointer(ppFilter, E_POINTER);
+
+ HRESULT hr;
+
+ CStringW fn = CStringW(lpcwstrFileName).TrimLeft();
+ CStringW protocol = fn.Left(fn.Find(':')+1).TrimRight(':').MakeLower();
+ CStringW ext = CPathW(fn).GetExtension();
+
+ TCHAR buff[256], buff2[256];
+ ULONG len, len2;
+
+ CFGFilterList fl;
+
+ HANDLE hFile = CreateFile(CString(fn), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL);
+
+ // internal / protocol
+
+ if(protocol.GetLength() > 1 && protocol != L"file")
+ {
+ POSITION pos = m_source.GetHeadPosition();
+ while(pos)
+ {
+ CFGFilter* pFGF = m_source.GetNext(pos);
+ if(pFGF->m_protocols.Find(CString(protocol)))
+ fl.Insert(pFGF, 0, false, false);
+ }
+ }
+
+ // internal / check bytes
+
+ if(hFile != INVALID_HANDLE_VALUE)
+ {
+ POSITION pos = m_source.GetHeadPosition();
+ while(pos)
+ {
+ CFGFilter* pFGF = m_source.GetNext(pos);
+
+ POSITION pos2 = pFGF->m_chkbytes.GetHeadPosition();
+ while(pos2)
+ {
+ if(CheckBytes(hFile, pFGF->m_chkbytes.GetNext(pos2)))
+ {
+ fl.Insert(pFGF, 1, false, false);
+ break;
+ }
+ }
+ }
+ }
+
+ // insernal / file extension
+
+ if(!ext.IsEmpty())
+ {
+ POSITION pos = m_source.GetHeadPosition();
+ while(pos)
+ {
+ CFGFilter* pFGF = m_source.GetNext(pos);
+ if(pFGF->m_extensions.Find(CString(ext)))
+ fl.Insert(pFGF, 2, false, false);
+ }
+ }
+
+ // internal / the rest
+
+ {
+ POSITION pos = m_source.GetHeadPosition();
+ while(pos)
+ {
+ CFGFilter* pFGF = m_source.GetNext(pos);
+ if(pFGF->m_protocols.IsEmpty() && pFGF->m_chkbytes.IsEmpty() && pFGF->m_extensions.IsEmpty())
+ fl.Insert(pFGF, 3, false, false);
+ }
+ }
+
+ // protocol
+
+ if(protocol.GetLength() > 1 && protocol != L"file")
+ {
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, CString(protocol), KEY_READ))
+ {
+ CRegKey exts;
+ if(ERROR_SUCCESS == exts.Open(key, _T("Extensions"), KEY_READ))
+ {
+ len = countof(buff);
+ if(ERROR_SUCCESS == exts.QueryStringValue(CString(ext), buff, &len))
+ fl.Insert(new CFGFilterRegistry(GUIDFromCString(buff)), 4);
+ }
+
+ len = countof(buff);
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("Source Filter"), buff, &len))
+ fl.Insert(new CFGFilterRegistry(GUIDFromCString(buff)), 5);
+ }
+
+ fl.Insert(new CFGFilterRegistry(CLSID_URLReader), 6);
+ }
+
+ // check bytes
+
+ if(hFile != INVALID_HANDLE_VALUE)
+ {
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Media Type"), KEY_READ))
+ {
+ FILETIME ft;
+ len = countof(buff);
+ for(DWORD i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len, &ft); i++, len = countof(buff))
+ {
+ GUID majortype;
+ if(FAILED(GUIDFromCString(buff, majortype)))
+ continue;
+
+ CRegKey majorkey;
+ if(ERROR_SUCCESS == majorkey.Open(key, buff, KEY_READ))
+ {
+ len = countof(buff);
+ for(DWORD j = 0; ERROR_SUCCESS == majorkey.EnumKey(j, buff, &len, &ft); j++, len = countof(buff))
+ {
+ GUID subtype;
+ if(FAILED(GUIDFromCString(buff, subtype)))
+ continue;
+
+ CRegKey subkey;
+ if(ERROR_SUCCESS == subkey.Open(majorkey, buff, KEY_READ))
+ {
+ len = countof(buff);
+ if(ERROR_SUCCESS != subkey.QueryStringValue(_T("Source Filter"), buff, &len))
+ continue;
+
+ GUID clsid = GUIDFromCString(buff);
+
+ len = countof(buff);
+ len2 = sizeof(buff2);
+ for(DWORD k = 0, type;
+ clsid != GUID_NULL && ERROR_SUCCESS == RegEnumValue(subkey, k, buff2, &len2, 0, &type, (BYTE*)buff, &len);
+ k++, len = countof(buff), len2 = sizeof(buff2))
+ {
+ if(CheckBytes(hFile, CString(buff)))
+ {
+ CFGFilter* pFGF = new CFGFilterRegistry(clsid);
+ pFGF->AddType(majortype, subtype);
+ fl.Insert(pFGF, 7);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // file extension
+
+ if(!ext.IsEmpty())
+ {
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Media Type\\Extensions\\") + CString(ext), KEY_READ))
+ {
+ ULONG len = countof(buff);
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("Source Filter"), buff, &len))
+ {
+ GUID clsid = GUIDFromCString(buff);
+ GUID majortype = GUID_NULL;
+ GUID subtype = GUID_NULL;
+
+ len = countof(buff);
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("Media Type"), buff, &len))
+ majortype = GUIDFromCString(buff);
+
+ len = countof(buff);
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("Subtype"), buff, &len))
+ subtype = GUIDFromCString(buff);
+
+ CFGFilter* pFGF = new CFGFilterRegistry(clsid);
+ pFGF->AddType(majortype, subtype);
+ fl.Insert(pFGF, 8);
+ }
+ }
+ }
+
+ if(hFile != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(hFile);
+ }
+
+ CFGFilter* pFGF = new CFGFilterRegistry(CLSID_AsyncReader);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_NULL);
+ fl.Insert(pFGF, 9);
+
+ POSITION pos = fl.GetHeadPosition();
+ while(pos)
+ {
+ if(SUCCEEDED(hr = AddSourceFilter(fl.GetNext(pos), lpcwstrFileName, lpcwstrFilterName, ppFilter)))
+ return hr;
+ }
+
+ return hFile == INVALID_HANDLE_VALUE ? VFW_E_NOT_FOUND : VFW_E_CANNOT_LOAD_SOURCE_FILTER;
+}
+
+STDMETHODIMP CFGManager::SetLogFile(DWORD_PTR hFile)
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->SetLogFile(hFile);
+}
+
+STDMETHODIMP CFGManager::Abort()
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->Abort();
+}
+
+STDMETHODIMP CFGManager::ShouldOperationContinue()
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->ShouldOperationContinue();
+}
+
+// IFilterGraph2
+
+STDMETHODIMP CFGManager::AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter)
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->AddSourceFilterForMoniker(pMoniker, pCtx, lpcwstrFilterName, ppFilter);
+}
+
+STDMETHODIMP CFGManager::ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt)
+{
+ CAutoLock cAutoLock(this);
+
+ return CComQIPtr<IFilterGraph2>(m_pUnkInner)->ReconnectEx(ppin, pmt);
+}
+
+STDMETHODIMP CFGManager::RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext)
+{
+ CAutoLock cAutoLock(this);
+
+ m_streampath.RemoveAll();
+ m_deadends.RemoveAll();
+
+ if(!pPinOut || dwFlags > AM_RENDEREX_RENDERTOEXISTINGRENDERERS || pvContext)
+ return E_INVALIDARG;
+
+ HRESULT hr;
+
+ if(dwFlags & AM_RENDEREX_RENDERTOEXISTINGRENDERERS)
+ {
+ CInterfaceList<IBaseFilter> pBFs;
+
+ BeginEnumFilters(this, pEF, pBF)
+ {
+ if(CComQIPtr<IAMFilterMiscFlags> pAMMF = pBF)
+ {
+ if(pAMMF->GetMiscFlags() & AM_FILTER_MISC_FLAGS_IS_RENDERER)
+ {
+ pBFs.AddTail(pBF);
+ }
+ }
+ else
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ CComPtr<IPin> pPinIn;
+ DWORD size = 1;
+ if(SUCCEEDED(pPin->QueryInternalConnections(&pPinIn, &size)) && size == 0)
+ {
+ pBFs.AddTail(pBF);
+ break;
+ }
+ }
+ EndEnumPins
+ }
+ }
+ EndEnumFilters
+
+ while(!pBFs.IsEmpty())
+ {
+ if(SUCCEEDED(hr = ConnectFilter(pPinOut, pBFs.RemoveHead())))
+ return hr;
+ }
+
+ return VFW_E_CANNOT_RENDER;
+ }
+
+ return Connect(pPinOut, (IPin*)NULL);
+}
+
+// IGraphBuilder2
+
+STDMETHODIMP CFGManager::IsPinDirection(IPin* pPin, PIN_DIRECTION dir1)
+{
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(pPin, E_POINTER);
+
+ PIN_DIRECTION dir2;
+ if(FAILED(pPin->QueryDirection(&dir2)))
+ return E_FAIL;
+
+ return dir1 == dir2 ? S_OK : S_FALSE;
+}
+
+STDMETHODIMP CFGManager::IsPinConnected(IPin* pPin)
+{
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(pPin, E_POINTER);
+
+ CComPtr<IPin> pPinTo;
+ return SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo ? S_OK : S_FALSE;
+}
+
+STDMETHODIMP CFGManager::ConnectFilter(IBaseFilter* pBF, IPin* pPinIn)
+{
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(pBF, E_POINTER);
+
+ if(pPinIn && S_OK != IsPinDirection(pPinIn, PINDIR_INPUT))
+ return VFW_E_INVALID_DIRECTION;
+
+ int nTotal = 0, nRendered = 0;
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(GetPinName(pPin)[0] != '~'
+ && S_OK == IsPinDirection(pPin, PINDIR_OUTPUT)
+ && S_OK != IsPinConnected(pPin))
+ {
+ m_streampath.Append(pBF, pPin);
+
+ HRESULT hr = Connect(pPin, pPinIn);
+
+ if(SUCCEEDED(hr))
+ {
+ for(int i = m_deadends.GetCount()-1; i >= 0; i--)
+ if(m_deadends[i]->Compare(m_streampath))
+ m_deadends.RemoveAt(i);
+
+ nRendered++;
+ }
+
+ nTotal++;
+
+ m_streampath.RemoveTail();
+
+ if(SUCCEEDED(hr) && pPinIn)
+ return S_OK;
+ }
+ }
+ EndEnumPins
+
+ return
+ nRendered == nTotal ? (nRendered > 0 ? S_OK : S_FALSE) :
+ nRendered > 0 ? VFW_S_PARTIAL_RENDER :
+ VFW_E_CANNOT_RENDER;
+}
+
+STDMETHODIMP CFGManager::ConnectFilter(IPin* pPinOut, IBaseFilter* pBF)
+{
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(pPinOut, E_POINTER);
+ CheckPointer(pBF, E_POINTER);
+
+ if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT))
+ return VFW_E_INVALID_DIRECTION;
+
+ HRESULT hr;
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(GetPinName(pPin)[0] != '~'
+ && S_OK == IsPinDirection(pPin, PINDIR_INPUT)
+ && S_OK != IsPinConnected(pPin)
+ && SUCCEEDED(hr = Connect(pPinOut, pPin)))
+ return hr;
+ }
+ EndEnumPins
+
+ return VFW_E_CANNOT_CONNECT;
+}
+
+STDMETHODIMP CFGManager::ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt)
+{
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(pPinOut, E_POINTER);
+ CheckPointer(pBF, E_POINTER);
+
+ if(S_OK != IsPinDirection(pPinOut, PINDIR_OUTPUT))
+ return VFW_E_INVALID_DIRECTION;
+
+ HRESULT hr;
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(GetPinName(pPin)[0] != '~'
+ && S_OK == IsPinDirection(pPin, PINDIR_INPUT)
+ && S_OK != IsPinConnected(pPin)
+ && SUCCEEDED(hr = ConnectDirect(pPinOut, pPin, pmt)))
+ return hr;
+ }
+ EndEnumPins
+
+ return VFW_E_CANNOT_CONNECT;
+}
+
+STDMETHODIMP CFGManager::NukeDownstream(IUnknown* pUnk)
+{
+ CAutoLock cAutoLock(this);
+
+ if(CComQIPtr<IBaseFilter> pBF = pUnk)
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ NukeDownstream(pPin);
+ }
+ EndEnumPins
+ }
+ else if(CComQIPtr<IPin> pPin = pUnk)
+ {
+ CComPtr<IPin> pPinTo;
+ if(S_OK == IsPinDirection(pPin, PINDIR_OUTPUT)
+ && SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo)
+ {
+ if(CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo))
+ {
+ NukeDownstream(pBF);
+ Disconnect(pPinTo);
+ Disconnect(pPin);
+ RemoveFilter(pBF);
+ }
+ }
+ }
+ else
+ {
+ return E_INVALIDARG;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CFGManager::FindInterface(REFIID iid, void** ppv, BOOL bRemove)
+{
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(ppv, E_POINTER);
+
+ for(POSITION pos = m_pUnks.GetHeadPosition(); pos; m_pUnks.GetNext(pos))
+ {
+ if(SUCCEEDED(m_pUnks.GetAt(pos)->QueryInterface(iid, ppv)))
+ {
+ if(bRemove) m_pUnks.RemoveAt(pos);
+ return S_OK;
+ }
+ }
+
+ return E_NOINTERFACE;
+}
+
+STDMETHODIMP CFGManager::AddToROT()
+{
+ CAutoLock cAutoLock(this);
+
+ HRESULT hr;
+
+ if(m_dwRegister) return S_FALSE;
+
+ CComPtr<IRunningObjectTable> pROT;
+ CComPtr<IMoniker> pMoniker;
+ WCHAR wsz[256];
+ swprintf(wsz, L"FilterGraph %08p pid %08x (MPC)", (DWORD_PTR)this, GetCurrentProcessId());
+ if(SUCCEEDED(hr = GetRunningObjectTable(0, &pROT))
+ && SUCCEEDED(hr = CreateItemMoniker(L"!", wsz, &pMoniker)))
+ hr = pROT->Register(ROTFLAGS_REGISTRATIONKEEPSALIVE, (IGraphBuilder2*)this, pMoniker, &m_dwRegister);
+
+ return hr;
+}
+
+STDMETHODIMP CFGManager::RemoveFromROT()
+{
+ CAutoLock cAutoLock(this);
+
+ HRESULT hr;
+
+ if(!m_dwRegister) return S_FALSE;
+
+ CComPtr<IRunningObjectTable> pROT;
+ if(SUCCEEDED(hr = GetRunningObjectTable(0, &pROT))
+ && SUCCEEDED(hr = pROT->Revoke(m_dwRegister)))
+ m_dwRegister = 0;
+
+ return hr;
+}
+
+// IGraphBuilderDeadEnd
+
+STDMETHODIMP_(size_t) CFGManager::GetCount()
+{
+ CAutoLock cAutoLock(this);
+
+ return m_deadends.GetCount();
+}
+
+STDMETHODIMP CFGManager::GetDeadEnd(int iIndex, CAtlList<CStringW>& path, CAtlList<CMediaType>& mts)
+{
+ CAutoLock cAutoLock(this);
+
+ if(iIndex < 0 || iIndex >= m_deadends.GetCount()) return E_FAIL;
+
+ path.RemoveAll();
+ mts.RemoveAll();
+
+ POSITION pos = m_deadends[iIndex]->GetHeadPosition();
+ while(pos)
+ {
+ const path_t& p = m_deadends[iIndex]->GetNext(pos);
+
+ CStringW str;
+ str.Format(L"%s::%s", p.filter, p.pin);
+ path.AddTail(str);
+ }
+
+ mts.AddTailList(&m_deadends[iIndex]->mts);
+
+ return S_OK;
+}
+
+//
+// CFGManagerCustom
+//
+
+CFGManagerCustom::CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra)
+ : CFGManager(pName, pUnk)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ CFGFilter* pFGF;
+
+ // Source filters
+
+// UINT src = s.SrcFilters;
+
+ if(src & SRC_SHOUTCAST)
+ {
+ pFGF = new CFGFilterInternal<CShoutcastSource>();
+ pFGF->m_protocols.AddTail(_T("http"));
+ m_source.AddTail(pFGF);
+ }
+
+ // if(src & SRC_UDP)
+ {
+ pFGF = new CFGFilterInternal<CUDPReader>();
+ pFGF->m_protocols.AddTail(_T("udp"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_AVI)
+ {
+ pFGF = new CFGFilterInternal<CAviSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564920"));
+ pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564958"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_MP4)
+ {
+ pFGF = new CFGFilterInternal<CMP4SourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("4,4,,66747970")); // ftyp
+ pFGF->m_chkbytes.AddTail(_T("4,4,,6d6f6f76")); // moov
+ pFGF->m_chkbytes.AddTail(_T("4,4,,6d646174")); // mdat
+ pFGF->m_chkbytes.AddTail(_T("4,4,,736b6970")); // skip
+ pFGF->m_chkbytes.AddTail(_T("4,12,ffffffff00000000ffffffff,77696465027fe3706d646174")); // wide ? mdat
+ pFGF->m_extensions.AddTail(_T(".mov"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_MATROSKA)
+ {
+ pFGF = new CFGFilterInternal<CMatroskaSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,4,,1A45DFA3"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_REALMEDIA)
+ {
+ pFGF = new CFGFilterInternal<CRealMediaSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,4,,2E524D46"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_DSM)
+ {
+ pFGF = new CFGFilterInternal<CDSMSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,4,,44534D53"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_FLIC)
+ {
+ pFGF = new CFGFilterInternal<CFLICSource>();
+ pFGF->m_chkbytes.AddTail(_T("4,2,,11AF"));
+ pFGF->m_chkbytes.AddTail(_T("4,2,,12AF"));
+ pFGF->m_extensions.AddTail(_T(".fli"));
+ pFGF->m_extensions.AddTail(_T(".flc"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_CDDA)
+ {
+ pFGF = new CFGFilterInternal<CCDDAReader>();
+ pFGF->m_extensions.AddTail(_T(".cda"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_CDXA)
+ {
+ pFGF = new CFGFilterInternal<CCDXAReader>();
+ pFGF->m_chkbytes.AddTail(_T("0,4,,52494646,8,4,,43445841"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_VTS)
+ {
+ pFGF = new CFGFilterInternal<CVTSReader>();
+ pFGF->m_chkbytes.AddTail(_T("0,12,,445644564944454F2D565453"));
+ m_source.AddTail(pFGF);
+ }
+
+ __if_exists(CD2VSource)
+ {
+ if(src & SRC_D2V)
+ {
+ pFGF = new CFGFilterInternal<CD2VSource>();
+ pFGF->m_chkbytes.AddTail(_T("0,18,,4456443241564950726F6A65637446696C65"));
+ pFGF->m_extensions.AddTail(_T(".d2v"));
+ m_source.AddTail(pFGF);
+ }
+ }
+
+ __if_exists(CRadGtSourceFilter)
+ {
+ if(src & SRC_RADGT)
+ {
+ pFGF = new CFGFilterInternal<CRadGtSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,3,,534D4B"));
+ pFGF->m_chkbytes.AddTail(_T("0,3,,42494B"));
+ pFGF->m_extensions.AddTail(_T(".smk"));
+ pFGF->m_extensions.AddTail(_T(".bik"));
+ m_source.AddTail(pFGF);
+ }
+ }
+
+ if(src & SRC_ROQ)
+ {
+ pFGF = new CFGFilterInternal<CRoQSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,8,,8410FFFFFFFF1E00"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_OGG)
+ {
+ pFGF = new CFGFilterInternal<COggSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,4,,4F676753"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_NUT)
+ {
+ pFGF = new CFGFilterInternal<CNutSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,8,,F9526A624E55544D"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_DIRAC)
+ {
+ pFGF = new CFGFilterInternal<CDiracSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,8,,4B572D4449524143"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_MPEG)
+ {
+ pFGF = new CFGFilterInternal<CMpegSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,16,FFFFFFFFF100010001800001FFFFFFFF,000001BA2100010001800001000001BB"));
+ pFGF->m_chkbytes.AddTail(_T("0,5,FFFFFFFFC0,000001BA40"));
+ pFGF->m_chkbytes.AddTail(_T("0,1,,47,188,1,,47,376,1,,47"));
+ pFGF->m_chkbytes.AddTail(_T("4,1,,47,196,1,,47,388,1,,47"));
+ pFGF->m_chkbytes.AddTail(_T("0,8,fffffc00ffe00000,4156000055000000"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_DTSAC3)
+ {
+ pFGF = new CFGFilterInternal<CDTSAC3Source>();
+ pFGF->m_chkbytes.AddTail(_T("0,4,,7FFE8001"));
+ pFGF->m_chkbytes.AddTail(_T("0,2,,0B77"));
+ pFGF->m_chkbytes.AddTail(_T("0,2,,770B"));
+ pFGF->m_extensions.AddTail(_T(".ac3"));
+ pFGF->m_extensions.AddTail(_T(".dts"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(src & SRC_MPA)
+ {
+ pFGF = new CFGFilterInternal<CMpaSourceFilter>();
+ pFGF->m_chkbytes.AddTail(_T("0,2,FFE0,FFE0"));
+ pFGF->m_chkbytes.AddTail(_T("0,10,FFFFFF00000080808080,49443300000000000000"));
+ m_source.AddTail(pFGF);
+ }
+
+ if(AfxGetAppSettings().fUseWMASFReader)
+ {
+ pFGF = new CFGFilterRegistry(CLSID_WMAsfReader);
+ pFGF->m_chkbytes.AddTail(_T("0,4,,3026B275"));
+ pFGF->m_chkbytes.AddTail(_T("0,4,,D129E2D6"));
+ m_source.AddTail(pFGF);
+ }
+
+ // Transform filters
+
+// UINT tra = s.TraFilters;
+
+ pFGF = new CFGFilterInternal<CAVI2AC3Filter>(L"AVI<->AC3/DTS", MERIT64(0x00680000)+1);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DOLBY_AC3);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DTS);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMatroskaSplitterFilter>(
+ (src & SRC_MATROSKA) ? L"Matroska Splitter" : L"Matroska Splitter (low merit)",
+ (src & SRC_MATROSKA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Matroska);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CRealMediaSplitterFilter>(
+ (src & SRC_REALMEDIA) ? L"RealMedia Splitter" : L"RealMedia Splitter (low merit)",
+ (src & SRC_REALMEDIA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_RealMedia);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CAviSplitterFilter>(
+ (src & SRC_AVI) ? L"Avi Splitter" : L"Avi Splitter (low merit)",
+ (src & SRC_AVI) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Avi);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ __if_exists(CRadGtSplitterFilter)
+ {
+ pFGF = new CFGFilterInternal<CRadGtSplitterFilter>(
+ (src & SRC_RADGT) ? L"RadGt Splitter" : L"RadGt Splitter (low merit)",
+ (src & SRC_RADGT) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Bink);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Smacker);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+ }
+
+ pFGF = new CFGFilterInternal<CRoQSplitterFilter>(
+ (src & SRC_ROQ) ? L"RoQ Splitter" : L"RoQ Splitter (low merit)",
+ (src & SRC_ROQ) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_RoQ);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<COggSplitterFilter>(
+ (src & SRC_OGG) ? L"Ogg Splitter" : L"Ogg Splitter (low merit)",
+ (src & SRC_OGG) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Ogg);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CNutSplitterFilter>(
+ (src & SRC_NUT) ? L"Nut Splitter" : L"Nut Splitter (low merit)",
+ (src & SRC_NUT) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Nut);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpegSplitterFilter>(
+ (src & SRC_MPEG) ? L"Mpeg Splitter" : L"Mpeg Splitter (low merit)",
+ (src & SRC_MPEG) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG1System);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG2_PROGRAM);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG2_TRANSPORT);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG2_PVA);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CDiracSplitterFilter>(
+ (src & SRC_DIRAC) ? L"Dirac Splitter" : L"Dirac Splitter (low merit)",
+ (src & SRC_DIRAC) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_Dirac);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpaSplitterFilter>(
+ (src & SRC_MPA) ? L"Mpa Splitter" : L"Mpa Splitter (low merit)",
+ (src & SRC_MPA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG1Audio);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CDSMSplitterFilter>(
+ (src & SRC_DSM) ? L"DSM Splitter" : L"DSM Splitter (low merit)",
+ (src & SRC_DSM) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_DirectShowMedia);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMP4SplitterFilter>(
+ (src & SRC_MP4) ? L"MP4 Splitter" : L"MP4 Splitter (low merit)",
+ (src & SRC_MP4) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Stream, MEDIASUBTYPE_MP4);
+ pFGF->AddType(MEDIATYPE_Stream, GUID_NULL);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpeg2DecFilter>(
+ (tra & TRA_MPEG1) ? L"MPEG-1 Video Decoder" : L"MPEG-1 Video Decoder (low merit)",
+ (tra & TRA_MPEG1) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_MPEG1Packet);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_MPEG1Payload);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpeg2DecFilter>(
+ (tra & TRA_MPEG2) ? L"MPEG-2 Video Decoder" : L"MPEG-2 Video Decoder (low merit)",
+ (tra & TRA_MPEG2) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MPEG2_VIDEO);
+ pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_MPEG2_VIDEO);
+ pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_MPEG2_VIDEO);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_MPEG2_VIDEO);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ (tra & TRA_MPA) ? L"MPEG-1 Audio Decoder" : L"MPEG-1 Audio Decoder (low merit)",
+ (tra & TRA_MPA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MP3);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1AudioPayload);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1Payload);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MPEG1Packet);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ (tra & TRA_MPA) ? L"MPEG-2 Audio Decoder" : L"MPEG-2 Audio Decoder (low merit)",
+ (tra & TRA_MPA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MPEG2_AUDIO);
+ pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_MPEG2_AUDIO);
+ pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_MPEG2_AUDIO);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MPEG2_AUDIO);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ (tra & TRA_LPCM) ? L"LPCM Audio Decoder" : L"LPCM Audio Decoder (low merit)",
+ (tra & TRA_LPCM) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_DVD_LPCM_AUDIO);
+ pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_DVD_LPCM_AUDIO);
+ pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_DVD_LPCM_AUDIO);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DVD_LPCM_AUDIO);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ (tra & TRA_AC3) ? L"AC3 Audio Decoder" : L"AC3 Audio Decoder (low merit)",
+ (tra & TRA_AC3) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_DOLBY_AC3);
+ pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_DOLBY_AC3);
+ pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_DOLBY_AC3);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DOLBY_AC3);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DOLBY_AC3);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ (tra & TRA_DTS) ? L"DTS Decoder" : L"DTS Decoder (low merit)",
+ (tra & TRA_DTS) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_DTS);
+ pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_DTS);
+ pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_DTS);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DTS);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_WAVE_DTS);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ (tra & TRA_AAC) ? L"AAC Decoder" : L"AAC Decoder (low merit)",
+ (tra & TRA_AAC) ? MERIT64_ABOVE_DSHOW+1 : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_AAC);
+ pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_AAC);
+ pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_AAC);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_AAC);
+ pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_MP4A);
+ pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_MP4A);
+ pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_MP4A);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_MP4A);
+ pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_mp4a);
+ pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_mp4a);
+ pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_mp4a);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_mp4a);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CMpaDecFilter>(
+ (tra & TRA_PS2AUD) ? L"PS2 Audio Decoder" : L"PS2 Audio Decoder (low merit)",
+ (tra & TRA_PS2AUD) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_DVD_ENCRYPTED_PACK, MEDIASUBTYPE_PS2_PCM);
+ pFGF->AddType(MEDIATYPE_MPEG2_PACK, MEDIASUBTYPE_PS2_PCM);
+ pFGF->AddType(MEDIATYPE_MPEG2_PES, MEDIASUBTYPE_PS2_PCM);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_PS2_PCM);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CRealVideoDecoder>(
+ (tra & TRA_RV) ? L"RealVideo Decoder" : L"RealVideo Decoder (low merit)",
+ (tra & TRA_RV) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RV10);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RV20);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RV30);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RV40);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CRealAudioDecoder>(
+ (tra & TRA_RA) ? L"RealAudio Decoder" : L"RealAudio Decoder (low merit)",
+ (tra & TRA_RA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_14_4);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_28_8);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_ATRC);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_COOK);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_DNET);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_SIPR);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_RAAC);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CRoQVideoDecoder>(
+ (tra & TRA_RV) ? L"RoQ Video Decoder" : L"RoQ Video Decoder (low merit)",
+ (tra & TRA_RV) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_RoQV);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CRoQAudioDecoder>(
+ (tra & TRA_RA) ? L"RoQ Audio Decoder" : L"RoQ Audio Decoder (low merit)",
+ (tra & TRA_RA) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_RoQA);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CDiracVideoDecoder>(
+ (tra & TRA_DIRAC) ? L"Dirac Video Decoder" : L"Dirac Video Decoder (low merit)",
+ (tra & TRA_DIRAC) ? MERIT64_ABOVE_DSHOW : MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_DiracVideo);
+ m_transform.AddTail(pFGF);
+
+ pFGF = new CFGFilterInternal<CNullTextRenderer>(L"NullTextRenderer", MERIT64_DO_USE);
+ pFGF->AddType(MEDIATYPE_Text, MEDIASUBTYPE_NULL);
+ pFGF->AddType(MEDIATYPE_ScriptCommand, MEDIASUBTYPE_NULL);
+ pFGF->AddType(MEDIATYPE_Subtitle, MEDIASUBTYPE_NULL);
+ pFGF->AddType(MEDIATYPE_Text, MEDIASUBTYPE_NULL);
+ pFGF->AddType(MEDIATYPE_NULL, MEDIASUBTYPE_DVD_SUBPICTURE);
+ pFGF->AddType(MEDIATYPE_NULL, MEDIASUBTYPE_CVD_SUBPICTURE);
+ pFGF->AddType(MEDIATYPE_NULL, MEDIASUBTYPE_SVCD_SUBPICTURE);
+ m_transform.AddTail(pFGF);
+
+ // Blocked filters
+
+ // "Subtitle Mixer" makes an access violation around the
+ // 11-12th media type when enumerating them on its output.
+ m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{00A95963-3BE5-48C0-AD9F-3356D67EA09D}")), MERIT64_DO_NOT_USE));
+
+ // ISCR suxx
+ m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}")), MERIT64_DO_NOT_USE));
+
+ // Samsung's "mpeg-4 demultiplexor" can even open matroska files, amazing...
+ m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{99EC0C72-4D1B-411B-AB1F-D561EE049D94}")), MERIT64_DO_NOT_USE));
+
+ // LG Video Renderer (lgvid.ax) just crashes when trying to connect it
+ m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{9F711C60-0668-11D0-94D4-0000C02BA972}")), MERIT64_DO_NOT_USE));
+
+ // palm demuxer crashes (even crashes graphedit when dropping an .ac3 onto it)
+ m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{BE2CF8A7-08CE-4A2C-9A25-FD726A999196}")), MERIT64_DO_NOT_USE));
+
+ // DCDSPFilter (early versions crash mpc)
+ {
+ CRegKey key;
+
+ TCHAR buff[256];
+ ULONG len = sizeof(buff);
+ memset(buff, 0, len);
+
+ CString clsid = _T("{B38C58A0-1809-11D6-A458-EDAE78F1DF12}");
+
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("CLSID\\") + clsid + _T("\\InprocServer32"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len)
+ && GetFileVersion(buff) < 0x0001000000030000ui64)
+ {
+ m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(clsid), MERIT64_DO_NOT_USE));
+ }
+ }
+
+ // Overrides
+
+ WORD merit_low = 1;
+
+ POSITION pos = s.filters.GetTailPosition();
+ while(pos)
+ {
+ FilterOverride* fo = s.filters.GetPrev(pos);
+
+ if(fo->fDisabled || fo->type == FilterOverride::EXTERNAL && !CPath(MakeFullPath(fo->path)).FileExists())
+ continue;
+
+ ULONGLONG merit =
+ fo->iLoadType == FilterOverride::PREFERRED ? MERIT64_ABOVE_DSHOW :
+ fo->iLoadType == FilterOverride::MERIT ? MERIT64(fo->dwMerit) :
+ MERIT64_DO_NOT_USE; // fo->iLoadType == FilterOverride::BLOCKED
+
+ merit += merit_low++;
+
+ CFGFilter* pFGF = NULL;
+
+ if(fo->type == FilterOverride::REGISTERED)
+ {
+ pFGF = new CFGFilterRegistry(fo->dispname, merit);
+ }
+ else if(fo->type == FilterOverride::EXTERNAL)
+ {
+ pFGF = new CFGFilterFile(fo->clsid, fo->path, CStringW(fo->name), merit);
+ }
+
+ if(pFGF)
+ {
+ pFGF->SetTypes(fo->guids);
+ m_override.AddTail(pFGF);
+ }
+ }
+}
+
+STDMETHODIMP CFGManagerCustom::AddFilter(IBaseFilter* pBF, LPCWSTR pName)
+{
+ CAutoLock cAutoLock(this);
+
+ HRESULT hr;
+
+ if(FAILED(hr = __super::AddFilter(pBF, pName)))
+ return hr;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ if(GetCLSID(pBF) == CLSID_DMOWrapperFilter)
+ {
+ if(CComQIPtr<IPropertyBag> pPB = pBF)
+ {
+ CComVariant var(true);
+ pPB->Write(CComBSTR(L"_HIRESOUTPUT"), &var);
+ }
+ }
+
+ if(CComQIPtr<IAudioSwitcherFilter> pASF = pBF)
+ {
+ pASF->EnableDownSamplingTo441(s.fDownSampleTo441);
+ pASF->SetSpeakerConfig(s.fCustomChannelMapping, s.pSpeakerToChannelMap);
+ pASF->SetAudioTimeShift(s.fAudioTimeShift ? 10000i64*s.tAudioTimeShift : 0);
+ pASF->SetNormalizeBoost(s.fAudioNormalize, s.fAudioNormalizeRecover, s.AudioBoost);
+ }
+
+ return hr;
+}
+
+//
+// CFGManagerPlayer
+//
+
+CFGManagerPlayer::CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd)
+ : CFGManagerCustom(pName, pUnk, src, tra)
+ , m_hWnd(hWnd)
+ , m_vrmerit(MERIT64(MERIT_PREFERRED))
+ , m_armerit(MERIT64(MERIT_PREFERRED))
+{
+ CFGFilter* pFGF;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ if(m_pFM)
+ {
+ CComPtr<IEnumMoniker> pEM;
+
+ GUID guids[] = {MEDIATYPE_Video, MEDIASUBTYPE_NULL};
+
+ if(SUCCEEDED(m_pFM->EnumMatchingFilters(&pEM, 0, FALSE, MERIT_DO_NOT_USE+1,
+ TRUE, 1, guids, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL)))
+ {
+ for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL)
+ {
+ CFGFilterRegistry f(pMoniker);
+ m_vrmerit = max(m_vrmerit, f.GetMerit());
+ }
+ }
+
+ m_vrmerit += 0x100;
+ }
+
+ if(m_pFM)
+ {
+ CComPtr<IEnumMoniker> pEM;
+
+ GUID guids[] = {MEDIATYPE_Audio, MEDIASUBTYPE_NULL};
+
+ if(SUCCEEDED(m_pFM->EnumMatchingFilters(&pEM, 0, FALSE, MERIT_DO_NOT_USE+1,
+ TRUE, 1, guids, NULL, NULL, TRUE, FALSE, 0, NULL, NULL, NULL)))
+ {
+ for(CComPtr<IMoniker> pMoniker; S_OK == pEM->Next(1, &pMoniker, NULL); pMoniker = NULL)
+ {
+ CFGFilterRegistry f(pMoniker);
+ m_armerit = max(m_armerit, f.GetMerit());
+ }
+ }
+
+ BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker)
+ {
+ CFGFilterRegistry f(pMoniker);
+ m_armerit = max(m_armerit, f.GetMerit());
+ }
+ EndEnumSysDev
+
+ m_armerit += 0x100;
+ }
+
+ // Switchers
+
+ if(s.fEnableAudioSwitcher)
+ {
+ pFGF = new CFGFilterInternal<CAudioSwitcherFilter>(L"Audio Switcher", m_armerit + 0x100);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+
+ // morgan stream switcher
+ m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{D3CD7858-971A-4838-ACEC-40CA5D529DC8}")), MERIT64_DO_NOT_USE));
+ }
+
+ // Renderers
+
+ if(s.iDSVideoRendererType == VIDRNDT_DS_OLDRENDERER)
+ m_transform.AddTail(new CFGFilterRegistry(CLSID_VideoRenderer, m_vrmerit));
+ else if(s.iDSVideoRendererType == VIDRNDT_DS_OVERLAYMIXER)
+ m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit));
+ else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7WINDOWED)
+ m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer, L"Video Mixing Render 7 (Windowed)", m_vrmerit));
+ else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR9WINDOWED)
+ m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VideoMixingRenderer9, L"Video Mixing Render 9 (Windowed)", m_vrmerit));
+ else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR7RENDERLESS)
+ m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VMR7AllocatorPresenter, L"Video Mixing Render 7 (Renderless)", m_vrmerit));
+ else if(s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS)
+ m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_VMR9AllocatorPresenter, L"Video Mixing Render 9 (Renderless)", m_vrmerit));
+ else if(s.iDSVideoRendererType == VIDRNDT_DS_DXR)
+ m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_DXRAllocatorPresenter, L"Haali's Video Renderer", m_vrmerit));
+ else if(s.iDSVideoRendererType == VIDRNDT_DS_NULL_COMP)
+ {
+ pFGF = new CFGFilterInternal<CNullVideoRenderer>(L"Null Video Renderer (Any)", MERIT64_ABOVE_DSHOW+2);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+ }
+ else if(s.iDSVideoRendererType == VIDRNDT_DS_NULL_UNCOMP)
+ {
+ pFGF = new CFGFilterInternal<CNullUVideoRenderer>(L"Null Video Renderer (Uncompressed)", MERIT64_ABOVE_DSHOW+2);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+ }
+
+ if(s.AudioRendererDisplayName == AUDRNDT_NULL_COMP)
+ {
+ pFGF = new CFGFilterInternal<CNullAudioRenderer>(AUDRNDT_NULL_COMP, MERIT64_ABOVE_DSHOW+2);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+ }
+ else if(s.AudioRendererDisplayName == AUDRNDT_NULL_UNCOMP)
+ {
+ pFGF = new CFGFilterInternal<CNullUAudioRenderer>(AUDRNDT_NULL_UNCOMP, MERIT64_ABOVE_DSHOW+2);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+ }
+ else if(!s.AudioRendererDisplayName.IsEmpty())
+ {
+ pFGF = new CFGFilterRegistry(s.AudioRendererDisplayName, m_armerit);
+ pFGF->AddType(MEDIATYPE_Audio, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+ }
+}
+
+STDMETHODIMP CFGManagerPlayer::ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt)
+{
+ CAutoLock cAutoLock(this);
+
+ if(GetCLSID(pPinOut) == CLSID_MPEG2Demultiplexer)
+ {
+ CComQIPtr<IMediaSeeking> pMS = pPinOut;
+ REFERENCE_TIME rtDur = 0;
+ if(!pMS || FAILED(pMS->GetDuration(&rtDur)) || rtDur <= 0)
+ return E_FAIL;
+ }
+
+ return __super::ConnectDirect(pPinOut, pPinIn, pmt);
+}
+
+//
+// CFGManagerDVD
+//
+
+CFGManagerDVD::CFGManagerDVD(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd)
+ : CFGManagerPlayer(pName, pUnk, src, tra, hWnd)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ if(!s.fXpOrBetter && s.iDSVideoRendererType != VIDRNDT_DS_OVERLAYMIXER || s.iDSVideoRendererType == VIDRNDT_DS_OLDRENDERER)
+ m_transform.AddTail(new CFGFilterVideoRenderer(m_hWnd, CLSID_OverlayMixer, L"Overlay Mixer", m_vrmerit-1));
+
+ // elecard's decoder isn't suited for dvd playback (atm)
+ m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{F50B3F13-19C4-11CF-AA9A-02608C9BABA2}")), MERIT64_DO_NOT_USE));
+}
+
+#include "..\..\decss\VobFile.h"
+
+class CResetDVD : public CDVDSession
+{
+public:
+ CResetDVD(LPCTSTR path)
+ {
+ if(Open(path))
+ {
+ if(BeginSession()) {Authenticate(); /*GetDiscKey();*/ EndSession();}
+ Close();
+ }
+ }
+};
+
+STDMETHODIMP CFGManagerDVD::AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter)
+{
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(lpcwstrFileName, E_POINTER);
+ CheckPointer(ppFilter, E_POINTER);
+
+ HRESULT hr;
+
+ CStringW fn = CStringW(lpcwstrFileName).TrimLeft();
+ CStringW protocol = fn.Left(fn.Find(':')+1).TrimRight(':').MakeLower();
+ CStringW ext = CPathW(fn).GetExtension();
+
+ GUID clsid = ext == L".ratdvd" ? GUIDFromCString(_T("{482d10b6-376e-4411-8a17-833800A065DB}")) : CLSID_DVDNavigator;
+
+ CComPtr<IBaseFilter> pBF;
+ if(FAILED(hr = pBF.CoCreateInstance(clsid))
+ || FAILED(hr = AddFilter(pBF, L"DVD Navigator")))
+ return VFW_E_CANNOT_LOAD_SOURCE_FILTER;
+
+ CComQIPtr<IDvdControl2> pDVDC;
+ CComQIPtr<IDvdInfo2> pDVDI;
+
+ if(!((pDVDC = pBF) && (pDVDI = pBF)))
+ return E_NOINTERFACE;
+
+ WCHAR buff[MAX_PATH];
+ ULONG len;
+ if((!fn.IsEmpty()
+ && FAILED(hr = pDVDC->SetDVDDirectory(fn))
+ && FAILED(hr = pDVDC->SetDVDDirectory(fn + L"VIDEO_TS"))
+ && FAILED(hr = pDVDC->SetDVDDirectory(fn + L"\\VIDEO_TS")))
+ || FAILED(hr = pDVDI->GetDVDDirectory(buff, countof(buff), &len)) || len == 0)
+ return VFW_E_CANNOT_LOAD_SOURCE_FILTER;
+
+ pDVDC->SetOption(DVD_ResetOnStop, FALSE);
+ pDVDC->SetOption(DVD_HMSF_TimeCodeEvents, TRUE);
+
+ m_pUnks.AddTail(pDVDC);
+ m_pUnks.AddTail(pDVDI);
+
+ if(clsid == CLSID_DVDNavigator)
+ CResetDVD(CString(buff));
+
+ *ppFilter = pBF.Detach();
+
+ return S_OK;
+}
+
+//
+// CFGManagerCapture
+//
+
+CFGManagerCapture::CFGManagerCapture(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd)
+ : CFGManagerPlayer(pName, pUnk, src, tra, hWnd)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ CFGFilter* pFGF = new CFGFilterInternal<CDeinterlacerFilter>(L"Deinterlacer", m_vrmerit + 0x100);
+ pFGF->AddType(MEDIATYPE_Video, MEDIASUBTYPE_NULL);
+ m_transform.AddTail(pFGF);
+
+ // morgan stream switcher
+ m_transform.AddTail(new CFGFilterRegistry(GUIDFromCString(_T("{D3CD7858-971A-4838-ACEC-40CA5D529DC8}")), MERIT64_DO_NOT_USE));
+}
+
+//
+// CFGManagerMuxer
+//
+
+CFGManagerMuxer::CFGManagerMuxer(LPCTSTR pName, LPUNKNOWN pUnk)
+ : CFGManagerCustom(pName, pUnk, ~0, ~0)
+{
+ m_source.AddTail(new CFGFilterInternal<CSubtitleSourceASS>());
+}
+
diff --git a/src/apps/mplayerc/FGManager.h b/src/apps/mplayerc/FGManager.h
new file mode 100644
index 000000000..a660b5478
--- /dev/null
+++ b/src/apps/mplayerc/FGManager.h
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "FGFilter.h"
+#include "IGraphBuilder2.h"
+
+class CFGManager
+ : public CUnknown
+ , public IGraphBuilder2
+ , public IGraphBuilderDeadEnd
+ , public CCritSec
+{
+public:
+ struct path_t {CLSID clsid; CString filter, pin;};
+
+ class CStreamPath : public CAtlList<path_t>
+ {
+ public:
+ void Append(IBaseFilter* pBF, IPin* pPin);
+ bool Compare(const CStreamPath& path);
+ };
+
+ class CStreamDeadEnd : public CStreamPath
+ {
+ public:
+ CAtlList<CMediaType> mts;
+ };
+
+private:
+ CComPtr<IUnknown> m_pUnkInner;
+ DWORD m_dwRegister;
+
+ CStreamPath m_streampath;
+ CAutoPtrArray<CStreamDeadEnd> m_deadends;
+
+protected:
+ CComPtr<IFilterMapper2> m_pFM;
+ CInterfaceList<IUnknown, &IID_IUnknown> m_pUnks;
+ CAtlList<CFGFilter*> m_source, m_transform, m_override;
+
+ static bool CheckBytes(HANDLE hFile, CString chkbytes);
+
+ HRESULT AddSourceFilter(CFGFilter* pFGF, LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppBF);
+
+ // IFilterGraph
+
+ STDMETHODIMP AddFilter(IBaseFilter* pFilter, LPCWSTR pName);
+ STDMETHODIMP RemoveFilter(IBaseFilter* pFilter);
+ STDMETHODIMP EnumFilters(IEnumFilters** ppEnum);
+ STDMETHODIMP FindFilterByName(LPCWSTR pName, IBaseFilter** ppFilter);
+ STDMETHODIMP ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP Reconnect(IPin* ppin);
+ STDMETHODIMP Disconnect(IPin* ppin);
+ STDMETHODIMP SetDefaultSyncSource();
+
+ // IGraphBuilder
+
+ STDMETHODIMP Connect(IPin* pPinOut, IPin* pPinIn);
+ STDMETHODIMP Render(IPin* pPinOut);
+ STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
+ STDMETHODIMP AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter);
+ STDMETHODIMP SetLogFile(DWORD_PTR hFile);
+ STDMETHODIMP Abort();
+ STDMETHODIMP ShouldOperationContinue();
+
+ // IFilterGraph2
+
+ STDMETHODIMP AddSourceFilterForMoniker(IMoniker* pMoniker, IBindCtx* pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter);
+ STDMETHODIMP ReconnectEx(IPin* ppin, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP RenderEx(IPin* pPinOut, DWORD dwFlags, DWORD* pvContext);
+
+ // IGraphBuilder2
+
+ STDMETHODIMP IsPinDirection(IPin* pPin, PIN_DIRECTION dir);
+ STDMETHODIMP IsPinConnected(IPin* pPin);
+ STDMETHODIMP ConnectFilter(IBaseFilter* pBF, IPin* pPinIn);
+ STDMETHODIMP ConnectFilter(IPin* pPinOut, IBaseFilter* pBF);
+ STDMETHODIMP ConnectFilterDirect(IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP NukeDownstream(IUnknown* pUnk);
+ STDMETHODIMP FindInterface(REFIID iid, void** ppv, BOOL bRemove);
+ STDMETHODIMP AddToROT();
+ STDMETHODIMP RemoveFromROT();
+
+ // IGraphBuilderDeadEnd
+
+ STDMETHODIMP_(size_t) GetCount();
+ STDMETHODIMP GetDeadEnd(int iIndex, CAtlList<CStringW>& path, CAtlList<CMediaType>& mts);
+
+public:
+ CFGManager(LPCTSTR pName, LPUNKNOWN pUnk);
+ virtual ~CFGManager();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+};
+
+class CFGManagerCustom : public CFGManager
+{
+public:
+ // IFilterGraph
+
+ STDMETHODIMP AddFilter(IBaseFilter* pFilter, LPCWSTR pName);
+
+public:
+ CFGManagerCustom(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra);
+};
+
+class CFGManagerPlayer : public CFGManagerCustom
+{
+protected:
+ HWND m_hWnd;
+ UINT64 m_vrmerit, m_armerit;
+
+ // IFilterGraph
+
+ STDMETHODIMP ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt);
+
+public:
+ CFGManagerPlayer(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd);
+};
+
+class CFGManagerDVD : public CFGManagerPlayer
+{
+protected:
+ // IGraphBuilder
+
+ STDMETHODIMP AddSourceFilter(LPCWSTR lpcwstrFileName, LPCWSTR lpcwstrFilterName, IBaseFilter** ppFilter);
+
+public:
+ CFGManagerDVD(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd);
+};
+
+class CFGManagerCapture : public CFGManagerPlayer
+{
+public:
+ CFGManagerCapture(LPCTSTR pName, LPUNKNOWN pUnk, UINT src, UINT tra, HWND hWnd);
+};
+
+class CFGManagerMuxer : public CFGManagerCustom
+{
+public:
+ CFGManagerMuxer(LPCTSTR pName, LPUNKNOWN pUnk);
+};
+
diff --git a/src/apps/mplayerc/FakeFilterMapper2.cpp b/src/apps/mplayerc/FakeFilterMapper2.cpp
new file mode 100644
index 000000000..216c9b2d5
--- /dev/null
+++ b/src/apps/mplayerc/FakeFilterMapper2.cpp
@@ -0,0 +1,474 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "fakefiltermapper2.h"
+#include "MacrovisionKicker.h"
+#include "..\..\..\include\detours\detours.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include <qedit.h>
+
+DETOUR_TRAMPOLINE(HRESULT WINAPI Real_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID FAR* ppv), CoCreateInstance);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCloseKey(HKEY a0), RegCloseKey);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegFlushKey(HKEY a0), RegFlushKey);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCreateKeyA(HKEY a0, LPCSTR a1, PHKEY a2), RegCreateKeyA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCreateKeyW(HKEY a0, LPCWSTR a1, PHKEY a2), RegCreateKeyW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCreateKeyExA(HKEY a0, LPCSTR a1, DWORD a2, LPSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8), RegCreateKeyExA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegCreateKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, LPWSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8), RegCreateKeyExW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegDeleteKeyA(HKEY a0, LPCSTR a1), RegDeleteKeyA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegDeleteKeyW(HKEY a0, LPCWSTR a1), RegDeleteKeyW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegDeleteValueA(HKEY a0, LPCSTR a1), RegDeleteValueA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegDeleteValueW(HKEY a0, LPCWSTR a1), RegDeleteValueW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegEnumKeyExA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPSTR a5, LPDWORD a6, struct _FILETIME* a7), RegEnumKeyExA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegEnumKeyExW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPWSTR a5, LPDWORD a6, struct _FILETIME* a7), RegEnumKeyExW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegEnumValueA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7), RegEnumValueA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegEnumValueW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7), RegEnumValueW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegOpenKeyA(HKEY a0, LPCSTR a1, PHKEY a2), RegOpenKeyA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegOpenKeyW(HKEY a0, LPCWSTR a1, PHKEY a2), RegOpenKeyW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegOpenKeyExA(HKEY a0, LPCSTR a1, DWORD a2, REGSAM a3, PHKEY a4), RegOpenKeyExA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegOpenKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, REGSAM a3, PHKEY a4), RegOpenKeyExW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryInfoKeyA(HKEY a0, LPSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11), RegQueryInfoKeyA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryInfoKeyW(HKEY a0, LPWSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11), RegQueryInfoKeyW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryValueA(HKEY a0, LPCSTR a1, LPSTR a2, PLONG a3), RegQueryValueA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryValueW(HKEY a0, LPCWSTR a1, LPWSTR a2, PLONG a3), RegQueryValueW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryValueExA(HKEY a0, LPCSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5), RegQueryValueExA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegQueryValueExW(HKEY a0, LPCWSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5), RegQueryValueExW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegSetValueA(HKEY a0, LPCSTR a1, DWORD a2, LPCSTR a3, DWORD a4), RegSetValueA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegSetValueW(HKEY a0, LPCWSTR a1, DWORD a2, LPCWSTR a3, DWORD a4), RegSetValueW);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegSetValueExA(HKEY a0, LPCSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5), RegSetValueExA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_RegSetValueExW(HKEY a0, LPCWSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5), RegSetValueExW);
+
+HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter,
+ IN DWORD dwClsContext, IN REFIID riid, OUT LPVOID FAR* ppv)
+{
+ if(CFilterMapper2::m_pFilterMapper2)
+ {
+ CheckPointer(ppv, E_POINTER);
+
+ if(rclsid == CLSID_FilterMapper)
+ {
+ ASSERT(0);
+ return REGDB_E_CLASSNOTREG; // sorry...
+ }
+
+ if(rclsid == CLSID_FilterMapper2)
+ {
+ if(pUnkOuter) return CLASS_E_NOAGGREGATION;
+
+ if(riid == __uuidof(IUnknown))
+ {
+ CFilterMapper2::m_pFilterMapper2->AddRef();
+ *ppv = (IUnknown*)CFilterMapper2::m_pFilterMapper2;
+ return S_OK;
+ }
+ else if(riid == __uuidof(IFilterMapper2))
+ {
+ CFilterMapper2::m_pFilterMapper2->AddRef();
+ *ppv = (IFilterMapper2*)CFilterMapper2::m_pFilterMapper2;
+ return S_OK;
+ }
+ else
+ {
+ return E_NOINTERFACE;
+ }
+ }
+ }
+/* else
+ {
+ if(rclsid == CLSID_FilterMapper2)
+ {
+ CFilterMapper2* pFM2 = new CFilterMapper2(true, false, pUnkOuter);
+ CComPtr<IUnknown> pUnk = (IUnknown*)pFM2;
+ return pUnk->QueryInterface(riid, ppv);
+ }
+ }
+*/
+ if(!pUnkOuter)
+ if(rclsid == CLSID_VideoMixingRenderer || rclsid == CLSID_VideoMixingRenderer9
+ || rclsid == CLSID_VideoRenderer || rclsid == CLSID_VideoRendererDefault
+ || rclsid == CLSID_OverlayMixer)// || rclsid == CLSID_OverlayMixer2 - where is this declared?)
+ {
+ CMacrovisionKicker* pMK = new CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;
+ CComPtr<IUnknown> pInner;
+ HRESULT hr;
+ if(SUCCEEDED(hr = Real_CoCreateInstance(rclsid, pUnk, dwClsContext, __uuidof(IUnknown), (void**)&pInner)))
+ {
+ pMK->SetInner(pInner);
+ return pUnk->QueryInterface(riid, ppv);
+ }
+ }
+
+ return Real_CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
+}
+
+#define FAKEHKEY (HKEY)0x12345678
+
+LONG WINAPI Mine_RegCloseKey(HKEY a0)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_SUCCESS;}
+ return Real_RegCloseKey(a0);
+}
+LONG WINAPI Mine_RegFlushKey(HKEY a0)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_SUCCESS;}
+ return Real_RegFlushKey(a0);
+}
+LONG WINAPI Mine_RegCreateKeyA(HKEY a0, LPCSTR a1, PHKEY a2)
+{
+ if(CFilterMapper2::m_pFilterMapper2) {*a2 = FAKEHKEY; return ERROR_SUCCESS;}
+ return Real_RegCreateKeyA(a0, a1, a2);
+}
+LONG WINAPI Mine_RegCreateKeyW(HKEY a0, LPCWSTR a1, PHKEY a2)
+{
+ if(CFilterMapper2::m_pFilterMapper2) {*a2 = FAKEHKEY; return ERROR_SUCCESS;}
+ return Real_RegCreateKeyW(a0, a1, a2);
+}
+LONG WINAPI Mine_RegCreateKeyExA(HKEY a0, LPCSTR a1, DWORD a2, LPSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8)
+{
+ if(CFilterMapper2::m_pFilterMapper2) {*a7 = FAKEHKEY; return ERROR_SUCCESS;}
+ return Real_RegCreateKeyExA(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+}
+LONG WINAPI Mine_RegCreateKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, LPWSTR a3, DWORD a4, REGSAM a5, LPSECURITY_ATTRIBUTES a6, PHKEY a7, LPDWORD a8)
+{
+ if(CFilterMapper2::m_pFilterMapper2) {*a7 = FAKEHKEY; return ERROR_SUCCESS;}
+ return Real_RegCreateKeyExW(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+}
+LONG WINAPI Mine_RegDeleteKeyA(HKEY a0, LPCSTR a1)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;}
+ return Real_RegDeleteKeyA(a0, a1);
+}
+LONG WINAPI Mine_RegDeleteKeyW(HKEY a0, LPCWSTR a1)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;}
+ return Real_RegDeleteKeyW(a0, a1);
+}
+LONG WINAPI Mine_RegDeleteValueA(HKEY a0, LPCSTR a1)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;}
+ return Real_RegDeleteValueA(a0, a1);
+}
+LONG WINAPI Mine_RegDeleteValueW(HKEY a0, LPCWSTR a1)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;}
+ return Real_RegDeleteValueW(a0, a1);
+}
+LONG WINAPI Mine_RegEnumKeyExA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPSTR a5, LPDWORD a6, struct _FILETIME* a7)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_NO_MORE_ITEMS;}
+ return Real_RegEnumKeyExA(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+LONG WINAPI Mine_RegEnumKeyExW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPWSTR a5, LPDWORD a6, struct _FILETIME* a7)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_NO_MORE_ITEMS;}
+ return Real_RegEnumKeyExW(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+LONG WINAPI Mine_RegEnumValueA(HKEY a0, DWORD a1, LPSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_NO_MORE_ITEMS;}
+ return Real_RegEnumValueA(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+LONG WINAPI Mine_RegEnumValueW(HKEY a0, DWORD a1, LPWSTR a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPBYTE a6, LPDWORD a7)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_NO_MORE_ITEMS;}
+ return Real_RegEnumValueW(a0, a1, a2, a3, a4, a5, a6, a7);
+}
+LONG WINAPI Mine_RegOpenKeyA(HKEY a0, LPCSTR a1, PHKEY a2)
+{
+ if(CFilterMapper2::m_pFilterMapper2) {*a2 = FAKEHKEY; return ERROR_SUCCESS;}
+ return Real_RegOpenKeyA(a0, a1, a2);
+}
+LONG WINAPI Mine_RegOpenKeyW(HKEY a0, LPCWSTR a1, PHKEY a2)
+{
+ if(CFilterMapper2::m_pFilterMapper2) {*a2 = FAKEHKEY; return ERROR_SUCCESS;}
+ return Real_RegOpenKeyW(a0, a1, a2);
+}
+LONG WINAPI Mine_RegOpenKeyExA(HKEY a0, LPCSTR a1, DWORD a2, REGSAM a3, PHKEY a4)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a3&(KEY_SET_VALUE|KEY_CREATE_SUB_KEY))) {*a4 = FAKEHKEY; return ERROR_SUCCESS;}
+ return Real_RegOpenKeyExA(a0, a1, a2, a3, a4);
+}
+LONG WINAPI Mine_RegOpenKeyExW(HKEY a0, LPCWSTR a1, DWORD a2, REGSAM a3, PHKEY a4)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a3&(KEY_SET_VALUE|KEY_CREATE_SUB_KEY))) {*a4 = FAKEHKEY; return ERROR_SUCCESS;}
+ return Real_RegOpenKeyExW(a0, a1, a2, a3, a4);
+}
+LONG WINAPI Mine_RegQueryInfoKeyA(HKEY a0, LPSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_INVALID_HANDLE;}
+ return Real_RegQueryInfoKeyA(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+}
+LONG WINAPI Mine_RegQueryInfoKeyW(HKEY a0, LPWSTR a1, LPDWORD a2, LPDWORD a3, LPDWORD a4, LPDWORD a5, LPDWORD a6, LPDWORD a7, LPDWORD a8, LPDWORD a9, LPDWORD a10, struct _FILETIME* a11)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {return ERROR_INVALID_HANDLE;}
+ return Real_RegQueryInfoKeyW(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+}
+LONG WINAPI Mine_RegQueryValueA(HKEY a0, LPCSTR a1, LPSTR a2, PLONG a3)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {*a3 = 0; return ERROR_SUCCESS;}
+ return Real_RegQueryValueA(a0, a1, a2, a3);
+}
+LONG WINAPI Mine_RegQueryValueW(HKEY a0, LPCWSTR a1, LPWSTR a2, PLONG a3)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {*a3 = 0; return ERROR_SUCCESS;}
+ return Real_RegQueryValueW(a0, a1, a2, a3);
+}
+LONG WINAPI Mine_RegQueryValueExA(HKEY a0, LPCSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {*a5 = 0; return ERROR_SUCCESS;}
+ return Real_RegQueryValueExA(a0, a1, a2, a3, a4, a5);
+}
+LONG WINAPI Mine_RegQueryValueExW(HKEY a0, LPCWSTR a1, LPDWORD a2, LPDWORD a3, LPBYTE a4, LPDWORD a5)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && a0 == FAKEHKEY) {*a5 = 0; return ERROR_SUCCESS;}
+ return Real_RegQueryValueExW(a0, a1, a2, a3, a4, a5);
+}
+LONG WINAPI Mine_RegSetValueA(HKEY a0, LPCSTR a1, DWORD a2, LPCSTR a3, DWORD a4)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;}
+ return Real_RegSetValueA(a0, a1, a2, a3, a4);
+}
+LONG WINAPI Mine_RegSetValueW(HKEY a0, LPCWSTR a1, DWORD a2, LPCWSTR a3, DWORD a4)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;}
+ return Real_RegSetValueW(a0, a1, a2, a3, a4);
+}
+LONG WINAPI Mine_RegSetValueExA(HKEY a0, LPCSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;}
+ return Real_RegSetValueExA(a0, a1, a2, a3, a4, a5);
+}
+LONG WINAPI Mine_RegSetValueExW(HKEY a0, LPCWSTR a1, DWORD a2, DWORD a3, BYTE* a4, DWORD a5)
+{
+ if(CFilterMapper2::m_pFilterMapper2 && (a0 == FAKEHKEY || (int)a0 < 0)) {return ERROR_SUCCESS;}
+ return Real_RegSetValueExW(a0, a1, a2, a3, a4, a5);
+}
+
+//
+// CFilterMapper2
+//
+
+IFilterMapper2* CFilterMapper2::m_pFilterMapper2 = NULL;
+
+bool CFilterMapper2::fInitialized = false;
+
+void CFilterMapper2::Init()
+{
+ if(!fInitialized)
+ {
+ DetourFunctionWithTrampoline((PBYTE)Real_CoCreateInstance, (PBYTE)Mine_CoCreateInstance);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegCloseKey, (PBYTE)Mine_RegCloseKey);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegFlushKey, (PBYTE)Mine_RegFlushKey);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegCreateKeyA, (PBYTE)Mine_RegCreateKeyA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegCreateKeyW, (PBYTE)Mine_RegCreateKeyW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegCreateKeyExA, (PBYTE)Mine_RegCreateKeyExA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegCreateKeyExW, (PBYTE)Mine_RegCreateKeyExW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegDeleteKeyA, (PBYTE)Mine_RegDeleteKeyA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegDeleteKeyW, (PBYTE)Mine_RegDeleteKeyW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegDeleteValueA, (PBYTE)Mine_RegDeleteValueA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegDeleteValueW, (PBYTE)Mine_RegDeleteValueW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegEnumKeyExA, (PBYTE)Mine_RegEnumKeyExA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegEnumKeyExW, (PBYTE)Mine_RegEnumKeyExW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegEnumValueA, (PBYTE)Mine_RegEnumValueA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegEnumValueW, (PBYTE)Mine_RegEnumValueW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegOpenKeyA, (PBYTE)Mine_RegOpenKeyA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegOpenKeyW, (PBYTE)Mine_RegOpenKeyW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegOpenKeyExA, (PBYTE)Mine_RegOpenKeyExA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegOpenKeyExW, (PBYTE)Mine_RegOpenKeyExW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegQueryInfoKeyA, (PBYTE)Mine_RegQueryInfoKeyA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegQueryInfoKeyW, (PBYTE)Mine_RegQueryInfoKeyW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegQueryValueA, (PBYTE)Mine_RegQueryValueA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegQueryValueW, (PBYTE)Mine_RegQueryValueW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegQueryValueExA, (PBYTE)Mine_RegQueryValueExA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegQueryValueExW, (PBYTE)Mine_RegQueryValueExW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegSetValueA, (PBYTE)Mine_RegSetValueA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegSetValueW, (PBYTE)Mine_RegSetValueW);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegSetValueExA, (PBYTE)Mine_RegSetValueExA);
+ DetourFunctionWithTrampoline((PBYTE)Real_RegSetValueExW, (PBYTE)Mine_RegSetValueExW);
+
+ fInitialized = true;
+ }
+}
+
+CFilterMapper2::CFilterMapper2(bool fRefCounted, bool fAllowUnreg, LPUNKNOWN pUnkOuter)
+ : CUnknown(NAME("CFilterMapper2"), pUnkOuter)
+ , m_fRefCounted(fRefCounted), m_fAllowUnreg(fAllowUnreg)
+{
+ m_cRef = fRefCounted ? 0 : 1;
+
+ Init();
+
+ HRESULT hr = Real_CoCreateInstance(
+ CLSID_FilterMapper2, (IUnknown*)(INonDelegatingUnknown*)this, CLSCTX_ALL,
+ __uuidof(IUnknown), (void**)&m_pFM2);
+ if(FAILED(hr) || !m_pFM2)
+ {
+ ASSERT(0);
+ return;
+ }
+}
+
+CFilterMapper2::~CFilterMapper2()
+{
+ POSITION pos = m_filters.GetHeadPosition();
+ while(pos) delete m_filters.GetNext(pos);
+}
+
+STDMETHODIMP CFilterMapper2::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ if(riid == __uuidof(IFilterMapper2))
+ return GetInterface((IFilterMapper2*)this, ppv);
+
+ HRESULT hr = m_pFM2 ? m_pFM2->QueryInterface(riid, ppv) : E_NOINTERFACE;
+
+ return
+ SUCCEEDED(hr) ? hr :
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+void CFilterMapper2::Register(CString path)
+{
+ if(HMODULE h = LoadLibrary(path))
+ {
+ typedef HRESULT (__stdcall * PDllRegisterServer)();
+ if(PDllRegisterServer p = (PDllRegisterServer)GetProcAddress(h, "DllRegisterServer"))
+ {
+ ASSERT(CFilterMapper2::m_pFilterMapper2 == NULL);
+
+ CFilterMapper2::m_pFilterMapper2 = this;
+ m_path = path;
+ p();
+ m_path.Empty();
+ CFilterMapper2::m_pFilterMapper2 = NULL;
+ }
+
+ FreeLibrary(h);
+ }
+}
+
+// IFilterMapper2
+
+STDMETHODIMP CFilterMapper2::CreateCategory(REFCLSID clsidCategory, DWORD dwCategoryMerit, LPCWSTR Description)
+{
+ if(!m_path.IsEmpty())
+ {
+ return S_OK;
+ }
+ else if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2)
+ {
+ return pFM2->CreateCategory(clsidCategory, dwCategoryMerit, Description);
+ }
+
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CFilterMapper2::UnregisterFilter(const CLSID* pclsidCategory, const OLECHAR* szInstance, REFCLSID Filter)
+{
+ if(!m_path.IsEmpty())
+ {
+ return S_OK;
+ }
+ else if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2)
+ {
+ return m_fAllowUnreg
+ ? pFM2->UnregisterFilter(pclsidCategory, szInstance, Filter)
+ : S_OK;
+ }
+
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CFilterMapper2::RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, IMoniker** ppMoniker, const CLSID* pclsidCategory, const OLECHAR* szInstance, const REGFILTER2* prf2)
+{
+ if(!m_path.IsEmpty())
+ {
+ if(FilterOverride* f = new FilterOverride)
+ {
+ f->fDisabled = false;
+ f->type = FilterOverride::EXTERNAL;
+ f->path = m_path;
+ f->name = CStringW(Name);
+ f->clsid = clsidFilter;
+ f->iLoadType = FilterOverride::MERIT;
+ f->dwMerit = prf2->dwMerit;
+
+ if(prf2->dwVersion == 1)
+ {
+ for(ULONG i = 0; i < prf2->cPins; i++)
+ {
+ const REGFILTERPINS& rgPin = prf2->rgPins[i];
+ if(rgPin.bOutput) continue;
+
+ for(UINT i = 0; i < rgPin.nMediaTypes; i++)
+ {
+ if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) break;
+ f->guids.AddTail(*rgPin.lpMediaType[i].clsMajorType);
+ f->guids.AddTail(*rgPin.lpMediaType[i].clsMinorType);
+ }
+ }
+ }
+ else if(prf2->dwVersion == 2)
+ {
+ for(ULONG i = 0; i < prf2->cPins2; i++)
+ {
+ const REGFILTERPINS2& rgPin = prf2->rgPins2[i];
+ if(rgPin.dwFlags&REG_PINFLAG_B_OUTPUT) continue;
+
+ for(UINT i = 0; i < rgPin.nMediaTypes; i++)
+ {
+ if(!rgPin.lpMediaType[i].clsMajorType || !rgPin.lpMediaType[i].clsMinorType) break;
+ f->guids.AddTail(*rgPin.lpMediaType[i].clsMajorType);
+ f->guids.AddTail(*rgPin.lpMediaType[i].clsMinorType);
+ }
+ }
+ }
+
+ f->backup.AddTailList(&f->guids);
+
+ m_filters.AddTail(f);
+ }
+
+ return S_OK;
+ }
+ else if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2)
+ {
+ return pFM2->RegisterFilter(clsidFilter, Name, ppMoniker, pclsidCategory, szInstance, prf2);
+ }
+
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CFilterMapper2::EnumMatchingFilters(IEnumMoniker** ppEnum, DWORD dwFlags, BOOL bExactMatch, DWORD dwMerit,
+ BOOL bInputNeeded, DWORD cInputTypes, const GUID* pInputTypes, const REGPINMEDIUM* pMedIn, const CLSID* pPinCategoryIn, BOOL bRender,
+ BOOL bOutputNeeded, DWORD cOutputTypes, const GUID* pOutputTypes, const REGPINMEDIUM* pMedOut, const CLSID* pPinCategoryOut)
+{
+ if(CComQIPtr<IFilterMapper2> pFM2 = m_pFM2)
+ {
+ pFM2->EnumMatchingFilters(ppEnum, dwFlags, bExactMatch, dwMerit,
+ bInputNeeded, cInputTypes, pInputTypes, pMedIn, pPinCategoryIn, bRender,
+ bOutputNeeded, cOutputTypes, pOutputTypes, pMedOut, pPinCategoryOut);
+ }
+
+ return E_NOTIMPL;
+}
diff --git a/src/apps/mplayerc/FakeFilterMapper2.h b/src/apps/mplayerc/FakeFilterMapper2.h
new file mode 100644
index 000000000..88f071cb3
--- /dev/null
+++ b/src/apps/mplayerc/FakeFilterMapper2.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+
+class FilterOverride
+{
+public:
+ bool fDisabled, fTemporary;
+ enum {REGISTERED, EXTERNAL} type;
+ // REGISTERED
+ CStringW dispname;
+ // EXTERNAL
+ CString path, name;
+ CLSID clsid;
+ // props
+ CAtlList<GUID> guids, backup;
+ enum {PREFERRED, BLOCK, MERIT};
+ int iLoadType;
+ DWORD dwMerit;
+
+ FilterOverride() {fTemporary = false;}
+ FilterOverride(FilterOverride* f)
+ {
+ fDisabled = f->fDisabled;
+ fTemporary = f->fTemporary;
+ type = f->type;
+ dispname = f->dispname;
+ path = f->path;
+ name = f->name;
+ clsid = f->clsid;
+ guids.AddTailList(&f->guids);
+ backup.AddTailList(&f->backup);
+ iLoadType = f->iLoadType;
+ dwMerit = f->dwMerit;
+ }
+};
+/*
+class CFilterMapper2 : protected CUnknown, protected IFilterMapper2
+{
+ static bool fInitialized;
+
+ CComPtr<IFilterMapper2> m_pFM2;
+ CString m_path;
+
+protected:
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IFilterMapper2
+
+ STDMETHODIMP CreateCategory(REFCLSID clsidCategory, DWORD dwCategoryMerit, LPCWSTR Description);
+ STDMETHODIMP UnregisterFilter(const CLSID* pclsidCategory, const OLECHAR* szInstance, REFCLSID Filter);
+ STDMETHODIMP RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, IMoniker** ppMoniker, const CLSID* pclsidCategory, const OLECHAR* szInstance, const REGFILTER2* prf2);
+ STDMETHODIMP EnumMatchingFilters(IEnumMoniker** ppEnum, DWORD dwFlags, BOOL bExactMatch, DWORD dwMerit,
+ BOOL bInputNeeded, DWORD cInputTypes, const GUID* pInputTypes, const REGPINMEDIUM* pMedIn, const CLSID* pPinCategoryIn, BOOL bRender,
+ BOOL bOutputNeeded, DWORD cOutputTypes, const GUID* pOutputTypes, const REGPINMEDIUM* pMedOut, const CLSID* pPinCategoryOut);
+
+public:
+ CFilterMapper2();
+ virtual ~CFilterMapper2();
+
+ static void Init();
+
+ static IFilterMapper2* m_pFilterMapper2;
+ CList<Filter*> m_filters;
+ void Register(CString path);
+};
+*/
+
+class CFilterMapper2 : protected CUnknown, public IFilterMapper2
+{
+ static bool fInitialized;
+
+ CComPtr<IUnknown> m_pFM2;
+ CString m_path;
+
+ bool m_fRefCounted, m_fAllowUnreg;
+
+protected:
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IFilterMapper2
+
+ STDMETHODIMP CreateCategory(REFCLSID clsidCategory, DWORD dwCategoryMerit, LPCWSTR Description);
+ STDMETHODIMP UnregisterFilter(const CLSID* pclsidCategory, const OLECHAR* szInstance, REFCLSID Filter);
+ STDMETHODIMP RegisterFilter(REFCLSID clsidFilter, LPCWSTR Name, IMoniker** ppMoniker, const CLSID* pclsidCategory, const OLECHAR* szInstance, const REGFILTER2* prf2);
+ STDMETHODIMP EnumMatchingFilters(IEnumMoniker** ppEnum, DWORD dwFlags, BOOL bExactMatch, DWORD dwMerit,
+ BOOL bInputNeeded, DWORD cInputTypes, const GUID* pInputTypes, const REGPINMEDIUM* pMedIn, const CLSID* pPinCategoryIn, BOOL bRender,
+ BOOL bOutputNeeded, DWORD cOutputTypes, const GUID* pOutputTypes, const REGPINMEDIUM* pMedOut, const CLSID* pPinCategoryOut);
+
+public:
+ CFilterMapper2(bool fRefCounted, bool fAllowUnreg = false, LPUNKNOWN pUnkOuter = NULL);
+ virtual ~CFilterMapper2();
+
+ void SetInner(IUnknown* pUnk) {m_pFM2 = pUnk;}
+
+ static void Init();
+
+ static IFilterMapper2* m_pFilterMapper2;
+ CList<FilterOverride*> m_filters;
+ void Register(CString path);
+};
diff --git a/src/apps/mplayerc/FavoriteAddDlg.cpp b/src/apps/mplayerc/FavoriteAddDlg.cpp
new file mode 100644
index 000000000..9ecee1fac
--- /dev/null
+++ b/src/apps/mplayerc/FavoriteAddDlg.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FavoritAddDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "FavoriteAddDlg.h"
+
+
+// CFavoriteAddDlg dialog
+
+IMPLEMENT_DYNAMIC(CFavoriteAddDlg, CCmdUIDialog)
+CFavoriteAddDlg::CFavoriteAddDlg(CString shortname, CString fullname, CWnd* pParent /*=NULL*/)
+ : CCmdUIDialog(CFavoriteAddDlg::IDD, pParent)
+ , m_shortname(shortname)
+ , m_fullname(fullname)
+ , m_fRememberPos(TRUE)
+{
+}
+
+CFavoriteAddDlg::~CFavoriteAddDlg()
+{
+}
+
+void CFavoriteAddDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO1, m_namectrl);
+ DDX_CBString(pDX, IDC_COMBO1, m_name);
+ DDX_Check(pDX, IDC_CHECK1, m_fRememberPos);
+}
+
+BOOL CFavoriteAddDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ if(!m_shortname.IsEmpty()) m_namectrl.AddString(m_shortname);
+ if(!m_fullname.IsEmpty()) m_namectrl.AddString(m_fullname);
+ m_namectrl.SetCurSel(0);
+
+ ::CorrectComboListWidth(m_namectrl, GetFont());
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+
+BEGIN_MESSAGE_MAP(CFavoriteAddDlg, CCmdUIDialog)
+ ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOk)
+END_MESSAGE_MAP()
+
+
+// CFavoriteAddDlg message handlers
+
+void CFavoriteAddDlg::OnUpdateOk(CCmdUI* pCmdUI)
+{
+ UpdateData();
+ pCmdUI->Enable(!m_name.IsEmpty());
+}
diff --git a/src/apps/mplayerc/FavoriteAddDlg.h b/src/apps/mplayerc/FavoriteAddDlg.h
new file mode 100644
index 000000000..20c1e953e
--- /dev/null
+++ b/src/apps/mplayerc/FavoriteAddDlg.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CFavoriteAddDlg dialog
+
+class CFavoriteAddDlg : public CCmdUIDialog
+{
+ DECLARE_DYNAMIC(CFavoriteAddDlg)
+
+private:
+ CString m_shortname, m_fullname;
+
+public:
+ CFavoriteAddDlg(CString shortname, CString fullname, CWnd* pParent = NULL); // standard constructor
+ virtual ~CFavoriteAddDlg();
+
+// Dialog Data
+ enum { IDD = IDD_FAVADD };
+
+ CComboBox m_namectrl;
+ CString m_name;
+ BOOL m_fRememberPos;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnUpdateOk(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/FavoriteOrganizeDlg.cpp b/src/apps/mplayerc/FavoriteOrganizeDlg.cpp
new file mode 100644
index 000000000..1d4b09a50
--- /dev/null
+++ b/src/apps/mplayerc/FavoriteOrganizeDlg.cpp
@@ -0,0 +1,284 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FavoriteOrganizeDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "FavoriteOrganizeDlg.h"
+
+
+// CFavoriteOrganizeDlg dialog
+
+//IMPLEMENT_DYNAMIC(CFavoriteOrganizeDlg, CResizableDialog)
+CFavoriteOrganizeDlg::CFavoriteOrganizeDlg(CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CFavoriteOrganizeDlg::IDD, pParent)
+{
+}
+
+CFavoriteOrganizeDlg::~CFavoriteOrganizeDlg()
+{
+}
+
+void CFavoriteOrganizeDlg::SetupList(bool fSave)
+{
+ int i = m_tab.GetCurSel();
+
+ if(fSave)
+ {
+ CAtlList<CString> sl;
+
+ for(int j = 0; j < m_list.GetItemCount(); j++)
+ {
+ CString desc = m_list.GetItemText(j, 0);
+ desc.Remove(';');
+ CString str = m_sl[i].GetAt((POSITION)m_list.GetItemData(j));
+ sl.AddTail(desc + str.Mid(str.Find(';')));
+ }
+
+ m_sl[i].RemoveAll();
+ m_sl[i].AddTailList(&sl);
+ }
+ else
+ {
+ m_list.DeleteAllItems();
+
+ POSITION pos = m_sl[i].GetHeadPosition(), tmp;
+ while(pos)
+ {
+ tmp = pos;
+ CString s = m_sl[i].GetNext(pos);
+ int i = s.Find(';');
+ if(i >= 0) s = s.Left(i);
+ m_list.SetItemData(m_list.InsertItem(m_list.GetItemCount(), s), (DWORD_PTR)tmp);
+ }
+
+ m_list.SetRedraw(FALSE);
+
+ CRect r;
+ m_list.GetClientRect(r);
+ m_list.SetColumnWidth(0, -1);
+ m_list.SetColumnWidth(0, max(m_list.GetColumnWidth(0), r.Size().cx));
+
+ m_list.SetRedraw(TRUE);
+ }
+}
+
+void CFavoriteOrganizeDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_TAB1, m_tab);
+ DDX_Control(pDX, IDC_LIST2, m_list);
+}
+
+
+BEGIN_MESSAGE_MAP(CFavoriteOrganizeDlg, CResizableDialog)
+ ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnTcnSelchangeTab1)
+ ON_WM_DRAWITEM()
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
+ ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
+ ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton7)
+ ON_NOTIFY(TCN_SELCHANGING, IDC_TAB1, OnTcnSelchangingTab1)
+ ON_BN_CLICKED(IDOK, OnBnClickedOk)
+ ON_WM_ACTIVATE()
+ ON_NOTIFY(LVN_ENDLABELEDIT, IDC_LIST2, OnLvnEndlabeleditList2)
+ ON_WM_SIZE()
+END_MESSAGE_MAP()
+
+
+// CFavoriteOrganizeDlg message handlers
+
+BOOL CFavoriteOrganizeDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ m_tab.InsertItem(0, ResStr(IDS_R_FAVFILES));
+ m_tab.InsertItem(1, ResStr(IDS_R_FAVDVDS));
+// m_tab.InsertItem(2, ResStr(IDS_R_FAVDEVICES));
+ m_tab.SetCurSel(0);
+
+ m_list.InsertColumn(0, _T(""));
+ m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
+
+ AfxGetAppSettings().GetFav(FAV_FILE, m_sl[0]);
+ AfxGetAppSettings().GetFav(FAV_DVD, m_sl[1]);
+ AfxGetAppSettings().GetFav(FAV_DEVICE, m_sl[2]);
+
+ SetupList(false);
+
+ AddAnchor(IDC_TAB1, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_LIST2, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON1, TOP_RIGHT);
+ AddAnchor(IDC_BUTTON2, TOP_RIGHT);
+ AddAnchor(IDC_BUTTON3, TOP_RIGHT);
+ AddAnchor(IDC_BUTTON4, TOP_RIGHT);
+ AddAnchor(IDOK, BOTTOM_RIGHT);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CFavoriteOrganizeDlg::OnTcnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ SetupList(false);
+
+ m_list.SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+
+ *pResult = 0;
+}
+
+void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
+{
+ if(nIDCtl != IDC_LIST2) return;
+
+ int nItem = lpDrawItemStruct->itemID;
+ CRect rcItem = lpDrawItemStruct->rcItem;
+
+ CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
+
+ if(!!m_list.GetItemState(nItem, LVIS_SELECTED))
+ {
+ FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
+ FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
+ }
+ else
+ {
+ CBrush b;
+ b.CreateSysColorBrush(COLOR_WINDOW);
+ FillRect(pDC->m_hDC, rcItem, b);
+ }
+
+ CString str = m_list.GetItemText(nItem, 0);
+
+ pDC->SetTextColor(0);
+ pDC->TextOut(rcItem.left+3, (rcItem.top+rcItem.bottom - pDC->GetTextExtent(str).cy)/2, str);
+}
+
+void CFavoriteOrganizeDlg::OnBnClickedButton1()
+{
+ if(POSITION pos = m_list.GetFirstSelectedItemPosition())
+ {
+ m_list.SetFocus();
+ m_list.EditLabel(m_list.GetNextSelectedItem(pos));
+ }
+}
+
+void CFavoriteOrganizeDlg::OnLvnEndlabeleditList2(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ NMLVDISPINFO* pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
+ if(pDispInfo->item.iItem >= 0 && pDispInfo->item.pszText)
+ m_list.SetItemText(pDispInfo->item.iItem, 0, pDispInfo->item.pszText);
+ *pResult = 0;
+}
+
+void CFavoriteOrganizeDlg::OnBnClickedButton2()
+{
+ if(POSITION pos = m_list.GetFirstSelectedItemPosition())
+ {
+ int nItem = m_list.GetNextSelectedItem(pos);
+ if(nItem < 0 || nItem >= m_list.GetItemCount()) return;
+
+ m_list.DeleteItem(nItem);
+
+ nItem = min(nItem, m_list.GetItemCount()-1);
+
+ m_list.SetSelectionMark(nItem);
+ m_list.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED);
+ }
+}
+
+void CFavoriteOrganizeDlg::OnBnClickedButton3()
+{
+ if(POSITION pos = m_list.GetFirstSelectedItemPosition())
+ {
+ int nItem = m_list.GetNextSelectedItem(pos);
+ if(nItem <= 0) return;
+
+ DWORD_PTR data = m_list.GetItemData(nItem);
+ CString str = m_list.GetItemText(nItem, 0);
+
+ m_list.DeleteItem(nItem);
+
+ nItem--;
+
+ m_list.InsertItem(nItem, str);
+ m_list.SetItemData(nItem, data);
+ m_list.SetSelectionMark(nItem);
+ m_list.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED);
+ }
+}
+
+void CFavoriteOrganizeDlg::OnBnClickedButton7()
+{
+ if(POSITION pos = m_list.GetFirstSelectedItemPosition())
+ {
+ int nItem = m_list.GetNextSelectedItem(pos);
+ if(nItem < 0 || nItem >= m_list.GetItemCount()-1) return;
+
+ DWORD_PTR data = m_list.GetItemData(nItem);
+ CString str = m_list.GetItemText(nItem, 0);
+
+ m_list.DeleteItem(nItem);
+
+ nItem++;
+
+ m_list.InsertItem(nItem, str);
+ m_list.SetItemData(nItem, data);
+ m_list.SetSelectionMark(nItem);
+ m_list.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED);
+ }
+}
+
+void CFavoriteOrganizeDlg::OnTcnSelchangingTab1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ SetupList(true);
+
+ *pResult = 0;
+}
+
+void CFavoriteOrganizeDlg::OnBnClickedOk()
+{
+ SetupList(true);
+
+ AfxGetAppSettings().SetFav(FAV_FILE, m_sl[0]);
+ AfxGetAppSettings().SetFav(FAV_DVD, m_sl[1]);
+ AfxGetAppSettings().SetFav(FAV_DEVICE, m_sl[2]);
+
+ OnOK();
+}
+
+void CFavoriteOrganizeDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
+{
+ __super::OnActivate(nState, pWndOther, bMinimized);
+
+ if(nState == WA_ACTIVE)
+ m_list.SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+}
+
+void CFavoriteOrganizeDlg::OnSize(UINT nType, int cx, int cy)
+{
+ __super::OnSize(nType, cx, cy);
+
+ if(IsWindow(m_list))
+ m_list.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
+}
diff --git a/src/apps/mplayerc/FavoriteOrganizeDlg.h b/src/apps/mplayerc/FavoriteOrganizeDlg.h
new file mode 100644
index 000000000..59c1be17f
--- /dev/null
+++ b/src/apps/mplayerc/FavoriteOrganizeDlg.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxcmn.h"
+#include "afxwin.h"
+#include "..\..\ui\ResizableLib\ResizableDialog.h"
+
+
+// CFavoriteOrganizeDlg dialog
+
+class CFavoriteOrganizeDlg : public CResizableDialog
+{
+// DECLARE_DYNAMIC(CFavoriteOrganizeDlg)
+
+private:
+ CAtlList<CString> m_sl[3];
+ void SetupList(bool fSave);
+
+public:
+ CFavoriteOrganizeDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~CFavoriteOrganizeDlg();
+
+// Dialog Data
+ enum { IDD = IDD_FAVORGANIZE };
+
+ CTabCtrl m_tab;
+ CListCtrl m_list;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnTcnSelchangeTab1(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnBnClickedButton2();
+ afx_msg void OnBnClickedButton3();
+ afx_msg void OnBnClickedButton7();
+ afx_msg void OnTcnSelchangingTab1(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnBnClickedOk();
+ afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
+ afx_msg void OnLvnEndlabeleditList2(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+};
diff --git a/src/apps/mplayerc/FileDropTarget.cpp b/src/apps/mplayerc/FileDropTarget.cpp
new file mode 100644
index 000000000..4243d82eb
--- /dev/null
+++ b/src/apps/mplayerc/FileDropTarget.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// FileDropTarget.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "FileDropTarget.h"
+
+
+// CFileDropTarget
+
+//IMPLEMENT_DYNAMIC(CFileDropTarget, COleDropTarget)
+CFileDropTarget::CFileDropTarget(CDropTarget* pDropTarget)
+ : m_pDropTarget(pDropTarget)
+{
+ ASSERT(m_pDropTarget);
+}
+
+CFileDropTarget::~CFileDropTarget()
+{
+}
+
+DROPEFFECT CFileDropTarget::OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+ return m_pDropTarget ? m_pDropTarget->OnDragEnter(pDataObject, dwKeyState, point) : DROPEFFECT_NONE;
+}
+
+DROPEFFECT CFileDropTarget::OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+ return m_pDropTarget ? m_pDropTarget->OnDragOver(pDataObject, dwKeyState, point) : DROPEFFECT_NONE;
+}
+
+BOOL CFileDropTarget::OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
+{
+ return m_pDropTarget ? m_pDropTarget->OnDrop(pDataObject, dropEffect, point) : DROPEFFECT_NONE;
+}
+
+DROPEFFECT CFileDropTarget::OnDropEx(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point)
+{
+ return m_pDropTarget ? m_pDropTarget->OnDropEx(pDataObject, dropDefault, dropList, point) : DROPEFFECT_NONE;
+}
+
+void CFileDropTarget::OnDragLeave(CWnd* pWnd)
+{
+ if(m_pDropTarget) m_pDropTarget->OnDragLeave();
+}
+
+DROPEFFECT CFileDropTarget::OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point)
+{
+ return m_pDropTarget ? m_pDropTarget->OnDragScroll(dwKeyState, point) : DROPEFFECT_NONE;
+}
+
+BEGIN_MESSAGE_MAP(CFileDropTarget, COleDropTarget)
+END_MESSAGE_MAP()
+
+
+
+// CFileDropTarget message handlers
diff --git a/src/apps/mplayerc/FileDropTarget.h b/src/apps/mplayerc/FileDropTarget.h
new file mode 100644
index 000000000..79db45449
--- /dev/null
+++ b/src/apps/mplayerc/FileDropTarget.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <afxole.h>
+
+class CDropTarget
+{
+public:
+ CDropTarget() {}
+
+ virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) {return DROPEFFECT_NONE;}
+ virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) {return DROPEFFECT_NONE;}
+ virtual BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point) {return FALSE;}
+ virtual DROPEFFECT OnDropEx(COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point) {return (DROPEFFECT)-1;}
+ virtual void OnDragLeave() {}
+ virtual DROPEFFECT OnDragScroll(DWORD dwKeyState, CPoint point) {return DROPEFFECT_NONE;}
+};
+
+// CFileDropTarget command target
+
+class CFileDropTarget : public COleDropTarget
+{
+// DECLARE_DYNAMIC(CFileDropTarget)
+
+private:
+ CDropTarget* m_pDropTarget;
+
+public:
+ CFileDropTarget(CDropTarget* pDropTarget);
+ virtual ~CFileDropTarget();
+
+protected:
+ DECLARE_MESSAGE_MAP()
+
+ DROPEFFECT OnDragEnter(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+ DROPEFFECT OnDragOver(CWnd* pWnd, COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+ BOOL OnDrop(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+ DROPEFFECT OnDropEx(CWnd* pWnd, COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point);
+ void OnDragLeave(CWnd* pWnd);
+ DROPEFFECT OnDragScroll(CWnd* pWnd, DWORD dwKeyState, CPoint point);
+};
+
+
diff --git a/src/apps/mplayerc/FloatEdit.cpp b/src/apps/mplayerc/FloatEdit.cpp
new file mode 100644
index 000000000..f437d89ea
--- /dev/null
+++ b/src/apps/mplayerc/FloatEdit.cpp
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "floatedit.h"
+
+// CFloatEdit
+
+IMPLEMENT_DYNAMIC(CFloatEdit, CEdit)
+
+bool CFloatEdit::GetFloat(float& f)
+{
+ CString s;
+ GetWindowText(s);
+ return(_stscanf(s, _T("%f"), &f) == 1);
+}
+
+double CFloatEdit::operator = (double d)
+{
+ CString s;
+ s.Format(_T("%.4f"), d);
+ SetWindowText(s);
+ return(d);
+}
+
+CFloatEdit::operator double()
+{
+ CString s;
+ GetWindowText(s);
+ float f;
+ return(_stscanf(s, _T("%f"), &f) == 1 ? f : 0);
+}
+
+BEGIN_MESSAGE_MAP(CFloatEdit, CEdit)
+ ON_WM_CHAR()
+END_MESSAGE_MAP()
+
+void CFloatEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ if(!(nChar >= '0' && nChar <= '9' || nChar == '.' || nChar == '\b'))
+ return;
+
+ CString str;
+ GetWindowText(str);
+
+ if(nChar == '.' && (str.Find('.') >= 0 || str.IsEmpty()))
+ return;
+
+ int nStartChar, nEndChar;
+ GetSel(nStartChar, nEndChar);
+
+ if(nChar == '\b' && nStartChar <= 0)
+ return;
+
+ CEdit::OnChar(nChar, nRepCnt, nFlags);
+}
+
+// CIntEdit
+
+IMPLEMENT_DYNAMIC(CIntEdit, CEdit)
+
+BEGIN_MESSAGE_MAP(CIntEdit, CEdit)
+ ON_WM_CHAR()
+END_MESSAGE_MAP()
+
+void CIntEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ if(!(nChar >= '0' && nChar <= '9' || nChar == '-' || nChar == '\b'))
+ return;
+
+ CString str;
+ GetWindowText(str);
+
+ if(nChar == '-' && !str.IsEmpty() && str[0] == '-')
+ return;
+
+ int nStartChar, nEndChar;
+ GetSel(nStartChar, nEndChar);
+
+ if(nChar == '\b' && nStartChar <= 0)
+ return;
+
+ if(nChar == '-' && (nStartChar != 0 || nEndChar != 0))
+ return;
+
+ CEdit::OnChar(nChar, nRepCnt, nFlags);
+}
+
+// CHexEdit
+
+IMPLEMENT_DYNAMIC(CHexEdit, CEdit)
+
+bool CHexEdit::GetDWORD(DWORD& dw)
+{
+ CString s;
+ GetWindowText(s);
+ return(_stscanf(s, _T("%x"), &dw) == 1);
+}
+
+DWORD CHexEdit::operator = (DWORD dw)
+{
+ CString s;
+ s.Format(_T("%08x"), dw);
+ SetWindowText(s);
+ return(dw);
+}
+
+CHexEdit::operator DWORD()
+{
+ CString s;
+ GetWindowText(s);
+ DWORD dw;
+ return(_stscanf(s, _T("%x"), &dw) == 1 ? dw : 0);
+}
+
+BEGIN_MESSAGE_MAP(CHexEdit, CEdit)
+ ON_WM_CHAR()
+END_MESSAGE_MAP()
+
+void CHexEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ if(!(nChar >= 'A' && nChar <= 'F' || nChar >= 'a' && nChar <= 'f'
+ || nChar >= '0' && nChar <= '9' || nChar == '\b'))
+ return;
+
+ CString str;
+ GetWindowText(str);
+
+ int nStartChar, nEndChar;
+ GetSel(nStartChar, nEndChar);
+
+ if(nChar == '\b' && nStartChar <= 0)
+ return;
+
+ if(nChar != '\b' && nEndChar - nStartChar == 0 && str.GetLength() >= 8)
+ return;
+
+ CEdit::OnChar(nChar, nRepCnt, nFlags);
+}
diff --git a/src/apps/mplayerc/FloatEdit.h b/src/apps/mplayerc/FloatEdit.h
new file mode 100644
index 000000000..8abb97582
--- /dev/null
+++ b/src/apps/mplayerc/FloatEdit.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CFloatEdit
+
+class CFloatEdit : public CEdit
+{
+public:
+ bool GetFloat(float& f);
+ double operator = (double d);
+ operator double();
+
+ DECLARE_DYNAMIC(CFloatEdit)
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+};
+
+// CIntEdit
+
+class CIntEdit : public CEdit
+{
+public:
+ DECLARE_DYNAMIC(CIntEdit)
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+};
+
+// CHexEdit
+
+class CHexEdit : public CEdit
+{
+public:
+ bool GetDWORD(DWORD& dw);
+ DWORD operator = (DWORD dw);
+ operator DWORD();
+
+ DECLARE_DYNAMIC(CHexEdit)
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+};
diff --git a/src/apps/mplayerc/FullscreenWnd.cpp b/src/apps/mplayerc/FullscreenWnd.cpp
new file mode 100644
index 000000000..bf76a4a84
--- /dev/null
+++ b/src/apps/mplayerc/FullscreenWnd.cpp
@@ -0,0 +1,103 @@
+// FullscreenWnd.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "FullscreenWnd.h"
+#include "MainFrm.h"
+#include ".\fullscreenwnd.h"
+
+
+// CFullscreenWnd
+
+IMPLEMENT_DYNAMIC(CFullscreenWnd, CWnd)
+CFullscreenWnd::CFullscreenWnd(CMainFrame* pMainFrame)
+{
+ m_pMainFrame = pMainFrame;
+ m_hCursor = ::LoadCursor(NULL, IDC_HAND);
+ m_bCursorVisible = false;
+}
+
+CFullscreenWnd::~CFullscreenWnd()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CFullscreenWnd, CWnd)
+ ON_WM_ERASEBKGND()
+ ON_WM_SETCURSOR()
+END_MESSAGE_MAP()
+
+
+
+BOOL CFullscreenWnd::PreTranslateMessage(MSG* pMsg)
+{
+ switch (pMsg->message)
+ {
+ case WM_MOUSEMOVE :
+ case WM_SYSKEYDOWN :
+ case WM_SYSKEYUP :
+ case WM_SYSCHAR :
+ case WM_SYSCOMMAND :
+
+ case WM_KEYDOWN :
+ case WM_KEYUP :
+ case WM_CHAR :
+
+ case WM_LBUTTONDOWN :
+ case WM_LBUTTONUP :
+ case WM_LBUTTONDBLCLK :
+ case WM_MBUTTONDOWN :
+ case WM_MBUTTONUP :
+ case WM_MBUTTONDBLCLK :
+ case WM_RBUTTONDOWN :
+ case WM_RBUTTONUP :
+ case WM_RBUTTONDBLCLK :
+
+ case WM_MOUSEWHEEL :
+
+ m_pMainFrame->PostMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
+ break;
+ }
+
+ return CWnd::PreTranslateMessage(pMsg);
+}
+
+
+BOOL CFullscreenWnd::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!CWnd::PreCreateWindow(cs))
+ return FALSE;
+
+ cs.style &= ~WS_BORDER;
+ cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, m_hCursor, HBRUSH(COLOR_WINDOW+1), NULL);
+
+ return TRUE;
+}
+
+// CFullscreenWnd message handlers
+
+
+BOOL CFullscreenWnd::OnEraseBkgnd(CDC* pDC)
+{
+ return false;
+}
+
+BOOL CFullscreenWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
+{
+ if (m_bCursorVisible)
+ ::SetCursor(m_hCursor);
+ else
+ ::SetCursor(NULL);
+ return FALSE;
+}
+
+
+void CFullscreenWnd::ShowCursor(bool bVisible)
+{
+ if (m_bCursorVisible != bVisible)
+ {
+ m_bCursorVisible = bVisible;
+ PostMessage (WM_SETCURSOR,0,0);
+ }
+}
diff --git a/src/apps/mplayerc/FullscreenWnd.h b/src/apps/mplayerc/FullscreenWnd.h
new file mode 100644
index 000000000..462e7f4fd
--- /dev/null
+++ b/src/apps/mplayerc/FullscreenWnd.h
@@ -0,0 +1,32 @@
+#pragma once
+
+
+// CFullscreenWnd
+
+class CMainFrame;
+
+class CFullscreenWnd : public CWnd
+{
+ DECLARE_DYNAMIC(CFullscreenWnd)
+
+public:
+ CFullscreenWnd(CMainFrame* pMainFrame);
+ virtual ~CFullscreenWnd();
+
+ void ShowCursor(bool bVisible);
+
+protected:
+ DECLARE_MESSAGE_MAP()
+
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ CMainFrame* m_pMainFrame;
+ HCURSOR m_hCursor;
+ bool m_bCursorVisible;
+public:
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+};
+
+
diff --git a/src/apps/mplayerc/GoToDlg.cpp b/src/apps/mplayerc/GoToDlg.cpp
new file mode 100644
index 000000000..aebe09d46
--- /dev/null
+++ b/src/apps/mplayerc/GoToDlg.cpp
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// GoToDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "GoToDlg.h"
+
+#include <atlrx.h>
+
+
+// CGoToDlg dialog
+
+IMPLEMENT_DYNAMIC(CGoToDlg, CDialog)
+CGoToDlg::CGoToDlg(int time, float fps, CWnd* pParent /*=NULL*/)
+ : CDialog(CGoToDlg::IDD, pParent)
+ , m_timestr(_T(""))
+ , m_framestr(_T(""))
+ , m_time(time)
+ , m_fps(fps)
+{
+ if(m_fps == 0)
+ {
+ CString str = AfxGetApp()->GetProfileString(ResStr(IDS_R_SETTINGS), _T("fps"), _T("0"));
+ if(_stscanf(str, _T("%f"), &m_fps) != 1) m_fps = 0;
+ }
+}
+
+CGoToDlg::~CGoToDlg()
+{
+}
+
+void CGoToDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ DDX_Text(pDX, IDC_EDIT1, m_timestr);
+ DDX_Text(pDX, IDC_EDIT2, m_framestr);
+ DDX_Control(pDX, IDC_EDIT1, m_timeedit);
+ DDX_Control(pDX, IDC_EDIT2, m_frameedit);
+}
+
+BOOL CGoToDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ if(m_time >= 0)
+ {
+ m_timestr.Format(_T("%02d:%02d:%02d.%03d"),
+ (m_time/(1000*60*60))%60, (m_time/(1000*60))%60, (m_time/1000)%60, m_time%1000);
+
+ if(m_fps > 0)
+ {
+ m_framestr.Format(_T("%d, %.3f"), (int)(m_fps*m_time/1000), m_fps);
+ }
+
+ UpdateData(FALSE);
+
+ switch(AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("gotoluf"), 0))
+ {
+ default:
+ case 0: m_timeedit.SetFocus(); m_timeedit.SetSel(0, 0); break;
+ case 1: m_frameedit.SetFocus(); m_frameedit.SetSel(0, m_framestr.Find(',')); break;
+ }
+
+ }
+
+ return FALSE;
+
+// return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+
+BEGIN_MESSAGE_MAP(CGoToDlg, CDialog)
+ ON_BN_CLICKED(IDC_OK1, OnBnClickedOk1)
+ ON_BN_CLICKED(IDC_OK2, OnBnClickedOk2)
+END_MESSAGE_MAP()
+
+
+// CGoToDlg message handlers
+
+void CGoToDlg::OnBnClickedOk1()
+{
+ UpdateData();
+
+ int hh, mm, ss, ms;
+ hh = mm = ss = ms = 0;
+
+ CAtlRegExp<> re;
+
+ REParseError status = re.Parse(_T("{\\z}"), FALSE);
+ if(REPARSE_ERROR_OK == status)
+ {
+ CAtlREMatchContext<> mc;
+ const CAtlREMatchContext<>::RECHAR* s = m_timestr.GetBuffer();
+ const CAtlREMatchContext<>::RECHAR* e = NULL;
+ while(s && re.Match(s, &mc, &e))
+ {
+ const CAtlREMatchContext<>::RECHAR* szStart = 0;
+ const CAtlREMatchContext<>::RECHAR* szEnd = 0;
+ mc.GetMatch(0, &szStart, &szEnd);
+
+ if(hh != 0 || hh > 59 || mm > 59 || ss > 59)
+ {
+ AfxMessageBox(_T("Error parsing entered time!"));
+ return;
+ }
+
+ hh = mm;
+ mm = ss;
+ ss = ms;
+ ms = _tcstol(szStart, (TCHAR**)&szStart, 10);
+
+ s = e;
+ }
+
+ m_time = ((hh*60+mm)*60+ss)*1000+ms;
+
+ AfxGetApp()->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("gotoluf"), 0);
+
+ OnOK();
+ }
+}
+
+
+void CGoToDlg::OnBnClickedOk2()
+{
+ UpdateData();
+
+ int frame = 0;
+ float fps = 0;
+
+ CAtlRegExp<> re;
+
+ REParseError status = re.Parse(_T("{\\z}[^0-9\\.]+{[0-9\\.]+}"), FALSE);
+ if(REPARSE_ERROR_OK == status)
+ {
+ CAtlREMatchContext<> mc;
+ const CAtlREMatchContext<>::RECHAR* s = m_framestr.GetBuffer();
+ const CAtlREMatchContext<>::RECHAR* e = NULL;
+ if(re.Match(s, &mc, &e))
+ {
+ const CAtlREMatchContext<>::RECHAR* szStart = 0;
+ const CAtlREMatchContext<>::RECHAR* szEnd = 0;
+
+ mc.GetMatch(0, &szStart, &szEnd);
+ frame = _tcstol(szStart, (TCHAR**)&szStart, 10);
+
+ mc.GetMatch(1, &szStart, &szEnd);
+ if(_stscanf(szStart, _T("%f"), &fps) != 1) fps = 0;
+ else AfxGetApp()->WriteProfileString(ResStr(IDS_R_SETTINGS), _T("fps"), szStart);
+ }
+ else
+ {
+ AfxMessageBox(_T("Error parsing entered text!"));
+ return;
+ }
+
+ if(fps == 0)
+ {
+ AfxMessageBox(_T("Error parsing entered frame-rate!"));
+ return;
+ }
+
+ m_time = (int)(1000.0*frame/fps) + 1;
+
+ AfxGetApp()->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("gotoluf"), 1);
+
+ OnOK();
+ }
+}
+
+BOOL CGoToDlg::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
+ {
+ if(*GetFocus() == m_timeedit) OnBnClickedOk1();
+ else if(*GetFocus() == m_frameedit) OnBnClickedOk2();
+
+ return TRUE;
+ }
+
+ return __super::PreTranslateMessage(pMsg);
+}
diff --git a/src/apps/mplayerc/GoToDlg.h b/src/apps/mplayerc/GoToDlg.h
new file mode 100644
index 000000000..c0a653344
--- /dev/null
+++ b/src/apps/mplayerc/GoToDlg.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxwin.h"
+
+// CGoToDlg dialog
+
+class CGoToDlg : public CDialog
+{
+ DECLARE_DYNAMIC(CGoToDlg)
+
+public:
+ CGoToDlg(int time = -1, float fps = 0, CWnd* pParent = NULL); // standard constructor
+ virtual ~CGoToDlg();
+
+ CString m_timestr;
+ CString m_framestr;
+ CEdit m_timeedit;
+ CEdit m_frameedit;
+
+ int m_time;
+ float m_fps;
+
+// Dialog Data
+ enum { IDD = IDD_GOTO_DLG };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedOk1();
+ afx_msg void OnBnClickedOk2();
+};
diff --git a/src/apps/mplayerc/History.txt b/src/apps/mplayerc/History.txt
new file mode 100644
index 000000000..3dc5b3964
--- /dev/null
+++ b/src/apps/mplayerc/History.txt
@@ -0,0 +1,38 @@
+=== v1.0.5.0 - //2006
+- Correction bug le curseur souris n'était pas caché en lisant des fichiers
+- Correction bug le fait de cliquer sur le slider de l'OSD effectuait égalemetn l'action "play/pause"
+
+=== v1.0.4.0 - 09/05/2006
+- Complément de l'OSD
+ * temp restant / temps total sur l'OSD (Ctrl+I, ou bien "Remaining_Time" pour WinLIRC)
+ * affiche la vitesse accélérée avant et arrière
+- Correction bug d'affichage de la barre de tâche qui perturbait le mode D3D fullscreen
+- Modification de la gestion du fast forward / rewind pour les DVD : plus de vitesse avant lente, et suppression des vitesses maximale avant et arrière (désormais fonction des possibilités du décodeur utilisé).
+- Cache le curseur souris après quelques secondes en mode D3D fullscreen
+
+
+=== v1.0.3.0 - 02/05/2006
+- Correction d'un bug sur l'aspect ratio non respecté en fullscreen D3D
+- Ajout du mode Mixer YUV pour le VMR9 et d'une partie des fonctionnalités de la version 6.4.9.0 officielle (les build-in filter ne sont pas a jour)
+- Première version de l'OSD pour le VMR9, avec pour l'instant le slider et l'affichage du choix des langues et sous-titres pour les DVD
+- La fonction "DVD Menu Activate" active la lecture de la vidéo si l'on est pas dans le menu (pratique une utilisation avec télécommande via WinLirc)
+
+
+=== v1.0.2.0 - 23/04/2006
+- Amélioration du mode Fullscreen Direct 3D avec le VMR9
+- Correction bugs sur le réglage des couleur du VMR9. Ces réglages fonctionnent maintenant en Renderless et en Windowless.
+
+
+=== v1.0.1.0 - 09/04/2006
+- Amélioration de l'ouverture d'un DVD (boîte de dialogue pour choisir le répertoire source)
+- Possibilité de sauvegarder de la position de lecture pour les 5 derniers DVD et les 5 derniers fichier lus (reprend la lecture a cet endroit au lancement). Options a cocher dans les options "Casimir".
+- Ajout d'un raccourcit clavier pour activer ou desactiver rapidement les Pixels Shaders (Ctrl+P)
+- Si l'option "remember window size" est activée, passe MPC en fullscreen au lancement le cas échéant
+- Le fullscreen sur l'écran secondaire est remplacé par l'option "Direct3D Fullscreen" qui permet de supprimer le tearing. Attention cette fonction est beta pour le moment!
+
+
+==== v1.0.0.0 - 29/03/2006
+- Option pour avoir la vidéo systématiquement en full screen sur l'écran secondaire mais en conservant les contrôles sur le principal
+- Réglage contraste / luminosité / hue / saturation pour le VMR renderless en "mixer mode"
+- Rechargement des Pixels Shaders au lancement
+- Fonction de "Tearing test" fonctionnant en VRM9 renderless (Ctrl+T) \ No newline at end of file
diff --git a/src/apps/mplayerc/IGraphBuilder2.h b/src/apps/mplayerc/IGraphBuilder2.h
new file mode 100644
index 000000000..5da815ef2
--- /dev/null
+++ b/src/apps/mplayerc/IGraphBuilder2.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+[uuid("165BE9D6-0929-4363-9BA3-580D735AA0F6")]
+interface IGraphBuilder2 : public IFilterGraph2
+{
+ STDMETHOD(IsPinDirection) (IPin* pPin, PIN_DIRECTION dir) = 0;
+ STDMETHOD(IsPinConnected) (IPin* pPin) = 0;
+ STDMETHOD(ConnectFilter) (IBaseFilter* pBF, IPin* pPinIn) = 0;
+ STDMETHOD(ConnectFilter) (IPin* pPinOut, IBaseFilter* pBF) = 0;
+ STDMETHOD(ConnectFilterDirect) (IPin* pPinOut, IBaseFilter* pBF, const AM_MEDIA_TYPE* pmt) = 0;
+ STDMETHOD(NukeDownstream) (IUnknown* pUnk) = 0;
+ STDMETHOD(FindInterface) (REFIID iid, void** ppv, BOOL bRemove) = 0;
+ STDMETHOD(AddToROT) () = 0;
+ STDMETHOD(RemoveFromROT) () = 0;
+};
+
+// private use only
+[uuid("43CDA93D-6A4E-4A07-BD3E-49D161073EE7")]
+interface IGraphBuilderDeadEnd : public IUnknown
+{
+ STDMETHOD_(size_t, GetCount)() = 0;
+ STDMETHOD(GetDeadEnd) (int iIndex, CAtlList<CStringW>& path, CAtlList<CMediaType>& mts) = 0;
+}; \ No newline at end of file
diff --git a/src/apps/mplayerc/IPinHook.cpp b/src/apps/mplayerc/IPinHook.cpp
new file mode 100644
index 000000000..9721c0d2c
--- /dev/null
+++ b/src/apps/mplayerc/IPinHook.cpp
@@ -0,0 +1,475 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "IPinHook.h"
+
+REFERENCE_TIME g_tSegmentStart = 0;
+REFERENCE_TIME g_tSampleStart = 0;
+
+static HRESULT (STDMETHODCALLTYPE * NewSegmentOrg)(IPinC * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate) = NULL;
+
+static HRESULT STDMETHODCALLTYPE NewSegmentMine(IPinC * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate)
+{
+ g_tSegmentStart = tStart;
+ return NewSegmentOrg(This, tStart, tStop, dRate);
+}
+
+static HRESULT ( STDMETHODCALLTYPE *ReceiveOrg )( IMemInputPinC * This, IMediaSample *pSample) = NULL;
+
+static HRESULT STDMETHODCALLTYPE ReceiveMine(IMemInputPinC * This, IMediaSample *pSample)
+{
+ REFERENCE_TIME rtStart, rtStop;
+ if(pSample && SUCCEEDED(pSample->GetTime(&rtStart, &rtStop)))
+ g_tSampleStart = rtStart;
+ return ReceiveOrg(This, pSample);
+}
+
+bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPinC)
+{
+ if(!pPinC || !pMemInputPinC || (GetVersion()&0x80000000))
+ return false;
+
+ g_tSegmentStart = 0;
+ g_tSampleStart = 0;
+
+ BOOL res;
+ DWORD flOldProtect = 0;
+
+ res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinC), PAGE_WRITECOPY, &flOldProtect);
+ if(NewSegmentOrg == NULL) NewSegmentOrg = pPinC->lpVtbl->NewSegment;
+ pPinC->lpVtbl->NewSegment = NewSegmentMine;
+ res = VirtualProtect(pPinC->lpVtbl, sizeof(IPinC), PAGE_EXECUTE, &flOldProtect);
+
+ res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinC), PAGE_WRITECOPY, &flOldProtect);
+ if(ReceiveOrg == NULL) ReceiveOrg = pMemInputPinC->lpVtbl->Receive;
+ pMemInputPinC->lpVtbl->Receive = ReceiveMine;
+ res = VirtualProtect(pMemInputPinC->lpVtbl, sizeof(IMemInputPinC), PAGE_EXECUTE, &flOldProtect);
+
+ return true;
+}
+
+static HRESULT ( STDMETHODCALLTYPE *GetVideoAcceleratorGUIDsOrg )( IAMVideoAcceleratorC * This,/* [out][in] */ LPDWORD pdwNumGuidsSupported,/* [out][in] */ LPGUID pGuidsSupported) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *GetUncompFormatsSupportedOrg )( IAMVideoAcceleratorC * This,/* [in] */ const GUID *pGuid,/* [out][in] */ LPDWORD pdwNumFormatsSupported,/* [out][in] */ LPDDPIXELFORMAT pFormatsSupported) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *GetInternalMemInfoOrg )( IAMVideoAcceleratorC * This,/* [in] */ const GUID *pGuid,/* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,/* [out][in] */ LPAMVAInternalMemInfo pamvaInternalMemInfo) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *GetCompBufferInfoOrg )( IAMVideoAcceleratorC * This,/* [in] */ const GUID *pGuid,/* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,/* [out][in] */ LPDWORD pdwNumTypesCompBuffers,/* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *GetInternalCompBufferInfoOrg )( IAMVideoAcceleratorC * This,/* [out][in] */ LPDWORD pdwNumTypesCompBuffers,/* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *BeginFrameOrg )( IAMVideoAcceleratorC * This,/* [in] */ const AMVABeginFrameInfo *amvaBeginFrameInfo) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *EndFrameOrg )( IAMVideoAcceleratorC * This,/* [in] */ const AMVAEndFrameInfo *pEndFrameInfo) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *GetBufferOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwTypeIndex,/* [in] */ DWORD dwBufferIndex,/* [in] */ BOOL bReadOnly,/* [out] */ LPVOID *ppBuffer,/* [out] */ LONG *lpStride) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *ReleaseBufferOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwTypeIndex,/* [in] */ DWORD dwBufferIndex) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *ExecuteOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwFunction,/* [in] */ LPVOID lpPrivateInputData,/* [in] */ DWORD cbPrivateInputData,/* [in] */ LPVOID lpPrivateOutputDat,/* [in] */ DWORD cbPrivateOutputData,/* [in] */ DWORD dwNumBuffers,/* [in] */ const AMVABUFFERINFO *pamvaBufferInfo) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *QueryRenderStatusOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwTypeIndex,/* [in] */ DWORD dwBufferIndex,/* [in] */ DWORD dwFlags) = NULL;
+static HRESULT ( STDMETHODCALLTYPE *DisplayFrameOrg )( IAMVideoAcceleratorC * This,/* [in] */ DWORD dwFlipToIndex,/* [in] */ IMediaSample *pMediaSample) = NULL;
+
+static void LOG(LPCTSTR fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ if(TCHAR* buff = new TCHAR[_vsctprintf(fmt, args) + 1])
+ {
+ _vstprintf(buff, fmt, args);
+ if(FILE* f = _tfopen(_T("c:\\dxva.log"), _T("at")))
+ {
+ fseek(f, 0, 2);
+ _ftprintf(f, _T("%s\n"), buff);
+ fclose(f);
+ }
+ delete [] buff;
+ }
+ va_end(args);
+}
+
+static void LOGPF(LPCTSTR prefix, const DDPIXELFORMAT* p, int n)
+{
+ for(int i = 0; i < n; i++)
+ {
+ LOG(_T("%s[%d].dwSize = %d"), prefix, i, p[i].dwSize);
+ LOG(_T("%s[%d].dwFlags = %08x"), prefix, i, p[i].dwFlags);
+ LOG(_T("%s[%d].dwFourCC = %4.4hs"), prefix, i, &p[i].dwFourCC);
+ LOG(_T("%s[%d].dwRGBBitCount = %08x"), prefix, i, &p[i].dwRGBBitCount);
+ LOG(_T("%s[%d].dwRBitMask = %08x"), prefix, i, &p[i].dwRBitMask);
+ LOG(_T("%s[%d].dwGBitMask = %08x"), prefix, i, &p[i].dwGBitMask);
+ LOG(_T("%s[%d].dwBBitMask = %08x"), prefix, i, &p[i].dwBBitMask);
+ LOG(_T("%s[%d].dwRGBAlphaBitMask = %08x"), prefix, i, &p[i].dwRGBAlphaBitMask);
+ }
+}
+
+static void LOGUDI(LPCTSTR prefix, const AMVAUncompDataInfo* p, int n)
+{
+ for(int i = 0; i < n; i++)
+ {
+ LOG(_T("%s[%d].dwUncompWidth = %d"), prefix, i, p[i].dwUncompWidth);
+ LOG(_T("%s[%d].dwUncompHeight = %d"), prefix, i, p[i].dwUncompHeight);
+
+ CString prefix2;
+ prefix2.Format(_T("%s[%d]"), prefix, i);
+ LOGPF(prefix2, &p[i].ddUncompPixelFormat, 1);
+ }
+}
+
+static HRESULT STDMETHODCALLTYPE GetVideoAcceleratorGUIDsMine(
+ IAMVideoAcceleratorC * This,
+ /* [out][in] */ LPDWORD pdwNumGuidsSupported,
+ /* [out][in] */ LPGUID pGuidsSupported)
+{
+ LOG(_T("\nGetVideoAcceleratorGUIDs"));
+
+ if(pdwNumGuidsSupported)
+ {
+ LOG(_T("[in] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported);
+ }
+
+ HRESULT hr = GetVideoAcceleratorGUIDsOrg(This, pdwNumGuidsSupported, pGuidsSupported);
+
+ LOG(_T("hr = %08x"), hr);
+
+ if(pdwNumGuidsSupported)
+ {
+ LOG(_T("[out] *pdwNumGuidsSupported = %d"), *pdwNumGuidsSupported);
+
+ if(pGuidsSupported)
+ {
+ for(int i = 0; i < *pdwNumGuidsSupported; i++)
+ {
+ LOG(_T("[out] pGuidsSupported[%d] = %s"), i, CStringFromGUID(pGuidsSupported[i]));
+ }
+ }
+ }
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE GetUncompFormatsSupportedMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const GUID *pGuid,
+ /* [out][in] */ LPDWORD pdwNumFormatsSupported,
+ /* [out][in] */ LPDDPIXELFORMAT pFormatsSupported)
+{
+ LOG(_T("\nGetUncompFormatsSupported"));
+
+ if(pGuid)
+ {
+ LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid));
+ }
+
+ if(pdwNumFormatsSupported)
+ {
+ LOG(_T("[in] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported);
+ }
+
+ HRESULT hr = GetUncompFormatsSupportedOrg(This, pGuid, pdwNumFormatsSupported, pFormatsSupported);
+
+ LOG(_T("hr = %08x"), hr);
+
+ if(pdwNumFormatsSupported)
+ {
+ LOG(_T("[out] *pdwNumFormatsSupported = %d"), *pdwNumFormatsSupported);
+
+ if(pFormatsSupported)
+ {
+ LOGPF(_T("[out] pFormatsSupported"), pFormatsSupported, *pdwNumFormatsSupported);
+ }
+ }
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE GetInternalMemInfoMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const GUID *pGuid,
+ /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,
+ /* [out][in] */ LPAMVAInternalMemInfo pamvaInternalMemInfo)
+{
+ LOG(_T("\nGetInternalMemInfo"));
+
+ HRESULT hr = GetInternalMemInfoOrg(This, pGuid, pamvaUncompDataInfo, pamvaInternalMemInfo);
+
+ LOG(_T("hr = %08x"), hr);
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE GetCompBufferInfoMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const GUID *pGuid,
+ /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,
+ /* [out][in] */ LPDWORD pdwNumTypesCompBuffers,
+ /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo)
+{
+ LOG(_T("\nGetCompBufferInfo"));
+
+ if(pGuid)
+ {
+ LOG(_T("[in] *pGuid = %s"), CStringFromGUID(*pGuid));
+
+ if(pdwNumTypesCompBuffers)
+ {
+ LOG(_T("[in] *pdwNumTypesCompBuffers = %d"), *pdwNumTypesCompBuffers);
+ }
+ }
+
+ HRESULT hr = GetCompBufferInfoOrg(This, pGuid, pamvaUncompDataInfo, pdwNumTypesCompBuffers, pamvaCompBufferInfo);
+
+ LOG(_T("hr = %08x"), hr);
+
+ if(pdwNumTypesCompBuffers)
+ {
+ LOG(_T("[out] *pdwNumTypesCompBuffers = %d"), *pdwNumTypesCompBuffers);
+
+ if(pamvaUncompDataInfo)
+ {
+ LOGUDI(_T("[out] pamvaUncompDataInfo"), pamvaUncompDataInfo, *pdwNumTypesCompBuffers);
+ }
+ }
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE GetInternalCompBufferInfoMine(
+ IAMVideoAcceleratorC * This,
+ /* [out][in] */ LPDWORD pdwNumTypesCompBuffers,
+ /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo)
+{
+ LOG(_T("\nGetInternalCompBufferInfo"));
+
+ HRESULT hr = GetInternalCompBufferInfoOrg(This, pdwNumTypesCompBuffers, pamvaCompBufferInfo);
+
+ LOG(_T("hr = %08x"), hr);
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE BeginFrameMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const AMVABeginFrameInfo *amvaBeginFrameInfo)
+{
+ LOG(_T("\nBeginFrame"));
+
+ if(amvaBeginFrameInfo)
+ {
+ LOG(_T("[in] amvaBeginFrameInfo->dwDestSurfaceIndex = %08x"), amvaBeginFrameInfo->dwDestSurfaceIndex);
+ LOG(_T("[in] amvaBeginFrameInfo->pInputData = %08x"), amvaBeginFrameInfo->pInputData);
+ LOG(_T("[in] amvaBeginFrameInfo->dwSizeInputData = %08x"), amvaBeginFrameInfo->dwSizeInputData);
+ LOG(_T("[in] amvaBeginFrameInfo->pOutputData = %08x"), amvaBeginFrameInfo->pOutputData);
+ LOG(_T("[in] amvaBeginFrameInfo->dwSizeOutputData = %08x"), amvaBeginFrameInfo->dwSizeOutputData);
+ }
+
+ HRESULT hr = BeginFrameOrg(This, amvaBeginFrameInfo);
+
+ LOG(_T("hr = %08x"), hr);
+
+ if(amvaBeginFrameInfo && amvaBeginFrameInfo->pOutputData)
+ {
+ LOG(_T("[out] amvaBeginFrameInfo->pOutputData = %02x %02x %02x %02x..."),
+ ((BYTE*)amvaBeginFrameInfo->pOutputData)[0],
+ ((BYTE*)amvaBeginFrameInfo->pOutputData)[1],
+ ((BYTE*)amvaBeginFrameInfo->pOutputData)[2],
+ ((BYTE*)amvaBeginFrameInfo->pOutputData)[3]);
+ }
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE EndFrameMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const AMVAEndFrameInfo *pEndFrameInfo)
+{
+ LOG(_T("\nEndFrame"));
+
+ if(pEndFrameInfo)
+ {
+ LOG(_T("[in] pEndFrameInfo->dwSizeMiscData = %08x"), pEndFrameInfo->dwSizeMiscData);
+ LOG(_T("[in] pEndFrameInfo->pMiscData = %08x"), pEndFrameInfo->pMiscData);
+ }
+
+ HRESULT hr = EndFrameOrg(This, pEndFrameInfo);
+
+ LOG(_T("hr = %08x"), hr);
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE GetBufferMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwTypeIndex,
+ /* [in] */ DWORD dwBufferIndex,
+ /* [in] */ BOOL bReadOnly,
+ /* [out] */ LPVOID *ppBuffer,
+ /* [out] */ LONG *lpStride)
+{
+ LOG(_T("\nGetBuffer"));
+
+ LOG(_T("[in] dwTypeIndex = %08x"), dwTypeIndex);
+ LOG(_T("[in] dwBufferIndex = %08x"), dwBufferIndex);
+ LOG(_T("[in] bReadOnly = %08x"), bReadOnly);
+ LOG(_T("[in] ppBuffer = %08x"), ppBuffer);
+ LOG(_T("[in] lpStride = %08x"), lpStride);
+
+ HRESULT hr = GetBufferOrg(This, dwTypeIndex, dwBufferIndex, bReadOnly, ppBuffer, lpStride);
+
+ LOG(_T("hr = %08x"), hr);
+
+ LOG(_T("[out] *ppBuffer = %02x %02x %02x %02x ..."), ((BYTE*)*ppBuffer)[0], ((BYTE*)*ppBuffer)[1], ((BYTE*)*ppBuffer)[2], ((BYTE*)*ppBuffer)[3]);
+ LOG(_T("[out] *lpStride = %08x"), *lpStride);
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE ReleaseBufferMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwTypeIndex,
+ /* [in] */ DWORD dwBufferIndex)
+{
+ LOG(_T("\nReleaseBuffer"));
+
+ LOG(_T("[in] dwTypeIndex = %08x"), dwTypeIndex);
+ LOG(_T("[in] dwBufferIndex = %08x"), dwBufferIndex);
+
+ HRESULT hr = ReleaseBufferOrg(This, dwTypeIndex, dwBufferIndex);
+
+ LOG(_T("hr = %08x"), hr);
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE ExecuteMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwFunction,
+ /* [in] */ LPVOID lpPrivateInputData,
+ /* [in] */ DWORD cbPrivateInputData,
+ /* [in] */ LPVOID lpPrivateOutputData,
+ /* [in] */ DWORD cbPrivateOutputData,
+ /* [in] */ DWORD dwNumBuffers,
+ /* [in] */ const AMVABUFFERINFO *pamvaBufferInfo)
+{
+ LOG(_T("\nExecute"));
+
+ LOG(_T("[in] dwFunction = %08x"), dwFunction);
+ if(lpPrivateInputData)
+ {
+ LOG(_T("[in] lpPrivateInputData = %02x %02x %02x %02x ..."),
+ ((BYTE*)lpPrivateInputData)[0],
+ ((BYTE*)lpPrivateInputData)[1],
+ ((BYTE*)lpPrivateInputData)[2],
+ ((BYTE*)lpPrivateInputData)[3]);
+ }
+ LOG(_T("[in] cbPrivateInputData = %08x"), cbPrivateInputData);
+ LOG(_T("[in] lpPrivateOutputData = %08"), lpPrivateOutputData);
+ LOG(_T("[in] cbPrivateOutputData = %08x"), cbPrivateOutputData);
+ LOG(_T("[in] dwNumBuffers = %08x"), dwNumBuffers);
+ if(pamvaBufferInfo)
+ {
+ LOG(_T("[in] pamvaBufferInfo->dwTypeIndex = %08x"), pamvaBufferInfo->dwTypeIndex);
+ LOG(_T("[in] pamvaBufferInfo->dwBufferIndex = %08x"), pamvaBufferInfo->dwBufferIndex);
+ LOG(_T("[in] pamvaBufferInfo->dwDataOffset = %08x"), pamvaBufferInfo->dwDataOffset);
+ LOG(_T("[in] pamvaBufferInfo->dwDataSize = %08x"), pamvaBufferInfo->dwDataSize);
+ }
+
+ HRESULT hr = ExecuteOrg(This, dwFunction, lpPrivateInputData, cbPrivateInputData, lpPrivateOutputData, cbPrivateOutputData, dwNumBuffers, pamvaBufferInfo);
+
+ LOG(_T("hr = %08x"), hr);
+
+ if(lpPrivateOutputData)
+ {
+ LOG(_T("[out] *lpPrivateOutputData = %08"), lpPrivateOutputData);
+
+ if(cbPrivateOutputData)
+ {
+ LOG(_T("[out] cbPrivateOutputData = %02x %02x %02x %02x ..."),
+ ((BYTE*)lpPrivateOutputData)[0],
+ ((BYTE*)lpPrivateOutputData)[1],
+ ((BYTE*)lpPrivateOutputData)[2],
+ ((BYTE*)lpPrivateOutputData)[3]);
+ }
+ }
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE QueryRenderStatusMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwTypeIndex,
+ /* [in] */ DWORD dwBufferIndex,
+ /* [in] */ DWORD dwFlags)
+{
+ LOG(_T("\nQueryRenderStatus"));
+
+ HRESULT hr = QueryRenderStatusOrg(This, dwTypeIndex, dwBufferIndex, dwFlags);
+
+ LOG(_T("hr = %08x"), hr);
+
+ return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE DisplayFrameMine(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwFlipToIndex,
+ /* [in] */ IMediaSample *pMediaSample)
+{
+ LOG(_T("\nDisplayFrame"));
+
+ HRESULT hr = DisplayFrameOrg(This, dwFlipToIndex, pMediaSample);
+
+ LOG(_T("hr = %08x"), hr);
+
+ return hr;
+}
+
+void HookAMVideoAccelerator(IAMVideoAcceleratorC* pAMVideoAcceleratorC)
+{
+ BOOL res;
+ DWORD flOldProtect = 0;
+ res = VirtualProtect(pAMVideoAcceleratorC->lpVtbl, sizeof(IAMVideoAcceleratorC), PAGE_WRITECOPY, &flOldProtect);
+/*
+*/
+ if(GetVideoAcceleratorGUIDsOrg == NULL) GetVideoAcceleratorGUIDsOrg = pAMVideoAcceleratorC->lpVtbl->GetVideoAcceleratorGUIDs;
+ if(GetUncompFormatsSupportedOrg == NULL) GetUncompFormatsSupportedOrg = pAMVideoAcceleratorC->lpVtbl->GetUncompFormatsSupported;
+ if(GetInternalMemInfoOrg == NULL) GetInternalMemInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalMemInfo;
+ if(GetCompBufferInfoOrg == NULL) GetCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetCompBufferInfo;
+ if(GetInternalCompBufferInfoOrg == NULL) GetInternalCompBufferInfoOrg = pAMVideoAcceleratorC->lpVtbl->GetInternalCompBufferInfo;
+ if(BeginFrameOrg == NULL) BeginFrameOrg = pAMVideoAcceleratorC->lpVtbl->BeginFrame;
+ if(EndFrameOrg == NULL) EndFrameOrg = pAMVideoAcceleratorC->lpVtbl->EndFrame;
+ if(GetBufferOrg == NULL) GetBufferOrg = pAMVideoAcceleratorC->lpVtbl->GetBuffer;
+ if(ReleaseBufferOrg == NULL) ReleaseBufferOrg = pAMVideoAcceleratorC->lpVtbl->ReleaseBuffer;
+ if(ExecuteOrg == NULL) ExecuteOrg = pAMVideoAcceleratorC->lpVtbl->Execute;
+ if(QueryRenderStatusOrg == NULL) QueryRenderStatusOrg = pAMVideoAcceleratorC->lpVtbl->QueryRenderStatus;
+ if(DisplayFrameOrg == NULL) DisplayFrameOrg = pAMVideoAcceleratorC->lpVtbl->DisplayFrame;
+/*
+*/
+/*
+*/
+ pAMVideoAcceleratorC->lpVtbl->GetVideoAcceleratorGUIDs = GetVideoAcceleratorGUIDsMine;
+ pAMVideoAcceleratorC->lpVtbl->GetUncompFormatsSupported = GetUncompFormatsSupportedMine;
+ pAMVideoAcceleratorC->lpVtbl->GetInternalMemInfo = GetInternalMemInfoMine;
+ pAMVideoAcceleratorC->lpVtbl->GetCompBufferInfo = GetCompBufferInfoMine;
+ pAMVideoAcceleratorC->lpVtbl->GetInternalCompBufferInfo = GetInternalCompBufferInfoMine;
+ pAMVideoAcceleratorC->lpVtbl->BeginFrame = BeginFrameMine;
+ pAMVideoAcceleratorC->lpVtbl->EndFrame = EndFrameMine;
+ pAMVideoAcceleratorC->lpVtbl->GetBuffer = GetBufferMine;
+ pAMVideoAcceleratorC->lpVtbl->ReleaseBuffer = ReleaseBufferMine;
+ pAMVideoAcceleratorC->lpVtbl->Execute = ExecuteMine;
+ pAMVideoAcceleratorC->lpVtbl->QueryRenderStatus = QueryRenderStatusMine;
+ pAMVideoAcceleratorC->lpVtbl->DisplayFrame = DisplayFrameMine;
+/*
+*/
+ res = VirtualProtect(pAMVideoAcceleratorC->lpVtbl, sizeof(IAMVideoAcceleratorC), PAGE_EXECUTE, &flOldProtect);
+}
diff --git a/src/apps/mplayerc/IPinHook.h b/src/apps/mplayerc/IPinHook.h
new file mode 100644
index 000000000..82ab189a2
--- /dev/null
+++ b/src/apps/mplayerc/IPinHook.h
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+interface IPinC;
+
+typedef struct IPinCVtbl
+{
+ BEGIN_INTERFACE
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IPinC * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppvObject );
+ ULONG ( STDMETHODCALLTYPE *AddRef )( IPinC * This );
+ ULONG ( STDMETHODCALLTYPE *Release )( IPinC * This );
+ HRESULT ( STDMETHODCALLTYPE *Connect )( IPinC * This, /* [in] */ IPinC *pReceivePin, /* [in] */ const AM_MEDIA_TYPE *pmt );
+ HRESULT ( STDMETHODCALLTYPE *ReceiveConnection )( IPinC * This, /* [in] */ IPinC *pConnector, /* [in] */ const AM_MEDIA_TYPE *pmt );
+ HRESULT ( STDMETHODCALLTYPE *Disconnect )( IPinC * This );
+ HRESULT ( STDMETHODCALLTYPE *ConnectedTo )( IPinC * This, /* [out] */ IPinC **pPin );
+ HRESULT ( STDMETHODCALLTYPE *ConnectionMediaType )( IPinC * This, /* [out] */ AM_MEDIA_TYPE *pmt );
+ HRESULT ( STDMETHODCALLTYPE *QueryPinInfo )( IPinC * This, /* [out] */ PIN_INFO *pInfo );
+ HRESULT ( STDMETHODCALLTYPE *QueryDirection )( IPinC * This, /* [out] */ PIN_DIRECTION *pPinDir );
+ HRESULT ( STDMETHODCALLTYPE *QueryId )( IPinC * This, /* [out] */ LPWSTR *Id );
+ HRESULT ( STDMETHODCALLTYPE *QueryAccept )( IPinC * This, /* [in] */ const AM_MEDIA_TYPE *pmt );
+ HRESULT ( STDMETHODCALLTYPE *EnumMediaTypes )( IPinC * This, /* [out] */ IEnumMediaTypes **ppEnum );
+ HRESULT ( STDMETHODCALLTYPE *QueryInternalConnections )( IPinC * This, /* [out] */ IPinC **apPin, /* [out][in] */ ULONG *nPin );
+ HRESULT ( STDMETHODCALLTYPE *EndOfStream )( IPinC * This );
+ HRESULT ( STDMETHODCALLTYPE *BeginFlush )( IPinC * This );
+ HRESULT ( STDMETHODCALLTYPE *EndFlush )( IPinC * This );
+ HRESULT ( STDMETHODCALLTYPE *NewSegment )( IPinC * This, /* [in] */ REFERENCE_TIME tStart, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate );
+ END_INTERFACE
+} IPinCVtbl;
+
+interface IPinC
+{
+ CONST_VTBL struct IPinCVtbl *lpVtbl;
+};
+
+interface IMemInputPinC;
+
+typedef struct IMemInputPinCVtbl
+{
+ BEGIN_INTERFACE
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IPinC * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppvObject );
+ ULONG ( STDMETHODCALLTYPE *AddRef )( IPinC * This );
+ ULONG ( STDMETHODCALLTYPE *Release )( IPinC * This );
+ HRESULT ( STDMETHODCALLTYPE *GetAllocator )( IMemInputPinC * This, IMemAllocator **ppAllocator);
+ HRESULT ( STDMETHODCALLTYPE *NotifyAllocator )( IMemInputPinC * This, IMemAllocator *pAllocator, BOOL bReadOnly);
+ HRESULT ( STDMETHODCALLTYPE *GetAllocatorRequirements )( IMemInputPinC * This, ALLOCATOR_PROPERTIES *pProps);
+ HRESULT ( STDMETHODCALLTYPE *Receive )( IMemInputPinC * This, IMediaSample *pSample);
+ HRESULT ( STDMETHODCALLTYPE *ReceiveMultiple )( IMemInputPinC * This, IMediaSample **pSamples, long nSamples, long *nSamplesProcessed);
+ HRESULT ( STDMETHODCALLTYPE *ReceiveCanBlock )( IMemInputPinC * This);
+ END_INTERFACE
+} IMemInputPinCVtbl;
+
+interface IMemInputPinC
+{
+ CONST_VTBL struct IMemInputPinCVtbl *lpVtbl;
+};
+
+extern bool HookNewSegmentAndReceive(IPinC* pPinC, IMemInputPinC* pMemInputPin);
+extern REFERENCE_TIME g_tSegmentStart, g_tSampleStart;
+
+//
+
+#include <videoacc.h>
+
+interface IAMVideoAcceleratorC;
+
+typedef struct IAMVideoAcceleratorCVtbl
+{
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IAMVideoAcceleratorC * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IAMVideoAcceleratorC * This);
+
+ HRESULT ( STDMETHODCALLTYPE *GetVideoAcceleratorGUIDs )(
+ IAMVideoAcceleratorC * This,
+ /* [out][in] */ LPDWORD pdwNumGuidsSupported,
+ /* [out][in] */ LPGUID pGuidsSupported);
+
+ HRESULT ( STDMETHODCALLTYPE *GetUncompFormatsSupported )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const GUID *pGuid,
+ /* [out][in] */ LPDWORD pdwNumFormatsSupported,
+ /* [out][in] */ LPDDPIXELFORMAT pFormatsSupported);
+
+ HRESULT ( STDMETHODCALLTYPE *GetInternalMemInfo )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const GUID *pGuid,
+ /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,
+ /* [out][in] */ LPAMVAInternalMemInfo pamvaInternalMemInfo);
+
+ HRESULT ( STDMETHODCALLTYPE *GetCompBufferInfo )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const GUID *pGuid,
+ /* [in] */ const AMVAUncompDataInfo *pamvaUncompDataInfo,
+ /* [out][in] */ LPDWORD pdwNumTypesCompBuffers,
+ /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo);
+
+ HRESULT ( STDMETHODCALLTYPE *GetInternalCompBufferInfo )(
+ IAMVideoAcceleratorC * This,
+ /* [out][in] */ LPDWORD pdwNumTypesCompBuffers,
+ /* [out] */ LPAMVACompBufferInfo pamvaCompBufferInfo);
+
+ HRESULT ( STDMETHODCALLTYPE *BeginFrame )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const AMVABeginFrameInfo *amvaBeginFrameInfo);
+
+ HRESULT ( STDMETHODCALLTYPE *EndFrame )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ const AMVAEndFrameInfo *pEndFrameInfo);
+
+ HRESULT ( STDMETHODCALLTYPE *GetBuffer )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwTypeIndex,
+ /* [in] */ DWORD dwBufferIndex,
+ /* [in] */ BOOL bReadOnly,
+ /* [out] */ LPVOID *ppBuffer,
+ /* [out] */ LONG *lpStride);
+
+ HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwTypeIndex,
+ /* [in] */ DWORD dwBufferIndex);
+
+ HRESULT ( STDMETHODCALLTYPE *Execute )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwFunction,
+ /* [in] */ LPVOID lpPrivateInputData,
+ /* [in] */ DWORD cbPrivateInputData,
+ /* [in] */ LPVOID lpPrivateOutputDat,
+ /* [in] */ DWORD cbPrivateOutputData,
+ /* [in] */ DWORD dwNumBuffers,
+ /* [in] */ const AMVABUFFERINFO *pamvaBufferInfo);
+
+ HRESULT ( STDMETHODCALLTYPE *QueryRenderStatus )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwTypeIndex,
+ /* [in] */ DWORD dwBufferIndex,
+ /* [in] */ DWORD dwFlags);
+
+ HRESULT ( STDMETHODCALLTYPE *DisplayFrame )(
+ IAMVideoAcceleratorC * This,
+ /* [in] */ DWORD dwFlipToIndex,
+ /* [in] */ IMediaSample *pMediaSample);
+
+ END_INTERFACE
+} IAMVideoAcceleratorCVtbl;
+
+interface IAMVideoAcceleratorC
+{
+ CONST_VTBL struct IAMVideoAcceleratorCVtbl *lpVtbl;
+};
+
+extern void HookAMVideoAccelerator(IAMVideoAcceleratorC* pAMVideoAcceleratorC);
diff --git a/src/apps/mplayerc/IQTVideoSurface.h b/src/apps/mplayerc/IQTVideoSurface.h
new file mode 100644
index 000000000..4b6adf6fe
--- /dev/null
+++ b/src/apps/mplayerc/IQTVideoSurface.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+//
+// IQTVideoSurface
+//
+
+[uuid("A6AE36F7-A6F2-4157-AF54-6599857E4E20")]
+interface IQTVideoSurface : public IUnknown
+{
+ STDMETHOD (BeginBlt) (const BITMAP& bm) PURE;
+ STDMETHOD (DoBlt) (const BITMAP& bm) PURE;
+};
diff --git a/src/apps/mplayerc/ISDb.cpp b/src/apps/mplayerc/ISDb.cpp
new file mode 100644
index 000000000..df00ab9c6
--- /dev/null
+++ b/src/apps/mplayerc/ISDb.cpp
@@ -0,0 +1,89 @@
+#include "stdafx.h"
+#include "ISDb.h"
+#include "mplayerc.h"
+
+bool hash(LPCTSTR fn, filehash& fh)
+{
+ CFile f;
+ CFileException fe;
+ if(!f.Open(fn, CFile::modeRead|CFile::osSequentialScan|CFile::shareDenyNone, &fe))
+ return false;
+
+ CPath p(fn);
+ p.StripPath();
+ fh.name = (LPCTSTR)p;
+
+ fh.size = f.GetLength();
+
+ fh.hash = fh.size;
+ for(UINT64 tmp = 0, i = 0; i < 65536/sizeof(tmp) && f.Read(&tmp, sizeof(tmp)); fh.hash += tmp, i++);
+ f.Seek(max(0, (INT64)fh.size - 65536), CFile::begin);
+ for(UINT64 tmp = 0, i = 0; i < 65536/sizeof(tmp) && f.Read(&tmp, sizeof(tmp)); fh.hash += tmp, i++);
+
+ return true;
+}
+
+void hash(CPlaylist& pl, CList<filehash>& fhs)
+{
+ fhs.RemoveAll();
+
+ POSITION pos = pl.GetHeadPosition();
+ while(pos)
+ {
+ CString fn = pl.GetNext(pos).m_fns.GetHead();
+ if(AfxGetAppSettings().Formats.FindExt(CPath(fn).GetExtension().MakeLower(), true))
+ continue;
+
+ filehash fh;
+ if(!hash(fn, fh))
+ continue;
+
+ fhs.AddTail(fh);
+ }
+}
+
+CStringA makeargs(CPlaylist& pl)
+{
+ CList<filehash> fhs;
+ hash(pl, fhs);
+
+ CAtlList<CStringA> args;
+
+ POSITION pos = fhs.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ filehash& fh = fhs.GetNext(pos);
+
+ CStringA str;
+ str.Format("name[%d]=%s&size[%d]=%016I64x&hash[%d]=%016I64x",
+ i, UrlEncode(CStringA(fh.name)),
+ i, fh.size,
+ i, fh.hash);
+
+ args.AddTail(str);
+ }
+
+ return Implode(args, '&');
+}
+
+bool OpenUrl(CInternetSession& is, CString url, CStringA& str)
+{
+ str.Empty();
+
+ try
+ {
+ CAutoPtr<CStdioFile> f(is.OpenURL(url, 1, INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_EXISTING_CONNECT));
+
+ char buff[1024];
+ for(int len; (len = f->Read(buff, sizeof(buff))) > 0; str += CStringA(buff, len));
+
+ f->Close(); // must close it because the desctructor doesn't seem to do it and we will get an exception when "is" is destroying
+ }
+ catch(CInternetException* ie)
+ {
+ ie->Delete();
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/apps/mplayerc/ISDb.h b/src/apps/mplayerc/ISDb.h
new file mode 100644
index 000000000..97ee0bc9a
--- /dev/null
+++ b/src/apps/mplayerc/ISDb.h
@@ -0,0 +1,37 @@
+#pragma once
+
+#include <atlcoll.h>
+#include <afxinet.h>
+#include "Playlist.h"
+
+#define ISDb_PROTOCOL_VERSION 1
+
+struct isdb_subtitle
+{
+ int id, discs, disc_no;
+ CStringA name, format, language, iso639_2, nick, email;
+ struct isdb_subtitle() {reset();}
+ void reset() {id = discs = disc_no = 0; format = language = nick = email = "";}
+};
+
+struct isdb_movie
+{
+ CAtlList<CStringA> titles;
+ CAtlList<isdb_subtitle> subs;
+ void reset() {titles.RemoveAll(); subs.RemoveAll();}
+ void operator = (const struct isdb_movie& m)
+ {
+ titles.RemoveAll();
+ titles.AddTailList(&m.titles);
+ subs.RemoveAll();
+ subs.AddTailList(&m.subs);
+ }
+};
+
+struct filehash {CString name; UINT64 size, hash;};
+
+extern bool hash(LPCTSTR fn, filehash& fh);
+extern void hash(CPlaylist& pl, CList<filehash>& fhs);
+extern CStringA makeargs(CPlaylist& pl);
+extern bool OpenUrl(CInternetSession& is, CString url, CStringA& str);
+
diff --git a/src/apps/mplayerc/KeyProvider.cpp b/src/apps/mplayerc/KeyProvider.cpp
new file mode 100644
index 000000000..298f10fc8
--- /dev/null
+++ b/src/apps/mplayerc/KeyProvider.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "keyprovider.h"
+#include "..\..\DSUtil\DSUtil.h"
+//#include "c:\WMSDK\WMFSDK9\include\wmsdk.h"
+
+CKeyProvider::CKeyProvider()
+ : CUnknown(NAME("CKeyProvider"), NULL)
+{
+}
+
+STDMETHODIMP CKeyProvider::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(IServiceProvider)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+STDMETHODIMP CKeyProvider::QueryService(REFIID siid, REFIID riid, void **ppv)
+{
+ /*
+ if(siid == __uuidof(IWMReader) && riid == IID_IUnknown)
+ {
+ CComPtr<IUnknown> punkCert;
+ HRESULT hr = WMCreateCertificate(&punkCert);
+ if(SUCCEEDED(hr))
+ *ppv = (void*)punkCert.Detach();
+ return hr;
+ }
+ */
+
+ return E_NOINTERFACE;
+}
diff --git a/src/apps/mplayerc/KeyProvider.h b/src/apps/mplayerc/KeyProvider.h
new file mode 100644
index 000000000..51f68010f
--- /dev/null
+++ b/src/apps/mplayerc/KeyProvider.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <Servprov.h>
+
+// Declare and implement a key provider class derived from IServiceProvider.
+
+class CKeyProvider
+ : public CUnknown
+ , public IServiceProvider
+{
+public:
+ CKeyProvider();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IServiceProvider
+ STDMETHODIMP QueryService(REFIID siid, REFIID riid, void **ppv);
+};
diff --git a/src/apps/mplayerc/LineNumberEdit.cpp b/src/apps/mplayerc/LineNumberEdit.cpp
new file mode 100644
index 000000000..563bd4a15
--- /dev/null
+++ b/src/apps/mplayerc/LineNumberEdit.cpp
@@ -0,0 +1,971 @@
+/* ==========================================================================
+ CLineNumberEdit
+ Author : Johan Rosengren, Abstrakt Mekanik AB
+ Date : 2004-03-09
+ Purpose : CLineNumberEdit is a CEdit-derived class that displays
+ line numbers to the left of the text.
+ Description : The class uses the edit rect to make space for the line
+ numbers. The line numbers are relized through a special
+ CStatic-derived class, CLineNumberStatic. As soon as the
+ text is updated, the CLineNumberStatic is updated as
+ well.
+ Usage : The control can be dynamically created, or created from
+ a dialog template. The formatting string for the line
+ numbers can be set by calling SetLineNumberFormat (the
+ same format string as for CString::Format). By calling
+ SetMarginForegroundColor or SetMarginBackgroundColor
+ the fore- and background colors for the line number
+ display is set.
+ ========================================================================
+ Update : Keith Bowes
+ Date : 2004-04-13
+ Purpose : 1. To allow CLineNumberEdit to properly change colour when
+ Enabled/Disabled or when system colours change.
+ Changing system colours only has a noticable effect when
+ a scheme such as Marine or Plum is chosen.
+ 2. To allow a line number delta to be applied to the first
+ line number so the index does not have to start at zero.
+ 3. To allow a max value to be specified to stop the line
+ count and to allow smarter size formatting.
+ Description : 1. Added OnEnable and OnSysColorChange to detect when
+ a colour change is required. This allows the line number
+ area and CEdit area to update colours properly.
+ Added colour ref variables to hold enabled/disabled states
+ of the background/foreground colours.
+ In an attempt to allow previous functionality to take
+ precedence, if the colours are changed explicitly, the
+ system colours are no longer queried.
+ 2. Added m_LineDelta, applied when line numbers are formatted.
+ 3. Using m_maxval when > 0 to limit the max values and when
+ formatting colomn width.
+ JRO: Added m_lineDelta as well.
+ Usage : 1. Default behaviour is to change colours to reflect CEdit.
+ manually changing the colour will cause the colours to
+ only change to the specified colours.
+ 2. SetLineNumberRange sets both min and max values.
+ 3. SetLineNumberRange sets both min and max values.
+
+ Comments : - Perhaps line values should be stored as UINT's as negative
+ values may have unexpected results.
+ - CLineNumberEdit::m_format creates a duplicate of
+ CLineNumberStatic::m_format, is this needed?
+ JRO: Even though the the two classes are thightly coupled,
+ this duplication of data makes it easier to decouple them.
+ A small matter, but code reuse is Politically Correct,
+ and as such A Desirable Feature.
+ - Added options could allow different system colours to be
+ chosen and updated as system attributes are changed.
+ - if m_maxval is exceeded in the edit box, new lines
+ are added without line numbers. This might not be the
+ desired behaviour.
+ JRO: I think this is rather nifty, actually. If I, as a
+ developer, sets the max number of lines to be numbered,
+ I also expect this to be the case :-)))
+ - It's not spelled wrong, just differently. ;0)
+ ========================================================================
+ Update : Johan Rosengren
+ Date : 2004-04-14
+ Purpose : 1. Allow deriving of CLineNumberEdit.
+ Description : 1. Made the message handlers virtual.
+ Usage : 1. Declare message handlers as virtual in derived
+ classes. Note that CLineNumberEdit is not built to
+ be derived from, however.
+ ========================================================================
+ Update : Keith Bowes
+ Date : 2004-04-22
+ Purpose : To allow processing of WM_LINESCROLL messages.
+ Description : Added OnLineScroll to handle the message.
+ Usage : Now will call UpdateTopAndBottom if the message is
+ received.
+ ========================================================================
+ Update : Johan Rosengren
+ Date : 2004-05-02
+ Purpose : Select complete line when a line-number is clicked
+ Description : Added registered user message, sent when the line-
+ number static is clicked.
+ Usage : See urm_SELECTLINE in the code.
+ ========================================================================*/
+
+#include "stdafx.h"
+#include "LineNumberEdit.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+// Registered message to allow selection of complete
+// lines by clicking the line number
+UINT urm_SELECTLINE = ::RegisterWindowMessage( _T("_LINE_NUMBER_EDIT_SELECTLINE_") );
+
+/////////////////////////////////////////////////////////////////////////////
+// CLineNumberEdit
+CLineNumberEdit::CLineNumberEdit()
+/* ============================================================
+ Function : CLineNumberEdit::CLineNumberEdit
+ Description : constructor
+
+ Return : void
+ Parameters : none
+
+ Usage :
+
+ ============================================================*/
+{
+
+ m_hWnd = NULL;
+ m_line.m_hWnd = NULL;
+ m_zero.cx = 0;
+ m_zero.cy = 0;
+ m_format = _T( "%03i" );
+ m_LineDelta = 1;
+
+ // Could default m_maxval to 99,999, but may cause problems
+ // if m_format is changed and m_maxval is not...
+ m_maxval = 998;
+
+ // Setting up so by defult the original hard-coded colour
+ // scheme is used when enabled and the system colours are
+ // used when disabled.
+ m_bUseEnabledSystemColours = FALSE;
+ m_bUseDisabledSystemColours = TRUE;
+ m_EnabledFgCol = RGB( 0, 0, 0 );
+ m_EnabledBgCol = RGB( 200, 200, 200 );
+ m_DisabledFgCol = GetSysColor( COLOR_GRAYTEXT );
+ m_DisabledBgCol = GetSysColor( COLOR_3DFACE );
+
+ SetWindowColour();
+
+}
+
+CLineNumberEdit::~CLineNumberEdit()
+/* ============================================================
+ Function : CLineNumberEdit::~CLineNumberEdit
+ Description : destructor
+
+ Return : void
+ Parameters : none
+
+ Usage :
+
+ ============================================================*/
+{
+}
+
+BEGIN_MESSAGE_MAP(CLineNumberEdit, CEdit)
+ ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
+ ON_WM_VSCROLL()
+ ON_CONTROL_REFLECT(EN_VSCROLL, OnVscroll)
+ ON_MESSAGE(WM_SETFONT, OnSetFont)
+ ON_WM_SIZE()
+ ON_MESSAGE(WM_SETTEXT, OnSetText)
+ ON_WM_SYSCOLORCHANGE()
+ ON_WM_ENABLE()
+ ON_MESSAGE(EM_LINESCROLL, OnLineScroll)
+ ON_REGISTERED_MESSAGE(urm_SELECTLINE, OnSelectLine)
+END_MESSAGE_MAP()
+
+void CLineNumberEdit::PreSubclassWindow()
+/* ============================================================
+ Function : CLineNumberEdit::PreSubclassWindow
+ Description : This function is called before the control
+ is subclassed for a control on a dialog
+ template, and during creation for
+ dynamically created controls.
+
+ Return : void
+ Parameters : none
+
+ Usage : Called from MFC
+
+ ============================================================*/
+{
+
+ // Unfortunately, we can't change to ES_MULTILINE
+ // during run-time.
+ ASSERT( GetStyle() & ES_MULTILINE );
+
+ // Creating the line number control
+ SetLineNumberFormat( m_format );
+
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CLineNumberEdit message handlers
+
+void CLineNumberEdit::OnSysColorChange()
+/* ============================================================
+ Function : CLineNumberEdit::OnSysColorChange
+ Description : Handles WM_SYSCOLORCHANGE. User has changed
+ the system colours, want to refresh.
+
+ Return : void
+ Parameters : void
+
+ Usage : Called from Windows
+
+ ============================================================*/
+{
+
+ CEdit::OnSysColorChange();
+
+ // update the CStatic with the new colours
+ SetWindowColour( IsWindowEnabled() );
+
+}
+
+LRESULT CLineNumberEdit::OnSetText( WPARAM wParam, LPARAM lParam )
+/* ============================================================
+ Function : CLineNumberEdit::OnSetText
+ Description : Handles WM_SETTEXT. We must update the line
+ numbers in the line number control as well.
+
+ Return : LRESULT - From Def proc
+ Parameters : WPARAM wParam - From Windows
+ LPARAM lParam - From Windows
+
+ Usage : Called from Windows
+
+ ============================================================*/
+{
+
+ // Default processing
+ LRESULT retval = DefWindowProc( WM_SETTEXT, wParam, lParam );
+ UpdateTopAndBottom();
+ return retval;
+
+}
+
+void CLineNumberEdit::OnChange()
+/* ============================================================
+ Function : CLineNumberEdit::OnChange
+ Description : Mapped to EN_CHANGE. We must handle
+ EN_CHANGE to let the line-number control
+ reflect changes to the edit box content.
+
+ Return : void
+ Parameters : none
+
+ Usage : Called from Windows
+
+ ============================================================*/
+{
+
+ UpdateTopAndBottom();
+
+}
+
+void CLineNumberEdit::OnVscroll()
+/* ============================================================
+ Function : CLineNumberEdit::OnVscroll
+ Description : Mapped to EN_VSCROLL. We update the line
+ numbers in the line number control
+
+ Return : void
+ Parameters : none
+
+ Usage : Called from Windows
+
+ ============================================================*/
+{
+
+ UpdateTopAndBottom();
+
+}
+
+void CLineNumberEdit::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar )
+/* ============================================================
+ Function : CLineNumberEdit::OnVScroll
+ Description : Handles WM_VSCROLL. We handle WM_VSCROLL
+ in addition to the notification EN_VSCROLL,
+ to handle scrollbar dragging as well
+
+ Return : void
+ Parameters : UINT nSBCode - From Windows
+ UINT nPos - From Windows
+ CScrollBar* pScrollBar - From Windows
+
+ Usage : Called from Windows
+
+ ============================================================*/
+{
+
+ CEdit::OnVScroll( nSBCode, nPos, pScrollBar );
+ UpdateTopAndBottom();
+
+}
+
+LRESULT CLineNumberEdit::OnLineScroll( WPARAM wParam, LPARAM lParam )
+/* ============================================================
+ Function : CLineNumberEdit::OnLineScroll
+ Description : Mapped to EM_LINESCROLL. We update the line
+ numbers in the line number control.
+
+ Return : void
+ Parameters : none
+ Usage : Called from Windows
+ ============================================================*/
+{
+
+ // Default processing
+ LRESULT retval = DefWindowProc( EM_LINESCROLL, wParam, lParam );
+ UpdateTopAndBottom();
+ return retval;
+
+}
+
+LRESULT CLineNumberEdit::OnSetFont( WPARAM wParam, LPARAM lParam )
+/* ============================================================
+ Function : CLineNumberEdit::OnSetFont
+ Description : Mapped to WM_SETFONT. We must recalculate
+ the line number control size as well.
+
+ Return : LRESULT - Always 0
+ Parameters : WPARAM wParam - From Windows
+ LPARAM lParam - From Windows
+
+ Usage : Called from Windows
+
+ ============================================================*/
+{
+
+ DefWindowProc( WM_SETFONT, wParam, lParam );
+ // We resize the line-number
+ // field
+ Prepare();
+ return 0;
+
+}
+
+void CLineNumberEdit::OnSize( UINT nType, int cx, int cy )
+/* ============================================================
+ Function : CLineNumberEdit::OnSize
+ Description : Handles WM_SIZE. Recalculates the line
+ number control size as well.
+
+ Return : void
+ Parameters : UINT nType - From Windows
+ int cx - From Windows
+ int cy - From Windows
+
+ Usage : Called from Windows
+
+ ============================================================*/
+{
+
+ CEdit::OnSize( nType, cx, cy );
+
+ // If we have the line-number
+ // control, it must be resized
+ // as well.
+ if( m_line.m_hWnd )
+ Prepare();
+
+}
+
+void CLineNumberEdit::OnEnable( BOOL bEnable )
+/* ============================================================
+ Function : CLineNumberEdit::OnEnable
+ Description : Handles WM_ENABLE. Calls to set colours.
+
+ Return : void
+ Parameters : BOOL bEnable - From Windows
+
+ Usage : Called from Windows.
+
+ ============================================================*/
+{
+
+ CEdit::OnEnable( bEnable );
+ SetWindowColour( bEnable );
+
+}
+
+LRESULT CLineNumberEdit::OnSelectLine(WPARAM wParam, LPARAM /*lParam*/ )
+/* ============================================================
+ Function : CLineNumberEdit::OnSelectLine
+ Description : Handler for the urm_SELECTLINE registered
+ message. Will select the line in wParam.
+
+ Return : LRESULT - Not used
+ Parameters : WPARAM wParam - The line to select
+ LPARAM lParam - Not used
+
+ Usage : Called from MFC. Use
+ SendMessage( urm_SELECTLINE, line ) from
+ code.
+
+ ============================================================*/
+{
+
+ // Calc start and end position of the line
+ int lineno = wParam + GetScrollPos( SB_VERT );
+ int start = LineIndex( lineno );
+ int end = LineIndex( lineno + 1 );
+ SetSel( start, end - 1 );
+ return 0;
+
+}
+
+void CLineNumberEdit::SetWindowColour( BOOL bEnable /*= TRUE*/ )
+/* ============================================================
+ Function : CLineNumberEdit::SetWindowColour
+ Description : Handles changing window colours.
+
+ Return : void
+ Parameters : BOOL bEnable - flag if set enabled/disabled
+ colours
+
+ Usage : Called to change colours in the edit box.
+
+ ============================================================*/
+{
+
+ if (m_bUseEnabledSystemColours)
+ {
+ // re-query the system colours in case they have changed.
+ m_EnabledFgCol = GetSysColor( COLOR_WINDOWTEXT );
+ m_EnabledBgCol = GetSysColor( COLOR_WINDOW );
+ }
+
+ if (m_bUseDisabledSystemColours)
+ {
+ // re-query the system colours in case they have changed.
+ m_DisabledFgCol = GetSysColor( COLOR_GRAYTEXT );
+ m_DisabledBgCol = GetSysColor( COLOR_3DFACE );
+ }
+
+ // change the colour based on bEnable
+ if (bEnable)
+ {
+ m_line.SetFgColor( m_EnabledFgCol, TRUE );
+ m_line.SetBgColor( m_EnabledBgCol, TRUE );
+ } else {
+ m_line.SetFgColor( m_DisabledFgCol, TRUE );
+ m_line.SetBgColor( m_DisabledBgCol, TRUE );
+ }
+
+}
+
+void CLineNumberEdit::UseSystemColours( BOOL bUseEnabled /*= TRUE*/, BOOL bUseDisabled /*= TRUE*/ )
+/* ============================================================
+ Function : CLineNumberEdit::UseSystemColours
+ Description : Sets the Use*SystemColours flags.
+
+ Return : void
+ Parameters : BOOL bEnabled - flag if to use enabled
+ system colours
+ BOOL bDisabled - flag if to use disabled
+ system colours
+
+ Usage : Called to change colours in the edit box
+
+ ============================================================*/
+{
+
+ m_bUseEnabledSystemColours = bUseEnabled;
+ m_bUseDisabledSystemColours = bUseDisabled;
+ BOOL bEnable = TRUE;
+ if (::IsWindow(m_hWnd))
+ bEnable = IsWindowEnabled();
+
+ SetWindowColour( bEnable );
+
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CLineNumberEdit private implementation
+
+void CLineNumberEdit::Prepare()
+/* ============================================================
+ Function : CLineNumberEdit::Prepare
+ Description : Setting the edit rect for the control and
+ either create or move the line number
+ control. Also sets the top- and bottom
+ line numbers.
+
+ Return : void
+ Parameters : none
+
+ Usage : Must be called to (re)establish the edit
+ rect, must also be called as soon as the
+ control changes size.
+
+ ============================================================*/
+{
+
+ // Calc sizes
+ int width = CalcLineNumberWidth();
+ CRect rect;
+ GetClientRect( &rect );
+ CRect rectEdit( rect );
+ rect.right = width;
+ rectEdit.left = rect.right + 3;
+
+ // Setting the edit rect and
+ // creating or moving child control
+ SetRect( &rectEdit );
+ if( m_line.m_hWnd )
+ m_line.MoveWindow( 0, 0, width, rect.Height() );
+ else
+ m_line.Create(NULL,WS_CHILD | WS_VISIBLE | SS_NOTIFY, rect, this, 1 );
+
+ GetRect( &rectEdit );
+
+ // Update line number control data
+ m_line.SetTopMargin( rectEdit.top );
+ UpdateTopAndBottom();
+
+}
+
+int CLineNumberEdit::CalcLineNumberWidth()
+/* ============================================================
+ Function : CLineNumberEdit::CalcLineNumberWidth
+ Description : Calculates the desired width of the line
+ number control, using the current format
+ string and the max number of chars allowed
+ (pessimistic - assumes one character per
+ line).
+
+ Return : int - The width in pixels
+ Parameters : none
+
+ Usage : Called as soon as the format string is
+ changed.
+
+ ============================================================*/
+{
+
+ CClientDC dc( this );
+
+ // If a new font is set during runtime,
+ // we must explicitly select the font into
+ // the CClientDC to measure it.
+ CFont* font = GetFont();
+ CFont* oldFont = dc.SelectObject( font );
+
+ m_zero=dc.GetTextExtent( _T( "0" ) );
+ CString format;
+
+ // GetLimitText returns the number of bytes the edit box may contain,
+ // not the max number of lines...
+ //... which is the max number of lines, given one character per d:o :-)
+ int maxval = GetLimitText();
+ if (m_maxval > 0)
+ maxval = m_maxval + m_LineDelta;
+
+ format.Format( m_format, maxval );
+ CSize fmt = dc.GetTextExtent( format );
+ dc.SelectObject( oldFont );
+
+ // Calculate the size of the line-
+ // number field. We add a 5 pixel margin
+ // to the max size of the format string
+ return fmt.cx + 5;
+
+}
+
+void CLineNumberEdit::UpdateTopAndBottom()
+/* ============================================================
+ Function : CLineNumberEdit::UpdateTopAndBottom
+ Description : Updates the top- and bottom line number
+ for the line number control.
+
+ Return : void
+ Parameters : none
+ Usage : Should be called as soon as the contents of
+ the control is changed.
+
+ ============================================================*/
+{
+
+ CRect rect;
+ GetClientRect( &rect );
+ int maxline = GetLineCount() + m_LineDelta;
+
+ // Height for individual lines
+ int lineheight = m_zero.cy;
+
+ // Calculate the number of lines to draw
+ int topline = GetFirstVisibleLine() + m_LineDelta;
+ if( ( topline + ( rect.Height() / lineheight ) ) < maxline )
+ maxline = topline + ( rect.Height() / lineheight );
+
+ if ( m_maxval > 0 && maxline > m_maxval + m_LineDelta )
+ maxline = m_maxval + m_LineDelta;
+
+ m_line.SetTopAndBottom( topline, maxline );
+
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CLineNumberEdit public implementation
+
+void CLineNumberEdit::SetMarginForegroundColor( COLORREF col, BOOL redraw, BOOL bEnabled /*= TRUE*/ )
+/* ============================================================
+ Function : CLineNumberEdit::SetMarginForegroundColor
+ Description : Sets the text color for the number
+ margin.
+
+ Return : void
+ Parameters : COLORREF col - The new text color
+ BOOL redraw - TRUE if the control
+ should be redrawn
+ (default)
+
+ Usage : Call to set a new text color for the line
+ number margin. The control will be redrawn
+ if it exists.
+
+ ============================================================*/
+{
+
+ m_line.SetFgColor( col, redraw );
+ if (bEnabled)
+ {
+ m_bUseEnabledSystemColours = FALSE;
+ m_EnabledFgCol = col;
+ } else {
+ m_bUseDisabledSystemColours = FALSE;
+ m_DisabledFgCol = col;
+ }
+
+}
+
+void CLineNumberEdit::SetMarginBackgroundColor( COLORREF col, BOOL redraw, BOOL bEnabled /*= TRUE*/ )
+/* ============================================================
+ Function : CLineNumberEdit::SetMarginBackgroundColor
+ Description : Sets the background color for the number
+ margin.
+
+ Return : void
+ Parameters : COLORREF col - The new background color
+ BOOL redraw - TRUE if the control
+ should be redrawn
+ (default)
+
+ Usage : Call to set a new background color for the
+ line number margin. The control will be
+ redrawn if it exists.
+
+ ============================================================*/
+{
+
+ m_line.SetBgColor( col, redraw );
+ if (bEnabled)
+ {
+ m_bUseEnabledSystemColours = FALSE;
+ m_EnabledBgCol = col;
+ } else {
+ m_bUseDisabledSystemColours = FALSE;
+ m_DisabledBgCol = col;
+ }
+
+}
+
+void CLineNumberEdit::SetLineNumberFormat( CString format )
+/* ============================================================
+ Function : CLineNumberEdit::SetLineNumberFormat
+ Description : Changes the way line numbers are presented
+ on screen.
+
+ Return : void
+ Parameters : CString format - The new format string
+
+ Usage : Call with a format string using the same
+ format as CString::Format. It should contain
+ one and only one numeric type.
+
+ ============================================================*/
+{
+
+ m_format = format;
+ m_line.SetLineNumberFormat( format );
+ if( m_hWnd )
+ Prepare();
+
+}
+
+void CLineNumberEdit::SetLineNumberRange( UINT nMin, UINT nMax /*= 0*/ )
+/* ============================================================
+ Function : CLineNumberEdit::SetLineNumberRange
+ Description : Changes the default min and max line numbers.
+
+ Return : void
+ Parameters : int nMin - changes the line offset
+ int nMax - changes the max line number
+
+ Usage : Call to set up the min and max line numbers.
+
+ ============================================================*/
+{
+
+ m_LineDelta = ( int ) nMin;
+ m_maxval = ( int ) nMax;
+
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CLineNumberStatic
+
+CLineNumberStatic::CLineNumberStatic()
+/* ============================================================
+ Function : CLineNumberStatic::CLineNumberStatic
+ Description : constructor
+
+ Return : void
+ Parameters : none
+
+ Usage :
+
+ ============================================================*/
+{
+
+ m_bgcol = RGB( 255, 255, 248 );
+ m_fgcol = RGB( 0, 0, 0 );
+ m_format = _T( "%05i" );
+ m_topline = 0;
+ m_bottomline = 0;
+}
+
+CLineNumberStatic::~CLineNumberStatic()
+/* ============================================================
+ Function : CLineNumberStatic::~CLineNumberStatic
+ Description : destructor
+
+ Return : void
+ Parameters : none
+
+ Usage :
+
+ ============================================================*/
+{
+}
+
+BEGIN_MESSAGE_MAP(CLineNumberStatic, CStatic)
+ ON_WM_PAINT()
+ ON_WM_ERASEBKGND()
+ ON_WM_LBUTTONDOWN()
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CLineNumberStatic message handlers
+
+void CLineNumberStatic::OnPaint()
+/* ============================================================
+ Function : CLineNumberStatic::OnPaint
+ Description : Handler for WM_PAINT.
+
+ Return : void
+ Parameters : none
+
+ Usage : Called from Windows.
+
+ ============================================================*/
+{
+
+ CPaintDC dcPaint( this );
+
+ CRect rect;
+ GetClientRect( &rect );
+
+ // We double buffer the drawing -
+ // preparing the memory CDC
+ CDC dc;
+ dc.CreateCompatibleDC( &dcPaint );
+ int saved = dc.SaveDC();
+
+ // Create GDI and select objects
+ CBitmap bmp;
+ CPen pen;
+ bmp.CreateCompatibleBitmap( &dcPaint, rect.Width(), rect.Height() );
+ pen.CreatePen( PS_SOLID, 1, m_fgcol );
+ dc.SelectObject( &bmp );
+ dc.SelectObject( &pen );
+
+ // Painting the background
+ dc.FillSolidRect( &rect, m_bgcol );
+ dc.MoveTo( rect.right - 1, 0 );
+ dc.LineTo( rect.right - 1, rect.bottom );
+
+ // Setting other attributes
+ dc.SetTextColor( m_fgcol );
+ dc.SetBkColor( m_bgcol );
+ dc.SelectObject( GetParent()->GetFont() );
+
+ // Output the line numbers
+ if( m_bottomline )
+ {
+ int lineheight = dc.GetTextExtent( _T( "0" ) ).cy;
+ for( int t = m_topline ; t < m_bottomline ; t++ )
+ {
+ CString output;
+ output.Format( m_format, t );
+ int topposition = m_topmargin + lineheight * ( t - m_topline );
+ dc.TextOut( 2, topposition, output );
+ }
+ }
+
+ dcPaint.BitBlt( 0, 0, rect. right, rect.bottom, &dc, 0, 0, SRCCOPY );
+ dc.RestoreDC( saved );
+
+}
+
+BOOL CLineNumberStatic::OnEraseBkgnd( CDC* )
+/* ============================================================
+ Function : CLineNumberStatic::OnEraseBkgnd
+ Description : Mapped to WM_ERASEBKGND. Handled to avoid
+ flicker, as we redraw the complete control
+ in OnPaint
+
+ Return : BOOL - Always TRUE
+ Parameters : CDC* - From Windows
+
+ Usage : Called from Windows.
+
+ ============================================================*/
+{
+
+ return TRUE;
+
+}
+
+void CLineNumberStatic::OnLButtonDown( UINT nFlags, CPoint point )
+/* ============================================================
+ Function : CLineNumberStatic::OnLButtonDown
+ Description : Called when the control is clicked. Will
+ send the urm_SELECTLINE registered message
+ to the parent to select the line clicked on.
+
+ Return : void
+ Parameters : UINT nFlags - Not used
+ CPoint point - Position of cursor
+
+ Usage : Called from Windows.
+
+ ============================================================*/
+{
+
+ // Find the line clicked on
+ CClientDC dc( this );
+ dc.SelectObject( GetParent()->GetFont() );
+ int lineheight = dc.GetTextExtent( _T( "0" ) ).cy;
+ int lineno = ( int ) ( ( double ) point.y / ( double ) lineheight );
+
+ // Select this line in the edit control
+ GetParent()->SendMessage( urm_SELECTLINE, lineno );
+
+ CStatic::OnLButtonDown( nFlags, point );
+
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CLineNumberStatic public implementation
+
+void CLineNumberStatic::SetBgColor( COLORREF col, BOOL redraw )
+/* ============================================================
+ Function : CLineNumberStatic::SetBgColor
+ Description : This function sets the panel background
+ color
+
+ Return : void
+ Parameters : COLORREF col - New background color
+ BOOL redraw - TRUE if the control
+ should be redrawn
+ (default)
+
+ Usage : Called from the parent.
+
+ ============================================================*/
+{
+
+ m_bgcol = col;
+ if( m_hWnd && redraw )
+ RedrawWindow();
+
+}
+
+void CLineNumberStatic::SetFgColor( COLORREF col, BOOL redraw )
+/* ============================================================
+ Function : CLineNumberStatic::SetFgColor
+ Description : This function sets the panel foreground
+ color
+
+ Return : void
+ Parameters : COLORREF col - New text color
+ BOOL redraw - TRUE if the control
+ should be redrawn
+ (default)
+
+ Usage : Called from the parent.
+
+ ============================================================*/
+{
+
+ m_fgcol = col;
+ if( m_hWnd && redraw )
+ RedrawWindow();
+
+}
+
+void CLineNumberStatic::SetTopAndBottom( int topline, int bottomline )
+/* ============================================================
+ Function : CLineNumberStatic::SetTopAndBottom
+ Description : Sets the top- and bottom line and redraw
+ the control (if it exists)
+
+ Return : void
+ Parameters : int topline - The top line number
+ int bottomline - The bottom line number
+
+ Usage : Called when the top and bottom line is
+ changed in the parent.
+
+ ============================================================*/
+{
+
+ m_topline = topline;
+ m_bottomline = bottomline;
+ if( m_hWnd )
+ RedrawWindow();
+
+}
+
+void CLineNumberStatic::SetTopMargin( int topmargin )
+/* ============================================================
+ Function : CLineNumberStatic::SetTopMargin
+ Description : Sets the top margin for painting.
+
+ Return : void
+ Parameters : int topmargin - The top margin to set
+
+ Usage : Will be called with the value of GetRect
+ from the parent.
+
+ ============================================================*/
+{
+
+ m_topmargin = topmargin;
+
+}
+
+void CLineNumberStatic::SetLineNumberFormat( CString format )
+/* ============================================================
+ Function : CLineNumberStatic::SetLineNumberFormat
+ Description : Sets the format string of the control
+
+ Return : void
+ Parameters : CString format - Format string to use
+
+ Usage : Called from the parent when the format
+ string is changed.
+
+ ============================================================*/
+{
+
+ m_format = format;
+ if( m_hWnd )
+ RedrawWindow();
+
+}
diff --git a/src/apps/mplayerc/LineNumberEdit.h b/src/apps/mplayerc/LineNumberEdit.h
new file mode 100644
index 000000000..4794ead44
--- /dev/null
+++ b/src/apps/mplayerc/LineNumberEdit.h
@@ -0,0 +1,99 @@
+#if !defined(AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_)
+#define AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_
+
+/////////////////////////////////////////////////////////////////////////////
+// CLineNumberStatic window
+
+class CLineNumberStatic : public CStatic
+{
+// Construction/destruction
+public:
+ CLineNumberStatic();
+ virtual ~CLineNumberStatic();
+
+// Operations
+public:
+ void SetFgColor( COLORREF col, BOOL redraw );
+ void SetBgColor( COLORREF col, BOOL redraw );
+ void SetTopAndBottom( int topline, int bottomline );
+ void SetTopMargin( int topmargin );
+ void SetLineNumberFormat( CString format );
+
+protected:
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ afx_msg void OnPaint();
+ afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
+ DECLARE_MESSAGE_MAP()
+
+private:
+// Attributes
+ COLORREF m_fgcol;
+ COLORREF m_bgcol;
+ CString m_format;
+
+ int m_topmargin; // Current top margin
+ int m_topline; // Current top line number
+ int m_bottomline; // Current bottom line number
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CLineNumberEdit window
+
+class CLineNumberEdit : public CEdit
+{
+// Construction/destruction
+public:
+ CLineNumberEdit();
+ virtual ~CLineNumberEdit();
+
+// Operations
+public:
+ void SetMarginForegroundColor( COLORREF col, BOOL redraw = TRUE, BOOL bEnabled = TRUE );
+ void SetMarginBackgroundColor( COLORREF col, BOOL redraw = TRUE, BOOL bEnabled = TRUE );
+ void SetLineNumberFormat( CString format );
+ void SetLineNumberRange( UINT nMin, UINT nMax = 0 );
+ void UseSystemColours( BOOL bUseEnabled = TRUE, BOOL bUseDisabled = TRUE );
+
+ int GetLineHeight() {return m_zero.cy;}
+
+protected:
+ virtual void PreSubclassWindow();
+
+ virtual afx_msg void OnEnable( BOOL bEnable );
+ virtual afx_msg void OnSysColorChange();
+ virtual afx_msg void OnChange();
+ virtual afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+ virtual afx_msg void OnVscroll();
+ virtual afx_msg void OnSize(UINT nType, int cx, int cy);
+ virtual afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam); // Maps to WM_SETFONT
+ virtual afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam); // Maps to WM_SETTEXT
+ virtual afx_msg LRESULT OnLineScroll(WPARAM wParam, LPARAM lParam); // Maps to EM_LINESCROLL
+ virtual afx_msg LRESULT OnSelectLine(WPARAM wParam, LPARAM lParam);
+ DECLARE_MESSAGE_MAP()
+
+private:
+ void Prepare();
+ int CalcLineNumberWidth();
+ void UpdateTopAndBottom();
+
+ // Method to set window colour only
+ void SetWindowColour( BOOL bEnable = TRUE );
+
+// Attributes
+ BOOL m_bUseEnabledSystemColours;
+ COLORREF m_EnabledFgCol;
+ COLORREF m_EnabledBgCol;
+ BOOL m_bUseDisabledSystemColours;
+ COLORREF m_DisabledFgCol;
+ COLORREF m_DisabledBgCol;
+
+ CLineNumberStatic m_line;
+ CSize m_zero;
+ int m_maxval;
+ CString m_format;
+ int m_LineDelta; // Introduced to provide an offset to the first line number
+
+};
+
+#endif // !defined(AFX_LINENUMBEREDIT_H__CAB7A465_709C_42B8_80D0_2B0AF6D25AD4__INCLUDED_)
diff --git a/src/apps/mplayerc/MacrovisionKicker.cpp b/src/apps/mplayerc/MacrovisionKicker.cpp
new file mode 100644
index 000000000..2f3e423cb
--- /dev/null
+++ b/src/apps/mplayerc/MacrovisionKicker.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "MacrovisionKicker.h"
+
+//
+// CMacrovisionKicker
+//
+
+CMacrovisionKicker::CMacrovisionKicker(const TCHAR* pName, LPUNKNOWN pUnk)
+ : CUnknown(pName, pUnk)
+{
+}
+
+CMacrovisionKicker::~CMacrovisionKicker()
+{
+}
+
+void CMacrovisionKicker::SetInner(CComPtr<IUnknown> pUnk)
+{
+ m_pInner = pUnk;
+}
+
+STDMETHODIMP CMacrovisionKicker::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ if(riid == __uuidof(IUnknown))
+ return __super::NonDelegatingQueryInterface(riid, ppv);
+ if(riid == __uuidof(IKsPropertySet) && CComQIPtr<IKsPropertySet>(m_pInner))
+ return GetInterface((IKsPropertySet*)this, ppv);
+
+ HRESULT hr = m_pInner ? m_pInner->QueryInterface(riid, ppv) : E_NOINTERFACE;
+
+ return SUCCEEDED(hr) ? hr : __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IKsPropertySet
+
+STDMETHODIMP CMacrovisionKicker::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
+{
+ if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner)
+ {
+ if(PropSet == AM_KSPROPSETID_CopyProt && Id == AM_PROPERTY_COPY_MACROVISION
+ /*&& DataLength == 4 && *(DWORD*)pPropertyData*/)
+ {
+ TRACE(_T("Oops, no-no-no, no macrovision please\n"));
+ return S_OK;
+ }
+
+ return pKsPS->Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
+ }
+
+ return E_UNEXPECTED;
+}
+
+STDMETHODIMP CMacrovisionKicker::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
+{
+ if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner)
+ {
+ return pKsPS->Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
+ }
+
+ return E_UNEXPECTED;
+}
+
+STDMETHODIMP CMacrovisionKicker::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
+{
+ if(CComQIPtr<IKsPropertySet> pKsPS = m_pInner)
+ {
+ return pKsPS->QuerySupported(PropSet, Id, pTypeSupport);
+ }
+
+ return E_UNEXPECTED;
+}
diff --git a/src/apps/mplayerc/MacrovisionKicker.h b/src/apps/mplayerc/MacrovisionKicker.h
new file mode 100644
index 000000000..72b465cf3
--- /dev/null
+++ b/src/apps/mplayerc/MacrovisionKicker.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+class CMacrovisionKicker
+ : public CUnknown
+ , public IKsPropertySet
+{
+ CComPtr<IUnknown> m_pInner;
+
+public:
+ CMacrovisionKicker(const TCHAR* pName, LPUNKNOWN pUnk);
+ virtual ~CMacrovisionKicker();
+
+ void SetInner(CComPtr<IUnknown> pUnk);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IKsPropertySet
+ STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength);
+ STDMETHODIMP Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned);
+ STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport);
+};
+
diff --git a/src/apps/mplayerc/MainFrm.cpp b/src/apps/mplayerc/MainFrm.cpp
new file mode 100644
index 000000000..100b87ec9
--- /dev/null
+++ b/src/apps/mplayerc/MainFrm.cpp
@@ -0,0 +1,10265 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// MainFrm.cpp : implementation of the CMainFrame class
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+
+#include "MainFrm.h"
+
+#include <math.h>
+
+#include <afxpriv.h>
+
+#include <atlconv.h>
+#include <atlrx.h>
+#include <atlsync.h>
+
+#include "OpenFileDlg.h"
+#include "OpenDlg.h"
+#include "SaveDlg.h"
+#include "GoToDlg.h"
+#include "PnSPresetsDlg.h"
+#include "MediaTypesDlg.h"
+#include "SaveTextFileDialog.h"
+#include "SaveThumbnailsDialog.h"
+#include "FavoriteAddDlg.h"
+#include "FavoriteOrganizeDlg.h"
+#include "ConvertDlg.h"
+#include "ShaderCombineDlg.h"
+#include "FullscreenWnd.h"
+
+#include <mtype.h>
+#include <Mpconfig.h>
+#include <ks.h>
+#include <ksmedia.h>
+#include <dvdevcod.h>
+#include <dsound.h>
+
+#include <initguid.h>
+#include <uuids.h>
+#include "..\..\..\include\moreuuids.h"
+#include <Qnetwork.h>
+//#include <qedit.h> // Casimir666 : incompatible avec D3D.h
+
+#include "..\..\DSUtil\DSUtil.h"
+#include "FGManager.h"
+
+#include "textpassthrufilter.h"
+#include "..\..\filters\filters.h"
+#include "..\..\filters\PinInfoWnd.h"
+
+#include "DX7AllocatorPresenter.h"
+#include "DX9AllocatorPresenter.h"
+
+#include "..\..\subtitles\SSF.h"
+#include "ComPropertySheet.h"
+
+
+#define DEFCLIENTW 292
+#define DEFCLIENTH 200
+
+static UINT s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
+static UINT WM_NOTIFYICON = RegisterWindowMessage(TEXT("MYWM_NOTIFYICON"));
+
+#include "..\..\filters\transform\vsfilter\IDirectVobSub.h"
+
+class CSubClock : public CUnknown, public ISubClock
+{
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
+ {
+ return
+ QI(ISubClock)
+ CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ }
+
+ REFERENCE_TIME m_rt;
+
+public:
+ CSubClock() : CUnknown(NAME("CSubClock"), NULL) {m_rt = 0;}
+
+ DECLARE_IUNKNOWN;
+
+ // ISubClock
+ STDMETHODIMP SetTime(REFERENCE_TIME rt) {m_rt = rt; return S_OK;}
+ STDMETHODIMP_(REFERENCE_TIME) GetTime() {return(m_rt);}
+};
+
+//
+
+#define SaveMediaState \
+ OAFilterState __fs = GetMediaState(); \
+ \
+ REFERENCE_TIME __rt = 0; \
+ if(m_iMediaLoadState == MLS_LOADED) __rt = GetPos(); \
+ \
+ if(__fs != State_Stopped) \
+ SendMessage(WM_COMMAND, ID_PLAY_STOP); \
+
+
+#define RestoreMediaState \
+ if(m_iMediaLoadState == MLS_LOADED) \
+ { \
+ SeekTo(__rt); \
+ \
+ if(__fs == State_Stopped) \
+ SendMessage(WM_COMMAND, ID_PLAY_STOP); \
+ else if(__fs == State_Paused) \
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE); \
+ else if(__fs == State_Running) \
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY); \
+ } \
+
+/*
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+*/
+/////////////////////////////////////////////////////////////////////////////
+// CMainFrame
+
+IMPLEMENT_DYNAMIC(CMainFrame, CFrameWnd)
+
+BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
+ ON_WM_CREATE()
+ ON_WM_DESTROY()
+ ON_WM_CLOSE()
+
+ ON_REGISTERED_MESSAGE(s_uTaskbarRestart, OnTaskBarRestart)
+ ON_REGISTERED_MESSAGE(WM_NOTIFYICON, OnNotifyIcon)
+
+ ON_WM_SETFOCUS()
+ ON_WM_GETMINMAXINFO()
+ ON_WM_MOVE()
+ ON_WM_MOVING()
+ ON_WM_SIZE()
+ ON_WM_SIZING()
+ ON_MESSAGE_VOID(WM_DISPLAYCHANGE, OnDisplayChange)
+
+ ON_WM_SYSCOMMAND()
+ ON_WM_ACTIVATEAPP()
+ ON_MESSAGE(WM_APPCOMMAND, OnAppCommand)
+
+ ON_WM_TIMER()
+
+ ON_MESSAGE(WM_GRAPHNOTIFY, OnGraphNotify)
+ ON_MESSAGE(WM_REARRANGERENDERLESS, OnRepaintRenderLess)
+ ON_MESSAGE(WM_RESUMEFROMSTATE, OnResumeFromState)
+
+ ON_WM_LBUTTONDOWN()
+ ON_WM_LBUTTONUP()
+ ON_WM_LBUTTONDBLCLK()
+ ON_WM_MBUTTONDOWN()
+ ON_WM_MBUTTONUP()
+ ON_WM_MBUTTONDBLCLK()
+ ON_WM_RBUTTONDOWN()
+ ON_WM_RBUTTONUP()
+ ON_WM_RBUTTONDBLCLK()
+ ON_MESSAGE(WM_XBUTTONDOWN, OnXButtonDown)
+ ON_MESSAGE(WM_XBUTTONUP, OnXButtonUp)
+ ON_MESSAGE(WM_XBUTTONDBLCLK, OnXButtonDblClk)
+ ON_WM_MOUSEWHEEL()
+ ON_WM_MOUSEMOVE()
+
+ ON_WM_NCHITTEST()
+
+ ON_WM_HSCROLL()
+
+ ON_WM_INITMENU()
+ ON_WM_INITMENUPOPUP()
+
+ ON_COMMAND(ID_MENU_PLAYER_SHORT, OnMenuPlayerShort)
+ ON_COMMAND(ID_MENU_PLAYER_LONG, OnMenuPlayerLong)
+ ON_COMMAND(ID_MENU_FILTERS, OnMenuFilters)
+
+ ON_UPDATE_COMMAND_UI(IDC_PLAYERSTATUS, OnUpdatePlayerStatus)
+
+ ON_COMMAND(ID_FILE_POST_OPENMEDIA, OnFilePostOpenmedia)
+ ON_UPDATE_COMMAND_UI(ID_FILE_POST_OPENMEDIA, OnUpdateFilePostOpenmedia)
+ ON_COMMAND(ID_FILE_POST_CLOSEMEDIA, OnFilePostClosemedia)
+ ON_UPDATE_COMMAND_UI(ID_FILE_POST_CLOSEMEDIA, OnUpdateFilePostClosemedia)
+
+ ON_COMMAND(ID_BOSS, OnBossKey)
+
+ ON_COMMAND_RANGE(ID_STREAM_AUDIO_NEXT, ID_STREAM_AUDIO_PREV, OnStreamAudio)
+ ON_COMMAND_RANGE(ID_STREAM_SUB_NEXT, ID_STREAM_SUB_PREV, OnStreamSub)
+ ON_COMMAND(ID_STREAM_SUB_ONOFF, OnStreamSubOnOff)
+ ON_COMMAND_RANGE(ID_OGM_AUDIO_NEXT, ID_OGM_AUDIO_PREV, OnOgmAudio)
+ ON_COMMAND_RANGE(ID_OGM_SUB_NEXT, ID_OGM_SUB_PREV, OnOgmSub)
+ ON_COMMAND_RANGE(ID_DVD_ANGLE_NEXT, ID_DVD_ANGLE_PREV, OnDvdAngle)
+ ON_COMMAND_RANGE(ID_DVD_AUDIO_NEXT, ID_DVD_AUDIO_PREV, OnDvdAudio)
+ ON_COMMAND_RANGE(ID_DVD_SUB_NEXT, ID_DVD_SUB_PREV, OnDvdSub)
+ ON_COMMAND(ID_DVD_SUB_ONOFF, OnDvdSubOnOff)
+
+
+ ON_COMMAND(ID_FILE_OPENQUICK, OnFileOpenQuick)
+ ON_UPDATE_COMMAND_UI(ID_FILE_OPENMEDIA, OnUpdateFileOpen)
+ ON_COMMAND(ID_FILE_OPENMEDIA, OnFileOpenmedia)
+ ON_UPDATE_COMMAND_UI(ID_FILE_OPENMEDIA, OnUpdateFileOpen)
+ ON_WM_COPYDATA()
+ ON_COMMAND(ID_FILE_OPENDVD, OnFileOpendvd)
+ ON_UPDATE_COMMAND_UI(ID_FILE_OPENDVD, OnUpdateFileOpen)
+ ON_COMMAND(ID_FILE_OPENDEVICE, OnFileOpendevice)
+ ON_UPDATE_COMMAND_UI(ID_FILE_OPENDEVICE, OnUpdateFileOpen)
+ ON_COMMAND_RANGE(ID_FILE_OPEN_CD_START, ID_FILE_OPEN_CD_END, OnFileOpenCD)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_FILE_OPEN_CD_START, ID_FILE_OPEN_CD_END, OnUpdateFileOpen)
+ ON_WM_DROPFILES()
+ ON_COMMAND(ID_FILE_SAVE_COPY, OnFileSaveAs)
+ ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_COPY, OnUpdateFileSaveAs)
+ ON_COMMAND(ID_FILE_SAVE_IMAGE, OnFileSaveImage)
+ ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_IMAGE, OnUpdateFileSaveImage)
+ ON_COMMAND(ID_FILE_SAVE_IMAGE_AUTO, OnFileSaveImageAuto)
+ ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_IMAGE_AUTO, OnUpdateFileSaveImage)
+ ON_COMMAND(ID_FILE_SAVE_THUMBNAILS, OnFileSaveThumbnails)
+ ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_THUMBNAILS, OnUpdateFileSaveThumbnails)
+ ON_COMMAND(ID_FILE_CONVERT, OnFileConvert)
+ ON_UPDATE_COMMAND_UI(ID_FILE_CONVERT, OnUpdateFileConvert)
+ ON_COMMAND(ID_FILE_LOAD_SUBTITLE, OnFileLoadsubtitle)
+ ON_UPDATE_COMMAND_UI(ID_FILE_LOAD_SUBTITLE, OnUpdateFileLoadsubtitle)
+ ON_COMMAND(ID_FILE_SAVE_SUBTITLE, OnFileSavesubtitle)
+ ON_UPDATE_COMMAND_UI(ID_FILE_SAVE_SUBTITLE, OnUpdateFileSavesubtitle)
+ ON_COMMAND(ID_FILE_ISDB_SEARCH, OnFileISDBSearch)
+ ON_UPDATE_COMMAND_UI(ID_FILE_ISDB_SEARCH, OnUpdateFileISDBSearch)
+ ON_COMMAND(ID_FILE_ISDB_UPLOAD, OnFileISDBUpload)
+ ON_UPDATE_COMMAND_UI(ID_FILE_ISDB_UPLOAD, OnUpdateFileISDBUpload)
+ ON_COMMAND(ID_FILE_ISDB_DOWNLOAD, OnFileISDBDownload)
+ ON_UPDATE_COMMAND_UI(ID_FILE_ISDB_DOWNLOAD, OnUpdateFileISDBDownload)
+ ON_COMMAND(ID_FILE_PROPERTIES, OnFileProperties)
+ ON_UPDATE_COMMAND_UI(ID_FILE_PROPERTIES, OnUpdateFileProperties)
+ ON_COMMAND(ID_FILE_CLOSEPLAYLIST, OnFileClosePlaylist)
+ ON_COMMAND(ID_FILE_CLOSEMEDIA, OnFileCloseMedia)
+ ON_UPDATE_COMMAND_UI(ID_FILE_CLOSEMEDIA, OnUpdateFileClose)
+
+ ON_COMMAND(ID_VIEW_CAPTIONMENU, OnViewCaptionmenu)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_CAPTIONMENU, OnUpdateViewCaptionmenu)
+ ON_COMMAND_RANGE(ID_VIEW_SEEKER, ID_VIEW_STATUS, OnViewControlBar)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_SEEKER, ID_VIEW_STATUS, OnUpdateViewControlBar)
+ ON_COMMAND(ID_VIEW_SUBRESYNC, OnViewSubresync)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_SUBRESYNC, OnUpdateViewSubresync)
+ ON_COMMAND(ID_VIEW_PLAYLIST, OnViewPlaylist)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_PLAYLIST, OnUpdateViewPlaylist)
+ ON_COMMAND(ID_VIEW_CAPTURE, OnViewCapture)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_CAPTURE, OnUpdateViewCapture)
+ ON_COMMAND(ID_VIEW_SHADEREDITOR, OnViewShaderEditor)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_SHADEREDITOR, OnUpdateViewShaderEditor)
+ ON_COMMAND(ID_VIEW_PRESETS_MINIMAL, OnViewMinimal)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_PRESETS_MINIMAL, OnUpdateViewMinimal)
+ ON_COMMAND(ID_VIEW_PRESETS_COMPACT, OnViewCompact)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_PRESETS_COMPACT, OnUpdateViewCompact)
+ ON_COMMAND(ID_VIEW_PRESETS_NORMAL, OnViewNormal)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_PRESETS_NORMAL, OnUpdateViewNormal)
+ ON_COMMAND(ID_VIEW_FULLSCREEN, OnViewFullscreen)
+ ON_COMMAND(ID_VIEW_FULLSCREEN_SECONDARY, OnViewFullscreenSecondary)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_FULLSCREEN, OnUpdateViewFullscreen)
+ ON_COMMAND_RANGE(ID_VIEW_ZOOM_50, ID_VIEW_ZOOM_200, OnViewZoom)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_ZOOM_50, ID_VIEW_ZOOM_200, OnUpdateViewZoom)
+ ON_COMMAND(ID_VIEW_ZOOM_AUTOFIT, OnViewZoomAutoFit)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_ZOOM_AUTOFIT, OnUpdateViewZoom)
+ ON_COMMAND_RANGE(ID_VIEW_VF_HALF, ID_VIEW_VF_FROMOUTSIDE, OnViewDefaultVideoFrame)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_VF_HALF, ID_VIEW_VF_FROMOUTSIDE, OnUpdateViewDefaultVideoFrame)
+ ON_COMMAND(ID_VIEW_VF_KEEPASPECTRATIO, OnViewKeepaspectratio)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_VF_KEEPASPECTRATIO, OnUpdateViewKeepaspectratio)
+ ON_COMMAND(ID_VIEW_VF_COMPMONDESKARDIFF, OnViewCompMonDeskARDiff)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_VF_COMPMONDESKARDIFF, OnUpdateViewCompMonDeskARDiff)
+ ON_COMMAND_RANGE(ID_VIEW_RESET, ID_PANSCAN_CENTER, OnViewPanNScan)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_RESET, ID_PANSCAN_CENTER, OnUpdateViewPanNScan)
+ ON_COMMAND_RANGE(ID_PANNSCAN_PRESETS_START, ID_PANNSCAN_PRESETS_END, OnViewPanNScanPresets)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_PANNSCAN_PRESETS_START, ID_PANNSCAN_PRESETS_END, OnUpdateViewPanNScanPresets)
+ ON_COMMAND_RANGE(ID_PANSCAN_ROTATEXP, ID_PANSCAN_ROTATEZM, OnViewRotate)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_PANSCAN_ROTATEXP, ID_PANSCAN_ROTATEZM, OnUpdateViewRotate)
+ ON_COMMAND_RANGE(ID_ASPECTRATIO_START, ID_ASPECTRATIO_END, OnViewAspectRatio)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_ASPECTRATIO_START, ID_ASPECTRATIO_END, OnUpdateViewAspectRatio)
+ ON_COMMAND(ID_ASPECTRATIO_NEXT, OnViewAspectRatioNext)
+ ON_COMMAND_RANGE(ID_ONTOP_NEVER, ID_ONTOP_WHILEPLAYING, OnViewOntop)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_ONTOP_NEVER, ID_ONTOP_WHILEPLAYING, OnUpdateViewOntop)
+ ON_COMMAND(ID_VIEW_OPTIONS, OnViewOptions)
+
+ // Casimir666
+ ON_UPDATE_COMMAND_UI(ID_VIEW_TEARING_TEST, OnUpdateViewTearingTest)
+ ON_COMMAND(ID_VIEW_TEARING_TEST, OnViewTearingTest)
+ ON_UPDATE_COMMAND_UI(ID_SHADER_TOGGLE, OnUpdateShaderToggle)
+ ON_COMMAND(ID_SHADER_TOGGLE, OnShaderToggle)
+ ON_UPDATE_COMMAND_UI(ID_VIEW_REMAINING_TIME, OnUpdateViewRemainingTime)
+ ON_COMMAND(ID_VIEW_REMAINING_TIME, OnViewRemainingTime)
+
+ ON_COMMAND(ID_PLAY_PLAY, OnPlayPlay)
+ ON_COMMAND(ID_PLAY_PAUSE, OnPlayPause)
+ ON_COMMAND(ID_PLAY_PLAYPAUSE, OnPlayPlaypause)
+ ON_COMMAND(ID_PLAY_STOP, OnPlayStop)
+ ON_UPDATE_COMMAND_UI(ID_PLAY_PLAY, OnUpdatePlayPauseStop)
+ ON_UPDATE_COMMAND_UI(ID_PLAY_PAUSE, OnUpdatePlayPauseStop)
+ ON_UPDATE_COMMAND_UI(ID_PLAY_PLAYPAUSE, OnUpdatePlayPauseStop)
+ ON_UPDATE_COMMAND_UI(ID_PLAY_STOP, OnUpdatePlayPauseStop)
+ ON_COMMAND_RANGE(ID_PLAY_FRAMESTEP, ID_PLAY_FRAMESTEPCANCEL, OnPlayFramestep)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_FRAMESTEP, ID_PLAY_FRAMESTEPCANCEL, OnUpdatePlayFramestep)
+ ON_COMMAND_RANGE(ID_PLAY_SEEKBACKWARDSMALL, ID_PLAY_SEEKFORWARDLARGE, OnPlaySeek)
+ ON_COMMAND_RANGE(ID_PLAY_SEEKKEYBACKWARD, ID_PLAY_SEEKKEYFORWARD, OnPlaySeekKey)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_SEEKBACKWARDSMALL, ID_PLAY_SEEKFORWARDLARGE, OnUpdatePlaySeek)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_SEEKKEYBACKWARD, ID_PLAY_SEEKKEYFORWARD, OnUpdatePlaySeek)
+ ON_COMMAND(ID_PLAY_GOTO, OnPlayGoto)
+ ON_UPDATE_COMMAND_UI(ID_PLAY_GOTO, OnUpdateGoto)
+ ON_COMMAND_RANGE(ID_PLAY_DECRATE, ID_PLAY_INCRATE, OnPlayChangeRate)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_DECRATE, ID_PLAY_INCRATE, OnUpdatePlayChangeRate)
+ ON_COMMAND(ID_PLAY_RESETRATE, OnPlayResetRate)
+ ON_UPDATE_COMMAND_UI(ID_PLAY_RESETRATE, OnUpdatePlayResetRate)
+ ON_COMMAND_RANGE(ID_PLAY_INCAUDDELAY, ID_PLAY_DECAUDDELAY, OnPlayChangeAudDelay)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_PLAY_INCAUDDELAY, ID_PLAY_DECAUDDELAY, OnUpdatePlayChangeAudDelay)
+ ON_COMMAND_RANGE(ID_FILTERS_SUBITEM_START, ID_FILTERS_SUBITEM_END, OnPlayFilters)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_FILTERS_SUBITEM_START, ID_FILTERS_SUBITEM_END, OnUpdatePlayFilters)
+ ON_COMMAND_RANGE(ID_SHADERS_START, ID_SHADERS_END, OnPlayShaders)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_SHADERS_START, ID_SHADERS_END, OnUpdatePlayShaders)
+ ON_COMMAND_RANGE(ID_AUDIO_SUBITEM_START, ID_AUDIO_SUBITEM_END, OnPlayAudio)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_AUDIO_SUBITEM_START, ID_AUDIO_SUBITEM_END, OnUpdatePlayAudio)
+ ON_COMMAND_RANGE(ID_SUBTITLES_SUBITEM_START, ID_SUBTITLES_SUBITEM_END, OnPlaySubtitles)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_SUBTITLES_SUBITEM_START, ID_SUBTITLES_SUBITEM_END, OnUpdatePlaySubtitles)
+ ON_COMMAND_RANGE(ID_FILTERSTREAMS_SUBITEM_START, ID_FILTERSTREAMS_SUBITEM_END, OnPlayLanguage)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_FILTERSTREAMS_SUBITEM_START, ID_FILTERSTREAMS_SUBITEM_END, OnUpdatePlayLanguage)
+ ON_COMMAND_RANGE(ID_VOLUME_UP, ID_VOLUME_MUTE, OnPlayVolume)
+ ON_COMMAND_RANGE(ID_VOLUME_BOOST_INC, ID_VOLUME_BOOST_MAX, OnPlayVolumeBoost)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_VOLUME_BOOST_INC, ID_VOLUME_BOOST_MAX, OnUpdatePlayVolumeBoost)
+ ON_COMMAND_RANGE(ID_AFTERPLAYBACK_CLOSE, ID_AFTERPLAYBACK_DONOTHING, OnAfterplayback)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_AFTERPLAYBACK_CLOSE, ID_AFTERPLAYBACK_DONOTHING, OnUpdateAfterplayback)
+
+ ON_COMMAND_RANGE(ID_NAVIGATE_SKIPBACK, ID_NAVIGATE_SKIPFORWARD, OnNavigateSkip)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_NAVIGATE_SKIPBACK, ID_NAVIGATE_SKIPFORWARD, OnUpdateNavigateSkip)
+ ON_COMMAND_RANGE(ID_NAVIGATE_SKIPBACKPLITEM, ID_NAVIGATE_SKIPFORWARDPLITEM, OnNavigateSkipPlaylistItem)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_NAVIGATE_SKIPBACKPLITEM, ID_NAVIGATE_SKIPFORWARDPLITEM, OnUpdateNavigateSkipPlaylistItem)
+ ON_COMMAND_RANGE(ID_NAVIGATE_TITLEMENU, ID_NAVIGATE_CHAPTERMENU, OnNavigateMenu)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_NAVIGATE_TITLEMENU, ID_NAVIGATE_CHAPTERMENU, OnUpdateNavigateMenu)
+ ON_COMMAND_RANGE(ID_NAVIGATE_AUDIO_SUBITEM_START, ID_NAVIGATE_AUDIO_SUBITEM_END, OnNavigateAudio)
+ ON_COMMAND_RANGE(ID_NAVIGATE_SUBP_SUBITEM_START, ID_NAVIGATE_SUBP_SUBITEM_END, OnNavigateSubpic)
+ ON_COMMAND_RANGE(ID_NAVIGATE_ANGLE_SUBITEM_START, ID_NAVIGATE_ANGLE_SUBITEM_END, OnNavigateAngle)
+ ON_COMMAND_RANGE(ID_NAVIGATE_CHAP_SUBITEM_START, ID_NAVIGATE_CHAP_SUBITEM_END, OnNavigateChapters)
+ ON_COMMAND_RANGE(ID_NAVIGATE_MENU_LEFT, ID_NAVIGATE_MENU_LEAVE, OnNavigateMenuItem)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_NAVIGATE_MENU_LEFT, ID_NAVIGATE_MENU_LEAVE, OnUpdateNavigateMenuItem)
+
+ ON_COMMAND(ID_FAVORITES_ADD, OnFavoritesAdd)
+ ON_UPDATE_COMMAND_UI(ID_FAVORITES_ADD, OnUpdateFavoritesAdd)
+ ON_COMMAND(ID_FAVORITES_ORGANIZE, OnFavoritesOrganize)
+ ON_UPDATE_COMMAND_UI(ID_FAVORITES_ORGANIZE, OnUpdateFavoritesOrganize)
+ ON_COMMAND_RANGE(ID_FAVORITES_FILE_START, ID_FAVORITES_FILE_END, OnFavoritesFile)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_FAVORITES_FILE_START, ID_FAVORITES_FILE_END, OnUpdateFavoritesFile)
+ ON_COMMAND_RANGE(ID_FAVORITES_DVD_START, ID_FAVORITES_DVD_END, OnFavoritesDVD)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_FAVORITES_DVD_START, ID_FAVORITES_DVD_END, OnUpdateFavoritesDVD)
+ ON_COMMAND_RANGE(ID_FAVORITES_DEVICE_START, ID_FAVORITES_DEVICE_END, OnFavoritesDevice)
+ ON_UPDATE_COMMAND_UI_RANGE(ID_FAVORITES_DEVICE_START, ID_FAVORITES_DEVICE_END, OnUpdateFavoritesDevice)
+
+ ON_COMMAND(ID_HELP_HOMEPAGE, OnHelpHomepage)
+ ON_COMMAND(ID_HELP_DOCUMENTATION, OnHelpDocumentation)
+ ON_COMMAND(ID_HELP_DONATE, OnHelpDonate)
+
+ END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CMainFrame construction/destruction
+
+#pragma warning(disable : 4355)
+
+CMainFrame::CMainFrame() :
+ m_dwRegister(0),
+ m_iMediaLoadState(MLS_CLOSED),
+ m_iPlaybackMode(PM_NONE),
+ m_iSpeedLevel(0),
+ m_rtDurationOverride(-1),
+ m_fFullScreen(false),
+ m_fHideCursor(false),
+ m_lastMouseMove(-1, -1),
+ m_pLastBar(NULL),
+ m_nLoops(0),
+ m_iSubtitleSel(-1),
+ m_ZoomX(1), m_ZoomY(1), m_PosX(0.5), m_PosY(0.5),
+ m_AngleX(0), m_AngleY(0), m_AngleZ(0),
+ m_fCustomGraph(false),
+ m_fRealMediaGraph(false), m_fShockwaveGraph(false), m_fQuicktimeGraph(false),
+ m_fFrameSteppingActive(false),
+ m_fEndOfStream(false),
+ m_fCapturing(false),
+ m_fLiveWM(false),
+ m_fOpeningAborted(false),
+ m_fBuffering(false),
+ m_fileDropTarget(this),
+ m_fTrayIcon(false),
+ m_pFullscreenWnd(NULL),
+ m_pVideoWnd(NULL),
+ m_bD3DFullscreenMode(false),
+ m_bRemainingTime(false)
+{
+}
+
+CMainFrame::~CMainFrame()
+{
+// m_owner.DestroyWindow();
+}
+
+int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if(__super::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ m_popup.LoadMenu(IDR_POPUP);
+ m_popupmain.LoadMenu(IDR_POPUPMAIN);
+
+ GetMenu()->ModifyMenu(ID_FAVORITES, MF_BYCOMMAND|MF_STRING, IDR_MAINFRAME, ResStr(IDS_FAVORITES_POPUP));
+
+ // create a view to occupy the client area of the frame
+ if(!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
+ CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
+ {
+ TRACE0("Failed to create view window\n");
+ return -1;
+ }
+
+ // static bars
+
+ if(!m_wndStatusBar.Create(this)
+ || !m_wndStatsBar.Create(this)
+ || !m_wndInfoBar.Create(this)
+ || !m_wndToolBar.Create(this)
+ || !m_wndSeekBar.Create(this))
+ {
+ TRACE0("Failed to create all control bars\n");
+ return -1; // fail to create
+ }
+
+ m_pFullscreenWnd = new CFullscreenWnd(this);
+
+ m_bars.AddTail(&m_wndSeekBar);
+ m_bars.AddTail(&m_wndToolBar);
+ m_bars.AddTail(&m_wndInfoBar);
+ m_bars.AddTail(&m_wndStatsBar);
+ m_bars.AddTail(&m_wndStatusBar);
+
+ m_wndSeekBar.Enable(false);
+
+ // dockable bars
+
+ EnableDocking(CBRS_ALIGN_ANY);
+
+ m_dockingbars.RemoveAll();
+
+ m_wndSubresyncBar.Create(this, &m_csSubLock);
+ m_wndSubresyncBar.SetBarStyle(m_wndSubresyncBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
+ m_wndSubresyncBar.EnableDocking(CBRS_ALIGN_ANY);
+ m_wndSubresyncBar.SetHeight(200);
+ LoadControlBar(&m_wndSubresyncBar, AFX_IDW_DOCKBAR_TOP);
+
+ m_wndPlaylistBar.Create(this);
+ m_wndPlaylistBar.SetBarStyle(m_wndPlaylistBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
+ m_wndPlaylistBar.EnableDocking(CBRS_ALIGN_ANY);
+ m_wndPlaylistBar.SetHeight(100);
+ LoadControlBar(&m_wndPlaylistBar, AFX_IDW_DOCKBAR_BOTTOM);
+ m_wndPlaylistBar.LoadPlaylist();
+
+ m_wndCaptureBar.Create(this);
+ m_wndCaptureBar.SetBarStyle(m_wndCaptureBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
+ m_wndCaptureBar.EnableDocking(CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT);
+ LoadControlBar(&m_wndCaptureBar, AFX_IDW_DOCKBAR_LEFT);
+
+ m_wndShaderEditorBar.Create(this);
+ m_wndShaderEditorBar.SetBarStyle(m_wndShaderEditorBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
+ m_wndShaderEditorBar.EnableDocking(CBRS_ALIGN_ANY);
+ LoadControlBar(&m_wndShaderEditorBar, AFX_IDW_DOCKBAR_TOP);
+
+ m_fileDropTarget.Register(this);
+
+ GetDesktopWindow()->GetWindowRect(&m_rcDesktop);
+
+ AppSettings& s = AfxGetAppSettings();
+
+ ShowControls(s.nCS);
+
+ SetAlwaysOnTop(s.iOnTop);
+
+ ShowTrayIcon(s.fTrayIcon);
+
+ SetFocus();
+
+ m_pGraphThread = (CGraphThread*)AfxBeginThread(RUNTIME_CLASS(CGraphThread));
+
+ if(m_pGraphThread)
+ m_pGraphThread->SetMainFrame(this);
+
+ if(s.fEnableWebServer)
+ StartWebServer(s.nWebServerPort);
+
+ // Casimir666 : rechargement des Shaders
+ CString strList = AfxGetAppSettings().strShaderList;
+ CString strRes;
+ int curPos= 0;
+
+ strRes = strList.Tokenize (_T("|"), curPos);
+ while (strRes != _T(""))
+ {
+ m_shaderlabels.AddTail (strRes);
+ strRes = strList.Tokenize(_T("|"),curPos);
+ };
+
+ return 0;
+}
+
+void CMainFrame::OnDestroy()
+{
+ ShowTrayIcon(false);
+
+ m_fileDropTarget.Revoke();
+
+ if(m_pGraphThread)
+ {
+ CAMEvent e;
+ m_pGraphThread->PostThreadMessage(CGraphThread::TM_EXIT, 0, (LPARAM)&e);
+ if(!e.Wait(5000))
+ {
+ TRACE(_T("ERROR: Must call TerminateThread() on CMainFrame::m_pGraphThread->m_hThread\n"));
+ TerminateThread(m_pGraphThread->m_hThread, -1);
+ }
+ }
+
+ __super::OnDestroy();
+}
+
+void CMainFrame::OnClose()
+{
+ // Casimir666 : sauvegarde de la liste des shaders
+ POSITION pos;
+ CString strList = "";
+
+ pos = m_shaderlabels.GetHeadPosition();
+ while(pos)
+ {
+ strList += m_shaderlabels.GetAt (pos) + "|";
+ m_dockingbars.GetNext(pos);
+ }
+ AfxGetAppSettings().strShaderList = strList;
+
+ m_wndPlaylistBar.SavePlaylist();
+
+ SaveControlBars();
+
+ ShowWindow(SW_HIDE);
+
+ CloseMedia();
+
+ __super::OnClose();
+}
+
+DROPEFFECT CMainFrame::OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+ return DROPEFFECT_NONE;
+}
+DROPEFFECT CMainFrame::OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
+{
+ UINT CF_URL = RegisterClipboardFormat(_T("UniformResourceLocator"));
+ return pDataObject->IsDataAvailable(CF_URL) ? DROPEFFECT_COPY : DROPEFFECT_NONE;
+}
+BOOL CMainFrame::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
+{
+ UINT CF_URL = RegisterClipboardFormat(_T("UniformResourceLocator"));
+
+ BOOL bResult = FALSE;
+
+ if(pDataObject->IsDataAvailable(CF_URL))
+ {
+ FORMATETC fmt = {CF_URL, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL};
+ if(HGLOBAL hGlobal = pDataObject->GetGlobalData(CF_URL, &fmt))
+ {
+ LPCSTR pText = (LPCSTR)GlobalLock(hGlobal);
+ if(AfxIsValidString(pText))
+ {
+ CStringA url(pText);
+
+ SetForegroundWindow();
+
+ CAtlList<CString> sl;
+ sl.AddTail(CString(url));
+
+ if(m_wndPlaylistBar.IsWindowVisible())
+ {
+ m_wndPlaylistBar.Append(sl, true);
+ }
+ else
+ {
+ m_wndPlaylistBar.Open(sl, true);
+ OpenCurPlaylistItem();
+ }
+
+ GlobalUnlock(hGlobal);
+ bResult = TRUE;
+ }
+ }
+ }
+
+ return bResult;
+}
+DROPEFFECT CMainFrame::OnDropEx(COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point)
+{
+ return (DROPEFFECT)-1;
+}
+void CMainFrame::OnDragLeave()
+{
+}
+DROPEFFECT CMainFrame::OnDragScroll(DWORD dwKeyState, CPoint point)
+{
+ return DROPEFFECT_NONE;
+}
+
+void CMainFrame::LoadControlBar(CControlBar* pBar, UINT defDockBarID)
+{
+ if(!pBar) return;
+
+ CString str;
+ pBar->GetWindowText(str);
+ if(str.IsEmpty()) return;
+ CString section = _T("ToolBars\\") + str;
+
+ CWinApp* pApp = AfxGetApp();
+
+ UINT nID = pApp->GetProfileInt(section, _T("DockState"), defDockBarID);
+
+ if(nID != AFX_IDW_DOCKBAR_FLOAT)
+ {
+ DockControlBar(pBar, nID);
+ }
+
+ pBar->ShowWindow(
+ pApp->GetProfileInt(section, _T("Visible"), FALSE)
+ && pBar != &m_wndSubresyncBar
+ && pBar != &m_wndCaptureBar
+ && pBar != &m_wndShaderEditorBar
+ ? SW_SHOW
+ : SW_HIDE);
+
+ if(CSizingControlBar* pSCB = dynamic_cast<CSizingControlBar*>(pBar))
+ {
+ pSCB->LoadState(section + _T("\\State"));
+ m_dockingbars.AddTail(pSCB);
+ }
+}
+
+void CMainFrame::RestoreFloatingControlBars()
+{
+ CWinApp* pApp = AfxGetApp();
+
+ CRect r;
+ GetWindowRect(r);
+
+ POSITION pos = m_dockingbars.GetHeadPosition();
+ while(pos)
+ {
+ CSizingControlBar* pBar = m_dockingbars.GetNext(pos);
+
+ CString str;
+ pBar->GetWindowText(str);
+ if(str.IsEmpty()) return;
+ CString section = _T("ToolBars\\") + str;
+
+ if(pApp->GetProfileInt(section, _T("DockState"), ~AFX_IDW_DOCKBAR_FLOAT) == AFX_IDW_DOCKBAR_FLOAT)
+ {
+ CPoint p;
+ p.x = pApp->GetProfileInt(section, _T("DockPosX"), r.right);
+ p.y = pApp->GetProfileInt(section, _T("DockPosY"), r.top);
+ if(p.x < m_rcDesktop.left) p.x = m_rcDesktop.left;
+ if(p.y < m_rcDesktop.top) p.y = m_rcDesktop.top;
+ if(p.x >= m_rcDesktop.right) p.x = m_rcDesktop.right-1;
+ if(p.y >= m_rcDesktop.bottom) p.y = m_rcDesktop.bottom-1;
+ FloatControlBar(pBar, p);
+ }
+ }
+}
+
+void CMainFrame::SaveControlBars()
+{
+ CWinApp* pApp = AfxGetApp();
+
+ POSITION pos = m_dockingbars.GetHeadPosition();
+ while(pos)
+ {
+ CSizingControlBar* pBar = m_dockingbars.GetNext(pos);
+
+ CString str;
+ pBar->GetWindowText(str);
+ if(str.IsEmpty()) return;
+ CString section = _T("ToolBars\\") + str;
+
+ pApp->WriteProfileInt(section, _T("Visible"), pBar->IsWindowVisible());
+
+ if(CSizingControlBar* pSCB = dynamic_cast<CSizingControlBar*>(pBar))
+ {
+ pSCB->SaveState(section + _T("\\State"));
+ }
+
+ UINT nID = pBar->GetParent()->GetDlgCtrlID();
+
+ if(nID == AFX_IDW_DOCKBAR_FLOAT)
+ {
+ CRect r;
+ pBar->GetParent()->GetParent()->GetWindowRect(r);
+ pApp->WriteProfileInt(section, _T("DockPosX"), r.left);
+ pApp->WriteProfileInt(section, _T("DockPosY"), r.top);
+ }
+
+ pApp->WriteProfileInt(section, _T("DockState"), nID);
+ }
+}
+
+LRESULT CMainFrame::OnTaskBarRestart(WPARAM, LPARAM)
+{
+ m_fTrayIcon = false;
+ ShowTrayIcon(AfxGetAppSettings().fTrayIcon);
+
+ return 0;
+}
+
+LRESULT CMainFrame::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
+{
+ if((UINT)wParam != IDR_MAINFRAME)
+ return -1;
+
+ switch((UINT)lParam)
+ {
+ case WM_LBUTTONDOWN:
+ ShowWindow(SW_SHOW);
+ MoveVideoWindow();
+ SetForegroundWindow();
+ break;
+
+ case WM_LBUTTONDBLCLK:
+ PostMessage(WM_COMMAND, ID_FILE_OPENMEDIA);
+ break;
+
+ case WM_RBUTTONDOWN:
+ {
+ POINT p;
+ GetCursorPos(&p);
+ SetForegroundWindow();
+ m_popupmain.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON|TPM_NOANIMATION, p.x, p.y, this);
+ PostMessage(WM_NULL);
+ break;
+ }
+
+ case WM_MOUSEMOVE:
+ {
+ CString str;
+ GetWindowText(str);
+ SetTrayTip(str);
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+void CMainFrame::ShowTrayIcon(bool fShow)
+{
+ BOOL bWasVisible = ShowWindow(SW_HIDE);
+
+ if(fShow)
+ {
+ if(!m_fTrayIcon)
+ {
+ NOTIFYICONDATA tnid;
+ tnid.cbSize = sizeof(NOTIFYICONDATA);
+ tnid.hWnd = m_hWnd;
+ tnid.uID = IDR_MAINFRAME;
+// tnid.hIcon = (HICON)LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME));
+ tnid.hIcon = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+ tnid.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP;
+ tnid.uCallbackMessage = WM_NOTIFYICON;
+ lstrcpyn(tnid.szTip, TEXT("Media Player Classic"), sizeof(tnid.szTip));
+ Shell_NotifyIcon(NIM_ADD, &tnid);
+
+ m_fTrayIcon = true;
+ }
+ }
+ else
+ {
+ if(m_fTrayIcon)
+ {
+ NOTIFYICONDATA tnid;
+ tnid.cbSize = sizeof(NOTIFYICONDATA);
+ tnid.hWnd = m_hWnd;
+ tnid.uID = IDR_MAINFRAME;
+ Shell_NotifyIcon(NIM_DELETE, &tnid);
+
+ m_fTrayIcon = false;
+ }
+ }
+
+ if(bWasVisible)
+ ShowWindow(SW_SHOW);
+}
+
+void CMainFrame::SetTrayTip(CString str)
+{
+ NOTIFYICONDATA tnid;
+ tnid.cbSize = sizeof(NOTIFYICONDATA);
+ tnid.hWnd = m_hWnd;
+ tnid.uID = IDR_MAINFRAME;
+ tnid.uFlags = NIF_TIP;
+ lstrcpyn(tnid.szTip, str, sizeof(tnid.szTip));
+ Shell_NotifyIcon(NIM_MODIFY, &tnid);
+}
+
+BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!__super::PreCreateWindow(cs))
+ return FALSE;
+
+ cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
+ cs.lpszClass = MPC_WND_CLASS_NAME; //AfxRegisterWndClass(0);
+
+ return TRUE;
+}
+
+BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN)
+ {
+/* if(m_fShockwaveGraph
+ && (pMsg->wParam == VK_LEFT || pMsg->wParam == VK_RIGHT
+ || pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN))
+ return FALSE;
+*/
+ if(pMsg->wParam == VK_ESCAPE && m_iMediaLoadState == MLS_LOADED && m_fFullScreen)
+ {
+ OnViewFullscreen();
+ PostMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ return TRUE;
+ }
+ else if(pMsg->wParam == VK_ESCAPE && (IsCaptionMenuHidden()))
+ {
+ PostMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU);
+ return TRUE;
+ }
+ else if(pMsg->wParam == VK_LEFT && pAMTuner)
+ {
+ PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPBACK);
+ return TRUE;
+ }
+ else if(pMsg->wParam == VK_RIGHT && pAMTuner)
+ {
+ PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
+ return TRUE;
+ }
+ }
+
+ return __super::PreTranslateMessage(pMsg);
+}
+
+void CMainFrame::RecalcLayout(BOOL bNotify)
+{
+ __super::RecalcLayout(bNotify);
+
+ CRect r;
+ GetWindowRect(&r);
+ MINMAXINFO mmi;
+ memset(&mmi, 0, sizeof(mmi));
+ SendMessage(WM_GETMINMAXINFO, 0, (LPARAM)&mmi);
+ r |= CRect(r.TopLeft(), CSize(r.Width(), mmi.ptMinTrackSize.y));
+ MoveWindow(&r);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CMainFrame diagnostics
+
+#ifdef _DEBUG
+void CMainFrame::AssertValid() const
+{
+ __super::AssertValid();
+}
+
+void CMainFrame::Dump(CDumpContext& dc) const
+{
+ __super::Dump(dc);
+}
+
+#endif //_DEBUG
+
+/////////////////////////////////////////////////////////////////////////////
+// CMainFrame message handlers
+void CMainFrame::OnSetFocus(CWnd* pOldWnd)
+{
+ SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
+
+ // forward focus to the view window
+ if(IsWindow(m_wndView.m_hWnd))
+ m_wndView.SetFocus();
+}
+
+BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
+{
+ // let the view have first crack at the command
+ if(m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
+ return TRUE;
+
+ POSITION pos = m_bars.GetHeadPosition();
+ while(pos)
+ {
+ if(m_bars.GetNext(pos)->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
+ return TRUE;
+ }
+
+ pos = m_dockingbars.GetHeadPosition();
+ while(pos)
+ {
+ if(m_dockingbars.GetNext(pos)->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
+ return TRUE;
+ }
+
+ // otherwise, do default handling
+ return __super::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
+}
+
+void CMainFrame::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
+{
+ DWORD style = GetStyle();
+
+ MENUBARINFO mbi;
+ memset(&mbi, 0, sizeof(mbi));
+ mbi.cbSize = sizeof(mbi);
+ ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
+
+ lpMMI->ptMinTrackSize.x = 0;
+ if(!IsCaptionMenuHidden())
+ {
+ lpMMI->ptMinTrackSize.x = 10;
+ CRect r;
+ for(int i = 0; ::GetMenuItemRect(m_hWnd, mbi.hMenu, i, &r); i++)
+ lpMMI->ptMinTrackSize.x += r.Width();
+ lpMMI->ptMinTrackSize.x = max(DEFCLIENTW, lpMMI->ptMinTrackSize.x);
+ }
+ if(style&WS_THICKFRAME) lpMMI->ptMinTrackSize.x += GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2;
+
+ memset(&mbi, 0, sizeof(mbi));
+ mbi.cbSize = sizeof(mbi);
+ ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
+
+ lpMMI->ptMinTrackSize.y = 0;
+ if(style&WS_CAPTION) lpMMI->ptMinTrackSize.y += GetSystemMetrics(SM_CYCAPTION);
+ if(style&WS_THICKFRAME) lpMMI->ptMinTrackSize.y += GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2;
+ lpMMI->ptMinTrackSize.y += (mbi.rcBar.bottom - mbi.rcBar.top);
+ if(!AfxGetAppSettings().fHideCaptionMenu) lpMMI->ptMinTrackSize.y += 3;
+
+ POSITION pos = m_bars.GetHeadPosition();
+ while(pos)
+ {
+ CControlBar* pCB = m_bars.GetNext(pos);
+ if(!IsWindow(pCB->m_hWnd) || !pCB->IsVisible()) continue;
+
+ lpMMI->ptMinTrackSize.y += pCB->CalcFixedLayout(TRUE, TRUE).cy;
+ }
+
+ pos = m_dockingbars.GetHeadPosition();
+ while(pos)
+ {
+ CSizingControlBar* pCB = m_dockingbars.GetNext(pos);
+ if(IsWindow(pCB->m_hWnd) && pCB->IsWindowVisible() && !pCB->IsFloating())
+ lpMMI->ptMinTrackSize.y += pCB->CalcFixedLayout(TRUE, TRUE).cy-2;
+ }
+
+ __super::OnGetMinMaxInfo(lpMMI);
+}
+
+void CMainFrame::OnMove(int x, int y)
+{
+ __super::OnMove(x, y);
+
+ MoveVideoWindow();
+
+ WINDOWPLACEMENT wp;
+ GetWindowPlacement(&wp);
+ if(!m_fFullScreen && wp.flags != WPF_RESTORETOMAXIMIZED && wp.showCmd != SW_SHOWMINIMIZED)
+ GetWindowRect(AfxGetAppSettings().rcLastWindowPos);
+}
+
+void CMainFrame::OnMoving(UINT fwSide, LPRECT pRect)
+{
+ __super::OnMoving(fwSide, pRect);
+
+ if(AfxGetAppSettings().fSnapToDesktopEdges)
+ {
+ const CPoint threshold(3, 3);
+
+ CRect r0 = m_rcDesktop;
+ CRect r1 = r0 + threshold;
+ CRect r2 = r0 - threshold;
+
+ RECT& wr = *pRect;
+ CSize ws = CRect(wr).Size();
+
+ if(wr.left < r1.left && wr.left > r2.left)
+ wr.right = (wr.left = r0.left) + ws.cx;
+
+ if(wr.top < r1.top && wr.top > r2.top)
+ wr.bottom = (wr.top = r0.top) + ws.cy;
+
+ if(wr.right < r1.right && wr.right > r2.right)
+ wr.left = (wr.right = r0.right) - ws.cx;
+
+ if(wr.bottom < r1.bottom && wr.bottom > r2.bottom)
+ wr.top = (wr.bottom = r0.bottom) - ws.cy;
+ }
+}
+
+void CMainFrame::OnSize(UINT nType, int cx, int cy)
+{
+ __super::OnSize(nType, cx, cy);
+
+ m_OSD.OnSize (nType, cx, cy);
+
+ if(nType == SIZE_RESTORED && m_fTrayIcon)
+ {
+ ShowWindow(SW_SHOW);
+ }
+
+ if(!m_fFullScreen)
+ {
+ AppSettings& s = AfxGetAppSettings();
+ if(nType != SIZE_MAXIMIZED && nType != SIZE_MINIMIZED)
+ GetWindowRect(s.rcLastWindowPos);
+ s.lastWindowType = nType;
+ }
+}
+
+void CMainFrame::OnSizing(UINT fwSide, LPRECT pRect)
+{
+ __super::OnSizing(fwSide, pRect);
+
+ AppSettings& s = AfxGetAppSettings();
+
+ bool fCtrl = !!(GetAsyncKeyState(VK_CONTROL)&0x80000000);
+
+ if(m_iMediaLoadState != MLS_LOADED || m_fFullScreen
+ || s.iDefaultVideoSize == DVS_STRETCH
+ || (fCtrl ^ s.fFreeWindowResizing))
+ return;
+
+ CSize wsize(pRect->right - pRect->left, pRect->bottom - pRect->top);
+ CSize vsize = GetVideoSize();
+ CSize fsize(0, 0);
+
+ if(!vsize.cx || !vsize.cy)
+ return;
+
+ // TODO
+ {
+ DWORD style = GetStyle();
+
+ MENUBARINFO mbi;
+ memset(&mbi, 0, sizeof(mbi));
+ mbi.cbSize = sizeof(mbi);
+ ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
+
+ fsize.cx += GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2;
+
+ if(style&WS_CAPTION) fsize.cy += GetSystemMetrics(SM_CYCAPTION);
+ if(style&WS_THICKFRAME) fsize.cy += GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2;
+ fsize.cy += mbi.rcBar.bottom - mbi.rcBar.top;
+ if(!AfxGetAppSettings().fHideCaptionMenu) fsize.cy += 3;
+
+ POSITION pos = m_bars.GetHeadPosition();
+ while(pos)
+ {
+ CControlBar* pCB = m_bars.GetNext(pos);
+ if(IsWindow(pCB->m_hWnd) && pCB->IsVisible())
+ fsize.cy += pCB->CalcFixedLayout(TRUE, TRUE).cy;
+ }
+
+ pos = m_dockingbars.GetHeadPosition();
+ while(pos)
+ {
+ CSizingControlBar* pCB = m_dockingbars.GetNext(pos);
+
+ if(IsWindow(pCB->m_hWnd) && pCB->IsWindowVisible())
+ {
+ if(pCB->IsHorzDocked()) fsize.cy += pCB->CalcFixedLayout(TRUE, TRUE).cy-2;
+ else if(pCB->IsVertDocked()) fsize.cx += pCB->CalcFixedLayout(TRUE, FALSE).cx;
+ }
+ }
+ }
+
+ wsize -= fsize;
+
+ bool fWider = wsize.cy < wsize.cx;
+
+ wsize.SetSize(
+ wsize.cy * vsize.cx / vsize.cy,
+ wsize.cx * vsize.cy / vsize.cx);
+
+ wsize += fsize;
+
+ if(fwSide == WMSZ_TOP || fwSide == WMSZ_BOTTOM || !fWider && (fwSide == WMSZ_TOPRIGHT || fwSide == WMSZ_BOTTOMRIGHT))
+ {
+ pRect->right = pRect->left + wsize.cx;
+ }
+ else if(fwSide == WMSZ_LEFT || fwSide == WMSZ_RIGHT || fWider && (fwSide == WMSZ_BOTTOMLEFT || fwSide == WMSZ_BOTTOMRIGHT))
+ {
+ pRect->bottom = pRect->top + wsize.cy;
+ }
+ else if(!fWider && (fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_BOTTOMLEFT))
+ {
+ pRect->left = pRect->right - wsize.cx;
+ }
+ else if(fWider && (fwSide == WMSZ_TOPLEFT || fwSide == WMSZ_TOPRIGHT))
+ {
+ pRect->top = pRect->bottom - wsize.cy;
+ }
+}
+
+void CMainFrame::OnDisplayChange() // untested, not sure if it's working...
+{
+ TRACE(_T("*** CMainFrame::OnDisplayChange()\n"));
+/*
+ if(m_iMediaLoadState == MLS_LOADED && m_pCAP)
+ m_pCAP->OnDisplayChange();
+*/
+
+ GetDesktopWindow()->GetWindowRect(&m_rcDesktop);
+}
+
+#include <psapi.h>
+
+void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
+{
+ if((nID & 0xFFF0) == SC_SCREENSAVE)
+ {
+ TRACE(_T("SC_SCREENSAVE, nID = %d, lParam = %d\n"), nID, lParam);
+ }
+ else if((nID & 0xFFF0) == SC_MINIMIZE && m_fTrayIcon)
+ {
+ ShowWindow(SW_HIDE);
+ return;
+ }
+
+ __super::OnSysCommand(nID, lParam);
+}
+
+void CMainFrame::OnActivateApp(BOOL bActive, DWORD dwThreadID)
+{
+ __super::OnActivateApp(bActive, dwThreadID);
+
+ MONITORINFO mi;
+ mi.cbSize = sizeof(MONITORINFO);
+ GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi);
+
+ if(!bActive && (mi.dwFlags&MONITORINFOF_PRIMARY) && m_fFullScreen && m_iMediaLoadState == MLS_LOADED)
+ {
+ bool fExitFullscreen = true;
+
+ if(CWnd* pWnd = GetForegroundWindow())
+ {
+ HMONITOR hMonitor1 = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+ HMONITOR hMonitor2 = MonitorFromWindow(pWnd->m_hWnd, MONITOR_DEFAULTTONEAREST);
+ if(hMonitor1 && hMonitor2 && hMonitor1 != hMonitor2) fExitFullscreen = false;
+
+ CString title;
+ pWnd->GetWindowText(title);
+
+ CString module;
+
+ if(GetVersion()&0x80000000)
+ {
+ module.ReleaseBufferSetLength(GetWindowModuleFileName(pWnd->m_hWnd, module.GetBuffer(MAX_PATH), MAX_PATH));
+ }
+ else
+ {
+ DWORD pid;
+ GetWindowThreadProcessId(pWnd->m_hWnd, &pid);
+
+ if(HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid))
+ {
+ HMODULE hMod;
+ DWORD cbNeeded;
+
+ if(EnumProcessModules(hProcess, &hMod, sizeof(hMod), &cbNeeded))
+ {
+ module.ReleaseBufferSetLength(GetModuleFileNameEx(hProcess, hMod, module.GetBuffer(MAX_PATH), MAX_PATH));
+ }
+
+ CloseHandle(hProcess);
+ }
+ }
+
+ CPath p(module);
+ p.StripPath();
+ module = (LPCTSTR)p;
+ module.MakeLower();
+
+ CString str;
+ str.Format(_T("Focus lost to: %s - %s"), module, title);
+ SendStatusMessage(str, 5000);
+ }
+
+ if(fExitFullscreen) OnViewFullscreen();
+ }
+}
+
+LRESULT CMainFrame::OnAppCommand(WPARAM wParam, LPARAM lParam)
+{
+ UINT cmd = GET_APPCOMMAND_LPARAM(lParam);
+ UINT uDevice = GET_DEVICE_LPARAM(lParam);
+ UINT dwKeys = GET_KEYSTATE_LPARAM(lParam);
+
+ if(uDevice != FAPPCOMMAND_OEM)
+ {
+ AppSettings& s = AfxGetAppSettings();
+
+ BOOL fRet = FALSE;
+
+ POSITION pos = s.wmcmds.GetHeadPosition();
+ while(pos)
+ {
+ wmcmd& wc = s.wmcmds.GetNext(pos);
+ if(wc.appcmd == cmd && TRUE == SendMessage(WM_COMMAND, wc.cmd))
+ fRet = TRUE;
+ }
+
+ if(fRet) return TRUE;
+ }
+
+ return Default();
+}
+
+void CMainFrame::OnTimer(UINT nIDEvent)
+{
+ if(nIDEvent == TIMER_STREAMPOSPOLLER && m_iMediaLoadState == MLS_LOADED)
+ {
+ REFERENCE_TIME rtNow = 0, rtDur = 0;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ pMS->GetCurrentPosition(&rtNow);
+ pMS->GetDuration(&rtDur);
+
+ FILE_POSITION* FilePosition = AfxGetAppSettings().CurrentFilePosition();
+ if (FilePosition) FilePosition->llPosition = rtNow;
+
+ if(m_rtDurationOverride >= 0) rtDur = m_rtDurationOverride;
+
+ m_wndSeekBar.Enable(rtDur > 0);
+ m_wndSeekBar.SetRange(0, rtDur);
+ m_wndSeekBar.SetPos(rtNow);
+ m_OSD.SetRange (0, rtDur);
+ m_OSD.SetPos (rtNow);
+ }
+ else if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ if(m_fCapturing && m_wndCaptureBar.m_capdlg.m_pMux)
+ {
+ CComQIPtr<IMediaSeeking> pMuxMS = m_wndCaptureBar.m_capdlg.m_pMux;
+ if(!pMuxMS || FAILED(pMuxMS->GetCurrentPosition(&rtNow))) rtNow = 0;
+ }
+
+ if(m_rtDurationOverride >= 0) rtDur = m_rtDurationOverride;
+
+ m_wndSeekBar.Enable(false);
+ m_wndSeekBar.SetRange(0, rtDur);
+ m_wndSeekBar.SetPos(rtNow);
+ m_OSD.SetRange (0, rtDur);
+ m_OSD.SetPos (rtNow);
+/*
+ if(m_fCapturing)
+ {
+ if(rtNow > 10000i64*1000*60*60*3)
+ {
+ m_wndCaptureBar.m_capdlg.OnRecord();
+ }
+ }
+*/
+ }
+
+ if(m_pCAP && m_iPlaybackMode != PM_FILE) m_pCAP->SetTime(/*rtNow*/m_wndSeekBar.GetPos());
+ }
+ else if(nIDEvent == TIMER_STREAMPOSPOLLER2 && m_iMediaLoadState == MLS_LOADED)
+ {
+ __int64 start, stop, pos;
+ m_wndSeekBar.GetRange(start, stop);
+ pos = m_wndSeekBar.GetPosReal();
+
+ GUID tf;
+ pMS->GetTimeFormat(&tf);
+
+ if(m_iPlaybackMode == PM_CAPTURE && !m_fCapturing)
+ {
+ CString str = _T("Live");
+
+ long lChannel = 0, lVivSub = 0, lAudSub = 0;
+ if(pAMTuner
+ && m_wndCaptureBar.m_capdlg.IsTunerActive()
+ && SUCCEEDED(pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub)))
+ {
+ CString ch;
+ ch.Format(_T(" (ch%d)"), lChannel);
+ str += ch;
+ }
+
+ m_wndStatusBar.SetStatusTimer(str);
+ }
+ else
+ {
+ m_wndStatusBar.SetStatusTimer(pos, stop, !!m_wndSubresyncBar.IsWindowVisible(), &tf);
+ if (m_bRemainingTime) m_OSD.DisplayMessage(OSD_TOPLEFT, m_wndStatusBar.GetStatusTimer());
+
+ }
+
+ m_wndSubresyncBar.SetTime(pos);
+
+ if(m_pCAP && GetMediaState() == State_Paused) m_pCAP->Paint(true);
+ }
+ else if(nIDEvent == TIMER_FULLSCREENCONTROLBARHIDER)
+ {
+ CPoint p;
+ GetCursorPos(&p);
+
+ CRect r;
+ GetWindowRect(r);
+ bool fCursorOutside = !r.PtInRect(p);
+
+ CWnd* pWnd = WindowFromPoint(p);
+ if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside))
+ {
+ if(AfxGetAppSettings().nShowBarsWhenFullScreenTimeOut >= 0)
+ ShowControls(CS_NONE, false);
+ }
+ }
+ else if(nIDEvent == TIMER_FULLSCREENMOUSEHIDER)
+ {
+ CPoint p;
+ GetCursorPos(&p);
+
+ CRect r;
+ GetWindowRect(r);
+ bool fCursorOutside = !r.PtInRect(p);
+
+ if (m_bD3DFullscreenMode)
+ {
+ TRACE ("==> HIDE!\n");
+ m_pFullscreenWnd->ShowCursor(false);
+ KillTimer(TIMER_FULLSCREENMOUSEHIDER);
+ }
+ else
+ {
+ CWnd* pWnd = WindowFromPoint(p);
+ if(pWnd && (m_wndView == *pWnd || m_wndView.IsChild(pWnd) || fCursorOutside))
+ {
+ m_fHideCursor = true;
+ SetCursor(NULL);
+ }
+ }
+ }
+ else if(nIDEvent == TIMER_STATS)
+ {
+ if(pQP)
+ {
+ CString rate;
+ if(m_iSpeedLevel >= -11 && m_iSpeedLevel <= 3 && m_iSpeedLevel != -4)
+ {
+ CString speeds[] = {_T("1/8"),_T("1/4"),_T("1/2"),_T("1"),_T("2"),_T("4"),_T("8")};
+ rate = speeds[(m_iSpeedLevel >= -3 ? m_iSpeedLevel : (-m_iSpeedLevel - 8)) + 3];
+ if(m_iSpeedLevel < -4) rate = _T("-") + rate;
+ if(!rate.IsEmpty()) rate = _T("(") + rate + _T("X)");
+ }
+
+ CString info;
+ int val;
+
+ pQP->get_AvgFrameRate(&val);
+ info.Format(_T("%d.%02d %s"), val/100, val%100, rate);
+ m_wndStatsBar.SetLine(_T("Frame-rate"), info);
+
+ int avg, dev;
+ pQP->get_AvgSyncOffset(&avg);
+ pQP->get_DevSyncOffset(&dev);
+ info.Format(_T("avg: %d ms, dev: %d ms"), avg, dev);
+ m_wndStatsBar.SetLine(_T("Sync Offset"), info);
+
+ int drawn, dropped;
+ pQP->get_FramesDrawn(&drawn);
+ pQP->get_FramesDroppedInRenderer(&dropped);
+ info.Format(_T("drawn: %d, dropped: %d"), drawn, dropped);
+ m_wndStatsBar.SetLine(_T("Frames"), info);
+
+ pQP->get_Jitter(&val);
+ info.Format(_T("%d ms"), val);
+ m_wndStatsBar.SetLine(_T("Jitter"), info);
+ }
+
+ if(pBI)
+ {
+ CAtlList<CString> sl;
+
+ for(int i = 0, j = pBI->GetCount(); i < j; i++)
+ {
+ int samples, size;
+ if(S_OK == pBI->GetStatus(i, samples, size))
+ {
+ CString str;
+ str.Format(_T("[%d]: %03d/%d KB"), i, samples, size / 1024);
+ sl.AddTail(str);
+ }
+ }
+
+ if(!sl.IsEmpty())
+ {
+ CString str;
+ str.Format(_T("%s (p%d)"), Implode(sl, ' '), pBI->GetPriority());
+
+ m_wndStatsBar.SetLine(_T("Buffers"), str);
+ }
+ }
+
+ CInterfaceList<IBitRateInfo> pBRIs;
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(CComQIPtr<IBitRateInfo> pBRI = pPin)
+ {
+ pBRIs.AddTail(pBRI);
+ }
+ }
+ EndEnumPins
+
+ if(!pBRIs.IsEmpty())
+ {
+ CAtlList<CString> sl;
+
+ POSITION pos = pBRIs.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ IBitRateInfo* pBRI = pBRIs.GetNext(pos);
+
+ DWORD cur = pBRI->GetCurrentBitRate() / 1000;
+ DWORD avg = pBRI->GetAverageBitRate() / 1000;
+
+ if(avg == 0) continue;
+
+ CString str;
+ if(cur != avg) str.Format(_T("[%d]: %d/%d Kb/s"), i, avg, cur);
+ else str.Format(_T("[%d]: %d Kb/s"), i, avg);
+ sl.AddTail(str);
+ }
+
+ if(!sl.IsEmpty())
+ {
+ m_wndStatsBar.SetLine(_T("Bitrate"), Implode(sl, ' ') + _T(" (avg/cur)"));
+ }
+
+ break;
+ }
+ }
+ EndEnumFilters
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ SetupChapters();
+ }
+
+ if(m_iPlaybackMode == PM_DVD) // we also use this timer to update the info panel for dvd playback
+ {
+ ULONG ulAvailable, ulCurrent;
+
+ // Location
+
+ CString Location('-');
+
+ DVD_PLAYBACK_LOCATION2 loc;
+ ULONG ulNumOfVolumes, ulVolume;
+ DVD_DISC_SIDE Side;
+ ULONG ulNumOfTitles;
+ ULONG ulNumOfChapters;
+
+ if(SUCCEEDED(pDVDI->GetCurrentLocation(&loc))
+ && SUCCEEDED(pDVDI->GetNumberOfChapters(loc.TitleNum, &ulNumOfChapters))
+ && SUCCEEDED(pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles)))
+ {
+ Location.Format(_T("Volume: %02d/%02d, Title: %02d/%02d, Chapter: %02d/%02d"),
+ ulVolume, ulNumOfVolumes,
+ loc.TitleNum, ulNumOfTitles,
+ loc.ChapterNum, ulNumOfChapters);
+ }
+
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_LOCATION), Location);
+
+ // Video
+
+ CString Video('-');
+
+ DVD_VideoAttributes VATR;
+
+ if(SUCCEEDED(pDVDI->GetCurrentAngle(&ulAvailable, &ulCurrent))
+ && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR)))
+ {
+ Video.Format(_T("Angle: %02d/%02d, %dx%d %dHz %d:%d"),
+ ulAvailable, ulCurrent,
+ VATR.ulSourceResolutionX, VATR.ulSourceResolutionY, VATR.ulFrameRate,
+ VATR.ulAspectX, VATR.ulAspectY);
+ }
+
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_VIDEO), Video);
+
+ // Audio
+
+ CString Audio('-');
+
+ DVD_AudioAttributes AATR;
+
+ if(SUCCEEDED(pDVDI->GetCurrentAudio(&ulAvailable, &ulCurrent))
+ && SUCCEEDED(pDVDI->GetAudioAttributes(ulCurrent, &AATR)))
+ {
+ CString lang;
+ int len = GetLocaleInfo(AATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
+ lang.ReleaseBufferSetLength(max(len-1, 0));
+
+ switch(AATR.LanguageExtension)
+ {
+ case DVD_AUD_EXT_NotSpecified:
+ default: break;
+ case DVD_AUD_EXT_Captions: lang += _T(" (Captions)"); break;
+ case DVD_AUD_EXT_VisuallyImpaired: lang += _T(" (Visually Impaired)"); break;
+ case DVD_AUD_EXT_DirectorComments1: lang += _T(" (Director Comments 1)"); break;
+ case DVD_AUD_EXT_DirectorComments2: lang += _T(" (Director Comments 2)"); break;
+ }
+
+ CString format = GetDVDAudioFormatName(AATR);
+
+ Audio.Format(_T("%s, %s %dHz %dbits %d channel(s)"),
+ lang,
+ format,
+ AATR.dwFrequency,
+ AATR.bQuantization,
+ AATR.bNumberOfChannels);
+
+ m_wndStatusBar.SetStatusBitmap(
+ AATR.bNumberOfChannels == 1 ? IDB_MONO
+ : AATR.bNumberOfChannels >= 2 ? IDB_STEREO
+ : IDB_NOAUDIO);
+ }
+
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_AUDIO), Audio);
+
+ // Subtitles
+
+ CString Subtitles('-');
+
+ BOOL bIsDisabled;
+ DVD_SubpictureAttributes SATR;
+
+ if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulAvailable, &ulCurrent, &bIsDisabled))
+ && SUCCEEDED(pDVDI->GetSubpictureAttributes(ulCurrent, &SATR)))
+ {
+ CString lang;
+ int len = GetLocaleInfo(SATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
+ lang.ReleaseBufferSetLength(max(len-1, 0));
+
+ switch(SATR.LanguageExtension)
+ {
+ case DVD_SP_EXT_NotSpecified:
+ default: break;
+ case DVD_SP_EXT_Caption_Normal: lang += _T(""); break;
+ case DVD_SP_EXT_Caption_Big: lang += _T(" (Big)"); break;
+ case DVD_SP_EXT_Caption_Children: lang += _T(" (Children)"); break;
+ case DVD_SP_EXT_CC_Normal: lang += _T(" (CC)"); break;
+ case DVD_SP_EXT_CC_Big: lang += _T(" (CC Big)"); break;
+ case DVD_SP_EXT_CC_Children: lang += _T(" (CC Children)"); break;
+ case DVD_SP_EXT_Forced: lang += _T(" (Forced)"); break;
+ case DVD_SP_EXT_DirectorComments_Normal: lang += _T(" (Director Comments)"); break;
+ case DVD_SP_EXT_DirectorComments_Big: lang += _T(" (Director Comments, Big)"); break;
+ case DVD_SP_EXT_DirectorComments_Children: lang += _T(" (Director Comments, Children)"); break;
+ }
+
+ if(bIsDisabled) lang = _T("-");
+
+ Subtitles.Format(_T("%s"),
+ lang);
+ }
+
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_SUBTITLES), Subtitles);
+ }
+
+ if(GetMediaState() == State_Running)
+ {
+ UINT fSaverActive = 0;
+ if(SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&fSaverActive, 0))
+ {
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, fSaverActive, 0, SPIF_SENDWININICHANGE);
+ }
+
+ fSaverActive = 0;
+ if(SystemParametersInfo(SPI_GETPOWEROFFACTIVE, 0, (PVOID)&fSaverActive, 0))
+ {
+ SystemParametersInfo(SPI_SETPOWEROFFACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
+ SystemParametersInfo(SPI_SETPOWEROFFACTIVE, fSaverActive, 0, SPIF_SENDWININICHANGE);
+ }
+ }
+ }
+ else if(nIDEvent == TIMER_STATUSERASER)
+ {
+ KillTimer(TIMER_STATUSERASER);
+ m_playingmsg.Empty();
+ }
+
+ __super::OnTimer(nIDEvent);
+}
+
+static bool SetShutdownPrivilege()
+{
+ HANDLE hToken;
+ TOKEN_PRIVILEGES tkp;
+
+ // Get a token for this process.
+
+ if(!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
+ return(false);
+
+ // Get the LUID for the shutdown privilege.
+
+ LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
+
+ tkp.PrivilegeCount = 1; // one privilege to set
+ tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+
+ // Get the shutdown privilege for this process.
+
+ AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
+
+ if(GetLastError() != ERROR_SUCCESS)
+ return false;
+
+ return true;
+}
+
+bool CMainFrame::DoAfterPlaybackEvent()
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ bool fExit = false;
+
+ if(s.nCLSwitches&CLSW_CLOSE)
+ {
+ fExit = true;
+ }
+
+ if(s.nCLSwitches&CLSW_STANDBY)
+ {
+ SetShutdownPrivilege();
+ SetSystemPowerState(TRUE, TRUE);
+ fExit = true; // TODO: unless the app closes, it will call standby or hibernate once again forever, how to avoid that?
+ }
+ else if(s.nCLSwitches&CLSW_HIBERNATE)
+ {
+ SetShutdownPrivilege();
+ SetSystemPowerState(FALSE, TRUE);
+ fExit = true; // TODO: unless the app closes, it will call standby or hibernate once again forever, how to avoid that?
+ }
+ else if(s.nCLSwitches&CLSW_SHUTDOWN)
+ {
+ SetShutdownPrivilege();
+ ExitWindowsEx(EWX_SHUTDOWN|EWX_POWEROFF|EWX_FORCEIFHUNG, 0);
+ fExit = true;
+ }
+ else if(s.nCLSwitches&CLSW_LOGOFF)
+ {
+ SetShutdownPrivilege();
+ ExitWindowsEx(EWX_LOGOFF|EWX_FORCEIFHUNG, 0);
+ fExit = true;
+ }
+
+ if(!fExit) return false;
+
+ SendMessage(WM_COMMAND, ID_FILE_EXIT);
+
+ return true;
+}
+
+//
+// our WM_GRAPHNOTIFY handler
+//
+#include <comdef.h>
+LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam)
+{
+ HRESULT hr = S_OK;
+
+ LONG evCode, evParam1, evParam2;
+ while(pME && SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0)))
+ {
+ CString str;
+
+ if(m_fCustomGraph)
+ {
+ if(EC_BG_ERROR == evCode)
+ {
+ str = CString((char*)evParam1);
+ }
+ }
+
+ hr = pME->FreeEventParams(evCode, evParam1, evParam2);
+
+ if(EC_COMPLETE == evCode)
+ {
+ AppSettings& s = AfxGetAppSettings();
+
+ if(m_wndPlaylistBar.GetCount() <= 1)
+ {
+ m_nLoops++;
+
+ if(DoAfterPlaybackEvent()) return hr;
+
+ if(s.fLoopForever || m_nLoops < s.nLoops)
+ {
+ if(GetMediaState() == State_Stopped)
+ {
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
+ else
+ {
+ LONGLONG pos = 0;
+ pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+
+ if(GetMediaState() == State_Paused)
+ {
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
+ }
+ }
+ else
+ {
+ if(s.fRewind) SendMessage(WM_COMMAND, ID_PLAY_STOP);
+ else m_fEndOfStream = true;
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+
+ if(m_fFullScreen && s.fExitFullScreenAtTheEnd)
+ OnViewFullscreen();
+ }
+ }
+ else if(m_wndPlaylistBar.GetCount() > 1)
+ {
+ if(m_wndPlaylistBar.IsAtEnd())
+ {
+ if(DoAfterPlaybackEvent()) return hr;
+
+ m_nLoops++;
+ }
+
+ if(s.fLoopForever || m_nLoops < s.nLoops)
+ {
+ int nLoops = m_nLoops;
+ PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
+ m_nLoops = nLoops;
+ }
+ else
+ {
+ if(m_fFullScreen && s.fExitFullScreenAtTheEnd)
+ OnViewFullscreen();
+
+ if(s.fRewind)
+ {
+ AfxGetAppSettings().nCLSwitches |= CLSW_OPEN; // HACK
+ PostMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARD);
+ }
+ else
+ {
+ m_fEndOfStream = true;
+ PostMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
+ }
+ }
+ }
+ else if(EC_ERRORABORT == evCode)
+ {
+ TRACE(_T("EC_ERRORABORT, hr = %08x\n"), (HRESULT)evParam1);
+// SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+// m_closingmsg = _com_error((HRESULT)evParam1).ErrorMessage();
+ }
+ else if(EC_REPAINT == evCode)
+ {
+ TRACE(_T("EC_REPAINT\n"));
+ }
+ else if(EC_BUFFERING_DATA == evCode)
+ {
+ TRACE(_T("EC_BUFFERING_DATA, %d, %d\n"), (HRESULT)evParam1, evParam2);
+
+ m_fBuffering = ((HRESULT)evParam1 != S_OK);
+ }
+ else if(EC_STEP_COMPLETE == evCode)
+ {
+ if(m_fFrameSteppingActive)
+ {
+ m_fFrameSteppingActive = false;
+ pBA->put_Volume(m_VolumeBeforeFrameStepping);
+ }
+ }
+ else if(EC_DEVICE_LOST == evCode)
+ {
+ CComQIPtr<IBaseFilter> pBF;
+ if(m_iPlaybackMode == PM_CAPTURE
+ && (!pVidCap && pVidCap == (pBF = (IUnknown*)evParam1)
+ || !pAudCap && pAudCap == (pBF = (IUnknown*)evParam1))
+ && evParam2 == 0)
+ {
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ }
+ }
+ else if(EC_DVD_TITLE_CHANGE == evCode)
+ {
+ // Casimir666 : Mémoriser le chapitre en cours
+ DVD_POSITION* DvdPos = AfxGetAppSettings().CurrentDVDPosition();
+ if (DvdPos) DvdPos->lTitle = (DWORD)evParam1;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ SetupChapters();
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ m_iDVDTitle = (DWORD)evParam1;
+
+ if(m_iDVDDomain == DVD_DOMAIN_Title)
+ {
+ CString Domain;
+ Domain.Format(_T("Title %d"), m_iDVDTitle);
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
+ }
+ }
+ }
+ else if(EC_DVD_DOMAIN_CHANGE == evCode)
+ {
+ m_iDVDDomain = (DVD_DOMAIN)evParam1;
+
+ CString Domain('-');
+
+ switch(m_iDVDDomain)
+ {
+ case DVD_DOMAIN_FirstPlay:
+ IDvdCmd* pCmd;
+ ULONGLONG llDVDGuid;
+
+ // Casimir666 : Au lancement de positionner a la dernière position lue
+ if (pDVDI && SUCCEEDED (pDVDI->GetDiscID (NULL, &llDVDGuid)))
+ {
+ if (!AfxGetAppSettings().NewDvd (llDVDGuid) && AfxGetAppSettings().fRememberDVDPos)
+ {
+ DVD_POSITION* DvdPos = AfxGetAppSettings().CurrentDVDPosition();
+ hr = pDVDC->PlayAtTimeInTitle (DvdPos->lTitle, &DvdPos->Timecode, DVD_CMD_FLAG_Flush, &pCmd);
+ if (pCmd) pCmd->Release();
+ }
+ }
+ Domain = _T("First Play"); break;
+ case DVD_DOMAIN_VideoManagerMenu: Domain = _T("Video Manager Menu"); break;
+ case DVD_DOMAIN_VideoTitleSetMenu: Domain = _T("Video Title Set Menu"); break;
+ case DVD_DOMAIN_Title: Domain.Format(_T("Title %d"), m_iDVDTitle); break;
+ case DVD_DOMAIN_Stop: Domain = _T("Stop"); break;
+ default: Domain = _T("-"); break;
+ }
+
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), Domain);
+
+ MoveVideoWindow(); // AR might have changed
+ }
+ else if(EC_DVD_CURRENT_HMSF_TIME == evCode)
+ {
+ double fps = evParam2 == DVD_TC_FLAG_25fps ? 25.0
+ : evParam2 == DVD_TC_FLAG_30fps ? 30.0
+ : evParam2 == DVD_TC_FLAG_DropFrame ? 29.97
+ : 25.0;
+
+ REFERENCE_TIME rtDur = 0;
+
+ DVD_HMSF_TIMECODE tcDur;
+ ULONG ulFlags;
+ if(SUCCEEDED(pDVDI->GetTotalTitleTime(&tcDur, &ulFlags)))
+ rtDur = HMSF2RT(tcDur, fps);
+
+ m_wndSeekBar.Enable(rtDur > 0);
+ m_wndSeekBar.SetRange(0, rtDur);
+ m_OSD.SetRange (0, rtDur);
+
+ REFERENCE_TIME rtNow = HMSF2RT(*((DVD_HMSF_TIMECODE*)&evParam1), fps);
+
+ // Casimir666 : Mémoriser le timecode courant dans le chapitre
+ DVD_POSITION* DvdPos = AfxGetAppSettings().CurrentDVDPosition();
+ if (DvdPos)
+ memcpy (&DvdPos->Timecode, (void*)&evParam1, sizeof(DVD_HMSF_TIMECODE));
+
+ m_wndSeekBar.SetPos(rtNow);
+ m_OSD.SetPos(rtNow);
+
+ if(m_pSubClock) m_pSubClock->SetTime(rtNow);
+ }
+ else if(EC_DVD_ERROR == evCode)
+ {
+ TRACE(_T("EC_DVD_ERROR %d %d\n"), evParam1, evParam2);
+
+ CString err;
+
+ switch(evParam1)
+ {
+ case DVD_ERROR_Unexpected: default: err = _T("DVD: Unexpected error"); break;
+ case DVD_ERROR_CopyProtectFail: err = _T("DVD: Copy-Protect Fail"); break;
+ case DVD_ERROR_InvalidDVD1_0Disc: err = _T("DVD: Invalid DVD 1.x Disc"); break;
+ case DVD_ERROR_InvalidDiscRegion: err = _T("DVD: Invalid Disc Region"); break;
+ case DVD_ERROR_LowParentalLevel: err = _T("DVD: Low Parental Level"); break;
+ case DVD_ERROR_MacrovisionFail: err = _T("DVD: Macrovision Fail"); break;
+ case DVD_ERROR_IncompatibleSystemAndDecoderRegions: err = _T("DVD: Incompatible System And Decoder Regions"); break;
+ case DVD_ERROR_IncompatibleDiscAndDecoderRegions: err = _T("DVD: Incompatible Disc And Decoder Regions"); break;
+ }
+
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+
+ m_closingmsg = err;
+ }
+ else if(EC_DVD_WARNING == evCode)
+ {
+ TRACE(_T("EC_DVD_WARNING %d %d\n"), evParam1, evParam2);
+ }
+ else if(EC_VIDEO_SIZE_CHANGED == evCode)
+ {
+ TRACE(_T("EC_VIDEO_SIZE_CHANGED %dx%d\n"), CSize(evParam1));
+
+ WINDOWPLACEMENT wp;
+ wp.length = sizeof(wp);
+ GetWindowPlacement(&wp);
+
+ CSize size(evParam1);
+ m_fAudioOnly = (size.cx <= 0 || size.cy <= 0);
+
+ if(AfxGetAppSettings().fRememberZoomLevel
+ && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED))
+ {
+ ZoomVideoWindow();
+ }
+ else
+ {
+ MoveVideoWindow();
+ }
+
+ if(m_iMediaLoadState == MLS_LOADED
+ && !m_fAudioOnly && (AfxGetAppSettings().nCLSwitches&CLSW_FULLSCREEN))
+ {
+ PostMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
+ AfxGetAppSettings().nCLSwitches &= ~CLSW_FULLSCREEN;
+ }
+ }
+ else if(EC_LENGTH_CHANGED == evCode)
+ {
+ __int64 rtDur = 0;
+ pMS->GetDuration(&rtDur);
+ m_wndPlaylistBar.SetCurTime(rtDur);
+ }
+ else if(!m_fCustomGraph)
+ {
+ TRACE(_T("evCode: %d\n"), evCode);
+ }
+ else if(EC_BG_AUDIO_CHANGED == evCode)
+ {
+ int nAudioChannels = evParam1;
+
+ m_wndStatusBar.SetStatusBitmap(nAudioChannels == 1 ? IDB_MONO
+ : nAudioChannels >= 2 ? IDB_STEREO
+ : IDB_NOAUDIO);
+ }
+ else if(EC_BG_ERROR == evCode)
+ {
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ m_closingmsg = !str.IsEmpty() ? str : _T("Unspecified graph error");
+ m_wndPlaylistBar.SetCurValid(false);
+ break;
+ }
+ }
+
+ return hr;
+}
+
+LRESULT CMainFrame::OnRepaintRenderLess(WPARAM wParam, LPARAM lParam)
+{
+ MoveVideoWindow();
+ return TRUE;
+}
+
+LRESULT CMainFrame::OnResumeFromState(WPARAM wParam, LPARAM lParam)
+{
+ int iPlaybackMode = (int)wParam;
+
+ if(iPlaybackMode == PM_FILE)
+ {
+ SeekTo(10000i64*int(lParam));
+ }
+ else if(iPlaybackMode == PM_DVD)
+ {
+ CComPtr<IDvdState> pDvdState;
+ pDvdState.Attach((IDvdState*)lParam);
+ if(pDVDC) pDVDC->SetState(pDvdState, DVD_CMD_FLAG_Block, NULL);
+ }
+ else if(iPlaybackMode == PM_CAPTURE)
+ {
+ // not implemented
+ }
+ else
+ {
+ ASSERT(0);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+BOOL CMainFrame::OnButton(UINT id, UINT nFlags, CPoint point)
+{
+ SetFocus();
+
+ CRect r;
+ if (m_bD3DFullscreenMode)
+ m_pFullscreenWnd->GetClientRect(r);
+ else
+ {
+ m_wndView.GetClientRect(r);
+ m_wndView.MapWindowPoints(this, &r);
+ }
+
+ if(id != wmcmd::WDOWN && id != wmcmd::WUP && !r.PtInRect(point)) return FALSE;
+
+ BOOL ret = FALSE;
+
+ AppSettings& s = AfxGetAppSettings();
+ POSITION pos = s.wmcmds.GetHeadPosition();
+ while(pos)
+ {
+ wmcmd& wc = s.wmcmds.GetNext(pos);
+ if(wc.mouse == id)
+ {
+ SendMessage(WM_COMMAND, wc.cmd);
+ ret = true;
+ }
+ }
+
+ return ret;
+}
+
+static bool s_fLDown = false;
+
+void CMainFrame::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ if (!m_OSD.OnLButtonDown (nFlags, point))
+ {
+ SetFocus();
+
+ bool fClicked = false;
+
+ if(m_iPlaybackMode == PM_DVD)
+ {
+ CPoint p = point - m_wndView.GetVideoRect().TopLeft();
+
+ if(SUCCEEDED(pDVDC->ActivateAtPosition(p))
+ || m_iDVDDomain == DVD_DOMAIN_VideoManagerMenu
+ || m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu)
+ fClicked = true;
+ }
+
+ if(!fClicked)
+ {
+ bool fLeftMouseBtnUnassigned = true;
+ AppSettings& s = AfxGetAppSettings();
+ POSITION pos = s.wmcmds.GetHeadPosition();
+ while(pos && fLeftMouseBtnUnassigned)
+ if(s.wmcmds.GetNext(pos).mouse == wmcmd::LDOWN)
+ fLeftMouseBtnUnassigned = false;
+
+ if(!m_fFullScreen && (IsCaptionMenuHidden() || fLeftMouseBtnUnassigned))
+ {
+ PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
+ }
+ else
+ {
+ s_fLDown = true;
+ if(OnButton(wmcmd::LDOWN, nFlags, point))
+ return;
+ }
+ }
+
+ __super::OnLButtonDown(nFlags, point);
+ }
+}
+
+void CMainFrame::OnLButtonUp(UINT nFlags, CPoint point)
+{
+ if (!m_OSD.OnLButtonUp (nFlags, point))
+ {
+ if(!OnButton(wmcmd::LUP, nFlags, point))
+ __super::OnLButtonUp(nFlags, point);
+ }
+}
+
+void CMainFrame::OnLButtonDblClk(UINT nFlags, CPoint point)
+{
+if(s_fLDown)
+{
+ SendMessage(WM_LBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y));
+s_fLDown = false;
+}
+ if(!OnButton(wmcmd::LDBLCLK, nFlags, point))
+ __super::OnLButtonDblClk(nFlags, point);
+}
+
+void CMainFrame::OnMButtonDown(UINT nFlags, CPoint point)
+{
+ SendMessage(WM_CANCELMODE);
+ if(!OnButton(wmcmd::MDOWN, nFlags, point))
+ __super::OnMButtonDown(nFlags, point);
+}
+
+void CMainFrame::OnMButtonUp(UINT nFlags, CPoint point)
+{
+ if(!OnButton(wmcmd::MUP, nFlags, point))
+ __super::OnMButtonUp(nFlags, point);
+}
+
+void CMainFrame::OnMButtonDblClk(UINT nFlags, CPoint point)
+{
+ SendMessage(WM_MBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y));
+ if(!OnButton(wmcmd::MDBLCLK, nFlags, point))
+ __super::OnMButtonDblClk(nFlags, point);
+}
+
+void CMainFrame::OnRButtonDown(UINT nFlags, CPoint point)
+{
+ if(!OnButton(wmcmd::RDOWN, nFlags, point))
+ __super::OnRButtonDown(nFlags, point);
+}
+
+void CMainFrame::OnRButtonUp(UINT nFlags, CPoint point)
+{
+ if(!OnButton(wmcmd::RUP, nFlags, point))
+ __super::OnRButtonUp(nFlags, point);
+}
+
+void CMainFrame::OnRButtonDblClk(UINT nFlags, CPoint point)
+{
+ SendMessage(WM_RBUTTONDOWN, nFlags, MAKELPARAM(point.x, point.y));
+ if(!OnButton(wmcmd::RDBLCLK, nFlags, point))
+ __super::OnRButtonDblClk(nFlags, point);
+}
+
+LRESULT CMainFrame::OnXButtonDown(WPARAM wParam, LPARAM lParam)
+{
+ SendMessage(WM_CANCELMODE);
+ UINT fwButton = GET_XBUTTON_WPARAM(wParam);
+ return OnButton(fwButton == XBUTTON1 ? wmcmd::X1DOWN : fwButton == XBUTTON2 ? wmcmd::X2DOWN : wmcmd::NONE,
+ GET_KEYSTATE_WPARAM(wParam), CPoint(lParam));
+}
+
+LRESULT CMainFrame::OnXButtonUp(WPARAM wParam, LPARAM lParam)
+{
+ UINT fwButton = GET_XBUTTON_WPARAM(wParam);
+ return OnButton(fwButton == XBUTTON1 ? wmcmd::X1UP : fwButton == XBUTTON2 ? wmcmd::X2UP : wmcmd::NONE,
+ GET_KEYSTATE_WPARAM(wParam), CPoint(lParam));
+}
+
+LRESULT CMainFrame::OnXButtonDblClk(WPARAM wParam, LPARAM lParam)
+{
+ SendMessage(WM_XBUTTONDOWN, wParam, lParam);
+ UINT fwButton = GET_XBUTTON_WPARAM(wParam);
+ return OnButton(fwButton == XBUTTON1 ? wmcmd::X1DBLCLK : fwButton == XBUTTON2 ? wmcmd::X2DBLCLK : wmcmd::NONE,
+ GET_KEYSTATE_WPARAM(wParam), CPoint(lParam));
+}
+
+BOOL CMainFrame::OnMouseWheel(UINT nFlags, short zDelta, CPoint point)
+{
+ ScreenToClient(&point);
+
+ BOOL fRet =
+ zDelta > 0 ? OnButton(wmcmd::WUP, nFlags, point) :
+ zDelta < 0 ? OnButton(wmcmd::WDOWN, nFlags, point) :
+ FALSE;
+
+ return fRet;
+}
+
+void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
+{
+ if (!m_OSD.OnMouseMove (nFlags, point))
+ {
+ if(m_iPlaybackMode == PM_DVD)
+ {
+ CPoint vp = point - m_wndView.GetVideoRect().TopLeft();
+ pDVDC->SelectAtPosition(vp);
+ }
+
+ CSize diff = m_lastMouseMove - point;
+
+ if (m_bD3DFullscreenMode && (abs(diff.cx)+abs(diff.cy)) >= 1)
+ {
+ // TRACE ("==> SHOW!\n");
+ m_pFullscreenWnd->ShowCursor(true);
+
+ // Casimir666 : en dehors du menu DVD, cacher le curseur
+ if ( (m_iPlaybackMode == PM_FILE) ||
+ ((m_iPlaybackMode == PM_DVD) && (m_iDVDDomain != DVD_DOMAIN_VideoManagerMenu) && (m_iDVDDomain != DVD_DOMAIN_VideoTitleSetMenu)) )
+ {
+ KillTimer(TIMER_FULLSCREENMOUSEHIDER);
+ SetTimer(TIMER_FULLSCREENMOUSEHIDER, 2000, NULL);
+ }
+ }
+ else if(m_fFullScreen && (abs(diff.cx)+abs(diff.cy)) >= 1)
+ {
+ int nTimeOut = AfxGetAppSettings().nShowBarsWhenFullScreenTimeOut;
+
+ if(nTimeOut < 0)
+ {
+ m_fHideCursor = false;
+ if(AfxGetAppSettings().fShowBarsWhenFullScreen)
+ ShowControls(AfxGetAppSettings().nCS);
+
+ KillTimer(TIMER_FULLSCREENCONTROLBARHIDER);
+ SetTimer(TIMER_FULLSCREENMOUSEHIDER, 2000, NULL);
+ }
+ else if(nTimeOut == 0)
+ {
+ CRect r;
+ GetClientRect(r);
+ r.top = r.bottom;
+
+ POSITION pos = m_bars.GetHeadPosition();
+ for(int i = 1; pos; i <<= 1)
+ {
+ CControlBar* pNext = m_bars.GetNext(pos);
+ CSize s = pNext->CalcFixedLayout(FALSE, TRUE);
+ if(AfxGetAppSettings().nCS&i) r.top -= s.cy;
+ }
+
+
+ // HACK: the controls would cover the menu too early hiding some buttons
+ if(m_iPlaybackMode == PM_DVD
+ && (m_iDVDDomain == DVD_DOMAIN_VideoManagerMenu
+ || m_iDVDDomain == DVD_DOMAIN_VideoTitleSetMenu))
+ r.top = r.bottom - 10;
+
+ m_fHideCursor = false;
+
+ if(r.PtInRect(point))
+ {
+ if(AfxGetAppSettings().fShowBarsWhenFullScreen)
+ ShowControls(AfxGetAppSettings().nCS);
+ }
+ else
+ {
+ if(AfxGetAppSettings().fShowBarsWhenFullScreen)
+ ShowControls(CS_NONE, false);
+ }
+
+ SetTimer(TIMER_FULLSCREENMOUSEHIDER, 2000, NULL);
+ }
+ else
+ {
+ m_fHideCursor = false;
+ if(AfxGetAppSettings().fShowBarsWhenFullScreen)
+ ShowControls(AfxGetAppSettings().nCS);
+
+ SetTimer(TIMER_FULLSCREENCONTROLBARHIDER, nTimeOut*1000, NULL);
+ SetTimer(TIMER_FULLSCREENMOUSEHIDER, max(nTimeOut*1000, 2000), NULL);
+ }
+ }
+
+ m_lastMouseMove = point;
+
+ __super::OnMouseMove(nFlags, point);
+ }
+}
+
+UINT CMainFrame::OnNcHitTest(CPoint point)
+{
+ LRESULT nHitTest = __super::OnNcHitTest(point);
+ return ((IsCaptionMenuHidden()) && nHitTest == HTCLIENT) ? HTCAPTION : nHitTest;
+}
+
+void CMainFrame::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ if(pScrollBar->IsKindOf(RUNTIME_CLASS(CVolumeCtrl)))
+ {
+ OnPlayVolume(0);
+ }
+ else if(pScrollBar->IsKindOf(RUNTIME_CLASS(CPlayerSeekBar)) && m_iMediaLoadState == MLS_LOADED)
+ {
+ SeekTo(m_wndSeekBar.GetPos(), !!(::GetKeyState(VK_SHIFT)&0x8000));
+ }
+ else if (m_pVideoWnd == m_pVideoWnd)
+ {
+ SeekTo(m_OSD.GetPos(), !!(::GetKeyState(VK_SHIFT)&0x8000));
+ }
+
+ __super::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CMainFrame::OnInitMenu(CMenu* pMenu)
+{
+ __super::OnInitMenu(pMenu);
+
+ MENUITEMINFO mii;
+ mii.cbSize = sizeof(mii);
+
+ for(UINT i = 0, j = pMenu->GetMenuItemCount(); i < j; i++)
+ {
+ CString str;
+ pMenu->GetMenuString(i, str, MF_BYPOSITION);
+
+ CMenu* pSubMenu = NULL;
+
+ if(str == ResStr(IDS_FAVORITES_POPUP))
+ {
+ SetupFavoritesSubMenu();
+ pSubMenu = &m_favorites;
+ }
+
+ if(pSubMenu)
+ {
+ mii.fMask = MIIM_STATE|MIIM_SUBMENU;
+ mii.fType = MF_POPUP;
+ mii.hSubMenu = pSubMenu->m_hMenu;
+ mii.fState = (pSubMenu->GetMenuItemCount() > 0 ? MF_ENABLED : (MF_DISABLED|MF_GRAYED));
+ pMenu->SetMenuItemInfo(i, &mii, TRUE);
+ }
+ }
+}
+
+void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
+{
+ __super::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
+
+ static CAtlStringMap<UINT> transl;
+
+ if(transl.IsEmpty())
+ {
+ transl[_T("Navigate")] = IDS_NAVIGATE_POPUP;
+ transl[_T("Open Disc")] = IDS_OPENCDROM_POPUP;
+ transl[_T("Filters")] = IDS_FILTERS_POPUP;
+ transl[_T("Audio")] = IDS_AUDIO_POPUP;
+ transl[_T("Subtitles")] = IDS_SUBTITLES_POPUP;
+ transl[_T("Audio Language")] = IDS_AUDIOLANGUAGE_POPUP;
+ transl[_T("Subtitle Language")] = IDS_SUBTITLELANGUAGE_POPUP;
+ transl[_T("Video Angle")] = IDS_VIDEOANGLE_POPUP;
+ transl[_T("Jump To...")] = IDS_JUMPTO_POPUP;
+ transl[_T("Favorites")] = IDS_FAVORITES_POPUP;
+ transl[_T("Shaders")] = IDS_SHADER_POPUP;
+ transl[_T("Video Frame")] = IDS_VIDEOFRAME_POPUP;
+ transl[_T("PanScan")] = IDS_PANSCAN_POPUP;
+ transl[_T("Aspect Ratio")] = IDS_ASPECTRATIO_POPUP;
+ transl[_T("Zoom")] = IDS_ZOOM_POPUP;
+ }
+
+ MENUITEMINFO mii;
+ mii.cbSize = sizeof(mii);
+
+ for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++)
+ {
+ CString str;
+ pPopupMenu->GetMenuString(i, str, MF_BYPOSITION);
+
+ CString lookupstr = str;
+ lookupstr.Remove('&');
+
+ CMenu* pSubMenu = NULL;
+
+ UINT id;
+ if(transl.Lookup(lookupstr, id))
+ {
+ str = ResStr(id);
+ // pPopupMenu->ModifyMenu(i, MF_BYPOSITION|MF_STRING, 0, str);
+ MENUITEMINFO mii;
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_STRING;
+ mii.dwTypeData = (LPTSTR)(LPCTSTR)str;
+ pPopupMenu->SetMenuItemInfo(i, &mii, TRUE);
+ }
+
+ if(str == ResStr(IDS_NAVIGATE_POPUP))
+ {
+ UINT fState = (m_iMediaLoadState == MLS_LOADED
+ && (1/*m_iPlaybackMode == PM_DVD *//*|| (m_iPlaybackMode == PM_FILE && m_PlayList.GetCount() > 0)*/))
+ ? MF_ENABLED
+ : (MF_DISABLED|MF_GRAYED);
+
+ pPopupMenu->EnableMenuItem(i, MF_BYPOSITION|fState);
+ }
+ else if(str == ResStr(IDS_VIDEOFRAME_POPUP)
+ || str == ResStr(IDS_PANSCAN_POPUP)
+ || str == ResStr(IDS_ASPECTRATIO_POPUP)
+ || str == ResStr(IDS_ZOOM_POPUP))
+ {
+ UINT fState = (m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly)
+ ? MF_ENABLED
+ : (MF_DISABLED|MF_GRAYED);
+
+ pPopupMenu->EnableMenuItem(i, MF_BYPOSITION|fState);
+ }
+ else if(str == ResStr(IDS_OPENCDROM_POPUP))
+ {
+ SetupOpenCDSubMenu();
+ pSubMenu = &m_opencds;
+ }
+ else if(str == ResStr(IDS_FILTERS_POPUP))
+ {
+ SetupFiltersSubMenu();
+ pSubMenu = &m_filters;
+ }
+ else if(str == ResStr(IDS_AUDIO_POPUP))
+ {
+ SetupAudioSwitcherSubMenu();
+ pSubMenu = &m_audios;
+ }
+ else if(str == ResStr(IDS_SUBTITLES_POPUP))
+ {
+ SetupSubtitlesSubMenu();
+ pSubMenu = &m_subtitles;
+ }
+ else if(str == ResStr(IDS_AUDIOLANGUAGE_POPUP))
+ {
+ SetupNavAudioSubMenu();
+ pSubMenu = &m_navaudio;
+ }
+ else if(str == ResStr(IDS_SUBTITLELANGUAGE_POPUP))
+ {
+ SetupNavSubtitleSubMenu();
+ pSubMenu = &m_navsubtitle;
+ }
+ else if(str == ResStr(IDS_VIDEOANGLE_POPUP))
+ {
+ SetupNavAngleSubMenu();
+ pSubMenu = &m_navangle;
+ }
+ else if(str == ResStr(IDS_JUMPTO_POPUP))
+ {
+ SetupNavChaptersSubMenu();
+ pSubMenu = &m_navchapters;
+ }
+ else if(str == ResStr(IDS_FAVORITES_POPUP))
+ {
+ SetupFavoritesSubMenu();
+ pSubMenu = &m_favorites;
+ }
+ else if(str == ResStr(IDS_SHADER_POPUP))
+ {
+ SetupShadersSubMenu();
+ pSubMenu = &m_shaders;
+ }
+
+ if(pSubMenu)
+ {
+ mii.fMask = MIIM_STATE|MIIM_SUBMENU;
+ mii.fType = MF_POPUP;
+ mii.hSubMenu = pSubMenu->m_hMenu;
+ mii.fState = (pSubMenu->GetMenuItemCount() > 0 ? MF_ENABLED : (MF_DISABLED|MF_GRAYED));
+ pPopupMenu->SetMenuItemInfo(i, &mii, TRUE);
+ }
+ }
+
+ //
+
+ for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++)
+ {
+ UINT nID = pPopupMenu->GetMenuItemID(i);
+ if(nID == ID_SEPARATOR || nID == -1
+ || nID >= ID_FAVORITES_FILE_START && nID <= ID_FAVORITES_FILE_END
+ || nID >= ID_NAVIGATE_CHAP_SUBITEM_START && nID <= ID_NAVIGATE_CHAP_SUBITEM_END)
+ continue;
+
+ CString str;
+ pPopupMenu->GetMenuString(i, str, MF_BYPOSITION);
+ int k = str.Find('\t');
+ if(k > 0) str = str.Left(k);
+
+ CString key = CPPageAccelTbl::MakeAccelShortcutLabel(nID);
+ if(!key.IsEmpty()) str += _T("\t") + key;
+
+ if(key.IsEmpty() && i < 0) continue;
+
+ // BUG(?): this disables menu item update ui calls for some reason...
+// pPopupMenu->ModifyMenu(i, MF_BYPOSITION|MF_STRING, nID, str);
+
+ // this works fine
+ MENUITEMINFO mii;
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_STRING;
+ mii.dwTypeData = (LPTSTR)(LPCTSTR)str;
+ pPopupMenu->SetMenuItemInfo(i, &mii, TRUE);
+
+ }
+
+ //
+
+ bool fPnSPresets = false;
+
+ for(UINT i = 0, j = pPopupMenu->GetMenuItemCount(); i < j; i++)
+ {
+ UINT nID = pPopupMenu->GetMenuItemID(i);
+
+ if(nID >= ID_PANNSCAN_PRESETS_START && nID < ID_PANNSCAN_PRESETS_END)
+ {
+ do
+ {
+ nID = pPopupMenu->GetMenuItemID(i);
+ pPopupMenu->DeleteMenu(i, MF_BYPOSITION);
+ j--;
+ }
+ while(i < j && nID >= ID_PANNSCAN_PRESETS_START && nID < ID_PANNSCAN_PRESETS_END);
+
+ nID = pPopupMenu->GetMenuItemID(i);
+ }
+
+ if(nID == ID_VIEW_RESET)
+ {
+ fPnSPresets = true;
+ }
+ }
+
+ if(fPnSPresets)
+ {
+ AppSettings& s = AfxGetAppSettings();
+ int i = 0, j = s.m_pnspresets.GetCount();
+ for(; i < j; i++)
+ {
+ int k = 0;
+ CString label = s.m_pnspresets[i].Tokenize(_T(","), k);
+ pPopupMenu->InsertMenu(ID_VIEW_RESET, MF_BYCOMMAND, ID_PANNSCAN_PRESETS_START+i, label);
+ }
+// if(j > 0)
+ {
+ pPopupMenu->InsertMenu(ID_VIEW_RESET, MF_BYCOMMAND, ID_PANNSCAN_PRESETS_START+i, ResStr(IDS_PANSCAN_EDIT));
+ pPopupMenu->InsertMenu(ID_VIEW_RESET, MF_BYCOMMAND|MF_SEPARATOR);
+ }
+ }
+}
+
+BOOL CMainFrame::OnMenu(CMenu* pMenu)
+{
+ if(!pMenu) return FALSE;
+
+ KillTimer(TIMER_FULLSCREENMOUSEHIDER);
+ m_fHideCursor = false;
+
+ CPoint point;
+ GetCursorPos(&point);
+
+ pMenu->TrackPopupMenu(TPM_RIGHTBUTTON|TPM_NOANIMATION, point.x+1, point.y+1, this);
+
+ return TRUE;
+}
+
+void CMainFrame::OnMenuPlayerShort()
+{
+ if(IsCaptionMenuHidden())
+ {
+ OnMenu(m_popupmain.GetSubMenu(0));
+ }
+ else
+ {
+ OnMenu(m_popup.GetSubMenu(0));
+ }
+}
+
+void CMainFrame::OnMenuPlayerLong()
+{
+ OnMenu(m_popupmain.GetSubMenu(0));
+}
+
+void CMainFrame::OnMenuFilters()
+{
+ SetupFiltersSubMenu();
+ OnMenu(&m_filters);
+}
+
+void CMainFrame::OnUpdatePlayerStatus(CCmdUI* pCmdUI)
+{
+ if(m_iMediaLoadState == MLS_LOADING)
+ {
+ pCmdUI->SetText(ResStr(IDS_CONTROLS_OPENING));
+ }
+ else if(m_iMediaLoadState == MLS_LOADED)
+ {
+ CString msg;
+
+ if(!m_playingmsg.IsEmpty())
+ {
+ msg = m_playingmsg;
+ }
+ else if(m_fCapturing)
+ {
+ msg = ResStr(IDS_CONTROLS_CAPTURING);
+
+ if(pAMDF)
+ {
+ long lDropped = 0;
+ pAMDF->GetNumDropped(&lDropped);
+ long lNotDropped = 0;
+ pAMDF->GetNumNotDropped(&lNotDropped);
+
+ if((lDropped + lNotDropped) > 0)
+ {
+ CString str;
+ str.Format(_T(", Total: %d, Dropped: %d"), lDropped + lNotDropped, lDropped);
+ msg += str;
+ }
+ }
+
+ CComPtr<IPin> pPin;
+ if(SUCCEEDED(pCGB->FindPin(m_wndCaptureBar.m_capdlg.m_pDst, PINDIR_INPUT, NULL, NULL, FALSE, 0, &pPin)))
+ {
+ LONGLONG size = 0;
+ if(CComQIPtr<IStream> pStream = pPin)
+ {
+ pStream->Commit(STGC_DEFAULT);
+
+ WIN32_FIND_DATA findFileData;
+ HANDLE h = FindFirstFile(m_wndCaptureBar.m_capdlg.m_file, &findFileData);
+ if(h != INVALID_HANDLE_VALUE)
+ {
+ size = ((LONGLONG)findFileData.nFileSizeHigh << 32) | findFileData.nFileSizeLow;
+
+ CString str;
+ if(size < 1024i64*1024)
+ str.Format(_T(", Size: %I64dKB"), size/1024);
+ else //if(size < 1024i64*1024*1024)
+ str.Format(_T(", Size: %I64dMB"), size/1024/1024);
+ msg += str;
+
+ FindClose(h);
+ }
+ }
+
+ ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
+ if(GetDiskFreeSpaceEx(
+ m_wndCaptureBar.m_capdlg.m_file.Left(m_wndCaptureBar.m_capdlg.m_file.ReverseFind('\\')+1),
+ &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes))
+ {
+ CString str;
+ if(FreeBytesAvailable.QuadPart < 1024i64*1024)
+ str.Format(_T(", Free: %I64dKB"), FreeBytesAvailable.QuadPart/1024);
+ else //if(FreeBytesAvailable.QuadPart < 1024i64*1024*1024)
+ str.Format(_T(", Free: %I64dMB"), FreeBytesAvailable.QuadPart/1024/1024);
+ msg += str;
+ }
+
+ if(m_wndCaptureBar.m_capdlg.m_pMux)
+ {
+ __int64 pos = 0;
+ CComQIPtr<IMediaSeeking> pMuxMS = m_wndCaptureBar.m_capdlg.m_pMux;
+ if(pMuxMS && SUCCEEDED(pMuxMS->GetCurrentPosition(&pos)) && pos > 0)
+ {
+ double bytepersec = 10000000.0 * size / pos;
+ if(bytepersec > 0)
+ m_rtDurationOverride = __int64(10000000.0 * (FreeBytesAvailable.QuadPart+size) / bytepersec);
+ }
+ }
+
+ if(m_wndCaptureBar.m_capdlg.m_pVidBuffer
+ || m_wndCaptureBar.m_capdlg.m_pAudBuffer)
+ {
+ int nFreeVidBuffers = 0, nFreeAudBuffers = 0;
+ if(CComQIPtr<IBufferFilter> pVB = m_wndCaptureBar.m_capdlg.m_pVidBuffer)
+ nFreeVidBuffers = pVB->GetFreeBuffers();
+ if(CComQIPtr<IBufferFilter> pAB = m_wndCaptureBar.m_capdlg.m_pAudBuffer)
+ nFreeAudBuffers = pAB->GetFreeBuffers();
+
+ CString str;
+ str.Format(_T(", Free V/A Buffers: %03d/%03d"), nFreeVidBuffers, nFreeAudBuffers);
+ msg += str;
+ }
+ }
+ }
+ else if(m_fBuffering)
+ {
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if(CComQIPtr<IAMNetworkStatus, &IID_IAMNetworkStatus> pAMNS = pBF)
+ {
+ long BufferingProgress = 0;
+ if(SUCCEEDED(pAMNS->get_BufferingProgress(&BufferingProgress)) && BufferingProgress > 0)
+ {
+ msg.Format(ResStr(IDS_CONTROLS_BUFFERING), BufferingProgress);
+
+ __int64 start = 0, stop = 0;
+ m_wndSeekBar.GetRange(start, stop);
+ m_fLiveWM = (stop == start);
+ }
+ break;
+ }
+ }
+ EndEnumFilters
+ }
+ else if(pAMOP)
+ {
+ __int64 t = 0, c = 0;
+ if(SUCCEEDED(pAMOP->QueryProgress(&t, &c)) && t > 0 && c < t)
+ msg.Format(ResStr(IDS_CONTROLS_BUFFERING), c*100/t);
+
+ if(m_fUpdateInfoBar)
+ OpenSetupInfoBar();
+ }
+
+ OAFilterState fs = GetMediaState();
+ pCmdUI->SetText(
+ !msg.IsEmpty() ? msg :
+ fs == State_Stopped ? ResStr(IDS_CONTROLS_STOPPED) :
+ (fs == State_Paused || m_fFrameSteppingActive) ? ResStr(IDS_CONTROLS_PAUSED) :
+ fs == State_Running ? ResStr(IDS_CONTROLS_PLAYING) :
+ _T(""));
+ }
+ else if(m_iMediaLoadState == MLS_CLOSING)
+ {
+ pCmdUI->SetText(ResStr(IDS_CONTROLS_CLOSING));
+ }
+ else
+ {
+ pCmdUI->SetText(m_closingmsg);
+ }
+}
+
+void CMainFrame::OnFilePostOpenmedia()
+{
+ OpenSetupInfoBar();
+
+ OpenSetupStatsBar();
+
+ OpenSetupStatusBar();
+
+ // OpenSetupToolBar();
+
+ OpenSetupCaptureBar();
+
+ __int64 rtDur = 0;
+ pMS->GetDuration(&rtDur);
+ m_wndPlaylistBar.SetCurTime(rtDur);
+
+ if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ ShowControlBar(&m_wndSubresyncBar, FALSE, TRUE);
+// ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE);
+// ShowControlBar(&m_wndCaptureBar, TRUE, TRUE);
+ }
+
+ m_iMediaLoadState = MLS_LOADED;
+
+ // IMPORTANT: must not call any windowing msgs before
+ // this point, it will deadlock when OpenMediaPrivate is
+ // still running and the renderer window was created on
+ // the same worker-thread
+
+ {
+ WINDOWPLACEMENT wp;
+ wp.length = sizeof(wp);
+ GetWindowPlacement(&wp);
+
+ // restore magnification
+ if(IsWindowVisible() && AfxGetAppSettings().fRememberZoomLevel
+ && !(m_fFullScreen || wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED))
+ {
+ ZoomVideoWindow();
+ }
+ }
+
+ if(!m_fAudioOnly && (AfxGetAppSettings().nCLSwitches&CLSW_FULLSCREEN))
+ {
+ SendMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
+ AfxGetAppSettings().nCLSwitches &= ~CLSW_FULLSCREEN;
+ }
+
+ SendNowPlayingToMSN();
+ SendNowPlayingTomIRC();
+}
+
+void CMainFrame::OnUpdateFilePostOpenmedia(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADING);
+}
+
+void CMainFrame::OnFilePostClosemedia()
+{
+ m_wndView.SetVideoRect();
+ m_wndSeekBar.Enable(false);
+ m_wndSeekBar.SetPos(0);
+ m_wndInfoBar.RemoveAllLines();
+ m_wndStatsBar.RemoveAllLines();
+ m_wndStatusBar.Clear();
+ m_wndStatusBar.ShowTimer(false);
+
+ if(IsWindow(m_wndSubresyncBar.m_hWnd))
+ {
+ ShowControlBar(&m_wndSubresyncBar, FALSE, TRUE);
+ SetSubtitle(NULL);
+ }
+
+ if(IsWindow(m_wndCaptureBar.m_hWnd))
+ {
+ ShowControlBar(&m_wndCaptureBar, FALSE, TRUE);
+ m_wndCaptureBar.m_capdlg.SetupVideoControls(_T(""), NULL, NULL, NULL);
+ m_wndCaptureBar.m_capdlg.SetupAudioControls(_T(""), NULL, CInterfaceArray<IAMAudioInputMixer>());
+ }
+
+ RecalcLayout();
+
+ SetWindowText(ResStr(IDR_MAINFRAME));
+
+ SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
+
+ // this will prevent any further UI updates on the dynamically added menu items
+ SetupFiltersSubMenu();
+ SetupAudioSwitcherSubMenu();
+ SetupSubtitlesSubMenu();
+ SetupNavAudioSubMenu();
+ SetupNavSubtitleSubMenu();
+ SetupNavAngleSubMenu();
+ SetupNavChaptersSubMenu();
+ SetupFavoritesSubMenu();
+
+ SendNowPlayingToMSN();
+}
+
+void CMainFrame::OnUpdateFilePostClosemedia(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!!m_hWnd && m_iMediaLoadState == MLS_CLOSING);
+}
+
+void CMainFrame::OnBossKey()
+{
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ if(m_fFullScreen) SendMessage(WM_COMMAND, ID_VIEW_FULLSCREEN);
+ SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, -1);
+}
+
+void CMainFrame::OnStreamAudio(UINT nID)
+{
+ nID -= ID_STREAM_AUDIO_NEXT;
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
+ if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB); // morgan's switcher
+
+ DWORD cStreams = 0;
+ if(pSS && SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1)
+ {
+ for(int i = 0; i < (int)cStreams; i++)
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+ DWORD dwFlags = 0;
+ LCID lcid = 0;
+ DWORD dwGroup = 0;
+ WCHAR* pszName = NULL;
+ if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
+ return;
+ if(pmt) DeleteMediaType(pmt);
+ if(pszName) CoTaskMemFree(pszName);
+
+ if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE))
+ {
+ pSS->Enable((i+(nID==0?1:cStreams-1))%cStreams, AMSTREAMSELECTENABLE_ENABLE);
+ break;
+ }
+ }
+ }
+ else if(m_iPlaybackMode == PM_FILE) SendMessage(WM_COMMAND, ID_OGM_AUDIO_NEXT+nID);
+ else if(m_iPlaybackMode == PM_DVD) SendMessage(WM_COMMAND, ID_DVD_AUDIO_NEXT+nID);
+}
+
+void CMainFrame::OnStreamSub(UINT nID)
+{
+ nID -= ID_STREAM_SUB_NEXT;
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ int cnt = 0;
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos) cnt += m_pSubStreams.GetNext(pos)->GetStreamCount();
+
+ if(cnt > 1)
+ {
+ int i = ((m_iSubtitleSel&0x7fffffff)+(nID==0?1:cnt-1))%cnt;
+ m_iSubtitleSel = i | (m_iSubtitleSel&0x80000000);
+ UpdateSubtitle();
+ SetFocus();
+ }
+ else if(m_iPlaybackMode == PM_FILE) SendMessage(WM_COMMAND, ID_OGM_SUB_NEXT+nID);
+ else if(m_iPlaybackMode == PM_DVD) SendMessage(WM_COMMAND, ID_DVD_SUB_NEXT+nID);
+}
+
+void CMainFrame::OnStreamSubOnOff()
+{
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ int cnt = 0;
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos) cnt += m_pSubStreams.GetNext(pos)->GetStreamCount();
+
+ if(cnt > 0)
+ {
+ m_iSubtitleSel ^= 0x80000000;
+ UpdateSubtitle();
+ SetFocus();
+ }
+ else if(m_iPlaybackMode == PM_DVD) SendMessage(WM_COMMAND, ID_DVD_SUB_ONOFF);
+}
+
+void CMainFrame::OnOgmAudio(UINT nID)
+{
+ nID -= ID_OGM_AUDIO_NEXT;
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ CComQIPtr<IAMStreamSelect> pSS = FindFilter(CLSID_OggSplitter, pGB);
+ if(!pSS) pSS = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB);
+ if(!pSS) return;
+
+ CAtlArray<int> snds;
+ int iSel = -1;
+
+ DWORD cStreams = 0;
+ if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1)
+ {
+ for(int i = 0; i < (int)cStreams; i++)
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+ DWORD dwFlags = 0;
+ LCID lcid = 0;
+ DWORD dwGroup = 0;
+ WCHAR* pszName = NULL;
+ if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
+ return;
+
+ if(dwGroup == 1)
+ {
+ if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE))
+ iSel = snds.GetCount();
+ snds.Add(i);
+ }
+
+ if(pmt) DeleteMediaType(pmt);
+ if(pszName) CoTaskMemFree(pszName);
+
+ }
+
+ int cnt = snds.GetCount();
+ if(cnt > 1 && iSel >= 0)
+ pSS->Enable(snds[(iSel+(nID==0?1:cnt-1))%cnt], AMSTREAMSELECTENABLE_ENABLE);
+ }
+}
+
+void CMainFrame::OnOgmSub(UINT nID)
+{
+ nID -= ID_OGM_SUB_NEXT;
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ CComQIPtr<IAMStreamSelect> pSS = FindFilter(CLSID_OggSplitter, pGB);
+ if(!pSS) pSS = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB);
+ if(!pSS) return;
+
+ CArray<int> subs;
+ int iSel = -1;
+
+ DWORD cStreams = 0;
+ if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 1)
+ {
+ for(int i = 0; i < (int)cStreams; i++)
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+ DWORD dwFlags = 0;
+ LCID lcid = 0;
+ DWORD dwGroup = 0;
+ WCHAR* pszName = NULL;
+ if(FAILED(pSS->Info(i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
+ return;
+
+ if(dwGroup == 2)
+ {
+ if(dwFlags&(AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE))
+ iSel = subs.GetCount();
+ subs.Add(i);
+ }
+
+ if(pmt) DeleteMediaType(pmt);
+ if(pszName) CoTaskMemFree(pszName);
+
+ }
+
+ int cnt = subs.GetCount();
+ if(cnt > 1 && iSel >= 0)
+ pSS->Enable(subs[(iSel+(nID==0?1:cnt-1))%cnt], AMSTREAMSELECTENABLE_ENABLE);
+ }
+}
+
+void CMainFrame::OnDvdAngle(UINT nID)
+{
+ nID -= ID_DVD_ANGLE_NEXT;
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ if(pDVDI && pDVDC)
+ {
+ ULONG ulAnglesAvailable, ulCurrentAngle;
+ if(SUCCEEDED(pDVDI->GetCurrentAngle(&ulAnglesAvailable, &ulCurrentAngle)) && ulAnglesAvailable > 1)
+ {
+ ulCurrentAngle += nID==0 ? 1 : ulAnglesAvailable-1;
+ if(ulCurrentAngle > ulAnglesAvailable) ulCurrentAngle = 1;
+ else if(ulCurrentAngle < 1) ulCurrentAngle = ulAnglesAvailable;
+ pDVDC->SelectAngle(ulCurrentAngle, DVD_CMD_FLAG_Block, NULL);
+ }
+ }
+}
+
+void CMainFrame::OnDvdAudio(UINT nID)
+{
+ HRESULT hr;
+ nID -= ID_DVD_AUDIO_NEXT;
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ if(pDVDI && pDVDC)
+ {
+ ULONG nStreamsAvailable, nCurrentStream;
+ if(SUCCEEDED(pDVDI->GetCurrentAudio(&nStreamsAvailable, &nCurrentStream)) && nStreamsAvailable > 1)
+ {
+ DVD_AudioAttributes AATR;
+ UINT nNextStream = (nCurrentStream+(nID==0?1:nStreamsAvailable-1))%nStreamsAvailable;
+
+ hr = pDVDC->SelectAudioStream(nNextStream, DVD_CMD_FLAG_Block, NULL);
+ if (SUCCEEDED(pDVDI->GetAudioAttributes(nNextStream, &AATR)))
+ {
+ CString lang;
+ CString strMessage;
+ int len = GetLocaleInfo(AATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
+ lang.ReleaseBufferSetLength(max(len-1, 0));
+ strMessage.Format (_T("Audio : %s - %s %s"), lang, GetDVDAudioFormatName(AATR), FAILED(hr)?_T("Error"):_T(""));
+ m_OSD.DisplayMessage (OSD_TOPLEFT, strMessage);
+ }
+ }
+ }
+}
+
+void CMainFrame::OnDvdSub(UINT nID)
+{
+ HRESULT hr;
+ nID -= ID_DVD_SUB_NEXT;
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ if(pDVDI && pDVDC)
+ {
+ ULONG ulStreamsAvailable, ulCurrentStream;
+ BOOL bIsDisabled;
+ if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled))
+ && ulStreamsAvailable > 1)
+ {
+// UINT nNextStream = (ulCurrentStream+(nID==0?1:ulStreamsAvailable-1))%ulStreamsAvailable;
+ int nNextStream;
+
+ if (!bIsDisabled)
+ nNextStream = ulCurrentStream+ (nID==0?1:-1);
+ else
+ nNextStream = (nID==0?0:ulStreamsAvailable-1);
+
+ if (!bIsDisabled && ((nNextStream < 0) || (nNextStream >= ulStreamsAvailable)))
+ {
+ pDVDC->SetSubpictureState(FALSE, DVD_CMD_FLAG_Block, NULL);
+ m_OSD.DisplayMessage (OSD_TOPLEFT, _T("Subtitle : off"));
+ }
+ else
+ {
+ hr = pDVDC->SelectSubpictureStream(nNextStream, DVD_CMD_FLAG_Block, NULL);
+
+ DVD_SubpictureAttributes SATR;
+ pDVDC->SetSubpictureState(TRUE, DVD_CMD_FLAG_Block, NULL);
+ if(SUCCEEDED(pDVDI->GetSubpictureAttributes(nNextStream, &SATR)))
+ {
+ CString lang;
+ CString strMessage;
+ int len = GetLocaleInfo(SATR.Language, LOCALE_SENGLANGUAGE, lang.GetBuffer(64), 64);
+ lang.ReleaseBufferSetLength(max(len-1, 0));
+ strMessage.Format (_T("Subtitle : %s %s"), lang, FAILED(hr)?_T("Error"):_T(""));
+ m_OSD.DisplayMessage (OSD_TOPLEFT, strMessage);
+ }
+ }
+ }
+ }
+}
+
+void CMainFrame::OnDvdSubOnOff()
+{
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ if(pDVDI && pDVDC)
+ {
+ ULONG ulStreamsAvailable, ulCurrentStream;
+ BOOL bIsDisabled;
+ if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled)))
+ {
+ pDVDC->SetSubpictureState(bIsDisabled, DVD_CMD_FLAG_Block, NULL);
+ }
+ }
+}
+
+//
+// menu item handlers
+//
+
+// file
+
+void CMainFrame::OnFileOpenQuick()
+{
+ if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar)) return;
+
+ CString filter;
+ CAtlArray<CString> mask;
+ AfxGetAppSettings().Formats.GetFilter(filter, mask);
+
+ COpenFileDlg fd(mask, true, NULL, NULL,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY,
+ filter, this);
+ if(fd.DoModal() != IDOK) return;
+
+ CAtlList<CString> fns;
+
+ POSITION pos = fd.GetStartPosition();
+ while(pos) fns.AddTail(fd.GetNextPathName(pos));
+
+ bool fMultipleFiles = false;
+
+ if(fns.GetCount() > 1
+ || fns.GetCount() == 1
+ && (fns.GetHead()[fns.GetHead().GetLength()-1] == '\\'
+ || fns.GetHead()[fns.GetHead().GetLength()-1] == '*'))
+ {
+ fMultipleFiles = true;
+ }
+
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+
+ ShowWindow(SW_SHOW);
+ SetForegroundWindow();
+
+ m_wndPlaylistBar.Open(fns, fMultipleFiles);
+
+ if(m_wndPlaylistBar.GetCount() == 1 && m_wndPlaylistBar.IsWindowVisible() && !m_wndPlaylistBar.IsFloating())
+ {
+ ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE);
+ }
+
+ OpenCurPlaylistItem();
+}
+
+void CMainFrame::OnFileOpenmedia()
+{
+ if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar) || m_bD3DFullscreenMode) return;
+
+ COpenDlg dlg;
+ if(dlg.DoModal() != IDOK || dlg.m_fns.GetCount() == 0) return;
+
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+
+ ShowWindow(SW_SHOW);
+ SetForegroundWindow();
+
+ if(dlg.m_fAppendPlaylist)
+ {
+ m_wndPlaylistBar.Append(dlg.m_fns, dlg.m_fMultipleFiles);
+ return;
+ }
+
+ m_wndPlaylistBar.Open(dlg.m_fns, dlg.m_fMultipleFiles);
+
+ if(m_wndPlaylistBar.GetCount() == 1 && m_wndPlaylistBar.IsWindowVisible() && !m_wndPlaylistBar.IsFloating())
+ {
+ ShowControlBar(&m_wndPlaylistBar, FALSE, TRUE);
+ }
+
+ OpenCurPlaylistItem();
+}
+
+void CMainFrame::OnUpdateFileOpen(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState != MLS_LOADING);
+}
+
+BOOL CMainFrame::OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCDS)
+{
+ if(m_iMediaLoadState == MLS_LOADING || !IsWindow(m_wndPlaylistBar))
+ return FALSE;
+
+ if(pCDS->dwData != 0x6ABE51 || pCDS->cbData < sizeof(DWORD))
+ return FALSE;
+
+ DWORD len = *((DWORD*)pCDS->lpData);
+ TCHAR* pBuff = (TCHAR*)((DWORD*)pCDS->lpData + 1);
+ TCHAR* pBuffEnd = (TCHAR*)((BYTE*)pBuff + pCDS->cbData - sizeof(DWORD));
+
+ CAtlList<CString> cmdln;
+
+ while(len-- > 0)
+ {
+ CString str;
+ while(pBuff < pBuffEnd && *pBuff) str += *pBuff++;
+ pBuff++;
+ cmdln.AddTail(str);
+ }
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.ParseCommandLine(cmdln);
+
+ POSITION pos = s.slFilters.GetHeadPosition();
+ while(pos)
+ {
+ CString fullpath = MakeFullPath(s.slFilters.GetNext(pos));
+
+ CPath tmp(fullpath);
+ tmp.RemoveFileSpec();
+ tmp.AddBackslash();
+ CString path = tmp;
+
+ WIN32_FIND_DATA fd = {0};
+ HANDLE hFind = FindFirstFile(fullpath, &fd);
+ if(hFind != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
+
+ CFilterMapper2 fm2(false);
+ fm2.Register(path + fd.cFileName);
+ while(!fm2.m_filters.IsEmpty())
+ {
+ if(FilterOverride* f = fm2.m_filters.RemoveTail())
+ {
+ f->fTemporary = true;
+
+ bool fFound = false;
+
+ POSITION pos2 = s.filters.GetHeadPosition();
+ while(pos2)
+ {
+ FilterOverride* f2 = s.filters.GetNext(pos2);
+ if(f2->type == FilterOverride::EXTERNAL && !f2->path.CompareNoCase(f->path))
+ {
+ fFound = true;
+ break;
+ }
+ }
+
+ if(!fFound)
+ {
+ CAutoPtr<FilterOverride> p(f);
+ s.filters.AddHead(p);
+ }
+ }
+ }
+ }
+ while(FindNextFile(hFind, &fd));
+
+ FindClose(hFind);
+ }
+ }
+
+ bool fSetForegroundWindow = false;
+
+ if((s.nCLSwitches&CLSW_DVD) && !s.slFiles.IsEmpty())
+ {
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ fSetForegroundWindow = true;
+
+ CAutoPtr<OpenDVDData> p(new OpenDVDData());
+ if(p) {p->path = s.slFiles.GetHead(); p->subs.AddTailList(&s.slSubs);}
+ OpenMedia(p);
+ }
+ else if(s.nCLSwitches&CLSW_CD)
+ {
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ fSetForegroundWindow = true;
+
+ CAtlList<CString> sl;
+
+ if(!s.slFiles.IsEmpty())
+ {
+ GetCDROMType(s.slFiles.GetHead()[0], sl);
+ }
+ else
+ {
+ CString dir;
+ dir.ReleaseBufferSetLength(GetCurrentDirectory(MAX_PATH, dir.GetBuffer(MAX_PATH)));
+
+ GetCDROMType(dir[0], sl);
+
+ for(TCHAR drive = 'C'; sl.IsEmpty() && drive <= 'Z'; drive++)
+ {
+ GetCDROMType(drive, sl);
+ }
+ }
+
+ m_wndPlaylistBar.Open(sl, true);
+ OpenCurPlaylistItem();
+ }
+ else if(!s.slFiles.IsEmpty())
+ {
+ bool fMulti = s.slFiles.GetCount() > 1;
+
+ CAtlList<CString> sl;
+ sl.AddTailList(&s.slFiles);
+ if(!fMulti) sl.AddTailList(&s.slDubs);
+
+ if((s.nCLSwitches&CLSW_ADD) && m_wndPlaylistBar.GetCount() > 0)
+ {
+ m_wndPlaylistBar.Append(sl, fMulti, &s.slSubs);
+
+ if(s.nCLSwitches&(CLSW_OPEN|CLSW_PLAY))
+ {
+ m_wndPlaylistBar.SetLast();
+ OpenCurPlaylistItem();
+ }
+ }
+ else
+ {
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ fSetForegroundWindow = true;
+
+ m_wndPlaylistBar.Open(sl, fMulti, &s.slSubs);
+ OpenCurPlaylistItem((s.nCLSwitches&CLSW_STARTVALID) ? s.rtStart : 0);
+
+ s.nCLSwitches &= ~CLSW_STARTVALID;
+ s.rtStart = 0;
+ }
+ }
+ else
+ {
+ s.nCLSwitches = CLSW_NONE;
+ }
+
+ if(fSetForegroundWindow && !(s.nCLSwitches&CLSW_NOFOCUS))
+ SetForegroundWindow();
+
+ s.nCLSwitches &= ~CLSW_NOFOCUS;
+
+ return TRUE;
+}
+
+int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData)
+{
+ switch(uMsg)
+ {
+ case BFFM_INITIALIZED:
+ //Initial directory is set here
+ SendMessage(hwnd, BFFM_SETSELECTION, TRUE,(LPARAM)(LPCTSTR)AfxGetAppSettings().sDVDPath);
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+
+
+void CMainFrame::OnFileOpendvd()
+{
+ if ((m_iMediaLoadState == MLS_LOADING) || m_bD3DFullscreenMode) return;
+
+ /*
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ SetForegroundWindow();
+
+ ShowWindow(SW_SHOW);
+
+ CAutoPtr<OpenDVDData> p(new OpenDVDData());
+ if(p)
+ {
+ AppSettings& s = AfxGetAppSettings();
+ if(s.fUseDVDPath && !s.sDVDPath.IsEmpty())
+ {
+ p->path = s.sDVDPath;
+ p->path.Replace('/', '\\');
+ if(p->path[p->path.GetLength()-1] != '\\') p->path += '\\';
+ }
+ }
+ OpenMedia(p);*/
+
+ AppSettings& s = AfxGetAppSettings();
+ TCHAR path[MAX_PATH];
+
+ BROWSEINFO bi;
+ bi.hwndOwner = m_hWnd;
+ bi.pidlRoot = NULL;
+ bi.pszDisplayName = path;
+ bi.lpszTitle = _T("Select the path for the DVD:");
+ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_VALIDATE | BIF_USENEWUI | BIF_NONEWFOLDERBUTTON;
+ bi.lpfn = BrowseCallbackProc;
+ bi.lParam = 0;
+ bi.iImage = 0;
+
+ static LPITEMIDLIST iil;
+
+ if(iil = SHBrowseForFolder(&bi))
+ {
+ CAutoPtr<OpenDVDData> p(new OpenDVDData());
+
+ SHGetPathFromIDList(iil, path);
+
+ s.sDVDPath = path;
+ p->path = path;
+ p->path.Replace('/', '\\');
+ if(p->path[p->path.GetLength()-1] != '\\') p->path += '\\';
+
+ OpenMedia(p);
+ }
+}
+
+void CMainFrame::OnFileOpendevice()
+{
+ if(m_iMediaLoadState == MLS_LOADING) return;
+
+ COpenCapDeviceDlg capdlg;
+ if(capdlg.DoModal() != IDOK)
+ return;
+
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ SetForegroundWindow();
+
+ ShowWindow(SW_SHOW);
+
+ m_wndPlaylistBar.Empty();
+
+ CAutoPtr<OpenDeviceData> p(new OpenDeviceData());
+ if(p) {p->DisplayName[0] = capdlg.m_vidstr; p->DisplayName[1] = capdlg.m_audstr;}
+ OpenMedia(p);
+}
+
+void CMainFrame::OnFileOpenCD(UINT nID)
+{
+ nID -= ID_FILE_OPEN_CD_START;
+
+ nID++;
+ for(TCHAR drive = 'C'; drive <= 'Z'; drive++)
+ {
+ CAtlList<CString> sl;
+
+ switch(GetCDROMType(drive, sl))
+ {
+ case CDROM_Audio:
+ case CDROM_VideoCD:
+ case CDROM_DVDVideo:
+ nID--;
+ break;
+ default:
+ break;
+ }
+
+ if(nID == 0)
+ {
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ SetForegroundWindow();
+
+ ShowWindow(SW_SHOW);
+
+ m_wndPlaylistBar.Open(sl, true);
+ OpenCurPlaylistItem();
+
+ break;
+ }
+ }
+}
+
+void CMainFrame::OnDropFiles(HDROP hDropInfo)
+{
+ SetForegroundWindow();
+
+ if(m_wndPlaylistBar.IsWindowVisible())
+ {
+ m_wndPlaylistBar.OnDropFiles(hDropInfo);
+ return;
+ }
+
+ CAtlList<CString> sl;
+
+ UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
+
+ for(UINT iFile = 0; iFile < nFiles; iFile++)
+ {
+ CString fn;
+ fn.ReleaseBuffer(::DragQueryFile(hDropInfo, iFile, fn.GetBuffer(MAX_PATH), MAX_PATH));
+ sl.AddTail(fn);
+ }
+
+ ::DragFinish(hDropInfo);
+
+ if(sl.IsEmpty()) return;
+
+ if(sl.GetCount() == 1 && m_iMediaLoadState == MLS_LOADED && m_pCAP)
+ {
+ if(LoadSubtitle(sl.GetHead()))
+ {
+ SetSubtitle(m_pSubStreams.GetTail());
+ CPath p(sl.GetHead());
+ p.StripPath();
+ SendStatusMessage(CString((LPCTSTR)p) + _T(" loaded successfully"), 3000);
+ return;
+ }
+ }
+
+ m_wndPlaylistBar.Open(sl, true);
+ OpenCurPlaylistItem();
+}
+
+void CMainFrame::OnFileSaveAs()
+{
+ CString ext, in = m_wndPlaylistBar.GetCur(), out = in;
+
+ if(out.Find(_T("://")) < 0)
+ {
+ ext = CString(CPath(out).GetExtension()).MakeLower();
+ if(ext == _T(".cda")) out = out.Left(out.GetLength()-4) + _T(".wav");
+ else if(ext == _T(".ifo")) out = out.Left(out.GetLength()-4) + _T(".vob");
+ }
+ else
+ {
+ out.Empty();
+ }
+
+ CFileDialog fd(FALSE, 0, out,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
+ _T("All files (*.*)|*.*||"), this, 0);
+ if(fd.DoModal() != IDOK || !in.CompareNoCase(fd.GetPathName())) return;
+
+ CPath p(fd.GetPathName());
+ if(!ext.IsEmpty()) p.AddExtension(ext);
+
+ OAFilterState fs = State_Stopped;
+ pMC->GetState(0, &fs);
+ if(fs == State_Running) pMC->Pause();
+
+ CSaveDlg dlg(in, p);
+ dlg.DoModal();
+
+ if(fs == State_Running) pMC->Run();
+}
+
+void CMainFrame::OnUpdateFileSaveAs(CCmdUI* pCmdUI)
+{
+ if(m_iMediaLoadState != MLS_LOADED || m_iPlaybackMode != PM_FILE)
+ {
+ pCmdUI->Enable(FALSE);
+ return;
+ }
+
+ CString fn = m_wndPlaylistBar.GetCur();
+ CString ext = fn.Mid(fn.ReverseFind('.')+1).MakeLower();
+
+ if(fn.Find(_T("://")) >= 0)
+ {
+ pCmdUI->Enable(FALSE);
+ return;
+ }
+
+ if((GetVersion()&0x80000000) && (ext == _T("cda") || ext == _T("ifo")))
+ {
+ pCmdUI->Enable(FALSE);
+ return;
+ }
+
+ pCmdUI->Enable(TRUE);
+}
+
+bool CMainFrame::GetDIB(BYTE** ppData, long& size, bool fSilent)
+{
+ if(!ppData) return false;
+
+ *ppData = NULL;
+ size = 0;
+
+ bool fNeedsToPause = !m_pCAP;
+ if(fNeedsToPause) fNeedsToPause = !IsVMR7InGraph(pGB);
+ if(fNeedsToPause) fNeedsToPause = !IsVMR9InGraph(pGB);
+
+ OAFilterState fs = GetMediaState();
+
+ if(!(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && (fs == State_Paused || fs == State_Running)))
+ return false;
+
+ if(fs == State_Running && fNeedsToPause)
+ {
+ pMC->Pause();
+ GetMediaState(); // wait for completion of the pause command
+ }
+
+ HRESULT hr = S_OK;
+ CString errmsg;
+
+ do
+ {
+ if(m_pCAP)
+ {
+ hr = m_pCAP->GetDIB(NULL, (DWORD*)&size);
+ if(FAILED(hr)) {errmsg.Format(_T("GetDIB failed, hr = %08x"), hr); break;}
+
+ if(!(*ppData = new BYTE[size])) return false;
+
+ hr = m_pCAP->GetDIB(*ppData, (DWORD*)&size);
+ if(FAILED(hr)) {errmsg.Format(_T("GetDIB failed, hr = %08x"), hr); break;}
+ }
+ else
+ {
+ hr = pBV->GetCurrentImage(&size, NULL);
+ if(FAILED(hr) || size == 0) {errmsg.Format(_T("GetCurrentImage failed, hr = %08x"), hr); break;}
+
+ if(!(*ppData = new BYTE[size])) return false;
+
+ hr = pBV->GetCurrentImage(&size, (long*)*ppData);
+ if(FAILED(hr)) {errmsg.Format(_T("GetCurrentImage failed, hr = %08x"), hr); break;}
+ }
+ }
+ while(0);
+
+ if(!fSilent)
+ {
+ if(!errmsg.IsEmpty())
+ {
+ AfxMessageBox(errmsg, MB_OK);
+ }
+ }
+
+ if(fs == State_Running && GetMediaState() != State_Running)
+ {
+ pMC->Run();
+ }
+
+ if(FAILED(hr))
+ {
+ if(*ppData) {ASSERT(0); delete [] *ppData; *ppData = NULL;} // huh?
+ return false;
+ }
+
+ return true;
+}
+
+#include "jpeg.h"
+
+void CMainFrame::SaveDIB(LPCTSTR fn, BYTE* pData, long size)
+{
+ CString ext = CString(CPath(fn).GetExtension()).MakeLower();
+
+ if(ext == _T(".bmp"))
+ {
+ if(FILE* f = _tfopen(fn, _T("wb")))
+ {
+ BITMAPINFO* bi = (BITMAPINFO*)pData;
+
+ BITMAPFILEHEADER bfh;
+ bfh.bfType = 'MB';
+ bfh.bfOffBits = sizeof(bfh) + sizeof(bi->bmiHeader);
+ bfh.bfSize = sizeof(bfh) + size;
+ bfh.bfReserved1 = bfh.bfReserved2 = 0;
+
+ if(bi->bmiHeader.biBitCount <= 8)
+ {
+ if(bi->bmiHeader.biClrUsed) bfh.bfOffBits += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
+ else bfh.bfOffBits += (1 << bi->bmiHeader.biBitCount) * sizeof(bi->bmiColors[0]);
+ }
+
+ fwrite(&bfh, 1, sizeof(bfh), f);
+ fwrite(pData, 1, size, f);
+
+ fclose(f);
+ }
+ else
+ {
+ AfxMessageBox(_T("Cannot create file"), MB_OK);
+ }
+ }
+ else if(ext == _T(".jpg"))
+ {
+ CJpegEncoderFile(fn).Encode(pData);
+ }
+
+ CPath p(fn);
+
+ if(CDC* pDC = m_wndStatusBar.m_status.GetDC())
+ {
+ CRect r;
+ m_wndStatusBar.m_status.GetClientRect(r);
+ p.CompactPath(pDC->m_hDC, r.Width());
+ m_wndStatusBar.m_status.ReleaseDC(pDC);
+ }
+
+ SendStatusMessage((LPCTSTR)p, 3000);
+}
+
+void CMainFrame::SaveImage(LPCTSTR fn)
+{
+ BYTE* pData = NULL;
+ long size = 0;
+
+ if(GetDIB(&pData, size))
+ {
+ SaveDIB(fn, pData, size);
+ delete [] pData;
+ }
+}
+
+void CMainFrame::SaveThumbnails(LPCTSTR fn)
+{
+ if(!pMC || !pMS || m_iPlaybackMode != PM_FILE /*&& m_iPlaybackMode != PM_DVD*/)
+ return;
+
+ REFERENCE_TIME rtPos = GetPos();
+ REFERENCE_TIME rtDur = GetDur();
+
+ if(rtDur <= 0)
+ {
+ AfxMessageBox(_T("Cannot create thumbnails for files with no duration"));
+ return;
+ }
+
+ pMC->Pause();
+ GetMediaState(); // wait for completion of the pause command
+
+ //
+
+ CSize video, wh(0, 0), arxy(0, 0);
+
+ if(m_pCAP)
+ {
+ wh = m_pCAP->GetVideoSize(false);
+ arxy = m_pCAP->GetVideoSize(true);
+ }
+ else
+ {
+ pBV->GetVideoSize(&wh.cx, &wh.cy);
+
+ long arx = 0, ary = 0;
+ CComQIPtr<IBasicVideo2> pBV2 = pBV;
+ if(pBV2 && SUCCEEDED(pBV2->GetPreferredAspectRatio(&arx, &ary)) && arx > 0 && ary > 0)
+ arxy.SetSize(arx, ary);
+ }
+
+ if(wh.cx <= 0 || wh.cy <= 0)
+ {
+ AfxMessageBox(_T("Failed to get video frame size"));
+ return;
+ }
+
+ // with the overlay mixer IBasicVideo2 won't tell the new AR when changed dynamically
+ DVD_VideoAttributes VATR;
+ if(m_iPlaybackMode == PM_DVD && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR)))
+ arxy.SetSize(VATR.ulAspectX, VATR.ulAspectY);
+
+ video = (arxy.cx <= 0 || arxy.cy <= 0) ? wh : CSize(MulDiv(wh.cy, arxy.cx, arxy.cy), wh.cy);
+
+ //
+
+ AppSettings& s = AfxGetAppSettings();
+
+ int cols = s.ThumbCols, rows = s.ThumbRows;
+
+ int margin = 5;
+ int infoheight = 70;
+ int width = s.ThumbWidth;
+ int height = width * video.cy / video.cx * rows / cols + infoheight;
+
+ int dibsize = sizeof(BITMAPINFOHEADER) + width*height*4;
+
+ CAutoVectorPtr<BYTE> dib;
+ if(!dib.Allocate(dibsize))
+ {
+ AfxMessageBox(_T("Out of memory, go buy some more!"));
+ return;
+ }
+
+ BITMAPINFOHEADER* bih = (BITMAPINFOHEADER*)(BYTE*)dib;
+ memset(bih, 0, sizeof(BITMAPINFOHEADER));
+ bih->biSize = sizeof(BITMAPINFOHEADER);
+ bih->biWidth = width;
+ bih->biHeight = height;
+ bih->biPlanes = 1;
+ bih->biBitCount = 32;
+ bih->biCompression = BI_RGB;
+ bih->biSizeImage = width*height*4;
+ memsetd(bih + 1, 0xffffff, bih->biSizeImage);
+
+ SubPicDesc spd;
+ spd.w = width;
+ spd.h = height;
+ spd.bpp = 32;
+ spd.pitch = -width*4;
+ spd.bits = (BYTE*)(bih + 1) + (width*4)*(height-1);
+
+ {
+ BYTE* p = (BYTE*)spd.bits;
+ for(int y = 0; y < spd.h; y++, p += spd.pitch)
+ for(int x = 0; x < spd.w; x++)
+ ((DWORD*)p)[x] = 0x010101 * (0xe0 + 0x08*y/spd.h + 0x18*(spd.w-x)/spd.w);
+ }
+
+ CCritSec csSubLock;
+ RECT bbox;
+
+ for(int i = 1, pics = cols*rows; i <= pics; i++)
+ {
+ REFERENCE_TIME rt = rtDur * i / (pics+1);
+ DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt, 25);
+
+ SeekTo(rt);
+
+ m_VolumeBeforeFrameStepping = m_wndToolBar.Volume;
+ pBA->put_Volume(-10000);
+
+ HRESULT hr = pFS ? pFS->Step(1, NULL) : E_FAIL;
+
+ if(FAILED(hr))
+ {
+ pBA->put_Volume(m_VolumeBeforeFrameStepping);
+ AfxMessageBox(_T("Cannot frame step, try a different video renderer."));
+ return;
+ }
+
+ HANDLE hGraphEvent = NULL;
+ pME->GetEventHandle((OAEVENT*)&hGraphEvent);
+
+ while(hGraphEvent && WaitForSingleObject(hGraphEvent, INFINITE) == WAIT_OBJECT_0)
+ {
+ LONG evCode = 0, evParam1, evParam2;
+ while(SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0)))
+ {
+ pME->FreeEventParams(evCode, evParam1, evParam2);
+ if(EC_STEP_COMPLETE == evCode) hGraphEvent = NULL;
+ }
+ }
+
+ pBA->put_Volume(m_VolumeBeforeFrameStepping);
+
+ int col = (i-1)%cols;
+ int row = (i-1)/cols;
+
+ CSize s((width-margin*2)/cols, (height-margin*2-infoheight)/rows);
+ CPoint p(margin+col*s.cx, margin+row*s.cy+infoheight);
+ CRect r(p, s);
+ r.DeflateRect(margin, margin);
+
+ CRenderedTextSubtitle rts(&csSubLock);
+ rts.CreateDefaultStyle(0);
+ rts.m_dstScreenSize.SetSize(width, height);
+ STSStyle* style = new STSStyle();
+ style->marginRect.SetRectEmpty();
+ rts.AddStyle(_T("thumbs"), style);
+
+ CStringW str;
+ str.Format(L"{\\an7\\1c&Hffffff&\\4a&Hb0&\\bord1\\shad4\\be1}{\\p1}m %d %d l %d %d %d %d %d %d{\\p}",
+ r.left, r.top, r.right, r.top, r.right, r.bottom, r.left, r.bottom);
+ rts.Add(str, true, 0, 1, _T("thumbs"));
+ str.Format(L"{\\an3\\1c&Hffffff&\\3c&H000000&\\alpha&H80&\\fs16\\b1\\bord2\\shad0\\pos(%d,%d)}%02d:%02d:%02d",
+ r.right-5, r.bottom-3, hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
+ rts.Add(str, true, 1, 2, _T("thumbs"));
+
+ rts.Render(spd, 0, 25, bbox);
+
+ BYTE* pData = NULL;
+ long size = 0;
+ if(!GetDIB(&pData, size)) return;
+
+ BITMAPINFO* bi = (BITMAPINFO*)pData;
+
+ if(bi->bmiHeader.biBitCount != 32)
+ {
+ delete [] pData;
+ CString str;
+ str.Format(_T("Invalid image format, cannot create thumbnails out of %d bpp dibs."), bi->bmiHeader.biBitCount);
+ AfxMessageBox(str);
+ return;
+ }
+
+ int sw = bi->bmiHeader.biWidth;
+ int sh = abs(bi->bmiHeader.biHeight);
+ int sp = sw*4;
+ const BYTE* src = pData + sizeof(bi->bmiHeader);
+ if(bi->bmiHeader.biHeight >= 0) {src += sp*(sh-1); sp = -sp;}
+
+ int dw = spd.w;
+ int dh = spd.h;
+ int dp = spd.pitch;
+ BYTE* dst = (BYTE*)spd.bits + spd.pitch*r.top + r.left*4;
+
+ for(DWORD h = r.bottom - r.top, y = 0, yd = (sh<<8)/h; h > 0; y += yd, h--)
+ {
+ DWORD yf = y&0xff;
+ DWORD yi = y>>8;
+
+ DWORD* s0 = (DWORD*)(src + yi*sp);
+ DWORD* s1 = (DWORD*)(src + yi*sp + sp);
+ DWORD* d = (DWORD*)dst;
+
+ for(DWORD w = r.right - r.left, x = 0, xd = (sw<<8)/w; w > 0; x += xd, w--)
+ {
+ DWORD xf = x&0xff;
+ DWORD xi = x>>8;
+
+ DWORD c0 = s0[xi];
+ DWORD c1 = s0[xi+1];
+ DWORD c2 = s1[xi];
+ DWORD c3 = s1[xi+1];
+
+ c0 = ((c0&0xff00ff) + ((((c1&0xff00ff) - (c0&0xff00ff)) * xf) >> 8)) & 0xff00ff
+ | ((c0&0x00ff00) + ((((c1&0x00ff00) - (c0&0x00ff00)) * xf) >> 8)) & 0x00ff00;
+
+ c2 = ((c2&0xff00ff) + ((((c3&0xff00ff) - (c2&0xff00ff)) * xf) >> 8)) & 0xff00ff
+ | ((c2&0x00ff00) + ((((c3&0x00ff00) - (c2&0x00ff00)) * xf) >> 8)) & 0x00ff00;
+
+ c0 = ((c0&0xff00ff) + ((((c2&0xff00ff) - (c0&0xff00ff)) * yf) >> 8)) & 0xff00ff
+ | ((c0&0x00ff00) + ((((c2&0x00ff00) - (c0&0x00ff00)) * yf) >> 8)) & 0x00ff00;
+
+ *d++ = c0;
+ }
+
+ dst += dp;
+ }
+
+ rts.Render(spd, 10000, 25, bbox);
+
+ delete [] pData;
+ }
+
+ {
+ CRenderedTextSubtitle rts(&csSubLock);
+ rts.CreateDefaultStyle(0);
+ rts.m_dstScreenSize.SetSize(width, height);
+ STSStyle* style = new STSStyle();
+ style->marginRect.SetRect(margin*2, margin*2, margin*2, height-infoheight-margin);
+ rts.AddStyle(_T("thumbs"), style);
+
+ CStringW str;
+ str.Format(L"{\\an9\\fs%d\\b1\\bord0\\shad0\\1c&Hffffff&}%s", infoheight-10, width >= 550 ? L"Media Player Classic" : L"MPC");
+
+ rts.Add(str, true, 0, 1, _T("thumbs"), _T(""), _T(""), CRect(0,0,0,0), -1);
+
+ DVD_HMSF_TIMECODE hmsf = RT2HMSF(rtDur, 25);
+
+ CPath path(m_wndPlaylistBar.GetCur());
+ path.StripPath();
+ CStringW fn = (LPCTSTR)path;
+
+ CStringW fs;
+ WIN32_FIND_DATA wfd;
+ HANDLE hFind = FindFirstFile(m_wndPlaylistBar.GetCur(), &wfd);
+ if(hFind != INVALID_HANDLE_VALUE)
+ {
+ FindClose(hFind);
+
+ __int64 size = (__int64(wfd.nFileSizeHigh)<<32)|wfd.nFileSizeLow;
+ __int64 shortsize = size;
+ CStringW measure = _T("B");
+ if(shortsize > 10240) shortsize /= 1024, measure = L"KB";
+ if(shortsize > 10240) shortsize /= 1024, measure = L"MB";
+ if(shortsize > 10240) shortsize /= 1024, measure = L"GB";
+ fs.Format(L"File Size: %I64d%s (%I64d bytes)\\N", shortsize, measure, size);
+ }
+
+ CStringW ar;
+ if(arxy.cx > 0 && arxy.cy > 0 && arxy.cx != wh.cx && arxy.cy != wh.cy)
+ ar.Format(L"(%d:%d)", arxy.cx, arxy.cy);
+
+ str.Format(L"{\\an7\\1c&H000000&\\fs16\\b0\\bord0\\shad0}File Name: %s\\N%sResolution: %dx%d %s\\NDuration: %02d:%02d:%02d",
+ fn, fs, wh.cx, wh.cy, ar, hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
+ rts.Add(str, true, 0, 1, _T("thumbs"));
+
+ rts.Render(spd, 0, 25, bbox);
+ }
+
+ SaveDIB(fn, (BYTE*)dib, dibsize);
+
+ SeekTo(rtPos);
+}
+
+static CString MakeSnapshotFileName(LPCTSTR prefix)
+{
+ CTime t = CTime::GetCurrentTime();
+ CString fn;
+ fn.Format(_T("%s%s%s"), prefix, t.Format(_T("%Y%m%d%H%M%S")), AfxGetAppSettings().SnapShotExt);
+ return fn;
+}
+
+void CMainFrame::OnFileSaveImage()
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ CPath psrc(s.SnapShotPath);
+ psrc.Combine(s.SnapShotPath, MakeSnapshotFileName(_T("snapshot")));
+
+ CFileDialog fd(FALSE, 0, (LPCTSTR)psrc,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
+ _T("Bitmaps (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg||"), this, 0);
+
+ if(s.SnapShotExt == _T(".bmp")) fd.m_pOFN->nFilterIndex = 1;
+ else if(s.SnapShotExt == _T(".jpg")) fd.m_pOFN->nFilterIndex = 2;
+
+ if(fd.DoModal() != IDOK) return;
+
+ if(fd.m_pOFN->nFilterIndex == 1) s.SnapShotExt = _T(".bmp");
+ else if(fd.m_pOFN->nFilterIndex = 2) s.SnapShotExt = _T(".jpg");
+
+ CPath pdst(fd.GetPathName());
+ if(pdst.GetExtension().MakeLower() != s.SnapShotExt) pdst = CPath((LPCTSTR)pdst + s.SnapShotExt);
+ CString path = (LPCTSTR)pdst;
+ pdst.RemoveFileSpec();
+ s.SnapShotPath = (LPCTSTR)pdst;
+
+ SaveImage(path);
+}
+
+void CMainFrame::OnFileSaveImageAuto()
+{
+ CString fn;
+ fn.Format(_T("%s\\%s"), AfxGetAppSettings().SnapShotPath, MakeSnapshotFileName(_T("snapshot")));
+ SaveImage(fn);
+}
+
+void CMainFrame::OnUpdateFileSaveImage(CCmdUI* pCmdUI)
+{
+ OAFilterState fs = GetMediaState();
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && (fs == State_Paused || fs == State_Running));
+}
+
+void CMainFrame::OnFileSaveThumbnails()
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ CPath psrc(s.SnapShotPath);
+ psrc.Combine(s.SnapShotPath, MakeSnapshotFileName(_T("thumbs")));
+
+ CSaveThumbnailsDialog fd(
+ s.ThumbRows, s.ThumbCols, s.ThumbWidth,
+ 0, (LPCTSTR)psrc,
+ _T("Bitmaps (*.bmp)|*.bmp|Jpeg (*.jpg)|*.jpg||"), this);
+
+ if(s.SnapShotExt == _T(".bmp")) fd.m_pOFN->nFilterIndex = 1;
+ else if(s.SnapShotExt == _T(".jpg")) fd.m_pOFN->nFilterIndex = 2;
+
+ if(fd.DoModal() != IDOK) return;
+
+ if(fd.m_pOFN->nFilterIndex == 1) s.SnapShotExt = _T(".bmp");
+ else if(fd.m_pOFN->nFilterIndex = 2) s.SnapShotExt = _T(".jpg");
+
+ s.ThumbRows = fd.m_rows;
+ s.ThumbCols = fd.m_cols;
+ s.ThumbWidth = fd.m_width;
+
+ CPath pdst(fd.GetPathName());
+ if(pdst.GetExtension().MakeLower() != s.SnapShotExt) pdst = CPath((LPCTSTR)pdst + s.SnapShotExt);
+ CString path = (LPCTSTR)pdst;
+ pdst.RemoveFileSpec();
+ s.SnapShotPath = (LPCTSTR)pdst;
+
+ SaveThumbnails(path);
+}
+
+void CMainFrame::OnUpdateFileSaveThumbnails(CCmdUI* pCmdUI)
+{
+ OAFilterState fs = GetMediaState();
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && (m_iPlaybackMode == PM_FILE /*|| m_iPlaybackMode == PM_DVD*/));
+}
+
+void CMainFrame::OnFileConvert()
+{
+ CConvertDlg().DoModal();
+}
+
+void CMainFrame::OnUpdateFileConvert(CCmdUI* pCmdUI)
+{
+ // TODO: Add your command update UI handler code here
+}
+
+void CMainFrame::OnFileLoadsubtitle()
+{
+ if(!m_pCAP)
+ {
+ AfxMessageBox(_T("To load subtitles you have change the video renderer type and reopen the file.\n")
+ _T("- DirectShow: VMR7/VMR9 renderless or Haali's\n")
+ _T("- RealMedia: Special renderer for RealMedia, or open it through DirectShow\n")
+ _T("- Quicktime: DX7 or DX9 renderer for QuickTime\n")
+ _T("- ShockWave: n/a\n")
+ , MB_OK);
+ return;
+ }
+
+ static TCHAR BASED_CODE szFilter[] =
+ _T(".srt .sub .ssa .ass .smi .psb .txt .idx .usf .xss|")
+ _T("*.srt;*.sub;*.ssa;*.ass;*smi;*.psb;*.txt;*.idx;*.usf;*.xss||");
+
+ CFileDialog fd(TRUE, NULL, NULL,
+ OFN_EXPLORER | OFN_ENABLESIZING | OFN_HIDEREADONLY,
+ szFilter, this, 0);
+
+ if(fd.DoModal() != IDOK) return;
+
+ if(LoadSubtitle(fd.GetPathName()))
+ SetSubtitle(m_pSubStreams.GetTail());
+}
+
+void CMainFrame::OnUpdateFileLoadsubtitle(CCmdUI *pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && /*m_pCAP &&*/ !m_fAudioOnly);
+}
+
+void CMainFrame::OnFileSavesubtitle()
+{
+ int i = m_iSubtitleSel;
+
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos && i >= 0)
+ {
+ CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
+
+ if(i < pSubStream->GetStreamCount())
+ {
+ CLSID clsid;
+ if(FAILED(pSubStream->GetClassID(&clsid)))
+ continue;
+
+ if(clsid == __uuidof(CVobSubFile))
+ {
+ CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)pSubStream;
+
+ CFileDialog fd(FALSE, NULL, NULL,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
+ _T("VobSub (*.idx, *.sub)|*.idx;*.sub||"), this, 0);
+
+ if(fd.DoModal() == IDOK)
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+ pVSF->Save(fd.GetPathName());
+ }
+
+ return;
+ }
+ else if(clsid == __uuidof(CRenderedTextSubtitle))
+ {
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
+
+ CString filter;
+ filter += _T("Subripper (*.srt)|*.srt|");
+ filter += _T("Microdvd (*.sub)|*.sub|");
+ filter += _T("Sami (*.smi)|*.smi|");
+ filter += _T("Psb (*.psb)|*.psb|");
+ filter += _T("Sub Station Alpha (*.ssa)|*.ssa|");
+ filter += _T("Advanced Sub Station Alpha (*.ass)|*.ass|");
+ filter += _T("|");
+
+ CSaveTextFileDialog fd(pRTS->m_encoding, NULL, NULL, filter, this);
+
+ if(fd.DoModal() == IDOK)
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+ pRTS->SaveAs(fd.GetPathName(), (exttype)(fd.m_ofn.nFilterIndex-1), m_pCAP->GetFPS(), fd.GetEncoding());
+ }
+
+ return;
+ }
+ }
+
+ i -= pSubStream->GetStreamCount();
+ }
+}
+
+void CMainFrame::OnUpdateFileSavesubtitle(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iSubtitleSel >= 0);
+}
+
+///////////////
+
+#include "SubtitleDlDlg.h"
+#include "ISDb.h"
+
+void CMainFrame::OnFileISDBSearch()
+{
+ CStringA url = "http://" + AfxGetAppSettings().ISDb + "/index.php?";
+ CStringA args = makeargs(m_wndPlaylistBar.m_pl);
+ ShellExecute(m_hWnd, _T("open"), CString(url+args), NULL, NULL, SW_SHOWDEFAULT);
+}
+
+void CMainFrame::OnUpdateFileISDBSearch(CCmdUI *pCmdUI)
+{
+ pCmdUI->Enable(TRUE);
+}
+
+void CMainFrame::OnFileISDBUpload()
+{
+ CStringA url = "http://" + AfxGetAppSettings().ISDb + "/ul.php?";
+ CStringA args = makeargs(m_wndPlaylistBar.m_pl);
+ ShellExecute(m_hWnd, _T("open"), CString(url+args), NULL, NULL, SW_SHOWDEFAULT);
+}
+
+void CMainFrame::OnUpdateFileISDBUpload(CCmdUI *pCmdUI)
+{
+ pCmdUI->Enable(m_wndPlaylistBar.GetCount() > 0);
+}
+
+void CMainFrame::OnFileISDBDownload()
+{
+ filehash fh;
+ if(!hash(m_wndPlaylistBar.GetCur(), fh))
+ {
+ MessageBeep(-1);
+ return;
+ }
+
+ // TODO: put this on a worker thread
+
+ CStringA url = "http://" + AfxGetAppSettings().ISDb + "/index.php?";
+ CStringA args;
+ args.Format("player=mpc&name[0]=%s&size[0]=%016I64x&hash[0]=%016I64x",
+ UrlEncode(CStringA(fh.name)), fh.size, fh.hash);
+
+ try
+ {
+ CInternetSession is;
+
+ CStringA str;
+ if(!OpenUrl(is, CString(url+args), str))
+ {
+ MessageBeep(-1);
+ return;
+ }
+
+ CStringA ticket;
+ CList<isdb_movie> movies;
+ isdb_movie m;
+ isdb_subtitle s;
+
+ CAtlList<CStringA> sl;
+ Explode(str, sl, '\n');
+
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ str = sl.GetNext(pos);
+
+ CStringA param = str.Left(max(0, str.Find('=')));
+ CStringA value = str.Mid(str.Find('=')+1);
+
+ if(param == "ticket") ticket = value;
+ else if(param == "movie") {m.reset(); Explode(value, m.titles, '|');}
+ else if(param == "subtitle") {s.reset(); s.id = atoi(value);}
+ else if(param == "name") s.name = value;
+ else if(param == "discs") s.discs = atoi(value);
+ else if(param == "disc_no") s.disc_no = atoi(value);
+ else if(param == "format") s.format = value;
+ else if(param == "iso639_2") s.iso639_2 = value;
+ else if(param == "language") s.language = value;
+ else if(param == "nick") s.nick = value;
+ else if(param == "email") s.email = value;
+ else if(param == "" && value == "endsubtitle") {m.subs.AddTail(s);}
+ else if(param == "" && value == "endmovie") {movies.AddTail(m);}
+ else if(param == "" && value == "end") break;
+ }
+
+ CSubtitleDlDlg dlg(movies, this);
+ if(IDOK == dlg.DoModal())
+ {
+ if(dlg.m_fReplaceSubs)
+ m_pSubStreams.RemoveAll();
+
+ CComPtr<ISubStream> pSubStreamToSet;
+
+ POSITION pos = dlg.m_selsubs.GetHeadPosition();
+ while(pos)
+ {
+ isdb_subtitle& s = dlg.m_selsubs.GetNext(pos);
+
+ CStringA url = "http://" + AfxGetAppSettings().ISDb + "/dl.php?";
+ CStringA args;
+ args.Format("id=%d&ticket=%s", s.id, UrlEncode(ticket));
+
+ if(OpenUrl(is, CString(url+args), str))
+ {
+ CAutoPtr<CRenderedTextSubtitle> pRTS(new CRenderedTextSubtitle(&m_csSubLock));
+ if(pRTS && pRTS->Open((BYTE*)(LPCSTR)str, str.GetLength(), DEFAULT_CHARSET, CString(s.name)) && pRTS->GetStreamCount() > 0)
+ {
+ CComPtr<ISubStream> pSubStream = pRTS.Detach();
+ m_pSubStreams.AddTail(pSubStream);
+ if(!pSubStreamToSet) pSubStreamToSet = pSubStream;
+ }
+ }
+ }
+
+ if(pSubStreamToSet)
+ SetSubtitle(pSubStreamToSet);
+ }
+ }
+ catch(CInternetException* ie)
+ {
+ ie->Delete();
+ return;
+ }
+}
+
+void CMainFrame::OnUpdateFileISDBDownload(CCmdUI *pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && m_pCAP && !m_fAudioOnly);
+}
+
+void CMainFrame::OnFileProperties()
+{
+ CPPageFileInfoSheet m_fileinfo(m_wndPlaylistBar.GetCur(), this);
+ m_fileinfo.DoModal();
+}
+
+void CMainFrame::OnUpdateFileProperties(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && m_iPlaybackMode == PM_FILE);
+}
+
+void CMainFrame::OnFileCloseMedia()
+{
+ CloseMedia();
+}
+
+void CMainFrame::OnUpdateViewTearingTest(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable (TRUE);
+}
+
+void CMainFrame::OnViewTearingTest()
+{
+ AfxGetMyApp()->m_fTearingTest = ! AfxGetMyApp()->m_fTearingTest;
+}
+
+void CMainFrame::OnUpdateViewRemainingTime(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable (m_iMediaLoadState != MLS_CLOSED);
+}
+
+void CMainFrame::OnViewRemainingTime()
+{
+ m_bRemainingTime = !m_bRemainingTime;
+ if (!m_bRemainingTime) m_OSD.ClearMessage();
+}
+
+void CMainFrame::OnUpdateShaderToggle(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable (TRUE);
+}
+
+void CMainFrame::OnShaderToggle()
+{
+ static bool bToggleShader = false;
+
+ if (bToggleShader)
+ {
+ SetShaders();
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, _T("Pixel Shader on"));
+ }
+ else
+ {
+ m_pCAP->SetPixelShader(NULL, NULL);
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, _T("Pixel Shader off"));
+ }
+
+ bToggleShader = !bToggleShader;
+}
+
+void CMainFrame::OnFileClosePlaylist()
+{
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+ RestoreDefaultWindowRect();
+}
+
+void CMainFrame::OnUpdateFileClose(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED || m_iMediaLoadState == MLS_LOADING);
+}
+
+// view
+
+void CMainFrame::OnViewCaptionmenu()
+{
+ bool fHideCaptionMenu = AfxGetAppSettings().fHideCaptionMenu;
+
+ AfxGetAppSettings().fHideCaptionMenu = !fHideCaptionMenu;
+
+ if(m_fFullScreen) return;
+
+ DWORD dwRemove = 0, dwAdd = 0;
+ HMENU hMenu;
+
+ if(!fHideCaptionMenu)
+ {
+ dwRemove = WS_CAPTION;
+ hMenu = NULL;
+ }
+ else
+ {
+ dwAdd = WS_CAPTION;
+ hMenu = m_hMenuDefault;
+ }
+
+ ModifyStyle(dwRemove, dwAdd, SWP_NOZORDER);
+ ::SetMenu(m_hWnd, hMenu);
+ SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
+
+ MoveVideoWindow();
+}
+
+void CMainFrame::OnUpdateViewCaptionmenu(CCmdUI* pCmdUI)
+{
+ pCmdUI->SetCheck(!AfxGetAppSettings().fHideCaptionMenu);
+}
+
+void CMainFrame::OnViewControlBar(UINT nID)
+{
+ nID -= ID_VIEW_SEEKER;
+ ShowControls(AfxGetAppSettings().nCS ^ (1<<nID));
+}
+
+void CMainFrame::OnUpdateViewControlBar(CCmdUI* pCmdUI)
+{
+ UINT nID = pCmdUI->m_nID - ID_VIEW_SEEKER;
+ pCmdUI->SetCheck(!!(AfxGetAppSettings().nCS & (1<<nID)));
+}
+
+
+void CMainFrame::OnViewSubresync()
+{
+ ShowControlBar(&m_wndSubresyncBar, !m_wndSubresyncBar.IsWindowVisible(), TRUE);
+}
+
+void CMainFrame::OnUpdateViewSubresync(CCmdUI* pCmdUI)
+{
+ pCmdUI->SetCheck(m_wndSubresyncBar.IsWindowVisible());
+ pCmdUI->Enable(m_pCAP && m_iSubtitleSel >= 0);
+}
+
+void CMainFrame::OnViewPlaylist()
+{
+ ShowControlBar(&m_wndPlaylistBar, !m_wndPlaylistBar.IsWindowVisible(), TRUE);
+}
+
+void CMainFrame::OnUpdateViewPlaylist(CCmdUI* pCmdUI)
+{
+ pCmdUI->SetCheck(m_wndPlaylistBar.IsWindowVisible());
+ pCmdUI->Enable(m_iMediaLoadState == MLS_CLOSED && m_iMediaLoadState != MLS_LOADED
+ || m_iMediaLoadState == MLS_LOADED /*&& (m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE)*/);
+}
+
+void CMainFrame::OnViewCapture()
+{
+ ShowControlBar(&m_wndCaptureBar, !m_wndCaptureBar.IsWindowVisible(), TRUE);
+}
+
+void CMainFrame::OnUpdateViewCapture(CCmdUI* pCmdUI)
+{
+ pCmdUI->SetCheck(m_wndCaptureBar.IsWindowVisible());
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && m_iPlaybackMode == PM_CAPTURE);
+}
+
+void CMainFrame::OnViewShaderEditor()
+{
+ ShowControlBar(&m_wndShaderEditorBar, !m_wndShaderEditorBar.IsWindowVisible(), TRUE);
+}
+
+void CMainFrame::OnUpdateViewShaderEditor(CCmdUI* pCmdUI)
+{
+ pCmdUI->SetCheck(m_wndShaderEditorBar.IsWindowVisible());
+ pCmdUI->Enable(TRUE);
+}
+
+void CMainFrame::OnViewMinimal()
+{
+ if(!AfxGetAppSettings().fHideCaptionMenu)
+ SendMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU);
+ ShowControls(0);
+}
+
+void CMainFrame::OnUpdateViewMinimal(CCmdUI* pCmdUI)
+{
+}
+
+void CMainFrame::OnViewCompact()
+{
+ if(AfxGetAppSettings().fHideCaptionMenu)
+ SendMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU);
+ ShowControls(CS_TOOLBAR);
+}
+
+void CMainFrame::OnUpdateViewCompact(CCmdUI* pCmdUI)
+{
+}
+
+void CMainFrame::OnViewNormal()
+{
+ if(AfxGetAppSettings().fHideCaptionMenu)
+ SendMessage(WM_COMMAND, ID_VIEW_CAPTIONMENU);
+ ShowControls(CS_SEEKBAR|CS_TOOLBAR|CS_STATUSBAR|CS_INFOBAR);
+}
+
+void CMainFrame::OnUpdateViewNormal(CCmdUI* pCmdUI)
+{
+}
+
+void CMainFrame::OnViewFullscreen()
+{
+ ToggleFullscreen(true, true);
+}
+
+void CMainFrame::OnViewFullscreenSecondary()
+{
+ ToggleFullscreen(true, false);
+}
+
+void CMainFrame::OnUpdateViewFullscreen(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly || m_fFullScreen);
+ pCmdUI->SetCheck(m_fFullScreen);
+}
+
+void CMainFrame::OnViewZoom(UINT nID)
+{
+ ZoomVideoWindow(nID == ID_VIEW_ZOOM_50 ? 0.5 : nID == ID_VIEW_ZOOM_200 ? 2.0 : 1.0);
+}
+
+void CMainFrame::OnUpdateViewZoom(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly);
+}
+
+void CMainFrame::OnViewZoomAutoFit()
+{
+ ZoomVideoWindow(GetZoomAutoFitScale());
+}
+
+void CMainFrame::OnViewDefaultVideoFrame(UINT nID)
+{
+ AfxGetAppSettings().iDefaultVideoSize = nID - ID_VIEW_VF_HALF;
+ m_ZoomX = m_ZoomY = 1;
+ m_PosX = m_PosY = 0.5;
+ MoveVideoWindow();
+}
+
+void CMainFrame::OnUpdateViewDefaultVideoFrame(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly);
+ pCmdUI->SetRadio(AfxGetAppSettings().iDefaultVideoSize == (pCmdUI->m_nID - ID_VIEW_VF_HALF));
+}
+
+void CMainFrame::OnViewKeepaspectratio()
+{
+ AfxGetAppSettings().fKeepAspectRatio = !AfxGetAppSettings().fKeepAspectRatio;
+ MoveVideoWindow();
+}
+
+void CMainFrame::OnUpdateViewKeepaspectratio(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly);
+ pCmdUI->SetCheck(AfxGetAppSettings().fKeepAspectRatio);
+}
+
+void CMainFrame::OnViewCompMonDeskARDiff()
+{
+ AfxGetAppSettings().fCompMonDeskARDiff = !AfxGetAppSettings().fCompMonDeskARDiff;
+ MoveVideoWindow();
+}
+
+void CMainFrame::OnUpdateViewCompMonDeskARDiff(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly);
+ pCmdUI->SetCheck(AfxGetAppSettings().fCompMonDeskARDiff);
+}
+
+void CMainFrame::OnViewPanNScan(UINT nID)
+{
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ int x = 0, y = 0;
+ int dx = 0, dy = 0;
+
+ switch(nID)
+ {
+ case ID_VIEW_RESET: m_ZoomX = m_ZoomY = 1.0; m_PosX = m_PosY = 0.5; m_AngleX = m_AngleY = m_AngleZ = 0; break;
+ case ID_VIEW_INCSIZE: x = y = 1; break;
+ case ID_VIEW_DECSIZE: x = y = -1; break;
+ case ID_VIEW_INCWIDTH: x = 1; break;
+ case ID_VIEW_DECWIDTH: x = -1; break;
+ case ID_VIEW_INCHEIGHT: y = 1; break;
+ case ID_VIEW_DECHEIGHT: y = -1; break;
+ case ID_PANSCAN_CENTER: m_PosX = m_PosY = 0.5; break;
+ case ID_PANSCAN_MOVELEFT: dx = -1; break;
+ case ID_PANSCAN_MOVERIGHT: dx = 1; break;
+ case ID_PANSCAN_MOVEUP: dy = -1; break;
+ case ID_PANSCAN_MOVEDOWN: dy = 1; break;
+ case ID_PANSCAN_MOVEUPLEFT: dx = dy = -1; break;
+ case ID_PANSCAN_MOVEUPRIGHT: dx = 1; dy = -1; break;
+ case ID_PANSCAN_MOVEDOWNLEFT: dx = -1; dy = 1; break;
+ case ID_PANSCAN_MOVEDOWNRIGHT: dx = dy = 1; break;
+ default: break;
+ }
+
+ if(x > 0 && m_ZoomX < 3) m_ZoomX *= 1.02;
+ if(x < 0 && m_ZoomX > 0.2) m_ZoomX /= 1.02;
+ if(y > 0 && m_ZoomY < 3) m_ZoomY *= 1.02;
+ if(y < 0 && m_ZoomY > 0.2) m_ZoomY /= 1.02;
+
+ if(dx < 0 && m_PosX > 0) m_PosX = max(m_PosX - 0.005*m_ZoomX, 0);
+ if(dx > 0 && m_PosX < 1) m_PosX = min(m_PosX + 0.005*m_ZoomX, 1);
+ if(dy < 0 && m_PosY > 0) m_PosY = max(m_PosY - 0.005*m_ZoomY, 0);
+ if(dy > 0 && m_PosY < 1) m_PosY = min(m_PosY + 0.005*m_ZoomY, 1);
+
+ MoveVideoWindow(true);
+}
+
+void CMainFrame::OnUpdateViewPanNScan(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly);
+}
+
+void CMainFrame::OnViewPanNScanPresets(UINT nID)
+{
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ nID -= ID_PANNSCAN_PRESETS_START;
+
+ if(nID == s.m_pnspresets.GetCount())
+ {
+ CPnSPresetsDlg dlg;
+ dlg.m_pnspresets.Copy(s.m_pnspresets);
+ if(dlg.DoModal() == IDOK)
+ {
+ s.m_pnspresets.Copy(dlg.m_pnspresets);
+ s.UpdateData(true);
+ }
+ return;
+ }
+
+ m_PosX = 0.5;
+ m_PosY = 0.5;
+ m_ZoomX = 1.0;
+ m_ZoomY = 1.0;
+
+ CString str = s.m_pnspresets[nID];
+
+ int i = 0, j = 0;
+ for(CString token = str.Tokenize(_T(","), i); !token.IsEmpty(); token = str.Tokenize(_T(","), i), j++)
+ {
+ float f = 0;
+ if(_stscanf(token, _T("%f"), &f) != 1) continue;
+
+ switch(j)
+ {
+ case 0: break;
+ case 1: m_PosX = f; break;
+ case 2: m_PosY = f; break;
+ case 3: m_ZoomX = f; break;
+ case 4: m_ZoomY = f; break;
+ default: break;
+ }
+ }
+
+ if(j != 5) return;
+
+ m_PosX = min(max(m_PosX, 0), 1);
+ m_PosY = min(max(m_PosY, 0), 1);
+ m_ZoomX = min(max(m_ZoomX, 0.2), 3);
+ m_ZoomY = min(max(m_ZoomY, 0.2), 3);
+
+ MoveVideoWindow(true);
+}
+
+void CMainFrame::OnUpdateViewPanNScanPresets(CCmdUI* pCmdUI)
+{
+ int nID = pCmdUI->m_nID - ID_PANNSCAN_PRESETS_START;
+ AppSettings& s = AfxGetAppSettings();
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && nID >= 0 && nID <= s.m_pnspresets.GetCount());
+}
+
+void CMainFrame::OnViewRotate(UINT nID)
+{
+ if(!m_pCAP) return;
+
+ switch(nID)
+ {
+ case ID_PANSCAN_ROTATEXP: m_AngleX += 2; break;
+ case ID_PANSCAN_ROTATEXM: m_AngleX -= 2; break;
+ case ID_PANSCAN_ROTATEYP: m_AngleY += 2; break;
+ case ID_PANSCAN_ROTATEYM: m_AngleY -= 2; break;
+ case ID_PANSCAN_ROTATEZP: m_AngleZ += 2; break;
+ case ID_PANSCAN_ROTATEZM: m_AngleZ -= 2; break;
+ default: return;
+ }
+
+ m_pCAP->SetVideoAngle(Vector(DegToRad(m_AngleX), DegToRad(m_AngleY), DegToRad(m_AngleZ)));
+
+ CString info;
+ info.Format(_T("x: %d, y: %d, z: %d"), m_AngleX, m_AngleY, m_AngleZ);
+ SendStatusMessage(info, 3000);
+}
+
+void CMainFrame::OnUpdateViewRotate(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && m_pCAP);
+}
+
+// FIXME
+const static SIZE s_ar[] = {{0,0}, {4,3}, {5,4}, {16,9}};
+
+void CMainFrame::OnViewAspectRatio(UINT nID)
+{
+ CSize& ar = AfxGetAppSettings().AspectRatio;
+
+ ar = s_ar[nID - ID_ASPECTRATIO_START];
+
+ CString info;
+ if(ar.cx && ar.cy) info.Format(_T("Aspect Ratio: %d:%d"), ar.cx, ar.cy);
+ else info.Format(_T("Aspect Ratio: Default"));
+ SendStatusMessage(info, 3000);
+
+ MoveVideoWindow();
+}
+
+void CMainFrame::OnUpdateViewAspectRatio(CCmdUI* pCmdUI)
+{
+ pCmdUI->SetRadio(AfxGetAppSettings().AspectRatio == s_ar[pCmdUI->m_nID - ID_ASPECTRATIO_START]);
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly);
+}
+
+void CMainFrame::OnViewAspectRatioNext()
+{
+ CSize& ar = AfxGetAppSettings().AspectRatio;
+
+ UINT nID = ID_ASPECTRATIO_START;
+
+ for(int i = 0; i < countof(s_ar); i++)
+ {
+ if(ar == s_ar[i])
+ {
+ nID += (i + 1) % countof(s_ar);
+ break;
+ }
+ }
+
+ OnViewAspectRatio(nID);
+}
+
+void CMainFrame::OnViewOntop(UINT nID)
+{
+ nID -= ID_ONTOP_NEVER;
+ if(AfxGetAppSettings().iOnTop == nID)
+ nID = !nID;
+ SetAlwaysOnTop(nID);
+}
+
+void CMainFrame::OnUpdateViewOntop(CCmdUI* pCmdUI)
+{
+ pCmdUI->SetRadio(AfxGetAppSettings().iOnTop == (pCmdUI->m_nID - ID_ONTOP_NEVER));
+}
+
+void CMainFrame::OnViewOptions()
+{
+ ShowOptions();
+}
+
+// play
+
+#include "IPinHook.h"
+
+void CMainFrame::OnPlayPlay()
+{
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ if(GetMediaState() == State_Stopped) m_iSpeedLevel = 0;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ m_iSpeedLevel = 0;
+ if(m_fEndOfStream) SendMessage(WM_COMMAND, ID_PLAY_STOP);
+ pMS->SetRate (1.0);
+ pMC->Run();
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ double dRate = 1.0;
+ m_iSpeedLevel = 0;
+
+ pDVDC->PlayForwards(dRate, DVD_CMD_FLAG_Block, NULL);
+ pDVDC->Pause(FALSE);
+ pMC->Run();
+ }
+ else if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ pMC->Stop(); // audio preview won't be in sync if we run it from paused state
+ pMC->Run();
+ }
+
+ SetTimer(TIMER_STREAMPOSPOLLER, 40, NULL);
+ SetTimer(TIMER_STREAMPOSPOLLER2, 500, NULL);
+ SetTimer(TIMER_STATS, 1000, NULL);
+
+ if(m_fFrameSteppingActive) // FIXME
+ {
+ m_fFrameSteppingActive = false;
+ pBA->put_Volume(m_VolumeBeforeFrameStepping);
+ }
+
+ SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
+ }
+
+ MoveVideoWindow();
+}
+
+void CMainFrame::OnPlayPause()
+{
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ pMC->Pause();
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ pMC->Pause();
+ }
+ else if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ pMC->Pause();
+ }
+
+ SetTimer(TIMER_STREAMPOSPOLLER, 40, NULL);
+ SetTimer(TIMER_STREAMPOSPOLLER2, 500, NULL);
+ SetTimer(TIMER_STATS, 1000, NULL);
+ }
+
+ MoveVideoWindow();
+}
+
+void CMainFrame::OnPlayPlaypause()
+{
+ OAFilterState fs = GetMediaState();
+ if(fs == State_Running) SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ else if(fs == State_Stopped || fs == State_Paused) SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+}
+
+void CMainFrame::OnPlayStop()
+{
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ LONGLONG pos = 0;
+ pMS->SetPositions(&pos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ pMC->Stop();
+
+ // BUG: after pause or stop the netshow url source filter won't continue
+ // on the next play command, unless we cheat it by setting the file name again.
+ //
+ // Note: WMPx may be using some undocumented interface to restart streaming.
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ CComQIPtr<IAMNetworkStatus, &IID_IAMNetworkStatus> pAMNS = pBF;
+ CComQIPtr<IFileSourceFilter> pFSF = pBF;
+ if(pAMNS && pFSF)
+ {
+ WCHAR* pFN = NULL;
+ AM_MEDIA_TYPE mt;
+ if(SUCCEEDED(pFSF->GetCurFile(&pFN, &mt)) && pFN && *pFN)
+ {
+ pFSF->Load(pFN, NULL);
+ CoTaskMemFree(pFN);
+ }
+ break;
+ }
+ }
+ EndEnumFilters
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ pDVDC->SetOption(DVD_ResetOnStop, TRUE);
+ pMC->Stop();
+ pDVDC->SetOption(DVD_ResetOnStop, FALSE);
+ }
+ else if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ pMC->Stop();
+ }
+
+ m_iSpeedLevel = 0;
+
+ if(m_fFrameSteppingActive) // FIXME
+ {
+ m_fFrameSteppingActive = false;
+ pBA->put_Volume(m_VolumeBeforeFrameStepping);
+ }
+
+ m_fEndOfStream = false;
+ }
+
+ m_nLoops = 0;
+
+ if(m_hWnd)
+ {
+ KillTimer(TIMER_STREAMPOSPOLLER2);
+ KillTimer(TIMER_STREAMPOSPOLLER);
+ KillTimer(TIMER_STATS);
+
+ MoveVideoWindow();
+
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ __int64 start, stop;
+ m_wndSeekBar.GetRange(start, stop);
+ GUID tf;
+ pMS->GetTimeFormat(&tf);
+ m_wndStatusBar.SetStatusTimer(m_wndSeekBar.GetPosReal(), stop, !!m_wndSubresyncBar.IsWindowVisible(), &tf);
+
+ SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
+ }
+ }
+}
+
+void CMainFrame::OnUpdatePlayPauseStop(CCmdUI* pCmdUI)
+{
+ OAFilterState fs = m_fFrameSteppingActive ? State_Paused : GetMediaState();
+
+ pCmdUI->SetCheck(fs == State_Running && pCmdUI->m_nID == ID_PLAY_PLAY
+ || fs == State_Paused && pCmdUI->m_nID == ID_PLAY_PAUSE
+ || fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_STOP
+ || (fs == State_Paused || fs == State_Running) && pCmdUI->m_nID == ID_PLAY_PLAYPAUSE);
+
+ bool fEnable = false;
+
+ if(fs >= 0)
+ {
+ if(m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE)
+ {
+ fEnable = true;
+
+ if(fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_PAUSE && m_fRealMediaGraph) fEnable = false; // can't go into paused state from stopped with rm
+ else if(m_fCapturing) fEnable = false;
+ else if(m_fLiveWM && pCmdUI->m_nID == ID_PLAY_PAUSE) fEnable = false;
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ fEnable = m_iDVDDomain != DVD_DOMAIN_VideoManagerMenu
+ && m_iDVDDomain != DVD_DOMAIN_VideoTitleSetMenu;
+
+ if(fs == State_Stopped && pCmdUI->m_nID == ID_PLAY_PAUSE) fEnable = false;
+ }
+ }
+
+ pCmdUI->Enable(fEnable);
+}
+
+void CMainFrame::OnPlayFramestep(UINT nID)
+{
+ REFERENCE_TIME rt;
+
+ if(pFS && m_fQuicktimeGraph)
+ {
+ if(GetMediaState() != State_Paused)
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+
+ pFS->Step(nID == ID_PLAY_FRAMESTEP ? 1 : -1, NULL);
+ }
+ else if(pFS && nID == ID_PLAY_FRAMESTEP)
+ {
+ if(GetMediaState() != State_Paused)
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+
+ m_fFrameSteppingActive = true;
+
+ m_VolumeBeforeFrameStepping = m_wndToolBar.Volume;
+ pBA->put_Volume(-10000);
+
+ pFS->Step(1, NULL);
+ }
+ else if(S_OK == pMS->IsFormatSupported(&TIME_FORMAT_FRAME))
+ {
+ if(GetMediaState() != State_Paused)
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+
+ pMS->SetTimeFormat(&TIME_FORMAT_FRAME);
+ pMS->GetCurrentPosition(&rt);
+ if(nID == ID_PLAY_FRAMESTEP) rt++;
+ else if(nID == ID_PLAY_FRAMESTEPCANCEL) rt--;
+ pMS->SetPositions(&rt, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ pMS->SetTimeFormat(&TIME_FORMAT_MEDIA_TIME);
+ }
+}
+
+void CMainFrame::OnUpdatePlayFramestep(CCmdUI* pCmdUI)
+{
+ bool fEnable = false;
+
+ if(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly
+ && (m_iPlaybackMode != PM_DVD || m_iDVDDomain == DVD_DOMAIN_Title)
+ && m_iPlaybackMode != PM_CAPTURE
+ && !m_fLiveWM)
+ {
+ REFTIME AvgTimePerFrame = 0;
+ if(S_OK == pMS->IsFormatSupported(&TIME_FORMAT_FRAME)
+ || pCmdUI->m_nID == ID_PLAY_FRAMESTEP && pFS && pFS->CanStep(0, NULL) == S_OK
+ || m_fQuicktimeGraph && pFS)
+ {
+ fEnable = true;
+ }
+ }
+
+ pCmdUI->Enable(fEnable);
+}
+
+void CMainFrame::OnPlaySeek(UINT nID)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ REFERENCE_TIME dt =
+ nID == ID_PLAY_SEEKBACKWARDSMALL ? -10000i64*s.nJumpDistS :
+ nID == ID_PLAY_SEEKFORWARDSMALL ? +10000i64*s.nJumpDistS :
+ nID == ID_PLAY_SEEKBACKWARDMED ? -10000i64*s.nJumpDistM :
+ nID == ID_PLAY_SEEKFORWARDMED ? +10000i64*s.nJumpDistM :
+ nID == ID_PLAY_SEEKBACKWARDLARGE ? -10000i64*s.nJumpDistL :
+ nID == ID_PLAY_SEEKFORWARDLARGE ? +10000i64*s.nJumpDistL :
+ 0;
+
+ if(!dt) return;
+
+ // HACK: the custom graph should support frame based seeking instead
+ if(m_fShockwaveGraph) dt /= 10000i64*100;
+
+ SeekTo(m_wndSeekBar.GetPos() + dt);
+}
+
+static int rangebsearch(REFERENCE_TIME val, CAtlArray<REFERENCE_TIME>& rta)
+{
+ int i = 0, j = rta.GetCount() - 1, ret = -1;
+
+ if(j >= 0 && val >= rta[j]) return(j);
+
+ while(i < j)
+ {
+ int mid = (i + j) >> 1;
+ REFERENCE_TIME midt = rta[mid];
+ if(val == midt) {ret = mid; break;}
+ else if(val < midt) {ret = -1; if(j == mid) mid--; j = mid;}
+ else if(val > midt) {ret = mid; if(i == mid) mid++; i = mid;}
+ }
+
+ return(ret);
+}
+
+void CMainFrame::OnPlaySeekKey(UINT nID)
+{
+ if(m_kfs.GetCount() > 0)
+ {
+ HRESULT hr;
+
+ if(GetMediaState() == State_Stopped)
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+
+ REFERENCE_TIME rtCurrent, rtDur;
+ hr = pMS->GetCurrentPosition(&rtCurrent);
+ hr = pMS->GetDuration(&rtDur);
+
+ int dec = 1;
+ int i = rangebsearch(rtCurrent, m_kfs);
+ if(i > 0) dec = (UINT)max(min(rtCurrent - m_kfs[i-1], 10000000), 0);
+
+ rtCurrent =
+ nID == ID_PLAY_SEEKKEYBACKWARD ? max(rtCurrent - dec, 0) :
+ nID == ID_PLAY_SEEKKEYFORWARD ? rtCurrent : 0;
+
+ i = rangebsearch(rtCurrent, m_kfs);
+
+ if(nID == ID_PLAY_SEEKKEYBACKWARD)
+ rtCurrent = m_kfs[max(i, 0)];
+ else if(nID == ID_PLAY_SEEKKEYFORWARD && i < m_kfs.GetCount()-1)
+ rtCurrent = m_kfs[i+1];
+ else
+ return;
+
+ // HACK: if d3d or something changes fpu control word the values of
+ // m_kfs may be different now (if it was asked again), adding a little
+ // to the seek position eliminates this error usually.
+
+ rtCurrent += 10;
+
+ hr = pMS->SetPositions(
+ &rtCurrent, AM_SEEKING_AbsolutePositioning|AM_SEEKING_SeekToKeyFrame,
+ NULL, AM_SEEKING_NoPositioning);
+ }
+}
+
+void CMainFrame::OnUpdatePlaySeek(CCmdUI* pCmdUI)
+{
+ bool fEnable = false;
+
+ OAFilterState fs = GetMediaState();
+
+ if(m_iMediaLoadState == MLS_LOADED && (fs == State_Paused || fs == State_Running))
+ {
+ fEnable = true;
+ if(m_iPlaybackMode == PM_DVD && (m_iDVDDomain != DVD_DOMAIN_Title || fs != State_Running)) fEnable = false;
+ else if(m_iPlaybackMode == PM_CAPTURE) fEnable = false;
+ }
+
+ pCmdUI->Enable(fEnable);
+}
+
+void CMainFrame::OnPlayGoto()
+{
+ if ((m_iMediaLoadState != MLS_LOADED) || m_bD3DFullscreenMode)
+ return;
+
+ REFTIME atpf = 0;
+ if(FAILED(pBV->get_AvgTimePerFrame(&atpf)) || atpf < 0)
+ {
+ atpf = 0;
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if(atpf > 0) break;
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(atpf > 0) break;
+
+ AM_MEDIA_TYPE mt;
+ pPin->ConnectionMediaType(&mt);
+
+ if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo)
+ {
+ atpf = (REFTIME)((VIDEOINFOHEADER*)mt.pbFormat)->AvgTimePerFrame / 10000000i64;
+ }
+ else if(mt.majortype == MEDIATYPE_Video && mt.formattype == FORMAT_VideoInfo2)
+ {
+ atpf = (REFTIME)((VIDEOINFOHEADER2*)mt.pbFormat)->AvgTimePerFrame / 10000000i64;
+ }
+ }
+ EndEnumPins
+ }
+ EndEnumFilters
+ }
+
+ CGoToDlg dlg((int)(m_wndSeekBar.GetPos()/10000), atpf > 0 ? (float)(1.0/atpf) : 0);
+ if(IDOK != dlg.DoModal() || dlg.m_time < 0) return;
+
+ SeekTo(10000i64 * dlg.m_time);
+}
+
+void CMainFrame::OnUpdateGoto(CCmdUI* pCmdUI)
+{
+ bool fEnable = false;
+
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ fEnable = true;
+ if(m_iPlaybackMode == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) fEnable = false;
+ else if(m_iPlaybackMode == PM_CAPTURE) fEnable = false;
+ }
+
+ pCmdUI->Enable(fEnable);
+}
+
+void CMainFrame::OnPlayChangeRate(UINT nID)
+{
+ if(m_iMediaLoadState != MLS_LOADED)
+ return;
+
+ if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ if(GetMediaState() != State_Running)
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+
+ long lChannelMin = 0, lChannelMax = 0;
+ pAMTuner->ChannelMinMax(&lChannelMin, &lChannelMax);
+ long lChannel = 0, lVivSub = 0, lAudSub = 0;
+ pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub);
+
+ long lFreqOrg = 0, lFreqNew = -1;
+ pAMTuner->get_VideoFrequency(&lFreqOrg);
+
+// long lSignalStrength;
+ do
+ {
+ if(nID == ID_PLAY_DECRATE) lChannel--;
+ else if(nID == ID_PLAY_INCRATE) lChannel++;
+
+// if(lChannel < lChannelMin) lChannel = lChannelMax;
+// if(lChannel > lChannelMax) lChannel = lChannelMin;
+
+ if(lChannel < lChannelMin || lChannel > lChannelMax)
+ break;
+
+ if(FAILED(pAMTuner->put_Channel(lChannel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT)))
+ break;
+
+ long flFoundSignal;
+ pAMTuner->AutoTune(lChannel, &flFoundSignal);
+
+ pAMTuner->get_VideoFrequency(&lFreqNew);
+ }
+ while(FALSE);
+/* SUCCEEDED(pAMTuner->SignalPresent(&lSignalStrength))
+ && (lSignalStrength != AMTUNER_SIGNALPRESENT || lFreqNew == lFreqOrg));*/
+
+ }
+ else
+ {
+ int iNewSpeedLevel;
+
+ if(nID == ID_PLAY_INCRATE) iNewSpeedLevel = m_iSpeedLevel+1;
+ else if(nID == ID_PLAY_DECRATE) iNewSpeedLevel = m_iSpeedLevel-1;
+ else return;
+
+ HRESULT hr = E_FAIL;
+
+ if((iNewSpeedLevel == -4) && (m_iPlaybackMode == PM_FILE))
+ {
+ if(GetMediaState() != State_Paused)
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+
+ if(GetMediaState() == State_Paused) hr = S_OK;
+ }
+ else
+ {
+ double dRate;
+
+ if(GetMediaState() != State_Running)
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ dRate = pow(2.0, iNewSpeedLevel >= -3 ? iNewSpeedLevel : (-iNewSpeedLevel - 8));
+ if(fabs(dRate - 1.0) < 0.01) dRate = 1.0;
+ hr = pMS->SetRate(dRate);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ dRate = pow(2.0, abs(iNewSpeedLevel));
+ if(iNewSpeedLevel >= 0)
+ hr = pDVDC->PlayForwards(dRate, DVD_CMD_FLAG_Block, NULL);
+ else
+ hr = pDVDC->PlayBackwards(dRate, DVD_CMD_FLAG_Block, NULL);
+ }
+
+ if(SUCCEEDED(hr))
+ {
+ CString strMessage;
+ m_iSpeedLevel = iNewSpeedLevel;
+
+ if (dRate == 1.0)
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, _T("Play"));
+ else
+ {
+ strMessage.Format (_T("%s x %.01f"), (iNewSpeedLevel > 0)?_T(">"):_T("<"), fabs(dRate));
+ m_OSD.DisplayMessage (OSD_TOPRIGHT, strMessage);
+ }
+ }
+ }
+
+ }
+}
+
+void CMainFrame::OnUpdatePlayChangeRate(CCmdUI* pCmdUI)
+{
+ bool fEnable = false;
+
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ bool fInc = pCmdUI->m_nID == ID_PLAY_INCRATE;
+
+ fEnable = true;
+ if(fInc && m_iSpeedLevel >= 7) fEnable = false;
+ else if(!fInc && m_iPlaybackMode == PM_FILE && m_iSpeedLevel <= -4) fEnable = false;
+ else if(!fInc && m_iPlaybackMode == PM_DVD && m_iSpeedLevel <= -11) fEnable = false;
+ else if(m_iPlaybackMode == PM_DVD && m_iDVDDomain != DVD_DOMAIN_Title) fEnable = false;
+ else if(m_fRealMediaGraph || m_fShockwaveGraph) fEnable = false;
+ else if(m_iPlaybackMode == PM_CAPTURE && (!m_wndCaptureBar.m_capdlg.IsTunerActive() || m_fCapturing)) fEnable = false;
+ else if(m_fLiveWM) fEnable = false;
+ }
+
+ pCmdUI->Enable(fEnable);
+}
+
+void CMainFrame::OnPlayResetRate()
+{
+ if(m_iMediaLoadState != MLS_LOADED)
+ return;
+
+ HRESULT hr = E_FAIL;
+
+ if(GetMediaState() != State_Running)
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ hr = pMS->SetRate(1.0);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ hr = pDVDC->PlayForwards(1.0, DVD_CMD_FLAG_Block, NULL);
+ }
+
+ if(SUCCEEDED(hr))
+ m_iSpeedLevel = 0;
+}
+
+void CMainFrame::OnUpdatePlayResetRate(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED);
+}
+
+void CMainFrame::OnPlayChangeAudDelay(UINT nID)
+{
+ if(CComQIPtr<IAudioSwitcherFilter> pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB))
+ {
+ REFERENCE_TIME rtShift = pASF->GetAudioTimeShift();
+ rtShift +=
+ nID == ID_PLAY_INCAUDDELAY ? 100000 :
+ nID == ID_PLAY_DECAUDDELAY ? -100000 :
+ 0;
+ pASF->SetAudioTimeShift(rtShift);
+
+ CString str;
+ str.Format(_T("Audio Delay: %I64dms"), rtShift/10000);
+ SendStatusMessage(str, 3000);
+ }
+}
+
+void CMainFrame::OnUpdatePlayChangeAudDelay(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!!pGB /*&& !!FindFilter(__uuidof(CAudioSwitcherFilter), pGB)*/);
+}
+
+void CMainFrame::OnPlayFilters(UINT nID)
+{
+// ShowPPage(m_spparray[nID - ID_FILTERS_SUBITEM_START], m_hWnd);
+
+ CComPtr<IUnknown> pUnk = m_pparray[nID - ID_FILTERS_SUBITEM_START];
+
+ CComPropertySheet ps(ResStr(IDS_PROPSHEET_PROPERTIES), this);
+
+ if(CComQIPtr<ISpecifyPropertyPages> pSPP = pUnk)
+ {
+ ps.AddPages(pSPP);
+ }
+
+ if(CComQIPtr<IBaseFilter> pBF = pUnk)
+ {
+ HRESULT hr;
+ CComPtr<IPropertyPage> pPP = new CInternalPropertyPageTempl<CPinInfoWnd>(NULL, &hr);
+ ps.AddPage(pPP, pBF);
+ }
+
+ if(ps.GetPageCount() > 0)
+ {
+ ps.DoModal();
+ OpenSetupStatusBar();
+ }
+}
+
+void CMainFrame::OnUpdatePlayFilters(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!m_fCapturing);
+}
+
+void CMainFrame::OnPlayShaders(UINT nID)
+{
+ if(nID == ID_SHADERS_START+2)
+ {
+ ShowControlBar(&m_wndShaderEditorBar, TRUE, TRUE);
+ return;
+ }
+
+ if(!m_pCAP) return;
+
+ if(nID == ID_SHADERS_START)
+ {
+ m_shaderlabels.RemoveAll();
+ }
+ else if(nID == ID_SHADERS_START+1)
+ {
+ if(IDOK != CShaderCombineDlg(m_shaderlabels, this).DoModal())
+ return;
+ }
+ else if(nID >= ID_SHADERS_START+3)
+ {
+ MENUITEMINFO mii;
+ memset(&mii, 0, sizeof(mii));
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_DATA;
+ m_shaders.GetMenuItemInfo(nID, &mii);
+
+ m_shaderlabels.RemoveAll();
+ m_shaderlabels.AddTail(((const AppSettings::Shader*)mii.dwItemData)->label);
+ }
+
+ SetShaders();
+}
+
+void CMainFrame::OnUpdatePlayShaders(CCmdUI* pCmdUI)
+{
+ if(pCmdUI->m_nID >= ID_SHADERS_START)
+ {
+ pCmdUI->Enable(!!m_pCAP);
+
+ if(pCmdUI->m_nID == ID_SHADERS_START)
+ {
+ pCmdUI->SetRadio(m_shaderlabels.IsEmpty());
+ }
+ else if(pCmdUI->m_nID == ID_SHADERS_START+1)
+ {
+ pCmdUI->SetRadio(m_shaderlabels.GetCount() > 1);
+ }
+ else if(pCmdUI->m_nID == ID_SHADERS_START+2)
+ {
+ pCmdUI->Enable(TRUE);
+ }
+ else
+ {
+ MENUITEMINFO mii;
+ memset(&mii, 0, sizeof(mii));
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_DATA;
+ m_shaders.GetMenuItemInfo(pCmdUI->m_nID, &mii);
+
+ pCmdUI->SetRadio(m_shaderlabels.GetCount() == 1
+ && m_shaderlabels.GetHead() == ((AppSettings::Shader*)mii.dwItemData)->label);
+ }
+ }
+}
+
+void CMainFrame::OnPlayAudio(UINT nID)
+{
+ int i = (int)nID - (1 + ID_AUDIO_SUBITEM_START);
+
+ CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
+ if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
+
+ if(i == -1)
+ {
+ ShowOptions(CPPageAudioSwitcher::IDD);
+ }
+ else if(i >= 0 && pSS)
+ {
+ pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE);
+ }
+}
+
+void CMainFrame::OnUpdatePlayAudio(CCmdUI* pCmdUI)
+{
+ UINT nID = pCmdUI->m_nID;
+ int i = (int)nID - (1 + ID_AUDIO_SUBITEM_START);
+
+ CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
+ if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
+
+ /*if(i == -1)
+ {
+ // TODO****
+ }
+ else*/ if(i >= 0 && pSS)
+ {
+ DWORD flags = 0;
+
+ if(SUCCEEDED(pSS->Info(i, NULL, &flags, NULL, NULL, NULL, NULL, NULL)))
+ {
+ if(flags&AMSTREAMSELECTINFO_EXCLUSIVE) pCmdUI->SetRadio(TRUE);
+ else if(flags&AMSTREAMSELECTINFO_ENABLED) pCmdUI->SetCheck(TRUE);
+ else pCmdUI->SetCheck(FALSE);
+ }
+ else
+ {
+ pCmdUI->Enable(FALSE);
+ }
+ }
+}
+
+void CMainFrame::OnPlaySubtitles(UINT nID)
+{
+ int i = (int)nID - (4 + ID_SUBTITLES_SUBITEM_START);
+
+ if(i == -4)
+ {
+ ShowOptions(CPPageSubtitles::IDD);
+ }
+ else if(i == -3)
+ {
+ int i = m_iSubtitleSel;
+
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos && i >= 0)
+ {
+ CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
+
+ if(i < pSubStream->GetStreamCount())
+ {
+ CLSID clsid;
+ if(FAILED(pSubStream->GetClassID(&clsid)))
+ continue;
+
+ if(clsid == __uuidof(CRenderedTextSubtitle))
+ {
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
+
+ CAutoPtrArray<CPPageSubStyle> pages;
+ CAtlArray<STSStyle*> styles;
+
+ POSITION pos = pRTS->m_styles.GetStartPosition();
+ for(int i = 0; pos; i++)
+ {
+ CString key;
+ STSStyle* val;
+ pRTS->m_styles.GetNextAssoc(pos, key, val);
+
+ CAutoPtr<CPPageSubStyle> page(new CPPageSubStyle());
+ page->InitStyle(key, *val);
+ pages.Add(page);
+ styles.Add(val);
+ }
+
+ CPropertySheet dlg(_T("Styles..."), this);
+ for(int i = 0; i < (int)pages.GetCount(); i++)
+ dlg.AddPage(pages[i]);
+
+ if(dlg.DoModal() == IDOK)
+ {
+ for(int j = 0; j < (int)pages.GetCount(); j++)
+ pages[j]->GetStyle(*styles[j]);
+ UpdateSubtitle(false);
+ }
+
+ return;
+ }
+ }
+
+ i -= pSubStream->GetStreamCount();
+ }
+ }
+ else if(i == -2)
+ {
+ ReloadSubtitle();
+ }
+ else if(i == -1)
+ {
+ if(m_iSubtitleSel == -1) m_iSubtitleSel = 0;
+ else m_iSubtitleSel ^= (1<<31);
+ UpdateSubtitle();
+ }
+ else if(i >= 0)
+ {
+ m_iSubtitleSel = i;
+ UpdateSubtitle();
+ }
+
+ AfxGetAppSettings().fEnableSubtitles = !(m_iSubtitleSel & 0x80000000);
+}
+
+void CMainFrame::OnUpdatePlaySubtitles(CCmdUI* pCmdUI)
+{
+ UINT nID = pCmdUI->m_nID;
+ int i = (int)nID - (4 + ID_SUBTITLES_SUBITEM_START);
+
+ pCmdUI->Enable(m_pCAP && !m_fAudioOnly);
+
+ if(i == -3)
+ {
+ pCmdUI->Enable(FALSE);
+
+ int i = m_iSubtitleSel;
+
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos && i >= 0)
+ {
+ CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
+
+ if(i < pSubStream->GetStreamCount())
+ {
+ CLSID clsid;
+ if(FAILED(pSubStream->GetClassID(&clsid)))
+ continue;
+
+ if(clsid == __uuidof(CRenderedTextSubtitle))
+ {
+ pCmdUI->Enable(TRUE);
+ break;
+ }
+ }
+
+ i -= pSubStream->GetStreamCount();
+ }
+ }
+ else if(i == -1)
+ {
+ pCmdUI->SetCheck(m_iSubtitleSel >= 0);
+ }
+ else if(i >= 0)
+ {
+ pCmdUI->SetRadio(i == abs(m_iSubtitleSel));
+ }
+}
+
+void CMainFrame::OnPlayLanguage(UINT nID)
+{
+ nID -= ID_FILTERSTREAMS_SUBITEM_START;
+ CComPtr<IAMStreamSelect> pAMSS = m_ssarray[nID];
+ UINT i = nID;
+ while(i > 0 && pAMSS == m_ssarray[i-1]) i--;
+ if(FAILED(pAMSS->Enable(nID-i, AMSTREAMSELECTENABLE_ENABLE)))
+ MessageBeep(-1);
+
+ OpenSetupStatusBar();
+}
+
+void CMainFrame::OnUpdatePlayLanguage(CCmdUI* pCmdUI)
+{
+ UINT nID = pCmdUI->m_nID;
+ nID -= ID_FILTERSTREAMS_SUBITEM_START;
+ CComPtr<IAMStreamSelect> pAMSS = m_ssarray[nID];
+ UINT i = nID;
+ while(i > 0 && pAMSS == m_ssarray[i-1]) i--;
+ DWORD flags = 0;
+ pAMSS->Info(nID-i, NULL, &flags, NULL, NULL, NULL, NULL, NULL);
+ if(flags&AMSTREAMSELECTINFO_EXCLUSIVE) pCmdUI->SetRadio(TRUE);
+ else if(flags&AMSTREAMSELECTINFO_ENABLED) pCmdUI->SetCheck(TRUE);
+ else pCmdUI->SetCheck(FALSE);
+}
+
+void CMainFrame::OnPlayVolume(UINT nID)
+{
+ if(m_iMediaLoadState == MLS_LOADED)
+ pBA->put_Volume(m_wndToolBar.Volume);
+}
+
+void CMainFrame::OnPlayVolumeBoost(UINT nID)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ int i = (int)(50.0f*log10(s.AudioBoost));
+
+ switch(nID)
+ {
+ case ID_VOLUME_BOOST_INC: i = min(i+10, 100); break;
+ case ID_VOLUME_BOOST_DEC: i = max(i-10, 0); break;
+ case ID_VOLUME_BOOST_MIN: i = 0; break;
+ case ID_VOLUME_BOOST_MAX: i = 100; break;
+ }
+
+ s.AudioBoost = pow(10.0f, (float)i/50);
+
+ if(CComQIPtr<IAudioSwitcherFilter> pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pGB))
+ {
+ bool fNormalize, fNormalizeRecover;
+ float boost;
+ pASF->GetNormalizeBoost(fNormalize, fNormalizeRecover, boost);
+ pASF->SetNormalizeBoost(fNormalize, fNormalizeRecover, s.AudioBoost);
+ }
+}
+
+void CMainFrame::OnUpdatePlayVolumeBoost(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable();
+}
+
+void CMainFrame::OnAfterplayback(UINT nID)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ s.nCLSwitches &= ~CLSW_AFTERPLAYBACK_MASK;
+
+ switch(nID)
+ {
+ case ID_AFTERPLAYBACK_CLOSE: s.nCLSwitches |= CLSW_CLOSE; break;
+ case ID_AFTERPLAYBACK_STANDBY: s.nCLSwitches |= CLSW_STANDBY; break;
+ case ID_AFTERPLAYBACK_HIBERNATE: s.nCLSwitches |= CLSW_HIBERNATE; break;
+ case ID_AFTERPLAYBACK_SHUTDOWN: s.nCLSwitches |= CLSW_SHUTDOWN; break;
+ case ID_AFTERPLAYBACK_LOGOFF: s.nCLSwitches |= CLSW_LOGOFF; break;
+ }
+}
+
+void CMainFrame::OnUpdateAfterplayback(CCmdUI* pCmdUI)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ bool fChecked = false;
+
+ switch(pCmdUI->m_nID)
+ {
+ case ID_AFTERPLAYBACK_CLOSE: fChecked = !!(s.nCLSwitches & CLSW_CLOSE); break;
+ case ID_AFTERPLAYBACK_STANDBY: fChecked = !!(s.nCLSwitches & CLSW_STANDBY); break;
+ case ID_AFTERPLAYBACK_HIBERNATE: fChecked = !!(s.nCLSwitches & CLSW_HIBERNATE); break;
+ case ID_AFTERPLAYBACK_SHUTDOWN: fChecked = !!(s.nCLSwitches & CLSW_SHUTDOWN); break;
+ case ID_AFTERPLAYBACK_LOGOFF: fChecked = !!(s.nCLSwitches & CLSW_LOGOFF); break;
+ case ID_AFTERPLAYBACK_DONOTHING: fChecked = !(s.nCLSwitches & CLSW_AFTERPLAYBACK_MASK); break;
+ }
+
+ pCmdUI->SetRadio(fChecked);
+}
+
+// navigate
+
+void CMainFrame::OnNavigateSkip(UINT nID)
+{
+ if(m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE)
+ {
+ if(m_iPlaybackMode == PM_FILE) SetupChapters();
+
+ if(DWORD nChapters = m_pCB->ChapGetCount())
+ {
+ REFERENCE_TIME rtCur;
+ pMS->GetCurrentPosition(&rtCur);
+
+ REFERENCE_TIME rt = rtCur;
+ CComBSTR name;
+ long i;
+
+ if(nID == ID_NAVIGATE_SKIPBACK)
+ {
+ rt -= 30000000;
+ i = m_pCB->ChapLookup(&rt, &name);
+ }
+ else if(nID == ID_NAVIGATE_SKIPFORWARD)
+ {
+ i = m_pCB->ChapLookup(&rt, &name) + 1;
+ name.Empty();
+ if(i < nChapters) m_pCB->ChapGet(i, &rt, &name);
+ }
+
+ if(i >= 0 && i < nChapters)
+ {
+ SeekTo(rt);
+ SendStatusMessage(_T("Chapter: ") + CString(name), 3000);
+ return;
+ }
+ }
+
+ if(nID == ID_NAVIGATE_SKIPBACK)
+ {
+ SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPBACKPLITEM);
+ }
+ else if(nID == ID_NAVIGATE_SKIPFORWARD)
+ {
+ SendMessage(WM_COMMAND, ID_NAVIGATE_SKIPFORWARDPLITEM);
+ }
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ m_iSpeedLevel = 0;
+
+ if(GetMediaState() != State_Running)
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+
+ ULONG ulNumOfVolumes, ulVolume;
+ DVD_DISC_SIDE Side;
+ ULONG ulNumOfTitles = 0;
+ pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles);
+
+ DVD_PLAYBACK_LOCATION2 Location;
+ pDVDI->GetCurrentLocation(&Location);
+
+ ULONG ulNumOfChapters = 0;
+ pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters);
+
+ if(nID == ID_NAVIGATE_SKIPBACK)
+ {
+ if(Location.ChapterNum == 1 && Location.TitleNum > 1)
+ {
+ pDVDI->GetNumberOfChapters(Location.TitleNum-1, &ulNumOfChapters);
+ pDVDC->PlayChapterInTitle(Location.TitleNum-1, ulNumOfChapters, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ }
+ else
+ {
+ pDVDC->PlayPrevChapter(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ }
+ }
+ else if(nID == ID_NAVIGATE_SKIPFORWARD)
+ {
+ if(Location.ChapterNum == ulNumOfChapters && Location.TitleNum < ulNumOfTitles)
+ {
+ pDVDC->PlayChapterInTitle(Location.TitleNum+1, 1, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ }
+ else
+ {
+ pDVDC->PlayNextChapter(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ }
+ }
+/*
+ if(nID == ID_NAVIGATE_SKIPBACK)
+ pDVDC->PlayPrevChapter(DVD_CMD_FLAG_Block, NULL);
+ else if(nID == ID_NAVIGATE_SKIPFORWARD)
+ pDVDC->PlayNextChapter(DVD_CMD_FLAG_Block, NULL);
+*/
+ }
+}
+
+void CMainFrame::OnUpdateNavigateSkip(CCmdUI* pCmdUI)
+{
+ // moved to the timer callback function, that runs less frequent
+// if(m_iPlaybackMode == PM_FILE) SetupChapters();
+
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED
+ && ((m_iPlaybackMode == PM_DVD
+ && m_iDVDDomain != DVD_DOMAIN_VideoManagerMenu
+ && m_iDVDDomain != DVD_DOMAIN_VideoTitleSetMenu)
+ || (m_iPlaybackMode == PM_FILE && (m_wndPlaylistBar.GetCount() > 1/*0*/ || m_pCB->ChapGetCount() > 1))
+ || (m_iPlaybackMode == PM_CAPTURE && !m_fCapturing))); // TODO
+}
+
+void CMainFrame::OnNavigateSkipPlaylistItem(UINT nID)
+{
+ if(m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE)
+ {
+ if(m_wndPlaylistBar.GetCount() == 1)
+ {
+ SendMessage(WM_COMMAND, ID_PLAY_STOP); // do not remove this, unless you want a circular call with OnPlayPlay()
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
+ else
+ {
+ if(nID == ID_NAVIGATE_SKIPBACKPLITEM)
+ {
+ m_wndPlaylistBar.SetPrev();
+ }
+ else if(nID == ID_NAVIGATE_SKIPFORWARDPLITEM)
+ {
+ m_wndPlaylistBar.SetNext();
+ }
+
+ OpenCurPlaylistItem();
+ }
+ }
+}
+
+void CMainFrame::OnUpdateNavigateSkipPlaylistItem(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iMediaLoadState == MLS_LOADED
+ && ((m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_CAPTURE && !m_fCapturing) && m_wndPlaylistBar.GetCount() > 1/*0*/));
+}
+
+void CMainFrame::OnNavigateMenu(UINT nID)
+{
+ nID -= ID_NAVIGATE_TITLEMENU;
+
+ if(m_iMediaLoadState != MLS_LOADED || m_iPlaybackMode != PM_DVD)
+ return;
+
+ m_iSpeedLevel = 0;
+
+ if(GetMediaState() != State_Running)
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+
+ pDVDC->ShowMenu((DVD_MENU_ID)(nID+2), DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+}
+
+void CMainFrame::OnUpdateNavigateMenu(CCmdUI* pCmdUI)
+{
+ UINT nID = pCmdUI->m_nID - ID_NAVIGATE_TITLEMENU;
+ ULONG ulUOPs;
+
+ if(m_iMediaLoadState != MLS_LOADED || m_iPlaybackMode != PM_DVD
+ || FAILED(pDVDI->GetCurrentUOPS(&ulUOPs)))
+ {
+ pCmdUI->Enable(FALSE);
+ return;
+ }
+
+ pCmdUI->Enable(!(ulUOPs & (UOP_FLAG_ShowMenu_Title << nID)));
+}
+
+void CMainFrame::OnNavigateAudio(UINT nID)
+{
+ nID -= ID_NAVIGATE_AUDIO_SUBITEM_START;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ OnNavStreamSelectSubMenu(nID, 1);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ pDVDC->SelectAudioStream(nID, DVD_CMD_FLAG_Block, NULL);
+ }
+}
+
+void CMainFrame::OnNavigateSubpic(UINT nID)
+{
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ OnNavStreamSelectSubMenu(nID - ID_NAVIGATE_SUBP_SUBITEM_START, 2);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ int i = (int)nID - (1 + ID_NAVIGATE_SUBP_SUBITEM_START);
+
+ if(i == -1)
+ {
+ ULONG ulStreamsAvailable, ulCurrentStream;
+ BOOL bIsDisabled;
+ if(SUCCEEDED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled)))
+ pDVDC->SetSubpictureState(bIsDisabled, DVD_CMD_FLAG_Block, NULL);
+ }
+ else
+ {
+ pDVDC->SelectSubpictureStream(i, DVD_CMD_FLAG_Block, NULL);
+ pDVDC->SetSubpictureState(TRUE, DVD_CMD_FLAG_Block, NULL);
+ }
+ }
+}
+
+void CMainFrame::OnNavigateAngle(UINT nID)
+{
+ nID -= ID_NAVIGATE_ANGLE_SUBITEM_START;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ OnNavStreamSelectSubMenu(nID, 0);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ pDVDC->SelectAngle(nID+1, DVD_CMD_FLAG_Block, NULL);
+ }
+}
+
+void CMainFrame::OnNavigateChapters(UINT nID)
+{
+ nID -= ID_NAVIGATE_CHAP_SUBITEM_START;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ if((int)nID >= 0 && nID < m_pCB->ChapGetCount())
+ {
+ REFERENCE_TIME rt;
+ CComBSTR name;
+ if(SUCCEEDED(m_pCB->ChapGet(nID, &rt, &name)))
+ {
+ SeekTo(rt);
+ SendStatusMessage(_T("Chapter: ") + CString(name), 3000);
+ }
+ return;
+ }
+
+ nID -= m_pCB->ChapGetCount();
+
+ if((int)nID >= 0 && (int)nID < m_wndPlaylistBar.GetCount()
+ && m_wndPlaylistBar.GetSelIdx() != (int)nID)
+ {
+ m_wndPlaylistBar.SetSelIdx(nID);
+ OpenCurPlaylistItem();
+ }
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ ULONG ulNumOfVolumes, ulVolume;
+ DVD_DISC_SIDE Side;
+ ULONG ulNumOfTitles = 0;
+ pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles);
+
+ DVD_PLAYBACK_LOCATION2 Location;
+ pDVDI->GetCurrentLocation(&Location);
+
+ ULONG ulNumOfChapters = 0;
+ pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters);
+
+ nID++;
+
+ if(nID > 0 && nID <= ulNumOfTitles)
+ {
+ pDVDC->PlayTitle(nID, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); // sometimes this does not do anything ...
+ pDVDC->PlayChapterInTitle(nID, 1, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); // ... but this does!
+ return;
+ }
+
+ nID -= ulNumOfTitles;
+
+ if(nID > 0 && nID <= ulNumOfChapters)
+ {
+ pDVDC->PlayChapter(nID, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+ return;
+ }
+ }
+}
+
+void CMainFrame::OnNavigateMenuItem(UINT nID)
+{
+ nID -= ID_NAVIGATE_MENU_LEFT;
+
+ if(m_iPlaybackMode == PM_DVD)
+ {
+ switch(nID)
+ {
+ case 0: pDVDC->SelectRelativeButton(DVD_Relative_Left); break;
+ case 1: pDVDC->SelectRelativeButton(DVD_Relative_Right); break;
+ case 2: pDVDC->SelectRelativeButton(DVD_Relative_Upper); break;
+ case 3: pDVDC->SelectRelativeButton(DVD_Relative_Lower); break;
+ case 4:
+ if (m_iDVDDomain != DVD_DOMAIN_Title) // Casimir666 : pour télécommande
+ pDVDC->ActivateButton();
+ else
+ OnPlayPlay();
+ break;
+ case 5: pDVDC->ReturnFromSubmenu(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); break;
+ case 6: pDVDC->Resume(DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL); break;
+ default: break;
+ }
+ }
+ else if (m_iPlaybackMode = PM_FILE) OnPlayPlay();
+}
+
+void CMainFrame::OnUpdateNavigateMenuItem(CCmdUI* pCmdUI)
+{
+ UINT nID = pCmdUI->m_nID - ID_NAVIGATE_MENU_LEFT;
+ pCmdUI->Enable((m_iMediaLoadState == MLS_LOADED) && ((m_iPlaybackMode == PM_DVD) || (m_iPlaybackMode == PM_FILE)));
+}
+
+// favorites
+
+class CDVDStateStream : public CUnknown, public IStream
+{
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
+ {
+ return
+ QI(IStream)
+ CUnknown::NonDelegatingQueryInterface(riid, ppv);
+ }
+
+ __int64 m_pos;
+
+public:
+ CDVDStateStream() : CUnknown(NAME("CDVDStateStream"), NULL) {m_pos = 0;}
+
+ DECLARE_IUNKNOWN;
+
+ CAtlArray<BYTE> m_data;
+
+ // ISequentialStream
+ STDMETHODIMP Read(void* pv, ULONG cb, ULONG* pcbRead)
+ {
+ __int64 cbRead = min(m_data.GetCount() - m_pos, (__int64)cb);
+ cbRead = max(cbRead, 0);
+ memcpy(pv, &m_data[(INT_PTR)m_pos], (int)cbRead);
+ if(pcbRead) *pcbRead = (ULONG)cbRead;
+ m_pos += cbRead;
+ return S_OK;
+ }
+ STDMETHODIMP Write(const void* pv, ULONG cb, ULONG* pcbWritten)
+ {
+ BYTE* p = (BYTE*)pv;
+ ULONG cbWritten = -1;
+ while(++cbWritten < cb)
+ m_data.Add(*p++);
+ if(pcbWritten) *pcbWritten = cbWritten;
+ return S_OK;
+ }
+
+ // IStream
+ STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) {return E_NOTIMPL;}
+ STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize) {return E_NOTIMPL;}
+ STDMETHODIMP CopyTo(IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) {return E_NOTIMPL;}
+ STDMETHODIMP Commit(DWORD grfCommitFlags) {return E_NOTIMPL;}
+ STDMETHODIMP Revert() {return E_NOTIMPL;}
+ STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;}
+ STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;}
+ STDMETHODIMP Stat(STATSTG* pstatstg, DWORD grfStatFlag) {return E_NOTIMPL;}
+ STDMETHODIMP Clone(IStream** ppstm) {return E_NOTIMPL;}
+};
+
+
+void CMainFrame::OnFavoritesAdd()
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ CString fn = m_wndPlaylistBar.GetCur();
+ if(fn.IsEmpty()) return;
+
+ CString desc = fn;
+ desc.Replace('\\', '/');
+ int i = desc.Find(_T("://")), j = desc.Find(_T("?")), k = desc.ReverseFind('/');
+ if(i >= 0) desc = j >= 0 ? desc.Left(j) : desc;
+ else if(k >= 0) desc = desc.Mid(k+1);
+
+ CFavoriteAddDlg dlg(desc, fn);
+ if(dlg.DoModal() != IDOK) return;
+
+ CString str = dlg.m_name;
+ str.Remove(';');
+
+ CString pos(_T("0"));
+ if(dlg.m_fRememberPos)
+ pos.Format(_T("%I64d"), GetPos());
+
+ str += ';';
+ str += pos;
+
+ CPlaylistItem pli;
+ if(m_wndPlaylistBar.GetCur(pli))
+ {
+ POSITION pos = pli.m_fns.GetHeadPosition();
+ while(pos) str += _T(";") + pli.m_fns.GetNext(pos);
+ }
+
+ s.AddFav(FAV_FILE, str);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ WCHAR path[MAX_PATH];
+ ULONG len = 0;
+ pDVDI->GetDVDDirectory(path, MAX_PATH, &len);
+ CString fn = path;
+ fn.TrimRight(_T("/\\"));
+
+ DVD_PLAYBACK_LOCATION2 Location;
+ pDVDI->GetCurrentLocation(&Location);
+ CString desc;
+ desc.Format(_T("%s - T%02d C%02d - %02d:%02d:%02d"), fn, Location.TitleNum, Location.ChapterNum,
+ Location.TimeCode.bHours, Location.TimeCode.bMinutes, Location.TimeCode.bSeconds);
+
+ CFavoriteAddDlg dlg(fn, desc);
+ if(dlg.DoModal() != IDOK) return;
+
+ CString str = dlg.m_name;
+ str.Remove(';');
+
+ CString pos(_T("0"));
+ if(dlg.m_fRememberPos)
+ {
+ CDVDStateStream stream;
+ stream.AddRef();
+
+ CComPtr<IDvdState> pStateData;
+ CComQIPtr<IPersistStream> pPersistStream;
+ if(SUCCEEDED(pDVDI->GetState(&pStateData))
+ && (pPersistStream = pStateData)
+ && SUCCEEDED(OleSaveToStream(pPersistStream, (IStream*)&stream)))
+ {
+ pos = BinToCString(stream.m_data.GetData(), stream.m_data.GetCount());
+ }
+ }
+
+ str += ';';
+ str += pos;
+
+ str += ';';
+ str += fn;
+
+ s.AddFav(FAV_DVD, str);
+ }
+ else if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ // TODO
+ }
+}
+
+void CMainFrame::OnUpdateFavoritesAdd(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_iPlaybackMode == PM_FILE || m_iPlaybackMode == PM_DVD);
+}
+
+void CMainFrame::OnFavoritesOrganize()
+{
+ CFavoriteOrganizeDlg dlg;
+ dlg.DoModal();
+}
+
+void CMainFrame::OnUpdateFavoritesOrganize(CCmdUI* pCmdUI)
+{
+ // TODO: Add your command update UI handler code here
+}
+
+void CMainFrame::OnFavoritesFile(UINT nID)
+{
+ nID -= ID_FAVORITES_FILE_START;
+
+ CAtlList<CString> sl;
+ AfxGetAppSettings().GetFav(FAV_FILE, sl);
+
+ if(POSITION pos = sl.FindIndex(nID))
+ {
+ CAtlList<CString> fns;
+ REFERENCE_TIME rtStart = 0;
+
+ int i = 0, j = 0;
+ for(CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i);
+ !s2.IsEmpty();
+ s2 = s1.Tokenize(_T(";"), i), j++)
+ {
+ if(j == 0) ; // desc
+ else if(j == 1) _stscanf(s2, _T("%I64d"), &rtStart); // pos
+ else fns.AddTail(s2); // subs
+ }
+
+ m_wndPlaylistBar.Open(fns, false);
+ OpenCurPlaylistItem(max(rtStart, 0));
+ }
+}
+
+void CMainFrame::OnUpdateFavoritesFile(CCmdUI* pCmdUI)
+{
+ UINT nID = pCmdUI->m_nID - ID_FAVORITES_FILE_START;
+}
+
+void CMainFrame::OnFavoritesDVD(UINT nID)
+{
+ nID -= ID_FAVORITES_DVD_START;
+
+ CAtlList<CString> sl;
+ AfxGetAppSettings().GetFav(FAV_DVD, sl);
+
+ if(POSITION pos = sl.FindIndex(nID))
+ {
+ CString fn;
+
+ CDVDStateStream stream;
+ stream.AddRef();
+
+ int i = 0, j = 0;
+ for(CString s1 = sl.GetAt(pos), s2 = s1.Tokenize(_T(";"), i);
+ !s2.IsEmpty();
+ s2 = s1.Tokenize(_T(";"), i), j++)
+ {
+ if(j == 0) ; // desc
+ else if(j == 1 && s2 != _T("0")) // state
+ {
+ CStringToBin(s2, stream.m_data);
+ }
+ else if(j == 2) fn = s2; // path
+ }
+
+ SendMessage(WM_COMMAND, ID_FILE_CLOSEMEDIA);
+
+ CComPtr<IDvdState> pDvdState;
+ HRESULT hr = OleLoadFromStream((IStream*)&stream, IID_IDvdState, (void**)&pDvdState);
+
+ CAutoPtr<OpenDVDData> p(new OpenDVDData());
+ if(p) {p->path = fn; p->pDvdState = pDvdState;}
+ OpenMedia(p);
+ }
+}
+
+void CMainFrame::OnUpdateFavoritesDVD(CCmdUI* pCmdUI)
+{
+ UINT nID = pCmdUI->m_nID - ID_FAVORITES_DVD_START;
+}
+
+void CMainFrame::OnFavoritesDevice(UINT nID)
+{
+ nID -= ID_FAVORITES_DEVICE_START;
+}
+
+void CMainFrame::OnUpdateFavoritesDevice(CCmdUI* pCmdUI)
+{
+ UINT nID = pCmdUI->m_nID - ID_FAVORITES_DEVICE_START;
+}
+
+// help
+
+void CMainFrame::OnHelpHomepage()
+{
+ ShellExecute(m_hWnd, _T("open"), _T("http://gabest.org/"), NULL, NULL, SW_SHOWDEFAULT);
+}
+
+void CMainFrame::OnHelpDocumentation()
+{
+ ShellExecute(m_hWnd, _T("open"), _T("http://sourceforge.net/project/showfiles.php?group_id=82303&package_id=144472"), NULL, NULL, SW_SHOWDEFAULT);
+}
+
+void CMainFrame::OnHelpDonate()
+{
+ const TCHAR URL[] = _T("http://order.kagi.com/?N4A");
+ if(CString(URL).Find(CString(_T("A4N")).MakeReverse()) >= 0)
+ ShellExecute(m_hWnd, _T("open"), URL, NULL, NULL, SW_SHOWDEFAULT);
+}
+
+//////////////////////////////////
+
+static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
+{
+ CAtlArray<HMONITOR>* ml = (CAtlArray<HMONITOR>*)dwData;
+ ml->Add(hMonitor);
+ return TRUE;
+}
+
+void CMainFrame::SetDefaultWindowRect(int iMonitor)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ {
+ CRect r1, r2;
+ GetClientRect(&r1);
+ m_wndView.GetClientRect(&r2);
+
+ CSize logosize = m_wndView.GetLogoSize();
+ int _DEFCLIENTW = max(logosize.cx, DEFCLIENTW);
+ int _DEFCLIENTH = max(logosize.cy, DEFCLIENTH);
+
+ if(GetSystemMetrics(SM_REMOTESESSION))
+ _DEFCLIENTH = 0;
+
+ DWORD style = GetStyle();
+
+ MENUBARINFO mbi;
+ memset(&mbi, 0, sizeof(mbi));
+ mbi.cbSize = sizeof(mbi);
+ ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
+
+ int w = _DEFCLIENTW + GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2
+ + r1.Width() - r2.Width();
+ int h = _DEFCLIENTH + GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2
+ + (mbi.rcBar.bottom - mbi.rcBar.top)
+ + r1.Height() - r2.Height()
+ + 1; // ???
+// + 2; // ???
+ if(style&WS_CAPTION) h += GetSystemMetrics(SM_CYCAPTION);
+
+ if(s.HasFixedWindowSize())
+ {
+ w = s.fixedWindowSize.cx;
+ h = s.fixedWindowSize.cy;
+ }
+ else if(s.fRememberWindowSize)
+ {
+ w = s.rcLastWindowPos.Width();
+ h = s.rcLastWindowPos.Height();
+ }
+
+ HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
+
+ if(iMonitor > 0)
+ {
+ iMonitor--;
+ CAtlArray<HMONITOR> ml;
+ EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&ml);
+ if(iMonitor < ml.GetCount()) hMonitor = ml[iMonitor];
+ }
+
+ MONITORINFO mi;
+ mi.cbSize = sizeof(MONITORINFO);
+ GetMonitorInfo(hMonitor, &mi);
+
+ int x = (mi.rcWork.left+mi.rcWork.right-w)/2;
+ int y = (mi.rcWork.top+mi.rcWork.bottom-h)/2;
+
+ if(s.fRememberWindowPos)
+ {
+ CRect r = s.rcLastWindowPos;
+// x = r.CenterPoint().x - w/2;
+// y = r.CenterPoint().y - h/2;
+ x = r.TopLeft().x;
+ y = r.TopLeft().y;
+ }
+
+ UINT lastWindowType = s.lastWindowType;
+
+ MoveWindow(x, y, w, h);
+
+ if(s.fRememberWindowSize && s.fRememberWindowPos)
+ {
+ WINDOWPLACEMENT wp;
+ memset(&wp, 0, sizeof(wp));
+ wp.length = sizeof(WINDOWPLACEMENT);
+ if(lastWindowType == SIZE_MAXIMIZED)
+ ShowWindow(SW_MAXIMIZE);
+ else if(lastWindowType == SIZE_MINIMIZED)
+ ShowWindow(SW_MINIMIZE);
+
+ // Casimir666 : remettre le full screen si tel était de cas
+ if (!m_fFullScreen && s.fLastFullScreen) ToggleFullscreen(true, true);
+ }
+ }
+
+ if(s.fHideCaptionMenu)
+ {
+ ModifyStyle(WS_CAPTION, 0, SWP_NOZORDER);
+ ::SetMenu(m_hWnd, NULL);
+ SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
+ }
+}
+
+void CMainFrame::RestoreDefaultWindowRect()
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ WINDOWPLACEMENT wp;
+ GetWindowPlacement(&wp);
+ if(!m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED && wp.showCmd != SW_SHOWMINIMIZED
+// && (GetExStyle()&WS_EX_APPWINDOW)
+ && !s.fRememberWindowSize)
+ {
+ CRect r1, r2;
+ GetClientRect(&r1);
+ m_wndView.GetClientRect(&r2);
+
+ CSize logosize = m_wndView.GetLogoSize();
+ int _DEFCLIENTW = max(logosize.cx, DEFCLIENTW);
+ int _DEFCLIENTH = max(logosize.cy, DEFCLIENTH);
+
+ DWORD style = GetStyle();
+
+ MENUBARINFO mbi;
+ memset(&mbi, 0, sizeof(mbi));
+ mbi.cbSize = sizeof(mbi);
+ ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
+
+ int w = _DEFCLIENTW + GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2
+ + r1.Width() - r2.Width();
+ int h = _DEFCLIENTH + GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2
+ + (mbi.rcBar.bottom - mbi.rcBar.top)
+ + r1.Height() - r2.Height()
+ + 1; // ???
+// + 2; // ???
+ if(style&WS_CAPTION) h += GetSystemMetrics(SM_CYCAPTION);
+
+ if(s.HasFixedWindowSize())
+ {
+ w = s.fixedWindowSize.cx;
+ h = s.fixedWindowSize.cy;
+ }
+
+ CRect r;
+ GetWindowRect(r);
+
+ int x = r.CenterPoint().x - w/2;
+ int y = r.CenterPoint().y - h/2;
+
+ if(s.fRememberWindowPos)
+ {
+ CRect r = s.rcLastWindowPos;
+
+ x = r.TopLeft().x;
+ y = r.TopLeft().y;
+ }
+
+ MoveWindow(x, y, w, h);
+ }
+}
+
+OAFilterState CMainFrame::GetMediaState()
+{
+ OAFilterState ret = -1;
+ if(m_iMediaLoadState == MLS_LOADED) pMC->GetState(0, &ret);
+ return(ret);
+}
+
+CSize CMainFrame::GetVideoSize()
+{
+ bool fKeepAspectRatio = AfxGetAppSettings().fKeepAspectRatio;
+ bool fCompMonDeskARDiff = AfxGetAppSettings().fCompMonDeskARDiff;
+
+ CSize ret(0,0);
+ if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly)
+ return ret;
+
+ CSize wh(0, 0), arxy(0, 0);
+
+ if(m_pCAP)
+ {
+ wh = m_pCAP->GetVideoSize(false);
+ arxy = m_pCAP->GetVideoSize(fKeepAspectRatio);
+ }
+ else
+ {
+ pBV->GetVideoSize(&wh.cx, &wh.cy);
+
+ long arx = 0, ary = 0;
+ CComQIPtr<IBasicVideo2> pBV2 = pBV;
+ if(pBV2 && SUCCEEDED(pBV2->GetPreferredAspectRatio(&arx, &ary)) && arx > 0 && ary > 0)
+ arxy.SetSize(arx, ary);
+ }
+
+ if(wh.cx <= 0 || wh.cy <= 0)
+ return ret;
+
+ // with the overlay mixer IBasicVideo2 won't tell the new AR when changed dynamically
+ DVD_VideoAttributes VATR;
+ if(m_iPlaybackMode == PM_DVD && SUCCEEDED(pDVDI->GetCurrentVideoAttributes(&VATR)))
+ arxy.SetSize(VATR.ulAspectX, VATR.ulAspectY);
+
+ CSize& ar = AfxGetAppSettings().AspectRatio;
+ if(ar.cx && ar.cy) arxy = ar;
+
+ ret = (!fKeepAspectRatio || arxy.cx <= 0 || arxy.cy <= 0)
+ ? wh
+ : CSize(MulDiv(wh.cy, arxy.cx, arxy.cy), wh.cy);
+
+ if(fCompMonDeskARDiff)
+ if(HDC hDC = ::GetDC(0))
+ {
+ int _HORZSIZE = GetDeviceCaps(hDC, HORZSIZE);
+ int _VERTSIZE = GetDeviceCaps(hDC, VERTSIZE);
+ int _HORZRES = GetDeviceCaps(hDC, HORZRES);
+ int _VERTRES = GetDeviceCaps(hDC, VERTRES);
+
+ if(_HORZSIZE > 0 && _VERTSIZE > 0 && _HORZRES > 0 && _VERTRES > 0)
+ {
+ double a = 1.0*_HORZSIZE/_VERTSIZE;
+ double b = 1.0*_HORZRES/_VERTRES;
+
+ if(b < a)
+ ret.cy = (DWORD)(1.0*ret.cy * a / b);
+ else if(a < b)
+ ret.cx = (DWORD)(1.0*ret.cx * b / a);
+ }
+
+ ::ReleaseDC(0, hDC);
+ }
+
+ return ret;
+}
+
+void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasTo)
+{
+ AppSettings& s = AfxGetAppSettings();
+ CRect r;
+// const CWnd* pWndInsertAfter;
+ DWORD dwRemove = 0, dwAdd = 0;
+ DWORD dwRemoveEx = 0, dwAddEx = 0;
+ HMENU hMenu;
+
+ if(!m_fFullScreen)
+ {
+ GetWindowRect(&m_lastWindowRect);
+
+ dispmode& dm = AfxGetAppSettings().dmFullscreenRes;
+ m_dmBeforeFullscreen.fValid = false;
+ if(dm.fValid && fSwitchScreenResWhenHasTo)
+ {
+ GetCurDispMode(m_dmBeforeFullscreen);
+ SetDispMode(dm);
+ }
+
+ MONITORINFO mi;
+ mi.cbSize = sizeof(MONITORINFO);
+ GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi);
+
+ dwRemove = WS_CAPTION|WS_THICKFRAME;
+ if(fToNearest) r = mi.rcMonitor;
+ else GetDesktopWindow()->GetWindowRect(&r);
+ hMenu = NULL;
+ }
+ else
+ {
+ if(m_dmBeforeFullscreen.fValid)
+ SetDispMode(m_dmBeforeFullscreen);
+
+ dwAdd = (AfxGetAppSettings().fHideCaptionMenu ? 0 : WS_CAPTION) | WS_THICKFRAME;
+ r = m_lastWindowRect;
+ hMenu = AfxGetAppSettings().fHideCaptionMenu ? NULL : m_hMenuDefault;
+ }
+
+ m_lastMouseMove.x = m_lastMouseMove.y = -1;
+
+ bool fAudioOnly = m_fAudioOnly;
+ m_fAudioOnly = true;
+
+ m_fFullScreen = !m_fFullScreen;
+ s.fLastFullScreen = m_fFullScreen;
+
+ SetAlwaysOnTop(AfxGetAppSettings().iOnTop);
+
+ ModifyStyle(dwRemove, dwAdd, SWP_NOZORDER);
+ ModifyStyleEx(dwRemoveEx, dwAddEx, SWP_NOZORDER);
+ ::SetMenu(m_hWnd, hMenu);
+ SetWindowPos(NULL, r.left, r.top, r.Width(), r.Height(), SWP_NOZORDER|SWP_NOSENDCHANGING /*SWP_FRAMECHANGED*/);
+
+ if(m_fFullScreen)
+ {
+ m_fHideCursor = true;
+ ShowControls(CS_NONE, false);
+ }
+ else
+ {
+ KillTimer(TIMER_FULLSCREENCONTROLBARHIDER);
+ KillTimer(TIMER_FULLSCREENMOUSEHIDER);
+ m_fHideCursor = false;
+ ShowControls(AfxGetAppSettings().nCS);
+ }
+
+ m_wndView.SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER);
+
+ m_fAudioOnly = fAudioOnly;
+
+ MoveVideoWindow();
+}
+
+void CMainFrame::MoveVideoWindow(bool fShowStats)
+{
+ if(m_iMediaLoadState == MLS_LOADED && !m_fAudioOnly && IsWindowVisible())
+ {
+ CRect wr;
+ if (m_bD3DFullscreenMode)
+ m_pFullscreenWnd->GetClientRect(wr);
+ else if(!m_fFullScreen)
+ {
+ m_wndView.GetClientRect(wr);
+ if(!AfxGetAppSettings().fHideCaptionMenu)
+ wr.DeflateRect(2, 2);
+ }
+ else
+ {
+ GetWindowRect(&wr);
+
+ // HACK
+ CRect r;
+ m_wndView.GetWindowRect(&r);
+ wr -= r.TopLeft();
+ }
+
+ CRect vr = CRect(0,0,0,0);
+
+ OAFilterState fs = GetMediaState();
+ if(fs == State_Paused || fs == State_Running || fs == State_Stopped && (m_fShockwaveGraph || m_fQuicktimeGraph))
+ {
+ CSize arxy = GetVideoSize();
+
+ int iDefaultVideoSize = AfxGetAppSettings().iDefaultVideoSize;
+
+ CSize ws =
+ iDefaultVideoSize == DVS_HALF ? CSize(arxy.cx/2, arxy.cy/2) :
+ iDefaultVideoSize == DVS_NORMAL ? arxy :
+ iDefaultVideoSize == DVS_DOUBLE ? CSize(arxy.cx*2, arxy.cy*2) :
+ wr.Size();
+
+ int w = ws.cx;
+ int h = ws.cy;
+
+ if(!m_fShockwaveGraph) //&& !m_fQuicktimeGraph)
+ {
+ if(iDefaultVideoSize == DVS_FROMINSIDE || iDefaultVideoSize == DVS_FROMOUTSIDE)
+ {
+ h = ws.cy;
+ w = MulDiv(h, arxy.cx, arxy.cy);
+
+ if(iDefaultVideoSize == DVS_FROMINSIDE && w > ws.cx
+ || iDefaultVideoSize == DVS_FROMOUTSIDE && w < ws.cx)
+ {
+ w = ws.cx;
+ h = MulDiv(w, arxy.cy, arxy.cx);
+ }
+ }
+ }
+
+ CSize size(
+ (int)(m_ZoomX*w),
+ (int)(m_ZoomY*h));
+
+ CPoint pos(
+ (int)(m_PosX*(wr.Width()*3 - m_ZoomX*w) - wr.Width()),
+ (int)(m_PosY*(wr.Height()*3 - m_ZoomY*h) - wr.Height()));
+
+/* CPoint pos(
+ (int)(m_PosX*(wr.Width() - size.cx)),
+ (int)(m_PosY*(wr.Height() - size.cy)));
+
+*/
+ vr = CRect(pos, size);
+ }
+
+ wr |= CRect(0,0,0,0);
+ vr |= CRect(0,0,0,0);
+
+ if(m_pCAP)
+ {
+ m_pCAP->SetPosition(wr, vr);
+ m_pCAP->SetVideoAngle(Vector(DegToRad(m_AngleX), DegToRad(m_AngleY), DegToRad(m_AngleZ)));
+ }
+ else
+ {
+ HRESULT hr;
+ hr = pBV->SetDefaultSourcePosition();
+ hr = pBV->SetDestinationPosition(vr.left, vr.top, vr.Width(), vr.Height());
+ hr = pVW->SetWindowPosition(wr.left, wr.top, wr.Width(), wr.Height());
+ }
+
+ m_wndView.SetVideoRect(wr);
+
+ if(fShowStats && vr.Height() > 0)
+ {
+ CString info;
+ info.Format(_T("Pos %.2f %.2f, Zoom %.2f %.2f, AR %.2f"), m_PosX, m_PosY, m_ZoomX, m_ZoomY, (float)vr.Width()/vr.Height());
+ SendStatusMessage(info, 3000);
+ }
+ }
+ else
+ {
+ m_wndView.SetVideoRect();
+ }
+}
+
+void CMainFrame::ZoomVideoWindow(double scale)
+{
+ if(m_iMediaLoadState != MLS_LOADED)
+ return;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ if(scale <= 0)
+ {
+ scale =
+ s.iZoomLevel == 0 ? 0.5 :
+ s.iZoomLevel == 1 ? 1.0 :
+ s.iZoomLevel == 2 ? 2.0 :
+ s.iZoomLevel == 3 ? GetZoomAutoFitScale() :
+ 1.0;
+ }
+
+ if(m_fFullScreen)
+ {
+ OnViewFullscreen();
+ }
+
+ MINMAXINFO mmi;
+ OnGetMinMaxInfo(&mmi);
+
+ CRect r;
+ int w = 0, h = 0;
+
+ if(!m_fAudioOnly)
+ {
+ CSize arxy = GetVideoSize();
+
+ long lWidth = int(arxy.cx * scale + 0.5);
+ long lHeight = int(arxy.cy * scale + 0.5);
+
+ DWORD style = GetStyle();
+
+ CRect r1, r2;
+ GetClientRect(&r1);
+ m_wndView.GetClientRect(&r2);
+
+ w = GetSystemMetrics((style&WS_CAPTION)?SM_CXSIZEFRAME:SM_CXFIXEDFRAME)*2
+ + r1.Width() - r2.Width()
+ + lWidth;
+
+ MENUBARINFO mbi;
+ memset(&mbi, 0, sizeof(mbi));
+ mbi.cbSize = sizeof(mbi);
+ ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
+
+ h = GetSystemMetrics((style&WS_CAPTION)?SM_CYSIZEFRAME:SM_CYFIXEDFRAME)*2
+ + (mbi.rcBar.bottom - mbi.rcBar.top)
+ + r1.Height() - r2.Height()
+ + lHeight;
+
+ if(style&WS_CAPTION)
+ {
+ h += GetSystemMetrics(SM_CYCAPTION);
+ w += 2; h += 2; // for the 1 pixel wide sunken frame
+ w += 2; h += 3; // for the inner black border
+ }
+
+ GetWindowRect(r);
+
+ w = max(w, mmi.ptMinTrackSize.x);
+ h = max(h, mmi.ptMinTrackSize.y);
+ }
+ else
+ {
+ GetWindowRect(r);
+
+ w = r.Width(); // mmi.ptMinTrackSize.x;
+ h = mmi.ptMinTrackSize.y;
+ }
+
+ // center window
+ if(!s.fRememberWindowPos)
+ {
+ CPoint cp = r.CenterPoint();
+ r.left = cp.x - w/2;
+ r.top = cp.y - h/2;
+ }
+
+ r.right = r.left + w;
+ r.bottom = r.top + h;
+
+ MONITORINFO mi;
+ mi.cbSize = sizeof(MONITORINFO);
+ GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi);
+ if(r.right > mi.rcWork.right) r.OffsetRect(mi.rcWork.right-r.right, 0);
+ if(r.left < mi.rcWork.left) r.OffsetRect(mi.rcWork.left-r.left, 0);
+ if(r.bottom > mi.rcWork.bottom) r.OffsetRect(0, mi.rcWork.bottom-r.bottom);
+ if(r.top < mi.rcWork.top) r.OffsetRect(0, mi.rcWork.top-r.top);
+
+ if((m_fFullScreen || !s.HasFixedWindowSize()) && !m_bD3DFullscreenMode)
+ {
+ MoveWindow(r);
+ }
+
+// ShowWindow(SW_SHOWNORMAL);
+
+ MoveVideoWindow();
+}
+
+double CMainFrame::GetZoomAutoFitScale()
+{
+ if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly)
+ return 1.0;
+
+ CSize arxy = GetVideoSize();
+
+ double sx = 2.0/3 * m_rcDesktop.Width() / arxy.cx;
+ double sy = 2.0/3 * m_rcDesktop.Height() / arxy.cy;
+
+ return sx < sy ? sx : sy;
+}
+
+void CMainFrame::RepaintVideo()
+{
+ if(m_pCAP) m_pCAP->Paint(false);
+}
+
+void CMainFrame::SetShaders()
+{
+ if(!m_pCAP) return;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ CAtlStringMap<const AppSettings::Shader*> s2s;
+
+ POSITION pos = s.m_shaders.GetHeadPosition();
+ while(pos)
+ {
+ const AppSettings::Shader* pShader = &s.m_shaders.GetNext(pos);
+ s2s[pShader->label] = pShader;
+ }
+
+ m_pCAP->SetPixelShader(NULL, NULL);
+
+ CAtlList<CString> labels;
+
+ pos = m_shaderlabels.GetHeadPosition();
+ while(pos)
+ {
+ const AppSettings::Shader* pShader = NULL;
+ if(s2s.Lookup(m_shaderlabels.GetNext(pos), pShader))
+ {
+ CStringA target = pShader->target;
+ CStringA srcdata = pShader->srcdata;
+
+ HRESULT hr = m_pCAP->SetPixelShader(srcdata, target);
+
+ if(FAILED(hr))
+ {
+ m_pCAP->SetPixelShader(NULL, NULL);
+ SendStatusMessage(_T("Could not load shader: ") + pShader->label, 3000);
+ return;
+ }
+
+ labels.AddTail(pShader->label);
+ }
+ }
+
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ CString str = Implode(labels, '|');
+ str.Replace(_T("|"), _T(", "));
+ SendStatusMessage(_T("Shader: ") + str, 3000);
+ }
+}
+
+void CMainFrame::UpdateShaders(CString label)
+{
+ if(!m_pCAP) return;
+
+ if(m_shaderlabels.GetCount() <= 1)
+ m_shaderlabels.RemoveAll();
+
+ if(m_shaderlabels.IsEmpty() && !label.IsEmpty())
+ m_shaderlabels.AddTail(label);
+
+ bool fUpdate = m_shaderlabels.IsEmpty();
+
+ POSITION pos = m_shaderlabels.GetHeadPosition();
+ while(pos)
+ {
+ if(label == m_shaderlabels.GetNext(pos))
+ {
+ fUpdate = true;
+ break;
+ }
+ }
+
+ if(fUpdate) SetShaders();
+
+}
+
+void CMainFrame::SetBalance(int balance)
+{
+ AfxGetAppSettings().nBalance = balance;
+
+ int sign = balance>0?-1:1;
+ balance = max(100-abs(balance), 1);
+ balance = (int)((log10(1.0*balance)-2)*5000*sign);
+ balance = max(min(balance, 10000), -10000);
+
+ if(m_iMediaLoadState == MLS_LOADED)
+ pBA->put_Balance(balance);
+}
+
+void CMainFrame::SetupIViAudReg()
+{
+ if(!AfxGetAppSettings().fAutoSpeakerConf) return;
+
+ DWORD spc = 0, defchnum = 0;
+
+ if(AfxGetAppSettings().fAutoSpeakerConf)
+ {
+ CComPtr<IDirectSound> pDS;
+ if(SUCCEEDED(DirectSoundCreate(NULL, &pDS, NULL))
+ && SUCCEEDED(pDS->SetCooperativeLevel(m_hWnd, DSSCL_NORMAL)))
+ {
+ if(SUCCEEDED(pDS->GetSpeakerConfig(&spc)))
+ {
+ switch(spc)
+ {
+ case DSSPEAKER_DIRECTOUT: defchnum = 6; break;
+ case DSSPEAKER_HEADPHONE: defchnum = 2; break;
+ case DSSPEAKER_MONO: defchnum = 1; break;
+ case DSSPEAKER_QUAD: defchnum = 4; break;
+ default:
+ case DSSPEAKER_STEREO: defchnum = 2; break;
+ case DSSPEAKER_SURROUND: defchnum = 2; break;
+ case DSSPEAKER_5POINT1: defchnum = 5; break;
+ case DSSPEAKER_7POINT1: defchnum = 5; break;
+ }
+ }
+ }
+ }
+ else
+ {
+ defchnum = 2;
+ }
+
+ CRegKey iviaud;
+ if(ERROR_SUCCESS == iviaud.Create(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\InterVideo\\Common\\AudioDec")))
+ {
+ DWORD chnum = 0;
+ if(FAILED(iviaud.QueryDWORDValue(_T("AUDIO"), chnum))) chnum = 0;
+ if(chnum <= defchnum) // check if the user has already set it..., but we won't skip if it's lower than sensible :P
+ iviaud.SetDWORDValue(_T("AUDIO"), defchnum);
+ }
+}
+
+//
+// Open/Close
+//
+
+void CMainFrame::OpenCreateGraphObject(OpenMediaData* pOMD)
+{
+ ASSERT(pGB == NULL);
+
+ m_fCustomGraph = false;
+ m_fRealMediaGraph = m_fShockwaveGraph = m_fQuicktimeGraph = false;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ // CASIMIR666 todo
+ if (s.fD3DFullscreen && (s.iDSVideoRendererType == VIDRNDT_DS_VMR9RENDERLESS))
+ {
+ CreateFullScreenWindow();
+ m_pVideoWnd = m_pFullscreenWnd;
+ m_bD3DFullscreenMode = true;
+ }
+ else
+ {
+ m_pVideoWnd = &m_wndView;
+ m_bD3DFullscreenMode = false;
+ }
+
+ if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD))
+ {
+ engine_t engine = s.Formats.GetEngine(p->fns.GetHead());
+
+ CStringA ct = GetContentType(p->fns.GetHead());
+
+ if(ct == "video/x-ms-asf")
+ {
+ // TODO: put something here to make the windows media source filter load later
+ }
+ else if(ct == "audio/x-pn-realaudio"
+ || ct == "audio/x-pn-realaudio-plugin"
+ || ct == "audio/x-realaudio-secure"
+ || ct == "video/vnd.rn-realvideo-secure"
+ || ct == "application/vnd.rn-realmedia"
+ || ct.Find("vnd.rn-") >= 0
+ || ct.Find("realaudio") >= 0
+ || ct.Find("realvideo") >= 0)
+ {
+ engine = RealMedia;
+ }
+ else if(ct == "application/x-shockwave-flash")
+ {
+ engine = ShockWave;
+ }
+ else if(ct == "video/quicktime"
+ || ct == "application/x-quicktimeplayer")
+ {
+ engine = QuickTime;
+ }
+
+ HRESULT hr;
+ CComPtr<IUnknown> pUnk;
+
+ if(engine == RealMedia)
+ {
+ if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)new CRealMediaGraph(m_pVideoWnd->m_hWnd, hr)))
+ throw _T("Out of memory");
+
+ if(SUCCEEDED(hr) && !!(pGB = CComQIPtr<IGraphBuilder>(pUnk)))
+ m_fRealMediaGraph = true;
+ }
+ else if(engine == ShockWave)
+ {
+ if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)new CShockwaveGraph(m_pVideoWnd->m_hWnd, hr)))
+ throw _T("Out of memory");
+
+ if(FAILED(hr) || !(pGB = CComQIPtr<IGraphBuilder>(pUnk)))
+ throw _T("Can't create shockwave control");
+
+ m_fShockwaveGraph = true;
+ }
+ else if(engine == QuickTime)
+ {
+ if(!(pUnk = (IUnknown*)(INonDelegatingUnknown*)new CQuicktimeGraph(m_pVideoWnd->m_hWnd, hr)))
+ throw _T("Out of memory");
+
+ if(SUCCEEDED(hr) && !!(pGB = CComQIPtr<IGraphBuilder>(pUnk)))
+ m_fQuicktimeGraph = true;
+ }
+
+ m_fCustomGraph = m_fRealMediaGraph || m_fShockwaveGraph || m_fQuicktimeGraph;
+
+ if(!m_fCustomGraph)
+ {
+ pGB = new CFGManagerPlayer(_T("CFGManagerPlayer"), NULL, s.SrcFilters, s.TraFilters, m_pVideoWnd->m_hWnd);
+ }
+ }
+ else if(OpenDVDData* p = dynamic_cast<OpenDVDData*>(pOMD))
+ {
+ pGB = new CFGManagerDVD(_T("CFGManagerDVD"), NULL, s.SrcFilters, s.TraFilters, m_pVideoWnd->m_hWnd);
+ }
+ else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD))
+ {
+ pGB = new CFGManagerCapture(_T("CFGManagerCapture"), NULL, s.SrcFilters, s.TraFilters, m_pVideoWnd->m_hWnd);
+ }
+
+ if(!pGB)
+ {
+ throw _T("Failed to create the filter graph object");
+ }
+
+ pGB->AddToROT();
+
+ pMC = pGB; pME = pGB; pMS = pGB; // general
+ pVW = pGB; pBV = pGB; // video
+ pBA = pGB; // audio
+ pFS = pGB;
+
+ if(!(pMC && pME && pMS)
+ || !(pVW && pBV)
+ || !(pBA))
+ {
+ throw _T("Failed to query the needed interfaces for playback");
+ }
+
+ if(FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0)))
+ {
+ throw _T("Could not set target window for graph notification");
+ }
+
+ m_pProv = (IUnknown*)new CKeyProvider();
+
+ if(CComQIPtr<IObjectWithSite> pObjectWithSite = pGB)
+ pObjectWithSite->SetSite(m_pProv);
+
+ m_pCB = new CDSMChapterBag(NULL, NULL);
+}
+
+void CMainFrame::OpenFile(OpenFileData* pOFD)
+{
+ if(pOFD->fns.IsEmpty())
+ throw _T("Invalid argument");
+
+ AppSettings& s = AfxGetAppSettings();
+
+ bool fFirst = true;
+
+ POSITION pos = pOFD->fns.GetHeadPosition();
+ while(pos)
+ {
+ CString fn = pOFD->fns.GetNext(pos);
+
+ fn.Trim();
+ if(fn.IsEmpty() && !fFirst)
+ break;
+
+ HRESULT hr = pGB->RenderFile(CStringW(fn), NULL);
+
+ if (!AfxGetAppSettings().NewFile (fn) && AfxGetAppSettings().fRememberFilePos)
+ {
+ REFERENCE_TIME rtPos = AfxGetAppSettings().CurrentFilePosition()->llPosition;
+ if (pMS) pMS->SetPositions (&rtPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ }
+
+ if(FAILED(hr))
+ {
+ if(fFirst)
+ {
+ if(s.fReportFailedPins)
+ {
+ CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
+ if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, this).DoModal();
+ }
+
+ CString err;
+
+ switch(hr)
+ {
+ case E_ABORT: err = _T("Opening aborted"); break;
+ case E_FAIL: case E_POINTER: default: err = _T("Failed to render the file"); break;
+ case E_INVALIDARG: err = _T("Invalid file name"); break;
+ case E_OUTOFMEMORY: err = _T("Out of memory"); break;
+ case VFW_E_CANNOT_CONNECT: err = _T("Cannot connect the filters"); break;
+ case VFW_E_CANNOT_LOAD_SOURCE_FILTER: err = _T("Cannot load any source filter"); break;
+ case VFW_E_CANNOT_RENDER: err = _T("Cannot render the file"); break;
+ case VFW_E_INVALID_FILE_FORMAT: err = _T("Invalid file format"); break;
+ case VFW_E_NOT_FOUND: err = _T("File not found"); break;
+ case VFW_E_UNKNOWN_FILE_TYPE: err = _T("Unknown file type"); break;
+ case VFW_E_UNSUPPORTED_STREAM: err = _T("Unsupported stream"); break;
+ }
+
+ throw err;
+ }
+ }
+
+ if(s.fKeepHistory)
+ {
+ CRecentFileList* pMRU = fFirst ? &s.MRU : &s.MRUDub;
+ pMRU->ReadList();
+ pMRU->Add(fn);
+ pMRU->WriteList();
+ }
+
+ if(fFirst)
+ {
+ pOFD->title = fn;
+ }
+
+ fFirst = false;
+
+ if(m_fCustomGraph) break;
+ }
+
+ if(s.fReportFailedPins)
+ {
+ CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
+ if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, this).DoModal();
+ }
+
+ if(!(pAMOP = pGB))
+ {
+ BeginEnumFilters(pGB, pEF, pBF)
+ if(pAMOP = pBF) break;
+ EndEnumFilters
+ }
+
+ if(FindFilter(__uuidof(CShoutcastSource), pGB))
+ m_fUpdateInfoBar = true;
+
+ SetupChapters();
+
+ CComQIPtr<IKeyFrameInfo> pKFI;
+ BeginEnumFilters(pGB, pEF, pBF)
+ if(pKFI = pBF) break;
+ EndEnumFilters
+ UINT nKFs = 0, nKFsTmp = 0;
+ if(pKFI && S_OK == pKFI->GetKeyFrameCount(nKFs) && nKFs > 0)
+ {
+ m_kfs.SetCount(nKFsTmp = nKFs);
+ if(S_OK != pKFI->GetKeyFrames(&TIME_FORMAT_MEDIA_TIME, m_kfs.GetData(), nKFsTmp) || nKFsTmp != nKFs)
+ m_kfs.RemoveAll();
+ }
+
+ m_iPlaybackMode = PM_FILE;
+}
+
+void CMainFrame::SetupChapters()
+{
+ ASSERT(m_pCB);
+
+ m_pCB->ChapRemoveAll();
+
+ CInterfaceList<IBaseFilter> pBFs;
+ BeginEnumFilters(pGB, pEF, pBF)
+ pBFs.AddTail(pBF);
+ EndEnumFilters
+
+ POSITION pos;
+
+ pos = pBFs.GetHeadPosition();
+ while(pos && !m_pCB->ChapGetCount())
+ {
+ IBaseFilter* pBF = pBFs.GetNext(pos);
+
+ CComQIPtr<IDSMChapterBag> pCB = pBF;
+ if(!pCB) continue;
+
+ for(DWORD i = 0, cnt = pCB->ChapGetCount(); i < cnt; i++)
+ {
+ REFERENCE_TIME rt;
+ CComBSTR name;
+ if(SUCCEEDED(pCB->ChapGet(i, &rt, &name)))
+ m_pCB->ChapAppend(rt, name);
+ }
+ }
+
+ pos = pBFs.GetHeadPosition();
+ while(pos && !m_pCB->ChapGetCount())
+ {
+ IBaseFilter* pBF = pBFs.GetNext(pos);
+
+ CComQIPtr<IChapterInfo> pCI = pBF;
+ if(!pCI) continue;
+
+ CHAR iso6391[3];
+ ::GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, iso6391, 3);
+ CStringA iso6392 = ISO6391To6392(iso6391);
+ if(iso6392.GetLength() < 3) iso6392 = "eng";
+
+ UINT cnt = pCI->GetChapterCount(CHAPTER_ROOT_ID);
+ for(UINT i = 1; i <= cnt; i++)
+ {
+ UINT cid = pCI->GetChapterId(CHAPTER_ROOT_ID, i);
+
+ ChapterElement ce;
+ if(pCI->GetChapterInfo(cid, &ce))
+ {
+ char pl[3] = {iso6392[0], iso6392[1], iso6392[2]};
+ char cc[] = " ";
+ CComBSTR name;
+ name.Attach(pCI->GetChapterStringInfo(cid, pl, cc));
+ m_pCB->ChapAppend(ce.rtStart, name);
+ }
+ }
+ }
+
+ pos = pBFs.GetHeadPosition();
+ while(pos && !m_pCB->ChapGetCount())
+ {
+ IBaseFilter* pBF = pBFs.GetNext(pos);
+
+ CComQIPtr<IAMExtendedSeeking, &IID_IAMExtendedSeeking> pES = pBF;
+ if(!pES) continue;
+
+ long MarkerCount = 0;
+ if(SUCCEEDED(pES->get_MarkerCount(&MarkerCount)))
+ {
+ for(long i = 1; i <= MarkerCount; i++)
+ {
+ double MarkerTime = 0;
+ if(SUCCEEDED(pES->GetMarkerTime(i, &MarkerTime)))
+ {
+ CStringW name;
+ name.Format(L"Chapter %d", i);
+
+ CComBSTR bstr;
+ if(S_OK == pES->GetMarkerName(i, &bstr))
+ name = bstr;
+
+ m_pCB->ChapAppend(REFERENCE_TIME(MarkerTime*10000000), name);
+ }
+ }
+ }
+ }
+
+ pos = pBFs.GetHeadPosition();
+ while(pos && !m_pCB->ChapGetCount())
+ {
+ IBaseFilter* pBF = pBFs.GetNext(pos);
+
+ if(GetCLSID(pBF) != CLSID_OggSplitter)
+ continue;
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(m_pCB->ChapGetCount()) break;
+
+ if(CComQIPtr<IPropertyBag> pPB = pPin)
+ {
+ for(int i = 1; ; i++)
+ {
+ CStringW str;
+ CComVariant var;
+
+ var.Clear();
+ str.Format(L"CHAPTER%02d", i);
+ if(S_OK != pPB->Read(str, &var, NULL))
+ break;
+
+ int h, m, s, ms;
+ WCHAR wc;
+ if(7 != swscanf(CStringW(var), L"%d%c%d%c%d%c%d", &h, &wc, &m, &wc, &s, &wc, &ms))
+ break;
+
+ CStringW name;
+ name.Format(L"Chapter %d", i);
+ var.Clear();
+ str += L"NAME";
+ if(S_OK == pPB->Read(str, &var, NULL))
+ name = var;
+
+ m_pCB->ChapAppend(10000i64*(((h*60 + m)*60 + s)*1000 + ms), name);
+ }
+ }
+ }
+ EndEnumPins
+ }
+
+ m_pCB->ChapSort();
+}
+
+void CMainFrame::OpenDVD(OpenDVDData* pODD)
+{
+ HRESULT hr = pGB->RenderFile(CStringW(pODD->path), NULL);
+
+ AppSettings& s = AfxGetAppSettings();
+
+ if(s.fReportFailedPins)
+ {
+ CComQIPtr<IGraphBuilderDeadEnd> pGBDE = pGB;
+ if(pGBDE && pGBDE->GetCount()) CMediaTypesDlg(pGBDE, this).DoModal();
+ }
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if((pDVDC = pBF) && (pDVDI = pBF))
+ break;
+ }
+ EndEnumFilters
+
+ if(hr == E_INVALIDARG)
+ throw _T("Cannot find DVD directory");
+ else if(hr == VFW_E_CANNOT_RENDER)
+ throw _T("Failed to render all pins of the DVD Navigator filter");
+ else if(hr == VFW_S_PARTIAL_RENDER)
+ throw _T("Failed to render some of the pins of the DVD Navigator filter");
+ else if(hr == E_NOINTERFACE || !pDVDC || !pDVDI)
+ throw _T("Failed to query the needed interfaces for DVD playback");
+ else if(hr == VFW_E_CANNOT_LOAD_SOURCE_FILTER)
+ throw _T("Can't create the DVD Navigator filter");
+ else if(FAILED(hr))
+ throw _T("Failed");
+
+ WCHAR buff[MAX_PATH];
+ ULONG len = 0;
+ if(SUCCEEDED(hr = pDVDI->GetDVDDirectory(buff, countof(buff), &len)))
+ pODD->title = CString(CStringW(buff));
+
+ // TODO: resetdvd
+ pDVDC->SetOption(DVD_ResetOnStop, FALSE);
+ pDVDC->SetOption(DVD_HMSF_TimeCodeEvents, TRUE);
+
+ if(s.idMenuLang) pDVDC->SelectDefaultMenuLanguage(s.idMenuLang);
+ if(s.idAudioLang) pDVDC->SelectDefaultAudioLanguage(s.idAudioLang, DVD_AUD_EXT_NotSpecified);
+ if(s.idSubtitlesLang) pDVDC->SelectDefaultSubpictureLanguage(s.idSubtitlesLang, DVD_SP_EXT_NotSpecified);
+
+ m_iDVDDomain = DVD_DOMAIN_Stop;
+
+ m_iPlaybackMode = PM_DVD;
+}
+
+void CMainFrame::OpenCapture(OpenDeviceData* pODD)
+{
+ CStringW vidfrname, audfrname;
+ CComPtr<IBaseFilter> pVidCapTmp, pAudCapTmp;
+
+ m_VidDispName = pODD->DisplayName[0];
+
+ if(!m_VidDispName.IsEmpty())
+ {
+ if(!CreateFilter(m_VidDispName, &pVidCapTmp, vidfrname))
+ throw _T("Can't create video capture filter");
+ }
+
+ m_AudDispName = pODD->DisplayName[1];
+
+ if(!m_AudDispName.IsEmpty())
+ {
+ if(!CreateFilter(m_AudDispName, &pAudCapTmp, audfrname))
+ throw _T("Can't create video capture filter");
+ }
+
+ if(!pVidCapTmp && !pAudCapTmp)
+ {
+ throw _T("No capture filters");
+ }
+
+ pCGB = NULL;
+ pVidCap = NULL;
+ pAudCap = NULL;
+
+ if(FAILED(pCGB.CoCreateInstance(CLSID_CaptureGraphBuilder2)))
+ {
+ throw _T("Can't create capture graph builder object");
+ }
+
+ HRESULT hr;
+
+ pCGB->SetFiltergraph(pGB);
+
+ if(pVidCapTmp)
+ {
+ if(FAILED(hr = pGB->AddFilter(pVidCapTmp, vidfrname)))
+ {
+ throw _T("Can't add video capture filter to the graph");
+ }
+
+ pVidCap = pVidCapTmp;
+
+ if(!pAudCapTmp)
+ {
+ if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap))
+ && FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap)))
+ TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
+
+ if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Interleaved, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev))
+ && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev)))
+ TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
+
+ if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, pVidCap, IID_IAMStreamConfig, (void **)&pAMASC))
+ && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Audio, pVidCap, IID_IAMStreamConfig, (void **)&pAMASC)))
+ {
+ TRACE(_T("Warning: No IAMStreamConfig interface for vidcap"));
+ }
+ else
+ {
+ pAudCap = pVidCap;
+ }
+ }
+ else
+ {
+ if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCCap)))
+ TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
+
+ if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMStreamConfig, (void **)&pAMVSCPrev)))
+ TRACE(_T("Warning: No IAMStreamConfig interface for vidcap capture"));
+ }
+
+ if(FAILED(pCGB->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, pVidCap, IID_IAMCrossbar, (void**)&pAMXBar)))
+ TRACE(_T("Warning: No IAMCrossbar interface was found\n"));
+
+ if(FAILED(pCGB->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, pVidCap, IID_IAMTVTuner, (void**)&pAMTuner)))
+ TRACE(_T("Warning: No IAMTVTuner interface was found\n"));
+/*
+ if(pAMVSCCap)
+ {
+//DumpStreamConfig(_T("c:\\mpclog.txt"), pAMVSCCap);
+ CComQIPtr<IAMVfwCaptureDialogs> pVfwCD = pVidCap;
+ if(!pAMXBar && pVfwCD)
+ {
+ m_wndCaptureBar.m_capdlg.SetupVideoControls(viddispname, pAMVSCCap, pVfwCD);
+ }
+ else
+ {
+ m_wndCaptureBar.m_capdlg.SetupVideoControls(viddispname, pAMVSCCap, pAMXBar, pAMTuner);
+ }
+ }
+*/
+ // TODO: init pAMXBar
+
+ if(pAMTuner) // load saved channel
+ {
+ pAMTuner->put_CountryCode(AfxGetApp()->GetProfileInt(_T("Capture"), _T("Country"), 1));
+
+ int vchannel = pODD->vchannel;
+ if(vchannel < 0) vchannel = AfxGetApp()->GetProfileInt(_T("Capture\\") + CString(m_VidDispName), _T("Channel"), -1);
+ if(vchannel >= 0)
+ {
+ OAFilterState fs = State_Stopped;
+ pMC->GetState(0, &fs);
+ if(fs == State_Running) pMC->Pause();
+ pAMTuner->put_Channel(vchannel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT);
+ if(fs == State_Running) pMC->Run();
+ }
+ }
+ }
+
+ if(pAudCapTmp)
+ {
+ if(FAILED(hr = pGB->AddFilter(pAudCapTmp, CStringW(audfrname))))
+ {
+ throw _T("Can't add audio capture filter to the graph");
+ }
+
+ pAudCap = pAudCapTmp;
+
+ if(FAILED(pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, pAudCap, IID_IAMStreamConfig, (void **)&pAMASC))
+ && FAILED(pCGB->FindInterface(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Audio, pAudCap, IID_IAMStreamConfig, (void **)&pAMASC)))
+ {
+ TRACE(_T("Warning: No IAMStreamConfig interface for vidcap"));
+ }
+/*
+ CInterfaceArray<IAMAudioInputMixer> pAMAIM;
+
+ BeginEnumPins(pAudCap, pEP, pPin)
+ {
+ PIN_DIRECTION dir;
+ if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_INPUT)
+ continue;
+
+ if(CComQIPtr<IAMAudioInputMixer> pAIM = pPin)
+ pAMAIM.Add(pAIM);
+ }
+ EndEnumPins
+
+ if(pAMASC)
+ {
+ m_wndCaptureBar.m_capdlg.SetupAudioControls(auddispname, pAMASC, pAMAIM);
+ }
+*/
+ }
+
+ if(!(pVidCap || pAudCap))
+ {
+ throw _T("Couldn't open any device");
+ }
+
+ pODD->title = _T("Live");
+
+ m_iPlaybackMode = PM_CAPTURE;
+}
+
+void CMainFrame::OpenCustomizeGraph()
+{
+ if(m_iPlaybackMode == PM_CAPTURE)
+ return;
+
+ CleanGraph();
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ if(m_pCAP)
+ AddTextPassThruFilter();
+ }
+
+ if(m_iPlaybackMode == PM_DVD)
+ {
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if(CComQIPtr<IDirectVobSub2> pDVS2 = pBF)
+ {
+// pDVS2->AdviseSubClock(m_pSubClock = new CSubClock);
+// break;
+
+ // TODO: test multiple dvobsub instances with one clock
+ if(!m_pSubClock) m_pSubClock = new CSubClock;
+ pDVS2->AdviseSubClock(m_pSubClock);
+ }
+ }
+ EndEnumFilters
+ }
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if(GetCLSID(pBF) == CLSID_OggSplitter)
+ {
+ if(CComQIPtr<IAMStreamSelect> pSS = pBF)
+ {
+ LCID idAudio = AfxGetAppSettings().idAudioLang;
+ if(!idAudio) idAudio = GetUserDefaultLCID();
+ LCID idSub = AfxGetAppSettings().idSubtitlesLang;
+ if(!idSub) idSub = GetUserDefaultLCID();
+
+ DWORD cnt = 0;
+ pSS->Count(&cnt);
+ for(DWORD i = 0; i < cnt; i++)
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+ DWORD dwFlags = 0;
+ LCID lcid = 0;
+ DWORD dwGroup = 0;
+ WCHAR* pszName = NULL;
+ if(SUCCEEDED(pSS->Info((long)i, &pmt, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL)))
+ {
+ CStringW name(pszName), sound(L"Sound"), subtitle(L"Subtitle");
+
+ if(idAudio != -1 && (idAudio&0x3ff) == (lcid&0x3ff) // sublang seems to be zeroed out in ogm...
+ && name.GetLength() > sound.GetLength()
+ && !name.Left(sound.GetLength()).CompareNoCase(sound))
+ {
+ if(SUCCEEDED(pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE)))
+ idAudio = -1;
+ }
+
+ if(idSub != -1 && (idSub&0x3ff) == (lcid&0x3ff) // sublang seems to be zeroed out in ogm...
+ && name.GetLength() > subtitle.GetLength()
+ && !name.Left(subtitle.GetLength()).CompareNoCase(subtitle)
+ && name.Mid(subtitle.GetLength()).Trim().CompareNoCase(L"off"))
+ {
+ if(SUCCEEDED(pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE)))
+ idSub = -1;
+ }
+
+ if(pmt) DeleteMediaType(pmt);
+ if(pszName) CoTaskMemFree(pszName);
+ }
+ }
+ }
+ }
+ }
+ EndEnumFilters
+
+ CleanGraph();
+}
+
+void CMainFrame::OpenSetupVideo()
+{
+ m_fAudioOnly = true;
+
+ if(m_pCAP)
+ {
+ CSize vs = m_pCAP->GetVideoSize();
+ m_fAudioOnly = (vs.cx <= 0 || vs.cy <= 0);
+ }
+ else
+ {
+ {
+ long w = 0, h = 0;
+
+ if(CComQIPtr<IBasicVideo> pBV = pGB)
+ {
+ pBV->GetVideoSize(&w, &h);
+ }
+
+ if(w > 0 && h > 0)
+ {
+ m_fAudioOnly = false;
+ }
+ }
+
+ if(m_fAudioOnly)
+ {
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ long w = 0, h = 0;
+
+ if(CComQIPtr<IVideoWindow> pVW = pBF)
+ {
+ long lVisible;
+ if(FAILED(pVW->get_Visible(&lVisible)))
+ continue;
+
+ pVW->get_Width(&w);
+ pVW->get_Height(&h);
+ }
+
+ if(w > 0 && h > 0)
+ {
+ m_fAudioOnly = false;
+ break;
+ }
+ }
+ EndEnumFilters
+ }
+ }
+
+ if(m_fShockwaveGraph)
+ {
+ m_fAudioOnly = false;
+ }
+
+ if(m_pCAP)
+ {
+ SetShaders();
+ }
+ // else
+ {
+ // TESTME
+
+ pVW->put_Owner((OAHWND)m_pVideoWnd->m_hWnd);
+ pVW->put_WindowStyle(WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN);
+ pVW->put_MessageDrain((OAHWND)m_hWnd);
+
+ for(CWnd* pWnd = m_wndView.GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
+ pWnd->EnableWindow(FALSE); // little trick to let WM_SETCURSOR thru
+ }
+}
+
+void CMainFrame::OpenSetupAudio()
+{
+ pBA->put_Volume(m_wndToolBar.Volume);
+
+ // FIXME
+ int balance = AfxGetAppSettings().nBalance;
+ int sign = balance>0?-1:1;
+ balance = max(100-abs(balance), 1);
+ balance = (int)((log10(1.0*balance)-2)*5000*sign);
+ balance = max(min(balance, 10000), -10000);
+ pBA->put_Balance(balance);
+}
+/*
+void CMainFrame::OpenSetupToolBar()
+{
+// m_wndToolBar.Volume = AfxGetAppSettings().nVolume;
+// SetBalance(AfxGetAppSettings().nBalance);
+}
+*/
+void CMainFrame::OpenSetupCaptureBar()
+{
+ if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ if(pVidCap && pAMVSCCap)
+ {
+ CComQIPtr<IAMVfwCaptureDialogs> pVfwCD = pVidCap;
+
+ if(!pAMXBar && pVfwCD)
+ {
+ m_wndCaptureBar.m_capdlg.SetupVideoControls(m_VidDispName, pAMVSCCap, pVfwCD);
+ }
+ else
+ {
+ m_wndCaptureBar.m_capdlg.SetupVideoControls(m_VidDispName, pAMVSCCap, pAMXBar, pAMTuner);
+ }
+ }
+
+ if(pAudCap && pAMASC)
+ {
+ CInterfaceArray<IAMAudioInputMixer> pAMAIM;
+
+ BeginEnumPins(pAudCap, pEP, pPin)
+ {
+ if(CComQIPtr<IAMAudioInputMixer> pAIM = pPin)
+ pAMAIM.Add(pAIM);
+ }
+ EndEnumPins
+
+ m_wndCaptureBar.m_capdlg.SetupAudioControls(m_AudDispName, pAMASC, pAMAIM);
+ }
+ }
+
+ BuildGraphVideoAudio(
+ m_wndCaptureBar.m_capdlg.m_fVidPreview, false,
+ m_wndCaptureBar.m_capdlg.m_fAudPreview, false);
+}
+
+void CMainFrame::OpenSetupInfoBar()
+{
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ bool fEmpty = true;
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF)
+ {
+ CComBSTR bstr;
+ if(SUCCEEDED(pAMMC->get_Title(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_TITLE), bstr.m_str); if(bstr.Length()) fEmpty = false;}
+ if(SUCCEEDED(pAMMC->get_AuthorName(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_AUTHOR), bstr.m_str); if(bstr.Length()) fEmpty = false;}
+ if(SUCCEEDED(pAMMC->get_Copyright(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_COPYRIGHT), bstr.m_str); if(bstr.Length()) fEmpty = false;}
+ if(SUCCEEDED(pAMMC->get_Rating(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_RATING), bstr.m_str); if(bstr.Length()) fEmpty = false;}
+ if(SUCCEEDED(pAMMC->get_Description(&bstr))) {m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DESCRIPTION), bstr.m_str); if(bstr.Length()) fEmpty = false;}
+ if(!fEmpty)
+ {
+ RecalcLayout();
+ break;
+ }
+ }
+ }
+ EndEnumFilters
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ CString info('-');
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_DOMAIN), info);
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_LOCATION), info);
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_VIDEO), info);
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_AUDIO), info);
+ m_wndInfoBar.SetLine(ResStr(IDS_INFOBAR_SUBTITLES), info);
+ RecalcLayout();
+ }
+}
+
+void CMainFrame::OpenSetupStatsBar()
+{
+ CString info('-');
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if(!pQP && (pQP = pBF))
+ {
+ m_wndStatsBar.SetLine(_T("Frame-rate"), info);
+ m_wndStatsBar.SetLine(_T("Sync Offset"), info);
+ m_wndStatsBar.SetLine(_T("Frames"), info);
+ m_wndStatsBar.SetLine(_T("Jitter"), info);
+ m_wndStatsBar.SetLine(_T("Buffers"), info);
+ m_wndStatsBar.SetLine(_T("Bitrate"), info);
+ RecalcLayout();
+ }
+
+ if(!pBI && (pBI = pBF))
+ {
+ m_wndStatsBar.SetLine(_T("Buffers"), info);
+ m_wndStatsBar.SetLine(_T("Bitrate"), info); // FIXME: shouldn't be here
+ RecalcLayout();
+ }
+ }
+ EndEnumFilters
+}
+
+void CMainFrame::OpenSetupStatusBar()
+{
+ m_wndStatusBar.ShowTimer(true);
+
+ //
+
+ if(!m_fCustomGraph)
+ {
+ UINT id = IDB_NOAUDIO;
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ CComQIPtr<IBasicAudio> pBA = pBF;
+ if(!pBA) continue;
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(S_OK == pGB->IsPinDirection(pPin, PINDIR_INPUT)
+ && S_OK == pGB->IsPinConnected(pPin))
+ {
+ AM_MEDIA_TYPE mt;
+ memset(&mt, 0, sizeof(mt));
+ pPin->ConnectionMediaType(&mt);
+
+ if(mt.majortype == MEDIATYPE_Audio && mt.formattype == FORMAT_WaveFormatEx)
+ {
+ switch(((WAVEFORMATEX*)mt.pbFormat)->nChannels)
+ {
+ case 1: id = IDB_MONO; break;
+ case 2: default: id = IDB_STEREO; break;
+ }
+ break;
+ }
+ else if(mt.majortype == MEDIATYPE_Midi)
+ {
+ id = NULL;
+ break;
+ }
+ }
+ }
+ EndEnumPins
+
+ if(id != IDB_NOAUDIO)
+ {
+ break;
+ }
+ }
+ EndEnumFilters
+
+ m_wndStatusBar.SetStatusBitmap(id);
+ }
+
+ //
+
+ HICON hIcon = NULL;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ CString fn = m_wndPlaylistBar.GetCur();
+ CString ext = fn.Mid(fn.ReverseFind('.')+1);
+ hIcon = LoadIcon(ext, true);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ hIcon = LoadIcon(_T(".ifo"), true);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ // hIcon = ; // TODO
+ }
+
+ m_wndStatusBar.SetStatusTypeIcon(hIcon);
+}
+
+void CMainFrame::OpenSetupWindowTitle(CString fn)
+{
+ CString title(MAKEINTRESOURCE(IDR_MAINFRAME));
+
+ AppSettings& s = AfxGetAppSettings();
+
+ int i = s.iTitleBarTextStyle;
+
+ if(!fn.IsEmpty() && (i == 0 || i == 1))
+ {
+ if(i == 1)
+ {
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ fn.Replace('\\', '/');
+ CString fn2 = fn.Mid(fn.ReverseFind('/')+1);
+ if(!fn2.IsEmpty()) fn = fn2;
+ if(s.fTitleBarTextTitle)
+ {
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF)
+ {
+ CComBSTR bstr;
+ if(SUCCEEDED(pAMMC->get_Title(&bstr)) && bstr.Length())
+ {
+ fn = CString(bstr.m_str);
+ break;
+ }
+ }
+ }
+ EndEnumFilters
+ }
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ fn = _T("DVD");
+ }
+ else if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ fn = _T("Live");
+ }
+ }
+
+ title = fn + _T(" - ") + title;
+ }
+
+ SetWindowText(title);
+}
+
+bool CMainFrame::OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ if(m_iMediaLoadState != MLS_CLOSED)
+ {
+ ASSERT(0);
+ return(false);
+ }
+
+ if(!dynamic_cast<OpenFileData*>(pOMD.m_p)
+ && !dynamic_cast<OpenDVDData*>(pOMD.m_p)
+ && !dynamic_cast<OpenDeviceData*>(pOMD.m_p))
+ {
+ ASSERT(0);
+ return(false);
+ }
+
+ if(OpenFileData* pOFD = dynamic_cast<OpenFileData*>(pOMD.m_p))
+ {
+ if(pOFD->fns.IsEmpty())
+ return(false);
+
+ CString fn = pOFD->fns.GetHead();
+
+ int i = fn.Find(_T(":\\"));
+ if(i > 0)
+ {
+ CString drive = fn.Left(i+2);
+ UINT type = GetDriveType(drive);
+ CAtlList<CString> sl;
+ if(type == DRIVE_REMOVABLE || type == DRIVE_CDROM && GetCDROMType(drive[0], sl) != CDROM_Audio)
+ {
+ int ret = IDRETRY;
+ while(ret == IDRETRY)
+ {
+ WIN32_FIND_DATA findFileData;
+ HANDLE h = FindFirstFile(fn, &findFileData);
+ if(h != INVALID_HANDLE_VALUE)
+ {
+ FindClose(h);
+ ret = IDOK;
+ }
+ else
+ {
+ CString msg;
+ msg.Format(_T("%s was not found, please insert media containing this file."), fn);
+ ret = AfxMessageBox(msg, MB_RETRYCANCEL);
+ }
+ }
+
+ if(ret != IDOK)
+ return(false);
+ }
+ }
+ }
+
+ m_iMediaLoadState = MLS_LOADING;
+
+ // FIXME: Don't show "Closed" initially
+ PostMessage(WM_KICKIDLE);
+
+ CString err, aborted(_T("Aborted"));
+
+ m_fUpdateInfoBar = false;
+
+ try
+ {
+ CComQIPtr<IVMRMixerBitmap9> pVMB;
+ if(m_fOpeningAborted) throw aborted;
+
+ OpenCreateGraphObject(pOMD);
+
+ if(m_fOpeningAborted) throw aborted;
+
+ SetupIViAudReg();
+
+ if(m_fOpeningAborted) throw aborted;
+
+ if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD.m_p)) OpenFile(p);
+ else if(OpenDVDData* p = dynamic_cast<OpenDVDData*>(pOMD.m_p)) OpenDVD(p);
+ else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p)) OpenCapture(p);
+ else throw _T("Can't open, invalid input parameters");
+
+ pGB->FindInterface(__uuidof(ISubPicAllocatorPresenter), (void**)&m_pCAP, TRUE);
+ pGB->FindInterface(__uuidof(IVMRMixerControl9), (void**)&m_pMC, TRUE);
+ pGB->FindInterface(__uuidof(IVMRMixerBitmap9), (void**)&pVMB, TRUE);
+ if (pVMB) m_OSD.Start (m_pVideoWnd, pVMB);
+ if (m_pMC)
+ {
+ m_pMC->GetProcAmpControlRange (0, (VMR9ProcAmpControlRange*)AfxGetMyApp()->GetColorControl (Brightness));
+ m_pMC->GetProcAmpControlRange (0, (VMR9ProcAmpControlRange*)AfxGetMyApp()->GetColorControl (Contrast));
+ m_pMC->GetProcAmpControlRange (0, (VMR9ProcAmpControlRange*)AfxGetMyApp()->GetColorControl (Hue));
+ m_pMC->GetProcAmpControlRange (0, (VMR9ProcAmpControlRange*)AfxGetMyApp()->GetColorControl (Saturation));
+ SetVMR9ColorControl(s.dBrightness, s.dContrast, s.dHue, s.dSaturation);
+ }
+
+ if(m_fOpeningAborted) throw aborted;
+
+ OpenCustomizeGraph();
+
+ if(m_fOpeningAborted) throw aborted;
+
+ OpenSetupVideo();
+
+ if(m_fOpeningAborted) throw aborted;
+
+ OpenSetupAudio();
+
+ if(m_fOpeningAborted) throw aborted;
+
+ if(m_pCAP && (!m_fAudioOnly || m_fRealMediaGraph))
+ {
+ POSITION pos = pOMD->subs.GetHeadPosition();
+ while(pos) LoadSubtitle(pOMD->subs.GetNext(pos));
+
+ if(AfxGetAppSettings().fEnableSubtitles && m_pSubStreams.GetCount() > 0)
+ SetSubtitle(m_pSubStreams.GetHead());
+ }
+
+ if(m_fOpeningAborted) throw aborted;
+
+ OpenSetupWindowTitle(pOMD->title);
+
+ if(::GetCurrentThreadId() == AfxGetApp()->m_nThreadID)
+ {
+ OnFilePostOpenmedia();
+ }
+ else
+ {
+ PostMessage(WM_COMMAND, ID_FILE_POST_OPENMEDIA);
+ }
+
+ while(m_iMediaLoadState != MLS_LOADED
+ && m_iMediaLoadState != MLS_CLOSING // FIXME
+ )
+ {
+ Sleep(50);
+ }
+
+ // PostMessage instead of SendMessage because the user might call CloseMedia and then we would deadlock
+
+ PostMessage(WM_COMMAND, ID_PLAY_PAUSE);
+
+ if(!(AfxGetAppSettings().nCLSwitches&CLSW_OPEN))
+ PostMessage(WM_COMMAND, ID_PLAY_PLAY);
+
+ AfxGetAppSettings().nCLSwitches &= ~CLSW_OPEN;
+
+ if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD.m_p))
+ {
+ if(p->rtStart > 0)
+ PostMessage(WM_RESUMEFROMSTATE, (WPARAM)PM_FILE, (LPARAM)(p->rtStart/10000)); // REFERENCE_TIME doesn't fit in LPARAM under a 32bit env.
+ }
+ else if(OpenDVDData* p = dynamic_cast<OpenDVDData*>(pOMD.m_p))
+ {
+ if(p->pDvdState)
+ PostMessage(WM_RESUMEFROMSTATE, (WPARAM)PM_DVD, (LPARAM)(CComPtr<IDvdState>(p->pDvdState).Detach())); // must be released by the called message handler
+ }
+ else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p))
+ {
+ m_wndCaptureBar.m_capdlg.SetVideoInput(p->vinput);
+ m_wndCaptureBar.m_capdlg.SetVideoChannel(p->vchannel);
+ m_wndCaptureBar.m_capdlg.SetAudioInput(p->ainput);
+ }
+ }
+ catch(LPCTSTR msg)
+ {
+ err = msg;
+ }
+ catch(CString msg)
+ {
+ err = msg;
+ }
+
+ if(!err.IsEmpty())
+ {
+ CloseMediaPrivate();
+ m_closingmsg = err;
+
+ OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD.m_p);
+ if(p && err != aborted)
+ {
+ m_wndPlaylistBar.SetCurValid(false);
+ if(m_wndPlaylistBar.GetCount() > 1)
+ {
+ CPlaylistItem pli[2];
+ m_wndPlaylistBar.GetCur(pli[0]);
+ m_wndPlaylistBar.SetNext();
+ m_wndPlaylistBar.GetCur(pli[1]);
+ if(pli[0].m_id != pli[1].m_id)
+ {
+ CAutoPtr<OpenMediaData> p(m_wndPlaylistBar.GetCurOMD());
+ if(p) OpenMediaPrivate(p);
+ }
+ }
+ }
+ }
+ else
+ {
+ m_wndPlaylistBar.SetCurValid(true);
+ }
+
+ PostMessage(WM_KICKIDLE); // calls main thread to update things
+
+ return(err.IsEmpty());
+}
+
+void CMainFrame::CloseMediaPrivate()
+{
+ m_iMediaLoadState = MLS_CLOSING;
+
+ OnPlayStop(); // SendMessage(WM_COMMAND, ID_PLAY_STOP);
+
+ m_iPlaybackMode = PM_NONE;
+ m_iSpeedLevel = 0;
+
+ m_fLiveWM = false;
+
+ m_fEndOfStream = false;
+
+ m_rtDurationOverride = -1;
+
+ m_kfs.RemoveAll();
+
+ m_pCB = NULL;
+
+// if(pVW) pVW->put_Visible(OAFALSE);
+// if(pVW) pVW->put_MessageDrain((OAHWND)NULL), pVW->put_Owner((OAHWND)NULL);
+
+ m_pCAP = NULL; // IMPORTANT: IVMRSurfaceAllocatorNotify/IVMRSurfaceAllocatorNotify9 has to be released before the VMR/VMR9, otherwise it will crash in Release()
+ m_pMC = NULL;
+ m_OSD.Stop();
+
+ pAMXBar.Release(); pAMTuner.Release(); pAMDF.Release();
+ pAMVCCap.Release(); pAMVCPrev.Release(); pAMVSCCap.Release(); pAMVSCPrev.Release(); pAMASC.Release();
+ pVidCap.Release(); pAudCap.Release();
+ pCGB.Release();
+ pDVDC.Release(); pDVDI.Release();
+ pQP.Release(); pBI.Release(); pAMOP.Release(); pFS.Release();
+ pMC.Release(); pME.Release(); pMS.Release();
+ pVW.Release(); pBV.Release();
+ pBA.Release();
+
+ if(pGB) pGB->RemoveFromROT();
+ pGB.Release();
+
+ m_fRealMediaGraph = m_fShockwaveGraph = m_fQuicktimeGraph = false;
+
+ m_pSubClock = NULL;
+
+ m_pProv.Release();
+
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+ m_pSubStreams.RemoveAll();
+ }
+
+ m_VidDispName.Empty();
+ m_AudDispName.Empty();
+
+ m_closingmsg = ResStr(IDS_CONTROLS_CLOSED);
+
+ AfxGetAppSettings().nCLSwitches &= CLSW_OPEN|CLSW_PLAY|CLSW_AFTERPLAYBACK_MASK|CLSW_NOFOCUS;
+
+ m_iMediaLoadState = MLS_CLOSED;
+}
+
+// msn
+
+void CMainFrame::SendNowPlayingToMSN()
+{
+ if(!AfxGetAppSettings().fNotifyMSN)
+ return;
+
+ CString title, author;
+
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_TITLE), title);
+ m_wndInfoBar.GetLine(ResStr(IDS_INFOBAR_AUTHOR), author);
+
+ if(title.IsEmpty())
+ {
+ CPlaylistItem pli;
+ m_wndPlaylistBar.GetCur(pli);
+
+ if(!pli.m_fns.IsEmpty())
+ {
+ CString label = !pli.m_label.IsEmpty() ? pli.m_label : pli.m_fns.GetHead();
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ CString fn = label;
+ if(fn.Find(_T("://")) >= 0) {int i = fn.Find('?'); if(i >= 0) fn = fn.Left(i);}
+ CPath path(fn);
+ path.StripPath();
+ path.MakePretty();
+ path.RemoveExtension();
+ title = (LPCTSTR)path;
+ author.Empty();
+ }
+ else if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ title = label != pli.m_fns.GetHead() ? label : _T("Live");
+ author.Empty();
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ title = _T("DVD");
+ author.Empty();
+ }
+ }
+ }
+ }
+
+ CStringW buff;
+ buff += L"\\0Music\\0";
+ buff += title.IsEmpty() ? L"0" : L"1";
+ buff += L"\\0";
+ buff += author.IsEmpty() ? L"{0}" : L"{0} - {1}";
+ buff += L"\\0";
+ if(!author.IsEmpty()) {buff += CStringW(author) + L"\\0";}
+ buff += CStringW(title) + L"\\0";
+ buff += L"\\0\\0";
+
+ COPYDATASTRUCT data;
+ data.dwData = 0x0547;
+ data.lpData = (PVOID)(LPCWSTR)buff;
+ data.cbData = buff.GetLength() * 2 + 2;
+
+ HWND hWnd = NULL;
+ while(hWnd = ::FindWindowEx(NULL, hWnd, _T("MsnMsgrUIManager"), NULL))
+ ::SendMessage(hWnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&data);
+}
+
+// mIRC
+
+void CMainFrame::SendNowPlayingTomIRC()
+{
+ if(!AfxGetAppSettings().fNotifyGTSdll)
+ return;
+
+ for(int i = 0; i < 20; i++)
+ {
+ HANDLE hFMap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 1024, _T("mIRC"));
+ if(!hFMap) return;
+
+ if(GetLastError() == ERROR_ALREADY_EXISTS)
+ {
+ CloseHandle(hFMap);
+ Sleep(50);
+ continue;
+ }
+
+ if(LPVOID lpMappingAddress = MapViewOfFile(hFMap, FILE_MAP_WRITE, 0, 0, 0))
+ {
+ LPCSTR cmd = m_fAudioOnly ? "/.timerAUDGTS 1 5 mpcaud" : "/.timerVIDGTS 1 5 mpcvid";
+ strcpy((char*)lpMappingAddress, cmd);
+
+ if(HWND hWnd = ::FindWindow(_T("mIRC"), NULL))
+ ::SendMessage(hWnd, (WM_USER + 200), (WPARAM)1, (LPARAM)0);
+
+ UnmapViewOfFile(lpMappingAddress);
+ }
+
+ CloseHandle(hFMap);
+
+ break;
+ }
+}
+
+// dynamic menus
+
+void CMainFrame::SetupOpenCDSubMenu()
+{
+ CMenu* pSub = &m_opencds;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ if(m_iMediaLoadState == MLS_LOADING) return;
+
+ if(AfxGetAppSettings().fHideCDROMsSubMenu) return;
+
+ UINT id = ID_FILE_OPEN_CD_START;
+
+ for(TCHAR drive = 'C'; drive <= 'Z'; drive++)
+ {
+ CString label = GetDriveLabel(drive), str;
+
+ CAtlList<CString> files;
+ switch(GetCDROMType(drive, files))
+ {
+ case CDROM_Audio:
+ if(label.IsEmpty()) label = _T("Audio CD");
+ str.Format(_T("%s (%c:)"), label, drive);
+ break;
+ case CDROM_VideoCD:
+ if(label.IsEmpty()) label = _T("(S)VCD");
+ str.Format(_T("%s (%c:)"), label, drive);
+ break;
+ case CDROM_DVDVideo:
+ if(label.IsEmpty()) label = _T("DVD Video");
+ str.Format(_T("%s (%c:)"), label, drive);
+ break;
+ default:
+ break;
+ }
+
+ if(!str.IsEmpty())
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, str);
+ }
+}
+
+void CMainFrame::SetupFiltersSubMenu()
+{
+ CMenu* pSub = &m_filters;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ m_filterpopups.RemoveAll();
+
+ m_pparray.RemoveAll();
+ m_ssarray.RemoveAll();
+
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ UINT idf = 0;
+ UINT ids = ID_FILTERS_SUBITEM_START;
+ UINT idl = ID_FILTERSTREAMS_SUBITEM_START;
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ CString name(GetFilterName(pBF));
+ if(name.GetLength() >= 43) name = name.Left(40) + _T("...");
+
+ CLSID clsid = GetCLSID(pBF);
+ if(clsid == CLSID_AVIDec)
+ {
+ CComPtr<IPin> pPin = GetFirstPin(pBF);
+ AM_MEDIA_TYPE mt;
+ if(pPin && SUCCEEDED(pPin->ConnectionMediaType(&mt)))
+ {
+ DWORD c = ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression;
+ switch(c)
+ {
+ case BI_RGB: name += _T(" (RGB)"); break;
+ case BI_RLE4: name += _T(" (RLE4)"); break;
+ case BI_RLE8: name += _T(" (RLE8)"); break;
+ case BI_BITFIELDS: name += _T(" (BITF)"); break;
+ default: name.Format(_T("%s (%c%c%c%c)"),
+ CString(name), (TCHAR)((c>>0)&0xff), (TCHAR)((c>>8)&0xff), (TCHAR)((c>>16)&0xff), (TCHAR)((c>>24)&0xff)); break;
+ }
+ }
+ }
+ else if(clsid == CLSID_ACMWrapper)
+ {
+ CComPtr<IPin> pPin = GetFirstPin(pBF);
+ AM_MEDIA_TYPE mt;
+ if(pPin && SUCCEEDED(pPin->ConnectionMediaType(&mt)))
+ {
+ WORD c = ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag;
+ name.Format(_T("%s (0x%04x)"), CString(name), (int)c);
+ }
+ }
+ else if(clsid == __uuidof(CTextPassThruFilter) || clsid == __uuidof(CNullTextRenderer)
+ || clsid == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) // ISCR
+ {
+ // hide these
+ continue;
+ }
+
+ CAutoPtr<CMenu> pSubSub(new CMenu);
+ pSubSub->CreatePopupMenu();
+
+ int nPPages = 0;
+
+ CComQIPtr<ISpecifyPropertyPages> pSPP = pBF;
+
+/* if(pSPP)
+ {
+ CAUUID caGUID;
+ caGUID.pElems = NULL;
+ if(SUCCEEDED(pSPP->GetPages(&caGUID)) && caGUID.cElems > 0)
+ {
+*/ m_pparray.Add(pBF);
+ pSubSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids, _T("&Properties..."));
+/*
+ if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+*/
+ nPPages++;
+/* }
+ }
+*/
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ CString name = GetPinName(pPin);
+ name.Replace(_T("&"), _T("&&"));
+
+ if(pSPP = pPin)
+ {
+ CAUUID caGUID;
+ caGUID.pElems = NULL;
+ if(SUCCEEDED(pSPP->GetPages(&caGUID)) && caGUID.cElems > 0)
+ {
+ m_pparray.Add(pPin);
+ pSubSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids+nPPages, name + _T(" (pin) properties..."));
+
+ if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+
+ nPPages++;
+ }
+ }
+ }
+ EndEnumPins
+
+ CComQIPtr<IAMStreamSelect> pSS = pBF;
+ if(pSS)
+ {
+ DWORD nStreams = 0, flags, group, prevgroup = -1;
+ LCID lcid;
+ WCHAR* wname = NULL;
+ CComPtr<IUnknown> pObj, pUnk;
+
+ pSS->Count(&nStreams);
+
+ if(nStreams > 0 && nPPages > 0) pSubSub->AppendMenu(MF_SEPARATOR|MF_ENABLED);
+
+ UINT idlstart = idl;
+
+ for(DWORD i = 0; i < nStreams; i++, pObj = NULL, pUnk = NULL)
+ {
+ m_ssarray.Add(pSS);
+
+ flags = group = 0;
+ wname = NULL;
+ pSS->Info(i, NULL, &flags, &lcid, &group, &wname, &pObj, &pUnk);
+
+ if(group != prevgroup && idl > idlstart)
+ pSubSub->AppendMenu(MF_SEPARATOR|MF_ENABLED);
+ prevgroup = group;
+
+ if(flags & AMSTREAMSELECTINFO_EXCLUSIVE)
+ {
+ }
+ else if(flags & AMSTREAMSELECTINFO_ENABLED)
+ {
+ }
+
+ if(!wname)
+ {
+ CStringW stream(L"Unknown Stream");
+ wname = (WCHAR*)CoTaskMemAlloc((stream.GetLength()+3+1)*sizeof(WCHAR));
+ swprintf(wname, L"%s %d", stream, min(i+1,999));
+ }
+
+ CString name(wname);
+ name.Replace(_T("&"), _T("&&"));
+
+ pSubSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, idl++, name);
+
+ CoTaskMemFree(wname);
+ }
+
+ if(nStreams == 0) pSS.Release();
+ }
+
+ if(nPPages == 1 && !pSS)
+ {
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ids, name);
+ }
+ else
+ {
+ pSub->AppendMenu(MF_BYPOSITION|MF_STRING|MF_DISABLED|MF_GRAYED, idf, name);
+
+ if(nPPages > 0 || pSS)
+ {
+ MENUITEMINFO mii;
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_STATE|MIIM_SUBMENU;
+ mii.fType = MF_POPUP;
+ mii.hSubMenu = pSubSub->m_hMenu;
+ mii.fState = (pSPP || pSS) ? MF_ENABLED : (MF_DISABLED|MF_GRAYED);
+ pSub->SetMenuItemInfo(idf, &mii, TRUE);
+
+ m_filterpopups.Add(pSubSub);
+ }
+ }
+
+ ids += nPPages;
+ idf++;
+ }
+ EndEnumFilters
+ }
+}
+
+void CMainFrame::SetupAudioSwitcherSubMenu()
+{
+ CMenu* pSub = &m_audios;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ if(m_iMediaLoadState == MLS_LOADED)
+ {
+ UINT id = ID_AUDIO_SUBITEM_START;
+
+ CComQIPtr<IAMStreamSelect> pSS = FindFilter(__uuidof(CAudioSwitcherFilter), pGB);
+ if(!pSS) pSS = FindFilter(L"{D3CD7858-971A-4838-ACEC-40CA5D529DC8}", pGB);
+
+ if(pSS)
+ {
+ DWORD cStreams = 0;
+ if(SUCCEEDED(pSS->Count(&cStreams)) && cStreams > 0)
+ {
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_OPTIONS));
+ pSub->AppendMenu(MF_SEPARATOR|MF_ENABLED);
+
+ for(int i = 0; i < (int)cStreams; i++)
+ {
+ WCHAR* pName = NULL;
+ if(FAILED(pSS->Info(i, NULL, NULL, NULL, NULL, &pName, NULL, NULL)))
+ break;
+
+ CString name(pName);
+ name.Replace(_T("&"), _T("&&"));
+
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, name);
+
+ CoTaskMemFree(pName);
+ }
+ }
+ }
+ }
+}
+
+void CMainFrame::SetupSubtitlesSubMenu()
+{
+ CMenu* pSub = &m_subtitles;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ if(m_iMediaLoadState != MLS_LOADED || m_fAudioOnly || !m_pCAP)
+ return;
+
+ UINT id = ID_SUBTITLES_SUBITEM_START;
+
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+
+ if(pos)
+ {
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_OPTIONS));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_STYLES));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_RELOAD));
+ pSub->AppendMenu(MF_SEPARATOR);
+
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SUBTITLES_ENABLE));
+ pSub->AppendMenu(MF_SEPARATOR);
+ }
+
+ while(pos)
+ {
+ CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
+ if(!pSubStream) continue;
+
+ for(int i = 0, j = pSubStream->GetStreamCount(); i < j; i++)
+ {
+ WCHAR* pName = NULL;
+ if(SUCCEEDED(pSubStream->GetStreamInfo(i, &pName, NULL)))
+ {
+ CString name(pName);
+ name.Replace(_T("&"), _T("&&"));
+
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, name);
+ CoTaskMemFree(pName);
+ }
+ else
+ {
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, _T("<Unknown>"));
+ }
+ }
+
+ // TODO: find a better way to group these entries
+ if(pos && m_pSubStreams.GetAt(pos))
+ {
+ CLSID cur, next;
+ pSubStream->GetClassID(&cur);
+ m_pSubStreams.GetAt(pos)->GetClassID(&next);
+
+ if(cur != next)
+ pSub->AppendMenu(MF_SEPARATOR);
+ }
+ }
+}
+
+void CMainFrame::SetupNavAudioSubMenu()
+{
+ CMenu* pSub = &m_navaudio;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ UINT id = ID_NAVIGATE_AUDIO_SUBITEM_START;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ SetupNavStreamSelectSubMenu(pSub, id, 1);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ ULONG ulStreamsAvailable, ulCurrentStream;
+ if(FAILED(pDVDI->GetCurrentAudio(&ulStreamsAvailable, &ulCurrentStream)))
+ return;
+
+ LCID DefLanguage;
+ DVD_AUDIO_LANG_EXT ext;
+ if(FAILED(pDVDI->GetDefaultAudioLanguage(&DefLanguage, &ext)))
+ return;
+
+ for(ULONG i = 0; i < ulStreamsAvailable; i++)
+ {
+ LCID Language;
+ if(FAILED(pDVDI->GetAudioLanguage(i, &Language)))
+ continue;
+
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+ if(Language == DefLanguage) flags |= MF_DEFAULT;
+ if(i == ulCurrentStream) flags |= MF_CHECKED;
+
+ CString str(_T("Unknown"));
+ if(Language)
+ {
+ int len = GetLocaleInfo(Language, LOCALE_SENGLANGUAGE, str.GetBuffer(256), 256);
+ str.ReleaseBufferSetLength(max(len-1, 0));
+ }
+
+ DVD_AudioAttributes ATR;
+ if(SUCCEEDED(pDVDI->GetAudioAttributes(i, &ATR)))
+ {
+ switch(ATR.LanguageExtension)
+ {
+ case DVD_AUD_EXT_NotSpecified:
+ default: break;
+ case DVD_AUD_EXT_Captions: str += _T(" (Captions)"); break;
+ case DVD_AUD_EXT_VisuallyImpaired: str += _T(" (Visually Impaired)"); break;
+ case DVD_AUD_EXT_DirectorComments1: str += _T(" (Director Comments 1)"); break;
+ case DVD_AUD_EXT_DirectorComments2: str += _T(" (Director Comments 2)"); break;
+ }
+
+ CString format = GetDVDAudioFormatName(ATR);
+
+ if(!format.IsEmpty())
+ {
+ str.Format(_T("%s, %s %dHz %dbits %d channel(s)"),
+ CString(str),
+ format,
+ ATR.dwFrequency,
+ ATR.bQuantization,
+ ATR.bNumberOfChannels);
+ }
+ }
+
+ str.Replace(_T("&"), _T("&&"));
+
+ pSub->AppendMenu(flags, id++, str);
+ }
+ }
+}
+
+void CMainFrame::SetupNavSubtitleSubMenu()
+{
+ CMenu* pSub = &m_navsubtitle;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ UINT id = ID_NAVIGATE_SUBP_SUBITEM_START;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ SetupNavStreamSelectSubMenu(pSub, id, 2);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ ULONG ulStreamsAvailable, ulCurrentStream;
+ BOOL bIsDisabled;
+ if(FAILED(pDVDI->GetCurrentSubpicture(&ulStreamsAvailable, &ulCurrentStream, &bIsDisabled))
+ || ulStreamsAvailable == 0)
+ return;
+
+ LCID DefLanguage;
+ DVD_SUBPICTURE_LANG_EXT ext;
+ if(FAILED(pDVDI->GetDefaultSubpictureLanguage(&DefLanguage, &ext)))
+ return;
+
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|(bIsDisabled?0:MF_CHECKED), id++, _T("Enabled"));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_SEPARATOR|MF_ENABLED);
+
+ for(ULONG i = 0; i < ulStreamsAvailable; i++)
+ {
+ LCID Language;
+ if(FAILED(pDVDI->GetSubpictureLanguage(i, &Language)))
+ continue;
+
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+ if(Language == DefLanguage) flags |= MF_DEFAULT;
+ if(i == ulCurrentStream) flags |= MF_CHECKED;
+
+ CString str(_T("Unknown"));
+ if(Language)
+ {
+ int len = GetLocaleInfo(Language, LOCALE_SENGLANGUAGE, str.GetBuffer(256), 256);
+ str.ReleaseBufferSetLength(max(len-1, 0));
+ }
+
+ DVD_SubpictureAttributes ATR;
+ if(SUCCEEDED(pDVDI->GetSubpictureAttributes(i, &ATR)))
+ {
+ switch(ATR.LanguageExtension)
+ {
+ case DVD_SP_EXT_NotSpecified:
+ default: break;
+ case DVD_SP_EXT_Caption_Normal: str += _T(""); break;
+ case DVD_SP_EXT_Caption_Big: str += _T(" (Big)"); break;
+ case DVD_SP_EXT_Caption_Children: str += _T(" (Children)"); break;
+ case DVD_SP_EXT_CC_Normal: str += _T(" (CC)"); break;
+ case DVD_SP_EXT_CC_Big: str += _T(" (CC Big)"); break;
+ case DVD_SP_EXT_CC_Children: str += _T(" (CC Children)"); break;
+ case DVD_SP_EXT_Forced: str += _T(" (Forced)"); break;
+ case DVD_SP_EXT_DirectorComments_Normal: str += _T(" (Director Comments)"); break;
+ case DVD_SP_EXT_DirectorComments_Big: str += _T(" (Director Comments, Big)"); break;
+ case DVD_SP_EXT_DirectorComments_Children: str += _T(" (Director Comments, Children)"); break;
+ }
+ }
+
+ str.Replace(_T("&"), _T("&&"));
+
+ pSub->AppendMenu(flags, id++, str);
+ }
+ }
+}
+
+void CMainFrame::SetupNavAngleSubMenu()
+{
+ CMenu* pSub = &m_navangle;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ if(m_iMediaLoadState != MLS_LOADED) return;
+
+ UINT id = ID_NAVIGATE_ANGLE_SUBITEM_START;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ SetupNavStreamSelectSubMenu(pSub, id, 0);
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ ULONG ulStreamsAvailable, ulCurrentStream;
+ if(FAILED(pDVDI->GetCurrentAngle(&ulStreamsAvailable, &ulCurrentStream)))
+ return;
+
+ if(ulStreamsAvailable < 2) return; // one choice is not a choice...
+
+ for(ULONG i = 1; i <= ulStreamsAvailable; i++)
+ {
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+ if(i == ulCurrentStream) flags |= MF_CHECKED;
+
+ CString str;
+ str.Format(_T("Angle %d"), i);
+
+ pSub->AppendMenu(flags, id++, str);
+ }
+ }
+}
+
+void CMainFrame::SetupNavChaptersSubMenu()
+{
+ CMenu* pSub = &m_navchapters;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ if(m_iMediaLoadState != MLS_LOADED)
+ return;
+
+ UINT id = ID_NAVIGATE_CHAP_SUBITEM_START;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ SetupChapters();
+
+ REFERENCE_TIME rt = GetPos();
+ DWORD j = m_pCB->ChapLookup(&rt, NULL);
+
+ for(DWORD i = 0; i < m_pCB->ChapGetCount(); i++, id++)
+ {
+ rt = 0;
+ CComBSTR bstr;
+ if(FAILED(m_pCB->ChapGet(i, &rt, &bstr)))
+ continue;
+
+ int s = (int)((rt/10000000)%60);
+ int m = (int)((rt/10000000/60)%60);
+ int h = (int)((rt/10000000/60/60));
+
+ CString time;
+ time.Format(_T("[%02d:%02d:%02d] "), h, m, s);
+
+ CString name = CString(bstr);
+ name.Replace(_T("&"), _T("&&"));
+ name.Replace(_T("\t"), _T(" "));
+
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+ if(i == j) flags |= MF_CHECKED;
+ if(id != ID_NAVIGATE_CHAP_SUBITEM_START && i == 0) pSub->AppendMenu(MF_SEPARATOR);
+ pSub->AppendMenu(flags, id, name + '\t' + time);
+ }
+
+ if(m_wndPlaylistBar.GetCount() > 1)
+ {
+ POSITION pos = m_wndPlaylistBar.m_pl.GetHeadPosition();
+ while(pos)
+ {
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+ if(pos == m_wndPlaylistBar.m_pl.GetPos()) flags |= MF_CHECKED;
+ if(id != ID_NAVIGATE_CHAP_SUBITEM_START && pos == m_wndPlaylistBar.m_pl.GetHeadPosition())
+ pSub->AppendMenu(MF_SEPARATOR);
+ CPlaylistItem& pli = m_wndPlaylistBar.m_pl.GetNext(pos);
+ CString name = pli.GetLabel();
+ name.Replace(_T("&"), _T("&&"));
+ pSub->AppendMenu(flags, id++, name);
+ }
+ }
+ }
+ else if(m_iPlaybackMode == PM_DVD)
+ {
+ ULONG ulNumOfVolumes, ulVolume;
+ DVD_DISC_SIDE Side;
+ ULONG ulNumOfTitles = 0;
+ pDVDI->GetDVDVolumeInfo(&ulNumOfVolumes, &ulVolume, &Side, &ulNumOfTitles);
+
+ DVD_PLAYBACK_LOCATION2 Location;
+ pDVDI->GetCurrentLocation(&Location);
+
+ ULONG ulNumOfChapters = 0;
+ pDVDI->GetNumberOfChapters(Location.TitleNum, &ulNumOfChapters);
+
+ ULONG ulUOPs = 0;
+ pDVDI->GetCurrentUOPS(&ulUOPs);
+
+ for(ULONG i = 1; i <= ulNumOfTitles; i++)
+ {
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+ if(i == Location.TitleNum) flags |= MF_CHECKED;
+ if(ulUOPs&UOP_FLAG_Play_Title) flags |= MF_DISABLED|MF_GRAYED;
+
+ CString str;
+ str.Format(_T("Title %d"), i);
+
+ pSub->AppendMenu(flags, id++, str);
+ }
+
+ for(ULONG i = 1; i <= ulNumOfChapters; i++)
+ {
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+ if(i == Location.ChapterNum) flags |= MF_CHECKED;
+ if(ulUOPs&UOP_FLAG_Play_Chapter) flags |= MF_DISABLED|MF_GRAYED;
+ if(i == 1) flags |= MF_MENUBARBREAK;
+
+ CString str;
+ str.Format(_T("Chapter %d"), i);
+
+ pSub->AppendMenu(flags, id++, str);
+ }
+ }
+}
+
+void CMainFrame::SetupNavStreamSelectSubMenu(CMenu* pSub, UINT id, DWORD dwSelGroup)
+{
+ UINT baseid = id;
+
+ CComQIPtr<IAMStreamSelect> pSS = FindFilter(CLSID_OggSplitter, pGB);
+ if(!pSS) pSS = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB);
+ if(!pSS) return;
+
+ DWORD cStreams;
+ if(FAILED(pSS->Count(&cStreams)))
+ return;
+
+ DWORD dwPrevGroup = -1;
+
+ for(int i = 0, j = cStreams; i < j; i++)
+ {
+ DWORD dwFlags, dwGroup;
+ LCID lcid;
+ WCHAR* pszName = NULL;
+
+ if(FAILED(pSS->Info(i, NULL, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))
+ || !pszName)
+ continue;
+
+ CString name(pszName);
+ CString lcname = CString(name).MakeLower();
+
+ if(pszName) CoTaskMemFree(pszName);
+
+ if(dwGroup != dwSelGroup)
+ continue;
+
+ if(dwPrevGroup != -1 && dwPrevGroup != dwGroup)
+ pSub->AppendMenu(MF_SEPARATOR);
+ dwPrevGroup = dwGroup;
+
+ CString str;
+
+ if(lcname.Find(_T(" off")) >= 0)
+ {
+ str = _T("Disabled");
+ }
+ else
+ {
+ if(lcid == 0)
+ {
+ str.Format(_T("Unknown %d"), id - baseid);
+ }
+ else
+ {
+ int len = GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, str.GetBuffer(64), 64);
+ str.ReleaseBufferSetLength(max(len-1, 0));
+ }
+
+ CString lcstr = CString(str).MakeLower();
+
+ if(str.IsEmpty() || lcname.Find(lcstr) >= 0) str = name;
+ else if(!name.IsEmpty()) str = CString(name) + _T(" (") + str + _T(")");
+ }
+
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+ if(dwFlags) flags |= MF_CHECKED;
+
+ str.Replace(_T("&"), _T("&&"));
+ pSub->AppendMenu(flags, id++, str);
+ }
+}
+
+void CMainFrame::OnNavStreamSelectSubMenu(UINT id, DWORD dwSelGroup)
+{
+ CComQIPtr<IAMStreamSelect> pSS = FindFilter(CLSID_OggSplitter, pGB);
+ if(!pSS) pSS = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGB);
+ if(!pSS) return;
+
+ DWORD cStreams;
+ if(FAILED(pSS->Count(&cStreams)))
+ return;
+
+ for(int i = 0, j = cStreams; i < j; i++)
+ {
+ DWORD dwFlags, dwGroup;
+ LCID lcid;
+ WCHAR* pszName = NULL;
+
+ if(FAILED(pSS->Info(i, NULL, &dwFlags, &lcid, &dwGroup, &pszName, NULL, NULL))
+ || !pszName)
+ continue;
+
+ if(pszName) CoTaskMemFree(pszName);
+
+ if(dwGroup != dwSelGroup)
+ continue;
+
+ if(id == 0)
+ {
+ pSS->Enable(i, AMSTREAMSELECTENABLE_ENABLE);
+ break;
+ }
+
+ id--;
+ }
+}
+
+void CMainFrame::SetupFavoritesSubMenu()
+{
+ CMenu* pSub = &m_favorites;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ AppSettings& s = AfxGetAppSettings();
+
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_FAVORITES_ADD, ResStr(IDS_FAVORITES_ADD));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_FAVORITES_ORGANIZE, ResStr(IDS_FAVORITES_ORGANIZE));
+
+ int nLastGroupStart = pSub->GetMenuItemCount();
+
+ UINT id = ID_FAVORITES_FILE_START;
+
+ CAtlList<CString> sl;
+ AfxGetAppSettings().GetFav(FAV_FILE, sl);
+
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+
+ CString str = sl.GetNext(pos);
+ str.Replace(_T("&"), _T("&&"));
+ str.Replace(_T("\t"), _T(" "));
+
+ CAtlList<CString> sl;
+ Explode(str, sl, ';', 2);
+
+ str = sl.RemoveHead();
+
+ if(!sl.IsEmpty())
+ {
+ REFERENCE_TIME rt = 0;
+ if(1 == _stscanf(sl.GetHead(), _T("%I64d"), &rt) && rt > 0)
+ {
+ DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt, 0);
+ str.Format(_T("%s\t[%02d:%02d:%02d]"), CString(str), hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
+ }
+ }
+
+ if(!str.IsEmpty())
+ pSub->AppendMenu(flags, id, str);
+
+ id++;
+ }
+
+ if(id > ID_FAVORITES_FILE_START)
+ pSub->InsertMenu(nLastGroupStart, MF_SEPARATOR|MF_ENABLED|MF_BYPOSITION);
+
+ nLastGroupStart = pSub->GetMenuItemCount();
+
+ id = ID_FAVORITES_DVD_START;
+
+ AfxGetAppSettings().GetFav(FAV_DVD, sl);
+
+ pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+
+ CString str = sl.GetNext(pos);
+ str.Replace(_T("&"), _T("&&"));
+
+ CAtlList<CString> sl;
+ Explode(str, sl, ';', 2);
+
+ str = sl.RemoveHead();
+
+ if(!sl.IsEmpty())
+ {
+ // TODO
+ }
+
+ if(!str.IsEmpty())
+ pSub->AppendMenu(flags, id, str);
+
+ id++;
+ }
+
+ if(id > ID_FAVORITES_DVD_START)
+ pSub->InsertMenu(nLastGroupStart, MF_SEPARATOR|MF_ENABLED|MF_BYPOSITION);
+
+ nLastGroupStart = pSub->GetMenuItemCount();
+
+ id = ID_FAVORITES_DEVICE_START;
+
+ AfxGetAppSettings().GetFav(FAV_DEVICE, sl);
+
+ pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ UINT flags = MF_BYCOMMAND|MF_STRING|MF_ENABLED;
+
+ CString str = sl.GetNext(pos);
+ str.Replace(_T("&"), _T("&&"));
+
+ CAtlList<CString> sl;
+ Explode(str, sl, ';', 2);
+
+ str = sl.RemoveHead();
+
+ if(!str.IsEmpty())
+ pSub->AppendMenu(flags, id, str);
+
+ id++;
+ }
+}
+
+void CMainFrame::SetupShadersSubMenu()
+{
+ CMenu* pSub = &m_shaders;
+
+ if(!IsMenu(pSub->m_hMenu)) pSub->CreatePopupMenu();
+ else while(pSub->RemoveMenu(0, MF_BYPOSITION));
+
+ CWinApp* pApp = AfxGetApp();
+
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADERS_START, ResStr(IDS_SHADER_OFF));
+
+ UINT id = ID_SHADERS_START+1;
+
+ if(POSITION pos = AfxGetAppSettings().m_shaders.GetHeadPosition())
+ {
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SHADER_COMBINE));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id++, ResStr(IDS_SHADER_EDIT));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, ID_SHADER_TOGGLE, ResStr(IDS_SHADER_TOGGLE));
+ pSub->AppendMenu(MF_SEPARATOR);
+
+ MENUITEMINFO mii;
+ memset(&mii, 0, sizeof(mii));
+ mii.cbSize = sizeof(mii);
+ mii.fMask |= MIIM_DATA;
+
+ while(pos)
+ {
+ const AppSettings::Shader& s = AfxGetAppSettings().m_shaders.GetNext(pos);
+ CString label = s.label;
+ label.Replace(_T("&"), _T("&&"));
+ pSub->AppendMenu(MF_BYCOMMAND|MF_STRING|MF_ENABLED, id, label);
+ mii.dwItemData = (ULONG_PTR)&s;
+ pSub->SetMenuItemInfo(id, &mii);
+ id++;
+ }
+ }
+}
+
+/////////////
+
+void CMainFrame::ShowControls(int nCS, bool fSave)
+{
+ int nCSprev = AfxGetAppSettings().nCS;
+ int hbefore = 0, hafter = 0;
+
+ m_pLastBar = NULL;
+
+ POSITION pos = m_bars.GetHeadPosition();
+ for(int i = 1; pos; i <<= 1)
+ {
+ CControlBar* pNext = m_bars.GetNext(pos);
+ ShowControlBar(pNext, !!(nCS&i), TRUE);
+ if(nCS&i) m_pLastBar = pNext;
+
+ CSize s = pNext->CalcFixedLayout(FALSE, TRUE);
+ if(nCSprev&i) hbefore += s.cy;
+ if(nCS&i) hafter += s.cy;
+ }
+
+ WINDOWPLACEMENT wp;
+ wp.length = sizeof(wp);
+ GetWindowPlacement(&wp);
+
+ if(wp.showCmd != SW_SHOWMAXIMIZED && !m_fFullScreen)
+ {
+ CRect r;
+ GetWindowRect(r);
+ MoveWindow(r.left, r.top, r.Width(), r.Height()+(hafter-hbefore));
+ }
+
+ if(fSave)
+ AfxGetAppSettings().nCS = nCS;
+
+ RecalcLayout();
+}
+
+void CMainFrame::SetAlwaysOnTop(int i)
+{
+ AfxGetAppSettings().iOnTop = i;
+
+ if(!m_fFullScreen)
+ {
+ const CWnd* pInsertAfter = NULL;
+
+ if(i == 0)
+ pInsertAfter = &wndNoTopMost;
+ else if(i == 1)
+ pInsertAfter = &wndTopMost;
+ else // if(i == 2)
+ pInsertAfter = GetMediaState() == State_Running ? &wndTopMost : &wndNoTopMost;
+
+ SetWindowPos(pInsertAfter, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ }
+ else if(!(GetWindowLong(m_hWnd, GWL_EXSTYLE)&WS_EX_TOPMOST))
+ {
+ if (!AfxGetAppSettings().fD3DFullscreen)
+ SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ }
+}
+
+void CMainFrame::AddTextPassThruFilter()
+{
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ if(!IsSplitter(pBF)) continue;
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ CComPtr<IPin> pPinTo;
+ AM_MEDIA_TYPE mt;
+ if(FAILED(pPin->ConnectedTo(&pPinTo)) || !pPinTo
+ || FAILED(pPin->ConnectionMediaType(&mt))
+ || mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle)
+ continue;
+
+ CComQIPtr<IBaseFilter> pTPTF = new CTextPassThruFilter(this);
+ CStringW name;
+ name.Format(L"TextPassThru%08x", pTPTF);
+ if(FAILED(pGB->AddFilter(pTPTF, name)))
+ continue;
+
+ HRESULT hr;
+
+ hr = pPinTo->Disconnect();
+ hr = pPin->Disconnect();
+
+ if(FAILED(hr = pGB->ConnectDirect(pPin, GetFirstPin(pTPTF, PINDIR_INPUT), NULL))
+ || FAILED(hr = pGB->ConnectDirect(GetFirstPin(pTPTF, PINDIR_OUTPUT), pPinTo, NULL)))
+ hr = pGB->ConnectDirect(pPin, pPinTo, NULL);
+ else
+ m_pSubStreams.AddTail(CComQIPtr<ISubStream>(pTPTF));
+ }
+ EndEnumPins
+ }
+ EndEnumFilters
+}
+
+bool CMainFrame::LoadSubtitle(CString fn)
+{
+ CComPtr<ISubStream> pSubStream;
+
+ // TMP: maybe this will catch something for those who get a runtime error dialog when opening subtitles from cds
+ try
+ {
+ if(!pSubStream)
+ {
+ CAutoPtr<CVobSubFile> pVSF(new CVobSubFile(&m_csSubLock));
+ if(CString(CPath(fn).GetExtension()).MakeLower() == _T(".idx") && pVSF && pVSF->Open(fn) && pVSF->GetStreamCount() > 0)
+ pSubStream = pVSF.Detach();
+ }
+
+ if(!pSubStream)
+ {
+ CAutoPtr<CRenderedTextSubtitle> pRTS(new CRenderedTextSubtitle(&m_csSubLock));
+ if(pRTS && pRTS->Open(fn, DEFAULT_CHARSET) && pRTS->GetStreamCount() > 0)
+ pSubStream = pRTS.Detach();
+ }
+ }
+ catch(CException* e)
+ {
+ e->Delete();
+ }
+
+ if(pSubStream)
+ {
+ m_pSubStreams.AddTail(pSubStream);
+ }
+
+ return(!!pSubStream);
+}
+
+void CMainFrame::UpdateSubtitle(bool fApplyDefStyle)
+{
+ if(!m_pCAP) return;
+
+ int i = m_iSubtitleSel;
+
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos && i >= 0)
+ {
+ CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
+
+ if(i < pSubStream->GetStreamCount())
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+ pSubStream->SetStream(i);
+ SetSubtitle(pSubStream, fApplyDefStyle);
+ return;
+ }
+
+ i -= pSubStream->GetStreamCount();
+ }
+
+ m_pCAP->SetSubPicProvider(NULL);
+}
+
+void CMainFrame::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ if(pSubStream)
+ {
+ CLSID clsid;
+ pSubStream->GetClassID(&clsid);
+
+ if(clsid == __uuidof(CVobSubFile))
+ {
+ CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)pSubStream;
+
+ if(fApplyDefStyle)
+ {
+ pVSF->SetAlignment(s.fOverridePlacement, s.nHorPos, s.nVerPos, 1, 1);
+ }
+ }
+ else if(clsid == __uuidof(CVobSubStream))
+ {
+ CVobSubStream* pVSS = (CVobSubStream*)(ISubStream*)pSubStream;
+
+ if(fApplyDefStyle)
+ {
+ pVSS->SetAlignment(s.fOverridePlacement, s.nHorPos, s.nVerPos, 1, 1);
+ }
+ }
+ else if(clsid == __uuidof(CRenderedTextSubtitle))
+ {
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
+
+ STSStyle style;
+
+ if(fApplyDefStyle || pRTS->m_fUsingAutoGeneratedDefaultStyle)
+ {
+ style = s.subdefstyle;
+
+ if(s.fOverridePlacement)
+ {
+ style.scrAlignment = 2;
+ int w = pRTS->m_dstScreenSize.cx;
+ int h = pRTS->m_dstScreenSize.cy;
+ int mw = w - style.marginRect.left - style.marginRect.right;
+ style.marginRect.bottom = h - MulDiv(h, s.nVerPos, 100);
+ style.marginRect.left = MulDiv(w, s.nHorPos, 100) - mw/2;
+ style.marginRect.right = w - (style.marginRect.left + mw);
+ }
+
+ pRTS->SetDefaultStyle(style);
+ }
+
+ if(pRTS->GetDefaultStyle(style) && style.relativeTo == 2)
+ {
+ style.relativeTo = s.subdefstyle.relativeTo;
+ pRTS->SetDefaultStyle(style);
+ }
+
+ pRTS->Deinit();
+ }
+ }
+
+ if(!fApplyDefStyle)
+ {
+ m_iSubtitleSel = -1;
+
+ if(pSubStream)
+ {
+
+ int i = 0;
+
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos)
+ {
+ CComPtr<ISubStream> pSubStream2 = m_pSubStreams.GetNext(pos);
+
+ if(pSubStream == pSubStream2)
+ {
+ m_iSubtitleSel = i + pSubStream2->GetStream();
+ break;
+ }
+
+ i += pSubStream2->GetStreamCount();
+ }
+
+ }
+ }
+
+ m_nSubtitleId = (DWORD_PTR)pSubStream;
+
+ if(m_pCAP)
+ {
+ m_pCAP->SetSubPicProvider(CComQIPtr<ISubPicProvider>(pSubStream));
+ m_wndSubresyncBar.SetSubtitle(pSubStream, m_pCAP->GetFPS());
+ }
+}
+
+void CMainFrame::ReplaceSubtitle(ISubStream* pSubStreamOld, ISubStream* pSubStreamNew)
+{
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ if(pSubStreamOld == m_pSubStreams.GetNext(pos))
+ {
+ m_pSubStreams.SetAt(cur, pSubStreamNew);
+ UpdateSubtitle();
+ break;
+ }
+ }
+}
+
+void CMainFrame::InvalidateSubtitle(DWORD_PTR nSubtitleId, REFERENCE_TIME rtInvalidate)
+{
+ if(m_pCAP)
+ {
+ if(nSubtitleId == -1 || nSubtitleId == m_nSubtitleId)
+ m_pCAP->Invalidate(rtInvalidate);
+ }
+}
+
+void CMainFrame::ReloadSubtitle()
+{
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos) m_pSubStreams.GetNext(pos)->Reload();
+ UpdateSubtitle();
+}
+
+REFERENCE_TIME CMainFrame::GetPos()
+{
+ return(m_iMediaLoadState == MLS_LOADED ? m_wndSeekBar.GetPos() : 0);
+}
+
+REFERENCE_TIME CMainFrame::GetDur()
+{
+ __int64 start, stop;
+ m_wndSeekBar.GetRange(start, stop);
+ return(m_iMediaLoadState == MLS_LOADED ? stop : 0);
+}
+
+void CMainFrame::SeekTo(REFERENCE_TIME rtPos, bool fSeekToKeyFrame)
+{
+ OAFilterState fs = GetMediaState();
+
+ if(rtPos < 0) rtPos = 0;
+
+ if(m_iPlaybackMode == PM_FILE)
+ {
+ if(fs == State_Stopped)
+ SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+
+ HRESULT hr;
+
+ if(fSeekToKeyFrame)
+ {
+ if(!m_kfs.IsEmpty())
+ {
+ int i = rangebsearch(rtPos, m_kfs);
+ if(i >= 0 && i < m_kfs.GetCount())
+ rtPos = m_kfs[i];
+ }
+ }
+
+ hr = pMS->SetPositions(&rtPos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
+ }
+ else if(m_iPlaybackMode == PM_DVD && m_iDVDDomain == DVD_DOMAIN_Title)
+ {
+ if(fs != State_Running)
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+
+ DVD_HMSF_TIMECODE tc = RT2HMSF(rtPos);
+ pDVDC->PlayAtTime(&tc, DVD_CMD_FLAG_Block|DVD_CMD_FLAG_Flush, NULL);
+
+// if(fs != State_Running)
+// SendMessage(WM_COMMAND, ID_PLAY_PAUSE);
+ }
+ else if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ TRACE(_T("Warning (CMainFrame::SeekTo): Trying to seek in capture mode"));
+ }
+ m_fEndOfStream = false;
+}
+
+void CMainFrame::CleanGraph()
+{
+ if(!pGB) return;
+
+ BeginEnumFilters(pGB, pEF, pBF)
+ {
+ CComQIPtr<IAMFilterMiscFlags> pAMMF(pBF);
+ if(pAMMF && (pAMMF->GetMiscFlags()&AM_FILTER_MISC_FLAGS_IS_SOURCE))
+ continue;
+
+ // some capture filters forget to set AM_FILTER_MISC_FLAGS_IS_SOURCE
+ // or to implement the IAMFilterMiscFlags interface
+ if(pBF == pVidCap || pBF == pAudCap)
+ continue;
+
+ if(CComQIPtr<IFileSourceFilter>(pBF))
+ continue;
+
+ int nIn, nOut, nInC, nOutC;
+ if(CountPins(pBF, nIn, nOut, nInC, nOutC) > 0 && (nInC+nOutC) == 0)
+ {
+ TRACE(CStringW(L"Removing: ") + GetFilterName(pBF) + '\n');
+
+ pGB->RemoveFilter(pBF);
+ pEF->Reset();
+ }
+ }
+ EndEnumFilters
+}
+
+#define AUDIOBUFFERLEN 500
+
+static void SetLatency(IBaseFilter* pBF, int cbBuffer)
+{
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(CComQIPtr<IAMBufferNegotiation> pAMBN = pPin)
+ {
+ ALLOCATOR_PROPERTIES ap;
+ ap.cbAlign = -1; // -1 means no preference.
+ ap.cbBuffer = cbBuffer;
+ ap.cbPrefix = -1;
+ ap.cBuffers = -1;
+ pAMBN->SuggestAllocatorProperties(&ap);
+ }
+ }
+ EndEnumPins
+}
+
+HRESULT CMainFrame::BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& majortype, AM_MEDIA_TYPE* pmt)
+{
+ IBaseFilter* pBuff = pBF[0];
+ IBaseFilter* pEnc = pBF[1];
+ IBaseFilter* pMux = pBF[2];
+
+ if(!pPin || !pMux) return E_FAIL;
+
+ CString err;
+
+ HRESULT hr = S_OK;
+
+ CFilterInfo fi;
+ if(FAILED(pMux->QueryFilterInfo(&fi)) || !fi.pGraph)
+ pGB->AddFilter(pMux, L"Multiplexer");
+
+ CStringW prefix, prefixl;
+ if(majortype == MEDIATYPE_Video) prefix = L"Video ";
+ else if(majortype == MEDIATYPE_Audio) prefix = L"Audio ";
+ prefixl = prefix;
+ prefixl.MakeLower();
+
+ if(pBuff)
+ {
+ hr = pGB->AddFilter(pBuff, prefix + L"Buffer");
+ if(FAILED(hr))
+ {
+ err = _T("Can't add ") + CString(prefixl) + _T("buffer filter");
+ AfxMessageBox(err);
+ return hr;
+ }
+
+ hr = pGB->ConnectFilter(pPin, pBuff);
+ if(FAILED(hr))
+ {
+ err = _T("Error connecting the ") + CString(prefixl) + _T("buffer filter");
+ AfxMessageBox(err);
+ return(hr);
+ }
+
+ pPin = GetFirstPin(pBuff, PINDIR_OUTPUT);
+ }
+
+ if(pEnc)
+ {
+ hr = pGB->AddFilter(pEnc, prefix + L"Encoder");
+ if(FAILED(hr))
+ {
+ err = _T("Can't add ") + CString(prefixl) + _T("encoder filter");
+ AfxMessageBox(err);
+ return hr;
+ }
+
+ hr = pGB->ConnectFilter(pPin, pEnc);
+ if(FAILED(hr))
+ {
+ err = _T("Error connecting the ") + CString(prefixl) + _T("encoder filter");
+ AfxMessageBox(err);
+ return(hr);
+ }
+
+ pPin = GetFirstPin(pEnc, PINDIR_OUTPUT);
+
+ if(CComQIPtr<IAMStreamConfig> pAMSC = pPin)
+ {
+ if(pmt->majortype == majortype)
+ {
+ hr = pAMSC->SetFormat(pmt);
+ if(FAILED(hr))
+ {
+ err = _T("Can't set compression format on the ") + CString(prefixl) + _T("encoder filter");
+ AfxMessageBox(err);
+ return(hr);
+ }
+ }
+ }
+
+ }
+
+// if(pMux)
+ {
+ hr = pGB->ConnectFilter(pPin, pMux);
+ if(FAILED(hr))
+ {
+ err = _T("Error connecting ") + CString(prefixl) + _T(" to the muliplexer filter");
+ AfxMessageBox(err);
+ return(hr);
+ }
+ }
+
+ CleanGraph();
+
+ return S_OK;
+}
+
+bool CMainFrame::BuildToCapturePreviewPin(
+ IBaseFilter* pVidCap, IPin** ppVidCapPin, IPin** ppVidPrevPin,
+ IBaseFilter* pAudCap, IPin** ppAudCapPin, IPin** ppAudPrevPin)
+{
+ HRESULT hr;
+
+ *ppVidCapPin = *ppVidPrevPin = NULL;
+ *ppAudCapPin = *ppAudPrevPin = NULL;
+
+ CComPtr<IPin> pDVAudPin;
+
+ if(pVidCap)
+ {
+ CComPtr<IPin> pPin;
+ if(!pAudCap // only look for interleaved stream when we don't use any other audio capture source
+ && SUCCEEDED(pCGB->FindPin(pVidCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Interleaved, TRUE, 0, &pPin)))
+ {
+ CComPtr<IBaseFilter> pDVSplitter;
+ hr = pDVSplitter.CoCreateInstance(CLSID_DVSplitter);
+ hr = pGB->AddFilter(pDVSplitter, L"DV Splitter");
+
+ hr = pCGB->RenderStream(NULL, &MEDIATYPE_Interleaved, pPin, NULL, pDVSplitter);
+
+ pPin = NULL;
+ hr = pCGB->FindPin(pDVSplitter, PINDIR_OUTPUT, NULL, &MEDIATYPE_Video, TRUE, 0, &pPin);
+ hr = pCGB->FindPin(pDVSplitter, PINDIR_OUTPUT, NULL, &MEDIATYPE_Audio, TRUE, 0, &pDVAudPin);
+
+ CComPtr<IBaseFilter> pDVDec;
+ hr = pDVDec.CoCreateInstance(CLSID_DVVideoCodec);
+ hr = pGB->AddFilter(pDVDec, L"DV Video Decoder");
+
+ hr = pGB->ConnectFilter(pPin, pDVDec);
+
+ pPin = NULL;
+ hr = pCGB->FindPin(pDVDec, PINDIR_OUTPUT, NULL, &MEDIATYPE_Video, TRUE, 0, &pPin);
+ }
+ else if(SUCCEEDED(pCGB->FindPin(pVidCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, TRUE, 0, &pPin)))
+ {
+ }
+ else
+ {
+ AfxMessageBox(_T("No video capture pin was found"));
+ return(false);
+ }
+
+ CComPtr<IBaseFilter> pSmartTee;
+ hr = pSmartTee.CoCreateInstance(CLSID_SmartTee);
+ hr = pGB->AddFilter(pSmartTee, L"Smart Tee (video)");
+
+ hr = pGB->ConnectFilter(pPin, pSmartTee);
+
+ hr = pSmartTee->FindPin(L"Preview", ppVidPrevPin);
+ hr = pSmartTee->FindPin(L"Capture", ppVidCapPin);
+ }
+
+ if(pAudCap || pDVAudPin)
+ {
+ CComPtr<IPin> pPin;
+ if(pDVAudPin)
+ {
+ pPin = pDVAudPin;
+ }
+ else if(SUCCEEDED(pCGB->FindPin(pAudCap, PINDIR_OUTPUT, &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, TRUE, 0, &pPin)))
+ {
+ }
+ else
+ {
+ AfxMessageBox(_T("No audio capture pin was found"));
+ return(false);
+ }
+
+ CComPtr<IBaseFilter> pSmartTee;
+ hr = pSmartTee.CoCreateInstance(CLSID_SmartTee);
+ hr = pGB->AddFilter(pSmartTee, L"Smart Tee (audio)");
+
+ hr = pGB->ConnectFilter(pPin, pSmartTee);
+
+ hr = pSmartTee->FindPin(L"Preview", ppAudPrevPin);
+ hr = pSmartTee->FindPin(L"Capture", ppAudCapPin);
+ }
+
+ return(true);
+}
+
+bool CMainFrame::BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPreview, bool fACapture)
+{
+ if(!pCGB) return(false);
+
+ SaveMediaState;
+
+ HRESULT hr;
+
+ pGB->NukeDownstream(pVidCap);
+ pGB->NukeDownstream(pAudCap);
+
+ CleanGraph();
+
+ if(pAMVSCCap) hr = pAMVSCCap->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv);
+ if(pAMVSCPrev) hr = pAMVSCPrev->SetFormat(&m_wndCaptureBar.m_capdlg.m_mtv);
+ if(pAMASC) hr = pAMASC->SetFormat(&m_wndCaptureBar.m_capdlg.m_mta);
+
+ CComPtr<IBaseFilter> pVidBuffer = m_wndCaptureBar.m_capdlg.m_pVidBuffer;
+ CComPtr<IBaseFilter> pAudBuffer = m_wndCaptureBar.m_capdlg.m_pAudBuffer;
+ CComPtr<IBaseFilter> pVidEnc = m_wndCaptureBar.m_capdlg.m_pVidEnc;
+ CComPtr<IBaseFilter> pAudEnc = m_wndCaptureBar.m_capdlg.m_pAudEnc;
+ CComPtr<IBaseFilter> pMux = m_wndCaptureBar.m_capdlg.m_pMux;
+ CComPtr<IBaseFilter> pDst = m_wndCaptureBar.m_capdlg.m_pDst;
+ CComPtr<IBaseFilter> pAudMux = m_wndCaptureBar.m_capdlg.m_pAudMux;
+ CComPtr<IBaseFilter> pAudDst = m_wndCaptureBar.m_capdlg.m_pAudDst;
+
+ bool fFileOutput = (pMux && pDst) || (pAudMux && pAudDst);
+ bool fCapture = (fVCapture || fACapture);
+
+ if(pAudCap)
+ {
+ AM_MEDIA_TYPE* pmt = &m_wndCaptureBar.m_capdlg.m_mta;
+ int ms = (fACapture && fFileOutput && m_wndCaptureBar.m_capdlg.m_fAudOutput) ? AUDIOBUFFERLEN : 60;
+ if(pMux != pAudMux && fACapture) SetLatency(pAudCap, -1);
+ else if(pmt->pbFormat) SetLatency(pAudCap, ((WAVEFORMATEX*)pmt->pbFormat)->nAvgBytesPerSec * ms / 1000);
+ }
+
+ CComPtr<IPin> pVidCapPin, pVidPrevPin, pAudCapPin, pAudPrevPin;
+ BuildToCapturePreviewPin(pVidCap, &pVidCapPin, &pVidPrevPin, pAudCap, &pAudCapPin, &pAudPrevPin);
+
+// if(pVidCap)
+ {
+ bool fVidPrev = pVidPrevPin && fVPreview;
+ bool fVidCap = pVidCapPin && fVCapture && fFileOutput && m_wndCaptureBar.m_capdlg.m_fVidOutput;
+
+ if(fVPreview == 2 && !fVidCap && pVidCapPin)
+ {
+ pVidPrevPin = pVidCapPin;
+ pVidCapPin = NULL;
+ }
+
+ if(fVidPrev)
+ {
+ m_pCAP = NULL;
+ pGB->Render(pVidPrevPin);
+ pGB->FindInterface(__uuidof(ISubPicAllocatorPresenter), (void**)&m_pCAP, TRUE);
+ }
+
+ if(fVidCap)
+ {
+ IBaseFilter* pBF[3] = {pVidBuffer, pVidEnc, pMux};
+ HRESULT hr = BuildCapture(pVidCapPin, pBF, MEDIATYPE_Video, &m_wndCaptureBar.m_capdlg.m_mtcv);
+ }
+
+ pAMDF = NULL;
+ pCGB->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pVidCap, IID_IAMDroppedFrames, (void**)&pAMDF);
+ }
+
+// if(pAudCap)
+ {
+ bool fAudPrev = pAudPrevPin && fAPreview;
+ bool fAudCap = pAudCapPin && fACapture && fFileOutput && m_wndCaptureBar.m_capdlg.m_fAudOutput;
+
+ if(fAPreview == 2 && !fAudCap && pAudCapPin)
+ {
+ pAudPrevPin = pAudCapPin;
+ pAudCapPin = NULL;
+ }
+
+ if(fAudPrev)
+ {
+ pGB->Render(pAudPrevPin);
+ }
+
+ if(fAudCap)
+ {
+ IBaseFilter* pBF[3] = {pAudBuffer, pAudEnc, pAudMux ? pAudMux : pMux};
+ HRESULT hr = BuildCapture(pAudCapPin, pBF, MEDIATYPE_Audio, &m_wndCaptureBar.m_capdlg.m_mtca);
+ }
+ }
+
+ if((pVidCap || pAudCap) && fCapture && fFileOutput)
+ {
+ if(pMux != pDst)
+ {
+ hr = pGB->AddFilter(pDst, L"File Writer V/A");
+ hr = pGB->ConnectFilter(GetFirstPin(pMux, PINDIR_OUTPUT), pDst);
+ }
+
+ if(CComQIPtr<IConfigAviMux> pCAM = pMux)
+ {
+ int nIn, nOut, nInC, nOutC;
+ CountPins(pMux, nIn, nOut, nInC, nOutC);
+ pCAM->SetMasterStream(nInC-1);
+// pCAM->SetMasterStream(-1);
+ pCAM->SetOutputCompatibilityIndex(FALSE);
+ }
+
+ if(CComQIPtr<IConfigInterleaving> pCI = pMux)
+ {
+// if(FAILED(pCI->put_Mode(INTERLEAVE_CAPTURE)))
+ if(FAILED(pCI->put_Mode(INTERLEAVE_NONE_BUFFERED)))
+ pCI->put_Mode(INTERLEAVE_NONE);
+
+ REFERENCE_TIME rtInterleave = 10000i64*AUDIOBUFFERLEN, rtPreroll = 0;//10000i64*500
+ pCI->put_Interleaving(&rtInterleave, &rtPreroll);
+ }
+
+ if(pMux != pAudMux && pAudMux != pAudDst)
+ {
+ hr = pGB->AddFilter(pAudDst, L"File Writer A");
+ hr = pGB->ConnectFilter(GetFirstPin(pAudMux, PINDIR_OUTPUT), pAudDst);
+ }
+ }
+
+ REFERENCE_TIME stop = MAX_TIME;
+ hr = pCGB->ControlStream(&PIN_CATEGORY_CAPTURE, NULL, NULL, NULL, &stop, 0, 0); // stop in the infinite
+
+ CleanGraph();
+
+ OpenSetupVideo();
+ OpenSetupAudio();
+ OpenSetupStatsBar();
+ OpenSetupStatusBar();
+
+ RestoreMediaState;
+
+ return(true);
+}
+
+bool CMainFrame::StartCapture()
+{
+ if(!pCGB || m_fCapturing) return(false);
+
+ if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) return(false);
+
+ HRESULT hr;
+
+ ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
+
+ // rare to see two capture filters to support IAMPushSource at the same time...
+// hr = CComQIPtr<IAMGraphStreams>(pGB)->SyncUsingStreamOffset(TRUE); // TODO:
+
+ BuildGraphVideoAudio(
+ m_wndCaptureBar.m_capdlg.m_fVidPreview, true,
+ m_wndCaptureBar.m_capdlg.m_fAudPreview, true);
+
+ hr = pME->CancelDefaultHandling(EC_REPAINT);
+
+ SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+
+ m_fCapturing = true;
+
+ return(true);
+}
+
+bool CMainFrame::StopCapture()
+{
+ if(!pCGB || !m_fCapturing) return(false);
+
+ if(!m_wndCaptureBar.m_capdlg.m_pMux && !m_wndCaptureBar.m_capdlg.m_pDst) return(false);
+
+ HRESULT hr;
+
+ m_wndStatusBar.SetStatusMessage(ResStr(IDS_CONTROLS_COMPLETING));
+
+ m_fCapturing = false;
+
+ BuildGraphVideoAudio(
+ m_wndCaptureBar.m_capdlg.m_fVidPreview, false,
+ m_wndCaptureBar.m_capdlg.m_fAudPreview, false);
+
+ hr = pME->RestoreDefaultHandling(EC_REPAINT);
+
+ ::SetPriorityClass(::GetCurrentProcess(), AfxGetAppSettings().priority);
+
+ m_rtDurationOverride = -1;
+
+ return(true);
+}
+
+//
+
+void CMainFrame::ShowOptions(int idPage)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ CPPageSheet options(ResStr(IDS_OPTIONS_CAPTION), pGB, this, idPage);
+
+ if(options.DoModal() == IDOK)
+ {
+ if(!m_fFullScreen)
+ SetAlwaysOnTop(s.iOnTop);
+
+ m_wndView.LoadLogo();
+
+ s.UpdateData(true);
+ }
+}
+
+void CMainFrame::StartWebServer(int nPort)
+{
+ if(!m_pWebServer)
+ m_pWebServer.Attach(new CWebServer(this, nPort));
+}
+
+void CMainFrame::StopWebServer()
+{
+ if(m_pWebServer)
+ m_pWebServer.Free();
+}
+
+CString CMainFrame::GetStatusMessage()
+{
+ CString str;
+ m_wndStatusBar.m_status.GetWindowText(str);
+ return str;
+}
+
+void CMainFrame::SendStatusMessage(CString msg, int nTimeOut)
+{
+ KillTimer(TIMER_STATUSERASER);
+
+ m_playingmsg.Empty();
+ if(nTimeOut <= 0) return;
+
+ m_playingmsg = msg;
+ SetTimer(TIMER_STATUSERASER, nTimeOut, NULL);
+}
+
+void CMainFrame::OpenCurPlaylistItem(REFERENCE_TIME rtStart)
+{
+ if(m_wndPlaylistBar.GetCount() == 0)
+ return;
+
+ CPlaylistItem pli;
+ if(!m_wndPlaylistBar.GetCur(pli)) m_wndPlaylistBar.SetFirst();
+ if(!m_wndPlaylistBar.GetCur(pli)) return;
+
+ CAutoPtr<OpenMediaData> p(m_wndPlaylistBar.GetCurOMD(rtStart));
+ if(p) OpenMedia(p);
+}
+
+void CMainFrame::AddCurDevToPlaylist()
+{
+ if(m_iPlaybackMode == PM_CAPTURE)
+ {
+ m_wndPlaylistBar.Append(
+ m_VidDispName,
+ m_AudDispName,
+ m_wndCaptureBar.m_capdlg.GetVideoInput(),
+ m_wndCaptureBar.m_capdlg.GetVideoChannel(),
+ m_wndCaptureBar.m_capdlg.GetAudioInput()
+ );
+ }
+}
+
+static int s_fOpenedThruThread = false;
+
+void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD)
+{
+ // shortcut
+ if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p))
+ {
+ if(m_iMediaLoadState == MLS_LOADED && pAMTuner
+ && m_VidDispName == p->DisplayName[0] && m_AudDispName == p->DisplayName[1])
+ {
+ m_wndCaptureBar.m_capdlg.SetVideoInput(p->vinput);
+ m_wndCaptureBar.m_capdlg.SetVideoChannel(p->vchannel);
+ m_wndCaptureBar.m_capdlg.SetAudioInput(p->ainput);
+ SendNowPlayingToMSN();
+ SendNowPlayingTomIRC();
+ return;
+ }
+ }
+
+ if(m_iMediaLoadState != MLS_CLOSED)
+ CloseMedia();
+
+// m_iMediaLoadState = MLS_LOADING; // HACK: hides the logo
+
+ AppSettings& s = AfxGetAppSettings();
+
+ bool fUseThread = true;
+
+ if(OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD.m_p))
+ {
+ if(p->fns.GetCount() > 0)
+ {
+ engine_t e = s.Formats.GetEngine(p->fns.GetHead());
+ fUseThread = e == DirectShow /*|| e == RealMedia || e == QuickTime*/;
+ }
+ }
+ else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p))
+ {
+ fUseThread = false;
+ }
+
+ if(m_pGraphThread && fUseThread
+ && AfxGetAppSettings().fEnableWorkerThreadForOpening)
+ {
+ m_pGraphThread->PostThreadMessage(CGraphThread::TM_OPEN, 0, (LPARAM)pOMD.Detach());
+ s_fOpenedThruThread = true;
+ }
+ else
+ {
+ OpenMediaPrivate(pOMD);
+ s_fOpenedThruThread = false;
+ }
+}
+
+void CMainFrame::CloseMedia()
+{
+ if(m_iMediaLoadState == MLS_CLOSING)
+ {
+ TRACE(_T("WARNING: CMainFrame::CloseMedia() called twice or more\n"));
+ return;
+ }
+
+ int nTimeWaited = 0;
+
+ while(m_iMediaLoadState == MLS_LOADING)
+ {
+ m_fOpeningAborted = true;
+
+ if(pGB) pGB->Abort(); // TODO: lock on graph objects somehow, this is not thread safe
+
+ if(nTimeWaited > 5*1000 && m_pGraphThread)
+ {
+ MessageBeep(MB_ICONEXCLAMATION);
+ TRACE(_T("CRITICAL ERROR: !!! Must kill opener thread !!!"));
+ TerminateThread(m_pGraphThread->m_hThread, -1);
+ m_pGraphThread = (CGraphThread*)AfxBeginThread(RUNTIME_CLASS(CGraphThread));
+ s_fOpenedThruThread = false;
+ break;
+ }
+
+ Sleep(50);
+
+ nTimeWaited += 50;
+ }
+
+ m_fOpeningAborted = false;
+
+ m_closingmsg.Empty();
+
+ m_iMediaLoadState = MLS_CLOSING;
+
+ OnFilePostClosemedia();
+
+ if(m_pGraphThread && s_fOpenedThruThread)
+ {
+ CAMEvent e;
+ m_pGraphThread->PostThreadMessage(CGraphThread::TM_CLOSE, 0, (LPARAM)&e);
+ e.Wait(); // either opening or closing has to be blocked to prevent reentering them, closing is the better choice
+ }
+ else
+ {
+ CloseMediaPrivate();
+ }
+
+ UnloadExternalObjects();
+ if (m_bD3DFullscreenMode)
+ {
+ if (m_pFullscreenWnd->m_hWnd) m_pFullscreenWnd->ShowWindow (SW_HIDE);
+ m_bD3DFullscreenMode = false;
+ }
+}
+
+//
+// CGraphThread
+//
+
+IMPLEMENT_DYNCREATE(CGraphThread, CWinThread)
+
+BOOL CGraphThread::InitInstance()
+{
+ AfxSocketInit();
+ return SUCCEEDED(CoInitialize(0)) ? TRUE : FALSE;
+}
+
+int CGraphThread::ExitInstance()
+{
+ CoUninitialize();
+ return __super::ExitInstance();
+}
+
+BEGIN_MESSAGE_MAP(CGraphThread, CWinThread)
+ ON_THREAD_MESSAGE(TM_EXIT, OnExit)
+ ON_THREAD_MESSAGE(TM_OPEN, OnOpen)
+ ON_THREAD_MESSAGE(TM_CLOSE, OnClose)
+END_MESSAGE_MAP()
+
+void CGraphThread::OnExit(WPARAM wParam, LPARAM lParam)
+{
+ PostQuitMessage(0);
+ if(CAMEvent* e = (CAMEvent*)lParam) e->Set();
+}
+
+void CGraphThread::OnOpen(WPARAM wParam, LPARAM lParam)
+{
+ if(m_pMainFrame)
+ {
+ CAutoPtr<OpenMediaData> pOMD((OpenMediaData*)lParam);
+ m_pMainFrame->OpenMediaPrivate(pOMD);
+ }
+}
+
+void CGraphThread::OnClose(WPARAM wParam, LPARAM lParam)
+{
+ if(m_pMainFrame) m_pMainFrame->CloseMediaPrivate();
+ if(CAMEvent* e = (CAMEvent*)lParam) e->Set();
+}
+
+
+
+
+// ==== Added by CASIMIR666
+bool CMainFrame::CreateFullScreenWindow()
+{
+ HMONITOR hMonitor;
+ MONITORINFOEX MonitorInfo;
+ CRect MonitorRect;
+
+ if (m_pFullscreenWnd->m_hWnd) m_pFullscreenWnd->DestroyWindow();
+
+ ZeroMemory (&MonitorInfo, sizeof(MonitorInfo));
+ MonitorInfo.cbSize = sizeof(MonitorInfo);
+ hMonitor = MonitorFromWindow (m_hWnd, 0);
+ if (GetMonitorInfo (hMonitor, &MonitorInfo))
+ {
+ MonitorRect = CRect (MonitorInfo.rcMonitor);
+ // Creation de la fenetre
+ DWORD dwStyle = WS_POPUP | WS_VISIBLE ;
+ m_fullWndSize.cx = MonitorRect.Width();
+ m_fullWndSize.cy = MonitorRect.Height();
+
+ m_pFullscreenWnd->CreateEx (WS_EX_TOPMOST | WS_EX_TOOLWINDOW, _T(""), _T("MPC D3D FullScreen"), dwStyle, MonitorRect.left, MonitorRect.top, MonitorRect.Width(), MonitorRect.Height(), NULL, NULL, NULL);
+ }
+
+ return (m_pFullscreenWnd->m_hWnd)? true : false;
+}
+
+
+bool CMainFrame::IsD3DFullScreenMode()
+{
+ return (m_bD3DFullscreenMode);
+// return (AfxGetAppSettings().fD3DFullscreen && ((m_iMediaLoadState == MLS_LOADED) || (m_iMediaLoadState == MLS_LOADING)));
+};
+
+
+
+void CMainFrame::SetVMR9ColorControl(float dBrightness, float dContrast, float dHue, float dSaturation)
+{
+ VMR9ProcAmpControl ClrControl;
+
+ if(m_pMC)
+ {
+ ClrControl.dwSize = sizeof(ClrControl);
+ ClrControl.dwFlags = ProcAmpControl9_Mask;
+ ClrControl.Brightness = dBrightness;
+ ClrControl.Contrast = dContrast;
+ ClrControl.Hue = dHue;
+ ClrControl.Saturation = dSaturation;
+
+ m_pMC->SetProcAmpControl (0, &ClrControl);
+ }
+}
+
+LPCTSTR CMainFrame::GetDVDAudioFormatName (DVD_AudioAttributes& ATR)
+{
+ switch(ATR.AudioFormat)
+ {
+ case DVD_AudioFormat_AC3:
+ return _T("AC3");
+ case DVD_AudioFormat_MPEG1:
+ case DVD_AudioFormat_MPEG1_DRC:
+ return _T("MPEG1");
+ case DVD_AudioFormat_MPEG2:
+ case DVD_AudioFormat_MPEG2_DRC:
+ return _T("MPEG2");
+ case DVD_AudioFormat_LPCM:
+ return _T("LPCM");
+ case DVD_AudioFormat_DTS:
+ return _T("DTS");
+ case DVD_AudioFormat_SDDS:
+ return _T("SDDS");
+ case DVD_AudioFormat_Other:
+ default:
+ return _T("Unknown format");
+ }
+}
diff --git a/src/apps/mplayerc/MainFrm.h b/src/apps/mplayerc/MainFrm.h
new file mode 100644
index 000000000..aeabf3c46
--- /dev/null
+++ b/src/apps/mplayerc/MainFrm.h
@@ -0,0 +1,693 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+
+#include "ChildView.h"
+#include "PlayerSeekBar.h"
+#include "PlayerToolBar.h"
+#include "PlayerInfoBar.h"
+#include "PlayerStatusBar.h"
+#include "PlayerSubresyncBar.h"
+#include "PlayerPlaylistBar.h"
+#include "PlayerCaptureBar.h"
+#include "PlayerShaderEditorBar.h"
+#include "PPageSheet.h"
+#include "PPageFileInfoSheet.h"
+#include "OpenCapDeviceDlg.h"
+
+#include "FileDropTarget.h"
+
+#include "KeyProvider.h"
+
+#include "..\..\subpic\ISubPic.h"
+
+#include "IGraphBuilder2.h"
+
+#include "RealMediaGraph.h"
+#include "QuicktimeGraph.h"
+#include "ShockwaveGraph.h"
+
+#include "..\..\..\include\IChapterInfo.h"
+#include "..\..\..\include\IKeyFrameInfo.h"
+#include "..\..\..\include\IBufferInfo.h"
+
+#include "WebServer.h"
+#include <D3d9.h>
+#include <Vmr9.h>
+#include "VMROSD.h"
+
+class CFullscreenWnd;
+
+enum {PM_NONE, PM_FILE, PM_DVD, PM_CAPTURE};
+
+class OpenMediaData
+{
+public:
+// OpenMediaData() {}
+ virtual ~OpenMediaData() {} // one virtual funct is needed to enable rtti
+ CString title;
+ CAtlList<CString> subs;
+};
+
+class OpenFileData : public OpenMediaData
+{
+public:
+ OpenFileData() : rtStart(0) {}
+ CAtlList<CString> fns;
+ REFERENCE_TIME rtStart;
+};
+
+class OpenDVDData : public OpenMediaData
+{
+public:
+// OpenDVDData() {}
+ CString path;
+ CComPtr<IDvdState> pDvdState;
+};
+
+class OpenDeviceData : public OpenMediaData
+{
+public:
+ OpenDeviceData() {vinput = vchannel = ainput = -1;}
+ CStringW DisplayName[2];
+ int vinput, vchannel, ainput;
+};
+
+class CMainFrame;
+
+class CGraphThread : public CWinThread
+{
+ CMainFrame* m_pMainFrame;
+
+ DECLARE_DYNCREATE(CGraphThread);
+
+public:
+ CGraphThread() : m_pMainFrame(NULL) {}
+
+ void SetMainFrame(CMainFrame* pMainFrame) {m_pMainFrame = pMainFrame;}
+
+ BOOL InitInstance();
+ int ExitInstance();
+
+ enum {TM_EXIT=WM_APP, TM_OPEN, TM_CLOSE};
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnExit(WPARAM wParam, LPARAM lParam);
+ afx_msg void OnOpen(WPARAM wParam, LPARAM lParam);
+ afx_msg void OnClose(WPARAM wParam, LPARAM lParam);
+};
+/*
+class CKeyFrameFinderThread : public CWinThread, public CCritSec
+{
+ DECLARE_DYNCREATE(CKeyFrameFinderThread);
+
+public:
+ CKeyFrameFinderThread() {}
+
+ CUIntArray m_kfs; // protected by (CCritSec*)this
+
+ BOOL InitInstance();
+ int ExitInstance();
+
+ enum {TM_EXIT=WM_APP, TM_INDEX, TM_BREAK};
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnExit(WPARAM wParam, LPARAM lParam);
+ afx_msg void OnIndex(WPARAM wParam, LPARAM lParam);
+ afx_msg void OnBreak(WPARAM wParam, LPARAM lParam);
+};
+*/
+interface ISubClock;
+
+class CMainFrame : public CFrameWnd, public CDropTarget
+{
+ enum
+ {
+ TIMER_STREAMPOSPOLLER = 1,
+ TIMER_STREAMPOSPOLLER2,
+ TIMER_FULLSCREENCONTROLBARHIDER,
+ TIMER_FULLSCREENMOUSEHIDER,
+ TIMER_STATS,
+ TIMER_LEFTCLICK,
+ TIMER_STATUSERASER
+ };
+
+ friend class CPPageFileInfoSheet;
+ friend class CPPageLogo;
+
+ // TODO: wrap these graph objects into a class to make it look cleaner
+
+ DWORD m_dwRegister;
+
+ CComPtr<IGraphBuilder2> pGB;
+ CComQIPtr<IMediaControl> pMC;
+ CComQIPtr<IMediaEventEx> pME;
+ CComQIPtr<IVideoWindow> pVW;
+ CComQIPtr<IBasicVideo> pBV;
+ CComQIPtr<IBasicAudio> pBA;
+ CComQIPtr<IMediaSeeking> pMS;
+ CComQIPtr<IVideoFrameStep> pFS;
+ CComQIPtr<IQualProp, &IID_IQualProp> pQP;
+ CComQIPtr<IBufferInfo> pBI;
+ CComQIPtr<IAMOpenProgress> pAMOP;
+
+ CComQIPtr<IDvdControl2> pDVDC;
+ CComQIPtr<IDvdInfo2> pDVDI;
+
+ CComPtr<ICaptureGraphBuilder2> pCGB;
+ CStringW m_VidDispName, m_AudDispName;
+ CComPtr<IBaseFilter> pVidCap, pAudCap;
+ CComPtr<IAMVideoCompression> pAMVCCap, pAMVCPrev;
+ CComPtr<IAMStreamConfig> pAMVSCCap, pAMVSCPrev, pAMASC;
+ CComPtr<IAMCrossbar> pAMXBar;
+ CComPtr<IAMTVTuner> pAMTuner;
+ CComPtr<IAMDroppedFrames> pAMDF;
+
+ CComPtr<ISubPicAllocatorPresenter> m_pCAP;
+
+ void SetBalance(int balance);
+
+ // subtitles
+
+ CCritSec m_csSubLock;
+ CInterfaceList<ISubStream> m_pSubStreams;
+ int m_iSubtitleSel; // if(m_iSubtitleSel&(1<<31)): disabled
+ DWORD_PTR m_nSubtitleId;
+
+ friend class CTextPassThruFilter;
+
+ // windowing
+
+ CRect m_lastWindowRect;
+ CPoint m_lastMouseMove;
+
+ CRect m_rcDesktop;
+
+ void ShowControls(int nCS, bool fSave = true);
+
+ void SetDefaultWindowRect(int iMonitor = 0);
+ void RestoreDefaultWindowRect();
+ void ZoomVideoWindow(double scale = -1);
+ double GetZoomAutoFitScale();
+
+ void SetAlwaysOnTop(int i);
+
+ // dynamic menus
+
+ void SetupOpenCDSubMenu();
+ void SetupFiltersSubMenu();
+ void SetupAudioSwitcherSubMenu();
+ void SetupSubtitlesSubMenu();
+ void SetupNavAudioSubMenu();
+ void SetupNavSubtitleSubMenu();
+ void SetupNavAngleSubMenu();
+ void SetupNavChaptersSubMenu();
+ void SetupFavoritesSubMenu();
+ void SetupShadersSubMenu();
+
+ void SetupNavStreamSelectSubMenu(CMenu* pSub, UINT id, DWORD dwSelGroup);
+ void OnNavStreamSelectSubMenu(UINT id, DWORD dwSelGroup);
+
+ CMenu m_popupmain, m_popup;
+ CMenu m_opencds;
+ CMenu m_filters, m_subtitles, m_audios;
+ CAutoPtrArray<CMenu> m_filterpopups;
+ CMenu m_navaudio, m_navsubtitle, m_navangle;
+ CMenu m_navchapters, m_navtitles;
+ CMenu m_favorites;
+ CMenu m_shaders;
+
+ CInterfaceArray<IUnknown, &IID_IUnknown> m_pparray;
+ CInterfaceArray<IAMStreamSelect> m_ssarray;
+
+ // chapters (file mode)
+ CComPtr<IDSMChapterBag> m_pCB;
+ void SetupChapters();
+
+ //
+
+ void SetupIViAudReg();
+
+ void AddTextPassThruFilter();
+
+ int m_nLoops;
+
+ bool m_fCustomGraph;
+ bool m_fRealMediaGraph, m_fShockwaveGraph, m_fQuicktimeGraph;
+
+ CComPtr<ISubClock> m_pSubClock;
+
+ int m_fFrameSteppingActive;
+ int m_VolumeBeforeFrameStepping;
+
+ bool m_fEndOfStream;
+
+ bool m_fBuffering;
+
+ bool m_fLiveWM;
+
+ bool m_fUpdateInfoBar;
+
+ void SendStatusMessage(CString msg, int nTimeOut);
+ CString m_playingmsg, m_closingmsg;
+
+ REFERENCE_TIME m_rtDurationOverride;
+
+ CComPtr<IUnknown> m_pProv;
+
+ void CleanGraph();
+
+ CComPtr<IBaseFilter> pAudioDubSrc;
+
+ void ShowOptions(int idPage = 0);
+
+ bool GetDIB(BYTE** ppData, long& size, bool fSilent = false);
+ void SaveDIB(LPCTSTR fn, BYTE* pData, long size);
+ void SaveImage(LPCTSTR fn);
+ void SaveThumbnails(LPCTSTR fn);
+
+ //
+
+ friend class CWebClientSocket;
+ friend class CWebServer;
+ CAutoPtr<CWebServer> m_pWebServer;
+
+public:
+ void StartWebServer(int nPort);
+ void StopWebServer();
+
+ CString GetStatusMessage();
+ bool IsMuted() {return m_wndToolBar.GetVolume() == -10000;}
+ int GetVolume() {return m_wndToolBar.m_volctrl.GetPos();}
+
+public:
+ CMainFrame();
+
+ DECLARE_DYNAMIC(CMainFrame)
+
+// Attributes
+public:
+ int m_iPlaybackMode;
+
+ bool m_fFullScreen;
+ bool m_fHideCursor;
+
+ bool IsFrameLessWindow() {return(m_fFullScreen || AfxGetAppSettings().fHideCaptionMenu);}
+ bool IsCaptionMenuHidden() {return(!m_fFullScreen && AfxGetAppSettings().fHideCaptionMenu);}
+ bool IsSomethingLoaded() {return((m_iMediaLoadState == MLS_LOADING || m_iMediaLoadState == MLS_LOADED) && !IsD3DFullScreenMode());}
+ bool IsPlaylistEmpty() {return(m_wndPlaylistBar.GetCount() == 0);}
+ bool IsInteractiveVideo() {return(AfxGetAppSettings().fIntRealMedia && m_fRealMediaGraph || m_fShockwaveGraph);}
+ bool IsD3DFullScreenMode();
+
+ CControlBar* m_pLastBar;
+
+protected:
+ enum {MLS_CLOSED, MLS_LOADING, MLS_LOADED, MLS_CLOSING};
+ int m_iMediaLoadState;
+
+ bool m_fAudioOnly;
+ dispmode m_dmBeforeFullscreen;
+
+ DVD_DOMAIN m_iDVDDomain;
+ DWORD m_iDVDTitle;
+ int m_iSpeedLevel;
+
+ double m_ZoomX, m_ZoomY, m_PosX, m_PosY;
+ int m_AngleX, m_AngleY, m_AngleZ;
+
+// Operations
+ bool OpenMediaPrivate(CAutoPtr<OpenMediaData> pOMD);
+ void CloseMediaPrivate();
+
+ void SendNowPlayingToMSN();
+ void SendNowPlayingTomIRC();
+
+ void OpenCreateGraphObject(OpenMediaData* pOMD);
+ void OpenFile(OpenFileData* pOFD);
+ void OpenDVD(OpenDVDData* pODD);
+ void OpenCapture(OpenDeviceData* pODD);
+ void OpenCustomizeGraph();
+ void OpenSetupVideo();
+ void OpenSetupAudio();
+ void OpenSetupInfoBar();
+ void OpenSetupStatsBar();
+ void OpenSetupStatusBar();
+ // void OpenSetupToolBar();
+ void OpenSetupCaptureBar();
+ void OpenSetupWindowTitle(CString fn = _T(""));
+
+ friend class CGraphThread;
+ CGraphThread* m_pGraphThread;
+
+ CAtlArray<REFERENCE_TIME> m_kfs;
+
+ bool m_fOpeningAborted;
+
+public:
+ void OpenCurPlaylistItem(REFERENCE_TIME rtStart = 0);
+ void OpenMedia(CAutoPtr<OpenMediaData> pOMD);
+ void CloseMedia();
+
+ void AddCurDevToPlaylist();
+
+ bool m_fTrayIcon;
+ void ShowTrayIcon(bool fShow);
+ void SetTrayTip(CString str);
+
+ CSize GetVideoSize();
+ void ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasTo);
+ void MoveVideoWindow(bool fShowStats = false);
+ void RepaintVideo();
+
+ OAFilterState GetMediaState();
+ REFERENCE_TIME GetPos(), GetDur();
+ void SeekTo(REFERENCE_TIME rt, bool fSeekToKeyFrame = false);
+
+ bool LoadSubtitle(CString fn);
+ void UpdateSubtitle(bool fApplyDefStyle = false);
+ void SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle = false);
+ void ReplaceSubtitle(ISubStream* pSubStreamOld, ISubStream* pSubStreamNew);
+ void InvalidateSubtitle(DWORD_PTR nSubtitleId = -1, REFERENCE_TIME rtInvalidate = -1);
+ void ReloadSubtitle();
+
+ // shaders
+ CAtlList<CString> m_shaderlabels;
+ void SetShaders();
+ void UpdateShaders(CString label);
+
+ // capturing
+ bool m_fCapturing;
+ HRESULT BuildCapture(IPin* pPin, IBaseFilter* pBF[3], const GUID& majortype, AM_MEDIA_TYPE* pmt); // pBF: 0 buff, 1 enc, 2 mux, pmt is for 1 enc
+ bool BuildToCapturePreviewPin(
+ IBaseFilter* pVidCap, IPin** pVidCapPin, IPin** pVidPrevPin,
+ IBaseFilter* pAudCap, IPin** pAudCapPin, IPin** pAudPrevPin);
+ bool BuildGraphVideoAudio(int fVPreview, bool fVCapture, int fAPreview, bool fACapture);
+ bool DoCapture(), StartCapture(), StopCapture();
+
+ bool DoAfterPlaybackEvent();
+
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+ virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
+ virtual void RecalcLayout(BOOL bNotify = TRUE);
+
+// Implementation
+public:
+ virtual ~CMainFrame();
+#ifdef _DEBUG
+ virtual void AssertValid() const;
+ virtual void Dump(CDumpContext& dc) const;
+#endif
+
+protected: // control bar embedded members
+
+ CChildView m_wndView;
+
+ CPlayerSeekBar m_wndSeekBar;
+ CPlayerToolBar m_wndToolBar;
+ CPlayerInfoBar m_wndInfoBar;
+ CPlayerInfoBar m_wndStatsBar;
+ CPlayerStatusBar m_wndStatusBar;
+ CList<CControlBar*> m_bars;
+
+ CPlayerSubresyncBar m_wndSubresyncBar;
+ CPlayerPlaylistBar m_wndPlaylistBar;
+ CPlayerCaptureBar m_wndCaptureBar;
+ CPlayerShaderEditorBar m_wndShaderEditorBar;
+ CList<CSizingControlBar*> m_dockingbars;
+
+ CFileDropTarget m_fileDropTarget;
+ // TODO
+ DROPEFFECT OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+ DROPEFFECT OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point);
+ BOOL OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point);
+ DROPEFFECT OnDropEx(COleDataObject* pDataObject, DROPEFFECT dropDefault, DROPEFFECT dropList, CPoint point);
+ void OnDragLeave();
+ DROPEFFECT OnDragScroll(DWORD dwKeyState, CPoint point);
+
+ friend class CPPagePlayback; // TODO
+ friend class CMPlayerCApp; // TODO
+
+ void LoadControlBar(CControlBar* pBar, UINT defDockBarID);
+ void RestoreFloatingControlBars();
+ void SaveControlBars();
+
+// Generated message map functions
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnDestroy();
+
+ afx_msg LRESULT OnTaskBarRestart(WPARAM, LPARAM);
+ afx_msg LRESULT OnNotifyIcon(WPARAM, LPARAM);
+
+ afx_msg void OnSetFocus(CWnd* pOldWnd);
+ afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
+ afx_msg void OnMove(int x, int y);
+ afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
+ afx_msg void OnDisplayChange();
+
+ afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+ afx_msg void OnActivateApp(BOOL bActive, DWORD dwThreadID);
+ afx_msg LRESULT OnAppCommand(WPARAM wParam, LPARAM lParam);
+
+ afx_msg void OnTimer(UINT nIDEvent);
+
+ afx_msg LRESULT OnGraphNotify(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnRepaintRenderLess(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnResumeFromState(WPARAM wParam, LPARAM lParam);
+
+ BOOL OnButton(UINT id, UINT nFlags, CPoint point);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+ afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+ afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
+ afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
+ afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
+ afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
+ afx_msg LRESULT OnXButtonDown(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnXButtonUp(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnXButtonDblClk(WPARAM wParam, LPARAM lParam);
+ afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+
+ afx_msg UINT OnNcHitTest(CPoint point);
+
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+
+ afx_msg void OnInitMenu(CMenu* pMenu);
+ afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
+
+ BOOL OnMenu(CMenu* pMenu);
+ afx_msg void OnMenuPlayerShort();
+ afx_msg void OnMenuPlayerLong();
+ afx_msg void OnMenuFilters();
+
+ afx_msg void OnUpdatePlayerStatus(CCmdUI* pCmdUI);
+
+ afx_msg void OnFilePostOpenmedia();
+ afx_msg void OnUpdateFilePostOpenmedia(CCmdUI* pCmdUI);
+ afx_msg void OnFilePostClosemedia();
+ afx_msg void OnUpdateFilePostClosemedia(CCmdUI* pCmdUI);
+
+ afx_msg void OnBossKey();
+
+ afx_msg void OnStreamAudio(UINT nID);
+ afx_msg void OnStreamSub(UINT nID);
+ afx_msg void OnStreamSubOnOff();
+ afx_msg void OnOgmAudio(UINT nID);
+ afx_msg void OnOgmSub(UINT nID);
+ afx_msg void OnDvdAngle(UINT nID);
+ afx_msg void OnDvdAudio(UINT nID);
+ afx_msg void OnDvdSub(UINT nID);
+ afx_msg void OnDvdSubOnOff();
+
+
+ // menu item handlers
+
+ afx_msg void OnFileOpenQuick();
+ afx_msg void OnFileOpenmedia();
+ afx_msg void OnUpdateFileOpen(CCmdUI* pCmdUI);
+ afx_msg BOOL OnCopyData(CWnd* pWnd, COPYDATASTRUCT* pCopyDataStruct);
+ afx_msg void OnFileOpendvd();
+ afx_msg void OnFileOpendevice();
+ afx_msg void OnFileOpenCD(UINT nID);
+ afx_msg void OnDropFiles(HDROP hDropInfo); // no menu item
+ afx_msg void OnFileSaveAs();
+ afx_msg void OnUpdateFileSaveAs(CCmdUI* pCmdUI);
+ afx_msg void OnFileSaveImage();
+ afx_msg void OnFileSaveImageAuto();
+ afx_msg void OnUpdateFileSaveImage(CCmdUI* pCmdUI);
+ afx_msg void OnFileSaveThumbnails();
+ afx_msg void OnUpdateFileSaveThumbnails(CCmdUI* pCmdUI);
+ afx_msg void OnFileConvert();
+ afx_msg void OnUpdateFileConvert(CCmdUI* pCmdUI);
+ afx_msg void OnFileLoadsubtitle();
+ afx_msg void OnUpdateFileLoadsubtitle(CCmdUI* pCmdUI);
+ afx_msg void OnFileSavesubtitle();
+ afx_msg void OnUpdateFileSavesubtitle(CCmdUI* pCmdUI);
+ afx_msg void OnFileISDBSearch();
+ afx_msg void OnUpdateFileISDBSearch(CCmdUI* pCmdUI);
+ afx_msg void OnFileISDBUpload();
+ afx_msg void OnUpdateFileISDBUpload(CCmdUI* pCmdUI);
+ afx_msg void OnFileISDBDownload();
+ afx_msg void OnUpdateFileISDBDownload(CCmdUI* pCmdUI);
+ afx_msg void OnFileProperties();
+ afx_msg void OnUpdateFileProperties(CCmdUI* pCmdUI);
+ afx_msg void OnFileClosePlaylist();
+ afx_msg void OnFileCloseMedia(); // no menu item
+ afx_msg void OnUpdateFileClose(CCmdUI* pCmdUI);
+
+ afx_msg void OnViewCaptionmenu();
+ afx_msg void OnUpdateViewCaptionmenu(CCmdUI* pCmdUI);
+ afx_msg void OnViewControlBar(UINT nID);
+ afx_msg void OnUpdateViewControlBar(CCmdUI* pCmdUI);
+ afx_msg void OnViewSubresync();
+ afx_msg void OnUpdateViewSubresync(CCmdUI* pCmdUI);
+ afx_msg void OnViewPlaylist();
+ afx_msg void OnUpdateViewPlaylist(CCmdUI* pCmdUI);
+ afx_msg void OnViewCapture();
+ afx_msg void OnUpdateViewCapture(CCmdUI* pCmdUI);
+ afx_msg void OnViewShaderEditor();
+ afx_msg void OnUpdateViewShaderEditor(CCmdUI* pCmdUI);
+ afx_msg void OnViewMinimal();
+ afx_msg void OnUpdateViewMinimal(CCmdUI* pCmdUI);
+ afx_msg void OnViewCompact();
+ afx_msg void OnUpdateViewCompact(CCmdUI* pCmdUI);
+ afx_msg void OnViewNormal();
+ afx_msg void OnUpdateViewNormal(CCmdUI* pCmdUI);
+ afx_msg void OnViewFullscreen();
+ afx_msg void OnViewFullscreenSecondary();
+ afx_msg void OnUpdateViewFullscreen(CCmdUI* pCmdUI);
+ afx_msg void OnViewZoom(UINT nID);
+ afx_msg void OnUpdateViewZoom(CCmdUI* pCmdUI);
+ afx_msg void OnViewZoomAutoFit();
+ afx_msg void OnViewDefaultVideoFrame(UINT nID);
+ afx_msg void OnUpdateViewDefaultVideoFrame(CCmdUI* pCmdUI);
+ afx_msg void OnViewKeepaspectratio();
+ afx_msg void OnUpdateViewKeepaspectratio(CCmdUI* pCmdUI);
+ afx_msg void OnViewCompMonDeskARDiff();
+ afx_msg void OnUpdateViewCompMonDeskARDiff(CCmdUI* pCmdUI);
+ afx_msg void OnViewPanNScan(UINT nID);
+ afx_msg void OnUpdateViewPanNScan(CCmdUI* pCmdUI);
+ afx_msg void OnViewPanNScanPresets(UINT nID);
+ afx_msg void OnUpdateViewPanNScanPresets(CCmdUI* pCmdUI);
+ afx_msg void OnViewRotate(UINT nID);
+ afx_msg void OnUpdateViewRotate(CCmdUI* pCmdUI);
+ afx_msg void OnViewAspectRatio(UINT nID);
+ afx_msg void OnUpdateViewAspectRatio(CCmdUI* pCmdUI);
+ afx_msg void OnViewAspectRatioNext();
+ afx_msg void OnViewOntop(UINT nID);
+ afx_msg void OnUpdateViewOntop(CCmdUI* pCmdUI);
+ afx_msg void OnViewOptions();
+ afx_msg void OnUpdateViewTearingTest(CCmdUI* pCmdUI);
+ afx_msg void OnViewTearingTest();
+ afx_msg void OnUpdateShaderToggle(CCmdUI* pCmdUI);
+ afx_msg void OnShaderToggle();
+ afx_msg void OnUpdateViewRemainingTime(CCmdUI* pCmdUI);
+ afx_msg void OnViewRemainingTime();
+
+
+ afx_msg void OnPlayPlay();
+ afx_msg void OnPlayPause();
+ afx_msg void OnPlayPlaypause();
+ afx_msg void OnPlayStop();
+ afx_msg void OnUpdatePlayPauseStop(CCmdUI* pCmdUI);
+ afx_msg void OnPlayFramestep(UINT nID);
+ afx_msg void OnUpdatePlayFramestep(CCmdUI* pCmdUI);
+ afx_msg void OnPlaySeek(UINT nID);
+ afx_msg void OnPlaySeekKey(UINT nID); // no menu item
+ afx_msg void OnUpdatePlaySeek(CCmdUI* pCmdUI);
+ afx_msg void OnPlayGoto();
+ afx_msg void OnUpdateGoto(CCmdUI* pCmdUI);
+ afx_msg void OnPlayChangeRate(UINT nID);
+ afx_msg void OnUpdatePlayChangeRate(CCmdUI* pCmdUI);
+ afx_msg void OnPlayResetRate();
+ afx_msg void OnUpdatePlayResetRate(CCmdUI* pCmdUI);
+ afx_msg void OnPlayChangeAudDelay(UINT nID);
+ afx_msg void OnUpdatePlayChangeAudDelay(CCmdUI* pCmdUI);
+ afx_msg void OnPlayFilters(UINT nID);
+ afx_msg void OnUpdatePlayFilters(CCmdUI* pCmdUI);
+ afx_msg void OnPlayShaders(UINT nID);
+ afx_msg void OnUpdatePlayShaders(CCmdUI* pCmdUI);
+ afx_msg void OnPlayAudio(UINT nID);
+ afx_msg void OnUpdatePlayAudio(CCmdUI* pCmdUI);
+ afx_msg void OnPlaySubtitles(UINT nID);
+ afx_msg void OnUpdatePlaySubtitles(CCmdUI* pCmdUI);
+ afx_msg void OnPlayLanguage(UINT nID);
+ afx_msg void OnUpdatePlayLanguage(CCmdUI* pCmdUI);
+ afx_msg void OnPlayVolume(UINT nID);
+ afx_msg void OnPlayVolumeBoost(UINT nID);
+ afx_msg void OnUpdatePlayVolumeBoost(CCmdUI* pCmdUI);
+ afx_msg void OnAfterplayback(UINT nID);
+ afx_msg void OnUpdateAfterplayback(CCmdUI* pCmdUI);
+
+ afx_msg void OnNavigateSkip(UINT nID);
+ afx_msg void OnUpdateNavigateSkip(CCmdUI* pCmdUI);
+ afx_msg void OnNavigateSkipPlaylistItem(UINT nID);
+ afx_msg void OnUpdateNavigateSkipPlaylistItem(CCmdUI* pCmdUI);
+ afx_msg void OnNavigateMenu(UINT nID);
+ afx_msg void OnUpdateNavigateMenu(CCmdUI* pCmdUI);
+ afx_msg void OnNavigateAudio(UINT nID);
+ afx_msg void OnNavigateSubpic(UINT nID);
+ afx_msg void OnNavigateAngle(UINT nID);
+ afx_msg void OnNavigateChapters(UINT nID);
+ afx_msg void OnNavigateMenuItem(UINT nID);
+ afx_msg void OnUpdateNavigateMenuItem(CCmdUI* pCmdUI);
+
+ afx_msg void OnFavoritesAdd();
+ afx_msg void OnUpdateFavoritesAdd(CCmdUI* pCmdUI);
+ afx_msg void OnFavoritesOrganize();
+ afx_msg void OnUpdateFavoritesOrganize(CCmdUI* pCmdUI);
+ afx_msg void OnFavoritesFile(UINT nID);
+ afx_msg void OnUpdateFavoritesFile(CCmdUI* pCmdUI);
+ afx_msg void OnFavoritesDVD(UINT nID);
+ afx_msg void OnUpdateFavoritesDVD(CCmdUI* pCmdUI);
+ afx_msg void OnFavoritesDevice(UINT nID);
+ afx_msg void OnUpdateFavoritesDevice(CCmdUI* pCmdUI);
+
+ afx_msg void OnHelpHomepage();
+ afx_msg void OnHelpDocumentation();
+ afx_msg void OnHelpDonate();
+
+ afx_msg void OnClose();
+
+
+ // ==== Added by CASIMIR666
+ CWnd* m_pVideoWnd; // Vidéo courante (écran principal ou 2ieme écran)
+ SIZE m_fullWndSize;
+ CFullscreenWnd* m_pFullscreenWnd;
+ CComPtr<IVMRMixerControl9> m_pMC;
+ CVMROSD m_OSD;
+ bool m_bD3DFullscreenMode;
+ bool m_bRemainingTime;
+
+ bool CreateFullScreenWindow();
+ void SetVMR9ColorControl(float Brightness, float Contrast, float Hue, float Saturation);
+ LPCTSTR GetDVDAudioFormatName (DVD_AudioAttributes& ATR);
+};
diff --git a/src/apps/mplayerc/MediaFormats.cpp b/src/apps/mplayerc/MediaFormats.cpp
new file mode 100644
index 000000000..644e95511
--- /dev/null
+++ b/src/apps/mplayerc/MediaFormats.cpp
@@ -0,0 +1,344 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <atlbase.h>
+#include "MediaFormats.h"
+
+//
+// CMediaFormatCategory
+//
+
+CMediaFormatCategory::CMediaFormatCategory()
+ : m_fAudioOnly(false)
+{
+}
+
+CMediaFormatCategory::CMediaFormatCategory(
+ CString label, CAtlList<CString>& exts, bool fAudioOnly,
+ CString specreqnote, engine_t engine)
+{
+ m_label = label;
+ m_exts.AddTailList(&exts);
+ m_backupexts.AddTailList(&m_exts);
+ m_specreqnote = specreqnote;
+ m_fAudioOnly = fAudioOnly;
+ m_engine = engine;
+}
+
+CMediaFormatCategory::CMediaFormatCategory(
+ CString label, CString exts, bool fAudioOnly,
+ CString specreqnote, engine_t engine)
+{
+ m_label = label;
+ ExplodeMin(exts, m_exts, ' ');
+ POSITION pos = m_exts.GetHeadPosition();
+ while(pos) m_exts.GetNext(pos).TrimLeft('.');
+
+ m_backupexts.AddTailList(&m_exts);
+ m_specreqnote = specreqnote;
+ m_fAudioOnly = fAudioOnly;
+ m_engine = engine;
+}
+
+CMediaFormatCategory::~CMediaFormatCategory()
+{
+}
+
+void CMediaFormatCategory::UpdateData(bool fSave)
+{
+ if(fSave)
+ {
+ AfxGetApp()->WriteProfileString(_T("FileFormats"), m_label, GetExts(true));
+ }
+ else
+ {
+ SetExts(AfxGetApp()->GetProfileString(_T("FileFormats"), m_label, GetExts(true)));
+ }
+}
+
+CMediaFormatCategory::CMediaFormatCategory(CMediaFormatCategory& mfc)
+{
+ *this = mfc;
+}
+
+CMediaFormatCategory& CMediaFormatCategory::operator = (const CMediaFormatCategory& mfc)
+{
+ m_label = mfc.m_label;
+ m_specreqnote = mfc.m_specreqnote;
+ m_exts.RemoveAll();
+ m_exts.AddTailList(&mfc.m_exts);
+ m_backupexts.RemoveAll();
+ m_backupexts.AddTailList(&mfc.m_backupexts);
+ m_fAudioOnly = mfc.m_fAudioOnly;
+ m_engine = mfc.m_engine;
+
+ return(*this);
+}
+
+void CMediaFormatCategory::RestoreDefaultExts()
+{
+ m_exts.RemoveAll();
+ m_exts.AddTailList(&m_backupexts);
+}
+
+void CMediaFormatCategory::SetExts(CAtlList<CString>& exts)
+{
+ m_exts.RemoveAll();
+ m_exts.AddTailList(&exts);
+}
+
+void CMediaFormatCategory::SetExts(CString exts)
+{
+ m_exts.RemoveAll();
+ ExplodeMin(exts, m_exts, ' ');
+ POSITION pos = m_exts.GetHeadPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ CString& ext = m_exts.GetNext(pos);
+ if(ext[0] == '\\') {m_engine = (engine_t)_tcstol(ext.TrimLeft('\\'), NULL, 10); m_exts.RemoveAt(cur);}
+ else ext.TrimLeft('.');
+ }
+}
+
+CString CMediaFormatCategory::GetFilter()
+{
+ CString filter;
+ POSITION pos = m_exts.GetHeadPosition();
+ while(pos) filter += _T("*.") + m_exts.GetNext(pos) + _T(";");
+ filter.TrimRight(_T(";")); // cheap...
+ return(filter);
+}
+
+CString CMediaFormatCategory::GetExts(bool fAppendEngine)
+{
+ CString exts = Implode(m_exts, ' ');
+ if(fAppendEngine) exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
+ return(exts);
+}
+
+CString CMediaFormatCategory::GetExtsWithPeriod(bool fAppendEngine)
+{
+ CString exts;
+ POSITION pos = m_exts.GetHeadPosition();
+ while(pos) exts += _T(".") + m_exts.GetNext(pos) + _T(" ");
+ exts.TrimRight(_T(" ")); // cheap...
+ if(fAppendEngine) exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
+ return(exts);
+}
+
+CString CMediaFormatCategory::GetBackupExtsWithPeriod(bool fAppendEngine)
+{
+ CString exts;
+ POSITION pos = m_backupexts.GetHeadPosition();
+ while(pos) exts += _T(".") + m_backupexts.GetNext(pos) + _T(" ");
+ exts.TrimRight(_T(" ")); // cheap...
+ if(fAppendEngine) exts += CString(_T(" \\")) + (TCHAR)(0x30 + (int)m_engine);
+ return(exts);
+}
+
+//
+// CMediaFormats
+//
+
+CMediaFormats::CMediaFormats()
+{
+}
+
+CMediaFormats::~CMediaFormats()
+{
+}
+
+void CMediaFormats::UpdateData(bool fSave)
+{
+ if(fSave)
+ {
+ AfxGetApp()->WriteProfileString(_T("FileFormats"), NULL, NULL);
+
+ AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspHandler"), m_iRtspHandler);
+ AfxGetApp()->WriteProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), m_fRtspFileExtFirst);
+ }
+ else
+ {
+ RemoveAll();
+#define ADDFMT(f) Add(CMediaFormatCategory##f)
+ ADDFMT((_T("Windows Media file"), _T("wmv wmp wm asf")));
+ ADDFMT((_T("Windows Media Audio file"), _T("wma"), true));
+ ADDFMT((_T("Video file"), _T("avi")));
+ ADDFMT((_T("Audio file"), _T("wav"), true));
+ ADDFMT((_T("MPEG Media file "), _T("mpg mpeg mpe m1v m2v mpv2 mp2v dat ts tp tpr pva pss")));
+ ADDFMT((_T("MPEG Audio file"), _T("mpa mp2 m1a m2a"), true));
+ ADDFMT((_T("DVD file"), _T("vob ifo")));
+ ADDFMT((_T("DVD Audio file"), _T("ac3 dts"), true));
+ ADDFMT((_T("MP3 Format Sound"), _T("mp3"), true));
+ ADDFMT((_T("MIDI file"), _T("mid midi rmi"), true));
+ ADDFMT((_T("Indeo Video file"), _T("ivf")));
+ ADDFMT((_T("AIFF Format Sound"), _T("aif aifc aiff"), true));
+ ADDFMT((_T("AU Format Sound"), _T("au snd"), true));
+ ADDFMT((_T("Ogg Media file"), _T("ogm")));
+ ADDFMT((_T("Ogg Vorbis Audio file"), _T("ogg"), true));
+ ADDFMT((_T("CD Audio Track"), _T("cda"), true, _T("Windows 2000/XP or better")));
+ ADDFMT((_T("FLIC file"), _T("fli flc flic")));
+ ADDFMT((_T("DVD2AVI Project file"), _T("d2v")));
+ ADDFMT((_T("MPEG4 file "), _T("mp4 m4v m4p m4b 3gp 3gpp 3g2 3gp2")));
+ ADDFMT((_T("MPEG4 Audio file "), _T("m4a aac"), true));
+ ADDFMT((_T("Matroska Media file"), _T("mkv")));
+ ADDFMT((_T("Matroska Audio file"), _T("mka"), true));
+ ADDFMT((_T("Smacker/Bink Media file"), _T("smk bik"), false, _T("smackw32/binkw32.dll in dll path")));
+ ADDFMT((_T("ratdvd file"), _T("ratdvd"), false, _T("ratdvd media file")));
+ ADDFMT((_T("RoQ Media file"), _T("roq"), false));
+ ADDFMT((_T("Real Media file "), _T("rm ram rmvb rpm"), false, _T("RealOne or codec pack")));
+ ADDFMT((_T("Real Audio file "), _T("ra"), true, _T("RealOne or codec pack")));
+ ADDFMT((_T("Real Script file"), _T("rt rp smi smil"), false, _T("RealOne or codec pack"), RealMedia));
+ ADDFMT((_T("Dirac Video file"), _T("drc"), false));
+ ADDFMT((_T("DirectShow Media file"), _T("dsm dsv dsa dss")));
+ ADDFMT((_T("Shockwave Flash file"), _T("swf"), false, _T("ShockWave ActiveX control"), ShockWave));
+ ADDFMT((_T("Quicktime file "), _T("mov qt amr"), false, _T("QuickTime Player or codec pack"), QuickTime));
+ ADDFMT((_T("Image file"), _T("jpeg jpg bmp gif pic png dib tiff tif")));
+ ADDFMT((_T("Playlist file"), _T("asx m3u pls wvx wax wmx mpcpl")));
+ ADDFMT((_T("Other "), _T("divx vp6")));
+#undef ADDFMT
+
+ m_iRtspHandler = (engine_t)AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspHandler"), (int)RealMedia);
+ m_fRtspFileExtFirst = !!AfxGetApp()->GetProfileInt(_T("FileFormats"), _T("RtspFileExtFirst"), 1);
+ }
+
+ for(int i = 0; i < GetCount(); i++)
+ GetAt(i).UpdateData(fSave);
+}
+
+engine_t CMediaFormats::GetRtspHandler(bool& fRtspFileExtFirst)
+{
+ fRtspFileExtFirst = m_fRtspFileExtFirst;
+ return m_iRtspHandler;
+}
+
+void CMediaFormats::SetRtspHandler(engine_t e, bool fRtspFileExtFirst)
+{
+ m_iRtspHandler = e;
+ m_fRtspFileExtFirst = fRtspFileExtFirst;
+}
+
+bool CMediaFormats::IsUsingEngine(CString path, engine_t e)
+{
+ return(GetEngine(path) == e);
+}
+
+engine_t CMediaFormats::GetEngine(CString path)
+{
+ path.Trim().MakeLower();
+
+ if(!m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0)
+ return m_iRtspHandler;
+
+ CString ext = CPath(path).GetExtension();
+ ext.MakeLower();
+ if(!ext.IsEmpty())
+ {
+ if(path.Find(_T("rtsp://")) == 0)
+ {
+ if(ext == _T(".ram") || ext == _T(".rm") || ext == _T(".ra"))
+ return RealMedia;
+ if(ext == _T(".qt") || ext == _T(".mov"))
+ return QuickTime;
+ }
+
+ for(int i = 0; i < GetCount(); i++)
+ {
+ CMediaFormatCategory& mfc = GetAt(i);
+ if(mfc.FindExt(ext))
+ return mfc.GetEngineType();
+ }
+ }
+
+ if(m_fRtspFileExtFirst && path.Find(_T("rtsp://")) == 0)
+ return m_iRtspHandler;
+
+ return DirectShow;
+}
+
+bool CMediaFormats::FindExt(CString ext, bool fAudioOnly)
+{
+ ext.TrimLeft(_T("."));
+
+ if(!ext.IsEmpty())
+ {
+ for(int i = 0; i < GetCount(); i++)
+ {
+ CMediaFormatCategory& mfc = GetAt(i);
+ if((!fAudioOnly || mfc.IsAudioOnly()) && mfc.FindExt(ext))
+ return(true);
+ }
+ }
+
+ return(false);
+}
+
+void CMediaFormats::GetFilter(CString& filter, CAtlArray<CString>& mask)
+{
+ filter += _T("Media files (all types)|__dummy|");
+ mask.Add(_T(""));
+
+ for(int i = 0; i < GetCount(); i++)
+ mask[0] += GetAt(i).GetFilter() + _T(";");
+ mask[0].TrimRight(_T(";"));
+
+ for(int i = 0; i < GetCount(); i++)
+ {
+ CMediaFormatCategory& mfc = GetAt(i);
+ filter += mfc.GetLabel() + _T("|__dummy|");
+ mask.Add(mfc.GetFilter());
+ }
+
+ filter += _T("All files (*.*)|__dummy|");
+ mask.Add(_T("*.*"));
+
+ filter += _T("|");
+}
+
+void CMediaFormats::GetAudioFilter(CString& filter, CAtlArray<CString>& mask)
+{
+ filter += _T("Audio files (all types)|__dummy|");
+ mask.Add(_T(""));
+
+ for(int i = 0; i < GetCount(); i++)
+ {
+ CMediaFormatCategory& mfc = GetAt(i);
+ if(!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) continue;
+ mask[0] += GetAt(i).GetFilter() + _T(";");
+ }
+
+ mask[0].TrimRight(_T(";"));
+
+ for(int i = 0; i < GetCount(); i++)
+ {
+ CMediaFormatCategory& mfc = GetAt(i);
+ if(!mfc.IsAudioOnly() || mfc.GetEngineType() != DirectShow) continue;
+ filter += mfc.GetLabel() + _T("|__dummy|");
+ mask.Add(mfc.GetFilter());
+ }
+
+ filter += _T("All files (*.*)|__dummy|");
+ mask.Add(_T("*.*"));
+
+ filter += _T("|");
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/MediaFormats.h b/src/apps/mplayerc/MediaFormats.h
new file mode 100644
index 000000000..ae54f9717
--- /dev/null
+++ b/src/apps/mplayerc/MediaFormats.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+#include "BaseGraph.h"
+
+class CMediaFormatCategory
+{
+public:
+protected:
+ CString m_label, m_specreqnote;
+ CAtlList<CString> m_exts, m_backupexts;
+ bool m_fAudioOnly;
+ engine_t m_engine;
+
+public:
+ CMediaFormatCategory();
+ CMediaFormatCategory(
+ CString label, CAtlList<CString>& exts, bool fAudioOnly = false,
+ CString specreqnote = _T(""), engine_t e = DirectShow);
+ CMediaFormatCategory(
+ CString label, CString exts, bool fAudioOnly = false,
+ CString specreqnote = _T(""), engine_t e = DirectShow);
+ virtual ~CMediaFormatCategory();
+
+ void UpdateData(bool fSave);
+
+ CMediaFormatCategory(CMediaFormatCategory& mfc);
+ CMediaFormatCategory& operator = (const CMediaFormatCategory& mfc);
+
+ void RestoreDefaultExts();
+ void SetExts(CAtlList<CString>& exts);
+ void SetExts(CString exts);
+
+ bool FindExt(CString ext) {return m_exts.Find(ext.TrimLeft(_T(".")).MakeLower()) != NULL;}
+
+ CString GetLabel() {return m_label;}
+ CString GetFilter();
+ CString GetExts(bool fAppendEngine = false);
+ CString GetExtsWithPeriod(bool fAppendEngine = false);
+ CString GetBackupExtsWithPeriod(bool fAppendEngine = false);
+ CString GetSpecReqNote() {return m_specreqnote;}
+ bool IsAudioOnly() {return m_fAudioOnly;}
+ engine_t GetEngineType() {return m_engine;}
+ void SetEngineType(engine_t e) {m_engine = e;}
+};
+
+class CMediaFormats : public CArray<CMediaFormatCategory>
+{
+protected:
+ engine_t m_iRtspHandler;
+ bool m_fRtspFileExtFirst;
+
+public:
+ CMediaFormats();
+ virtual ~CMediaFormats();
+
+ void UpdateData(bool fSave);
+
+ engine_t GetRtspHandler(bool& fRtspFileExtFirst);
+ void SetRtspHandler(engine_t e, bool fRtspFileExtFirst);
+
+ bool IsUsingEngine(CString path, engine_t e);
+ engine_t GetEngine(CString path);
+
+ bool FindExt(CString ext, bool fAudioOnly = false);
+
+ void GetFilter(CString& filter, CAtlArray<CString>& mask);
+ void GetAudioFilter(CString& filter, CAtlArray<CString>& mask);
+};
diff --git a/src/apps/mplayerc/MediaTypesDlg.cpp b/src/apps/mplayerc/MediaTypesDlg.cpp
new file mode 100644
index 000000000..aaa4dd969
--- /dev/null
+++ b/src/apps/mplayerc/MediaTypesDlg.cpp
@@ -0,0 +1,340 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// MediaTypesDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MediaTypesDlg.h"
+#include "..\..\DSUtil\DSUtil.h"
+#include "..\..\..\include\moreuuids.h"
+
+#pragma pack(push, 1)
+typedef struct
+{
+ WAVEFORMATEX Format;
+ BYTE bBigEndian;
+ BYTE bsid;
+ BYTE lfeon;
+ BYTE copyrightb;
+ BYTE nAuxBitsCode; // Aux bits per frame
+} DOLBYAC3WAVEFORMAT;
+#pragma pack(pop)
+
+// CMediaTypesDlg dialog
+
+//IMPLEMENT_DYNAMIC(CMediaTypesDlg, CResizableDialog)
+CMediaTypesDlg::CMediaTypesDlg(IGraphBuilderDeadEnd* pGBDE, CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CMediaTypesDlg::IDD, pParent)
+ , m_pGBDE(pGBDE)
+{
+ m_subtype = GUID_NULL;
+ m_type = UNKNOWN;
+}
+
+CMediaTypesDlg::~CMediaTypesDlg()
+{
+}
+
+void CMediaTypesDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CResizableDialog::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO1, m_pins);
+ DDX_Control(pDX, IDC_EDIT1, m_report);
+}
+
+void CMediaTypesDlg::AddLine(CString str)
+{
+ str.Replace(_T("\n"), _T("\r\n"));
+ int len = m_report.GetWindowTextLength();
+ m_report.SetSel(len, len, TRUE);
+ m_report.ReplaceSel(str);
+}
+
+void CMediaTypesDlg::AddMediaType(AM_MEDIA_TYPE* pmt)
+{
+ CString major = CStringFromGUID(pmt->majortype);
+ CString sub = CStringFromGUID(pmt->subtype);
+ CString format = CStringFromGUID(pmt->formattype);
+
+ m_subtype = pmt->subtype;
+ if(pmt->majortype == MEDIATYPE_Video) m_type = VIDEO;
+ else if(pmt->majortype == MEDIATYPE_Audio) m_type = AUDIO;
+ else m_type = UNKNOWN;
+
+ CString str;
+
+ AddLine(_T("AM_MEDIA_TYPE: (") + CMediaTypeEx(*pmt).ToString() + _T(")\n"));
+ str.Format(_T("majortype: %s %s\n"), CString(GuidNames[pmt->majortype]), major);
+ AddLine(str);
+ str.Format(_T("subtype: %s %s\n"), CString(GuidNames[pmt->subtype]), sub);
+ AddLine(str);
+ str.Format(_T("formattype: %s %s\n"), CString(GuidNames[pmt->formattype]), format);
+ AddLine(str);
+ str.Format(_T("bFixedSizeSamples: %d\n"), pmt->bFixedSizeSamples);
+ AddLine(str);
+ str.Format(_T("bTemporalCompression: %d\n"), pmt->bTemporalCompression);
+ AddLine(str);
+ str.Format(_T("lSampleSize: %d\n"), pmt->lSampleSize);
+ AddLine(str);
+ str.Format(_T("cbFormat: %d\n"), pmt->cbFormat);
+ AddLine(str);
+
+ AddLine();
+
+ if(pmt->formattype == FORMAT_VideoInfo || pmt->formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER& vih = *((VIDEOINFOHEADER*)pmt->pbFormat);
+ BITMAPINFOHEADER* bih = &vih.bmiHeader;
+
+ AddLine(_T("VIDEOINFOHEADER:\n"));
+ str.Format(_T("rcSource: (%d,%d)-(%d,%d)\n"), vih.rcSource);
+ AddLine(str);
+ str.Format(_T("rcTarget: (%d,%d)-(%d,%d)\n"), vih.rcTarget);
+ AddLine(str);
+ str.Format(_T("dwBitRate: %d\n"), vih.dwBitRate);
+ AddLine(str);
+ str.Format(_T("dwBitErrorRate: %d\n"), vih.dwBitErrorRate);
+ AddLine(str);
+ str.Format(_T("AvgTimePerFrame: %I64d\n"), vih.AvgTimePerFrame);
+ AddLine(str);
+
+ if(pmt->formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2& vih = *((VIDEOINFOHEADER2*)pmt->pbFormat);
+ bih = &vih.bmiHeader;
+
+ AddLine(_T("VIDEOINFOHEADER2:\n"));
+ str.Format(_T("dwInterlaceFlags: 0x%08x\n"), vih.dwInterlaceFlags);
+ AddLine(str);
+ str.Format(_T("dwCopyProtectFlags: 0x%08x\n"), vih.dwCopyProtectFlags);
+ AddLine(str);
+ str.Format(_T("dwPictAspectRatioX: %d\n"), vih.dwPictAspectRatioX);
+ AddLine(str);
+ str.Format(_T("dwPictAspectRatioY: %d\n"), vih.dwPictAspectRatioY);
+ AddLine(str);
+ str.Format(_T("dwControlFlags: 0x%08x\n"), vih.dwControlFlags);
+ AddLine(str);
+ str.Format(_T("dwReserved2: 0x%08x\n"), vih.dwReserved2);
+ AddLine(str);
+ }
+
+ AddLine();
+
+ AddLine(_T("BITMAPINFOHEADER:\n"));
+ str.Format(_T("biSize: %d\n"), bih->biSize);
+ AddLine(str);
+ str.Format(_T("biWidth: %d\n"), bih->biWidth);
+ AddLine(str);
+ str.Format(_T("biHeight: %d\n"), bih->biHeight);
+ AddLine(str);
+ str.Format(_T("biPlanes: %d\n"), bih->biPlanes);
+ AddLine(str);
+ str.Format(_T("biBitCount: %d\n"), bih->biBitCount);
+ AddLine(str);
+ if(bih->biCompression < 256) str.Format(_T("biCompression: %d\n"), bih->biCompression);
+ else str.Format(_T("biCompression: %4.4hs\n"), &bih->biCompression);
+ AddLine(str);
+ str.Format(_T("biSizeImage: %d\n"), bih->biSizeImage);
+ AddLine(str);
+ str.Format(_T("biXPelsPerMeter: %d\n"), bih->biXPelsPerMeter);
+ AddLine(str);
+ str.Format(_T("biYPelsPerMeter: %d\n"), bih->biYPelsPerMeter);
+ AddLine(str);
+ str.Format(_T("biYPelsPerMeter: %d\n"), bih->biYPelsPerMeter);
+ AddLine(str);
+ str.Format(_T("biClrUsed: %d\n"), bih->biClrUsed);
+ AddLine(str);
+ str.Format(_T("biClrImportant: %d\n"), bih->biClrImportant);
+ AddLine(str);
+
+ AddLine();
+ }
+ else if(pmt->formattype == FORMAT_WaveFormatEx)
+ {
+ WAVEFORMATEX& wfe = *((WAVEFORMATEX*)pmt->pbFormat);
+
+ AddLine(_T("WAVEFORMATEX:\n"));
+ str.Format(_T("wFormatTag: 0x%04x\n"), wfe.wFormatTag);
+ AddLine(str);
+ str.Format(_T("nChannels: %d\n"), wfe.nChannels);
+ AddLine(str);
+ str.Format(_T("nSamplesPerSec: %d\n"), wfe.nSamplesPerSec);
+ AddLine(str);
+ str.Format(_T("nAvgBytesPerSec: %d\n"), wfe.nAvgBytesPerSec);
+ AddLine(str);
+ str.Format(_T("nBlockAlign: %d\n"), wfe.nBlockAlign);
+ AddLine(str);
+ str.Format(_T("wBitsPerSample: %d\n"), wfe.wBitsPerSample);
+ AddLine(str);
+
+ if(wfe.wFormatTag != WAVE_FORMAT_PCM && wfe.cbSize > 0)
+ {
+ str.Format(_T("cbSize: %d (extra bytes)\n"), wfe.cbSize);
+ AddLine(str);
+
+ if(wfe.wFormatTag == WAVE_FORMAT_EXTENSIBLE && wfe.cbSize == sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX))
+ {
+ WAVEFORMATEXTENSIBLE& wfe = *((WAVEFORMATEXTENSIBLE*)pmt->pbFormat);
+
+ AddLine(_T("WAVEFORMATEXTENSIBLE:\n"));
+ if(wfe.Format.wBitsPerSample != 0) str.Format(_T("wValidBitsPerSample: %d\n"), wfe.Samples.wValidBitsPerSample);
+ else str.Format(_T("wSamplesPerBlock: %d\n"), wfe.Samples.wSamplesPerBlock);
+ AddLine(str);
+ str.Format(_T("dwChannelMask: 0x%08x\n"), wfe.dwChannelMask);
+ AddLine(str);
+ str.Format(_T("SubFormat: %s\n"), CStringFromGUID(wfe.SubFormat));
+ AddLine(str);
+ }
+ else if(wfe.wFormatTag == WAVE_FORMAT_DOLBY_AC3 && wfe.cbSize == sizeof(DOLBYAC3WAVEFORMAT)-sizeof(WAVEFORMATEX))
+ {
+ DOLBYAC3WAVEFORMAT& wfe = *((DOLBYAC3WAVEFORMAT*)pmt->pbFormat);
+
+ AddLine(_T("DOLBYAC3WAVEFORMAT:\n"));
+ str.Format(_T("bBigEndian: %d\n"), wfe.bBigEndian);
+ AddLine(str);
+ str.Format(_T("bsid: %d\n"), wfe.bsid);
+ AddLine(str);
+ str.Format(_T("lfeon: %d\n"), wfe.lfeon);
+ AddLine(str);
+ str.Format(_T("copyrightb: %d\n"), wfe.copyrightb);
+ AddLine(str);
+ str.Format(_T("nAuxBitsCode: %d\n"), wfe.nAuxBitsCode);
+ AddLine(str);
+ }
+ }
+
+ AddLine();
+ }
+
+ if(pmt->cbFormat > 0)
+ {
+ AddLine(_T("pbFormat:\n"));
+
+ for(int i = 0, j = (pmt->cbFormat + 15) & ~15; i < j; i += 16)
+ {
+ str.Format(_T("%08x:"), i);
+ for(int k = i, l = min(i+16, pmt->cbFormat); k < l; k++)
+ {
+ CString byte;
+ byte.Format(_T(" %02x"), pmt->pbFormat[k]);
+ str += byte;
+ }
+ str += '\n';
+ AddLine(str);
+ }
+
+ AddLine();
+ }
+}
+
+BEGIN_MESSAGE_MAP(CMediaTypesDlg, CResizableDialog)
+ ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateButton1)
+END_MESSAGE_MAP()
+
+
+// CMediaTypesDlg message handlers
+
+BOOL CMediaTypesDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ CAtlList<CStringW> path;
+ CAtlList<CMediaType> mts;
+
+ for(int i = 0; S_OK == m_pGBDE->GetDeadEnd(i, path, mts); i++)
+ {
+ if(!path.GetCount()) continue;
+ m_pins.SetItemData(m_pins.AddString(CString(path.GetTail())), (DWORD_PTR)i);
+ }
+
+ m_pins.SetCurSel(0);
+ OnCbnSelchangeCombo1();
+
+ AddAnchor(IDC_STATIC1, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDC_STATIC2, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON1, BOTTOM_LEFT);
+ AddAnchor(IDOK, BOTTOM_RIGHT);
+
+ SetMinTrackSize(CSize(300, 200));
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CMediaTypesDlg::OnCbnSelchangeCombo1()
+{
+ m_report.SetWindowText(_T(""));
+
+ int i = m_pins.GetCurSel();
+ if(i < 0) return;
+
+ CAtlList<CStringW> path;
+ CAtlList<CMediaType> mts;
+
+ if(FAILED(m_pGBDE->GetDeadEnd(i, path, mts)) || !path.GetCount())
+ return;
+
+ POSITION pos = path.GetHeadPosition();
+ while(pos)
+ {
+ AddLine(CString(path.GetNext(pos)) + _T("\n"));
+ if(!pos) AddLine(_T("\n"));
+ }
+
+ pos = mts.GetHeadPosition();
+ for(int j = 0; pos; j++)
+ {
+ CString str;
+ str.Format(_T("Media Type %d:\n"), j);
+ AddLine(str);
+ AddLine(_T("--------------------------\n"));
+ AddMediaType(&mts.GetNext(pos));
+ AddLine();
+ }
+
+ m_report.SetSel(0, 0);
+}
+
+void CMediaTypesDlg::OnBnClickedButton1()
+{
+ if(m_subtype.Data2 == 0x0000 && m_subtype.Data3 == 0x0010
+ && *(unsigned __int64*)m_subtype.Data4 == 0x719b3800aa000080i64)
+ {
+ BYTE* p = (BYTE*)&m_subtype.Data1;
+ for(int i = 0; i < 4; i++, p++)
+ if(*p >= 'a' && *p <= 'z') *p -= 0x20;
+ }
+
+ CString str;
+ str.Format(_T("http://gabest.org/codec.php?type=%d&guid=%s"), m_type, CStringFromGUID(m_subtype));
+ ShellExecute(NULL, _T("open"), str, NULL, NULL, SW_SHOW);
+}
+
+void CMediaTypesDlg::OnUpdateButton1(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_subtype != GUID_NULL);
+}
diff --git a/src/apps/mplayerc/MediaTypesDlg.h b/src/apps/mplayerc/MediaTypesDlg.h
new file mode 100644
index 000000000..6d9755c86
--- /dev/null
+++ b/src/apps/mplayerc/MediaTypesDlg.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <afxwin.h>
+#include <atlcoll.h>
+#include "IGraphBuilder2.h"
+
+// CMediaTypesDlg dialog
+
+class CMediaTypesDlg : public CResizableDialog
+{
+// DECLARE_DYNAMIC(CMediaTypesDlg)
+
+private:
+ CComPtr<IGraphBuilderDeadEnd> m_pGBDE;
+ enum {UNKNOWN, VIDEO, AUDIO} m_type;
+ GUID m_subtype;
+ void AddLine(CString str = _T("\n"));
+ void AddMediaType(AM_MEDIA_TYPE* pmt);
+
+public:
+ CMediaTypesDlg(IGraphBuilderDeadEnd* pGBDE, CWnd* pParent = NULL); // standard constructor
+ virtual ~CMediaTypesDlg();
+
+// Dialog Data
+ enum { IDD = IDD_MEDIATYPES_DLG };
+ CComboBox m_pins;
+ CEdit m_report;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnCbnSelchangeCombo1();
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnUpdateButton1(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/OpenCapDeviceDlg.cpp b/src/apps/mplayerc/OpenCapDeviceDlg.cpp
new file mode 100644
index 000000000..e4a3b0b60
--- /dev/null
+++ b/src/apps/mplayerc/OpenCapDeviceDlg.cpp
@@ -0,0 +1,448 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// OpenCapDeviceDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "OpenCapDeviceDlg.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+static struct cc_t {long code; AnalogVideoStandard standard; const TCHAR* str;} s_countrycodes[] =
+{
+ {1, AnalogVideo_NTSC_M, _T("USA")},
+/* {1, AnalogVideo_NTSC_M, _T("Anguilla")},
+ {1, AnalogVideo_NTSC_M, _T("Antigua")},
+ {1, AnalogVideo_NTSC_M, _T("Bahamas")},
+ {1, AnalogVideo_NTSC_M, _T("Barbados")},
+ {1, AnalogVideo_NTSC_M, _T("Bermuda")},
+ {1, AnalogVideo_NTSC_M, _T("British Virgin Islands")},
+ {1, AnalogVideo_NTSC_M, _T("Canada")},
+ {1, AnalogVideo_NTSC_M, _T("Cayman Islands")},
+ {1, AnalogVideo_NTSC_M, _T("Dominica")},
+ {1, AnalogVideo_NTSC_M, _T("Dominican Republic")},
+ {1, AnalogVideo_NTSC_M, _T("Grenada")},
+ {1, AnalogVideo_NTSC_M, _T("Jamaica")},
+ {1, AnalogVideo_NTSC_M, _T("Montserrat")},
+ {1, AnalogVideo_NTSC_M, _T("Nevis")},
+ {1, AnalogVideo_NTSC_M, _T("St. Kitts")},
+ {1, AnalogVideo_NTSC_M, _T("St. Vincent and the Grenadines")},
+ {1, AnalogVideo_NTSC_M, _T("Trinidad and Tobago")},
+ {1, AnalogVideo_NTSC_M, _T("Turks and Caicos Islands")},
+ {1, AnalogVideo_NTSC_M, _T("Barbuda")},
+ {1, AnalogVideo_NTSC_M, _T("Puerto Rico")},
+ {1, AnalogVideo_NTSC_M, _T("Saint Lucia")},
+ {1, AnalogVideo_NTSC_M, _T("United States Virgin Islands")},
+*/ {2, AnalogVideo_NTSC_M, _T("Canada")},
+ {7, AnalogVideo_SECAM_D, _T("Russia")},
+/* {7, AnalogVideo_SECAM_D, _T("Kazakhstan")},
+ {7, AnalogVideo_SECAM_D, _T("Kyrgyzstan")},
+ {7, AnalogVideo_SECAM_D, _T("Tajikistan")},
+ {7, AnalogVideo_SECAM_D, _T("Turkmenistan")},
+ {7, AnalogVideo_SECAM_D, _T("Uzbekistan")},
+*/ {20, AnalogVideo_SECAM_B, _T("Egypt")},
+ {27, AnalogVideo_PAL_I, _T("South Africa")},
+ {30, AnalogVideo_SECAM_B, _T("Greece")},
+ {31, AnalogVideo_PAL_B, _T("Netherlands")},
+ {32, AnalogVideo_PAL_B, _T("Belgium")},
+ {33, AnalogVideo_SECAM_L, _T("France")},
+ {34, AnalogVideo_PAL_B, _T("Spain")},
+ {36, AnalogVideo_SECAM_D, _T("Hungary")},
+ {39, AnalogVideo_PAL_B, _T("Italy")},
+ {39, AnalogVideo_PAL_B, _T("Vatican City")},
+ {40, AnalogVideo_PAL_D, _T("Romania")},
+ {41, AnalogVideo_PAL_B, _T("Switzerland")},
+ {41, AnalogVideo_PAL_B, _T("Liechtenstein")},
+ {43, AnalogVideo_PAL_B, _T("Austria")},
+ {44, AnalogVideo_PAL_I, _T("United Kingdom")},
+ {45, AnalogVideo_PAL_B, _T("Denmark")},
+ {46, AnalogVideo_PAL_B, _T("Sweden")},
+ {47, AnalogVideo_PAL_B, _T("Norway")},
+ {48, AnalogVideo_PAL_B, _T("Poland")},
+ {49, AnalogVideo_PAL_B, _T("Germany")},
+ {51, AnalogVideo_NTSC_M, _T("Peru")},
+ {52, AnalogVideo_NTSC_M, _T("Mexico")},
+ {53, AnalogVideo_NTSC_M, _T("Cuba")},
+ {53, AnalogVideo_NTSC_M, _T("Guantanamo Bay")},
+ {54, AnalogVideo_PAL_N, _T("Argentina")},
+ {55, AnalogVideo_PAL_M, _T("Brazil")},
+ {56, AnalogVideo_NTSC_M, _T("Chile")},
+ {57, AnalogVideo_NTSC_M, _T("Colombia")},
+ {58, AnalogVideo_NTSC_M, _T("Bolivarian Republic of Venezuela")},
+ {60, AnalogVideo_PAL_B, _T("Malaysia")},
+ {61, AnalogVideo_PAL_B, _T("Australia")},
+ // {61, AnalogVideo_NTSC_M, _T("Cocos-Keeling Islands")},
+ {62, AnalogVideo_PAL_B, _T("Indonesia")},
+ {63, AnalogVideo_NTSC_M, _T("Philippines")},
+ {64, AnalogVideo_PAL_B, _T("New Zealand")},
+ {65, AnalogVideo_PAL_B, _T("Singapore")},
+ {66, AnalogVideo_PAL_B, _T("Thailand")},
+ {81, AnalogVideo_NTSC_M_J, _T("Japan")},
+ {82, AnalogVideo_NTSC_M, _T("Korea (South)")},
+ {84, AnalogVideo_NTSC_M, _T("Vietnam")},
+ {86, AnalogVideo_PAL_D, _T("China")},
+ {90, AnalogVideo_PAL_B, _T("Turkey")},
+ {91, AnalogVideo_PAL_B, _T("India")},
+ {92, AnalogVideo_PAL_B, _T("Pakistan")},
+ {93, AnalogVideo_PAL_B, _T("Afghanistan")},
+ {94, AnalogVideo_PAL_B, _T("Sri Lanka")},
+ {95, AnalogVideo_NTSC_M, _T("Myanmar")},
+ {98, AnalogVideo_SECAM_B, _T("Iran")},
+ {212, AnalogVideo_SECAM_B, _T("Morocco")},
+ {213, AnalogVideo_PAL_B, _T("Algeria")},
+ {216, AnalogVideo_SECAM_B, _T("Tunisia")},
+ {218, AnalogVideo_SECAM_B, _T("Libya")},
+ {220, AnalogVideo_SECAM_K, _T("Gambia")},
+ {221, AnalogVideo_SECAM_K, _T("Senegal Republic")},
+ {222, AnalogVideo_SECAM_B, _T("Mauritania")},
+ {223, AnalogVideo_SECAM_K, _T("Mali")},
+ {224, AnalogVideo_SECAM_K, _T("Guinea")},
+ {225, AnalogVideo_SECAM_K, _T("Cote D'Ivoire")},
+ {226, AnalogVideo_SECAM_K, _T("Burkina Faso")},
+ {227, AnalogVideo_SECAM_K, _T("Niger")},
+ {228, AnalogVideo_SECAM_K, _T("Togo")},
+ {229, AnalogVideo_SECAM_K, _T("Benin")},
+ {230, AnalogVideo_SECAM_B, _T("Mauritius")},
+ {231, AnalogVideo_PAL_B, _T("Liberia")},
+ {232, AnalogVideo_PAL_B, _T("Sierra Leone")},
+ {233, AnalogVideo_PAL_B, _T("Ghana")},
+ {234, AnalogVideo_PAL_B, _T("Nigeria")},
+ {235, AnalogVideo_PAL_B, _T("Chad")},
+ {236, AnalogVideo_PAL_B, _T("Central African Republic")},
+ {237, AnalogVideo_PAL_B, _T("Cameroon")},
+ {238, AnalogVideo_NTSC_M, _T("Cape Verde Islands")},
+ {239, AnalogVideo_PAL_B, _T("Sao Tome and Principe")},
+ {240, AnalogVideo_SECAM_B, _T("Equatorial Guinea")},
+ {241, AnalogVideo_SECAM_K, _T("Gabon")},
+ {242, AnalogVideo_SECAM_D, _T("Congo")},
+ {243, AnalogVideo_SECAM_K, _T("Congo(DRC)")},
+ {244, AnalogVideo_PAL_I, _T("Angola")},
+ {245, AnalogVideo_NTSC_M, _T("Guinea-Bissau")},
+ {246, AnalogVideo_NTSC_M, _T("Diego Garcia")},
+ {247, AnalogVideo_NTSC_M, _T("Ascension Island")},
+ {248, AnalogVideo_PAL_B, _T("Seychelle Islands")},
+ {249, AnalogVideo_PAL_B, _T("Sudan")},
+ {250, AnalogVideo_PAL_B, _T("Rwanda")},
+ {251, AnalogVideo_PAL_B, _T("Ethiopia")},
+ {252, AnalogVideo_PAL_B, _T("Somalia")},
+ {253, AnalogVideo_SECAM_K, _T("Djibouti")},
+ {254, AnalogVideo_PAL_B, _T("Kenya")},
+ {255, AnalogVideo_PAL_B, _T("Tanzania")},
+ {256, AnalogVideo_PAL_B, _T("Uganda")},
+ {257, AnalogVideo_SECAM_K, _T("Burundi")},
+ {258, AnalogVideo_PAL_B, _T("Mozambique")},
+ {260, AnalogVideo_PAL_B, _T("Zambia")},
+ {261, AnalogVideo_SECAM_K, _T("Madagascar")},
+ {262, AnalogVideo_SECAM_K, _T("Reunion Island")},
+ {263, AnalogVideo_PAL_B, _T("Zimbabwe")},
+ {264, AnalogVideo_PAL_I, _T("Namibia")},
+ {265, AnalogVideo_NTSC_M, _T("Malawi")},
+ {266, AnalogVideo_PAL_I, _T("Lesotho")},
+ {267, AnalogVideo_SECAM_K, _T("Botswana")},
+ {268, AnalogVideo_PAL_B, _T("Swaziland")},
+ {269, AnalogVideo_SECAM_K, _T("Mayotte Island")},
+// {269, AnalogVideo_NTSC_M, _T("Comoros")},
+ {290, AnalogVideo_NTSC_M, _T("St. Helena")},
+ {291, AnalogVideo_NTSC_M, _T("Eritrea")},
+ {297, AnalogVideo_NTSC_M, _T("Aruba")},
+ {298, AnalogVideo_PAL_B, _T("Faroe Islands")},
+ {299, AnalogVideo_NTSC_M, _T("Greenland")},
+ {350, AnalogVideo_PAL_B, _T("Gibraltar")},
+ {351, AnalogVideo_PAL_B, _T("Portugal")},
+ {352, AnalogVideo_PAL_B, _T("Luxembourg")},
+ {353, AnalogVideo_PAL_I, _T("Ireland")},
+ {354, AnalogVideo_PAL_B, _T("Iceland")},
+ {355, AnalogVideo_PAL_B, _T("Albania")},
+ {356, AnalogVideo_PAL_B, _T("Malta")},
+ {357, AnalogVideo_PAL_B, _T("Cyprus")},
+ {358, AnalogVideo_PAL_B, _T("Finland")},
+ {359, AnalogVideo_SECAM_D, _T("Bulgaria")},
+ {370, AnalogVideo_PAL_B, _T("Lithuania")},
+ {371, AnalogVideo_SECAM_D, _T("Latvia")},
+ {372, AnalogVideo_PAL_B, _T("Estonia")},
+ {373, AnalogVideo_SECAM_D, _T("Moldova")},
+ {374, AnalogVideo_SECAM_D, _T("Armenia")},
+ {375, AnalogVideo_SECAM_D, _T("Belarus")},
+ {376, AnalogVideo_NTSC_M, _T("Andorra")},
+ {377, AnalogVideo_SECAM_G, _T("Monaco")},
+ {378, AnalogVideo_PAL_B, _T("San Marino")},
+ {380, AnalogVideo_SECAM_D, _T("Ukraine")},
+ {381, AnalogVideo_PAL_B, _T("Serbia and Montenegro")},
+ {385, AnalogVideo_PAL_B, _T("Croatia")},
+ {386, AnalogVideo_PAL_B, _T("Slovenia")},
+ {387, AnalogVideo_PAL_B, _T("Bosnia and Herzegovina")},
+ {389, AnalogVideo_PAL_B, _T("F.Y.R.O.M. (Former Yugoslav Republic of Macedonia)")},
+ {420, AnalogVideo_PAL_D, _T("Czech Republic")},
+ {421, AnalogVideo_PAL_B, _T("Slovak Republic")},
+ {500, AnalogVideo_PAL_I, _T("Falkland Islands (Islas Malvinas)")},
+ {501, AnalogVideo_NTSC_M, _T("Belize")},
+ {502, AnalogVideo_NTSC_M, _T("Guatemala")},
+ {503, AnalogVideo_NTSC_M, _T("El Salvador")},
+ {504, AnalogVideo_NTSC_M, _T("Honduras")},
+ {505, AnalogVideo_NTSC_M, _T("Nicaragua")},
+ {506, AnalogVideo_NTSC_M, _T("Costa Rica")},
+ {507, AnalogVideo_NTSC_M, _T("Panama")},
+ {508, AnalogVideo_SECAM_K, _T("St. Pierre and Miquelon")},
+ {509, AnalogVideo_NTSC_M, _T("Haiti")},
+ {590, AnalogVideo_SECAM_K, _T("Guadeloupe")},
+// {590, AnalogVideo_NTSC_M, _T("French Antilles")},
+ {591, AnalogVideo_PAL_N, _T("Bolivia")},
+ {592, AnalogVideo_SECAM_K, _T("Guyana")},
+ {593, AnalogVideo_NTSC_M, _T("Ecuador")},
+ {594, AnalogVideo_SECAM_K, _T("French Guiana")},
+ {595, AnalogVideo_PAL_N, _T("Paraguay")},
+ {596, AnalogVideo_SECAM_K, _T("Martinique")},
+ {597, AnalogVideo_NTSC_M, _T("Suriname")},
+ {598, AnalogVideo_PAL_N, _T("Uruguay")},
+ {599, AnalogVideo_NTSC_M, _T("Netherlands Antilles")},
+ {670, AnalogVideo_NTSC_M, _T("Saipan Island")},
+// {670, AnalogVideo_NTSC_M, _T("Rota Island")},
+// {670, AnalogVideo_NTSC_M, _T("Tinian Island")},
+ {671, AnalogVideo_NTSC_M, _T("Guam")},
+ {672, AnalogVideo_NTSC_M, _T("Christmas Island")},
+ {672, AnalogVideo_NTSC_M, _T("Australian Antarctic Territory")},
+ //{672, AnalogVideo_PAL_B, _T("Norfolk Island")},
+ {673, AnalogVideo_PAL_B, _T("Brunei")},
+ {674, AnalogVideo_NTSC_M, _T("Nauru")},
+ {675, AnalogVideo_PAL_B, _T("Papua New Guinea")},
+ {676, AnalogVideo_NTSC_M, _T("Tonga")},
+ {677, AnalogVideo_NTSC_M, _T("Solomon Islands")},
+ {678, AnalogVideo_NTSC_M, _T("Vanuatu")},
+ {679, AnalogVideo_NTSC_M, _T("Fiji Islands")},
+ {680, AnalogVideo_NTSC_M, _T("Palau")},
+ {681, AnalogVideo_SECAM_K, _T("Wallis and Futuna Islands")},
+ {682, AnalogVideo_PAL_B, _T("Cook Islands")},
+ {683, AnalogVideo_NTSC_M, _T("Niue")},
+ {684, AnalogVideo_NTSC_M, _T("Territory of American Samoa")},
+ {685, AnalogVideo_PAL_B, _T("Samoa")},
+ {686, AnalogVideo_PAL_B, _T("Kiribati Republic")},
+ {687, AnalogVideo_SECAM_K, _T("New Caledonia")},
+ {688, AnalogVideo_NTSC_M, _T("Tuvalu")},
+ {689, AnalogVideo_SECAM_K, _T("French Polynesia")},
+ {690, AnalogVideo_NTSC_M, _T("Tokelau")},
+ {691, AnalogVideo_NTSC_M, _T("Micronesia")},
+ {692, AnalogVideo_NTSC_M, _T("Marshall Islands")},
+ {850, AnalogVideo_SECAM_D, _T("Korea (North)")},
+ {852, AnalogVideo_PAL_I, _T("Hong Kong SAR")},
+ {853, AnalogVideo_PAL_I, _T("Macao SAR")},
+ {855, AnalogVideo_PAL_B, _T("Cambodia")},
+ {856, AnalogVideo_PAL_B, _T("Laos")},
+ {871, AnalogVideo_NTSC_M, _T("INMARSAT (Atlantic-East)")},
+ {872, AnalogVideo_NTSC_M, _T("INMARSAT (Pacific)")},
+ {873, AnalogVideo_NTSC_M, _T("INMARSAT (Indian)")},
+ {874, AnalogVideo_NTSC_M, _T("INMARSAT (Atlantic-West)")},
+ {880, AnalogVideo_PAL_B, _T("Bangladesh")},
+ {886, AnalogVideo_NTSC_M, _T("Taiwan")},
+ {960, AnalogVideo_PAL_B, _T("Maldives")},
+ {961, AnalogVideo_SECAM_B, _T("Lebanon")},
+ {962, AnalogVideo_PAL_B, _T("Jordan")},
+ {963, AnalogVideo_SECAM_B, _T("Syria")},
+ {964, AnalogVideo_SECAM_B, _T("Iraq")},
+ {965, AnalogVideo_PAL_B, _T("Kuwait")},
+ {966, AnalogVideo_SECAM_B, _T("Saudi Arabia")},
+ {967, AnalogVideo_PAL_B, _T("Yemen")},
+ {968, AnalogVideo_PAL_B, _T("Oman")},
+ {971, AnalogVideo_PAL_B, _T("United Arab Emirates")},
+ {972, AnalogVideo_PAL_B, _T("Israel")},
+ {973, AnalogVideo_PAL_B, _T("Bahrain")},
+ {974, AnalogVideo_PAL_B, _T("Qatar")},
+ {975, AnalogVideo_NTSC_M, _T("Bhutan")},
+ {976, AnalogVideo_SECAM_D, _T("Mongolia")},
+ {977, AnalogVideo_PAL_B, _T("Nepal")},
+ {994, AnalogVideo_SECAM_D, _T("Azerbaijan")},
+ {995, AnalogVideo_SECAM_D,_T("Georgia")},
+};
+
+// COpenCapDeviceDlg dialog
+
+//IMPLEMENT_DYNAMIC(COpenCapDeviceDlg, CResizableDialog)
+COpenCapDeviceDlg::COpenCapDeviceDlg(CWnd* pParent /*=NULL*/)
+ : CResizableDialog(COpenCapDeviceDlg::IDD, pParent)
+ , m_vidstr(_T(""))
+ , m_audstr(_T(""))
+ , m_country(1)
+{
+}
+
+COpenCapDeviceDlg::~COpenCapDeviceDlg()
+{
+}
+
+void COpenCapDeviceDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO1, m_vidctrl);
+ DDX_Control(pDX, IDC_COMBO2, m_audctrl);
+ DDX_Control(pDX, IDC_COMBO9, m_countryctrl);
+}
+
+BEGIN_MESSAGE_MAP(COpenCapDeviceDlg, CResizableDialog)
+ ON_BN_CLICKED(IDOK, OnBnClickedOk)
+END_MESSAGE_MAP()
+
+
+// COpenCapDeviceDlg message handlers
+
+BOOL COpenCapDeviceDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AddAnchor(m_vidctrl, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(m_audctrl, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(m_countryctrl, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDOK, TOP_CENTER);
+ AddAnchor(IDCANCEL, TOP_CENTER);
+
+ CRect r;
+ GetWindowRect(r);
+ CSize s = r.Size();
+ SetMinTrackSize(s);
+ s.cx = 1000;
+ SetMaxTrackSize(s);
+
+ CString dummy = _T("dummy");
+ CString vidstr = AfxGetApp()->GetProfileString(_T("Capture"), _T("VidDispName"), dummy);
+ CString audstr = AfxGetApp()->GetProfileString(_T("Capture"), _T("AudDispName"), dummy);
+ long country = AfxGetApp()->GetProfileInt(_T("Capture"), _T("Country"), 1);
+
+ int iSel = vidstr == dummy ? 0 : -1;
+
+ BeginEnumSysDev(CLSID_VideoInputDeviceCategory, pMoniker)
+ {
+ CComPtr<IPropertyBag> pPB;
+ pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
+
+ CComVariant var;
+ pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);
+ int i = m_vidctrl.AddString(CString(var.bstrVal));
+
+ LPOLESTR strName = NULL;
+ if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
+ {
+ m_vidnames.Add(CString(strName));
+ if(vidstr == CString(strName)) iSel = i;
+ CoTaskMemFree(strName);
+ }
+ }
+ EndEnumSysDev
+
+ if(m_vidctrl.GetCount())
+ m_vidctrl.SetCurSel(iSel);
+
+ iSel = audstr == dummy ? 0 : -1;
+
+ BeginEnumSysDev(CLSID_AudioInputDeviceCategory, pMoniker)
+ {
+ CComPtr<IPropertyBag> pPB;
+ pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
+
+ CComVariant var;
+ pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);
+ int i = m_audctrl.AddString(CString(var.bstrVal));
+
+ LPOLESTR strName = NULL;
+ if(SUCCEEDED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
+ {
+ m_audnames.Add(CString(strName));
+ if(audstr == CString(strName)) iSel = i;
+ CoTaskMemFree(strName);
+ }
+ }
+ EndEnumSysDev
+
+ {
+ int i = m_audctrl.AddString(_T("<Video Capture Device>"));
+ m_audnames.Add(_T(""));
+ if(audstr.IsEmpty()) iSel = i;
+ }
+
+ if(m_audctrl.GetCount())
+ m_audctrl.SetCurSel(iSel);
+
+ iSel = 0;
+
+ for(int j = 0; j < countof(s_countrycodes); j++)
+ {
+ CString standard;
+ switch(s_countrycodes[j].standard)
+ {
+ case AnalogVideo_NTSC_M: standard = _T("NTSC M"); break;
+ case AnalogVideo_NTSC_M_J: standard = _T("NTSC M J"); break;
+ case AnalogVideo_NTSC_433: standard = _T("NTSC 433"); break;
+ case AnalogVideo_PAL_B: standard = _T("PAL B"); break;
+ case AnalogVideo_PAL_D: standard = _T("PAL D"); break;
+ case AnalogVideo_PAL_G: standard = _T("PAL G"); break;
+ case AnalogVideo_PAL_H: standard = _T("PAL H"); break;
+ case AnalogVideo_PAL_I: standard = _T("PAL I"); break;
+ case AnalogVideo_PAL_M: standard = _T("PAL M"); break;
+ case AnalogVideo_PAL_N: standard = _T("PAL N"); break;
+ case AnalogVideo_PAL_60: standard = _T("PAL 60"); break;
+ case AnalogVideo_SECAM_B: standard = _T("SECAM B"); break;
+ case AnalogVideo_SECAM_D: standard = _T("SECAM D"); break;
+ case AnalogVideo_SECAM_G: standard = _T("SECAM G"); break;
+ case AnalogVideo_SECAM_H: standard = _T("SECAM H"); break;
+ case AnalogVideo_SECAM_K: standard = _T("SECAM K"); break;
+ case AnalogVideo_SECAM_K1: standard = _T("SECAM K1"); break;
+ case AnalogVideo_SECAM_L: standard = _T("SECAM L"); break;
+ case AnalogVideo_SECAM_L1: standard = _T("SECAM L1"); break;
+ case AnalogVideo_PAL_N_COMBO: standard = _T("PAL N COMBO"); break;
+ }
+
+ CString str;
+ str.Format(_T("%d - %s - %s"), s_countrycodes[j].code, s_countrycodes[j].str, standard);
+
+ int i = m_countryctrl.AddString(str);
+ m_countryctrl.SetItemDataPtr(i, &s_countrycodes[j]);
+ if(country == s_countrycodes[j].code) iSel = i;
+ }
+
+ if(m_countryctrl.GetCount())
+ m_countryctrl.SetCurSel(iSel);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void COpenCapDeviceDlg::OnBnClickedOk()
+{
+ UpdateData();
+
+ if(m_vidctrl.GetCurSel() >= 0)
+ {
+ m_vidstr = m_vidnames[m_vidctrl.GetCurSel()];
+ AfxGetApp()->WriteProfileString(_T("Capture"), _T("VidDispName"), m_vidstr);
+ }
+
+ if(m_audctrl.GetCurSel() >= 0)
+ {
+ m_audstr = m_audnames[m_audctrl.GetCurSel()];
+ AfxGetApp()->WriteProfileString(_T("Capture"), _T("AudDispName"), m_audstr);
+ }
+
+ if(m_countryctrl.GetCurSel() >= 0)
+ {
+ m_country = ((cc_t*)m_countryctrl.GetItemDataPtr(m_countryctrl.GetCurSel()))->code;
+ AfxGetApp()->WriteProfileInt(_T("Capture"), _T("Country"), m_country);
+ }
+
+ OnOK();
+}
diff --git a/src/apps/mplayerc/OpenCapDeviceDlg.h b/src/apps/mplayerc/OpenCapDeviceDlg.h
new file mode 100644
index 000000000..f192aec18
--- /dev/null
+++ b/src/apps/mplayerc/OpenCapDeviceDlg.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "afxwin.h"
+#include <atlcoll.h>
+
+// COpenCapDeviceDlg dialog
+
+class COpenCapDeviceDlg : public CResizableDialog
+{
+// DECLARE_DYNAMIC(COpenCapDeviceDlg)
+
+private:
+ CAtlArray<CString> m_vidnames, m_audnames;
+
+public:
+ COpenCapDeviceDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~COpenCapDeviceDlg();
+
+ CComboBox m_vidctrl;
+ CComboBox m_audctrl;
+ CComboBox m_countryctrl;
+
+ CString m_vidstr, m_audstr;
+ long m_country;
+
+// Dialog Data
+ enum { IDD = IDD_OPENCAPDEVICE_DLG };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedOk();
+};
diff --git a/src/apps/mplayerc/OpenDlg.cpp b/src/apps/mplayerc/OpenDlg.cpp
new file mode 100644
index 000000000..e5e41b2f5
--- /dev/null
+++ b/src/apps/mplayerc/OpenDlg.cpp
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// OpenDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "OpenDlg.h"
+#include "OpenFileDlg.h"
+
+// COpenDlg dialog
+
+//IMPLEMENT_DYNAMIC(COpenDlg, CResizableDialog)
+COpenDlg::COpenDlg(CWnd* pParent /*=NULL*/)
+ : CResizableDialog(COpenDlg::IDD, pParent)
+ , m_path(_T(""))
+ , m_path2(_T(""))
+ , m_fMultipleFiles(false)
+ , m_fAppendPlaylist(FALSE)
+{
+}
+
+COpenDlg::~COpenDlg()
+{
+}
+
+void COpenDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO1, m_mrucombo);
+ DDX_CBString(pDX, IDC_COMBO1, m_path);
+ DDX_Control(pDX, IDC_COMBO2, m_mrucombo2);
+ DDX_CBString(pDX, IDC_COMBO2, m_path2);
+ DDX_Control(pDX, IDC_STATIC1, m_label2);
+ DDX_Check(pDX, IDC_CHECK1, m_fAppendPlaylist);
+}
+
+
+BEGIN_MESSAGE_MAP(COpenDlg, CResizableDialog)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedBrowsebutton)
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedBrowsebutton2)
+ ON_BN_CLICKED(IDOK, OnBnClickedOk)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdateDub)
+ ON_UPDATE_COMMAND_UI(IDC_COMBO2, OnUpdateDub)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateDub)
+END_MESSAGE_MAP()
+
+
+// COpenDlg message handlers
+
+BOOL COpenDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ CRecentFileList& MRU = AfxGetAppSettings().MRU;
+ MRU.ReadList();
+ m_mrucombo.ResetContent();
+ for(int i = 0; i < MRU.GetSize(); i++)
+ if(!MRU[i].IsEmpty())
+ m_mrucombo.AddString(MRU[i]);
+ CorrectComboListWidth(m_mrucombo, GetFont());
+
+ CRecentFileList& MRUDub = AfxGetAppSettings().MRUDub;
+ MRUDub.ReadList();
+ m_mrucombo2.ResetContent();
+ for(int i = 0; i < MRUDub.GetSize(); i++)
+ if(!MRUDub[i].IsEmpty())
+ m_mrucombo2.AddString(MRUDub[i]);
+ CorrectComboListWidth(m_mrucombo2, GetFont());
+
+ if(m_mrucombo.GetCount() > 0) m_mrucombo.SetCurSel(0);
+
+ AddAnchor(m_mrucombo, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(m_mrucombo2, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDC_BUTTON1, TOP_RIGHT);
+ AddAnchor(IDC_BUTTON2, TOP_RIGHT);
+ AddAnchor(IDOK, TOP_RIGHT);
+ AddAnchor(IDCANCEL, TOP_RIGHT);
+ AddAnchor(IDC_STATIC1, TOP_LEFT, TOP_RIGHT);
+
+ CRect r;
+ GetWindowRect(r);
+ CSize s = r.Size();
+ SetMinTrackSize(s);
+ s.cx = 1000;
+ SetMaxTrackSize(s);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+static CString GetFileName(CString str)
+{
+ CPath p = str;
+ p.StripPath();
+ return (LPCTSTR)p;
+}
+
+void COpenDlg::OnBnClickedBrowsebutton()
+{
+ UpdateData();
+
+ CString filter;
+ CAtlArray<CString> mask;
+ AfxGetAppSettings().Formats.GetFilter(filter, mask);
+
+ COpenFileDlg fd(mask, true, NULL, m_path,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_ENABLEINCLUDENOTIFY,
+ filter, this);
+ if(fd.DoModal() != IDOK) return;
+
+ m_fns.RemoveAll();
+
+ POSITION pos = fd.GetStartPosition();
+ while(pos)
+ {
+/*
+ CString str = fd.GetNextPathName(pos);
+ POSITION insertpos = m_fns.GetTailPosition();
+ while(insertpos && GetFileName(str).CompareNoCase(GetFileName(m_fns.GetAt(insertpos))) <= 0)
+ m_fns.GetPrev(insertpos);
+ if(!insertpos) m_fns.AddHead(str);
+ else m_fns.InsertAfter(insertpos, str);
+*/
+ m_fns.AddTail(fd.GetNextPathName(pos));
+ }
+
+ if(m_fns.GetCount() > 1
+ || m_fns.GetCount() == 1
+ && (m_fns.GetHead()[m_fns.GetHead().GetLength()-1] == '\\'
+ || m_fns.GetHead()[m_fns.GetHead().GetLength()-1] == '*'))
+ {
+ m_fMultipleFiles = true;
+ EndDialog(IDOK);
+ return;
+ }
+
+ m_mrucombo.SetWindowText(fd.GetPathName());
+}
+
+void COpenDlg::OnBnClickedBrowsebutton2()
+{
+ UpdateData();
+
+ CString filter;
+ CAtlArray<CString> mask;
+ AfxGetAppSettings().Formats.GetAudioFilter(filter, mask);
+
+ COpenFileDlg fd(mask, false, NULL, m_path2,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ENABLEINCLUDENOTIFY,
+ filter, this);
+
+ if(fd.DoModal() != IDOK) return;
+
+ m_mrucombo2.SetWindowText(fd.GetPathName());
+}
+
+void COpenDlg::OnBnClickedOk()
+{
+ UpdateData();
+
+ m_fns.RemoveAll();
+ m_fns.AddTail(m_path);
+ if(m_mrucombo2.IsWindowEnabled())
+ m_fns.AddTail(m_path2);
+
+ m_fMultipleFiles = false;
+
+ OnOK();
+}
+
+void COpenDlg::OnUpdateDub(CCmdUI* pCmdUI)
+{
+ m_mrucombo.GetWindowText(m_path);
+ pCmdUI->Enable(AfxGetAppSettings().Formats.GetEngine(m_path) == DirectShow);
+}
diff --git a/src/apps/mplayerc/OpenDlg.h b/src/apps/mplayerc/OpenDlg.h
new file mode 100644
index 000000000..53ce30ee5
--- /dev/null
+++ b/src/apps/mplayerc/OpenDlg.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "resource.h"
+
+// COpenDlg dialog
+
+class COpenDlg : public CResizableDialog
+{
+// DECLARE_DYNAMIC(COpenDlg)
+
+public:
+ COpenDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~COpenDlg();
+
+ bool m_fMultipleFiles;
+ CAtlList<CString> m_fns;
+
+// Dialog Data
+ enum { IDD = IDD_OPEN_DLG };
+ CComboBox m_mrucombo;
+ CString m_path;
+ CComboBox m_mrucombo2;
+ CString m_path2;
+ CStatic m_label2;
+ BOOL m_fAppendPlaylist;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedBrowsebutton();
+ afx_msg void OnBnClickedBrowsebutton2();
+ afx_msg void OnBnClickedOk();
+ afx_msg void OnUpdateDub(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/OpenFileDlg.cpp b/src/apps/mplayerc/OpenFileDlg.cpp
new file mode 100644
index 000000000..11d0eb8df
--- /dev/null
+++ b/src/apps/mplayerc/OpenFileDlg.cpp
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// OpenFileDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <shlobj.h>
+#include <dlgs.h>
+#include "OpenFileDlg.h"
+
+#define __DUMMY__ _T("*.*")
+
+bool COpenFileDlg::m_fAllowDirSelection = false;
+WNDPROC COpenFileDlg::m_wndProc = NULL;
+
+// COpenFileDlg
+
+IMPLEMENT_DYNAMIC(COpenFileDlg, CFileDialog)
+COpenFileDlg::COpenFileDlg(CAtlArray<CString>& mask, bool fAllowDirSelection, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
+ DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd)
+ : CFileDialog(TRUE, lpszDefExt, lpszFileName, dwFlags|OFN_NOVALIDATE, lpszFilter, pParentWnd, 0)
+ , m_mask(mask)
+{
+ m_fAllowDirSelection = fAllowDirSelection;
+ m_pOFN->lpstrInitialDir = lpszFileName;
+
+ m_buff = new TCHAR[10000];
+ m_buff[0] = 0;
+ m_pOFN->lpstrFile = m_buff;
+ m_pOFN->nMaxFile = 10000;
+}
+
+COpenFileDlg::~COpenFileDlg()
+{
+ delete [] m_buff;
+}
+
+BEGIN_MESSAGE_MAP(COpenFileDlg, CFileDialog)
+ ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+
+// COpenFileDlg message handlers
+
+LRESULT CALLBACK COpenFileDlg::WindowProcNew(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if(message == WM_COMMAND && HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDOK
+ && m_fAllowDirSelection)
+ {
+ CAutoVectorPtr<TCHAR> path;
+ path.Allocate(MAX_PATH+1); // MAX_PATH should be bigger for multiple selection, but we are only interested if it's zero length
+ // note: allocating MAX_PATH only will cause a buffer overrun for too long strings, and will result in a silent app disappearing crash, 100% reproducable
+ if(::GetDlgItemText(hwnd, cmb13, (TCHAR*)path, MAX_PATH) == 0)
+ ::SendMessage(hwnd, CDM_SETCONTROLTEXT, edt1, (LPARAM)__DUMMY__);
+ }
+
+ return CallWindowProc(COpenFileDlg::m_wndProc, hwnd, message, wParam, lParam);
+}
+
+BOOL COpenFileDlg::OnInitDialog()
+{
+ CFileDialog::OnInitDialog();
+
+ m_wndProc = (WNDPROC)SetWindowLong(GetParent()->m_hWnd, GWL_WNDPROC, (LONG)WindowProcNew);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void COpenFileDlg::OnDestroy()
+{
+ int i = GetPathName().Find(__DUMMY__);
+ if(i >= 0) m_pOFN->lpstrFile[i] = m_pOFN->lpstrFile[i+1] = 0;
+
+ CFileDialog::OnDestroy();
+}
+
+BOOL COpenFileDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
+{
+ ASSERT(pResult != NULL);
+
+ OFNOTIFY* pNotify = (OFNOTIFY*)lParam;
+ // allow message map to override
+ if (__super::OnNotify(wParam, lParam, pResult))
+ {
+ ASSERT(pNotify->hdr.code != CDN_INCLUDEITEM);
+ return TRUE;
+ }
+
+ switch(pNotify->hdr.code)
+ {
+ case CDN_INCLUDEITEM:
+ if(OnIncludeItem((OFNOTIFYEX*)lParam, pResult))
+ return TRUE;
+ break;
+ }
+
+ return FALSE; // not handled
+}
+
+BOOL COpenFileDlg::OnIncludeItem(OFNOTIFYEX* pOFNEx, LRESULT* pResult)
+{
+ TCHAR buff[MAX_PATH];
+ if(!SHGetPathFromIDList((LPCITEMIDLIST)pOFNEx->pidl, buff))
+ {
+ STRRET s;
+ HRESULT hr = ((IShellFolder*)pOFNEx->psf)->GetDisplayNameOf((LPCITEMIDLIST)pOFNEx->pidl, SHGDN_NORMAL|SHGDN_FORPARSING, &s);
+ if(S_OK != hr) return FALSE;
+ switch(s.uType)
+ {
+ case STRRET_CSTR: _tcscpy(buff, CString(s.cStr)); break;
+ case STRRET_WSTR: _tcscpy(buff, CString(s.pOleStr)); CoTaskMemFree(s.pOleStr); break;
+ default: return FALSE;
+ }
+ }
+
+ CString fn(buff);
+/*
+ WIN32_FILE_ATTRIBUTE_DATA fad;
+ if(GetFileAttributesEx(fn, GetFileExInfoStandard, &fad)
+ && (fad.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
+ return FALSE;
+*/
+ int i = fn.ReverseFind('.'), j = fn.ReverseFind('\\');
+ if(i < 0 || i < j)
+ return FALSE;
+
+ CString mask = m_mask[pOFNEx->lpOFN->nFilterIndex-1] + _T(";");
+ CString ext = fn.Mid(i).MakeLower() + _T(";");
+
+ *pResult = mask.Find(ext) >= 0 || mask.Find(_T("*.*")) >= 0;
+
+ return TRUE;
+}
diff --git a/src/apps/mplayerc/OpenFileDlg.h b/src/apps/mplayerc/OpenFileDlg.h
new file mode 100644
index 000000000..ba89b6295
--- /dev/null
+++ b/src/apps/mplayerc/OpenFileDlg.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxwin.h"
+
+// COpenFileDlg
+
+class COpenFileDlg : public CFileDialog
+{
+ DECLARE_DYNAMIC(COpenFileDlg)
+
+private:
+ TCHAR* m_buff;
+ CAtlArray<CString>& m_mask;
+
+public:
+ COpenFileDlg(CAtlArray<CString>& mask, bool fAllowDirSelection,
+ LPCTSTR lpszDefExt = NULL,
+ LPCTSTR lpszFileName = NULL,
+ DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
+ LPCTSTR lpszFilter = NULL,
+ CWnd* pParentWnd = NULL);
+ virtual ~COpenFileDlg();
+
+ static bool m_fAllowDirSelection;
+ static WNDPROC m_wndProc;
+ static LRESULT CALLBACK WindowProcNew(HWND hwnd,UINT message, WPARAM wParam, LPARAM lParam);
+
+ virtual BOOL OnInitDialog();
+
+protected:
+ DECLARE_MESSAGE_MAP()
+ virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
+ virtual BOOL OnIncludeItem(OFNOTIFYEX* pOFNEx, LRESULT* pResult);
+
+public:
+ afx_msg void OnDestroy();
+};
+
+
diff --git a/src/apps/mplayerc/PPageAccelTbl.cpp b/src/apps/mplayerc/PPageAccelTbl.cpp
new file mode 100644
index 000000000..cb3600e4c
--- /dev/null
+++ b/src/apps/mplayerc/PPageAccelTbl.cpp
@@ -0,0 +1,962 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageAccelTbl.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageAccelTbl.h"
+
+// CPPageAccelTbl dialog
+
+IMPLEMENT_DYNAMIC(CPPageAccelTbl, CPPageBase)
+CPPageAccelTbl::CPPageAccelTbl()
+ : CPPageBase(CPPageAccelTbl::IDD, CPPageAccelTbl::IDD)
+ , m_list(0)
+ , m_counter(0)
+ , m_fWinLirc(FALSE)
+ , m_WinLircLink(_T("http://winlirc.sourceforge.net/"))
+ , m_fUIce(FALSE)
+ , m_UIceLink(_T("http://www.mediatexx.com/"))
+{
+}
+
+CPPageAccelTbl::~CPPageAccelTbl()
+{
+}
+
+BOOL CPPageAccelTbl::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
+ && (pMsg->hwnd == m_WinLircEdit.m_hWnd || pMsg->hwnd == m_UIceEdit.m_hWnd))
+ {
+ OnApply();
+ return TRUE;
+ }
+
+ return __super::PreTranslateMessage(pMsg);
+}
+
+
+void CPPageAccelTbl::SetupList()
+{
+ for(int row = 0; row < m_list.GetItemCount(); row++)
+ {
+ wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(row));
+
+ CString mod = MakeAccelModLabel(wc.fVirt);
+ m_list.SetItemText(row, COL_MOD, mod);
+
+ CString key = MakeAccelVkeyLabel(wc.key, wc.fVirt&FVIRTKEY);
+ m_list.SetItemText(row, COL_KEY, key);
+
+ CString type = (wc.fVirt&FVIRTKEY)?_T("VIRTKEY"):_T("ASCII");
+ m_list.SetItemText(row, COL_TYPE, type);
+
+ CString id;
+ id.Format(_T("%d"), wc.cmd);
+ m_list.SetItemText(row, COL_ID, id);
+
+ m_list.SetItemText(row, COL_MOUSE, MakeMouseButtonLabel(wc.mouse));
+
+ m_list.SetItemText(row, COL_APPCMD, MakeAppCommandLabel(wc.appcmd));
+
+ m_list.SetItemText(row, COL_RMCMD, CString(wc.rmcmd));
+
+ CString repcnt;
+ repcnt.Format(_T("%d"), wc.rmrepcnt);
+ m_list.SetItemText(row, COL_RMREPCNT, repcnt);
+ }
+}
+
+CString CPPageAccelTbl::MakeAccelModLabel(BYTE fVirt)
+{
+ CString str;
+ if(fVirt&FCONTROL) {if(!str.IsEmpty()) str += _T(" + "); str += _T("Ctrl");}
+ if(fVirt&FALT) {if(!str.IsEmpty()) str += _T(" + "); str += _T("Alt");}
+ if(fVirt&FSHIFT) {if(!str.IsEmpty()) str += _T(" + "); str += _T("Shift");}
+ if(str.IsEmpty()) str = _T("None");
+ return(str);
+}
+
+CString CPPageAccelTbl::MakeAccelVkeyLabel(WORD key, bool fVirtKey)
+{
+ CString str;
+
+ if(fVirtKey)
+ switch(key)
+ {
+ case VK_LBUTTON: str = _T("VK_LBUTTON"); break;
+ case VK_RBUTTON: str = _T("VK_RBUTTON"); break;
+ case VK_CANCEL: str = _T("VK_CANCEL"); break;
+ case VK_MBUTTON: str = _T("VK_MBUTTON"); break;
+ case VK_XBUTTON1: str = _T("VK_XBUTTON1"); break;
+ case VK_XBUTTON2: str = _T("VK_XBUTTON2"); break;
+ case VK_BACK: str = _T("VK_BACK"); break;
+ case VK_TAB: str = _T("VK_TAB"); break;
+ case VK_CLEAR: str = _T("VK_CLEAR"); break;
+ case VK_RETURN: str = _T("VK_RETURN"); break;
+ case VK_SHIFT: str = _T("VK_SHIFT"); break;
+ case VK_CONTROL: str = _T("VK_CONTROL"); break;
+ case VK_MENU: str = _T("VK_MENU"); break;
+ case VK_PAUSE: str = _T("VK_PAUSE"); break;
+ case VK_CAPITAL: str = _T("VK_CAPITAL"); break;
+// case VK_KANA: str = _T("VK_KANA"); break;
+// case VK_HANGEUL: str = _T("VK_HANGEUL"); break;
+ case VK_HANGUL: str = _T("VK_HANGUL"); break;
+ case VK_JUNJA: str = _T("VK_JUNJA"); break;
+ case VK_FINAL: str = _T("VK_FINAL"); break;
+// case VK_HANJA: str = _T("VK_HANJA"); break;
+ case VK_KANJI: str = _T("VK_KANJI"); break;
+ case VK_ESCAPE: str = _T("VK_ESCAPE"); break;
+ case VK_CONVERT: str = _T("VK_CONVERT"); break;
+ case VK_NONCONVERT: str = _T("VK_NONCONVERT"); break;
+ case VK_ACCEPT: str = _T("VK_ACCEPT"); break;
+ case VK_MODECHANGE: str = _T("VK_MODECHANGE"); break;
+ case VK_SPACE: str = _T("VK_SPACE"); break;
+ case VK_PRIOR: str = _T("VK_PRIOR"); break;
+ case VK_NEXT: str = _T("VK_NEXT"); break;
+ case VK_END: str = _T("VK_END"); break;
+ case VK_HOME: str = _T("VK_HOME"); break;
+ case VK_LEFT: str = _T("VK_LEFT"); break;
+ case VK_UP: str = _T("VK_UP"); break;
+ case VK_RIGHT: str = _T("VK_RIGHT"); break;
+ case VK_DOWN: str = _T("VK_DOWN"); break;
+ case VK_SELECT: str = _T("VK_SELECT"); break;
+ case VK_PRINT: str = _T("VK_PRINT"); break;
+ case VK_EXECUTE: str = _T("VK_EXECUTE"); break;
+ case VK_SNAPSHOT: str = _T("VK_SNAPSHOT"); break;
+ case VK_INSERT: str = _T("VK_INSERT"); break;
+ case VK_DELETE: str = _T("VK_DELETE"); break;
+ case VK_HELP: str = _T("VK_HELP"); break;
+ case VK_LWIN: str = _T("VK_LWIN"); break;
+ case VK_RWIN: str = _T("VK_RWIN"); break;
+ case VK_APPS: str = _T("VK_APPS"); break;
+ case VK_SLEEP: str = _T("VK_SLEEP"); break;
+ case VK_NUMPAD0: str = _T("VK_NUMPAD0"); break;
+ case VK_NUMPAD1: str = _T("VK_NUMPAD1"); break;
+ case VK_NUMPAD2: str = _T("VK_NUMPAD2"); break;
+ case VK_NUMPAD3: str = _T("VK_NUMPAD3"); break;
+ case VK_NUMPAD4: str = _T("VK_NUMPAD4"); break;
+ case VK_NUMPAD5: str = _T("VK_NUMPAD5"); break;
+ case VK_NUMPAD6: str = _T("VK_NUMPAD6"); break;
+ case VK_NUMPAD7: str = _T("VK_NUMPAD7"); break;
+ case VK_NUMPAD8: str = _T("VK_NUMPAD8"); break;
+ case VK_NUMPAD9: str = _T("VK_NUMPAD9"); break;
+ case VK_MULTIPLY: str = _T("VK_MULTIPLY"); break;
+ case VK_ADD: str = _T("VK_ADD"); break;
+ case VK_SEPARATOR: str = _T("VK_SEPARATOR"); break;
+ case VK_SUBTRACT: str = _T("VK_SUBTRACT"); break;
+ case VK_DECIMAL: str = _T("VK_DECIMAL"); break;
+ case VK_DIVIDE: str = _T("VK_DIVIDE"); break;
+ case VK_F1: str = _T("VK_F1"); break;
+ case VK_F2: str = _T("VK_F2"); break;
+ case VK_F3: str = _T("VK_F3"); break;
+ case VK_F4: str = _T("VK_F4"); break;
+ case VK_F5: str = _T("VK_F5"); break;
+ case VK_F6: str = _T("VK_F6"); break;
+ case VK_F7: str = _T("VK_F7"); break;
+ case VK_F8: str = _T("VK_F8"); break;
+ case VK_F9: str = _T("VK_F9"); break;
+ case VK_F10: str = _T("VK_F10"); break;
+ case VK_F11: str = _T("VK_F11"); break;
+ case VK_F12: str = _T("VK_F12"); break;
+ case VK_F13: str = _T("VK_F13"); break;
+ case VK_F14: str = _T("VK_F14"); break;
+ case VK_F15: str = _T("VK_F15"); break;
+ case VK_F16: str = _T("VK_F16"); break;
+ case VK_F17: str = _T("VK_F17"); break;
+ case VK_F18: str = _T("VK_F18"); break;
+ case VK_F19: str = _T("VK_F19"); break;
+ case VK_F20: str = _T("VK_F20"); break;
+ case VK_F21: str = _T("VK_F21"); break;
+ case VK_F22: str = _T("VK_F22"); break;
+ case VK_F23: str = _T("VK_F23"); break;
+ case VK_F24: str = _T("VK_F24"); break;
+ case VK_NUMLOCK: str = _T("VK_NUMLOCK"); break;
+ case VK_SCROLL: str = _T("VK_SCROLL"); break;
+// case VK_OEM_NEC_EQUAL: str = _T("VK_OEM_NEC_EQUAL"); break;
+ case VK_OEM_FJ_JISHO: str = _T("VK_OEM_FJ_JISHO"); break;
+ case VK_OEM_FJ_MASSHOU: str = _T("VK_OEM_FJ_MASSHOU"); break;
+ case VK_OEM_FJ_TOUROKU: str = _T("VK_OEM_FJ_TOUROKU"); break;
+ case VK_OEM_FJ_LOYA: str = _T("VK_OEM_FJ_LOYA"); break;
+ case VK_OEM_FJ_ROYA: str = _T("VK_OEM_FJ_ROYA"); break;
+ case VK_LSHIFT: str = _T("VK_LSHIFT"); break;
+ case VK_RSHIFT: str = _T("VK_RSHIFT"); break;
+ case VK_LCONTROL: str = _T("VK_LCONTROL"); break;
+ case VK_RCONTROL: str = _T("VK_RCONTROL"); break;
+ case VK_LMENU: str = _T("VK_LMENU"); break;
+ case VK_RMENU: str = _T("VK_RMENU"); break;
+ case VK_BROWSER_BACK: str = _T("VK_BROWSER_BACK"); break;
+ case VK_BROWSER_FORWARD: str = _T("VK_BROWSER_FORWARD"); break;
+ case VK_BROWSER_REFRESH: str = _T("VK_BROWSER_REFRESH"); break;
+ case VK_BROWSER_STOP: str = _T("VK_BROWSER_STOP"); break;
+ case VK_BROWSER_SEARCH: str = _T("VK_BROWSER_SEARCH"); break;
+ case VK_BROWSER_FAVORITES: str = _T("VK_BROWSER_FAVORITES"); break;
+ case VK_BROWSER_HOME: str = _T("VK_BROWSER_HOME"); break;
+ case VK_VOLUME_MUTE: str = _T("VK_VOLUME_MUTE"); break;
+ case VK_VOLUME_DOWN: str = _T("VK_VOLUME_DOWN"); break;
+ case VK_VOLUME_UP: str = _T("VK_VOLUME_UP"); break;
+ case VK_MEDIA_NEXT_TRACK: str = _T("VK_MEDIA_NEXT_TRACK"); break;
+ case VK_MEDIA_PREV_TRACK: str = _T("VK_MEDIA_PREV_TRACK"); break;
+ case VK_MEDIA_STOP: str = _T("VK_MEDIA_STOP"); break;
+ case VK_MEDIA_PLAY_PAUSE: str = _T("VK_MEDIA_PLAY_PAUSE"); break;
+ case VK_LAUNCH_MAIL: str = _T("VK_LAUNCH_MAIL"); break;
+ case VK_LAUNCH_MEDIA_SELECT: str = _T("VK_LAUNCH_MEDIA_SELECT"); break;
+ case VK_LAUNCH_APP1: str = _T("VK_LAUNCH_APP1"); break;
+ case VK_LAUNCH_APP2: str = _T("VK_LAUNCH_APP2"); break;
+ case VK_OEM_1: str = _T("VK_OEM_1"); break;
+ case VK_OEM_PLUS: str = _T("VK_OEM_PLUS"); break;
+ case VK_OEM_COMMA: str = _T("VK_OEM_COMMA"); break;
+ case VK_OEM_MINUS: str = _T("VK_OEM_MINUS"); break;
+ case VK_OEM_PERIOD: str = _T("VK_OEM_PERIOD"); break;
+ case VK_OEM_2: str = _T("VK_OEM_2"); break;
+ case VK_OEM_3: str = _T("VK_OEM_3"); break;
+ case VK_OEM_4: str = _T("VK_OEM_4"); break;
+ case VK_OEM_5: str = _T("VK_OEM_5"); break;
+ case VK_OEM_6: str = _T("VK_OEM_6"); break;
+ case VK_OEM_7: str = _T("VK_OEM_7"); break;
+ case VK_OEM_8: str = _T("VK_OEM_8"); break;
+ case VK_OEM_AX: str = _T("VK_OEM_AX"); break;
+ case VK_OEM_102: str = _T("VK_OEM_102"); break;
+ case VK_ICO_HELP: str = _T("VK_ICO_HELP"); break;
+ case VK_ICO_00: str = _T("VK_ICO_00"); break;
+ case VK_PROCESSKEY: str = _T("VK_PROCESSKEY"); break;
+ case VK_ICO_CLEAR: str = _T("VK_ICO_CLEAR"); break;
+ case VK_PACKET: str = _T("VK_PACKET"); break;
+ case VK_OEM_RESET: str = _T("VK_OEM_RESET"); break;
+ case VK_OEM_JUMP: str = _T("VK_OEM_JUMP"); break;
+ case VK_OEM_PA1: str = _T("VK_OEM_PA1"); break;
+ case VK_OEM_PA2: str = _T("VK_OEM_PA2"); break;
+ case VK_OEM_PA3: str = _T("VK_OEM_PA3"); break;
+ case VK_OEM_WSCTRL: str = _T("VK_OEM_WSCTRL"); break;
+ case VK_OEM_CUSEL: str = _T("VK_OEM_CUSEL"); break;
+ case VK_OEM_ATTN: str = _T("VK_OEM_ATTN"); break;
+ case VK_OEM_FINISH: str = _T("VK_OEM_FINISH"); break;
+ case VK_OEM_COPY: str = _T("VK_OEM_COPY"); break;
+ case VK_OEM_AUTO: str = _T("VK_OEM_AUTO"); break;
+ case VK_OEM_ENLW: str = _T("VK_OEM_ENLW"); break;
+ case VK_OEM_BACKTAB: str = _T("VK_OEM_BACKTAB"); break;
+ case VK_ATTN: str = _T("VK_ATTN"); break;
+ case VK_CRSEL: str = _T("VK_CRSEL"); break;
+ case VK_EXSEL: str = _T("VK_EXSEL"); break;
+ case VK_EREOF: str = _T("VK_EREOF"); break;
+ case VK_PLAY: str = _T("VK_PLAY"); break;
+ case VK_ZOOM: str = _T("VK_ZOOM"); break;
+ case VK_NONAME: str = _T("VK_NONAME"); break;
+ case VK_PA1: str = _T("VK_PA1"); break;
+ case VK_OEM_CLEAR: str = _T("VK_OEM_CLEAR"); break;
+ default:
+ if('0' <= key && key <= '9' || 'A' <= key && key <= 'Z')
+ str.Format(_T("%c"), (TCHAR)key);
+ break;
+ }
+
+ if(str.IsEmpty() || !fVirtKey)
+ {
+ str.Format(_T("%c, 0x%02x"), (TCHAR)key, key);
+ return(str);
+ }
+
+ return(str);
+}
+
+CString CPPageAccelTbl::MakeAccelShortcutLabel(UINT id)
+{
+ CList<wmcmd>& wmcmds = AfxGetAppSettings().wmcmds;
+ POSITION pos = wmcmds.GetHeadPosition();
+ while(pos)
+ {
+ ACCEL& a = wmcmds.GetNext(pos);
+ if(a.cmd == id)
+ return(MakeAccelShortcutLabel(a));
+ }
+
+ return(_T(""));
+}
+
+CString CPPageAccelTbl::MakeAccelShortcutLabel(ACCEL& a)
+{
+ CString str;
+
+ if(a.fVirt&1)
+ switch(a.key)
+ {
+ case VK_LBUTTON: str = _T("LBtn"); break;
+ case VK_RBUTTON: str = _T("RBtn"); break;
+ case VK_CANCEL: str = _T("Cancel"); break;
+ case VK_MBUTTON: str = _T("MBtn"); break;
+ case VK_XBUTTON1: str = _T("X1Btn"); break;
+ case VK_XBUTTON2: str = _T("X2Btn"); break;
+ case VK_BACK: str = _T("Back"); break;
+ case VK_TAB: str = _T("Tab"); break;
+ case VK_CLEAR: str = _T("Clear"); break;
+ case VK_RETURN: str = _T("Return"); break;
+ case VK_SHIFT: str = _T("Shift"); break;
+ case VK_CONTROL: str = _T("Ctrl"); break;
+ case VK_MENU: str = _T("Alt"); break;
+ case VK_PAUSE: str = _T("Pause"); break;
+ case VK_CAPITAL: str = _T("Capital"); break;
+// case VK_KANA: str = _T("Kana"); break;
+// case VK_HANGEUL: str = _T("Hangeul"); break;
+ case VK_HANGUL: str = _T("Hangul"); break;
+ case VK_JUNJA: str = _T("Junja"); break;
+ case VK_FINAL: str = _T("Final"); break;
+// case VK_HANJA: str = _T("Hanja"); break;
+ case VK_KANJI: str = _T("Kanji"); break;
+ case VK_ESCAPE: str = _T("Escape"); break;
+ case VK_CONVERT: str = _T("Convert"); break;
+ case VK_NONCONVERT: str = _T("Non Convert"); break;
+ case VK_ACCEPT: str = _T("Accept"); break;
+ case VK_MODECHANGE: str = _T("Mode Change"); break;
+ case VK_SPACE: str = _T("Space"); break;
+ case VK_PRIOR: str = _T("PgUp"); break;
+ case VK_NEXT: str = _T("PgDn"); break;
+ case VK_END: str = _T("End"); break;
+ case VK_HOME: str = _T("Home"); break;
+ case VK_LEFT: str = _T("Left"); break;
+ case VK_UP: str = _T("Up"); break;
+ case VK_RIGHT: str = _T("Right"); break;
+ case VK_DOWN: str = _T("Down"); break;
+ case VK_SELECT: str = _T("Select"); break;
+ case VK_PRINT: str = _T("Print"); break;
+ case VK_EXECUTE: str = _T("Execute"); break;
+ case VK_SNAPSHOT: str = _T("Snapshot"); break;
+ case VK_INSERT: str = _T("Insert"); break;
+ case VK_DELETE: str = _T("Delete"); break;
+ case VK_HELP: str = _T("Help"); break;
+ case VK_LWIN: str = _T("LWin"); break;
+ case VK_RWIN: str = _T("RWin"); break;
+ case VK_APPS: str = _T("Apps"); break;
+ case VK_SLEEP: str = _T("Sleep"); break;
+ case VK_NUMPAD0: str = _T("Numpad 0"); break;
+ case VK_NUMPAD1: str = _T("Numpad 1"); break;
+ case VK_NUMPAD2: str = _T("Numpad 2"); break;
+ case VK_NUMPAD3: str = _T("Numpad 3"); break;
+ case VK_NUMPAD4: str = _T("Numpad 4"); break;
+ case VK_NUMPAD5: str = _T("Numpad 5"); break;
+ case VK_NUMPAD6: str = _T("Numpad 6"); break;
+ case VK_NUMPAD7: str = _T("Numpad 7"); break;
+ case VK_NUMPAD8: str = _T("Numpad 8"); break;
+ case VK_NUMPAD9: str = _T("Numpad 9"); break;
+ case VK_MULTIPLY: str = _T("Multiply"); break;
+ case VK_ADD: str = _T("Add"); break;
+ case VK_SEPARATOR: str = _T("Separator"); break;
+ case VK_SUBTRACT: str = _T("Subtract"); break;
+ case VK_DECIMAL: str = _T("Decimal"); break;
+ case VK_DIVIDE: str = _T("Divide"); break;
+ case VK_F1: str = _T("F1"); break;
+ case VK_F2: str = _T("F2"); break;
+ case VK_F3: str = _T("F3"); break;
+ case VK_F4: str = _T("F4"); break;
+ case VK_F5: str = _T("F5"); break;
+ case VK_F6: str = _T("F6"); break;
+ case VK_F7: str = _T("F7"); break;
+ case VK_F8: str = _T("F8"); break;
+ case VK_F9: str = _T("F9"); break;
+ case VK_F10: str = _T("F10"); break;
+ case VK_F11: str = _T("F11"); break;
+ case VK_F12: str = _T("F12"); break;
+ case VK_F13: str = _T("F13"); break;
+ case VK_F14: str = _T("F14"); break;
+ case VK_F15: str = _T("F15"); break;
+ case VK_F16: str = _T("F16"); break;
+ case VK_F17: str = _T("F17"); break;
+ case VK_F18: str = _T("F18"); break;
+ case VK_F19: str = _T("F19"); break;
+ case VK_F20: str = _T("F20"); break;
+ case VK_F21: str = _T("F21"); break;
+ case VK_F22: str = _T("F22"); break;
+ case VK_F23: str = _T("F23"); break;
+ case VK_F24: str = _T("F24"); break;
+ case VK_NUMLOCK: str = _T("Numlock"); break;
+ case VK_SCROLL: str = _T("Scroll"); break;
+// case VK_OEM_NEC_EQUAL: str = _T("OEM NEC Equal"); break;
+ case VK_OEM_FJ_JISHO: str = _T("OEM FJ Jisho"); break;
+ case VK_OEM_FJ_MASSHOU: str = _T("OEM FJ Msshou"); break;
+ case VK_OEM_FJ_TOUROKU: str = _T("OEM FJ Touroku"); break;
+ case VK_OEM_FJ_LOYA: str = _T("OEM FJ Loya"); break;
+ case VK_OEM_FJ_ROYA: str = _T("OEM FJ Roya"); break;
+ case VK_LSHIFT: str = _T("LShift"); break;
+ case VK_RSHIFT: str = _T("RShift"); break;
+ case VK_LCONTROL: str = _T("LCtrl"); break;
+ case VK_RCONTROL: str = _T("RCtrl"); break;
+ case VK_LMENU: str = _T("LAlt"); break;
+ case VK_RMENU: str = _T("RAlt"); break;
+ case VK_BROWSER_BACK: str = _T("Browser Back"); break;
+ case VK_BROWSER_FORWARD: str = _T("Browser Forward"); break;
+ case VK_BROWSER_REFRESH: str = _T("Browser Refresh"); break;
+ case VK_BROWSER_STOP: str = _T("Browser Stop"); break;
+ case VK_BROWSER_SEARCH: str = _T("Browser Search"); break;
+ case VK_BROWSER_FAVORITES: str = _T("Browser Favorites"); break;
+ case VK_BROWSER_HOME: str = _T("Browser Home"); break;
+ case VK_VOLUME_MUTE: str = _T("Volume Mute"); break;
+ case VK_VOLUME_DOWN: str = _T("Volume Down"); break;
+ case VK_VOLUME_UP: str = _T("Volume Up"); break;
+ case VK_MEDIA_NEXT_TRACK: str = _T("Media Next Track"); break;
+ case VK_MEDIA_PREV_TRACK: str = _T("Media Prev Track"); break;
+ case VK_MEDIA_STOP: str = _T("Media Stop"); break;
+ case VK_MEDIA_PLAY_PAUSE: str = _T("Media Play/Pause"); break;
+ case VK_LAUNCH_MAIL: str = _T("Launch Mail"); break;
+ case VK_LAUNCH_MEDIA_SELECT: str = _T("Launch Media Select"); break;
+ case VK_LAUNCH_APP1: str = _T("Launch App1"); break;
+ case VK_LAUNCH_APP2: str = _T("Launch App2"); break;
+ case VK_OEM_1: str = _T("OEM 1"); break;
+ case VK_OEM_PLUS: str = _T("Plus"); break;
+ case VK_OEM_COMMA: str = _T("Comma"); break;
+ case VK_OEM_MINUS: str = _T("Minus"); break;
+ case VK_OEM_PERIOD: str = _T("Period"); break;
+ case VK_OEM_2: str = _T("OEM 2"); break;
+ case VK_OEM_3: str = _T("OEM 3"); break;
+ case VK_OEM_4: str = _T("OEM 4"); break;
+ case VK_OEM_5: str = _T("OEM 5"); break;
+ case VK_OEM_6: str = _T("OEM 6"); break;
+ case VK_OEM_7: str = _T("OEM 7"); break;
+ case VK_OEM_8: str = _T("OEM 8"); break;
+ case VK_OEM_AX: str = _T("OEM AX"); break;
+ case VK_OEM_102: str = _T("OEM 102"); break;
+ case VK_ICO_HELP: str = _T("ICO Help"); break;
+ case VK_ICO_00: str = _T("ICO 00"); break;
+ case VK_PROCESSKEY: str = _T("Process Key"); break;
+ case VK_ICO_CLEAR: str = _T("ICO Clear"); break;
+ case VK_PACKET: str = _T("Packet"); break;
+ case VK_OEM_RESET: str = _T("OEM Reset"); break;
+ case VK_OEM_JUMP: str = _T("OEM Jump"); break;
+ case VK_OEM_PA1: str = _T("OEM PA1"); break;
+ case VK_OEM_PA2: str = _T("OEM PA2"); break;
+ case VK_OEM_PA3: str = _T("OEM PA3"); break;
+ case VK_OEM_WSCTRL: str = _T("OEM WSCtrl"); break;
+ case VK_OEM_CUSEL: str = _T("OEM CUSEL"); break;
+ case VK_OEM_ATTN: str = _T("OEM ATTN"); break;
+ case VK_OEM_FINISH: str = _T("OEM Finish"); break;
+ case VK_OEM_COPY: str = _T("OEM Copy"); break;
+ case VK_OEM_AUTO: str = _T("OEM Auto"); break;
+ case VK_OEM_ENLW: str = _T("OEM ENLW"); break;
+ case VK_OEM_BACKTAB: str = _T("OEM Backtab"); break;
+ case VK_ATTN: str = _T("ATTN"); break;
+ case VK_CRSEL: str = _T("CRSEL"); break;
+ case VK_EXSEL: str = _T("EXSEL"); break;
+ case VK_EREOF: str = _T("EREOF"); break;
+ case VK_PLAY: str = _T("Play"); break;
+ case VK_ZOOM: str = _T("Zoom"); break;
+ case VK_NONAME: str = _T("Noname"); break;
+ case VK_PA1: str = _T("PA1"); break;
+ case VK_OEM_CLEAR: str = _T("OEM Clear"); break;
+ default:
+ if('0' <= a.key && a.key <= '9' || 'A' <= a.key && a.key <= 'Z')
+ str.Format(_T("%c"), (TCHAR)a.key);
+ break;
+ }
+
+ if(str.IsEmpty() || !(a.fVirt&1))
+ str.Format(_T("%c"), (TCHAR)a.key);
+
+ if(a.fVirt&(FCONTROL|FALT|FSHIFT))
+ str = MakeAccelModLabel(a.fVirt) + _T(" + ") + str;
+
+ str.Replace(_T(" + "), _T("+"));
+
+ return(str);
+}
+
+CString CPPageAccelTbl::MakeMouseButtonLabel(UINT mouse)
+{
+ CString ret;
+ switch(mouse)
+ {
+ case wmcmd::NONE: default: ret = _T("None"); break;
+ case wmcmd::LDOWN: ret = _T("Left Down"); break;
+ case wmcmd::LUP: ret = _T("Left Up"); break;
+ case wmcmd::LDBLCLK: ret = _T("Left DblClk"); break;
+ case wmcmd::MDOWN: ret = _T("Middle Down"); break;
+ case wmcmd::MUP: ret = _T("Middle Up"); break;
+ case wmcmd::MDBLCLK: ret = _T("Middle DblClk"); break;
+ case wmcmd::RDOWN: ret = _T("Right Down"); break;
+ case wmcmd::RUP: ret = _T("Right Up"); break;
+ case wmcmd::RDBLCLK: ret = _T("Right DblClk"); break;
+ case wmcmd::X1DOWN: ret = _T("X1 Down"); break;
+ case wmcmd::X1UP: ret = _T("X1 Up"); break;
+ case wmcmd::X1DBLCLK: ret = _T("X1 DblClk"); break;
+ case wmcmd::X2DOWN: ret = _T("X2 Down"); break;
+ case wmcmd::X2UP: ret = _T("X2 Up"); break;
+ case wmcmd::X2DBLCLK: ret = _T("X2 DblClk"); break;
+ case wmcmd::WUP: ret = _T("Wheel Up"); break;
+ case wmcmd::WDOWN: ret = _T("Wheel Down"); break;
+ }
+ return ret;
+}
+
+CString CPPageAccelTbl::MakeAppCommandLabel(UINT id)
+{
+ CString str;
+
+ ASSERT(id <= APPCOMMAND_LAST);
+
+ switch(id)
+ {
+ default: str = _T(""); break;
+ case APPCOMMAND_BROWSER_BACKWARD: str = _T("BROWSER_BACKWARD"); break;
+ case APPCOMMAND_BROWSER_FORWARD: str = _T("BROWSER_FORWARD"); break;
+ case APPCOMMAND_BROWSER_REFRESH: str = _T("BROWSER_REFRESH"); break;
+ case APPCOMMAND_BROWSER_STOP: str = _T("BROWSER_STOP"); break;
+ case APPCOMMAND_BROWSER_SEARCH: str = _T("BROWSER_SEARCH"); break;
+ case APPCOMMAND_BROWSER_FAVORITES: str = _T("BROWSER_FAVORITES"); break;
+ case APPCOMMAND_BROWSER_HOME: str = _T("BROWSER_HOME"); break;
+ case APPCOMMAND_VOLUME_MUTE: str = _T("VOLUME_MUTE"); break;
+ case APPCOMMAND_VOLUME_DOWN: str = _T("VOLUME_DOWN"); break;
+ case APPCOMMAND_VOLUME_UP: str = _T("VOLUME_UP"); break;
+ case APPCOMMAND_MEDIA_NEXTTRACK: str = _T("MEDIA_NEXTTRACK"); break;
+ case APPCOMMAND_MEDIA_PREVIOUSTRACK: str = _T("MEDIA_PREVIOUSTRACK"); break;
+ case APPCOMMAND_MEDIA_STOP: str = _T("MEDIA_STOP"); break;
+ case APPCOMMAND_MEDIA_PLAY_PAUSE: str = _T("MEDIA_PLAY_PAUSE"); break;
+ case APPCOMMAND_LAUNCH_MAIL: str = _T("LAUNCH_MAIL"); break;
+ case APPCOMMAND_LAUNCH_MEDIA_SELECT: str = _T("LAUNCH_MEDIA_SELECT"); break;
+ case APPCOMMAND_LAUNCH_APP1: str = _T("LAUNCH_APP1"); break;
+ case APPCOMMAND_LAUNCH_APP2: str = _T("LAUNCH_APP2"); break;
+ case APPCOMMAND_BASS_DOWN: str = _T("BASS_DOWN"); break;
+ case APPCOMMAND_BASS_BOOST: str = _T("BASS_BOOST"); break;
+ case APPCOMMAND_BASS_UP: str = _T("BASS_UP"); break;
+ case APPCOMMAND_TREBLE_DOWN: str = _T("TREBLE_DOWN"); break;
+ case APPCOMMAND_TREBLE_UP: str = _T("TREBLE_UP"); break;
+ case APPCOMMAND_MICROPHONE_VOLUME_MUTE: str = _T("MICROPHONE_VOLUME_MUTE"); break;
+ case APPCOMMAND_MICROPHONE_VOLUME_DOWN: str = _T("MICROPHONE_VOLUME_DOWN"); break;
+ case APPCOMMAND_MICROPHONE_VOLUME_UP: str = _T("MICROPHONE_VOLUME_UP"); break;
+ case APPCOMMAND_HELP: str = _T("HELP"); break;
+ case APPCOMMAND_FIND: str = _T("FIND"); break;
+ case APPCOMMAND_NEW: str = _T("NEW"); break;
+ case APPCOMMAND_OPEN: str = _T("OPEN"); break;
+ case APPCOMMAND_CLOSE: str = _T("CLOSE"); break;
+ case APPCOMMAND_SAVE: str = _T("SAVE"); break;
+ case APPCOMMAND_PRINT: str = _T("PRINT"); break;
+ case APPCOMMAND_UNDO: str = _T("UNDO"); break;
+ case APPCOMMAND_REDO: str = _T("REDO"); break;
+ case APPCOMMAND_COPY: str = _T("COPY"); break;
+ case APPCOMMAND_CUT: str = _T("CUT"); break;
+ case APPCOMMAND_PASTE: str = _T("PASTE"); break;
+ case APPCOMMAND_REPLY_TO_MAIL: str = _T("REPLY_TO_MAIL"); break;
+ case APPCOMMAND_FORWARD_MAIL: str = _T("FORWARD_MAIL"); break;
+ case APPCOMMAND_SEND_MAIL: str = _T("SEND_MAIL"); break;
+ case APPCOMMAND_SPELL_CHECK: str = _T("SPELL_CHECK"); break;
+ case APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE: str = _T("DICTATE_OR_COMMAND_CONTROL_TOGGLE"); break;
+ case APPCOMMAND_MIC_ON_OFF_TOGGLE: str = _T("MIC_ON_OFF_TOGGLE"); break;
+ case APPCOMMAND_CORRECTION_LIST: str = _T("CORRECTION_LIST"); break;
+ case APPCOMMAND_MEDIA_PLAY: str = _T("MEDIA_PLAY"); break;
+ case APPCOMMAND_MEDIA_PAUSE: str = _T("MEDIA_PAUSE"); break;
+ case APPCOMMAND_MEDIA_RECORD: str = _T("MEDIA_RECORD"); break;
+ case APPCOMMAND_MEDIA_FAST_FORWARD: str = _T("MEDIA_FAST_FORWARD"); break;
+ case APPCOMMAND_MEDIA_REWIND: str = _T("MEDIA_REWIND"); break;
+ case APPCOMMAND_MEDIA_CHANNEL_UP: str = _T("MEDIA_CHANNEL_UP"); break;
+ case APPCOMMAND_MEDIA_CHANNEL_DOWN: str = _T("MEDIA_CHANNEL_DOWN"); break;
+ }
+
+ return str;
+}
+void CPPageAccelTbl::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Text(pDX, IDC_EDIT1, m_WinLircAddr);
+ DDX_Control(pDX, IDC_EDIT1, m_WinLircEdit);
+ DDX_Control(pDX, IDC_STATICLINK, m_WinLircLink);
+ DDX_Check(pDX, IDC_CHECK1, m_fWinLirc);
+ DDX_Text(pDX, IDC_EDIT2, m_UIceAddr);
+ DDX_Control(pDX, IDC_EDIT2, m_UIceEdit);
+ DDX_Control(pDX, IDC_STATICLINK2, m_UIceLink);
+ DDX_Check(pDX, IDC_CHECK9, m_fUIce);
+}
+
+BEGIN_MESSAGE_MAP(CPPageAccelTbl, CPPageBase)
+ ON_NOTIFY(LVN_BEGINLABELEDIT, IDC_LIST1, OnBeginlabeleditList)
+ ON_NOTIFY(LVN_DOLABELEDIT, IDC_LIST1, OnDolabeleditList)
+ ON_NOTIFY(LVN_ENDLABELEDIT, IDC_LIST1, OnEndlabeleditList)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
+ ON_WM_TIMER()
+ ON_WM_CTLCOLOR()
+END_MESSAGE_MAP()
+
+// CPPageAccelTbl message handlers
+
+BOOL CPPageAccelTbl::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_wmcmds.RemoveAll();
+ m_wmcmds.AddTail(&s.wmcmds);
+ m_fWinLirc = s.fWinLirc;
+ m_WinLircAddr = s.WinLircAddr;
+ m_fUIce = s.fUIce;
+ m_UIceAddr = s.UIceAddr;
+
+ UpdateData(FALSE);
+
+ CRect r;
+ GetDlgItem(IDC_PLACEHOLDER)->GetWindowRect(r);
+ ScreenToClient(r);
+
+ m_list.CreateEx(
+ WS_EX_CLIENTEDGE,
+ WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_TABSTOP|LVS_REPORT|LVS_AUTOARRANGE|LVS_SHOWSELALWAYS,
+ r, this, IDC_LIST1);
+
+ m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER);
+
+ for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) m_list.DeleteColumn(0);
+ m_list.InsertColumn(COL_CMD, _T("Command"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_MOD, _T("Modifier"), LVCFMT_LEFT, 40);
+ m_list.InsertColumn(COL_KEY, _T("Key"), LVCFMT_LEFT, 40);
+ m_list.InsertColumn(COL_TYPE, _T("Type"), LVCFMT_LEFT, 40);
+ m_list.InsertColumn(COL_ID, _T("ID"), LVCFMT_LEFT, 40);
+ m_list.InsertColumn(COL_MOUSE, _T("Mouse"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_APPCMD, _T("App Command"), LVCFMT_LEFT, 120);
+ m_list.InsertColumn(COL_RMCMD, _T("RemoteCmd"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_RMREPCNT, _T("RepCnt"), LVCFMT_CENTER, 60);
+
+ POSITION pos = m_wmcmds.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ int row = m_list.InsertItem(m_list.GetItemCount(), m_wmcmds.GetAt(pos).name, COL_CMD);
+ m_list.SetItemData(row, (DWORD_PTR)pos);
+ m_wmcmds.GetNext(pos);
+ }
+
+ SetupList();
+
+ m_list.SetColumnWidth(COL_CMD, LVSCW_AUTOSIZE);
+ m_list.SetColumnWidth(COL_MOD, LVSCW_AUTOSIZE);
+ m_list.SetColumnWidth(COL_KEY, LVSCW_AUTOSIZE);
+ m_list.SetColumnWidth(COL_TYPE, LVSCW_AUTOSIZE);
+ m_list.SetColumnWidth(COL_ID, LVSCW_AUTOSIZE_USEHEADER);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageAccelTbl::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.wmcmds.RemoveAll();
+ s.wmcmds.AddTail(&m_wmcmds);
+
+ CAtlArray<ACCEL> pAccel;
+ pAccel.SetCount(m_wmcmds.GetCount());
+ POSITION pos = m_wmcmds.GetHeadPosition();
+ for(int i = 0; pos; i++) pAccel[i] = m_wmcmds.GetNext(pos);
+ if(s.hAccel) DestroyAcceleratorTable(s.hAccel);
+ s.hAccel = CreateAcceleratorTable(pAccel.GetData(), pAccel.GetCount());
+
+ GetParentFrame()->m_hAccelTable = s.hAccel;
+
+ s.fWinLirc = !!m_fWinLirc;
+ s.WinLircAddr = m_WinLircAddr;
+ if(s.fWinLirc) s.WinLircClient.Connect(m_WinLircAddr);
+ s.fUIce = !!m_fUIce;
+ s.UIceAddr = m_UIceAddr;
+ if(s.fUIce) s.UIceClient.Connect(m_UIceAddr);
+
+ return __super::OnApply();
+}
+
+void CPPageAccelTbl::OnBnClickedButton1()
+{
+ m_list.SetFocus();
+
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
+ {
+ m_list.SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
+ }
+}
+
+void CPPageAccelTbl::OnBnClickedButton2()
+{
+ m_list.SetFocus();
+
+ POSITION pos = m_list.GetFirstSelectedItemPosition();
+ if(!pos) return;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ while(pos)
+ {
+ wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(m_list.GetNextSelectedItem(pos)));
+ wc.Restore();
+ }
+
+ SetupList();
+
+ SetModified();
+}
+
+void CPPageAccelTbl::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
+ LV_ITEM* pItem = &pDispInfo->item;
+
+ *pResult = FALSE;
+
+ if(pItem->iItem < 0)
+ return;
+
+ if(pItem->iSubItem == COL_MOD || pItem->iSubItem == COL_KEY || pItem->iSubItem == COL_TYPE
+ || pItem->iSubItem == COL_MOUSE || pItem->iSubItem == COL_APPCMD
+ || pItem->iSubItem == COL_RMCMD || pItem->iSubItem == COL_RMREPCNT)
+ {
+ *pResult = TRUE;
+ }
+}
+
+static BYTE s_mods[] = {0,FALT,FCONTROL,FSHIFT,FCONTROL|FALT,FCONTROL|FSHIFT,FALT|FSHIFT,FCONTROL|FALT|FSHIFT};
+
+void CPPageAccelTbl::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
+ LV_ITEM* pItem = &pDispInfo->item;
+
+ *pResult = FALSE;
+
+ if(pItem->iItem < 0)
+ return;
+
+ wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(pItem->iItem));
+ ACCEL& a = wc;
+
+ CAtlList<CString> sl;
+ int nSel = -1;
+
+ if(pItem->iSubItem == COL_MOD)
+ {
+ for(int i = 0; i < countof(s_mods); i++)
+ {
+ sl.AddTail(MakeAccelModLabel(s_mods[i]));
+ if((a.fVirt&~3) == s_mods[i]) nSel = i;
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+
+ *pResult = TRUE;
+ }
+ else if(pItem->iSubItem == COL_KEY)
+ {
+ for(int i = 0; i < 256; i++)
+ {
+ sl.AddTail(MakeAccelVkeyLabel(i, a.fVirt&FVIRTKEY));
+ if(a.key == i) nSel = i;
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+
+ *pResult = TRUE;
+ }
+ else if(pItem->iSubItem == COL_TYPE)
+ {
+ sl.AddTail(_T("VIRTKEY"));
+ sl.AddTail(_T("ASCII"));
+
+ nSel = !(a.fVirt&FVIRTKEY);
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+
+ *pResult = TRUE;
+ }
+ else if(pItem->iSubItem == COL_MOUSE)
+ {
+ for(UINT i = 0; i < wmcmd::LAST; i++)
+ {
+ sl.AddTail(MakeMouseButtonLabel(i));
+ if(wc.mouse == i) nSel = i;
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+
+ *pResult = TRUE;
+ }
+ else if(pItem->iSubItem == COL_APPCMD)
+ {
+ for(int i = 0; i <= APPCOMMAND_LAST; i++)
+ {
+ sl.AddTail(MakeAppCommandLabel(i));
+ if(wc.appcmd == i) nSel = i;
+ }
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+
+ *pResult = TRUE;
+ }
+ else if(pItem->iSubItem == COL_RMCMD)
+ {
+ m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
+
+ *pResult = TRUE;
+ }
+ else if(pItem->iSubItem == COL_RMREPCNT)
+ {
+ m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
+
+ *pResult = TRUE;
+ }
+}
+
+void CPPageAccelTbl::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
+ LV_ITEM* pItem = &pDispInfo->item;
+
+ *pResult = FALSE;
+
+ if(!m_list.m_fInPlaceDirty)
+ return;
+
+ if(pItem->iItem < 0)
+ return;
+
+ wmcmd& wc = m_wmcmds.GetAt((POSITION)m_list.GetItemData(pItem->iItem));
+
+ if(pItem->iSubItem == COL_MOD)
+ {
+ if(pItem->lParam >= 0 && pItem->lParam < countof(s_mods))
+ {
+ wc.fVirt = (wc.fVirt&3) | (s_mods[pItem->lParam]&~3);
+ m_list.SetItemText(pItem->iItem, COL_MOD, pItem->pszText);
+ *pResult = TRUE;
+ }
+ }
+ else if(pItem->iSubItem == COL_KEY)
+ {
+ int i = pItem->lParam;
+ if(i >= 0 && i < 256)
+ {
+ wc.key = (WORD)i;
+ m_list.SetItemText(pItem->iItem, COL_KEY, pItem->pszText);
+ *pResult = TRUE;
+ }
+ }
+ else if(pItem->iSubItem == COL_TYPE)
+ {
+ int i = pItem->lParam;
+ if(i >= 0 && i < 2)
+ {
+ wc.fVirt = (wc.fVirt&~FVIRTKEY) | (i == 0 ? FVIRTKEY : 0);
+ m_list.SetItemText(pItem->iItem, COL_KEY, MakeAccelVkeyLabel(wc.key, wc.fVirt&FVIRTKEY));
+ m_list.SetItemText(pItem->iItem, COL_TYPE, (wc.fVirt&FVIRTKEY)?_T("VIRTKEY"):_T("ASCII"));
+ *pResult = TRUE;
+ }
+ }
+ else if(pItem->iSubItem == COL_APPCMD)
+ {
+ int i = pItem->lParam;
+ if(i >= 0 && i <= APPCOMMAND_LAST)
+ {
+ wc.appcmd = (WORD)i;
+ m_list.SetItemText(pItem->iItem, COL_APPCMD, pItem->pszText);
+ *pResult = TRUE;
+ }
+ }
+ else if(pItem->iSubItem == COL_MOUSE)
+ {
+ wc.mouse = pItem->lParam;
+ m_list.SetItemText(pItem->iItem, COL_MOUSE, pItem->pszText);
+ }
+ else if(pItem->iSubItem == COL_RMCMD)
+ {
+ wc.rmcmd = CStringA(CString(pItem->pszText)).Trim();
+ wc.rmcmd.Replace(' ', '_');
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, CString(wc.rmcmd));
+ *pResult = TRUE;
+ }
+ else if(pItem->iSubItem == COL_RMREPCNT)
+ {
+ CString str = CString(pItem->pszText).Trim();
+ wc.rmrepcnt = _tcstol(str, NULL, 10);
+ str.Format(_T("%d"), wc.rmrepcnt);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ *pResult = TRUE;
+ }
+
+ if(*pResult)
+ SetModified();
+}
+
+
+void CPPageAccelTbl::OnTimer(UINT nIDEvent)
+{
+ UpdateData();
+
+ if(m_fWinLirc)
+ {
+ CString addr;
+ m_WinLircEdit.GetWindowText(addr);
+ AfxGetAppSettings().WinLircClient.Connect(addr);
+ }
+
+ m_WinLircEdit.Invalidate();
+
+ if(m_fUIce)
+ {
+ CString addr;
+ m_UIceEdit.GetWindowText(addr);
+ AfxGetAppSettings().UIceClient.Connect(addr);
+ }
+
+ m_UIceEdit.Invalidate();
+
+ m_counter++;
+
+ __super::OnTimer(nIDEvent);
+}
+
+HBRUSH CPPageAccelTbl::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+ HBRUSH hbr = __super::OnCtlColor(pDC, pWnd, nCtlColor);
+
+ int status = -1;
+
+ if(*pWnd == m_WinLircEdit)
+ status = AfxGetAppSettings().WinLircClient.GetStatus();
+ else if(*pWnd == m_UIceEdit)
+ status = AfxGetAppSettings().UIceClient.GetStatus();
+
+ if(status == 0 || status == 2 && (m_counter&1))
+ pDC->SetTextColor(0x0000ff);
+ else if(status == 1)
+ pDC->SetTextColor(0x008000);
+
+ return hbr;
+}
+
+BOOL CPPageAccelTbl::OnSetActive()
+{
+ SetTimer(1, 1000, NULL);
+
+ return CPPageBase::OnSetActive();
+}
+
+BOOL CPPageAccelTbl::OnKillActive()
+{
+ KillTimer(1);
+
+ return CPPageBase::OnKillActive();
+}
+
diff --git a/src/apps/mplayerc/PPageAccelTbl.h b/src/apps/mplayerc/PPageAccelTbl.h
new file mode 100644
index 000000000..9322dc375
--- /dev/null
+++ b/src/apps/mplayerc/PPageAccelTbl.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+#include "PlayerListCtrl.h"
+#include "StaticLink.h"
+
+// CPPageAccelTbl dialog
+
+class CPPageAccelTbl : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageAccelTbl)
+
+private:
+ enum {COL_CMD, COL_MOD, COL_KEY, COL_TYPE, COL_ID, COL_MOUSE, COL_APPCMD, COL_RMCMD, COL_RMREPCNT};
+ CList<wmcmd> m_wmcmds;
+
+ void SetupList();
+
+ int m_counter;
+
+public:
+ CPPageAccelTbl();
+ virtual ~CPPageAccelTbl();
+
+ static CString MakeAccelModLabel(BYTE fVirt);
+ static CString MakeAccelVkeyLabel(WORD key, bool fVirtKey);
+ static CString MakeAccelShortcutLabel(UINT id);
+ static CString MakeAccelShortcutLabel(ACCEL& a);
+ static CString MakeMouseButtonLabel(UINT mouse);
+ static CString MakeAppCommandLabel(UINT id);
+
+ enum {APPCOMMAND_LAST=APPCOMMAND_MEDIA_CHANNEL_DOWN};
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEACCELTBL };
+ CPlayerListCtrl m_list;
+ BOOL m_fWinLirc;
+ CString m_WinLircAddr;
+ CEdit m_WinLircEdit;
+ CStaticLink m_WinLircLink;
+ BOOL m_fUIce;
+ CString m_UIceAddr;
+ CEdit m_UIceEdit;
+ CStaticLink m_UIceLink;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+ virtual BOOL OnSetActive();
+ virtual BOOL OnKillActive();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnBnClickedButton2();
+ afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+ afx_msg void OnTimer(UINT nIDEvent);
+};
diff --git a/src/apps/mplayerc/PPageAudioSwitcher.cpp b/src/apps/mplayerc/PPageAudioSwitcher.cpp
new file mode 100644
index 000000000..65839a2c1
--- /dev/null
+++ b/src/apps/mplayerc/PPageAudioSwitcher.cpp
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageAudioSwitcher.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <math.h>
+#include "mplayerc.h"
+#include "PPageAudioSwitcher.h"
+
+// CPPageAudioSwitcher dialog
+
+IMPLEMENT_DYNAMIC(CPPageAudioSwitcher, CPPageBase)
+CPPageAudioSwitcher::CPPageAudioSwitcher(IFilterGraph* pFG)
+ : CPPageBase(CPPageAudioSwitcher::IDD, CPPageAudioSwitcher::IDD)
+ , m_fAudioNormalize(FALSE)
+ , m_fAudioNormalizeRecover(FALSE)
+ , m_fDownSampleTo441(FALSE)
+ , m_fCustomChannelMapping(FALSE)
+ , m_nChannels(0)
+ , m_fEnableAudioSwitcher(FALSE)
+ , m_dwChannelMask(0)
+ , m_tAudioTimeShift(0)
+ , m_fAudioTimeShift(FALSE)
+ , m_AudioBoost(0)
+{
+ m_pASF = FindFilter(__uuidof(CAudioSwitcherFilter), pFG);
+}
+
+CPPageAudioSwitcher::~CPPageAudioSwitcher()
+{
+}
+
+void CPPageAudioSwitcher::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Check(pDX, IDC_CHECK5, m_fAudioNormalize);
+ DDX_Check(pDX, IDC_CHECK6, m_fAudioNormalizeRecover);
+ DDX_Slider(pDX, IDC_SLIDER1, m_AudioBoost);
+ DDX_Control(pDX, IDC_SLIDER1, m_AudioBoostCtrl);
+ DDX_Check(pDX, IDC_CHECK3, m_fDownSampleTo441);
+ DDX_Check(pDX, IDC_CHECK1, m_fCustomChannelMapping);
+ DDX_Control(pDX, IDC_EDIT1, m_nChannelsCtrl);
+ DDX_Text(pDX, IDC_EDIT1, m_nChannels);
+ DDX_Control(pDX, IDC_SPIN1, m_nChannelsSpinCtrl);
+ DDX_Control(pDX, IDC_LIST1, m_list);
+ DDX_Check(pDX, IDC_CHECK2, m_fEnableAudioSwitcher);
+ DDX_Control(pDX, IDC_CHECK3, m_fDownSampleTo441Ctrl);
+ DDX_Control(pDX, IDC_CHECK1, m_fCustomChannelMappingCtrl);
+ DDX_Control(pDX, IDC_EDIT2, m_tAudioTimeShiftCtrl);
+ DDX_Control(pDX, IDC_SPIN2, m_tAudioTimeShiftSpin);
+ DDX_Text(pDX, IDC_EDIT2, m_tAudioTimeShift);
+ DDX_Check(pDX, IDC_CHECK4, m_fAudioTimeShift);
+ DDX_Control(pDX, IDC_CHECK4, m_fAudioTimeShiftCtrl);
+}
+
+BEGIN_MESSAGE_MAP(CPPageAudioSwitcher, CPPageBase)
+ ON_NOTIFY(NM_CLICK, IDC_LIST1, OnNMClickList1)
+ ON_WM_DRAWITEM()
+ ON_EN_CHANGE(IDC_EDIT1, OnEnChangeEdit1)
+ ON_UPDATE_COMMAND_UI(IDC_SLIDER1, OnUpdateAudioSwitcher)
+ ON_UPDATE_COMMAND_UI(IDC_CHECK5, OnUpdateAudioSwitcher)
+ ON_UPDATE_COMMAND_UI(IDC_CHECK6, OnUpdateAudioSwitcher)
+ ON_UPDATE_COMMAND_UI(IDC_CHECK3, OnUpdateAudioSwitcher)
+ ON_UPDATE_COMMAND_UI(IDC_CHECK4, OnUpdateAudioSwitcher)
+ ON_UPDATE_COMMAND_UI(IDC_EDIT2, OnUpdateAudioSwitcher)
+ ON_UPDATE_COMMAND_UI(IDC_SPIN2, OnUpdateAudioSwitcher)
+ ON_UPDATE_COMMAND_UI(IDC_CHECK1, OnUpdateAudioSwitcher)
+ ON_UPDATE_COMMAND_UI(IDC_EDIT1, OnUpdateChannelMapping)
+ ON_UPDATE_COMMAND_UI(IDC_SPIN1, OnUpdateChannelMapping)
+ ON_UPDATE_COMMAND_UI(IDC_LIST1, OnUpdateChannelMapping)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdateChannelMapping)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC2, OnUpdateChannelMapping)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC3, OnUpdateChannelMapping)
+ ON_WM_HSCROLL()
+END_MESSAGE_MAP()
+
+
+// CPPageAudioSwitcher message handlers
+
+BOOL CPPageAudioSwitcher::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_fEnableAudioSwitcher = s.fEnableAudioSwitcher;
+ m_fAudioNormalize = s.fAudioNormalize;
+ m_fAudioNormalizeRecover = s.fAudioNormalizeRecover;
+ m_AudioBoost = (int)(50.0f*log10(s.AudioBoost));
+ m_AudioBoostCtrl.SetRange(0, 100);
+ m_fDownSampleTo441 = s.fDownSampleTo441;
+ m_fAudioTimeShift = s.fAudioTimeShift;
+ m_tAudioTimeShift = s.tAudioTimeShift;
+ m_tAudioTimeShiftSpin.SetRange32(-1000*60*60*24, 1000*60*60*24);
+ m_fCustomChannelMapping = s.fCustomChannelMapping;
+ memcpy(m_pSpeakerToChannelMap, s.pSpeakerToChannelMap, sizeof(s.pSpeakerToChannelMap));
+
+ if(m_pASF)
+ m_pASF->GetInputSpeakerConfig(&m_dwChannelMask);
+
+ m_nChannels = 1;
+ m_nChannelsSpinCtrl.SetRange(1, 18);
+
+ if(m_pASF)
+ m_nChannels = m_pASF->GetNumberOfInputChannels();
+
+ m_list.InsertColumn(0, _T(""), LVCFMT_LEFT, 100);
+ m_list.InsertItem(0, _T(""));
+ m_list.InsertItem(1, _T("Front Left"));
+ m_list.InsertItem(2, _T("Front Right"));
+ m_list.InsertItem(3, _T("Front Center"));
+ m_list.InsertItem(4, _T("Low Frequency"));
+ m_list.InsertItem(5, _T("Back Left"));
+ m_list.InsertItem(6, _T("Back Right"));
+ m_list.InsertItem(7, _T("Front Left of Center"));
+ m_list.InsertItem(8, _T("Front Right of Center"));
+ m_list.InsertItem(9, _T("Back Center"));
+ m_list.InsertItem(10, _T("Side Left"));
+ m_list.InsertItem(11, _T("Side Right"));
+ m_list.InsertItem(12, _T("Top Center"));
+ m_list.InsertItem(13, _T("Top Front Left"));
+ m_list.InsertItem(14, _T("Top Front Center"));
+ m_list.InsertItem(15, _T("Top Front Right"));
+ m_list.InsertItem(16, _T("Top Back Left"));
+ m_list.InsertItem(17, _T("Top Back Center"));
+ m_list.InsertItem(18, _T("Top Back Right"));
+ m_list.SetColumnWidth(0, LVSCW_AUTOSIZE);
+
+ for(int i = 1; i <= 18; i++)
+ {
+ m_list.InsertColumn(i, _T(""), LVCFMT_CENTER, 16);
+ CString n;
+ n.Format(_T("%d"), i);
+ m_list.SetItemText(0, i, n);
+// m_list.SetColumnWidth(i, LVSCW_AUTOSIZE);
+// m_list.SetColumnWidth(i, m_list.GetColumnWidth(i)*8/10);
+ }
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageAudioSwitcher::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.fEnableAudioSwitcher = !!m_fEnableAudioSwitcher;
+ s.fAudioNormalize = !!m_fAudioNormalize;
+ s.fAudioNormalizeRecover = !!m_fAudioNormalizeRecover;
+ s.AudioBoost = (float)pow(10.0, (double)m_AudioBoost/50);
+ s.fDownSampleTo441 = !!m_fDownSampleTo441;
+ s.fAudioTimeShift = !!m_fAudioTimeShift;
+ s.tAudioTimeShift = m_tAudioTimeShift;
+ s.fCustomChannelMapping = !!m_fCustomChannelMapping;
+ memcpy(s.pSpeakerToChannelMap, m_pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap));
+
+ if(m_pASF)
+ {
+ m_pASF->SetSpeakerConfig(s.fCustomChannelMapping, s.pSpeakerToChannelMap);
+ m_pASF->EnableDownSamplingTo441(s.fDownSampleTo441);
+ m_pASF->SetAudioTimeShift(s.fAudioTimeShift ? 10000i64*s.tAudioTimeShift : 0);
+ m_pASF->SetNormalizeBoost(s.fAudioNormalize, s.fAudioNormalizeRecover, s.AudioBoost);
+ }
+
+ return __super::OnApply();
+}
+
+void CPPageAudioSwitcher::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
+
+ if(lpnmlv->iItem > 0 && lpnmlv->iSubItem > 0 && lpnmlv->iSubItem <= m_nChannels)
+ {
+ UpdateData();
+ m_pSpeakerToChannelMap[m_nChannels-1][lpnmlv->iItem-1] ^= 1<<(lpnmlv->iSubItem-1);
+ m_list.RedrawItems(lpnmlv->iItem, lpnmlv->iItem);
+ SetModified();
+
+ if(GetKeyState(VK_SHIFT) & 0x8000)
+ {
+ OnApply();
+ }
+ }
+
+ *pResult = 0;
+}
+
+void CPPageAudioSwitcher::OnEnChangeEdit1()
+{
+ if(IsWindow(m_list.m_hWnd))
+ {
+ UpdateData();
+ m_list.Invalidate();
+ }
+}
+
+#include <math.h>
+
+void CPPageAudioSwitcher::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
+{
+ if(nIDCtl != IDC_LIST1) return;
+
+// if(lpDrawItemStruct->itemID == 0)
+// UpdateData();
+
+ CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
+
+ pDC->SetBkMode(TRANSPARENT);
+
+ CPen p(PS_INSIDEFRAME, 1, 0xe0e0e0);
+ CPen* old = pDC->SelectObject(&p);
+
+ pDC->MoveTo(lpDrawItemStruct->rcItem.left, lpDrawItemStruct->rcItem.bottom-1);
+ pDC->LineTo(lpDrawItemStruct->rcItem.right, lpDrawItemStruct->rcItem.bottom-1);
+
+ CHeaderCtrl* pHeader = m_list.GetHeaderCtrl();
+ int nColumnCount = pHeader->GetItemCount();
+
+ for(int i = 0; i < nColumnCount; i++)
+ {
+ CRect r, rb;
+ m_list.GetSubItemRect(lpDrawItemStruct->itemID, i, LVIR_BOUNDS, rb);
+ m_list.GetSubItemRect(lpDrawItemStruct->itemID, i, LVIR_LABEL, r);
+
+ pDC->MoveTo(r.right-1, r.top);
+ pDC->LineTo(r.right-1, r.bottom-1);
+
+ CSize s = pDC->GetTextExtent(m_list.GetItemText(lpDrawItemStruct->itemID, i));
+
+ if(i == 0)
+ {
+ r.left = rb.left;
+
+ if(lpDrawItemStruct->itemID == 0)
+ {
+ pDC->MoveTo(0, 0);
+ pDC->LineTo(r.right, r.bottom-1);
+ }
+ else
+ {
+ pDC->SetTextColor(m_list.IsWindowEnabled() ? 0 : 0xb0b0b0);
+ pDC->TextOut(r.left+1, (r.top+r.bottom-s.cy)/2, m_list.GetItemText(lpDrawItemStruct->itemID, i));
+ }
+ }
+ else
+ {
+ pDC->SetTextColor(i > m_nChannels ? 0xe0e0e0 : (!m_list.IsWindowEnabled() ? 0xb0b0b0 : 0));
+
+ if(lpDrawItemStruct->itemID == 0)
+ {
+ pDC->TextOut((r.left+r.right-s.cx)/2, (r.top+r.bottom-s.cy)/2, m_list.GetItemText(lpDrawItemStruct->itemID, i));
+ }
+ else
+ {
+ if(m_dwChannelMask & (1<<(lpDrawItemStruct->itemID-1)))
+ {
+ int nBitsSet = 0;
+
+ for(int j = 1; j <= (1<<(lpDrawItemStruct->itemID-1)); j <<= 1)
+ {
+ if(m_dwChannelMask & j)
+ nBitsSet++;
+ }
+
+ if(nBitsSet == i)
+ {
+ COLORREF tmp = pDC->GetTextColor();
+
+ pDC->SetTextColor(0xe0e0e0);
+ CFont f;
+ f.CreatePointFont(MulDiv(100, 96, pDC->GetDeviceCaps(LOGPIXELSX)), _T("Marlett"));
+ CFont* old = pDC->SelectObject(&f);
+ s = pDC->GetTextExtent(_T("g"));
+ pDC->TextOut((r.left+r.right-s.cx)/2, (r.top+r.bottom-s.cy)/2, _T("g"));
+
+ pDC->SetTextColor(tmp);
+ }
+ }
+
+ if(m_pSpeakerToChannelMap[m_nChannels-1][lpDrawItemStruct->itemID-1] & (1<<(i-1)))
+ {
+ CFont f;
+ f.CreatePointFont(MulDiv(100, 96, pDC->GetDeviceCaps(LOGPIXELSX)), _T("Marlett"));
+ CFont* old = pDC->SelectObject(&f);
+ s = pDC->GetTextExtent(_T("a"));
+ pDC->TextOut((r.left+r.right-s.cx)/2, (r.top+r.bottom-s.cy)/2, _T("a"));
+ pDC->SelectObject(old);
+ }
+ }
+ }
+ }
+
+ pDC->SelectObject(old);
+}
+
+void CPPageAudioSwitcher::OnUpdateAudioSwitcher(CCmdUI* pCmdUI)
+{
+// UpdateData();
+ pCmdUI->Enable(IsDlgButtonChecked(IDC_CHECK2)/*m_fEnableAudioSwitcher*/);
+}
+
+void CPPageAudioSwitcher::OnUpdateChannelMapping(CCmdUI* pCmdUI)
+{
+// UpdateData();
+ pCmdUI->Enable(IsDlgButtonChecked(IDC_CHECK2)/*m_fEnableAudioSwitcher*/
+ && IsDlgButtonChecked(IDC_CHECK1)/*m_fCustomChannelMapping*/);
+}
+
+void CPPageAudioSwitcher::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ SetModified();
+
+ __super::OnHScroll(nSBCode, nPos, pScrollBar);
+}
diff --git a/src/apps/mplayerc/PPageAudioSwitcher.h b/src/apps/mplayerc/PPageAudioSwitcher.h
new file mode 100644
index 000000000..87f51adc8
--- /dev/null
+++ b/src/apps/mplayerc/PPageAudioSwitcher.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+#include "FloatEdit.h"
+#include "..\..\filters\switcher\AudioSwitcher\AudioSwitcher.h"
+
+// CPPageAudioSwitcher dialog
+
+class CPPageAudioSwitcher : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageAudioSwitcher)
+
+private:
+ CComQIPtr<IAudioSwitcherFilter> m_pASF;
+ DWORD m_pSpeakerToChannelMap[18][18];
+ DWORD m_dwChannelMask;
+
+public:
+ CPPageAudioSwitcher(IFilterGraph* pFG);
+ virtual ~CPPageAudioSwitcher();
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEAUDIOSWITCHER };
+
+ BOOL m_fEnableAudioSwitcher;
+ BOOL m_fAudioNormalize;
+ BOOL m_fAudioNormalizeRecover;
+ int m_AudioBoost;
+ CSliderCtrl m_AudioBoostCtrl;
+ BOOL m_fDownSampleTo441;
+ CButton m_fDownSampleTo441Ctrl;
+ BOOL m_fCustomChannelMapping;
+ CButton m_fCustomChannelMappingCtrl;
+ CEdit m_nChannelsCtrl;
+ int m_nChannels;
+ CSpinButtonCtrl m_nChannelsSpinCtrl;
+ CListCtrl m_list;
+ int m_tAudioTimeShift;
+ CButton m_fAudioTimeShiftCtrl;
+ CIntEdit m_tAudioTimeShiftCtrl;
+ CSpinButtonCtrl m_tAudioTimeShiftSpin;
+ BOOL m_fAudioTimeShift;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
+ afx_msg void OnEnChangeEdit1();
+ afx_msg void OnUpdateAudioSwitcher(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateChannelMapping(CCmdUI* pCmdUI);
+public:
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+};
diff --git a/src/apps/mplayerc/PPageBase.cpp b/src/apps/mplayerc/PPageBase.cpp
new file mode 100644
index 000000000..517cf21c3
--- /dev/null
+++ b/src/apps/mplayerc/PPageBase.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageBase.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageBase.h"
+
+// CPPageBase dialog
+
+IMPLEMENT_DYNAMIC(CPPageBase, CCmdUIPropertyPage)
+CPPageBase::CPPageBase(UINT nIDTemplate, UINT nIDCaption)
+ : CCmdUIPropertyPage(nIDTemplate, nIDCaption)
+{
+}
+
+CPPageBase::~CPPageBase()
+{
+}
+
+void CPPageBase::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+}
+
+void CPPageBase::CreateToolTip()
+{
+ m_wndToolTip.Create(this);
+ m_wndToolTip.Activate(TRUE);
+ m_wndToolTip.SetMaxTipWidth(300);
+ m_wndToolTip.SetDelayTime(TTDT_AUTOPOP, 10000);
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetWindow(GW_HWNDNEXT))
+ {
+ CString strToolTip;
+ if(strToolTip.LoadString(pChild->GetDlgCtrlID()))
+ m_wndToolTip.AddTool(pChild, strToolTip);
+ }
+}
+
+BOOL CPPageBase::PreTranslateMessage(MSG* pMsg)
+{
+ if(IsWindow(m_wndToolTip))
+ if(pMsg->message >= WM_MOUSEFIRST && pMsg->message <= WM_MOUSELAST)
+ {
+ MSG msg;
+ memcpy(&msg, pMsg, sizeof(MSG));
+ for(HWND hWndParent = ::GetParent(msg.hwnd);
+ hWndParent && hWndParent != m_hWnd;
+ hWndParent = ::GetParent(hWndParent))
+ {
+ msg.hwnd = hWndParent;
+ }
+
+ if(msg.hwnd)
+ {
+ m_wndToolTip.RelayEvent(&msg);
+ }
+ }
+
+ return __super::PreTranslateMessage(pMsg);
+}
+
+BEGIN_MESSAGE_MAP(CPPageBase, CCmdUIPropertyPage)
+ ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+
+// CPPageBase message handlers
+
+BOOL CPPageBase::OnSetActive()
+{
+ AfxGetApp()->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("LastUsedPage"), (UINT)m_pPSP->pszTemplate);
+
+ return __super::OnSetActive();
+}
+
+void CPPageBase::OnDestroy()
+{
+ __super::OnDestroy();
+
+ m_wndToolTip.DestroyWindow();
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/PPageBase.h b/src/apps/mplayerc/PPageBase.h
new file mode 100644
index 000000000..25f00fba7
--- /dev/null
+++ b/src/apps/mplayerc/PPageBase.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CPPageBase dialog
+
+class CPPageBase : public CCmdUIPropertyPage
+{
+ DECLARE_DYNAMIC(CPPageBase)
+
+protected:
+ CToolTipCtrl m_wndToolTip;
+ void CreateToolTip();
+
+public:
+ CPPageBase(UINT nIDTemplate, UINT nIDCaption = 0);
+ virtual ~CPPageBase();
+
+// Dialog Data
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+ virtual BOOL OnSetActive();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnDestroy();
+};
diff --git a/src/apps/mplayerc/PPageCasimir.cpp b/src/apps/mplayerc/PPageCasimir.cpp
new file mode 100644
index 000000000..a72f5cdcb
--- /dev/null
+++ b/src/apps/mplayerc/PPageCasimir.cpp
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// CPPageCasimir.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPageOutput.h"
+#include "../../../include/moreuuids.h"
+#include ".\ppagecasimir.h"
+
+// CPPageCasimir dialog
+
+IMPLEMENT_DYNAMIC(CPPageCasimir, CPPageBase)
+CPPageCasimir::CPPageCasimir()
+ : CPPageBase(CPPageCasimir::IDD, CPPageCasimir::IDD)
+ , m_fMonitorAutoRefreshRate(FALSE)
+ , m_fD3DFullscreen(FALSE)
+ , m_fRememberDVDPos(FALSE)
+ , m_fRememberFilePos(FALSE)
+{
+}
+
+CPPageCasimir::~CPPageCasimir()
+{
+}
+
+void CPPageCasimir::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Check(pDX, IDC_AUTO_REFRESHRATE_CHECK, m_fMonitorAutoRefreshRate);
+ DDX_Check(pDX, IDC_FULLSCREEN_MONITOR_CHECK, m_fD3DFullscreen);
+ DDX_Control(pDX, IDC_SLI_CONTRAST, m_SliContrast);
+ DDX_Control(pDX, IDC_SLI_BRIGHTNESS, m_SliBrightness);
+ DDX_Control(pDX, IDC_SLI_HUE, m_SliHue);
+ DDX_Control(pDX, IDC_SLI_SATURATION, m_SliSaturation);
+ DDX_Check(pDX, IDC_DVD_POS, m_fRememberDVDPos);
+ DDX_Check(pDX, IDC_FILE_POS, m_fRememberFilePos);
+}
+
+
+BEGIN_MESSAGE_MAP(CPPageCasimir, CPPageBase)
+ ON_WM_HSCROLL()
+ ON_BN_CLICKED(IDC_RESET, OnBnClickedReset)
+END_MESSAGE_MAP()
+
+
+// CPPageCasimir message handlers
+
+BOOL CPPageCasimir::OnInitDialog()
+{
+ COLORPROPERTY_RANGE* ControlRange;
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_fMonitorAutoRefreshRate = s.fMonitorAutoRefreshRate;
+ m_fD3DFullscreen = s.fD3DFullscreen;
+ m_fRememberDVDPos = s.fRememberDVDPos;
+ m_fRememberFilePos = s.fRememberFilePos;
+
+ UpdateData(FALSE);
+
+ CreateToolTip();
+
+ ControlRange = AfxGetMyApp()->GetColorControl (Contrast);
+ if (ControlRange)
+ {
+ m_dContrast = s.dContrast;
+ m_SliContrast.EnableWindow (TRUE);
+ m_SliContrast.SetRange ((int)ControlRange->MinValue*100, (int)ControlRange->MaxValue*100);
+ m_SliContrast.SetTicFreq ((int)(ControlRange->MaxValue - ControlRange->MinValue) * 10);
+ m_SliContrast.SetPos ((int)(m_dContrast*100));
+ }
+
+ ControlRange = AfxGetMyApp()->GetColorControl (Brightness);
+ if (ControlRange)
+ {
+ m_dBrightness = s.dBrightness;
+ m_SliBrightness.EnableWindow (TRUE);
+ m_SliBrightness.SetRange ((int)ControlRange->MinValue, (int)ControlRange->MaxValue);
+ m_SliBrightness.SetTicFreq ((int)(ControlRange->MaxValue - ControlRange->MinValue) / 10);
+ m_SliBrightness.SetPos ((int)m_dBrightness);
+ }
+
+ ControlRange = AfxGetMyApp()->GetColorControl (Hue);
+ if (ControlRange)
+ {
+ m_dHue = s.dHue;
+ m_SliHue.EnableWindow (TRUE);
+ m_SliHue.SetRange ((int)ControlRange->MinValue, (int)ControlRange->MaxValue);
+ m_SliHue.SetTicFreq ((int)(ControlRange->MaxValue - ControlRange->MinValue) / 10);
+ m_SliHue.SetPos ((int)m_dHue);
+ }
+
+ ControlRange = AfxGetMyApp()->GetColorControl (Saturation);
+ if (ControlRange)
+ {
+ m_dSaturation = s.dSaturation;
+ m_SliSaturation.EnableWindow (TRUE);
+ m_SliSaturation.SetRange ((int)ControlRange->MinValue*100, (int)ControlRange->MaxValue*100);
+ m_SliSaturation.SetTicFreq ((int)(ControlRange->MaxValue - ControlRange->MinValue) * 10);
+ m_SliSaturation.SetPos ((int)(m_dSaturation*100));
+ }
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageCasimir::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.dBrightness = m_dBrightness;
+ s.dContrast = m_dContrast;
+ s.dHue = m_dHue;
+ s.dSaturation = m_dSaturation;
+ s.fMonitorAutoRefreshRate = m_fMonitorAutoRefreshRate ? true : false;
+ s.fD3DFullscreen = m_fD3DFullscreen ? true : false;
+ s.fRememberDVDPos = m_fRememberDVDPos ? true : false;
+ s.fRememberFilePos = m_fRememberFilePos ? true : false;
+
+ return __super::OnApply();
+}
+
+
+void CPPageCasimir::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ if(*pScrollBar == m_SliContrast)
+ {
+ UpdateData();
+ m_dContrast = (float)(m_SliContrast.GetPos()/100.0);
+ }
+ else if(*pScrollBar == m_SliBrightness)
+ {
+ UpdateData();
+ m_dBrightness = (float)m_SliBrightness.GetPos();
+ }
+ else if(*pScrollBar == m_SliHue)
+ {
+ UpdateData();
+ m_dHue = (float)m_SliHue.GetPos();
+ }
+ else if(*pScrollBar == m_SliSaturation)
+ {
+ UpdateData();
+ m_dSaturation = (float)(m_SliSaturation.GetPos()/100.0);
+ }
+
+ SetModified();
+
+ ((CMainFrame*)AfxGetMyApp()->GetMainWnd())->SetVMR9ColorControl(m_dBrightness, m_dContrast, m_dHue, m_dSaturation);
+
+ __super::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CPPageCasimir::OnBnClickedReset()
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ UpdateData(FALSE);
+
+ m_dContrast = AfxGetMyApp()->GetColorControl (Contrast)->DefaultValue;
+ m_dBrightness = AfxGetMyApp()->GetColorControl (Brightness)->DefaultValue;
+ m_dHue = AfxGetMyApp()->GetColorControl (Hue)->DefaultValue;
+ m_dSaturation = AfxGetMyApp()->GetColorControl (Saturation)->DefaultValue;
+
+ m_SliContrast.SetPos ((int)m_dContrast*100);
+ m_SliBrightness.SetPos ((int)m_dBrightness);
+ m_SliHue.SetPos ((int)m_dHue);
+ m_SliSaturation.SetPos ((int)m_dSaturation*100);
+
+ ((CMainFrame*)AfxGetMyApp()->GetMainWnd())->SetVMR9ColorControl(m_dBrightness, m_dContrast, m_dHue, m_dSaturation);
+}
+
+void CPPageCasimir::OnCancel()
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ ((CMainFrame*)AfxGetMyApp()->GetMainWnd())->SetVMR9ColorControl(s.dBrightness, s.dContrast, s.dHue, s.dSaturation);
+ __super::OnCancel();
+}
diff --git a/src/apps/mplayerc/PPageCasimir.h b/src/apps/mplayerc/PPageCasimir.h
new file mode 100644
index 000000000..13d63c728
--- /dev/null
+++ b/src/apps/mplayerc/PPageCasimir.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+#include "afxcmn.h"
+
+// CPPageCasimir dialog
+
+class CPPageCasimir : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageCasimir)
+
+private:
+ CStringArray m_AudioRendererDisplayNames;
+
+ float m_dBrightness;
+ float m_dContrast;
+ float m_dHue;
+ float m_dSaturation;
+
+public:
+ CPPageCasimir();
+ virtual ~CPPageCasimir();
+
+// Dialog Data
+ enum { IDD = IDD_PPAGECASIMIR };
+ BOOL m_fMonitorAutoRefreshRate;
+ BOOL m_fD3DFullscreen;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+
+ CSliderCtrl m_SliContrast;
+ CSliderCtrl m_SliBrightness;
+ CSliderCtrl m_SliHue;
+ CSliderCtrl m_SliSaturation;
+ afx_msg void OnBnClickedReset();
+ BOOL m_fRememberDVDPos;
+ BOOL m_fRememberFilePos;
+ virtual void OnCancel();
+};
diff --git a/src/apps/mplayerc/PPageDVD.cpp b/src/apps/mplayerc/PPageDVD.cpp
new file mode 100644
index 000000000..e0813b539
--- /dev/null
+++ b/src/apps/mplayerc/PPageDVD.cpp
@@ -0,0 +1,329 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageDVD.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageDVD.h"
+
+struct
+{
+ LCID lcid;
+ TCHAR name[64];
+}
+LCIDNameList[] =
+{
+ {0x0000, _T("Default")},
+ {0x0436, _T("Afrikaans")},
+ {0x041c, _T("Albanian")},
+ {0x0401, _T("Arabic (Saudi Arabia)")},
+ {0x0801, _T("Arabic (Iraq)")},
+ {0x0c01, _T("Arabic (Egypt)")},
+ {0x1001, _T("Arabic (Libya)")},
+ {0x1401, _T("Arabic (Algeria)")},
+ {0x1801, _T("Arabic (Morocco)")},
+ {0x1c01, _T("Arabic (Tunisia)")},
+ {0x2001, _T("Arabic (Oman)")},
+ {0x2401, _T("Arabic (Yemen)")},
+ {0x2801, _T("Arabic (Syria)")},
+ {0x2c01, _T("Arabic (Jordan)")},
+ {0x3001, _T("Arabic (Lebanon)")},
+ {0x3401, _T("Arabic (Kuwait)")},
+ {0x3801, _T("Arabic (U.A.E.)")},
+ {0x3c01, _T("Arabic (Bahrain)")},
+ {0x4001, _T("Arabic (Qatar)")},
+ {0x042b, _T("Armenian")},
+ {0x042c, _T("Azeri (Latin)")},
+ {0x082c, _T("Azeri (Cyrillic)")},
+ {0x042d, _T("Basque")},
+ {0x0423, _T("Belarusian")},
+ {0x0402, _T("Bulgarian")},
+ {0x0455, _T("Burmese")},
+ {0x0403, _T("Catalan")},
+ {0x0404, _T("Chinese (Taiwan)")},
+ {0x0804, _T("Chinese (PRC)")},
+ {0x0c04, _T("Chinese (Hong Kong SAR, PRC)")},
+ {0x1004, _T("Chinese (Singapore)")},
+ {0x1404, _T("Chinese (Macau SAR)")},
+ {0x041a, _T("Croatian")},
+ {0x0405, _T("Czech")},
+ {0x0406, _T("Danish")},
+ {0x0465, _T("Divehi")},
+ {0x0413, _T("Dutch (Netherlands)")},
+ {0x0813, _T("Dutch (Belgium)")},
+ {0x0409, _T("English (United States)")},
+ {0x0809, _T("English (United Kingdom)")},
+ {0x0c09, _T("English (Australian)")},
+ {0x1009, _T("English (Canadian)")},
+ {0x1409, _T("English (New Zealand)")},
+ {0x1809, _T("English (Ireland)")},
+ {0x1c09, _T("English (South Africa)")},
+ {0x2009, _T("English (Jamaica)")},
+ {0x2409, _T("English (Caribbean)")},
+ {0x2809, _T("English (Belize)")},
+ {0x2c09, _T("English (Trinidad)")},
+ {0x3009, _T("English (Zimbabwe)")},
+ {0x3409, _T("English (Philippines)")},
+ {0x0425, _T("Estonian")},
+ {0x0438, _T("Faeroese")},
+ {0x0429, _T("Farsi")},
+ {0x040b, _T("Finnish")},
+ {0x040c, _T("French (Standard)")},
+ {0x080c, _T("French (Belgian)")},
+ {0x0c0c, _T("French (Canadian)")},
+ {0x100c, _T("French (Switzerland)")},
+ {0x140c, _T("French (Luxembourg)")},
+ {0x180c, _T("French (Monaco)")},
+ {0x0456, _T("Galician")},
+ {0x0437, _T("Georgian")},
+ {0x0407, _T("German (Standard)")},
+ {0x0807, _T("German (Switzerland)")},
+ {0x0c07, _T("German (Austria)")},
+ {0x1007, _T("German (Luxembourg)")},
+ {0x1407, _T("German (Liechtenstein)")},
+ {0x0408, _T("Greek")},
+ {0x0447, _T("Gujarati")},
+ {0x040d, _T("Hebrew")},
+ {0x0439, _T("Hindi")},
+ {0x040e, _T("Hungarian")},
+ {0x040f, _T("Icelandic")},
+ {0x0421, _T("Indonesian")},
+ {0x0410, _T("Italian (Standard)")},
+ {0x0810, _T("Italian (Switzerland)")},
+ {0x0411, _T("Japanese")},
+ {0x044b, _T("Kannada")},
+ {0x0457, _T("Konkani")},
+ {0x0412, _T("Korean")},
+ {0x0812, _T("Korean (Johab)")},
+ {0x0440, _T("Kyrgyz")},
+ {0x0426, _T("Latvian")},
+ {0x0427, _T("Lithuanian")},
+ {0x0827, _T("Lithuanian (Classic)")},
+ {0x042f, _T("FYRO Macedonian")},
+ {0x043e, _T("Malay (Malaysian)")},
+ {0x083e, _T("Malay (Brunei Darussalam)")},
+ {0x044e, _T("Marathi")},
+ {0x0450, _T("Mongolian")},
+ {0x0414, _T("Norwegian (Bokmal)")},
+ {0x0814, _T("Norwegian (Nynorsk)")},
+ {0x0415, _T("Polish")},
+ {0x0416, _T("Portuguese (Brazil)")},
+ {0x0816, _T("Portuguese (Portugal)")},
+ {0x0446, _T("Punjabi")},
+ {0x0418, _T("Romanian")},
+ {0x0419, _T("Russian")},
+ {0x044f, _T("Sanskrit")},
+ {0x0c1a, _T("Serbian (Cyrillic)")},
+ {0x081a, _T("Serbian (Latin)")},
+ {0x041b, _T("Slovak")},
+ {0x0424, _T("Slovenian")},
+ {0x040a, _T("Spanish (Spain, Traditional Sort)")},
+ {0x080a, _T("Spanish (Mexican)")},
+ {0x0c0a, _T("Spanish (Spain, International Sort)")},
+ {0x100a, _T("Spanish (Guatemala)")},
+ {0x140a, _T("Spanish (Costa Rica)")},
+ {0x180a, _T("Spanish (Panama)")},
+ {0x1c0a, _T("Spanish (Dominican Republic)")},
+ {0x200a, _T("Spanish (Venezuela)")},
+ {0x240a, _T("Spanish (Colombia)")},
+ {0x280a, _T("Spanish (Peru)")},
+ {0x2c0a, _T("Spanish (Argentina)")},
+ {0x300a, _T("Spanish (Ecuador)")},
+ {0x340a, _T("Spanish (Chile)")},
+ {0x380a, _T("Spanish (Uruguay)")},
+ {0x3c0a, _T("Spanish (Paraguay)")},
+ {0x400a, _T("Spanish (Bolivia)")},
+ {0x440a, _T("Spanish (El Salvador)")},
+ {0x480a, _T("Spanish (Honduras)")},
+ {0x4c0a, _T("Spanish (Nicaragua)")},
+ {0x500a, _T("Spanish (Puerto Rico)")},
+ {0x0430, _T("Sutu")},
+ {0x0441, _T("Swahili (Kenya)")},
+ {0x041d, _T("Swedish")},
+ {0x081d, _T("Swedish (Finland)")},
+ {0x045a, _T("Syriac")},
+ {0x0449, _T("Tamil")},
+ {0x0444, _T("Tatar (Tatarstan)")},
+ {0x044a, _T("Telugu")},
+ {0x041e, _T("Thai")},
+ {0x041f, _T("Turkish")},
+ {0x0422, _T("Ukrainian")},
+ {0x0420, _T("Urdu (Pakistan)")},
+ {0x0820, _T("Urdu (India)")},
+ {0x0443, _T("Uzbek (Latin)")},
+ {0x0843, _T("Uzbek (Cyrillic)")},
+ {0x042a, _T("Vietnamese")}
+};
+
+
+// CPPageDVD dialog
+
+IMPLEMENT_DYNAMIC(CPPageDVD, CPPageBase)
+CPPageDVD::CPPageDVD()
+ : CPPageBase(CPPageDVD::IDD, CPPageDVD::IDD)
+ , m_iDVDLocation(0)
+ , m_iDVDLangType(0)
+ , m_dvdpath(_T(""))
+ , m_fAutoSpeakerConf(FALSE)
+{
+}
+
+CPPageDVD::~CPPageDVD()
+{
+}
+
+void CPPageDVD::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Radio(pDX, IDC_RADIO1, m_iDVDLocation);
+ DDX_Radio(pDX, IDC_RADIO3, m_iDVDLangType);
+ DDX_Control(pDX, IDC_LIST1, m_lcids);
+ DDX_Text(pDX, IDC_DVDPATH, m_dvdpath);
+ DDX_Control(pDX, IDC_DVDPATH, m_dvdpathctrl);
+ DDX_Control(pDX, IDC_BUTTON1, m_dvdpathselctrl);
+ DDX_Check(pDX, IDC_CHECK1, m_fAutoSpeakerConf);
+}
+
+void CPPageDVD::UpdateLCIDList()
+{
+ UpdateData();
+
+ LCID lcid = m_iDVDLangType == 0 ? m_idMenuLang
+ : m_iDVDLangType == 1 ? m_idAudioLang
+ : m_idSubtitlesLang;
+
+ for(int i = 0; i < m_lcids.GetCount(); i++)
+ {
+ if(m_lcids.GetItemData(i) == lcid)
+ {
+ m_lcids.SetCurSel(i);
+ m_lcids.SetTopIndex(i);
+ break;
+ }
+ }
+}
+
+BEGIN_MESSAGE_MAP(CPPageDVD, CPPageBase)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_CONTROL_RANGE(BN_CLICKED, IDC_RADIO3, IDC_RADIO5, OnBnClickedLangradio123)
+ ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
+ ON_UPDATE_COMMAND_UI(IDC_DVDPATH, OnUpdateDVDPath)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateDVDPath)
+END_MESSAGE_MAP()
+
+
+// CPPageDVD message handlers
+
+BOOL CPPageDVD::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_iDVDLocation = s.fUseDVDPath ? 1 : 0;
+ m_dvdpath = s.sDVDPath;
+ m_iDVDLangType = 0;
+
+ m_idMenuLang = s.idMenuLang;
+ m_idAudioLang = s.idAudioLang;
+ m_idSubtitlesLang = s.idSubtitlesLang;
+ m_fAutoSpeakerConf = s.fAutoSpeakerConf;
+
+ UpdateData(FALSE);
+
+ for(int i = 0; i < countof(LCIDNameList); i++)
+ {
+ m_lcids.AddString(LCIDNameList[i].name);
+ m_lcids.SetItemData(i, LCIDNameList[i].lcid);
+ }
+
+ UpdateLCIDList();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageDVD::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.sDVDPath = m_dvdpath;
+ s.fUseDVDPath = (m_iDVDLocation == 1);
+ s.idMenuLang = m_idMenuLang;
+ s.idAudioLang = m_idAudioLang;
+ s.idSubtitlesLang = m_idSubtitlesLang;
+ s.fAutoSpeakerConf = !!m_fAutoSpeakerConf;
+
+ return __super::OnApply();
+}
+
+void CPPageDVD::OnBnClickedButton1()
+{
+ TCHAR path[MAX_PATH];
+
+ BROWSEINFO bi;
+ bi.hwndOwner = m_hWnd;
+ bi.pidlRoot = NULL;
+ bi.pszDisplayName = path;
+ bi.lpszTitle = _T("Select the path for the DVD:");
+ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_VALIDATE | BIF_USENEWUI | BIF_NONEWFOLDERBUTTON;
+ bi.lpfn = NULL;
+ bi.lParam = 0;
+ bi.iImage = 0;
+
+ LPITEMIDLIST iil;
+ if(iil = SHBrowseForFolder(&bi))
+ {
+ SHGetPathFromIDList(iil, path);
+ m_dvdpath = path;
+
+ UpdateData(FALSE);
+
+ SetModified();
+ }
+}
+
+void CPPageDVD::OnBnClickedLangradio123(UINT nID)
+{
+ UpdateLCIDList();
+}
+
+void CPPageDVD::OnLbnSelchangeList1()
+{
+ LCID& lcid = m_iDVDLangType == 0 ? m_idMenuLang
+ : m_iDVDLangType == 1 ? m_idAudioLang
+ : m_idSubtitlesLang;
+
+ lcid = m_lcids.GetItemData(m_lcids.GetCurSel());
+
+ SetModified();
+}
+
+void CPPageDVD::OnUpdateDVDPath(CCmdUI* pCmdUI)
+{
+ UpdateData();
+
+ pCmdUI->Enable(m_iDVDLocation == 1);
+}
diff --git a/src/apps/mplayerc/PPageDVD.h b/src/apps/mplayerc/PPageDVD.h
new file mode 100644
index 000000000..8581a51c7
--- /dev/null
+++ b/src/apps/mplayerc/PPageDVD.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+
+// CPPageDVD dialog
+
+class CPPageDVD : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageDVD)
+
+private:
+ void UpdateLCIDList();
+
+public:
+ CPPageDVD();
+ virtual ~CPPageDVD();
+
+ CListBox m_lcids;
+ CString m_dvdpath;
+ CEdit m_dvdpathctrl;
+ CButton m_dvdpathselctrl;
+ int m_iDVDLocation;
+ int m_iDVDLangType;
+
+ LCID m_idMenuLang;
+ LCID m_idAudioLang;
+ LCID m_idSubtitlesLang;
+
+ BOOL m_fAutoSpeakerConf;
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEDVD};
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnBnClickedLangradio123(UINT nID);
+ afx_msg void OnLbnSelchangeList1();
+ afx_msg void OnUpdateDVDPath(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/PPageExternalFilters.cpp b/src/apps/mplayerc/PPageExternalFilters.cpp
new file mode 100644
index 000000000..6810bf0d9
--- /dev/null
+++ b/src/apps/mplayerc/PPageExternalFilters.cpp
@@ -0,0 +1,731 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageExternalFilters.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageExternalFilters.h"
+#include "ComPropertySheet.h"
+#include "RegFilterChooserDlg.h"
+#include "SelectMediaType.h"
+#include "FGFilter.h"
+#include "..\..\..\include\moreuuids.h"
+
+#include <initguid.h>
+#include <Dmoreg.h>
+
+// CPPageExternalFilters dialog
+
+IMPLEMENT_DYNAMIC(CPPageExternalFilters, CPPageBase)
+CPPageExternalFilters::CPPageExternalFilters()
+ : CPPageBase(CPPageExternalFilters::IDD, CPPageExternalFilters::IDD)
+ , m_iLoadType(FilterOverride::PREFERRED)
+ , m_pLastSelFilter(NULL)
+{
+}
+
+CPPageExternalFilters::~CPPageExternalFilters()
+{
+}
+
+void CPPageExternalFilters::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_filters);
+ DDX_Radio(pDX, IDC_RADIO1, m_iLoadType);
+ DDX_Control(pDX, IDC_EDIT1, m_dwMerit);
+ DDX_Control(pDX, IDC_TREE2, m_tree);
+}
+
+void CPPageExternalFilters::StepUp(CCheckListBox& list)
+{
+ int i = list.GetCurSel();
+ if(i < 1) return;
+
+ CString str;
+ list.GetText(i, str);
+ DWORD_PTR dwItemData = list.GetItemData(i);
+ int nCheck = list.GetCheck(i);
+ list.DeleteString(i);
+ i--;
+ list.InsertString(i, str);
+ list.SetItemData(i, dwItemData);
+ list.SetCheck(i, nCheck);
+ list.SetCurSel(i);
+}
+
+void CPPageExternalFilters::StepDown(CCheckListBox& list)
+{
+ int i = list.GetCurSel();
+ if(i < 0 || i >= list.GetCount()-1) return;
+
+ CString str;
+ list.GetText(i, str);
+ DWORD_PTR dwItemData = list.GetItemData(i);
+ int nCheck = list.GetCheck(i);
+ list.DeleteString(i);
+ i++;
+ list.InsertString(i, str);
+ list.SetItemData(i, dwItemData);
+ list.SetCheck(i, nCheck);
+ list.SetCurSel(i);
+}
+
+FilterOverride* CPPageExternalFilters::GetCurFilter()
+{
+ int i = m_filters.GetCurSel();
+ return i >= 0 ? (FilterOverride*)m_pFilters.GetAt((POSITION)m_filters.GetItemDataPtr(i)) : (FilterOverride*)NULL;
+}
+
+void CPPageExternalFilters::SetupMajorTypes(CAtlArray<GUID>& guids)
+{
+ guids.RemoveAll();
+ guids.Add(MEDIATYPE_NULL);
+ guids.Add(MEDIATYPE_Video);
+ guids.Add(MEDIATYPE_Audio);
+ guids.Add(MEDIATYPE_Text);
+ guids.Add(MEDIATYPE_Midi);
+ guids.Add(MEDIATYPE_Stream);
+ guids.Add(MEDIATYPE_Interleaved);
+ guids.Add(MEDIATYPE_File);
+ guids.Add(MEDIATYPE_ScriptCommand);
+ guids.Add(MEDIATYPE_AUXLine21Data);
+ guids.Add(MEDIATYPE_VBI);
+ guids.Add(MEDIATYPE_Timecode);
+ guids.Add(MEDIATYPE_LMRT);
+ guids.Add(MEDIATYPE_URL_STREAM);
+ guids.Add(MEDIATYPE_MPEG1SystemStream);
+ guids.Add(MEDIATYPE_AnalogVideo);
+ guids.Add(MEDIATYPE_AnalogAudio);
+ guids.Add(MEDIATYPE_MPEG2_PACK);
+ guids.Add(MEDIATYPE_MPEG2_PES);
+ guids.Add(MEDIATYPE_MPEG2_SECTIONS);
+ guids.Add(MEDIATYPE_DVD_ENCRYPTED_PACK);
+ guids.Add(MEDIATYPE_DVD_NAVIGATION);
+}
+
+void CPPageExternalFilters::SetupSubTypes(CAtlArray<GUID>& guids)
+{
+ guids.RemoveAll();
+ guids.Add(MEDIASUBTYPE_None);
+ guids.Add(MEDIASUBTYPE_CLPL);
+ guids.Add(MEDIASUBTYPE_YUYV);
+ guids.Add(MEDIASUBTYPE_IYUV);
+ guids.Add(MEDIASUBTYPE_YVU9);
+ guids.Add(MEDIASUBTYPE_Y411);
+ guids.Add(MEDIASUBTYPE_Y41P);
+ guids.Add(MEDIASUBTYPE_YUY2);
+ guids.Add(MEDIASUBTYPE_YVYU);
+ guids.Add(MEDIASUBTYPE_UYVY);
+ guids.Add(MEDIASUBTYPE_Y211);
+ guids.Add(MEDIASUBTYPE_CLJR);
+ guids.Add(MEDIASUBTYPE_IF09);
+ guids.Add(MEDIASUBTYPE_CPLA);
+ guids.Add(MEDIASUBTYPE_MJPG);
+ guids.Add(MEDIASUBTYPE_TVMJ);
+ guids.Add(MEDIASUBTYPE_WAKE);
+ guids.Add(MEDIASUBTYPE_CFCC);
+ guids.Add(MEDIASUBTYPE_IJPG);
+ guids.Add(MEDIASUBTYPE_Plum);
+ guids.Add(MEDIASUBTYPE_DVCS);
+ guids.Add(MEDIASUBTYPE_DVSD);
+ guids.Add(MEDIASUBTYPE_MDVF);
+ guids.Add(MEDIASUBTYPE_RGB1);
+ guids.Add(MEDIASUBTYPE_RGB4);
+ guids.Add(MEDIASUBTYPE_RGB8);
+ guids.Add(MEDIASUBTYPE_RGB565);
+ guids.Add(MEDIASUBTYPE_RGB555);
+ guids.Add(MEDIASUBTYPE_RGB24);
+ guids.Add(MEDIASUBTYPE_RGB32);
+ guids.Add(MEDIASUBTYPE_ARGB1555);
+ guids.Add(MEDIASUBTYPE_ARGB4444);
+ guids.Add(MEDIASUBTYPE_ARGB32);
+ guids.Add(MEDIASUBTYPE_A2R10G10B10);
+ guids.Add(MEDIASUBTYPE_A2B10G10R10);
+ guids.Add(MEDIASUBTYPE_AYUV);
+ guids.Add(MEDIASUBTYPE_AI44);
+ guids.Add(MEDIASUBTYPE_IA44);
+ guids.Add(MEDIASUBTYPE_RGB32_D3D_DX7_RT);
+ guids.Add(MEDIASUBTYPE_RGB16_D3D_DX7_RT);
+ guids.Add(MEDIASUBTYPE_ARGB32_D3D_DX7_RT);
+ guids.Add(MEDIASUBTYPE_ARGB4444_D3D_DX7_RT);
+ guids.Add(MEDIASUBTYPE_ARGB1555_D3D_DX7_RT);
+ guids.Add(MEDIASUBTYPE_RGB32_D3D_DX9_RT);
+ guids.Add(MEDIASUBTYPE_RGB16_D3D_DX9_RT);
+ guids.Add(MEDIASUBTYPE_ARGB32_D3D_DX9_RT);
+ guids.Add(MEDIASUBTYPE_ARGB4444_D3D_DX9_RT);
+ guids.Add(MEDIASUBTYPE_ARGB1555_D3D_DX9_RT);
+ guids.Add(MEDIASUBTYPE_YV12);
+ guids.Add(MEDIASUBTYPE_NV12);
+ guids.Add(MEDIASUBTYPE_IMC1);
+ guids.Add(MEDIASUBTYPE_IMC2);
+ guids.Add(MEDIASUBTYPE_IMC3);
+ guids.Add(MEDIASUBTYPE_IMC4);
+ guids.Add(MEDIASUBTYPE_S340);
+ guids.Add(MEDIASUBTYPE_S342);
+ guids.Add(MEDIASUBTYPE_Overlay);
+ guids.Add(MEDIASUBTYPE_MPEG1Packet);
+ guids.Add(MEDIASUBTYPE_MPEG1Payload);
+ guids.Add(MEDIASUBTYPE_MPEG1AudioPayload);
+ guids.Add(MEDIASUBTYPE_MPEG1System);
+ guids.Add(MEDIASUBTYPE_MPEG1VideoCD);
+ guids.Add(MEDIASUBTYPE_MPEG1Video);
+ guids.Add(MEDIASUBTYPE_MPEG1Audio);
+ guids.Add(MEDIASUBTYPE_Avi);
+ guids.Add(MEDIASUBTYPE_Asf);
+ guids.Add(MEDIASUBTYPE_QTMovie);
+ guids.Add(MEDIASUBTYPE_QTRpza);
+ guids.Add(MEDIASUBTYPE_QTSmc);
+ guids.Add(MEDIASUBTYPE_QTRle);
+ guids.Add(MEDIASUBTYPE_QTJpeg);
+ guids.Add(MEDIASUBTYPE_PCMAudio_Obsolete);
+ guids.Add(MEDIASUBTYPE_PCM);
+ guids.Add(MEDIASUBTYPE_WAVE);
+ guids.Add(MEDIASUBTYPE_AU);
+ guids.Add(MEDIASUBTYPE_AIFF);
+ guids.Add(MEDIASUBTYPE_dvsd);
+ guids.Add(MEDIASUBTYPE_dvhd);
+ guids.Add(MEDIASUBTYPE_dvsl);
+ guids.Add(MEDIASUBTYPE_dv25);
+ guids.Add(MEDIASUBTYPE_dv50);
+ guids.Add(MEDIASUBTYPE_dvh1);
+ guids.Add(MEDIASUBTYPE_Line21_BytePair);
+ guids.Add(MEDIASUBTYPE_Line21_GOPPacket);
+ guids.Add(MEDIASUBTYPE_Line21_VBIRawData);
+ guids.Add(MEDIASUBTYPE_TELETEXT);
+ guids.Add(MEDIASUBTYPE_DRM_Audio);
+ guids.Add(MEDIASUBTYPE_IEEE_FLOAT);
+ guids.Add(MEDIASUBTYPE_DOLBY_AC3_SPDIF);
+ guids.Add(MEDIASUBTYPE_RAW_SPORT);
+ guids.Add(MEDIASUBTYPE_SPDIF_TAG_241h);
+ guids.Add(MEDIASUBTYPE_DssVideo);
+ guids.Add(MEDIASUBTYPE_DssAudio);
+ guids.Add(MEDIASUBTYPE_VPVideo);
+ guids.Add(MEDIASUBTYPE_VPVBI);
+ guids.Add(MEDIASUBTYPE_ATSC_SI);
+ guids.Add(MEDIASUBTYPE_DVB_SI);
+ guids.Add(MEDIASUBTYPE_MPEG2DATA);
+ guids.Add(MEDIASUBTYPE_MPEG2_VIDEO);
+ guids.Add(MEDIASUBTYPE_MPEG2_PROGRAM);
+ guids.Add(MEDIASUBTYPE_MPEG2_TRANSPORT);
+ guids.Add(MEDIASUBTYPE_MPEG2_TRANSPORT_STRIDE);
+ guids.Add(MEDIASUBTYPE_MPEG2_AUDIO);
+ guids.Add(MEDIASUBTYPE_DOLBY_AC3);
+ guids.Add(MEDIASUBTYPE_DVD_SUBPICTURE);
+ guids.Add(MEDIASUBTYPE_DVD_LPCM_AUDIO);
+ guids.Add(MEDIASUBTYPE_DTS);
+ guids.Add(MEDIASUBTYPE_SDDS);
+ guids.Add(MEDIASUBTYPE_DVD_NAVIGATION_PCI);
+ guids.Add(MEDIASUBTYPE_DVD_NAVIGATION_DSI);
+ guids.Add(MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER);
+ guids.Add(MEDIASUBTYPE_I420);
+ guids.Add(MEDIASUBTYPE_WAVE_DOLBY_AC3);
+ guids.Add(MEDIASUBTYPE_WAVE_DTS);
+}
+
+BEGIN_MESSAGE_MAP(CPPageExternalFilters, CPPageBase)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateFilter)
+ ON_UPDATE_COMMAND_UI(IDC_RADIO1, OnUpdateFilter)
+ ON_UPDATE_COMMAND_UI(IDC_RADIO2, OnUpdateFilter)
+ ON_UPDATE_COMMAND_UI(IDC_RADIO3, OnUpdateFilter)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON3, OnUpdateFilterUp)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON4, OnUpdateFilterDown)
+ ON_UPDATE_COMMAND_UI(IDC_EDIT1, OnUpdateFilterMerit)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON5, OnUpdateFilter)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON6, OnUpdateSubType)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON7, OnUpdateDeleteType)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON8, OnUpdateFilter)
+ ON_BN_CLICKED(IDC_BUTTON1, OnAddRegistered)
+ ON_BN_CLICKED(IDC_BUTTON2, OnRemoveFilter)
+ ON_BN_CLICKED(IDC_BUTTON3, OnMoveFilterUp)
+ ON_BN_CLICKED(IDC_BUTTON4, OnMoveFilterDown)
+ ON_LBN_DBLCLK(IDC_LIST1, OnLbnDblclkFilter)
+ ON_BN_CLICKED(IDC_BUTTON5, OnAddMajorType)
+ ON_BN_CLICKED(IDC_BUTTON6, OnAddSubType)
+ ON_BN_CLICKED(IDC_BUTTON7, OnDeleteType)
+ ON_BN_CLICKED(IDC_BUTTON8, OnResetTypes)
+ ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
+ ON_BN_CLICKED(IDC_RADIO1, OnBnClickedRadio)
+ ON_BN_CLICKED(IDC_RADIO2, OnBnClickedRadio)
+ ON_BN_CLICKED(IDC_RADIO3, OnBnClickedRadio)
+ ON_EN_CHANGE(IDC_EDIT1, OnEnChangeEdit1)
+ ON_NOTIFY(NM_DBLCLK, IDC_TREE2, OnNMDblclkTree2)
+ ON_WM_DROPFILES()
+END_MESSAGE_MAP()
+
+
+// CPPageExternalFilters message handlers
+
+BOOL CPPageExternalFilters::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ DragAcceptFiles(TRUE);
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_pFilters.RemoveAll();
+
+ POSITION pos = s.filters.GetHeadPosition();
+ while(pos)
+ {
+ CAutoPtr<FilterOverride> f(new FilterOverride(s.filters.GetNext(pos)));
+
+ CString name(_T("<unknown>"));
+
+ if(f->type == FilterOverride::REGISTERED)
+ {
+ name = CFGFilterRegistry(f->dispname).GetName();
+ if(name.IsEmpty()) name = f->name + _T(" <not registered>");
+ }
+ else if(f->type == FilterOverride::EXTERNAL)
+ {
+ name = f->name;
+ if(f->fTemporary) name += _T(" <temporary>");
+ if(!CPath(MakeFullPath(f->path)).FileExists()) name += _T(" <not found!>");
+ }
+
+ int i = m_filters.AddString(name);
+ m_filters.SetCheck(i, f->fDisabled ? 0 : 1);
+ m_filters.SetItemDataPtr(i, m_pFilters.AddTail(f));
+ }
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageExternalFilters::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.filters.RemoveAll();
+
+ for(int i = 0; i < m_filters.GetCount(); i++)
+ {
+ if(POSITION pos = (POSITION)m_filters.GetItemData(i))
+ {
+ CAutoPtr<FilterOverride> f(new FilterOverride(m_pFilters.GetAt(pos)));
+ f->fDisabled = !m_filters.GetCheck(i);
+ s.filters.AddTail(f);
+ }
+ }
+
+ return __super::OnApply();
+}
+
+void CPPageExternalFilters::OnUpdateFilter(CCmdUI* pCmdUI)
+{
+ if(FilterOverride* f = GetCurFilter())
+ {
+ pCmdUI->Enable(!(pCmdUI->m_nID == IDC_RADIO2 && f->type == FilterOverride::EXTERNAL));
+ }
+ else
+ {
+ pCmdUI->Enable(FALSE);
+ }
+}
+
+void CPPageExternalFilters::OnUpdateFilterUp(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_filters.GetCurSel() > 0);
+}
+
+void CPPageExternalFilters::OnUpdateFilterDown(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_filters.GetCurSel() >= 0 && m_filters.GetCurSel() < m_filters.GetCount()-1);
+}
+
+void CPPageExternalFilters::OnUpdateFilterMerit(CCmdUI* pCmdUI)
+{
+ UpdateData();
+ pCmdUI->Enable(m_iLoadType == FilterOverride::MERIT);
+}
+
+void CPPageExternalFilters::OnUpdateSubType(CCmdUI* pCmdUI)
+{
+ HTREEITEM node = m_tree.GetSelectedItem();
+ pCmdUI->Enable(node != NULL && m_tree.GetItemData(node) == NULL);
+}
+
+void CPPageExternalFilters::OnUpdateDeleteType(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!!m_tree.GetSelectedItem());
+}
+
+void CPPageExternalFilters::OnAddRegistered()
+{
+ CRegFilterChooserDlg dlg(this);
+ if(dlg.DoModal() == IDOK)
+ {
+ while(!dlg.m_filters.IsEmpty())
+ {
+ if(FilterOverride* f = dlg.m_filters.RemoveHead())
+ {
+ CAutoPtr<FilterOverride> p(f);
+
+ CString name = f->name;
+
+ if(f->type == FilterOverride::EXTERNAL)
+ {
+ if(!CPath(MakeFullPath(f->path)).FileExists()) name += _T(" <not found!>");
+ }
+
+ int i = m_filters.AddString(name);
+ m_filters.SetItemDataPtr(i, m_pFilters.AddTail(p));
+ m_filters.SetCheck(i, 1);
+
+ if(dlg.m_filters.IsEmpty())
+ {
+ m_filters.SetCurSel(i);
+ OnLbnSelchangeList1();
+ }
+ }
+ }
+ }
+}
+
+void CPPageExternalFilters::OnRemoveFilter()
+{
+ int i = m_filters.GetCurSel();
+ m_pFilters.RemoveAt((POSITION)m_filters.GetItemDataPtr(i));
+ m_filters.DeleteString(i);
+ if(i >= m_filters.GetCount()) i--;
+ m_filters.SetCurSel(i);
+ OnLbnSelchangeList1();
+}
+
+void CPPageExternalFilters::OnMoveFilterUp()
+{
+ StepUp(m_filters);
+}
+
+void CPPageExternalFilters::OnMoveFilterDown()
+{
+ StepDown(m_filters);
+}
+
+void CPPageExternalFilters::OnLbnDblclkFilter()
+{
+ if(FilterOverride* f = GetCurFilter())
+ {
+ CComPtr<IBaseFilter> pBF;
+ CString name;
+
+ if(f->type == FilterOverride::REGISTERED)
+ {
+ CStringW namew;
+ if(CreateFilter(f->dispname, &pBF, namew))
+ name = namew;
+ }
+ else if(f->type == FilterOverride::EXTERNAL)
+ {
+ if(SUCCEEDED(LoadExternalFilter(f->path, f->clsid, &pBF)))
+ name = f->name;
+ }
+
+ if(CComQIPtr<ISpecifyPropertyPages> pSPP = pBF)
+ {
+ CComPropertySheet ps(name, this);
+ if(ps.AddPages(pSPP) > 0)
+ {
+ CComPtr<IFilterGraph> pFG;
+ if(SUCCEEDED(pFG.CoCreateInstance(CLSID_FilterGraph)))
+ pFG->AddFilter(pBF, L"");
+
+ ps.DoModal();
+ }
+ }
+ }
+}
+
+void CPPageExternalFilters::OnAddMajorType()
+{
+ FilterOverride* f = GetCurFilter();
+ if(!f) return;
+
+ CAtlArray<GUID> guids;
+ SetupMajorTypes(guids);
+
+ CSelectMediaType dlg(guids, MEDIATYPE_NULL, this);
+ if(dlg.DoModal() == IDOK)
+ {
+ POSITION pos = f->guids.GetHeadPosition();
+ while(pos)
+ {
+ if(f->guids.GetNext(pos) == dlg.m_guid) {AfxMessageBox(_T("Already on the list!")); return;}
+ f->guids.GetNext(pos);
+ }
+
+ f->guids.AddTail(dlg.m_guid);
+ pos = f->guids.GetTailPosition();
+ f->guids.AddTail(GUID_NULL);
+
+ CString major = GetMediaTypeName(dlg.m_guid);
+ CString sub = GetMediaTypeName(GUID_NULL);
+
+ HTREEITEM node = m_tree.InsertItem(major);
+ m_tree.SetItemData(node, NULL);
+
+ node = m_tree.InsertItem(sub, node);
+ m_tree.SetItemData(node, (DWORD_PTR)pos);
+ }
+}
+
+void CPPageExternalFilters::OnAddSubType()
+{
+ FilterOverride* f = GetCurFilter();
+ if(!f) return;
+
+ HTREEITEM node = m_tree.GetSelectedItem();
+ if(!node) return;
+
+ HTREEITEM child = m_tree.GetChildItem(node);
+ if(!child) return;
+
+ POSITION pos = (POSITION)m_tree.GetItemData(child);
+ GUID major = f->guids.GetAt(pos);
+
+ CAtlArray<GUID> guids;
+ SetupSubTypes(guids);
+
+ CSelectMediaType dlg(guids, MEDIASUBTYPE_NULL, this);
+ if(dlg.DoModal() == IDOK)
+ {
+ for(child = m_tree.GetChildItem(node); child; child = m_tree.GetNextSiblingItem(child))
+ {
+ pos = (POSITION)m_tree.GetItemData(child);
+ f->guids.GetNext(pos);
+ if(f->guids.GetAt(pos) == dlg.m_guid) {AfxMessageBox(_T("Already on the list!")); return;}
+ }
+
+ f->guids.AddTail(major);
+ pos = f->guids.GetTailPosition();
+ f->guids.AddTail(dlg.m_guid);
+
+ CString sub = GetMediaTypeName(dlg.m_guid);
+
+ node = m_tree.InsertItem(sub, node);
+ m_tree.SetItemData(node, (DWORD_PTR)pos);
+ }
+}
+
+void CPPageExternalFilters::OnDeleteType()
+{
+ if(FilterOverride* f = GetCurFilter())
+ {
+ HTREEITEM node = m_tree.GetSelectedItem();
+ if(!node) return;
+
+ POSITION pos = (POSITION)m_tree.GetItemData(node);
+
+ if(pos == NULL)
+ {
+ for(HTREEITEM child = m_tree.GetChildItem(node); child; child = m_tree.GetNextSiblingItem(child))
+ {
+ pos = (POSITION)m_tree.GetItemData(child);
+
+ POSITION pos1 = pos;
+ f->guids.GetNext(pos);
+ POSITION pos2 = pos;
+ f->guids.GetNext(pos);
+
+ f->guids.RemoveAt(pos1);
+ f->guids.RemoveAt(pos2);
+ }
+
+ m_tree.DeleteItem(node);
+ }
+ else
+ {
+ HTREEITEM parent = m_tree.GetParentItem(node);
+
+ POSITION pos1 = pos;
+ f->guids.GetNext(pos);
+ POSITION pos2 = pos;
+ f->guids.GetNext(pos);
+
+ m_tree.DeleteItem(node);
+
+ if(!m_tree.ItemHasChildren(parent))
+ {
+ f->guids.SetAt(pos2, GUID_NULL);
+ node = m_tree.InsertItem(GetMediaTypeName(GUID_NULL), parent);
+ m_tree.SetItemData(node, (DWORD_PTR)pos1);
+ }
+ else
+ {
+ f->guids.RemoveAt(pos1);
+ f->guids.RemoveAt(pos2);
+ }
+ }
+ }
+}
+
+void CPPageExternalFilters::OnResetTypes()
+{
+ if(FilterOverride* f = GetCurFilter())
+ {
+ f->guids.RemoveAll();
+ f->guids.AddTailList(&f->backup);
+
+ m_pLastSelFilter = NULL;
+ OnLbnSelchangeList1();
+ }
+}
+
+void CPPageExternalFilters::OnLbnSelchangeList1()
+{
+ if(FilterOverride* f = GetCurFilter())
+ {
+ if(m_pLastSelFilter == f) return;
+ m_pLastSelFilter = f;
+
+ m_iLoadType = f->iLoadType;
+ UpdateData(FALSE);
+ m_dwMerit = f->dwMerit;
+
+ HTREEITEM dummy_item = m_tree.InsertItem(_T(""), 0,0, NULL, TVI_FIRST);
+ if(dummy_item)
+ for(HTREEITEM item = m_tree.GetNextVisibleItem(dummy_item); item; item = m_tree.GetNextVisibleItem(dummy_item))
+ m_tree.DeleteItem(item);
+
+ CMapStringToPtr map;
+
+ POSITION pos = f->guids.GetHeadPosition();
+ while(pos)
+ {
+ POSITION tmp = pos;
+ CString major = GetMediaTypeName(f->guids.GetNext(pos));
+ CString sub = GetMediaTypeName(f->guids.GetNext(pos));
+
+ HTREEITEM node = NULL;
+
+ void* val = NULL;
+ if(map.Lookup(major, val)) node = (HTREEITEM)val;
+ else map[major] = node = m_tree.InsertItem(major);
+ m_tree.SetItemData(node, NULL);
+
+ node = m_tree.InsertItem(sub, node);
+ m_tree.SetItemData(node, (DWORD_PTR)tmp);
+ }
+
+ m_tree.DeleteItem(dummy_item);
+
+ for(HTREEITEM item = m_tree.GetFirstVisibleItem(); item; item = m_tree.GetNextVisibleItem(item))
+ m_tree.Expand(item, TVE_EXPAND);
+
+ m_tree.EnsureVisible(m_tree.GetRootItem());
+ }
+ else
+ {
+ m_pLastSelFilter = NULL;
+
+ m_iLoadType = FilterOverride::PREFERRED;
+ UpdateData(FALSE);
+ m_dwMerit = 0;
+
+ m_tree.DeleteAllItems();
+ }
+}
+
+void CPPageExternalFilters::OnBnClickedRadio()
+{
+ UpdateData();
+ if(FilterOverride* f = GetCurFilter())
+ f->iLoadType = m_iLoadType;
+}
+
+void CPPageExternalFilters::OnEnChangeEdit1()
+{
+ UpdateData();
+ if(FilterOverride* f = GetCurFilter())
+ {
+ DWORD dw;
+ if(m_dwMerit.GetDWORD(dw))
+ f->dwMerit = dw;
+ }
+}
+
+void CPPageExternalFilters::OnNMDblclkTree2(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ *pResult = 0;
+
+ if(FilterOverride* f = GetCurFilter())
+ {
+ HTREEITEM node = m_tree.GetSelectedItem();
+ if(!node) return;
+
+ POSITION pos = (POSITION)m_tree.GetItemData(node);
+ if(!pos) return;
+
+ f->guids.GetNext(pos);
+ if(!pos) return;
+
+ CAtlArray<GUID> guids;
+ SetupSubTypes(guids);
+
+ CSelectMediaType dlg(guids, f->guids.GetAt(pos), this);
+ if(dlg.DoModal() == IDOK)
+ {
+ f->guids.SetAt(pos, dlg.m_guid);
+ m_tree.SetItemText(node, GetMediaTypeName(dlg.m_guid));
+ }
+ }
+}
+
+void CPPageExternalFilters::OnDropFiles(HDROP hDropInfo)
+{
+ SetActiveWindow();
+
+ UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
+ for(UINT iFile = 0; iFile < nFiles; iFile++)
+ {
+ TCHAR szFileName[_MAX_PATH];
+ ::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);
+
+ CFilterMapper2 fm2(false);
+ fm2.Register(szFileName);
+
+ while(!fm2.m_filters.IsEmpty())
+ {
+ if(FilterOverride* f = fm2.m_filters.RemoveHead())
+ {
+ CAutoPtr<FilterOverride> p(f);
+ int i = m_filters.AddString(f->name);
+ m_filters.SetItemDataPtr(i, m_pFilters.AddTail(p));
+ m_filters.SetCheck(i, 1);
+
+ if(fm2.m_filters.IsEmpty())
+ {
+ m_filters.SetCurSel(i);
+ OnLbnSelchangeList1();
+ }
+ }
+ }
+ }
+ ::DragFinish(hDropInfo);
+}
diff --git a/src/apps/mplayerc/PPageExternalFilters.h b/src/apps/mplayerc/PPageExternalFilters.h
new file mode 100644
index 000000000..1fa3043dc
--- /dev/null
+++ b/src/apps/mplayerc/PPageExternalFilters.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "PPageBase.h"
+#include "floatedit.h"
+#include "mplayerc.h"
+
+// CPPageExternalFilters dialog
+
+class CPPageExternalFilters : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageExternalFilters)
+
+private:
+ void StepUp(CCheckListBox& list);
+ void StepDown(CCheckListBox& list);
+
+ CAutoPtrList<FilterOverride> m_pFilters;
+ FilterOverride* m_pLastSelFilter;
+ FilterOverride* GetCurFilter();
+
+ void SetupMajorTypes(CAtlArray<GUID>& guids);
+ void SetupSubTypes(CAtlArray<GUID>& guids);
+
+public:
+ CPPageExternalFilters();
+ virtual ~CPPageExternalFilters();
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEEXTERNALFILTERS };
+
+ CCheckListBox m_filters;
+ int m_iLoadType;
+ CHexEdit m_dwMerit;
+ CTreeCtrl m_tree;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnUpdateFilter(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateFilterUp(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateFilterDown(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateFilterMerit(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateSubType(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateDeleteType(CCmdUI* pCmdUI);
+ afx_msg void OnAddRegistered();
+ afx_msg void OnRemoveFilter();
+ afx_msg void OnMoveFilterUp();
+ afx_msg void OnMoveFilterDown();
+ afx_msg void OnLbnDblclkFilter();
+ afx_msg void OnAddMajorType();
+ afx_msg void OnAddSubType();
+ afx_msg void OnDeleteType();
+ afx_msg void OnResetTypes();
+ afx_msg void OnLbnSelchangeList1();
+ afx_msg void OnBnClickedRadio();
+ afx_msg void OnEnChangeEdit1();
+ afx_msg void OnNMDblclkTree2(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnDropFiles(HDROP hDropInfo);
+};
diff --git a/src/apps/mplayerc/PPageFileInfoClip.cpp b/src/apps/mplayerc/PPageFileInfoClip.cpp
new file mode 100644
index 000000000..da48375af
--- /dev/null
+++ b/src/apps/mplayerc/PPageFileInfoClip.cpp
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageFileInfoClip.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageFileInfoClip.h"
+#include <atlbase.h>
+#include <qnetwork.h>
+#include "..\..\DSUtil\DSUtil.h"
+
+// CPPageFileInfoClip dialog
+
+IMPLEMENT_DYNAMIC(CPPageFileInfoClip, CPropertyPage)
+CPPageFileInfoClip::CPPageFileInfoClip(CString fn, IFilterGraph* pFG)
+ : CPropertyPage(CPPageFileInfoClip::IDD, CPPageFileInfoClip::IDD)
+ , m_fn(fn)
+ , m_pFG(pFG)
+ , m_clip(_T("None"))
+ , m_author(_T("None"))
+ , m_copyright(_T("None"))
+ , m_rating(_T("None"))
+ , m_location(_T("None"))
+ , m_hIcon(NULL)
+{
+}
+
+CPPageFileInfoClip::~CPPageFileInfoClip()
+{
+ if(m_hIcon) DestroyIcon(m_hIcon);
+}
+
+void CPPageFileInfoClip::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_DEFAULTICON, m_icon);
+ DDX_Text(pDX, IDC_EDIT1, m_fn);
+ DDX_Text(pDX, IDC_EDIT4, m_clip);
+ DDX_Text(pDX, IDC_EDIT3, m_author);
+ DDX_Text(pDX, IDC_EDIT2, m_copyright);
+ DDX_Text(pDX, IDC_EDIT5, m_rating);
+ DDX_Text(pDX, IDC_EDIT6, m_location);
+ DDX_Control(pDX, IDC_EDIT7, m_desc);
+}
+
+BEGIN_MESSAGE_MAP(CPPageFileInfoClip, CPropertyPage)
+END_MESSAGE_MAP()
+
+
+// CPPageFileInfoClip message handlers
+
+BOOL CPPageFileInfoClip::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ if(m_hIcon = LoadIcon(m_fn, false))
+ m_icon.SetIcon(m_hIcon);
+
+ m_fn.TrimRight('/');
+ int i = max(m_fn.ReverseFind('\\'), m_fn.ReverseFind('/'));
+ if(i >= 0 && i < m_fn.GetLength()-1)
+ {
+ m_location = m_fn.Left(i);
+ m_fn = m_fn.Mid(i+1);
+
+ if(m_location.GetLength() == 2 && m_location[1] == ':')
+ m_location += '\\';
+ }
+
+ bool fEmpty = true;
+ BeginEnumFilters(m_pFG, pEF, pBF)
+ {
+ if(CComQIPtr<IAMMediaContent, &IID_IAMMediaContent> pAMMC = pBF)
+ {
+ CComBSTR bstr;
+ if(SUCCEEDED(pAMMC->get_Title(&bstr)) && wcslen(bstr.m_str) > 0) {m_clip = bstr.m_str; fEmpty = false;}
+ if(SUCCEEDED(pAMMC->get_AuthorName(&bstr)) && wcslen(bstr.m_str) > 0) {m_author = bstr.m_str; fEmpty = false;}
+ if(SUCCEEDED(pAMMC->get_Copyright(&bstr)) && wcslen(bstr.m_str) > 0) {m_copyright = bstr.m_str; fEmpty = false;}
+ if(SUCCEEDED(pAMMC->get_Rating(&bstr)) && wcslen(bstr.m_str) > 0) {m_rating = bstr.m_str; fEmpty = false;}
+ if(SUCCEEDED(pAMMC->get_Description(&bstr)) && wcslen(bstr.m_str) > 0) {m_desc.SetWindowText(CString(bstr.m_str)); fEmpty = false;}
+ if(!fEmpty) break;
+ }
+ }
+ EndEnumFilters
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
diff --git a/src/apps/mplayerc/PPageFileInfoClip.h b/src/apps/mplayerc/PPageFileInfoClip.h
new file mode 100644
index 000000000..4cff6be86
--- /dev/null
+++ b/src/apps/mplayerc/PPageFileInfoClip.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxwin.h"
+
+// CPPageFileInfoClip dialog
+
+class CPPageFileInfoClip : public CPropertyPage
+{
+ DECLARE_DYNAMIC(CPPageFileInfoClip)
+
+private:
+ CComPtr<IFilterGraph> m_pFG;
+ HICON m_hIcon;
+
+public:
+ CPPageFileInfoClip(CString fn, IFilterGraph* pFG);
+ virtual ~CPPageFileInfoClip();
+
+// Dialog Data
+ enum { IDD = IDD_FILEPROPCLIP };
+
+ CStatic m_icon;
+ CString m_fn;
+ CString m_clip;
+ CString m_author;
+ CString m_copyright;
+ CString m_rating;
+ CString m_location;
+ CEdit m_desc;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+};
diff --git a/src/apps/mplayerc/PPageFileInfoDetails.cpp b/src/apps/mplayerc/PPageFileInfoDetails.cpp
new file mode 100644
index 000000000..4067bb3b0
--- /dev/null
+++ b/src/apps/mplayerc/PPageFileInfoDetails.cpp
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageFileInfoDetails.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageFileInfoDetails.h"
+#include <atlbase.h>
+#include "..\..\DSUtil\DSUtil.h"
+#include "d3d9.h"
+#include "Vmr9.h"
+#include "..\..\..\include\moreuuids.h"
+
+// CPPageFileInfoDetails dialog
+
+IMPLEMENT_DYNAMIC(CPPageFileInfoDetails, CPropertyPage)
+CPPageFileInfoDetails::CPPageFileInfoDetails(CString fn, IFilterGraph* pFG, ISubPicAllocatorPresenter* pCAP)
+ : CPropertyPage(CPPageFileInfoDetails::IDD, CPPageFileInfoDetails::IDD)
+ , m_fn(fn)
+ , m_pFG(pFG)
+ , m_pCAP(pCAP)
+ , m_hIcon(NULL)
+ , m_type(_T("Not known"))
+ , m_size(_T("Not known"))
+ , m_time(_T("Not known"))
+ , m_res(_T("Not known"))
+ , m_created(_T("Not known"))
+{
+}
+
+CPPageFileInfoDetails::~CPPageFileInfoDetails()
+{
+ if(m_hIcon) DestroyIcon(m_hIcon);
+}
+
+void CPPageFileInfoDetails::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_DEFAULTICON, m_icon);
+ DDX_Text(pDX, IDC_EDIT1, m_fn);
+ DDX_Text(pDX, IDC_EDIT4, m_type);
+ DDX_Text(pDX, IDC_EDIT3, m_size);
+ DDX_Text(pDX, IDC_EDIT2, m_time);
+ DDX_Text(pDX, IDC_EDIT5, m_res);
+ DDX_Text(pDX, IDC_EDIT6, m_created);
+ DDX_Control(pDX, IDC_EDIT7, m_encoding);
+}
+
+BEGIN_MESSAGE_MAP(CPPageFileInfoDetails, CPropertyPage)
+END_MESSAGE_MAP()
+
+inline int LNKO(int a, int b)
+{
+ if(a == 0 || b == 0)
+ return(1);
+
+ while(a != b)
+ {
+ if(a < b) b -= a;
+ else if(a > b) a -= b;
+ }
+
+ return(a);
+}
+
+// CPPageFileInfoDetails message handlers
+
+static bool GetProperty(IFilterGraph* pFG, LPCOLESTR propName, VARIANT* vt)
+{
+ BeginEnumFilters(pFG, pEF, pBF)
+ {
+ if(CComQIPtr<IPropertyBag> pPB = pBF)
+ if(SUCCEEDED(pPB->Read(propName, vt, NULL)))
+ return true;
+ }
+ EndEnumFilters
+
+ return false;
+}
+
+static CString FormatDateTime(FILETIME tm)
+{
+ SYSTEMTIME t;
+ FileTimeToSystemTime(&tm, &t);
+ TCHAR buff[256];
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &t, NULL, buff, 256);
+ CString ret(buff);
+ ret += _T(" ");
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &t, NULL, buff, 256);
+ ret += buff;
+ return ret;
+}
+
+BOOL CPPageFileInfoDetails::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ CString ext = m_fn.Left(m_fn.Find(_T("://"))+1).TrimRight(':');
+ if(ext.IsEmpty() || !ext.CompareNoCase(_T("file")))
+ ext = _T(".") + m_fn.Mid(m_fn.ReverseFind('.')+1);
+
+ if(m_hIcon = LoadIcon(m_fn, false))
+ m_icon.SetIcon(m_hIcon);
+
+ if(!LoadType(ext, m_type))
+ m_type = _T("Not known");
+
+ CComVariant vt;
+ if(::GetProperty(m_pFG, L"CurFile.TimeCreated", &vt))
+ {
+ if(V_VT(&vt) == VT_UI8)
+ {
+ ULARGE_INTEGER uli;
+ uli.QuadPart = V_UI8(&vt);
+
+ FILETIME ft;
+ ft.dwLowDateTime = uli.LowPart;
+ ft.dwHighDateTime = uli.HighPart;
+
+ m_created = FormatDateTime(ft);
+ }
+ }
+
+ WIN32_FIND_DATA wfd;
+ HANDLE hFind = FindFirstFile(m_fn, &wfd);
+ if(hFind != INVALID_HANDLE_VALUE)
+ {
+ FindClose(hFind);
+
+ __int64 size = (__int64(wfd.nFileSizeHigh)<<32)|wfd.nFileSizeLow;
+ __int64 shortsize = size;
+ CString measure = _T("B");
+ if(shortsize > 10240) shortsize /= 1024, measure = _T("KB");
+ if(shortsize > 10240) shortsize /= 1024, measure = _T("MB");
+ if(shortsize > 10240) shortsize /= 1024, measure = _T("GB");
+ m_size.Format(_T("%I64d%s (%I64d bytes)"), shortsize, measure, size);
+
+ if(m_created.IsEmpty())
+ {
+ m_created = FormatDateTime(wfd.ftCreationTime);
+ }
+ }
+
+ REFERENCE_TIME rtDur = 0;
+ CComQIPtr<IMediaSeeking> pMS = m_pFG;
+ if(pMS && SUCCEEDED(pMS->GetDuration(&rtDur)) && rtDur > 0)
+ {
+ m_time.Format(_T("%02d:%02d:%02d"),
+ int(rtDur/10000000/60/60),
+ int((rtDur/10000000/60)%60),
+ int((rtDur/10000000)%60));
+ }
+
+ CSize wh(0, 0), arxy(0, 0);
+ long fps = 0;
+
+ if(m_pCAP)
+ {
+ wh = m_pCAP->GetVideoSize(false);
+ arxy = m_pCAP->GetVideoSize(true);
+ }
+ else
+ {
+ if(CComQIPtr<IBasicVideo> pBV = m_pFG)
+ {
+ if(SUCCEEDED(pBV->GetVideoSize(&wh.cx, &wh.cy)))
+ {
+ if(CComQIPtr<IBasicVideo2> pBV2 = m_pFG)
+ pBV2->GetPreferredAspectRatio(&arxy.cx, &arxy.cy);
+ }
+ else
+ {
+ wh.SetSize(0, 0);
+ }
+ }
+
+ if(wh.cx == 0 && wh.cy == 0)
+ {
+ BeginEnumFilters(m_pFG, pEF, pBF)
+ {
+ if(CComQIPtr<IBasicVideo> pBV = pBF)
+ {
+ pBV->GetVideoSize(&wh.cx, &wh.cy);
+ if(CComQIPtr<IBasicVideo2> pBV2 = pBF)
+ pBV2->GetPreferredAspectRatio(&arxy.cx, &arxy.cy);
+ break;
+ }
+ else if(CComQIPtr<IVMRWindowlessControl> pWC = pBF)
+ {
+ pWC->GetNativeVideoSize(&wh.cx, &wh.cy, &arxy.cx, &arxy.cy);
+ break;
+ }
+ else if(CComQIPtr<IVMRWindowlessControl9> pWC = pBF)
+ {
+ pWC->GetNativeVideoSize(&wh.cx, &wh.cy, &arxy.cx, &arxy.cy);
+ break;
+ }
+ }
+ EndEnumFilters
+ }
+ }
+
+ if(wh.cx > 0 && wh.cy > 0)
+ {
+ m_res.Format(_T("%d x %d"), wh.cx, wh.cy);
+
+ int lnko = 0;
+ do
+ {
+ lnko = LNKO(arxy.cx, arxy.cy);
+ if(lnko > 1) arxy.cx /= lnko, arxy.cy /= lnko;
+ }
+ while(lnko > 1);
+
+ if(arxy.cx > 0 && arxy.cy > 0 && arxy.cx*wh.cy != arxy.cy*wh.cx)
+ {
+ CString ar;
+ ar.Format(_T(" (AR %d:%d)"), arxy.cx, arxy.cy);
+ m_res += ar;
+ }
+ }
+
+ m_fn.TrimRight('/');
+ m_fn.Replace('\\', '/');
+ m_fn = m_fn.Mid(m_fn.ReverseFind('/')+1);
+
+ UpdateData(FALSE);
+
+ InitEncoding();
+
+ m_pFG = NULL;
+ m_pCAP = NULL;
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CPPageFileInfoDetails::InitEncoding()
+{
+ CAtlList<CString> sl;
+
+ BeginEnumFilters(m_pFG, pEF, pBF)
+ {
+ CComPtr<IBaseFilter> pUSBF = GetUpStreamFilter(pBF);
+
+ if(GetCLSID(pBF) == CLSID_NetShowSource)
+ {
+ continue;
+ }
+ else if(GetCLSID(pUSBF) != CLSID_NetShowSource)
+ {
+ if(IPin* pPin = GetFirstPin(pBF, PINDIR_INPUT))
+ {
+ CMediaType mt;
+ if(FAILED(pPin->ConnectionMediaType(&mt)) || mt.majortype != MEDIATYPE_Stream)
+ continue;
+ }
+
+ if(IPin* pPin = GetFirstPin(pBF, PINDIR_OUTPUT))
+ {
+ CMediaType mt;
+ if(SUCCEEDED(pPin->ConnectionMediaType(&mt)) && mt.majortype == MEDIATYPE_Stream)
+ continue;
+ }
+ }
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ CMediaTypeEx mt;
+ PIN_DIRECTION dir;
+ if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT
+ || FAILED(pPin->ConnectionMediaType(&mt)))
+ continue;
+
+ CString str = mt.ToString();
+
+ if(!str.IsEmpty())
+ {
+ sl.AddTail(mt.ToString() + CString(L" [" + GetPinName(pPin) + L"]"));
+ }
+ }
+ EndEnumPins
+ }
+ EndEnumFilters
+
+ CString text = Implode(sl, '\n');
+ text.Replace(_T("\n"), _T("\r\n"));
+ m_encoding.SetWindowText(text);
+}
diff --git a/src/apps/mplayerc/PPageFileInfoDetails.h b/src/apps/mplayerc/PPageFileInfoDetails.h
new file mode 100644
index 000000000..8950ee067
--- /dev/null
+++ b/src/apps/mplayerc/PPageFileInfoDetails.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "..\..\subpic\ISubPic.h"
+#include "afxwin.h"
+
+// CPPageFileInfoDetails dialog
+
+class CPPageFileInfoDetails : public CPropertyPage
+{
+ DECLARE_DYNAMIC(CPPageFileInfoDetails)
+
+private:
+ CComPtr<IFilterGraph> m_pFG;
+ CComPtr<ISubPicAllocatorPresenter> m_pCAP;
+
+ HICON m_hIcon;
+
+ void InitEncoding();
+
+public:
+ CPPageFileInfoDetails(CString fn, IFilterGraph* pFG, ISubPicAllocatorPresenter* pCAP);
+ virtual ~CPPageFileInfoDetails();
+
+// Dialog Data
+ enum { IDD = IDD_FILEPROPDETAILS };
+
+ CStatic m_icon;
+ CString m_fn;
+ CString m_type;
+ CString m_size;
+ CString m_time;
+ CString m_res;
+ CString m_created;
+ CEdit m_encoding;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+};
diff --git a/src/apps/mplayerc/PPageFileInfoRes.cpp b/src/apps/mplayerc/PPageFileInfoRes.cpp
new file mode 100644
index 000000000..43a747dd9
--- /dev/null
+++ b/src/apps/mplayerc/PPageFileInfoRes.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageFileInfoRes.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageFileInfoRes.h"
+#include ".\ppagefileinfores.h"
+
+// CPPageFileInfoRes dialog
+
+IMPLEMENT_DYNAMIC(CPPageFileInfoRes, CPPageBase)
+CPPageFileInfoRes::CPPageFileInfoRes(CString fn, IFilterGraph* pFG)
+ : CPPageBase(CPPageFileInfoRes::IDD, CPPageFileInfoRes::IDD)
+ , m_fn(fn)
+ , m_hIcon(NULL)
+ , m_pFG(pFG)
+{
+}
+
+CPPageFileInfoRes::~CPPageFileInfoRes()
+{
+ if(m_hIcon) DestroyIcon(m_hIcon);
+}
+
+void CPPageFileInfoRes::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_DEFAULTICON, m_icon);
+ DDX_Text(pDX, IDC_EDIT1, m_fn);
+ DDX_Control(pDX, IDC_LIST1, m_list);
+}
+
+BEGIN_MESSAGE_MAP(CPPageFileInfoRes, CPPageBase)
+ ON_BN_CLICKED(IDC_BUTTON1, OnSaveAs)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateSaveAs)
+ ON_NOTIFY(NM_DBLCLK, IDC_LIST1, OnNMDblclkList1)
+END_MESSAGE_MAP()
+
+// CPPageFileInfoRes message handlers
+
+BOOL CPPageFileInfoRes::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ if(m_hIcon = LoadIcon(m_fn, false))
+ m_icon.SetIcon(m_hIcon);
+
+ m_fn.TrimRight('/');
+ int i = max(m_fn.ReverseFind('\\'), m_fn.ReverseFind('/'));
+ if(i >= 0 && i < m_fn.GetLength()-1)
+ m_fn = m_fn.Mid(i+1);
+
+ m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
+
+ m_list.InsertColumn(0, _T("Name"), LVCFMT_LEFT, 187);
+ m_list.InsertColumn(1, _T("Mime Type"), LVCFMT_LEFT, 127);
+
+ BeginEnumFilters(m_pFG, pEF, pBF)
+ {
+ if(CComQIPtr<IDSMResourceBag> pRB = pBF)
+ if(pRB && pRB->ResGetCount() > 0)
+ {
+ for(DWORD i = 0; i < pRB->ResGetCount(); i++)
+ {
+ CComBSTR name, desc, mime;
+ BYTE* pData = NULL;
+ DWORD len = 0;
+ if(SUCCEEDED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL)))
+ {
+ CDSMResource r;
+ r.name = name;
+ r.desc = desc;
+ r.mime = mime;
+ r.data.SetCount(len);
+ memcpy(r.data.GetData(), pData, r.data.GetCount());
+ CoTaskMemFree(pData);
+ POSITION pos = m_res.AddTail(r);
+ int iItem = m_list.InsertItem(m_list.GetItemCount(), CString(name));
+ m_list.SetItemText(iItem, 1, CString(mime));
+ m_list.SetItemData(iItem, (DWORD_PTR)pos);
+ }
+ }
+ }
+ }
+ EndEnumFilters
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CPPageFileInfoRes::OnSaveAs()
+{
+ int i = m_list.GetSelectionMark();
+ if(i < 0) return;
+
+ CDSMResource& r = m_res.GetAt((POSITION)m_list.GetItemData(i));
+
+ CFileDialog fd(FALSE, NULL, CString(r.name),
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
+ _T("All files|*.*||"), this, 0);
+ if(fd.DoModal() == IDOK)
+ {
+ if(FILE* f = _tfopen(fd.GetPathName(), _T("wb")))
+ {
+ fwrite(r.data.GetData(), 1, r.data.GetCount(), f);
+ fclose(f);
+ }
+ }
+}
+
+void CPPageFileInfoRes::OnUpdateSaveAs(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_list.GetSelectedCount());
+}
+
+void CPPageFileInfoRes::OnNMDblclkList1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ int i = m_list.GetSelectionMark();
+ if(i < 0) return;
+
+ CDSMResource& r = m_res.GetAt((POSITION)m_list.GetItemData(i));
+
+ CString url;
+ url.Format(_T("http://localhost:%d/convres.html?id=%x"), AfxGetAppSettings().nWebServerPort, (DWORD)&r);
+ ShellExecute(NULL, _T("open"), url, NULL, NULL, SW_SHOWDEFAULT);
+
+ *pResult = 0;
+}
diff --git a/src/apps/mplayerc/PPageFileInfoRes.h b/src/apps/mplayerc/PPageFileInfoRes.h
new file mode 100644
index 000000000..030d73fb2
--- /dev/null
+++ b/src/apps/mplayerc/PPageFileInfoRes.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxwin.h"
+#include "afxcmn.h"
+#include "..\..\DSUtil\DSMPropertyBag.h"
+#include "PPageBase.h"
+
+// CPPageFileInfoRes dialog
+
+class CPPageFileInfoRes : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageFileInfoRes)
+
+private:
+ CComPtr<IFilterGraph> m_pFG;
+ HICON m_hIcon;
+ CAtlList<CDSMResource> m_res;
+
+public:
+ CPPageFileInfoRes(CString fn, IFilterGraph* pFG); // standard constructor
+ virtual ~CPPageFileInfoRes();
+
+// Dialog Data
+ enum { IDD = IDD_FILEPROPRES };
+
+ CStatic m_icon;
+ CString m_fn;
+ CListCtrl m_list;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnSaveAs();
+ afx_msg void OnUpdateSaveAs(CCmdUI* pCmdUI);
+ afx_msg void OnNMDblclkList1(NMHDR *pNMHDR, LRESULT *pResult);
+};
diff --git a/src/apps/mplayerc/PPageFileInfoSheet.cpp b/src/apps/mplayerc/PPageFileInfoSheet.cpp
new file mode 100644
index 000000000..90495d2f0
--- /dev/null
+++ b/src/apps/mplayerc/PPageFileInfoSheet.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageFileInfoSheet.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPageFileInfoSheet.h"
+
+// CPPageFileInfoSheet
+
+IMPLEMENT_DYNAMIC(CPPageFileInfoSheet, CPropertySheet)
+CPPageFileInfoSheet::CPPageFileInfoSheet(CString fn, CMainFrame* pParentWnd)
+ : CPropertySheet(ResStr(IDS_PROPSHEET_PROPERTIES), pParentWnd, 0)
+ , m_clip(fn, pParentWnd->pGB)
+ , m_details(fn, pParentWnd->pGB, pParentWnd->m_pCAP)
+ , m_res(fn, pParentWnd->pGB)
+{
+ AddPage(&m_clip);
+ AddPage(&m_details);
+
+ BeginEnumFilters(pParentWnd->pGB, pEF, pBF)
+ {
+ if(CComQIPtr<IDSMResourceBag> pRB = pBF)
+ if(pRB && pRB->ResGetCount() > 0)
+ {
+ AddPage(&m_res);
+ break;
+ }
+ }
+ EndEnumFilters
+}
+
+CPPageFileInfoSheet::~CPPageFileInfoSheet()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CPPageFileInfoSheet, CPropertySheet)
+END_MESSAGE_MAP()
+
+// CPPageFileInfoSheet message handlers
+
+BOOL CPPageFileInfoSheet::OnInitDialog()
+{
+ BOOL fRet = __super::OnInitDialog();
+
+ GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);
+ GetDlgItem(ID_APPLY_NOW)->ShowWindow(SW_HIDE);
+ GetDlgItem(IDOK)->SetWindowText(_T("Close"));
+
+ CRect r;
+ GetDlgItem(ID_APPLY_NOW)->GetWindowRect(&r);
+ ScreenToClient(r);
+ GetDlgItem(IDOK)->MoveWindow(r);
+
+ return fRet;
+}
+
diff --git a/src/apps/mplayerc/PPageFileInfoSheet.h b/src/apps/mplayerc/PPageFileInfoSheet.h
new file mode 100644
index 000000000..1a80ecad5
--- /dev/null
+++ b/src/apps/mplayerc/PPageFileInfoSheet.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageFileInfoClip.h"
+#include "PPageFileInfoDetails.h"
+#include "PPageFileInfoRes.h"
+
+class CMainFrame;
+
+// CPPageFileInfoSheet
+
+class CPPageFileInfoSheet : public CPropertySheet
+{
+ DECLARE_DYNAMIC(CPPageFileInfoSheet)
+
+private:
+ CPPageFileInfoClip m_clip;
+ CPPageFileInfoDetails m_details;
+ CPPageFileInfoRes m_res;
+
+public:
+ CPPageFileInfoSheet(CString fn, CMainFrame* pParentWnd);
+ virtual ~CPPageFileInfoSheet();
+
+protected:
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+};
+
+
diff --git a/src/apps/mplayerc/PPageFormats.cpp b/src/apps/mplayerc/PPageFormats.cpp
new file mode 100644
index 000000000..847fe4644
--- /dev/null
+++ b/src/apps/mplayerc/PPageFormats.cpp
@@ -0,0 +1,767 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageFormats.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageFormats.h"
+
+// CPPageFormats dialog
+
+IMPLEMENT_DYNAMIC(CPPageFormats, CPPageBase)
+CPPageFormats::CPPageFormats()
+ : CPPageBase(CPPageFormats::IDD, CPPageFormats::IDD)
+ , m_list(0)
+ , m_exts(_T(""))
+ , m_iRtspHandler(0)
+ , m_fRtspFileExtFirst(FALSE)
+{
+}
+
+CPPageFormats::~CPPageFormats()
+{
+}
+
+void CPPageFormats::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_list);
+ DDX_Text(pDX, IDC_EDIT1, m_exts);
+ DDX_Control(pDX, IDC_STATIC1, m_autoplay);
+ DDX_Control(pDX, IDC_CHECK1, m_apvideo);
+ DDX_Control(pDX, IDC_CHECK2, m_apmusic);
+ DDX_Control(pDX, IDC_CHECK3, m_apaudiocd);
+ DDX_Control(pDX, IDC_CHECK4, m_apdvd);
+ DDX_Radio(pDX, IDC_RADIO1, m_iRtspHandler);
+ DDX_Check(pDX, IDC_CHECK5, m_fRtspFileExtFirst);
+}
+
+int CPPageFormats::GetChecked(int iItem)
+{
+ LVITEM lvi;
+ lvi.iItem = iItem;
+ lvi.iSubItem = 0;
+ lvi.mask = LVIF_IMAGE;
+ m_list.GetItem(&lvi);
+ return(lvi.iImage);
+}
+
+void CPPageFormats::SetChecked(int iItem, int iChecked)
+{
+ LVITEM lvi;
+ lvi.iItem = iItem;
+ lvi.iSubItem = 0;
+ lvi.mask = LVIF_IMAGE;
+ lvi.iImage = iChecked;
+ m_list.SetItem(&lvi);
+}
+
+static bool MakeRegParams(CString ext, CString& path, CString& fn, CString& extfile, CString& cmd)
+{
+ if(ext.GetLength() == 0)
+ return(false);
+
+ TCHAR buff[MAX_PATH];
+ if(::GetModuleFileName(AfxGetInstanceHandle(), buff, MAX_PATH) == 0)
+ return(false);
+
+ path = buff;
+
+ fn = path.Mid(path.ReverseFind('\\')+1).MakeLower();
+ if(fn.IsEmpty())
+ return(false);
+
+ extfile = ext.TrimLeft('.')+_T("file");
+
+ cmd = _T("\"") + path + _T("\" \"%1\"");
+
+ return(true);
+}
+
+bool CPPageFormats::IsRegistered(CString ext)
+{
+ CString path, fn, extfile, cmd;
+ if(!MakeRegParams(ext, path, fn, extfile, cmd))
+ return(false);
+
+ TCHAR buff[256];
+ ULONG len = sizeof(buff);
+ memset(buff, 0, len);
+
+ CRegKey key;
+
+ CString ExplExt = _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\") + ext;
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, ExplExt, KEY_READ))
+ {
+ len = sizeof(buff);
+ memset(buff, 0, len);
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("Application"), buff, &len))
+ return(CString(buff).Trim() == cmd);
+ }
+
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext, KEY_READ))
+ return(false);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len) || (extfile = buff).Trim().IsEmpty())
+ return(false);
+
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, extfile + _T("\\shell\\open\\command"), KEY_READ))
+ return(false);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ CRegKey key2;
+ if(ERROR_SUCCESS == key2.Open(HKEY_CLASSES_ROOT, extfile + _T("\\shell\\open"), KEY_READ)
+ && ERROR_SUCCESS == key2.QueryStringValue(_T("LegacyDisable"), buff, &len))
+ return(false);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ if(ERROR_SUCCESS == key2.Open(HKEY_CLASSES_ROOT, extfile + _T("\\shell\\open\\DropTarget"), KEY_READ))
+ return(false);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ return(ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len)
+ && !CString(buff).CompareNoCase(cmd));
+}
+
+bool CPPageFormats::RegisterExt(CString ext, bool fRegister)
+{
+ if(fRegister == IsRegistered(ext))
+ return(true);
+
+ CString path, fn, extfile, cmd;
+ if(!MakeRegParams(ext, path, fn, extfile, cmd))
+ return(false);
+
+ TCHAR buff[256];
+ ULONG len = sizeof(buff);
+ memset(buff, 0, len);
+
+ CRegKey key;
+
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, ext))
+ return(false);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ if(ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && !CString(buff).Trim().IsEmpty())
+ {
+ extfile = buff;
+ }
+ else
+ {
+ if(!fRegister) return(true);
+ else if(ERROR_SUCCESS != key.SetStringValue(NULL, extfile)) return(false);
+ }
+
+ if(fRegister)
+ {
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, extfile + _T("\\shell")))
+ return(false);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ key.QueryStringValue(NULL, buff, &len);
+
+ if(ERROR_SUCCESS != key.SetStringValue(fn + _T(".bak"), buff))
+ return(false);
+
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, _T("open")))
+ {
+ key.SetStringValue(NULL, buff);
+ key.DeleteValue(fn + _T(".bak"));
+ return(false);
+ }
+
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, extfile + _T("\\shell\\open")))
+ return(false);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, _T("&Open")))
+ return(false);
+
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, extfile + _T("\\shell\\open\\command")))
+ return(false);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ key.QueryStringValue(NULL, buff, &len);
+
+ if(CString(buff).MakeLower() == cmd)
+ return(true);
+
+ if(ERROR_SUCCESS != key.SetStringValue(fn + _T(".bak"), buff))
+ return(false);
+
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, cmd))
+ {
+ key.SetStringValue(NULL, buff);
+ key.DeleteValue(fn + _T(".bak"));
+ return(false);
+ }
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, extfile + _T("\\shell\\open")))
+ {
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("LegacyDisable"), buff, &len))
+ {
+ key.DeleteValue(_T("LegacyDisable"));
+ key.SetStringValue(_T("LegacyDisable.bak"), _T(""));
+ }
+
+ key.RecurseDeleteKey(_T("ddeexec"));
+ key.RecurseDeleteKey(_T("DropTarget"));
+ }
+
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\") + ext))
+ {
+ key.DeleteValue(_T("Application"));
+ }
+ }
+ else
+ {
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, extfile + _T("\\shell\\open\\command")))
+ return(true);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ if(ERROR_SUCCESS != key.QueryStringValue(fn + _T(".bak"), buff, &len))
+ buff[0] = 0; //return(true);
+
+ if(CString(buff).Trim().IsEmpty())
+ {
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, extfile + _T("\\shell\\open"))
+ || ERROR_SUCCESS != key.RecurseDeleteKey(_T("command")))
+ return(false);
+ }
+ else
+ {
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, buff)
+ || ERROR_SUCCESS != key.DeleteValue(fn + _T(".bak")))
+ return(false);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, extfile + _T("\\shell\\open"))
+ && ERROR_SUCCESS == key.QueryStringValue(_T("LegacyDisable.bak"), buff, &len))
+ {
+ key.DeleteValue(_T("LegacyDisable.bak"));
+ key.SetStringValue(_T("LegacyDisable"), _T(""));
+ }
+ }
+
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, extfile + _T("\\shell")))
+ return(true);
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+
+ if(ERROR_SUCCESS != key.QueryStringValue(fn + _T(".bak"), buff, &len))
+ return(true);
+
+ if(CString(buff).Trim().IsEmpty())
+ {
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, extfile)
+ || ERROR_SUCCESS != key.RecurseDeleteKey(_T("shell")))
+ return(false);
+ }
+ else
+ {
+ if(ERROR_SUCCESS != key.SetStringValue(NULL, buff)
+ || ERROR_SUCCESS != key.DeleteValue(fn + _T(".bak")))
+ return(false);
+ }
+ }
+
+ return(true);
+}
+
+static struct {TCHAR verb[20], cmd[20], action[100];} handlers[] =
+{
+ {_T("VideoFiles"), _T(" %1"), _T("")},
+ {_T("MusicFiles"), _T(" %1"), _T("")},
+ {_T("CDAudio"), _T(" %1 /cd"), _T("")},
+ {_T("DVDMovie"), _T(" %1 /dvd"), _T("")},
+};
+
+void CPPageFormats::AddAutoPlayToRegistry(autoplay_t ap, bool fRegister)
+{
+ if(!AfxGetAppSettings().fXpOrBetter) return;
+
+ TCHAR buff[MAX_PATH];
+ if(::GetModuleFileName(AfxGetInstanceHandle(), buff, MAX_PATH) == 0) return;
+ CString exe = buff;
+
+ int i = (int)ap;
+ if(i < 0 || i >= countof(handlers)) return;
+
+ CRegKey key;
+
+ if(fRegister)
+ {
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT, _T("MediaPlayerClassic.Autorun"))) return;
+ key.Close();
+
+ if(ERROR_SUCCESS != key.Create(HKEY_CLASSES_ROOT,
+ CString(_T("MediaPlayerClassic.Autorun\\Shell\\Play")) + handlers[i].verb + _T("\\Command"))) return;
+ key.SetStringValue(NULL, exe + handlers[i].cmd);
+ key.Close();
+
+ if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
+ CString(_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\Handlers\\MPCPlay")) + handlers[i].verb + _T("OnArrival"))) return;
+ key.SetStringValue(_T("Action"), handlers[i].action);
+ key.SetStringValue(_T("Provider"), _T("Media Player Classic"));
+ key.SetStringValue(_T("InvokeProgID"), _T("MediaPlayerClassic.Autorun"));
+ key.SetStringValue(_T("InvokeVerb"), CString(_T("Play")) + handlers[i].verb);
+ key.SetStringValue(_T("DefaultIcon"), exe + _T(",0"));
+ key.Close();
+
+ if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
+ CString(_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play")) + handlers[i].verb + _T("OnArrival"))) return;
+ key.SetStringValue(CString(_T("MPCPlay")) + handlers[i].verb + _T("OnArrival"), _T(""));
+ key.Close();
+ }
+ else
+ {
+ if(ERROR_SUCCESS != key.Create(HKEY_LOCAL_MACHINE,
+ CString(_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play")) + handlers[i].verb + _T("OnArrival"))) return;
+ key.DeleteValue(CString(_T("MPCPlay")) + handlers[i].verb + _T("OnArrival"));
+ key.Close();
+ }
+}
+
+bool CPPageFormats::IsAutoPlayRegistered(autoplay_t ap)
+{
+ ULONG len;
+ TCHAR buff[MAX_PATH];
+ if(::GetModuleFileName(AfxGetInstanceHandle(), buff, MAX_PATH) == 0) return(false);
+ CString exe = buff;
+
+ int i = (int)ap;
+ if(i < 0 || i >= countof(handlers)) return(false);
+
+ CRegKey key;
+
+ if(ERROR_SUCCESS != key.Open(HKEY_LOCAL_MACHINE,
+ CString(_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\AutoplayHandlers\\EventHandlers\\Play")) + handlers[i].verb + _T("OnArrival"),
+ KEY_READ)) return(false);
+ len = countof(buff);
+ if(ERROR_SUCCESS != key.QueryStringValue(
+ CString(_T("MPCPlay")) + handlers[i].verb + _T("OnArrival"),
+ buff, &len)) return(false);
+ key.Close();
+
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT,
+ CString(_T("MediaPlayerClassic.Autorun\\Shell\\Play")) + handlers[i].verb + _T("\\Command"),
+ KEY_READ)) return(false);
+ len = countof(buff);
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len))
+ return(false);
+ if(_tcsnicmp(exe, buff, exe.GetLength()))
+ return(false);
+ key.Close();
+
+ return(true);
+}
+
+void CPPageFormats::SetListItemState(int nItem)
+{
+ if(nItem < 0) return;
+
+ CString str = AfxGetAppSettings().Formats[(int)m_list.GetItemData(nItem)].GetExtsWithPeriod();
+
+ CAtlList<CString> exts;
+ ExplodeMin(str, exts, ' ');
+
+ int cnt = 0;
+
+ POSITION pos = exts.GetHeadPosition();
+ while(pos) if(IsRegistered(exts.GetNext(pos))) cnt++;
+
+ SetChecked(nItem, cnt == 0 ? 0 : cnt == exts.GetCount() ? 1 : 2);
+}
+
+BEGIN_MESSAGE_MAP(CPPageFormats, CPPageBase)
+ ON_NOTIFY(NM_CLICK, IDC_LIST1, OnNMClickList1)
+ ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, OnLvnItemchangedList1)
+ ON_NOTIFY(LVN_BEGINLABELEDIT, IDC_LIST1, OnBeginlabeleditList)
+ ON_NOTIFY(LVN_DOLABELEDIT, IDC_LIST1, OnDolabeleditList)
+ ON_NOTIFY(LVN_ENDLABELEDIT, IDC_LIST1, OnEndlabeleditList)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton12)
+ ON_BN_CLICKED(IDC_BUTTON_EXT_SET, OnBnClickedButton11)
+ ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton14)
+ ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton13)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateButtonDefault)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON_EXT_SET, OnUpdateButtonSet)
+END_MESSAGE_MAP()
+
+// CPPageFormats message handlers
+
+BOOL CPPageFormats::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ _tcscpy(handlers[0].action, ResStr(IDS_AUTOPLAY_PLAYVIDEO));
+ _tcscpy(handlers[1].action, ResStr(IDS_AUTOPLAY_PLAYMUSIC));
+ _tcscpy(handlers[2].action, ResStr(IDS_AUTOPLAY_PLAYAUDIOCD));
+ _tcscpy(handlers[3].action, ResStr(IDS_AUTOPLAY_PLAYDVDMOVIE));
+
+ m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
+
+ m_list.InsertColumn(COL_CATEGORY, _T("Category"), LVCFMT_LEFT, 300);
+ m_list.InsertColumn(COL_ENGINE, _T("Engine"), LVCFMT_RIGHT, 60);
+
+ m_onoff.Create(IDB_ONOFF, 12, 3, 0xffffff);
+ m_list.SetImageList(&m_onoff, LVSIL_SMALL);
+
+ CMediaFormats& mf = AfxGetAppSettings().Formats;
+ for(int i = 0; i < mf.GetCount(); i++)
+ {
+ CString label = mf[i].GetLabel();
+ // HACK: sorry, mpc is just not an image viewer :)
+ if(!label.CompareNoCase(_T("Image file"))) continue;
+ int iItem = m_list.InsertItem(i, label);
+ m_list.SetItemData(iItem, i);
+ engine_t e = mf[i].GetEngineType();
+ m_list.SetItemText(iItem, COL_ENGINE,
+ e == DirectShow ? _T("DirectShow") :
+ e == RealMedia ? _T("RealMedia") :
+ e == QuickTime ? _T("QuickTime") :
+ e == ShockWave ? _T("ShockWave") : _T("-"));
+ }
+
+// m_list.SetColumnWidth(COL_CATEGORY, LVSCW_AUTOSIZE);
+ m_list.SetColumnWidth(COL_ENGINE, LVSCW_AUTOSIZE_USEHEADER);
+
+ m_list.SetSelectionMark(0);
+ m_list.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
+ m_exts = mf[(int)m_list.GetItemData(0)].GetExtsWithPeriod();
+
+ AppSettings& s = AfxGetAppSettings();
+ bool fRtspFileExtFirst;
+ engine_t e = s.Formats.GetRtspHandler(fRtspFileExtFirst);
+ m_iRtspHandler = (e==RealMedia?0:e==QuickTime?1:2);
+ m_fRtspFileExtFirst = fRtspFileExtFirst;
+
+ UpdateData(FALSE);
+
+ for(int i = 0; i < m_list.GetItemCount(); i++)
+ {
+ SetListItemState(i);
+ }
+
+ if(AfxGetAppSettings().fXpOrBetter)
+ {
+ m_apvideo.SetCheck(IsAutoPlayRegistered(AP_VIDEO));
+ m_apmusic.SetCheck(IsAutoPlayRegistered(AP_MUSIC));
+ m_apaudiocd.SetCheck(IsAutoPlayRegistered(AP_AUDIOCD));
+ m_apdvd.SetCheck(IsAutoPlayRegistered(AP_DVDMOVIE));
+ }
+ else
+ {
+ m_autoplay.ShowWindow(SW_HIDE);
+ m_apvideo.ShowWindow(SW_HIDE);
+ m_apmusic.ShowWindow(SW_HIDE);
+ m_apaudiocd.ShowWindow(SW_HIDE);
+ m_apdvd.ShowWindow(SW_HIDE);
+ }
+
+ CreateToolTip();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageFormats::OnApply()
+{
+ UpdateData();
+
+ {
+ int i = m_list.GetSelectionMark();
+ if(i >= 0) i = (int)m_list.GetItemData(i);
+ if(i >= 0)
+ {
+ CMediaFormats& mf = AfxGetAppSettings().Formats;
+ mf[i].SetExts(m_exts);
+ m_exts = mf[i].GetExtsWithPeriod();
+ UpdateData(FALSE);
+ }
+ }
+
+ CMediaFormats& mf = AfxGetAppSettings().Formats;
+
+ for(int i = 0; i < m_list.GetItemCount(); i++)
+ {
+ int iChecked = GetChecked(i);
+ if(iChecked == 2) continue;
+
+ CAtlList<CString> exts;
+ Explode(mf[(int)m_list.GetItemData(i)].GetExtsWithPeriod(), exts, ' ');
+
+ POSITION pos = exts.GetHeadPosition();
+ while(pos) RegisterExt(exts.GetNext(pos), !!iChecked);
+ }
+
+ {
+ SetListItemState(m_list.GetSelectionMark());
+ }
+
+ AddAutoPlayToRegistry(AP_VIDEO, !!m_apvideo.GetCheck());
+ AddAutoPlayToRegistry(AP_MUSIC, !!m_apmusic.GetCheck());
+ AddAutoPlayToRegistry(AP_AUDIOCD, !!m_apaudiocd.GetCheck());
+ AddAutoPlayToRegistry(AP_DVDMOVIE, !!m_apdvd.GetCheck());
+
+// SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
+
+ AppSettings& s = AfxGetAppSettings();
+ s.Formats.SetRtspHandler(m_iRtspHandler==0?RealMedia:m_iRtspHandler==1?QuickTime:DirectShow, !!m_fRtspFileExtFirst);
+
+ return __super::OnApply();
+}
+
+void CPPageFormats::OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
+
+ if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem == COL_CATEGORY)
+ {
+ CRect r;
+ m_list.GetItemRect(lpnmlv->iItem, r, LVIR_ICON);
+ if(r.PtInRect(lpnmlv->ptAction))
+ {
+ SetChecked(lpnmlv->iItem, (GetChecked(lpnmlv->iItem)&1) == 0 ? 1 : 0);
+ SetModified();
+ }
+ }
+
+ *pResult = 0;
+}
+
+void CPPageFormats::OnLvnItemchangedList1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
+
+ if(pNMLV->iItem >= 0 && pNMLV->iSubItem == COL_CATEGORY
+ && (pNMLV->uChanged&LVIF_STATE) && (pNMLV->uNewState&LVIS_SELECTED))
+ {
+ m_exts = AfxGetAppSettings().Formats[(int)m_list.GetItemData(pNMLV->iItem)].GetExtsWithPeriod();
+ UpdateData(FALSE);
+ }
+
+ *pResult = 0;
+}
+
+void CPPageFormats::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
+ LV_ITEM* pItem = &pDispInfo->item;
+
+ *pResult = FALSE;
+
+ if(pItem->iItem < 0)
+ return;
+
+ if(pItem->iSubItem == COL_ENGINE)
+ {
+ *pResult = TRUE;
+ }
+}
+
+void CPPageFormats::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
+ LV_ITEM* pItem = &pDispInfo->item;
+
+ *pResult = FALSE;
+
+ if(pItem->iItem < 0)
+ return;
+
+ CMediaFormatCategory& mfc = AfxGetAppSettings().Formats[m_list.GetItemData(pItem->iItem)];
+
+ CAtlList<CString> sl;
+ int nSel = -1;
+
+ if(pItem->iSubItem == COL_ENGINE)
+ {
+ sl.AddTail(_T("DirectShow"));
+ sl.AddTail(_T("RealMedia"));
+ sl.AddTail(_T("QuickTime"));
+ sl.AddTail(_T("ShockWave"));
+
+ nSel = (int)mfc.GetEngineType();
+
+ m_list.ShowInPlaceComboBox(pItem->iItem, pItem->iSubItem, sl, nSel);
+
+ *pResult = TRUE;
+ }
+}
+
+void CPPageFormats::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
+ LV_ITEM* pItem = &pDispInfo->item;
+
+ *pResult = FALSE;
+
+ if(!m_list.m_fInPlaceDirty)
+ return;
+
+ if(pItem->iItem < 0)
+ return;
+
+ CMediaFormatCategory& mfc = AfxGetAppSettings().Formats[m_list.GetItemData(pItem->iItem)];
+
+ if(pItem->iSubItem == COL_ENGINE && pItem->lParam >= 0)
+ {
+ mfc.SetEngineType((engine_t)pItem->lParam);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, pItem->pszText);
+ *pResult = TRUE;
+ }
+
+ if(*pResult)
+ SetModified();
+}
+
+void CPPageFormats::OnBnClickedButton1()
+{
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
+ {
+ SetChecked(i, 1);
+ }
+
+ m_apvideo.SetCheck(1);
+ m_apmusic.SetCheck(1);
+ m_apaudiocd.SetCheck(1);
+ m_apdvd.SetCheck(1);
+
+ SetModified();
+}
+
+void CPPageFormats::OnBnClickedButton14()
+{
+ CMediaFormats& mf = AfxGetAppSettings().Formats;
+
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
+ {
+ SetChecked(i, mf[(int)m_list.GetItemData(i)].IsAudioOnly()?0:1);
+ }
+
+ m_apvideo.SetCheck(1);
+ m_apmusic.SetCheck(0);
+ m_apaudiocd.SetCheck(0);
+ m_apdvd.SetCheck(1);
+
+ SetModified();
+}
+
+void CPPageFormats::OnBnClickedButton13()
+{
+ CMediaFormats& mf = AfxGetAppSettings().Formats;
+
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
+ {
+ SetChecked(i, mf[(int)m_list.GetItemData(i)].IsAudioOnly()?1:0);
+ }
+
+ m_apvideo.SetCheck(0);
+ m_apmusic.SetCheck(1);
+ m_apaudiocd.SetCheck(1);
+ m_apdvd.SetCheck(0);
+
+ SetModified();
+}
+
+void CPPageFormats::OnBnClickedButton12()
+{
+ int i = m_list.GetSelectionMark();
+ if(i < 0) return;
+ i = (int)m_list.GetItemData(i);
+ CMediaFormats& mf = AfxGetAppSettings().Formats;
+ mf[i].RestoreDefaultExts();
+ m_exts = mf[i].GetExtsWithPeriod();
+ SetListItemState(m_list.GetSelectionMark());
+ UpdateData(FALSE);
+
+ SetModified();
+}
+
+void CPPageFormats::OnBnClickedButton11()
+{
+ UpdateData();
+ int i = m_list.GetSelectionMark();
+ if(i < 0) return;
+ i = (int)m_list.GetItemData(i);
+ CMediaFormats& mf = AfxGetAppSettings().Formats;
+ mf[i].SetExts(m_exts);
+ m_exts = mf[i].GetExtsWithPeriod();
+ SetListItemState(m_list.GetSelectionMark());
+ UpdateData(FALSE);
+
+ SetModified();
+}
+
+void CPPageFormats::OnUpdateButtonDefault(CCmdUI* pCmdUI)
+{
+ int i = m_list.GetSelectionMark();
+ if(i < 0) {pCmdUI->Enable(FALSE); return;}
+ i = (int)m_list.GetItemData(i);
+
+ CString orgexts, newexts;
+ GetDlgItem(IDC_EDIT1)->GetWindowText(newexts);
+ newexts.Trim();
+ orgexts = AfxGetAppSettings().Formats[i].GetBackupExtsWithPeriod();
+
+ pCmdUI->Enable(!!newexts.CompareNoCase(orgexts));
+}
+
+void CPPageFormats::OnUpdateButtonSet(CCmdUI* pCmdUI)
+{
+ int i = m_list.GetSelectionMark();
+ if(i < 0) {pCmdUI->Enable(FALSE); return;}
+ i = (int)m_list.GetItemData(i);
+
+ CString orgexts, newexts;
+ GetDlgItem(IDC_EDIT1)->GetWindowText(newexts);
+ newexts.Trim();
+ orgexts = AfxGetAppSettings().Formats[i].GetExtsWithPeriod();
+
+ pCmdUI->Enable(!!newexts.CompareNoCase(orgexts));
+}
diff --git a/src/apps/mplayerc/PPageFormats.h b/src/apps/mplayerc/PPageFormats.h
new file mode 100644
index 000000000..ce6698e65
--- /dev/null
+++ b/src/apps/mplayerc/PPageFormats.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+#include "PlayerListCtrl.h"
+
+// CPPageFormats dialog
+
+class CPPageFormats : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageFormats)
+
+private:
+ CImageList m_onoff;
+
+ int GetChecked(int iItem);
+ void SetChecked(int iItem, int fChecked);
+
+ typedef enum {AP_VIDEO=0,AP_MUSIC,AP_AUDIOCD,AP_DVDMOVIE} autoplay_t;
+ void AddAutoPlayToRegistry(autoplay_t ap, bool fRegister);
+ bool IsAutoPlayRegistered(autoplay_t ap);
+
+ void SetListItemState(int nItem);
+
+public:
+ CPPageFormats();
+ virtual ~CPPageFormats();
+
+ static bool IsRegistered(CString ext);
+ static bool RegisterExt(CString ext, bool fRegister);
+
+ enum {COL_CATEGORY, COL_ENGINE};
+ CPlayerListCtrl m_list;
+ CString m_exts;
+ CStatic m_autoplay;
+ CButton m_apvideo;
+ CButton m_apmusic;
+ CButton m_apaudiocd;
+ CButton m_apdvd;
+ int m_iRtspHandler;
+ BOOL m_fRtspFileExtFirst;
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEFORMATS };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnNMClickList1(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnLvnItemchangedList1(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnBnClickedButton14();
+ afx_msg void OnBnClickedButton13();
+ afx_msg void OnBnClickedButton12();
+ afx_msg void OnBnClickedButton11();
+ afx_msg void OnUpdateButtonDefault(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateButtonSet(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/PPageInternalFilters.cpp b/src/apps/mplayerc/PPageInternalFilters.cpp
new file mode 100644
index 000000000..a65a59cd2
--- /dev/null
+++ b/src/apps/mplayerc/PPageInternalFilters.cpp
@@ -0,0 +1,292 @@
+
+
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageInternalFilters.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageInternalFilters.h"
+#include "ComPropertySheet.h"
+#include "..\..\filters\filters.h"
+
+static struct filter_t
+{
+ LPCTSTR label;
+ int type;
+ int flag;
+ UINT nHintID;
+ CUnknown* (WINAPI * CreateInstance)(LPUNKNOWN lpunk, HRESULT* phr);
+}
+s_filters[] =
+{
+ {_T("AVI"), 0, SRC_AVI, IDS_SRC_AVI, NULL},
+ {_T("CDDA (Audio CD)"), 0, SRC_CDDA, IDS_SRC_CDDA, NULL},
+ {_T("CDXA (VCD/SVCD/XCD)"), 0, SRC_CDXA, IDS_SRC_CDXA, NULL},
+ {_T("Dirac"), 0, SRC_DIRAC, IDS_SRC_DIRAC, NULL},
+ {_T("DirectShow Media"), 0, SRC_DSM, IDS_SRC_DSM, NULL},
+ {_T("DTS/AC3"), 0, SRC_DTSAC3, IDS_SRC_DTSAC3, NULL},
+ {_T("DVD Video Title Set"), 0, SRC_VTS, IDS_SRC_VTS, NULL},
+ {_T("DVD2AVI Project File"), 0, SRC_D2V, IDS_SRC_D2V, NULL},
+ {_T("FLI/FLC"), 0, SRC_FLIC, IDS_SRC_FLIC, NULL},
+ {_T("Matroska"), 0, SRC_MATROSKA, IDS_SRC_MATROSKA, NULL},
+ {_T("MP4/MOV"), 0, SRC_MP4, IDS_SRC_MP4, NULL},
+ {_T("MPEG Audio"), 0, SRC_MPA, IDS_SRC_MPA, NULL},
+ {_T("MPEG PS/TS/PVA"), 0, SRC_MPEG, 0, NULL},
+ {_T("Nut"), 0, SRC_NUT, IDS_SRC_NUT, NULL},
+ {_T("Ogg"), 0, SRC_OGG, IDS_SRC_OGG, NULL},
+ {_T("RealMedia"), 0, SRC_REALMEDIA, IDS_SRC_REALMEDIA, NULL},
+ {_T("RoQ"), 0, SRC_ROQ, IDS_SRC_ROQ, NULL},
+ {_T("SHOUTcast"), 0, SRC_SHOUTCAST, IDS_SRC_SHOUTCAST, NULL},
+ __if_exists(CRadGtSplitterFilter) {{_T("Smacker/Bink"), 0, SRC_RADGT, IDS_SRC_RADGT, NULL},}
+ {_T("AAC"), 1, TRA_AAC, IDS_TRA_AAC, CreateInstance<CMpaDecFilter>},
+ {_T("AC3"), 1, TRA_AC3, IDS_TRA_AC3, CreateInstance<CMpaDecFilter>},
+ {_T("DTS"), 1, TRA_DTS, IDS_TRA_DTS, CreateInstance<CMpaDecFilter>},
+ {_T("Dirac"), 1, TRA_DIRAC, IDS_TRA_DIRAC, NULL},
+ {_T("LPCM"), 1, TRA_LPCM, IDS_TRA_LPCM, CreateInstance<CMpaDecFilter>},
+ {_T("MPEG Audio"), 1, TRA_MPA, IDS_TRA_MPA, CreateInstance<CMpaDecFilter>},
+ {_T("MPEG-1 Video"), 1, TRA_MPEG1, IDS_TRA_MPEG1, CreateInstance<CMpeg2DecFilter>},
+ {_T("MPEG-2 Video"), 1, TRA_MPEG2, IDS_TRA_MPEG2, CreateInstance<CMpeg2DecFilter>},
+ {_T("PS2 Audio (PCM/ADPCM)"), 1, TRA_PS2AUD, IDS_TRA_PS2AUD, CreateInstance<CMpaDecFilter>},
+ {_T("RealVideo"), 1, TRA_RV, IDS_TRA_RV, NULL},
+ {_T("RealAudio"), 1, TRA_RA, IDS_TRA_RA, NULL},
+ {_T("Vorbis"), 1, TRA_VORBIS, 0, NULL /* TODO: CreateInstance<CMpaDecFilter>*/},
+};
+
+IMPLEMENT_DYNAMIC(CPPageInternalFiltersListBox, CCheckListBox)
+CPPageInternalFiltersListBox::CPPageInternalFiltersListBox()
+ : CCheckListBox()
+{
+}
+
+void CPPageInternalFiltersListBox::PreSubclassWindow()
+{
+ __super::PreSubclassWindow();
+ EnableToolTips(TRUE);
+}
+
+INT_PTR CPPageInternalFiltersListBox::OnToolHitTest(CPoint point, TOOLINFO* pTI) const
+{
+ BOOL b = FALSE;
+ int row = ItemFromPoint(point, b);
+ if(row < 0) return -1;
+
+ CRect r;
+ GetItemRect(row, r);
+ pTI->rect = r;
+ pTI->hwnd = m_hWnd;
+ pTI->uId = (UINT)row;
+ pTI->lpszText = LPSTR_TEXTCALLBACK;
+ pTI->uFlags |= TTF_ALWAYSTIP;
+
+ return pTI->uId;
+}
+
+BEGIN_MESSAGE_MAP(CPPageInternalFiltersListBox, CCheckListBox)
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
+END_MESSAGE_MAP()
+
+BOOL CPPageInternalFiltersListBox::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
+{
+ TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
+ TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
+
+ filter_t* f = (filter_t*)GetItemDataPtr(pNMHDR->idFrom);
+ if(f->nHintID == 0) return FALSE;
+
+ ::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, (LPARAM)(INT)1000);
+
+ static CStringA m_strTipTextA;
+ static CStringW m_strTipTextW;
+
+ m_strTipTextA = CString(MAKEINTRESOURCE(f->nHintID));
+ m_strTipTextW = CString(MAKEINTRESOURCE(f->nHintID));
+
+ if(pNMHDR->code == TTN_NEEDTEXTA) pTTTA->lpszText = (LPSTR)(LPCSTR)m_strTipTextA;
+ else pTTTW->lpszText = (LPWSTR)(LPCWSTR)m_strTipTextW;
+
+ *pResult = 0;
+
+ return TRUE; // message was handled
+}
+
+void CPPageInternalFiltersListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
+{
+ CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
+
+ CFont* pOldFont = NULL;
+
+ if(((filter_t*)lpDrawItemStruct->itemData)->CreateInstance)
+ {
+ if(!(HFONT)m_bold)
+ {
+ CFont* pFont = pDC->GetCurrentFont();
+
+ LOGFONT lf;
+ pFont->GetLogFont(&lf);
+ lf.lfWeight = FW_BOLD;
+
+ m_bold.CreateFontIndirect(&lf);
+ }
+
+ if((HFONT)m_bold)
+ {
+ pOldFont = pDC->SelectObject(&m_bold);
+ }
+ }
+
+ __super::DrawItem(lpDrawItemStruct);
+
+ if(pOldFont)
+ {
+ pDC->SelectObject(pOldFont);
+ }
+}
+
+// CPPageInternalFilters dialog
+
+IMPLEMENT_DYNAMIC(CPPageInternalFilters, CPPageBase)
+CPPageInternalFilters::CPPageInternalFilters()
+ : CPPageBase(CPPageInternalFilters::IDD, CPPageInternalFilters::IDD)
+{
+}
+
+CPPageInternalFilters::~CPPageInternalFilters()
+{
+}
+
+
+void CPPageInternalFilters::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_listSrc);
+ DDX_Control(pDX, IDC_LIST2, m_listTra);
+}
+
+BEGIN_MESSAGE_MAP(CPPageInternalFilters, CPPageBase)
+ ON_LBN_DBLCLK(IDC_LIST1, &CPPageInternalFilters::OnLbnDblclkList1)
+ ON_LBN_DBLCLK(IDC_LIST2, &CPPageInternalFilters::OnLbnDblclkList2)
+END_MESSAGE_MAP()
+
+// CPPageInternalFilters message handlers
+
+BOOL CPPageInternalFilters::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ for(int i = 0; i < countof(s_filters); i++)
+ {
+ CCheckListBox* l =
+ s_filters[i].type == 0 ? &m_listSrc :
+ s_filters[i].type == 1 ? &m_listTra :
+ NULL;
+
+ UINT* pflags =
+ s_filters[i].type == 0 ? &s.SrcFilters :
+ s_filters[i].type == 1 ? &s.TraFilters :
+ NULL;
+
+ if(l && pflags)
+ {
+ int Index = l->AddString(s_filters[i].label);
+ l->SetCheck(Index, !!(*pflags & s_filters[i].flag));
+ l->SetItemDataPtr(Index, &s_filters[i]);
+ }
+ }
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageInternalFilters::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.SrcFilters = s.TraFilters = 0;
+
+ CList<filter_t*> fl;
+ for(int i = 0; i < m_listSrc.GetCount(); i++)
+ if(m_listSrc.GetCheck(i))
+ fl.AddTail((filter_t*)m_listSrc.GetItemDataPtr(i));
+ for(int i = 0; i < m_listTra.GetCount(); i++)
+ if(m_listTra.GetCheck(i))
+ fl.AddTail((filter_t*)m_listTra.GetItemDataPtr(i));
+
+ POSITION pos = fl.GetHeadPosition();
+ while(pos)
+ {
+ filter_t* f = fl.GetNext(pos);
+
+ UINT* pflags =
+ f->type == 0 ? &s.SrcFilters :
+ f->type == 1 ? &s.TraFilters :
+ NULL;
+
+ if(pflags)
+ *pflags |= f->flag;
+ }
+
+ return __super::OnApply();
+}
+
+void CPPageInternalFilters::ShowPPage(CPPageInternalFiltersListBox& l)
+{
+ int i = l.GetCurSel();
+ if(i < 0) return;
+
+ filter_t* f = (filter_t*)l.GetItemDataPtr(i);
+ if(!f || !f->CreateInstance) return;
+
+ HRESULT hr;
+ CUnknown* pObj = f->CreateInstance(NULL, &hr);
+ if(!pObj) return;
+
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pObj;
+
+ if(SUCCEEDED(hr))
+ {
+ if(CComQIPtr<ISpecifyPropertyPages> pSPP = pUnk)
+ {
+ CComPropertySheet ps(ResStr(IDS_PROPSHEET_PROPERTIES), this);
+ ps.AddPages(pSPP);
+ ps.DoModal();
+ }
+ }
+}
+
+void CPPageInternalFilters::OnLbnDblclkList1()
+{
+ ShowPPage(m_listSrc);
+}
+
+void CPPageInternalFilters::OnLbnDblclkList2()
+{
+ ShowPPage(m_listTra);
+}
diff --git a/src/apps/mplayerc/PPageInternalFilters.h b/src/apps/mplayerc/PPageInternalFilters.h
new file mode 100644
index 000000000..e1a24450f
--- /dev/null
+++ b/src/apps/mplayerc/PPageInternalFilters.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+#include "afxwin.h"
+
+class CPPageInternalFiltersListBox : public CCheckListBox
+{
+ DECLARE_DYNAMIC(CPPageInternalFiltersListBox)
+
+public:
+ CPPageInternalFiltersListBox();
+
+ CFont m_bold;
+
+protected:
+ virtual void PreSubclassWindow();
+ virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
+
+ DECLARE_MESSAGE_MAP()
+ afx_msg BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
+
+public:
+ virtual void DrawItem(LPDRAWITEMSTRUCT /*lpDrawItemStruct*/);
+};
+
+// CPPageInternalFilters dialog
+
+class CPPageInternalFilters : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageInternalFilters)
+
+public:
+ CPPageInternalFilters();
+ virtual ~CPPageInternalFilters();
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEINTERNALFILTERS };
+ CPPageInternalFiltersListBox m_listSrc;
+ CPPageInternalFiltersListBox m_listTra;
+
+ void ShowPPage(CPPageInternalFiltersListBox& l);
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnLbnDblclkList1();
+ afx_msg void OnLbnDblclkList2();
+};
diff --git a/src/apps/mplayerc/PPageLogo.cpp b/src/apps/mplayerc/PPageLogo.cpp
new file mode 100644
index 000000000..561ce08bf
--- /dev/null
+++ b/src/apps/mplayerc/PPageLogo.cpp
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// CPPageLogo.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPageLogo.h"
+
+// CPPageLogo dialog
+
+IMPLEMENT_DYNAMIC(CPPageLogo, CPPageBase)
+CPPageLogo::CPPageLogo()
+ : CPPageBase(CPPageLogo::IDD, CPPageLogo::IDD)
+ , m_intext(0)
+ , m_logofn(_T(""))
+ , m_author(_T(""))
+{
+ m_logoids.AddTail(IDB_LOGO0);
+ m_logoids.AddTail(IDB_LOGO1);
+ m_logoids.AddTail(IDB_LOGO2);
+ m_logoids.AddTail(IDB_LOGO3);
+ m_logoids.AddTail(IDB_LOGO4);
+ m_logoids.AddTail(IDB_LOGO5);
+ m_logoids.AddTail(IDB_LOGO6);
+ m_logoids.AddTail(IDB_LOGO7);
+}
+
+CPPageLogo::~CPPageLogo()
+{
+}
+
+void CPPageLogo::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Radio(pDX, IDC_RADIO1, m_intext);
+ DDX_Text(pDX, IDC_LOGOFILENAME, m_logofn);
+ DDX_Control(pDX, IDC_LOGOPREVIEW, m_logopreview);
+ DDX_Text(pDX, IDC_AUTHOR, m_author);
+}
+
+
+BEGIN_MESSAGE_MAP(CPPageLogo, CPPageBase)
+ ON_BN_CLICKED(IDC_RADIO1, OnBnClickedRadio1)
+ ON_BN_CLICKED(IDC_RADIO2, OnBnClickedRadio2)
+ ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1)
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
+END_MESSAGE_MAP()
+
+
+// CPPageLogo message handlers
+
+BOOL CPPageLogo::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_intext = s.logoext?1:0;
+ m_logofn = s.logofn;
+ m_logoidpos = NULL;
+
+ UpdateData(FALSE);
+
+ for(POSITION pos = m_logoids.GetHeadPosition(); pos; m_logoids.GetNext(pos))
+ {
+ if(m_logoids.GetAt(pos) == s.logoid)
+ {
+ m_logoidpos = pos;
+ break;
+ }
+ }
+
+ if(!m_intext) OnBnClickedRadio1();
+ else OnBnClickedRadio2();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageLogo::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.logoext = !!m_intext;
+ s.logofn = m_logofn;
+ s.logoid = m_logoids.GetAt(m_logoidpos);
+
+ ((CMainFrame*)AfxGetMainWnd())->m_wndView.LoadLogo();
+
+ return __super::OnApply();
+}
+
+
+void CPPageLogo::OnBnClickedRadio1()
+{
+ ASSERT(m_logoidpos);
+
+ m_author.Empty();
+
+ m_logobm.Destroy();
+ UINT id = m_logoids.GetAt(m_logoidpos);
+ if(IDB_LOGO0 != id)
+ {
+ m_logobm.LoadFromResource(::AfxGetInstanceHandle(), id);
+ if(!m_author.LoadString(id))
+ m_author = _T("Author unknown. Contact me if you made this logo!");
+ }
+ m_logopreview.SetBitmap(m_logobm);
+ Invalidate();
+
+ m_intext = 0;
+ UpdateData(FALSE);
+
+ SetModified();
+}
+
+void CPPageLogo::OnBnClickedRadio2()
+{
+ UpdateData();
+
+ m_author.Empty();
+
+ m_logobm.Destroy();
+ if(AfxGetAppSettings().fXpOrBetter)
+ m_logobm.Load(m_logofn);
+ else if(HANDLE h = LoadImage(NULL, m_logofn, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE))
+ m_logobm.Attach((HBITMAP)h);
+ m_logopreview.SetBitmap(m_logobm);
+ Invalidate();
+
+ m_intext = 1;
+ UpdateData(FALSE);
+
+ SetModified();
+}
+
+void CPPageLogo::OnDeltaposSpin1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ LPNMUPDOWN pNMUpDown = reinterpret_cast<LPNMUPDOWN>(pNMHDR);
+
+ if(pNMUpDown->iDelta < 0)
+ {
+ m_logoids.GetNext(m_logoidpos);
+ if(!m_logoidpos) m_logoidpos = m_logoids.GetHeadPosition();
+ }
+ else
+ {
+ m_logoids.GetPrev(m_logoidpos);
+ if(!m_logoidpos) m_logoidpos = m_logoids.GetTailPosition();
+ }
+
+ OnBnClickedRadio1();
+
+ *pResult = 0;
+}
+
+void CPPageLogo::OnBnClickedButton2()
+{
+ CFileDialog dlg(TRUE, NULL, m_logofn,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
+ AfxGetAppSettings().fXpOrBetter
+ ? _T("Images (*.bmp;*.jpg;*.gif;*.png)|*.bmp;*.jpg;*.gif;*.png|All files (*.*)|*.*||")
+ : _T("Images (*.bmp)|*.bmp|All files (*.*)|*.*||")
+ , this, 0);
+
+ if(dlg.DoModal() == IDOK)
+ {
+ m_logofn = dlg.GetPathName();
+ UpdateData(FALSE);
+ OnBnClickedRadio2();
+ }
+}
diff --git a/src/apps/mplayerc/PPageLogo.h b/src/apps/mplayerc/PPageLogo.h
new file mode 100644
index 000000000..cf354a932
--- /dev/null
+++ b/src/apps/mplayerc/PPageLogo.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlimage.h>
+
+// CPPageLogo dialog
+
+class CPPageLogo : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageLogo)
+
+private:
+ CList<UINT> m_logoids;
+ POSITION m_logoidpos;
+ CImage m_logobm;
+
+public:
+ CPPageLogo();
+ virtual ~CPPageLogo();
+
+// Dialog Data
+ enum { IDD = IDD_PPAGELOGO };
+ int m_intext;
+ CString m_logofn;
+ CStatic m_logopreview;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedRadio1();
+ afx_msg void OnBnClickedRadio2();
+ afx_msg void OnDeltaposSpin1(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnBnClickedButton2();
+ CString m_author;
+};
diff --git a/src/apps/mplayerc/PPageOutput.cpp b/src/apps/mplayerc/PPageOutput.cpp
new file mode 100644
index 000000000..50b61e413
--- /dev/null
+++ b/src/apps/mplayerc/PPageOutput.cpp
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// CPPageOutput.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPageOutput.h"
+#include "../../../include/moreuuids.h"
+
+// CPPageOutput dialog
+
+IMPLEMENT_DYNAMIC(CPPageOutput, CPPageBase)
+CPPageOutput::CPPageOutput()
+ : CPPageBase(CPPageOutput::IDD, CPPageOutput::IDD)
+ , m_iDSVideoRendererType(0)
+ , m_iRMVideoRendererType(0)
+ , m_iQTVideoRendererType(0)
+ , m_iAPSurfaceUsage(0)
+ , m_iAudioRendererType(0)
+ , m_fVMRSyncFix(FALSE)
+ , m_iDX9Resizer(0)
+ , m_fVMR9MixerMode(FALSE)
+ , m_fVMR9MixerYUV(FALSE)
+{
+}
+
+CPPageOutput::~CPPageOutput()
+{
+}
+
+void CPPageOutput::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Radio(pDX, IDC_DSSYSDEF, m_iDSVideoRendererType);
+ DDX_Radio(pDX, IDC_RMSYSDEF, m_iRMVideoRendererType);
+ DDX_Radio(pDX, IDC_QTSYSDEF, m_iQTVideoRendererType);
+ DDX_Radio(pDX, IDC_REGULARSURF, m_iAPSurfaceUsage);
+ DDX_CBIndex(pDX, IDC_COMBO1, m_iAudioRendererType);
+ DDX_Control(pDX, IDC_COMBO1, m_iAudioRendererTypeCtrl);
+ DDX_Check(pDX, IDC_CHECK1, m_fVMRSyncFix);
+ DDX_CBIndex(pDX, IDC_DX9RESIZER_COMBO, m_iDX9Resizer);
+ DDX_Check(pDX, IDC_DSVMR9LOADMIXER, m_fVMR9MixerMode);
+ DDX_Check(pDX, IDC_DSVMR9YUVMIXER, m_fVMR9MixerYUV);
+}
+
+BEGIN_MESSAGE_MAP(CPPageOutput, CPPageBase)
+ ON_UPDATE_COMMAND_UI(IDC_DSVMR9YUVMIXER, OnUpdateMixerYUV)
+END_MESSAGE_MAP()
+
+void CPPageOutput::DisableRadioButton(UINT nID, UINT nDefID)
+{
+ if(IsDlgButtonChecked(nID))
+ {
+ CheckDlgButton(nID, BST_UNCHECKED);
+ CheckDlgButton(nDefID, BST_CHECKED);
+ }
+
+ GetDlgItem(nID)->EnableWindow(FALSE);
+}
+
+// CPPageOutput message handlers
+
+BOOL CPPageOutput::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_iDSVideoRendererType = s.iDSVideoRendererType;
+ m_iRMVideoRendererType = s.iRMVideoRendererType;
+ m_iQTVideoRendererType = s.iQTVideoRendererType;
+ m_iAPSurfaceUsage = s.iAPSurfaceUsage;
+ m_fVMRSyncFix = s.fVMRSyncFix;
+ m_iDX9Resizer = s.iDX9Resizer;
+ m_fVMR9MixerMode = s.fVMR9MixerMode;
+ m_fVMR9MixerYUV = s.fVMR9MixerYUV;
+
+ m_AudioRendererDisplayNames.Add(_T(""));
+ m_iAudioRendererTypeCtrl.AddString(_T("System Default"));
+ m_iAudioRendererType = 0;
+
+ BeginEnumSysDev(CLSID_AudioRendererCategory, pMoniker)
+ {
+ LPOLESTR olestr = NULL;
+ if(FAILED(pMoniker->GetDisplayName(0, 0, &olestr)))
+ continue;
+
+ CStringW str(olestr);
+ CoTaskMemFree(olestr);
+
+ m_AudioRendererDisplayNames.Add(CString(str));
+
+ CComPtr<IPropertyBag> pPB;
+ if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
+ {
+ CComVariant var;
+ pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL);
+
+ CString fstr(var.bstrVal);
+
+ var.Clear();
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FilterData")), &var, NULL)))
+ {
+ BSTR* pbstr;
+ if(SUCCEEDED(SafeArrayAccessData(var.parray, (void**)&pbstr)))
+ {
+ fstr.Format(_T("%s (%08x)"), CString(fstr), *((DWORD*)pbstr + 1));
+ SafeArrayUnaccessData(var.parray);
+ }
+ }
+
+ m_iAudioRendererTypeCtrl.AddString(fstr);
+ }
+ else
+ {
+ m_iAudioRendererTypeCtrl.AddString(CString(str));
+ }
+
+ if(s.AudioRendererDisplayName == str && m_iAudioRendererType == 0)
+ {
+ m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
+ }
+ }
+ EndEnumSysDev
+
+ m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_COMP);
+ m_iAudioRendererTypeCtrl.AddString(AUDRNDT_NULL_COMP);
+ if(s.AudioRendererDisplayName == AUDRNDT_NULL_COMP && m_iAudioRendererType == 0)
+ m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
+
+ m_AudioRendererDisplayNames.Add(AUDRNDT_NULL_UNCOMP);
+ m_iAudioRendererTypeCtrl.AddString(AUDRNDT_NULL_UNCOMP);
+ if(s.AudioRendererDisplayName == AUDRNDT_NULL_UNCOMP && m_iAudioRendererType == 0)
+ m_iAudioRendererType = m_iAudioRendererTypeCtrl.GetCount()-1;
+
+ CorrectComboListWidth(m_iAudioRendererTypeCtrl, GetFont());
+
+ UpdateData(FALSE);
+
+ if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer))
+ {
+ DisableRadioButton(IDC_DSVMR7WIN, IDC_DSSYSDEF);
+ DisableRadioButton(IDC_DSVMR7REN, IDC_DSSYSDEF);
+ }
+
+ if(!IsCLSIDRegistered(CLSID_VideoMixingRenderer9))
+ {
+ DisableRadioButton(IDC_DSVMR9WIN, IDC_DSSYSDEF);
+ DisableRadioButton(IDC_DSVMR9REN, IDC_DSSYSDEF);
+ DisableRadioButton(IDC_RMDX9, IDC_RMSYSDEF);
+ DisableRadioButton(IDC_QTDX9, IDC_QTSYSDEF);
+ }
+
+ if(!IsCLSIDRegistered(CLSID_DXR))
+ {
+ DisableRadioButton(IDC_DSDXR, IDC_DSSYSDEF);
+ }
+
+ CreateToolTip();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageOutput::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.iDSVideoRendererType = m_iDSVideoRendererType;
+ s.iRMVideoRendererType = m_iRMVideoRendererType;
+ s.iQTVideoRendererType = m_iQTVideoRendererType;
+ s.iAPSurfaceUsage = m_iAPSurfaceUsage;
+ s.fVMRSyncFix = !!m_fVMRSyncFix;
+ s.AudioRendererDisplayName = m_AudioRendererDisplayNames[m_iAudioRendererType];
+ s.iDX9Resizer = m_iDX9Resizer;
+ s.fVMR9MixerMode = !!m_fVMR9MixerMode;
+ s.fVMR9MixerYUV = !!m_fVMR9MixerYUV;
+
+ return __super::OnApply();
+}
+
+void CPPageOutput::OnUpdateMixerYUV(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!!IsDlgButtonChecked(IDC_DSVMR9LOADMIXER));
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/PPageOutput.h b/src/apps/mplayerc/PPageOutput.h
new file mode 100644
index 000000000..a79f1be24
--- /dev/null
+++ b/src/apps/mplayerc/PPageOutput.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+
+// CPPageOutput dialog
+
+class CPPageOutput : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageOutput)
+
+private:
+ CStringArray m_AudioRendererDisplayNames;
+
+ void DisableRadioButton(UINT nID, UINT nDefID);
+
+public:
+ CPPageOutput();
+ virtual ~CPPageOutput();
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEOUTPUT };
+ int m_iDSVideoRendererType;
+ int m_iRMVideoRendererType;
+ int m_iQTVideoRendererType;
+ int m_iAPSurfaceUsage;
+ int m_iAudioRendererType;
+ CComboBox m_iAudioRendererTypeCtrl;
+ BOOL m_fVMRSyncFix;
+ int m_iDX9Resizer;
+ BOOL m_fVMR9MixerMode;
+ BOOL m_fVMR9MixerYUV;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnUpdateMixerYUV(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/PPagePlayback.cpp b/src/apps/mplayerc/PPagePlayback.cpp
new file mode 100644
index 000000000..205020112
--- /dev/null
+++ b/src/apps/mplayerc/PPagePlayback.cpp
@@ -0,0 +1,210 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPagePlayback.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPagePlayback.h"
+
+// CPPagePlayback dialog
+
+IMPLEMENT_DYNAMIC(CPPagePlayback, CPPageBase)
+CPPagePlayback::CPPagePlayback()
+ : CPPageBase(CPPagePlayback::IDD, CPPagePlayback::IDD)
+ , m_iLoopForever(0)
+ , m_nLoops(0)
+ , m_fRewind(FALSE)
+ , m_iZoomLevel(0)
+ , m_iRememberZoomLevel(FALSE)
+ , m_fSetFullscreenRes(FALSE)
+ , m_nVolume(0)
+ , m_nBalance(0)
+ , m_fAutoloadAudio(FALSE)
+ , m_fAutoloadSubtitles(FALSE)
+ , m_fEnableWorkerThreadForOpening(FALSE)
+ , m_fReportFailedPins(FALSE)
+{
+}
+
+CPPagePlayback::~CPPagePlayback()
+{
+}
+
+void CPPagePlayback::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_SLIDER1, m_volumectrl);
+ DDX_Control(pDX, IDC_SLIDER2, m_balancectrl);
+ DDX_Slider(pDX, IDC_SLIDER1, m_nVolume);
+ DDX_Slider(pDX, IDC_SLIDER2, m_nBalance);
+ DDX_Radio(pDX, IDC_RADIO1, m_iLoopForever);
+ DDX_Control(pDX, IDC_EDIT1, m_loopnumctrl);
+ DDX_Text(pDX, IDC_EDIT1, m_nLoops);
+ DDX_Check(pDX, IDC_CHECK1, m_fRewind);
+ DDX_CBIndex(pDX, IDC_COMBO1, m_iZoomLevel);
+ DDX_Check(pDX, IDC_CHECK5, m_iRememberZoomLevel);
+ DDX_Check(pDX, IDC_CHECK4, m_fSetFullscreenRes);
+ DDX_Control(pDX, IDC_COMBO2, m_dispmodecombo);
+ DDX_Check(pDX, IDC_CHECK2, m_fAutoloadAudio);
+ DDX_Check(pDX, IDC_CHECK3, m_fAutoloadSubtitles);
+ DDX_Check(pDX, IDC_CHECK7, m_fEnableWorkerThreadForOpening);
+ DDX_Check(pDX, IDC_CHECK6, m_fReportFailedPins);
+}
+
+
+
+BEGIN_MESSAGE_MAP(CPPagePlayback, CPPageBase)
+ ON_WM_HSCROLL()
+ ON_CONTROL_RANGE(BN_CLICKED, IDC_RADIO1, IDC_RADIO2, OnBnClickedRadio12)
+ ON_UPDATE_COMMAND_UI(IDC_EDIT1, OnUpdateLoopNum)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdateLoopNum)
+ ON_UPDATE_COMMAND_UI(IDC_COMBO1, OnUpdateAutoZoomCombo)
+ ON_UPDATE_COMMAND_UI(IDC_COMBO2, OnUpdateDispModeCombo)
+END_MESSAGE_MAP()
+
+
+// CPPagePlayback message handlers
+
+BOOL CPPagePlayback::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_volumectrl.SetRange(1, 100);
+ m_volumectrl.SetTicFreq(10);
+ m_balancectrl.SetRange(0, 200);
+ m_balancectrl.SetTicFreq(20);
+ m_nVolume = s.nVolume;
+ m_nBalance = s.nBalance+100;
+ m_iLoopForever = s.fLoopForever?1:0;
+ m_nLoops = s.nLoops;
+ m_fRewind = s.fRewind;
+ m_iZoomLevel = s.iZoomLevel;
+ m_iRememberZoomLevel = s.fRememberZoomLevel;
+
+ m_fSetFullscreenRes = s.dmFullscreenRes.fValid;
+ int iSel = -1;
+ dispmode dm, dmtoset = s.dmFullscreenRes;
+ if(!dmtoset.fValid) GetCurDispMode(dmtoset);
+ for(int i = 0, j = 0; GetDispMode(i, dm); i++)
+ {
+ if(dm.bpp <= 8) continue;
+
+ m_dms.Add(dm);
+
+ CString str;
+ str.Format(_T("%dx%d %dbpp %dHz"), dm.size.cx, dm.size.cy, dm.bpp, dm.freq);
+ m_dispmodecombo.AddString(str);
+
+ if(iSel < 0 && dmtoset.fValid && dm.size == dmtoset.size
+ && dm.bpp == dmtoset.bpp && dm.freq == dmtoset.freq)
+ iSel = j;
+
+ j++;
+ }
+ m_dispmodecombo.SetCurSel(iSel);
+
+ m_fAutoloadAudio = s.fAutoloadAudio;
+ m_fAutoloadSubtitles = s.fAutoloadSubtitles;
+ m_fEnableWorkerThreadForOpening = s.fEnableWorkerThreadForOpening;
+ m_fReportFailedPins = s.fReportFailedPins;
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPagePlayback::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.nVolume = m_nVolume;
+ s.nBalance = m_nBalance-100;
+ s.fLoopForever = !!m_iLoopForever;
+ s.nLoops = m_nLoops;
+ s.fRewind = !!m_fRewind;
+ s.iZoomLevel = m_iZoomLevel;
+ s.fRememberZoomLevel = !!m_iRememberZoomLevel;
+ int iSel = m_dispmodecombo.GetCurSel();
+ if((s.dmFullscreenRes.fValid = !!m_fSetFullscreenRes) && iSel >= 0 && iSel < m_dms.GetCount())
+ s.dmFullscreenRes = m_dms[m_dispmodecombo.GetCurSel()];
+ s.fAutoloadAudio = !!m_fAutoloadAudio;
+ s.fAutoloadSubtitles = !!m_fAutoloadSubtitles;
+ s.fEnableWorkerThreadForOpening = !!m_fEnableWorkerThreadForOpening;
+ s.fReportFailedPins = !!m_fReportFailedPins;
+
+ return __super::OnApply();
+}
+
+LRESULT CPPagePlayback::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if(message == WM_HSCROLL || message == WM_VSCROLL)
+ {
+ SetModified();
+ }
+
+ return __super::DefWindowProc(message, wParam, lParam);
+}
+
+void CPPagePlayback::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ if(*pScrollBar == m_volumectrl)
+ {
+ UpdateData();
+ ((CMainFrame*)GetParentFrame())->m_wndToolBar.Volume = m_nVolume; // nice shortcut...
+ }
+ else if(*pScrollBar == m_balancectrl)
+ {
+ UpdateData();
+ ((CMainFrame*)GetParentFrame())->SetBalance(m_nBalance-100); // see prev note...
+ }
+
+ SetModified();
+
+ __super::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CPPagePlayback::OnBnClickedRadio12(UINT nID)
+{
+ SetModified();
+}
+
+void CPPagePlayback::OnUpdateLoopNum(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!!IsDlgButtonChecked(IDC_RADIO1));
+}
+
+void CPPagePlayback::OnUpdateAutoZoomCombo(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!!IsDlgButtonChecked(IDC_CHECK5));
+}
+
+void CPPagePlayback::OnUpdateDispModeCombo(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!!IsDlgButtonChecked(IDC_CHECK4));
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/PPagePlayback.h b/src/apps/mplayerc/PPagePlayback.h
new file mode 100644
index 000000000..63b9d7024
--- /dev/null
+++ b/src/apps/mplayerc/PPagePlayback.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+
+// CPPagePlayback dialog
+
+class CPPagePlayback : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPagePlayback)
+
+private:
+ CAtlArray<dispmode> m_dms;
+
+public:
+ CPPagePlayback();
+ virtual ~CPPagePlayback();
+
+ CSliderCtrl m_volumectrl;
+ CSliderCtrl m_balancectrl;
+ int m_nVolume;
+ int m_nBalance;
+ int m_iLoopForever;
+ CEdit m_loopnumctrl;
+ int m_nLoops;
+ BOOL m_fRewind;
+ int m_iZoomLevel;
+ BOOL m_iRememberZoomLevel;
+ BOOL m_fSetFullscreenRes;
+ CComboBox m_dispmodecombo;
+ BOOL m_fAutoloadAudio;
+ BOOL m_fAutoloadSubtitles;
+ BOOL m_fEnableWorkerThreadForOpening;
+ BOOL m_fReportFailedPins;
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEPLAYBACK };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+ virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+ afx_msg void OnBnClickedRadio12(UINT nID);
+ afx_msg void OnUpdateLoopNum(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateAutoZoomCombo(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateDispModeCombo(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/PPagePlayer.cpp b/src/apps/mplayerc/PPagePlayer.cpp
new file mode 100644
index 000000000..b401faa85
--- /dev/null
+++ b/src/apps/mplayerc/PPagePlayer.cpp
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+// PPagePlayer.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPagePlayer.h"
+
+// CPPagePlayer dialog
+
+IMPLEMENT_DYNAMIC(CPPagePlayer, CPPageBase)
+CPPagePlayer::CPPagePlayer()
+ : CPPageBase(CPPagePlayer::IDD, CPPagePlayer::IDD)
+ , m_iAllowMultipleInst(0)
+ , m_iAlwaysOnTop(FALSE)
+ , m_fTrayIcon(FALSE)
+ , m_iShowBarsWhenFullScreen(FALSE)
+ , m_nShowBarsWhenFullScreenTimeOut(0)
+ , m_iTitleBarTextStyle(0)
+ , m_fExitFullScreenAtTheEnd(FALSE)
+ , m_fRememberWindowPos(FALSE)
+ , m_fRememberWindowSize(FALSE)
+ , m_fSnapToDesktopEdges(FALSE)
+ , m_fUseIni(FALSE)
+ , m_fKeepHistory(FALSE)
+ , m_fHideCDROMsSubMenu(FALSE)
+ , m_priority(FALSE)
+ , m_launchfullscreen(FALSE)
+{
+}
+
+CPPagePlayer::~CPPagePlayer()
+{
+}
+
+void CPPagePlayer::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Radio(pDX, IDC_RADIO1, m_iAllowMultipleInst);
+ DDX_Radio(pDX, IDC_RADIO3, m_iTitleBarTextStyle);
+ DDX_Check(pDX, IDC_CHECK13, m_bTitleBarTextTitle);
+ DDX_Check(pDX, IDC_CHECK2, m_iAlwaysOnTop);
+ DDX_Check(pDX, IDC_CHECK3, m_fTrayIcon);
+ DDX_Check(pDX, IDC_CHECK4, m_iShowBarsWhenFullScreen);
+ DDX_Text(pDX, IDC_EDIT1, m_nShowBarsWhenFullScreenTimeOut);
+ DDX_Check(pDX, IDC_CHECK5, m_fExitFullScreenAtTheEnd);
+ DDX_Check(pDX, IDC_CHECK6, m_fRememberWindowPos);
+ DDX_Check(pDX, IDC_CHECK7, m_fRememberWindowSize);
+ DDX_Check(pDX, IDC_CHECK12, m_fSnapToDesktopEdges);
+ DDX_Check(pDX, IDC_CHECK8, m_fUseIni);
+ DDX_Control(pDX, IDC_SPIN1, m_nTimeOutCtrl);
+ DDX_Check(pDX, IDC_CHECK1, m_fKeepHistory);
+ DDX_Check(pDX, IDC_CHECK10, m_fHideCDROMsSubMenu);
+ DDX_Check(pDX, IDC_CHECK9, m_priority);
+ DDX_Check(pDX, IDC_CHECK11, m_launchfullscreen);
+}
+
+BEGIN_MESSAGE_MAP(CPPagePlayer, CPPageBase)
+ ON_BN_CLICKED(IDC_CHECK8, OnBnClickedCheck8)
+ ON_UPDATE_COMMAND_UI(IDC_SPIN1, OnUpdateTimeout)
+ ON_UPDATE_COMMAND_UI(IDC_EDIT1, OnUpdateTimeout)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdateTimeout)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC2, OnUpdateTimeout)
+ ON_UPDATE_COMMAND_UI(IDC_CHECK13, OnUpdateCheck13)
+END_MESSAGE_MAP()
+
+// CPPagePlayer message handlers
+
+BOOL CPPagePlayer::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_iAllowMultipleInst = s.fAllowMultipleInst;
+ m_iTitleBarTextStyle = s.iTitleBarTextStyle;
+ m_bTitleBarTextTitle = s.fTitleBarTextTitle;
+ m_iAlwaysOnTop = s.iOnTop;
+ m_fTrayIcon = s.fTrayIcon;
+ m_iShowBarsWhenFullScreen = s.fShowBarsWhenFullScreen;
+ m_nShowBarsWhenFullScreenTimeOut = s.nShowBarsWhenFullScreenTimeOut;
+ m_nTimeOutCtrl.SetRange(-1, 10);
+ m_fExitFullScreenAtTheEnd = s.fExitFullScreenAtTheEnd;
+ m_fRememberWindowPos = s.fRememberWindowPos;
+ m_fRememberWindowSize = s.fRememberWindowSize;
+ m_fSnapToDesktopEdges = s.fSnapToDesktopEdges;
+ m_fUseIni = ((CMPlayerCApp*)AfxGetApp())->IsIniValid();
+ m_fKeepHistory = s.fKeepHistory;
+ m_fHideCDROMsSubMenu = s.fHideCDROMsSubMenu;
+ m_priority = s.priority != NORMAL_PRIORITY_CLASS;
+ m_launchfullscreen = s.launchfullscreen;
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPagePlayer::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.fAllowMultipleInst = !!m_iAllowMultipleInst;
+ s.iTitleBarTextStyle = m_iTitleBarTextStyle;
+ s.fTitleBarTextTitle = !!m_bTitleBarTextTitle;
+ s.iOnTop = m_iAlwaysOnTop;
+ s.fTrayIcon = !!m_fTrayIcon;
+ s.fShowBarsWhenFullScreen = !!m_iShowBarsWhenFullScreen;
+ s.nShowBarsWhenFullScreenTimeOut = m_nShowBarsWhenFullScreenTimeOut;
+ s.fExitFullScreenAtTheEnd = !!m_fExitFullScreenAtTheEnd;
+ s.fRememberWindowPos = !!m_fRememberWindowPos;
+ s.fRememberWindowSize = !!m_fRememberWindowSize;
+ s.fSnapToDesktopEdges = !!m_fSnapToDesktopEdges;
+ s.fKeepHistory = !!m_fKeepHistory;
+ s.fHideCDROMsSubMenu = !!m_fHideCDROMsSubMenu;
+ s.priority = !m_priority ? NORMAL_PRIORITY_CLASS : GetVersion() < 0 ? HIGH_PRIORITY_CLASS : ABOVE_NORMAL_PRIORITY_CLASS;
+ s.launchfullscreen = !!m_launchfullscreen;
+
+ if(!m_fKeepHistory)
+ {
+ for(int i = 0; i < s.MRU.GetSize(); i++) s.MRU.Remove(i);
+ for(int i = 0; i < s.MRUDub.GetSize(); i++) s.MRUDub.Remove(i);
+ s.MRU.WriteList();
+ s.MRUDub.WriteList();
+ }
+
+ ((CMainFrame*)AfxGetMainWnd())->ShowTrayIcon(s.fTrayIcon);
+
+ ::SetPriorityClass(::GetCurrentProcess(), s.priority);
+
+ return __super::OnApply();
+}
+
+void CPPagePlayer::OnBnClickedCheck8()
+{
+ UpdateData();
+
+ if(m_fUseIni) ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToIni();
+ else ((CMPlayerCApp*)AfxGetApp())->StoreSettingsToRegistry();
+
+ SetModified();
+}
+
+void CPPagePlayer::OnUpdateTimeout(CCmdUI* pCmdUI)
+{
+ UpdateData();
+
+ pCmdUI->Enable(m_iShowBarsWhenFullScreen);
+}
+
+void CPPagePlayer::OnUpdateCheck13(CCmdUI* pCmdUI)
+{
+ UpdateData();
+
+ pCmdUI->Enable(m_iTitleBarTextStyle == 1);
+}
diff --git a/src/apps/mplayerc/PPagePlayer.h b/src/apps/mplayerc/PPagePlayer.h
new file mode 100644
index 000000000..e3980ff43
--- /dev/null
+++ b/src/apps/mplayerc/PPagePlayer.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+
+// CPPagePlayer dialog
+
+class CPPagePlayer : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPagePlayer)
+
+public:
+ CPPagePlayer();
+ virtual ~CPPagePlayer();
+
+ int m_iAllowMultipleInst;
+ int m_iTitleBarTextStyle;
+ BOOL m_bTitleBarTextTitle;
+ BOOL m_iAlwaysOnTop;
+ BOOL m_iShowBarsWhenFullScreen;
+ int m_nShowBarsWhenFullScreenTimeOut;
+ BOOL m_fExitFullScreenAtTheEnd;
+ BOOL m_fRememberWindowPos;
+ BOOL m_fRememberWindowSize;
+ BOOL m_fSnapToDesktopEdges;
+ BOOL m_fUseIni;
+ CSpinButtonCtrl m_nTimeOutCtrl;
+ BOOL m_fTrayIcon;
+ BOOL m_fKeepHistory;
+ BOOL m_fHideCDROMsSubMenu;
+ BOOL m_priority;
+ BOOL m_launchfullscreen;
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEPLAYER };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedCheck8();
+ afx_msg void OnUpdateTimeout(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateCheck13(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/PPageSheet.cpp b/src/apps/mplayerc/PPageSheet.cpp
new file mode 100644
index 000000000..13bc4559b
--- /dev/null
+++ b/src/apps/mplayerc/PPageSheet.cpp
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageSheet.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageSheet.h"
+
+// CPPageSheet
+
+IMPLEMENT_DYNAMIC(CPPageSheet, CTreePropSheet)
+
+CPPageSheet::CPPageSheet(LPCTSTR pszCaption, IFilterGraph* pFG, CWnd* pParentWnd, UINT idPage)
+ : CTreePropSheet(pszCaption, pParentWnd, 0)
+ , m_audioswitcher(pFG)
+{
+ AddPage(&m_player);
+ AddPage(&m_formats);
+ AddPage(&m_acceltbl);
+ AddPage(&m_logo);
+ AddPage(&m_playback);
+ AddPage(&m_dvd);
+ AddPage(&m_output);
+ AddPage(&m_webserver);
+ AddPage(&m_internalfilters);
+ AddPage(&m_audioswitcher);
+ AddPage(&m_externalfilters);
+ AddPage(&m_subtitles);
+ AddPage(&m_substyle);
+ AddPage(&m_subdb);
+ AddPage(&m_tweaks);
+ AddPage(&m_casimir);
+
+ EnableStackedTabs(FALSE);
+
+ SetTreeViewMode(TRUE, TRUE, FALSE);
+
+ if(idPage || (idPage = AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("LastUsedPage"), 0)))
+ {
+ for(int i = 0; i < GetPageCount(); i++)
+ {
+ if(GetPage(i)->m_pPSP->pszTemplate == MAKEINTRESOURCE(idPage))
+ {
+ SetActivePage(i);
+ break;
+ }
+ }
+ }
+}
+
+CPPageSheet::~CPPageSheet()
+{
+}
+
+CTreeCtrl* CPPageSheet::CreatePageTreeObject()
+{
+ return new CTreePropSheetTreeCtrl();
+}
+
+BEGIN_MESSAGE_MAP(CPPageSheet, CTreePropSheet)
+END_MESSAGE_MAP()
+
+BOOL CPPageSheet::OnInitDialog()
+{
+ BOOL bResult = __super::OnInitDialog();
+
+ if(CTreeCtrl* pTree = GetPageTreeControl())
+ {
+ for(HTREEITEM node = pTree->GetRootItem(); node; node = pTree->GetNextSiblingItem(node))
+ pTree->Expand(node, TVE_EXPAND);
+ }
+
+ return bResult;
+}
+
+// CTreePropSheetTreeCtrl
+
+IMPLEMENT_DYNAMIC(CTreePropSheetTreeCtrl, CTreeCtrl)
+CTreePropSheetTreeCtrl::CTreePropSheetTreeCtrl()
+{
+}
+
+CTreePropSheetTreeCtrl::~CTreePropSheetTreeCtrl()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CTreePropSheetTreeCtrl, CTreeCtrl)
+END_MESSAGE_MAP()
+
+// CTreePropSheetTreeCtrl message handlers
+
+
+BOOL CTreePropSheetTreeCtrl::PreCreateWindow(CREATESTRUCT& cs)
+{
+ cs.dwExStyle |= WS_EX_CLIENTEDGE;
+// cs.style &= ~TVS_LINESATROOT;
+
+ return __super::PreCreateWindow(cs);
+}
+
diff --git a/src/apps/mplayerc/PPageSheet.h b/src/apps/mplayerc/PPageSheet.h
new file mode 100644
index 000000000..15810239d
--- /dev/null
+++ b/src/apps/mplayerc/PPageSheet.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+using namespace TreePropSheet;
+
+#include "PPagePlayer.h"
+#include "PPageFormats.h"
+#include "PPageAccelTbl.h"
+#include "PPageLogo.h"
+#include "PPagePlayback.h"
+#include "PPageDVD.h"
+#include "PPageOutput.h"
+#include "PPageWebServer.h"
+#include "PPageInternalFilters.h"
+#include "PPageAudioSwitcher.h"
+#include "PPageExternalFilters.h"
+#include "PPageSubtitles.h"
+#include "PPageSubStyle.h"
+#include "PPageSubDB.h"
+#include "PPageTweaks.h"
+#include "PPageCasimir.h"
+
+// CTreePropSheetTreeCtrl
+
+class CTreePropSheetTreeCtrl : public CTreeCtrl
+{
+ DECLARE_DYNAMIC(CTreePropSheetTreeCtrl)
+
+public:
+ CTreePropSheetTreeCtrl();
+ virtual ~CTreePropSheetTreeCtrl();
+
+protected:
+ DECLARE_MESSAGE_MAP()
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+};
+
+// CPPageSheet
+
+class CPPageSheet : public CTreePropSheet
+{
+ DECLARE_DYNAMIC(CPPageSheet)
+
+private:
+ CPPagePlayer m_player;
+ CPPageFormats m_formats;
+ CPPageAccelTbl m_acceltbl;
+ CPPageLogo m_logo;
+ CPPagePlayback m_playback;
+ CPPageDVD m_dvd;
+ CPPageOutput m_output;
+ CPPageWebServer m_webserver;
+ CPPageSubtitles m_subtitles;
+ CPPageSubStyle m_substyle;
+ CPPageSubDB m_subdb;
+ CPPageInternalFilters m_internalfilters;
+ CPPageAudioSwitcher m_audioswitcher;
+ CPPageExternalFilters m_externalfilters;
+ CPPageTweaks m_tweaks;
+ CPPageCasimir m_casimir;
+
+ CTreeCtrl* CreatePageTreeObject();
+
+public:
+ CPPageSheet(LPCTSTR pszCaption, IFilterGraph* pFG, CWnd* pParentWnd, UINT idPage = 0);
+ virtual ~CPPageSheet();
+
+protected:
+ DECLARE_MESSAGE_MAP()
+public:
+ virtual BOOL OnInitDialog();
+};
diff --git a/src/apps/mplayerc/PPageSubDB.cpp b/src/apps/mplayerc/PPageSubDB.cpp
new file mode 100644
index 000000000..3a0aedaef
--- /dev/null
+++ b/src/apps/mplayerc/PPageSubDB.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageSubDB.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPageSubDB.h"
+#include "ISDb.h"
+
+// CPPageSubDB dialog
+
+IMPLEMENT_DYNAMIC(CPPageSubDB, CPPageBase)
+CPPageSubDB::CPPageSubDB()
+ : CPPageBase(CPPageSubDB::IDD, CPPageSubDB::IDD)
+ , m_ISDb(_T(""))
+{
+}
+
+CPPageSubDB::~CPPageSubDB()
+{
+}
+
+void CPPageSubDB::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO1, m_ISDbCombo);
+ DDX_CBString(pDX, IDC_COMBO1, m_ISDb);
+}
+
+BEGIN_MESSAGE_MAP(CPPageSubDB, CPPageBase)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateButton1)
+END_MESSAGE_MAP()
+
+
+// CPPageSubDB message handlers
+
+BOOL CPPageSubDB::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_ISDb = s.ISDb;
+ m_ISDbCombo.AddString(m_ISDb);
+ if(m_ISDb.CompareNoCase(_T("sub.sytes.net")))
+ m_ISDbCombo.AddString(_T("sub.sytes.net"));
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageSubDB::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.ISDb = m_ISDb;
+ s.ISDb.TrimRight('/');
+
+ return __super::OnApply();
+}
+
+void CPPageSubDB::OnBnClickedButton1()
+{
+ CString ISDb, ver, msg, str;
+
+ m_ISDbCombo.GetWindowText(ISDb);
+ ISDb.TrimRight('/');
+
+ ver.Format(_T("ISDb v%d"), ISDb_PROTOCOL_VERSION);
+
+ CWebTextFile wtf;
+ if(wtf.Open(_T("http://") + ISDb + _T("/test.php")) && wtf.ReadString(str) && str == ver)
+ {
+ msg = _T("The URL appears to be correct!");
+ }
+ else if(str.Find(_T("ISDb v")) == 0)
+ {
+ msg = _T("Protocol version mismatch, please upgrade your player or choose a different address!");
+ }
+ else
+ {
+ msg = _T("Bad URL, could not locate subtitle database there!");
+ }
+
+ AfxMessageBox(msg, MB_OK);
+}
+
+void CPPageSubDB::OnUpdateButton1(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_ISDbCombo.GetWindowTextLength() > 0);
+}
diff --git a/src/apps/mplayerc/PPageSubDB.h b/src/apps/mplayerc/PPageSubDB.h
new file mode 100644
index 000000000..8c537a719
--- /dev/null
+++ b/src/apps/mplayerc/PPageSubDB.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxwin.h"
+
+// CPPageSubDB dialog
+
+class CPPageSubDB : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageSubDB)
+
+public:
+ CPPageSubDB();
+ virtual ~CPPageSubDB();
+
+// Dialog Data
+ enum { IDD = IDD_PPAGESUBDB };
+ CComboBox m_ISDbCombo;
+ CString m_ISDb;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnUpdateButton1(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/PPageSubStyle.cpp b/src/apps/mplayerc/PPageSubStyle.cpp
new file mode 100644
index 000000000..e68be0a39
--- /dev/null
+++ b/src/apps/mplayerc/PPageSubStyle.cpp
@@ -0,0 +1,303 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageSubStyle.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <math.h>
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPageSubStyle.h"
+
+// CColorStatic
+
+//IMPLEMENT_DYNAMIC(CColorStatic, CStatic)
+
+//BEGIN_MESSAGE_MAP(CColorStatic, CStatic)
+//END_MESSAGE_MAP()
+
+// CPPageSubStyle dialog
+
+IMPLEMENT_DYNAMIC(CPPageSubStyle, CPPageBase)
+CPPageSubStyle::CPPageSubStyle()
+ : CPPageBase(CPPageSubStyle::IDD, CPPageSubStyle::IDD)
+ , m_iCharset(0)
+ , m_spacing(0)
+ , m_angle(0)
+ , m_scalex(0)
+ , m_scaley(0)
+ , m_borderstyle(0)
+ , m_borderwidth(0)
+ , m_shadowdepth(0)
+ , m_screenalignment(0)
+ , m_margin(0,0,0,0)
+ , m_linkalphasliders(FALSE)
+ , m_relativeTo(FALSE)
+{
+ m_stss = AfxGetAppSettings().subdefstyle;
+ m_fUseDefaultStyle = true;
+}
+
+CPPageSubStyle::~CPPageSubStyle()
+{
+}
+
+void CPPageSubStyle::InitStyle(CString title, STSStyle& stss)
+{
+ m_pPSP->pszTitle = (m_title = title);
+ m_psp.dwFlags |= PSP_USETITLE;
+
+ m_stss = stss;
+ m_fUseDefaultStyle = false;
+}
+
+void CPPageSubStyle::AskColor(int i)
+{
+ CColorDialog dlg(m_stss.colors[i]);
+ dlg.m_cc.Flags |= CC_FULLOPEN;
+ if(dlg.DoModal() == IDOK)
+ {
+ m_stss.colors[i] = dlg.m_cc.rgbResult;
+ m_color[i].Invalidate();
+ }
+}
+
+void CPPageSubStyle::DoDataExchange(CDataExchange* pDX)
+{
+ CPPageBase::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_BUTTON1, m_font);
+ DDX_CBIndex(pDX, IDC_COMBO1, m_iCharset);
+ DDX_Control(pDX, IDC_COMBO1, m_charset);
+ DDX_Text(pDX, IDC_EDIT3, m_spacing);
+ DDX_Control(pDX, IDC_SPIN3, m_spacingspin);
+ DDX_Text(pDX, IDC_EDIT4, m_angle);
+ DDX_Control(pDX, IDC_SPIN10, m_anglespin);
+ DDX_Text(pDX, IDC_EDIT5, m_scalex);
+ DDX_Control(pDX, IDC_SPIN4, m_scalexspin);
+ DDX_Text(pDX, IDC_EDIT6, m_scaley);
+ DDX_Control(pDX, IDC_SPIN5, m_scaleyspin);
+ DDX_Radio(pDX, IDC_RADIO1, m_borderstyle);
+ DDX_Text(pDX, IDC_EDIT1, m_borderwidth);
+ DDX_Control(pDX, IDC_SPIN1, m_borderwidthspin);
+ DDX_Text(pDX, IDC_EDIT2, m_shadowdepth);
+ DDX_Control(pDX, IDC_SPIN2, m_shadowdepthspin);
+ DDX_Radio(pDX, IDC_RADIO3, m_screenalignment);
+ DDX_Text(pDX, IDC_EDIT7, m_margin.left);
+ DDX_Control(pDX, IDC_SPIN6, m_marginleftspin);
+ DDX_Text(pDX, IDC_EDIT8, m_margin.right);
+ DDX_Control(pDX, IDC_SPIN7, m_marginrightspin);
+ DDX_Text(pDX, IDC_EDIT9, m_margin.top);
+ DDX_Control(pDX, IDC_SPIN8, m_margintopspin);
+ DDX_Text(pDX, IDC_EDIT10, m_margin.bottom);
+ DDX_Control(pDX, IDC_SPIN9, m_marginbottomspin);
+ DDX_Control(pDX, IDC_COLORPRI, m_color[0]);
+ DDX_Control(pDX, IDC_COLORSEC, m_color[1]);
+ DDX_Control(pDX, IDC_COLOROUTL, m_color[2]);
+ DDX_Control(pDX, IDC_COLORSHAD, m_color[3]);
+ DDX_Slider(pDX, IDC_SLIDER1, m_alpha[0]);
+ DDX_Slider(pDX, IDC_SLIDER2, m_alpha[1]);
+ DDX_Slider(pDX, IDC_SLIDER3, m_alpha[2]);
+ DDX_Slider(pDX, IDC_SLIDER4, m_alpha[3]);
+ DDX_Control(pDX, IDC_SLIDER1, m_alphasliders[0]);
+ DDX_Control(pDX, IDC_SLIDER2, m_alphasliders[1]);
+ DDX_Control(pDX, IDC_SLIDER3, m_alphasliders[2]);
+ DDX_Control(pDX, IDC_SLIDER4, m_alphasliders[3]);
+ DDX_Check(pDX, IDC_CHECK1, m_linkalphasliders);
+ DDX_Check(pDX, IDC_CHECK_RELATIVETO, m_relativeTo);
+}
+
+
+BEGIN_MESSAGE_MAP(CPPageSubStyle, CPPageBase)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_STN_CLICKED(IDC_COLORPRI, OnStnClickedColorpri)
+ ON_STN_CLICKED(IDC_COLORSEC, OnStnClickedColorsec)
+ ON_STN_CLICKED(IDC_COLOROUTL, OnStnClickedColoroutl)
+ ON_STN_CLICKED(IDC_COLORSHAD, OnStnClickedColorshad)
+ ON_BN_CLICKED(IDC_CHECK1, OnBnClickedCheck1)
+ ON_WM_HSCROLL()
+END_MESSAGE_MAP()
+
+
+// CPPageSubStyle message handlers
+
+BOOL CPPageSubStyle::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ m_font.SetWindowText(m_stss.fontName);
+ m_iCharset = -1;
+ for(int i = 0; i < CharSetLen; i++)
+ {
+ CString str;
+ str.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
+ m_charset.AddString(str);
+ m_charset.SetItemData(i, CharSetList[i]);
+ if(m_stss.charSet == CharSetList[i]) m_iCharset = i;
+ }
+
+ // TODO: allow floats in these edit boxes
+ m_spacing = (int)m_stss.fontSpacing;
+ m_spacingspin.SetRange32(-10000, 10000);
+ while(m_stss.fontAngleZ < 0) m_stss.fontAngleZ += 360;
+ m_angle = (int)fmod(m_stss.fontAngleZ, 360);
+ m_anglespin.SetRange32(0, 359);
+ m_scalex = (int)m_stss.fontScaleX;
+ m_scalexspin.SetRange32(-10000, 10000);
+ m_scaley = (int)m_stss.fontScaleY;
+ m_scaleyspin.SetRange32(-10000, 10000);
+
+ m_borderstyle = m_stss.borderStyle;
+ m_borderwidth = (int)m_stss.outlineWidth;
+ m_borderwidthspin.SetRange32(0, 10000);
+ m_shadowdepth = (int)m_stss.shadowDepth;
+ m_shadowdepthspin.SetRange32(0, 10000);
+
+ m_screenalignment = m_stss.scrAlignment-1;
+ m_margin = m_stss.marginRect;
+ m_marginleftspin.SetRange32(-10000, 10000);
+ m_marginrightspin.SetRange32(-10000, 10000);
+ m_margintopspin.SetRange32(-10000, 10000);
+ m_marginbottomspin.SetRange32(-10000, 10000);
+ m_relativeTo = m_stss.relativeTo;
+
+ for(int i = 0; i < 4; i++)
+ {
+ m_color[i].SetColorPtr(&m_stss.colors[i]);
+ m_alpha[i] = 255-m_stss.alpha[i];
+ m_alphasliders[i].SetRange(0, 255);
+ }
+
+ m_linkalphasliders = FALSE;
+
+ UpdateData(FALSE);
+
+ CreateToolTip();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageSubStyle::OnApply()
+{
+ UpdateData();
+
+ if(m_iCharset >= 0) m_stss.charSet = m_charset.GetItemData(m_iCharset);
+ m_stss.fontSpacing = m_spacing;
+ m_stss.fontAngleZ = m_angle;
+ m_stss.fontScaleX = m_scalex;
+ m_stss.fontScaleY = m_scaley;
+
+ m_stss.borderStyle = m_borderstyle;
+ m_stss.outlineWidth = m_borderwidth;
+ m_stss.shadowDepth = m_shadowdepth;
+
+ m_stss.scrAlignment = m_screenalignment+1;
+ m_stss.marginRect = m_margin;
+ m_stss.relativeTo = m_relativeTo;
+
+ for(int i = 0; i < 4; i++) m_stss.alpha[i] = 255-m_alpha[i];
+
+ if(m_fUseDefaultStyle)
+ {
+ STSStyle& stss = AfxGetAppSettings().subdefstyle;
+ if(!(stss == m_stss))
+ {
+ stss = m_stss;
+ if(CMainFrame* pFrame = dynamic_cast<CMainFrame*>(AfxGetMainWnd()))
+ pFrame->UpdateSubtitle(true);
+ }
+ }
+
+ return __super::OnApply();
+}
+
+void CPPageSubStyle::OnBnClickedButton1()
+{
+ LOGFONT lf;
+ lf <<= m_stss;
+
+ CFontDialog dlg(&lf, CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|CF_SCALABLEONLY|CF_EFFECTS);
+ if(dlg.DoModal() == IDOK)
+ {
+ CString str(lf.lfFaceName);
+ if(str.GetLength() > 16) str = str.Left(14) + _T("...");
+ m_font.SetWindowText(str);
+
+ for(int i = 0, j = m_charset.GetCount(); i < j; i++)
+ {
+ if(m_charset.GetItemData(i) == lf.lfCharSet)
+ {
+ m_charset.SetCurSel(i);
+ break;
+ }
+ }
+
+ m_stss = lf;
+
+ SetModified();
+ }
+}
+
+void CPPageSubStyle::OnStnClickedColorpri()
+{
+ AskColor(0);
+}
+
+void CPPageSubStyle::OnStnClickedColorsec()
+{
+ AskColor(1);
+}
+
+void CPPageSubStyle::OnStnClickedColoroutl()
+{
+ AskColor(2);
+}
+
+void CPPageSubStyle::OnStnClickedColorshad()
+{
+ AskColor(3);
+}
+
+void CPPageSubStyle::OnBnClickedCheck1()
+{
+ UpdateData();
+
+ int avg = 0;
+ for(int i = 0; i < 4; i++) avg += m_alphasliders[i].GetPos();
+ avg /= 4;
+ for(int i = 0; i < 4; i++) m_alphasliders[i].SetPos(avg);
+
+ SetModified();
+}
+
+void CPPageSubStyle::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ if(m_linkalphasliders && pScrollBar)
+ {
+ int pos = ((CSliderCtrl*)pScrollBar)->GetPos();
+ for(int i = 0; i < 4; i++) m_alphasliders[i].SetPos(pos);
+ }
+
+ SetModified();
+
+ __super::OnHScroll(nSBCode, nPos, pScrollBar);
+}
diff --git a/src/apps/mplayerc/PPageSubStyle.h b/src/apps/mplayerc/PPageSubStyle.h
new file mode 100644
index 000000000..ccf852e29
--- /dev/null
+++ b/src/apps/mplayerc/PPageSubStyle.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+#include "..\..\subtitles\STS.h"
+
+class CColorStatic : public CStatic
+{
+// DECLARE_DYNAMIC(CColorStatic)
+
+ COLORREF* m_pColor;
+
+public:
+ CColorStatic(CWnd* pParent = NULL) : m_pColor(NULL) {}
+ virtual ~CColorStatic() {}
+
+ void SetColorPtr(COLORREF* pColor) {m_pColor = pColor;}
+
+// DECLARE_MESSAGE_MAP()
+
+protected:
+ virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
+ {
+ CRect r;
+ GetClientRect(r);
+ CDC::FromHandle(lpDrawItemStruct->hDC)->FillSolidRect(r, m_pColor ? *m_pColor : ::GetSysColor(COLOR_BTNFACE));
+ }
+};
+
+// CPPageSubStyle dialog
+
+class CPPageSubStyle : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageSubStyle)
+
+private:
+ CString m_title;
+ STSStyle m_stss;
+ bool m_fUseDefaultStyle;
+
+ void AskColor(int i);
+
+public:
+ CPPageSubStyle();
+ virtual ~CPPageSubStyle();
+
+ void InitStyle(CString title, STSStyle& stss);
+ void GetStyle(STSStyle& stss) {stss = m_stss;}
+
+// Dialog Data
+ enum { IDD = IDD_PPAGESUBSTYLE };
+ CButton m_font;
+ int m_iCharset;
+ CComboBox m_charset;
+ int m_spacing;
+ CSpinButtonCtrl m_spacingspin;
+ int m_angle;
+ CSpinButtonCtrl m_anglespin;
+ int m_scalex;
+ CSpinButtonCtrl m_scalexspin;
+ int m_scaley;
+ CSpinButtonCtrl m_scaleyspin;
+ int m_borderstyle;
+ int m_borderwidth;
+ CSpinButtonCtrl m_borderwidthspin;
+ int m_shadowdepth;
+ CSpinButtonCtrl m_shadowdepthspin;
+ int m_screenalignment;
+ CRect m_margin;
+ CSpinButtonCtrl m_marginleftspin;
+ CSpinButtonCtrl m_marginrightspin;
+ CSpinButtonCtrl m_margintopspin;
+ CSpinButtonCtrl m_marginbottomspin;
+ CColorStatic m_color[4];
+ int m_alpha[4];
+ CSliderCtrl m_alphasliders[4];
+ BOOL m_linkalphasliders;
+ BOOL m_relativeTo;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnStnClickedColorpri();
+ afx_msg void OnStnClickedColorsec();
+ afx_msg void OnStnClickedColoroutl();
+ afx_msg void OnStnClickedColorshad();
+ afx_msg void OnBnClickedCheck1();
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+public:
+};
diff --git a/src/apps/mplayerc/PPageSubtitles.cpp b/src/apps/mplayerc/PPageSubtitles.cpp
new file mode 100644
index 000000000..b19db1896
--- /dev/null
+++ b/src/apps/mplayerc/PPageSubtitles.cpp
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageSubtitles.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPageSubtitles.h"
+
+// CPPageSubtitles dialog
+
+IMPLEMENT_DYNAMIC(CPPageSubtitles, CPPageBase)
+CPPageSubtitles::CPPageSubtitles()
+ : CPPageBase(CPPageSubtitles::IDD, CPPageSubtitles::IDD)
+ , m_fOverridePlacement(FALSE)
+ , m_nHorPos(0)
+ , m_nVerPos(0)
+ , m_nSPCSize(0)
+ , m_fSPCPow2Tex(FALSE)
+{
+}
+
+CPPageSubtitles::~CPPageSubtitles()
+{
+}
+
+void CPPageSubtitles::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Check(pDX, IDC_CHECK3, m_fOverridePlacement);
+ DDX_Text(pDX, IDC_EDIT2, m_nHorPos);
+ DDX_Control(pDX, IDC_SPIN2, m_nHorPosCtrl);
+ DDX_Text(pDX, IDC_EDIT3, m_nVerPos);
+ DDX_Control(pDX, IDC_SPIN3, m_nVerPosCtrl);
+ DDX_Text(pDX, IDC_EDIT1, m_nSPCSize);
+ DDX_Control(pDX, IDC_SPIN1, m_nSPCSizeCtrl);
+ DDX_Control(pDX, IDC_COMBO1, m_spmaxres);
+ DDX_Control(pDX, IDC_EDIT2, m_nHorPosEdit);
+ DDX_Control(pDX, IDC_EDIT3, m_nVerPosEdit);
+ DDX_Check(pDX, IDC_CHECK_SPCPOW2TEX, m_fSPCPow2Tex);
+}
+
+
+BEGIN_MESSAGE_MAP(CPPageSubtitles, CPPageBase)
+ ON_UPDATE_COMMAND_UI(IDC_EDIT2, OnUpdatePosOverride)
+ ON_UPDATE_COMMAND_UI(IDC_SPIN2, OnUpdatePosOverride)
+ ON_UPDATE_COMMAND_UI(IDC_EDIT3, OnUpdatePosOverride)
+ ON_UPDATE_COMMAND_UI(IDC_SPIN3, OnUpdatePosOverride)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC1, OnUpdatePosOverride)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC2, OnUpdatePosOverride)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC3, OnUpdatePosOverride)
+ ON_UPDATE_COMMAND_UI(IDC_STATIC4, OnUpdatePosOverride)
+END_MESSAGE_MAP()
+
+
+// CPPageSubtitles message handlers
+
+BOOL CPPageSubtitles::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_fOverridePlacement = s.fOverridePlacement;
+ m_nHorPos = s.nHorPos;
+ m_nHorPosCtrl.SetRange(-10,110);
+ m_nVerPos = s.nVerPos;
+ m_nVerPosCtrl.SetRange(110,-10);
+ m_nSPCSize = s.nSPCSize;
+ m_nSPCSizeCtrl.SetRange(0, 10);
+ m_spmaxres.AddString(_T("Desktop"));
+ m_spmaxres.AddString(_T("1024x768"));
+ m_spmaxres.AddString(_T("800x600"));
+ m_spmaxres.AddString(_T("640x480"));
+ m_spmaxres.AddString(_T("512x384"));
+ m_spmaxres.AddString(_T("384x288"));
+ m_spmaxres.SetCurSel(s.nSPCMaxRes);
+ m_fSPCPow2Tex = s.fSPCPow2Tex;
+
+ UpdateData(FALSE);
+
+ CreateToolTip();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageSubtitles::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ if(s.fOverridePlacement != !!m_fOverridePlacement
+ || s.nHorPos != m_nHorPos
+ || s.nVerPos != m_nVerPos
+ || s.nSPCSize != m_nSPCSize
+ || s.nSPCMaxRes != m_spmaxres.GetCurSel()
+ || s.fSPCPow2Tex != !!m_fSPCPow2Tex)
+ {
+ s.fOverridePlacement = !!m_fOverridePlacement;
+ s.nHorPos = m_nHorPos;
+ s.nVerPos = m_nVerPos;
+ s.nSPCSize = m_nSPCSize;
+ s.nSPCMaxRes = m_spmaxres.GetCurSel();
+ s.fSPCPow2Tex = !!m_fSPCPow2Tex;
+
+ if(CMainFrame* pFrame = (CMainFrame*)GetParentFrame())
+ pFrame->UpdateSubtitle(true);
+ }
+
+ return __super::OnApply();
+}
+
+void CPPageSubtitles::OnUpdatePosOverride(CCmdUI* pCmdUI)
+{
+ UpdateData();
+ pCmdUI->Enable(m_fOverridePlacement);
+}
diff --git a/src/apps/mplayerc/PPageSubtitles.h b/src/apps/mplayerc/PPageSubtitles.h
new file mode 100644
index 000000000..54c8d012c
--- /dev/null
+++ b/src/apps/mplayerc/PPageSubtitles.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\subtitles\STS.h"
+
+// CPPageSubtitles dialog
+
+class CPPageSubtitles : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageSubtitles)
+
+public:
+ CPPageSubtitles();
+ virtual ~CPPageSubtitles();
+
+ BOOL m_fOverridePlacement;
+ int m_nHorPos;
+ CEdit m_nHorPosEdit;
+ CSpinButtonCtrl m_nHorPosCtrl;
+ int m_nVerPos;
+ CEdit m_nVerPosEdit;
+ CSpinButtonCtrl m_nVerPosCtrl;
+ int m_nSPCSize;
+ CSpinButtonCtrl m_nSPCSizeCtrl;
+ CComboBox m_spmaxres;
+ BOOL m_fSPCPow2Tex;
+
+// Dialog Data
+ enum { IDD = IDD_PPAGESUBTITLES };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnUpdatePosOverride(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/PPageTweaks.cpp b/src/apps/mplayerc/PPageTweaks.cpp
new file mode 100644
index 000000000..9bad729c6
--- /dev/null
+++ b/src/apps/mplayerc/PPageTweaks.cpp
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageTweaks.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PPageTweaks.h"
+
+// CPPageTweaks dialog
+
+IMPLEMENT_DYNAMIC(CPPageTweaks, CPPageBase)
+CPPageTweaks::CPPageTweaks()
+ : CPPageBase(CPPageTweaks::IDD, CPPageTweaks::IDD)
+ , m_fDisabeXPToolbars(FALSE)
+ , m_fUseWMASFReader(FALSE)
+ , m_nJumpDistS(0)
+ , m_nJumpDistM(0)
+ , m_nJumpDistL(0)
+ , m_fFreeWindowResizing(TRUE)
+ , m_fNotifyMSN(TRUE)
+ , m_fNotifyGTSdll(FALSE)
+ , m_GTSdllLink(_T("https://sourceforge.net/project/showfiles.php?group_id=82303&package_id=169521&release_id=371114"))
+{
+ m_fWMASFReader = SUCCEEDED(CComPtr<IBaseFilter>().CoCreateInstance(
+ GUIDFromCString(_T("{187463A0-5BB7-11D3-ACBE-0080C75E246E}")))); // WM ASF Reader
+}
+
+CPPageTweaks::~CPPageTweaks()
+{
+}
+
+void CPPageTweaks::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Check(pDX, IDC_CHECK3, m_fDisabeXPToolbars);
+ DDX_Control(pDX, IDC_CHECK3, m_fDisabeXPToolbarsCtrl);
+ DDX_Check(pDX, IDC_CHECK2, m_fUseWMASFReader);
+ DDX_Control(pDX, IDC_CHECK2, m_fUseWMASFReaderCtrl);
+ DDX_Text(pDX, IDC_EDIT1, m_nJumpDistS);
+ DDX_Text(pDX, IDC_EDIT2, m_nJumpDistM);
+ DDX_Text(pDX, IDC_EDIT3, m_nJumpDistL);
+ DDX_Check(pDX, IDC_CHECK1, m_fFreeWindowResizing);
+ DDX_Check(pDX, IDC_CHECK4, m_fNotifyMSN);
+ DDX_Check(pDX, IDC_CHECK5, m_fNotifyGTSdll);
+ DDX_Control(pDX, IDC_STATICLINKGTS, m_GTSdllLink);
+}
+
+BOOL CPPageTweaks::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_fDisabeXPToolbars = s.fDisabeXPToolbars;
+ m_fUseWMASFReader = s.fUseWMASFReader;
+ m_nJumpDistS = s.nJumpDistS;
+ m_nJumpDistM = s.nJumpDistM;
+ m_nJumpDistL = s.nJumpDistL;
+ m_fFreeWindowResizing = s.fFreeWindowResizing;
+ m_fNotifyMSN = s.fNotifyMSN;
+ m_fNotifyGTSdll = s.fNotifyGTSdll;
+
+ UpdateData(FALSE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageTweaks::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ s.fDisabeXPToolbars = !!m_fDisabeXPToolbars;
+ s.fUseWMASFReader = !!m_fUseWMASFReader;
+ s.nJumpDistS = m_nJumpDistS;
+ s.nJumpDistM = m_nJumpDistM;
+ s.nJumpDistL = m_nJumpDistL;
+ s.fFreeWindowResizing = !!m_fFreeWindowResizing;
+ s.fNotifyMSN = !!m_fNotifyMSN;
+ s.fNotifyGTSdll = !!m_fNotifyGTSdll;
+
+ return __super::OnApply();
+}
+
+BEGIN_MESSAGE_MAP(CPPageTweaks, CPPageBase)
+ ON_UPDATE_COMMAND_UI(IDC_CHECK3, OnUpdateCheck3)
+ ON_UPDATE_COMMAND_UI(IDC_CHECK2, OnUpdateCheck2)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+END_MESSAGE_MAP()
+
+
+// CPPageTweaks message handlers
+
+void CPPageTweaks::OnUpdateCheck3(CCmdUI* pCmdUI)
+{
+ if(!AfxGetAppSettings().fXpOrBetter)
+ {
+ pCmdUI->Enable(FALSE);
+ pCmdUI->SetCheck(TRUE);
+ }
+}
+
+void CPPageTweaks::OnUpdateCheck2(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_fWMASFReader);
+}
+
+void CPPageTweaks::OnBnClickedButton1()
+{
+ m_nJumpDistS = 1000;
+ m_nJumpDistM = 5000;
+ m_nJumpDistL = 20000;
+
+ UpdateData(FALSE);
+}
+
+
diff --git a/src/apps/mplayerc/PPageTweaks.h b/src/apps/mplayerc/PPageTweaks.h
new file mode 100644
index 000000000..be24cea90
--- /dev/null
+++ b/src/apps/mplayerc/PPageTweaks.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "PPageBase.h"
+#include "StaticLink.h"
+
+// CPPageTweaks dialog
+
+class CPPageTweaks : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageTweaks)
+
+private:
+ bool m_fWMASFReader;
+
+public:
+ CPPageTweaks();
+ virtual ~CPPageTweaks();
+
+ BOOL m_fDisabeXPToolbars;
+ CButton m_fDisabeXPToolbarsCtrl;
+ BOOL m_fUseWMASFReader;
+ CButton m_fUseWMASFReaderCtrl;
+
+// Dialog Data
+ enum { IDD = IDD_PPAGETWEAKS };
+ int m_nJumpDistS;
+ int m_nJumpDistM;
+ int m_nJumpDistL;
+ BOOL m_fFreeWindowResizing;
+ BOOL m_fNotifyMSN;
+ BOOL m_fNotifyGTSdll;
+ CStaticLink m_GTSdllLink;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnUpdateCheck3(CCmdUI* pCmdUI);
+ afx_msg void OnUpdateCheck2(CCmdUI* pCmdUI);
+ afx_msg void OnBnClickedButton1();
+};
diff --git a/src/apps/mplayerc/PPageWebServer.cpp b/src/apps/mplayerc/PPageWebServer.cpp
new file mode 100644
index 000000000..650d578a7
--- /dev/null
+++ b/src/apps/mplayerc/PPageWebServer.cpp
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PPageWebServer.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "MainFrm.h"
+#include "PPageWebServer.h"
+
+// CPPageWebServer dialog
+
+IMPLEMENT_DYNAMIC(CPPageWebServer, CPPageBase)
+CPPageWebServer::CPPageWebServer()
+ : CPPageBase(CPPageWebServer::IDD, CPPageWebServer::IDD)
+ , m_fEnableWebServer(FALSE)
+ , m_nWebServerPort(0)
+ , m_launch(_T("http://localhost:13579/"))
+ , m_fWebServerPrintDebugInfo(FALSE)
+ , m_fWebServerUseCompression(FALSE)
+ , m_fWebRoot(FALSE)
+ , m_WebRoot(_T(""))
+ , m_fWebServerLocalhostOnly(FALSE)
+ , m_WebServerCGI(_T(""))
+ , m_WebDefIndex(_T(""))
+{
+}
+
+CPPageWebServer::~CPPageWebServer()
+{
+}
+
+void CPPageWebServer::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Check(pDX, IDC_CHECK1, m_fEnableWebServer);
+ DDX_Text(pDX, IDC_EDIT1, m_nWebServerPort);
+ DDX_Control(pDX, IDC_EDIT1, m_nWebServerPortCtrl);
+ DDX_Control(pDX, IDC_STATIC1, m_launch);
+ DDX_Check(pDX, IDC_CHECK2, m_fWebServerPrintDebugInfo);
+ DDX_Check(pDX, IDC_CHECK3, m_fWebServerUseCompression);
+ DDX_Check(pDX, IDC_CHECK4, m_fWebRoot);
+ DDX_Text(pDX, IDC_EDIT2, m_WebRoot);
+ DDX_Check(pDX, IDC_CHECK5, m_fWebServerLocalhostOnly);
+ DDX_Text(pDX, IDC_EDIT3, m_WebServerCGI);
+ DDX_Text(pDX, IDC_EDIT9, m_WebDefIndex);
+}
+
+BOOL CPPageWebServer::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_LBUTTONDOWN && pMsg->hwnd == m_launch.m_hWnd)
+ {
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ if(CMainFrame* pWnd = (CMainFrame*)AfxGetMainWnd())
+ {
+ if(m_fEnableWebServer)
+ {
+ if(s.nWebServerPort != m_nWebServerPort)
+ {
+ AfxMessageBox(_T("Press apply first, before testing the new settings!"), MB_OK);
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ return CPPageBase::PreTranslateMessage(pMsg);
+}
+
+BOOL CPPageWebServer::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ m_fEnableWebServer = s.fEnableWebServer;
+ m_nWebServerPort = s.nWebServerPort;
+ m_fWebServerPrintDebugInfo = s.fWebServerPrintDebugInfo;
+ m_fWebServerLocalhostOnly = s.fWebServerLocalhostOnly;
+ m_fWebServerUseCompression = s.fWebServerUseCompression;
+ m_fWebRoot = s.WebRoot.Find('*') < 0;
+ m_WebRoot = s.WebRoot;
+ m_WebRoot.TrimLeft(_T("*"));
+ m_WebDefIndex = s.WebDefIndex;
+ m_WebServerCGI = s.WebServerCGI;
+
+ UpdateData(FALSE);
+
+ OnEnChangeEdit1();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BOOL CPPageWebServer::OnApply()
+{
+ UpdateData();
+
+ AppSettings& s = AfxGetAppSettings();
+
+ CString NewWebRoot = m_WebRoot;
+ if(!m_fWebRoot) NewWebRoot = _T("*") + NewWebRoot;
+
+ bool fRestart = s.nWebServerPort != m_nWebServerPort
+ || s.WebRoot != NewWebRoot || s.WebServerCGI != m_WebServerCGI;
+
+ s.fEnableWebServer = !!m_fEnableWebServer;
+ s.nWebServerPort = m_nWebServerPort;
+ s.fWebServerPrintDebugInfo = !!m_fWebServerPrintDebugInfo;
+ s.fWebServerLocalhostOnly = !!m_fWebServerLocalhostOnly;
+ s.fWebServerUseCompression = !!m_fWebServerUseCompression;
+ s.WebRoot = NewWebRoot;
+ s.WebDefIndex = m_WebDefIndex;
+ s.WebServerCGI = m_WebServerCGI;
+
+ if(CMainFrame* pWnd = (CMainFrame*)AfxGetMainWnd())
+ {
+ if(m_fEnableWebServer)
+ {
+ if(fRestart) pWnd->StopWebServer();
+ pWnd->StartWebServer(m_nWebServerPort);
+ }
+ else
+ {
+ pWnd->StopWebServer();
+ }
+ }
+
+ return __super::OnApply();
+}
+
+CString CPPageWebServer::GetMPCDir()
+{
+ CString dir;
+ GetModuleFileName(AfxGetInstanceHandle(), dir.GetBuffer(MAX_PATH), MAX_PATH);
+ dir.ReleaseBuffer();
+ CPath path(dir);
+ path.RemoveFileSpec();
+ return (LPCTSTR)path;
+}
+
+CString CPPageWebServer::GetCurWebRoot()
+{
+ CString WebRoot;
+ GetDlgItem(IDC_EDIT2)->GetWindowText(WebRoot);
+ WebRoot.Replace('/', '\\');
+
+ CPath path;
+ path.Combine(GetMPCDir(), WebRoot);
+ return path.IsDirectory() ? (LPCTSTR)path : _T("");
+}
+
+static int __stdcall BrowseCtrlCallback(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
+{
+ if(uMsg == BFFM_INITIALIZED && lpData)
+ ::SendMessage(hwnd, BFFM_SETSELECTION, TRUE, lpData);
+ return 0;
+}
+
+bool CPPageWebServer::PickDir(CString& dir)
+{
+ TCHAR buff[MAX_PATH];
+
+ BROWSEINFO bi;
+ bi.hwndOwner = m_hWnd;
+ bi.pidlRoot = NULL;
+ bi.pszDisplayName = buff;
+ bi.lpszTitle = _T("Select the directory");
+ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_VALIDATE | BIF_USENEWUI;
+ bi.lpfn = BrowseCtrlCallback;
+ bi.lParam = (LPARAM)(LPCTSTR)dir;
+ bi.iImage = 0;
+
+ LPITEMIDLIST iil;
+ if(iil = SHBrowseForFolder(&bi))
+ {
+ SHGetPathFromIDList(iil, buff);
+ dir = buff;
+ return true;
+ }
+
+ return false;
+}
+
+BEGIN_MESSAGE_MAP(CPPageWebServer, CPPageBase)
+ ON_EN_CHANGE(IDC_EDIT1, OnEnChangeEdit1)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateButton2)
+END_MESSAGE_MAP()
+
+
+// CPPageWebServer message handlers
+
+
+void CPPageWebServer::OnEnChangeEdit1()
+{
+ UpdateData();
+
+ CString link;
+ link.Format(_T("http://localhost:%d/"), m_nWebServerPort);
+ m_launch.m_link = link;
+
+ SetModified();
+}
+
+void CPPageWebServer::OnBnClickedButton1()
+{
+ CString dir = GetCurWebRoot();
+ if(PickDir(dir))
+ {
+ CPath path;
+ if(path.RelativePathTo(GetMPCDir(), FILE_ATTRIBUTE_DIRECTORY, dir, FILE_ATTRIBUTE_DIRECTORY))
+ dir = (LPCTSTR)path;
+ m_WebRoot = dir;
+ UpdateData(FALSE);
+ }
+}
+
+void CPPageWebServer::OnBnClickedButton2()
+{
+ CString dir;
+ if(PickDir(dir))
+ {
+ dir += _T("\\");
+ CWebServer::Deploy(dir);
+ }
+}
+
+void CPPageWebServer::OnUpdateButton2(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(GetDlgItem(IDC_EDIT2)->GetWindowTextLength() > 0);
+}
diff --git a/src/apps/mplayerc/PPageWebServer.h b/src/apps/mplayerc/PPageWebServer.h
new file mode 100644
index 000000000..c89c74417
--- /dev/null
+++ b/src/apps/mplayerc/PPageWebServer.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PPageBase.h"
+#include "FloatEdit.h"
+#include "StaticLink.h"
+
+// CPPageWebServer dialog
+
+class CPPageWebServer : public CPPageBase
+{
+ DECLARE_DYNAMIC(CPPageWebServer)
+
+private:
+ CString GetMPCDir();
+ CString GetCurWebRoot();
+ bool PickDir(CString& dir);
+
+public:
+ CPPageWebServer();
+ virtual ~CPPageWebServer();
+
+// Dialog Data
+ enum { IDD = IDD_PPAGEWEBSERVER };
+ BOOL m_fEnableWebServer;
+ int m_nWebServerPort;
+ CIntEdit m_nWebServerPortCtrl;
+ CStaticLink m_launch;
+ BOOL m_fWebServerPrintDebugInfo;
+ BOOL m_fWebServerUseCompression;
+ BOOL m_fWebServerLocalhostOnly;
+ BOOL m_fWebRoot;
+ CString m_WebRoot;
+ CString m_WebServerCGI;
+ CString m_WebDefIndex;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnApply();
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnEnChangeEdit1();
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnBnClickedButton2();
+ afx_msg void OnUpdateButton2(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/PixelShaderCompiler.cpp b/src/apps/mplayerc/PixelShaderCompiler.cpp
new file mode 100644
index 000000000..ffab33d6c
--- /dev/null
+++ b/src/apps/mplayerc/PixelShaderCompiler.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "PixelShaderCompiler.h"
+
+CPixelShaderCompiler::CPixelShaderCompiler(IDirect3DDevice9* pD3DDev, bool fStaySilent)
+ : m_pD3DDev(pD3DDev)
+ , m_hDll(NULL)
+ , m_pD3DXCompileShader(NULL)
+ , m_pD3DXDisassembleShader(NULL)
+{
+ CString d3dx9_dll;
+
+ // CASIMIR666 TODO : voir comment detecter la bonne Dll a charger ???
+ d3dx9_dll.Format(_T("d3dx9_%d.dll"), D3DX_SDK_VERSION);
+ m_hDll = LoadLibrary(d3dx9_dll);
+
+
+ if(m_hDll)
+ {
+ m_pD3DXCompileShader = (D3DXCompileShaderPtr)GetProcAddress(m_hDll, "D3DXCompileShader");
+ m_pD3DXDisassembleShader = (D3DXDisassembleShaderPtr)GetProcAddress(m_hDll, "D3DXDisassembleShader");
+ }
+
+ if(!fStaySilent)
+ {
+ if(!m_hDll)
+ {
+ AfxMessageBox(_T("Cannot load ") + d3dx9_dll + _T(", pixel shaders will not work."), MB_OK);
+ }
+ else if(!m_pD3DXCompileShader || !m_pD3DXDisassembleShader)
+ {
+ AfxMessageBox(_T("Cannot find necessary function entry points in ") + d3dx9_dll + _T(", pixel shaders will not work."), MB_OK);
+ }
+ }
+}
+
+CPixelShaderCompiler::~CPixelShaderCompiler()
+{
+ if(m_hDll) FreeLibrary(m_hDll);
+}
+
+HRESULT CPixelShaderCompiler::CompileShader(
+ LPCSTR pSrcData,
+ LPCSTR pFunctionName,
+ LPCSTR pProfile,
+ DWORD Flags,
+ IDirect3DPixelShader9** ppPixelShader,
+ CString* disasm,
+ CString* errmsg)
+{
+ if(!m_pD3DXCompileShader || !m_pD3DXDisassembleShader)
+ return E_FAIL;
+
+ HRESULT hr;
+
+ CComPtr<ID3DXBuffer> pShader, pDisAsm, pErrorMsgs;
+ hr = m_pD3DXCompileShader(pSrcData, strlen(pSrcData), NULL, NULL, pFunctionName, pProfile, Flags, &pShader, &pErrorMsgs, NULL);
+
+ if(FAILED(hr))
+ {
+ if(errmsg)
+ {
+ CStringA msg = "Unexpected compiler error";
+
+ if(pErrorMsgs)
+ {
+ int len = pErrorMsgs->GetBufferSize();
+ memcpy(msg.GetBufferSetLength(len), pErrorMsgs->GetBufferPointer(), len);
+ }
+
+ *errmsg = msg;
+ }
+
+ return hr;
+ }
+
+ if(ppPixelShader)
+ {
+ if(!m_pD3DDev) return E_FAIL;
+ hr = m_pD3DDev->CreatePixelShader((DWORD*)pShader->GetBufferPointer(), ppPixelShader);
+ if(FAILED(hr)) return hr;
+ }
+
+ if(disasm)
+ {
+ hr = m_pD3DXDisassembleShader((DWORD*)pShader->GetBufferPointer(), FALSE, NULL, &pDisAsm);
+ if(SUCCEEDED(hr) && pDisAsm) *disasm = CStringA((const char*)pDisAsm->GetBufferPointer());
+ }
+
+ return S_OK;
+}
diff --git a/src/apps/mplayerc/PixelShaderCompiler.h b/src/apps/mplayerc/PixelShaderCompiler.h
new file mode 100644
index 000000000..e9061d920
--- /dev/null
+++ b/src/apps/mplayerc/PixelShaderCompiler.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <d3dx9shader.h>
+
+class CPixelShaderCompiler
+{
+ typedef HRESULT (WINAPI * D3DXCompileShaderPtr) (
+ LPCSTR pSrcData,
+ UINT SrcDataLen,
+ CONST D3DXMACRO* pDefines,
+ LPD3DXINCLUDE pInclude,
+ LPCSTR pFunctionName,
+ LPCSTR pProfile,
+ DWORD Flags,
+ LPD3DXBUFFER* ppShader,
+ LPD3DXBUFFER* ppErrorMsgs,
+ LPD3DXCONSTANTTABLE* ppConstantTable);
+
+ typedef HRESULT (WINAPI * D3DXDisassembleShaderPtr) (
+ CONST DWORD* pShader,
+ BOOL EnableColorCode,
+ LPCSTR pComments,
+ LPD3DXBUFFER* ppDisassembly);
+
+ HMODULE m_hDll;
+ D3DXCompileShaderPtr m_pD3DXCompileShader;
+ D3DXDisassembleShaderPtr m_pD3DXDisassembleShader;
+
+ CComPtr<IDirect3DDevice9> m_pD3DDev;
+
+public:
+ CPixelShaderCompiler(IDirect3DDevice9* pD3DDev, bool fStaySilent = false);
+ virtual ~CPixelShaderCompiler();
+
+ HRESULT CompileShader(
+ LPCSTR pSrcData,
+ LPCSTR pFunctionName,
+ LPCSTR pProfile,
+ DWORD Flags,
+ IDirect3DPixelShader9** ppPixelShader,
+ CString* disasm = NULL,
+ CString* errmsg = NULL);
+};
diff --git a/src/apps/mplayerc/PlayerCaptureBar.cpp b/src/apps/mplayerc/PlayerCaptureBar.cpp
new file mode 100644
index 000000000..ae43355a2
--- /dev/null
+++ b/src/apps/mplayerc/PlayerCaptureBar.cpp
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PlayerCaptureBar.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "mainfrm.h"
+#include "PlayerCaptureBar.h"
+
+
+// CPlayerCaptureBar
+
+IMPLEMENT_DYNAMIC(CPlayerCaptureBar, baseCPlayerCaptureBar)
+CPlayerCaptureBar::CPlayerCaptureBar()
+{
+}
+
+CPlayerCaptureBar::~CPlayerCaptureBar()
+{
+}
+
+BOOL CPlayerCaptureBar::Create(CWnd* pParentWnd)
+{
+ if(!baseCPlayerCaptureBar::Create(_T("Capture Settings"), pParentWnd, 0))
+ return FALSE;
+
+ m_capdlg.Create(this);
+ m_capdlg.ShowWindow(SW_SHOWNORMAL);
+
+ CRect r;
+ m_capdlg.GetWindowRect(r);
+ m_szMinVert = m_szVert = r.Size();
+ m_szMinHorz = m_szHorz = r.Size();
+ m_szMinFloat = m_szFloat = r.Size();
+ m_bFixedFloat = true;
+ m_szFixedFloat = r.Size();
+
+ return TRUE;
+}
+
+BOOL CPlayerCaptureBar::PreTranslateMessage(MSG* pMsg)
+{
+ if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
+ {
+ if(IsDialogMessage(pMsg))
+ return TRUE;
+ }
+
+ return __super::PreTranslateMessage(pMsg);
+}
+
+BEGIN_MESSAGE_MAP(CPlayerCaptureBar, baseCPlayerCaptureBar)
+END_MESSAGE_MAP()
+
+// CPlayerCaptureBar message handlers
diff --git a/src/apps/mplayerc/PlayerCaptureBar.h b/src/apps/mplayerc/PlayerCaptureBar.h
new file mode 100644
index 000000000..33c4f66d1
--- /dev/null
+++ b/src/apps/mplayerc/PlayerCaptureBar.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "PlayerCaptureDialog.h"
+
+#ifndef baseCPlayerCaptureBar
+#define baseCPlayerCaptureBar CSizingControlBarG
+#endif
+
+// CPlayerCaptureBar
+
+class CPlayerCaptureBar : public baseCPlayerCaptureBar
+{
+ DECLARE_DYNAMIC(CPlayerCaptureBar)
+
+public:
+ CPlayerCaptureBar();
+ virtual ~CPlayerCaptureBar();
+
+ BOOL Create(CWnd* pParentWnd);
+
+public:
+ CPlayerCaptureDialog m_capdlg;
+
+protected:
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/src/apps/mplayerc/PlayerCaptureDialog.cpp b/src/apps/mplayerc/PlayerCaptureDialog.cpp
new file mode 100644
index 000000000..16624aaf9
--- /dev/null
+++ b/src/apps/mplayerc/PlayerCaptureDialog.cpp
@@ -0,0 +1,1659 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PlayerCaptureDialog.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "mainfrm.h"
+#include "PlayerCaptureDialog.h"
+#include "..\..\DSUtil\DSUtil.h"
+#include "..\..\..\include\moreuuids.h"
+#include "..\..\filters\muxer\wavdest\wavdest.h"
+#include "..\..\filters\muxer\MatroskaMuxer\MatroskaMuxer.h"
+#include "..\..\filters\muxer\DSMMuxer\DSMMuxer.h"
+
+static bool LoadMediaType(CStringW DisplayName, AM_MEDIA_TYPE** ppmt)
+{
+ bool fRet = false;
+
+ if(!ppmt) return(fRet);
+
+ *ppmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
+ if(!*ppmt) return(fRet);
+
+ memset(*ppmt, 0, sizeof(AM_MEDIA_TYPE));
+
+ BYTE* pData;
+ UINT len;
+ if(AfxGetApp()->GetProfileBinary(_T("Capture\\") + CString(DisplayName), _T("MediaType"), &pData, &len))
+ {
+ if(len != sizeof(AM_MEDIA_TYPE)) return(fRet);
+ memcpy(*ppmt, pData, len);
+ delete [] pData;
+
+ (*ppmt)->cbFormat = 0;
+ (*ppmt)->pbFormat = NULL;
+
+ fRet = true;
+
+ if(AfxGetApp()->GetProfileBinary(_T("Capture\\") + CString(DisplayName), _T("Format"), &pData, &len))
+ {
+ if(!len) return(fRet);
+ (*ppmt)->cbFormat = len;
+ (*ppmt)->pbFormat = (BYTE*)CoTaskMemAlloc(len);
+ memcpy((*ppmt)->pbFormat, pData, len);
+ delete [] pData;
+
+ }
+ }
+
+ return(fRet);
+}
+
+static void SaveMediaType(CStringW DisplayName, AM_MEDIA_TYPE* pmt)
+{
+ if(DisplayName.IsEmpty() || !pmt) return;
+
+ AfxGetApp()->WriteProfileBinary(_T("Capture\\") + CString(DisplayName), _T("MediaType"), (BYTE*)pmt, sizeof(AM_MEDIA_TYPE));
+ AfxGetApp()->WriteProfileBinary(_T("Capture\\") + CString(DisplayName), _T("Format"), pmt->pbFormat, pmt->cbFormat);
+}
+
+static void LoadDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& cat)
+{
+ int len = box.GetCount();
+ if(len >= 0) box.SetCurSel(0);
+
+ if(cat == GUID_NULL) return;
+
+ CString DisplayName = AfxGetApp()->GetProfileString(_T("Capture\\") + CStringFromGUID(cat), _T("DisplayName"));
+
+ for(int i = 0; i < len; i++)
+ {
+ int iSel = box.GetItemData(i);
+ if(iSel < 0) continue;
+
+ Codec& c = codecs[iSel];
+ if(DisplayName == c.DisplayName)
+ {
+ box.SetCurSel(i);
+ if(!c.pBF)
+ c.pMoniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.pBF);
+ break;
+ }
+ }
+}
+
+static void SaveDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& cat)
+{
+ if(cat == GUID_NULL) return;
+
+ CString guid = CStringFromGUID(cat);
+
+ AfxGetApp()->WriteProfileString(_T("Capture\\") + guid, NULL, NULL);
+
+ int iSel = box.GetCurSel();
+ if(iSel < 0) return;
+ iSel = box.GetItemData(iSel);
+ if(iSel < 0) return;
+
+ Codec& codec = codecs[iSel];
+
+ AfxGetApp()->WriteProfileString(_T("Capture\\") + guid, _T("DisplayName"), CString(codec.DisplayName));
+}
+
+static void SetupDefaultCaps(AM_MEDIA_TYPE* pmt, VIDEO_STREAM_CONFIG_CAPS& caps)
+{
+ memset(&caps, 0, sizeof(caps));
+
+ if(!pmt) return;
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->pbFormat;
+
+ BITMAPINFOHEADER* bih = (pmt->formattype == FORMAT_VideoInfo)
+ ? &((VIDEOINFOHEADER*)pmt->pbFormat)->bmiHeader
+ : (pmt->formattype == FORMAT_VideoInfo2)
+ ? &((VIDEOINFOHEADER2*)pmt->pbFormat)->bmiHeader
+ : NULL;
+
+ caps.guid = GUID_NULL;
+ caps.VideoStandard = 0;
+ caps.InputSize.cx = bih->biWidth;
+ caps.InputSize.cy = abs(bih->biHeight);
+ caps.MinCroppingSize = caps.MaxCroppingSize = caps.InputSize;
+ caps.CropGranularityX = caps.CropGranularityY = 1;
+ caps.CropAlignX = caps.CropAlignY = 1;
+ caps.MinOutputSize = CSize(64, 64);
+ caps.MaxOutputSize = CSize(768, 576);
+ caps.OutputGranularityX = 16;
+ caps.OutputGranularityY = 1;
+ caps.StretchTapsX = caps.StretchTapsY = 0;
+ caps.ShrinkTapsX = caps.ShrinkTapsY = 0;
+ caps.MinFrameInterval = 100000i64;
+ caps.MaxFrameInterval = 100000000i64;
+ caps.MinBitsPerSecond = caps.MaxBitsPerSecond = 0;
+}
+
+static void SetupDefaultCaps(AM_MEDIA_TYPE* pmt, AUDIO_STREAM_CONFIG_CAPS& caps)
+{
+ memset(&caps, 0, sizeof(caps));
+
+ if(!pmt) return;
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->pbFormat;
+
+ caps.guid = GUID_NULL;
+ caps.MinimumChannels = caps.MaximumChannels = wfe->nChannels;
+ caps.ChannelsGranularity = 1;
+ caps.MinimumBitsPerSample = caps.MaximumBitsPerSample = wfe->wBitsPerSample;
+ caps.BitsPerSampleGranularity = 1;
+ caps.MinimumSampleFrequency = caps.MaximumSampleFrequency = wfe->nSamplesPerSec;
+ caps.SampleFrequencyGranularity = 1;
+}
+
+template<class T>
+static void SetupMediaTypes(CComPtr<IAMStreamConfig> pAMSC, CFormatArray<T>& tfa, CComboBox& type, CComboBox& dim, CMediaType& mt)
+{
+ tfa.RemoveAll();
+ type.ResetContent();
+ dim.ResetContent();
+ type.EnableWindow(FALSE);
+ dim.EnableWindow(FALSE);
+
+ if(!pAMSC) return;
+
+ AM_MEDIA_TYPE* pcurmt = NULL;
+ pAMSC->GetFormat(&pcurmt);
+
+ int iCount = 0, iSize;
+ if(SUCCEEDED(pAMSC->GetNumberOfCapabilities(&iCount, &iSize))
+ && iSize == sizeof(T) && iCount > 0)
+ {
+ for(int i = 0; i < iCount; i++)
+ {
+ T caps;
+ AM_MEDIA_TYPE* pmt = NULL;
+ if(SUCCEEDED(pAMSC->GetStreamCaps(i, &pmt, (BYTE*)&caps)))
+ {
+ tfa.AddFormat(pmt, caps);
+ }
+ }
+
+ if(iSize == sizeof(VIDEO_STREAM_CONFIG_CAPS))
+ {
+ for(int i = 0, cnt = tfa.GetCount(); i < cnt; i++)
+ {
+ if(tfa[i]->GetCount() != 1) continue;
+
+ CFormatElem<T>* pfe = tfa[i]->GetAt(0);
+
+ if(pfe->mt.formattype != FORMAT_VideoInfo
+ && pfe->mt.formattype != FORMAT_VideoInfo2)
+ continue;
+
+ static SIZE presets[] =
+ {
+ {160, 120}, {192, 144},
+ {320, 240}, {384, 288},
+ {480, 240}, {512, 288},
+ {480, 360}, {512, 384},
+ {640, 240}, {768, 288},
+ {640, 480}, {768, 576},
+ {704, 240}, {704, 288},
+ {704, 480}, {704, 576},
+ {720, 240}, {720, 288},
+ {720, 480}, {720, 576},
+ {768, 240}, {768, 288},
+ {768, 480}, {768, 576},
+ };
+
+ VIDEO_STREAM_CONFIG_CAPS* pcaps = (VIDEO_STREAM_CONFIG_CAPS*)&pfe->caps;
+ BITMAPINFOHEADER bihCur;
+ ExtractBIH(&pfe->mt, &bihCur);
+
+ for(int j = 0; j < countof(presets); j++)
+ {
+ if(presets[j].cx == bihCur.biWidth
+ && presets[j].cy == abs(bihCur.biHeight)
+ || presets[j].cx < pcaps->MinOutputSize.cx
+ || presets[j].cx > pcaps->MaxOutputSize.cx
+ || presets[j].cy < pcaps->MinOutputSize.cy
+ || presets[j].cy > pcaps->MaxOutputSize.cy
+ || presets[j].cx % pcaps->OutputGranularityX
+ || presets[j].cy % pcaps->OutputGranularityY)
+ continue;
+
+ CMediaType mt = pfe->mt;
+
+ if(mt.formattype == FORMAT_VideoInfo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.pbFormat;
+ if(!vih->bmiHeader.biHeight) vih->bmiHeader.biHeight = 1;
+ vih->bmiHeader.biWidth = presets[j].cx;
+ vih->bmiHeader.biHeight = presets[j].cy*(vih->bmiHeader.biHeight/vih->bmiHeader.biHeight);
+ vih->bmiHeader.biSizeImage = presets[j].cx*presets[j].cy*vih->bmiHeader.biBitCount>>3;
+
+ AM_MEDIA_TYPE* pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
+ CopyMediaType(pmt, &mt);
+ tfa.AddFormat(pmt, pcaps, sizeof(*pcaps));
+
+ if(presets[j].cx*3 != presets[j].cy*4)
+ {
+ int extra = mt.cbFormat - sizeof(VIDEOINFOHEADER);
+ int bmiHeaderSize = sizeof(vih->bmiHeader) + extra;
+ BYTE* pbmiHeader = new BYTE[bmiHeaderSize];
+ memcpy(pbmiHeader, &vih->bmiHeader, bmiHeaderSize);
+ mt.ReallocFormatBuffer(FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader) + bmiHeaderSize);
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.pbFormat;
+ memcpy(&vih2->bmiHeader, pbmiHeader, bmiHeaderSize);
+ delete [] pbmiHeader;
+ vih2->dwInterlaceFlags = vih2->dwCopyProtectFlags = 0;
+ vih2->dwReserved1 = vih2->dwReserved2 = 0;
+ vih2->dwPictAspectRatioX = 4;
+ vih2->dwPictAspectRatioY = 3;
+
+ AM_MEDIA_TYPE* pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
+ CopyMediaType(pmt, &mt);
+ tfa.AddFormat(pmt, pcaps, sizeof(*pcaps));
+ }
+ }
+ else if(mt.formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.pbFormat;
+ if(!vih2->bmiHeader.biHeight) vih2->bmiHeader.biHeight = 1;
+ vih2->bmiHeader.biWidth = presets[j].cx;
+ vih2->bmiHeader.biHeight = presets[j].cy*(vih2->bmiHeader.biHeight/vih2->bmiHeader.biHeight);
+ vih2->bmiHeader.biSizeImage = presets[j].cx*presets[j].cy*vih2->bmiHeader.biBitCount>>3;
+ vih2->dwPictAspectRatioX = 4;
+ vih2->dwPictAspectRatioY = 3;
+
+ AM_MEDIA_TYPE* pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
+ CopyMediaType(pmt, &mt);
+ tfa.AddFormat(pmt, pcaps, sizeof(*pcaps));
+ }
+ }
+ }
+ }
+ }
+
+ if(tfa.GetCount() == 0)
+ {
+ if(pcurmt && (pcurmt->majortype == MEDIATYPE_Video || pcurmt->majortype == MEDIATYPE_Audio))
+ {
+ AM_MEDIA_TYPE* pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
+ CopyMediaType(pmt, pcurmt);
+ T caps;
+ SetupDefaultCaps(pmt, caps);
+ tfa.AddFormat(pmt, caps);
+ }
+ else
+ {
+ mt.majortype = GUID_NULL;
+ if(pcurmt) DeleteMediaType(pcurmt);
+ return;
+ }
+ }
+
+ for(int i = 0; i < (int)tfa.GetCount(); i++)
+ {
+ CFormat<T>* pf = tfa[i];
+ int j = type.AddString(pf->name);
+ type.SetItemData(j, (DWORD_PTR)pf);
+ }
+
+ CFormat<T>* pf = NULL;
+ CFormatElem<T>* pfe = NULL;
+
+ if(!pcurmt)
+ {
+ pf = tfa[0];
+ pfe = pf->GetAt(0);
+ }
+ else if(!tfa.FindFormat(pcurmt, NULL, &pf, &pfe) && !tfa.FindFormat(pcurmt, &pf))
+ {
+ if(pcurmt) DeleteMediaType(pcurmt);
+ return;
+ }
+
+ for(int i = 0; i < (int)pf->GetCount(); i++)
+ {
+ CFormatElem<T>* pfe = pf->GetAt(i);
+ int j = dim.AddString(tfa.MakeDimensionName(pfe));
+ dim.SetItemData(j, (DWORD_PTR)pfe);
+ }
+
+ int iType = type.SetCurSel(type.FindStringExact(0, pf->name));
+ if(iType < 0 && type.GetCount()) type.SetCurSel(0);
+ int iDim = dim.SetCurSel(dim.FindStringExact(0, tfa.MakeDimensionName(pfe)));
+// if(iDim < 0 && dim.GetCount()) dim.SetCurSel(iDim = 0);
+
+ CorrectComboListWidth(type, type.GetParent()->GetFont());
+ CorrectComboListWidth(dim, dim.GetParent()->GetFont());
+
+ if(iDim >= 0) mt = ((CFormatElem<T>*)dim.GetItemData(iDim))->mt;
+ else if(pcurmt) mt = *pcurmt;
+
+ type.EnableWindow(type.GetCount() > 0);
+ dim.EnableWindow(dim.GetCount() > 0);
+
+ if(pcurmt) DeleteMediaType(pcurmt);
+}
+
+template<class T>
+static bool SetupDimension(CFormatArray<T>& tfa, CComboBox& type, CComboBox& dim)
+{
+ CString str;
+ dim.GetWindowText(str);
+
+ dim.ResetContent();
+ dim.EnableWindow(FALSE);
+
+ int iSel = type.GetCurSel();
+ if(iSel < 0) return(false);
+
+ CFormat<T>* pf = (CFormat<T>*)type.GetItemData(iSel);
+
+ for(int i = 0; i < (int)pf->GetCount(); i++)
+ {
+ CFormatElem<T>* pfe = pf->GetAt(i);
+ dim.SetItemData(dim.AddString(tfa.MakeDimensionName(pfe)), (DWORD_PTR)pfe);
+ }
+
+ CorrectComboListWidth(dim, dim.GetParent()->GetFont());
+
+ dim.SetCurSel(dim.FindStringExact(0, str));
+ dim.EnableWindow(dim.GetCount() > 0);
+
+ return(dim.GetCurSel() >= 0);
+}
+
+static void InitCodecList(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& cat)
+{
+ codecs.RemoveAll();
+ box.ResetContent();
+ box.EnableWindow(FALSE);
+
+ box.SetItemData(box.AddString(_T("Uncompressed")), (DWORD_PTR)-1);
+
+ BeginEnumSysDev(cat, pMoniker)
+ {
+ Codec c;
+
+ c.pMoniker = pMoniker;
+/*
+ CComPtr<IBaseFilter> pBF;
+ if(FAILED(pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&pBF)) || !pBF)
+ continue;
+
+ c.pBF = pBF;
+*/
+ LPOLESTR strName = NULL;
+ if(FAILED(pMoniker->GetDisplayName(NULL, NULL, &strName)))
+ continue;
+
+ c.DisplayName = strName;
+ CoTaskMemFree(strName);
+
+ CComPtr<IPropertyBag> pPB;
+ pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB);
+
+ CComVariant var;
+ if(FAILED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ continue;
+
+ c.FriendlyName = var.bstrVal;
+
+ CStringW str = CStringW(c.DisplayName).MakeLower();
+ if(str.Find(L"@device:dmo:") == 0)
+ c.FriendlyName = _T("(DMO) ") + c.FriendlyName;
+ else if(str.Find(L"@device:sw:") == 0)
+ c.FriendlyName = _T("(DS) ") + c.FriendlyName;
+ else if(str.Find(L"@device:cm:") == 0)
+ c.FriendlyName = _T("(VfW) ") + c.FriendlyName;
+
+ box.SetItemData(
+ box.AddString(c.FriendlyName),
+ (DWORD_PTR)codecs.Add(c));
+ }
+ EndEnumSysDev
+
+ box.EnableWindow(box.GetCount() > 1);
+
+ CorrectComboListWidth(box, box.GetParent()->GetFont());
+
+ LoadDefaultCodec(codecs, box, cat);
+}
+
+static int ShowPPage(CAtlArray<Codec>& codecs, CComboBox& box, HWND hWnd = NULL)
+{
+ int iSel = box.GetCurSel();
+ if(iSel < 0) return(-1);
+
+ iSel = box.GetItemData(iSel);
+ if(iSel < 0) return(-1);
+
+ Codec& c = codecs[iSel];
+
+ if(!c.pBF)
+ {
+ c.pMoniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.pBF);
+ }
+
+ if(CComQIPtr<ISpecifyPropertyPages> pSPP = c.pBF)
+ {
+ CAUUID caGUID;
+ caGUID.pElems = NULL;
+ if(SUCCEEDED(pSPP->GetPages(&caGUID)))
+ {
+ IUnknown* lpUnk = NULL;
+ pSPP.QueryInterface(&lpUnk);
+ OleCreatePropertyFrame(
+ hWnd, 0, 0, CStringW(c.FriendlyName),
+ 1, (IUnknown**)&lpUnk,
+ caGUID.cElems, caGUID.pElems,
+ 0, 0, NULL);
+ lpUnk->Release();
+
+ if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+ }
+ }
+ else if(CComQIPtr<IAMVfwCompressDialogs> pAMVfWCD = c.pBF)
+ {
+ if(pAMVfWCD->ShowDialog(VfwCompressDialog_QueryConfig, NULL) == S_OK)
+ pAMVfWCD->ShowDialog(VfwCompressDialog_Config, hWnd);
+ }
+
+ return(iSel);
+}
+
+// CPlayerCaptureDialog dialog
+
+//IMPLEMENT_DYNAMIC(CPlayerCaptureDialog, CResizableDialog)
+CPlayerCaptureDialog::CPlayerCaptureDialog()
+ : CResizableDialog(CPlayerCaptureDialog::IDD, NULL)
+ , m_vidfps(0)
+ , m_file(_T(""))
+ , m_fVidOutput(TRUE)
+ , m_fAudOutput(TRUE)
+ , m_fVidPreview(FALSE)
+ , m_fAudPreview(FALSE)
+ , m_nVidBuffers(0)
+ , m_nAudBuffers(0)
+ , m_pVidBuffer(NULL)
+ , m_pAudBuffer(NULL)
+ , m_fSepAudio(FALSE)
+ , m_muxtype(0)
+{
+}
+
+CPlayerCaptureDialog::~CPlayerCaptureDialog()
+{
+ EmptyVideo();
+ EmptyAudio();
+}
+
+BOOL CPlayerCaptureDialog::Create(CWnd* pParent)
+{
+ if(!__super::Create(IDD, pParent))
+ return FALSE;
+
+ EmptyVideo();
+ EmptyAudio();
+
+ return TRUE;
+}
+
+void CPlayerCaptureDialog::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO4, m_vidinput);
+ DDX_Control(pDX, IDC_COMBO1, m_vidtype);
+ DDX_Control(pDX, IDC_COMBO5, m_viddimension);
+ DDX_Control(pDX, IDC_SPIN1, m_vidhor);
+ DDX_Control(pDX, IDC_SPIN2, m_vidver);
+ DDX_Control(pDX, IDC_EDIT1, m_vidhoredit);
+ DDX_Control(pDX, IDC_EDIT2, m_vidveredit);
+ DDX_Control(pDX, IDC_EDIT3, m_vidfpsedit);
+ DDX_Control(pDX, IDC_BUTTON1, m_vidsetres);
+ DDX_Control(pDX, IDC_COMBO3, m_audinput);
+ DDX_Control(pDX, IDC_COMBO2, m_audtype);
+ DDX_Control(pDX, IDC_COMBO6, m_auddimension);
+ DDX_Control(pDX, IDC_COMBO7, m_vidcodec);
+ DDX_Control(pDX, IDC_COMBO9, m_vidcodectype);
+ DDX_Control(pDX, IDC_COMBO10, m_vidcodecdimension);
+ DDX_Check(pDX, IDC_CHECK1, m_fVidOutput);
+ DDX_Control(pDX, IDC_CHECK1, m_vidoutput);
+ DDX_Check(pDX, IDC_CHECK2, m_fVidPreview);
+ DDX_Control(pDX, IDC_CHECK2, m_vidpreview);
+ DDX_Control(pDX, IDC_COMBO8, m_audcodec);
+ DDX_Control(pDX, IDC_COMBO12, m_audcodectype);
+ DDX_Control(pDX, IDC_COMBO11, m_audcodecdimension);
+ DDX_Check(pDX, IDC_CHECK3, m_fAudOutput);
+ DDX_Control(pDX, IDC_CHECK3, m_audoutput);
+ DDX_Check(pDX, IDC_CHECK4, m_fAudPreview);
+ DDX_Control(pDX, IDC_CHECK4, m_audpreview);
+ DDX_Text(pDX, IDC_EDIT4, m_file);
+ DDX_Control(pDX, IDC_BUTTON2, m_recordbtn);
+ DDX_Text(pDX, IDC_EDIT5, m_nVidBuffers);
+ DDX_Text(pDX, IDC_EDIT6, m_nAudBuffers);
+ DDX_Check(pDX, IDC_CHECK5, m_fSepAudio);
+ DDX_CBIndex(pDX, IDC_COMBO14, m_muxtype);
+ DDX_Control(pDX, IDC_COMBO14, m_muxctrl);
+}
+
+BOOL CPlayerCaptureDialog::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN)
+ {
+ if(pMsg->wParam == VK_RETURN)
+ {
+ CWnd* pFocused = GetFocus();
+ if(pFocused && pFocused->m_hWnd == m_vidfpsedit.m_hWnd)
+ {
+ UpdateGraph();
+ }
+ }
+ }
+
+ return __super::PreTranslateMessage(pMsg);
+}
+
+
+void CPlayerCaptureDialog::EmptyVideo()
+{
+ // first save channel from previous session
+
+ if(m_pAMTuner && !m_VidDisplayName.IsEmpty())
+ {
+ long lChannel = 0, lVivSub = 0, lAudSub = 0;
+ m_pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub);
+ AfxGetApp()->WriteProfileInt(_T("Capture\\") + CString(m_VidDisplayName), _T("Channel"), lChannel);
+ }
+
+ //
+
+ m_vfa.RemoveAll();
+
+ m_pAMXB = NULL;
+ m_pAMTuner = NULL;
+ m_pAMVSC = NULL;
+
+ if(IsWindow(m_hWnd))
+ {
+ m_vidinput.ResetContent();
+ m_vidinput.EnableWindow(FALSE);
+ m_vidtype.ResetContent();
+ m_vidtype.EnableWindow(FALSE);
+ m_viddimension.ResetContent();
+ m_viddimension.EnableWindow(FALSE);
+ m_vidhor.EnableWindow(FALSE);
+ m_vidver.EnableWindow(FALSE);
+ m_vidhoredit.EnableWindow(FALSE);
+ m_vidveredit.EnableWindow(FALSE);
+ m_vidfpsedit.EnableWindow(FALSE);
+ m_vidfps = 0;
+ m_vidsetres.EnableWindow(FALSE);
+ UpdateData(FALSE);
+ }
+}
+
+void CPlayerCaptureDialog::EmptyAudio()
+{
+ m_afa.RemoveAll();
+
+ m_pAMASC = NULL;
+ m_pAMAIM.RemoveAll();
+
+ if(IsWindow(m_hWnd))
+ {
+ m_audinput.ResetContent();
+ m_audinput.EnableWindow(FALSE);
+ m_audtype.ResetContent();
+ m_audtype.EnableWindow(FALSE);
+ m_auddimension.ResetContent();
+ m_auddimension.EnableWindow(FALSE);
+ UpdateData(FALSE);
+ }
+}
+
+void CPlayerCaptureDialog::UpdateMediaTypes()
+{
+ UpdateData();
+
+ // fps
+
+ CString fps;
+ m_vidfpsedit.GetWindowText(fps);
+ if(!fps.IsEmpty())
+ {
+ float ffps;
+ _stscanf(fps, _T("%f"), &ffps);
+ if(ffps > 0) m_vidfps = ffps;
+ }
+
+ // video
+
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+ VIDEO_STREAM_CONFIG_CAPS* pcaps = NULL;
+
+ int i = m_viddimension.GetCurSel();
+ if(i >= 0)
+ {
+ pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
+ CopyMediaType(pmt, &((CVidFormatElem*)m_viddimension.GetItemData(i))->mt);
+ pcaps = &((CVidFormatElem*)m_viddimension.GetItemData(i))->caps;
+ }
+ else if(m_pAMVSC)
+ {
+ m_pAMVSC->GetFormat(&pmt);
+ }
+
+ if(pmt)
+ {
+ if(m_vidfps > 0)
+ {
+ REFERENCE_TIME atpf = (REFERENCE_TIME)(10000000.0 / m_vidfps);
+
+ if(pcaps)
+ {
+ // FIXME: some drivers do not set the interval right and they still accept the preferable but unfortunately out-of-range fps
+// atpf = min(max(atpf, pcaps->MinFrameInterval), pcaps->MaxFrameInterval);
+ }
+
+ if(pmt->formattype == FORMAT_VideoInfo)
+ ((VIDEOINFOHEADER*)pmt->pbFormat)->AvgTimePerFrame = atpf;
+ else if(pmt->formattype == FORMAT_VideoInfo2)
+ ((VIDEOINFOHEADER2*)pmt->pbFormat)->AvgTimePerFrame = atpf;
+ }
+
+ BITMAPINFOHEADER* bih = (pmt->formattype == FORMAT_VideoInfo)
+ ? &((VIDEOINFOHEADER*)pmt->pbFormat)->bmiHeader
+ : (pmt->formattype == FORMAT_VideoInfo2)
+ ? &((VIDEOINFOHEADER2*)pmt->pbFormat)->bmiHeader
+ : NULL;
+
+ bih->biWidth = m_vidhor.GetPos();
+ bih->biHeight = m_vidver.GetPos();
+ bih->biSizeImage = bih->biWidth*bih->biHeight*bih->biBitCount>>3;
+
+ SaveMediaType(m_VidDisplayName, pmt);
+
+ m_mtv = *pmt;
+ DeleteMediaType(pmt);
+ }
+ }
+
+ // audio
+
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+
+ int i = m_auddimension.GetCurSel();
+ if(i >= 0)
+ {
+ pmt = (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
+ CopyMediaType(pmt, &((CAudFormatElem*)m_auddimension.GetItemData(i))->mt);
+ }
+ else if(m_pAMASC)
+ {
+ m_pAMASC->GetFormat(&pmt);
+ }
+
+ if(pmt)
+ {
+ SaveMediaType(m_AudDisplayName, pmt);
+
+ m_mta = *pmt;
+ DeleteMediaType(pmt);
+ }
+ }
+}
+
+void CPlayerCaptureDialog::UpdateUserDefinableControls()
+{
+ int iSel = m_viddimension.GetCurSel();
+ if(iSel < 0) return;
+
+ CVidFormatElem* pvfe = (CVidFormatElem*)m_viddimension.GetItemData(iSel);
+ if(!pvfe) return;
+
+ if(!m_pAMVSC) return;
+
+ AM_MEDIA_TYPE* pmt = NULL;
+ m_pAMVSC->GetFormat(&pmt);
+ if(!pmt) return;
+
+ BITMAPINFOHEADER* bih = (pmt->formattype == FORMAT_VideoInfo)
+ ? &((VIDEOINFOHEADER*)pmt->pbFormat)->bmiHeader
+ : (pmt->formattype == FORMAT_VideoInfo2)
+ ? &((VIDEOINFOHEADER2*)pmt->pbFormat)->bmiHeader
+ : NULL;
+
+ if(!bih) return;
+
+ UDACCEL ua[3] = {{0,0},{2,0},{4,0}};
+
+ int w = m_vidhor.GetPos(), h = m_vidver.GetPos();
+
+ m_vidhor.SetRange((short)pvfe->caps.MinOutputSize.cx, (short)pvfe->caps.MaxOutputSize.cx);
+/* if(bih->biCompression == mmioFOURCC('Y','U','Y','2')) // FIXME: bt8x8 drivers seem to crop the right side in yuv2 mode if the width is not divisable by 64
+ pvfe->caps.OutputGranularityX = 64;
+*/
+ ua[0].nInc = pvfe->caps.OutputGranularityX;
+ ua[1].nInc = pvfe->caps.OutputGranularityX*2;
+ ua[2].nInc = pvfe->caps.OutputGranularityX*4;
+ m_vidhor.SetAccel(3, ua);
+
+ m_vidver.SetRange((short)pvfe->caps.MinOutputSize.cy, (short)pvfe->caps.MaxOutputSize.cy);
+ ua[0].nInc = pvfe->caps.OutputGranularityY;
+ ua[1].nInc = pvfe->caps.OutputGranularityY*2;
+ ua[2].nInc = pvfe->caps.OutputGranularityY*4;
+ m_vidver.SetAccel(3, ua);
+
+ m_vidhor.SetPos(bih->biWidth);
+ m_vidver.SetPos(abs(bih->biHeight));
+
+ CString fps;
+ fps.Format(_T("%.4f"), (float)(10000000.0 / ((VIDEOINFOHEADER*)pmt->pbFormat)->AvgTimePerFrame));
+ m_vidfpsedit.SetWindowText(fps);
+
+ DeleteMediaType(pmt);
+}
+
+void CPlayerCaptureDialog::UpdateVideoCodec()
+{
+ int iSel = m_vidcodec.GetCurSel();
+ if(iSel >= 0) iSel = m_vidcodec.GetItemData(iSel);
+
+ m_pVidEnc = iSel < 0 ? NULL : m_pVidEncArray[iSel].pBF;
+ m_pVidEncMoniker = iSel < 0 ? NULL : m_pVidEncArray[iSel].pMoniker;
+
+// CString DisplayName = iSel < 0 ? _T("") : CString(m_pVidEncArray[iSel].DisplayName.m_str);
+ CComQIPtr<IAMStreamConfig> pAMSC = GetFirstPin(m_pVidEnc, PINDIR_OUTPUT);
+
+ SetupMediaTypes(pAMSC, m_vcfa, m_vidcodectype, m_vidcodecdimension, m_mtcv);
+
+ SaveDefaultCodec(m_pVidEncArray, m_vidcodec, CLSID_VideoCompressorCategory);
+
+// SaveMediaType(DisplayName, &m_mtcv);
+}
+
+void CPlayerCaptureDialog::UpdateAudioCodec()
+{
+ int iSel = m_audcodec.GetCurSel();
+ if(iSel >= 0) iSel = m_audcodec.GetItemData(iSel);
+
+ m_pAudEnc = iSel < 0 ? NULL : m_pAudEncArray[iSel].pBF;
+ m_pAudEncMoniker = iSel < 0 ? NULL : m_pAudEncArray[iSel].pMoniker;
+
+// CString DisplayName = iSel < 0 ? _T("") : CString(m_pAudEncArray[iSel].DisplayName.m_str);
+ CComQIPtr<IAMStreamConfig> pAMSC = GetFirstPin(m_pAudEnc, PINDIR_OUTPUT);
+
+ SetupMediaTypes(pAMSC, m_acfa, m_audcodectype, m_audcodecdimension, m_mtca);
+
+ SaveDefaultCodec(m_pAudEncArray, m_audcodec, CLSID_AudioCompressorCategory);
+
+// SaveMediaType(DisplayName, &m_mtca);
+}
+
+void CPlayerCaptureDialog::UpdateMuxer()
+{
+ m_pMux = NULL;
+ m_pAudMux = NULL;
+
+ UpdateData();
+
+ HRESULT hr;
+
+ if(m_muxtype == 0) m_pMux.CoCreateInstance(CLSID_AviDest);
+ else if(m_muxtype == 1) m_pMux.CoCreateInstance(CLSID_OggMux);
+ else if(m_muxtype == 2) m_pMux = new CMatroskaMuxerFilter(NULL, &hr);
+ else if(m_muxtype == 3) m_pMux = new CDSMMuxerFilter(NULL, &hr);
+ else return;
+
+ if(m_fSepAudio) m_pAudMux = new CWavDestFilter(NULL, &hr);
+}
+
+void CPlayerCaptureDialog::UpdateOutputControls()
+{
+ UpdateData();
+
+ m_recordbtn.EnableWindow(!m_file.IsEmpty() && (m_pAMVSC && m_fVidOutput || m_pAMASC && m_fAudOutput));
+ m_vidcodec.EnableWindow(TRUE);
+ m_audcodec.EnableWindow(TRUE);
+}
+
+void CPlayerCaptureDialog::UpdateGraph()
+{
+ UpdateMediaTypes();
+
+// UpdateMuxer();
+
+ ((CMainFrame*)AfxGetMainWnd())->BuildGraphVideoAudio(m_fVidPreview, false, m_fAudPreview, false);
+
+ UpdateUserDefinableControls();
+}
+
+void CPlayerCaptureDialog::EnableControls(CWnd* pWnd, bool fEnable)
+{
+ if(fEnable)
+ {
+ for(CWnd* pChild = pWnd->GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
+ {
+ BOOL fEnabled;
+ if(m_wndenabledmap.Lookup(pChild->m_hWnd, fEnabled))
+ pChild->EnableWindow(fEnabled);
+ EnableControls(pChild, fEnable);
+ }
+
+ if(pWnd->m_hWnd == m_hWnd)
+ m_wndenabledmap.RemoveAll();
+
+ m_recordbtn.SetWindowText(_T("Record"));
+ }
+ else
+ {
+ if(pWnd->m_hWnd == m_hWnd)
+ m_wndenabledmap.RemoveAll();
+
+ for(CWnd* pChild = pWnd->GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
+ {
+ m_wndenabledmap[pChild->m_hWnd] = pChild->IsWindowEnabled();
+ pChild->EnableWindow(FALSE);
+ EnableControls(pChild, fEnable);
+ }
+
+ m_recordbtn.EnableWindow(TRUE);
+ m_recordbtn.SetWindowText(_T("Stop"));
+ }
+}
+
+void CPlayerCaptureDialog::SetupVideoControls(
+ CStringW DisplayName,
+ CComPtr<IAMStreamConfig> pAMSC, CComPtr<IAMCrossbar> pAMXB, CComPtr<IAMTVTuner> pAMTuner)
+{
+ EmptyVideo();
+
+ // crossbar
+
+ if(m_pAMXB = pAMXB)
+ {
+ long OutputPinCount, InputPinCount;
+ if(SUCCEEDED(pAMXB->get_PinCounts(&OutputPinCount, &InputPinCount)))
+ {
+ for(int i = 0; i < InputPinCount; i++)
+ {
+ long PinIndexRelated, PhysicalType;
+ if(FAILED(pAMXB->get_CrossbarPinInfo(TRUE, i, &PinIndexRelated, &PhysicalType)))
+ continue;
+
+ if(PhysicalType >= PhysConn_Audio_Tuner)
+ continue;
+
+ CString str;
+ switch(PhysicalType)
+ {
+ case PhysConn_Video_Tuner: str = _T("Tuner"); break;
+ case PhysConn_Video_Composite: str = _T("Composite"); break;
+ case PhysConn_Video_SVideo: str = _T("SVideo"); break;
+ case PhysConn_Video_RGB: str = _T("RGB"); break;
+ case PhysConn_Video_YRYBY: str = _T("YRYBY"); break;
+ case PhysConn_Video_SerialDigital: str = _T("SerialDigital"); break;
+ case PhysConn_Video_ParallelDigital: str = _T("ParallelDigital"); break;
+ case PhysConn_Video_SCSI: str = _T("SCSI"); break;
+ case PhysConn_Video_AUX: str = _T("AUX"); break;
+ case PhysConn_Video_1394: str = _T("1394"); break;
+ case PhysConn_Video_USB: str = _T("USB"); break;
+ case PhysConn_Video_VideoDecoder: str = _T("VideoDecoder"); break;
+ case PhysConn_Video_VideoEncoder: str = _T("VideoEncoder"); break;
+ case PhysConn_Video_SCART: str = _T("SCART"); break;
+ default: str.Format(_T("PhysicalType %d"), PhysicalType); break;
+ }
+
+ m_vidinput.SetItemData(m_vidinput.AddString(str), i);
+ }
+ }
+ }
+
+ if(m_vidinput.GetCount() > 0)
+ {
+ m_vidinput.EnableWindow(TRUE);
+
+ long OutputPinCount, InputPinCount;
+ if(SUCCEEDED(pAMXB->get_PinCounts(&OutputPinCount, &InputPinCount)))
+ {
+ for(int i = 0; i < OutputPinCount; i++)
+ {
+ long InputPinIndex;
+ if(S_OK == pAMXB->get_IsRoutedTo(i, &InputPinIndex))
+ {
+ for(int j = 0; j < m_vidinput.GetCount(); j++)
+ {
+ if(m_vidinput.GetItemData(j) == InputPinIndex)
+ {
+ m_vidinput.SetCurSel(j);
+ i = OutputPinCount;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // tuner
+
+ if(m_pAMTuner = pAMTuner)
+ {
+ // TODO:...
+ }
+
+ // streamconfig
+
+ if(m_pAMVSC = pAMSC)
+ {
+ m_VidDisplayName = DisplayName;
+
+ AM_MEDIA_TYPE* pmt;
+ if(LoadMediaType(DisplayName, &pmt))
+ {
+ pAMSC->SetFormat(pmt);
+ DeleteMediaType(pmt);
+ }
+
+ SetupMediaTypes(pAMSC, m_vfa, m_vidtype, m_viddimension, m_mtv);
+ }
+
+ if(m_vidtype.GetCount() > 0)
+ {
+ m_vidfpsedit.EnableWindow(TRUE);
+ m_vidhor.EnableWindow(TRUE);
+ m_vidver.EnableWindow(TRUE);
+ m_vidhoredit.EnableWindow(TRUE);
+ m_vidveredit.EnableWindow(TRUE);
+ m_vidsetres.EnableWindow(TRUE);
+ }
+
+ {
+ m_vidoutput.EnableWindow(TRUE);
+ m_vidpreview.EnableWindow(TRUE);
+ }
+
+ UpdateMediaTypes();
+
+ UpdateUserDefinableControls();
+
+ UpdateOutputControls();
+}
+
+void CPlayerCaptureDialog::SetupVideoControls(
+ CStringW DisplayName,
+ CComPtr<IAMStreamConfig> pAMSC, CComPtr<IAMVfwCaptureDialogs> pAMVfwCD)
+{
+ EmptyVideo();
+
+ if(m_pAMVfwCD = pAMVfwCD)
+ {
+ if(S_OK == m_pAMVfwCD->HasDialog(VfwCaptureDialog_Source))
+ m_vidinput.SetItemData(m_vidinput.AddString(_T("Source")), (DWORD_PTR)VfwCaptureDialog_Source);
+ if(S_OK == m_pAMVfwCD->HasDialog(VfwCaptureDialog_Format))
+ m_vidinput.SetItemData(m_vidinput.AddString(_T("Format")), (DWORD_PTR)VfwCaptureDialog_Format);
+ if(S_OK == m_pAMVfwCD->HasDialog(VfwCaptureDialog_Display))
+ m_vidinput.SetItemData(m_vidinput.AddString(_T("Display")), (DWORD_PTR)VfwCaptureDialog_Display);
+
+ if(m_vidinput.GetCount() > 0)
+ {
+ m_vidinput.EnableWindow(TRUE);
+ m_vidinput.SetCurSel(0);
+ }
+ }
+
+ // streamconfig
+
+ if(m_pAMVSC = pAMSC)
+ {
+ m_VidDisplayName = DisplayName;
+
+ AM_MEDIA_TYPE* pmt;
+ if(LoadMediaType(DisplayName, &pmt))
+ {
+ pAMSC->SetFormat(pmt);
+ DeleteMediaType(pmt);
+ }
+
+ SetupMediaTypes(pAMSC, m_vfa, m_vidtype, m_viddimension, m_mtv);
+ }
+
+ if(m_vidtype.GetCount() > 0)
+ {
+ m_vidfpsedit.EnableWindow(TRUE);
+ m_vidhor.EnableWindow(TRUE);
+ m_vidver.EnableWindow(TRUE);
+ m_vidhoredit.EnableWindow(TRUE);
+ m_vidveredit.EnableWindow(TRUE);
+ m_vidsetres.EnableWindow(TRUE);
+ }
+
+ {
+ m_vidoutput.EnableWindow(TRUE);
+ m_vidpreview.EnableWindow(TRUE);
+ }
+
+ UpdateMediaTypes();
+
+ UpdateUserDefinableControls();
+
+ UpdateOutputControls();
+}
+
+void CPlayerCaptureDialog::SetupAudioControls(
+ CStringW DisplayName,
+ CComPtr<IAMStreamConfig> pAMSC, CInterfaceArray<IAMAudioInputMixer>& pAMAIM)
+{
+ EmptyAudio();
+
+ // input selection
+
+ if(pAMAIM.GetCount() > 0)
+ {
+ m_pAMAIM.Copy(pAMAIM);
+
+ int iSel = -1;
+
+ for(int i = 0; i < (int)m_pAMAIM.GetCount(); i++)
+ {
+ CComQIPtr<IPin> pPin = m_pAMAIM[i];
+ m_audinput.SetItemData(m_audinput.AddString(CString(GetPinName(pPin))), (DWORD_PTR)i);
+
+ BOOL fEnable;
+ if(SUCCEEDED(m_pAMAIM[i]->get_Enable(&fEnable)) && fEnable)
+ iSel = i;
+ }
+
+ if(m_audinput.GetCount() > 0)
+ {
+ for(int i = 0; i < m_audinput.GetCount(); i++)
+ {
+ if(m_audinput.GetItemData(i) == iSel)
+ {
+ m_audinput.SetCurSel(i);
+ break;
+ }
+ }
+
+ m_audinput.EnableWindow(TRUE);
+ }
+ }
+
+ // stream config
+
+ if(m_pAMASC = pAMSC)
+ {
+ m_AudDisplayName = DisplayName;
+
+ AM_MEDIA_TYPE* pmt;
+ if(LoadMediaType(DisplayName, &pmt))
+ {
+ pAMSC->SetFormat(pmt);
+ DeleteMediaType(pmt);
+ }
+
+ SetupMediaTypes(pAMSC, m_afa, m_audtype, m_auddimension, m_mta);
+ }
+
+// if(m_audtype.GetCount() > 0)
+ {
+ m_audoutput.EnableWindow(TRUE);
+ m_audpreview.EnableWindow(TRUE);
+ }
+
+ UpdateMediaTypes();
+
+ UpdateUserDefinableControls();
+
+ UpdateOutputControls();
+}
+
+bool CPlayerCaptureDialog::IsTunerActive()
+{
+ int iSel = m_vidinput.GetCurSel();
+ if(iSel < 0) return(false);
+ iSel = m_vidinput.GetItemData(iSel);
+ if(iSel < 0) return(false);
+
+ long PinIndexRelated, PhysicalType;
+ return(m_pAMXB
+ && SUCCEEDED(m_pAMXB->get_CrossbarPinInfo(TRUE, iSel, &PinIndexRelated, &PhysicalType))
+ && PhysicalType == PhysConn_Video_Tuner);
+}
+
+bool CPlayerCaptureDialog::SetVideoInput(int input)
+{
+ if(!m_pAMXB || input < 0) return false;
+
+ for(int i = 0; i < m_vidinput.GetCount(); i++)
+ {
+ if(m_vidinput.GetItemData(i) == input)
+ {
+ m_vidinput.SetCurSel(i);
+ OnVideoInput();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool CPlayerCaptureDialog::SetVideoChannel(int channel)
+{
+ if(!m_pAMTuner || channel < 0) return false;
+
+ return SUCCEEDED(m_pAMTuner->put_Channel(channel, AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT));
+}
+
+bool CPlayerCaptureDialog::SetAudioInput(int input)
+{
+ if(input < 0) return false;
+
+ for(int i = 0; i < m_audinput.GetCount(); i++)
+ {
+ if(m_audinput.GetItemData(i) == input)
+ {
+ m_audinput.SetCurSel(i);
+ OnAudioInput();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+int CPlayerCaptureDialog::GetVideoInput()
+{
+ int i = m_vidinput.GetCurSel();
+ if(i < 0) return -1;
+ return m_vidinput.GetItemData(i);
+}
+
+int CPlayerCaptureDialog::GetVideoChannel()
+{
+ long lChannel, lVivSub, lAudSub;
+ return m_pAMTuner && SUCCEEDED(m_pAMTuner->get_Channel(&lChannel, &lVivSub, &lAudSub)) ? lChannel : -1;
+}
+
+int CPlayerCaptureDialog::GetAudioInput()
+{
+ int i = m_audinput.GetCurSel();
+ if(i < 0) return -1;
+ return m_audinput.GetItemData(i);
+}
+
+BEGIN_MESSAGE_MAP(CPlayerCaptureDialog, CResizableDialog)
+ ON_WM_DESTROY()
+ ON_CBN_SELCHANGE(IDC_COMBO4, OnVideoInput)
+ ON_CBN_SELCHANGE(IDC_COMBO1, OnVideoType)
+ ON_CBN_SELCHANGE(IDC_COMBO5, OnVideoDimension)
+ ON_BN_CLICKED(IDC_BUTTON1, OnOverrideVideoDimension)
+ ON_CBN_SELCHANGE(IDC_COMBO3, OnAudioInput)
+ ON_CBN_SELCHANGE(IDC_COMBO2, OnAudioType)
+ ON_CBN_SELCHANGE(IDC_COMBO6, OnAudioDimension)
+ ON_BN_CLICKED(IDC_CHECK1, OnRecordVideo)
+ ON_CBN_SELCHANGE(IDC_COMBO7, OnVideoCodec)
+ ON_CBN_SELCHANGE(IDC_COMBO9, OnVideoCodecType)
+ ON_CBN_SELCHANGE(IDC_COMBO10, OnVideoCodecDimension)
+ ON_BN_CLICKED(IDC_CHECK3, OnRecordAudio)
+ ON_CBN_SELCHANGE(IDC_COMBO8, OnAudioCodec)
+ ON_CBN_SELCHANGE(IDC_COMBO12, OnAudioCodecType)
+ ON_CBN_SELCHANGE(IDC_COMBO11, OnAudioCodecDimension)
+ ON_BN_CLICKED(IDC_BUTTON3, OnOpenFile)
+ ON_BN_CLICKED(IDC_BUTTON2, OnRecord)
+ ON_EN_CHANGE(IDC_EDIT5, OnEnChangeEdit9)
+ ON_EN_CHANGE(IDC_EDIT6, OnEnChangeEdit12)
+ ON_WM_TIMER()
+ ON_BN_CLICKED(IDC_CHECK2, OnBnClickedVidAudPreview)
+ ON_BN_CLICKED(IDC_CHECK4, OnBnClickedVidAudPreview)
+ ON_BN_CLICKED(IDC_CHECK5, OnBnClickedCheck7)
+ ON_CBN_SELCHANGE(IDC_COMBO14, OnCbnSelchangeCombo14)
+END_MESSAGE_MAP()
+
+
+// CPlayerCaptureDialog message handlers
+
+BOOL CPlayerCaptureDialog::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ InitCodecList(m_pVidEncArray, m_vidcodec, CLSID_VideoCompressorCategory);
+ UpdateVideoCodec();
+
+ InitCodecList(m_pAudEncArray, m_audcodec, CLSID_AudioCompressorCategory);
+ UpdateAudioCodec();
+
+ m_fEnableOgm = IsCLSIDRegistered(_T("{8cae96b7-85b1-4605-b23c-17ff5262b296}"));
+
+ m_nVidBuffers = AfxGetApp()->GetProfileInt(_T("Capture"), _T("VidBuffers"), 50);
+ m_nAudBuffers = AfxGetApp()->GetProfileInt(_T("Capture"), _T("AudBuffers"), 50);
+ m_fVidOutput = !!AfxGetApp()->GetProfileInt(_T("Capture"), _T("VidOutput"), TRUE);
+ m_fAudOutput = !!AfxGetApp()->GetProfileInt(_T("Capture"), _T("AudOutput"), TRUE);
+ m_fVidPreview = AfxGetApp()->GetProfileInt(_T("Capture"), _T("VidPreview"), TRUE);
+ m_fAudPreview = AfxGetApp()->GetProfileInt(_T("Capture"), _T("AudPreview"), TRUE);
+ m_muxtype = AfxGetApp()->GetProfileInt(_T("Capture"), _T("FileFormat"), 0);
+ m_file = AfxGetApp()->GetProfileString(_T("Capture"), _T("FileName"), _T(""));
+ m_fSepAudio = AfxGetApp()->GetProfileInt(_T("Capture"), _T("SepAudio"), TRUE);
+
+ m_muxctrl.AddString(_T("AVI"));
+ m_muxctrl.AddString(_T("Ogg Media"));
+ m_muxctrl.AddString(_T("Matroska"));
+ m_muxctrl.AddString(_T("DirectShow Media"));
+
+// UpdateMuxer();
+
+ UpdateData(FALSE);
+
+ OnCbnSelchangeCombo14();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CPlayerCaptureDialog::OnDestroy()
+{
+ UpdateData();
+
+ AfxGetApp()->WriteProfileInt(_T("Capture"), _T("VidOutput"), m_fVidOutput);
+ AfxGetApp()->WriteProfileInt(_T("Capture"), _T("AudOutput"), m_fAudOutput);
+ AfxGetApp()->WriteProfileInt(_T("Capture"), _T("VidPreview"), m_fVidPreview);
+ AfxGetApp()->WriteProfileInt(_T("Capture"), _T("AudPreview"), m_fAudPreview);
+ AfxGetApp()->WriteProfileInt(_T("Capture"), _T("FileFormat"), m_muxtype);
+ AfxGetApp()->WriteProfileString(_T("Capture"), _T("FileName"), m_file);
+ AfxGetApp()->WriteProfileInt(_T("Capture"), _T("SepAudio"), m_fSepAudio);
+
+ __super::OnDestroy();
+}
+
+void CPlayerCaptureDialog::OnVideoInput()
+{
+ int iSel = m_vidinput.GetCurSel();
+ if(iSel < 0) return;
+ iSel = m_vidinput.GetItemData(iSel);
+ if(iSel < 0) return;
+
+ if(m_pAMXB)
+ {
+ long PinIndexRelated, PhysicalType;
+ if(FAILED(m_pAMXB->get_CrossbarPinInfo(TRUE, iSel, &PinIndexRelated, &PhysicalType)))
+ return;
+
+ long OutputPinCount, InputPinCount;
+ if(FAILED(m_pAMXB->get_PinCounts(&OutputPinCount, &InputPinCount)))
+ return;
+
+ for(int i = 0; i < OutputPinCount; i++)
+ {
+ if(S_OK == m_pAMXB->CanRoute(i, iSel))
+ {
+ m_pAMXB->Route(i, iSel);
+ break;
+ }
+ }
+
+ if(PinIndexRelated >= 0)
+ {
+ for(int i = 0; i < OutputPinCount; i++)
+ {
+ if(S_OK == m_pAMXB->CanRoute(i, PinIndexRelated))
+ {
+ m_pAMXB->Route(i, PinIndexRelated);
+ break;
+ }
+ }
+ }
+ }
+ else if(m_pAMVfwCD)
+ {
+ if(S_OK == m_pAMVfwCD->HasDialog(iSel))
+ {
+ HRESULT hr = m_pAMVfwCD->ShowDialog(iSel, m_hWnd);
+
+ if(VFW_E_NOT_STOPPED == hr)
+ {
+ ((CMainFrame*)AfxGetMainWnd())->SendMessage(WM_COMMAND, ID_PLAY_STOP);
+ hr = m_pAMVfwCD->ShowDialog(iSel, m_hWnd);
+ ((CMainFrame*)AfxGetMainWnd())->SendMessage(WM_COMMAND, ID_PLAY_PLAY);
+ }
+
+ if(VFW_E_CANNOT_CONNECT == hr)
+ UpdateGraph();
+ }
+ }
+}
+
+void CPlayerCaptureDialog::OnVideoType()
+{
+ if(SetupDimension(m_vfa, m_vidtype, m_viddimension))
+ OnVideoDimension();
+}
+
+void CPlayerCaptureDialog::OnVideoDimension()
+{
+ int iSel = m_viddimension.GetCurSel();
+ if(iSel < 0) return;
+
+ CVidFormatElem* pvfe = (CVidFormatElem*)m_viddimension.GetItemData(iSel);
+ if(!pvfe) return;
+
+ BITMAPINFOHEADER* bih = (pvfe->mt.formattype == FORMAT_VideoInfo)
+ ? &((VIDEOINFOHEADER*)pvfe->mt.pbFormat)->bmiHeader
+ : (pvfe->mt.formattype == FORMAT_VideoInfo2)
+ ? &((VIDEOINFOHEADER2*)pvfe->mt.pbFormat)->bmiHeader
+ : NULL;
+
+ m_vidhor.SetRange(0, 32767);
+ m_vidver.SetRange(0, 32767);
+ m_vidhor.SetPos(bih->biWidth);
+ m_vidver.SetPos(abs(bih->biHeight));
+ CString fps;
+ fps.Format(_T("%.4f"), (float)(10000000.0 / ((VIDEOINFOHEADER*)pvfe->mt.pbFormat)->AvgTimePerFrame));
+ m_vidfpsedit.SetWindowText(fps);
+
+ UpdateGraph();
+}
+
+void CPlayerCaptureDialog::OnOverrideVideoDimension()
+{
+ UpdateGraph();
+}
+
+void CPlayerCaptureDialog::OnAudioInput()
+{
+ int iSel = m_audinput.GetCurSel();
+
+ for(int i = 0; i < (int)m_pAMAIM.GetCount(); i++)
+ {
+ m_pAMAIM[m_audinput.GetItemData(i)]->put_Enable(i == iSel ? TRUE : FALSE);
+ }
+}
+
+void CPlayerCaptureDialog::OnAudioType()
+{
+ if(SetupDimension(m_afa, m_audtype, m_auddimension))
+ OnAudioDimension();
+}
+
+void CPlayerCaptureDialog::OnAudioDimension()
+{
+ UpdateGraph();
+}
+
+void CPlayerCaptureDialog::OnRecordVideo()
+{
+ UpdateOutputControls();
+}
+
+void CPlayerCaptureDialog::OnVideoCodec()
+{
+ ShowPPage(m_pVidEncArray, m_vidcodec, m_hWnd);
+ UpdateVideoCodec();
+}
+
+void CPlayerCaptureDialog::OnVideoCodecType()
+{
+ if(SetupDimension(m_vcfa, m_vidcodectype, m_vidcodecdimension))
+ OnVideoCodecDimension();
+}
+
+void CPlayerCaptureDialog::OnVideoCodecDimension()
+{
+ int i = m_vidcodecdimension.GetCurSel();
+ if(i >= 0)
+ {
+ m_mtcv = ((CVidFormatElem*)m_vidcodecdimension.GetItemData(i))->mt;
+
+ // we have to recreate the encoder, otherwise it will accept the new media type for only the first time
+ m_pVidEnc = NULL;
+ m_pVidEncMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&m_pVidEnc);
+ }
+}
+
+void CPlayerCaptureDialog::OnRecordAudio()
+{
+ UpdateOutputControls();
+}
+
+void CPlayerCaptureDialog::OnAudioCodec()
+{
+ ShowPPage(m_pAudEncArray, m_audcodec, m_hWnd);
+ UpdateAudioCodec();
+}
+
+void CPlayerCaptureDialog::OnAudioCodecType()
+{
+ if(SetupDimension(m_acfa, m_audcodectype, m_audcodecdimension))
+ OnAudioCodecDimension();
+}
+
+void CPlayerCaptureDialog::OnAudioCodecDimension()
+{
+ int i = m_audcodecdimension.GetCurSel();
+ if(i >= 0)
+ {
+ m_mtca = ((CAudFormatElem*)m_audcodecdimension.GetItemData(i))->mt;
+
+ // we have to recreate the encoder, otherwise it will accept the new media type for only the first time
+ m_pAudEnc = NULL;
+ m_pAudEncMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&m_pAudEnc);
+/*
+ SaveMediaType(
+ CString(m_pAudEncArray[m_audcodec.GetItemData(m_audcodec.GetCurSel())].DisplayName.m_str),
+ &m_mtca);
+*/ }
+}
+
+void CPlayerCaptureDialog::OnOpenFile()
+{
+ CFileDialog fd(FALSE, NULL, NULL,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
+ _T("Media files (*.avi,*.ogm,*.mkv,*.dsm)|*.avi;*.ogm;*.mkv;*.dsm|"), this, 0);
+
+ if(fd.DoModal() == IDOK)
+ {
+ CString str = fd.GetPathName();
+
+ CString ext = str.Mid(str.ReverseFind('.')+1).MakeLower();
+ if(ext == _T("avi")) m_muxtype = 0;
+ else if(ext == _T("ogm")) m_muxtype = 1;
+ else if(ext == _T("mkv")) m_muxtype = 2;
+ else if(ext == _T("dsm")) m_muxtype = 3;
+ else
+ {
+ if(m_muxtype == 0) str += _T(".avi");
+ else if(m_muxtype == 1) str += _T(".ogm");
+ else if(m_muxtype == 2) str += _T(".mkv");
+ else if(m_muxtype == 3) str += _T(".dsm");
+ }
+
+ m_file = str;
+
+ UpdateData(FALSE);
+ }
+
+ UpdateOutputControls();
+}
+
+void CPlayerCaptureDialog::OnRecord()
+{
+ UpdateData();
+
+ CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
+ if(!pFrame) return;
+
+ if(!pFrame->m_fCapturing)
+ {
+ UpdateMuxer();
+
+ CComQIPtr<IFileSinkFilter2> pFSF = m_pMux;
+ if(pFSF)
+ {
+ m_pDst = m_pMux;
+ }
+ else
+ {
+ m_pDst = NULL;
+ m_pDst.CoCreateInstance(CLSID_FileWriter);
+ pFSF = m_pDst;
+ }
+
+ if(!pFSF
+ || FAILED(pFSF->SetFileName(CStringW(m_file), NULL))
+ || FAILED(pFSF->SetMode(AM_FILE_OVERWRITE)))
+ {
+ AfxMessageBox(_T("Error initializing the output file"));
+ return;
+ }
+
+ CString audfn = m_file.Left(m_file.ReverseFind('.')+1);
+ if(m_fSepAudio && m_fAudOutput && m_pAudMux && !audfn.IsEmpty())
+ {
+ audfn += _T("wav");
+
+ CComQIPtr<IFileSinkFilter2> pFSF = m_pAudMux;
+ if(pFSF)
+ {
+ m_pAudDst = m_pAudMux;
+ }
+ else
+ {
+ m_pAudDst = NULL;
+ m_pAudDst.CoCreateInstance(CLSID_FileWriter);
+ pFSF = m_pAudDst;
+ }
+
+ if(!pFSF
+ || FAILED(pFSF->SetFileName(CStringW(audfn), NULL))
+ || FAILED(pFSF->SetMode(AM_FILE_OVERWRITE)))
+ {
+ AfxMessageBox(_T("Error initializing the audio output file"));
+ return;
+ }
+ }
+
+ m_pVidBuffer = m_fVidOutput && m_nVidBuffers > 0 && m_muxtype != 2 && m_muxtype != 3 ? new CBufferFilter(NULL, NULL) : NULL;
+ if(CComQIPtr<IBufferFilter> pVB = m_pVidBuffer)
+ {pVB->SetBuffers(m_nVidBuffers); pVB->SetPriority(THREAD_PRIORITY_NORMAL);}
+
+ m_pAudBuffer = m_fAudOutput && m_nAudBuffers > 0 && m_muxtype != 2 && m_muxtype != 3 ? new CBufferFilter(NULL, NULL) : NULL;
+ if(CComQIPtr<IBufferFilter> pAB = m_pAudBuffer)
+ {pAB->SetBuffers(m_nAudBuffers); pAB->SetPriority(THREAD_PRIORITY_ABOVE_NORMAL);}
+
+ EnableControls(this, false);
+
+ pFrame->StartCapture();
+
+ SetTimer(1, 100, NULL);
+ }
+ else
+ {
+ KillTimer(1);
+
+ pFrame->StopCapture();
+/*
+ {
+ if(FILE* f = _tfopen(m_file, _T("rb+")))
+ {
+ fseek(f, 0x20, SEEK_SET);
+ unsigned short mspf = (unsigned short)(((VIDEOINFOHEADER*)m_mtv.pbFormat)->AvgTimePerFrame / 10);
+ fwrite(&mspf, 1, 2, f);
+ fclose(f);
+ }
+ }
+*/
+ EnableControls(this, true);
+
+ m_pVidBuffer = NULL;
+ m_pAudBuffer = NULL;
+ }
+}
+
+void CPlayerCaptureDialog::OnEnChangeEdit9()
+{
+ UpdateData();
+ AfxGetApp()->WriteProfileInt(_T("Capture"), _T("VidBuffers"), max(m_nVidBuffers, 0));
+}
+
+void CPlayerCaptureDialog::OnEnChangeEdit12()
+{
+ UpdateData();
+ AfxGetApp()->WriteProfileInt(_T("Capture"), _T("AudBuffers"), max(m_nAudBuffers, 0));
+}
+
+void CPlayerCaptureDialog::OnTimer(UINT nIDEvent)
+{
+ if(nIDEvent == 1)
+ {
+ if(((CMainFrame*)AfxGetMainWnd())->m_fCapturing)
+ {
+ ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes;
+ if(GetDiskFreeSpaceEx(m_file.Left(m_file.ReverseFind('\\')+1), &FreeBytesAvailable, &TotalNumberOfBytes, &TotalNumberOfFreeBytes)
+ && FreeBytesAvailable.QuadPart < 1024i64*1024*10)
+ {
+ OnRecord();
+ }
+ }
+ }
+
+ __super::OnTimer(nIDEvent);
+}
+
+void CPlayerCaptureDialog::OnBnClickedVidAudPreview()
+{
+ UpdateData();
+ UpdateGraph();
+}
+
+void CPlayerCaptureDialog::OnBnClickedCheck7()
+{
+// UpdateMuxer();
+}
+
+void CPlayerCaptureDialog::OnCbnSelchangeCombo14()
+{
+ UpdateData();
+
+ CString ext = m_file.Mid(m_file.ReverseFind('.')+1).MakeLower();
+
+ if(m_muxtype == 0 && ext != _T("avi"))
+ m_file = m_file.Left(m_file.GetLength()-4) + _T(".avi");
+ else if(m_muxtype == 1 && ext != _T("ogm"))
+ m_file = m_file.Left(m_file.GetLength()-4) + _T(".ogm");
+ else if(m_muxtype == 2 && ext != _T("mkv"))
+ m_file = m_file.Left(m_file.GetLength()-4) + _T(".mkv");
+ else if(m_muxtype == 3 && ext != _T("dsm"))
+ m_file = m_file.Left(m_file.GetLength()-4) + _T(".dsm");
+
+ UpdateData(FALSE);
+
+ GetDlgItem(IDC_EDIT5)->EnableWindow(m_muxtype != 2 && m_muxtype != 3);
+ GetDlgItem(IDC_EDIT6)->EnableWindow(m_muxtype != 2 && m_muxtype != 3);
+
+ m_recordbtn.EnableWindow(m_muxtype != 1 || m_fEnableOgm);
+}
diff --git a/src/apps/mplayerc/PlayerCaptureDialog.h b/src/apps/mplayerc/PlayerCaptureDialog.h
new file mode 100644
index 000000000..ddde4d1fb
--- /dev/null
+++ b/src/apps/mplayerc/PlayerCaptureDialog.h
@@ -0,0 +1,452 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxwin.h"
+#include "afxcmn.h"
+#include "..\..\filters\transform\bufferfilter\bufferfilter.h"
+#include "FloatEdit.h"
+
+//
+
+template<class T>
+class CFormatElem
+{
+public:
+ CMediaType mt;
+ T caps;
+};
+
+template<class T>
+class CFormat : public CAutoPtrArray<CFormatElem<T> >
+{
+public:
+ CString name;
+ CFormat(CString name = _T("")) {this->name = name;}
+ virtual ~CFormat() {}
+};
+
+template<class T>
+class CFormatArray : public CAutoPtrArray<CFormat<T> >
+{
+public:
+ virtual ~CFormatArray() {}
+
+ CFormat<T>* Find(CString name, bool fCreate = false)
+ {
+ for(int i = 0; i < (int)GetCount(); i++)
+ {
+ if(GetAt(i)->name == name)
+ return(GetAt(i));
+ }
+
+ if(fCreate)
+ {
+ CAutoPtr<CFormat<T> > pf(new CFormat<T>(name));
+ CFormat<T>* tmp = pf;
+ Add(pf);
+ return(tmp);
+ }
+
+ return(NULL);
+ }
+
+ bool FindFormat(AM_MEDIA_TYPE* pmt, CFormat<T>** ppf)
+ {
+ if(!pmt) return(false);
+
+ for(int i = 0; i < (int)GetCount(); i++)
+ {
+ CFormat<T>* pf = GetAt(i);
+ for(int j = 0; j < (int)pf->GetCount(); j++)
+ {
+ CFormatElem<T>* pfe = pf->GetAt(j);
+ if(!pmt || (pfe->mt.majortype == pmt->majortype && pfe->mt.subtype == pmt->subtype))
+ {
+ if(ppf) *ppf = pf;
+ return(true);
+ }
+ }
+ }
+
+ return(false);
+ }
+
+ bool FindFormat(AM_MEDIA_TYPE* pmt, T* pcaps, CFormat<T>** ppf, CFormatElem<T>** ppfe)
+ {
+ if(!pmt && !pcaps) return(false);
+
+ for(int i = 0; i < (int)GetCount(); i++)
+ {
+ CFormat<T>* pf = GetAt(i);
+ for(int j = 0; j < (int)pf->GetCount(); j++)
+ {
+ CFormatElem<T>* pfe = pf->GetAt(j);
+ if((!pmt || pfe->mt == *pmt) && (!pcaps || !memcmp(pcaps, &pfe->caps, sizeof(T))))
+ {
+ if(ppf) *ppf = pf;
+ if(ppfe) *ppfe = pfe;
+ return(true);
+ }
+ }
+ }
+
+ return(false);
+ }
+
+ bool AddFormat(AM_MEDIA_TYPE* pmt, T caps)
+ {
+ if(!pmt) return(false);
+
+ if(FindFormat(pmt, NULL, NULL, NULL)) {DeleteMediaType(pmt); return(false);}
+// if(pmt->formattype == FORMAT_VideoInfo2) {DeleteMediaType(pmt); return(false);} // TODO
+
+ CFormat<T>* pf = Find(MakeFormatName(pmt), true);
+ if(!pf) {DeleteMediaType(pmt); return(false);}
+
+ CAutoPtr<CFormatElem<T> > pfe(new CFormatElem<T>());
+ pfe->mt = *pmt;
+ pfe->caps = caps;
+ pf->Add(pfe);
+
+ return(true);
+ }
+
+ bool AddFormat(AM_MEDIA_TYPE* pmt, void* pcaps, int size)
+ {
+ if(!pcaps) return false;
+ ASSERT(size == sizeof(T));
+ return AddFormat(pmt, *(T*)pcaps);
+ }
+
+ virtual CString MakeFormatName(AM_MEDIA_TYPE* pmt) = 0;
+ virtual CString MakeDimensionName(CFormatElem<T>* pfe) = 0;
+};
+
+typedef CFormatElem<VIDEO_STREAM_CONFIG_CAPS> CVidFormatElem;
+typedef CFormat<VIDEO_STREAM_CONFIG_CAPS> CVidFormat;
+
+class CVidFormatArray : public CFormatArray<VIDEO_STREAM_CONFIG_CAPS>
+{
+public:
+ CString MakeFormatName(AM_MEDIA_TYPE* pmt)
+ {
+ CString str(_T("Default"));
+
+ if(!pmt) return(str);
+
+ BITMAPINFOHEADER* bih = (pmt->formattype == FORMAT_VideoInfo)
+ ? &((VIDEOINFOHEADER*)pmt->pbFormat)->bmiHeader
+ : (pmt->formattype == FORMAT_VideoInfo2)
+ ? &((VIDEOINFOHEADER2*)pmt->pbFormat)->bmiHeader
+ : NULL;
+
+ if(!bih)
+ {
+ // it may have a fourcc in the mediasubtype, let's check that
+
+ WCHAR guid[100];
+ memset(guid, 0, 100*sizeof(WCHAR));
+ StringFromGUID2(pmt->subtype, guid, 100);
+
+ if(CStringW(guid).MakeUpper().Find(L"0000-0010-8000-00AA00389B71") >= 0)
+ {
+ str.Format(_T("%c%c%c%c"),
+ (TCHAR)((pmt->subtype.Data1>>0)&0xff), (TCHAR)((pmt->subtype.Data1>>8)&0xff),
+ (TCHAR)((pmt->subtype.Data1>>16)&0xff), (TCHAR)((pmt->subtype.Data1>>24)&0xff));
+ }
+
+ return(str);
+ }
+
+ switch(bih->biCompression)
+ {
+ case BI_RGB: str.Format(_T("RGB%d"), bih->biBitCount); break;
+ case BI_RLE8: str = _T("RLE8"); break;
+ case BI_RLE4: str = _T("RLE4"); break;
+ case BI_BITFIELDS: str.Format(_T("BITF%d"), bih->biBitCount); break;
+ case BI_JPEG: str = _T("JPEG"); break;
+ case BI_PNG: str = _T("PNG"); break;
+ default:
+ str.Format(_T("%c%c%c%c"),
+ (TCHAR)((bih->biCompression>>0)&0xff), (TCHAR)((bih->biCompression>>8)&0xff),
+ (TCHAR)((bih->biCompression>>16)&0xff), (TCHAR)((bih->biCompression>>24)&0xff));
+ break;
+ }
+
+ return(str);
+ }
+
+ CString MakeDimensionName(CVidFormatElem* pfe)
+ {
+ CString str(_T("Default"));
+
+ if(!pfe) return(str);
+
+ BITMAPINFOHEADER* bih = (pfe->mt.formattype == FORMAT_VideoInfo)
+ ? &((VIDEOINFOHEADER*)pfe->mt.pbFormat)->bmiHeader
+ : (pfe->mt.formattype == FORMAT_VideoInfo2)
+ ? &((VIDEOINFOHEADER2*)pfe->mt.pbFormat)->bmiHeader
+ : NULL;
+
+ if(bih == NULL) return(str);
+
+ str.Format(_T("%dx%d %.2f"), bih->biWidth, bih->biHeight, (float)10000000/((VIDEOINFOHEADER*)pfe->mt.pbFormat)->AvgTimePerFrame);
+
+ if(pfe->mt.formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)pfe->mt.pbFormat;
+ CString str2;
+ str2.Format(_T(" i%02x %d:%d"), vih2->dwInterlaceFlags, vih2->dwPictAspectRatioX, vih2->dwPictAspectRatioY);
+ str += str2;
+ }
+
+ return(str);
+ }
+};
+
+typedef CFormatElem<AUDIO_STREAM_CONFIG_CAPS> CAudFormatElem;
+typedef CFormat<AUDIO_STREAM_CONFIG_CAPS> CAudFormat;
+
+class CAudFormatArray : public CFormatArray<AUDIO_STREAM_CONFIG_CAPS>
+{
+public:
+ CString MakeFormatName(AM_MEDIA_TYPE* pmt)
+ {
+ CString str(_T("Unknown"));
+
+ if(!pmt) return(str);
+
+ WAVEFORMATEX* wfe = (pmt->formattype == FORMAT_WaveFormatEx)
+ ? (WAVEFORMATEX*)pmt->pbFormat
+ : NULL;
+
+ if(!wfe)
+ {
+ WCHAR guid[100];
+ memset(guid, 0, 100*sizeof(WCHAR));
+ StringFromGUID2(pmt->subtype, guid, 100);
+
+ if(CStringW(guid).MakeUpper().Find(L"0000-0010-8000-00AA00389B71") >= 0)
+ {
+ str.Format(_T("0x%04x"), pmt->subtype.Data1);
+ }
+
+ return(str);
+ }
+
+ switch(wfe->wFormatTag)
+ {
+ case 1: str = _T("PCM "); break;
+ default: str.Format(_T("0x%03x "), wfe->wFormatTag); break;
+ }
+
+ return(str);
+ }
+
+ CString MakeDimensionName(CAudFormatElem* pfe)
+ {
+ CString str(_T("Unknown"));
+
+ if(!pfe) return(str);
+
+ WAVEFORMATEX* wfe = (pfe->mt.formattype == FORMAT_WaveFormatEx)
+ ? (WAVEFORMATEX*)pfe->mt.pbFormat
+ : NULL;
+
+ if(!wfe) return(str);
+
+ str.Empty();
+ CString str2;
+
+ str2.Format(_T("%6dKHz "), wfe->nSamplesPerSec); str += str2;
+
+ str2.Format(_T("%dbps "), wfe->wBitsPerSample); str += str2;
+
+ switch(wfe->nChannels)
+ {
+ case 1: str += _T("mono "); break;
+ case 2: str += _T("stereo "); break;
+ default: str2.Format(_T("%d channels "), wfe->nChannels); str += str2; break;
+ }
+
+ str2.Format(_T("%3dkbps "), wfe->nAvgBytesPerSec*8/1000); str += str2;
+
+ return(str);
+ }
+};
+
+//
+
+typedef struct
+{
+ CComPtr<IMoniker> pMoniker;
+ CComPtr<IBaseFilter> pBF;
+ CString FriendlyName;
+ CComBSTR DisplayName;
+} Codec;
+
+typedef CAtlArray<Codec> CCodecArray;
+
+// CPlayerCaptureDialog dialog
+
+class CPlayerCaptureDialog : public CResizableDialog //CDialog
+{
+ //DECLARE_DYNAMIC(CPlayerCaptureDialog)
+
+ // video input
+ CStringW m_VidDisplayName;
+ CComPtr<IAMStreamConfig> m_pAMVSC;
+ CComPtr<IAMCrossbar> m_pAMXB;
+ CComPtr<IAMTVTuner> m_pAMTuner;
+ CComPtr<IAMVfwCaptureDialogs> m_pAMVfwCD;
+ CVidFormatArray m_vfa;
+
+ // audio input
+ CStringW m_AudDisplayName;
+ CComPtr<IAMStreamConfig> m_pAMASC;
+ CInterfaceArray<IAMAudioInputMixer> m_pAMAIM;
+ CAudFormatArray m_afa;
+
+ // video codec
+ CCodecArray m_pVidEncArray;
+ CVidFormatArray m_vcfa;
+
+ // audio codec
+ CCodecArray m_pAudEncArray;
+ CAudFormatArray m_acfa;
+
+ void EmptyVideo();
+ void EmptyAudio();
+
+ void UpdateMediaTypes();
+ void UpdateUserDefinableControls();
+ void UpdateVideoCodec();
+ void UpdateAudioCodec();
+ void UpdateMuxer();
+ void UpdateOutputControls();
+
+ void UpdateGraph();
+
+ CMap<HWND, HWND&, BOOL, BOOL&> m_wndenabledmap;
+ void EnableControls(CWnd* pWnd, bool fEnable);
+
+ bool m_fEnableOgm;
+
+public:
+ CPlayerCaptureDialog(); // standard constructor
+ virtual ~CPlayerCaptureDialog();
+
+ BOOL Create(CWnd* pParent = NULL);
+
+// Dialog Data
+ enum { IDD = IDD_CAPTURE_DLG };
+
+ CComboBox m_vidinput;
+ CComboBox m_vidtype;
+ CComboBox m_viddimension;
+ CSpinButtonCtrl m_vidhor;
+ CSpinButtonCtrl m_vidver;
+ CEdit m_vidhoredit;
+ CEdit m_vidveredit;
+ CFloatEdit m_vidfpsedit;
+ float m_vidfps;
+ CButton m_vidsetres;
+ CComboBox m_audinput;
+ CComboBox m_audtype;
+ CComboBox m_auddimension;
+ CComboBox m_vidcodec;
+ CComboBox m_vidcodectype;
+ CComboBox m_vidcodecdimension;
+ BOOL m_fVidOutput;
+ CButton m_vidoutput;
+ int m_fVidPreview;
+ CButton m_vidpreview;
+ CComboBox m_audcodec;
+ CComboBox m_audcodectype;
+ CComboBox m_audcodecdimension;
+ BOOL m_fAudOutput;
+ CButton m_audoutput;
+ int m_fAudPreview;
+ CButton m_audpreview;
+ int m_nVidBuffers;
+ int m_nAudBuffers;
+ CString m_file;
+ CButton m_recordbtn;
+ BOOL m_fSepAudio;
+ int m_muxtype;
+ CComboBox m_muxctrl;
+
+ CMediaType m_mtv, m_mta, m_mtcv, m_mtca;
+ CComPtr<IBaseFilter> m_pVidEnc, m_pAudEnc, m_pMux, m_pDst, m_pAudMux, m_pAudDst;
+ CComPtr<IMoniker> m_pVidEncMoniker, m_pAudEncMoniker;
+ CComPtr<IBaseFilter> m_pVidBuffer, m_pAudBuffer;
+
+public:
+ void SetupVideoControls(CStringW DisplayName, CComPtr<IAMStreamConfig> pAMSC, CComPtr<IAMCrossbar> pAMXB, CComPtr<IAMTVTuner> pAMTuner);
+ void SetupVideoControls(CStringW DisplayName, CComPtr<IAMStreamConfig> pAMSC, CComPtr<IAMVfwCaptureDialogs> pAMVfwCD);
+ void SetupAudioControls(CStringW DisplayName, CComPtr<IAMStreamConfig> pAMSC, CInterfaceArray<IAMAudioInputMixer>& pAMAIM);
+
+ bool IsTunerActive();
+
+ bool SetVideoInput(int input);
+ bool SetVideoChannel(int channel);
+ bool SetAudioInput(int input);
+
+ int GetVideoInput();
+ int GetVideoChannel();
+ int GetAudioInput();
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+ virtual BOOL OnInitDialog();
+ virtual void OnOK() {}
+ virtual void OnCancel() {}
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnDestroy();
+ afx_msg void OnVideoInput();
+ afx_msg void OnVideoType();
+ afx_msg void OnVideoDimension();
+ afx_msg void OnOverrideVideoDimension();
+ afx_msg void OnAudioInput();
+ afx_msg void OnAudioType();
+ afx_msg void OnAudioDimension();
+ afx_msg void OnRecordVideo();
+ afx_msg void OnVideoCodec();
+ afx_msg void OnVideoCodecType();
+ afx_msg void OnVideoCodecDimension();
+ afx_msg void OnRecordAudio();
+ afx_msg void OnAudioCodec();
+ afx_msg void OnAudioCodecType();
+ afx_msg void OnAudioCodecDimension();
+ afx_msg void OnOpenFile();
+ afx_msg void OnRecord();
+ afx_msg void OnEnChangeEdit9();
+ afx_msg void OnEnChangeEdit12();
+ afx_msg void OnTimer(UINT nIDEvent);
+ afx_msg void OnBnClickedVidAudPreview();
+ afx_msg void OnBnClickedCheck7();
+ afx_msg void OnCbnSelchangeCombo14();
+};
diff --git a/src/apps/mplayerc/PlayerInfoBar.cpp b/src/apps/mplayerc/PlayerInfoBar.cpp
new file mode 100644
index 000000000..e1e47ec96
--- /dev/null
+++ b/src/apps/mplayerc/PlayerInfoBar.cpp
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PlayerInfoBar.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PlayerInfoBar.h"
+#include "MainFrm.h"
+
+
+// CPlayerInfoBar
+
+IMPLEMENT_DYNAMIC(CPlayerInfoBar, CDialogBar)
+CPlayerInfoBar::CPlayerInfoBar(int nFirstColWidth) : m_nFirstColWidth(nFirstColWidth)
+{
+}
+
+CPlayerInfoBar::~CPlayerInfoBar()
+{
+}
+
+void CPlayerInfoBar::SetLine(CString label, CString info)
+{
+ if(info.IsEmpty())
+ {
+ RemoveLine(label);
+ return;
+ }
+
+ for(size_t idx = 0; idx < m_label.GetCount(); idx++)
+ {
+ CString tmp;
+ m_label[idx]->GetWindowText(tmp);
+ if(label == tmp)
+ {
+ m_info[idx]->GetWindowText(tmp);
+ if(info != tmp) m_info[idx]->SetWindowText(info);
+ return;
+ }
+ }
+
+ CAutoPtr<CStatusLabel> l(new CStatusLabel(true, false));
+ l->Create(label, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|SS_OWNERDRAW, CRect(0,0,0,0), this);
+ m_label.Add(l);
+
+ CAutoPtr<CStatusLabel> i(new CStatusLabel(false, true));
+ i->Create(info, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS|SS_OWNERDRAW, CRect(0,0,0,0), this);
+ m_info.Add(i);
+
+ Relayout();
+}
+
+void CPlayerInfoBar::GetLine(CString label, CString& info)
+{
+ info.Empty();
+
+ for(size_t idx = 0; idx < m_label.GetCount(); idx++)
+ {
+ CString tmp;
+ m_label[idx]->GetWindowText(tmp);
+ if(label == tmp)
+ {
+ m_info[idx]->GetWindowText(tmp);
+ info = tmp;
+ return;
+ }
+ }
+}
+
+void CPlayerInfoBar::RemoveLine(CString label)
+{
+ for(size_t i = 0; i < m_label.GetCount(); i++)
+ {
+ CString tmp;
+ m_label[i]->GetWindowText(tmp);
+ if(label == tmp)
+ {
+ m_label.RemoveAt(i);
+ m_info.RemoveAt(i);
+ break;
+ }
+ }
+
+ Relayout();
+}
+
+void CPlayerInfoBar::RemoveAllLines()
+{
+ m_label.RemoveAll();
+ m_info.RemoveAll();
+
+ Relayout();
+}
+
+BOOL CPlayerInfoBar::Create(CWnd* pParentWnd)
+{
+ return CDialogBar::Create(pParentWnd, IDD_PLAYERINFOBAR, WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM, IDD_PLAYERINFOBAR);
+}
+
+BOOL CPlayerInfoBar::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!CDialogBar::PreCreateWindow(cs))
+ return FALSE;
+
+ m_dwStyle &= ~CBRS_BORDER_TOP;
+ m_dwStyle &= ~CBRS_BORDER_BOTTOM;
+
+ return TRUE;
+}
+
+CSize CPlayerInfoBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
+{
+ CRect r;
+ GetParent()->GetClientRect(&r);
+ r.bottom = r.top + m_label.GetCount() * 17 + (m_label.GetCount() ? 4 : 0);
+ return r.Size();
+}
+
+void CPlayerInfoBar::Relayout()
+{
+ CRect r;
+ GetParent()->GetClientRect(&r);
+
+ int w = m_nFirstColWidth, h = 17, y = 2;
+
+ for(size_t i = 0; i < m_label.GetCount(); i++)
+ {
+ CDC* pDC = m_label[i]->GetDC();
+ CString str;
+ m_label[i]->GetWindowText(str);
+ w = max(w, pDC->GetTextExtent(str).cx);
+ m_label[i]->ReleaseDC(pDC);
+ }
+
+ for(size_t i = 0; i < m_label.GetCount(); i++, y += h)
+ {
+ m_label[i]->MoveWindow(1, y, w - 10, h);
+ m_info[i]->MoveWindow(w + 10, y, r.Width()-(w+10)-1, h);
+ }
+}
+
+BEGIN_MESSAGE_MAP(CPlayerInfoBar, CDialogBar)
+ ON_WM_ERASEBKGND()
+ ON_WM_SIZE()
+ ON_WM_LBUTTONDOWN()
+END_MESSAGE_MAP()
+
+
+
+// CPlayerInfoBar message handlers
+
+BOOL CPlayerInfoBar::OnEraseBkgnd(CDC* pDC)
+{
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
+ {
+ CRect r;
+ pChild->GetClientRect(&r);
+ pChild->MapWindowPoints(this, &r);
+ pDC->ExcludeClipRect(&r);
+ }
+
+ CRect r;
+ GetClientRect(&r);
+
+ CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
+
+ if(pFrame->m_pLastBar != this || pFrame->m_fFullScreen)
+ r.InflateRect(0, 0, 0, 1);
+
+ if(pFrame->m_fFullScreen)
+ r.InflateRect(1, 0, 1, 0);
+
+ pDC->Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
+
+ r.DeflateRect(1, 1);
+
+ pDC->FillSolidRect(&r, 0);
+
+ return TRUE;
+}
+
+void CPlayerInfoBar::OnSize(UINT nType, int cx, int cy)
+{
+ CDialogBar::OnSize(nType, cx, cy);
+
+ Relayout();
+
+ Invalidate();
+}
+
+void CPlayerInfoBar::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
+ if(!pFrame->m_fFullScreen)
+ {
+ MapWindowPoints(pFrame, &point, 1);
+ pFrame->PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
+ }
+}
diff --git a/src/apps/mplayerc/PlayerInfoBar.h b/src/apps/mplayerc/PlayerInfoBar.h
new file mode 100644
index 000000000..2ead2e831
--- /dev/null
+++ b/src/apps/mplayerc/PlayerInfoBar.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+#include "StatusLabel.h"
+
+// CPlayerInfoBar
+
+class CPlayerInfoBar : public CDialogBar
+{
+ DECLARE_DYNAMIC(CPlayerInfoBar)
+
+private:
+ CAutoPtrArray<CStatusLabel> m_label;
+ CAutoPtrArray<CStatusLabel> m_info;
+
+ int m_nFirstColWidth;
+
+ void Relayout();
+
+public:
+ CPlayerInfoBar(int nFirstColWidth = 100);
+ virtual ~CPlayerInfoBar();
+
+ BOOL Create(CWnd* pParentWnd);
+
+ void SetLine(CString label, CString info);
+ void GetLine(CString label, CString& info);
+ void RemoveLine(CString label);
+ void RemoveAllLines();
+
+protected:
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
+
+public:
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+};
diff --git a/src/apps/mplayerc/PlayerListCtrl.cpp b/src/apps/mplayerc/PlayerListCtrl.cpp
new file mode 100644
index 000000000..a2b7cd287
--- /dev/null
+++ b/src/apps/mplayerc/PlayerListCtrl.cpp
@@ -0,0 +1,871 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PlayerListCtrl.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PlayerListCtrl.h"
+#include ".\playerlistctrl.h"
+
+// CInPlaceEdit
+
+CInPlaceEdit::CInPlaceEdit(int iItem, int iSubItem, CString sInitText)
+ : m_sInitText( sInitText )
+{
+ m_iItem = iItem;
+ m_iSubItem = iSubItem;
+ m_bESC = FALSE;
+}
+
+CInPlaceEdit::~CInPlaceEdit()
+{
+}
+
+BEGIN_MESSAGE_MAP(CInPlaceEdit, CEdit)
+ //{{AFX_MSG_MAP(CInPlaceEdit)
+ ON_WM_KILLFOCUS()
+ ON_WM_NCDESTROY()
+ ON_WM_CHAR()
+ ON_WM_CREATE()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceEdit message handlers
+
+BOOL CInPlaceEdit::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN)
+ {
+ if(pMsg->wParam == VK_RETURN
+ || pMsg->wParam == VK_DELETE
+ || pMsg->wParam == VK_ESCAPE
+ || GetKeyState(VK_CONTROL))
+ {
+ ::TranslateMessage(pMsg);
+ ::DispatchMessage(pMsg);
+ return TRUE; // DO NOT process further
+ }
+ }
+
+ return CEdit::PreTranslateMessage(pMsg);
+}
+
+void CInPlaceEdit::OnKillFocus(CWnd* pNewWnd)
+{
+ CEdit::OnKillFocus(pNewWnd);
+
+ CString str;
+ GetWindowText(str);
+
+ LV_DISPINFO dispinfo;
+ dispinfo.hdr.hwndFrom = GetParent()->m_hWnd;
+ dispinfo.hdr.idFrom = GetDlgCtrlID();
+ dispinfo.hdr.code = LVN_ENDLABELEDIT;
+ dispinfo.item.mask = LVIF_TEXT;
+ dispinfo.item.iItem = m_iItem;
+ dispinfo.item.iSubItem = m_iSubItem;
+ dispinfo.item.pszText = m_bESC ? NULL : LPTSTR((LPCTSTR)str);
+ dispinfo.item.cchTextMax = str.GetLength();
+ GetParent()->GetParent()->SendMessage(WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM)&dispinfo);
+
+ DestroyWindow();
+}
+
+void CInPlaceEdit::OnNcDestroy()
+{
+ CEdit::OnNcDestroy();
+
+ delete this;
+}
+
+
+void CInPlaceEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ if(nChar == VK_ESCAPE || nChar == VK_RETURN)
+ {
+ if(nChar == VK_ESCAPE) m_bESC = TRUE;
+ GetParent()->SetFocus();
+ return;
+ }
+
+ CEdit::OnChar(nChar, nRepCnt, nFlags);
+}
+
+int CInPlaceEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if(CEdit::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ // Set the proper font
+ CFont* font = GetParent()->GetFont();
+ SetFont(font);
+
+ SetWindowText(m_sInitText);
+ SetFocus();
+ SetSel(0, -1);
+ return 0;
+}
+
+// CInPlaceComboBox
+
+CInPlaceComboBox::CInPlaceComboBox(int iItem, int iSubItem, CAtlList<CString>& lstItems, int nSel)
+{
+ m_iItem = iItem;
+ m_iSubItem = iSubItem;
+
+ m_lstItems.AddTailList(&lstItems);
+ m_nSel = nSel;
+ m_bESC = FALSE;
+}
+
+CInPlaceComboBox::~CInPlaceComboBox()
+{
+}
+
+BEGIN_MESSAGE_MAP(CInPlaceComboBox, CComboBox)
+ //{{AFX_MSG_MAP(CInPlaceComboBox)
+ ON_WM_CREATE()
+ ON_WM_KILLFOCUS()
+ ON_WM_CHAR()
+ ON_WM_NCDESTROY()
+ ON_CONTROL_REFLECT(CBN_CLOSEUP, OnCloseup)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceComboBox message handlers
+
+int CInPlaceComboBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if (CComboBox::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ // Set the proper font
+ CFont* font = GetParent()->GetFont();
+ SetFont(font);
+
+ for(POSITION pos = m_lstItems.GetHeadPosition(); pos != NULL;)
+ AddString((LPCTSTR)(m_lstItems.GetNext(pos)));
+
+ SetFocus();
+ SetCurSel(m_nSel);
+ return 0;
+}
+
+BOOL CInPlaceComboBox::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN)
+ {
+ if(pMsg->wParam == VK_RETURN
+ || pMsg->wParam == VK_ESCAPE)
+ {
+ ::TranslateMessage(pMsg);
+ ::DispatchMessage(pMsg);
+ return TRUE; // DO NOT process further
+ }
+ }
+
+ return CComboBox::PreTranslateMessage(pMsg);
+}
+
+void CInPlaceComboBox::OnKillFocus(CWnd* pNewWnd)
+{
+ CComboBox::OnKillFocus(pNewWnd);
+
+ CString str;
+ GetWindowText(str);
+
+ LV_DISPINFO dispinfo;
+ dispinfo.hdr.hwndFrom = GetParent()->m_hWnd;
+ dispinfo.hdr.idFrom = GetDlgCtrlID();
+ dispinfo.hdr.code = LVN_ENDLABELEDIT;
+ dispinfo.item.mask = LVIF_TEXT|LVIF_PARAM;
+ dispinfo.item.iItem = m_iItem;
+ dispinfo.item.iSubItem = m_iSubItem;
+ dispinfo.item.pszText = m_bESC ? NULL : LPTSTR((LPCTSTR)str);
+ dispinfo.item.cchTextMax = str.GetLength();
+ dispinfo.item.lParam = GetCurSel();
+ GetParent()->GetParent()->SendMessage(WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM)&dispinfo);
+
+ PostMessage(WM_CLOSE);
+}
+
+void CInPlaceComboBox::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ if(nChar == VK_ESCAPE || nChar == VK_RETURN)
+ {
+ if(nChar == VK_ESCAPE) m_bESC = TRUE;
+ GetParent()->SetFocus();
+ return;
+ }
+
+ CComboBox::OnChar(nChar, nRepCnt, nFlags);
+}
+
+void CInPlaceComboBox::OnNcDestroy()
+{
+ CComboBox::OnNcDestroy();
+
+ delete this;
+}
+
+void CInPlaceComboBox::OnCloseup()
+{
+ GetParent()->SetFocus();
+}
+
+// CInPlaceListBox
+
+CInPlaceListBox::CInPlaceListBox(int iItem, int iSubItem, CAtlList<CString>& lstItems, int nSel)
+{
+ m_iItem = iItem;
+ m_iSubItem = iSubItem;
+
+ m_lstItems.AddTailList(&lstItems);
+ m_nSel = nSel;
+ m_bESC = FALSE;
+}
+
+CInPlaceListBox::~CInPlaceListBox()
+{
+}
+
+BEGIN_MESSAGE_MAP(CInPlaceListBox, CListBox)
+ //{{AFX_MSG_MAP(CInPlaceListBox)
+ ON_WM_CREATE()
+ ON_WM_KILLFOCUS()
+ ON_WM_CHAR()
+ ON_WM_NCDESTROY()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CInPlaceListBox message handlers
+
+int CInPlaceListBox::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if(CListBox::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ // Set the proper font
+ CFont* font = GetParent()->GetFont();
+ SetFont(font);
+
+ for(POSITION pos = m_lstItems.GetHeadPosition(); pos != NULL;)
+ {
+ AddString( (LPCTSTR) (m_lstItems.GetNext( pos )) );
+ }
+ SetCurSel( m_nSel );
+ SetFocus();
+ return 0;
+}
+
+BOOL CInPlaceListBox::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN)
+ {
+ if(pMsg->wParam == VK_RETURN
+ || pMsg->wParam == VK_ESCAPE)
+ {
+ ::TranslateMessage(pMsg);
+ ::DispatchMessage(pMsg);
+ return TRUE; // DO NOT process further
+ }
+ }
+
+ return CListBox::PreTranslateMessage(pMsg);
+}
+
+void CInPlaceListBox::OnKillFocus(CWnd* pNewWnd)
+{
+ CListBox::OnKillFocus(pNewWnd);
+
+ CString str;
+ GetWindowText(str);
+
+ LV_DISPINFO dispinfo;
+ dispinfo.hdr.hwndFrom = GetParent()->m_hWnd;
+ dispinfo.hdr.idFrom = GetDlgCtrlID();
+ dispinfo.hdr.code = LVN_ENDLABELEDIT;
+ dispinfo.item.mask = LVIF_TEXT|LVIF_PARAM;
+ dispinfo.item.iItem = m_iItem;
+ dispinfo.item.iSubItem = m_iSubItem;
+ dispinfo.item.pszText = m_bESC ? NULL : LPTSTR((LPCTSTR)str);
+ dispinfo.item.cchTextMax = str.GetLength();
+ dispinfo.item.lParam = GetCurSel();
+ GetParent()->GetParent()->SendMessage(WM_NOTIFY, GetParent()->GetDlgCtrlID(), (LPARAM)&dispinfo);
+
+ PostMessage(WM_CLOSE);
+}
+
+void CInPlaceListBox::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
+{
+ if(nChar == VK_ESCAPE || nChar == VK_RETURN)
+ {
+ if(nChar == VK_ESCAPE) m_bESC = TRUE;
+ GetParent()->SetFocus();
+ return;
+ }
+
+ CListBox::OnChar(nChar, nRepCnt, nFlags);
+}
+
+void CInPlaceListBox::OnNcDestroy()
+{
+ CListBox::OnNcDestroy();
+
+ delete this;
+}
+
+
+
+// CPlayerListCtrl
+
+IMPLEMENT_DYNAMIC(CPlayerListCtrl, CListCtrl)
+CPlayerListCtrl::CPlayerListCtrl(int tStartEditingDelay)
+ : m_tStartEditingDelay(tStartEditingDelay)
+ , m_nItemClicked(-1)
+{
+}
+
+CPlayerListCtrl::~CPlayerListCtrl()
+{
+}
+
+void CPlayerListCtrl::PreSubclassWindow()
+{
+ EnableToolTips(TRUE);
+
+ CListCtrl::PreSubclassWindow();
+}
+
+int CPlayerListCtrl::HitTestEx(CPoint& point, int* col) const
+{
+ if(col) *col = 0;
+
+ int row = HitTest(CPoint(0, point.y), NULL);
+
+ if((GetWindowLong(m_hWnd, GWL_STYLE) & LVS_TYPEMASK) != LVS_REPORT)
+ return row;
+
+ int nColumnCount = ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount();
+
+ for(int top = GetTopIndex(), bottom = GetBottomIndex(); top <= bottom; top++)
+ {
+ CRect r;
+ GetItemRect(top, &r, LVIR_BOUNDS);
+
+ if(r.top <= point.y && point.y < r.bottom)
+ {
+ for(int colnum = 0; colnum < nColumnCount; colnum++)
+ {
+ int colwidth = GetColumnWidth(colnum);
+
+ if(point.x >= r.left && point.x <= (r.left + colwidth))
+ {
+ if(col) *col = colnum;
+ return top;
+ }
+
+ r.left += colwidth;
+ }
+ }
+ }
+
+ return -1;
+}
+
+int CPlayerListCtrl::GetBottomIndex() const
+{
+ CRect r;
+ GetClientRect(r);
+
+ int nBottomIndex = GetTopIndex() + GetCountPerPage() - 1;
+
+ if(nBottomIndex >= GetItemCount())
+ {
+ nBottomIndex = GetItemCount() - 1;
+ }
+ else if(nBottomIndex < GetItemCount())
+ {
+ CRect br;
+ GetItemRect(nBottomIndex, br, LVIR_BOUNDS);
+
+ if(br.bottom < r.bottom)
+ nBottomIndex++;
+ }
+
+ return(nBottomIndex);
+}
+
+CImageList* CPlayerListCtrl::CreateDragImageEx(LPPOINT lpPoint)
+{
+ if(GetSelectedCount() <= 0)
+ return NULL;
+
+ CRect cSingleRect, cCompleteRect(0, 0, 0, 0);
+ GetClientRect(cSingleRect);
+ int nWidth = cSingleRect.Width();
+
+ // Start and Stop index in view area
+ int nIndex = GetTopIndex() - 1;
+ int nBottomIndex = GetBottomIndex();
+
+ // Determine the size of the drag image (limite for
+ // rows visibled and Client width)
+ while((nIndex = GetNextItem(nIndex, LVNI_SELECTED)) != -1 && nIndex <= nBottomIndex)
+ {
+ GetItemRect(nIndex, cSingleRect, LVIR_BOUNDS);
+/*
+ CRect r;
+ GetItemRect(nIndex, r, LVIR_LABEL);
+ cSingleRect.left = r.left;
+*/
+ if(cSingleRect.left < 0) cSingleRect.left = 0;
+ if(cSingleRect.right > nWidth) cSingleRect.right = nWidth;
+
+ cCompleteRect |= cSingleRect;
+ }
+
+ //
+ // Create bitmap in memory DC
+ //
+ CClientDC cDc(this);
+ CDC cMemDC;
+ CBitmap cBitmap;
+
+ if(!cMemDC.CreateCompatibleDC(&cDc))
+ return NULL;
+
+ if(!cBitmap.CreateCompatibleBitmap(&cDc, cCompleteRect.Width(), cCompleteRect.Height()))
+ return NULL;
+
+ CBitmap* pOldMemDCBitmap = cMemDC.SelectObject(&cBitmap);
+ // Here green is used as mask color
+ cMemDC.FillSolidRect(0, 0, cCompleteRect.Width(), cCompleteRect.Height(), RGB(0, 255, 0));
+
+ // Paint each DragImage in the DC
+ nIndex = GetTopIndex() - 1;
+ while((nIndex = GetNextItem(nIndex, LVNI_SELECTED)) != -1 && nIndex <= nBottomIndex)
+ {
+ CPoint pt;
+ CImageList* pSingleImageList = CreateDragImage(nIndex, &pt);
+
+ if(pSingleImageList)
+ {
+ GetItemRect(nIndex, cSingleRect, LVIR_BOUNDS);
+
+ pSingleImageList->Draw(&cMemDC,
+ 0,
+ CPoint(cSingleRect.left - cCompleteRect.left, cSingleRect.top - cCompleteRect.top),
+ ILD_MASK);
+
+ pSingleImageList->DeleteImageList();
+ delete pSingleImageList;
+ }
+ }
+
+ cMemDC.SelectObject(pOldMemDCBitmap);
+
+ //
+ // Create the imagelist with the merged drag images
+ //
+ CImageList* pCompleteImageList = new CImageList;
+
+ pCompleteImageList->Create(cCompleteRect.Width(),
+ cCompleteRect.Height(),
+ ILC_COLOR | ILC_MASK, 0, 1);
+
+ // Here green is used as mask color
+ pCompleteImageList->Add(&cBitmap, RGB(0, 255, 0));
+
+ //
+ // as an optional service:
+ // Find the offset of the current mouse cursor to the imagelist
+ // this we can use in BeginDrag()
+ //
+ if(lpPoint)
+ {
+ lpPoint->x = cCompleteRect.left;
+ lpPoint->y = cCompleteRect.top;
+ }
+
+ return(pCompleteImageList);
+}
+
+bool CPlayerListCtrl::PrepareInPlaceControl(int nRow, int nCol, CRect& rect)
+{
+ if(!EnsureVisible(nRow, TRUE)) return(false);
+
+ int nColumnCount = ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount();
+ if(nCol >= nColumnCount || GetColumnWidth(nCol) < 5) return(false);
+
+ int offset = 0;
+ for(int i = 0; i < nCol; i++) offset += GetColumnWidth(i);
+
+ GetItemRect(nRow, &rect, LVIR_BOUNDS);
+
+ CRect rcClient;
+ GetClientRect(&rcClient);
+ if(offset + rect.left < 0 || offset + rect.left > rcClient.right)
+ {
+ CSize size(offset + rect.left, 0);
+ Scroll(size);
+ rect.left -= size.cx;
+ }
+
+ rect.left += offset;
+ rect.right = rect.left + GetColumnWidth(nCol);
+ if(rect.right > rcClient.right) rect.right = rcClient.right;
+
+ rect.DeflateRect(1, 0, 0, 1);
+
+ if(nCol == 0)
+ {
+ CRect r;
+ GetItemRect(nRow, r, LVIR_LABEL);
+ rect.left = r.left-1;
+ }
+
+ return(true);
+}
+
+CEdit* CPlayerListCtrl::ShowInPlaceEdit(int nItem, int nCol)
+{
+ CRect rect;
+ if(!PrepareInPlaceControl(nItem, nCol, rect))
+ return(NULL);
+
+ DWORD dwStyle = /*WS_BORDER|*/WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL;
+
+ LV_COLUMN lvcol;
+ lvcol.mask = LVCF_FMT;
+ GetColumn(nCol, &lvcol);
+ dwStyle |= (lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_LEFT ? ES_LEFT
+ : (lvcol.fmt&LVCFMT_JUSTIFYMASK) == LVCFMT_RIGHT ? ES_RIGHT
+ : ES_CENTER;
+
+ CEdit* pEdit = new CInPlaceEdit(nItem, nCol, GetItemText(nItem, nCol));
+ pEdit->Create(dwStyle, rect, this, IDC_EDIT1);
+
+ m_fInPlaceDirty = false;
+
+ return pEdit;
+}
+
+CComboBox* CPlayerListCtrl::ShowInPlaceComboBox(int nItem, int nCol, CAtlList<CString>& lstItems, int nSel)
+{
+ CRect rect;
+ if(!PrepareInPlaceControl(nItem, nCol, rect))
+ return(NULL);
+
+ DWORD dwStyle = /*WS_BORDER|*/WS_CHILD|WS_VISIBLE|WS_VSCROLL/*|WS_HSCROLL*/
+ |CBS_DROPDOWNLIST|CBS_DISABLENOSCROLL/*|CBS_NOINTEGRALHEIGHT*/;
+ CComboBox* pComboBox = new CInPlaceComboBox(nItem, nCol, lstItems, nSel);
+ pComboBox->Create(dwStyle, rect, this, IDC_COMBO1);
+
+ CorrectComboListWidth(*pComboBox, GetFont());
+
+ int width = GetColumnWidth(nCol);
+ if(pComboBox->GetDroppedWidth() < width)
+ pComboBox->SetDroppedWidth(width);
+
+ m_fInPlaceDirty = false;
+
+ return pComboBox;
+}
+
+CListBox* CPlayerListCtrl::ShowInPlaceListBox(int nItem, int nCol, CAtlList<CString>& lstItems, int nSel)
+{
+ CRect rect;
+ if(!PrepareInPlaceControl(nItem, nCol, rect))
+ return(NULL);
+
+ DWORD dwStyle = WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL/*|WS_HSCROLL*/|LBS_NOTIFY;
+ CListBox* pListBox = new CInPlaceListBox(nItem, nCol, lstItems, nSel);
+ pListBox->Create(dwStyle, rect, this, IDC_LIST1);
+
+ CRect ir;
+ GetItemRect(m_nItemClicked, &ir, LVIR_BOUNDS);
+
+ pListBox->SetItemHeight(-1, ir.Height());
+
+ CDC* pDC = pListBox->GetDC();
+ CFont* pWndFont = GetFont();
+ pDC->SelectObject(pWndFont);
+ int width = GetColumnWidth(nCol);
+ POSITION pos = lstItems.GetHeadPosition();
+ while(pos)
+ {
+ int w = pDC->GetTextExtent(lstItems.GetNext(pos)).cx + 16;
+ if(width < w) width = w;
+ }
+ ReleaseDC(pDC);
+
+ CRect r;
+ pListBox->GetWindowRect(r);
+ ScreenToClient(r);
+ r.top = ir.bottom;
+ r.bottom = r.top + pListBox->GetItemHeight(0) * (pListBox->GetCount() + 1);
+ r.right = r.left + width;
+ pListBox->MoveWindow(r);
+
+ m_fInPlaceDirty = false;
+
+ return pListBox;
+}
+
+BEGIN_MESSAGE_MAP(CPlayerListCtrl, CListCtrl)
+ ON_WM_VSCROLL()
+ ON_WM_HSCROLL()
+ ON_WM_MOUSEWHEEL()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_TIMER()
+ ON_WM_LBUTTONDBLCLK()
+ ON_NOTIFY_REFLECT(LVN_MARQUEEBEGIN, OnLvnMarqueeBegin)
+ ON_NOTIFY_REFLECT(LVN_INSERTITEM, OnLvnInsertitem)
+ ON_NOTIFY_REFLECT(LVN_DELETEITEM, OnLvnDeleteitem)
+ ON_EN_CHANGE(IDC_EDIT1, OnEnChangeEdit1)
+ ON_CBN_DROPDOWN(IDC_COMBO1, OnCbnDropdownCombo1)
+ ON_CBN_SELENDOK(IDC_COMBO1, OnCbnSelendokCombo1)
+ ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelChangeList1)
+ ON_NOTIFY_EX(HDN_ITEMCHANGINGA, 0, OnHdnItemchanging)
+ ON_NOTIFY_EX(HDN_ITEMCHANGINGW, 0, OnHdnItemchanging)
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
+END_MESSAGE_MAP()
+
+// CPlayerListCtrl message handlers
+
+void CPlayerListCtrl::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ if(GetFocus() != this) SetFocus();
+ CListCtrl::OnVScroll(nSBCode, nPos, pScrollBar);
+}
+
+void CPlayerListCtrl::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ if(GetFocus() != this) SetFocus();
+ CListCtrl::OnHScroll(nSBCode, nPos, pScrollBar);
+}
+
+BOOL CPlayerListCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
+{
+ if(GetFocus() != this) SetFocus();
+ return CListCtrl::OnMouseWheel(nFlags, zDelta, pt);
+}
+
+void CPlayerListCtrl::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ CListCtrl::OnLButtonDown(nFlags, point);
+
+ if(GetFocus() != this) SetFocus();
+
+ KillTimer(1);
+
+ int m_nItemClickedNow, m_nSubItemClickedNow;
+
+ if((m_nItemClickedNow = HitTestEx(point, &m_nSubItemClickedNow)) < 0)
+ {
+ m_nItemClicked = -1;
+ }
+ else if(m_nItemClicked == m_nItemClickedNow /*&& m_nSubItemClicked == m_nSubItemClickedNow*/)
+ {
+ m_nSubItemClicked = m_nSubItemClickedNow;
+
+ LV_DISPINFO dispinfo;
+ dispinfo.hdr.hwndFrom = m_hWnd;
+ dispinfo.hdr.idFrom = GetDlgCtrlID();
+ dispinfo.hdr.code = LVN_BEGINLABELEDIT;
+ dispinfo.item.mask = 0;
+ dispinfo.item.iItem = m_nItemClicked;
+ dispinfo.item.iSubItem = m_nSubItemClicked;
+ if(GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo))
+ {
+ if(m_tStartEditingDelay > 0)
+ {
+ SetTimer(1, m_tStartEditingDelay, NULL);
+ }
+ else
+ {
+ dispinfo.hdr.code = LVN_DOLABELEDIT;
+ GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo);
+ }
+ }
+ }
+ else
+ {
+ m_nItemClicked = m_nItemClickedNow;
+ m_nSubItemClicked = m_nSubItemClickedNow;
+
+ SetItemState(m_nItemClicked, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
+ }
+}
+
+void CPlayerListCtrl::OnTimer(UINT nIDEvent)
+{
+ if(nIDEvent == 1)
+ {
+ KillTimer(1);
+
+ UINT flag = LVIS_FOCUSED;
+ if((GetItemState(m_nItemClicked, flag) & flag) == flag && m_nSubItemClicked >= 0)
+ {
+ LV_DISPINFO dispinfo;
+ dispinfo.hdr.hwndFrom = m_hWnd;
+ dispinfo.hdr.idFrom = GetDlgCtrlID();
+ dispinfo.hdr.code = LVN_DOLABELEDIT;
+ dispinfo.item.mask = 0;
+ dispinfo.item.iItem = m_nItemClicked;
+ dispinfo.item.iSubItem = m_nSubItemClicked;
+ GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&dispinfo);
+ }
+ }
+
+ CListCtrl::OnTimer(nIDEvent);
+}
+
+void CPlayerListCtrl::OnLButtonDblClk(UINT nFlags, CPoint point)
+{
+ KillTimer(1);
+
+ CListCtrl::OnLButtonDblClk(nFlags, point);
+}
+
+void CPlayerListCtrl::OnLvnMarqueeBegin(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
+ *pResult = 1;
+}
+
+void CPlayerListCtrl::OnLvnInsertitem(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
+ m_nItemClicked = -1;
+ *pResult = 0;
+}
+
+void CPlayerListCtrl::OnLvnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
+ m_nItemClicked = -1;
+ *pResult = 0;
+}
+
+void CPlayerListCtrl::OnEnChangeEdit1()
+{
+ m_fInPlaceDirty = true;
+}
+
+void CPlayerListCtrl::OnCbnDropdownCombo1()
+{
+ CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO1);
+
+ CRect ir;
+ GetItemRect(m_nItemClicked, &ir, LVIR_BOUNDS);
+
+ CRect r;
+ pCombo->GetWindowRect(r);
+ ScreenToClient(r);
+ r.bottom = r.top + ir.Height() + pCombo->GetItemHeight(0)*10;
+ pCombo->MoveWindow(r);
+}
+
+void CPlayerListCtrl::OnCbnSelendokCombo1()
+{
+ m_fInPlaceDirty = true;
+}
+
+void CPlayerListCtrl::OnLbnSelChangeList1()
+{
+ m_fInPlaceDirty = true;
+ SetFocus();
+}
+
+BOOL CPlayerListCtrl::OnHdnItemchanging(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMHEADER phdr = reinterpret_cast<LPNMHEADER>(pNMHDR);
+// SetFocus();
+ *pResult = 0;
+ return FALSE;
+}
+
+int CPlayerListCtrl::OnToolHitTest(CPoint point, TOOLINFO* pTI) const
+{
+ int col;
+ int row = HitTestEx(point, &col);
+ if(row == -1)
+ return -1;
+
+ CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);
+ int nColumnCount = pHeader->GetItemCount();
+
+ CRect rect;
+ GetItemRect(row, &rect, LVIR_BOUNDS);
+
+ for(int colnum = 0; colnum < nColumnCount; colnum++)
+ {
+ int colwidth = GetColumnWidth(colnum);
+
+ if(colnum == col)
+ {
+ rect.right = rect.left + colwidth; break;
+ }
+
+ rect.left += colwidth;
+ }
+
+ pTI->hwnd = m_hWnd;
+ pTI->uId = (UINT)((row<<10)+(col&0x3ff)+1);
+ pTI->lpszText = LPSTR_TEXTCALLBACK;
+ pTI->rect = rect;
+
+ return pTI->uId;
+}
+
+BOOL CPlayerListCtrl::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
+{
+ TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
+ TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
+
+ UINT nID = pNMHDR->idFrom;
+
+ if(pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND)
+ || pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
+ {
+ // idFrom is actually the HWND of the tool
+ nID = ::GetDlgCtrlID((HWND)nID);
+ }
+
+ if(nID == 0) // Notification in NT from automatically
+ return FALSE; // created tooltip
+
+ if(pNMHDR->code == TTN_NEEDTEXTA) pTTTA->lParam = (LPARAM)m_hWnd;
+ else if(pNMHDR->code == TTN_NEEDTEXTW) pTTTW->lParam = (LPARAM)m_hWnd;
+
+ *pResult = 0;
+
+ return GetParent()->SendMessage(WM_NOTIFY, id, (LPARAM)pNMHDR);
+}
+
diff --git a/src/apps/mplayerc/PlayerListCtrl.h b/src/apps/mplayerc/PlayerListCtrl.h
new file mode 100644
index 000000000..870470061
--- /dev/null
+++ b/src/apps/mplayerc/PlayerListCtrl.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#define LVN_DOLABELEDIT (LVN_FIRST+1)
+
+class CInPlaceEdit : public CEdit
+{
+private:
+ int m_iItem;
+ int m_iSubItem;
+ CString m_sInitText;
+ BOOL m_bESC; // To indicate whether ESC key was pressed
+
+public:
+ CInPlaceEdit(int iItem, int iSubItem, CString sInitText);
+ virtual ~CInPlaceEdit();
+
+protected:
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnKillFocus(CWnd* pNewWnd);
+ afx_msg void OnNcDestroy();
+ afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+};
+
+class CInPlaceComboBox : public CComboBox
+{
+private:
+ int m_iItem;
+ int m_iSubItem;
+ CAtlList<CString> m_lstItems;
+ int m_nSel;
+ BOOL m_bESC; // To indicate whether ESC key was pressed
+
+public:
+ CInPlaceComboBox(int iItem, int iSubItem, CAtlList<CString>& plstItems, int nSel);
+ virtual ~CInPlaceComboBox();
+
+protected:
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnKillFocus(CWnd* pNewWnd);
+ afx_msg void OnNcDestroy();
+ afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnCloseup();
+};
+
+class CInPlaceListBox : public CListBox
+{
+private:
+ int m_iItem;
+ int m_iSubItem;
+ CAtlList<CString> m_lstItems;
+ int m_nSel;
+ BOOL m_bESC; // To indicate whether ESC key was pressed
+
+public:
+ CInPlaceListBox(int iItem, int iSubItem, CAtlList<CString>& plstItems, int nSel);
+ virtual ~CInPlaceListBox();
+
+protected:
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnKillFocus(CWnd* pNewWnd);
+ afx_msg void OnNcDestroy();
+ afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+};
+
+// CPlayerListCtrl
+
+class CPlayerListCtrl : public CListCtrl
+{
+ DECLARE_DYNAMIC(CPlayerListCtrl)
+
+private:
+ int m_nItemClicked, m_nSubItemClicked;
+ int m_tStartEditingDelay;
+
+ bool PrepareInPlaceControl(int nRow, int nCol, CRect& rect);
+
+public:
+ CPlayerListCtrl(int tStartEditingDelay = 500);
+ virtual ~CPlayerListCtrl();
+
+ int HitTestEx(CPoint& point, int* col) const;
+ CImageList* CreateDragImageEx(LPPOINT lpPoint);
+
+ int GetBottomIndex() const;
+
+ CEdit* ShowInPlaceEdit(int nItem, int nCol);
+ CComboBox* ShowInPlaceComboBox(int nItem, int nCol, CAtlList<CString>& lstItems, int nSel);
+ CListBox* ShowInPlaceListBox(int nItem, int nCol, CAtlList<CString>& lstItems, int nSel);
+
+ bool m_fInPlaceDirty;
+
+protected:
+ virtual void PreSubclassWindow();
+ virtual int OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
+ afx_msg void OnTimer(UINT nIDEvent);
+ afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+ afx_msg void OnLvnMarqueeBegin(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnLvnInsertitem(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnLvnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnEnChangeEdit1();
+ afx_msg void OnCbnDropdownCombo1();
+ afx_msg void OnCbnSelendokCombo1();
+ afx_msg void OnLbnSelChangeList1();
+ afx_msg BOOL OnHdnItemchanging(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
+};
diff --git a/src/apps/mplayerc/PlayerPlaylistBar.cpp b/src/apps/mplayerc/PlayerPlaylistBar.cpp
new file mode 100644
index 000000000..d116cc87a
--- /dev/null
+++ b/src/apps/mplayerc/PlayerPlaylistBar.cpp
@@ -0,0 +1,1405 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <math.h>
+#include <afxinet.h>
+#include <atlrx.h>
+#include <atlutil.h>
+#include "mplayerc.h"
+#include "mainfrm.h"
+#include "..\..\DSUtil\DSUtil.h"
+#include "SaveTextFileDialog.h"
+#include ".\playerplaylistbar.h"
+
+IMPLEMENT_DYNAMIC(CPlayerPlaylistBar, CSizingControlBarG)
+CPlayerPlaylistBar::CPlayerPlaylistBar()
+ : m_list(0)
+ , m_nTimeColWidth(0)
+{
+ m_bDragging = FALSE;
+}
+
+CPlayerPlaylistBar::~CPlayerPlaylistBar()
+{
+}
+
+BOOL CPlayerPlaylistBar::Create(CWnd* pParentWnd)
+{
+ if(!CSizingControlBarG::Create(_T("Playlist"), pParentWnd, 0))
+ return FALSE;
+
+ m_list.CreateEx(
+ WS_EX_DLGMODALFRAME|WS_EX_CLIENTEDGE,
+ WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_TABSTOP
+ |LVS_OWNERDRAWFIXED
+ |LVS_NOCOLUMNHEADER
+ |LVS_EDITLABELS
+ |LVS_REPORT|LVS_SINGLESEL|LVS_AUTOARRANGE|LVS_NOSORTHEADER, // TODO: remove LVS_SINGLESEL and implement multiple item repositioning (dragging is ready)
+ CRect(0,0,100,100), this, IDC_PLAYLIST);
+
+ m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER);
+
+ m_list.InsertColumn(COL_NAME, _T("Name"), LVCFMT_LEFT, 380);
+
+ CDC* pDC = m_list.GetDC();
+ CFont* old = pDC->SelectObject(GetFont());
+ m_nTimeColWidth = pDC->GetTextExtent(_T("000:00:00")).cx + 5;
+ pDC->SelectObject(old);
+ m_list.ReleaseDC(pDC);
+ m_list.InsertColumn(COL_TIME, _T("Time"), LVCFMT_RIGHT, m_nTimeColWidth);
+
+ m_fakeImageList.Create(1, 16, ILC_COLOR4, 10, 10);
+ m_list.SetImageList(&m_fakeImageList, LVSIL_SMALL);
+
+ return TRUE;
+}
+
+BOOL CPlayerPlaylistBar::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!CSizingControlBarG::PreCreateWindow(cs))
+ return FALSE;
+
+ cs.dwExStyle |= WS_EX_ACCEPTFILES;
+
+ return TRUE;
+}
+
+BOOL CPlayerPlaylistBar::PreTranslateMessage(MSG* pMsg)
+{
+ if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
+ {
+ if(IsDialogMessage(pMsg))
+ return TRUE;
+ }
+
+ return CSizingControlBarG::PreTranslateMessage(pMsg);
+}
+
+bool FindFileInList(CAtlList<CString>& sl, CString fn)
+{
+ bool fFound = false;
+ POSITION pos = sl.GetHeadPosition();
+ while(pos && !fFound) {if(!sl.GetNext(pos).CompareNoCase(fn)) fFound = true;}
+ return(fFound);
+}
+
+void CPlayerPlaylistBar::AddItem(CString fn, CAtlList<CString>* subs)
+{
+ CAtlList<CString> sl;
+ sl.AddTail(fn);
+ AddItem(sl, subs);
+}
+
+void CPlayerPlaylistBar::AddItem(CAtlList<CString>& fns, CAtlList<CString>* subs)
+{
+ CPlaylistItem pli;
+
+ POSITION pos = fns.GetHeadPosition();
+ while(pos)
+ {
+ CString fn = fns.GetNext(pos);
+ if(!fn.Trim().IsEmpty()) pli.m_fns.AddTail(fn);
+ }
+
+ if(subs)
+ {
+ POSITION pos = subs->GetHeadPosition();
+ while(pos)
+ {
+ CString fn = subs->GetNext(pos);
+ if(!fn.Trim().IsEmpty()) pli.m_subs.AddTail(fn);
+ }
+ }
+
+ if(pli.m_fns.IsEmpty()) return;
+
+ CString fn = pli.m_fns.GetHead();
+
+ if(AfxGetAppSettings().fAutoloadAudio && fn.Find(_T("://")) < 0)
+ {
+ int i = fn.ReverseFind('.');
+ if(i > 0)
+ {
+ CMediaFormats& mf = AfxGetAppSettings().Formats;
+
+ CString ext = fn.Mid(i+1).MakeLower();
+
+ if(!mf.FindExt(ext, true))
+ {
+ CString path = fn;
+ path.Replace('/', '\\');
+ path = path.Left(path.ReverseFind('\\')+1);
+
+ WIN32_FIND_DATA fd = {0};
+ HANDLE hFind = FindFirstFile(fn.Left(i) + _T("*.*"), &fd);
+ if(hFind != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
+
+ CString fullpath = path + fd.cFileName;
+ CString ext2 = fullpath.Mid(fullpath.ReverseFind('.')+1).MakeLower();
+ if(!FindFileInList(pli.m_fns, fullpath) && ext != ext2
+ && mf.FindExt(ext2, true) && mf.IsUsingEngine(fullpath, DirectShow))
+ {
+ pli.m_fns.AddTail(fullpath);
+ }
+ }
+ while(FindNextFile(hFind, &fd));
+
+ FindClose(hFind);
+ }
+ }
+ }
+ }
+
+ if(AfxGetAppSettings().fAutoloadSubtitles)
+ {
+ CAtlArray<CString> paths;
+ paths.Add(_T("."));
+ paths.Add(_T(".\\subtitles"));
+ paths.Add(_T("c:\\subtitles"));
+
+ CAtlArray<SubFile> ret;
+ GetSubFileNames(fn, paths, ret);
+
+ for(int i = 0; i < ret.GetCount(); i++)
+ {
+ if(!FindFileInList(pli.m_subs, ret[i].fn))
+ pli.m_subs.AddTail(ret[i].fn);
+ }
+ }
+
+ m_pl.AddTail(pli);
+}
+
+static bool SearchFiles(CString mask, CAtlList<CString>& sl)
+{
+ if(mask.Find(_T("://")) >= 0)
+ return(false);
+
+ mask.Trim();
+ sl.RemoveAll();
+
+ CMediaFormats& mf = AfxGetAppSettings().Formats;
+
+ bool fFilterKnownExts;
+ WIN32_FILE_ATTRIBUTE_DATA fad;
+ mask = (fFilterKnownExts = (GetFileAttributesEx(mask, GetFileExInfoStandard, &fad)
+ && (fad.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)))
+ ? CString(mask).TrimRight(_T("\\/")) + _T("\\*.*")
+ : mask;
+
+ {
+ CString dir = mask.Left(max(mask.ReverseFind('\\'), mask.ReverseFind('/'))+1);
+
+ WIN32_FIND_DATA fd;
+ HANDLE h = FindFirstFile(mask, &fd);
+ if(h != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) continue;
+
+ CString fn = fd.cFileName;
+ CString ext = fn.Mid(fn.ReverseFind('.')+1).MakeLower();
+ CString path = dir + fd.cFileName;
+
+ if(!fFilterKnownExts || mf.FindExt(ext))
+ sl.AddTail(path);
+ }
+ while(FindNextFile(h, &fd));
+
+ FindClose(h);
+
+ if(sl.GetCount() == 0 && mask.Find(_T(":\\")) == 1)
+ {
+ GetCDROMType(mask[0], sl);
+ }
+ }
+ }
+
+ return(sl.GetCount() > 1
+ || sl.GetCount() == 1 && sl.GetHead().CompareNoCase(mask)
+ || sl.GetCount() == 0 && mask.FindOneOf(_T("?*")) >= 0);
+}
+
+void CPlayerPlaylistBar::ParsePlayList(CString fn, CAtlList<CString>* subs)
+{
+ CAtlList<CString> sl;
+ sl.AddTail(fn);
+ ParsePlayList(sl, subs);
+}
+
+void CPlayerPlaylistBar::ParsePlayList(CAtlList<CString>& fns, CAtlList<CString>* subs)
+{
+ if(fns.IsEmpty()) return;
+
+ // resolve .lnk files
+
+ CComPtr<IShellLink> pSL;
+ pSL.CoCreateInstance(CLSID_ShellLink);
+ CComQIPtr<IPersistFile> pPF = pSL;
+
+ POSITION pos = fns.GetHeadPosition();
+ while(pSL && pPF && pos)
+ {
+ CString& fn = fns.GetNext(pos);
+ TCHAR buff[MAX_PATH];
+ if(CPath(fn).GetExtension().MakeLower() != _T(".lnk")
+ || FAILED(pPF->Load(CStringW(fn), STGM_READ))
+ || FAILED(pSL->Resolve(NULL, SLR_ANY_MATCH|SLR_NO_UI))
+ || FAILED(pSL->GetPath(buff, countof(buff), NULL, 0)))
+ continue;
+
+ fn = buff;
+ }
+
+ //
+
+ CAtlList<CString> sl;
+ if(SearchFiles(fns.GetHead(), sl))
+ {
+ if(sl.GetCount() > 1) subs = NULL;
+ POSITION pos = sl.GetHeadPosition();
+ while(pos) ParsePlayList(sl.GetNext(pos), subs);
+ return;
+ }
+
+ CAtlList<CString> redir;
+ CStringA ct = GetContentType(fns.GetHead(), &redir);
+ if(!redir.IsEmpty())
+ {
+ POSITION pos = redir.GetHeadPosition();
+ while(pos) ParsePlayList(sl.GetNext(pos), subs);
+ return;
+ }
+
+ if(ct == "application/x-mpc-playlist")
+ {
+ ParseMPCPlayList(fns.GetHead());
+ return;
+ }
+
+ AddItem(fns, subs);
+}
+
+static int s_int_comp(const void* i1, const void* i2)
+{
+ return (int)i1 - (int)i2;
+}
+
+static CString CombinePath(CPath p, CString fn)
+{
+ if(fn.Find(':') >= 0 || fn.Find(_T("\\")) == 0) return fn;
+ p.Append(CPath(fn));
+ return (LPCTSTR)p;
+}
+
+bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn)
+{
+ CString str;
+ CAtlMap<int, CPlaylistItem> pli;
+ CAtlArray<int> idx;
+
+ CWebTextFile f(CTextFile::ANSI);
+ if(!f.Open(fn) || !f.ReadString(str) || str != _T("MPCPLAYLIST"))
+ return false;
+
+ CPath base(fn);
+ base.RemoveFileSpec();
+
+ while(f.ReadString(str))
+ {
+ CAtlList<CString> sl;
+ Explode(str, sl, ',', 3);
+ if(sl.GetCount() != 3) continue;
+
+ if(int i = _ttoi(sl.RemoveHead()))
+ {
+ CString key = sl.RemoveHead();
+ CString value = sl.RemoveHead();
+
+ if(key == _T("type")) {pli[i].m_type = (CPlaylistItem::type_t)_ttol(value); idx.Add(i);}
+ else if(key == _T("label")) pli[i].m_label = value;
+ else if(key == _T("filename")) {value = CombinePath(base, value); pli[i].m_fns.AddTail(value);}
+ else if(key == _T("subtitle")) {value = CombinePath(base, value); pli[i].m_subs.AddTail(value);}
+ else if(key == _T("video")) {while(pli[i].m_fns.GetCount() < 2) pli[i].m_fns.AddTail(_T("")); pli[i].m_fns.GetHead() = value;}
+ else if(key == _T("audio")) {while(pli[i].m_fns.GetCount() < 2) pli[i].m_fns.AddTail(_T("")); pli[i].m_fns.GetTail() = value;}
+ else if(key == _T("vinput")) pli[i].m_vinput = _ttol(value);
+ else if(key == _T("vchannel")) pli[i].m_vchannel = _ttol(value);
+ else if(key == _T("ainput")) pli[i].m_ainput = _ttol(value);
+ else if(key == _T("country")) pli[i].m_country = _ttol(value);
+ }
+ }
+
+ qsort(idx.GetData(), idx.GetCount(), sizeof(int), s_int_comp);
+ for(int i = 0; i < idx.GetCount(); i++)
+ m_pl.AddTail(pli[idx[i]]);
+
+ return pli.GetCount() > 0;
+}
+
+bool CPlayerPlaylistBar::SaveMPCPlayList(CString fn, CTextFile::enc e, bool fRemovePath)
+{
+ CTextFile f;
+ if(!f.Save(fn, e))
+ return false;
+
+ f.WriteString(_T("MPCPLAYLIST\n"));
+
+ POSITION pos = m_pl.GetHeadPosition(), pos2;
+ for(int i = 1; pos; i++)
+ {
+ CPlaylistItem& pli = m_pl.GetNext(pos);
+
+ CString idx;
+ idx.Format(_T("%d"), i);
+
+ CString str;
+ str.Format(_T("%d,type,%d"), i, pli.m_type);
+ f.WriteString(str + _T("\n"));
+
+ if(!pli.m_label.IsEmpty())
+ f.WriteString(idx + _T(",label,") + pli.m_label + _T("\n"));
+
+ if(pli.m_type == CPlaylistItem::file)
+ {
+ pos2 = pli.m_fns.GetHeadPosition();
+ while(pos2)
+ {
+ CString fn = pli.m_fns.GetNext(pos2);
+ if(fRemovePath) {CPath p(fn); p.StripPath(); fn = (LPCTSTR)p;}
+ f.WriteString(idx + _T(",filename,") + fn + _T("\n"));
+ }
+
+ pos2 = pli.m_subs.GetHeadPosition();
+ while(pos2)
+ {
+ CString fn = pli.m_subs.GetNext(pos2);
+ if(fRemovePath) {CPath p(fn); p.StripPath(); fn = (LPCTSTR)p;}
+ f.WriteString(idx + _T(",subtitle,") + fn + _T("\n"));
+ }
+ }
+ else if(pli.m_type == CPlaylistItem::device && pli.m_fns.GetCount() == 2)
+ {
+ f.WriteString(idx + _T(",video,") + pli.m_fns.GetHead() + _T("\n"));
+ f.WriteString(idx + _T(",audio,") + pli.m_fns.GetTail() + _T("\n"));
+ str.Format(_T("%d,vinput,%d"), i, pli.m_vinput);
+ f.WriteString(str + _T("\n"));
+ str.Format(_T("%d,vchannel,%d"), i, pli.m_vchannel);
+ f.WriteString(str + _T("\n"));
+ str.Format(_T("%d,ainput,%d"), i, pli.m_ainput);
+ f.WriteString(str + _T("\n"));
+ str.Format(_T("%d,country,%d"), i, pli.m_country);
+ f.WriteString(str + _T("\n"));
+ }
+ }
+
+ return true;
+}
+
+void CPlayerPlaylistBar::Refresh()
+{
+ SetupList();
+ ResizeListColumn();
+}
+
+void CPlayerPlaylistBar::Empty()
+{
+ m_pl.RemoveAll();
+ m_list.DeleteAllItems();
+ SavePlaylist();
+}
+
+void CPlayerPlaylistBar::Open(CAtlList<CString>& fns, bool fMulti, CAtlList<CString>* subs)
+{
+ Empty();
+ Append(fns, fMulti, subs);
+}
+
+void CPlayerPlaylistBar::Append(CAtlList<CString>& fns, bool fMulti, CAtlList<CString>* subs)
+{
+ if(fMulti)
+ {
+ ASSERT(subs == NULL || subs->GetCount() == 0);
+ POSITION pos = fns.GetHeadPosition();
+ while(pos) ParsePlayList(fns.GetNext(pos), NULL);
+ }
+ else
+ {
+ ParsePlayList(fns, subs);
+ }
+
+ Refresh();
+ SavePlaylist();
+}
+
+void CPlayerPlaylistBar::Open(CStringW vdn, CStringW adn, int vinput, int vchannel, int ainput)
+{
+ Empty();
+ Append(vdn, adn, vinput, vchannel, ainput);
+}
+
+void CPlayerPlaylistBar::Append(CStringW vdn, CStringW adn, int vinput, int vchannel, int ainput)
+{
+ CPlaylistItem pli;
+ pli.m_type = CPlaylistItem::device;
+ pli.m_fns.AddTail(CString(vdn));
+ pli.m_fns.AddTail(CString(adn));
+ pli.m_vinput = vinput;
+ pli.m_vchannel = vchannel;
+ pli.m_ainput = ainput;
+ CAtlList<CStringW> sl;
+ CStringW vfn = GetFriendlyName(vdn);
+ CStringW afn = GetFriendlyName(adn);
+ if(!vfn.IsEmpty()) sl.AddTail(vfn);
+ if(!afn.IsEmpty()) sl.AddTail(afn);
+ CStringW label = Implode(sl, '|');
+ label.Replace(L"|", L" - ");
+ pli.m_label = CString(label);
+ m_pl.AddTail(pli);
+
+ Refresh();
+ SavePlaylist();
+}
+
+void CPlayerPlaylistBar::SetupList()
+{
+ m_list.DeleteAllItems();
+
+ POSITION pos = m_pl.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ CPlaylistItem& pli = m_pl.GetAt(pos);
+ m_list.SetItemData(m_list.InsertItem(i, pli.GetLabel()), (DWORD_PTR)pos);
+ m_list.SetItemText(i, COL_TIME, pli.GetLabel(1));
+ m_pl.GetNext(pos);
+ }
+}
+
+void CPlayerPlaylistBar::UpdateList()
+{
+ POSITION pos = m_pl.GetHeadPosition();
+ for(int i = 0, j = m_list.GetItemCount(); pos && i < j; i++)
+ {
+ CPlaylistItem& pli = m_pl.GetAt(pos);
+ m_list.SetItemData(i, (DWORD_PTR)pos);
+ m_list.SetItemText(i, COL_NAME, pli.GetLabel(0));
+ m_list.SetItemText(i, COL_TIME, pli.GetLabel(1));
+ m_pl.GetNext(pos);
+ }
+}
+
+void CPlayerPlaylistBar::EnsureVisible(POSITION pos)
+{
+ int i = FindItem(m_pl.GetPos());
+ if(i < 0) return;
+ m_list.EnsureVisible(i, TRUE);
+ m_list.Invalidate();
+}
+
+int CPlayerPlaylistBar::FindItem(POSITION pos)
+{
+ for(int i = 0; i < m_list.GetItemCount(); i++)
+ if((POSITION)m_list.GetItemData(i) == pos)
+ return(i);
+ return(-1);
+}
+
+POSITION CPlayerPlaylistBar::FindPos(int i)
+{
+ if(i < 0) return(NULL);
+ return((POSITION)m_list.GetItemData(i));
+}
+
+int CPlayerPlaylistBar::GetCount()
+{
+ return(m_pl.GetCount()); // TODO: n - .fInvalid
+}
+
+int CPlayerPlaylistBar::GetSelIdx()
+{
+ return(FindItem(m_pl.GetPos()));
+}
+
+void CPlayerPlaylistBar::SetSelIdx(int i)
+{
+ m_pl.SetPos(FindPos(i));
+}
+
+bool CPlayerPlaylistBar::IsAtEnd()
+{
+ return(m_pl.GetPos() && m_pl.GetPos() == m_pl.GetTailPosition());
+}
+
+bool CPlayerPlaylistBar::GetCur(CPlaylistItem& pli)
+{
+ if(!m_pl.GetPos()) return(false);
+ pli = m_pl.GetAt(m_pl.GetPos());
+ return(true);
+}
+
+CString CPlayerPlaylistBar::GetCur()
+{
+ CString fn;
+ CPlaylistItem pli;
+ if(GetCur(pli) && !pli.m_fns.IsEmpty()) fn = pli.m_fns.GetHead();
+ return(fn);
+}
+
+void CPlayerPlaylistBar::SetNext()
+{
+ POSITION pos = m_pl.GetPos(), org = pos;
+ while(m_pl.GetNextWrap(pos).m_fInvalid && pos != org);
+UpdateList();
+ m_pl.SetPos(pos);
+ EnsureVisible(pos);
+}
+
+void CPlayerPlaylistBar::SetPrev()
+{
+ POSITION pos = m_pl.GetPos(), org = pos;
+ while(m_pl.GetPrevWrap(pos).m_fInvalid && pos != org);
+ m_pl.SetPos(pos);
+ EnsureVisible(pos);
+}
+
+void CPlayerPlaylistBar::SetFirst()
+{
+ POSITION pos = m_pl.GetTailPosition(), org = pos;
+ while(m_pl.GetNextWrap(pos).m_fInvalid && pos != org);
+UpdateList();
+ m_pl.SetPos(pos);
+ EnsureVisible(pos);
+}
+
+void CPlayerPlaylistBar::SetLast()
+{
+ POSITION pos = m_pl.GetHeadPosition(), org = pos;
+ while(m_pl.GetPrevWrap(pos).m_fInvalid && pos != org);
+ m_pl.SetPos(pos);
+ EnsureVisible(pos);
+}
+
+void CPlayerPlaylistBar::SetCurValid(bool fValid)
+{
+ if(POSITION pos = m_pl.GetPos())
+ {
+ if(m_pl.GetAt(pos).m_fInvalid = !fValid)
+ {
+ int i = FindItem(pos);
+ m_list.RedrawItems(i, i);
+ }
+ }
+}
+
+void CPlayerPlaylistBar::SetCurTime(REFERENCE_TIME rt)
+{
+ if(POSITION pos = m_pl.GetPos())
+ {
+ CPlaylistItem& pli = m_pl.GetAt(pos);
+ pli.m_duration = rt;
+ m_list.SetItemText(FindItem(pos), COL_TIME, pli.GetLabel(1));
+ }
+}
+
+OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart)
+{
+ CPlaylistItem pli;
+ if(!GetCur(pli)) return NULL;
+
+ CString fn = CString(pli.m_fns.GetHead()).MakeLower();
+
+ if(fn.Find(_T("video_ts.ifo")) >= 0
+ || fn.Find(_T(".ratdvd")) >= 0)
+ {
+ if(OpenDVDData* p = new OpenDVDData())
+ {
+ p->path = pli.m_fns.GetHead();
+ p->subs.AddTailList(&pli.m_subs);
+ return p;
+ }
+ }
+
+ if(pli.m_type == CPlaylistItem::device)
+ {
+ if(OpenDeviceData* p = new OpenDeviceData())
+ {
+ POSITION pos = pli.m_fns.GetHeadPosition();
+ for(int i = 0; i < countof(p->DisplayName) && pos; i++)
+ p->DisplayName[i] = pli.m_fns.GetNext(pos);
+ p->vinput = pli.m_vinput;
+ p->vchannel = pli.m_vchannel;
+ p->ainput = pli.m_ainput;
+ return p;
+ }
+ }
+ else
+ {
+ if(OpenFileData* p = new OpenFileData())
+ {
+ p->fns.AddTailList(&pli.m_fns);
+ p->subs.AddTailList(&pli.m_subs);
+ p->rtStart = rtStart;
+ return p;
+ }
+ }
+
+ return NULL;
+}
+
+void CPlayerPlaylistBar::LoadPlaylist()
+{
+ CString base;
+ if(AfxGetMyApp()->GetAppDataPath(base))
+ {
+ CPath p;
+ p.Combine(base, _T("default.mpcpl"));
+
+ if(!AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("RememberPlaylistItems"), TRUE))
+ {
+ DeleteFile(p);
+ }
+ else
+ {
+ ParseMPCPlayList(p);
+ Refresh();
+ }
+ }
+}
+
+void CPlayerPlaylistBar::SavePlaylist()
+{
+ CString base;
+ if(AfxGetMyApp()->GetAppDataPath(base))
+ {
+ CPath p;
+ p.Combine(base, _T("default.mpcpl"));
+
+ if(!AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("RememberPlaylistItems"), TRUE))
+ {
+ DeleteFile(p);
+ }
+ else
+ {
+ SaveMPCPlayList(p, CTextFile::UTF8, false);
+ }
+ }
+}
+
+BEGIN_MESSAGE_MAP(CPlayerPlaylistBar, CSizingControlBarG)
+ ON_WM_SIZE()
+ ON_NOTIFY(LVN_KEYDOWN, IDC_PLAYLIST, OnLvnKeyDown)
+ ON_NOTIFY(NM_DBLCLK, IDC_PLAYLIST, OnNMDblclkList)
+// ON_NOTIFY(NM_CUSTOMDRAW, IDC_PLAYLIST, OnCustomdrawList)
+ ON_WM_DRAWITEM()
+ ON_COMMAND_EX(ID_FILE_CLOSEPLAYLIST, OnFileClosePlaylist)
+ ON_COMMAND_EX(ID_PLAY_PLAY, OnPlayPlay)
+ ON_WM_DROPFILES()
+ ON_NOTIFY(LVN_BEGINDRAG, IDC_PLAYLIST, OnBeginDrag)
+ ON_WM_MOUSEMOVE()
+ ON_WM_LBUTTONUP()
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
+ ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
+ ON_WM_TIMER()
+ ON_WM_CONTEXTMENU()
+ ON_NOTIFY(LVN_ENDLABELEDIT, IDC_PLAYLIST, OnLvnEndlabeleditList)
+END_MESSAGE_MAP()
+
+
+// CPlayerPlaylistBar message handlers
+
+void CPlayerPlaylistBar::ResizeListColumn()
+{
+ if(::IsWindow(m_list.m_hWnd))
+ {
+ CRect r;
+ GetClientRect(r);
+ r.DeflateRect(2, 2);
+ m_list.SetRedraw(FALSE);
+ m_list.MoveWindow(r);
+ m_list.GetClientRect(r);
+ m_list.SetColumnWidth(COL_NAME, r.Width()-m_nTimeColWidth); //LVSCW_AUTOSIZE_USEHEADER
+ m_list.SetRedraw(TRUE);
+ }
+}
+
+void CPlayerPlaylistBar::OnSize(UINT nType, int cx, int cy)
+{
+ CSizingControlBarG::OnSize(nType, cx, cy);
+
+ ResizeListColumn();
+}
+
+void CPlayerPlaylistBar::OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLVKEYDOWN pLVKeyDown = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
+
+ *pResult = FALSE;
+
+ CList<int> items;
+ POSITION pos = m_list.GetFirstSelectedItemPosition();
+ while(pos) items.AddHead(m_list.GetNextSelectedItem(pos));
+
+ if(pLVKeyDown->wVKey == VK_DELETE && items.GetCount() > 0)
+ {
+ pos = items.GetHeadPosition();
+ while(pos)
+ {
+ int i = items.GetNext(pos);
+ if(m_pl.RemoveAt(FindPos(i))) ((CMainFrame*)AfxGetMainWnd())->CloseMedia();
+ m_list.DeleteItem(i);
+ }
+
+ m_list.SetItemState(-1, 0, LVIS_SELECTED);
+ m_list.SetItemState(
+ max(min(items.GetTail(), m_list.GetItemCount()-1), 0),
+ LVIS_SELECTED, LVIS_SELECTED);
+
+ ResizeListColumn();
+
+ *pResult = TRUE;
+ }
+ else if(pLVKeyDown->wVKey == VK_SPACE && items.GetCount() == 1)
+ {
+ m_pl.SetPos(FindPos(items.GetHead()));
+
+ ((CMainFrame*)AfxGetMainWnd())->OpenCurPlaylistItem();
+
+ *pResult = TRUE;
+ }
+}
+
+void CPlayerPlaylistBar::OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
+
+ if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0)
+ {
+ m_pl.SetPos(FindPos(lpnmlv->iItem));
+ m_list.Invalidate();
+ ((CMainFrame*)AfxGetMainWnd())->OpenCurPlaylistItem();
+ }
+
+ *pResult = 0;
+}
+/*
+void CPlayerPlaylistBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
+
+ *pResult = CDRF_DODEFAULT;
+
+ if(CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
+ {
+ *pResult = CDRF_NOTIFYPOSTPAINT|CDRF_NOTIFYITEMDRAW;
+ }
+ else if(CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
+ {
+ pLVCD->nmcd.uItemState &= ~CDIS_SELECTED;
+ pLVCD->nmcd.uItemState &= ~CDIS_FOCUS;
+
+ pLVCD->clrText = (pLVCD->nmcd.dwItemSpec == m_playList.m_idx) ? 0x0000ff : CLR_DEFAULT;
+ pLVCD->clrTextBk = m_list.GetItemState(pLVCD->nmcd.dwItemSpec, LVIS_SELECTED) ? 0xf1dacc : CLR_DEFAULT;
+
+ *pResult = CDRF_NOTIFYPOSTPAINT;
+ }
+ else if(CDDS_ITEMPOSTPAINT == pLVCD->nmcd.dwDrawStage)
+ {
+ int nItem = static_cast<int>(pLVCD->nmcd.dwItemSpec);
+
+ if(m_list.GetItemState(pLVCD->nmcd.dwItemSpec, LVIS_SELECTED))
+ {
+ CRect r, r2;
+ m_list.GetItemRect(nItem, &r, LVIR_BOUNDS);
+ m_list.GetItemRect(nItem, &r2, LVIR_LABEL);
+ r.left = r2.left;
+ FrameRect(pLVCD->nmcd.hdc, &r, CBrush(0xc56a31));
+ }
+
+ *pResult = CDRF_SKIPDEFAULT;
+ }
+ else if(CDDS_POSTPAINT == pLVCD->nmcd.dwDrawStage)
+ {
+ }
+}
+*/
+
+void CPlayerPlaylistBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
+{
+ if(nIDCtl != IDC_PLAYLIST) return;
+
+ int nItem = lpDrawItemStruct->itemID;
+ CRect rcItem = lpDrawItemStruct->rcItem;
+ POSITION pos = FindPos(nItem);
+ bool fSelected = pos == m_pl.GetPos();
+ CPlaylistItem& pli = m_pl.GetAt(pos);
+
+ CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
+
+ if(!!m_list.GetItemState(nItem, LVIS_SELECTED))
+ {
+ FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
+ FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
+ }
+ else
+ {
+ FillRect(pDC->m_hDC, rcItem, CBrush(GetSysColor(COLOR_WINDOW)));
+ }
+
+ COLORREF textcolor = fSelected?0xff:0;
+ if(pli.m_fInvalid) textcolor |= 0xA0A0A0;
+
+ CString time = !pli.m_fInvalid ? m_list.GetItemText(nItem, COL_TIME) : _T("Invalid");
+ CSize timesize(0, 0);
+ CPoint timept(rcItem.right, 0);
+ if(time.GetLength() > 0)
+ {
+ timesize = pDC->GetTextExtent(time);
+ if((3+timesize.cx+3) < rcItem.Width()/2)
+ {
+ timept = CPoint(rcItem.right-(3+timesize.cx+3), (rcItem.top+rcItem.bottom-timesize.cy)/2);
+
+ pDC->SetTextColor(textcolor);
+ pDC->TextOut(timept.x, timept.y, time);
+ }
+ }
+
+ CString fmt, file;
+ fmt.Format(_T("%%0%dd. %%s"), (int)log10(0.1+m_pl.GetCount())+1);
+ file.Format(fmt, nItem+1, m_list.GetItemText(nItem, COL_NAME));
+ CSize filesize = pDC->GetTextExtent(file);
+ while(3+filesize.cx+6 > timept.x && file.GetLength() > 3)
+ {
+ file = file.Left(file.GetLength()-4) + _T("...");
+ filesize = pDC->GetTextExtent(file);
+ }
+
+ if(file.GetLength() > 3)
+ {
+ pDC->SetTextColor(textcolor);
+ pDC->TextOut(rcItem.left+3, (rcItem.top+rcItem.bottom-filesize.cy)/2, file);
+ }
+}
+
+BOOL CPlayerPlaylistBar::OnFileClosePlaylist(UINT nID)
+{
+ Empty();
+ return FALSE;
+}
+
+BOOL CPlayerPlaylistBar::OnPlayPlay(UINT nID)
+{
+ m_list.Invalidate();
+ return FALSE;
+}
+
+void CPlayerPlaylistBar::OnDropFiles(HDROP hDropInfo)
+{
+ SetActiveWindow();
+
+ CAtlList<CString> sl;
+
+ UINT nFiles = ::DragQueryFile(hDropInfo, (UINT)-1, NULL, 0);
+ for(UINT iFile = 0; iFile < nFiles; iFile++)
+ {
+ TCHAR szFileName[_MAX_PATH];
+ ::DragQueryFile(hDropInfo, iFile, szFileName, _MAX_PATH);
+ sl.AddTail(szFileName);
+ }
+ ::DragFinish(hDropInfo);
+
+ Append(sl, true);
+}
+
+void CPlayerPlaylistBar::OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ ModifyStyle(WS_EX_ACCEPTFILES, 0);
+
+ m_nDragIndex = ((LPNMLISTVIEW)pNMHDR)->iItem;
+
+ CPoint p(0, 0);
+ m_pDragImage = m_list.CreateDragImageEx(&p);
+
+ CPoint p2 = ((LPNMLISTVIEW)pNMHDR)->ptAction;
+
+ m_pDragImage->BeginDrag(0, p2 - p);
+ m_pDragImage->DragEnter(GetDesktopWindow(), ((LPNMLISTVIEW)pNMHDR)->ptAction);
+
+ m_bDragging = TRUE;
+ m_nDropIndex = -1;
+
+ SetCapture();
+}
+
+void CPlayerPlaylistBar::OnMouseMove(UINT nFlags, CPoint point)
+{
+ if(m_bDragging)
+ {
+ m_ptDropPoint = point;
+ ClientToScreen(&m_ptDropPoint);
+
+ m_pDragImage->DragMove(m_ptDropPoint);
+ m_pDragImage->DragShowNolock(FALSE);
+
+ WindowFromPoint(m_ptDropPoint)->ScreenToClient(&m_ptDropPoint);
+
+ m_pDragImage->DragShowNolock(TRUE);
+
+ {
+ int iOverItem = m_list.HitTest(m_ptDropPoint);
+ int iTopItem = m_list.GetTopIndex();
+ int iBottomItem = m_list.GetBottomIndex();
+
+ if(iOverItem == iTopItem && iTopItem != 0) // top of list
+ SetTimer(1, 100, NULL);
+ else
+ KillTimer(1);
+
+ if(iOverItem >= iBottomItem && iBottomItem != (m_list.GetItemCount() - 1)) // bottom of list
+ SetTimer(2, 100, NULL);
+ else
+ KillTimer(2);
+ }
+ }
+
+ __super::OnMouseMove(nFlags, point);
+}
+
+void CPlayerPlaylistBar::OnTimer(UINT nIDEvent)
+{
+ int iTopItem = m_list.GetTopIndex();
+ int iBottomItem = iTopItem + m_list.GetCountPerPage() - 1;
+
+ if(m_bDragging)
+ {
+ m_pDragImage->DragShowNolock(FALSE);
+
+ if(nIDEvent == 1)
+ {
+ m_list.EnsureVisible(iTopItem - 1, false);
+ m_list.UpdateWindow();
+ if(m_list.GetTopIndex() == 0) KillTimer(1);
+ }
+ else if(nIDEvent == 2)
+ {
+ m_list.EnsureVisible(iBottomItem + 1, false);
+ m_list.UpdateWindow();
+ if(m_list.GetBottomIndex() == (m_list.GetItemCount() - 1)) KillTimer(2);
+ }
+
+ m_pDragImage->DragShowNolock(TRUE);
+ }
+
+ __super::OnTimer(nIDEvent);
+}
+
+void CPlayerPlaylistBar::OnLButtonUp(UINT nFlags, CPoint point)
+{
+ if(m_bDragging)
+ {
+ ::ReleaseCapture();
+
+ m_bDragging = FALSE;
+ m_pDragImage->DragLeave(GetDesktopWindow());
+ m_pDragImage->EndDrag();
+
+ delete m_pDragImage;
+ m_pDragImage = NULL;
+
+ KillTimer(1);
+ KillTimer(2);
+
+ CPoint pt(point);
+ ClientToScreen(&pt);
+
+ if(WindowFromPoint(pt) == &m_list)
+ DropItemOnList();
+ }
+
+ ModifyStyle(0, WS_EX_ACCEPTFILES);
+
+ __super::OnLButtonUp(nFlags, point);
+}
+
+void CPlayerPlaylistBar::DropItemOnList()
+{
+ m_ptDropPoint.y += 10; //
+ m_nDropIndex = m_list.HitTest(CPoint(10, m_ptDropPoint.y));
+
+ TCHAR szLabel[MAX_PATH];
+ LV_ITEM lvi;
+ ZeroMemory(&lvi, sizeof(LV_ITEM));
+ lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
+ lvi.stateMask = LVIS_DROPHILITED | LVIS_FOCUSED | LVIS_SELECTED;
+ lvi.pszText = szLabel;
+ lvi.iItem = m_nDragIndex;
+ lvi.cchTextMax = MAX_PATH;
+ m_list.GetItem(&lvi);
+
+ if(m_nDropIndex < 0) m_nDropIndex = m_list.GetItemCount();
+ lvi.iItem = m_nDropIndex;
+ m_list.InsertItem(&lvi);
+
+ CHeaderCtrl* pHeader = (CHeaderCtrl*)m_list.GetDlgItem(0);
+ int nColumnCount = pHeader->GetItemCount();
+ lvi.mask = LVIF_TEXT;
+ lvi.iItem = m_nDropIndex;
+ //INDEX OF DRAGGED ITEM WILL CHANGE IF ITEM IS DROPPED ABOVE ITSELF
+ if(m_nDropIndex < m_nDragIndex) m_nDragIndex++;
+ for(int col=1; col < nColumnCount; col++)
+ {
+ _tcscpy(lvi.pszText, (LPCTSTR)(m_list.GetItemText(m_nDragIndex, col)));
+ lvi.iSubItem = col;
+ m_list.SetItem(&lvi);
+ }
+
+ m_list.DeleteItem(m_nDragIndex);
+
+ CList<CPlaylistItem> tmp;
+ UINT id = -1;
+ for(int i = 0; i < m_list.GetItemCount(); i++)
+ {
+ POSITION pos = (POSITION)m_list.GetItemData(i);
+ CPlaylistItem& pli = m_pl.GetAt(pos);
+ tmp.AddTail(pli);
+ if(pos == m_pl.GetPos()) id = pli.m_id;
+ }
+ m_pl.RemoveAll();
+ POSITION pos = tmp.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ CPlaylistItem& pli = tmp.GetNext(pos);
+ m_pl.AddTail(pli);
+ if(pli.m_id == id) m_pl.SetPos(m_pl.GetTailPosition());
+ m_list.SetItemData(i, (DWORD_PTR)m_pl.GetTailPosition());
+ }
+
+ ResizeListColumn();
+}
+
+BOOL CPlayerPlaylistBar::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
+{
+ TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
+ TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
+
+ if((pNMHDR->code == TTN_NEEDTEXTA && (HWND)pTTTA->lParam != m_list.m_hWnd)
+ || (pNMHDR->code == TTN_NEEDTEXTW && (HWND)pTTTW->lParam != m_list.m_hWnd))
+ return FALSE;
+
+ int row = ((pNMHDR->idFrom-1) >> 10) & 0x3fffff;
+ int col = (pNMHDR->idFrom-1) & 0x3ff;
+
+ if(row < 0 || row >= m_pl.GetCount())
+ return FALSE;
+
+ CPlaylistItem& pli = m_pl.GetAt(FindPos(row));
+
+ CString strTipText;
+
+ if(col == COL_NAME)
+ {
+ POSITION pos = pli.m_fns.GetHeadPosition();
+ while(pos) strTipText += _T("\n") + pli.m_fns.GetNext(pos);
+ strTipText.Trim();
+
+ if(pli.m_type == CPlaylistItem::device)
+ {
+ CString str;
+ str.Format(_T("Video Input %d"), pli.m_vinput);
+ if(pli.m_vinput >= 0) strTipText += _T("\n") + str;
+ str.Format(_T("Video Channel %d"), pli.m_vchannel);
+ if(pli.m_vchannel >= 0) strTipText += _T("\n") + str;
+ str.Format(_T("Audio Input %d"), pli.m_ainput);
+ if(pli.m_ainput >= 0) strTipText += _T("\n") + str;
+ }
+
+ ::SendMessage(pNMHDR->hwndFrom, TTM_SETMAXTIPWIDTH, 0, (LPARAM)(INT)1000);
+ }
+ else if(col == COL_TIME)
+ {
+ return FALSE;
+ }
+
+ static CStringA m_strTipTextA;
+ static CStringW m_strTipTextW;
+
+ if(pNMHDR->code == TTN_NEEDTEXTA)
+ {
+ m_strTipTextA = strTipText;
+ pTTTA->lpszText = (LPSTR)(LPCSTR)m_strTipTextA;
+ }
+ else
+ {
+ m_strTipTextW = strTipText;
+ pTTTW->lpszText = (LPWSTR)(LPCWSTR)m_strTipTextW;
+ }
+
+ *pResult = 0;
+
+ return TRUE; // message was handled
+}
+
+void CPlayerPlaylistBar::OnContextMenu(CWnd* /*pWnd*/, CPoint p)
+{
+ LVHITTESTINFO lvhti;
+ lvhti.pt = p;
+ m_list.ScreenToClient(&lvhti.pt);
+ m_list.SubItemHitTest(&lvhti);
+
+ POSITION pos = FindPos(lvhti.iItem);
+// bool fSelected = (pos == m_pl.GetPos());
+ bool fOnItem = !!(lvhti.flags&LVHT_ONITEM);
+
+ CMenu m;
+ m.CreatePopupMenu();
+
+ enum
+ {
+ M_OPEN=1, M_ADD, M_REMOVE, M_CLIPBOARD, M_SAVEAS,
+ M_SORTBYNAME, M_SORTBYPATH, M_RANDOMIZE, M_SORTBYID,
+ M_REMEMBERPLAYLIST, M_SHUFFLE
+ };
+
+ m.AppendMenu(MF_STRING|(!fOnItem?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_OPEN, ResStr(IDS_PLAYLIST_OPEN));
+ if(((CMainFrame*)AfxGetMainWnd())->m_iPlaybackMode == PM_CAPTURE) m.AppendMenu(MF_STRING|MF_ENABLED, M_ADD, ResStr(IDS_PLAYLIST_ADD));
+ m.AppendMenu(MF_STRING|(/*fSelected||*/!fOnItem?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_REMOVE, ResStr(IDS_PLAYLIST_REMOVE));
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|(!fOnItem?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_CLIPBOARD, ResStr(IDS_PLAYLIST_COPYTOCLIPBOARD));
+ m.AppendMenu(MF_STRING|(!m_pl.GetCount()?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_SAVEAS, ResStr(IDS_PLAYLIST_SAVEAS));
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|(!m_pl.GetCount()?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_SORTBYNAME, ResStr(IDS_PLAYLIST_SORTBYLABEL));
+ m.AppendMenu(MF_STRING|(!m_pl.GetCount()?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_SORTBYPATH, ResStr(IDS_PLAYLIST_SORTBYPATH));
+ m.AppendMenu(MF_STRING|(!m_pl.GetCount()?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_RANDOMIZE, ResStr(IDS_PLAYLIST_RANDOMIZE));
+ m.AppendMenu(MF_STRING|(!m_pl.GetCount()?(MF_DISABLED|MF_GRAYED):MF_ENABLED), M_SORTBYID, ResStr(IDS_PLAYLIST_RESTORE));
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED|(AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("ShufflePlaylistItems"), FALSE)?MF_CHECKED:0), M_SHUFFLE, ResStr(IDS_PLAYLIST_SHUFFLE));
+ m.AppendMenu(MF_STRING|MF_ENABLED|(AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("RememberPlaylistItems"), TRUE)?MF_CHECKED:0), M_REMEMBERPLAYLIST, ResStr(IDS_PLAYLIST_REMEBERITEMS));
+
+ CMainFrame* pMainFrm = (CMainFrame*)AfxGetMainWnd();
+
+ int nID = (int)m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this);
+ switch(nID)
+ {
+ case M_OPEN:
+ m_pl.SetPos(pos);
+ m_list.Invalidate();
+ pMainFrm->OpenCurPlaylistItem();
+ break;
+ case M_ADD:
+ pMainFrm->AddCurDevToPlaylist();
+ m_pl.SetPos(m_pl.GetTailPosition());
+ break;
+ case M_REMOVE:
+ if(m_pl.RemoveAt(pos)) pMainFrm->CloseMedia();
+ m_list.DeleteItem(lvhti.iItem);
+ SavePlaylist();
+ break;
+ case M_SORTBYID:
+ m_pl.SortById();
+ SetupList();
+ SavePlaylist();
+ break;
+ case M_SORTBYNAME:
+ m_pl.SortByName();
+ SetupList();
+ SavePlaylist();
+ break;
+ case M_SORTBYPATH:
+ m_pl.SortByPath();
+ SetupList();
+ SavePlaylist();
+ break;
+ case M_RANDOMIZE:
+ m_pl.Randomize();
+ SetupList();
+ SavePlaylist();
+ break;
+ case M_CLIPBOARD:
+ if(OpenClipboard() && EmptyClipboard())
+ {
+ CString str;
+
+ CPlaylistItem& pli = m_pl.GetAt(pos);
+ POSITION pos = pli.m_fns.GetHeadPosition();
+ while(pos) str += _T("\r\n") + pli.m_fns.GetNext(pos);
+ str.Trim();
+
+ if(HGLOBAL h = GlobalAlloc(GMEM_MOVEABLE, (str.GetLength()+1)*sizeof(TCHAR)))
+ {
+ if(TCHAR* s = (TCHAR*)GlobalLock(h))
+ {
+ _tcscpy(s, str);
+ GlobalUnlock(h);
+#ifdef UNICODE
+ SetClipboardData(CF_UNICODETEXT, h);
+#else
+ SetClipboardData(CF_TEXT, h);
+#endif
+ }
+ }
+ CloseClipboard();
+ }
+ break;
+ case M_SAVEAS:
+ {
+ CSaveTextFileDialog fd(
+ CTextFile::ASCII, NULL, NULL,
+ _T("Media Player Classic playlist (*.mpcpl)|*.mpcpl|Playlist (*.pls)|*.pls|WinAmp playlist (*.m3u)|*.m3u|Windows Media Playlist (*.asx)|*.asx||"),
+ this);
+
+ if(fd.DoModal() != IDOK)
+ break;
+
+ CTextFile::enc encoding = (CTextFile::enc)fd.GetEncoding();
+ if(encoding == CTextFile::ASCII) encoding = CTextFile::ANSI;
+
+ int idx = fd.m_pOFN->nFilterIndex;
+
+ CPath path(fd.GetPathName());
+
+ switch(idx)
+ {
+ case 1: path.AddExtension(_T(".mpcpl")); break;
+ case 2: path.AddExtension(_T(".pls")); break;
+ case 3: path.AddExtension(_T(".m3u")); break;
+ case 4: path.AddExtension(_T(".asx")); break;
+ default: break;
+ }
+
+ bool fRemovePath = true;
+
+ CPath p(path);
+ p.RemoveFileSpec();
+ CString base = (LPCTSTR)p;
+
+ pos = m_pl.GetHeadPosition();
+ while(pos && fRemovePath)
+ {
+ CPlaylistItem& pli = m_pl.GetNext(pos);
+
+ if(pli.m_type != CPlaylistItem::file) fRemovePath = false;
+ else
+ {
+ POSITION pos;
+
+ pos = pli.m_fns.GetHeadPosition();
+ while(pos && fRemovePath)
+ {
+ CString fn = pli.m_fns.GetNext(pos);
+
+ CPath p(fn);
+ p.RemoveFileSpec();
+ if(base != (LPCTSTR)p) fRemovePath = false;
+ }
+
+ pos = pli.m_subs.GetHeadPosition();
+ while(pos && fRemovePath)
+ {
+ CString fn = pli.m_subs.GetNext(pos);
+
+ CPath p(fn);
+ p.RemoveFileSpec();
+ if(base != (LPCTSTR)p) fRemovePath = false;
+ }
+ }
+ }
+
+ if(idx == 1)
+ {
+ SaveMPCPlayList(path, encoding, fRemovePath);
+ break;
+ }
+
+ CTextFile f;
+ if(!f.Save(path, encoding))
+ break;
+
+ if(idx == 4)
+ {
+ f.WriteString(_T("<ASX version = \"3.0\">\n"));
+ }
+
+ pos = m_pl.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ CPlaylistItem& pli = m_pl.GetNext(pos);
+
+ if(pli.m_type != CPlaylistItem::file)
+ continue;
+
+ CString fn = pli.m_fns.GetHead();
+
+ /*
+ if(fRemovePath)
+ {
+ CPath p(path);
+ p.StripPath();
+ fn = (LPCTSTR)p;
+ }
+ */
+
+ CString str;
+ switch(idx)
+ {
+ case 2: str.Format(_T("File%d=%s\n"), i+1, fn); break;
+ case 3: str.Format(_T("%s\n"), fn); break;
+ case 4: str.Format(_T("<Entry><Ref href = \"%s\"/></Entry>\n"), fn); break;
+ default: break;
+ }
+ f.WriteString(str);
+ }
+
+ if(idx == 4)
+ {
+ f.WriteString(_T("</ASX>\n"));
+ }
+ }
+ break;
+ case M_REMEMBERPLAYLIST:
+ AfxGetApp()->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("RememberPlaylistItems"),
+ !AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("RememberPlaylistItems"), TRUE));
+ break;
+ case M_SHUFFLE:
+ AfxGetApp()->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("ShufflePlaylistItems"),
+ !AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("ShufflePlaylistItems"), FALSE));
+ break;
+ default:
+ break;
+ }
+}
+
+void CPlayerPlaylistBar::OnLvnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ NMLVDISPINFO* pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
+
+ if(pDispInfo->item.iItem >= 0 && pDispInfo->item.pszText)
+ {
+ CPlaylistItem& pli = m_pl.GetAt((POSITION)m_list.GetItemData(pDispInfo->item.iItem));
+ pli.m_label = pDispInfo->item.pszText;
+ m_list.SetItemText(pDispInfo->item.iItem, 0, pDispInfo->item.pszText);
+ }
+
+ *pResult = 0;
+}
diff --git a/src/apps/mplayerc/PlayerPlaylistBar.h b/src/apps/mplayerc/PlayerPlaylistBar.h
new file mode 100644
index 000000000..56c7021d9
--- /dev/null
+++ b/src/apps/mplayerc/PlayerPlaylistBar.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include <afxcoll.h>
+#include "PlayerListCtrl.h"
+#include "Playlist.h"
+
+class OpenMediaData;
+
+class CPlayerPlaylistBar : public CSizingControlBarG
+{
+ DECLARE_DYNAMIC(CPlayerPlaylistBar)
+
+private:
+ enum {COL_NAME, COL_TIME};
+
+ CImageList m_fakeImageList;
+ CPlayerListCtrl m_list;
+
+ int m_nTimeColWidth;
+ void ResizeListColumn();
+
+ void AddItem(CString fn, CAtlList<CString>* subs);
+ void AddItem(CAtlList<CString>& fns, CAtlList<CString>* subs);
+ void ParsePlayList(CString fn, CAtlList<CString>* subs);
+ void ParsePlayList(CAtlList<CString>& fns, CAtlList<CString>* subs);
+
+ bool ParseMPCPlayList(CString fn);
+ bool SaveMPCPlayList(CString fn, CTextFile::enc e, bool fRemovePath);
+
+ void SetupList();
+ void UpdateList();
+ void EnsureVisible(POSITION pos);
+ int FindItem(POSITION pos);
+ POSITION FindPos(int i);
+
+ CImageList* m_pDragImage;
+ BOOL m_bDragging;
+ int m_nDragIndex, m_nDropIndex;
+ CPoint m_ptDropPoint;
+
+ void DropItemOnList();
+
+public:
+ CPlayerPlaylistBar();
+ virtual ~CPlayerPlaylistBar();
+
+ BOOL Create(CWnd* pParentWnd);
+
+ CPlaylist m_pl;
+
+ int GetCount();
+ int GetSelIdx();
+ void SetSelIdx(int i);
+ bool IsAtEnd();
+ bool GetCur(CPlaylistItem& pli);
+ CString GetCur();
+ void SetNext(), SetPrev(), SetFirst(), SetLast();
+ void SetCurValid(bool fValid);
+ void SetCurTime(REFERENCE_TIME rt);
+
+ void Refresh();
+ void Empty();
+
+ void Open(CAtlList<CString>& fns, bool fMulti, CAtlList<CString>* subs = NULL);
+ void Append(CAtlList<CString>& fns, bool fMulti, CAtlList<CString>* subs = NULL);
+
+ void Open(CStringW vdn, CStringW adn, int vinput, int vchannel, int ainput);
+ void Append(CStringW vdn, CStringW adn, int vinput, int vchannel, int ainput);
+
+ OpenMediaData* GetCurOMD(REFERENCE_TIME rtStart = 0);
+
+ void LoadPlaylist();
+ void SavePlaylist();
+
+protected:
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnLvnKeyDown(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnLvnKeydownList(NMHDR* pNMHDR, LRESULT* pResult);
+// afx_msg void OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
+ afx_msg BOOL OnFileClosePlaylist(UINT nID);
+ afx_msg BOOL OnPlayPlay(UINT nID);
+ afx_msg void OnDropFiles(HDROP hDropInfo);
+ afx_msg void OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+ afx_msg BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnTimer(UINT nIDEvent);
+ afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
+ afx_msg void OnLvnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+};
diff --git a/src/apps/mplayerc/PlayerSeekBar.cpp b/src/apps/mplayerc/PlayerSeekBar.cpp
new file mode 100644
index 000000000..b8efe5e44
--- /dev/null
+++ b/src/apps/mplayerc/PlayerSeekBar.cpp
@@ -0,0 +1,304 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PlayerSeekBar.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PlayerSeekBar.h"
+
+// CPlayerSeekBar
+
+IMPLEMENT_DYNAMIC(CPlayerSeekBar, CDialogBar)
+
+CPlayerSeekBar::CPlayerSeekBar() :
+ m_start(0), m_stop(100), m_pos(0), m_posreal(0),
+ m_fEnabled(false)
+{
+}
+
+CPlayerSeekBar::~CPlayerSeekBar()
+{
+}
+
+BOOL CPlayerSeekBar::Create(CWnd* pParentWnd)
+{
+ if(!CDialogBar::Create(pParentWnd, IDD_PLAYERSEEKBAR, WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM, IDD_PLAYERSEEKBAR))
+ return FALSE;
+
+ return TRUE;
+}
+
+BOOL CPlayerSeekBar::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!CDialogBar::PreCreateWindow(cs))
+ return FALSE;
+
+ m_dwStyle &= ~CBRS_BORDER_TOP;
+ m_dwStyle &= ~CBRS_BORDER_BOTTOM;
+ m_dwStyle |= CBRS_SIZE_FIXED;
+
+ return TRUE;
+}
+
+void CPlayerSeekBar::Enable(bool fEnable)
+{
+ m_fEnabled = fEnable;
+ Invalidate();
+}
+
+void CPlayerSeekBar::GetRange(__int64& start, __int64& stop)
+{
+ start = m_start;
+ stop = m_stop;
+}
+
+void CPlayerSeekBar::SetRange(__int64 start, __int64 stop)
+{
+ if(start > stop) start ^= stop, stop ^= start, start ^= stop;
+ m_start = start;
+ m_stop = stop;
+ if(m_pos < m_start || m_pos >= m_stop) SetPos(m_start);
+}
+
+__int64 CPlayerSeekBar::GetPos()
+{
+ return(m_pos);
+}
+
+__int64 CPlayerSeekBar::GetPosReal()
+{
+ return(m_posreal);
+}
+
+void CPlayerSeekBar::SetPos(__int64 pos)
+{
+ CWnd* w = GetCapture();
+ if(w && w->m_hWnd == m_hWnd) return;
+
+ SetPosInternal(pos);
+}
+
+void CPlayerSeekBar::SetPosInternal(__int64 pos)
+{
+ if(m_pos == pos) return;
+
+ CRect before = GetThumbRect();
+ m_pos = min(max(pos, m_start), m_stop);
+ m_posreal = pos;
+ CRect after = GetThumbRect();
+
+ if(before != after) InvalidateRect(before | after);
+}
+
+CRect CPlayerSeekBar::GetChannelRect()
+{
+ CRect r;
+ GetClientRect(&r);
+ r.DeflateRect(8, 9, 9, 0);
+ r.bottom = r.top + 5;
+ return(r);
+}
+
+CRect CPlayerSeekBar::GetThumbRect()
+{
+// bool fEnabled = m_fEnabled || m_start >= m_stop;
+
+ CRect r = GetChannelRect();
+
+ int x = r.left + (int)((m_start < m_stop /*&& fEnabled*/) ? (__int64)r.Width() * (m_pos - m_start) / (m_stop - m_start) : 0);
+ int y = r.CenterPoint().y;
+
+ r.SetRect(x, y, x, y);
+ r.InflateRect(6, 7, 7, 8);
+
+ return(r);
+}
+
+CRect CPlayerSeekBar::GetInnerThumbRect()
+{
+ CRect r = GetThumbRect();
+
+ bool fEnabled = m_fEnabled && m_start < m_stop;
+ r.DeflateRect(3, fEnabled ? 5 : 4, 3, fEnabled ? 5 : 4);
+
+ return(r);
+}
+
+void CPlayerSeekBar::MoveThumb(CPoint point)
+{
+ CRect r = GetChannelRect();
+
+ if(r.left >= r.right) return;
+
+ if(point.x < r.left) SetPos(m_start);
+ else if(point.x >= r.right) SetPos(m_stop);
+ else
+ {
+ __int64 w = r.right - r.left;
+ if(m_start < m_stop)
+ SetPosInternal(m_start + ((m_stop - m_start) * (point.x - r.left) + (w/2)) / w);
+ }
+}
+
+BEGIN_MESSAGE_MAP(CPlayerSeekBar, CDialogBar)
+ //{{AFX_MSG_MAP(CPlayerSeekBar)
+ ON_WM_PAINT()
+ ON_WM_SIZE()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_LBUTTONUP()
+ ON_WM_MOUSEMOVE()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
+ ON_COMMAND_EX(ID_PLAY_STOP, OnPlayStop)
+END_MESSAGE_MAP()
+
+
+// CPlayerSeekBar message handlers
+
+void CPlayerSeekBar::OnPaint()
+{
+ CPaintDC dc(this); // device context for painting
+
+ bool fEnabled = m_fEnabled && m_start < m_stop;
+
+ COLORREF
+ white = GetSysColor(COLOR_WINDOW),
+ shadow = GetSysColor(COLOR_3DSHADOW),
+ light = GetSysColor(COLOR_3DHILIGHT),
+ bkg = GetSysColor(COLOR_BTNFACE);
+
+ // thumb
+ {
+ CRect r = GetThumbRect(), r2 = GetInnerThumbRect();
+ CRect rt = r, rit = r2;
+
+ dc.Draw3dRect(&r, light, 0);
+ r.DeflateRect(0, 0, 1, 1);
+ dc.Draw3dRect(&r, light, shadow);
+ r.DeflateRect(1, 1, 1, 1);
+
+ CBrush b(bkg);
+
+ dc.FrameRect(&r, &b);
+ r.DeflateRect(0, 1, 0, 1);
+ dc.FrameRect(&r, &b);
+
+ r.DeflateRect(1, 1, 0, 0);
+ dc.Draw3dRect(&r, shadow, bkg);
+
+ if(fEnabled)
+ {
+ r.DeflateRect(1, 1, 1, 2);
+ CPen white(PS_INSIDEFRAME, 1, white);
+ CPen* old = dc.SelectObject(&white);
+ dc.MoveTo(r.left, r.top);
+ dc.LineTo(r.right, r.top);
+ dc.MoveTo(r.left, r.bottom);
+ dc.LineTo(r.right, r.bottom);
+ dc.SelectObject(old);
+ dc.SetPixel(r.CenterPoint().x, r.top, 0);
+ dc.SetPixel(r.CenterPoint().x, r.bottom, 0);
+ }
+
+ dc.SetPixel(r.CenterPoint().x+5, r.top-4, bkg);
+
+ {
+ CRgn rgn1, rgn2;
+ rgn1.CreateRectRgnIndirect(&rt);
+ rgn2.CreateRectRgnIndirect(&rit);
+ ExtSelectClipRgn(dc, rgn1, RGN_DIFF);
+ ExtSelectClipRgn(dc, rgn2, RGN_OR);
+ }
+ }
+
+ // channel
+ {
+ CRect r = GetChannelRect();
+
+ dc.FillSolidRect(&r, fEnabled ? white : bkg);
+ r.InflateRect(1, 1);
+ dc.Draw3dRect(&r, shadow, light);
+ dc.ExcludeClipRect(&r);
+ }
+
+ // background
+ {
+ CRect r;
+ GetClientRect(&r);
+ CBrush b(bkg);
+ dc.FillRect(&r, &b);
+ }
+
+
+ // Do not call CDialogBar::OnPaint() for painting messages
+}
+
+
+void CPlayerSeekBar::OnSize(UINT nType, int cx, int cy)
+{
+ CDialogBar::OnSize(nType, cx, cy);
+
+ Invalidate();
+}
+
+void CPlayerSeekBar::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ if(m_fEnabled && (GetChannelRect() | GetThumbRect()).PtInRect(point))
+ {
+ SetCapture();
+ MoveThumb(point);
+ GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)m_pos, SB_THUMBPOSITION), (LPARAM)m_hWnd);
+ }
+
+ CDialogBar::OnLButtonDown(nFlags, point);
+}
+
+void CPlayerSeekBar::OnLButtonUp(UINT nFlags, CPoint point)
+{
+ ReleaseCapture();
+
+ CDialogBar::OnLButtonUp(nFlags, point);
+}
+
+void CPlayerSeekBar::OnMouseMove(UINT nFlags, CPoint point)
+{
+ CWnd* w = GetCapture();
+ if(w && w->m_hWnd == m_hWnd && (nFlags & MK_LBUTTON))
+ {
+ MoveThumb(point);
+ GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)m_pos, SB_THUMBTRACK), (LPARAM)m_hWnd);
+ }
+
+ CDialogBar::OnMouseMove(nFlags, point);
+}
+
+BOOL CPlayerSeekBar::OnEraseBkgnd(CDC* pDC)
+{
+ return TRUE;
+}
+
+BOOL CPlayerSeekBar::OnPlayStop(UINT nID)
+{
+ SetPos(0);
+ return FALSE;
+}
diff --git a/src/apps/mplayerc/PlayerSeekBar.h b/src/apps/mplayerc/PlayerSeekBar.h
new file mode 100644
index 000000000..7919232b5
--- /dev/null
+++ b/src/apps/mplayerc/PlayerSeekBar.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CPlayerSeekBar
+
+class CPlayerSeekBar : public CDialogBar
+{
+ DECLARE_DYNAMIC(CPlayerSeekBar)
+
+private:
+ __int64 m_start, m_stop, m_pos, m_posreal;
+ bool m_fEnabled;
+
+ void MoveThumb(CPoint point);
+ void SetPosInternal(__int64 pos);
+
+ CRect GetChannelRect();
+ CRect GetThumbRect();
+ CRect GetInnerThumbRect();
+
+public:
+ CPlayerSeekBar();
+ virtual ~CPlayerSeekBar();
+
+ void Enable(bool fEnable);
+
+ void GetRange(__int64& start, __int64& stop);
+ void SetRange(__int64 start, __int64 stop);
+ __int64 GetPos(), GetPosReal();
+ void SetPos(__int64 pos);
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CPlayerSeekBar)
+ virtual BOOL Create(CWnd* pParentWnd);
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ //}}AFX_VIRTUAL
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CPlayerSeekBar)
+ afx_msg void OnPaint();
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg BOOL OnPlayStop(UINT nID);
+};
diff --git a/src/apps/mplayerc/PlayerShaderEditorBar.cpp b/src/apps/mplayerc/PlayerShaderEditorBar.cpp
new file mode 100644
index 000000000..d098dff71
--- /dev/null
+++ b/src/apps/mplayerc/PlayerShaderEditorBar.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PlayerShaderEditorBar.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "PlayerShaderEditorBar.h"
+
+// CPlayerShaderEditorBar
+
+IMPLEMENT_DYNAMIC(CPlayerShaderEditorBar, baseCPlayerShaderEditorBar)
+CPlayerShaderEditorBar::CPlayerShaderEditorBar()
+{
+}
+
+CPlayerShaderEditorBar::~CPlayerShaderEditorBar()
+{
+}
+
+BOOL CPlayerShaderEditorBar::Create(CWnd* pParentWnd)
+{
+ if(!__super::Create(_T("Shader Editor"), pParentWnd, 0))
+ return FALSE;
+
+ m_dlg.Create(this);
+ m_dlg.ShowWindow(SW_SHOWNORMAL);
+
+ CRect r;
+ m_dlg.GetWindowRect(r);
+ m_szMinVert = m_szVert = r.Size();
+ m_szMinHorz = m_szHorz = r.Size();
+ m_szMinFloat = m_szFloat = r.Size();
+ m_bFixedFloat = false;
+
+ return TRUE;
+}
+
+BOOL CPlayerShaderEditorBar::PreTranslateMessage(MSG* pMsg)
+{
+ if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
+ {
+ if(IsDialogMessage(pMsg))
+ return TRUE;
+ }
+
+ return __super::PreTranslateMessage(pMsg);
+}
+
+BEGIN_MESSAGE_MAP(CPlayerShaderEditorBar, baseCPlayerShaderEditorBar)
+ ON_WM_SIZE()
+END_MESSAGE_MAP()
+
+// CPlayerShaderEditorBar message handlers
+
+void CPlayerShaderEditorBar::OnSize(UINT nType, int cx, int cy)
+{
+ __super::OnSize(nType, cx, cy);
+
+ if(::IsWindow(m_dlg.m_hWnd))
+ {
+ CRect r;
+ GetClientRect(r);
+ m_dlg.MoveWindow(r);
+ }
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/PlayerShaderEditorBar.h b/src/apps/mplayerc/PlayerShaderEditorBar.h
new file mode 100644
index 000000000..5db9d5f0a
--- /dev/null
+++ b/src/apps/mplayerc/PlayerShaderEditorBar.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "ShaderEditorDlg.h"
+
+#ifndef baseCPlayerShaderEditorBar
+#define baseCPlayerShaderEditorBar CSizingControlBarG
+#endif
+
+// CPlayerShaderEditorBar
+
+class CPlayerShaderEditorBar : public baseCPlayerShaderEditorBar
+{
+ DECLARE_DYNAMIC(CPlayerShaderEditorBar)
+
+public:
+ CPlayerShaderEditorBar();
+ virtual ~CPlayerShaderEditorBar();
+
+ BOOL Create(CWnd* pParentWnd);
+
+public:
+ CShaderEditorDlg m_dlg;
+
+protected:
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+};
diff --git a/src/apps/mplayerc/PlayerStatusBar.cpp b/src/apps/mplayerc/PlayerStatusBar.cpp
new file mode 100644
index 000000000..18240774b
--- /dev/null
+++ b/src/apps/mplayerc/PlayerStatusBar.cpp
@@ -0,0 +1,374 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PlayerStatusBar.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PlayerStatusBar.h"
+#include "MainFrm.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+// CPlayerStatusBar
+
+IMPLEMENT_DYNAMIC(CPlayerStatusBar, CDialogBar)
+
+CPlayerStatusBar::CPlayerStatusBar()
+ : m_status(false, false)
+ , m_time(true, false)
+ , m_bmid(0)
+ , m_hIcon(0)
+{
+}
+
+CPlayerStatusBar::~CPlayerStatusBar()
+{
+ if(m_hIcon) DestroyIcon(m_hIcon);
+}
+
+BOOL CPlayerStatusBar::Create(CWnd* pParentWnd)
+{
+ return CDialogBar::Create(pParentWnd, IDD_PLAYERSTATUSBAR, WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM, IDD_PLAYERSTATUSBAR);
+}
+
+BOOL CPlayerStatusBar::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!CDialogBar::PreCreateWindow(cs))
+ return FALSE;
+
+ m_dwStyle &= ~CBRS_BORDER_TOP;
+ m_dwStyle &= ~CBRS_BORDER_BOTTOM;
+
+ return TRUE;
+}
+
+int CPlayerStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if(CDialogBar::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ CRect r;
+ r.SetRectEmpty();
+
+ m_type.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_ICON,
+ r, this, IDC_STATIC1);
+
+ m_status.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_OWNERDRAW,
+ r, this, IDC_PLAYERSTATUS);
+
+ m_time.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_OWNERDRAW,
+ r, this, IDC_PLAYERTIME);
+
+ m_status.SetWindowPos(&m_time, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+
+ Relayout();
+
+ return 0;
+}
+
+void CPlayerStatusBar::Relayout()
+{
+ BITMAP bm;
+ memset(&bm, 0, sizeof(bm));
+ if(m_bm.m_hObject) m_bm.GetBitmap(&bm);
+
+ CRect r, r2;
+ GetClientRect(r);
+
+ r.DeflateRect(27, 5, bm.bmWidth + 8, 4);
+ int div = r.right - (m_time.IsWindowVisible() ? 140 : 0);
+
+ CString str;
+ m_time.GetWindowText(str);
+ if(CDC* pDC = m_time.GetDC())
+ {
+ CFont* pOld = pDC->SelectObject(&m_time.GetFont());
+ div = r.right - pDC->GetTextExtent(str).cx;
+ pDC->SelectObject(pOld);
+ m_time.ReleaseDC(pDC);
+ }
+
+ r2 = r;
+ r2.right = div - 2;
+ m_status.MoveWindow(&r2);
+
+ r2 = r;
+ r2.left = div;
+ m_time.MoveWindow(&r2);
+
+ GetClientRect(r);
+ r.SetRect(6, r.top+4, 22, r.bottom-4);
+ m_type.MoveWindow(r);
+
+ Invalidate();
+}
+
+void CPlayerStatusBar::Clear()
+{
+ m_status.SetWindowText(_T(""));
+ m_time.SetWindowText(_T(""));
+ SetStatusBitmap(0);
+ SetStatusTypeIcon(0);
+
+ Relayout();
+}
+
+void CPlayerStatusBar::SetStatusBitmap(UINT id)
+{
+ if(m_bmid == id) return;
+
+ if(m_bm.m_hObject) m_bm.DeleteObject();
+ if(id) m_bm.LoadBitmap(id);
+ m_bmid = id;
+
+ Relayout();
+}
+
+void CPlayerStatusBar::SetStatusTypeIcon(HICON hIcon)
+{
+ if(m_hIcon == hIcon) return;
+
+ if(m_hIcon) DestroyIcon(m_hIcon);
+ m_type.SetIcon(m_hIcon = hIcon);
+
+ Relayout();
+}
+
+void CPlayerStatusBar::SetStatusMessage(CString str)
+{
+ str.Trim();
+ m_status.SetWindowText(str);
+}
+
+CString CPlayerStatusBar::GetStatusTimer()
+{
+ CString strResult;
+
+ m_time.GetWindowText(strResult);
+
+ return strResult;
+}
+
+void CPlayerStatusBar::SetStatusTimer(CString str)
+{
+ CString tmp;
+ m_time.GetWindowText(tmp);
+ if(tmp == str) return;
+
+ str.Trim();
+ m_time.SetWindowText(str);
+
+ Relayout();
+}
+
+void CPlayerStatusBar::SetStatusTimer(REFERENCE_TIME rtNow, REFERENCE_TIME rtDur, bool fHighPrecision, const GUID* pTimeFormat)
+{
+ ASSERT(pTimeFormat);
+
+ CString str;
+ CString posstr, durstr;
+
+ if(*pTimeFormat == TIME_FORMAT_MEDIA_TIME)
+ {
+ DVD_HMSF_TIMECODE tcNow = RT2HMSF(rtNow);
+ DVD_HMSF_TIMECODE tcDur = RT2HMSF(rtDur);
+
+ if(tcDur.bHours > 0 || (rtNow >= rtDur && tcNow.bHours > 0))
+ posstr.Format(_T("%02d:%02d:%02d"), tcNow.bHours, tcNow.bMinutes, tcNow.bSeconds);
+ else
+ posstr.Format(_T("%02d:%02d"), tcNow.bMinutes, tcNow.bSeconds);
+
+ if(tcDur.bHours > 0)
+ durstr.Format(_T("%02d:%02d:%02d"), tcDur.bHours, tcDur.bMinutes, tcDur.bSeconds);
+ else
+ durstr.Format(_T("%02d:%02d"), tcDur.bMinutes, tcDur.bSeconds);
+
+ if(fHighPrecision)
+ {
+ str.Format(_T("%s.%03d"), posstr, (rtNow/10000)%1000);
+ posstr = str;
+ str.Format(_T("%s.%03d"), durstr, (rtDur/10000)%1000);
+ durstr = str;
+ str.Empty();
+ }
+ }
+ else if(*pTimeFormat == TIME_FORMAT_FRAME)
+ {
+ posstr.Format(_T("%I64d"), rtNow);
+ durstr.Format(_T("%I64d"), rtDur);
+ }
+
+ str = (/*start <= 0 &&*/ rtDur <= 0) ? posstr : posstr + _T(" / ") + durstr;
+
+ SetStatusTimer(str);
+}
+
+void CPlayerStatusBar::ShowTimer(bool fShow)
+{
+ m_time.ShowWindow(fShow ? SW_SHOW : SW_HIDE);
+
+ Relayout();
+}
+
+BEGIN_MESSAGE_MAP(CPlayerStatusBar, CDialogBar)
+ ON_WM_ERASEBKGND()
+ ON_WM_PAINT()
+ ON_WM_SIZE()
+ ON_WM_CREATE()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_SETCURSOR()
+ ON_WM_CTLCOLOR()
+END_MESSAGE_MAP()
+
+
+// CPlayerStatusBar message handlers
+
+
+BOOL CPlayerStatusBar::OnEraseBkgnd(CDC* pDC)
+{
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
+ {
+ if(!pChild->IsWindowVisible()) continue;
+
+ CRect r;
+ pChild->GetClientRect(&r);
+ pChild->MapWindowPoints(this, &r);
+ pDC->ExcludeClipRect(&r);
+ }
+
+ CRect r;
+ GetClientRect(&r);
+
+ CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
+
+ if(pFrame->m_pLastBar != this || pFrame->m_fFullScreen)
+ r.InflateRect(0, 0, 0, 1);
+
+ if(pFrame->m_fFullScreen)
+ r.InflateRect(1, 0, 1, 0);
+
+ pDC->Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
+
+ r.DeflateRect(1, 1);
+
+ pDC->FillSolidRect(&r, 0);
+
+ return TRUE;
+}
+
+void CPlayerStatusBar::OnPaint()
+{
+ CPaintDC dc(this); // device context for painting
+
+ CRect r;
+
+ if(m_bm.m_hObject)
+ {
+ BITMAP bm;
+ m_bm.GetBitmap(&bm);
+ CDC memdc;
+ memdc.CreateCompatibleDC(&dc);
+ memdc.SelectObject(&m_bm);
+ GetClientRect(&r);
+ dc.BitBlt(r.right-bm.bmWidth-1, (r.Height() - bm.bmHeight)/2, bm.bmWidth, bm.bmHeight, &memdc, 0, 0, SRCCOPY);
+
+ //
+ }
+/*
+ if(m_hIcon)
+ {
+ GetClientRect(&r);
+ r.SetRect(6, r.top+4, 22-1, r.bottom-4-1);
+ DrawIconEx(dc, r.left, r.top, m_hIcon, r.Width(), r.Height(), 0, NULL, DI_NORMAL|DI_COMPAT);
+ }
+*/
+ // Do not call CDialogBar::OnPaint() for painting messages
+}
+
+void CPlayerStatusBar::OnSize(UINT nType, int cx, int cy)
+{
+ CDialogBar::OnSize(nType, cx, cy);
+
+ Relayout();
+}
+
+void CPlayerStatusBar::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
+
+ WINDOWPLACEMENT wp;
+ wp.length = sizeof(wp);
+ pFrame->GetWindowPlacement(&wp);
+
+ if(!pFrame->m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED)
+ {
+ CRect r;
+ GetClientRect(r);
+ CPoint p = point;
+
+ MapWindowPoints(pFrame, &point, 1);
+ pFrame->PostMessage(WM_NCLBUTTONDOWN,
+// (p.x+p.y >= r.Width()) ? HTBOTTOMRIGHT : HTCAPTION,
+ (p.x >= r.Width()-r.Height()) ? HTBOTTOMRIGHT :
+ HTCAPTION,
+ MAKELPARAM(point.x, point.y));
+ }
+}
+
+BOOL CPlayerStatusBar::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
+{
+ CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
+
+ WINDOWPLACEMENT wp;
+ wp.length = sizeof(wp);
+ pFrame->GetWindowPlacement(&wp);
+
+ if(!pFrame->m_fFullScreen && wp.showCmd != SW_SHOWMAXIMIZED)
+ {
+ CRect r;
+ GetClientRect(r);
+ CPoint p;
+ GetCursorPos(&p);
+ ScreenToClient(&p);
+// if(p.x+p.y >= r.Width())
+ if(p.x >= r.Width()-r.Height())
+ {
+ SetCursor(LoadCursor(NULL, IDC_SIZENWSE));
+ return TRUE;
+ }
+ }
+
+ return CDialogBar::OnSetCursor(pWnd, nHitTest, message);
+}
+
+HBRUSH CPlayerStatusBar::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+ HBRUSH hbr = CDialogBar::OnCtlColor(pDC, pWnd, nCtlColor);
+
+ if(*pWnd == m_type)
+ {
+ hbr = GetStockBrush(BLACK_BRUSH);
+ }
+
+ // TODO: Return a different brush if the default is not desired
+ return hbr;
+}
diff --git a/src/apps/mplayerc/PlayerStatusBar.h b/src/apps/mplayerc/PlayerStatusBar.h
new file mode 100644
index 000000000..4e459be17
--- /dev/null
+++ b/src/apps/mplayerc/PlayerStatusBar.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "StatusLabel.h"
+
+// CPlayerStatusBar
+
+class CPlayerStatusBar : public CDialogBar
+{
+ DECLARE_DYNAMIC(CPlayerStatusBar)
+
+ CStatic m_type;
+ CStatusLabel m_status, m_time;
+ CBitmap m_bm;
+ UINT m_bmid;
+ HICON m_hIcon;
+
+ void Relayout();
+
+public:
+ CPlayerStatusBar();
+ virtual ~CPlayerStatusBar();
+
+ void Clear();
+
+ void SetStatusBitmap(UINT id);
+ void SetStatusTypeIcon(HICON hIcon);
+ void SetStatusMessage(CString str);
+ void SetStatusTimer(CString str);
+ void SetStatusTimer(REFERENCE_TIME rtNow, REFERENCE_TIME rtDur, bool fHighPrecision, const GUID* pTimeFormat = &TIME_FORMAT_MEDIA_TIME);
+
+ CString GetStatusTimer();
+
+ void ShowTimer(bool fShow);
+
+// Overrides
+ virtual BOOL Create(CWnd* pParentWnd);
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+
+ DECLARE_MESSAGE_MAP()
+
+protected:
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ afx_msg void OnPaint();
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+public:
+ afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+};
diff --git a/src/apps/mplayerc/PlayerSubresyncBar.cpp b/src/apps/mplayerc/PlayerSubresyncBar.cpp
new file mode 100644
index 000000000..aa4ba19f0
--- /dev/null
+++ b/src/apps/mplayerc/PlayerSubresyncBar.cpp
@@ -0,0 +1,1301 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PlayerSubresyncBar.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "mainfrm.h"
+#include "PlayerSubresyncBar.h"
+
+// CPlayerSubresyncBar
+
+IMPLEMENT_DYNAMIC(CPlayerSubresyncBar, CSizingControlBarG)
+CPlayerSubresyncBar::CPlayerSubresyncBar()
+{
+ m_rt = 0;
+ m_fUnlink = false;
+ m_lastSegment = -1;
+}
+
+CPlayerSubresyncBar::~CPlayerSubresyncBar()
+{
+}
+
+BOOL CPlayerSubresyncBar::Create(CWnd* pParentWnd, CCritSec* pSubLock)
+{
+ if(!CSizingControlBarG::Create(_T("Subresync"), pParentWnd, 0))
+ return FALSE;
+
+ m_pSubLock = pSubLock;
+
+ m_list.CreateEx(
+ WS_EX_DLGMODALFRAME|WS_EX_CLIENTEDGE,
+ WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_TABSTOP|LVS_REPORT/*|LVS_SHOWSELALWAYS*/|LVS_AUTOARRANGE|LVS_NOSORTHEADER,
+ CRect(0,0,100,100), this, IDC_SUBRESYNCLIST);
+
+ m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER);
+
+ return TRUE;
+}
+
+BOOL CPlayerSubresyncBar::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!CSizingControlBarG::PreCreateWindow(cs))
+ return FALSE;
+
+ return TRUE;
+}
+
+BOOL CPlayerSubresyncBar::PreTranslateMessage(MSG* pMsg)
+{
+ if(IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST)
+ {
+ if(IsShortCut(pMsg) || IsDialogMessage(pMsg))
+ return TRUE;
+ }
+
+ return CSizingControlBarG::PreTranslateMessage(pMsg);
+}
+
+void CPlayerSubresyncBar::SetTime(__int64 rt)
+{
+ m_rt = rt;
+
+ int curSegment;
+
+ if(!m_sts.SearchSubs((int)(rt/10000), 25, &curSegment))
+ {
+ curSegment = -1;
+ }
+
+ if(m_lastSegment != curSegment) m_list.Invalidate();
+ m_lastSegment = curSegment;
+}
+
+void CPlayerSubresyncBar::SetSubtitle(ISubStream* pSubStream, double fps)
+{
+ m_pSubStream = pSubStream;
+
+ m_mode = NONE;
+ m_lastSegment = -1;
+ m_sts.Empty();
+
+ ResetSubtitle();
+
+ if(!m_pSubStream) return;
+
+ CLSID clsid;
+ m_pSubStream->GetClassID(&clsid);
+
+ if(clsid == __uuidof(CVobSubFile))
+ {
+ CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)m_pSubStream;
+
+ m_mode = VOBSUB;
+
+ CAtlArray<CVobSubFile::SubPos>& sp = pVSF->m_langs[pVSF->m_iLang].subpos;
+
+ for(int i = 0, j = sp.GetCount(); i < j; i++)
+ {
+ CString str;
+ str.Format(_T("%d,%d,%d,%d"), sp[i].vobid, sp[i].cellid, sp[i].fForced, i);
+ m_sts.Add(TToW(str), false, (int)sp[i].start, (int)sp[i].stop);
+ }
+
+ m_sts.CreateDefaultStyle(DEFAULT_CHARSET);
+
+ pVSF->m_fOnlyShowForcedSubs = false;
+
+ for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) m_list.DeleteColumn(0);
+ m_list.InsertColumn(COL_START, _T("Time"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_END, _T("End"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_PREVSTART, _T("Preview"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_PREVEND, _T("End"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_VOBID, _T("Vob ID"), LVCFMT_CENTER, 60);
+ m_list.InsertColumn(COL_CELLID, _T("Cell ID"), LVCFMT_CENTER, 60);
+ m_list.InsertColumn(COL_FORCED, _T("Forced"), LVCFMT_CENTER, 60);
+ }
+ else if(clsid == __uuidof(CRenderedTextSubtitle))
+ {
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
+
+ m_mode = TEXTSUB;
+
+ m_sts.Copy(*pRTS);
+ m_sts.ConvertToTimeBased(fps);
+ m_sts.Sort(true); /*!!m_fUnlink*/
+
+#ifndef UNICODE
+ if(!m_sts.IsEntryUnicode(0))
+ {
+ CFont* f = m_list.GetFont();
+ LOGFONT lf;
+ f->GetLogFont(&lf);
+ lf.lfCharSet = m_sts.GetCharSet(0);
+ m_font.DeleteObject();
+ m_font.CreateFontIndirect(&lf);
+ m_list.SetFont(&m_font);
+ }
+#endif
+ for(int i = 0, j = m_list.GetHeaderCtrl()->GetItemCount(); i < j; i++) m_list.DeleteColumn(0);
+ m_list.InsertColumn(COL_START, _T("Time"), LVCFMT_LEFT, 90);
+ m_list.InsertColumn(COL_END, _T("End"), LVCFMT_LEFT, 4);
+ m_list.InsertColumn(COL_PREVSTART, _T("Preview"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_PREVEND, _T("End"), LVCFMT_LEFT, 4);
+ m_list.InsertColumn(COL_TEXT, _T("Text"), LVCFMT_LEFT, 275);
+ m_list.InsertColumn(COL_STYLE, _T("Style"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_FONT, _T("Font"), LVCFMT_LEFT, 60);
+ m_list.InsertColumn(COL_CHARSET, _T("CharSet"), LVCFMT_CENTER, 20);
+ m_list.InsertColumn(COL_UNICODE, _T("Unicode"), LVCFMT_CENTER, 40);
+ m_list.InsertColumn(COL_LAYER, _T("Layer"), LVCFMT_CENTER, 50);
+ m_list.InsertColumn(COL_ACTOR, _T("Actor"), LVCFMT_LEFT, 80);
+ m_list.InsertColumn(COL_EFFECT, _T("Effect"), LVCFMT_LEFT, 80);
+ }
+
+ m_subtimes.SetCount(m_sts.GetCount());
+
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ {
+ m_subtimes[i].orgstart = m_sts[i].start;
+ m_subtimes[i].orgend = m_sts[i].end;
+ }
+
+ ResetSubtitle();
+}
+
+void CPlayerSubresyncBar::ResetSubtitle()
+{
+ m_list.DeleteAllItems();
+
+ if(m_mode == VOBSUB || m_mode == TEXTSUB)
+ {
+ TCHAR buff[32];
+
+ int prevstart = INT_MIN;
+
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ {
+ m_subtimes[i].newstart = m_subtimes[i].orgstart;
+ m_subtimes[i].newend = m_subtimes[i].orgend;
+
+ FormatTime(i, buff, 0, false);
+ m_list.InsertItem(i, buff, COL_START);
+ FormatTime(i, buff, 0, true);
+ m_list.SetItemText(i, COL_END, buff);
+
+ if(prevstart > m_subtimes[i].orgstart) m_list.SetItemData(i, TSEP);
+ prevstart = m_subtimes[i].orgstart;
+
+ SetCheck(i, false, false);
+ }
+
+ UpdatePreview();
+
+ m_list.SetColumnWidth(COL_START, LVSCW_AUTOSIZE);
+ m_list.SetColumnWidth(COL_PREVSTART, LVSCW_AUTOSIZE);
+ }
+
+ UpdateStrings();
+}
+
+void CPlayerSubresyncBar::SaveSubtitle()
+{
+ CMainFrame* pFrame = ((CMainFrame*)AfxGetMainWnd());
+ if(!pFrame) return;
+
+ CLSID clsid;
+ m_pSubStream->GetClassID(&clsid);
+
+ if(clsid == __uuidof(CVobSubFile) && m_mode == VOBSUB)
+ {
+ CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)m_pSubStream;
+
+ CAutoLock cAutoLock(m_pSubLock);
+
+ CAtlArray<CVobSubFile::SubPos>& sp = pVSF->m_langs[pVSF->m_iLang].subpos;
+
+ for(int i = 0, j = sp.GetCount(); i < j; i++)
+ {
+ sp[i].fValid = false;
+ }
+
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ {
+ int vobid, cellid, forced, spnum, c;
+ if(_stscanf(m_sts.GetStr(i), _T("%d%c%d%c%d%c%d"), &vobid, &c, &cellid, &c, &forced, &c, &spnum) != 7) continue;
+ sp[spnum].start = m_sts[i].start;
+ sp[spnum].stop = m_sts[i].end;
+ sp[spnum].fValid = true;
+ }
+ }
+ else if(clsid == __uuidof(CRenderedTextSubtitle) && m_mode == TEXTSUB)
+ {
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
+
+ CAutoLock cAutoLock(m_pSubLock);
+
+ pRTS->Copy(m_sts);
+ }
+ else
+ {
+ return;
+ }
+
+ pFrame->InvalidateSubtitle();
+}
+
+void CPlayerSubresyncBar::UpdatePreview()
+{
+ if(m_mode == VOBSUB || m_mode == TEXTSUB)
+ {
+ if(0/*m_fUnlink*/)
+ {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ {
+ bool fStartMod, fEndMod, fStartAdj, fEndAdj;
+ GetCheck(i, fStartMod, fEndMod, fStartAdj, fEndAdj);
+ m_sts[i].start = (fStartMod||fStartAdj) ? m_subtimes[i].newstart : m_subtimes[i].orgstart;
+ m_sts[i].end = (fEndMod||fEndAdj) ? m_subtimes[i].newend : m_subtimes[i].orgend;
+ }
+ }
+ else
+ {
+ CAtlArray<int> schk;
+
+ for(int i = 0, j = m_sts.GetCount(); i < j;)
+ {
+ schk.RemoveAll();
+
+ int start = i, end;
+
+ for(end = i; end < j; end++)
+ {
+ int data = (int)m_list.GetItemData(end);
+ if((data&TSEP) && end > i) break;
+ if(data&(TSMOD|TSADJ))
+ schk.Add(end);
+ }
+
+ if(schk.GetCount() == 0)
+ {
+ for(; start < end; start++)
+ {
+ m_sts[start].start = m_subtimes[start].orgstart;
+ m_sts[start].end = m_subtimes[start].orgend;
+ }
+ }
+ else if(schk.GetCount() == 1)
+ {
+ int k = schk[0];
+ int dt = m_subtimes[k].newstart - m_subtimes[k].orgstart;
+ for(; start < end; start++)
+ {
+ m_sts[start].start = m_subtimes[start].orgstart + dt;
+ m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
+ ? m_subtimes[start].newend
+ : (m_subtimes[start].orgend + dt);
+ }
+ }
+ else if(schk.GetCount() >= 2)
+ {
+ int i0, i1, ti0, ds;
+ double m = 0;
+
+ for(int k = 0, l = schk.GetCount()-1; k < l; k++)
+ {
+ i0 = schk[k];
+ i1 = schk[k+1];
+
+ ti0 = m_subtimes[i0].orgstart;
+ ds = m_subtimes[i1].orgstart - ti0;
+
+ if(ds == 0)
+ {
+ for(; start < i1; start++)
+ {
+ m_sts[start].start = ti0;
+ m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
+ ? m_subtimes[start].newend
+ : (ti0 + m_subtimes[start].orgend - m_subtimes[start].orgstart);
+ }
+ }
+ else
+ {
+ m = double(m_subtimes[i1].newstart - m_subtimes[i0].newstart) / ds;
+
+ for(; start < i1; start++)
+ {
+ m_sts[start].start = int((m_subtimes[start].orgstart - ti0)*m + m_subtimes[i0].newstart);
+ m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
+ ? m_subtimes[start].newend
+ : m_mode == VOBSUB
+ ? (m_sts[start].start + m_subtimes[start].orgend - m_subtimes[start].orgstart)
+ : (m_sts[start].start + int((m_subtimes[start].orgend - m_subtimes[start].orgstart)*m));
+ }
+ }
+ }
+
+ if(ds == 0)
+ {
+ for(; start < end; start++)
+ {
+ m_sts[start].start = ti0;
+ m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
+ ? m_subtimes[start].newend
+ : (ti0 + (m_subtimes[start].orgend - m_subtimes[start].orgstart));
+ }
+ }
+ else
+ {
+ for(; start < end; start++)
+ {
+ m_sts[start].start = int((m_subtimes[start].orgstart - ti0)*m + m_subtimes[i0].newstart);
+ m_sts[start].end = (m_list.GetItemData(start)&TEMOD)
+ ? m_subtimes[start].newend
+ : m_mode == VOBSUB
+ ? (m_sts[start].start + m_subtimes[start].orgend - m_subtimes[start].orgstart)
+ : (m_sts[start].start + int((m_subtimes[start].orgend - m_subtimes[start].orgstart)*m));
+ }
+ }
+ }
+
+ i = end;
+ }
+ }
+
+ m_sts.CreateSegments();
+
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ {
+ TCHAR buff[32];
+ FormatTime(i, buff, 2, false);
+ m_list.SetItemText(i, COL_PREVSTART, buff);
+ FormatTime(i, buff, 2, true);
+ m_list.SetItemText(i, COL_PREVEND, buff);
+ }
+
+ if(IsWindowVisible())
+ {
+ SaveSubtitle();
+ }
+ }
+}
+
+void CPlayerSubresyncBar::UpdateStrings()
+{
+ CString str;
+
+ if(m_mode == TEXTSUB)
+ {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ {
+ STSStyle stss;
+ m_sts.GetStyle(i, stss);
+
+ m_list.SetItemText(i, COL_TEXT, m_sts.GetStr(i, true));
+ m_list.SetItemText(i, COL_STYLE, m_sts[i].style);
+ m_list.SetItemText(i, COL_FONT, stss.fontName);
+ str.Format(_T("%d"), stss.charSet);
+ m_list.SetItemText(i, COL_CHARSET, str);
+ m_list.SetItemText(i, COL_UNICODE, m_sts.IsEntryUnicode(i) ? _T("yes") : _T("no"));
+ str.Format(_T("%d"), m_sts[i].layer);
+ m_list.SetItemText(i, COL_LAYER, str);
+ m_list.SetItemText(i, COL_ACTOR, m_sts[i].actor);
+ m_list.SetItemText(i, COL_EFFECT, m_sts[i].effect);
+ }
+ }
+ else if(m_mode == VOBSUB)
+ {
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ {
+ int vobid, cellid, forced, c;
+ if(_stscanf(m_sts.GetStr(i), _T("%d%c%d%c%d"), &vobid, &c, &cellid, &c, &forced) != 5) continue;
+ if(vobid < 0) str = _T("-");
+ else str.Format(_T("%d"), vobid);
+ m_list.SetItemText(i, COL_VOBID, str);
+ if(cellid < 0) str = _T("-");
+ else str.Format(_T("%d"), cellid);
+ m_list.SetItemText(i, COL_CELLID, str);
+ str = forced?_T("Yes"):_T("");
+ m_list.SetItemText(i, COL_FORCED, str);
+ }
+ }
+}
+
+void CPlayerSubresyncBar::GetCheck(int iItem, bool& fStartMod, bool& fEndMod, bool& fStartAdj, bool& fEndAdj)
+{
+ if(0 <= iItem && iItem < m_sts.GetCount())
+ {
+ int nCheck = (int)m_list.GetItemData(iItem);
+ fStartMod = !!(nCheck&TSMOD);
+ fEndMod = !!(nCheck&TEMOD);
+ fStartAdj = !!(nCheck&TSADJ);
+ fEndAdj = !!(nCheck&TEADJ);
+ }
+}
+
+void CPlayerSubresyncBar::SetCheck(int iItem, bool fStart, bool fEnd)
+{
+ if(0 <= iItem && iItem < m_sts.GetCount())
+ {
+ SubTime& st = m_subtimes[iItem];
+
+ int nCheck = (int)m_list.GetItemData(iItem) & TSEP;
+
+ if(fStart) nCheck |= TSMOD;
+ else if(abs(st.orgstart-st.newstart)) nCheck |= TSADJ;
+ if(fEnd) nCheck |= TEMOD;
+ else if(abs(st.orgend-st.newend)) nCheck |= TEADJ;
+
+ m_list.SetItemData(iItem, (DWORD)nCheck);
+
+ TCHAR buff[32];
+ FormatTime(iItem, buff, fStart, false);
+ m_list.SetItemText(iItem, COL_START, buff);
+ FormatTime(iItem, buff, fEnd, true);
+ m_list.SetItemText(iItem, COL_END, buff);
+ }
+}
+
+bool CPlayerSubresyncBar::ModStart(int iItem, int t, bool fReset)
+{
+ bool fRet = false;
+
+ bool fStartMod, fEndMod, fStartAdj, fEndAdj;
+ GetCheck(iItem, fStartMod, fEndMod, fStartAdj, fEndAdj);
+
+ SubTime& st = m_subtimes[iItem];
+
+// if(fStartMod || fStartAdj || st.orgstart != t || fReset)
+ {
+ fRet = (st.newstart != t);
+
+ st.newstart = t;
+ if(!fEndMod) st.newend = st.newstart + (st.orgend - st.orgstart);
+ else if(fReset) st.newstart = st.newend - (st.orgend - st.orgstart);
+
+ SetCheck(iItem, !fReset, fEndMod);
+ }
+
+ return(fRet);
+}
+
+bool CPlayerSubresyncBar::ModEnd(int iItem, int t, bool fReset)
+{
+ bool fRet = false;
+
+ bool fStartMod, fEndMod, fStartAdj, fEndAdj;
+ GetCheck(iItem, fStartMod, fEndMod, fStartAdj, fEndAdj);
+
+ SubTime& st = m_subtimes[iItem];
+
+// if(fEndMod || fEndAdj || st.orgend != t || fReset)
+ {
+ fRet = (st.newend != t);
+
+ st.newend = t;
+ if(!fStartMod) st.newstart = st.newend - (st.orgend - st.orgstart);
+ else if(fReset) st.newend = st.newstart + (st.orgend - st.orgstart);
+
+ SetCheck(iItem, fStartMod, !fReset);
+ }
+
+ return(fRet);
+}
+
+void CPlayerSubresyncBar::FormatTime(int iItem, TCHAR* buff, int time, bool fEnd)
+{
+ int t = !fEnd
+ ?(time == 2 ? m_sts[iItem].start
+ : time == 1 ? m_subtimes[iItem].newstart
+ : m_subtimes[iItem].orgstart)
+ : (time == 2 ? m_sts[iItem].end
+ : time == 1 ? m_subtimes[iItem].newend
+ : m_subtimes[iItem].orgend);
+
+ _stprintf(buff, t >= 0
+ ? _T("%02d:%02d:%02d.%03d")
+ : _T("-%02d:%02d:%02d.%03d"),
+ abs(t)/60/60/1000,
+ (abs(t)/60/1000)%60,
+ (abs(t)/1000)%60,
+ abs(t)%1000);
+}
+
+
+BEGIN_MESSAGE_MAP(CPlayerSubresyncBar, CSizingControlBarG)
+ ON_WM_SIZE()
+ ON_NOTIFY(LVN_BEGINLABELEDIT, IDC_SUBRESYNCLIST, OnBeginlabeleditList)
+ ON_NOTIFY(LVN_DOLABELEDIT, IDC_SUBRESYNCLIST, OnDolabeleditList)
+ ON_NOTIFY(LVN_ENDLABELEDIT, IDC_SUBRESYNCLIST, OnEndlabeleditList)
+ ON_NOTIFY(NM_RCLICK, IDC_SUBRESYNCLIST, OnRclickList)
+ ON_NOTIFY(NM_DBLCLK, IDC_SUBRESYNCLIST, OnNMDblclkList)
+ ON_NOTIFY(LVN_KEYDOWN, IDC_SUBRESYNCLIST, OnLvnKeydownList)
+ ON_NOTIFY(NM_CUSTOMDRAW, IDC_SUBRESYNCLIST, OnCustomdrawList)
+END_MESSAGE_MAP()
+
+
+// CPlayerSubresyncBar message handlers
+
+void CPlayerSubresyncBar::OnSize(UINT nType, int cx, int cy)
+{
+ CSizingControlBarG::OnSize(nType, cx, cy);
+
+ if(::IsWindow(m_list.m_hWnd))
+ {
+ CRect r;
+ GetClientRect(r);
+ r.DeflateRect(2, 2);
+ m_list.MoveWindow(r);
+ }
+}
+
+static bool ParseTime(CString str, int& ret, bool fWarn = true)
+{
+ int sign = 1, h, m, s, ms;
+ TCHAR c;
+
+ str.Trim();
+ if(str.GetLength() > 0 && str[0] == '-') sign = -1;
+
+ int n = _stscanf(str, _T("%d%c%d%c%d%c%d"), &h, &c, &m, &c, &s, &c, &ms);
+
+ h = abs(h);
+
+ if(n == 7
+ && 0 <= h && h < 24
+ && 0 <= m && m < 60
+ && 0 <= s && s < 60
+ && 0 <= ms && ms < 1000)
+ {
+ ret = sign*(h*60*60*1000+m*60*1000+s*1000+ms);
+ return(true);
+ }
+
+ if(fWarn) AfxMessageBox(_T("The correct time format is [-]hh:mm:ss.ms\n(e.g. 01:23:45.678)"));
+ return(false);
+}
+
+void CPlayerSubresyncBar::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
+ LV_ITEM* pItem = &pDispInfo->item;
+
+ *pResult = FALSE;
+
+ if(pItem->iItem >= 0)
+ {
+ if((pItem->iSubItem == COL_START || pItem->iSubItem == COL_END || pItem->iSubItem == COL_TEXT
+ || pItem->iSubItem == COL_STYLE || pItem->iSubItem == COL_LAYER
+ || pItem->iSubItem == COL_ACTOR || pItem->iSubItem == COL_EFFECT)
+ && m_mode == TEXTSUB)
+ {
+ *pResult = TRUE;
+ }
+ else if((pItem->iSubItem == COL_START)
+ && m_mode == VOBSUB)
+ {
+ *pResult = TRUE;
+ }
+ }
+}
+
+void CPlayerSubresyncBar::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
+ LV_ITEM* pItem = &pDispInfo->item;
+
+ *pResult = FALSE;
+
+ if(pItem->iItem >= 0)
+ {
+ if((pItem->iSubItem == COL_START || pItem->iSubItem == COL_END || pItem->iSubItem == COL_TEXT
+ || pItem->iSubItem == COL_STYLE || pItem->iSubItem == COL_LAYER
+ || pItem->iSubItem == COL_ACTOR || pItem->iSubItem == COL_EFFECT)
+ && m_mode == TEXTSUB)
+ {
+ m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
+ *pResult = TRUE;
+ }
+ else if((pItem->iSubItem == COL_START)
+ && m_mode == VOBSUB)
+ {
+ m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
+ *pResult = TRUE;
+ }
+ }
+}
+
+void CPlayerSubresyncBar::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
+ LV_ITEM* pItem = &pDispInfo->item;
+
+ *pResult = FALSE;
+
+ if(!m_list.m_fInPlaceDirty)
+ return;
+
+ bool fNeedsUpdate = false;
+
+ if(pItem->iItem >= 0 && pItem->pszText && (m_mode == VOBSUB || m_mode == TEXTSUB))
+ {
+ if(pItem->iSubItem == COL_START)
+ {
+ int t;
+ if(ParseTime(pItem->pszText, t))
+ {
+ fNeedsUpdate = ModStart(pItem->iItem, t);
+
+ *pResult = TRUE;
+ }
+ }
+ else if(pItem->iSubItem == COL_END && m_mode == TEXTSUB)
+ {
+ int t;
+ if(ParseTime(pItem->pszText, t))
+ {
+ fNeedsUpdate = ModEnd(pItem->iItem, t);
+
+ *pResult = TRUE;
+ }
+ }
+ else if(pItem->iSubItem == COL_TEXT && m_mode == TEXTSUB)
+ {
+ CString str = m_sts.GetStr(pItem->iItem, true);
+
+ if(str != pItem->pszText)
+ {
+ fNeedsUpdate = true;
+ m_sts.SetStr(pItem->iItem, CString(pItem->pszText), true);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, m_sts.GetStr(pItem->iItem, true));
+ }
+ }
+ else if(pItem->iSubItem == COL_STYLE && m_mode == TEXTSUB)
+ {
+ CString str(pItem->pszText);
+ str.Trim();
+
+ if(!str.IsEmpty() && m_sts[pItem->iItem].style != str)
+ {
+ fNeedsUpdate = true;
+
+ if(!m_sts.m_styles.Lookup(str))
+ m_sts.AddStyle(str, new STSStyle());
+
+ m_sts[pItem->iItem].style = str;
+
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, pItem->pszText);
+ }
+ }
+ else if(pItem->iSubItem == COL_LAYER && m_mode == TEXTSUB)
+ {
+ int l;
+ if(_stscanf(pItem->pszText, _T("%d"), &l) == 1)
+ {
+ fNeedsUpdate = true;
+ m_sts[pItem->iItem].layer = l;
+ CString str;
+ str.Format(_T("%d"), l);
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ }
+ }
+ else if(pItem->iSubItem == COL_ACTOR && m_mode == TEXTSUB)
+ {
+ CString str(pItem->pszText);
+ str.Trim();
+ if(!str.IsEmpty())
+ {
+ fNeedsUpdate = true;
+ m_sts[pItem->iItem].actor = str;
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ }
+ }
+ else if(pItem->iSubItem == COL_EFFECT && m_mode == TEXTSUB)
+ {
+ CString str(pItem->pszText);
+ str.Trim();
+ if(!str.IsEmpty())
+ {
+ fNeedsUpdate = true;
+ m_sts[pItem->iItem].effect = str;
+ m_list.SetItemText(pItem->iItem, pItem->iSubItem, str);
+ }
+ }
+ }
+
+ if(fNeedsUpdate)
+ {
+ UpdatePreview();
+ }
+}
+
+static int uintcomp(const void* i1, const void* i2)
+{
+ return(*((UINT*)i2) - *((UINT*)i1));
+}
+
+void CPlayerSubresyncBar::OnRclickList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
+
+ if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0)
+ {
+ enum
+ {
+ TOGSEP=1,
+ DUPITEM, DELITEM,
+ RESETS, SETOS, SETCS, RESETE, SETOE, SETCE,
+ STYLEFIRST, STYLELAST=STYLEFIRST+1000, STYLEEDIT,
+ UNICODEYES, UNICODENO,
+ LAYERDEC, LAYERINC,
+ ACTORFIRST, ACTORLAST=ACTORFIRST+1000,
+ EFFECTFIRST, EFFECTLAST=EFFECTFIRST+1000
+ };
+
+ CStringArray styles;
+ CStringArray actors;
+ CStringArray effects;
+
+ CMenu m;
+ m.CreatePopupMenu();
+
+ if(m_mode == VOBSUB || m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_STRING|MF_ENABLED, TOGSEP, ResStr(IDS_SUBRESYNC_SEPARATOR));
+ m.AppendMenu(MF_SEPARATOR);
+ if(m_mode == TEXTSUB) m.AppendMenu(MF_STRING|MF_ENABLED, DUPITEM, ResStr(IDS_SUBRESYNC_DUPLICATE));
+ m.AppendMenu(MF_STRING|MF_ENABLED, DELITEM, ResStr(IDS_SUBRESYNC_DELETE));
+ }
+
+ if(lpnmlv->iSubItem == COL_START && (m_mode == VOBSUB || m_mode == TEXTSUB))
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, RESETS, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF1"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETOS, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF3"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETCS, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF5"));
+ }
+ else if(lpnmlv->iSubItem == COL_END && m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, RESETE, ResStr(IDS_SUBRESYNC_RESET) + _T("\tF2"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETOE, ResStr(IDS_SUBRESYNC_ORIGINAL) + _T("\tF4"));
+ m.AppendMenu(MF_STRING|MF_ENABLED, SETCE, ResStr(IDS_SUBRESYNC_CURRENT) + _T("\tF6"));
+ }
+ else if(lpnmlv->iSubItem == COL_STYLE && m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+
+ int id = STYLEFIRST;
+
+ POSITION pos = m_sts.m_styles.GetStartPosition();
+ while(pos && id <= STYLELAST)
+ {
+ CString key;
+ STSStyle* val;
+ m_sts.m_styles.GetNextAssoc(pos, key, val);
+ styles.Add(key);
+ m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ }
+
+ if(id > STYLEFIRST && m_list.GetSelectedCount() == 1)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, STYLEEDIT, ResStr(IDS_SUBRESYNC_EDIT));
+ }
+ }
+ else if(lpnmlv->iSubItem == COL_UNICODE && m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, UNICODEYES, ResStr(IDS_SUBRESYNC_YES));
+ m.AppendMenu(MF_STRING|MF_ENABLED, UNICODENO, ResStr(IDS_SUBRESYNC_NO));
+ }
+ else if(lpnmlv->iSubItem == COL_LAYER && m_mode == TEXTSUB)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+ m.AppendMenu(MF_STRING|MF_ENABLED, LAYERDEC, ResStr(IDS_SUBRESYNC_DECREASE));
+ m.AppendMenu(MF_STRING|MF_ENABLED, LAYERINC, ResStr(IDS_SUBRESYNC_INCREASE));
+ }
+ else if(lpnmlv->iSubItem == COL_ACTOR && m_mode == TEXTSUB)
+ {
+ CMapStringToPtr actormap;
+
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ actormap[m_sts[i].actor] = NULL;
+
+ actormap.RemoveKey(_T(""));
+
+ if(actormap.GetCount() > 0)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+
+ int id = ACTORFIRST;
+
+ POSITION pos = actormap.GetStartPosition();
+ while(pos && id <= ACTORLAST)
+ {
+ CString key;
+ void* val;
+ actormap.GetNextAssoc(pos, key, val);
+
+ actors.Add(key);
+
+ m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ }
+ }
+ }
+ else if(lpnmlv->iSubItem == COL_EFFECT && m_mode == TEXTSUB)
+ {
+ CMapStringToPtr effectmap;
+
+ for(int i = 0, j = m_sts.GetCount(); i < j; i++)
+ effectmap[m_sts[i].effect] = NULL;
+
+ effectmap.RemoveKey(_T(""));
+
+ if(effectmap.GetCount() > 0)
+ {
+ m.AppendMenu(MF_SEPARATOR);
+
+ int id = EFFECTFIRST;
+
+ POSITION pos = effectmap.GetStartPosition();
+ while(pos && id <= EFFECTLAST)
+ {
+ CString key;
+ void* val;
+ effectmap.GetNextAssoc(pos, key, val);
+
+ effects.Add(key);
+
+ m.AppendMenu(MF_STRING|MF_ENABLED, id++, key);
+ }
+ }
+ }
+
+ CPoint p = lpnmlv->ptAction;
+ ::MapWindowPoints(pNMHDR->hwndFrom, HWND_DESKTOP, &p, 1);
+
+ UINT id = m.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, this);
+
+ bool fNeedsUpdate = false;
+
+ POSITION pos = m_list.GetFirstSelectedItemPosition();
+ while(pos)
+ {
+ int iItem = m_list.GetNextSelectedItem(pos);
+
+ SubTime& st = m_subtimes[iItem];
+
+ switch(id)
+ {
+ case TOGSEP:
+ m_list.SetItemData(iItem, m_list.GetItemData(iItem)^TSEP);
+ m_list.Invalidate();
+ fNeedsUpdate = true;
+ break;
+ case DUPITEM:
+ {
+ CUIntArray items;
+ pos = m_list.GetFirstSelectedItemPosition();
+ while(pos) items.Add(m_list.GetNextSelectedItem(pos));
+
+ qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);
+
+ for(int i = 0; i < items.GetCount(); i++)
+ {
+ iItem = items[i];
+
+ STSEntry stse = m_sts[iItem];
+ m_sts.InsertAt(iItem+1, stse);
+
+ SubTime st = m_subtimes[iItem];
+ m_subtimes.InsertAt(iItem+1, st);
+
+ CHeaderCtrl* pHeader = (CHeaderCtrl*)m_list.GetDlgItem(0);
+ int nColumnCount = pHeader->GetItemCount();
+
+ CStringArray sa;
+ sa.SetSize(nColumnCount);
+ for(int col = 0; col < nColumnCount; col++)
+ sa[col] = m_list.GetItemText(iItem, col);
+
+ DWORD data = m_list.GetItemData(iItem);
+ m_list.InsertItem(iItem+1, sa[0]);
+ m_list.SetItemData(iItem+1, data);
+ for(int col = 1; col < nColumnCount; col++)
+ m_list.SetItemText(iItem+1, col, sa[col]);
+ }
+ }
+
+ fNeedsUpdate = true;
+ break;
+ case DELITEM:
+ {
+ CUIntArray items;
+ pos = m_list.GetFirstSelectedItemPosition();
+ while(pos) items.Add(m_list.GetNextSelectedItem(pos));
+
+ qsort(items.GetData(), items.GetCount(), sizeof(UINT), uintcomp);
+
+ for(int i = 0; i < items.GetCount(); i++)
+ {
+ iItem = items[i];
+ m_sts.RemoveAt(iItem);
+ m_subtimes.RemoveAt(iItem);
+ m_list.DeleteItem(iItem);
+ }
+
+ iItem = items[items.GetCount()-1];
+ if(iItem >= m_list.GetItemCount()) iItem = m_list.GetItemCount()-1;
+
+ m_list.SetSelectionMark(iItem);
+ }
+ fNeedsUpdate = true;
+ break;
+ case RESETS: /*if(*/ModStart(iItem, st.orgstart, true);/*)*/ fNeedsUpdate = true; break;
+ case SETOS: /*if(*/ModStart(iItem, st.orgstart);/*)*/ fNeedsUpdate = true; break;
+ case SETCS: /*if(*/ModStart(iItem, (int)(m_rt/10000));/*)*/ fNeedsUpdate = true; break;
+ case RESETE: /*if(*/ModEnd(iItem, st.orgend, true);/*)*/ fNeedsUpdate = true; break;
+ case SETOE: /*if(*/ModEnd(iItem, st.orgend);/*)*/ fNeedsUpdate = true; break;
+ case SETCE: /*if(*/ModEnd(iItem, (int)(m_rt/10000));/*)*/ fNeedsUpdate = true; break;
+ default:
+ if(STYLEFIRST <= id && id <= STYLELAST)
+ {
+ CString s = styles[id - STYLEFIRST];
+ if(m_sts[iItem].style != s) fNeedsUpdate = true;
+ m_sts[iItem].style = s;
+ m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
+ }
+ else if(id == STYLEEDIT)
+ {
+ CAutoPtrArray<CPPageSubStyle> pages;
+ CAtlArray<STSStyle*> styles;
+
+ STSStyle* stss = m_sts.GetStyle(iItem);
+ int iSelPage = 0;
+
+ POSITION pos = m_sts.m_styles.GetStartPosition();
+ for(int i = 0; pos; i++)
+ {
+ CString key;
+ STSStyle* val;
+ m_sts.m_styles.GetNextAssoc(pos, key, val);
+
+ CAutoPtr<CPPageSubStyle> page(new CPPageSubStyle());
+ page->InitStyle(key, *val);
+ pages.Add(page);
+ styles.Add(val);
+
+ if(stss == val)
+ iSelPage = i;
+ }
+
+ CPropertySheet dlg(_T("Styles..."), this, iSelPage);
+ for(int i = 0; i < (int)pages.GetCount(); i++) dlg.AddPage(pages[i]);
+
+ if(dlg.DoModal() == IDOK)
+ {
+ for(int j = 0; j < (int)pages.GetCount(); j++)
+ {
+ stss = styles[j];
+ pages[j]->GetStyle(*stss);
+
+ for(int i = 0; i < m_sts.GetCount(); i++)
+ {
+ if(m_sts.GetStyle(i) == stss)
+ {
+ CString str;
+ m_list.SetItemText(i, COL_TEXT, m_sts.GetStr(i, true));
+ m_list.SetItemText(i, COL_FONT, stss->fontName);
+ str.Format(_T("%d"), stss->charSet);
+ m_list.SetItemText(i, COL_CHARSET, str);
+ str.Format(_T("%d"), m_sts[i].layer);
+ }
+ }
+ }
+
+ fNeedsUpdate = true;
+ }
+ }
+ else if(id == UNICODEYES || id == UNICODENO)
+ {
+ m_sts.ConvertUnicode(iItem, id == UNICODEYES);
+ m_list.SetItemText(iItem, COL_TEXT, m_sts.GetStr(iItem, true));
+ m_list.SetItemText(iItem, COL_UNICODE, m_sts.IsEntryUnicode(iItem) ? _T("yes") : _T("no"));
+ fNeedsUpdate = true;
+ }
+ else if(id == LAYERDEC || id == LAYERINC)
+ {
+ int d = (id == LAYERDEC) ? -1 : (id == LAYERINC) ? +1 : 0;
+ if(d != 0) fNeedsUpdate = true;
+ m_sts[iItem].layer += d;
+ CString s;
+ s.Format(_T("%d"), m_sts[iItem].layer);
+ m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
+ }
+ else if(ACTORFIRST <= id && id <= ACTORLAST)
+ {
+ CString s = actors[id - ACTORFIRST];
+ if(m_sts[iItem].actor != s) fNeedsUpdate = true;
+ m_sts[iItem].actor = s;
+ m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
+ }
+ else if(EFFECTFIRST <= id && id <= EFFECTLAST)
+ {
+ CString s = effects[id - EFFECTFIRST];
+ if(m_sts[iItem].effect != s) fNeedsUpdate = true;
+ m_sts[iItem].effect = s;
+ m_list.SetItemText(iItem, lpnmlv->iSubItem, s);
+ }
+ break;
+ }
+ }
+
+ if(fNeedsUpdate)
+ {
+ UpdatePreview();
+ }
+ }
+
+ *pResult = 0;
+}
+
+void CPlayerSubresyncBar::OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
+
+ if(lpnmlv->iItem >= 0 && lpnmlv->iSubItem >= 0 && (m_mode == VOBSUB || m_mode == TEXTSUB))
+ {
+ if(CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd())
+ {
+ int t = 0;
+ if(!ParseTime(m_list.GetItemText(lpnmlv->iItem, lpnmlv->iSubItem), t, false))
+ t = m_sts[lpnmlv->iItem].start;
+
+ REFERENCE_TIME rt =
+ lpnmlv->iSubItem == COL_START ? ((REFERENCE_TIME)t*10000) :
+ lpnmlv->iSubItem == COL_END ? ((REFERENCE_TIME)t*10000) :
+ lpnmlv->iSubItem == COL_PREVSTART ? ((REFERENCE_TIME)t*10000) :
+ lpnmlv->iSubItem == COL_PREVEND ? ((REFERENCE_TIME)t*10000) :
+ ((REFERENCE_TIME)t*10000);
+
+ pFrame->SeekTo(rt);
+ }
+ }
+
+ *pResult = 0;
+}
+
+void CPlayerSubresyncBar::OnLvnKeydownList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMLVKEYDOWN pLVKeyDown = reinterpret_cast<LPNMLVKEYDOWN>(pNMHDR);
+
+ *pResult = 0;
+}
+
+static CUIntArray m_itemGroups;
+static int m_totalGroups;
+
+void CPlayerSubresyncBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
+
+ *pResult = CDRF_DODEFAULT;
+
+ if(CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
+ {
+ m_itemGroups.SetSize(m_list.GetItemCount());
+ m_totalGroups = 0;
+ for(int i = 0, j = m_list.GetItemCount(); i < j; i++)
+ {
+ if(m_list.GetItemData(i)&TSEP) m_totalGroups++;
+ m_itemGroups[i] = m_totalGroups;
+ }
+
+ *pResult = CDRF_NOTIFYPOSTPAINT|CDRF_NOTIFYITEMDRAW;
+ }
+ else if(CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
+ {
+ pLVCD->nmcd.uItemState &= ~CDIS_FOCUS;
+
+ *pResult = CDRF_NOTIFYPOSTPAINT|CDRF_NOTIFYSUBITEMDRAW;
+ }
+ else if((CDDS_ITEMPREPAINT|CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage)
+ {
+ COLORREF clrText;
+ COLORREF clrTextBk;
+
+ if((pLVCD->iSubItem == COL_START || pLVCD->iSubItem == COL_END || pLVCD->iSubItem == COL_TEXT || pLVCD->iSubItem == COL_STYLE
+ || pLVCD->iSubItem == COL_LAYER || pLVCD->iSubItem == COL_ACTOR || pLVCD->iSubItem == COL_EFFECT)
+ && m_mode == TEXTSUB)
+ {
+ clrText = 0;
+ }
+ else if((pLVCD->iSubItem == COL_START)
+ && m_mode == VOBSUB)
+ {
+ clrText = 0;
+ }
+ else
+ {
+ clrText = 0x606060;
+ }
+
+ clrTextBk = 0xffffff;
+// if(m_totalGroups > 0)
+ clrTextBk -= ((m_itemGroups[pLVCD->nmcd.dwItemSpec]&1) ? 0x100010 : 0x200020);
+
+ if(m_sts[pLVCD->nmcd.dwItemSpec].start <= m_rt/10000 && m_rt/10000 < m_sts[pLVCD->nmcd.dwItemSpec].end)
+ {
+ clrText |= 0xFF;
+ }
+
+ int nCheck = (int)m_list.GetItemData(pLVCD->nmcd.dwItemSpec);
+
+ if((nCheck&1) && (pLVCD->iSubItem == COL_START || pLVCD->iSubItem == COL_PREVSTART))
+ {
+ clrTextBk = 0xffddbb;
+ }
+ else if((nCheck&4) && (/*pLVCD->iSubItem == COL_START ||*/ pLVCD->iSubItem == COL_PREVSTART))
+ {
+ clrTextBk = 0xffeedd;
+ }
+
+ if((nCheck&2) && (pLVCD->iSubItem == COL_END || pLVCD->iSubItem == COL_PREVEND))
+ {
+ clrTextBk = 0xffddbb;
+ }
+ else if((nCheck&8) && (/*pLVCD->iSubItem == COL_END ||*/ pLVCD->iSubItem == COL_PREVEND))
+ {
+ clrTextBk = 0xffeedd;
+ }
+
+ pLVCD->clrText = clrText;
+ pLVCD->clrTextBk = clrTextBk;
+
+ *pResult = CDRF_NOTIFYPOSTPAINT;
+ }
+ else if((CDDS_ITEMPOSTPAINT|CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage)
+ {
+// *pResult = CDRF_DODEFAULT;
+ }
+ else if(CDDS_ITEMPOSTPAINT == pLVCD->nmcd.dwDrawStage)
+ {
+ int nItem = static_cast<int>(pLVCD->nmcd.dwItemSpec);
+
+ LVITEM rItem;
+ ZeroMemory(&rItem, sizeof(LVITEM));
+ rItem.mask = LVIF_IMAGE | LVIF_STATE;
+ rItem.iItem = nItem;
+ rItem.stateMask = LVIS_SELECTED;
+ m_list.GetItem(&rItem);
+
+ {
+ CDC* pDC = CDC::FromHandle(pLVCD->nmcd.hdc);
+
+ CRect rcItem;
+ m_list.GetItemRect(nItem, &rcItem, LVIR_BOUNDS);
+
+ {
+ bool fSeparator = nItem < m_list.GetItemCount()-1 && (m_list.GetItemData(nItem+1)&TSEP);
+ CPen p(PS_INSIDEFRAME, 1, fSeparator ? 0x404040 : 0xe0e0e0);
+ CPen* old = pDC->SelectObject(&p);
+ pDC->MoveTo(CPoint(rcItem.left, rcItem.bottom-1));
+ pDC->LineTo(CPoint(rcItem.right, rcItem.bottom-1));
+ pDC->SelectObject(old);
+ }
+
+ {
+ CPen p(PS_INSIDEFRAME, 1, 0xe0e0e0);
+ CPen* old = pDC->SelectObject(&p);
+
+ CHeaderCtrl* pHeader = (CHeaderCtrl*)m_list.GetDlgItem(0);
+ int nColumnCount = pHeader->GetItemCount();
+
+ // Get the column offset
+ int offset = rcItem.left;
+ for(int i = 0; i < nColumnCount; i++)
+ {
+ offset += m_list.GetColumnWidth(i);
+ pDC->MoveTo(CPoint(offset, rcItem.top));
+ pDC->LineTo(CPoint(offset, rcItem.bottom));
+ }
+
+ pDC->SelectObject(old);
+ }
+
+ *pResult = CDRF_SKIPDEFAULT;
+ }
+ }
+ else if(CDDS_POSTPAINT == pLVCD->nmcd.dwDrawStage)
+ {
+ }
+}
+
+
+bool CPlayerSubresyncBar::IsShortCut(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN && VK_F1 <= pMsg->wParam && pMsg->wParam <= VK_F6)
+ {
+ int iItem = -1;
+
+ bool fNeedsUpdate = false;
+ bool fStep = false;
+
+ POSITION pos = m_list.GetFirstSelectedItemPosition();
+ while(pos)
+ {
+ iItem = m_list.GetNextSelectedItem(pos);
+
+ SubTime& st = m_subtimes[iItem];
+
+ switch(pMsg->wParam)
+ {
+ case VK_F1: /*if(*/ModStart(iItem, st.orgstart, true);/*)*/ fNeedsUpdate = true; break;
+ case VK_F3: /*if(*/ModStart(iItem, st.orgstart);/*)*/ fNeedsUpdate = true; break;
+ case VK_F5: /*if(*/ModStart(iItem, (int)(m_rt/10000));/*)*/ fNeedsUpdate = true; break;
+ case VK_F2: /*if(*/ModEnd(iItem, st.orgend, true);/*)*/ fNeedsUpdate = true; break;
+ case VK_F4: /*if(*/ModEnd(iItem, st.orgend);/*)*/ fNeedsUpdate = true; break;
+ case VK_F6: /*if(*/ModEnd(iItem, (int)(m_rt/10000));/*)*/ fNeedsUpdate = fStep = true; break;
+ }
+ }
+
+ if(fNeedsUpdate)
+ {
+ if(fStep && m_list.GetSelectedCount() == 1 && iItem < m_list.GetItemCount()-1)
+ {
+ m_list.SetItemState(iItem, 0, LVIS_SELECTED);
+ m_list.SetItemState(iItem+1, LVIS_SELECTED, LVIS_SELECTED);
+ m_list.SetSelectionMark(iItem+1);
+ m_list.EnsureVisible(iItem+1, false);
+ }
+
+ UpdatePreview();
+
+ return true;
+ }
+ }
+
+ return false;
+}
diff --git a/src/apps/mplayerc/PlayerSubresyncBar.h b/src/apps/mplayerc/PlayerSubresyncBar.h
new file mode 100644
index 000000000..f826c511b
--- /dev/null
+++ b/src/apps/mplayerc/PlayerSubresyncBar.h
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <afxcview.h>
+#include "PlayerListCtrl.h"
+#include "..\..\subtitles\RTS.h"
+#include "..\..\subtitles\VobSubFile.h"
+
+// CPlayerSubresyncBar
+
+class CPlayerSubresyncBar : public CSizingControlBarG
+{
+ DECLARE_DYNAMIC(CPlayerSubresyncBar)
+
+private:
+ CPlayerListCtrl m_list;
+
+ CFont m_font;
+
+ CCritSec* m_pSubLock;
+ CComPtr<ISubStream> m_pSubStream;
+
+ int m_lastSegment;
+ __int64 m_rt;
+
+ enum
+ {
+ // TEXTSUB
+ COL_START=0, COL_END, COL_PREVSTART, COL_PREVEND, COL_TEXT, COL_STYLE, COL_FONT, COL_CHARSET, COL_UNICODE, COL_LAYER, COL_ACTOR, COL_EFFECT,
+ // VOBSUB
+ /* ........... same as TEXTSUB ............. */ COL_VOBID=COL_TEXT, COL_CELLID, COL_FORCED,
+ };
+
+ enum {NONE = 0, VOBSUB, TEXTSUB};
+ int m_mode;
+
+ bool m_fUnlink;
+
+ typedef struct {int orgstart, newstart, orgend, newend;} SubTime;
+ CAtlArray<SubTime> m_subtimes;
+
+// CRenderedTextSubtitle m_sts;
+ CSimpleTextSubtitle m_sts;
+
+ int GetStartTime(int iItem), GetEndTime(int iItem);
+ void FormatTime(int iItem, TCHAR* buff, int time /* 0:start, 1:newstart, 2:preview */, bool fEnd);
+
+ void UpdatePreview(), UpdateStrings();
+
+ enum {TSMOD=1, TEMOD=2, TSADJ=4, TEADJ=8, TSEP=0x80000000};
+
+ void GetCheck(int iItem, bool& fStartMod, bool& fEndMod, bool& fStartAdj, bool& fEndAdj);
+ void SetCheck(int iItem, bool fStart, bool fEnd);
+
+ bool ModStart(int iItem, int t, bool fReset = false);
+ bool ModEnd(int iItem, int t, bool fReset = false);
+
+public:
+ CPlayerSubresyncBar();
+ virtual ~CPlayerSubresyncBar();
+
+ BOOL Create(CWnd* pParentWnd, CCritSec* pSubLock);
+
+ void SetTime(__int64 rt);
+
+ void SetSubtitle(ISubStream* pSubStream, double fps);
+ void ResetSubtitle();
+ void SaveSubtitle();
+
+protected:
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ bool IsShortCut(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnRclickList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnNMDblclkList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnLvnKeydownList(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult);
+};
diff --git a/src/apps/mplayerc/PlayerToolBar.cpp b/src/apps/mplayerc/PlayerToolBar.cpp
new file mode 100644
index 000000000..9bcf75d19
--- /dev/null
+++ b/src/apps/mplayerc/PlayerToolBar.cpp
@@ -0,0 +1,276 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PlayerToolBar.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include <math.h>
+#include <atlbase.h>
+#include <afxpriv.h>
+#include "PlayerToolBar.h"
+#include "MainFrm.h"
+
+typedef HRESULT (__stdcall * SetWindowThemeFunct)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList);
+
+// CPlayerToolBar
+
+IMPLEMENT_DYNAMIC(CPlayerToolBar, CToolBar)
+CPlayerToolBar::CPlayerToolBar()
+{
+}
+
+CPlayerToolBar::~CPlayerToolBar()
+{
+}
+
+BOOL CPlayerToolBar::Create(CWnd* pParentWnd)
+{
+ if(!__super::CreateEx(pParentWnd,
+ TBSTYLE_FLAT|TBSTYLE_TRANSPARENT|TBSTYLE_AUTOSIZE,
+ WS_CHILD|WS_VISIBLE|CBRS_ALIGN_BOTTOM|CBRS_TOOLTIPS, CRect(2,2,0,3))
+ || !LoadToolBar(IDB_PLAYERTOOLBAR))
+ return FALSE;
+
+ GetToolBarCtrl().SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS);
+
+ CToolBarCtrl& tb = GetToolBarCtrl();
+ tb.DeleteButton(tb.GetButtonCount()-1);
+ tb.DeleteButton(tb.GetButtonCount()-1);
+
+ SetMute(AfxGetAppSettings().fMute);
+
+ UINT styles[] =
+ {
+ TBBS_CHECKGROUP, TBBS_CHECKGROUP, TBBS_CHECKGROUP,
+ TBBS_SEPARATOR,
+ TBBS_BUTTON, TBBS_BUTTON, TBBS_BUTTON, TBBS_BUTTON,
+ TBBS_SEPARATOR,
+ TBBS_BUTTON/*|TBSTYLE_DROPDOWN*/,
+ TBBS_SEPARATOR,
+ TBBS_SEPARATOR,
+ TBBS_CHECKBOX,
+ /*TBBS_SEPARATOR,*/
+ };
+
+ for(int i = 0; i < countof(styles); i++)
+ SetButtonStyle(i, styles[i]|TBBS_DISABLED);
+
+ m_volctrl.Create(this);
+
+ if(AfxGetAppSettings().fDisabeXPToolbars)
+ {
+ if(HMODULE h = LoadLibrary(_T("uxtheme.dll")))
+ {
+ SetWindowThemeFunct f = (SetWindowThemeFunct)GetProcAddress(h, "SetWindowTheme");
+ if(f) f(m_hWnd, L" ", L" ");
+ FreeLibrary(h);
+ }
+ }
+
+ return TRUE;
+}
+
+BOOL CPlayerToolBar::PreCreateWindow(CREATESTRUCT& cs)
+{
+ if(!__super::PreCreateWindow(cs))
+ return FALSE;
+
+ m_dwStyle &= ~CBRS_BORDER_TOP;
+ m_dwStyle &= ~CBRS_BORDER_BOTTOM;
+// m_dwStyle |= CBRS_SIZE_FIXED;
+
+ return TRUE;
+}
+
+void CPlayerToolBar::ArrangeControls()
+{
+ if(!::IsWindow(m_volctrl.m_hWnd)) return;
+
+ CRect r;
+ GetClientRect(&r);
+
+ CRect br = GetBorders();
+
+ CRect r10;
+ GetItemRect(10, &r10);
+
+ CRect vr;
+ m_volctrl.GetClientRect(&vr);
+ CRect vr2(r.right+br.right-60, r.top-1, r.right+br.right+6, r.bottom);
+ m_volctrl.MoveWindow(vr2);
+
+ UINT nID;
+ UINT nStyle;
+ int iImage;
+ GetButtonInfo(12, nID, nStyle, iImage);
+ SetButtonInfo(11, GetItemID(11), TBBS_SEPARATOR, vr2.left - iImage - r10.right - 11);
+}
+
+void CPlayerToolBar::SetMute(bool fMute)
+{
+ CToolBarCtrl& tb = GetToolBarCtrl();
+ TBBUTTONINFO bi;
+ bi.cbSize = sizeof(bi);
+ bi.dwMask = TBIF_IMAGE;
+ bi.iImage = fMute?13:12;
+ tb.SetButtonInfo(ID_VOLUME_MUTE, &bi);
+
+ AfxGetAppSettings().fMute = fMute;
+}
+
+bool CPlayerToolBar::IsMuted()
+{
+ CToolBarCtrl& tb = GetToolBarCtrl();
+ TBBUTTONINFO bi;
+ bi.cbSize = sizeof(bi);
+ bi.dwMask = TBIF_IMAGE;
+ tb.GetButtonInfo(ID_VOLUME_MUTE, &bi);
+ return(bi.iImage==13);
+}
+
+int CPlayerToolBar::GetVolume()
+{
+ int volume = m_volctrl.GetPos();
+ volume = (int)((log10(1.0*volume)-2)*5000);
+ volume = max(min(volume, 0), -10000);
+ return(IsMuted() ? -10000 : volume);
+}
+
+void CPlayerToolBar::SetVolume(int volume)
+{
+/*
+ volume = (int)pow(10, ((double)volume)/5000+2);
+ volume = max(min(volume, 100), 1);
+*/
+ m_volctrl.SetPosInternal(volume);
+}
+
+BEGIN_MESSAGE_MAP(CPlayerToolBar, CToolBar)
+ ON_WM_PAINT()
+ ON_WM_SIZE()
+ ON_MESSAGE_VOID(WM_INITIALUPDATE, OnInitialUpdate)
+ ON_COMMAND_EX(ID_VOLUME_MUTE, OnVolumeMute)
+ ON_UPDATE_COMMAND_UI(ID_VOLUME_MUTE, OnUpdateVolumeMute)
+ ON_COMMAND_EX(ID_VOLUME_UP, OnVolumeUp)
+ ON_COMMAND_EX(ID_VOLUME_DOWN, OnVolumeDown)
+ ON_WM_NCPAINT()
+ ON_WM_LBUTTONDOWN()
+END_MESSAGE_MAP()
+
+// CPlayerToolBar message handlers
+
+void CPlayerToolBar::OnPaint()
+{
+ if(m_bDelayedButtonLayout)
+ Layout();
+
+ CPaintDC dc(this); // device context for painting
+
+ DefWindowProc(WM_PAINT, WPARAM(dc.m_hDC), 0);
+
+ {
+ UINT nID;
+ UINT nStyle = 0;
+ int iImage = 0;
+ GetButtonInfo(11, nID, nStyle, iImage);
+ CRect ItemRect;
+ GetItemRect(11, ItemRect);
+ dc.FillSolidRect(ItemRect, GetSysColor(COLOR_BTNFACE));
+ }
+}
+
+void CPlayerToolBar::OnSize(UINT nType, int cx, int cy)
+{
+ __super::OnSize(nType, cx, cy);
+
+ ArrangeControls();
+}
+
+void CPlayerToolBar::OnInitialUpdate()
+{
+ ArrangeControls();
+}
+
+BOOL CPlayerToolBar::OnVolumeMute(UINT nID)
+{
+ SetMute(!IsMuted());
+ return FALSE;
+}
+
+void CPlayerToolBar::OnUpdateVolumeMute(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(true);
+ pCmdUI->SetCheck(IsMuted());
+}
+
+BOOL CPlayerToolBar::OnVolumeUp(UINT nID)
+{
+ m_volctrl.IncreaseVolume();
+ return FALSE;
+}
+
+BOOL CPlayerToolBar::OnVolumeDown(UINT nID)
+{
+ m_volctrl.DecreaseVolume();
+ return FALSE;
+}
+
+void CPlayerToolBar::OnNcPaint() // when using XP styles the NC area isn't drawn for our toolbar...
+{
+ CRect wr, cr;
+
+ CWindowDC dc(this);
+ GetClientRect(&cr);
+ ClientToScreen(&cr);
+ GetWindowRect(&wr);
+ cr.OffsetRect(-wr.left, -wr.top);
+ wr.OffsetRect(-wr.left, -wr.top);
+ dc.ExcludeClipRect(&cr);
+ dc.FillSolidRect(wr, GetSysColor(COLOR_BTNFACE));
+
+ // Do not call CToolBar::OnNcPaint() for painting messages
+}
+
+void CPlayerToolBar::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ for(int i = 0, j = GetToolBarCtrl().GetButtonCount(); i < j; i++)
+ {
+ if(GetButtonStyle(i)&(TBBS_SEPARATOR|TBBS_DISABLED))
+ continue;
+
+ CRect r;
+ GetItemRect(i, r);
+ if(r.PtInRect(point))
+ {
+ __super::OnLButtonDown(nFlags, point);
+ return;
+ }
+ }
+
+ CMainFrame* pFrame = ((CMainFrame*)GetParentFrame());
+ if(!pFrame->m_fFullScreen)
+ {
+ MapWindowPoints(pFrame, &point, 1);
+ pFrame->PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
+ }
+}
diff --git a/src/apps/mplayerc/PlayerToolBar.h b/src/apps/mplayerc/PlayerToolBar.h
new file mode 100644
index 000000000..a0b01800a
--- /dev/null
+++ b/src/apps/mplayerc/PlayerToolBar.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "VolumeCtrl.h"
+
+// CPlayerToolBar
+
+class CPlayerToolBar : public CToolBar
+{
+ DECLARE_DYNAMIC(CPlayerToolBar)
+
+private:
+ bool IsMuted();
+ void SetMute(bool fMute = true);
+
+public:
+ CPlayerToolBar();
+ virtual ~CPlayerToolBar();
+
+ int GetVolume();
+ void SetVolume(int volume);
+ __declspec(property(get=GetVolume, put=SetVolume)) int Volume;
+
+ void ArrangeControls();
+
+ CVolumeCtrl m_volctrl;
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CPlayerToolBar)
+ virtual BOOL Create(CWnd* pParentWnd);
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ //}}AFX_VIRTUAL
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CPlayerToolBar)
+ afx_msg void OnPaint();
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnInitialUpdate();
+ afx_msg BOOL OnVolumeMute(UINT nID);
+ afx_msg void OnUpdateVolumeMute(CCmdUI* pCmdUI);
+ afx_msg BOOL OnVolumeUp(UINT nID);
+ afx_msg BOOL OnVolumeDown(UINT nID);
+ afx_msg void OnNcPaint();
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/src/apps/mplayerc/Playlist.cpp b/src/apps/mplayerc/Playlist.cpp
new file mode 100644
index 000000000..1a6dd1bdd
--- /dev/null
+++ b/src/apps/mplayerc/Playlist.cpp
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "playlist.h"
+
+//
+// CPlaylistItem
+//
+
+UINT CPlaylistItem::m_globalid = 0;
+
+CPlaylistItem::CPlaylistItem()
+ : m_type(file)
+ , m_fInvalid(false)
+ , m_duration(0)
+ , m_vinput(-1)
+ , m_vchannel(-1)
+ , m_ainput(-1)
+{
+ m_id = m_globalid++;
+}
+
+CPlaylistItem::~CPlaylistItem()
+{
+}
+
+CPlaylistItem::CPlaylistItem(const CPlaylistItem& pli)
+{
+ *this = pli;
+}
+
+CPlaylistItem& CPlaylistItem::operator = (const CPlaylistItem& pli)
+{
+ m_id = pli.m_id;
+ m_label = pli.m_label;
+ m_fns.RemoveAll();
+ m_fns.AddTailList(&pli.m_fns);
+ m_subs.RemoveAll();
+ m_subs.AddTailList(&pli.m_subs);
+ m_type = pli.m_type;
+ m_fInvalid = pli.m_fInvalid;
+ m_duration = pli.m_duration;
+ m_vinput = pli.m_vinput;
+ m_vchannel = pli.m_vchannel;
+ m_ainput = pli.m_ainput;
+ return(*this);
+}
+
+POSITION CPlaylistItem::FindFile(CString path)
+{
+ POSITION pos = m_fns.GetHeadPosition();
+ while(pos && !m_fns.GetAt(pos).CompareNoCase(path)) m_fns.GetNext(pos);
+ return(NULL);
+}
+
+static CString StripPath(CString path)
+{
+ CString p = path;
+ p.Replace('\\', '/');
+ p = p.Mid(p.ReverseFind('/')+1);
+ return(p.IsEmpty() ? path : p);
+}
+
+CString CPlaylistItem::GetLabel(int i)
+{
+ CString str;
+
+ if(i == 0)
+ {
+ if(!m_label.IsEmpty()) str = m_label;
+ else if(!m_fns.IsEmpty()) str = StripPath(m_fns.GetHead());
+ }
+ else if(i == 1)
+ {
+ if(m_fInvalid) return _T("Invalid");
+
+ if(m_type == file)
+ {
+ REFERENCE_TIME rt = m_duration;
+
+ if(rt > 0)
+ {
+ rt /= 10000000;
+ int ss = int(rt%60);
+ rt /= 60;
+ int mm = int(rt%60);
+ rt /= 60;
+ int hh = int(rt);
+
+ str.Format(_T("%02d:%02d:%02d"), hh, mm, ss);
+ }
+ }
+ else if(m_type == device)
+ {
+ // TODO
+ }
+
+ }
+
+ return str;
+}
+
+//
+// CPlaylist
+//
+
+CPlaylist::CPlaylist()
+ : m_pos(NULL)
+{
+}
+
+CPlaylist::~CPlaylist()
+{
+}
+
+void CPlaylist::RemoveAll()
+{
+ __super::RemoveAll();
+ m_pos = NULL;
+}
+
+bool CPlaylist::RemoveAt(POSITION pos)
+{
+ if(pos)
+ {
+ __super::RemoveAt(pos);
+ if(m_pos == pos) {m_pos = NULL; return(true);}
+ }
+
+ return(false);
+}
+
+typedef struct {UINT n; POSITION pos;} plsort_t;
+
+static int compare(const void* arg1, const void* arg2)
+{
+ UINT a1 = ((plsort_t*)arg1)->n;
+ UINT a2 = ((plsort_t*)arg2)->n;
+ return a1 > a2 ? 1 : a1 < a2 ? -1 : 0;
+}
+
+typedef struct {LPCTSTR str; POSITION pos;} plsort2_t;
+
+int compare2(const void* arg1, const void* arg2)
+{
+ return _tcsicmp(((plsort2_t*)arg1)->str, ((plsort2_t*)arg2)->str);
+}
+
+void CPlaylist::SortById()
+{
+ CAtlArray<plsort_t> a;
+ a.SetCount(GetCount());
+ POSITION pos = GetHeadPosition();
+ for(int i = 0; pos; i++, GetNext(pos))
+ a[i].n = GetAt(pos).m_id, a[i].pos = pos;
+ qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare);
+ for(int i = 0; i < a.GetCount(); i++)
+ {
+ AddTail(GetAt(a[i].pos));
+ __super::RemoveAt(a[i].pos);
+ if(m_pos == a[i].pos) m_pos = GetTailPosition();
+ }
+}
+
+void CPlaylist::SortByName()
+{
+ CAtlArray<plsort2_t> a;
+ a.SetCount(GetCount());
+ POSITION pos = GetHeadPosition();
+ for(int i = 0; pos; i++, GetNext(pos))
+ {
+ CString& fn = GetAt(pos).m_fns.GetHead();
+ a[i].str = (LPCTSTR)fn + max(fn.ReverseFind('/'), fn.ReverseFind('\\')) + 1;
+ a[i].pos = pos;
+ }
+ qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2);
+ for(int i = 0; i < a.GetCount(); i++)
+ {
+ AddTail(GetAt(a[i].pos));
+ __super::RemoveAt(a[i].pos);
+ if(m_pos == a[i].pos) m_pos = GetTailPosition();
+ }
+}
+
+void CPlaylist::SortByPath()
+{
+ CAtlArray<plsort2_t> a;
+ a.SetCount(GetCount());
+ POSITION pos = GetHeadPosition();
+ for(int i = 0; pos; i++, GetNext(pos))
+ a[i].str = GetAt(pos).m_fns.GetHead(), a[i].pos = pos;
+ qsort(a.GetData(), a.GetCount(), sizeof(plsort2_t), compare2);
+ for(int i = 0; i < a.GetCount(); i++)
+ {
+ AddTail(GetAt(a[i].pos));
+ __super::RemoveAt(a[i].pos);
+ if(m_pos == a[i].pos) m_pos = GetTailPosition();
+ }
+}
+
+void CPlaylist::Randomize()
+{
+ CAtlArray<plsort_t> a;
+ a.SetCount(GetCount());
+ srand((unsigned int)time(NULL));
+ POSITION pos = GetHeadPosition();
+ for(int i = 0; pos; i++, GetNext(pos))
+ a[i].n = rand(), a[i].pos = pos;
+ qsort(a.GetData(), a.GetCount(), sizeof(plsort_t), compare);
+ CList<CPlaylistItem> pl;
+ for(int i = 0; i < a.GetCount(); i++)
+ {
+ AddTail(GetAt(a[i].pos));
+ __super::RemoveAt(a[i].pos);
+ if(m_pos == a[i].pos)
+ m_pos = GetTailPosition();
+ }
+}
+
+POSITION CPlaylist::GetPos()
+{
+ return(m_pos);
+}
+
+void CPlaylist::SetPos(POSITION pos)
+{
+ m_pos = pos;
+}
+
+CPlaylistItem& CPlaylist::GetNextWrap(POSITION& pos)
+{
+ GetNext(pos);
+
+ if(!pos)
+ {
+ // FIXME: add param: , bool fShuffle
+ if(GetCount() > 2 && AfxGetApp()->GetProfileInt(ResStr(IDS_R_SETTINGS), _T("ShufflePlaylistItems"), FALSE))
+ Randomize();
+
+ pos = GetHeadPosition();
+ }
+
+ return(GetAt(pos));
+}
+
+CPlaylistItem& CPlaylist::GetPrevWrap(POSITION& pos)
+{
+ GetPrev(pos);
+ if(!pos) pos = GetTailPosition();
+ return(GetAt(pos));
+}
+
diff --git a/src/apps/mplayerc/Playlist.h b/src/apps/mplayerc/Playlist.h
new file mode 100644
index 000000000..5aa7045ba
--- /dev/null
+++ b/src/apps/mplayerc/Playlist.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <afxcoll.h>
+
+class CPlaylistItem
+{
+ static UINT m_globalid;
+
+public:
+ UINT m_id;
+ CString m_label;
+ CAtlList<CString> m_fns;
+ CAtlList<CString> m_subs;
+ enum type_t {file, device} m_type;
+ REFERENCE_TIME m_duration;
+ int m_vinput, m_vchannel;
+ int m_ainput;
+ long m_country;
+
+ bool m_fInvalid;
+
+public:
+ CPlaylistItem();
+ virtual ~CPlaylistItem();
+
+ CPlaylistItem(const CPlaylistItem& pli);
+ CPlaylistItem& operator = (const CPlaylistItem& pli);
+
+ POSITION FindFile(CString path);
+
+ CString GetLabel(int i = 0);
+};
+
+class CPlaylist : public CList<CPlaylistItem>
+{
+protected:
+ POSITION m_pos;
+
+public:
+ CPlaylist();
+ virtual ~CPlaylist();
+
+ void RemoveAll();
+ bool RemoveAt(POSITION pos);
+
+ void SortById(), SortByName(), SortByPath(), Randomize();
+
+ POSITION GetPos();
+ void SetPos(POSITION pos);
+ CPlaylistItem& GetNextWrap(POSITION& pos);
+ CPlaylistItem& GetPrevWrap(POSITION& pos);
+};
diff --git a/src/apps/mplayerc/PnSPresetsDlg.cpp b/src/apps/mplayerc/PnSPresetsDlg.cpp
new file mode 100644
index 000000000..ae203595c
--- /dev/null
+++ b/src/apps/mplayerc/PnSPresetsDlg.cpp
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// PnSPresetsDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PnSPresetsDlg.h"
+
+
+// CPnSPresetsDlg dialog
+
+IMPLEMENT_DYNAMIC(CPnSPresetsDlg, CCmdUIDialog)
+CPnSPresetsDlg::CPnSPresetsDlg(CWnd* pParent /*=NULL*/)
+ : CCmdUIDialog(CPnSPresetsDlg::IDD, pParent)
+ , m_label(_T(""))
+{
+}
+
+CPnSPresetsDlg::~CPnSPresetsDlg()
+{
+}
+
+void CPnSPresetsDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_EDIT2, m_PosX);
+ DDX_Control(pDX, IDC_EDIT3, m_PosY);
+ DDX_Control(pDX, IDC_EDIT4, m_ZoomX);
+ DDX_Control(pDX, IDC_EDIT5, m_ZoomY);
+ DDX_Text(pDX, IDC_EDIT1, m_label);
+ DDX_Control(pDX, IDC_LIST1, m_list);
+}
+
+BOOL CPnSPresetsDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ for(int i = 0, j = m_pnspresets.GetCount(); i < j; i++)
+ {
+ CString label;
+ double PosX, PosY, ZoomX, ZoomY;
+ StringToParams(m_pnspresets[i], label, PosX, PosY, ZoomX, ZoomY);
+
+ m_list.AddString(label);
+
+ if(i == 0)
+ {
+ m_list.SetCurSel(0);
+ OnLbnSelchangeList1();
+ }
+ }
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+
+void CPnSPresetsDlg::StringToParams(CString str, CString& label, double& PosX, double& PosY, double& ZoomX, double& ZoomY)
+{
+ int i = 0, j = 0;
+
+ for(CString token = str.Tokenize(_T(","), i); !token.IsEmpty(); token = str.Tokenize(_T(","), i), j++)
+ {
+ if(j == 0)
+ {
+ label = token;
+ }
+ else
+ {
+ float f = 0;
+ if(_stscanf(token, _T("%f"), &f) != 1) continue;
+
+ switch(j)
+ {
+ case 1: PosX = f; break;
+ case 2: PosY = f; break;
+ case 3: ZoomX = f; break;
+ case 4: ZoomY = f; break;
+ default: break;
+ }
+ }
+ }
+}
+
+CString CPnSPresetsDlg::ParamsToString(CString label, double PosX, double PosY, double ZoomX, double ZoomY)
+{
+ CString str;
+ str.Format(_T("%s,%.3f,%.3f,%.3f,%.3f"), label, PosX, PosY, ZoomX, ZoomY);
+ return(str);
+}
+
+BEGIN_MESSAGE_MAP(CPnSPresetsDlg, CCmdUIDialog)
+ ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateButton2)
+ ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton6)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON3, OnUpdateButton6)
+ ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton9)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON4, OnUpdateButton9)
+ ON_BN_CLICKED(IDC_BUTTON5, OnBnClickedButton10)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON5, OnUpdateButton10)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateButton1)
+END_MESSAGE_MAP()
+
+
+// CPnSPresetsDlg message handlers
+void CPnSPresetsDlg::OnLbnSelchangeList1()
+{
+ int i = m_list.GetCurSel();
+ if(i >= 0 && i < m_pnspresets.GetCount())
+ {
+ double PosX, PosY, ZoomX, ZoomY;
+ StringToParams(m_pnspresets[i], m_label, PosX, PosY, ZoomX, ZoomY);
+ m_PosX = PosX; m_PosY = PosY;
+ m_ZoomX = ZoomX; m_ZoomY = ZoomY;
+ }
+ else
+ {
+ m_label.Empty();
+ m_PosX.SetWindowText(_T(""));
+ m_PosY.SetWindowText(_T(""));
+ m_ZoomX.SetWindowText(_T(""));
+ m_ZoomY.SetWindowText(_T(""));
+ }
+
+ UpdateData(FALSE);
+}
+
+void CPnSPresetsDlg::OnBnClickedButton2() // new
+{
+ m_pnspresets.Add(_T("New,0.5,0.5,1.0,1.0"));
+ m_list.SetCurSel(m_list.AddString(_T("New")));
+ OnLbnSelchangeList1();
+}
+
+void CPnSPresetsDlg::OnUpdateButton2(CCmdUI* pCmdUI)
+{
+ CString str;
+ int len = m_list.GetCount();
+ if(len > 0) m_list.GetText(len-1, str);
+ pCmdUI->Enable(str != _T("New"));
+}
+
+void CPnSPresetsDlg::OnBnClickedButton6() // del
+{
+ int i = m_list.GetCurSel();
+ m_list.DeleteString(i);
+ m_pnspresets.RemoveAt(i);
+ if(i == m_list.GetCount()) i--;
+ m_list.SetCurSel(i);
+ OnLbnSelchangeList1();
+}
+
+void CPnSPresetsDlg::OnUpdateButton6(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_list.GetCurSel() >= 0);
+}
+
+void CPnSPresetsDlg::OnBnClickedButton9() // up
+{
+ int i = m_list.GetCurSel();
+ CString str, str2;
+ m_list.GetText(i, str);
+ str2 = m_pnspresets.GetAt(i);
+ m_list.DeleteString(i);
+ m_pnspresets.RemoveAt(i);
+ i--;
+ m_list.InsertString(i, str);
+ m_pnspresets.InsertAt(i, str2);
+ m_list.SetCurSel(i);
+}
+
+void CPnSPresetsDlg::OnUpdateButton9(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_list.GetCurSel() > 0 && m_list.GetCurSel() < m_list.GetCount());
+}
+
+void CPnSPresetsDlg::OnBnClickedButton10() // down
+{
+ int i = m_list.GetCurSel();
+ CString str, str2;
+ m_list.GetText(i, str);
+ str2 = m_pnspresets.GetAt(i);
+ m_list.DeleteString(i);
+ m_pnspresets.RemoveAt(i);
+ i++;
+ m_list.InsertString(i, str);
+ m_pnspresets.InsertAt(i, str2);
+ m_list.SetCurSel(i);
+}
+
+void CPnSPresetsDlg::OnUpdateButton10(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(m_list.GetCurSel() >= 0 && m_list.GetCurSel() < m_list.GetCount()-1);
+}
+
+void CPnSPresetsDlg::OnBnClickedButton1() // set
+{
+ int i = m_list.GetCurSel();
+ UpdateData();
+ if(m_label.Remove(',') > 0)
+ UpdateData(FALSE);
+ m_pnspresets[i] = ParamsToString(m_label, m_PosX, m_PosY, m_ZoomX, m_ZoomY);
+ m_list.DeleteString(i);
+ m_list.InsertString(i, m_label);
+ m_list.SetCurSel(i);
+}
+
+void CPnSPresetsDlg::OnUpdateButton1(CCmdUI* pCmdUI)
+{
+ UpdateData();
+ pCmdUI->Enable(m_list.GetCurSel() >= 0
+ && !m_label.IsEmpty() && m_label.Find(',') < 0
+ && m_PosX >= 0 && m_PosX <= 1
+ && m_PosY >= 0 && m_PosY <= 1
+ && m_ZoomX >= 0.2 && m_ZoomX <= 3.0
+ && m_ZoomY >= 0.2 && m_ZoomY <= 3.0);
+}
+
+void CPnSPresetsDlg::OnOK()
+{
+ if(m_list.GetCurSel() >= 0)
+ OnBnClickedButton1();
+
+ __super::OnOK();
+}
diff --git a/src/apps/mplayerc/PnSPresetsDlg.h b/src/apps/mplayerc/PnSPresetsDlg.h
new file mode 100644
index 000000000..8e89d2de2
--- /dev/null
+++ b/src/apps/mplayerc/PnSPresetsDlg.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "FloatEdit.h"
+
+// CPnSPresetsDlg dialog
+
+class CPnSPresetsDlg : public CCmdUIDialog
+{
+ DECLARE_DYNAMIC(CPnSPresetsDlg)
+
+private:
+ void StringToParams(CString str, CString& label, double& PosX, double& PosY, double& ZoomX, double& ZoomY);
+ CString ParamsToString(CString label, double PosX, double PosY, double ZoomX, double ZoomY);
+
+public:
+ CPnSPresetsDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~CPnSPresetsDlg();
+
+ CStringArray m_pnspresets;
+
+// Dialog Data
+ enum { IDD = IDD_PNSPRESET_DLG };
+ CFloatEdit m_PosX;
+ CFloatEdit m_PosY;
+ CFloatEdit m_ZoomX;
+ CFloatEdit m_ZoomY;
+ CString m_label;
+ CListBox m_list;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnLbnSelchangeList1();
+ afx_msg void OnBnClickedButton2();
+ afx_msg void OnUpdateButton2(CCmdUI* pCmdUI);
+ afx_msg void OnBnClickedButton6();
+ afx_msg void OnUpdateButton6(CCmdUI* pCmdUI);
+ afx_msg void OnBnClickedButton9();
+ afx_msg void OnUpdateButton9(CCmdUI* pCmdUI);
+ afx_msg void OnBnClickedButton10();
+ afx_msg void OnUpdateButton10(CCmdUI* pCmdUI);
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnUpdateButton1(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/QuicktimeGraph.cpp b/src/apps/mplayerc/QuicktimeGraph.cpp
new file mode 100644
index 000000000..047e0e53c
--- /dev/null
+++ b/src/apps/mplayerc/QuicktimeGraph.cpp
@@ -0,0 +1,652 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <math.h>
+#include "QuicktimeGraph.h"
+#include "IQTVideoSurface.h"
+#include "mplayerc.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+//
+// CQuicktimeGraph
+//
+
+#pragma warning(disable:4355) // 'this' : used in base member initializer list
+
+using namespace QT;
+
+CQuicktimeGraph::CQuicktimeGraph(HWND hWndParent, HRESULT& hr)
+ : CBaseGraph()
+ , m_wndDestFrame(this)
+ , m_fQtInitialized(false)
+{
+ hr = S_OK;
+
+ DWORD dwStyle = WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ if(s.iQTVideoRendererType == VIDRNDT_QT_DX7)
+ {
+ if(SUCCEEDED(CreateAP7(CLSID_QT7AllocatorPresenter, hWndParent, &m_pQTAP)))
+ dwStyle &= ~WS_VISIBLE;
+ }
+ else if(s.iQTVideoRendererType == VIDRNDT_QT_DX9)
+ {
+ if(SUCCEEDED(CreateAP9(CLSID_QT9AllocatorPresenter, hWndParent, &m_pQTAP)))
+ dwStyle &= ~WS_VISIBLE;
+ }
+
+ m_fQtInitialized = false;
+ if(InitializeQTML(0) != 0) {hr = E_FAIL; return;}
+ if(EnterMovies() != 0) {TerminateQTML(); hr = E_FAIL; return;}
+ m_fQtInitialized = true;
+
+ if(!m_wndWindowFrame.CreateEx(WS_EX_NOPARENTNOTIFY, NULL, NULL, dwStyle, CRect(0, 0, 0, 0), CWnd::FromHandle(hWndParent), 0))
+ {
+ hr = E_FAIL;
+ return;
+ }
+
+ if(!m_wndDestFrame.Create(NULL, NULL, dwStyle, CRect(0, 0, 0, 0), &m_wndWindowFrame, 0))
+ {
+ hr = E_FAIL;
+ return;
+ }
+}
+
+CQuicktimeGraph::~CQuicktimeGraph()
+{
+ m_wndDestFrame.DestroyWindow();
+ m_wndWindowFrame.DestroyWindow();
+
+ if(m_fQtInitialized)
+ {
+ ExitMovies();
+ TerminateQTML();
+ }
+}
+
+STDMETHODIMP CQuicktimeGraph::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IVideoFrameStep)
+ (m_pQTAP && (riid == __uuidof(ISubPicAllocatorPresenter) || riid == __uuidof(IQTVideoSurface))) ? m_pQTAP->QueryInterface(riid, ppv) :
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IGraphBuilder
+STDMETHODIMP CQuicktimeGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList)
+{
+ bool fRet = m_wndDestFrame.OpenMovie(CString(lpcwstrFile));
+
+ if(fRet)
+ {
+ for(int i = 1, cnt = GetMovieTrackCount(m_wndDestFrame.theMovie); i <= cnt; i++)
+ {
+ Track aTrack = GetMovieIndTrack(m_wndDestFrame.theMovie, i);
+ Media aMedia = GetTrackMedia(aTrack);
+
+ OSType aTrackType;
+ GetMediaHandlerDescription(aMedia, &aTrackType, 0, 0);
+ if(aTrackType == SoundMediaType)
+ {
+ SampleDescriptionHandle aDesc = (SampleDescriptionHandle)NewHandle(sizeof(aDesc));
+ GetMediaSampleDescription(aMedia, 1, aDesc);
+ if(GetMoviesError() == noErr)
+ {
+ SoundDescription& desc = **(SoundDescriptionHandle)aDesc;
+ NotifyEvent(EC_BG_AUDIO_CHANGED, desc.numChannels, 0);
+ i = cnt;
+ }
+ DisposeHandle((Handle)aDesc);
+ }
+ }
+ }
+
+ return fRet ? S_OK : E_FAIL;
+}
+
+// IMediaControl
+STDMETHODIMP CQuicktimeGraph::Run()
+{
+ m_wndDestFrame.Run();
+ return S_OK;
+}
+STDMETHODIMP CQuicktimeGraph::Pause()
+{
+ m_wndDestFrame.Pause();
+ return S_OK;
+}
+STDMETHODIMP CQuicktimeGraph::Stop()
+{
+ m_wndDestFrame.Stop();
+ return S_OK;
+}
+STDMETHODIMP CQuicktimeGraph::GetState(LONG msTimeout, OAFilterState* pfs)
+{
+ // TODO: this seems to deadlock when opening from the net
+ return pfs ? *pfs = m_wndDestFrame.GetState(), S_OK : E_POINTER;
+}
+
+// IMediaSeeking
+STDMETHODIMP CQuicktimeGraph::GetDuration(LONGLONG* pDuration)
+{
+ CheckPointer(pDuration, E_POINTER);
+
+ *pDuration = 0;
+
+ if(!m_wndDestFrame.theMovie) return E_UNEXPECTED;
+
+ TimeScale ts = GetMovieTimeScale(m_wndDestFrame.theMovie);
+ if(ts == 0) return E_FAIL;
+
+ *pDuration = 10000i64*GetMovieDuration(m_wndDestFrame.theMovie)/ts*1000;
+
+ return S_OK;
+}
+STDMETHODIMP CQuicktimeGraph::GetCurrentPosition(LONGLONG* pCurrent)
+{
+ CheckPointer(pCurrent, E_POINTER);
+
+ *pCurrent = 0;
+
+ if(!m_wndDestFrame.theMovie) return E_UNEXPECTED;
+
+ TimeScale ts = GetMovieTimeScale(m_wndDestFrame.theMovie);
+ if(ts == 0) return E_FAIL;
+
+ TimeRecord tr;
+ *pCurrent = 10000i64*GetMovieTime(m_wndDestFrame.theMovie, &tr)/ts*1000;
+
+ return S_OK;
+}
+STDMETHODIMP CQuicktimeGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
+{
+ CheckPointer(pCurrent, E_POINTER);
+
+ if(!(dwCurrentFlags&AM_SEEKING_AbsolutePositioning)) return E_INVALIDARG;
+
+ if(!m_wndDestFrame.theMovie) return E_UNEXPECTED;
+
+ TimeScale ts = GetMovieTimeScale(m_wndDestFrame.theMovie);
+ if(ts == 0) return E_FAIL;
+
+ SetMovieTimeValue(m_wndDestFrame.theMovie, (TimeValue)(*pCurrent*ts/1000/10000i64));
+
+ if(!m_wndDestFrame.theMC)
+ {
+ UpdateMovie(m_wndDestFrame.theMovie);
+ MoviesTask(m_wndDestFrame.theMovie, 0L);
+ }
+
+ return S_OK;
+}
+STDMETHODIMP CQuicktimeGraph::SetRate(double dRate)
+{
+ return m_wndDestFrame.theMovie ? SetMovieRate(m_wndDestFrame.theMovie, (Fixed)(dRate * 0x10000)), S_OK : E_UNEXPECTED;
+}
+STDMETHODIMP CQuicktimeGraph::GetRate(double* pdRate)
+{
+ CheckPointer(pdRate, E_POINTER);
+ *pdRate = 1.0;
+ return m_wndDestFrame.theMovie ? *pdRate = (double)GetMovieRate(m_wndDestFrame.theMovie) / 0x10000, S_OK : E_UNEXPECTED;
+}
+
+// IVideoWindow
+STDMETHODIMP CQuicktimeGraph::SetWindowPosition(long Left, long Top, long Width, long Height)
+{
+ if(IsWindow(m_wndWindowFrame.m_hWnd))
+ m_wndWindowFrame.MoveWindow(Left, Top, Width, Height);
+
+ return S_OK;
+}
+
+// IBasicVideo
+STDMETHODIMP CQuicktimeGraph::SetDestinationPosition(long Left, long Top, long Width, long Height)// {return E_NOTIMPL;}
+{
+ if(!m_pQTAP && IsWindow(m_wndDestFrame.m_hWnd))
+ {
+ m_wndDestFrame.MoveWindow(Left, Top, Width, Height);
+
+ if(m_wndDestFrame.theMC)
+ {
+ Rect bounds = {0,0,(short)Height,(short)Width};
+ MCPositionController(m_wndDestFrame.theMC, &bounds, NULL, mcTopLeftMovie|mcScaleMovieToFit);
+ }
+ }
+
+ return S_OK;
+}
+STDMETHODIMP CQuicktimeGraph::GetVideoSize(long* pWidth, long* pHeight)
+{
+ if(!pWidth || !pHeight) return E_POINTER;
+
+ *pWidth = m_wndDestFrame.m_size.cx;
+ *pHeight = m_wndDestFrame.m_size.cy;
+
+ return S_OK;
+}
+
+// IBasicAudio
+STDMETHODIMP CQuicktimeGraph::put_Volume(long lVolume)
+{
+ if(m_wndDestFrame.theMovie)
+ {
+ lVolume = (lVolume == -10000) ? 0 : (int)pow(10.0, (double)lVolume/4152.41 + 2.41);
+ SetMovieVolume(m_wndDestFrame.theMovie, (short)max(min(lVolume, 256), 0));
+ return S_OK;
+ }
+
+ return E_UNEXPECTED;
+}
+STDMETHODIMP CQuicktimeGraph::get_Volume(long* plVolume)
+{
+ CheckPointer(plVolume, E_POINTER);
+
+ if(m_wndDestFrame.theMovie)
+ {
+ long lVolume = (long)GetMovieVolume(m_wndDestFrame.theMovie);
+ *plVolume = (int)((log10(1.0*lVolume)-2.41)*4152.41);
+ *plVolume = max(min(*plVolume, 0), -10000);
+ return S_OK;
+ }
+
+ return E_UNEXPECTED;
+}
+
+// IVideoFrameStep
+STDMETHODIMP CQuicktimeGraph::Step(DWORD dwFrames, IUnknown* pStepObject)
+{
+ if(pStepObject) return E_INVALIDARG;
+ if(dwFrames == 0) return S_OK;
+ if(!m_wndDestFrame.theMovie) return E_UNEXPECTED;
+
+ // w/o m_wndDestFrame.theMC
+
+ OSType myTypes[] = {VisualMediaCharacteristic};
+ TimeValue myCurrTime = GetMovieTime(m_wndDestFrame.theMovie, NULL);
+ Fixed theRate = (int)dwFrames > 0 ? 0x00010000 : 0xffff0000;
+
+ for(int nSteps = abs((int)dwFrames); nSteps > 0; nSteps--)
+ {
+ TimeValue myNextTime;
+ GetMovieNextInterestingTime(m_wndDestFrame.theMovie, nextTimeStep, 1, myTypes, myCurrTime, theRate, &myNextTime, NULL);
+ if(GetMoviesError() != noErr) return E_FAIL;
+ myCurrTime = myNextTime;
+ }
+
+ if(myCurrTime >= 0 && myCurrTime < GetMovieDuration(m_wndDestFrame.theMovie))
+ {
+ SetMovieTimeValue(m_wndDestFrame.theMovie, myCurrTime);
+ if(GetMoviesError() != noErr) return E_FAIL;
+ // the rest is not needed when we also have m_wndDestFrame.theMC:
+ UpdateMovie(m_wndDestFrame.theMovie);
+ if(GetMoviesError() != noErr) return E_FAIL;
+ MoviesTask(m_wndDestFrame.theMovie, 0L);
+ }
+
+ NotifyEvent(EC_STEP_COMPLETE);
+
+ return S_OK;
+
+/*
+ // w/ m_wndDestFrame.theMC
+
+ short myStep = (short)(long)dwFrames;
+ return noErr == MCDoAction(m_wndDestFrame.theMC, mcActionStep, (Ptr)myStep)
+ ? NotifyEvent(EC_STEP_COMPLETE), S_OK : E_FAIL;
+*/
+}
+STDMETHODIMP CQuicktimeGraph::CanStep(long bMultiple, IUnknown* pStepObject)
+{
+ return m_wndDestFrame.theMovie ? S_OK : S_FALSE;
+}
+STDMETHODIMP CQuicktimeGraph::CancelStep()
+{
+ return E_NOTIMPL;
+}
+
+// IGraphEngine
+STDMETHODIMP_(engine_t) CQuicktimeGraph::GetEngine() {return QuickTime;}
+
+//
+// CQuicktimeWindow
+//
+
+CQuicktimeWindow::CQuicktimeWindow(CQuicktimeGraph* pGraph)
+ : m_pGraph(pGraph)
+ , theMovie(NULL)
+ , theMC(NULL)
+ , m_size(0, 0)
+ , m_idEndPoller(0)
+ , m_fs(State_Stopped)
+ , m_offscreenGWorld(NULL)
+{
+}
+
+void CQuicktimeWindow::ProcessMovieEvent(unsigned int message, unsigned int wParam, long lParam)
+{
+ if(message >= WM_MOUSEFIRST && message <= WM_MOUSELAST
+ || message >= WM_KEYFIRST && message <= WM_KEYLAST)
+ return;
+
+ // Convert the Windows event to a QTML event
+ MSG theMsg;
+ EventRecord macEvent;
+ LONG thePoints = GetMessagePos();
+
+ theMsg.hwnd = m_hWnd;
+ theMsg.message = message;
+ theMsg.wParam = wParam;
+ theMsg.lParam = lParam;
+ theMsg.time = GetMessageTime();
+ theMsg.pt.x = LOWORD(thePoints);
+ theMsg.pt.y = HIWORD(thePoints);
+
+ // tranlate a windows event to a mac event
+ WinEventToMacEvent(&theMsg, &macEvent);
+
+ // Pump messages as mac event
+ MCIsPlayerEvent(theMC, (const EventRecord*)&macEvent);
+}
+
+LRESULT CQuicktimeWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if(message == WM_ERASEBKGND)
+ {
+ LRESULT theResult = __super::WindowProc(message, wParam, lParam);
+ ProcessMovieEvent(message, wParam, lParam);
+ return theResult;
+ }
+ else
+ {
+ ProcessMovieEvent(message, wParam, lParam);
+ return __super::WindowProc(message, wParam, lParam);
+ }
+}
+
+OSErr CQuicktimeWindow::MyMovieDrawingCompleteProc(Movie theMovie, long refCon)
+{
+ CQuicktimeWindow* pQW = (CQuicktimeWindow*)refCon;
+ if(!pQW) return noErr;
+
+ CQuicktimeGraph* pGraph = pQW->m_pGraph;
+ if(!pGraph) return noErr;
+
+ if(CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)pGraph)
+ {
+ BITMAP bm;
+ pQW->m_bm.GetObject(sizeof(bm), &bm);
+ pQTVS->DoBlt(bm);
+ }
+ /*
+ else
+ {
+ pQW->Invalidate();
+ }*/
+
+ return(noErr);
+}
+
+bool CQuicktimeWindow::OpenMovie(CString fn)
+{
+ CloseMovie();
+
+ CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)m_pGraph;
+
+ if(!pQTVS)
+ {
+ // Set the port
+ SetGWorld((CGrafPtr)GetHWNDPort(m_hWnd), NULL);
+ }
+
+ if(fn.Find(_T("://")) > 0)
+ {
+ Handle myHandle = NULL;
+ Size mySize = fn.GetLength()+1;
+
+ if(!(myHandle = NewHandleClear(mySize)))
+ return(false);
+
+ BlockMove((LPSTR)(LPCSTR)CStringA(fn), *myHandle, mySize);
+
+ OSErr err = NewMovieFromDataRef(&theMovie, newMovieActive, NULL, myHandle, URLDataHandlerSubType);
+
+ DisposeHandle(myHandle);
+
+ if(err != noErr) return(false);
+ }
+ else
+ {
+ if(!(fn.GetLength() > 0 && fn.GetLength() < 255))
+ return(false);
+
+ CHAR buff[MAX_PATH] = {0, 0};
+#ifdef UNICODE
+ WideCharToMultiByte(GetACP(), 0, fn, -1, buff+1, MAX_PATH-1, 0, 0);
+#else
+ strcpy(buff+1, fn);
+#endif
+ buff[0] = strlen(buff+1);
+
+ // Make a FSSpec with a pascal string filename
+ FSSpec sfFile;
+ FSMakeFSSpec(0, 0L, (BYTE*)buff, &sfFile);
+
+ // Open the movie file
+ short movieResFile;
+ OSErr err = OpenMovieFile(&sfFile, &movieResFile, fsRdPerm);
+ if(err == noErr)
+ {
+ err = NewMovieFromFile(&theMovie, movieResFile, 0, 0, newMovieActive, 0);
+ CloseMovieFile(movieResFile);
+ }
+ if(err != noErr) return(false);
+ }
+
+ Rect rect;
+ GetMovieBox(theMovie, &rect);
+ MacOffsetRect(&rect, -rect.left, -rect.top);
+ SetMovieBox(theMovie, &rect);
+ m_size.SetSize(rect.right - rect.left, rect.bottom - rect.top);
+
+ Rect nrect;
+ GetMovieNaturalBoundsRect(theMovie, &nrect);
+
+ if(!pQTVS)
+ {
+ theMC = NewMovieController(theMovie, &rect, mcTopLeftMovie|mcNotVisible);
+ }
+ else if(m_size.cx > 0 && m_size.cy > 0)
+ {
+ SetMovieDrawingCompleteProc(theMovie,
+ movieDrawingCallWhenChanged,//|movieDrawingCallAlways,
+ MyMovieDrawingCompleteProc, (long)this);
+
+ if(CDC* pDC = GetDC())
+ {
+ m_dc.CreateCompatibleDC(pDC);
+ ReleaseDC(pDC);
+
+ struct
+ {
+ BITMAPINFOHEADER bmiHeader;
+ long bmiColors[256];
+ } bmi;
+
+ memset(&bmi, 0, sizeof(bmi));
+
+ int bpp = m_dc.GetDeviceCaps(BITSPIXEL);
+
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biCompression = BI_BITFIELDS/*BI_RGB*/;
+ bmi.bmiHeader.biWidth = m_size.cx;
+ bmi.bmiHeader.biHeight = -m_size.cy;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = 32/*bpp*/;
+
+ bmi.bmiColors[0] = /*bpp == 16 ? 0xf800 :*/ 0xff0000;
+ bmi.bmiColors[1] = /*bpp == 16 ? 0x07e0 :*/ 0x00ff00;
+ bmi.bmiColors[2] = /*bpp == 16 ? 0x001f :*/ 0x0000ff;
+
+ void* bits;
+ m_bm.Attach(CreateDIBSection(m_dc, (BITMAPINFO*)&bmi, DIB_RGB_COLORS, &bits, NULL, 0));
+
+ QDErr err = NewGWorldFromHBITMAP(&m_offscreenGWorld, NULL, NULL, 0, m_bm.m_hObject, m_dc.m_hDC);
+
+ SetMovieGWorld(theMovie, m_offscreenGWorld, GetGWorldDevice(m_offscreenGWorld));
+
+ BITMAP bm;
+ m_bm.GetObject(sizeof(bm), &bm);
+ pQTVS->BeginBlt(bm);
+ }
+ }
+
+ return(theMovie != NULL);
+}
+
+void CQuicktimeWindow::CloseMovie()
+{
+ if(theMC) DisposeMovieController(theMC), theMC = NULL;
+ if(theMovie) DisposeMovie(theMovie), theMovie = NULL;
+ m_size.SetSize(0, 0);
+ m_fs = State_Stopped;
+
+ if(m_offscreenGWorld) DisposeGWorld(m_offscreenGWorld), m_offscreenGWorld = NULL;
+ m_dc.DeleteDC();
+ m_bm.DeleteObject();
+}
+
+void CQuicktimeWindow::Run()
+{
+ if(theMovie)
+ {
+ StartMovie(theMovie);
+ if(!m_idEndPoller) m_idEndPoller = SetTimer(1, 10, NULL); // 10ms -> 100fps max
+ }
+
+ m_fs = State_Running;
+}
+
+void CQuicktimeWindow::Pause()
+{
+ if(theMovie)
+ {
+ StopMovie(theMovie);
+ if(m_idEndPoller) KillTimer(m_idEndPoller), m_idEndPoller = 0;
+ }
+
+ m_fs = State_Paused;
+}
+
+void CQuicktimeWindow::Stop()
+{
+ if(theMovie)
+ {
+ StopMovie(theMovie);
+ GoToBeginningOfMovie(theMovie);
+ if(m_idEndPoller) KillTimer(m_idEndPoller), m_idEndPoller = 0;
+ }
+
+ m_fs = State_Stopped;
+}
+
+FILTER_STATE CQuicktimeWindow::GetState()
+{
+ return m_fs;
+}
+
+BEGIN_MESSAGE_MAP(CQuicktimeWindow, CPlayerWindow)
+ ON_WM_CREATE()
+ ON_WM_DESTROY()
+ ON_WM_ERASEBKGND()
+ ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+int CQuicktimeWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if(__super::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)m_pGraph;
+
+ if(!pQTVS)
+ {
+ // Create GrafPort <-> HWND association
+ CreatePortAssociation(m_hWnd, NULL, 0);
+ }
+
+ return 0;
+}
+
+void CQuicktimeWindow::OnDestroy()
+{
+ CPlayerWindow::OnDestroy();
+
+ // close any movies before destroying PortAssocation
+ CloseMovie();
+
+ CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)m_pGraph;
+
+ if(!pQTVS)
+ {
+ // Destroy the view's GrafPort <-> HWND association
+ if(m_hWnd)
+ if(CGrafPtr windowPort = (CGrafPtr)GetHWNDPort(m_hWnd))
+ DestroyPortAssociation(windowPort);
+ }
+}
+
+BOOL CQuicktimeWindow::OnEraseBkgnd(CDC* pDC)
+{
+ return m_fs != State_Stopped && theMovie ? TRUE : __super::OnEraseBkgnd(pDC);
+}
+
+void CQuicktimeWindow::OnTimer(UINT nIDEvent)
+{
+ if(nIDEvent == m_idEndPoller && theMovie)
+ {
+ if(IsMovieDone(theMovie))
+ {
+ Pause();
+ m_pGraph->NotifyEvent(EC_COMPLETE);
+ }
+ else if(CComQIPtr<IQTVideoSurface> pQTVS = (IUnknown*)(INonDelegatingUnknown*)m_pGraph)
+ {
+ MoviesTask(theMovie, 0);
+/*
+ long duration = 0, scale = 1000;
+ OSErr err = QTGetTimeUntilNextTask(&duration, scale);
+
+ // err is 0 but still doesn't seem to work... returns duration=0 always
+ TRACE(_T("%d\n"), duration);
+ KillTimer(m_idEndPoller);
+ m_idEndPoller = SetTimer(m_idEndPoller, duration, NULL);
+*/
+ }
+ }
+
+ __super::OnTimer(nIDEvent);
+}
diff --git a/src/apps/mplayerc/QuicktimeGraph.h b/src/apps/mplayerc/QuicktimeGraph.h
new file mode 100644
index 000000000..222169c12
--- /dev/null
+++ b/src/apps/mplayerc/QuicktimeGraph.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "BaseGraph.h"
+#include "DX7AllocatorPresenter.h"
+#include "DX9AllocatorPresenter.h"
+
+namespace DSObjects
+{
+
+class CQuicktimeGraph;
+
+class CQuicktimeWindow : public CPlayerWindow
+{
+ CDC m_dc;
+ CBitmap m_bm;
+ QT::GWorldPtr m_offscreenGWorld;
+
+ CQuicktimeGraph* m_pGraph;
+ FILTER_STATE m_fs;
+ UINT m_idEndPoller;
+
+ static QT::OSErr MyMovieDrawingCompleteProc(QT::Movie theMovie, long refCon);
+
+ void ProcessMovieEvent(unsigned int message, unsigned int wParam, long lParam);
+
+protected:
+ virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+
+public:
+ CQuicktimeWindow(CQuicktimeGraph* pGraph);
+
+ bool OpenMovie(CString fn);
+ void CloseMovie();
+
+ void Run(), Pause(), Stop();
+ FILTER_STATE GetState();
+
+ QT::Movie theMovie;
+ QT::MovieController theMC;
+ CSize m_size;
+
+public:
+ DECLARE_MESSAGE_MAP()
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnDestroy();
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ afx_msg void OnTimer(UINT nIDEvent);
+};
+
+class CQuicktimeGraph : public CBaseGraph, public IVideoFrameStep
+{
+protected:
+ bool m_fQtInitialized;
+
+ CPlayerWindow m_wndWindowFrame;
+ CQuicktimeWindow m_wndDestFrame;
+
+ CComPtr<ISubPicAllocatorPresenter> m_pQTAP;
+
+public:
+ CQuicktimeGraph(HWND hParent, HRESULT& hr);
+ virtual ~CQuicktimeGraph();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+protected:
+ // IGraphBuilder
+ STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
+
+ // IMediaControl
+ STDMETHODIMP Run();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Stop();
+ STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
+
+ // IMediaSeeking
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+
+ // IVideoWindow
+ STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
+
+ // IBasicVideo
+ STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
+ STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
+
+ // IBasicAudio
+ STDMETHODIMP put_Volume(long lVolume);
+ STDMETHODIMP get_Volume(long* plVolume);
+
+ // IVideoFrameStep
+ STDMETHODIMP Step(DWORD dwFrames, IUnknown* pStepObject);
+ STDMETHODIMP CanStep(long bMultiple, IUnknown* pStepObject);
+ STDMETHODIMP CancelStep();
+
+ // IGraphEngine
+ STDMETHODIMP_(engine_t) GetEngine();
+};
+
+}
+using namespace DSObjects; \ No newline at end of file
diff --git a/src/apps/mplayerc/RealMediaGraph.cpp b/src/apps/mplayerc/RealMediaGraph.cpp
new file mode 100644
index 000000000..719b5282c
--- /dev/null
+++ b/src/apps/mplayerc/RealMediaGraph.cpp
@@ -0,0 +1,714 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include <math.h>
+#include <atlbase.h>
+#include <atlcoll.h>
+#include <initguid.h>
+#include "RealMediaGraph.h"
+#include "RealMediaWindowlessSite.h"
+#include "..\..\..\include\RealMedia\rmavsurf.h"
+#include "..\..\..\include\RealMedia\rmaevent.h"
+#include "..\..\..\include\RealMedia\rmaprefs.h"
+#include "..\..\DSUtil\DSUtil.h"
+#include "AuthDlg.h"
+
+// CRealMediaPlayer
+
+CRealMediaPlayer::CRealMediaPlayer(HWND hWndParent, CRealMediaGraph* pRMG)
+ : CUnknown(NAME("CRealMediaPlayer"), NULL)
+ , m_pRMG(pRMG)
+ , m_hWndParent(hWndParent)
+ , m_fpCreateEngine(NULL), m_fpCloseEngine(NULL), m_hRealMediaCore(NULL)
+ , m_State(State_Stopped), m_UserState(State_Stopped), m_nCurrent(0), m_nDuration(0)
+ , m_VideoSize(0, 0)
+ , m_fVideoSizeChanged(true)
+{
+}
+
+CRealMediaPlayer::~CRealMediaPlayer()
+{
+ Deinit();
+}
+
+bool CRealMediaPlayer::Init()
+{
+ CString prefs(_T("Software\\RealNetworks\\Preferences"));
+
+ CRegKey key;
+
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, prefs + _T("\\DT_Common"), KEY_READ))
+ return(false);
+
+ TCHAR buff[MAX_PATH];
+ ULONG len = sizeof(buff);
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len))
+ return(false);
+
+ key.Close();
+
+ if(!(m_hRealMediaCore = LoadLibrary(CString(buff) + _T("pnen3260.dll"))))
+ return(false);
+
+ m_fpCreateEngine = (FPRMCREATEENGINE)GetProcAddress(m_hRealMediaCore, "CreateEngine");
+ m_fpCloseEngine = (FPRMCLOSEENGINE)GetProcAddress(m_hRealMediaCore, "CloseEngine");
+ m_fpSetDLLAccessPath = (FPRMSETDLLACCESSPATH)GetProcAddress(m_hRealMediaCore, "SetDLLAccessPath");
+
+ if(!m_fpCreateEngine || !m_fpCloseEngine || !m_fpSetDLLAccessPath)
+ return(false);
+
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, prefs, KEY_READ))
+ {
+ CString dllpaths;
+
+ len = sizeof(buff);
+ for(int i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len); i++, len = sizeof(buff))
+ {
+ CRegKey key2;
+ TCHAR buff2[MAX_PATH];
+ ULONG len2 = sizeof(buff2);
+ if(ERROR_SUCCESS != key2.Open(HKEY_CLASSES_ROOT, prefs + _T("\\") + buff, KEY_READ)
+ || ERROR_SUCCESS != key2.QueryStringValue(NULL, buff2, &len2))
+ continue;
+
+ dllpaths += CString(buff) + '=' + buff2 + '|';
+ }
+
+ key.Close();
+
+ if(!dllpaths.IsEmpty())
+ {
+ char* s = new char[dllpaths.GetLength()+1];
+ strcpy(s, CStringA(dllpaths));
+ for(int i = 0, j = strlen(s); i < j; i++) {if(s[i] == '|') s[i] = '\0';}
+ m_fpSetDLLAccessPath(s);
+ delete [] s;
+ }
+ }
+
+ if(PNR_OK != m_fpCreateEngine(&m_pEngine))
+ return(false);
+
+ if(PNR_OK != m_pEngine->CreatePlayer(*&m_pPlayer))
+ return(false);
+
+ if(!(m_pSiteManager = m_pPlayer) || !(m_pCommonClassFactory = m_pPlayer))
+ return(false);
+
+ m_pAudioPlayer = m_pPlayer;
+ m_pAudioPlayer->AddPostMixHook(static_cast<IRMAAudioHook*>(this), FALSE, FALSE);
+// m_pVolume = m_pAudioPlayer->GetDeviceVolume();
+ m_pVolume = m_pAudioPlayer->GetAudioVolume();
+
+ // IRMAVolume::SetVolume has a huge latency when used via GetAudioVolume,
+ // but by lowering this audio pushdown thing it can get better
+ CComQIPtr<IRMAAudioPushdown, &IID_IRMAAudioPushdown> pAP = m_pAudioPlayer;
+ if(pAP) pAP->SetAudioPushdown(300); // 100ms makes the playback sound choppy, 200ms looks ok, but for safety we set this to 300ms... :P
+
+ CComQIPtr<IRMAErrorSinkControl, &IID_IRMAErrorSinkControl> pErrorSinkControl = m_pPlayer;
+ if(pErrorSinkControl) pErrorSinkControl->AddErrorSink(static_cast<IRMAErrorSink*>(this), PNLOG_EMERG, PNLOG_INFO);
+
+ if(PNR_OK != m_pPlayer->AddAdviseSink(static_cast<IRMAClientAdviseSink*>(this)))
+ return(false);
+
+ if(PNR_OK != m_pPlayer->SetClientContext((IUnknown*)(INonDelegatingUnknown*)(this)))
+ return(false);
+
+ // TODO
+/*
+ if(CComQIPtr<IRMAPreferences, &IID_IRMAPreferences> pPrefs = m_pPlayer)
+ {
+ CComPtr<IRMABuffer> pBuffer;
+ HRESULT hr = pPrefs->ReadPref("HTTPProxyHost", *&pBuffer);
+
+ UCHAR* pData = NULL;
+ ULONG32 ulLength = 0;
+ hr = pBuffer->Get(pData, ulLength);
+
+ pBuffer = NULL;
+ hr = m_pCommonClassFactory->CreateInstance(CLSID_IRMABuffer, (void**)&pBuffer);
+ hr = pBuffer->SetSize(strlen("localhost")+1);
+ pData = pBuffer->GetBuffer();
+ strcpy((char*)pData, "localhost");
+ hr = pBuffer->Set(pData, strlen("localhost")+1);
+
+ pData = NULL;
+ ulLength = 0;
+ hr = pBuffer->Get(pData, ulLength);
+
+ hr = pPrefs->WritePref("HTTPProxyHost", pBuffer);
+
+ hr = hr;
+ }
+*/
+ return(true);
+}
+
+void CRealMediaPlayer::Deinit()
+{
+ if(m_pPlayer)
+ {
+ m_pPlayer->Stop();
+
+ CComQIPtr<IRMAErrorSinkControl, &IID_IRMAErrorSinkControl> pErrorSinkControl = m_pPlayer;
+ if(pErrorSinkControl) pErrorSinkControl->RemoveErrorSink(static_cast<IRMAErrorSink*>(this));
+
+ m_pPlayer->RemoveAdviseSink(static_cast<IRMAClientAdviseSink*>(this));
+
+ m_pVolume = NULL;
+ m_pAudioPlayer->RemovePostMixHook(static_cast<IRMAAudioHook*>(this));
+ m_pAudioPlayer.Release();
+
+ m_pEngine->ClosePlayer(m_pPlayer);
+
+ m_pSiteManager.Release();
+ m_pCommonClassFactory.Release();
+
+ m_pPlayer = NULL;
+ }
+
+ if(m_pEngine)
+ {
+ m_fpCloseEngine(m_pEngine);
+ m_pEngine = NULL;
+ }
+
+ if(m_hRealMediaCore)
+ {
+ FreeLibrary(m_hRealMediaCore);
+ m_hRealMediaCore = NULL;
+ }
+}
+
+STDMETHODIMP CRealMediaPlayer::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI2(IRMAErrorSink)
+ QI2(IRMAClientAdviseSink)
+ QI2(IRMAAuthenticationManager)
+ QI2(IRMASiteSupplier)
+ QI2(IRMAPassiveSiteWatcher)
+ QI2(IRMAAudioHook)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IRMAErrorSink
+STDMETHODIMP CRealMediaPlayer::ErrorOccurred(const UINT8 unSeverity, const UINT32 ulRMACode, const UINT32 ulUserCode, const char* pUserString, const char* pMoreInfoURL)
+{
+ char* errmsg = NULL;
+
+ if(unSeverity < 5)
+ {
+ if(CComQIPtr<IRMAErrorMessages, &IID_IRMAErrorMessages> pErrorMessages = m_pPlayer)
+ {
+ CComPtr<IRMABuffer> pBuffer = pErrorMessages->GetErrorText(ulRMACode);
+ if(pBuffer)
+ {
+ char* buff = (char*)pBuffer->GetBuffer();
+ int len = strlen(buff);
+ if(len > 0 && (errmsg = (char*)CoTaskMemAlloc(len+1)))
+ strcpy(errmsg, buff);
+ }
+ }
+
+ if(!errmsg && (errmsg = (char*)CoTaskMemAlloc(strlen("RealMedia error")+1)))
+ strcpy(errmsg, "RealMedia error");
+
+ m_pRMG->NotifyEvent(EC_BG_ERROR, (LONG_PTR)errmsg, 0);
+ }
+
+ return PNR_OK;
+}
+
+// IRMAClientAdviseSink
+STDMETHODIMP CRealMediaPlayer::OnPosLength(UINT32 ulPosition, UINT32 ulLength)
+{
+ m_nCurrent = (REFERENCE_TIME)ulPosition*10000;
+ m_nDuration = (REFERENCE_TIME)ulLength*10000;
+ return PNR_OK;
+}
+STDMETHODIMP CRealMediaPlayer::OnPresentationOpened() {return PNR_OK;}
+STDMETHODIMP CRealMediaPlayer::OnPresentationClosed() {return PNR_OK;}
+STDMETHODIMP CRealMediaPlayer::OnStatisticsChanged()
+{
+ m_pRMG->NotifyEvent(EC_LENGTH_CHANGED);
+ return PNR_OK;
+}
+STDMETHODIMP CRealMediaPlayer::OnPreSeek(UINT32 ulOldTime, UINT32 ulNewTime)
+{
+ m_nCurrent = (REFERENCE_TIME)ulNewTime*10000;
+ return PNR_OK;
+}
+STDMETHODIMP CRealMediaPlayer::OnPostSeek(UINT32 ulOldTime, UINT32 ulNewTime)
+{
+ m_nCurrent = (REFERENCE_TIME)ulNewTime*10000;
+ return PNR_OK;
+}
+STDMETHODIMP CRealMediaPlayer::OnStop()
+{
+ m_nCurrent = 0;
+ m_State = State_Stopped;
+ if(m_UserState != State_Stopped)
+ m_pRMG->NotifyEvent(EC_COMPLETE);
+ return PNR_OK;
+}
+STDMETHODIMP CRealMediaPlayer::OnPause(UINT32 ulTime)
+{
+ m_State = State_Paused;
+ return PNR_OK;
+}
+STDMETHODIMP CRealMediaPlayer::OnBegin(UINT32 ulTime)
+{
+ m_State = State_Running;
+ return PNR_OK;
+}
+STDMETHODIMP CRealMediaPlayer::OnBuffering(UINT32 ulFlags, UINT16 unPercentComplete)
+{
+ m_unPercentComplete = unPercentComplete;
+ return PNR_OK;
+}
+STDMETHODIMP CRealMediaPlayer::OnContacting(const char* pHostName) {return PNR_OK;}
+
+// IRMAAuthenticationManager
+STDMETHODIMP CRealMediaPlayer::HandleAuthenticationRequest(IRMAAuthenticationManagerResponse* pResponse)
+{
+ CAuthDlg dlg;
+
+ if(dlg.DoModal() == IDOK)
+ {
+ pResponse->AuthenticationRequestDone(
+ PNR_OK, CStringA(dlg.m_username), CStringA(dlg.m_password));
+ return PNR_OK;
+ }
+
+ return pResponse->AuthenticationRequestDone(PNR_NOT_AUTHORIZED, NULL, NULL);
+}
+
+// IRMASiteSupplier
+STDMETHODIMP CRealMediaPlayer::SitesNeeded(UINT32 uRequestID, IRMAValues* pProps)
+{
+ if(!pProps) return PNR_INVALID_PARAMETER;
+
+ if(m_pTheSite || m_pTheSite2 || !m_hWndParent) return PNR_UNEXPECTED;
+
+ HRESULT hr = PNR_OK;
+
+ if(!CreateSite(&m_pTheSite))
+ return E_FAIL;
+
+ ULONG refc = ((IRMASite*)m_pTheSite)->AddRef();
+ refc = ((IRMASite*)m_pTheSite)->Release();
+
+ if(!(m_pTheSite2 = m_pTheSite))
+ return E_NOINTERFACE;
+
+ CComQIPtr<IRMAValues, &IID_IRMAValues> pSiteProps = m_pTheSite;
+ if(!pSiteProps)
+ return E_NOINTERFACE;
+
+ IRMABuffer* pValue;
+
+ // no idea what these supposed to do... but they were in the example
+ hr = pProps->GetPropertyCString("playto", pValue);
+ if(PNR_OK == hr)
+ {
+ pSiteProps->SetPropertyCString("channel", pValue);
+ pValue->Release();
+ }
+ else
+ {
+ hr = pProps->GetPropertyCString("name", pValue);
+ if(PNR_OK == hr)
+ {
+ pSiteProps->SetPropertyCString("LayoutGroup", pValue);
+ pValue->Release();
+ }
+ }
+
+ m_pTheSite2->AddPassiveSiteWatcher(static_cast<IRMAPassiveSiteWatcher*>(this));
+
+ hr = m_pSiteManager->AddSite(m_pTheSite);
+ if(PNR_OK != hr)
+ return hr;
+
+ m_CreatedSites[uRequestID] = m_pTheSite;
+
+ return hr;
+}
+
+STDMETHODIMP CRealMediaPlayer::SitesNotNeeded(UINT32 uRequestID)
+{
+ IRMASite* pSite;
+ if(!m_CreatedSites.Lookup(uRequestID, pSite))
+ return PNR_INVALID_PARAMETER;
+
+ m_CreatedSites.RemoveKey(uRequestID);
+
+ m_pSiteManager->RemoveSite(pSite);
+
+ m_pTheSite2->RemovePassiveSiteWatcher(static_cast<IRMAPassiveSiteWatcher*>(this));
+
+ m_pTheSite.Release();
+ m_pTheSite2.Release();
+
+ DestroySite(pSite);
+
+ return PNR_OK;
+}
+STDMETHODIMP CRealMediaPlayer::BeginChangeLayout() {return E_NOTIMPL;}
+STDMETHODIMP CRealMediaPlayer::DoneChangeLayout()
+{
+ if(m_fVideoSizeChanged)
+ {
+ m_pRMG->NotifyEvent(EC_VIDEO_SIZE_CHANGED, MAKELPARAM(m_VideoSize.cx, m_VideoSize.cy), 0);
+ m_fVideoSizeChanged = false;
+ }
+
+ return PNR_OK;
+}
+
+// IRMAPassiveSiteWatcher
+STDMETHODIMP CRealMediaPlayer::PositionChanged(PNxPoint* pos) {return E_NOTIMPL;}
+STDMETHODIMP CRealMediaPlayer::SizeChanged(PNxSize* size)
+{
+ if(m_VideoSize.cx == 0 || m_VideoSize.cy == 0)
+ {
+ m_fVideoSizeChanged = true;
+ m_VideoSize.cx = size->cx;
+ m_VideoSize.cy = size->cy;
+ }
+ return PNR_OK;
+}
+
+// IRMAAudioHook
+STDMETHODIMP CRealMediaPlayer::OnBuffer(RMAAudioData* pAudioInData, RMAAudioData* pAudioOutData) {return E_NOTIMPL;}
+STDMETHODIMP CRealMediaPlayer::OnInit(RMAAudioFormat* pFormat)
+{
+ m_pRMG->NotifyEvent(EC_BG_AUDIO_CHANGED, pFormat->uChannels, 0);
+ return PNR_OK;
+}
+
+//
+// CRealMediaPlayerWindowed
+//
+
+CRealMediaPlayerWindowed::CRealMediaPlayerWindowed(HWND hWndParent, CRealMediaGraph* pRMG)
+ : CRealMediaPlayer(hWndParent, pRMG)
+{
+ if(!m_wndWindowFrame.CreateEx(WS_EX_NOPARENTNOTIFY, NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_VISIBLE,
+ CRect(0, 0, 0, 0), CWnd::FromHandle(m_hWndParent), 0, NULL))
+ return;
+
+ if(!m_wndDestFrame.Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
+ CRect(0, 0, 0, 0), &m_wndWindowFrame, 0, NULL))
+ return;
+}
+
+CRealMediaPlayerWindowed::~CRealMediaPlayerWindowed()
+{
+ m_wndDestFrame.DestroyWindow();
+ m_wndWindowFrame.DestroyWindow();
+}
+
+void CRealMediaPlayerWindowed::SetWindowRect(CRect r)
+{
+ if(IsWindow(m_wndWindowFrame.m_hWnd))
+ m_wndWindowFrame.MoveWindow(r);
+}
+
+void CRealMediaPlayerWindowed::SetDestRect(CRect r)
+{
+ if(IsWindow(m_wndDestFrame.m_hWnd))
+ m_wndDestFrame.MoveWindow(r);
+
+ if(m_pTheSite)
+ {
+ PNxSize s = {r.Width(), r.Height()};
+ m_pTheSite->SetSize(s);
+ }
+}
+
+bool CRealMediaPlayerWindowed::CreateSite(IRMASite** ppSite)
+{
+ if(!ppSite)
+ return(false);
+
+ CComPtr<IRMASiteWindowed> pSiteWindowed;
+ if(PNR_OK != m_pCommonClassFactory->CreateInstance(CLSID_IRMASiteWindowed, (void**)&pSiteWindowed))
+ return(false);
+
+ DWORD style = WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
+ if(!AfxGetAppSettings().fIntRealMedia) style |= WS_DISABLED;
+ if(PNR_OK != pSiteWindowed->Create(m_wndDestFrame.m_hWnd, style))
+ return(false);
+
+ return !!(*ppSite = CComQIPtr<IRMASite, &IID_IRMASite>(pSiteWindowed).Detach());
+}
+
+void CRealMediaPlayerWindowed::DestroySite(IRMASite* pSite)
+{
+ if(CComQIPtr<IRMASiteWindowed, &IID_IRMASiteWindowed> pRMASiteWindowed = pSite)
+ pRMASiteWindowed->Destroy();
+}
+//
+// CRealMediaPlayerWindowless
+//
+
+CRealMediaPlayerWindowless::CRealMediaPlayerWindowless(HWND hWndParent, CRealMediaGraph* pRMG)
+ : CRealMediaPlayer(hWndParent, pRMG)
+{
+ AppSettings& s = AfxGetAppSettings();
+
+ switch(s.iRMVideoRendererType)
+ {
+ default:
+ case VIDRNDT_RM_DX7:
+ if(FAILED(CreateAP7(CLSID_RM7AllocatorPresenter, hWndParent, &m_pRMAP)))
+ return;
+ break;
+ case VIDRNDT_RM_DX9:
+ if(FAILED(CreateAP9(CLSID_RM9AllocatorPresenter, hWndParent, &m_pRMAP)))
+ return;
+ break;
+ }
+}
+
+CRealMediaPlayerWindowless::~CRealMediaPlayerWindowless()
+{
+}
+
+STDMETHODIMP CRealMediaPlayerWindowless::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ (m_pRMAP && (riid == __uuidof(ISubPicAllocatorPresenter) || riid == IID_IRMAVideoSurface)) ? m_pRMAP->QueryInterface(riid, ppv) :
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+bool CRealMediaPlayerWindowless::CreateSite(IRMASite** ppSite)
+{
+ if(!ppSite || !m_pRMAP)
+ return(false);
+
+ HRESULT hr = S_OK;
+
+ CRealMediaWindowlessSite* pWMWlS;
+
+ CComPtr<IRMASiteWindowless> pSiteWindowless;
+ pSiteWindowless = (IRMASiteWindowless*)(pWMWlS = new CRealMediaWindowlessSite(hr, m_pPlayer, NULL, NULL));
+ if(FAILED(hr))
+ return(false);
+
+ pWMWlS->SetBltService(CComQIPtr<IRMAVideoSurface, &IID_IRMAVideoSurface>(m_pRMAP));
+
+ return !!(*ppSite = CComQIPtr<IRMASite, &IID_IRMASite>(pSiteWindowless).Detach());
+}
+
+void CRealMediaPlayerWindowless::DestroySite(IRMASite* pSite)
+{
+}
+
+STDMETHODIMP CRealMediaPlayerWindowless::SizeChanged(PNxSize* size)
+{
+ if(CComQIPtr<IRMAVideoSurface, &IID_IRMAVideoSurface> pRMAVS = m_pRMAP)
+ {
+ RMABitmapInfoHeader BitmapInfo;
+ memset(&BitmapInfo, 0, sizeof(BitmapInfo));
+ BitmapInfo.biWidth = size->cx;
+ BitmapInfo.biHeight = size->cy;
+ pRMAVS->BeginOptimizedBlt(&BitmapInfo);
+ }
+
+ return __super::SizeChanged(size);
+}
+
+
+////////////////
+
+CRealMediaGraph::CRealMediaGraph(HWND hWndParent, HRESULT& hr)
+ : CBaseGraph()
+{
+ hr = S_OK;
+
+ m_pRMP = AfxGetAppSettings().iRMVideoRendererType == VIDRNDT_RM_DEFAULT
+ ? (CRealMediaPlayer*)new CRealMediaPlayerWindowed(hWndParent, this)
+ : (CRealMediaPlayer*)new CRealMediaPlayerWindowless(hWndParent, this);
+
+ if(!m_pRMP)
+ {
+ hr = E_OUTOFMEMORY;
+ return;
+ }
+
+ if(!m_pRMP->Init())
+ {
+ delete m_pRMP, m_pRMP = NULL;
+ hr = E_FAIL;
+ return;
+ }
+
+ m_pRMP->AddRef();
+}
+
+CRealMediaGraph::~CRealMediaGraph()
+{
+ if(m_pRMP)
+ {
+ m_pRMP->Deinit();
+ m_pRMP->Release();
+ m_pRMP = NULL;
+ }
+}
+
+STDMETHODIMP CRealMediaGraph::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ (m_pRMP && (riid == __uuidof(ISubPicAllocatorPresenter) || riid == __uuidof(ISubPicAllocatorPresenter))) ? m_pRMP->QueryInterface(riid, ppv) :
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IGraphBuilder
+STDMETHODIMP CRealMediaGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList)
+{
+ m_fn = lpcwstrFile;
+
+ CHAR buff[MAX_PATH] = {0};
+ WideCharToMultiByte(GetACP(), 0, lpcwstrFile, -1, buff, MAX_PATH, 0, 0);
+
+ CStringA fn(buff);
+ if(fn.Find("://") < 0) fn = "file://" + fn;
+
+ m_pRMP->m_unPercentComplete = 100;
+
+ ClearMessageQueue();
+
+ if(PNR_OK != m_pRMP->m_pPlayer->OpenURL(fn))
+ return E_FAIL;
+
+ m_pRMP->m_pPlayer->Pause()/*Stop()*/; // please, don't start just yet
+
+ return S_OK;
+}
+
+// IMediaControl
+STDMETHODIMP CRealMediaGraph::Run()
+{
+ if(m_pRMP->m_pPlayer->IsDone())
+ RenderFile(m_fn, NULL);
+
+ m_pRMP->m_UserState = State_Running;
+ return (PNR_OK == m_pRMP->m_pPlayer->Begin()) ? S_OK : E_FAIL;
+}
+STDMETHODIMP CRealMediaGraph::Pause()
+{
+ m_pRMP->m_UserState = State_Paused;
+ return (PNR_OK == m_pRMP->m_pPlayer->Pause()) ? S_OK : E_FAIL;
+}
+STDMETHODIMP CRealMediaGraph::Stop()
+{
+ m_pRMP->m_UserState = State_Stopped;
+ return (PNR_OK == m_pRMP->m_pPlayer->Stop()) ? S_OK : E_FAIL;
+}
+STDMETHODIMP CRealMediaGraph::GetState(LONG msTimeout, OAFilterState* pfs)
+{
+ return pfs ? *pfs = m_pRMP->m_State, S_OK : E_POINTER;
+}
+
+// IMediaSeeking
+STDMETHODIMP CRealMediaGraph::GetDuration(LONGLONG* pDuration)
+{
+ return pDuration ? *pDuration = m_pRMP->m_nDuration, S_OK : E_POINTER;
+}
+STDMETHODIMP CRealMediaGraph::GetCurrentPosition(LONGLONG* pCurrent)
+{
+ return pCurrent ? *pCurrent = m_pRMP->m_nCurrent, S_OK : E_POINTER;
+}
+STDMETHODIMP CRealMediaGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
+{
+ return (dwCurrentFlags&AM_SEEKING_AbsolutePositioning)
+ && (PNR_OK == m_pRMP->m_pPlayer->Seek((ULONG)(*pCurrent / 10000))) ? S_OK : E_FAIL;
+}
+
+// IVideoWindow
+STDMETHODIMP CRealMediaGraph::SetWindowPosition(long Left, long Top, long Width, long Height)
+{
+ if(m_pRMP)
+ m_pRMP->SetWindowRect(CRect(CPoint(Left, Top), CSize(Width, Height)));
+
+ return S_OK;
+}
+
+// IBasicVideo
+STDMETHODIMP CRealMediaGraph::SetDestinationPosition(long Left, long Top, long Width, long Height)// {return E_NOTIMPL;}
+{
+ m_pRMP->SetDestRect(CRect(CPoint(Left, Top), CSize(Width, Height)));
+ return S_OK;
+}
+STDMETHODIMP CRealMediaGraph::GetVideoSize(long* pWidth, long* pHeight)
+{
+ if(!pWidth || !pHeight) return E_POINTER;
+ *pWidth = m_pRMP->GetVideoSize().cx;
+ *pHeight = m_pRMP->GetVideoSize().cy;
+ return S_OK;
+}
+
+// IBasicAudio
+STDMETHODIMP CRealMediaGraph::put_Volume(long lVolume)
+{
+ if(!m_pRMP->m_pVolume) return E_UNEXPECTED;
+
+ UINT16 volume = (lVolume == -10000) ? 0 : (int)pow(10.0, ((double)lVolume)/5000+2);
+ volume = max(min(volume, 100), 0);
+
+ return PNR_OK == m_pRMP->m_pVolume->SetVolume(volume) ? S_OK : E_FAIL;
+}
+STDMETHODIMP CRealMediaGraph::get_Volume(long* plVolume)
+{
+ if(!m_pRMP->m_pVolume) return E_UNEXPECTED;
+
+ CheckPointer(plVolume, E_POINTER);
+
+ UINT16 volume = m_pRMP->m_pVolume->GetVolume();
+ volume = (int)((log10(1.0*volume)-2)*5000);
+ volume = max(min(volume, 0), -10000);
+
+ *plVolume = volume;
+
+ return S_OK;
+}
+
+// IAMOpenProgress
+STDMETHODIMP CRealMediaGraph::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent)
+{
+ *pllTotal = 100;
+ *pllCurrent = m_pRMP->m_unPercentComplete > 0 ? m_pRMP->m_unPercentComplete : 100; // after seeking it drops to 0 and would show annoying "Buffering... (0%)" messages on the status line
+ return S_OK;
+}
+
+// IGraphEngine
+STDMETHODIMP_(engine_t) CRealMediaGraph::GetEngine() {return RealMedia;}
diff --git a/src/apps/mplayerc/RealMediaGraph.h b/src/apps/mplayerc/RealMediaGraph.h
new file mode 100644
index 000000000..3e085f6bb
--- /dev/null
+++ b/src/apps/mplayerc/RealMediaGraph.h
@@ -0,0 +1,229 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "BaseGraph.h"
+
+#include "DX7AllocatorPresenter.h"
+#include "DX9AllocatorPresenter.h"
+
+#include "..\..\..\include\RealMedia\pntypes.h"
+#include "..\..\..\include\RealMedia\pnwintyp.h"
+#include "..\..\..\include\RealMedia\pncom.h"
+#include "..\..\..\include\RealMedia\rmapckts.h"
+#include "..\..\..\include\RealMedia\rmacomm.h"
+#include "..\..\..\include\RealMedia\rmamon.h"
+#include "..\..\..\include\RealMedia\rmafiles.h"
+#include "..\..\..\include\RealMedia\rmaengin.h"
+#include "..\..\..\include\RealMedia\rmacore.h"
+#include "..\..\..\include\RealMedia\rmaclsnk.h"
+#include "..\..\..\include\RealMedia\rmaerror.h"
+#include "..\..\..\include\RealMedia\rmaauth.h"
+#include "..\..\..\include\RealMedia\rmawin.h"
+#include "..\..\..\include\RealMedia\rmasite2.h"
+#include "..\..\..\include\RealMedia\rmaausvc.h"
+#include "..\..\..\include\RealMedia\rmavsurf.h"
+
+namespace DSObjects
+{
+
+class CRealMediaGraph;
+
+class CRealMediaPlayer
+ : public CUnknown
+ , public IRMAErrorSink
+ , public IRMAClientAdviseSink
+ , public IRMAAuthenticationManager
+ , public IRMASiteSupplier
+ , public IRMAPassiveSiteWatcher
+ , public IRMAAudioHook
+
+{
+protected:
+ friend class CRealMediaGraph;
+ CRealMediaGraph* m_pRMG; // IMPORTANT: do not ever AddRef on this from here
+
+ HWND m_hWndParent;
+ CSize m_VideoSize;
+ bool m_fVideoSizeChanged;
+
+ //
+
+ DWORD m_wndStyle;
+ CPlayerWindow m_wndWindowFrame, m_wndDestFrame;
+
+ //
+
+ FPRMCREATEENGINE m_fpCreateEngine;
+ FPRMCLOSEENGINE m_fpCloseEngine;
+ FPRMSETDLLACCESSPATH m_fpSetDLLAccessPath;
+ HMODULE m_hRealMediaCore;
+
+ CComPtr<IRMAClientEngine> m_pEngine;
+ CComPtr<IRMAPlayer> m_pPlayer;
+ CComQIPtr<IRMAAudioPlayer, &IID_IRMAAudioPlayer> m_pAudioPlayer;
+ CComPtr<IRMAVolume> m_pVolume;
+ CComQIPtr<IRMASiteManager, &IID_IRMASiteManager> m_pSiteManager;
+ CComQIPtr<IRMACommonClassFactory, &IID_IRMACommonClassFactory> m_pCommonClassFactory;
+
+ CComQIPtr<IRMASite, &IID_IRMASite> m_pTheSite;
+ CComQIPtr<IRMASite2, &IID_IRMASite2> m_pTheSite2;
+ CMap<UINT32, UINT32&, IRMASite*, IRMASite*&> m_CreatedSites;
+
+ //
+
+ OAFilterState m_State, m_UserState;
+ REFERENCE_TIME m_nCurrent, m_nDuration;
+
+ UINT16 m_unPercentComplete;
+
+ //
+
+public:
+ CRealMediaPlayer(HWND hWndParent, CRealMediaGraph* pRMG);
+ virtual ~CRealMediaPlayer();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ bool Init();
+ void Deinit();
+
+ virtual CSize GetVideoSize() {return(m_VideoSize);}
+ virtual void SetWindowRect(CRect r) {}
+ virtual void SetDestRect(CRect r) {}
+ virtual bool CreateSite(IRMASite** pSite) = 0;
+ virtual void DestroySite(IRMASite* pSite) = 0;
+
+ // IRMAErrorSink
+ STDMETHODIMP ErrorOccurred(const UINT8 unSeverity, const UINT32 ulRMACode, const UINT32 ulUserCode, const char* pUserString, const char* pMoreInfoURL);
+
+ // IRMAClientAdviseSink
+ STDMETHODIMP OnPosLength(UINT32 ulPosition, UINT32 ulLength);
+ STDMETHODIMP OnPresentationOpened();
+ STDMETHODIMP OnPresentationClosed();
+ STDMETHODIMP OnStatisticsChanged();
+ STDMETHODIMP OnPreSeek(UINT32 ulOldTime, UINT32 ulNewTime);
+ STDMETHODIMP OnPostSeek(UINT32 ulOldTime, UINT32 ulNewTime);
+ STDMETHODIMP OnStop();
+ STDMETHODIMP OnPause(UINT32 ulTime);
+ STDMETHODIMP OnBegin(UINT32 ulTime);
+ STDMETHODIMP OnBuffering(UINT32 ulFlags, UINT16 unPercentComplete);
+ STDMETHODIMP OnContacting(const char* pHostName);
+
+ // IRMAAuthenticationManager
+ STDMETHODIMP HandleAuthenticationRequest(IRMAAuthenticationManagerResponse* pResponse);
+
+ // IRMASiteSupplier
+ STDMETHODIMP SitesNeeded(UINT32 uRequestID, IRMAValues* pSiteProps);
+ STDMETHODIMP SitesNotNeeded(UINT32 uRequestID);
+ STDMETHODIMP BeginChangeLayout();
+ STDMETHODIMP DoneChangeLayout();
+
+ // IRMAPassiveSiteWatcher
+ STDMETHODIMP PositionChanged(PNxPoint* pos);
+ STDMETHODIMP SizeChanged(PNxSize* size);
+
+ // IRMAAudioHook
+ STDMETHODIMP OnBuffer(RMAAudioData* pAudioInData, RMAAudioData* pAudioOutData);
+ STDMETHODIMP OnInit(RMAAudioFormat* pFormat);
+};
+
+class CRealMediaPlayerWindowed
+ : public CRealMediaPlayer
+{
+public:
+ CRealMediaPlayerWindowed(HWND hWndParent, CRealMediaGraph* pRMG);
+ virtual ~CRealMediaPlayerWindowed();
+
+ void SetWindowRect(CRect r);
+ void SetDestRect(CRect r);
+
+ bool CreateSite(IRMASite** pSite);
+ void DestroySite(IRMASite* pSite);
+};
+
+class CRealMediaPlayerWindowless
+ : public CRealMediaPlayer
+{
+ CComPtr<ISubPicAllocatorPresenter> m_pRMAP;
+
+public:
+ CRealMediaPlayerWindowless(HWND hWndParent, CRealMediaGraph* pRMG);
+ virtual ~CRealMediaPlayerWindowless();
+
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ bool CreateSite(IRMASite** pSite);
+ void DestroySite(IRMASite* pSite);
+
+ STDMETHODIMP SizeChanged(PNxSize* size);
+};
+
+class CRealMediaGraph : public CBaseGraph
+{
+ CRealMediaPlayer* m_pRMP; // TODO: access m_pRMP through a private interface
+
+ CStringW m_fn;
+
+public:
+ CRealMediaGraph(HWND hWndParent, HRESULT& hr); // in windowless mode IVideoWindow::* will return E_NOTIMPL, use ISubPicAllocatorPresenter instead
+ virtual ~CRealMediaGraph();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+protected:
+ // IGraphBuilder
+ STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
+
+ // IMediaControl
+ STDMETHODIMP Run();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Stop();
+ STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
+
+ // IMediaSeeking
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+
+ // IVideoWindow
+ STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
+
+ // IBasicVideo
+ STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
+ STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
+
+ // IBasicAudio
+ STDMETHODIMP put_Volume(long lVolume);
+ STDMETHODIMP get_Volume(long* plVolume);
+
+ // IAMOpenProgress
+ STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
+
+ // IGraphEngine
+ STDMETHODIMP_(engine_t) GetEngine();
+};
+
+}
+using namespace DSObjects; \ No newline at end of file
diff --git a/src/apps/mplayerc/RealMediaWindowlessSite.cpp b/src/apps/mplayerc/RealMediaWindowlessSite.cpp
new file mode 100644
index 000000000..9891f5e71
--- /dev/null
+++ b/src/apps/mplayerc/RealMediaWindowlessSite.cpp
@@ -0,0 +1,710 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include <math.h>
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "realmediawindowlesssite.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+void DSObjects::ExtractRects(REGION* pRegion)
+{
+ LPRGNDATA lpRgnData;
+
+ DWORD sizeNeeed = GetRegionData((HRGN)pRegion->pOSRegion, 0, NULL);
+
+ lpRgnData = (LPRGNDATA)new char[sizeNeeed];
+ DWORD returnValue = GetRegionData((HRGN)pRegion->pOSRegion, sizeNeeed, lpRgnData);
+
+ PN_VECTOR_DELETE(pRegion->rects);
+
+ pRegion->numRects = lpRgnData->rdh.nCount;
+ pRegion->extents.left = lpRgnData->rdh.rcBound.left;
+ pRegion->extents.top = lpRgnData->rdh.rcBound.top;
+ pRegion->extents.right = lpRgnData->rdh.rcBound.right;
+ pRegion->extents.bottom = lpRgnData->rdh.rcBound.bottom;
+
+ if(lpRgnData->rdh.nCount)
+ {
+ pRegion->rects = new PNxRect[lpRgnData->rdh.nCount];
+
+ // now extract the information.
+
+ for(int j = 0; j < (int) lpRgnData->rdh.nCount;j++)
+ {
+ RECT* pRect = (RECT*)lpRgnData->Buffer;
+ pRegion->rects[j].left = pRect[j].left;
+ pRegion->rects[j].top = pRect[j].top;
+ pRegion->rects[j].right = pRect[j].right;
+ pRegion->rects[j].bottom = pRect[j].bottom;
+ }
+ }
+
+ PN_VECTOR_DELETE(lpRgnData);
+}
+REGION* DSObjects::RMACreateRectRegion(int left, int top, int right, int bottom)
+{
+ REGION* retVal = new REGION;
+ retVal->pOSRegion = (void*)CreateRectRgn(left, top, right, bottom);
+ ExtractRects(retVal);
+ return retVal;
+}
+void DSObjects::RMASubtractRegion(REGION* regM, REGION* regS, REGION* regD)
+{
+ CombineRgn((HRGN)regD->pOSRegion, (HRGN)regM->pOSRegion, (HRGN)regS->pOSRegion, RGN_DIFF);
+ ExtractRects(regD);
+}
+void DSObjects::RMAUnionRegion(REGION* reg1, REGION* reg2, REGION* regD)
+{
+ CombineRgn((HRGN)regD->pOSRegion, (HRGN)reg1->pOSRegion, (HRGN)reg2->pOSRegion, RGN_OR);
+ ExtractRects(regD);
+}
+void DSObjects::RMAIntersectRegion(REGION* reg1, REGION* reg2, REGION* regD)
+{
+ CombineRgn((HRGN)regD->pOSRegion, (HRGN)reg1->pOSRegion, (HRGN)reg2->pOSRegion, RGN_AND);
+ ExtractRects(regD);
+}
+BOOL DSObjects::RMAEqualRegion(REGION* reg1, REGION* reg2)
+{
+ return EqualRgn((HRGN)reg1->pOSRegion, (HRGN)reg2->pOSRegion)
+ && !memcmp(&reg1->extents, &reg2->extents, sizeof(PNxRect)) ? TRUE : FALSE;
+}
+void DSObjects::RMADestroyRegion(REGION* reg)
+{
+ if(reg) DeleteObject((HRGN)reg->pOSRegion),
+ PN_VECTOR_DELETE(reg->rects);
+ PN_DELETE(reg);
+}
+REGION* DSObjects::RMACreateRegion()
+{
+ return RMACreateRectRegion(0,0,0,0);
+}
+
+//
+// CRealMediaWindowlessSite
+//
+
+CRealMediaWindowlessSite::CRealMediaWindowlessSite(HRESULT& hr, IUnknown* pContext, CRealMediaWindowlessSite* pParentSite, IUnknown* pUnkOuter)
+ : CUnknown(NAME("CRealMediaWindowlessSite"), pUnkOuter, &hr)
+ , m_pContext(pContext)
+ , m_pParentSite(pParentSite)
+ , m_pCCF(pContext)
+ , m_fDamaged(false), m_fInRedraw(false), m_fIsVisible(true)
+ , m_lZOrder(0)
+ , m_pRegion(NULL), m_pRegionWithoutChildren(NULL)
+{
+ m_size.cx = m_size.cy = 0;
+ m_position.x = m_position.y = 0;
+
+ memset(&m_lastBitmapInfo, 0, sizeof(m_lastBitmapInfo));
+
+ hr = S_OK;
+
+ if(!m_pContext || !m_pCCF)
+ {
+ hr = E_POINTER;
+ return;
+ }
+
+ m_pCCF->CreateInstance(CLSID_IRMAValues, (void**)&m_pValues);
+}
+
+CRealMediaWindowlessSite::~CRealMediaWindowlessSite()
+{
+ POSITION pos = m_pChildren.GetHeadPosition();
+ while(pos) DestroyChild(m_pChildren.GetNext(pos));
+
+ RMADestroyRegion(m_pRegion);
+ RMADestroyRegion(m_pRegionWithoutChildren);
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI2(IRMASite)
+ QI2(IRMASite2)
+ QI2(IRMASiteWindowless)
+ QI2(IRMAVideoSurface)
+ (m_pValues && m_pValues->QueryInterface(riid, ppv) == PNR_OK) ? PNR_OK :
+ CUnknown::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// public
+
+void CRealMediaWindowlessSite::GetTopLeft(PNxPoint* pPoint)
+{
+ pPoint->x += m_position.x;
+ pPoint->y += m_position.y;
+
+ if(m_pParentSite)
+ m_pParentSite->GetTopLeft(pPoint);
+}
+
+REGION* CRealMediaWindowlessSite::GetRegion()
+{
+ return m_pRegion;
+}
+
+// private
+
+void CRealMediaWindowlessSite::RecomputeRegion()
+{
+ if(m_pParentSite) m_pParentSite->RecomputeRegion();
+ else InternalRecomputeRegion();
+}
+
+void CRealMediaWindowlessSite::InternalRecomputeRegion()
+{
+ ComputeRegion();
+
+ POSITION pos = m_pChildren.GetHeadPosition();
+ while(pos)
+ {
+ CRealMediaWindowlessSite* pSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pChildren.GetNext(pos);
+ if(pSite) pSite->InternalRecomputeRegion();
+ }
+}
+
+void CRealMediaWindowlessSite::ComputeRegion()
+{
+ REGION* pTempRegion = NULL;
+
+ if(m_pRegion)
+ {
+ pTempRegion = RMACreateRegion();
+ RMAUnionRegion(pTempRegion, m_pRegion, pTempRegion);
+ RMADestroyRegion(m_pRegion);
+ }
+
+ if(m_pRegionWithoutChildren)
+ {
+ RMADestroyRegion(m_pRegionWithoutChildren);
+ }
+
+ PNxPoint topleft = {0,0};
+ GetTopLeft(&topleft);
+
+ if(IsSiteVisible())
+ {
+ m_pRegionWithoutChildren = RMACreateRectRegion(topleft.x, topleft.y, topleft.x + m_size.cx, topleft.y + m_size.cy);
+
+ if(m_pParentSite)
+ {
+ RMAIntersectRegion(m_pRegionWithoutChildren, m_pParentSite->m_pRegionWithoutChildren, m_pRegionWithoutChildren);
+
+ POSITION pos = m_pParentSite->m_pChildren.GetHeadPosition();
+ while(pos)
+ {
+ CRealMediaWindowlessSite* pSiblingSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pParentSite->m_pChildren.GetNext(pos);
+ if(pSiblingSite != this)
+ {
+ INT32 zOrder;
+ pSiblingSite->GetZOrder(zOrder);
+
+ if(zOrder > m_lZOrder && pSiblingSite->IsSiteVisible())
+ {
+ pSiblingSite->SubtractSite(m_pRegionWithoutChildren);
+ }
+ }
+ }
+ }
+
+ m_pRegion = RMACreateRegion();
+ RMAUnionRegion(m_pRegion, m_pRegionWithoutChildren, m_pRegion);
+
+ POSITION pos = m_pChildren.GetHeadPosition();
+ while(pos)
+ {
+ CRealMediaWindowlessSite* pChildSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pChildren.GetNext(pos);
+ if(pChildSite->IsSiteVisible()) pChildSite->SubtractSite(m_pRegion);
+ }
+ }
+ else
+ {
+ m_pRegionWithoutChildren = RMACreateRectRegion(0,0,0,0);
+ m_pRegion = RMACreateRectRegion(0,0,0,0);
+ }
+
+ if(pTempRegion && !RMAEqualRegion(m_pRegion, pTempRegion))
+ {
+ ForceRedraw();
+ }
+
+ RMADestroyRegion(pTempRegion);
+}
+
+void CRealMediaWindowlessSite::SubtractSite(REGION* pRegion)
+{
+ PNxPoint topLeft;
+ memset(&topLeft, 0, sizeof(PNxPoint));
+ GetTopLeft(&topLeft);
+
+ REGION* pTempRegion = RMACreateRectRegion(topLeft.x, topLeft.y, topLeft.x + m_size.cx, topLeft.y + m_size.cy);
+
+ RMASubtractRegion(pRegion, pTempRegion, pRegion);
+ RMADestroyRegion(pTempRegion);
+}
+
+void CRealMediaWindowlessSite::UpdateZOrder(CRealMediaWindowlessSite* pUpdatedChildSite, INT32 lOldZOrder, INT32 lNewZOrder)
+{
+ POSITION pos = m_pChildren.GetHeadPosition();
+ while(pos)
+ {
+ CRealMediaWindowlessSite* pSite = (CRealMediaWindowlessSite*)(IRMASite*)m_pChildren.GetNext(pos);
+
+ INT32 lItsOldZOrder;
+ pSite->GetZOrder(lItsOldZOrder);
+
+ if(pSite != pUpdatedChildSite)
+ {
+ if(lOldZOrder < lNewZOrder)
+ {
+ if(lItsOldZOrder >= lOldZOrder && lItsOldZOrder < lNewZOrder)
+ {
+ pSite->SetInternalZOrder(lItsOldZOrder-1);
+ }
+ }
+ else
+ {
+ if(lItsOldZOrder >= lNewZOrder && lItsOldZOrder < lOldZOrder)
+ {
+ pSite->SetInternalZOrder(lItsOldZOrder+1);
+ }
+ }
+ }
+ else
+ {
+ pSite->SetInternalZOrder(lNewZOrder);
+ }
+ }
+}
+
+void CRealMediaWindowlessSite::SetInternalZOrder(INT32 lZOrder)
+{
+ m_lZOrder = lZOrder;
+}
+
+// IRMASiteWindowless
+
+STDMETHODIMP CRealMediaWindowlessSite::EventOccurred(PNxEvent* /*IN*/ pEvent)
+{
+ return PNR_NOTIMPL; /* not necessary within our implementation */
+}
+
+STDMETHODIMP_(PNxWindow*) CRealMediaWindowlessSite::GetParentWindow()
+{
+ return NULL;
+}
+
+// IRMASite
+
+STDMETHODIMP CRealMediaWindowlessSite::AttachUser(IRMASiteUser* /*IN*/ pUser)
+{
+ HRESULT hr = PNR_FAIL;
+
+ if(m_pUser) return PNR_UNEXPECTED;
+
+ if(CComQIPtr<IRMASite, &IID_IRMASite> pOuterSite = GetOwner())
+ hr = pUser->AttachSite(pOuterSite);
+
+ if(PNR_OK == hr)
+ m_pUser = pUser;
+
+ return hr;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::DetachUser()
+{
+ HRESULT hr = PNR_OK;
+
+ if(!m_pUser) return PNR_UNEXPECTED;
+
+ hr = m_pUser->DetachSite();
+
+ if(PNR_OK == hr)
+ m_pUser = NULL;
+
+ return hr;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::GetUser(REF(IRMASiteUser*) /*OUT*/ pUser)
+{
+ HRESULT hr = PNR_OK;
+
+ if(!m_pUser) return PNR_UNEXPECTED;
+
+ (pUser = m_pUser)->AddRef();
+
+ return hr;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::CreateChild(REF(IRMASite*) /*OUT*/ pChildSite)
+{
+ HRESULT hr = PNR_OK;
+
+ CComPtr<IRMASite> pSite =
+ (IRMASite*)new CRealMediaWindowlessSite(hr, m_pContext, this);
+
+ if(FAILED(hr) || !pSite)
+ return E_FAIL;
+
+ pChildSite = pSite.Detach();
+
+ m_pChildren.AddTail(pChildSite);
+
+ return hr;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::DestroyChild(IRMASite* /*IN*/ pChildSite)
+{
+ if(POSITION pos = m_pChildren.Find(pChildSite))
+ {
+ m_pChildren.RemoveAt(pos);
+ return PNR_OK;
+ }
+
+ return PNR_UNEXPECTED;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::AttachWatcher(IRMASiteWatcher* /*IN*/ pWatcher)
+{
+ if(m_pWatcher) return PNR_UNEXPECTED;
+
+ if(m_pWatcher = pWatcher)
+ m_pWatcher->AttachSite((IRMASite*)this);
+
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::DetachWatcher()
+{
+ if(!m_pWatcher) return PNR_UNEXPECTED;
+
+ m_pWatcher->DetachSite();
+ m_pWatcher = NULL;
+
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::SetPosition(PNxPoint position)
+{
+ HRESULT hr = PNR_OK;
+
+ if(m_pWatcher)
+ {
+ hr = m_pWatcher->ChangingPosition(m_position, position);
+ }
+
+ if(PNR_OK == hr)
+ {
+ m_position = position;
+
+ POSITION pos = m_pPassiveWatchers.GetHeadPosition();
+ while(pos) m_pPassiveWatchers.GetNext(pos)->PositionChanged(&position);
+
+ RecomputeRegion();
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::GetPosition(REF(PNxPoint) position)
+{
+ position = m_position;
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::SetSize(PNxSize size)
+{
+ HRESULT hr = PNR_OK;
+
+ if(m_pWatcher)
+ {
+ hr = m_pWatcher->ChangingSize(m_size, size);
+ }
+
+ if(PNR_OK == hr && size.cx != 0 && size.cy != 0)
+ {
+ m_size = size;
+
+ POSITION pos = m_pPassiveWatchers.GetHeadPosition();
+ while(pos) m_pPassiveWatchers.GetNext(pos)->SizeChanged(&size);
+
+ RecomputeRegion();
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::GetSize(REF(PNxSize) size)
+{
+ size = m_size;
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::DamageRect(PNxRect rect)
+{
+ m_fDamaged = TRUE;
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::DamageRegion(PNxRegion region)
+{
+ m_fDamaged = TRUE;
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::ForceRedraw()
+{
+ // make sure we have a visible window and are not re-enterering and we have damage
+ if(!m_fInRedraw && m_fDamaged && m_fIsVisible)
+ {
+ m_fInRedraw = TRUE;
+
+ PNxEvent event = {RMA_SURFACE_UPDATE, NULL, (IRMAVideoSurface*)this, NULL, 0, 0};
+ m_pUser->HandleEvent(&event);
+
+ m_fInRedraw = FALSE;
+ m_fDamaged = FALSE;
+ }
+
+ return PNR_OK;
+}
+
+// IRMASite2
+
+STDMETHODIMP CRealMediaWindowlessSite::UpdateSiteWindow(PNxWindow* /*IN*/ pWindow)
+{
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::ShowSite(BOOL bShow)
+{
+ m_fIsVisible = !!bShow;
+ RecomputeRegion();
+ return PNR_OK;
+}
+
+STDMETHODIMP_(BOOL) CRealMediaWindowlessSite::IsSiteVisible()
+{
+ BOOL fIsVisible = m_fIsVisible;
+ if(m_pParentSite) fIsVisible = fIsVisible && m_pParentSite->IsSiteVisible();
+ return fIsVisible;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::SetZOrder(INT32 lZOrder)
+{
+ if(!m_pParentSite) return PNR_UNEXPECTED;
+
+ if(lZOrder == -1 || lZOrder >= (INT32)m_pParentSite->GetNumberOfChildSites())
+ lZOrder = m_pParentSite->GetNumberOfChildSites() - 1;
+
+ if(m_lZOrder != lZOrder)
+ m_pParentSite->UpdateZOrder(this, m_lZOrder, lZOrder);
+
+ m_lZOrder = lZOrder;
+
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::GetZOrder(REF(INT32) lZOrder)
+{
+ if(!m_pParentSite) return PNR_UNEXPECTED;
+ lZOrder = m_lZOrder;
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::MoveSiteToTop()
+{
+ if(!m_pParentSite) return PNR_UNEXPECTED;
+ return PNR_NOTIMPL;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::GetVideoSurface(REF(IRMAVideoSurface*) pSurface)
+{
+ (pSurface = (IRMAVideoSurface*)this)->AddRef();
+ return PNR_OK;
+}
+
+STDMETHODIMP_(UINT32) CRealMediaWindowlessSite::GetNumberOfChildSites()
+{
+ return (UINT32)m_pChildren.GetCount();
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::AddPassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher)
+{
+ m_pPassiveWatchers.AddTail(pWatcher);
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::RemovePassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher)
+{
+ if(POSITION pos = m_pPassiveWatchers.Find(pWatcher))
+ {
+ m_pPassiveWatchers.RemoveAt(pos);
+ return PNR_OK;
+ }
+
+ return PNR_UNEXPECTED;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::SetCursor(PNxCursor cursor, REF(PNxCursor) oldCursor)
+{
+ return PNR_NOTIMPL;
+}
+
+// private
+
+void CRealMediaWindowlessSite::IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal)
+{
+ pRetVal->left = max(pRect->left, pBox->left);
+ pRetVal->top = max(pRect->top, pBox->top);
+ pRetVal->right = min(pRect->right, pBox->right);
+ pRetVal->bottom = min(pRect->bottom, pBox->bottom);
+}
+
+// protected
+
+bool CRealMediaWindowlessSite::GetBltService(IRMAVideoSurface** ppBltService)
+{
+ bool fRet = false;
+
+ if(ppBltService)
+ {
+ if(m_pParentSite)
+ {
+ fRet = m_pParentSite->GetBltService(ppBltService);
+ }
+ else if(m_pBltService)
+ {
+ (*ppBltService = m_pBltService)->AddRef();
+ fRet = true;
+ }
+ }
+
+ return(fRet);
+}
+
+void CRealMediaWindowlessSite::SetBltService(IRMAVideoSurface* pBltService)
+{
+ m_pBltService = pBltService;
+}
+
+// IRMAVideoSurface
+
+STDMETHODIMP CRealMediaWindowlessSite::Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect)
+{
+ BeginOptimizedBlt(pBitmapInfo);
+ return OptimizedBlt(pImageData, inDestRect, inSrcRect);
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo)
+{
+ if(memcmp(&m_bitmapInfo, pBitmapInfo, sizeof(RMABitmapInfoHeader)))
+ {
+ memcpy(&m_bitmapInfo, pBitmapInfo, sizeof(RMABitmapInfoHeader));
+
+ // format of image has changed somehow.
+ // do something here if this affects you.
+ }
+
+/*
+ CComPtr<IRMAVideoSurface> pBltService;
+ GetBltService(&pBltService);
+ if(!pBltService)
+ return PNR_UNEXPECTED;
+
+ RMA_COMPRESSION_TYPE ulType = (RMA_COMPRESSION_TYPE)-1;
+ pBltService->GetPreferredFormat(ulType);
+
+ if(pBitmapInfo->biCompression != ulType)
+ return PNR_UNEXPECTED;
+*/
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect)
+{
+ CComPtr<IRMAVideoSurface> pBltService;
+ GetBltService(&pBltService);
+
+ REGION* pRegion = GetRegion();
+
+ if(!pBltService || !pRegion)
+ return PNR_UNEXPECTED;
+
+ PNxPoint origin;
+ memset(&origin, 0, sizeof(PNxPoint));
+ GetTopLeft(&origin);
+ PNxRect adjustedDestRect;
+ adjustedDestRect.left = rDestRect.left + origin.x;
+ adjustedDestRect.top = rDestRect.top + origin.y;
+ adjustedDestRect.right = rDestRect.right + origin.x;
+ adjustedDestRect.bottom = rDestRect.bottom + origin.y;
+
+ for(int i = 0; i < pRegion->numRects; i++)
+ {
+ PNxRect* pRect = pRegion->rects+i;
+
+ // intersect the dest rect with the rect from the
+ // region to get the final dest rect.
+ PNxRect finalDestRect;
+ IntersectRect(&adjustedDestRect, pRect, &finalDestRect);
+
+ // now compute the src rect for this blt.
+ double xStretch = (double) (rDestRect.right - rDestRect.left) / (double) (rSrcRect.right - rSrcRect.left);
+ double yStretch = (double) (rDestRect.bottom - rDestRect.top) / (double) (rSrcRect.bottom - rSrcRect.top);
+
+ PNxRect finalSrcRect;
+ finalSrcRect.left = (INT32)((double)(finalDestRect.left-origin.x) / xStretch + 0.5);
+ finalSrcRect.top = (INT32)((double)(finalDestRect.top-origin.y) / yStretch + 0.5);
+ finalSrcRect.right = (INT32)((double)(finalDestRect.right-origin.x) / xStretch + 0.5);
+ finalSrcRect.bottom = (INT32)((double)(finalDestRect.bottom-origin.y) / yStretch + 0.5);
+
+ pBltService->Blt(pImageBits, &m_bitmapInfo, finalDestRect, finalSrcRect);
+ }
+
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::EndOptimizedBlt()
+{
+ memset(&m_bitmapInfo, 0, sizeof(m_bitmapInfo));
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType)
+{
+ ulType = m_bitmapInfo.biCompression;
+ return PNR_OK;
+}
+
+STDMETHODIMP CRealMediaWindowlessSite::GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType)
+{
+ CComPtr<IRMAVideoSurface> pBltService;
+ GetBltService(&pBltService);
+ if(!pBltService)
+ return PNR_UNEXPECTED;
+
+ return pBltService->GetPreferredFormat(ulType);
+}
diff --git a/src/apps/mplayerc/RealMediaWindowlessSite.h b/src/apps/mplayerc/RealMediaWindowlessSite.h
new file mode 100644
index 000000000..d96f49d94
--- /dev/null
+++ b/src/apps/mplayerc/RealMediaWindowlessSite.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\..\include\RealMedia\pntypes.h"
+#include "..\..\..\include\RealMedia\pnwintyp.h"
+#include "..\..\..\include\RealMedia\pncom.h"
+#include "..\..\..\include\RealMedia\rmapckts.h"
+#include "..\..\..\include\RealMedia\rmacomm.h"
+#include "..\..\..\include\RealMedia\rmamon.h"
+#include "..\..\..\include\RealMedia\rmafiles.h"
+#include "..\..\..\include\RealMedia\rmaengin.h"
+#include "..\..\..\include\RealMedia\rmacore.h"
+#include "..\..\..\include\RealMedia\rmaclsnk.h"
+#include "..\..\..\include\RealMedia\rmaerror.h"
+#include "..\..\..\include\RealMedia\rmaauth.h"
+#include "..\..\..\include\RealMedia\rmawin.h"
+#include "..\..\..\include\RealMedia\rmasite2.h"
+#include "..\..\..\include\RealMedia\rmaausvc.h"
+#include "..\..\..\include\RealMedia\rmavsurf.h"
+#include "..\..\..\include\RealMedia\rmaevent.h"
+
+namespace DSObjects
+{
+
+struct REGION
+{
+ REGION() : rects(0), pOSRegion(0) {}
+ long size;
+ long numRects;
+ PNxRect* rects;
+ PNxRect extents;
+ void* pOSRegion;
+};
+
+void ExtractRects(REGION* pRegion);
+REGION* RMACreateRectRegion(int left, int top, int right, int bottom);
+void RMASubtractRegion(REGION* regM, REGION* regS, REGION* regD);
+void RMAUnionRegion(REGION* reg1, REGION* reg2, REGION* regD);
+void RMAIntersectRegion(REGION* reg1, REGION* reg2, REGION* regD);
+BOOL RMAEqualRegion(REGION* reg1, REGION* reg2);
+void RMADestroyRegion(REGION* reg);
+REGION* RMACreateRegion();
+
+class CRealMediaWindowlessSite;
+
+//
+// CRealMediaVideoSurface
+//
+
+class CRealMediaWindowlessSite;
+
+class CRealMediaVideoSurface
+ : public CUnknown
+ , public IRMAVideoSurface
+{
+ void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
+
+protected:
+ CComPtr<IUnknown> m_pContext;
+ CRealMediaWindowlessSite* m_pSiteWindowless;
+ RMABitmapInfoHeader m_bitmapInfo;
+ RMABitmapInfoHeader m_lastBitmapInfo;
+
+public:
+ CRealMediaVideoSurface(IUnknown* pContext, CRealMediaWindowlessSite* pSiteWindowless);
+ virtual ~CRealMediaVideoSurface();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IRMAVideoSurface
+
+ STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
+ STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
+ STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
+ STDMETHODIMP EndOptimizedBlt();
+ STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
+ STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
+};
+
+//
+// CRealMediaWindowlessSite
+//
+
+class CRealMediaWindowlessSite
+ : public CUnknown
+ , public IRMASite
+ , public IRMASite2
+ , public IRMASiteWindowless
+ , public IRMAVideoSurface
+{
+ CComQIPtr<IRMACommonClassFactory, &IID_IRMACommonClassFactory> m_pCCF;
+ CComPtr<IUnknown> m_pContext;
+ CComPtr<IRMAValues> m_pValues;
+
+ CComPtr<IRMASiteUser> m_pUser;
+
+ CRealMediaWindowlessSite* m_pParentSite;
+ CInterfaceList<IRMASite, &IID_IRMASite> m_pChildren;
+
+ CComPtr<IRMASiteWatcher> m_pWatcher;
+ CInterfaceList<IRMAPassiveSiteWatcher, &IID_IRMAPassiveSiteWatcher> m_pPassiveWatchers;
+
+ PNxSize m_size;
+ PNxPoint m_position;
+ bool m_fDamaged, m_fInRedraw, m_fIsVisible;
+ INT32 m_lZOrder;
+
+ //
+
+ REGION* m_pRegion;
+ REGION* m_pRegionWithoutChildren;
+
+ void RecomputeRegion();
+ void InternalRecomputeRegion();
+ void ComputeRegion();
+ void SubtractSite(REGION* pRegion);
+
+ void UpdateZOrder(CRealMediaWindowlessSite* pUpdatedChildSite, INT32 lOldZOrder, INT32 lNewZOrder);
+ void SetInternalZOrder(INT32 lZOrder);
+
+public:
+ CRealMediaWindowlessSite(HRESULT& hr, IUnknown* pContext, CRealMediaWindowlessSite* pParentSite = NULL, IUnknown* pUnkOuter = NULL);
+ virtual ~CRealMediaWindowlessSite();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ void GetTopLeft(PNxPoint* pPoint);
+ REGION* GetRegion();
+
+ // IRMASiteWindowless
+
+ STDMETHODIMP EventOccurred(PNxEvent* /*IN*/ pEvent);
+ STDMETHODIMP_(PNxWindow*) GetParentWindow();
+
+ // IRMASite
+
+ STDMETHODIMP AttachUser(IRMASiteUser* /*IN*/ pUser);
+ STDMETHODIMP DetachUser();
+ STDMETHODIMP GetUser(REF(IRMASiteUser*) /*OUT*/ pUser);
+
+ STDMETHODIMP CreateChild(REF(IRMASite*) /*OUT*/ pChildSite);
+ STDMETHODIMP DestroyChild(IRMASite* /*IN*/ pChildSite);
+
+ STDMETHODIMP AttachWatcher(IRMASiteWatcher* /*IN*/ pWatcher);
+ STDMETHODIMP DetachWatcher();
+
+ STDMETHODIMP SetPosition(PNxPoint position);
+ STDMETHODIMP GetPosition(REF(PNxPoint) position);
+ STDMETHODIMP SetSize(PNxSize size);
+ STDMETHODIMP GetSize(REF(PNxSize) size);
+
+ STDMETHODIMP DamageRect(PNxRect rect);
+ STDMETHODIMP DamageRegion(PNxRegion region);
+ STDMETHODIMP ForceRedraw();
+
+ // IRMASite2
+
+ STDMETHODIMP UpdateSiteWindow(PNxWindow* /*IN*/ pWindow);
+ STDMETHODIMP ShowSite(BOOL bShow);
+ STDMETHODIMP_(BOOL) IsSiteVisible();
+ STDMETHODIMP SetZOrder(INT32 lZOrder);
+ STDMETHODIMP GetZOrder(REF(INT32) lZOrder);
+ STDMETHODIMP MoveSiteToTop();
+ STDMETHODIMP GetVideoSurface(REF(IRMAVideoSurface*) pSurface);
+ STDMETHODIMP_(UINT32) GetNumberOfChildSites();
+
+ STDMETHODIMP AddPassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
+ STDMETHODIMP RemovePassiveSiteWatcher(IRMAPassiveSiteWatcher* pWatcher);
+
+ STDMETHODIMP SetCursor(PNxCursor cursor, REF(PNxCursor) oldCursor);
+
+private:
+ void IntersectRect(PNxRect* pRect, PNxRect* pBox, PNxRect* pRetVal);
+
+protected:
+ RMABitmapInfoHeader m_bitmapInfo;
+ RMABitmapInfoHeader m_lastBitmapInfo;
+
+ CComPtr<IRMAVideoSurface> m_pBltService;
+
+public:
+ bool GetBltService(IRMAVideoSurface** ppBltService);
+ void SetBltService(IRMAVideoSurface* ppBltService);
+
+ // IRMAVideoSurface
+
+ STDMETHODIMP Blt(UCHAR* /*IN*/ pImageData, RMABitmapInfoHeader* /*IN*/ pBitmapInfo, REF(PNxRect) /*IN*/ inDestRect, REF(PNxRect) /*IN*/ inSrcRect);
+ STDMETHODIMP BeginOptimizedBlt(RMABitmapInfoHeader* /*IN*/ pBitmapInfo);
+ STDMETHODIMP OptimizedBlt(UCHAR* /*IN*/ pImageBits, REF(PNxRect) /*IN*/ rDestRect, REF(PNxRect) /*IN*/ rSrcRect);
+ STDMETHODIMP EndOptimizedBlt();
+ STDMETHODIMP GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
+ STDMETHODIMP GetPreferredFormat(REF(RMA_COMPRESSION_TYPE) /*OUT*/ ulType);
+};
+
+}
+using namespace DSObjects;
diff --git a/src/apps/mplayerc/RegFilterChooserDlg.cpp b/src/apps/mplayerc/RegFilterChooserDlg.cpp
new file mode 100644
index 000000000..c9372c87f
--- /dev/null
+++ b/src/apps/mplayerc/RegFilterChooserDlg.cpp
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// RegFilterChooserDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include <dmo.h>
+#include "RegFilterChooserDlg.h"
+#include "FGFilter.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+
+// CRegFilterChooserDlg dialog
+
+//IMPLEMENT_DYNAMIC(CRegFilterChooserDlg, CResizableDialog)
+CRegFilterChooserDlg::CRegFilterChooserDlg(CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CRegFilterChooserDlg::IDD, pParent)
+{
+}
+
+CRegFilterChooserDlg::~CRegFilterChooserDlg()
+{
+ POSITION pos = m_filters.GetHeadPosition();
+ while(pos) delete m_filters.GetNext(pos);
+}
+
+void CRegFilterChooserDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST2, m_list);
+}
+
+void CRegFilterChooserDlg::AddToList(IMoniker* pMoniker)
+{
+ CComPtr<IPropertyBag> pPB;
+ if(SUCCEEDED(pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)&pPB)))
+ {
+ CComVariant var;
+ if(SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ {
+ m_list.SetItemData(
+ m_list.InsertItem(-1, CString(CStringW(var.bstrVal))),
+ (DWORD_PTR)m_monikers.AddTail(pMoniker));
+ }
+ }
+
+}
+
+
+BEGIN_MESSAGE_MAP(CRegFilterChooserDlg, CResizableDialog)
+ ON_LBN_DBLCLK(IDC_LIST1, OnLbnDblclkList1)
+ ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOK)
+ ON_BN_CLICKED(IDOK, OnBnClickedOk)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnNMDblclkList2)
+END_MESSAGE_MAP()
+
+
+// CRegFilterChooserDlg message handlers
+
+BOOL CRegFilterChooserDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ BeginEnumSysDev(CLSID_LegacyAmFilterCategory, pMoniker)
+ {
+ AddToList(pMoniker);
+ }
+ EndEnumSysDev
+
+ BeginEnumSysDev(DMOCATEGORY_VIDEO_EFFECT, pMoniker)
+ {
+ AddToList(pMoniker);
+ }
+ EndEnumSysDev
+
+ BeginEnumSysDev(DMOCATEGORY_AUDIO_EFFECT, pMoniker)
+ {
+ AddToList(pMoniker);
+ }
+ EndEnumSysDev
+
+ AddAnchor(IDC_LIST2, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON1, BOTTOM_LEFT);
+ AddAnchor(IDOK, BOTTOM_RIGHT);
+ AddAnchor(IDCANCEL, BOTTOM_RIGHT);
+
+ SetMinTrackSize(CSize(300,100));
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CRegFilterChooserDlg::OnLbnDblclkList1()
+{
+ SendMessage(WM_COMMAND, IDOK);
+}
+
+void CRegFilterChooserDlg::OnUpdateOK(CCmdUI* pCmdUI)
+{
+ pCmdUI->Enable(!!m_list.GetFirstSelectedItemPosition());
+}
+
+void CRegFilterChooserDlg::OnBnClickedOk()
+{
+ CComPtr<IMoniker> pMoniker;
+
+ POSITION pos = m_list.GetFirstSelectedItemPosition();
+ if(pos) pos = (POSITION)m_list.GetItemData(m_list.GetNextSelectedItem(pos));
+ if(pos) pMoniker = m_monikers.GetAt(pos);
+ if(pMoniker)
+ {
+ CFGFilterRegistry fgf(pMoniker);
+ FilterOverride* f = new FilterOverride;
+ f->fDisabled = false;
+ f->type = FilterOverride::REGISTERED;
+ f->name = fgf.GetName();
+ f->dispname = fgf.GetDisplayName();
+ f->guids.AddTailList(&fgf.GetTypes());
+ f->backup.AddTailList(&fgf.GetTypes());
+ f->dwMerit = fgf.GetMeritForDirectShow();
+ f->iLoadType = FilterOverride::MERIT;
+ m_filters.AddTail(f);
+ }
+
+ __super::OnOK();
+}
+
+void CRegFilterChooserDlg::OnBnClickedButton1()
+{
+ CFileDialog dlg(TRUE, NULL, NULL,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
+ _T("DirectShow Filters (*.dll,*.ax)|*.dll;*.ax|"), this, 0);
+
+ if(dlg.DoModal() == IDOK)
+ {
+ CFilterMapper2 fm2(false);
+ fm2.Register(dlg.GetPathName());
+ m_filters.AddTail(&fm2.m_filters);
+ fm2.m_filters.RemoveAll();
+
+ __super::OnOK();
+ }
+}
+
+void CRegFilterChooserDlg::OnNMDblclkList2(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ if(m_list.GetFirstSelectedItemPosition())
+ {
+ OnBnClickedOk();
+ }
+
+ *pResult = 0;
+}
diff --git a/src/apps/mplayerc/RegFilterChooserDlg.h b/src/apps/mplayerc/RegFilterChooserDlg.h
new file mode 100644
index 000000000..33ab06202
--- /dev/null
+++ b/src/apps/mplayerc/RegFilterChooserDlg.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "afxwin.h"
+
+// CRegFilterChooserDlg dialog
+
+class CRegFilterChooserDlg : public CResizableDialog
+{
+// DECLARE_DYNAMIC(CRegFilterChooserDlg)
+
+ CInterfaceList<IMoniker> m_monikers;
+ void AddToList(IMoniker* pMoniker);
+
+public:
+ CRegFilterChooserDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~CRegFilterChooserDlg();
+
+ CList<FilterOverride*> m_filters;
+
+// Dialog Data
+ enum { IDD = IDD_ADDREGFILTER };
+ CListCtrl m_list;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnLbnDblclkList1();
+ afx_msg void OnUpdateOK(CCmdUI* pCmdUI);
+ afx_msg void OnBnClickedOk();
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnNMDblclkList2(NMHDR *pNMHDR, LRESULT *pResult);
+};
diff --git a/src/apps/mplayerc/Release Unicode/d3dx9_28.dll b/src/apps/mplayerc/Release Unicode/d3dx9_28.dll
new file mode 100644
index 000000000..fde5bd447
--- /dev/null
+++ b/src/apps/mplayerc/Release Unicode/d3dx9_28.dll
Binary files differ
diff --git a/src/apps/mplayerc/SaveDlg.cpp b/src/apps/mplayerc/SaveDlg.cpp
new file mode 100644
index 000000000..83fa2dcb8
--- /dev/null
+++ b/src/apps/mplayerc/SaveDlg.cpp
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// SaveDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "SaveDlg.h"
+#include "..\..\filters\filters.h"
+
+
+// CSaveDlg dialog
+
+IMPLEMENT_DYNAMIC(CSaveDlg, CCmdUIDialog)
+CSaveDlg::CSaveDlg(CString in, CString out, CWnd* pParent /*=NULL*/)
+ : CCmdUIDialog(CSaveDlg::IDD, pParent)
+ , m_in(in), m_out(out)
+ , m_nIDTimerEvent(-1)
+{
+}
+
+CSaveDlg::~CSaveDlg()
+{
+}
+
+void CSaveDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CCmdUIDialog::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_ANIMATE1, m_anim);
+ DDX_Control(pDX, IDC_PROGRESS1, m_progress);
+ DDX_Control(pDX, IDC_REPORT, m_report);
+ DDX_Control(pDX, IDC_FROMTO, m_fromto);
+}
+
+
+BEGIN_MESSAGE_MAP(CSaveDlg, CCmdUIDialog)
+ ON_BN_CLICKED(IDCANCEL, OnBnClickedCancel)
+ ON_MESSAGE(WM_GRAPHNOTIFY, OnGraphNotify)
+ ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+
+// CSaveDlg message handlers
+
+BOOL CSaveDlg::OnInitDialog()
+{
+ CCmdUIDialog::OnInitDialog();
+
+ m_anim.Open(IDR_AVI_FILECOPY);
+ m_anim.Play(0, -1, -1);
+
+ CString str, in = m_in, out = m_out;
+ if(in.GetLength() > 60) in = in.Left(17) + _T("..") + in.Right(43);
+ if(out.GetLength() > 60) out = out.Left(17) + _T("..") + out.Right(43);
+ str.Format(_T("%s\r\n%s"), in, out);
+ m_fromto.SetWindowText(str);
+
+ m_progress.SetRange(0, 100);
+
+ if(FAILED(pGB.CoCreateInstance(CLSID_FilterGraph)) || !(pMC = pGB) || !(pME = pGB) || !(pMS = pGB)
+ || FAILED(pME->SetNotifyWindow((OAHWND)m_hWnd, WM_GRAPHNOTIFY, 0)))
+ {
+ m_report.SetWindowText(_T("Error"));
+ return FALSE;
+ }
+
+ HRESULT hr;
+
+ CStringW fnw = m_in;
+ CComPtr<IFileSourceFilter> pReader;
+
+ if(!pReader && m_in.Mid(m_in.ReverseFind('.')+1).MakeLower() == _T("cda"))
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)new CCDDAReader(NULL, &hr);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ pReader.Release();
+ }
+
+ if(!pReader)
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)new CCDXAReader(NULL, &hr);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ pReader.Release();
+ }
+
+ if(!pReader /*&& ext == _T("ifo")*/)
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)new CVTSReader(NULL, &hr);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ pReader.Release();
+ else
+ {
+ CPath pout(m_out);
+ pout.RenameExtension(_T(".ifo"));
+ CopyFile(m_in, pout, FALSE);
+ }
+ }
+
+ if(!pReader)
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk;
+ pUnk.CoCreateInstance(CLSID_AsyncReader);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(pReader->Load(fnw, NULL)))
+ pReader.Release();
+ }
+
+ if(!pReader)
+ {
+ hr = S_OK;
+ CComPtr<IUnknown> pUnk;
+ pUnk.CoCreateInstance(CLSID_URLReader);
+ if(FAILED(hr) || !(pReader = pUnk) || FAILED(hr = pReader->Load(fnw, NULL)))
+ pReader.Release();
+ }
+
+ CComQIPtr<IBaseFilter> pSrc = pReader;
+ if(FAILED(pGB->AddFilter(pSrc, fnw)))
+ {
+ m_report.SetWindowText(_T("Sorry, can't save this file, press cancel"));
+ return FALSE;
+ }
+
+ CComQIPtr<IBaseFilter> pMid = new CStreamDriveThruFilter(NULL, &hr);
+ if(FAILED(pGB->AddFilter(pMid, L"StreamDriveThru")))
+ {
+ m_report.SetWindowText(_T("Error"));
+ return FALSE;
+ }
+
+ CComQIPtr<IBaseFilter> pDst;
+ pDst.CoCreateInstance(CLSID_FileWriter);
+ CComQIPtr<IFileSinkFilter2> pFSF = pDst;
+ pFSF->SetFileName(CStringW(m_out), NULL);
+ pFSF->SetMode(AM_FILE_OVERWRITE);
+ if(FAILED(pGB->AddFilter(pDst, L"File Writer")))
+ {
+ m_report.SetWindowText(_T("Error"));
+ return FALSE;
+ }
+
+ hr = pGB->Connect(
+ GetFirstPin((pSrc), PINDIR_OUTPUT),
+ GetFirstPin((pMid), PINDIR_INPUT));
+
+ hr = pGB->Connect(
+ GetFirstPin((pMid), PINDIR_OUTPUT),
+ GetFirstPin((pDst), PINDIR_INPUT));
+
+pMS = pMid;
+
+ pMC->Run();
+
+ m_nIDTimerEvent = SetTimer(1, 1000, NULL);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CSaveDlg::OnBnClickedCancel()
+{
+ if(pMC) pMC->Stop();
+
+ OnCancel();
+}
+
+LRESULT CSaveDlg::OnGraphNotify(WPARAM wParam, LPARAM lParam)
+{
+ LONG evCode, evParam1, evParam2;
+ while(pME && SUCCEEDED(pME->GetEvent(&evCode, (LONG_PTR*)&evParam1, (LONG_PTR*)&evParam2, 0)))
+ {
+ HRESULT hr = pME->FreeEventParams(evCode, evParam1, evParam2);
+
+ if(EC_COMPLETE == evCode)
+ {
+ EndDialog(IDOK);
+ }
+ else if(EC_ERRORABORT == evCode)
+ {
+ TRACE(_T("CSaveDlg::OnGraphNotify / EC_ERRORABORT, hr = %08x\n"), (HRESULT)evParam1);
+ m_report.SetWindowText(_T("Copying unexpectedly terminated!"));
+ }
+ }
+
+ return 0;
+}
+
+void CSaveDlg::OnTimer(UINT nIDEvent)
+{
+ if(nIDEvent == m_nIDTimerEvent && pGB)
+ {
+ if(pMS)
+ {
+ CString str;
+ REFERENCE_TIME pos = 0, dur = 0;
+ pMS->GetCurrentPosition(&pos);
+ pMS->GetDuration(&dur);
+ REFERENCE_TIME time = 0;
+ CComQIPtr<IMediaSeeking>(pGB)->GetCurrentPosition(&time);
+ REFERENCE_TIME speed = time > 0 ? pos*10000000/time / 1024 : 0i64;
+ str.Format(_T("%I64d/%I64d KB, %I64d KB/s, %I64d s"),
+ pos/1024, dur/1024, speed, speed > 0 ? (dur-pos)/1024 / speed : 0);
+ m_report.SetWindowText(str);
+
+ m_progress.SetPos(dur > 0 ? (int)(100*pos/dur) : 0);
+ }
+ }
+
+ CCmdUIDialog::OnTimer(nIDEvent);
+}
diff --git a/src/apps/mplayerc/SaveDlg.h b/src/apps/mplayerc/SaveDlg.h
new file mode 100644
index 000000000..507324e61
--- /dev/null
+++ b/src/apps/mplayerc/SaveDlg.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "afxcmn.h"
+#include "afxwin.h"
+
+// CSaveDlg dialog
+
+class CSaveDlg : public CCmdUIDialog
+{
+ DECLARE_DYNAMIC(CSaveDlg)
+
+private:
+ CString m_in, m_out;
+ CComPtr<IGraphBuilder> pGB;
+ CComQIPtr<IMediaControl> pMC;
+ CComQIPtr<IMediaEventEx> pME;
+ CComQIPtr<IMediaSeeking> pMS;
+ UINT_PTR m_nIDTimerEvent;
+
+public:
+ CSaveDlg(CString in, CString out, CWnd* pParent = NULL); // standard constructor
+ virtual ~CSaveDlg();
+
+// Dialog Data
+ enum { IDD = IDD_SAVE_DLG };
+ CAnimateCtrl m_anim;
+ CProgressCtrl m_progress;
+ CStatic m_report;
+ CStatic m_fromto;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnBnClickedCancel();
+ afx_msg void OnTimer(UINT nIDEvent);
+ afx_msg LRESULT OnGraphNotify(WPARAM wParam, LPARAM lParam);
+};
diff --git a/src/apps/mplayerc/SaveTextFileDialog.cpp b/src/apps/mplayerc/SaveTextFileDialog.cpp
new file mode 100644
index 000000000..c4c21a560
--- /dev/null
+++ b/src/apps/mplayerc/SaveTextFileDialog.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// SaveTextFileDialog.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "SaveTextFileDialog.h"
+
+
+// CSaveTextFileDialog
+
+IMPLEMENT_DYNAMIC(CSaveTextFileDialog, CFileDialog)
+CSaveTextFileDialog::CSaveTextFileDialog(
+ CTextFile::enc e,
+ LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
+ LPCTSTR lpszFilter, CWnd* pParentWnd) :
+ CFileDialog(FALSE, lpszDefExt, lpszFileName,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
+ lpszFilter, pParentWnd, 0),
+ m_e(e)
+{
+ if(m_ofn.lStructSize == sizeof(OPENFILENAME))
+ {
+ SetTemplate(0, IDD_SAVETEXTFILEDIALOGTEMPL);
+ }
+ else /*if(m_ofn.lStructSize == OPENFILENAME_SIZE_VERSION_400)*/
+ {
+ SetTemplate(0, IDD_SAVETEXTFILEDIALOGTEMPL_400);
+ }
+}
+
+CSaveTextFileDialog::~CSaveTextFileDialog()
+{
+}
+
+void CSaveTextFileDialog::DoDataExchange(CDataExchange* pDX)
+{
+ DDX_Control(pDX, IDC_COMBO1, m_encoding);
+ __super::DoDataExchange(pDX);
+}
+
+BOOL CSaveTextFileDialog::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ m_encoding.SetItemData(m_encoding.AddString(_T("ANSI")), CTextFile::ASCII);
+ m_encoding.SetItemData(m_encoding.AddString(_T("Unicode 16-LE")), CTextFile::LE16);
+ m_encoding.SetItemData(m_encoding.AddString(_T("Unicode 16-BE")), CTextFile::BE16);
+ m_encoding.SetItemData(m_encoding.AddString(_T("UTF-8")), CTextFile::UTF8);
+
+ switch(m_e)
+ {
+ default:
+ case CTextFile::ASCII: m_encoding.SetCurSel(0); break;
+ case CTextFile::LE16: m_encoding.SetCurSel(1); break;
+ case CTextFile::BE16: m_encoding.SetCurSel(2); break;
+ case CTextFile::UTF8: m_encoding.SetCurSel(3); break;
+ }
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BEGIN_MESSAGE_MAP(CSaveTextFileDialog, CFileDialog)
+END_MESSAGE_MAP()
+
+// CSaveTextFileDialog message handlers
+
+BOOL CSaveTextFileDialog::OnFileNameOK()
+{
+ m_e = (CTextFile::enc)m_encoding.GetItemData(m_encoding.GetCurSel());
+ return __super::OnFileNameOK();
+}
diff --git a/src/apps/mplayerc/SaveTextFileDialog.h b/src/apps/mplayerc/SaveTextFileDialog.h
new file mode 100644
index 000000000..a6b9d24a1
--- /dev/null
+++ b/src/apps/mplayerc/SaveTextFileDialog.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\subtitles\TextFile.h"
+
+// CSaveTextFileDialog
+
+class CSaveTextFileDialog : public CFileDialog
+{
+ DECLARE_DYNAMIC(CSaveTextFileDialog)
+
+private:
+ CTextFile::enc m_e;
+
+public:
+ CSaveTextFileDialog(
+ CTextFile::enc e,
+ LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL,
+ LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL);
+ virtual ~CSaveTextFileDialog();
+
+ CComboBox m_encoding;
+
+ CTextFile::enc GetEncoding() {return(m_e);}
+
+protected:
+ DECLARE_MESSAGE_MAP()
+ virtual void DoDataExchange(CDataExchange* pDX);
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnFileNameOK();
+
+public:
+ afx_msg void OnEncodingChange();
+};
+
+
diff --git a/src/apps/mplayerc/SaveThumbnailsDialog.cpp b/src/apps/mplayerc/SaveThumbnailsDialog.cpp
new file mode 100644
index 000000000..66723d716
--- /dev/null
+++ b/src/apps/mplayerc/SaveThumbnailsDialog.cpp
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// SaveThumbnailsDialog.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "SaveThumbnailsDialog.h"
+
+
+// CSaveThumbnailsDialog
+
+IMPLEMENT_DYNAMIC(CSaveThumbnailsDialog, CFileDialog)
+CSaveThumbnailsDialog::CSaveThumbnailsDialog(
+ int rows, int cols, int width,
+ LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
+ LPCTSTR lpszFilter, CWnd* pParentWnd) :
+ CFileDialog(FALSE, lpszDefExt, lpszFileName,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
+ lpszFilter, pParentWnd, 0),
+ m_rows(rows), m_cols(cols), m_width(width)
+{
+ if(m_ofn.lStructSize == sizeof(OPENFILENAME))
+ {
+ SetTemplate(0, IDD_SAVETHUMBSDIALOGTEMPL);
+ }
+ else /*if(m_ofn.lStructSize == OPENFILENAME_SIZE_VERSION_400)*/
+ {
+ SetTemplate(0, IDD_SAVETHUMBSDIALOGTEMPL_400);
+ }
+}
+
+CSaveThumbnailsDialog::~CSaveThumbnailsDialog()
+{
+}
+
+void CSaveThumbnailsDialog::DoDataExchange(CDataExchange* pDX)
+{
+ DDX_Control(pDX, IDC_SPIN1, m_rowsctrl);
+ DDX_Control(pDX, IDC_SPIN2, m_colsctrl);
+ DDX_Control(pDX, IDC_SPIN3, m_widthctrl);
+ __super::DoDataExchange(pDX);
+}
+
+BOOL CSaveThumbnailsDialog::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ m_rowsctrl.SetRange(0, 8);
+ m_colsctrl.SetRange(0, 8);
+ m_widthctrl.SetRange(256, 2048);
+ m_rowsctrl.SetPos(m_rows);
+ m_colsctrl.SetPos(m_cols);
+ m_widthctrl.SetPos(m_width);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+BEGIN_MESSAGE_MAP(CSaveThumbnailsDialog, CFileDialog)
+END_MESSAGE_MAP()
+
+// CSaveThumbnailsDialog message handlers
+
+BOOL CSaveThumbnailsDialog::OnFileNameOK()
+{
+ m_rows = m_rowsctrl.GetPos();
+ m_cols = m_colsctrl.GetPos();
+ m_width = m_widthctrl.GetPos();
+
+ return __super::OnFileNameOK();
+}
diff --git a/src/apps/mplayerc/SaveThumbnailsDialog.h b/src/apps/mplayerc/SaveThumbnailsDialog.h
new file mode 100644
index 000000000..646be2103
--- /dev/null
+++ b/src/apps/mplayerc/SaveThumbnailsDialog.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CSaveThumbnailsDialog
+
+class CSaveThumbnailsDialog : public CFileDialog
+{
+ DECLARE_DYNAMIC(CSaveThumbnailsDialog)
+
+public:
+ CSaveThumbnailsDialog(
+ int rows, int cols, int width,
+ LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL,
+ LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL);
+ virtual ~CSaveThumbnailsDialog();
+
+protected:
+ DECLARE_MESSAGE_MAP()
+ virtual void DoDataExchange(CDataExchange* pDX);
+ virtual BOOL OnInitDialog();
+ virtual BOOL OnFileNameOK();
+
+public:
+ int m_rows, m_cols, m_width;
+ CSpinButtonCtrl m_rowsctrl;
+ CSpinButtonCtrl m_colsctrl;
+ CSpinButtonCtrl m_widthctrl;
+};
+
+
diff --git a/src/apps/mplayerc/SelectMediaType.cpp b/src/apps/mplayerc/SelectMediaType.cpp
new file mode 100644
index 000000000..d0e40197e
--- /dev/null
+++ b/src/apps/mplayerc/SelectMediaType.cpp
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// SelectMediaType.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "SelectMediaType.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+
+// CSelectMediaType dialog
+
+IMPLEMENT_DYNAMIC(CSelectMediaType, CCmdUIDialog)
+CSelectMediaType::CSelectMediaType(CAtlArray<GUID>& guids, GUID guid, CWnd* pParent /*=NULL*/)
+ : CCmdUIDialog(CSelectMediaType::IDD, pParent)
+ , m_guids(guids), m_guid(guid)
+{
+ m_guidstr = CStringFromGUID(guid);
+}
+
+CSelectMediaType::~CSelectMediaType()
+{
+}
+
+void CSelectMediaType::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_CBString(pDX, IDC_COMBO1, m_guidstr);
+ DDX_Control(pDX, IDC_COMBO1, m_guidsctrl);
+}
+
+
+BEGIN_MESSAGE_MAP(CSelectMediaType, CCmdUIDialog)
+ ON_CBN_EDITCHANGE(IDC_COMBO1, OnCbnEditchangeCombo1)
+ ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOK)
+END_MESSAGE_MAP()
+
+
+// CSelectMediaType message handlers
+
+BOOL CSelectMediaType::OnInitDialog()
+{
+ CCmdUIDialog::OnInitDialog();
+
+ for(int i = 0; i < m_guids.GetCount(); i++)
+ {
+ m_guidsctrl.AddString(GetMediaTypeName(m_guids[i]));
+ }
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CSelectMediaType::OnCbnEditchangeCombo1()
+{
+ UpdateData();
+ int i = m_guidsctrl.FindStringExact(0, m_guidstr);
+ if(i >= 0)
+ {
+ DWORD sel = m_guidsctrl.GetEditSel();
+ m_guidsctrl.SetCurSel(i);
+ m_guidsctrl.SetEditSel(sel,sel);
+ }
+}
+
+void CSelectMediaType::OnUpdateOK(CCmdUI* pCmdUI)
+{
+ UpdateData();
+
+ pCmdUI->Enable(!m_guidstr.IsEmpty() && (m_guidsctrl.GetCurSel() >= 0 || GUIDFromCString(m_guidstr) != GUID_NULL));
+}
+
+void CSelectMediaType::OnOK()
+{
+ UpdateData();
+
+ int i = m_guidsctrl.GetCurSel();
+ m_guid = i >= 0 ? m_guids[i] : GUIDFromCString(m_guidstr);
+
+ CCmdUIDialog::OnOK();
+}
diff --git a/src/apps/mplayerc/SelectMediaType.h b/src/apps/mplayerc/SelectMediaType.h
new file mode 100644
index 000000000..e3f71139f
--- /dev/null
+++ b/src/apps/mplayerc/SelectMediaType.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "afxwin.h"
+
+// CSelectMediaType dialog
+
+class CSelectMediaType : public CCmdUIDialog
+{
+ DECLARE_DYNAMIC(CSelectMediaType)
+
+private:
+ CAtlArray<GUID>& m_guids;
+
+public:
+ CSelectMediaType(CAtlArray<GUID>& guids, GUID guid, CWnd* pParent = NULL); // standard constructor
+ virtual ~CSelectMediaType();
+
+ GUID m_guid;
+
+// Dialog Data
+ enum { IDD = IDD_SELECTMEDIATYPE };
+ CString m_guidstr;
+ CComboBox m_guidsctrl;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnCbnEditchangeCombo1();
+ afx_msg void OnUpdateOK(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp b/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp
new file mode 100644
index 000000000..04655cd33
--- /dev/null
+++ b/src/apps/mplayerc/ShaderAutoCompleteDlg.cpp
@@ -0,0 +1,179 @@
+// ShaderAutoCompleteDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "ShaderAutoCompleteDlg.h"
+
+
+// CShaderAutoCompleteDlg dialog
+
+CShaderAutoCompleteDlg::CShaderAutoCompleteDlg(CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CShaderAutoCompleteDlg::IDD, pParent)
+{
+ m_text[0] = 0;
+
+ m_inst[_T("abs")] = _T("abs(value a)|Absolute value (per component). ");
+ m_inst[_T("acos")] = _T("acos(x)|Returns the arccosine of each component of x. Each component should be in the range [-1, 1]. ");
+ m_inst[_T("all")] = _T("all(x)|Test if all components of x are nonzero. ");
+ m_inst[_T("any")] = _T("any(x)|Test is any component of x is nonzero. ");
+ m_inst[_T("asin")] = _T("asin(x)|Returns the arcsine of each component of x. Each component should be in the range [-pi/2, pi/2]. ");
+ m_inst[_T("atan")] = _T("atan(x)|Returns the arctangent of x. The return values are in the range [-pi/2, pi/2]. ");
+ m_inst[_T("atan2")] = _T("atan2(y, x)|Returns the arctangent of y/x. The signs of y and x are used to determine the quadrant of the return values in the range [-pi, pi]. atan2 is well-defined for every point other than the origin, even if x equals 0 and y does not equal 0. ");
+ m_inst[_T("ceil")] = _T("ceil(x)|Returns the smallest integer which is greater than or equal to x. ");
+ m_inst[_T("clamp")] = _T("clamp(x, min, max)|Clamps x to the range [min, max]. ");
+ m_inst[_T("clip")] = _T("clip(x)|Discards the current pixel, if any component of x is less than zero. This can be used to simulate clip planes, if each component of x represents the distance from a plane. ");
+ m_inst[_T("cos")] = _T("cos(x)|Returns the cosine of x. ");
+ m_inst[_T("cosh")] = _T("cosh(x)|Returns the hyperbolic cosine of x. ");
+ m_inst[_T("cross")] = _T("cross(a, b)|Returns the cross product of two 3-D vectors a and b. ");
+ m_inst[_T("d3dcolortoubyte4")] = _T("D3DCOLORtoUBYTE4(x)|Swizzles and scales components of the 4-D vector x to compensate for the lack of UBYTE4 support in some hardware. ");
+ m_inst[_T("ddx")] = _T("ddx(x)|Returns the partial derivative of x with respect to the screen-space x-coordinate. ");
+ m_inst[_T("ddy")] = _T("ddy(x)|Returns the partial derivative of x with respect to the screen-space y-coordinate. ");
+ m_inst[_T("degrees")] = _T("degrees(x)|Converts x from radians to degrees. ");
+ m_inst[_T("determinant")] = _T("determinant(m)|Returns the determinant of the square matrix m. ");
+ m_inst[_T("distance")] = _T("distance(a, b)|Returns the distance between two points a and b. ");
+ m_inst[_T("dot")] = _T("dot(a, b)|Returns the dot product of two vectors a and b. ");
+ m_inst[_T("exp")] = _T("exp(x)|Returns the base-e exponent ex. ");
+ m_inst[_T("exp2")] = _T("exp2(value a)|Base 2 Exp (per component). ");
+ m_inst[_T("faceforward")] = _T("faceforward(n, i, ng)|Returns -n * sign(dot(i, ng)). ");
+ m_inst[_T("floor")] = _T("floor(x)|Returns the greatest integer which is less than or equal to x. ");
+ m_inst[_T("fmod")] = _T("fmod(a, b)|Returns the floating point remainder f of a / b such that a = i * b + f, where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of b. ");
+ m_inst[_T("frac")] = _T("frac(x)|Returns the fractional part f of x, such that f is a value greater than or equal to 0, and less than 1. ");
+ m_inst[_T("frc")] = _T("frc(value a)|Fractional part (per component). ");
+ m_inst[_T("frexp")] = _T("frexp(x, out exp)|Returns the mantissa and exponent of x. frexp returns the mantissa, and the exponent is stored in the output parameter exp. If x is 0, the function returns 0 for both the mantissa and the exponent. ");
+ m_inst[_T("fwidth")] = _T("fwidth(x)|Returns abs(ddx(x))+abs(ddy(x)). ");
+ m_inst[_T("isfinite")] = _T("isfinite(x)|Returns true if x is finite, false otherwise. ");
+ m_inst[_T("isinf")] = _T("isinf(x)|Returns true if x is +INF or -INF, false otherwise. ");
+ m_inst[_T("isnan")] = _T("isnan(x)|Returns true if x is NAN or QNAN, false otherwise. ");
+ m_inst[_T("ldexp")] = _T("ldexp(x, exp)|Returns x * 2exp. ");
+ m_inst[_T("len")] = _T("len(value a)|Vector length. ");
+ m_inst[_T("length")] = _T("length(v)|Returns the length of the vector v. ");
+ m_inst[_T("lerp")] = _T("lerp(a, b, s)|Returns a + s(b - a). This linearly interpolates between a and b, such that the return value is a when s is 0, and b when s is 1. ");
+ m_inst[_T("lit")] = _T("lit(ndotl, ndoth, m)|Returns a lighting vector (ambient, diffuse, specular, 1): ambient = 1; diffuse = (ndotl < 0) ? 0 : ndotl; specular = (ndotl < 0) || (ndoth < 0) ? 0 : (ndoth * m); ");
+ m_inst[_T("log")] = _T("log(x)|Returns the base-e logarithm of x. If x is negative, the function returns indefinite. If x is 0, the function returns +INF. ");
+ m_inst[_T("log10")] = _T("log10(x)|Returns the base-10 logarithm of x. If x is negative, the function returns indefinite. If x is 0, the function returns +INF. ");
+ m_inst[_T("log2")] = _T("log2(x)|Returns the base-2 logarithm of x. If x is negative, the function returns indefinite. If x is 0, the function returns +INF. ");
+ m_inst[_T("max")] = _T("max(a, b)|Selects the greater of a and b. ");
+ m_inst[_T("min")] = _T("min(a, b)|Selects the lesser of a and b. ");
+ m_inst[_T("modf")] = _T("modf(x, out ip)|Splits the value x into fractional and integer parts, each of which has the same sign and x. The signed fractional portion of x is returned. The integer portion is stored in the output parameter ip. ");
+ m_inst[_T("mul")] = _T("mul(a, b)|Performs matrix multiplication between a and b. If a is a vector, it treated as a row vector. If b is a vector, it is treated as a column vector. The inner dimension acolumns and brows must be equal. The result has the dimension arows x bcolumns. ");
+ m_inst[_T("noise")] = _T("noise(x)|Not yet implemented. ");
+ m_inst[_T("normalize")] = _T("normalize(v)|Returns the normalized vector v / length(v). If the length of v is 0, the result is indefinite. ");
+ m_inst[_T("pow")] = _T("pow(x, y)|Returns xy. ");
+ m_inst[_T("radians")] = _T("radians(x)|Converts x from degrees to radians. ");
+ m_inst[_T("reflect")] = _T("reflect(i, n)|Returns the reflection vector v, given the entering ray direction i, and the surface normal n. Such that v = i - 2 * dot(i, n) * n ");
+ m_inst[_T("refract")] = _T("refract(i, n, eta)|Returns the refraction vector v, given the entering ray direction i, the surface normal n, and the relative index of refraction eta. If the angle between i and n is too great for a given eta, refract returns (0,0,0). ");
+ m_inst[_T("round")] = _T("round(x)|Rounds x to the nearest integer. ");
+ m_inst[_T("rsqrt")] = _T("rsqrt(x)|Returns 1 / sqrt(x). ");
+ m_inst[_T("saturate")] = _T("saturate(x)|Clamps x to the range [0, 1]. ");
+ m_inst[_T("sign")] = _T("sign(x)|Computes the sign of x. Returns -1 if x is less than 0, 0 if x equals 0, and 1 if x is greater than zero. ");
+ m_inst[_T("sin")] = _T("sin(x)|Returns the sine of x. ");
+ m_inst[_T("sincos")] = _T("sincos(x, out s, out c)|Returns the sine and cosine of x. sin(x) is stored in the output parameter s. cos(x) is stored in the output parameter c. ");
+ m_inst[_T("sinh")] = _T("sinh(x)|Returns the hyperbolic sine of x. ");
+ m_inst[_T("smoothstep")] = _T("smoothstep(min, max, x)|Returns 0 if x < min. Returns 1 if x > max. Returns a smooth Hermite interpolation between 0 and 1, if x is in the range [min, max]. ");
+ m_inst[_T("sqrt")] = _T("sqrt(value a)|Square root (per component). ");
+ m_inst[_T("step")] = _T("step(a, x)|Returns (x >= a) ? 1 : 0. ");
+ m_inst[_T("tan")] = _T("tan(x)|Returns the tangent of x. ");
+ m_inst[_T("tanh")] = _T("tanh(x)|Returns the hyperbolic tangent of x. ");
+ m_inst[_T("tex1d")] = _T("tex1D(s, t)|1-D texture lookup. s is a sampler or a sampler1D object. t is a scalar. ");
+ m_inst[_T("tex1d(")] = _T("tex1D(s, t, ddx, ddy)|1-D texture lookup, with derivatives. s is a sampler or sampler1D object. t, ddx, and ddy are scalars. ");
+ m_inst[_T("tex1dproj")] = _T("tex1Dproj(s, t)|1-D projective texture lookup. s is a sampler or sampler1D object. t is a 4-D vector. t is divided by its last component before the lookup takes place. ");
+ m_inst[_T("tex1dbias")] = _T("tex1Dbias(s, t)|1-D biased texture lookup. s is a sampler or sampler1D object. t is a 4-D vector. The mip level is biased by t.w before the lookup takes place. ");
+ m_inst[_T("tex2d")] = _T("tex2D(s, t)|2-D texture lookup. s is a sampler or a sampler2D object. t is a 2-D texture coordinate. ");
+ m_inst[_T("tex2d(")] = _T("tex2D(s, t, ddx, ddy)|2-D texture lookup, with derivatives. s is a sampler or sampler2D object. t, ddx, and ddy are 2-D vectors. ");
+ m_inst[_T("tex2dproj")] = _T("tex2Dproj(s, t)|2-D projective texture lookup. s is a sampler or sampler2D object. t is a 4-D vector. t is divided by its last component before the lookup takes place. ");
+ m_inst[_T("tex2dbias")] = _T("tex2Dbias(s, t)|2-D biased texture lookup. s is a sampler or sampler2D object. t is a 4-D vector. The mip level is biased by t.w before the lookup takes place. ");
+ m_inst[_T("tex3d")] = _T("tex3D(s, t)|3-D volume texture lookup. s is a sampler or a sampler3D object. t is a 3-D texture coordinate. ");
+ m_inst[_T("tex3d(")] = _T("tex3D(s, t, ddx, ddy)|3-D volume texture lookup, with derivatives. s is a sampler or sampler3D object. t, ddx, and ddy are 3-D vectors. ");
+ m_inst[_T("tex3dproj")] = _T("tex3Dproj(s, t)|3-D projective volume texture lookup. s is a sampler or sampler3D object. t is a 4-D vector. t is divided by its last component before the lookup takes place. ");
+ m_inst[_T("tex3dbias")] = _T("tex3Dbias(s, t)|3-D biased texture lookup. s is a sampler or sampler3D object. t is a 4-D vector. The mip level is biased by t.w before the lookup takes place. ");
+ m_inst[_T("texcube")] = _T("texCUBE(s, t)|3-D cube texture lookup. s is a sampler or a samplerCUBE object. t is a 3-D texture coordinate. ");
+ m_inst[_T("texcube(")] = _T("texCUBE(s, t, ddx, ddy)|3-D cube texture lookup, with derivatives. s is a sampler or samplerCUBE object. t, ddx, and ddy are 3-D vectors. ");
+ m_inst[_T("texcubeproj")] = _T("texCUBEproj(s, t)|3-D projective cube texture lookup. s is a sampler or samplerCUBE object. t is a 4-D vector. t is divided by its last component before the lookup takes place. ");
+ m_inst[_T("texcubebias")] = _T("texCUBEbias(s, t)|3-D biased cube texture lookup. s is a sampler or samplerCUBE object. t is a 4-dimensional vector. The mip level is biased by t.w before the lookup takes place. ");
+ m_inst[_T("transpose")] = _T("transpose(m)|Returns the transpose of the matrix m. If the source is dimension mrows x mcolumns, the result is dimension mcolumns x mrows. ");
+}
+
+CShaderAutoCompleteDlg::~CShaderAutoCompleteDlg()
+{
+}
+
+void CShaderAutoCompleteDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_list);
+}
+
+
+BEGIN_MESSAGE_MAP(CShaderAutoCompleteDlg, CResizableDialog)
+ ON_WM_SETFOCUS()
+ ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
+ ON_WM_SHOWWINDOW()
+END_MESSAGE_MAP()
+
+
+// CShaderAutoCompleteDlg message handlers
+
+BOOL CShaderAutoCompleteDlg::OnInitDialog()
+{
+ CResizableDialog::OnInitDialog();
+
+ AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT);
+
+ m_hToolTipWnd = CreateWindowEx(
+ WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, TTS_NOPREFIX | TTS_ALWAYSTIP,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ NULL, NULL, NULL, NULL);
+
+ memset(&m_ti, 0, sizeof(m_ti));
+ m_ti.cbSize = sizeof(TOOLINFO);
+ m_ti.uFlags = TTF_ABSOLUTE|TTF_TRACK;
+ m_ti.hwnd = m_hWnd;
+ m_ti.lpszText = m_text;
+
+ ::SendMessage(m_hToolTipWnd, TTM_ADDTOOL, 0, (LPARAM)&m_ti);
+ ::SendMessage(m_hToolTipWnd, TTM_SETMAXTIPWIDTH, 0, (LPARAM)400);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CShaderAutoCompleteDlg::OnSetFocus(CWnd* pOldWnd)
+{
+ __super::OnSetFocus(pOldWnd);
+
+ GetParent()->SetFocus();
+}
+
+void CShaderAutoCompleteDlg::OnLbnSelchangeList1()
+{
+ ::SendMessage(m_hToolTipWnd, TTM_TRACKACTIVATE, FALSE, (LPARAM)&m_ti);
+
+ int i = m_list.GetCurSel();
+ if(i < 0) return;
+
+ if(POSITION pos = (POSITION)m_list.GetItemData(i))
+ {
+ CString str, desc;
+ m_inst.GetNextAssoc(pos, str, desc);
+ CAtlList<CString> sl;
+ Explode(desc, sl, '|', 2);
+ if(sl.GetCount() != 2) return;
+ _tcscpy(m_ti.lpszText, sl.RemoveTail());
+ CRect r;
+ GetWindowRect(r);
+ ::SendMessage(m_hToolTipWnd, TTM_UPDATETIPTEXT, 0, (LPARAM)&m_ti);
+ ::SendMessage(m_hToolTipWnd, TTM_TRACKPOSITION, 0, (LPARAM)MAKELONG(r.left, r.bottom+1));
+ ::SendMessage(m_hToolTipWnd, TTM_TRACKACTIVATE, TRUE, (LPARAM)&m_ti);
+ }
+}
+
+void CShaderAutoCompleteDlg::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+ CResizableDialog::OnShowWindow(bShow, nStatus);
+
+ if(!bShow)
+ {
+ ::SendMessage(m_hToolTipWnd, TTM_TRACKACTIVATE, FALSE, (LPARAM)&m_ti);
+ }
+}
diff --git a/src/apps/mplayerc/ShaderAutoCompleteDlg.h b/src/apps/mplayerc/ShaderAutoCompleteDlg.h
new file mode 100644
index 000000000..ede767438
--- /dev/null
+++ b/src/apps/mplayerc/ShaderAutoCompleteDlg.h
@@ -0,0 +1,33 @@
+#pragma once
+#include "resource.h"
+
+
+// CShaderAutoCompleteDlg dialog
+
+class CShaderAutoCompleteDlg : public CResizableDialog
+{
+ TOOLINFO m_ti;
+ HWND m_hToolTipWnd;
+ TCHAR m_text[1024];
+
+public:
+ CShaderAutoCompleteDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~CShaderAutoCompleteDlg();
+
+ CMap<CString, LPCTSTR, CString, CString> m_inst;
+
+// Dialog Data
+ enum { IDD = IDD_SHADERAUTOCOMPLETE_DLG };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ CListBox m_list;
+ virtual BOOL OnInitDialog();
+ afx_msg void OnSetFocus(CWnd* pOldWnd);
+ afx_msg void OnLbnSelchangeList1();
+ afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+};
diff --git a/src/apps/mplayerc/ShaderCombineDlg.cpp b/src/apps/mplayerc/ShaderCombineDlg.cpp
new file mode 100644
index 000000000..190c4acb5
--- /dev/null
+++ b/src/apps/mplayerc/ShaderCombineDlg.cpp
@@ -0,0 +1,131 @@
+// ShaderCombineDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "ShaderCombineDlg.h"
+
+// CShaderCombineDlg dialog
+
+CShaderCombineDlg::CShaderCombineDlg(CAtlList<CString>& labels, CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CShaderCombineDlg::IDD, pParent)
+ , m_labels(labels)
+{
+}
+
+CShaderCombineDlg::~CShaderCombineDlg()
+{
+}
+
+void CShaderCombineDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_list);
+ DDX_Control(pDX, IDC_COMBO1, m_combo);
+}
+
+BEGIN_MESSAGE_MAP(CShaderCombineDlg, CResizableDialog)
+ ON_BN_CLICKED(IDC_BUTTON2, &CShaderCombineDlg::OnBnClickedButton12)
+ ON_BN_CLICKED(IDC_BUTTON3, &CShaderCombineDlg::OnBnClickedButton13)
+ ON_BN_CLICKED(IDC_BUTTON1, &CShaderCombineDlg::OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON4, &CShaderCombineDlg::OnBnClickedButton11)
+END_MESSAGE_MAP()
+
+// CShaderCombineDlg message handlers
+
+BOOL CShaderCombineDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+ AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_COMBO1, BOTTOM_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_STATIC1, BOTTOM_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON2, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON3, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON1, TOP_RIGHT);
+ AddAnchor(IDC_BUTTON4, TOP_RIGHT);
+ AddAnchor(IDOK, TOP_RIGHT);
+ AddAnchor(IDCANCEL, TOP_RIGHT);
+
+ AppSettings& s = AfxGetAppSettings();
+
+ CString str = s.m_shadercombine.Trim();
+
+ CAtlList<CString> sl;
+ if(!str.IsEmpty()) Explode(str, sl, '|');
+
+ POSITION pos = sl.GetHeadPosition();
+ while(pos) m_list.AddString(sl.GetNext(pos));
+
+ pos = s.m_shaders.GetHeadPosition();
+ while(pos) m_combo.AddString(s.m_shaders.GetNext(pos).label);
+ if(m_combo.GetCount()) m_combo.SetCurSel(0);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CShaderCombineDlg::OnOK()
+{
+ m_labels.RemoveAll();
+
+ CAtlList<CString> sl;
+
+ for(int i = 0, j = m_list.GetCount(); i < j; i++)
+ {
+ CString label;
+ m_list.GetText(i, label);
+ sl.AddTail(label);
+ m_labels.AddTail(label);
+ }
+
+ AfxGetAppSettings().m_shadercombine = Implode(sl, '|');
+
+ __super::OnOK();
+}
+
+void CShaderCombineDlg::OnBnClickedButton12()
+{
+ int i = m_combo.GetCurSel();
+ if(i < 0) return;
+
+ CString label;
+ m_combo.GetLBText(i, label);
+ m_list.SetCurSel(m_list.AddString(label));
+}
+
+void CShaderCombineDlg::OnBnClickedButton13()
+{
+ int i = m_list.GetCurSel();
+ if(i < 0) return;
+
+ m_list.DeleteString(i);
+ if(i == m_list.GetCount()) i--;
+ if(i >= 0) m_list.SetCurSel(i);
+}
+
+void CShaderCombineDlg::OnBnClickedButton1()
+{
+ int i = m_list.GetCurSel();
+ if(i < 1) return;
+
+ CString label;
+ m_list.GetText(i, label);
+ m_list.DeleteString(i);
+ i--;
+ m_list.InsertString(i, label);
+ m_list.SetCurSel(i);
+}
+
+void CShaderCombineDlg::OnBnClickedButton11()
+{
+ int i = m_list.GetCurSel();
+ if(i < 0 || i >= m_list.GetCount()-1) return;
+
+ CString label;
+ m_list.GetText(i, label);
+ m_list.DeleteString(i);
+ if(++i == m_list.GetCount()) m_list.AddString(label);
+ else m_list.InsertString(i, label);
+ m_list.SetCurSel(i);
+}
diff --git a/src/apps/mplayerc/ShaderCombineDlg.h b/src/apps/mplayerc/ShaderCombineDlg.h
new file mode 100644
index 000000000..a2ce42620
--- /dev/null
+++ b/src/apps/mplayerc/ShaderCombineDlg.h
@@ -0,0 +1,38 @@
+#pragma once
+#include "afxwin.h"
+
+
+// CShaderCombineDlg dialog
+
+class CShaderCombineDlg : public CResizableDialog
+{
+ CAtlList<CString>& m_labels;
+
+public:
+ CShaderCombineDlg(CAtlList<CString>& labels, CWnd* pParent = NULL); // standard constructor
+ virtual ~CShaderCombineDlg();
+
+// Dialog Data
+ enum { IDD = IDD_SHADERCOMBINE_DLG };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+public:
+ virtual BOOL OnInitDialog();
+protected:
+ virtual void OnOK();
+public:
+ CListBox m_list;
+public:
+ CComboBox m_combo;
+public:
+ afx_msg void OnBnClickedButton12();
+public:
+ afx_msg void OnBnClickedButton13();
+public:
+ afx_msg void OnBnClickedButton1();
+public:
+ afx_msg void OnBnClickedButton11();
+};
diff --git a/src/apps/mplayerc/ShaderEditorDlg.cpp b/src/apps/mplayerc/ShaderEditorDlg.cpp
new file mode 100644
index 000000000..4880f47e9
--- /dev/null
+++ b/src/apps/mplayerc/ShaderEditorDlg.cpp
@@ -0,0 +1,482 @@
+// ShaderEditorDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "PixelShaderCompiler.h"
+#include "ShaderEditorDlg.h"
+#include "MainFrm.h"
+
+#undef SubclassWindow
+
+// CShaderLabelComboBox
+
+BEGIN_MESSAGE_MAP(CShaderLabelComboBox, CComboBox)
+ ON_WM_CTLCOLOR()
+ ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+HBRUSH CShaderLabelComboBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+ if(nCtlColor == CTLCOLOR_EDIT)
+ {
+ if(m_edit.GetSafeHwnd() == NULL)
+ m_edit.SubclassWindow(pWnd->GetSafeHwnd());
+ }
+
+ return __super::OnCtlColor(pDC, pWnd, nCtlColor);
+}
+
+void CShaderLabelComboBox::OnDestroy()
+{
+ if(m_edit.GetSafeHwnd() != NULL)
+ m_edit.UnsubclassWindow();
+
+ __super::OnDestroy();
+}
+
+// CShaderEdit
+
+CShaderEdit::CShaderEdit()
+{
+ m_acdlg.Create(CShaderAutoCompleteDlg::IDD, NULL);
+
+ m_nEndChar = -1;
+ m_nIDEvent = -1;
+}
+
+CShaderEdit::~CShaderEdit()
+{
+ m_acdlg.DestroyWindow();
+}
+
+BOOL CShaderEdit::PreTranslateMessage(MSG* pMsg)
+{
+ if(m_acdlg.IsWindowVisible()
+ && pMsg->message == WM_KEYDOWN
+ && (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN
+ || pMsg->wParam == VK_PRIOR || pMsg->wParam == VK_NEXT
+ || pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE))
+ {
+ int i = m_acdlg.m_list.GetCurSel();
+
+ if(pMsg->wParam == VK_RETURN && i >= 0)
+ {
+ CString str;
+ m_acdlg.m_list.GetText(i, str);
+ i = str.Find('(')+1;
+ if(i > 0) str = str.Left(i);
+
+ int nStartChar = 0, nEndChar = -1;
+ GetSel(nStartChar, nEndChar);
+
+ CString text;
+ GetWindowText(text);
+ while(nStartChar > 0 && _istalnum(text.GetAt(nStartChar-1)))
+ nStartChar--;
+
+ SetSel(nStartChar, nEndChar);
+ ReplaceSel(str, TRUE);
+ }
+ else if(pMsg->wParam == VK_ESCAPE)
+ {
+ m_acdlg.ShowWindow(SW_HIDE);
+ }
+ else
+ {
+ m_acdlg.m_list.SendMessage(pMsg->message, pMsg->wParam, pMsg->lParam);
+ }
+
+ return TRUE;
+ }
+
+ return __super::PreTranslateMessage(pMsg);
+}
+
+BEGIN_MESSAGE_MAP(CShaderEdit, CLineNumberEdit)
+ ON_CONTROL_REFLECT(EN_UPDATE, OnUpdate)
+ ON_WM_KILLFOCUS()
+ ON_WM_TIMER()
+END_MESSAGE_MAP()
+
+void CShaderEdit::OnUpdate()
+{
+ if(m_nIDEvent == -1)
+ {
+ m_nIDEvent = SetTimer(1, 100, NULL);
+ }
+
+ CString text;
+ int nStartChar = 0, nEndChar = -1;
+ GetSel(nStartChar, nEndChar);
+
+ if(nStartChar == nEndChar)
+ {
+ GetWindowText(text);
+ while(nStartChar > 0 && _istalnum(text.GetAt(nStartChar-1)))
+ nStartChar--;
+ }
+
+ if(nStartChar < nEndChar)
+ {
+ text = text.Mid(nStartChar, nEndChar - nStartChar);
+ text.TrimRight('(');
+ text.MakeLower();
+
+ m_acdlg.m_list.ResetContent();
+
+ CString key, value;
+ POSITION pos = m_acdlg.m_inst.GetStartPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ m_acdlg.m_inst.GetNextAssoc(pos, key, value);
+
+ if(key.Find(text) == 0)
+ {
+ CAtlList<CString> sl;
+ Explode(value, sl, '|', 2);
+ if(sl.GetCount() != 2) continue;
+ CString name = sl.RemoveHead();
+ CString description = sl.RemoveHead();
+ int i = m_acdlg.m_list.AddString(name);
+ m_acdlg.m_list.SetItemDataPtr(i, cur);
+ }
+ }
+
+ if(m_acdlg.m_list.GetCount() > 0)
+ {
+ int lineheight = GetLineHeight();
+
+ CPoint p = PosFromChar(nStartChar);
+ p.y += lineheight;
+ ClientToScreen(&p);
+ CRect r(p, CSize(100, 100));
+
+ m_acdlg.MoveWindow(r);
+ m_acdlg.SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
+ m_acdlg.ShowWindow(SW_SHOWNOACTIVATE);
+
+ m_nEndChar = nEndChar;
+
+ return;
+ }
+ }
+
+ m_acdlg.ShowWindow(SW_HIDE);
+}
+
+void CShaderEdit::OnKillFocus(CWnd* pNewWnd)
+{
+ CString text;
+ GetWindowText(text);
+ __super::OnKillFocus(pNewWnd);
+ GetWindowText(text);
+
+ m_acdlg.ShowWindow(SW_HIDE);
+}
+
+void CShaderEdit::OnTimer(UINT nIDEvent)
+{
+ if(m_nIDEvent == nIDEvent)
+ {
+ int nStartChar = 0, nEndChar = -1;
+ GetSel(nStartChar, nEndChar);
+ if(nStartChar != nEndChar || m_nEndChar != nEndChar)
+ m_acdlg.ShowWindow(SW_HIDE);
+ }
+
+ __super::OnTimer(nIDEvent);
+}
+
+// CShaderEditorDlg dialog
+
+CShaderEditorDlg::CShaderEditorDlg()
+ : CResizableDialog(CShaderEditorDlg::IDD, NULL)
+ , m_fSplitterGrabbed(false)
+ , m_pPSC(NULL)
+ , m_pShader(NULL)
+{
+}
+
+CShaderEditorDlg::~CShaderEditorDlg()
+{
+ delete m_pPSC;
+}
+
+BOOL CShaderEditorDlg::Create(CWnd* pParent)
+{
+ if(!__super::Create(IDD, pParent))
+ return FALSE;
+
+ AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT);
+ AddAnchor(IDC_COMBO2, TOP_RIGHT);
+ AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_EDIT2, BOTTOM_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_BUTTON1, TOP_RIGHT);
+
+ m_srcdata.SetTabStops(16);
+
+ SetMinTrackSize(CSize(250, 40));
+
+ m_targets.AddString(_T("ps_1_1"));
+ m_targets.AddString(_T("ps_1_2"));
+ m_targets.AddString(_T("ps_1_3"));
+ m_targets.AddString(_T("ps_1_4"));
+ m_targets.AddString(_T("ps_2_0"));
+ m_targets.AddString(_T("ps_2_a"));
+ m_targets.AddString(_T("ps_2_sw"));
+ m_targets.AddString(_T("ps_3_0"));
+ m_targets.AddString(_T("ps_3_sw"));
+
+ POSITION pos = AfxGetAppSettings().m_shaders.GetHeadPosition();
+ while(pos)
+ {
+ const AppSettings::Shader& s = AfxGetAppSettings().m_shaders.GetNext(pos);
+ m_labels.SetItemDataPtr(m_labels.AddString(s.label), (void*)&s);
+ }
+
+ m_nIDEventShader = SetTimer(1, 1000, NULL);
+
+ return TRUE;
+}
+
+void CShaderEditorDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_COMBO1, m_labels);
+ DDX_Control(pDX, IDC_COMBO2, m_targets);
+ DDX_Control(pDX, IDC_EDIT1, m_srcdata);
+ DDX_Control(pDX, IDC_EDIT2, m_output);
+}
+
+bool CShaderEditorDlg::HitTestSplitter(CPoint p)
+{
+ CRect r, rs, ro;
+ m_srcdata.GetWindowRect(&rs);
+ m_output.GetWindowRect(&ro);
+ ScreenToClient(&rs);
+ ScreenToClient(&ro);
+ GetClientRect(&r);
+ r.left = ro.left;
+ r.right = ro.right;
+ r.top = rs.bottom;
+ r.bottom = ro.top;
+ return !!r.PtInRect(p);
+}
+
+BEGIN_MESSAGE_MAP(CShaderEditorDlg, CResizableDialog)
+ ON_CBN_SELCHANGE(IDC_COMBO1, OnCbnSelchangeCombo1)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton2)
+ ON_WM_TIMER()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_LBUTTONUP()
+ ON_WM_MOUSEMOVE()
+ ON_WM_SETCURSOR()
+END_MESSAGE_MAP()
+
+// CShaderEditorDlg message handlers
+
+BOOL CShaderEditorDlg::PreTranslateMessage(MSG* pMsg)
+{
+ if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
+ && pMsg->hwnd == m_labels.m_edit.GetSafeHwnd())
+ {
+ OnCbnSelchangeCombo1();
+
+ return TRUE;
+ }
+ else if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_TAB
+ && pMsg->hwnd == m_srcdata.GetSafeHwnd())
+ {
+ int nStartChar, nEndChar;
+ m_srcdata.GetSel(nStartChar, nEndChar);
+ if(nStartChar == nEndChar) m_srcdata.ReplaceSel(_T("\t"));
+ return TRUE;
+ }
+ else if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE)
+ {
+ return TRUE;
+ }
+
+ return __super::PreTranslateMessage(pMsg);
+}
+
+void CShaderEditorDlg::OnCbnSelchangeCombo1()
+{
+ int i = m_labels.GetCurSel();
+
+ if(i < 0)
+ {
+ CString label;
+ m_labels.GetWindowText(label);
+ label.Trim();
+
+ if(label.IsEmpty()) return;
+
+ CStringA srcdata;
+ LoadResource(IDF_SHADER_EMPTY, srcdata, _T("FILE"));
+
+ AppSettings::Shader s;
+ s.label = label;
+ s.target = _T("ps_2_0");
+ s.srcdata = CString(srcdata);
+
+ POSITION pos = AfxGetAppSettings().m_shaders.AddTail(s);
+
+ i = m_labels.AddString(s.label);
+ m_labels.SetCurSel(i);
+ m_labels.SetItemDataPtr(i, (void*)&AfxGetAppSettings().m_shaders.GetAt(pos));
+ }
+
+ m_pShader = (AppSettings::Shader*)m_labels.GetItemDataPtr(i);
+
+ m_targets.SetWindowText(m_pShader->target);
+
+ CString srcdata = m_pShader->srcdata;
+ srcdata.Replace(_T("\n"), _T("\r\n"));
+ m_srcdata.SetWindowText(srcdata);
+
+ ((CMainFrame*)AfxGetMainWnd())->UpdateShaders(m_pShader->label);
+}
+
+void CShaderEditorDlg::OnBnClickedButton2()
+{
+ if(!m_pShader) return;
+
+ if(IDYES != AfxMessageBox(_T("Are you sure you want to delete this shader?"), MB_YESNO))
+ return;
+
+ AppSettings& s = AfxGetAppSettings();
+
+ for(POSITION pos = s.m_shaders.GetHeadPosition(); pos; s.m_shaders.GetNext(pos))
+ {
+ if(m_pShader == &s.m_shaders.GetAt(pos))
+ {
+ m_pShader = NULL;
+ s.m_shaders.RemoveAt(pos);
+ int i = m_labels.GetCurSel();
+ if(i >= 0) m_labels.DeleteString(i);
+ m_labels.SetWindowText(_T(""));
+ m_targets.SetWindowText(_T(""));
+ m_srcdata.SetWindowText(_T(""));
+ m_output.SetWindowText(_T(""));
+ ((CMainFrame*)AfxGetMainWnd())->UpdateShaders(_T(""));
+ break;
+ }
+ }
+}
+
+void CShaderEditorDlg::OnTimer(UINT nIDEvent)
+{
+ if(nIDEvent == m_nIDEventShader && IsWindowVisible() && m_pShader)
+ {
+ CString srcdata;
+ m_srcdata.GetWindowText(srcdata);
+ srcdata.Replace(_T("\r"), _T(""));
+ srcdata.Trim();
+
+ CString target;
+ m_targets.GetWindowText(target);
+ target.Trim();
+
+ if(!srcdata.IsEmpty() && !target.IsEmpty() && (m_pShader->srcdata != srcdata || m_pShader->target != target))
+ {
+ KillTimer(m_nIDEventShader);
+
+ m_pShader->srcdata = srcdata;
+ m_pShader->target = target;
+
+ if(!m_pPSC) m_pPSC = new CPixelShaderCompiler(NULL);
+
+ CString disasm, errmsg;
+ HRESULT hr = m_pPSC->CompileShader(CStringA(srcdata), "main", CStringA(target), D3DXSHADER_DEBUG, NULL, &disasm, &errmsg);
+
+ if(SUCCEEDED(hr))
+ {
+ errmsg = _T("D3DXCompileShader succeeded\n");
+ errmsg += _T("\n");
+ errmsg += disasm;
+
+ ((CMainFrame*)AfxGetMainWnd())->UpdateShaders(m_pShader->label);
+ }
+
+ errmsg.Replace(_T("\n"), _T("\r\n"));
+
+ m_output.SetWindowText(errmsg);
+
+ // TODO: autosave
+
+ m_nIDEventShader = SetTimer(1, 1000, NULL);
+ }
+ }
+
+ __super::OnTimer(nIDEvent);
+}
+
+void CShaderEditorDlg::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ if(HitTestSplitter(point))
+ {
+ m_fSplitterGrabbed = true;
+ SetCapture();
+ }
+
+ __super::OnLButtonDown(nFlags, point);
+}
+
+void CShaderEditorDlg::OnLButtonUp(UINT nFlags, CPoint point)
+{
+ if(m_fSplitterGrabbed)
+ {
+ ReleaseCapture();
+ m_fSplitterGrabbed = false;
+ }
+
+ __super::OnLButtonUp(nFlags, point);
+}
+
+void CShaderEditorDlg::OnMouseMove(UINT nFlags, CPoint point)
+{
+ if(m_fSplitterGrabbed)
+ {
+ CRect r, rs, ro;
+ GetClientRect(&r);
+ m_srcdata.GetWindowRect(&rs);
+ m_output.GetWindowRect(&ro);
+ ScreenToClient(&rs);
+ ScreenToClient(&ro);
+
+ int dist = ro.top - rs.bottom;
+ int avgdist = dist / 2;
+
+ rs.bottom = min(max(point.y, rs.top + 40), ro.bottom - 40) - avgdist;
+ ro.top = rs.bottom + dist;
+ m_srcdata.MoveWindow(&rs);
+ m_output.MoveWindow(&ro);
+
+ int div = 100 * ((rs.bottom + ro.top) / 2) / (ro.bottom - rs.top);
+
+ RemoveAnchor(IDC_EDIT1);
+ RemoveAnchor(IDC_EDIT2);
+ AddAnchor(IDC_EDIT1, TOP_LEFT, CSize(100, div)/*BOTTOM_RIGHT*/);
+ AddAnchor(IDC_EDIT2, CSize(0, div)/*BOTTOM_LEFT*/, BOTTOM_RIGHT);
+ }
+
+ __super::OnMouseMove(nFlags, point);
+}
+
+BOOL CShaderEditorDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
+{
+ CPoint p;
+ GetCursorPos(&p);
+ ScreenToClient(&p);
+ if(HitTestSplitter(p))
+ {
+ ::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZENS));
+ return TRUE;
+ }
+
+ return __super::OnSetCursor(pWnd, nHitTest, message);
+}
+
diff --git a/src/apps/mplayerc/ShaderEditorDlg.h b/src/apps/mplayerc/ShaderEditorDlg.h
new file mode 100644
index 000000000..7950819ce
--- /dev/null
+++ b/src/apps/mplayerc/ShaderEditorDlg.h
@@ -0,0 +1,81 @@
+#pragma once
+
+#include "..\..\subpic\ISubPic.h"
+#include "LineNumberEdit.h"
+#include "ShaderAutoCompleteDlg.h"
+#include "mplayerc.h"
+
+// Q174667
+
+class CShaderLabelComboBox : public CComboBox
+{
+public:
+ CEdit m_edit;
+
+ DECLARE_MESSAGE_MAP()
+ afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
+ afx_msg void OnDestroy();
+};
+
+class CShaderEdit : public CLineNumberEdit
+{
+ int m_nEndChar;
+ UINT m_nIDEvent;
+
+public:
+ CShaderEdit();
+ ~CShaderEdit();
+
+ CShaderAutoCompleteDlg m_acdlg;
+
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnUpdate();
+ afx_msg void OnKillFocus(CWnd* pNewWnd);
+ afx_msg void OnTimer(UINT nIDEvent);
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+};
+
+// CShaderEditorDlg dialog
+
+class CPixelShaderCompiler;
+
+class CShaderEditorDlg : public CResizableDialog
+{
+private:
+ UINT m_nIDEventShader;
+
+ bool m_fSplitterGrabbed;
+ bool HitTestSplitter(CPoint p);
+
+ CPixelShaderCompiler* m_pPSC;
+ AppSettings::Shader* m_pShader;
+
+public:
+ CShaderEditorDlg(); // standard constructor
+ virtual ~CShaderEditorDlg();
+
+ BOOL Create(CWnd* pParent = NULL);
+
+// Dialog Data
+ enum { IDD = IDD_SHADEREDITOR_DLG };
+ CShaderLabelComboBox m_labels;
+ CComboBox m_targets;
+ CShaderEdit m_srcdata;
+ CEdit m_output;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnCbnSelchangeCombo1();
+ afx_msg void OnBnClickedButton2();
+ afx_msg void OnTimer(UINT nIDEvent);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+ afx_msg void OnKillFocus(CWnd* pNewWnd);
+};
diff --git a/src/apps/mplayerc/ShockwaveGraph.cpp b/src/apps/mplayerc/ShockwaveGraph.cpp
new file mode 100644
index 000000000..5530b04ac
--- /dev/null
+++ b/src/apps/mplayerc/ShockwaveGraph.cpp
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "shockwavegraph.h"
+#include "resource.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+CShockwaveGraph::CShockwaveGraph(HWND hParent, HRESULT& hr)
+ : m_fs(State_Stopped)
+{
+ hr = S_OK;
+
+ if(!m_wndWindowFrame.Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,
+ CRect(0, 0, 0, 0), CWnd::FromHandle(hParent), 0, NULL))
+ {
+ hr = E_FAIL;
+ return;
+ }
+
+ if(!m_wndDestFrame.Create(NULL, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,
+ CRect(0, 0, 0, 0), &m_wndWindowFrame, 0))
+ {
+ hr = E_FAIL;
+ return;
+ }
+}
+
+CShockwaveGraph::~CShockwaveGraph()
+{
+ m_wndDestFrame.DestroyWindow();
+ m_wndWindowFrame.DestroyWindow();
+}
+
+// IGraphBuilder
+STDMETHODIMP CShockwaveGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList)
+{
+ try {m_wndDestFrame.LoadMovie(0, CString(lpcwstrFile));}
+ catch(CException* e) {e->Delete(); return E_FAIL;}
+ return S_OK;
+}
+
+// IMediaControl
+STDMETHODIMP CShockwaveGraph::Run()
+{
+ try {if(m_fs != State_Running) m_wndDestFrame.Play();}
+ catch(CException* e) {e->Delete(); return E_FAIL;}
+ m_fs = State_Running;
+ m_wndWindowFrame.EnableWindow();
+// m_wndDestFrame.EnableWindow();
+ return S_OK;
+}
+STDMETHODIMP CShockwaveGraph::Pause()
+{
+ try {if(m_fs == State_Running) m_wndDestFrame.Stop();}
+ catch(CException* e) {e->Delete(); return E_FAIL;}
+ m_fs = State_Paused;
+ return S_OK;
+}
+STDMETHODIMP CShockwaveGraph::Stop()
+{
+ try {m_wndDestFrame.Stop();}
+ catch(CException* e) {e->Delete(); return E_FAIL;}
+ m_fs = State_Stopped;
+ return S_OK;
+}
+STDMETHODIMP CShockwaveGraph::GetState(LONG msTimeout, OAFilterState* pfs)
+{
+ OAFilterState fs = m_fs;
+
+ try
+ {
+ if(m_wndDestFrame.IsPlaying() && m_fs == State_Stopped) m_fs = State_Running;
+ else if(!m_wndDestFrame.IsPlaying() && m_fs == State_Running) m_fs = State_Stopped;
+ fs = m_fs;
+ }
+ catch(CException* e)
+ {
+ e->Delete();
+ return E_FAIL;
+ }
+
+ return pfs ? *pfs = fs, S_OK : E_POINTER;
+}
+
+// IMediaSeeking
+STDMETHODIMP CShockwaveGraph::IsFormatSupported(const GUID* pFormat)
+{
+ return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_FRAME ? S_OK : S_FALSE;
+}
+STDMETHODIMP CShockwaveGraph::GetTimeFormat(GUID* pFormat)
+{
+ return pFormat ? *pFormat = TIME_FORMAT_FRAME, S_OK : E_POINTER;
+}
+STDMETHODIMP CShockwaveGraph::GetDuration(LONGLONG* pDuration)
+{
+ CheckPointer(pDuration, E_POINTER);
+ *pDuration = 0;
+ try {if(m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) *pDuration = m_wndDestFrame.get_TotalFrames();}
+ catch(CException* e) {e->Delete(); return E_FAIL;}
+ return S_OK;
+}
+STDMETHODIMP CShockwaveGraph::GetCurrentPosition(LONGLONG* pCurrent)
+{
+ CheckPointer(pCurrent, E_POINTER);
+ *pCurrent = 0;
+ try {if(m_wndDestFrame.get_ReadyState() >= READYSTATE_COMPLETE) *pCurrent = m_wndDestFrame.get_FrameNum();}
+ catch(CException* e) {e->Delete(); return E_FAIL;}
+ return S_OK;
+}
+STDMETHODIMP CShockwaveGraph::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
+{
+ if(dwCurrentFlags&AM_SEEKING_AbsolutePositioning)
+ {
+ m_wndDestFrame.put_FrameNum(*pCurrent);
+
+ if(m_fs == State_Running && !m_wndDestFrame.IsPlaying())
+ m_wndDestFrame.Play();
+ else if((m_fs == State_Paused || m_fs == State_Stopped) && m_wndDestFrame.IsPlaying())
+ m_wndDestFrame.Stop();
+
+ m_wndDestFrame.put_Quality(1); // 0=Low, 1=High, 2=AutoLow, 3=AutoHigh
+
+ return S_OK;
+ }
+
+ return E_INVALIDARG;
+}
+
+// IVideoWindow
+STDMETHODIMP CShockwaveGraph::put_Visible(long Visible)
+{
+ if(IsWindow(m_wndDestFrame.m_hWnd))
+ m_wndDestFrame.ShowWindow(Visible == OATRUE ? SW_SHOWNORMAL : SW_HIDE);
+ return S_OK;
+}
+STDMETHODIMP CShockwaveGraph::get_Visible(long* pVisible)
+{
+ return pVisible ? *pVisible = (m_wndDestFrame.IsWindowVisible() ? OATRUE : OAFALSE), S_OK : E_POINTER;
+}
+STDMETHODIMP CShockwaveGraph::SetWindowPosition(long Left, long Top, long Width, long Height)
+{
+ if(IsWindow(m_wndWindowFrame.m_hWnd))
+ m_wndWindowFrame.MoveWindow(Left, Top, Width, Height);
+
+ return S_OK;
+}
+
+// IBasicVideo
+STDMETHODIMP CShockwaveGraph::SetDestinationPosition(long Left, long Top, long Width, long Height)// {return E_NOTIMPL;}
+{
+ if(IsWindow(m_wndDestFrame.m_hWnd))
+ m_wndDestFrame.MoveWindow(Left, Top, Width, Height);
+
+ return S_OK;
+}
+STDMETHODIMP CShockwaveGraph::GetVideoSize(long* pWidth, long* pHeight)
+{
+ if(!pWidth || !pHeight) return E_POINTER;
+
+ CRect r;
+ m_wndWindowFrame.GetWindowRect(r);
+ if(!r.IsRectEmpty())
+ {
+ *pWidth = r.Width();
+ *pHeight = r.Height();
+ }
+ else
+ {
+ // no call exists to determine these...
+ *pWidth = 384;//m_wndDestFrame.get_;
+ *pHeight = 288;
+
+ NotifyEvent(EC_BG_AUDIO_CHANGED, 2, 0);
+ }
+
+ return S_OK;
+}
+
+#include <math.h>
+
+// IBasicAudio
+STDMETHODIMP CShockwaveGraph::put_Volume(long lVolume)
+{
+ lVolume = (lVolume == -10000) ? 0 : (int)pow(10.0, ((double)lVolume)/5000+2);
+ lVolume = lVolume*0x10000/100;
+ lVolume = max(min(lVolume, 0xffff), 0);
+ waveOutSetVolume(0, (lVolume<<16)|lVolume);
+
+ return S_OK;
+}
+STDMETHODIMP CShockwaveGraph::get_Volume(long* plVolume)
+{
+ CheckPointer(plVolume, E_POINTER);
+
+ waveOutGetVolume(0, (DWORD*)plVolume);
+ *plVolume = (*plVolume&0xffff + ((*plVolume>>16)&0xffff)) / 2;
+ *plVolume = *plVolume*100/0x10000;
+ *plVolume = (int)((log10(1.0*(*plVolume))-2)*5000);
+ *plVolume = max(min(*plVolume, 0), -10000);
+
+ return S_OK;
+}
+
+// IAMOpenProgress
+STDMETHODIMP CShockwaveGraph::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent)
+{
+ *pllTotal = 100;
+ *pllCurrent = m_wndDestFrame.PercentLoaded();
+ return S_OK;
+}
+
+// IGraphEngine
+STDMETHODIMP_(engine_t) CShockwaveGraph::GetEngine() {return ShockWave;}
diff --git a/src/apps/mplayerc/ShockwaveGraph.h b/src/apps/mplayerc/ShockwaveGraph.h
new file mode 100644
index 000000000..66acf56ca
--- /dev/null
+++ b/src/apps/mplayerc/ShockwaveGraph.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "BaseGraph.h"
+#include "CShockwaveFlash.h"
+
+namespace DSObjects
+{
+
+class CShockwaveGraph : public CBaseGraph
+{
+ CPlayerWindow m_wndWindowFrame;
+ CShockwaveFlash m_wndDestFrame;
+
+ FILTER_STATE m_fs;
+
+public:
+ CShockwaveGraph(HWND hParent, HRESULT& hr);
+ virtual ~CShockwaveGraph();
+
+protected:
+ // IGraphBuilder
+ STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
+
+ // IMediaControl
+ STDMETHODIMP Run();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Stop();
+ STDMETHODIMP GetState(LONG msTimeout, OAFilterState* pfs);
+
+ // IMediaSeeking
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+
+ // IVideoWindow
+ STDMETHODIMP put_Visible(long Visible);
+ STDMETHODIMP get_Visible(long* pVisible);
+ STDMETHODIMP SetWindowPosition(long Left, long Top, long Width, long Height);
+
+ // IBasicVideo
+ STDMETHODIMP SetDestinationPosition(long Left, long Top, long Width, long Height);
+ STDMETHODIMP GetVideoSize(long* pWidth, long* pHeight);
+
+ // IBasicAudio
+ STDMETHODIMP put_Volume(long lVolume);
+ STDMETHODIMP get_Volume(long* plVolume);
+
+ // IAMOpenProgress
+ STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
+
+ // IGraphEngine
+ STDMETHODIMP_(engine_t) GetEngine();
+};
+
+}
+using namespace DSObjects; \ No newline at end of file
diff --git a/src/apps/mplayerc/StaticLink.cpp b/src/apps/mplayerc/StaticLink.cpp
new file mode 100644
index 000000000..eefc883ce
--- /dev/null
+++ b/src/apps/mplayerc/StaticLink.cpp
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// StaticLink.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "StaticLink.h"
+
+
+// CStaticLink
+
+COLORREF CStaticLink::g_colorUnvisited = RGB(0,0,255); // blue
+COLORREF CStaticLink::g_colorVisited = RGB(128,0,128); // purple
+
+HCURSOR CStaticLink::g_hCursorLink = NULL;
+
+IMPLEMENT_DYNAMIC(CStaticLink, CStatic)
+
+BEGIN_MESSAGE_MAP(CStaticLink, CStatic)
+ ON_WM_NCHITTEST()
+ ON_WM_CTLCOLOR_REFLECT()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_SETCURSOR()
+END_MESSAGE_MAP()
+
+///////////////////
+// Constructor sets default colors = blue/purple.
+// bDeleteOnDestroy is used internally by PixieLib in CPixieDlg.
+//
+CStaticLink::CStaticLink(LPCTSTR lpText, BOOL bDeleteOnDestroy)
+{
+ m_link = lpText; // link text (NULL ==> window text)
+ m_color = g_colorUnvisited; // not visited yet
+ m_bDeleteOnDestroy = bDeleteOnDestroy; // delete object with window?
+}
+
+//////////////////
+// Normally, a static control does not get mouse events unless it has
+// SS_NOTIFY. This achieves the same effect as SS_NOTIFY, but it's fewer
+// lines of code and more reliable than turning on SS_NOTIFY in OnCtlColor
+// because Windows doesn't send WM_CTLCOLOR to bitmap static controls.
+//
+UINT CStaticLink::OnNcHitTest(CPoint point)
+{
+ return HTCLIENT;
+}
+
+//////////////////
+// Handle reflected WM_CTLCOLOR to set custom control color.
+// For a text control, use visited/unvisited colors and underline font.
+// For non-text controls, do nothing. Also ensures SS_NOTIFY is on.
+//
+HBRUSH CStaticLink::CtlColor(CDC* pDC, UINT nCtlColor)
+{
+ ASSERT(nCtlColor == CTLCOLOR_STATIC);
+ DWORD dwStyle = GetStyle();
+
+ HBRUSH hbr = NULL;
+ if ((dwStyle & 0xFF) <= SS_RIGHT) {
+
+ // this is a text control: set up font and colors
+ if (!(HFONT)m_font) {
+ // first time init: create font
+ LOGFONT lf;
+ GetFont()->GetObject(sizeof(lf), &lf);
+ lf.lfUnderline = TRUE;
+ m_font.CreateFontIndirect(&lf);
+ }
+
+ // use underline font and visited/unvisited colors
+ pDC->SelectObject(&m_font);
+ pDC->SetTextColor(m_color);
+ pDC->SetBkMode(TRANSPARENT);
+
+ // return hollow brush to preserve parent background color
+ hbr = (HBRUSH)::GetStockObject(HOLLOW_BRUSH);
+ }
+ return hbr;
+}
+
+/////////////////
+// Handle mouse click: navigate link
+//
+void CStaticLink::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ if (m_link.IsEmpty()) {
+ // no link: try to load from resource string or window text
+ m_link.LoadString(GetDlgCtrlID()) || (GetWindowText(m_link),1);
+ if (m_link.IsEmpty())
+ return;
+ }
+
+ // Call ShellExecute to run the file.
+ // For an URL, this means opening it in the browser.
+ //
+ HINSTANCE h = m_link.Navigate();
+ if ((UINT)h > 32) { // success!
+ m_color = g_colorVisited; // change color
+ Invalidate(); // repaint
+ } else {
+ MessageBeep(0); // unable to execute file!
+ TRACE(_T("*** WARNING: CStaticLink: unable to navigate link %s\n"),
+ (LPCTSTR)m_link);
+ }
+}
+
+//////////////////
+// Set "hand" cursor to cue user that this is a link. If app has not set
+// g_hCursorLink, then try to get the cursor from winhlp32.exe,
+// resource 106, which is a pointing finger. This is a bit of a kludge,
+// but it works.
+//
+BOOL CStaticLink::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
+{
+ if (g_hCursorLink == NULL) {
+ static BOOL bTriedOnce = FALSE;
+ if (!bTriedOnce) {
+ CString windir;
+ GetWindowsDirectory(windir.GetBuffer(MAX_PATH), MAX_PATH);
+ windir.ReleaseBuffer();
+ windir += _T("\\winhlp32.exe");
+ HMODULE hModule = LoadLibrary(windir);
+ if (hModule) {
+ g_hCursorLink =
+ CopyCursor(::LoadCursor(hModule, MAKEINTRESOURCE(106)));
+ }
+ FreeLibrary(hModule);
+ bTriedOnce = TRUE;
+ }
+ }
+ if (g_hCursorLink) {
+ ::SetCursor(g_hCursorLink);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+//////////////////
+// Normally, a control class is not destoyed when the window is;
+// however, CPixieDlg creates static controls with "new" instead of
+// as class members, so it's convenient to allow the option of destroying
+// object with window. In applications where you want the object to be
+// destoyed along with the window, you can call constructor with
+// bDeleteOnDestroy=TRUE.
+//
+void CStaticLink::PostNcDestroy()
+{
+ if (m_bDeleteOnDestroy)
+ delete this;
+}
+
diff --git a/src/apps/mplayerc/StaticLink.h b/src/apps/mplayerc/StaticLink.h
new file mode 100644
index 000000000..55742a1df
--- /dev/null
+++ b/src/apps/mplayerc/StaticLink.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CHyperlink
+
+class CHyperlink : public CString {
+public:
+ CHyperlink(LPCTSTR lpLink = NULL) : CString(lpLink) { }
+ ~CHyperlink() { }
+ const CHyperlink& operator=(LPCTSTR lpsz) {
+ CString::operator=(lpsz);
+ return *this;
+ }
+ operator LPCTSTR() {
+ return CString::operator LPCTSTR();
+ }
+ virtual HINSTANCE Navigate() {
+ return IsEmpty() ? NULL :
+ ShellExecute(0, _T("open"), *this, 0, 0, SW_SHOWNORMAL);
+ }
+};
+
+// CStaticLink
+
+class CStaticLink : public CStatic
+{
+public:
+ DECLARE_DYNAMIC(CStaticLink)
+ CStaticLink(LPCTSTR lpText = NULL, BOOL bDeleteOnDestroy=FALSE);
+ ~CStaticLink() { }
+
+ // Hyperlink contains URL/filename. If NULL, I will use the window text.
+ // (GetWindowText) to get the target.
+ CHyperlink m_link;
+ COLORREF m_color;
+
+ // Default colors you can change
+ // These are global, so they're the same for all links.
+ static COLORREF g_colorUnvisited;
+ static COLORREF g_colorVisited;
+
+ // Cursor used when mouse is on a link--you can set, or
+ // it will default to the standard hand with pointing finger.
+ // This is global, so it's the same for all links.
+ static HCURSOR g_hCursorLink;
+
+protected:
+ CFont m_font; // underline font for text control
+ BOOL m_bDeleteOnDestroy; // delete object when window destroyed?
+
+ virtual void PostNcDestroy();
+
+ // message handlers
+ DECLARE_MESSAGE_MAP()
+ afx_msg UINT OnNcHitTest(CPoint point);
+ afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
+};
+
+
diff --git a/src/apps/mplayerc/StatusLabel.cpp b/src/apps/mplayerc/StatusLabel.cpp
new file mode 100644
index 000000000..a6d19d071
--- /dev/null
+++ b/src/apps/mplayerc/StatusLabel.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// StatusLabel.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "StatusLabel.h"
+
+
+// CStatusLabel
+
+IMPLEMENT_DYNAMIC(CStatusLabel, CStatic)
+CStatusLabel::CStatusLabel(bool fRightAlign, bool fAddEllipses)
+ : m_fRightAlign(fRightAlign)
+ , m_fAddEllipses(fAddEllipses)
+{
+ HDC hdc = ::GetDC(NULL);
+ double scale = 1.0*GetDeviceCaps(hdc, LOGPIXELSY) / 96.0;
+ ::ReleaseDC(0, hdc);
+
+ m_font.m_hObject = NULL;
+
+ if(!(::GetVersion()&0x80000000))
+ m_font.CreateFont(int(14.0 * scale), 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET,
+ OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE,
+ _T("Microsoft Sans Serif"));
+ if(!m_font.m_hObject)
+ m_font.CreateFont(int(14.0 * scale), 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET,
+ OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE,
+ _T("MS Sans Serif"));
+}
+
+CStatusLabel::~CStatusLabel()
+{
+}
+
+BEGIN_MESSAGE_MAP(CStatusLabel, CStatic)
+ ON_WM_ERASEBKGND()
+END_MESSAGE_MAP()
+
+// CStatusLabel message handlers
+
+void CStatusLabel::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
+{
+ CDC dc;
+ dc.Attach(lpDrawItemStruct->hDC);
+ CString str;
+ GetWindowText(str);
+ CRect r;
+ GetClientRect(&r);
+ CFont* old = dc.SelectObject(&m_font);
+ dc.SetTextColor(0xffffff);
+ dc.SetBkColor(0);
+ CSize size = dc.GetTextExtent(str);
+ CPoint p = CPoint(m_fRightAlign ? r.Width() - size.cx : 0, (r.Height()-size.cy)/2);
+
+ if(m_fAddEllipses)
+ while(size.cx > r.Width()-3 && str.GetLength() > 3)
+ {
+ str = str.Left(str.GetLength()-4) + _T("...");
+ size = dc.GetTextExtent(str);
+ }
+
+ dc.TextOut(p.x, p.y, str);
+ dc.ExcludeClipRect(CRect(p, size));
+ dc.SelectObject(&old);
+ dc.FillSolidRect(&r, 0);
+ dc.Detach();
+}
+
+BOOL CStatusLabel::OnEraseBkgnd(CDC* pDC)
+{
+ CRect r;
+ GetClientRect(&r);
+ pDC->FillSolidRect(&r, 0);
+ return TRUE;
+}
+
diff --git a/src/apps/mplayerc/StatusLabel.h b/src/apps/mplayerc/StatusLabel.h
new file mode 100644
index 000000000..0f31b7ddc
--- /dev/null
+++ b/src/apps/mplayerc/StatusLabel.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CStatusLabel
+
+class CStatusLabel : public CStatic
+{
+ DECLARE_DYNAMIC(CStatusLabel)
+
+private:
+ bool m_fRightAlign, m_fAddEllipses;
+ CFont m_font;
+
+public:
+ CStatusLabel(bool fRightAlign, bool fAddEllipses);
+ virtual ~CStatusLabel();
+
+ CFont& GetFont() {return m_font;}
+
+ void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
+
+protected:
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+};
diff --git a/src/apps/mplayerc/StdAfx.cpp b/src/apps/mplayerc/StdAfx.cpp
new file mode 100644
index 000000000..f8ecc6014
--- /dev/null
+++ b/src/apps/mplayerc/StdAfx.cpp
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// mplayerc.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
diff --git a/src/apps/mplayerc/StdAfx.h b/src/apps/mplayerc/StdAfx.h
new file mode 100644
index 000000000..c4535f2c6
--- /dev/null
+++ b/src/apps/mplayerc/StdAfx.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__C76533D6_6242_4BEB_8FD3_C6BE58F07224__INCLUDED_)
+#define AFX_STDAFX_H__C76533D6_6242_4BEB_8FD3_C6BE58F07224__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+#include <afxdisp.h> // MFC Automation classes
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+#include <afxdlgs.h>
+
+#define ResStr(id) CString(MAKEINTRESOURCE(id))
+
+#include <afxdisp.h>
+#include <afxole.h>
+
+#include <Shlwapi.h>
+
+#include <atlcoll.h>
+#include <atlpath.h>
+
+#include <streams.h>
+#include <dvdmedia.h>
+#include <mpconfig.h>
+#include "..\..\..\include\qt\qt.h"
+#include "..\..\ui\ui.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+template <class T = CString, class S = CString>
+class CAtlStringMap : public CAtlMap<S, T, CStringElementTraits<S> > {};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__C76533D6_6242_4BEB_8FD3_C6BE58F07224__INCLUDED_)
diff --git a/src/apps/mplayerc/SubtitleDlDlg.cpp b/src/apps/mplayerc/SubtitleDlDlg.cpp
new file mode 100644
index 000000000..bdf4d0609
--- /dev/null
+++ b/src/apps/mplayerc/SubtitleDlDlg.cpp
@@ -0,0 +1,153 @@
+// SubtitleDlDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "SubtitleDlDlg.h"
+
+
+// CSubtitleDlDlg dialog
+
+//IMPLEMENT_DYNAMIC(CSubtitleDlDlg, CResizableDialog)
+CSubtitleDlDlg::CSubtitleDlDlg(CList<isdb_movie>& movies, CWnd* pParent /*=NULL*/)
+ : CResizableDialog(CSubtitleDlDlg::IDD, pParent)
+{
+ m_movies.AddTail(&movies);
+}
+
+CSubtitleDlDlg::~CSubtitleDlDlg()
+{
+}
+
+int CSubtitleDlDlg::GetChecked(int iItem)
+{
+ LVITEM lvi;
+ lvi.iItem = iItem;
+ lvi.iSubItem = 0;
+ lvi.mask = LVIF_IMAGE;
+ m_list.GetItem(&lvi);
+ return(lvi.iImage);
+}
+
+void CSubtitleDlDlg::SetChecked(int iItem, int iChecked)
+{
+ LVITEM lvi;
+ lvi.iItem = iItem;
+ lvi.iSubItem = 0;
+ lvi.mask = LVIF_IMAGE;
+ lvi.iImage = iChecked;
+ m_list.SetItem(&lvi);
+}
+
+void CSubtitleDlDlg::DoDataExchange(CDataExchange* pDX)
+{
+ __super::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_list);
+}
+
+
+BEGIN_MESSAGE_MAP(CSubtitleDlDlg, CResizableDialog)
+ ON_NOTIFY(NM_CLICK, IDC_LIST1, OnNMClickList1)
+ ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOk)
+END_MESSAGE_MAP()
+
+// CSubtitleDlDlg message handlers
+
+BOOL CSubtitleDlDlg::OnInitDialog()
+{
+ __super::OnInitDialog();
+
+
+ AddAnchor(IDC_LIST1, TOP_LEFT, BOTTOM_RIGHT);
+ AddAnchor(IDC_CHECK1, BOTTOM_LEFT);
+ AddAnchor(IDOK, BOTTOM_RIGHT);
+
+ CSize s(200, 150);
+ SetMinTrackSize(s);
+
+
+ m_list.SetExtendedStyle(m_list.GetExtendedStyle()|LVS_EX_FULLROWSELECT);
+
+ m_list.InsertColumn(COL_FILENAME, _T("File"), LVCFMT_LEFT, 160);
+ m_list.InsertColumn(COL_LANGUAGE, _T("Language"), LVCFMT_CENTER, 80);
+ m_list.InsertColumn(COL_FORMAT, _T("Format"), LVCFMT_CENTER, 50);
+ m_list.InsertColumn(COL_DISC, _T("Disc"), LVCFMT_CENTER, 50);
+ m_list.InsertColumn(COL_TITLES, _T("Title(s)"), LVCFMT_LEFT, 300);
+
+ m_onoff.Create(IDB_ONOFF, 12, 3, 0xffffff);
+ m_list.SetImageList(&m_onoff, LVSIL_SMALL);
+
+
+ int i = 0;
+
+ POSITION pos = m_movies.GetHeadPosition();
+ while(pos)
+ {
+ isdb_movie& m = m_movies.GetNext(pos);
+
+ CStringA titlesA = Implode(m.titles, '|');
+ titlesA.Replace("|", ", ");
+ CString titles = UTF8To16(titlesA);
+
+ POSITION pos2 = m.subs.GetHeadPosition();
+ while(pos2)
+ {
+ isdb_subtitle& s = m.subs.GetNext(pos2);
+ CString name = UTF8To16(s.name);
+ CString language = s.language;
+ CString format = s.format;
+ CString disc;
+ disc.Format(_T("%d/%d"), s.disc_no, s.discs);
+
+ int iItem = m_list.InsertItem(i++, _T(""));
+ m_list.SetItemData(iItem, (DWORD_PTR)&s);
+ m_list.SetItemText(iItem, COL_FILENAME, name);
+ m_list.SetItemText(iItem, COL_LANGUAGE, language);
+ m_list.SetItemText(iItem, COL_FORMAT, format);
+ m_list.SetItemText(iItem, COL_DISC, disc);
+ m_list.SetItemText(iItem, COL_TITLES, titles);
+ }
+ }
+
+ m_selsubs.RemoveAll();
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CSubtitleDlDlg::OnOK()
+{
+ for(int i = 0; i < m_list.GetItemCount(); i++)
+ if(GetChecked(i))
+ m_selsubs.AddTail(*(isdb_subtitle*)m_list.GetItemData(i));
+
+ m_fReplaceSubs = IsDlgButtonChecked(IDC_CHECK1) == BST_CHECKED;
+
+ __super::OnOK();
+}
+
+void CSubtitleDlDlg::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult)
+{
+ LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)pNMHDR;
+
+ if(lpnmlv->iItem >= 0)
+ {
+ CRect r;
+ m_list.GetItemRect(lpnmlv->iItem, r, LVIR_ICON);
+ if(r.PtInRect(lpnmlv->ptAction))
+ {
+ SetChecked(lpnmlv->iItem, (GetChecked(lpnmlv->iItem)&1) == 0 ? 1 : 0);
+ }
+ }
+
+ *pResult = 0;
+}
+
+void CSubtitleDlDlg::OnUpdateOk(CCmdUI* pCmdUI)
+{
+ bool fEnable = false;
+ for(int i = 0; !fEnable && i < m_list.GetItemCount(); i++)
+ fEnable = !!GetChecked(i);
+
+ pCmdUI->Enable(fEnable);
+}
diff --git a/src/apps/mplayerc/SubtitleDlDlg.h b/src/apps/mplayerc/SubtitleDlDlg.h
new file mode 100644
index 000000000..fcf3f057e
--- /dev/null
+++ b/src/apps/mplayerc/SubtitleDlDlg.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "ISDb.h"
+#include "afxwin.h"
+
+// CSubtitleDlDlg dialog
+
+class CSubtitleDlDlg : public CResizableDialog
+{
+// DECLARE_DYNAMIC(CSubtitleDlDlg)
+
+private:
+ CList<isdb_movie> m_movies;
+
+ enum {COL_FILENAME, COL_LANGUAGE, COL_FORMAT, COL_DISC, COL_TITLES};
+
+ CImageList m_onoff;
+ int GetChecked(int iItem);
+ void SetChecked(int iItem, int iChecked);
+
+public:
+ CSubtitleDlDlg(CList<isdb_movie>& movies, CWnd* pParent = NULL); // standard constructor
+ virtual ~CSubtitleDlDlg();
+
+ bool m_fReplaceSubs;
+ CList<isdb_subtitle> m_selsubs;
+
+// Dialog Data
+ enum { IDD = IDD_SUBTITLEDL_DLG };
+ CListCtrl m_list;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnUpdateOk(CCmdUI* pCmdUI);
+};
diff --git a/src/apps/mplayerc/TextPassThruFilter.cpp b/src/apps/mplayerc/TextPassThruFilter.cpp
new file mode 100644
index 000000000..842b23c9a
--- /dev/null
+++ b/src/apps/mplayerc/TextPassThruFilter.cpp
@@ -0,0 +1,249 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <windows.h>
+#include <commdlg.h>
+#include "mplayerc.h"
+#include "mainfrm.h"
+#include "TextPassThruFilter.h"
+#include "..\..\..\include\moreuuids.h"
+#include "..\..\DSUtil\DSUtil.h"
+#include "..\..\subtitles\SubtitleInputPin.h"
+
+//
+// CTextPassThruInputPin
+//
+
+class CTextPassThruInputPin : public CSubtitleInputPin
+{
+ CTextPassThruFilter* m_pTPTFilter;
+ CComPtr<ISubStream> m_pSubStreamOld;
+
+protected:
+ void AddSubStream(ISubStream* pSubStream)
+ {
+ if(m_pSubStreamOld)
+ {
+ if(pSubStream) m_pTPTFilter->m_pMainFrame->ReplaceSubtitle(m_pSubStreamOld, pSubStream);
+ m_pSubStreamOld = NULL;
+ }
+ }
+
+ void RemoveSubStream(ISubStream* pSubStream)
+ {
+ m_pSubStreamOld = pSubStream;
+ }
+
+ void InvalidateSubtitle(REFERENCE_TIME rtStart, ISubStream* pSubStream)
+ {
+ m_pTPTFilter->m_pMainFrame->InvalidateSubtitle((DWORD_PTR)pSubStream, rtStart);
+ }
+
+public:
+ CTextPassThruInputPin(CTextPassThruFilter* pTPTFilter, CCritSec* pLock, CCritSec* pSubLock, HRESULT* phr);
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ STDMETHODIMP Receive(IMediaSample* pSample);
+ STDMETHODIMP EndOfStream();
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
+};
+
+//
+// CTextPassThruOutputPin
+//
+
+class CTextPassThruOutputPin : public CBaseOutputPin
+{
+ CTextPassThruFilter* m_pTPTFilter;
+
+public:
+ CTextPassThruOutputPin(CTextPassThruFilter* pTPTFilter, CCritSec* pLock, HRESULT* phr);
+
+ HRESULT CheckMediaType(const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q) {return S_OK;}
+};
+
+///////////
+
+CTextPassThruInputPin::CTextPassThruInputPin(CTextPassThruFilter* pTPTFilter, CCritSec* pLock, CCritSec* pSubLock, HRESULT* phr)
+ : CSubtitleInputPin(pTPTFilter, pLock, pSubLock, phr)
+ , m_pTPTFilter(pTPTFilter)
+{
+}
+
+STDMETHODIMP CTextPassThruInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ HRESULT hr = __super::NewSegment(tStart, tStop, dRate);
+ if(FAILED(hr)) return hr;
+ return m_pTPTFilter->m_pOutput->DeliverNewSegment(tStart, tStop, dRate);
+}
+
+STDMETHODIMP CTextPassThruInputPin::Receive(IMediaSample* pSample)
+{
+ HRESULT hr = __super::Receive(pSample);
+ if(FAILED(hr)) return hr;
+ return m_pTPTFilter->m_pOutput->Deliver(pSample);
+}
+
+STDMETHODIMP CTextPassThruInputPin::EndOfStream()
+{
+ HRESULT hr = __super::EndOfStream();
+ if(FAILED(hr)) return hr;
+ return m_pTPTFilter->m_pOutput->DeliverEndOfStream();
+}
+
+STDMETHODIMP CTextPassThruInputPin::BeginFlush()
+{
+ HRESULT hr = __super::BeginFlush();
+ if(FAILED(hr)) return hr;
+ return m_pTPTFilter->m_pOutput->DeliverBeginFlush();
+}
+
+STDMETHODIMP CTextPassThruInputPin::EndFlush()
+{
+ HRESULT hr = __super::EndFlush();
+ if(FAILED(hr)) return hr;
+ return m_pTPTFilter->m_pOutput->DeliverEndFlush();
+}
+
+//
+
+CTextPassThruOutputPin::CTextPassThruOutputPin(CTextPassThruFilter* pTPTFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseOutputPin(NAME(""), pTPTFilter, pLock, phr, L"Out")
+ , m_pTPTFilter(pTPTFilter)
+{
+}
+
+HRESULT CTextPassThruOutputPin::CheckMediaType(const CMediaType* mtOut)
+{
+ CMediaType mt;
+ return S_OK == m_pTPTFilter->m_pInput->ConnectionMediaType(&mt) && mt == *mtOut
+ ? S_OK
+ : E_FAIL;
+}
+
+HRESULT CTextPassThruOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pTPTFilter->m_pInput->IsConnected() == FALSE)
+ return E_UNEXPECTED;
+
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pTPTFilter->m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
+
+ pAllocatorIn->GetProperties(pProperties);
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CTextPassThruOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pTPTFilter->m_pInput->IsConnected() == FALSE)
+ return E_UNEXPECTED;
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ m_pTPTFilter->m_pInput->ConnectionMediaType(pmt);
+
+ return S_OK;
+}
+
+//
+// CTextPassThruFilter
+//
+
+CTextPassThruFilter::CTextPassThruFilter(CMainFrame* pMainFrame)
+ : CBaseFilter(NAME("CTextPassThruFilter"), NULL, this, __uuidof(this))
+ , m_pMainFrame(pMainFrame)
+{
+ HRESULT hr;
+ m_pInput = new CTextPassThruInputPin(this, this, &m_pMainFrame->m_csSubLock, &hr);
+ m_pOutput = new CTextPassThruOutputPin(this, this, &hr);
+}
+
+CTextPassThruFilter::~CTextPassThruFilter()
+{
+ delete m_pInput; m_pInput = NULL;
+ delete m_pOutput; m_pOutput = NULL;
+}
+
+STDMETHODIMP CTextPassThruFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ if(m_pInput && riid == __uuidof(ISubStream))
+ {
+ if(CComPtr<ISubStream> pSubStream = m_pInput->GetSubStream())
+ {
+ *ppv = pSubStream.Detach();
+ return S_OK;
+ }
+ }
+
+ return __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+int CTextPassThruFilter::GetPinCount()
+{
+ return 2;
+}
+
+CBasePin* CTextPassThruFilter::GetPin(int n)
+{
+ if(n == 0) return m_pInput;
+ else if(n == 1) return m_pOutput;
+ return NULL;
+}
+
+/*
+void CTextPassThruFilter::SetName()
+{
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pRTS;
+
+ CAutoLock cAutoLock(&m_pMainFrame->m_csSubLock);
+
+ if(CComQIPtr<IPropertyBag> pPB = m_pTPTInput->GetConnected())
+ {
+ CComVariant var;
+ if(SUCCEEDED(pPB->Read(L"LANGUAGE", &var, NULL)))
+ {
+ pRTS->m_name = CString(var.bstrVal) + _T(" (embeded)");
+ }
+ }
+
+ if(pRTS->m_name.IsEmpty())
+ {
+ CPinInfo pi;
+ m_pTPTInput->GetConnected()->QueryPinInfo(&pi);
+ pRTS->m_name = CString(CStringW(pi.achName)) + _T(" (embeded)");
+
+ }
+}
+*/
diff --git a/src/apps/mplayerc/TextPassThruFilter.h b/src/apps/mplayerc/TextPassThruFilter.h
new file mode 100644
index 000000000..5cbfdcdad
--- /dev/null
+++ b/src/apps/mplayerc/TextPassThruFilter.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+class CTextPassThruInputPin;
+
+[uuid("E2BA9B7B-B65D-4804-ACB2-89C3E55511DB")]
+class CTextPassThruFilter : public CBaseFilter, public CCritSec
+{
+ friend class CTextPassThruInputPin;
+ friend class CTextPassThruOutputPin;
+
+ CTextPassThruInputPin* m_pInput;
+ CTextPassThruOutputPin* m_pOutput;
+
+ CMainFrame* m_pMainFrame;
+
+public:
+ CTextPassThruFilter(CMainFrame* pMainFrame);
+ virtual ~CTextPassThruFilter();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+};
diff --git a/src/apps/mplayerc/VMROSD.cpp b/src/apps/mplayerc/VMROSD.cpp
new file mode 100644
index 000000000..6c62554ab
--- /dev/null
+++ b/src/apps/mplayerc/VMROSD.cpp
@@ -0,0 +1,302 @@
+#include "stdafx.h"
+#include ".\vmrosd.h"
+
+
+#define SEEKBAR_HEIGHT 60
+#define SLIDER_BAR_HEIGHT 10
+#define SLIDER_CURSOR_HEIGHT 30
+#define SLIDER_CURSOR_WIDTH 15
+
+
+CVMROSD::CVMROSD(void)
+{
+ m_Color[OSD_TRANSPARENT] = RGB( 0, 0, 0);
+ m_Color[OSD_BACKGROUND] = RGB( 0, 96, 183);
+ m_Color[OSD_BORDER] = RGB(255, 255, 255);
+ m_Color[OSD_TEXT] = RGB(255, 255, 255);
+ m_Color[OSD_BAR] = RGB( 4, 200, 12);
+ m_Color[OSD_CURSOR] = RGB( 23, 50, 247);
+
+ m_penBorder.CreatePen(PS_SOLID, 1, m_Color[OSD_BORDER]);
+ m_penCursor.CreatePen(PS_SOLID, 4, m_Color[OSD_CURSOR]);
+ m_brushBack.CreateSolidBrush(m_Color[OSD_BACKGROUND]);
+ m_brushBar.CreateSolidBrush (m_Color[OSD_BAR]);
+ m_MainFont.CreatePointFont (200, _T("Arial"));
+
+ m_nMessagePos = OSD_NOMESSAGE;
+}
+
+CVMROSD::~CVMROSD(void)
+{
+}
+
+
+void CVMROSD::OnSize(UINT nType, int cx, int cy)
+{
+ // TODO : gérer le changement de taille de fenêtre
+}
+
+void CVMROSD::Start (CWnd* pWnd, CComQIPtr<IVMRMixerBitmap9> pVMB)
+{
+ CRect rc;
+ CWindowDC dc (pWnd);
+
+ m_pWnd = pWnd;
+ m_bCursorMoving = false;
+ m_bSeekBarVisible = false;
+
+ CalcRect();
+
+ m_MemDC.DeleteDC();
+ m_Bitmap.DeleteObject();
+
+ if (m_MemDC.CreateCompatibleDC (&dc))
+ {
+ BITMAPINFO bmi = {0};
+ HBITMAP hbmpRender;
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = m_rectWnd.Width();
+ bmi.bmiHeader.biHeight = - (int) m_rectWnd.Height(); // top-down
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = 32;
+ bmi.bmiHeader.biCompression = BI_RGB;
+ hbmpRender = CreateDIBSection( m_MemDC, &bmi, DIB_RGB_COLORS, NULL, NULL, NULL );
+ m_MemDC.SelectObject (hbmpRender);
+
+ if (::GetObject(hbmpRender, sizeof(BITMAP), &m_BitmapInfo) != 0)
+ {
+ // Configure the VMR's bitmap structure
+ ZeroMemory(&m_VMR9AlphaBitmap, sizeof(m_VMR9AlphaBitmap) );
+ m_VMR9AlphaBitmap.dwFlags = VMRBITMAP_HDC | VMRBITMAP_SRCCOLORKEY;
+ m_VMR9AlphaBitmap.hdc = m_MemDC;
+ m_VMR9AlphaBitmap.rSrc = m_rectWnd;
+ m_VMR9AlphaBitmap.rDest.left = 0;
+ m_VMR9AlphaBitmap.rDest.top = 0;
+ m_VMR9AlphaBitmap.rDest.right = 1.0;
+ m_VMR9AlphaBitmap.rDest.bottom = 1.0;
+ m_VMR9AlphaBitmap.fAlpha = 1.0;
+ m_VMR9AlphaBitmap.clrSrcKey = m_Color[OSD_TRANSPARENT];
+
+ m_MemDC.SelectObject(m_MainFont);
+ m_MemDC.SetTextColor(RGB(255, 255, 255));
+ m_MemDC.SetBkMode(TRANSPARENT);
+
+ m_pVMB = pVMB;
+ }
+ }
+}
+
+
+void CVMROSD::Stop()
+{
+ m_pVMB.Release();
+}
+
+void CVMROSD::CalcRect()
+{
+ m_pWnd->GetClientRect(&m_rectWnd);
+
+ m_rectSeekBar.left = m_rectWnd.left + 10;
+ m_rectSeekBar.right = m_rectWnd.right - 10;
+ m_rectSeekBar.top = m_rectWnd.bottom - SEEKBAR_HEIGHT;
+ m_rectSeekBar.bottom = m_rectSeekBar.top + SEEKBAR_HEIGHT;
+
+ m_rectSeekBar.left = m_rectSeekBar.left;
+ m_rectSeekBar.right = m_rectSeekBar.right;
+ m_rectSeekBar.top = m_rectSeekBar.top;
+ m_rectSeekBar.bottom = m_rectSeekBar.bottom;
+}
+
+void CVMROSD::DrawRect(CRect* rect, CBrush* pBrush, CPen* pPen)
+{
+ if (pPen)
+ m_MemDC.SelectObject (pPen);
+ else
+ m_MemDC.SelectStockObject(NULL_PEN);
+
+ if (pBrush)
+ m_MemDC.SelectObject (pBrush);
+ else
+ m_MemDC.SelectStockObject(HOLLOW_BRUSH);
+
+ m_MemDC.Rectangle (rect);
+}
+
+void CVMROSD::DrawSlider(CRect* rect, __int64 llMin, __int64 llMax, __int64 llPos)
+{
+ m_rectBar.left = rect->left + 10;
+ m_rectBar.right = rect->right - 10;
+ m_rectBar.top = rect->top + (rect->Height() - SLIDER_BAR_HEIGHT) / 2;
+ m_rectBar.bottom = m_rectBar.top + SLIDER_BAR_HEIGHT;
+
+ if (llMax == llMin)
+ m_rectCursor.left = m_rectBar.left;
+ else
+ m_rectCursor.left = m_rectBar.left + (m_rectBar.Width() - SLIDER_CURSOR_WIDTH) * llPos / (llMax-llMin);
+ m_rectCursor.right = m_rectCursor.left + SLIDER_CURSOR_WIDTH;
+ m_rectCursor.top = rect->top + (rect->Height() - SLIDER_CURSOR_HEIGHT) / 2;
+ m_rectCursor.bottom = m_rectCursor.top + SLIDER_CURSOR_HEIGHT;
+
+ DrawRect (rect, &m_brushBack, &m_penBorder);
+ DrawRect (&m_rectBar, &m_brushBar);
+ DrawRect (&m_rectCursor, NULL, &m_penCursor);
+}
+
+
+void CVMROSD::DrawMessage()
+{
+ if (m_nMessagePos != OSD_NOMESSAGE)
+ {
+ CRect rectText (0,0,0,0);
+ CRect rectMessages;
+
+ m_MemDC.DrawText (m_strMessage, &rectText, DT_CALCRECT);
+ rectText.InflateRect(20, 10);
+ switch (m_nMessagePos)
+ {
+ case OSD_TOPLEFT :
+ rectMessages = CRect (10, 10, rectText.right + 10, rectText.bottom + 10);
+ break;
+ case OSD_TOPRIGHT :
+ default :
+ rectMessages = CRect (m_rectWnd.right-10-rectText.Width(), 10, m_rectWnd.right-10, rectText.bottom + 10);
+ break;
+ }
+ DrawRect (&rectMessages, &m_brushBack, &m_penBorder);
+ m_MemDC.DrawText (m_strMessage, &rectMessages, DT_SINGLELINE |DT_CENTER|DT_VCENTER);
+ }
+}
+
+void CVMROSD::Invalidate()
+{
+ memsetd(m_BitmapInfo.bmBits, 0xff000000, m_BitmapInfo.bmWidth*m_BitmapInfo.bmHeight*(m_BitmapInfo.bmBitsPixel/8));
+
+ if (m_bSeekBarVisible) DrawSlider(&m_rectSeekBar, m_llSeekMin, m_llSeekMax, m_llSeekPos);
+ DrawMessage();
+
+ m_VMR9AlphaBitmap.dwFlags &= ~VMRBITMAP_DISABLE;
+ if (m_pVMB) m_pVMB->SetAlphaBitmap(&m_VMR9AlphaBitmap);
+}
+
+void CVMROSD::UpdateSeekBarPos(CPoint point)
+{
+ m_llSeekPos = (point.x - m_rectBar.left) * (m_llSeekMax-m_llSeekMin) / (m_rectBar.Width() - SLIDER_CURSOR_WIDTH);
+ m_llSeekPos = max (m_llSeekPos, m_llSeekMin);
+ m_llSeekPos = min (m_llSeekPos, m_llSeekMax);
+
+ AfxGetApp()->GetMainWnd()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)m_llSeekPos, SB_THUMBTRACK), (LPARAM)m_pWnd->m_hWnd);
+}
+
+bool CVMROSD::OnMouseMove(UINT nFlags, CPoint point)
+{
+ bool bRet = true;
+
+ if (m_pVMB)
+ {
+ if (m_bCursorMoving)
+ {
+ UpdateSeekBarPos(point);
+ Invalidate();
+ }
+ else if (!m_bSeekBarVisible && m_rectSeekBar.PtInRect(point))
+ {
+ m_bSeekBarVisible = true;
+ Invalidate();
+ }
+ else if (m_bSeekBarVisible && !m_rectSeekBar.PtInRect(point))
+ {
+ m_bSeekBarVisible = false;
+ Invalidate();
+ }
+ else
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+bool CVMROSD::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ bool bRet = true;
+ if (m_pVMB)
+ {
+ if (m_rectCursor.PtInRect (point))
+ {
+ m_bCursorMoving = true;
+ }
+ else if (m_rectSeekBar.PtInRect(point))
+ {
+ UpdateSeekBarPos(point);
+ Invalidate();
+ }
+ else bRet = false;
+ }
+
+ return bRet;
+}
+
+bool CVMROSD::OnLButtonUp(UINT nFlags, CPoint point)
+{
+ bool bRet = true;
+
+ if (m_pVMB)
+ {
+ m_bCursorMoving = false;
+
+ bRet = (m_rectCursor.PtInRect (point) || m_rectSeekBar.PtInRect(point));
+ }
+ return bRet;
+}
+
+__int64 CVMROSD::GetPos()
+{
+ return m_llSeekPos;
+}
+
+void CVMROSD::SetPos(__int64 pos)
+{
+ m_llSeekPos = pos;
+}
+
+void CVMROSD::SetRange(__int64 start, __int64 stop)
+{
+ m_llSeekMin = start;
+ m_llSeekMax = stop;
+}
+
+void CVMROSD::GetRange(__int64& start, __int64& stop)
+{
+ start = m_llSeekMin;
+ stop = m_llSeekMax;
+}
+
+void CVMROSD::TimerFunc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime)
+{
+ CVMROSD* pVMROSD = (CVMROSD*) nIDEvent;
+ if (pVMROSD)
+ {
+ pVMROSD->ClearMessage();
+ }
+}
+
+void CVMROSD::ClearMessage()
+{
+ if (m_pVMB)
+ {
+ m_VMR9AlphaBitmap.dwFlags |= VMRBITMAP_DISABLE;
+ m_nMessagePos = OSD_NOMESSAGE;
+ if (m_pVMB) m_pVMB->SetAlphaBitmap(&m_VMR9AlphaBitmap);
+ }
+}
+
+void CVMROSD::DisplayMessage (OSD_MESSAGEPOS nPos, LPCTSTR strMsg, int nDuration)
+{
+ if (m_pVMB)
+ {
+ m_nMessagePos = nPos;
+ m_strMessage = strMsg;
+ KillTimer(m_pWnd->m_hWnd, (long)this);
+ if (nDuration != -1) SetTimer(m_pWnd->m_hWnd, (long)this, nDuration, TimerFunc);
+ Invalidate();
+ }
+}
diff --git a/src/apps/mplayerc/VMROSD.h b/src/apps/mplayerc/VMROSD.h
new file mode 100644
index 000000000..20d83c324
--- /dev/null
+++ b/src/apps/mplayerc/VMROSD.h
@@ -0,0 +1,89 @@
+#pragma once
+
+#include <atlbase.h>
+#include <D3d9.h>
+#include <Vmr9.h>
+
+typedef enum
+{
+ OSD_TRANSPARENT,
+ OSD_BACKGROUND,
+ OSD_BORDER,
+ OSD_TEXT,
+ OSD_BAR,
+ OSD_CURSOR,
+ OSD_LAST
+} OSD_COLORS;
+
+typedef enum
+{
+ OSD_NOMESSAGE,
+ OSD_TOPLEFT,
+ OSD_TOPRIGHT,
+} OSD_MESSAGEPOS;
+
+
+class CVMROSD
+{
+public:
+ CVMROSD(void);
+ ~CVMROSD(void);
+
+ void Start (CWnd* pWnd, CComQIPtr<IVMRMixerBitmap9> pVMB);
+ void Stop();
+
+ void DisplayMessage (OSD_MESSAGEPOS nPos, LPCTSTR strMsg, int nDuration = 5000);
+ void ClearMessage();
+
+ __int64 GetPos();
+ void SetPos(__int64 pos);
+ void SetRange(__int64 start, __int64 stop);
+ void GetRange(__int64& start, __int64& stop);
+
+ void OnSize(UINT nType, int cx, int cy);
+ bool OnMouseMove(UINT nFlags, CPoint point);
+ bool OnLButtonDown(UINT nFlags, CPoint point);
+ bool OnLButtonUp(UINT nFlags, CPoint point);
+
+private :
+ CComQIPtr<IVMRMixerBitmap9> m_pVMB;
+ CWnd* m_pWnd;
+
+ CBitmap m_Bitmap;
+ CDC m_MemDC;
+ VMR9AlphaBitmap m_VMR9AlphaBitmap;
+ BITMAP m_BitmapInfo;
+
+ CFont m_MainFont;
+ CPen m_penBorder;
+ CPen m_penCursor;
+ CBrush m_brushBack;
+ CBrush m_brushBar;
+
+ CRect m_rectWnd;
+ COLORREF m_Color[OSD_LAST];
+
+ // Curseur de calage
+ CRect m_rectSeekBar;
+ CRect m_rectCursor;
+ CRect m_rectBar;
+ bool m_bCursorMoving;
+ bool m_bSeekBarVisible;
+ __int64 m_llSeekMin;
+ __int64 m_llSeekMax;
+ __int64 m_llSeekPos;
+
+ // Messages
+ CString m_strMessage;
+ OSD_MESSAGEPOS m_nMessagePos;
+
+ void CalcRect();
+ void UpdateSeekBarPos(CPoint point);
+ void DrawSlider(CRect* rect, __int64 llMin, __int64 llMax, __int64 llPos);
+ void DrawRect(CRect* rect, CBrush* pBrush = NULL, CPen* pPen = NULL);
+ void Invalidate();
+ void DrawMessage();
+
+ static void CALLBACK TimerFunc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime);
+
+};
diff --git a/src/apps/mplayerc/VolumeCtrl.cpp b/src/apps/mplayerc/VolumeCtrl.cpp
new file mode 100644
index 000000000..5d9decfa3
--- /dev/null
+++ b/src/apps/mplayerc/VolumeCtrl.cpp
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// VolumeCtrl.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "VolumeCtrl.h"
+
+
+// CVolumeCtrl
+
+IMPLEMENT_DYNAMIC(CVolumeCtrl, CSliderCtrl)
+CVolumeCtrl::CVolumeCtrl(bool fSelfDrawn) : m_fSelfDrawn(fSelfDrawn)
+{
+}
+
+CVolumeCtrl::~CVolumeCtrl()
+{
+}
+
+bool CVolumeCtrl::Create(CWnd* pParentWnd)
+{
+ if(!CSliderCtrl::Create(WS_CHILD|WS_VISIBLE|TBS_NOTICKS|TBS_HORZ, CRect(0,0,0,0), pParentWnd, IDC_SLIDER1))
+ return(false);
+
+ SetRange(1, 100);
+ SetPosInternal(AfxGetAppSettings().nVolume);
+ SetPageSize(8);
+ SetLineSize(0);
+
+ return(true);
+}
+
+void CVolumeCtrl::SetPosInternal(int pos)
+{
+ SetPos(pos);
+ GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)pos, SB_THUMBPOSITION), (LPARAM)m_hWnd); // this will be reflected back on us
+}
+
+void CVolumeCtrl::IncreaseVolume()
+{
+ SetPosInternal(GetPos() + GetPageSize());
+}
+
+void CVolumeCtrl::DecreaseVolume()
+{
+ SetPosInternal(GetPos() - GetPageSize());
+}
+
+BEGIN_MESSAGE_MAP(CVolumeCtrl, CSliderCtrl)
+ ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnNMCustomdraw)
+ ON_WM_LBUTTONDOWN()
+ ON_WM_SETFOCUS()
+ ON_WM_HSCROLL_REFLECT()
+END_MESSAGE_MAP()
+
+// CVolumeCtrl message handlers
+
+
+void CVolumeCtrl::OnNMCustomdraw(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
+
+ LRESULT lr = CDRF_DODEFAULT;
+
+ if(m_fSelfDrawn)
+ switch(pNMCD->dwDrawStage)
+ {
+ case CDDS_PREPAINT:
+ lr = CDRF_NOTIFYITEMDRAW;
+ break;
+
+ case CDDS_ITEMPREPAINT:
+ if(pNMCD->dwItemSpec == TBCD_CHANNEL)
+ {
+ CDC dc;
+ dc.Attach(pNMCD->hdc);
+
+ CRect r;
+ GetClientRect(r);
+ r.DeflateRect(8, 4, 10, 6);
+ CopyRect(&pNMCD->rc, &r);
+ CPen shadow(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
+ CPen light(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
+ CPen* old = dc.SelectObject(&light);
+ dc.MoveTo(pNMCD->rc.right, pNMCD->rc.top);
+ dc.LineTo(pNMCD->rc.right, pNMCD->rc.bottom);
+ dc.LineTo(pNMCD->rc.left, pNMCD->rc.bottom);
+ dc.SelectObject(&shadow);
+ dc.LineTo(pNMCD->rc.right, pNMCD->rc.top);
+ dc.SelectObject(old);
+
+ dc.Detach();
+ lr = CDRF_SKIPDEFAULT;
+ }
+ else if(pNMCD->dwItemSpec == TBCD_THUMB)
+ {
+ CDC dc;
+ dc.Attach(pNMCD->hdc);
+ pNMCD->rc.bottom--;
+ CRect r(pNMCD->rc);
+ r.DeflateRect(0, 0, 1, 0);
+
+ COLORREF shadow = GetSysColor(COLOR_3DSHADOW);
+ COLORREF light = GetSysColor(COLOR_3DHILIGHT);
+ dc.Draw3dRect(&r, light, 0);
+ r.DeflateRect(0, 0, 1, 1);
+ dc.Draw3dRect(&r, light, shadow);
+ r.DeflateRect(1, 1, 1, 1);
+ dc.FillSolidRect(&r, GetSysColor(COLOR_BTNFACE));
+ dc.SetPixel(r.left+7, r.top-1, GetSysColor(COLOR_BTNFACE));
+
+ dc.Detach();
+ lr = CDRF_SKIPDEFAULT;
+ }
+
+ break;
+ };
+
+ pNMCD->uItemState &= ~CDIS_FOCUS;
+
+ *pResult = lr;
+}
+
+void CVolumeCtrl::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ CRect r;
+ GetChannelRect(&r);
+
+ if(r.left >= r.right) return;
+
+ int start, stop;
+ GetRange(start, stop);
+
+ int pos = GetPos();
+
+ r.left += 3;
+ r.right -= 4;
+
+ if(point.x < r.left) SetPos(start);
+ else if(point.x >= r.right) SetPos(stop);
+ else
+ {
+ int w = r.right - r.left;
+ if(start < stop)
+ SetPosInternal(start + ((stop - start) * (point.x - r.left) + (w/2)) / w);
+ }
+
+ CSliderCtrl::OnLButtonDown(nFlags, point);
+}
+
+void CVolumeCtrl::OnSetFocus(CWnd* pOldWnd)
+{
+ CSliderCtrl::OnSetFocus(pOldWnd);
+
+ AfxGetMainWnd()->SetFocus(); // don't focus on us, parents will take care of our positioning
+}
+
+void CVolumeCtrl::HScroll(UINT nSBCode, UINT nPos)
+{
+ AfxGetAppSettings().nVolume = GetPos();
+
+ CFrameWnd* pFrame = GetParentFrame();
+ if(pFrame && pFrame != GetParent())
+ pFrame->PostMessage(WM_HSCROLL, MAKEWPARAM((short)nPos, nSBCode), (LPARAM)m_hWnd);
+}
diff --git a/src/apps/mplayerc/VolumeCtrl.h b/src/apps/mplayerc/VolumeCtrl.h
new file mode 100644
index 000000000..13d1fd098
--- /dev/null
+++ b/src/apps/mplayerc/VolumeCtrl.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CVolumeCtrl
+
+class CVolumeCtrl : public CSliderCtrl
+{
+ DECLARE_DYNAMIC(CVolumeCtrl)
+
+private:
+ bool m_fSelfDrawn;
+
+public:
+ CVolumeCtrl(bool fSelfDrawn = true);
+ virtual ~CVolumeCtrl();
+
+ bool Create(CWnd* pParentWnd);
+
+ void IncreaseVolume(), DecreaseVolume();
+
+ void SetPosInternal(int pos);
+
+protected:
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnSetFocus(CWnd* pOldWnd);
+ afx_msg void HScroll(UINT nSBCode, UINT nPos);
+};
diff --git a/src/apps/mplayerc/WebClientSocket.cpp b/src/apps/mplayerc/WebClientSocket.cpp
new file mode 100644
index 000000000..510bd7060
--- /dev/null
+++ b/src/apps/mplayerc/WebClientSocket.cpp
@@ -0,0 +1,727 @@
+#include "stdafx.h"
+#include <atlisapi.h>
+#include "mplayerc.h"
+#include "resource.h"
+#include "MainFrm.h"
+#include "..\..\subtitles\TextFile.h"
+#include ".\webserver.h"
+#include ".\webclientsocket.h"
+
+CWebClientSocket::CWebClientSocket(CWebServer* pWebServer, CMainFrame* pMainFrame)
+ : m_pWebServer(pWebServer)
+ , m_pMainFrame(pMainFrame)
+{
+}
+
+CWebClientSocket::~CWebClientSocket()
+{
+}
+
+bool CWebClientSocket::SetCookie(CString name, CString value, __time64_t expire, CString path, CString domain)
+{
+ if(name.IsEmpty()) return(false);
+ if(value.IsEmpty()) {m_cookie.RemoveKey(name); return true;}
+
+ m_cookie[name] = value;
+
+ m_cookieattribs[name].path = path;
+ m_cookieattribs[name].domain = domain;
+
+ if(expire >= 0)
+ {
+ CTime t(expire);
+ SYSTEMTIME st;
+ t.GetAsSystemTime(st);
+ CStringA str;
+ SystemTimeToHttpDate(st, str);
+ m_cookieattribs[name].expire = str;
+ }
+
+ return true;
+}
+
+void CWebClientSocket::Clear()
+{
+ m_hdr.Empty();
+ m_hdrlines.RemoveAll();
+ m_data.Empty();
+
+ m_cmd.Empty();
+ m_path.Empty();
+ m_ver.Empty();
+ m_get.RemoveAll();
+ m_post.RemoveAll();
+ m_cookie.RemoveAll();
+ m_request.RemoveAll();
+}
+
+void CWebClientSocket::Header()
+{
+ if(m_cmd.IsEmpty())
+ {
+ if(m_hdr.IsEmpty()) return;
+
+ CAtlList<CString> lines;
+ Explode(m_hdr, lines, '\n');
+ CString str = lines.RemoveHead();
+
+ CAtlList<CString> sl;
+ ExplodeMin(str, sl, ' ', 3);
+ m_cmd = sl.RemoveHead().MakeUpper();
+ m_path = sl.RemoveHead();
+ m_ver = sl.RemoveHead().MakeUpper();
+ ASSERT(sl.GetCount() == 0);
+
+ POSITION pos = lines.GetHeadPosition();
+ while(pos)
+ {
+ Explode(lines.GetNext(pos), sl, ':', 2);
+ if(sl.GetCount() == 2)
+ m_hdrlines[sl.GetHead().MakeLower()] = sl.GetTail();
+ }
+ }
+
+ // remember new cookies
+
+ POSITION pos = m_hdrlines.GetStartPosition();
+ while(pos)
+ {
+ CString key, value;
+ m_hdrlines.GetNextAssoc(pos, key, value);
+
+ if(key == _T("cookie"))
+ {
+ CAtlList<CString> sl;
+ Explode(value, sl, ';');
+ POSITION pos2 = sl.GetHeadPosition();
+ while(pos2)
+ {
+ CAtlList<CString> sl2;
+ Explode(sl.GetNext(pos2), sl2, '=', 2);
+ m_cookie[sl2.GetHead()] = sl2.GetCount() == 2 ? sl2.GetTail() : _T("");
+ }
+ }
+ }
+
+ // start new session
+
+ if(!m_cookie.Lookup(_T("MPCSESSIONID"), m_sessid))
+ {
+ srand((unsigned int)time(NULL));
+ m_sessid.Format(_T("%08x"), rand()*0x12345678);
+ SetCookie(_T("MPCSESSIONID"), m_sessid);
+ }
+ else
+ {
+ // TODO: load session
+ }
+
+ CStringA reshdr, resbody;
+
+ if(m_cmd == _T("POST"))
+ {
+ CString str;
+ if(m_hdrlines.Lookup(_T("content-length"), str))
+ {
+ int len = _tcstol(str, NULL, 10);
+ str.Empty();
+
+ int err;
+ char c;
+
+ int timeout = 1000;
+
+ do
+ {
+ for(; len > 0 && (err = Receive(&c, 1)) > 0; len--)
+ {
+ m_data += c;
+ if(c == '\r') continue;
+ str += c;
+ if(c == '\n' || len == 1)
+ {
+ CAtlList<CString> sl;
+ Explode(AToT(UrlDecode(TToA(str))), sl, '&'); // FIXME
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ CAtlList<CString> sl2;
+ Explode(sl.GetNext(pos), sl2, '=', 2);
+ m_post[sl2.GetHead().MakeLower()] = sl2.GetCount() == 2 ? sl2.GetTail() : _T("");
+ }
+ str.Empty();
+ }
+ }
+
+ if(err == SOCKET_ERROR)
+ Sleep(1);
+ }
+ while(err == SOCKET_ERROR && GetLastError() == WSAEWOULDBLOCK
+ && timeout-- > 0); // FIXME: this is just a dirty fix now
+
+ // FIXME: with IE it will only work if I read +2 bytes (?), btw Receive will just return -1
+ Receive(&c, 1);
+ Receive(&c, 1);
+ }
+ }
+
+ if(m_cmd == _T("GET") || m_cmd == _T("HEAD") || m_cmd == _T("POST"))
+ {
+ CAtlList<CString> sl;
+
+ Explode(m_path, sl, '?', 2);
+ m_path = sl.RemoveHead();
+ m_query.Empty();
+
+ if(!sl.IsEmpty())
+ {
+ m_query = sl.GetTail();
+
+ Explode(Explode(m_query, sl, '#', 2), sl, '&'); // oh yeah
+ // Explode(AToT(UrlDecode(TToA(Explode(m_query, sl, '#', 2)))), sl, '&'); // oh yeah
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ CAtlList<CString> sl2;
+ Explode(AToT(UrlDecode(TToA(sl.GetNext(pos)))), sl2, '=', 2);
+ // Explode(sl.GetNext(pos), sl2, '=', 2);
+ m_get[sl2.GetHead()] = sl2.GetCount() == 2 ? sl2.GetTail() : _T("");
+ }
+ }
+
+ // m_request <-- m_get+m_post+m_cookie
+ {
+ CString key, value;
+ POSITION pos;
+ pos = m_get.GetStartPosition();
+ while(pos) {m_get.GetNextAssoc(pos, key, value); m_request[key] = value;}
+ pos = m_post.GetStartPosition();
+ while(pos) {m_post.GetNextAssoc(pos, key, value); m_request[key] = value;}
+ pos = m_cookie.GetStartPosition();
+ while(pos) {m_cookie.GetNextAssoc(pos, key, value); m_request[key] = value;}
+ }
+
+ m_pWebServer->OnRequest(this, reshdr, resbody);
+ }
+ else
+ {
+ reshdr = "HTTP/1.0 400 Bad Request\r\n";
+ }
+
+ if(!reshdr.IsEmpty())
+ {
+ // cookies
+ {
+ POSITION pos = m_cookie.GetStartPosition();
+ while(pos)
+ {
+ CString key, value;
+ m_cookie.GetNextAssoc(pos, key, value);
+ reshdr += "Set-Cookie: " + key + "=" + value;
+ POSITION pos2 = m_cookieattribs.GetStartPosition();
+ while(pos2)
+ {
+ CString key;
+ cookie_attribs value;
+ m_cookieattribs.GetNextAssoc(pos2, key, value);
+ if(!value.path.IsEmpty()) reshdr += " path=" + value.path;
+ if(!value.expire.IsEmpty()) reshdr += " expire=" + value.expire;
+ if(!value.domain.IsEmpty()) reshdr += " domain=" + value.domain;
+ }
+ reshdr += "\r\n";
+ }
+ }
+
+ reshdr +=
+ "Server: MPC WebServer\r\n"
+ "Connection: close\r\n"
+ "\r\n";
+
+ Send(reshdr, reshdr.GetLength());
+
+ if(m_cmd != _T("HEAD") && reshdr.Find("HTTP/1.0 200 OK") == 0 && !resbody.IsEmpty())
+ {
+ Send(resbody, resbody.GetLength());
+ }
+
+ CString connection = _T("close");
+ m_hdrlines.Lookup(_T("connection"), connection);
+
+ Clear();
+
+ // TODO
+ // if(connection == _T("close"))
+ OnClose(0);
+ }
+}
+
+//
+
+void CWebClientSocket::OnReceive(int nErrorCode)
+{
+ if(nErrorCode == 0)
+ {
+ char c;
+ while(Receive(&c, 1) > 0)
+ {
+ if(c == '\r') continue;
+ else m_hdr += c;
+
+ int len = m_hdr.GetLength();
+ if(len >= 2 && m_hdr[len-2] == '\n' && m_hdr[len-1] == '\n')
+ {
+ Header();
+ return;
+ }
+ }
+ }
+
+ __super::OnReceive(nErrorCode);
+}
+
+void CWebClientSocket::OnClose(int nErrorCode)
+{
+ // TODO: save session
+ m_pWebServer->OnClose(this);
+ __super::OnClose(nErrorCode);
+}
+
+////////////////////
+
+bool CWebClientSocket::OnCommand(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ CString arg;
+ if(m_request.Lookup(_T("wm_command"), arg))
+ {
+ int id = _ttol(arg);
+
+ if(id > 0)
+ {
+ if(id == ID_FILE_EXIT) m_pMainFrame->PostMessage(WM_COMMAND, id);
+ else m_pMainFrame->SendMessage(WM_COMMAND, id);
+ }
+ else
+ {
+ if(arg == CMD_SETPOS && m_request.Lookup(_T("position"), arg))
+ {
+ int h, m, s, ms = 0;
+ TCHAR c;
+ if(_stscanf(arg, _T("%d%c%d%c%d%c%d"), &h, &c, &m, &c, &s, &c, &ms) >= 5)
+ {
+ REFERENCE_TIME rtPos = 10000i64*(((h*60+m)*60+s)*1000+ms);
+ m_pMainFrame->SeekTo(rtPos);
+ for(int retries = 20; retries-- > 0; Sleep(50))
+ {
+ if(abs((int)((rtPos - m_pMainFrame->GetPos())/10000)) < 100)
+ break;
+ }
+ }
+ }
+ else if(arg == CMD_SETPOS && m_request.Lookup(_T("percent"), arg))
+ {
+ float percent = 0;
+ if(_stscanf(arg, _T("%f"), &percent) == 1)
+ m_pMainFrame->SeekTo((REFERENCE_TIME)(percent / 100 * m_pMainFrame->GetDur()));
+ }
+ else if(arg == CMD_SETVOLUME && m_request.Lookup(_T("volume"), arg))
+ {
+ int volume = _tcstol(arg, NULL, 10);
+ m_pMainFrame->m_wndToolBar.Volume = min(max(volume, 1), 100);
+ m_pMainFrame->OnPlayVolume(0);
+ }
+ }
+ }
+
+ CString ref;
+ if(!m_hdrlines.Lookup(_T("referer"), ref))
+ return true;
+
+ hdr =
+ "HTTP/1.0 302 Found\r\n"
+ "Location: " + CStringA(ref) + "\r\n";
+
+ return true;
+}
+
+bool CWebClientSocket::OnIndex(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ CStringA wmcoptions;
+
+ // generate page
+
+ AppSettings& s = AfxGetAppSettings();
+ POSITION pos = s.wmcmds.GetHeadPosition();
+ while(pos)
+ {
+ wmcmd& wc = s.wmcmds.GetNext(pos);
+ CStringA str;
+ str.Format("%d", wc.cmd);
+ wmcoptions += "<option value=\"" + str + "\">"
+ + CStringA(wc.name) + "\r\n";
+ }
+
+ m_pWebServer->LoadPage(IDR_HTML_INDEX, body, m_path);
+ body.Replace("[wmcoptions]", wmcoptions);
+
+ return true;
+}
+
+bool CWebClientSocket::OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ CAtlList<CStringA> rootdrives;
+ for(TCHAR drive[] = _T("A:"); drive[0] <= 'Z'; drive[0]++)
+ if(GetDriveType(drive) != DRIVE_NO_ROOT_DIR)
+ rootdrives.AddTail(CStringA(drive) + '\\');
+
+ // process GET
+
+ CString path;
+ CFileStatus fs;
+ if(m_get.Lookup(_T("path"), path))
+ {
+ path = WToT(UTF8To16(TToA(path)));
+
+ if(CFileGetStatus(path, fs) && !(fs.m_attribute&CFile::directory))
+ {
+ // TODO: make a new message for just opening files, this is a bit overkill now...
+
+ CAtlList<CString> cmdln;
+
+ cmdln.AddTail(path);
+
+ CString focus;
+ if(m_get.Lookup(_T("focus"), focus) && !focus.CompareNoCase(_T("no")))
+ cmdln.AddTail(_T("/nofocus"));
+
+ int len = 0;
+
+ POSITION pos = cmdln.GetHeadPosition();
+ while(pos)
+ {
+ CString& str = cmdln.GetNext(pos);
+ len += (str.GetLength()+1)*sizeof(TCHAR);
+ }
+
+ CAutoVectorPtr<BYTE> buff;
+ if(buff.Allocate(4+len))
+ {
+ BYTE* p = buff;
+ *(DWORD*)p = cmdln.GetCount();
+ p += sizeof(DWORD);
+
+ POSITION pos = cmdln.GetHeadPosition();
+ while(pos)
+ {
+ CString& str = cmdln.GetNext(pos);
+ len = (str.GetLength()+1)*sizeof(TCHAR);
+ memcpy(p, (LPCTSTR)str, len);
+ p += len;
+ }
+
+ COPYDATASTRUCT cds;
+ cds.dwData = 0x6ABE51;
+ cds.cbData = p - buff;
+ cds.lpData = (void*)(BYTE*)buff;
+ m_pMainFrame->SendMessage(WM_COPYDATA, (WPARAM)NULL, (LPARAM)&cds);
+ }
+
+ CPath p(path);
+ p.RemoveFileSpec();
+ path = (LPCTSTR)p;
+ }
+ }
+ else
+ {
+ path = m_pMainFrame->m_wndPlaylistBar.GetCur();
+
+ if(CFileGetStatus(path, fs) && !(fs.m_attribute&CFile::directory))
+ {
+ CPath p(path);
+ p.RemoveFileSpec();
+ path = (LPCTSTR)p;
+ }
+ }
+
+ if(path.Find(_T("://")) >= 0)
+ path.Empty();
+
+ if(CFileGetStatus(path, fs) && (fs.m_attribute&CFile::directory)
+ || path.Find(_T("\\")) == 0) // FIXME
+ {
+ CPath p(path);
+ p.Canonicalize();
+ p.MakePretty();
+ p.AddBackslash();
+ path = (LPCTSTR)p;
+ }
+
+ CStringA files;
+
+ if(path.IsEmpty())
+ {
+ POSITION pos = rootdrives.GetHeadPosition();
+ while(pos)
+ {
+ CStringA& drive = rootdrives.GetNext(pos);
+
+ files += "<tr>\r\n";
+ files +=
+ "<td><a href=\"[path]?path=" + UrlEncode(drive) + "\">" + drive + "</a></td>"
+ "<td>Directory</td>"
+ "<td>&nbsp</td>\r\n"
+ "<td>&nbsp</td>";
+ files += "</tr>\r\n";
+ }
+
+ path = "Root";
+ }
+ else
+ {
+ CString parent;
+
+ if(path.GetLength() > 3)
+ {
+ CPath p(path + "..");
+ p.Canonicalize();
+ p.AddBackslash();
+ parent = (LPCTSTR)p;
+ }
+
+ files += "<tr>\r\n";
+ files +=
+ "<td><a href=\"[path]?path=" + parent + "\">..</a></td>"
+ "<td>Directory</td>"
+ "<td>&nbsp</td>\r\n"
+ "<td>&nbsp</td>";
+ files += "</tr>\r\n";
+
+ WIN32_FIND_DATA fd = {0};
+
+ HANDLE hFind = FindFirstFile(path + "*.*", &fd);
+ if(hFind != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if(!(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) || fd.cFileName[0] == '.')
+ continue;
+
+ CString fullpath = path + fd.cFileName;
+
+ files += "<tr>\r\n";
+ files +=
+ "<td><a href=\"[path]?path=" + UTF8Arg(fullpath) + "\">" + UTF8(fd.cFileName) + "</a></td>"
+ "<td>Directory</td>"
+ "<td>&nbsp</td>\r\n"
+ "<td><nobr>" + CStringA(CTime(fd.ftLastWriteTime).Format(_T("%Y.%m.%d %H:%M"))) + "</nobr></td>";
+ files += "</tr>\r\n";
+ }
+ while(FindNextFile(hFind, &fd));
+
+ FindClose(hFind);
+ }
+
+ hFind = FindFirstFile(path + "*.*", &fd);
+ if(hFind != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if(fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
+ continue;
+
+ CString fullpath = path + fd.cFileName;
+
+ CStringA size;
+ size.Format("%I64dK", ((UINT64)fd.nFileSizeHigh<<22)|(fd.nFileSizeLow>>10));
+
+ CString type(_T("&nbsp"));
+ LoadType(fullpath, type);
+
+ files += "<tr>\r\n";
+ files +=
+ "<td><a href=\"[path]?path=" + UTF8Arg(fullpath) + "\">" + UTF8(fd.cFileName) + "</a></td>"
+ "<td><nobr>" + UTF8(type) + "</nobr></td>"
+ "<td align=\"right\"><nobr>" + size + "</nobr></td>\r\n"
+ "<td><nobr>" + CStringA(CTime(fd.ftLastWriteTime).Format(_T("%Y.%m.%d %H:%M"))) + "</nobr></td>";
+ files += "</tr>\r\n";
+ }
+ while(FindNextFile(hFind, &fd));
+
+ FindClose(hFind);
+ }
+ }
+
+ m_pWebServer->LoadPage(IDR_HTML_BROWSER, body, m_path);
+ body.Replace("[charset]", "UTF-8"); // FIXME: win9x build...
+ body.Replace("[currentdir]", UTF8(path));
+ body.Replace("[currentfiles]", files);
+
+ return true;
+}
+
+bool CWebClientSocket::OnControls(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ CString path = m_pMainFrame->m_wndPlaylistBar.GetCur();
+ CString dir;
+
+ if(!path.IsEmpty())
+ {
+ CPath p(path);
+ p.RemoveFileSpec();
+ dir = (LPCTSTR)p;
+ }
+
+ OAFilterState fs = m_pMainFrame->GetMediaState();
+ CString state;
+ state.Format(_T("%d"), fs);
+ CString statestring;
+ switch(fs)
+ {
+ case State_Stopped: statestring = ResStr(IDS_CONTROLS_STOPPED); break;
+ case State_Paused: statestring = ResStr(IDS_CONTROLS_PAUSED); break;
+ case State_Running: statestring = ResStr(IDS_CONTROLS_PLAYING); break;
+ default: statestring = _T("n/a"); break;
+ }
+
+ int pos = (int)(m_pMainFrame->GetPos()/10000);
+ int dur = (int)(m_pMainFrame->GetDur()/10000);
+
+ CString position, duration;
+ position.Format(_T("%d"), pos);
+ duration.Format(_T("%d"), dur);
+
+ CString positionstring, durationstring, playbackrate;
+// positionstring.Format(_T("%02d:%02d:%02d.%03d"), (pos/3600000), (pos/60000)%60, (pos/1000)%60, pos%1000);
+// durationstring.Format(_T("%02d:%02d:%02d.%03d"), (dur/3600000), (dur/60000)%60, (dur/1000)%60, dur%1000);
+ positionstring.Format(_T("%02d:%02d:%02d"), (pos/3600000), (pos/60000)%60, (pos/1000)%60);
+ durationstring.Format(_T("%02d:%02d:%02d"), (dur/3600000), (dur/60000)%60, (dur/1000)%60);
+ playbackrate = _T("1"); // TODO
+
+ CString volumelevel, muted;
+ volumelevel.Format(_T("%d"), m_pMainFrame->m_wndToolBar.m_volctrl.GetPos());
+ muted.Format(_T("%d"), m_pMainFrame->m_wndToolBar.Volume == -10000 ? 1 : 0);
+
+ CString reloadtime(_T("0")); // TODO
+
+ m_pWebServer->LoadPage(IDR_HTML_CONTROLS, body, m_path);
+ body.Replace("[charset]", "UTF-8"); // FIXME: win9x build...
+ body.Replace("[filepatharg]", UTF8Arg(path));
+ body.Replace("[filepath]", UTF8(path));
+ body.Replace("[filedirarg]", UTF8Arg(dir));
+ body.Replace("[filedir]", UTF8(dir));
+ body.Replace("[state]", UTF8(state));
+ body.Replace("[statestring]", UTF8(statestring));
+ body.Replace("[position]", UTF8(position));
+ body.Replace("[positionstring]", UTF8(positionstring));
+ body.Replace("[duration]", UTF8(duration));
+ body.Replace("[durationstring]", UTF8(durationstring));
+ body.Replace("[volumelevel]", UTF8(volumelevel));
+ body.Replace("[muted]", UTF8(muted));
+ body.Replace("[playbackrate]", UTF8(playbackrate));
+ body.Replace("[reloadtime]", UTF8(reloadtime));
+
+ return true;
+}
+
+bool CWebClientSocket::OnStatus(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+/*
+ CString path = m_pMainFrame->m_wndPlaylistBar.GetCur(), dir;
+ if(!path.IsEmpty()) {CPath p(path); p.RemoveFileSpec(); dir = (LPCTSTR)p;}
+ path.Replace(_T("'"), _T("\\'"));
+ dir.Replace(_T("'"), _T("\\'"));
+
+ CString volumelevel, muted;
+ volumelevel.Format(_T("%d"), m_pMainFrame->m_wndToolBar.m_volctrl.GetPos());
+ muted.Format(_T("%d"), m_pMainFrame->m_wndToolBar.Volume == -10000 ? 1 : 0);
+ body.Replace("[volumelevel]", UTF8(volumelevel));
+ body.Replace("[muted]", UTF8(muted));
+*/
+ CString title;
+ m_pMainFrame->GetWindowText(title);
+
+ CString status = m_pMainFrame->GetStatusMessage();
+
+ int pos = (int)(m_pMainFrame->GetPos()/10000);
+ int dur = (int)(m_pMainFrame->GetDur()/10000);
+
+ CString posstr, durstr;
+ posstr.Format(_T("%02d:%02d:%02d"), (pos/3600000), (pos/60000)%60, (pos/1000)%60);
+ durstr.Format(_T("%02d:%02d:%02d"), (dur/3600000), (dur/60000)%60, (dur/1000)%60);
+
+ title.Replace(_T("'"), _T("\\'"));
+ status.Replace(_T("'"), _T("\\'"));
+
+ body.Format("OnStatus('%s', '%s', %d, '%s', %d, '%s', %d, %d)", // , '%s', '%s'
+ UTF8(title), UTF8(status),
+ pos, UTF8(posstr), dur, UTF8(durstr),
+ m_pMainFrame->IsMuted(), m_pMainFrame->GetVolume()
+ /*, UTF8(path), UTF8(dir)*/);
+
+ return true;
+}
+
+bool CWebClientSocket::OnError404(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ m_pWebServer->LoadPage(IDR_HTML_404, body, m_path);
+ return true;
+}
+
+bool CWebClientSocket::OnPlayer(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ m_pWebServer->LoadPage(IDR_HTML_PLAYER, body, m_path);
+ return true;
+}
+
+#include "jpeg.h"
+
+bool CWebClientSocket::OnSnapShotJpeg(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ // TODO: add quality control and return logo when nothing is loaded
+
+ bool fRet = false;
+
+ BYTE* pData = NULL;
+ long size = 0;
+ CAtlArray<BYTE> jpeg;
+ if(m_pMainFrame->GetDIB(&pData, size, true))
+ {
+ if(CJpegEncoderMem().Encode(pData, jpeg))
+ {
+ hdr +=
+ "Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n"
+ "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\n"
+ "Pragma: no-cache\r\n";
+ body = CStringA((char*)jpeg.GetData(), jpeg.GetCount());
+ mime = "image/jpeg";
+ fRet = true;
+ }
+
+ delete [] pData;
+ }
+
+ return fRet;
+}
+
+#include "ConvertDlg.h"
+
+bool CWebClientSocket::OnConvRes(CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ CString id;
+ if(!m_get.Lookup(_T("id"), id))
+ return false;
+
+ DWORD key = 0;
+ if(1 != _stscanf(id, _T("%x"), &key) || key == 0)
+ return false;
+
+ CAutoLock cAutoLock(&CDSMResource::m_csResources);
+
+ CDSMResource* res = NULL;
+ if(!CDSMResource::m_resources.Lookup(key, res) || !res)
+ return false;
+
+ body = CStringA((const char*)res->data.GetData(), res->data.GetCount());
+ mime = CString(res->mime);
+
+ return true;
+}
diff --git a/src/apps/mplayerc/WebClientSocket.h b/src/apps/mplayerc/WebClientSocket.h
new file mode 100644
index 000000000..d08dafe97
--- /dev/null
+++ b/src/apps/mplayerc/WebClientSocket.h
@@ -0,0 +1,44 @@
+#pragma once
+
+class CWebServer;
+
+class CWebClientSocket : public CAsyncSocket
+{
+ CWebServer* m_pWebServer;
+ CMainFrame* m_pMainFrame;
+
+ CString m_hdr;
+
+ struct cookie_attribs {CString path, expire, domain;};
+ CAtlStringMap<cookie_attribs> m_cookieattribs;
+
+ void Clear();
+ void Header();
+
+protected:
+ void OnReceive(int nErrorCode);
+ void OnClose(int nErrorCode);
+
+public:
+ CWebClientSocket(CWebServer* pWebServer, CMainFrame* pMainFrame);
+ virtual ~CWebClientSocket();
+
+ bool SetCookie(CString name, CString value = _T(""), __time64_t expire = -1, CString path = _T("/"), CString domain = _T(""));
+
+ CString m_sessid;
+ CString m_cmd, m_path, m_query, m_ver;
+ CStringA m_data;
+ CAtlStringMap<> m_hdrlines;
+ CAtlStringMap<> m_get, m_post, m_cookie;
+ CAtlStringMap<> m_request;
+
+ bool OnCommand(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnIndex(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnControls(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnStatus(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnError404(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnPlayer(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnSnapShotJpeg(CStringA& hdr, CStringA& body, CStringA& mime);
+ bool OnConvRes(CStringA& hdr, CStringA& body, CStringA& mime);
+}; \ No newline at end of file
diff --git a/src/apps/mplayerc/WebServer.cpp b/src/apps/mplayerc/WebServer.cpp
new file mode 100644
index 000000000..a58b29f7d
--- /dev/null
+++ b/src/apps/mplayerc/WebServer.cpp
@@ -0,0 +1,614 @@
+#include "stdafx.h"
+#include "mplayerc.h"
+#include "resource.h"
+#include "MainFrm.h"
+#include <atlbase.h>
+#include <atlisapi.h>
+#include "WebServerSocket.h"
+#include "WebClientSocket.h"
+#include "WebServer.h"
+#include "..\..\zlib\zlib.h"
+
+CAtlStringMap<CWebServer::RequestHandler> CWebServer::m_internalpages;
+CAtlStringMap<UINT> CWebServer::m_downloads;
+CAtlStringMap<CStringA, CStringA> CWebServer::m_mimes;
+
+CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort)
+ : m_pMainFrame(pMainFrame)
+ , m_nPort(nPort)
+{
+ if(m_internalpages.IsEmpty())
+ {
+ m_internalpages[_T("/")] = &CWebClientSocket::OnIndex;
+ m_internalpages[_T("/index.html")] = &CWebClientSocket::OnIndex;
+ m_internalpages[_T("/browser.html")] = &CWebClientSocket::OnBrowser;
+ m_internalpages[_T("/controls.html")] = &CWebClientSocket::OnControls;
+ m_internalpages[_T("/command.html")] = &CWebClientSocket::OnCommand;
+ m_internalpages[_T("/status.html")] = &CWebClientSocket::OnStatus;
+ m_internalpages[_T("/player.html")] = &CWebClientSocket::OnPlayer;
+ m_internalpages[_T("/snapshot.jpg")] = &CWebClientSocket::OnSnapShotJpeg;
+ m_internalpages[_T("/404.html")] = &CWebClientSocket::OnError404;
+ m_internalpages[_T("/convres.html")] = &CWebClientSocket::OnConvRes;
+ }
+
+ if(m_downloads.IsEmpty())
+ {
+ m_downloads[_T("/default.css")] = IDF_DEFAULT_CSS;
+ m_downloads[_T("/vbg.gif")] = IDF_VBR_GIF;
+ m_downloads[_T("/vbs.gif")] = IDF_VBS_GIF;
+ m_downloads[_T("/sliderbar.gif")] = IDF_SLIDERBAR_GIF;
+ m_downloads[_T("/slidergrip.gif")] = IDF_SLIDERGRIP_GIF;
+ m_downloads[_T("/sliderback.gif")] = IDF_SLIDERBACK_GIF;
+ m_downloads[_T("/1pix.gif")] = IDF_1PIX_GIF;
+ m_downloads[_T("/headericon.png")] = IDF_HEADERICON_PNG;
+ m_downloads[_T("/headerback.png")] = IDF_HEADERBACK_PNG;
+ m_downloads[_T("/headerclose.png")] = IDF_HEADERCLOSE_PNG;
+ m_downloads[_T("/leftside.png")] = IDF_LEFTSIDE_PNG;
+ m_downloads[_T("/rightside.png")] = IDF_RIGHTSIDE_PNG;
+ m_downloads[_T("/bottomside.png")] = IDF_BOTTOMSIDE_PNG;
+ m_downloads[_T("/leftbottomside.png")] = IDF_LEFTBOTTOMSIDE_PNG;
+ m_downloads[_T("/rightbottomside.png")] = IDF_RIGHTBOTTOMSIDE_PNG;
+ m_downloads[_T("/seekbarleft.png")] = IDF_SEEKBARLEFT_PNG;
+ m_downloads[_T("/seekbarmid.png")] = IDF_SEEKBARMID_PNG;
+ m_downloads[_T("/seekbarright.png")] = IDF_SEEKBARRIGHT_PNG;
+ m_downloads[_T("/seekbargrip.png")] = IDF_SEEKBARGRIP_PNG;
+ m_downloads[_T("/logo.png")] = IDF_LOGO_PNG;
+ m_downloads[_T("/controlback.png")] = IDF_CONTROLBACK_PNG;
+ m_downloads[_T("/controlbuttonplay.png")] = IDF_CONTROLBUTTONPLAY_PNG;
+ m_downloads[_T("/controlbuttonpause.png")] = IDF_CONTROLBUTTONPAUSE_PNG;
+ m_downloads[_T("/controlbuttonstop.png")] = IDF_CONTROLBUTTONSTOP_PNG;
+ m_downloads[_T("/controlbuttonskipback.png")] = IDF_CONTROLBUTTONSKIPBACK_PNG;
+ m_downloads[_T("/controlbuttondecrate.png")] = IDF_CONTROLBUTTONDECRATE_PNG;
+ m_downloads[_T("/controlbuttonincrate.png")] = IDF_CONTROLBUTTONINCRATE_PNG;
+ m_downloads[_T("/controlbuttonskipforward.png")] = IDF_CONTROLBUTTONSKIPFORWARD_PNG;
+ m_downloads[_T("/controlbuttonstep.png")] = IDF_CONTROLBUTTONSTEP_PNG;
+ m_downloads[_T("/controlvolumeon.png")] = IDF_CONTROLVOLUMEON_PNG;
+ m_downloads[_T("/controlvolumeoff.png")] = IDF_CONTROLVOLUMEOFF_PNG;
+ m_downloads[_T("/controlvolumebar.png")] = IDF_CONTROLVOLUMEBAR_PNG;
+ m_downloads[_T("/controlvolumegrip.png")] = IDF_CONTROLVOLUMEGRIP_PNG;
+ }
+
+ CRegKey key;
+ CString str(_T("MIME\\Database\\Content Type"));
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, str, KEY_READ))
+ {
+ TCHAR buff[256];
+ DWORD len = countof(buff);
+ for(int i = 0; ERROR_SUCCESS == key.EnumKey(i, buff, &len); i++, len = countof(buff))
+ {
+ CRegKey mime;
+ TCHAR ext[64];
+ ULONG len = countof(ext);
+ if(ERROR_SUCCESS == mime.Open(HKEY_CLASSES_ROOT, str + _T("\\") + buff, KEY_READ)
+ && ERROR_SUCCESS == mime.QueryStringValue(_T("Extension"), ext, &len))
+ m_mimes[CStringA(ext).MakeLower()] = CStringA(buff).MakeLower();
+ }
+ }
+
+ m_mimes[".html"] = "text/html";
+ m_mimes[".txt"] = "text/plain";
+ m_mimes[".css"] = "text/css";
+ m_mimes[".gif"] = "image/gif";
+ m_mimes[".jpeg"] = "image/jpeg";
+ m_mimes[".jpg"] = "image/jpeg";
+ m_mimes[".png"] = "image/png";
+
+ GetModuleFileName(AfxGetInstanceHandle(), str.GetBuffer(MAX_PATH), MAX_PATH);
+ str.ReleaseBuffer();
+ m_webroot = CPath(str);
+ m_webroot.RemoveFileSpec();
+
+ CString WebRoot = AfxGetAppSettings().WebRoot;
+ WebRoot.Replace('/', '\\');
+ WebRoot.Trim();
+ CPath p(WebRoot);
+ if(WebRoot.Find(_T(":\\")) < 0 && WebRoot.Find(_T("\\\\")) < 0) m_webroot.Append(WebRoot);
+ else m_webroot = p;
+ m_webroot.Canonicalize();
+ m_webroot.MakePretty();
+ if(!m_webroot.IsDirectory()) m_webroot = CPath();
+
+ CAtlList<CString> sl;
+ Explode(AfxGetAppSettings().WebServerCGI, sl, ';');
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ CAtlList<CString> sl2;
+ CString ext = Explode(sl.GetNext(pos), sl2, '=', 2);
+ if(sl2.GetCount() < 2) continue;
+ m_cgi[ext] = sl2.GetTail();
+ }
+
+ m_ThreadId = 0;
+ m_hThread = ::CreateThread(NULL, 0, StaticThreadProc, (LPVOID)this, 0, &m_ThreadId);
+}
+
+CWebServer::~CWebServer()
+{
+ if(m_hThread != NULL)
+ {
+ PostThreadMessage(m_ThreadId, WM_QUIT, 0, 0);
+ WaitForSingleObject(m_hThread, 10000);
+ EXECUTE_ASSERT(CloseHandle(m_hThread));
+ }
+}
+
+DWORD WINAPI CWebServer::StaticThreadProc(LPVOID lpParam)
+{
+ return ((CWebServer*)lpParam)->ThreadProc();
+}
+
+DWORD CWebServer::ThreadProc()
+{
+ if(!AfxSocketInit(NULL))
+ return -1;
+
+ CWebServerSocket s(this, m_nPort);
+
+ MSG msg;
+ while((int)GetMessage(&msg, NULL, 0, 0) > 0)
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ return 0;
+}
+
+static void PutFileContents(LPCTSTR fn, const CStringA& data)
+{
+ if(FILE* f = _tfopen(fn, _T("wb")))
+ {
+ fwrite((LPCSTR)data, 1, data.GetLength(), f);
+ fclose(f);
+ }
+}
+
+void CWebServer::Deploy(CString dir)
+{
+ CStringA data;
+ if(LoadResource(IDR_HTML_INDEX, data, RT_HTML)) PutFileContents(dir + _T("index.html"), data);
+ if(LoadResource(IDR_HTML_BROWSER, data, RT_HTML)) PutFileContents(dir + _T("browser.html"), data);
+ if(LoadResource(IDR_HTML_CONTROLS, data, RT_HTML)) PutFileContents(dir + _T("controls.html"), data);
+ if(LoadResource(IDR_HTML_404, data, RT_HTML)) PutFileContents(dir + _T("404.html"), data);
+ if(LoadResource(IDR_HTML_PLAYER, data, RT_HTML)) PutFileContents(dir + _T("player.html"), data);
+
+ POSITION pos = m_downloads.GetStartPosition();
+ while(pos)
+ {
+ CString fn;
+ UINT id;
+ m_downloads.GetNextAssoc(pos, fn, id);
+ if(LoadResource(id, data, _T("FILE")))
+ PutFileContents(dir + fn, data);
+ }
+}
+
+bool CWebServer::ToLocalPath(CString& path, CString& redir)
+{
+ if(!path.IsEmpty() && m_webroot.IsDirectory())
+ {
+ CString str = path;
+ str.Replace('/', '\\');
+ str.TrimLeft('\\');
+
+ CPath p;
+ p.Combine(m_webroot, str);
+ p.Canonicalize();
+
+ if(p.IsDirectory())
+ {
+ CAtlList<CString> sl;
+ Explode(AfxGetAppSettings().WebDefIndex, sl, ';');
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ str = sl.GetNext(pos);
+ CPath p2 = p;
+ p2.Append(str);
+ if(p2.FileExists())
+ {
+ p = p2;
+ redir = path;
+ if(redir.GetAt(redir.GetLength()-1) != '/') redir += '/';
+ redir += str;
+ break;
+ }
+ }
+ }
+
+ if(_tcslen(p) > _tcslen(m_webroot) && p.FileExists())
+ {
+ path = (LPCTSTR)p;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool CWebServer::LoadPage(UINT resid, CStringA& str, CString path)
+{
+ CString redir;
+ if(ToLocalPath(path, redir))
+ {
+ if(FILE* f = _tfopen(path, _T("rb")))
+ {
+ fseek(f, 0, 2);
+ char* buff = str.GetBufferSetLength(ftell(f));
+ fseek(f, 0, 0);
+ int len = fread(buff, 1, str.GetLength(), f);
+ fclose(f);
+ return len == str.GetLength();
+ }
+ }
+
+ return LoadResource(resid, str, RT_HTML);
+}
+
+void CWebServer::OnAccept(CWebServerSocket* pServer)
+{
+ CAutoPtr<CWebClientSocket> p(new CWebClientSocket(this, m_pMainFrame));
+ if(pServer->Accept(*p))
+ {
+ CString name;
+ UINT port;
+ if(AfxGetAppSettings().fWebServerLocalhostOnly && p->GetPeerName(name, port) && name != _T("127.0.0.1"))
+ {
+ p->Close();
+ return;
+ }
+
+ m_clients.AddTail(p);
+ }
+}
+
+void CWebServer::OnClose(CWebClientSocket* pClient)
+{
+ POSITION pos = m_clients.GetHeadPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ if(m_clients.GetNext(pos) == pClient)
+ {
+ m_clients.RemoveAt(cur);
+ break;
+ }
+ }
+}
+
+void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& body)
+{
+ CPath p(pClient->m_path);
+ CStringA ext = p.GetExtension().MakeLower();
+ CStringA mime;
+ if(ext.IsEmpty()) mime = "text/html";
+ else m_mimes.Lookup(ext, mime);
+
+ hdr = "HTTP/1.0 200 OK\r\n";
+
+ bool fHandled = false, fCGI = false;
+
+ if(!fHandled && m_webroot.IsDirectory())
+ {
+ CStringA tmphdr;
+ fHandled = fCGI = CallCGI(pClient, tmphdr, body, mime);
+
+ if(fHandled)
+ {
+ tmphdr.Replace("\r\n", "\n");
+ CAtlList<CStringA> hdrlines;
+ ExplodeMin(tmphdr, hdrlines, '\n');
+ POSITION pos = hdrlines.GetHeadPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ CAtlList<CStringA> sl;
+ CStringA key = Explode(hdrlines.GetNext(pos), sl, ':', 2);
+ if(sl.GetCount() < 2) continue;
+ key.Trim().MakeLower();
+ if(key == "content-type") {mime = sl.GetTail().Trim(); hdrlines.RemoveAt(cur);}
+ else if(key == "content-length") {hdrlines.RemoveAt(cur);}
+ }
+ tmphdr = Implode(hdrlines, '\n');
+ tmphdr.Replace("\n", "\r\n");
+ hdr += tmphdr + "\r\n";
+ }
+ }
+
+ RequestHandler rh = NULL;
+ if(!fHandled && m_internalpages.Lookup(pClient->m_path, rh) && (pClient->*rh)(hdr, body, mime))
+ {
+ if(mime.IsEmpty()) mime = "text/html";
+
+ CString redir;
+ if(pClient->m_get.Lookup(_T("redir"), redir)
+ || pClient->m_post.Lookup(_T("redir"), redir))
+ {
+ if(redir.IsEmpty()) redir = '/';
+
+ hdr =
+ "HTTP/1.0 302 Found\r\n"
+ "Location: " + CStringA(redir) + "\r\n";
+ return;
+ }
+
+ fHandled = true;
+ }
+
+ if(!fHandled && m_webroot.IsDirectory())
+ {
+ fHandled = LoadPage(0, body, pClient->m_path);
+ }
+
+ UINT resid;
+ CStringA res;
+ if(!fHandled && m_downloads.Lookup(pClient->m_path, resid) && LoadResource(resid, res, _T("FILE")))
+ {
+ if(mime.IsEmpty()) mime = "application/octet-stream";
+ memcpy(body.GetBufferSetLength(res.GetLength()), res.GetBuffer(), res.GetLength());
+ fHandled = true;
+ }
+
+ if(!fHandled)
+ {
+ hdr = mime == "text/html"
+ ? "HTTP/1.0 301 Moved Permanently\r\n" "Location: /404.html\r\n"
+ : "HTTP/1.0 404 Not Found\r\n";
+ return;
+ }
+
+ if(mime == "text/html" && !fCGI)
+ {
+ hdr +=
+ "Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n"
+ "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\n"
+ "Pragma: no-cache\r\n";
+
+ CStringA debug;
+ if(AfxGetAppSettings().fWebServerPrintDebugInfo)
+ {
+ debug += "<hr>\r\n";
+ CString key, value;
+ POSITION pos;
+ pos = pClient->m_hdrlines.GetStartPosition();
+ while(pos) {pClient->m_hdrlines.GetNextAssoc(pos, key, value); debug += "HEADER[" + key + "] = " + value + "<br>\r\n";}
+ debug += "cmd: " + pClient->m_cmd + "<br>\r\n";
+ debug += "path: " + pClient->m_path + "<br>\r\n";
+ debug += "ver: " + pClient->m_ver + "<br>\r\n";
+ pos = pClient->m_get.GetStartPosition();
+ while(pos) {pClient->m_get.GetNextAssoc(pos, key, value); debug += "GET[" + key + "] = " + value + "<br>\r\n";}
+ pos = pClient->m_post.GetStartPosition();
+ while(pos) {pClient->m_post.GetNextAssoc(pos, key, value); debug += "POST[" + key + "] = " + value + "<br>\r\n";}
+ pos = pClient->m_cookie.GetStartPosition();
+ while(pos) {pClient->m_cookie.GetNextAssoc(pos, key, value); debug += "COOKIE[" + key + "] = " + value + "<br>\r\n";}
+ pos = pClient->m_request.GetStartPosition();
+ while(pos) {pClient->m_request.GetNextAssoc(pos, key, value); debug += "REQUEST[" + key + "] = " + value + "<br>\r\n";}
+ }
+
+ body.Replace("[path]", CStringA(pClient->m_path));
+ body.Replace("[indexpath]", "/index.html");
+ body.Replace("[commandpath]", "/command.html");
+ body.Replace("[browserpath]", "/browser.html");
+ body.Replace("[controlspath]", "/controls.html");
+ body.Replace("[wmcname]", "wm_command");
+ body.Replace("[setposcommand]", CMD_SETPOS);
+ body.Replace("[setvolumecommand]", CMD_SETVOLUME);
+ body.Replace("[debug]", debug);
+ // TODO: add more general tags to replace
+ }
+
+ // gzip
+ if(AfxGetAppSettings().fWebServerUseCompression && hdr.Find("Content-Encoding:") < 0)
+ do
+ {
+ CString accept_encoding;
+ pClient->m_hdrlines.Lookup(_T("accept-encoding"), accept_encoding);
+ accept_encoding.MakeLower();
+ CAtlList<CString> sl;
+ ExplodeMin(accept_encoding, sl, ',');
+ if(!sl.Find(_T("gzip"))) break;;
+
+ CHAR path[MAX_PATH], fn[MAX_PATH];
+ if(!GetTempPathA(MAX_PATH, path) || !GetTempFileNameA(path, "mpc_gz", 0, fn))
+ break;
+
+ gzFile gf = gzopen(fn, "wb9");
+ if(!gf || gzwrite(gf, (LPVOID)(LPCSTR)body, body.GetLength()) != body.GetLength())
+ {
+ if(gf) gzclose(gf);
+ DeleteFileA(fn);
+ break;
+ }
+ gzclose(gf);
+
+ FILE* f = fopen(fn, "rb");
+ if(!f) {DeleteFileA(fn); break;}
+ fseek(f, 0, 2);
+ CHAR* s = body.GetBufferSetLength(ftell(f));
+ fseek(f, 0, 0);
+ int len = fread(s, 1, body.GetLength(), f);
+ ASSERT(len == body.GetLength());
+ fclose(f);
+ DeleteFileA(fn);
+
+ hdr += "Content-Encoding: gzip\r\n";
+ }
+ while(0);
+
+ CStringA content;
+ content.Format(
+ "Content-Type: %s\r\n"
+ "Content-Length: %d\r\n",
+ mime, body.GetLength());
+ hdr += content;
+}
+
+static DWORD WINAPI KillCGI(LPVOID lParam)
+{
+ HANDLE hProcess = (HANDLE)lParam;
+ if(WaitForSingleObject(hProcess, 30000) == WAIT_TIMEOUT)
+ TerminateProcess(hProcess, 0);
+ return 0;
+}
+
+bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& body, CStringA& mime)
+{
+ CString path = pClient->m_path, redir = path;
+ if(!ToLocalPath(path, redir)) return false;
+ CString ext = CPath(path).GetExtension().MakeLower();
+ CPath dir(path);
+ dir.RemoveFileSpec();
+
+ CString cgi;
+ if(!m_cgi.Lookup(ext, cgi) || !CPath(cgi).FileExists())
+ return false;
+
+ HANDLE hProcess = GetCurrentProcess();
+ HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup = NULL;
+ HANDLE hChildStdoutRd, hChildStdoutWr, hChildStdoutRdDup = NULL;
+
+ SECURITY_ATTRIBUTES saAttr;
+ ZeroMemory(&saAttr, sizeof(saAttr));
+ saAttr.nLength = sizeof(saAttr);
+ saAttr.bInheritHandle = TRUE;
+
+ if(CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0))
+ {
+ BOOL fSuccess = DuplicateHandle(hProcess, hChildStdoutRd, hProcess, &hChildStdoutRdDup, 0, FALSE, DUPLICATE_SAME_ACCESS);
+ CloseHandle(hChildStdoutRd);
+ }
+
+ if(CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0))
+ {
+ BOOL fSuccess = DuplicateHandle(hProcess, hChildStdinWr, hProcess, &hChildStdinWrDup, 0, FALSE, DUPLICATE_SAME_ACCESS);
+ CloseHandle(hChildStdinWr);
+ }
+
+ STARTUPINFO siStartInfo;
+ ZeroMemory(&siStartInfo, sizeof(siStartInfo));
+ siStartInfo.cb = sizeof(siStartInfo);
+ siStartInfo.hStdError = hChildStdoutWr;
+ siStartInfo.hStdOutput = hChildStdoutWr;
+ siStartInfo.hStdInput = hChildStdinRd;
+ siStartInfo.dwFlags |= STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
+ siStartInfo.wShowWindow = SW_HIDE;
+
+ PROCESS_INFORMATION piProcInfo;
+ ZeroMemory(&piProcInfo, sizeof(piProcInfo));
+
+ CStringA envstr;
+
+ if(LPVOID lpvEnv = GetEnvironmentStrings())
+ {
+ CString str;
+
+ CAtlList<CString> env;
+ for(LPTSTR lpszVariable = (LPTSTR)lpvEnv; *lpszVariable; lpszVariable += _tcslen(lpszVariable)+1)
+ if(lpszVariable != (LPTSTR)lpvEnv)
+ env.AddTail(lpszVariable);
+
+ env.AddTail(_T("GATEWAY_INTERFACE=CGI/1.1"));
+ env.AddTail(_T("SERVER_SOFTWARE=Media Player Classic/6.4.x.y"));
+ env.AddTail(_T("SERVER_PROTOCOL=") + pClient->m_ver);
+ env.AddTail(_T("REQUEST_METHOD=") + pClient->m_cmd);
+ env.AddTail(_T("PATH_INFO=") + redir);
+ env.AddTail(_T("PATH_TRANSLATED=") + path);
+ env.AddTail(_T("SCRIPT_NAME=") + redir);
+ env.AddTail(_T("QUERY_STRING=") + pClient->m_query);
+
+ if(pClient->m_hdrlines.Lookup(_T("content-type"), str))
+ env.AddTail(_T("CONTENT_TYPE=") + str);
+ if(pClient->m_hdrlines.Lookup(_T("content-length"), str))
+ env.AddTail(_T("CONTENT_LENGTH=") + str);
+
+ POSITION pos = pClient->m_hdrlines.GetStartPosition();
+ while(pos)
+ {
+ CString key = pClient->m_hdrlines.GetKeyAt(pos);
+ CString value = pClient->m_hdrlines.GetNextValue(pos);
+ key.Replace(_T("-"), _T("_"));
+ key.MakeUpper();
+ env.AddTail(_T("HTTP_") + key + _T("=") + value);
+ }
+
+ CString name;
+ UINT port;
+
+ if(pClient->GetPeerName(name, port))
+ {
+ str.Format(_T("%d"), port);
+ env.AddTail(_T("REMOTE_ADDR=")+name);
+ env.AddTail(_T("REMOTE_HOST=")+name);
+ env.AddTail(_T("REMOTE_PORT=")+str);
+ }
+
+ if(pClient->GetSockName(name, port))
+ {
+ str.Format(_T("%d"), port);
+ env.AddTail(_T("SERVER_NAME=")+name);
+ env.AddTail(_T("SERVER_PORT=")+str);
+ }
+
+ env.AddTail(_T("\0"));
+
+ str = Implode(env, '\0');
+ envstr = CStringA(str, str.GetLength());
+
+ FreeEnvironmentStrings((LPTSTR)lpvEnv);
+ }
+
+ TCHAR* cmdln = new TCHAR[32768];
+ _sntprintf(cmdln, 32768, _T("\"%s\" \"%s\""), cgi, path);
+
+ if(hChildStdinRd && hChildStdoutWr)
+ if(CreateProcess(
+ NULL, cmdln, NULL, NULL, TRUE, 0,
+ envstr.GetLength() ? (LPVOID)(LPCSTR)envstr : NULL,
+ dir, &siStartInfo, &piProcInfo))
+ {
+ DWORD ThreadId;
+ CreateThread(NULL, 0, KillCGI, (LPVOID)piProcInfo.hProcess, 0, &ThreadId);
+
+ static const int BUFFSIZE = 1024;
+ DWORD dwRead, dwWritten = 0;
+
+ int i = 0, len = pClient->m_data.GetLength();
+ for(; i < len; i += dwWritten)
+ if(!WriteFile(hChildStdinWrDup, (LPCSTR)pClient->m_data + i, min(len - i, BUFFSIZE), &dwWritten, NULL))
+ break;
+
+ CloseHandle(hChildStdinWrDup);
+ CloseHandle(hChildStdoutWr);
+
+ body.Empty();
+
+ CStringA buff;
+ while(i == len && ReadFile(hChildStdoutRdDup, buff.GetBuffer(BUFFSIZE), BUFFSIZE, &dwRead, NULL) && dwRead)
+ {
+ buff.ReleaseBufferSetLength(dwRead);
+ body += buff;
+ }
+
+ int hdrend = body.Find("\r\n\r\n");
+ if(hdrend >= 0)
+ {
+ hdr = body.Left(hdrend+2);
+ body = body.Mid(hdrend+4);
+ }
+
+ CloseHandle(hChildStdinRd);
+ CloseHandle(hChildStdoutRdDup);
+
+ CloseHandle(piProcInfo.hProcess);
+ CloseHandle(piProcInfo.hThread);
+ }
+ else
+ {
+ body = _T("CGI Error");
+ }
+
+ delete [] cmdln;
+
+ return true;
+}
diff --git a/src/apps/mplayerc/WebServer.h b/src/apps/mplayerc/WebServer.h
new file mode 100644
index 000000000..9518f498c
--- /dev/null
+++ b/src/apps/mplayerc/WebServer.h
@@ -0,0 +1,50 @@
+#pragma once
+
+#include <afxsock.h>
+#include <atlcoll.h>
+
+#define UTF8(str) UTF16To8(TToW(str))
+#define UTF8Arg(str) UrlEncode(UTF8(str))
+
+#define CMD_SETPOS "-1"
+#define CMD_SETVOLUME "-2"
+
+
+class CWebServerSocket;
+class CWebClientSocket;
+class CMainFrame;
+
+class CWebServer
+{
+ CMainFrame* m_pMainFrame;
+ int m_nPort;
+
+ DWORD ThreadProc();
+ static DWORD WINAPI StaticThreadProc(LPVOID lpParam);
+ DWORD m_ThreadId;
+ HANDLE m_hThread;
+
+ CAutoPtrList<CWebClientSocket> m_clients;
+
+ typedef bool (CWebClientSocket::*RequestHandler)(CStringA& hdr, CStringA& body, CStringA& mime);
+ static CAtlStringMap<RequestHandler> m_internalpages;
+ static CAtlStringMap<UINT> m_downloads;
+ static CAtlStringMap<CStringA, CStringA> m_mimes;
+ CPath m_webroot;
+
+ CAtlStringMap<> m_cgi;
+ bool CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& body, CStringA& mime);
+
+public:
+ CWebServer(CMainFrame* pMainFrame, int nPort = 13579);
+ virtual ~CWebServer();
+
+ static void Deploy(CString dir);
+
+ bool ToLocalPath(CString& path, CString& redir);
+ bool LoadPage(UINT resid, CStringA& str, CString path = _T(""));
+
+ void OnAccept(CWebServerSocket* pServer);
+ void OnClose(CWebClientSocket* pClient);
+ void OnRequest(CWebClientSocket* pClient, CStringA& reshdr, CStringA& resbody);
+};
diff --git a/src/apps/mplayerc/WebServerSocket.cpp b/src/apps/mplayerc/WebServerSocket.cpp
new file mode 100644
index 000000000..ab2ab5710
--- /dev/null
+++ b/src/apps/mplayerc/WebServerSocket.cpp
@@ -0,0 +1,22 @@
+#include "stdafx.h"
+#include ".\webserver.h"
+#include ".\webserversocket.h"
+
+CWebServerSocket::CWebServerSocket(CWebServer* pWebServer, int port)
+ : m_pWebServer(pWebServer)
+{
+ Create(port);
+ Listen();
+}
+
+CWebServerSocket::~CWebServerSocket()
+{
+}
+
+void CWebServerSocket::OnAccept(int nErrorCode)
+{
+ if(nErrorCode == 0 && m_pWebServer)
+ m_pWebServer->OnAccept(this);
+
+ __super::OnAccept(nErrorCode);
+}
diff --git a/src/apps/mplayerc/WebServerSocket.h b/src/apps/mplayerc/WebServerSocket.h
new file mode 100644
index 000000000..e7737960d
--- /dev/null
+++ b/src/apps/mplayerc/WebServerSocket.h
@@ -0,0 +1,15 @@
+#pragma once
+
+class CWebServer;
+
+class CWebServerSocket : public CAsyncSocket
+{
+ CWebServer* m_pWebServer;
+
+protected:
+ void OnAccept(int nErrorCode);
+
+public:
+ CWebServerSocket(CWebServer* pWebServer, int port = 13579);
+ virtual ~CWebServerSocket();
+}; \ No newline at end of file
diff --git a/src/apps/mplayerc/jpeg.cpp b/src/apps/mplayerc/jpeg.cpp
new file mode 100644
index 000000000..0ea2172e5
--- /dev/null
+++ b/src/apps/mplayerc/jpeg.cpp
@@ -0,0 +1,404 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * - a simple baseline encoder
+ * - created exactly after the specs
+ * - no optimization or anything like that :)
+ *
+ */
+
+
+#include "stdafx.h"
+#include <math.h>
+#include "jpeg.h"
+#include "jpeg_tables.h"
+
+bool CJpegEncoder::PutBit(int b, int n)
+{
+ if(n > 24 || n <= 0) return(false);
+
+ m_bbuff <<= n;
+ m_bbuff |= b & ((1 << n) - 1);
+ m_bwidth += n;
+
+ while(m_bwidth >= 8)
+ {
+ BYTE c = (BYTE)(m_bbuff >> (m_bwidth - 8));
+ PutByte(c);
+ if(c == 0xff) PutByte(0);
+ m_bwidth -= 8;
+ }
+
+ return(true);
+}
+
+void CJpegEncoder::Flush()
+{
+ if(m_bwidth > 0)
+ {
+ BYTE c = m_bbuff << (8 - m_bwidth);
+ PutByte(c);
+ if(c == 0xff) PutByte(0);
+ }
+
+ m_bbuff = m_bwidth = 0;
+}
+
+///////
+
+int CJpegEncoder::GetBitWidth(short q)
+{
+ if(q == 0) return(0);
+ if(q < 0) q = -q;
+
+ int width = 15;
+ for(; !(q&0x4000); q <<= 1, width--);
+ return(width);
+}
+
+///////
+
+void CJpegEncoder::WriteSOI()
+{
+ PutByte(0xff);
+ PutByte(0xd8);
+}
+
+void CJpegEncoder::WriteDQT()
+{
+ PutByte(0xff);
+ PutByte(0xdb);
+
+ WORD size = 2 + 2*(65 + 64*0);
+ PutByte(size>>8);
+ PutByte(size&0xff);
+
+ for(int c = 0; c < 2; c++)
+ {
+ PutByte(c);
+ PutBytes(quanttbl[c], 64);
+ }
+}
+
+void CJpegEncoder::WriteSOF0()
+{
+ PutByte(0xff);
+ PutByte(0xc0);
+
+ WORD size = 8 + 3*ColorComponents;
+ PutByte(size>>8);
+ PutByte(size&0xff);
+
+ PutByte(8); // precision
+
+ PutByte(m_h>>8);
+ PutByte(m_h&0xff);
+ PutByte(m_w>>8);
+ PutByte(m_w&0xff);
+
+ PutByte(ColorComponents); // color components
+
+ PutByte(1); // component id
+ PutByte(0x11); // hor | ver sampling factor
+ PutByte(0); // quant. tbl. id
+
+ PutByte(2); // component id
+ PutByte(0x11); // hor | ver sampling factor
+ PutByte(1); // quant. tbl. id
+
+ PutByte(3); // component id
+ PutByte(0x11); // hor | ver sampling factor
+ PutByte(1); // quant. tbl. id
+}
+
+void CJpegEncoder::WriteDHT()
+{
+ PutByte(0xff);
+ PutByte(0xc4);
+
+ WORD size = 0x01A2; // 2 + n*(17+mi);
+ PutByte(size>>8);
+ PutByte(size&0xff);
+
+ PutByte(0x00); // tbl class (DC) | tbl id
+ PutBytes(DCVLC_NumByLength[0], 16);
+ for(int i = 0; i < 12; i++) PutByte(i);
+
+ PutByte(0x01); // tbl class (DC) | tbl id
+ PutBytes(DCVLC_NumByLength[1], 16);
+ for(int i = 0; i < 12; i++) PutByte(i);
+
+ PutByte(0x10); // tbl class (AC) | tbl id
+ PutBytes(ACVLC_NumByLength[0], 16);
+ PutBytes(ACVLC_Data[0], sizeof(ACVLC_Data[0]));
+
+ PutByte(0x11); // tbl class (AC) | tbl id
+ PutBytes(ACVLC_NumByLength[1], 16);
+ PutBytes(ACVLC_Data[1], sizeof(ACVLC_Data[1]));
+}
+
+// float(1.0 / sqrt(2.0))
+#define invsq2 0.70710678118654f
+#define PI 3.14159265358979
+
+void CJpegEncoder::WriteSOS()
+{
+ PutByte(0xff);
+ PutByte(0xda);
+
+ WORD size = 6 + 2*ColorComponents;
+ PutByte(size>>8);
+ PutByte(size&0xff);
+
+ PutByte(ColorComponents); // color components: 3
+
+ PutByte(1); // component id
+ PutByte(0x00); // DC | AC huff tbl
+
+ PutByte(2); // component id
+ PutByte(0x11); // DC | AC huff tbl
+
+ PutByte(3); // component id
+ PutByte(0x11); // DC | AC huff tbl
+
+ PutByte(0); // ss, first AC
+ PutByte(63); // se, last AC
+
+ PutByte(0); // ah | al
+
+ static float cosuv[8][8][8][8];
+
+ // oh yeah, we don't need no fast dct :)
+ for(int v = 0; v < 8; v++)
+ for(int u = 0; u < 8; u++)
+ for(int j = 0; j < 8; j++)
+ for(int i = 0; i < 8; i++)
+ cosuv[v][u][j][i] = (float)(cos((2*i+1)*u*PI/16) * cos((2*j+1)*v*PI/16));
+
+ int prevDC[3] = {0, 0, 0};
+
+ for(int y = 0; y < m_h; y += 8)
+ {
+ int jj = min(m_h - y, 8);
+
+ for(int x = 0; x < m_w; x += 8)
+ {
+ int ii = min(m_w - x, 8);
+
+ for(int c = 0; c < ColorComponents; c++)
+ {
+ int cc = !!c;
+
+ int ACs = 0;
+
+ static short block[64];
+
+ for(int zigzag = 0; zigzag < 64; zigzag++)
+ {
+ BYTE u = zigzagU[zigzag];
+ BYTE v = zigzagV[zigzag];
+
+ float F = 0;
+/*
+ for(int j = 0; j < jj; j++)
+ for(int i = 0; i < ii; i++)
+ F += (signed char)m_p[((y+j)*m_w + (x+i))*4 + c] * cosuv[v][u][j][i];
+*/
+ for(int j = 0; j < jj; j++)
+ {
+ signed char* p = (signed char*)&m_p[((y+j)*m_w + x)*4 + c];
+ for(int i = 0; i < ii; i++, p += 4)
+ F += *p * cosuv[v][u][j][i];
+ }
+
+ float cu = !u ? invsq2 : 1.0f;
+ float cv = !v ? invsq2 : 1.0f;
+
+ block[zigzag] = short(2.0 / 8.0 * cu * cv * F) / quanttbl[cc][zigzag];
+ }
+
+ short DC = block[0] - prevDC[c];
+ prevDC[c] = block[0];
+
+ int size = GetBitWidth(DC);
+ PutBit(DCVLC[cc][size], DCVLC_Size[cc][size]);
+
+ if(DC < 0) DC = DC - 1;
+ PutBit(DC, size);
+
+ int j;
+ for(j = 64; j > 1 && !block[j-1]; j--);
+
+ for(int i = 1; i < j; i++)
+ {
+ short AC = block[i];
+
+ if(AC == 0)
+ {
+ if(++ACs == 16)
+ {
+ PutBit(ACVLC[cc][15][0], ACVLC_Size[cc][15][0]);
+ ACs = 0;
+ }
+ }
+ else
+ {
+ int size = GetBitWidth(AC);
+ PutBit(ACVLC[cc][ACs][size], ACVLC_Size[cc][ACs][size]);
+
+ if(AC < 0) AC--;
+ PutBit(AC, size);
+
+ ACs = 0;
+ }
+ }
+
+ if(j < 64) PutBit(ACVLC[cc][0][0], ACVLC_Size[cc][0][0]);
+ }
+ }
+ }
+
+ Flush();
+}
+
+void CJpegEncoder::WriteEOI()
+{
+ PutByte(0xff);
+ PutByte(0xd9);
+}
+
+//
+
+CJpegEncoder::CJpegEncoder()
+{
+}
+
+bool CJpegEncoder::Encode(const BYTE* dib)
+{
+ m_bbuff = m_bwidth = 0;
+
+ BITMAPINFO* bi = (BITMAPINFO*)dib;
+
+ int bpp = bi->bmiHeader.biBitCount;
+
+ if(bpp != 16 && bpp != 24 && bpp != 32) // 16 & 24 not tested!!! there may be some alignment problems when the row size is not 4*something in bytes
+ return false;
+
+ m_w = bi->bmiHeader.biWidth;
+ m_h = abs(bi->bmiHeader.biHeight);
+ m_p = new BYTE[m_w*m_h*4];
+
+ const BYTE* src = dib + sizeof(bi->bmiHeader);
+ if(bi->bmiHeader.biBitCount <= 8)
+ {
+ if(bi->bmiHeader.biClrUsed) src += bi->bmiHeader.biClrUsed * sizeof(bi->bmiColors[0]);
+ else src += (1 << bi->bmiHeader.biBitCount) * sizeof(bi->bmiColors[0]);
+ }
+
+ int srcpitch = m_w*(bpp>>3);
+ int dstpitch = m_w*4;
+
+ BitBltFromRGBToRGB(
+ m_w, m_h,
+ m_p, dstpitch, 32,
+ (BYTE*)src + srcpitch*(m_h-1), -srcpitch, bpp);
+
+ BYTE* p = m_p;
+ for(BYTE* e = p + m_h*dstpitch; p < e; p += 4)
+ {
+ int r = p[2], g = p[1], b = p[0];
+
+ p[0] = (BYTE)min(max(0.2990*r+0.5870*g+0.1140*b, 0), 255) - 128;
+ p[1] = (BYTE)min(max(-0.1687*r-0.3313*g+0.5000*b + 128, 0), 255) - 128;
+ p[2] = (BYTE)min(max(0.5000*r-0.4187*g-0.0813*b + 128, 0), 255) - 128;
+ }
+
+ if(quanttbl[0][0] == 16)
+ {
+ for(int i = 0; i < countof(quanttbl); i++)
+ for(int j = 0; j < countof(quanttbl[0]); j++)
+ quanttbl[i][j] >>= 2; // the default quantization table contains a little too large values
+ }
+
+ WriteSOI();
+ WriteDQT();
+ WriteSOF0();
+ WriteDHT();
+ WriteSOS();
+ WriteEOI();
+
+ delete [] m_p;
+
+ return true;
+}
+
+//////////
+
+CJpegEncoderFile::CJpegEncoderFile(LPCTSTR fn)
+{
+ m_fn = fn;
+ m_file = NULL;
+}
+
+bool CJpegEncoderFile::PutByte(BYTE b)
+{
+ return fputc(b, m_file) != EOF;
+}
+
+bool CJpegEncoderFile::PutBytes(const void* pData, int len)
+{
+ return fwrite(pData, 1, len, m_file) == len;
+}
+
+bool CJpegEncoderFile::Encode(const BYTE* dib)
+{
+ if(!(m_file = _tfopen(m_fn, _T("wb")))) return false;
+ bool ret = __super::Encode(dib);
+ fclose(m_file);
+ m_file = NULL;
+ return ret;
+}
+
+//////////
+
+CJpegEncoderMem::CJpegEncoderMem()
+{
+}
+
+bool CJpegEncoderMem::PutByte(BYTE b)
+{
+ m_pdata->Add(b); // yeah... a bit unbuffered, for now
+ return true;
+}
+
+bool CJpegEncoderMem::PutBytes(const void* pData, int len)
+{
+ CAtlArray<BYTE> moredata;
+ moredata.SetCount(len);
+ memcpy(moredata.GetData(), pData, len);
+ m_pdata->Append(moredata);
+ return true;
+}
+
+bool CJpegEncoderMem::Encode(const BYTE* dib, CAtlArray<BYTE>& data)
+{
+ m_pdata = &data;
+ return __super::Encode(dib);
+}
+
diff --git a/src/apps/mplayerc/jpeg.h b/src/apps/mplayerc/jpeg.h
new file mode 100644
index 000000000..932da80fd
--- /dev/null
+++ b/src/apps/mplayerc/jpeg.h
@@ -0,0 +1,59 @@
+#pragma once
+
+class CJpegEncoder
+{
+ static const int ColorComponents = 3;
+
+ int m_w, m_h;
+ BYTE* m_p;
+
+ unsigned int m_bbuff, m_bwidth;
+ bool PutBit(int b, int n);
+ void Flush();
+ int GetBitWidth(short q);
+
+ void WriteSOI();
+ void WriteDQT();
+ void WriteSOF0();
+ void WriteDHT();
+ void WriteSOS();
+ void WriteEOI();
+
+protected:
+ virtual bool PutByte(BYTE b) = 0;
+ virtual bool PutBytes(const void* pData, int len) = 0;
+ virtual bool Encode(const BYTE* dib);
+
+public:
+ CJpegEncoder();
+};
+
+class CJpegEncoderFile : public CJpegEncoder
+{
+ CString m_fn;
+ FILE* m_file;
+
+protected:
+ bool PutByte(BYTE b);
+ bool PutBytes(const void* pData, int len);
+
+public:
+ CJpegEncoderFile(LPCTSTR fn);
+
+ bool Encode(const BYTE* dib);
+};
+
+class CJpegEncoderMem : public CJpegEncoder
+{
+ CAtlArray<BYTE>* m_pdata;
+
+protected:
+ bool PutByte(BYTE b);
+ bool PutBytes(const void* pData, int len);
+
+public:
+ CJpegEncoderMem();
+
+ bool Encode(const BYTE* dib, CAtlArray<BYTE>& data);
+};
+
diff --git a/src/apps/mplayerc/jpeg_tables.h b/src/apps/mplayerc/jpeg_tables.h
new file mode 100644
index 000000000..df01d3f67
--- /dev/null
+++ b/src/apps/mplayerc/jpeg_tables.h
@@ -0,0 +1,233 @@
+#pragma once
+
+/* Tables */
+
+static unsigned char quanttbl[2][64] =
+{
+ {
+ 16,
+ 11, 12,
+ 14, 12, 10,
+ 16, 14, 13, 14,
+ 18, 17, 16, 19, 24,
+ 40, 26, 24, 22, 22, 24,
+ 49, 35, 37, 29, 40, 58, 51,
+ 61, 30, 57, 51, 56, 55, 64, 72,
+ 92, 78, 64, 68, 87, 69, 55,
+ 56, 80, 109, 81, 87, 95,
+ 98, 103, 104, 103, 62,
+ 77, 113, 121, 112,
+ 100, 120, 92,
+ 101, 103,
+ 99
+ },
+ {
+ 17,
+ 18, 18,
+ 24, 21, 24,
+ 47, 26, 26, 47,
+ 99, 66, 56, 66, 99,
+ 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99,
+ 99, 99, 99, 99,
+ 99, 99, 99,
+ 99, 99,
+ 99
+ }
+};
+
+static unsigned char zigzagU[64] =
+{
+ 0,
+ 1, 0,
+ 0, 1, 2,
+ 3, 2, 1, 0,
+ 0, 1, 2, 3, 4,
+ 5, 4, 3, 2, 1, 0,
+ 0, 1, 2, 3, 4, 5, 6,
+ 7, 6, 5, 4, 3, 2, 1, 0,
+ 1, 2, 3, 4, 5, 6, 7,
+ 7, 6, 5, 4, 3, 2,
+ 3, 4, 5, 6, 7,
+ 7, 6, 5, 4,
+ 5, 6, 7,
+ 7, 6,
+ 7,
+};
+
+static unsigned char zigzagV[64] =
+{
+ 0,
+ 0, 1,
+ 2, 1, 0,
+ 0, 1, 2, 3,
+ 4, 3, 2, 1, 0,
+ 0, 1, 2, 3, 4, 5,
+ 6, 5, 4, 3, 2, 1, 0,
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 7, 6, 5, 4, 3, 2, 1,
+ 2, 3, 4, 5, 6, 7,
+ 7, 6, 5, 4, 3,
+ 4, 5, 6, 7,
+ 7, 6, 5,
+ 6, 7,
+ 7,
+};
+
+static unsigned short DCVLC[2][12] =
+{
+ {0, 2, 3, 4, 5, 6, 14, 30, 62, 126, 254, 510},
+ {0, 1, 2, 6, 14, 30, 62, 126, 254, 510, 1022, 2046}
+};
+
+static unsigned char DCVLC_Size[2][12] =
+{
+ {2, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8, 9},
+ {2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
+};
+
+static unsigned char DCVLC_NumByLength[2][16] =
+{
+ {0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},
+ {0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0}
+};
+
+static unsigned short ACVLC[2][16][11] =
+{
+ {
+ {10, 0, 1, 4, 11, 26, 120, 248, 1014, 65410, 65410},
+ {0, 12, 27, 121, 502, 2038, 65412, 65413, 65414, 65415, 65416},
+ {0, 28, 249, 1015, 4084, 65417, 65418, 65419, 65420, 65421, 65422},
+ {0, 58, 503, 8181, 65423, 65424, 65425, 65426, 65427, 65428, 65429},
+ {0, 59, 1016, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437},
+ {0, 122, 2039, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445},
+ {0, 123, 4086, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453},
+ {0, 250, 4087, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461},
+ {0, 504, 32704, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469},
+ {0, 505, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478},
+ {0, 506, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487},
+ {0, 1017, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496},
+ {0, 1018, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505},
+ {0, 2040, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514},
+ {0, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524},
+ {2041, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534}
+ },
+ {
+ {0, 1, 4, 10, 24, 25, 56, 120, 500, 1014, 4084},
+ {0, 11, 57, 246, 501, 2038, 4085, 65416, 65417, 65418, 65419},
+ {0, 26, 247, 1015, 4086, 32706, 65420, 65421, 65422, 65423, 65424},
+ {0, 27, 248, 1016, 4087, 65425, 65426, 65427, 65428, 65429, 65430},
+ {0, 58, 502, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438},
+ {0, 59, 1017, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446},
+ {0, 121, 2039, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454},
+ {0, 122, 2040, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462},
+ {0, 249, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471},
+ {0, 503, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480},
+ {0, 504, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489},
+ {0, 505, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498},
+ {0, 506, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507},
+ {0, 2041, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516},
+ {0, 16352, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525},
+ {1018, 32707, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534}
+ }
+};
+
+static unsigned char ACVLC_Size[2][16][11] =
+{
+ {
+ {4, 2, 2, 3, 4, 5, 7, 8, 10, 16, 16},
+ {0, 4, 5, 7, 9, 11, 16, 16, 16, 16, 16},
+ {0, 5, 8, 10, 12, 16, 16, 16, 16, 16, 16},
+ {0, 6, 9, 12, 16, 16, 16, 16, 16, 16, 16},
+ {0, 6, 10, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 7, 11, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 7, 12, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 8, 12, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 9, 15, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 10, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}
+ },
+ {
+ {2, 2, 3, 4, 5, 5, 6, 7, 9, 10, 12},
+ {0, 4, 6, 8, 9, 11, 12, 16, 16, 16, 16},
+ {0, 5, 8, 10, 12, 15, 16, 16, 16, 16, 16},
+ {0, 5, 8, 10, 12, 16, 16, 16, 16, 16, 16},
+ {0, 6, 9, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 6, 10, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 7, 11, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 7, 11, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 9, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 11, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {0, 14, 16, 16, 16, 16, 16, 16, 16, 16, 16},
+ {10, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16}
+ }
+};
+
+static unsigned char ACVLC_NumByLength[2][16] =
+{
+ {0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 125},
+ {0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119}
+};
+
+static unsigned char ACVLC_Data[2][162] =
+{
+ {
+ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
+ 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
+ 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, 0x08,
+ 0x23, 0x42, 0xB1, 0xC1, 0x15, 0x52, 0xD1, 0xF0,
+ 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A, 0x16,
+ 0x17, 0x18, 0x19, 0x1A, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+ 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
+ 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
+ 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+ 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
+ 0x7A, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+ 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+ 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
+ 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6,
+ 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5,
+ 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3, 0xD4,
+ 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2,
+ 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,
+ 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8,
+ 0xF9, 0xFA
+ },
+ {
+ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
+ 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
+ 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
+ 0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33, 0x52, 0xF0,
+ 0x15, 0x62, 0x72, 0xD1, 0x0A, 0x16, 0x24, 0x34,
+ 0xE1, 0x25, 0xF1, 0x17, 0x18, 0x19, 0x1A, 0x26,
+ 0x27, 0x28, 0x29, 0x2A, 0x35, 0x36, 0x37, 0x38,
+ 0x39, 0x3A, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+ 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+ 0x59, 0x5A, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+ 0x79, 0x7A, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96,
+ 0x97, 0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5,
+ 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4,
+ 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3,
+ 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2,
+ 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
+ 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9,
+ 0xEA, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8,
+ 0xF9, 0xFA
+ }
+};
diff --git a/src/apps/mplayerc/mplayerc.aps b/src/apps/mplayerc/mplayerc.aps
new file mode 100644
index 000000000..3c8e62ccf
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.aps
Binary files differ
diff --git a/src/apps/mplayerc/mplayerc.cpp b/src/apps/mplayerc/mplayerc.cpp
new file mode 100644
index 000000000..3e92220a4
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.cpp
@@ -0,0 +1,2408 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// mplayerc.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "mplayerc.h"
+#include <atlsync.h>
+#include <Tlhelp32.h>
+#include "MainFrm.h"
+#include "..\..\DSUtil\DSUtil.h"
+
+/////////
+
+void CorrectComboListWidth(CComboBox& box, CFont* pWndFont)
+{
+ int cnt = box.GetCount();
+ if(cnt <= 0) return;
+
+ CDC* pDC = box.GetDC();
+ pDC->SelectObject(pWndFont);
+
+ int maxw = box.GetDroppedWidth();
+
+ for(int i = 0; i < cnt; i++)
+ {
+ CString str;
+ box.GetLBText(i, str);
+ int w = pDC->GetTextExtent(str).cx + 22;
+ if(maxw < w) maxw = w;
+ }
+
+ box.ReleaseDC(pDC);
+
+ box.SetDroppedWidth(maxw);
+}
+
+HICON LoadIcon(CString fn, bool fSmall)
+{
+ if(fn.IsEmpty()) return(NULL);
+
+ CString ext = fn.Left(fn.Find(_T("://"))+1).TrimRight(':');
+ if(ext.IsEmpty() || !ext.CompareNoCase(_T("file")))
+ ext = _T(".") + fn.Mid(fn.ReverseFind('.')+1);
+
+ CSize size(fSmall?16:32,fSmall?16:32);
+
+ if(!ext.CompareNoCase(_T(".ifo")))
+ {
+ if(HICON hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_DVD), IMAGE_ICON, size.cx, size.cy, 0))
+ return(hIcon);
+ }
+
+ if(!ext.CompareNoCase(_T(".cda")))
+ {
+ if(HICON hIcon = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_AUDIOCD), IMAGE_ICON, size.cx, size.cy, 0))
+ return(hIcon);
+ }
+
+ do
+ {
+ CRegKey key;
+
+ TCHAR buff[256];
+ ULONG len;
+
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext + _T("\\DefaultIcon"), KEY_READ))
+ {
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext, KEY_READ))
+ break;
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len) || (ext = buff).Trim().IsEmpty())
+ break;
+
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext + _T("\\DefaultIcon"), KEY_READ))
+ break;
+ }
+
+ CString icon;
+
+ len = sizeof(buff);
+ memset(buff, 0, len);
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len) || (icon = buff).Trim().IsEmpty())
+ break;
+
+ int i = icon.ReverseFind(',');
+ if(i < 0) break;
+
+ int id = 0;
+ if(_stscanf(icon.Mid(i+1), _T("%d"), &id) != 1)
+ break;
+
+ icon = icon.Left(i);
+
+ HICON hIcon = NULL;
+ UINT cnt = fSmall
+ ? ExtractIconEx(icon, id, NULL, &hIcon, 1)
+ : ExtractIconEx(icon, id, &hIcon, NULL, 1);
+ if(hIcon) return hIcon;
+ }
+ while(0);
+
+ return((HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_UNKNOWN), IMAGE_ICON, size.cx, size.cy, 0));
+}
+
+bool LoadType(CString fn, CString& type)
+{
+ CRegKey key;
+
+ TCHAR buff[256];
+ ULONG len;
+
+ if(fn.IsEmpty()) return(NULL);
+
+ CString ext = fn.Left(fn.Find(_T("://"))+1).TrimRight(':');
+ if(ext.IsEmpty() || !ext.CompareNoCase(_T("file")))
+ ext = _T(".") + fn.Mid(fn.ReverseFind('.')+1);
+
+ if(ERROR_SUCCESS != key.Open(HKEY_CLASSES_ROOT, ext))
+ return(false);
+
+ CString tmp = ext;
+
+ while(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, tmp))
+ {
+ len = sizeof(buff);
+ memset(buff, 0, len);
+ if(ERROR_SUCCESS != key.QueryStringValue(NULL, buff, &len))
+ break;
+
+ CString str(buff);
+ str.Trim();
+
+ if(str.IsEmpty() || str == tmp)
+ break;
+
+ tmp = str;
+ }
+
+ type = tmp;
+
+ return(true);
+}
+
+bool LoadResource(UINT resid, CStringA& str, LPCTSTR restype)
+{
+ str.Empty();
+ HRSRC hrsrc = FindResource(AfxGetResourceHandle(), MAKEINTRESOURCE(resid), restype);
+ if(!hrsrc) return(false);
+ HGLOBAL hGlobal = LoadResource(AfxGetResourceHandle(), hrsrc);
+ if(!hGlobal) return(false);
+ DWORD size = SizeofResource(AfxGetResourceHandle(), hrsrc);
+ if(!size) return(false);
+ memcpy(str.GetBufferSetLength(size), LockResource(hGlobal), size);
+ return(true);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CAboutDlg dialog used for App About
+
+class CAboutDlg : public CDialog
+{
+public:
+ CAboutDlg();
+
+// Dialog Data
+ //{{AFX_DATA(CAboutDlg)
+ enum { IDD = IDD_ABOUTBOX };
+ //}}AFX_DATA
+
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CAboutDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ //{{AFX_MSG(CAboutDlg)
+ // No message handlers
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+public:
+ CString m_appname;
+ virtual BOOL OnInitDialog()
+ {
+#ifdef UNICODE
+ UpdateData();
+ m_appname += _T(" (unicode build)");
+ UpdateData(FALSE);
+#endif
+ return TRUE;
+ }
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD), m_appname(_T(""))
+{
+ //{{AFX_DATA_INIT(CAboutDlg)
+ //}}AFX_DATA_INIT
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CAboutDlg)
+ //}}AFX_DATA_MAP
+ DDX_Text(pDX, IDC_STATIC1, m_appname);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+ //{{AFX_MSG_MAP(CAboutDlg)
+ // No message handlers
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CMPlayerCApp
+
+BEGIN_MESSAGE_MAP(CMPlayerCApp, CWinApp)
+ //{{AFX_MSG_MAP(CMPlayerCApp)
+ ON_COMMAND(ID_HELP_ABOUT, OnAppAbout)
+ ON_COMMAND(ID_FILE_EXIT, OnFileExit)
+ //}}AFX_MSG_MAP
+ ON_COMMAND(ID_HELP_SHOWCOMMANDLINESWITCHES, OnHelpShowcommandlineswitches)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CMPlayerCApp construction
+
+CMPlayerCApp::CMPlayerCApp()
+// : m_hMutexOneInstance(NULL)
+{
+ m_fTearingTest = false;
+ memset (&m_ColorControl, 0, sizeof(m_ColorControl));
+ m_ColorControl[0].dwSize = sizeof (COLORPROPERTY_RANGE);
+ m_ColorControl[0].dwProperty = Brightness;
+ m_ColorControl[1].dwSize = sizeof (COLORPROPERTY_RANGE);
+ m_ColorControl[1].dwProperty = Contrast;
+ m_ColorControl[2].dwSize = sizeof (COLORPROPERTY_RANGE);
+ m_ColorControl[2].dwProperty = Hue;
+ m_ColorControl[3].dwSize = sizeof (COLORPROPERTY_RANGE);
+ m_ColorControl[3].dwProperty = Saturation;
+
+ QueryPerformanceFrequency ((LARGE_INTEGER*)&m_PerfFrequency);
+}
+
+void CMPlayerCApp::ShowCmdlnSwitches()
+{
+ CString s;
+
+ if(m_s.nCLSwitches&CLSW_UNRECOGNIZEDSWITCH)
+ {
+ CAtlList<CString> sl;
+ for(int i = 0; i < __argc; i++) sl.AddTail(__targv[i]);
+ s += "Unrecognized switch(es) found in command line string: \n\n" + Implode(sl, ' ') + "\n\n";
+ }
+
+ s +=
+ _T("Usage: mplayerc.exe \"pathname\" [switches]\n\n")
+ _T("\"pathname\"\tThe main file or directory to be loaded. (wildcards allowed)\n")
+ _T("/dub \"dubname\"\tLoad an additional audio file.\n")
+ _T("/sub \"subname\"\tLoad an additional subtitle file.\n")
+ _T("/filter \"filtername\"\tLoad DirectShow filters from a dynamic link library. (wildcards allowed)\n")
+ _T("/dvd\t\tRun in dvd mode, \"pathname\" means the dvd folder (optional).\n")
+ _T("/cd\t\tLoad all the tracks of an audio cd or (s)vcd, \"pathname\" means the drive path (optional).\n")
+ _T("/open\t\tOpen the file, don't automatically start playing.\n")
+ _T("/play\t\tStart playing the file as soon the player is launched.\n")
+ _T("/close\t\tClose the player after playback (only works when used with /play).\n")
+ _T("/shutdown\tShutdown the operating system after playback\n")
+ _T("/fullscreen\tStart in full-screen mode.\n")
+ _T("/minimized\tStart in minimized mode.\n")
+ _T("/new\t\tUse a new instance of the player.\n")
+ _T("/add\t\tAdd \"pathname\" to playlist, can be combined with /open and /play.\n")
+ _T("/regvid\t\tRegister video formats\n")
+ _T("/regaud\t\tRegister audio formats\n")
+ _T("/unregvid\t\tUnregister video formats\n")
+ _T("/unregaud\tUnregister audio formats\n")
+ _T("/start ms\t\tStart playing at \"ms\" (= milliseconds)\n")
+ _T("/fixedsize w,h\tSet fixed window size.\n")
+ _T("/monitor N\tStart on monitor N, where N starts from 1.\n")
+ _T("/help /h /?\tShow help about command line switches. (this message box)\n");
+
+ AfxMessageBox(s);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// The one and only CMPlayerCApp object
+
+CMPlayerCApp theApp;
+
+HWND g_hWnd = NULL;
+
+bool CMPlayerCApp::StoreSettingsToIni()
+{
+ CString ini = GetIniPath();
+/*
+ FILE* f;
+ if(!(f = _tfopen(ini, _T("r+"))) && !(f = _tfopen(ini, _T("w"))))
+ return StoreSettingsToRegistry();
+ fclose(f);
+*/
+ if(m_pszRegistryKey) free((void*)m_pszRegistryKey);
+ m_pszRegistryKey = NULL;
+ if(m_pszProfileName) free((void*)m_pszProfileName);
+ m_pszProfileName = _tcsdup(ini);
+
+ return(true);
+}
+
+bool CMPlayerCApp::StoreSettingsToRegistry()
+{
+ _tremove(GetIniPath());
+
+ if(m_pszRegistryKey) free((void*)m_pszRegistryKey);
+ m_pszRegistryKey = NULL;
+
+ SetRegistryKey(_T("Gabest"));
+
+ return(true);
+}
+
+CString CMPlayerCApp::GetIniPath()
+{
+ CString path;
+ GetModuleFileName(AfxGetInstanceHandle(), path.GetBuffer(MAX_PATH), MAX_PATH);
+ path.ReleaseBuffer();
+ path = path.Left(path.ReverseFind('.')+1) + _T("ini");
+ return(path);
+}
+
+bool CMPlayerCApp::IsIniValid()
+{
+ CFileStatus fs;
+ return CFileGetStatus(GetIniPath(), fs) && fs.m_size > 0;
+}
+
+bool CMPlayerCApp::GetAppDataPath(CString& path)
+{
+ path.Empty();
+
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"), KEY_READ))
+ {
+ ULONG len = MAX_PATH;
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("AppData"), path.GetBuffer(MAX_PATH), &len))
+ path.ReleaseBufferSetLength(len);
+ }
+
+ if(path.IsEmpty())
+ return(false);
+
+ CPath p;
+ p.Combine(path, _T("Media Player Classic"));
+ path = (LPCTSTR)p;
+
+ return(true);
+}
+
+void CMPlayerCApp::PreProcessCommandLine()
+{
+ m_cmdln.RemoveAll();
+ for(int i = 1; i < __argc; i++)
+ {
+ CString str = CString(__targv[i]).Trim(_T(" \""));
+
+ if(str[0] != '/' && str[0] != '-' && str.Find(_T(":")) < 0)
+ {
+ LPTSTR p = NULL;
+ CString str2;
+ str2.ReleaseBuffer(GetFullPathName(str, MAX_PATH, str2.GetBuffer(MAX_PATH), &p));
+ CFileStatus fs;
+ if(!str2.IsEmpty() && CFileGetStatus(str2, fs)) str = str2;
+ }
+
+ m_cmdln.AddTail(str);
+ }
+}
+
+void CMPlayerCApp::SendCommandLine(HWND hWnd)
+{
+ if(m_cmdln.IsEmpty())
+ return;
+
+ int bufflen = sizeof(DWORD);
+
+ POSITION pos = m_cmdln.GetHeadPosition();
+ while(pos) bufflen += (m_cmdln.GetNext(pos).GetLength()+1)*sizeof(TCHAR);
+
+ CAutoVectorPtr<BYTE> buff;
+ if(!buff.Allocate(bufflen))
+ return;
+
+ BYTE* p = buff;
+
+ *(DWORD*)p = m_cmdln.GetCount();
+ p += sizeof(DWORD);
+
+ pos = m_cmdln.GetHeadPosition();
+ while(pos)
+ {
+ CString s = m_cmdln.GetNext(pos);
+ int len = (s.GetLength()+1)*sizeof(TCHAR);
+ memcpy(p, s, len);
+ p += len;
+ }
+
+ COPYDATASTRUCT cds;
+ cds.dwData = 0x6ABE51;
+ cds.cbData = bufflen;
+ cds.lpData = (void*)(BYTE*)buff;
+ SendMessage(hWnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&cds);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CMPlayerCApp initialization
+
+#include "..\..\..\include\detours\detours.h"
+#include "..\..\..\include\winddk\ntddcdvd.h"
+
+DETOUR_TRAMPOLINE(BOOL WINAPI Real_IsDebuggerPresent(), IsDebuggerPresent);
+BOOL WINAPI Mine_IsDebuggerPresent()
+{
+ TRACE(_T("Oops, somebody was trying to be naughty! (called IsDebuggerPresent)\n"));
+ return FALSE;
+}
+
+DETOUR_TRAMPOLINE(LONG WINAPI Real_ChangeDisplaySettingsExA(LPCSTR lpszDeviceName, LPDEVMODEA lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam), ChangeDisplaySettingsExA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam), ChangeDisplaySettingsExW);
+LONG WINAPI Mine_ChangeDisplaySettingsEx(LONG ret, DWORD dwFlags, LPVOID lParam)
+{
+ if(dwFlags&CDS_VIDEOPARAMETERS)
+ {
+ VIDEOPARAMETERS* vp = (VIDEOPARAMETERS*)lParam;
+
+ if(vp->Guid == GUIDFromCString(_T("{02C62061-1097-11d1-920F-00A024DF156E}"))
+ && (vp->dwFlags&VP_FLAGS_COPYPROTECT))
+ {
+ if(vp->dwCommand == VP_COMMAND_GET)
+ {
+ if((vp->dwTVStandard&VP_TV_STANDARD_WIN_VGA)
+ && vp->dwTVStandard != VP_TV_STANDARD_WIN_VGA)
+ {
+ TRACE(_T("Ooops, tv-out enabled? macrovision checks suck..."));
+ vp->dwTVStandard = VP_TV_STANDARD_WIN_VGA;
+ }
+ }
+ else if(vp->dwCommand == VP_COMMAND_SET)
+ {
+ TRACE(_T("Ooops, as I already told ya, no need for any macrovision bs here"));
+ return 0;
+ }
+ }
+ }
+
+ return ret;
+}
+LONG WINAPI Mine_ChangeDisplaySettingsExA(LPCSTR lpszDeviceName, LPDEVMODEA lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam)
+{
+ return Mine_ChangeDisplaySettingsEx(
+ Real_ChangeDisplaySettingsExA(lpszDeviceName, lpDevMode, hwnd, dwFlags, lParam),
+ dwFlags,
+ lParam);
+}
+LONG WINAPI Mine_ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam)
+{
+ return Mine_ChangeDisplaySettingsEx(
+ Real_ChangeDisplaySettingsExW(lpszDeviceName, lpDevMode, hwnd, dwFlags, lParam),
+ dwFlags,
+ lParam);
+}
+
+DETOUR_TRAMPOLINE(HANDLE WINAPI Real_CreateFileA(LPCSTR p1, DWORD p2, DWORD p3, LPSECURITY_ATTRIBUTES p4, DWORD p5, DWORD p6, HANDLE p7), CreateFileA);
+DETOUR_TRAMPOLINE(HANDLE WINAPI Real_CreateFileW(LPCWSTR p1, DWORD p2, DWORD p3, LPSECURITY_ATTRIBUTES p4, DWORD p5, DWORD p6, HANDLE p7), CreateFileW);
+HANDLE WINAPI Mine_CreateFileA(LPCSTR p1, DWORD p2, DWORD p3, LPSECURITY_ATTRIBUTES p4, DWORD p5, DWORD p6, HANDLE p7)
+{
+ CStringA fn(p1);
+ fn.MakeLower();
+ int i = fn.Find(".part");
+ if(i > 0 && i == fn.GetLength() - 5)
+ p3 |= FILE_SHARE_WRITE;
+
+ return Real_CreateFileA(p1, p2, p3, p4, p5, p6, p7);
+}
+HANDLE WINAPI Mine_CreateFileW(LPCWSTR p1, DWORD p2, DWORD p3, LPSECURITY_ATTRIBUTES p4, DWORD p5, DWORD p6, HANDLE p7)
+{
+ CStringW fn(p1);
+ fn.MakeLower();
+ int i = fn.Find(L".part");
+ if(i > 0 && i == fn.GetLength() - 5)
+ p3 |= FILE_SHARE_WRITE;
+
+ return Real_CreateFileW(p1, p2, p3, p4, p5, p6, p7);
+}
+
+DETOUR_TRAMPOLINE(MMRESULT WINAPI Real_mixerSetControlDetails(HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails), mixerSetControlDetails);
+MMRESULT WINAPI Mine_mixerSetControlDetails(HMIXEROBJ hmxobj, LPMIXERCONTROLDETAILS pmxcd, DWORD fdwDetails)
+{
+ if(fdwDetails == (MIXER_OBJECTF_HMIXER|MIXER_SETCONTROLDETAILSF_VALUE))
+ return MMSYSERR_NOERROR; // don't touch the mixer, kthx
+ return Real_mixerSetControlDetails(hmxobj, pmxcd, fdwDetails);
+}
+
+DETOUR_TRAMPOLINE(BOOL WINAPI Real_DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped), DeviceIoControl);
+BOOL WINAPI Mine_DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped)
+{
+ BOOL ret = Real_DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);
+
+ if(IOCTL_DVD_GET_REGION == dwIoControlCode && lpOutBuffer
+ && lpBytesReturned && *lpBytesReturned == sizeof(DVD_REGION))
+ {
+ DVD_REGION* pDVDRegion = (DVD_REGION*)lpOutBuffer;
+ pDVDRegion->SystemRegion = ~pDVDRegion->RegionData;
+ }
+
+ return ret;
+}
+
+BOOL CMPlayerCApp::InitInstance()
+{
+ DetourFunctionWithTrampoline((PBYTE)Real_IsDebuggerPresent, (PBYTE)Mine_IsDebuggerPresent);
+ DetourFunctionWithTrampoline((PBYTE)Real_ChangeDisplaySettingsExA, (PBYTE)Mine_ChangeDisplaySettingsExA);
+ DetourFunctionWithTrampoline((PBYTE)Real_ChangeDisplaySettingsExW, (PBYTE)Mine_ChangeDisplaySettingsExW);
+ DetourFunctionWithTrampoline((PBYTE)Real_CreateFileA, (PBYTE)Mine_CreateFileA);
+ DetourFunctionWithTrampoline((PBYTE)Real_CreateFileW, (PBYTE)Mine_CreateFileW);
+ DetourFunctionWithTrampoline((PBYTE)Real_mixerSetControlDetails, (PBYTE)Mine_mixerSetControlDetails);
+ DetourFunctionWithTrampoline((PBYTE)Real_DeviceIoControl, (PBYTE)Mine_DeviceIoControl);
+ CFilterMapper2::Init();
+
+ HRESULT hr;
+ if(FAILED(hr = OleInitialize(0)))
+ {
+ AfxMessageBox(_T("OleInitialize failed!"));
+ return FALSE;
+ }
+
+ WNDCLASS wndcls;
+ memset(&wndcls, 0, sizeof(WNDCLASS));
+ wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
+ wndcls.lpfnWndProc = ::DefWindowProc;
+ wndcls.hInstance = AfxGetInstanceHandle();
+ wndcls.hIcon = LoadIcon(IDR_MAINFRAME);
+ wndcls.hCursor = LoadCursor(IDC_ARROW);
+ wndcls.hbrBackground = 0;//(HBRUSH)(COLOR_WINDOW + 1); // no bkg brush, the view and the bars should always fill the whole client area
+ wndcls.lpszMenuName = NULL;
+ wndcls.lpszClassName = MPC_WND_CLASS_NAME;
+
+ if(!AfxRegisterClass(&wndcls))
+ {
+ AfxMessageBox(_T("MainFrm class registration failed!"));
+ return FALSE;
+ }
+
+ if(!AfxSocketInit(NULL))
+ {
+ AfxMessageBox(_T("AfxSocketInit failed!"));
+ return FALSE;
+ }
+
+ PreProcessCommandLine();
+
+ if(IsIniValid()) StoreSettingsToIni();
+ else StoreSettingsToRegistry();
+
+ CString AppDataPath;
+ if(GetAppDataPath(AppDataPath))
+ CreateDirectory(AppDataPath, NULL);
+
+ m_s.ParseCommandLine(m_cmdln);
+
+ if(m_s.nCLSwitches&(CLSW_HELP|CLSW_UNRECOGNIZEDSWITCH))
+ {
+ ShowCmdlnSwitches();
+ return FALSE;
+ }
+
+ if((m_s.nCLSwitches&CLSW_CLOSE) && m_s.slFiles.IsEmpty())
+ {
+ return FALSE;
+ }
+
+ m_s.UpdateData(false);
+
+ if((m_s.nCLSwitches&CLSW_REGEXTVID) || (m_s.nCLSwitches&CLSW_UNREGEXTVID)
+ || (m_s.nCLSwitches&CLSW_REGEXTAUD) || (m_s.nCLSwitches&CLSW_UNREGEXTAUD))
+ {
+ CMediaFormats& mf = m_s.Formats;
+
+ for(int i = 0; i < mf.GetCount(); i++)
+ {
+ // HACK
+ if(!mf[i].GetLabel().CompareNoCase(_T("Image file"))) continue;
+
+ bool fAudioOnly = mf[i].IsAudioOnly();
+
+ int j = 0;
+ CString str = mf[i].GetExtsWithPeriod();
+ for(CString ext = str.Tokenize(_T(" "), j); !ext.IsEmpty(); ext = str.Tokenize(_T(" "), j))
+ {
+ if((m_s.nCLSwitches&CLSW_REGEXTVID) && !fAudioOnly
+ || (m_s.nCLSwitches&CLSW_REGEXTAUD) && fAudioOnly)
+ CPPageFormats::RegisterExt(ext, true);
+
+ if((m_s.nCLSwitches&CLSW_UNREGEXTVID) && !fAudioOnly
+ || (m_s.nCLSwitches&CLSW_UNREGEXTAUD) && fAudioOnly)
+ CPPageFormats::RegisterExt(ext, false);
+ }
+ }
+
+ return FALSE;
+ }
+
+ m_mutexOneInstance.Create(NULL, TRUE, MPC_WND_CLASS_NAME);
+
+ if(GetLastError() == ERROR_ALREADY_EXISTS
+ && (!(m_s.fAllowMultipleInst || (m_s.nCLSwitches&CLSW_NEW) || m_cmdln.IsEmpty())
+ || (m_s.nCLSwitches&CLSW_ADD)))
+ {
+ if(HWND hWnd = ::FindWindow(MPC_WND_CLASS_NAME, NULL))
+ {
+ SetForegroundWindow(hWnd);
+
+ if(!(m_s.nCLSwitches&CLSW_MINIMIZED) && IsIconic(hWnd))
+ ShowWindow(hWnd, SW_RESTORE);
+
+ SendCommandLine(hWnd);
+
+ return FALSE;
+ }
+ }
+
+ if(!__super::InitInstance())
+ {
+ AfxMessageBox(_T("InitInstance failed!"));
+ return FALSE;
+ }
+
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Create(HKEY_LOCAL_MACHINE, _T("Software\\Gabest\\Media Player Classic")))
+ {
+ CString path;
+ GetModuleFileName(AfxGetInstanceHandle(), path.GetBuffer(MAX_PATH), MAX_PATH);
+ path.ReleaseBuffer();
+ key.SetStringValue(_T("ExePath"), path);
+ }
+
+ AfxEnableControlContainer();
+
+ CMainFrame* pFrame = new CMainFrame;
+ m_pMainWnd = pFrame;
+ pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW|FWS_ADDTOTITLE, NULL, NULL);
+ pFrame->SetDefaultWindowRect((m_s.nCLSwitches&CLSW_MONITOR)?m_s.iMonitor:0);
+ pFrame->RestoreFloatingControlBars();
+ pFrame->SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), TRUE);
+ pFrame->DragAcceptFiles();
+ pFrame->ShowWindow((m_s.nCLSwitches&CLSW_MINIMIZED)?SW_SHOWMINIMIZED:SW_SHOW);
+ pFrame->UpdateWindow();
+ pFrame->m_hAccelTable = m_s.hAccel;
+
+ m_s.WinLircClient.SetHWND(m_pMainWnd->m_hWnd);
+ if(m_s.fWinLirc) m_s.WinLircClient.Connect(m_s.WinLircAddr);
+ m_s.UIceClient.SetHWND(m_pMainWnd->m_hWnd);
+ if(m_s.fUIce) m_s.UIceClient.Connect(m_s.UIceAddr);
+
+ SendCommandLine(m_pMainWnd->m_hWnd);
+
+ pFrame->SetFocus();
+
+ return TRUE;
+}
+
+int CMPlayerCApp::ExitInstance()
+{
+ m_s.UpdateData(true);
+
+ OleUninitialize();
+
+ return CWinApp::ExitInstance();
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CMPlayerCApp message handlers
+// App command to run the dialog
+
+void CMPlayerCApp::OnAppAbout()
+{
+ CAboutDlg aboutDlg;
+ aboutDlg.DoModal();
+}
+
+void CMPlayerCApp::OnFileExit()
+{
+ OnAppExit();
+}
+
+// CRemoteCtrlClient
+
+CRemoteCtrlClient::CRemoteCtrlClient()
+ : m_pWnd(NULL)
+ , m_nStatus(DISCONNECTED)
+{
+}
+
+void CRemoteCtrlClient::SetHWND(HWND hWnd)
+{
+ CAutoLock cAutoLock(&m_csLock);
+
+ m_pWnd = CWnd::FromHandle(hWnd);
+}
+
+void CRemoteCtrlClient::Connect(CString addr)
+{
+ CAutoLock cAutoLock(&m_csLock);
+
+ if(m_nStatus == CONNECTING && m_addr == addr)
+ {
+ TRACE(_T("CRemoteCtrlClient (Connect): already connecting to %s\n"), addr);
+ return;
+ }
+
+ if(m_nStatus == CONNECTED && m_addr == addr)
+ {
+ TRACE(_T("CRemoteCtrlClient (Connect): already connected to %s\n"), addr);
+ return;
+ }
+
+ m_nStatus = CONNECTING;
+
+ TRACE(_T("CRemoteCtrlClient (Connect): connecting to %s\n"), addr);
+
+ Close();
+
+ Create();
+
+ CString ip = addr.Left(addr.Find(':')+1).TrimRight(':');
+ int port = _tcstol(addr.Mid(addr.Find(':')+1), NULL, 10);
+
+ __super::Connect(ip, port);
+
+ m_addr = addr;
+}
+
+void CRemoteCtrlClient::OnConnect(int nErrorCode)
+{
+ CAutoLock cAutoLock(&m_csLock);
+
+ m_nStatus = (nErrorCode == 0 ? CONNECTED : DISCONNECTED);
+
+ TRACE(_T("CRemoteCtrlClient (OnConnect): %d\n"), nErrorCode);
+}
+
+void CRemoteCtrlClient::OnClose(int nErrorCode)
+{
+ CAutoLock cAutoLock(&m_csLock);
+
+ if(m_hSocket != INVALID_SOCKET && m_nStatus == CONNECTED)
+ {
+ TRACE(_T("CRemoteCtrlClient (OnClose): connection lost\n"));
+ }
+
+ m_nStatus = DISCONNECTED;
+
+ TRACE(_T("CRemoteCtrlClient (OnClose): %d\n"), nErrorCode);
+}
+
+void CRemoteCtrlClient::OnReceive(int nErrorCode)
+{
+ if(nErrorCode != 0 || !m_pWnd) return;
+
+ CStringA str;
+ int ret = Receive(str.GetBuffer(256), 255, 0);
+ if(ret <= 0) return;
+ str.ReleaseBuffer(ret);
+
+ TRACE(_T("CRemoteCtrlClient (OnReceive): %s\n"), CString(str));
+
+ OnCommand(str);
+
+ __super::OnReceive(nErrorCode);
+}
+
+void CRemoteCtrlClient::ExecuteCommand(CStringA cmd, int repcnt)
+{
+ cmd.Trim();
+ if(cmd.IsEmpty()) return;
+ cmd.Replace(' ', '_');
+
+ AppSettings& s = AfxGetAppSettings();
+
+ POSITION pos = s.wmcmds.GetHeadPosition();
+ while(pos)
+ {
+ wmcmd wc = s.wmcmds.GetNext(pos);
+ CStringA name = CString(wc.name);
+ name.Replace(' ', '_');
+ if((repcnt == 0 && wc.rmrepcnt == 0 || wc.rmrepcnt > 0 && (repcnt%wc.rmrepcnt) == 0)
+ && (!name.CompareNoCase(cmd) || !wc.rmcmd.CompareNoCase(cmd) || wc.cmd == (WORD)strtol(cmd, NULL, 10)))
+ {
+ CAutoLock cAutoLock(&m_csLock);
+ TRACE(_T("CRemoteCtrlClient (calling command): %s\n"), wc.name);
+ m_pWnd->SendMessage(WM_COMMAND, wc.cmd);
+ break;
+ }
+ }
+}
+
+// CWinLircClient
+
+CWinLircClient::CWinLircClient()
+{
+}
+
+void CWinLircClient::OnCommand(CStringA str)
+{
+ TRACE(_T("CWinLircClient (OnCommand): %s\n"), CString(str));
+
+ int i = 0, j = 0, repcnt = 0;
+ for(CStringA token = str.Tokenize(" ", i);
+ !token.IsEmpty();
+ token = str.Tokenize(" ", i), j++)
+ {
+ if(j == 1)
+ repcnt = strtol(token, NULL, 16);
+ else if(j == 2)
+ ExecuteCommand(token, repcnt);
+ }
+}
+
+// CUIceClient
+
+CUIceClient::CUIceClient()
+{
+}
+
+void CUIceClient::OnCommand(CStringA str)
+{
+ TRACE(_T("CUIceClient (OnCommand): %s\n"), CString(str));
+
+ CStringA cmd;
+ int i = 0, j = 0;
+ for(CStringA token = str.Tokenize("|", i);
+ !token.IsEmpty();
+ token = str.Tokenize("|", i), j++)
+ {
+ if(j == 0)
+ cmd = token;
+ else if(j == 1)
+ ExecuteCommand(cmd, strtol(token, NULL, 16));
+ }
+}
+
+// CMPlayerCApp::Settings
+
+CMPlayerCApp::Settings::Settings()
+ : fInitialized(false)
+ , MRU(0, _T("Recent File List"), _T("File%d"), 20)
+ , MRUDub(0, _T("Recent Dub List"), _T("Dub%d"), 20)
+ , hAccel(NULL)
+{
+#define ADDCMD(cmd) wmcmds.AddTail(wmcmd##cmd)
+ ADDCMD((ID_FILE_OPENQUICK, 'Q', FVIRTKEY|FCONTROL|FNOINVERT, _T("Quick Open File")));
+ ADDCMD((ID_FILE_OPENMEDIA, 'O', FVIRTKEY|FCONTROL|FNOINVERT, _T("Open File")));
+ ADDCMD((ID_FILE_OPENDVD, 'D', FVIRTKEY|FCONTROL|FNOINVERT, _T("Open DVD")));
+ ADDCMD((ID_FILE_OPENDEVICE, 'V', FVIRTKEY|FCONTROL|FNOINVERT, _T("Open Device")));
+ ADDCMD((ID_FILE_SAVE_COPY, 0, FVIRTKEY|FNOINVERT, _T("Save As")));
+ ADDCMD((ID_FILE_SAVE_IMAGE, 0, FVIRTKEY|FNOINVERT, _T("Save Image")));
+ ADDCMD((ID_FILE_SAVE_IMAGE_AUTO, VK_F5, FVIRTKEY|FNOINVERT, _T("Save Image (auto)")));
+ ADDCMD((ID_FILE_LOAD_SUBTITLE, 'L', FVIRTKEY|FCONTROL|FNOINVERT, _T("Load Subtitle")));
+ ADDCMD((ID_FILE_SAVE_SUBTITLE, 'S', FVIRTKEY|FCONTROL|FNOINVERT, _T("Save Subtitle")));
+ ADDCMD((ID_FILE_CLOSEPLAYLIST, 'C', FVIRTKEY|FCONTROL|FNOINVERT, _T("Close")));
+ ADDCMD((ID_FILE_PROPERTIES, VK_F10, FVIRTKEY|FSHIFT|FNOINVERT, _T("Properties")));
+ ADDCMD((ID_FILE_EXIT, 'X', FVIRTKEY|FALT|FNOINVERT, _T("Exit")));
+ ADDCMD((ID_PLAY_PLAYPAUSE, VK_SPACE, FVIRTKEY|FNOINVERT, _T("Play/Pause"), APPCOMMAND_MEDIA_PLAY_PAUSE, wmcmd::LDOWN));
+ ADDCMD((ID_PLAY_PLAY, 0, FVIRTKEY|FNOINVERT, _T("Play")));
+ ADDCMD((ID_PLAY_PAUSE, 0, FVIRTKEY|FNOINVERT, _T("Pause")));
+ ADDCMD((ID_PLAY_STOP, VK_OEM_PERIOD, FVIRTKEY|FNOINVERT, _T("Stop"), APPCOMMAND_MEDIA_STOP));
+ ADDCMD((ID_PLAY_FRAMESTEP, VK_RIGHT, FVIRTKEY|FNOINVERT, _T("Framestep")));
+ ADDCMD((ID_PLAY_FRAMESTEPCANCEL, VK_LEFT, FVIRTKEY|FNOINVERT, _T("Framestep back")));
+ ADDCMD((ID_PLAY_GOTO, 'G', FVIRTKEY|FCONTROL|FNOINVERT, _T("Go To")));
+ ADDCMD((ID_PLAY_INCRATE, VK_UP, FVIRTKEY|FCONTROL|FNOINVERT, _T("Increase Rate")));
+ ADDCMD((ID_PLAY_DECRATE, VK_DOWN, FVIRTKEY|FCONTROL|FNOINVERT, _T("Decrease Rate")));
+ ADDCMD((ID_PLAY_RESETRATE, 'R', FVIRTKEY|FCONTROL|FNOINVERT, _T("Reset Rate")));
+ ADDCMD((ID_PLAY_INCAUDDELAY, VK_ADD, FVIRTKEY|FNOINVERT, _T("Audio Delay +10ms")));
+ ADDCMD((ID_PLAY_DECAUDDELAY, VK_SUBTRACT, FVIRTKEY|FNOINVERT, _T("Audio Delay -10ms")));
+ ADDCMD((ID_PLAY_SEEKFORWARDSMALL, 0, FVIRTKEY|FNOINVERT, _T("Jump Forward (small)")));
+ ADDCMD((ID_PLAY_SEEKBACKWARDSMALL, 0, FVIRTKEY|FNOINVERT, _T("Jump Backward (small)")));
+ ADDCMD((ID_PLAY_SEEKFORWARDMED, VK_RIGHT, FVIRTKEY|FCONTROL|FNOINVERT, _T("Jump Forward (medium)")));
+ ADDCMD((ID_PLAY_SEEKBACKWARDMED, VK_LEFT, FVIRTKEY|FCONTROL|FNOINVERT, _T("Jump Backward (medium)")));
+ ADDCMD((ID_PLAY_SEEKFORWARDLARGE, 0, FVIRTKEY|FNOINVERT, _T("Jump Forward (large)")));
+ ADDCMD((ID_PLAY_SEEKBACKWARDLARGE, 0, FVIRTKEY|FNOINVERT, _T("Jump Backward (large)")));
+ ADDCMD((ID_PLAY_SEEKKEYFORWARD, VK_RIGHT, FVIRTKEY|FSHIFT|FNOINVERT, _T("Jump Forward (keyframe)")));
+ ADDCMD((ID_PLAY_SEEKKEYBACKWARD, VK_LEFT, FVIRTKEY|FSHIFT|FNOINVERT, _T("Jump Backward (keyframe)")));
+ ADDCMD((ID_NAVIGATE_SKIPFORWARD, VK_NEXT, FVIRTKEY|FNOINVERT, _T("Next"), APPCOMMAND_MEDIA_NEXTTRACK, wmcmd::X2DOWN));
+ ADDCMD((ID_NAVIGATE_SKIPBACK, VK_PRIOR, FVIRTKEY|FNOINVERT, _T("Previous"), APPCOMMAND_MEDIA_PREVIOUSTRACK, wmcmd::X1DOWN));
+ ADDCMD((ID_NAVIGATE_SKIPFORWARDPLITEM, VK_NEXT, FVIRTKEY|FCONTROL|FNOINVERT, _T("Next Playlist Item")));
+ ADDCMD((ID_NAVIGATE_SKIPBACKPLITEM, VK_PRIOR, FVIRTKEY|FCONTROL|FNOINVERT, _T("Previous Playlist Item")));
+ ADDCMD((ID_VIEW_CAPTIONMENU, '0', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Caption&Menu")));
+ ADDCMD((ID_VIEW_SEEKER, '1', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Seeker")));
+ ADDCMD((ID_VIEW_CONTROLS, '2', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Controls")));
+ ADDCMD((ID_VIEW_INFORMATION, '3', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Information")));
+ ADDCMD((ID_VIEW_STATISTICS, '4', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Statistics")));
+ ADDCMD((ID_VIEW_STATUS, '5', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Status")));
+ ADDCMD((ID_VIEW_SUBRESYNC, '6', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Subresync Bar")));
+ ADDCMD((ID_VIEW_PLAYLIST, '7', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Playlist Bar")));
+ ADDCMD((ID_VIEW_CAPTURE, '8', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Capture Bar")));
+ ADDCMD((ID_VIEW_SHADEREDITOR, '9', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Shader Editor Bar")));
+ ADDCMD((ID_VIEW_PRESETS_MINIMAL, '1', FVIRTKEY|FNOINVERT, _T("View Minimal")));
+ ADDCMD((ID_VIEW_PRESETS_COMPACT, '2', FVIRTKEY|FNOINVERT, _T("View Compact")));
+ ADDCMD((ID_VIEW_PRESETS_NORMAL, '3', FVIRTKEY|FNOINVERT, _T("View Normal")));
+ ADDCMD((ID_VIEW_FULLSCREEN, VK_RETURN, FVIRTKEY|FALT|FNOINVERT, _T("Fullscreen"), 0, wmcmd::LDBLCLK));
+ ADDCMD((ID_VIEW_FULLSCREEN_SECONDARY, VK_RETURN, FVIRTKEY|FCONTROL|FNOINVERT, _T("Fullscreen (w/o res.change)")));
+ ADDCMD((ID_VIEW_ZOOM_50, '1', FVIRTKEY|FALT|FNOINVERT, _T("Zoom 50%")));
+ ADDCMD((ID_VIEW_ZOOM_100, '2', FVIRTKEY|FALT|FNOINVERT, _T("Zoom 100%")));
+ ADDCMD((ID_VIEW_ZOOM_200, '3', FVIRTKEY|FALT|FNOINVERT, _T("Zoom 200%")));
+ ADDCMD((ID_VIEW_ZOOM_AUTOFIT, '4', FVIRTKEY|FALT|FNOINVERT, _T("Zoom Auto Fit")));
+ ADDCMD((ID_ASPECTRATIO_NEXT, 0, FVIRTKEY|FNOINVERT, _T("Next AR Preset")));
+ ADDCMD((ID_VIEW_VF_HALF, 0, FVIRTKEY|FNOINVERT, _T("VidFrm Half")));
+ ADDCMD((ID_VIEW_VF_NORMAL, 0, FVIRTKEY|FNOINVERT, _T("VidFrm Normal")));
+ ADDCMD((ID_VIEW_VF_DOUBLE, 0, FVIRTKEY|FNOINVERT, _T("VidFrm Double")));
+ ADDCMD((ID_VIEW_VF_STRETCH, 0, FVIRTKEY|FNOINVERT, _T("VidFrm Stretch")));
+ ADDCMD((ID_VIEW_VF_FROMINSIDE, 0, FVIRTKEY|FNOINVERT, _T("VidFrm Inside")));
+ ADDCMD((ID_VIEW_VF_FROMOUTSIDE, 0, FVIRTKEY|FNOINVERT, _T("VidFrm Outside")));
+ ADDCMD((ID_ONTOP_ALWAYS, 'A', FVIRTKEY|FCONTROL|FNOINVERT, _T("Always On Top")));
+ ADDCMD((ID_VIEW_RESET, VK_NUMPAD5, FVIRTKEY|FNOINVERT, _T("PnS Reset")));
+ ADDCMD((ID_VIEW_INCSIZE, VK_NUMPAD9, FVIRTKEY|FNOINVERT, _T("PnS Inc Size")));
+ ADDCMD((ID_VIEW_INCWIDTH, VK_NUMPAD6, FVIRTKEY|FNOINVERT, _T("PnS Inc Width")));
+ ADDCMD((ID_VIEW_INCHEIGHT, VK_NUMPAD8, FVIRTKEY|FNOINVERT, _T("PnS Inc Height")));
+ ADDCMD((ID_VIEW_DECSIZE, VK_NUMPAD1, FVIRTKEY|FNOINVERT, _T("PnS Dec Size")));
+ ADDCMD((ID_VIEW_DECWIDTH, VK_NUMPAD4, FVIRTKEY|FNOINVERT, _T("PnS Dec Width")));
+ ADDCMD((ID_VIEW_DECHEIGHT, VK_NUMPAD2, FVIRTKEY|FNOINVERT, _T("PnS Dec Height")));
+ ADDCMD((ID_PANSCAN_CENTER, VK_NUMPAD5, FVIRTKEY|FCONTROL|FNOINVERT, _T("PnS Center")));
+ ADDCMD((ID_PANSCAN_MOVELEFT, VK_NUMPAD4, FVIRTKEY|FCONTROL|FNOINVERT, _T("PnS Left")));
+ ADDCMD((ID_PANSCAN_MOVERIGHT, VK_NUMPAD6, FVIRTKEY|FCONTROL|FNOINVERT, _T("PnS Right")));
+ ADDCMD((ID_PANSCAN_MOVEUP, VK_NUMPAD8, FVIRTKEY|FCONTROL|FNOINVERT, _T("PnS Up")));
+ ADDCMD((ID_PANSCAN_MOVEDOWN, VK_NUMPAD2, FVIRTKEY|FCONTROL|FNOINVERT, _T("PnS Down")));
+ ADDCMD((ID_PANSCAN_MOVEUPLEFT, VK_NUMPAD7, FVIRTKEY|FCONTROL|FNOINVERT, _T("PnS Up/Left")));
+ ADDCMD((ID_PANSCAN_MOVEUPRIGHT, VK_NUMPAD9, FVIRTKEY|FCONTROL|FNOINVERT, _T("PnS Up/Right")));
+ ADDCMD((ID_PANSCAN_MOVEDOWNLEFT, VK_NUMPAD1, FVIRTKEY|FCONTROL|FNOINVERT, _T("PnS Down/Left")));
+ ADDCMD((ID_PANSCAN_MOVEDOWNRIGHT, VK_NUMPAD3, FVIRTKEY|FCONTROL|FNOINVERT, _T("PnS Down/Right")));
+ ADDCMD((ID_PANSCAN_ROTATEXP, VK_NUMPAD8, FVIRTKEY|FALT|FNOINVERT, _T("PnS Rotate X+")));
+ ADDCMD((ID_PANSCAN_ROTATEXM, VK_NUMPAD2, FVIRTKEY|FALT|FNOINVERT, _T("PnS Rotate X-")));
+ ADDCMD((ID_PANSCAN_ROTATEYP, VK_NUMPAD4, FVIRTKEY|FALT|FNOINVERT, _T("PnS Rotate Y+")));
+ ADDCMD((ID_PANSCAN_ROTATEYM, VK_NUMPAD6, FVIRTKEY|FALT|FNOINVERT, _T("PnS Rotate Y-")));
+ ADDCMD((ID_PANSCAN_ROTATEZP, VK_NUMPAD1, FVIRTKEY|FALT|FNOINVERT, _T("PnS Rotate Z+")));
+ ADDCMD((ID_PANSCAN_ROTATEZM, VK_NUMPAD3, FVIRTKEY|FALT|FNOINVERT, _T("PnS Rotate Z-")));
+ ADDCMD((ID_VOLUME_UP, VK_UP, FVIRTKEY|FNOINVERT, _T("Volume Up"), APPCOMMAND_VOLUME_UP, wmcmd::WUP));
+ ADDCMD((ID_VOLUME_DOWN, VK_DOWN, FVIRTKEY|FNOINVERT, _T("Volume Down"), APPCOMMAND_VOLUME_DOWN, wmcmd::WDOWN));
+ ADDCMD((ID_VOLUME_MUTE, 'M', FVIRTKEY|FCONTROL|FNOINVERT, _T("Volume Mute"), APPCOMMAND_VOLUME_MUTE));
+ ADDCMD((ID_NAVIGATE_TITLEMENU, 'T', FVIRTKEY|FALT|FNOINVERT, _T("DVD Title Menu")));
+ ADDCMD((ID_NAVIGATE_ROOTMENU, 'R', FVIRTKEY|FALT|FNOINVERT, _T("DVD Root Menu")));
+ ADDCMD((ID_NAVIGATE_SUBPICTUREMENU, 0, FVIRTKEY|FNOINVERT, _T("DVD Subtitle Menu")));
+ ADDCMD((ID_NAVIGATE_AUDIOMENU, 0, FVIRTKEY|FNOINVERT, _T("DVD Audio Menu")));
+ ADDCMD((ID_NAVIGATE_ANGLEMENU, 0, FVIRTKEY|FNOINVERT, _T("DVD Angle Menu")));
+ ADDCMD((ID_NAVIGATE_CHAPTERMENU, 0, FVIRTKEY|FNOINVERT, _T("DVD Chapter Menu")));
+ ADDCMD((ID_NAVIGATE_MENU_LEFT, VK_LEFT, FVIRTKEY|FALT|FNOINVERT, _T("DVD Menu Left")));
+ ADDCMD((ID_NAVIGATE_MENU_RIGHT, VK_RIGHT, FVIRTKEY|FALT|FNOINVERT, _T("DVD Menu Right")));
+ ADDCMD((ID_NAVIGATE_MENU_UP, VK_UP, FVIRTKEY|FALT|FNOINVERT, _T("DVD Menu Up")));
+ ADDCMD((ID_NAVIGATE_MENU_DOWN, VK_DOWN, FVIRTKEY|FALT|FNOINVERT, _T("DVD Menu Down")));
+ ADDCMD((ID_NAVIGATE_MENU_ACTIVATE, VK_SPACE, FVIRTKEY|FALT|FNOINVERT, _T("DVD Menu Activate")));
+ ADDCMD((ID_NAVIGATE_MENU_BACK, 0, FVIRTKEY|FNOINVERT, _T("DVD Menu Back")));
+ ADDCMD((ID_NAVIGATE_MENU_LEAVE, 0, FVIRTKEY|FNOINVERT, _T("DVD Menu Leave")));
+ ADDCMD((ID_BOSS, 'B', FVIRTKEY|FNOINVERT, _T("Boss key")));
+ ADDCMD((ID_MENU_PLAYER_SHORT, 0, FVIRTKEY|FNOINVERT, _T("Player Menu (short)"), 0, wmcmd::RUP));
+ ADDCMD((ID_MENU_PLAYER_LONG, 0, FVIRTKEY|FNOINVERT, _T("Player Menu (long)")));
+ ADDCMD((ID_MENU_FILTERS, 0, FVIRTKEY|FNOINVERT, _T("Filters Menu")));
+ ADDCMD((ID_VIEW_OPTIONS, 'O', FVIRTKEY|FNOINVERT, _T("Options")));
+ ADDCMD((ID_STREAM_AUDIO_NEXT, 'A', FVIRTKEY|FNOINVERT, _T("Next Audio")));
+ ADDCMD((ID_STREAM_AUDIO_PREV, 'A', FVIRTKEY|FSHIFT|FNOINVERT, _T("Prev Audio")));
+ ADDCMD((ID_STREAM_SUB_NEXT, 'S', FVIRTKEY|FNOINVERT, _T("Next Subtitle")));
+ ADDCMD((ID_STREAM_SUB_PREV, 'S', FVIRTKEY|FSHIFT|FNOINVERT, _T("Prev Subtitle")));
+ ADDCMD((ID_STREAM_SUB_ONOFF, 'W', FVIRTKEY|FNOINVERT, _T("On/Off Subtitle")));
+ ADDCMD((ID_SUBTITLES_SUBITEM_START+2, 0, FVIRTKEY|FNOINVERT, _T("Reload Subtitles")));
+ ADDCMD((ID_OGM_AUDIO_NEXT, 0, FVIRTKEY|FNOINVERT, _T("Next Audio (OGM)")));
+ ADDCMD((ID_OGM_AUDIO_PREV, 0, FVIRTKEY|FNOINVERT, _T("Prev Audio (OGM)")));
+ ADDCMD((ID_OGM_SUB_NEXT, 0, FVIRTKEY|FNOINVERT, _T("Next Subtitle (OGM)")));
+ ADDCMD((ID_OGM_SUB_PREV, 0, FVIRTKEY|FNOINVERT, _T("Prev Subtitle (OGM)")));
+ ADDCMD((ID_DVD_ANGLE_NEXT, 0, FVIRTKEY|FNOINVERT, _T("Next Angle (DVD)")));
+ ADDCMD((ID_DVD_ANGLE_PREV, 0, FVIRTKEY|FNOINVERT, _T("Prev Angle (DVD)")));
+ ADDCMD((ID_DVD_AUDIO_NEXT, 0, FVIRTKEY|FNOINVERT, _T("Next Audio (DVD)")));
+ ADDCMD((ID_DVD_AUDIO_PREV, 0, FVIRTKEY|FNOINVERT, _T("Prev Audio (DVD)")));
+ ADDCMD((ID_DVD_SUB_NEXT, 0, FVIRTKEY|FNOINVERT, _T("Next Subtitle (DVD)")));
+ ADDCMD((ID_DVD_SUB_PREV, 0, FVIRTKEY|FNOINVERT, _T("Prev Subtitle (DVD)")));
+ ADDCMD((ID_DVD_SUB_ONOFF, 0, FVIRTKEY|FNOINVERT, _T("On/Off Subtitle (DVD)")));
+
+ // === CASIMIR666 : nouveau shortcuts
+ ADDCMD((ID_VIEW_TEARING_TEST, 'T', FVIRTKEY|FCONTROL|FNOINVERT, _T("Tearing Test")));
+ ADDCMD((ID_VIEW_REMAINING_TIME, 'I', FVIRTKEY|FCONTROL|FNOINVERT, _T("Remaining Time")));
+ ADDCMD((ID_SHADER_TOGGLE, 'P', FVIRTKEY|FCONTROL|FNOINVERT, _T("Toggle Pixel Shader")));
+
+ nCurrentDvdPosition = -1;
+ nCurrentFilePosition = -1;
+
+#undef ADDCMD
+}
+
+CMPlayerCApp::Settings::~Settings()
+{
+ if(hAccel)
+ DestroyAcceleratorTable(hAccel);
+}
+
+DVD_POSITION* CMPlayerCApp::Settings::CurrentDVDPosition()
+{
+ if (nCurrentDvdPosition != -1)
+ return &DvdPosition[nCurrentDvdPosition];
+ else
+ return NULL;
+}
+
+bool CMPlayerCApp::Settings::NewDvd(ULONGLONG llDVDGuid)
+{
+ int i;
+
+ // Recherche si la position du DVD est connue
+ for (i=0; i<MAX_DVD_POSITION; i++)
+ {
+ if (DvdPosition[i].llDVDGuid == llDVDGuid)
+ {
+ nCurrentDvdPosition = i;
+ return false;
+ }
+ }
+
+ // Si DVD inconnu, le mettre en premier
+ for (int i=MAX_DVD_POSITION-1; i>0; i--)
+ memcpy (&DvdPosition[i], &DvdPosition[i-1], sizeof(DVD_POSITION));
+ DvdPosition[0].llDVDGuid = llDVDGuid;
+ nCurrentDvdPosition = 0;
+ return true;
+}
+
+FILE_POSITION* CMPlayerCApp::Settings::CurrentFilePosition()
+{
+ if (nCurrentFilePosition != -1)
+ return &FilePosition[nCurrentFilePosition];
+ else
+ return NULL;
+}
+
+bool CMPlayerCApp::Settings::NewFile(LPCTSTR strFileName)
+{
+ int i;
+
+ // Recherche si la position du fichier est connue
+ for (i=0; i<MAX_FILE_POSITION; i++)
+ {
+ if (FilePosition[i].strFile == strFileName)
+ {
+ nCurrentFilePosition = i;
+ return false;
+ }
+ }
+
+ // Si fichier inconnu, le mettre en premier
+ for (int i=MAX_FILE_POSITION-1; i>0; i--)
+ {
+ FilePosition[i].strFile = FilePosition[i-1].strFile;
+ FilePosition[i].llPosition = FilePosition[i-1].llPosition;
+ }
+ FilePosition[0].strFile = strFileName;
+ FilePosition[0].llPosition = 0;
+ nCurrentFilePosition = 0;
+ return true;
+}
+
+
+void CMPlayerCApp::Settings::DeserializeHex (LPCTSTR strVal, BYTE* pBuffer, int nBufSize)
+{
+ long lRes;
+
+ for (int i=0; i<nBufSize; i++)
+ {
+ _stscanf (strVal+(i*2), _T("%02x"), &lRes);
+ pBuffer[i] = (BYTE)lRes;
+ }
+}
+
+CString CMPlayerCApp::Settings::SerializeHex (BYTE* pBuffer, int nBufSize)
+{
+ CString strTemp;
+ CString strResult;
+
+ for (int i=0; i<nBufSize; i++)
+ {
+ strTemp.Format (_T("%02x"), pBuffer[i]);
+ strResult += strTemp;
+ }
+
+ return strResult;
+}
+
+void CMPlayerCApp::Settings::UpdateData(bool fSave)
+{
+ CWinApp* pApp = AfxGetApp();
+ ASSERT(pApp);
+
+ UINT len;
+ BYTE* ptr = NULL;
+
+ if(fSave)
+ {
+ if(!fInitialized) return;
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_HIDECAPTIONMENU), fHideCaptionMenu);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_CONTROLSTATE), nCS);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DEFAULTVIDEOFRAME), iDefaultVideoSize);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_KEEPASPECTRATIO), fKeepAspectRatio);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COMPMONDESKARDIFF), fCompMonDeskARDiff);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VOLUME), nVolume);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_BALANCE), nBalance);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_MUTE), fMute);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOOPNUM), nLoops);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOOP), fLoopForever);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REWIND), fRewind);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ZOOM), iZoomLevel);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_MULTIINST), fAllowMultipleInst);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_TITLEBARTEXTSTYLE), iTitleBarTextStyle);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_TITLEBARTEXTTITLE), fTitleBarTextTitle);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ONTOP), iOnTop);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_TRAYICON), fTrayIcon);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOZOOM), fRememberZoomLevel);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FULLSCREENCTRLS), fShowBarsWhenFullScreen);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FULLSCREENCTRLSTIMEOUT), nShowBarsWhenFullScreenTimeOut);
+ pApp->WriteProfileBinary(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FULLSCREENRES), (BYTE*)&dmFullscreenRes, sizeof(dmFullscreenRes));
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_EXITFULLSCREENATTHEEND), fExitFullScreenAtTheEnd);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REMEMBERWINDOWPOS), fRememberWindowPos);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REMEMBERWINDOWSIZE), fRememberWindowSize);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SNAPTODESKTOPEDGES), fSnapToDesktopEdges);
+ pApp->WriteProfileBinary(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LASTWINDOWRECT), (BYTE*)&rcLastWindowPos, sizeof(rcLastWindowPos));
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LASTWINDOWTYPE), lastWindowType);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ASPECTRATIO_X), AspectRatio.cx);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ASPECTRATIO_Y), AspectRatio.cy);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_KEEPHISTORY), fKeepHistory);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DSVIDEORENDERERTYPE), iDSVideoRendererType);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_RMVIDEORENDERERTYPE), iRMVideoRendererType);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_QTVIDEORENDERERTYPE), iQTVideoRendererType);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_APSURACEFUSAGE), iAPSurfaceUsage);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMRSYNCFIX), fVMRSyncFix);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DX9_RESIZER), iDX9Resizer);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMR9MIXERMODE), fVMR9MixerMode);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMR9MIXERYUV), fVMR9MixerYUV);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIORENDERERTYPE), CString(AudioRendererDisplayName));
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOLOADAUDIO), fAutoloadAudio);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOLOADSUBTITLES), fAutoloadSubtitles);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEWORKERTHREADFOROPENING), fEnableWorkerThreadForOpening);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REPORTFAILEDPINS), fReportFailedPins);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DVDPATH), sDVDPath);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_USEDVDPATH), fUseDVDPath);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_MENULANG), idMenuLang);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIOLANG), idAudioLang);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SUBTITLESLANG), idSubtitlesLang);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOSPEAKERCONF), fAutoSpeakerConf);
+ CString style;
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPLOGFONT), style <<= subdefstyle);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPOVERRIDEPLACEMENT), fOverridePlacement);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPHORPOS), nHorPos);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPVERPOS), nVerPos);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPCSIZE), nSPCSize);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPCMAXRES), nSPCMaxRes);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_POW2TEX), fSPCPow2Tex);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLESUBTITLES), fEnableSubtitles);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEAUDIOSWITCHER), fEnableAudioSwitcher);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEAUDIOTIMESHIFT), fAudioTimeShift);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIOTIMESHIFT), tAudioTimeShift);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DOWNSAMPLETO441), fDownSampleTo441);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_CUSTOMCHANNELMAPPING), fCustomChannelMapping);
+ pApp->WriteProfileBinary(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPEAKERTOCHANNELMAPPING), (BYTE*)pSpeakerToChannelMap, sizeof(pSpeakerToChannelMap));
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIONORMALIZE), fAudioNormalize);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIONORMALIZERECOVER), fAudioNormalizeRecover);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIOBOOST), (int)AudioBoost);
+
+ // CASIMIR666 : nouveau settings
+ CString strTemp;
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_D3DFULLSCREEN), fD3DFullscreen);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_MONITOR_AUTOREFRESHRATE), fMonitorAutoRefreshRate);
+
+ strTemp.Format (_T("%f"), dBrightness);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_BRIGHTNESS), strTemp);
+ strTemp.Format (_T("%f"), dContrast);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_CONTRAST), strTemp);
+ strTemp.Format (_T("%f"), dHue);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_HUE), strTemp);
+ strTemp.Format (_T("%f"), dSaturation);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_SATURATION), strTemp);
+
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SHADERLIST), strShaderList);
+
+ // Position de lecture des derniers DVD's
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DVDPOS), (int)fRememberDVDPos);
+ for (int i=0; i<MAX_DVD_POSITION; i++)
+ {
+ CString strDVDPos;
+ CString strValue;
+
+ strDVDPos.Format (_T("DVD Position %d"), i);
+ strValue = SerializeHex((BYTE*)&DvdPosition[i], sizeof(DVD_POSITION));
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), strDVDPos, strValue);
+ }
+
+ // Position de lecture des derniers fichiers
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FILEPOS), (int)fRememberFilePos);
+ for (int i=0; i<MAX_FILE_POSITION; i++)
+ {
+ CString strFilePos;
+ CString strValue;
+
+ strFilePos.Format (_T("File Name %d"), i);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), strFilePos, FilePosition[i].strFile);
+ strFilePos.Format (_T("File Position %d"), i);
+ strValue.Format (_T("%I64d"), FilePosition[i].llPosition);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), strFilePos, strValue);
+ }
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LASTFULLSCREEN), (int)fLastFullScreen);
+ // CASIMIR666 : fin nouveaux settings
+
+ {
+ for(int i = 0; ; i++)
+ {
+ CString key;
+ key.Format(_T("%s\\%04d"), ResStr(IDS_R_FILTERS), i);
+ int j = pApp->GetProfileInt(key, _T("Enabled"), -1);
+ pApp->WriteProfileString(key, NULL, NULL);
+ if(j < 0) break;
+ }
+ pApp->WriteProfileString(ResStr(IDS_R_FILTERS), NULL, NULL);
+
+ POSITION pos = filters.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ FilterOverride* f = filters.GetNext(pos);
+
+ if(f->fTemporary)
+ continue;
+
+ CString key;
+ key.Format(_T("%s\\%04d"), ResStr(IDS_R_FILTERS), i);
+
+ pApp->WriteProfileInt(key, _T("SourceType"), (int)f->type);
+ pApp->WriteProfileInt(key, _T("Enabled"), (int)!f->fDisabled);
+ if(f->type == FilterOverride::REGISTERED)
+ {
+ pApp->WriteProfileString(key, _T("DisplayName"), CString(f->dispname));
+ pApp->WriteProfileString(key, _T("Name"), f->name);
+ }
+ else if(f->type == FilterOverride::EXTERNAL)
+ {
+ pApp->WriteProfileString(key, _T("Path"), f->path);
+ pApp->WriteProfileString(key, _T("Name"), f->name);
+ pApp->WriteProfileString(key, _T("CLSID"), CStringFromGUID(f->clsid));
+ }
+ POSITION pos2 = f->backup.GetHeadPosition();
+ for(int i = 0; pos2; i++)
+ {
+ CString val;
+ val.Format(_T("org%04d"), i);
+ pApp->WriteProfileString(key, val, CStringFromGUID(f->backup.GetNext(pos2)));
+ }
+ pos2 = f->guids.GetHeadPosition();
+ for(int i = 0; pos2; i++)
+ {
+ CString val;
+ val.Format(_T("mod%04d"), i);
+ pApp->WriteProfileString(key, val, CStringFromGUID(f->guids.GetNext(pos2)));
+ }
+ pApp->WriteProfileInt(key, _T("LoadType"), f->iLoadType);
+ pApp->WriteProfileInt(key, _T("Merit"), f->dwMerit);
+ }
+ }
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_INTREALMEDIA), fIntRealMedia);
+ // pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REALMEDIARENDERLESS), fRealMediaRenderless);
+ // pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_QUICKTIMERENDERER), iQuickTimeRenderer);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REALMEDIAFPS), *((DWORD*)&RealMediaQuickTimeFPS));
+
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS) + _T("\\") + ResStr(IDS_RS_PNSPRESETS), NULL, NULL);
+ for(int i = 0, j = m_pnspresets.GetCount(); i < j; i++)
+ {
+ CString str;
+ str.Format(_T("Preset%d"), i);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS) + _T("\\") + ResStr(IDS_RS_PNSPRESETS), str, m_pnspresets[i]);
+ }
+
+ pApp->WriteProfileString(ResStr(IDS_R_COMMANDS), NULL, NULL);
+ POSITION pos = wmcmds.GetHeadPosition();
+ for(int i = 0; pos; )
+ {
+ wmcmd& wc = wmcmds.GetNext(pos);
+ if(wc.IsModified())
+ {
+ CString str;
+ str.Format(_T("CommandMod%d"), i);
+ CString str2;
+ str2.Format(_T("%d %x %x %s %d %d %d"),
+ wc.cmd, wc.fVirt, wc.key,
+ _T("\"") + CString(wc.rmcmd) + _T("\""), wc.rmrepcnt,
+ wc.mouse, wc.appcmd);
+ pApp->WriteProfileString(ResStr(IDS_R_COMMANDS), str, str2);
+ i++;
+ }
+ }
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WINLIRC), fWinLirc);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WINLIRCADDR), WinLircAddr);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_UICE), fUIce);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_UICEADDR), UIceAddr);
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DISABLEXPTOOLBARS), fDisabeXPToolbars);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_USEWMASFREADER), fUseWMASFReader);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_JUMPDISTS), nJumpDistS);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_JUMPDISTM), nJumpDistM);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_JUMPDISTL), nJumpDistL);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FREEWINDOWRESIZING), fFreeWindowResizing);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_NOTIFYMSN), fNotifyMSN);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_NOTIFYGTSDLL), fNotifyGTSdll);
+
+ Formats.UpdateData(true);
+
+ pApp->WriteProfileInt(ResStr(IDS_R_INTERNAL_FILTERS), ResStr(IDS_RS_SRCFILTERS), SrcFilters|~(SRC_LAST-1));
+ pApp->WriteProfileInt(ResStr(IDS_R_INTERNAL_FILTERS), ResStr(IDS_RS_TRAFILTERS), TraFilters|~(TRA_LAST-1));
+
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOGOFILE), logofn);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOGOID), logoid);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOGOEXT), logoext);
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_HIDECDROMSSUBMENU), fHideCDROMsSubMenu);
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_PRIORITY), priority);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LAUNCHFULLSCREEN), launchfullscreen);
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEWEBSERVER), fEnableWebServer);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERPORT), nWebServerPort);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERPRINTDEBUGINFO), fWebServerPrintDebugInfo);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERUSECOMPRESSION), fWebServerUseCompression);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERLOCALHOSTONLY), fWebServerLocalhostOnly);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBROOT), WebRoot);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBDEFINDEX), WebDefIndex);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERCGI), WebServerCGI);
+
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SNAPSHOTPATH), SnapShotPath);
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SNAPSHOTEXT), SnapShotExt);
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_THUMBROWS), ThumbRows);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_THUMBCOLS), ThumbCols);
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_THUMBWIDTH), ThumbWidth);
+
+ pApp->WriteProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ISDB), ISDb);
+
+ pApp->WriteProfileString(_T("Shaders"), NULL, NULL);
+ pApp->WriteProfileInt(_T("Shaders"), _T("Initialized"), 1);
+ pApp->WriteProfileString(_T("Shaders"), _T("Combine"), m_shadercombine);
+
+ pos = m_shaders.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ const Shader& s = m_shaders.GetNext(pos);
+
+ if(!s.label.IsEmpty())
+ {
+ CString index;
+ index.Format(_T("%d"), i);
+ CString srcdata = s.srcdata;
+ srcdata.Replace(_T("\r"), _T(""));
+ srcdata.Replace(_T("\n"), _T("\\n"));
+ srcdata.Replace(_T("\t"), _T("\\t"));
+ AfxGetApp()->WriteProfileString(_T("Shaders"), index, s.label + _T("|") + s.target + _T("|") + srcdata);
+ }
+ }
+
+ if(pApp->m_pszRegistryKey)
+ {
+ // WINBUG: on win2k this would crash WritePrivateProfileString
+ pApp->WriteProfileInt(_T(""), _T(""), pApp->GetProfileInt(_T(""), _T(""), 0)?0:1);
+ }
+ }
+ else
+ {
+ if(fInitialized) return;
+
+ if(pApp->m_pszRegistryKey)
+ {
+ CRegKey appkey, settingskey;
+ appkey.Attach(pApp->GetAppRegistryKey());
+ settingskey.Attach(pApp->GetSectionKey(ResStr(IDS_R_INTERNAL_FILTERS)));
+ if(appkey && settingskey)
+ {
+ ULONGLONG ftapp = 0, ftsettings = 0;
+ RegQueryInfoKey(appkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (FILETIME*)&ftapp);
+ RegQueryInfoKey(settingskey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (FILETIME*)&ftsettings);
+ if(ftapp < ftsettings)
+ {
+ pApp->WriteProfileInt(ResStr(IDS_R_INTERNAL_FILTERS), ResStr(IDS_RS_SRCFILTERS), ~0);
+ pApp->WriteProfileInt(ResStr(IDS_R_INTERNAL_FILTERS), ResStr(IDS_RS_TRAFILTERS), ~0^TRA_MPEG1);
+ }
+ }
+ }
+
+ OSVERSIONINFO vi;
+ vi.dwOSVersionInfoSize = sizeof(vi);
+ GetVersionEx(&vi);
+ fXpOrBetter = (vi.dwMajorVersion >= 5 && vi.dwMinorVersion >= 1 || vi.dwMajorVersion >= 6);
+
+ iDXVer = 0;
+ CRegKey dxver;
+ if(ERROR_SUCCESS == dxver.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\DirectX"), KEY_READ))
+ {
+ CString str;
+ ULONG len = 64;
+ if(ERROR_SUCCESS == dxver.QueryStringValue(_T("Version"), str.GetBuffer(len), &len))
+ {
+ str.ReleaseBuffer(len);
+ int ver[4];
+ _stscanf(str, _T("%d.%d.%d.%d"), ver+0, ver+1, ver+2, ver+3);
+ iDXVer = ver[1];
+ }
+ }
+
+ fHideCaptionMenu = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_HIDECAPTIONMENU), 0);
+ nCS = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_CONTROLSTATE), CS_SEEKBAR|CS_TOOLBAR|CS_INFOBAR|CS_STATUSBAR);
+ iDefaultVideoSize = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DEFAULTVIDEOFRAME), DVS_FROMINSIDE);
+ fKeepAspectRatio = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_KEEPASPECTRATIO), TRUE);
+ fCompMonDeskARDiff = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COMPMONDESKARDIFF), FALSE);
+ nVolume = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VOLUME), 100);
+ nBalance = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_BALANCE), 0);
+ fMute = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_MUTE), 0);
+ nLoops = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOOPNUM), 1);
+ fLoopForever = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOOP), 1);
+ fRewind = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REWIND), TRUE);
+ iZoomLevel = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ZOOM), 1);
+ iDSVideoRendererType = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DSVIDEORENDERERTYPE), VIDRNDT_DS_DEFAULT);
+ iRMVideoRendererType = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_RMVIDEORENDERERTYPE), VIDRNDT_RM_DEFAULT);
+ iQTVideoRendererType = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_QTVIDEORENDERERTYPE), VIDRNDT_QT_DEFAULT);
+ iAPSurfaceUsage = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_APSURACEFUSAGE), VIDRNDT_AP_TEXTURE2D);
+ fVMRSyncFix = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMRSYNCFIX), FALSE);
+ iDX9Resizer = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DX9_RESIZER), 1);
+ fVMR9MixerMode = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMR9MIXERMODE), FALSE);
+ fVMR9MixerYUV = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_VMR9MIXERYUV), FALSE);
+ AudioRendererDisplayName = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIORENDERERTYPE), _T(""));
+ fAutoloadAudio = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOLOADAUDIO), TRUE);
+ fAutoloadSubtitles = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOLOADSUBTITLES), TRUE);
+ fEnableWorkerThreadForOpening = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEWORKERTHREADFOROPENING), TRUE);
+ fReportFailedPins = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REPORTFAILEDPINS), TRUE);
+ fAllowMultipleInst = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_MULTIINST), 0);
+ iTitleBarTextStyle = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_TITLEBARTEXTSTYLE), 1);
+ fTitleBarTextTitle = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_TITLEBARTEXTTITLE), FALSE);
+ iOnTop = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ONTOP), 0);
+ fTrayIcon = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_TRAYICON), 0);
+ fRememberZoomLevel = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOZOOM), 1);
+ fShowBarsWhenFullScreen = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FULLSCREENCTRLS), 1);
+ nShowBarsWhenFullScreenTimeOut = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FULLSCREENCTRLSTIMEOUT), 0);
+ if(pApp->GetProfileBinary(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FULLSCREENRES), &ptr, &len))
+ {
+ memcpy(&dmFullscreenRes, ptr, sizeof(dmFullscreenRes));
+ delete [] ptr;
+ }
+ else
+ {
+ dmFullscreenRes.fValid = false;
+ }
+ fExitFullScreenAtTheEnd = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_EXITFULLSCREENATTHEEND), 0);
+ fRememberWindowPos = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REMEMBERWINDOWPOS), 0);
+ fRememberWindowSize = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REMEMBERWINDOWSIZE), 0);
+ fSnapToDesktopEdges = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SNAPTODESKTOPEDGES), 0);
+ AspectRatio.cx = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ASPECTRATIO_X), 0);
+ AspectRatio.cy = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ASPECTRATIO_Y), 0);
+ fKeepHistory = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_KEEPHISTORY), 1);
+ if(pApp->GetProfileBinary(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LASTWINDOWRECT), &ptr, &len))
+ {
+ memcpy(&rcLastWindowPos, ptr, sizeof(rcLastWindowPos));
+ delete [] ptr;
+ }
+ else
+ {
+ fRememberWindowPos = false;
+ }
+ lastWindowType = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LASTWINDOWTYPE), SIZE_RESTORED);
+ sDVDPath = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DVDPATH), _T(""));
+ fUseDVDPath = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_USEDVDPATH), 0);
+ idMenuLang = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_MENULANG), ::GetUserDefaultLCID());
+ idAudioLang = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIOLANG), ::GetUserDefaultLCID());
+ idSubtitlesLang = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SUBTITLESLANG), ::GetUserDefaultLCID());
+ fAutoSpeakerConf = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUTOSPEAKERCONF), 1);
+ // TODO: rename subdefstyle -> defStyle, IDS_RS_SPLOGFONT -> IDS_RS_SPSTYLE
+ subdefstyle <<= pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPLOGFONT), _T(""));
+ fOverridePlacement = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPOVERRIDEPLACEMENT), 0);
+ nHorPos = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPHORPOS), 50);
+ nVerPos = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPVERPOS), 90);
+ nSPCSize = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPCSIZE), 3);
+ nSPCMaxRes = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPCMAXRES), 2);
+ fSPCPow2Tex = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_POW2TEX), TRUE);
+ fEnableSubtitles = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLESUBTITLES), TRUE);
+ fEnableAudioSwitcher = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEAUDIOSWITCHER), TRUE);
+ fAudioTimeShift = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEAUDIOTIMESHIFT), 0);
+ tAudioTimeShift = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIOTIMESHIFT), 0);
+ fDownSampleTo441 = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DOWNSAMPLETO441), 0);
+ fCustomChannelMapping = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_CUSTOMCHANNELMAPPING), 0);
+ if(pApp->GetProfileBinary(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SPEAKERTOCHANNELMAPPING), &ptr, &len))
+ {
+ memcpy(pSpeakerToChannelMap, ptr, sizeof(pSpeakerToChannelMap));
+ delete [] ptr;
+ }
+ else
+ {
+ memset(pSpeakerToChannelMap, 0, sizeof(pSpeakerToChannelMap));
+ for(int j = 0; j < 18; j++)
+ for(int i = 0; i <= j; i++)
+ pSpeakerToChannelMap[j][i] = 1<<i;
+
+ pSpeakerToChannelMap[0][0] = 1<<0;
+ pSpeakerToChannelMap[0][1] = 1<<0;
+
+ pSpeakerToChannelMap[3][0] = 1<<0;
+ pSpeakerToChannelMap[3][1] = 1<<1;
+ pSpeakerToChannelMap[3][2] = 0;
+ pSpeakerToChannelMap[3][3] = 0;
+ pSpeakerToChannelMap[3][4] = 1<<2;
+ pSpeakerToChannelMap[3][5] = 1<<3;
+
+ pSpeakerToChannelMap[4][0] = 1<<0;
+ pSpeakerToChannelMap[4][1] = 1<<1;
+ pSpeakerToChannelMap[4][2] = 1<<2;
+ pSpeakerToChannelMap[4][3] = 0;
+ pSpeakerToChannelMap[4][4] = 1<<3;
+ pSpeakerToChannelMap[4][5] = 1<<4;
+ }
+ fAudioNormalize = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIONORMALIZE), FALSE);
+ fAudioNormalizeRecover = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIONORMALIZERECOVER), TRUE);
+ AudioBoost = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_AUDIOBOOST), 1);
+
+ {
+ for(int i = 0; ; i++)
+ {
+ CString key;
+ key.Format(_T("%s\\%04d"), ResStr(IDS_R_FILTERS), i);
+
+ CAutoPtr<FilterOverride> f(new FilterOverride);
+
+ f->fDisabled = !pApp->GetProfileInt(key, _T("Enabled"), 0);
+
+ UINT j = pApp->GetProfileInt(key, _T("SourceType"), -1);
+ if(j == 0)
+ {
+ f->type = FilterOverride::REGISTERED;
+ f->dispname = CStringW(pApp->GetProfileString(key, _T("DisplayName"), _T("")));
+ f->name = pApp->GetProfileString(key, _T("Name"), _T(""));
+ }
+ else if(j == 1)
+ {
+ f->type = FilterOverride::EXTERNAL;
+ f->path = pApp->GetProfileString(key, _T("Path"), _T(""));
+ f->name = pApp->GetProfileString(key, _T("Name"), _T(""));
+ f->clsid = GUIDFromCString(pApp->GetProfileString(key, _T("CLSID"), _T("")));
+ }
+ else
+ {
+ pApp->WriteProfileString(key, NULL, 0);
+ break;
+ }
+
+ f->backup.RemoveAll();
+ for(int i = 0; ; i++)
+ {
+ CString val;
+ val.Format(_T("org%04d"), i);
+ CString guid = pApp->GetProfileString(key, val, _T(""));
+ if(guid.IsEmpty()) break;
+ f->backup.AddTail(GUIDFromCString(guid));
+ }
+
+ f->guids.RemoveAll();
+ for(int i = 0; ; i++)
+ {
+ CString val;
+ val.Format(_T("mod%04d"), i);
+ CString guid = pApp->GetProfileString(key, val, _T(""));
+ if(guid.IsEmpty()) break;
+ f->guids.AddTail(GUIDFromCString(guid));
+ }
+
+ f->iLoadType = (int)pApp->GetProfileInt(key, _T("LoadType"), -1);
+ if(f->iLoadType < 0) break;
+
+ f->dwMerit = pApp->GetProfileInt(key, _T("Merit"), MERIT_DO_NOT_USE+1);
+
+ filters.AddTail(f);
+ }
+ }
+
+ fIntRealMedia = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_INTREALMEDIA), 0);
+ //fRealMediaRenderless = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REALMEDIARENDERLESS), 0);
+ //iQuickTimeRenderer = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_QUICKTIMERENDERER), 2);
+ RealMediaQuickTimeFPS = 25.0;
+ *((DWORD*)&RealMediaQuickTimeFPS) = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_REALMEDIAFPS), *((DWORD*)&RealMediaQuickTimeFPS));
+
+ m_pnspresets.RemoveAll();
+ for(int i = 0; i < (ID_PANNSCAN_PRESETS_END - ID_PANNSCAN_PRESETS_START); i++)
+ {
+ CString str;
+ str.Format(_T("Preset%d"), i);
+ str = pApp->GetProfileString(ResStr(IDS_R_SETTINGS) + _T("\\") + ResStr(IDS_RS_PNSPRESETS), str, _T(""));
+ if(str.IsEmpty()) break;
+ m_pnspresets.Add(str);
+ }
+ if(m_pnspresets.IsEmpty())
+ {
+ double _4p3 = 4.0/3.0;
+ double _16p9 = 16.0/9.0;
+ double _185p1 = 1.85/1.0;
+ double _235p1 = 2.35/1.0;
+
+ CString str;
+ str.Format(_T("Scale to 16:9 TV,%.3f,%.3f,%.3f,%.3f"), 0.5, 0.5, _4p3/_4p3, _16p9/_4p3);
+ m_pnspresets.Add(str);
+ str.Format(_T("Zoom To Widescreen,%.3f,%.3f,%.3f,%.3f"), 0.5, 0.5, _16p9/_4p3, _16p9/_4p3);
+ m_pnspresets.Add(str);
+ str.Format(_T("Zoom To Ultra-Widescreen,%.3f,%.3f,%.3f,%.3f"), 0.5, 0.5, _235p1/_4p3, _235p1/_4p3);
+ m_pnspresets.Add(str);
+ }
+
+ for(int i = 0; i < wmcmds.GetCount(); i++)
+ {
+ CString str;
+ str.Format(_T("CommandMod%d"), i);
+ str = pApp->GetProfileString(ResStr(IDS_R_COMMANDS), str, _T(""));
+ if(str.IsEmpty()) break;
+ int cmd, fVirt, key, repcnt, mouse, appcmd;
+ TCHAR buff[128];
+ int n;
+ if(5 > (n = _stscanf(str, _T("%d %x %x %s %d %d %d"), &cmd, &fVirt, &key, buff, &repcnt, &mouse, &appcmd)))
+ break;
+ if(POSITION pos = wmcmds.Find(cmd))
+ {
+ wmcmd& wc = wmcmds.GetAt(pos);
+ wc.cmd = cmd;
+ wc.fVirt = fVirt;
+ wc.key = key;
+ if(n >= 6) wc.mouse = (UINT)mouse;
+ if(n >= 7) wc.appcmd = (UINT)appcmd;
+ wc.rmcmd = CStringA(buff).Trim('\"');
+ wc.rmrepcnt = repcnt;
+ }
+ }
+
+ CAtlArray<ACCEL> pAccel;
+ pAccel.SetCount(wmcmds.GetCount());
+ POSITION pos = wmcmds.GetHeadPosition();
+ for(int i = 0; pos; i++) pAccel[i] = wmcmds.GetNext(pos);
+ hAccel = CreateAcceleratorTable(pAccel.GetData(), pAccel.GetCount());
+
+ WinLircAddr = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WINLIRCADDR), _T("127.0.0.1:8765"));
+ fWinLirc = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WINLIRC), 0);
+ UIceAddr = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_UICEADDR), _T("127.0.0.1:1234"));
+ fUIce = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_UICE), 0);
+
+ fDisabeXPToolbars = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DISABLEXPTOOLBARS), 0);
+ fUseWMASFReader = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_USEWMASFREADER), TRUE);
+ nJumpDistS = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_JUMPDISTS), 1000);
+ nJumpDistM = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_JUMPDISTM), 5000);
+ nJumpDistL = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_JUMPDISTL), 20000);
+ fFreeWindowResizing = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FREEWINDOWRESIZING), TRUE);
+ fNotifyMSN = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_NOTIFYMSN), FALSE);
+ fNotifyGTSdll = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_NOTIFYGTSDLL), FALSE);
+
+ Formats.UpdateData(false);
+
+ SrcFilters = pApp->GetProfileInt(ResStr(IDS_R_INTERNAL_FILTERS), ResStr(IDS_RS_SRCFILTERS), ~0);
+ TraFilters = pApp->GetProfileInt(ResStr(IDS_R_INTERNAL_FILTERS), ResStr(IDS_RS_TRAFILTERS), ~0^TRA_MPEG1);
+
+ logofn = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOGOFILE), _T(""));
+ logoid = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOGOID), IDB_LOGO7);
+ logoext = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LOGOEXT), 0);
+
+ fHideCDROMsSubMenu = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_HIDECDROMSSUBMENU), 0);
+
+ priority = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_PRIORITY), NORMAL_PRIORITY_CLASS);
+ ::SetPriorityClass(::GetCurrentProcess(), priority);
+ launchfullscreen = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LAUNCHFULLSCREEN), FALSE);
+
+ fEnableWebServer = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ENABLEWEBSERVER), FALSE);
+ nWebServerPort = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERPORT), 13579);
+ fWebServerPrintDebugInfo = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERPRINTDEBUGINFO), FALSE);
+ fWebServerUseCompression = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERUSECOMPRESSION), TRUE);
+ fWebServerLocalhostOnly = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERLOCALHOSTONLY), TRUE);
+ WebRoot = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBROOT), _T("*./webroot"));
+ WebDefIndex = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBDEFINDEX), _T("index.html;index.php"));
+ WebServerCGI = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_WEBSERVERCGI), _T(""));
+
+ CString MyPictures;
+
+ CRegKey key;
+ // grrrrr
+ // if(!SHGetSpecialFolderPath(NULL, MyPictures.GetBufferSetLength(MAX_PATH), CSIDL_MYPICTURES, TRUE)) MyPictures.Empty();
+ // else MyPictures.ReleaseBuffer();
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"), KEY_READ))
+ {
+ ULONG len = MAX_PATH;
+ if(ERROR_SUCCESS == key.QueryStringValue(_T("My Pictures"), MyPictures.GetBuffer(MAX_PATH), &len)) MyPictures.ReleaseBufferSetLength(len);
+ else MyPictures.Empty();
+ }
+ SnapShotPath = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SNAPSHOTPATH), MyPictures);
+ SnapShotExt = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SNAPSHOTEXT), _T(".bmp"));
+
+ ThumbRows = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_THUMBROWS), 4);
+ ThumbCols = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_THUMBCOLS), 4);
+ ThumbWidth = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_THUMBWIDTH), 1024);
+
+ ISDb = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_ISDB), _T("isdb.go.dyndns.org"));
+
+ pApp->WriteProfileInt(ResStr(IDS_R_SETTINGS), _T("LastUsedPage"), 0);
+
+ //
+
+ m_shaders.RemoveAll();
+
+ CAtlStringMap<UINT> shaders;
+
+ shaders[_T("contour")] = IDF_SHADER_CONTOUR;
+ shaders[_T("deinterlace (blend)")] = IDF_SHADER_DEINTERLACE;
+ shaders[_T("emboss")] = IDF_SHADER_EMBOSS;
+ shaders[_T("grayscale")] = IDF_SHADER_GRAYSCALE;
+ shaders[_T("invert")] = IDF_SHADER_INVERT;
+ shaders[_T("letterbox")] = IDF_SHADER_LETTERBOX;
+ shaders[_T("procamp")] = IDF_SHADER_PROCAMP;
+ shaders[_T("sharpen")] = IDF_SHADER_SHARPEN;
+ shaders[_T("sphere")] = IDF_SHADER_SPHERE;
+ shaders[_T("spotlight")] = IDF_SHADER_SPOTLIGHT;
+ shaders[_T("wave")] = IDF_SHADER_WAVE;
+ shaders[_T("Edge Sharpen (jim.ro)")] = IDF_SHADER_EDGE_SHARPEN;
+ shaders[_T("Sharpen complex (jim.ro)")] = IDF_SHADER_SHARPEN_COMPLEX;
+
+ int iShader = 0;
+
+ for(; ; iShader++)
+ {
+ CString str;
+ str.Format(_T("%d"), iShader);
+ str = pApp->GetProfileString(_T("Shaders"), str);
+
+ CAtlList<CString> sl;
+ CString label = Explode(str, sl, '|');
+ if(label.IsEmpty()) break;
+ if(sl.GetCount() < 3) continue;
+
+ Shader s;
+ s.label = sl.RemoveHead();
+ s.target = sl.RemoveHead();
+ s.srcdata = sl.RemoveHead();
+ s.srcdata.Replace(_T("\\n"), _T("\n"));
+ s.srcdata.Replace(_T("\\t"), _T("\t"));
+ m_shaders.AddTail(s);
+
+ shaders.RemoveKey(s.label);
+ }
+
+ pos = shaders.GetStartPosition();
+ for(; pos; iShader++)
+ {
+ CAtlStringMap<UINT>::CPair* pPair = shaders.GetNext(pos);
+
+ CStringA srcdata;
+ if(LoadResource(pPair->m_value, srcdata, _T("FILE")))
+ {
+ Shader s;
+ s.label = pPair->m_key;
+ s.target = _T("ps_2_0");
+ s.srcdata = CString(srcdata);
+ m_shaders.AddTail(s);
+ }
+ }
+
+ // CASIMIR666 : nouveaux settings
+ fD3DFullscreen = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_D3DFULLSCREEN), FALSE);
+ fMonitorAutoRefreshRate = !!pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_MONITOR_AUTOREFRESHRATE), FALSE);
+
+ dBrightness = _tstof(pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_BRIGHTNESS), _T("1")));
+ dContrast = _tstof(pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_CONTRAST), _T("1")));
+ dHue = _tstof(pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_HUE), _T("0")));
+ dSaturation = _tstof(pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_COLOR_SATURATION), _T("1")));
+ strShaderList = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_SHADERLIST), _T(""));
+
+ // Position de lecture des derniers DVD's
+ fRememberDVDPos = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_DVDPOS), 0);
+ nCurrentDvdPosition = -1;
+ memset (DvdPosition, 0, sizeof(DvdPosition));
+ for (int i=0; i<MAX_DVD_POSITION; i++)
+ {
+ CString strDVDPos;
+ CString strValue;
+
+ strDVDPos.Format (_T("DVD Position %d"), i);
+ strValue = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), strDVDPos, _T(""));
+ if (strValue.GetLength()/2 == sizeof(DVD_POSITION))
+ {
+ DeserializeHex(strValue, (BYTE*)&DvdPosition[i], sizeof(DVD_POSITION));
+ }
+ }
+
+ // Position de lecture des derniers fichiers
+ fRememberFilePos = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_FILEPOS), 0);
+ nCurrentFilePosition = -1;
+ for (int i=0; i<MAX_FILE_POSITION; i++)
+ {
+ CString strFilePos;
+ CString strValue;
+
+ strFilePos.Format (_T("File Name %d"), i);
+ FilePosition[i].strFile = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), strFilePos, _T(""));
+
+ strFilePos.Format (_T("File Position %d"), i);
+ strValue = pApp->GetProfileString(ResStr(IDS_R_SETTINGS), strFilePos, _T(""));
+ FilePosition[i].llPosition = _tstoi64 (strValue);
+ }
+
+ fLastFullScreen = pApp->GetProfileInt(ResStr(IDS_R_SETTINGS), ResStr(IDS_RS_LASTFULLSCREEN), 0);
+
+ // CASIMIR666 : fin nouveaux settings
+
+
+ // TODO: sort shaders by label
+
+ m_shadercombine = pApp->GetProfileString(_T("Shaders"), _T("Combine"), _T(""));
+
+ fInitialized = true;
+ }
+}
+
+void CMPlayerCApp::Settings::ParseCommandLine(CAtlList<CString>& cmdln)
+{
+ nCLSwitches = 0;
+ slFiles.RemoveAll();
+ slDubs.RemoveAll();
+ slSubs.RemoveAll();
+ slFilters.RemoveAll();
+ rtStart = 0;
+ fixedWindowSize.SetSize(0, 0);
+ iMonitor = 0;
+
+ if(launchfullscreen) nCLSwitches |= CLSW_FULLSCREEN;
+
+ POSITION pos = cmdln.GetHeadPosition();
+ while(pos)
+ {
+ CString param = cmdln.GetNext(pos);
+ if(param.IsEmpty()) continue;
+
+ if((param[0] == '-' || param[0] == '/') && param.GetLength() > 1)
+ {
+ CString sw = param.Mid(1).MakeLower();
+ if(sw == _T("open")) nCLSwitches |= CLSW_OPEN;
+ else if(sw == _T("play")) nCLSwitches |= CLSW_PLAY;
+ else if(sw == _T("fullscreen")) nCLSwitches |= CLSW_FULLSCREEN;
+ else if(sw == _T("minimized")) nCLSwitches |= CLSW_MINIMIZED;
+ else if(sw == _T("new")) nCLSwitches |= CLSW_NEW;
+ else if(sw == _T("help") || sw == _T("h") || sw == _T("?")) nCLSwitches |= CLSW_HELP;
+ else if(sw == _T("dub") && pos) slDubs.AddTail(cmdln.GetNext(pos));
+ else if(sw == _T("sub") && pos) slSubs.AddTail(cmdln.GetNext(pos));
+ else if(sw == _T("filter") && pos) slFilters.AddTail(cmdln.GetNext(pos));
+ else if(sw == _T("dvd")) nCLSwitches |= CLSW_DVD;
+ else if(sw == _T("cd")) nCLSwitches |= CLSW_CD;
+ else if(sw == _T("add")) nCLSwitches |= CLSW_ADD;
+ else if(sw == _T("regvid")) nCLSwitches |= CLSW_REGEXTVID;
+ else if(sw == _T("regaud")) nCLSwitches |= CLSW_REGEXTAUD;
+ else if(sw == _T("unregvid")) nCLSwitches |= CLSW_UNREGEXTVID;
+ else if(sw == _T("unregaud")) nCLSwitches |= CLSW_UNREGEXTAUD;
+ else if(sw == _T("start") && pos) {rtStart = 10000i64*_tcstol(cmdln.GetNext(pos), NULL, 10); nCLSwitches |= CLSW_STARTVALID;}
+ else if(sw == _T("startpos") && pos) {/* TODO: mm:ss. */;}
+ else if(sw == _T("nofocus")) nCLSwitches |= CLSW_NOFOCUS;
+ else if(sw == _T("close")) nCLSwitches |= CLSW_CLOSE;
+ else if(sw == _T("standby")) nCLSwitches |= CLSW_STANDBY;
+ else if(sw == _T("hibernate")) nCLSwitches |= CLSW_HIBERNATE;
+ else if(sw == _T("shutdown")) nCLSwitches |= CLSW_SHUTDOWN;
+ else if(sw == _T("logoff")) nCLSwitches |= CLSW_LOGOFF;
+ else if(sw == _T("fixedsize") && pos)
+ {
+ CAtlList<CString> sl;
+ Explode(cmdln.GetNext(pos), sl, ',', 2);
+ if(sl.GetCount() == 2)
+ {
+ fixedWindowSize.SetSize(_ttol(sl.GetHead()), _ttol(sl.GetTail()));
+ if(fixedWindowSize.cx > 0 && fixedWindowSize.cy > 0)
+ nCLSwitches |= CLSW_FIXEDSIZE;
+ }
+ }
+ else if(sw == _T("monitor") && pos) {iMonitor = _tcstol(cmdln.GetNext(pos), NULL, 10); nCLSwitches |= CLSW_MONITOR;}
+ else nCLSwitches |= CLSW_HELP|CLSW_UNRECOGNIZEDSWITCH;
+ }
+ else
+ {
+ slFiles.AddTail(param);
+ }
+ }
+}
+
+void CMPlayerCApp::Settings::GetFav(favtype ft, CAtlList<CString>& sl)
+{
+ sl.RemoveAll();
+
+ CString root;
+
+ switch(ft)
+ {
+ case FAV_FILE: root = ResStr(IDS_R_FAVFILES); break;
+ case FAV_DVD: root = ResStr(IDS_R_FAVDVDS); break;
+ case FAV_DEVICE: root = ResStr(IDS_R_FAVDEVICES); break;
+ default: return;
+ }
+
+ for(int i = 0; ; i++)
+ {
+ CString s;
+ s.Format(_T("Name%d"), i);
+ s = AfxGetApp()->GetProfileString(root, s, NULL);
+ if(s.IsEmpty()) break;
+ sl.AddTail(s);
+ }
+}
+
+void CMPlayerCApp::Settings::SetFav(favtype ft, CAtlList<CString>& sl)
+{
+ CString root;
+
+ switch(ft)
+ {
+ case FAV_FILE: root = ResStr(IDS_R_FAVFILES); break;
+ case FAV_DVD: root = ResStr(IDS_R_FAVDVDS); break;
+ case FAV_DEVICE: root = ResStr(IDS_R_FAVDEVICES); break;
+ default: return;
+ }
+
+ AfxGetApp()->WriteProfileString(root, NULL, NULL);
+
+ int i = 0;
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ CString s;
+ s.Format(_T("Name%d"), i++);
+ AfxGetApp()->WriteProfileString(root, s, sl.GetNext(pos));
+ }
+}
+
+void CMPlayerCApp::Settings::AddFav(favtype ft, CString s)
+{
+ CAtlList<CString> sl;
+ GetFav(ft, sl);
+ if(sl.Find(s)) return;
+ sl.AddTail(s);
+ SetFav(ft, sl);
+}
+
+// CMPlayerCApp::Settings::CRecentFileAndURLList
+
+CMPlayerCApp::Settings::CRecentFileAndURLList::CRecentFileAndURLList(UINT nStart, LPCTSTR lpszSection,
+ LPCTSTR lpszEntryFormat, int nSize,
+ int nMaxDispLen)
+ : CRecentFileList(nStart, lpszSection, lpszEntryFormat, nSize, nMaxDispLen)
+{
+}
+
+//#include <afximpl.h>
+extern BOOL AFXAPI AfxFullPath(LPTSTR lpszPathOut, LPCTSTR lpszFileIn);
+extern BOOL AFXAPI AfxComparePath(LPCTSTR lpszPath1, LPCTSTR lpszPath2);
+
+void CMPlayerCApp::Settings::CRecentFileAndURLList::Add(LPCTSTR lpszPathName)
+{
+ ASSERT(m_arrNames != NULL);
+ ASSERT(lpszPathName != NULL);
+ ASSERT(AfxIsValidString(lpszPathName));
+
+ if(CString(lpszPathName).MakeLower().Find(_T("@device:")) >= 0)
+ return;
+
+ bool fURL = (CString(lpszPathName).Find(_T("://")) >= 0);
+
+ // fully qualify the path name
+ TCHAR szTemp[1024];
+ if(fURL) _tcscpy(szTemp, lpszPathName);
+ else AfxFullPath(szTemp, lpszPathName);
+
+ // update the MRU list, if an existing MRU string matches file name
+ int iMRU;
+ for (iMRU = 0; iMRU < m_nSize-1; iMRU++)
+ {
+ if((fURL && !_tcscmp(m_arrNames[iMRU], szTemp))
+ || AfxComparePath(m_arrNames[iMRU], szTemp))
+ break; // iMRU will point to matching entry
+ }
+ // move MRU strings before this one down
+ for (; iMRU > 0; iMRU--)
+ {
+ ASSERT(iMRU > 0);
+ ASSERT(iMRU < m_nSize);
+ m_arrNames[iMRU] = m_arrNames[iMRU-1];
+ }
+ // place this one at the beginning
+ m_arrNames[0] = szTemp;
+}
+
+
+void CMPlayerCApp::OnHelpShowcommandlineswitches()
+{
+ ShowCmdlnSwitches();
+}
+
+//
+
+void GetCurDispMode(dispmode& dm)
+{
+ if(HDC hDC = ::GetDC(0))
+ {
+ dm.fValid = true;
+ dm.size = CSize(GetDeviceCaps(hDC, HORZRES), GetDeviceCaps(hDC, VERTRES));
+ dm.bpp = GetDeviceCaps(hDC, BITSPIXEL);
+ dm.freq = GetDeviceCaps(hDC, VREFRESH);
+ ::ReleaseDC(0, hDC);
+ }
+}
+
+bool GetDispMode(int i, dispmode& dm)
+{
+ DEVMODE devmode;
+ devmode.dmSize = sizeof(DEVMODE);
+ if(!EnumDisplaySettings(0, i, &devmode))
+ return(false);
+
+ dm.fValid = true;
+ dm.size = CSize(devmode.dmPelsWidth, devmode.dmPelsHeight);
+ dm.bpp = devmode.dmBitsPerPel;
+ dm.freq = devmode.dmDisplayFrequency;
+
+ return(true);
+}
+
+void SetDispMode(dispmode& dm)
+{
+ if(!dm.fValid) return;
+
+ DEVMODE dmScreenSettings;
+ memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
+ dmScreenSettings.dmSize = sizeof(dmScreenSettings);
+ dmScreenSettings.dmPelsWidth = dm.size.cx;
+ dmScreenSettings.dmPelsHeight = dm.size.cy;
+ dmScreenSettings.dmBitsPerPel = dm.bpp;
+ dmScreenSettings.dmDisplayFrequency = dm.freq;
+ dmScreenSettings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL | DM_DISPLAYFREQUENCY;
+ ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
+}
+
+#include <afxsock.h>
+#include <atlsync.h>
+#include <atlutil.h> // put this before the first detours macro above to see an ICE with vc71 :)
+#include <atlrx.h>
+
+typedef CAtlRegExp<CAtlRECharTraits> CAtlRegExpT;
+typedef CAtlREMatchContext<CAtlRECharTraits> CAtlREMatchContextT;
+
+bool FindRedir(CUrl& src, CString ct, CString& body, CAtlList<CString>& urls, CAutoPtrList<CAtlRegExpT>& res)
+{
+ POSITION pos = res.GetHeadPosition();
+ while(pos)
+ {
+ CAtlRegExpT* re = res.GetNext(pos);
+
+ CAtlREMatchContextT mc;
+ const CAtlREMatchContextT::RECHAR* s = (LPCTSTR)body;
+ const CAtlREMatchContextT::RECHAR* e = NULL;
+ for(; s && re->Match(s, &mc, &e); s = e)
+ {
+ const CAtlREMatchContextT::RECHAR* szStart = 0;
+ const CAtlREMatchContextT::RECHAR* szEnd = 0;
+ mc.GetMatch(0, &szStart, &szEnd);
+
+ CString url;
+ url.Format(_T("%.*s"), szEnd - szStart, szStart);
+ url.Trim();
+
+ if(url.CompareNoCase(_T("asf path")) == 0) continue;
+
+ CUrl dst;
+ dst.CrackUrl(CString(url));
+ if(_tcsicmp(src.GetSchemeName(), dst.GetSchemeName())
+ || _tcsicmp(src.GetHostName(), dst.GetHostName())
+ || _tcsicmp(src.GetUrlPath(), dst.GetUrlPath()))
+ {
+ urls.AddTail(url);
+ }
+ else
+ {
+ // recursive
+ urls.RemoveAll();
+ break;
+ }
+ }
+ }
+
+ return urls.GetCount() > 0;
+}
+
+bool FindRedir(CString& fn, CString ct, CAtlList<CString>& fns, CAutoPtrList<CAtlRegExpT>& res)
+{
+ CString body;
+
+ CTextFile f(CTextFile::ANSI);
+ if(f.Open(fn)) for(CString tmp; f.ReadString(tmp); body += tmp + '\n');
+
+ CString dir = fn.Left(max(fn.ReverseFind('/'), fn.ReverseFind('\\'))+1); // "ReverseFindOneOf"
+
+ POSITION pos = res.GetHeadPosition();
+ while(pos)
+ {
+ CAtlRegExpT* re = res.GetNext(pos);
+
+ CAtlREMatchContextT mc;
+ const CAtlREMatchContextT::RECHAR* s = (LPCTSTR)body;
+ const CAtlREMatchContextT::RECHAR* e = NULL;
+ for(; s && re->Match(s, &mc, &e); s = e)
+ {
+ const CAtlREMatchContextT::RECHAR* szStart = 0;
+ const CAtlREMatchContextT::RECHAR* szEnd = 0;
+ mc.GetMatch(0, &szStart, &szEnd);
+
+ CString fn2;
+ fn2.Format(_T("%.*s"), szEnd - szStart, szStart);
+ fn2.Trim();
+
+ if(!fn2.CompareNoCase(_T("asf path"))) continue;
+ if(fn2.Find(_T("EXTM3U")) == 0 || fn2.Find(_T("#EXTINF")) == 0) continue;
+
+ if(fn2.Find(_T(":")) < 0 && fn2.Find(_T("\\\\")) != 0 && fn2.Find(_T("//")) != 0)
+ {
+ CPath p;
+ p.Combine(dir, fn2);
+ fn2 = (LPCTSTR)p;
+ }
+
+ if(!fn2.CompareNoCase(fn))
+ continue;
+
+ fns.AddTail(fn2);
+ }
+ }
+
+ return fns.GetCount() > 0;
+}
+
+CString GetContentType(CString fn, CAtlList<CString>* redir)
+{
+ CUrl url;
+ CString ct, body;
+
+ if(fn.Find(_T("://")) >= 0)
+ {
+ url.CrackUrl(fn);
+
+ if(_tcsicmp(url.GetSchemeName(), _T("pnm")) == 0)
+ return "audio/x-pn-realaudio";
+
+ if(_tcsicmp(url.GetSchemeName(), _T("mms")) == 0)
+ return "video/x-ms-asf";
+
+ if(_tcsicmp(url.GetSchemeName(), _T("http")) != 0)
+ return "";
+
+ DWORD ProxyEnable = 0;
+ CString ProxyServer;
+ DWORD ProxyPort = 0;
+
+ ULONG len = 256+1;
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryDWORDValue(_T("ProxyEnable"), ProxyEnable) && ProxyEnable
+ && ERROR_SUCCESS == key.QueryStringValue(_T("ProxyServer"), ProxyServer.GetBufferSetLength(256), &len))
+ {
+ ProxyServer.ReleaseBufferSetLength(len);
+
+ CAtlList<CString> sl;
+ ProxyServer = Explode(ProxyServer, sl, ';');
+ if(sl.GetCount() > 1)
+ {
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ CAtlList<CString> sl2;
+ if(!Explode(sl.GetNext(pos), sl2, '=', 2).CompareNoCase(_T("http"))
+ && sl2.GetCount() == 2)
+ {
+ ProxyServer = sl2.GetTail();
+ break;
+ }
+ }
+ }
+
+ ProxyServer = Explode(ProxyServer, sl, ':');
+ if(sl.GetCount() > 1) ProxyPort = _tcstol(sl.GetTail(), NULL, 10);
+ }
+
+ CSocket s;
+ s.Create();
+ if(s.Connect(
+ ProxyEnable ? ProxyServer : url.GetHostName(),
+ ProxyEnable ? ProxyPort : url.GetPortNumber()))
+ {
+ CStringA host = CStringA(url.GetHostName());
+ CStringA path = CStringA(url.GetUrlPath()) + CStringA(url.GetExtraInfo());
+
+ if(ProxyEnable) path = "http://" + host + path;
+
+ CStringA hdr;
+ hdr.Format(
+ "GET %s HTTP/1.0\r\n"
+ "User-Agent: Media Player Classic\r\n"
+ "Host: %s\r\n"
+ "Accept: */*\r\n"
+ "\r\n", path, host);
+
+// MessageBox(NULL, CString(hdr), _T("Sending..."), MB_OK);
+
+ if(s.Send((LPCSTR)hdr, hdr.GetLength()) < hdr.GetLength()) return "";
+
+ hdr.Empty();
+ while(1)
+ {
+ CStringA str;
+ str.ReleaseBuffer(s.Receive(str.GetBuffer(256), 256)); // SOCKET_ERROR == -1, also suitable for ReleaseBuffer
+ if(str.IsEmpty()) break;
+ hdr += str;
+ int hdrend = hdr.Find("\r\n\r\n");
+ if(hdrend >= 0) {body = hdr.Mid(hdrend+4); hdr = hdr.Left(hdrend); break;}
+ }
+
+// MessageBox(NULL, CString(hdr), _T("Received..."), MB_OK);
+
+ CAtlList<CStringA> sl;
+ Explode(hdr, sl, '\n');
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ CStringA& hdrline = sl.GetNext(pos);
+ CAtlList<CStringA> sl2;
+ Explode(hdrline, sl2, ':', 2);
+ CStringA field = sl2.RemoveHead().MakeLower();
+ if(field == "location" && !sl2.IsEmpty())
+ return GetContentType(CString(sl2.GetHead()), redir);
+ if(field == "content-type" && !sl2.IsEmpty())
+ ct = sl2.GetHead();
+ }
+
+ while(body.GetLength() < 256)
+ {
+ CStringA str;
+ str.ReleaseBuffer(s.Receive(str.GetBuffer(256), 256)); // SOCKET_ERROR == -1, also suitable for ReleaseBuffer
+ if(str.IsEmpty()) break;
+ body += str;
+ }
+
+ if(body.GetLength() >= 8)
+ {
+ CStringA str = TToA(body);
+ if(!strncmp((LPCSTR)str, ".ra", 3))
+ return "audio/x-pn-realaudio";
+ if(!strncmp((LPCSTR)str, ".RMF", 4))
+ return "audio/x-pn-realaudio";
+ if(*(DWORD*)(LPCSTR)str == 0x75b22630)
+ return "video/x-ms-wmv";
+ if(!strncmp((LPCSTR)str+4, "moov", 4))
+ return "video/quicktime";
+ }
+
+ if(redir && (ct == _T("audio/x-scpls") || ct == _T("audio/x-mpegurl")))
+ {
+ while(body.GetLength() < 4*1024) // should be enough for a playlist...
+ {
+ CStringA str;
+ str.ReleaseBuffer(s.Receive(str.GetBuffer(256), 256)); // SOCKET_ERROR == -1, also suitable for ReleaseBuffer
+ if(str.IsEmpty()) break;
+ body += str;
+ }
+ }
+ }
+ }
+ else if(!fn.IsEmpty())
+ {
+ CPath p(fn);
+ CString ext = p.GetExtension().MakeLower();
+ if(ext == _T(".asx")) ct = _T("video/x-ms-asf");
+ else if(ext == _T(".pls")) ct = _T("audio/x-scpls");
+ else if(ext == _T(".m3u")) ct = _T("audio/x-mpegurl");
+ else if(ext == _T(".qtl")) ct = _T("application/x-quicktimeplayer");
+ else if(ext == _T(".mpcpl")) ct = _T("application/x-mpc-playlist");
+
+ if(FILE* f = _tfopen(fn, _T("rb")))
+ {
+ CStringA str;
+ str.ReleaseBufferSetLength(fread(str.GetBuffer(10240), 1, 10240, f));
+ body = AToT(str);
+ fclose(f);
+ }
+ }
+
+ if(body.GetLength() >= 4) // here only those which cannot be opened through dshow
+ {
+ CStringA str = TToA(body);
+ if(!strncmp((LPCSTR)str, ".ra", 3))
+ return "audio/x-pn-realaudio";
+ if(!strncmp((LPCSTR)str, "FWS", 3))
+ return "application/x-shockwave-flash";
+
+ }
+
+ if(redir && !ct.IsEmpty())
+ {
+ CAutoPtrList<CAtlRegExpT> res;
+ CAutoPtr<CAtlRegExpT> re;
+
+ if(ct == _T("video/x-ms-asf"))
+ {
+ // ...://..."/>
+ re.Attach(new CAtlRegExpT());
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("{[a-zA-Z]+://[^\n\">]*}"), FALSE))
+ res.AddTail(re);
+ // Ref#n= ...://...\n
+ re.Attach(new CAtlRegExpT());
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("Ref\\z\\b*=\\b*[\"]*{([a-zA-Z]+://[^\n\"]+}"), FALSE))
+ res.AddTail(re);
+ }
+ else if(ct == _T("audio/x-scpls"))
+ {
+ // File1=...\n
+ re.Attach(new CAtlRegExp<>());
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("file\\z\\b*=\\b*[\"]*{[^\n\"]+}"), FALSE))
+ res.AddTail(re);
+ }
+ else if(ct == _T("audio/x-mpegurl"))
+ {
+ // #comment
+ // ...
+ re.Attach(new CAtlRegExp<>());
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("{[^#][^\n]+}"), FALSE))
+ res.AddTail(re);
+ }
+ else if(ct == _T("audio/x-pn-realaudio"))
+ {
+ // rtsp://...
+ re.Attach(new CAtlRegExp<>());
+ if(re && REPARSE_ERROR_OK == re->Parse(_T("{rtsp://[^\n]+}"), FALSE))
+ res.AddTail(re);
+ }
+
+ if(!body.IsEmpty())
+ {
+ if(fn.Find(_T("://")) >= 0) FindRedir(url, ct, body, *redir, res);
+ else FindRedir(fn, ct, *redir, res);
+ }
+ }
+
+ return ct;
+}
+
+
+LONGLONG CMPlayerCApp::GetPerfCounter()
+{
+ LONGLONG i64TicksMicroSeconde;
+ if (m_PerfFrequency != 0)
+ {
+ QueryPerformanceCounter ((LARGE_INTEGER*)&i64TicksMicroSeconde);
+ i64TicksMicroSeconde = i64TicksMicroSeconde * 1000000;
+ i64TicksMicroSeconde = i64TicksMicroSeconde / m_PerfFrequency;
+
+ return i64TicksMicroSeconde;
+ }
+ return 0;
+}
+
+COLORPROPERTY_RANGE* CMPlayerCApp::GetColorControl(ControlType nFlag)
+{
+ switch (nFlag)
+ {
+ case Brightness :
+ return &m_ColorControl[0];
+ case Contrast :
+ return &m_ColorControl[1];
+ case Hue :
+ return &m_ColorControl[2];
+ case Saturation :
+ return &m_ColorControl[3];
+ }
+ return NULL;
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/mplayerc.h b/src/apps/mplayerc/mplayerc.h
new file mode 100644
index 000000000..792fcc150
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.h
@@ -0,0 +1,580 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+#include <afxadv.h>
+#include <atlsync.h>
+#include "..\..\subtitles\STS.h"
+#include "MediaFormats.h"
+#include "fakefiltermapper2.h"
+
+#ifdef UNICODE
+#define MPC_WND_CLASS_NAME L"MediaPlayerClassicW"
+#else
+#define MPC_WND_CLASS_NAME "MediaPlayerClassicA"
+#endif
+
+enum
+{
+ WM_GRAPHNOTIFY = WM_APP+1,
+ WM_REARRANGERENDERLESS,
+ WM_RESUMEFROMSTATE
+};
+
+#define WM_MYMOUSELAST WM_XBUTTONDBLCLK
+
+///////////////
+
+extern void CorrectComboListWidth(CComboBox& box, CFont* pWndFont);
+extern HICON LoadIcon(CString fn, bool fSmall);
+extern bool LoadType(CString fn, CString& type);
+extern bool LoadResource(UINT resid, CStringA& str, LPCTSTR restype);
+extern CString GetContentType(CString fn, CAtlList<CString>* redir = NULL);
+
+/////////////////////////////////////////////////////////////////////////////
+// Casimir666
+//
+typedef enum
+{
+ Brightness = 0x1,
+ Contrast = 0x2,
+ Hue = 0x4,
+ Saturation = 0x8,
+} ControlType;
+
+typedef struct // _VMR9ProcAmpControlRange
+ {
+ DWORD dwSize;
+ DWORD dwProperty;
+ float MinValue;
+ float MaxValue;
+ float DefaultValue;
+ float StepSize;
+} COLORPROPERTY_RANGE;
+
+#define MAX_DVD_POSITION 5
+typedef struct
+{
+ ULONGLONG llDVDGuid;
+ ULONG lTitle;
+ DVD_HMSF_TIMECODE Timecode;
+} DVD_POSITION;
+
+#define MAX_FILE_POSITION 5
+typedef struct
+{
+ CString strFile;
+ LONGLONG llPosition;
+} FILE_POSITION;
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CMPlayerCApp:
+// See mplayerc.cpp for the implementation of this class
+//
+
+// flags for AppSettings::nCS
+enum
+{
+ CS_NONE=0,
+ CS_SEEKBAR=1,
+ CS_TOOLBAR=CS_SEEKBAR<<1,
+ CS_INFOBAR=CS_TOOLBAR<<1,
+ CS_STATSBAR=CS_INFOBAR<<1,
+ CS_STATUSBAR=CS_STATSBAR<<1,
+ CS_LAST=CS_STATUSBAR
+};
+
+enum
+{
+ CLSW_NONE=0,
+ CLSW_OPEN=1,
+ CLSW_PLAY=CLSW_OPEN<<1,
+ CLSW_CLOSE=CLSW_PLAY<<1,
+ CLSW_STANDBY=CLSW_CLOSE<<1,
+ CLSW_HIBERNATE=CLSW_STANDBY<<1,
+ CLSW_SHUTDOWN=CLSW_HIBERNATE<<1,
+ CLSW_LOGOFF=CLSW_SHUTDOWN<<1,
+ CLSW_AFTERPLAYBACK_MASK=CLSW_CLOSE|CLSW_STANDBY|CLSW_SHUTDOWN|CLSW_HIBERNATE|CLSW_LOGOFF,
+ CLSW_FULLSCREEN=CLSW_LOGOFF<<1,
+ CLSW_NEW=CLSW_FULLSCREEN<<1,
+ CLSW_HELP=CLSW_NEW<<1,
+ CLSW_DVD=CLSW_HELP<<1,
+ CLSW_CD=CLSW_DVD<<1,
+ CLSW_ADD=CLSW_CD<<1,
+ CLSW_MINIMIZED=CLSW_ADD<<1,
+ CLSW_REGEXTVID=CLSW_MINIMIZED<<1,
+ CLSW_REGEXTAUD=CLSW_REGEXTVID<<1,
+ CLSW_UNREGEXTVID=CLSW_REGEXTAUD<<1,
+ CLSW_UNREGEXTAUD=CLSW_UNREGEXTVID<<1,
+ CLSW_STARTVALID=CLSW_UNREGEXTAUD<<1,
+ CLSW_NOFOCUS=CLSW_STARTVALID<<1,
+ CLSW_FIXEDSIZE=CLSW_NOFOCUS<<1,
+ CLSW_MONITOR=CLSW_FIXEDSIZE<<1,
+ CLSW_UNRECOGNIZEDSWITCH=CLSW_MONITOR<<1
+};
+
+enum
+{
+ VIDRNDT_DS_DEFAULT,
+ VIDRNDT_DS_OLDRENDERER,
+ VIDRNDT_DS_OVERLAYMIXER,
+ VIDRNDT_DS_VMR7WINDOWED,
+ VIDRNDT_DS_VMR9WINDOWED,
+ VIDRNDT_DS_VMR7RENDERLESS,
+ VIDRNDT_DS_VMR9RENDERLESS,
+ VIDRNDT_DS_DXR,
+ VIDRNDT_DS_NULL_COMP,
+ VIDRNDT_DS_NULL_UNCOMP,
+};
+
+enum
+{
+ VIDRNDT_RM_DEFAULT,
+ VIDRNDT_RM_DX7,
+ VIDRNDT_RM_DX9,
+};
+
+enum
+{
+ VIDRNDT_QT_DEFAULT,
+ VIDRNDT_QT_DX7,
+ VIDRNDT_QT_DX9,
+};
+
+enum
+{
+ VIDRNDT_AP_SURFACE,
+ VIDRNDT_AP_TEXTURE2D,
+ VIDRNDT_AP_TEXTURE3D,
+};
+
+#define AUDRNDT_NULL_COMP _T("Null Audio Renderer (Any)")
+#define AUDRNDT_NULL_UNCOMP _T("Null Audio Renderer (Uncompressed)")
+
+enum
+{
+ SRC_CDDA=1,
+ SRC_CDXA=SRC_CDDA<<1,
+ SRC_VTS=SRC_CDXA<<1,
+ SRC_FLIC=SRC_VTS<<1,
+ SRC_D2V=SRC_FLIC<<1,
+ SRC_DTSAC3=SRC_D2V<<1,
+ SRC_MATROSKA=SRC_DTSAC3<<1,
+ SRC_SHOUTCAST=SRC_MATROSKA<<1,
+ SRC_REALMEDIA=SRC_SHOUTCAST<<1,
+ SRC_AVI=SRC_REALMEDIA<<1,
+ SRC_RADGT=SRC_AVI<<1,
+ SRC_ROQ=SRC_RADGT<<1,
+ SRC_OGG=SRC_ROQ<<1,
+ SRC_NUT=SRC_OGG<<1,
+ SRC_MPEG=SRC_NUT<<1,
+ SRC_DIRAC=SRC_MPEG<<1,
+ SRC_MPA=SRC_DIRAC<<1,
+ SRC_DSM=SRC_MPA<<1,
+ SRC_SUBS=SRC_DSM<<1,
+ SRC_MP4=SRC_SUBS<<1,
+ SRC_LAST=SRC_MP4<<1
+};
+
+enum
+{
+ TRA_MPEG1=1,
+ TRA_MPEG2=TRA_MPEG1<<1,
+ TRA_RV=TRA_MPEG2<<1,
+ TRA_RA=TRA_RV<<1,
+ TRA_MPA=TRA_RA<<1,
+ TRA_LPCM=TRA_MPA<<1,
+ TRA_AC3=TRA_LPCM<<1,
+ TRA_DTS=TRA_AC3<<1,
+ TRA_AAC=TRA_DTS<<1,
+ TRA_PS2AUD=TRA_AAC<<1,
+ TRA_DIRAC=TRA_PS2AUD<<1,
+ TRA_VORBIS=TRA_DIRAC<<1,
+ TRA_FLV4=TRA_VORBIS<<1,
+ TRA_VP62=TRA_FLV4<<1,
+ TRA_LAST=TRA_VP62<<1
+};
+
+enum
+{
+ DVS_HALF,
+ DVS_NORMAL,
+ DVS_DOUBLE,
+ DVS_STRETCH,
+ DVS_FROMINSIDE,
+ DVS_FROMOUTSIDE
+};
+
+typedef enum
+{
+ FAV_FILE,
+ FAV_DVD,
+ FAV_DEVICE
+} favtype;
+
+#pragma pack(push, 1)
+typedef struct
+{
+ bool fValid;
+ CSize size;
+ int bpp, freq;
+} dispmode;
+
+class wmcmd : public ACCEL
+{
+ ACCEL backup;
+ UINT appcmdorg;
+ UINT mouseorg;
+public:
+ CString name;
+ UINT appcmd;
+ enum {NONE,LDOWN,LUP,LDBLCLK,MDOWN,MUP,MDBLCLK,RDOWN,RUP,RDBLCLK,X1DOWN,X1UP,X1DBLCLK,X2DOWN,X2UP,X2DBLCLK,WUP,WDOWN,LAST};
+ UINT mouse;
+ CStringA rmcmd;
+ int rmrepcnt;
+ wmcmd(WORD cmd = 0) {this->cmd = cmd;}
+ wmcmd(WORD cmd, WORD key, BYTE fVirt, LPCTSTR name, UINT appcmd = 0, UINT mouse = NONE, LPCSTR rmcmd = "", int rmrepcnt = 5)
+ {
+ this->cmd = cmd;
+ this->key = key;
+ this->fVirt = fVirt;
+ this->appcmd = appcmdorg = appcmd;
+ this->name = name;
+ this->mouse = mouseorg = mouse;
+ this->rmcmd = rmcmd;
+ this->rmrepcnt = rmrepcnt;
+ backup = *this;
+ }
+ bool operator == (const wmcmd& wc) const
+ {
+ return(cmd > 0 && cmd == wc.cmd);
+ }
+ void Restore() {*(ACCEL*)this = backup; appcmd = appcmdorg; mouse = mouseorg; rmcmd.Empty(); rmrepcnt = 5;}
+ bool IsModified() {return(memcmp((const ACCEL*)this, &backup, sizeof(ACCEL)) || appcmd != appcmdorg || mouse != mouseorg || !rmcmd.IsEmpty() || rmrepcnt != 5);}
+};
+#pragma pack(pop)
+
+#include <afxsock.h>
+
+class CRemoteCtrlClient : public CAsyncSocket
+{
+protected:
+ CCritSec m_csLock;
+ CWnd* m_pWnd;
+ enum {DISCONNECTED, CONNECTED, CONNECTING} m_nStatus;
+ CString m_addr;
+
+ virtual void OnConnect(int nErrorCode);
+ virtual void OnClose(int nErrorCode);
+ virtual void OnReceive(int nErrorCode);
+
+ virtual void OnCommand(CStringA str) = 0;
+
+ void ExecuteCommand(CStringA cmd, int repcnt);
+
+public:
+ CRemoteCtrlClient();
+ void SetHWND(HWND hWnd);
+ void Connect(CString addr);
+ int GetStatus() {return(m_nStatus);}
+};
+
+class CWinLircClient : public CRemoteCtrlClient
+{
+protected:
+ virtual void OnCommand(CStringA str);
+
+public:
+ CWinLircClient();
+};
+
+class CUIceClient : public CRemoteCtrlClient
+{
+protected:
+ virtual void OnCommand(CStringA str);
+
+public:
+ CUIceClient();
+};
+
+extern void GetCurDispMode(dispmode& dm);
+extern bool GetDispMode(int i, dispmode& dm);
+extern void SetDispMode(dispmode& dm);
+
+class CMPlayerCApp : public CWinApp
+{
+ ATL::CMutex m_mutexOneInstance;
+
+ CAtlList<CString> m_cmdln;
+ void PreProcessCommandLine();
+ void SendCommandLine(HWND hWnd);
+
+ // === CASIMIR666 : Ajout CMPlayerCApp
+ COLORPROPERTY_RANGE m_ColorControl[4];
+
+public:
+ CMPlayerCApp();
+
+ void ShowCmdlnSwitches();
+
+ bool StoreSettingsToIni();
+ bool StoreSettingsToRegistry();
+ CString GetIniPath();
+ bool IsIniValid();
+
+ bool GetAppDataPath(CString& path);
+
+ // === CASIMIR666 : Ajout CMPlayerCApp
+ bool m_fTearingTest;
+ LONGLONG m_PerfFrequency;
+
+ LONGLONG GetPerfCounter();
+ COLORPROPERTY_RANGE* GetColorControl(ControlType nFlag);
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CMPlayerCApp)
+ public:
+ virtual BOOL InitInstance();
+ virtual int ExitInstance();
+ //}}AFX_VIRTUAL
+
+// Implementation
+
+ class Settings
+ {
+ friend class CMPlayerCApp;
+
+ bool fInitialized;
+
+ class CRecentFileAndURLList : public CRecentFileList
+ {
+ public:
+ CRecentFileAndURLList(UINT nStart, LPCTSTR lpszSection,
+ LPCTSTR lpszEntryFormat, int nSize,
+ int nMaxDispLen = AFX_ABBREV_FILENAME_LEN);
+
+ virtual void Add(LPCTSTR lpszPathName); // we have to override CRecentFileList::Add because the original version can't handle URLs
+ };
+
+ public:
+ // cmdline params
+ int nCLSwitches;
+ CAtlList<CString> slFiles, slDubs, slSubs, slFilters;
+ __int64 rtStart;
+ CSize fixedWindowSize;
+ bool HasFixedWindowSize() {return fixedWindowSize.cx > 0 || fixedWindowSize.cy > 0;}
+ // int iFixedWidth, iFixedHeight;
+ int iMonitor;
+
+ void ParseCommandLine(CAtlList<CString>& cmdln);
+
+ bool fXpOrBetter;
+ int iDXVer;
+
+ int nCS;
+ bool fHideCaptionMenu;
+ int iDefaultVideoSize;
+ bool fKeepAspectRatio;
+ bool fCompMonDeskARDiff;
+
+ CRecentFileAndURLList MRU;
+ CRecentFileAndURLList MRUDub;
+
+ CAutoPtrList<FilterOverride> filters;
+
+ int iDSVideoRendererType;
+ int iRMVideoRendererType;
+ int iQTVideoRendererType;
+ int iAPSurfaceUsage;
+ bool fVMRSyncFix;
+ int iDX9Resizer;
+ bool fVMR9MixerMode;
+ bool fVMR9MixerYUV;
+
+ int nVolume;
+ int nBalance;
+ bool fMute;
+ int nLoops;
+ bool fLoopForever;
+ bool fRewind;
+ int iZoomLevel;
+ // int iVideoRendererType;
+ CStringW AudioRendererDisplayName;
+ bool fAutoloadAudio;
+ bool fAutoloadSubtitles;
+ bool fEnableWorkerThreadForOpening;
+ bool fReportFailedPins;
+
+ bool fAllowMultipleInst;
+ int iTitleBarTextStyle;
+ bool fTitleBarTextTitle;
+ int iOnTop;
+ bool fTrayIcon;
+ bool fRememberZoomLevel;
+ bool fShowBarsWhenFullScreen;
+ int nShowBarsWhenFullScreenTimeOut;
+ dispmode dmFullscreenRes;
+ bool fExitFullScreenAtTheEnd;
+ bool fRememberWindowPos;
+ bool fRememberWindowSize;
+ bool fSnapToDesktopEdges;
+ CRect rcLastWindowPos;
+ UINT lastWindowType;
+ CSize AspectRatio;
+ bool fKeepHistory;
+
+ CString sDVDPath;
+ bool fUseDVDPath;
+ LCID idMenuLang, idAudioLang, idSubtitlesLang;
+ bool fAutoSpeakerConf;
+
+ STSStyle subdefstyle;
+ bool fOverridePlacement;
+ int nHorPos, nVerPos;
+ int nSPCSize;
+ int nSPCMaxRes;
+ bool fSPCPow2Tex;
+ bool fEnableSubtitles;
+
+ bool fDisabeXPToolbars;
+ bool fUseWMASFReader;
+ int nJumpDistS;
+ int nJumpDistM;
+ int nJumpDistL;
+ bool fFreeWindowResizing;
+ bool fNotifyMSN;
+ bool fNotifyGTSdll;
+
+ bool fEnableAudioSwitcher;
+ bool fDownSampleTo441;
+ bool fAudioTimeShift;
+ int tAudioTimeShift;
+ bool fCustomChannelMapping;
+ DWORD pSpeakerToChannelMap[18][18];
+ bool fAudioNormalize;
+ bool fAudioNormalizeRecover;
+ float AudioBoost;
+
+ bool fIntRealMedia;
+ // bool fRealMediaRenderless;
+ int iQuickTimeRenderer;
+ float RealMediaQuickTimeFPS;
+
+ CStringArray m_pnspresets;
+
+ CList<wmcmd> wmcmds;
+ HACCEL hAccel;
+
+ bool fWinLirc;
+ CString WinLircAddr;
+ CWinLircClient WinLircClient;
+ bool fUIce;
+ CString UIceAddr;
+ CUIceClient UIceClient;
+
+ CMediaFormats Formats;
+
+ UINT SrcFilters, TraFilters;
+
+ CString logofn;
+ UINT logoid;
+ bool logoext;
+
+ bool fHideCDROMsSubMenu;
+
+ DWORD priority;
+ bool launchfullscreen;
+
+ BOOL fEnableWebServer;
+ int nWebServerPort;
+ bool fWebServerPrintDebugInfo;
+ bool fWebServerUseCompression;
+ bool fWebServerLocalhostOnly;
+ CString WebRoot, WebDefIndex;
+ CString WebServerCGI;
+
+ CString SnapShotPath, SnapShotExt;
+ int ThumbRows, ThumbCols, ThumbWidth;
+
+ CString ISDb;
+
+ struct Shader {CString label, target, srcdata;};
+ CAtlList<Shader> m_shaders;
+ CString m_shadercombine;
+
+ // === CASIMIR666 : nouveau settings
+ bool fD3DFullscreen;
+ bool fMonitorAutoRefreshRate;
+ bool fLastFullScreen;
+ float dBrightness;
+ float dContrast;
+ float dHue;
+ float dSaturation;
+ CString strShaderList;
+
+ bool fRememberDVDPos;
+ bool fRememberFilePos;
+
+
+ DVD_POSITION* CurrentDVDPosition();
+ bool NewDvd(ULONGLONG llDVDGuid);
+ FILE_POSITION* CurrentFilePosition();
+ bool NewFile(LPCTSTR strFileName);
+
+ void DeserializeHex (LPCTSTR strVal, BYTE* pBuffer, int nBufSize);
+ CString SerializeHex (BYTE* pBuffer, int nBufSize);
+
+ private :
+ DVD_POSITION DvdPosition[MAX_DVD_POSITION];
+ int nCurrentDvdPosition;
+ FILE_POSITION FilePosition[MAX_FILE_POSITION];
+ int nCurrentFilePosition;
+
+
+ public:
+ Settings();
+ virtual ~Settings();
+ void UpdateData(bool fSave);
+
+ void GetFav(favtype ft, CAtlList<CString>& sl);
+ void SetFav(favtype ft, CAtlList<CString>& sl);
+ void AddFav(favtype ft, CString s);
+ } m_s;
+
+public:
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnAppAbout();
+ afx_msg void OnFileExit();
+ afx_msg void OnHelpShowcommandlineswitches();
+};
+
+#define AfxGetMyApp() ((CMPlayerCApp*)AfxGetApp())
+#define AfxGetAppSettings() ((CMPlayerCApp*)AfxGetApp())->m_s
+#define AppSettings CMPlayerCApp::Settings
diff --git a/src/apps/mplayerc/mplayerc.ncb b/src/apps/mplayerc/mplayerc.ncb
new file mode 100644
index 000000000..940bbfc4f
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.ncb
Binary files differ
diff --git a/src/apps/mplayerc/mplayerc.rc b/src/apps/mplayerc/mplayerc.rc
new file mode 100644
index 000000000..014999ae4
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.rc
@@ -0,0 +1,2825 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_SELECTMEDIATYPE DIALOGEX 0, 0, 225, 47
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Select Media Type"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ COMBOBOX IDC_COMBO1,7,7,211,120,CBS_DROPDOWN | WS_VSCROLL |
+ WS_TABSTOP
+ DEFPUSHBUTTON "OK",IDOK,114,26,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,168,26,50,14
+END
+
+IDD_OPENCAPDEVICE_DLG DIALOGEX 0, 0, 226, 131
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Select Capture Device"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT "The following input devices were found on your system:",
+ IDC_STATIC,12,7,200,11
+ LTEXT "Video",IDC_STATIC,12,23,18,8
+ COMBOBOX IDC_COMBO1,47,20,165,30,CBS_DROPDOWN | CBS_AUTOHSCROLL |
+ WS_VSCROLL | WS_TABSTOP
+ LTEXT "Audio",IDC_STATIC,12,41,19,8
+ COMBOBOX IDC_COMBO2,47,38,165,30,CBS_DROPDOWN | CBS_AUTOHSCROLL |
+ WS_VSCROLL | WS_TABSTOP
+ DEFPUSHBUTTON "OK",IDOK,60,110,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,115,110,50,14
+ LTEXT "Some capture cards can output audio directly and not through the audio card. In that case you can leave the audio input selection empty.",
+ IDC_STATIC,12,76,200,24
+ LTEXT "Country",IDC_STATIC,12,58,27,8
+ COMBOBOX IDC_COMBO9,47,56,165,102,CBS_DROPDOWNLIST |
+ CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
+END
+
+IDD_CAPTURE_DLG DIALOGEX 0, 0, 127, 289
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Video",IDC_STATIC1,3,1,116,59
+ COMBOBOX IDC_COMBO4,10,10,62,116,CBS_DROPDOWNLIST | WS_DISABLED |
+ WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT3,74,10,38,13,ES_RIGHT | ES_AUTOHSCROLL |
+ WS_DISABLED
+ COMBOBOX IDC_COMBO1,10,26,37,89,CBS_DROPDOWNLIST | CBS_SORT |
+ WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_COMBO5,50,26,62,89,CBS_DROPDOWNLIST | CBS_SORT |
+ WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT1,10,43,37,13,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS | WS_DISABLED,35,46,11,14
+ EDITTEXT IDC_EDIT2,50,43,35,13,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS | WS_DISABLED,74,46,11,14
+ PUSHBUTTON "Set",IDC_BUTTON1,89,43,23,13
+ GROUPBOX "Audio",IDC_STATIC,3,61,116,43
+ COMBOBOX IDC_COMBO3,10,71,62,99,CBS_DROPDOWNLIST | WS_DISABLED |
+ WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_COMBO2,74,71,38,98,CBS_DROPDOWNLIST | CBS_SORT |
+ WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_COMBO6,10,87,102,118,CBS_DROPDOWNLIST | CBS_SORT |
+ WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ GROUPBOX "Output",IDC_STATIC,3,105,116,171
+ CONTROL "Record Video",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,10,114,58,10
+ CONTROL "Preview",IDC_CHECK2,"Button",BS_AUTO3STATE | WS_TABSTOP,
+ 72,114,41,10
+ COMBOBOX IDC_COMBO7,10,126,102,62,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ COMBOBOX IDC_COMBO9,10,142,37,89,CBS_DROPDOWNLIST | CBS_SORT |
+ WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_COMBO10,50,142,62,89,CBS_DROPDOWNLIST | CBS_SORT |
+ WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,10,158,104,1
+ CONTROL "Record Audio",IDC_CHECK3,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,10,161,59,10
+ CONTROL "Preview",IDC_CHECK4,"Button",BS_AUTO3STATE | WS_TABSTOP,
+ 72,161,41,10
+ COMBOBOX IDC_COMBO8,10,173,102,62,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ COMBOBOX IDC_COMBO12,10,189,37,98,CBS_DROPDOWNLIST | CBS_SORT |
+ WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_COMBO11,50,189,62,118,CBS_DROPDOWNLIST | CBS_SORT |
+ WS_DISABLED | WS_VSCROLL | WS_TABSTOP
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,10,205,104,1
+ LTEXT "V/A Buffers:",IDC_STATIC,10,211,40,8
+ EDITTEXT IDC_EDIT5,52,209,28,12,ES_CENTER | ES_AUTOHSCROLL |
+ ES_NUMBER
+ EDITTEXT IDC_EDIT6,83,209,28,12,ES_CENTER | ES_AUTOHSCROLL |
+ ES_NUMBER
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,10,225,104,1
+ EDITTEXT IDC_EDIT4,10,231,86,13,ES_AUTOHSCROLL | ES_READONLY
+ PUSHBUTTON "...",IDC_BUTTON3,98,231,14,13
+ CONTROL "Audio to wav",IDC_CHECK5,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,10,260,55,10
+ PUSHBUTTON "Record",IDC_BUTTON2,74,259,38,13,WS_DISABLED | WS_GROUP
+ COMBOBOX IDC_COMBO14,10,245,102,52,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+END
+
+IDD_PPAGEAUDIOSWITCHER DIALOGEX 0, 0, 296, 198
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "Enable built-in audio switcher filter (needs re-opening, disables morgan switcher)",
+ IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,5,273,
+ 10
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,18,282,1
+ CONTROL "Down-sample to 44100 Hz",IDC_CHECK3,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,35,99,10
+ CONTROL "Audio time shift (ms):",IDC_CHECK4,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,48,82,10
+ EDITTEXT IDC_EDIT2,96,47,46,13,ES_AUTOHSCROLL,WS_EX_RIGHT
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS | UDS_HOTTRACK,144,46,11,14
+ CONTROL "Enable custom channel mapping",IDC_CHECK1,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,61,117,10
+ LTEXT "Speaker configuration for ",IDC_STATIC1,7,76,84,8
+ EDITTEXT IDC_EDIT1,95,74,29,13,ES_CENTER | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_WRAP |
+ UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
+ UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,183,73,11,
+ 14
+ LTEXT "input channels:",IDC_STATIC2,131,76,51,8
+ CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT |
+ LVS_OWNERDRAWFIXED | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER |
+ WS_BORDER | WS_TABSTOP,7,93,282,94
+ CTEXT "Hold shift for immediate changes when clicking something ",
+ IDC_STATIC3,7,189,282,8
+ CONTROL "Normalize",IDC_CHECK5,"Button",BS_AUTOCHECKBOX |
+ WS_GROUP | WS_TABSTOP,7,23,47,8
+ LTEXT "Boost:",IDC_STATIC,129,23,19,8
+ CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
+ TBS_NOTICKS | WS_TABSTOP,152,23,137,11
+ CONTROL "Regain volume",IDC_CHECK6,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,59,22,59,10
+END
+
+IDD_GOTO_DLG DIALOGEX 0, 0, 157, 113
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Go To..."
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT "Enter at most four numbers separated by anything but digits. One number only means ms, two numbers mean sec and ms, etc.",
+ IDC_STATIC,7,7,143,27
+ LTEXT "Time",IDC_STATIC,7,40,16,8
+ EDITTEXT IDC_EDIT1,31,37,83,14,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "Go!",IDC_OK1,119,37,31,14
+ LTEXT "Enter two numbers to jump to a specified frame, the first is the frame number, the second is the frame-rate.",
+ IDC_STATIC,7,62,143,26
+ LTEXT "Frame",IDC_STATIC,7,95,20,8
+ EDITTEXT IDC_EDIT2,31,92,83,14,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "Go!",IDC_OK2,119,92,31,14
+END
+
+IDD_OPEN_DLG DIALOGEX 0, 0, 241, 87
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Open"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ ICON IDR_MAINFRAME,IDC_STATIC,9,8,21,20
+ LTEXT "Type the address of a movie or audio file (on the Internet or your computer) and the player will open it for you.",
+ IDC_STATIC1,33,9,149,28
+ LTEXT "Open:",IDC_STATIC,7,52,21,8
+ COMBOBOX IDC_COMBO1,33,50,149,76,CBS_DROPDOWN | CBS_AUTOHSCROLL |
+ WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Browse...",IDC_BUTTON1,187,49,47,14
+ LTEXT "Dub:",IDC_STATIC,7,71,16,8
+ COMBOBOX IDC_COMBO2,33,68,149,20,CBS_DROPDOWN | CBS_AUTOHSCROLL |
+ WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Browse...",IDC_BUTTON2,187,67,47,14
+ DEFPUSHBUTTON "OK",IDOK,187,9,47,14,WS_GROUP
+ PUSHBUTTON "Cancel",IDCANCEL,187,25,47,14
+ CONTROL "Add to playlist without opening",IDC_CHECK1,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,33,37,115,10
+END
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 222, 89
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "About"
+FONT 8, "MS Shell Dlg", 400, 0, 0xB1
+BEGIN
+ ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
+ LTEXT "Media Player Classic",IDC_STATIC1,40,10,126,8,
+ SS_NOPREFIX
+ LTEXT "Copyright (C) 2002-2006 Gabest",IDC_STATIC,40,21,113,8
+ LTEXT "Version: 6.4.8.8",IDC_STATIC,40,33,92,8
+ PUSHBUTTON "OK",IDOK,160,8,50,14,WS_GROUP
+ LTEXT "This program is freeware and released under the GNU General Public License.\nDistribution in Codec Packs is allowed, but the author (Gabest) is not liable for the additional content.",
+ IDC_STATIC,11,47,199,34
+END
+
+IDD_PLAYERSTATUSBAR DIALOGEX 0, 0, 183, 15
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+END
+
+IDD_PLAYERSEEKBAR DIALOGEX 0, 0, 254, 12
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+END
+
+IDD_PLAYERINFOBAR DIALOGEX 0, 0, 183, 12
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+END
+
+IDD_PPAGEPLAYER DIALOGEX 0, 0, 296, 198
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Open options",IDC_STATIC,5,7,117,119
+ CONTROL "Use the same player for each media file",IDC_RADIO1,
+ "Button",BS_AUTORADIOBUTTON | BS_MULTILINE | WS_GROUP,15,
+ 20,93,20
+ CONTROL "Open a new player for each media file played",
+ IDC_RADIO2,"Button",BS_AUTORADIOBUTTON | BS_MULTILINE,15,
+ 63,98,15
+ ICON IDI_SINGLE,IDC_STATIC,51,40,20,20,SS_CENTERIMAGE
+ ICON IDI_MULTI,IDC_STATIC,51,84,20,20,SS_CENTERIMAGE
+ CONTROL "Launch files in fullscreen",IDC_CHECK11,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,109,93,10
+ GROUPBOX "Title bar",IDC_STATIC,5,130,117,61
+ CONTROL "Display full path",IDC_RADIO3,"Button",
+ BS_AUTORADIOBUTTON | WS_GROUP,16,143,67,10
+ CONTROL "File name only",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,
+ 16,154,61,10
+ CONTROL "Don't prefix anything",IDC_RADIO5,"Button",
+ BS_AUTORADIOBUTTON,16,165,83,10
+ GROUPBOX "Other",IDC_STATIC,130,7,159,184,WS_GROUP
+ CONTROL "Always on top",IDC_CHECK2,"Button",BS_AUTO3STATE |
+ WS_GROUP | WS_TABSTOP,140,19,61,10
+ CONTROL "Tray icon",IDC_CHECK3,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,140,32,45,10
+ CONTROL "Show controls in fullscreen for",IDC_CHECK4,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,45,112,10
+ EDITTEXT IDC_EDIT1,152,60,32,13,ES_CENTER | ES_AUTOHSCROLL |
+ ES_READONLY | ES_NUMBER
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS | UDS_HOTTRACK,175,61,11,14
+ LTEXT "sec(s)",IDC_STATIC1,188,62,20,8
+ LTEXT "0: auto-hide\n-1: don't hide",IDC_STATIC2,218,58,48,17
+ CONTROL "Exit fullscreen at the end of playback",IDC_CHECK5,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,79,135,10
+ CONTROL "Remember last window position",IDC_CHECK6,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,92,127,10
+ CONTROL "Remember last window size",IDC_CHECK7,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,105,127,10
+ CONTROL "Snap to desktop edges",IDC_CHECK12,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,118,89,10
+ CONTROL "Store settings to .ini file",IDC_CHECK8,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,131,92,10
+ CONTROL "Keep history of recently opened files",IDC_CHECK1,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,140,144,133,10
+ CONTROL "Hide CD-ROMs menu",IDC_CHECK10,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,140,157,82,10
+ CONTROL "Process priority above normal",IDC_CHECK9,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,140,170,111,10
+ CONTROL "Replace file name with title",IDC_CHECK13,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,15,177,101,10
+END
+
+IDD_PPAGEDVD DIALOGEX 0, 0, 296, 193
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Location of the DVD drive or the ""VIDEO_TS"" folder",
+ IDC_STATIC,5,7,235,66
+ CONTROL "Default",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP,15,21,39,10
+ CONTROL "User defined path:",IDC_RADIO2,"Button",
+ BS_AUTORADIOBUTTON,15,35,76,10
+ EDITTEXT IDC_DVDPATH,29,50,180,14,ES_AUTOHSCROLL | WS_GROUP
+ PUSHBUTTON "...",IDC_BUTTON1,215,50,15,14
+ GROUPBOX "Prefered language for DVD Navigator and the external OGM Splitter",
+ IDC_STATIC,5,77,235,73
+ CONTROL "Menu",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON | WS_GROUP,
+ 15,95,33,10
+ CONTROL "Audio",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,15,111,34,
+ 10
+ CONTROL "Subtitles",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,15,
+ 127,43,10
+ LISTBOX IDC_LIST1,74,90,156,53,WS_VSCROLL | WS_GROUP |
+ WS_TABSTOP
+ GROUPBOX "Audio channels",IDC_STATIC,5,155,235,32
+ CONTROL "Automatically set speaker count for the ivideo ac3 decoder",
+ IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,169,
+ 204,10
+END
+
+IDD_PPAGEPLAYBACK DIALOGEX 0, 0, 296, 198
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Audio",IDC_STATIC,5,7,284,58
+ LTEXT "Volume",IDC_STATIC,66,19,24,8
+ LTEXT "Min",IDC_STATIC,27,38,12,8
+ CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_AUTOTICKS |
+ TBS_BOTH | WS_TABSTOP,41,31,75,24
+ LTEXT "Max",IDC_STATIC,123,38,14,8
+ LTEXT "Balance",IDC_STATIC,196,19,26,8
+ LTEXT "L",IDC_STATIC,160,39,8,8
+ CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_AUTOTICKS |
+ WS_TABSTOP,172,36,75,19
+ LTEXT "R",IDC_STATIC,252,39,8,8
+ GROUPBOX "Playback",IDC_STATIC,5,67,114,71
+ CONTROL "Play",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP,
+ 14,86,29,10
+ CONTROL "Repeat forever",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,
+ 14,102,65,10
+ CONTROL "Rewind when done playing",IDC_CHECK1,"Button",
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,14,119,101,10
+ EDITTEXT IDC_EDIT1,52,85,20,13,ES_AUTOHSCROLL | ES_NUMBER
+ LTEXT "time(s)",IDC_STATIC1,81,87,23,8
+ GROUPBOX "Output",IDC_STATIC,126,67,163,71
+ CONTROL "Auto-zoom:",IDC_CHECK5,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,137,85,48,10
+ COMBOBOX IDC_COMBO1,193,83,49,47,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ CONTROL "Change fullscreen resolution:",IDC_CHECK4,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,137,102,109,10
+ COMBOBOX IDC_COMBO2,156,116,112,64,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ GROUPBOX "Open settings",IDC_STATIC,5,140,284,43
+ CONTROL "Use worker thread to construct the filter graph",
+ IDC_CHECK7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,153,
+ 166,10
+ CONTROL "Report pins which fail to render",IDC_CHECK6,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,13,167,116,10
+ CONTROL "Auto-load audio files",IDC_CHECK2,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,193,153,81,10
+ CONTROL "Auto-load subtitles",IDC_CHECK3,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,193,167,76,10
+END
+
+IDD_PPAGESUBTITLES DIALOGEX 0, 0, 296, 203
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0xEE
+BEGIN
+ GROUPBOX "",IDC_STATIC,5,3,192,38
+ CONTROL "Override placement",IDC_CHECK3,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,14,3,75,10
+ LTEXT "Horizontal:",IDC_STATIC1,14,22,35,8
+ EDITTEXT IDC_EDIT2,54,20,32,12,ES_CENTER | ES_AUTOHSCROLL |
+ ES_READONLY | ES_NUMBER
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS | UDS_HOTTRACK,74,25,11,14
+ LTEXT "%",IDC_STATIC2,88,22,8,8
+ LTEXT "Vertical:",IDC_STATIC3,107,22,26,8
+ EDITTEXT IDC_EDIT3,139,20,32,12,ES_CENTER | ES_AUTOHSCROLL |
+ ES_READONLY | ES_NUMBER
+ CONTROL "",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS | UDS_HOTTRACK,159,26,11,14
+ LTEXT "%",IDC_STATIC4,173,22,8,8
+ GROUPBOX "Texture settings (open the video again to see the changes)",
+ IDC_STATIC,5,43,284,55
+ LTEXT "Number of subpictures to buffer ahead:",IDC_STATIC,14,
+ 60,128,8
+ EDITTEXT IDC_EDIT1,147,58,32,12,ES_CENTER | ES_AUTOHSCROLL |
+ ES_READONLY | ES_NUMBER
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS | UDS_HOTTRACK,168,63,11,14
+ LTEXT "Set 0 to disable buffering\n(not recommended)",
+ IDC_STATIC,191,55,90,17
+ LTEXT "Maximum texture resolution:",IDC_STATIC,14,79,92,8
+ LTEXT "Subtitling for DirectShow is available when the video renderer called ""VMR7 (renderless)"" or ""VMR9 (renderless)"" is set. VMR7 requires Windows XP, VMR9 requires DirectX 9, and both require a HW accelerated D3D video card.",
+ IDC_STATIC,14,148,267,25
+ GROUPBOX "Before you ask",IDC_STATIC,5,136,284,65
+ LTEXT "If you override and enable full-screen antialiasing somewhere at your videocard's settings, subtitles aren't going to look any better but it will surely eat your cpu.",
+ IDC_STATIC,14,110,267,19
+ COMBOBOX IDC_COMBO1,111,77,68,45,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ GROUPBOX "Warning",IDC_STATIC,5,99,284,35
+ LTEXT "RealMedia and QuickTime formats can be subtitled by setting their special DirectX 7 or DirectX 9 renderers.",
+ IDC_STATIC,14,178,267,16
+ CONTROL "Round up to power of two",IDC_CHECK_SPCPOW2TEX,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,184,79,97,10
+END
+
+IDD_PPAGESUBDB DIALOGEX 0, 0, 296, 203
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0xEE
+BEGIN
+ LTEXT "Base URL of the online subtitle database:",IDC_STATIC,5,
+ 8,133,8
+ COMBOBOX IDC_COMBO1,29,22,205,30,CBS_DROPDOWN | CBS_SORT |
+ WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Test",IDC_BUTTON1,239,21,50,14
+ LTEXT "http://",IDC_STATIC,5,24,22,8
+END
+
+IDD_PPAGEFORMATS DIALOGEX 0, 0, 296, 198
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SINGLESEL |
+ LVS_SORTASCENDING | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER |
+ WS_BORDER | WS_TABSTOP,13,15,268,97
+ GROUPBOX "File extensions",IDC_STATIC,6,4,283,135
+ EDITTEXT IDC_EDIT1,13,118,192,14,ES_AUTOHSCROLL
+ PUSHBUTTON "Default",IDC_BUTTON2,210,118,34,14
+ PUSHBUTTON "Set",IDC_BUTTON_EXT_SET,247,118,34,14
+ GROUPBOX "Real-Time Streaming Protocol handler (for rtsp://... URLs)",
+ IDC_STATIC,6,141,283,27
+ CONTROL "RealMedia",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP,14,153,49,10
+ CONTROL "QuickTime",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,66,
+ 153,48,10
+ CONTROL "DirectShow",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,117,
+ 153,52,10
+ CONTROL "Look file extension first",IDC_CHECK5,"Button",
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,191,153,90,10
+ CONTROL "Video",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 13,183,31,10
+ CONTROL "Music",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 45,183,31,10
+ CONTROL "DVD",IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 78,183,29,10
+ CONTROL "Audio CD",IDC_CHECK3,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,108,183,43,10
+ PUSHBUTTON "&Video",IDC_BUTTON4,176,180,33,14
+ PUSHBUTTON "A&udio",IDC_BUTTON3,212,180,33,14
+ PUSHBUTTON "A&ll",IDC_BUTTON1,248,180,33,14
+ GROUPBOX "Autoplay (XP only)",IDC_STATIC1,6,170,151,28
+END
+
+IDD_PPAGETWEAKS DIALOGEX 0, 0, 296, 178
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "Don't use XP-theming on the player controls (needs restart)",
+ IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,9,207,
+ 10
+ CONTROL "Use the WM ASF Reader for Windows Media files (enables faster seeking, but won't seek with incomplete files at all)",
+ IDC_CHECK2,"Button",BS_AUTOCHECKBOX | BS_MULTILINE |
+ WS_TABSTOP,7,25,260,17
+ GROUPBOX "Jump distances (small, medium, large in ms)",IDC_STATIC,
+ 7,50,202,34
+ EDITTEXT IDC_EDIT1,15,62,40,14,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_NUMBER
+ EDITTEXT IDC_EDIT2,64,62,40,14,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_NUMBER
+ EDITTEXT IDC_EDIT3,110,62,40,14,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_NUMBER
+ PUSHBUTTON "Default",IDC_BUTTON1,158,62,44,14
+ CONTROL "Free window resizing",IDC_CHECK1,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,90,83,10
+ CONTROL "Send ""Now Playing"" information to MSN Messenger",
+ IDC_CHECK4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,106,
+ 177,10
+ CONTROL "Send ""Now Playing"" information to mIRC through GTSdll",
+ IDC_CHECK5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,122,
+ 193,10
+ LTEXT "Click here to download GTSdll",IDC_STATICLINKGTS,19,134,
+ 95,8
+END
+
+IDD_PPAGEEXTERNALFILTERS DIALOGEX 0, 0, 296, 200
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LISTBOX IDC_LIST1,6,5,208,102,LBS_OWNERDRAWFIXED |
+ LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
+ WS_TABSTOP
+ PUSHBUTTON "Add Filter...",IDC_BUTTON1,220,5,69,13
+ PUSHBUTTON "Remove",IDC_BUTTON2,220,20,69,13
+ CONTROL "Prefer",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP,220,39,53,10
+ CONTROL "Block",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,220,50,53,
+ 10
+ CONTROL "Set merit:",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,220,
+ 61,47,10
+ EDITTEXT IDC_EDIT1,220,73,69,12,ES_RIGHT | ES_AUTOHSCROLL |
+ WS_GROUP
+ PUSHBUTTON "Up",IDC_BUTTON3,220,95,33,13
+ PUSHBUTTON "Down",IDC_BUTTON4,256,95,33,13
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,6,112,283,1
+ CONTROL "",IDC_TREE2,"SysTreeView32",TVS_HASBUTTONS |
+ TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS |
+ WS_BORDER | WS_TABSTOP,6,117,208,81
+ PUSHBUTTON "Add Media Type...",IDC_BUTTON5,220,117,69,13
+ PUSHBUTTON "Add Sub Type...",IDC_BUTTON6,220,132,69,13
+ PUSHBUTTON "Delete",IDC_BUTTON7,220,147,69,13
+ PUSHBUTTON "Reset List",IDC_BUTTON8,220,185,69,13
+END
+
+IDD_FILEPROPDETAILS DIALOGEX 0, 0, 234, 202
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ ICON "",IDC_DEFAULTICON,8,8,20,20,SS_REALSIZEIMAGE
+ EDITTEXT IDC_EDIT1,35,16,186,12,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,8,35,213,1
+ LTEXT "Type:",IDC_STATIC,40,42,20,8
+ EDITTEXT IDC_EDIT4,73,42,148,13,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ LTEXT "Size:",IDC_STATIC,44,55,16,8
+ EDITTEXT IDC_EDIT3,73,55,148,13,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ LTEXT "Media length:",IDC_STATIC,16,68,44,8
+ EDITTEXT IDC_EDIT2,73,68,148,13,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ LTEXT "Video size:",IDC_STATIC,25,81,35,8
+ EDITTEXT IDC_EDIT5,73,81,148,13,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ LTEXT "Created:",IDC_STATIC,30,94,30,8
+ EDITTEXT IDC_EDIT6,73,94,148,13,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,8,114,213,1
+ EDITTEXT IDC_EDIT7,8,121,213,69,ES_MULTILINE | ES_AUTOHSCROLL |
+ ES_READONLY | WS_VSCROLL | WS_HSCROLL
+END
+
+IDD_FILEPROPCLIP DIALOGEX 0, 0, 234, 202
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ ICON "",IDC_DEFAULTICON,8,8,20,20,SS_REALSIZEIMAGE
+ EDITTEXT IDC_EDIT1,35,16,186,12,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,8,35,213,1
+ LTEXT "Clip:",IDC_STATIC,8,42,15,8
+ EDITTEXT IDC_EDIT4,58,42,163,13,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ LTEXT "Author:",IDC_STATIC,8,55,26,8
+ EDITTEXT IDC_EDIT3,58,55,163,13,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ LTEXT "Copyright:",IDC_STATIC,8,68,35,8
+ EDITTEXT IDC_EDIT2,58,68,163,13,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ LTEXT "Rating:",IDC_STATIC,8,81,24,8
+ EDITTEXT IDC_EDIT5,58,81,163,13,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,8,101,213,1
+ LTEXT "Location:",IDC_STATIC,8,108,30,8
+ EDITTEXT IDC_EDIT6,58,108,163,12,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,8,123,213,1
+ LTEXT "Description:",IDC_STATIC,8,132,39,8
+ EDITTEXT IDC_EDIT7,58,132,144,47,ES_MULTILINE | ES_AUTOHSCROLL |
+ ES_READONLY
+END
+
+IDD_FAVADD DIALOGEX 0, 0, 252, 70
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Add Favorite"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Choose a name for your shortcut:",IDC_STATIC,7,7,238,36
+ COMBOBOX IDC_COMBO1,15,21,222,77,CBS_DROPDOWN | CBS_AUTOHSCROLL |
+ WS_VSCROLL | WS_TABSTOP
+ CONTROL "Remember position",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,15,51,77,10
+ PUSHBUTTON "Cancel",IDCANCEL,139,49,50,14
+ DEFPUSHBUTTON "OK",IDOK,195,49,50,14
+END
+
+IDD_FAVORGANIZE DIALOGEX 0, 0, 276, 174
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Organize Favorites"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_TAB1,"SysTabControl32",0x0,7,7,204,160
+ CONTROL "",IDC_LIST2,"SysListView32",LVS_REPORT | LVS_SINGLESEL |
+ LVS_EDITLABELS | LVS_OWNERDRAWFIXED | LVS_ALIGNLEFT |
+ LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,10,22,197,
+ 141,WS_EX_CLIENTEDGE
+ PUSHBUTTON "Rename",IDC_BUTTON1,219,19,50,14
+ PUSHBUTTON "Move Up",IDC_BUTTON3,219,41,50,14
+ PUSHBUTTON "Move Down",IDC_BUTTON4,219,59,50,14
+ PUSHBUTTON "Delete",IDC_BUTTON2,219,82,50,14
+ DEFPUSHBUTTON "OK",IDOK,219,153,50,14
+END
+
+IDD_PNSPRESET_DLG DIALOGEX 0, 0, 203, 121
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Pan&Scan Presets"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LISTBOX IDC_LIST1,7,7,123,50,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
+ WS_TABSTOP
+ EDITTEXT IDC_EDIT1,7,60,189,13,ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT2,135,18,29,12,ES_CENTER | ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT3,167,18,29,12,ES_CENTER | ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT4,135,44,29,12,ES_CENTER | ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT5,167,44,29,12,ES_CENTER | ES_AUTOHSCROLL
+ PUSHBUTTON "New",IDC_BUTTON2,7,77,33,12
+ PUSHBUTTON "Delete",IDC_BUTTON3,41,77,33,12
+ PUSHBUTTON "Up",IDC_BUTTON4,85,77,33,12
+ PUSHBUTTON "Down",IDC_BUTTON5,119,77,33,12
+ PUSHBUTTON "&Set",IDC_BUTTON1,163,77,33,12
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,8,93,190,1
+ PUSHBUTTON "&Cancel",IDCANCEL,49,100,50,14
+ PUSHBUTTON "&Save",IDOK,105,100,50,14
+ LTEXT "Pos: 0.0 -> 1.0",IDC_STATIC,135,7,61,8
+ LTEXT "Zoom: 0.2 -> 3.0",IDC_STATIC,135,33,61,8
+END
+
+IDD_PPAGEACCELTBL DIALOGEX 0, 0, 296, 198
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_PLACEHOLDER,"Static",SS_BLACKFRAME | NOT
+ WS_VISIBLE,5,5,284,152
+ CONTROL "",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,
+ 165,10,8
+ LTEXT "WinLIRC:",IDC_STATICLINK,19,165,30,8
+ EDITTEXT IDC_EDIT1,53,163,77,13,ES_AUTOHSCROLL
+ CONTROL "",IDC_CHECK9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,
+ 182,10,8
+ LTEXT "uICE:",IDC_STATICLINK2,19,182,19,8
+ EDITTEXT IDC_EDIT2,53,180,77,13,ES_AUTOHSCROLL
+ PUSHBUTTON "Select All",IDC_BUTTON1,230,162,59,14
+ PUSHBUTTON "Reset Selected",IDC_BUTTON2,230,179,59,14
+END
+
+IDD_MEDIATYPES_DLG DIALOGEX 0, 0, 296, 219
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+EXSTYLE WS_EX_TOOLWINDOW
+CAPTION "Warning"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT "Media Player Classic could not render some of the pins in the graph, you may not have the needed codecs or filters installed on the system.",
+ IDC_STATIC1,7,7,282,18
+ LTEXT "The following pin(s) failed to find a connectable filter:",
+ IDC_STATIC2,7,28,282,11
+ COMBOBOX IDC_COMBO1,7,39,282,87,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ EDITTEXT IDC_EDIT1,7,55,282,138,ES_MULTILINE | ES_AUTOHSCROLL |
+ ES_READONLY | WS_VSCROLL | WS_HSCROLL
+ PUSHBUTTON "Look for codecs on the net",IDC_BUTTON1,7,198,109,14
+ DEFPUSHBUTTON "Close",IDOK,239,198,50,14
+END
+
+IDD_SAVE_DLG DIALOGEX 0, 0, 250, 84
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Saving..."
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_ANIMATE1,"SysAnimate32",ACS_CENTER |
+ ACS_TRANSPARENT | WS_TABSTOP,7,3,187,30
+ CONTROL "Static",IDC_FROMTO,"Static",SS_LEFTNOWORDWRAP |
+ WS_GROUP,7,38,235,17
+ CONTROL "",IDC_PROGRESS1,"msctls_progress32",WS_BORDER,7,63,190,
+ 8
+ LTEXT "",IDC_REPORT,7,74,189,8
+ PUSHBUTTON "Cancel",IDCANCEL,203,62,39,14
+END
+
+IDD_SAVETEXTFILEDIALOGTEMPL DIALOGEX 0, 0, 304, 20
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS |
+ WS_CLIPCHILDREN
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT "Encoding:",IDC_STATIC,68,2,32,8
+ COMBOBOX IDC_COMBO1,130,0,164,46,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+END
+
+IDD_SAVETEXTFILEDIALOGTEMPL_400 DIALOGEX 0, 0, 222, 18
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS |
+ WS_CLIPCHILDREN
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT "Encoding:",IDC_STATIC,5,2,32,8
+ COMBOBOX IDC_COMBO1,54,0,155,66,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+END
+
+IDD_SAVETHUMBSDIALOGTEMPL DIALOGEX 0, 0, 304, 35
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS |
+ WS_CLIPCHILDREN
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT "Thumbnails:",IDC_STATIC,68,2,39,8
+ EDITTEXT IDC_EDIT1,130,0,30,13,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,145,0,11,14
+ EDITTEXT IDC_EDIT2,187,0,30,13,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,203,0,11,14
+ LTEXT "rows",IDC_STATIC,164,2,16,8
+ LTEXT "columns",IDC_STATIC,221,2,26,8
+ EDITTEXT IDC_EDIT3,130,17,36,13,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,146,17,11,14
+ LTEXT "Image width:",IDC_STATIC,68,19,43,8
+ LTEXT "pixels",IDC_STATIC,170,19,19,8
+END
+
+IDD_SAVETHUMBSDIALOGTEMPL_400 DIALOGEX 0, 0, 222, 33
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS |
+ WS_CLIPCHILDREN
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LTEXT "Thumbnails:",IDC_STATIC,5,2,39,8
+ EDITTEXT IDC_EDIT1,54,0,30,13,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,69,0,11,14
+ EDITTEXT IDC_EDIT2,111,0,30,13,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,127,0,11,14
+ LTEXT "rows",IDC_STATIC,88,2,16,8
+ LTEXT "columns",IDC_STATIC,145,2,26,8
+ EDITTEXT IDC_EDIT3,54,16,36,13,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,70,16,11,14
+ LTEXT "Image width:",IDC_STATIC,5,18,43,8
+ LTEXT "pixels",IDC_STATIC,95,17,19,8
+END
+
+IDD_COMPROPERTYPAGE DIALOGEX 0, 0, 5, 5
+STYLE DS_SETFONT | WS_CHILD
+FONT 8, "MS Sans Serif", 0, 0, 0x0
+BEGIN
+END
+
+IDD_ADDREGFILTER DIALOGEX 0, 0, 285, 182
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MAXIMIZEBOX | WS_POPUP |
+ WS_CAPTION | WS_SYSMENU
+CAPTION "Select Filter"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_LIST2,"SysListView32",LVS_LIST | LVS_SINGLESEL |
+ LVS_SORTASCENDING | LVS_ALIGNLEFT | WS_TABSTOP,5,5,275,
+ 154,WS_EX_CLIENTEDGE
+ PUSHBUTTON "Browse...",IDC_BUTTON1,5,163,50,14
+ DEFPUSHBUTTON "OK",IDOK,177,163,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,230,163,50,14
+END
+
+IDD_PPAGESUBSTYLE DIALOGEX 0, 0, 296, 198
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Font",IDC_STATIC,4,2,106,123
+ PUSHBUTTON "Font",IDC_BUTTON1,11,13,89,13
+ COMBOBOX IDC_COMBO1,11,30,90,52,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ LTEXT "Spacing",IDC_STATIC,11,50,26,8
+ EDITTEXT IDC_EDIT3,66,48,35,13,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,93,48,11,14
+ LTEXT "Angle (z,°)",IDC_STATIC,11,69,36,8
+ EDITTEXT IDC_EDIT4,66,67,35,13,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_NUMBER
+ CONTROL "",IDC_SPIN10,"msctls_updown32",UDS_WRAP |
+ UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
+ UDS_ARROWKEYS | UDS_NOTHOUSANDS,93,67,11,14
+ LTEXT "Scale (x,%)",IDC_STATIC,11,88,39,8
+ EDITTEXT IDC_EDIT5,66,86,35,13,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN4,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,93,86,11,14
+ LTEXT "Scale (y,%)",IDC_STATIC,11,107,39,8
+ EDITTEXT IDC_EDIT6,66,105,35,13,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN5,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,93,105,11,14
+ GROUPBOX "Border Style",IDC_STATIC,4,127,106,68
+ CONTROL "Outline",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP,11,140,39,10
+ CONTROL "Opaque box",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,50,
+ 140,52,10
+ LTEXT "Border width",IDC_STATIC,13,158,42,8
+ EDITTEXT IDC_EDIT1,66,155,35,13,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_NUMBER
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,94,154,11,14
+ LTEXT "Shadow depth",IDC_STATIC,13,177,47,8
+ EDITTEXT IDC_EDIT2,66,174,35,13,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_NUMBER
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,93,175,11,14
+ GROUPBOX "Screen Alignment && Margins",IDC_STATIC,116,2,174,66
+ CONTROL "",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON | WS_GROUP,124,
+ 37,11,8
+ CONTROL "",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,136,37,11,8
+ CONTROL "",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,148,37,11,8
+ CONTROL "",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,124,26,11,8
+ CONTROL "",IDC_RADIO7,"Button",BS_AUTORADIOBUTTON,136,26,11,8
+ CONTROL "",IDC_RADIO8,"Button",BS_AUTORADIOBUTTON,148,26,11,8
+ CONTROL "",IDC_RADIO9,"Button",BS_AUTORADIOBUTTON,124,15,11,8
+ CONTROL "",IDC_RADIO10,"Button",BS_AUTORADIOBUTTON,136,15,11,8
+ CONTROL "",IDC_RADIO11,"Button",BS_AUTORADIOBUTTON,148,15,11,8
+ LTEXT "Left",IDC_STATIC,166,17,14,8
+ EDITTEXT IDC_EDIT7,188,14,30,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN6,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,217,14,11,14
+ LTEXT "Right",IDC_STATIC,166,34,18,8
+ EDITTEXT IDC_EDIT8,188,32,30,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,217,32,11,14
+ LTEXT "Top",IDC_STATIC,223,17,13,8
+ EDITTEXT IDC_EDIT9,251,14,30,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,280,12,11,14
+ LTEXT "Bottom",IDC_STATIC,223,34,24,8
+ EDITTEXT IDC_EDIT10,251,32,30,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT |
+ UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS |
+ UDS_NOTHOUSANDS,280,32,11,14
+ GROUPBOX "Colors && Transparency",IDC_STATIC,116,70,174,108
+ LTEXT "Primary",IDC_STATIC,123,95,25,8
+ CONTROL "",IDC_COLORPRI,"Static",SS_OWNERDRAW | SS_NOTIFY,165,92,
+ 16,14,WS_EX_DLGMODALFRAME
+ CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
+ TBS_NOTICKS | WS_TABSTOP,187,94,92,12
+ LTEXT "Secondary",IDC_STATIC,123,112,34,8
+ CONTROL "",IDC_COLORSEC,"Static",SS_OWNERDRAW | SS_NOTIFY,165,
+ 109,16,14,WS_EX_DLGMODALFRAME
+ CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_BOTH |
+ TBS_NOTICKS | WS_TABSTOP,187,111,92,12
+ LTEXT "Outline",IDC_STATIC,123,129,24,8
+ CONTROL "",IDC_COLOROUTL,"Static",SS_OWNERDRAW | SS_NOTIFY,165,
+ 126,16,14,WS_EX_DLGMODALFRAME
+ CONTROL "",IDC_SLIDER3,"msctls_trackbar32",TBS_BOTH |
+ TBS_NOTICKS | WS_TABSTOP,187,128,92,12
+ LTEXT "Shadow",IDC_STATIC,123,146,26,8
+ CONTROL "",IDC_COLORSHAD,"Static",SS_OWNERDRAW | SS_NOTIFY,165,
+ 143,16,14,WS_EX_DLGMODALFRAME
+ CONTROL "",IDC_SLIDER4,"msctls_trackbar32",TBS_BOTH |
+ TBS_NOTICKS | WS_TABSTOP,187,145,92,12
+ CONTROL "Link alpha channels",IDC_CHECK1,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,195,161,76,10
+ LTEXT "100%",IDC_STATIC,265,83,20,8
+ LTEXT "0%",IDC_STATIC,190,83,12,8
+ CONTROL "Position subtitles relative to the video frame",
+ IDC_CHECK_RELATIVETO,"Button",BS_AUTO3STATE | WS_TABSTOP,
+ 125,51,157,10
+END
+
+IDD_PPAGEINTERNALFILTERS DIALOGEX 0, 0, 296, 200
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Source Filters",IDC_STATIC,5,33,130,159
+ LTEXT "If you would like to use the stand-alone version from these filters or a some other replacement, disable them here. Filters written bold can be double-clicked to show their property pages.",
+ IDC_STATIC,5,4,269,25
+ LISTBOX IDC_LIST1,11,44,118,142,LBS_OWNERDRAWFIXED |
+ LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
+ WS_TABSTOP
+ GROUPBOX "Transform Filters",IDC_STATIC,144,33,130,159
+ LISTBOX IDC_LIST2,150,44,118,142,LBS_OWNERDRAWFIXED |
+ LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
+ WS_TABSTOP
+END
+
+IDD_PPAGELOGO DIALOGEX 0, 0, 296, 203
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0xEE
+BEGIN
+ CONTROL "",IDC_LOGOPREVIEW,"Static",SS_BITMAP | SS_CENTERIMAGE,5,
+ 5,284,150
+ CONTROL "Internal:",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON |
+ WS_GROUP,5,164,44,10
+ CONTROL "External:",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,5,181,
+ 45,10
+ EDITTEXT IDC_LOGOFILENAME,51,179,182,14,ES_AUTOHSCROLL |
+ ES_READONLY
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS | UDS_HORZ,
+ 51,163,36,12
+ PUSHBUTTON "Browse...",IDC_BUTTON2,239,179,50,14
+ RTEXT "",IDC_AUTHOR,95,164,194,9
+END
+
+IDD_PPAGEOUTPUT DIALOGEX 0, 0, 296, 203
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0xEE
+BEGIN
+ GROUPBOX "DirectShow Video",IDC_STATIC,5,2,95,126
+ CONTROL "System Default",IDC_DSSYSDEF,"Button",
+ BS_AUTORADIOBUTTON | WS_GROUP,13,15,65,10
+ CONTROL "Old Renderer",IDC_DSOLD,"Button",BS_AUTORADIOBUTTON,13,
+ 26,59,10
+ CONTROL "Overlay Mixer *",IDC_DSOVERLAYMIXER,"Button",
+ BS_AUTORADIOBUTTON,13,37,67,10
+ CONTROL "VMR7 (windowed)",IDC_DSVMR7WIN,"Button",
+ BS_AUTORADIOBUTTON,13,48,73,10
+ CONTROL "VMR9 (windowed)",IDC_DSVMR9WIN,"Button",
+ BS_AUTORADIOBUTTON,13,59,73,10
+ CONTROL "VMR7 (renderless) **",IDC_DSVMR7REN,"Button",
+ BS_AUTORADIOBUTTON,13,70,85,10
+ CONTROL "VMR9 (renderless) **",IDC_DSVMR9REN,"Button",
+ BS_AUTORADIOBUTTON,13,81,85,10
+ CONTROL "Haali's Video Renderer",IDC_DSDXR,"Button",
+ BS_AUTORADIOBUTTON,13,92,83,10
+ CONTROL "Null (anything)",IDC_DSNULL_COMP,"Button",
+ BS_AUTORADIOBUTTON,13,103,63,10
+ CONTROL "Null (uncompressed)",IDC_DSNULL_UNCOMP,"Button",
+ BS_AUTORADIOBUTTON,13,114,81,10
+ GROUPBOX "RealMedia Video",IDC_STATIC,105,2,89,50
+ CONTROL "System Default *",IDC_RMSYSDEF,"Button",
+ BS_AUTORADIOBUTTON | WS_GROUP,113,14,71,10
+ CONTROL "DirectX 7 **",IDC_RMDX7,"Button",BS_AUTORADIOBUTTON,113,
+ 25,55,10
+ CONTROL "DirectX 9 **",IDC_RMDX9,"Button",BS_AUTORADIOBUTTON,113,
+ 36,55,10
+ GROUPBOX "QuickTime Video",IDC_STATIC,199,2,89,50
+ CONTROL "System Default *",IDC_QTSYSDEF,"Button",
+ BS_AUTORADIOBUTTON | WS_GROUP,207,14,71,10
+ CONTROL "DirectX 7 **",IDC_QTDX7,"Button",BS_AUTORADIOBUTTON,207,
+ 25,55,10
+ CONTROL "DirectX 9 **",IDC_QTDX9,"Button",BS_AUTORADIOBUTTON,207,
+ 36,55,10
+ GROUPBOX """VMR7/9 (renderless)"" && ""DirectX 7/9"" settings",
+ IDC_STATIC,105,53,183,75
+ CONTROL "Use regular offscreen plain surfaces",IDC_REGULARSURF,
+ "Button",BS_AUTORADIOBUTTON | WS_GROUP,113,64,131,10
+ CONTROL "Use texture surfaces and render video in 2D",
+ IDC_TEXTURESURF2D,"Button",BS_AUTORADIOBUTTON,113,75,158,
+ 10
+ CONTROL "Use texture surfaces and render video in 3D ***",
+ IDC_TEXTURESURF3D,"Button",BS_AUTORADIOBUTTON,113,86,172,
+ 10
+ LTEXT "Resizer:",IDC_STATIC,134,99,27,8
+ COMBOBOX IDC_DX9RESIZER_COMBO,163,98,94,49,CBS_DROPDOWNLIST |
+ WS_VSCROLL | WS_TABSTOP
+ GROUPBOX "DirectShow Audio",IDC_STATIC,5,129,283,28
+ COMBOBOX IDC_COMBO1,14,139,266,66,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ CONTROL "Lock back-buffer before presenting (may fix broken vertical syncronization)",
+ IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,160,
+ 263,10
+ LTEXT "* Saving images won't work with these renderers",
+ IDC_STATIC,13,171,158,8
+ LTEXT "** Required for loading subtitles",IDC_STATIC,13,181,
+ 104,8
+ LTEXT "*** Required for image rotation and pixelshaders (DX9-only)",
+ IDC_STATIC,13,190,195,8
+ CONTROL "VMR9 mixer mode",IDC_DSVMR9LOADMIXER,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,113,113,73,10
+ CONTROL "YUV mixing",IDC_DSVMR9YUVMIXER,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,191,113,51,10
+END
+
+IDD_AUTH_DLG DIALOGEX 0, 0, 213, 146
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Authentication needed"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,100,125,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,154,125,50,14
+ CONTROL 337,IDC_STATIC,"Static",SS_BITMAP,0,0,213,37
+ LTEXT "Restricted area",IDC_STATIC,13,48,50,8
+ LTEXT "Username:",IDC_STATIC,13,66,36,8
+ LTEXT "Password:",IDC_STATIC,13,83,34,8
+ COMBOBOX IDC_COMBO1,75,64,129,56,CBS_DROPDOWN | CBS_SORT |
+ WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT3,75,81,129,13,ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Remember my password",IDC_CHECK1,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,75,99,94,10
+END
+
+IDD_PPAGEWEBSERVER DIALOGEX 0, 0, 296, 178
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "Listen on port:",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,7,4,63,10
+ EDITTEXT IDC_EDIT1,71,3,40,12,ES_AUTOHSCROLL
+ LTEXT "Launch in web browser...",IDC_STATIC1,129,5,152,8
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,19,282,1
+ CONTROL "Enable compression",IDC_CHECK3,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,7,25,79,10
+ CONTROL "Print debug info",IDC_CHECK2,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,7,51,67,10
+ CONTROL "Serve pages from:",IDC_CHECK4,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,7,72,75,10
+ EDITTEXT IDC_EDIT2,7,85,183,14,ES_AUTOHSCROLL
+ PUSHBUTTON "Browse...",IDC_BUTTON1,194,85,45,14
+ PUSHBUTTON "Deploy...",IDC_BUTTON2,243,85,46,14
+ CONTROL "Allow access from localhost only",IDC_CHECK5,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,38,118,10
+ LTEXT "CGI handlers: (.ext1=path1;.ext2=path2;...)",IDC_STATIC,
+ 8,132,148,8
+ EDITTEXT IDC_EDIT3,7,144,282,14,ES_AUTOHSCROLL
+ CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,65,281,1
+ LTEXT "Default page:",IDC_STATIC,7,103,45,8
+ EDITTEXT IDC_EDIT9,7,114,282,14,ES_AUTOHSCROLL
+END
+
+IDD_SUBTITLEDL_DLG DIALOGEX 0, 0, 377, 158
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Subtitles available online"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "Download && Open",IDOK,272,136,98,14
+ CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT |
+ WS_BORDER | WS_TABSTOP,7,7,363,124
+ CONTROL "Replace currently loaded subtitles",IDC_CHECK1,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,138,124,10
+END
+
+IDD_FILEPROPRES DIALOGEX 0, 0, 234, 202
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ ICON "",IDC_DEFAULTICON,8,8,21,20,SS_REALSIZEIMAGE
+ EDITTEXT IDC_EDIT1,35,16,186,12,ES_AUTOHSCROLL | ES_READONLY |
+ NOT WS_BORDER
+ CONTROL "",-1,"Static",SS_ETCHEDHORZ,8,35,213,1
+ PUSHBUTTON "Save As...",IDC_BUTTON1,8,182,50,14
+ CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SINGLESEL |
+ LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_ALIGNLEFT |
+ WS_BORDER | WS_TABSTOP,8,43,213,134
+END
+
+IDD_SHADERCOMBINE_DLG DIALOGEX 0, 0, 225, 153
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Shader Combiner"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LISTBOX IDC_LIST1,7,7,157,117,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
+ WS_TABSTOP
+ DEFPUSHBUTTON "OK",IDOK,168,7,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,168,23,50,14
+ PUSHBUTTON "Move &Up",IDC_BUTTON1,168,57,50,14
+ PUSHBUTTON "Move &Down",IDC_BUTTON4,168,73,50,14
+ PUSHBUTTON "&Remove",IDC_BUTTON3,168,110,50,14
+ CONTROL "",IDC_STATIC1,"Static",SS_ETCHEDHORZ,7,128,211,1
+ COMBOBOX IDC_COMBO1,7,133,157,120,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ PUSHBUTTON "&Add",IDC_BUTTON2,168,132,50,14
+END
+
+IDD_SHADEREDITOR_DLG DIALOGEX 0, 0, 198, 71
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ COMBOBOX IDC_COMBO1,0,0,115,51,CBS_DROPDOWN | CBS_SORT |
+ WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT1,0,15,198,27,ES_MULTILINE | ES_AUTOVSCROLL |
+ ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL
+ COMBOBOX IDC_COMBO2,117,0,47,42,CBS_DROPDOWN | CBS_SORT |
+ WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT2,0,44,198,26,ES_MULTILINE | ES_AUTOHSCROLL |
+ ES_READONLY | WS_VSCROLL
+ PUSHBUTTON "Delete",IDC_BUTTON1,166,0,32,13
+END
+
+IDD_SHADERAUTOCOMPLETE_DLG DIALOGEX 0, 0, 99, 81
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_SYSMENU | WS_THICKFRAME
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LISTBOX IDC_LIST1,0,0,99,81,LBS_SORT | LBS_NOINTEGRALHEIGHT |
+ NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP
+END
+
+IDD_CONVERT_DLG DIALOGEX 0, 0, 322, 190
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP |
+ WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+EXSTYLE WS_EX_ACCEPTFILES
+CAPTION "DSM Converter - Right click the empty area to add media files"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_TREE1,"SysTreeView32",TVS_HASBUTTONS |
+ TVS_LINESATROOT | TVS_SHOWSELALWAYS | WS_BORDER |
+ WS_TABSTOP,5,5,312,138
+ PUSHBUTTON "Save &As...",IDC_BUTTON1,267,146,50,14
+ EDITTEXT IDC_EDIT1,5,146,259,14,ES_AUTOHSCROLL | ES_READONLY
+ PUSHBUTTON "Start",IDC_BUTTON2,83,171,50,14
+ PUSHBUTTON "Pause",IDC_BUTTON3,136,171,50,14
+ PUSHBUTTON "Stop",IDC_BUTTON4,188,171,50,14
+ CONTROL "",IDC_HLINE,"Static",SS_ETCHEDHORZ,5,165,310,1
+END
+
+IDD_CONVERTPROPS_DLG DIALOGEX 0, 0, 266, 145
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Properties"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ PUSHBUTTON "OK",IDOK,81,125,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,133,125,50,14
+ COMBOBOX IDC_COMBO1,7,7,48,82,CBS_DROPDOWN | CBS_SORT |
+ WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT1,56,7,167,13,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "Set",IDC_BUTTON1,225,7,34,13
+ CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SINGLESEL |
+ LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER |
+ WS_TABSTOP,7,22,252,98
+END
+
+IDD_CONVERTRES_DLG DIALOGEX 0, 0, 230, 126
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Resource"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,64,106,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,116,106,50,14
+ COMBOBOX IDC_COMBO1,7,40,216,30,CBS_DROPDOWN | CBS_SORT |
+ WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT2,7,65,216,36,ES_MULTILINE | ES_AUTOHSCROLL |
+ ES_WANTRETURN
+ EDITTEXT IDC_EDIT3,7,16,216,13,ES_AUTOHSCROLL
+ LTEXT "Name",IDC_STATIC,7,6,19,8
+ LTEXT "Mime",IDC_STATIC,7,30,17,8
+ LTEXT "Description",IDC_STATIC,7,55,36,8
+END
+
+IDD_CONVERTCHAP_DLG DIALOGEX 0, 0, 213, 46
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
+ WS_SYSMENU
+CAPTION "Chapter"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,55,25,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,107,25,50,14
+ EDITTEXT IDC_EDIT2,72,7,134,13,ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT1,7,7,61,13,ES_AUTOHSCROLL
+END
+
+IDD_PPAGECASIMIR DIALOGEX 0, 0, 296, 203
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0xEE
+BEGIN
+ GROUPBOX "Video",IDC_STATIC,5,2,283,48
+ CONTROL "Automatic refresh rate",IDC_AUTO_REFRESHRATE_CHECK,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,32,98,10
+ CONTROL "Direct3D Fullscreen",IDC_FULLSCREEN_MONITOR_CHECK,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,18,77,10
+ GROUPBOX " VMR9 Color controls ",IDC_STATIC,5,91,283,109
+ CONTROL "",IDC_SLI_CONTRAST,"msctls_trackbar32",TBS_AUTOTICKS |
+ TBS_TOOLTIPS | WS_DISABLED | WS_TABSTOP,55,105,233,13
+ LTEXT "Contrast",IDC_STATIC,13,107,29,8
+ LTEXT "Brightness",IDC_STATIC,13,126,34,8
+ LTEXT "Hue",IDC_STATIC,13,145,14,8
+ LTEXT "Saturation",IDC_STATIC,13,164,34,8
+ CONTROL "",IDC_SLI_BRIGHTNESS,"msctls_trackbar32",TBS_AUTOTICKS |
+ TBS_TOOLTIPS | WS_DISABLED | WS_TABSTOP,55,124,233,13
+ CONTROL "",IDC_SLI_HUE,"msctls_trackbar32",TBS_AUTOTICKS |
+ TBS_TOOLTIPS | WS_DISABLED | WS_TABSTOP,55,143,233,13
+ CONTROL "",IDC_SLI_SATURATION,"msctls_trackbar32",TBS_AUTOTICKS |
+ TBS_TOOLTIPS | WS_DISABLED | WS_TABSTOP,55,162,233,13
+ PUSHBUTTON "Reset",IDC_RESET,13,182,59,14
+ CONTROL "Remember DVD position",IDC_DVD_POS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,134,19,92,10
+ CONTROL "Remember File position",IDC_FILE_POS,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,134,34,89,10
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_SELECTMEDIATYPE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 218
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 40
+ END
+
+ IDD_OPENCAPDEVICE_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 219
+ VERTGUIDE, 12
+ VERTGUIDE, 47
+ VERTGUIDE, 212
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 124
+ END
+
+ IDD_CAPTURE_DLG, DIALOG
+ BEGIN
+ RIGHTMARGIN, 125
+ VERTGUIDE, 3
+ VERTGUIDE, 10
+ VERTGUIDE, 47
+ VERTGUIDE, 50
+ VERTGUIDE, 72
+ VERTGUIDE, 74
+ VERTGUIDE, 112
+ VERTGUIDE, 119
+ END
+
+ IDD_PPAGEAUDIOSWITCHER, DIALOG
+ BEGIN
+ VERTGUIDE, 7
+ VERTGUIDE, 289
+ BOTTOMMARGIN, 193
+ END
+
+ IDD_GOTO_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 150
+ VERTGUIDE, 31
+ VERTGUIDE, 114
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 106
+ END
+
+ IDD_OPEN_DLG, DIALOG
+ BEGIN
+ VERTGUIDE, 7
+ VERTGUIDE, 33
+ VERTGUIDE, 182
+ VERTGUIDE, 187
+ VERTGUIDE, 234
+ BOTTOMMARGIN, 86
+ HORZGUIDE, 9
+ END
+
+ IDD_ABOUTBOX, DIALOG
+ BEGIN
+ VERTGUIDE, 40
+ VERTGUIDE, 210
+ END
+
+ IDD_PPAGEPLAYER, DIALOG
+ BEGIN
+ VERTGUIDE, 15
+ VERTGUIDE, 140
+ VERTGUIDE, 289
+ BOTTOMMARGIN, 192
+ END
+
+ IDD_PPAGEDVD, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 15
+ VERTGUIDE, 240
+ HORZGUIDE, 57
+ END
+
+ IDD_PPAGEPLAYBACK, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 13
+ VERTGUIDE, 137
+ VERTGUIDE, 193
+ VERTGUIDE, 289
+ END
+
+ IDD_PPAGESUBTITLES, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 14
+ VERTGUIDE, 281
+ VERTGUIDE, 289
+ BOTTOMMARGIN, 200
+ END
+
+ IDD_PPAGESUBDB, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 289
+ BOTTOMMARGIN, 200
+ END
+
+ IDD_PPAGEFORMATS, DIALOG
+ BEGIN
+ VERTGUIDE, 6
+ VERTGUIDE, 13
+ VERTGUIDE, 281
+ VERTGUIDE, 289
+ END
+
+ IDD_PPAGETWEAKS, DIALOG
+ BEGIN
+ RIGHTMARGIN, 289
+ VERTGUIDE, 7
+ VERTGUIDE, 15
+ VERTGUIDE, 289
+ END
+
+ IDD_FILEPROPDETAILS, DIALOG
+ BEGIN
+ VERTGUIDE, 8
+ VERTGUIDE, 60
+ VERTGUIDE, 73
+ VERTGUIDE, 221
+ HORZGUIDE, 42
+ HORZGUIDE, 55
+ HORZGUIDE, 68
+ HORZGUIDE, 81
+ HORZGUIDE, 94
+ END
+
+ IDD_FILEPROPCLIP, DIALOG
+ BEGIN
+ VERTGUIDE, 8
+ VERTGUIDE, 35
+ VERTGUIDE, 58
+ VERTGUIDE, 221
+ HORZGUIDE, 42
+ HORZGUIDE, 55
+ HORZGUIDE, 68
+ HORZGUIDE, 81
+ HORZGUIDE, 108
+ END
+
+ IDD_FAVADD, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 245
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 63
+ END
+
+ IDD_FAVORGANIZE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 269
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 167
+ END
+
+ IDD_PNSPRESET_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 196
+ VERTGUIDE, 135
+ VERTGUIDE, 168
+ VERTGUIDE, 196
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 114
+ END
+
+ IDD_PPAGEACCELTBL, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 289
+ BOTTOMMARGIN, 197
+ HORZGUIDE, 169
+ HORZGUIDE, 186
+ END
+
+ IDD_MEDIATYPES_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 289
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 212
+ END
+
+ IDD_SAVE_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 242
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 82
+ END
+
+ IDD_SAVETHUMBSDIALOGTEMPL, DIALOG
+ BEGIN
+ VERTGUIDE, 68
+ VERTGUIDE, 130
+ END
+
+ IDD_SAVETHUMBSDIALOGTEMPL_400, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 54
+ BOTTOMMARGIN, 30
+ END
+
+ IDD_ADDREGFILTER, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 280
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 177
+ HORZGUIDE, 159
+ END
+
+ IDD_PPAGEINTERNALFILTERS, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 274
+ VERTGUIDE, 289
+ HORZGUIDE, 29
+ HORZGUIDE, 33
+ HORZGUIDE, 44
+ HORZGUIDE, 186
+ HORZGUIDE, 192
+ HORZGUIDE, 198
+ END
+
+ IDD_PPAGELOGO, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 289
+ BOTTOMMARGIN, 200
+ HORZGUIDE, 5
+ HORZGUIDE, 155
+ HORZGUIDE, 163
+ END
+
+ IDD_PPAGEOUTPUT, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 13
+ VERTGUIDE, 288
+ BOTTOMMARGIN, 200
+ END
+
+ IDD_AUTH_DLG, DIALOG
+ BEGIN
+ VERTGUIDE, 13
+ VERTGUIDE, 75
+ VERTGUIDE, 204
+ BOTTOMMARGIN, 139
+ END
+
+ IDD_PPAGEWEBSERVER, DIALOG
+ BEGIN
+ RIGHTMARGIN, 289
+ VERTGUIDE, 7
+ VERTGUIDE, 289
+ END
+
+ IDD_SUBTITLEDL_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 370
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 151
+ END
+
+ IDD_FILEPROPRES, DIALOG
+ BEGIN
+ VERTGUIDE, 8
+ VERTGUIDE, 35
+ VERTGUIDE, 221
+ END
+
+ IDD_SHADERCOMBINE_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 218
+ VERTGUIDE, 164
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 146
+ END
+
+ IDD_SHADEREDITOR_DLG, DIALOG
+ BEGIN
+ BOTTOMMARGIN, 70
+ END
+
+ IDD_CONVERT_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 317
+ VERTGUIDE, 12
+ TOPMARGIN, 5
+ BOTTOMMARGIN, 185
+ END
+
+ IDD_CONVERTPROPS_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 259
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 139
+ END
+
+ IDD_CONVERTRES_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 223
+ TOPMARGIN, 6
+ BOTTOMMARGIN, 120
+ END
+
+ IDD_CONVERTCHAP_DLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 206
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 39
+ END
+
+ IDD_PPAGECASIMIR, DIALOG
+ BEGIN
+ VERTGUIDE, 5
+ VERTGUIDE, 13
+ VERTGUIDE, 288
+ BOTTOMMARGIN, 200
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDB_ONOFF BITMAP "res\\onoff.bmp"
+IDB_PLAYERTOOLBAR BITMAP "res\\toolbar1.bmp"
+IDB_MONO BITMAP "res\\mono.bmp"
+IDB_STEREO BITMAP "res\\stereo.bmp"
+IDB_NOAUDIO BITMAP "res\\noaudio.bmp"
+IDB_LOGO0 BITMAP "res\\logo.0.bmp"
+IDB_LOGO1 BITMAP "res\\logo.1.bmp"
+IDB_LOGO2 BITMAP "res\\logo.2.bmp"
+IDB_LOGO3 BITMAP "res\\logo.3.bmp"
+IDB_LOGO4 BITMAP "res\\logo.4.bmp"
+IDB_LOGO5 BITMAP "res\\logo.5.bmp"
+IDB_LOGO6 BITMAP "res\\logo.6.bmp"
+IDB_AUTHHDRPIC BITMAP "res\\authhdrpic.bmp"
+IDB_LOGO7 BITMAP "res\\logo.7.bmp"
+IDB_STREAMTYPES BITMAP "res\\streamtypes.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// FILE
+//
+
+IDF_SHADER_EMPTY FILE "res\\shaders\\empty.psh"
+IDF_SHADER_CONTOUR FILE "res\\shaders\\contour.psh"
+IDF_SHADER_DEINTERLACE FILE "res\\shaders\\deinterlace (blend).psh"
+IDF_SHADER_EMBOSS FILE "res\\shaders\\emboss.psh"
+IDF_SHADER_GRAYSCALE FILE "res\\shaders\\grayscale.psh"
+IDF_SHADER_INVERT FILE "res\\shaders\\invert.psh"
+IDF_SHADER_LETTERBOX FILE "res\\shaders\\letterbox.psh"
+IDF_SHADER_PROCAMP FILE "res\\shaders\\procamp.psh"
+IDF_SHADER_SHARPEN FILE "res\\shaders\\sharpen.psh"
+IDF_SHADER_SPHERE FILE "res\\shaders\\sphere.psh"
+IDF_SHADER_SPOTLIGHT FILE "res\\shaders\\spotlight.psh"
+IDF_SHADER_WAVE FILE "res\\shaders\\wave.psh"
+IDF_DEFAULT_CSS FILE "res\\web\\default.css"
+IDF_VBR_GIF FILE "res\\web\\vbg.gif"
+IDF_VBS_GIF FILE "res\\web\\vbs.GIF"
+IDF_SLIDERBAR_GIF FILE "res\\web\\sliderbar.gif"
+IDF_SLIDERGRIP_GIF FILE "res\\web\\slidergrip.gif"
+IDF_1PIX_GIF FILE "res\\web\\1pix.gif"
+IDF_SLIDERBACK_GIF FILE "res\\web\\sliderback.gif"
+IDF_HEADERICON_PNG FILE "res\\web\\headericon.png"
+IDF_HEADERBACK_PNG FILE "res\\web\\headerback.png"
+IDF_HEADERCLOSE_PNG FILE "res\\web\\headerclose.png"
+IDF_LEFTSIDE_PNG FILE "res\\web\\leftside.png"
+IDF_RIGHTSIDE_PNG FILE "res\\web\\rightside.png"
+IDF_BOTTOMSIDE_PNG FILE "res\\web\\bottomside.png"
+IDF_LEFTBOTTOMSIDE_PNG FILE "res\\web\\leftbottomside.png"
+IDF_RIGHTBOTTOMSIDE_PNG FILE "res\\web\\rightbottomside.png"
+IDF_SEEKBARLEFT_PNG FILE "res\\web\\seekbarleft.png"
+IDF_SEEKBARMID_PNG FILE "res\\web\\seekbarmid.png"
+IDF_SEEKBARRIGHT_PNG FILE "res\\web\\seekbarright.png"
+IDF_SEEKBARGRIP_PNG FILE "res\\web\\seekbargrip.png"
+IDF_LOGO_PNG FILE "res\\web\\logo.png"
+IDF_CONTROLBACK_PNG FILE "res\\web\\controlback.png"
+IDF_CONTROLBUTTONPLAY_PNG FILE "res\\web\\controlbuttonplay.png"
+IDF_CONTROLBUTTONPAUSE_PNG FILE "res\\web\\controlbuttonpause.png"
+IDF_CONTROLBUTTONSTOP_PNG FILE "res\\web\\controlbuttonstop.png"
+IDF_CONTROLBUTTONSKIPBACK_PNG FILE "res\\web\\controlbuttonskipback.png"
+IDF_CONTROLBUTTONDECRATE_PNG FILE "res\\web\\controlbuttondecrate.png"
+IDF_CONTROLBUTTONINCRATE_PNG FILE "res\\web\\controlbuttonincrate.png"
+IDF_CONTROLBUTTONSKIPFORWARD_PNG FILE "res\\web\\controlbuttonskipforward.png"
+IDF_CONTROLBUTTONSTEP_PNG FILE "res\\web\\controlbuttonstep.png"
+IDF_CONTROLVOLUMEON_PNG FILE "res\\web\\controlvolumeon.png"
+IDF_CONTROLVOLUMEOFF_PNG FILE "res\\web\\controlvolumeoff.png"
+IDF_CONTROLVOLUMEBAR_PNG FILE "res\\web\\controlvolumebar.png"
+IDF_CONTROLVOLUMEGRIP_PNG FILE "res\\web\\controlvolumegrip.png"
+IDF_SHADER_RESIZER FILE "res\\shaders\\resizer.psh"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\icon.ico"
+IDI_SINGLE ICON "res\\single.ico"
+IDI_MULTI ICON "res\\multi.ico"
+IDI_AUDIOCD ICON "res\\Icon_41.ico"
+IDI_DVD ICON "res\\Icon_114.ico"
+IDI_UNKNOWN ICON "res\\Icon_116.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Toolbar
+//
+
+IDB_PLAYERTOOLBAR TOOLBAR 16, 16
+BEGIN
+ BUTTON ID_PLAY_PLAY
+ BUTTON ID_PLAY_PAUSE
+ BUTTON ID_PLAY_STOP
+ BUTTON ID_BUTTONSEP
+ BUTTON ID_NAVIGATE_SKIPBACK
+ BUTTON ID_PLAY_DECRATE
+ BUTTON ID_PLAY_INCRATE
+ BUTTON ID_NAVIGATE_SKIPFORWARD
+ BUTTON ID_BUTTONSEP
+ BUTTON ID_PLAY_FRAMESTEP
+ BUTTON ID_BUTTONSEP
+ BUTTON ID_DUMMYSEPARATOR
+ BUTTON ID_VOLUME_MUTE
+ BUTTON ID_VOLUME_MUTE_ON
+ BUTTON ID_VOLUME_MUTE_DISABLED
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_PPAGEPLAYBACK DLGINIT
+BEGIN
+ IDC_COMBO1, 0x403, 4, 0
+0x3035, 0x0025,
+ IDC_COMBO1, 0x403, 5, 0
+0x3031, 0x2530, "\000"
+ IDC_COMBO1, 0x403, 5, 0
+0x3032, 0x2530, "\000"
+ IDC_COMBO1, 0x403, 9, 0
+0x7541, 0x6f74, 0x4620, 0x7469, "\000"
+ 0
+END
+
+IDD_PPAGEOUTPUT DLGINIT
+BEGIN
+ IDC_DX9RESIZER_COMBO, 0x403, 17, 0
+0x654e, 0x7261, 0x7365, 0x2074, 0x656e, 0x6769, 0x6268, 0x726f, "\000"
+ IDC_DX9RESIZER_COMBO, 0x403, 9, 0
+0x6942, 0x696c, 0x656e, 0x7261, "\000"
+ IDC_DX9RESIZER_COMBO, 0x403, 18, 0
+0x6942, 0x696c, 0x656e, 0x7261, 0x2820, 0x5350, 0x3220, 0x302e, 0x0029,
+
+ IDC_DX9RESIZER_COMBO, 0x403, 25, 0
+0x6942, 0x7563, 0x6962, 0x2063, 0x3d41, 0x302d, 0x362e, 0x2030, 0x5028,
+0x2053, 0x2e32, 0x2930, "\000"
+ IDC_DX9RESIZER_COMBO, 0x403, 25, 0
+0x6942, 0x7563, 0x6962, 0x2063, 0x3d41, 0x302d, 0x372e, 0x2035, 0x5028,
+0x2053, 0x2e32, 0x2930, "\000"
+ IDC_DX9RESIZER_COMBO, 0x403, 25, 0
+0x6942, 0x7563, 0x6962, 0x2063, 0x3d41, 0x312d, 0x302e, 0x2030, 0x5028,
+0x2053, 0x2e32, 0x2930, "\000"
+ 0
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,1,4,1
+ PRODUCTVERSION 6,4,9,0
+ FILEFLAGSMASK 0x1fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/ Modify by Casimir666"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Media Player Classic"
+ VALUE "FileVersion", "1, 1, 4, 1"
+ VALUE "InternalName", "Media Player Classic"
+ VALUE "LegalCopyright", "Copyright (C) 2002-2006 Gabest"
+ VALUE "OriginalFilename", "mplayerc.EXE"
+ VALUE "ProductName", "Media Player Classic"
+ VALUE "ProductVersion", "6, 4, 9, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MAINFRAME MENU
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&Quick Open File...\tCtrl+Q", ID_FILE_OPENQUICK
+ MENUITEM SEPARATOR
+ MENUITEM "&Open File...\tCtrl+O", ID_FILE_OPENMEDIA
+ MENUITEM "Open &DVD...\tCtrl+D", ID_FILE_OPENDVD
+ MENUITEM "Open De&vice...\tCtrl+V", ID_FILE_OPENDEVICE
+ MENUITEM "O&pen Disc", ID_FILE_OPENDISC32774
+ MENUITEM "&Close\tCtrl+C", ID_FILE_CLOSEPLAYLIST
+ MENUITEM SEPARATOR
+ MENUITEM "&Save As...", ID_FILE_SAVE_COPY
+ MENUITEM "Save &Image...", ID_FILE_SAVE_IMAGE
+ MENUITEM "Save Thumbnails...", ID_FILE_SAVE_THUMBNAILS
+ MENUITEM SEPARATOR
+ MENUITEM "&Load Subtitle...\tCtrl+L", ID_FILE_LOAD_SUBTITLE
+ MENUITEM "Save Subtitle...\tCtrl+S", ID_FILE_SAVE_SUBTITLE
+ POPUP "Subtitle Database"
+ BEGIN
+ MENUITEM "Search...", ID_FILE_ISDB_SEARCH
+ MENUITEM "Upload...", ID_FILE_ISDB_UPLOAD
+ MENUITEM "Download...", ID_FILE_ISDB_DOWNLOAD
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "P&roperties", ID_FILE_PROPERTIES
+ MENUITEM SEPARATOR
+ POPUP "Utils"
+ BEGIN
+ MENUITEM "DSM Co&nverter...", ID_FILE_CONVERT
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit\tAlt+X", ID_FILE_EXIT
+ END
+ POPUP "&View"
+ BEGIN
+ MENUITEM "Caption&&Menu\tCtrl+0", ID_VIEW_CAPTIONMENU
+ MENUITEM "&Seek Bar\tCtrl+1", ID_VIEW_SEEKER
+ MENUITEM "Cont&rols\tCtrl+2", ID_VIEW_CONTROLS
+ MENUITEM "&Information\tCtrl+3", ID_VIEW_INFORMATION
+ MENUITEM "S&tatistics\tCtrl+4", ID_VIEW_STATISTICS
+ MENUITEM "St&atus\tCtrl+5", ID_VIEW_STATUS
+ MENUITEM "Subresync\tCtrl+6", ID_VIEW_SUBRESYNC
+ MENUITEM "Playlist\tCtrl+7", ID_VIEW_PLAYLIST
+ MENUITEM "Capture\tCtrl+8", ID_VIEW_CAPTURE
+ MENUITEM "Shader Editor\tCtrl+9", ID_VIEW_SHADEREDITOR
+ POPUP "Presets..."
+ BEGIN
+ MENUITEM "Minimal", ID_VIEW_PRESETS_MINIMAL
+ MENUITEM "Compact", ID_VIEW_PRESETS_COMPACT
+ MENUITEM "Normal", ID_VIEW_PRESETS_NORMAL
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "Fu&ll Screen\tAlt+Enter", ID_VIEW_FULLSCREEN
+ POPUP "&Zoom"
+ BEGIN
+ MENUITEM "&50%\tAlt+1", ID_VIEW_ZOOM_50
+ MENUITEM "&100%\tAlt+2", ID_VIEW_ZOOM_100
+ MENUITEM "&200%\tAlt+3", ID_VIEW_ZOOM_200
+ MENUITEM "Auto Fit\tAlt+4", ID_VIEW_ZOOM_AUTOFIT
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "&Tearing Test\tCtrl+T", ID_VIEW_TEARING_TEST
+ MENUITEM "Remaining Time\tCtrl+I", ID_VIEW_REMAINING_TIME
+ MENUITEM SEPARATOR
+ POPUP "&Video Frame"
+ BEGIN
+ MENUITEM "&Half Size", ID_VIEW_VF_HALF
+ MENUITEM "&Normal Size", ID_VIEW_VF_NORMAL
+ MENUITEM "&Double Size", ID_VIEW_VF_DOUBLE
+ MENUITEM "&Stretch To Window", ID_VIEW_VF_STRETCH
+ MENUITEM "Touch Window From &Inside", ID_VIEW_VF_FROMINSIDE
+ MENUITEM "Touch Window From &Outside", ID_VIEW_VF_FROMOUTSIDE
+ MENUITEM SEPARATOR
+ MENUITEM "&Keep Aspect Ratio", ID_VIEW_VF_KEEPASPECTRATIO
+
+ POPUP "Override Aspect Ratio"
+ BEGIN
+ MENUITEM "Default", ID_ASPECTRATIO_SOURCE
+
+ MENUITEM "4:3", ID_ASPECTRATIO_4_3
+ MENUITEM "5:4", ID_ASPECTRATIO_5_4
+ MENUITEM "16:9", ID_ASPECTRATIO_16_9
+ END
+ MENUITEM "Correct Monitor/Desktop AR Diff",
+ ID_VIEW_VF_COMPMONDESKARDIFF
+
+ END
+ POPUP "Pan&&S&can"
+ BEGIN
+ MENUITEM "Increase Size\tNumpad 9", ID_VIEW_INCSIZE
+ MENUITEM "Decrease Size\tNumpad 1", ID_VIEW_DECSIZE
+ MENUITEM "Increase Width\tNumpad 6", ID_VIEW_INCWIDTH
+ MENUITEM "Decrease Width\tNumpad 4", ID_VIEW_DECWIDTH
+ MENUITEM "Increase Height\tNumpad 8", ID_VIEW_INCHEIGHT
+ MENUITEM "Decrease Height\tNumpad 2", ID_VIEW_DECHEIGHT
+ MENUITEM SEPARATOR
+ MENUITEM "Move Right\tCtrl+Numpad 6", ID_PANSCAN_MOVERIGHT
+ MENUITEM "Move Left\tCtrl+Numpad 4", ID_PANSCAN_MOVELEFT
+ MENUITEM "Move Up\tCtrl+Numpad 8", ID_PANSCAN_MOVEUP
+ MENUITEM "Move Down\tCtrl+Numpad 2", ID_PANSCAN_MOVEDOWN
+ MENUITEM "Center\tCtrl+Numpad 5", ID_PANSCAN_CENTER
+ MENUITEM SEPARATOR
+ MENUITEM "Reset\tNumpad 5", ID_VIEW_RESET
+ END
+ MENUITEM SEPARATOR
+ POPUP "On Top"
+ BEGIN
+ MENUITEM "Never", ID_ONTOP_NEVER
+ MENUITEM "Always", ID_ONTOP_ALWAYS
+ MENUITEM "While Playing", ID_ONTOP_WHILEPLAYING
+ END
+ MENUITEM "&Options...", ID_VIEW_OPTIONS
+ END
+ POPUP "&Play"
+ BEGIN
+ MENUITEM "&Play/Pause\tSpace", ID_PLAY_PLAYPAUSE
+ MENUITEM "&Stop\tPeriod", ID_PLAY_STOP
+ MENUITEM "F&rame Step\tRight", ID_PLAY_FRAMESTEP
+ MENUITEM "&Go To...\tCtrl+G", ID_PLAY_GOTO
+ MENUITEM SEPARATOR
+ MENUITEM "&Decrease Rate\tCtrl+Down", ID_PLAY_DECRATE
+ MENUITEM "&Increase Rate\tCtrl+Up", ID_PLAY_INCRATE
+ MENUITEM "Reset Rate\tCtrl+R", ID_PLAY_RESETRATE
+ MENUITEM SEPARATOR
+ MENUITEM "&Filters", 65535
+ MENUITEM "S&haders", 65535
+ MENUITEM SEPARATOR
+ MENUITEM "&Audio", 65535
+ MENUITEM "Su&btitles", 65535
+ MENUITEM SEPARATOR
+ POPUP "Vol&ume"
+ BEGIN
+ MENUITEM "&Up\tUp Arrow", ID_VOLUME_UP
+ MENUITEM "&Down\tDown Arrow", ID_VOLUME_DOWN
+ MENUITEM "&Mute\tCtrl+M", ID_VOLUME_MUTE
+ END
+ POPUP "After Playback"
+ BEGIN
+ MENUITEM "Close ", ID_AFTERPLAYBACK_CLOSE
+ MENUITEM "Stand By", ID_AFTERPLAYBACK_STANDBY
+ MENUITEM "Hibernate", ID_AFTERPLAYBACK_HIBERNATE
+
+ MENUITEM "Shutdown", ID_AFTERPLAYBACK_SHUTDOWN
+
+ MENUITEM "Log Off", ID_AFTERPLAYBACK_LOGOFF
+ MENUITEM SEPARATOR
+ MENUITEM "Do Nothing", ID_AFTERPLAYBACK_DONOTHING
+
+ END
+ END
+ POPUP "&Navigate"
+ BEGIN
+ MENUITEM "&Previous\tPage Up", ID_NAVIGATE_SKIPBACK
+ MENUITEM "&Next\tPage Down", ID_NAVIGATE_SKIPFORWARD
+ MENUITEM "&Jump To...", 65535
+ MENUITEM SEPARATOR
+ MENUITEM "A&udio Language", 65535
+ MENUITEM "Su&btitle Language", 65535
+ MENUITEM "Video Ang&le", 65535
+ MENUITEM SEPARATOR
+ MENUITEM "Title Menu\tAlt+T", ID_NAVIGATE_TITLEMENU
+ MENUITEM "&Root Menu\tAlt+R", ID_NAVIGATE_ROOTMENU
+ MENUITEM "&Subtitle Menu", ID_NAVIGATE_SUBPICTUREMENU
+ MENUITEM "&Audio Menu", ID_NAVIGATE_AUDIOMENU
+ MENUITEM "An&gle Menu", ID_NAVIGATE_ANGLEMENU
+ MENUITEM "&Chapter Menu", ID_NAVIGATE_CHAPTERMENU
+ END
+ MENUITEM "F&avorites", ID_FAVORITES
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "Home Page", ID_HELP_HOMEPAGE
+ MENUITEM "Documentation (sf.net)", ID_HELP_DOCUMENTATION
+ MENUITEM "Command Line Switches", ID_HELP_SHOWCOMMANDLINESWITCHES
+
+ MENUITEM SEPARATOR
+ MENUITEM "Donate!", ID_HELP_DONATE
+ MENUITEM SEPARATOR
+ MENUITEM "&About...", ID_HELP_ABOUT
+ END
+END
+
+IDR_POPUP MENU
+BEGIN
+ POPUP ""
+ BEGIN
+ MENUITEM "&Play/Pause", ID_PLAY_PLAYPAUSE
+ MENUITEM "&Stop", ID_PLAY_STOP
+ MENUITEM SEPARATOR
+ MENUITEM "Fu&ll Screen", ID_VIEW_FULLSCREEN
+ POPUP "&Zoom"
+ BEGIN
+ MENUITEM "&50%\tAlt+1", ID_VIEW_ZOOM_50
+ MENUITEM "&100%\tAlt+2", ID_VIEW_ZOOM_100
+ MENUITEM "&200%\tAlt+3", ID_VIEW_ZOOM_200
+ MENUITEM "Auto Fit\tAlt+4", ID_VIEW_ZOOM_AUTOFIT
+ END
+ MENUITEM SEPARATOR
+ POPUP "&Video Frame"
+ BEGIN
+ MENUITEM "&Half Size", ID_VIEW_VF_HALF
+ MENUITEM "&Normal Size", ID_VIEW_VF_NORMAL
+ MENUITEM "&Double Size", ID_VIEW_VF_DOUBLE
+ MENUITEM "&Stretch To Window", ID_VIEW_VF_STRETCH
+ MENUITEM "Touch Window From &Inside", ID_VIEW_VF_FROMINSIDE
+ MENUITEM "Touch Window From &Outside", ID_VIEW_VF_FROMOUTSIDE
+ MENUITEM SEPARATOR
+ MENUITEM "&Keep Aspect Ratio", ID_VIEW_VF_KEEPASPECTRATIO
+
+ POPUP "Override Aspect Ratio"
+ BEGIN
+ MENUITEM "Default", ID_ASPECTRATIO_SOURCE
+
+ MENUITEM "4:3", ID_ASPECTRATIO_4_3
+ MENUITEM "5:4", ID_ASPECTRATIO_5_4
+ MENUITEM "16:9", ID_ASPECTRATIO_16_9
+ END
+ MENUITEM "Correct Monitor/Desktop AR Diff",
+ ID_VIEW_VF_COMPMONDESKARDIFF
+
+ END
+ POPUP "Pan&&S&can"
+ BEGIN
+ MENUITEM "Increase Size\tNumpad 9", ID_VIEW_INCSIZE
+ MENUITEM "Decrease Size\tNumpad 1", ID_VIEW_DECSIZE
+ MENUITEM "Increase Width\tNumpad 6", ID_VIEW_INCWIDTH
+ MENUITEM "Decrease Width\tNumpad 4", ID_VIEW_DECWIDTH
+ MENUITEM "Increase Height\tNumpad 8", ID_VIEW_INCHEIGHT
+ MENUITEM "Decrease Height\tNumpad 2", ID_VIEW_DECHEIGHT
+ MENUITEM SEPARATOR
+ MENUITEM "Move Right\tCtrl+Numpad 6", ID_PANSCAN_MOVERIGHT
+ MENUITEM "Move Left\tCtrl+Numpad 4", ID_PANSCAN_MOVELEFT
+ MENUITEM "Move Up\tCtrl+Numpad 8", ID_PANSCAN_MOVEUP
+ MENUITEM "Move Down\tCtrl+Numpad 2", ID_PANSCAN_MOVEDOWN
+ MENUITEM "Center\tCtrl+Numpad 5", ID_PANSCAN_CENTER
+ MENUITEM SEPARATOR
+ MENUITEM "Reset\tNumpad 5", ID_VIEW_RESET
+ END
+ MENUITEM SEPARATOR
+ POPUP "&Navigate"
+ BEGIN
+ MENUITEM "&Previous\tPage Up", ID_NAVIGATE_SKIPBACK
+ MENUITEM "&Next\tPage Down", ID_NAVIGATE_SKIPFORWARD
+ MENUITEM "&Jump To...", 65535
+ MENUITEM SEPARATOR
+ MENUITEM "A&udio Language", 65535
+ MENUITEM "Su&btitle Language", 65535
+ MENUITEM "Video Ang&le", 65535
+ MENUITEM SEPARATOR
+ MENUITEM "&Title Menu", ID_NAVIGATE_TITLEMENU
+ MENUITEM "&Root Menu", ID_NAVIGATE_ROOTMENU
+ MENUITEM "&Subtitle Menu", ID_NAVIGATE_SUBPICTUREMENU
+
+ MENUITEM "&Audio Menu", ID_NAVIGATE_AUDIOMENU
+ MENUITEM "An&gle Menu", ID_NAVIGATE_ANGLEMENU
+ MENUITEM "&Chapter Menu", ID_NAVIGATE_CHAPTERMENU
+ END
+ MENUITEM "&Favorites", 65535
+ MENUITEM SEPARATOR
+ MENUITEM "F&ilters", 65535
+ MENUITEM "S&haders", 65535
+ MENUITEM SEPARATOR
+ MENUITEM "&Audio", 65535
+ MENUITEM "Su&btitles", 65535
+ MENUITEM SEPARATOR
+ POPUP "Vol&ume"
+ BEGIN
+ MENUITEM "&Up\tUp Arrow", ID_VOLUME_UP
+ MENUITEM "&Down\tDown Arrow", ID_VOLUME_DOWN
+ MENUITEM "&Mute\tCtrl+M", ID_VOLUME_MUTE
+ END
+ POPUP "After Playback"
+ BEGIN
+ MENUITEM "Close ", ID_AFTERPLAYBACK_CLOSE
+ MENUITEM "Stand By", ID_AFTERPLAYBACK_STANDBY
+ MENUITEM "Hibernate", ID_AFTERPLAYBACK_HIBERNATE
+
+ MENUITEM "Shutdown", ID_AFTERPLAYBACK_SHUTDOWN
+
+ MENUITEM "Log Off", ID_AFTERPLAYBACK_LOGOFF
+ MENUITEM SEPARATOR
+ MENUITEM "Do Nothing", ID_AFTERPLAYBACK_DONOTHING
+
+ END
+ MENUITEM SEPARATOR
+ POPUP "Vi&ew"
+ BEGIN
+ POPUP "On Top"
+ BEGIN
+ MENUITEM "Never", ID_ONTOP_NEVER
+ MENUITEM "Always", ID_ONTOP_ALWAYS
+ MENUITEM "While Playing", ID_ONTOP_WHILEPLAYING
+
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "Caption&&Menu", ID_VIEW_CAPTIONMENU
+ MENUITEM "Seek Bar", ID_VIEW_SEEKER
+ MENUITEM "Cont&rols", ID_VIEW_CONTROLS
+ MENUITEM "&Information", ID_VIEW_INFORMATION
+ MENUITEM "St&atistics", ID_VIEW_STATISTICS
+ MENUITEM "S&tatus", ID_VIEW_STATUS
+ MENUITEM "Subresync", ID_VIEW_SUBRESYNC
+ MENUITEM "Playlist", ID_VIEW_PLAYLIST
+ MENUITEM "Capture", ID_VIEW_CAPTURE
+ MENUITEM "Shader Editor", ID_VIEW_SHADEREDITOR
+ POPUP "Presets..."
+ BEGIN
+ MENUITEM "Minimal", ID_VIEW_PRESETS_MINIMAL
+
+ MENUITEM "Compact", ID_VIEW_PRESETS_COMPACT
+
+ MENUITEM "Normal", ID_VIEW_PRESETS_NORMAL
+
+ END
+ END
+ MENUITEM "P&roperties", ID_FILE_PROPERTIES
+ MENUITEM "&Options...", ID_VIEW_OPTIONS
+ END
+END
+
+IDR_POPUPMAIN MENU
+BEGIN
+ POPUP ""
+ BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "&Quick Open File...\tCtrl+Q", ID_FILE_OPENQUICK
+ MENUITEM SEPARATOR
+ MENUITEM "&Open File...\tCtrl+O", ID_FILE_OPENMEDIA
+ MENUITEM "Open &DVD...\tCtrl+D", ID_FILE_OPENDVD
+ MENUITEM "Open De&vice...\tCtrl+V", ID_FILE_OPENDEVICE
+ MENUITEM "O&pen Disc", 65535
+ MENUITEM "&Close", ID_FILE_CLOSEPLAYLIST
+ MENUITEM SEPARATOR
+ MENUITEM "&Save As...", ID_FILE_SAVE_COPY
+ MENUITEM "Save Image...", ID_FILE_SAVE_IMAGE
+ MENUITEM "Save Thumbnails...", ID_FILE_SAVE_THUMBNAILS
+ MENUITEM SEPARATOR
+ MENUITEM "&Load Subtitle...\tCtrl+L", ID_FILE_LOAD_SUBTITLE
+ MENUITEM "Save Subtitle...\tCtrl+S", ID_FILE_SAVE_SUBTITLE
+ POPUP "Subtitle Database"
+ BEGIN
+ MENUITEM "Search...", ID_FILE_ISDB_SEARCH
+ MENUITEM "Upload...", ID_FILE_ISDB_UPLOAD
+ MENUITEM "Download...", ID_FILE_ISDB_DOWNLOAD
+
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "Prope&rties", ID_FILE_PROPERTIES
+ MENUITEM SEPARATOR
+ POPUP "Utils"
+ BEGIN
+ MENUITEM "DSM Co&nverter...", ID_FILE_CONVERT
+ END
+ END
+ POPUP "&View"
+ BEGIN
+ MENUITEM "Caption&&Menu\tCtrl+0", ID_VIEW_CAPTIONMENU
+ MENUITEM "&Seek Bar\tCtrl+1", ID_VIEW_SEEKER
+ MENUITEM "Cont&rols\tCtrl+2", ID_VIEW_CONTROLS
+ MENUITEM "&Information\tCtrl+3", ID_VIEW_INFORMATION
+ MENUITEM "S&tatistics\tCtrl+4", ID_VIEW_STATISTICS
+ MENUITEM "St&atus\tCtrl+5", ID_VIEW_STATUS
+ MENUITEM "Subresync\tCtrl+6", ID_VIEW_SUBRESYNC
+ MENUITEM "Playlist\tCtrl+7", ID_VIEW_PLAYLIST
+ MENUITEM "Capture\tCtrl+8", ID_VIEW_CAPTURE
+ MENUITEM "Shader Editor\tCtrl+9", ID_VIEW_SHADEREDITOR
+ POPUP "Presets..."
+ BEGIN
+ MENUITEM "Minimal", ID_VIEW_PRESETS_MINIMAL
+
+ MENUITEM "Compact", ID_VIEW_PRESETS_COMPACT
+
+ MENUITEM "Normal", ID_VIEW_PRESETS_NORMAL
+
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "Fu&ll Screen\tAlt+Enter", ID_VIEW_FULLSCREEN
+ POPUP "&Zoom"
+ BEGIN
+ MENUITEM "&50%\tAlt+1", ID_VIEW_ZOOM_50
+ MENUITEM "&100%\tAlt+2", ID_VIEW_ZOOM_100
+ MENUITEM "&200%\tAlt+3", ID_VIEW_ZOOM_200
+ MENUITEM "Auto Fit\tAlt+4", ID_VIEW_ZOOM_AUTOFIT
+ END
+ MENUITEM "&Tearing Test\tCtrl+T", 32769
+ MENUITEM SEPARATOR
+ POPUP "&Video Frame"
+ BEGIN
+ MENUITEM "&Half Size", ID_VIEW_VF_HALF
+ MENUITEM "&Normal Size", ID_VIEW_VF_NORMAL
+ MENUITEM "&Double Size", ID_VIEW_VF_DOUBLE
+ MENUITEM "&Stretch To Window", ID_VIEW_VF_STRETCH
+ MENUITEM "Touch Window From &Inside", ID_VIEW_VF_FROMINSIDE
+
+ MENUITEM "Touch Window From &Outside", ID_VIEW_VF_FROMOUTSIDE
+
+ MENUITEM SEPARATOR
+ MENUITEM "&Keep Aspect Ratio", ID_VIEW_VF_KEEPASPECTRATIO
+
+ POPUP "Override Aspect Ratio"
+ BEGIN
+ MENUITEM "Default", ID_ASPECTRATIO_SOURCE
+
+ MENUITEM "4:3", ID_ASPECTRATIO_4_3
+
+ MENUITEM "5:4", ID_ASPECTRATIO_5_4
+
+ MENUITEM "16:9", ID_ASPECTRATIO_16_9
+
+ END
+ MENUITEM "Correct Monitor/Desktop AR Diff",
+ ID_VIEW_VF_COMPMONDESKARDIFF
+
+ END
+ POPUP "Pan&&S&can"
+ BEGIN
+ MENUITEM "Increase Size\tNumpad 9", ID_VIEW_INCSIZE
+ MENUITEM "Decrease Size\tNumpad 1", ID_VIEW_DECSIZE
+ MENUITEM "Increase Width\tNumpad 6", ID_VIEW_INCWIDTH
+ MENUITEM "Decrease Width\tNumpad 4", ID_VIEW_DECWIDTH
+ MENUITEM "Increase Height\tNumpad 8", ID_VIEW_INCHEIGHT
+ MENUITEM "Decrease Height\tNumpad 2", ID_VIEW_DECHEIGHT
+ MENUITEM SEPARATOR
+ MENUITEM "Move Right\tCtrl+Numpad 6", ID_PANSCAN_MOVERIGHT
+ MENUITEM "Move Left\tCtrl+Numpad 4", ID_PANSCAN_MOVELEFT
+ MENUITEM "Move Up\tCtrl+Numpad 8", ID_PANSCAN_MOVEUP
+ MENUITEM "Move Down\tCtrl+Numpad 2", ID_PANSCAN_MOVEDOWN
+ MENUITEM "Center\tCtrl+Numpad 5", ID_PANSCAN_CENTER
+ MENUITEM SEPARATOR
+ MENUITEM "Reset\tNumpad 5", ID_VIEW_RESET
+ END
+ MENUITEM SEPARATOR
+ POPUP "On Top"
+ BEGIN
+ MENUITEM "Never", ID_ONTOP_NEVER
+ MENUITEM "Always", ID_ONTOP_ALWAYS
+ MENUITEM "While Playing", ID_ONTOP_WHILEPLAYING
+
+ END
+ MENUITEM "&Options...", ID_VIEW_OPTIONS
+ END
+ POPUP "&Play"
+ BEGIN
+ MENUITEM "&Play/Pause\tSpace", ID_PLAY_PLAYPAUSE
+ MENUITEM "&Stop\tPeriod", ID_PLAY_STOP
+ MENUITEM "F&rame Step\tRight", ID_PLAY_FRAMESTEP
+ MENUITEM "&Go To...\tCtrl+G", ID_PLAY_GOTO
+ MENUITEM SEPARATOR
+ MENUITEM "&Decrease Rate\tCtrl+Down", ID_PLAY_DECRATE
+ MENUITEM "&Increase Rate\tCtrl+Up", ID_PLAY_INCRATE
+ MENUITEM "Reset Rate\tCtrl+R", ID_PLAY_RESETRATE
+ END
+ POPUP "&Navigate"
+ BEGIN
+ MENUITEM "&Previous\tPage Up", ID_NAVIGATE_SKIPBACK
+ MENUITEM "&Next\tPage Down", ID_NAVIGATE_SKIPFORWARD
+ MENUITEM "&Jump To...", 65535
+ MENUITEM SEPARATOR
+ MENUITEM "A&udio Language", 65535
+ MENUITEM "Su&btitle Language", 65535
+ MENUITEM "Video Ang&le", 65535
+ MENUITEM SEPARATOR
+ MENUITEM "Title Menu\tAlt+T", ID_NAVIGATE_TITLEMENU
+ MENUITEM "&Root Menu\tAlt+R", ID_NAVIGATE_ROOTMENU
+ MENUITEM "&Subtitle Menu", ID_NAVIGATE_SUBPICTUREMENU
+
+ MENUITEM "&Audio Menu", ID_NAVIGATE_AUDIOMENU
+ MENUITEM "An&gle Menu", ID_NAVIGATE_ANGLEMENU
+ MENUITEM "&Chapter Menu", ID_NAVIGATE_CHAPTERMENU
+ END
+ MENUITEM "&Favorites", 65535
+ POPUP "&Help"
+ BEGIN
+ MENUITEM "Home Page", ID_HELP_HOMEPAGE
+ MENUITEM "Command Line Switches", ID_HELP_SHOWCOMMANDLINESWITCHES
+
+ MENUITEM SEPARATOR
+ MENUITEM "Donate!", ID_HELP_DONATE
+ MENUITEM SEPARATOR
+ MENUITEM "&About...", ID_HELP_ABOUT
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "&Filters", 65535
+ MENUITEM "S&haders", ID__SHADERS
+ MENUITEM SEPARATOR
+ MENUITEM "&Audio", 65535
+ MENUITEM "Su&btitles", 65535
+ MENUITEM SEPARATOR
+ POPUP "Vol&ume"
+ BEGIN
+ MENUITEM "&Up\tUp Arrow", ID_VOLUME_UP
+ MENUITEM "&Down\tDown Arrow", ID_VOLUME_DOWN
+ MENUITEM "&Mute\tCtrl+M", ID_VOLUME_MUTE
+ END
+ POPUP "After Playback"
+ BEGIN
+ MENUITEM "Close ", ID_AFTERPLAYBACK_CLOSE
+ MENUITEM "Stand By", ID_AFTERPLAYBACK_STANDBY
+ MENUITEM "Hibernate", ID_AFTERPLAYBACK_HIBERNATE
+
+ MENUITEM "Shutdown", ID_AFTERPLAYBACK_SHUTDOWN
+
+ MENUITEM "Log Off", ID_AFTERPLAYBACK_LOGOFF
+ MENUITEM SEPARATOR
+ MENUITEM "Do Nothing", ID_AFTERPLAYBACK_DONOTHING
+
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "E&xit\tAlt+X", ID_FILE_EXIT
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AVI
+//
+
+IDR_AVI_FILECOPY AVI "res\\ani.avi"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// HTML
+//
+
+IDR_HTML_INDEX HTML "res\\web\\index.html"
+IDR_HTML_404 HTML "res\\web\\404.html"
+IDR_HTML_BROWSER HTML "res\\web\\browser.html"
+IDR_HTML_CONTROLS HTML "res\\web\\controls.html"
+IDR_HTML_PLAYER HTML "res\\web\\player.html"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDR_MAINFRAME "Media Player Classic (Mod by Casimir666)"
+ IDS_RS_DVDPOS "Remember DVD Pos"
+ IDS_RS_FILEPOS "Remember File Pos"
+ IDS_RS_LASTFULLSCREEN "LastFullScreen"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_SHADER_TOGGLE "Toggle Pixel Shader"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_R_SETTINGS "Settings"
+ IDS_RS_TITLEBARTEXTSTYLE "TitleBarTextStyle"
+ IDS_RS_USEWMASFREADER "UseWMASFReader"
+ IDS_RS_CONTROLSTATE "ControlState"
+ IDS_RS_VOLUME "Volume"
+ IDS_RS_MUTE "Mute"
+ IDS_RS_BALANCE "Balance"
+ IDS_RS_LOOP "Loop"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_VIDRENDDESC "Move the mouse pointer over the choices to see their description."
+ IDS_CONVERT_ADDFILE "Add File..."
+ IDS_CONVERT_PROPERTIES "Properties..."
+ IDS_CONVERT_REMOVE "Remove"
+ IDS_CONVERT_ENABLESTREAM "Enable Stream"
+ IDS_CONVERT_DISABLESTREAM "Disable Stream"
+ IDS_CONVERT_PINPROPERTIES "Pin Properties..."
+ IDS_CONVERT_ADDRESOURCE "Add Resource..."
+ IDS_CONVERT_REMOVEALL "Remove All"
+ IDS_CONVERT_SAVEAS "Save As..."
+ IDS_CONVERT_RESOURCEPROPERTIES "Resource Properties..."
+ IDS_CONVERT_LAUNCHINBROWSER "Launch in Browser..."
+END
+
+STRINGTABLE
+BEGIN
+ IDS_CONVERT_ADDCHAPTER "Add Chapter..."
+ IDS_CONVERT_CHAPTERPROPERTIES "Chapter Properties..."
+ IDS_CONVERT_DEMUXSTREAM "Demux..."
+ IDS_PLAYLIST_OPEN "&Open"
+ IDS_PLAYLIST_ADD "A&dd"
+ IDS_PLAYLIST_REMOVE "&Remove"
+ IDS_PLAYLIST_COPYTOCLIPBOARD "&Copy to clipboard"
+ IDS_PLAYLIST_SAVEAS "&Save As..."
+ IDS_PLAYLIST_SORTBYLABEL "Sort by &label"
+ IDS_PLAYLIST_SORTBYPATH "Sort by &path"
+ IDS_PLAYLIST_RANDOMIZE "R&andomize"
+ IDS_PLAYLIST_RESTORE "R&estore"
+ IDS_SUBRESYNC_SEPARATOR "&Separator"
+ IDS_SUBRESYNC_DELETE "&Delete"
+ IDS_SUBRESYNC_DUPLICATE "D&uplicate"
+ IDS_SUBRESYNC_RESET "&Reset"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RS_LOOPNUM "LoopNum"
+ IDS_RS_REWIND "Rewind"
+ IDS_RS_ZOOM "Zoom"
+ IDS_RS_MULTIINST "AllowMultipleInstances"
+ IDS_RS_ALWAYSONTOP "AlwaysOnTop"
+ IDS_RS_AUTOZOOM "AutoZoom"
+ IDS_RS_FULLSCREENCTRLS "FullScreenCtrls"
+ IDS_RS_FULLSCREENCTRLSTIMEOUT "FullScreenCtrlsTimeOut"
+ IDS_RS_VMRFLIP "VMRFlip"
+ IDS_RS_DVDPATH "DVDPath"
+ IDS_RS_USEDVDPATH "UseDVDPath"
+ IDS_RS_MENULANG "MenuLang"
+ IDS_RS_AUDIOLANG "AudioLang"
+ IDS_RS_SUBTITLESLANG "SubtitlesLang"
+ IDS_RS_SPLOGFONT "SPDefaultStyle"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RS_SPOVERRIDEPLACEMENT "SPOverridePlacement"
+ IDS_RS_SPHORPOS "SPHorPos"
+ IDS_RS_SPVERPOS "SPVerPos"
+ IDS_RS_SPCSIZE "SPCSize"
+ IDS_RS_SPCMAXRES "SPCMaxRes"
+ IDS_RS_INTREALMEDIA "IntRealMedia"
+ IDS_RS_DISABLEXPTOOLBARS "DisableXPToolbars"
+ IDS_RS_USEDEDYNAMIC "UseDeDynamic"
+ IDS_RS_DBLCLICKFULLSCREEN "DblClickFullScreen"
+ IDS_RS_EXITFULLSCREENATTHEEND "ExitFullscreenAtTheEnd"
+END
+
+STRINGTABLE
+BEGIN
+ AFX_IDS_APP_TITLE "Media Player Classic (Mod by Casimir666)"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RS_AUTOSPEAKERCONF "AutoSpeakerConf"
+ IDS_RS_REMEMBERWINDOWPOS "RememberWindowPos"
+ IDS_RS_LASTWINDOWRECT "LastWindowRect"
+ IDS_RS_AUDIORENDERERTYPE "AudioRendererType"
+ IDS_RS_SPEAKERTOCHANNELMAPPING "SpeakerToChannelMapping"
+ IDS_RS_CUSTOMCHANNELMAPPING "CustomChannelMapping"
+ IDS_RS_DOWNSAMPLETO441 "DownSampleTo441"
+ IDS_RS_ENABLEAUDIOSWITCHER "EnableAudioSwitcher"
+ IDS_RS_HIDECAPTIONMENU "HideCaptionMenu"
+ IDS_R_FILTERS "Filters"
+ IDS_RS_DEFAULTVIDEOFRAME "DefaultVideoFrame"
+ IDS_RS_REMEMBERWINDOWSIZE "RememberWindowSize"
+ IDS_RS_REALMEDIARENDERLESS "RealMediaRenderless"
+ IDS_RS_QUICKTIMERENDERER "QuickTimeRenderer"
+ IDS_RS_REALMEDIAFPS "RealMediaFPS"
+ IDS_RS_AUDIOTIMESHIFT "AudioTimeShift"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RS_SNAPTODESKTOPEDGES "SnapToDesktopEdges"
+ IDS_RS_ENABLESUBTITLES "EnableSubtitles"
+ IDS_RS_MPEGINTERLACED "MPEGInterlaced"
+ IDS_RS_THUMBWIDTH "ThumbWidth"
+ IDS_RS_AUDIONORMALIZE "AudioNormalize"
+ IDS_RS_AUDIOBOOST "AudioBoost"
+ IDS_RS_D3DFULLSCREEN "D3DFullScreen"
+ IDS_RS_MONITOR_AUTOREFRESHRATE "MonitorAutoRefreshRate"
+ IDS_RS_COLOR_BRIGHTNESS "Color Brightness"
+ IDS_RS_COLOR_CONTRAST "Color Contrast"
+ IDS_RS_COLOR_HUE "Color Hue"
+ IDS_RS_COLOR_SATURATION "Color Saturation"
+ IDS_RS_SHADERLIST "Shaders List"
+ IDS_RS_TITLEBARTEXTTITLE "TitleBarTextTitle"
+ IDS_RS_VMR9MIXERYUV "VMRMixerYUV"
+ IDS_RS_AUDIONORMALIZERECOVER "AudioNormalizeRecover"
+END
+
+STRINGTABLE
+BEGIN
+ IDD_PPAGEPLAYBACK "Playback"
+ IDD_PPAGEPLAYER "Player"
+ IDD_PPAGEDVD "Playback::DVD/OGM"
+ IDD_PPAGESUBTITLES "Subtitles"
+ IDD_PPAGEFORMATS "Player::Formats"
+ IDD_PPAGETWEAKS "Tweaks"
+ IDD_PPAGEAUDIOSWITCHER "Internal Filters::Audio Switcher"
+ IDD_PPAGEEXTERNALFILTERS "External Filters"
+END
+
+STRINGTABLE
+BEGIN
+ IDB_LOGO3 "Andrew S. Gildehaus, agildehaus@runbox.com"
+ IDB_LOGO4 "Marcel Hoffs, marcelhoffs@hotmail.com"
+ IDB_LOGO7 "Steven W. Smith, smith78@sbcglobal.net"
+END
+
+STRINGTABLE
+BEGIN
+ IDD_PPAGEACCELTBL "Player::Keys"
+ IDD_PPAGESUBSTYLE "Subtitles::Default Style"
+ IDD_PPAGEINTERNALFILTERS "Internal Filters"
+ IDD_PPAGELOGO "Player::Logo"
+ IDD_PPAGEOUTPUT "Playback::Output"
+ IDD_PPAGEWEBSERVER "Player::Web Interface"
+ IDD_PPAGEAUDIODEC "Internal Filters::Audio Decoders"
+ IDD_PPAGESUBDB "Subtitles::Database"
+END
+
+STRINGTABLE
+BEGIN
+ IDD_FILEPROPDETAILS "Details"
+ IDD_FILEPROPCLIP "Clip"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RS_ENABLEAUDIOTIMESHIFT "EnableAudioTimeShift"
+ IDS_R_FAVFILES "Favorites\\Files"
+ IDS_R_FAVDVDS "Favorites\\DVDs"
+ IDS_R_FAVDEVICES "Favorites\\Devices"
+ IDS_RS_LOGOFILE "LogoFile"
+ IDS_RS_ENABLEWORKERTHREADFOROPENING "EnableWorkerThreadForOpening"
+ IDS_RS_PNSPRESETS "PnSPresets"
+ IDS_RS_AUTOLOADAUDIO "AutoloadAudio"
+ IDS_RS_AUTOLOADSUBTITLES "AutoloadSubtitles"
+ IDS_RS_SEARCHKEYFRAMES "SearchKeyframes"
+ IDS_RS_ACCELTBL "AccelTbl"
+ IDS_RS_SETFULLSCREENRES "SetFullscreenRes"
+ IDS_RS_FULLSCREENRES "FullscreenRes"
+ IDS_RS_WINLIRCADDR "WinLircAddr"
+ IDS_R_COMMANDS "Commands2"
+ IDS_RS_WINLIRC "UseWinLirc"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RS_TRAYICON "TrayIcon"
+ IDS_RS_KEEPASPECTRATIO "KeepAspectRatio"
+ IDS_RS_UICEADDR "UICEAddr"
+ IDS_RS_UICE "UseUICE"
+ IDS_RS_JUMPDISTS "JumpDistS"
+ IDS_RS_JUMPDISTM "JumpDistM"
+ IDS_RS_JUMPDISTL "JumpDistL"
+ IDS_RS_REPORTFAILEDPINS "ReportFailedPins"
+ IDS_RS_SRCFILTERS "SrcFilters"
+ IDS_RS_KEEPHISTORY "KeepHistory"
+ IDS_RS_LOGOID "LogoID2"
+ IDS_RS_LOGOEXT "LogoExt"
+ IDS_RS_TRAFILTERS "TraFilters"
+ IDS_RS_MPEGDI "MPEGDI"
+ IDS_RS_MPEGBRIGHT "MPEGBright"
+ IDS_RS_MPEGCONT "MPEGCont"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RS_MPEGHUE "MPEGHue"
+ IDS_RS_MPEGSAT "MPEGSat"
+ IDS_RS_MPEGFORCEDSUBS "MPEGForcedSubs"
+ IDS_RS_MPEGPLANARYUV "MPEGPlanarYUV"
+ IDS_RS_COMPMONDESKARDIFF "CompMonDeskARDiff"
+ IDS_RS_HIDECDROMSSUBMENU "HideCDROMsSubMenu"
+ IDS_RS_VMRTEXTURE "VMRTexture"
+ IDS_RS_VMR3D "VMR3D"
+ IDS_RS_DSVIDEORENDERERTYPE "DSVidRen"
+ IDS_RS_RMVIDEORENDERERTYPE "RMVidRen"
+ IDS_RS_QTVIDEORENDERERTYPE "QTVidRen"
+ IDS_RS_APSURACEFUSAGE "APSurfaceUsage"
+ IDS_R_LOGINS "Logins"
+ IDS_RS_ENABLEWEBSERVER "EnableWebServer"
+ IDS_RS_WEBSERVERPORT "WebServerPort"
+ IDS_RS_LASTWINDOWTYPE "LastWindowType"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RS_ONTOP "OnTop"
+ IDS_RS_MPASF "MPASampleFormat"
+ IDS_RS_AC3SC "AC3SpeakerConfig"
+ IDS_RS_AC3DRC "AC3DynamicRangeControl"
+ IDS_RS_WEBSERVERPRINTDEBUGINFO "WebServerPrintDebugIfo"
+ IDS_RS_WEBSERVERUSECOMPRESSION "WebServerUseCompression"
+ IDS_RS_MPANORMALIZE "MPANormalize"
+ IDS_RS_DTSSC "DTSSpeakerConfig"
+ IDS_RS_DTSDRC "DTSDynamicRangeControl"
+ IDS_RS_SNAPSHOTPATH "SnapShotPath"
+ IDS_RS_PRIORITY "Priority"
+ IDS_RS_SNAPSHOTEXT "SnapShotExt"
+ IDS_RS_LAUNCHFULLSCREEN "LaunchFullScreen"
+ IDS_RS_MPABOOST "MpaBoost"
+ IDS_RS_AACSC "AACSpeakerConfig"
+ IDS_RS_VMRSYNCFIX "VMRSyncFix"
+END
+
+STRINGTABLE
+BEGIN
+ IDC_DSSYSDEF "Default video renderer filter for DirectShow. Others will fall back to this one when they can't be loaded for some reason. On Windown XP this is the same as VMR7 (windowed)."
+ IDC_DSOLD "This is the default renderer of Windows 9x/me/2k. Depending on the visiblity of the video window and your video card's abilies, it will switch between GDI, DirectDraw, Overlay rendering modes dynamically."
+ IDC_DSOVERLAYMIXER "Always renders in overlay. Generally only YUV formats are allowed, but they are presented directly without any color conversion to RGB. This is the fastest rendering method of all and the only where you can be sure about full screen video mirroring to tv-out activating."
+ IDC_DSVMR7WIN "The default renderer of Windows XP. Very stable and just a little slower than the Overlay mixer. Uses DirectDraw and runs in Overlay when it can."
+ IDC_DSVMR9WIN "Only available if you have DirectX 9 installed. Has the same abilies as VMR7 (windowed), but it will never use Overlay rendering and because of this it may be a little slower than VMR7 (windowed)."
+ IDC_DSVMR7REN "Same as the VMR7 (windowed), but with the Allocator-Presenter plugin of MPC for subtitling. Overlay video mirroring WILL NOT work. 'True Color' desktop color space recommended."
+ IDC_DSVMR9REN "Same as the VMR9 (windowed), but with the Allocator-Presenter plugin of MPC for subtitling. Overlay video mirroring MIGHT work. 'True Color' desktop color space recommended."
+ IDC_DSNULL_COMP "Connects to any video-like media type and will send the incoming samples to nowhere. Use it when you don't need the video display and want to save the cpu from working unnecessarily."
+ IDC_DSNULL_UNCOMP "Same as the normal Null renderer, but this will only connect to uncompressed types."
+END
+
+STRINGTABLE
+BEGIN
+ IDC_RMSYSDEF "Real's own renderer. SMIL scripts will work, but interaction not likely. Uses DirectDraw and runs in Overlay when it can."
+ IDC_RMDX7 "The output of Real's engine rendered by the DX7-based Allocator-Presenter of VMR7 (renderless)."
+ IDC_RMDX9 "The output of Real's engine rendered by the DX9-based Allocator-Presenter of VMR9 (renderless)."
+ IDC_QTSYSDEF "QuickTime's own renderer. Gets a little slow when its video area is resized or partially covered by another window. When Overlay is not available it likes to fall back to GDI."
+ IDC_QTDX7 "The output of QuickTime's engine rendered by the DX7-based Allocator-Presenter of VMR7 (renderless)."
+ IDC_QTDX9 "The output of QuickTime's engine rendered by the DX9-based Allocator-Presenter of VMR9 (renderless)."
+ IDC_REGULARSURF "Video surface will be allocated as a regular offscreen surface."
+END
+
+STRINGTABLE
+BEGIN
+ IDC_TEXTURESURF2D "Video surface will be allocated as a texture but still the 2d functions will be used to copy and stretch it onto the backbuffer. Requires a video card which can allocate 32bit, RGBA, non-power-of-two sized textures and at least in the resolution of the video."
+ IDC_TEXTURESURF3D "Video surface will be allocated as a texture and drawn as two triangles in 3d. Antialiasing turned on at the display settings may have a bad effect on the rendering speed."
+ IDC_DX9RESIZER_COMBO "If there is no Pixel Shader 2.0 support, simple bilinear is used automatically."
+ IDC_DSVMR9LOADMIXER "Puts VMR9 (renderless) into mixer mode, this means most of the controls on its property page will work and it will use a separate worker thread to renderer frames."
+ IDC_CHECK_MPEGINTERLACED
+ "Use it together with ""Weave"" if the video renderer can also deinterlace. The currently loaded file has to be opened again."
+END
+
+STRINGTABLE
+BEGIN
+ IDS_SRC_RADGT "6.4.0.0\nRequires smackw32.dll and binkw32.dll"
+ IDS_SRC_CDDA "6.4.0.1\n2K/XP only"
+ IDS_SRC_AVI "6.4.0.6\nNon-interleaved files are not welcome"
+ IDS_SRC_CDXA "6.4.0.1"
+ IDS_SRC_VTS "6.4.0.0\nOpen VTS_xx_0.ifo to load VTS_xx_x.vob files in one piece"
+ IDS_SRC_FLIC "6.4.0.0"
+ IDS_SRC_D2V "6.4.0.0"
+ IDS_SRC_DTSAC3 "6.4.0.1"
+ IDS_SRC_SHOUTCAST "6.4.0.1"
+ IDS_SRC_REALMEDIA "6.4.1.1\nRealMedia format categories must be set to 'DirectShow' to make it load\nDoesn't support streaming"
+ IDS_SRC_MATROSKA "6.4.2.8"
+ IDS_SRC_ROQ "6.4.0.0"
+ IDS_SRC_OGG "6.4.0.2"
+ IDS_SRC_NUT "6.4.0.0\nBased on ""NUT Open Container Format DRAFT 20030906""\nStill very incomplete, if you have or can make test files, please contact me."
+ IDS_SRC_DIRAC "6.4.0.1\nBased on libdirac 0.5.0"
+ IDS_SRC_DSM "6.4.0.5"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_SRC_MPA "6.4.0.2\nSource filter for mp3 and aac"
+ IDS_SRC_MP4 "6.4.0.1"
+ IDS_TRA_RV "6.4.1.0\nRequires RealVideo decoder dlls, RV10 also works with ffdshow"
+ IDS_TRA_RA "6.4.1.0\nRequires RealAudio decoder dlls, DNET also works with ac3filter"
+ IDS_TRA_MPEG1 "6.4.0.1\nBased on libmpeg2 (mpeg1 video decoding is bogus)"
+ IDS_TRA_MPEG2 "6.4.0.1\nBased on libmpeg2"
+ IDS_TRA_MPA "6.4.0.2\nBased on libmad, liba52, libdts, libfaad"
+ IDS_TRA_LPCM "6.4.0.1"
+ IDS_TRA_AC3 "6.4.0.1\nBased on liba52 0.7.4, http://liba52.sourceforge.net/"
+ IDS_TRA_DTS "6.4.0.1\nBased on libdts 0.0.2, http://www.videolan.org/dtsdec.html"
+ IDS_TRA_AAC "6.4.0.1\nBased on libfaad 2.0, http://www.audiocoding.com/"
+ IDS_TRA_DIRAC "6.4.0.1\nBased on libdirac 0.5.0"
+ IDS_TRA_PS2AUD "6.4.0.1\nDecodes audio streams of PSS files"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RS_ISDB "ISDb"
+ IDS_RS_POW2TEX "SPCPow2Tex"
+ IDS_R_INTERNAL_FILTERS "Internal Filters"
+ IDS_RS_WEBROOT "WebRoot"
+ IDS_RS_WEBSERVERLOCALHOSTONLY "WebServerLocalhostOnly"
+ IDS_RS_ASPECTRATIO_X "AspectRatioX"
+ IDS_RS_ASPECTRATIO_Y "AspectRatioY"
+ IDS_RS_DX9_RESIZER "DX9Resizer"
+ IDS_RS_WEBSERVERCGI "WebServerCGI"
+ IDS_RS_WEBDEFINDEX "WebDefIndex"
+ IDS_RS_FREEWINDOWRESIZING "FreeWindowResizing"
+ IDS_RS_NOTIFYMSN "NotifyMSN2"
+ IDS_RS_NOTIFYGTSDLL "NotifyGTSdll"
+ IDS_RS_VMR9MIXERMODE "VMR9MixerMode"
+ IDS_RS_THUMBROWS "ThumbRows"
+ IDS_RS_THUMBCOLS "ThumbCols"
+END
+
+STRINGTABLE
+BEGIN
+ IDC_CHECK_RELATIVETO "Default state gets inherited to other styles where it is still undefined"
+ IDC_CHECK_SPCPOW2TEX "Unchecking this frees up a little video memory and saves bandwidth on local to video memory transfers, but it may not work with older video cards."
+ IDC_BUTTON_EXT_SET "After clicking this button, the checked state of the format group will reflect the actual file association for mpc. A newly added extension will usually make it grayed, so don't forget to check it again before closing this dialog!"
+END
+
+STRINGTABLE
+BEGIN
+ ID_PLAY_PLAY "Play\nPlay"
+ ID_PLAY_PAUSE "Pause\nPause"
+ ID_PLAY_STOP "Stop\nStop"
+ ID_PLAY_FRAMESTEP "Step\nStep"
+ ID_PLAY_DECRATE "Decrease speed\nDecrease speed"
+ ID_PLAY_INCRATE "Increase speed\nIncrease speed"
+END
+
+STRINGTABLE
+BEGIN
+ ID_VOLUME_MUTE "Mute\nMute"
+ ID_VOLUME_MUTE_ON "Mute\nMute"
+ ID_VOLUME_MUTE_DISABLED "No audio\nNo audio"
+END
+
+STRINGTABLE
+BEGIN
+ ID_NAVIGATE_SKIPBACK "Skip back\nSkip back"
+ ID_NAVIGATE_SKIPFORWARD "Skip forward\nSkip forward"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_SUBRESYNC_ORIGINAL "&Original"
+ IDS_SUBRESYNC_CURRENT "&Current"
+ IDS_SUBRESYNC_EDIT "&Edit"
+ IDS_SUBRESYNC_YES "&Yes"
+ IDS_SUBRESYNC_NO "&No"
+ IDS_SUBRESYNC_DECREASE "&Decrease"
+ IDS_SUBRESYNC_INCREASE "&Increase"
+ IDS_OPTIONS_CAPTION "Options"
+ IDS_SHADER_COMBINE "&Combine..."
+ IDS_SHADER_OFF "Off"
+ IDS_SHADER_POPUP "Shaders"
+ IDS_FAVORITES_POPUP "F&avorites"
+ IDS_JUMPTO_POPUP "Jump To..."
+ IDS_VIDEOANGLE_POPUP "Video Angle"
+ IDS_SUBTITLELANGUAGE_POPUP "Subtitle Language"
+ IDS_AUDIOLANGUAGE_POPUP "Audio Language"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_INFOBAR_LOCATION "Location"
+ IDS_INFOBAR_VIDEO "Video"
+ IDS_INFOBAR_AUDIO "Audio"
+ IDS_INFOBAR_SUBTITLES "Subtitles"
+ IDS_CONTROLS_COMPLETING "Completing..."
+ IDS_AUTOPLAY_PLAYVIDEO "Play Video"
+ IDS_AUTOPLAY_PLAYMUSIC "Play Music"
+ IDS_AUTOPLAY_PLAYAUDIOCD "Play Audio CD"
+ IDS_AUTOPLAY_PLAYDVDMOVIE "Play DVD Movie"
+ IDS_PROPSHEET_PROPERTIES "Properties"
+ IDS_GRAPHBUILDER_AUDIOSWITCHER "Audio Switcher"
+ IDS_SHADER_EDIT "&Edit..."
+END
+
+STRINGTABLE
+BEGIN
+ IDD_FILEPROPRES "Resources"
+ IDD_PPAGECASIMIR "Casimir666"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_SUBTITLES_POPUP "Subtitles"
+ IDS_AUDIO_POPUP "Audio"
+ IDS_FILTERS_POPUP "Filters"
+ IDS_OPENCDROM_POPUP "O&pen Disc"
+ IDS_NAVIGATE_POPUP "Navigate"
+ IDS_VIDEOFRAME_POPUP "Video Frame"
+ IDS_PANSCAN_POPUP "Pan&&Scan"
+ IDS_ASPECTRATIO_POPUP "Aspect Ratio"
+ IDS_ZOOM_POPUP "Zoom"
+ IDS_FAVORITES_ADD "&Add to Favorites..."
+ IDS_FAVORITES_ORGANIZE "&Organize Favorites..."
+ IDS_PLAYLIST_SHUFFLE "Shuffle"
+ IDS_PLAYLIST_REMEBERITEMS "Remember items"
+ IDS_CONTROLS_CLOSING "Closing..."
+ IDS_CONTROLS_PLAYING "Playing"
+ IDS_CONTROLS_PAUSED "Paused"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_CONTROLS_STOPPED "Stopped"
+ IDS_CONTROLS_BUFFERING "Buffering... (%d%%)"
+ IDS_CONTROLS_CAPTURING "Capturing..."
+ IDS_CONTROLS_OPENING "Opening..."
+ IDS_CONTROLS_CLOSED "Closed"
+ IDS_SUBTITLES_OPTIONS "&Options..."
+ IDS_SUBTITLES_STYLES "&Styles..."
+ IDS_SUBTITLES_RELOAD "&Reload"
+ IDS_SUBTITLES_ENABLE "&Enable"
+ IDS_PANSCAN_EDIT "Edit..."
+ IDS_INFOBAR_TITLE "Title"
+ IDS_INFOBAR_AUTHOR "Author"
+ IDS_INFOBAR_COPYRIGHT "Copyright"
+ IDS_INFOBAR_RATING "Rating"
+ IDS_INFOBAR_DESCRIPTION "Description"
+ IDS_INFOBAR_DOMAIN "Domain"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral (Sys. Default) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// FILE
+//
+
+IDF_SHADER_EDGE_SHARPEN FILE "res\\shaders\\EdgeSharpen.psh"
+IDF_SHADER_SHARPEN_COMPLEX FILE "res\\shaders\\SharpenComplex.psh"
+#endif // Neutral (Sys. Default) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "afxres.rc" // Standard components
+#endif
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/apps/mplayerc/mplayerc.sln b/src/apps/mplayerc/mplayerc.sln
new file mode 100644
index 000000000..e954a879a
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.sln
@@ -0,0 +1,147 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mplayerc", "mplayerc.vcproj", "{8CE7E5D0-C821-47AC-A247-28EC95B34670}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575} = {1A2DFD1A-3C6C-44D1-909D-294AF646B575}
+ {03208025-D5C2-426A-B0FA-251D4338F30C} = {03208025-D5C2-426A-B0FA-251D4338F30C}
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10} = {AB494732-EF6D-44D0-BCF8-80FF04858D10}
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F} = {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0} = {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitles", "..\..\subtitles\subtitles.vcproj", "{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D514EA4D-EAFB-47A9-A437-A582CA571251} = {D514EA4D-EAFB-47A9-A437-A582CA571251}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subpic", "..\..\subpic\subpic.vcproj", "{D514EA4D-EAFB-47A9-A437-A582CA571251}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decss", "..\..\decss\decss.vcproj", "{1A2DFD1A-3C6C-44D1-909D-294AF646B575}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResizableLib", "..\..\ui\ResizableLib\ResizableLib.vcproj", "{4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdUI", "..\..\ui\CmdUI\CmdUI.vcproj", "{03208025-D5C2-426A-B0FA-251D4338F30C}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sizecbar", "..\..\ui\sizecbar\sizecbar.vcproj", "{61E6EB4D-2F1A-443B-94B0-E8200B26E99F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TreePropSheet", "..\..\ui\TreePropSheet\TreePropSheet.vcproj", "{AB494732-EF6D-44D0-BCF8-80FF04858D10}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ ResourceDLL = ResourceDLL
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug.ActiveCfg = Debug|Win32
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug.Build.0 = Debug|Win32
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release.ActiveCfg = Release|Win32
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release.Build.0 = Release|Win32
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.Release Unicode.Build.0 = Release Unicode|Win32
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.ResourceDLL.ActiveCfg = ResourceDLL|Win32
+ {8CE7E5D0-C821-47AC-A247-28EC95B34670}.ResourceDLL.Build.0 = ResourceDLL|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.Build.0 = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.Build.0 = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.ResourceDLL.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.ResourceDLL.ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug.ActiveCfg = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug.Build.0 = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release.ActiveCfg = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release.Build.0 = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode.Build.0 = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.ResourceDLL.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.ActiveCfg = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.Build.0 = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.ActiveCfg = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.Build.0 = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.Build.0 = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.ResourceDLL.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.ResourceDLL.Build.0 = Release Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug.ActiveCfg = Debug|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug.Build.0 = Debug|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release.ActiveCfg = Release|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release.Build.0 = Release|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode.Build.0 = Release Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.ResourceDLL.ActiveCfg = Release Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.ResourceDLL.Build.0 = Release Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug.ActiveCfg = Debug|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug.Build.0 = Debug|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release.ActiveCfg = Release|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release.Build.0 = Release|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode.Build.0 = Release Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.ResourceDLL.ActiveCfg = Release Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.ResourceDLL.Build.0 = Release Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug.ActiveCfg = Debug|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug.Build.0 = Debug|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release.ActiveCfg = Release|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release.Build.0 = Release|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode.Build.0 = Release Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.ResourceDLL.ActiveCfg = Release Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.ResourceDLL.Build.0 = Release Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug.ActiveCfg = Debug|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug.Build.0 = Debug|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release.ActiveCfg = Release|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release.Build.0 = Release|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode.Build.0 = Release Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.ResourceDLL.ActiveCfg = Release Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.ResourceDLL.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/apps/mplayerc/mplayerc.suo b/src/apps/mplayerc/mplayerc.suo
new file mode 100644
index 000000000..a55bd7f7d
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.suo
Binary files differ
diff --git a/src/apps/mplayerc/mplayerc.vcproj b/src/apps/mplayerc/mplayerc.vcproj
new file mode 100644
index 000000000..8217fc79e
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.vcproj
@@ -0,0 +1,1927 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="mplayerc"
+ ProjectGUID="{CEAF0A23-A949-443E-BDA4-2F025DD774F6}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="MFCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory=".\$(ConfigurationName)"
+ IntermediateDirectory=".\$(OutDir)"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ UseOfATL="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ FavorSizeOrSpeed="1"
+ OptimizeForProcessor="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile="$(OutDir)\$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="Delayimp.lib detours.lib qtmlClient.lib wmstub.lib d3dx9.lib dxguid.lib Dsound.lib strmbaseRU.lib dsutilRU.lib subpicRU.lib subtitlesRU.lib asyncreaderRU.lib audioswitcherRU.lib avi2ac3filterRU.lib bufferfilterRU.lib cddareaderRU.lib cdxareaderRU.lib d2vsourceRU.lib decssfilterRU.lib flicsourceRU.lib dtsac3sourceRU.lib basesourceRU.lib wavdestRU.lib shoutcastsourceRU.lib streamdrivethruRU.lib vtsreaderRU.lib basesplitterRU.lib MatroskaSplitterRU.lib MatroskaMuxerRU.lib RealMediaSplitterRU.lib AviSplitterRU.lib Mpeg2DecFilterRU.lib MpaDecFilterRU.lib RoQSplitterRU.lib OggSplitterRU.lib NutSplitterRU.lib MpegSplitterRU.lib DiracSplitterRU.lib MpaSplitterRU.lib DSMSplitterRU.lib BaseMuxerRU.lib DSMMuxerRU.lib zlibR.lib subtitlesourceRU.lib strmiids.lib MP4SplitterRU.lib udpreaderRU.lib Psapi.lib"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="../../../lib;../../../lib/wm7;../../../lib/qt6;../../../lib/detours"
+ IgnoreDefaultLibraryNames="MSVCRT"
+ DelayLoadDLLs="d3d9.dll;msimg32.dll;gdiplus.dll"
+ ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+ SubSystem="2"
+ SupportUnloadOfDelayLoadedDLL="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="TRUE"
+ SuppressStartupBanner="TRUE"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release_unicode/mplayerc.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\bin\upx.exe --best &quot;$(TargetPath)&quot;"
+ ExcludedFromBuild="TRUE"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories=""/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory=".\$(ConfigurationName)"
+ IntermediateDirectory=".\$(OutDir)"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;pascal="
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile="$(OutDir)\$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="Delayimp.lib detours.lib qtmlClient.lib wmstub.lib d3dx9.lib Dsound.lib dxguid.lib strmbaseDU.lib dsutilDU.lib subpicDU.lib subtitlesDU.lib asyncreaderDU.lib audioswitcherDU.lib avi2ac3filterDU.lib bufferfilterDU.lib cddareaderDU.lib cdxareaderDU.lib d2vsourceDU.lib decssfilterDU.lib flicsourceDU.lib dtsac3sourceDU.lib basesourceDU.lib subtitlesourceDU.lib wavdestDU.lib shoutcastsourceDU.lib streamdrivethruDU.lib vtsreaderDU.lib basesplitterDU.lib MatroskaSplitterDU.lib MatroskaMuxerDU.lib RealMediaSplitterDU.lib AviSplitterDU.lib Mpeg2DecFilterDU.lib MpaDecFilterDU.lib RoQSplitterDU.lib OggSplitterDU.lib NutSplitterDU.lib MpegSplitterDU.lib DiracSplitterDU.lib MpaSplitterDU.lib DSMSplitterDU.lib BaseMuxerDU.lib DSMMuxerDU.lib zlibD.lib strmiids.lib MP4SplitterDU.lib udpreaderDU.lib Psapi.lib"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="../../../lib;../../../lib/wm7;../../../lib/qt6;../../../lib/detours"
+ IgnoreDefaultLibraryNames="MSVCRT;LIBCMT;MSVCR71D"
+ DelayLoadDLLs="d3d9.dll;msimg32.dll;gdiplus.dll"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+ SubSystem="2"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="TRUE"
+ SuppressStartupBanner="TRUE"
+ TargetEnvironment="1"
+ TypeLibraryName="$(OutDir)\$(ProjectName).tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\$(ConfigurationName)"
+ IntermediateDirectory=".\$(OutDir)"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ FavorSizeOrSpeed="1"
+ OptimizeForProcessor="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile="$(OutDir)\$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="Delayimp.lib detours.lib qtmlClient.lib wmstub.lib d3dx9.lib Dsound.lib dxguid.lib strmbaseR.lib dsutilR.lib subpicR.lib subtitlesR.lib asyncreaderR.lib audioswitcherR.lib avi2ac3filterR.lib bufferfilterR.lib cddareaderR.lib cdxareaderR.lib d2vsourceR.lib decssfilterR.lib flicsourceR.lib dtsac3sourceR.lib basesourceR.lib wavdestR.lib shoutcastsourceR.lib streamdrivethruR.lib vtsreaderR.lib basesplitterR.lib MatroskaSplitterR.lib MatroskaMuxerR.lib RealMediaSplitterR.lib AviSplitterR.lib Mpeg2DecFilterR.lib MpaDecFilterR.lib RadGtSplitterR.lib RoQSplitterR.lib OggSplitterR.lib NutSplitterR.lib MpegSplitterR.lib DiracSplitterR.lib MpaSplitterR.lib DSMSplitterR.lib BaseMuxerR.lib DSMMuxerR.lib zlibR.lib subtitlesourceR.lib"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="../../../lib;../../../lib/wm7;../../../lib/qt6;../../../lib/detours"
+ IgnoreDefaultLibraryNames="MSVCRT"
+ DelayLoadDLLs="d3d9.dll;msimg32.dll;gdiplus.dll"
+ ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+ SubSystem="2"
+ SupportUnloadOfDelayLoadedDLL="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="TRUE"
+ SuppressStartupBanner="TRUE"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/mplayerc.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\bin\upx.exe --best &quot;$(TargetPath)&quot;"
+ ExcludedFromBuild="TRUE"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories=""/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\$(ConfigurationName)"
+ IntermediateDirectory=".\$(OutDir)"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile="$(OutDir)\$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="Delayimp.lib detours.lib qtmlClient.lib wmstub.lib d3dx9.lib Dsound.lib dxguid.lib strmbaseD.lib dsutilD.lib subpicD.lib subtitlesD.lib asyncreaderD.lib audioswitcherD.lib avi2ac3filterD.lib bufferfilterD.lib cddareaderD.lib cdxareaderD.lib d2vsourceD.lib decssfilterD.lib flicsourceD.lib dtsac3sourceD.lib basesourceD.lib subtitlesourceD.lib wavdestD.lib shoutcastsourceD.lib streamdrivethruD.lib vtsreaderD.lib basesplitterD.lib MatroskaSplitterD.lib MatroskaMuxerD.lib RealMediaSplitterD.lib AviSplitterD.lib Mpeg2DecFilterD.lib MpaDecFilterD.lib RadGtSplitterD.lib RoQSplitterD.lib OggSplitterD.lib NutSplitterD.lib MpegSplitterD.lib DiracSplitterD.lib MpaSplitterD.lib DSMSplitterD.lib BaseMuxerD.lib DSMMuxerD.lib zlibD.lib"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="../../../lib;../../../lib/wm7;../../../lib/qt6;../../../lib/detours"
+ IgnoreDefaultLibraryNames="MSVCRT;LIBCMT"
+ DelayLoadDLLs="d3d9.dll;msimg32.dll;gdiplus.dll"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
+ SubSystem="2"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="TRUE"
+ SuppressStartupBanner="TRUE"
+ TargetEnvironment="1"
+ TypeLibraryName="$(OutDir)\$(ProjectName).tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="ResourceDLL|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ ResourceOnlyDLL="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath=".\AuthDlg.cpp">
+ </File>
+ <File
+ RelativePath="BaseGraph.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ChildView.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ComPropertyPage.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ComPropertySheet.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ConvertChapDlg.cpp">
+ </File>
+ <File
+ RelativePath=".\ConvertDlg.cpp">
+ </File>
+ <File
+ RelativePath=".\ConvertPropsDlg.cpp">
+ </File>
+ <File
+ RelativePath=".\ConvertResDlg.cpp">
+ </File>
+ <File
+ RelativePath="CShockwaveFlash.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\D3DFont.cpp">
+ </File>
+ <File
+ RelativePath=".\DeinterlacerFilter.cpp">
+ </File>
+ <File
+ RelativePath="DX7AllocatorPresenter.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="DX9AllocatorPresenter.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\FakeFilterMapper2.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="FavoriteAddDlg.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="FavoriteOrganizeDlg.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\FGFilter.cpp">
+ </File>
+ <File
+ RelativePath=".\FGManager.cpp">
+ </File>
+ <File
+ RelativePath="FileDropTarget.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="FloatEdit.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\FullscreenWnd.cpp">
+ </File>
+ <File
+ RelativePath="GoToDlg.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\filters\InternalPropertyPage.cpp">
+ </File>
+ <File
+ RelativePath=".\IPinHook.cpp">
+ </File>
+ <File
+ RelativePath=".\ISDb.cpp">
+ </File>
+ <File
+ RelativePath=".\jpeg.cpp">
+ </File>
+ <File
+ RelativePath="KeyProvider.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\LineNumberEdit.cpp">
+ </File>
+ <File
+ RelativePath=".\MacrovisionKicker.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\MainFrm.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="MediaFormats.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="MediaTypesDlg.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\mplayerc.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\mplayerc.rc">
+ </File>
+ <File
+ RelativePath="OpenCapDeviceDlg.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="OpenDlg.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\OpenFileDlg.cpp">
+ </File>
+ <File
+ RelativePath="..\..\filters\PinInfoWnd.cpp">
+ </File>
+ <File
+ RelativePath=".\PixelShaderCompiler.cpp">
+ </File>
+ <File
+ RelativePath="PlayerCaptureBar.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerCaptureDialog.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerInfoBar.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerListCtrl.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerPlaylistBar.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerSeekBar.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PlayerShaderEditorBar.cpp">
+ </File>
+ <File
+ RelativePath="PlayerStatusBar.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerSubresyncBar.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerToolBar.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="Playlist.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PnSPresetsDlg.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageAccelTbl.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageAudioSwitcher.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageBase.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageCasimir.cpp">
+ </File>
+ <File
+ RelativePath="PPageDVD.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageExternalFilters.cpp">
+ </File>
+ <File
+ RelativePath="PPageFileInfoClip.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageFileInfoDetails.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageFileInfoRes.cpp">
+ </File>
+ <File
+ RelativePath="PPageFileInfoSheet.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageFormats.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageInternalFilters.cpp">
+ </File>
+ <File
+ RelativePath=".\PPageLogo.cpp">
+ </File>
+ <File
+ RelativePath=".\PPageOutput.cpp">
+ </File>
+ <File
+ RelativePath="PPagePlayback.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPagePlayer.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageSheet.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageSubDB.cpp">
+ </File>
+ <File
+ RelativePath="PPageSubStyle.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageSubtitles.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageTweaks.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageWebServer.cpp">
+ </File>
+ <File
+ RelativePath="QuicktimeGraph.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="RealMediaGraph.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="RealMediaWindowlessSite.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="RegFilterChooserDlg.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="SaveDlg.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="SaveTextFileDialog.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\SaveThumbnailsDialog.cpp">
+ </File>
+ <File
+ RelativePath="SelectMediaType.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ShaderAutoCompleteDlg.cpp">
+ </File>
+ <File
+ RelativePath=".\ShaderCombineDlg.cpp">
+ </File>
+ <File
+ RelativePath=".\ShaderEditorDlg.cpp">
+ </File>
+ <File
+ RelativePath="ShockwaveGraph.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="StaticLink.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="StatusLabel.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\StdAfx.cpp">
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\SubtitleDlDlg.cpp">
+ </File>
+ <File
+ RelativePath="TextPassThruFilter.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\VMROSD.cpp">
+ </File>
+ <File
+ RelativePath="VolumeCtrl.cpp">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\WebClientSocket.cpp">
+ </File>
+ <File
+ RelativePath=".\WebServer.cpp">
+ </File>
+ <File
+ RelativePath=".\WebServerSocket.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath=".\AuthDlg.h">
+ </File>
+ <File
+ RelativePath="BaseGraph.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ChildView.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ComPropertyPage.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ComPropertySheet.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ConvertChapDlg.h">
+ </File>
+ <File
+ RelativePath=".\ConvertDlg.h">
+ </File>
+ <File
+ RelativePath=".\ConvertPropsDlg.h">
+ </File>
+ <File
+ RelativePath=".\ConvertResDlg.h">
+ </File>
+ <File
+ RelativePath="CShockwaveFlash.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\D3DFont.h">
+ </File>
+ <File
+ RelativePath=".\DeinterlacerFilter.h">
+ </File>
+ <File
+ RelativePath="DX7AllocatorPresenter.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="DX9AllocatorPresenter.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\FakeFilterMapper2.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="FavoriteAddDlg.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="FavoriteOrganizeDlg.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\FGFilter.h">
+ </File>
+ <File
+ RelativePath=".\FGManager.h">
+ </File>
+ <File
+ RelativePath="FileDropTarget.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="FloatEdit.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\FullscreenWnd.h">
+ </File>
+ <File
+ RelativePath="GoToDlg.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\IGraphBuilder2.h">
+ </File>
+ <File
+ RelativePath=".\IPinHook.h">
+ </File>
+ <File
+ RelativePath="IQTVideoSurface.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ISDb.h">
+ </File>
+ <File
+ RelativePath=".\jpeg.h">
+ </File>
+ <File
+ RelativePath=".\jpeg_tables.h">
+ </File>
+ <File
+ RelativePath="KeyProvider.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\LineNumberEdit.h">
+ </File>
+ <File
+ RelativePath=".\MacrovisionKicker.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\MainFrm.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="MediaFormats.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="MediaTypesDlg.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\mplayerc.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="OpenCapDeviceDlg.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="OpenDlg.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\OpenFileDlg.h">
+ </File>
+ <File
+ RelativePath=".\PixelShaderCompiler.h">
+ </File>
+ <File
+ RelativePath="PlayerCaptureBar.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerCaptureDialog.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerInfoBar.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerListCtrl.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerPlaylistBar.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerSeekBar.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PlayerShaderEditorBar.h">
+ </File>
+ <File
+ RelativePath="PlayerStatusBar.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerSubresyncBar.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PlayerToolBar.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="Playlist.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PnSPresetsDlg.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageAccelTbl.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageAudioSwitcher.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageBase.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageCasimir.h">
+ </File>
+ <File
+ RelativePath="PPageDVD.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageExternalFilters.h">
+ </File>
+ <File
+ RelativePath="PPageFileInfoClip.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageFileInfoDetails.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageFileInfoRes.h">
+ </File>
+ <File
+ RelativePath="PPageFileInfoSheet.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageFormats.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageInternalFilters.h">
+ </File>
+ <File
+ RelativePath=".\PPageLogo.h">
+ </File>
+ <File
+ RelativePath=".\PPageOutput.h">
+ </File>
+ <File
+ RelativePath="PPagePlayback.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPagePlayer.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageSheet.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageSubDB.h">
+ </File>
+ <File
+ RelativePath="PPageSubStyle.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageSubtitles.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="PPageTweaks.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\PPageWebServer.h">
+ </File>
+ <File
+ RelativePath="QuicktimeGraph.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="RealMediaGraph.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="RealMediaWindowlessSite.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="RegFilterChooserDlg.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Resource.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="SaveDlg.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="SaveTextFileDialog.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\SaveThumbnailsDialog.h">
+ </File>
+ <File
+ RelativePath="SelectMediaType.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ShaderAutoCompleteDlg.h">
+ </File>
+ <File
+ RelativePath=".\ShaderCombineDlg.h">
+ </File>
+ <File
+ RelativePath=".\ShaderEditorDlg.h">
+ </File>
+ <File
+ RelativePath="ShockwaveGraph.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="StaticLink.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="StatusLabel.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\StdAfx.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\SubtitleDlDlg.h">
+ </File>
+ <File
+ RelativePath="TextPassThruFilter.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\VMROSD.h">
+ </File>
+ <File
+ RelativePath="VolumeCtrl.h">
+ <FileConfiguration
+ Name="ResourceDLL|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\WebClientSocket.h">
+ </File>
+ <File
+ RelativePath=".\WebServer.h">
+ </File>
+ <File
+ RelativePath=".\WebServerSocket.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath="res\ani.avi">
+ </File>
+ <File
+ RelativePath=".\res\authhdrpic.bmp">
+ </File>
+ <File
+ RelativePath="res\icon.ico">
+ </File>
+ <File
+ RelativePath="res\Icon_114.ico">
+ </File>
+ <File
+ RelativePath="res\Icon_116.ico">
+ </File>
+ <File
+ RelativePath="res\Icon_41.ico">
+ </File>
+ <File
+ RelativePath=".\res\logo.0.bmp">
+ </File>
+ <File
+ RelativePath=".\res\logo.1.bmp">
+ </File>
+ <File
+ RelativePath=".\res\logo.2.bmp">
+ </File>
+ <File
+ RelativePath=".\res\logo.3.bmp">
+ </File>
+ <File
+ RelativePath=".\res\logo.4.bmp">
+ </File>
+ <File
+ RelativePath=".\res\logo.5.bmp">
+ </File>
+ <File
+ RelativePath=".\res\logo.6.bmp">
+ </File>
+ <File
+ RelativePath=".\res\logo.7.bmp">
+ </File>
+ <File
+ RelativePath="res\mono.bmp">
+ </File>
+ <File
+ RelativePath="res\mplayerc.manifest">
+ </File>
+ <File
+ RelativePath="res\multi.ico">
+ </File>
+ <File
+ RelativePath="res\noaudio.bmp">
+ </File>
+ <File
+ RelativePath="res\onoff.bmp">
+ </File>
+ <File
+ RelativePath="res\single.ico">
+ </File>
+ <File
+ RelativePath="res\stereo.bmp">
+ </File>
+ <File
+ RelativePath=".\res\streamtypes.bmp">
+ </File>
+ <File
+ RelativePath="res\toolbar1.bmp">
+ </File>
+ <Filter
+ Name="web"
+ Filter="">
+ <File
+ RelativePath=".\res\web\1pix.gif">
+ </File>
+ <File
+ RelativePath=".\res\web\404.html">
+ </File>
+ <File
+ RelativePath=".\res\web\bottomside.PNG">
+ </File>
+ <File
+ RelativePath=".\res\web\browser.html">
+ </File>
+ <File
+ RelativePath=".\res\web\controlback.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlbuttondecrate.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlbuttonincrate.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlbuttonpause.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlbuttonplay.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlbuttonskipback.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlbuttonskipforward.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlbuttonstep.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlbuttonstop.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controls.html">
+ </File>
+ <File
+ RelativePath=".\res\web\controlvolumebar.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlvolumegrip.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlvolumeoff.png">
+ </File>
+ <File
+ RelativePath=".\res\web\controlvolumeon.png">
+ </File>
+ <File
+ RelativePath=".\res\web\default.css">
+ </File>
+ <File
+ RelativePath=".\res\web\headerback.png">
+ </File>
+ <File
+ RelativePath=".\res\web\headerclose.png">
+ </File>
+ <File
+ RelativePath=".\res\web\headericon.png">
+ </File>
+ <File
+ RelativePath=".\res\web\index.html">
+ </File>
+ <File
+ RelativePath=".\res\web\leftbottomside.png">
+ </File>
+ <File
+ RelativePath=".\res\web\leftside.png">
+ </File>
+ <File
+ RelativePath=".\res\web\logo.png">
+ </File>
+ <File
+ RelativePath=".\res\web\player.html">
+ </File>
+ <File
+ RelativePath=".\res\web\rightbottomside.png">
+ </File>
+ <File
+ RelativePath=".\res\web\rightside.png">
+ </File>
+ <File
+ RelativePath=".\res\web\seekbargrip.png">
+ </File>
+ <File
+ RelativePath=".\res\web\seekbarleft.png">
+ </File>
+ <File
+ RelativePath=".\res\web\seekbarmid.png">
+ </File>
+ <File
+ RelativePath=".\res\web\seekbarright.png">
+ </File>
+ <File
+ RelativePath=".\res\web\sliderback.gif">
+ </File>
+ <File
+ RelativePath=".\res\web\sliderbar.gif">
+ </File>
+ <File
+ RelativePath=".\res\web\slidergrip.gif">
+ </File>
+ <File
+ RelativePath=".\res\web\vbg.gif">
+ </File>
+ <File
+ RelativePath=".\res\web\vbs.GIF">
+ </File>
+ </Filter>
+ <Filter
+ Name="shaders"
+ Filter="">
+ <File
+ RelativePath=".\res\shaders\contour.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\deinterlace (blend).psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\EdgeSharpen.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\emboss.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\empty.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\grayscale.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\invert.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\letterbox.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\procamp.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\resizer.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\sharpen.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\SharpenComplex.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\sphere.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\spotlight.psh">
+ </File>
+ <File
+ RelativePath=".\res\shaders\wave.psh">
+ </File>
+ </Filter>
+ </Filter>
+ <File
+ RelativePath=".\History.txt">
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="1"/>
+ <Global
+ Name="RESOURCE_FILE"
+ Value="mplayerc.rc"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/apps/mplayerc/mplayerc.vcproj.vspscc b/src/apps/mplayerc/mplayerc.vcproj.vspscc
new file mode 100644
index 000000000..69ee94fb8
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:apps\\mplayerc"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
+}
diff --git a/src/apps/mplayerc/mplayerc.vssscc b/src/apps/mplayerc/mplayerc.vssscc
new file mode 100644
index 000000000..69ee94fb8
--- /dev/null
+++ b/src/apps/mplayerc/mplayerc.vssscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:apps\\mplayerc"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
+}
diff --git a/src/apps/mplayerc/res/Icon_114.ico b/src/apps/mplayerc/res/Icon_114.ico
new file mode 100644
index 000000000..31c5175ad
--- /dev/null
+++ b/src/apps/mplayerc/res/Icon_114.ico
Binary files differ
diff --git a/src/apps/mplayerc/res/Icon_116.ico b/src/apps/mplayerc/res/Icon_116.ico
new file mode 100644
index 000000000..9c10e4bdd
--- /dev/null
+++ b/src/apps/mplayerc/res/Icon_116.ico
Binary files differ
diff --git a/src/apps/mplayerc/res/Icon_41.ico b/src/apps/mplayerc/res/Icon_41.ico
new file mode 100644
index 000000000..ac42fb931
--- /dev/null
+++ b/src/apps/mplayerc/res/Icon_41.ico
Binary files differ
diff --git a/src/apps/mplayerc/res/ani.avi b/src/apps/mplayerc/res/ani.avi
new file mode 100644
index 000000000..df6050bde
--- /dev/null
+++ b/src/apps/mplayerc/res/ani.avi
Binary files differ
diff --git a/src/apps/mplayerc/res/authhdrpic.bmp b/src/apps/mplayerc/res/authhdrpic.bmp
new file mode 100644
index 000000000..69deb8350
--- /dev/null
+++ b/src/apps/mplayerc/res/authhdrpic.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/icon.ico b/src/apps/mplayerc/res/icon.ico
new file mode 100644
index 000000000..3178cc5a6
--- /dev/null
+++ b/src/apps/mplayerc/res/icon.ico
Binary files differ
diff --git a/src/apps/mplayerc/res/logo.0.bmp b/src/apps/mplayerc/res/logo.0.bmp
new file mode 100644
index 000000000..978a9186b
--- /dev/null
+++ b/src/apps/mplayerc/res/logo.0.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/logo.1.bmp b/src/apps/mplayerc/res/logo.1.bmp
new file mode 100644
index 000000000..3efad7a94
--- /dev/null
+++ b/src/apps/mplayerc/res/logo.1.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/logo.2.bmp b/src/apps/mplayerc/res/logo.2.bmp
new file mode 100644
index 000000000..70ec7af39
--- /dev/null
+++ b/src/apps/mplayerc/res/logo.2.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/logo.3.bmp b/src/apps/mplayerc/res/logo.3.bmp
new file mode 100644
index 000000000..b30c1c198
--- /dev/null
+++ b/src/apps/mplayerc/res/logo.3.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/logo.4.bmp b/src/apps/mplayerc/res/logo.4.bmp
new file mode 100644
index 000000000..e1d73700b
--- /dev/null
+++ b/src/apps/mplayerc/res/logo.4.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/logo.5.bmp b/src/apps/mplayerc/res/logo.5.bmp
new file mode 100644
index 000000000..a1000289f
--- /dev/null
+++ b/src/apps/mplayerc/res/logo.5.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/logo.6.bmp b/src/apps/mplayerc/res/logo.6.bmp
new file mode 100644
index 000000000..26c357f3e
--- /dev/null
+++ b/src/apps/mplayerc/res/logo.6.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/logo.7.bmp b/src/apps/mplayerc/res/logo.7.bmp
new file mode 100644
index 000000000..a750ce2a1
--- /dev/null
+++ b/src/apps/mplayerc/res/logo.7.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/mono.bmp b/src/apps/mplayerc/res/mono.bmp
new file mode 100644
index 000000000..7c9eeb012
--- /dev/null
+++ b/src/apps/mplayerc/res/mono.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/mpc.png b/src/apps/mplayerc/res/mpc.png
new file mode 100644
index 000000000..61230b249
--- /dev/null
+++ b/src/apps/mplayerc/res/mpc.png
Binary files differ
diff --git a/src/apps/mplayerc/res/mplayerc.manifest b/src/apps/mplayerc/res/mplayerc.manifest
new file mode 100644
index 000000000..6e21a7389
--- /dev/null
+++ b/src/apps/mplayerc/res/mplayerc.manifest
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<!--assemblyIdentity
+ version="6.4.0.1"
+ processorArchitecture="X86"
+ name="Gabest.VobSub.MediaPlayerClassic"
+ type="win32"
+/-->
+<description>MediaPlayerClassic</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="X86"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+</assembly>
+
diff --git a/src/apps/mplayerc/res/multi.ico b/src/apps/mplayerc/res/multi.ico
new file mode 100644
index 000000000..96584e103
--- /dev/null
+++ b/src/apps/mplayerc/res/multi.ico
Binary files differ
diff --git a/src/apps/mplayerc/res/noaudio.bmp b/src/apps/mplayerc/res/noaudio.bmp
new file mode 100644
index 000000000..f3ea250ec
--- /dev/null
+++ b/src/apps/mplayerc/res/noaudio.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/onoff.bmp b/src/apps/mplayerc/res/onoff.bmp
new file mode 100644
index 000000000..b40c5c9f9
--- /dev/null
+++ b/src/apps/mplayerc/res/onoff.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/shaders/EdgeSharpen.psh b/src/apps/mplayerc/res/shaders/EdgeSharpen.psh
new file mode 100644
index 000000000..6b6c4916b
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/EdgeSharpen.psh
@@ -0,0 +1,63 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+#define NbPixel 1
+
+#define Edge_threshold 0.2
+
+#define Sharpen_val0 2.0
+#define Sharpen_val1 0.125
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+// taille de NbPixel pixels
+float dx = NbPixel/width;
+float dy = NbPixel/height;
+float4 Res = 0;
+
+// Détection de contour par Prewitt
+ // récuppération des 9 points
+ // [ 1, 2, 3 ]
+ // [ 4, 0, 5 ]
+ // [ 6, 7, 8 ]
+ float4 c0 = tex2D(s0, tex);
+ float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
+ float4 c2 = tex2D(s0, tex + float2(0,-dy));
+ float4 c3 = tex2D(s0, tex + float2(dx,-dy));
+ float4 c4 = tex2D(s0, tex + float2(-dx,0));
+ float4 c5 = tex2D(s0, tex + float2(dx,0));
+ float4 c6 = tex2D(s0, tex + float2(-dx,dy));
+ float4 c7 = tex2D(s0, tex + float2(0,dy));
+ float4 c8 = tex2D(s0, tex + float2(dx,dy));
+
+ // Calcul des 3 vecteurs dérivé (hor,vert, diag1, diag2)
+ float4 delta1 = (c6+c4+c1-c3-c5-c8);
+ float4 delta2 = (c4+c1+c2-c5-c8-c7);
+ float4 delta3 = (c1+c2+c3-c8-c7-c6);
+ float4 delta4 = (c2+c3+c5-c7-c6-c4);
+
+ // calcul du Prewitt
+ float value = length(abs(delta1) + abs(delta2) + abs(delta3) + abs(delta4))/6;
+
+// Si c'est un contour (vector lenght > Edge_threshold) => filtre de sharpen
+ if(value > Edge_threshold )
+ {
+ Res = c0 * Sharpen_val0 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * Sharpen_val1 ;
+ // Pour voir les contour en rouge ...
+ //Res = float4( 1.0, 0.0, 0.0, 0.0 );
+
+ return Res;
+ }
+ else
+ return c0;
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/SharpenComplex.psh b/src/apps/mplayerc/res/shaders/SharpenComplex.psh
new file mode 100644
index 000000000..5b1179820
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/SharpenComplex.psh
@@ -0,0 +1,82 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+
+#define dx (p1[0])
+#define dy (p1[1])
+
+float4 main( float2 tex : TEXCOORD0 ) : COLOR
+{
+// definition des pixels : original, flouté, corigé, final
+float4 ori;
+float4 flou;
+float4 cori;
+float4 final;
+
+////////////////////////////////////////////////////
+// récuppération de la matrice de 9 points
+// [ 1, 2 , 3 ]
+// [ 4,ori, 5 ]
+// [ 6, 7 , 8 ]
+
+ ori = tex2D(s0, tex);
+ float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
+ float4 c2 = tex2D(s0, tex + float2(0,-dy));
+ float4 c3 = tex2D(s0, tex + float2(dx,-dy));
+ float4 c4 = tex2D(s0, tex + float2(-dx,0));
+ float4 c5 = tex2D(s0, tex + float2(dx,0));
+ float4 c6 = tex2D(s0, tex + float2(-dx,dy));
+ float4 c7 = tex2D(s0, tex + float2(0,dy));
+ float4 c8 = tex2D(s0, tex + float2(dx,dy));
+
+////////////////////////////////////////////////////
+// calcul image floue (filtre gaussien)
+ // pour normaliser les valeurs, il faut diviser par la somme des coef
+ // 1/(1+2+1+2+4+2+1+2+1) = 1/ 16 = .0625
+ flou = (c1+c3+c6+c8 + 2*(c2+c4+c5+c7)+ 4*ori)*0.0625;
+
+// soustraction de l'image flou à l'image originale
+ cori = 2*ori - flou;
+
+////////////////////////////////////////////////////
+// détection des contours
+float delta1;
+float delta2;
+float value;
+
+// par filtre de sobel
+ // Gradient horizontal
+ // [ -1, 0 ,1 ]
+ // [ -2, 0, 2 ]
+ // [ -1, 0 ,1 ]
+ delta1 = (c3 + 2*c5 + c8)-(c1 + 2*c4 + c6);
+
+ // Gradient vertical
+ // [ -1,- 2,-1 ]
+ // [ 0, 0, 0 ]
+ // [ 1, 2, 1 ]
+ delta2 = (c6 + 2*c7 + c8)-(c1 + 2*c2 + c3);
+
+ // calcul
+ value = sqrt( mul(delta1,delta1) + mul(delta2,delta2) ) ;
+
+ if( value >.3 )
+ {
+////////////////////////////////////////////////////
+// si contour, sharpen
+#define Sharpen_val0 2.0
+#define Sharpen_val1 0.125
+ final = ori*2 - (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 ) * 0.125 ;
+// final= float4(1,0,0,0);
+ return final;
+ }
+ else
+ {
+////////////////////////////////////////////////////
+// sinon, image corrigée
+ return cori;
+ }
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/contour.psh b/src/apps/mplayerc/res/shaders/contour.psh
new file mode 100644
index 000000000..7b0480d50
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/contour.psh
@@ -0,0 +1,30 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float dx = 4/width;
+ float dy = 4/height;
+
+ float4 c2 = tex2D(s0, tex + float2(0,-dy));
+ float4 c4 = tex2D(s0, tex + float2(-dx,0));
+ float4 c5 = tex2D(s0, tex + float2(0,0));
+ float4 c6 = tex2D(s0, tex + float2(dx,0));
+ float4 c8 = tex2D(s0, tex + float2(0,dy));
+
+ float4 c0 = (-c2-c4+c5*4-c6-c8);
+ if(length(c0) < 1.0) c0 = float4(0,0,0,0);
+ else c0 = float4(1,1,1,0);
+
+ return c0;
+}
diff --git a/src/apps/mplayerc/res/shaders/deinterlace (blend).psh b/src/apps/mplayerc/res/shaders/deinterlace (blend).psh
new file mode 100644
index 000000000..2dc2606e5
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/deinterlace (blend).psh
@@ -0,0 +1,24 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float4 c0 = tex2D(s0, tex);
+
+ float2 h = float2(0, 1/height);
+ float4 c1 = tex2D(s0, tex-h);
+ float4 c2 = tex2D(s0, tex+h);
+ c0 = (c0*2+c1+c2)/4;
+
+ return c0;
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/emboss.psh b/src/apps/mplayerc/res/shaders/emboss.psh
new file mode 100644
index 000000000..4dc2bba00
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/emboss.psh
@@ -0,0 +1,30 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float dx = 1/width;
+ float dy = 1/height;
+
+ float4 c1 = tex2D(s0, tex + float2(-dx,-dy));
+ float4 c2 = tex2D(s0, tex + float2(0,-dy));
+ float4 c4 = tex2D(s0, tex + float2(-dx,0));
+ float4 c6 = tex2D(s0, tex + float2(dx,0));
+ float4 c8 = tex2D(s0, tex + float2(0,dy));
+ float4 c9 = tex2D(s0, tex + float2(dx,dy));
+
+ float4 c0 = (-c1-c2-c4+c6+c8+c9);
+ c0 = (c0.r+c0.g+c0.b)/3 + 0.5;
+
+ return c0;
+}
diff --git a/src/apps/mplayerc/res/shaders/empty.psh b/src/apps/mplayerc/res/shaders/empty.psh
new file mode 100644
index 000000000..3d0ab987a
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/empty.psh
@@ -0,0 +1,19 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float4 c0 = tex2D(s0, tex);
+
+ return c0;
+}
diff --git a/src/apps/mplayerc/res/shaders/grayscale.psh b/src/apps/mplayerc/res/shaders/grayscale.psh
new file mode 100644
index 000000000..d57c94201
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/grayscale.psh
@@ -0,0 +1,19 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float c0 = dot(tex2D(s0, tex), float4(0.299, 0.587, 0.114, 0));
+
+ return c0;
+}
diff --git a/src/apps/mplayerc/res/shaders/invert.psh b/src/apps/mplayerc/res/shaders/invert.psh
new file mode 100644
index 000000000..4d61115c3
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/invert.psh
@@ -0,0 +1,19 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float4 c0 = float4(1, 1, 1, 1) - tex2D(s0, tex);
+
+ return c0;
+}
diff --git a/src/apps/mplayerc/res/shaders/letterbox.psh b/src/apps/mplayerc/res/shaders/letterbox.psh
new file mode 100644
index 000000000..c3a17297b
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/letterbox.psh
@@ -0,0 +1,25 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float4 c0 = 0;
+
+ float2 ar = float2(16, 9);
+ float h = (1 - width/height * ar.y/ar.x) / 2;
+
+ if(tex.y >= h && tex.y <= 1-h)
+ c0 = tex2D(s0, tex);
+
+ return c0;
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/procamp.psh b/src/apps/mplayerc/res/shaders/procamp.psh
new file mode 100644
index 000000000..ec331d6bd
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/procamp.psh
@@ -0,0 +1,61 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+static float4x4 r2y =
+{
+ 0.299, 0.587, 0.114, 0,
+ -0.147, -0.289, 0.437, 0,
+ 0.615, -0.515, -0.100, 0,
+ 0, 0, 0, 0
+};
+
+static float4x4 y2r =
+{
+ 1.0, 0.0, 1.140, 0,
+ 1.0, -0.394, -0.581, 0,
+ 1.0, 2.028, 0.0, 0,
+ 0, 0, 0, 0
+};
+
+#define ymin (16.0/255)
+#define ymax (235.0/255)
+
+// Brightness: -1.0 to 1.0, default 0.0
+// Contrast: 0.0 to 10.0, default 1.0
+// Hue: -180.0 to +180.0, default 0.0
+// Saturation: 0.0 to 10.0, default 1.0
+
+#define Brightness 0.0
+#define Contrast 1.0
+#define Hue 0.0
+#define Saturation 1.0
+
+// tv -> pc scale
+// #define Brightness (-ymin)
+// #define Contrast (1.0/(ymax-ymin))
+
+static float2x2 HueMatrix =
+{
+ cos(Hue * PI / 180), sin(Hue * PI / 180),
+ -sin(Hue * PI / 180), cos(Hue * PI / 180)
+};
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float4 c0 = tex2D(s0, tex);
+ c0 = mul(r2y, c0);
+ c0.r = Contrast * (c0.r - ymin) + ymin + Brightness;
+ c0.gb = mul(HueMatrix, c0.gb) * Saturation;
+ c0 = mul(y2r, c0);
+ return c0;
+}
diff --git a/src/apps/mplayerc/res/shaders/resizer.psh b/src/apps/mplayerc/res/shaders/resizer.psh
new file mode 100644
index 000000000..1c31f7653
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/resizer.psh
@@ -0,0 +1,105 @@
+
+sampler s0 : register(s0);
+sampler s1 : register(s1);
+sampler s2 : register(s2);
+sampler s3 : register(s3);
+sampler s4 : register(s4);
+
+float4 p0 : register(c0);
+float2 dxdy : register(c1);
+float2 dx : register(c2);
+float2 dy : register(c3);
+
+#define A _The_Value_Of_A_Is_Set_Here_
+
+// none of the resizers here can be used for 1:1 mapping!
+// tex * size won't be 0, 1, 2, 3, .. as you might expect, but something like 0, 0.999, 2.001, 2.999, ...
+// this means when the fractional part becomes 0.999 we will be interpolating with the wrong value!!!
+
+struct PS_INPUT
+{
+ float2 t0 : TEXCOORD0;
+ float2 t1 : TEXCOORD1;
+ float2 t2 : TEXCOORD2;
+ float2 t3 : TEXCOORD3;
+ float2 t4 : TEXCOORD4;
+};
+
+float4 main_bilinear(PS_INPUT input) : COLOR
+{
+ float2 dd = frac(input.t4);
+
+ float4 c = lerp(
+ lerp(tex2D(s0, input.t0), tex2D(s1, input.t1), dd.x),
+ lerp(tex2D(s2, input.t2), tex2D(s3, input.t3), dd.x),
+ dd.y);
+
+ return c;
+}
+
+static float4x4 tco =
+{
+ 0, A, -2*A, A,
+ 1, 0, -A-3, A+2,
+ 0, -A, 2*A+3, -A-2,
+ 0, 0, A, -A
+};
+
+float4 taps(float t)
+{
+ return mul(tco, float4(1, t, t*t, t*t*t));
+}
+
+float4 SampleX(float4 tx, float2 t0)
+{
+ return
+ mul(tx,
+ float4x4(
+ tex2D(s0, t0 - dx),
+ tex2D(s0, t0),
+ tex2D(s0, t0 + dx),
+ tex2D(s0, t0 + dx + dx)
+ )
+ );
+}
+
+float4 SampleY(float4 tx, float4 ty, float2 t0)
+{
+ return
+ mul(ty,
+ float4x4(
+ SampleX(tx, t0 - dy),
+ SampleX(tx, t0),
+ SampleX(tx, t0 + dy),
+ SampleX(tx, t0 + dy + dy)
+ )
+ );
+}
+
+float4 main_bicubic1pass(PS_INPUT input) : COLOR
+{
+ float2 dd = frac(input.t1);
+ return SampleY(taps(dd.x), taps(dd.y), input.t0);
+ // return SampleY(tex1D(s1, dd.x), tex1D(s1, dd.y), input.t0);
+}
+
+float4 Sample(float4 t, PS_INPUT input)
+{
+ return
+ mul(t,
+ float4x4(
+ tex2D(s0, input.t0),
+ tex2D(s1, input.t1),
+ tex2D(s2, input.t2),
+ tex2D(s3, input.t3)
+ )
+ );
+}
+
+float4 main_bicubic2pass(PS_INPUT input) : COLOR
+{
+ float2 dd = frac(input.t4);
+ return Sample(taps(dd.x), input);
+ // return Sample(tex1D(s4, dd.x), input);
+}
+
diff --git a/src/apps/mplayerc/res/shaders/sharpen.psh b/src/apps/mplayerc/res/shaders/sharpen.psh
new file mode 100644
index 000000000..e1001f476
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/sharpen.psh
@@ -0,0 +1,30 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define effect_width (1.6)
+#define val0 (2.0)
+#define val1 (-0.125)
+
+#define width (p0[0])
+#define height (p0[1])
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float dx = effect_width/width;
+ float dy = effect_width/height;
+
+ float4 c1 = tex2D(s0, tex + float2(-dx,-dy)) * val1;
+ float4 c2 = tex2D(s0, tex + float2(0,-dy)) * val1;
+ float4 c3 = tex2D(s0, tex + float2(-dx,0)) * val1;
+ float4 c4 = tex2D(s0, tex + float2(dx,0)) * val1;
+ float4 c5 = tex2D(s0, tex + float2(0,dy)) * val1;
+ float4 c6 = tex2D(s0, tex + float2(dx,dy)) * val1;
+ float4 c7 = tex2D(s0, tex + float2(-dx,+dy)) * val1;
+ float4 c8 = tex2D(s0, tex + float2(+dx,-dy)) * val1;
+ float4 c9 = tex2D(s0, tex) * val0;
+
+ float4 c0 = (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 +c9);
+
+ return c0;
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/shaders/sphere.psh b/src/apps/mplayerc/res/shaders/sphere.psh
new file mode 100644
index 000000000..62dca5645
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/sphere.psh
@@ -0,0 +1,60 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ // - this is a very simple raytracer, one sphere only
+ // - no reflection or refraction, yet (my ati 9800 has a 64 + 32 instruction limit...)
+
+ float3 pl = float3(3,-3,-4); // light pos
+ float4 cl = 0.4; // light color
+
+ float3 pc = float3(0,0,-1); // cam pos
+ float3 ps = float3(0,0,0.5); // sphere pos
+ float r = 0.65; // sphere radius
+
+ float3 pd = normalize(float3(tex.x-0.5, tex.y-0.5, 0) - pc);
+
+ float A = 1;
+ float B = 2*dot(pd, pc - ps);
+ float C = dot(pc - ps, pc - ps) - r*r;
+ float D = B*B - 4*A*C;
+
+ float4 c0 = 0;
+
+ if(D >= 0)
+ {
+ // t2 is the smaller, obviously...
+ // float t1 = (-B + sqrt(D)) / (2*A);
+ // float t2 = (-B - sqrt(D)) / (2*A);
+ // float t = min(t1, t2);
+
+ float t = (-B - sqrt(D)) / (2*A);
+
+ // intersection data
+ float3 p = pc + pd*t;
+ float3 n = normalize(p - ps);
+ float3 l = normalize(pl - p);
+
+ // mapping the image onto the sphere
+ tex = acos(-n)/PI;
+
+ // rotate it
+ tex.x = frac(tex.x + frac(clock/10));
+
+ // diffuse + specular
+ c0 = tex2D(s0, tex) * dot(n, l) + cl * pow(max(dot(l, reflect(pd, n)), 0), 50);
+ }
+
+ return c0;
+}
diff --git a/src/apps/mplayerc/res/shaders/spotlight.psh b/src/apps/mplayerc/res/shaders/spotlight.psh
new file mode 100644
index 000000000..1a185a8f4
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/spotlight.psh
@@ -0,0 +1,22 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ float4 c0 = tex2D(s0, tex);
+ float3 lightsrc = float3(sin(clock*PI/1.5)/2+0.5,cos(clock*PI)/2+0.5,1);
+ float3 light = normalize(lightsrc - float3(tex.x,tex.y,0));
+ c0 *= pow(dot(light, float3(0,0,1)), 50);
+
+ return c0;
+}
diff --git a/src/apps/mplayerc/res/shaders/wave.psh b/src/apps/mplayerc/res/shaders/wave.psh
new file mode 100644
index 000000000..8cc42ed5c
--- /dev/null
+++ b/src/apps/mplayerc/res/shaders/wave.psh
@@ -0,0 +1,29 @@
+sampler s0 : register(s0);
+float4 p0 : register(c0);
+float4 p1 : register(c1);
+
+#define width (p0[0])
+#define height (p0[1])
+#define counter (p0[2])
+#define clock (p0[3])
+#define one_over_width (p1[0])
+#define one_over_height (p1[1])
+
+#define PI acos(-1)
+
+float4 main(float2 tex : TEXCOORD0) : COLOR
+{
+ // don't look at this for too long, you'll get dizzy :)
+
+ float4 c0 = 0;
+
+ tex.x += sin(tex.x+clock/0.3)/20;
+ tex.y += sin(tex.x+clock/0.3)/20;
+
+ if(tex.x >= 0 && tex.x <= 1 && tex.y >= 0 && tex.y <= 1)
+ {
+ c0 = tex2D(s0, tex);
+ }
+
+ return c0;
+}
diff --git a/src/apps/mplayerc/res/single.ico b/src/apps/mplayerc/res/single.ico
new file mode 100644
index 000000000..626da9bc2
--- /dev/null
+++ b/src/apps/mplayerc/res/single.ico
Binary files differ
diff --git a/src/apps/mplayerc/res/stereo.bmp b/src/apps/mplayerc/res/stereo.bmp
new file mode 100644
index 000000000..fec2e16ba
--- /dev/null
+++ b/src/apps/mplayerc/res/stereo.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/streamtypes.bmp b/src/apps/mplayerc/res/streamtypes.bmp
new file mode 100644
index 000000000..8aef07389
--- /dev/null
+++ b/src/apps/mplayerc/res/streamtypes.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/toolbar1.bmp b/src/apps/mplayerc/res/toolbar1.bmp
new file mode 100644
index 000000000..a0cd5087a
--- /dev/null
+++ b/src/apps/mplayerc/res/toolbar1.bmp
Binary files differ
diff --git a/src/apps/mplayerc/res/web/1pix.gif b/src/apps/mplayerc/res/web/1pix.gif
new file mode 100644
index 000000000..410a04b28
--- /dev/null
+++ b/src/apps/mplayerc/res/web/1pix.gif
Binary files differ
diff --git a/src/apps/mplayerc/res/web/404.html b/src/apps/mplayerc/res/web/404.html
new file mode 100644
index 000000000..eabeda830
--- /dev/null
+++ b/src/apps/mplayerc/res/web/404.html
@@ -0,0 +1,10 @@
+<html>
+ <head>
+ <title>MPC WebServer</title>
+ <link rel="stylesheet" type="text/css" href="/default.css">
+ </head>
+ <body>
+ <strong>404 - The requested URL was not found!</strong>
+ </body>
+</html>
+[debug]
diff --git a/src/apps/mplayerc/res/web/bottomside.png b/src/apps/mplayerc/res/web/bottomside.png
new file mode 100644
index 000000000..69d4e40d1
--- /dev/null
+++ b/src/apps/mplayerc/res/web/bottomside.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/browser.html b/src/apps/mplayerc/res/web/browser.html
new file mode 100644
index 000000000..6cae6c267
--- /dev/null
+++ b/src/apps/mplayerc/res/web/browser.html
@@ -0,0 +1,28 @@
+<html>
+ <head>
+ <title>MPC WebServer</title>
+ <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=[charset]">
+ <link rel="stylesheet" type="text/css" href="/default.css">
+ </head>
+ <body>
+ <p>
+ <table border="1" cellpadding="2" cellspacing="1" width="100%">
+ <tr>
+ <td align="center"><strong>Location: </strong>[currentdir]</td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <table border="1" cellpadding="2" cellspacing="1" width="100%">
+ <tr>
+ <th width="100%"><nobr>Name</nobr></th>
+ <th><nobr>Type</nobr></th>
+ <th><nobr>Size</nobr></th>
+ <th><nobr>Date Modified</nobr></th>
+ </tr>
+ [currentfiles]
+ </table>
+ </p>
+ </body>
+</html>
+[debug]
diff --git a/src/apps/mplayerc/res/web/controlback.png b/src/apps/mplayerc/res/web/controlback.png
new file mode 100644
index 000000000..9dddb5e7e
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlback.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlbuttondecrate.png b/src/apps/mplayerc/res/web/controlbuttondecrate.png
new file mode 100644
index 000000000..73e0c23e1
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlbuttondecrate.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlbuttonincrate.png b/src/apps/mplayerc/res/web/controlbuttonincrate.png
new file mode 100644
index 000000000..aeb31385d
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlbuttonincrate.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlbuttonpause.png b/src/apps/mplayerc/res/web/controlbuttonpause.png
new file mode 100644
index 000000000..f8837a310
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlbuttonpause.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlbuttonplay.png b/src/apps/mplayerc/res/web/controlbuttonplay.png
new file mode 100644
index 000000000..2f97c6f02
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlbuttonplay.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlbuttonskipback.png b/src/apps/mplayerc/res/web/controlbuttonskipback.png
new file mode 100644
index 000000000..aba644ee1
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlbuttonskipback.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlbuttonskipforward.png b/src/apps/mplayerc/res/web/controlbuttonskipforward.png
new file mode 100644
index 000000000..db720c892
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlbuttonskipforward.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlbuttonstep.png b/src/apps/mplayerc/res/web/controlbuttonstep.png
new file mode 100644
index 000000000..2eb1671cd
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlbuttonstep.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlbuttonstop.png b/src/apps/mplayerc/res/web/controlbuttonstop.png
new file mode 100644
index 000000000..fcc80afa9
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlbuttonstop.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controls.html b/src/apps/mplayerc/res/web/controls.html
new file mode 100644
index 000000000..6a55fd506
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controls.html
@@ -0,0 +1,1735 @@
+<html>
+ <head>
+ <title>MPC WebServer</title>
+ <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=[charset]">
+ <link rel="stylesheet" type="text/css" href="/default.css">
+ <script language="JavaScript" type="text/JavaScript">
+
+ // var filedir = "[filedirarg]";
+ var filepath = "[filepath]";
+ var curpos = [position];
+ var length = [duration];
+ var state = [state];
+ var pbr = [playbackrate];
+ var eta = [reloadtime];
+ var volume = [volumelevel];
+ var muted = [muted]; // -1 no sound
+
+ var starttime = (new Date()).getTime();
+ var slidersize = 500;
+ var sliderbuttonwidth = 15;
+ var vsb=10;
+ var vss=100;
+ var sc=0
+ var rdirt
+ var AP
+ var RL
+ var rpt
+ var etaup=false
+
+ if (eta==0) eta=(state<0 && filepath.length>0)?2:120;
+
+ function init()
+ {
+ if (eta>0) RL=setTimeout("etaup=true; if (re.checked==true) postform(0,'null',0);",1000*eta);
+ Live=(length<1);
+ starttime=starttime-curpos;
+ rdirt=length*pbr/slidersize;
+ rdirt=Math.floor(rdirt>1000?1000:(rdirt<300?300:rdirt))
+ cpf=document.getElementById("pos")
+ cp=document.getElementById("time")
+ sas=document.getElementById("SliderAutoScroll")
+ re=document.getElementById("reloadenabled")
+ s=document.getElementById("slider")
+ sb1=document.getElementById("c1")
+ sb2=document.getElementById("c2")
+ sb3=document.getElementById("c3")
+ vs=document.getElementById("v")
+ vs1=document.getElementById("v1")
+ vs2=document.getElementById("v2")
+ vs3=document.getElementById("v3")
+ document.getElementById("muted").innerHTML= muted == -1 ? "X" : muted == 1 ? "M" : "&nbsp;&nbsp;";
+
+ s.height=sb1.height=sb2.height=sb3.height=vs.height=vs1.height=vs2.height=vs3.height=20
+ s.width=slidersize+(sb2.width=sliderbuttonwidth);
+ vs.width=vss+(vs2.width=vsb);
+
+ sb1.onclick=sb2.onclick=sb3.onclick=sliderclick
+ vs1.onclick=vs2.onclick=vs3.onclick=vsliderclick
+
+ sas.checked=true;
+ // g=" "+secondsToTS(curpos,0,true)+" "+x<0?("Buffering %"+(-x-1).toString()):"";
+ cp.innerHTML = cpf.value=secondsToTS(curpos,5,false);
+ rpt=curpos;
+ if (state==2 && pbr!=0)
+ autoplay();
+ vupdate(volume,true);
+ return update(curpos,true);
+ }
+ function autoplay(a)
+ {
+ if (etaup && re.checked==true)
+ {
+ etaup=false;
+ RL=setTimeout("etaup=true; if (re.checked==true) postform(0,'null',0);",5000);
+ }
+ AP=setTimeout('autoplay()',rdirt);
+ var ct = (new Date()).getTime();
+ var cap=pbr*(ct-starttime);
+ if (cap>length && !Live) if (re.checked==true) RL=setTimeout('window.location=window.location',5000);
+ cap=((cap>length && !Live)?length:(cap<0?0:cap))
+ if (sas.checked==true || a==true)
+ {
+ update(cap,true)
+ cpf.value=secondsToTS(cap,5,false);
+ }
+ var gg = " "+secondsToTS(cap,5,true)+" ";
+ cp.innerHTML = gg;
+ rpt=cap;
+ return true;
+ }
+ function pad(number, length)
+ {
+ var str = '' + number;
+ while(str.length < length) str = '0' + str;
+ return str;
+ }
+ function secondsToTS(a,b,c)
+ {
+ var a1 = Math.floor(a/3600000);
+ var a2 = Math.floor(a/60000)%60;
+ var a3 = Math.floor(a/1000)%60;
+ var a4 = Math.floor(a)%1000;
+ var a1s = pad(a1.toString(),2);
+ var a2s = pad(a2.toString(),2);
+ var a3s = pad(a3.toString(),2);
+ var a4s = pad(a4.toString(),3);
+ switch(b){
+ case 1: return a1s;
+ case 2: return a2s;
+ case 3: return a3s;
+ case 4: return a4s;
+ case 5: //return a1s+":"+a2s+":"+a3s+"."+a4s;
+ case 6: //return ((a1>0?(a1s+":"):"")+a2s+":"+a3s+"."+a4s);
+ case 7: return a1s+":"+a2s+":"+a3s;
+ default: return ((a1>0?(a1s+":"):"")+a2s+":"+a3s);
+ }
+ return "bahh";
+ }
+ function parsetime(y)
+ {
+ ts=timesyntax(y)
+ t = 0
+ p1=ts.indexOf(".")
+ p2=ts.indexOf(":")
+ p3=ts.indexOf(":",p2+1)
+ p4=ts.indexOf(":",p3+1)
+ if (p4!=-1 || (p1!=-1 && p2!=-1 && p2>p1) || (p1!=-1 && p3!=-1 && p3>p1)) return -2000;
+ p1=(p1 == -1?ts.length+1:p1)
+ if (p2 == -1) t=parseFloat((ts+" ").substring(0,p1+4));
+ if (p2 != -1 && p3 == -1) t=parseInt(ts.substring(0,p2))*60 +
+ parseFloat("0"+(ts+" ").substring(p2+1,p1+4));
+ if (p2 != -1 && p3 != -1) t=parseInt(ts.substring(0,p2))*3600 +
+ parseInt(ts.substring(p2+1,p3))*60 +
+ parseFloat("0"+(ts+" ").substring(p3+1,p1+4));
+ return t;
+ }
+ function update(a,b)
+ {
+ if (a==-2000) return false;
+ if (b){ m=(curpos=((a>length && !Live)?length:(a<0?0:a)))*slidersize/length; }
+ else{ curpos=(m=(a>slidersize?slidersize:(a<0?0:a)))*length/slidersize; }
+ if (m>sb1.width)
+ {sb3.width=slidersize-Math.floor(m); sb1.width=m;}else
+ {sb1.width=m; sb3.width=slidersize-sb1.width;}
+ return true;
+ }
+ function sliderclick(e)
+ {
+ update( (window.event?window.event.clientX-3:e.clientX) + document.body.scrollLeft -
+ getoffsetx(s) - Math.floor(sliderbuttonwidth/2) + sc, false);
+ cpf.value=secondsToTS(curpos,5,false);
+ sas.checked=false;
+ return true;
+ }
+ function getoffsetx(m)
+ {
+ var x = m.offsetLeft;
+ while (m.offsetParent) {x += (m = m.offsetParent).offsetLeft; }
+ return x;
+ }
+ function posupdate()
+ {
+ if (event.keyCode < 46 || event.keyCode > 58 || event.keyCode==47)
+ return false;
+ self.setTimeout('update(parseFloat(parsetime(cpf.value)),true)',1);
+ return true;
+ }
+
+ function timesyntax(ts)
+ {
+ var b=""
+ for(a=0;a<ts.length;a++)
+ {
+ switch(ts.charAt(a)){
+ case "0": b+="0";break;
+ case "1": b+="1";break;
+ case "2": b+="2";break;
+ case "3": b+="3";break;
+ case "4": b+="4";break;
+ case "5": b+="5";break;
+ case "6": b+="6";break;
+ case "7": b+="7";break;
+ case "8": b+="8";break;
+ case "9": b+="9";break;
+ case ".": b+=".";break;
+ case ":": b+=":";break;
+ default: break;}
+ }
+ return b;
+ }
+
+ function vupdate(a,b)
+ {
+ if (b){ m=(volume=((a>100)?100:(a<0?0:a)))*vss/100; }
+ else{ volume=(m=(a>vss?vss:(a<0?0:a)))*100/vss; }
+ volume=Math.ceil(volume)
+ vs1.width=m;
+ vs3.width=vss-vs1.width;
+ return true;
+ }
+ function vsliderclick(e)
+ {
+ return vupdate( (window.event?window.event.clientX-3:e.clientX) + document.body.scrollLeft -
+ getoffsetx(vs) - Math.floor(vsb/2) + sc, false);
+ }
+ function postform(wmc,ext,extv)
+ {
+ document.getElementById("fwmc").value=wmc;
+ document.getElementById("fextra").value=extv;
+ document.getElementById("fextra").name=ext;
+ document.getElementById("ef").submit();
+ return true;
+ }
+
+ </script>
+ </head>
+ <body onload="init()">
+ <p>
+ <strong>
+ Feel free to redesign this page (nice image buttons, more "player-like" layout, etc.), but if you do
+ alter the page <a href="http://cvs.sourceforge.net/viewcvs.py/guliverkli/guliverkli/src/apps/mplayerc/res/web/">here</a>
+ and not the one you can save from the browser. Post your comments, remarks, ideas, progress into
+ <a href="https://sourceforge.net/forum/message.php?msg_id=2357783">this topic</a>.
+ </strong>
+ </p>
+ <p>
+ File Info
+ <noscript>: disabled (component requires javascript)</noscript>
+ <br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td colspan="4">
+ <nobr>
+ Loaded file: <a href="[browserpath]?path=[filepatharg]&redir=[path]">[filepath]</a>
+ <a href="[browserpath]?path=[filedirarg]">Browse...</a>
+ </nobr>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Status: [statestring]
+ </td>
+ <td align="center">
+ <table>
+ <tr>
+ <td id="time">[positionstring]</td>
+ <td>/</td>
+ <td>[durationstring]</td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <input type="checkbox" id="reloadenabled" checked>
+ </td>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ </noscript>
+ <input type="submit" value="Refresh" name="submit" onclick="window.location=window.location; return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="-1"> Goto control
+ <noscript>: (position slider disabled)</noscript>
+ <br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <table id="slider" border="0" cellspacing="0" cellpadding="0" width="1" height="1" style="background-image:url('sliderback.gif');">
+ <tr>
+ <td><img id="c1" width="1" height="1" src="/1pix.gif" ></td>
+ <td><img id="c2" width="1" height="1" src="/slidergrip.gif"></td>
+ <td><img id="c3" width="1" height="1" src="/1pix.gif"></td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <input type="checkbox" id="SliderAutoScroll" onclick="if (sas.checked==true) {update(rpt,true); cpf.value=secondsToTS(rpt,5,false)}; return true;">
+ </td>
+ <td>
+ <noscript>Goto...</noscript>
+ <input id="pos" name="position" size="12" onfocus="sas.checked=false;" onkeypress="return posupdate()"
+ value="[positionstring]">
+ </td>
+ <td>
+ <input type="submit" value="Go!" name="submit" onclick="postform([setposcommand],'position',timesyntax(cpf.value)); return false;">
+ </td>
+ </tr>
+ </table>
+ </form>
+ </p>
+ <p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ Playback control<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="887">
+ </noscript>
+ <input type="submit" value=" &gt; " name="submit" onclick="postform(887,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="888">
+ </noscript>
+ <input type="submit" value=" I I " name="submit" onclick="postform(888,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="890">
+ </noscript>
+ <input type="submit" value=" # " name="submit" onclick="postform(890,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="920">
+ </noscript>
+ <input type="submit" value="I&lt;&lt;" name="submit" onclick="postform(920,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="894">
+ </noscript>
+ <input type="submit" value="&lt;&lt;" name="submit" onclick="postform(894,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="895">
+ </noscript>
+ <input type="submit" value="&gt;&gt;" name="submit" onclick="postform(895,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="921">
+ </noscript>
+ <input type="submit" value="&gt;&gt;I" name="submit" onclick="postform(921,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="892">
+ </noscript>
+ <input type="submit" value=" &lt;I " name="submit" onclick="postform(892,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="891">
+ </noscript>
+ <input type="submit" value=" I&gt; " name="submit" onclick="postform(891,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ <td width="20">
+ &nbsp;
+ </td>
+ <td>
+ Seek<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="897">
+ </noscript>
+ <input type="submit" value="&lt; k" name="submit" onclick="postform(897,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="903">
+ </noscript>
+ <input type="submit" value="&lt;&lt;&lt;" name="submit" onclick="postform(903,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="901">
+ </noscript>
+ <input type="submit" value=" &lt;&lt; " name="submit" onclick="postform(901,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="899">
+ </noscript>
+ <input type="submit" value=" &lt; " name="submit" onclick="postform(899,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="900">
+ </noscript>
+ <input type="submit" value=" &gt; " name="submit" onclick="postform(900,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="902">
+ </noscript>
+ <input type="submit" value=" &gt;&gt; " name="submit" onclick="postform(902,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="904">
+ </noscript>
+ <input type="submit" value="&gt;&gt;&gt;" name="submit" onclick="postform(904,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="898">
+ </noscript>
+ <input type="submit" value="k &gt;" name="submit" onclick="postform(898,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ Volume control
+ <noscript>: (integer between 0 & 100)</noscript><br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td id="muted" align="center" valign="center">
+ U
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="909">
+ </noscript>
+ <input type="submit" value="Mute" name="submit" onclick="postform(909,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ <table id="v" width="1" height="1" border="0" cellspacing="0" cellpadding="0" style="background-image:url('vbg.gif');">
+ <tr>
+ <td><img id="v1" src="/1pix.gif" width="1" height="1"></td>
+ <td><img id="v2" src="/vbs.gif" width="1" height="1"></td>
+ <td><img id="v3" src="/1pix.gif" width="1" height="1"></td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="[setvolumecommand]">
+ <input name="volume" value="[volumelevel]" size="5">
+ <!-- FIXME /form -->
+ </noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <input type="submit" value="Go!" name="submit" onclick="postform([setvolumecommand],'volume',volume); return true;">
+ <noscript></form><!-- FIXME --></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="908">
+ </noscript>
+ <input type="submit" value="Down" name="submit" onclick="postform(908,'null',0); return true;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="907">
+ </noscript>
+ <input type="submit" value=" Up " name="submit" onclick="postform(907,'null',0); return true;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width="20">
+ &nbsp;
+ </td>
+ <td>
+ Playlist
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="918">
+ </noscript>
+ <input type="submit" value="&lt;&lt;" name="submit" onclick="postform(918,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="919">
+ </noscript>
+ <input type="submit" value="&gt;&gt;" name="submit" onclick="postform(919,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ <td width="20">
+ &nbsp;
+ </td>
+ <td>
+ Panic Button<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="943">
+ </noscript>
+ <input type="submit" value="Boss Key" name="submit" onclick="postform(943,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width="20">
+ &nbsp;
+ </td>
+ <td>
+ Audio Delay<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="906">
+ </noscript>
+ <input type="submit" value="-10ms" name="submit" onclick="postform(906,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="905">
+ </noscript>
+ <input type="submit" value="+10ms" name="submit" onclick="postform(905,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <!-- sorry chobits, I was thinking of doing this differently :) p>
+ <form action="[commandpath]" method="POST">
+ Playlist Editor<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr align="center">
+ <td colspan="4">
+ <input type="hidden" name="[wmcname]" value="-3">
+ <textarea name="playlist" multiple cols="60" rows="10" wrap="off">[playlist]</textarea>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ Play changes on update&nbsp;
+ <input type="checkbox" name="playupdate" checked>
+ </td>
+ <td align="center">
+ Playlist playing position&nbsp;
+ <input type="text" name="playlistposition" size=4 value="[currentplaylistposition]">
+ </td>
+ <td align="center">
+ <input type="submit" value="Update" name="submit">
+ </td>
+ </tr>
+ </table>
+ </form>
+ </p -->
+ <p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ Pan&amp;Scan Move<br>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="872">
+ </noscript>
+ <input type="submit" value="Up/Left" name="submit" onclick="postform(872,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="870">
+ </noscript>
+ <input type="submit" value="Up" name="submit" onclick="postform(870,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="873">
+ </noscript>
+ <input type="submit" value="Up/Right" name="submit" onclick="postform(873,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="868">
+ </noscript>
+ <input type="submit" value="Left" name="submit" onclick="postform(868,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="876">
+ </noscript>
+ <input type="submit" value="Center" name="submit" onclick="postform(876,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="869">
+ </noscript>
+ <input type="submit" value="Right" name="submit" onclick="postform(869,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="874">
+ </noscript>
+ <input type="submit" value="Down/Left" name="submit" onclick="postform(874,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="871">
+ </noscript>
+ <input type="submit" value="Down" name="submit" onclick="postform(871,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="875">
+ </noscript>
+ <input type="submit" value="Down/Right" name="submit" onclick="postform(875,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <td width="30">
+ &nbsp;
+ </td>
+ <td>
+ Pan&amp;Scan Size<br>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="866">
+ </noscript>
+ <input type="submit" value="Inc Height" name="submit" onclick="postform(866,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="862">
+ </noscript>
+ <input type="submit" value="Inc Size" name="submit" onclick="postform(862,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="865">
+ </noscript>
+ <input type="submit" value="Dec Width" name="submit" onclick="postform(865,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="861">
+ </noscript>
+ <input type="submit" value="Reset" name="submit" onclick="postform(861,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="864">
+ </noscript>
+ <input type="submit" value="Inc Width" name="submit" onclick="postform(864,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ <tr>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="863">
+ </noscript>
+ <input type="submit" value="Dec Size" name="submit" onclick="postform(863,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="867">
+ </noscript>
+ <input type="submit" value="Dec Height" name="submit" onclick="postform(867,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td> </tr> </table>
+ </p>
+ <p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ Video Frame<br>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="835">
+ </noscript>
+ <input type="submit" value="Half" name="submit" onclick="postform(835,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="837">
+ </noscript>
+ <input type="submit" value="Double" name="submit" onclick="postform(837,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="836">
+ </noscript>
+ <input type="submit" value="Normal" name="submit" onclick="postform(836,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="838">
+ </noscript>
+ <input type="submit" value="Stretch" name="submit" onclick="postform(838,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="839">
+ </noscript>
+ <input type="submit" value="Inside" name="submit" onclick="postform(839,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="840">
+ </noscript>
+ <input type="submit" value="Outside" name="submit" onclick="postform(840,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <td width="30">
+ </td>
+ <td>
+ DVD Menu Controler<br>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="930">
+ </noscript>
+ <input type="submit" value="Up" name="submit" onclick="postform(930,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ &nbsp;
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="928">
+ </noscript>
+ <input type="submit" value="Left" name="submit" onclick="postform(928,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="932">
+ </noscript>
+ <input type="submit" value="Activate" name="submit" onclick="postform(932,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="929">
+ </noscript>
+ <input type="submit" value="Right" name="submit" onclick="postform(929,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="933">
+ </noscript>
+ <input type="submit" value="Back" name="submit" onclick="postform(933,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="931">
+ </noscript>
+ <input type="submit" value="Down" name="submit" onclick="postform(931,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="934">
+ </noscript>
+ <input type="submit" value="Leave" name="submit" onclick="postform(934,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </table>
+ <td width="30">
+ &nbsp;
+ </td>
+ <td>
+ Misc<br>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="800">
+ </noscript>
+ <input type="submit" value="Open File" name="submit" onclick="postform(800,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="801">
+ </noscript>
+ <input type="submit" value="Open DVD" name="submit" onclick="postform(801,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="802">
+ </noscript>
+ <input type="submit" value="Open Device" name="submit" onclick="postform(802,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="805">
+ </noscript>
+ <input type="submit" value="Save As" name="submit" onclick="postform(805,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="804">
+ </noscript>
+ <input type="submit" value="Close" name="submit" onclick="postform(804,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="816">
+ </noscript>
+ <input type="submit" value="Exit" name="submit" onclick="postform(816,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="893">
+ </noscript>
+ <input type="submit" value="Go To" name="submit" onclick="postform(893,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="886">
+ </noscript>
+ <input type="submit" value="Options" name="submit" onclick="postform(886,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table border="2" cellspacing="1" cellpadding="4" width="100%">
+ <tr>
+ <td align="center">
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="814">
+ </noscript>
+ <input type="submit" value="Properties" name="submit" onclick="postform(814,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ Zoom control<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="832">
+ </noscript>
+ <input type="submit" value="Zoom 50%" name="submit" onclick="postform(832,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="833">
+ </noscript>
+ <input type="submit" value="Zoom 100%" name="submit" onclick="postform(833,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="834">
+ </noscript>
+ <input type="submit" value="Zoom 200%" name="submit" onclick="postform(834,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width="20">
+ &nbsp;
+ </td>
+ <td>
+ Fullscreen control<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="830">
+ </noscript>
+ <input type="submit" value="Normal" name="submit" onclick="postform(830,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="831">
+ </noscript>
+ <input type="submit" value="w/o res.change" name="submit" onclick="postform(831,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ Player views<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="827">
+ </noscript>
+ <input type="submit" value="Minimal" name="submit" onclick="postform(827,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="828">
+ </noscript>
+ <input type="submit" value="Compact" name="submit" onclick="postform(828,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="829">
+ </noscript>
+ <input type="submit" value="Normal" name="submit" onclick="postform(829,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width="20">
+ </td>
+ <td>
+ Detachable Controlls<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="824">
+ </noscript>
+ <input type="submit" value="Playlist" name="submit" onclick="postform(824,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="823">
+ </noscript>
+ <input type="submit" value="Subresync" name="submit" onclick="postform(823,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="825">
+ </noscript>
+ <input type="submit" value="Capture" name="submit" onclick="postform(825,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="817">
+ </noscript>
+ <input type="submit" value="Caption&Menu" name="submit" onclick="postform(817,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="818">
+ </noscript>
+ <input type="submit" value="Seeker" name="submit" onclick="postform(818,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="819">
+ </noscript>
+ <input type="submit" value="Controls" name="submit" onclick="postform(819,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="820">
+ </noscript>
+ <input type="submit" value="Information" name="submit" onclick="postform(820,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="821">
+ </noscript>
+ <input type="submit" value="Statistics" name="submit" onclick="postform(821,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="822">
+ </noscript>
+ <input type="submit" value="Status" name="submit" onclick="postform(822,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ Generic Audio/Subtitles<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="952">
+ </noscript>
+ <input type="submit" value="&lt; Audio" name="submit" onclick="postform(952,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="951">
+ </noscript>
+ <input type="submit" value="Audio &gt;" name="submit" onclick="postform(951,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="954">
+ </noscript>
+ <input type="submit" value="&lt; Subtitle" name="submit" onclick="postform(954,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="953">
+ </noscript>
+ <input type="submit" value="Subtitle &gt;" name="submit" onclick="postform(953,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width="20">
+ &nbsp;
+ </td>
+ <td>
+ <!-- p TODO -->
+ OGM Audio/Subtitles<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="957">
+ </noscript>
+ <input type="submit" value="&lt; Audio" name="submit" onclick="postform(957,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="956">
+ </noscript>
+ <input type="submit" value="Audio &gt;" name="submit" onclick="postform(956,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="959">
+ </noscript>
+ <input type="submit" value="&lt; Subtitle" name="submit" onclick="postform(959,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="958">
+ </noscript>
+ <input type="submit" value="Subtitle &gt;" name="submit" onclick="postform(958,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ Subtitles<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="809">
+ </noscript>
+ <input type="submit" value="Load" name="submit" onclick="postform(809,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="810">
+ </noscript>
+ <input type="submit" value="Save" name="submit" onclick="postform(810,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width="20">
+ &nbsp;
+ </td>
+ <td>
+ DVD Angles/Audio/Subtitles<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="961">
+ </noscript>
+ <input type="submit" value="&lt; Angle" name="submit" onclick="postform(961,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="960">
+ </noscript>
+ <input type="submit" value="Angle &gt;" name="submit" onclick="postform(960,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="963">
+ </noscript>
+ <input type="submit" value="&lt; Audio" name="submit" onclick="postform(963,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="962">
+ </noscript>
+ <input type="submit" value="Audio &gt;" name="submit" onclick="postform(962,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="965">
+ </noscript>
+ <input type="submit" value="&lt; Subtitle" name="submit" onclick="postform(965,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="964">
+ </noscript>
+ <input type="submit" value="Subtitle &gt;" name="submit" onclick="postform(964,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ DVD Menus<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="922">
+ </noscript>
+ <input type="submit" value="Title" name="submit" onclick="postform(922,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="923">
+ </noscript>
+ <input type="submit" value="Root" name="submit" onclick="postform(923,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="924">
+ </noscript>
+ <input type="submit" value="Subtitle" name="submit" onclick="postform(924,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="925">
+ </noscript>
+ <input type="submit" value="Audio" name="submit" onclick="postform(925,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="926">
+ </noscript>
+ <input type="submit" value="Angle" name="submit" onclick="postform(926,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="927">
+ </noscript>
+ <input type="submit" value="Chapter" name="submit" onclick="postform(927,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width="20">
+ &nbsp;
+ </td>
+ <td>
+ Media Player Classic Menu's
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="950">
+ </noscript>
+ <input type="submit" value="Filters" name="submit" onclick="postform(950,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="948">
+ </noscript>
+ <input type="submit" value="Player (short)" name="submit" onclick="postform(948,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="949">
+ </noscript>
+ <input type="submit" value="Player (long)" name="submit" onclick="postform(949,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </p>
+ <p>
+ Always On Top<br>
+ <table border="2" cellspacing="1" cellpadding="4">
+ <tr>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="884">
+ </noscript>
+ <input type="submit" value="Always" name="submit" onclick="postform(884,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="885">
+ </noscript>
+ <input type="submit" value="While Playing" name="submit" onclick="postform(885,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ <td>
+ <noscript>
+ <form action="[commandpath]" method="POST">
+ <input type="hidden" name="[wmcname]" value="883">
+ </noscript>
+ <input type="submit" value="Never" name="submit" onclick="postform(883,'null',0); return false;">
+ <noscript></form></noscript>
+ </td>
+ </tr>
+ </table>
+ <form id="ef" action="[commandpath]" method="POST"> <!-- FIXME: POSTing does not want to work with mozilla -->
+ <input id="fwmc" type="hidden" name="[wmcname]" value="-2">
+ <input id="fextra" type="hidden" name="extra" value="">
+ </form>
+ </p>
+ </body>
+</html>
+[debug]
diff --git a/src/apps/mplayerc/res/web/controlvolumebar.png b/src/apps/mplayerc/res/web/controlvolumebar.png
new file mode 100644
index 000000000..ab51a5d01
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlvolumebar.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlvolumegrip.png b/src/apps/mplayerc/res/web/controlvolumegrip.png
new file mode 100644
index 000000000..f9f68ce03
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlvolumegrip.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlvolumeoff.png b/src/apps/mplayerc/res/web/controlvolumeoff.png
new file mode 100644
index 000000000..a78d48389
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlvolumeoff.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/controlvolumeon.png b/src/apps/mplayerc/res/web/controlvolumeon.png
new file mode 100644
index 000000000..979b82998
--- /dev/null
+++ b/src/apps/mplayerc/res/web/controlvolumeon.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/default.css b/src/apps/mplayerc/res/web/default.css
new file mode 100644
index 000000000..89191a529
--- /dev/null
+++ b/src/apps/mplayerc/res/web/default.css
@@ -0,0 +1,5 @@
+body, th, td
+{
+ font-size: 0.8em;
+ font-family: Verdana, Arial, Helvetica, Sans-Serif;
+} \ No newline at end of file
diff --git a/src/apps/mplayerc/res/web/headerback.png b/src/apps/mplayerc/res/web/headerback.png
new file mode 100644
index 000000000..ac14c9653
--- /dev/null
+++ b/src/apps/mplayerc/res/web/headerback.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/headerclose.png b/src/apps/mplayerc/res/web/headerclose.png
new file mode 100644
index 000000000..72fd81c98
--- /dev/null
+++ b/src/apps/mplayerc/res/web/headerclose.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/headericon.png b/src/apps/mplayerc/res/web/headericon.png
new file mode 100644
index 000000000..f8e9dc705
--- /dev/null
+++ b/src/apps/mplayerc/res/web/headericon.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/index.html b/src/apps/mplayerc/res/web/index.html
new file mode 100644
index 000000000..e050e98be
--- /dev/null
+++ b/src/apps/mplayerc/res/web/index.html
@@ -0,0 +1,35 @@
+<html>
+ <head>
+ <title>MPC WebServer</title>
+ <link rel="stylesheet" type="text/css" href="/default.css">
+ </head>
+ <body>
+ <p>
+ Sorry, this is just a little demo page for now, I'm still awaiting ideas what
+ to put here ... and mostly why (hehe) Anyway, I'm sure there will be some use
+ of this web server in the future. You users can always come up with something.
+ </p>
+ <p>
+ And if you are already here, why don't you try sending a few commands to MPC,
+ just to see if it works :)
+ </p>
+ <p>
+ <form action="[commandpath]" method="post">
+ <select name="[wmcname]">
+ [wmcoptions]
+ </select>
+ <input type="submit" value="Go!" name="submit">
+ </form>
+ </p>
+ <p>
+ <a href="/browser.html">File browser</a>
+ </p>
+ <p>
+ <a href="/controls.html">The media player interface made by chobits</a>
+ </p>
+ <p>
+ New in this release: <a href="/player.html">MPC in the browser!</a>
+ </p>
+ [debug]
+ </body>
+</html>
diff --git a/src/apps/mplayerc/res/web/leftbottomside.png b/src/apps/mplayerc/res/web/leftbottomside.png
new file mode 100644
index 000000000..93c696046
--- /dev/null
+++ b/src/apps/mplayerc/res/web/leftbottomside.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/leftside.png b/src/apps/mplayerc/res/web/leftside.png
new file mode 100644
index 000000000..f8fdfa97c
--- /dev/null
+++ b/src/apps/mplayerc/res/web/leftside.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/logo.png b/src/apps/mplayerc/res/web/logo.png
new file mode 100644
index 000000000..9ee6a389b
--- /dev/null
+++ b/src/apps/mplayerc/res/web/logo.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/player.html b/src/apps/mplayerc/res/web/player.html
new file mode 100644
index 000000000..778cf879a
--- /dev/null
+++ b/src/apps/mplayerc/res/web/player.html
@@ -0,0 +1,303 @@
+<html>
+
+<head>
+
+<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
+
+<title>Media Player Classic</title>
+
+<script language="JavaScript" type="text/JavaScript">
+
+function getXMLHTTP()
+{
+ try {return new ActiveXObject("Msxml2.XMLHTTP");}
+ catch(e) {try {return new ActiveXObject("Microsoft.XMLHTTP");}
+ catch(e) {}}
+ if(typeof XMLHttpRequest != "undefined") {return new XMLHttpRequest();}
+ return null;
+}
+
+function MakeRequest(req)
+{
+ var httpRequest = getXMLHTTP();
+
+ try
+ {
+ httpRequest.open("GET", req, true);
+ httpRequest.send(null);
+ }
+ catch(e)
+ {
+ }
+}
+
+function urlencode(s)
+{
+ if(encodeURIComponent) return encodeURIComponent(s);
+ if(escape) return escape(s);
+ return s; // whatever
+}
+
+function getOffsetX(m)
+{
+ var x = m.offsetLeft;
+ while (m.offsetParent) {x += (m = m.offsetParent).offsetLeft; }
+ return x;
+}
+
+OnStatus = function(title, status, pos, posstr, dur, durstr, muted, volume)
+{
+ var maxtitle = 70;
+ if(title.length > maxtitle) title = title.substr(0, maxtitle-3) + '...';
+ var timestr = dur > 0 && posstr && durstr ? posstr + '&nbsp;/&nbsp;' + durstr : '&nbsp;';
+ if(!dur || dur == 0) dur = 1;
+ var sbpercent = Math.floor(100*pos/dur);
+
+ if(e = document.getElementById('title')) e.innerHTML = title;
+ if(e = document.getElementById('seekbarchleft')) e.width = sbpercent > 0 ? sbpercent + '%' : '1px';
+ if(e = document.getElementById('seekbarchright')) e.width = sbpercent < 100 ? (100 - sbpercent) + '%' : '1px';
+ if((e = document.getElementById('status')) && e.innerHTML != status) e.innerHTML = status;
+ if((e = document.getElementById('timer')) && e.innerHTML != timestr) e.innerHTML = timestr;
+ if(e = document.getElementById('controlvolumemute')) {url = 'url(controlvolume' + (muted?'off':'on') + '.png)'; if(e.style.backgroundImage != url) e.style.backgroundImage = url;}
+ if(e = document.getElementById('controlvolumegrip'))
+ {
+ volume = (document.getElementById('controlvolumebar').offsetWidth - e.offsetWidth) * volume / 100;
+ e.style.position = 'relative';
+ e.style.top = '2px';
+ e.style.left = Math.floor(volume) + 'px';
+ }
+}
+
+var httpRequestStatus;
+
+function OnReadyStateChange()
+{
+ if(httpRequestStatus && httpRequestStatus.readyState == 4 && httpRequestStatus.responseText)
+ {
+ if(httpRequestStatus.responseText.charAt(0) != "<") eval(httpRequestStatus.responseText);
+ else {alert(httpRequestStatus.responseText);}
+ httpRequestStatus = null;
+ }
+}
+
+function StatusLoop()
+{
+ if(!httpRequestStatus || httpRequestStatus.readyState == 0)
+ {
+ httpRequestStatus = getXMLHTTP();
+
+ try
+ {
+ httpRequestStatus.open("GET", 'status.html', true);
+ httpRequestStatus.onreadystatechange = OnReadyStateChange;
+ httpRequestStatus.send(null);
+ }
+ catch(e)
+ {
+ }
+ }
+
+ setTimeout("StatusLoop()", 500);
+}
+
+var snapshotcounter = 0;
+
+function LoadSnapShot()
+{
+ if(img = document.getElementById('snapshot'))
+ {
+ img.src = 'snapshot.jpg' + '?' + snapshotcounter++;
+ }
+}
+
+function OnLoadSnapShot()
+{
+ setTimeout("LoadSnapShot()", 5000);
+}
+
+function OnAbortErrorSnapShot(e)
+{
+ setTimeout("LoadSnapShot()", 10000);
+}
+
+function OnSeek(e)
+{
+ left = right = 0;
+ if(sb = document.getElementById('seekbarchleft')) left = getOffsetX(sb);
+ if(sb = document.getElementById('seekbarchright')) {right = getOffsetX(sb) + sb.offsetWidth;}
+ if(sb = document.getElementById('seekbargrip')) {left += sb.offsetWidth / 2; right -= sb.offsetWidth / 2;}
+ if(left > 0 && left < right)
+ {
+ percent = 100 * ((window.event ? window.event.clientX : e.clientX) - left) / (right - left);
+ if(percent < 0) percent = 0;
+ else if(percent > 100) percent = 100;
+
+ MakeRequest('command.html?wm_command=[setposcommand]&percent='+percent);
+ }
+}
+
+function OnVolume(e)
+{
+ left = right = 0;
+ if(cv = document.getElementById('controlvolumebar')) {left = getOffsetX(cv)+3; right = getOffsetX(cv) + cv.offsetWidth-3;}
+ if(left > 0 && left < right)
+ {
+ percent = 100 * ((window.event ? window.event.clientX : e.clientX) - left) / (right - left);
+ if(percent < 0) percent = 0;
+ else if(percent > 100) percent = 100;
+
+ MakeRequest('command.html?wm_command=[setvolumecommand]&volume='+percent);
+ }
+}
+
+function OnCommand(id)
+{
+ MakeRequest('command.html?wm_command='+id);
+}
+
+function Init()
+{
+ StatusLoop();
+ LoadSnapShot();
+
+ if(e = document.getElementById('seekbar'))
+ e.onclick = OnSeek;
+
+ if(e = document.getElementById('controlvolumebar'))
+ e.onclick = OnVolume;
+}
+
+</script>
+
+<style>
+img {padding: 0; margin: 0; border: 0;}
+#player {margin-left: auto; margin-right: auto;}
+#player td {font-family: Sans-Serif; font-size: 13px;}
+#header {width: 100%;}
+#header td {height: 30px;}
+#headericon {background-image: url(headericon.png); background-repeat: no-repeat; width: 22px;}
+#headerback {background-image: url(headerback.png); background-repeat: repeat-x; color: white; font-weight: bold; padding-top: 5px}
+#headerclose {background-image: url(headerclose.png); background-repeat: no-repeat; width: 28px;}
+#title, #status, #posstr, #durstr {display: inline;}
+#menu td {font-family: Sans-Serif; font-size: 12px; padding: 1px 5px;}
+#menu, #controlbar {background-color: #ece6d4;}
+#statusbar td {font-family: Sans-Serif; font-size: 12px;}
+#video, #statusbar {background-color: black; color: white;}
+#video {padding: 1px; cursor: pointer;}
+#controlbar {background-image: url(controlback.png); background-repeat: repeat-x; height: 28px;}
+#controlbuttonplay {background-image: url(controlbuttonplay.png); background-repeat: no-repeat; width: 25px; height: 28px;}
+#controlbuttonpause {background-image: url(controlbuttonpause.png); background-repeat: no-repeat; width: 23px; height: 28px;}
+#controlbuttonstop {background-image: url(controlbuttonstop.png); background-repeat: no-repeat; width: 25px; height: 28px;}
+#controlbuttonskipback {background-image: url(controlbuttonskipback.png); background-repeat: no-repeat; width: 24px; height: 28px;}
+#controlbuttondecrate {background-image: url(controlbuttondecrate.png); background-repeat: no-repeat; width: 22px; height: 28px;}
+#controlbuttonincrate {background-image: url(controlbuttonincrate.png); background-repeat: no-repeat; width: 23px; height: 28px;}
+#controlbuttonskipforward {background-image: url(controlbuttonskipforward.png); background-repeat: no-repeat; width: 28px; height: 28px;}
+#controlbuttonstep {background-image: url(controlbuttonstep.png); background-repeat: no-repeat; width: 31px; height: 28px;}
+#controlvolumemute {background-image: url(controlvolumeon.png); background-repeat: no-repeat; width: 28px; height: 28px;}
+#controlvolumebar {background-image: url(controlvolumebar.png); background-repeat: no-repeat; width: 55px; height: 28px;}
+#seekbar {background-image: url(seekbarmid.png); background-repeat: repeat-x;}
+#seekbar td {height: 15px;}
+#center {width: 100%;}
+#leftside {background-image: url(leftside.png); background-repeat: repeat-y; width: 4px;}
+#rightside {background-image: url(rightside.png); background-repeat: repeat-y; width: 4px;}
+#leftbottomside {background-image: url(leftbottomside.png); background-repeat: repeat-x; width: 4px; height: 4px;}
+#bottomside {background-image: url(bottomside.png); background-repeat: repeat-x; height: 4px;}
+#rightbottomside {background-image: url(rightbottomside.png); background-repeat: repeat-x; width: 4px; height: 4px;}
+</style>
+
+</head>
+
+<body onload="Init()">
+
+ <div align="center">
+ <table id="player" cellpadding="0" cellspacing="0">
+ <tr>
+ <td colspan="3">
+ <table id="header" cellpadding="0" cellspacing="0">
+ <tr>
+ <td id="headericon"></td>
+ <td id="headerback"><nobr>&nbsp;<div id="title"></div>&nbsp;</nobr></td>
+ <td id="headerclose" onclick="OnCommand(816)"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td id="leftside"></td>
+ <td>
+ <table cellpadding="0" cellspacing="0" id="center">
+ <tr>
+ <td>
+ <table id="menu" width="100%">
+ <tr>
+ <td>File</td>
+ <td>View</td>
+ <td>Play</td>
+ <td>Navigate</td>
+ <td>Favorites</td>
+ <td width="100%" align="right">Help</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td id="video" align="center" onclick="OnCommand(889)">
+ <img src="snapshot.png" alt="snapshot" id="snapshot" onload="OnLoadSnapShot()" onabort="OnAbortErrorSnapShot()" onerror="OnAbortErrorSnapShot()" />
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table width="100%" id="seekbar" cellpadding="0" cellspacing="0">
+ <tr>
+ <td id="seekbarleft"><img src="seekbarleft.png"></td>
+ <td id="seekbarchleft" width="0%"></td>
+ <td id="seekbargrip"><img src="seekbargrip.png"></td>
+ <td id="seekbarchright" width="100%"></td>
+ <td id="seekbarright"><img src="seekbarright.png"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table width="100%" cellpadding="0" cellspacing="0" id="controlbar">
+ <tr>
+ <td id="controlbuttonplay" onclick="OnCommand(887)"></td>
+ <td id="controlbuttonpause" onclick="OnCommand(888)"></td>
+ <td id="controlbuttonstop" onclick="OnCommand(890)"></td>
+ <td id="controlbuttonskipback" onclick="OnCommand(920)"></td>
+ <td id="controlbuttondecrate" onclick="OnCommand(894)"></td>
+ <td id="controlbuttonincrate" onclick="OnCommand(895)"></td>
+ <td id="controlbuttonskipforward" onclick="OnCommand(921)"></td>
+ <td id="controlbuttonstep" onclick="OnCommand(891)"></td>
+ <td>&nbsp;</td>
+ <td id="controlvolumemute" onclick="OnCommand(909)"></td>
+ <td id="controlvolumebar" valign="top"><img src="controlvolumegrip.png" id="controlvolumegrip"></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table width="100%" id="statusbar">
+ <tr>
+ <td><div id="status"></div></td>
+ <td align="right"><div id="timer">&nbsp;</div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td id="rightside"></td>
+ </tr>
+ <tr>
+ <td id="leftbottomside"></td>
+ <td id="bottomside"></td>
+ <td id="rightbottomside"></td>
+ </tr>
+ </table>
+ </div>
+</body>
+
+</html> \ No newline at end of file
diff --git a/src/apps/mplayerc/res/web/rightbottomside.png b/src/apps/mplayerc/res/web/rightbottomside.png
new file mode 100644
index 000000000..ee3241c5f
--- /dev/null
+++ b/src/apps/mplayerc/res/web/rightbottomside.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/rightside.png b/src/apps/mplayerc/res/web/rightside.png
new file mode 100644
index 000000000..a38d53978
--- /dev/null
+++ b/src/apps/mplayerc/res/web/rightside.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/seekbargrip.png b/src/apps/mplayerc/res/web/seekbargrip.png
new file mode 100644
index 000000000..afb032748
--- /dev/null
+++ b/src/apps/mplayerc/res/web/seekbargrip.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/seekbarleft.png b/src/apps/mplayerc/res/web/seekbarleft.png
new file mode 100644
index 000000000..880e254a3
--- /dev/null
+++ b/src/apps/mplayerc/res/web/seekbarleft.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/seekbarmid.png b/src/apps/mplayerc/res/web/seekbarmid.png
new file mode 100644
index 000000000..f93e037f0
--- /dev/null
+++ b/src/apps/mplayerc/res/web/seekbarmid.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/seekbarright.png b/src/apps/mplayerc/res/web/seekbarright.png
new file mode 100644
index 000000000..f411c42d2
--- /dev/null
+++ b/src/apps/mplayerc/res/web/seekbarright.png
Binary files differ
diff --git a/src/apps/mplayerc/res/web/sliderback.gif b/src/apps/mplayerc/res/web/sliderback.gif
new file mode 100644
index 000000000..d4e5cd6f9
--- /dev/null
+++ b/src/apps/mplayerc/res/web/sliderback.gif
Binary files differ
diff --git a/src/apps/mplayerc/res/web/sliderbar.gif b/src/apps/mplayerc/res/web/sliderbar.gif
new file mode 100644
index 000000000..0d05c58c2
--- /dev/null
+++ b/src/apps/mplayerc/res/web/sliderbar.gif
Binary files differ
diff --git a/src/apps/mplayerc/res/web/slidergrip.gif b/src/apps/mplayerc/res/web/slidergrip.gif
new file mode 100644
index 000000000..15002f09b
--- /dev/null
+++ b/src/apps/mplayerc/res/web/slidergrip.gif
Binary files differ
diff --git a/src/apps/mplayerc/res/web/vbg.GIF b/src/apps/mplayerc/res/web/vbg.GIF
new file mode 100644
index 000000000..5247809ca
--- /dev/null
+++ b/src/apps/mplayerc/res/web/vbg.GIF
Binary files differ
diff --git a/src/apps/mplayerc/res/web/vbs.GIF b/src/apps/mplayerc/res/web/vbs.GIF
new file mode 100644
index 000000000..fac72a07d
--- /dev/null
+++ b/src/apps/mplayerc/res/web/vbs.GIF
Binary files differ
diff --git a/src/apps/mplayerc/resource.h b/src/apps/mplayerc/resource.h
new file mode 100644
index 000000000..b14fa16ce
--- /dev/null
+++ b/src/apps/mplayerc/resource.h
@@ -0,0 +1,758 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by mplayerc.rc
+//
+#define IDR_MAINFRAME 128
+#define IDR_POPUP 129
+#define IDS_STRING129 129
+#define IDS_RS_DVDPOS 129
+#define IDR_POPUPMAIN 130
+#define IDS_RS_FILEPOS 130
+#define IDS_RS_LASTFULLSCREEN 131
+#define IDB_PLAYERTOOLBAR 201
+#define IDB_NOAUDIO 202
+#define IDB_MONO 203
+#define IDB_STEREO 204
+#define IDB_ONOFF 205
+#define IDB_LOGO0 206
+#define IDB_LOGO1 207
+#define IDB_LOGO2 208
+#define IDB_LOGO3 209
+#define IDB_LOGO4 210
+#define IDB_LOGO5 211
+#define IDB_LOGO6 212
+#define IDB_LOGO7 213
+#define IDB_AUTHHDRPIC 214
+#define IDB_STREAMTYPES 215
+#define IDI_SINGLE 300
+#define IDI_MULTI 301
+#define IDI_DVD 302
+#define IDI_AUDIOCD 303
+#define IDI_UNKNOWN 304
+#define IDR_AVI_FILECOPY 400
+#define IDR_HTML_INDEX 500
+#define IDR_HTML_404 501
+#define IDR_HTML_BROWSER 502
+#define IDR_HTML_CONTROLS 503
+#define IDR_HTML_PLAYER 504
+#define IDF_DEFAULT_CSS 505
+#define IDF_SLIDERBAR_GIF 506
+#define IDF_VBR_GIF 507
+#define IDF_VBS_GIF 508
+#define IDF_SLIDERGRIP_GIF 509
+#define IDF_1PIX_GIF 510
+#define IDF_SLIDERBACK_GIF 511
+#define IDF_HEADERICON_PNG 512
+#define IDF_HEADERBACK_PNG 513
+#define IDF_HEADERCLOSE_PNG 514
+#define IDF_LEFTSIDE_PNG 515
+#define IDF_RIGHTSIDE_PNG 516
+#define IDF_BOTTOMSIDE_PNG 517
+#define IDF_LEFTBOTTOMSIDE_PNG 518
+#define IDF_RIGHTBOTTOMSIDE_PNG 519
+#define IDF_SEEKBARLEFT_PNG 520
+#define IDF_SEEKBARMID_PNG 521
+#define IDF_SEEKBARRIGHT_PNG 522
+#define IDF_SEEKBARGRIP_PNG 523
+#define IDF_LOGO_PNG 524
+#define IDF_CONTROLBACK_PNG 525
+#define IDF_CONTROLBUTTONPLAY_PNG 526
+#define IDF_CONTROLBUTTONPAUSE_PNG 527
+#define IDF_CONTROLBUTTONSTOP_PNG 528
+#define IDF_CONTROLBUTTONSKIPBACK_PNG 529
+#define IDF_CONTROLBUTTONDECRATE_PNG 530
+#define IDF_CONTROLBUTTONINCRATE_PNG 531
+#define IDF_CONTROLBUTTONSKIPFORWARD_PNG 532
+#define IDF_CONTROLBUTTONSTEP_PNG 533
+#define IDF_CONTROLVOLUMEON_PNG 534
+#define IDF_CONTROLVOLUMEOFF_PNG 535
+#define IDF_CONTROLVOLUMEBAR_PNG 536
+#define IDF_CONTROLVOLUMEGRIP_PNG 537
+#define IDF_SHADER_RESIZER 700
+#define IDF_SHADER_EMPTY 701
+#define IDF_SHADER_CONTOUR 702
+#define IDF_SHADER_DEINTERLACE 703
+#define IDF_SHADER_EMBOSS 704
+#define IDF_SHADER_GRAYSCALE 705
+#define IDF_SHADER_INVERT 706
+#define IDF_SHADER_LETTERBOX 707
+#define IDF_SHADER_SHARPEN 708
+#define IDF_SHADER_SPHERE 709
+#define IDF_SHADER_SPOTLIGHT 710
+#define IDF_SHADER_WAVE 711
+#define IDF_SHADER_PROCAMP 712
+#define ID_FILE_OPENMEDIA 800
+#define ID_FILE_OPENDVD 801
+#define ID_FILE_OPENDEVICE 802
+#define ID_FILE_CLOSEMEDIA 803
+#define ID_FILE_CLOSEPLAYLIST 804
+#define ID_FILE_SAVE_COPY 805
+#define ID_FILE_SAVE_IMAGE 806
+#define ID_FILE_SAVE_IMAGE_AUTO 807
+#define ID_FILE_SAVE_THUMBNAILS 808
+#define ID_FILE_LOAD_SUBTITLE 809
+#define ID_FILE_SAVE_SUBTITLE 810
+#define ID_FILE_ISDB_UPLOAD 811
+#define ID_FILE_ISDB_DOWNLOAD 812
+#define ID_FILE_ISDB_SEARCH 813
+#define ID_FILE_PROPERTIES 814
+#define ID_FILE_CONVERT 815
+#define ID_FILE_EXIT 816
+#define ID_VIEW_CAPTIONMENU 817
+#define ID_VIEW_SEEKER 818
+#define ID_VIEW_CONTROLS 819
+#define ID_VIEW_INFORMATION 820
+#define ID_VIEW_STATISTICS 821
+#define ID_VIEW_STATUS 822
+#define ID_VIEW_SUBRESYNC 823
+#define ID_VIEW_PLAYLIST 824
+#define ID_VIEW_CAPTURE 825
+#define ID_VIEW_SHADEREDITOR 826
+#define ID_VIEW_PRESETS_MINIMAL 827
+#define ID_VIEW_PRESETS_COMPACT 828
+#define ID_VIEW_PRESETS_NORMAL 829
+#define ID_VIEW_FULLSCREEN 830
+#define ID_VIEW_FULLSCREEN_SECONDARY 831
+#define ID_VIEW_ZOOM_50 832
+#define ID_VIEW_ZOOM_100 833
+#define ID_VIEW_ZOOM_200 834
+#define ID_VIEW_VF_HALF 835
+#define ID_VIEW_VF_NORMAL 836
+#define ID_VIEW_VF_DOUBLE 837
+#define ID_VIEW_VF_STRETCH 838
+#define ID_VIEW_VF_FROMINSIDE 839
+#define ID_VIEW_VF_FROMOUTSIDE 840
+#define ID_VIEW_VF_KEEPASPECTRATIO 841
+#define ID_VIEW_VF_COMPMONDESKARDIFF 842
+#define ID_ASPECTRATIO_START 850
+#define ID_ASPECTRATIO_SOURCE 850
+#define ID_ASPECTRATIO_4_3 851
+#define ID_ASPECTRATIO_5_4 852
+#define ID_ASPECTRATIO_16_9 853
+#define ID_ASPECTRATIO_END 859
+#define ID_ASPECTRATIO_NEXT 860
+#define ID_VIEW_RESET 861
+#define ID_VIEW_INCSIZE 862
+#define ID_VIEW_DECSIZE 863
+#define ID_VIEW_INCWIDTH 864
+#define ID_VIEW_DECWIDTH 865
+#define ID_VIEW_INCHEIGHT 866
+#define ID_VIEW_DECHEIGHT 867
+#define ID_PANSCAN_MOVELEFT 868
+#define ID_PANSCAN_MOVERIGHT 869
+#define ID_PANSCAN_MOVEUP 870
+#define ID_PANSCAN_MOVEDOWN 871
+#define ID_PANSCAN_MOVEUPLEFT 872
+#define ID_PANSCAN_MOVEUPRIGHT 873
+#define ID_PANSCAN_MOVEDOWNLEFT 874
+#define ID_PANSCAN_MOVEDOWNRIGHT 875
+#define ID_PANSCAN_CENTER 876
+#define ID_PANSCAN_ROTATEXP 877
+#define ID_PANSCAN_ROTATEXM 878
+#define ID_PANSCAN_ROTATEYP 879
+#define ID_PANSCAN_ROTATEYM 880
+#define ID_PANSCAN_ROTATEZP 881
+#define ID_PANSCAN_ROTATEZM 882
+#define ID_ONTOP_NEVER 883
+#define ID_ONTOP_ALWAYS 884
+#define ID_ONTOP_WHILEPLAYING 885
+#define ID_VIEW_OPTIONS 886
+#define ID_PLAY_PLAY 887
+#define ID_PLAY_PAUSE 888
+#define ID_PLAY_PLAYPAUSE 889
+#define ID_PLAY_STOP 890
+#define ID_PLAY_FRAMESTEP 891
+#define ID_PLAY_FRAMESTEPCANCEL 892
+#define ID_PLAY_GOTO 893
+#define ID_PLAY_DECRATE 894
+#define ID_PLAY_INCRATE 895
+#define ID_PLAY_RESETRATE 896
+#define ID_PLAY_SEEKKEYBACKWARD 897
+#define ID_PLAY_SEEKKEYFORWARD 898
+#define ID_PLAY_SEEKBACKWARDSMALL 899
+#define ID_PLAY_SEEKFORWARDSMALL 900
+#define ID_PLAY_SEEKBACKWARDMED 901
+#define ID_PLAY_SEEKFORWARDMED 902
+#define ID_PLAY_SEEKBACKWARDLARGE 903
+#define ID_PLAY_SEEKFORWARDLARGE 904
+#define ID_PLAY_INCAUDDELAY 905
+#define ID_PLAY_DECAUDDELAY 906
+#define ID_VOLUME_UP 907
+#define ID_VOLUME_DOWN 908
+#define ID_VOLUME_MUTE 909
+#define ID_VOLUME_MUTE_ON 910
+#define ID_VOLUME_MUTE_DISABLED 911
+#define ID_AFTERPLAYBACK_CLOSE 912
+#define ID_AFTERPLAYBACK_STANDBY 913
+#define ID_AFTERPLAYBACK_HIBERNATE 914
+#define ID_AFTERPLAYBACK_SHUTDOWN 915
+#define ID_AFTERPLAYBACK_LOGOFF 916
+#define ID_AFTERPLAYBACK_DONOTHING 917
+#define ID_NAVIGATE_SKIPBACKPLITEM 918
+#define ID_NAVIGATE_SKIPFORWARDPLITEM 919
+#define ID_NAVIGATE_SKIPBACK 920
+#define ID_NAVIGATE_SKIPFORWARD 921
+#define ID_NAVIGATE_TITLEMENU 922
+#define ID_NAVIGATE_ROOTMENU 923
+#define ID_NAVIGATE_SUBPICTUREMENU 924
+#define ID_NAVIGATE_AUDIOMENU 925
+#define ID_NAVIGATE_ANGLEMENU 926
+#define ID_NAVIGATE_CHAPTERMENU 927
+#define ID_NAVIGATE_MENU_LEFT 928
+#define ID_NAVIGATE_MENU_RIGHT 929
+#define ID_NAVIGATE_MENU_UP 930
+#define ID_NAVIGATE_MENU_DOWN 931
+#define ID_NAVIGATE_MENU_ACTIVATE 932
+#define ID_NAVIGATE_MENU_BACK 933
+#define ID_NAVIGATE_MENU_LEAVE 934
+#define ID_FAVORITES 935
+#define ID_FAVORITES_ORGANIZE 936
+#define ID_FAVORITES_ADD 937
+#define ID_HELP_HOMEPAGE 938
+#define ID_HELP_DOCUMENTATION 939
+#define ID_HELP_SHOWCOMMANDLINESWITCHES 940
+#define ID_HELP_DONATE 941
+#define ID_HELP_ABOUT 942
+#define ID_BOSS 943
+#define ID_DUMMYSEPARATOR 944
+#define ID_BUTTONSEP 945
+#define ID_FILE_POST_OPENMEDIA 946
+#define ID_FILE_POST_CLOSEMEDIA 947
+#define ID_MENU_PLAYER_SHORT 948
+#define ID_MENU_PLAYER_LONG 949
+#define ID_MENU_FILTERS 950
+#define ID_STREAM_AUDIO_NEXT 951
+#define ID_STREAM_AUDIO_PREV 952
+#define ID_STREAM_SUB_NEXT 953
+#define ID_STREAM_SUB_PREV 954
+#define ID_STREAM_SUB_ONOFF 955
+#define ID_OGM_AUDIO_NEXT 956
+#define ID_OGM_AUDIO_PREV 957
+#define ID_OGM_SUB_NEXT 958
+#define ID_OGM_SUB_PREV 959
+#define ID_DVD_ANGLE_NEXT 960
+#define ID_DVD_ANGLE_PREV 961
+#define ID_DVD_AUDIO_NEXT 962
+#define ID_DVD_AUDIO_PREV 963
+#define ID_DVD_SUB_NEXT 964
+#define ID_DVD_SUB_PREV 965
+#define ID_DVD_SUB_ONOFF 966
+#define ID_VIEW_ZOOM_AUTOFIT 967
+#define ID_FILE_OPENQUICK 968
+#define ID_VOLUME_BOOST_INC 969
+#define ID_VOLUME_BOOST_DEC 970
+#define ID_VOLUME_BOOST_MIN 971
+#define ID_VOLUME_BOOST_MAX 972
+#define ID_FILTERS_SUBITEM_START 2000
+#define ID_FILTERS_SUBITEM_END 2099
+#define ID_FILTERSTREAMS_SUBITEM_START 2100
+#define ID_FILTERSTREAMS_SUBITEM_END 2199
+#define ID_AUDIO_SUBITEM_START 2200
+#define ID_AUDIO_SUBITEM_END 2299
+#define ID_SUBTITLES_SUBITEM_START 2300
+#define ID_SUBTITLES_SUBITEM_END 2399
+#define ID_NAVIGATE_CHAP_SUBITEM_START 2400
+#define ID_NAVIGATE_CHAP_SUBITEM_END 2499
+#define ID_NAVIGATE_AUDIO_SUBITEM_START 2500
+#define ID_NAVIGATE_AUDIO_SUBITEM_END 2599
+#define ID_NAVIGATE_SUBP_SUBITEM_START 2600
+#define ID_NAVIGATE_SUBP_SUBITEM_END 2699
+#define ID_NAVIGATE_ANGLE_SUBITEM_START 2700
+#define ID_NAVIGATE_ANGLE_SUBITEM_END 2799
+#define ID_FAVORITES_FILE_START 2800
+#define ID_FAVORITES_FILE_END 3799
+#define ID_FAVORITES_DVD_START 3800
+#define ID_FAVORITES_DVD_END 3899
+#define ID_FAVORITES_DEVICE_START 3900
+#define ID_FAVORITES_DEVICE_END 3999
+#define ID_FILE_OPEN_CD_START 4000
+#define ID_FILE_OPEN_CD_END 4099
+#define ID_PANNSCAN_PRESETS_START 4100
+#define ID_PANNSCAN_PRESETS_END 4199
+#define ID_SHADERS_START 4200
+#define ID_SHADERS_END 4299
+#define IDD_OPEN_DLG 10000
+#define IDD_OPENCAPDEVICE_DLG 10001
+#define IDD_MEDIATYPES_DLG 10002
+#define IDD_AUTH_DLG 10003
+#define IDD_SAVE_DLG 10004
+#define IDD_SUBTITLEDL_DLG 10005
+#define IDD_CONVERT_DLG 10006
+#define IDD_CONVERTPROPS_DLG 10007
+#define IDD_CONVERTRES_DLG 10008
+#define IDD_CONVERTCHAP_DLG 10009
+#define IDD_FILEPROPDETAILS 10010
+#define IDD_FILEPROPCLIP 10011
+#define IDD_SHADEREDITOR_DLG 10012
+#define IDD_SHADERAUTOCOMPLETE_DLG 10013
+#define IDD_SHADERCOMBINE_DLG 10014
+#define IDD_PNSPRESET_DLG 10015
+#define IDD_GOTO_DLG 10016
+#define IDD_FAVADD 10017
+#define IDD_FAVORGANIZE 10018
+#define IDD_ABOUTBOX 10019
+#define IDD_PLAYERINFOBAR 10020
+#define IDD_PLAYERSTATUSBAR 10021
+#define IDD_PLAYERSEEKBAR 10022
+#define IDD_PPAGEPLAYBACK 10023
+#define IDD_PPAGEPLAYER 10024
+#define IDD_PPAGEDVD 10025
+#define IDD_PPAGESUBTITLES 10026
+#define IDD_PPAGEFORMATS 10027
+#define IDD_PPAGETWEAKS 10028
+#define IDD_PPAGEAUDIOSWITCHER 10029
+#define IDD_PPAGEEXTERNALFILTERS 10030
+#define IDD_PPAGEACCELTBL 10032
+#define IDD_PPAGESUBSTYLE 10033
+#define IDD_PPAGEMOUSE 10034
+#define IDD_PPAGEINTERNALFILTERS 10036
+#define IDD_PPAGELOGO 10037
+#define IDD_PPAGEVIDREND 10038
+#define IDD_PPAGEOUTPUT 10039
+#define IDD_PPAGEWEBSERVER 10040
+#define IDD_PPAGEAUDIODEC 10041
+#define IDD_PPAGESUBDB 10042
+#define IDD_SAVETEXTFILEDIALOGTEMPL 10043
+#define IDD_SAVETEXTFILEDIALOGTEMPL_400 10044
+#define IDD_CAPTURE_DLG 10045
+#define IDD_ADDREGFILTER 10046
+#define IDD_SELECTMEDIATYPE 10047
+#define IDD_COMPROPERTYPAGE 10048
+#define IDD_FILEPROPRES 10049
+#define IDD_SAVETHUMBSDIALOGTEMPL 10050
+#define IDD_SAVETHUMBSDIALOGTEMPL_400 10051
+#define IDD_PPAGECASIMIR 10052
+#define IDC_COMBO1 11000
+#define IDC_COMBO2 11001
+#define IDC_COMBO3 11002
+#define IDC_COMBO4 11003
+#define IDC_COMBO5 11004
+#define IDC_COMBO6 11005
+#define IDC_COMBO7 11006
+#define IDC_COMBO8 11007
+#define IDC_COMBO9 11008
+#define IDC_COMBO10 11009
+#define IDC_COMBO11 11010
+#define IDC_COMBO12 11011
+#define IDC_COMBO13 11012
+#define IDC_COMBO14 11013
+#define IDC_SLIDER1 11020
+#define IDC_SLIDER2 11021
+#define IDC_SLIDER3 11022
+#define IDC_SLIDER4 11023
+#define IDC_SLI_BRIGHTNESS 11025
+#define IDC_SLI_HUE 11026
+#define IDC_SLI_SATURATION 11027
+#define IDC_RADIO1 11040
+#define IDC_RADIO2 11041
+#define IDC_RADIO3 11042
+#define IDC_RADIO4 11043
+#define IDC_RADIO5 11044
+#define IDC_RADIO6 11045
+#define IDC_RADIO7 11046
+#define IDC_RADIO8 11047
+#define IDC_RADIO9 11048
+#define IDC_RADIO10 11049
+#define IDC_RADIO11 11050
+#define IDC_EDIT1 11060
+#define IDC_EDIT3 11061
+#define IDC_EDIT2 11062
+#define IDC_EDIT4 11063
+#define IDC_EDIT5 11064
+#define IDC_EDIT6 11065
+#define IDC_EDIT7 11066
+#define IDC_EDIT8 11067
+#define IDC_EDIT9 11068
+#define IDC_EDIT10 11069
+#define IDC_CHECK1 11080
+#define IDC_CHECK2 11081
+#define IDC_CHECK3 11082
+#define IDC_CHECK4 11083
+#define IDC_CHECK5 11084
+#define IDC_CHECK6 11085
+#define IDC_CHECK7 11086
+#define IDC_CHECK8 11087
+#define IDC_CHECK9 11088
+#define IDC_CHECK10 11089
+#define IDC_CHECK11 11090
+#define IDC_CHECK12 11091
+#define IDC_CHECK13 11092
+#define IDC_SPIN1 11100
+#define IDC_SPIN2 11101
+#define IDC_SPIN3 11102
+#define IDC_SPIN4 11103
+#define IDC_SPIN5 11104
+#define IDC_SPIN6 11105
+#define IDC_SPIN7 11106
+#define IDC_SPIN8 11107
+#define IDC_SPIN9 11108
+#define IDC_SPIN10 11109
+#define IDC_BUTTON1 11120
+#define IDC_BUTTON2 11121
+#define IDC_BUTTON3 11122
+#define IDC_BUTTON4 11123
+#define IDC_BUTTON5 11124
+#define IDC_BUTTON6 11125
+#define IDC_BUTTON7 11126
+#define IDC_BUTTON8 11127
+#define IDC_TREE1 11140
+#define IDC_TREE2 11141
+#define IDC_LIST1 11160
+#define IDC_LIST2 11180
+#define IDC_TAB1 11200
+#define IDC_ANIMATE1 11220
+#define IDC_PROGRESS1 11240
+#define IDC_STATIC1 11260
+#define IDC_STATIC2 11261
+#define IDC_STATIC3 11262
+#define IDC_STATIC4 11263
+#define IDC_DVDPATH 12000
+#define IDC_SUBRESYNCLIST 12001
+#define IDC_PLAYLIST 12002
+#define IDC_COLORPRI 12003
+#define IDC_COLORSEC 12004
+#define IDC_COLOROUTL 12005
+#define IDC_COLORSHAD 12006
+#define IDC_STATICLINK 12007
+#define IDC_STATICLINK2 12008
+#define IDC_DEFAULTICON 12009
+#define IDC_PLACEHOLDER 12010
+#define IDC_REPORT 12011
+#define IDC_FROMTO 12012
+#define IDC_TYPE 12013
+#define IDC_LOGOPREVIEW 12014
+#define IDC_LOGONAME 12015
+#define IDC_LOGOFILENAME 12016
+#define IDC_DESC 12017
+#define IDC_AUTHOR 12018
+#define IDC_CHECK_RELATIVETO 12019
+#define IDC_CHECK_SPCPOW2TEX 12020
+#define IDC_HLINE 12021
+#define IDC_STATICLINKGTS 12022
+#define IDC_BUTTON_EXT_SET 12023
+#define IDC_OK1 12024
+#define IDC_OK2 12025
+#define IDC_PLAYERSTATUS 12026
+#define IDC_PLAYERTIME 12027
+#define IDC_DSSYSDEF 12100
+#define IDC_DSOLD 12101
+#define IDC_DSOVERLAYMIXER 12102
+#define IDC_DSVMR7WIN 12103
+#define IDC_DSVMR9WIN 12104
+#define IDC_DSVMR7REN 12105
+#define IDC_DSVMR9REN 12106
+#define IDC_DSDXR 12107
+#define IDC_DSNULL_COMP 12108
+#define IDC_DSNULL_UNCOMP 12109
+#define IDC_RMSYSDEF 12120
+#define IDC_RMDX7 12121
+#define IDC_RMDX9 12122
+#define IDC_QTSYSDEF 12123
+#define IDC_QTDX7 12124
+#define IDC_QTDX9 12125
+#define IDC_REULARSURF 12126
+#define IDC_REGULARSURF 12127
+#define IDC_TEXTURESURF2D 12128
+#define IDC_TEXTURESURF3D 12129
+#define IDC_DX9RESIZER_COMBO 12130
+#define IDC_DSVMR9LOADMIXER 12131
+#define IDC_CHECK_MPEGINTERLACED 12132
+#define IDC_DSVMR9YUVMIXER 12132
+#define IDS_R_SETTINGS 13000
+#define IDS_RS_TITLEBARTEXTSTYLE 13001
+#define IDS_RS_USEWMASFREADER 13002
+#define IDS_RS_CONTROLSTATE 13003
+#define IDS_RS_VOLUME 13004
+#define IDS_RS_MUTE 13005
+#define IDS_RS_BALANCE 13006
+#define IDS_RS_LOOP 13007
+#define IDS_RS_LOOPNUM 13008
+#define IDS_RS_REWIND 13009
+#define IDS_RS_ZOOM 13010
+#define IDS_RS_HWACCEL 13011
+#define IDS_RS_MULTIINST 13012
+#define IDS_RS_ALWAYSONTOP 13013
+#define IDS_RS_AUTOZOOM 13014
+#define IDS_RS_FULLSCREENCTRLS 13015
+#define IDS_RS_FULLSCREENCTRLSTIMEOUT 13016
+#define IDS_RS_VMRFLIP 13017
+#define IDS_RS_DVDPATH 13018
+#define IDS_RS_USEDVDPATH 13019
+#define IDS_RS_MENULANG 13020
+#define IDS_RS_AUDIOLANG 13021
+#define IDS_RS_SUBTITLESLANG 13022
+#define IDS_RS_SPLOGFONT 13023
+#define IDS_RS_SPOUTLINE 13024
+#define IDS_RS_SPSHADOW 13025
+#define IDS_RS_SPSFGCOLOR 13026
+#define IDS_RS_SPOVERRIDEPLACEMENT 13027
+#define IDS_RS_SPHORPOS 13028
+#define IDS_RS_SPVERPOS 13029
+#define IDS_RS_SPCSIZE 13030
+#define IDS_RS_SPC16BPP 13031
+#define IDS_RS_SPCMAXRES 13032
+#define IDS_RS_SPCCOMPRESS 13033
+#define IDS_RS_INTREALMEDIA 13034
+#define IDS_RS_FAVORWAVEOUT 13035
+#define IDS_RS_DISABLEXPTOOLBARS 13036
+#define IDS_RS_USEDEDYNAMIC 13037
+#define IDS_RS_DBLCLICKFULLSCREEN 13038
+#define IDS_RS_EXITFULLSCREENATTHEEND 13039
+#define IDS_RS_AUTOSPEAKERCONF 13040
+#define IDS_RS_REMEMBERWINDOWPOS 13041
+#define IDS_RS_LASTWINDOWRECT 13042
+#define IDS_RS_AUDIORENDERERTYPE 13043
+#define IDS_RS_SPEAKERTOCHANNELMAPPING 13044
+#define IDS_RS_CUSTOMCHANNELMAPPING 13045
+#define IDS_RS_DOWNSAMPLETO441 13046
+#define IDS_RS_ENABLEAUDIOSWITCHER 13047
+#define IDS_RS_HIDECAPTIONMENU 13048
+#define IDS_R_FILTERS 13049
+#define IDS_RS_DEFAULTVIDEOFRAME 13050
+#define IDS_RS_REMEMBERWINDOWSIZE 13051
+#define IDS_RS_REALMEDIARENDERLESS 13052
+#define IDS_RS_QUICKTIMERENDERER 13053
+#define IDS_RS_REALMEDIAFPS 13054
+#define IDS_RS_AUDIOTIMESHIFT 13055
+#define IDS_RS_ENABLEAUDIOTIMESHIFT 13056
+#define IDS_R_FAVFILES 13057
+#define IDS_R_FAVDVDS 13058
+#define IDS_R_FAVDEVICES 13059
+#define IDS_RS_LOGOFILE 13060
+#define IDS_RS_ENABLEWORKERTHREADFOROPENING 13061
+#define IDS_RS_PNSPRESETS 13062
+#define IDS_RS_AUTOLOADAUDIO 13063
+#define IDS_RS_AUTOLOADSUBTITLES 13064
+#define IDS_RS_SEARCHKEYFRAMES 13065
+#define IDS_RS_ACCELTBL 13066
+#define IDS_RS_SETFULLSCREENRES 13067
+#define IDS_RS_FULLSCREENRES 13068
+#define IDS_RS_WINLIRCADDR 13069
+#define IDS_R_COMMANDS 13070
+#define IDS_RS_WINLIRC 13071
+#define IDS_RS_TRAYICON 13072
+#define IDS_RS_KEEPASPECTRATIO 13073
+#define IDS_RS_UICEADDR 13074
+#define IDS_RS_UICE 13075
+#define IDS_RS_JUMPDISTS 13076
+#define IDS_RS_JUMPDISTM 13077
+#define IDS_RS_JUMPDISTL 13078
+#define IDS_RS_REPORTFAILEDPINS 13079
+#define IDS_RS_SRCFILTERS 13080
+#define IDS_RS_KEEPHISTORY 13081
+#define IDS_RS_LOGOID 13082
+#define IDS_RS_LOGOEXT 13083
+#define IDS_RS_TRAFILTERS 13084
+#define IDS_RS_MPEGDI 13085
+#define IDS_RS_MPEGBRIGHT 13086
+#define IDS_RS_MPEGCONT 13087
+#define IDS_RS_MPEGHUE 13088
+#define IDS_RS_MPEGSAT 13089
+#define IDS_RS_MPEGFORCEDSUBS 13090
+#define IDS_RS_MPEGPLANARYUV 13091
+#define IDS_RS_COMPMONDESKARDIFF 13092
+#define IDS_RS_HIDECDROMSSUBMENU 13093
+#define IDS_RS_VMRTEXTURE 13094
+#define IDS_RS_VMR3D 13095
+#define IDS_RS_DSVIDEORENDERERTYPE 13096
+#define IDS_RS_RMVIDEORENDERERTYPE 13097
+#define IDS_RS_QTVIDEORENDERERTYPE 13098
+#define IDS_RS_APSURACEFUSAGE 13099
+#define IDS_R_LOGINS 13100
+#define IDS_RS_ENABLEWEBSERVER 13101
+#define IDS_RS_WEBSERVERPORT 13102
+#define IDS_RS_LASTWINDOWTYPE 13103
+#define IDS_RS_ONTOP 13104
+#define IDS_RS_MPASF 13105
+#define IDS_RS_AC3SC 13106
+#define IDS_RS_AC3DRC 13107
+#define IDS_RS_WEBSERVERPRINTDEBUGINFO 13108
+#define IDS_RS_WEBSERVERUSECOMPRESSION 13109
+#define IDS_RS_MPANORMALIZE 13110
+#define IDS_RS_DTSSC 13111
+#define IDS_RS_DTSDRC 13112
+#define IDS_RS_SNAPSHOTPATH 13113
+#define IDS_RS_PRIORITY 13114
+#define IDS_RS_SNAPSHOTEXT 13115
+#define IDS_RS_LAUNCHFULLSCREEN 13116
+#define IDS_RS_MPABOOST 13117
+#define IDS_RS_AACSC 13118
+#define IDS_RS_VMRSYNCFIX 13119
+#define IDS_RS_ISDB 13120
+#define IDS_RS_POW2TEX 13121
+#define IDS_R_INTERNAL_FILTERS 13122
+#define IDS_RS_WEBROOT 13123
+#define IDS_RS_WEBSERVERLOCALHOSTONLY 13124
+#define IDS_RS_ASPECTRATIO_X 13125
+#define IDS_RS_ASPECTRATIO_Y 13126
+#define IDS_RS_DX9_RESIZER 13127
+#define IDS_RS_WEBSERVERCGI 13128
+#define IDS_RS_WEBDEFINDEX 13129
+#define IDS_RS_FREEWINDOWRESIZING 13130
+#define IDS_RS_NOTIFYMSN 13131
+#define IDS_RS_NOTIFYGTSDLL 13132
+#define IDS_RS_VMR9MIXERMODE 13133
+#define IDS_RS_THUMBROWS 13134
+#define IDS_RS_THUMBCOLS 13135
+#define IDS_RS_SNAPTODESKTOPEDGES 13136
+#define IDS_RS_ENABLESUBTITLES 13137
+#define IDS_RS_MPEGINTERLACED 13138
+#define IDS_RS_THUMBWIDTH 13139
+#define IDS_RS_AUDIONORMALIZE 13140
+#define IDS_RS_AUDIOBOOST 13141
+#define IDS_RS_D3DFULLSCREEN 13142
+#define IDS_RS_MONITOR_AUTOREFRESHRATE 13143
+#define IDS_RS_COLOR_BRIGHTNESS 13144
+#define IDS_RS_COLOR_CONTRAST 13145
+#define IDS_RS_COLOR_HUE 13146
+#define IDS_RS_COLOR_SATURATION 13147
+#define IDS_RS_SHADERLIST 13148
+#define IDS_RS_TITLEBARTEXTTITLE 13149
+#define IDS_RS_VMR9MIXERYUV 13150
+#define IDS_RS_AUDIONORMALIZERECOVER 13151
+#define IDS_SRC_RADGT 14000
+#define IDS_SRC_CDDA 14001
+#define IDS_SRC_AVI 14002
+#define IDS_SRC_CDXA 14003
+#define IDS_SRC_VTS 14004
+#define IDS_SRC_FLIC 14005
+#define IDS_SRC_D2V 14006
+#define IDS_SRC_DTSAC3 14007
+#define IDS_SRC_SHOUTCAST 14008
+#define IDS_SRC_REALMEDIA 14009
+#define IDS_SRC_MATROSKA 14010
+#define IDS_SRC_ROQ 14011
+#define IDS_SRC_OGG 14012
+#define IDS_SRC_NUT 14013
+#define IDS_SRC_DIRAC 14014
+#define IDS_SRC_DSM 14015
+#define IDS_SRC_MPA 14016
+#define IDS_SRC_MP4 14017
+#define IDS_TRA_RV 14018
+#define IDS_TRA_RA 14019
+#define IDS_TRA_MPEG1 14020
+#define IDS_TRA_MPEG2 14021
+#define IDS_TRA_MPA 14022
+#define IDS_TRA_LPCM 14023
+#define IDS_TRA_AC3 14024
+#define IDS_TRA_DTS 14025
+#define IDS_TRA_AAC 14026
+#define IDS_TRA_DIRAC 14027
+#define IDS_TRA_PS2AUD 14028
+#define IDS_VIDRENDDESC 14100
+#define IDS_CONVERT_ADDFILE 14101
+#define IDS_CONVERT_PROPERTIES 14102
+#define IDS_CONVERT_REMOVE 14103
+#define IDS_CONVERT_ENABLESTREAM 14104
+#define IDS_CONVERT_DISABLESTREAM 14105
+#define IDS_CONVERT_PINPROPERTIES 14106
+#define IDS_CONVERT_ADDRESOURCE 14107
+#define IDS_CONVERT_REMOVEALL 14108
+#define IDS_CONVERT_SAVEAS 14109
+#define IDS_CONVERT_RESOURCEPROPERTIES 14110
+#define IDS_CONVERT_LAUNCHINBROWSER 14111
+#define IDS_CONVERT_ADDCHAPTER 14112
+#define IDS_CONVERT_CHAPTERPROPERTIES 14113
+#define IDS_CONVERT_DEMUXSTREAM 14114
+#define IDS_PLAYLIST_OPEN 14115
+#define IDS_PLAYLIST_ADD 14116
+#define IDS_PLAYLIST_REMOVE 14117
+#define IDS_PLAYLIST_COPYTOCLIPBOARD 14118
+#define IDS_PLAYLIST_SAVEAS 14119
+#define IDS_PLAYLIST_SORTBYLABEL 14120
+#define IDS_PLAYLIST_SORTBYPATH 14121
+#define IDS_PLAYLIST_RANDOMIZE 14122
+#define IDS_PLAYLIST_RESTORE 14123
+#define IDS_SUBRESYNC_SEPARATOR 14124
+#define IDS_SUBRESYNC_DELETE 14125
+#define IDS_SUBRESYNC_DUPLICATE 14126
+#define IDS_SUBRESYNC_RESET 14127
+#define IDS_SUBRESYNC_ORIGINAL 14128
+#define IDS_SUBRESYNC_CURRENT 14129
+#define IDS_SUBRESYNC_EDIT 14130
+#define IDS_SUBRESYNC_YES 14131
+#define IDS_SUBRESYNC_NO 14132
+#define IDS_SUBRESYNC_DECREASE 14133
+#define IDS_SUBRESYNC_INCREASE 14134
+#define IDS_OPTIONS_CAPTION 14135
+#define IDS_SHADER_COMBINE 14136
+#define IDS_SHADER_OFF 14137
+#define IDS_SHADER_POPUP 14138
+#define IDS_FAVORITES_POPUP 14139
+#define IDS_JUMPTO_POPUP 14140
+#define IDS_VIDEOANGLE_POPUP 14141
+#define IDS_SUBTITLELANGUAGE_POPUP 14142
+#define IDS_AUDIOLANGUAGE_POPUP 14143
+#define IDS_SUBTITLES_POPUP 14144
+#define IDS_AUDIO_POPUP 14145
+#define IDS_FILTERS_POPUP 14146
+#define IDS_OPENCDROM_POPUP 14147
+#define IDS_NAVIGATE_POPUP 14148
+#define IDS_VIDEOFRAME_POPUP 14149
+#define IDS_PANSCAN_POPUP 14150
+#define IDS_ASPECTRATIO_POPUP 14151
+#define IDS_ZOOM_POPUP 14152
+#define IDS_FAVORITES_ADD 14153
+#define IDS_FAVORITES_ORGANIZE 14154
+#define IDS_PLAYLIST_SHUFFLE 14155
+#define IDS_PLAYLIST_REMEBERITEMS 14156
+#define IDS_CONTROLS_CLOSING 14157
+#define IDS_CONTROLS_PLAYING 14158
+#define IDS_CONTROLS_PAUSED 14159
+#define IDS_CONTROLS_STOPPED 14160
+#define IDS_CONTROLS_BUFFERING 14161
+#define IDS_CONTROLS_CAPTURING 14162
+#define IDS_CONTROLS_OPENING 14163
+#define IDS_CONTROLS_CLOSED 14164
+#define IDS_SUBTITLES_OPTIONS 14165
+#define IDS_SUBTITLES_STYLES 14166
+#define IDS_SUBTITLES_RELOAD 14167
+#define IDS_SUBTITLES_ENABLE 14168
+#define IDS_PANSCAN_EDIT 14169
+#define IDS_INFOBAR_TITLE 14170
+#define IDS_INFOBAR_AUTHOR 14171
+#define IDS_INFOBAR_COPYRIGHT 14172
+#define IDS_INFOBAR_RATING 14173
+#define IDS_INFOBAR_DESCRIPTION 14174
+#define IDS_INFOBAR_DOMAIN 14175
+#define IDS_INFOBAR_LOCATION 14176
+#define IDS_INFOBAR_VIDEO 14177
+#define IDS_INFOBAR_AUDIO 14178
+#define IDS_INFOBAR_SUBTITLES 14179
+#define IDS_CONTROLS_COMPLETING 14180
+#define IDS_AUTOPLAY_PLAYVIDEO 14181
+#define IDS_AUTOPLAY_PLAYMUSIC 14182
+#define IDS_AUTOPLAY_PLAYAUDIOCD 14183
+#define IDS_AUTOPLAY_PLAYDVDMOVIE 14184
+#define IDS_PROPSHEET_PROPERTIES 14185
+#define IDS_GRAPHBUILDER_AUDIOSWITCHER 14186
+#define IDS_SHADER_EDIT 14187
+#define IDF_SHADER_EDGE_SHARPEN 20000
+#define IDF_SHADER_SHARPEN_COMPLEX 20001
+#define IDC_FULLSCR_COMBO 22000
+#define IDC_AUTO_REFRESHRATE_CHECK 22001
+#define IDC_FULLSCREEN_MONITOR_CHECK 22002
+#define IDC_SLI_CONTRAST 22003
+#define IDC_RESET 22004
+#define IDC_DVD_POS 22005
+#define IDC_FILE_POS 22006
+#define ID_VIEW_TEARING_TEST 32769
+#define ID_SHADER_TOGGLE 32770
+#define IDS_SHADER_TOGGLE 32771
+#define ID_FILE_OPENDISC 32772
+#define ID_FILE_EJECTCLIP 32773
+#define ID_FILE_OPENDISC32774 32774
+#define ID__SHADERS 32775
+#define ID_Menu 32776
+#define ID_VIEW_REMAINING_TIME 32778
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 20002
+#define _APS_NEXT_COMMAND_VALUE 32779
+#define _APS_NEXT_CONTROL_VALUE 22006
+#define _APS_NEXT_SYMED_VALUE 24000
+#endif
+#endif
diff --git a/src/apps/subresync/res/bitmap1.bmp b/src/apps/subresync/res/bitmap1.bmp
new file mode 100644
index 000000000..002ab8074
--- /dev/null
+++ b/src/apps/subresync/res/bitmap1.bmp
Binary files differ
diff --git a/src/apps/subresync/res/bitmap2.bmp b/src/apps/subresync/res/bitmap2.bmp
new file mode 100644
index 000000000..9ce5fecda
--- /dev/null
+++ b/src/apps/subresync/res/bitmap2.bmp
Binary files differ
diff --git a/src/apps/subresync/res/subresync.ico b/src/apps/subresync/res/subresync.ico
new file mode 100644
index 000000000..8a84ca3d3
--- /dev/null
+++ b/src/apps/subresync/res/subresync.ico
Binary files differ
diff --git a/src/apps/subresync/res/subresync.manifest b/src/apps/subresync/res/subresync.manifest
new file mode 100644
index 000000000..abc7808e1
--- /dev/null
+++ b/src/apps/subresync/res/subresync.manifest
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="X86"
+ name="Microsoft.Windows.subresync"
+ type="win32"
+/>
+<description>Your app description here</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="X86"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+</assembly>
diff --git a/src/apps/subresync/res/subresync.rc2 b/src/apps/subresync/res/subresync.rc2
new file mode 100644
index 000000000..79e456b05
--- /dev/null
+++ b/src/apps/subresync/res/subresync.rc2
@@ -0,0 +1,13 @@
+//
+// subresync.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/src/apps/subresync/resource.h b/src/apps/subresync/resource.h
new file mode 100644
index 000000000..71c2b67ff
--- /dev/null
+++ b/src/apps/subresync/resource.h
@@ -0,0 +1,56 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by subresync.rc
+//
+#define IDR_MANIFEST 1
+#define VS_VERSION_INFO 1
+#define IDC_EDIT3 3
+#define IDM_ABOUTBOX 0x0010
+#define IDS_ABOUTBOX 101
+#define IDD_SUBRESYNC_DIALOG 102
+#define IDS_RG_SPACESENS 102
+#define IDS_R_GENERAL 103
+#define IDS_SKIP 104
+#define IDS_ADD 105
+#define IDR_MAINFRAME 128
+#define IDB_BITMAP1 130
+#define IDB_BITMAP2 131
+#define IDD_SAVEASTMPLT 131
+#define IDD_ASKCHARDLG 137
+#define IDD_OPENTMPLT 138
+#define IDD_ABOUTBOX 142
+#define IDC_HOMEPAGEBTN 202
+#define IDC_BUGREPORTBTN 212
+#define IDC_LIST1 1003
+#define IDC_OPENBTN 1004
+#define IDC_SAVEBTN 1005
+#define IDC_RESET 1006
+#define IDC_COMBO1 1007
+#define IDC_EDIT1 1008
+#define IDC_EDITSUB 1008
+#define IDC_EXTEND 1010
+#define IDC_UNDOEXTEND 1011
+#define IDC_EDIT4 1011
+#define IDC_CHECK1 1012
+#define IDC_CHECK2 1013
+#define IDC_SLIDER1 1014
+#define IDC_STATIC1 1015
+#define IDC_STATIC2 1016
+#define IDC_STATIC3 1017
+#define IDC_EDIT2 1018
+#define IDC_STATIC4 1019
+#define IDC_TIMEFORMATLABEL 1020
+#define IDC_AT 1025
+#define IDC_OCRDLL 1026
+#define IDC_COMBO2 2000
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 129
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/apps/subresync/stdafx.cpp b/src/apps/subresync/stdafx.cpp
new file mode 100644
index 000000000..6d5255033
--- /dev/null
+++ b/src/apps/subresync/stdafx.cpp
@@ -0,0 +1,28 @@
+/*
+ * SubResync. Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// subresync.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
diff --git a/src/apps/subresync/stdafx.h b/src/apps/subresync/stdafx.h
new file mode 100644
index 000000000..0acab6d71
--- /dev/null
+++ b/src/apps/subresync/stdafx.h
@@ -0,0 +1,63 @@
+/*
+ * SubResync. Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+#include <afxdisp.h> // MFC Automation classes
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
diff --git a/src/apps/subresync/subresync.cpp b/src/apps/subresync/subresync.cpp
new file mode 100644
index 000000000..bee844ac7
--- /dev/null
+++ b/src/apps/subresync/subresync.cpp
@@ -0,0 +1,98 @@
+/*
+ * SubResync. Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// subresync.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "subresync.h"
+#include "subresyncDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CSubresyncApp
+
+BEGIN_MESSAGE_MAP(CSubresyncApp, CWinApp)
+ ON_COMMAND(ID_HELP, CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CSubresyncApp construction
+
+CSubresyncApp::CSubresyncApp()
+{
+}
+
+
+// The one and only CSubresyncApp object
+
+CSubresyncApp theApp;
+
+
+// CSubresyncApp initialization
+
+BOOL CSubresyncApp::InitInstance()
+{
+ // InitCommonControls() is required on Windows XP if an application
+ // manifest specifies use of ComCtl32.dll version 6 or later to enable
+ // visual styles. Otherwise, any window creation will fail.
+ InitCommonControls();
+
+ CWinApp::InitInstance();
+
+ AfxEnableControlContainer();
+
+ SetRegistryKey(_T("Gabest"));
+
+ CoInitialize(NULL);
+
+ CCommandLineInfo cmdInfo;
+ ParseCommandLine(cmdInfo);
+
+ CSubresyncDlg dlg(cmdInfo.m_strFileName);
+ m_pMainWnd = &dlg;
+
+ INT_PTR nResponse = dlg.DoModal();
+ if (nResponse == IDOK)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with OK
+ }
+ else if (nResponse == IDCANCEL)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with Cancel
+ }
+
+ // Since the dialog has been closed, return FALSE so that we exit the
+ // application, rather than start the application's message pump.
+ return FALSE;
+}
+
+int CSubresyncApp::ExitInstance()
+{
+ CoUninitialize();
+
+ return CWinApp::ExitInstance();
+}
diff --git a/src/apps/subresync/subresync.h b/src/apps/subresync/subresync.h
new file mode 100644
index 000000000..44bfc4df0
--- /dev/null
+++ b/src/apps/subresync/subresync.h
@@ -0,0 +1,53 @@
+/*
+ * SubResync. Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// subresync.h : main header file for the PROJECT_NAME application
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+
+// CsubresyncApp:
+// See subresync.cpp for the implementation of this class
+//
+
+class CSubresyncApp : public CWinApp
+{
+public:
+ CSubresyncApp();
+
+// Overrides
+ public:
+ virtual BOOL InitInstance();
+ virtual int ExitInstance();
+
+// Implementation
+
+ DECLARE_MESSAGE_MAP()
+};
+
+extern CSubresyncApp theApp; \ No newline at end of file
diff --git a/src/apps/subresync/subresync.rc b/src/apps/subresync/subresync.rc
new file mode 100644
index 000000000..52cfe7a55
--- /dev/null
+++ b/src/apps/subresync/subresync.rc
@@ -0,0 +1,352 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\subresync.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\subresync.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_ABOUTBOX, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 198
+ VERTGUIDE, 14
+ VERTGUIDE, 190
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 122
+ END
+
+ IDD_ASKCHARDLG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 115
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 92
+ END
+
+ IDD_OPENTMPLT, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 285
+ VERTGUIDE, 54
+ TOPMARGIN, 1
+ BOTTOMMARGIN, 33
+ HORZGUIDE, 7
+ END
+
+ IDD_SAVEASTMPLT, DIALOG
+ BEGIN
+ LEFTMARGIN, 5
+ RIGHTMARGIN, 271
+ TOPMARGIN, 2
+ BOTTOMMARGIN, 63
+ END
+
+ IDD_SUBRESYNC_DIALOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 334
+ VERTGUIDE, 13
+ VERTGUIDE, 68
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 190
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// RT_MANIFEST
+//
+
+IDR_MANIFEST RT_MANIFEST "res\\subresync.manifest"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDB_BITMAP1 BITMAP "res\\bitmap1.bmp"
+IDB_BITMAP2 BITMAP "res\\bitmap2.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 205, 129
+STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About..."
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,137,98,50,14,WS_GROUP
+ GROUPBOX "",IDC_STATIC,7,7,191,115,BS_CENTER
+ LTEXT "Subresync Version 2.24\nCopyright 2001-2002 Gabest",
+ IDC_STATIC,14,17,179,19
+ PUSHBUTTON "Homepage",IDC_HOMEPAGEBTN,17,98,50,14,BS_FLAT
+ PUSHBUTTON "Bug Report",IDC_BUGREPORTBTN,77,98,50,14,BS_FLAT
+ LTEXT "Credits:\n- SAMI format support by Sanger && Wilowisp of SPKOR\n- Handling of some basic html style modifier tags in SAMI done by [maven]\n- Advanced Text Renderer is using the 'Rasterizer' class of Avery Lee's subtitler plugin",
+ IDC_STATIC,14,40,176,51
+END
+
+IDD_ASKCHARDLG DIALOGEX 0, 0, 122, 99
+STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_TOOLWINDOW
+CAPTION "Enter matching letter(s)"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ EDITTEXT 1008,7,7,108,28,ES_CENTER | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "&OK",IDOK,7,40,108,14
+ PUSHBUTTON "&Extend",IDC_EXTEND,65,59,50,14
+ PUSHBUTTON "Un&do Extend",IDC_UNDOEXTEND,7,59,50,14
+ EDITTEXT 1018,7,78,108,14,ES_AUTOHSCROLL | ES_READONLY
+END
+
+IDD_OPENTMPLT DIALOGEX 0, 0, 292, 40
+STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ LTEXT "Character Set:",IDC_STATIC4,5,3,47,8
+ COMBOBOX 1007,54,1,74,76,CBS_DROPDOWNLIST | WS_VSCROLL |
+ WS_TABSTOP
+ LTEXT "Fps:",IDC_STATIC,143,3,14,8
+ COMBOBOX IDC_COMBO2,161,1,37,69,CBS_DROPDOWN | WS_VSCROLL |
+ WS_TABSTOP
+ CONTROL "Append",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,5,22,48,10
+ EDITTEXT IDC_EDIT1,54,20,21,13,ES_CENTER | ES_AUTOHSCROLL
+ EDITTEXT IDC_EDIT2,78,20,21,13,ES_CENTER | ES_AUTOHSCROLL |
+ ES_NUMBER
+ EDITTEXT IDC_EDIT3,102,20,21,13,ES_CENTER | ES_AUTOHSCROLL |
+ ES_NUMBER
+ EDITTEXT IDC_EDIT4,126,20,21,13,ES_CENTER | ES_AUTOHSCROLL |
+ ES_NUMBER
+ LTEXT "(hh:mm:ss.ms)",IDC_TIMEFORMATLABEL,152,23,49,8
+ LTEXT "at:",IDC_AT,44,23,8,8
+END
+
+IDD_SAVEASTMPLT DIALOGEX 0, 0, 278, 68
+STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ CONTROL "Unicode output",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,18,15,63,10
+ CONTROL "Clear image->letter(s) database",IDC_CHECK2,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,99,15,110,10
+ CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
+ TBS_NOTICKS | WS_TABSTOP,120,40,123,13
+ LTEXT "Space detecting sensitivity:",IDC_STATIC1,99,29,87,8
+ LTEXT "More",IDC_STATIC2,99,42,17,8
+ LTEXT "Less",IDC_STATIC3,247,42,16,8
+ GROUPBOX "MBCS<->Unicode",IDC_STATIC,9,2,77,58
+ GROUPBOX "OCR Settings",IDC_STATIC,93,2,178,58
+ CONTROL "Use ocrdll.dll",IDC_OCRDLL,"Button",BS_AUTOCHECKBOX |
+ NOT WS_VISIBLE | WS_TABSTOP,212,15,52,10
+END
+
+IDD_SUBRESYNC_DIALOG DIALOGEX 0, 0, 342, 197
+STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE |
+ WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+EXSTYLE WS_EX_ACCEPTFILES | WS_EX_APPWINDOW
+CAPTION "Subresync"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ PUSHBUTTON "&Open...",IDC_OPENBTN,7,7,52,14
+ PUSHBUTTON "Save &As...",IDC_SAVEBTN,7,28,52,14
+ PUSHBUTTON "&Reset timing",IDC_RESET,7,49,52,14
+ PUSHBUTTON "&Edit...",IDC_EDITSUB,7,70,52,14,WS_DISABLED
+ COMBOBOX IDC_COMBO1,7,71,52,30,CBS_DROPDOWNLIST | NOT WS_VISIBLE |
+ WS_VSCROLL | WS_TABSTOP
+ CONTROL "Render",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,13,92,42,10
+ CONTROL "Unlink",IDC_CHECK2,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,13,107,43,10
+ PUSHBUTTON "E&xit",IDOK,7,176,52,14
+ CONTROL "List1",IDC_LIST1,"SysListView32",LVS_REPORT |
+ LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_EDITLABELS |
+ LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,68,7,266,183,
+ WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog Info
+//
+
+IDD_OPENTMPLT DLGINIT
+BEGIN
+ IDC_COMBO2, 0x403, 7, 0
+0x3332, 0x392e, 0x3637, "\000"
+ IDC_COMBO2, 0x403, 3, 0
+0x3432, "\000"
+ IDC_COMBO2, 0x403, 3, 0
+0x3532, "\000"
+ IDC_COMBO2, 0x403, 6, 0
+0x3932, 0x392e, 0x0037,
+ IDC_COMBO2, 0x403, 3, 0
+0x3033, "\000"
+ 0
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 2,0,24,0
+ PRODUCTVERSION 2,0,24,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "Visit http://gabest.org/ for updates"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Subresync"
+ VALUE "FileVersion", "2, 0, 24, 0"
+ VALUE "InternalName", "subresync"
+ VALUE "LegalCopyright", "Copyright (C) 2001-2002 Gabest"
+ VALUE "OriginalFilename", "subresync.EXE"
+ VALUE "ProductName", "Subresync"
+ VALUE "ProductVersion", "2, 0, 24, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_ABOUTBOX "&About subresync..."
+ IDS_RG_SPACESENS "SpaceSensitivity"
+ IDS_R_GENERAL "General"
+ IDS_SKIP "&Skip"
+ IDS_ADD "&Add"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\subresync.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/apps/subresync/subresync.sln b/src/apps/subresync/subresync.sln
new file mode 100644
index 000000000..374a23124
--- /dev/null
+++ b/src/apps/subresync/subresync.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subresync", "subresync.vcproj", "{0B232385-29E3-4F64-92F6-1029204A08F3}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {0B232385-29E3-4F64-92F6-1029204A08F3}.Debug.ActiveCfg = Debug|Win32
+ {0B232385-29E3-4F64-92F6-1029204A08F3}.Debug.Build.0 = Debug|Win32
+ {0B232385-29E3-4F64-92F6-1029204A08F3}.Release.ActiveCfg = Release|Win32
+ {0B232385-29E3-4F64-92F6-1029204A08F3}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/apps/subresync/subresync.vcproj b/src/apps/subresync/subresync.vcproj
new file mode 100644
index 000000000..9e97d3281
--- /dev/null
+++ b/src/apps/subresync/subresync.vcproj
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding = "windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.00"
+ Name="subresync"
+ ProjectGUID="{0B232385-29E3-4F64-92F6-1029204A08F3}"
+ Keyword="MFCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+ StringPooling="TRUE"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ TreatWChar_tAsBuiltInType="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ </Configuration>
+ </Configurations>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="subresync.cpp">
+ </File>
+ <File
+ RelativePath="subresyncDlg.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="Resource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="subresync.h">
+ </File>
+ <File
+ RelativePath="subresyncDlg.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest">
+ <File
+ RelativePath="res\subresync.ico">
+ </File>
+ <File
+ RelativePath="res\subresync.manifest">
+ </File>
+ <File
+ RelativePath="subresync.rc">
+ </File>
+ <File
+ RelativePath="res\subresync.rc2">
+ </File>
+ </Filter>
+ <File
+ RelativePath="ReadMe.txt">
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/apps/subresync/subresyncDlg.cpp b/src/apps/subresync/subresyncDlg.cpp
new file mode 100644
index 000000000..2c0c5ce94
--- /dev/null
+++ b/src/apps/subresync/subresyncDlg.cpp
@@ -0,0 +1,169 @@
+/*
+ * SubResync. Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// subresyncDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "subresync.h"
+#include "subresyncDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CAboutDlg dialog used for App About
+
+class CAboutDlg : public CDialog
+{
+public:
+ CAboutDlg();
+
+// Dialog Data
+ enum { IDD = IDD_ABOUTBOX };
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+// Implementation
+protected:
+ DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+END_MESSAGE_MAP()
+
+
+// CSubresyncDlg dialog
+
+
+
+CSubresyncDlg::CSubresyncDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CSubresyncDlg::IDD, pParent)
+{
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+}
+
+void CSubresyncDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CSubresyncDlg, CDialog)
+ ON_WM_SYSCOMMAND()
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+// CSubresyncDlg message handlers
+
+BOOL CSubresyncDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // Add "About..." menu item to system menu.
+
+ // IDM_ABOUTBOX must be in the system command range.
+ ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+ ASSERT(IDM_ABOUTBOX < 0xF000);
+
+ CMenu* pSysMenu = GetSystemMenu(FALSE);
+ if (pSysMenu != NULL)
+ {
+ CString strAboutMenu;
+ strAboutMenu.LoadString(IDS_ABOUTBOX);
+ if (!strAboutMenu.IsEmpty())
+ {
+ pSysMenu->AppendMenu(MF_SEPARATOR);
+ pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+ }
+ }
+
+ // Set the icon for this dialog. The framework does this automatically
+ // when the application's main window is not a dialog
+ SetIcon(m_hIcon, TRUE); // Set big icon
+ SetIcon(m_hIcon, FALSE); // Set small icon
+
+ // TODO: Add extra initialization here
+
+ return TRUE; // return TRUE unless you set the focus to a control
+}
+
+void CSubresyncDlg::OnSysCommand(UINT nID, LPARAM lParam)
+{
+ if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+ {
+ CAboutDlg dlgAbout;
+ dlgAbout.DoModal();
+ }
+ else
+ {
+ CDialog::OnSysCommand(nID, lParam);
+ }
+}
+
+// If you add a minimize button to your dialog, you will need the code below
+// to draw the icon. For MFC applications using the document/view model,
+// this is automatically done for you by the framework.
+
+void CSubresyncDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // device context for painting
+
+ SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
+
+ // Center icon in client rectangle
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // Draw the icon
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ CDialog::OnPaint();
+ }
+}
+
+// The system calls this function to obtain the cursor to display while the user drags
+// the minimized window.
+HCURSOR CSubresyncDlg::OnQueryDragIcon()
+{
+ return static_cast<HCURSOR>(m_hIcon);
+}
diff --git a/src/apps/subresync/subresyncDlg.h b/src/apps/subresync/subresyncDlg.h
new file mode 100644
index 000000000..b03e4799a
--- /dev/null
+++ b/src/apps/subresync/subresyncDlg.h
@@ -0,0 +1,97 @@
+/*
+ * SubResync. Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// subresyncDlg.h : header file
+//
+
+#pragma once
+
+class CharImg
+{
+public:
+ CString m_str;
+
+ CSize m_size;
+ CAutoVectorPtr<BYTE> m_p;
+
+ // feature list
+ int m_topbottom;
+
+ CharImg(DWORD* p, int pitch, CRect r, int* left, int* right, int topbottom, CString str = _T(""));
+ CharImg(FILE* f);
+ ~CharImg();
+
+ bool Match(CharImg* img);
+
+ bool Write(FILE* f);
+ bool Read(FILE* f);
+};
+
+class CharSegment
+{
+public:
+ int* left;
+ int* right;
+ int h, srow, erow;
+
+ CharSegment(int* left, int* right, int h, int srow, int erow);
+ ~CharSegment();
+};
+
+// CSubresyncDlg dialog
+class CSubresyncDlg : public CDialog
+{
+// Construction
+public:
+ CSubresyncDlg(CString fn, CWnd* pParent = NULL); // standard constructor
+ virtual ~CSubresyncDlg();
+
+ bool Open(CString fn, int CharSet = DEFAULT_CHARSET, bool fAppend = false, int timeoff = 0);
+ bool Save(CString fn, exttype et, CTextFile::enc e, bool fClearImgLetterDb = false, bool fOcrDll = false);
+
+// Dialog Data
+ enum { IDD = IDD_SUBRESYNC_DIALOG };
+ CListCtrl m_list;
+ CButton m_saveasbtn;
+ CButton m_resetbtn;
+ CButton m_editbtn;
+ CButton m_exitbtn;
+ BOOL m_fRender;
+ CButton m_previewchk;
+ BOOL m_fUnlink;
+ CButton m_unlinkchk;
+ CComboBox m_vslangs;
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+
+// Implementation
+protected:
+ HICON m_hIcon;
+
+ // Generated message map functions
+ virtual BOOL OnInitDialog();
+ afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/src/apps/vsconv/Resource.h b/src/apps/vsconv/Resource.h
new file mode 100644
index 000000000..37f0b1669
--- /dev/null
+++ b/src/apps/vsconv/Resource.h
@@ -0,0 +1,20 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by vsconv.rc
+//
+#define IDR_MANIFEST 1
+#define IDM_ABOUTBOX 0x0010
+#define IDS_ABOUTBOX 101
+#define IDD_VSCONV_DIALOG 102
+#define IDR_MAINFRAME 128
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 129
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/apps/vsconv/res/vsconv.ico b/src/apps/vsconv/res/vsconv.ico
new file mode 100644
index 000000000..8a84ca3d3
--- /dev/null
+++ b/src/apps/vsconv/res/vsconv.ico
Binary files differ
diff --git a/src/apps/vsconv/res/vsconv.manifest b/src/apps/vsconv/res/vsconv.manifest
new file mode 100644
index 000000000..fa49fd4c2
--- /dev/null
+++ b/src/apps/vsconv/res/vsconv.manifest
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="X86"
+ name="Microsoft.Windows.vsconv"
+ type="win32"
+/>
+<description>Your app description here</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="X86"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+</assembly>
diff --git a/src/apps/vsconv/res/vsconv.rc2 b/src/apps/vsconv/res/vsconv.rc2
new file mode 100644
index 000000000..7535c79d2
--- /dev/null
+++ b/src/apps/vsconv/res/vsconv.rc2
@@ -0,0 +1,13 @@
+//
+// vsconv.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/src/apps/vsconv/stdafx.cpp b/src/apps/vsconv/stdafx.cpp
new file mode 100644
index 000000000..31cb1a3de
--- /dev/null
+++ b/src/apps/vsconv/stdafx.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// vsconv.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
diff --git a/src/apps/vsconv/stdafx.h b/src/apps/vsconv/stdafx.h
new file mode 100644
index 000000000..bae7f7d40
--- /dev/null
+++ b/src/apps/vsconv/stdafx.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+#include <afxdisp.h> // MFC Automation classes
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <dshow.h>
+#include <streams.h>
diff --git a/src/apps/vsconv/vsconv.cpp b/src/apps/vsconv/vsconv.cpp
new file mode 100644
index 000000000..576fa7bd1
--- /dev/null
+++ b/src/apps/vsconv/vsconv.cpp
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// vsconv.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "vsconv.h"
+#include "vsconvDlg.h"
+#include "..\..\subtitles\VobSubFile.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CvsconvApp
+
+BEGIN_MESSAGE_MAP(CvsconvApp, CWinApp)
+ ON_COMMAND(ID_HELP, CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CvsconvApp construction
+
+CvsconvApp::CvsconvApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+
+// The one and only CvsconvApp object
+
+CvsconvApp theApp;
+
+
+// CvsconvApp initialization
+
+BOOL CvsconvApp::InitInstance()
+{
+ // InitCommonControls() is required on Windows XP if an application
+ // manifest specifies use of ComCtl32.dll version 6 or later to enable
+ // visual styles. Otherwise, any window creation will fail.
+ InitCommonControls();
+
+ CWinApp::InitInstance();
+
+ AfxEnableControlContainer();
+
+ // TODO
+// if(__argc > 1)
+ {
+ CString in, out;
+ CVobSubFile::SubFormat sf = CVobSubFile::None;
+ int iLang = -1;
+ bool fIgnoreForcedOnly = false;
+ bool fForcedOnly = false;
+
+ try
+ {
+ for(int i = 1; i < __argc; i++)
+ {
+ if(__targv[i][0] == '-' || __targv[i][0] == '/')
+ {
+ CString sw(&__targv[i][1]);
+
+ if(sw == _T("f"))
+ {
+ if(++i < __argc && __targv[i][0] != '-' && __targv[i][0] != '/')
+ {
+ CString fmt = CString(__targv[i]).MakeLower();
+
+ if(fmt == _T("winsubmux"))
+ sf = CVobSubFile::WinSubMux;
+ else if(fmt == _T("scenarist"))
+ sf = CVobSubFile::Scenarist;
+ else if(fmt == _T("maestro"))
+ sf = CVobSubFile::Maestro;
+ else
+ throw _T("Unrecognized conversion format");
+ }
+ else
+ throw _T("No conversion format given");
+ }
+ else if(sw == _T("i"))
+ {
+ if(++i < __argc && __targv[i][0] != '-' && __targv[i][0] != '/')
+ in = __targv[i];
+ else
+ throw _T("Missing input file");
+ }
+ else if(sw == _T("o"))
+ {
+ if(++i < __argc && __targv[i][0] != '-' && __targv[i][0] != '/')
+ out = __targv[i];
+ else
+ throw _T("Missing output file");
+ }
+ else if(sw == _T("id"))
+ {
+ if(++i < __argc && __targv[i][0] != '-' && __targv[i][0] != '/')
+ iLang = _tcstol(__targv[i], NULL, 10);
+ else
+ throw _T("Missing stream id");
+ }
+ else if(sw == _T("ignoreforcedonly"))
+ {
+ fIgnoreForcedOnly = true;
+ }
+ else if(sw == _T("forcedonly"))
+ {
+ fForcedOnly = true;
+ }
+ }
+ }
+
+ if(!in.IsEmpty() && !out.IsEmpty() && sf != CVobSubFile::None)
+ {
+ CVobSubFile vsf(NULL);
+
+ if(!vsf.Open(in))
+ throw _T("Can't open input");
+
+ if(iLang >= 0 && iLang < 32)
+ vsf.m_iLang = iLang;
+
+ if(fForcedOnly)
+ vsf.m_fOnlyShowForcedSubs = true;
+
+ if(fIgnoreForcedOnly)
+ vsf.m_fOnlyShowForcedSubs = false;
+
+ if(!vsf.Save(out, sf))
+ throw _T("Can't save output");
+
+ return FALSE;
+ }
+ }
+ catch(LPCTSTR msg)
+ {
+ AfxMessageBox(CString(_T("Error: ")) + msg);
+ }
+
+ AfxMessageBox(
+ _T("Usage: vsconv.exe <switches>\n\n")
+ _T("-f \"format\" (winsubmux, scenarist, maestro)\n")
+ _T("-i \"input\"\n")
+ _T("-o \"output\"\n")
+ _T("-id 0-31 (optional)\n")
+ _T("-ignoreforcedonly (optional)\n")
+ _T("-forcedonly (optional)\n")
+ );
+
+ return FALSE;
+ }
+
+ // TODO
+ return FALSE;
+
+
+ CvsconvDlg dlg;
+ m_pMainWnd = &dlg;
+ INT_PTR nResponse = dlg.DoModal();
+ if (nResponse == IDOK)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with OK
+ }
+ else if (nResponse == IDCANCEL)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with Cancel
+ }
+
+ // Since the dialog has been closed, return FALSE so that we exit the
+ // application, rather than start the application's message pump.
+ return FALSE;
+}
diff --git a/src/apps/vsconv/vsconv.h b/src/apps/vsconv/vsconv.h
new file mode 100644
index 000000000..a3e44f2e4
--- /dev/null
+++ b/src/apps/vsconv/vsconv.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// vsconv.h : main header file for the PROJECT_NAME application
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+
+// CvsconvApp:
+// See vsconv.cpp for the implementation of this class
+//
+
+class CvsconvApp : public CWinApp
+{
+public:
+ CvsconvApp();
+
+// Overrides
+ public:
+ virtual BOOL InitInstance();
+
+// Implementation
+
+ DECLARE_MESSAGE_MAP()
+};
+
+extern CvsconvApp theApp; \ No newline at end of file
diff --git a/src/apps/vsconv/vsconv.rc b/src/apps/vsconv/vsconv.rc
new file mode 100644
index 000000000..9aa9e4364
--- /dev/null
+++ b/src/apps/vsconv/vsconv.rc
@@ -0,0 +1,199 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\vsconv.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\vsconv.ico"
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_VSCONV_DIALOG DIALOGEX 0, 0, 320, 200
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP |
+ WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+EXSTYLE WS_EX_APPWINDOW
+CAPTION "vsconv"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,263,7,50,16
+ PUSHBUTTON "Cancel",IDCANCEL,263,25,50,16
+ CTEXT "TODO: Place dialog controls here.",IDC_STATIC,10,96,300,
+ 8
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,6
+ PRODUCTVERSION 1,0,0,6
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "VobSub subtitle format converter"
+ VALUE "FileVersion", "1, 0, 0, 6"
+ VALUE "InternalName", "vsconv.exe"
+ VALUE "LegalCopyright", "2003-2004 (c) Gabest. All rights reserved."
+ VALUE "OriginalFilename", "vsconv.exe"
+ VALUE "ProductName", "VSConv"
+ VALUE "ProductVersion", "1, 0, 0, 6"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_VSCONV_DIALOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 313
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 193
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// RT_MANIFEST
+//
+
+IDR_MANIFEST RT_MANIFEST "res\\vsconv.manifest"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_ABOUTBOX "&About vsconv..."
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\vsconv.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/apps/vsconv/vsconv.sln b/src/apps/vsconv/vsconv.sln
new file mode 100644
index 000000000..dc09b6934
--- /dev/null
+++ b/src/apps/vsconv/vsconv.sln
@@ -0,0 +1,40 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vsconv", "vsconv.vcproj", "{F655A8A5-A73E-4EE0-89B4-2758055B3768}"
+ ProjectSection(ProjectDependencies) = postProject
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitles", "..\..\subtitles\subtitles.vcproj", "{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {F655A8A5-A73E-4EE0-89B4-2758055B3768}.Debug.ActiveCfg = Debug|Win32
+ {F655A8A5-A73E-4EE0-89B4-2758055B3768}.Debug.Build.0 = Debug|Win32
+ {F655A8A5-A73E-4EE0-89B4-2758055B3768}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F655A8A5-A73E-4EE0-89B4-2758055B3768}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F655A8A5-A73E-4EE0-89B4-2758055B3768}.Release.ActiveCfg = Release|Win32
+ {F655A8A5-A73E-4EE0-89B4-2758055B3768}.Release.Build.0 = Release|Win32
+ {F655A8A5-A73E-4EE0-89B4-2758055B3768}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F655A8A5-A73E-4EE0-89B4-2758055B3768}.Release Unicode.Build.0 = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.Build.0 = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/apps/vsconv/vsconv.vcproj b/src/apps/vsconv/vsconv.vcproj
new file mode 100644
index 000000000..3dd70d035
--- /dev/null
+++ b/src/apps/vsconv/vsconv.vcproj
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="vsconv"
+ ProjectGUID="{F655A8A5-A73E-4EE0-89B4-2758055B3768}"
+ Keyword="MFCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="subtitlesD.lib subpicD.lib strmbaseD.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="../../../lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+ StringPooling="TRUE"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="subtitlesR.lib subpicR.lib strmbaseR.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\bin\upx.exe --best --compress-icons=0 &quot;$(TargetPath)&quot;"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="subtitlesDU.lib subpicDU.lib strmbaseDU.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="../../../lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+ StringPooling="TRUE"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="subtitlesRU.lib subpicRU.lib strmbaseRU.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\bin\upx.exe --best --compress-icons=0 &quot;$(TargetPath)&quot;"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="vsconv.cpp">
+ </File>
+ <File
+ RelativePath="vsconvDlg.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="Resource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="vsconv.h">
+ </File>
+ <File
+ RelativePath="vsconvDlg.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest">
+ <File
+ RelativePath="res\vsconv.ico">
+ </File>
+ <File
+ RelativePath="res\vsconv.manifest">
+ </File>
+ <File
+ RelativePath="vsconv.rc">
+ </File>
+ <File
+ RelativePath="res\vsconv.rc2">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/apps/vsconv/vsconvDlg.cpp b/src/apps/vsconv/vsconvDlg.cpp
new file mode 100644
index 000000000..31d3348a6
--- /dev/null
+++ b/src/apps/vsconv/vsconvDlg.cpp
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// vsconvDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "vsconv.h"
+#include "vsconvDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CAboutDlg dialog used for App About
+
+class CAboutDlg : public CDialog
+{
+public:
+ CAboutDlg();
+
+// Dialog Data
+ enum { IDD = IDD_ABOUTBOX };
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+// Implementation
+protected:
+ DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+END_MESSAGE_MAP()
+
+
+// CvsconvDlg dialog
+
+
+
+CvsconvDlg::CvsconvDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CvsconvDlg::IDD, pParent)
+{
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+}
+
+void CvsconvDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CvsconvDlg, CDialog)
+ ON_WM_SYSCOMMAND()
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+// CvsconvDlg message handlers
+
+BOOL CvsconvDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // Add "About..." menu item to system menu.
+
+ // IDM_ABOUTBOX must be in the system command range.
+ ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+ ASSERT(IDM_ABOUTBOX < 0xF000);
+
+ CMenu* pSysMenu = GetSystemMenu(FALSE);
+ if (pSysMenu != NULL)
+ {
+ CString strAboutMenu;
+ strAboutMenu.LoadString(IDS_ABOUTBOX);
+ if (!strAboutMenu.IsEmpty())
+ {
+ pSysMenu->AppendMenu(MF_SEPARATOR);
+ pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+ }
+ }
+
+ // Set the icon for this dialog. The framework does this automatically
+ // when the application's main window is not a dialog
+ SetIcon(m_hIcon, TRUE); // Set big icon
+ SetIcon(m_hIcon, FALSE); // Set small icon
+
+ // TODO: Add extra initialization here
+
+ return TRUE; // return TRUE unless you set the focus to a control
+}
+
+void CvsconvDlg::OnSysCommand(UINT nID, LPARAM lParam)
+{
+ if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+ {
+ CAboutDlg dlgAbout;
+ dlgAbout.DoModal();
+ }
+ else
+ {
+ CDialog::OnSysCommand(nID, lParam);
+ }
+}
+
+// If you add a minimize button to your dialog, you will need the code below
+// to draw the icon. For MFC applications using the document/view model,
+// this is automatically done for you by the framework.
+
+void CvsconvDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // device context for painting
+
+ SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
+
+ // Center icon in client rectangle
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // Draw the icon
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ CDialog::OnPaint();
+ }
+}
+
+// The system calls this function to obtain the cursor to display while the user drags
+// the minimized window.
+HCURSOR CvsconvDlg::OnQueryDragIcon()
+{
+ return static_cast<HCURSOR>(m_hIcon);
+}
diff --git a/src/apps/vsconv/vsconvDlg.h b/src/apps/vsconv/vsconvDlg.h
new file mode 100644
index 000000000..07326405b
--- /dev/null
+++ b/src/apps/vsconv/vsconvDlg.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// vsconvDlg.h : header file
+//
+
+#pragma once
+
+
+// CvsconvDlg dialog
+class CvsconvDlg : public CDialog
+{
+// Construction
+public:
+ CvsconvDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ enum { IDD = IDD_VSCONV_DIALOG };
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+
+// Implementation
+protected:
+ HICON m_hIcon;
+
+ // Generated message map functions
+ virtual BOOL OnInitDialog();
+ afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/src/apps/vsrip/VSRip.cpp b/src/apps/vsrip/VSRip.cpp
new file mode 100644
index 000000000..8aee5088b
--- /dev/null
+++ b/src/apps/vsrip/VSRip.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// VSRip.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "VSRip.h"
+#include "VSRipDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CVSRipApp
+
+BEGIN_MESSAGE_MAP(CVSRipApp, CWinApp)
+ ON_COMMAND(ID_HELP, CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CVSRipApp construction
+
+CVSRipApp::CVSRipApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+
+// The one and only CVSRipApp object
+
+CVSRipApp theApp;
+
+// CVSRipApp initialization
+
+BOOL CVSRipApp::InitInstance()
+{
+ // InitCommonControls() is required on Windows XP if an application
+ // manifest specifies use of ComCtl32.dll version 6 or later to enable
+ // visual styles. Otherwise, any window creation will fail.
+ InitCommonControls();
+
+ CWinApp::InitInstance();
+
+ CVSRipDlg dlg;
+ m_pMainWnd = &dlg;
+ INT_PTR nResponse = dlg.DoModal();
+ if (nResponse == IDOK)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with OK
+ }
+ else if (nResponse == IDCANCEL)
+ {
+ // TODO: Place code here to handle when the dialog is
+ // dismissed with Cancel
+ }
+
+ // Since the dialog has been closed, return FALSE so that we exit the
+ // application, rather than start the application's message pump.
+ return FALSE;
+}
diff --git a/src/apps/vsrip/VSRip.h b/src/apps/vsrip/VSRip.h
new file mode 100644
index 000000000..05a38411e
--- /dev/null
+++ b/src/apps/vsrip/VSRip.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// VSRip.h : main header file for the PROJECT_NAME application
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+
+// CVSRipApp:
+// See VSRip.cpp for the implementation of this class
+//
+
+class CVSRipApp : public CWinApp
+{
+public:
+ CVSRipApp();
+
+// Overrides
+ public:
+ virtual BOOL InitInstance();
+
+// Implementation
+
+ DECLARE_MESSAGE_MAP()
+};
+
+extern CVSRipApp theApp; \ No newline at end of file
diff --git a/src/apps/vsrip/VSRip.rc b/src/apps/vsrip/VSRip.rc
new file mode 100644
index 000000000..51202daf1
--- /dev/null
+++ b/src/apps/vsrip/VSRip.rc
@@ -0,0 +1,263 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#include ""res\\VSRip.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\VSRip.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_VSRIP_DIALOG DIALOGEX 0, 0, 320, 201
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE |
+ WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_TOOLWINDOW | WS_EX_APPWINDOW
+CAPTION "VobSub Ripper Wizard"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ PUSHBUTTON "&Cancel",IDCANCEL,260,177,50,14
+ PUSHBUTTON "< &Back",IDC_BUTTON1,145,177,50,14
+ PUSHBUTTON "&Next >",IDC_BUTTON2,196,177,50,14
+ CONTROL "",IDC_HEADERSEP,"Static",SS_ETCHEDHORZ,0,35,319,1
+ CONTROL "",IDC_DLGRECT,"Static",SS_BLACKFRAME | NOT WS_VISIBLE,6,
+ 40,307,120
+ CONTROL "",IDC_FOOTERSEP,"Static",SS_ETCHEDHORZ,0,166,319,1
+END
+
+IDD_DIALOG_FILE DIALOGEX 0, 0, 307, 120
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_EDIT1,2,2,249,13,ES_AUTOHSCROLL | ES_READONLY
+ PUSHBUTTON "&Load IFO...",IDC_BUTTON1,255,2,50,13
+ EDITTEXT IDC_EDIT2,2,17,249,13,ES_AUTOHSCROLL | ES_READONLY
+ PUSHBUTTON "&Save To...",IDC_BUTTON2,255,17,50,13
+ EDITTEXT IDC_EDIT3,2,37,303,82,ES_MULTILINE | ES_AUTOHSCROLL |
+ ES_READONLY | WS_VSCROLL
+END
+
+IDD_DIALOG_PGC DIALOGEX 0, 0, 307, 120
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ LISTBOX IDC_LIST1,0,12,54,107,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
+ WS_TABSTOP
+ LISTBOX IDC_LIST2,128,12,64,107,LBS_NOINTEGRALHEIGHT |
+ WS_VSCROLL | WS_TABSTOP
+ LTEXT "Program Chains:",IDC_STATIC,0,2,54,8
+ LTEXT "Angles:",IDC_STATIC,128,2,25,8
+ LISTBOX IDC_LIST3,196,12,47,107,LBS_NOINTEGRALHEIGHT |
+ LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Vob/Cell IDs:",IDC_STATIC,196,2,42,8
+ LISTBOX IDC_LIST4,57,12,67,107,LBS_NOINTEGRALHEIGHT |
+ LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Languages:",IDC_STATIC,57,2,38,8
+ CONTROL "Reset time at the first selected cell",IDC_CHECK1,
+ "Button",BS_AUTOCHECKBOX | BS_VCENTER | BS_MULTILINE |
+ WS_TABSTOP,248,12,59,27
+ CONTROL "Extract closed caption",IDC_CHECK2,"Button",
+ BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,248,52,59,18
+ CONTROL "Forced subtitles only",IDC_CHECK3,"Button",
+ BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,248,83,59,18
+END
+
+IDD_DIALOG_INDEXING DIALOGEX 0, 0, 307, 120
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ CONTROL "",IDC_PROGRESS1,"msctls_progress32",WS_BORDER,0,2,252,
+ 14
+ PUSHBUTTON "&Start",IDC_BUTTON1,257,1,50,14
+ CONTROL "Close dialog",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
+ WS_TABSTOP,122,110,52,10
+ LTEXT "After a successful rip:",IDC_STATIC,0,110,71,8
+ CONTROL "Beep",IDC_CHECK2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+ 82,110,29,10
+ EDITTEXT IDC_EDIT1,0,20,307,83,ES_MULTILINE | ES_AUTOHSCROLL |
+ ES_READONLY | WS_VSCROLL
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,6
+ PRODUCTVERSION 1,0,0,6
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "Comments", "Visit http://gabest.org/ for updates"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "VobSub Subtitle Ripper Wizard"
+ VALUE "FileVersion", "1, 0, 0, 6"
+ VALUE "InternalName", "VSRip.exe"
+ VALUE "LegalCopyright", "2003-2004 (c) Gabest. All rights reserved."
+ VALUE "OriginalFilename", "VSRip.exe"
+ VALUE "ProductName", "VSRip"
+ VALUE "ProductVersion", "1, 0, 0, 6"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_VSRIP_DIALOG, DIALOG
+ BEGIN
+ BOTTOMMARGIN, 200
+ HORZGUIDE, 184
+ END
+
+ IDD_DIALOG_FILE, DIALOG
+ BEGIN
+ VERTGUIDE, 2
+ VERTGUIDE, 305
+ HORZGUIDE, 2
+ HORZGUIDE, 15
+ HORZGUIDE, 17
+ HORZGUIDE, 30
+ END
+
+ IDD_DIALOG_PGC, DIALOG
+ BEGIN
+ VERTGUIDE, 57
+ VERTGUIDE, 128
+ VERTGUIDE, 196
+ VERTGUIDE, 248
+ HORZGUIDE, 2
+ HORZGUIDE, 12
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// RT_MANIFEST
+//
+
+IDR_MANIFEST RT_MANIFEST "res\\VSRip.manifest"
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#include "res\VSRip.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/apps/vsrip/VSRip.sln b/src/apps/vsrip/VSRip.sln
new file mode 100644
index 000000000..b54ca4e4e
--- /dev/null
+++ b/src/apps/vsrip/VSRip.sln
@@ -0,0 +1,53 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VSRip", "VSRip.vcproj", "{E6B555EF-515E-47B6-A78A-98973397CF93}"
+ ProjectSection(ProjectDependencies) = postProject
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575} = {1A2DFD1A-3C6C-44D1-909D-294AF646B575}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decss", "..\..\decss\decss.vcproj", "{1A2DFD1A-3C6C-44D1-909D-294AF646B575}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitles", "..\..\subtitles\subtitles.vcproj", "{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {E6B555EF-515E-47B6-A78A-98973397CF93}.Debug.ActiveCfg = Debug|Win32
+ {E6B555EF-515E-47B6-A78A-98973397CF93}.Debug.Build.0 = Debug|Win32
+ {E6B555EF-515E-47B6-A78A-98973397CF93}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {E6B555EF-515E-47B6-A78A-98973397CF93}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {E6B555EF-515E-47B6-A78A-98973397CF93}.Release.ActiveCfg = Release|Win32
+ {E6B555EF-515E-47B6-A78A-98973397CF93}.Release.Build.0 = Release|Win32
+ {E6B555EF-515E-47B6-A78A-98973397CF93}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {E6B555EF-515E-47B6-A78A-98973397CF93}.Release Unicode.Build.0 = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.ActiveCfg = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.Build.0 = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.ActiveCfg = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.Build.0 = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.Build.0 = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.Build.0 = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/apps/vsrip/VSRip.vcproj b/src/apps/vsrip/VSRip.vcproj
new file mode 100644
index 000000000..c1fc6e539
--- /dev/null
+++ b/src/apps/vsrip/VSRip.vcproj
@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="VSRip"
+ ProjectGUID="{E6B555EF-515E-47B6-A78A-98973397CF93}"
+ Keyword="MFCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="decssD.lib strmbaseD.lib subtitlesD.lib subpicD.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="../../../lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+ StringPooling="TRUE"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="delayimp.lib decssR.lib strmbaseR.lib subtitlesR.lib subpicR.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../lib"
+ DelayLoadDLLs="oleacc.dll"
+ GenerateDebugInformation="TRUE"
+ GenerateMapFile="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\bin\upx.exe --best --compress-icons=0 &quot;$(TargetPath)&quot;"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="1"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="decssDU.lib strmbaseDU.lib subtitlesDU.lib subpicDU.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="../../../lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="1"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
+ StringPooling="TRUE"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ TreatWChar_tAsBuiltInType="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="delayimp.lib decssRU.lib strmbaseRU.lib subtitlesRU.lib subpicRU.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../lib"
+ DelayLoadDLLs="oleacc.dll"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="FALSE"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\bin\upx.exe --best --compress-icons=0 &quot;$(TargetPath)&quot;"
+ ExcludedFromBuild="TRUE"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ AdditionalIncludeDirectories="$(IntDir)"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="VSRip.cpp">
+ </File>
+ <File
+ RelativePath="VSRipDlg.cpp">
+ </File>
+ <File
+ RelativePath="VSRipFileDlg.cpp">
+ </File>
+ <File
+ RelativePath="VSRipIndexingDlg.cpp">
+ </File>
+ <File
+ RelativePath="VSRipPage.cpp">
+ </File>
+ <File
+ RelativePath="VSRipPGCDlg.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="Resource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="VSRip.h">
+ </File>
+ <File
+ RelativePath="VSRipDlg.h">
+ </File>
+ <File
+ RelativePath="VSRipFileDlg.h">
+ </File>
+ <File
+ RelativePath="VSRipIndexingDlg.h">
+ </File>
+ <File
+ RelativePath="VSRipPage.h">
+ </File>
+ <File
+ RelativePath="VSRipPGCDlg.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;manifest">
+ <File
+ RelativePath="res\VSRip.ico">
+ </File>
+ <File
+ RelativePath="res\VSRip.manifest">
+ </File>
+ <File
+ RelativePath="VSRip.rc">
+ </File>
+ <File
+ RelativePath="res\VSRip.rc2">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/apps/vsrip/VSRipDlg.cpp b/src/apps/vsrip/VSRipDlg.cpp
new file mode 100644
index 000000000..91680d301
--- /dev/null
+++ b/src/apps/vsrip/VSRipDlg.cpp
@@ -0,0 +1,312 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// VSRipDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <afxpriv.h>
+#include "VSRip.h"
+#include "VSRipDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CVSRipDlg dialog
+
+CVSRipDlg::CVSRipDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CVSRipDlg::IDD, pParent)
+{
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+ m_dlgpos = NULL;
+
+ m_pVSFRipper = new CVobSubFileRipper();
+}
+
+CVSRipDlg::~CVSRipDlg()
+{
+ m_pVSFRipper->SetCallBack(NULL);
+}
+
+void CVSRipDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_DLGRECT, m_dlgrect);
+ DDX_Control(pDX, IDC_HEADERSEP, m_hdrline);
+ DDX_Control(pDX, IDC_FOOTERSEP, m_ftrline);
+}
+
+void CVSRipDlg::ShowNext()
+{
+ POSITION prev = m_dlgpos;
+ m_dlgpos = GetNext();
+
+ if(prev && prev != m_dlgpos)
+ {
+ m_dlgs.GetAt(prev)->OnNext();
+ m_dlgs.GetAt(prev)->ShowWindow(SW_HIDE);
+ }
+
+ if(m_dlgpos)
+ {
+ CVSRipPage* pDlg = m_dlgs.GetAt(m_dlgpos);
+ CRect dr;
+ m_dlgrect.GetClientRect(dr);
+ m_dlgrect.MapWindowPoints(this, dr);
+ pDlg->MoveWindow(dr);
+ pDlg->ShowWindow(SW_SHOWNORMAL);
+ Invalidate();
+ }
+}
+
+void CVSRipDlg::ShowPrev()
+{
+ POSITION next = m_dlgpos;
+ m_dlgpos = GetPrev();
+
+ if(next && next != m_dlgpos)
+ {
+ m_dlgs.GetAt(next)->OnPrev();
+ m_dlgs.GetAt(next)->ShowWindow(SW_HIDE);
+ }
+
+ if(m_dlgpos)
+ {
+ CVSRipPage* pDlg = m_dlgs.GetAt(m_dlgpos);
+ CRect dr;
+ m_dlgrect.GetClientRect(dr);
+ m_dlgrect.MapWindowPoints(this, dr);
+ pDlg->MoveWindow(dr);
+ pDlg->ShowWindow(SW_SHOWNORMAL);
+ Invalidate();
+ }
+}
+
+POSITION CVSRipDlg::GetNext()
+{
+ POSITION pos = m_dlgpos;
+ if(pos && m_dlgs.GetAt(pos)->CanGoNext()) m_dlgs.GetNext(pos);
+ else if(pos && !m_dlgs.GetAt(pos)->CanGoNext()) pos = NULL;
+ else pos = m_dlgs.GetHeadPosition();
+ return(pos);
+}
+
+POSITION CVSRipDlg::GetPrev()
+{
+ POSITION pos = m_dlgpos;
+ if(pos && m_dlgs.GetAt(pos)->CanGoPrev()) m_dlgs.GetPrev(pos);
+ else if(pos && !m_dlgs.GetAt(pos)->CanGoPrev()) pos = NULL;
+ else pos = m_dlgs.GetTailPosition();
+ return(pos);
+}
+
+BEGIN_MESSAGE_MAP(CVSRipDlg, CDialog)
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
+ ON_BN_CLICKED(IDC_BUTTON1, OnPrev)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdatePrev)
+ ON_BN_CLICKED(IDC_BUTTON2, OnNext)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON2, OnUpdateNext)
+ ON_BN_CLICKED(IDCANCEL, OnClose)
+ ON_UPDATE_COMMAND_UI(IDCANCEL, OnUpdateClose)
+END_MESSAGE_MAP()
+
+// CVSRipDlg message handlers
+
+BOOL CVSRipDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // Set the icon for this dialog. The framework does this automatically
+ // when the application's main window is not a dialog
+ SetIcon(m_hIcon, TRUE); // Set big icon
+ SetIcon(m_hIcon, FALSE); // Set small icon
+
+ if(CMenu* pSysMenu = GetSystemMenu(FALSE))
+ {
+ pSysMenu->RemoveMenu(SC_SIZE, MF_BYCOMMAND);
+ pSysMenu->RemoveMenu(SC_MAXIMIZE, MF_BYCOMMAND);
+ }
+
+ CRect cr;
+ GetClientRect(cr);
+ CRect r;
+ m_hdrline.GetClientRect(r);
+ m_hdrline.MapWindowPoints(this, r);
+ r.left = 0;
+ r.right = cr.right;
+ r.bottom+=2;
+ m_hdrline.MoveWindow(r);
+ m_ftrline.GetClientRect(r);
+ m_ftrline.MapWindowPoints(this, r);
+ r.left = 0;
+ r.right = cr.right;
+ r.bottom+=2;
+ m_ftrline.MoveWindow(r);
+
+ m_pVSFRipper = new CVobSubFileRipper();
+
+ CAutoPtr<CVSRipPage> pPage;
+
+ pPage.Attach(new CVSRipFileDlg(m_pVSFRipper));
+ pPage->Create(CVSRipFileDlg::IDD, this);
+ m_dlgs.AddTail(pPage);
+
+ pPage.Attach(new CVSRipPGCDlg(m_pVSFRipper));
+ pPage->Create(CVSRipPGCDlg::IDD, this);
+ m_dlgs.AddTail(pPage);
+
+ pPage.Attach(new CVSRipIndexingDlg(m_pVSFRipper));
+ pPage->Create(CVSRipIndexingDlg::IDD, this);
+ m_dlgs.AddTail(pPage);
+
+ if(__argc > 1)
+ {
+ m_pVSFRipper->SetCallBack((IVSFRipperCallback*)m_dlgs.GetTail());
+
+ if(S_OK != m_pVSFRipper->LoadParamFile(CString(__targv[1])))
+ {
+ AfxMessageBox(_T("Error parsing parameter file!"), MB_OK);
+ EndDialog(IDCANCEL);
+ return FALSE;
+ }
+
+ ShowPrev();
+ }
+ else
+ {
+ ShowNext();
+ }
+
+ return TRUE; // return TRUE unless you set the focus to a control
+}
+
+// If you add a minimize button to your dialog, you will need the code below
+// to draw the icon. For MFC applications using the document/view model,
+// this is automatically done for you by the framework.
+
+void CVSRipDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // device context for painting
+
+ SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
+
+ // Center icon in client rectangle
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // Draw the icon
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ CPaintDC dc(this); // device context for painting
+
+ CWnd* pHdrSep = GetDlgItem(IDC_HEADERSEP);
+ CRect r;
+ m_hdrline.GetClientRect(r);
+ m_hdrline.MapWindowPoints(this, r);
+ CRect cr;
+ GetClientRect(cr);
+ dc.FillSolidRect(CRect(0,0,cr.right,r.top), 0xffffff);
+
+ if(m_dlgpos)
+ {
+ CVSRipPage* pWnd = m_dlgs.GetAt(m_dlgpos);
+ CFont hdrfont, descfont;
+ hdrfont.CreateFont(16,0,0,0,FW_BOLD,0,0,0,DEFAULT_CHARSET,
+ OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,DEFAULT_PITCH,
+ _T("Times New Roman"));
+ descfont.CreateFont(14,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,
+ OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,DEFAULT_PITCH,
+ _T("Arial"));
+ CFont* pOld = dc.SelectObject(&hdrfont);
+ dc.DrawText(pWnd->GetHeaderText(), CRect(10,5,cr.right,r.top), DT_WORDBREAK);
+ dc.SelectObject(&descfont);
+ dc.DrawText(pWnd->GetDescText(), CRect(20,22,cr.right,r.top), DT_WORDBREAK);
+ dc.SelectObject(pOld);
+ }
+
+ CDialog::OnPaint();
+ }
+}
+
+void CVSRipDlg::OnKickIdle()
+{
+ UpdateDialogControls(this, false);
+
+ for(CWnd* pChild = GetWindow(GW_CHILD); pChild; pChild = pChild->GetNextWindow())
+ {
+ if(pChild->IsKindOf(RUNTIME_CLASS(CVSRipPage)))
+ pChild->UpdateDialogControls(pChild, false);
+ }
+}
+
+// The system calls this function to obtain the cursor to display while the user drags
+// the minimized window.
+HCURSOR CVSRipDlg::OnQueryDragIcon()
+{
+ return static_cast<HCURSOR>(m_hIcon);
+}
+
+void CVSRipDlg::OnPrev()
+{
+ ShowPrev();
+}
+
+void CVSRipDlg::OnUpdatePrev(CCmdUI* pCmdUI)
+{
+ if(m_dlgpos) pCmdUI->SetText(m_dlgs.GetAt(m_dlgpos)->GetPrevText());
+ pCmdUI->Enable(!!GetPrev());
+}
+
+void CVSRipDlg::OnNext()
+{
+ ShowNext();
+}
+
+void CVSRipDlg::OnUpdateNext(CCmdUI* pCmdUI)
+{
+ if(m_dlgpos) pCmdUI->SetText(m_dlgs.GetAt(m_dlgpos)->GetNextText());
+ pCmdUI->Enable(!!GetNext());
+}
+
+void CVSRipDlg::OnClose()
+{
+ if(m_dlgpos) m_dlgs.GetAt(m_dlgpos)->OnClose();
+
+ OnCancel();
+}
+
+void CVSRipDlg::OnUpdateClose(CCmdUI* pCmdUI)
+{
+ if(m_dlgpos) pCmdUI->SetText(m_dlgs.GetAt(m_dlgpos)->GetCloseText());
+ pCmdUI->Enable(!m_dlgpos || m_dlgs.GetAt(m_dlgpos)->CanClose());
+}
diff --git a/src/apps/vsrip/VSRipDlg.h b/src/apps/vsrip/VSRipDlg.h
new file mode 100644
index 000000000..9e6067e45
--- /dev/null
+++ b/src/apps/vsrip/VSRipDlg.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "VSRipFileDlg.h"
+#include "VSRipPGCDlg.h"
+#include "VSRipIndexingDlg.h"
+
+// CVSRipDlg dialog
+class CVSRipDlg : public CDialog
+{
+// Construction
+public:
+ CVSRipDlg(CWnd* pParent = NULL); // standard constructor
+ virtual ~CVSRipDlg();
+
+// Dialog Data
+ enum { IDD = IDD_VSRIP_DIALOG };
+
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+
+// Implementation
+protected:
+ HICON m_hIcon;
+
+ CStatic m_dlgrect;
+ CStatic m_hdrline;
+
+ CAutoPtrList<CVSRipPage> m_dlgs;
+ POSITION m_dlgpos;
+ void ShowNext(), ShowPrev();
+ POSITION GetNext(), GetPrev();
+
+ CComPtr<IVSFRipper> m_pVSFRipper;
+
+ // Generated message map functions
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnPaint();
+ afx_msg void OnKickIdle();
+ afx_msg HCURSOR OnQueryDragIcon();
+ afx_msg void OnPrev();
+ afx_msg void OnUpdatePrev(CCmdUI* pCmdUI);
+ afx_msg void OnNext();
+ afx_msg void OnUpdateNext(CCmdUI* pCmdUI);
+ afx_msg void OnClose();
+ afx_msg void OnUpdateClose(CCmdUI* pCmdUI);
+ CStatic m_ftrline;
+};
diff --git a/src/apps/vsrip/VSRipFileDlg.cpp b/src/apps/vsrip/VSRipFileDlg.cpp
new file mode 100644
index 000000000..6ae7e0afc
--- /dev/null
+++ b/src/apps/vsrip/VSRipFileDlg.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// VSRipFileDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "VSRip.h"
+#include <atlcoll.h>
+#include "..\..\..\include\winddk\devioctl.h"
+#include "..\..\..\include\winddk\ntddcdrm.h"
+#include "VSRipFileDlg.h"
+
+
+// CVSRipFileDlg dialog
+
+IMPLEMENT_DYNAMIC(CVSRipFileDlg, CVSRipPage)
+CVSRipFileDlg::CVSRipFileDlg(IVSFRipper* pVSFRipper, CWnd* pParent /*=NULL*/)
+ : CVSRipPage(pVSFRipper, CVSRipFileDlg::IDD, pParent)
+{
+}
+
+CVSRipFileDlg::~CVSRipFileDlg()
+{
+}
+
+void CVSRipFileDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CVSRipPage::DoDataExchange(pDX);
+ DDX_Text(pDX, IDC_EDIT1, m_infn);
+ DDX_Text(pDX, IDC_EDIT2, m_outfn);
+ DDX_Control(pDX, IDC_EDIT3, m_log);
+}
+
+BEGIN_MESSAGE_MAP(CVSRipFileDlg, CVSRipPage)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
+END_MESSAGE_MAP()
+
+STDMETHODIMP CVSRipFileDlg::OnMessage(LPCTSTR msg)
+{
+ if(CEdit* pLog = (CEdit*)CEdit::FromHandle(m_log.m_hWnd))
+ {
+ CString str = msg;
+ str += _T("\r\n");
+ int len = pLog->GetWindowTextLength();
+ pLog->SetSel(len, len);
+ pLog->ReplaceSel(str);
+ }
+
+ return S_OK;
+}
+
+// CVSRipFileDlg message handlers
+
+void CVSRipFileDlg::OnBnClickedButton1()
+{
+ CFileDialog fd(TRUE, NULL, NULL,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_PATHMUSTEXIST,
+ _T("Video Title Set IFO file (*.ifo)|*.ifo|"), this, 0);
+
+ if(fd.DoModal() == IDOK)
+ {
+ m_log.SetWindowText(_T(""));
+ m_log.SetMargins(0, 0);
+
+ CString fn = fd.GetPathName();
+ if(FAILED(m_pVSFRipper->SetInput(fn))) fn.Empty();
+ m_infn = fn;
+
+ UpdateData(FALSE);
+ }
+
+}
+
+void CVSRipFileDlg::OnBnClickedButton2()
+{
+ CString fn = m_infn.Mid(m_infn.ReverseFind('\\')+1);
+ int i = fn.ReverseFind('.');
+ if(i > 0) fn = fn.Left(i);
+
+ CFileDialog fd(FALSE, NULL, fn,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,
+ _T("VobSub index file (*.idx)|*.idx|"), this, 0);
+
+ if(fd.DoModal() == IDOK)
+ {
+ CString fn = fd.GetPathName();
+ if(FAILED(m_pVSFRipper->SetOutput(fn))) fn.Empty();
+ m_outfn = fn;
+
+ UpdateData(FALSE);
+ }
+}
diff --git a/src/apps/vsrip/VSRipFileDlg.h b/src/apps/vsrip/VSRipFileDlg.h
new file mode 100644
index 000000000..15d00784e
--- /dev/null
+++ b/src/apps/vsrip/VSRipFileDlg.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include <afxwin.h>
+#include "VSRipPage.h"
+#include "afxwin.h"
+
+// CVSRipFileDlg dialog
+
+class CVSRipFileDlg : public CVSRipPage
+{
+ DECLARE_DYNAMIC(CVSRipFileDlg)
+
+protected:
+ // IVSFRipperCallback
+ STDMETHODIMP OnMessage(LPCTSTR msg);
+
+public:
+ CVSRipFileDlg(IVSFRipper* pVSFRipper, CWnd* pParent = NULL); // standard constructor
+ virtual ~CVSRipFileDlg();
+
+ virtual bool CanGoPrev() {return(false);}
+ virtual bool CanGoNext() {return(!m_infn.IsEmpty() && !m_outfn.IsEmpty());}
+ virtual CString GetHeaderText() {return(_T("Select input and output"));}
+ virtual CString GetDescText() {return(_T("First choose a video title set ifo, then select an ")
+ _T("output path for the idx/sub files. Make sure the vob files ")
+ _T("have some standard naming, this util can't read your mind."));}
+
+// Dialog Data
+ enum { IDD = IDD_DIALOG_FILE };
+ CEdit m_log;
+ CString m_infn, m_outfn;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnBnClickedButton2();
+};
diff --git a/src/apps/vsrip/VSRipIndexingDlg.cpp b/src/apps/vsrip/VSRipIndexingDlg.cpp
new file mode 100644
index 000000000..dd5983cfb
--- /dev/null
+++ b/src/apps/vsrip/VSRipIndexingDlg.cpp
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// VSRipIndexingDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <afxpriv.h>
+#include "VSRip.h"
+#include "VSRipIndexingDlg.h"
+
+// CVSRipIndexingDlg dialog
+
+IMPLEMENT_DYNAMIC(CVSRipIndexingDlg, CVSRipPage)
+CVSRipIndexingDlg::CVSRipIndexingDlg(IVSFRipper* pVSFRipper, CWnd* pParent /*=NULL*/)
+ : CVSRipPage(pVSFRipper, CVSRipIndexingDlg::IDD, pParent)
+ , m_bBeep(FALSE), m_bExit(FALSE)
+ , m_fFinished(false)
+ , m_fAuto(false)
+{
+}
+
+CVSRipIndexingDlg::~CVSRipIndexingDlg()
+{
+}
+
+void CVSRipIndexingDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CVSRipPage::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_PROGRESS1, m_progress);
+ DDX_Control(pDX, IDC_EDIT1, m_log);
+ DDX_Check(pDX, IDC_CHECK1, m_bExit);
+ DDX_Check(pDX, IDC_CHECK2, m_bBeep);
+}
+
+STDMETHODIMP CVSRipIndexingDlg::OnMessage(LPCTSTR msg)
+{
+ if(CEdit* pLog = (CEdit*)CEdit::FromHandle(m_log.m_hWnd))
+ {
+ CString str = msg;
+ str += _T("\r\n");
+ int len = pLog->GetWindowTextLength();
+ pLog->SetSel(len, len);
+ pLog->ReplaceSel(str);
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CVSRipIndexingDlg::OnProgress(double progress)
+{
+ if(CProgressCtrl* pProgress = (CProgressCtrl*)CProgressCtrl::FromHandle(m_progress.m_hWnd))
+ {
+ pProgress->SetPos((int)(progress * 100));
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CVSRipIndexingDlg::OnFinished(bool fSucceeded)
+{
+ m_fFinished = fSucceeded;
+
+ GetParent()->PostMessage(WM_KICKIDLE); // and kick it hard :)
+
+ if(m_fFinished && m_bBeep) MessageBeep(-1);
+ if(m_fFinished && m_bExit) GetParent()->PostMessage(WM_COMMAND, IDCANCEL);
+
+ if(!fSucceeded)
+ {
+ VSFRipperData rd;
+ m_pVSFRipper->GetRipperData(rd);
+ if(rd.fCloseIgnoreError) GetParent()->PostMessage(WM_COMMAND, IDCANCEL);
+ }
+
+ return S_OK;
+}
+
+BEGIN_MESSAGE_MAP(CVSRipIndexingDlg, CVSRipPage)
+ ON_BN_CLICKED(IDC_BUTTON1, OnIndex)
+ ON_UPDATE_COMMAND_UI(IDC_BUTTON1, OnUpdateIndex)
+ ON_WM_SHOWWINDOW()
+ ON_BN_CLICKED(IDC_CHECK2, OnBnClickedCheck2)
+ ON_BN_CLICKED(IDC_CHECK1, OnBnClickedCheck1)
+END_MESSAGE_MAP()
+
+
+// CVSRipIndexingDlg message handlers
+
+void CVSRipIndexingDlg::OnIndex()
+{
+ if(S_OK == m_pVSFRipper->IsIndexing())
+ {
+ m_pVSFRipper->Abort(false);
+ }
+ else
+ {
+ m_progress.SetRange(0, 100);
+ m_progress.SetPos(0);
+ m_log.SetWindowText(_T(""));
+ m_log.SetMargins(0, 0);
+
+ m_pVSFRipper->Index();
+ }
+
+ GetParent()->PostMessage(WM_KICKIDLE); // and kick it hard :)
+}
+
+void CVSRipIndexingDlg::OnUpdateIndex(CCmdUI* pCmdUI)
+{
+ pCmdUI->SetText(S_OK == m_pVSFRipper->IsIndexing() ? _T("&Stop") : _T("Re&start"));
+}
+
+void CVSRipIndexingDlg::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+ __super::OnShowWindow(bShow, nStatus);
+
+ m_fFinished = false;
+
+ if(bShow)
+ {
+ VSFRipperData rd;
+ m_pVSFRipper->GetRipperData(rd);
+ m_bBeep = rd.fBeep;
+ m_bExit = rd.fClose;
+ m_fAuto = rd.fAuto;
+ UpdateData(FALSE);
+
+ if(S_OK != m_pVSFRipper->IsIndexing())
+ {
+ if(!m_fAuto)
+ {
+ m_progress.SetRange(0, 100);
+ m_progress.SetPos(0);
+ m_log.SetWindowText(_T(""));
+ m_log.SetMargins(0, 0);
+ }
+
+ m_pVSFRipper->Index();
+ }
+ }
+ else
+ {
+ VSFRipperData rd;
+ m_pVSFRipper->GetRipperData(rd);
+ UpdateData();
+ rd.fBeep = !m_bBeep;
+ rd.fClose = !!m_bExit;
+ m_pVSFRipper->UpdateRipperData(rd);
+ }
+}
+
+void CVSRipIndexingDlg::OnBnClickedCheck2()
+{
+ UpdateData();
+}
+
+void CVSRipIndexingDlg::OnBnClickedCheck1()
+{
+ UpdateData();
+}
diff --git a/src/apps/vsrip/VSRipIndexingDlg.h b/src/apps/vsrip/VSRipIndexingDlg.h
new file mode 100644
index 000000000..4fbf120cb
--- /dev/null
+++ b/src/apps/vsrip/VSRipIndexingDlg.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "VSRipPage.h"
+
+// CVSRipIndexingDlg dialog
+
+class CVSRipIndexingDlg : public CVSRipPage
+{
+ DECLARE_DYNAMIC(CVSRipIndexingDlg)
+
+private:
+ BOOL m_bBeep, m_bExit;
+ bool m_fAuto;
+
+protected:
+ // IVSFRipperCallback
+ STDMETHODIMP OnMessage(LPCTSTR msg);
+ STDMETHODIMP OnProgress(double progress /*0->1*/);
+ STDMETHODIMP OnFinished(bool fSucceeded);
+
+public:
+ CVSRipIndexingDlg(IVSFRipper* pVSFRipper, CWnd* pParent = NULL); // standard constructor
+ virtual ~CVSRipIndexingDlg();
+
+ virtual bool CanGoPrev() {return(S_OK != m_pVSFRipper->IsIndexing() && !m_fAuto);}
+ virtual bool CanGoNext() {return(false);}
+ virtual bool CanClose() {return(S_OK != m_pVSFRipper->IsIndexing());}
+ virtual CString GetCloseText() {return(m_fFinished ? _T("&Close") : _T("&Cancel"));}
+ virtual CString GetHeaderText() {return(_T("Extracting subtitles"));}
+ virtual CString GetDescText() {return(_T("This may take a while, please sit back and relax... ")
+ _T("If you wish you can abort the process and go back to ")
+ _T("adjust the settings again."));}
+
+ bool m_fFinished;
+
+// Dialog Data
+ enum { IDD = IDD_DIALOG_INDEXING };
+
+ CEdit m_log;
+ CProgressCtrl m_progress;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnIndex();
+ afx_msg void OnUpdateIndex(CCmdUI* pCmdUI);
+ afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+ afx_msg void OnBnClickedCheck2();
+ afx_msg void OnBnClickedCheck1();
+};
diff --git a/src/apps/vsrip/VSRipPGCDlg.cpp b/src/apps/vsrip/VSRipPGCDlg.cpp
new file mode 100644
index 000000000..01b02b13e
--- /dev/null
+++ b/src/apps/vsrip/VSRipPGCDlg.cpp
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// VSRipPGCDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <atlcoll.h>
+#include "VSRip.h"
+#include "VSRipPGCDlg.h"
+#include "..\..\subtitles\VobSubFile.h"
+
+
+// CVSRipPGCDlg dialog
+
+IMPLEMENT_DYNAMIC(CVSRipPGCDlg, CVSRipPage)
+CVSRipPGCDlg::CVSRipPGCDlg(IVSFRipper* pVSFRipper, CWnd* pParent /*=NULL*/)
+ : CVSRipPage(pVSFRipper, CVSRipPGCDlg::IDD, pParent)
+ , m_bResetTime(TRUE)
+ , m_bClosedCaption(FALSE)
+ , m_bForcedOnly(FALSE)
+{
+ m_rd.Reset();
+}
+
+CVSRipPGCDlg::~CVSRipPGCDlg()
+{
+}
+
+void CVSRipPGCDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CVSRipPage::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_pgclist);
+ DDX_Control(pDX, IDC_LIST2, m_anglelist);
+ DDX_Control(pDX, IDC_LIST3, m_vclist);
+ DDX_Control(pDX, IDC_LIST4, m_langlist);
+ DDX_Check(pDX, IDC_CHECK1, m_bResetTime);
+ DDX_Check(pDX, IDC_CHECK2, m_bClosedCaption);
+ DDX_Check(pDX, IDC_CHECK3, m_bForcedOnly);
+}
+
+void CVSRipPGCDlg::OnPrev()
+{
+ OnNext();
+}
+
+void CVSRipPGCDlg::OnNext()
+{
+ CAutoVectorPtr<int> items;
+
+ m_rd.iSelPGC = m_pgclist.GetCurSel();
+
+ m_rd.selids.RemoveAll();
+ if(items.Allocate(m_langlist.GetSelCount()))
+ {
+ int j = m_langlist.GetSelItems(m_langlist.GetSelCount(), items);
+ for(int i = 0; i < j; i++)
+ m_rd.selids[(BYTE)m_langlist.GetItemData(items[i])] = true;
+ items.Free();
+ }
+
+ m_rd.pgcs[m_rd.iSelPGC].iSelAngle = m_anglelist.GetCurSel();
+
+ m_rd.selvcs.RemoveAll();
+ if(items.Allocate(m_vclist.GetSelCount()))
+ {
+ int j = m_vclist.GetSelItems(m_vclist.GetSelCount(), items);
+ for(int i = 0; i < j; i++)
+ m_rd.selvcs.Add((DWORD)m_vclist.GetItemData(items[i]));
+ items.Free();
+ }
+
+ m_rd.fClosedCaption = !!m_bClosedCaption;
+ m_rd.fResetTime = !!m_bResetTime;
+ m_rd.fForcedOnly = !!m_bForcedOnly;
+
+ m_pVSFRipper->UpdateRipperData(m_rd);
+}
+
+bool CVSRipPGCDlg::CanGoNext()
+{
+ UpdateData();
+
+ return(m_pgclist.GetCurSel() >= 0
+ && m_anglelist.GetCurSel() >= 0
+ && m_vclist.GetSelCount() > 0
+ && (m_langlist.GetSelCount() > 0 || m_bClosedCaption));
+}
+
+void CVSRipPGCDlg::SetupPGCList()
+{
+ ASSERT(m_rd.iSelPGC >= 0);
+
+ m_pgclist.ResetContent();
+
+ for(int i = 0; i < m_rd.pgcs.GetCount(); i++)
+ {
+ CString str;
+ str.Format(_T("PGC %d"), i+1);
+ m_pgclist.AddString(str);
+ }
+
+ m_pgclist.SetCurSel(m_rd.iSelPGC);
+
+ SetupLangList();
+ SetupAngleList();
+}
+
+void CVSRipPGCDlg::SetupLangList()
+{
+ m_langlist.ResetContent();
+
+ for(BYTE i = 0; i < 32; i++)
+ {
+ WORD id = m_rd.pgcs[m_rd.iSelPGC].ids[i];
+
+ CString str;
+
+ if(id == 0)
+ {
+ str.Format(_T("%02d (empty)"), (int)i);
+ }
+ else if(!isalpha(id>>8) || !isalpha(id&0xff))
+ {
+ str.Format(_T("%02d (unknown)"), (int)i);
+ }
+ else
+ {
+ str.Format(_T("%02d %s (%c%c)"), (int)i, FindLangFromId(id), TCHAR(id>>8), TCHAR(id&0xff));
+ }
+
+ int j = m_langlist.AddString(str);
+ m_langlist.SetSel(j, !!id);
+ m_langlist.SetItemData(j, (DWORD_PTR)i);
+ }
+
+ m_langlist.SetTopIndex(0);
+}
+
+void CVSRipPGCDlg::SetupAngleList()
+{
+ m_anglelist.ResetContent();
+
+ m_rd.pgcs[m_rd.iSelPGC].iSelAngle = m_rd.pgcs[m_rd.iSelPGC].nAngles > 0 ? 1 : 0;
+
+ for(int i = 0; i < 10; i++)
+ {
+ CString str;
+
+ if(i == 0)
+ {
+ str = _T("Everything");
+ }
+ else
+ {
+ str.Format(_T("Angle %d"), i);
+ if(i > m_rd.pgcs[m_rd.iSelPGC].nAngles)
+ str += _T(" (empty)");
+ }
+
+ m_anglelist.AddString(str);
+ }
+
+ m_anglelist.SetCurSel(m_rd.pgcs[m_rd.iSelPGC].iSelAngle);
+
+ SetupVCList();
+}
+
+void CVSRipPGCDlg::SetupVCList()
+{
+ m_vclist.ResetContent();
+
+ CArray<vc_t>& vca = m_rd.pgcs[m_rd.iSelPGC].angles[m_rd.pgcs[m_rd.iSelPGC].iSelAngle];
+
+ for(int i = 0; i < vca.GetCount(); i++)
+ {
+ CString str;
+ str.Format(_T("V%02d C%02d"), vca[i].vob, vca[i].cell);
+
+ DWORD vc = (vca[i].vob<<16)|vca[i].cell;
+
+ int j = m_vclist.AddString(str);
+ m_vclist.SetSel(j, TRUE);
+ m_vclist.SetItemData(j, (DWORD_PTR)vc);
+ }
+
+ m_vclist.SetTopIndex(0);
+}
+
+BEGIN_MESSAGE_MAP(CVSRipPGCDlg, CVSRipPage)
+ ON_LBN_SELCHANGE(IDC_LIST1, OnLbnSelchangeList1)
+ ON_LBN_SELCHANGE(IDC_LIST2, OnLbnSelchangeList2)
+ ON_WM_SHOWWINDOW()
+END_MESSAGE_MAP()
+
+
+// CVSRipPGCDlg message handlers
+
+void CVSRipPGCDlg::OnLbnSelchangeList1()
+{
+ if(m_rd.iSelPGC == m_pgclist.GetCurSel()) return;
+ m_rd.iSelPGC = m_pgclist.GetCurSel();
+ SetupAngleList();
+}
+
+void CVSRipPGCDlg::OnLbnSelchangeList2()
+{
+ if(m_rd.pgcs[m_rd.iSelPGC].iSelAngle == m_anglelist.GetCurSel()) return;
+ m_rd.pgcs[m_rd.iSelPGC].iSelAngle = m_anglelist.GetCurSel();
+ SetupVCList();
+}
+
+void CVSRipPGCDlg::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+ CVSRipPage::OnShowWindow(bShow, nStatus);
+
+ if(!bShow) return;
+
+ m_pVSFRipper->GetRipperData(m_rd);
+
+ if(m_rd.iSelPGC == -1)
+ {
+ m_rd.iSelPGC = 0;
+ SetupPGCList();
+
+ m_bClosedCaption = m_rd.vidinfo.line21_1 || m_rd.vidinfo.line21_2;
+ UpdateData(FALSE);
+ }
+}
diff --git a/src/apps/vsrip/VSRipPGCDlg.h b/src/apps/vsrip/VSRipPGCDlg.h
new file mode 100644
index 000000000..91802b525
--- /dev/null
+++ b/src/apps/vsrip/VSRipPGCDlg.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "VSRipPage.h"
+#include "afxwin.h"
+
+
+// CVSRipPGCDlg dialog
+
+class CVSRipPGCDlg : public CVSRipPage
+{
+ DECLARE_DYNAMIC(CVSRipPGCDlg)
+
+private:
+ VSFRipperData m_rd;
+ void SetupPGCList();
+ void SetupAngleList();
+ void SetupVCList();
+ void SetupLangList();
+
+public:
+ CVSRipPGCDlg(IVSFRipper* pVSFRipper, CWnd* pParent = NULL); // standard constructor
+ virtual ~CVSRipPGCDlg();
+
+ virtual void OnPrev();
+ virtual void OnNext();
+ virtual bool CanGoPrev() {return(true);}
+ virtual bool CanGoNext();
+ virtual CString GetHeaderText() {return(_T("Extraction settings"));}
+ virtual CString GetDescText() {return(_T("Select the program chain and angle you did or ")
+ _T("will do in the dvd ripper. Optionally, remove any not ")
+ _T("needed language streams and vob/cell ids."));}
+
+// Dialog Data
+ enum { IDD = IDD_DIALOG_PGC };
+ CListBox m_pgclist;
+ CListBox m_anglelist;
+ CListBox m_vclist;
+ CListBox m_langlist;
+ BOOL m_bResetTime;
+ BOOL m_bClosedCaption;
+ BOOL m_bForcedOnly;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnLbnSelchangeList1();
+ afx_msg void OnLbnSelchangeList2();
+ afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+};
diff --git a/src/apps/vsrip/VSRipPage.cpp b/src/apps/vsrip/VSRipPage.cpp
new file mode 100644
index 000000000..d6d2ba1d3
--- /dev/null
+++ b/src/apps/vsrip/VSRipPage.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// VSRipPage.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <afxpriv.h>
+#include "VSRip.h"
+#include "VSRipPage.h"
+
+// CVSRipPage dialog
+
+IMPLEMENT_DYNAMIC(CVSRipPage, CDialog)
+CVSRipPage::CVSRipPage(IVSFRipper* pVSFRipper, UINT nIDTemplate, CWnd* pParent /*=NULL*/)
+ : CDialog(nIDTemplate, pParent)
+ , m_pVSFRipper(pVSFRipper)
+{
+ m_cRef = 1;
+}
+
+CVSRipPage::~CVSRipPage()
+{
+}
+
+void CVSRipPage::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CVSRipPage, CDialog)
+ ON_WM_SHOWWINDOW()
+END_MESSAGE_MAP()
+
+
+// CVSRipPage message handlers
+
+void CVSRipPage::OnShowWindow(BOOL bShow, UINT nStatus)
+{
+ __super::OnShowWindow(bShow, nStatus);
+
+ m_pVSFRipper->SetCallBack(bShow ? (IVSFRipperCallback*)this : NULL);
+}
+
diff --git a/src/apps/vsrip/VSRipPage.h b/src/apps/vsrip/VSRipPage.h
new file mode 100644
index 000000000..72e50f674
--- /dev/null
+++ b/src/apps/vsrip/VSRipPage.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <afxtempl.h>
+#include "..\..\subtitles\VobSubFileRipper.h"
+
+// CVSRipPage dialog
+
+class CVSRipPage : public CDialog, public IVSFRipperCallbackImpl
+{
+ DECLARE_DYNAMIC(CVSRipPage)
+
+protected:
+ CComPtr<IVSFRipper> m_pVSFRipper;
+
+public:
+ CVSRipPage(IVSFRipper* pVSFRipper, UINT nIDTemplate, CWnd* pParent = NULL); // standard constructor
+ virtual ~CVSRipPage();
+
+// static bool ParseParamFile(CString fn);
+
+ virtual void OnPrev() {}
+ virtual void OnNext() {}
+ virtual void OnClose() {}
+ virtual bool CanGoPrev() {return(false);}
+ virtual bool CanGoNext() {return(false);}
+ virtual bool CanClose() {return(true);}
+ virtual CString GetPrevText() {return(_T("< &Back"));}
+ virtual CString GetNextText() {return(_T("&Next >"));}
+ virtual CString GetCloseText() {return(_T("&Cancel"));}
+ virtual CString GetHeaderText() {return(_T("Header Text"));}
+ virtual CString GetDescText() {return(_T("Hello World"));}
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+public:
+ afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
+};
diff --git a/src/apps/vsrip/res/VSRip.ico b/src/apps/vsrip/res/VSRip.ico
new file mode 100644
index 000000000..8a84ca3d3
--- /dev/null
+++ b/src/apps/vsrip/res/VSRip.ico
Binary files differ
diff --git a/src/apps/vsrip/res/VSRip.manifest b/src/apps/vsrip/res/VSRip.manifest
new file mode 100644
index 000000000..3d1f3b957
--- /dev/null
+++ b/src/apps/vsrip/res/VSRip.manifest
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="X86"
+ name="Microsoft.Windows.VSRip"
+ type="win32"
+/>
+<description>Your app description here</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="X86"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+</assembly>
diff --git a/src/apps/vsrip/res/VSRip.rc2 b/src/apps/vsrip/res/VSRip.rc2
new file mode 100644
index 000000000..e8572ddbd
--- /dev/null
+++ b/src/apps/vsrip/res/VSRip.rc2
@@ -0,0 +1,13 @@
+//
+// VSRip.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/src/apps/vsrip/resource.h b/src/apps/vsrip/resource.h
new file mode 100644
index 000000000..96a8a3219
--- /dev/null
+++ b/src/apps/vsrip/resource.h
@@ -0,0 +1,37 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by VSRip.rc
+//
+#define IDR_MANIFEST 1
+#define IDD_VSRIP_DIALOG 102
+#define IDR_MAINFRAME 128
+#define IDD_DIALOG_FILE 129
+#define IDD_DIALOG_PGC 130
+#define IDD_DIALOG_INDEXING 131
+#define IDC_BUTTON1 1000
+#define IDC_BUTTON2 1001
+#define IDC_HEADERSEP 1002
+#define IDC_DLGRECT 1003
+#define IDC_CHECK1 1004
+#define IDC_EDIT1 1005
+#define IDC_LIST1 1007
+#define IDC_LIST2 1008
+#define IDC_PROGRESS1 1009
+#define IDC_LIST3 1010
+#define IDC_LIST4 1011
+#define IDC_CHECK2 1012
+#define IDC_FOOTERSEP 1013
+#define IDC_EDIT2 1014
+#define IDC_CHECK3 1015
+#define IDC_EDIT3 1017
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 132
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1018
+#define _APS_NEXT_SYMED_VALUE 104
+#endif
+#endif
diff --git a/src/apps/vsrip/stdafx.cpp b/src/apps/vsrip/stdafx.cpp
new file mode 100644
index 000000000..958e3681c
--- /dev/null
+++ b/src/apps/vsrip/stdafx.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// VSRip.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+
diff --git a/src/apps/vsrip/stdafx.h b/src/apps/vsrip/stdafx.h
new file mode 100644
index 000000000..291cf4180
--- /dev/null
+++ b/src/apps/vsrip/stdafx.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
+#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
+#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
+#define _WIN32_IE 0x0400 // Change this to the appropriate value to target IE 5.0 or later.
+#endif
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <streams.h>
+
diff --git a/src/decss/CSSauth.cpp b/src/decss/CSSauth.cpp
new file mode 100644
index 000000000..10aa2135b
--- /dev/null
+++ b/src/decss/CSSauth.cpp
@@ -0,0 +1,328 @@
+#include "stdafx.h"
+
+static void CSSengine(int varient,unsigned char const *input,unsigned char *output);
+
+void CSSkey1(int varient,unsigned char const *challenge,unsigned char *key)
+{
+ static unsigned char perm_challenge[] = {1,3,0,7,5, 2,9,6,4,8};
+
+ unsigned char scratch[10];
+ int i;
+
+ for (i = 9; i >= 0; --i)
+ scratch[i] = challenge[perm_challenge[i]];
+
+ CSSengine(varient, scratch, key);
+}
+
+void CSSkey2(int varient,unsigned char const *challenge,unsigned char *key)
+{
+ static unsigned char perm_challenge[] = {6,1,9,3,8, 5,7,4,0,2};
+
+ static unsigned char perm_varient[] = {
+ 0x0a, 0x08, 0x0e, 0x0c, 0x0b, 0x09, 0x0f, 0x0d,
+ 0x1a, 0x18, 0x1e, 0x1c, 0x1b, 0x19, 0x1f, 0x1d,
+ 0x02, 0x00, 0x06, 0x04, 0x03, 0x01, 0x07, 0x05,
+ 0x12, 0x10, 0x16, 0x14, 0x13, 0x11, 0x17, 0x15};
+
+ unsigned char scratch[10];
+ int i;
+
+ for (i = 9; i >= 0; --i)
+ scratch[i] = challenge[perm_challenge[i]];
+
+ CSSengine(perm_varient[varient], scratch, key);
+}
+
+void CSSbuskey(int varient,unsigned char const *challenge,unsigned char *key)
+{
+ static unsigned char perm_challenge[] = {4,0,3,5,7, 2,8,6,1,9};
+ static unsigned char perm_varient[] = {
+ 0x12, 0x1a, 0x16, 0x1e, 0x02, 0x0a, 0x06, 0x0e,
+ 0x10, 0x18, 0x14, 0x1c, 0x00, 0x08, 0x04, 0x0c,
+ 0x13, 0x1b, 0x17, 0x1f, 0x03, 0x0b, 0x07, 0x0f,
+ 0x11, 0x19, 0x15, 0x1d, 0x01, 0x09, 0x05, 0x0d};
+
+ unsigned char scratch[10];
+ int i;
+
+ for (i = 9; i >= 0; --i)
+ scratch[i] = challenge[perm_challenge[i]];
+
+ CSSengine(perm_varient[varient], scratch, key);
+}
+
+static void CSSgenbits(unsigned char *output, int len,unsigned char const *s)
+{
+ unsigned long lfsr0, lfsr1;
+ unsigned char b1_combined; /* Save the old value of bit 1 for feedback */
+
+ /* In order to ensure that the LFSR works we need to ensure that the
+ * initial values are non-zero. Thus when we initialise them from
+ * the seed, we ensure that a bit is set.
+ */
+ lfsr0 = (s[0] << 17) | (s[1] << 9) | ((s[2] & ~7) << 1) | 8 | (s[2] & 7);
+ lfsr1 = (s[3] << 9) | 0x100 | s[4];
+
+ ++output;
+
+ b1_combined = 0;
+ do {
+ int bit;
+ unsigned char val;
+
+ for (bit = 0, val = 0; bit < 8; ++bit) {
+ unsigned char o_lfsr0, o_lfsr1; /* Actually only 1 bit each */
+ unsigned char combined;
+
+ o_lfsr0 = ((lfsr0 >> 24) ^ (lfsr0 >> 21) ^ (lfsr0 >> 20) ^ (lfsr0 >> 12)) & 1;
+ lfsr0 = (lfsr0 << 1) | o_lfsr0;
+
+ o_lfsr1 = ((lfsr1 >> 16) ^ (lfsr1 >> 2)) & 1;
+ lfsr1 = (lfsr1 << 1) | o_lfsr1;
+
+#define BIT0(x) ((x) & 1)
+#define BIT1(x) (((x) >> 1) & 1)
+
+ combined = !o_lfsr1 + b1_combined + !o_lfsr0;
+ b1_combined = BIT1(combined);
+ val |= BIT0(combined) << bit;
+ }
+
+ *--output = val;
+ } while (--len > 0);
+}
+
+unsigned char CSSsecret[];
+unsigned char CSSvarients[];
+unsigned char CSStable0[];
+unsigned char CSStable1[];
+unsigned char CSStable2[];
+unsigned char CSStable3[];
+
+static void CSSengine(int varient, unsigned char const *input,unsigned char *output)
+{
+ unsigned char cse, term, index;
+ unsigned char temp1[5];
+ unsigned char temp2[5];
+ unsigned char bits[30];
+
+ int i;
+
+ /* Feed the CSSsecret into the input values such that
+ * we alter the seed to the LFSR's used above, then
+ * generate the bits to play with.
+ */
+ for (i = 5; --i >= 0; )
+ temp1[i] = input[5 + i] ^ CSSsecret[i] ^ CSStable2[i];
+
+ CSSgenbits(&bits[29], sizeof bits, temp1);
+
+ /* This term is used throughout the following to
+ * select one of 32 different variations on the
+ * algorithm.
+ */
+ cse = CSSvarients[varient] ^ CSStable2[varient];
+
+ /* Now the actual blocks doing the encryption. Each
+ * of these works on 40 bits at a time and are quite
+ * similar.
+ */
+ for (i = 5, term = 0; --i >= 0; term = input[i]) {
+ index = bits[25 + i] ^ input[i];
+ index = CSStable1[index] ^ ~CSStable2[index] ^ cse;
+
+ temp1[i] = CSStable2[index] ^ CSStable3[index] ^ term;
+ }
+ temp1[4] ^= temp1[0];
+
+ for (i = 5, term = 0; --i >= 0; term = temp1[i]) {
+ index = bits[20 + i] ^ temp1[i];
+ index = CSStable1[index] ^ ~CSStable2[index] ^ cse;
+
+ temp2[i] = CSStable2[index] ^ CSStable3[index] ^ term;
+ }
+ temp2[4] ^= temp2[0];
+
+ for (i = 5, term = 0; --i >= 0; term = temp2[i]) {
+ index = bits[15 + i] ^ temp2[i];
+ index = CSStable1[index] ^ ~CSStable2[index] ^ cse;
+ index = CSStable2[index] ^ CSStable3[index] ^ term;
+
+ temp1[i] = CSStable0[index] ^ CSStable2[index];
+ }
+ temp1[4] ^= temp1[0];
+
+ for (i = 5, term = 0; --i >= 0; term = temp1[i]) {
+ index = bits[10 + i] ^ temp1[i];
+ index = CSStable1[index] ^ ~CSStable2[index] ^ cse;
+
+ index = CSStable2[index] ^ CSStable3[index] ^ term;
+
+ temp2[i] = CSStable0[index] ^ CSStable2[index];
+ }
+ temp2[4] ^= temp2[0];
+
+ for (i = 5, term = 0; --i >= 0; term = temp2[i]) {
+ index = bits[5 + i] ^ temp2[i];
+ index = CSStable1[index] ^ ~CSStable2[index] ^ cse;
+
+ temp1[i] = CSStable2[index] ^ CSStable3[index] ^ term;
+ }
+ temp1[4] ^= temp1[0];
+
+ for (i = 5, term = 0; --i >= 0; term = temp1[i]) {
+ index = bits[i] ^ temp1[i];
+ index = CSStable1[index] ^ ~CSStable2[index] ^ cse;
+
+ output[i] = CSStable2[index] ^ CSStable3[index] ^ term;
+ }
+}
+
+static unsigned char CSSvarients[] = {
+ 0xB7, 0x74, 0x85, 0xD0, 0xCC, 0xDB, 0xCA, 0x73,
+ 0x03, 0xFE, 0x31, 0x03, 0x52, 0xE0, 0xB7, 0x42,
+ 0x63, 0x16, 0xF2, 0x2A, 0x79, 0x52, 0xFF, 0x1B,
+ 0x7A, 0x11, 0xCA, 0x1A, 0x9B, 0x40, 0xAD, 0x01};
+
+static unsigned char CSSsecret[] = {0x55, 0xD6, 0xC4, 0xC5, 0x28};
+
+static unsigned char CSStable0[] = {
+ 0xB7, 0xF4, 0x82, 0x57, 0xDA, 0x4D, 0xDB, 0xE2,
+ 0x2F, 0x52, 0x1A, 0xA8, 0x68, 0x5A, 0x8A, 0xFF,
+ 0xFB, 0x0E, 0x6D, 0x35, 0xF7, 0x5C, 0x76, 0x12,
+ 0xCE, 0x25, 0x79, 0x29, 0x39, 0x62, 0x08, 0x24,
+ 0xA5, 0x85, 0x7B, 0x56, 0x01, 0x23, 0x68, 0xCF,
+ 0x0A, 0xE2, 0x5A, 0xED, 0x3D, 0x59, 0xB0, 0xA9,
+ 0xB0, 0x2C, 0xF2, 0xB8, 0xEF, 0x32, 0xA9, 0x40,
+ 0x80, 0x71, 0xAF, 0x1E, 0xDE, 0x8F, 0x58, 0x88,
+ 0xB8, 0x3A, 0xD0, 0xFC, 0xC4, 0x1E, 0xB5, 0xA0,
+ 0xBB, 0x3B, 0x0F, 0x01, 0x7E, 0x1F, 0x9F, 0xD9,
+ 0xAA, 0xB8, 0x3D, 0x9D, 0x74, 0x1E, 0x25, 0xDB,
+ 0x37, 0x56, 0x8F, 0x16, 0xBA, 0x49, 0x2B, 0xAC,
+ 0xD0, 0xBD, 0x95, 0x20, 0xBE, 0x7A, 0x28, 0xD0,
+ 0x51, 0x64, 0x63, 0x1C, 0x7F, 0x66, 0x10, 0xBB,
+ 0xC4, 0x56, 0x1A, 0x04, 0x6E, 0x0A, 0xEC, 0x9C,
+ 0xD6, 0xE8, 0x9A, 0x7A, 0xCF, 0x8C, 0xDB, 0xB1,
+ 0xEF, 0x71, 0xDE, 0x31, 0xFF, 0x54, 0x3E, 0x5E,
+ 0x07, 0x69, 0x96, 0xB0, 0xCF, 0xDD, 0x9E, 0x47,
+ 0xC7, 0x96, 0x8F, 0xE4, 0x2B, 0x59, 0xC6, 0xEE,
+ 0xB9, 0x86, 0x9A, 0x64, 0x84, 0x72, 0xE2, 0x5B,
+ 0xA2, 0x96, 0x58, 0x99, 0x50, 0x03, 0xF5, 0x38,
+ 0x4D, 0x02, 0x7D, 0xE7, 0x7D, 0x75, 0xA7, 0xB8,
+ 0x67, 0x87, 0x84, 0x3F, 0x1D, 0x11, 0xE5, 0xFC,
+ 0x1E, 0xD3, 0x83, 0x16, 0xA5, 0x29, 0xF6, 0xC7,
+ 0x15, 0x61, 0x29, 0x1A, 0x43, 0x4F, 0x9B, 0xAF,
+ 0xC5, 0x87, 0x34, 0x6C, 0x0F, 0x3B, 0xA8, 0x1D,
+ 0x45, 0x58, 0x25, 0xDC, 0xA8, 0xA3, 0x3B, 0xD1,
+ 0x79, 0x1B, 0x48, 0xF2, 0xE9, 0x93, 0x1F, 0xFC,
+ 0xDB, 0x2A, 0x90, 0xA9, 0x8A, 0x3D, 0x39, 0x18,
+ 0xA3, 0x8E, 0x58, 0x6C, 0xE0, 0x12, 0xBB, 0x25,
+ 0xCD, 0x71, 0x22, 0xA2, 0x64, 0xC6, 0xE7, 0xFB,
+ 0xAD, 0x94, 0x77, 0x04, 0x9A, 0x39, 0xCF, 0x7C};
+
+static unsigned char CSStable1[] = {
+ 0x8C, 0x47, 0xB0, 0xE1, 0xEB, 0xFC, 0xEB, 0x56,
+ 0x10, 0xE5, 0x2C, 0x1A, 0x5D, 0xEF, 0xBE, 0x4F,
+ 0x08, 0x75, 0x97, 0x4B, 0x0E, 0x25, 0x8E, 0x6E,
+ 0x39, 0x5A, 0x87, 0x53, 0xC4, 0x1F, 0xF4, 0x5C,
+ 0x4E, 0xE6, 0x99, 0x30, 0xE0, 0x42, 0x88, 0xAB,
+ 0xE5, 0x85, 0xBC, 0x8F, 0xD8, 0x3C, 0x54, 0xC9,
+ 0x53, 0x47, 0x18, 0xD6, 0x06, 0x5B, 0x41, 0x2C,
+ 0x67, 0x1E, 0x41, 0x74, 0x33, 0xE2, 0xB4, 0xE0,
+ 0x23, 0x29, 0x42, 0xEA, 0x55, 0x0F, 0x25, 0xB4,
+ 0x24, 0x2C, 0x99, 0x13, 0xEB, 0x0A, 0x0B, 0xC9,
+ 0xF9, 0x63, 0x67, 0x43, 0x2D, 0xC7, 0x7D, 0x07,
+ 0x60, 0x89, 0xD1, 0xCC, 0xE7, 0x94, 0x77, 0x74,
+ 0x9B, 0x7E, 0xD7, 0xE6, 0xFF, 0xBB, 0x68, 0x14,
+ 0x1E, 0xA3, 0x25, 0xDE, 0x3A, 0xA3, 0x54, 0x7B,
+ 0x87, 0x9D, 0x50, 0xCA, 0x27, 0xC3, 0xA4, 0x50,
+ 0x91, 0x27, 0xD4, 0xB0, 0x82, 0x41, 0x97, 0x79,
+ 0x94, 0x82, 0xAC, 0xC7, 0x8E, 0xA5, 0x4E, 0xAA,
+ 0x78, 0x9E, 0xE0, 0x42, 0xBA, 0x28, 0xEA, 0xB7,
+ 0x74, 0xAD, 0x35, 0xDA, 0x92, 0x60, 0x7E, 0xD2,
+ 0x0E, 0xB9, 0x24, 0x5E, 0x39, 0x4F, 0x5E, 0x63,
+ 0x09, 0xB5, 0xFA, 0xBF, 0xF1, 0x22, 0x55, 0x1C,
+ 0xE2, 0x25, 0xDB, 0xC5, 0xD8, 0x50, 0x03, 0x98,
+ 0xC4, 0xAC, 0x2E, 0x11, 0xB4, 0x38, 0x4D, 0xD0,
+ 0xB9, 0xFC, 0x2D, 0x3C, 0x08, 0x04, 0x5A, 0xEF,
+ 0xCE, 0x32, 0xFB, 0x4C, 0x92, 0x1E, 0x4B, 0xFB,
+ 0x1A, 0xD0, 0xE2, 0x3E, 0xDA, 0x6E, 0x7C, 0x4D,
+ 0x56, 0xC3, 0x3F, 0x42, 0xB1, 0x3A, 0x23, 0x4D,
+ 0x6E, 0x84, 0x56, 0x68, 0xF4, 0x0E, 0x03, 0x64,
+ 0xD0, 0xA9, 0x92, 0x2F, 0x8B, 0xBC, 0x39, 0x9C,
+ 0xAC, 0x09, 0x5E, 0xEE, 0xE5, 0x97, 0xBF, 0xA5,
+ 0xCE, 0xFA, 0x28, 0x2C, 0x6D, 0x4F, 0xEF, 0x77,
+ 0xAA, 0x1B, 0x79, 0x8E, 0x97, 0xB4, 0xC3, 0xF4};
+
+static unsigned char CSStable2[] = {
+ 0xB7, 0x75, 0x81, 0xD5, 0xDC, 0xCA, 0xDE, 0x66,
+ 0x23, 0xDF, 0x15, 0x26, 0x62, 0xD1, 0x83, 0x77,
+ 0xE3, 0x97, 0x76, 0xAF, 0xE9, 0xC3, 0x6B, 0x8E,
+ 0xDA, 0xB0, 0x6E, 0xBF, 0x2B, 0xF1, 0x19, 0xB4,
+ 0x95, 0x34, 0x48, 0xE4, 0x37, 0x94, 0x5D, 0x7B,
+ 0x36, 0x5F, 0x65, 0x53, 0x07, 0xE2, 0x89, 0x11,
+ 0x98, 0x85, 0xD9, 0x12, 0xC1, 0x9D, 0x84, 0xEC,
+ 0xA4, 0xD4, 0x88, 0xB8, 0xFC, 0x2C, 0x79, 0x28,
+ 0xD8, 0xDB, 0xB3, 0x1E, 0xA2, 0xF9, 0xD0, 0x44,
+ 0xD7, 0xD6, 0x60, 0xEF, 0x14, 0xF4, 0xF6, 0x31,
+ 0xD2, 0x41, 0x46, 0x67, 0x0A, 0xE1, 0x58, 0x27,
+ 0x43, 0xA3, 0xF8, 0xE0, 0xC8, 0xBA, 0x5A, 0x5C,
+ 0x80, 0x6C, 0xC6, 0xF2, 0xE8, 0xAD, 0x7D, 0x04,
+ 0x0D, 0xB9, 0x3C, 0xC2, 0x25, 0xBD, 0x49, 0x63,
+ 0x8C, 0x9F, 0x51, 0xCE, 0x20, 0xC5, 0xA1, 0x50,
+ 0x92, 0x2D, 0xDD, 0xBC, 0x8D, 0x4F, 0x9A, 0x71,
+ 0x2F, 0x30, 0x1D, 0x73, 0x39, 0x13, 0xFB, 0x1A,
+ 0xCB, 0x24, 0x59, 0xFE, 0x05, 0x96, 0x57, 0x0F,
+ 0x1F, 0xCF, 0x54, 0xBE, 0xF5, 0x06, 0x1B, 0xB2,
+ 0x6D, 0xD3, 0x4D, 0x32, 0x56, 0x21, 0x33, 0x0B,
+ 0x52, 0xE7, 0xAB, 0xEB, 0xA6, 0x74, 0x00, 0x4C,
+ 0xB1, 0x7F, 0x82, 0x99, 0x87, 0x0E, 0x5E, 0xC0,
+ 0x8F, 0xEE, 0x6F, 0x55, 0xF3, 0x7E, 0x08, 0x90,
+ 0xFA, 0xB6, 0x64, 0x70, 0x47, 0x4A, 0x17, 0xA7,
+ 0xB5, 0x40, 0x8A, 0x38, 0xE5, 0x68, 0x3E, 0x8B,
+ 0x69, 0xAA, 0x9B, 0x42, 0xA5, 0x10, 0x01, 0x35,
+ 0xFD, 0x61, 0x9E, 0xE6, 0x16, 0x9C, 0x86, 0xED,
+ 0xCD, 0x2E, 0xFF, 0xC4, 0x5B, 0xA0, 0xAE, 0xCC,
+ 0x4B, 0x3B, 0x03, 0xBB, 0x1C, 0x2A, 0xAC, 0x0C,
+ 0x3F, 0x93, 0xC7, 0x72, 0x7A, 0x09, 0x22, 0x3D,
+ 0x45, 0x78, 0xA9, 0xA8, 0xEA, 0xC9, 0x6A, 0xF7,
+ 0x29, 0x91, 0xF0, 0x02, 0x18, 0x3A, 0x4E, 0x7C};
+
+static unsigned char CSStable3[] = {
+ 0x73, 0x51, 0x95, 0xE1, 0x12, 0xE4, 0xC0, 0x58,
+ 0xEE, 0xF2, 0x08, 0x1B, 0xA9, 0xFA, 0x98, 0x4C,
+ 0xA7, 0x33, 0xE2, 0x1B, 0xA7, 0x6D, 0xF5, 0x30,
+ 0x97, 0x1D, 0xF3, 0x02, 0x60, 0x5A, 0x82, 0x0F,
+ 0x91, 0xD0, 0x9C, 0x10, 0x39, 0x7A, 0x83, 0x85,
+ 0x3B, 0xB2, 0xB8, 0xAE, 0x0C, 0x09, 0x52, 0xEA,
+ 0x1C, 0xE1, 0x8D, 0x66, 0x4F, 0xF3, 0xDA, 0x92,
+ 0x29, 0xB9, 0xD5, 0xC5, 0x77, 0x47, 0x22, 0x53,
+ 0x14, 0xF7, 0xAF, 0x22, 0x64, 0xDF, 0xC6, 0x72,
+ 0x12, 0xF3, 0x75, 0xDA, 0xD7, 0xD7, 0xE5, 0x02,
+ 0x9E, 0xED, 0xDA, 0xDB, 0x4C, 0x47, 0xCE, 0x91,
+ 0x06, 0x06, 0x6D, 0x55, 0x8B, 0x19, 0xC9, 0xEF,
+ 0x8C, 0x80, 0x1A, 0x0E, 0xEE, 0x4B, 0xAB, 0xF2,
+ 0x08, 0x5C, 0xE9, 0x37, 0x26, 0x5E, 0x9A, 0x90,
+ 0x00, 0xF3, 0x0D, 0xB2, 0xA6, 0xA3, 0xF7, 0x26,
+ 0x17, 0x48, 0x88, 0xC9, 0x0E, 0x2C, 0xC9, 0x02,
+ 0xE7, 0x18, 0x05, 0x4B, 0xF3, 0x39, 0xE1, 0x20,
+ 0x02, 0x0D, 0x40, 0xC7, 0xCA, 0xB9, 0x48, 0x30,
+ 0x57, 0x67, 0xCC, 0x06, 0xBF, 0xAC, 0x81, 0x08,
+ 0x24, 0x7A, 0xD4, 0x8B, 0x19, 0x8E, 0xAC, 0xB4,
+ 0x5A, 0x0F, 0x73, 0x13, 0xAC, 0x9E, 0xDA, 0xB6,
+ 0xB8, 0x96, 0x5B, 0x60, 0x88, 0xE1, 0x81, 0x3F,
+ 0x07, 0x86, 0x37, 0x2D, 0x79, 0x14, 0x52, 0xEA,
+ 0x73, 0xDF, 0x3D, 0x09, 0xC8, 0x25, 0x48, 0xD8,
+ 0x75, 0x60, 0x9A, 0x08, 0x27, 0x4A, 0x2C, 0xB9,
+ 0xA8, 0x8B, 0x8A, 0x73, 0x62, 0x37, 0x16, 0x02,
+ 0xBD, 0xC1, 0x0E, 0x56, 0x54, 0x3E, 0x14, 0x5F,
+ 0x8C, 0x8F, 0x6E, 0x75, 0x1C, 0x07, 0x39, 0x7B,
+ 0x4B, 0xDB, 0xD3, 0x4B, 0x1E, 0xC8, 0x7E, 0xFE,
+ 0x3E, 0x72, 0x16, 0x83, 0x7D, 0xEE, 0xF5, 0xCA,
+ 0xC5, 0x18, 0xF9, 0xD8, 0x68, 0xAB, 0x38, 0x85,
+ 0xA8, 0xF0, 0xA1, 0x73, 0x9F, 0x5D, 0x19, 0x0B,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x33, 0x72, 0x39, 0x25, 0x67, 0x26, 0x6D, 0x71,
+ 0x36, 0x77, 0x3C, 0x20, 0x62, 0x23, 0x68, 0x74,
+ 0xC3, 0x82, 0xC9, 0x15, 0x57, 0x16, 0x5D, 0x81};
diff --git a/src/decss/CSSauth.h b/src/decss/CSSauth.h
new file mode 100644
index 000000000..9929ae887
--- /dev/null
+++ b/src/decss/CSSauth.h
@@ -0,0 +1,5 @@
+#pragma once
+
+extern void CSSkey1(int varient, byte const *challenge, byte *key);
+extern void CSSkey2(int varient, byte const *challenge, byte *key);
+extern void CSSbuskey(int varient, byte const *challenge, byte *key);
diff --git a/src/decss/CSSscramble.cpp b/src/decss/CSSscramble.cpp
new file mode 100644
index 000000000..87f251d21
--- /dev/null
+++ b/src/decss/CSSscramble.cpp
@@ -0,0 +1,247 @@
+#include "stdafx.h"
+
+#ifndef countof
+#define countof(array) (sizeof(array)/sizeof(array[0]))
+#endif
+
+unsigned int CSStab0[11]={5,0,1,2,3,4,0,1,2,3,4};
+
+unsigned char CSStab1[256]=
+{
+ 0x33,0x73,0x3b,0x26,0x63,0x23,0x6b,0x76,0x3e,0x7e,0x36,0x2b,0x6e,0x2e,0x66,0x7b,
+ 0xd3,0x93,0xdb,0x06,0x43,0x03,0x4b,0x96,0xde,0x9e,0xd6,0x0b,0x4e,0x0e,0x46,0x9b,
+ 0x57,0x17,0x5f,0x82,0xc7,0x87,0xcf,0x12,0x5a,0x1a,0x52,0x8f,0xca,0x8a,0xc2,0x1f,
+ 0xd9,0x99,0xd1,0x00,0x49,0x09,0x41,0x90,0xd8,0x98,0xd0,0x01,0x48,0x08,0x40,0x91,
+ 0x3d,0x7d,0x35,0x24,0x6d,0x2d,0x65,0x74,0x3c,0x7c,0x34,0x25,0x6c,0x2c,0x64,0x75,
+ 0xdd,0x9d,0xd5,0x04,0x4d,0x0d,0x45,0x94,0xdc,0x9c,0xd4,0x05,0x4c,0x0c,0x44,0x95,
+ 0x59,0x19,0x51,0x80,0xc9,0x89,0xc1,0x10,0x58,0x18,0x50,0x81,0xc8,0x88,0xc0,0x11,
+ 0xd7,0x97,0xdf,0x02,0x47,0x07,0x4f,0x92,0xda,0x9a,0xd2,0x0f,0x4a,0x0a,0x42,0x9f,
+ 0x53,0x13,0x5b,0x86,0xc3,0x83,0xcb,0x16,0x5e,0x1e,0x56,0x8b,0xce,0x8e,0xc6,0x1b,
+ 0xb3,0xf3,0xbb,0xa6,0xe3,0xa3,0xeb,0xf6,0xbe,0xfe,0xb6,0xab,0xee,0xae,0xe6,0xfb,
+ 0x37,0x77,0x3f,0x22,0x67,0x27,0x6f,0x72,0x3a,0x7a,0x32,0x2f,0x6a,0x2a,0x62,0x7f,
+ 0xb9,0xf9,0xb1,0xa0,0xe9,0xa9,0xe1,0xf0,0xb8,0xf8,0xb0,0xa1,0xe8,0xa8,0xe0,0xf1,
+ 0x5d,0x1d,0x55,0x84,0xcd,0x8d,0xc5,0x14,0x5c,0x1c,0x54,0x85,0xcc,0x8c,0xc4,0x15,
+ 0xbd,0xfd,0xb5,0xa4,0xed,0xad,0xe5,0xf4,0xbc,0xfc,0xb4,0xa5,0xec,0xac,0xe4,0xf5,
+ 0x39,0x79,0x31,0x20,0x69,0x29,0x61,0x70,0x38,0x78,0x30,0x21,0x68,0x28,0x60,0x71,
+ 0xb7,0xf7,0xbf,0xa2,0xe7,0xa7,0xef,0xf2,0xba,0xfa,0xb2,0xaf,0xea,0xaa,0xe2,0xff
+};
+
+unsigned char CSStab2[256]=
+{
+ 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x09,0x08,0x0b,0x0a,0x0d,0x0c,0x0f,0x0e,
+ 0x12,0x13,0x10,0x11,0x16,0x17,0x14,0x15,0x1b,0x1a,0x19,0x18,0x1f,0x1e,0x1d,0x1c,
+ 0x24,0x25,0x26,0x27,0x20,0x21,0x22,0x23,0x2d,0x2c,0x2f,0x2e,0x29,0x28,0x2b,0x2a,
+ 0x36,0x37,0x34,0x35,0x32,0x33,0x30,0x31,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,
+ 0x49,0x48,0x4b,0x4a,0x4d,0x4c,0x4f,0x4e,0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,
+ 0x5b,0x5a,0x59,0x58,0x5f,0x5e,0x5d,0x5c,0x52,0x53,0x50,0x51,0x56,0x57,0x54,0x55,
+ 0x6d,0x6c,0x6f,0x6e,0x69,0x68,0x6b,0x6a,0x64,0x65,0x66,0x67,0x60,0x61,0x62,0x63,
+ 0x7f,0x7e,0x7d,0x7c,0x7b,0x7a,0x79,0x78,0x76,0x77,0x74,0x75,0x72,0x73,0x70,0x71,
+ 0x92,0x93,0x90,0x91,0x96,0x97,0x94,0x95,0x9b,0x9a,0x99,0x98,0x9f,0x9e,0x9d,0x9c,
+ 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x89,0x88,0x8b,0x8a,0x8d,0x8c,0x8f,0x8e,
+ 0xb6,0xb7,0xb4,0xb5,0xb2,0xb3,0xb0,0xb1,0xbf,0xbe,0xbd,0xbc,0xbb,0xba,0xb9,0xb8,
+ 0xa4,0xa5,0xa6,0xa7,0xa0,0xa1,0xa2,0xa3,0xad,0xac,0xaf,0xae,0xa9,0xa8,0xab,0xaa,
+ 0xdb,0xda,0xd9,0xd8,0xdf,0xde,0xdd,0xdc,0xd2,0xd3,0xd0,0xd1,0xd6,0xd7,0xd4,0xd5,
+ 0xc9,0xc8,0xcb,0xca,0xcd,0xcc,0xcf,0xce,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,
+ 0xff,0xfe,0xfd,0xfc,0xfb,0xfa,0xf9,0xf8,0xf6,0xf7,0xf4,0xf5,0xf2,0xf3,0xf0,0xf1,
+ 0xed,0xec,0xef,0xee,0xe9,0xe8,0xeb,0xea,0xe4,0xe5,0xe6,0xe7,0xe0,0xe1,0xe2,0xe3
+};
+
+unsigned char CSStab3[512]=
+{
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,
+ 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff,0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff
+};
+
+unsigned char CSStab4[256]=
+{
+ 0x00,0x80,0x40,0xc0,0x20,0xa0,0x60,0xe0,0x10,0x90,0x50,0xd0,0x30,0xb0,0x70,0xf0,
+ 0x08,0x88,0x48,0xc8,0x28,0xa8,0x68,0xe8,0x18,0x98,0x58,0xd8,0x38,0xb8,0x78,0xf8,
+ 0x04,0x84,0x44,0xc4,0x24,0xa4,0x64,0xe4,0x14,0x94,0x54,0xd4,0x34,0xb4,0x74,0xf4,
+ 0x0c,0x8c,0x4c,0xcc,0x2c,0xac,0x6c,0xec,0x1c,0x9c,0x5c,0xdc,0x3c,0xbc,0x7c,0xfc,
+ 0x02,0x82,0x42,0xc2,0x22,0xa2,0x62,0xe2,0x12,0x92,0x52,0xd2,0x32,0xb2,0x72,0xf2,
+ 0x0a,0x8a,0x4a,0xca,0x2a,0xaa,0x6a,0xea,0x1a,0x9a,0x5a,0xda,0x3a,0xba,0x7a,0xfa,
+ 0x06,0x86,0x46,0xc6,0x26,0xa6,0x66,0xe6,0x16,0x96,0x56,0xd6,0x36,0xb6,0x76,0xf6,
+ 0x0e,0x8e,0x4e,0xce,0x2e,0xae,0x6e,0xee,0x1e,0x9e,0x5e,0xde,0x3e,0xbe,0x7e,0xfe,
+ 0x01,0x81,0x41,0xc1,0x21,0xa1,0x61,0xe1,0x11,0x91,0x51,0xd1,0x31,0xb1,0x71,0xf1,
+ 0x09,0x89,0x49,0xc9,0x29,0xa9,0x69,0xe9,0x19,0x99,0x59,0xd9,0x39,0xb9,0x79,0xf9,
+ 0x05,0x85,0x45,0xc5,0x25,0xa5,0x65,0xe5,0x15,0x95,0x55,0xd5,0x35,0xb5,0x75,0xf5,
+ 0x0d,0x8d,0x4d,0xcd,0x2d,0xad,0x6d,0xed,0x1d,0x9d,0x5d,0xdd,0x3d,0xbd,0x7d,0xfd,
+ 0x03,0x83,0x43,0xc3,0x23,0xa3,0x63,0xe3,0x13,0x93,0x53,0xd3,0x33,0xb3,0x73,0xf3,
+ 0x0b,0x8b,0x4b,0xcb,0x2b,0xab,0x6b,0xeb,0x1b,0x9b,0x5b,0xdb,0x3b,0xbb,0x7b,0xfb,
+ 0x07,0x87,0x47,0xc7,0x27,0xa7,0x67,0xe7,0x17,0x97,0x57,0xd7,0x37,0xb7,0x77,0xf7,
+ 0x0f,0x8f,0x4f,0xcf,0x2f,0xaf,0x6f,0xef,0x1f,0x9f,0x5f,0xdf,0x3f,0xbf,0x7f,0xff
+};
+
+unsigned char CSStab5[256]=
+{
+ 0xff,0x7f,0xbf,0x3f,0xdf,0x5f,0x9f,0x1f,0xef,0x6f,0xaf,0x2f,0xcf,0x4f,0x8f,0x0f,
+ 0xf7,0x77,0xb7,0x37,0xd7,0x57,0x97,0x17,0xe7,0x67,0xa7,0x27,0xc7,0x47,0x87,0x07,
+ 0xfb,0x7b,0xbb,0x3b,0xdb,0x5b,0x9b,0x1b,0xeb,0x6b,0xab,0x2b,0xcb,0x4b,0x8b,0x0b,
+ 0xf3,0x73,0xb3,0x33,0xd3,0x53,0x93,0x13,0xe3,0x63,0xa3,0x23,0xc3,0x43,0x83,0x03,
+ 0xfd,0x7d,0xbd,0x3d,0xdd,0x5d,0x9d,0x1d,0xed,0x6d,0xad,0x2d,0xcd,0x4d,0x8d,0x0d,
+ 0xf5,0x75,0xb5,0x35,0xd5,0x55,0x95,0x15,0xe5,0x65,0xa5,0x25,0xc5,0x45,0x85,0x05,
+ 0xf9,0x79,0xb9,0x39,0xd9,0x59,0x99,0x19,0xe9,0x69,0xa9,0x29,0xc9,0x49,0x89,0x09,
+ 0xf1,0x71,0xb1,0x31,0xd1,0x51,0x91,0x11,0xe1,0x61,0xa1,0x21,0xc1,0x41,0x81,0x01,
+ 0xfe,0x7e,0xbe,0x3e,0xde,0x5e,0x9e,0x1e,0xee,0x6e,0xae,0x2e,0xce,0x4e,0x8e,0x0e,
+ 0xf6,0x76,0xb6,0x36,0xd6,0x56,0x96,0x16,0xe6,0x66,0xa6,0x26,0xc6,0x46,0x86,0x06,
+ 0xfa,0x7a,0xba,0x3a,0xda,0x5a,0x9a,0x1a,0xea,0x6a,0xaa,0x2a,0xca,0x4a,0x8a,0x0a,
+ 0xf2,0x72,0xb2,0x32,0xd2,0x52,0x92,0x12,0xe2,0x62,0xa2,0x22,0xc2,0x42,0x82,0x02,
+ 0xfc,0x7c,0xbc,0x3c,0xdc,0x5c,0x9c,0x1c,0xec,0x6c,0xac,0x2c,0xcc,0x4c,0x8c,0x0c,
+ 0xf4,0x74,0xb4,0x34,0xd4,0x54,0x94,0x14,0xe4,0x64,0xa4,0x24,0xc4,0x44,0x84,0x04,
+ 0xf8,0x78,0xb8,0x38,0xd8,0x58,0x98,0x18,0xe8,0x68,0xa8,0x28,0xc8,0x48,0x88,0x08,
+ 0xf0,0x70,0xb0,0x30,0xd0,0x50,0x90,0x10,0xe0,0x60,0xa0,0x20,0xc0,0x40,0x80,0x00
+};
+
+void CSSdescramble(unsigned char *sec,unsigned char *tkey)
+{
+ unsigned int t1,t2,t3,t4,t5,t6;
+ unsigned char *end=sec+0x800;
+
+ t1=tkey[0]^sec[0x54]|0x100;
+ t2=tkey[1]^sec[0x55];
+ t3=(*((unsigned int *)(tkey+2)))^(*((unsigned int *)(sec+0x56)));
+ t4=t3&7;
+ t3=t3*2+8-t4;
+ sec+=0x80;
+ t5=0;
+ while(sec!=end)
+ {
+ t4=CSStab2[t2]^CSStab3[t1];
+ t2=t1>>1;
+ t1=((t1&1)<<8)^t4;
+ t4=CSStab5[t4];
+ t6=(((((((t3>>3)^t3)>>1)^t3)>>8)^t3)>>5)&0xff;
+ t3=(t3<<8)|t6;
+ t6=CSStab4[t6];
+ t5+=t6+t4;
+ *sec++=CSStab1[*sec]^(t5&0xff);
+ t5>>=8;
+ }
+}
+
+void CSSdisckey(unsigned char *dkey,unsigned char *pkey)
+{
+ unsigned int t1,t2,t3,t4,t5,t6;
+ unsigned char k[5];
+ int i;
+
+ t1=pkey[0]|0x100;
+ t2=pkey[1];
+ t3=*((unsigned int *)(pkey+2));
+ t4=t3&7;
+ t3=t3*2+8-t4;
+ t5=0;
+ for(i=0;i<5;i++)
+ {
+ t4=CSStab2[t2]^CSStab3[t1];
+ t2=t1>>1;
+ t1=((t1&1)<<8)^t4;
+ t4=CSStab4[t4];
+ t6=(((((((t3>>3)^t3)>>1)^t3)>>8)^t3)>>5)&0xff;
+ t3=(t3<<8)|t6;
+ t6=CSStab4[t6];
+ t5+=t6+t4;
+ k[i]=t5&0xff;
+ t5>>=8;
+ }
+ for(i=9;i>=0;i--)
+ dkey[CSStab0[i+1]]=k[CSStab0[i+1]]^CSStab1[dkey[CSStab0[i+1]]]^dkey[CSStab0[i]];
+}
+
+void CSStitlekey(unsigned char *tkey,unsigned char *dkey)
+{
+ unsigned int t1,t2,t3,t4,t5,t6;
+ unsigned char k[5];
+ int i;
+
+ t1=dkey[0]|0x100;
+ t2=dkey[1];
+ t3=*((unsigned int *)(dkey+2));
+ t4=t3&7;
+ t3=t3*2+8-t4;
+ t5=0;
+ for(i=0;i<5;i++)
+ {
+ t4=CSStab2[t2]^CSStab3[t1];
+ t2=t1>>1;
+ t1=((t1&1)<<8)^t4;
+ t4=CSStab4[t4];
+ t6=(((((((t3>>3)^t3)>>1)^t3)>>8)^t3)>>5)&0xff;
+ t3=(t3<<8)|t6;
+ t6=CSStab5[t6];
+ t5+=t6+t4;
+ k[i]=t5&0xff;
+ t5>>=8;
+ }
+ for(i=9;i>=0;i--)
+ tkey[CSStab0[i+1]]=k[CSStab0[i+1]]^CSStab1[tkey[CSStab0[i+1]]]^tkey[CSStab0[i]];
+}
+
+unsigned char g_PlayerKeys[][6] =
+{
+ // from mplayer:
+ {0x01, 0xaf, 0xe3, 0x12, 0x80},
+ {0x12, 0x11, 0xca, 0x04, 0x3b},
+ {0x14, 0x0c, 0x9e, 0xd0, 0x09},
+ {0x14, 0x71, 0x35, 0xba, 0xe2},
+ {0x1a, 0xa4, 0x33, 0x21, 0xa6},
+ {0x26, 0xec, 0xc4, 0xa7, 0x4e},
+ {0x2c, 0xb2, 0xc1, 0x09, 0xee},
+ {0x2f, 0x25, 0x9e, 0x96, 0xdd},
+ {0x33, 0x2f, 0x49, 0x6c, 0xe0},
+ {0x35, 0x5b, 0xc1, 0x31, 0x0f},
+ {0x36, 0x67, 0xb2, 0xe3, 0x85},
+ {0x39, 0x3d, 0xf1, 0xf1, 0xbd},
+ {0x3b, 0x31, 0x34, 0x0d, 0x91},
+ {0x45, 0xed, 0x28, 0xeb, 0xd3},
+ {0x48, 0xb7, 0x6c, 0xce, 0x69},
+ {0x4b, 0x65, 0x0d, 0xc1, 0xee},
+ {0x4c, 0xbb, 0xf5, 0x5b, 0x23},
+ {0x51, 0x67, 0x67, 0xc5, 0xe0},
+ {0x53, 0x94, 0xe1, 0x75, 0xbf},
+ {0x57, 0x2c, 0x8b, 0x31, 0xae},
+ {0x63, 0xdb, 0x4c, 0x5b, 0x4a},
+ {0x7b, 0x1e, 0x5e, 0x2b, 0x57},
+ {0x85, 0xf3, 0x85, 0xa0, 0xe0},
+ {0xab, 0x1e, 0xe7, 0x7b, 0x72},
+ {0xab, 0x36, 0xe3, 0xeb, 0x76},
+ {0xb1, 0xb8, 0xf9, 0x38, 0x03},
+ {0xb8, 0x5d, 0xd8, 0x53, 0xbd},
+ {0xbf, 0x92, 0xc3, 0xb0, 0xe2},
+ {0xcf, 0x1a, 0xb2, 0xf8, 0x0a},
+ {0xec, 0xa0, 0xcf, 0xb3, 0xff},
+ {0xfc, 0x95, 0xa9, 0x87, 0x35}
+ // TODO: find more player keys
+};
+
+int g_nPlayerKeys = countof(g_PlayerKeys);
diff --git a/src/decss/CSSscramble.h b/src/decss/CSSscramble.h
new file mode 100644
index 000000000..0ea8d9f42
--- /dev/null
+++ b/src/decss/CSSscramble.h
@@ -0,0 +1,8 @@
+#pragma once
+
+extern void CSSdisckey(unsigned char *dkey,unsigned char *pkey);
+extern void CSStitlekey(unsigned char *tkey,unsigned char *dkey);
+extern void CSSdescramble(unsigned char *sector,unsigned char *tkey);
+
+extern unsigned char g_PlayerKeys[][6];
+extern int g_nPlayerKeys; \ No newline at end of file
diff --git a/src/decss/DeCSSInputPin.cpp b/src/decss/DeCSSInputPin.cpp
new file mode 100644
index 000000000..2d121bf4c
--- /dev/null
+++ b/src/decss/DeCSSInputPin.cpp
@@ -0,0 +1,350 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <atlbase.h>
+#include <streams.h>
+#include <dvdmedia.h>
+#include <ks.h>
+#include <ksmedia.h>
+#include "DeCSSInputPin.h"
+#include "..\DSUtil\DSUtil.h"
+#include "CSSauth.h"
+#include "CSSscramble.h"
+
+#include <initguid.h>
+#include "..\..\include\moreuuids.h"
+
+//
+// CDeCSSInputPin
+//
+
+CDeCSSInputPin::CDeCSSInputPin(TCHAR* pObjectName, CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName)
+ : CTransformInputPin(pObjectName, pFilter, phr, pName)
+{
+ m_varient = -1;
+ memset(m_Challenge, 0, sizeof(m_Challenge));
+ memset(m_KeyCheck, 0, sizeof(m_KeyCheck));
+ memset(m_DiscKey, 0, sizeof(m_DiscKey));
+ memset(m_TitleKey, 0, sizeof(m_TitleKey));
+}
+
+STDMETHODIMP CDeCSSInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IKsPropertySet)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IMemInputPin
+
+STDMETHODIMP CDeCSSInputPin::Receive(IMediaSample* pSample)
+{
+ long len = pSample->GetActualDataLength();
+
+ BYTE* p = NULL;
+ if(SUCCEEDED(pSample->GetPointer(&p)) && len > 0)
+ {
+ BYTE* base = p;
+
+ if(m_mt.majortype == MEDIATYPE_DVD_ENCRYPTED_PACK && len == 2048 && (p[0x14]&0x30))
+ {
+ CSSdescramble(p, m_TitleKey);
+ p[0x14] &= ~0x30;
+
+ if(CComQIPtr<IMediaSample2> pMS2 = pSample)
+ {
+ AM_SAMPLE2_PROPERTIES props;
+ memset(&props, 0, sizeof(props));
+ if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props))
+ && (props.dwTypeSpecificFlags & AM_UseNewCSSKey))
+ {
+ props.dwTypeSpecificFlags &= ~AM_UseNewCSSKey;
+ pMS2->SetProperties(sizeof(props), (BYTE*)&props);
+ }
+ }
+ }
+ }
+
+ HRESULT hr = Transform(pSample);
+
+ return hr == S_OK ? __super::Receive(pSample) :
+ hr == S_FALSE ? S_OK : hr;
+}
+
+void CDeCSSInputPin::StripPacket(BYTE*& p, long& len)
+{
+ GUID majortype = m_mt.majortype;
+
+ if(majortype == MEDIATYPE_MPEG2_PACK || majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ if(len > 0 && *(DWORD*)p == 0xba010000) // MEDIATYPE_*_PACK
+ {
+ len -= 14; p += 14;
+ if(int stuffing = (p[-1]&7)) {len -= stuffing; p += stuffing;}
+ majortype = MEDIATYPE_MPEG2_PES;
+ }
+
+ if(majortype == MEDIATYPE_MPEG2_PES)
+ if(len > 0 && *(DWORD*)p == 0xbb010000)
+ {
+ len -= 4; p += 4;
+ int hdrlen = ((p[0]<<8)|p[1]) + 2;
+ len -= hdrlen; p += hdrlen;
+ }
+
+ if(majortype == MEDIATYPE_MPEG2_PES)
+ if(len > 0
+ && ((*(DWORD*)p&0xf0ffffff) == 0xe0010000
+ || (*(DWORD*)p&0xe0ffffff) == 0xc0010000
+ || (*(DWORD*)p&0xbdffffff) == 0xbd010000)) // PES
+ {
+ bool ps1 = (*(DWORD*)p&0xbdffffff) == 0xbd010000;
+
+ len -= 4; p += 4;
+ int expected = ((p[0]<<8)|p[1]);
+ len -= 2; p += 2;
+ BYTE* p0 = p;
+
+ for(int i = 0; i < 16 && *p == 0xff; i++, len--, p++);
+
+ if((*p&0xc0) == 0x80) // mpeg2
+ {
+ len -= 2; p += 2;
+ len -= *p+1; p += *p+1;
+ }
+ else // mpeg1
+ {
+ if((*p&0xc0) == 0x40)
+ {
+ len -= 2; p += 2;
+ }
+
+ if((*p&0x30) == 0x30 || (*p&0x30) == 0x20)
+ {
+ bool pts = !!(*p&0x20), dts = !!(*p&0x10);
+ if(pts) len -= 5; p += 5;
+ if(dts) {ASSERT((*p&0xf0) == 0x10); len -= 5; p += 5;}
+ }
+ else
+ {
+ len--; p++;
+ }
+ }
+
+ if(ps1)
+ {
+ len--; p++;
+ if(m_mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO) {len -= 6; p += 6;}
+ else if(m_mt.subtype == MEDIASUBTYPE_DOLBY_AC3 || m_mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3
+ || m_mt.subtype == MEDIASUBTYPE_DTS || m_mt.subtype == MEDIASUBTYPE_WAVE_DTS) {len -= 3; p += 3;}
+ }
+
+ if(expected > 0)
+ {
+ expected -= (p - p0);
+ len = min(expected, len);
+ }
+ }
+
+ if(len < 0) {ASSERT(0); len = 0;}
+}
+
+// IKsPropertySet
+
+STDMETHODIMP CDeCSSInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
+{
+ if(PropSet != AM_KSPROPSETID_CopyProt)
+ return E_NOTIMPL;
+
+ switch(Id)
+ {
+ case AM_PROPERTY_COPY_MACROVISION:
+ break;
+ case AM_PROPERTY_DVDCOPY_CHLG_KEY: // 3. auth: receive drive nonce word, also store and encrypt the buskey made up of the two nonce words
+ {
+ AM_DVDCOPY_CHLGKEY* pChlgKey = (AM_DVDCOPY_CHLGKEY*)pPropertyData;
+ for(int i = 0; i < 10; i++)
+ m_Challenge[i] = pChlgKey->ChlgKey[9-i];
+
+ CSSkey2(m_varient, m_Challenge, &m_Key[5]);
+
+ CSSbuskey(m_varient, m_Key, m_KeyCheck);
+ }
+ break;
+ case AM_PROPERTY_DVDCOPY_DISC_KEY: // 5. receive the disckey
+ {
+ AM_DVDCOPY_DISCKEY* pDiscKey = (AM_DVDCOPY_DISCKEY*)pPropertyData; // pDiscKey->DiscKey holds the disckey encrypted with itself and the 408 disckeys encrypted with the playerkeys
+
+ bool fSuccess = false;
+
+ for(int j = 0; j < g_nPlayerKeys; j++)
+ {
+ for(int k = 1; k < 409; k++)
+ {
+ BYTE DiscKey[6];
+ for(int i = 0; i < 5; i++)
+ DiscKey[i] = pDiscKey->DiscKey[k*5+i] ^ m_KeyCheck[4-i];
+ DiscKey[5] = 0;
+
+ CSSdisckey(DiscKey, g_PlayerKeys[j]);
+
+ BYTE Hash[6];
+ for(int i = 0; i < 5; i++)
+ Hash[i] = pDiscKey->DiscKey[i] ^ m_KeyCheck[4-i];
+ Hash[5] = 0;
+
+ CSSdisckey(Hash, DiscKey);
+
+ if(!memcmp(Hash, DiscKey, 6))
+ {
+ memcpy(m_DiscKey, DiscKey, 6);
+ j = g_nPlayerKeys;
+ fSuccess = true;
+ break;
+ }
+ }
+ }
+
+ if(!fSuccess)
+ return E_FAIL;
+ }
+ break;
+ case AM_PROPERTY_DVDCOPY_DVD_KEY1: // 2. auth: receive our drive-encrypted nonce word and decrypt it for verification
+ {
+ AM_DVDCOPY_BUSKEY* pKey1 = (AM_DVDCOPY_BUSKEY*)pPropertyData;
+ for(int i = 0; i < 5; i++)
+ m_Key[i] = pKey1->BusKey[4-i];
+
+ m_varient = -1;
+
+ for(int i = 31; i >= 0; i--)
+ {
+ CSSkey1(i, m_Challenge, m_KeyCheck);
+
+ if(memcmp(m_KeyCheck, &m_Key[0], 5) == 0)
+ m_varient = i;
+ }
+ }
+ break;
+ case AM_PROPERTY_DVDCOPY_REGION:
+ break;
+ case AM_PROPERTY_DVDCOPY_SET_COPY_STATE:
+ break;
+ case AM_PROPERTY_DVDCOPY_TITLE_KEY: // 6. receive the title key and decrypt it with the disc key
+ {
+ AM_DVDCOPY_TITLEKEY* pTitleKey = (AM_DVDCOPY_TITLEKEY*)pPropertyData;
+ for(int i = 0; i < 5; i++)
+ m_TitleKey[i] = pTitleKey->TitleKey[i] ^ m_KeyCheck[4-i];
+ m_TitleKey[5] = 0;
+ CSStitlekey(m_TitleKey, m_DiscKey);
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CDeCSSInputPin::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
+{
+ if(PropSet != AM_KSPROPSETID_CopyProt)
+ return E_NOTIMPL;
+
+ switch(Id)
+ {
+ case AM_PROPERTY_DVDCOPY_CHLG_KEY: // 1. auth: send our nonce word
+ {
+ AM_DVDCOPY_CHLGKEY* pChlgKey = (AM_DVDCOPY_CHLGKEY*)pPropertyData;
+ for(int i = 0; i < 10; i++)
+ pChlgKey->ChlgKey[i] = 9 - (m_Challenge[i] = i);
+ *pBytesReturned = sizeof(AM_DVDCOPY_CHLGKEY);
+ }
+ break;
+ case AM_PROPERTY_DVDCOPY_DEC_KEY2: // 4. auth: send back the encrypted drive nonce word to finish the authentication
+ {
+ AM_DVDCOPY_BUSKEY* pKey2 = (AM_DVDCOPY_BUSKEY*)pPropertyData;
+ for(int i = 0; i < 5; i++)
+ pKey2->BusKey[4-i] = m_Key[5+i];
+ *pBytesReturned = sizeof(AM_DVDCOPY_BUSKEY);
+ }
+ break;
+ case AM_PROPERTY_DVDCOPY_REGION:
+ {
+ DVD_REGION* pRegion = (DVD_REGION*)pPropertyData;
+ pRegion->RegionData = 0;
+ pRegion->SystemRegion = 0;
+ *pBytesReturned = sizeof(DVD_REGION);
+ }
+ break;
+ case AM_PROPERTY_DVDCOPY_SET_COPY_STATE:
+ {
+ AM_DVDCOPY_SET_COPY_STATE* pState = (AM_DVDCOPY_SET_COPY_STATE*)pPropertyData;
+ pState->DVDCopyState = AM_DVDCOPYSTATE_AUTHENTICATION_REQUIRED;
+ *pBytesReturned = sizeof(AM_DVDCOPY_SET_COPY_STATE);
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CDeCSSInputPin::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
+{
+ if(PropSet != AM_KSPROPSETID_CopyProt)
+ return E_NOTIMPL;
+
+ switch(Id)
+ {
+ case AM_PROPERTY_COPY_MACROVISION:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDCOPY_CHLG_KEY:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDCOPY_DEC_KEY2:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_PROPERTY_DVDCOPY_DISC_KEY:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDCOPY_DVD_KEY1:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDCOPY_REGION:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDCOPY_SET_COPY_STATE:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDCOPY_TITLE_KEY:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+
+ return S_OK;
+} \ No newline at end of file
diff --git a/src/decss/DeCSSInputPin.h b/src/decss/DeCSSInputPin.h
new file mode 100644
index 000000000..99058dde4
--- /dev/null
+++ b/src/decss/DeCSSInputPin.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+class CDeCSSInputPin : public CTransformInputPin, public IKsPropertySet
+{
+ int m_varient;
+ BYTE m_Challenge[10], m_KeyCheck[5], m_Key[10];
+ BYTE m_DiscKey[6], m_TitleKey[6];
+
+protected:
+ // return S_FALSE here if you don't want the base class
+ // to call CTransformFilter::Receive with this sample
+ virtual HRESULT Transform(IMediaSample* pSample) {return S_OK;}
+
+public:
+ CDeCSSInputPin(TCHAR* pObjectName, CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ void StripPacket(BYTE*& p, long& len);
+
+ // IMemInputPin
+ STDMETHODIMP Receive(IMediaSample* pSample);
+
+ // IKsPropertySet
+ STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength);
+ STDMETHODIMP Get(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength, ULONG* pBytesReturned);
+ STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport);
+}; \ No newline at end of file
diff --git a/src/decss/VobDec.cpp b/src/decss/VobDec.cpp
new file mode 100644
index 000000000..dbf8e0a7f
--- /dev/null
+++ b/src/decss/VobDec.cpp
@@ -0,0 +1,184 @@
+#include "StdAfx.h"
+#include "vobdec.h"
+
+static BYTE reverse[0x100], table[0x100] =
+{
+ 0x33, 0x73, 0x3B, 0x26, 0x63, 0x23, 0x6B, 0x76, 0x3E, 0x7E, 0x36, 0x2B, 0x6E, 0x2E, 0x66, 0x7B,
+ 0xD3, 0x93, 0xDB, 0x06, 0x43, 0x03, 0x4B, 0x96, 0xDE, 0x9E, 0xD6, 0x0B, 0x4E, 0x0E, 0x46, 0x9B,
+ 0x57, 0x17, 0x5F, 0x82, 0xC7, 0x87, 0xCF, 0x12, 0x5A, 0x1A, 0x52, 0x8F, 0xCA, 0x8A, 0xC2, 0x1F,
+ 0xD9, 0x99, 0xD1, 0x00, 0x49, 0x09, 0x41, 0x90, 0xD8, 0x98, 0xD0, 0x01, 0x48, 0x08, 0x40, 0x91,
+ 0x3D, 0x7D, 0x35, 0x24, 0x6D, 0x2D, 0x65, 0x74, 0x3C, 0x7C, 0x34, 0x25, 0x6C, 0x2C, 0x64, 0x75,
+ 0xDD, 0x9D, 0xD5, 0x04, 0x4D, 0x0D, 0x45, 0x94, 0xDC, 0x9C, 0xD4, 0x05, 0x4C, 0x0C, 0x44, 0x95,
+ 0x59, 0x19, 0x51, 0x80, 0xC9, 0x89, 0xC1, 0x10, 0x58, 0x18, 0x50, 0x81, 0xC8, 0x88, 0xC0, 0x11,
+ 0xD7, 0x97, 0xDF, 0x02, 0x47, 0x07, 0x4F, 0x92, 0xDA, 0x9A, 0xD2, 0x0F, 0x4A, 0x0A, 0x42, 0x9F,
+ 0x53, 0x13, 0x5B, 0x86, 0xC3, 0x83, 0xCB, 0x16, 0x5E, 0x1E, 0x56, 0x8B, 0xCE, 0x8E, 0xC6, 0x1B,
+ 0xB3, 0xF3, 0xBB, 0xA6, 0xE3, 0xA3, 0xEB, 0xF6, 0xBE, 0xFE, 0xB6, 0xAB, 0xEE, 0xAE, 0xE6, 0xFB,
+ 0x37, 0x77, 0x3F, 0x22, 0x67, 0x27, 0x6F, 0x72, 0x3A, 0x7A, 0x32, 0x2F, 0x6A, 0x2A, 0x62, 0x7F,
+ 0xB9, 0xF9, 0xB1, 0xA0, 0xE9, 0xA9, 0xE1, 0xF0, 0xB8, 0xF8, 0xB0, 0xA1, 0xE8, 0xA8, 0xE0, 0xF1,
+ 0x5D, 0x1D, 0x55, 0x84, 0xCD, 0x8D, 0xC5, 0x14, 0x5C, 0x1C, 0x54, 0x85, 0xCC, 0x8C, 0xC4, 0x15,
+ 0xBD, 0xFD, 0xB5, 0xA4, 0xED, 0xAD, 0xE5, 0xF4, 0xBC, 0xFC, 0xB4, 0xA5, 0xEC, 0xAC, 0xE4, 0xF5,
+ 0x39, 0x79, 0x31, 0x20, 0x69, 0x29, 0x61, 0x70, 0x38, 0x78, 0x30, 0x21, 0x68, 0x28, 0x60, 0x71,
+ 0xB7, 0xF7, 0xBF, 0xA2, 0xE7, 0xA7, 0xEF, 0xF2, 0xBA, 0xFA, 0xB2, 0xAF, 0xEA, 0xAA, 0xE2, 0xFF,
+};
+
+CVobDec::CVobDec()
+{
+ m_fFoundKey = false;
+
+ for(DWORD loop0 = 0; loop0 < 0x100; loop0++)
+ {
+ BYTE value = 0;
+
+ for(DWORD loop1 = 0; loop1 < 8; loop1++)
+ {
+ value |= ((loop0 >> loop1) & 1) << (7 - loop1);
+ }
+
+ reverse[loop0] = value;
+ }
+
+}
+
+CVobDec::~CVobDec()
+{
+}
+
+void CVobDec::ClockLfsr0Forward(int &lfsr0)
+{
+ int temp = (lfsr0 << 3) | (lfsr0 >> 14);
+ lfsr0 = (lfsr0 >> 8) | ((((((temp << 3) ^ temp) << 3) ^ temp ^ lfsr0) & 0xFF) << 9);
+}
+
+void CVobDec::ClockLfsr1Forward(int &lfsr1)
+{
+ lfsr1 = (lfsr1 >> 8) | ((((((((lfsr1 >> 8) ^ lfsr1) >> 1) ^ lfsr1) >> 3) ^ lfsr1) & 0xFF) << 17);
+}
+
+void CVobDec::ClockBackward(int &lfsr0, int &lfsr1)
+{
+ int temp0, temp1;
+
+ lfsr0 = ((lfsr0 << 8) ^ ((((lfsr0 >> 3) ^ lfsr0) >> 6) & 0xFF)) & ((1 << 17) - 1);
+ temp0 = ((lfsr1 >> 17) ^ (lfsr1 >> 4)) & 0xFF;
+ temp1 = (lfsr1 << 5) | (temp0 >> 3);
+ temp1 = ((temp1 >> 1) ^ temp1) & 0xFF;
+ lfsr1 = ((lfsr1 << 8) | ((((((temp1 >> 2) ^ temp1) >> 1) ^ temp1) >> 3) ^ temp1 ^ temp0)) & ((1 << 25) - 1);
+}
+
+void CVobDec::Salt(const BYTE salt[5], int &lfsr0, int &lfsr1)
+{
+ lfsr0 ^= (reverse[salt[0]] << 9) | reverse[salt[1]];
+ lfsr1 ^= ((reverse[salt[2]] & 0xE0) << 17) | ((reverse[salt[2]] & 0x1F) << 16) | (reverse[salt[3]] << 8) | reverse[salt[4]];
+}
+
+int CVobDec::FindLfsr(const BYTE *crypt, int offset, const BYTE *plain)
+{
+ int loop0, loop1, lfsr0, lfsr1, carry, count;
+
+ for(loop0 = count = 0; loop0 != (1 << 18); loop0++)
+ {
+ lfsr0 = loop0 >> 1;
+ carry = loop0 & 0x01;
+
+ for(loop1 = lfsr1 = 0; loop1 != 4; loop1++)
+ {
+ ClockLfsr0Forward(lfsr0);
+ carry = (table[crypt[offset + loop1]] ^ plain[loop1]) - ((lfsr0 >> 9) ^ 0xFF) - carry;
+ lfsr1 = (lfsr1 >> 8) | ((carry & 0xFF) << 17);
+ carry = (carry >> 8) & 0x01;
+ }
+ for( ; loop1 != 7; loop1++)
+ {
+ ClockLfsr0Forward(lfsr0);
+ ClockLfsr1Forward(lfsr1);
+ carry += ((lfsr0 >> 9) ^ 0xFF) + (lfsr1 >> 17);
+ if((carry & 0xFF) != (table[crypt[offset + loop1]] ^ plain[loop1]))
+ {
+ break;
+ }
+ carry >>= 8;
+ }
+ if(loop1 == 7)
+ {
+ for(loop1 = 0; loop1 != 6; loop1++)
+ {
+ ClockBackward(lfsr0, lfsr1);
+ }
+ carry = ((lfsr0 >> 9) ^ 0xFF) + (lfsr1 >> 17) + (loop0 & 0x01);
+ if((carry & 0xFF) == (table[crypt[offset]] ^ plain[0]))
+ {
+ for(loop1 = 0; loop1 != offset + 1; loop1++)
+ {
+ ClockBackward(lfsr0, lfsr1);
+ }
+ if(lfsr0 & 0x100 && lfsr1 & 0x200000)
+ {
+ m_lfsr0 = lfsr0;
+ m_lfsr1 = lfsr1;
+ count++;
+ }
+ }
+ }
+ }
+
+ return count;
+}
+
+bool CVobDec::FindKey(BYTE* buff)
+{
+ BYTE plain[7] = {0x00, 0x00, 0x01, 0xBE, 0x00, 0x00, 0xFF};
+ int offset, left, flag = 0, block = 0, count, maxblock = 20000;
+
+ m_fFoundKey = false;
+
+ if(buff[0x14] & 0x30)
+ {
+ flag |= 0x01;
+
+ if(*(DWORD*)&buff[0x00] == 0xba010000 && (*(DWORD*)&buff[0x0e] & 0xffffff) == 0x010000)
+ {
+ offset = 0x14 + (buff[0x12] << 8) + buff[0x13];
+ if(0x80 <= offset && offset <= 0x7F9)
+ {
+ flag |= 0x02;
+ left = 0x800 - offset - 6;
+ plain[4] = (char)(left >> 8);
+ plain[5] = (char)left;
+ if((count = FindLfsr(buff + 0x80, offset - 0x80, plain)) == 1)
+ {
+ Salt(buff + 0x54, m_lfsr0, m_lfsr1);
+ m_fFoundKey = true;
+ }
+ else if(count)
+ {
+// printf(_T("\rblock %d reported %d possible keys, skipping\n"), block, count);
+ }
+ }
+ }
+ }
+
+ return(m_fFoundKey);
+}
+
+void CVobDec::Decrypt(BYTE* buff)
+{
+ if(buff[0x14] & 0x30)
+ {
+ buff[0x14] &= ~0x30;
+
+ int lfsr0 = m_lfsr0, lfsr1 = m_lfsr1;
+
+ Salt(buff + 0x54, lfsr0, lfsr1);
+
+ buff += 0x80;
+
+ for(int loop0 = 0, carry = 0; loop0 != 0x800 - 0x80; loop0++, buff++)
+ {
+ ClockLfsr0Forward(lfsr0);
+ ClockLfsr1Forward(lfsr1);
+ carry += ((lfsr0 >> 9) ^ 0xFF) + (lfsr1 >> 17);
+ *buff = BYTE(table[*buff] ^ carry);
+ carry >>= 8;
+ }
+ }
+}
diff --git a/src/decss/VobDec.h b/src/decss/VobDec.h
new file mode 100644
index 000000000..9b3e5cef8
--- /dev/null
+++ b/src/decss/VobDec.h
@@ -0,0 +1,21 @@
+#pragma once
+
+class CVobDec
+{
+ int m_lfsr0, m_lfsr1;
+
+ void ClockLfsr0Forward(int& lfsr0);
+ void ClockLfsr1Forward(int& lfsr1);
+ void ClockBackward(int& lfsr0, int& lfsr1);
+ void Salt(const BYTE salt[5], int& lfsr0, int& lfsr1);
+ int FindLfsr(const BYTE* crypt, int offset, const BYTE* plain);
+
+public:
+ CVobDec();
+ virtual ~CVobDec();
+
+ bool m_fFoundKey;
+
+ bool FindKey(BYTE* buff);
+ void Decrypt(BYTE* buff);
+};
diff --git a/src/decss/VobFile.cpp b/src/decss/VobFile.cpp
new file mode 100644
index 000000000..9215c0c48
--- /dev/null
+++ b/src/decss/VobFile.cpp
@@ -0,0 +1,639 @@
+#include "StdAfx.h"
+#include <io.h>
+#include "VobFile.h"
+#include "CSSauth.h"
+#include "CSSscramble.h"
+#include "udf.h"
+
+//
+// CDVDSession
+//
+
+CDVDSession::CDVDSession()
+ : m_session(DVD_END_ALL_SESSIONS)
+ , m_hDrive(INVALID_HANDLE_VALUE)
+{
+}
+
+CDVDSession::~CDVDSession()
+{
+ EndSession();
+}
+
+bool CDVDSession::Open(LPCTSTR path)
+{
+ Close();
+
+ CString fn = path;
+ CString drive = _T("\\\\.\\") + fn.Left(fn.Find(':')+1);
+
+ m_hDrive = CreateFile(drive, GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_READONLY|FILE_FLAG_SEQUENTIAL_SCAN, (HANDLE)NULL);
+ if(m_hDrive == INVALID_HANDLE_VALUE)
+ return(false);
+
+ return(true);
+}
+
+void CDVDSession::Close()
+{
+ if(m_hDrive != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(m_hDrive);
+ m_hDrive = INVALID_HANDLE_VALUE;
+ }
+}
+
+bool CDVDSession::BeginSession()
+{
+ EndSession();
+
+ if(m_hDrive == INVALID_HANDLE_VALUE)
+ return(false);
+
+ DWORD BytesReturned;
+ if(!DeviceIoControl(m_hDrive, IOCTL_DVD_START_SESSION, NULL, 0, &m_session, sizeof(m_session), &BytesReturned, NULL))
+ {
+ m_session = DVD_END_ALL_SESSIONS;
+ if(!DeviceIoControl(m_hDrive, IOCTL_DVD_END_SESSION, &m_session, sizeof(m_session), NULL, 0, &BytesReturned, NULL)
+ || !DeviceIoControl(m_hDrive, IOCTL_DVD_START_SESSION, NULL, 0, &m_session, sizeof(m_session), &BytesReturned, NULL))
+ {
+ CloseHandle(m_hDrive);
+ DWORD err = GetLastError();
+ return(false);
+ }
+ }
+
+ return(true);
+}
+
+void CDVDSession::EndSession()
+{
+ if(m_session != DVD_END_ALL_SESSIONS)
+ {
+ DWORD BytesReturned;
+ DeviceIoControl(m_hDrive, IOCTL_DVD_END_SESSION, &m_session, sizeof(m_session), NULL, 0, &BytesReturned, NULL);
+ m_session = DVD_END_ALL_SESSIONS;
+ }
+}
+
+bool CDVDSession::Authenticate()
+{
+ if(m_session == DVD_END_ALL_SESSIONS)
+ return(false);
+
+ BYTE Challenge[10], Key[10];
+
+ for(int i = 0; i < 10; i++) Challenge[i] = i;
+
+ if(!SendKey(DvdChallengeKey, Challenge))
+ return(false);
+
+ if(!ReadKey(DvdBusKey1, Key))
+ return(false);
+
+ int varient = -1;
+
+ for(int i = 31; i >= 0; i--)
+ {
+ BYTE KeyCheck[5];
+ CSSkey1(i, Challenge, KeyCheck);
+ if(!memcmp(KeyCheck, Key, 5))
+ varient = i;
+ }
+
+ if(!ReadKey(DvdChallengeKey, Challenge))
+ return(false);
+
+ CSSkey2(varient, Challenge, &Key[5]);
+
+ if(!SendKey(DvdBusKey2, &Key[5]))
+ return(false);
+
+ CSSbuskey(varient, Key, m_SessionKey);
+
+ return(true);
+}
+
+bool CDVDSession::GetDiscKey()
+{
+ if(m_session == DVD_END_ALL_SESSIONS)
+ return(false);
+
+ BYTE DiscKeys[2048];
+ if(!ReadKey(DvdDiskKey, DiscKeys))
+ return(false);
+
+ for(int i = 0; i < g_nPlayerKeys; i++)
+ {
+ for(int j = 1; j < 409; j++)
+ {
+ BYTE DiscKey[6];
+ memcpy(DiscKey, &DiscKeys[j*5], 5);
+ DiscKey[5] = 0;
+
+ CSSdisckey(DiscKey, g_PlayerKeys[i]);
+
+ BYTE Hash[6];
+ memcpy(Hash, &DiscKeys[0], 5);
+ Hash[5] = 0;
+
+ CSSdisckey(Hash, DiscKey);
+
+ if(!memcmp(Hash, DiscKey, 6))
+ {
+ memcpy(m_DiscKey, DiscKey, 6);
+ return(true);
+ }
+ }
+ }
+
+ return(false);
+}
+
+bool CDVDSession::GetTitleKey(int lba, BYTE* pKey)
+{
+ if(m_session == DVD_END_ALL_SESSIONS)
+ return(false);
+
+ if(!ReadKey(DvdTitleKey, pKey, lba))
+ return(false);
+
+ if(!(pKey[0]|pKey[1]|pKey[2]|pKey[3]|pKey[4]))
+ return(false);
+
+ pKey[5] = 0;
+
+ CSStitlekey(pKey, m_DiscKey);
+
+ return(true);
+}
+
+static void Reverse(BYTE* d, BYTE* s, int len)
+{
+ if(d == s)
+ {
+ for(s += len-1; d < s; d++, s--)
+ *d ^= *s, *s ^= *d, *d ^= *s;
+ }
+ else
+ {
+ for(int i = 0; i < len; i++)
+ d[i] = s[len-1 - i];
+ }
+}
+
+bool CDVDSession::SendKey(DVD_KEY_TYPE KeyType, BYTE* pKeyData)
+{
+ CAutoPtr<DVD_COPY_PROTECT_KEY> key;
+
+ switch(KeyType)
+ {
+ case DvdChallengeKey:
+ key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_CHALLENGE_KEY_LENGTH]);
+ key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
+ Reverse(key->KeyData, pKeyData, 10);
+ break;
+ case DvdBusKey2:
+ key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_BUS_KEY_LENGTH]);
+ key->KeyLength = DVD_BUS_KEY_LENGTH;
+ Reverse(key->KeyData, pKeyData, 5);
+ break;
+ default:
+ break;
+ }
+
+ if(!key)
+ return(false);
+
+ key->SessionId = m_session;
+ key->KeyType = KeyType;
+ key->KeyFlags = 0;
+
+ DWORD BytesReturned;
+ return(!!DeviceIoControl(m_hDrive, IOCTL_DVD_SEND_KEY, key, key->KeyLength, NULL, 0, &BytesReturned, NULL));
+}
+
+bool CDVDSession::ReadKey(DVD_KEY_TYPE KeyType, BYTE* pKeyData, int lba)
+{
+ CAutoPtr<DVD_COPY_PROTECT_KEY> key;
+
+ switch(KeyType)
+ {
+ case DvdChallengeKey:
+ key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_CHALLENGE_KEY_LENGTH]);
+ key->KeyLength = DVD_CHALLENGE_KEY_LENGTH;
+ key->Parameters.TitleOffset.QuadPart = 0;
+ break;
+ case DvdBusKey1:
+ key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_BUS_KEY_LENGTH]);
+ key->KeyLength = DVD_BUS_KEY_LENGTH;
+ key->Parameters.TitleOffset.QuadPart = 0;
+ break;
+ case DvdDiskKey:
+ key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_DISK_KEY_LENGTH]);
+ key->KeyLength = DVD_DISK_KEY_LENGTH;
+ key->Parameters.TitleOffset.QuadPart = 0;
+ break;
+ case DvdTitleKey:
+ key.Attach((DVD_COPY_PROTECT_KEY*)new BYTE[DVD_TITLE_KEY_LENGTH]);
+ key->KeyLength = DVD_TITLE_KEY_LENGTH;
+ key->Parameters.TitleOffset.QuadPart = 2048i64*lba;
+ break;
+ default:
+ break;
+ }
+
+ if(!key)
+ return(false);
+
+ key->SessionId = m_session;
+ key->KeyType = KeyType;
+ key->KeyFlags = 0;
+
+ DWORD BytesReturned;
+ if(!DeviceIoControl(m_hDrive, IOCTL_DVD_READ_KEY, key, key->KeyLength, key, key->KeyLength, &BytesReturned, NULL))
+ {
+ DWORD err = GetLastError();
+ return(false);
+ }
+
+ switch(KeyType)
+ {
+ case DvdChallengeKey:
+ Reverse(pKeyData, key->KeyData, 10);
+ break;
+ case DvdBusKey1:
+ Reverse(pKeyData, key->KeyData, 5);
+ break;
+ case DvdDiskKey:
+ memcpy(pKeyData, key->KeyData, 2048);
+ for(int i = 0; i < 2048/5; i++)
+ pKeyData[i] ^= m_SessionKey[4-(i%5)];
+ break;
+ case DvdTitleKey:
+ memcpy(pKeyData, key->KeyData, 5);
+ for(int i = 0; i < 5; i++)
+ pKeyData[i] ^= m_SessionKey[4-(i%5)];
+ break;
+ default:
+ break;
+ }
+
+ return(true);
+}
+
+//
+// CLBAFile
+//
+
+CLBAFile::CLBAFile()
+{
+}
+
+CLBAFile::~CLBAFile()
+{
+}
+
+bool CLBAFile::IsOpen()
+{
+ return(m_hFile != hFileNull);
+}
+
+bool CLBAFile::Open(LPCTSTR path)
+{
+ Close();
+
+ return(!!CFile::Open(path, modeRead|typeBinary|shareDenyWrite|osSequentialScan));
+}
+
+void CLBAFile::Close()
+{
+ if(m_hFile != hFileNull)
+ CFile::Close();
+}
+
+int CLBAFile::GetLength()
+{
+ return (int)(CFile::GetLength()/2048);
+}
+
+int CLBAFile::GetPosition()
+{
+ return (int)(CFile::GetPosition()/2048);
+}
+
+int CLBAFile::Seek(int lba)
+{
+ return (int)(CFile::Seek(2048i64*lba, CFile::begin)/2048);
+}
+
+bool CLBAFile::Read(BYTE* buff)
+{
+ return CFile::Read(buff, 2048) == 2048;
+}
+
+//
+// CVobFile
+//
+
+CVobFile::CVobFile()
+{
+ Close();
+}
+
+CVobFile::~CVobFile()
+{
+}
+
+bool CVobFile::IsDVD()
+{
+ return m_fDVD;
+}
+
+bool CVobFile::HasDiscKey(BYTE* key)
+{
+ if(key) memcpy(key, m_DiscKey, 5);
+ return m_fHasDiscKey;
+}
+
+bool CVobFile::HasTitleKey(BYTE* key)
+{
+ if(key) memcpy(key, m_TitleKey, 5);
+ return m_fHasTitleKey;
+}
+
+bool CVobFile::Open(CString fn, CAtlList<CString>& vobs)
+{
+ CFile f;
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ return(false);
+
+ char hdr[13];
+ f.Read(hdr, 12);
+ hdr[12] = 0;
+ if(strcmp(hdr, "DVDVIDEO-VTS"))
+ return(false);
+
+ f.Close();
+
+ int offset = -1;
+
+ vobs.RemoveAll();
+
+ fn = fn.Left(fn.ReverseFind('.')+1);
+ fn.TrimRight(_T(".0123456789"));
+ for(int i = 0; i < 100; i++)
+ {
+ CString vob;
+ vob.Format(_T("%s%d.vob"), fn, i);
+
+ CFileStatus status;
+ if(!CFile::GetStatus(vob, status))
+ {
+ if(i == 0) continue;
+ else break;
+ }
+
+ if(status.m_size&0x7ff)
+ {
+ vobs.RemoveAll();
+ break;
+ }
+
+ if(status.m_size > 0)
+ vobs.AddTail(vob);
+
+ if(i == 0)
+ offset = (int)(status.m_size/0x800);
+ }
+
+ return Open(vobs, offset);
+}
+
+bool CVobFile::Open(CAtlList<CString>& vobs, int offset)
+{
+ Close();
+
+ if(vobs.GetCount() == 0)
+ return(false);
+
+ if(vobs.GetCount() == 1)
+ offset = -1;
+
+ m_offset = offset;
+
+ POSITION pos = vobs.GetHeadPosition();
+ while(pos)
+ {
+ CString fn = vobs.GetNext(pos);
+
+ WIN32_FIND_DATA fd;
+ HANDLE h = FindFirstFile(fn, &fd);
+ if(h == INVALID_HANDLE_VALUE)
+ {
+ m_files.RemoveAll();
+ return(false);
+ }
+ FindClose(h);
+
+ file_t f;
+ f.fn = fn;
+ f.size = (int)(((__int64(fd.nFileSizeHigh)<<32)|fd.nFileSizeLow)/2048);
+ m_files.Add(f);
+
+ m_size += f.size;
+ }
+
+ if(m_files.GetCount() > 0 && CDVDSession::Open(m_files[0].fn))
+ {
+ for(int i = 0; !m_fHasTitleKey && i < m_files.GetCount(); i++)
+ {
+ if(BeginSession())
+ {
+ m_fDVD = true;
+ Authenticate();
+ m_fHasDiscKey = GetDiscKey();
+ EndSession();
+ }
+ else
+ {
+ CString fn = m_files[0].fn;
+ fn.MakeLower();
+
+ if(fn.Find(_T(":\\video_ts")) == 1 && GetDriveType(fn.Left(3)) == DRIVE_CDROM)
+ {
+ m_fDVD = true;
+ }
+
+ break;
+ }
+
+ if(tp_udf_file f = udf_find_file(m_hDrive, 0, CStringA(m_files[i].fn.Mid(m_files[i].fn.Find(':')+1))))
+ {
+ DWORD start, end;
+ if(udf_get_lba(m_hDrive, f, &start, &end))
+ {
+ if(BeginSession())
+ {
+ Authenticate();
+ m_fHasTitleKey = GetTitleKey(start + f->partition_lba, m_TitleKey);
+ EndSession();
+ }
+ }
+
+ udf_free(f);
+ }
+
+ BYTE key[5];
+ if(HasTitleKey(key) && i == 0 && offset >= 0)
+ {
+ i++;
+
+ if(BeginSession())
+ {
+ m_fDVD = true;
+ Authenticate();
+ m_fHasDiscKey = GetDiscKey();
+ EndSession();
+ }
+ else
+ {
+ break;
+ }
+
+ if(tp_udf_file f = udf_find_file(m_hDrive, 0, CStringA(m_files[i].fn.Mid(m_files[i].fn.Find(':')+1))))
+ {
+ DWORD start, end;
+ if(udf_get_lba(m_hDrive, f, &start, &end))
+ {
+ if(BeginSession())
+ {
+ Authenticate();
+ m_fHasTitleKey = GetTitleKey(start + f->partition_lba, m_TitleKey);
+ EndSession();
+ }
+ }
+
+ udf_free(f);
+ }
+
+ if(!m_fHasTitleKey)
+ {
+ memcpy(m_TitleKey, key, 5);
+ m_fHasTitleKey = true;
+ }
+ }
+ }
+ }
+/*
+ if(m_files.GetCount() > 0 && !m_fDVD)
+ {
+ CString fn = m_files[0].fn;
+ fn.MakeLower();
+
+ if(fn.Find(_T(":\\video_ts")) == 1 && GetDriveType(fn.Left(3)) == DRIVE_CDROM)
+ {
+ m_fDVD = true;
+ }
+ }
+*/
+ m_offset = max(offset, 0);
+
+ return(true);
+}
+
+void CVobFile::Close()
+{
+ CDVDSession::Close();
+ m_files.RemoveAll();
+ m_iFile = -1;
+ m_pos = m_size = m_offset = 0;
+ m_file.Close();
+ m_fDVD = m_fHasDiscKey = m_fHasTitleKey = false;
+}
+
+int CVobFile::GetLength()
+{
+ return(m_size - m_offset);
+}
+
+int CVobFile::GetPosition()
+{
+ return(m_pos - m_offset);
+}
+
+int CVobFile::Seek(int pos)
+{
+ pos = min(max(pos+m_offset, m_offset), m_size-1);
+
+ int i = -1;
+ int size = 0;
+
+ // this suxx, but won't take long
+ do size += m_files[++i].size;
+ while(i < m_files.GetCount() && pos >= size);
+
+ if(i != m_iFile && i < m_files.GetCount())
+ {
+ if(!m_file.Open(m_files[i].fn))
+ return(m_pos);
+
+ m_iFile = i;
+ }
+
+ m_pos = pos;
+
+ pos -= (size - m_files[i].size);
+ m_file.Seek(pos);
+
+ return(GetPosition());
+}
+
+bool CVobFile::Read(BYTE* buff)
+{
+ if(m_pos >= m_size) return(false);
+
+ if(m_file.IsOpen() && m_file.GetPosition() == m_file.GetLength())
+ {
+ m_file.Close();
+ }
+
+ if(!m_file.IsOpen())
+ {
+ if(m_iFile >= m_files.GetCount()-1)
+ {
+ return(false);
+ }
+
+ if(!m_file.Open(m_files[++m_iFile].fn))
+ {
+ m_iFile = -1;
+ return(false);
+ }
+ }
+
+ if(!m_file.Read(buff))
+ {
+ // dvd still locked?
+ return(false);
+ }
+
+ m_pos++;
+
+ if(buff[0x14] & 0x30)
+ {
+ if(m_fHasTitleKey)
+ {
+ CSSdescramble(buff, m_TitleKey);
+ buff[0x14] &= ~0x30;
+ }
+ else
+ {
+ // under win9x this is normal, but I'm not developing under win9x :P
+ ASSERT(0);
+ }
+ }
+
+ return(true);
+}
diff --git a/src/decss/VobFile.h b/src/decss/VobFile.h
new file mode 100644
index 000000000..4be1dbcb7
--- /dev/null
+++ b/src/decss/VobFile.h
@@ -0,0 +1,87 @@
+#pragma once
+
+#pragma warning(disable : 4200)
+
+#include <atlbase.h>
+#include <atlcoll.h>
+//#include <winioctl.h> // platform sdk
+#include "..\..\include\winddk\ntddcdvd.h"
+
+class CDVDSession
+{
+protected:
+ HANDLE m_hDrive;
+
+ DVD_SESSION_ID m_session;
+ bool BeginSession();
+ void EndSession();
+
+ BYTE m_SessionKey[5];
+ bool Authenticate();
+
+ BYTE m_DiscKey[6], m_TitleKey[6];
+ bool GetDiscKey();
+ bool GetTitleKey(int lba, BYTE* pKey);
+
+public:
+ CDVDSession();
+ virtual ~CDVDSession();
+
+ bool Open(LPCTSTR path);
+ void Close();
+
+ operator HANDLE() {return m_hDrive;}
+ operator DVD_SESSION_ID() {return m_session;}
+
+ bool SendKey(DVD_KEY_TYPE KeyType, BYTE* pKeyData);
+ bool ReadKey(DVD_KEY_TYPE KeyType, BYTE* pKeyData, int lba = 0);
+};
+
+class CLBAFile : private CFile
+{
+public:
+ CLBAFile();
+ virtual ~CLBAFile();
+
+ bool IsOpen();
+
+ bool Open(LPCTSTR path);
+ void Close();
+
+ int GetLength();
+ int GetPosition();
+ int Seek(int lba);
+ bool Read(BYTE* buff);
+};
+
+class CVobFile : public CDVDSession
+{
+ // all files
+ typedef struct {CString fn; int size;} file_t;
+ CAtlArray<file_t> m_files;
+ int m_iFile;
+ int m_pos, m_size, m_offset;
+
+ // currently opened file
+ CLBAFile m_file;
+
+ // attribs
+ bool m_fDVD, m_fHasDiscKey, m_fHasTitleKey;
+
+public:
+ CVobFile();
+ virtual ~CVobFile();
+
+ bool IsDVD();
+ bool HasDiscKey(BYTE* key);
+ bool HasTitleKey(BYTE* key);
+
+ bool Open(CString fn, CAtlList<CString>& files /* out */); // vts ifo
+ bool Open(CAtlList<CString>& files, int offset = -1); // vts vobs, video vob offset in lba
+ void Close();
+
+ int GetLength();
+ int GetPosition();
+ int Seek(int pos);
+ bool Read(BYTE* buff);
+};
diff --git a/src/decss/decss.h b/src/decss/decss.h
new file mode 100644
index 000000000..93fd76c45
--- /dev/null
+++ b/src/decss/decss.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#include "CSSauth.h"
+#include "CSSscramble.h"
+#include "DVDSession.h" \ No newline at end of file
diff --git a/src/decss/decss.sln b/src/decss/decss.sln
new file mode 100644
index 000000000..fcd6c1181
--- /dev/null
+++ b/src/decss/decss.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decss", "decss.vcproj", "{1A2DFD1A-3C6C-44D1-909D-294AF646B575}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.ActiveCfg = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.Build.0 = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.ActiveCfg = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.Build.0 = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/decss/decss.vcproj b/src/decss/decss.vcproj
new file mode 100644
index 000000000..4effa274f
--- /dev/null
+++ b/src/decss/decss.vcproj
@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="decss"
+ ProjectGUID="{1A2DFD1A-3C6C-44D1-909D-294AF646B575}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="CSSauth.cpp">
+ </File>
+ <File
+ RelativePath="CSSscramble.cpp">
+ </File>
+ <File
+ RelativePath=".\DeCSSInputPin.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="VobDec.cpp">
+ </File>
+ <File
+ RelativePath="VobFile.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="CSSauth.h">
+ </File>
+ <File
+ RelativePath="CSSscramble.h">
+ </File>
+ <File
+ RelativePath="decss.h">
+ </File>
+ <File
+ RelativePath=".\DeCSSInputPin.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="VobDec.h">
+ </File>
+ <File
+ RelativePath="VobFile.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ <Filter
+ Name="vstrip"
+ Filter="">
+ <File
+ RelativePath="udf.cpp">
+ </File>
+ <File
+ RelativePath="udf.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/decss/decss.vcproj.vspscc b/src/decss/decss.vcproj.vspscc
new file mode 100644
index 000000000..78331ece4
--- /dev/null
+++ b/src/decss/decss.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:decss"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/src/decss/stdafx.cpp b/src/decss/stdafx.cpp
new file mode 100644
index 000000000..f06429c1f
--- /dev/null
+++ b/src/decss/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// decss.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/decss/stdafx.h b/src/decss/stdafx.h
new file mode 100644
index 000000000..58101e98b
--- /dev/null
+++ b/src/decss/stdafx.h
@@ -0,0 +1,18 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
diff --git a/src/decss/udf.cpp b/src/decss/udf.cpp
new file mode 100644
index 000000000..a91a6cde2
--- /dev/null
+++ b/src/decss/udf.cpp
@@ -0,0 +1,355 @@
+/*************************************************************************
+ vStrip by [maven] (maven@maven.de)
+ udf.c: routines for udf-parsing (because windows just doesn't cut it),
+ refs: udf102.pdf, udf200.pdf, ecma 167
+ (tabsize 2)
+*************************************************************************/
+
+#include "stdafx.h"
+#include "udf.h"
+
+static bool aspi_GetSectorInfo(const HANDLE hDrive, DWORD* sec_size, DWORD* max_sec)
+{
+ LARGE_INTEGER size;
+ size.LowPart = GetFileSize(hDrive, (DWORD*)&size.HighPart);
+
+ *sec_size = 2048;
+ *max_sec = size.QuadPart / *sec_size;
+
+ return true;
+}
+
+static bool aspi_ReadSectors(const HANDLE hDrive, int lba, int nSectors, DWORD sec_size, BYTE* sector)
+{
+ DWORD nbr = 0;
+ return lba*sec_size == SetFilePointer(hDrive, lba*sec_size, NULL, FILE_BEGIN)
+ && ReadFile(hDrive, sector, nSectors*sec_size, &nbr, NULL);
+}
+
+static bool udf_GetLBA(const tp_udf_FileEntry fe, const DWORD sec_size, DWORD *start, DWORD *end)
+{
+ if (fe->LengthofAllocationDescriptors == 0)
+ return false;
+ switch (fe->ICBTag.Flags & udf_icbf_Mask)
+ {
+ case udf_icbf_ShortAd:
+ {
+ tp_udf_short_ad ad = (tp_udf_short_ad)(fe->ExtendedAttributes + fe->LengthofExtendedAttributes);
+
+ *start = ad->Location;
+ *end = *start + ((ad->Length & udf_LengthMask) - 1) / sec_size;
+ return true;
+ }
+ break;
+ case udf_icbf_LongAd:
+ {
+ tp_udf_long_ad ad = (tp_udf_long_ad)(fe->ExtendedAttributes + fe->LengthofExtendedAttributes);
+
+ *start = ad->Location.Location; // ignore partition number
+ *end = *start + ((ad->Length & udf_LengthMask) - 1) / sec_size;
+ return true;
+ }
+ break;
+ case udf_icbf_ExtAd:
+ {
+ tp_udf_ext_ad ad = (tp_udf_ext_ad)(fe->ExtendedAttributes + fe->LengthofExtendedAttributes);
+
+ *start = ad->Location.Location; // ignore partition number
+ *end = *start + ((ad->Length & udf_LengthMask) - 1) / sec_size;
+ return true;
+ }
+ break;
+ }
+ return false;
+}
+
+tp_udf_file udf_get_root(const HANDLE hDrive, const WORD partition_number)
+{
+ BYTE sector[fio_SECTOR_SIZE];
+ tp_udf_tag tag = (tp_udf_tag)sector;
+ DWORD sec_size, max_sec, i, j;
+ DWORD MVDS_lba, MVDS_lba_end, MVDS_back_lba, MVDS_back_lba_end;
+ DWORD FileDescriptorSequence_lba, FileDescriptorSequence_lba_end;
+ DWORD partition_lba, parent_icb;
+ tp_udf_AnchorVolumeDescriptorPointer avd;
+ bool res, part_valid, vol_valid;
+
+ if (!aspi_GetSectorInfo(hDrive, &sec_size, &max_sec))
+ return NULL;
+
+ if (sec_size != fio_SECTOR_SIZE || max_sec < 256)
+ return NULL;
+
+ // read AnchorVolumeDescriptorPointer at 256 (or MaxSec) (Tag == 2)
+ res = aspi_ReadSectors(hDrive, 256, 1, sec_size, sector);
+ if (!res || tag->TagIdentifier != udf_TAG_AnchorVolumeDescriptor)
+ {
+ res = aspi_ReadSectors(hDrive, max_sec, 1, sec_size, sector);
+ if (!res || tag->TagIdentifier != udf_TAG_AnchorVolumeDescriptor)
+ return NULL;
+ }
+
+ // check Static Structures
+
+ // get MainVolumeDescriptorSequence Location & Length
+ avd = (tp_udf_AnchorVolumeDescriptorPointer)sector;
+ MVDS_lba = avd->MainVolumeDescriptorSequenceExtent.Location;
+ MVDS_lba_end = MVDS_lba + (avd->MainVolumeDescriptorSequenceExtent.Length - 1) / sec_size;
+ MVDS_back_lba = avd->ReserveVolumeDescriptorSequenceExtent.Location;
+ MVDS_back_lba_end = MVDS_back_lba + (avd->ReserveVolumeDescriptorSequenceExtent.Length - 1) / sec_size;
+
+ // read MVDS_Location..MVDS_Location + (MVDS_Length - 1) / SectorSize sectors
+
+ part_valid = vol_valid = false;
+ i = 1;
+ do
+ { // try twice (if we need to) for ReserveAnchor
+ j = MVDS_lba;
+ do
+ {
+ res = aspi_ReadSectors(hDrive, j++, 1, sec_size, sector);
+ if (res)
+ {
+ if (tag->TagIdentifier == udf_TAG_PartitionDescriptor && !part_valid)
+ { // get stuff out of partition
+ tp_udf_PartitionDescriptor par = (tp_udf_PartitionDescriptor )sector;
+
+ part_valid = par->PartitionNumber == partition_number;
+ if (part_valid)
+ { // extract par->PartitionStartingLocation, par->PartitionLength
+ partition_lba = par->PartitionStartingLocation;
+ }
+ }
+ else if (tag->TagIdentifier == udf_TAG_LogicalVolumeDescriptor && !vol_valid)
+ { // get stuff out of volume
+ tp_udf_LogicalVolumeDescriptor vol = (tp_udf_LogicalVolumeDescriptor)sector;
+
+ // check_volume sector size
+ vol_valid = (vol->LogicalBlockSize == sec_size) && (partition_number == vol->FileSetDescriptorSequence.Location.PartitionNumber);
+ if (vol_valid)
+ { // extract vol->FileSetDescriptorSequence
+ FileDescriptorSequence_lba = vol->FileSetDescriptorSequence.Location.Location;
+ FileDescriptorSequence_lba_end = FileDescriptorSequence_lba + ((vol->FileSetDescriptorSequence.Length & udf_LengthMask) - 1) / sec_size;
+ }
+ }
+ }
+ else
+ tag->TagIdentifier = 0;
+ } while (j <= MVDS_lba_end && tag->TagIdentifier != udf_TAG_TerminatingDescriptor && ((!part_valid) || (!vol_valid)));
+
+ if ((!part_valid) || (!vol_valid))
+ { // try backup
+ MVDS_lba = MVDS_back_lba;
+ MVDS_lba_end = MVDS_back_lba_end;
+ }
+ } while (i-- && ((!part_valid) || (!vol_valid)));
+
+ if (part_valid && vol_valid)
+ { // read FileSetDescriptor, get RootDir Location & Length, RootDir Length != 0
+ res = aspi_ReadSectors(hDrive, FileDescriptorSequence_lba + partition_lba, 1, sec_size, sector);
+ if (res && tag->TagIdentifier == udf_TAG_FileSetDescriptor)
+ {
+ tp_udf_FileSetDescriptor fsd = (tp_udf_FileSetDescriptor)sector;
+
+ if (partition_number == fsd->RootDirectoryICB.Location.PartitionNumber)
+ {
+ parent_icb = fsd->RootDirectoryICB.Location.Location;
+ res = aspi_ReadSectors(hDrive, partition_lba + parent_icb, 1, sec_size, sector);
+ if (res && tag->TagIdentifier == udf_TAG_FileEntry)
+ {
+ tp_udf_FileEntry fe = (tp_udf_FileEntry)sector;
+
+ if (fe->ICBTag.FileType == udf_FT_Directory)
+ {
+ tp_udf_file root = (tp_udf_file)malloc(sizeof *root);
+
+ root->partition_lba = partition_lba;
+ udf_GetLBA(fe, sec_size, &root->dir_lba, &root->dir_end_lba);
+ root->dir_left = (DWORD)fe->InformationLength; // don't want directories of more than 4gb
+ root->sector = NULL;
+ root->fid = NULL;
+ root->sec_size = sec_size;
+ strcpy(root->name, "/");
+ root->is_dir = true;
+ root->is_parent = false;
+ return root;
+ }
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
+static void udf_GetName(const BYTE *data, const DWORD len, char *target)
+{
+ DWORD p = 1, i = 0;
+
+ if (len == 0 || !(data[0] & 0x18))
+ target[0] = '\0';
+
+ if (data[0] & 0x10)
+ { // ignore MSB of unicode16
+ p++;
+
+ while (p < len)
+ target[i++] = data[p += 2];
+ }
+ else
+ {
+ while (p < len)
+ target[i++] = data[p++];
+ }
+
+ target[i]='\0';
+}
+
+tp_udf_file udf_get_sub(const HANDLE hDrive, tp_udf_file f)
+{
+ if (f->is_dir && !f->is_parent && f->fid)
+ {
+ BYTE sector[fio_SECTOR_SIZE];
+ tp_udf_tag tag = (tp_udf_tag)sector;
+ bool res;
+
+ res = aspi_ReadSectors(hDrive, f->partition_lba + f->fid->ICB.Location.Location, 1, f->sec_size, sector);
+ if (res && tag->TagIdentifier == udf_TAG_FileEntry)
+ {
+ tp_udf_FileEntry fe = (tp_udf_FileEntry)sector;
+
+ if (fe->ICBTag.FileType == udf_FT_Directory)
+ {
+ tp_udf_file newf = (tp_udf_file)malloc(sizeof *newf);
+
+ strcpy(newf->name, f->name); // maybe just ""?
+ newf->sec_size = f->sec_size;
+ newf->partition_lba = f->partition_lba;
+ udf_GetLBA(fe, f->sec_size, &newf->dir_lba, &newf->dir_end_lba);
+ newf->dir_left = (DWORD)fe->InformationLength; // don't want directories of more than 4gb
+ newf->sector = NULL;
+ newf->fid = NULL;
+ newf->is_dir = true;
+ newf->is_parent = false;
+ return newf;
+ }
+ }
+ }
+ return NULL;
+}
+
+tp_udf_file udf_get_next(const HANDLE hDrive, tp_udf_file f)
+{
+ bool res = true;
+
+ if (f->dir_left <= 0)
+ {
+ f->fid = NULL;
+ return NULL;
+ }
+
+ if (f->fid)
+ { // advance to next FileIdentifierDescriptor
+ DWORD ofs = 4 * ((sizeof *(f->fid) + f->fid->LengthofImplementationUse + f->fid->LengthofFileIdentifier + 3) / 4);
+
+ f->fid = (tp_udf_FileIdentifierDescriptor)((BYTE *)f->fid + ofs);
+ }
+
+ if (f->fid == NULL)
+ {
+ DWORD size = f->sec_size * (f->dir_end_lba - f->dir_lba + 1);
+
+ if (!f->sector)
+ f->sector = (BYTE*)malloc(size);
+ res = aspi_ReadSectors(hDrive, f->partition_lba + f->dir_lba, (WORD)(f->dir_end_lba - f->dir_lba + 1), f->sec_size, f->sector);
+ if (res)
+ f->fid = (tp_udf_FileIdentifierDescriptor)f->sector;
+ else
+ f->fid = NULL;
+ }
+
+ if (f->fid && f->fid->DescriptorTag.TagIdentifier == udf_TAG_FileIdentifierDescriptor)
+ {
+ DWORD ofs = 4 * ((sizeof *f->fid + f->fid->LengthofImplementationUse + f->fid->LengthofFileIdentifier + 3) / 4);
+
+ f->dir_left -= ofs;
+ f->is_dir = (f->fid->FileCharacteristics & udf_FID_Directory) != 0;
+ f->is_parent = (f->fid->FileCharacteristics & udf_FID_Parent) != 0;
+ udf_GetName(f->fid->ImplementationUse + f->fid->LengthofImplementationUse, f->fid->LengthofFileIdentifier, f->name);
+ return f;
+ }
+ return NULL;
+}
+
+void udf_free(tp_udf_file f)
+{
+ if (f)
+ {
+ if (f->sector)
+ free(f->sector);
+ free(f);
+ }
+}
+
+#define udf_PATH_DELIMITERS "/\\"
+
+static tp_udf_file udf_ff_traverse(const HANDLE hDrive, tp_udf_file f, char *token)
+{
+ while (udf_get_next(hDrive, f))
+ {
+ if (stricmp(token, f->name) == 0)
+ {
+ char *next_tok = strtok(NULL, udf_PATH_DELIMITERS);
+
+ if (!next_tok)
+ return f; // found
+ else if (f->is_dir)
+ {
+ tp_udf_file f2 = udf_get_sub(hDrive, f);
+
+ if (f2)
+ {
+ tp_udf_file f3 = udf_ff_traverse(hDrive, f2, next_tok);
+
+ if (!f3)
+ udf_free(f2);
+ return f3;
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
+tp_udf_file udf_find_file(const HANDLE hDrive, const WORD partition, const char *name)
+{
+ tp_udf_file f = udf_get_root(hDrive, partition), f2 = NULL;
+
+ if (f)
+ {
+ char tokenline[udf_MAX_PATHLEN];
+ char *token;
+
+ strcpy(tokenline, name);
+ token = strtok(tokenline, udf_PATH_DELIMITERS);
+ if (token)
+ f2 = udf_ff_traverse(hDrive, f, token);
+ udf_free(f);
+ }
+ return f2;
+}
+
+bool udf_get_lba(const HANDLE hDrive, const tp_udf_file f, DWORD *start_lba, DWORD *end_lba)
+{
+ if (f->fid)
+ {
+ BYTE sector[2048];
+ tp_udf_FileEntry fe = (tp_udf_FileEntry)sector;
+ bool res;
+
+ res = aspi_ReadSectors(hDrive, f->partition_lba + f->fid->ICB.Location.Location, 1, f->sec_size, sector);
+ if (res && fe->DescriptorTag.TagIdentifier == udf_TAG_FileEntry)
+ return udf_GetLBA(fe, f->sec_size, start_lba, end_lba);
+ }
+ return false;
+}
diff --git a/src/decss/udf.h b/src/decss/udf.h
new file mode 100644
index 000000000..c108f59d1
--- /dev/null
+++ b/src/decss/udf.h
@@ -0,0 +1,265 @@
+#pragma once
+
+/*************************************************************************
+ vStrip by [maven] (maven@maven.de)
+*************************************************************************/
+
+typedef unsigned __int64 QWORD;
+#define fio_SECTOR_SIZE 2048
+
+typedef char dstring; // last BYTE of string indicates encoding/length
+
+#define udf_LengthMask 0x3fffffff
+
+#define udf_TAG_PrimaryVolumeDescriptor 0x0001
+#define udf_TAG_AnchorVolumeDescriptor 0x0002
+#define udf_TAG_PartitionDescriptor 0x0005
+#define udf_TAG_LogicalVolumeDescriptor 0x0006
+#define udf_TAG_TerminatingDescriptor 0x0008
+#define udf_TAG_FileSetDescriptor 0x0100
+#define udf_TAG_FileIdentifierDescriptor 0x0101
+#define udf_TAG_IndirectEntry 0x0103
+#define udf_TAG_TerminalEntry 0x0104
+#define udf_TAG_FileEntry 0x0105
+
+#define udf_FT_IndirectEntry 0x03
+#define udf_FT_Directory 0x04
+#define udf_FT_File 0x05
+#define udf_FT_TerminalEntry 0x0b
+
+#define udf_icbf_Mask 0x0007
+#define udf_icbf_ShortAd 0x0000
+#define udf_icbf_LongAd 0x0001
+#define udf_icbf_ExtAd 0x0002
+#define udf_icbf_Direct 0x0003
+#define udf_icbf_Contiguous 0x0100
+
+#define udf_FID_Directory 0x02
+#define udf_FID_Parent 0x08
+
+#pragma pack(push, 1)
+
+typedef struct
+{
+ DWORD Length; // 00, high 2 bits: 0 ^= recorded & used, 1 ^= not recorded & used, 2 ^= not recorded & not used, 3 ^= linked list
+ DWORD Location; // 04
+} t_udf_short_ad, *tp_udf_short_ad; // 08
+
+typedef struct
+{
+ DWORD Length; // 00
+ DWORD Location; // 04
+} t_udf_extent_ad, *tp_udf_extent_ad; // 08
+
+typedef struct
+{
+ DWORD Location; // 00, relative to volume
+ WORD PartitionNumber; // 04
+} t_udf_lb_addr; // 06
+
+typedef struct
+{
+ DWORD Length; // 00, high 2 bits: 0 ^= recorded & used, 1 ^= not recorded & used, 2 ^= not recorded & not used, 3 ^= linked list
+ t_udf_lb_addr Location; // 04
+ BYTE ImplementationUse[6]; // 10
+} t_udf_long_ad, *tp_udf_long_ad; // 16
+
+typedef struct
+{
+ DWORD Length; // 00, high 2 bits: 0 ^= recorded & used, 1 ^= not recorded & used, 2 ^= not recorded & not used, 3 ^= linked list
+ DWORD RecordedLength; // 04
+ DWORD InformationLength; // 08
+ t_udf_lb_addr Location; // 12
+ BYTE ImplementationUse[2]; // 18
+} t_udf_ext_ad, *tp_udf_ext_ad; // 20
+
+typedef struct
+{
+ BYTE CharacterSetType; // 00
+ BYTE CharacterSetInfo[63]; // 01
+} t_udf_charspec; // 64
+
+typedef struct
+{ /* ECMA 167 1/7.3 */
+ WORD TypeAndTimezone; // 00
+ WORD Year; // 02
+ BYTE Month; // 04
+ BYTE Day; // 05
+ BYTE Hour; // 06
+ BYTE Minute; // 07
+ BYTE Second; // 08
+ BYTE Centiseconds; // 09
+ BYTE HundredsofMicroseconds; // 10
+ BYTE Microseconds; // 11
+} t_udf_timestamp; // 12
+
+typedef struct
+{ /* ISO 13346 3/7.2 */
+ WORD TagIdentifier; // 00
+ WORD DescriptorVersion; // 02
+ BYTE TagChecksum; // 04
+ BYTE Reserved; // 05
+ WORD TagSerialNumber; // 06
+ WORD DescriptorCRC; // 08
+ WORD DescriptorCRCLength; // 10
+ DWORD TagLocation; // 12
+} t_udf_tag, *tp_udf_tag; // 16
+
+typedef struct
+{ /* ISO 13346 1/7.4 */
+ BYTE Flags; // 00
+ char Identifier[23]; // 01
+ char IdentifierSuffix[8]; // 24
+} t_udf_EntityID; // 32
+
+typedef struct
+{ /* ISO 13346 3/10.2 */
+ t_udf_tag DescriptorTag; // 00
+ t_udf_extent_ad MainVolumeDescriptorSequenceExtent; // 16
+ t_udf_extent_ad ReserveVolumeDescriptorSequenceExtent; // 24
+ BYTE Reserved[480]; // 32
+} t_udf_AnchorVolumeDescriptorPointer, *tp_udf_AnchorVolumeDescriptorPointer; // 512
+
+typedef struct
+{ /* ISO 13346 3/10.6 */
+ t_udf_tag DescriptorTag; // 00
+ DWORD VolumeDescriptorSequenceNumber; // 16
+ t_udf_charspec DescriptorCharacterSet; // 20
+ dstring LogicalVolumeIdentifier[128]; // 84
+ DWORD LogicalBlockSize; // 212
+ t_udf_EntityID DomainIdentifier; // 244
+// BYTE LogicalVolumeContentsUse[16]; // 276
+ t_udf_long_ad FileSetDescriptorSequence; // 276
+ DWORD MapTableLength; // 292
+ DWORD NumberofPartitionMaps; // 296
+ t_udf_EntityID ImplementationIdentifier; // 300
+ BYTE ImplementationUse[128]; // 332
+ t_udf_extent_ad IntegritySequenceExtent; // 460
+ BYTE PartitionMaps[1]; // 468
+} t_udf_LogicalVolumeDescriptor, *tp_udf_LogicalVolumeDescriptor;
+
+typedef struct
+{
+ t_udf_short_ad UnallocatedSpaceTable; // 00
+ t_udf_short_ad UnallocatedSpaceBitmap; // 08
+ t_udf_short_ad PartitionIntegrityTable; // 16
+ t_udf_short_ad FreedSpaceTable; // 24
+ t_udf_short_ad FreedSpaceBitmap; // 32
+ BYTE Reserved[88]; // 40
+} t_udf_PartitionHeaderDescriptor; // 128
+
+typedef struct
+{ /* ECMA 167 3/10.5 */
+ t_udf_tag DescriptorTag; // 00
+ DWORD VolumeDescriptorSequenceNumber; // 16
+ WORD PartitionFlags; // 20
+ WORD PartitionNumber; // 22
+ t_udf_EntityID PartitionContents; // 24
+ t_udf_PartitionHeaderDescriptor PartitionHeaderDescriptor; // 56
+ DWORD AccessType; // 184, 0 unspecified, 1 read only, 2 write once, 3 rewriteable, 4 overwriteable
+ DWORD PartitionStartingLocation; // 188
+ DWORD PartitionLength; // 192
+ t_udf_EntityID ImplementationIdentifier; // 196
+ BYTE ImplementationUse[128]; // 228
+ BYTE Reserved[156]; // 356
+} t_udf_PartitionDescriptor, *tp_udf_PartitionDescriptor; // 512
+
+typedef struct
+{ /* ECMA 167 4/14.1 */
+ t_udf_tag DescriptorTag; // 00
+ t_udf_timestamp RecordingDateandTime; // 16
+ WORD InterchangeLevel; // 28
+ WORD MaximumInterchangeLevel; // 30
+ DWORD CharacterSetList; // 32
+ DWORD MaximumCharacterSetList; // 36
+ DWORD FileSetNumber; // 40
+ DWORD FileSetDescriptorNumber; // 44
+ t_udf_charspec LogicalVolumeIdentifierCharacterSet; // 48
+ dstring LogicalVolumeIdentifier[128]; // 112
+ t_udf_charspec FileSetCharacterSet; // 240
+ dstring FileSetIdentifer[32]; // 304
+ dstring CopyrightFileIdentifier[32]; // 336
+ dstring AbstractFileIdentifier[32]; // 368
+ t_udf_long_ad RootDirectoryICB; // 400
+ t_udf_EntityID DomainIdentifier; // 416
+ t_udf_long_ad NextExtent; // 448
+ t_udf_long_ad StreamDirectoryICB; // 464
+ BYTE Reserved[32]; // 480
+} t_udf_FileSetDescriptor, *tp_udf_FileSetDescriptor; // 512
+
+typedef struct
+{ /* ECMA 167 4/14.6 */
+ DWORD PriorRecordedNumberofDirectEntries; // 00
+ WORD StrategyType; // 04
+ BYTE StrategyParameter[2]; // 06
+ WORD NumberofEntries; // 08
+ BYTE Reserved; // 10
+ BYTE FileType; // 11
+ t_udf_lb_addr ParentICBLocation; // 12
+ WORD Flags; // 18
+} t_udf_icbtag; // 20
+
+typedef struct
+{ /* ECMA 167 4/14.9 */
+ t_udf_tag DescriptorTag; // 00
+ t_udf_icbtag ICBTag; // 16
+ DWORD Uid; // 36
+ DWORD Gid; // 40
+ DWORD Permissions; // 44
+ WORD FileLinkCount; // 48
+ BYTE RecordFormat; // 50
+ BYTE RecordDisplayAttributes; // 51
+ DWORD RecordLength; // 52
+ QWORD InformationLength; // 56
+ QWORD LogicalBlocksRecorded; // 64
+ t_udf_timestamp AccessTime; // 72
+ t_udf_timestamp ModificationTime; // 84
+ t_udf_timestamp AttributeTime; // 96
+ DWORD Checkpoint; // 108
+ t_udf_long_ad ExtendedAttributeICB; // 112
+ t_udf_EntityID ImplementationIdentifier; // 128
+ QWORD UniqueID; // 160
+ DWORD LengthofExtendedAttributes; // 168
+ DWORD LengthofAllocationDescriptors; // 172
+ BYTE ExtendedAttributes[]; // 176
+// BYTE AllocationDescriptors[]; // 176
+} t_udf_FileEntry, *tp_udf_FileEntry; // >= 176
+
+typedef struct
+{ /* ECMA 167 4/14.4 */
+ t_udf_tag DescriptorTag; // 00
+ WORD FileVersionNumber; // 16
+ BYTE FileCharacteristics; // 18
+ BYTE LengthofFileIdentifier; // 19
+ t_udf_long_ad ICB; // 20
+ WORD LengthofImplementationUse; // 36
+ BYTE ImplementationUse[]; // 38
+// char FileIdentifier[]; // 38
+// BYTE Padding[]; // 38
+} t_udf_FileIdentifierDescriptor, *tp_udf_FileIdentifierDescriptor; // >= 38
+
+#define udf_MAX_NAMELEN 256
+#define udf_MAX_PATHLEN 2048
+
+typedef struct
+{
+ // public
+ char name[udf_MAX_NAMELEN];
+ bool is_dir, is_parent;
+ // internal
+ BYTE *sector;
+ tp_udf_FileIdentifierDescriptor fid;
+ DWORD partition_lba;
+ DWORD dir_lba, dir_end_lba;
+ DWORD sec_size;
+ int dir_left;
+} t_udf_file, *tp_udf_file;
+
+#pragma pack(pop)
+
+tp_udf_file udf_find_file(const HANDLE hDrive, const WORD partition, const char *name);
+tp_udf_file udf_get_root(const HANDLE hDrive, const WORD partition_number);
+tp_udf_file udf_get_next(const HANDLE hDrive, tp_udf_file f); // advances f
+tp_udf_file udf_get_sub(const HANDLE hDrive, tp_udf_file f); // creates new f
+bool udf_get_lba(const HANDLE hDrive, const tp_udf_file f, DWORD *start_lba, DWORD *end_lba);
+void udf_free(tp_udf_file f);
diff --git a/src/dsutil/DSMPropertyBag.cpp b/src/dsutil/DSMPropertyBag.cpp
new file mode 100644
index 000000000..4efd36ecb
--- /dev/null
+++ b/src/dsutil/DSMPropertyBag.cpp
@@ -0,0 +1,382 @@
+#include "StdAfx.h"
+#include "DSUtil.h"
+#include "DSMPropertyBag.h"
+
+//
+// IDSMPropertyBagImpl
+//
+
+IDSMPropertyBagImpl::IDSMPropertyBagImpl()
+{
+}
+
+IDSMPropertyBagImpl::~IDSMPropertyBagImpl()
+{
+}
+
+// IPropertyBag
+
+STDMETHODIMP IDSMPropertyBagImpl::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog)
+{
+ CheckPointer(pVar, E_POINTER);
+ if(pVar->vt != VT_EMPTY) return E_INVALIDARG;
+ CStringW value = Lookup(pszPropName);
+ if(value.IsEmpty()) return E_FAIL;
+ CComVariant(value).Detach(pVar);
+ return S_OK;
+}
+
+STDMETHODIMP IDSMPropertyBagImpl::Write(LPCOLESTR pszPropName, VARIANT* pVar)
+{
+ return SetProperty(pszPropName, pVar);
+}
+
+// IPropertyBag2
+
+STDMETHODIMP IDSMPropertyBagImpl::Read(ULONG cProperties, PROPBAG2* pPropBag, IErrorLog* pErrLog, VARIANT* pvarValue, HRESULT* phrError)
+{
+ CheckPointer(pPropBag, E_POINTER);
+ CheckPointer(pvarValue, E_POINTER);
+ CheckPointer(phrError, E_POINTER);
+ for(ULONG i = 0; i < cProperties; phrError[i] = S_OK, i++)
+ CComVariant(Lookup(pPropBag[i].pstrName)).Detach(pvarValue);
+ return S_OK;
+}
+
+STDMETHODIMP IDSMPropertyBagImpl::Write(ULONG cProperties, PROPBAG2* pPropBag, VARIANT* pvarValue)
+{
+ CheckPointer(pPropBag, E_POINTER);
+ CheckPointer(pvarValue, E_POINTER);
+ for(ULONG i = 0; i < cProperties; i++)
+ SetProperty(pPropBag[i].pstrName, &pvarValue[i]);
+ return S_OK;
+}
+
+STDMETHODIMP IDSMPropertyBagImpl::CountProperties(ULONG* pcProperties)
+{
+ CheckPointer(pcProperties, E_POINTER);
+ *pcProperties = GetSize();
+ return S_OK;
+}
+
+STDMETHODIMP IDSMPropertyBagImpl::GetPropertyInfo(ULONG iProperty, ULONG cProperties, PROPBAG2* pPropBag, ULONG* pcProperties)
+{
+ CheckPointer(pPropBag, E_POINTER);
+ CheckPointer(pcProperties, E_POINTER);
+ for(ULONG i = 0; i < cProperties; i++, iProperty++, (*pcProperties)++)
+ {
+ CStringW key = GetKeyAt(iProperty);
+ pPropBag[i].pstrName = (BSTR)CoTaskMemAlloc((key.GetLength()+1)*sizeof(WCHAR));
+ if(!pPropBag[i].pstrName) return E_FAIL;
+ wcscpy(pPropBag[i].pstrName, key);
+ }
+ return S_OK;
+}
+
+STDMETHODIMP IDSMPropertyBagImpl::LoadObject(LPCOLESTR pstrName, DWORD dwHint, IUnknown* pUnkObject, IErrorLog* pErrLog)
+{
+ return E_NOTIMPL;
+}
+
+// IDSMProperyBag
+
+HRESULT IDSMPropertyBagImpl::SetProperty(LPCWSTR key, LPCWSTR value)
+{
+ CheckPointer(key, E_POINTER);
+ CheckPointer(value, E_POINTER);
+ if(!Lookup(key).IsEmpty()) SetAt(key, value);
+ else Add(key, value);
+ return S_OK;
+}
+
+HRESULT IDSMPropertyBagImpl::SetProperty(LPCWSTR key, VARIANT* var)
+{
+ CheckPointer(key, E_POINTER);
+ CheckPointer(var, E_POINTER);
+ if((var->vt & (VT_BSTR | VT_BYREF)) != VT_BSTR) return E_INVALIDARG;
+ return SetProperty(key, var->bstrVal);
+}
+
+HRESULT IDSMPropertyBagImpl::GetProperty(LPCWSTR key, BSTR* value)
+{
+ CheckPointer(key, E_POINTER);
+ CheckPointer(value, E_POINTER);
+ int i = FindKey(key);
+ if(i < 0) return E_FAIL;
+ *value = GetValueAt(i).AllocSysString();
+ return S_OK;
+}
+
+HRESULT IDSMPropertyBagImpl::DelAllProperties()
+{
+ RemoveAll();
+ return S_OK;
+}
+
+HRESULT IDSMPropertyBagImpl::DelProperty(LPCWSTR key)
+{
+ return Remove(key) ? S_OK : S_FALSE;
+}
+
+//
+// CDSMResource
+//
+
+CCritSec CDSMResource::m_csResources;
+CAtlMap<DWORD, CDSMResource*> CDSMResource::m_resources;
+
+CDSMResource::CDSMResource()
+ : mime(_T("application/octet-stream"))
+ , tag(0)
+{
+ CAutoLock cAutoLock(&m_csResources);
+ m_resources.SetAt((DWORD)this, this);
+}
+
+CDSMResource::CDSMResource(const CDSMResource& r)
+{
+ *this = r;
+
+ CAutoLock cAutoLock(&m_csResources);
+ m_resources.SetAt((DWORD)this, this);
+}
+
+CDSMResource::CDSMResource(LPCWSTR name, LPCWSTR desc, LPCWSTR mime, BYTE* pData, int len, DWORD_PTR tag)
+{
+ this->name = name;
+ this->desc = desc;
+ this->mime = mime;
+ data.SetCount(len);
+ memcpy(data.GetData(), pData, data.GetCount());
+ this->tag = tag;
+
+ CAutoLock cAutoLock(&m_csResources);
+ m_resources.SetAt((DWORD)this, this);
+}
+
+CDSMResource::~CDSMResource()
+{
+ CAutoLock cAutoLock(&m_csResources);
+ m_resources.RemoveKey((DWORD)this);
+}
+
+void CDSMResource::operator = (const CDSMResource& r)
+{
+ tag = r.tag;
+ name = r.name;
+ desc = r.desc;
+ mime = r.mime;
+ data.Copy(r.data);
+}
+
+//
+// IDSMResourceBagImpl
+//
+
+IDSMResourceBagImpl::IDSMResourceBagImpl()
+{
+}
+
+// IDSMResourceBag
+
+STDMETHODIMP_(DWORD) IDSMResourceBagImpl::ResGetCount()
+{
+ return m_resources.GetCount();
+}
+
+STDMETHODIMP IDSMResourceBagImpl::ResGet(DWORD iIndex, BSTR* ppName, BSTR* ppDesc, BSTR* ppMime, BYTE** ppData, DWORD* pDataLen, DWORD_PTR* pTag)
+{
+ if(ppData) CheckPointer(pDataLen, E_POINTER);
+
+ if((INT_PTR)iIndex >= m_resources.GetCount())
+ return E_INVALIDARG;
+
+ CDSMResource& r = m_resources[iIndex];
+
+ if(ppName) *ppName = r.name.AllocSysString();
+ if(ppDesc) *ppDesc = r.desc.AllocSysString();
+ if(ppMime) *ppMime = r.mime.AllocSysString();
+ if(ppData) {*pDataLen = r.data.GetCount(); memcpy(*ppData = (BYTE*)CoTaskMemAlloc(*pDataLen), r.data.GetData(), *pDataLen);}
+ if(pTag) *pTag = r.tag;
+
+ return S_OK;
+}
+
+STDMETHODIMP IDSMResourceBagImpl::ResSet(DWORD iIndex, LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag)
+{
+ if((INT_PTR)iIndex >= m_resources.GetCount())
+ return E_INVALIDARG;
+
+ CDSMResource& r = m_resources[iIndex];
+
+ if(pName) r.name = pName;
+ if(pDesc) r.desc = pDesc;
+ if(pMime) r.mime = pMime;
+ if(pData || len == 0) {r.data.SetCount(len); if(pData) memcpy(r.data.GetData(), pData, r.data.GetCount());}
+ r.tag = tag;
+
+ return S_OK;
+}
+
+STDMETHODIMP IDSMResourceBagImpl::ResAppend(LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag)
+{
+ return ResSet(m_resources.Add(CDSMResource()), pName, pDesc, pMime, pData, len, tag);
+}
+
+STDMETHODIMP IDSMResourceBagImpl::ResRemoveAt(DWORD iIndex)
+{
+ if((INT_PTR)iIndex >= m_resources.GetCount())
+ return E_INVALIDARG;
+
+ m_resources.RemoveAt(iIndex);
+
+ return S_OK;
+}
+
+STDMETHODIMP IDSMResourceBagImpl::ResRemoveAll(DWORD_PTR tag)
+{
+ if(tag)
+ {
+ for(int i = m_resources.GetCount() - 1; i >= 0; i--)
+ if(m_resources[i].tag == tag)
+ m_resources.RemoveAt(i);
+ }
+ else
+ {
+ m_resources.RemoveAll();
+ }
+
+ return S_OK;
+}
+
+//
+// CDSMChapter
+//
+
+CDSMChapter::CDSMChapter(REFERENCE_TIME rt, LPCWSTR name)
+{
+ this->rt = rt;
+ this->name = name;
+}
+
+void CDSMChapter::operator = (const CDSMChapter& c)
+{
+ rt = c.rt;
+ name = c.name;
+}
+
+//
+// IDSMChapterBagImpl
+//
+
+IDSMChapterBagImpl::IDSMChapterBagImpl()
+{
+ m_fSorted = false;
+}
+
+// IDSMRChapterBag
+
+STDMETHODIMP_(DWORD) IDSMChapterBagImpl::ChapGetCount()
+{
+ return m_chapters.GetCount();
+}
+
+STDMETHODIMP IDSMChapterBagImpl::ChapGet(DWORD iIndex, REFERENCE_TIME* prt, BSTR* ppName)
+{
+ if((INT_PTR)iIndex >= m_chapters.GetCount())
+ return E_INVALIDARG;
+
+ CDSMChapter& c = m_chapters[iIndex];
+
+ if(prt) *prt = c.rt;
+ if(ppName) *ppName = c.name.AllocSysString();
+
+ return S_OK;
+}
+
+STDMETHODIMP IDSMChapterBagImpl::ChapSet(DWORD iIndex, REFERENCE_TIME rt, LPCWSTR pName)
+{
+ if((INT_PTR)iIndex >= m_chapters.GetCount())
+ return E_INVALIDARG;
+
+ CDSMChapter& c = m_chapters[iIndex];
+
+ c.rt = rt;
+ if(pName) c.name = pName;
+
+ m_fSorted = false;
+
+ return S_OK;
+}
+
+STDMETHODIMP IDSMChapterBagImpl::ChapAppend(REFERENCE_TIME rt, LPCWSTR pName)
+{
+ return ChapSet(m_chapters.Add(CDSMChapter()), rt, pName);
+}
+
+STDMETHODIMP IDSMChapterBagImpl::ChapRemoveAt(DWORD iIndex)
+{
+ if((INT_PTR)iIndex >= m_chapters.GetCount())
+ return E_INVALIDARG;
+
+ m_chapters.RemoveAt(iIndex);
+
+ return S_OK;
+}
+
+STDMETHODIMP IDSMChapterBagImpl::ChapRemoveAll()
+{
+ m_chapters.RemoveAll();
+
+ m_fSorted = false;
+
+ return S_OK;
+}
+
+STDMETHODIMP_(long) IDSMChapterBagImpl::ChapLookup(REFERENCE_TIME* prt, BSTR* ppName)
+{
+ CheckPointer(prt, -1);
+
+ ChapSort();
+
+ int i = range_bsearch(m_chapters, *prt);
+ if(i < 0) return -1;
+
+ *prt = m_chapters[i].rt;
+ if(ppName) *ppName = m_chapters[i].name.AllocSysString();
+
+ return i;
+}
+
+static int chapter_comp(const void* a, const void* b)
+{
+ if(((CDSMChapter*)a)->rt > ((CDSMChapter*)b)->rt) return 1;
+ else if(((CDSMChapter*)a)->rt < ((CDSMChapter*)b)->rt) return -1;
+ return 0;
+}
+
+STDMETHODIMP IDSMChapterBagImpl::ChapSort()
+{
+ if(m_fSorted) return S_FALSE;
+ qsort(m_chapters.GetData(), m_chapters.GetCount(), sizeof(CDSMChapter), chapter_comp);
+ m_fSorted = true;
+ return S_OK;
+}
+
+//
+// CDSMChapterBag
+//
+
+CDSMChapterBag::CDSMChapterBag(LPUNKNOWN pUnk, HRESULT* phr)
+ : CUnknown(_T("CDSMChapterBag"), NULL)
+{
+}
+
+STDMETHODIMP CDSMChapterBag::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IDSMChapterBag)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
diff --git a/src/dsutil/DSMPropertyBag.h b/src/dsutil/DSMPropertyBag.h
new file mode 100644
index 000000000..5af71c29e
--- /dev/null
+++ b/src/dsutil/DSMPropertyBag.h
@@ -0,0 +1,169 @@
+#pragma once
+#include <atlcoll.h>
+#include <atlsimpcoll.h>
+
+// IDSMPropertyBag
+
+[uuid("232FD5D2-4954-41E7-BF9B-09E1257B1A95")]
+interface IDSMPropertyBag : public IPropertyBag2
+{
+ STDMETHOD(SetProperty) (LPCWSTR key, LPCWSTR value) = 0;
+ STDMETHOD(SetProperty) (LPCWSTR key, VARIANT* var) = 0;
+ STDMETHOD(GetProperty) (LPCWSTR key, BSTR* value) = 0;
+ STDMETHOD(DelAllProperties) () = 0;
+ STDMETHOD(DelProperty) (LPCWSTR key) = 0;
+};
+
+class IDSMPropertyBagImpl : public ATL::CSimpleMap<CStringW, CStringW>, public IDSMPropertyBag, public IPropertyBag
+{
+ BOOL Add(const CStringW& key, const CStringW& val) {return __super::Add(key, val);}
+ BOOL SetAt(const CStringW& key, const CStringW& val) {return __super::SetAt(key, val);}
+
+public:
+ IDSMPropertyBagImpl();
+ virtual ~IDSMPropertyBagImpl();
+
+ // IPropertyBag
+
+ STDMETHODIMP Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog);
+ STDMETHODIMP Write(LPCOLESTR pszPropName, VARIANT* pVar);
+
+ // IPropertyBag2
+
+ STDMETHODIMP Read(ULONG cProperties, PROPBAG2* pPropBag, IErrorLog* pErrLog, VARIANT* pvarValue, HRESULT* phrError);
+ STDMETHODIMP Write(ULONG cProperties, PROPBAG2* pPropBag, VARIANT* pvarValue);
+ STDMETHODIMP CountProperties(ULONG* pcProperties);
+ STDMETHODIMP GetPropertyInfo(ULONG iProperty, ULONG cProperties, PROPBAG2* pPropBag, ULONG* pcProperties);
+ STDMETHODIMP LoadObject(LPCOLESTR pstrName, DWORD dwHint, IUnknown* pUnkObject, IErrorLog* pErrLog);
+
+ // IDSMPropertyBag
+
+ STDMETHODIMP SetProperty(LPCWSTR key, LPCWSTR value);
+ STDMETHODIMP SetProperty(LPCWSTR key, VARIANT* var);
+ STDMETHODIMP GetProperty(LPCWSTR key, BSTR* value);
+ STDMETHODIMP DelAllProperties();
+ STDMETHODIMP DelProperty(LPCWSTR key);
+};
+
+// IDSMResourceBag
+
+[uuid("EBAFBCBE-BDE0-489A-9789-05D5692E3A93")]
+interface IDSMResourceBag : public IUnknown
+{
+ STDMETHOD_(DWORD, ResGetCount) () = 0;
+ STDMETHOD(ResGet) (DWORD iIndex, BSTR* ppName, BSTR* ppDesc, BSTR* ppMime, BYTE** ppData, DWORD* pDataLen, DWORD_PTR* pTag) = 0;
+ STDMETHOD(ResSet) (DWORD iIndex, LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag) = 0;
+ STDMETHOD(ResAppend) (LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag) = 0;
+ STDMETHOD(ResRemoveAt) (DWORD iIndex) = 0;
+ STDMETHOD(ResRemoveAll) (DWORD_PTR tag) = 0;
+};
+
+class CDSMResource
+{
+public:
+ DWORD_PTR tag;
+ CStringW name, desc, mime;
+ CAtlArray<BYTE> data;
+ CDSMResource();
+ CDSMResource(const CDSMResource& r);
+ CDSMResource(LPCWSTR name, LPCWSTR desc, LPCWSTR mime, BYTE* pData, int len, DWORD_PTR tag = 0);
+ virtual ~CDSMResource();
+ void operator = (const CDSMResource& r);
+
+ // global access to all resources
+ static CCritSec m_csResources;
+ static CAtlMap<DWORD, CDSMResource*> m_resources;
+};
+
+class IDSMResourceBagImpl : public IDSMResourceBag
+{
+protected:
+ CAtlArray<CDSMResource> m_resources;
+
+public:
+ IDSMResourceBagImpl();
+
+ void operator += (const CDSMResource& r) {m_resources.Add(r);}
+
+ // IDSMResourceBag
+
+ STDMETHODIMP_(DWORD) ResGetCount();
+ STDMETHODIMP ResGet(DWORD iIndex, BSTR* ppName, BSTR* ppDesc, BSTR* ppMime, BYTE** ppData, DWORD* pDataLen, DWORD_PTR* pTag = NULL);
+ STDMETHODIMP ResSet(DWORD iIndex, LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag = 0);
+ STDMETHODIMP ResAppend(LPCWSTR pName, LPCWSTR pDesc, LPCWSTR pMime, BYTE* pData, DWORD len, DWORD_PTR tag = 0);
+ STDMETHODIMP ResRemoveAt(DWORD iIndex);
+ STDMETHODIMP ResRemoveAll(DWORD_PTR tag = 0);
+};
+
+// IDSMChapterBag
+
+[uuid("2D0EBE73-BA82-4E90-859B-C7C48ED3650F")]
+interface IDSMChapterBag : public IUnknown
+{
+ STDMETHOD_(DWORD, ChapGetCount) () = 0;
+ STDMETHOD(ChapGet) (DWORD iIndex, REFERENCE_TIME* prt, BSTR* ppName) = 0;
+ STDMETHOD(ChapSet) (DWORD iIndex, REFERENCE_TIME rt, LPCWSTR pName) = 0;
+ STDMETHOD(ChapAppend) (REFERENCE_TIME rt, LPCWSTR pName) = 0;
+ STDMETHOD(ChapRemoveAt) (DWORD iIndex) = 0;
+ STDMETHOD(ChapRemoveAll) () = 0;
+ STDMETHOD_(long, ChapLookup) (REFERENCE_TIME* prt, BSTR* ppName) = 0;
+ STDMETHOD(ChapSort) () = 0;
+};
+
+class CDSMChapter
+{
+public:
+ REFERENCE_TIME rt;
+ CStringW name;
+ CDSMChapter() {rt = 0;}
+ CDSMChapter(REFERENCE_TIME rt, LPCWSTR name);
+ void operator = (const CDSMChapter& c);
+};
+
+class IDSMChapterBagImpl : public IDSMChapterBag
+{
+protected:
+ CAtlArray<CDSMChapter> m_chapters;
+ bool m_fSorted;
+
+public:
+ IDSMChapterBagImpl();
+
+ void operator += (const CDSMChapter& c) {m_chapters.Add(c); m_fSorted = false;}
+
+ // IDSMChapterBag
+
+ STDMETHODIMP_(DWORD) ChapGetCount();
+ STDMETHODIMP ChapGet(DWORD iIndex, REFERENCE_TIME* prt, BSTR* ppName = NULL);
+ STDMETHODIMP ChapSet(DWORD iIndex, REFERENCE_TIME rt, LPCWSTR pName);
+ STDMETHODIMP ChapAppend(REFERENCE_TIME rt, LPCWSTR pName);
+ STDMETHODIMP ChapRemoveAt(DWORD iIndex);
+ STDMETHODIMP ChapRemoveAll();
+ STDMETHODIMP_(long) ChapLookup(REFERENCE_TIME* prt, BSTR* ppName = NULL);
+ STDMETHODIMP ChapSort();
+};
+
+class CDSMChapterBag : public CUnknown, public IDSMChapterBagImpl
+{
+public:
+ CDSMChapterBag(LPUNKNOWN pUnk, HRESULT* phr);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+};
+
+template<class T>
+int range_bsearch(const CAtlArray<T>& array, REFERENCE_TIME rt)
+{
+ int i = 0, j = array.GetCount() - 1, ret = -1;
+ if(j >= 0 && rt >= array[j].rt) return j;
+ while(i < j)
+ {
+ int mid = (i + j) >> 1;
+ REFERENCE_TIME midrt = array[mid].rt;
+ if(rt == midrt) {ret = mid; break;}
+ else if(rt < midrt) {ret = -1; if(j == mid) mid--; j = mid;}
+ else if(rt > midrt) {ret = mid; if(i == mid) mid++; i = mid;}
+ }
+ return ret;
+}
diff --git a/src/dsutil/DSUtil.cpp b/src/dsutil/DSUtil.cpp
new file mode 100644
index 000000000..502768826
--- /dev/null
+++ b/src/dsutil/DSUtil.cpp
@@ -0,0 +1,2218 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <Vfw.h>
+#include "..\..\include\winddk\devioctl.h"
+#include "..\..\include\winddk\ntddcdrm.h"
+#include "DSUtil.h"
+#include "..\..\include\moreuuids.h"
+
+void DumpStreamConfig(TCHAR* fn, IAMStreamConfig* pAMVSCCap)
+{
+ CString s, ss;
+ CStdioFile f;
+ if(!f.Open(fn, CFile::modeCreate|CFile::modeWrite|CFile::typeText))
+ return;
+
+ int cnt = 0, size = 0;
+ if(FAILED(pAMVSCCap->GetNumberOfCapabilities(&cnt, &size)))
+ return;
+
+ s.Empty();
+ s.Format(_T("cnt %d, size %d\n"), cnt, size);
+ f.WriteString(s);
+
+ if(size == sizeof(VIDEO_STREAM_CONFIG_CAPS))
+ {
+ for(int i = 0; i < cnt; i++)
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+
+ VIDEO_STREAM_CONFIG_CAPS caps;
+ memset(&caps, 0, sizeof(caps));
+
+ s.Empty();
+ ss.Format(_T("%d\n"), i); s += ss;
+ f.WriteString(s);
+
+ if(FAILED(pAMVSCCap->GetStreamCaps(i, &pmt, (BYTE*)&caps)))
+ continue;
+
+ {
+ s.Empty();
+ ss.Format(_T("VIDEO_STREAM_CONFIG_CAPS\n")); s += ss;
+ ss.Format(_T("\tVideoStandard 0x%08x\n"), caps.VideoStandard); s += ss;
+ ss.Format(_T("\tInputSize %dx%d\n"), caps.InputSize); s += ss;
+ ss.Format(_T("\tCroppingSize %dx%d - %dx%d\n"), caps.MinCroppingSize, caps.MaxCroppingSize); s += ss;
+ ss.Format(_T("\tCropGranularity %d, %d\n"), caps.CropGranularityX, caps.CropGranularityY); s += ss;
+ ss.Format(_T("\tCropAlign %d, %d\n"), caps.CropAlignX, caps.CropAlignY); s += ss;
+ ss.Format(_T("\tOutputSize %dx%d - %dx%d\n"), caps.MinOutputSize, caps.MaxOutputSize); s += ss;
+ ss.Format(_T("\tOutputGranularity %d, %d\n"), caps.OutputGranularityX, caps.OutputGranularityY); s += ss;
+ ss.Format(_T("\tStretchTaps %d, %d\n"), caps.StretchTapsX, caps.StretchTapsY); s += ss;
+ ss.Format(_T("\tShrinkTaps %d, %d\n"), caps.ShrinkTapsX, caps.ShrinkTapsY); s += ss;
+ ss.Format(_T("\tFrameInterval %I64d, %I64d (%.4f, %.4f)\n"),
+ caps.MinFrameInterval, caps.MaxFrameInterval,
+ (float)10000000/caps.MinFrameInterval, (float)10000000/caps.MaxFrameInterval); s += ss;
+ ss.Format(_T("\tBitsPerSecond %d - %d\n"), caps.MinBitsPerSecond, caps.MaxBitsPerSecond); s += ss;
+ f.WriteString(s);
+ }
+
+ BITMAPINFOHEADER* pbh;
+ if(pmt->formattype == FORMAT_VideoInfo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->pbFormat;
+ pbh = &vih->bmiHeader;
+
+ s.Empty();
+ ss.Format(_T("FORMAT_VideoInfo\n")); s += ss;
+ ss.Format(_T("\tAvgTimePerFrame %I64d, %.4f\n"), vih->AvgTimePerFrame, (float)10000000/vih->AvgTimePerFrame); s += ss;
+ ss.Format(_T("\trcSource %d,%d,%d,%d\n"), vih->rcSource); s += ss;
+ ss.Format(_T("\trcTarget %d,%d,%d,%d\n"), vih->rcTarget); s += ss;
+ f.WriteString(s);
+ }
+ else if(pmt->formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
+ pbh = &vih->bmiHeader;
+
+ s.Empty();
+ ss.Format(_T("FORMAT_VideoInfo2\n")); s += ss;
+ ss.Format(_T("\tAvgTimePerFrame %I64d, %.4f\n"), vih->AvgTimePerFrame, (float)10000000/vih->AvgTimePerFrame); s += ss;
+ ss.Format(_T("\trcSource %d,%d,%d,%d\n"), vih->rcSource); s += ss;
+ ss.Format(_T("\trcTarget %d,%d,%d,%d\n"), vih->rcTarget); s += ss;
+ ss.Format(_T("\tdwInterlaceFlags 0x%x\n"), vih->dwInterlaceFlags); s += ss;
+ ss.Format(_T("\tdwPictAspectRatio %d:%d\n"), vih->dwPictAspectRatioX, vih->dwPictAspectRatioY); s += ss;
+ f.WriteString(s);
+ }
+ else
+ {
+ DeleteMediaType(pmt);
+ continue;
+ }
+
+ s.Empty();
+ ss.Format(_T("BITMAPINFOHEADER\n")); s += ss;
+ ss.Format(_T("\tbiCompression %x\n"), pbh->biCompression); s += ss;
+ ss.Format(_T("\tbiWidth %d\n"), pbh->biWidth); s += ss;
+ ss.Format(_T("\tbiHeight %d\n"), pbh->biHeight); s += ss;
+ ss.Format(_T("\tbiBitCount %d\n"), pbh->biBitCount); s += ss;
+ ss.Format(_T("\tbiPlanes %d\n"), pbh->biPlanes); s += ss;
+ ss.Format(_T("\tbiSizeImage %d\n"), pbh->biSizeImage); s += ss;
+ f.WriteString(s);
+
+ DeleteMediaType(pmt);
+ }
+ }
+ else if(size == sizeof(AUDIO_STREAM_CONFIG_CAPS))
+ {
+ // TODO
+ }
+}
+
+int CountPins(IBaseFilter* pBF, int& nIn, int& nOut, int& nInC, int& nOutC)
+{
+ nIn = nOut = 0;
+ nInC = nOutC = 0;
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ PIN_DIRECTION dir;
+ if(SUCCEEDED(pPin->QueryDirection(&dir)))
+ {
+ CComPtr<IPin> pPinConnectedTo;
+ pPin->ConnectedTo(&pPinConnectedTo);
+
+ if(dir == PINDIR_INPUT) {nIn++; if(pPinConnectedTo) nInC++;}
+ else if(dir == PINDIR_OUTPUT) {nOut++; if(pPinConnectedTo) nOutC++;}
+ }
+ }
+ EndEnumPins
+
+ return(nIn+nOut);
+}
+
+bool IsSplitter(IBaseFilter* pBF, bool fCountConnectedOnly)
+{
+ int nIn, nOut, nInC, nOutC;
+ CountPins(pBF, nIn, nOut, nInC, nOutC);
+ return(fCountConnectedOnly ? nOutC > 1 : nOut > 1);
+}
+
+bool IsMultiplexer(IBaseFilter* pBF, bool fCountConnectedOnly)
+{
+ int nIn, nOut, nInC, nOutC;
+ CountPins(pBF, nIn, nOut, nInC, nOutC);
+ return(fCountConnectedOnly ? nInC > 1 : nIn > 1);
+}
+
+bool IsStreamStart(IBaseFilter* pBF)
+{
+ CComQIPtr<IAMFilterMiscFlags> pAMMF(pBF);
+ if(pAMMF && pAMMF->GetMiscFlags()&AM_FILTER_MISC_FLAGS_IS_SOURCE)
+ return(true);
+
+ int nIn, nOut, nInC, nOutC;
+ CountPins(pBF, nIn, nOut, nInC, nOutC);
+ AM_MEDIA_TYPE mt;
+ CComPtr<IPin> pIn = GetFirstPin(pBF);
+ return((nOut > 1)
+ || (nOut > 0 && nIn == 1 && pIn && SUCCEEDED(pIn->ConnectionMediaType(&mt)) && mt.majortype == MEDIATYPE_Stream));
+}
+
+bool IsStreamEnd(IBaseFilter* pBF)
+{
+ int nIn, nOut, nInC, nOutC;
+ CountPins(pBF, nIn, nOut, nInC, nOutC);
+ return(nOut == 0);
+}
+
+bool IsVideoRenderer(IBaseFilter* pBF)
+{
+ int nIn, nOut, nInC, nOutC;
+ CountPins(pBF, nIn, nOut, nInC, nOutC);
+
+ if(nInC > 0 && nOut == 0)
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ AM_MEDIA_TYPE mt;
+ if(S_OK != pPin->ConnectionMediaType(&mt))
+ continue;
+
+ FreeMediaType(mt);
+
+ return(!!(mt.majortype == MEDIATYPE_Video));
+ /*&& (mt.formattype == FORMAT_VideoInfo || mt.formattype == FORMAT_VideoInfo2));*/
+ }
+ EndEnumPins
+ }
+
+ CLSID clsid;
+ memcpy(&clsid, &GUID_NULL, sizeof(clsid));
+ pBF->GetClassID(&clsid);
+
+ return(clsid == CLSID_VideoRenderer || clsid == CLSID_VideoRendererDefault);
+}
+
+#include <initguid.h>
+
+DEFINE_GUID(CLSID_ReClock,
+0x9dc15360, 0x914c, 0x46b8, 0xb9, 0xdf, 0xbf, 0xe6, 0x7f, 0xd3, 0x6c, 0x6a);
+
+bool IsAudioWaveRenderer(IBaseFilter* pBF)
+{
+ int nIn, nOut, nInC, nOutC;
+ CountPins(pBF, nIn, nOut, nInC, nOutC);
+
+ if(nInC > 0 && nOut == 0 && CComQIPtr<IBasicAudio>(pBF))
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ AM_MEDIA_TYPE mt;
+ if(S_OK != pPin->ConnectionMediaType(&mt))
+ continue;
+
+ FreeMediaType(mt);
+
+ return(!!(mt.majortype == MEDIATYPE_Audio)
+ /*&& mt.formattype == FORMAT_WaveFormatEx*/);
+ }
+ EndEnumPins
+ }
+
+ CLSID clsid;
+ memcpy(&clsid, &GUID_NULL, sizeof(clsid));
+ pBF->GetClassID(&clsid);
+
+ return(clsid == CLSID_DSoundRender || clsid == CLSID_AudioRender || clsid == CLSID_ReClock
+ || clsid == __uuidof(CNullAudioRenderer) || clsid == __uuidof(CNullUAudioRenderer));
+}
+
+IBaseFilter* GetUpStreamFilter(IBaseFilter* pBF, IPin* pInputPin)
+{
+ return GetFilterFromPin(GetUpStreamPin(pBF, pInputPin));
+}
+
+IPin* GetUpStreamPin(IBaseFilter* pBF, IPin* pInputPin)
+{
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ if(pInputPin && pInputPin != pPin) continue;
+
+ PIN_DIRECTION dir;
+ CComPtr<IPin> pPinConnectedTo;
+ if(SUCCEEDED(pPin->QueryDirection(&dir)) && dir == PINDIR_INPUT
+ && SUCCEEDED(pPin->ConnectedTo(&pPinConnectedTo)))
+ {
+ IPin* pRet = pPinConnectedTo.Detach();
+ pRet->Release();
+ return(pRet);
+ }
+ }
+ EndEnumPins
+
+ return(NULL);
+}
+
+IPin* GetFirstPin(IBaseFilter* pBF, PIN_DIRECTION dir)
+{
+ if(!pBF) return(NULL);
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ PIN_DIRECTION dir2;
+ pPin->QueryDirection(&dir2);
+ if(dir == dir2)
+ {
+ IPin* pRet = pPin.Detach();
+ pRet->Release();
+ return(pRet);
+ }
+ }
+ EndEnumPins
+
+ return(NULL);
+}
+
+IPin* GetFirstDisconnectedPin(IBaseFilter* pBF, PIN_DIRECTION dir)
+{
+ if(!pBF) return(NULL);
+
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ PIN_DIRECTION dir2;
+ pPin->QueryDirection(&dir2);
+ CComPtr<IPin> pPinTo;
+ if(dir == dir2 && (S_OK != pPin->ConnectedTo(&pPinTo)))
+ {
+ IPin* pRet = pPin.Detach();
+ pRet->Release();
+ return(pRet);
+ }
+ }
+ EndEnumPins
+
+ return(NULL);
+}
+
+IBaseFilter* FindFilter(LPCWSTR clsid, IFilterGraph* pFG)
+{
+ CLSID clsid2;
+ CLSIDFromString(CComBSTR(clsid), &clsid2);
+ return(FindFilter(clsid2, pFG));
+}
+
+IBaseFilter* FindFilter(const CLSID& clsid, IFilterGraph* pFG)
+{
+ BeginEnumFilters(pFG, pEF, pBF)
+ {
+ CLSID clsid2;
+ if(SUCCEEDED(pBF->GetClassID(&clsid2)) && clsid == clsid2)
+ return(pBF);
+ }
+ EndEnumFilters
+
+ return NULL;
+}
+
+CStringW GetFilterName(IBaseFilter* pBF)
+{
+ CStringW name;
+ CFilterInfo fi;
+ if(pBF && SUCCEEDED(pBF->QueryFilterInfo(&fi)))
+ name = fi.achName;
+ return(name);
+}
+
+CStringW GetPinName(IPin* pPin)
+{
+ CStringW name;
+ CPinInfo pi;
+ if(pPin && SUCCEEDED(pPin->QueryPinInfo(&pi)))
+ name = pi.achName;
+ return(name);
+}
+
+IFilterGraph* GetGraphFromFilter(IBaseFilter* pBF)
+{
+ if(!pBF) return NULL;
+ IFilterGraph* pGraph = NULL;
+ CFilterInfo fi;
+ if(pBF && SUCCEEDED(pBF->QueryFilterInfo(&fi)))
+ pGraph = fi.pGraph;
+ return(pGraph);
+}
+
+IBaseFilter* GetFilterFromPin(IPin* pPin)
+{
+ if(!pPin) return NULL;
+ IBaseFilter* pBF = NULL;
+ CPinInfo pi;
+ if(pPin && SUCCEEDED(pPin->QueryPinInfo(&pi)))
+ pBF = pi.pFilter;
+ return(pBF);
+}
+
+IPin* AppendFilter(IPin* pPin, CString DisplayName, IGraphBuilder* pGB)
+{
+ IPin* pRet = pPin;
+
+ CInterfaceList<IBaseFilter> pFilters;
+
+ do
+ {
+ if(!pPin || DisplayName.IsEmpty() || !pGB)
+ break;
+
+ CComPtr<IPin> pPinTo;
+ PIN_DIRECTION dir;
+ if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT || SUCCEEDED(pPin->ConnectedTo(&pPinTo)))
+ break;
+
+ CComPtr<IBindCtx> pBindCtx;
+ CreateBindCtx(0, &pBindCtx);
+
+ CComPtr<IMoniker> pMoniker;
+ ULONG chEaten;
+ if(S_OK != MkParseDisplayName(pBindCtx, CComBSTR(DisplayName), &chEaten, &pMoniker))
+ break;
+
+ CComPtr<IBaseFilter> pBF;
+ if(FAILED(pMoniker->BindToObject(pBindCtx, 0, IID_IBaseFilter, (void**)&pBF)) || !pBF)
+ break;
+
+ CComPtr<IPropertyBag> pPB;
+ if(FAILED(pMoniker->BindToStorage(pBindCtx, 0, IID_IPropertyBag, (void**)&pPB)))
+ break;
+
+ CComVariant var;
+ if(FAILED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ break;
+
+ pFilters.AddTail(pBF);
+ BeginEnumFilters(pGB, pEnum, pBF2)
+ pFilters.AddTail(pBF2);
+ EndEnumFilters
+
+ if(FAILED(pGB->AddFilter(pBF, CStringW(var.bstrVal))))
+ break;
+
+ BeginEnumFilters(pGB, pEnum, pBF2)
+ if(!pFilters.Find(pBF2) && SUCCEEDED(pGB->RemoveFilter(pBF2)))
+ pEnum->Reset();
+ EndEnumFilters
+
+ pPinTo = GetFirstPin(pBF, PINDIR_INPUT);
+ if(!pPinTo)
+ {
+ pGB->RemoveFilter(pBF);
+ break;
+ }
+
+ HRESULT hr;
+ if(FAILED(hr = pGB->ConnectDirect(pPin, pPinTo, NULL)))
+ {
+ hr = pGB->Connect(pPin, pPinTo);
+ pGB->RemoveFilter(pBF);
+ break;
+ }
+
+ BeginEnumFilters(pGB, pEnum, pBF2)
+ if(!pFilters.Find(pBF2) && SUCCEEDED(pGB->RemoveFilter(pBF2)))
+ pEnum->Reset();
+ EndEnumFilters
+
+ pRet = GetFirstPin(pBF, PINDIR_OUTPUT);
+ if(!pRet)
+ {
+ pRet = pPin;
+ pGB->RemoveFilter(pBF);
+ break;
+ }
+ }
+ while(false);
+
+ return(pRet);
+}
+
+IPin* InsertFilter(IPin* pPin, CString DisplayName, IGraphBuilder* pGB)
+{
+ do
+ {
+ if(!pPin || DisplayName.IsEmpty() || !pGB)
+ break;
+
+ PIN_DIRECTION dir;
+ if(FAILED(pPin->QueryDirection(&dir)))
+ break;
+
+ CComPtr<IPin> pFrom, pTo;
+
+ if(dir == PINDIR_INPUT)
+ {
+ pPin->ConnectedTo(&pFrom);
+ pTo = pPin;
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ pFrom = pPin;
+ pPin->ConnectedTo(&pTo);
+ }
+
+ if(!pFrom || !pTo)
+ break;
+
+ CComPtr<IBindCtx> pBindCtx;
+ CreateBindCtx(0, &pBindCtx);
+
+ CComPtr<IMoniker> pMoniker;
+ ULONG chEaten;
+ if(S_OK != MkParseDisplayName(pBindCtx, CComBSTR(DisplayName), &chEaten, &pMoniker))
+ break;
+
+ CComPtr<IBaseFilter> pBF;
+ if(FAILED(pMoniker->BindToObject(pBindCtx, 0, IID_IBaseFilter, (void**)&pBF)) || !pBF)
+ break;
+
+ CComPtr<IPropertyBag> pPB;
+ if(FAILED(pMoniker->BindToStorage(pBindCtx, 0, IID_IPropertyBag, (void**)&pPB)))
+ break;
+
+ CComVariant var;
+ if(FAILED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ break;
+
+ if(FAILED(pGB->AddFilter(pBF, CStringW(var.bstrVal))))
+ break;
+
+ CComPtr<IPin> pFromTo = GetFirstPin(pBF, PINDIR_INPUT);
+ if(!pFromTo)
+ {
+ pGB->RemoveFilter(pBF);
+ break;
+ }
+
+ if(FAILED(pGB->Disconnect(pFrom)) || FAILED(pGB->Disconnect(pTo)))
+ {
+ pGB->RemoveFilter(pBF);
+ pGB->ConnectDirect(pFrom, pTo, NULL);
+ break;
+ }
+
+ HRESULT hr;
+ if(FAILED(hr = pGB->ConnectDirect(pFrom, pFromTo, NULL)))
+ {
+ pGB->RemoveFilter(pBF);
+ pGB->ConnectDirect(pFrom, pTo, NULL);
+ break;
+ }
+
+ CComPtr<IPin> pToFrom = GetFirstPin(pBF, PINDIR_OUTPUT);
+ if(!pToFrom)
+ {
+ pGB->RemoveFilter(pBF);
+ pGB->ConnectDirect(pFrom, pTo, NULL);
+ break;
+ }
+
+ if(FAILED(pGB->ConnectDirect(pToFrom, pTo, NULL)))
+ {
+ pGB->RemoveFilter(pBF);
+ pGB->ConnectDirect(pFrom, pTo, NULL);
+ break;
+ }
+
+ pPin = pToFrom;
+ }
+ while(false);
+
+ return(pPin);
+}
+
+void ExtractMediaTypes(IPin* pPin, CAtlArray<GUID>& types)
+{
+ types.RemoveAll();
+
+ BeginEnumMediaTypes(pPin, pEM, pmt)
+ {
+ bool fFound = false;
+
+ for(int i = 0; !fFound && i < types.GetCount(); i += 2)
+ {
+ if(types[i] == pmt->majortype && types[i+1] == pmt->subtype)
+ fFound = true;
+ }
+
+ if(!fFound)
+ {
+ types.Add(pmt->majortype);
+ types.Add(pmt->subtype);
+ }
+ }
+ EndEnumMediaTypes(pmt)
+}
+
+void ExtractMediaTypes(IPin* pPin, CAtlList<CMediaType>& mts)
+{
+ mts.RemoveAll();
+
+ BeginEnumMediaTypes(pPin, pEM, pmt)
+ {
+ bool fFound = false;
+
+ POSITION pos = mts.GetHeadPosition();
+ while(!fFound && pos)
+ {
+ CMediaType& mt = mts.GetNext(pos);
+ if(mt.majortype == pmt->majortype && mt.subtype == pmt->subtype)
+ fFound = true;
+ }
+
+ if(!fFound)
+ {
+ mts.AddTail(CMediaType(*pmt));
+ }
+ }
+ EndEnumMediaTypes(pmt)
+}
+
+int Eval_Exception(int n_except)
+{
+ if(n_except == STATUS_ACCESS_VIOLATION)
+ {
+ AfxMessageBox(_T("The property page of this filter has just caused a\nmemory access violation. The application will gently die now :)"));
+ }
+
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+
+void MyOleCreatePropertyFrame(HWND hwndOwner, UINT x, UINT y, LPCOLESTR lpszCaption, ULONG cObjects, LPUNKNOWN FAR* lplpUnk, ULONG cPages, LPCLSID lpPageClsID, LCID lcid, DWORD dwReserved, LPVOID lpvReserved)
+{
+ __try
+ {
+ OleCreatePropertyFrame(hwndOwner, x, y, lpszCaption, cObjects, lplpUnk, cPages, lpPageClsID, lcid, dwReserved, lpvReserved);
+ }
+ __except(Eval_Exception(GetExceptionCode()))
+ {
+ // No code; this block never executed.
+ }
+}
+
+void ShowPPage(CString DisplayName, HWND hParentWnd)
+{
+ CComPtr<IBindCtx> pBindCtx;
+ CreateBindCtx(0, &pBindCtx);
+
+ CComPtr<IMoniker> pMoniker;
+ ULONG chEaten;
+ if(S_OK != MkParseDisplayName(pBindCtx, CStringW(DisplayName), &chEaten, &pMoniker))
+ return;
+
+ CComPtr<IBaseFilter> pBF;
+ if(FAILED(pMoniker->BindToObject(pBindCtx, 0, IID_IBaseFilter, (void**)&pBF)) || !pBF)
+ return;
+
+ ShowPPage(pBF, hParentWnd);
+}
+
+void ShowPPage(IUnknown* pUnk, HWND hParentWnd)
+{
+ CComQIPtr<ISpecifyPropertyPages> pSPP = pUnk;
+ if(!pSPP) return;
+
+ CString str;
+
+ CComQIPtr<IBaseFilter> pBF = pSPP;
+ CFilterInfo fi;
+ CComQIPtr<IPin> pPin = pSPP;
+ CPinInfo pi;
+ if(pBF && SUCCEEDED(pBF->QueryFilterInfo(&fi)))
+ str = fi.achName;
+ else if(pPin && SUCCEEDED(pPin->QueryPinInfo(&pi)))
+ str = pi.achName;
+
+ CAUUID caGUID;
+ caGUID.pElems = NULL;
+ if(SUCCEEDED(pSPP->GetPages(&caGUID)))
+ {
+ IUnknown* lpUnk = NULL;
+ pSPP.QueryInterface(&lpUnk);
+ MyOleCreatePropertyFrame(
+ hParentWnd, 0, 0, CStringW(str),
+ 1, (IUnknown**)&lpUnk,
+ caGUID.cElems, caGUID.pElems,
+ 0, 0, NULL);
+ lpUnk->Release();
+
+ if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+ }
+}
+
+CLSID GetCLSID(IBaseFilter* pBF)
+{
+ CLSID clsid = GUID_NULL;
+ if(pBF) pBF->GetClassID(&clsid);
+ return(clsid);
+}
+
+CLSID GetCLSID(IPin* pPin)
+{
+ return(GetCLSID(GetFilterFromPin(pPin)));
+}
+
+bool IsCLSIDRegistered(LPCTSTR clsid)
+{
+ CString rootkey1(_T("CLSID\\"));
+ CString rootkey2(_T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\"));
+
+ return ERROR_SUCCESS == CRegKey().Open(HKEY_CLASSES_ROOT, rootkey1 + clsid, KEY_READ)
+ || ERROR_SUCCESS == CRegKey().Open(HKEY_CLASSES_ROOT, rootkey2 + clsid, KEY_READ);
+}
+
+bool IsCLSIDRegistered(const CLSID& clsid)
+{
+ bool fRet = false;
+
+ LPOLESTR pStr = NULL;
+ if(S_OK == StringFromCLSID(clsid, &pStr) && pStr)
+ {
+ fRet = IsCLSIDRegistered(CString(pStr));
+ CoTaskMemFree(pStr);
+ }
+
+ return(fRet);
+}
+
+void CStringToBin(CString str, CAtlArray<BYTE>& data)
+{
+ str.Trim();
+ ASSERT((str.GetLength()&1) == 0);
+ data.SetCount(str.GetLength()/2);
+
+ BYTE b = 0;
+
+ str.MakeUpper();
+ for(int i = 0, j = str.GetLength(); i < j; i++)
+ {
+ TCHAR c = str[i];
+ if(c >= '0' && c <= '9')
+ {
+ if(!(i&1)) b = ((char(c-'0')<<4)&0xf0)|(b&0x0f);
+ else b = (char(c-'0')&0x0f)|(b&0xf0);
+ }
+ else if(c >= 'A' && c <= 'F')
+ {
+ if(!(i&1)) b = ((char(c-'A'+10)<<4)&0xf0)|(b&0x0f);
+ else b = (char(c-'A'+10)&0x0f)|(b&0xf0);
+ }
+ else break;
+
+ if(i&1)
+ {
+ data[i>>1] = b;
+ b = 0;
+ }
+ }
+}
+
+CString BinToCString(BYTE* ptr, int len)
+{
+ CString ret;
+
+ while(len-- > 0)
+ {
+ TCHAR high, low;
+ high = (*ptr>>4) >= 10 ? (*ptr>>4)-10 + 'A' : (*ptr>>4) + '0';
+ low = (*ptr&0xf) >= 10 ? (*ptr&0xf)-10 + 'A' : (*ptr&0xf) + '0';
+
+ CString str;
+ str.Format(_T("%c%c"), high, low);
+ ret += str;
+
+ ptr++;
+ }
+
+ return(ret);
+}
+
+static void FindFiles(CString fn, CAtlList<CString>& files)
+{
+ CString path = fn;
+ path.Replace('/', '\\');
+ path = path.Left(path.ReverseFind('\\')+1);
+
+ WIN32_FIND_DATA findData;
+ HANDLE h = FindFirstFile(fn, &findData);
+ if(h != INVALID_HANDLE_VALUE)
+ {
+ do {files.AddTail(path + findData.cFileName);}
+ while(FindNextFile(h, &findData));
+
+ FindClose(h);
+ }
+}
+
+cdrom_t GetCDROMType(TCHAR drive, CAtlList<CString>& files)
+{
+ files.RemoveAll();
+
+ CString path;
+ path.Format(_T("%c:"), drive);
+
+ if(GetDriveType(path + _T("\\")) == DRIVE_CDROM)
+ {
+ // CDROM_VideoCD
+ FindFiles(path + _T("\\mpegav\\avseq??.dat"), files);
+ FindFiles(path + _T("\\mpegav\\avseq??.mpg"), files);
+ FindFiles(path + _T("\\mpeg2\\avseq??.dat"), files);
+ FindFiles(path + _T("\\mpeg2\\avseq??.mpg"), files);
+ FindFiles(path + _T("\\mpegav\\music??.dat"), files);
+ FindFiles(path + _T("\\mpegav\\music??.mpg"), files);
+ FindFiles(path + _T("\\mpeg2\\music??.dat"), files);
+ FindFiles(path + _T("\\mpeg2\\music??.mpg"), files);
+ if(files.GetCount() > 0) return CDROM_VideoCD;
+
+ // CDROM_DVDVideo
+ FindFiles(path + _T("\\VIDEO_TS\\video_ts.ifo"), files);
+ if(files.GetCount() > 0) return CDROM_DVDVideo;
+
+ // CDROM_Audio
+ if(!(GetVersion()&0x80000000))
+ {
+ HANDLE hDrive = CreateFile(CString(_T("\\\\.\\")) + path, GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL);
+ if(hDrive != INVALID_HANDLE_VALUE)
+ {
+ DWORD BytesReturned;
+ CDROM_TOC TOC;
+ if(DeviceIoControl(hDrive, IOCTL_CDROM_READ_TOC, NULL, 0, &TOC, sizeof(TOC), &BytesReturned, 0))
+ {
+ for(int i = TOC.FirstTrack; i <= TOC.LastTrack; i++)
+ {
+ // MMC-3 Draft Revision 10g: Table 222 – Q Sub-channel control field
+ TOC.TrackData[i-1].Control &= 5;
+ if(TOC.TrackData[i-1].Control == 0 || TOC.TrackData[i-1].Control == 1)
+ {
+ CString fn;
+ fn.Format(_T("%s\\track%02d.cda"), path, i);
+ files.AddTail(fn);
+ }
+ }
+ }
+
+ CloseHandle(hDrive);
+ }
+ }
+ if(files.GetCount() > 0) return CDROM_Audio;
+
+ // it is a cdrom but nothing special
+ return CDROM_Unknown;
+ }
+
+ return CDROM_NotFound;
+}
+
+CString GetDriveLabel(TCHAR drive)
+{
+ CString label;
+
+ CString path;
+ path.Format(_T("%c:\\"), drive);
+ TCHAR VolumeNameBuffer[MAX_PATH], FileSystemNameBuffer[MAX_PATH];
+ DWORD VolumeSerialNumber, MaximumComponentLength, FileSystemFlags;
+ if(GetVolumeInformation(path,
+ VolumeNameBuffer, MAX_PATH, &VolumeSerialNumber, &MaximumComponentLength,
+ &FileSystemFlags, FileSystemNameBuffer, MAX_PATH))
+ {
+ label = VolumeNameBuffer;
+ }
+
+ return(label);
+}
+
+bool GetKeyFrames(CString fn, CUIntArray& kfs)
+{
+ kfs.RemoveAll();
+
+ CString fn2 = CString(fn).MakeLower();
+ if(fn2.Mid(fn2.ReverseFind('.')+1) == _T("avi"))
+ {
+ AVIFileInit();
+
+ PAVIFILE pfile;
+ if(AVIFileOpen(&pfile, fn, OF_SHARE_DENY_WRITE, 0L) == 0)
+ {
+ AVIFILEINFO afi;
+ memset(&afi, 0, sizeof(afi));
+ AVIFileInfo(pfile, &afi, sizeof(AVIFILEINFO));
+
+ CComPtr<IAVIStream> pavi;
+ if(AVIFileGetStream(pfile, &pavi, streamtypeVIDEO, 0) == AVIERR_OK)
+ {
+ AVISTREAMINFO si;
+ AVIStreamInfo(pavi, &si, sizeof(si));
+
+ if(afi.dwCaps&AVIFILECAPS_ALLKEYFRAMES)
+ {
+ kfs.SetSize(si.dwLength);
+ for(int kf = 0; kf < si.dwLength; kf++) kfs[kf] = kf;
+ }
+ else
+ {
+ for(int kf = 0; ; kf++)
+ {
+ kf = pavi->FindSample(kf, FIND_KEY|FIND_NEXT);
+ if(kf < 0 || kfs.GetCount() > 0 && kfs[kfs.GetCount()-1] >= kf) break;
+ kfs.Add(kf);
+ }
+
+ if(kfs.GetCount() > 0 && kfs[kfs.GetCount()-1] < si.dwLength-1)
+ {
+ kfs.Add(si.dwLength-1);
+ }
+ }
+ }
+
+ AVIFileRelease(pfile);
+ }
+
+ AVIFileExit();
+ }
+
+ return(kfs.GetCount() > 0);
+}
+
+DVD_HMSF_TIMECODE RT2HMSF(REFERENCE_TIME rt, double fps)
+{
+ DVD_HMSF_TIMECODE hmsf =
+ {
+ (BYTE)((rt/10000000/60/60)),
+ (BYTE)((rt/10000000/60)%60),
+ (BYTE)((rt/10000000)%60),
+ (BYTE)(1.0*((rt/10000)%1000) * fps / 1000)
+ };
+
+ return hmsf;
+}
+
+REFERENCE_TIME HMSF2RT(DVD_HMSF_TIMECODE hmsf, double fps)
+{
+ if(fps == 0) {hmsf.bFrames = 0; fps = 1;}
+ return (REFERENCE_TIME)((((REFERENCE_TIME)hmsf.bHours*60+hmsf.bMinutes)*60+hmsf.bSeconds)*1000+1.0*hmsf.bFrames*1000/fps)*10000;
+}
+
+void memsetd(void* dst, unsigned int c, int nbytes)
+{
+ __asm
+ {
+ mov eax, c
+ mov ecx, nbytes
+ shr ecx, 2
+ mov edi, dst
+ cld
+ rep stosd
+ }
+}
+
+bool ExtractBIH(const AM_MEDIA_TYPE* pmt, BITMAPINFOHEADER* bih)
+{
+ if(pmt && bih)
+ {
+ memset(bih, 0, sizeof(*bih));
+
+ if(pmt->formattype == FORMAT_VideoInfo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->pbFormat;
+ memcpy(bih, &vih->bmiHeader, sizeof(BITMAPINFOHEADER));
+ return true;
+ }
+ else if(pmt->formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
+ memcpy(bih, &vih->bmiHeader, sizeof(BITMAPINFOHEADER));
+ return true;
+ }
+ else if(pmt->formattype == FORMAT_MPEGVideo)
+ {
+ VIDEOINFOHEADER* vih = &((MPEG1VIDEOINFO*)pmt->pbFormat)->hdr;
+ memcpy(bih, &vih->bmiHeader, sizeof(BITMAPINFOHEADER));
+ return true;
+ }
+ else if(pmt->formattype == FORMAT_MPEG2_VIDEO)
+ {
+ VIDEOINFOHEADER2* vih = &((MPEG2VIDEOINFO*)pmt->pbFormat)->hdr;
+ memcpy(bih, &vih->bmiHeader, sizeof(BITMAPINFOHEADER));
+ return true;
+ }
+ else if(pmt->formattype == FORMAT_DiracVideoInfo)
+ {
+ VIDEOINFOHEADER2* vih = &((DIRACINFOHEADER*)pmt->pbFormat)->hdr;
+ memcpy(bih, &vih->bmiHeader, sizeof(BITMAPINFOHEADER));
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool ExtractBIH(IMediaSample* pMS, BITMAPINFOHEADER* bih)
+{
+ AM_MEDIA_TYPE* pmt = NULL;
+ pMS->GetMediaType(&pmt);
+ if(pmt)
+ {
+ bool fRet = ExtractBIH(pmt, bih);
+ DeleteMediaType(pmt);
+ return(fRet);
+ }
+
+ return(false);
+}
+
+bool ExtractDim(const AM_MEDIA_TYPE* pmt, int& w, int& h, int& arx, int& ary)
+{
+ w = h = arx = ary = 0;
+
+ if(pmt->formattype == FORMAT_VideoInfo || pmt->formattype == FORMAT_MPEGVideo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->pbFormat;
+ w = vih->bmiHeader.biWidth;
+ h = abs(vih->bmiHeader.biHeight);
+ arx = w * vih->bmiHeader.biYPelsPerMeter;
+ ary = h * vih->bmiHeader.biXPelsPerMeter;
+ }
+ else if(pmt->formattype == FORMAT_VideoInfo2 || pmt->formattype == FORMAT_MPEG2_VIDEO || pmt->formattype == FORMAT_DiracVideoInfo)
+ {
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
+ w = vih->bmiHeader.biWidth;
+ h = abs(vih->bmiHeader.biHeight);
+ arx = vih->dwPictAspectRatioX;
+ ary = vih->dwPictAspectRatioY;
+ }
+ else
+ {
+ return(false);
+ }
+
+ if(!arx || !ary)
+ {
+ arx = w;
+ ary = h;
+ }
+
+ BYTE* ptr = NULL;
+ DWORD len = 0;
+
+ if(pmt->formattype == FORMAT_MPEGVideo)
+ {
+ ptr = ((MPEG1VIDEOINFO*)pmt->pbFormat)->bSequenceHeader;
+ len = ((MPEG1VIDEOINFO*)pmt->pbFormat)->cbSequenceHeader;
+
+ if(ptr && len >= 8 && *(DWORD*)ptr == 0xb3010000)
+ {
+ w = (ptr[4]<<4)|(ptr[5]>>4);
+ h = ((ptr[5]&0xf)<<8)|ptr[6];
+ float ar[] =
+ {
+ 1.0000f,1.0000f,0.6735f,0.7031f,
+ 0.7615f,0.8055f,0.8437f,0.8935f,
+ 0.9157f,0.9815f,1.0255f,1.0695f,
+ 1.0950f,1.1575f,1.2015f,1.0000f,
+ };
+ arx = (int)((float)w / ar[ptr[7]>>4] + 0.5);
+ ary = h;
+ }
+ }
+ else if(pmt->formattype == FORMAT_MPEG2_VIDEO)
+ {
+ ptr = (BYTE*)((MPEG2VIDEOINFO*)pmt->pbFormat)->dwSequenceHeader;
+ len = ((MPEG2VIDEOINFO*)pmt->pbFormat)->cbSequenceHeader;
+
+ if(ptr && len >= 8 && *(DWORD*)ptr == 0xb3010000)
+ {
+ w = (ptr[4]<<4)|(ptr[5]>>4);
+ h = ((ptr[5]&0xf)<<8)|ptr[6];
+ struct {int x, y;} ar[] = {{w,h},{4,3},{16,9},{221,100},{w,h}};
+ int i = min(max(ptr[7]>>4, 1), 5)-1;
+ arx = ar[i].x;
+ ary = ar[i].y;
+ }
+ }
+
+ if(ptr && len >= 8)
+ {
+
+ }
+
+ DWORD a = arx, b = ary;
+ while(a) {int tmp = a; a = b % tmp; b = tmp;}
+ if(b) arx /= b, ary /= b;
+
+ return(true);
+}
+
+bool MakeMPEG2MediaType(CMediaType& mt, BYTE* seqhdr, DWORD len, int w, int h)
+{
+ if(len < 4 || *(DWORD*)seqhdr != 0xb3010000) return false;
+
+ BYTE* seqhdr_ext = NULL;
+
+ BYTE* seqhdr_end = seqhdr + 11;
+ if(seqhdr_end - seqhdr > len) return false;
+ if(*seqhdr_end & 0x02) seqhdr_end += 64;
+ if(seqhdr_end - seqhdr > len) return false;
+ if(*seqhdr_end & 0x01) seqhdr_end += 64;
+ if(seqhdr_end - seqhdr > len) return false;
+ seqhdr_end++;
+ if(seqhdr_end - seqhdr > len) return false;
+ if(len - (seqhdr_end - seqhdr) > 4 && *(DWORD*)seqhdr_end == 0xb5010000) {seqhdr_ext = seqhdr_end; seqhdr_end += 10;}
+ if(seqhdr_end - seqhdr > len) return false;
+
+ len = seqhdr_end - seqhdr;
+
+ mt = CMediaType();
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = MEDIASUBTYPE_MPEG2_VIDEO;
+ mt.formattype = FORMAT_MPEG2Video;
+
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + len);
+ memset(mt.Format(), 0, mt.FormatLength());
+ vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
+ vih->hdr.bmiHeader.biWidth = w;
+ vih->hdr.bmiHeader.biHeight = h;
+
+ BYTE* pSequenceHeader = (BYTE*)vih->dwSequenceHeader;
+ memcpy(pSequenceHeader, seqhdr, len);
+ vih->cbSequenceHeader = len;
+
+ static char profile[8] =
+ {
+ 0, AM_MPEG2Profile_High, AM_MPEG2Profile_SpatiallyScalable, AM_MPEG2Profile_SNRScalable,
+ AM_MPEG2Profile_Main, AM_MPEG2Profile_Simple, 0, 0
+ };
+
+ static char level[16] =
+ {
+ 0, 0, 0, 0,
+ AM_MPEG2Level_High, 0, AM_MPEG2Level_High1440, 0,
+ AM_MPEG2Level_Main, 0, AM_MPEG2Level_Low, 0,
+ 0, 0, 0, 0
+ };
+
+ if(seqhdr_ext && (seqhdr_ext[4] & 0xf0) == 0x10)
+ {
+ vih->dwProfile = profile[seqhdr_ext[4] & 0x07];
+ vih->dwLevel = level[seqhdr_ext[5] >> 4];
+ }
+
+ return true;
+}
+
+unsigned __int64 GetFileVersion(LPCTSTR fn)
+{
+ unsigned __int64 ret = 0;
+
+ DWORD buff[4];
+ VS_FIXEDFILEINFO* pvsf = (VS_FIXEDFILEINFO*)buff;
+ DWORD d; // a variable that GetFileVersionInfoSize sets to zero (but why is it needed ?????????????????????????????? :)
+ DWORD len = GetFileVersionInfoSize((TCHAR*)fn, &d);
+
+ if(len)
+ {
+ TCHAR* b1 = new TCHAR[len];
+ if(b1)
+ {
+ UINT uLen;
+ if(GetFileVersionInfo((TCHAR*)fn, 0, len, b1) && VerQueryValue(b1, _T("\\"), (void**)&pvsf, &uLen))
+ {
+ ret = ((unsigned __int64)pvsf->dwFileVersionMS<<32) | pvsf->dwFileVersionLS;
+ }
+
+ delete [] b1;
+ }
+ }
+
+ return ret;
+}
+
+bool CreateFilter(CStringW DisplayName, IBaseFilter** ppBF, CStringW& FriendlyName)
+{
+ if(!ppBF) return(false);
+
+ *ppBF = NULL;
+ FriendlyName.Empty();
+
+ CComPtr<IBindCtx> pBindCtx;
+ CreateBindCtx(0, &pBindCtx);
+
+ CComPtr<IMoniker> pMoniker;
+ ULONG chEaten;
+ if(S_OK != MkParseDisplayName(pBindCtx, CComBSTR(DisplayName), &chEaten, &pMoniker))
+ return(false);
+
+ if(FAILED(pMoniker->BindToObject(pBindCtx, 0, IID_IBaseFilter, (void**)ppBF)) || !*ppBF)
+ return(false);
+
+ CComPtr<IPropertyBag> pPB;
+ CComVariant var;
+ if(SUCCEEDED(pMoniker->BindToStorage(pBindCtx, 0, IID_IPropertyBag, (void**)&pPB))
+ && SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ FriendlyName = var.bstrVal;
+
+ return(true);
+}
+
+IBaseFilter* AppendFilter(IPin* pPin, IMoniker* pMoniker, IGraphBuilder* pGB)
+{
+ do
+ {
+ if(!pPin || !pMoniker || !pGB)
+ break;
+
+ CComPtr<IPin> pPinTo;
+ PIN_DIRECTION dir;
+ if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT || SUCCEEDED(pPin->ConnectedTo(&pPinTo)))
+ break;
+
+ CComPtr<IBindCtx> pBindCtx;
+ CreateBindCtx(0, &pBindCtx);
+
+ CComPtr<IPropertyBag> pPB;
+ if(FAILED(pMoniker->BindToStorage(pBindCtx, 0, IID_IPropertyBag, (void**)&pPB)))
+ break;
+
+ CComVariant var;
+ if(FAILED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ break;
+
+ CComPtr<IBaseFilter> pBF;
+ if(FAILED(pMoniker->BindToObject(pBindCtx, 0, IID_IBaseFilter, (void**)&pBF)) || !pBF)
+ break;
+
+ if(FAILED(pGB->AddFilter(pBF, CStringW(var.bstrVal))))
+ break;
+
+ BeginEnumPins(pBF, pEP, pPinTo)
+ {
+ PIN_DIRECTION dir;
+ if(FAILED(pPinTo->QueryDirection(&dir)) || dir != PINDIR_INPUT)
+ continue;
+
+ if(SUCCEEDED(pGB->ConnectDirect(pPin, pPinTo, NULL)))
+ return(pBF);
+ }
+ EndEnumFilters
+
+ pGB->RemoveFilter(pBF);
+ }
+ while(false);
+
+ return(NULL);
+}
+
+CStringW GetFriendlyName(CStringW DisplayName)
+{
+ CStringW FriendlyName;
+
+ CComPtr<IBindCtx> pBindCtx;
+ CreateBindCtx(0, &pBindCtx);
+
+ CComPtr<IMoniker> pMoniker;
+ ULONG chEaten;
+ if(S_OK != MkParseDisplayName(pBindCtx, CComBSTR(DisplayName), &chEaten, &pMoniker))
+ return(false);
+
+ CComPtr<IPropertyBag> pPB;
+ CComVariant var;
+ if(SUCCEEDED(pMoniker->BindToStorage(pBindCtx, 0, IID_IPropertyBag, (void**)&pPB))
+ && SUCCEEDED(pPB->Read(CComBSTR(_T("FriendlyName")), &var, NULL)))
+ FriendlyName = var.bstrVal;
+
+ return FriendlyName;
+}
+
+typedef struct
+{
+ CString path;
+ HINSTANCE hInst;
+ CLSID clsid;
+} ExternalObject;
+
+static CAtlList<ExternalObject> s_extobjs;
+
+HRESULT LoadExternalObject(LPCTSTR path, REFCLSID clsid, REFIID iid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ CString fullpath = MakeFullPath(path);
+
+ HINSTANCE hInst = NULL;
+ bool fFound = false;
+
+ POSITION pos = s_extobjs.GetHeadPosition();
+ while(pos)
+ {
+ ExternalObject& eo = s_extobjs.GetNext(pos);
+ if(!eo.path.CompareNoCase(fullpath))
+ {
+ hInst = eo.hInst;
+ fFound = true;
+ break;
+ }
+ }
+
+ HRESULT hr = E_FAIL;
+
+ if(hInst || (hInst = CoLoadLibrary(CComBSTR(fullpath), TRUE)))
+ {
+ typedef HRESULT (__stdcall * PDllGetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
+ PDllGetClassObject p = (PDllGetClassObject)GetProcAddress(hInst, "DllGetClassObject");
+
+ if(p && FAILED(hr = p(clsid, iid, ppv)))
+ {
+ CComPtr<IClassFactory> pCF;
+ if(SUCCEEDED(hr = p(clsid, __uuidof(IClassFactory), (void**)&pCF)))
+ {
+ hr = pCF->CreateInstance(NULL, iid, ppv);
+ }
+ }
+ }
+
+ if(FAILED(hr) && hInst && !fFound)
+ {
+ CoFreeLibrary(hInst);
+ return hr;
+ }
+
+ if(hInst && !fFound)
+ {
+ ExternalObject eo;
+ eo.path = fullpath;
+ eo.hInst = hInst;
+ eo.clsid = clsid;
+ s_extobjs.AddTail(eo);
+ }
+
+ return hr;
+}
+
+HRESULT LoadExternalFilter(LPCTSTR path, REFCLSID clsid, IBaseFilter** ppBF)
+{
+ return LoadExternalObject(path, clsid, __uuidof(IBaseFilter), (void**)ppBF);
+}
+
+HRESULT LoadExternalPropertyPage(IPersist* pP, REFCLSID clsid, IPropertyPage** ppPP)
+{
+ CLSID clsid2 = GUID_NULL;
+ if(FAILED(pP->GetClassID(&clsid2))) return E_FAIL;
+
+ POSITION pos = s_extobjs.GetHeadPosition();
+ while(pos)
+ {
+ ExternalObject& eo = s_extobjs.GetNext(pos);
+ if(eo.clsid == clsid2)
+ {
+ return LoadExternalObject(eo.path, clsid, __uuidof(IPropertyPage), (void**)ppPP);
+ }
+ }
+
+ return E_FAIL;
+}
+
+void UnloadExternalObjects()
+{
+ POSITION pos = s_extobjs.GetHeadPosition();
+ while(pos)
+ {
+ ExternalObject& eo = s_extobjs.GetNext(pos);
+ CoFreeLibrary(eo.hInst);
+ }
+ s_extobjs.RemoveAll();
+}
+
+CString MakeFullPath(LPCTSTR path)
+{
+ CString full(path);
+ full.Replace('/', '\\');
+
+ CString fn;
+ fn.ReleaseBuffer(GetModuleFileName(AfxGetInstanceHandle(), fn.GetBuffer(MAX_PATH), MAX_PATH));
+ CPath p(fn);
+
+ if(full.GetLength() >= 2 && full[0] == '\\' && full[1] != '\\')
+ {
+ p.StripToRoot();
+ full = CString(p) + full.Mid(1);
+ }
+ else if(full.Find(_T(":\\")) < 0)
+ {
+ p.RemoveFileSpec();
+ p.AddBackslash();
+ full = CString(p) + full;
+ }
+
+ CPath c(full);
+ c.Canonicalize();
+ return CString(c);
+}
+
+//
+
+CString GetMediaTypeName(const GUID& guid)
+{
+ CString ret = guid == GUID_NULL
+ ? _T("Any type")
+ : CString(GuidNames[guid]);
+
+ if(ret == _T("FOURCC GUID"))
+ {
+ CString str;
+ if(guid.Data1 >= 0x10000)
+ str.Format(_T("Video: %c%c%c%c"), (guid.Data1>>0)&0xff, (guid.Data1>>8)&0xff, (guid.Data1>>16)&0xff, (guid.Data1>>24)&0xff);
+ else
+ str.Format(_T("Audio: 0x%08x"), guid.Data1);
+ ret = str;
+ }
+ else if(ret == _T("Unknown GUID Name"))
+ {
+ WCHAR null[128] = {0}, buff[128];
+ StringFromGUID2(GUID_NULL, null, 127);
+ ret = CString(CStringW(StringFromGUID2(guid, buff, 127) ? buff : null));
+ }
+
+ return ret;
+}
+
+GUID GUIDFromCString(CString str)
+{
+ GUID guid = GUID_NULL;
+ HRESULT hr = CLSIDFromString(CComBSTR(str), &guid);
+ ASSERT(SUCCEEDED(hr));
+ return guid;
+}
+
+HRESULT GUIDFromCString(CString str, GUID& guid)
+{
+ guid = GUID_NULL;
+ return CLSIDFromString(CComBSTR(str), &guid);
+}
+
+CString CStringFromGUID(const GUID& guid)
+{
+ WCHAR null[128] = {0}, buff[128];
+ StringFromGUID2(GUID_NULL, null, 127);
+ return CString(StringFromGUID2(guid, buff, 127) > 0 ? buff : null);
+}
+
+CStringW UTF8To16(LPCSTR utf8)
+{
+ CStringW str;
+ int n = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0)-1;
+ if(n < 0) return str;
+ str.ReleaseBuffer(MultiByteToWideChar(CP_UTF8, 0, utf8, -1, str.GetBuffer(n), n+1)-1);
+ return str;
+}
+
+CStringA UTF16To8(LPCWSTR utf16)
+{
+ CStringA str;
+ int n = WideCharToMultiByte(CP_UTF8, 0, utf16, -1, NULL, 0, NULL, NULL)-1;
+ if(n < 0) return str;
+ str.ReleaseBuffer(WideCharToMultiByte(CP_UTF8, 0, utf16, -1, str.GetBuffer(n), n+1, NULL, NULL)-1);
+ return str;
+}
+
+static struct {LPCSTR name, iso6392, iso6391;} s_isolangs[] =
+{
+ {"Abkhazian", "abk", "ab"},
+ {"Achinese", "ace", ""},
+ {"Acoli", "ach", ""},
+ {"Adangme", "ada", ""},
+ {"Afar", "aar", "aa"},
+ {"Afrihili", "afh", ""},
+ {"Afrikaans", "afr", "af"},
+ {"Afro-Asiatic (Other)", "afa", ""},
+ {"Akan", "aka", "ak"},
+ {"Akkadian", "akk", ""},
+ {"Albanian", "alb", "sq"},
+ {"Albanian", "sqi", "sq"},
+ {"Aleut", "ale", ""},
+ {"Algonquian languages", "alg", ""},
+ {"Altaic (Other)", "tut", ""},
+ {"Amharic", "amh", "am"},
+ {"Apache languages", "apa", ""},
+ {"Arabic", "ara", "ar"},
+ {"Aragonese", "arg", "an"},
+ {"Aramaic", "arc", ""},
+ {"Arapaho", "arp", ""},
+ {"Araucanian", "arn", ""},
+ {"Arawak", "arw", ""},
+ {"Armenian", "arm", "hy"},
+ {"Armenian", "hye", "hy"},
+ {"Artificial (Other)", "art", ""},
+ {"Assamese", "asm", "as"},
+ {"Asturian; Bable", "ast", ""},
+ {"Athapascan languages", "ath", ""},
+ {"Australian languages", "aus", ""},
+ {"Austronesian (Other)", "map", ""},
+ {"Avaric", "ava", "av"},
+ {"Avestan", "ave", "ae"},
+ {"Awadhi", "awa", ""},
+ {"Aymara", "aym", "ay"},
+ {"Azerbaijani", "aze", "az"},
+ {"Bable; Asturian", "ast", ""},
+ {"Balinese", "ban", ""},
+ {"Baltic (Other)", "bat", ""},
+ {"Baluchi", "bal", ""},
+ {"Bambara", "bam", "bm"},
+ {"Bamileke languages", "bai", ""},
+ {"Banda", "bad", ""},
+ {"Bantu (Other)", "bnt", ""},
+ {"Basa", "bas", ""},
+ {"Bashkir", "bak", "ba"},
+ {"Basque", "baq", "eu"},
+ {"Basque", "eus", "eu"},
+ {"Batak (Indonesia)", "btk", ""},
+ {"Beja", "bej", ""},
+ {"Belarusian", "bel", "be"},
+ {"Bemba", "bem", ""},
+ {"Bengali", "ben", "bn"},
+ {"Berber (Other)", "ber", ""},
+ {"Bhojpuri", "bho", ""},
+ {"Bihari", "bih", "bh"},
+ {"Bikol", "bik", ""},
+ {"Bini", "bin", ""},
+ {"Bislama", "bis", "bi"},
+ {"Bokmål, Norwegian; Norwegian Bokmål", "nob", "nb"},
+ {"Bosnian", "bos", "bs"},
+ {"Braj", "bra", ""},
+ {"Breton", "bre", "br"},
+ {"Buginese", "bug", ""},
+ {"Bulgarian", "bul", "bg"},
+ {"Buriat", "bua", ""},
+ {"Burmese", "bur", "my"},
+ {"Burmese", "mya", "my"},
+ {"Caddo", "cad", ""},
+ {"Carib", "car", ""},
+ {"Spanish; Castilian", "spa", "es"},
+ {"Catalan", "cat", "ca"},
+ {"Caucasian (Other)", "cau", ""},
+ {"Cebuano", "ceb", ""},
+ {"Celtic (Other)", "cel", ""},
+ {"Central American Indian (Other)", "cai", ""},
+ {"Chagatai", "chg", ""},
+ {"Chamic languages", "cmc", ""},
+ {"Chamorro", "cha", "ch"},
+ {"Chechen", "che", "ce"},
+ {"Cherokee", "chr", ""},
+ {"Chewa; Chichewa; Nyanja", "nya", "ny"},
+ {"Cheyenne", "chy", ""},
+ {"Chibcha", "chb", ""},
+ {"Chichewa; Chewa; Nyanja", "nya", "ny"},
+ {"Chinese", "chi", "zh"},
+ {"Chinese", "zho", "zh"},
+ {"Chinook jargon", "chn", ""},
+ {"Chipewyan", "chp", ""},
+ {"Choctaw", "cho", ""},
+ {"Chuang; Zhuang", "zha", "za"},
+ {"Church Slavic; Old Church Slavonic", "chu", "cu"},
+ {"Old Church Slavonic; Old Slavonic; ", "chu", "cu"},
+ {"Church Slavonic; Old Bulgarian; Church Slavic;", "chu", "cu"},
+ {"Old Slavonic; Church Slavonic; Old Bulgarian;", "chu", "cu"},
+ {"Church Slavic; Old Church Slavonic", "chu", "cu"},
+ {"Chuukese", "chk", ""},
+ {"Chuvash", "chv", "cv"},
+ {"Coptic", "cop", ""},
+ {"Cornish", "cor", "kw"},
+ {"Corsican", "cos", "co"},
+ {"Cree", "cre", "cr"},
+ {"Creek", "mus", ""},
+ {"Creoles and pidgins (Other)", "crp", ""},
+ {"Creoles and pidgins,", "cpe", ""},
+ // {"English-based (Other)", "", ""},
+ {"Creoles and pidgins,", "cpf", ""},
+ // {"French-based (Other)", "", ""},
+ {"Creoles and pidgins,", "cpp", ""},
+ // {"Portuguese-based (Other)", "", ""},
+ {"Croatian", "scr", "hr"},
+ {"Croatian", "hrv", "hr"},
+ {"Cushitic (Other)", "cus", ""},
+ {"Czech", "cze", "cs"},
+ {"Czech", "ces", "cs"},
+ {"Dakota", "dak", ""},
+ {"Danish", "dan", "da"},
+ {"Dargwa", "dar", ""},
+ {"Dayak", "day", ""},
+ {"Delaware", "del", ""},
+ {"Dinka", "din", ""},
+ {"Divehi", "div", "dv"},
+ {"Dogri", "doi", ""},
+ {"Dogrib", "dgr", ""},
+ {"Dravidian (Other)", "dra", ""},
+ {"Duala", "dua", ""},
+ {"Dutch; Flemish", "dut", "nl"},
+ {"Dutch; Flemish", "nld", "nl"},
+ {"Dutch, Middle (ca. 1050-1350)", "dum", ""},
+ {"Dyula", "dyu", ""},
+ {"Dzongkha", "dzo", "dz"},
+ {"Efik", "efi", ""},
+ {"Egyptian (Ancient)", "egy", ""},
+ {"Ekajuk", "eka", ""},
+ {"Elamite", "elx", ""},
+ {"English", "eng", "en"},
+ {"English, Middle (1100-1500)", "enm", ""},
+ {"English, Old (ca.450-1100)", "ang", ""},
+ {"Esperanto", "epo", "eo"},
+ {"Estonian", "est", "et"},
+ {"Ewe", "ewe", "ee"},
+ {"Ewondo", "ewo", ""},
+ {"Fang", "fan", ""},
+ {"Fanti", "fat", ""},
+ {"Faroese", "fao", "fo"},
+ {"Fijian", "fij", "fj"},
+ {"Finnish", "fin", "fi"},
+ {"Finno-Ugrian (Other)", "fiu", ""},
+ {"Flemish; Dutch", "dut", "nl"},
+ {"Flemish; Dutch", "nld", "nl"},
+ {"Fon", "fon", ""},
+ {"French", "fre", "fr"},
+ {"French", "fra*", "fr"},
+ {"French, Middle (ca.1400-1600)", "frm", ""},
+ {"French, Old (842-ca.1400)", "fro", ""},
+ {"Frisian", "fry", "fy"},
+ {"Friulian", "fur", ""},
+ {"Fulah", "ful", "ff"},
+ {"Ga", "gaa", ""},
+ {"Gaelic; Scottish Gaelic", "gla", "gd"},
+ {"Gallegan", "glg", "gl"},
+ {"Ganda", "lug", "lg"},
+ {"Gayo", "gay", ""},
+ {"Gbaya", "gba", ""},
+ {"Geez", "gez", ""},
+ {"Georgian", "geo", "ka"},
+ {"Georgian", "kat", "ka"},
+ {"German", "ger", "de"},
+ {"German", "deu", "de"},
+ {"German, Low; Saxon, Low; Low German; Low Saxon", "nds", ""},
+ {"German, Middle High (ca.1050-1500)", "gmh", ""},
+ {"German, Old High (ca.750-1050)", "goh", ""},
+ {"Germanic (Other)", "gem", ""},
+ {"Gikuyu; Kikuyu", "kik", "ki"},
+ {"Gilbertese", "gil", ""},
+ {"Gondi", "gon", ""},
+ {"Gorontalo", "gor", ""},
+ {"Gothic", "got", ""},
+ {"Grebo", "grb", ""},
+ {"Greek, Ancient (to 1453)", "grc", ""},
+ {"Greek, Modern (1453-)", "gre", "el"},
+ {"Greek, Modern (1453-)", "ell", "el"},
+ {"Greenlandic; Kalaallisut", "kal", "kl"},
+ {"Guarani", "grn", "gn"},
+ {"Gujarati", "guj", "gu"},
+ {"Gwich´in", "gwi", ""},
+ {"Haida", "hai", ""},
+ {"Hausa", "hau", "ha"},
+ {"Hawaiian", "haw", ""},
+ {"Hebrew", "heb", "he"},
+ {"Herero", "her", "hz"},
+ {"Hiligaynon", "hil", ""},
+ {"Himachali", "him", ""},
+ {"Hindi", "hin", "hi"},
+ {"Hiri Motu", "hmo", "ho"},
+ {"Hittite", "hit", ""},
+ {"Hmong", "hmn", ""},
+ {"Hungarian", "hun", "hu"},
+ {"Hupa", "hup", ""},
+ {"Iban", "iba", ""},
+ {"Icelandic", "ice", "is"},
+ {"Icelandic", "isl", "is"},
+ {"Ido", "ido", "io"},
+ {"Igbo", "ibo", "ig"},
+ {"Ijo", "ijo", ""},
+ {"Iloko", "ilo", ""},
+ {"Inari Sami", "smn", ""},
+ {"Indic (Other)", "inc", ""},
+ {"Indo-European (Other)", "ine", ""},
+ {"Indonesian", "ind", "id"},
+ {"Ingush", "inh", ""},
+ {"Interlingua (International", "ina", "ia"},
+ // {"Auxiliary Language Association)", "", ""},
+ {"Interlingue", "ile", "ie"},
+ {"Inuktitut", "iku", "iu"},
+ {"Inupiaq", "ipk", "ik"},
+ {"Iranian (Other)", "ira", ""},
+ {"Irish", "gle", "ga"},
+ {"Irish, Middle (900-1200)", "mga", ""},
+ {"Irish, Old (to 900)", "sga", ""},
+ {"Iroquoian languages", "iro", ""},
+ {"Italian", "ita", "it"},
+ {"Japanese", "jpn", "ja"},
+ {"Javanese", "jav", "jv"},
+ {"Judeo-Arabic", "jrb", ""},
+ {"Judeo-Persian", "jpr", ""},
+ {"Kabardian", "kbd", ""},
+ {"Kabyle", "kab", ""},
+ {"Kachin", "kac", ""},
+ {"Kalaallisut; Greenlandic", "kal", "kl"},
+ {"Kamba", "kam", ""},
+ {"Kannada", "kan", "kn"},
+ {"Kanuri", "kau", "kr"},
+ {"Kara-Kalpak", "kaa", ""},
+ {"Karen", "kar", ""},
+ {"Kashmiri", "kas", "ks"},
+ {"Kawi", "kaw", ""},
+ {"Kazakh", "kaz", "kk"},
+ {"Khasi", "kha", ""},
+ {"Khmer", "khm", "km"},
+ {"Khoisan (Other)", "khi", ""},
+ {"Khotanese", "kho", ""},
+ {"Kikuyu; Gikuyu", "kik", "ki"},
+ {"Kimbundu", "kmb", ""},
+ {"Kinyarwanda", "kin", "rw"},
+ {"Kirghiz", "kir", "ky"},
+ {"Komi", "kom", "kv"},
+ {"Kongo", "kon", "kg"},
+ {"Konkani", "kok", ""},
+ {"Korean", "kor", "ko"},
+ {"Kosraean", "kos", ""},
+ {"Kpelle", "kpe", ""},
+ {"Kru", "kro", ""},
+ {"Kuanyama; Kwanyama", "kua", "kj"},
+ {"Kumyk", "kum", ""},
+ {"Kurdish", "kur", "ku"},
+ {"Kurukh", "kru", ""},
+ {"Kutenai", "kut", ""},
+ {"Kwanyama, Kuanyama", "kua", "kj"},
+ {"Ladino", "lad", ""},
+ {"Lahnda", "lah", ""},
+ {"Lamba", "lam", ""},
+ {"Lao", "lao", "lo"},
+ {"Latin", "lat", "la"},
+ {"Latvian", "lav", "lv"},
+ {"Letzeburgesch; Luxembourgish", "ltz", "lb"},
+ {"Lezghian", "lez", ""},
+ {"Limburgan; Limburger; Limburgish", "lim", "li"},
+ {"Limburger; Limburgan; Limburgish;", "lim", "li"},
+ {"Limburgish; Limburger; Limburgan", "lim", "li"},
+ {"Lingala", "lin", "ln"},
+ {"Lithuanian", "lit", "lt"},
+ {"Low German; Low Saxon; German, Low; Saxon, Low", "nds", ""},
+ {"Low Saxon; Low German; Saxon, Low; German, Low", "nds", ""},
+ {"Lozi", "loz", ""},
+ {"Luba-Katanga", "lub", "lu"},
+ {"Luba-Lulua", "lua", ""},
+ {"Luiseno", "lui", ""},
+ {"Lule Sami", "smj", ""},
+ {"Lunda", "lun", ""},
+ {"Luo (Kenya and Tanzania)", "luo", ""},
+ {"Lushai", "lus", ""},
+ {"Luxembourgish; Letzeburgesch", "ltz", "lb"},
+ {"Macedonian", "mac", "mk"},
+ {"Macedonian", "mkd", "mk"},
+ {"Madurese", "mad", ""},
+ {"Magahi", "mag", ""},
+ {"Maithili", "mai", ""},
+ {"Makasar", "mak", ""},
+ {"Malagasy", "mlg", "mg"},
+ {"Malay", "may", "ms"},
+ {"Malay", "msa", "ms"},
+ {"Malayalam", "mal", "ml"},
+ {"Maltese", "mlt", "mt"},
+ {"Manchu", "mnc", ""},
+ {"Mandar", "mdr", ""},
+ {"Mandingo", "man", ""},
+ {"Manipuri", "mni", ""},
+ {"Manobo languages", "mno", ""},
+ {"Manx", "glv", "gv"},
+ {"Maori", "mao", "mi"},
+ {"Maori", "mri", "mi"},
+ {"Marathi", "mar", "mr"},
+ {"Mari", "chm", ""},
+ {"Marshallese", "mah", "mh"},
+ {"Marwari", "mwr", ""},
+ {"Masai", "mas", ""},
+ {"Mayan languages", "myn", ""},
+ {"Mende", "men", ""},
+ {"Micmac", "mic", ""},
+ {"Minangkabau", "min", ""},
+ {"Miscellaneous languages", "mis", ""},
+ {"Mohawk", "moh", ""},
+ {"Moldavian", "mol", "mo"},
+ {"Mon-Khmer (Other)", "mkh", ""},
+ {"Mongo", "lol", ""},
+ {"Mongolian", "mon", "mn"},
+ {"Mossi", "mos", ""},
+ {"Multiple languages", "mul", ""},
+ {"Munda languages", "mun", ""},
+ {"Nahuatl", "nah", ""},
+ {"Nauru", "nau", "na"},
+ {"Navaho, Navajo", "nav", "nv"},
+ {"Navajo; Navaho", "nav", "nv"},
+ {"Ndebele, North", "nde", "nd"},
+ {"Ndebele, South", "nbl", "nr"},
+ {"Ndonga", "ndo", "ng"},
+ {"Neapolitan", "nap", ""},
+ {"Nepali", "nep", "ne"},
+ {"Newari", "new", ""},
+ {"Nias", "nia", ""},
+ {"Niger-Kordofanian (Other)", "nic", ""},
+ {"Nilo-Saharan (Other)", "ssa", ""},
+ {"Niuean", "niu", ""},
+ {"Norse, Old", "non", ""},
+ {"North American Indian (Other)", "nai", ""},
+ {"Northern Sami", "sme", "se"},
+ {"North Ndebele", "nde", "nd"},
+ {"Norwegian", "nor", "no"},
+ {"Norwegian Bokmål; Bokmål, Norwegian", "nob", "nb"},
+ {"Norwegian Nynorsk; Nynorsk, Norwegian", "nno", "nn"},
+ {"Nubian languages", "nub", ""},
+ {"Nyamwezi", "nym", ""},
+ {"Nyanja; Chichewa; Chewa", "nya", "ny"},
+ {"Nyankole", "nyn", ""},
+ {"Nynorsk, Norwegian; Norwegian Nynorsk", "nno", "nn"},
+ {"Nyoro", "nyo", ""},
+ {"Nzima", "nzi", ""},
+ {"Occitan (post 1500},; Provençal", "oci", "oc"},
+ {"Ojibwa", "oji", "oj"},
+ {"Old Bulgarian; Old Slavonic; Church Slavonic;", "chu", "cu"},
+ {"Oriya", "ori", "or"},
+ {"Oromo", "orm", "om"},
+ {"Osage", "osa", ""},
+ {"Ossetian; Ossetic", "oss", "os"},
+ {"Ossetic; Ossetian", "oss", "os"},
+ {"Otomian languages", "oto", ""},
+ {"Pahlavi", "pal", ""},
+ {"Palauan", "pau", ""},
+ {"Pali", "pli", "pi"},
+ {"Pampanga", "pam", ""},
+ {"Pangasinan", "pag", ""},
+ {"Panjabi", "pan", "pa"},
+ {"Papiamento", "pap", ""},
+ {"Papuan (Other)", "paa", ""},
+ {"Persian", "per", "fa"},
+ {"Persian", "fas", "fa"},
+ {"Persian, Old (ca.600-400 B.C.)", "peo", ""},
+ {"Philippine (Other)", "phi", ""},
+ {"Phoenician", "phn", ""},
+ {"Pohnpeian", "pon", ""},
+ {"Polish", "pol", "pl"},
+ {"Portuguese", "por", "pt"},
+ {"Prakrit languages", "pra", ""},
+ {"Provençal; Occitan (post 1500)", "oci", "oc"},
+ {"Provençal, Old (to 1500)", "pro", ""},
+ {"Pushto", "pus", "ps"},
+ {"Quechua", "que", "qu"},
+ {"Raeto-Romance", "roh", "rm"},
+ {"Rajasthani", "raj", ""},
+ {"Rapanui", "rap", ""},
+ {"Rarotongan", "rar", ""},
+ {"Reserved for local use", "qaa-qtz", ""},
+ {"Romance (Other)", "roa", ""},
+ {"Romanian", "rum", "ro"},
+ {"Romanian", "ron", "ro"},
+ {"Romany", "rom", ""},
+ {"Rundi", "run", "rn"},
+ {"Russian", "rus", "ru"},
+ {"Salishan languages", "sal", ""},
+ {"Samaritan Aramaic", "sam", ""},
+ {"Sami languages (Other)", "smi", ""},
+ {"Samoan", "smo", "sm"},
+ {"Sandawe", "sad", ""},
+ {"Sango", "sag", "sg"},
+ {"Sanskrit", "san", "sa"},
+ {"Santali", "sat", ""},
+ {"Sardinian", "srd", "sc"},
+ {"Sasak", "sas", ""},
+ {"Saxon, Low; German, Low; Low Saxon; Low German", "nds", ""},
+ {"Scots", "sco", ""},
+ {"Scottish Gaelic; Gaelic", "gla", "gd"},
+ {"Selkup", "sel", ""},
+ {"Semitic (Other)", "sem", ""},
+ {"Serbian", "scc", "sr"},
+ {"Serbian", "srp", "sr"},
+ {"Serer", "srr", ""},
+ {"Shan", "shn", ""},
+ {"Shona", "sna", "sn"},
+ {"Sichuan Yi", "iii", "ii"},
+ {"Sidamo", "sid", ""},
+ {"Sign languages", "sgn", ""},
+ {"Siksika", "bla", ""},
+ {"Sindhi", "snd", "sd"},
+ {"Sinhalese", "sin", "si"},
+ {"Sino-Tibetan (Other)", "sit", ""},
+ {"Siouan languages", "sio", ""},
+ {"Skolt Sami", "sms", ""},
+ {"Slave (Athapascan)", "den", ""},
+ {"Slavic (Other)", "sla", ""},
+ {"Slovak", "slo", "sk"},
+ {"Slovak", "slk", "sk"},
+ {"Slovenian", "slv", "sl"},
+ {"Sogdian", "sog", ""},
+ {"Somali", "som", "so"},
+ {"Songhai", "son", ""},
+ {"Soninke", "snk", ""},
+ {"Sorbian languages", "wen", ""},
+ {"Sotho, Northern", "nso", ""},
+ {"Sotho, Southern", "sot", "st"},
+ {"South American Indian (Other)", "sai", ""},
+ {"Southern Sami", "sma", ""},
+ {"South Ndebele", "nbl", "nr"},
+ {"Spanish; Castilian", "spa", "es"},
+ {"Sukuma", "suk", ""},
+ {"Sumerian", "sux", ""},
+ {"Sundanese", "sun", "su"},
+ {"Susu", "sus", ""},
+ {"Swahili", "swa", "sw"},
+ {"Swati", "ssw", "ss"},
+ {"Swedish", "swe", "sv"},
+ {"Syriac", "syr", ""},
+ {"Tagalog", "tgl", "tl"},
+ {"Tahitian", "tah", "ty"},
+ {"Tai (Other)", "tai", ""},
+ {"Tajik", "tgk", "tg"},
+ {"Tamashek", "tmh", ""},
+ {"Tamil", "tam", "ta"},
+ {"Tatar", "tat", "tt"},
+ {"Telugu", "tel", "te"},
+ {"Tereno", "ter", ""},
+ {"Tetum", "tet", ""},
+ {"Thai", "tha", "th"},
+ {"Tibetan", "tib", "bo"},
+ {"Tibetan", "bod", "bo"},
+ {"Tigre", "tig", ""},
+ {"Tigrinya", "tir", "ti"},
+ {"Timne", "tem", ""},
+ {"Tiv", "tiv", ""},
+ {"Tlingit", "tli", ""},
+ {"Tok Pisin", "tpi", ""},
+ {"Tokelau", "tkl", ""},
+ {"Tonga (Nyasa)", "tog", ""},
+ {"Tonga (Tonga Islands)", "ton", "to"},
+ {"Tsimshian", "tsi", ""},
+ {"Tsonga", "tso", "ts"},
+ {"Tswana", "tsn", "tn"},
+ {"Tumbuka", "tum", ""},
+ {"Tupi languages", "tup", ""},
+ {"Turkish", "tur", "tr"},
+ {"Turkish, Ottoman (1500-1928)", "ota", ""},
+ {"Turkmen", "tuk", "tk"},
+ {"Tuvalu", "tvl", ""},
+ {"Tuvinian", "tyv", ""},
+ {"Twi", "twi", "tw"},
+ {"Ugaritic", "uga", ""},
+ {"Uighur", "uig", "ug"},
+ {"Ukrainian", "ukr", "uk"},
+ {"Umbundu", "umb", ""},
+ {"Undetermined", "und", ""},
+ {"Urdu", "urd", "ur"},
+ {"Uzbek", "uzb", "uz"},
+ {"Vai", "vai", ""},
+ {"Venda", "ven", "ve"},
+ {"Vietnamese", "vie", "vi"},
+ {"Volapük", "vol", "vo"},
+ {"Votic", "vot", ""},
+ {"Wakashan languages", "wak", ""},
+ {"Walamo", "wal", ""},
+ {"Walloon", "wln", "wa"},
+ {"Waray", "war", ""},
+ {"Washo", "was", ""},
+ {"Welsh", "wel", "cy"},
+ {"Welsh", "cym", "cy"},
+ {"Wolof", "wol", "wo"},
+ {"Xhosa", "xho", "xh"},
+ {"Yakut", "sah", ""},
+ {"Yao", "yao", ""},
+ {"Yapese", "yap", ""},
+ {"Yiddish", "yid", "yi"},
+ {"Yoruba", "yor", "yo"},
+ {"Yupik languages", "ypk", ""},
+ {"Zande", "znd", ""},
+ {"Zapotec", "zap", ""},
+ {"Zenaga", "zen", ""},
+ {"Zhuang; Chuang", "zha", "za"},
+ {"Zulu", "zul", "zu"},
+ {"Zuni", "zun", ""},
+ {"Classical Newari", "nwc", ""},
+ {"Klingon", "tlh", ""},
+ {"Blin", "byn", ""},
+ {"Lojban", "jbo", ""},
+ {"Lower Sorbian", "dsb", ""},
+ {"Upper Sorbian", "hsb", ""},
+ {"Kashubian", "csb", ""},
+ {"Crimean Turkish", "crh", ""},
+ {"Erzya", "myv", ""},
+ {"Moksha", "mdf", ""},
+ {"Karachay-Balkar", "krc", ""},
+ {"Adyghe", "ady", ""},
+ {"Udmurt", "udm", ""},
+ {"Dargwa", "dar", ""},
+ {"Ingush", "inh", ""},
+ {"Nogai", "nog", ""},
+ {"Haitian", "hat", "ht"},
+ {"Kalmyk", "xal", ""},
+ {"", "", ""},
+};
+
+CString ISO6391ToLanguage(LPCSTR code)
+{
+ CHAR tmp[2+1];
+ strncpy(tmp, code, 2);
+ tmp[2] = 0;
+ _strlwr(tmp);
+ for(int i = 0, j = countof(s_isolangs); i < j; i++)
+ if(!strcmp(s_isolangs[i].iso6391, tmp))
+ {
+ CString ret = CString(CStringA(s_isolangs[i].name));
+ int i = ret.Find(';');
+ if(i > 0) ret = ret.Left(i);
+ return ret;
+ }
+ return(_T(""));
+}
+
+CString ISO6392ToLanguage(LPCSTR code)
+{
+ CHAR tmp[3+1];
+ strncpy(tmp, code, 3);
+ tmp[3] = 0;
+ _strlwr(tmp);
+ for(int i = 0, j = countof(s_isolangs); i < j; i++)
+ {
+ if(!strcmp(s_isolangs[i].iso6392, tmp))
+ {
+ CString ret = CString(CStringA(s_isolangs[i].name));
+ int i = ret.Find(';');
+ if(i > 0) ret = ret.Left(i);
+ return ret;
+ }
+ }
+ return _T("");
+}
+
+CString ISO6391To6392(LPCSTR code)
+{
+ CHAR tmp[2+1];
+ strncpy(tmp, code, 2);
+ tmp[2] = 0;
+ _strlwr(tmp);
+ for(int i = 0, j = countof(s_isolangs); i < j; i++)
+ if(!strcmp(s_isolangs[i].iso6391, tmp))
+ return CString(CStringA(s_isolangs[i].iso6392));
+ return _T("");
+}
+
+CString ISO6392To6391(LPCSTR code)
+{
+ CHAR tmp[3+1];
+ strncpy(tmp, code, 3);
+ tmp[3] = 0;
+ _strlwr(tmp);
+ for(int i = 0, j = countof(s_isolangs); i < j; i++)
+ if(!strcmp(s_isolangs[i].iso6392, tmp))
+ return CString(CStringA(s_isolangs[i].iso6391));
+ return _T("");
+}
+
+CString LanguageToISO6392(LPCTSTR lang)
+{
+ CString str = lang;
+ str.MakeLower();
+ for(int i = 0, j = countof(s_isolangs); i < j; i++)
+ {
+ CAtlList<CString> sl;
+ Explode(CString(s_isolangs[i].name), sl, ';');
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ if(!str.CompareNoCase(sl.GetNext(pos)))
+ return CString(s_isolangs[i].iso6392);
+ }
+ }
+ return _T("");
+}
+
+int MakeAACInitData(BYTE* pData, int profile, int freq, int channels)
+{
+ int srate_idx;
+
+ if(92017 <= freq) srate_idx = 0;
+ else if(75132 <= freq) srate_idx = 1;
+ else if(55426 <= freq) srate_idx = 2;
+ else if(46009 <= freq) srate_idx = 3;
+ else if(37566 <= freq) srate_idx = 4;
+ else if(27713 <= freq) srate_idx = 5;
+ else if(23004 <= freq) srate_idx = 6;
+ else if(18783 <= freq) srate_idx = 7;
+ else if(13856 <= freq) srate_idx = 8;
+ else if(11502 <= freq) srate_idx = 9;
+ else if(9391 <= freq) srate_idx = 10;
+ else srate_idx = 11;
+
+ pData[0] = ((abs(profile) + 1) << 3) | ((srate_idx & 0xe) >> 1);
+ pData[1] = ((srate_idx & 0x1) << 7) | (channels << 3);
+
+ int ret = 2;
+
+ if(profile < 0)
+ {
+ freq *= 2;
+
+ if(92017 <= freq) srate_idx = 0;
+ else if(75132 <= freq) srate_idx = 1;
+ else if(55426 <= freq) srate_idx = 2;
+ else if(46009 <= freq) srate_idx = 3;
+ else if(37566 <= freq) srate_idx = 4;
+ else if(27713 <= freq) srate_idx = 5;
+ else if(23004 <= freq) srate_idx = 6;
+ else if(18783 <= freq) srate_idx = 7;
+ else if(13856 <= freq) srate_idx = 8;
+ else if(11502 <= freq) srate_idx = 9;
+ else if(9391 <= freq) srate_idx = 10;
+ else srate_idx = 11;
+
+ pData[2] = 0x2B7>>3;
+ pData[3] = (BYTE)((0x2B7<<5) | 5);
+ pData[4] = (1<<7) | (srate_idx<<3);
+
+ ret = 5;
+ }
+
+ return(ret);
+}
+
+BOOL CFileGetStatus(LPCTSTR lpszFileName, CFileStatus& status)
+{
+ try
+ {
+ return CFile::GetStatus(lpszFileName, status);
+ }
+ catch(CException* e)
+ {
+ // MFCBUG: E_INVALIDARG / "Parameter is incorrect" is thrown for certain cds (vs2003)
+ // http://groups.google.co.uk/groups?hl=en&lr=&ie=UTF-8&threadm=OZuXYRzWDHA.536%40TK2MSFTNGP10.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DISO-8859-1
+ TRACE(_T("CFile::GetStatus has thrown an exception\n"));
+ e->Delete();
+ return false;
+ }
+}
+
+// filter registration helpers
+
+bool DeleteRegKey(LPCTSTR pszKey, LPCTSTR pszSubkey)
+{
+ bool bOK = false;
+
+ HKEY hKey;
+ LONG ec = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, pszKey, 0, KEY_ALL_ACCESS, &hKey);
+ if(ec == ERROR_SUCCESS)
+ {
+ if(pszSubkey != 0)
+ ec = ::RegDeleteKey(hKey, pszSubkey);
+
+ bOK = (ec == ERROR_SUCCESS);
+
+ ::RegCloseKey(hKey);
+ }
+
+ return bOK;
+}
+
+bool SetRegKeyValue(LPCTSTR pszKey, LPCTSTR pszSubkey, LPCTSTR pszValueName, LPCTSTR pszValue)
+{
+ bool bOK = false;
+
+ CString szKey(pszKey);
+ if(pszSubkey != 0)
+ szKey += CString(_T("\\")) + pszSubkey;
+
+ HKEY hKey;
+ LONG ec = ::RegCreateKeyEx(HKEY_CLASSES_ROOT, szKey, 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, 0);
+ if(ec == ERROR_SUCCESS)
+ {
+ if(pszValue != 0)
+ {
+ ec = ::RegSetValueEx(hKey, pszValueName, 0, REG_SZ,
+ reinterpret_cast<BYTE*>(const_cast<LPTSTR>(pszValue)),
+ (_tcslen(pszValue) + 1) * sizeof(TCHAR));
+ }
+
+ bOK = (ec == ERROR_SUCCESS);
+
+ ::RegCloseKey(hKey);
+ }
+
+ return bOK;
+}
+
+bool SetRegKeyValue(LPCTSTR pszKey, LPCTSTR pszSubkey, LPCTSTR pszValue)
+{
+ return SetRegKeyValue(pszKey, pszSubkey, 0, pszValue);
+}
+
+void RegisterSourceFilter(const CLSID& clsid, const GUID& subtype2, LPCTSTR chkbytes, LPCTSTR ext, ...)
+{
+ CString null = CStringFromGUID(GUID_NULL);
+ CString majortype = CStringFromGUID(MEDIATYPE_Stream);
+ CString subtype = CStringFromGUID(subtype2);
+
+ SetRegKeyValue(_T("Media Type\\") + majortype, subtype, _T("0"), chkbytes);
+ SetRegKeyValue(_T("Media Type\\") + majortype, subtype, _T("Source Filter"), CStringFromGUID(clsid));
+
+ DeleteRegKey(_T("Media Type\\") + null, subtype);
+
+ va_list marker;
+ va_start(marker, ext);
+ for(; ext; ext = va_arg(marker, LPCTSTR))
+ DeleteRegKey(_T("Media Type\\Extensions"), ext);
+ va_end(marker);
+}
+
+void RegisterSourceFilter(const CLSID& clsid, const GUID& subtype2, const CAtlList<CString>& chkbytes, LPCTSTR ext, ...)
+{
+ CString null = CStringFromGUID(GUID_NULL);
+ CString majortype = CStringFromGUID(MEDIATYPE_Stream);
+ CString subtype = CStringFromGUID(subtype2);
+
+ POSITION pos = chkbytes.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ CString idx;
+ idx.Format(_T("%d"), i);
+ SetRegKeyValue(_T("Media Type\\") + majortype, subtype, idx, chkbytes.GetNext(pos));
+ }
+
+ SetRegKeyValue(_T("Media Type\\") + majortype, subtype, _T("Source Filter"), CStringFromGUID(clsid));
+
+ DeleteRegKey(_T("Media Type\\") + null, subtype);
+
+ va_list marker;
+ va_start(marker, ext);
+ for(; ext; ext = va_arg(marker, LPCTSTR))
+ DeleteRegKey(_T("Media Type\\Extensions"), ext);
+ va_end(marker);
+}
+
+void UnRegisterSourceFilter(const GUID& subtype)
+{
+ DeleteRegKey(_T("Media Type\\") + CStringFromGUID(MEDIATYPE_Stream), CStringFromGUID(subtype));
+}
diff --git a/src/dsutil/DSUtil.h b/src/dsutil/DSUtil.h
new file mode 100644
index 000000000..8b283a2c9
--- /dev/null
+++ b/src/dsutil/DSUtil.h
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#ifdef UNICODE
+#ifdef DEBUG
+#pragma comment(lib, "dsutilDU")
+#else
+#pragma comment(lib, "dsutilRU")
+#endif
+#else
+#ifdef DEBUG
+#pragma comment(lib, "dsutilD")
+#else
+#pragma comment(lib, "dsutilR")
+#endif
+#endif
+
+#include "NullRenderers.h"
+//#include "MediaTypes.h"
+#include "MediaTypeEx.h"
+#include "vd.h"
+#include "text.h"
+
+extern void DumpStreamConfig(TCHAR* fn, IAMStreamConfig* pAMVSCCap);
+extern int CountPins(IBaseFilter* pBF, int& nIn, int& nOut, int& nInC, int& nOutC);
+extern bool IsSplitter(IBaseFilter* pBF, bool fCountConnectedOnly = false);
+extern bool IsMultiplexer(IBaseFilter* pBF, bool fCountConnectedOnly = false);
+extern bool IsStreamStart(IBaseFilter* pBF);
+extern bool IsStreamEnd(IBaseFilter* pBF);
+extern bool IsVideoRenderer(IBaseFilter* pBF);
+extern bool IsAudioWaveRenderer(IBaseFilter* pBF);
+extern IBaseFilter* GetUpStreamFilter(IBaseFilter* pBF, IPin* pInputPin = NULL);
+extern IPin* GetUpStreamPin(IBaseFilter* pBF, IPin* pInputPin = NULL);
+extern IPin* GetFirstPin(IBaseFilter* pBF, PIN_DIRECTION dir = PINDIR_INPUT);
+extern IPin* GetFirstDisconnectedPin(IBaseFilter* pBF, PIN_DIRECTION dir);
+extern void NukeDownstream(IBaseFilter* pBF, IFilterGraph* pFG);
+extern void NukeDownstream(IPin* pPin, IFilterGraph* pFG);
+extern IBaseFilter* FindFilter(LPCWSTR clsid, IFilterGraph* pFG);
+extern IBaseFilter* FindFilter(const CLSID& clsid, IFilterGraph* pFG);
+extern CStringW GetFilterName(IBaseFilter* pBF);
+extern CStringW GetPinName(IPin* pPin);
+extern IFilterGraph* GetGraphFromFilter(IBaseFilter* pBF);
+extern IBaseFilter* GetFilterFromPin(IPin* pPin);
+extern IPin* AppendFilter(IPin* pPin, CString DisplayName, IGraphBuilder* pGB);
+extern IPin* InsertFilter(IPin* pPin, CString DisplayName, IGraphBuilder* pGB);
+extern void ExtractMediaTypes(IPin* pPin, CAtlArray<GUID>& types);
+extern void ExtractMediaTypes(IPin* pPin, CAtlList<CMediaType>& mts);
+extern void ShowPPage(CString DisplayName, HWND hParentWnd);
+extern void ShowPPage(IUnknown* pUnknown, HWND hParentWnd);
+extern CLSID GetCLSID(IBaseFilter* pBF);
+extern CLSID GetCLSID(IPin* pPin);
+extern bool IsCLSIDRegistered(LPCTSTR clsid);
+extern bool IsCLSIDRegistered(const CLSID& clsid);
+extern void CStringToBin(CString str, CAtlArray<BYTE>& data);
+extern CString BinToCString(BYTE* ptr, int len);
+typedef enum {CDROM_NotFound, CDROM_Audio, CDROM_VideoCD, CDROM_DVDVideo, CDROM_Unknown} cdrom_t;
+extern cdrom_t GetCDROMType(TCHAR drive, CAtlList<CString>& files);
+extern CString GetDriveLabel(TCHAR drive);
+extern bool GetKeyFrames(CString fn, CUIntArray& kfs);
+extern DVD_HMSF_TIMECODE RT2HMSF(REFERENCE_TIME rt, double fps = 0);
+extern REFERENCE_TIME HMSF2RT(DVD_HMSF_TIMECODE hmsf, double fps = 0);
+extern void memsetd(void* dst, unsigned int c, int nbytes);
+extern bool ExtractBIH(const AM_MEDIA_TYPE* pmt, BITMAPINFOHEADER* bih);
+extern bool ExtractBIH(IMediaSample* pMS, BITMAPINFOHEADER* bih);
+extern bool ExtractDim(const AM_MEDIA_TYPE* pmt, int& w, int& h, int& arx, int& ary);
+extern bool MakeMPEG2MediaType(CMediaType& mt, BYTE* seqhdr, DWORD len, int w, int h);
+extern unsigned __int64 GetFileVersion(LPCTSTR fn);
+extern bool CreateFilter(CStringW DisplayName, IBaseFilter** ppBF, CStringW& FriendlyName);
+extern IBaseFilter* AppendFilter(IPin* pPin, IMoniker* pMoniker, IGraphBuilder* pGB);
+extern CStringW GetFriendlyName(CStringW DisplayName);
+extern HRESULT LoadExternalObject(LPCTSTR path, REFCLSID clsid, REFIID iid, void** ppv);
+extern HRESULT LoadExternalFilter(LPCTSTR path, REFCLSID clsid, IBaseFilter** ppBF);
+extern HRESULT LoadExternalPropertyPage(IPersist* pP, REFCLSID clsid, IPropertyPage** ppPP);
+extern void UnloadExternalObjects();
+extern CString MakeFullPath(LPCTSTR path);
+extern CString GetMediaTypeName(const GUID& guid);
+extern GUID GUIDFromCString(CString str);
+extern HRESULT GUIDFromCString(CString str, GUID& guid);
+extern CString CStringFromGUID(const GUID& guid);
+extern CStringW UTF8To16(LPCSTR utf8);
+extern CStringA UTF16To8(LPCWSTR utf16);
+extern CString ISO6391ToLanguage(LPCSTR code);
+extern CString ISO6392ToLanguage(LPCSTR code);
+extern CString ISO6391To6392(LPCSTR code);
+extern CString ISO6392To6391(LPCSTR code);
+extern CString LanguageToISO6392(LPCTSTR lang);
+extern int MakeAACInitData(BYTE* pData, int profile, int freq, int channels);
+extern BOOL CFileGetStatus(LPCTSTR lpszFileName, CFileStatus& status);
+extern bool DeleteRegKey(LPCTSTR pszKey, LPCTSTR pszSubkey);
+extern bool SetRegKeyValue(LPCTSTR pszKey, LPCTSTR pszSubkey, LPCTSTR pszValueName, LPCTSTR pszValue);
+extern bool SetRegKeyValue(LPCTSTR pszKey, LPCTSTR pszSubkey, LPCTSTR pszValue);
+extern void RegisterSourceFilter(const CLSID& clsid, const GUID& subtype2, LPCTSTR chkbytes, LPCTSTR ext = NULL, ...);
+extern void RegisterSourceFilter(const CLSID& clsid, const GUID& subtype2, const CAtlList<CString>& chkbytes, LPCTSTR ext = NULL, ...);
+extern void UnRegisterSourceFilter(const GUID& subtype);
+
+class CPinInfo : public PIN_INFO
+{
+public:
+ CPinInfo() {pFilter = NULL;}
+ ~CPinInfo() {if(pFilter) pFilter->Release();}
+};
+
+class CFilterInfo : public FILTER_INFO
+{
+public:
+ CFilterInfo() {pGraph = NULL;}
+ ~CFilterInfo() {if(pGraph) pGraph->Release();}
+};
+
+#define BeginEnumFilters(pFilterGraph, pEnumFilters, pBaseFilter) \
+ {CComPtr<IEnumFilters> pEnumFilters; \
+ if(pFilterGraph && SUCCEEDED(pFilterGraph->EnumFilters(&pEnumFilters))) \
+ { \
+ for(CComPtr<IBaseFilter> pBaseFilter; S_OK == pEnumFilters->Next(1, &pBaseFilter, 0); pBaseFilter = NULL) \
+ { \
+
+#define EndEnumFilters }}}
+
+#define BeginEnumCachedFilters(pGraphConfig, pEnumFilters, pBaseFilter) \
+ {CComPtr<IEnumFilters> pEnumFilters; \
+ if(pGraphConfig && SUCCEEDED(pGraphConfig->EnumCacheFilter(&pEnumFilters))) \
+ { \
+ for(CComPtr<IBaseFilter> pBaseFilter; S_OK == pEnumFilters->Next(1, &pBaseFilter, 0); pBaseFilter = NULL) \
+ { \
+
+#define EndEnumCachedFilters }}}
+
+#define BeginEnumPins(pBaseFilter, pEnumPins, pPin) \
+ {CComPtr<IEnumPins> pEnumPins; \
+ if(pBaseFilter && SUCCEEDED(pBaseFilter->EnumPins(&pEnumPins))) \
+ { \
+ for(CComPtr<IPin> pPin; S_OK == pEnumPins->Next(1, &pPin, 0); pPin = NULL) \
+ { \
+
+#define EndEnumPins }}}
+
+#define BeginEnumMediaTypes(pPin, pEnumMediaTypes, pMediaType) \
+ {CComPtr<IEnumMediaTypes> pEnumMediaTypes; \
+ if(pPin && SUCCEEDED(pPin->EnumMediaTypes(&pEnumMediaTypes))) \
+ { \
+ AM_MEDIA_TYPE* pMediaType = NULL; \
+ for(; S_OK == pEnumMediaTypes->Next(1, &pMediaType, NULL); DeleteMediaType(pMediaType), pMediaType = NULL) \
+ { \
+
+#define EndEnumMediaTypes(pMediaType) } if(pMediaType) DeleteMediaType(pMediaType); }}
+
+#define BeginEnumSysDev(clsid, pMoniker) \
+ {CComPtr<ICreateDevEnum> pDevEnum4$##clsid; \
+ pDevEnum4$##clsid.CoCreateInstance(CLSID_SystemDeviceEnum); \
+ CComPtr<IEnumMoniker> pClassEnum4$##clsid; \
+ if(SUCCEEDED(pDevEnum4$##clsid->CreateClassEnumerator(clsid, &pClassEnum4$##clsid, 0)) \
+ && pClassEnum4$##clsid) \
+ { \
+ for(CComPtr<IMoniker> pMoniker; pClassEnum4$##clsid->Next(1, &pMoniker, 0) == S_OK; pMoniker = NULL) \
+ { \
+
+#define EndEnumSysDev }}}
+
+#define QI(i) (riid == __uuidof(i)) ? GetInterface((i*)this, ppv) :
+#define QI2(i) (riid == IID_##i) ? GetInterface((i*)this, ppv) :
+
+template <typename T> __inline void INITDDSTRUCT(T& dd)
+{
+ ZeroMemory(&dd, sizeof(dd));
+ dd.dwSize = sizeof(dd);
+}
+
+#define countof(array) (sizeof(array)/sizeof(array[0]))
+
+template <class T>
+static CUnknown* WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT* phr)
+{
+ *phr = S_OK;
+ CUnknown* punk = new T(lpunk, phr);
+ if(punk == NULL) *phr = E_OUTOFMEMORY;
+ return punk;
+}
diff --git a/src/dsutil/FontInstaller.cpp b/src/dsutil/FontInstaller.cpp
new file mode 100644
index 000000000..fedc60abe
--- /dev/null
+++ b/src/dsutil/FontInstaller.cpp
@@ -0,0 +1,94 @@
+#include "StdAfx.h"
+#include ".\fontinstaller.h"
+
+CFontInstaller::CFontInstaller()
+{
+ if(HMODULE hGdi = GetModuleHandle(_T("gdi32.dll")))
+ {
+ pAddFontMemResourceEx = (HANDLE (WINAPI *)(PVOID,DWORD,PVOID,DWORD*))GetProcAddress(hGdi, "AddFontMemResourceEx");
+ pAddFontResourceEx = (int (WINAPI *)(LPCTSTR,DWORD,PVOID))GetProcAddress(hGdi, "AddFontResourceExA");
+ pRemoveFontMemResourceEx = (BOOL (WINAPI *)(HANDLE))GetProcAddress(hGdi, "RemoveFontMemResourceEx");
+ pRemoveFontResourceEx = (BOOL (WINAPI *)(LPCTSTR,DWORD,PVOID))GetProcAddress(hGdi, "RemoveFontResourceExA");
+ }
+
+ if(HMODULE hGdi = GetModuleHandle(_T("kernel32.dll")))
+ {
+ pMoveFileEx = (BOOL (WINAPI *)(LPCTSTR, LPCTSTR, DWORD))GetProcAddress(hGdi, "MoveFileExA");
+ }
+}
+
+CFontInstaller::~CFontInstaller()
+{
+ UninstallFonts();
+}
+
+bool CFontInstaller::InstallFont(const CAtlArray<BYTE>& data)
+{
+ return InstallFont(data.GetData(), data.GetCount());
+}
+
+bool CFontInstaller::InstallFont(const void* pData, UINT len)
+{
+ return InstallFontFile(pData, len) || InstallFontMemory(pData, len);
+}
+
+void CFontInstaller::UninstallFonts()
+{
+ if(pRemoveFontMemResourceEx)
+ {
+ POSITION pos = m_fonts.GetHeadPosition();
+ while(pos) pRemoveFontMemResourceEx(m_fonts.GetNext(pos));
+ m_fonts.RemoveAll();
+ }
+
+ if(pRemoveFontResourceEx)
+ {
+ POSITION pos = m_files.GetHeadPosition();
+ while(pos)
+ {
+ CString fn = m_files.GetNext(pos);
+ pRemoveFontResourceEx(fn, FR_PRIVATE, 0);
+ if(!DeleteFile(fn) && pMoveFileEx)
+ pMoveFileEx(fn, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
+ }
+
+ m_files.RemoveAll();
+ }
+}
+
+bool CFontInstaller::InstallFontMemory(const void* pData, UINT len)
+{
+ if(!pAddFontMemResourceEx)
+ return false;
+
+ DWORD nFonts = 0;
+ HANDLE hFont = pAddFontMemResourceEx((PVOID)pData, len, NULL, &nFonts);
+ if(hFont && nFonts > 0) m_fonts.AddTail(hFont);
+ return hFont && nFonts > 0;
+}
+
+bool CFontInstaller::InstallFontFile(const void* pData, UINT len)
+{
+ if(!pAddFontResourceEx)
+ return false;
+
+ CFile f;
+ TCHAR path[MAX_PATH], fn[MAX_PATH];
+ if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("g_font"), 0, fn))
+ return false;
+
+ if(f.Open(fn, CFile::modeWrite))
+ {
+ f.Write(pData, len);
+ f.Close();
+
+ if(pAddFontResourceEx(fn, FR_PRIVATE, 0) > 0)
+ {
+ m_files.AddTail(fn);
+ return true;
+ }
+ }
+
+ DeleteFile(fn);
+ return false;
+}
diff --git a/src/dsutil/FontInstaller.h b/src/dsutil/FontInstaller.h
new file mode 100644
index 000000000..60d1e77e1
--- /dev/null
+++ b/src/dsutil/FontInstaller.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <atlcoll.h>
+
+class CFontInstaller
+{
+ HANDLE (WINAPI *pAddFontMemResourceEx)(PVOID,DWORD,PVOID,DWORD*);
+ BOOL (WINAPI *pRemoveFontMemResourceEx)(HANDLE);
+ int (WINAPI *pAddFontResourceEx)(LPCTSTR,DWORD,PVOID);
+ BOOL (WINAPI *pRemoveFontResourceEx)(LPCTSTR,DWORD,PVOID);
+ BOOL (WINAPI *pMoveFileEx)(LPCTSTR, LPCTSTR,DWORD);
+
+ CAtlList<HANDLE> m_fonts;
+ CAtlList<CString> m_files;
+ bool InstallFontMemory(const void* pData, UINT len);
+ bool InstallFontFile(const void* pData, UINT len);
+
+public:
+ CFontInstaller();
+ virtual ~CFontInstaller();
+
+ bool InstallFont(const CAtlArray<BYTE>& data);
+ bool InstallFont(const void* pData, UINT len);
+ void UninstallFonts();
+};
diff --git a/src/dsutil/MediaTypeEx.cpp b/src/dsutil/MediaTypeEx.cpp
new file mode 100644
index 000000000..e014c8476
--- /dev/null
+++ b/src/dsutil/MediaTypeEx.cpp
@@ -0,0 +1,641 @@
+#include "StdAfx.h"
+#include "DSUtil.h"
+#include "MediaTypeEx.h"
+
+#include <mmreg.h>
+#include <initguid.h>
+#include "..\..\include\moreuuids.h"
+
+#pragma pack(push, 1)
+typedef struct
+{
+ WAVEFORMATEX Format;
+ BYTE bBigEndian;
+ BYTE bsid;
+ BYTE lfeon;
+ BYTE copyrightb;
+ BYTE nAuxBitsCode; // Aux bits per frame
+} DOLBYAC3WAVEFORMAT;
+#pragma pack(pop)
+
+CMediaTypeEx::CMediaTypeEx()
+{
+}
+
+CString CMediaTypeEx::ToString(IPin* pPin)
+{
+ CString packing, type, codec, dim, rate, dur;
+
+ // TODO
+
+ if(majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ {
+ packing = _T("Encrypted MPEG2 Pack");
+ }
+ else if(majortype == MEDIATYPE_MPEG2_PACK)
+ {
+ packing = _T("MPEG2 Pack");
+ }
+ else if(majortype == MEDIATYPE_MPEG2_PES)
+ {
+ packing = _T("MPEG2 PES");
+ }
+
+ if(majortype == MEDIATYPE_Video)
+ {
+ type = _T("Video");
+
+ BITMAPINFOHEADER bih;
+ bool fBIH = ExtractBIH(this, &bih);
+
+ int w, h, arx, ary;
+ bool fDim = ExtractDim(this, w, h, arx, ary);
+
+ if(fBIH && bih.biCompression)
+ {
+ codec = GetVideoCodecName(subtype, bih.biCompression);
+ }
+
+ if(codec.IsEmpty())
+ {
+ if(formattype == FORMAT_MPEGVideo) codec = _T("MPEG1 Video");
+ else if(formattype == FORMAT_MPEG2_VIDEO) codec = _T("MPEG2 Video");
+ else if(formattype == FORMAT_DiracVideoInfo) codec = _T("Dirac Video");
+ }
+
+ if(fDim)
+ {
+ dim.Format(_T("%dx%d"), w, h);
+ if(w*ary != h*arx) dim.Format(_T("%s (%d:%d)"), CString(dim), arx, ary);
+ }
+
+ if(formattype == FORMAT_VideoInfo || formattype == FORMAT_MPEGVideo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pbFormat;
+ if(vih->AvgTimePerFrame) rate.Format(_T("%0.2ffps "), 10000000.0f / vih->AvgTimePerFrame);
+ if(vih->dwBitRate) rate.Format(_T("%s%dKbps"), CString(rate), vih->dwBitRate/1000);
+ }
+ else if(formattype == FORMAT_VideoInfo2 || formattype == FORMAT_MPEG2_VIDEO || formattype == FORMAT_DiracVideoInfo)
+ {
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)pbFormat;
+ if(vih->AvgTimePerFrame) rate.Format(_T("%0.2ffps "), 10000000.0f / vih->AvgTimePerFrame);
+ if(vih->dwBitRate) rate.Format(_T("%s%dKbps"), CString(rate), vih->dwBitRate/1000);
+ }
+
+ rate.Trim();
+
+ if(subtype == MEDIASUBTYPE_DVD_SUBPICTURE)
+ {
+ type = _T("Subtitle");
+ codec = _T("DVD Subpicture");
+ }
+ }
+ else if(majortype == MEDIATYPE_Audio)
+ {
+ type = _T("Audio");
+
+ if(formattype == FORMAT_WaveFormatEx)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)Format();
+
+ if(wfe->wFormatTag/* > WAVE_FORMAT_PCM && wfe->wFormatTag < WAVE_FORMAT_EXTENSIBLE
+ && wfe->wFormatTag != WAVE_FORMAT_IEEE_FLOAT*/
+ || subtype != GUID_NULL)
+ {
+ codec = GetAudioCodecName(subtype, wfe->wFormatTag);
+ dim.Format(_T("%dHz"), wfe->nSamplesPerSec);
+ if(wfe->nChannels == 1) dim.Format(_T("%s mono"), CString(dim));
+ else if(wfe->nChannels == 2) dim.Format(_T("%s stereo"), CString(dim));
+ else dim.Format(_T("%s %dch"), CString(dim), wfe->nChannels);
+ if(wfe->nAvgBytesPerSec) rate.Format(_T("%dKbps"), wfe->nAvgBytesPerSec*8/1000);
+ }
+ }
+ else if(formattype == FORMAT_VorbisFormat)
+ {
+ VORBISFORMAT* vf = (VORBISFORMAT*)Format();
+
+ codec = GetAudioCodecName(subtype, 0);
+ dim.Format(_T("%dHz"), vf->nSamplesPerSec);
+ if(vf->nChannels == 1) dim.Format(_T("%s mono"), CString(dim));
+ else if(vf->nChannels == 2) dim.Format(_T("%s stereo"), CString(dim));
+ else dim.Format(_T("%s %dch"), CString(dim), vf->nChannels);
+ if(vf->nAvgBitsPerSec) rate.Format(_T("%dKbps"), vf->nAvgBitsPerSec/1000);
+ }
+ else if(formattype == FORMAT_VorbisFormat2)
+ {
+ VORBISFORMAT2* vf = (VORBISFORMAT2*)Format();
+
+ codec = GetAudioCodecName(subtype, 0);
+ dim.Format(_T("%dHz"), vf->SamplesPerSec);
+ if(vf->Channels == 1) dim.Format(_T("%s mono"), CString(dim));
+ else if(vf->Channels == 2) dim.Format(_T("%s stereo"), CString(dim));
+ else dim.Format(_T("%s %dch"), CString(dim), vf->Channels);
+ }
+ }
+ else if(majortype == MEDIATYPE_Text)
+ {
+ type = _T("Text");
+ }
+ else if(majortype == MEDIATYPE_Subtitle)
+ {
+ type = _T("Subtitle");
+ codec = GetSubtitleCodecName(subtype);
+ }
+ else
+ {
+ type = _T("Unknown");
+ }
+
+ if(CComQIPtr<IMediaSeeking> pMS = pPin)
+ {
+ REFERENCE_TIME rtDur = 0;
+ if(SUCCEEDED(pMS->GetDuration(&rtDur)) && rtDur)
+ {
+ rtDur /= 10000000;
+ int s = rtDur%60;
+ rtDur /= 60;
+ int m = rtDur%60;
+ rtDur /= 60;
+ int h = rtDur;
+ if(h) dur.Format(_T("%d:%02d:%02d"), h, m, s);
+ else if(m) dur.Format(_T("%02d:%02d"), m, s);
+ else if(s) dur.Format(_T("%ds"), s);
+ }
+ }
+
+ CString str;
+ if(!codec.IsEmpty()) str += codec + _T(" ");
+ if(!dim.IsEmpty()) str += dim + _T(" ");
+ if(!rate.IsEmpty()) str += rate + _T(" ");
+ if(!dur.IsEmpty()) str += dur + _T(" ");
+ str.Trim(_T(" ,"));
+
+ if(!str.IsEmpty()) str = type + _T(": ") + str;
+ else str = type;
+
+ return str;
+}
+
+CString CMediaTypeEx::GetVideoCodecName(const GUID& subtype, DWORD biCompression)
+{
+ CString str;
+
+ static CAtlMap<DWORD, CString> names;
+
+ if(names.IsEmpty())
+ {
+ names['WMV1'] = _T("Windows Media Video 7");
+ names['WMV2'] = _T("Windows Media Video 8");
+ names['WMV3'] = _T("Windows Media Video 9");
+ names['DIV3'] = _T("DivX 3");
+ names['DX50'] = _T("DivX 5");
+ names['MP4V'] = _T("MPEG4 Video");
+ names['AVC1'] = _T("MPEG4 Video (H264)");
+ names['H264'] = _T("MPEG4 Video (H264)");
+ names['RV10'] = _T("RealVideo 1");
+ names['RV20'] = _T("RealVideo 2");
+ names['RV30'] = _T("RealVideo 3");
+ names['RV40'] = _T("RealVideo 4");
+ names['FLV1'] = _T("Flash Video 1");
+ // names[''] = _T("");
+ }
+
+ if(biCompression)
+ {
+ BYTE* b = (BYTE*)&biCompression;
+
+ for(int i = 0; i < 4; i++)
+ if(b[i] >= 'a' && b[i] <= 'z')
+ b[i] = toupper(b[i]);
+
+ if(!names.Lookup(MAKEFOURCC(b[3], b[2], b[1], b[0]), str))
+ {
+ if(subtype == MEDIASUBTYPE_DiracVideo) str = _T("Dirac Video");
+ // else if(subtype == ) str = _T("");
+ else if(biCompression < 256) str.Format(_T("%d"), biCompression);
+ else str.Format(_T("%4.4hs"), &biCompression);
+ }
+ }
+
+ return str;
+}
+
+CString CMediaTypeEx::GetAudioCodecName(const GUID& subtype, WORD wFormatTag)
+{
+ CString str;
+
+ static CAtlMap<WORD, CString> names;
+
+ if(names.IsEmpty())
+ {
+ names[WAVE_FORMAT_PCM] = _T("PCM");
+ names[WAVE_FORMAT_EXTENSIBLE] = _T("WAVE_FORMAT_EXTENSIBLE");
+ names[WAVE_FORMAT_IEEE_FLOAT] = _T("IEEE Float");
+ names[WAVE_FORMAT_ADPCM] = _T("MS ADPCM");
+ names[WAVE_FORMAT_ALAW] = _T("aLaw");
+ names[WAVE_FORMAT_MULAW] = _T("muLaw");
+ names[WAVE_FORMAT_DRM] = _T("DRM");
+ names[WAVE_FORMAT_OKI_ADPCM] = _T("OKI ADPCM");
+ names[WAVE_FORMAT_DVI_ADPCM] = _T("DVI ADPCM");
+ names[WAVE_FORMAT_IMA_ADPCM] = _T("IMA ADPCM");
+ names[WAVE_FORMAT_MEDIASPACE_ADPCM] = _T("Mediaspace ADPCM");
+ names[WAVE_FORMAT_SIERRA_ADPCM] = _T("Sierra ADPCM");
+ names[WAVE_FORMAT_G723_ADPCM] = _T("G723 ADPCM");
+ names[WAVE_FORMAT_DIALOGIC_OKI_ADPCM] = _T("Dialogic OKI ADPCM");
+ names[WAVE_FORMAT_MEDIAVISION_ADPCM] = _T("Media Vision ADPCM");
+ names[WAVE_FORMAT_YAMAHA_ADPCM] = _T("Yamaha ADPCM");
+ names[WAVE_FORMAT_DSPGROUP_TRUESPEECH] = _T("DSP Group Truespeech");
+ names[WAVE_FORMAT_DOLBY_AC2] = _T("Dolby AC2");
+ names[WAVE_FORMAT_GSM610] = _T("GSM610");
+ names[WAVE_FORMAT_MSNAUDIO] = _T("MSN Audio");
+ names[WAVE_FORMAT_ANTEX_ADPCME] = _T("Antex ADPCME");
+ names[WAVE_FORMAT_CS_IMAADPCM] = _T("Crystal Semiconductor IMA ADPCM");
+ names[WAVE_FORMAT_ROCKWELL_ADPCM] = _T("Rockwell ADPCM");
+ names[WAVE_FORMAT_ROCKWELL_DIGITALK] = _T("Rockwell Digitalk");
+ names[WAVE_FORMAT_G721_ADPCM] = _T("G721");
+ names[WAVE_FORMAT_G728_CELP] = _T("G728");
+ names[WAVE_FORMAT_MSG723] = _T("MSG723");
+ names[WAVE_FORMAT_MPEG] = _T("MPEG Audio");
+ names[WAVE_FORMAT_MPEGLAYER3] = _T("MPEG Audio Layer 3");
+ names[WAVE_FORMAT_LUCENT_G723] = _T("Lucent G723");
+ names[WAVE_FORMAT_VOXWARE] = _T("Voxware");
+ names[WAVE_FORMAT_G726_ADPCM] = _T("G726");
+ names[WAVE_FORMAT_G722_ADPCM] = _T("G722");
+ names[WAVE_FORMAT_G729A] = _T("G729A");
+ names[WAVE_FORMAT_MEDIASONIC_G723] = _T("MediaSonic G723");
+ names[WAVE_FORMAT_ZYXEL_ADPCM] = _T("ZyXEL ADPCM");
+ names[WAVE_FORMAT_RHETOREX_ADPCM] = _T("Rhetorex ADPCM");
+ names[WAVE_FORMAT_VIVO_G723] = _T("Vivo G723");
+ names[WAVE_FORMAT_VIVO_SIREN] = _T("Vivo Siren");
+ names[WAVE_FORMAT_DIGITAL_G723] = _T("Digital G723");
+ names[WAVE_FORMAT_SANYO_LD_ADPCM] = _T("Sanyo LD ADPCM");
+ names[WAVE_FORMAT_CREATIVE_ADPCM] = _T("Creative ADPCM");
+ names[WAVE_FORMAT_CREATIVE_FASTSPEECH8] = _T("Creative Fastspeech 8");
+ names[WAVE_FORMAT_CREATIVE_FASTSPEECH10] = _T("Creative Fastspeech 10");
+ names[WAVE_FORMAT_UHER_ADPCM] = _T("UHER ADPCM");
+ names[WAVE_FORMAT_DOLBY_AC3] = _T("Dolby AC3");
+ names[WAVE_FORMAT_DVD_DTS] = _T("DTS");
+ names[WAVE_FORMAT_AAC] = _T("AAC");
+ names[WAVE_FORMAT_FLAC] = _T("FLAC");
+ names[WAVE_FORMAT_TTA1] = _T("TTA");
+ names[WAVE_FORMAT_14_4] = _T("RealAudio 14.4");
+ names[WAVE_FORMAT_28_8] = _T("RealAudio 28.8");
+ names[WAVE_FORMAT_ATRC] = _T("RealAudio ATRC");
+ names[WAVE_FORMAT_COOK] = _T("RealAudio COOK");
+ names[WAVE_FORMAT_DNET] = _T("RealAudio DNET");
+ names[WAVE_FORMAT_RAAC] = _T("RealAudio RAAC");
+ names[WAVE_FORMAT_RACP] = _T("RealAudio RACP");
+ names[WAVE_FORMAT_SIPR] = _T("RealAudio SIPR");
+ names[WAVE_FORMAT_PS2_PCM] = _T("PS2 PCM");
+ names[WAVE_FORMAT_PS2_ADPCM] = _T("PS2 ADPCM");
+ names[0x0160] = _T("Windows Media Audio");
+ names[0x0161] = _T("Windows Media Audio");
+ names[0x0162] = _T("Windows Media Audio");
+ names[0x0163] = _T("Windows Media Audio");
+ // names[] = _T("");
+ }
+
+ if(!names.Lookup(wFormatTag, str))
+ {
+ if(subtype == MEDIASUBTYPE_Vorbis) str = _T("Vorbis (deprecated)");
+ else if(subtype == MEDIASUBTYPE_Vorbis2) str = _T("Vorbis");
+ else if(subtype == MEDIASUBTYPE_MP4A) str = _T("MPEG4 Audio");
+ else if(subtype == MEDIASUBTYPE_FLAC_FRAMED) str = _T("FLAC (framed)");
+ else if(subtype == MEDIASUBTYPE_DOLBY_AC3) str += _T("Dolby AC3");
+ else if(subtype == MEDIASUBTYPE_DTS) str += _T("DTS");
+ // else if(subtype == ) str = _T("");
+ else str.Format(_T("0x%04x"), wFormatTag);
+ }
+
+ if(wFormatTag == WAVE_FORMAT_PCM)
+ {
+ if(subtype == MEDIASUBTYPE_DOLBY_AC3) str += _T(" (AC3)");
+ else if(subtype == MEDIASUBTYPE_DTS) str += _T(" (DTS)");
+ }
+
+ return str;
+}
+
+CString CMediaTypeEx::GetSubtitleCodecName(const GUID& subtype)
+{
+ CString str;
+
+ static CAtlMap<GUID, CString> names;
+
+ if(names.IsEmpty())
+ {
+ names[MEDIASUBTYPE_UTF8] = _T("UTF-8");
+ names[MEDIASUBTYPE_SSA] = _T("SubStation Alpha");
+ names[MEDIASUBTYPE_ASS] = _T("Advanced SubStation Alpha");
+ names[MEDIASUBTYPE_USF] = _T("Universal Subtitle Format");
+ names[MEDIASUBTYPE_VOBSUB] = _T("VobSub");
+ // names[''] = _T("");
+ }
+
+ if(names.Lookup(subtype, str))
+ {
+
+ }
+
+ return str;
+}
+
+void CMediaTypeEx::Dump(CAtlList<CString>& sl)
+{
+ CString str;
+
+ sl.RemoveAll();
+
+ int fmtsize = 0;
+
+ CString major = CStringFromGUID(majortype);
+ CString sub = CStringFromGUID(subtype);
+ CString format = CStringFromGUID(formattype);
+
+ sl.AddTail(ToString() + _T("\n"));
+
+ sl.AddTail(_T("AM_MEDIA_TYPE: "));
+ str.Format(_T("majortype: %s %s"), CString(GuidNames[majortype]), major);
+ sl.AddTail(str);
+ str.Format(_T("subtype: %s %s"), CString(GuidNames[subtype]), sub);
+ sl.AddTail(str);
+ str.Format(_T("formattype: %s %s"), CString(GuidNames[formattype]), format);
+ sl.AddTail(str);
+ str.Format(_T("bFixedSizeSamples: %d"), bFixedSizeSamples);
+ sl.AddTail(str);
+ str.Format(_T("bTemporalCompression: %d"), bTemporalCompression);
+ sl.AddTail(str);
+ str.Format(_T("lSampleSize: %d"), lSampleSize);
+ sl.AddTail(str);
+ str.Format(_T("cbFormat: %d"), cbFormat);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+
+ if(formattype == FORMAT_VideoInfo || formattype == FORMAT_VideoInfo2
+ || formattype == FORMAT_MPEGVideo || formattype == FORMAT_MPEG2_VIDEO)
+ {
+ fmtsize =
+ formattype == FORMAT_VideoInfo ? sizeof(VIDEOINFOHEADER) :
+ formattype == FORMAT_VideoInfo2 ? sizeof(VIDEOINFOHEADER2) :
+ formattype == FORMAT_MPEGVideo ? sizeof(MPEG1VIDEOINFO)-1 :
+ formattype == FORMAT_MPEG2_VIDEO ? sizeof(MPEG2VIDEOINFO)-4 :
+ 0;
+
+ VIDEOINFOHEADER& vih = *(VIDEOINFOHEADER*)pbFormat;
+ BITMAPINFOHEADER* bih = &vih.bmiHeader;
+
+ sl.AddTail(_T("VIDEOINFOHEADER:"));
+ str.Format(_T("rcSource: (%d,%d)-(%d,%d)"), vih.rcSource);
+ sl.AddTail(str);
+ str.Format(_T("rcTarget: (%d,%d)-(%d,%d)"), vih.rcTarget);
+ sl.AddTail(str);
+ str.Format(_T("dwBitRate: %d"), vih.dwBitRate);
+ sl.AddTail(str);
+ str.Format(_T("dwBitErrorRate: %d"), vih.dwBitErrorRate);
+ sl.AddTail(str);
+ str.Format(_T("AvgTimePerFrame: %I64d"), vih.AvgTimePerFrame);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+
+ if(formattype == FORMAT_VideoInfo2 || formattype == FORMAT_MPEG2_VIDEO)
+ {
+ VIDEOINFOHEADER2& vih = *(VIDEOINFOHEADER2*)pbFormat;
+ bih = &vih.bmiHeader;
+
+ sl.AddTail(_T("VIDEOINFOHEADER2:"));
+ str.Format(_T("dwInterlaceFlags: 0x%08x"), vih.dwInterlaceFlags);
+ sl.AddTail(str);
+ str.Format(_T("dwCopyProtectFlags: 0x%08x"), vih.dwCopyProtectFlags);
+ sl.AddTail(str);
+ str.Format(_T("dwPictAspectRatioX: %d"), vih.dwPictAspectRatioX);
+ sl.AddTail(str);
+ str.Format(_T("dwPictAspectRatioY: %d"), vih.dwPictAspectRatioY);
+ sl.AddTail(str);
+ str.Format(_T("dwControlFlags: 0x%08x"), vih.dwControlFlags);
+ sl.AddTail(str);
+ str.Format(_T("dwReserved2: 0x%08x"), vih.dwReserved2);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+ }
+
+ if(formattype == FORMAT_MPEGVideo)
+ {
+ MPEG1VIDEOINFO& mvih = *(MPEG1VIDEOINFO*)pbFormat;
+
+ sl.AddTail(_T("MPEG1VIDEOINFO:"));
+ str.Format(_T("dwStartTimeCode: %d"), mvih.dwStartTimeCode);
+ sl.AddTail(str);
+ str.Format(_T("cbSequenceHeader: %d"), mvih.cbSequenceHeader);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+ }
+ else if(formattype == FORMAT_MPEG2_VIDEO)
+ {
+ MPEG2VIDEOINFO& mvih = *(MPEG2VIDEOINFO*)pbFormat;
+
+ sl.AddTail(_T("MPEG2VIDEOINFO:"));
+ str.Format(_T("dwStartTimeCode: %d"), mvih.dwStartTimeCode);
+ sl.AddTail(str);
+ str.Format(_T("cbSequenceHeader: %d"), mvih.cbSequenceHeader);
+ sl.AddTail(str);
+ str.Format(_T("dwProfile: 0x%08x"), mvih.dwProfile);
+ sl.AddTail(str);
+ str.Format(_T("dwLevel: 0x%08x"), mvih.dwLevel);
+ sl.AddTail(str);
+ str.Format(_T("dwFlags: 0x%08x"), mvih.dwFlags);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+ }
+
+ sl.AddTail(_T("BITMAPINFOHEADER:"));
+ str.Format(_T("biSize: %d"), bih->biSize);
+ sl.AddTail(str);
+ str.Format(_T("biWidth: %d"), bih->biWidth);
+ sl.AddTail(str);
+ str.Format(_T("biHeight: %d"), bih->biHeight);
+ sl.AddTail(str);
+ str.Format(_T("biPlanes: %d"), bih->biPlanes);
+ sl.AddTail(str);
+ str.Format(_T("biBitCount: %d"), bih->biBitCount);
+ sl.AddTail(str);
+ if(bih->biCompression < 256) str.Format(_T("biCompression: %d"), bih->biCompression);
+ else str.Format(_T("biCompression: %4.4hs"), &bih->biCompression);
+ sl.AddTail(str);
+ str.Format(_T("biSizeImage: %d"), bih->biSizeImage);
+ sl.AddTail(str);
+ str.Format(_T("biXPelsPerMeter: %d"), bih->biXPelsPerMeter);
+ sl.AddTail(str);
+ str.Format(_T("biYPelsPerMeter: %d"), bih->biYPelsPerMeter);
+ sl.AddTail(str);
+ str.Format(_T("biYPelsPerMeter: %d"), bih->biYPelsPerMeter);
+ sl.AddTail(str);
+ str.Format(_T("biClrUsed: %d"), bih->biClrUsed);
+ sl.AddTail(str);
+ str.Format(_T("biClrImportant: %d"), bih->biClrImportant);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+ }
+ else if(formattype == FORMAT_WaveFormatEx)
+ {
+ fmtsize = sizeof(WAVEFORMATEX);
+
+ WAVEFORMATEX& wfe = *(WAVEFORMATEX*)pbFormat;
+
+ sl.AddTail(_T("WAVEFORMATEX:"));
+ str.Format(_T("wFormatTag: 0x%04x"), wfe.wFormatTag);
+ sl.AddTail(str);
+ str.Format(_T("nChannels: %d"), wfe.nChannels);
+ sl.AddTail(str);
+ str.Format(_T("nSamplesPerSec: %d"), wfe.nSamplesPerSec);
+ sl.AddTail(str);
+ str.Format(_T("nAvgBytesPerSec: %d"), wfe.nAvgBytesPerSec);
+ sl.AddTail(str);
+ str.Format(_T("nBlockAlign: %d"), wfe.nBlockAlign);
+ sl.AddTail(str);
+ str.Format(_T("wBitsPerSample: %d"), wfe.wBitsPerSample);
+ sl.AddTail(str);
+ str.Format(_T("cbSize: %d (extra bytes)"), wfe.cbSize);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+
+ if(wfe.wFormatTag != WAVE_FORMAT_PCM && wfe.cbSize > 0)
+ {
+ if(wfe.wFormatTag == WAVE_FORMAT_EXTENSIBLE && wfe.cbSize == sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX))
+ {
+ fmtsize = sizeof(WAVEFORMATEXTENSIBLE);
+
+ WAVEFORMATEXTENSIBLE& wfe = *(WAVEFORMATEXTENSIBLE*)pbFormat;
+
+ sl.AddTail(_T("WAVEFORMATEXTENSIBLE:"));
+ if(wfe.Format.wBitsPerSample != 0) str.Format(_T("wValidBitsPerSample: %d"), wfe.Samples.wValidBitsPerSample);
+ else str.Format(_T("wSamplesPerBlock: %d"), wfe.Samples.wSamplesPerBlock);
+ sl.AddTail(str);
+ str.Format(_T("dwChannelMask: 0x%08x"), wfe.dwChannelMask);
+ sl.AddTail(str);
+ str.Format(_T("SubFormat: %s"), CStringFromGUID(wfe.SubFormat));
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+ }
+ else if(wfe.wFormatTag == WAVE_FORMAT_DOLBY_AC3 && wfe.cbSize == sizeof(DOLBYAC3WAVEFORMAT)-sizeof(WAVEFORMATEX))
+ {
+ fmtsize = sizeof(DOLBYAC3WAVEFORMAT);
+
+ DOLBYAC3WAVEFORMAT& wfe = *(DOLBYAC3WAVEFORMAT*)pbFormat;
+
+ sl.AddTail(_T("DOLBYAC3WAVEFORMAT:"));
+ str.Format(_T("bBigEndian: %d"), wfe.bBigEndian);
+ sl.AddTail(str);
+ str.Format(_T("bsid: %d"), wfe.bsid);
+ sl.AddTail(str);
+ str.Format(_T("lfeon: %d"), wfe.lfeon);
+ sl.AddTail(str);
+ str.Format(_T("copyrightb: %d"), wfe.copyrightb);
+ sl.AddTail(str);
+ str.Format(_T("nAuxBitsCode: %d"), wfe.nAuxBitsCode);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+ }
+ }
+ }
+ else if(formattype == FORMAT_VorbisFormat)
+ {
+ fmtsize = sizeof(VORBISFORMAT);
+
+ VORBISFORMAT& vf = *(VORBISFORMAT*)pbFormat;
+
+ sl.AddTail(_T("VORBISFORMAT:"));
+ str.Format(_T("nChannels: %d"), vf.nChannels);
+ sl.AddTail(str);
+ str.Format(_T("nSamplesPerSec: %d"), vf.nSamplesPerSec);
+ sl.AddTail(str);
+ str.Format(_T("nMinBitsPerSec: %d"), vf.nMinBitsPerSec);
+ sl.AddTail(str);
+ str.Format(_T("nAvgBitsPerSec: %d"), vf.nAvgBitsPerSec);
+ sl.AddTail(str);
+ str.Format(_T("nMaxBitsPerSec: %d"), vf.nMaxBitsPerSec);
+ sl.AddTail(str);
+ str.Format(_T("fQuality: %.3f"), vf.fQuality);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+ }
+ else if(formattype == FORMAT_VorbisFormat2)
+ {
+ fmtsize = sizeof(VORBISFORMAT2);
+
+ VORBISFORMAT2& vf = *(VORBISFORMAT2*)pbFormat;
+
+ sl.AddTail(_T("VORBISFORMAT:"));
+ str.Format(_T("Channels: %d"), vf.Channels);
+ sl.AddTail(str);
+ str.Format(_T("SamplesPerSec: %d"), vf.SamplesPerSec);
+ sl.AddTail(str);
+ str.Format(_T("BitsPerSample: %d"), vf.BitsPerSample);
+ sl.AddTail(str);
+ str.Format(_T("HeaderSize: {%d, %d, %d}"), vf.HeaderSize[0], vf.HeaderSize[1], vf.HeaderSize[2]);
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+ }
+ else if(formattype == FORMAT_SubtitleInfo)
+ {
+ fmtsize = sizeof(SUBTITLEINFO);
+
+ SUBTITLEINFO& si = *(SUBTITLEINFO*)pbFormat;
+
+ sl.AddTail(_T("SUBTITLEINFO:"));
+ str.Format(_T("dwOffset: %d"), si.dwOffset);
+ sl.AddTail(str);
+ str.Format(_T("IsoLang: %s"), CString(CStringA(si.IsoLang, sizeof(si.IsoLang)-1)));
+ sl.AddTail(str);
+ str.Format(_T("TrackName: %s"), CString(CStringW(si.TrackName, sizeof(si.TrackName)-1)));
+ sl.AddTail(str);
+
+ sl.AddTail(_T(""));
+ }
+
+ if(cbFormat > 0)
+ {
+ sl.AddTail(_T("pbFormat:"));
+
+ for(int i = 0, j = (cbFormat + 15) & ~15; i < j; i += 16)
+ {
+ str.Format(_T("%04x:"), i);
+
+ for(int k = i, l = min(i + 16, cbFormat); k < l; k++)
+ {
+ CString byte;
+ byte.Format(_T("%c%02x"), fmtsize > 0 && fmtsize == k ? '|' : ' ', pbFormat[k]);
+ str += byte;
+ }
+
+ for(int k = min(i + 16, cbFormat), l = i + 16; k < l; k++)
+ {
+ str += _T(" ");
+ }
+
+ str += ' ';
+
+ for(int k = i, l = min(i + 16, cbFormat); k < l; k++)
+ {
+ unsigned char c = (unsigned char)pbFormat[k];
+ CStringA ch;
+ ch.Format("%c", c >= 0x20 ? c : '.');
+ str += ch;
+ }
+
+ sl.AddTail(str);
+ }
+
+ sl.AddTail(_T(""));
+ }
+} \ No newline at end of file
diff --git a/src/dsutil/MediaTypeEx.h b/src/dsutil/MediaTypeEx.h
new file mode 100644
index 000000000..a066136d0
--- /dev/null
+++ b/src/dsutil/MediaTypeEx.h
@@ -0,0 +1,16 @@
+#pragma once
+
+class CMediaTypeEx : public CMediaType
+{
+public:
+ CMediaTypeEx();
+ CMediaTypeEx(const CMediaType& mt) {CMediaType::operator = (mt);}
+
+ CString ToString(IPin* pPin = NULL);
+
+ static CString GetVideoCodecName(const GUID& subtype, DWORD biCompression);
+ static CString GetAudioCodecName(const GUID& subtype, WORD wFormatTag);
+ static CString GetSubtitleCodecName(const GUID& subtype);
+
+ void Dump(CAtlList<CString>& sl);
+};
diff --git a/src/dsutil/MediaTypes.cpp b/src/dsutil/MediaTypes.cpp
new file mode 100644
index 000000000..622177fc8
--- /dev/null
+++ b/src/dsutil/MediaTypes.cpp
@@ -0,0 +1,381 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <initguid.h>
+#include "..\..\include\moreuuids.h"
+#include "MediaTypes.h"
+#include "DSUtil.h"
+
+#define VIH_NORMAL (sizeof(VIDEOINFOHEADER))
+#define VIH_BITFIELDS (sizeof(VIDEOINFOHEADER)+3*sizeof(RGBQUAD))
+#define VIH2_NORMAL (sizeof(VIDEOINFOHEADER2))
+#define VIH2_BITFIELDS (sizeof(VIDEOINFOHEADER2)+3*sizeof(RGBQUAD))
+#define BIH_SIZE (sizeof(BITMAPINFOHEADER))
+
+VIH vihs[] =
+{
+ // YUY2
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, mmioFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH_NORMAL, // size
+ &MEDIASUBTYPE_YUY2 // subtype
+ },
+ // YV12
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 12, mmioFOURCC('Y','V','1','2'), 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH_NORMAL, // size
+ &MEDIASUBTYPE_YV12 // subtype
+ },
+ // I420
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 12, mmioFOURCC('I','4','2','0'), 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH_NORMAL, // size
+ &MEDIASUBTYPE_I420 // subtype
+ },
+ // IYUV
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 12, mmioFOURCC('I','Y','U','V'), 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH_NORMAL, // size
+ &MEDIASUBTYPE_IYUV // subtype
+ },
+ // 8888 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 32, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH_NORMAL, // size
+ &MEDIASUBTYPE_RGB32 // subtype
+ },
+ // 8888 bitf
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0xFF0000, 0x00FF00, 0x0000FF}, // mask[3]
+ VIH_BITFIELDS, // size
+ &MEDIASUBTYPE_RGB32 // subtype
+ },
+ // A888 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 32, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH_NORMAL, // size
+ &MEDIASUBTYPE_ARGB32 // subtype
+ },
+ // A888 bitf (I'm not sure if this exist...)
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0xFF0000, 0x00FF00, 0x0000FF}, // mask[3]
+ VIH_BITFIELDS, // size
+ &MEDIASUBTYPE_ARGB32 // subtype
+ },
+ // 888 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 24, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH_NORMAL, // size
+ &MEDIASUBTYPE_RGB24 // subtype
+ },
+ // 888 bitf
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 24, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0xFF0000, 0x00FF00, 0x0000FF}, // mask[3]
+ VIH_BITFIELDS, // size
+ &MEDIASUBTYPE_RGB24 // subtype
+ },
+ // 565 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH_NORMAL, // size
+ &MEDIASUBTYPE_RGB565 // subtype
+ },
+ // 565 bitf
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0xF800, 0x07E0, 0x001F}, // mask[3]
+ VIH_BITFIELDS, // size
+ &MEDIASUBTYPE_RGB565 // subtype
+ },
+ // 555 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH_NORMAL, // size
+ &MEDIASUBTYPE_RGB555 // subtype
+ },
+ // 555 bitf
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0x7C00, 0x03E0, 0x001F}, // mask[3]
+ VIH_BITFIELDS, // size
+ &MEDIASUBTYPE_RGB555 // subtype
+ },
+};
+
+VIH2 vih2s[] =
+{
+ // YUY2
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, mmioFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH2_NORMAL, // size
+ &MEDIASUBTYPE_YUY2 // subtype
+ },
+ // YV12
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 12, mmioFOURCC('Y','V','1','2'), 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH2_NORMAL, // size
+ &MEDIASUBTYPE_YV12 // subtype
+ },
+ // I420
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 12, mmioFOURCC('I','4','2','0'), 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH2_NORMAL, // size
+ &MEDIASUBTYPE_I420 // subtype
+ },
+ // IYUV
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 12, mmioFOURCC('I','Y','U','V'), 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH2_NORMAL, // size
+ &MEDIASUBTYPE_IYUV // subtype
+ },
+ // 8888 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 32, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH2_NORMAL, // size
+ &MEDIASUBTYPE_RGB32 // subtype
+ },
+ // 8888 bitf
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0xFF0000, 0x00FF00, 0x0000FF}, // mask[3]
+ VIH2_BITFIELDS, // size
+ &MEDIASUBTYPE_RGB32 // subtype
+ },
+ // A888 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 32, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH2_NORMAL, // size
+ &MEDIASUBTYPE_ARGB32 // subtype
+ },
+ // A888 bitf (I'm not sure if this exist...)
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0xFF0000, 0x00FF00, 0x0000FF}, // mask[3]
+ VIH2_BITFIELDS, // size
+ &MEDIASUBTYPE_ARGB32 // subtype
+ },
+ // 888 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 24, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH2_NORMAL, // size
+ &MEDIASUBTYPE_RGB24 // subtype
+ },
+ // 888 bitf
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 24, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0xFF0000, 0x00FF00, 0x0000FF}, // mask[3]
+ VIH2_BITFIELDS, // size
+ &MEDIASUBTYPE_RGB24 // subtype
+ },
+ // 565 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH2_NORMAL, // size
+ &MEDIASUBTYPE_RGB565 // subtype
+ },
+ // 565 bitf
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0xF800, 0x07E0, 0x001F}, // mask[3]
+ VIH2_BITFIELDS, // size
+ &MEDIASUBTYPE_RGB565 // subtype
+ },
+ // 555 normal
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, BI_RGB, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0, 0, 0}, // mask[3]
+ VIH2_NORMAL, // size
+ &MEDIASUBTYPE_RGB555 // subtype
+ },
+ // 555 bitf
+ {
+ {
+ {0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ {BIH_SIZE, 0, 0, 1, 16, BI_BITFIELDS, 0, 0, 0, 0, 0} // bmiHeader
+ },
+ {0x7C00, 0x03E0, 0x001F}, // mask[3]
+ VIH2_BITFIELDS, // size
+ &MEDIASUBTYPE_RGB555 // subtype
+ },
+};
+
+int VIHSIZE = countof(vihs);
+
+CString VIH2String(int i)
+{
+ CString ret = CString(GuidNames[*vihs[i].subtype]);
+ if(!ret.Left(13).CompareNoCase(_T("MEDIASUBTYPE_"))) ret = ret.Mid(13);
+ if(vihs[i].vih.bmiHeader.biCompression == 3) ret += _T(" BITF");
+ if(*vihs[i].subtype == MEDIASUBTYPE_I420) ret = _T("I420"); // FIXME
+ return(ret);
+}
+
+CString Subtype2String(const GUID& subtype)
+{
+ CString ret = CString(GuidNames[subtype]);
+ if(!ret.Left(13).CompareNoCase(_T("MEDIASUBTYPE_"))) ret = ret.Mid(13);
+ if(subtype == MEDIASUBTYPE_I420) ret = _T("I420"); // FIXME
+ return(ret);
+}
+
+void CorrectMediaType(AM_MEDIA_TYPE* pmt)
+{
+ if(!pmt) return;
+
+ CMediaType mt(*pmt);
+
+ if(mt.formattype == FORMAT_VideoInfo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.pbFormat;
+
+ for(int i = 0; i < VIHSIZE; i++)
+ {
+ if(mt.subtype == *vihs[i].subtype
+ && vih->bmiHeader.biCompression == vihs[i].vih.bmiHeader.biCompression)
+ {
+ mt.AllocFormatBuffer(vihs[i].size);
+ memcpy(mt.pbFormat, &vihs[i], vihs[i].size);
+ memcpy(mt.pbFormat, pmt->pbFormat, sizeof(VIDEOINFOHEADER));
+ break;
+ }
+ }
+ }
+ else if(mt.formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.pbFormat;
+
+ for(int i = 0; i < VIHSIZE; i++)
+ {
+ if(mt.subtype == *vih2s[i].subtype
+ && vih2->bmiHeader.biCompression == vih2s[i].vih.bmiHeader.biCompression)
+ {
+ mt.AllocFormatBuffer(vih2s[i].size);
+ memcpy(mt.pbFormat, &vih2s[i], vih2s[i].size);
+ memcpy(mt.pbFormat, pmt->pbFormat, sizeof(VIDEOINFOHEADER2));
+ break;
+ }
+ }
+ }
+
+ CopyMediaType(pmt, &mt);
+}
diff --git a/src/dsutil/MediaTypes.h b/src/dsutil/MediaTypes.h
new file mode 100644
index 000000000..609191d9d
--- /dev/null
+++ b/src/dsutil/MediaTypes.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#pragma pack(1)
+struct VIH
+{
+ VIDEOINFOHEADER vih;
+ UINT mask[3];
+ int size;
+ const GUID* subtype;
+};
+struct VIH2
+{
+ VIDEOINFOHEADER2 vih;
+ UINT mask[3];
+ int size;
+ const GUID* subtype;
+};
+#pragma pack()
+
+extern VIH vihs[];
+extern VIH2 vih2s[];
+
+extern int VIHSIZE;
+
+extern CString VIH2String(int i), Subtype2String(const GUID& subtype);
+extern void CorrectMediaType(AM_MEDIA_TYPE* pmt);
diff --git a/src/dsutil/NullRenderers.cpp b/src/dsutil/NullRenderers.cpp
new file mode 100644
index 000000000..f92438401
--- /dev/null
+++ b/src/dsutil/NullRenderers.cpp
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "NullRenderers.h"
+#include "..\..\include\moreuuids.h"
+
+//
+// CNullRenderer
+//
+
+CNullRenderer::CNullRenderer(REFCLSID clsid, TCHAR* pName, LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseRenderer(clsid, pName, pUnk, phr)
+{
+}
+
+//
+// CNullVideoRenderer
+//
+
+CNullVideoRenderer::CNullVideoRenderer(LPUNKNOWN pUnk, HRESULT* phr)
+ : CNullRenderer(__uuidof(this), NAME("Null Video Renderer"), pUnk, phr)
+{
+}
+
+HRESULT CNullVideoRenderer::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Video
+ || pmt->subtype == MEDIASUBTYPE_MPEG2_VIDEO
+ ? S_OK
+ : E_FAIL;
+}
+
+//
+// CNullUVideoRenderer
+//
+
+CNullUVideoRenderer::CNullUVideoRenderer(LPUNKNOWN pUnk, HRESULT* phr)
+ : CNullRenderer(__uuidof(this), NAME("Null Video Renderer (Uncompressed)"), pUnk, phr)
+{
+}
+
+HRESULT CNullUVideoRenderer::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Video
+ && (pmt->subtype == MEDIASUBTYPE_YV12
+ || pmt->subtype == MEDIASUBTYPE_I420
+ || pmt->subtype == MEDIASUBTYPE_YUYV
+ || pmt->subtype == MEDIASUBTYPE_IYUV
+ || pmt->subtype == MEDIASUBTYPE_YVU9
+ || pmt->subtype == MEDIASUBTYPE_Y411
+ || pmt->subtype == MEDIASUBTYPE_Y41P
+ || pmt->subtype == MEDIASUBTYPE_YUY2
+ || pmt->subtype == MEDIASUBTYPE_YVYU
+ || pmt->subtype == MEDIASUBTYPE_UYVY
+ || pmt->subtype == MEDIASUBTYPE_Y211
+ || pmt->subtype == MEDIASUBTYPE_RGB1
+ || pmt->subtype == MEDIASUBTYPE_RGB4
+ || pmt->subtype == MEDIASUBTYPE_RGB8
+ || pmt->subtype == MEDIASUBTYPE_RGB565
+ || pmt->subtype == MEDIASUBTYPE_RGB555
+ || pmt->subtype == MEDIASUBTYPE_RGB24
+ || pmt->subtype == MEDIASUBTYPE_RGB32
+ || pmt->subtype == MEDIASUBTYPE_ARGB1555
+ || pmt->subtype == MEDIASUBTYPE_ARGB4444
+ || pmt->subtype == MEDIASUBTYPE_ARGB32
+ || pmt->subtype == MEDIASUBTYPE_A2R10G10B10
+ || pmt->subtype == MEDIASUBTYPE_A2B10G10R10)
+ ? S_OK
+ : E_FAIL;
+}
+
+//
+// CNullAudioRenderer
+//
+
+CNullAudioRenderer::CNullAudioRenderer(LPUNKNOWN pUnk, HRESULT* phr)
+ : CNullRenderer(__uuidof(this), NAME("Null Audio Renderer"), pUnk, phr)
+{
+}
+
+HRESULT CNullAudioRenderer::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_Midi
+ || pmt->subtype == MEDIASUBTYPE_MPEG2_AUDIO
+ || pmt->subtype == MEDIASUBTYPE_DOLBY_AC3
+ || pmt->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
+ || pmt->subtype == MEDIASUBTYPE_DTS
+ || pmt->subtype == MEDIASUBTYPE_SDDS
+ || pmt->subtype == MEDIASUBTYPE_MPEG1AudioPayload
+ || pmt->subtype == MEDIASUBTYPE_MPEG1Audio
+ || pmt->subtype == MEDIASUBTYPE_MPEG1Audio
+ ? S_OK
+ : E_FAIL;
+}
+
+//
+// CNullUAudioRenderer
+//
+
+CNullUAudioRenderer::CNullUAudioRenderer(LPUNKNOWN pUnk, HRESULT* phr)
+ : CNullRenderer(__uuidof(this), NAME("Null Audio Renderer (Uncompressed)"), pUnk, phr)
+{
+}
+
+HRESULT CNullUAudioRenderer::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Audio
+ && (pmt->subtype == MEDIASUBTYPE_PCM
+ || pmt->subtype == MEDIASUBTYPE_IEEE_FLOAT
+ || pmt->subtype == MEDIASUBTYPE_DRM_Audio
+ || pmt->subtype == MEDIASUBTYPE_DOLBY_AC3_SPDIF
+ || pmt->subtype == MEDIASUBTYPE_RAW_SPORT
+ || pmt->subtype == MEDIASUBTYPE_SPDIF_TAG_241h)
+ ? S_OK
+ : E_FAIL;
+}
+
+//
+// CNullTextRenderer
+//
+
+HRESULT CNullTextRenderer::CTextInputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Text
+ || pmt->majortype == MEDIATYPE_ScriptCommand
+ || pmt->majortype == MEDIATYPE_Subtitle
+ || pmt->subtype == MEDIASUBTYPE_DVD_SUBPICTURE
+ || pmt->subtype == MEDIASUBTYPE_CVD_SUBPICTURE
+ || pmt->subtype == MEDIASUBTYPE_SVCD_SUBPICTURE
+ ? S_OK
+ : E_FAIL;
+}
+
+CNullTextRenderer::CNullTextRenderer(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseFilter(NAME("CNullTextRenderer"), pUnk, this, __uuidof(this), phr)
+{
+ m_pInput.Attach(new CTextInputPin(this, this, phr));
+}
diff --git a/src/dsutil/NullRenderers.h b/src/dsutil/NullRenderers.h
new file mode 100644
index 000000000..f944cbe1b
--- /dev/null
+++ b/src/dsutil/NullRenderers.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+
+class CNullRenderer : public CBaseRenderer
+{
+protected:
+ HRESULT DoRenderSample(IMediaSample* pSample) {return S_OK;}
+
+public:
+ CNullRenderer(REFCLSID clsid, TCHAR* pName, LPUNKNOWN pUnk, HRESULT* phr);
+};
+
+[uuid("579883A0-4E2D-481F-9436-467AAFAB7DE8")]
+class CNullVideoRenderer : public CNullRenderer
+{
+protected:
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+public:
+ CNullVideoRenderer(LPUNKNOWN pUnk, HRESULT* phr);
+};
+
+[uuid("DD9ED57D-6ABF-42E8-89A2-11D04798DC58")]
+class CNullUVideoRenderer : public CNullRenderer
+{
+protected:
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+public:
+ CNullUVideoRenderer(LPUNKNOWN pUnk, HRESULT* phr);
+};
+
+[uuid("0C38BDFD-8C17-4E00-A344-F89397D3E22A")]
+class CNullAudioRenderer : public CNullRenderer
+{
+protected:
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+public:
+ CNullAudioRenderer(LPUNKNOWN pUnk, HRESULT* phr);
+};
+
+[uuid("64A45125-7343-4772-9DA4-179FAC9D462C")]
+class CNullUAudioRenderer : public CNullRenderer
+{
+protected:
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+public:
+ CNullUAudioRenderer(LPUNKNOWN pUnk, HRESULT* phr);
+};
+
+[uuid("655D7613-C26C-4A25-BBBD-3C9C516122CC")]
+class CNullTextRenderer : public CBaseFilter, public CCritSec
+{
+ class CTextInputPin : public CBaseInputPin
+ {
+ public:
+ CTextInputPin(CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseInputPin(NAME("CTextInputPin"), pFilter, pLock, phr, L"In") {}
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ };
+
+ CAutoPtr<CTextInputPin> m_pInput;
+
+public:
+ CNullTextRenderer(LPUNKNOWN pUnk, HRESULT* phr);
+ int GetPinCount() {return (int)!!m_pInput;}
+ CBasePin* GetPin(int n) {return n == 0 ? (CBasePin*)m_pInput : NULL;}
+};
+
diff --git a/src/dsutil/a_yuv2rgb.asm b/src/dsutil/a_yuv2rgb.asm
new file mode 100644
index 000000000..a0b1d7366
--- /dev/null
+++ b/src/dsutil/a_yuv2rgb.asm
@@ -0,0 +1,1910 @@
+; VirtualDub - Video processing and capture application
+; Copyright (C) 1998-2001 Avery Lee
+;
+; 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; either version 2 of the License, or
+; (at your option) any later version.
+;
+; 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ .686
+ .mmx
+ .xmm
+ .model flat
+
+ extern _YUV_Y_table: dword
+ extern _YUV_U_table: dword
+ extern _YUV_V_table: dword
+ extern _YUV_clip_table: byte
+ extern _YUV_clip_table16: byte
+
+ .const
+
+ align 16
+
+MMX_10w dq 00010001000100010h
+MMX_80w dq 00080008000800080h
+MMX_00FFw dq 000FF00FF00FF00FFh
+MMX_FF00w dq 0FF00FF00FF00FF00h
+MMX_Ublucoeff dq 00081008100810081h
+MMX_Vredcoeff dq 00066006600660066h
+MMX_Ugrncoeff dq 0FFE7FFE7FFE7FFE7h
+MMX_Vgrncoeff dq 0FFCCFFCCFFCCFFCCh
+MMX_Ycoeff dq 0004A004A004A004Ah
+MMX_rbmask dq 07c1f7c1f7c1f7c1fh
+MMX_grnmask dq 003e003e003e003e0h
+MMX_grnmask2 dq 000f800f800f800f8h
+MMX_clip dq 07c007c007c007c00h
+
+MMX_Ucoeff0 dq 000810000FFE70081h
+MMX_Ucoeff1 dq 0FFE700810000FFE7h
+MMX_Ucoeff2 dq 00000FFE700810000h
+MMX_Vcoeff0 dq 000000066FFCC0000h
+MMX_Vcoeff1 dq 0FFCC00000066FFCCh
+MMX_Vcoeff2 dq 00066FFCC00000066h
+
+ .code
+
+ public _asm_YUVtoRGB32_row
+ public _asm_YUVtoRGB24_row
+ public _asm_YUVtoRGB16_row
+ public _asm_YUVtoRGB32_row_MMX
+ public _asm_YUVtoRGB24_row_MMX
+ public _asm_YUVtoRGB16_row_MMX
+ public _asm_YUVtoRGB32_row_ISSE
+ public _asm_YUVtoRGB24_row_ISSE
+ public _asm_YUVtoRGB16_row_ISSE
+
+; asm_YUVtoRGB_row(
+; Pixel *ARGB1_pointer,
+; Pixel *ARGB2_pointer,
+; YUVPixel *Y1_pointer,
+; YUVPixel *Y2_pointer,
+; YUVPixel *U_pointer,
+; YUVPixel *V_pointer,
+; long width
+; );
+
+ARGB1_pointer equ [esp+ 4+16]
+ARGB2_pointer equ [esp+ 8+16]
+Y1_pointer equ [esp+12+16]
+Y2_pointer equ [esp+16+16]
+U_pointer equ [esp+20+16]
+V_pointer equ [esp+24+16]
+count equ [esp+28+16]
+
+_asm_YUVtoRGB32_row:
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov eax,count
+ mov ebp,eax
+ mov ebx,eax
+ shl ebx,3
+ add eax,eax
+ add ARGB1_pointer,ebx
+ add ARGB2_pointer,ebx
+ add Y1_pointer,eax
+ add Y2_pointer,eax
+ add U_pointer,ebp
+ add V_pointer,ebp
+ neg ebp
+
+ mov esi,U_pointer ;[C]
+ mov edi,V_pointer ;[C]
+ xor edx,edx ;[C]
+ xor ecx,ecx ;[C]
+ jmp short col_loop_start
+
+col_loop:
+ mov ch,[_YUV_clip_table+ebx-3f00h] ;[4] edx = [0][0][red][green]
+ mov esi,U_pointer ;[C]
+ shl ecx,8 ;[4] edx = [0][red][green][0]
+ mov edi,V_pointer ;[C]
+ mov cl,[_YUV_clip_table+edx-3f00h] ;[4] edx = [0][r][g][b] !!
+ xor edx,edx ;[C]
+ mov [eax+ebp*8-4],ecx ;[4]
+ xor ecx,ecx ;[C]
+col_loop_start:
+ mov cl,[esi + ebp] ;[C] eax = U
+ mov dl,[edi + ebp] ;[C] ebx = V
+ mov eax,Y1_pointer ;[1]
+ xor ebx,ebx ;[1]
+ mov esi,[_YUV_U_table + ecx*4] ;[C] eax = [b impact][u-g impact]
+ mov ecx,[_YUV_V_table + edx*4] ;[C] ebx = [r impact][v-g impact]
+ mov edi,esi ;[C]
+ mov bl,[eax + ebp*2] ;[1] ebx = Y1 value
+ shr esi,16 ;[C] eax = blue impact
+ add edi,ecx ;[C] edi = [junk][g impact]
+ mov ebx,[_YUV_Y_table + ebx*4] ;[1] ebx = Y impact
+ and ecx,0ffff0000h ;[C]
+ mov edx,ebx ;[1] edx = Y impact
+ add esi,ecx ;[C] eax = [r impact][b impact]
+ and edi,0000ffffh ;[C]
+ add ebx,esi ;[1] ebx = [red][blue]
+ mov ecx,ebx ;[1] edi = [red][blue]
+ and edx,0000ffffh ;[1] ecx = green
+ shr ebx,16 ;[1] ebx = red
+ and ecx,0000ffffh ;[1] edi = blue
+ mov dl,[_YUV_clip_table+edx+edi-3f00h] ;[1] edx = [0][0][junk][green]
+ mov eax,Y1_pointer ;[2]
+ mov dh,[_YUV_clip_table+ebx-3f00h] ;[1] edx = [0][0][red][green]
+ xor ebx,ebx ;[2]
+ shl edx,8 ;[1] edx = [0][red][green][0]
+ mov bl,[eax + ebp*2 + 1] ;[2] ebx = Y1 value
+ mov eax,ARGB1_pointer ;[1]
+ mov dl,[_YUV_clip_table+ecx-3f00h] ;[1] edx = [0][r][g][b] !!
+ mov ebx,[_YUV_Y_table + ebx*4] ;[2] ebx = Y impact
+ mov ecx,0000ffffh ;[2]
+
+ and ecx,ebx ;[2]
+ add ebx,esi ;[2] ebx = [red][blue]
+
+ mov [eax+ebp*8],edx ;[1]
+ mov edx,ebx ;[2]
+
+ shr ebx,16 ;[2] ebx = red
+ mov eax,Y2_pointer ;[3]
+
+ and edx,0000ffffh ;[2]
+ mov cl,[_YUV_clip_table+ecx+edi-3f00h] ;[2] edx = [0][0][junk][green]
+
+ mov al,[eax + ebp*2] ;[3] ebx = Y1 value
+ mov ch,[_YUV_clip_table+ebx-3f00h] ;[2] edx = [0][0][red][green]
+
+ shl ecx,8 ;[2] edx = [0][red][green][0]
+ and eax,000000ffh ;[3]
+
+ mov cl,[_YUV_clip_table+edx-3f00h] ;[2] edx = [0][r][g][b] !!
+ mov edx,ARGB1_pointer ;[2]
+
+ mov ebx,[_YUV_Y_table + eax*4] ;[3] ebx = Y impact
+ mov eax,0000ffffh
+
+ and eax,ebx ;[3] edi = [red][blue]
+ add ebx,esi ;[3] ebx = [red][blue]
+
+ mov [edx+ebp*8+4],ecx ;[2]
+ mov edx,ebx ;[3]
+
+ shr ebx,16 ;[3] ebx = red
+ mov ecx,Y2_pointer ;[4]
+
+ and edx,0000ffffh ;[3] ecx = green
+ mov al,[_YUV_clip_table+eax+edi-3f00h] ;[3] edx = [0][0][junk][green]
+
+ mov cl,[ecx + ebp*2+1] ;[4] ebx = Y1 value
+ mov ah,[_YUV_clip_table+ebx-3f00h] ;[3] edx = [0][0][red][green]
+
+ shl eax,8 ;[3] edx = [0][red][green][0]
+ and ecx,000000ffh ;[4]
+
+ mov al,[_YUV_clip_table+edx-3f00h] ;[3] edx = [0][r][g][b] !!
+ mov edx,ARGB2_pointer ;[3]
+
+ mov ebx,[_YUV_Y_table + ecx*4] ;[4] ebx = Y impact
+ mov ecx,0000ffffh ;[4]
+
+ and ecx,ebx ;[4] ecx = [0][Y-impact]
+ add ebx,esi ;[4] ebx = [red][blue]
+
+ mov [edx+ebp*8],eax ;[3]
+ mov edx,ebx ;[4] edx = [red][blue]
+
+ shr ebx,16 ;[4] ebx = red
+ mov cl,[_YUV_clip_table+ecx+edi-3f00h] ;[4] edx = [0][0][junk][green]
+
+ and edx,0000ffffh ;[4] edx = blue
+ mov eax,ARGB2_pointer ;[4]
+
+ inc ebp
+
+ jnz col_loop
+
+ mov ch,[_YUV_clip_table+ebx-3f00h] ;[4] edx = [0][0][red][green]
+ shl ecx,8 ;[4] edx = [0][red][green][0]
+ mov cl,[_YUV_clip_table+edx-3f00h] ;[4] edx = [0][r][g][b] !!
+ mov [eax+ebp*8-4],ecx ;[4]
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+ ret
+
+;MMX_test dq 7060504030201000h
+
+_asm_YUVtoRGB32_row_MMX:
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov eax,count
+ mov ebp,eax
+ mov ebx,eax
+ shl ebx,3
+ add eax,eax
+ add ARGB1_pointer,ebx
+ add ARGB2_pointer,ebx
+ add Y1_pointer,eax
+ add Y2_pointer,eax
+ add U_pointer,ebp
+ add V_pointer,ebp
+ neg ebp
+
+ mov esi,U_pointer
+ mov edi,V_pointer
+ mov ecx,Y1_pointer
+ mov edx,Y2_pointer
+ mov eax,ARGB1_pointer
+ mov ebx,ARGB2_pointer
+
+col_loop_MMX:
+ movd mm0, dword ptr [esi+ebp] ;U (byte)
+ pxor mm7,mm7
+
+ movd mm1, dword ptr [edi+ebp] ;V (byte)
+ punpcklbw mm0,mm7 ;U (word)
+
+ psubw mm0,MMX_80w
+ punpcklbw mm1,mm7 ;V (word)
+
+ psubw mm1,MMX_80w
+ movq mm2,mm0
+
+ pmullw mm2,MMX_Ugrncoeff
+ movq mm3,mm1
+
+ pmullw mm3,MMX_Vgrncoeff
+ pmullw mm0,MMX_Ublucoeff
+ pmullw mm1,MMX_Vredcoeff
+ paddw mm2,mm3
+
+ ;mm0: blue
+ ;mm1: red
+ ;mm2: green
+
+ movq mm6,[ecx+ebp*2] ;Y
+ pand mm6,MMX_00FFw
+ psubw mm6,MMX_10w
+ pmullw mm6,MMX_Ycoeff
+ movq mm4,mm6
+ paddw mm6,mm0 ;mm6: <B3><B2><B1><B0>
+ movq mm5,mm4
+ paddw mm4,mm1 ;mm4: <R3><R2><R1><R0>
+ paddw mm5,mm2 ;mm5: <G3><G2><G1><G0>
+ psraw mm6,6
+ psraw mm4,6
+ packuswb mm6,mm6 ;mm6: B3B2B1B0B3B2B1B0
+ psraw mm5,6
+ packuswb mm4,mm4 ;mm4: R3R2R1R0R3R2R1R0
+ punpcklbw mm6,mm4 ;mm6: R3B3R2B2R1B1R0B0
+ packuswb mm5,mm5 ;mm5: G3G2G1G0G3G2G1G0
+ punpcklbw mm5,mm5 ;mm5: G3G3G2G2G1G1G0G0
+ movq mm4,mm6
+ punpcklbw mm6,mm5 ;mm6: G1R1G1B2G0R0G0B0
+ punpckhbw mm4,mm5 ;mm4: G3R3G3B3G2R2G2B2
+
+ movq mm7,[ecx+ebp*2] ;Y
+ psrlw mm7,8
+ psubw mm7,MMX_10w
+ pmullw mm7,MMX_Ycoeff
+ movq mm3,mm7
+ paddw mm7,mm0 ;mm7: final blue
+ movq mm5,mm3
+ paddw mm3,mm1 ;mm3: final red
+ paddw mm5,mm2 ;mm5: final green
+ psraw mm7,6
+ psraw mm3,6
+ packuswb mm7,mm7 ;mm7: B3B2B1B0B3B2B1B0
+ psraw mm5,6
+ packuswb mm3,mm3 ;mm3: R3R2R1R0R3R2R1R0
+ punpcklbw mm7,mm3 ;mm7: R3B3R2B2R1B1R0B0
+ packuswb mm5,mm5 ;mm5: G3G2G1G0G3G2G1G0
+ punpcklbw mm5,mm5 ;mm5: G3G3G2G2G1G1G0G0
+ movq mm3,mm7
+ punpcklbw mm7,mm5 ;mm7: G1R1G1B2G0R0G0B0
+ punpckhbw mm3,mm5 ;mm3: G3R3G3B3G2R2G2B2
+
+ ;mm3 P7:P5
+ ;mm4 P6:P4
+ ;mm6 P2:P0
+ ;mm7 P3:P1
+
+ movq mm5,mm6
+ punpckldq mm5,mm7 ;P1:P0
+ punpckhdq mm6,mm7 ;P3:P2
+ movq mm7,mm4
+ punpckldq mm4,mm3 ;P5:P4
+ punpckhdq mm7,mm3 ;P7:P6
+
+ movq [eax+ebp*8],mm5
+ movq [eax+ebp*8+8],mm6
+ movq [eax+ebp*8+16],mm4
+ movq [eax+ebp*8+24],mm7
+
+ movq mm6,[edx+ebp*2] ;Y
+ pand mm6,MMX_00FFw
+ psubw mm6,MMX_10w
+ pmullw mm6,MMX_Ycoeff
+ movq mm4,mm6
+ paddw mm6,mm0 ;mm6: <B3><B2><B1><B0>
+ movq mm5,mm4
+ paddw mm4,mm1 ;mm4: <R3><R2><R1><R0>
+ paddw mm5,mm2 ;mm5: <G3><G2><G1><G0>
+ psraw mm6,6
+ psraw mm4,6
+ packuswb mm6,mm6 ;mm6: B3B2B1B0B3B2B1B0
+ psraw mm5,6
+ packuswb mm4,mm4 ;mm4: R3R2R1R0R3R2R1R0
+ punpcklbw mm6,mm4 ;mm6: R3B3R2B2R1B1R0B0
+ packuswb mm5,mm5 ;mm5: G3G2G1G0G3G2G1G0
+ punpcklbw mm5,mm5 ;mm5: G3G3G2G2G1G1G0G0
+ movq mm4,mm6
+ punpcklbw mm6,mm5 ;mm6: G1R1G1B2G0R0G0B0
+ punpckhbw mm4,mm5 ;mm4: G3R3G3B3G2R2G2B2
+
+ movq mm7,[edx+ebp*2] ;Y
+ psrlw mm7,8
+ psubw mm7,MMX_10w
+ pmullw mm7,MMX_Ycoeff
+ movq mm3,mm7
+ paddw mm7,mm0 ;mm7: final blue
+ movq mm5,mm3
+ paddw mm3,mm1 ;mm3: final red
+ paddw mm5,mm2 ;mm5: final green
+ psraw mm7,6
+ psraw mm3,6
+ packuswb mm7,mm7 ;mm7: B3B2B1B0B3B2B1B0
+ psraw mm5,6
+ packuswb mm3,mm3 ;mm3: R3R2R1R0R3R2R1R0
+ punpcklbw mm7,mm3 ;mm7: R3B3R2B2R1B1R0B0
+ packuswb mm5,mm5 ;mm5: G3G2G1G0G3G2G1G0
+ punpcklbw mm5,mm5 ;mm5: G3G3G2G2G1G1G0G0
+ movq mm3,mm7
+ punpcklbw mm7,mm5 ;mm7: G1R1G1B2G0R0G0B0
+ punpckhbw mm3,mm5 ;mm3: G3R3G3B3G2R2G2B2
+
+ ;mm3 P7:P5
+ ;mm4 P6:P4
+ ;mm6 P2:P0
+ ;mm7 P3:P1
+
+ movq mm5,mm6
+ punpckldq mm5,mm7 ;P1:P0
+ punpckhdq mm6,mm7 ;P3:P2
+ movq mm7,mm4
+ punpckldq mm4,mm3 ;P5:P4
+ punpckhdq mm7,mm3 ;P7:P6
+
+ movq [ebx+ebp*8 ],mm5
+ movq [ebx+ebp*8+ 8],mm6
+
+ movq [ebx+ebp*8+16],mm4
+ movq [ebx+ebp*8+24],mm7
+
+ add ebp,4
+
+ jnz col_loop_MMX
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+ ret
+
+;**************************************************************************
+;
+; asm_YUVtoRGB24_row(
+; Pixel *ARGB1_pointer,
+; Pixel *ARGB2_pointer,
+; YUVPixel *Y1_pointer,
+; YUVPixel *Y2_pointer,
+; YUVPixel *U_pointer,
+; YUVPixel *V_pointer,
+; long width
+; );
+
+ARGB1_pointer equ [esp+ 4+16]
+ARGB2_pointer equ [esp+ 8+16]
+Y1_pointer equ [esp+12+16]
+Y2_pointer equ [esp+16+16]
+U_pointer equ [esp+20+16]
+V_pointer equ [esp+24+16]
+count equ [esp+28+16]
+
+_asm_YUVtoRGB24_row:
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov eax,count
+ mov ebp,eax
+ add eax,eax
+ add Y1_pointer,eax
+ add Y2_pointer,eax
+ add U_pointer,ebp
+ add V_pointer,ebp
+ neg ebp
+
+ mov esi,U_pointer ;[C]
+ mov edi,V_pointer ;[C]
+ xor edx,edx ;[C]
+ xor ecx,ecx ;[C]
+
+col_loop24:
+ mov esi,U_pointer
+ mov edi,V_pointer
+ xor eax,eax
+ xor ebx,ebx
+ mov al,[esi + ebp] ;eax = U
+ mov bl,[edi + ebp] ;ebx = V
+ mov eax,[_YUV_U_table + eax*4] ;eax = [b impact][u-g impact]
+ mov edi,[_YUV_V_table + ebx*4] ;edi = [r impact][v-g impact]
+
+ mov ecx,eax ;[C]
+ mov esi,Y1_pointer ;[1]
+
+ mov edx,edi ;[C]
+ xor ebx,ebx ;[1]
+
+ shr eax,16 ;[C] eax = blue impact
+ mov bl,[esi + ebp*2] ;[1] ebx = Y1 value
+
+ and edi,0ffff0000h ;[C] edi = [r impact][0]
+ add ecx,edx ;[C] ecx = [junk][g impact]
+
+ add eax,edi ;[C] eax = [r impact][b impact]
+ mov ebx,[_YUV_Y_table + ebx*4] ;[1] ebx = Y impact
+
+ ;eax = [r][b]
+ ;ecx = [g]
+
+ mov esi,ebx ;[1]
+ add ebx,eax ;[1] ebx = [red][blue]
+
+ add esi,ecx ;[1] edx = [junk][green]
+ mov edi,ebx ;[1] edi = [red][blue]
+
+ shr ebx,16 ;[1] ebx = red
+ and esi,0000ffffh ;[1] ecx = green
+
+ and edi,0000ffffh ;edi = blue
+ xor edx,edx
+
+ mov bh,[_YUV_clip_table+ebx-3f00h] ;bh = red
+ mov dl,[_YUV_clip_table+esi-3f00h] ;dl = green
+
+ mov esi,Y1_pointer ;[2]
+ mov bl,[_YUV_clip_table+edi-3f00h] ;bl = blue
+
+ mov edi,ARGB1_pointer ;[1]
+ mov [edi+2],bh ;[1]
+
+ mov [edi+0],bl ;[1]
+ xor ebx,ebx ;[2]
+
+ mov [edi+1],dl ;[1]
+
+ mov bl,[esi + ebp*2 + 1] ;[2] ebx = Y1 value
+ mov esi,ecx ;[2]
+
+ mov ebx,[_YUV_Y_table + ebx*4] ;[2] ebx = Y impact
+ mov edi,0000ffffh ;[2]
+
+ add esi,ebx ;[2] edx = [junk][green]
+ add ebx,eax ;[2] ebx = [red][blue]
+
+ and edi,ebx ;[2] edi = blue
+ and esi,0000ffffh ;[2] ecx = green
+
+ shr ebx,16 ;ebx = red
+ xor edx,edx
+
+ mov bh,[_YUV_clip_table+ebx-3f00h] ;bh = red
+ mov dl,[_YUV_clip_table+esi-3f00h] ;dl = green
+
+ mov esi,Y2_pointer ;[3]
+ mov bl,[_YUV_clip_table+edi-3f00h] ;bl = blue
+
+ mov edi,ARGB1_pointer ;[2]
+ mov [edi+5],bh ;[2]
+
+ mov [edi+4],dl ;[2]
+ mov [edi+3],bl ;[2]
+
+ xor ebx,ebx ;[3]
+
+ mov bl,[esi + ebp*2] ;[3] ebx = Y1 value
+ mov edi,ecx ;[2]
+
+ mov ebx,[_YUV_Y_table + ebx*4] ;[3] ebx = Y impact
+ mov esi,0000ffffh ;[3]
+
+ add edi,ebx ;[3] edx = [junk][green]
+ add ebx,eax ;[3] ebx = [red][blue]
+
+ and esi,ebx ;[3] edi = blue
+ and edi,0000ffffh ;ecx = green
+
+ shr ebx,16 ;ebx = red
+ xor edx,edx
+
+ mov dl,[_YUV_clip_table+edi-3f00h] ;dl = green
+ mov edi,ARGB2_pointer ;[3]
+
+ mov bh,[_YUV_clip_table+ebx-3f00h] ;bh = red
+ mov bl,[_YUV_clip_table+esi-3f00h] ;bl = blue
+
+ mov esi,Y2_pointer ;[4]
+ mov [edi+2],bh
+
+ mov [edi+0],bl
+ xor ebx,ebx ;[4]
+
+ mov [edi+1],dl
+ mov bl,[esi + ebp*2 + 1] ;[4] ebx = Y1 value
+
+ mov edi,0000ffffh ;[4]
+
+ mov ebx,[_YUV_Y_table + ebx*4] ;[4] ebx = Y impact
+ xor edx,edx
+
+ add ecx,ebx ;[4] ecx = [junk][green]
+ add ebx,eax ;ebx = [red][blue]
+
+ and edi,ebx ;edi = blue
+ and ecx,0000ffffh ;ecx = green
+
+ shr ebx,16 ;ebx = red
+ mov esi,ARGB2_pointer
+
+ mov bl,[_YUV_clip_table+ebx-3f00h] ;bh = red
+ mov dl,[_YUV_clip_table+ecx-3f00h] ;dl = green
+
+ mov al,[_YUV_clip_table+edi-3f00h] ;bl = blue
+ mov [esi+5],bl
+
+ mov [esi+4],dl
+ mov ecx,ARGB1_pointer
+
+ mov [esi+3],al
+ add esi,6
+
+ mov ARGB2_pointer,esi
+ add ecx,6
+
+ mov ARGB1_pointer,ecx
+
+ inc ebp
+ jnz col_loop24
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+ ret
+
+_asm_YUVtoRGB24_row_MMX:
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov eax,count
+ mov ebp,eax
+ add eax,eax
+ add Y1_pointer,eax
+ add Y2_pointer,eax
+ add U_pointer,ebp
+ add V_pointer,ebp
+ neg ebp
+
+ mov esi,U_pointer
+ mov edi,V_pointer
+ mov ecx,Y1_pointer
+ mov edx,Y2_pointer
+ mov eax,ARGB1_pointer
+ mov ebx,ARGB2_pointer
+
+col_loop_MMX24:
+ movd mm0, dword ptr [esi+ebp] ;U (byte)
+ pxor mm7,mm7
+
+ movd mm1, dword ptr [edi+ebp] ;V (byte)
+ punpcklbw mm0,mm7 ;U (word)
+
+ movd mm2, dword ptr [ecx+ebp*2] ;Y low
+ punpcklbw mm1,mm7 ;V (word)
+
+ movd mm3, dword ptr [edx+ebp*2] ;Y high
+ punpcklbw mm2,mm7 ;Y1 (word)
+
+ psubw mm2,MMX_10w
+ punpcklbw mm3,mm7 ;Y2 (word)
+
+ psubw mm3,MMX_10w
+
+ psubw mm0,MMX_80w
+ psubw mm1,MMX_80w
+
+ ;group 1
+
+ pmullw mm2,MMX_Ycoeff ;[lazy]
+ movq mm6,mm0
+ pmullw mm3,MMX_Ycoeff ;[lazy]
+ movq mm7,mm1
+ punpcklwd mm6,mm6 ;mm6 = U1U1U0U0
+ movq mm4,mm2 ;mm4 = Y3Y2Y1Y0 [high]
+ punpckldq mm6,mm6 ;mm6 = U0U0U0U0
+ movq mm5,mm3 ;mm3 = Y3Y2Y1Y0 [low]
+ punpcklwd mm7,mm7 ;mm7 = V1V1V0V0
+ punpckldq mm7,mm7 ;mm7 = V0V0V0V0
+
+ pmullw mm6,MMX_Ucoeff0
+ punpcklwd mm4,mm4 ;mm4 = Y1Y1Y0Y0 [high]
+ pmullw mm7,MMX_Vcoeff0
+ punpcklwd mm5,mm5 ;mm5 = Y1Y1Y0Y0 [low]
+
+ punpcklwd mm4,mm2 ;mm4 = Y1Y0Y0Y0
+ punpcklwd mm5,mm3 ;mm5 = Y1Y0Y0Y0
+
+ paddw mm4,mm6
+ paddw mm5,mm6
+ paddw mm4,mm7
+ paddw mm5,mm7
+
+ psraw mm4,6
+ psraw mm5,6
+
+ packuswb mm4,mm4
+ packuswb mm5,mm5
+
+ ;group 2
+
+ movd dword ptr [eax+0],mm4 ;[lazy write]
+ movq mm4,mm0
+ movd dword ptr [ebx+0],mm5 ;[lazy write]
+ movq mm5,mm1
+
+ punpcklwd mm4,mm4 ;mm6 = U1U1U0U0
+ movq mm6,mm2 ;mm4 = Y3Y2Y1Y0 [high]
+ punpcklwd mm5,mm5 ;mm6 = V1V1V0V0
+ movq mm7,mm3 ;mm3 = Y3Y2Y1Y0 [low]
+
+ pmullw mm4,MMX_Ucoeff1
+ psrlq mm6,16 ;mm4 = 00Y3Y2Y1 [high]
+ pmullw mm5,MMX_Vcoeff1
+ psrlq mm7,16 ;mm4 = 00Y3Y2Y1 [low]
+
+ punpcklwd mm6,mm6 ;mm4 = Y2Y2Y1Y1 [high]
+ punpcklwd mm7,mm7 ;mm5 = Y2Y2Y1Y1 [high]
+
+ paddw mm6,mm4
+ paddw mm7,mm4
+ paddw mm6,mm5
+ paddw mm7,mm5
+
+ psraw mm6,6
+ psraw mm7,6
+
+ packuswb mm6,mm6
+ packuswb mm7,mm7
+
+ ;group 3
+
+ movd dword ptr [eax+4],mm6 ;[lazy write]
+ movq mm6,mm0
+ movd dword ptr [ebx+4],mm7 ;[lazy write]
+ movq mm7,mm1
+
+ movq mm4,mm2 ;mm4 = Y3Y2Y1Y0 [high]
+ punpcklwd mm6,mm6 ;mm6 = U1U1U0U0
+ movq mm5,mm3 ;mm3 = Y3Y2Y1Y0 [low]
+ punpckhdq mm6,mm6 ;mm6 = U1U1U1U1
+ punpcklwd mm7,mm7 ;mm7 = V1V1V0V0
+ punpckhdq mm7,mm7 ;mm7 = V1V1V1V1
+
+ pmullw mm6,MMX_Ucoeff2
+ punpckhwd mm2,mm2 ;mm2 = Y3Y3Y2Y2 [high]
+ pmullw mm7,MMX_Vcoeff2
+ punpckhwd mm3,mm3 ;mm3 = Y3Y3Y2Y2 [low]
+
+ punpckhdq mm4,mm2 ;mm4 = Y3Y3Y3Y2 [high]
+ punpckhdq mm5,mm3 ;mm5 = Y3Y3Y3Y2 [low]
+
+ paddw mm4,mm6
+ paddw mm5,mm6
+ paddw mm4,mm7
+ paddw mm5,mm7
+
+ psraw mm4,6
+ psraw mm5,6
+
+ ;next 3 groups
+
+ movd mm2, dword ptr [ecx+ebp*2+4] ;Y low
+ packuswb mm4,mm4 ;[lazy]
+
+ movd mm3, dword ptr [edx+ebp*2+4] ;Y high
+ packuswb mm5,mm5 ;[lazy]
+
+ movd dword ptr [eax+8],mm4 ;[lazy write]
+ pxor mm7,mm7
+
+ movd dword ptr [ebx+8],mm5 ;[lazy write]
+ punpcklbw mm2,mm7 ;U (word)
+
+
+ psubw mm2,MMX_10w
+ punpcklbw mm3,mm7 ;V (word)
+
+ psubw mm3,MMX_10w
+
+
+ ;group 1
+
+ pmullw mm2,MMX_Ycoeff ;[init]
+ movq mm6,mm0
+
+ pmullw mm3,MMX_Ycoeff ;[init]
+ punpckhwd mm6,mm6 ;mm6 = U3U3U2U2
+
+ movq mm7,mm1
+ punpckldq mm6,mm6 ;mm6 = U2U2U2U2
+ movq mm4,mm2 ;mm4 = Y3Y2Y1Y0 [high]
+ punpckhwd mm7,mm7 ;mm7 = V3V3V2V2
+ movq mm5,mm3 ;mm3 = Y3Y2Y1Y0 [low]
+ punpckldq mm7,mm7 ;mm7 = V2V2V2V2
+
+ pmullw mm6,MMX_Ucoeff0
+ punpcklwd mm4,mm4 ;mm4 = Y1Y1Y0Y0 [high]
+ pmullw mm7,MMX_Vcoeff0
+ punpcklwd mm5,mm5 ;mm5 = Y1Y1Y0Y0 [low]
+
+ punpcklwd mm4,mm2 ;mm4 = Y1Y0Y0Y0
+ punpcklwd mm5,mm3 ;mm5 = Y1Y0Y0Y0
+
+ paddw mm4,mm6
+ paddw mm5,mm6
+ paddw mm4,mm7
+ paddw mm5,mm7
+
+ psraw mm4,6
+ psraw mm5,6
+
+ packuswb mm4,mm4
+ packuswb mm5,mm5
+
+ ;group 2
+
+ movd dword ptr [eax+12],mm4
+ movq mm6,mm0
+ movd dword ptr [ebx+12],mm5
+ movq mm7,mm1
+
+ punpckhwd mm6,mm6 ;mm6 = U3U3U2U2
+ movq mm4,mm2 ;mm4 = Y3Y2Y1Y0 [high]
+ punpckhwd mm7,mm7 ;mm6 = V3V3V2V2
+ movq mm5,mm3 ;mm3 = Y3Y2Y1Y0 [low]
+
+ pmullw mm6,MMX_Ucoeff1
+ psrlq mm4,16 ;mm4 = 00Y3Y2Y1 [high]
+ pmullw mm7,MMX_Vcoeff1
+ psrlq mm5,16 ;mm4 = 00Y3Y2Y1 [low]
+
+ punpcklwd mm4,mm4 ;mm4 = Y2Y2Y1Y1 [high]
+ punpcklwd mm5,mm5 ;mm5 = Y2Y2Y1Y1 [high]
+
+ paddw mm4,mm6
+ paddw mm5,mm6
+ paddw mm4,mm7
+ paddw mm5,mm7
+
+ psraw mm4,6
+ psraw mm5,6
+
+ packuswb mm4,mm4
+ packuswb mm5,mm5
+
+ ;group 3
+
+ movq mm6,mm2 ;mm4 = Y3Y2Y1Y0 [high]
+ punpckhwd mm0,mm0 ;mm6 = U3U3U2U2
+
+ movq mm7,mm3 ;mm3 = Y3Y2Y1Y0 [low]
+ punpckhdq mm0,mm0 ;mm6 = U3U3U3U3
+
+ movd dword ptr [eax+16],mm4 ;[lazy write]
+ punpckhwd mm1,mm1 ;mm7 = V3V3V2V2
+
+ movd dword ptr [ebx+16],mm5 ;[lazy write]
+ punpckhdq mm1,mm1 ;mm7 = V3V3V3V3
+
+ pmullw mm0,MMX_Ucoeff2
+ punpckhwd mm2,mm2 ;mm2 = Y3Y3Y2Y2 [high]
+ pmullw mm1,MMX_Vcoeff2
+ punpckhwd mm3,mm3 ;mm3 = Y3Y3Y2Y2 [low]
+
+ punpckhdq mm6,mm2 ;mm4 = Y3Y3Y3Y2 [high]
+ punpckhdq mm7,mm3 ;mm5 = Y3Y3Y3Y2 [low]
+
+ paddw mm6,mm0
+ paddw mm7,mm0
+ paddw mm6,mm1
+ paddw mm7,mm1
+
+ psraw mm6,6
+ psraw mm7,6
+
+ packuswb mm6,mm6
+ packuswb mm7,mm7
+
+ movd dword ptr [eax+20],mm6
+ add eax,24
+ movd dword ptr [ebx+20],mm7
+ add ebx,24
+
+ ;done
+
+ add ebp,4
+ jnz col_loop_MMX24
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+ ret
+
+;**************************************************************************
+
+_asm_YUVtoRGB16_row:
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov eax,count
+ mov ebp,eax
+ mov ebx,eax
+ shl ebx,2
+ add ARGB1_pointer,ebx
+ add ARGB2_pointer,ebx
+ add eax,eax
+ add Y1_pointer,eax
+ add Y2_pointer,eax
+ add U_pointer,ebp
+ add V_pointer,ebp
+ neg ebp
+
+ mov esi,U_pointer ;[C]
+ mov edi,V_pointer ;[C]
+ xor edx,edx ;[C]
+ xor ecx,ecx ;[C]
+
+col_loop16:
+ mov esi,U_pointer
+ mov edi,V_pointer
+ xor eax,eax
+ xor ebx,ebx
+ mov al,[esi + ebp] ;eax = U
+ mov bl,[edi + ebp] ;ebx = V
+ mov eax,[_YUV_U_table + eax*4] ;eax = [b impact][u-g impact]
+ mov edi,[_YUV_V_table + ebx*4] ;edi = [r impact][v-g impact]
+
+ mov ecx,eax ;[C]
+ mov esi,Y1_pointer ;[1]
+
+ mov edx,edi ;[C]
+ xor ebx,ebx ;[1]
+
+ shr eax,16 ;[C] eax = blue impact
+ mov bl,[esi + ebp*2] ;[1] ebx = Y1 value
+
+ and edi,0ffff0000h ;[C] edi = [r impact][0]
+ add ecx,edx ;[C] ecx = [junk][g impact]
+
+ add eax,edi ;[C] eax = [r impact][b impact]
+ mov ebx,[_YUV_Y_table + ebx*4] ;[1] ebx = Y impact
+
+ ;eax = [r][b]
+ ;ecx = [g]
+
+ mov esi,ebx ;[1]
+ add ebx,eax ;[1] ebx = [red][blue]
+
+ add esi,ecx ;[1] edx = [junk][green]
+ mov edi,ebx ;[1] edi = [red][blue]
+
+ shr ebx,16 ;[1] ebx = red
+ and esi,0000ffffh ;[1] ecx = green
+
+ and edi,0000ffffh ;edi = blue
+ xor edx,edx
+
+ mov bh,[_YUV_clip_table16+ebx-3f00h] ;bh = red
+ mov dl,[_YUV_clip_table16+esi-3f00h] ;dl = green
+
+ mov bl,[_YUV_clip_table16+edi-3f00h] ;bl = blue
+ xor dh,dh ;[1]
+
+;565fix shl bh,2 ;[1]
+ shl bh,3 ;[1]
+ mov edi,ARGB1_pointer ;[1]
+
+;565fix shl edx,5 ;[1]
+ shl edx,6 ;[1]
+ mov esi,Y1_pointer ;[2]
+
+ add edx,ebx ;[1]
+ xor ebx,ebx ;[2]
+
+ mov [edi+ebp*4+0],dl ;[1]
+ mov bl,[esi + ebp*2 + 1] ;[2] ebx = Y1 value
+
+ mov [edi+ebp*4+1],dh ;[1]
+ mov esi,ecx ;[2]
+
+ mov ebx,[_YUV_Y_table + ebx*4] ;[2] ebx = Y impact
+ mov edi,0000ffffh ;[2]
+
+ add esi,ebx ;[2] edx = [junk][green]
+ add ebx,eax ;[2] ebx = [red][blue]
+
+ and edi,ebx ;[2] edi = blue
+ and esi,0000ffffh ;[2] ecx = green
+
+ shr ebx,16 ;ebx = red
+ xor edx,edx
+
+ mov bh,[_YUV_clip_table16+ebx-3f00h] ;bh = red
+
+ mov dl,[_YUV_clip_table16+esi-3f00h] ;dl = green
+ mov bl,[_YUV_clip_table16+edi-3f00h] ;bl = blue
+
+;565fix shl edx,5 ;[2]
+ shl edx,6 ;[2]
+ mov edi,ARGB1_pointer ;[2]
+
+;565fix shl bh,2 ;[2]
+ shl bh,3 ;[2]
+ mov esi,Y2_pointer ;[3]
+
+ add edx,ebx ;[2]
+ xor ebx,ebx ;[3]
+
+ mov [edi+ebp*4+2],dl ;[2]
+ mov bl,[esi + ebp*2] ;[3] ebx = Y1 value
+
+ mov [edi+ebp*4+3],dh ;[2]
+ mov edi,ecx ;[2]
+
+ mov ebx,[_YUV_Y_table + ebx*4] ;[3] ebx = Y impact
+ mov esi,0000ffffh ;[3]
+
+ add edi,ebx ;[3] edx = [junk][green]
+ add ebx,eax ;[3] ebx = [red][blue]
+
+ and esi,ebx ;[3] edi = blue
+ and edi,0000ffffh ;ecx = green
+
+ shr ebx,16 ;ebx = red
+ xor edx,edx
+
+ mov dl,[_YUV_clip_table16+edi-3f00h] ;dl = green
+ mov edi,ARGB2_pointer ;[3]
+
+;565fix shl edx,5
+ shl edx,6
+ mov bh,[_YUV_clip_table16+ebx-3f00h] ;bh = red
+
+ mov bl,[_YUV_clip_table16+esi-3f00h] ;bl = blue
+ mov esi,Y2_pointer ;[4]
+
+;565fix shl bh,2 ;[3]
+ shl bh,3 ;[3]
+ nop
+
+ add edx,ebx ;[3]
+ xor ebx,ebx ;[4]
+
+ mov [edi+ebp*4+0],dl ;[3]
+ mov bl,[esi + ebp*2 + 1] ;[4] ebx = Y1 value
+
+ mov [edi+ebp*4+1],dh ;[3]
+ mov edi,0000ffffh ;[4]
+
+ mov ebx,[_YUV_Y_table + ebx*4] ;[4] ebx = Y impact
+ xor edx,edx
+
+ add ecx,ebx ;[4] ecx = [junk][green]
+ add ebx,eax ;ebx = [red][blue]
+
+ and edi,ebx ;edi = blue
+ and ecx,0000ffffh ;ecx = green
+
+ shr ebx,16 ;ebx = red
+ mov esi,ARGB2_pointer
+
+ mov dl,[_YUV_clip_table16+ecx-3f00h] ;dl = green
+ mov al,[_YUV_clip_table16+edi-3f00h] ;bl = blue
+
+;565fix shl edx,5
+ shl edx,6
+ mov ah,[_YUV_clip_table16+ebx-3f00h] ;bh = red
+
+;565fix shl ah,2
+ shl ah,3
+
+ add eax,edx
+
+ mov [esi+ebp*4+2],al
+ mov [esi+ebp*4+3],ah
+
+ inc ebp
+ jnz col_loop16
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+ ret
+
+
+
+_asm_YUVtoRGB16_row_MMX:
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov eax,count
+ mov ebp,eax
+ mov ebx,eax
+ shl ebx,2
+ add eax,eax
+ add ARGB1_pointer,ebx
+ add ARGB2_pointer,ebx
+ add Y1_pointer,eax
+ add Y2_pointer,eax
+ add U_pointer,ebp
+ add V_pointer,ebp
+ neg ebp
+
+ mov esi,U_pointer
+ mov edi,V_pointer
+ mov ecx,Y1_pointer
+ mov edx,Y2_pointer
+ mov eax,ARGB1_pointer
+ mov ebx,ARGB2_pointer
+
+col_loop_MMX16:
+ movd mm0, dword ptr [esi+ebp] ;[0 ] U (byte)
+ pxor mm7,mm7 ;[0 7]
+
+ movd mm1, dword ptr [edi+ebp] ;[01 7] V (byte)
+ punpcklbw mm0,mm7 ;[01 7] U (word)
+
+ psubw mm0,MMX_80w ;[01 7]
+ punpcklbw mm1,mm7 ;[01 7] V (word)
+
+ psubw mm1,MMX_80w ;[01 ]
+ movq mm2,mm0 ;[012 ]
+
+ pmullw mm2,MMX_Ugrncoeff ;[012 ]
+ movq mm3,mm1 ;[0123 ]
+
+ ;mm0: blue
+ ;mm1: red
+ ;mm2: green
+
+ movq mm6,[ecx+ebp*2] ;[0123 6 ] [1] Y
+ ;<-->
+
+ pmullw mm3,MMX_Vgrncoeff ;[0123 ]
+ movq mm7,mm6 ;[012 67] [2] Y
+
+ pmullw mm0,MMX_Ublucoeff ;[0123 ]
+ psrlw mm7,8 ;[012 67] [2]
+
+ pmullw mm1,MMX_Vredcoeff ;[0123 ]
+ ;<-->
+
+ pand mm6,MMX_00FFw ;[012 67] [1]
+ paddw mm2,mm3 ;[012 6 ] [C]
+
+ psubw mm6,MMX_10w ;[012 67] [1]
+
+ pmullw mm6,MMX_Ycoeff ;[012 67] [1]
+
+ psubw mm7,MMX_10w ;[012 67] [2]
+ movq mm4,mm6 ;[012 4 67] [1]
+
+ pmullw mm7,MMX_Ycoeff ;[012 67] [2]
+ movq mm5,mm6 ;[012 4567] [1]
+
+ paddw mm6,mm0 ;[012 4 67] [1] mm6: <B3><B2><B1><B0>
+ paddw mm4,mm1 ;[012 4567] [1] mm4: <R3><R2><R1><R0>
+
+ paddw mm5,mm2 ;[012 4567] [1] mm5: <G3><G2><G1><G0>
+ psraw mm4,6 ;[012 4567] [1]
+
+ movq mm3,mm7 ;[01234567] [2]
+ psraw mm5,4 ;[01234567] [1]
+
+ paddw mm7,mm0 ;[01234567] [2] mm6: <B3><B2><B1><B0>
+ psraw mm6,6 ;[01234567] [1]
+
+ paddsw mm5,MMX_clip
+ packuswb mm6,mm6 ;[01234567] [1] mm6: B3B2B1B0B3B2B1B0
+
+ psubusw mm5,MMX_clip
+ packuswb mm4,mm4 ;[01234567] [1] mm4: R3R2R1R0R3R2R1R0
+
+ pand mm5,MMX_grnmask ;[01234567] [1] mm7: <G3><G2><G1><G0>
+ psrlq mm6,2 ;[01234567] [1]
+
+ punpcklbw mm6,mm4 ;[0123 567] [1] mm4: R3B3R2B2R1B1R0B0
+
+ movq mm4,[edx+ebp*2] ;[01234567] [3] Y
+ psrlw mm6,1 ;[01234567] [1]
+
+ pand mm6,MMX_rbmask ;[01234567] [1] mm6: <RB3><RB2><RB1><RB0>
+
+ por mm6,mm5 ;[01234 67] [1] mm6: P6P4P2P0
+ movq mm5,mm3 ;[01234567] [2]
+
+ paddw mm3,mm1 ;[01234567] [2] mm4: <R3><R2><R1><R0>
+ paddw mm5,mm2 ;[01234567] [2] mm5: <G3><G2><G1><G0>
+
+ pand mm4,MMX_00FFw ;[01234567] [3]
+ psraw mm3,6 ;[01234567] [2]
+
+ psubw mm4,MMX_10w ;[01234567] [3]
+ psraw mm5,4 ;[01234567] [2]
+
+ pmullw mm4,MMX_Ycoeff ;[01234567] [3]
+ psraw mm7,6 ;[01234567] [2]
+
+ paddsw mm5,MMX_clip
+ packuswb mm3,mm3 ;[01234567] [2] mm4: R3R2R1R0R3R2R1R0
+
+ psubusw mm5,MMX_clip
+ packuswb mm7,mm7 ;[01234567] [2] mm6: B3B2B1B0B3B2B1B0
+
+ pand mm5,MMX_grnmask ;[012 4567] [2] mm7: <G3><G2><G1><G0>
+ psrlq mm7,2 ;[01234567] [2]
+
+ punpcklbw mm7,mm3 ;[012 4567] [2] mm6: R3B3R2B2R1B1R0B0
+
+ movq mm3,[edx+ebp*2] ;[01234567] [4] Y
+ psrlw mm7,1 ;[01234567] [2]
+
+ pand mm7,MMX_rbmask ;[01234567] [2] mm6: <RB3><RB2><RB1><RB0>
+ psrlw mm3,8 ;[01234567] [4]
+
+ por mm7,mm5 ;[01234567] [2] mm7: P7P5P3P1
+ movq mm5,mm6 ;[01234567] [A]
+
+ psubw mm3,MMX_10w ;[01234567] [4]
+ punpcklwd mm6,mm7 ;[01234567] [A] mm4: P3P2P1P0
+
+ pmullw mm3,MMX_Ycoeff ;[0123456 ] [4]
+ punpckhwd mm5,mm7 ;[0123456 ] [A} mm5: P7P6P5P4
+
+ movq [eax+ebp*4 ],mm6 ;[012345 ] [A]
+ movq mm6,mm4 ;[0123456 ] [3]
+
+ movq [eax+ebp*4+ 8],mm5 ;[0123456 ] [A]
+ paddw mm6,mm0 ;[01234 6 ] [3] mm6: <B3><B2><B1><B0>
+
+ movq mm5,mm4 ;[0123456 ] [3]
+ paddw mm4,mm1 ;[0123456 ] [3] mm4: <R3><R2><R1><R0>
+
+ paddw mm5,mm2 ;[0123456 ] [3] mm5: <G3><G2><G1><G0>
+ psraw mm4,6 ;[0123456 ] [3]
+
+ movq mm7,mm3 ;[01234567] [4]
+ psraw mm5,4 ;[01234567] [3]
+
+ paddw mm7,mm0 ;[01234567] [4] mm6: <B3><B2><B1><B0>
+ psraw mm6,6 ;[01234567] [3]
+
+ movq mm0,mm3 ;[01234567] [4]
+ packuswb mm4,mm4 ;[01234567] [3] mm4: R3R2R1R0R3R2R1R0
+
+
+ packuswb mm6,mm6 ;[01 34567] [3] mm6: B3B2B1B0B3B2B1B0
+ paddw mm3,mm1 ;[01234567] [4] mm4: <R3><R2><R1><R0>
+
+ psrlq mm6,2
+ paddw mm0,mm2 ;[01 34567] [4] mm5: <G3><G2><G1><G0>
+
+ paddsw mm5,MMX_clip
+ punpcklbw mm6,mm4 ;[01 3 567] [3] mm6: B3B3B2B2B1B1B0B0
+
+ psubusw mm5,MMX_clip
+ psrlw mm6,1 ;[01 3 567] [3]
+
+ pand mm6,MMX_rbmask ;[01 3 567] [3] mm6: <B3><B2><B1><B0>
+ psraw mm3,6 ;[01 3 567] [4]
+
+ pand mm5,MMX_grnmask ;[01 3 567] [3] mm7: <G3><G2><G1><G0>
+ psraw mm0,4 ;[01 3 567] [4]
+
+ por mm6,mm5 ;[01 3 67] [3] mm4: P6P4P2P0
+ psraw mm7,6 ;[01 3 67] [4]
+
+ paddsw mm0,MMX_clip
+ packuswb mm3,mm3 ;[01 3 67] [4] mm4: R3R2R1R0R3R2R1R0
+
+ psubusw mm0,MMX_clip
+ packuswb mm7,mm7 ;[01 3 67] mm6: B3B2B1B0B3B2B1B0
+
+ pand mm0,MMX_grnmask ;[01 67] mm7: <G3><G2><G1><G0>
+ psrlq mm7,2
+
+ punpcklbw mm7,mm3 ;[01 67] mm6: R3B3R2B2R1B1R0B0
+ movq mm1,mm6
+
+ psrlw mm7,1
+ add ebp,4
+
+ pand mm7,MMX_rbmask ;[01 67] mm6: <B3><B2><B1><B0>
+
+ por mm0,mm7 ;[01 67] mm0: P7P5P3P1
+
+ punpcklwd mm6,mm0 ;[01 6 ] mm4: P3P2P1P0
+
+ punpckhwd mm1,mm0 ;[ 1 6 ] mm5: P7P6P5P4
+ movq [ebx+ebp*4-16],mm6
+
+ movq [ebx+ebp*4- 8],mm1
+ jnz col_loop_MMX16
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+ ret
+
+;--------------------------------------------------------------------------
+
+_asm_YUVtoRGB32_row_ISSE:
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov eax,count
+ mov ebp,eax
+ mov ebx,eax
+ shl ebx,3
+ add eax,eax
+ add ARGB1_pointer,ebx
+ add ARGB2_pointer,ebx
+ add Y1_pointer,eax
+ add Y2_pointer,eax
+ add U_pointer,ebp
+ add V_pointer,ebp
+ neg ebp
+
+ mov esi,U_pointer
+ mov edi,V_pointer
+ mov ecx,Y1_pointer
+ mov edx,Y2_pointer
+ mov eax,ARGB1_pointer
+ mov ebx,ARGB2_pointer
+
+col_loop_SSE:
+ prefetchnta [esi+ebp+32]
+ prefetchnta [edi+ebp+32]
+ prefetchnta [ecx+ebp*2+32]
+ prefetchnta [edx+ebp*2+32]
+
+ movd mm0, dword ptr [esi+ebp] ;U (byte)
+ pxor mm7,mm7
+
+ movd mm1, dword ptr [edi+ebp] ;V (byte)
+ punpcklbw mm0,mm7 ;U (word)
+
+ psubw mm0,MMX_80w
+ punpcklbw mm1,mm7 ;V (word)
+
+ psubw mm1,MMX_80w
+ movq mm2,mm0
+
+ pmullw mm2,MMX_Ugrncoeff
+ movq mm3,mm1
+
+ pmullw mm3,MMX_Vgrncoeff
+ pmullw mm0,MMX_Ublucoeff
+ pmullw mm1,MMX_Vredcoeff
+ paddw mm2,mm3
+
+ ;mm0: blue
+ ;mm1: red
+ ;mm2: green
+
+ movq mm6,[ecx+ebp*2] ;Y
+ pand mm6,MMX_00FFw
+ psubw mm6,MMX_10w
+ pmullw mm6,MMX_Ycoeff
+ movq mm4,mm6
+ paddw mm6,mm0 ;mm6: <B3><B2><B1><B0>
+ movq mm5,mm4
+ paddw mm4,mm1 ;mm4: <R3><R2><R1><R0>
+ paddw mm5,mm2 ;mm5: <G3><G2><G1><G0>
+ psraw mm6,6
+ psraw mm4,6
+ packuswb mm6,mm6 ;mm6: B3B2B1B0B3B2B1B0
+ psraw mm5,6
+ packuswb mm4,mm4 ;mm4: R3R2R1R0R3R2R1R0
+ punpcklbw mm6,mm4 ;mm6: R3B3R2B2R1B1R0B0
+ packuswb mm5,mm5 ;mm5: G3G2G1G0G3G2G1G0
+ punpcklbw mm5,mm5 ;mm5: G3G3G2G2G1G1G0G0
+ movq mm4,mm6
+ punpcklbw mm6,mm5 ;mm6: G1R1G1B2G0R0G0B0
+ punpckhbw mm4,mm5 ;mm4: G3R3G3B3G2R2G2B2
+
+ movq mm7,[ecx+ebp*2] ;Y
+ psrlw mm7,8
+ psubw mm7,MMX_10w
+ pmullw mm7,MMX_Ycoeff
+ movq mm3,mm7
+ paddw mm7,mm0 ;mm7: final blue
+ movq mm5,mm3
+ paddw mm3,mm1 ;mm3: final red
+ paddw mm5,mm2 ;mm5: final green
+ psraw mm7,6
+ psraw mm3,6
+ packuswb mm7,mm7 ;mm7: B3B2B1B0B3B2B1B0
+ psraw mm5,6
+ packuswb mm3,mm3 ;mm3: R3R2R1R0R3R2R1R0
+ punpcklbw mm7,mm3 ;mm7: R3B3R2B2R1B1R0B0
+ packuswb mm5,mm5 ;mm5: G3G2G1G0G3G2G1G0
+ punpcklbw mm5,mm5 ;mm5: G3G3G2G2G1G1G0G0
+ movq mm3,mm7
+ punpcklbw mm7,mm5 ;mm7: G1R1G1B2G0R0G0B0
+ punpckhbw mm3,mm5 ;mm3: G3R3G3B3G2R2G2B2
+
+ ;mm3 P7:P5
+ ;mm4 P6:P4
+ ;mm6 P2:P0
+ ;mm7 P3:P1
+
+ movq mm5,mm6
+ punpckldq mm5,mm7 ;P1:P0
+ punpckhdq mm6,mm7 ;P3:P2
+ movq mm7,mm4
+ punpckldq mm4,mm3 ;P5:P4
+ punpckhdq mm7,mm3 ;P7:P6
+
+ movntq [eax+ebp*8],mm5
+ movntq [eax+ebp*8+8],mm6
+ movntq [eax+ebp*8+16],mm4
+ movntq [eax+ebp*8+24],mm7
+
+ movq mm6,[edx+ebp*2] ;Y
+ pand mm6,MMX_00FFw
+ psubw mm6,MMX_10w
+ pmullw mm6,MMX_Ycoeff
+ movq mm4,mm6
+ paddw mm6,mm0 ;mm6: <B3><B2><B1><B0>
+ movq mm5,mm4
+ paddw mm4,mm1 ;mm4: <R3><R2><R1><R0>
+ paddw mm5,mm2 ;mm5: <G3><G2><G1><G0>
+ psraw mm6,6
+ psraw mm4,6
+ packuswb mm6,mm6 ;mm6: B3B2B1B0B3B2B1B0
+ psraw mm5,6
+ packuswb mm4,mm4 ;mm4: R3R2R1R0R3R2R1R0
+ punpcklbw mm6,mm4 ;mm6: R3B3R2B2R1B1R0B0
+ packuswb mm5,mm5 ;mm5: G3G2G1G0G3G2G1G0
+ punpcklbw mm5,mm5 ;mm5: G3G3G2G2G1G1G0G0
+ movq mm4,mm6
+ punpcklbw mm6,mm5 ;mm6: G1R1G1B2G0R0G0B0
+ punpckhbw mm4,mm5 ;mm4: G3R3G3B3G2R2G2B2
+
+ movq mm7,[edx+ebp*2] ;Y
+ psrlw mm7,8
+ psubw mm7,MMX_10w
+ pmullw mm7,MMX_Ycoeff
+ movq mm3,mm7
+ paddw mm7,mm0 ;mm7: final blue
+ movq mm5,mm3
+ paddw mm3,mm1 ;mm3: final red
+ paddw mm5,mm2 ;mm5: final green
+ psraw mm7,6
+ psraw mm3,6
+ packuswb mm7,mm7 ;mm7: B3B2B1B0B3B2B1B0
+ psraw mm5,6
+ packuswb mm3,mm3 ;mm3: R3R2R1R0R3R2R1R0
+ punpcklbw mm7,mm3 ;mm7: R3B3R2B2R1B1R0B0
+ packuswb mm5,mm5 ;mm5: G3G2G1G0G3G2G1G0
+ punpcklbw mm5,mm5 ;mm5: G3G3G2G2G1G1G0G0
+ movq mm3,mm7
+ punpcklbw mm7,mm5 ;mm7: G1R1G1B2G0R0G0B0
+ punpckhbw mm3,mm5 ;mm3: G3R3G3B3G2R2G2B2
+
+ ;mm3 P7:P5
+ ;mm4 P6:P4
+ ;mm6 P2:P0
+ ;mm7 P3:P1
+
+ movq mm5,mm6
+ punpckldq mm5,mm7 ;P1:P0
+ punpckhdq mm6,mm7 ;P3:P2
+ movq mm7,mm4
+ punpckldq mm4,mm3 ;P5:P4
+ punpckhdq mm7,mm3 ;P7:P6
+
+ movntq [ebx+ebp*8 ],mm5
+ movntq [ebx+ebp*8+ 8],mm6
+
+ movntq [ebx+ebp*8+16],mm4
+ movntq [ebx+ebp*8+24],mm7
+
+ add ebp,4
+
+ jnz col_loop_SSE
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+ ret
+
+_asm_YUVtoRGB24_row_ISSE:
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov eax,count
+ mov ebp,eax
+ add eax,eax
+ add Y1_pointer,eax
+ add Y2_pointer,eax
+ add U_pointer,ebp
+ add V_pointer,ebp
+ neg ebp
+
+ mov esi,U_pointer
+ mov edi,V_pointer
+ mov ecx,Y1_pointer
+ mov edx,Y2_pointer
+ mov eax,ARGB1_pointer
+ mov ebx,ARGB2_pointer
+
+ movd mm0,esp
+ sub esp,20
+ and esp,-8
+ movd dword ptr [esp+16],mm0
+
+col_loop_ISSE24:
+ prefetchnta [esi+ebp+32]
+ prefetchnta [edi+ebp+32]
+ prefetchnta [ecx+ebp*2+32]
+ prefetchnta [edx+ebp*2+32]
+
+ movd mm0, dword ptr [esi+ebp] ;U (byte)
+ pxor mm7,mm7
+
+ movd mm1, dword ptr [edi+ebp] ;V (byte)
+ punpcklbw mm0,mm7 ;U (word)
+
+ movd mm2, dword ptr [ecx+ebp*2] ;Y low
+ punpcklbw mm1,mm7 ;V (word)
+
+ movd mm3, dword ptr [edx+ebp*2] ;Y high
+ punpcklbw mm2,mm7 ;Y1 (word)
+
+ psubw mm2,MMX_10w
+ punpcklbw mm3,mm7 ;Y2 (word)
+
+ psubw mm3,MMX_10w
+
+ psubw mm0,MMX_80w
+ psubw mm1,MMX_80w
+
+ movq [esp+0],mm0
+ movq [esp+8],mm1
+
+ ;group 1
+
+ pmullw mm2,MMX_Ycoeff ;[lazy]
+ pmullw mm3,MMX_Ycoeff ;[lazy]
+
+ pshufw mm6,mm0,00000000b ;mm6 = U0U0U0U0
+ pshufw mm7,mm1,00000000b ;mm7 = V0V0V0V0
+
+ pmullw mm6,MMX_Ucoeff0
+ pshufw mm4,mm2,01000000b ;mm4 = Y1Y0Y0Y0 [high]
+ pmullw mm7,MMX_Vcoeff0
+ pshufw mm5,mm3,01000000b ;mm4 = Y1Y0Y0Y0 [low]
+
+ paddw mm4,mm6
+ paddw mm5,mm6
+ paddw mm4,mm7
+ paddw mm5,mm7
+
+ psraw mm4,6
+ psraw mm5,6
+
+ ;group 2
+
+ pshufw mm6,[esp+0],01010000b ;mm6 = U1U1U0U0
+ pshufw mm7,[esp+8],01010000b ;mm7 = V1V1V0V0
+
+ pmullw mm6,MMX_Ucoeff1
+ pshufw mm0,mm2,10100101b ;mm0 = Y2Y2Y1Y1 [high]
+ pmullw mm7,MMX_Vcoeff1
+ pshufw mm1,mm3,10100101b ;mm1 = Y2Y2Y1Y1 [low]
+
+ paddw mm0,mm6
+ paddw mm1,mm6
+ paddw mm0,mm7
+ paddw mm1,mm7
+
+ psraw mm0,6
+ psraw mm1,6
+
+ packuswb mm4,mm0
+ packuswb mm5,mm1
+
+ ;group 3
+
+ pshufw mm6,[esp+0],01010101b ;mm6 = U1U1U1U1
+ pshufw mm7,[esp+8],01010101b ;mm7 = V1V1V1V1
+
+ movntq [eax],mm4 ;[lazy write]
+ movntq [ebx],mm5 ;[lazy write]
+
+ pmullw mm6,MMX_Ucoeff2
+ pshufw mm4,mm2,11111110b ;mm4 = Y3Y3Y3Y2 [high]
+ pmullw mm7,MMX_Vcoeff2
+ pshufw mm5,mm3,11111110b ;mm5 = Y3Y3Y3Y2 [low]
+
+ paddw mm4,mm6
+ paddw mm5,mm6
+ paddw mm4,mm7
+ paddw mm5,mm7
+
+ psraw mm4,6
+ psraw mm5,6
+
+ ;next 3 groups
+
+ movd mm2, dword ptr [ecx+ebp*2+4] ;Y low
+ pxor mm7,mm7
+
+ movd mm3, dword ptr [edx+ebp*2+4] ;Y high
+ punpcklbw mm2,mm7 ;U (word)
+
+ psubw mm2,MMX_10w
+ punpcklbw mm3,mm7 ;V (word)
+
+ psubw mm3,MMX_10w
+
+
+ ;group 1
+
+ pmullw mm2,MMX_Ycoeff ;[init]
+ pmullw mm3,MMX_Ycoeff ;[init]
+
+ pshufw mm6,[esp+0],10101010b ;mm6 = U2U2U2U2
+ pshufw mm7,[esp+8],10101010b ;mm7 = V2V2V2V2
+
+ pmullw mm6,MMX_Ucoeff0
+ pshufw mm0,mm2,01000000b ;mm0 = Y1Y0Y0Y0 [high]
+ pmullw mm7,MMX_Vcoeff0
+ pshufw mm1,mm3,01000000b ;mm1 = Y1Y0Y0Y0 [low]
+
+ paddw mm0,mm6
+ paddw mm1,mm6
+ paddw mm0,mm7
+ paddw mm1,mm7
+
+ psraw mm0,6
+ psraw mm1,6
+
+ packuswb mm4,mm0
+ packuswb mm5,mm1
+
+ ;group 2
+
+ pshufw mm6,[esp+0],11111010b ;mm6 = U3U3U2U2
+ pshufw mm7,[esp+8],11111010b ;mm7 = V3V3V2V2
+
+ movntq [eax+8],mm4
+ movntq [ebx+8],mm5
+
+ pmullw mm6,MMX_Ucoeff1
+ pshufw mm4,mm2,10100101b ;mm4 = Y2Y2Y1Y1 [high]
+ pmullw mm7,MMX_Vcoeff1
+ pshufw mm5,mm3,10100101b ;mm5 = Y2Y2Y1Y1 [low]
+
+ paddw mm4,mm6
+ paddw mm5,mm6
+ paddw mm4,mm7
+ paddw mm5,mm7
+
+ psraw mm4,6
+ psraw mm5,6
+
+ ;group 3
+
+ pshufw mm0,[esp+0],11111111b ;mm6 = U3U3U3U3
+ pshufw mm1,[esp+8],11111111b ;mm7 = V3V3V3V3
+
+ pmullw mm0,MMX_Ucoeff2
+ pshufw mm2,mm2,11111110b ;mm6 = Y3Y3Y3Y2 [high]
+ pmullw mm1,MMX_Vcoeff2
+ pshufw mm3,mm3,11111110b ;mm7 = Y3Y3Y3Y2 [low]
+
+ paddw mm2,mm0
+ paddw mm3,mm0
+ paddw mm2,mm1
+ paddw mm3,mm1
+
+ psraw mm2,6
+ psraw mm3,6
+
+ packuswb mm4,mm2
+ packuswb mm5,mm3
+
+ movntq [eax+16],mm4
+ add eax,24
+ movntq [ebx+16],mm5
+ add ebx,24
+
+ ;done
+
+ add ebp,4
+ jnz col_loop_ISSE24
+
+ mov esp,[esp+16]
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+ ret
+
+_asm_YUVtoRGB16_row_ISSE:
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov eax,count
+ mov ebp,eax
+ mov ebx,eax
+ shl ebx,2
+ add eax,eax
+ add ARGB1_pointer,ebx
+ add ARGB2_pointer,ebx
+ add Y1_pointer,eax
+ add Y2_pointer,eax
+ add U_pointer,ebp
+ add V_pointer,ebp
+ neg ebp
+
+ mov esi,U_pointer
+ mov edi,V_pointer
+ mov ecx,Y1_pointer
+ mov edx,Y2_pointer
+ mov eax,ARGB1_pointer
+ mov ebx,ARGB2_pointer
+
+col_loop_ISSE16:
+ prefetchnta [esi+ebp+32]
+ prefetchnta [edi+ebp+32]
+
+ movd mm0, dword ptr [esi+ebp] ;[0 ] U (byte)
+ pxor mm7,mm7 ;[0 7]
+
+ movd mm1, dword ptr [edi+ebp] ;[01 7] V (byte)
+ punpcklbw mm0,mm7 ;[01 7] U (word)
+
+ psubw mm0,MMX_80w ;[01 7]
+ punpcklbw mm1,mm7 ;[01 7] V (word)
+
+ psubw mm1,MMX_80w ;[01 ]
+ movq mm2,mm0 ;[012 ]
+
+ pmullw mm2,MMX_Ugrncoeff ;[012 ]
+ movq mm3,mm1 ;[0123 ]
+
+ ;mm0: blue
+ ;mm1: red
+ ;mm2: green
+
+ prefetchnta [ecx+ebp*2+32]
+ prefetchnta [edx+ebp*2+32]
+
+ movq mm6,[ecx+ebp*2] ;[0123 6 ] [1] Y
+ ;<-->
+
+ pmullw mm3,MMX_Vgrncoeff ;[0123 ]
+ movq mm7,mm6 ;[012 67] [2] Y
+
+ pmullw mm0,MMX_Ublucoeff ;[0123 ]
+ psrlw mm7,8 ;[012 67] [2]
+
+ pmullw mm1,MMX_Vredcoeff ;[0123 ]
+ ;<-->
+
+ pand mm6,MMX_00FFw ;[012 67] [1]
+ paddw mm2,mm3 ;[012 6 ] [C]
+
+ psubw mm6,MMX_10w ;[012 67] [1]
+
+ pmullw mm6,MMX_Ycoeff ;[012 67] [1]
+
+ psubw mm7,MMX_10w ;[012 67] [2]
+ movq mm4,mm6 ;[012 4 67] [1]
+
+ pmullw mm7,MMX_Ycoeff ;[012 67] [2]
+ movq mm5,mm6 ;[012 4567] [1]
+
+ paddw mm6,mm0 ;[012 4 67] [1] mm6: <B3><B2><B1><B0>
+ paddw mm4,mm1 ;[012 4567] [1] mm4: <R3><R2><R1><R0>
+
+ paddw mm5,mm2 ;[012 4567] [1] mm5: <G3><G2><G1><G0>
+ psraw mm4,6 ;[012 4567] [1]
+
+ movq mm3,mm7 ;[01234567] [2]
+ psraw mm5,4 ;[01234567] [1]
+
+ paddw mm7,mm0 ;[01234567] [2] mm6: <B3><B2><B1><B0>
+ psraw mm6,6 ;[01234567] [1]
+
+ paddsw mm5,MMX_clip
+ packuswb mm6,mm6 ;[01234567] [1] mm6: B3B2B1B0B3B2B1B0
+
+ psubusw mm5,MMX_clip
+ packuswb mm4,mm4 ;[01234567] [1] mm4: R3R2R1R0R3R2R1R0
+
+ pand mm5,MMX_grnmask ;[01234567] [1] mm7: <G3><G2><G1><G0>
+ psrlq mm6,2 ;[01234567] [1]
+
+ punpcklbw mm6,mm4 ;[0123 567] [1] mm4: R3B3R2B2R1B1R0B0
+
+ movq mm4,[edx+ebp*2] ;[01234567] [3] Y
+ psrlw mm6,1 ;[01234567] [1]
+
+ pand mm6,MMX_rbmask ;[01234567] [1] mm6: <RB3><RB2><RB1><RB0>
+
+ por mm6,mm5 ;[01234 67] [1] mm6: P6P4P2P0
+ movq mm5,mm3 ;[01234567] [2]
+
+ paddw mm3,mm1 ;[01234567] [2] mm4: <R3><R2><R1><R0>
+ paddw mm5,mm2 ;[01234567] [2] mm5: <G3><G2><G1><G0>
+
+ pand mm4,MMX_00FFw ;[01234567] [3]
+ psraw mm3,6 ;[01234567] [2]
+
+ psubw mm4,MMX_10w ;[01234567] [3]
+ psraw mm5,4 ;[01234567] [2]
+
+ pmullw mm4,MMX_Ycoeff ;[01234567] [3]
+ psraw mm7,6 ;[01234567] [2]
+
+ paddsw mm5,MMX_clip
+ packuswb mm3,mm3 ;[01234567] [2] mm4: R3R2R1R0R3R2R1R0
+
+ psubusw mm5,MMX_clip
+ packuswb mm7,mm7 ;[01234567] [2] mm6: B3B2B1B0B3B2B1B0
+
+ pand mm5,MMX_grnmask ;[012 4567] [2] mm7: <G3><G2><G1><G0>
+ psrlq mm7,2 ;[01234567] [2]
+
+ punpcklbw mm7,mm3 ;[012 4567] [2] mm6: R3B3R2B2R1B1R0B0
+
+ movq mm3,[edx+ebp*2] ;[01234567] [4] Y
+ psrlw mm7,1 ;[01234567] [2]
+
+ pand mm7,MMX_rbmask ;[01234567] [2] mm6: <RB3><RB2><RB1><RB0>
+ psrlw mm3,8 ;[01234567] [4]
+
+ por mm7,mm5 ;[01234567] [2] mm7: P7P5P3P1
+ movq mm5,mm6 ;[01234567] [A]
+
+ psubw mm3,MMX_10w ;[01234567] [4]
+ punpcklwd mm6,mm7 ;[01234567] [A] mm4: P3P2P1P0
+
+ pmullw mm3,MMX_Ycoeff ;[0123456 ] [4]
+ punpckhwd mm5,mm7 ;[0123456 ] [A} mm5: P7P6P5P4
+
+ movntq [eax+ebp*4 ],mm6 ;[012345 ] [A]
+ movq mm6,mm4 ;[0123456 ] [3]
+
+ movntq [eax+ebp*4+ 8],mm5 ;[0123456 ] [A]
+ paddw mm6,mm0 ;[01234 6 ] [3] mm6: <B3><B2><B1><B0>
+
+ movq mm5,mm4 ;[0123456 ] [3]
+ paddw mm4,mm1 ;[0123456 ] [3] mm4: <R3><R2><R1><R0>
+
+ paddw mm5,mm2 ;[0123456 ] [3] mm5: <G3><G2><G1><G0>
+ psraw mm4,6 ;[0123456 ] [3]
+
+ movq mm7,mm3 ;[01234567] [4]
+ psraw mm5,4 ;[01234567] [3]
+
+ paddw mm7,mm0 ;[01234567] [4] mm6: <B3><B2><B1><B0>
+ psraw mm6,6 ;[01234567] [3]
+
+ movq mm0,mm3 ;[01234567] [4]
+ packuswb mm4,mm4 ;[01234567] [3] mm4: R3R2R1R0R3R2R1R0
+
+
+ packuswb mm6,mm6 ;[01 34567] [3] mm6: B3B2B1B0B3B2B1B0
+ paddw mm3,mm1 ;[01234567] [4] mm4: <R3><R2><R1><R0>
+
+ psrlq mm6,2
+ paddw mm0,mm2 ;[01 34567] [4] mm5: <G3><G2><G1><G0>
+
+ paddsw mm5,MMX_clip
+ punpcklbw mm6,mm4 ;[01 3 567] [3] mm6: B3B3B2B2B1B1B0B0
+
+ psubusw mm5,MMX_clip
+ psrlw mm6,1 ;[01 3 567] [3]
+
+ pand mm6,MMX_rbmask ;[01 3 567] [3] mm6: <B3><B2><B1><B0>
+ psraw mm3,6 ;[01 3 567] [4]
+
+ pand mm5,MMX_grnmask ;[01 3 567] [3] mm7: <G3><G2><G1><G0>
+ psraw mm0,4 ;[01 3 567] [4]
+
+ por mm6,mm5 ;[01 3 67] [3] mm4: P6P4P2P0
+ psraw mm7,6 ;[01 3 67] [4]
+
+ paddsw mm0,MMX_clip
+ packuswb mm3,mm3 ;[01 3 67] [4] mm4: R3R2R1R0R3R2R1R0
+
+ psubusw mm0,MMX_clip
+ packuswb mm7,mm7 ;[01 3 67] mm6: B3B2B1B0B3B2B1B0
+
+ pand mm0,MMX_grnmask ;[01 67] mm7: <G3><G2><G1><G0>
+ psrlq mm7,2
+
+ punpcklbw mm7,mm3 ;[01 67] mm6: R3B3R2B2R1B1R0B0
+ movq mm1,mm6
+
+ psrlw mm7,1
+ add ebp,4
+
+ pand mm7,MMX_rbmask ;[01 67] mm6: <B3><B2><B1><B0>
+
+ por mm0,mm7 ;[01 67] mm0: P7P5P3P1
+
+ punpcklwd mm6,mm0 ;[01 6 ] mm4: P3P2P1P0
+
+ punpckhwd mm1,mm0 ;[ 1 6 ] mm5: P7P6P5P4
+ movntq [ebx+ebp*4-16],mm6
+
+ movntq [ebx+ebp*4- 8],mm1
+ jnz col_loop_ISSE16
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+ ret
+
+
+ end
diff --git a/src/dsutil/a_yuvtable.asm b/src/dsutil/a_yuvtable.asm
new file mode 100644
index 000000000..2ed568639
--- /dev/null
+++ b/src/dsutil/a_yuvtable.asm
@@ -0,0 +1,612 @@
+; VirtualDub - Video processing and capture application
+; Copyright (C) 1998-2001 Avery Lee
+;
+; 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; either version 2 of the License, or
+; (at your option) any later version.
+;
+; 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ .486
+ .model flat
+ .const
+
+ public _YUV_Y_table
+ public _YUV_U_table
+ public _YUV_V_table
+ public _YUV_clip_table
+ public _YUV_clip_table16
+
+_YUV_Y_table dd 1FED1FEDh, 1FEF1FEFh, 1FF01FF0h, 1FF11FF1h
+ dd 1FF21FF2h, 1FF31FF3h, 1FF41FF4h, 1FF61FF6h
+ dd 1FF71FF7h, 1FF81FF8h, 1FF91FF9h, 1FFA1FFAh
+ dd 1FFB1FFBh, 1FFD1FFDh, 1FFE1FFEh, 1FFF1FFFh
+ dd 20002000h, 20012001h, 20022002h, 20032003h
+ dd 20052005h, 20062006h, 20072007h, 20082008h
+ dd 20092009h, 200A200Ah, 200C200Ch, 200D200Dh
+ dd 200E200Eh, 200F200Fh, 20102010h, 20112011h
+ dd 20132013h, 20142014h, 20152015h, 20162016h
+ dd 20172017h, 20182018h, 201A201Ah, 201B201Bh
+ dd 201C201Ch, 201D201Dh, 201E201Eh, 201F201Fh
+ dd 20212021h, 20222022h, 20232023h, 20242024h
+ dd 20252025h, 20262026h, 20282028h, 20292029h
+ dd 202A202Ah, 202B202Bh, 202C202Ch, 202D202Dh
+ dd 202F202Fh, 20302030h, 20312031h, 20322032h
+ dd 20332033h, 20342034h, 20362036h, 20372037h
+ dd 20382038h, 20392039h, 203A203Ah, 203B203Bh
+ dd 203D203Dh, 203E203Eh, 203F203Fh, 20402040h
+ dd 20412041h, 20422042h, 20442044h, 20452045h
+ dd 20462046h, 20472047h, 20482048h, 20492049h
+ dd 204A204Ah, 204C204Ch, 204D204Dh, 204E204Eh
+ dd 204F204Fh, 20502050h, 20512051h, 20532053h
+ dd 20542054h, 20552055h, 20562056h, 20572057h
+ dd 20582058h, 205A205Ah, 205B205Bh, 205C205Ch
+ dd 205D205Dh, 205E205Eh, 205F205Fh, 20612061h
+ dd 20622062h, 20632063h, 20642064h, 20652065h
+ dd 20662066h, 20682068h, 20692069h, 206A206Ah
+ dd 206B206Bh, 206C206Ch, 206D206Dh, 206F206Fh
+ dd 20702070h, 20712071h, 20722072h, 20732073h
+ dd 20742074h, 20762076h, 20772077h, 20782078h
+ dd 20792079h, 207A207Ah, 207B207Bh, 207D207Dh
+ dd 207E207Eh, 207F207Fh, 20802080h, 20812081h
+ dd 20822082h, 20842084h, 20852085h, 20862086h
+ dd 20872087h, 20882088h, 20892089h, 208B208Bh
+ dd 208C208Ch, 208D208Dh, 208E208Eh, 208F208Fh
+ dd 20902090h, 20922092h, 20932093h, 20942094h
+ dd 20952095h, 20962096h, 20972097h, 20982098h
+ dd 209A209Ah, 209B209Bh, 209C209Ch, 209D209Dh
+ dd 209E209Eh, 209F209Fh, 20A120A1h, 20A220A2h
+ dd 20A320A3h, 20A420A4h, 20A520A5h, 20A620A6h
+ dd 20A820A8h, 20A920A9h, 20AA20AAh, 20AB20ABh
+ dd 20AC20ACh, 20AD20ADh, 20AF20AFh, 20B020B0h
+ dd 20B120B1h, 20B220B2h, 20B320B3h, 20B420B4h
+ dd 20B620B6h, 20B720B7h, 20B820B8h, 20B920B9h
+ dd 20BA20BAh, 20BB20BBh, 20BD20BDh, 20BE20BEh
+ dd 20BF20BFh, 20C020C0h, 20C120C1h, 20C220C2h
+ dd 20C420C4h, 20C520C5h, 20C620C6h, 20C720C7h
+ dd 20C820C8h, 20C920C9h, 20CB20CBh, 20CC20CCh
+ dd 20CD20CDh, 20CE20CEh, 20CF20CFh, 20D020D0h
+ dd 20D220D2h, 20D320D3h, 20D420D4h, 20D520D5h
+ dd 20D620D6h, 20D720D7h, 20D920D9h, 20DA20DAh
+ dd 20DB20DBh, 20DC20DCh, 20DD20DDh, 20DE20DEh
+ dd 20DF20DFh, 20E120E1h, 20E220E2h, 20E320E3h
+ dd 20E420E4h, 20E520E5h, 20E620E6h, 20E820E8h
+ dd 20E920E9h, 20EA20EAh, 20EB20EBh, 20EC20ECh
+ dd 20ED20EDh, 20EF20EFh, 20F020F0h, 20F120F1h
+ dd 20F220F2h, 20F320F3h, 20F420F4h, 20F620F6h
+ dd 20F720F7h, 20F820F8h, 20F920F9h, 20FA20FAh
+ dd 20FB20FBh, 20FD20FDh, 20FE20FEh, 20FF20FFh
+ dd 21002100h, 21012101h, 21022102h, 21042104h
+ dd 21052105h, 21062106h, 21072107h, 21082108h
+ dd 21092109h, 210B210Bh, 210C210Ch, 210D210Dh
+ dd 210E210Eh, 210F210Fh, 21102110h, 21122112h
+ dd 21132113h, 21142114h, 21152115h, 21162116h
+
+_YUV_U_table dd 1EFE1032h, 1F001032h, 1F021031h, 1F041031h
+ dd 1F061030h, 1F081030h, 1F0A1030h, 1F0C102Fh
+ dd 1F0E102Fh, 1F10102Fh, 1F12102Eh, 1F14102Eh
+ dd 1F16102Dh, 1F18102Dh, 1F1A102Dh, 1F1C102Ch
+ dd 1F1E102Ch, 1F20102Bh, 1F22102Bh, 1F24102Bh
+ dd 1F26102Ah, 1F28102Ah, 1F2A1029h, 1F2C1029h
+ dd 1F2E1029h, 1F301028h, 1F321028h, 1F341027h
+ dd 1F361027h, 1F381027h, 1F3A1026h, 1F3C1026h
+ dd 1F3E1026h, 1F401025h, 1F421025h, 1F441024h
+ dd 1F461024h, 1F481024h, 1F4A1023h, 1F4C1023h
+ dd 1F4E1022h, 1F501022h, 1F521022h, 1F541021h
+ dd 1F561021h, 1F591020h, 1F5B1020h, 1F5D1020h
+ dd 1F5F101Fh, 1F61101Fh, 1F63101Eh, 1F65101Eh
+ dd 1F67101Eh, 1F69101Dh, 1F6B101Dh, 1F6D101Dh
+ dd 1F6F101Ch, 1F71101Ch, 1F73101Bh, 1F75101Bh
+ dd 1F77101Bh, 1F79101Ah, 1F7B101Ah, 1F7D1019h
+ dd 1F7F1019h, 1F811019h, 1F831018h, 1F851018h
+ dd 1F871017h, 1F891017h, 1F8B1017h, 1F8D1016h
+ dd 1F8F1016h, 1F911016h, 1F931015h, 1F951015h
+ dd 1F971014h, 1F991014h, 1F9B1014h, 1F9D1013h
+ dd 1F9F1013h, 1FA11012h, 1FA31012h, 1FA51012h
+ dd 1FA71011h, 1FA91011h, 1FAB1010h, 1FAD1010h
+ dd 1FAF1010h, 1FB1100Fh, 1FB3100Fh, 1FB5100Eh
+ dd 1FB7100Eh, 1FB9100Eh, 1FBB100Dh, 1FBD100Dh
+ dd 1FBF100Dh, 1FC1100Ch, 1FC3100Ch, 1FC5100Bh
+ dd 1FC7100Bh, 1FCA100Bh, 1FCC100Ah, 1FCE100Ah
+ dd 1FD01009h, 1FD21009h, 1FD41009h, 1FD61008h
+ dd 1FD81008h, 1FDA1007h, 1FDC1007h, 1FDE1007h
+ dd 1FE01006h, 1FE21006h, 1FE41005h, 1FE61005h
+ dd 1FE81005h, 1FEA1004h, 1FEC1004h, 1FEE1004h
+ dd 1FF01003h, 1FF21003h, 1FF41002h, 1FF61002h
+ dd 1FF81002h, 1FFA1001h, 1FFC1001h, 1FFE1000h
+ dd 20001000h, 20021000h, 20040FFFh, 20060FFFh
+ dd 20080FFEh, 200A0FFEh, 200C0FFEh, 200E0FFDh
+ dd 20100FFDh, 20120FFCh, 20140FFCh, 20160FFCh
+ dd 20180FFBh, 201A0FFBh, 201C0FFBh, 201E0FFAh
+ dd 20200FFAh, 20220FF9h, 20240FF9h, 20260FF9h
+ dd 20280FF8h, 202A0FF8h, 202C0FF7h, 202E0FF7h
+ dd 20300FF7h, 20320FF6h, 20340FF6h, 20360FF5h
+ dd 20390FF5h, 203B0FF5h, 203D0FF4h, 203F0FF4h
+ dd 20410FF3h, 20430FF3h, 20450FF3h, 20470FF2h
+ dd 20490FF2h, 204B0FF2h, 204D0FF1h, 204F0FF1h
+ dd 20510FF0h, 20530FF0h, 20550FF0h, 20570FEFh
+ dd 20590FEFh, 205B0FEEh, 205D0FEEh, 205F0FEEh
+ dd 20610FEDh, 20630FEDh, 20650FECh, 20670FECh
+ dd 20690FECh, 206B0FEBh, 206D0FEBh, 206F0FEAh
+ dd 20710FEAh, 20730FEAh, 20750FE9h, 20770FE9h
+ dd 20790FE9h, 207B0FE8h, 207D0FE8h, 207F0FE7h
+ dd 20810FE7h, 20830FE7h, 20850FE6h, 20870FE6h
+ dd 20890FE5h, 208B0FE5h, 208D0FE5h, 208F0FE4h
+ dd 20910FE4h, 20930FE3h, 20950FE3h, 20970FE3h
+ dd 20990FE2h, 209B0FE2h, 209D0FE2h, 209F0FE1h
+ dd 20A10FE1h, 20A30FE0h, 20A50FE0h, 20A70FE0h
+ dd 20AA0FDFh, 20AC0FDFh, 20AE0FDEh, 20B00FDEh
+ dd 20B20FDEh, 20B40FDDh, 20B60FDDh, 20B80FDCh
+ dd 20BA0FDCh, 20BC0FDCh, 20BE0FDBh, 20C00FDBh
+ dd 20C20FDAh, 20C40FDAh, 20C60FDAh, 20C80FD9h
+ dd 20CA0FD9h, 20CC0FD9h, 20CE0FD8h, 20D00FD8h
+ dd 20D20FD7h, 20D40FD7h, 20D60FD7h, 20D80FD6h
+ dd 20DA0FD6h, 20DC0FD5h, 20DE0FD5h, 20E00FD5h
+ dd 20E20FD4h, 20E40FD4h, 20E60FD3h, 20E80FD3h
+ dd 20EA0FD3h, 20EC0FD2h, 20EE0FD2h, 20F00FD1h
+ dd 20F20FD1h, 20F40FD1h, 20F60FD0h, 20F80FD0h
+ dd 20FA0FD0h, 20FC0FCFh, 20FE0FCFh, 21000FCEh
+
+_YUV_V_table dd 1F341068h, 1F351067h, 1F371066h, 1F391066h
+ dd 1F3A1065h, 1F3C1064h, 1F3D1063h, 1F3F1062h
+ dd 1F401062h, 1F421061h, 1F441060h, 1F45105Fh
+ dd 1F47105Eh, 1F48105Dh, 1F4A105Dh, 1F4C105Ch
+ dd 1F4D105Bh, 1F4F105Ah, 1F501059h, 1F521059h
+ dd 1F541058h, 1F551057h, 1F571056h, 1F581055h
+ dd 1F5A1055h, 1F5C1054h, 1F5D1053h, 1F5F1052h
+ dd 1F601051h, 1F621050h, 1F641050h, 1F65104Fh
+ dd 1F67104Eh, 1F68104Dh, 1F6A104Ch, 1F6C104Ch
+ dd 1F6D104Bh, 1F6F104Ah, 1F701049h, 1F721048h
+ dd 1F741048h, 1F751047h, 1F771046h, 1F781045h
+ dd 1F7A1044h, 1F7C1043h, 1F7D1043h, 1F7F1042h
+ dd 1F801041h, 1F821040h, 1F84103Fh, 1F85103Fh
+ dd 1F87103Eh, 1F88103Dh, 1F8A103Ch, 1F8B103Bh
+ dd 1F8D103Bh, 1F8F103Ah, 1F901039h, 1F921038h
+ dd 1F931037h, 1F951036h, 1F971036h, 1F981035h
+ dd 1F9A1034h, 1F9B1033h, 1F9D1032h, 1F9F1032h
+ dd 1FA01031h, 1FA21030h, 1FA3102Fh, 1FA5102Eh
+ dd 1FA7102Eh, 1FA8102Dh, 1FAA102Ch, 1FAB102Bh
+ dd 1FAD102Ah, 1FAF1029h, 1FB01029h, 1FB21028h
+ dd 1FB31027h, 1FB51026h, 1FB71025h, 1FB81025h
+ dd 1FBA1024h, 1FBB1023h, 1FBD1022h, 1FBF1021h
+ dd 1FC01021h, 1FC21020h, 1FC3101Fh, 1FC5101Eh
+ dd 1FC7101Dh, 1FC8101Ch, 1FCA101Ch, 1FCB101Bh
+ dd 1FCD101Ah, 1FCF1019h, 1FD01018h, 1FD21018h
+ dd 1FD31017h, 1FD51016h, 1FD71015h, 1FD81014h
+ dd 1FDA1014h, 1FDB1013h, 1FDD1012h, 1FDE1011h
+ dd 1FE01010h, 1FE2100Fh, 1FE3100Fh, 1FE5100Eh
+ dd 1FE6100Dh, 1FE8100Ch, 1FEA100Bh, 1FEB100Bh
+ dd 1FED100Ah, 1FEE1009h, 1FF01008h, 1FF21007h
+ dd 1FF31007h, 1FF51006h, 1FF61005h, 1FF81004h
+ dd 1FFA1003h, 1FFB1002h, 1FFD1002h, 1FFE1001h
+ dd 20001000h, 20020FFFh, 20030FFEh, 20050FFEh
+ dd 20060FFDh, 20080FFCh, 200A0FFBh, 200B0FFAh
+ dd 200D0FF9h, 200E0FF9h, 20100FF8h, 20120FF7h
+ dd 20130FF6h, 20150FF5h, 20160FF5h, 20180FF4h
+ dd 201A0FF3h, 201B0FF2h, 201D0FF1h, 201E0FF1h
+ dd 20200FF0h, 20220FEFh, 20230FEEh, 20250FEDh
+ dd 20260FECh, 20280FECh, 20290FEBh, 202B0FEAh
+ dd 202D0FE9h, 202E0FE8h, 20300FE8h, 20310FE7h
+ dd 20330FE6h, 20350FE5h, 20360FE4h, 20380FE4h
+ dd 20390FE3h, 203B0FE2h, 203D0FE1h, 203E0FE0h
+ dd 20400FDFh, 20410FDFh, 20430FDEh, 20450FDDh
+ dd 20460FDCh, 20480FDBh, 20490FDBh, 204B0FDAh
+ dd 204D0FD9h, 204E0FD8h, 20500FD7h, 20510FD7h
+ dd 20530FD6h, 20550FD5h, 20560FD4h, 20580FD3h
+ dd 20590FD2h, 205B0FD2h, 205D0FD1h, 205E0FD0h
+ dd 20600FCFh, 20610FCEh, 20630FCEh, 20650FCDh
+ dd 20660FCCh, 20680FCBh, 20690FCAh, 206B0FCAh
+ dd 206D0FC9h, 206E0FC8h, 20700FC7h, 20710FC6h
+ dd 20730FC5h, 20750FC5h, 20760FC4h, 20780FC3h
+ dd 20790FC2h, 207B0FC1h, 207C0FC1h, 207E0FC0h
+ dd 20800FBFh, 20810FBEh, 20830FBDh, 20840FBDh
+ dd 20860FBCh, 20880FBBh, 20890FBAh, 208B0FB9h
+ dd 208C0FB8h, 208E0FB8h, 20900FB7h, 20910FB6h
+ dd 20930FB5h, 20940FB4h, 20960FB4h, 20980FB3h
+ dd 20990FB2h, 209B0FB1h, 209C0FB0h, 209E0FB0h
+ dd 20A00FAFh, 20A10FAEh, 20A30FADh, 20A40FACh
+ dd 20A60FABh, 20A80FABh, 20A90FAAh, 20AB0FA9h
+ dd 20AC0FA8h, 20AE0FA7h, 20B00FA7h, 20B10FA6h
+ dd 20B30FA5h, 20B40FA4h, 20B60FA3h, 20B80FA3h
+ dd 20B90FA2h, 20BB0FA1h, 20BC0FA0h, 20BE0F9Fh
+ dd 20C00F9Eh, 20C10F9Eh, 20C30F9Dh, 20C40F9Ch
+ dd 20C60F9Bh, 20C70F9Ah, 20C90F9Ah, 20CB0F99h
+
+_YUV_clip_table db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 1, 2, 3
+ db 4, 5, 6, 7
+ db 8, 9, 10, 11
+ db 12, 13, 14, 15
+ db 16, 17, 18, 19
+ db 20, 21, 22, 23
+ db 24, 25, 26, 27
+ db 28, 29, 30, 31
+ db 32, 33, 34, 35
+ db 36, 37, 38, 39
+ db 40, 41, 42, 43
+ db 44, 45, 46, 47
+ db 48, 49, 50, 51
+ db 52, 53, 54, 55
+ db 56, 57, 58, 59
+ db 60, 61, 62, 63
+ db 64, 65, 66, 67
+ db 68, 69, 70, 71
+ db 72, 73, 74, 75
+ db 76, 77, 78, 79
+ db 80, 81, 82, 83
+ db 84, 85, 86, 87
+ db 88, 89, 90, 91
+ db 92, 93, 94, 95
+ db 96, 97, 98, 99
+ db 100, 101, 102, 103
+ db 104, 105, 106, 107
+ db 108, 109, 110, 111
+ db 112, 113, 114, 115
+ db 116, 117, 118, 119
+ db 120, 121, 122, 123
+ db 124, 125, 126, 127
+ db 128, 129, 130, 131
+ db 132, 133, 134, 135
+ db 136, 137, 138, 139
+ db 140, 141, 142, 143
+ db 144, 145, 146, 147
+ db 148, 149, 150, 151
+ db 152, 153, 154, 155
+ db 156, 157, 158, 159
+ db 160, 161, 162, 163
+ db 164, 165, 166, 167
+ db 168, 169, 170, 171
+ db 172, 173, 174, 175
+ db 176, 177, 178, 179
+ db 180, 181, 182, 183
+ db 184, 185, 186, 187
+ db 188, 189, 190, 191
+ db 192, 193, 194, 195
+ db 196, 197, 198, 199
+ db 200, 201, 202, 203
+ db 204, 205, 206, 207
+ db 208, 209, 210, 211
+ db 212, 213, 214, 215
+ db 216, 217, 218, 219
+ db 220, 221, 222, 223
+ db 224, 225, 226, 227
+ db 228, 229, 230, 231
+ db 232, 233, 234, 235
+ db 236, 237, 238, 239
+ db 240, 241, 242, 243
+ db 244, 245, 246, 247
+ db 248, 249, 250, 251
+ db 252, 253, 254, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+ db 255, 255, 255, 255
+
+
+_YUV_clip_table16 db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 0, 0, 0, 0
+ db 1, 1, 1, 1
+ db 1, 1, 1, 1
+ db 2, 2, 2, 2
+ db 2, 2, 2, 2
+ db 3, 3, 3, 3
+ db 3, 3, 3, 3
+ db 4, 4, 4, 4
+ db 4, 4, 4, 4
+ db 5, 5, 5, 5
+ db 5, 5, 5, 5
+ db 6, 6, 6, 6
+ db 6, 6, 6, 6
+ db 7, 7, 7, 7
+ db 7, 7, 7, 7
+ db 8, 8, 8, 8
+ db 8, 8, 8, 8
+ db 9, 9, 9, 9
+ db 9, 9, 9, 9
+ db 10, 10, 10, 10
+ db 10, 10, 10, 10
+ db 11, 11, 11, 11
+ db 11, 11, 11, 11
+ db 12, 12, 12, 12
+ db 12, 12, 12, 12
+ db 13, 13, 13, 13
+ db 13, 13, 13, 13
+ db 14, 14, 14, 14
+ db 14, 14, 14, 14
+ db 15, 15, 15, 15
+ db 15, 15, 15, 15
+ db 16, 16, 16, 16
+ db 16, 16, 16, 16
+ db 17, 17, 17, 17
+ db 17, 17, 17, 17
+ db 18, 18, 18, 18
+ db 18, 18, 18, 18
+ db 19, 19, 19, 19
+ db 19, 19, 19, 19
+ db 20, 20, 20, 20
+ db 20, 20, 20, 20
+ db 21, 21, 21, 21
+ db 21, 21, 21, 21
+ db 22, 22, 22, 22
+ db 22, 22, 22, 22
+ db 23, 23, 23, 23
+ db 23, 23, 23, 23
+ db 24, 24, 24, 24
+ db 24, 24, 24, 24
+ db 25, 25, 25, 25
+ db 25, 25, 25, 25
+ db 26, 26, 26, 26
+ db 26, 26, 26, 26
+ db 27, 27, 27, 27
+ db 27, 27, 27, 27
+ db 28, 28, 28, 28
+ db 28, 28, 28, 28
+ db 29, 29, 29, 29
+ db 29, 29, 29, 29
+ db 30, 30, 30, 30
+ db 30, 30, 30, 30
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+ db 31, 31, 31, 31
+
+
+ end
+
diff --git a/src/dsutil/convert_a.asm b/src/dsutil/convert_a.asm
new file mode 100644
index 000000000..5322bd8bf
--- /dev/null
+++ b/src/dsutil/convert_a.asm
@@ -0,0 +1,263 @@
+; Avisynth v2.5. Copyright 2002 Ben Rudiak-Gould et al.
+; http://www.avisynth.org
+;
+; 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; either version 2 of the License, or
+; (at your option) any later version.
+;
+; 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., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
+; http://www.gnu.org/copyleft/gpl.html .
+;
+; Linking Avisynth statically or dynamically with other modules is making a
+; combined work based on Avisynth. Thus, the terms and conditions of the GNU
+; General Public License cover the whole combination.
+;
+; As a special exception, the copyright holders of Avisynth give you
+; permission to link Avisynth with independent modules that communicate with
+; Avisynth solely through the interfaces defined in avisynth.h, regardless of the license
+; terms of these independent modules, and to copy and distribute the
+; resulting combined work under terms of your choice, provided that
+; every copy of the combined work is accompanied by a complete copy of
+; the source code of Avisynth (the version of Avisynth used to produce the
+; combined work), being distributed under the terms of the GNU General
+; Public License plus this exception. An independent module is a module
+; which is not derived from or based on Avisynth, such as 3rd-party filters,
+; import and export plugins, or graphical user interfaces.
+
+ .586
+ .mmx
+ .model flat
+
+; alignment has to be 'page' so that I can use 'align 32' below
+
+_TEXT64 segment page public use32 'CODE'
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ align 8
+
+yuv2rgb_constants:
+
+x0000_0000_0010_0010 dq 00000000000100010h
+x0080_0080_0080_0080 dq 00080008000800080h
+x00FF_00FF_00FF_00FF dq 000FF00FF00FF00FFh
+x00002000_00002000 dq 00000200000002000h
+xFF000000_FF000000 dq 0FF000000FF000000h
+cy dq 000004A8500004A85h
+crv dq 03313000033130000h
+cgu_cgv dq 0E5FCF377E5FCF377h
+cbu dq 00000408D0000408Dh
+
+yuv2rgb_constants_rec709:
+
+ dq 00000000000100010h
+ dq 00080008000800080h
+ dq 000FF00FF00FF00FFh
+ dq 00000200000002000h
+ dq 0FF000000FF000000h
+ dq 000004A8500004A85h
+ dq 03960000039600000h
+ dq 0EEF5F930EEF5F930h
+ dq 00000439B0000439Bh
+
+ofs_x0000_0000_0010_0010 = 0
+ofs_x0080_0080_0080_0080 = 8
+ofs_x00FF_00FF_00FF_00FF = 16
+ofs_x00002000_00002000 = 24
+ofs_xFF000000_FF000000 = 32
+ofs_cy = 40
+ofs_crv = 48
+ofs_cgu_cgv = 56
+ofs_cbu = 64
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+GET_Y MACRO mma,uyvy
+IF &uyvy
+ psrlw mma,8
+ELSE
+ pand mma,[edx+ofs_x00FF_00FF_00FF_00FF]
+ENDIF
+ ENDM
+
+GET_UV MACRO mma,uyvy
+ GET_Y mma,1-uyvy
+ ENDM
+
+YUV2RGB_INNER_LOOP MACRO uyvy,rgb32,no_next_pixel
+
+;; This YUV422->RGB conversion code uses only four MMX registers per
+;; source dword, so I convert two dwords in parallel. Lines corresponding
+;; to the "second pipe" are indented an extra space. There's almost no
+;; overlap, except at the end and in the three lines marked ***.
+;; revised 4july,2002 to properly set alpha in rgb32 to default "on" & other small memory optimizations
+
+ movd mm0, dword ptr [esi]
+ movd mm5, dword ptr [esi+4]
+ movq mm1,mm0
+ GET_Y mm0,&uyvy ; mm0 = __________Y1__Y0
+ movq mm4,mm5
+ GET_UV mm1,&uyvy ; mm1 = __________V0__U0
+ GET_Y mm4,&uyvy
+ movq mm2,mm5 ; *** avoid reload from [esi+4]
+ GET_UV mm5,&uyvy
+ psubw mm0, qword ptr [edx+ofs_x0000_0000_0010_0010]
+ movd mm6, dword ptr [esi+8-4*(no_next_pixel)]
+ GET_UV mm2,&uyvy ; mm2 = __________V2__U2
+ psubw mm4, qword ptr [edx+ofs_x0000_0000_0010_0010]
+ paddw mm2,mm1
+ GET_UV mm6,&uyvy
+ psubw mm1, qword ptr [edx+ofs_x0080_0080_0080_0080]
+ paddw mm6,mm5
+ psllq mm2,32
+ psubw mm5, qword ptr [edx+ofs_x0080_0080_0080_0080]
+ punpcklwd mm0,mm2 ; mm0 = ______Y1______Y0
+ psllq mm6,32
+ pmaddwd mm0, qword ptr [edx+ofs_cy]
+ punpcklwd mm4,mm6
+ paddw mm1,mm1
+ pmaddwd mm4, qword ptr [edx+ofs_cy]
+ paddw mm5,mm5
+ paddw mm1,mm2 ; mm1 = __V1__U1__V0__U0 * 2
+ paddd mm0,[edx+ofs_x00002000_00002000]
+ paddw mm5,mm6
+ movq mm2,mm1
+ paddd mm4,[edx+ofs_x00002000_00002000]
+ movq mm3,mm1
+ movq mm6,mm5
+ pmaddwd mm1,[edx+ofs_crv]
+ movq mm7,mm5
+ paddd mm1,mm0
+ pmaddwd mm5,[edx+ofs_crv]
+ psrad mm1,14 ; mm1 = RRRRRRRRrrrrrrrr
+ paddd mm5,mm4
+ pmaddwd mm2,[edx+ofs_cgu_cgv]
+ psrad mm5,14
+ paddd mm2,mm0
+ pmaddwd mm6,[edx+ofs_cgu_cgv]
+ psrad mm2,14 ; mm2 = GGGGGGGGgggggggg
+ paddd mm6,mm4
+ pmaddwd mm3,[edx+ofs_cbu]
+ psrad mm6,14
+ paddd mm3,mm0
+ pmaddwd mm7,[edx+ofs_cbu]
+ add esi,8
+ add edi,12+4*rgb32
+IFE &no_next_pixel
+ cmp esi,ecx
+ENDIF
+ psrad mm3,14 ; mm3 = BBBBBBBBbbbbbbbb
+ paddd mm7,mm4
+ pxor mm0,mm0
+ psrad mm7,14
+ packssdw mm3,mm2 ; mm3 = GGGGggggBBBBbbbb
+ packssdw mm7,mm6
+ packssdw mm1,mm0 ; mm1 = ________RRRRrrrr
+ packssdw mm5,mm0 ; *** avoid pxor mm4,mm4
+ movq mm2,mm3
+ movq mm6,mm7
+ punpcklwd mm2,mm1 ; mm2 = RRRRBBBBrrrrbbbb
+ punpcklwd mm6,mm5
+ punpckhwd mm3,mm1 ; mm3 = ____GGGG____gggg
+ punpckhwd mm7,mm5
+ movq mm0,mm2
+ movq mm4,mm6
+ punpcklwd mm0,mm3 ; mm0 = ____rrrrggggbbbb
+ punpcklwd mm4,mm7
+IFE &rgb32
+ psllq mm0,16
+ psllq mm4,16
+ENDIF
+ punpckhwd mm2,mm3 ; mm2 = ____RRRRGGGGBBBB
+ punpckhwd mm6,mm7
+ packuswb mm0,mm2 ; mm0 = __RRGGBB__rrggbb <- ta dah!
+ packuswb mm4,mm6
+
+IF &rgb32
+ por mm0, [edx+ofs_xFF000000_FF000000] ; set alpha channels "on"
+ por mm4, [edx+ofs_xFF000000_FF000000]
+ movq [edi-16],mm0 ; store the quadwords independently
+ movq [edi-8],mm4
+ELSE
+ psrlq mm0,8 ; pack the two quadwords into 12 bytes
+ psllq mm4,8 ; (note: the two shifts above leave
+ movd dword ptr [edi-12],mm0 ; mm0,4 = __RRGGBBrrggbb__)
+ psrlq mm0,32
+ por mm4,mm0
+ movd dword ptr [edi-8],mm4
+ psrlq mm4,32
+ movd dword ptr [edi-4],mm4
+ENDIF
+
+ ENDM
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+YUV2RGB_PROC MACRO procname,uyvy,rgb32
+
+ PUBLIC C _&procname
+
+;;void __cdecl procname(
+;; [esp+ 4] const BYTE* src,
+;; [esp+ 8] BYTE* dst,
+;; [esp+12] const BYTE* src_end,
+;; [esp+16] int src_pitch,
+;; [esp+20] int row_size,
+;; [esp+24] bool rec709);
+
+_&procname PROC
+
+ push esi
+ push edi
+ push ebx
+
+ mov eax,[esp+16+12]
+ mov esi,[esp+12+12] ; read source bottom-up
+ mov edi,[esp+8+12]
+ mov ebx,[esp+20+12]
+ mov edx,offset yuv2rgb_constants
+ test byte ptr [esp+24+12],1
+ jz loop0
+ mov edx,offset yuv2rgb_constants_rec709
+
+loop0:
+ sub esi,eax
+ lea ecx,[esi+ebx-8]
+
+ align 32
+loop1:
+ YUV2RGB_INNER_LOOP uyvy,rgb32,0
+ jb loop1
+
+ YUV2RGB_INNER_LOOP uyvy,rgb32,1
+
+ sub esi,ebx
+ cmp esi,[esp+4+12]
+ ja loop0
+
+ emms
+ pop ebx
+ pop edi
+ pop esi
+ retn
+
+_&procname ENDP
+
+ ENDM
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+YUV2RGB_PROC mmx_YUY2toRGB24,0,0
+YUV2RGB_PROC mmx_YUY2toRGB32,0,1
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ END
diff --git a/src/dsutil/dsutil.sln b/src/dsutil/dsutil.sln
new file mode 100644
index 000000000..e27a776fa
--- /dev/null
+++ b/src/dsutil/dsutil.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/dsutil/dsutil.vcproj b/src/dsutil/dsutil.vcproj
new file mode 100644
index 000000000..240efff1a
--- /dev/null
+++ b/src/dsutil/dsutil.vcproj
@@ -0,0 +1,399 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="dsutil"
+ ProjectGUID="{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="vfw32.lib Version.lib"
+ OutputFile="../../lib/$(ProjectName)D.lib"
+ IgnoreAllDefaultLibraries="FALSE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="vfw32.lib Version.lib"
+ OutputFile="../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="vfw32.lib Version.lib"
+ OutputFile="../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="vfw32.lib Version.lib"
+ OutputFile="../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\a_yuv2rgb.asm">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\a_yuvtable.asm">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\convert_a.asm">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\DSMPropertyBag.cpp">
+ </File>
+ <File
+ RelativePath="DSUtil.cpp">
+ </File>
+ <File
+ RelativePath=".\FontInstaller.cpp">
+ </File>
+ <File
+ RelativePath=".\MediaTypeEx.cpp">
+ </File>
+ <File
+ RelativePath="MediaTypes.cpp">
+ </File>
+ <File
+ RelativePath=".\NullRenderers.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\text.cpp">
+ </File>
+ <File
+ RelativePath=".\vd.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\DSMPropertyBag.h">
+ </File>
+ <File
+ RelativePath="DSUtil.h">
+ </File>
+ <File
+ RelativePath=".\FontInstaller.h">
+ </File>
+ <File
+ RelativePath=".\MediaTypeEx.h">
+ </File>
+ <File
+ RelativePath="MediaTypes.h">
+ </File>
+ <File
+ RelativePath=".\NullRenderers.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath=".\text.h">
+ </File>
+ <File
+ RelativePath=".\vd.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/dsutil/dsutil.vcproj.vspscc b/src/dsutil/dsutil.vcproj.vspscc
new file mode 100644
index 000000000..5499145b7
--- /dev/null
+++ b/src/dsutil/dsutil.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:dsutil"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/src/dsutil/stdafx.cpp b/src/dsutil/stdafx.cpp
new file mode 100644
index 000000000..0cde80132
--- /dev/null
+++ b/src/dsutil/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// dsutil.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/dsutil/stdafx.h b/src/dsutil/stdafx.h
new file mode 100644
index 000000000..7cba79780
--- /dev/null
+++ b/src/dsutil/stdafx.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <Shlwapi.h>
+
+#include <atlcoll.h>
+#include <atlpath.h>
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/dsutil/text.cpp b/src/dsutil/text.cpp
new file mode 100644
index 000000000..9264a5a85
--- /dev/null
+++ b/src/dsutil/text.cpp
@@ -0,0 +1,220 @@
+#include "stdafx.h"
+#include "text.h"
+
+/*
+CString Explode(CString str, CAtlList<CString>& sl, TCHAR sep, int limit)
+{
+ sl.RemoveAll();
+
+ if(limit == 1) {sl.AddTail(str); return _T("");}
+
+ if(!str.IsEmpty() && str[str.GetLength()-1] != sep)
+ str += sep;
+
+ for(int i = 0, j = 0; (j = str.Find(sep, i)) >= 0; i = j+1)
+ {
+ CString tmp = str.Mid(i, j-i);
+ tmp.TrimLeft(sep); tmp.TrimRight(sep);
+ tmp.TrimLeft(); tmp.TrimRight();
+ sl.AddTail(tmp);
+ if(limit > 0 && sl.GetCount() == limit-1)
+ {
+ if(j+1 < str.GetLength())
+ {
+ CString tmp = str.Mid(j+1);
+ tmp.TrimLeft(sep); tmp.TrimRight(sep);
+ tmp.TrimLeft(); tmp.TrimRight();
+ sl.AddTail(tmp);
+ }
+ break;
+ }
+ }
+
+ if(sl.IsEmpty())
+ {
+ str.TrimLeft(sep); str.TrimRight(sep);
+ str.TrimLeft(); str.TrimRight();
+ sl.AddTail(str);
+ }
+
+ return sl.GetHead();
+}
+
+CString ExplodeMin(CString str, CAtlList<CString>& sl, TCHAR sep, int limit)
+{
+ Explode(str, sl, sep, limit);
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ POSITION tmp = pos;
+ if(sl.GetNext(pos).IsEmpty())
+ sl.RemoveAt(tmp);
+ }
+ if(sl.IsEmpty()) sl.AddTail(CString()); // eh
+
+ return sl.GetHead();
+}
+
+CString Implode(CAtlList<CString>& sl, TCHAR sep)
+{
+ CString ret;
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ ret += sl.GetNext(pos);
+ if(pos) ret += sep;
+ }
+ return(ret);
+}
+*/
+
+DWORD CharSetToCodePage(DWORD dwCharSet)
+{
+ if(dwCharSet == CP_UTF8) return CP_UTF8;
+ if(dwCharSet == CP_UTF7) return CP_UTF7;
+ CHARSETINFO cs={0};
+ ::TranslateCharsetInfo((DWORD *)dwCharSet, &cs, TCI_SRCCHARSET);
+ return cs.ciACP;
+}
+
+CStringA ConvertMBCS(CStringA str, DWORD SrcCharSet, DWORD DstCharSet)
+{
+ WCHAR* utf16 = new WCHAR[str.GetLength()+1];
+ memset(utf16, 0, (str.GetLength()+1)*sizeof(WCHAR));
+
+ CHAR* mbcs = new CHAR[str.GetLength()*6+1];
+ memset(mbcs, 0, str.GetLength()*6+1);
+
+ int len = MultiByteToWideChar(
+ CharSetToCodePage(SrcCharSet), 0,
+ str.GetBuffer(str.GetLength()), str.GetLength(),
+ utf16, (str.GetLength()+1)*sizeof(WCHAR));
+
+ len = WideCharToMultiByte(
+ CharSetToCodePage(DstCharSet), 0,
+ utf16, len,
+ mbcs, str.GetLength()*6,
+ NULL, NULL);
+
+ str = mbcs;
+
+ delete [] utf16;
+ delete [] mbcs;
+
+ return str;
+}
+
+CStringA UrlEncode(CStringA str, bool fRaw)
+{
+ CStringA urlstr;
+
+ for(int i = 0; i < str.GetLength(); i++)
+ {
+ CHAR c = str[i];
+ if(fRaw && c == '+') urlstr += "%2B";
+ else if(c > 0x20 && c < 0x7f && c != '&') urlstr += c;
+ else if(c == 0x20) urlstr += fRaw ? ' ' : '+';
+ else {CStringA tmp; tmp.Format("%%%02x", (BYTE)c); urlstr += tmp;}
+ }
+
+ return urlstr;
+}
+
+CStringA UrlDecode(CStringA str, bool fRaw)
+{
+ str.Replace("&amp;", "&");
+
+ CHAR* s = str.GetBuffer(str.GetLength());
+ CHAR* e = s + str.GetLength();
+ CHAR* s1 = s;
+ CHAR* s2 = s;
+ while(s1 < e)
+ {
+ CHAR s11 = (s1 < e-1) ? (__isascii(s1[1]) && isupper(s1[1]) ? tolower(s1[1]) : s1[1]) : 0;
+ CHAR s12 = (s1 < e-2) ? (__isascii(s1[2]) && isupper(s1[2]) ? tolower(s1[2]) : s1[2]) : 0;
+
+ if(*s1 == '%' && s1 < e-2
+ && (s1[1] >= '0' && s1[1] <= '9' || s11 >= 'a' && s11 <= 'f')
+ && (s1[2] >= '0' && s1[2] <= '9' || s12 >= 'a' && s12 <= 'f'))
+ {
+ s1[1] = s11;
+ s1[2] = s12;
+ *s2 = 0;
+ if(s1[1] >= '0' && s1[1] <= '9') *s2 |= s1[1]-'0';
+ else if(s1[1] >= 'a' && s1[1] <= 'f') *s2 |= s1[1]-'a'+10;
+ *s2 <<= 4;
+ if(s1[2] >= '0' && s1[2] <= '9') *s2 |= s1[2]-'0';
+ else if(s1[2] >= 'a' && s1[2] <= 'f') *s2 |= s1[2]-'a'+10;
+ s1 += 2;
+ }
+ else
+ {
+ *s2 = *s1 == '+' && !fRaw ? ' ' : *s1;
+ }
+
+ s1++;
+ s2++;
+ }
+
+ str.ReleaseBuffer(s2 - s);
+
+ return str;
+}
+
+CString ExtractTag(CString tag, CMapStringToString& attribs, bool& fClosing)
+{
+ tag.Trim();
+ attribs.RemoveAll();
+
+ fClosing = !tag.IsEmpty() ? tag[0] == '/' : false;
+ tag.TrimLeft('/');
+
+ int i = tag.Find(' ');
+ if(i < 0) i = tag.GetLength();
+ CString type = tag.Left(i).MakeLower();
+ tag = tag.Mid(i).Trim();
+
+ while((i = tag.Find('=')) > 0)
+ {
+ CString attrib = tag.Left(i).Trim().MakeLower();
+ tag = tag.Mid(i+1);
+ for(i = 0; i < tag.GetLength() && _istspace(tag[i]); i++);
+ tag = i < tag.GetLength() ? tag.Mid(i) : _T("");
+ if(!tag.IsEmpty() && tag[0] == '\"') {tag = tag.Mid(1); i = tag.Find('\"');}
+ else i = tag.Find(' ');
+ if(i < 0) i = tag.GetLength();
+ CString param = tag.Left(i).Trim();
+ if(!param.IsEmpty())
+ attribs[attrib] = param;
+ tag = i+1 < tag.GetLength() ? tag.Mid(i+1) : _T("");
+ }
+
+ return(type);
+}
+
+CAtlList<CString>& MakeLower(CAtlList<CString>& sl)
+{
+ POSITION pos = sl.GetHeadPosition();
+ while(pos) sl.GetNext(pos).MakeLower();
+ return sl;
+}
+
+CAtlList<CString>& MakeUpper(CAtlList<CString>& sl)
+{
+ POSITION pos = sl.GetHeadPosition();
+ while(pos) sl.GetNext(pos).MakeUpper();
+ return sl;
+}
+
+CAtlList<CString>& RemoveStrings(CAtlList<CString>& sl, int minlen, int maxlen)
+{
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ POSITION tmp = pos;
+ CString& str = sl.GetNext(pos);
+ int len = str.GetLength();
+ if(len < minlen || len > maxlen) sl.RemoveAt(tmp);
+ }
+ return sl;
+}
diff --git a/src/dsutil/text.h b/src/dsutil/text.h
new file mode 100644
index 000000000..14cd1149a
--- /dev/null
+++ b/src/dsutil/text.h
@@ -0,0 +1,69 @@
+#pragma once
+
+#include <atlcoll.h>
+
+// extern CString ExplodeMin(CString str, CAtlList<CString>& sl, TCHAR sep, int limit = 0);
+// extern CString Explode(CString str, CAtlList<CString>& sl, TCHAR sep, int limit = 0);
+// extern CString Implode(CAtlList<CString>& sl, TCHAR sep);
+
+template<class T, typename SEP>
+T Explode(T str, CAtlList<T>& sl, SEP sep, int limit = 0)
+{
+ sl.RemoveAll();
+
+ for(int i = 0, j = 0; ; i = j+1)
+ {
+ j = str.Find(sep, i);
+
+ if(j < 0 || sl.GetCount() == limit-1)
+ {
+ sl.AddTail(str.Mid(i).Trim());
+ break;
+ }
+ else
+ {
+ sl.AddTail(str.Mid(i, j-i).Trim());
+ }
+ }
+
+ return sl.GetHead();
+}
+
+template<class T, typename SEP>
+T ExplodeMin(T str, CAtlList<T>& sl, SEP sep, int limit = 0)
+{
+ Explode(str, sl, sep, limit);
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ POSITION tmp = pos;
+ if(sl.GetNext(pos).IsEmpty())
+ sl.RemoveAt(tmp);
+ }
+ if(sl.IsEmpty()) sl.AddTail(T()); // eh
+
+ return sl.GetHead();
+}
+
+template<class T, typename SEP>
+T Implode(CAtlList<T>& sl, SEP sep)
+{
+ T ret;
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ ret += sl.GetNext(pos);
+ if(pos) ret += sep;
+ }
+ return(ret);
+}
+
+extern CString ExtractTag(CString tag, CMapStringToString& attribs, bool& fClosing);
+extern CStringA ConvertMBCS(CStringA str, DWORD SrcCharSet, DWORD DstCharSet);
+extern CStringA UrlEncode(CStringA str, bool fRaw = false);
+extern CStringA UrlDecode(CStringA str, bool fRaw = false);
+extern DWORD CharSetToCodePage(DWORD dwCharSet);
+extern CAtlList<CString>& MakeLower(CAtlList<CString>& sl);
+extern CAtlList<CString>& MakeUpper(CAtlList<CString>& sl);
+extern CAtlList<CString>& RemoveStrings(CAtlList<CString>& sl, int minlen, int maxlen);
+
diff --git a/src/dsutil/vd.cpp b/src/dsutil/vd.cpp
new file mode 100644
index 000000000..8c45d7ac2
--- /dev/null
+++ b/src/dsutil/vd.cpp
@@ -0,0 +1,1509 @@
+// VirtualDub - Video processing and capture application
+// Copyright (C) 1998-2001 Avery Lee
+//
+// 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; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// Notes:
+// - BitBltFromI420ToRGB is from VirtualDub
+// - The core assembly function of CCpuID is from DVD2AVI
+// - sse2 yv12 to yuy2 conversion by Haali
+// (- vd.cpp/h should be renamed to something more sensible already :)
+
+
+#include "stdafx.h"
+#include "vd.h"
+
+#pragma warning(disable : 4799) // no emms... blahblahblah
+
+CCpuID::CCpuID()
+{
+ DWORD flags = 0;
+
+ __asm
+ {
+ mov eax, 1
+ cpuid
+ test edx, 0x00800000 // STD MMX
+ jz TEST_SSE
+ or [flags], 1
+TEST_SSE:
+ test edx, 0x02000000 // STD SSE
+ jz TEST_SSE2
+ or [flags], 2
+ or [flags], 4
+TEST_SSE2:
+ test edx, 0x04000000 // SSE2
+ jz TEST_3DNOW
+ or [flags], 8
+TEST_3DNOW:
+ mov eax, 0x80000001
+ cpuid
+ test edx, 0x80000000 // 3D NOW
+ jz TEST_SSEMMX
+ or [flags], 16
+TEST_SSEMMX:
+ test edx, 0x00400000 // SSE MMX
+ jz TEST_END
+ or [flags], 2
+TEST_END:
+ }
+
+ m_flags = (flag_t)flags;
+}
+
+CCpuID g_cpuid;
+
+void memcpy_accel(void* dst, const void* src, size_t len)
+{
+ if((g_cpuid.m_flags & CCpuID::flag_t::ssefpu) && len >= 128
+ && !((DWORD)src&15) && !((DWORD)dst&15))
+ {
+ __asm
+ {
+ mov esi, dword ptr [src]
+ mov edi, dword ptr [dst]
+ mov ecx, len
+ shr ecx, 7
+ memcpy_accel_sse_loop:
+ prefetchnta [esi+16*8]
+ movaps xmm0, [esi]
+ movaps xmm1, [esi+16*1]
+ movaps xmm2, [esi+16*2]
+ movaps xmm3, [esi+16*3]
+ movaps xmm4, [esi+16*4]
+ movaps xmm5, [esi+16*5]
+ movaps xmm6, [esi+16*6]
+ movaps xmm7, [esi+16*7]
+ movntps [edi], xmm0
+ movntps [edi+16*1], xmm1
+ movntps [edi+16*2], xmm2
+ movntps [edi+16*3], xmm3
+ movntps [edi+16*4], xmm4
+ movntps [edi+16*5], xmm5
+ movntps [edi+16*6], xmm6
+ movntps [edi+16*7], xmm7
+ add esi, 128
+ add edi, 128
+ dec ecx
+ jne memcpy_accel_sse_loop
+ mov ecx, len
+ and ecx, 127
+ cmp ecx, 0
+ je memcpy_accel_sse_end
+ memcpy_accel_sse_loop2:
+ mov dl, byte ptr[esi]
+ mov byte ptr[edi], dl
+ inc esi
+ inc edi
+ dec ecx
+ jne memcpy_accel_sse_loop2
+ memcpy_accel_sse_end:
+ emms
+ sfence
+ }
+ }
+ else if((g_cpuid.m_flags & CCpuID::flag_t::mmx) && len >= 64
+ && !((DWORD)src&7) && !((DWORD)dst&7))
+ {
+ __asm
+ {
+ mov esi, dword ptr [src]
+ mov edi, dword ptr [dst]
+ mov ecx, len
+ shr ecx, 6
+ memcpy_accel_mmx_loop:
+ movq mm0, qword ptr [esi]
+ movq mm1, qword ptr [esi+8*1]
+ movq mm2, qword ptr [esi+8*2]
+ movq mm3, qword ptr [esi+8*3]
+ movq mm4, qword ptr [esi+8*4]
+ movq mm5, qword ptr [esi+8*5]
+ movq mm6, qword ptr [esi+8*6]
+ movq mm7, qword ptr [esi+8*7]
+ movq qword ptr [edi], mm0
+ movq qword ptr [edi+8*1], mm1
+ movq qword ptr [edi+8*2], mm2
+ movq qword ptr [edi+8*3], mm3
+ movq qword ptr [edi+8*4], mm4
+ movq qword ptr [edi+8*5], mm5
+ movq qword ptr [edi+8*6], mm6
+ movq qword ptr [edi+8*7], mm7
+ add esi, 64
+ add edi, 64
+ loop memcpy_accel_mmx_loop
+ mov ecx, len
+ and ecx, 63
+ cmp ecx, 0
+ je memcpy_accel_mmx_end
+ memcpy_accel_mmx_loop2:
+ mov dl, byte ptr [esi]
+ mov byte ptr [edi], dl
+ inc esi
+ inc edi
+ dec ecx
+ jne memcpy_accel_mmx_loop2
+ memcpy_accel_mmx_end:
+ emms
+ }
+ }
+ else
+ {
+ memcpy(dst, src, len);
+ }
+}
+
+bool BitBltFromI420ToI420(int w, int h, BYTE* dsty, BYTE* dstu, BYTE* dstv, int dstpitch, BYTE* srcy, BYTE* srcu, BYTE* srcv, int srcpitch)
+{
+ if((w&1)) return(false);
+
+ if(w > 0 && w == srcpitch && w == dstpitch)
+ {
+ memcpy_accel(dsty, srcy, h*srcpitch);
+ memcpy_accel(dstu, srcu, h/2*srcpitch/2);
+ memcpy_accel(dstv, srcv, h/2*srcpitch/2);
+ }
+ else
+ {
+ int pitch = min(abs(srcpitch), abs(dstpitch));
+
+ for(int y = 0; y < h; y++, srcy += srcpitch, dsty += dstpitch)
+ memcpy_accel(dsty, srcy, pitch);
+
+ srcpitch >>= 1;
+ dstpitch >>= 1;
+
+ pitch = min(abs(srcpitch), abs(dstpitch));
+
+ for(int y = 0; y < h; y+=2, srcu += srcpitch, dstu += dstpitch)
+ memcpy_accel(dstu, srcu, pitch);
+
+ for(int y = 0; y < h; y+=2, srcv += srcpitch, dstv += dstpitch)
+ memcpy_accel(dstv, srcv, pitch);
+ }
+
+ return true;
+}
+
+bool BitBltFromYUY2ToYUY2(int w, int h, BYTE* dst, int dstpitch, BYTE* src, int srcpitch)
+{
+ if(w > 0 && w == srcpitch && w == dstpitch)
+ {
+ memcpy_accel(dst, src, h*srcpitch);
+ }
+ else
+ {
+ int pitch = min(abs(srcpitch), abs(dstpitch));
+
+ for(int y = 0; y < h; y++, src += srcpitch, dst += dstpitch)
+ memcpy_accel(dst, src, pitch);
+ }
+
+ return(true);
+}
+
+extern "C" void asm_YUVtoRGB32_row(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width);
+extern "C" void asm_YUVtoRGB24_row(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width);
+extern "C" void asm_YUVtoRGB16_row(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width);
+extern "C" void asm_YUVtoRGB32_row_MMX(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width);
+extern "C" void asm_YUVtoRGB24_row_MMX(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width);
+extern "C" void asm_YUVtoRGB16_row_MMX(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width);
+extern "C" void asm_YUVtoRGB32_row_ISSE(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width);
+extern "C" void asm_YUVtoRGB24_row_ISSE(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width);
+extern "C" void asm_YUVtoRGB16_row_ISSE(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width);
+
+bool BitBltFromI420ToRGB(int w, int h, BYTE* dst, int dstpitch, int dbpp, BYTE* srcy, BYTE* srcu, BYTE* srcv, int srcpitch)
+{
+ if(w<=0 || h<=0 || (w&1) || (h&1))
+ return(false);
+
+ void (*asm_YUVtoRGB_row)(void* ARGB1, void* ARGB2, BYTE* Y1, BYTE* Y2, BYTE* U, BYTE* V, long width) = NULL;;
+
+ if((g_cpuid.m_flags & CCpuID::ssefpu) && !(w&7))
+ {
+ switch(dbpp)
+ {
+ case 16: asm_YUVtoRGB_row = asm_YUVtoRGB16_row/*_ISSE*/; break; // TODO: fix _ISSE (555->565)
+ case 24: asm_YUVtoRGB_row = asm_YUVtoRGB24_row_ISSE; break;
+ case 32: asm_YUVtoRGB_row = asm_YUVtoRGB32_row_ISSE; break;
+ }
+ }
+ else if((g_cpuid.m_flags & CCpuID::mmx) && !(w&7))
+ {
+ switch(dbpp)
+ {
+ case 16: asm_YUVtoRGB_row = asm_YUVtoRGB16_row/*_MMX*/; break; // TODO: fix _MMX (555->565)
+ case 24: asm_YUVtoRGB_row = asm_YUVtoRGB24_row_MMX; break;
+ case 32: asm_YUVtoRGB_row = asm_YUVtoRGB32_row_MMX; break;
+ }
+ }
+ else
+ {
+ switch(dbpp)
+ {
+ case 16: asm_YUVtoRGB_row = asm_YUVtoRGB16_row; break;
+ case 24: asm_YUVtoRGB_row = asm_YUVtoRGB24_row; break;
+ case 32: asm_YUVtoRGB_row = asm_YUVtoRGB32_row; break;
+ }
+ }
+
+ if(!asm_YUVtoRGB_row)
+ return(false);
+
+ do
+ {
+ asm_YUVtoRGB_row(dst + dstpitch, dst, srcy + srcpitch, srcy, srcu, srcv, w/2);
+
+ dst += 2*dstpitch;
+ srcy += srcpitch*2;
+ srcu += srcpitch/2;
+ srcv += srcpitch/2;
+ }
+ while(h -= 2);
+
+ if(g_cpuid.m_flags & CCpuID::mmx)
+ __asm emms
+
+ if(g_cpuid.m_flags & CCpuID::ssefpu)
+ __asm sfence
+
+ return true;
+}
+
+static void yuvtoyuy2row_c(BYTE* dst, BYTE* srcy, BYTE* srcu, BYTE* srcv, DWORD width)
+{
+ WORD* dstw = (WORD*)dst;
+ for(; width > 1; width -= 2)
+ {
+ *dstw++ = (*srcu++<<8)|*srcy++;
+ *dstw++ = (*srcv++<<8)|*srcy++;
+ }
+}
+
+static void __declspec(naked) yuvtoyuy2row_MMX(BYTE* dst, BYTE* srcy, BYTE* srcu, BYTE* srcv, DWORD width)
+{
+ __asm {
+ push ebp
+ push edi
+ push esi
+ push ebx
+
+ mov edi, [esp+20] // dst
+ mov ebp, [esp+24] // srcy
+ mov ebx, [esp+28] // srcu
+ mov esi, [esp+32] // srcv
+ mov ecx, [esp+36] // width
+
+ shr ecx, 3
+
+yuvtoyuy2row_loop:
+
+ movd mm0, [ebx]
+ punpcklbw mm0, [esi]
+
+ movq mm1, [ebp]
+ movq mm2, mm1
+ punpcklbw mm1, mm0
+ punpckhbw mm2, mm0
+
+ movq [edi], mm1
+ movq [edi+8], mm2
+
+ add ebp, 8
+ add ebx, 4
+ add esi, 4
+ add edi, 16
+
+ dec ecx
+ jnz yuvtoyuy2row_loop
+
+ pop ebx
+ pop esi
+ pop edi
+ pop ebp
+ ret
+ };
+}
+
+static void yuvtoyuy2row_avg_c(BYTE* dst, BYTE* srcy, BYTE* srcu, BYTE* srcv, DWORD width, DWORD pitchuv)
+{
+ WORD* dstw = (WORD*)dst;
+ for(; width > 1; width -= 2, srcu++, srcv++)
+ {
+ *dstw++ = (((srcu[0]+srcu[pitchuv])>>1)<<8)|*srcy++;
+ *dstw++ = (((srcv[0]+srcv[pitchuv])>>1)<<8)|*srcy++;
+ }
+}
+
+static void __declspec(naked) yuvtoyuy2row_avg_MMX(BYTE* dst, BYTE* srcy, BYTE* srcu, BYTE* srcv, DWORD width, DWORD pitchuv)
+{
+ static const __int64 mask = 0x7f7f7f7f7f7f7f7fi64;
+
+ __asm {
+ push ebp
+ push edi
+ push esi
+ push ebx
+
+ movq mm7, mask
+
+ mov edi, [esp+20] // dst
+ mov ebp, [esp+24] // srcy
+ mov ebx, [esp+28] // srcu
+ mov esi, [esp+32] // srcv
+ mov ecx, [esp+36] // width
+ mov eax, [esp+40] // pitchuv
+
+ shr ecx, 3
+
+yuvtoyuy2row_avg_loop:
+
+ movd mm0, [ebx]
+ punpcklbw mm0, [esi]
+ movq mm1, mm0
+
+ movd mm2, [ebx + eax]
+ punpcklbw mm2, [esi + eax]
+ movq mm3, mm2
+
+ // (x+y)>>1 == (x&y)+((x^y)>>1)
+
+ pand mm0, mm2
+ pxor mm1, mm3
+ psrlq mm1, 1
+ pand mm1, mm7
+ paddb mm0, mm1
+
+ movq mm1, [ebp]
+ movq mm2, mm1
+ punpcklbw mm1, mm0
+ punpckhbw mm2, mm0
+
+ movq [edi], mm1
+ movq [edi+8], mm2
+
+ add ebp, 8
+ add ebx, 4
+ add esi, 4
+ add edi, 16
+
+ dec ecx
+ jnz yuvtoyuy2row_avg_loop
+
+ pop ebx
+ pop esi
+ pop edi
+ pop ebp
+ ret
+ };
+}
+
+static void __declspec(naked) yv12_yuy2_row_sse2() {
+ __asm {
+ // ebx - Y
+ // edx - U
+ // esi - V
+ // edi - dest
+ // ecx - halfwidth
+ xor eax, eax
+
+one:
+ movdqa xmm0, [ebx + eax*2] // YYYYYYYY
+ movdqa xmm1, [ebx + eax*2 + 16] // YYYYYYYY
+
+ movdqa xmm2, [edx + eax] // UUUUUUUU
+ movdqa xmm3, [esi + eax] // VVVVVVVV
+
+ movdqa xmm4, xmm2
+ movdqa xmm5, xmm0
+ movdqa xmm6, xmm1
+ punpcklbw xmm2, xmm3 // VUVUVUVU
+ punpckhbw xmm4, xmm3 // VUVUVUVU
+
+ punpcklbw xmm0, xmm2 // VYUYVYUY
+ punpcklbw xmm1, xmm4
+ punpckhbw xmm5, xmm2
+ punpckhbw xmm6, xmm4
+
+ movntdq [edi + eax*4], xmm0
+ movntdq [edi + eax*4 + 16], xmm5
+ movntdq [edi + eax*4 + 32], xmm1
+ movntdq [edi + eax*4 + 48], xmm6
+
+ add eax, 16
+ cmp eax, ecx
+
+ jb one
+
+ ret
+ };
+}
+
+static void __declspec(naked) yv12_yuy2_row_sse2_linear() {
+ __asm {
+ // ebx - Y
+ // edx - U
+ // esi - V
+ // edi - dest
+ // ecx - width
+ // ebp - uv_stride
+ xor eax, eax
+
+one:
+ movdqa xmm0, [ebx + eax*2] // YYYYYYYY
+ movdqa xmm1, [ebx + eax*2 + 16] // YYYYYYYY
+
+ movdqa xmm2, [edx]
+ movdqa xmm3, [esi]
+ pavgb xmm2, [edx + ebp] // UUUUUUUU
+ pavgb xmm3, [esi + ebp] // VVVVVVVV
+
+ movdqa xmm4, xmm2
+ movdqa xmm5, xmm0
+ movdqa xmm6, xmm1
+ punpcklbw xmm2, xmm3 // VUVUVUVU
+ punpckhbw xmm4, xmm3 // VUVUVUVU
+
+ punpcklbw xmm0, xmm2 // VYUYVYUY
+ punpcklbw xmm1, xmm4
+ punpckhbw xmm5, xmm2
+ punpckhbw xmm6, xmm4
+
+ movntdq [edi + eax*4], xmm0
+ movntdq [edi + eax*4 + 16], xmm5
+ movntdq [edi + eax*4 + 32], xmm1
+ movntdq [edi + eax*4 + 48], xmm6
+
+ add eax, 16
+ add edx, 16
+ add esi, 16
+ cmp eax, ecx
+
+ jb one
+
+ ret
+ };
+}
+
+static void __declspec(naked) yv12_yuy2_row_sse2_linear_interlaced() {
+ __asm {
+ // ebx - Y
+ // edx - U
+ // esi - V
+ // edi - dest
+ // ecx - width
+ // ebp - uv_stride
+ xor eax, eax
+
+one:
+ movdqa xmm0, [ebx + eax*2] // YYYYYYYY
+ movdqa xmm1, [ebx + eax*2 + 16] // YYYYYYYY
+
+ movdqa xmm2, [edx]
+ movdqa xmm3, [esi]
+ pavgb xmm2, [edx + ebp*2] // UUUUUUUU
+ pavgb xmm3, [esi + ebp*2] // VVVVVVVV
+
+ movdqa xmm4, xmm2
+ movdqa xmm5, xmm0
+ movdqa xmm6, xmm1
+ punpcklbw xmm2, xmm3 // VUVUVUVU
+ punpckhbw xmm4, xmm3 // VUVUVUVU
+
+ punpcklbw xmm0, xmm2 // VYUYVYUY
+ punpcklbw xmm1, xmm4
+ punpckhbw xmm5, xmm2
+ punpckhbw xmm6, xmm4
+
+ movntdq [edi + eax*4], xmm0
+ movntdq [edi + eax*4 + 16], xmm5
+ movntdq [edi + eax*4 + 32], xmm1
+ movntdq [edi + eax*4 + 48], xmm6
+
+ add eax, 16
+ add edx, 16
+ add esi, 16
+ cmp eax, ecx
+
+ jb one
+
+ ret
+ };
+}
+
+void __declspec(naked) yv12_yuy2_sse2(const BYTE *Y, const BYTE *U, const BYTE *V,
+ int halfstride, unsigned halfwidth, unsigned height,
+ BYTE *YUY2, int d_stride)
+{
+ __asm {
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov ebx, [esp + 20] // Y
+ mov edx, [esp + 24] // U
+ mov esi, [esp + 28] // V
+ mov edi, [esp + 44] // D
+ mov ebp, [esp + 32] // uv_stride
+ mov ecx, [esp + 36] // uv_width
+
+ mov eax, ecx
+ add eax, 15
+ and eax, 0xfffffff0
+ sub [esp + 32], eax
+
+ cmp dword ptr [esp + 40], 2
+ jbe last2
+
+row:
+ sub dword ptr [esp + 40], 2
+ call yv12_yuy2_row_sse2
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+
+ call yv12_yuy2_row_sse2_linear
+
+ add edx, [esp + 32]
+ add esi, [esp + 32]
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+
+ cmp dword ptr [esp + 40], 2
+ ja row
+
+last2:
+ call yv12_yuy2_row_sse2
+
+ dec dword ptr [esp + 40]
+ jz done
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+ call yv12_yuy2_row_sse2
+done:
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+
+ ret
+ };
+}
+
+void __declspec(naked) yv12_yuy2_sse2_interlaced(const BYTE *Y, const BYTE *U, const BYTE *V,
+ int halfstride, unsigned halfwidth, unsigned height,
+ BYTE *YUY2, int d_stride)
+{
+ __asm {
+ push ebx
+ push esi
+ push edi
+ push ebp
+
+ mov ebx, [esp + 20] // Y
+ mov edx, [esp + 24] // U
+ mov esi, [esp + 28] // V
+ mov edi, [esp + 44] // D
+ mov ebp, [esp + 32] // uv_stride
+ mov ecx, [esp + 36] // uv_width
+
+ mov eax, ecx
+ add eax, 15
+ and eax, 0xfffffff0
+ sub [esp + 32], eax
+
+ cmp dword ptr [esp + 40], 4
+ jbe last4
+
+row:
+ sub dword ptr [esp + 40], 4
+ call yv12_yuy2_row_sse2 // first row, first field
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+
+ add edx, ebp
+ add esi, ebp
+
+ call yv12_yuy2_row_sse2 // first row, second field
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+
+ sub edx, ebp
+ sub esi, ebp
+
+ call yv12_yuy2_row_sse2_linear_interlaced // second row, first field
+
+ add edx, [esp + 32]
+ add esi, [esp + 32]
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+
+ call yv12_yuy2_row_sse2_linear_interlaced // second row, second field
+
+ add edx, [esp + 32]
+ add esi, [esp + 32]
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+
+ cmp dword ptr [esp + 40], 4
+ ja row
+
+last4:
+ call yv12_yuy2_row_sse2
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+
+ add edx, ebp
+ add esi, ebp
+
+ call yv12_yuy2_row_sse2
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+
+ sub edx, ebp
+ sub esi, ebp
+
+ call yv12_yuy2_row_sse2
+
+ lea ebx, [ebx + ebp*2]
+ add edi, [esp + 48]
+
+ add edx, ebp
+ add esi, ebp
+
+ call yv12_yuy2_row_sse2
+
+ pop ebp
+ pop edi
+ pop esi
+ pop ebx
+
+ ret
+ };
+}
+
+bool BitBltFromI420ToYUY2(int w, int h, BYTE* dst, int dstpitch, BYTE* srcy, BYTE* srcu, BYTE* srcv, int srcpitch, bool fInterlaced)
+{
+ if(w<=0 || h<=0 || (w&1) || (h&1))
+ return(false);
+
+ if(srcpitch == 0) srcpitch = w;
+
+ if((g_cpuid.m_flags & CCpuID::sse2)
+ && ((DWORD_PTR)srcy&15) && ((DWORD_PTR)srcu&15) && ((DWORD_PTR)srcv&15) && !(srcpitch&15)
+ && ((DWORD_PTR)dst&15) && !(dstpitch&15))
+ {
+ if(!fInterlaced) yv12_yuy2_sse2(srcy, srcu, srcv, srcpitch/2, w/2, h, dst, dstpitch);
+ else yv12_yuy2_sse2_interlaced(srcy, srcu, srcv, srcpitch/2, w/2, h, dst, dstpitch);
+ return true;
+ }
+ else
+ {
+ ASSERT(!fInterlaced);
+ }
+
+ void (*yuvtoyuy2row)(BYTE* dst, BYTE* srcy, BYTE* srcu, BYTE* srcv, DWORD width) = NULL;
+ void (*yuvtoyuy2row_avg)(BYTE* dst, BYTE* srcy, BYTE* srcu, BYTE* srcv, DWORD width, DWORD pitchuv) = NULL;
+
+ if((g_cpuid.m_flags & CCpuID::mmx) && !(w&7))
+ {
+ yuvtoyuy2row = yuvtoyuy2row_MMX;
+ yuvtoyuy2row_avg = yuvtoyuy2row_avg_MMX;
+ }
+ else
+ {
+ yuvtoyuy2row = yuvtoyuy2row_c;
+ yuvtoyuy2row_avg = yuvtoyuy2row_avg_c;
+ }
+
+ if(!yuvtoyuy2row)
+ return(false);
+
+ do
+ {
+ yuvtoyuy2row(dst, srcy, srcu, srcv, w);
+ yuvtoyuy2row_avg(dst + dstpitch, srcy + srcpitch, srcu, srcv, w, srcpitch/2);
+
+ dst += 2*dstpitch;
+ srcy += srcpitch*2;
+ srcu += srcpitch/2;
+ srcv += srcpitch/2;
+ }
+ while((h -= 2) > 2);
+
+ yuvtoyuy2row(dst, srcy, srcu, srcv, w);
+ yuvtoyuy2row(dst + dstpitch, srcy + srcpitch, srcu, srcv, w);
+
+ if(g_cpuid.m_flags & CCpuID::mmx)
+ __asm emms
+
+ return(true);
+}
+
+bool BitBltFromRGBToRGB(int w, int h, BYTE* dst, int dstpitch, int dbpp, BYTE* src, int srcpitch, int sbpp)
+{
+ if(dbpp == sbpp)
+ {
+ int rowbytes = w*dbpp>>3;
+
+ if(rowbytes > 0 && rowbytes == srcpitch && rowbytes == dstpitch)
+ {
+ memcpy_accel(dst, src, h*rowbytes);
+ }
+ else
+ {
+ for(int y = 0; y < h; y++, src += srcpitch, dst += dstpitch)
+ memcpy_accel(dst, src, rowbytes);
+ }
+
+ return(true);
+ }
+
+ if(sbpp != 16 && sbpp != 24 && sbpp != 32
+ || dbpp != 16 && dbpp != 24 && dbpp != 32)
+ return(false);
+
+ if(dbpp == 16)
+ {
+ for(int y = 0; y < h; y++, src += srcpitch, dst += dstpitch)
+ {
+ if(sbpp == 24)
+ {
+ BYTE* s = (BYTE*)src;
+ WORD* d = (WORD*)dst;
+ for(int x = 0; x < w; x++, s+=3, d++)
+ *d = (WORD)(((*((DWORD*)s)>>8)&0xf800)|((*((DWORD*)s)>>5)&0x07e0)|((*((DWORD*)s)>>3)&0x1f));
+ }
+ else if(sbpp == 32)
+ {
+ DWORD* s = (DWORD*)src;
+ WORD* d = (WORD*)dst;
+ for(int x = 0; x < w; x++, s++, d++)
+ *d = (WORD)(((*s>>8)&0xf800)|((*s>>5)&0x07e0)|((*s>>3)&0x1f));
+ }
+ }
+ }
+ else if(dbpp == 24)
+ {
+ for(int y = 0; y < h; y++, src += srcpitch, dst += dstpitch)
+ {
+ if(sbpp == 16)
+ {
+ WORD* s = (WORD*)src;
+ BYTE* d = (BYTE*)dst;
+ for(int x = 0; x < w; x++, s++, d+=3)
+ { // not tested, r-g-b might be in reverse
+ d[0] = (*s&0x001f)<<3;
+ d[1] = (*s&0x07e0)<<5;
+ d[2] = (*s&0xf800)<<8;
+ }
+ }
+ else if(sbpp == 32)
+ {
+ BYTE* s = (BYTE*)src;
+ BYTE* d = (BYTE*)dst;
+ for(int x = 0; x < w; x++, s+=4, d+=3)
+ {d[0] = s[0]; d[1] = s[1]; d[2] = s[2];}
+ }
+ }
+ }
+ else if(dbpp == 32)
+ {
+ for(int y = 0; y < h; y++, src += srcpitch, dst += dstpitch)
+ {
+ if(sbpp == 16)
+ {
+ WORD* s = (WORD*)src;
+ DWORD* d = (DWORD*)dst;
+ for(int x = 0; x < w; x++, s++, d++)
+ *d = ((*s&0xf800)<<8)|((*s&0x07e0)<<5)|((*s&0x001f)<<3);
+ }
+ else if(sbpp == 24)
+ {
+ BYTE* s = (BYTE*)src;
+ DWORD* d = (DWORD*)dst;
+ for(int x = 0; x < w; x++, s+=3, d++)
+ *d = *((DWORD*)s)&0xffffff;
+ }
+ }
+ }
+
+ return(true);
+}
+
+static void asm_blend_row_clipped_c(BYTE* dst, BYTE* src, DWORD w, DWORD srcpitch)
+{
+ BYTE* src2 = src + srcpitch;
+ do {*dst++ = (*src++ + *src2++ + 1) >> 1;}
+ while(w--);
+}
+
+static void asm_blend_row_c(BYTE* dst, BYTE* src, DWORD w, DWORD srcpitch)
+{
+ BYTE* src2 = src + srcpitch;
+ BYTE* src3 = src2 + srcpitch;
+ do {*dst++ = (*src++ + (*src2++ << 1) + *src3++ + 2) >> 2;}
+ while(w--);
+}
+
+static void __declspec(naked) asm_blend_row_clipped_MMX(BYTE* dst, BYTE* src, DWORD w, DWORD srcpitch)
+{
+ static const __int64 _x0001000100010001 = 0x0001000100010001;
+
+ __asm {
+ push ebp
+ push edi
+ push esi
+ push ebx
+
+ mov edi,[esp+20]
+ mov esi,[esp+24]
+ sub edi,esi
+ mov ebp,[esp+28]
+ mov edx,[esp+32]
+
+ shr ebp, 3
+
+ movq mm6, _x0001000100010001
+ pxor mm7, mm7
+
+xloop:
+ movq mm0, [esi]
+ movq mm3, mm0
+ punpcklbw mm0, mm7
+ punpckhbw mm3, mm7
+
+ movq mm1, [esi+edx]
+ movq mm4, mm1
+ punpcklbw mm1, mm7
+ punpckhbw mm4, mm7
+
+ paddw mm1, mm0
+ paddw mm1, mm6
+ psrlw mm1, 1
+
+ paddw mm4, mm3
+ paddw mm4, mm6
+ psrlw mm4, 1
+
+ add esi, 8
+ packuswb mm1, mm4
+ movq [edi+esi-8], mm1
+
+ dec ebp
+ jne xloop
+
+ pop ebx
+ pop esi
+ pop edi
+ pop ebp
+ ret
+ };
+}
+
+static void __declspec(naked) asm_blend_row_MMX(BYTE* dst, BYTE* src, DWORD w, DWORD srcpitch)
+{
+ static const __int64 mask0 = 0xfcfcfcfcfcfcfcfci64;
+ static const __int64 mask1 = 0x7f7f7f7f7f7f7f7fi64;
+ static const __int64 mask2 = 0x3f3f3f3f3f3f3f3fi64;
+ static const __int64 _x0002000200020002 = 0x0002000200020002;
+
+ __asm {
+ push ebp
+ push edi
+ push esi
+ push ebx
+
+ mov edi, [esp+20]
+ mov esi, [esp+24]
+ sub edi, esi
+ mov ebp, [esp+28]
+ mov edx, [esp+32]
+
+ shr ebp, 3
+
+ movq mm6, _x0002000200020002
+ pxor mm7, mm7
+
+xloop:
+ movq mm0, [esi]
+ movq mm3, mm0
+ punpcklbw mm0, mm7
+ punpckhbw mm3, mm7
+
+ movq mm1, [esi+edx]
+ movq mm4, mm1
+ punpcklbw mm1, mm7
+ punpckhbw mm4, mm7
+
+ movq mm2, [esi+edx*2]
+ movq mm5, mm2
+ punpcklbw mm2, mm7
+ punpckhbw mm5, mm7
+
+ psllw mm1, 1
+ paddw mm1, mm0
+ paddw mm1, mm2
+ paddw mm1, mm6
+ psrlw mm1, 2
+
+ psllw mm4, 1
+ paddw mm4, mm3
+ paddw mm4, mm5
+ paddw mm4, mm6
+ psrlw mm4, 2
+
+ add esi, 8
+ packuswb mm1, mm4
+ movq [edi+esi-8], mm1
+
+ dec ebp
+ jne xloop
+
+ // sadly the original code makes a lot of visible banding artifacts on yuv
+ // (it seems those shiftings without rounding introduce too much error)
+/*
+ mov edi,[esp+20]
+ mov esi,[esp+24]
+ sub edi,esi
+ mov ebp,[esp+28]
+ mov edx,[esp+32]
+
+ movq mm5,mask0
+ movq mm6,mask1
+ movq mm7,mask2
+ shr ebp,1
+ jz oddpart
+
+xloop:
+ movq mm2,[esi]
+ movq mm0,mm5
+
+ movq mm1,[esi+edx]
+ pand mm0,mm2
+
+ psrlq mm1,1
+ movq mm2,[esi+edx*2]
+
+ psrlq mm2,2
+ pand mm1,mm6
+
+ psrlq mm0,2
+ pand mm2,mm7
+
+ paddb mm0,mm1
+ add esi,8
+
+ paddb mm0,mm2
+ dec ebp
+
+ movq [edi+esi-8],mm0
+ jne xloop
+
+oddpart:
+ test byte ptr [esp+28],1
+ jz nooddpart
+
+ mov ecx,[esi]
+ mov eax,0fcfcfcfch
+ mov ebx,[esi+edx]
+ and eax,ecx
+ shr ebx,1
+ mov ecx,[esi+edx*2]
+ shr ecx,2
+ and ebx,07f7f7f7fh
+ shr eax,2
+ and ecx,03f3f3f3fh
+ add eax,ebx
+ add eax,ecx
+ mov [edi+esi],eax
+
+nooddpart:
+*/
+ pop ebx
+ pop esi
+ pop edi
+ pop ebp
+ ret
+ };
+}
+
+__declspec(align(16)) static BYTE const_1_16_bytes[] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
+
+static void asm_blend_row_SSE2(BYTE* dst, BYTE* src, DWORD w, DWORD srcpitch)
+{
+ __asm
+ {
+ mov edx, srcpitch
+ mov esi, src
+ mov edi, dst
+ sub edi, esi
+ mov ecx, w
+ mov ebx, ecx
+ shr ecx, 4
+ and ebx, 15
+
+ movdqa xmm7, [const_1_16_bytes]
+
+asm_blend_row_SSE2_loop:
+ movdqa xmm0, [esi]
+ movdqa xmm1, [esi+edx]
+ movdqa xmm2, [esi+edx*2]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm1
+ psubusb xmm0, xmm7
+ pavgb xmm0, xmm2
+ movdqa [esi+edi], xmm0
+ add esi, 16
+ dec ecx
+ jnz asm_blend_row_SSE2_loop
+
+ test ebx,15
+ jz asm_blend_row_SSE2_end
+
+ mov ecx, ebx
+ xor ax, ax
+ xor bx, bx
+ xor dx, dx
+asm_blend_row_SSE2_loop2:
+ mov al, [esi]
+ mov bl, [esi+edx]
+ mov dl, [esi+edx*2]
+ add ax, bx
+ inc ax
+ shr ax, 1
+ add dx, bx
+ inc dx
+ shr dx, 1
+ add ax, dx
+ shr ax, 1
+ mov [esi+edi], al
+ inc esi
+ dec ecx
+ jnz asm_blend_row_SSE2_loop2
+
+asm_blend_row_SSE2_end:
+ }
+}
+
+static void asm_blend_row_clipped_SSE2(BYTE* dst, BYTE* src, DWORD w, DWORD srcpitch)
+{
+ __asm
+ {
+ mov edx, srcpitch
+ mov esi, src
+ mov edi, dst
+ sub edi, esi
+ mov ecx, w
+ mov ebx, ecx
+ shr ecx, 4
+ and ebx, 15
+
+ movdqa xmm7, [const_1_16_bytes]
+
+asm_blend_row_clipped_SSE2_loop:
+ movdqa xmm0, [esi]
+ movdqa xmm1, [esi+edx]
+ pavgb xmm0, xmm1
+ movdqa [esi+edi], xmm0
+ add esi, 16
+ dec ecx
+ jnz asm_blend_row_clipped_SSE2_loop
+
+ test ebx,15
+ jz asm_blend_row_clipped_SSE2_end
+
+ mov ecx, ebx
+ xor ax, ax
+ xor bx, bx
+asm_blend_row_clipped_SSE2_loop2:
+ mov al, [esi]
+ mov bl, [esi+edx]
+ add ax, bx
+ inc ax
+ shr ax, 1
+ mov [esi+edi], al
+ inc esi
+ dec ecx
+ jnz asm_blend_row_clipped_SSE2_loop2
+
+asm_blend_row_clipped_SSE2_end:
+ }
+}
+
+void DeinterlaceBlend(BYTE* dst, BYTE* src, DWORD rowbytes, DWORD h, DWORD dstpitch, DWORD srcpitch)
+{
+ void (*asm_blend_row_clipped)(BYTE* dst, BYTE* src, DWORD w, DWORD srcpitch) = NULL;
+ void (*asm_blend_row)(BYTE* dst, BYTE* src, DWORD w, DWORD srcpitch) = NULL;
+
+ if((g_cpuid.m_flags & CCpuID::sse2) && !((DWORD)src&0xf) && !((DWORD)dst&0xf) && !(srcpitch&0xf))
+ {
+ asm_blend_row_clipped = asm_blend_row_clipped_SSE2;
+ asm_blend_row = asm_blend_row_SSE2;
+ }
+ else if(g_cpuid.m_flags & CCpuID::mmx)
+ {
+ asm_blend_row_clipped = asm_blend_row_clipped_MMX;
+ asm_blend_row = asm_blend_row_MMX;
+ }
+ else
+ {
+ asm_blend_row_clipped = asm_blend_row_clipped_c;
+ asm_blend_row = asm_blend_row_c;
+ }
+
+ if(!asm_blend_row_clipped)
+ return;
+
+ asm_blend_row_clipped(dst, src, rowbytes, srcpitch);
+
+ if((h -= 2) > 0) do
+ {
+ dst += dstpitch;
+ asm_blend_row(dst, src, rowbytes, srcpitch);
+ src += srcpitch;
+ }
+ while(--h);
+
+ asm_blend_row_clipped(dst + dstpitch, src, rowbytes, srcpitch);
+
+ if(g_cpuid.m_flags & CCpuID::mmx)
+ __asm emms
+}
+
+void DeinterlaceBob(BYTE* dst, BYTE* src, DWORD rowbytes, DWORD h, DWORD dstpitch, DWORD srcpitch, bool topfield)
+{
+ if(topfield)
+ {
+ BitBltFromRGBToRGB(rowbytes, h/2, dst, dstpitch*2, 8, src, srcpitch*2, 8);
+ AvgLines8(dst, h, dstpitch);
+ }
+ else
+ {
+ BitBltFromRGBToRGB(rowbytes, h/2, dst + dstpitch, dstpitch*2, 8, src + srcpitch, srcpitch*2, 8);
+ AvgLines8(dst + dstpitch, h-1, dstpitch);
+ }
+}
+
+void AvgLines8(BYTE* dst, DWORD h, DWORD pitch)
+{
+ if(h <= 1) return;
+
+ BYTE* s = dst;
+ BYTE* d = dst + (h-2)*pitch;
+
+ for(; s < d; s += pitch*2)
+ {
+ BYTE* tmp = s;
+
+ if((g_cpuid.m_flags & CCpuID::sse2) && !((DWORD)tmp&0xf) && !((DWORD)pitch&0xf))
+ {
+ __asm
+ {
+ mov esi, tmp
+ mov ebx, pitch
+
+ mov ecx, ebx
+ shr ecx, 4
+
+AvgLines8_sse2_loop:
+ movdqa xmm0, [esi]
+ pavgb xmm0, [esi+ebx*2]
+ movdqa [esi+ebx], xmm0
+ add esi, 16
+
+ dec ecx
+ jnz AvgLines8_sse2_loop
+
+ mov tmp, esi
+ }
+
+ for(int i = pitch&7; i--; tmp++)
+ {
+ tmp[pitch] = (tmp[0] + tmp[pitch<<1] + 1) >> 1;
+ }
+ }
+ else if(g_cpuid.m_flags & CCpuID::mmx)
+ {
+ __asm
+ {
+ mov esi, tmp
+ mov ebx, pitch
+
+ mov ecx, ebx
+ shr ecx, 3
+
+ pxor mm7, mm7
+AvgLines8_mmx_loop:
+ movq mm0, [esi]
+ movq mm1, mm0
+
+ punpcklbw mm0, mm7
+ punpckhbw mm1, mm7
+
+ movq mm2, [esi+ebx*2]
+ movq mm3, mm2
+
+ punpcklbw mm2, mm7
+ punpckhbw mm3, mm7
+
+ paddw mm0, mm2
+ psrlw mm0, 1
+
+ paddw mm1, mm3
+ psrlw mm1, 1
+
+ packuswb mm0, mm1
+
+ movq [esi+ebx], mm0
+
+ lea esi, [esi+8]
+
+ dec ecx
+ jnz AvgLines8_mmx_loop
+
+ mov tmp, esi
+ }
+
+ for(int i = pitch&7; i--; tmp++)
+ {
+ tmp[pitch] = (tmp[0] + tmp[pitch<<1] + 1) >> 1;
+ }
+ }
+ else
+ {
+ for(int i = pitch; i--; tmp++)
+ {
+ tmp[pitch] = (tmp[0] + tmp[pitch<<1] + 1) >> 1;
+ }
+ }
+ }
+
+ if(!(h&1) && h >= 2)
+ {
+ dst += (h-2)*pitch;
+ memcpy_accel(dst + pitch, dst, pitch);
+ }
+
+ __asm emms;
+}
+
+void AvgLines555(BYTE* dst, DWORD h, DWORD pitch)
+{
+ if(h <= 1) return;
+
+ unsigned __int64 __0x7c007c007c007c00 = 0x7c007c007c007c00;
+ unsigned __int64 __0x03e003e003e003e0 = 0x03e003e003e003e0;
+ unsigned __int64 __0x001f001f001f001f = 0x001f001f001f001f;
+
+ BYTE* s = dst;
+ BYTE* d = dst + (h-2)*pitch;
+
+ for(; s < d; s += pitch*2)
+ {
+ BYTE* tmp = s;
+
+ __asm
+ {
+ mov esi, tmp
+ mov ebx, pitch
+
+ mov ecx, ebx
+ shr ecx, 3
+
+ movq mm6, __0x03e003e003e003e0
+ movq mm7, __0x001f001f001f001f
+
+AvgLines555_loop:
+ movq mm0, [esi]
+ movq mm1, mm0
+ movq mm2, mm0
+
+ psrlw mm0, 10 // red1 bits: mm0 = 001f001f001f001f
+ pand mm1, mm6 // green1 bits: mm1 = 03e003e003e003e0
+ pand mm2, mm7 // blue1 bits: mm2 = 001f001f001f001f
+
+ movq mm3, [esi+ebx*2]
+ movq mm4, mm3
+ movq mm5, mm3
+
+ psrlw mm3, 10 // red2 bits: mm3 = 001f001f001f001f
+ pand mm4, mm6 // green2 bits: mm4 = 03e003e003e003e0
+ pand mm5, mm7 // blue2 bits: mm5 = 001f001f001f001f
+
+ paddw mm0, mm3
+ psrlw mm0, 1 // (red1+red2)/2
+ psllw mm0, 10 // red bits at 7c007c007c007c00
+
+ paddw mm1, mm4
+ psrlw mm1, 1 // (green1+green2)/2
+ pand mm1, mm6 // green bits at 03e003e003e003e0
+
+ paddw mm2, mm5
+ psrlw mm2, 1 // (blue1+blue2)/2
+ // blue bits at 001f001f001f001f (no need to pand, lower bits were discareded)
+
+ por mm0, mm1
+ por mm0, mm2
+
+ movq [esi+ebx], mm0
+
+ lea esi, [esi+8]
+
+ dec ecx
+ jnz AvgLines555_loop
+
+ mov tmp, esi
+ }
+
+ for(int i = (pitch&7)>>1; i--; tmp++)
+ {
+ tmp[pitch] =
+ ((((*tmp&0x7c00) + (tmp[pitch<<1]&0x7c00)) >> 1)&0x7c00)|
+ ((((*tmp&0x03e0) + (tmp[pitch<<1]&0x03e0)) >> 1)&0x03e0)|
+ ((((*tmp&0x001f) + (tmp[pitch<<1]&0x001f)) >> 1)&0x001f);
+ }
+ }
+
+ if(!(h&1) && h >= 2)
+ {
+ dst += (h-2)*pitch;
+ memcpy_accel(dst + pitch, dst, pitch);
+ }
+
+ __asm emms;
+}
+
+void AvgLines565(BYTE* dst, DWORD h, DWORD pitch)
+{
+ if(h <= 1) return;
+
+ unsigned __int64 __0xf800f800f800f800 = 0xf800f800f800f800;
+ unsigned __int64 __0x07e007e007e007e0 = 0x07e007e007e007e0;
+ unsigned __int64 __0x001f001f001f001f = 0x001f001f001f001f;
+
+ BYTE* s = dst;
+ BYTE* d = dst + (h-2)*pitch;
+
+ for(; s < d; s += pitch*2)
+ {
+ WORD* tmp = (WORD*)s;
+
+ __asm
+ {
+ mov esi, tmp
+ mov ebx, pitch
+
+ mov ecx, ebx
+ shr ecx, 3
+
+ movq mm6, __0x07e007e007e007e0
+ movq mm7, __0x001f001f001f001f
+
+AvgLines565_loop:
+ movq mm0, [esi]
+ movq mm1, mm0
+ movq mm2, mm0
+
+ psrlw mm0, 11 // red1 bits: mm0 = 001f001f001f001f
+ pand mm1, mm6 // green1 bits: mm1 = 07e007e007e007e0
+ pand mm2, mm7 // blue1 bits: mm2 = 001f001f001f001f
+
+ movq mm3, [esi+ebx*2]
+ movq mm4, mm3
+ movq mm5, mm3
+
+ psrlw mm3, 11 // red2 bits: mm3 = 001f001f001f001f
+ pand mm4, mm6 // green2 bits: mm4 = 07e007e007e007e0
+ pand mm5, mm7 // blue2 bits: mm5 = 001f001f001f001f
+
+ paddw mm0, mm3
+ psrlw mm0, 1 // (red1+red2)/2
+ psllw mm0, 11 // red bits at f800f800f800f800
+
+ paddw mm1, mm4
+ psrlw mm1, 1 // (green1+green2)/2
+ pand mm1, mm6 // green bits at 03e003e003e003e0
+
+ paddw mm2, mm5
+ psrlw mm2, 1 // (blue1+blue2)/2
+ // blue bits at 001f001f001f001f (no need to pand, lower bits were discareded)
+
+ por mm0, mm1
+ por mm0, mm2
+
+ movq [esi+ebx], mm0
+
+ lea esi, [esi+8]
+
+ dec ecx
+ jnz AvgLines565_loop
+
+ mov tmp, esi
+ }
+
+ for(int i = (pitch&7)>>1; i--; tmp++)
+ {
+ tmp[pitch] =
+ ((((*tmp&0xf800) + (tmp[pitch<<1]&0xf800)) >> 1)&0xf800)|
+ ((((*tmp&0x07e0) + (tmp[pitch<<1]&0x07e0)) >> 1)&0x07e0)|
+ ((((*tmp&0x001f) + (tmp[pitch<<1]&0x001f)) >> 1)&0x001f);
+ }
+ }
+
+ if(!(h&1) && h >= 2)
+ {
+ dst += (h-2)*pitch;
+ memcpy_accel(dst + pitch, dst, pitch);
+ }
+
+ __asm emms;
+}
+
+extern "C" void mmx_YUY2toRGB24(const BYTE* src, BYTE* dst, const BYTE* src_end, int src_pitch, int row_size, bool rec709);
+extern "C" void mmx_YUY2toRGB32(const BYTE* src, BYTE* dst, const BYTE* src_end, int src_pitch, int row_size, bool rec709);
+
+bool BitBltFromYUY2ToRGB(int w, int h, BYTE* dst, int dstpitch, int dbpp, BYTE* src, int srcpitch)
+{
+ void (* YUY2toRGB)(const BYTE* src, BYTE* dst, const BYTE* src_end, int src_pitch, int row_size, bool rec709) = NULL;
+
+ if(g_cpuid.m_flags & CCpuID::mmx)
+ {
+ YUY2toRGB =
+ dbpp == 32 ? mmx_YUY2toRGB32 :
+ dbpp == 24 ? mmx_YUY2toRGB24 :
+ // dbpp == 16 ? mmx_YUY2toRGB16 : // TODO
+ NULL;
+ }
+ else
+ {
+ // TODO
+ }
+
+ if(!YUY2toRGB) return(false);
+
+ YUY2toRGB(src, dst, src + h*srcpitch, srcpitch, w, false);
+
+ return(true);
+}
diff --git a/src/dsutil/vd.h b/src/dsutil/vd.h
new file mode 100644
index 000000000..434c214ec
--- /dev/null
+++ b/src/dsutil/vd.h
@@ -0,0 +1,42 @@
+// VirtualDub - Video processing and capture application
+// Copyright (C) 1998-2001 Avery Lee
+//
+// 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; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+//
+// Notes:
+// - BitBltFromI420ToRGB is from VirtualDub
+// - BitBltFromYUY2ToRGB is from AviSynth 2.52
+// - The core assembly function of CCpuID is from DVD2AVI
+// (- vd.cpp/h should be renamed to something more sensible already :)
+
+#pragma once
+
+class CCpuID {public: CCpuID(); enum flag_t {mmx=1, ssemmx=2, ssefpu=4, sse2=8, _3dnow=16} m_flags;};
+extern CCpuID g_cpuid;
+
+extern bool BitBltFromI420ToI420(int w, int h, BYTE* dsty, BYTE* dstu, BYTE* dstv, int dstpitch, BYTE* srcy, BYTE* srcu, BYTE* srcv, int srcpitch);
+extern bool BitBltFromI420ToYUY2(int w, int h, BYTE* dst, int dstpitch, BYTE* srcy, BYTE* srcu, BYTE* srcv, int srcpitch, bool fInterlaced = false);
+extern bool BitBltFromI420ToRGB(int w, int h, BYTE* dst, int dstpitch, int dbpp, BYTE* srcy, BYTE* srcu, BYTE* srcv, int srcpitch /* TODO: , bool fInterlaced = false */);
+extern bool BitBltFromYUY2ToYUY2(int w, int h, BYTE* dst, int dstpitch, BYTE* src, int srcpitch);
+extern bool BitBltFromYUY2ToRGB(int w, int h, BYTE* dst, int dstpitch, int dbpp, BYTE* src, int srcpitch);
+extern bool BitBltFromRGBToRGB(int w, int h, BYTE* dst, int dstpitch, int dbpp, BYTE* src, int srcpitch, int sbpp);
+
+extern void DeinterlaceBlend(BYTE* dst, BYTE* src, DWORD rowbytes, DWORD h, DWORD dstpitch, DWORD srcpitch);
+extern void DeinterlaceBob(BYTE* dst, BYTE* src, DWORD rowbytes, DWORD h, DWORD dstpitch, DWORD srcpitch, bool topfield);
+
+extern void AvgLines8(BYTE* dst, DWORD h, DWORD pitch);
+extern void AvgLines555(BYTE* dst, DWORD h, DWORD pitch);
+extern void AvgLines565(BYTE* dst, DWORD h, DWORD pitch);
+
diff --git a/src/filters/FilterApp.cpp b/src/filters/FilterApp.cpp
new file mode 100644
index 000000000..30cc0da63
--- /dev/null
+++ b/src/filters/FilterApp.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "FilterApp.h"
+
+extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
+
+CFilterApp::CFilterApp()
+{
+}
+
+BOOL CFilterApp::InitInstance()
+{
+ if(!__super::InitInstance())
+ return FALSE;
+
+ SetRegistryKey(_T("Gabest"));
+
+ DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_ATTACH, 0);
+
+ return TRUE;
+}
+
+BOOL CFilterApp::ExitInstance()
+{
+ DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_DETACH, 0);
+
+ return __super::ExitInstance();
+}
+
+BEGIN_MESSAGE_MAP(CFilterApp, CWinApp)
+END_MESSAGE_MAP()
+
diff --git a/src/filters/FilterApp.h b/src/filters/FilterApp.h
new file mode 100644
index 000000000..0c95ee723
--- /dev/null
+++ b/src/filters/FilterApp.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+class CFilterApp : public CWinApp
+{
+public:
+ CFilterApp();
+
+ BOOL InitInstance();
+ BOOL ExitInstance();
+
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/src/filters/InternalPropertyPage.cpp b/src/filters/InternalPropertyPage.cpp
new file mode 100644
index 000000000..4231ab8ca
--- /dev/null
+++ b/src/filters/InternalPropertyPage.cpp
@@ -0,0 +1,312 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "InternalPropertyPage.h"
+#include "..\dsutil\dsutil.h"
+
+//
+// CInternalPropertyPageWnd
+//
+
+CInternalPropertyPageWnd::CInternalPropertyPageWnd()
+ : m_fDirty(false)
+ , m_fontheight(13)
+{
+}
+
+BOOL CInternalPropertyPageWnd::Create(IPropertyPageSite* pPageSite, LPCRECT pRect, CWnd* pParentWnd)
+{
+ if(!pPageSite || !pRect) return FALSE;
+
+ m_pPageSite = pPageSite;
+
+ if(!m_font.m_hObject)
+ {
+ CString face;
+ WORD height;
+ extern BOOL AFXAPI AfxGetPropSheetFont(CString& strFace, WORD& wSize, BOOL bWizard); // yay
+ if(!AfxGetPropSheetFont(face, height, FALSE))
+ return FALSE;
+
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(lf));
+ _tcscpy(lf.lfFaceName, face);
+ HDC hDC = ::GetDC(0);
+ lf.lfHeight = -MulDiv(height, GetDeviceCaps(hDC, LOGPIXELSY), 72);
+ ::ReleaseDC(0, hDC);
+ lf.lfWeight = FW_NORMAL;
+ lf.lfCharSet = DEFAULT_CHARSET;
+ if(!m_font.CreateFontIndirect(&lf))
+ return FALSE;
+
+ lf.lfHeight -= -1;
+ _tcscpy(lf.lfFaceName, _T("Lucida Console"));
+ if(!m_monospacefont.CreateFontIndirect(&lf))
+ {
+ _tcscpy(lf.lfFaceName, _T("Courier New"));
+ if(!m_monospacefont.CreateFontIndirect(&lf))
+ return FALSE;
+ }
+
+ hDC = ::GetDC(0);
+ HFONT hFontOld = (HFONT)::SelectObject(hDC, m_font.m_hObject);
+ CSize size;
+ ::GetTextExtentPoint32(hDC, _T("x"), 1, &size);
+ ::SelectObject(hDC, hFontOld);
+ ::ReleaseDC(0, hDC);
+
+ m_fontheight = size.cy;
+ }
+
+ LPCTSTR wc = AfxRegisterWndClass(CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS, 0, (HBRUSH)(COLOR_BTNFACE + 1));
+ if(!CreateEx(0, wc, _T("CInternalPropertyPageWnd"), WS_CHILDWINDOW, *pRect, pParentWnd, 0))
+ return FALSE;
+
+ SetFont(&m_font);
+
+ return TRUE;
+}
+
+BOOL CInternalPropertyPageWnd::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
+{
+ if(message == WM_COMMAND || message == WM_HSCROLL || message == WM_VSCROLL)
+ {
+ SetDirty(true);
+ }
+
+ return __super::OnWndMsg(message, wParam, lParam, pResult);
+}
+
+BEGIN_MESSAGE_MAP(CInternalPropertyPageWnd, CWnd)
+END_MESSAGE_MAP()
+
+//
+// CInternalPropertyPage
+//
+
+CInternalPropertyPage::CInternalPropertyPage(LPUNKNOWN lpunk, HRESULT* phr)
+ : CUnknown(_T("CInternalPropertyPage"), lpunk)
+ , m_pWnd(NULL)
+{
+ if(phr) *phr = S_OK;
+}
+
+CInternalPropertyPage::~CInternalPropertyPage()
+{
+ if(m_pWnd)
+ {
+ if(m_pWnd->m_hWnd) {ASSERT(0); m_pWnd->DestroyWindow();}
+ delete m_pWnd;
+ m_pWnd = NULL;
+ }
+}
+
+STDMETHODIMP CInternalPropertyPage::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI2(IPropertyPage)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IPropertyPage
+
+STDMETHODIMP CInternalPropertyPage::SetPageSite(IPropertyPageSite* pPageSite)
+{
+ CAutoLock cAutoLock(this);
+
+ if(pPageSite && m_pPageSite || !pPageSite && !m_pPageSite)
+ return E_UNEXPECTED;
+
+ m_pPageSite = pPageSite;
+
+ return S_OK;
+}
+
+STDMETHODIMP CInternalPropertyPage::Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(pRect, E_POINTER);
+
+ if(!m_pWnd || m_pWnd->m_hWnd || m_pUnks.IsEmpty())
+ return E_UNEXPECTED;
+
+ if(!m_pWnd->Create(m_pPageSite, pRect, CWnd::FromHandle(hwndParent)))
+ return E_OUTOFMEMORY;
+
+ if(!m_pWnd->OnActivate())
+ {
+ m_pWnd->DestroyWindow();
+ return E_FAIL;
+ }
+
+ m_pWnd->ModifyStyleEx(WS_EX_DLGMODALFRAME, WS_EX_CONTROLPARENT);
+ m_pWnd->ShowWindow(SW_SHOWNORMAL);
+
+ return S_OK;
+}
+
+STDMETHODIMP CInternalPropertyPage::Deactivate()
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(this);
+
+ if(!m_pWnd || !m_pWnd->m_hWnd)
+ return E_UNEXPECTED;
+
+ m_pWnd->OnDeactivate();
+
+ m_pWnd->ModifyStyleEx(WS_EX_CONTROLPARENT, 0);
+ m_pWnd->DestroyWindow();
+
+ return S_OK;
+}
+
+STDMETHODIMP CInternalPropertyPage::GetPageInfo(PROPPAGEINFO* pPageInfo)
+{
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(pPageInfo, E_POINTER);
+
+ LPOLESTR pszTitle;
+ HRESULT hr = AMGetWideString(CStringW(GetWindowTitle()), &pszTitle);
+ if(FAILED(hr)) return hr;
+
+ pPageInfo->cb = sizeof(PROPPAGEINFO);
+ pPageInfo->pszTitle = pszTitle;
+ pPageInfo->pszDocString = NULL;
+ pPageInfo->pszHelpFile = NULL;
+ pPageInfo->dwHelpContext = 0;
+ pPageInfo->size = GetWindowSize();
+
+ return S_OK;
+}
+
+STDMETHODIMP CInternalPropertyPage::SetObjects(ULONG cObjects, LPUNKNOWN* ppUnk)
+{
+ CAutoLock cAutoLock(this);
+
+ if(cObjects && m_pWnd || !cObjects && !m_pWnd)
+ return E_UNEXPECTED;
+
+ m_pUnks.RemoveAll();
+
+ if(cObjects > 0)
+ {
+ CheckPointer(ppUnk, E_POINTER);
+
+ for(ULONG i = 0; i < cObjects; i++)
+ m_pUnks.AddTail(ppUnk[i]);
+
+ if(!(m_pWnd = GetWindow()))
+ return E_OUTOFMEMORY;
+
+ if(!m_pWnd->OnConnect(m_pUnks))
+ {
+ delete m_pWnd;
+ m_pWnd = NULL;
+
+ return E_FAIL;
+ }
+ }
+ else
+ {
+ m_pWnd->OnDisconnect();
+
+ m_pWnd->DestroyWindow();
+ delete m_pWnd;
+ m_pWnd = NULL;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CInternalPropertyPage::Show(UINT nCmdShow)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(this);
+
+ if(!m_pWnd) return E_UNEXPECTED;
+
+ if((nCmdShow != SW_SHOW) && (nCmdShow != SW_SHOWNORMAL) && (nCmdShow != SW_HIDE))
+ return E_INVALIDARG;
+
+ m_pWnd->ShowWindow(nCmdShow);
+ m_pWnd->Invalidate();
+
+ return S_OK;
+}
+
+STDMETHODIMP CInternalPropertyPage::Move(LPCRECT pRect)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(this);
+
+ CheckPointer(pRect, E_POINTER);
+
+ if(!m_pWnd) return E_UNEXPECTED;
+
+ m_pWnd->MoveWindow(pRect, TRUE);
+
+ return S_OK;
+}
+
+STDMETHODIMP CInternalPropertyPage::IsPageDirty()
+{
+ CAutoLock cAutoLock(this);
+
+ return m_pWnd && m_pWnd->GetDirty() ? S_OK : S_FALSE;
+}
+
+STDMETHODIMP CInternalPropertyPage::Apply()
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(this);
+
+ if(!m_pWnd || m_pUnks.IsEmpty() || !m_pPageSite)
+ return E_UNEXPECTED;
+
+ if(m_pWnd->GetDirty() && m_pWnd->OnApply())
+ m_pWnd->SetDirty(false);
+
+ return S_OK;
+}
+
+STDMETHODIMP CInternalPropertyPage::Help(LPCWSTR lpszHelpDir)
+{
+ CAutoLock cAutoLock(this);
+
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CInternalPropertyPage::TranslateAccelerator(LPMSG lpMsg)
+{
+ CAutoLock cAutoLock(this);
+
+ return E_NOTIMPL;
+}
diff --git a/src/filters/InternalPropertyPage.h b/src/filters/InternalPropertyPage.h
new file mode 100644
index 000000000..c49f05aa7
--- /dev/null
+++ b/src/filters/InternalPropertyPage.h
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+
+[uuid("03481710-D73E-4674-839F-03EDE2D60ED8")]
+interface ISpecifyPropertyPages2 : public ISpecifyPropertyPages
+{
+ STDMETHOD (CreatePage) (const GUID& guid, IPropertyPage** ppPage) = 0;
+};
+
+class CInternalPropertyPageWnd : public CWnd
+{
+ bool m_fDirty;
+ CComPtr<IPropertyPageSite> m_pPageSite;
+
+protected:
+ CFont m_font, m_monospacefont;
+ int m_fontheight;
+
+ virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
+
+public:
+ CInternalPropertyPageWnd();
+
+ void SetDirty(bool fDirty = true) {m_fDirty = fDirty; if(fDirty && m_pPageSite) m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);}
+ bool GetDirty() {return m_fDirty;}
+
+ virtual BOOL Create(IPropertyPageSite* pPageSite, LPCRECT pRect, CWnd* pParentWnd);
+
+ virtual bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks) {return true;}
+ virtual void OnDisconnect() {}
+ virtual bool OnActivate() {return true;}
+ virtual void OnDeactivate() {}
+ virtual bool OnApply() {return true;}
+
+ DECLARE_MESSAGE_MAP()
+};
+
+class CInternalPropertyPage
+ : public CUnknown
+ , public IPropertyPage
+ , public CCritSec
+{
+ CComPtr<IPropertyPageSite> m_pPageSite;
+ CInterfaceList<IUnknown, &IID_IUnknown> m_pUnks;
+ CInternalPropertyPageWnd* m_pWnd;
+
+protected:
+ virtual CInternalPropertyPageWnd* GetWindow() = 0;
+ virtual LPCTSTR GetWindowTitle() = 0;
+ virtual CSize GetWindowSize() = 0;
+
+public:
+ CInternalPropertyPage(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CInternalPropertyPage();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IPropertyPage
+
+ STDMETHODIMP SetPageSite(IPropertyPageSite* pPageSite);
+ STDMETHODIMP Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal);
+ STDMETHODIMP Deactivate();
+ STDMETHODIMP GetPageInfo(PROPPAGEINFO* pPageInfo);
+ STDMETHODIMP SetObjects(ULONG cObjects, LPUNKNOWN* ppUnk);
+ STDMETHODIMP Show(UINT nCmdShow);
+ STDMETHODIMP Move(LPCRECT prect);
+ STDMETHODIMP IsPageDirty();
+ STDMETHODIMP Apply();
+ STDMETHODIMP Help(LPCWSTR lpszHelpDir);
+ STDMETHODIMP TranslateAccelerator(LPMSG lpMsg);
+};
+
+template<class WndClass>
+class CInternalPropertyPageTempl : public CInternalPropertyPage
+{
+ virtual CInternalPropertyPageWnd* GetWindow()
+ {
+ return new WndClass();
+ }
+
+ virtual LPCTSTR GetWindowTitle()
+ {
+ return WndClass::GetWindowTitle();
+ }
+
+ virtual CSize GetWindowSize()
+ {
+ return WndClass::GetWindowSize();
+ }
+
+public:
+ CInternalPropertyPageTempl(LPUNKNOWN lpunk, HRESULT* phr)
+ : CInternalPropertyPage(lpunk, phr)
+ {
+ }
+};
diff --git a/src/filters/PinInfoWnd.cpp b/src/filters/PinInfoWnd.cpp
new file mode 100644
index 000000000..fedaa7493
--- /dev/null
+++ b/src/filters/PinInfoWnd.cpp
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "PinInfoWnd.h"
+#include "..\dsutil\dsutil.h"
+
+//
+// CPinInfoWnd
+//
+
+CPinInfoWnd::CPinInfoWnd()
+{
+}
+
+bool CPinInfoWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
+{
+ ASSERT(!m_pBF);
+
+ m_pBF.Release();
+
+ POSITION pos = pUnks.GetHeadPosition();
+ while(pos && !(m_pBF = pUnks.GetNext(pos)));
+
+ if(!m_pBF) return false;
+
+ return true;
+}
+
+void CPinInfoWnd::OnDisconnect()
+{
+ m_pBF.Release();
+}
+
+bool CPinInfoWnd::OnActivate()
+{
+ DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP;
+
+ CPoint p(10, 10);
+
+ m_pin_static.Create(_T("Pin:"), dwStyle, CRect(p + CPoint(0, 3), CSize(30, m_fontheight)), this);
+ m_pin_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CPoint(30, 0), CSize(450, 200)), this, IDC_PP_COMBO1);
+ BeginEnumPins(m_pBF, pEP, pPin)
+ {
+ CPinInfo pi;
+ if(FAILED(pPin->QueryPinInfo(&pi))) continue;
+ CString str = CString(pi.achName);
+ CString dir = _T("[?] ");
+ if(pi.dir == PINDIR_INPUT) dir = _T("[IN] ");
+ else if(pi.dir == PINDIR_OUTPUT) dir = _T("[OUT] ");
+ m_pin_combo.SetItemDataPtr(m_pin_combo.AddString(dir + str), pPin);
+ }
+ EndEnumPins
+ m_pin_combo.SetCurSel(0);
+
+ p.y += m_fontheight + 20;
+
+ m_info_edit.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), dwStyle|WS_BORDER|WS_VSCROLL|WS_HSCROLL|ES_MULTILINE|ES_AUTOHSCROLL|ES_READONLY, CRect(p, CSize(480, m_fontheight*20)), this, IDC_PP_EDIT1);
+ m_info_edit.SetLimitText(60000);
+
+ OnCbnSelchangeCombo1();
+
+ for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
+ pWnd->SetFont(&m_font, FALSE);
+
+ m_info_edit.SetFont(&m_monospacefont);
+
+ return true;
+}
+
+void CPinInfoWnd::OnDeactivate()
+{
+}
+
+bool CPinInfoWnd::OnApply()
+{
+ OnDeactivate();
+
+ if(m_pBF)
+ {
+ }
+
+ return true;
+}
+
+BEGIN_MESSAGE_MAP(CPinInfoWnd, CInternalPropertyPageWnd)
+ ON_CBN_SELCHANGE(IDC_PP_COMBO1, OnCbnSelchangeCombo1)
+END_MESSAGE_MAP()
+
+void CPinInfoWnd::AddLine(CString str)
+{
+ str.Replace(_T("\n"), _T("\r\n"));
+ int len = m_info_edit.GetWindowTextLength();
+ m_info_edit.SetSel(len, len, TRUE);
+ m_info_edit.ReplaceSel(str);
+}
+
+void CPinInfoWnd::OnCbnSelchangeCombo1()
+{
+ m_info_edit.SetWindowText(_T(""));
+
+ int i = m_pin_combo.GetCurSel();
+ if(i < 0) return;
+
+ CComPtr<IPin> pPin = (IPin*)m_pin_combo.GetItemDataPtr(i);
+ if(!pPin) return;
+
+ CString str;
+
+ CMediaTypeEx cmt;
+
+ CComPtr<IPin> pPinTo;
+ if(SUCCEEDED(pPin->ConnectedTo(&pPinTo)) && pPinTo)
+ {
+ str.Format(_T("- Connected to:\n\nCLSID: %s\nFilter: %s\nPin: %s\n\n"),
+ CString(CStringFromGUID(GetCLSID(pPinTo))),
+ CString(GetFilterName(GetFilterFromPin(pPinTo))),
+ CString(GetPinName(pPinTo)));
+
+ AddLine(str);
+
+ AddLine(_T("- Connection media type:\n\n"));
+
+ if(SUCCEEDED(pPin->ConnectionMediaType(&cmt)))
+ {
+ CAtlList<CString> sl;
+ cmt.Dump(sl);
+ POSITION pos = sl.GetHeadPosition();
+ while(pos) AddLine(sl.GetNext(pos) + '\n');
+ }
+ }
+ else
+ {
+ str = _T("- Not connected\n\n");
+ }
+
+ int iMT = 0;
+
+ BeginEnumMediaTypes(pPin, pEMT, pmt)
+ {
+ CMediaTypeEx mt(*pmt);
+
+ str.Format(_T("- Enumerated media type %d:\n\n"), iMT++);
+ AddLine(str);
+
+ if(cmt.majortype != GUID_NULL && mt == cmt)
+ {
+ AddLine(_T("Set as the current media type\n\n"));
+ }
+ else
+ {
+ CAtlList<CString> sl;
+ mt.Dump(sl);
+ POSITION pos = sl.GetHeadPosition();
+ while(pos) AddLine(sl.GetNext(pos) + '\n');
+ }
+ }
+ EndEnumMediaTypes(pmt)
+
+ m_info_edit.SetSel(0, 0);
+} \ No newline at end of file
diff --git a/src/filters/PinInfoWnd.h b/src/filters/PinInfoWnd.h
new file mode 100644
index 000000000..6efa4c56b
--- /dev/null
+++ b/src/filters/PinInfoWnd.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "InternalPropertyPage.h"
+#include <afxcmn.h>
+
+[uuid("A1EB391C-6089-4A87-9988-BE50872317D4")]
+class CPinInfoWnd : public CInternalPropertyPageWnd
+{
+ CComQIPtr<IBaseFilter> m_pBF;
+
+ enum
+ {
+ IDC_PP_COMBO1 = 10000,
+ IDC_PP_EDIT1,
+ };
+
+ CStatic m_pin_static;
+ CComboBox m_pin_combo;
+ CEdit m_info_edit;
+
+ void AddLine(CString str);
+
+public:
+ CPinInfoWnd();
+
+ bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
+ void OnDisconnect();
+ bool OnActivate();
+ void OnDeactivate();
+ bool OnApply();
+
+ static LPCTSTR GetWindowTitle() {return _T("Pin Info");}
+ static CSize GetWindowSize() {return CSize(500, 300);}
+
+ DECLARE_MESSAGE_MAP()
+
+ void OnCbnSelchangeCombo1();
+}; \ No newline at end of file
diff --git a/src/filters/filters.h b/src/filters/filters.h
new file mode 100644
index 000000000..0a5464199
--- /dev/null
+++ b/src/filters/filters.h
@@ -0,0 +1,49 @@
+// Copyright (C) 2003-2006 Gabest.
+// http://www.gabest.org
+//
+// 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; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
+// http://www.gnu.org/copyleft/gpl.html
+
+#include ".\reader\CDDAReader\CDDAReader.h"
+#include ".\reader\CDXAReader\CDXAReader.h"
+#include ".\reader\UDPReader\UDPReader.h"
+#include ".\reader\VTSReader\VTSReader.h"
+#include ".\source\D2VSource\D2VSource.h"
+#include ".\source\DTSAC3Source\DTSAC3Source.h"
+#include ".\source\FLICSource\FLICSource.h"
+#include ".\source\ShoutcastSource\ShoutcastSource.h"
+#include ".\source\SubtitleSource\SubtitleSource.h"
+#include ".\switcher\AudioSwitcher\AudioSwitcher.h"
+#include ".\transform\avi2ac3filter\AVI2AC3Filter.h"
+#include ".\transform\BufferFilter\BufferFilter.h"
+#include ".\transform\DeCSSFilter\DeCSSFilter.h"
+#include ".\transform\Mpeg2DecFilter\Mpeg2DecFilter.h"
+#include ".\transform\MpaDecFilter\MpaDecFilter.h"
+#include ".\muxer\wavdest\wavdest.h"
+#include ".\muxer\DSMMuxer\DSMMuxer.h"
+#include ".\muxer\MatroskaMuxer\MatroskaMuxer.h"
+#include ".\parser\StreamDriveThru\StreamDriveThru.h"
+#include ".\parser\MatroskaSplitter\MatroskaSplitter.h"
+#include ".\parser\RealMediaSplitter\RealMediaSplitter.h"
+#include ".\parser\AviSplitter\AviSplitter.h"
+//#include ".\parser\RadGtSplitter\RadGtSplitter.h"
+#include ".\parser\RoQSplitter\RoQSplitter.h"
+#include ".\parser\OggSplitter\OggSplitter.h"
+#include ".\parser\NutSplitter\NutSplitter.h"
+#include ".\parser\MpegSplitter\MpegSplitter.h"
+#include ".\parser\DiracSplitter\DiracSplitter.h"
+#include ".\parser\MpaSplitter\MpaSplitter.h"
+#include ".\parser\DSMSplitter\DSMSplitter.h"
+#include ".\parser\MP4Splitter\MP4Splitter.h"
diff --git a/src/filters/filters.ncb b/src/filters/filters.ncb
new file mode 100644
index 000000000..00e3a3e23
--- /dev/null
+++ b/src/filters/filters.ncb
Binary files differ
diff --git a/src/filters/filters.sln b/src/filters/filters.sln
new file mode 100644
index 000000000..dbecb56b2
--- /dev/null
+++ b/src/filters/filters.sln
@@ -0,0 +1,862 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asyncreader", "reader\asyncreader\asyncreader.vcproj", "{9F31D122-E84D-485A-A58D-09DAD01A56CE}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cddareader", "reader\cddareader\cddareader.vcproj", "{543D40E9-8CA6-4E4B-9936-90CBA562B268}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdxareader", "reader\cdxareader\cdxareader.vcproj", "{4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d2vsource", "source\d2vsource\d2vsource.vcproj", "{83CC6B88-A112-4192-BD5A-F2A249AF2277}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E} = {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flicsource", "source\flicsource\flicsource.vcproj", "{431DD5B6-3F2F-47EE-A23F-514BC044B704}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audioswitcher", "switcher\audioswitcher\audioswitcher.vcproj", "{D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "avi2ac3filter", "transform\avi2ac3filter\avi2ac3filter.vcproj", "{339A4575-E25B-45D6-94A1-D835891740B8}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bufferfilter", "transform\bufferfilter\bufferfilter.vcproj", "{9DCFD02A-16A0-4766-BC18-66163E21929D}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decssfilter", "transform\decssfilter\decssfilter.vcproj", "{F6B06383-3FFD-403B-9867-4AA82A20AA83}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesource", "source\basesource\basesource.vcproj", "{F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wavdest", "muxer\wavdest\wavdest.vcproj", "{EB202B68-8029-4985-B914-E94B44D2E230}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vtsreader", "reader\vtsreader\vtsreader.vcproj", "{664E726B-EEEE-403A-AC15-345D9C9E1375}"
+ ProjectSection(ProjectDependencies) = postProject
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE} = {9F31D122-E84D-485A-A58D-09DAD01A56CE}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "streamdrivethru", "parser\streamdrivethru\streamdrivethru.vcproj", "{AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtsac3source", "source\dtsac3source\dtsac3source.vcproj", "{30D48874-899F-41C6-9B26-A40C96C91102}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E} = {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shoutcastsource", "source\shoutcastsource\shoutcastsource.vcproj", "{42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatroskaSplitter", "parser\matroskasplitter\MatroskaSplitter.vcproj", "{3F5EA225-F4B7-4413-AEB3-4E4E5751E438}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49} = {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatroskaMuxer", "muxer\matroskamuxer\MatroskaMuxer.vcproj", "{67827491-8162-4039-9132-F934ABC836A0}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RealMediaSplitter", "parser\realmediasplitter\RealMediaSplitter.vcproj", "{53CF9195-19DB-457D-8F55-8DB1706DFA84}"
+ ProjectSection(ProjectDependencies) = postProject
+ {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680}
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "parser\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AviSplitter", "parser\avisplitter\AviSplitter.vcproj", "{9738B023-FC46-48A2-953A-0035FD897678}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mpeg2DecFilter", "transform\mpeg2decfilter\Mpeg2DecFilter.vcproj", "{305BAB2D-0D75-4FBC-8BCD-A2917392B48C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpaDecFilter", "transform\mpadecfilter\MpaDecFilter.vcproj", "{4421516D-10A6-41C1-ADF3-099573BBB0C6}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} = {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} = {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} = {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13} = {54F609FD-A8CE-43CF-94AD-23E877B97C13}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmad", "transform\mpadecfilter\libmad-0.15.0b\msvc++\libmad.vcproj", "{D8365C15-2166-4DB6-8A2D-1C8F0239EB18}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RoQSplitter", "parser\roqsplitter\RoQSplitter.vcproj", "{23E1898F-8262-435C-8848-D4D8824E6D71}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "..\zlib\zlib.vcproj", "{2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OggSplitter", "parser\oggsplitter\OggSplitter.vcproj", "{7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liba52", "transform\mpadecfilter\a52dec-0.7.4\vc++\liba52.vcproj", "{62FE6D94-E17C-4A8E-8D3C-7A589A70D865}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NutSplitter", "parser\nutsplitter\NutSplitter.vcproj", "{E776D3C2-5BFA-41B9-B998-A35B549AF737}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdts", "transform\mpadecfilter\dtsdec-0.0.1\vc++\libdts.vcproj", "{54F609FD-A8CE-43CF-94AD-23E877B97C13}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpegSplitter", "parser\mpegsplitter\MpegSplitter.vcproj", "{4628C665-EDE4-40D2-B525-32BE8B8551C8}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "transform\mpadecfilter\faad2\libfaad\libfaad.vcproj", "{5EFCFACB-1835-422C-ACDA-E3B3A2F51387}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DiracSplitter", "parser\diracsplitter\DiracSplitter.vcproj", "{ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {12BE3440-A1F3-4C48-A229-30CB619EA276} = {12BE3440-A1F3-4C48-A229-30CB619EA276}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdirac", "parser\diracsplitter\libdirac\libdirac.vcproj", "{12BE3440-A1F3-4C48-A229-30CB619EA276}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpaSplitter", "parser\mpasplitter\MpaSplitter.vcproj", "{C0F7A036-FC2D-40DF-9852-C37518DB6B3E}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basevideofilter", "transform\basevideofilter\basevideofilter.vcproj", "{54DDA60F-E528-4D07-A152-960A1E818680}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMSplitter", "parser\dsmsplitter\DSMSplitter.vcproj", "{1E91F58C-0BAE-4021-8087-D1864D8EC066}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseMuxer", "muxer\basemuxer\BaseMuxer.vcproj", "{DB5F93B2-54D0-4474-A588-D259BE36C832}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMMuxer", "muxer\dsmmuxer\DSMMuxer.vcproj", "{65361C7C-83D6-42E4-870C-4DC85AE641FE}"
+ ProjectSection(ProjectDependencies) = postProject
+ {DB5F93B2-54D0-4474-A588-D259BE36C832} = {DB5F93B2-54D0-4474-A588-D259BE36C832}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitlesource", "source\subtitlesource\subtitlesource.vcproj", "{8F998497-9C51-4FAA-83E4-1D85B22CBA13}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MP4Splitter", "parser\mp4splitter\MP4Splitter.vcproj", "{9ED4B036-7399-4128-868D-6E71188E0277}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UDPReader", "reader\udpreader\UDPReader.vcproj", "{3020FF9B-8202-488D-B137-11DECC510E6E}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug.ActiveCfg = Debug|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug.Build.0 = Debug|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug lib.ActiveCfg = Debug|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug lib.Build.0 = Debug|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release.ActiveCfg = Release|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release.Build.0 = Release|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release lib.ActiveCfg = Release|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release lib.Build.0 = Release|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode.Build.0 = Release Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug.ActiveCfg = Debug|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug.Build.0 = Debug|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug lib.ActiveCfg = Debug lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug lib.Build.0 = Debug lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release.ActiveCfg = Release|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release.Build.0 = Release|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release lib.ActiveCfg = Release lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release lib.Build.0 = Release lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode.Build.0 = Release Unicode|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug.ActiveCfg = Debug|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug.Build.0 = Debug|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug lib.ActiveCfg = Debug lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug lib.Build.0 = Debug lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release.ActiveCfg = Release|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release.Build.0 = Release|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release lib.ActiveCfg = Release lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release lib.Build.0 = Release lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode.Build.0 = Release Unicode|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug.ActiveCfg = Debug|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug.Build.0 = Debug|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug lib.ActiveCfg = Debug lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug lib.Build.0 = Debug lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release.ActiveCfg = Release|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release.Build.0 = Release|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release lib.ActiveCfg = Release lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release lib.Build.0 = Release lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode.Build.0 = Release Unicode|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug.ActiveCfg = Debug|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug.Build.0 = Debug|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug lib.ActiveCfg = Debug lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug lib.Build.0 = Debug lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release.ActiveCfg = Release|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release.Build.0 = Release|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release lib.ActiveCfg = Release lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release lib.Build.0 = Release lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode.Build.0 = Release Unicode|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug.ActiveCfg = Debug|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug.Build.0 = Debug|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug lib.ActiveCfg = Debug lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug lib.Build.0 = Debug lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release.ActiveCfg = Release|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release.Build.0 = Release|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release lib.ActiveCfg = Release lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release lib.Build.0 = Release lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode.Build.0 = Release Unicode|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug.ActiveCfg = Debug|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug.Build.0 = Debug|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug lib.ActiveCfg = Debug lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug lib.Build.0 = Debug lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release.ActiveCfg = Release|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release.Build.0 = Release|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release lib.ActiveCfg = Release lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release lib.Build.0 = Release lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode.Build.0 = Release Unicode|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug.ActiveCfg = Debug|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug.Build.0 = Debug|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug lib.ActiveCfg = Debug lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug lib.Build.0 = Debug lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release.ActiveCfg = Release|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release.Build.0 = Release|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release lib.ActiveCfg = Release lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release lib.Build.0 = Release lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode.Build.0 = Release Unicode|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug.ActiveCfg = Debug|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug.Build.0 = Debug|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug lib.ActiveCfg = Debug lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug lib.Build.0 = Debug lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release.ActiveCfg = Release|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release.Build.0 = Release|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release lib.ActiveCfg = Release lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release lib.Build.0 = Release lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug.ActiveCfg = Debug lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug.Build.0 = Debug lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug lib.ActiveCfg = Debug lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug lib.Build.0 = Debug lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release.ActiveCfg = Release lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release.Build.0 = Release lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release lib.ActiveCfg = Release lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release lib.Build.0 = Release lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug.ActiveCfg = Debug|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug.Build.0 = Debug|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug lib.ActiveCfg = Debug lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug lib.Build.0 = Debug lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release.ActiveCfg = Release|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release.Build.0 = Release|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release lib.ActiveCfg = Release lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release lib.Build.0 = Release lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode.Build.0 = Release Unicode|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug.ActiveCfg = Debug|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug.Build.0 = Debug|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug lib.ActiveCfg = Debug lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug lib.Build.0 = Debug lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release.ActiveCfg = Release|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release.Build.0 = Release|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release lib.ActiveCfg = Release lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release lib.Build.0 = Release lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode.Build.0 = Release Unicode|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug.ActiveCfg = Debug|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug.Build.0 = Debug|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug lib.ActiveCfg = Debug lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug lib.Build.0 = Debug lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release.ActiveCfg = Release|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release.Build.0 = Release|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release lib.ActiveCfg = Release lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release lib.Build.0 = Release lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode.Build.0 = Release Unicode|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug.ActiveCfg = Debug|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug.Build.0 = Debug|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug lib.ActiveCfg = Debug lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug lib.Build.0 = Debug lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release.ActiveCfg = Release|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release.Build.0 = Release|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release lib.ActiveCfg = Release lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release lib.Build.0 = Release lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode.Build.0 = Release Unicode|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug.ActiveCfg = Debug|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug.Build.0 = Debug|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug lib.ActiveCfg = Debug lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug lib.Build.0 = Debug lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release.ActiveCfg = Release|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release.Build.0 = Release|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release lib.ActiveCfg = Release lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release lib.Build.0 = Release lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode.Build.0 = Release Unicode|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug.ActiveCfg = Debug|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug.Build.0 = Debug|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug lib.ActiveCfg = Debug lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug lib.Build.0 = Debug lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release.ActiveCfg = Release|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release.Build.0 = Release|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release lib.ActiveCfg = Release lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release lib.Build.0 = Release lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode.Build.0 = Release Unicode|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug.ActiveCfg = Debug|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug.Build.0 = Debug|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug lib.ActiveCfg = Debug lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug lib.Build.0 = Debug lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release.ActiveCfg = Release|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release.Build.0 = Release|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release lib.ActiveCfg = Release lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release lib.Build.0 = Release lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode.Build.0 = Release Unicode|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug.ActiveCfg = Debug|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug.Build.0 = Debug|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug lib.ActiveCfg = Debug lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug lib.Build.0 = Debug lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release.ActiveCfg = Release|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release.Build.0 = Release|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release lib.ActiveCfg = Release lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release lib.Build.0 = Release lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode.Build.0 = Release Unicode|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug.ActiveCfg = Debug|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug.Build.0 = Debug|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug lib.ActiveCfg = Debug lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug lib.Build.0 = Debug lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release.ActiveCfg = Release|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release.Build.0 = Release|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release lib.ActiveCfg = Release lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release lib.Build.0 = Release lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode.Build.0 = Release Unicode|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug.ActiveCfg = Debug|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug.Build.0 = Debug|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug lib.ActiveCfg = Debug lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug lib.Build.0 = Debug lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release.ActiveCfg = Release|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release.Build.0 = Release|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release lib.ActiveCfg = Release lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release lib.Build.0 = Release lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode.Build.0 = Release Unicode|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug.ActiveCfg = Debug|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug.Build.0 = Debug|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug lib.ActiveCfg = Debug lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug lib.Build.0 = Debug lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release.ActiveCfg = Release|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release.Build.0 = Release|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release lib.ActiveCfg = Release lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release lib.Build.0 = Release lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode.Build.0 = Release Unicode|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug.ActiveCfg = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug.Build.0 = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug lib.ActiveCfg = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug lib.Build.0 = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode.ActiveCfg = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode.Build.0 = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode lib.Build.0 = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release.ActiveCfg = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release.Build.0 = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release lib.ActiveCfg = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release lib.Build.0 = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode.ActiveCfg = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode.Build.0 = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode lib.ActiveCfg = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode lib.Build.0 = Release|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug.ActiveCfg = Debug|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug.Build.0 = Debug|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug lib.ActiveCfg = Debug lib|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug lib.Build.0 = Debug lib|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Release.ActiveCfg = Release|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Release.Build.0 = Release|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Release lib.ActiveCfg = Release lib|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Release lib.Build.0 = Release lib|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode.Build.0 = Release Unicode|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {23E1898F-8262-435C-8848-D4D8824E6D71}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug.ActiveCfg = Debug|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug.Build.0 = Debug|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug lib.ActiveCfg = Debug|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug lib.Build.0 = Debug|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode.ActiveCfg = Debug|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode.Build.0 = Debug|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Debug Unicode lib.Build.0 = Debug|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release.ActiveCfg = Release|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release.Build.0 = Release|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release lib.ActiveCfg = Release|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release lib.Build.0 = Release|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode.ActiveCfg = Release|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode.Build.0 = Release|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode lib.ActiveCfg = Release|Win32
+ {2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}.Release Unicode lib.Build.0 = Release|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug.ActiveCfg = Debug|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug.Build.0 = Debug|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug lib.ActiveCfg = Debug lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug lib.Build.0 = Debug lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release.ActiveCfg = Release|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release.Build.0 = Release|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release lib.ActiveCfg = Release lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release lib.Build.0 = Release lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode.Build.0 = Release Unicode|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug.ActiveCfg = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug.Build.0 = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug lib.ActiveCfg = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug lib.Build.0 = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode.ActiveCfg = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode.Build.0 = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode lib.Build.0 = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release.ActiveCfg = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release.Build.0 = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release lib.ActiveCfg = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release lib.Build.0 = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode.ActiveCfg = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode.Build.0 = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode lib.ActiveCfg = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode lib.Build.0 = Release|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug.ActiveCfg = Debug|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug.Build.0 = Debug|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug lib.ActiveCfg = Debug lib|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug lib.Build.0 = Debug lib|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release.ActiveCfg = Release|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release.Build.0 = Release|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release lib.ActiveCfg = Release lib|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release lib.Build.0 = Release lib|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode.Build.0 = Release Unicode|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {E776D3C2-5BFA-41B9-B998-A35B549AF737}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug.ActiveCfg = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug.Build.0 = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug lib.ActiveCfg = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug lib.Build.0 = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode.ActiveCfg = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode.Build.0 = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode lib.Build.0 = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release.ActiveCfg = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release.Build.0 = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release lib.ActiveCfg = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release lib.Build.0 = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode.ActiveCfg = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode.Build.0 = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode lib.ActiveCfg = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode lib.Build.0 = Release|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug.ActiveCfg = Debug|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug.Build.0 = Debug|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug lib.ActiveCfg = Debug lib|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug lib.Build.0 = Debug lib|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release.ActiveCfg = Release|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release.Build.0 = Release|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release lib.ActiveCfg = Release lib|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release lib.Build.0 = Release lib|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode.Build.0 = Release Unicode|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {4628C665-EDE4-40D2-B525-32BE8B8551C8}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug.ActiveCfg = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug.Build.0 = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug lib.ActiveCfg = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug lib.Build.0 = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode.ActiveCfg = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode.Build.0 = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode lib.Build.0 = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release.ActiveCfg = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release.Build.0 = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release lib.ActiveCfg = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release lib.Build.0 = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode.ActiveCfg = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode.Build.0 = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode lib.ActiveCfg = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode lib.Build.0 = Release|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug.ActiveCfg = Debug|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug.Build.0 = Debug|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug lib.ActiveCfg = Debug lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug lib.Build.0 = Debug lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release.ActiveCfg = Release|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release.Build.0 = Release|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release lib.ActiveCfg = Release lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release lib.Build.0 = Release lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode.Build.0 = Release Unicode|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug.ActiveCfg = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug.Build.0 = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug lib.ActiveCfg = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug lib.Build.0 = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode.ActiveCfg = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode.Build.0 = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode lib.Build.0 = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release.ActiveCfg = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release.Build.0 = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release lib.ActiveCfg = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release lib.Build.0 = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode.ActiveCfg = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode.Build.0 = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode lib.ActiveCfg = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode lib.Build.0 = Release|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug.ActiveCfg = Debug|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug.Build.0 = Debug|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug lib.ActiveCfg = Debug lib|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug lib.Build.0 = Debug lib|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release.ActiveCfg = Release|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release.Build.0 = Release|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release lib.ActiveCfg = Release lib|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release lib.Build.0 = Release lib|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode.Build.0 = Release Unicode|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {C0F7A036-FC2D-40DF-9852-C37518DB6B3E}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug.ActiveCfg = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug.Build.0 = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug lib.ActiveCfg = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug lib.Build.0 = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release.ActiveCfg = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release.Build.0 = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release lib.ActiveCfg = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release lib.Build.0 = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug.ActiveCfg = Debug|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug.Build.0 = Debug|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug lib.ActiveCfg = Debug lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug lib.Build.0 = Debug lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release.ActiveCfg = Release|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release.Build.0 = Release|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release lib.ActiveCfg = Release lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release lib.Build.0 = Release lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode.Build.0 = Release Unicode|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug.ActiveCfg = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug.Build.0 = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug lib.ActiveCfg = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug lib.Build.0 = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release.ActiveCfg = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release.Build.0 = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release lib.ActiveCfg = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release lib.Build.0 = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug.ActiveCfg = Debug|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug.Build.0 = Debug|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug lib.ActiveCfg = Debug lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug lib.Build.0 = Debug lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release.ActiveCfg = Release|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release.Build.0 = Release|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release lib.ActiveCfg = Release lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release lib.Build.0 = Release lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode.Build.0 = Release Unicode|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug.ActiveCfg = Debug|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug.Build.0 = Debug|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug lib.ActiveCfg = Debug lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug lib.Build.0 = Debug lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release.ActiveCfg = Release|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release.Build.0 = Release|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release lib.ActiveCfg = Release lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release lib.Build.0 = Release lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode.Build.0 = Release Unicode|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug.ActiveCfg = Debug|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug.Build.0 = Debug|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug lib.ActiveCfg = Debug lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug lib.Build.0 = Debug lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release.ActiveCfg = Release|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release.Build.0 = Release|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release lib.ActiveCfg = Release lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release lib.Build.0 = Release lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode.Build.0 = Release Unicode|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug.ActiveCfg = Debug|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug.Build.0 = Debug|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug lib.ActiveCfg = Debug lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug lib.Build.0 = Debug lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release.ActiveCfg = Release|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release.Build.0 = Release|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release lib.ActiveCfg = Release lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release lib.Build.0 = Release lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode.Build.0 = Release Unicode|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/filters.suo b/src/filters/filters.suo
new file mode 100644
index 000000000..594131357
--- /dev/null
+++ b/src/filters/filters.suo
Binary files differ
diff --git a/src/filters/muxer/basemuxer/BaseMuxer.cpp b/src/filters/muxer/basemuxer/BaseMuxer.cpp
new file mode 100644
index 000000000..004c4c48a
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxer.cpp
@@ -0,0 +1,436 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "BaseMuxer.h"
+
+//
+// CBaseMuxerFilter
+//
+
+CBaseMuxerFilter::CBaseMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
+ : CBaseFilter(NAME("CBaseMuxerFilter"), pUnk, this, clsid)
+ , m_rtCurrent(0)
+{
+ if(phr) *phr = S_OK;
+ m_pOutput.Attach(new CBaseMuxerOutputPin(L"Output", this, this, phr));
+ AddInput();
+}
+
+CBaseMuxerFilter::~CBaseMuxerFilter()
+{
+}
+
+STDMETHODIMP CBaseMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ *ppv = NULL;
+
+ return
+ QI(IMediaSeeking)
+ QI(IPropertyBag)
+ QI(IPropertyBag2)
+ QI(IDSMPropertyBag)
+ QI(IDSMResourceBag)
+ QI(IDSMChapterBag)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+//
+
+void CBaseMuxerFilter::AddInput()
+{
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CBasePin* pPin = m_pInputs.GetNext(pos);
+ if(!pPin->IsConnected()) return;
+ }
+
+ CStringW name;
+
+ name.Format(L"Input %d", m_pInputs.GetCount()+1);
+
+ CBaseMuxerInputPin* pInputPin = NULL;
+ if(FAILED(CreateInput(name, &pInputPin)) || !pInputPin) {ASSERT(0); return;}
+ CAutoPtr<CBaseMuxerInputPin> pAutoPtrInputPin(pInputPin);
+
+ name.Format(L"~Output %d", m_pRawOutputs.GetCount()+1);
+
+ CBaseMuxerRawOutputPin* pRawOutputPin = NULL;
+ if(FAILED(CreateRawOutput(name, &pRawOutputPin)) || !pRawOutputPin) {ASSERT(0); return;}
+ CAutoPtr<CBaseMuxerRawOutputPin> pAutoPtrRawOutputPin(pRawOutputPin);
+
+ pInputPin->SetRelatedPin(pRawOutputPin);
+ pRawOutputPin->SetRelatedPin(pInputPin);
+
+ m_pInputs.AddTail(pAutoPtrInputPin);
+ m_pRawOutputs.AddTail(pAutoPtrRawOutputPin);
+}
+
+HRESULT CBaseMuxerFilter::CreateInput(CStringW name, CBaseMuxerInputPin** ppPin)
+{
+ CheckPointer(ppPin, E_POINTER);
+ HRESULT hr = S_OK;
+ *ppPin = new CBaseMuxerInputPin(name, this, this, &hr);
+ return hr;
+}
+
+HRESULT CBaseMuxerFilter::CreateRawOutput(CStringW name, CBaseMuxerRawOutputPin** ppPin)
+{
+ CheckPointer(ppPin, E_POINTER);
+ HRESULT hr = S_OK;
+ *ppPin = new CBaseMuxerRawOutputPin(name, this, this, &hr);
+ return hr;
+}
+
+//
+
+DWORD CBaseMuxerFilter::ThreadProc()
+{
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_ABOVE_NORMAL);
+
+ POSITION pos;
+
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+
+ switch(cmd)
+ {
+ default:
+ case CMD_EXIT:
+ CAMThread::m_hThread = NULL;
+ Reply(S_OK);
+ return 0;
+
+ case CMD_RUN:
+ m_pActivePins.RemoveAll();
+ m_pPins.RemoveAll();
+
+ pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CBaseMuxerInputPin* pPin = m_pInputs.GetNext(pos);
+ if(pPin->IsConnected())
+ {
+ m_pActivePins.AddTail(pPin);
+ m_pPins.AddTail(pPin);
+ }
+ }
+
+ m_rtCurrent = 0;
+
+ Reply(S_OK);
+
+ MuxInit();
+
+ try
+ {
+ MuxHeaderInternal();
+
+ while(!CheckRequest(NULL) && m_pActivePins.GetCount())
+ {
+ if(m_State == State_Paused) {Sleep(10); continue;}
+
+ CAutoPtr<MuxerPacket> pPacket = GetPacket();
+ if(!pPacket) {Sleep(1); continue;}
+
+ if(pPacket->IsTimeValid())
+ m_rtCurrent = pPacket->rtStart;
+
+ if(pPacket->IsEOS())
+ m_pActivePins.RemoveAt(m_pActivePins.Find(pPacket->pPin));
+
+ MuxPacketInternal(pPacket);
+ }
+
+ MuxFooterInternal();
+ }
+ catch(HRESULT hr)
+ {
+ CComQIPtr<IMediaEventSink>(m_pGraph)->Notify(EC_ERRORABORT, hr, 0);
+ }
+
+ m_pOutput->DeliverEndOfStream();
+
+ pos = m_pRawOutputs.GetHeadPosition();
+ while(pos) m_pRawOutputs.GetNext(pos)->DeliverEndOfStream();
+
+ m_pActivePins.RemoveAll();
+ m_pPins.RemoveAll();
+
+ break;
+ }
+ }
+
+ ASSERT(0); // this function should only return via CMD_EXIT
+
+ CAMThread::m_hThread = NULL;
+ return 0;
+}
+
+void CBaseMuxerFilter::MuxHeaderInternal()
+{
+ TRACE(_T("MuxHeader\n"));
+
+ if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
+ MuxHeader(pBitStream);
+
+ MuxHeader();
+
+ //
+
+ POSITION pos = m_pPins.GetHeadPosition();
+ while(pos)
+ {
+ if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
+ if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
+ pOutput->MuxHeader(pInput->CurrentMediaType());
+ }
+}
+
+void CBaseMuxerFilter::MuxPacketInternal(const MuxerPacket* pPacket)
+{
+ TRACE(_T("MuxPacket pPin=%x, size=%d, s%d e%d b%d, rt=(%I64d-%I64d)\n"),
+ pPacket->pPin->GetID(),
+ pPacket->pData.GetCount(),
+ !!(pPacket->flags & MuxerPacket::syncpoint),
+ !!(pPacket->flags & MuxerPacket::eos),
+ !!(pPacket->flags & MuxerPacket::bogus),
+ pPacket->rtStart/10000, pPacket->rtStop/10000);
+
+ if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
+ MuxPacket(pBitStream, pPacket);
+
+ MuxPacket(pPacket);
+
+ if(CBaseMuxerInputPin* pInput = pPacket->pPin)
+ if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
+ pOutput->MuxPacket(pInput->CurrentMediaType(), pPacket);
+}
+
+void CBaseMuxerFilter::MuxFooterInternal()
+{
+ TRACE(_T("MuxFooter\n"));
+
+ if(CComQIPtr<IBitStream> pBitStream = m_pOutput->GetBitStream())
+ MuxFooter(pBitStream);
+
+ MuxFooter();
+
+ //
+
+ POSITION pos = m_pPins.GetHeadPosition();
+ while(pos)
+ {
+ if(CBaseMuxerInputPin* pInput = m_pPins.GetNext(pos))
+ if(CBaseMuxerRawOutputPin* pOutput = dynamic_cast<CBaseMuxerRawOutputPin*>(pInput->GetRelatedPin()))
+ pOutput->MuxFooter(pInput->CurrentMediaType());
+ }
+}
+
+CAutoPtr<MuxerPacket> CBaseMuxerFilter::GetPacket()
+{
+ REFERENCE_TIME rtMin = _I64_MAX;
+ CBaseMuxerInputPin* pPinMin = NULL;
+ int i = m_pActivePins.GetCount();
+
+ POSITION pos = m_pActivePins.GetHeadPosition();
+ while(pos)
+ {
+ CBaseMuxerInputPin* pPin = m_pActivePins.GetNext(pos);
+
+ CAutoLock cAutoLock(&pPin->m_csQueue);
+ if(!pPin->m_queue.GetCount()) continue;
+
+ MuxerPacket* p = pPin->m_queue.GetHead();
+
+ if(p->IsBogus() || !p->IsTimeValid() || p->IsEOS())
+ {
+ pPinMin = pPin;
+ i = 0;
+ break;
+ }
+
+ if(p->rtStart < rtMin)
+ {
+ rtMin = p->rtStart;
+ pPinMin = pPin;
+ }
+
+ i--;
+ }
+
+ CAutoPtr<MuxerPacket> pPacket;
+
+ if(pPinMin && i == 0)
+ {
+ pPacket = pPinMin->PopPacket();
+ }
+ else
+ {
+ pos = m_pActivePins.GetHeadPosition();
+ while(pos) m_pActivePins.GetNext(pos)->m_evAcceptPacket.Set();
+ }
+
+ return pPacket;
+}
+
+//
+
+int CBaseMuxerFilter::GetPinCount()
+{
+ return m_pInputs.GetCount() + (m_pOutput ? 1 : 0) + m_pRawOutputs.GetCount();
+}
+
+CBasePin* CBaseMuxerFilter::GetPin(int n)
+{
+ CAutoLock cAutoLock(this);
+
+ if(n >= 0 && n < (int)m_pInputs.GetCount())
+ {
+ if(POSITION pos = m_pInputs.FindIndex(n))
+ return m_pInputs.GetAt(pos);
+ }
+
+ n -= m_pInputs.GetCount();
+
+ if(n == 0 && m_pOutput)
+ {
+ return m_pOutput;
+ }
+
+ n--;
+
+ if(n >= 0 && n < (int)m_pRawOutputs.GetCount())
+ {
+ if(POSITION pos = m_pRawOutputs.FindIndex(n))
+ return m_pRawOutputs.GetAt(pos);
+ }
+
+ n -= m_pRawOutputs.GetCount();
+
+ return NULL;
+}
+
+STDMETHODIMP CBaseMuxerFilter::Stop()
+{
+ CAutoLock cAutoLock(this);
+
+ HRESULT hr = __super::Stop();
+ if(FAILED(hr)) return hr;
+
+ CallWorker(CMD_EXIT);
+
+ return hr;
+}
+
+STDMETHODIMP CBaseMuxerFilter::Pause()
+{
+ CAutoLock cAutoLock(this);
+
+ FILTER_STATE fs = m_State;
+
+ HRESULT hr = __super::Pause();
+ if(FAILED(hr)) return hr;
+
+ if(fs == State_Stopped && m_pOutput)
+ {
+ CAMThread::Create();
+ CallWorker(CMD_RUN);
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CBaseMuxerFilter::Run(REFERENCE_TIME tStart)
+{
+ CAutoLock cAutoLock(this);
+
+ HRESULT hr = __super::Run(tStart);
+ if(FAILED(hr)) return hr;
+
+ return hr;
+}
+
+// IMediaSeeking
+
+STDMETHODIMP CBaseMuxerFilter::GetCapabilities(DWORD* pCapabilities)
+{
+ return pCapabilities ? *pCapabilities = AM_SEEKING_CanGetDuration|AM_SEEKING_CanGetCurrentPos, S_OK : E_POINTER;
+}
+STDMETHODIMP CBaseMuxerFilter::CheckCapabilities(DWORD* pCapabilities)
+{
+ CheckPointer(pCapabilities, E_POINTER);
+ if(*pCapabilities == 0) return S_OK;
+ DWORD caps;
+ GetCapabilities(&caps);
+ caps &= *pCapabilities;
+ return caps == 0 ? E_FAIL : caps == *pCapabilities ? S_OK : S_FALSE;
+}
+STDMETHODIMP CBaseMuxerFilter::IsFormatSupported(const GUID* pFormat) {return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;}
+STDMETHODIMP CBaseMuxerFilter::QueryPreferredFormat(GUID* pFormat) {return GetTimeFormat(pFormat);}
+STDMETHODIMP CBaseMuxerFilter::GetTimeFormat(GUID* pFormat) {return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;}
+STDMETHODIMP CBaseMuxerFilter::IsUsingTimeFormat(const GUID* pFormat) {return IsFormatSupported(pFormat);}
+STDMETHODIMP CBaseMuxerFilter::SetTimeFormat(const GUID* pFormat) {return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;}
+STDMETHODIMP CBaseMuxerFilter::GetDuration(LONGLONG* pDuration)
+{
+ CheckPointer(pDuration, E_POINTER);
+ *pDuration = 0;
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos) {REFERENCE_TIME rt = m_pInputs.GetNext(pos)->GetDuration(); if(rt > *pDuration) *pDuration = rt;}
+ return S_OK;
+}
+STDMETHODIMP CBaseMuxerFilter::GetStopPosition(LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::GetCurrentPosition(LONGLONG* pCurrent)
+{
+ CheckPointer(pCurrent, E_POINTER);
+ *pCurrent = m_rtCurrent;
+ return S_OK;
+}
+STDMETHODIMP CBaseMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
+{
+ FILTER_STATE fs;
+
+ if(SUCCEEDED(GetState(0, &fs)) && fs == State_Stopped)
+ {
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CBasePin* pPin = m_pInputs.GetNext(pos);
+ CComQIPtr<IMediaSeeking> pMS = pPin->GetConnected();
+ if(!pMS) pMS = GetFilterFromPin(pPin->GetConnected());
+ if(pMS) pMS->SetPositions(pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+ }
+
+ return S_OK;
+ }
+
+ return VFW_E_WRONG_STATE;
+}
+STDMETHODIMP CBaseMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::SetRate(double dRate) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::GetRate(double* pdRate) {return E_NOTIMPL;}
+STDMETHODIMP CBaseMuxerFilter::GetPreroll(LONGLONG* pllPreroll) {return E_NOTIMPL;}
diff --git a/src/filters/muxer/basemuxer/BaseMuxer.h b/src/filters/muxer/basemuxer/BaseMuxer.h
new file mode 100644
index 000000000..71aed60fa
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxer.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "BaseMuxerInputPin.h"
+#include "BaseMuxerOutputPin.h"
+
+class CBaseMuxerFilter
+ : public CBaseFilter
+ , public CCritSec
+ , public CAMThread
+ , public IMediaSeeking
+ , public IDSMPropertyBagImpl
+ , public IDSMResourceBagImpl
+ , public IDSMChapterBagImpl
+{
+private:
+ CAutoPtrList<CBaseMuxerInputPin> m_pInputs;
+ CAutoPtr<CBaseMuxerOutputPin> m_pOutput;
+ CAutoPtrList<CBaseMuxerRawOutputPin> m_pRawOutputs;
+
+ enum {CMD_EXIT, CMD_RUN};
+ DWORD ThreadProc();
+
+ REFERENCE_TIME m_rtCurrent;
+ CAtlList<CBaseMuxerInputPin*> m_pActivePins;
+
+ CAutoPtr<MuxerPacket> GetPacket();
+
+ void MuxHeaderInternal();
+ void MuxPacketInternal(const MuxerPacket* pPacket);
+ void MuxFooterInternal();
+
+protected:
+ CAtlList<CBaseMuxerInputPin*> m_pPins;
+ CBaseMuxerOutputPin* GetOutputPin() {return m_pOutput;}
+
+ virtual void MuxInit() = 0;
+
+ // only called when the output pin is connected
+ virtual void MuxHeader(IBitStream* pBS) {}
+ virtual void MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket) {}
+ virtual void MuxFooter(IBitStream* pBS) {}
+
+ // always called (useful if the derived class wants to write somewhere else than downstream)
+ virtual void MuxHeader() {}
+ virtual void MuxPacket(const MuxerPacket* pPacket) {}
+ virtual void MuxFooter() {}
+
+ // allows customized pins in derived classes
+ virtual HRESULT CreateInput(CStringW name, CBaseMuxerInputPin** ppPin);
+ virtual HRESULT CreateRawOutput(CStringW name, CBaseMuxerRawOutputPin** ppPin);
+
+public:
+ CBaseMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid);
+ virtual ~CBaseMuxerFilter();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ void AddInput();
+
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+
+ STDMETHODIMP Stop();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Run(REFERENCE_TIME tStart);
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+};
+
diff --git a/src/filters/muxer/basemuxer/BaseMuxer.sln b/src/filters/muxer/basemuxer/BaseMuxer.sln
new file mode 100644
index 000000000..71a0b56e8
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxer.sln
@@ -0,0 +1,40 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseMuxer", "BaseMuxer.vcproj", "{DB5F93B2-54D0-4474-A588-D259BE36C832}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug lib = Debug lib
+ Debug Unicode lib = Debug Unicode lib
+ Release lib = Release lib
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug lib.ActiveCfg = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug lib.Build.0 = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release lib.ActiveCfg = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release lib.Build.0 = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/muxer/basemuxer/BaseMuxer.vcproj b/src/filters/muxer/basemuxer/BaseMuxer.vcproj
new file mode 100644
index 000000000..432126829
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxer.vcproj
@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="BaseMuxer"
+ ProjectGUID="{DB5F93B2-54D0-4474-A588-D259BE36C832}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="BaseMuxer.cpp">
+ </File>
+ <File
+ RelativePath=".\BaseMuxerInputPin.cpp">
+ </File>
+ <File
+ RelativePath=".\BaseMuxerOutputPin.cpp">
+ </File>
+ <File
+ RelativePath=".\BaseMuxerRelatedPin.cpp">
+ </File>
+ <File
+ RelativePath=".\BitStream.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="BaseMuxer.h">
+ </File>
+ <File
+ RelativePath=".\BaseMuxerInputPin.h">
+ </File>
+ <File
+ RelativePath=".\BaseMuxerOutputPin.h">
+ </File>
+ <File
+ RelativePath=".\BaseMuxerRelatedPin.h">
+ </File>
+ <File
+ RelativePath=".\BitStream.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="1"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/muxer/basemuxer/BaseMuxerInputPin.cpp b/src/filters/muxer/basemuxer/BaseMuxerInputPin.cpp
new file mode 100644
index 000000000..181328cc6
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxerInputPin.cpp
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include "BaseMuxer.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#define MAXQUEUESIZE 100
+
+//
+// CBaseMuxerInputPin
+//
+
+CBaseMuxerInputPin::CBaseMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseInputPin(NAME("CBaseMuxerInputPin"), pFilter, pLock, phr, pName)
+ , m_rtDuration(0)
+ , m_evAcceptPacket(TRUE)
+ , m_iPacketIndex(0)
+{
+ static int s_iID = 0;
+ m_iID = s_iID++;
+}
+
+CBaseMuxerInputPin::~CBaseMuxerInputPin()
+{
+}
+
+STDMETHODIMP CBaseMuxerInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IBaseMuxerRelatedPin)
+ QI(IPropertyBag)
+ QI(IPropertyBag2)
+ QI(IDSMPropertyBag)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+bool CBaseMuxerInputPin::IsSubtitleStream()
+{
+ return m_mt.majortype == MEDIATYPE_Subtitle || m_mt.majortype == MEDIATYPE_Text;
+}
+
+void CBaseMuxerInputPin::PushPacket(CAutoPtr<MuxerPacket> pPacket)
+{
+ for(int i = 0; m_pFilter->IsActive() && !m_bFlushing
+ && !m_evAcceptPacket.Wait(1)
+ && i < 1000;
+ i++);
+
+ if(!m_pFilter->IsActive() || m_bFlushing)
+ return;
+
+ CAutoLock cAutoLock(&m_csQueue);
+
+ m_queue.AddTail(pPacket);
+
+ if(m_queue.GetCount() >= MAXQUEUESIZE)
+ m_evAcceptPacket.Reset();
+}
+
+CAutoPtr<MuxerPacket> CBaseMuxerInputPin::PopPacket()
+{
+ CAutoPtr<MuxerPacket> pPacket;
+
+ CAutoLock cAutoLock(&m_csQueue);
+
+ if(m_queue.GetCount())
+ pPacket = m_queue.RemoveHead();
+
+ if(m_queue.GetCount() < MAXQUEUESIZE)
+ m_evAcceptPacket.Set();
+
+ return pPacket;
+}
+
+HRESULT CBaseMuxerInputPin::CheckMediaType(const CMediaType* pmt)
+{
+ if(pmt->formattype == FORMAT_WaveFormatEx)
+ {
+ WORD wFormatTag = ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag;
+ if((wFormatTag == WAVE_FORMAT_PCM
+ || wFormatTag == WAVE_FORMAT_EXTENSIBLE
+ || wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
+ && pmt->subtype != FOURCCMap(wFormatTag)
+ && !(pmt->subtype == MEDIASUBTYPE_PCM && wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ && !(pmt->subtype == MEDIASUBTYPE_PCM && wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
+ && pmt->subtype != MEDIASUBTYPE_DVD_LPCM_AUDIO
+ && pmt->subtype != MEDIASUBTYPE_DOLBY_AC3
+ && pmt->subtype != MEDIASUBTYPE_DTS)
+ {
+ return E_INVALIDARG;
+ }
+ }
+
+ return pmt->majortype == MEDIATYPE_Video
+ || pmt->majortype == MEDIATYPE_Audio && pmt->formattype != FORMAT_VorbisFormat
+ || pmt->majortype == MEDIATYPE_Text && pmt->subtype == MEDIASUBTYPE_NULL && pmt->formattype == FORMAT_None
+ || pmt->majortype == MEDIATYPE_Subtitle
+ ? S_OK
+ : E_INVALIDARG;
+}
+
+HRESULT CBaseMuxerInputPin::BreakConnect()
+{
+ HRESULT hr = __super::BreakConnect();
+ if(FAILED(hr)) return hr;
+
+ RemoveAll();
+
+ // TODO: remove extra disconnected pins, leave one
+
+ return hr;
+}
+
+HRESULT CBaseMuxerInputPin::CompleteConnect(IPin* pReceivePin)
+{
+ HRESULT hr = __super::CompleteConnect(pReceivePin);
+ if(FAILED(hr)) return hr;
+
+ // duration
+
+ m_rtDuration = 0;
+ CComQIPtr<IMediaSeeking> pMS;
+ if((pMS = GetFilterFromPin(pReceivePin)) || (pMS = pReceivePin))
+ pMS->GetDuration(&m_rtDuration);
+
+ // properties
+
+ for(CComPtr<IPin> pPin = pReceivePin; pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin)))
+ {
+ if(CComQIPtr<IDSMPropertyBag> pPB = pPin)
+ {
+ ULONG cProperties = 0;
+ if(SUCCEEDED(pPB->CountProperties(&cProperties)) && cProperties > 0)
+ {
+ for(ULONG iProperty = 0; iProperty < cProperties; iProperty++)
+ {
+ PROPBAG2 PropBag;
+ memset(&PropBag, 0, sizeof(PropBag));
+ ULONG cPropertiesReturned = 0;
+ if(FAILED(pPB->GetPropertyInfo(iProperty, 1, &PropBag, &cPropertiesReturned)))
+ continue;
+
+ HRESULT hr;
+ CComVariant var;
+ if(SUCCEEDED(pPB->Read(1, &PropBag, NULL, &var, &hr)) && SUCCEEDED(hr))
+ SetProperty(PropBag.pstrName, &var);
+
+ CoTaskMemFree(PropBag.pstrName);
+ }
+ }
+ }
+ }
+
+ ((CBaseMuxerFilter*)m_pFilter)->AddInput();
+
+ return S_OK;
+}
+
+HRESULT CBaseMuxerInputPin::Active()
+{
+ m_rtMaxStart = _I64_MIN;
+ m_fEOS = false;
+ m_iPacketIndex = 0;
+ m_evAcceptPacket.Set();
+ return __super::Active();
+}
+
+HRESULT CBaseMuxerInputPin::Inactive()
+{
+ CAutoLock cAutoLock(&m_csQueue);
+ m_queue.RemoveAll();
+ return __super::Inactive();
+}
+
+STDMETHODIMP CBaseMuxerInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ return __super::NewSegment(tStart, tStop, dRate);
+}
+
+STDMETHODIMP CBaseMuxerInputPin::Receive(IMediaSample* pSample)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr = __super::Receive(pSample);
+ if(FAILED(hr)) return hr;
+
+ CAutoPtr<MuxerPacket> pPacket(new MuxerPacket(this));
+
+ long len = pSample->GetActualDataLength();
+
+ BYTE* pData = NULL;
+ if(FAILED(pSample->GetPointer(&pData)) || !pData)
+ return S_OK;
+
+ pPacket->pData.SetCount(len);
+ memcpy(pPacket->pData.GetData(), pData, len);
+
+ if(S_OK == pSample->IsSyncPoint() || m_mt.majortype == MEDIATYPE_Audio && !m_mt.bTemporalCompression)
+ {
+ pPacket->flags |= MuxerPacket::syncpoint;
+ }
+
+ if(S_OK == pSample->GetTime(&pPacket->rtStart, &pPacket->rtStop))
+ {
+ pPacket->flags |= MuxerPacket::timevalid;
+
+ pPacket->rtStart += m_tStart;
+ pPacket->rtStop += m_tStart;
+
+ if((pPacket->flags & MuxerPacket::syncpoint) && pPacket->rtStart < m_rtMaxStart)
+ {
+ pPacket->flags &= ~MuxerPacket::syncpoint;
+ pPacket->flags |= MuxerPacket::bogus;
+ }
+
+ m_rtMaxStart = max(m_rtMaxStart, pPacket->rtStart);
+ }
+ else if(pPacket->flags & MuxerPacket::syncpoint)
+ {
+ pPacket->flags &= ~MuxerPacket::syncpoint;
+ pPacket->flags |= MuxerPacket::bogus;
+ }
+
+ if(S_OK == pSample->IsDiscontinuity())
+ {
+ pPacket->flags |= MuxerPacket::discontinuity;
+ }
+
+ pPacket->index = m_iPacketIndex++;
+
+ PushPacket(pPacket);
+
+ return S_OK;
+}
+
+STDMETHODIMP CBaseMuxerInputPin::EndOfStream()
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr = __super::EndOfStream();
+ if(FAILED(hr)) return hr;
+
+ ASSERT(!m_fEOS);
+
+ CAutoPtr<MuxerPacket> pPacket(new MuxerPacket(this));
+ pPacket->flags |= MuxerPacket::eos;
+ PushPacket(pPacket);
+
+ m_fEOS = true;
+
+ return hr;
+}
+
diff --git a/src/filters/muxer/basemuxer/BaseMuxerInputPin.h b/src/filters/muxer/basemuxer/BaseMuxerInputPin.h
new file mode 100644
index 000000000..cdae44041
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxerInputPin.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "BaseMuxerRelatedPin.h"
+#include "..\..\..\DSUtil\DSMPropertyBag.h"
+
+class CBaseMuxerInputPin;
+
+struct MuxerPacket
+{
+ CBaseMuxerInputPin* pPin;
+ REFERENCE_TIME rtStart, rtStop;
+ CAtlArray<BYTE> pData;
+ enum flag_t {empty = 0, timevalid = 1, syncpoint = 2, discontinuity = 4, eos = 8, bogus = 16};
+ DWORD flags;
+ int index;
+ struct MuxerPacket(CBaseMuxerInputPin* pPin) {this->pPin = pPin; rtStart = rtStop = _I64_MIN; flags = empty; index = -1;}
+ bool IsTimeValid() const {return !!(flags & timevalid);}
+ bool IsSyncPoint() const {return !!(flags & syncpoint);}
+ bool IsDiscontinuity() const {return !!(flags & discontinuity);}
+ bool IsEOS() const {return !!(flags & eos);}
+ bool IsBogus() const {return !!(flags & bogus);}
+};
+
+class CBaseMuxerInputPin : public CBaseInputPin, public CBaseMuxerRelatedPin, public IDSMPropertyBagImpl
+{
+private:
+ int m_iID;
+
+ CCritSec m_csReceive;
+ REFERENCE_TIME m_rtMaxStart, m_rtDuration;
+ bool m_fEOS;
+ int m_iPacketIndex;
+
+ CCritSec m_csQueue;
+ CAutoPtrList<MuxerPacket> m_queue;
+ void PushPacket(CAutoPtr<MuxerPacket> pPacket);
+ CAutoPtr<MuxerPacket> PopPacket();
+ CAMEvent m_evAcceptPacket;
+
+ friend class CBaseMuxerFilter;
+
+public:
+ CBaseMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CBaseMuxerInputPin();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ REFERENCE_TIME GetDuration() {return m_rtDuration;}
+ int GetID() {return m_iID;}
+ CMediaType& CurrentMediaType() {return m_mt;}
+ bool IsSubtitleStream();
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pReceivePin);
+
+ HRESULT Active();
+ HRESULT Inactive();
+
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ STDMETHODIMP Receive(IMediaSample* pSample);
+ STDMETHODIMP EndOfStream();
+};
diff --git a/src/filters/muxer/basemuxer/BaseMuxerOutputPin.cpp b/src/filters/muxer/basemuxer/BaseMuxerOutputPin.cpp
new file mode 100644
index 000000000..1818ecfe6
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxerOutputPin.cpp
@@ -0,0 +1,476 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "BaseMuxerOutputPin.h"
+
+#include <mmreg.h>
+#include <aviriff.h>
+#include <atlpath.h>
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+//
+// CBaseMuxerOutputPin
+//
+
+CBaseMuxerOutputPin::CBaseMuxerOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseOutputPin(_T("CBaseMuxerOutputPin"), pFilter, pLock, phr, pName)
+{
+}
+
+IBitStream* CBaseMuxerOutputPin::GetBitStream()
+{
+ if(!m_pBitStream)
+ {
+ if(CComQIPtr<IStream> pStream = GetConnected())
+ {
+ m_pBitStream = new CBitStream(pStream, true);
+ }
+ }
+
+ return m_pBitStream;
+}
+
+HRESULT CBaseMuxerOutputPin::BreakConnect()
+{
+ m_pBitStream = NULL;
+
+ return __super::BreakConnect();
+}
+
+HRESULT CBaseMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 1;
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
+
+ return NOERROR;
+}
+
+HRESULT CBaseMuxerOutputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_NULL
+ ? S_OK
+ : E_INVALIDARG;
+}
+
+HRESULT CBaseMuxerOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ CAutoLock cAutoLock(m_pLock);
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pmt->ResetFormatBuffer();
+ pmt->InitMediaType();
+ pmt->majortype = MEDIATYPE_Stream;
+ pmt->subtype = MEDIASUBTYPE_NULL;
+ pmt->formattype = FORMAT_None;
+
+ return S_OK;
+}
+
+HRESULT CBaseMuxerOutputPin::DeliverEndOfStream()
+{
+ m_pBitStream = NULL;
+
+ return __super::DeliverEndOfStream();
+}
+
+STDMETHODIMP CBaseMuxerOutputPin::Notify(IBaseFilter* pSender, Quality q)
+{
+ return E_NOTIMPL;
+}
+
+//
+// CBaseMuxerRawOutputPin
+//
+
+CBaseMuxerRawOutputPin::CBaseMuxerRawOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseMuxerOutputPin(pName, pFilter, pLock, phr)
+{
+}
+
+STDMETHODIMP CBaseMuxerRawOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IBaseMuxerRelatedPin)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+void CBaseMuxerRawOutputPin::MuxHeader(const CMediaType& mt)
+{
+ CComQIPtr<IBitStream> pBitStream = GetBitStream();
+ if(!pBitStream) return;
+
+ const BYTE utf8bom[3] = {0xef, 0xbb, 0xbf};
+
+ if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO)
+ {
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.Format();
+
+ for(DWORD i = 0; i < vih->cbSequenceHeader-2; i += 2)
+ {
+ pBitStream->BitWrite(0x00000001, 32);
+ WORD size = (((BYTE*)vih->dwSequenceHeader)[i+0]<<8) | ((BYTE*)vih->dwSequenceHeader)[i+1];
+ pBitStream->ByteWrite(&((BYTE*)vih->dwSequenceHeader)[i+2], size);
+ i += size;
+ }
+ }
+ else if(mt.subtype == MEDIASUBTYPE_UTF8)
+ {
+ pBitStream->ByteWrite(utf8bom, sizeof(utf8bom));
+ }
+ else if(mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2)
+ {
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mt.Format();
+ BYTE* p = (BYTE*)si + si->dwOffset;
+
+ if(memcmp(utf8bom, p, 3) != 0)
+ pBitStream->ByteWrite(utf8bom, sizeof(utf8bom));;
+
+ CStringA str((char*)p, mt.FormatLength() - (p - mt.Format()));
+ pBitStream->StrWrite(str + '\n', true);
+
+ if(str.Find("[Events]") < 0)
+ pBitStream->StrWrite("\n\n[Events]\n", true);
+ }
+ else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
+ {
+ m_idx.RemoveAll();
+ }
+ else if(mt.majortype == MEDIATYPE_Audio
+ && (mt.subtype == MEDIASUBTYPE_PCM
+ || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
+ && mt.formattype == FORMAT_WaveFormatEx)
+ {
+ pBitStream->BitWrite('RIFF', 32);
+ pBitStream->BitWrite(0, 32); // file length - 8, set later
+ pBitStream->BitWrite('WAVE', 32);
+
+ pBitStream->BitWrite('fmt ', 32);
+ pBitStream->ByteWrite(&mt.cbFormat, 4);
+ pBitStream->ByteWrite(mt.pbFormat, mt.cbFormat);
+
+ pBitStream->BitWrite('data', 32);
+ pBitStream->BitWrite(0, 32); // data length, set later
+ }
+}
+
+void CBaseMuxerRawOutputPin::MuxPacket(const CMediaType& mt, const MuxerPacket* pPacket)
+{
+ CComQIPtr<IBitStream> pBitStream = GetBitStream();
+ if(!pBitStream) return;
+
+ const BYTE* pData = pPacket->pData.GetData();
+ const int DataSize = pPacket->pData.GetCount();
+
+ if(mt.subtype == MEDIASUBTYPE_AAC && mt.formattype == FORMAT_WaveFormatEx)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ int profile = 0;
+
+ int srate_idx = 11;
+ if(92017 <= wfe->nSamplesPerSec) srate_idx = 0;
+ else if(75132 <= wfe->nSamplesPerSec) srate_idx = 1;
+ else if(55426 <= wfe->nSamplesPerSec) srate_idx = 2;
+ else if(46009 <= wfe->nSamplesPerSec) srate_idx = 3;
+ else if(37566 <= wfe->nSamplesPerSec) srate_idx = 4;
+ else if(27713 <= wfe->nSamplesPerSec) srate_idx = 5;
+ else if(23004 <= wfe->nSamplesPerSec) srate_idx = 6;
+ else if(18783 <= wfe->nSamplesPerSec) srate_idx = 7;
+ else if(13856 <= wfe->nSamplesPerSec) srate_idx = 8;
+ else if(11502 <= wfe->nSamplesPerSec) srate_idx = 9;
+ else if(9391 <= wfe->nSamplesPerSec) srate_idx = 10;
+
+ int channels = wfe->nChannels;
+
+ if(wfe->cbSize >= 2)
+ {
+ BYTE* p = (BYTE*)(wfe+1);
+ profile = (p[0]>>3)-1;
+ srate_idx = ((p[0]&7)<<1)|((p[1]&0x80)>>7);
+ channels = (p[1]>>3)&15;
+ }
+
+ int len = (DataSize + 7) & 0x1fff;
+
+ BYTE hdr[7] = {0xff, 0xf9};
+ hdr[2] = (profile<<6) | (srate_idx<<2) | ((channels&4)>>2);
+ hdr[3] = ((channels&3)<<6) | (len>>11);
+ hdr[4] = (len>>3)&0xff;
+ hdr[5] = ((len&7)<<5) | 0x1f;
+ hdr[6] = 0xfc;
+
+ pBitStream->ByteWrite(hdr, sizeof(hdr));
+ }
+ else if((mt.subtype == FOURCCMap('1CVA') || mt.subtype == FOURCCMap('1cva')) && mt.formattype == FORMAT_MPEG2_VIDEO)
+ {
+ const BYTE* p = pData;
+ int i = DataSize;
+
+ while(i >= 4)
+ {
+ DWORD len = (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3];
+
+ i -= len + 4;
+ p += len + 4;
+ }
+
+ if(i == 0)
+ {
+ p = pData;
+ i = DataSize;
+
+ while(i >= 4)
+ {
+ DWORD len = (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3];
+
+ pBitStream->BitWrite(0x00000001, 32);
+
+ p += 4;
+ i -= 4;
+
+ if(len > i || len == 1) {len = i; ASSERT(0);}
+
+ pBitStream->ByteWrite(p, len);
+
+ p += len;
+ i -= len;
+ }
+
+ return;
+ }
+ }
+ else if(mt.subtype == MEDIASUBTYPE_UTF8 || mt.majortype == MEDIATYPE_Text)
+ {
+ CStringA str((char*)pData, DataSize);
+ str.Trim();
+ if(str.IsEmpty()) return;
+
+ DVD_HMSF_TIMECODE start = RT2HMSF(pPacket->rtStart, 25);
+ DVD_HMSF_TIMECODE stop = RT2HMSF(pPacket->rtStop, 25);
+
+ str.Format("%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n%s\n\n",
+ pPacket->index+1,
+ start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart/10000)%1000),
+ stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop/10000)%1000),
+ CStringA(str));
+
+ pBitStream->StrWrite(str, true);
+
+ return;
+ }
+ else if(mt.subtype == MEDIASUBTYPE_SSA || mt.subtype == MEDIASUBTYPE_ASS || mt.subtype == MEDIASUBTYPE_ASS2)
+ {
+ CStringA str((char*)pData, DataSize);
+ str.Trim();
+ if(str.IsEmpty()) return;
+
+ DVD_HMSF_TIMECODE start = RT2HMSF(pPacket->rtStart, 25);
+ DVD_HMSF_TIMECODE stop = RT2HMSF(pPacket->rtStop, 25);
+
+ int fields = mt.subtype == MEDIASUBTYPE_ASS2 ? 10 : 9;
+
+ CAtlList<CStringA> sl;
+ Explode(str, sl, ',', fields);
+ if(sl.GetCount() < fields) return;
+
+ CStringA readorder = sl.RemoveHead(); // TODO
+ CStringA layer = sl.RemoveHead();
+ CStringA style = sl.RemoveHead();
+ CStringA actor = sl.RemoveHead();
+ CStringA left = sl.RemoveHead();
+ CStringA right = sl.RemoveHead();
+ CStringA top = sl.RemoveHead();
+ if(fields == 10) top += ',' + sl.RemoveHead(); // bottom
+ CStringA effect = sl.RemoveHead();
+ str = sl.RemoveHead();
+
+ if(mt.subtype == MEDIASUBTYPE_SSA) layer = "Marked=0";
+
+ str.Format("Dialogue: %s,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s,%s,%s,%s,%s,%s,%s\n",
+ layer,
+ start.bHours, start.bMinutes, start.bSeconds, (int)((pPacket->rtStart/100000)%100),
+ stop.bHours, stop.bMinutes, stop.bSeconds, (int)((pPacket->rtStop/100000)%100),
+ style, actor, left, right, top, effect,
+ CStringA(str));
+
+ pBitStream->StrWrite(str, true);
+
+ return;
+ }
+ else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
+ {
+ bool fTimeValid = pPacket->IsTimeValid();
+
+ if(fTimeValid)
+ {
+ idx_t i;
+ i.rt = pPacket->rtStart;
+ i.fp = pBitStream->GetPos();
+ m_idx.AddTail(i);
+ }
+
+ int DataSizeLeft = DataSize;
+
+ while(DataSizeLeft > 0)
+ {
+ int BytesAvail = 0x7ec - (fTimeValid ? 9 : 4);
+ int Size = min(BytesAvail, DataSizeLeft);
+ int Padding = 0x800 - Size - 20 - (fTimeValid ? 9 : 4);
+
+ pBitStream->BitWrite(0x000001ba, 32);
+ pBitStream->BitWrite(0x440004000401ui64, 48);
+ pBitStream->BitWrite(0x000003f8, 32);
+ pBitStream->BitWrite(0x000001bd, 32);
+
+ if(fTimeValid)
+ {
+ pBitStream->BitWrite(Size+9, 16);
+ pBitStream->BitWrite(0x8180052100010001ui64, 64);
+ }
+ else
+ {
+ pBitStream->BitWrite(Size+4, 16);
+ pBitStream->BitWrite(0x810000, 24);
+ }
+
+ pBitStream->BitWrite(0x20, 8);
+
+ pBitStream->ByteWrite(pData, Size);
+
+ pData += Size;
+ DataSizeLeft -= Size;
+
+ if(Padding > 0)
+ {
+ Padding -= 6;
+ ASSERT(Padding >= 0);
+ pBitStream->BitWrite(0x000001be, 32);
+ pBitStream->BitWrite(Padding, 16);
+ while(Padding-- > 0) pBitStream->BitWrite(0xff, 8);
+ }
+
+ fTimeValid = false;
+ }
+
+ return;
+ }
+ else if(mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ for(int i = 0, bps = wfe->wBitsPerSample/8; i < DataSize; i += bps)
+ for(int j = bps-1; j >= 0; j--)
+ pBitStream->BitWrite(pData[i+j], 8);
+
+ return;
+ }
+ // else // TODO: restore more streams (vorbis to ogg)
+
+ pBitStream->ByteWrite(pData, DataSize);
+}
+
+void CBaseMuxerRawOutputPin::MuxFooter(const CMediaType& mt)
+{
+ CComQIPtr<IBitStream> pBitStream = GetBitStream();
+ if(!pBitStream) return;
+
+ if(mt.majortype == MEDIATYPE_Audio
+ && (mt.subtype == MEDIASUBTYPE_PCM
+ || mt.subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_EXTENSIBLE)
+ || mt.subtype == FOURCCMap(WAVE_FORMAT_IEEE_FLOAT))
+ && mt.formattype == FORMAT_WaveFormatEx)
+ {
+ pBitStream->BitFlush();
+
+ ASSERT(pBitStream->GetPos() <= 0xffffffff);
+ UINT32 size = (UINT32)pBitStream->GetPos();
+
+ size -= 8;
+ pBitStream->Seek(4);
+ pBitStream->ByteWrite(&size, 4);
+
+ size -= sizeof(RIFFLIST) + sizeof(RIFFCHUNK) + mt.FormatLength();
+ pBitStream->Seek(sizeof(RIFFLIST) + sizeof(RIFFCHUNK) + mt.FormatLength() + 4);
+ pBitStream->ByteWrite(&size, 4);
+ }
+ else if(mt.subtype == MEDIASUBTYPE_VOBSUB)
+ {
+ if(CComQIPtr<IFileSinkFilter> pFSF = GetFilterFromPin(GetConnected()))
+ {
+ WCHAR* fn = NULL;
+ if(SUCCEEDED(pFSF->GetCurFile(&fn, NULL)))
+ {
+ CPathW p(fn);
+ p.RenameExtension(L".idx");
+ CoTaskMemFree(fn);
+
+ if(FILE* f = _tfopen(CString((LPCWSTR)p), _T("w")))
+ {
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mt.Format();
+
+ _ftprintf(f, _T("%s\n"), _T("# VobSub index file, v7 (do not modify this line!)"));
+
+ fwrite(mt.Format() + si->dwOffset, mt.FormatLength() - si->dwOffset, 1, f);
+
+ CString iso6391 = ISO6392To6391(si->IsoLang);
+ if(iso6391.IsEmpty()) iso6391 = _T("--");
+ _ftprintf(f, _T("\nlangidx: 0\n\nid: %s, index: 0\n"), iso6391);
+
+ CString alt = CString(CStringW(si->TrackName));
+ if(!alt.IsEmpty()) _ftprintf(f, _T("alt: %s\n"), alt);
+
+ POSITION pos = m_idx.GetHeadPosition();
+ while(pos)
+ {
+ const idx_t& i = m_idx.GetNext(pos);
+ DVD_HMSF_TIMECODE start = RT2HMSF(i.rt, 25);
+ _ftprintf(f, _T("timestamp: %02d:%02d:%02d:%03d, filepos: %09I64x\n"),
+ start.bHours, start.bMinutes, start.bSeconds, (int)((i.rt/10000)%1000),
+ i.fp);
+ }
+
+ fclose(f);
+ }
+ }
+ }
+ }
+}
diff --git a/src/filters/muxer/basemuxer/BaseMuxerOutputPin.h b/src/filters/muxer/basemuxer/BaseMuxerOutputPin.h
new file mode 100644
index 000000000..dc81722ff
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxerOutputPin.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "BitStream.h"
+#include "BaseMuxerInputPin.h"
+#include "BaseMuxerRelatedPin.h"
+
+class CBaseMuxerOutputPin : public CBaseOutputPin
+{
+ CComPtr<IBitStream> m_pBitStream;
+
+public:
+ CBaseMuxerOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CBaseMuxerOutputPin() {}
+
+ IBitStream* GetBitStream();
+
+ HRESULT BreakConnect();
+
+ HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
+ HRESULT DeliverEndOfStream();
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+};
+
+class CBaseMuxerRawOutputPin : public CBaseMuxerOutputPin, public CBaseMuxerRelatedPin
+{
+ struct idx_t {REFERENCE_TIME rt; __int64 fp;};
+ CAtlList<idx_t> m_idx;
+
+public:
+ CBaseMuxerRawOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CBaseMuxerRawOutputPin() {}
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ virtual void MuxHeader(const CMediaType& mt);
+ virtual void MuxPacket(const CMediaType& mt, const MuxerPacket* pPacket);
+ virtual void MuxFooter(const CMediaType& mt);
+}; \ No newline at end of file
diff --git a/src/filters/muxer/basemuxer/BaseMuxerRelatedPin.cpp b/src/filters/muxer/basemuxer/BaseMuxerRelatedPin.cpp
new file mode 100644
index 000000000..c4ba9b3bd
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxerRelatedPin.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "BaseMuxerRelatedPin.h"
+
+//
+// CBaseMuxerRelatedPin
+//
+
+CBaseMuxerRelatedPin::CBaseMuxerRelatedPin()
+{
+}
+
+CBaseMuxerRelatedPin::~CBaseMuxerRelatedPin()
+{
+}
+
+// IBaseMuxerRelatedPin
+
+STDMETHODIMP CBaseMuxerRelatedPin::SetRelatedPin(CBasePin* pPin)
+{
+ m_pRelatedPin = pPin;
+ return S_OK;
+}
+
+STDMETHODIMP_(CBasePin*) CBaseMuxerRelatedPin::GetRelatedPin()
+{
+ return m_pRelatedPin;
+}
diff --git a/src/filters/muxer/basemuxer/BaseMuxerRelatedPin.h b/src/filters/muxer/basemuxer/BaseMuxerRelatedPin.h
new file mode 100644
index 000000000..2b7f7095e
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxerRelatedPin.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+[uuid("EE6F2741-7DB4-4AAD-A3CB-545208EE4C0A")]
+interface IBaseMuxerRelatedPin : public IUnknown
+{
+ STDMETHOD(SetRelatedPin) (CBasePin* pPin) = 0;
+ STDMETHOD_(CBasePin*, GetRelatedPin) () = 0;
+};
+
+class CBaseMuxerRelatedPin : public IBaseMuxerRelatedPin
+{
+ CBasePin* m_pRelatedPin; // should not hold a reference because it would be circular
+
+public:
+ CBaseMuxerRelatedPin();
+ virtual ~CBaseMuxerRelatedPin();
+
+ // IBaseMuxerRelatedPin
+
+ STDMETHODIMP SetRelatedPin(CBasePin* pPin);
+ STDMETHODIMP_(CBasePin*) GetRelatedPin();
+}; \ No newline at end of file
diff --git a/src/filters/muxer/basemuxer/BaseMuxer_vs2005.vcproj b/src/filters/muxer/basemuxer/BaseMuxer_vs2005.vcproj
new file mode 100644
index 000000000..be8d7c916
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxer_vs2005.vcproj
@@ -0,0 +1,387 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="BaseMuxer"
+ ProjectGUID="{DB5F93B2-54D0-4474-A588-D259BE36C832}"
+ RootNamespace="BaseMuxer"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="BaseMuxer.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseMuxerInputPin.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseMuxerOutputPin.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseMuxerRelatedPin.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\BitStream.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="BaseMuxer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseMuxerInputPin.h"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseMuxerOutputPin.h"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseMuxerRelatedPin.h"
+ >
+ </File>
+ <File
+ RelativePath=".\BitStream.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="1"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/muxer/basemuxer/BaseMuxer_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/muxer/basemuxer/BaseMuxer_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..19de06174
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BaseMuxer_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/muxer/basemuxer/BitStream.cpp b/src/filters/muxer/basemuxer/BitStream.cpp
new file mode 100644
index 000000000..e3f1999b3
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BitStream.cpp
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "BitStream.h"
+
+//
+// CBitStream
+//
+
+CBitStream::CBitStream(IStream* pStream, bool fThrowError)
+ : CUnknown(_T("CBitStream"), NULL)
+ , m_pStream(pStream)
+ , m_fThrowError(fThrowError)
+ , m_bitlen(0)
+{
+ ASSERT(m_pStream);
+
+ LARGE_INTEGER li = {0};
+ m_pStream->Seek(li, STREAM_SEEK_SET, NULL);
+
+ ULARGE_INTEGER uli = {0};
+ m_pStream->SetSize(uli); // not that it worked...
+
+ m_pStream->Commit(S_OK); // also seems to have no effect, but maybe in the future...
+}
+
+CBitStream::~CBitStream()
+{
+ BitFlush();
+}
+
+STDMETHODIMP CBitStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ *ppv = NULL;
+
+ return
+ QI(IBitStream)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IBitStream
+
+STDMETHODIMP_(UINT64) CBitStream::GetPos()
+{
+ ULARGE_INTEGER pos = {0, 0};
+ m_pStream->Seek(*(LARGE_INTEGER*)&pos, STREAM_SEEK_CUR, &pos);
+ return pos.QuadPart;
+}
+
+STDMETHODIMP_(UINT64) CBitStream::Seek(UINT64 pos)
+{
+ BitFlush();
+
+ LARGE_INTEGER li;
+ li.QuadPart = pos;
+ ULARGE_INTEGER linew;
+ linew.QuadPart = -1;
+ m_pStream->Seek(li, STREAM_SEEK_SET, &linew);
+ ASSERT(li.QuadPart == linew.QuadPart);
+ return linew.QuadPart;
+}
+
+STDMETHODIMP CBitStream::ByteWrite(const void* pData, int len)
+{
+ HRESULT hr = S_OK;
+
+ BitFlush();
+
+ if(len > 0)
+ {
+ ULONG cbWritten = 0;
+ hr = m_pStream->Write(pData, len, &cbWritten);
+
+ ASSERT(SUCCEEDED(hr));
+ if(m_fThrowError && FAILED(hr)) throw hr;
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CBitStream::BitWrite(UINT64 data, int len)
+{
+ HRESULT hr = S_OK;
+
+ ASSERT(len >= 0 && len <= 64);
+
+ if(len > 56) {BitWrite(data >> 56, len - 56); len = 56;}
+
+ m_bitbuff <<= len;
+ m_bitbuff |= data & ((1ui64 << len) - 1);
+ m_bitlen += len;
+
+ while(m_bitlen >= 8)
+ {
+ BYTE b = (BYTE)(m_bitbuff >> (m_bitlen - 8));
+ hr = m_pStream->Write(&b, 1, NULL);
+ m_bitlen -= 8;
+
+ ASSERT(SUCCEEDED(hr));
+ if(m_fThrowError && FAILED(hr)) throw E_FAIL;
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CBitStream::BitFlush()
+{
+ HRESULT hr = S_OK;
+
+ if(m_bitlen > 0)
+ {
+ ASSERT(m_bitlen < 8);
+ BYTE b = (BYTE)(m_bitbuff << (8 - m_bitlen));
+ hr = m_pStream->Write(&b, 1, NULL);
+ m_bitlen = 0;
+
+ ASSERT(SUCCEEDED(hr));
+ if(m_fThrowError && FAILED(hr)) throw E_FAIL;
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CBitStream::StrWrite(LPCSTR pData, BOOL bFixNewLine)
+{
+ CStringA str = pData;
+
+ if(bFixNewLine)
+ {
+ str.Replace("\r", "");
+ str.Replace("\n", "\r\n");
+ }
+
+ return ByteWrite((LPCSTR)str, str.GetLength());
+}
diff --git a/src/filters/muxer/basemuxer/BitStream.h b/src/filters/muxer/basemuxer/BitStream.h
new file mode 100644
index 000000000..26621660e
--- /dev/null
+++ b/src/filters/muxer/basemuxer/BitStream.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+[uuid("30AB78C7-5259-4594-AEFE-9C0FC2F08A5E")]
+interface IBitStream : public IUnknown
+{
+ STDMETHOD_(UINT64, GetPos) () = 0;
+ STDMETHOD_(UINT64, Seek) (UINT64 pos) = 0; // it's a _stream_, please don't seek if you don't have to
+ STDMETHOD(ByteWrite) (const void* pData, int len) = 0;
+ STDMETHOD(BitWrite) (UINT64 data, int len) = 0;
+ STDMETHOD(BitFlush) () = 0;
+ STDMETHOD(StrWrite) (LPCSTR pData, BOOL bFixNewLine) = 0;
+};
+
+class CBitStream : public CUnknown, public IBitStream
+{
+ CComPtr<IStream> m_pStream;
+ bool m_fThrowError;
+ UINT64 m_bitbuff;
+ int m_bitlen;
+
+public:
+ CBitStream(IStream* pStream, bool m_fThrowError = false);
+ virtual ~CBitStream();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IBitStream
+
+ STDMETHODIMP_(UINT64) GetPos();
+ STDMETHODIMP_(UINT64) Seek(UINT64 pos);
+ STDMETHODIMP ByteWrite(const void* pData, int len);
+ STDMETHODIMP BitWrite(UINT64 data, int len);
+ STDMETHODIMP BitFlush();
+ STDMETHODIMP StrWrite(LPCSTR pData, BOOL bFixNewLine);
+};
diff --git a/src/filters/muxer/basemuxer/stdafx.cpp b/src/filters/muxer/basemuxer/stdafx.cpp
new file mode 100644
index 000000000..6f5d2a928
--- /dev/null
+++ b/src/filters/muxer/basemuxer/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// BaseMuxer.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/muxer/basemuxer/stdafx.h b/src/filters/muxer/basemuxer/stdafx.h
new file mode 100644
index 000000000..d4d4ba8eb
--- /dev/null
+++ b/src/filters/muxer/basemuxer/stdafx.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <atlbase.h>
+#include <atlcoll.h>
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
+
+#include "..\..\..\DSUtil\DSUtil.h"
diff --git a/src/filters/muxer/dsmmuxer/DSMMuxer.cpp b/src/filters/muxer/dsmmuxer/DSMMuxer.cpp
new file mode 100644
index 000000000..837530949
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/DSMMuxer.cpp
@@ -0,0 +1,451 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include "DSMMuxer.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include <qnetwork.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_DirectShowMedia}
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, TRUE, &CLSID_NULL, NULL, 0, NULL},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CDSMMuxerFilter), L"DSM Muxer", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDSMMuxerFilter>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+template<typename T> static T myabs(T n) {return n >= 0 ? n : -n;}
+
+static int GetByteLength(UINT64 data, int min = 0)
+{
+ int i = 7;
+ while(i >= min && ((BYTE*)&data)[i] == 0) i--;
+ return ++i;
+}
+
+//
+// CDSMMuxerFilter
+//
+
+CDSMMuxerFilter::CDSMMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, bool fAutoChap, bool fAutoRes)
+ : CBaseMuxerFilter(pUnk, phr, __uuidof(this))
+ , m_fAutoChap(fAutoChap)
+ , m_fAutoRes(fAutoRes)
+{
+ if(phr) *phr = S_OK;
+}
+
+CDSMMuxerFilter::~CDSMMuxerFilter()
+{
+}
+
+STDMETHODIMP CDSMMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ *ppv = NULL;
+
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+void CDSMMuxerFilter::MuxPacketHeader(IBitStream* pBS, dsmp_t type, UINT64 len)
+{
+ ASSERT(type < 32);
+
+ int i = GetByteLength(len, 1);
+
+ pBS->BitWrite(DSMSW, DSMSW_SIZE<<3);
+ pBS->BitWrite(type, 5);
+ pBS->BitWrite(i-1, 3);
+ pBS->BitWrite(len, i<<3);
+}
+
+void CDSMMuxerFilter::MuxFileInfo(IBitStream* pBS)
+{
+ int len = 1;
+ CSimpleMap<CStringA, CStringA> si;
+
+ for(int i = 0; i < GetSize(); i++)
+ {
+ CStringA key = CStringA(CString(GetKeyAt(i))), value = UTF16To8(GetValueAt(i));
+ if(key.GetLength() != 4) continue;
+ si.Add(key, value);
+ len += 4 + value.GetLength() + 1;
+ }
+
+ MuxPacketHeader(pBS, DSMP_FILEINFO, len);
+ pBS->BitWrite(DSMF_VERSION, 8);
+ for(int i = 0; i < si.GetSize(); i++)
+ {
+ CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
+ pBS->ByteWrite((LPCSTR)key, 4);
+ pBS->ByteWrite((LPCSTR)value, value.GetLength()+1);
+ }
+
+}
+
+void CDSMMuxerFilter::MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin)
+{
+ int len = 1;
+ CSimpleMap<CStringA, CStringA> si;
+
+ for(int i = 0; i < pPin->GetSize(); i++)
+ {
+ CStringA key = CStringA(CString(pPin->GetKeyAt(i))), value = UTF16To8(pPin->GetValueAt(i));
+ if(key.GetLength() != 4) continue;
+ si.Add(key, value);
+ len += 4 + value.GetLength() + 1;
+ }
+
+ if(len > 1)
+ {
+ MuxPacketHeader(pBS, DSMP_STREAMINFO, len);
+ pBS->BitWrite(pPin->GetID(), 8);
+ for(int i = 0; i < si.GetSize(); i++)
+ {
+ CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
+ pBS->ByteWrite((LPCSTR)key, 4);
+ pBS->ByteWrite((LPCSTR)value, value.GetLength()+1);
+ }
+ }
+}
+
+void CDSMMuxerFilter::MuxInit()
+{
+ m_sps.RemoveAll();
+ m_isps.RemoveAll();
+ m_rtPrevSyncPoint = _I64_MIN;
+}
+
+void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
+{
+ CString muxer;
+ muxer.Format(_T("DSM Muxer (%s)"), CString(__TIMESTAMP__));
+
+ SetProperty(L"MUXR", CStringW(muxer));
+ SetProperty(L"DATE", CStringW(CTime::GetCurrentTime().FormatGmt(_T("%Y-%m-%d %H:%M:%S"))));
+
+ MuxFileInfo(pBS);
+
+ POSITION pos = m_pPins.GetHeadPosition();
+ while(pos)
+ {
+ CBaseMuxerInputPin* pPin = m_pPins.GetNext(pos);
+ const CMediaType& mt = pPin->CurrentMediaType();
+
+ ASSERT((mt.lSampleSize >> 30) == 0); // you don't need >1GB samples, do you?
+
+ MuxPacketHeader(pBS, DSMP_MEDIATYPE, 5 + sizeof(GUID)*3 + mt.FormatLength());
+ pBS->BitWrite(pPin->GetID(), 8);
+ pBS->ByteWrite(&mt.majortype, sizeof(mt.majortype));
+ pBS->ByteWrite(&mt.subtype, sizeof(mt.subtype));
+ pBS->BitWrite(mt.bFixedSizeSamples, 1);
+ pBS->BitWrite(mt.bTemporalCompression, 1);
+ pBS->BitWrite(mt.lSampleSize, 30);
+ pBS->ByteWrite(&mt.formattype, sizeof(mt.formattype));
+ pBS->ByteWrite(mt.Format(), mt.FormatLength());
+
+ MuxStreamInfo(pBS, pPin);
+ }
+
+ // resources & chapters
+
+ CInterfaceList<IDSMResourceBag> pRBs;
+ pRBs.AddTail(this);
+
+ CComQIPtr<IDSMChapterBag> pCB = (IUnknown*)(INonDelegatingUnknown*)this;
+
+ pos = m_pPins.GetHeadPosition();
+ while(pos)
+ {
+ for(CComPtr<IPin> pPin = m_pPins.GetNext(pos)->GetConnected(); pPin; pPin = GetUpStreamPin(GetFilterFromPin(pPin)))
+ {
+ if(m_fAutoRes)
+ {
+ CComQIPtr<IDSMResourceBag> pPB = GetFilterFromPin(pPin);
+ if(pPB && !pRBs.Find(pPB)) pRBs.AddTail(pPB);
+ }
+
+ if(m_fAutoChap)
+ {
+ if(!pCB || pCB->ChapGetCount() == 0) pCB = GetFilterFromPin(pPin);
+ }
+ }
+ }
+
+ // resources
+
+ pos = pRBs.GetHeadPosition();
+ while(pos)
+ {
+ IDSMResourceBag* pRB = pRBs.GetNext(pos);
+
+ for(DWORD i = 0, j = pRB->ResGetCount(); i < j; i++)
+ {
+ CComBSTR name, desc, mime;
+ BYTE* pData = NULL;
+ DWORD len = 0;
+ if(SUCCEEDED(pRB->ResGet(i, &name, &desc, &mime, &pData, &len, NULL)))
+ {
+ CStringA utf8_name = UTF16To8(name);
+ CStringA utf8_desc = UTF16To8(desc);
+ CStringA utf8_mime = UTF16To8(mime);
+
+ MuxPacketHeader(pBS, DSMP_RESOURCE,
+ 1 +
+ utf8_name.GetLength()+1 +
+ utf8_desc.GetLength()+1 +
+ utf8_mime.GetLength()+1 +
+ len);
+
+ pBS->BitWrite(0, 2);
+ pBS->BitWrite(0, 6); // reserved
+ pBS->ByteWrite(utf8_name, utf8_name.GetLength()+1);
+ pBS->ByteWrite(utf8_desc, utf8_desc.GetLength()+1);
+ pBS->ByteWrite(utf8_mime, utf8_mime.GetLength()+1);
+ pBS->ByteWrite(pData, len);
+
+ CoTaskMemFree(pData);
+ }
+ }
+ }
+
+ // chapters
+
+ if(pCB)
+ {
+ CAtlList<CDSMChapter> chapters;
+ REFERENCE_TIME rtPrev = 0;
+ int len = 0;
+
+ pCB->ChapSort();
+
+ for(DWORD i = 0; i < pCB->ChapGetCount(); i++)
+ {
+ CDSMChapter c;
+ CComBSTR name;
+ if(SUCCEEDED(pCB->ChapGet(i, &c.rt, &name)))
+ {
+ REFERENCE_TIME rtDiff = c.rt - rtPrev; rtPrev = c.rt; c.rt = rtDiff;
+ c.name = name;
+ len += 1 + GetByteLength(myabs(c.rt)) + UTF16To8(c.name).GetLength()+1;
+ chapters.AddTail(c);
+ }
+ }
+
+ if(chapters.GetCount())
+ {
+ MuxPacketHeader(pBS, DSMP_CHAPTERS, len);
+
+ pos = chapters.GetHeadPosition();
+ while(pos)
+ {
+ CDSMChapter& c = chapters.GetNext(pos);
+ CStringA name = UTF16To8(c.name);
+ int irt = GetByteLength(myabs(c.rt));
+ pBS->BitWrite(c.rt < 0, 1);
+ pBS->BitWrite(irt, 3);
+ pBS->BitWrite(0, 4);
+ pBS->BitWrite(myabs(c.rt), irt<<3);
+ pBS->ByteWrite((LPCSTR)name, name.GetLength()+1);
+ }
+ }
+ }
+}
+
+void CDSMMuxerFilter::MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket)
+{
+ if(pPacket->IsEOS())
+ return;
+
+ if(pPacket->pPin->CurrentMediaType().majortype == MEDIATYPE_Text)
+ {
+ CStringA str((char*)pPacket->pData.GetData(), pPacket->pData.GetCount());
+ str.Replace("\xff", " ");
+ str.Replace("&nbsp;", " ");
+ str.Replace("&nbsp", " ");
+ str.Trim();
+ if(str.IsEmpty())
+ return;
+ }
+
+ ASSERT(!pPacket->IsSyncPoint() || pPacket->IsTimeValid());
+
+ REFERENCE_TIME rtTimeStamp = _I64_MIN, rtDuration = 0;
+ int iTimeStamp = 0, iDuration = 0;
+
+ if(pPacket->IsTimeValid())
+ {
+ rtTimeStamp = pPacket->rtStart;
+ rtDuration = max(pPacket->rtStop - pPacket->rtStart, 0);
+
+ iTimeStamp = GetByteLength(myabs(rtTimeStamp));
+ ASSERT(iTimeStamp <= 7);
+
+ iDuration = GetByteLength(rtDuration);
+ ASSERT(iDuration <= 7);
+
+ IndexSyncPoint(pPacket, pBS->GetPos());
+ }
+
+ int len = 2 + iTimeStamp + iDuration + pPacket->pData.GetCount(); // id + flags + data
+
+ MuxPacketHeader(pBS, DSMP_SAMPLE, len);
+ pBS->BitWrite(pPacket->pPin->GetID(), 8);
+ pBS->BitWrite(pPacket->IsSyncPoint(), 1);
+ pBS->BitWrite(rtTimeStamp < 0, 1);
+ pBS->BitWrite(iTimeStamp, 3);
+ pBS->BitWrite(iDuration, 3);
+ pBS->BitWrite(myabs(rtTimeStamp), iTimeStamp<<3);
+ pBS->BitWrite(rtDuration, iDuration<<3);
+ pBS->ByteWrite(pPacket->pData.GetData(), pPacket->pData.GetCount());
+}
+
+void CDSMMuxerFilter::MuxFooter(IBitStream* pBS)
+{
+ // syncpoints
+
+ int len = 0;
+ CAtlList<IndexedSyncPoint> isps;
+ REFERENCE_TIME rtPrev = 0, rt;
+ UINT64 fpPrev = 0, fp;
+
+ POSITION pos = m_isps.GetHeadPosition();
+ while(pos)
+ {
+ IndexedSyncPoint& isp = m_isps.GetNext(pos);
+ TRACE(_T("sp[%d]: %I64d %I64x\n"), isp.id, isp.rt, isp.fp);
+
+ rt = isp.rt - rtPrev; rtPrev = isp.rt;
+ fp = isp.fp - fpPrev; fpPrev = isp.fp;
+
+ IndexedSyncPoint isp2;
+ isp2.fp = fp;
+ isp2.rt = rt;
+ isps.AddTail(isp2);
+
+ len += 1 + GetByteLength(myabs(rt)) + GetByteLength(fp); // flags + rt + fp
+ }
+
+ MuxPacketHeader(pBS, DSMP_SYNCPOINTS, len);
+
+ pos = isps.GetHeadPosition();
+ while(pos)
+ {
+ IndexedSyncPoint& isp = isps.GetNext(pos);
+
+ int irt = GetByteLength(myabs(isp.rt));
+ int ifp = GetByteLength(isp.fp);
+
+ pBS->BitWrite(isp.rt < 0, 1);
+ pBS->BitWrite(irt, 3);
+ pBS->BitWrite(ifp, 3);
+ pBS->BitWrite(0, 1); // reserved
+ pBS->BitWrite(myabs(isp.rt), irt<<3);
+ pBS->BitWrite(isp.fp, ifp<<3);
+ }
+}
+
+void CDSMMuxerFilter::IndexSyncPoint(const MuxerPacket* p, __int64 fp)
+{
+ // Yes, this is as complicated as it looks.
+ // Rule #1: don't write this packet if you can't do it reliably.
+ // (think about overlapped subtitles, line1: 0->10, line2: 1->9)
+
+ // FIXME: the very last syncpoints won't get moved to m_isps because there are no more syncpoints to trigger it!
+
+ if(fp < 0 || !p || !p->IsTimeValid() || !p->IsSyncPoint())
+ return;
+
+ ASSERT(p->rtStart >= m_rtPrevSyncPoint);
+ m_rtPrevSyncPoint = p->rtStart;
+
+ SyncPoint sp;
+ sp.id = p->pPin->GetID();
+ sp.rtStart = p->rtStart;
+ sp.rtStop = p->pPin->IsSubtitleStream() ? p->rtStop : _I64_MAX;
+ sp.fp = fp;
+
+ {
+ SyncPoint& head = !m_sps.IsEmpty() ? m_sps.GetHead() : sp;
+ SyncPoint& tail = !m_sps.IsEmpty() ? m_sps.GetTail() : sp;
+ REFERENCE_TIME rtfp = !m_isps.IsEmpty() ? m_isps.GetTail().rtfp : _I64_MIN;
+
+ if(head.rtStart > rtfp + 1000000) // 100ms limit, just in case every stream had only keyframes, then sycnpoints would be too frequent
+ {
+ IndexedSyncPoint isp;
+ isp.id = head.id;
+ isp.rt = tail.rtStart;
+ isp.rtfp = head.rtStart;
+ isp.fp = head.fp;
+ m_isps.AddTail(isp);
+ }
+ }
+
+ POSITION pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ SyncPoint& sp2 = m_sps.GetNext(pos);
+ if(sp2.id == sp.id && sp2.rtStop <= sp.rtStop || sp2.rtStop <= sp.rtStart)
+ m_sps.RemoveAt(cur);
+ }
+
+ m_sps.AddTail(sp);
+} \ No newline at end of file
diff --git a/src/filters/muxer/dsmmuxer/DSMMuxer.def b/src/filters/muxer/dsmmuxer/DSMMuxer.def
new file mode 100644
index 000000000..fb9f0f9d7
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/DSMMuxer.def
@@ -0,0 +1,7 @@
+LIBRARY "DSMMuxer.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/muxer/dsmmuxer/DSMMuxer.h b/src/filters/muxer/dsmmuxer/DSMMuxer.h
new file mode 100644
index 000000000..a46201597
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/DSMMuxer.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\basemuxer\basemuxer.h"
+#include "..\..\..\..\include\dsm\dsm.h"
+
+[uuid("C6590B76-587E-4082-9125-680D0693A97B")]
+class CDSMMuxerFilter : public CBaseMuxerFilter
+{
+ bool m_fAutoChap, m_fAutoRes;
+
+ struct SyncPoint {BYTE id; REFERENCE_TIME rtStart, rtStop; __int64 fp;};
+ struct IndexedSyncPoint {BYTE id; REFERENCE_TIME rt, rtfp; __int64 fp;};
+ CAtlList<SyncPoint> m_sps;
+ CAtlList<IndexedSyncPoint> m_isps;
+ REFERENCE_TIME m_rtPrevSyncPoint;
+ void IndexSyncPoint(const MuxerPacket* p, __int64 fp);
+
+ void MuxPacketHeader(IBitStream* pBS, dsmp_t type, UINT64 len);
+ void MuxFileInfo(IBitStream* pBS);
+ void MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin);
+
+protected:
+ void MuxInit();
+
+ void MuxHeader(IBitStream* pBS);
+ void MuxPacket(IBitStream* pBS, const MuxerPacket* pPacket);
+ void MuxFooter(IBitStream* pBS);
+
+public:
+ CDSMMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr, bool fAutoChap = true, bool fAutoRes = true);
+ virtual ~CDSMMuxerFilter();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+};
diff --git a/src/filters/muxer/dsmmuxer/DSMMuxer.rc b/src/filters/muxer/dsmmuxer/DSMMuxer.rc
new file mode 100644
index 000000000..09bcc5e09
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/DSMMuxer.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,4
+ PRODUCTVERSION 1,0,0,4
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "DirectShow Media Muxer"
+ VALUE "FileVersion", "1, 0, 0, 4"
+ VALUE "InternalName", "DirectShow Media Muxer"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "DSMMuxer.ax"
+ VALUE "ProductName", "DirectShow Media Muxer"
+ VALUE "ProductVersion", "1, 0, 0, 4"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/muxer/dsmmuxer/DSMMuxer.sln b/src/filters/muxer/dsmmuxer/DSMMuxer.sln
new file mode 100644
index 000000000..777e77454
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/DSMMuxer.sln
@@ -0,0 +1,94 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMMuxer", "DSMMuxer.vcproj", "{65361C7C-83D6-42E4-870C-4DC85AE641FE}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ {DB5F93B2-54D0-4474-A588-D259BE36C832} = {DB5F93B2-54D0-4474-A588-D259BE36C832}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseMuxer", "..\basemuxer\BaseMuxer.vcproj", "{DB5F93B2-54D0-4474-A588-D259BE36C832}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug.ActiveCfg = Debug|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug lib.ActiveCfg = Debug lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release.ActiveCfg = Release|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release lib.ActiveCfg = Release lib|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {65361C7C-83D6-42E4-870C-4DC85AE641FE}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug.ActiveCfg = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug.Build.0 = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug lib.ActiveCfg = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug lib.Build.0 = Debug lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release.ActiveCfg = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release.Build.0 = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release lib.ActiveCfg = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release lib.Build.0 = Release lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {DB5F93B2-54D0-4474-A588-D259BE36C832}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/muxer/dsmmuxer/DSMMuxer.vcproj b/src/filters/muxer/dsmmuxer/DSMMuxer.vcproj
new file mode 100644
index 000000000..e6d8736d0
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/DSMMuxer.vcproj
@@ -0,0 +1,519 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="DSMMuxer"
+ ProjectGUID="{65361C7C-83D6-42E4-870C-4DC85AE641FE}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="DSMMuxer.cpp">
+ </File>
+ <File
+ RelativePath="DSMMuxer.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="DSMMuxer.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\DSMMuxer.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="1"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/muxer/dsmmuxer/DSMMuxer_vs2005.vcproj b/src/filters/muxer/dsmmuxer/DSMMuxer_vs2005.vcproj
new file mode 100644
index 000000000..c7a011b82
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/DSMMuxer_vs2005.vcproj
@@ -0,0 +1,762 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="DSMMuxer"
+ ProjectGUID="{65361C7C-83D6-42E4-870C-4DC85AE641FE}"
+ RootNamespace="DSMMuxer"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="DSMMuxer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="DSMMuxer.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="DSMMuxer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\DSMMuxer.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="1"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/muxer/dsmmuxer/DSMMuxer_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/muxer/dsmmuxer/DSMMuxer_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/DSMMuxer_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/muxer/dsmmuxer/resource.h b/src/filters/muxer/dsmmuxer/resource.h
new file mode 100644
index 000000000..be7a94010
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by DSMMuxer.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/muxer/dsmmuxer/stdafx.cpp b/src/filters/muxer/dsmmuxer/stdafx.cpp
new file mode 100644
index 000000000..5e2cdab92
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// DSMMuxer.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/muxer/dsmmuxer/stdafx.h b/src/filters/muxer/dsmmuxer/stdafx.h
new file mode 100644
index 000000000..b9b0d1a39
--- /dev/null
+++ b/src/filters/muxer/dsmmuxer/stdafx.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include <atlpath.h>
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/muxer/matroskamuxer/MatroskaFile.cpp b/src/filters/muxer/matroskamuxer/MatroskaFile.cpp
new file mode 100644
index 000000000..26f4391f4
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaFile.cpp
@@ -0,0 +1,862 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "MatroskaFile.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+using namespace MatroskaWriter;
+
+static void bswap(BYTE* s, int len)
+{
+ for(BYTE* d = s + len-1; s < d; s++, d--)
+ *s ^= *d, *d ^= *s, *s ^= *d;
+}
+
+//
+
+CID::CID(DWORD id) : m_id(id)
+{
+}
+
+QWORD CID::Size(bool fWithHeader)
+{
+ return CUInt(0, m_id).Size(false);
+}
+
+HRESULT CID::Write(IStream* pStream)
+{
+ QWORD len = CID::Size();
+ DWORD id = m_id;
+ bswap((BYTE*)&id, (int)len);
+ *(BYTE*)&id = ((*(BYTE*)&id)&(1<<(8-len))-1)|(1<<(8-len));
+ return pStream->Write(&id, (ULONG)len, NULL);
+}
+
+QWORD CID::HeaderSize(QWORD len)
+{
+ return CID::Size() + CLength(len).Size();
+}
+
+HRESULT CID::HeaderWrite(IStream* pStream)
+{
+ CID::Write(pStream);
+ CLength(Size(false)).Write(pStream);
+ return S_OK;
+}
+
+QWORD CBinary::Size(bool fWithHeader)
+{
+ if(GetCount() == 0) return 0;
+
+ QWORD len = 0;
+ len += GetCount();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT CBinary::Write(IStream* pStream)
+{
+ if(GetCount() == 0) return S_OK;
+
+ HeaderWrite(pStream);
+ return pStream->Write(GetData(), GetCount(), NULL);
+}
+
+QWORD CANSI::Size(bool fWithHeader)
+{
+ if(GetLength() == 0) return 0;
+
+ QWORD len = 0;
+ len += GetLength();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT CANSI::Write(IStream* pStream)
+{
+ if(GetLength() == 0) return S_OK;
+
+ HeaderWrite(pStream);
+ return pStream->Write((LPCSTR)*this, GetLength(), NULL);
+}
+
+QWORD CUTF8::Size(bool fWithHeader)
+{
+ if(GetLength() == 0) return 0;
+
+ QWORD len = 0;
+ len += UTF16To8(*this).GetLength();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT CUTF8::Write(IStream* pStream)
+{
+ if(GetLength() == 0) return S_OK;
+
+ HeaderWrite(pStream);
+ CStringA str = UTF16To8(*this);
+ return pStream->Write((BYTE*)(LPCSTR)str, str.GetLength(), NULL);
+}
+
+template<class T, class BASE>
+QWORD CSimpleVar<T, BASE>::Size(bool fWithHeader)
+{
+ if(!m_fSet) return 0;
+
+ QWORD len = 0;
+ len += sizeof(T);
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+template<class T, class BASE>
+HRESULT CSimpleVar<T, BASE>::Write(IStream* pStream)
+{
+ if(!m_fSet) return S_OK;
+
+ HeaderWrite(pStream);
+ T val = m_val;
+ bswap((BYTE*)&val, sizeof(T));
+ return pStream->Write(&val, sizeof(T), NULL);
+}
+
+QWORD CUInt::Size(bool fWithHeader)
+{
+ if(!m_fSet) return 0;
+
+ QWORD len = 0;
+
+ if(m_val == 0)
+ {
+ len++;
+ }
+ else
+ {
+ for(int i = 8; i > 0; i--)
+ {
+ if(((0xffi64<<((i-1)*8))&m_val))
+ {
+ len += i;
+ break;
+ }
+ }
+ }
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT CUInt::Write(IStream* pStream)
+{
+ if(!m_fSet) return S_OK;
+
+ CID::Write(pStream);
+ CLength l(Size(false));
+ l.Write(pStream);
+ UINT64 val = m_val;
+ bswap((BYTE*)&val, (int)l);
+ return pStream->Write(&val, (ULONG)l, NULL);
+}
+
+QWORD CInt::Size(bool fWithHeader)
+{
+ if(!m_fSet) return 0;
+
+ QWORD len = 0;
+
+ if(m_val == 0)
+ {
+ len++;
+ }
+ else
+ {
+ UINT64 val = m_val >= 0 ? m_val : -m_val;
+ for(int i = 8; i > 0; i--)
+ {
+ if(((0xffi64<<((i-1)*8))&val))
+ {
+ len += i;
+ if(m_val < 0 && !(m_val&(0x80<<(i-1))))
+ len++;
+ break;
+ }
+ }
+ }
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT CInt::Write(IStream* pStream)
+{
+ if(!m_fSet) return S_OK;
+
+ CID::Write(pStream);
+ CLength l(Size(false));
+ l.Write(pStream);
+ UINT64 val = m_val;
+ bswap((BYTE*)&val, (int)l);
+ return pStream->Write(&val, (ULONG)l, NULL);
+}
+
+QWORD CLength::Size(bool fWithHeader)
+{
+ if(m_len == 0x00FFFFFFFFFFFFFFi64)
+ return 8;
+
+ QWORD len = 0;
+ for(int i = 1; i <= 8; i++)
+ {
+ if(!(m_len&(~((1i64<<(7*i))-1))) && (m_len&((1i64<<(7*i))-1)) != ((1i64<<(7*i))-1))
+ {
+ len += i;
+ break;
+ }
+ }
+ return len;
+}
+
+HRESULT CLength::Write(IStream* pStream)
+{
+ QWORD len = Size(false);
+ UINT64 val = m_len;
+ bswap((BYTE*)&val, (int)len);
+ *(BYTE*)&val = ((*(BYTE*)&val)&(1<<(8-len))-1)|(1<<(8-len));
+ return pStream->Write(&val, (ULONG)len, NULL);
+}
+
+//
+
+EBML::EBML(DWORD id)
+ : CID(id)
+ , EBMLVersion(0x4286)
+ , EBMLReadVersion(0x42F7)
+ , EBMLMaxIDLength(0x42F2)
+ , EBMLMaxSizeLength(0x42F3)
+ , DocType(0x4282)
+ , DocTypeVersion(0x4287)
+ , DocTypeReadVersion(0x4285)
+{
+}
+
+QWORD EBML::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += EBMLVersion.Size();
+ len += EBMLReadVersion.Size();
+ len += EBMLMaxIDLength.Size();
+ len += EBMLMaxSizeLength.Size();
+ len += DocType.Size();
+ len += DocTypeVersion.Size();
+ len += DocTypeReadVersion.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT EBML::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ EBMLVersion.Write(pStream);
+ EBMLReadVersion.Write(pStream);
+ EBMLMaxIDLength.Write(pStream);
+ EBMLMaxSizeLength.Write(pStream);
+ DocType.Write(pStream);
+ DocTypeVersion.Write(pStream);
+ DocTypeReadVersion.Write(pStream);
+ return S_OK;
+}
+
+Info::Info(DWORD id)
+ : CID(id)
+ , SegmentUID(0x73A4)
+ , SegmentFilename(0x7384)
+ , PrevUID(0x3CB923)
+ , PrevFilename(0x3C83AB)
+ , NextUID(0x3EB923)
+ , NextFilename(0x3E83BB)
+ , TimeCodeScale(0x2AD7B1, 1000000ui64)
+ , Duration(0x4489)
+ , DateUTC(0x4461)
+ , Title(0x7BA9)
+ , MuxingApp(0x4D80)
+ , WritingApp(0x5741)
+{
+}
+
+QWORD Info::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += SegmentUID.Size();
+ len += PrevUID.Size();
+ len += NextUID.Size();
+ len += SegmentFilename.Size();
+ len += PrevFilename.Size();
+ len += NextFilename.Size();
+ len += TimeCodeScale.Size();
+ len += Duration.Size();
+ len += DateUTC.Size();
+ len += Title.Size();
+ len += MuxingApp.Size();
+ len += WritingApp.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT Info::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ SegmentUID.Write(pStream);
+ PrevUID.Write(pStream);
+ NextUID.Write(pStream);
+ SegmentFilename.Write(pStream);
+ PrevFilename.Write(pStream);
+ NextFilename.Write(pStream);
+ TimeCodeScale.Write(pStream);
+ Duration.Write(pStream);
+ DateUTC.Write(pStream);
+ Title.Write(pStream);
+ MuxingApp.Write(pStream);
+ WritingApp.Write(pStream);
+ return S_OK;
+}
+
+Segment::Segment(DWORD id)
+ : CID(id)
+{
+}
+
+QWORD Segment::Size(bool fWithHeader)
+{
+ return 0x00FFFFFFFFFFFFFFi64;
+/*
+ QWORD len = 0;
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+*/
+}
+
+HRESULT Segment::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ return S_OK;
+}
+
+Track::Track(DWORD id)
+ : CID(id)
+{
+}
+
+QWORD Track::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += TrackEntries.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT Track::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ TrackEntries.Write(pStream);
+ return S_OK;
+}
+
+TrackEntry::TrackEntry(DWORD id)
+ : CID(id)
+ , TrackNumber(0xD7)
+ , TrackUID(0x73C5)
+ , TrackType(0x83)
+ , FlagEnabled(0xB9)
+ , FlagDefault(0x88)
+ , FlagLacing(0x9C)
+ , MinCache(0x6DE7)
+ , MaxCache(0x6DF8)
+ , Name(0x536E)
+ , Language(0x22B59C)
+ , CodecID(0x86)
+ , CodecPrivate(0x63A2)
+ , CodecName(0x258688)
+ , CodecSettings(0x3A9697)
+ , CodecInfoURL(0x3B4040)
+ , CodecDownloadURL(0x26B240)
+ , CodecDecodeAll(0xAA)
+ , TrackOverlay(0x6FAB)
+ , DefaultDuration(0x23E383)
+ , v(0xE0)
+ , a(0xE1)
+{
+ DescType = NoDesc;
+}
+
+QWORD TrackEntry::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += TrackNumber.Size();
+ len += TrackUID.Size();
+ len += TrackType.Size();
+ len += FlagEnabled.Size();
+ len += FlagDefault.Size();
+ len += FlagLacing.Size();
+ len += MinCache.Size();
+ len += MaxCache.Size();
+ len += Name.Size();
+ len += Language.Size();
+ len += CodecID.Size();
+ len += CodecPrivate.Size();
+ len += CodecName.Size();
+ len += CodecSettings.Size();
+ len += CodecInfoURL.Size();
+ len += CodecDownloadURL.Size();
+ len += CodecDecodeAll.Size();
+ len += TrackOverlay.Size();
+ len += DefaultDuration.Size();
+ if(DescType == TypeVideo) len += v.Size();
+ if(DescType == TypeAudio) len += a.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT TrackEntry::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ TrackNumber.Write(pStream);
+ TrackUID.Write(pStream);
+ TrackType.Write(pStream);
+ FlagEnabled.Write(pStream);
+ FlagDefault.Write(pStream);
+ FlagLacing.Write(pStream);
+ MinCache.Write(pStream);
+ MaxCache.Write(pStream);
+ Name.Write(pStream);
+ Language.Write(pStream);
+ CodecID.Write(pStream);
+ CodecPrivate.Write(pStream);
+ CodecName.Write(pStream);
+ CodecSettings.Write(pStream);
+ CodecInfoURL.Write(pStream);
+ CodecDownloadURL.Write(pStream);
+ CodecDecodeAll.Write(pStream);
+ TrackOverlay.Write(pStream);
+ DefaultDuration.Write(pStream);
+ if(DescType == TypeVideo) v.Write(pStream);
+ if(DescType == TypeAudio) a.Write(pStream);
+ return S_OK;
+}
+
+Video::Video(DWORD id)
+ : CID(id)
+ , FlagInterlaced(0x9A)
+ , StereoMode(0x53B8)
+ , PixelWidth(0xB0)
+ , PixelHeight(0xBA)
+ , DisplayWidth(0x54B0)
+ , DisplayHeight(0x54BA)
+ , DisplayUnit(0x54B2)
+ , AspectRatioType(0x54B3)
+ , ColourSpace(0x2EB524)
+ , GammaValue(0x2FB523)
+ , FramePerSec(0x2383E3)
+{
+}
+
+QWORD Video::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += FlagInterlaced.Size();
+ len += StereoMode.Size();
+ len += PixelWidth.Size();
+ len += PixelHeight.Size();
+ len += DisplayWidth.Size();
+ len += DisplayHeight.Size();
+ len += DisplayUnit.Size();
+ len += AspectRatioType.Size();
+ len += ColourSpace.Size();
+ len += GammaValue.Size();
+ len += FramePerSec.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT Video::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ FlagInterlaced.Write(pStream);
+ StereoMode.Write(pStream);
+ PixelWidth.Write(pStream);
+ PixelHeight.Write(pStream);
+ DisplayWidth.Write(pStream);
+ DisplayHeight.Write(pStream);
+ DisplayUnit.Write(pStream);
+ AspectRatioType.Write(pStream);
+ ColourSpace.Write(pStream);
+ GammaValue.Write(pStream);
+ FramePerSec.Write(pStream);
+ return S_OK;
+}
+
+Audio::Audio(DWORD id)
+ : CID(id)
+ , SamplingFrequency(0xB5)
+ , OutputSamplingFrequency(0x78B5)
+ , Channels(0x9F)
+ , ChannelPositions(0x7D7B)
+ , BitDepth(0x6264)
+{
+}
+
+QWORD Audio::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += SamplingFrequency.Size();
+ len += OutputSamplingFrequency.Size();
+ len += Channels.Size();
+ len += ChannelPositions.Size();
+ len += BitDepth.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT Audio::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ SamplingFrequency.Write(pStream);
+ OutputSamplingFrequency.Write(pStream);
+ Channels.Write(pStream);
+ ChannelPositions.Write(pStream);
+ BitDepth.Write(pStream);
+ return S_OK;
+}
+
+Cluster::Cluster(DWORD id)
+ : CID(id)
+ , TimeCode(0xE7)
+ , Position(0xA7)
+ , PrevSize(0xAB)
+{
+}
+
+QWORD Cluster::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += TimeCode.Size();
+ len += Position.Size();
+ len += PrevSize.Size();
+ len += BlockGroups.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT Cluster::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ TimeCode.Write(pStream);
+ Position.Write(pStream);
+ PrevSize.Write(pStream);
+ BlockGroups.Write(pStream);
+ return S_OK;
+}
+
+BlockGroup::BlockGroup(DWORD id)
+ : CID(id)
+ , BlockDuration(0x9B)
+ , ReferencePriority(0xFA)
+ , ReferenceBlock(0xFB)
+ , ReferenceVirtual(0xFD)
+ , CodecState(0xA4)
+{
+}
+
+QWORD BlockGroup::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += BlockDuration.Size();
+ len += ReferencePriority.Size();
+ len += ReferenceBlock.Size();
+ len += ReferenceVirtual.Size();
+ len += CodecState.Size();
+ len += Block.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT BlockGroup::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ BlockDuration.Write(pStream);
+ ReferencePriority.Write(pStream);
+ ReferenceBlock.Write(pStream);
+ ReferenceVirtual.Write(pStream);
+ CodecState.Write(pStream);
+ Block.Write(pStream);
+ return S_OK;
+}
+
+CBlock::CBlock(DWORD id)
+ : CID(id)
+ , TimeCode(0)
+{
+}
+
+QWORD CBlock::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += TrackNumber.Size() + 2 + 1; // TrackNumber + TimeCode + Lacing
+ if(BlockData.GetCount() > 1)
+ {
+ len += 1; // nBlockData
+ POSITION pos = BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* b = BlockData.GetNext(pos);
+ if(pos) len += b->GetCount()/255 + 1;
+ }
+ }
+ POSITION pos = BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* b = BlockData.GetNext(pos);
+ len += b->GetCount();
+ }
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT CBlock::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ TrackNumber.Write(pStream);
+ short t = (short)TimeCode;
+ bswap((BYTE*)&t, 2);
+ pStream->Write(&t, 2, NULL);
+ BYTE Lacing = 0;
+ BYTE n = BlockData.GetCount();
+ if(n > 1) Lacing |= 2;
+ pStream->Write(&Lacing, 1, NULL);
+ if(n > 1)
+ {
+ pStream->Write(&n, 1, NULL);
+ POSITION pos = BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* b = BlockData.GetNext(pos);
+ if(pos)
+ {
+ int len = b->GetCount();
+ while(len >= 0)
+ {
+ n = min(len, 255);
+ pStream->Write(&n, 1, NULL);
+ len -= 255;
+ }
+ }
+ }
+ }
+ POSITION pos = BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* b = BlockData.GetNext(pos);
+ pStream->Write(b->GetData(), b->GetCount(), NULL);
+ }
+ return S_OK;
+}
+
+Cue::Cue(DWORD id)
+ : CID(id)
+{
+}
+
+QWORD Cue::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += CuePoints.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT Cue::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ CuePoints.Write(pStream);
+ return S_OK;
+}
+
+CuePoint::CuePoint(DWORD id)
+ : CID(id)
+ , CueTime(0xB3)
+{
+}
+
+QWORD CuePoint::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += CueTime.Size();
+ len += CueTrackPositions.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT CuePoint::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ CueTime.Write(pStream);
+ CueTrackPositions.Write(pStream);
+ return S_OK;
+}
+
+CueTrackPosition::CueTrackPosition(DWORD id)
+ : CID(id)
+ , CueTrack(0xF7)
+ , CueClusterPosition(0xF1)
+ , CueBlockNumber(0x5387)
+ , CueCodecState(0xEA)
+{
+}
+
+QWORD CueTrackPosition::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += CueTrack.Size();
+ len += CueClusterPosition.Size();
+ len += CueBlockNumber.Size();
+ len += CueCodecState.Size();
+// len += CueReferences.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT CueTrackPosition::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ CueTrack.Write(pStream);
+ CueClusterPosition.Write(pStream);
+ CueBlockNumber.Write(pStream);
+ CueCodecState.Write(pStream);
+// CueReferences.Write(pStream);
+ return S_OK;
+}
+
+Seek::Seek(DWORD id)
+ : CID(id)
+{
+}
+
+QWORD Seek::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += SeekHeads.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT Seek::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ SeekHeads.Write(pStream);
+ return S_OK;
+}
+
+SeekID::SeekID(DWORD id)
+ : CID(id)
+ , m_id(0)
+{
+}
+
+QWORD SeekID::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += m_id.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT SeekID::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ m_id.Write(pStream);
+ return S_OK;
+}
+
+SeekHead::SeekHead(DWORD id)
+ : CID(id)
+ , Position(0x53AC)
+{
+}
+
+QWORD SeekHead::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += ID.Size();
+ len += Position.Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT SeekHead::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ ID.Write(pStream);
+ Position.Write(pStream);
+ return S_OK;
+}
+
+Tags::Tags(DWORD id)
+ : CID(id)
+{
+}
+
+QWORD Tags::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+// len += .Size();
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT Tags::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+// .Write(pStream);
+ return S_OK;
+}
+
+Void::Void(QWORD len, DWORD id)
+ : CID(id)
+ , m_len(len)
+{
+}
+
+QWORD Void::Size(bool fWithHeader)
+{
+ QWORD len = 0;
+ len += m_len;
+ if(fWithHeader) len += HeaderSize(len);
+ return len;
+}
+
+HRESULT Void::Write(IStream* pStream)
+{
+ HeaderWrite(pStream);
+ BYTE buff[64];
+ memset(buff, 0x80, sizeof(buff));
+ for(int len = (int)m_len; len > 0; len -= sizeof(buff))
+ pStream->Write(buff, (ULONG)min(sizeof(buff), len), NULL);
+ return S_OK;
+}
diff --git a/src/filters/muxer/matroskamuxer/MatroskaFile.h b/src/filters/muxer/matroskamuxer/MatroskaFile.h
new file mode 100644
index 000000000..664f44a6d
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaFile.h
@@ -0,0 +1,387 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+
+namespace MatroskaWriter
+{
+ typedef unsigned __int64 QWORD;
+
+ class CID
+ {
+ protected:
+ DWORD m_id;
+ QWORD HeaderSize(QWORD len);
+ HRESULT HeaderWrite(IStream* pStream);
+
+ public:
+ CID(DWORD id);
+ DWORD GetID() {return m_id;}
+ virtual QWORD Size(bool fWithHeader = true);
+ virtual HRESULT Write(IStream* pStream);
+ };
+
+ class CLength : public CID
+ {
+ UINT64 m_len;
+ public:
+ CLength(UINT64 len = 0) : CID(0), m_len(len) {}
+ operator UINT64() {return m_len;}
+ QWORD Size(bool fWithHeader = false);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CBinary : public CAtlArray<BYTE>, public CID
+ {
+ public:
+ CBinary(DWORD id) : CID(id) {}
+ CBinary& operator = (const CBinary& b) {Copy(b); return(*this);}
+ operator BYTE*() {return (BYTE*)GetData();}
+ CBinary& Set(CStringA str) {SetCount(str.GetLength()+1); strcpy((char*)GetData(), str); return(*this);}
+// CBinary& Set(CStringA str) {SetCount(str.GetLength()); memcpy((char*)GetData(), str, str.GetLength()); return(*this);}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CANSI : public CStringA, public CID
+ {
+ public:
+ CANSI(DWORD id) : CID(id) {}
+ CANSI& Set(CStringA str) {CStringA::operator = (str); return(*this);}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CUTF8 : public CStringW, public CID
+ {
+ public:
+ CUTF8(DWORD id) : CID(id) {}
+ CUTF8& Set(CStringW str) {CStringW::operator = (str); return(*this);}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ template<class T, class BASE>
+ class CSimpleVar : public CID
+ {
+ protected:
+ T m_val;
+ bool m_fSet;
+ public:
+ explicit CSimpleVar(DWORD id, T val = 0) : CID(id), m_val(val) {m_fSet = !!val;}
+ operator T() {return m_val;}
+ BASE& Set(T val) {m_val = val; m_fSet = true; return(*(BASE*)this);}
+ void UnSet() {m_fSet = false;}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CUInt : public CSimpleVar<UINT64, CUInt>
+ {
+ public:
+ explicit CUInt(DWORD id, UINT64 val = 0) : CSimpleVar<UINT64, CUInt>(id, val) {}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CInt : public CSimpleVar<INT64, CInt>
+ {
+ public:
+ explicit CInt(DWORD id, INT64 val = 0) : CSimpleVar<INT64, CInt>(id, val) {}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CByte : public CSimpleVar<BYTE, CByte>
+ {
+ public:
+ explicit CByte(DWORD id, BYTE val = 0) : CSimpleVar<BYTE, CByte>(id, val) {}
+ };
+
+ class CShort : public CSimpleVar<short, CShort>
+ {
+ public:
+ explicit CShort(DWORD id, short val = 0) : CSimpleVar<short, CShort>(id, val) {}
+ };
+
+ class CFloat : public CSimpleVar<float, CFloat>
+ {
+ public:
+ explicit CFloat(DWORD id, float val = 0) : CSimpleVar<float, CFloat>(id, val) {}
+ };
+
+ template<class T>
+ class CNode : public CAutoPtrList<T>
+ {
+ public:
+ QWORD Size(bool fWithHeader = true)
+ {
+ QWORD len = 0;
+ POSITION pos = GetHeadPosition();
+ while(pos) len += GetNext(pos)->Size(fWithHeader);
+ return len;
+ }
+ HRESULT Write(IStream* pStream)
+ {
+ HRESULT hr;
+ POSITION pos = GetHeadPosition();
+ while(pos) if(FAILED(hr = GetNext(pos)->Write(pStream))) return hr;
+ return S_OK;
+ }
+ };
+
+ class EBML : public CID
+ {
+ public:
+ CUInt EBMLVersion, EBMLReadVersion;
+ CUInt EBMLMaxIDLength, EBMLMaxSizeLength;
+ CANSI DocType;
+ CUInt DocTypeVersion, DocTypeReadVersion;
+
+ EBML(DWORD id = 0x1A45DFA3);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Info : public CID
+ {
+ public:
+ CBinary SegmentUID, PrevUID, NextUID;
+ CUTF8 SegmentFilename, PrevFilename, NextFilename;
+ CUInt TimeCodeScale; // [ns], default: 1.000.000
+ CFloat Duration;
+ CInt DateUTC;
+ CUTF8 Title, MuxingApp, WritingApp;
+
+ Info(DWORD id = 0x1549A966);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Video : public CID
+ {
+ public:
+ CUInt FlagInterlaced, StereoMode;
+ CUInt PixelWidth, PixelHeight, DisplayWidth, DisplayHeight, DisplayUnit;
+ CUInt AspectRatioType;
+ CUInt ColourSpace;
+ CFloat GammaValue;
+ CFloat FramePerSec;
+
+ Video(DWORD id = 0xE0);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Audio : public CID
+ {
+ public:
+ CFloat SamplingFrequency;
+ CFloat OutputSamplingFrequency;
+ CUInt Channels;
+ CBinary ChannelPositions;
+ CUInt BitDepth;
+
+ Audio(DWORD id = 0xE1);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class TrackEntry : public CID
+ {
+ public:
+ enum {TypeVideo = 1, TypeAudio = 2, TypeComplex = 3, TypeLogo = 0x10, TypeSubtitle = 0x11, TypeControl = 0x20};
+ CUInt TrackNumber, TrackUID, TrackType;
+ CUInt FlagEnabled, FlagDefault, FlagLacing;
+ CUInt MinCache, MaxCache;
+ CUTF8 Name;
+ CANSI Language;
+ CBinary CodecID;
+ CBinary CodecPrivate;
+ CUTF8 CodecName;
+ CUTF8 CodecSettings;
+ CANSI CodecInfoURL;
+ CANSI CodecDownloadURL;
+ CUInt CodecDecodeAll;
+ CUInt TrackOverlay;
+ CUInt DefaultDuration;
+ enum {NoDesc = 0, DescVideo = 1, DescAudio = 2};
+ int DescType;
+ Video v;
+ Audio a;
+
+ TrackEntry(DWORD id = 0xAE);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Track : public CID
+ {
+ public:
+ CNode<TrackEntry> TrackEntries;
+
+ Track(DWORD id = 0x1654AE6B);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CBlock : public CID
+ {
+ public:
+ CLength TrackNumber;
+ REFERENCE_TIME TimeCode, TimeCodeStop;
+ CNode<CBinary> BlockData;
+
+ CBlock(DWORD id = 0xA1);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class BlockGroup : public CID
+ {
+ public:
+ CUInt BlockDuration;
+ CUInt ReferencePriority;
+ CInt ReferenceBlock;
+ CInt ReferenceVirtual;
+ CBinary CodecState;
+ CBlock Block;
+// CNode<TimeSlice> TimeSlices;
+
+ BlockGroup(DWORD id = 0xA0);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Cluster : public CID
+ {
+ public:
+ CUInt TimeCode, Position, PrevSize;
+ CNode<BlockGroup> BlockGroups;
+
+ Cluster(DWORD id = 0x1F43B675);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+/* class CueReference : public CID
+ {
+ public:
+ CUInt CueRefTime, CueRefCluster, CueRefNumber, CueRefCodecState;
+
+ CueReference(DWORD id = 0xDB);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+*/
+ class CueTrackPosition : public CID
+ {
+ public:
+ CUInt CueTrack, CueClusterPosition, CueBlockNumber, CueCodecState;
+// CNode<CueReference> CueReferences;
+
+ CueTrackPosition(DWORD id = 0xB7);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class CuePoint : public CID
+ {
+ public:
+ CUInt CueTime;
+ CNode<CueTrackPosition> CueTrackPositions;
+
+ CuePoint(DWORD id = 0xBB);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Cue : public CID
+ {
+ public:
+ CNode<CuePoint> CuePoints;
+
+ Cue(DWORD id = 0x1C53BB6B);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class SeekID : public CID
+ {
+ CID m_id;
+ public:
+ SeekID(DWORD id = 0x53AB);
+ void Set(DWORD id) {m_id = id;}
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class SeekHead : public CID
+ {
+ public:
+ SeekID ID;
+ CUInt Position;
+
+ SeekHead(DWORD id = 0x4DBB);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Seek : public CID
+ {
+ public:
+ CNode<SeekHead> SeekHeads;
+
+ Seek(DWORD id = 0x114D9B74);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Segment : public CID
+ {
+ public:
+ Segment(DWORD id = 0x18538067);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Tags : public CID
+ {
+ public:
+ // TODO
+
+ Tags(DWORD id = 0x1254C367);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+
+ class Void : public CID
+ {
+ QWORD m_len;
+ public:
+ Void(QWORD len, DWORD id = 0xEC);
+ QWORD Size(bool fWithHeader = true);
+ HRESULT Write(IStream* pStream);
+ };
+}
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer.cpp b/src/filters/muxer/matroskamuxer/MatroskaMuxer.cpp
new file mode 100644
index 000000000..4283aa325
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer.cpp
@@ -0,0 +1,1363 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include "MatroskaMuxer.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+using namespace MatroskaWriter;
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Matroska}
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, TRUE, &CLSID_NULL, NULL, 0, NULL},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CMatroskaMuxerFilter), L"Matroska Muxer", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMatroskaMuxerFilter>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CMatroskaMuxerFilter
+//
+
+CMatroskaMuxerFilter::CMatroskaMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseFilter(NAME("CMatroskaMuxerFilter"), pUnk, this, __uuidof(this))
+ , m_rtCurrent(0)
+ , m_fNegative(true), m_fPositive(false)
+{
+ if(phr) *phr = S_OK;
+
+ m_pOutput.Attach(new CMatroskaMuxerOutputPin(NAME("CMatroskaMuxerOutputPin"), this, this, phr));
+
+ AddInput();
+
+ srand(clock());
+}
+
+CMatroskaMuxerFilter::~CMatroskaMuxerFilter()
+{
+ CAutoLock cAutoLock(this);
+}
+
+STDMETHODIMP CMatroskaMuxerFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ *ppv = NULL;
+
+ return
+// QI(IAMFilterMiscFlags)
+ QI(IMediaSeeking)
+ QI(IMatroskaMuxer)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+UINT CMatroskaMuxerFilter::GetTrackNumber(CBasePin* pPin)
+{
+ UINT nTrackNumber = 0;
+
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ nTrackNumber++;
+ if(m_pInputs.GetNext(pos) == pPin)
+ return nTrackNumber;
+ }
+
+ return 0;
+}
+
+void CMatroskaMuxerFilter::AddInput()
+{
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CBasePin* pPin = m_pInputs.GetNext(pos);
+ if(!pPin->IsConnected()) return;
+ }
+
+ CStringW name;
+ name.Format(L"Track %d", m_pInputs.GetCount()+1);
+
+ HRESULT hr;
+ CAutoPtr<CMatroskaMuxerInputPin> pPin(new CMatroskaMuxerInputPin(name, this, this, &hr));
+ m_pInputs.AddTail(pPin);
+}
+
+int CMatroskaMuxerFilter::GetPinCount()
+{
+ return m_pInputs.GetCount() + (m_pOutput ? 1 : 0);
+}
+
+CBasePin* CMatroskaMuxerFilter::GetPin(int n)
+{
+ CAutoLock cAutoLock(this);
+
+ if(n >= 0 && n < (int)m_pInputs.GetCount())
+ {
+ if(POSITION pos = m_pInputs.FindIndex(n))
+ return m_pInputs.GetAt(pos);
+ }
+
+ if(n == m_pInputs.GetCount() && m_pOutput)
+ {
+ return m_pOutput;
+ }
+
+ return NULL;
+}
+
+STDMETHODIMP CMatroskaMuxerFilter::Stop()
+{
+ CAutoLock cAutoLock(this);
+
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Stop()))
+ return hr;
+
+ CallWorker(CMD_EXIT);
+
+ return hr;
+}
+
+STDMETHODIMP CMatroskaMuxerFilter::Pause()
+{
+ CAutoLock cAutoLock(this);
+
+ FILTER_STATE fs = m_State;
+
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Pause()))
+ return hr;
+
+ if(fs == State_Stopped && m_pOutput)
+ {
+ CAMThread::Create();
+ CallWorker(CMD_RUN);
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CMatroskaMuxerFilter::Run(REFERENCE_TIME tStart)
+{
+ CAutoLock cAutoLock(this);
+
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Run(tStart)))
+ return hr;
+
+ return hr;
+}
+
+// IAMFilterMiscFlags
+
+STDMETHODIMP_(ULONG) CMatroskaMuxerFilter::GetMiscFlags()
+{
+ return AM_FILTER_MISC_FLAGS_IS_RENDERER;
+}
+
+// IMediaSeeking
+
+STDMETHODIMP CMatroskaMuxerFilter::GetCapabilities(DWORD* pCapabilities)
+{
+ return pCapabilities ? *pCapabilities =
+ AM_SEEKING_CanGetDuration|
+ AM_SEEKING_CanGetCurrentPos, S_OK : E_POINTER;
+}
+STDMETHODIMP CMatroskaMuxerFilter::CheckCapabilities(DWORD* pCapabilities)
+{
+ CheckPointer(pCapabilities, E_POINTER);
+ if(*pCapabilities == 0) return S_OK;
+ DWORD caps;
+ GetCapabilities(&caps);
+ caps &= *pCapabilities;
+ return caps == 0 ? E_FAIL : caps == *pCapabilities ? S_OK : S_FALSE;
+}
+STDMETHODIMP CMatroskaMuxerFilter::IsFormatSupported(const GUID* pFormat) {return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;}
+STDMETHODIMP CMatroskaMuxerFilter::QueryPreferredFormat(GUID* pFormat) {return GetTimeFormat(pFormat);}
+STDMETHODIMP CMatroskaMuxerFilter::GetTimeFormat(GUID* pFormat) {return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;}
+STDMETHODIMP CMatroskaMuxerFilter::IsUsingTimeFormat(const GUID* pFormat) {return IsFormatSupported(pFormat);}
+STDMETHODIMP CMatroskaMuxerFilter::SetTimeFormat(const GUID* pFormat) {return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;}
+STDMETHODIMP CMatroskaMuxerFilter::GetDuration(LONGLONG* pDuration)
+{
+ CheckPointer(pDuration, E_POINTER);
+ *pDuration = 0;
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos) {REFERENCE_TIME rt = m_pInputs.GetNext(pos)->m_rtDur; if(rt > *pDuration) *pDuration = rt;}
+ return S_OK;
+}
+STDMETHODIMP CMatroskaMuxerFilter::GetStopPosition(LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetCurrentPosition(LONGLONG* pCurrent)
+{
+ CheckPointer(pCurrent, E_POINTER);
+ *pCurrent = m_rtCurrent;
+ return S_OK;
+}
+STDMETHODIMP CMatroskaMuxerFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::SetRate(double dRate) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetRate(double* pdRate) {return E_NOTIMPL;}
+STDMETHODIMP CMatroskaMuxerFilter::GetPreroll(LONGLONG* pllPreroll) {return E_NOTIMPL;}
+
+// IMatroskaMuxer
+
+STDMETHODIMP CMatroskaMuxerFilter::CorrectTimeOffset(bool fNegative, bool fPositive)
+{
+ m_fNegative = fNegative;
+ m_fPositive = fPositive;
+ return S_OK;
+}
+
+//
+
+ULONGLONG GetStreamPosition(IStream* pStream)
+{
+ ULARGE_INTEGER pos = {0, 0};
+ pStream->Seek(*(LARGE_INTEGER*)&pos, STREAM_SEEK_CUR, &pos);
+ return pos.QuadPart;
+}
+
+ULONGLONG SetStreamPosition(IStream* pStream, ULONGLONG seekpos)
+{
+ LARGE_INTEGER pos;
+ pos.QuadPart = seekpos;
+ ULARGE_INTEGER posnew;
+ posnew.QuadPart = GetStreamPosition(pStream);
+ pStream->Seek(pos, STREAM_SEEK_SET, &posnew);
+ return posnew.QuadPart;
+}
+
+DWORD CMatroskaMuxerFilter::ThreadProc()
+{
+ CComQIPtr<IStream> pStream;
+
+ if(!m_pOutput || !(pStream = m_pOutput->GetConnected()))
+ {
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+ if(cmd == CMD_EXIT) CAMThread::m_hThread = NULL;
+ Reply(S_OK);
+ if(cmd == CMD_EXIT) return 0;
+ }
+ }
+
+ REFERENCE_TIME rtDur = 0;
+ GetDuration(&rtDur);
+
+ SetStreamPosition(pStream, 0);
+
+ ULARGE_INTEGER uli = {0};
+ pStream->SetSize(uli);
+
+ EBML hdr;
+ hdr.DocType.Set("matroska");
+ hdr.DocTypeVersion.Set(1);
+ hdr.DocTypeReadVersion.Set(1);
+ hdr.Write(pStream);
+
+ Segment().Write(pStream);
+ ULONGLONG segpos = GetStreamPosition(pStream);
+
+ // TODO
+ QWORD voidlen = 100;
+ if(rtDur > 0) voidlen += int(1.0 * rtDur / MAXCLUSTERTIME / 10000 + 0.5) * 20;
+ else voidlen += int(1.0 * 1000*60*60*24 / MAXCLUSTERTIME + 0.5) * 20; // when no duration is known, allocate for 24 hours (~340k)
+ ULONGLONG voidpos = GetStreamPosition(pStream);
+ {
+ Void v(voidlen);
+ voidlen = v.Size();
+ v.Write(pStream);
+ }
+
+ // Meta Seek
+
+ Seek seek;
+ CAutoPtr<SeekHead> sh;
+
+ // Segment Info
+
+ sh.Attach(new SeekHead());
+ sh->ID.Set(0x1549A966);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ ULONGLONG infopos = GetStreamPosition(pStream);
+ Info info;
+ info.MuxingApp.Set(L"DirectShow Matroska Muxer");
+ info.TimeCodeScale.Set(1000000);
+ info.Duration.Set((float)rtDur / 10000);
+ struct tm _2001 = {0, 0, 0, 1, 0, 101, 0, 0, 1};
+ info.DateUTC.Set((_time64(NULL) - _mktime64(&_2001)) * 1000000000);
+ info.Write(pStream);
+
+ // Tracks
+
+ sh.Attach(new SeekHead());
+ sh->ID.Set(0x1654AE6B);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ UINT64 TrackNumber = 0;
+/*
+ CNode<Track> Tracks;
+ CAutoPtr<Track> pT(new Track());
+ POSITION pos = m_pInputs.GetHeadPosition();
+ for(int i = 1; pos; i++)
+ {
+ CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
+ if(!pPin->IsConnected()) continue;
+
+ CAutoPtr<TrackEntry> pTE(new TrackEntry());
+ *pTE = *pPin->GetTrackEntry();
+ if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
+ TrackNumber = pTE->TrackNumber;
+ pT->TrackEntries.AddTail(pTE);
+ }
+ Tracks.AddTail(pT);
+ Tracks.Write(pStream);
+
+ if(TrackNumber == 0) TrackNumber = 1;
+*/
+ bool fTracksWritten = false;
+
+ //
+
+ Cluster c;
+ c.TimeCode.Set(0);
+
+ bool fFirstBlock = true;
+ INT64 firstTimeCode = 0;
+
+ CAtlList<CMatroskaMuxerInputPin*> pActivePins;
+
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CMatroskaMuxerInputPin* pPin = m_pInputs.GetNext(pos);
+ if(pPin->IsConnected()) pActivePins.AddTail(pPin);
+ }
+
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+
+ switch(cmd)
+ {
+ default:
+ case CMD_EXIT:
+ CAMThread::m_hThread = NULL;
+ Reply(S_OK);
+ return 0;
+
+ case CMD_RUN:
+ Reply(S_OK);
+
+ Cue cue;
+ ULONGLONG lastcueclusterpos = -1;
+ INT64 lastcuetimecode = -1;
+ UINT64 nBlocksInCueTrack = 0;
+
+ while(!CheckRequest(NULL))
+ {
+ if(m_State == State_Paused)
+ {
+ Sleep(10);
+ continue;
+ }
+
+ int nPinsGotSomething = 0, nPinsNeeded = 0;
+ CMatroskaMuxerInputPin* pPin = NULL;
+ REFERENCE_TIME rtMin = _I64_MAX;
+
+ pos = pActivePins.GetHeadPosition();
+ while(pos)
+ {
+ CMatroskaMuxerInputPin* pTmp = pActivePins.GetNext(pos);
+
+ CAutoLock cAutoLock(&pTmp->m_csQueue);
+
+ if(pTmp->m_blocks.GetCount() == 0 && pTmp->m_fEndOfStreamReceived)
+ {
+ pActivePins.RemoveAt(pActivePins.Find(pTmp));
+ continue;
+ }
+
+ if(pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle)
+ nPinsNeeded++;
+
+ if(pTmp->m_blocks.GetCount() > 0)
+ {
+ if(pTmp->GetTrackEntry()->TrackType != TrackEntry::TypeSubtitle)
+ nPinsGotSomething++;
+
+ if(pTmp->m_blocks.GetCount() > 0)
+ {
+ REFERENCE_TIME rt = pTmp->m_blocks.GetHead()->Block.TimeCode;
+ if(rt < rtMin) {rtMin = rt; pPin = pTmp;}
+ }
+ }
+ }
+
+ if(pActivePins.GetCount() == 0)
+ {
+ break;
+ }
+
+ if(!pPin || nPinsNeeded > nPinsGotSomething || !pPin && nPinsGotSomething == 0)
+ {
+ Sleep(1);
+ continue;
+ }
+
+ if(!fTracksWritten)
+ {
+ CNode<Track> Tracks;
+ CAutoPtr<Track> pT(new Track());
+ POSITION pos = pActivePins.GetHeadPosition();
+ for(int i = 1; pos; i++)
+ {
+ CMatroskaMuxerInputPin* pPin = pActivePins.GetNext(pos);
+
+ CAutoPtr<TrackEntry> pTE(new TrackEntry());
+ *pTE = *pPin->GetTrackEntry();
+ if(TrackNumber == 0 && pTE->TrackType == TrackEntry::TypeVideo)
+ TrackNumber = pTE->TrackNumber;
+ pT->TrackEntries.AddTail(pTE);
+ }
+ Tracks.AddTail(pT);
+ Tracks.Write(pStream);
+
+ if(TrackNumber == 0) TrackNumber = 1;
+
+ fTracksWritten = true;
+ }
+
+ ASSERT(pPin);
+
+ CAutoPtr<BlockGroup> b;
+
+ {
+ CAutoLock cAutoLock(&pPin->m_csQueue);
+ b = pPin->m_blocks.RemoveHead();
+ }
+
+ if(b)
+ {
+ if(fFirstBlock)
+ {
+ if(b->Block.TimeCode < 0 && m_fNegative || b->Block.TimeCode > 0 && m_fPositive)
+ firstTimeCode = b->Block.TimeCode;
+ fFirstBlock = false;
+ }
+
+ b->Block.TimeCode -= firstTimeCode;
+ b->Block.TimeCodeStop -= firstTimeCode;
+
+/*
+TRACE(_T("Muxing (%d): %I64d-%I64d dur=%I64d (c=%d, co=%dms), cnt=%d, ref=%d\n"),
+ GetTrackNumber(pPin),
+ (INT64)b->Block.TimeCode, (INT64)b->Block.TimeCodeStop, (UINT64)b->BlockDuration,
+ (int)((b->Block.TimeCode)/MAXCLUSTERTIME), (int)(b->Block.TimeCode%MAXCLUSTERTIME),
+ b->Block.BlockData.GetCount(), (int)b->ReferenceBlock);
+*/
+ if(b->Block.TimeCode < SHRT_MIN /*0*/) {ASSERT(0); continue;}
+
+ while((INT64)(c.TimeCode + MAXCLUSTERTIME) < b->Block.TimeCode)
+ {
+ if(!c.BlockGroups.IsEmpty())
+ {
+ sh.Attach(new SeekHead());
+ sh->ID.Set(c.GetID()/*0x1F43B675*/);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ c.Write(pStream); // TODO: write blocks
+ }
+
+ c.TimeCode.Set(c.TimeCode + MAXCLUSTERTIME);
+ c.BlockGroups.RemoveAll();
+ nBlocksInCueTrack = 0;
+ }
+
+ if(b->Block.TrackNumber == TrackNumber)
+ {
+ nBlocksInCueTrack++;
+ }
+
+ if(b->ReferenceBlock == 0 && b->Block.TrackNumber == TrackNumber)
+ {
+ ULONGLONG clusterpos = GetStreamPosition(pStream) - segpos;
+ if(lastcueclusterpos != clusterpos || lastcuetimecode + 1000 < b->Block.TimeCode)
+ {
+ CAutoPtr<CueTrackPosition> ctp(new CueTrackPosition());
+ ctp->CueTrack.Set(b->Block.TrackNumber);
+ ctp->CueClusterPosition.Set(clusterpos);
+ if(c.BlockGroups.GetCount() > 0) ctp->CueBlockNumber.Set(nBlocksInCueTrack);
+ CAutoPtr<CuePoint> cp(new CuePoint());
+ cp->CueTime.Set(b->Block.TimeCode);
+ cp->CueTrackPositions.AddTail(ctp);
+ cue.CuePoints.AddTail(cp);
+ lastcueclusterpos = clusterpos;
+ lastcuetimecode = b->Block.TimeCode;
+ }
+ }
+
+ info.Duration.Set(max(info.Duration, (float)b->Block.TimeCodeStop));
+
+ m_rtCurrent = b->Block.TimeCode*10000;
+
+ b->Block.TimeCode -= c.TimeCode;
+ c.BlockGroups.AddTail(b);
+ }
+ }
+
+ if(!c.BlockGroups.IsEmpty())
+ {
+ sh.Attach(new SeekHead());
+ sh->ID.Set(c.GetID()/*0x1F43B675*/);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ c.Write(pStream);
+ }
+
+ ULONGLONG cuepos = 0;
+ if(!cue.CuePoints.IsEmpty())
+ {
+ sh.Attach(new SeekHead());
+ sh->ID.Set(cue.GetID()/*0x1C53BB6B*/);
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ cue.Write(pStream);
+ }
+
+ {
+ Tags tags;
+
+ sh.Attach(new SeekHead());
+ sh->ID.Set(tags.GetID());
+ sh->Position.Set(GetStreamPosition(pStream) - segpos);
+ seek.SeekHeads.AddTail(sh);
+
+ tags.Write(pStream);
+ }
+
+ SetStreamPosition(pStream, voidpos);
+ int len = (int)(voidlen - seek.Size());
+ ASSERT(len >= 0 && len != 1);
+ seek.Write(pStream);
+
+ if(len == 0)
+ {
+ // nothing to do
+ }
+ else if(len >= 2)
+ {
+ for(int i = 0; i < 8; i++)
+ {
+ if(len >= (1<<i*7)-2 && len <= (1<<(i+1)*7)-2)
+ {
+ Void(len-2-i).Write(pStream);
+ break;
+ }
+ }
+ }
+
+ if(abs(m_rtCurrent - (REFERENCE_TIME)info.Duration*10000) > 10000000i64)
+ {
+ info.Duration.Set(m_rtCurrent / 10000 + 1);
+ }
+
+ SetStreamPosition(pStream, infopos);
+ info.Write(pStream);
+
+ // TODO: write some tags
+
+ m_pOutput->DeliverEndOfStream();
+
+ break;
+ }
+ }
+
+ ASSERT(0); // we should only exit via CMD_EXIT
+
+ CAMThread::m_hThread = NULL;
+ return 0;
+}
+
+//
+// CMatroskaMuxerInputPin
+//
+
+CMatroskaMuxerInputPin::CMatroskaMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseInputPin(NAME("CMatroskaMuxerInputPin"), pFilter, pLock, phr, pName)
+ , m_fActive(false)
+ , m_fEndOfStreamReceived(false)
+ , m_rtDur(0)
+{
+}
+
+CMatroskaMuxerInputPin::~CMatroskaMuxerInputPin()
+{
+}
+
+STDMETHODIMP CMatroskaMuxerInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CMatroskaMuxerInputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Video && (pmt->formattype == FORMAT_VideoInfo
+ || pmt->formattype == FORMAT_VideoInfo2)
+// || pmt->majortype == MEDIATYPE_Video && pmt->subtype == MEDIASUBTYPE_MPEG1Payload && pmt->formattype == FORMAT_MPEGVideo
+// || pmt->majortype == MEDIATYPE_Video && pmt->subtype == MEDIASUBTYPE_MPEG2_VIDEO && pmt->formattype == FORMAT_MPEG2_VIDEO
+ || pmt->majortype == MEDIATYPE_Video && pmt->subtype == MEDIASUBTYPE_DiracVideo && pmt->formattype == FORMAT_DiracVideoInfo
+ || pmt->majortype == MEDIATYPE_Audio && pmt->formattype == FORMAT_WaveFormatEx && pmt->subtype == FOURCCMap(((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag)
+ || pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_Vorbis && pmt->formattype == FORMAT_VorbisFormat
+ || pmt->majortype == MEDIATYPE_Audio && pmt->subtype == MEDIASUBTYPE_Vorbis2 && pmt->formattype == FORMAT_VorbisFormat2
+ || pmt->majortype == MEDIATYPE_Audio && (pmt->subtype == MEDIASUBTYPE_14_4
+ || pmt->subtype == MEDIASUBTYPE_28_8
+ || pmt->subtype == MEDIASUBTYPE_ATRC
+ || pmt->subtype == MEDIASUBTYPE_COOK
+ || pmt->subtype == MEDIASUBTYPE_DNET
+ || pmt->subtype == MEDIASUBTYPE_SIPR) && pmt->formattype == FORMAT_WaveFormatEx
+ || pmt->majortype == MEDIATYPE_Text && pmt->subtype == MEDIASUBTYPE_NULL && pmt->formattype == FORMAT_None
+ || pmt->majortype == MEDIATYPE_Subtitle && pmt->formattype == FORMAT_SubtitleInfo
+ ? S_OK
+ : E_INVALIDARG;
+}
+
+HRESULT CMatroskaMuxerInputPin::BreakConnect()
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::BreakConnect()))
+ return hr;
+
+ m_pTE.Free();
+
+ return hr;
+}
+
+HRESULT CMatroskaMuxerInputPin::CompleteConnect(IPin* pPin)
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::CompleteConnect(pPin)))
+ return hr;
+
+ m_rtDur = 0;
+ CComQIPtr<IMediaSeeking> pMS;
+ if((pMS = GetFilterFromPin(pPin)) || (pMS = pPin))
+ pMS->GetDuration(&m_rtDur);
+
+ m_pTE.Free();
+ m_pTE.Attach(new TrackEntry());
+
+ m_pTE->TrackUID.Set(rand());
+ m_pTE->MinCache.Set(1);
+ m_pTE->MaxCache.Set(1);
+ m_pTE->TrackNumber.Set(((CMatroskaMuxerFilter*)m_pFilter)->GetTrackNumber(this));
+
+ hr = E_FAIL;
+
+ if(m_mt.majortype == MEDIATYPE_Video)
+ {
+ m_pTE->TrackType.Set(TrackEntry::TypeVideo);
+
+ if(m_mt.formattype == FORMAT_VideoInfo
+ && m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
+ || m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40)
+ {
+ m_pTE->CodecID.Set("V_REAL/RV00");
+ m_pTE->CodecID.SetAt(9, (BYTE)(m_mt.subtype.Data1>>16));
+
+ if(m_mt.formattype == FORMAT_VideoInfo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_mt.pbFormat;
+ if(m_mt.cbFormat > sizeof(VIDEOINFOHEADER))
+ {
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER));
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER), m_pTE->CodecPrivate.GetCount());
+ }
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
+ if(vih->AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)m_mt.pbFormat;
+ if(m_mt.cbFormat > sizeof(VIDEOINFOHEADER2))
+ {
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - sizeof(VIDEOINFOHEADER2));
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(VIDEOINFOHEADER2), m_pTE->CodecPrivate.GetCount());
+ }
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
+ if(vih->AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+ m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
+ m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
+ }
+ else
+ {
+ ASSERT(0);
+ return hr;
+ }
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo)
+ {
+ m_pTE->CodecID.Set("V_MS/VFW/FOURCC");
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader));
+ memcpy(m_pTE->CodecPrivate, &vih->bmiHeader, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
+ if(vih->AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo2)
+ {
+ m_pTE->CodecID.Set("V_MS/VFW/FOURCC");
+
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader));
+ memcpy(m_pTE->CodecPrivate, &vih->bmiHeader, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(vih->AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->bmiHeader.biHeight));
+ m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
+ m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
+ if(vih->AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_DiracVideoInfo)
+ {
+ m_pTE->CodecID.Set("V_DIRAC");
+
+ DIRACINFOHEADER* vih = (DIRACINFOHEADER*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(vih->cbSequenceHeader);
+ memcpy(m_pTE->CodecPrivate, (BYTE*)&vih->dwSequenceHeader[0], m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(vih->hdr.AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(vih->hdr.bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(vih->hdr.bmiHeader.biHeight));
+ // m_pTE->v.DisplayWidth.Set(vih->dwPictAspectRatioX);
+ // m_pTE->v.DisplayHeight.Set(vih->dwPictAspectRatioY);
+ if(vih->hdr.AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / vih->hdr.AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+/*
+ else if(m_mt.formattype == FORMAT_MPEGVideo)
+ {
+ m_pTE->CodecID.Set("V_DSHOW/MPEG1VIDEO"); // V_MPEG1
+
+ MPEG1VIDEOINFO* pm1vi = (MPEG1VIDEOINFO*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(pm1vi->hdr.AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(pm1vi->hdr.bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(pm1vi->hdr.bmiHeader.biHeight));
+ if(pm1vi->hdr.AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm1vi->hdr.AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_MPEG2_VIDEO)
+ {
+ m_pTE->CodecID.Set("V_DSHOW/MPEG2VIDEO"); // V_MPEG2
+
+ MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.FormatLength());
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DefaultDuration.Set(pm2vi->hdr.AvgTimePerFrame*100);
+ m_pTE->DescType = TrackEntry::DescVideo;
+ m_pTE->v.PixelWidth.Set(pm2vi->hdr.bmiHeader.biWidth);
+ m_pTE->v.PixelHeight.Set(abs(pm2vi->hdr.bmiHeader.biHeight));
+ if(pm2vi->hdr.AvgTimePerFrame > 0)
+ m_pTE->v.FramePerSec.Set((float)(10000000.0 / pm2vi->hdr.AvgTimePerFrame));
+
+ hr = S_OK;
+ }
+*/
+ }
+ else if(m_mt.majortype == MEDIATYPE_Audio)
+ {
+ m_pTE->TrackType.Set(TrackEntry::TypeAudio);
+
+ if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_AAC
+ && m_mt.cbFormat >= sizeof(WAVEFORMATEX)+2)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ BYTE* p = (BYTE*)(wfe+1);
+
+ DWORD nSamplesPerSec = wfe->nSamplesPerSec;
+
+ int profile = (p[0]>>3)-1;
+ int rate1 = ((p[0]&7)<<1)|(p[1]>>7);
+ int channels = ((p[1]>>3)&15);
+ int exttype = 0;
+ int rate2 = rate1;
+
+ if(wfe->cbSize >= 5)
+ {
+ profile = 4;
+
+ exttype = (p[2]<<3)|(p[3]>>5);
+ ASSERT(exttype == 0x2B7);
+ ASSERT((p[3]&31) == 5);
+ ASSERT((p[4]>>7) == 1);
+ rate2 = ((p[4]>>3)&15);
+
+ if(rate2 < rate1)
+ {
+ m_pTE->a.OutputSamplingFrequency.Set((float)nSamplesPerSec);
+ nSamplesPerSec /= 2;
+ }
+ }
+
+ switch(profile)
+ {
+ default:
+ case 0: m_pTE->CodecID.Set("A_AAC/MPEG2/MAIN"); break;
+ case 1: m_pTE->CodecID.Set("A_AAC/MPEG2/LC"); break;
+ case 2: m_pTE->CodecID.Set("A_AAC/MPEG2/SSR"); break;
+ case 3: m_pTE->CodecID.Set("A_AAC/MPEG4/LTP"); break;
+ case 4: m_pTE->CodecID.Set("A_AAC/MPEG4/LC/SBR"); break;
+ }
+
+ ASSERT(channels == wfe->nChannels);
+
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)nSamplesPerSec);
+ m_pTE->a.Channels.Set(channels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3)
+ {
+ m_pTE->CodecID.Set("A_AC3");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS)
+ {
+ m_pTE->CodecID.Set("A_DTS");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_FLAC)
+ {
+ m_pTE->CodecID.Set("A_FLAC");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ if(wfe->cbSize)
+ {
+ m_pTE->CodecPrivate.SetCount(wfe->cbSize);
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + sizeof(WAVEFORMATEX), wfe->cbSize);
+ }
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && (m_mt.subtype == MEDIASUBTYPE_14_4
+ || m_mt.subtype == MEDIASUBTYPE_28_8
+ || m_mt.subtype == MEDIASUBTYPE_ATRC
+ || m_mt.subtype == MEDIASUBTYPE_COOK
+ || m_mt.subtype == MEDIASUBTYPE_DNET
+ || m_mt.subtype == MEDIASUBTYPE_SIPR))
+ {
+ CStringA id;
+ id.Format("A_REAL/%c%c%c%c",
+ (char)((m_mt.subtype.Data1>>0)&0xff),
+ (char)((m_mt.subtype.Data1>>8)&0xff),
+ (char)((m_mt.subtype.Data1>>16)&0xff),
+ (char)((m_mt.subtype.Data1>>24)&0xff));
+
+ m_pTE->CodecID.Set(id);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ DWORD cbSize = sizeof(WAVEFORMATEX) + wfe->cbSize;
+ if(m_mt.cbFormat > cbSize)
+ {
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - cbSize);
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + cbSize, m_pTE->CodecPrivate.GetCount());
+ }
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM)
+ {
+ m_pTE->CodecID.Set("A_PCM/INT/LIT");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_WaveFormatEx)
+ {
+ m_pTE->CodecID.Set("A_MS/ACM");
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat);
+ memcpy(m_pTE->CodecPrivate, wfe, m_pTE->CodecPrivate.GetCount());
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)wfe->nSamplesPerSec);
+ m_pTE->a.Channels.Set(wfe->nChannels);
+ m_pTE->a.BitDepth.Set(wfe->wBitsPerSample);
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_VorbisFormat)
+ {
+ m_pTE->CodecID.Set("A_VORBIS");
+
+ VORBISFORMAT* pvf = (VORBISFORMAT*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)pvf->nSamplesPerSec);
+ m_pTE->a.Channels.Set(pvf->nChannels);
+
+ // m_pTE->CodecPrivate will be filled later
+
+ hr = S_OK;
+ }
+ else if(m_mt.formattype == FORMAT_VorbisFormat2)
+ {
+ m_pTE->CodecID.Set("A_VORBIS");
+
+ VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)m_mt.pbFormat;
+ m_pTE->DescType = TrackEntry::DescAudio;
+ m_pTE->a.SamplingFrequency.Set((float)pvf2->SamplesPerSec);
+ m_pTE->a.Channels.Set(pvf2->Channels);
+ m_pTE->a.BitDepth.Set(pvf2->BitsPerSample);
+
+ int len = 1;
+ for(int i = 0; i < 2; i++) len += pvf2->HeaderSize[i]/255 + 1;
+ for(int i = 0; i < 3; i++) len += pvf2->HeaderSize[i];
+ m_pTE->CodecPrivate.SetCount(len);
+
+ BYTE* src = (BYTE*)m_mt.pbFormat + sizeof(VORBISFORMAT2);
+ BYTE* dst = m_pTE->CodecPrivate.GetData();
+
+ *dst++ = 2;
+ for(int i = 0; i < 2; i++)
+ for(int len = pvf2->HeaderSize[i]; len >= 0; len -= 255)
+ *dst++ = min(len, 255);
+
+ memcpy(dst, src, pvf2->HeaderSize[0]);
+ dst += pvf2->HeaderSize[0];
+ src += pvf2->HeaderSize[0];
+ memcpy(dst, src, pvf2->HeaderSize[1]);
+ dst += pvf2->HeaderSize[1];
+ src += pvf2->HeaderSize[1];
+ memcpy(dst, src, pvf2->HeaderSize[2]);
+ dst += pvf2->HeaderSize[2];
+ src += pvf2->HeaderSize[2];
+
+ ASSERT(src <= m_mt.pbFormat + m_mt.cbFormat);
+ ASSERT(dst <= m_pTE->CodecPrivate.GetData() + m_pTE->CodecPrivate.GetCount());
+
+ hr = S_OK;
+ }
+ }
+ else if(m_mt.majortype == MEDIATYPE_Text)
+ {
+ m_pTE->TrackType.Set(TrackEntry::TypeSubtitle);
+
+ if(m_mt.formattype == FORMAT_None)
+ {
+ m_pTE->CodecID.Set("S_TEXT/ASCII");
+ hr = S_OK;
+ }
+ }
+ else if(m_mt.majortype == MEDIATYPE_Subtitle)
+ {
+ m_pTE->TrackType.Set(TrackEntry::TypeSubtitle);
+
+ m_pTE->CodecID.Set(
+ m_mt.subtype == MEDIASUBTYPE_UTF8 ? "S_TEXT/UTF8" :
+ m_mt.subtype == MEDIASUBTYPE_SSA ? "S_TEXT/SSA" :
+ m_mt.subtype == MEDIASUBTYPE_ASS ? "S_TEXT/ASS" :
+ m_mt.subtype == MEDIASUBTYPE_USF ? "S_TEXT/USF" :
+ m_mt.subtype == MEDIASUBTYPE_VOBSUB ? "S_VOBSUB" :
+ "");
+
+ if(!m_pTE->CodecID.IsEmpty())
+ {
+ hr = S_OK;
+
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)m_mt.pbFormat;
+ if(psi->dwOffset)
+ {
+ m_pTE->CodecPrivate.SetCount(m_mt.cbFormat - psi->dwOffset);
+ memcpy(m_pTE->CodecPrivate, m_mt.pbFormat + psi->dwOffset, m_pTE->CodecPrivate.GetCount());
+ }
+ }
+ }
+
+ if(S_OK == hr)
+ {
+ ((CMatroskaMuxerFilter*)m_pFilter)->AddInput();
+ }
+
+ return hr;
+}
+
+HRESULT CMatroskaMuxerInputPin::Active()
+{
+ m_fActive = true;
+ m_rtLastStart = m_rtLastStop = -1;
+ m_fEndOfStreamReceived = false;
+ return __super::Active();
+}
+
+HRESULT CMatroskaMuxerInputPin::Inactive()
+{
+ m_fActive = false;
+ CAutoLock cAutoLock(&m_csQueue);
+ m_blocks.RemoveAll();
+ m_pVorbisHdrs.RemoveAll();
+ return __super::Inactive();
+}
+
+STDMETHODIMP CMatroskaMuxerInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+ return __super::NewSegment(tStart, tStop, dRate);
+}
+
+STDMETHODIMP CMatroskaMuxerInputPin::BeginFlush()
+{
+ return __super::BeginFlush();
+}
+
+STDMETHODIMP CMatroskaMuxerInputPin::EndFlush()
+{
+ return __super::EndFlush();
+}
+
+STDMETHODIMP CMatroskaMuxerInputPin::Receive(IMediaSample* pSample)
+{
+ if(m_fEndOfStreamReceived) {/*ASSERT(0);*/ return S_FALSE;}
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ while(m_fActive)
+ {
+ {
+ CAutoLock cAutoLock2(&m_csQueue);
+ if(m_blocks.GetCount() < MAXBLOCKS)
+ break;
+ }
+
+ Sleep(1);
+ }
+
+ if(!m_fActive) return S_FALSE;
+
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Receive(pSample)))
+ return hr;
+
+ BYTE* pData = NULL;
+ pSample->GetPointer(&pData);
+
+ long len = pSample->GetActualDataLength();
+
+ REFERENCE_TIME rtStart = -1, rtStop = -1;
+ hr = pSample->GetTime(&rtStart, &rtStop);
+
+ if(FAILED(hr) || rtStart == -1 || rtStop == -1)
+ {
+ TRACE(_T("No timestamp was set on the sample!!!"));
+ m_pFilter->NotifyEvent(EC_ERRORABORT, VFW_E_SAMPLE_TIME_NOT_SET, 0);
+ return VFW_E_SAMPLE_TIME_NOT_SET;
+ }
+
+// rtStart += m_tStart;
+// rtStop += m_tStart;
+
+/**/
+ TRACE(_T("Received (%d): %I64d-%I64d (c=%d, co=%dms), len=%d, d%d p%d s%d\n"),
+ ((CMatroskaMuxerFilter*)m_pFilter)->GetTrackNumber(this),
+ rtStart, rtStop, (int)((rtStart/10000)/MAXCLUSTERTIME), (int)((rtStart/10000)%MAXCLUSTERTIME),
+ len,
+ pSample->IsDiscontinuity() == S_OK ? 1 : 0,
+ pSample->IsPreroll() == S_OK ? 1 : 0,
+ pSample->IsSyncPoint() == S_OK ? 1 : 0);
+
+ if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_pVorbisHdrs.GetCount() < 3)
+ {
+ CAutoPtr<CBinary> data(new CBinary(0));
+ data->SetCount(len);
+ memcpy(data->GetData(), pData, len);
+ m_pVorbisHdrs.Add(data);
+
+ if(m_pVorbisHdrs.GetCount() == 3)
+ {
+ int len = 1;
+ for(int i = 0; i < 2; i++) len += m_pVorbisHdrs[i]->GetCount()/255 + 1;
+ for(int i = 0; i < 3; i++) len += m_pVorbisHdrs[i]->GetCount();
+ m_pTE->CodecPrivate.SetCount(len);
+
+ BYTE* dst = m_pTE->CodecPrivate.GetData();
+
+ *dst++ = 2;
+ for(int i = 0; i < 2; i++)
+ for(int len = m_pVorbisHdrs[i]->GetCount(); len >= 0; len -= 255)
+ *dst++ = min(len, 255);
+
+ for(int i = 0; i < 3; i++)
+ {
+ memcpy(dst, m_pVorbisHdrs[i]->GetData(), m_pVorbisHdrs[i]->GetCount());
+ dst += m_pVorbisHdrs[i]->GetCount();
+ }
+ }
+
+ return S_OK;
+ }
+
+ if(m_mt.formattype == FORMAT_WaveFormatEx
+ && (((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_PCM
+ || ((WAVEFORMATEX*)m_mt.pbFormat)->wFormatTag == WAVE_FORMAT_MPEGLAYER3))
+ pSample->SetSyncPoint(TRUE); // HACK: some capture filters don't set this
+
+ CAutoPtr<BlockGroup> b(new BlockGroup());
+/*
+ // TODO: test this with a longer capture (pcm, mp3)
+ if(S_OK == pSample->IsSyncPoint() && rtStart < m_rtLastStart)
+ {
+ TRACE(_T("!!! timestamp went backwards, dropping this frame !!! rtStart (%I64) < m_rtLastStart (%I64)"), rtStart, m_rtLastStart);
+ return S_OK;
+ }
+*/
+ if((S_OK != pSample->IsSyncPoint() || m_rtLastStart == rtStart) && m_rtLastStart >= 0 /*&& m_rtLastStart < rtStart*/)
+ {
+ ASSERT(m_rtLastStart - rtStart <= 0);
+ REFERENCE_TIME rtDiff = m_rtLastStart - rtStart;
+ b->ReferenceBlock.Set((rtDiff + (rtDiff >= 0 ? 5000 : -5000)) / 10000);
+ }
+
+ b->Block.TrackNumber = ((CMatroskaMuxerFilter*)m_pFilter)->GetTrackNumber(this);
+
+ b->Block.TimeCode = (rtStart + 5000) / 10000;
+ b->Block.TimeCodeStop = (rtStop + 5000) / 10000;
+
+ if(m_pTE->TrackType == TrackEntry::TypeSubtitle)
+ {
+ b->BlockDuration.Set((rtStop - rtStart + 5000) / 10000);
+ }
+
+ CAutoPtr<CBinary> data(new CBinary(0));
+ data->SetCount(len);
+ memcpy(data->GetData(), pData, len);
+ b->Block.BlockData.AddTail(data);
+
+ CAutoLock cAutoLock2(&m_csQueue);
+ m_blocks.AddTail(b); // TODO: lacing for audio
+
+ m_rtLastStart = rtStart;
+ m_rtLastStop = rtStop;
+
+ return S_OK;
+}
+
+STDMETHODIMP CMatroskaMuxerInputPin::EndOfStream()
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::EndOfStream()))
+ return hr;
+
+ CAutoLock cAutoLock(&m_csQueue);
+
+ m_fEndOfStreamReceived = true;
+
+ return hr;
+}
+
+//
+// CMatroskaMuxerOutputPin
+//
+
+CMatroskaMuxerOutputPin::CMatroskaMuxerOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseOutputPin(pName, pFilter, pLock, phr, L"Output")
+{
+}
+
+CMatroskaMuxerOutputPin::~CMatroskaMuxerOutputPin()
+{
+}
+
+STDMETHODIMP CMatroskaMuxerOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CMatroskaMuxerOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 1;
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
+
+ return NOERROR;
+}
+
+HRESULT CMatroskaMuxerOutputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_Matroska
+ ? S_OK
+ : E_INVALIDARG;
+}
+
+HRESULT CMatroskaMuxerOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ CAutoLock cAutoLock(m_pLock);
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pmt->ResetFormatBuffer();
+ pmt->InitMediaType();
+ pmt->majortype = MEDIATYPE_Stream;
+ pmt->subtype = MEDIASUBTYPE_Matroska;
+ pmt->formattype = FORMAT_None;
+
+ return S_OK;
+}
+
+STDMETHODIMP CMatroskaMuxerOutputPin::Notify(IBaseFilter* pSender, Quality q)
+{
+ return E_NOTIMPL;
+}
+
+
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer.def b/src/filters/muxer/matroskamuxer/MatroskaMuxer.def
new file mode 100644
index 000000000..118808e45
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer.def
@@ -0,0 +1,7 @@
+LIBRARY "MatroskaMuxer.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer.h b/src/filters/muxer/matroskamuxer/MatroskaMuxer.h
new file mode 100644
index 000000000..68bcdd2e0
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "MatroskaFile.h"
+
+#define MAXCLUSTERTIME 1000
+#define MAXBLOCKS 50
+
+class CMatroskaMuxerInputPin : public CBaseInputPin
+{
+ CAutoPtr<MatroskaWriter::TrackEntry> m_pTE;
+ CAutoPtrArray<MatroskaWriter::CBinary> m_pVorbisHdrs;
+
+ bool m_fActive;
+ CCritSec m_csReceive;
+
+ REFERENCE_TIME m_rtLastStart, m_rtLastStop;
+
+public:
+ CMatroskaMuxerInputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CMatroskaMuxerInputPin();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ MatroskaWriter::TrackEntry* GetTrackEntry() {return m_pTE;}
+
+ REFERENCE_TIME m_rtDur;
+
+ CCritSec m_csQueue;
+ CAutoPtrList<MatroskaWriter::BlockGroup> m_blocks;
+ bool m_fEndOfStreamReceived;
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pPin);
+ HRESULT Active(), Inactive();
+
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
+
+ STDMETHODIMP Receive(IMediaSample* pSample);
+ STDMETHODIMP EndOfStream();
+};
+
+class CMatroskaMuxerOutputPin : public CBaseOutputPin
+{
+public:
+ CMatroskaMuxerOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CMatroskaMuxerOutputPin();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+};
+
+[uuid("38E2D43D-915D-493C-B373-888DB16EE3DC")]
+interface IMatroskaMuxer : public IUnknown
+{
+ STDMETHOD (CorrectTimeOffset) (bool fNegative, bool fPositive) = 0;
+ // TODO: chapters
+};
+
+[uuid("1E1299A2-9D42-4F12-8791-D79E376F4143")]
+class CMatroskaMuxerFilter
+ : public CBaseFilter
+ , public CCritSec
+ , public CAMThread
+ , public IAMFilterMiscFlags
+ , public IMediaSeeking
+ , public IMatroskaMuxer
+{
+protected:
+ CAutoPtrList<CMatroskaMuxerInputPin> m_pInputs;
+ CAutoPtr<CMatroskaMuxerOutputPin> m_pOutput;
+
+ REFERENCE_TIME m_rtCurrent;
+
+ bool m_fNegative, m_fPositive;
+
+ enum {CMD_EXIT, CMD_RUN};
+ DWORD ThreadProc();
+
+public:
+ CMatroskaMuxerFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CMatroskaMuxerFilter();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ void AddInput();
+ UINT GetTrackNumber(CBasePin* pPin);
+
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+
+ STDMETHODIMP Stop();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Run(REFERENCE_TIME tStart);
+
+ // IAMFilterMiscFlags
+
+ STDMETHODIMP_(ULONG) GetMiscFlags();
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+
+ // IMatroskaMuxer
+
+ STDMETHODIMP CorrectTimeOffset(bool fNegative, bool fPositive);
+};
+
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer.rc b/src/filters/muxer/matroskamuxer/MatroskaMuxer.rc
new file mode 100644
index 000000000..7f6b4a7d3
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,9
+ PRODUCTVERSION 1,0,0,9
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Matroska Muxer"
+ VALUE "FileVersion", "1, 0, 0, 9"
+ VALUE "InternalName", "Matroska Muxer"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "MatroskaMuxer.ax"
+ VALUE "ProductName", "Matroska Muxer"
+ VALUE "ProductVersion", "1, 0, 0, 9"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer.sln b/src/filters/muxer/matroskamuxer/MatroskaMuxer.sln
new file mode 100644
index 000000000..20b41d9bc
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer.sln
@@ -0,0 +1,60 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatroskaMuxer", "MatroskaMuxer.vcproj", "{67827491-8162-4039-9132-F934ABC836A0}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug.ActiveCfg = Debug|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug.Build.0 = Debug|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug lib.ActiveCfg = Debug lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug lib.Build.0 = Debug lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release.ActiveCfg = Release|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release.Build.0 = Release|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release lib.ActiveCfg = Release lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release lib.Build.0 = Release lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode.Build.0 = Release Unicode|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {67827491-8162-4039-9132-F934ABC836A0}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer.vcproj b/src/filters/muxer/matroskamuxer/MatroskaMuxer.vcproj
new file mode 100644
index 000000000..3add02729
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer.vcproj
@@ -0,0 +1,526 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="MatroskaMuxer"
+ ProjectGUID="{67827491-8162-4039-9132-F934ABC836A0}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\MatroskaFile.cpp">
+ </File>
+ <File
+ RelativePath="MatroskaMuxer.cpp">
+ </File>
+ <File
+ RelativePath="MatroskaMuxer.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\MatroskaFile.h">
+ </File>
+ <File
+ RelativePath="MatroskaMuxer.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\MatroskaMuxer.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer_vs2005.vcproj b/src/filters/muxer/matroskamuxer/MatroskaMuxer_vs2005.vcproj
new file mode 100644
index 000000000..b1bf8212b
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer_vs2005.vcproj
@@ -0,0 +1,773 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="MatroskaMuxer"
+ ProjectGUID="{67827491-8162-4039-9132-F934ABC836A0}"
+ RootNamespace="MatroskaMuxer"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\MatroskaFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="MatroskaMuxer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="MatroskaMuxer.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\MatroskaFile.h"
+ >
+ </File>
+ <File
+ RelativePath="MatroskaMuxer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\MatroskaMuxer.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/muxer/matroskamuxer/MatroskaMuxer_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/muxer/matroskamuxer/MatroskaMuxer_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/MatroskaMuxer_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/muxer/matroskamuxer/resource.h b/src/filters/muxer/matroskamuxer/resource.h
new file mode 100644
index 000000000..cfa5a212d
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by MatroskaMuxer.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/muxer/matroskamuxer/stdafx.cpp b/src/filters/muxer/matroskamuxer/stdafx.cpp
new file mode 100644
index 000000000..6927dbf9c
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// MatroskaMuxer.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/muxer/matroskamuxer/stdafx.h b/src/filters/muxer/matroskamuxer/stdafx.h
new file mode 100644
index 000000000..dd0d28f25
--- /dev/null
+++ b/src/filters/muxer/matroskamuxer/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/muxer/wavdest/stdafx.cpp b/src/filters/muxer/wavdest/stdafx.cpp
new file mode 100644
index 000000000..e9267f937
--- /dev/null
+++ b/src/filters/muxer/wavdest/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// wavdest.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/muxer/wavdest/stdafx.h b/src/filters/muxer/wavdest/stdafx.h
new file mode 100644
index 000000000..7becfecbe
--- /dev/null
+++ b/src/filters/muxer/wavdest/stdafx.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
diff --git a/src/filters/muxer/wavdest/wavdest.cpp b/src/filters/muxer/wavdest/wavdest.cpp
new file mode 100644
index 000000000..b3a71fe36
--- /dev/null
+++ b/src/filters/muxer/wavdest/wavdest.cpp
@@ -0,0 +1,331 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <streams.h>
+#include <aviriff.h>
+#include "wavdest.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CWavDestFilter), L"WavDest", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {L"WavDest", &__uuidof(CWavDestFilter), CreateInstance<CWavDestFilter>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CWavDestFilter
+//
+
+CWavDestFilter::CWavDestFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CTransformFilter(NAME("WavDest filter"), pUnk, __uuidof(this))
+{
+ if(SUCCEEDED(*phr))
+ {
+ if(CWavDestOutputPin* pOut = new CWavDestOutputPin(this, phr))
+ {
+ if(SUCCEEDED(*phr)) m_pOutput = pOut;
+ else delete pOut;
+ }
+ else
+ {
+ *phr = E_OUTOFMEMORY;
+ return;
+ }
+
+ if(CTransformInputPin* pIn = new CTransformInputPin(NAME("Transform input pin"), this, phr, L"In"))
+ {
+ if(SUCCEEDED(*phr)) m_pInput = pIn;
+ else delete pIn;
+ }
+ else
+ {
+ *phr = E_OUTOFMEMORY;
+ return;
+ }
+ }
+}
+
+CWavDestFilter::~CWavDestFilter()
+{
+}
+
+HRESULT CWavDestFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return CheckInputType(mtIn);
+}
+
+HRESULT CWavDestFilter::Receive(IMediaSample* pSample)
+{
+ ULONG cbOld = m_cbWavData;
+ HRESULT hr = CTransformFilter::Receive(pSample);
+
+ // don't update the count if Deliver() downstream fails.
+ if(hr != S_OK)
+ m_cbWavData = cbOld;
+
+ return hr;
+}
+
+HRESULT CWavDestFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
+{
+ REFERENCE_TIME rtStart, rtEnd;
+
+ HRESULT hr = Copy(pIn, pOut);
+ if(FAILED(hr))
+ return hr;
+
+ // Prepare it for writing
+ LONG lActual = pOut->GetActualDataLength();
+
+ if(m_cbWavData + m_cbHeader + lActual < m_cbWavData + m_cbHeader ) // overflow
+ return E_FAIL;
+
+ rtStart = m_cbWavData + m_cbHeader;
+ rtEnd = rtStart + lActual;
+ m_cbWavData += lActual;
+
+ EXECUTE_ASSERT(pOut->SetTime(&rtStart, &rtEnd) == S_OK);
+
+ return S_OK;
+}
+
+HRESULT CWavDestFilter::Copy(IMediaSample* pSource, IMediaSample* pDest) const
+{
+ BYTE* pSourceBuffer, * pDestBuffer;
+ long lSourceSize = pSource->GetActualDataLength();
+
+#ifdef DEBUG
+ long lDestSize = pDest->GetSize();
+ ASSERT(lDestSize >= lSourceSize);
+#endif
+
+ pSource->GetPointer(&pSourceBuffer);
+ pDest->GetPointer(&pDestBuffer);
+
+ CopyMemory((PVOID)pDestBuffer, (PVOID)pSourceBuffer, lSourceSize);
+
+ // Copy the sample times
+
+ REFERENCE_TIME TimeStart, TimeEnd;
+ if(NOERROR == pSource->GetTime(&TimeStart, &TimeEnd))
+ pDest->SetTime(&TimeStart, &TimeEnd);
+
+ LONGLONG MediaStart, MediaEnd;
+ if(pSource->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR)
+ pDest->SetMediaTime(&MediaStart, &MediaEnd);
+
+ // Copy the media type
+ AM_MEDIA_TYPE* pMediaType;
+ pSource->GetMediaType(&pMediaType);
+ pDest->SetMediaType(pMediaType);
+ DeleteMediaType(pMediaType);
+
+ // Copy the actual data length
+ long lDataLength = pSource->GetActualDataLength();
+ pDest->SetActualDataLength(lDataLength);
+
+ return NOERROR;
+}
+
+HRESULT CWavDestFilter::CheckInputType(const CMediaType* mtIn)
+{
+ return mtIn->formattype == FORMAT_WaveFormatEx ? S_OK : S_FALSE;
+}
+
+HRESULT CWavDestFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
+{
+ ASSERT(iPosition == 0 || iPosition == 1);
+
+ if(iPosition == 0)
+ {
+ pMediaType->SetType(&MEDIATYPE_Stream);
+ pMediaType->SetSubtype(&MEDIASUBTYPE_WAVE);
+ return S_OK;
+ }
+
+ return VFW_S_NO_MORE_ITEMS;
+}
+
+HRESULT CWavDestFilter::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE)
+ return E_UNEXPECTED;
+
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbAlign = 1;
+
+ CComPtr<IMemAllocator> pInAlloc;
+ ALLOCATOR_PROPERTIES InProps;
+ if(SUCCEEDED(hr = m_pInput->GetAllocator(&pInAlloc))
+ && SUCCEEDED(hr = pInAlloc->GetProperties(&InProps)))
+ {
+ pProperties->cbBuffer = InProps.cbBuffer;
+ }
+ else
+ {
+ return hr;
+ }
+
+ ASSERT(pProperties->cbBuffer);
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties,&Actual)))
+ return hr;
+
+ ASSERT(Actual.cBuffers == 1);
+
+ if(pProperties->cBuffers > Actual.cBuffers
+ || pProperties->cbBuffer > Actual.cbBuffer)
+ {
+ return E_FAIL;
+ }
+
+ return NOERROR;
+}
+
+// Compute the header size to allow space for us to write it at the end.
+//
+// 00000000 RIFF (00568BFE) 'WAVE'
+// 0000000C fmt (00000010)
+// 00000024 data (00568700)
+// 0056872C
+//
+
+HRESULT CWavDestFilter::StartStreaming()
+{
+ // leave space for the header
+ m_cbHeader = sizeof(RIFFLIST) +
+ sizeof(RIFFCHUNK) +
+ m_pInput->CurrentMediaType().FormatLength() +
+ sizeof(RIFFCHUNK);
+
+ m_cbWavData = 0;
+
+ return S_OK;
+}
+
+HRESULT CWavDestFilter::StopStreaming()
+{
+ IStream* pStream;
+ if (m_pOutput->IsConnected() == FALSE)
+ return E_FAIL;
+
+ IPin* pDwnstrmInputPin = m_pOutput->GetConnected();
+
+ if (!pDwnstrmInputPin)
+ return E_FAIL;
+
+ HRESULT hr = ((IMemInputPin *) pDwnstrmInputPin)->QueryInterface(IID_IStream, (void **)&pStream);
+ if(SUCCEEDED(hr))
+ {
+ BYTE *pb = (BYTE *)_alloca(m_cbHeader);
+
+ RIFFLIST *pRiffWave = (RIFFLIST *)pb;
+ RIFFCHUNK *pRiffFmt = (RIFFCHUNK *)(pRiffWave + 1);
+ RIFFCHUNK *pRiffData = (RIFFCHUNK *)(((BYTE *)(pRiffFmt + 1)) + m_pInput->CurrentMediaType().FormatLength());;
+
+ pRiffData->fcc = FCC('data');
+ pRiffData->cb = m_cbWavData;
+
+ pRiffFmt->fcc = FCC('fmt ');
+ pRiffFmt->cb = m_pInput->CurrentMediaType().FormatLength();
+ CopyMemory(pRiffFmt + 1, m_pInput->CurrentMediaType().Format(), pRiffFmt->cb);
+
+ pRiffWave->fcc = FCC('RIFF');
+ pRiffWave->cb = m_cbWavData + m_cbHeader - sizeof(RIFFCHUNK);
+ pRiffWave->fccListType = FCC('WAVE');
+
+ LARGE_INTEGER li;
+ ZeroMemory(&li, sizeof(li));
+
+ hr = pStream->Seek(li, STREAM_SEEK_SET, 0);
+ if(SUCCEEDED(hr)) {
+ hr = pStream->Write(pb, m_cbHeader, 0);
+ }
+ pStream->Release();
+ }
+
+ return hr;
+}
+
+CWavDestOutputPin::CWavDestOutputPin(CTransformFilter* pFilter, HRESULT* phr)
+ : CTransformOutputPin(NAME("WavDest output pin"), pFilter, phr, L"Out")
+{
+}
+
+STDMETHODIMP CWavDestOutputPin::EnumMediaTypes(IEnumMediaTypes** ppEnum)
+{
+ return CBaseOutputPin::EnumMediaTypes(ppEnum);
+}
+
+HRESULT CWavDestOutputPin::CheckMediaType(const CMediaType* pmt)
+{
+ if(pmt->majortype == MEDIATYPE_Stream && pmt->subtype == MEDIASUBTYPE_WAVE)
+ return S_OK;
+ else
+ return S_FALSE;
+}
diff --git a/src/filters/muxer/wavdest/wavdest.def b/src/filters/muxer/wavdest/wavdest.def
new file mode 100644
index 000000000..793856ee1
--- /dev/null
+++ b/src/filters/muxer/wavdest/wavdest.def
@@ -0,0 +1,7 @@
+LIBRARY "wavdest.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/muxer/wavdest/wavdest.h b/src/filters/muxer/wavdest/wavdest.h
new file mode 100644
index 000000000..84b054d32
--- /dev/null
+++ b/src/filters/muxer/wavdest/wavdest.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+
+class CWavDestOutputPin : public CTransformOutputPin
+{
+public:
+ CWavDestOutputPin(CTransformFilter* pFilter, HRESULT* phr);
+
+ STDMETHODIMP EnumMediaTypes(IEnumMediaTypes** ppEnum);
+ HRESULT CheckMediaType(const CMediaType* pmt);
+};
+
+[uuid("8685214E-4D32-4058-BE04-D01104F00B0C")]
+class CWavDestFilter : public CTransformFilter
+{
+public:
+ CWavDestFilter(LPUNKNOWN pUnk, HRESULT* pHr);
+ ~CWavDestFilter();
+
+ DECLARE_IUNKNOWN;
+
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT Receive(IMediaSample* pSample);
+
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType*mtIn, const CMediaType* mtOut);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+
+ HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
+
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
+
+private:
+
+ HRESULT Copy(IMediaSample* pSource, IMediaSample* pDest) const;
+ HRESULT Transform(IMediaSample* pMediaSample);
+ HRESULT Transform(AM_MEDIA_TYPE* pType, const signed char ContrastLevel) const;
+
+ ULONG m_cbWavData;
+ ULONG m_cbHeader;
+};
diff --git a/src/filters/muxer/wavdest/wavdest.sln b/src/filters/muxer/wavdest/wavdest.sln
new file mode 100644
index 000000000..ce752bf77
--- /dev/null
+++ b/src/filters/muxer/wavdest/wavdest.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wavdest", "wavdest.vcproj", "{EB202B68-8029-4985-B914-E94B44D2E230}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Debug lib
+ ConfigName.2 = Debug Unicode
+ ConfigName.3 = Debug Unicode lib
+ ConfigName.4 = Release
+ ConfigName.5 = Release lib
+ ConfigName.6 = Release Unicode
+ ConfigName.7 = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug.ActiveCfg = Debug|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug.Build.0 = Debug|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug lib.ActiveCfg = Debug lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug lib.Build.0 = Debug lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release.ActiveCfg = Release|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release.Build.0 = Release|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release lib.ActiveCfg = Release lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release lib.Build.0 = Release lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode.Build.0 = Release Unicode|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {EB202B68-8029-4985-B914-E94B44D2E230}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/muxer/wavdest/wavdest.vcproj b/src/filters/muxer/wavdest/wavdest.vcproj
new file mode 100644
index 000000000..287c843b7
--- /dev/null
+++ b/src/filters/muxer/wavdest/wavdest.vcproj
@@ -0,0 +1,480 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="wavdest"
+ ProjectGUID="{EB202B68-8029-4985-B914-E94B44D2E230}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="wavdest.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="wavdest.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;REGISTER_FILTER"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="wavdest.def"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;REGISTER_FILTER"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="wavdest.def"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="wavdest.cpp">
+ </File>
+ <File
+ RelativePath=".\wavdest.def">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="wavdest.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/muxer/wavdest/wavdest_vs2005.vcproj b/src/filters/muxer/wavdest/wavdest_vs2005.vcproj
new file mode 100644
index 000000000..48cc225f5
--- /dev/null
+++ b/src/filters/muxer/wavdest/wavdest_vs2005.vcproj
@@ -0,0 +1,714 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="wavdest"
+ ProjectGUID="{EB202B68-8029-4985-B914-E94B44D2E230}"
+ RootNamespace="wavdest"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="wavdest.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="wavdest.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="wavdest.def"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="wavdest.def"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="wavdest.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\wavdest.def"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath="wavdest.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/muxer/wavdest/wavdest_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/muxer/wavdest/wavdest_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..f2fd09b6d
--- /dev/null
+++ b/src/filters/muxer/wavdest/wavdest_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/avisplitter/AviFile.cpp b/src/filters/parser/avisplitter/AviFile.cpp
new file mode 100644
index 000000000..bd5979a8b
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviFile.cpp
@@ -0,0 +1,525 @@
+#include "StdAfx.h"
+#include "AviFile.h"
+
+//
+// CAviFile
+//
+
+CAviFile::CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
+{
+ if(FAILED(hr)) return;
+ hr = Init();
+}
+
+template<typename T>
+HRESULT CAviFile::Read(T& var, int offset)
+{
+ memset(&var, 0, sizeof(var));
+ HRESULT hr = ByteRead((BYTE*)&var + offset, sizeof(var) - offset);
+ return hr;
+}
+
+HRESULT CAviFile::Init()
+{
+ Seek(0);
+ DWORD dw[3];
+ if(S_OK != Read(dw) || dw[0] != FCC('RIFF') || (dw[2] != FCC('AVI ') && dw[2] != FCC('AVIX')))
+ return E_FAIL;
+
+ Seek(0);
+ HRESULT hr = Parse(0, GetLength());
+ if(m_movis.GetCount() == 0) // FAILED(hr) is allowed as long as there was a movi chunk found
+ return E_FAIL;
+
+ if(m_avih.dwStreams == 0 && m_strms.GetCount() > 0)
+ m_avih.dwStreams = m_strms.GetCount();
+
+ if(m_avih.dwStreams != m_strms.GetCount())
+ return E_FAIL;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ if(s->strh.fccType != FCC('auds')) continue;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)s->strf.GetData();
+ if(wfe->wFormatTag == 0x55 && wfe->nBlockAlign == 1152
+ && s->strh.dwScale == 1 && s->strh.dwRate != wfe->nSamplesPerSec)
+ {
+ // correcting encoder bugs...
+ s->strh.dwScale = 1152;
+ s->strh.dwRate = wfe->nSamplesPerSec;
+ }
+ }
+
+ if(FAILED(BuildIndex()))
+ EmptyIndex();
+
+ return S_OK;
+}
+
+HRESULT CAviFile::Parse(DWORD parentid, __int64 end)
+{
+ HRESULT hr = S_OK;
+
+ CAutoPtr<strm_t> strm;
+
+ while(S_OK == hr && GetPos() < end)
+ {
+ UINT64 pos = GetPos();
+
+ DWORD id = 0, size;
+ if(S_OK != Read(id) || id == 0)
+ return E_FAIL;
+
+ if(id == FCC('RIFF') || id == FCC('LIST'))
+ {
+ if(S_OK != Read(size) || S_OK != Read(id))
+ return E_FAIL;
+
+ size += (size&1) + 8;
+
+ TRACE(_T("CAviFile::Parse(..): LIST '%c%c%c%c'\n"),
+ TCHAR((id>>0)&0xff),
+ TCHAR((id>>8)&0xff),
+ TCHAR((id>>16)&0xff),
+ TCHAR((id>>24)&0xff));
+
+ if(id == FCC('movi'))
+ {
+ m_movis.AddTail(pos);
+ }
+ else
+ {
+ hr = Parse(id, pos + size);
+ }
+ }
+ else
+ {
+ if(S_OK != Read(size))
+ return E_FAIL;
+
+ TRACE(_T("CAviFile::Parse(..): '%c%c%c%c'\n"),
+ TCHAR((id>>0)&0xff),
+ TCHAR((id>>8)&0xff),
+ TCHAR((id>>16)&0xff),
+ TCHAR((id>>24)&0xff));
+
+ if(parentid == FCC('INFO') && size > 0)
+ {
+ switch(id)
+ {
+ case FCC('IARL'): // Archival Location. Indicates where the subject of the file is archived.
+ case FCC('IART'): // Artist. Lists the artist of the original subject of the file; for example, “Michaelangelo.”
+ case FCC('ICMS'): // Commissioned. Lists the name of the person or organization that commissioned the subject of the file; for example, “Pope Julian II.”
+ case FCC('ICMT'): // Comments. Provides general comments about the file or the subject of the file. If the comment is several sentences long, end each sentence with a period. Do not include new-line characters.
+ case FCC('ICOP'): // Copyright. Records the copyright information for the file; for example, “Copyright Encyclopedia International 1991.” If there are multiple copyrights, separate them by a semicolon followed by a space.
+ case FCC('ICRD'): // Creation date. Specifies the date the subject of the file was created. List dates in year-month-day format, padding one-digit months and days with a zero on the left; for example, “1553-05-03” for May 3, 1553.
+ case FCC('ICRP'): // Cropped. Describes whether an image has been cropped and, if so, how it was cropped; for example, “lower-right corner.”
+ case FCC('IDIM'): // Dimensions. Specifies the size of the original subject of the file; for example, “8.5 in h, 11 in w.”
+ case FCC('IDPI'): // Dots Per Inch. Stores dots per inch setting of the digitizer used to produce the file, such as “300.”
+ case FCC('IENG'): // Engineer. Stores the name of the engineer who worked on the file. If there are multiple engineers, separate the names by a semicolon and a blank; for example, “Smith, John; Adams, Joe.”
+ case FCC('IGNR'): // Genre. Describes the original work, such as “landscape,” “portrait,” “still life,” etc.
+ case FCC('IKEY'): // Keywords. Provides a list of keywords that refer to the file or subject of the file. Separate multiple keywords with a semicolon and a blank; for example, “Seattle; aerial view; scenery.”
+ case FCC('ILGT'): // Lightness. Describes the changes in lightness settings on the digitizer required to produce the file. Note that the format of this information depends on hardware used.
+ case FCC('IMED'): // Medium. Describes the original subject of the file, such as “computer image,” “drawing,” “lithograph,” and so on.
+ case FCC('INAM'): // Name. Stores the title of the subject of the file, such as “Seattle From Above.”
+ case FCC('IPLT'): // Palette Setting. Specifies the number of colors requested when digitizing an image, such as “256.”
+ case FCC('IPRD'): // Product. Specifies the name of the title the file was originally intended for, such as “Encyclopedia of Pacific Northwest Geography.”
+ case FCC('ISBJ'): // Subject. Describes the contents of the file, such as “Aerial view of Seattle.”
+ case FCC('ISFT'): // Software. Identifies the name of the software package used to create the file, such as “Microsoft WaveEdit.”
+ case FCC('ISHP'): // Sharpness. Identifies the changes in sharpness for the digitizer required to produce the file (the format depends on the hardware used).
+ case FCC('ISRC'): // Source. Identifies the name of the person or organization who supplied the original subject of the file; for example, “Trey Research.”
+ case FCC('ISRF'): // Source Form. Identifies the original form of the material that was digitized, such as “slide,” “paper,” “map,” and so on. This is not necessarily the same as IMED.
+ case FCC('ITCH'): // Technician. Identifies the technician who digitized the subject file; for example, “Smith, John.”
+ {
+ CStringA str;
+ if(S_OK != ByteRead((BYTE*)str.GetBufferSetLength(size), size)) return E_FAIL;
+ m_info[id] = str;
+ break;
+ }
+ }
+ }
+
+ switch(id)
+ {
+ case FCC('avih'):
+ m_avih.fcc = FCC('avih');
+ m_avih.cb = size;
+ if(S_OK != Read(m_avih, 8)) return E_FAIL;
+ break;
+ case FCC('strh'):
+ if(!strm) strm.Attach(new strm_t());
+ strm->strh.fcc = FCC('strh');
+ strm->strh.cb = size;
+ if(S_OK != Read(strm->strh, 8)) return E_FAIL;
+ break;
+ case FCC('strn'):
+ if(S_OK != ByteRead((BYTE*)strm->strn.GetBufferSetLength(size), size)) return E_FAIL;
+ break;
+ case FCC('strf'):
+ if(!strm) strm.Attach(new strm_t());
+ strm->strf.SetCount(size);
+ if(S_OK != ByteRead(strm->strf.GetData(), size)) return E_FAIL;
+ break;
+ case FCC('indx'):
+ if(!strm) strm.Attach(new strm_t());
+ ASSERT(strm->indx == NULL);
+ strm->indx.Attach((AVISUPERINDEX*)new BYTE[size + 8]);
+ strm->indx->fcc = FCC('indx');
+ strm->indx->cb = size;
+ if(S_OK != ByteRead((BYTE*)(AVISUPERINDEX*)strm->indx + 8, size)) return E_FAIL;
+ ASSERT(strm->indx->wLongsPerEntry == 4 && strm->indx->bIndexType == AVI_INDEX_OF_INDEXES);
+ break;
+ case FCC('dmlh'):
+ if(S_OK != Read(m_dmlh)) return E_FAIL;
+ break;
+ case FCC('vprp'):
+// if(S_OK != Read(m_vprp)) return E_FAIL;
+ break;
+ case FCC('idx1'):
+ ASSERT(m_idx1 == NULL);
+ m_idx1.Attach((AVIOLDINDEX*)new BYTE[size + 8]);
+ m_idx1->fcc = FCC('idx1');
+ m_idx1->cb = size;
+ if(S_OK != ByteRead((BYTE*)(AVIOLDINDEX*)m_idx1 + 8, size)) return E_FAIL;
+ break;
+ }
+
+ size += (size&1) + 8;
+ }
+
+ Seek(pos + size);
+ }
+
+ if(strm) m_strms.Add(strm);
+
+ return hr;
+}
+
+REFERENCE_TIME CAviFile::GetTotalTime()
+{
+ REFERENCE_TIME t = 0/*10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames*/;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ REFERENCE_TIME t2 = s->GetRefTime(s->cs.GetCount(), s->totalsize);
+ t = max(t, t2);
+ }
+
+ if(t == 0) t = 10i64*m_avih.dwMicroSecPerFrame*m_avih.dwTotalFrames;
+
+ return(t);
+}
+
+HRESULT CAviFile::BuildIndex()
+{
+ EmptyIndex();
+
+ int nSuperIndexes = 0;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ if(s->indx && s->indx->nEntriesInUse > 0) nSuperIndexes++;
+ }
+
+ if(nSuperIndexes == m_avih.dwStreams)
+ {
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+
+ AVISUPERINDEX* idx = (AVISUPERINDEX*)s->indx;
+
+ DWORD nEntriesInUse = 0;
+
+ for(int j = 0; j < (int)idx->nEntriesInUse; j++)
+ {
+ Seek(idx->aIndex[j].qwOffset);
+
+ AVISTDINDEX stdidx;
+ if(S_OK != ByteRead((BYTE*)&stdidx, FIELD_OFFSET(AVISTDINDEX, aIndex)))
+ {
+ EmptyIndex();
+ return E_FAIL;
+ }
+
+ nEntriesInUse += stdidx.nEntriesInUse;
+ }
+
+ s->cs.SetCount(nEntriesInUse);
+
+ DWORD frame = 0;
+ UINT64 size = 0;
+
+ for(int j = 0; j < (int)idx->nEntriesInUse; j++)
+ {
+ Seek(idx->aIndex[j].qwOffset);
+
+ CAutoPtr<AVISTDINDEX> p((AVISTDINDEX*)new BYTE[idx->aIndex[j].dwSize]);
+ if(!p || S_OK != ByteRead((BYTE*)(AVISTDINDEX*)p, idx->aIndex[j].dwSize))
+ {
+ EmptyIndex();
+ return E_FAIL;
+ }
+
+ for(int k = 0, l = 0; k < (int)p->nEntriesInUse; k++)
+ {
+ s->cs[frame].size = size;
+ s->cs[frame].filepos = p->qwBaseOffset + p->aIndex[k].dwOffset;
+ s->cs[frame].fKeyFrame = !(p->aIndex[k].dwSize&AVISTDINDEX_DELTAFRAME)
+ || s->strh.fccType == FCC('auds');
+ s->cs[frame].fChunkHdr = false;
+ s->cs[frame].orgsize = p->aIndex[k].dwSize&AVISTDINDEX_SIZEMASK;
+
+ if(m_idx1)
+ {
+ s->cs[frame].filepos -= 8;
+ s->cs[frame].fChunkHdr = true;
+ }
+
+ frame++;
+ size += s->GetChunkSize(p->aIndex[k].dwSize&AVISTDINDEX_SIZEMASK);
+ }
+ }
+
+ s->totalsize = size;
+ }
+ }
+ else if(AVIOLDINDEX* idx = m_idx1)
+ {
+ int len = idx->cb/sizeof(idx->aIndex[0]);
+
+ UINT64 offset = m_movis.GetHead() + 8;
+
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+
+ int nFrames = 0;
+
+ for(int j = 0; j < len; j++)
+ {
+ if(TRACKNUM(idx->aIndex[j].dwChunkId) == i)
+ nFrames++;
+ }
+
+ s->cs.SetCount(nFrames);
+
+ DWORD frame = 0;
+ UINT64 size = 0;
+
+ for(int j = 0, k = 0; j < len; j++)
+ {
+ DWORD TrackNumber = TRACKNUM(idx->aIndex[j].dwChunkId);
+
+ if(TrackNumber == i)
+ {
+ if(j == 0 && idx->aIndex[j].dwOffset > offset)
+ {
+ DWORD id;
+ Seek(offset + idx->aIndex[j].dwOffset);
+ Read(id);
+ if(id != idx->aIndex[j].dwChunkId)
+ {
+ TRACE(_T("WARNING: CAviFile::Init() detected absolute chunk addressing in \'idx1\'"));
+ offset = 0;
+ }
+ }
+
+ s->cs[frame].size = size;
+ s->cs[frame].filepos = offset + idx->aIndex[j].dwOffset;
+ s->cs[frame].fKeyFrame = !!(idx->aIndex[j].dwFlags&AVIIF_KEYFRAME)
+ || s->strh.fccType == FCC('auds') // FIXME: some audio index is without any kf flag
+ || frame == 0; // grrr
+ s->cs[frame].fChunkHdr = j == len-1 || idx->aIndex[j].dwOffset != idx->aIndex[j+1].dwOffset;
+ s->cs[frame].orgsize = idx->aIndex[j].dwSize;
+
+ frame++;
+ size += s->GetChunkSize(idx->aIndex[j].dwSize);
+ }
+ }
+
+ s->totalsize = size;
+ }
+ }
+
+ m_idx1.Free();
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ m_strms[i]->indx.Free();
+
+ return S_OK;
+}
+
+void CAviFile::EmptyIndex()
+{
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ strm_t* s = m_strms[i];
+ s->cs.RemoveAll();
+ s->totalsize = 0;
+ }
+}
+
+bool CAviFile::IsInterleaved(bool fKeepInfo)
+{
+ if(m_strms.GetCount() < 2)
+ return(true);
+/*
+ if(m_avih.dwFlags&AVIF_ISINTERLEAVED) // not reliable, nandub can write f*cked up files and still sets it
+ return(true);
+*/
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ m_strms[i]->cs2.SetCount(m_strms[i]->cs.GetCount());
+
+ DWORD* curchunks = new DWORD[m_avih.dwStreams];
+ UINT64* cursizes = new UINT64[m_avih.dwStreams];
+
+ memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
+ memset(cursizes, 0, sizeof(UINT64)*m_avih.dwStreams);
+
+ int end = 0;
+
+ while(1)
+ {
+ UINT64 fpmin = _I64_MAX;
+
+ DWORD n = -1;
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ int curchunk = curchunks[i];
+ CAtlArray<strm_t::chunk>& cs = m_strms[i]->cs;
+ if(curchunk >= cs.GetCount()) continue;
+ UINT64 fp = cs[curchunk].filepos;
+ if(fp < fpmin) {fpmin = fp; n = i;}
+ }
+ if(n == -1) break;
+
+ strm_t* s = m_strms[n];
+ DWORD& curchunk = curchunks[n];
+ UINT64& cursize = cursizes[n];
+
+ if(!s->IsRawSubtitleStream())
+ {
+ strm_t::chunk2& cs2 = s->cs2[curchunk];
+ cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)>>13); // for comparing later it is just as good as /10000 to get a near [ms] accuracy
+// cs2.t = (DWORD)(s->GetRefTime(curchunk, cursize)/10000);
+ cs2.n = end++;
+ }
+
+ cursize = s->cs[curchunk].size;
+ curchunk++;
+ }
+
+ memset(curchunks, 0, sizeof(DWORD)*m_avih.dwStreams);
+
+ strm_t::chunk2 cs2last = {-1, 0};
+
+ bool fInterleaved = true;
+
+ while(fInterleaved)
+ {
+ strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
+
+ int n = -1;
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ {
+ int curchunk = curchunks[i];
+ if(curchunk >= m_strms[i]->cs2.GetCount()) continue;
+ strm_t::chunk2& cs2 = m_strms[i]->cs2[curchunk];
+ if(cs2.t < cs2min.t) {cs2min = cs2; n = i;}
+ }
+ if(n == -1) break;
+
+ curchunks[n]++;
+
+ if(cs2last.t >= 0 && abs(cs2min.n - cs2last.n) >= 1000)
+ fInterleaved = false;
+
+ cs2last = cs2min;
+ }
+
+ delete [] curchunks;
+ delete [] cursizes;
+
+ if(fInterleaved && !fKeepInfo)
+ {
+ // this is not needed anymore, let's save a little memory then
+ for(int i = 0; i < (int)m_avih.dwStreams; i++)
+ m_strms[i]->cs2.RemoveAll();
+ }
+
+ return(fInterleaved);
+}
+
+REFERENCE_TIME CAviFile::strm_t::GetRefTime(DWORD frame, UINT64 size)
+{
+ float dframe = frame;
+
+ if(strh.fccType == FCC('auds'))
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
+
+ dframe = wfe->nBlockAlign ? 1.0f * size / wfe->nBlockAlign : 0;
+ }
+
+ float scale_per_rate = strh.dwRate ? 1.0f * strh.dwScale / strh.dwRate : 0;
+
+ return (REFERENCE_TIME)(scale_per_rate * dframe * 10000000 + 0.5f);
+}
+
+int CAviFile::strm_t::GetFrame(REFERENCE_TIME rt)
+{
+ int frame = -1;
+
+ float rate_per_scale = strh.dwScale ? 1.0f * strh.dwRate / strh.dwScale : 0;
+
+ if(strh.fccType == FCC('auds'))
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)strf.GetData();
+
+ __int64 size = (__int64)(rate_per_scale * wfe->nBlockAlign * rt / 10000000 + 0.5f);
+
+ for(frame = 0; frame < cs.GetCount(); frame++)
+ {
+ if(cs[frame].size > size)
+ {
+ frame--;
+ break;
+ }
+ }
+ }
+ else
+ {
+ frame = (int)(rate_per_scale * rt / 10000000 + 0.5f);
+ }
+
+ if(frame >= cs.GetCount()) frame = cs.GetCount()-1;
+
+ return frame;
+}
+
+int CAviFile::strm_t::GetKeyFrame(REFERENCE_TIME rt)
+{
+ int i = GetFrame(rt);
+ for(; i > 0; i--) {if(cs[i].fKeyFrame) break;}
+ return(i);
+}
+
+DWORD CAviFile::strm_t::GetChunkSize(DWORD size)
+{
+ if(strh.fccType == FCC('auds'))
+ {
+ WORD nBlockAlign = ((WAVEFORMATEX*)strf.GetData())->nBlockAlign;
+ size = nBlockAlign ? (size + (nBlockAlign-1)) / nBlockAlign * nBlockAlign : 0; // round up for nando's vbr hack
+ }
+
+ return size;
+}
+
+bool CAviFile::strm_t::IsRawSubtitleStream()
+{
+ return strh.fccType == FCC('txts') && cs.GetCount() == 1;
+}
diff --git a/src/filters/parser/avisplitter/AviFile.h b/src/filters/parser/avisplitter/AviFile.h
new file mode 100644
index 000000000..c8124c5d4
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviFile.h
@@ -0,0 +1,53 @@
+#pragma once
+
+#include <Aviriff.h> // conflicts with vfw.h...
+#include "..\BaseSplitter\BaseSplitter.h"
+
+class CAviFile : public CBaseSplitterFile
+{
+ HRESULT Init();
+ HRESULT Parse(DWORD parentid, __int64 end);
+
+public:
+ CAviFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+
+ //using CBaseSplitterFile::Read;
+ template<typename T> HRESULT Read(T& var, int offset = 0);
+
+ AVIMAINHEADER m_avih;
+ struct ODMLExtendedAVIHeader {DWORD dwTotalFrames;} m_dmlh;
+// VideoPropHeader m_vprp;
+ struct strm_t
+ {
+ AVISTREAMHEADER strh;
+ CAtlArray<BYTE> strf;
+ CStringA strn;
+ CAutoPtr<AVISUPERINDEX> indx;
+ struct chunk {UINT64 fKeyFrame:1, fChunkHdr:1, size:62; UINT64 filepos; DWORD orgsize;};
+ CAtlArray<chunk> cs;
+ UINT64 totalsize;
+ REFERENCE_TIME GetRefTime(DWORD frame, UINT64 size);
+ int GetTime(DWORD frame, UINT64 size);
+ int GetFrame(REFERENCE_TIME rt);
+ int GetKeyFrame(REFERENCE_TIME rt);
+ DWORD GetChunkSize(DWORD size);
+ bool IsRawSubtitleStream();
+
+ // tmp
+ struct chunk2 {DWORD t; DWORD n;};
+ CAtlArray<chunk2> cs2;
+ };
+ CAutoPtrArray<strm_t> m_strms;
+ CAtlMap<DWORD, CStringA> m_info;
+ CAutoPtr<AVIOLDINDEX> m_idx1;
+
+ CAtlList<UINT64> m_movis;
+
+ REFERENCE_TIME GetTotalTime();
+ HRESULT BuildIndex();
+ void EmptyIndex();
+ bool IsInterleaved(bool fKeepInfo = false);
+};
+
+#define TRACKNUM(fcc) (10*((fcc&0xff)-0x30) + (((fcc>>8)&0xff)-0x30))
+#define TRACKTYPE(fcc) ((WORD)((((DWORD)fcc>>24)&0xff)|((fcc>>8)&0xff00)))
diff --git a/src/filters/parser/avisplitter/AviReportWnd.cpp b/src/filters/parser/avisplitter/AviReportWnd.cpp
new file mode 100644
index 000000000..32a4f6e1a
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviReportWnd.cpp
@@ -0,0 +1,344 @@
+#include "StdAfx.h"
+#include "AviReportWnd.h"
+
+#define IDC_DONOTSHOWAGAINCHECK 1000
+#define TITLE _T("AVI Chunk Viewer")
+#define GRAPHFOOTER 10
+
+CAviReportWnd::CAviReportWnd()
+{
+ m_font.CreateFont(12, 0, 0, 0, 400, 0, 0, 0, 1, 0, 0, 0, 0, _T("MS Shell Dlg"));
+}
+
+bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText)
+{
+ m_nChunks = 0;
+ m_rtDur = 0;
+
+ for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
+ {
+ int cnt = pAF->m_strms[i]->cs2.GetCount();
+ if(cnt <= 0) continue;
+ CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
+ m_nChunks = max(m_nChunks, c2.n);
+ m_rtDur = max(m_rtDur, (REFERENCE_TIME)c2.t<<13);
+ }
+
+ CRect r, r2;
+ GetDesktopWindow()->GetWindowRect(r);
+ r.DeflateRect(r.Width()/4, r.Height()/4);
+
+ LPCTSTR wndclass = AfxRegisterWndClass(
+ CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS,
+ AfxGetApp()->LoadStandardCursor(IDC_ARROW),
+ (HBRUSH)(COLOR_BTNFACE + 1), 0);
+
+ CreateEx(0, wndclass, TITLE, WS_POPUPWINDOW|WS_CAPTION|WS_CLIPCHILDREN, r, NULL, 0);
+
+ CRect cr;
+ GetClientRect(cr);
+ cr.DeflateRect(10, 10);
+
+ SetFont(&m_font, FALSE);
+
+ CDC* pDC = GetDC();
+ CFont* pOldFont = pDC->SelectObject(&m_font);
+
+ //
+
+ CString str(
+ _T("This AVI file was not prepared for sequential reading, the alternative ")
+ _T("'Avi Splitter' will now let the default one handle it. ")
+ _T("The complete reinterleaving of this file is strongly recommended before ")
+ _T("burning it onto a slow media like cd-rom."));
+
+ r = cr;
+
+ pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT);
+ r.right = cr.right;
+
+ m_message.Create(str, WS_CHILD|WS_VISIBLE, r, this);
+ m_message.SetFont(&m_font, FALSE);
+
+ //
+
+ r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
+
+ str = _T("Do not show this dialog again (hold Shift to re-enable it)");
+
+ pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT);
+ r.right = cr.right;
+
+ m_checkbox.Create(str, WS_CHILD|WS_VISIBLE|BS_CHECKBOX|BS_AUTOCHECKBOX, r, this, IDC_DONOTSHOWAGAINCHECK);
+ m_checkbox.SetFont(&m_font, FALSE);
+
+ CheckDlgButton(IDC_DONOTSHOWAGAINCHECK, fHideChecked?BST_CHECKED:BST_UNCHECKED);
+
+ //
+
+ if(!fShowWarningText)
+ {
+ m_message.ShowWindow(SW_HIDE);
+ m_checkbox.ShowWindow(SW_HIDE);
+ r = cr;
+ }
+ else
+ {
+ r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom);
+ }
+
+ m_graph.Create(pAF, r, this);
+
+ //
+
+ pDC->SelectObject(pOldFont);
+ ReleaseDC(pDC);
+
+ SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
+ SetForegroundWindow();
+ ShowWindow(SW_SHOWNORMAL);
+
+ return !!RunModalLoop();
+}
+
+IMPLEMENT_DYNCREATE(CAviReportWnd, CWnd)
+
+BEGIN_MESSAGE_MAP(CAviReportWnd, CWnd)
+ ON_WM_CLOSE()
+ ON_WM_MOUSEMOVE()
+END_MESSAGE_MAP()
+
+void CAviReportWnd::OnClose()
+{
+ EndModalLoop(IsDlgButtonChecked(IDC_DONOTSHOWAGAINCHECK));
+ __super::OnClose();
+}
+
+void CAviReportWnd::OnMouseMove(UINT nFlags, CPoint p)
+{
+ MapWindowPoints(&m_graph, &p, 1);
+
+ CRect r, r2;
+ m_graph.GetClientRect(r);
+ r2 = r;
+ r.bottom -= GRAPHFOOTER;
+ r2.top = r.bottom;
+
+ if(r.PtInRect(p))
+ {
+ SetCapture();
+
+ int x = p.x - r.left;
+ int y = r.bottom - p.y;
+
+ REFERENCE_TIME rt = m_rtDur * x / r.Width();
+ int chunk = (int)(1.0 * m_nChunks * y / r.Height());
+
+ rt /= 10000;
+ int ms = (int)(rt%1000);
+ rt /= 1000;
+ int s = (int)(rt%60);
+ rt /= 60;
+ int m = (int)(rt%60);
+ rt /= 60;
+ int h = (int)(rt);
+
+ CString str;
+ str.Format(_T("%s (%d - %d:%02d:%02d.%03d)"), TITLE, chunk, h, m, s, ms);
+ SetWindowText(str);
+ }
+ else if(r2.PtInRect(p))
+ {
+ SetCapture();
+
+ int dist = m_graph.GetChunkDist(p.x - r2.left);
+ CString str;
+ str.Format(_T("%s (chunk distance: %d"), TITLE, dist);
+ if(dist >= 1000) str += _T(" - over the limit!");
+ str += ")";
+ SetWindowText(str);
+ }
+ else if(GetCapture() == this)
+ {
+ SetWindowText(TITLE);
+
+ ReleaseCapture();
+ }
+
+ __super::OnMouseMove(nFlags, p);
+}
+
+//////////////
+
+CAviPlotterWnd::CAviPlotterWnd()
+{
+}
+
+bool CAviPlotterWnd::Create(CAviFile* pAF, CRect r, CWnd* pParentWnd)
+{
+ if(!CreateEx(WS_EX_CLIENTEDGE, _T("STATIC"), _T(""), WS_CHILD|WS_VISIBLE, r, pParentWnd, 0))
+ return(false);
+
+ GetClientRect(r);
+ int w = r.Width();
+ int h = r.Height() - GRAPHFOOTER;
+
+ CDC* pDC = GetDC();
+ m_dc.CreateCompatibleDC(pDC);
+ m_bm.CreateCompatibleBitmap(pDC, r.Width(), r.Height());
+ ReleaseDC(pDC);
+
+ CBitmap* pOldBitmap = m_dc.SelectObject(&m_bm);
+
+ m_dc.FillSolidRect(r, 0);
+
+ {
+ CPen pen(PS_DOT, 1, 0x008000);
+ CPen* pOldPen = m_dc.SelectObject(&pen);
+ for(int y = 0, dy = max(h/10,1); y < h; y += dy) {if(y == 0) continue; m_dc.MoveTo(0, y); m_dc.LineTo(w, y);}
+ for(int x = 0, dx = max(w/10,1); x < w; x += dx) {if(x == 0) continue; m_dc.MoveTo(x, 0); m_dc.LineTo(x, w);}
+ m_dc.SelectObject(pOldPen);
+ }
+
+ {
+ CPen pen(PS_SOLID, 1, 0x00ff00);
+ CPen* pOldPen = m_dc.SelectObject(&pen);
+ m_dc.MoveTo(15, 30);
+ m_dc.LineTo(15, 2);
+ m_dc.LineTo(19, 10);
+ m_dc.LineTo(11, 10);
+ m_dc.LineTo(15, 2);
+ m_dc.MoveTo(w-30-10, h-15);
+ m_dc.LineTo(w-2-10, h-15);
+ m_dc.LineTo(w-10-10, h-19);
+ m_dc.LineTo(w-10-10, h-11);
+ m_dc.LineTo(w-2-10, h-15);
+ m_dc.SelectObject(pOldPen);
+
+ m_dc.SetTextColor(0x008000);
+ m_dc.TextOut(20, 10, _T("Chunk"));
+
+ CSize size = m_dc.GetTextExtent(_T("Time"));
+ m_dc.TextOut(w - size.cx - 10, h - size.cy - 20, _T("Time"));
+ }
+
+ COLORREF clr[] = {0x0000ff,0xff0000,0x40ffff,0xff40ff,0xffff40,0xffffff};
+
+ for(int i = 0, y = 40, dy = m_dc.GetTextExtent(_T("Stream N")).cy + 1; i < (int)pAF->m_avih.dwStreams; i++, y += dy)
+ {
+ m_dc.SetTextColor(clr[i%pAF->m_avih.dwStreams]);
+ m_dc.SetBkMode(TRANSPARENT);
+ CString str;
+ str.Format(_T("Stream %d"), i);
+ m_dc.TextOut(10, y, str);
+ }
+
+ DWORD nmax = 0, tmax = 0;
+
+ for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
+ {
+ int cnt = pAF->m_strms[i]->cs2.GetCount();
+ if(cnt <= 0) continue;
+ CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1];
+ nmax = max(nmax, c2.n);
+ tmax = max(tmax, c2.t);
+ }
+
+ if(nmax > 0 && tmax > 0)
+ {
+ CAtlArray<CPen> pen;
+ pen.SetCount(pAF->m_avih.dwStreams);
+ for(int i = 0; i < pen.GetCount(); i++)
+ pen[i].CreatePen(PS_SOLID, 2, clr[i]);
+
+ CAtlArray<CPoint> pp;
+ pp.SetCount(pAF->m_avih.dwStreams);
+ for(int i = 0; i < pen.GetCount(); i++)
+ pp[i].SetPoint(-1, -1);
+
+ m_chunkdist.SetCount(w);
+ memset(m_chunkdist.GetData(), 0, sizeof(int)*w);
+
+ DWORD* curchunks = new DWORD[pAF->m_avih.dwStreams];
+ memset(curchunks, 0, sizeof(DWORD)*pAF->m_avih.dwStreams);
+
+ CAviFile::strm_t::chunk2 cs2last = {-1, 0};
+
+ while(1)
+ {
+ CAviFile::strm_t::chunk2 cs2min = {LONG_MAX, LONG_MAX};
+
+ int n = -1;
+ for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++)
+ {
+ int curchunk = curchunks[i];
+ if(curchunk >= pAF->m_strms[i]->cs2.GetCount()) continue;
+ CAviFile::strm_t::chunk2& cs2 = pAF->m_strms[i]->cs2[curchunk];
+ if(cs2.t < cs2min.t) {cs2min = cs2; n = i;}
+ }
+ if(n == -1) break;
+
+
+ CPoint p;
+ p.x = (int)(1.0 * w * cs2min.t / tmax);
+ p.y = (int)(h - 1.0 * h * cs2min.n / nmax);
+ if(pp[n] != p)
+ {
+ CPen* pOldPen = m_dc.SelectObject(&pen[n]);
+ if(pp[n] == CPoint(-1, -1)) m_dc.MoveTo(p);
+ else {m_dc.MoveTo(pp[n]); m_dc.LineTo(p);}
+ m_dc.SelectObject(pOldPen);
+ pp[n] = p;
+ }
+
+ int dist = abs(cs2min.n - cs2last.n);
+
+ if(cs2last.t >= 0 /*&& dist >= 1000*/)
+ {
+ if(p.x >= 0 && p.x < w)
+ {
+ m_chunkdist[p.x] = max(m_chunkdist[p.x], dist);
+ }
+ }
+
+ curchunks[n]++;
+ cs2last = cs2min;
+ }
+
+ CPen red(PS_SOLID, 1, 0x0000ff);
+ CPen green(PS_SOLID, 1, 0x00ff00);
+
+ for(int x = 0; x < w; x++)
+ {
+ CPen* pOldPen = m_dc.SelectObject(m_chunkdist[x] >= 1000 ? &red : &green);
+ m_dc.MoveTo(x, h);
+ m_dc.LineTo(x, h + GRAPHFOOTER);
+ m_dc.SelectObject(pOldPen);
+ }
+
+ delete [] curchunks;
+ }
+
+ m_dc.SelectObject(pOldBitmap);
+
+ return(true);
+}
+
+IMPLEMENT_DYNCREATE(CAviPlotterWnd, CWnd)
+
+BEGIN_MESSAGE_MAP(CAviPlotterWnd, CWnd)
+ ON_WM_PAINT()
+END_MESSAGE_MAP()
+
+void CAviPlotterWnd::OnPaint()
+{
+ CPaintDC dc(this); // device context for painting
+
+ CRect r;
+ GetClientRect(r);
+
+ CBitmap* pOld = m_dc.SelectObject(&m_bm);
+ dc.BitBlt(0, 0, r.Width(), r.Height(), &m_dc, 0, 0, SRCCOPY);
+ m_dc.SelectObject(pOld);
+}
+
diff --git a/src/filters/parser/avisplitter/AviReportWnd.h b/src/filters/parser/avisplitter/AviReportWnd.h
new file mode 100644
index 000000000..cd5c3b331
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviReportWnd.h
@@ -0,0 +1,47 @@
+#pragma once
+
+#include "AviFile.h"
+
+class CAviPlotterWnd : public CStatic
+{
+ DECLARE_DYNCREATE(CAviPlotterWnd)
+
+private:
+ CDC m_dc;
+ CBitmap m_bm;
+
+ CAtlArray<int> m_chunkdist;
+
+public:
+ CAviPlotterWnd();
+ bool Create(CAviFile* pAF, CRect r, CWnd* pParentWnd);
+
+ int GetChunkDist(int x) {return x >= 0 && x < m_chunkdist.GetCount() ? m_chunkdist[x] : 0;}
+
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnPaint();
+};
+
+class CAviReportWnd : public CWnd
+{
+ DECLARE_DYNCREATE(CAviReportWnd)
+
+protected:
+ CFont m_font;
+ CStatic m_message;
+ CButton m_checkbox;
+ CAviPlotterWnd m_graph;
+
+ int m_nChunks;
+ REFERENCE_TIME m_rtDur;
+
+public:
+ CAviReportWnd();
+ bool DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText);
+
+ DECLARE_MESSAGE_MAP()
+ afx_msg void OnClose();
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+};
+
+
diff --git a/src/filters/parser/avisplitter/AviSplitter.cpp b/src/filters/parser/avisplitter/AviSplitter.cpp
new file mode 100644
index 000000000..c6fd720c4
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviSplitter.cpp
@@ -0,0 +1,854 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include "AviFile.h"
+#include "AviReportWnd.h"
+#include "AviSplitter.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Avi},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CAviSplitterFilter), L"Avi Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins},
+ {&__uuidof(CAviSourceFilter), L"Avi Source", MERIT_NORMAL+1, 0, NULL},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CAviSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CAviSourceFilter>, NULL, &sudFilter[1]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ CAtlList<CString> chkbytes;
+ chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564920")); // 'RIFF' ... 'AVI '
+ chkbytes.AddTail(_T("0,4,,52494646,8,4,,41564958")); // 'RIFF' ... 'AVIX'
+
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_Avi,
+ chkbytes,
+ _T(".avi"), _T(".divx"), _T(".vp6"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+// UnRegisterSourceFilter(MEDIASUBTYPE_Avi);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
+
+class CAviSplitterApp : public CWinApp
+{
+public:
+ CAviSplitterApp() {}
+
+ BOOL InitInstance()
+ {
+ if(!__super::InitInstance()) return FALSE;
+ DllEntryPoint(m_hInstance, DLL_PROCESS_ATTACH, 0);
+ return TRUE;
+ }
+
+ BOOL ExitInstance()
+ {
+ DllEntryPoint(m_hInstance, DLL_PROCESS_DETACH, 0);
+ return __super::ExitInstance();
+ }
+
+ void SetDefaultRegistryKey()
+ {
+ SetRegistryKey(_T("Gabest"));
+ }
+
+ DECLARE_MESSAGE_MAP()
+};
+
+BEGIN_MESSAGE_MAP(CAviSplitterApp, CWinApp)
+END_MESSAGE_MAP()
+
+CAviSplitterApp theApp;
+
+#endif
+
+//
+// CAviSplitterFilter
+//
+
+CAviSplitterFilter::CAviSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("CAviSplitterFilter"), pUnk, phr, __uuidof(this))
+ , m_timeformat(TIME_FORMAT_MEDIA_TIME)
+{
+}
+
+STDMETHODIMP CAviSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ *ppv = NULL;
+
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CAviSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+ m_tFrame.Free();
+
+ m_pFile.Attach(new CAviFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+
+ bool fShiftDown = !!(::GetKeyState(VK_SHIFT)&0x8000);
+ bool fShowWarningText = !m_pFile->IsInterleaved(fShiftDown);
+
+ if(SUCCEEDED(hr) && (fShowWarningText || fShiftDown))
+ {
+#ifdef REGISTER_FILTER
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+#endif
+ bool fHideWarning = !!AfxGetApp()->GetProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), 0);
+
+ if(!fHideWarning && !dynamic_cast<CAviSourceFilter*>(this) || fShiftDown)
+ {
+ CAviReportWnd wnd;
+ fHideWarning = wnd.DoModal(m_pFile, fHideWarning, fShowWarningText);
+ AfxGetApp()->WriteProfileInt(_T("Settings"), _T("HideAviSplitterWarning"), fHideWarning);
+ }
+
+ if(fShowWarningText) hr = E_FAIL;
+ }
+
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetTotalTime();
+
+ bool fHasIndex = false;
+
+ for(DWORD i = 0; !fHasIndex && i < m_pFile->m_strms.GetCount(); i++)
+ if(m_pFile->m_strms[i]->cs.GetCount() > 0)
+ fHasIndex = true;
+
+ for(DWORD i = 0; i < m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+
+ if(fHasIndex && s->cs.GetCount() == 0) continue;
+
+ CMediaType mt;
+ CAtlArray<CMediaType> mts;
+
+ CStringW name, label;
+
+ if(s->strh.fccType == FCC('vids'))
+ {
+ label = L"Video";
+
+ ASSERT(s->strf.GetCount() >= sizeof(BITMAPINFOHEADER));
+
+ BITMAPINFOHEADER* pbmi = &((BITMAPINFO*)s->strf.GetData())->bmiHeader;
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap(pbmi->biCompression);
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + s->strf.GetCount() - sizeof(BITMAPINFOHEADER));
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(&pvih->bmiHeader, s->strf.GetData(), s->strf.GetCount());
+ if(s->strh.dwRate > 0) pvih->AvgTimePerFrame = 10000000i64 * s->strh.dwScale / s->strh.dwRate;
+ switch(pbmi->biCompression)
+ {
+ case BI_RGB: case BI_BITFIELDS: mt.subtype =
+ pbmi->biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
+ pbmi->biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
+ pbmi->biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
+ pbmi->biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
+ pbmi->biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
+ pbmi->biBitCount == 32 ? MEDIASUBTYPE_ARGB32 :
+ MEDIASUBTYPE_NULL;
+ break;
+// case BI_RLE8: mt.subtype = MEDIASUBTYPE_RGB8; break;
+// case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
+ }
+
+ if(s->cs.GetCount() && pvih->AvgTimePerFrame > 0)
+ {
+ __int64 size = 0;
+ for(int i = 0; i < s->cs.GetCount(); i++)
+ size += s->cs[i].orgsize;
+ pvih->dwBitRate = size*8 / s->cs.GetCount() * 10000000i64 / pvih->AvgTimePerFrame;
+ }
+
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (pvih->bmiHeader.biWidth*pvih->bmiHeader.biHeight*4));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('auds'))
+ {
+ label = L"Audio";
+
+ ASSERT(s->strf.GetCount() >= sizeof(WAVEFORMATEX)
+ || s->strf.GetCount() == sizeof(PCMWAVEFORMAT));
+
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)s->strf.GetData();
+
+ if(pwfe->nBlockAlign == 0) continue;
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = FOURCCMap(pwfe->wFormatTag);
+ mt.formattype = FORMAT_WaveFormatEx;
+ mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(WAVEFORMATEX)));
+ pwfe = (WAVEFORMATEX*)mt.Format();
+ if(s->strf.GetCount() == sizeof(PCMWAVEFORMAT)) pwfe->cbSize = 0;
+ if(pwfe->wFormatTag == WAVE_FORMAT_PCM) pwfe->nBlockAlign = pwfe->nChannels*pwfe->wBitsPerSample>>3;
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (pwfe->nChannels*pwfe->nSamplesPerSec*32>>3));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('mids'))
+ {
+ label = L"Midi";
+
+ mt.majortype = MEDIATYPE_Midi;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (1024*1024));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('txts'))
+ {
+ label = L"Text";
+
+ mt.majortype = MEDIATYPE_Text;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (1024*1024));
+ mts.Add(mt);
+ }
+ else if(s->strh.fccType == FCC('iavs'))
+ {
+ label = L"Interleaved";
+
+ ASSERT(s->strh.fccHandler == FCC('dvsd'));
+
+ mt.majortype = MEDIATYPE_Interleaved;
+ mt.subtype = FOURCCMap(s->strh.fccHandler);
+ mt.formattype = FORMAT_DvInfo;
+ mt.SetFormat(s->strf.GetData(), max(s->strf.GetCount(), sizeof(DVINFO)));
+ mt.SetSampleSize(s->strh.dwSuggestedBufferSize > 0
+ ? s->strh.dwSuggestedBufferSize*3/2
+ : (1024*1024));
+ mts.Add(mt);
+ }
+
+ if(mts.IsEmpty())
+ {
+ TRACE(_T("CAviSourceFilter: Unsupported stream (%d)\n"), i);
+ continue;
+ }
+
+ name.Format(L"%s %d", !s->strn.IsEmpty() ? CStringW(s->strn) : label, i);
+
+ HRESULT hr;
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CAviSplitterOutputPin(mts, name, this, this, &hr));
+ AddOutputPin(i, pPinOut);
+ }
+
+ POSITION pos = m_pFile->m_info.GetStartPosition();
+ while(pos)
+ {
+ DWORD fcc;
+ CStringA value;
+ m_pFile->m_info.GetNextAssoc(pos, fcc, value);
+
+ switch(fcc)
+ {
+ case FCC('INAM'): SetProperty(L"TITL", CStringW(value)); break;
+ case FCC('IART'): SetProperty(L"AUTH", CStringW(value)); break;
+ case FCC('ICOP'): SetProperty(L"CPYR", CStringW(value)); break;
+ case FCC('ISBJ'): SetProperty(L"DESC", CStringW(value)); break;
+ }
+ }
+
+ m_tFrame.Attach(new DWORD[m_pFile->m_avih.dwStreams]);
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool CAviSplitterFilter::DemuxInit()
+{
+ if(!m_pFile) return(false);
+
+ // reindex if needed
+
+ bool fReIndex = false;
+
+ for(int i = 0; i < (int)m_pFile->m_avih.dwStreams && !fReIndex; i++)
+ {
+ if(m_pFile->m_strms[i]->cs.GetCount() == 0 && GetOutputPin(i))
+ fReIndex = true;
+ }
+
+ if(fReIndex)
+ {
+ m_pFile->EmptyIndex();
+
+ m_fAbort = false;
+ m_nOpenProgress = 0;
+
+ m_rtDuration = 0;
+
+ CAutoVectorPtr<UINT64> pSize;
+ pSize.Allocate(m_pFile->m_avih.dwStreams);
+ memset((UINT64*)pSize, 0, sizeof(UINT64)*m_pFile->m_avih.dwStreams);
+ m_pFile->Seek(0);
+ ReIndex(m_pFile->GetLength(), pSize);
+
+ if(m_fAbort) m_pFile->EmptyIndex();
+
+ m_fAbort = false;
+ m_nOpenProgress = 100;
+ }
+
+ return(true);
+}
+
+HRESULT CAviSplitterFilter::ReIndex(__int64 end, UINT64* pSize)
+{
+ HRESULT hr = S_OK;
+
+ while(S_OK == hr && m_pFile->GetPos() < end && SUCCEEDED(hr) && !m_fAbort)
+ {
+ __int64 pos = m_pFile->GetPos();
+
+ DWORD id = 0, size;
+ if(S_OK != m_pFile->Read(id) || id == 0)
+ return E_FAIL;
+
+ if(id == FCC('RIFF') || id == FCC('LIST'))
+ {
+ if(S_OK != m_pFile->Read(size) || S_OK != m_pFile->Read(id))
+ return E_FAIL;
+
+ size += (size&1) + 8;
+
+ if(id == FCC('AVI ') || id == FCC('AVIX') || id == FCC('movi') || id == FCC('rec '))
+ hr = ReIndex(pos + size, pSize);
+ }
+ else
+ {
+ if(S_OK != m_pFile->Read(size))
+ return E_FAIL;
+
+ DWORD TrackNumber = TRACKNUM(id);
+
+ if(TrackNumber < m_pFile->m_strms.GetCount())
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[TrackNumber];
+
+ WORD type = TRACKTYPE(id);
+
+ if(type == 'db' || type == 'dc' || /*type == 'pc' ||*/ type == 'wb'
+ || type == 'iv' || type == '__' || type == 'xx')
+ {
+ CAviFile::strm_t::chunk c;
+ c.filepos = pos;
+ c.size = pSize[TrackNumber];
+ c.orgsize = size;
+ c.fKeyFrame = size > 0; // TODO: find a better way...
+ c.fChunkHdr = true;
+ s->cs.Add(c);
+
+ pSize[TrackNumber] += s->GetChunkSize(size);
+
+ REFERENCE_TIME rt = s->GetRefTime(s->cs.GetCount()-1, pSize[TrackNumber]);
+ m_rtDuration = max(rt, m_rtDuration);
+ }
+ }
+
+ size += (size&1) + 8;
+ }
+
+ m_pFile->Seek(pos + size);
+
+ m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
+
+ DWORD cmd;
+ if(CheckRequest(&cmd))
+ {
+ if(cmd == CMD_EXIT) m_fAbort = true;
+ else Reply(S_OK);
+ }
+ }
+
+ return hr;
+}
+
+void CAviSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ memset((DWORD*)m_tFrame, 0, sizeof(DWORD)*m_pFile->m_avih.dwStreams);
+ m_pFile->Seek(0);
+
+ DbgLog((LOG_TRACE, 0, _T("Seek: %I64d"), rt/10000));
+
+ if(rt > 0)
+ {
+ UINT64 minfp = _I64_MAX;
+
+ for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[j];
+
+ int f = s->GetKeyFrame(rt);
+ UINT64 fp = f >= 0 ? s->cs[f].filepos : m_pFile->GetLength();
+
+ if(!s->IsRawSubtitleStream())
+ minfp = min(minfp, fp);
+ }
+
+ for(int j = 0; j < (int)m_pFile->m_strms.GetCount(); j++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[j];
+
+ for(int i = 0; i < s->cs.GetCount(); i++)
+ {
+ CAviFile::strm_t::chunk& c = s->cs[i];
+ if(c.filepos >= minfp)
+ {
+ m_tFrame[j] = i;
+ break;
+ }
+ }
+ }
+
+ DbgLog((LOG_TRACE, 0, _T("minfp: %I64d"), minfp));
+ }
+}
+
+bool CAviSplitterFilter::DemuxLoop()
+{
+ HRESULT hr = S_OK;
+
+ int nTracks = (int)m_pFile->m_strms.GetCount();
+
+ CAtlArray<BOOL> fDiscontinuity;
+ fDiscontinuity.SetCount(nTracks);
+ memset(fDiscontinuity.GetData(), 0, nTracks*sizeof(bool));
+
+ while(SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ int minTrack = nTracks;
+ UINT64 minFilePos = _I64_MAX;
+
+ for(int i = 0; i < nTracks; i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+
+ DWORD f = m_tFrame[i];
+ if(f >= (DWORD)s->cs.GetCount()) continue;
+
+ bool fUrgent = s->IsRawSubtitleStream();
+
+ if(fUrgent || s->cs[f].filepos < minFilePos)
+ {
+ minTrack = i;
+ minFilePos = s->cs[f].filepos;
+ }
+
+ if(fUrgent) break;
+ }
+
+ if(minTrack == nTracks)
+ break;
+
+ DWORD& f = m_tFrame[minTrack];
+
+ do
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[minTrack];
+
+ m_pFile->Seek(s->cs[f].filepos);
+
+ DWORD size = 0;
+
+ if(s->cs[f].fChunkHdr)
+ {
+ DWORD id = 0;
+ if(S_OK != m_pFile->Read(id) || id == 0 || minTrack != TRACKNUM(id)
+ || S_OK != m_pFile->Read(size))
+ {
+ fDiscontinuity[minTrack] = true;
+ break;
+ }
+
+ UINT64 expectedsize = -1;
+ expectedsize = f < (DWORD)s->cs.GetCount()-1
+ ? s->cs[f+1].size - s->cs[f].size
+ : s->totalsize - s->cs[f].size;
+
+ if(expectedsize != s->GetChunkSize(size))
+ {
+ fDiscontinuity[minTrack] = true;
+ // ASSERT(0);
+ break;
+ }
+ }
+ else
+ {
+ size = s->cs[f].orgsize;
+ }
+
+ CAutoPtr<Packet> p(new Packet());
+
+ p->TrackNumber = minTrack;
+ p->bSyncPoint = (BOOL)s->cs[f].fKeyFrame;
+ p->bDiscontinuity = fDiscontinuity[minTrack];
+ p->rtStart = s->GetRefTime(f, s->cs[f].size);
+ p->rtStop = s->GetRefTime(f+1, f+1 < (DWORD)s->cs.GetCount() ? s->cs[f+1].size : s->totalsize);
+
+ p->SetCount(size);
+ if(S_OK != (hr = m_pFile->ByteRead(p->GetData(), p->GetCount())))
+ return(true); // break;
+/*
+ DbgLog((LOG_TRACE, 0, _T("%d (%d): %I64d - %I64d, %I64d - %I64d (size = %d)"),
+ minTrack, (int)p->bSyncPoint,
+ (p->rtStart)/10000, (p->rtStop)/10000,
+ (p->rtStart-m_rtStart)/10000, (p->rtStop-m_rtStart)/10000,
+ size));
+*/
+ hr = DeliverPacket(p);
+
+ fDiscontinuity[minTrack] = false;
+ }
+ while(0);
+
+ f++;
+ }
+
+ return(true);
+}
+
+// IMediaSeeking
+
+STDMETHODIMP CAviSplitterFilter::GetDuration(LONGLONG* pDuration)
+{
+ CheckPointer(pDuration, E_POINTER);
+ CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
+
+ if(m_timeformat == TIME_FORMAT_FRAME)
+ {
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType == FCC('vids'))
+ {
+ *pDuration = s->cs.GetCount();
+ return S_OK;
+ }
+ }
+
+ return E_UNEXPECTED;
+ }
+
+ return __super::GetDuration(pDuration);
+}
+
+//
+
+STDMETHODIMP CAviSplitterFilter::IsFormatSupported(const GUID* pFormat)
+{
+ CheckPointer(pFormat, E_POINTER);
+ HRESULT hr = __super::IsFormatSupported(pFormat);
+ if(S_OK == hr) return hr;
+ return *pFormat == TIME_FORMAT_FRAME ? S_OK : S_FALSE;
+}
+
+STDMETHODIMP CAviSplitterFilter::GetTimeFormat(GUID* pFormat)
+{
+ CheckPointer(pFormat, E_POINTER);
+ *pFormat = m_timeformat;
+ return S_OK;
+}
+
+STDMETHODIMP CAviSplitterFilter::IsUsingTimeFormat(const GUID* pFormat)
+{
+ CheckPointer(pFormat, E_POINTER);
+ return *pFormat == m_timeformat ? S_OK : S_FALSE;
+}
+
+STDMETHODIMP CAviSplitterFilter::SetTimeFormat(const GUID* pFormat)
+{
+ CheckPointer(pFormat, E_POINTER);
+ if(S_OK != IsFormatSupported(pFormat)) return E_FAIL;
+ m_timeformat = *pFormat;
+ return S_OK;
+}
+
+STDMETHODIMP CAviSplitterFilter::GetStopPosition(LONGLONG* pStop)
+{
+ CheckPointer(pStop, E_POINTER);
+ if(FAILED(__super::GetStopPosition(pStop))) return E_FAIL;
+ if(m_timeformat == TIME_FORMAT_MEDIA_TIME) return S_OK;
+ LONGLONG rt = *pStop;
+ if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, rt, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
+ return S_OK;
+}
+
+STDMETHODIMP CAviSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
+{
+ CheckPointer(pTarget, E_POINTER);
+
+ const GUID& SourceFormat = pSourceFormat ? *pSourceFormat : m_timeformat;
+ const GUID& TargetFormat = pTargetFormat ? *pTargetFormat : m_timeformat;
+
+ if(TargetFormat == SourceFormat)
+ {
+ *pTarget = Source;
+ return S_OK;
+ }
+ else if(TargetFormat == TIME_FORMAT_FRAME && SourceFormat == TIME_FORMAT_MEDIA_TIME)
+ {
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType == FCC('vids'))
+ {
+ *pTarget = s->GetFrame(Source);
+ return S_OK;
+ }
+ }
+ }
+ else if(TargetFormat == TIME_FORMAT_MEDIA_TIME && SourceFormat == TIME_FORMAT_FRAME)
+ {
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType == FCC('vids'))
+ {
+ if(Source < 0 || Source >= s->cs.GetCount()) return E_FAIL;
+ CAviFile::strm_t::chunk& c = s->cs[(int)Source];
+ *pTarget = s->GetRefTime((DWORD)Source, c.size);
+ return S_OK;
+ }
+ }
+ }
+
+ return E_FAIL;
+}
+
+STDMETHODIMP CAviSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
+{
+ HRESULT hr;
+ if(FAILED(hr = __super::GetPositions(pCurrent, pStop)) || m_timeformat != TIME_FORMAT_FRAME)
+ return hr;
+
+ if(pCurrent)
+ if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_FRAME, *pCurrent, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
+ if(pStop)
+ if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_FRAME, *pStop, &TIME_FORMAT_MEDIA_TIME))) return E_FAIL;
+
+ return S_OK;
+}
+
+HRESULT CAviSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
+{
+ if(m_timeformat != TIME_FORMAT_FRAME)
+ return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+
+ if(!pCurrent && !pStop
+ || (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
+ && (dwStopFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
+ return S_OK;
+
+ REFERENCE_TIME
+ rtCurrent = m_rtCurrent,
+ rtStop = m_rtStop;
+
+ if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ && FAILED(ConvertTimeFormat(&rtCurrent, &TIME_FORMAT_FRAME, rtCurrent, &TIME_FORMAT_MEDIA_TIME)))
+ return E_FAIL;
+ if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ && FAILED(ConvertTimeFormat(&rtStop, &TIME_FORMAT_FRAME, rtStop, &TIME_FORMAT_MEDIA_TIME)))
+ return E_FAIL;
+
+ if(pCurrent)
+ switch(dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtCurrent = *pCurrent; break;
+ case AM_SEEKING_RelativePositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ case AM_SEEKING_IncrementalPositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ }
+
+ if(pStop)
+ switch(dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtStop = *pStop; break;
+ case AM_SEEKING_RelativePositioning: rtStop += *pStop; break;
+ case AM_SEEKING_IncrementalPositioning: rtStop = rtCurrent + *pStop; break;
+ }
+
+ if((dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ && pCurrent)
+ if(FAILED(ConvertTimeFormat(pCurrent, &TIME_FORMAT_MEDIA_TIME, rtCurrent, &TIME_FORMAT_FRAME))) return E_FAIL;
+ if((dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ && pStop)
+ if(FAILED(ConvertTimeFormat(pStop, &TIME_FORMAT_MEDIA_TIME, rtStop, &TIME_FORMAT_FRAME))) return E_FAIL;
+
+ return __super::SetPositionsInternal(id, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+}
+
+// IKeyFrameInfo
+
+STDMETHODIMP CAviSplitterFilter::GetKeyFrameCount(UINT& nKFs)
+{
+ if(!m_pFile) return E_UNEXPECTED;
+
+ HRESULT hr = S_OK;
+
+ nKFs = 0;
+
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType != FCC('vids')) continue;
+
+ for(int j = 0; j < s->cs.GetCount(); j++)
+ {
+ CAviFile::strm_t::chunk& c = s->cs[j];
+ if(c.fKeyFrame) nKFs++;
+ }
+
+ if(nKFs == s->cs.GetCount())
+ hr = S_FALSE;
+
+ break;
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CAviSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
+{
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
+
+ if(!m_pFile) return E_UNEXPECTED;
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME && *pFormat != TIME_FORMAT_FRAME) return E_INVALIDARG;
+
+ UINT nKFsTmp = 0;
+
+ for(int i = 0; i < (int)m_pFile->m_strms.GetCount(); i++)
+ {
+ CAviFile::strm_t* s = m_pFile->m_strms[i];
+ if(s->strh.fccType != FCC('vids')) continue;
+
+ bool fConvertToRefTime = !!(*pFormat == TIME_FORMAT_MEDIA_TIME);
+
+ for(int j = 0; j < s->cs.GetCount() && nKFsTmp < nKFs; j++)
+ {
+ if(s->cs[j].fKeyFrame)
+ pKFs[nKFsTmp++] = fConvertToRefTime ? s->GetRefTime(j, s->cs[j].size) : j;
+ }
+
+ break;
+ }
+
+ nKFs = nKFsTmp;
+
+ return S_OK;
+}
+
+//
+// CAviSourceFilter
+//
+
+CAviSourceFilter::CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CAviSplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
+
+//
+// CAviSplitterOutputPin
+//
+
+CAviSplitterOutputPin::CAviSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+{
+}
+
+HRESULT CAviSplitterOutputPin::CheckConnect(IPin* pPin)
+{
+ int iPosition = 0;
+ CMediaType mt;
+ while(S_OK == GetMediaType(iPosition++, &mt))
+ {
+ if(mt.majortype == MEDIATYPE_Video
+ && (mt.subtype == FOURCCMap(FCC('IV32'))
+ || mt.subtype == FOURCCMap(FCC('IV31'))
+ || mt.subtype == FOURCCMap(FCC('IF09'))))
+ {
+ CLSID clsid = GetCLSID(GetFilterFromPin(pPin));
+ if(clsid == CLSID_VideoMixingRenderer || clsid == CLSID_OverlayMixer)
+ return E_FAIL;
+ }
+
+ mt.InitMediaType();
+ }
+
+ return __super::CheckConnect(pPin);
+}
+
diff --git a/src/filters/parser/avisplitter/AviSplitter.def b/src/filters/parser/avisplitter/AviSplitter.def
new file mode 100644
index 000000000..f49bad2d4
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "AviSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/avisplitter/AviSplitter.h b/src/filters/parser/avisplitter/AviSplitter.h
new file mode 100644
index 000000000..cd29dc0cc
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviSplitter.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\BaseSplitter\BaseSplitter.h"
+
+class CAviFile;
+
+class CAviSplitterOutputPin : public CBaseSplitterOutputPin
+{
+public:
+ CAviSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+
+ HRESULT CheckConnect(IPin* pPin);
+};
+
+[uuid("9736D831-9D6C-4E72-B6E7-560EF9181001")]
+class CAviSplitterFilter : public CBaseSplitterFilter
+{
+ CAutoVectorPtr<DWORD> m_tFrame;
+
+protected:
+ CAutoPtr<CAviFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+ HRESULT ReIndex(__int64 end, UINT64* pSize);
+
+public:
+ CAviSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+
+ // TODO: this is too ugly, integrate this with the baseclass somehow
+ GUID m_timeformat;
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+
+ HRESULT SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+
+ // IKeyFrameInfo
+
+ STDMETHODIMP GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+};
+
+[uuid("CEA8DEFF-0AF7-4DB9-9A38-FB3C3AEFC0DE")]
+class CAviSourceFilter : public CAviSplitterFilter
+{
+public:
+ CAviSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
diff --git a/src/filters/parser/avisplitter/AviSplitter.rc b/src/filters/parser/avisplitter/AviSplitter.rc
new file mode 100644
index 000000000..f918b4adb
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,6
+ PRODUCTVERSION 1,0,0,6
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Avi Splitter"
+ VALUE "FileVersion", "1, 0, 0, 6"
+ VALUE "InternalName", "Avi Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "AviSplitter.ax"
+ VALUE "ProductName", "Avi Splitter"
+ VALUE "ProductVersion", "1, 0, 0, 6"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/avisplitter/AviSplitter.sln b/src/filters/parser/avisplitter/AviSplitter.sln
new file mode 100644
index 000000000..89994de7f
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviSplitter.sln
@@ -0,0 +1,73 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AviSplitter", "AviSplitter.vcproj", "{9738B023-FC46-48A2-953A-0035FD897678}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug.ActiveCfg = Debug|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug lib.ActiveCfg = Debug lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release.ActiveCfg = Release|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release lib.ActiveCfg = Release lib|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {9738B023-FC46-48A2-953A-0035FD897678}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/avisplitter/AviSplitter.vcproj b/src/filters/parser/avisplitter/AviSplitter.vcproj
new file mode 100644
index 000000000..64f74564b
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviSplitter.vcproj
@@ -0,0 +1,566 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="AviSplitter"
+ ProjectGUID="{9738B023-FC46-48A2-953A-0035FD897678}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\AviFile.cpp">
+ </File>
+ <File
+ RelativePath=".\AviReportWnd.cpp">
+ </File>
+ <File
+ RelativePath="AviSplitter.cpp">
+ </File>
+ <File
+ RelativePath="AviSplitter.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\AviFile.h">
+ </File>
+ <File
+ RelativePath=".\AviReportWnd.h">
+ </File>
+ <File
+ RelativePath="AviSplitter.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\AviSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/avisplitter/AviSplitter_vs2005.vcproj b/src/filters/parser/avisplitter/AviSplitter_vs2005.vcproj
new file mode 100644
index 000000000..bed5756e6
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviSplitter_vs2005.vcproj
@@ -0,0 +1,820 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="AviSplitter"
+ ProjectGUID="{9738B023-FC46-48A2-953A-0035FD897678}"
+ RootNamespace="AviSplitter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ BufferSecurityCheck="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\AviFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AviReportWnd.cpp"
+ >
+ </File>
+ <File
+ RelativePath="AviSplitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="AviSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\AviFile.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AviReportWnd.h"
+ >
+ </File>
+ <File
+ RelativePath="AviSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\AviSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/avisplitter/AviSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/avisplitter/AviSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/avisplitter/AviSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/avisplitter/resource.h b/src/filters/parser/avisplitter/resource.h
new file mode 100644
index 000000000..f29274003
--- /dev/null
+++ b/src/filters/parser/avisplitter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by AviSplitter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/avisplitter/stdafx.cpp b/src/filters/parser/avisplitter/stdafx.cpp
new file mode 100644
index 000000000..c356f5dba
--- /dev/null
+++ b/src/filters/parser/avisplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// AviSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/avisplitter/stdafx.h b/src/filters/parser/avisplitter/stdafx.h
new file mode 100644
index 000000000..482cd4924
--- /dev/null
+++ b/src/filters/parser/avisplitter/stdafx.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
+#include "..\..\..\DSUtil\DSUtil.h"
diff --git a/src/filters/parser/basesplitter/AsyncReader.cpp b/src/filters/parser/basesplitter/AsyncReader.cpp
new file mode 100644
index 000000000..15d29491b
--- /dev/null
+++ b/src/filters/parser/basesplitter/AsyncReader.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+
+#include "StdAfx.h"
+#include "AsyncReader.h"
+#include <afxsock.h>
+#include <afxinet.h>
+#include "..\..\..\DSUtil\DSUtil.h"
+
+//
+// CAsyncFileReader
+//
+
+CAsyncFileReader::CAsyncFileReader(CString fn, HRESULT& hr)
+ : CUnknown(NAME("CAsyncFileReader"), NULL, &hr)
+ , m_len(-1)
+ , m_hBreakEvent(NULL)
+ , m_lOsError(0)
+{
+ hr = Open(fn, modeRead|shareDenyWrite|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
+ if(SUCCEEDED(hr)) m_len = GetLength();
+}
+
+STDMETHODIMP CAsyncFileReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IAsyncReader)
+ QI(ISyncReader)
+ QI(IFileHandle)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IAsyncReader
+
+STDMETHODIMP CAsyncFileReader::SyncRead(LONGLONG llPosition, LONG lLength, BYTE* pBuffer)
+{
+ do
+ {
+ try
+ {
+ if(llPosition+lLength > GetLength()) return E_FAIL; // strange, but the Seek below can return llPosition even if the file is not that big (?)
+ if(llPosition != Seek(llPosition, begin)) return E_FAIL;
+ if((UINT)lLength < Read(pBuffer, lLength)) return E_FAIL;
+
+#if 0 // def DEBUG
+ static __int64 s_total = 0, s_laststoppos = 0;
+ s_total += lLength;
+ if(s_laststoppos > llPosition)
+ TRACE(_T("[%I64d - %I64d] %d (%I64d)\n"), llPosition, llPosition + lLength, lLength, s_total);
+ s_laststoppos = llPosition + lLength;
+#endif
+
+ return S_OK;
+ }
+ catch(CFileException* e)
+ {
+ m_lOsError = e->m_lOsError;
+ e->Delete();
+ Sleep(1);
+ CString fn = m_strFileName;
+ try {Close();} catch(CFileException* e) {e->Delete();}
+ try {Open(fn, modeRead|shareDenyWrite|typeBinary|osSequentialScan);} catch(CFileException* e) {e->Delete();}
+ m_strFileName = fn;
+ }
+ }
+ while(m_hBreakEvent && WaitForSingleObject(m_hBreakEvent, 0) == WAIT_TIMEOUT);
+
+ return E_FAIL;
+}
+
+STDMETHODIMP CAsyncFileReader::Length(LONGLONG* pTotal, LONGLONG* pAvailable)
+{
+ LONGLONG len = m_len >= 0 ? m_len : GetLength();
+ if(pTotal) *pTotal = len;
+ if(pAvailable) *pAvailable = len;
+ return S_OK;
+}
+
+// IFileHandle
+
+STDMETHODIMP_(HANDLE) CAsyncFileReader::GetFileHandle()
+{
+ return m_hFile;
+}
+
+//
+// CAsyncUrlReader
+//
+
+CAsyncUrlReader::CAsyncUrlReader(CString url, HRESULT& hr)
+ : CAsyncFileReader(url, hr)
+{
+ if(SUCCEEDED(hr)) return;
+
+ m_url = url;
+
+ if(CAMThread::Create())
+ CallWorker(CMD_INIT);
+
+ hr = Open(m_fn, modeRead|shareDenyRead|typeBinary|osSequentialScan) ? S_OK : E_FAIL;
+ m_len = -1; // force GetLength() return actual length always
+}
+
+CAsyncUrlReader::~CAsyncUrlReader()
+{
+ if(ThreadExists())
+ CallWorker(CMD_EXIT);
+
+ if(!m_fn.IsEmpty())
+ {
+ CFile::Close();
+ DeleteFile(m_fn);
+ }
+}
+
+// IAsyncReader
+
+STDMETHODIMP CAsyncUrlReader::Length(LONGLONG* pTotal, LONGLONG* pAvailable)
+{
+ if(pTotal) *pTotal = 0;
+ return __super::Length(NULL, pAvailable);
+}
+
+// CAMThread
+
+DWORD CAsyncUrlReader::ThreadProc()
+{
+ AfxSocketInit(NULL);
+
+ DWORD cmd = GetRequest();
+ if(cmd != CMD_INIT) {Reply(E_FAIL); return E_FAIL;}
+
+ try
+ {
+ CInternetSession is;
+ CAutoPtr<CStdioFile> fin(is.OpenURL(m_url, 1, INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_EXISTING_CONNECT|INTERNET_FLAG_NO_CACHE_WRITE));
+
+ TCHAR path[MAX_PATH], fn[MAX_PATH];
+ CFile fout;
+ if(GetTempPath(MAX_PATH, path) && GetTempFileName(path, _T("mpc_http"), 0, fn)
+ && fout.Open(fn, modeCreate|modeWrite|shareDenyWrite|typeBinary))
+ {
+ m_fn = fn;
+
+ char buff[1024];
+ int len = fin->Read(buff, sizeof(buff));
+ if(len > 0) fout.Write(buff, len);
+
+ Reply(S_OK);
+
+ while(!CheckRequest(&cmd))
+ {
+ int len = fin->Read(buff, sizeof(buff));
+ if(len > 0) fout.Write(buff, len);
+ }
+ }
+ else
+ {
+ Reply(E_FAIL);
+ }
+
+ fin->Close(); // must close it because the destructor doesn't seem to do it and we will get an exception when "is" is destroying
+ }
+ catch(CInternetException* ie)
+ {
+ ie->Delete();
+ Reply(E_FAIL);
+ }
+
+ //
+
+ cmd = GetRequest();
+ ASSERT(cmd == CMD_EXIT);
+ Reply(S_OK);
+
+ //
+
+ m_hThread = NULL;
+
+ return S_OK;
+}
diff --git a/src/filters/parser/basesplitter/AsyncReader.h b/src/filters/parser/basesplitter/AsyncReader.h
new file mode 100644
index 000000000..b670bff5a
--- /dev/null
+++ b/src/filters/parser/basesplitter/AsyncReader.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+[uuid("6DDB4EE7-45A0-4459-A508-BD77B32C91B2")]
+interface ISyncReader : public IUnknown
+{
+ STDMETHOD_(void, SetBreakEvent) (HANDLE hBreakEvent) = 0;
+ STDMETHOD_(bool, HasErrors) () = 0;
+ STDMETHOD_(void, ClearErrors) () = 0;
+};
+
+[uuid("7D55F67A-826E-40B9-8A7D-3DF0CBBD272D")]
+interface IFileHandle : public IUnknown
+{
+ STDMETHOD_(HANDLE, GetFileHandle)() = 0;
+};
+
+class CAsyncFileReader : public CUnknown, public CFile, public IAsyncReader, public ISyncReader, public IFileHandle
+{
+protected:
+ ULONGLONG m_len;
+ HANDLE m_hBreakEvent;
+ LONG m_lOsError; // CFileException::m_lOsError
+
+public:
+ CAsyncFileReader(CString fn, HRESULT& hr);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IAsyncReader
+
+ STDMETHODIMP RequestAllocator(IMemAllocator* pPreferred, ALLOCATOR_PROPERTIES* pProps, IMemAllocator** ppActual) {return E_NOTIMPL;}
+ STDMETHODIMP Request(IMediaSample* pSample, DWORD_PTR dwUser) {return E_NOTIMPL;}
+ STDMETHODIMP WaitForNext(DWORD dwTimeout, IMediaSample** ppSample, DWORD_PTR* pdwUser) {return E_NOTIMPL;}
+ STDMETHODIMP SyncReadAligned(IMediaSample* pSample) {return E_NOTIMPL;}
+ STDMETHODIMP SyncRead(LONGLONG llPosition, LONG lLength, BYTE* pBuffer);
+ STDMETHODIMP Length(LONGLONG* pTotal, LONGLONG* pAvailable);
+ STDMETHODIMP BeginFlush() {return E_NOTIMPL;}
+ STDMETHODIMP EndFlush() {return E_NOTIMPL;}
+
+ // ISyncReader
+
+ STDMETHODIMP_(void) SetBreakEvent(HANDLE hBreakEvent) {m_hBreakEvent = hBreakEvent;}
+ STDMETHODIMP_(bool) HasErrors() {return m_lOsError != 0;}
+ STDMETHODIMP_(void) ClearErrors() {m_lOsError = 0;}
+
+ // IFileHandle
+
+ STDMETHODIMP_(HANDLE) GetFileHandle();
+
+};
+
+class CAsyncUrlReader : public CAsyncFileReader, protected CAMThread
+{
+ CString m_url, m_fn;
+
+protected:
+ enum {CMD_EXIT, CMD_INIT};
+ DWORD ThreadProc();
+
+public:
+ CAsyncUrlReader(CString url, HRESULT& hr);
+ virtual ~CAsyncUrlReader();
+
+ // IAsyncReader
+
+ STDMETHODIMP Length(LONGLONG* pTotal, LONGLONG* pAvailable);
+};
diff --git a/src/filters/parser/basesplitter/BaseSplitter.cpp b/src/filters/parser/basesplitter/BaseSplitter.cpp
new file mode 100644
index 000000000..f2de7b265
--- /dev/null
+++ b/src/filters/parser/basesplitter/BaseSplitter.cpp
@@ -0,0 +1,1412 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+#include "..\..\switcher\AudioSwitcher\AudioSwitcher.h"
+#include "BaseSplitter.h"
+
+#pragma warning(disable: 4355)
+
+#define MINPACKETS 10
+#define MINPACKETSIZE 100*1024
+#define MAXPACKETS 10000
+#define MAXPACKETSIZE 1024*1024*5
+
+//
+// CPacketQueue
+//
+
+CPacketQueue::CPacketQueue() : m_size(0)
+{
+}
+
+void CPacketQueue::Add(CAutoPtr<Packet> p)
+{
+ CAutoLock cAutoLock(this);
+
+ if(p)
+ {
+ m_size += p->GetDataSize();
+
+ if(p->bAppendable && !p->bDiscontinuity && !p->pmt
+ && p->rtStart == Packet::INVALID_TIME
+ && !IsEmpty() && GetTail()->rtStart != Packet::INVALID_TIME)
+ {
+ /*
+ Packet* tail = GetTail();
+ int oldsize = tail->GetCount();
+ int newsize = tail->GetCount() + p->GetCount();
+ tail->SetCount(newsize, max(1024, newsize)); // doubles the reserved buffer size
+ memcpy(tail->GetData() + oldsize, p->GetData(), p->GetCount());
+ */
+ GetTail()->Append(*p);
+ return;
+ }
+ }
+
+ AddTail(p);
+}
+
+CAutoPtr<Packet> CPacketQueue::Remove()
+{
+ CAutoLock cAutoLock(this);
+ ASSERT(__super::GetCount() > 0);
+ CAutoPtr<Packet> p = RemoveHead();
+ if(p) m_size -= p->GetDataSize();
+ return p;
+}
+
+void CPacketQueue::RemoveAll()
+{
+ CAutoLock cAutoLock(this);
+ m_size = 0;
+ __super::RemoveAll();
+}
+
+int CPacketQueue::GetCount()
+{
+ CAutoLock cAutoLock(this);
+ return __super::GetCount();
+}
+
+int CPacketQueue::GetSize()
+{
+ CAutoLock cAutoLock(this);
+ return m_size;
+}
+
+//
+// CBaseSplitterInputPin
+//
+
+CBaseSplitterInputPin::CBaseSplitterInputPin(TCHAR* pName, CBaseSplitterFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBasePin(pName, pFilter, pLock, phr, L"Input", PINDIR_INPUT)
+{
+}
+
+CBaseSplitterInputPin::~CBaseSplitterInputPin()
+{
+}
+
+HRESULT CBaseSplitterInputPin::GetAsyncReader(IAsyncReader** ppAsyncReader)
+{
+ CheckPointer(ppAsyncReader, E_POINTER);
+ *ppAsyncReader = NULL;
+ CheckPointer(m_pAsyncReader, VFW_E_NOT_CONNECTED);
+ (*ppAsyncReader = m_pAsyncReader)->AddRef();
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CBaseSplitterInputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return S_OK;
+/*
+ return pmt->majortype == MEDIATYPE_Stream
+ ? S_OK
+ : E_INVALIDARG;
+*/
+}
+
+HRESULT CBaseSplitterInputPin::CheckConnect(IPin* pPin)
+{
+ HRESULT hr;
+ if(FAILED(hr = __super::CheckConnect(pPin)))
+ return hr;
+
+ return CComQIPtr<IAsyncReader>(pPin) ? S_OK : E_NOINTERFACE;
+}
+
+HRESULT CBaseSplitterInputPin::BreakConnect()
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::BreakConnect()))
+ return hr;
+
+ if(FAILED(hr = ((CBaseSplitterFilter*)m_pFilter)->BreakConnect(PINDIR_INPUT, this)))
+ return hr;
+
+ m_pAsyncReader.Release();
+
+ return S_OK;
+}
+
+HRESULT CBaseSplitterInputPin::CompleteConnect(IPin* pPin)
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::CompleteConnect(pPin)))
+ return hr;
+
+ CheckPointer(pPin, E_POINTER);
+ m_pAsyncReader = pPin;
+ CheckPointer(m_pAsyncReader, E_NOINTERFACE);
+
+ if(FAILED(hr = ((CBaseSplitterFilter*)m_pFilter)->CompleteConnect(PINDIR_INPUT, this)))
+ return hr;
+
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterInputPin::BeginFlush()
+{
+ return E_UNEXPECTED;
+}
+
+STDMETHODIMP CBaseSplitterInputPin::EndFlush()
+{
+ return E_UNEXPECTED;
+}
+
+//
+// CBaseSplitterOutputPin
+//
+
+CBaseSplitterOutputPin::CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers)
+ : CBaseOutputPin(NAME("CBaseSplitterOutputPin"), pFilter, pLock, phr, pName)
+ , m_hrDeliver(S_OK) // just in case it were asked before the worker thread could be created and reset it
+ , m_fFlushing(false)
+ , m_eEndFlush(TRUE)
+{
+ m_mts.Copy(mts);
+ m_nBuffers = max(nBuffers, 1);
+ memset(&m_brs, 0, sizeof(m_brs));
+ m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
+}
+
+CBaseSplitterOutputPin::CBaseSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers)
+ : CBaseOutputPin(NAME("CBaseSplitterOutputPin"), pFilter, pLock, phr, pName)
+ , m_hrDeliver(S_OK) // just in case it were asked before the worker thread could be created and reset it
+ , m_fFlushing(false)
+ , m_eEndFlush(TRUE)
+{
+ m_nBuffers = max(nBuffers, 1);
+ memset(&m_brs, 0, sizeof(m_brs));
+ m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
+}
+
+CBaseSplitterOutputPin::~CBaseSplitterOutputPin()
+{
+}
+
+STDMETHODIMP CBaseSplitterOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+// riid == __uuidof(IMediaSeeking) ? m_pFilter->QueryInterface(riid, ppv) :
+ QI(IMediaSeeking)
+ QI(IPropertyBag)
+ QI(IPropertyBag2)
+ QI(IDSMPropertyBag)
+ QI(IBitRateInfo)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CBaseSplitterOutputPin::SetName(LPCWSTR pName)
+{
+ CheckPointer(pName, E_POINTER);
+ if(m_pName) delete [] m_pName;
+ m_pName = new WCHAR[wcslen(pName)+1];
+ CheckPointer(m_pName, E_OUTOFMEMORY);
+ wcscpy(m_pName, pName);
+ return S_OK;
+}
+
+HRESULT CBaseSplitterOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ pProperties->cBuffers = m_nBuffers;
+ pProperties->cbBuffer = max(m_mt.lSampleSize, 1);
+
+ if(m_mt.subtype == MEDIASUBTYPE_Vorbis && m_mt.formattype == FORMAT_VorbisFormat)
+ {
+ // oh great, the oggds vorbis decoder assumes there will be two at least, stupid thing...
+ pProperties->cBuffers = max(pProperties->cBuffers, 2);
+ }
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
+
+ return NOERROR;
+}
+
+HRESULT CBaseSplitterOutputPin::CheckMediaType(const CMediaType* pmt)
+{
+ for(int i = 0; i < m_mts.GetCount(); i++)
+ {
+ if(*pmt == m_mts[i])
+ return S_OK;
+ }
+
+ return E_INVALIDARG;
+}
+
+HRESULT CBaseSplitterOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ CAutoLock cAutoLock(m_pLock);
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= m_mts.GetCount()) return VFW_S_NO_MORE_ITEMS;
+
+ *pmt = m_mts[iPosition];
+
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterOutputPin::Notify(IBaseFilter* pSender, Quality q)
+{
+ return E_NOTIMPL;
+}
+
+//
+
+HRESULT CBaseSplitterOutputPin::Active()
+{
+ CAutoLock cAutoLock(m_pLock);
+
+ if(m_Connected)
+ Create();
+
+ return __super::Active();
+}
+
+HRESULT CBaseSplitterOutputPin::Inactive()
+{
+ CAutoLock cAutoLock(m_pLock);
+
+ if(ThreadExists())
+ CallWorker(CMD_EXIT);
+
+ return __super::Inactive();
+}
+
+HRESULT CBaseSplitterOutputPin::DeliverBeginFlush()
+{
+ m_eEndFlush.Reset();
+ m_fFlushed = false;
+ m_fFlushing = true;
+ m_hrDeliver = S_FALSE;
+ m_queue.RemoveAll();
+ HRESULT hr = IsConnected() ? GetConnected()->BeginFlush() : S_OK;
+ if(S_OK != hr) m_eEndFlush.Set();
+ return(hr);
+}
+
+HRESULT CBaseSplitterOutputPin::DeliverEndFlush()
+{
+ if(!ThreadExists()) return S_FALSE;
+ HRESULT hr = IsConnected() ? GetConnected()->EndFlush() : S_OK;
+ m_hrDeliver = S_OK;
+ m_fFlushing = false;
+ m_fFlushed = true;
+ m_eEndFlush.Set();
+ return hr;
+}
+
+HRESULT CBaseSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ m_brs.rtLastDeliverTime = Packet::INVALID_TIME;
+ if(m_fFlushing) return S_FALSE;
+ m_rtStart = tStart;
+ if(!ThreadExists()) return S_FALSE;
+ HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
+ if(S_OK != hr) return hr;
+ MakeISCRHappy();
+ return hr;
+}
+
+int CBaseSplitterOutputPin::QueueCount()
+{
+ return m_queue.GetCount();
+}
+
+int CBaseSplitterOutputPin::QueueSize()
+{
+ return m_queue.GetSize();
+}
+
+HRESULT CBaseSplitterOutputPin::QueueEndOfStream()
+{
+ return QueuePacket(CAutoPtr<Packet>()); // NULL means EndOfStream
+}
+
+HRESULT CBaseSplitterOutputPin::QueuePacket(CAutoPtr<Packet> p)
+{
+ if(!ThreadExists()) return S_FALSE;
+
+ while(S_OK == m_hrDeliver
+ && (!((CBaseSplitterFilter*)m_pFilter)->IsAnyPinDrying()
+ || m_queue.GetSize() > MAXPACKETSIZE*100))
+ Sleep(1);
+
+ if(S_OK != m_hrDeliver)
+ return m_hrDeliver;
+
+ m_queue.Add(p);
+
+ return m_hrDeliver;
+}
+
+bool CBaseSplitterOutputPin::IsDiscontinuous()
+{
+ return m_mt.majortype == MEDIATYPE_Text
+ || m_mt.majortype == MEDIATYPE_ScriptCommand
+ || m_mt.majortype == MEDIATYPE_Subtitle
+ || m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE
+ || m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE
+ || m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE;
+}
+
+bool CBaseSplitterOutputPin::IsActive()
+{
+ CComPtr<IPin> pPin = this;
+ do
+ {
+ CComPtr<IPin> pPinTo;
+ CComQIPtr<IStreamSwitcherInputPin> pSSIP;
+ if(S_OK == pPin->ConnectedTo(&pPinTo) && (pSSIP = pPinTo) && !pSSIP->IsActive())
+ return(false);
+ pPin = GetFirstPin(GetFilterFromPin(pPinTo), PINDIR_OUTPUT);
+ }
+ while(pPin);
+
+ return(true);
+}
+
+DWORD CBaseSplitterOutputPin::ThreadProc()
+{
+ m_hrDeliver = S_OK;
+ m_fFlushing = m_fFlushed = false;
+ m_eEndFlush.Set();
+
+ while(1)
+ {
+ Sleep(1);
+
+ DWORD cmd;
+ if(CheckRequest(&cmd))
+ {
+ m_hThread = NULL;
+ cmd = GetRequest();
+ Reply(S_OK);
+ ASSERT(cmd == CMD_EXIT);
+ return 0;
+ }
+
+ int cnt = 0;
+ do
+ {
+ CAutoPtr<Packet> p;
+
+ {
+ CAutoLock cAutoLock(&m_queue);
+ if((cnt = m_queue.GetCount()) > 0)
+ p = m_queue.Remove();
+ }
+
+ if(S_OK == m_hrDeliver && cnt > 0)
+ {
+ ASSERT(!m_fFlushing);
+
+ m_fFlushed = false;
+
+ // flushing can still start here, to release a blocked deliver call
+
+ HRESULT hr = p
+ ? DeliverPacket(p)
+ : DeliverEndOfStream();
+
+ m_eEndFlush.Wait(); // .. so we have to wait until it is done
+
+ if(hr != S_OK && !m_fFlushed) // and only report the error in m_hrDeliver if we didn't flush the stream
+ {
+ // CAutoLock cAutoLock(&m_csQueueLock);
+ m_hrDeliver = hr;
+ break;
+ }
+ }
+ }
+ while(--cnt > 0);
+ }
+}
+
+HRESULT CBaseSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
+{
+ HRESULT hr;
+
+ INT_PTR nBytes = p->GetCount();
+
+ if(nBytes == 0)
+ {
+ return S_OK;
+ }
+
+ m_brs.nBytesSinceLastDeliverTime += nBytes;
+
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ if(m_brs.rtLastDeliverTime == Packet::INVALID_TIME)
+ {
+ m_brs.rtLastDeliverTime = p->rtStart;
+ m_brs.nBytesSinceLastDeliverTime = 0;
+ }
+
+ if(m_brs.rtLastDeliverTime + 10000000 < p->rtStart)
+ {
+ REFERENCE_TIME rtDiff = p->rtStart - m_brs.rtLastDeliverTime;
+
+ double secs, bits;
+
+ secs = (double)rtDiff / 10000000;
+ bits = 8.0 * m_brs.nBytesSinceLastDeliverTime;
+ m_brs.nCurrentBitRate = (DWORD)(bits / secs);
+
+ m_brs.rtTotalTimeDelivered += rtDiff;
+ m_brs.nTotalBytesDelivered += m_brs.nBytesSinceLastDeliverTime;
+
+ secs = (double)m_brs.rtTotalTimeDelivered / 10000000;
+ bits = 8.0 * m_brs.nTotalBytesDelivered;
+ m_brs.nAverageBitRate = (DWORD)(bits / secs);
+
+ m_brs.rtLastDeliverTime = p->rtStart;
+ m_brs.nBytesSinceLastDeliverTime = 0;
+/*
+ TRACE(_T("[%d] c: %d kbps, a: %d kbps\n"),
+ p->TrackNumber,
+ (m_brs.nCurrentBitRate+500)/1000,
+ (m_brs.nAverageBitRate+500)/1000);
+*/
+ }
+
+ double dRate = 1.0;
+ if(SUCCEEDED(((CBaseSplitterFilter*)m_pFilter)->GetRate(&dRate)))
+ {
+ p->rtStart = (REFERENCE_TIME)((double)p->rtStart / dRate);
+ p->rtStop = (REFERENCE_TIME)((double)p->rtStop / dRate);
+ }
+ }
+
+ do
+ {
+ CComPtr<IMediaSample> pSample;
+ if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) break;
+
+ if(nBytes > pSample->GetSize())
+ {
+ pSample.Release();
+
+ ALLOCATOR_PROPERTIES props, actual;
+ if(S_OK != (hr = m_pAllocator->GetProperties(&props))) break;
+ props.cbBuffer = nBytes*3/2;
+
+ if(props.cBuffers > 1)
+ {
+ if(S_OK != (hr = __super::DeliverBeginFlush())) break;
+ if(S_OK != (hr = __super::DeliverEndFlush())) break;
+ }
+
+ if(S_OK != (hr = m_pAllocator->Decommit())) break;
+ if(S_OK != (hr = m_pAllocator->SetProperties(&props, &actual))) break;
+ if(S_OK != (hr = m_pAllocator->Commit())) break;
+ if(S_OK != (hr = GetDeliveryBuffer(&pSample, NULL, NULL, 0))) break;
+ }
+
+ if(p->pmt)
+ {
+ pSample->SetMediaType(p->pmt);
+ p->bDiscontinuity = true;
+
+ CAutoLock cAutoLock(m_pLock);
+ m_mts.RemoveAll();
+ m_mts.Add(*p->pmt);
+ }
+
+ bool fTimeValid = p->rtStart != Packet::INVALID_TIME;
+
+//if(p->TrackNumber == 1)
+//if(p->rtStart != Packet::INVALID_TIME)
+TRACE(_T("[%d]: d%d s%d p%d, b=%d, %I64d-%I64d \n"),
+ p->TrackNumber,
+ p->bDiscontinuity, p->bSyncPoint, fTimeValid && p->rtStart < 0,
+ nBytes, p->rtStart, p->rtStop);
+/**/
+ ASSERT(!p->bSyncPoint || fTimeValid);
+
+ BYTE* pData = NULL;
+ if(S_OK != (hr = pSample->GetPointer(&pData)) || !pData) break;
+ memcpy(pData, p->GetData(), nBytes);
+ if(S_OK != (hr = pSample->SetActualDataLength(nBytes))) break;
+ if(S_OK != (hr = pSample->SetTime(fTimeValid ? &p->rtStart : NULL, fTimeValid ? &p->rtStop : NULL))) break;
+ if(S_OK != (hr = pSample->SetMediaTime(NULL, NULL))) break;
+ if(S_OK != (hr = pSample->SetDiscontinuity(p->bDiscontinuity))) break;
+ if(S_OK != (hr = pSample->SetSyncPoint(p->bSyncPoint))) break;
+ if(S_OK != (hr = pSample->SetPreroll(fTimeValid && p->rtStart < 0))) break;
+ if(S_OK != (hr = Deliver(pSample))) break;
+ }
+ while(false);
+
+ return hr;
+}
+
+void CBaseSplitterOutputPin::MakeISCRHappy()
+{
+ CComPtr<IPin> pPinTo = this, pTmp;
+ while(pPinTo && SUCCEEDED(pPinTo->ConnectedTo(&pTmp)) && (pPinTo = pTmp))
+ {
+ pTmp = NULL;
+
+ CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPinTo);
+
+ if(GetCLSID(pBF) == GUIDFromCString(_T("{48025243-2D39-11CE-875D-00608CB78066}"))) // ISCR
+ {
+ CAutoPtr<Packet> p(new Packet());
+ p->TrackNumber = (DWORD)-1;
+ p->rtStart = -1; p->rtStop = 0;
+ p->bSyncPoint = FALSE;
+ p->SetData(" ", 2);
+ QueuePacket(p);
+ break;
+ }
+
+ pPinTo = GetFirstPin(pBF, PINDIR_OUTPUT);
+ }
+}
+
+HRESULT CBaseSplitterOutputPin::GetDeliveryBuffer(IMediaSample** ppSample, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags)
+{
+ return __super::GetDeliveryBuffer(ppSample, pStartTime, pEndTime, dwFlags);
+}
+
+HRESULT CBaseSplitterOutputPin::Deliver(IMediaSample* pSample)
+{
+ return __super::Deliver(pSample);
+}
+
+// IMediaSeeking
+
+STDMETHODIMP CBaseSplitterOutputPin::GetCapabilities(DWORD* pCapabilities)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->GetCapabilities(pCapabilities);
+}
+STDMETHODIMP CBaseSplitterOutputPin::CheckCapabilities(DWORD* pCapabilities)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->CheckCapabilities(pCapabilities);
+}
+STDMETHODIMP CBaseSplitterOutputPin::IsFormatSupported(const GUID* pFormat)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->IsFormatSupported(pFormat);
+}
+STDMETHODIMP CBaseSplitterOutputPin::QueryPreferredFormat(GUID* pFormat)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->QueryPreferredFormat(pFormat);
+}
+STDMETHODIMP CBaseSplitterOutputPin::GetTimeFormat(GUID* pFormat)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->GetTimeFormat(pFormat);
+}
+STDMETHODIMP CBaseSplitterOutputPin::IsUsingTimeFormat(const GUID* pFormat)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->IsUsingTimeFormat(pFormat);
+}
+STDMETHODIMP CBaseSplitterOutputPin::SetTimeFormat(const GUID* pFormat)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->SetTimeFormat(pFormat);
+}
+STDMETHODIMP CBaseSplitterOutputPin::GetDuration(LONGLONG* pDuration)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->GetDuration(pDuration);
+}
+STDMETHODIMP CBaseSplitterOutputPin::GetStopPosition(LONGLONG* pStop)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->GetStopPosition(pStop);
+}
+STDMETHODIMP CBaseSplitterOutputPin::GetCurrentPosition(LONGLONG* pCurrent)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->GetCurrentPosition(pCurrent);
+}
+STDMETHODIMP CBaseSplitterOutputPin::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat);
+}
+STDMETHODIMP CBaseSplitterOutputPin::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->SetPositionsInternal(this, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+}
+STDMETHODIMP CBaseSplitterOutputPin::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->GetPositions(pCurrent, pStop);
+}
+STDMETHODIMP CBaseSplitterOutputPin::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->GetAvailable(pEarliest, pLatest);
+}
+STDMETHODIMP CBaseSplitterOutputPin::SetRate(double dRate)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->SetRate(dRate);
+}
+STDMETHODIMP CBaseSplitterOutputPin::GetRate(double* pdRate)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->GetRate(pdRate);
+}
+STDMETHODIMP CBaseSplitterOutputPin::GetPreroll(LONGLONG* pllPreroll)
+{
+ return ((CBaseSplitterFilter*)m_pFilter)->GetPreroll(pllPreroll);
+}
+
+//
+// CBaseSplitterFilter
+//
+
+CBaseSplitterFilter::CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
+ : CBaseFilter(pName, pUnk, this, clsid)
+ , m_rtDuration(0), m_rtStart(0), m_rtStop(0), m_rtCurrent(0)
+ , m_dRate(1.0)
+ , m_nOpenProgress(100)
+ , m_fAbort(false)
+ , m_rtLastStart(_I64_MIN)
+ , m_rtLastStop(_I64_MIN)
+ , m_priority(THREAD_PRIORITY_NORMAL)
+{
+ if(phr) *phr = S_OK;
+
+ m_pInput.Attach(new CBaseSplitterInputPin(NAME("CBaseSplitterInputPin"), this, this, phr));
+}
+
+CBaseSplitterFilter::~CBaseSplitterFilter()
+{
+ CAutoLock cAutoLock(this);
+
+ CAMThread::CallWorker(CMD_EXIT);
+ CAMThread::Close();
+}
+
+STDMETHODIMP CBaseSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ *ppv = NULL;
+
+ if(m_pInput && riid == __uuidof(IFileSourceFilter))
+ return E_NOINTERFACE;
+
+ return
+ QI(IFileSourceFilter)
+ QI(IMediaSeeking)
+ QI(IAMOpenProgress)
+ QI2(IAMMediaContent)
+ QI2(IAMExtendedSeeking)
+ QI(IKeyFrameInfo)
+ QI(IBufferInfo)
+ QI(IPropertyBag)
+ QI(IPropertyBag2)
+ QI(IDSMPropertyBag)
+ QI(IDSMResourceBag)
+ QI(IDSMChapterBag)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+CBaseSplitterOutputPin* CBaseSplitterFilter::GetOutputPin(DWORD TrackNum)
+{
+ CAutoLock cAutoLock(&m_csPinMap);
+
+ CBaseSplitterOutputPin* pPin = NULL;
+ m_pPinMap.Lookup(TrackNum, pPin);
+ return pPin;
+}
+
+DWORD CBaseSplitterFilter::GetOutputTrackNum(CBaseSplitterOutputPin* pPin)
+{
+ CAutoLock cAutoLock(&m_csPinMap);
+
+ POSITION pos = m_pPinMap.GetStartPosition();
+ while(pos)
+ {
+ DWORD TrackNum;
+ CBaseSplitterOutputPin* pPinTmp;
+ m_pPinMap.GetNextAssoc(pos, TrackNum, pPinTmp);
+ if(pPinTmp == pPin) return TrackNum;
+ }
+
+ return (DWORD)-1;
+}
+
+HRESULT CBaseSplitterFilter::RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDst, const AM_MEDIA_TYPE* pmt)
+{
+ CAutoLock cAutoLock(&m_csPinMap);
+
+ CBaseSplitterOutputPin* pPin;
+ if(m_pPinMap.Lookup(TrackNumSrc, pPin))
+ {
+ if(CComQIPtr<IPin> pPinTo = pPin->GetConnected())
+ {
+ if(pmt && S_OK != pPinTo->QueryAccept(pmt))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ m_pPinMap.RemoveKey(TrackNumSrc);
+ m_pPinMap[TrackNumDst] = pPin;
+
+ if(pmt)
+ {
+ CAutoLock cAutoLock(&m_csmtnew);
+ m_mtnew[TrackNumDst] = *pmt;
+ }
+
+ return S_OK;
+ }
+
+ return E_FAIL;
+}
+
+HRESULT CBaseSplitterFilter::AddOutputPin(DWORD TrackNum, CAutoPtr<CBaseSplitterOutputPin> pPin)
+{
+ CAutoLock cAutoLock(&m_csPinMap);
+
+ if(!pPin) return E_INVALIDARG;
+ m_pPinMap[TrackNum] = pPin;
+ m_pOutputs.AddTail(pPin);
+ return S_OK;
+}
+
+HRESULT CBaseSplitterFilter::DeleteOutputs()
+{
+ m_rtDuration = 0;
+
+ m_pRetiredOutputs.RemoveAll();
+
+ CAutoLock cAutoLockF(this);
+ if(m_State != State_Stopped) return VFW_E_NOT_STOPPED;
+
+ while(m_pOutputs.GetCount())
+ {
+ CAutoPtr<CBaseSplitterOutputPin> pPin = m_pOutputs.RemoveHead();
+ if(IPin* pPinTo = pPin->GetConnected()) pPinTo->Disconnect();
+ pPin->Disconnect();
+ // we can't just let it be deleted now, something might have AddRefed on it (graphedit...)
+ m_pRetiredOutputs.AddTail(pPin);
+ }
+
+ CAutoLock cAutoLockPM(&m_csPinMap);
+ m_pPinMap.RemoveAll();
+
+ CAutoLock cAutoLockMT(&m_csmtnew);
+ m_mtnew.RemoveAll();
+
+ RemoveAll();
+ ResRemoveAll();
+ ChapRemoveAll();
+
+ m_fontinst.UninstallFonts();
+
+ m_pSyncReader.Release();
+
+ return S_OK;
+}
+
+void CBaseSplitterFilter::DeliverBeginFlush()
+{
+ m_fFlushing = true;
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos) m_pOutputs.GetNext(pos)->DeliverBeginFlush();
+}
+
+void CBaseSplitterFilter::DeliverEndFlush()
+{
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos) m_pOutputs.GetNext(pos)->DeliverEndFlush();
+ m_fFlushing = false;
+ m_eEndFlush.Set();
+}
+
+DWORD CBaseSplitterFilter::ThreadProc()
+{
+ if(m_pSyncReader)
+ m_pSyncReader->SetBreakEvent(GetRequestHandle());
+
+ if(!DemuxInit())
+ {
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+ if(cmd == CMD_EXIT) CAMThread::m_hThread = NULL;
+ Reply(S_OK);
+ if(cmd == CMD_EXIT) return 0;
+ }
+ }
+
+ m_eEndFlush.Set();
+ m_fFlushing = false;
+
+ for(DWORD cmd = -1; ; cmd = GetRequest())
+ {
+ if(cmd == CMD_EXIT)
+ {
+ m_hThread = NULL;
+ Reply(S_OK);
+ return 0;
+ }
+
+ SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_NORMAL);
+
+ m_rtStart = m_rtNewStart;
+ m_rtStop = m_rtNewStop;
+
+ DemuxSeek(m_rtStart);
+
+ if(cmd != -1)
+ Reply(S_OK);
+
+ m_eEndFlush.Wait();
+
+ m_pActivePins.RemoveAll();
+
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos && !m_fFlushing)
+ {
+ CBaseSplitterOutputPin* pPin = m_pOutputs.GetNext(pos);
+ if(pPin->IsConnected() && pPin->IsActive())
+ {
+ m_pActivePins.AddTail(pPin);
+ pPin->DeliverNewSegment(m_rtStart, m_rtStop, m_dRate);
+ }
+ }
+
+ do {m_bDiscontinuitySent.RemoveAll();}
+ while(!DemuxLoop());
+
+ pos = m_pActivePins.GetHeadPosition();
+ while(pos && !CheckRequest(&cmd))
+ m_pActivePins.GetNext(pos)->QueueEndOfStream();
+ }
+
+ ASSERT(0); // we should only exit via CMD_EXIT
+
+ m_hThread = NULL;
+ return 0;
+}
+
+HRESULT CBaseSplitterFilter::DeliverPacket(CAutoPtr<Packet> p)
+{
+ HRESULT hr = S_FALSE;
+
+ CBaseSplitterOutputPin* pPin = GetOutputPin(p->TrackNumber);
+ if(!pPin || !pPin->IsConnected() || !m_pActivePins.Find(pPin))
+ return S_FALSE;
+
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ m_rtCurrent = p->rtStart;
+
+ p->rtStart -= m_rtStart;
+ p->rtStop -= m_rtStart;
+
+ ASSERT(p->rtStart <= p->rtStop);
+ }
+
+ {
+ CAutoLock cAutoLock(&m_csmtnew);
+
+ CMediaType mt;
+ if(m_mtnew.Lookup(p->TrackNumber, mt))
+ {
+ p->pmt = CreateMediaType(&mt);
+ m_mtnew.RemoveKey(p->TrackNumber);
+ }
+ }
+
+ if(!m_bDiscontinuitySent.Find(p->TrackNumber))
+ p->bDiscontinuity = TRUE;
+
+ DWORD TrackNumber = p->TrackNumber;
+ BOOL bDiscontinuity = p->bDiscontinuity;
+/*
+//if(p->TrackNumber == 1)
+//if(p->rtStart != Packet::INVALID_TIME)
+TRACE(_T("[%d]: d%d s%d p%d, b=%d, %I64d-%I64d \n"),
+ p->TrackNumber,
+ p->bDiscontinuity, p->bSyncPoint, p->rtStart != Packet::INVALID_TIME && p->rtStart < 0,
+ p->GetCount(), p->rtStart, p->rtStop);
+*/
+
+ hr = pPin->QueuePacket(p);
+
+ if(S_OK != hr)
+ {
+ if(POSITION pos = m_pActivePins.Find(pPin))
+ m_pActivePins.RemoveAt(pos);
+
+ if(!m_pActivePins.IsEmpty()) // only die when all pins are down
+ hr = S_OK;
+
+ return hr;
+ }
+
+ if(bDiscontinuity)
+ m_bDiscontinuitySent.AddTail(TrackNumber);
+
+ return hr;
+}
+
+bool CBaseSplitterFilter::IsAnyPinDrying()
+{
+ int totalcount = 0, totalsize = 0;
+
+ POSITION pos = m_pActivePins.GetHeadPosition();
+ while(pos)
+ {
+ CBaseSplitterOutputPin* pPin = m_pActivePins.GetNext(pos);
+ int count = pPin->QueueCount();
+ int size = pPin->QueueSize();
+ if(!pPin->IsDiscontinuous() && (count < MINPACKETS || size < MINPACKETSIZE))
+ {
+// if(m_priority != THREAD_PRIORITY_ABOVE_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3))
+ if(m_priority != THREAD_PRIORITY_BELOW_NORMAL && (count < MINPACKETS/3 || size < MINPACKETSIZE/3))
+ {
+ // SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_ABOVE_NORMAL);
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos) m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
+ m_priority = THREAD_PRIORITY_BELOW_NORMAL;
+ }
+ return(true);
+ }
+ totalcount += count;
+ totalsize += size;
+ }
+
+ if(m_priority != THREAD_PRIORITY_NORMAL && (totalcount > MAXPACKETS*2/3 || totalsize > MAXPACKETSIZE*2/3))
+ {
+// SetThreadPriority(m_hThread, m_priority = THREAD_PRIORITY_NORMAL);
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos) m_pOutputs.GetNext(pos)->SetThreadPriority(THREAD_PRIORITY_NORMAL);
+ m_priority = THREAD_PRIORITY_NORMAL;
+ }
+
+ if(totalcount < MAXPACKETS && totalsize < MAXPACKETSIZE)
+ return(true);
+
+ return(false);
+}
+
+HRESULT CBaseSplitterFilter::BreakConnect(PIN_DIRECTION dir, CBasePin* pPin)
+{
+ CheckPointer(pPin, E_POINTER);
+
+ if(dir == PINDIR_INPUT)
+ {
+ DeleteOutputs();
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ }
+ else
+ {
+ return E_UNEXPECTED;
+ }
+
+ return S_OK;
+}
+
+HRESULT CBaseSplitterFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin)
+{
+ CheckPointer(pPin, E_POINTER);
+
+ if(dir == PINDIR_INPUT)
+ {
+ CBaseSplitterInputPin* pIn = (CBaseSplitterInputPin*)pPin;
+
+ HRESULT hr;
+
+ CComPtr<IAsyncReader> pAsyncReader;
+ if(FAILED(hr = pIn->GetAsyncReader(&pAsyncReader))
+ || FAILED(hr = DeleteOutputs())
+ || FAILED(hr = CreateOutputs(pAsyncReader)))
+ return hr;
+
+ ChapSort();
+
+ m_pSyncReader = pAsyncReader;
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ m_pRetiredOutputs.RemoveAll();
+ }
+ else
+ {
+ return E_UNEXPECTED;
+ }
+
+ return S_OK;
+}
+
+int CBaseSplitterFilter::GetPinCount()
+{
+ return (m_pInput ? 1 : 0) + m_pOutputs.GetCount();
+}
+
+CBasePin* CBaseSplitterFilter::GetPin(int n)
+{
+ CAutoLock cAutoLock(this);
+
+ if(n >= 0 && n < (int)m_pOutputs.GetCount())
+ {
+ if(POSITION pos = m_pOutputs.FindIndex(n))
+ return m_pOutputs.GetAt(pos);
+ }
+
+ if(n == m_pOutputs.GetCount() && m_pInput)
+ {
+ return m_pInput;
+ }
+
+ return NULL;
+}
+
+STDMETHODIMP CBaseSplitterFilter::Stop()
+{
+ CAutoLock cAutoLock(this);
+
+ DeliverBeginFlush();
+ CallWorker(CMD_EXIT);
+ DeliverEndFlush();
+
+ HRESULT hr;
+ if(FAILED(hr = __super::Stop()))
+ return hr;
+
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterFilter::Pause()
+{
+ CAutoLock cAutoLock(this);
+
+ FILTER_STATE fs = m_State;
+
+ HRESULT hr;
+ if(FAILED(hr = __super::Pause()))
+ return hr;
+
+ if(fs == State_Stopped)
+ {
+ Create();
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterFilter::Run(REFERENCE_TIME tStart)
+{
+ CAutoLock cAutoLock(this);
+
+ HRESULT hr;
+ if(FAILED(hr = __super::Run(tStart)))
+ return hr;
+
+ return S_OK;
+}
+
+// IFileSourceFilter
+
+STDMETHODIMP CBaseSplitterFilter::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+{
+ CheckPointer(pszFileName, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+ CComPtr<IAsyncReader> pAsyncReader = (IAsyncReader*)new CAsyncFileReader(CString(pszFileName), hr);
+ if(FAILED(hr)
+ || FAILED(hr = DeleteOutputs())
+ || FAILED(hr = CreateOutputs(pAsyncReader)))
+ return hr;
+
+ ChapSort();
+
+ m_fn = pszFileName;
+ m_pSyncReader = pAsyncReader;
+
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterFilter::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+{
+ CheckPointer(ppszFileName, E_POINTER);
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+ wcscpy(*ppszFileName, m_fn);
+ return S_OK;
+}
+
+// IMediaSeeking
+
+STDMETHODIMP CBaseSplitterFilter::GetCapabilities(DWORD* pCapabilities)
+{
+ return pCapabilities ? *pCapabilities =
+ AM_SEEKING_CanGetStopPos|
+ AM_SEEKING_CanGetDuration|
+ AM_SEEKING_CanSeekAbsolute|
+ AM_SEEKING_CanSeekForwards|
+ AM_SEEKING_CanSeekBackwards, S_OK : E_POINTER;
+}
+STDMETHODIMP CBaseSplitterFilter::CheckCapabilities(DWORD* pCapabilities)
+{
+ CheckPointer(pCapabilities, E_POINTER);
+ if(*pCapabilities == 0) return S_OK;
+ DWORD caps;
+ GetCapabilities(&caps);
+ if((caps&*pCapabilities) == 0) return E_FAIL;
+ if(caps == *pCapabilities) return S_OK;
+ return S_FALSE;
+}
+STDMETHODIMP CBaseSplitterFilter::IsFormatSupported(const GUID* pFormat) {return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;}
+STDMETHODIMP CBaseSplitterFilter::QueryPreferredFormat(GUID* pFormat) {return GetTimeFormat(pFormat);}
+STDMETHODIMP CBaseSplitterFilter::GetTimeFormat(GUID* pFormat) {return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;}
+STDMETHODIMP CBaseSplitterFilter::IsUsingTimeFormat(const GUID* pFormat) {return IsFormatSupported(pFormat);}
+STDMETHODIMP CBaseSplitterFilter::SetTimeFormat(const GUID* pFormat) {return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;}
+STDMETHODIMP CBaseSplitterFilter::GetDuration(LONGLONG* pDuration) {CheckPointer(pDuration, E_POINTER); *pDuration = m_rtDuration; return S_OK;}
+STDMETHODIMP CBaseSplitterFilter::GetStopPosition(LONGLONG* pStop) {return GetDuration(pStop);}
+STDMETHODIMP CBaseSplitterFilter::GetCurrentPosition(LONGLONG* pCurrent) {return E_NOTIMPL;}
+STDMETHODIMP CBaseSplitterFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
+STDMETHODIMP CBaseSplitterFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
+{
+ return SetPositionsInternal(this, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
+}
+STDMETHODIMP CBaseSplitterFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
+{
+ if(pCurrent) *pCurrent = m_rtCurrent;
+ if(pStop) *pStop = m_rtStop;
+ return S_OK;
+}
+STDMETHODIMP CBaseSplitterFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
+{
+ if(pEarliest) *pEarliest = 0;
+ return GetDuration(pLatest);
+}
+STDMETHODIMP CBaseSplitterFilter::SetRate(double dRate) {return dRate > 0 ? m_dRate = dRate, S_OK : E_INVALIDARG;}
+STDMETHODIMP CBaseSplitterFilter::GetRate(double* pdRate) {return pdRate ? *pdRate = m_dRate, S_OK : E_POINTER;}
+STDMETHODIMP CBaseSplitterFilter::GetPreroll(LONGLONG* pllPreroll) {return pllPreroll ? *pllPreroll = 0, S_OK : E_POINTER;}
+
+HRESULT CBaseSplitterFilter::SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags)
+{
+ CAutoLock cAutoLock(this);
+
+ if(!pCurrent && !pStop
+ || (dwCurrentFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning
+ && (dwStopFlags&AM_SEEKING_PositioningBitsMask) == AM_SEEKING_NoPositioning)
+ return S_OK;
+
+ REFERENCE_TIME
+ rtCurrent = m_rtCurrent,
+ rtStop = m_rtStop;
+
+ if(pCurrent)
+ switch(dwCurrentFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtCurrent = *pCurrent; break;
+ case AM_SEEKING_RelativePositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ case AM_SEEKING_IncrementalPositioning: rtCurrent = rtCurrent + *pCurrent; break;
+ }
+
+ if(pStop)
+ switch(dwStopFlags&AM_SEEKING_PositioningBitsMask)
+ {
+ case AM_SEEKING_NoPositioning: break;
+ case AM_SEEKING_AbsolutePositioning: rtStop = *pStop; break;
+ case AM_SEEKING_RelativePositioning: rtStop += *pStop; break;
+ case AM_SEEKING_IncrementalPositioning: rtStop = rtCurrent + *pStop; break;
+ }
+
+ if(m_rtCurrent == rtCurrent && m_rtStop == rtStop)
+ return S_OK;
+
+ if(m_rtLastStart == rtCurrent && m_rtLastStop == rtStop && !m_LastSeekers.Find(id))
+ {
+ m_LastSeekers.AddTail(id);
+ return S_OK;
+ }
+
+ m_rtLastStart = rtCurrent;
+ m_rtLastStop = rtStop;
+ m_LastSeekers.RemoveAll();
+ m_LastSeekers.AddTail(id);
+
+DbgLog((LOG_TRACE, 0, _T("Seek Started %I64d"), rtCurrent));
+
+ m_rtNewStart = m_rtCurrent = rtCurrent;
+ m_rtNewStop = rtStop;
+
+ if(ThreadExists())
+ {
+ DeliverBeginFlush();
+ CallWorker(CMD_SEEK);
+ DeliverEndFlush();
+ }
+
+DbgLog((LOG_TRACE, 0, _T("Seek Ended")));
+
+ return S_OK;
+}
+
+// IAMOpenProgress
+
+STDMETHODIMP CBaseSplitterFilter::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent)
+{
+ CheckPointer(pllTotal, E_POINTER);
+ CheckPointer(pllCurrent, E_POINTER);
+
+ *pllTotal = 100;
+ *pllCurrent = m_nOpenProgress;
+
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterFilter::AbortOperation()
+{
+ m_fAbort = true;
+ return S_OK;
+}
+
+// IAMMediaContent
+
+STDMETHODIMP CBaseSplitterFilter::get_AuthorName(BSTR* pbstrAuthorName)
+{
+ return GetProperty(L"AUTH", pbstrAuthorName);
+}
+
+STDMETHODIMP CBaseSplitterFilter::get_Title(BSTR* pbstrTitle)
+{
+ return GetProperty(L"TITL", pbstrTitle);
+}
+
+STDMETHODIMP CBaseSplitterFilter::get_Rating(BSTR* pbstrRating)
+{
+ return GetProperty(L"RTNG", pbstrRating);
+}
+
+STDMETHODIMP CBaseSplitterFilter::get_Description(BSTR* pbstrDescription)
+{
+ return GetProperty(L"DESC", pbstrDescription);
+}
+
+STDMETHODIMP CBaseSplitterFilter::get_Copyright(BSTR* pbstrCopyright)
+{
+ return GetProperty(L"CPYR", pbstrCopyright);
+}
+
+// IAMExtendedSeeking
+
+STDMETHODIMP CBaseSplitterFilter::get_ExSeekCapabilities(long* pExCapabilities)
+{
+ CheckPointer(pExCapabilities, E_POINTER);
+ *pExCapabilities = AM_EXSEEK_CANSEEK;
+ if(ChapGetCount()) *pExCapabilities |= AM_EXSEEK_MARKERSEEK;
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterFilter::get_MarkerCount(long* pMarkerCount)
+{
+ CheckPointer(pMarkerCount, E_POINTER);
+ *pMarkerCount = (long)ChapGetCount();
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterFilter::get_CurrentMarker(long* pCurrentMarker)
+{
+ CheckPointer(pCurrentMarker, E_POINTER);
+ REFERENCE_TIME rt = m_rtCurrent;
+ long i = ChapLookup(&rt);
+ if(i < 0) return E_FAIL;
+ *pCurrentMarker = i+1;
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterFilter::GetMarkerTime(long MarkerNum, double* pMarkerTime)
+{
+ CheckPointer(pMarkerTime, E_POINTER);
+ REFERENCE_TIME rt;
+ if(FAILED(ChapGet((int)MarkerNum-1, &rt))) return E_FAIL;
+ *pMarkerTime = (double)rt / 10000000;
+ return S_OK;
+}
+
+STDMETHODIMP CBaseSplitterFilter::GetMarkerName(long MarkerNum, BSTR* pbstrMarkerName)
+{
+ return ChapGet((int)MarkerNum-1, NULL, pbstrMarkerName);
+}
+
+// IKeyFrameInfo
+
+STDMETHODIMP CBaseSplitterFilter::GetKeyFrameCount(UINT& nKFs)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CBaseSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
+{
+ return E_NOTIMPL;
+}
+
+// IBufferInfo
+
+STDMETHODIMP_(int) CBaseSplitterFilter::GetCount()
+{
+ CAutoLock cAutoLock(m_pLock);
+
+ return m_pOutputs.GetCount();
+}
+
+STDMETHODIMP CBaseSplitterFilter::GetStatus(int i, int& samples, int& size)
+{
+ CAutoLock cAutoLock(m_pLock);
+
+ if(POSITION pos = m_pOutputs.FindIndex(i))
+ {
+ CBaseSplitterOutputPin* pPin = m_pOutputs.GetAt(pos);
+ samples = pPin->QueueCount();
+ size = pPin->QueueSize();
+ return pPin->IsConnected() ? S_OK : S_FALSE;
+ }
+
+ return E_INVALIDARG;
+}
+
+STDMETHODIMP_(DWORD) CBaseSplitterFilter::GetPriority()
+{
+ return m_priority;
+}
diff --git a/src/filters/parser/basesplitter/BaseSplitter.h b/src/filters/parser/basesplitter/BaseSplitter.h
new file mode 100644
index 000000000..b7c4b9f35
--- /dev/null
+++ b/src/filters/parser/basesplitter/BaseSplitter.h
@@ -0,0 +1,373 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include <qnetwork.h>
+#include "..\..\..\..\include\IKeyFrameInfo.h"
+#include "..\..\..\..\include\IBufferInfo.h"
+#include "..\..\..\..\include\IBitRateInfo.h"
+#include "BaseSplitterFileEx.h"
+#include "AsyncReader.h"
+#include "..\..\..\DSUtil\DSMPropertyBag.h"
+#include "..\..\..\DSUtil\FontInstaller.h"
+
+class Packet : public CAtlArray<BYTE>
+{
+public:
+ DWORD TrackNumber;
+ BOOL bDiscontinuity, bSyncPoint, bAppendable;
+ static const REFERENCE_TIME INVALID_TIME = _I64_MIN;
+ REFERENCE_TIME rtStart, rtStop;
+ AM_MEDIA_TYPE* pmt;
+ Packet() {pmt = NULL; bDiscontinuity = bAppendable = FALSE;}
+ virtual ~Packet() {if(pmt) DeleteMediaType(pmt);}
+ virtual int GetDataSize() {return GetCount();}
+ void SetData(const void* ptr, DWORD len) {SetCount(len); memcpy(GetData(), ptr, len);}
+};
+
+class CPacketQueue
+ : public CCritSec
+ , protected CAutoPtrList<Packet>
+{
+ int m_size;
+
+public:
+ CPacketQueue();
+ void Add(CAutoPtr<Packet> p);
+ CAutoPtr<Packet> Remove();
+ void RemoveAll();
+ int GetCount(), GetSize();
+};
+
+class CBaseSplitterFilter;
+
+class CBaseSplitterInputPin
+ : public CBasePin
+{
+protected:
+ CComQIPtr<IAsyncReader> m_pAsyncReader;
+
+public:
+ CBaseSplitterInputPin(TCHAR* pName, CBaseSplitterFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CBaseSplitterInputPin();
+
+ HRESULT GetAsyncReader(IAsyncReader** ppAsyncReader);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pPin);
+
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
+};
+
+class CBaseSplitterOutputPin
+ : public CBaseOutputPin
+ , public IDSMPropertyBagImpl
+ , protected CAMThread
+ , public IMediaSeeking
+ , public IBitRateInfo
+{
+protected:
+ CAtlArray<CMediaType> m_mts;
+ int m_nBuffers;
+
+private:
+ CPacketQueue m_queue;
+
+ HRESULT m_hrDeliver;
+
+ bool m_fFlushing, m_fFlushed;
+ CAMEvent m_eEndFlush;
+
+ enum {CMD_EXIT};
+ DWORD ThreadProc();
+
+ void MakeISCRHappy();
+
+ // please only use DeliverPacket from the derived class
+ HRESULT GetDeliveryBuffer(IMediaSample** ppSample, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags);
+ HRESULT Deliver(IMediaSample* pSample);
+
+ // bitrate stats
+
+ struct
+ {
+ UINT64 nTotalBytesDelivered;
+ REFERENCE_TIME rtTotalTimeDelivered;
+ UINT64 nBytesSinceLastDeliverTime;
+ REFERENCE_TIME rtLastDeliverTime;
+ DWORD nCurrentBitRate;
+ DWORD nAverageBitRate;
+ } m_brs;
+
+protected:
+ REFERENCE_TIME m_rtStart;
+
+ // override this if you need some second level stream specific demuxing (optional)
+ // the default implementation will send the sample as is
+ virtual HRESULT DeliverPacket(CAutoPtr<Packet> p);
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+
+public:
+ CBaseSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers = 0);
+ CBaseSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr, int nBuffers = 0);
+ virtual ~CBaseSplitterOutputPin();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT SetName(LPCWSTR pName);
+
+ HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ CMediaType& CurrentMediaType() {return m_mt;}
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+
+ // Queueing
+
+ HANDLE GetThreadHandle() {ASSERT(m_hThread != NULL); return m_hThread;}
+ void SetThreadPriority(int nPriority) {if(m_hThread) ::SetThreadPriority(m_hThread, nPriority);}
+
+ HRESULT Active();
+ HRESULT Inactive();
+
+ HRESULT DeliverBeginFlush();
+ HRESULT DeliverEndFlush();
+ HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+ int QueueCount();
+ int QueueSize();
+ HRESULT QueueEndOfStream();
+ HRESULT QueuePacket(CAutoPtr<Packet> p);
+
+ // returns true for everything which (the lack of) would not block other streams (subtitle streams, basically)
+ virtual bool IsDiscontinuous();
+
+ // returns IStreamsSwitcherInputPin::IsActive(), when it can find one downstream
+ bool IsActive();
+
+ // IBitRateInfo
+
+ STDMETHODIMP_(DWORD) GetCurrentBitRate() {return m_brs.nCurrentBitRate;}
+ STDMETHODIMP_(DWORD) GetAverageBitRate() {return m_brs.nAverageBitRate;}
+};
+
+class CBaseSplitterFilter
+ : public CBaseFilter
+ , public CCritSec
+ , public IDSMPropertyBagImpl
+ , public IDSMResourceBagImpl
+ , public IDSMChapterBagImpl
+ , protected CAMThread
+ , public IFileSourceFilter
+ , public IMediaSeeking
+ , public IAMOpenProgress
+ , public IAMMediaContent
+ , public IAMExtendedSeeking
+ , public IKeyFrameInfo
+ , public IBufferInfo
+{
+ CCritSec m_csPinMap;
+ CAtlMap<DWORD, CBaseSplitterOutputPin*> m_pPinMap;
+
+ CCritSec m_csmtnew;
+ CAtlMap<DWORD, CMediaType> m_mtnew;
+
+ CAutoPtrList<CBaseSplitterOutputPin> m_pRetiredOutputs;
+
+ CComQIPtr<ISyncReader> m_pSyncReader;
+
+protected:
+ CStringW m_fn;
+
+ CAutoPtr<CBaseSplitterInputPin> m_pInput;
+ CAutoPtrList<CBaseSplitterOutputPin> m_pOutputs;
+
+ CBaseSplitterOutputPin* GetOutputPin(DWORD TrackNum);
+ DWORD GetOutputTrackNum(CBaseSplitterOutputPin* pPin);
+ HRESULT AddOutputPin(DWORD TrackNum, CAutoPtr<CBaseSplitterOutputPin> pPin);
+ HRESULT RenameOutputPin(DWORD TrackNumSrc, DWORD TrackNumDst, const AM_MEDIA_TYPE* pmt);
+ virtual HRESULT DeleteOutputs();
+ virtual HRESULT CreateOutputs(IAsyncReader* pAsyncReader) = 0; // override this ...
+
+ LONGLONG m_nOpenProgress;
+ bool m_fAbort;
+
+ REFERENCE_TIME m_rtDuration; // derived filter should set this at the end of CreateOutputs
+ REFERENCE_TIME m_rtStart, m_rtStop, m_rtCurrent, m_rtNewStart, m_rtNewStop;
+ double m_dRate;
+
+ CAtlList<UINT64> m_bDiscontinuitySent;
+ CAtlList<CBaseSplitterOutputPin*> m_pActivePins;
+
+ CAMEvent m_eEndFlush;
+ bool m_fFlushing;
+
+ void DeliverBeginFlush();
+ void DeliverEndFlush();
+ HRESULT DeliverPacket(CAutoPtr<Packet> p);
+
+ DWORD m_priority;
+
+ CFontInstaller m_fontinst;
+
+protected:
+ enum {CMD_EXIT, CMD_SEEK};
+ DWORD ThreadProc();
+
+ // ... and also override all these too
+ virtual bool DemuxInit() = 0;
+ virtual void DemuxSeek(REFERENCE_TIME rt) = 0;
+ virtual bool DemuxLoop() = 0;
+
+public:
+ CBaseSplitterFilter(LPCTSTR pName, LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid);
+ virtual ~CBaseSplitterFilter();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ bool IsAnyPinDrying();
+
+ HRESULT BreakConnect(PIN_DIRECTION dir, CBasePin* pPin);
+ HRESULT CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin);
+
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+
+ STDMETHODIMP Stop();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Run(REFERENCE_TIME tStart);
+
+ // IFileSourceFilter
+
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+
+protected:
+ friend class CBaseSplitterOutputPin;
+ virtual HRESULT SetPositionsInternal(void* id, LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+
+private:
+ REFERENCE_TIME m_rtLastStart, m_rtLastStop;
+ CAtlList<void*> m_LastSeekers;
+
+public:
+ // IAMOpenProgress
+
+ STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
+ STDMETHODIMP AbortOperation();
+
+ // IDispatch
+
+ STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) {return E_NOTIMPL;}
+ STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) {return E_NOTIMPL;}
+
+ // IAMMediaContent
+
+ STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName);
+ STDMETHODIMP get_Title(BSTR* pbstrTitle);
+ STDMETHODIMP get_Rating(BSTR* pbstrRating);
+ STDMETHODIMP get_Description(BSTR* pbstrDescription);
+ STDMETHODIMP get_Copyright(BSTR* pbstrCopyright);
+ STDMETHODIMP get_BaseURL(BSTR* pbstrBaseURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_LogoURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_LogoIconURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_WatermarkURL(BSTR* pbstrWatermarkURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoURL(BSTR* pbstrMoreInfoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoText(BSTR* pbstrMoreInfoText) {return E_NOTIMPL;}
+
+ // IAMExtendedSeeking
+
+ STDMETHODIMP get_ExSeekCapabilities(long* pExCapabilities);
+ STDMETHODIMP get_MarkerCount(long* pMarkerCount);
+ STDMETHODIMP get_CurrentMarker(long* pCurrentMarker);
+ STDMETHODIMP GetMarkerTime(long MarkerNum, double* pMarkerTime);
+ STDMETHODIMP GetMarkerName(long MarkerNum, BSTR* pbstrMarkerName);
+ STDMETHODIMP put_PlaybackSpeed(double Speed) {return E_NOTIMPL;}
+ STDMETHODIMP get_PlaybackSpeed(double* pSpeed) {return E_NOTIMPL;}
+
+ // IKeyFrameInfo
+
+ STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+
+ // IBufferInfo
+
+ STDMETHODIMP_(int) GetCount();
+ STDMETHODIMP GetStatus(int i, int& samples, int& size);
+ STDMETHODIMP_(DWORD) GetPriority();
+};
+
diff --git a/src/filters/parser/basesplitter/BaseSplitterFile.cpp b/src/filters/parser/basesplitter/BaseSplitterFile.cpp
new file mode 100644
index 000000000..221b640cd
--- /dev/null
+++ b/src/filters/parser/basesplitter/BaseSplitterFile.cpp
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "BaseSplitterFile.h"
+
+//
+// CBaseSplitterFile
+//
+
+CBaseSplitterFile::CBaseSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr, int cachelen)
+ : m_pAsyncReader(pAsyncReader)
+ , m_fStreaming(false)
+ , m_pos(0), m_len(0)
+ , m_bitbuff(0), m_bitlen(0)
+ , m_cachepos(0), m_cachelen(0)
+{
+ if(!m_pAsyncReader) {hr = E_UNEXPECTED; return;}
+
+ LONGLONG total = 0, available;
+ hr = m_pAsyncReader->Length(&total, &available);
+
+ m_fStreaming = total == 0 && available > 0;
+ m_len = available;
+
+ if(FAILED(hr) || !m_fStreaming && total != available || total < 0)
+ {
+ hr = E_FAIL;
+ return;
+ }
+
+ if(!SetCacheSize(cachelen))
+ {
+ hr = E_OUTOFMEMORY;
+ return;
+ }
+
+ hr = S_OK;
+}
+
+bool CBaseSplitterFile::SetCacheSize(int cachelen)
+{
+ m_pCache.Free();
+ m_cachetotal = 0;
+ m_pCache.Allocate((size_t)cachelen);
+ if(!m_pCache) return false;
+ m_cachetotal = cachelen;
+ m_cachelen = 0;
+ return true;
+}
+
+__int64 CBaseSplitterFile::GetPos()
+{
+ return m_pos - (m_bitlen>>3);
+}
+
+__int64 CBaseSplitterFile::GetLength()
+{
+ if(m_fStreaming)
+ {
+ LONGLONG total, available = 0;
+ if(SUCCEEDED(m_pAsyncReader->Length(&total, &available))) m_len = available;
+ }
+
+ return m_len;
+}
+
+void CBaseSplitterFile::Seek(__int64 pos)
+{
+ __int64 len = GetLength();
+ m_pos = min(max(pos, 0), len);
+ BitFlush();
+}
+
+HRESULT CBaseSplitterFile::Read(BYTE* pData, __int64 len)
+{
+ CheckPointer(m_pAsyncReader, E_NOINTERFACE);
+
+ HRESULT hr = S_OK;
+
+ if(m_cachetotal == 0 || !m_pCache)
+ {
+ hr = m_pAsyncReader->SyncRead(m_pos, (long)len, pData);
+ m_pos += len;
+ return hr;
+ }
+
+ BYTE* pCache = m_pCache;
+
+ if(m_cachepos <= m_pos && m_pos < m_cachepos + m_cachelen)
+ {
+ __int64 minlen = min(len, m_cachelen - (m_pos - m_cachepos));
+
+ memcpy(pData, &pCache[m_pos - m_cachepos], (size_t)minlen);
+
+ len -= minlen;
+ m_pos += minlen;
+ pData += minlen;
+ }
+
+ while(len > m_cachetotal)
+ {
+ hr = m_pAsyncReader->SyncRead(m_pos, (long)m_cachetotal, pData);
+ if(S_OK != hr) return hr;
+
+ len -= m_cachetotal;
+ m_pos += m_cachetotal;
+ pData += m_cachetotal;
+ }
+
+ while(len > 0)
+ {
+ __int64 tmplen = GetLength();
+ __int64 maxlen = min(tmplen - m_pos, m_cachetotal);
+ __int64 minlen = min(len, maxlen);
+ if(minlen <= 0) return S_FALSE;
+
+ hr = m_pAsyncReader->SyncRead(m_pos, (long)maxlen, pCache);
+ if(S_OK != hr) return hr;
+
+ m_cachepos = m_pos;
+ m_cachelen = maxlen;
+
+ memcpy(pData, pCache, (size_t)minlen);
+
+ len -= minlen;
+ m_pos += minlen;
+ pData += minlen;
+ }
+
+ return hr;
+}
+
+UINT64 CBaseSplitterFile::BitRead(int nBits, bool fPeek)
+{
+ ASSERT(nBits >= 0 && nBits <= 64);
+
+ while(m_bitlen < nBits)
+ {
+ m_bitbuff <<= 8;
+ if(S_OK != Read((BYTE*)&m_bitbuff, 1)) {return 0;} // EOF? // ASSERT(0);
+ m_bitlen += 8;
+ }
+
+ int bitlen = m_bitlen - nBits;
+
+ UINT64 ret = (m_bitbuff >> bitlen) & ((1ui64 << nBits) - 1);
+
+ if(!fPeek)
+ {
+ m_bitbuff &= ((1ui64 << bitlen) - 1);
+ m_bitlen = bitlen;
+ }
+
+ return ret;
+}
+
+void CBaseSplitterFile::BitByteAlign()
+{
+ m_bitlen &= ~7;
+}
+
+void CBaseSplitterFile::BitFlush()
+{
+ m_bitlen = 0;
+}
+
+HRESULT CBaseSplitterFile::ByteRead(BYTE* pData, __int64 len)
+{
+ Seek(GetPos());
+ return Read(pData, len);
+}
+
+UINT64 CBaseSplitterFile::UExpGolombRead()
+{
+ int n = -1;
+ for(BYTE b = 0; !b; n++) b = BitRead(1);
+ return (1ui64 << n) - 1 + BitRead(n);
+}
+
+INT64 CBaseSplitterFile::SExpGolombRead()
+{
+ UINT64 k = UExpGolombRead();
+ return ((k&1) ? 1 : -1) * ((k + 1) >> 1);
+}
+
+HRESULT CBaseSplitterFile::HasMoreData(__int64 len, DWORD ms)
+{
+ __int64 available = GetLength() - GetPos();
+
+ if(!m_fStreaming)
+ {
+ return available < 1 ? E_FAIL : S_OK;
+ }
+
+ if(available < len)
+ {
+ if(ms > 0) Sleep(ms);
+ return S_FALSE;
+ }
+
+ return S_OK;
+}
+
diff --git a/src/filters/parser/basesplitter/BaseSplitterFile.h b/src/filters/parser/basesplitter/BaseSplitterFile.h
new file mode 100644
index 000000000..b0a94eb27
--- /dev/null
+++ b/src/filters/parser/basesplitter/BaseSplitterFile.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+
+class CBaseSplitterFile
+{
+ CComPtr<IAsyncReader> m_pAsyncReader;
+ CAutoVectorPtr<BYTE> m_pCache;
+ __int64 m_cachepos, m_cachelen, m_cachetotal;
+
+ bool m_fStreaming;
+ __int64 m_pos, m_len;
+
+ virtual HRESULT Read(BYTE* pData, __int64 len); // use ByteRead
+
+protected:
+ UINT64 m_bitbuff;
+ int m_bitlen;
+
+ enum {DEFAULT_CACHELEN = 2048};
+
+public:
+ CBaseSplitterFile(IAsyncReader* pReader, HRESULT& hr, int cachelen = DEFAULT_CACHELEN);
+ virtual ~CBaseSplitterFile() {}
+
+ bool SetCacheSize(int cachelen = DEFAULT_CACHELEN);
+
+ __int64 GetPos();
+ __int64 GetLength();
+ virtual void Seek(__int64 pos);
+
+ UINT64 UExpGolombRead();
+ INT64 SExpGolombRead();
+
+ UINT64 BitRead(int nBits, bool fPeek = false);
+ void BitByteAlign(), BitFlush();
+ HRESULT ByteRead(BYTE* pData, __int64 len);
+
+ bool IsStreaming() {return m_fStreaming;}
+ HRESULT HasMoreData(__int64 len = 1, DWORD ms = 1);
+};
diff --git a/src/filters/parser/basesplitter/BaseSplitterFileEx.cpp b/src/filters/parser/basesplitter/BaseSplitterFileEx.cpp
new file mode 100644
index 000000000..5f8c58038
--- /dev/null
+++ b/src/filters/parser/basesplitter/BaseSplitterFileEx.cpp
@@ -0,0 +1,1108 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "BaseSplitterFileEx.h"
+#include <mmreg.h>
+#include "..\..\..\DSUtil\DSUtil.h"
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+//
+// CBaseSplitterFileEx
+//
+
+CBaseSplitterFileEx::CBaseSplitterFileEx(IAsyncReader* pReader, HRESULT& hr, int cachelen)
+ : CBaseSplitterFile(pReader, hr, cachelen)
+ , m_tslen(0)
+{
+}
+
+CBaseSplitterFileEx::~CBaseSplitterFileEx()
+{
+}
+
+//
+
+bool CBaseSplitterFileEx::NextMpegStartCode(BYTE& code, __int64 len)
+{
+ BitByteAlign();
+ DWORD dw = -1;
+ do
+ {
+ if(len-- == 0 || GetPos() >= GetLength()) return(false);
+ dw = (dw << 8) | (BYTE)BitRead(8);
+ }
+ while((dw&0xffffff00) != 0x00000100);
+ code = (BYTE)(dw&0xff);
+ return(true);
+}
+
+//
+
+#define MARKER if(BitRead(1) != 1) {ASSERT(0); return(false);}
+
+bool CBaseSplitterFileEx::Read(pshdr& h)
+{
+ memset(&h, 0, sizeof(h));
+
+ BYTE b = (BYTE)BitRead(8, true);
+
+ if((b&0xf1) == 0x21)
+ {
+ h.type = mpeg1;
+
+ EXECUTE_ASSERT(BitRead(4) == 2);
+
+ h.scr = 0;
+ h.scr |= BitRead(3) << 30; MARKER; // 32..30
+ h.scr |= BitRead(15) << 15; MARKER; // 29..15
+ h.scr |= BitRead(15); MARKER; MARKER; // 14..0
+ h.bitrate = BitRead(22); MARKER;
+ }
+ else if((b&0xc4) == 0x44)
+ {
+ h.type = mpeg2;
+
+ EXECUTE_ASSERT(BitRead(2) == 1);
+
+ h.scr = 0;
+ h.scr |= BitRead(3) << 30; MARKER; // 32..30
+ h.scr |= BitRead(15) << 15; MARKER; // 29..15
+ h.scr |= BitRead(15); MARKER; // 14..0
+ h.scr = h.scr*300 + BitRead(9); MARKER;
+ h.bitrate = BitRead(22); MARKER; MARKER;
+ BitRead(5); // reserved
+ UINT64 stuffing = BitRead(3);
+ while(stuffing-- > 0) EXECUTE_ASSERT(BitRead(8) == 0xff);
+ }
+ else
+ {
+ return(false);
+ }
+
+ h.bitrate *= 400;
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(pssyshdr& h)
+{
+ memset(&h, 0, sizeof(h));
+
+ WORD len = (WORD)BitRead(16); MARKER;
+ h.rate_bound = (DWORD)BitRead(22); MARKER;
+ h.audio_bound = (BYTE)BitRead(6);
+ h.fixed_rate = !!BitRead(1);
+ h.csps = !!BitRead(1);
+ h.sys_audio_loc_flag = !!BitRead(1);
+ h.sys_video_loc_flag = !!BitRead(1); MARKER;
+ h.video_bound = (BYTE)BitRead(5);
+
+ EXECUTE_ASSERT((BitRead(8)&0x7f) == 0x7f); // reserved (should be 0xff, but not in reality)
+
+ for(len -= 6; len > 3; len -= 3) // TODO: also store these, somewhere, if needed
+ {
+ UINT64 stream_id = BitRead(8);
+ EXECUTE_ASSERT(BitRead(2) == 3);
+ UINT64 p_std_buff_size_bound = (BitRead(1)?1024:128)*BitRead(13);
+ }
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(peshdr& h, BYTE code)
+{
+ memset(&h, 0, sizeof(h));
+
+ if(!(code >= 0xbd && code < 0xf0))
+ return(false);
+
+ h.len = (WORD)BitRead(16);
+
+ if(code == 0xbe || code == 0xbf)
+ return(true);
+
+ // mpeg1 stuffing (ff ff .. , max 16x)
+ for(int i = 0; i < 16 && BitRead(8, true) == 0xff; i++)
+ {
+ BitRead(8);
+ if(h.len) h.len--;
+ }
+
+ h.type = (BYTE)BitRead(2, true) == mpeg2 ? mpeg2 : mpeg1;
+
+ if(h.type == mpeg1)
+ {
+ BYTE b = (BYTE)BitRead(2);
+
+ if(b == 1)
+ {
+ h.std_buff_size = (BitRead(1)?1024:128)*BitRead(13);
+ if(h.len) h.len -= 2;
+ b = (BYTE)BitRead(2);
+ }
+
+ if(b == 0)
+ {
+ h.fpts = (BYTE)BitRead(1);
+ h.fdts = (BYTE)BitRead(1);
+ }
+ }
+ else if(h.type == mpeg2)
+ {
+ EXECUTE_ASSERT(BitRead(2) == mpeg2);
+ h.scrambling = (BYTE)BitRead(2);
+ h.priority = (BYTE)BitRead(1);
+ h.alignment = (BYTE)BitRead(1);
+ h.copyright = (BYTE)BitRead(1);
+ h.original = (BYTE)BitRead(1);
+ h.fpts = (BYTE)BitRead(1);
+ h.fdts = (BYTE)BitRead(1);
+ h.escr = (BYTE)BitRead(1);
+ h.esrate = (BYTE)BitRead(1);
+ h.dsmtrickmode = (BYTE)BitRead(1);
+ h.morecopyright = (BYTE)BitRead(1);
+ h.crc = (BYTE)BitRead(1);
+ h.extension = (BYTE)BitRead(1);
+ h.hdrlen = (BYTE)BitRead(8);
+ }
+ else
+ {
+ if(h.len) while(h.len-- > 0) BitRead(8);
+ return(false);
+ }
+
+ if(h.fpts)
+ {
+ if(h.type == mpeg2)
+ {
+ BYTE b = (BYTE)BitRead(4);
+ if(!(h.fdts && b == 3 || !h.fdts && b == 2)) {ASSERT(0); return(false);}
+ }
+
+ h.pts = 0;
+ h.pts |= BitRead(3) << 30; MARKER; // 32..30
+ h.pts |= BitRead(15) << 15; MARKER; // 29..15
+ h.pts |= BitRead(15); MARKER; // 14..0
+ h.pts = 10000*h.pts/90;
+ }
+
+ if(h.fdts)
+ {
+ if((BYTE)BitRead(4) != 1) {ASSERT(0); return(false);}
+
+ h.dts = 0;
+ h.dts |= BitRead(3) << 30; MARKER; // 32..30
+ h.dts |= BitRead(15) << 15; MARKER; // 29..15
+ h.dts |= BitRead(15); MARKER; // 14..0
+ h.dts = 10000*h.dts/90;
+ }
+
+ // skip to the end of header
+
+ if(h.type == mpeg1)
+ {
+ if(!h.fpts && !h.fdts && BitRead(4) != 0xf) {/*ASSERT(0);*/ return(false);}
+
+ if(h.len)
+ {
+ h.len--;
+ if(h.pts) h.len -= 4;
+ if(h.dts) h.len -= 5;
+ }
+ }
+
+ if(h.type == mpeg2)
+ {
+ if(h.len) h.len -= 3+h.hdrlen;
+
+ int left = h.hdrlen;
+ if(h.fpts) left -= 5;
+ if(h.fdts) left -= 5;
+ while(left-- > 0) BitRead(8);
+/*
+ // mpeg2 stuffing (ff ff .. , max 32x)
+ while(BitRead(8, true) == 0xff) {BitRead(8); if(h.len) h.len--;}
+ Seek(GetPos()); // put last peeked byte back for Read()
+
+ // FIXME: this doesn't seems to be here,
+ // infact there can be ff's as part of the data
+ // right at the beginning of the packet, which
+ // we should not skip...
+*/
+ }
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(seqhdr& h, int len, CMediaType* pmt)
+{
+ __int64 endpos = GetPos() + len; // - sequence header length
+
+ BYTE id = 0;
+
+ while(GetPos() < endpos && id != 0xb3)
+ {
+ if(!NextMpegStartCode(id, len))
+ return(false);
+ }
+
+ if(id != 0xb3)
+ return(false);
+
+ __int64 shpos = GetPos() - 4;
+
+ h.width = (WORD)BitRead(12);
+ h.height = (WORD)BitRead(12);
+ h.ar = BitRead(4);
+ static int ifps[16] = {0, 1126125, 1125000, 1080000, 900900, 900000, 540000, 450450, 450000, 0, 0, 0, 0, 0, 0, 0};
+ h.ifps = ifps[BitRead(4)];
+ h.bitrate = (DWORD)BitRead(18); MARKER;
+ h.vbv = (DWORD)BitRead(10);
+ h.constrained = BitRead(1);
+
+ if(h.fiqm = BitRead(1))
+ for(int i = 0; i < countof(h.iqm); i++)
+ h.iqm[i] = (BYTE)BitRead(8);
+
+ if(h.fniqm = BitRead(1))
+ for(int i = 0; i < countof(h.niqm); i++)
+ h.niqm[i] = (BYTE)BitRead(8);
+
+ __int64 shlen = GetPos() - shpos;
+
+ static float ar[] =
+ {
+ 1.0000f,1.0000f,0.6735f,0.7031f,0.7615f,0.8055f,0.8437f,0.8935f,
+ 0.9157f,0.9815f,1.0255f,1.0695f,1.0950f,1.1575f,1.2015f,1.0000f
+ };
+
+ h.arx = (int)((float)h.width / ar[h.ar] + 0.5);
+ h.ary = h.height;
+
+ mpeg_t type = mpeg1;
+
+ __int64 shextpos = 0, shextlen = 0;
+
+ if(NextMpegStartCode(id, 8) && id == 0xb5) // sequence header ext
+ {
+ shextpos = GetPos() - 4;
+
+ h.startcodeid = BitRead(4);
+ h.profile_levelescape = BitRead(1); // reserved, should be 0
+ h.profile = BitRead(3);
+ h.level = BitRead(4);
+ h.progressive = BitRead(1);
+ h.chroma = BitRead(2);
+ h.width |= (BitRead(2)<<12);
+ h.height |= (BitRead(2)<<12);
+ h.bitrate |= (BitRead(12)<<18); MARKER;
+ h.vbv |= (BitRead(8)<<10);
+ h.lowdelay = BitRead(1);
+ h.ifps = (DWORD)(h.ifps * (BitRead(2)+1) / (BitRead(5)+1));
+
+ shextlen = GetPos() - shextpos;
+
+ struct {DWORD x, y;} ar[] = {{h.width,h.height},{4,3},{16,9},{221,100},{h.width,h.height}};
+ int i = min(max(h.ar, 1), 5)-1;
+ h.arx = ar[i].x;
+ h.ary = ar[i].y;
+
+ type = mpeg2;
+ }
+
+ h.ifps = 10 * h.ifps / 27;
+ h.bitrate = h.bitrate == (1<<30)-1 ? 0 : h.bitrate * 400;
+
+ DWORD a = h.arx, b = h.ary;
+ while(a) {DWORD tmp = a; a = b % tmp; b = tmp;}
+ if(b) h.arx /= b, h.ary /= b;
+
+ if(!pmt) return(true);
+
+ pmt->majortype = MEDIATYPE_Video;
+
+ if(type == mpeg1)
+ {
+ pmt->subtype = MEDIASUBTYPE_MPEG1Payload;
+ pmt->formattype = FORMAT_MPEGVideo;
+ int len = FIELD_OFFSET(MPEG1VIDEOINFO, bSequenceHeader) + shlen + shextlen;
+ MPEG1VIDEOINFO* vi = (MPEG1VIDEOINFO*)new BYTE[len];
+ memset(vi, 0, len);
+ vi->hdr.dwBitRate = h.bitrate;
+ vi->hdr.AvgTimePerFrame = h.ifps;
+ vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
+ vi->hdr.bmiHeader.biWidth = h.width;
+ vi->hdr.bmiHeader.biHeight = h.height;
+ vi->hdr.bmiHeader.biXPelsPerMeter = h.width * h.ary;
+ vi->hdr.bmiHeader.biYPelsPerMeter = h.height * h.arx;
+ vi->cbSequenceHeader = shlen + shextlen;
+ Seek(shpos);
+ ByteRead((BYTE*)&vi->bSequenceHeader[0], shlen);
+ if(shextpos && shextlen) Seek(shextpos);
+ ByteRead((BYTE*)&vi->bSequenceHeader[0] + shlen, shextlen);
+ pmt->SetFormat((BYTE*)vi, len);
+ delete [] vi;
+ }
+ else if(type == mpeg2)
+ {
+ pmt->subtype = MEDIASUBTYPE_MPEG2_VIDEO;
+ pmt->formattype = FORMAT_MPEG2_VIDEO;
+ int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + shlen + shextlen;
+ MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)new BYTE[len];
+ memset(vi, 0, len);
+ vi->hdr.dwBitRate = h.bitrate;
+ vi->hdr.AvgTimePerFrame = h.ifps;
+ vi->hdr.dwPictAspectRatioX = h.arx;
+ vi->hdr.dwPictAspectRatioY = h.ary;
+ vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
+ vi->hdr.bmiHeader.biWidth = h.width;
+ vi->hdr.bmiHeader.biHeight = h.height;
+ vi->dwProfile = h.profile;
+ vi->dwLevel = h.level;
+ vi->cbSequenceHeader = shlen + shextlen;
+ Seek(shpos);
+ ByteRead((BYTE*)&vi->dwSequenceHeader[0], shlen);
+ if(shextpos && shextlen) Seek(shextpos);
+ ByteRead((BYTE*)&vi->dwSequenceHeader[0] + shlen, shextlen);
+ pmt->SetFormat((BYTE*)vi, len);
+ delete [] vi;
+ }
+ else
+ {
+ return(false);
+ }
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(mpahdr& h, int len, bool fAllowV25, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ int syncbits = fAllowV25 ? 11 : 12;
+
+ for(; len >= 4 && BitRead(syncbits, true) != (1<<syncbits) - 1; len--)
+ BitRead(8);
+
+ if(len < 4)
+ return(false);
+
+ h.sync = BitRead(11);
+ h.version = BitRead(2);
+ h.layer = BitRead(2);
+ h.crc = BitRead(1);
+ h.bitrate = BitRead(4);
+ h.freq = BitRead(2);
+ h.padding = BitRead(1);
+ h.privatebit = BitRead(1);
+ h.channels = BitRead(2);
+ h.modeext = BitRead(2);
+ h.copyright = BitRead(1);
+ h.original = BitRead(1);
+ h.emphasis = BitRead(2);
+
+ if(h.version == 1 || h.layer == 0 || h.freq == 3 || h.bitrate == 15 || h.emphasis == 2)
+ return(false);
+
+ if(h.version == 3 && h.layer == 2)
+ {
+ if((h.bitrate == 1 || h.bitrate == 2 || h.bitrate == 3 || h.bitrate == 5) && h.channels != 3
+ && (h.bitrate >= 11 && h.bitrate <= 14) && h.channels == 3)
+ return(false);
+ }
+
+ h.layer = 4 - h.layer;
+
+ //
+
+ static int brtbl[][5] =
+ {
+ {0,0,0,0,0},
+ {32,32,32,32,8},
+ {64,48,40,48,16},
+ {96,56,48,56,24},
+ {128,64,56,64,32},
+ {160,80,64,80,40},
+ {192,96,80,96,48},
+ {224,112,96,112,56},
+ {256,128,112,128,64},
+ {288,160,128,144,80},
+ {320,192,160,160,96},
+ {352,224,192,176,112},
+ {384,256,224,192,128},
+ {416,320,256,224,144},
+ {448,384,320,256,160},
+ {0,0,0,0,0},
+ };
+
+ static int brtblcol[][4] = {{0,3,4,4},{0,0,1,2}};
+ int bitrate = 1000*brtbl[h.bitrate][brtblcol[h.version&1][h.layer]];
+ if(bitrate == 0) return(false);
+
+ static int freq[][4] = {{11025,0,22050,44100},{12000,0,24000,48000},{8000,0,16000,32000}};
+
+ bool l3ext = h.layer == 3 && !(h.version&1);
+
+ h.nSamplesPerSec = freq[h.freq][h.version];
+ h.FrameSize = h.layer == 1
+ ? (12 * bitrate / h.nSamplesPerSec + h.padding) * 4
+ : (l3ext ? 72 : 144) * bitrate / h.nSamplesPerSec + h.padding;
+ h.rtDuration = 10000000i64 * (h.layer == 1 ? 384 : l3ext ? 576 : 1152) / h.nSamplesPerSec;// / (h.channels == 3 ? 1 : 2);
+ h.nBytesPerSec = bitrate / 8;
+
+ if(!pmt) return(true);
+
+ /*int*/ len = h.layer == 3
+ ? sizeof(WAVEFORMATEX/*MPEGLAYER3WAVEFORMAT*/) // no need to overcomplicate this...
+ : sizeof(MPEG1WAVEFORMAT);
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)new BYTE[len];
+ memset(wfe, 0, len);
+ wfe->cbSize = len - sizeof(WAVEFORMATEX);
+
+ if(h.layer == 3)
+ {
+ wfe->wFormatTag = WAVE_FORMAT_MP3;
+
+/* MPEGLAYER3WAVEFORMAT* f = (MPEGLAYER3WAVEFORMAT*)wfe;
+ f->wfx.wFormatTag = WAVE_FORMAT_MP3;
+ f->wID = MPEGLAYER3_ID_UNKNOWN;
+ f->fdwFlags = h.padding ? MPEGLAYER3_FLAG_PADDING_ON : MPEGLAYER3_FLAG_PADDING_OFF; // _OFF or _ISO ?
+*/
+ }
+ else
+ {
+ MPEG1WAVEFORMAT* f = (MPEG1WAVEFORMAT*)wfe;
+ f->wfx.wFormatTag = WAVE_FORMAT_MPEG;
+ f->fwHeadMode = 1 << h.channels;
+ f->fwHeadModeExt = 1 << h.modeext;
+ f->wHeadEmphasis = h.emphasis+1;
+ if(h.privatebit) f->fwHeadFlags |= ACM_MPEG_PRIVATEBIT;
+ if(h.copyright) f->fwHeadFlags |= ACM_MPEG_COPYRIGHT;
+ if(h.original) f->fwHeadFlags |= ACM_MPEG_ORIGINALHOME;
+ if(h.crc == 0) f->fwHeadFlags |= ACM_MPEG_PROTECTIONBIT;
+ if(h.version == 3) f->fwHeadFlags |= ACM_MPEG_ID_MPEG1;
+ f->fwHeadLayer = 1 << (h.layer-1);
+ f->dwHeadBitrate = bitrate;
+ }
+
+ wfe->nChannels = h.channels == 3 ? 1 : 2;
+ wfe->nSamplesPerSec = h.nSamplesPerSec;
+ wfe->nBlockAlign = h.FrameSize;
+ wfe->nAvgBytesPerSec = h.nBytesPerSec;
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = FOURCCMap(wfe->wFormatTag);
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)wfe, sizeof(WAVEFORMATEX) + wfe->cbSize);
+
+ delete [] wfe;
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(aachdr& h, int len, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ for(; len >= 7 && BitRead(12, true) != 0xfff; len--)
+ BitRead(8);
+
+ if(len < 7)
+ return(false);
+
+ h.sync = BitRead(12);
+ h.version = BitRead(1);
+ h.layer = BitRead(2);
+ h.fcrc = BitRead(1);
+ h.profile = BitRead(2);
+ h.freq = BitRead(4);
+ h.privatebit = BitRead(1);
+ h.channels = BitRead(3);
+ h.original = BitRead(1);
+ h.home = BitRead(1);
+
+ h.copyright_id_bit = BitRead(1);
+ h.copyright_id_start = BitRead(1);
+ h.aac_frame_length = BitRead(13);
+ h.adts_buffer_fullness = BitRead(11);
+ h.no_raw_data_blocks_in_frame = BitRead(2);
+
+ if(h.fcrc == 0) h.crc = BitRead(16);
+
+ if(h.layer != 0 || h.freq >= 12 || h.aac_frame_length <= (h.fcrc == 0 ? 9 : 7))
+ return(false);
+
+ h.FrameSize = h.aac_frame_length - (h.fcrc == 0 ? 9 : 7);
+ static int freq[] = {96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000};
+ h.nBytesPerSec = h.aac_frame_length * freq[h.freq] / 1024; // ok?
+ h.rtDuration = 10000000i64 * 1024 / freq[h.freq]; // ok?
+
+ if(!pmt) return(true);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)new BYTE[sizeof(WAVEFORMATEX)+5];
+ memset(wfe, 0, sizeof(WAVEFORMATEX)+5);
+ wfe->wFormatTag = WAVE_FORMAT_AAC;
+ wfe->nChannels = h.channels <= 6 ? h.channels : 2;
+ wfe->nSamplesPerSec = freq[h.freq];
+ wfe->nBlockAlign = h.aac_frame_length;
+ wfe->nAvgBytesPerSec = h.nBytesPerSec;
+ wfe->cbSize = MakeAACInitData((BYTE*)(wfe+1), h.profile, wfe->nSamplesPerSec, wfe->nChannels);
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_AAC;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)wfe, sizeof(WAVEFORMATEX)+wfe->cbSize);
+
+ delete [] wfe;
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(ac3hdr& h, int len, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ for(; len >= 7 && BitRead(16, true) != 0x0b77; len--)
+ BitRead(8);
+
+ if(len < 7)
+ return(false);
+
+ h.sync = (WORD)BitRead(16);
+ h.crc1 = (WORD)BitRead(16);
+ h.fscod = BitRead(2);
+ h.frmsizecod = BitRead(6);
+ h.bsid = BitRead(5);
+ h.bsmod = BitRead(3);
+ h.acmod = BitRead(3);
+ if((h.acmod & 1) && h.acmod != 1) h.cmixlev = BitRead(2);
+ if(h.acmod & 4) h.surmixlev = BitRead(2);
+ if(h.acmod == 2) h.dsurmod = BitRead(2);
+ h.lfeon = BitRead(1);
+
+ if(h.bsid >= 12 || h.fscod == 3 || h.frmsizecod >= 38)
+ return(false);
+
+ if(!pmt) return(true);
+
+ WAVEFORMATEX wfe;
+ memset(&wfe, 0, sizeof(wfe));
+ wfe.wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+
+ static int channels[] = {2, 1, 2, 3, 3, 4, 4, 5};
+ wfe.nChannels = channels[h.acmod] + h.lfeon;
+
+ static int freq[] = {48000, 44100, 32000, 0};
+ wfe.nSamplesPerSec = freq[h.fscod];
+
+ switch(h.bsid)
+ {
+ case 9: wfe.nSamplesPerSec >>= 1; break;
+ case 10: wfe.nSamplesPerSec >>= 2; break;
+ case 11: wfe.nSamplesPerSec >>= 3; break;
+ default: break;
+ }
+
+ static int rate[] = {32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, 640};
+
+ wfe.nAvgBytesPerSec = rate[h.frmsizecod>>1] * 1000 / 8;
+ wfe.nBlockAlign = (WORD)(1536 * wfe.nAvgBytesPerSec / wfe.nSamplesPerSec);
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_DOLBY_AC3;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(dtshdr& h, int len, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ for(; len >= 10 && BitRead(32, true) != 0x7ffe8001; len--)
+ BitRead(8);
+
+ if(len < 10)
+ return(false);
+
+ h.sync = (DWORD)BitRead(32);
+ h.frametype = BitRead(1);
+ h.deficitsamplecount = BitRead(5);
+ h.fcrc = BitRead(1);
+ h.nblocks = BitRead(7);
+ h.framebytes = (WORD)BitRead(14)+1;
+ h.amode = BitRead(6);
+ h.sfreq = BitRead(4);
+ h.rate = BitRead(5);
+
+ if(!pmt) return(true);
+
+ WAVEFORMATEX wfe;
+ memset(&wfe, 0, sizeof(wfe));
+ wfe.wFormatTag = WAVE_FORMAT_DVD_DTS;
+
+ static int channels[] = {1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8};
+ if(h.amode < countof(channels)) wfe.nChannels = channels[h.amode];
+
+ static int freq[] = {0,8000,16000,32000,0,0,11025,22050,44100,0,0,12000,24000,48000,0,0};
+ wfe.nSamplesPerSec = freq[h.sfreq];
+
+ static int rate[] =
+ {
+ 32000,56000,64000,96000,112000,128000,192000,224000,
+ 256000,320000,384000,448000,512000,576000,640000,754500,
+ 960000,1024000,1152000,1280000,1344000,1408000,1411200,1472000,
+ 1509750,1920000,2048000,3072000,3840000,0,0,0
+ };
+
+ wfe.nAvgBytesPerSec = rate[h.rate] * 1000 / 8;
+ wfe.nBlockAlign = h.framebytes;
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_DTS;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(lpcmhdr& h, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ h.emphasis = BitRead(1);
+ h.mute = BitRead(1);
+ h.reserved1 = BitRead(1);
+ h.framenum = BitRead(5);
+ h.quantwordlen = BitRead(2);
+ h.freq = BitRead(2);
+ h.reserved2 = BitRead(1);
+ h.channels = BitRead(3);
+ h.drc = (BYTE)BitRead(8);
+
+ if(h.channels > 2 || h.reserved1 || h.reserved2)
+ return(false);
+
+ if(!pmt) return(true);
+
+ WAVEFORMATEX wfe;
+ memset(&wfe, 0, sizeof(wfe));
+ wfe.wFormatTag = WAVE_FORMAT_PCM;
+ wfe.nChannels = h.channels+1;
+ static int freq[] = {48000, 96000, 44100, 32000};
+ wfe.nSamplesPerSec = freq[h.freq];
+ wfe.wBitsPerSample = 16;
+ wfe.nBlockAlign = wfe.nChannels*wfe.wBitsPerSample>>3;
+ wfe.nAvgBytesPerSec = wfe.nBlockAlign*wfe.nSamplesPerSec;
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = MEDIASUBTYPE_DVD_LPCM_AUDIO;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+
+ // TODO: what to do with dvd-audio lpcm?
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(dvdspuhdr& h, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ if(!pmt) return(true);
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = MEDIASUBTYPE_DVD_SUBPICTURE;
+ pmt->formattype = FORMAT_None;
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(svcdspuhdr& h, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ if(!pmt) return(true);
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = MEDIASUBTYPE_SVCD_SUBPICTURE;
+ pmt->formattype = FORMAT_None;
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(cvdspuhdr& h, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ if(!pmt) return(true);
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = MEDIASUBTYPE_CVD_SUBPICTURE;
+ pmt->formattype = FORMAT_None;
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(ps2audhdr& h, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ if(BitRead(16, true) != 'SS')
+ return(false);
+
+ __int64 pos = GetPos();
+
+ while(BitRead(16, true) == 'SS')
+ {
+ DWORD tag = (DWORD)BitRead(32, true);
+ DWORD size = 0;
+
+ if(tag == 'SShd')
+ {
+ BitRead(32);
+ ByteRead((BYTE*)&size, sizeof(size));
+ ASSERT(size == 0x18);
+ Seek(GetPos());
+ ByteRead((BYTE*)&h, sizeof(h));
+ }
+ else if(tag == 'SSbd')
+ {
+ BitRead(32);
+ ByteRead((BYTE*)&size, sizeof(size));
+ break;
+ }
+ }
+
+ Seek(pos);
+
+ if(!pmt) return(true);
+
+ WAVEFORMATEXPS2 wfe;
+ wfe.wFormatTag =
+ h.unk1 == 0x01 ? WAVE_FORMAT_PS2_PCM :
+ h.unk1 == 0x10 ? WAVE_FORMAT_PS2_ADPCM :
+ WAVE_FORMAT_UNKNOWN;
+ wfe.nChannels = (WORD)h.channels;
+ wfe.nSamplesPerSec = h.freq;
+ wfe.wBitsPerSample = 16; // always?
+ wfe.nBlockAlign = wfe.nChannels*wfe.wBitsPerSample>>3;
+ wfe.nAvgBytesPerSec = wfe.nBlockAlign*wfe.nSamplesPerSec;
+ wfe.dwInterleave = h.interleave;
+
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = FOURCCMap(wfe.wFormatTag);
+ pmt->formattype = FORMAT_WaveFormatEx;
+ pmt->SetFormat((BYTE*)&wfe, sizeof(wfe));
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(ps2subhdr& h, CMediaType* pmt)
+{
+ memset(&h, 0, sizeof(h));
+
+ if(!pmt) return(true);
+
+ pmt->majortype = MEDIATYPE_Subtitle;
+ pmt->subtype = MEDIASUBTYPE_PS2_SUB;
+ pmt->formattype = FORMAT_None;
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(trhdr& h, bool fSync)
+{
+ memset(&h, 0, sizeof(h));
+
+ BitByteAlign();
+
+ if(m_tslen == 0)
+ {
+ __int64 pos = GetPos();
+
+ for(int i = 0; i < 192; i++)
+ {
+ if(BitRead(8, true) == 0x47)
+ {
+ __int64 pos = GetPos();
+ Seek(pos + 188);
+ if(BitRead(8, true) == 0x47) {m_tslen = 188; break;}
+ Seek(pos + 192);
+ if(BitRead(8, true) == 0x47) {m_tslen = 192; break;}
+ }
+
+ BitRead(8);
+ }
+
+ Seek(pos);
+
+ if(m_tslen == 0)
+ {
+ return(false);
+ }
+ }
+
+ if(fSync)
+ {
+ for(int i = 0; i < m_tslen; i++)
+ {
+ if(BitRead(8, true) == 0x47)
+ {
+ if(i == 0) break;
+ Seek(GetPos()+m_tslen);
+ if(BitRead(8, true) == 0x47) {Seek(GetPos()-m_tslen); break;}
+ }
+
+ BitRead(8);
+
+ if(i == m_tslen-1)
+ return(false);
+ }
+ }
+
+ if(BitRead(8, true) != 0x47)
+ return(false);
+
+ h.next = GetPos() + m_tslen;
+
+ h.sync = (BYTE)BitRead(8);
+ h.error = BitRead(1);
+ h.payloadstart = BitRead(1);
+ h.transportpriority = BitRead(1);
+ h.pid = BitRead(13);
+ h.scrambling = BitRead(2);
+ h.adapfield = BitRead(1);
+ h.payload = BitRead(1);
+ h.counter = BitRead(4);
+
+ h.bytes = 188 - 4;
+
+ if(h.adapfield)
+ {
+ h.length = (BYTE)BitRead(8);
+
+ if(h.length > 0)
+ {
+ h.discontinuity = BitRead(1);
+ h.randomaccess = BitRead(1);
+ h.priority = BitRead(1);
+ h.PCR = BitRead(1);
+ h.OPCR = BitRead(1);
+ h.splicingpoint = BitRead(1);
+ h.privatedata = BitRead(1);
+ h.extension = BitRead(1);
+
+ for(int i = 1; i < h.length; i++)
+ BitRead(8);
+ }
+
+ h.bytes -= h.length+1;
+
+ if(h.bytes < 0) {ASSERT(0); return false;}
+ }
+
+ return true;
+}
+
+bool CBaseSplitterFileEx::Read(trsechdr& h)
+{
+ BYTE pointer_field = BitRead(8);
+ while(pointer_field-- > 0) BitRead(8);
+ h.table_id = BitRead(8);
+ h.section_syntax_indicator = BitRead(1);
+ h.zero = BitRead(1);
+ h.reserved1 = BitRead(2);
+ h.section_length = BitRead(12);
+ h.transport_stream_id = BitRead(16);
+ h.reserved2 = BitRead(2);
+ h.version_number = BitRead(5);
+ h.current_next_indicator = BitRead(1);
+ h.section_number = BitRead(8);
+ h.last_section_number = BitRead(8);
+ return h.section_syntax_indicator == 1 && h.zero == 0;
+}
+
+bool CBaseSplitterFileEx::Read(pvahdr& h, bool fSync)
+{
+ memset(&h, 0, sizeof(h));
+
+ BitByteAlign();
+
+ if(fSync)
+ {
+ for(int i = 0; i < 65536; i++)
+ {
+ if((BitRead(64, true)&0xfffffc00ffe00000i64) == 0x4156000055000000i64)
+ break;
+ BitRead(8);
+ }
+ }
+
+ if((BitRead(64, true)&0xfffffc00ffe00000i64) != 0x4156000055000000i64)
+ return(false);
+
+ h.sync = (WORD)BitRead(16);
+ h.streamid = (BYTE)BitRead(8);
+ h.counter = (BYTE)BitRead(8);
+ h.res1 = (BYTE)BitRead(8);
+ h.res2 = BitRead(3);
+ h.fpts = BitRead(1);
+ h.postbytes = BitRead(2);
+ h.prebytes = BitRead(2);
+ h.length = (WORD)BitRead(16);
+
+ if(h.length > 6136)
+ return(false);
+
+ __int64 pos = GetPos();
+
+ if(h.streamid == 1 && h.fpts)
+ {
+ h.pts = 10000*BitRead(32)/90;
+ }
+ else if(h.streamid == 2 && (h.fpts || (BitRead(32, true)&0xffffffe0) == 0x000001c0))
+ {
+ BYTE b;
+ if(!NextMpegStartCode(b, 4)) return(false);
+ peshdr h2;
+ if(!Read(h2, b)) return(false);
+ if(h.fpts = h2.fpts) h.pts = h2.pts;
+ }
+
+ BitRead(8*h.prebytes);
+
+ h.length -= GetPos() - pos;
+
+ return(true);
+}
+
+bool CBaseSplitterFileEx::Read(avchdr& h, int len, CMediaType* pmt)
+{
+ __int64 endpos = GetPos() + len; // - sequence header length
+
+ __int64 spspos = 0, spslen = 0;
+ __int64 ppspos = 0, ppslen = 0;
+
+ while(GetPos() < endpos+4 && BitRead(32, true) == 0x00000001)
+ {
+ __int64 pos = GetPos();
+
+ BitRead(32);
+ BYTE id = BitRead(8);
+
+ if(spspos != 0 && spslen == 0) spslen = pos - spspos;
+ else if(ppspos != 0 && ppslen == 0) ppslen = pos - ppspos;
+
+ if((id&0x9f) == 0x07 && (id&0x60) != 0)
+ {
+ spspos = pos;
+
+ h.profile = (BYTE)BitRead(8);
+ BitRead(8);
+ h.level = (BYTE)BitRead(8);
+
+ UExpGolombRead(); // seq_parameter_set_id
+ UExpGolombRead(); // log2_max_frame_num_minus4
+
+ UINT64 pic_order_cnt_type = UExpGolombRead();
+
+ if(pic_order_cnt_type == 0)
+ {
+ UExpGolombRead(); // log2_max_pic_order_cnt_lsb_minus4
+ }
+ else if(pic_order_cnt_type == 1)
+ {
+ BitRead(1); // delta_pic_order_always_zero_flag
+ SExpGolombRead(); // offset_for_non_ref_pic
+ SExpGolombRead(); // offset_for_top_to_bottom_field
+ UINT64 num_ref_frames_in_pic_order_cnt_cycle = UExpGolombRead();
+ for(int i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++)
+ SExpGolombRead(); // offset_for_ref_frame[i]
+ }
+
+ UExpGolombRead(); // num_ref_frames
+ BitRead(1); // gaps_in_frame_num_value_allowed_flag
+
+ UINT64 pic_width_in_mbs_minus1 = UExpGolombRead();
+ UINT64 pic_height_in_map_units_minus1 = UExpGolombRead();
+ BYTE frame_mbs_only_flag = (BYTE)BitRead(1);
+
+ h.width = (pic_width_in_mbs_minus1 + 1) * 16;
+ h.height = (2 - frame_mbs_only_flag) * (pic_height_in_map_units_minus1 + 1) * 16;
+ }
+ else if((id&0x9f) == 0x08 && (id&0x60) != 0)
+ {
+ ppspos = pos;
+ }
+
+ BitByteAlign();
+
+ while(GetPos() < endpos+4 && BitRead(32, true) != 0x00000001)
+ BitRead(8);
+ }
+
+ if(!spspos || !spslen || !ppspos || !ppslen)
+ return(false);
+
+ if(!pmt) return(true);
+
+ {
+ int extra = 2+spslen-4 + 2+ppslen-4;
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = FOURCCMap('1CVA');
+ pmt->formattype = FORMAT_MPEG2_VIDEO;
+ int len = FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + extra;
+ MPEG2VIDEOINFO* vi = (MPEG2VIDEOINFO*)new BYTE[len];
+ memset(vi, 0, len);
+ // vi->hdr.dwBitRate = ;
+ // vi->hdr.AvgTimePerFrame = ;
+ vi->hdr.dwPictAspectRatioX = h.width;
+ vi->hdr.dwPictAspectRatioY = h.height;
+ vi->hdr.bmiHeader.biSize = sizeof(vi->hdr.bmiHeader);
+ vi->hdr.bmiHeader.biWidth = h.width;
+ vi->hdr.bmiHeader.biHeight = h.height;
+ vi->hdr.bmiHeader.biCompression = '1CVA';
+ vi->dwProfile = h.profile;
+ vi->dwFlags = 4; // ?
+ vi->dwLevel = h.level;
+ vi->cbSequenceHeader = extra;
+ BYTE* p = (BYTE*)&vi->dwSequenceHeader[0];
+ *p++ = (spslen-4) >> 8;
+ *p++ = (spslen-4) & 0xff;
+ Seek(spspos+4);
+ ByteRead(p, spslen-4);
+ p += spslen-4;
+ *p++ = (ppslen-4) >> 8;
+ *p++ = (ppslen-4) & 0xff;
+ Seek(ppspos+4);
+ ByteRead(p, ppslen-4);
+ p += ppslen-4;
+ pmt->SetFormat((BYTE*)vi, len);
+ delete [] vi;
+ }
+
+ return(true);
+}
diff --git a/src/filters/parser/basesplitter/BaseSplitterFileEx.h b/src/filters/parser/basesplitter/BaseSplitterFileEx.h
new file mode 100644
index 000000000..4cc2ce741
--- /dev/null
+++ b/src/filters/parser/basesplitter/BaseSplitterFileEx.h
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "BaseSplitterFile.h"
+
+class CBaseSplitterFileEx : public CBaseSplitterFile
+{
+ int m_tslen; // transport stream packet length (188 or 192 bytes, auto-detected)
+
+public:
+ CBaseSplitterFileEx(IAsyncReader* pReader, HRESULT& hr, int cachelen = DEFAULT_CACHELEN);
+ virtual ~CBaseSplitterFileEx();
+
+ // using CBaseSplitterFile::Read;
+
+ bool NextMpegStartCode(BYTE& b, __int64 len = 65536);
+
+#pragma pack(push, 1)
+
+ enum mpeg_t {mpegunk, mpeg1, mpeg2};
+
+ struct pshdr
+ {
+ mpeg_t type;
+ UINT64 scr, bitrate;
+ };
+
+ struct pssyshdr
+ {
+ DWORD rate_bound;
+ BYTE video_bound, audio_bound;
+ bool fixed_rate, csps;
+ bool sys_video_loc_flag, sys_audio_loc_flag;
+ };
+
+ struct peshdr
+ {
+ WORD len;
+
+ BYTE type:2, fpts:1, fdts:1;
+ REFERENCE_TIME pts, dts;
+
+ // mpeg1 stuff
+ UINT64 std_buff_size;
+
+ // mpeg2 stuff
+ BYTE scrambling:2, priority:1, alignment:1, copyright:1, original:1;
+ BYTE escr:1, esrate:1, dsmtrickmode:1, morecopyright:1, crc:1, extension:1;
+ BYTE hdrlen;
+
+ struct peshdr() {memset(this, 0, sizeof(*this));}
+ };
+
+ class seqhdr
+ {
+ public:
+ WORD width;
+ WORD height;
+ BYTE ar:4;
+ DWORD ifps;
+ DWORD bitrate;
+ DWORD vbv;
+ BYTE constrained:1;
+ BYTE fiqm:1;
+ BYTE iqm[64];
+ BYTE fniqm:1;
+ BYTE niqm[64];
+ // ext
+ BYTE startcodeid:4;
+ BYTE profile_levelescape:1;
+ BYTE profile:3;
+ BYTE level:4;
+ BYTE progressive:1;
+ BYTE chroma:2;
+ BYTE lowdelay:1;
+ // misc
+ int arx, ary;
+ };
+
+ class mpahdr
+ {
+ public:
+ WORD sync:11;
+ WORD version:2;
+ WORD layer:2;
+ WORD crc:1;
+ WORD bitrate:4;
+ WORD freq:2;
+ WORD padding:1;
+ WORD privatebit:1;
+ WORD channels:2;
+ WORD modeext:2;
+ WORD copyright:1;
+ WORD original:1;
+ WORD emphasis:2;
+
+ int nSamplesPerSec, FrameSize, nBytesPerSec;
+ REFERENCE_TIME rtDuration;
+ };
+
+ class aachdr
+ {
+ public:
+ WORD sync:12;
+ WORD version:1;
+ WORD layer:2;
+ WORD fcrc:1;
+ WORD profile:2;
+ WORD freq:4;
+ WORD privatebit:1;
+ WORD channels:3;
+ WORD original:1;
+ WORD home:1; // ?
+
+ WORD copyright_id_bit:1;
+ WORD copyright_id_start:1;
+ WORD aac_frame_length:13;
+ WORD adts_buffer_fullness:11;
+ WORD no_raw_data_blocks_in_frame:2;
+
+ WORD crc;
+
+ int FrameSize, nBytesPerSec;
+ REFERENCE_TIME rtDuration;
+ };
+
+ class ac3hdr
+ {
+ public:
+ WORD sync;
+ WORD crc1;
+ BYTE fscod:2;
+ BYTE frmsizecod:6;
+ BYTE bsid:5;
+ BYTE bsmod:3;
+ BYTE acmod:3;
+ BYTE cmixlev:2;
+ BYTE surmixlev:2;
+ BYTE dsurmod:2;
+ BYTE lfeon:1;
+ // the rest is unimportant for us
+ };
+
+ class dtshdr
+ {
+ public:
+ DWORD sync;
+ BYTE frametype:1;
+ BYTE deficitsamplecount:5;
+ BYTE fcrc:1;
+ BYTE nblocks:7;
+ WORD framebytes;
+ BYTE amode:6;
+ BYTE sfreq:4;
+ BYTE rate:5;
+ };
+
+ class lpcmhdr
+ {
+ public:
+ BYTE emphasis:1;
+ BYTE mute:1;
+ BYTE reserved1:1;
+ BYTE framenum:5;
+ BYTE quantwordlen:2;
+ BYTE freq:2; // 48, 96, 44.1, 32
+ BYTE reserved2:1;
+ BYTE channels:3; // +1
+ BYTE drc; // 0x80: off
+ };
+
+ class dvdspuhdr
+ {
+ public:
+ // nothing ;)
+ };
+
+ class svcdspuhdr
+ {
+ public:
+ // nothing ;)
+ };
+
+ class cvdspuhdr
+ {
+ public:
+ // nothing ;)
+ };
+
+ class ps2audhdr
+ {
+ public:
+ // 'SShd' + len (0x18)
+ DWORD unk1;
+ DWORD freq;
+ DWORD channels;
+ DWORD interleave; // bytes per channel
+ // padding: FF .. FF
+ // 'SSbd' + len
+ // pcm or adpcm data
+ };
+
+ class ps2subhdr
+ {
+ public:
+ // nothing ;)
+ };
+
+ struct trhdr
+ {
+ BYTE sync; // 0x47
+ BYTE error:1;
+ BYTE payloadstart:1;
+ BYTE transportpriority:1;
+ WORD pid:13;
+ BYTE scrambling:2;
+ BYTE adapfield:1;
+ BYTE payload:1;
+ BYTE counter:4;
+ // if adapfield set
+ BYTE length;
+ BYTE discontinuity:1;
+ BYTE randomaccess:1;
+ BYTE priority:1;
+ BYTE PCR:1;
+ BYTE OPCR:1;
+ BYTE splicingpoint:1;
+ BYTE privatedata:1;
+ BYTE extension:1;
+ // TODO: add more fields here when the flags above are set (they aren't very interesting...)
+
+ int bytes;
+ __int64 next;
+ };
+
+ struct trsechdr
+ {
+ BYTE table_id;
+ WORD section_syntax_indicator:1;
+ WORD zero:1;
+ WORD reserved1:2;
+ WORD section_length:12;
+ WORD transport_stream_id;
+ BYTE reserved2:2;
+ BYTE version_number:5;
+ BYTE current_next_indicator:1;
+ BYTE section_number;
+ BYTE last_section_number;
+ };
+
+ // http://www.technotrend.de/download/av_format_v1.pdf
+
+ struct pvahdr
+ {
+ WORD sync; // 'VA'
+ BYTE streamid; // 1 - video, 2 - audio
+ BYTE counter;
+ BYTE res1; // 0x55
+ BYTE res2:3;
+ BYTE fpts:1;
+ BYTE postbytes:2;
+ BYTE prebytes:2;
+ WORD length;
+ REFERENCE_TIME pts;
+ };
+
+ struct avchdr
+ {
+ BYTE profile, level;
+ unsigned int width, height;
+ };
+
+#pragma pack(pop)
+
+ bool Read(pshdr& h);
+ bool Read(pssyshdr& h);
+ bool Read(peshdr& h, BYTE code);
+ bool Read(seqhdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(mpahdr& h, int len, bool fAllowV25, CMediaType* pmt = NULL);
+ bool Read(aachdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(ac3hdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(dtshdr& h, int len, CMediaType* pmt = NULL);
+ bool Read(lpcmhdr& h, CMediaType* pmt = NULL);
+ bool Read(dvdspuhdr& h, CMediaType* pmt = NULL);
+ bool Read(svcdspuhdr& h, CMediaType* pmt = NULL);
+ bool Read(cvdspuhdr& h, CMediaType* pmt = NULL);
+ bool Read(ps2audhdr& h, CMediaType* pmt = NULL);
+ bool Read(ps2subhdr& h, CMediaType* pmt = NULL);
+ bool Read(trhdr& h, bool fSync = true);
+ bool Read(trsechdr& h);
+ bool Read(pvahdr& h, bool fSync = true);
+ bool Read(avchdr& h, int len, CMediaType* pmt = NULL);
+};
diff --git a/src/filters/parser/basesplitter/basesplitter.sln b/src/filters/parser/basesplitter/basesplitter.sln
new file mode 100644
index 000000000..6df4a1cd5
--- /dev/null
+++ b/src/filters/parser/basesplitter/basesplitter.sln
@@ -0,0 +1,23 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug lib = Debug lib
+ Debug Unicode lib = Debug Unicode lib
+ Release lib = Release lib
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/basesplitter/basesplitter.vcproj b/src/filters/parser/basesplitter/basesplitter.vcproj
new file mode 100644
index 000000000..065143d13
--- /dev/null
+++ b/src/filters/parser/basesplitter/basesplitter.vcproj
@@ -0,0 +1,265 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="basesplitter"
+ ProjectGUID="{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\AsyncReader.cpp">
+ </File>
+ <File
+ RelativePath="BaseSplitter.cpp">
+ </File>
+ <File
+ RelativePath=".\BaseSplitterFile.cpp">
+ </File>
+ <File
+ RelativePath=".\BaseSplitterFileEx.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\AsyncReader.h">
+ </File>
+ <File
+ RelativePath="BaseSplitter.h">
+ </File>
+ <File
+ RelativePath=".\BaseSplitterFile.h">
+ </File>
+ <File
+ RelativePath=".\BaseSplitterFileEx.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/basesplitter/basesplitter_vs2005.vcproj b/src/filters/parser/basesplitter/basesplitter_vs2005.vcproj
new file mode 100644
index 000000000..c282b4cd2
--- /dev/null
+++ b/src/filters/parser/basesplitter/basesplitter_vs2005.vcproj
@@ -0,0 +1,380 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="basesplitter"
+ ProjectGUID="{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ RootNamespace="basesplitter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\AsyncReader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="BaseSplitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseSplitterFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseSplitterFileEx.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\AsyncReader.h"
+ >
+ </File>
+ <File
+ RelativePath="BaseSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseSplitterFile.h"
+ >
+ </File>
+ <File
+ RelativePath=".\BaseSplitterFileEx.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/basesplitter/basesplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/basesplitter/basesplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..19de06174
--- /dev/null
+++ b/src/filters/parser/basesplitter/basesplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/basesplitter/stdafx.cpp b/src/filters/parser/basesplitter/stdafx.cpp
new file mode 100644
index 000000000..4c0a34f8e
--- /dev/null
+++ b/src/filters/parser/basesplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// basesplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/basesplitter/stdafx.h b/src/filters/parser/basesplitter/stdafx.h
new file mode 100644
index 000000000..dd0d28f25
--- /dev/null
+++ b/src/filters/parser/basesplitter/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/parser/diracsplitter/DiracSplitter.cpp b/src/filters/parser/diracsplitter/DiracSplitter.cpp
new file mode 100644
index 000000000..8aac877c1
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitter.cpp
@@ -0,0 +1,616 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include <initguid.h>
+#include "DiracSplitter.h"
+#include "..\..\..\..\include\moreuuids.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Dirac},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn2[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_DiracVideo},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut2[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins2[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn2), sudPinTypesIn2},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut2), sudPinTypesOut2}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CDiracSplitterFilter), L"Dirac Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins},
+ {&__uuidof(CDiracSourceFilter), L"Dirac Source", MERIT_NORMAL, 0, NULL},
+ {&__uuidof(CDiracVideoDecoder), L"Dirac Video Decoder", MERIT_UNLIKELY, countof(sudpPins2), sudpPins2},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDiracSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CDiracSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CDiracVideoDecoder>, NULL, &sudFilter[2]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_Dirac,
+ _T("0,8,,4B572D4449524143"), // KW-DIRAC
+ _T(".drc"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ UnRegisterSourceFilter(MEDIASUBTYPE_Dirac);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CDiracSplitterFilter
+//
+
+CDiracSplitterFilter::CDiracSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("CDiracSplitterFilter"), pUnk, phr, __uuidof(this))
+{
+}
+
+STDMETHODIMP CDiracSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CDiracSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ m_pFile.Attach(new CDiracSplitterFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ CAtlArray<CMediaType> mts;
+ mts.Add(m_pFile->GetMediaType());
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ AddOutputPin(0, pPinOut);
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetDuration();
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool CDiracSplitterFilter::DemuxInit()
+{
+ if(!m_pFile) return(false);
+
+ // TODO
+
+ return(true);
+}
+
+void CDiracSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ REFERENCE_TIME rtPreroll = 0; //10000000;
+
+ if(rt <= rtPreroll || m_rtDuration <= 0)
+ {
+ m_pFile->Seek(8);
+ }
+ else
+ {
+ // TODO
+
+ __int64 len = m_pFile->GetLength();
+ __int64 seekpos = (__int64)(1.0*rt/m_rtDuration*len);
+
+ m_pFile->Seek(seekpos);
+ seekpos = 8;
+
+ REFERENCE_TIME rtmax = rt - rtPreroll;
+ REFERENCE_TIME rtmin = rtmax - 5000000;
+
+ REFERENCE_TIME pdt = _I64_MIN;
+
+ for(int j = 0; j < 10; j++)
+ {
+ BYTE code = NOT_START_CODE;
+ while(m_pFile->Next(code) && code != IFRAME_START_CODE);
+ if(code != IFRAME_START_CODE) {m_pFile->Seek(seekpos >>= 1); continue;}
+
+ __int64 pos = m_pFile->GetPos() - 5;
+
+ REFERENCE_TIME rt = ((DIRACINFOHEADER*)m_pFile->GetMediaType().Format())->hdr.AvgTimePerFrame * m_pFile->UnsignedGolombDecode();
+ REFERENCE_TIME dt = rt - rtmax;
+ if(dt > 0 && dt == pdt) dt = 10000000i64;
+
+ if(rtmin <= rt && rt <= rtmax || pdt > 0 && dt < 0)
+ {
+ seekpos = pos;
+ break;
+ }
+
+ m_pFile->Seek(pos - (__int64)(1.0*dt/m_rtDuration*len));
+
+ pdt = dt;
+ }
+
+ m_pFile->Seek(seekpos);
+ }
+}
+
+bool CDiracSplitterFilter::DemuxLoop()
+{
+ HRESULT hr = S_OK;
+ REFERENCE_TIME rtAvgTimePerFrame = ((DIRACINFOHEADER*)m_pFile->GetMediaType().Format())->hdr.AvgTimePerFrame;
+
+ while(SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ BYTE code = NOT_START_CODE;
+ int size = 0, fnum = 0;
+ const BYTE* pBuff = m_pFile->NextBlock(code, size, fnum);
+ if(!pBuff || size < 5) break;
+
+ if(isFrameStartCode(code))
+ {
+ CAutoPtr<Packet> p(new Packet());
+ p->TrackNumber = 0;
+ p->rtStart = rtAvgTimePerFrame*fnum;
+ p->rtStop = p->rtStart + rtAvgTimePerFrame;
+ p->bSyncPoint = code == IFRAME_START_CODE;
+ p->SetData(pBuff, size);
+ hr = DeliverPacket(p);
+ }
+
+ if(code == SEQ_END_CODE)
+ break;
+ }
+
+ return(true);
+}
+
+//
+// CDiracSourceFilter
+//
+
+CDiracSourceFilter::CDiracSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CDiracSplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
+
+//
+// CDiracVideoDecoder
+//
+
+CDiracVideoDecoder::CDiracVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CDiracVideoDecoder"), lpunk, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+
+ m_decoder = NULL;
+ m_pYUV[0] = NULL;
+}
+
+CDiracVideoDecoder::~CDiracVideoDecoder()
+{
+ delete [] m_pYUV[0];
+}
+
+void CDiracVideoDecoder::InitDecoder()
+{
+ FreeDecoder();
+
+ dirac_decoder_t* decoder = dirac_decoder_init(0);
+
+ DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)m_pInput->CurrentMediaType().Format();
+ dirac_buffer(decoder, (BYTE*)&dvih->dwSequenceHeader[0], (BYTE*)&dvih->dwSequenceHeader[0] + dvih->cbSequenceHeader);
+
+ m_decoder = decoder;
+}
+
+void CDiracVideoDecoder::FreeDecoder()
+{
+ if(m_decoder)
+ {
+ dirac_decoder_close((dirac_decoder_t*)m_decoder);
+ m_decoder = NULL;
+ delete [] m_pYUV[0]; m_pYUV[0] = NULL;
+ }
+}
+
+HRESULT CDiracVideoDecoder::Receive(IMediaSample* pIn)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr;
+
+ AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
+ if(pProps->dwStreamId != AM_STREAM_MEDIA)
+ return m_pOutput->Deliver(pIn);
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+
+ long len = pIn->GetActualDataLength();
+ if(len <= 0) return S_OK; // nothing to do
+
+ if(pIn->IsDiscontinuity() == S_OK)
+ InitDecoder();
+
+ dirac_decoder_t* decoder = (dirac_decoder_t*)m_decoder;
+
+ hr = S_OK;
+ while(SUCCEEDED(hr))
+ {
+ switch(dirac_parse(decoder))
+ {
+ case STATE_BUFFER:
+ if(len == 0) return S_OK;
+ dirac_buffer(decoder, pDataIn, pDataIn + len);
+ len = 0;
+ break;
+
+ case STATE_SEQUENCE:
+ TRACE(_T("STATE_SEQUENCE\n"));
+
+ {
+ DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)m_pInput->CurrentMediaType().Format();
+ if(dvih->hdr.bmiHeader.biWidth != decoder->seq_params.width
+ || dvih->hdr.bmiHeader.biHeight != decoder->seq_params.height)
+ return E_FAIL; // hmm
+ }
+
+ if(!m_pYUV[0])
+ {
+ int w = decoder->seq_params.width;
+ int h = decoder->seq_params.height;
+ int wc = decoder->seq_params.chroma_width;
+ int hc = decoder->seq_params.chroma_height;
+ delete [] m_pYUV[0]; m_pYUV[0] = NULL;
+ m_pYUV[0] = new BYTE[w*h + wc*hc*2 + w/2*h/2];
+ m_pYUV[1] = m_pYUV[0] + w*h;
+ m_pYUV[2] = m_pYUV[1] + wc*hc;
+ m_pYUV[3] = m_pYUV[2] + wc*hc;
+ memset(m_pYUV[3], 0x80, w/2*h/2);
+ m_rtAvgTimePerFrame = 10000000i64 * decoder->seq_params.frame_rate.denominator / decoder->seq_params.frame_rate.numerator;
+ dirac_set_buf(decoder, m_pYUV, NULL);
+ }
+
+ break;
+
+ case STATE_SEQUENCE_END:
+ TRACE(_T("STATE_SEQUENCE_END\n"));
+ break;
+
+ case STATE_PICTURE_START:
+ TRACE(_T("STATE_PICTURE_START, frame_type=%d frame_num=%d\n"), decoder->frame_params.ftype, decoder->frame_params.fnum);
+ dirac_skip(decoder, (m_fDropFrames || decoder->frame_params.fnum * m_rtAvgTimePerFrame < m_tStart) && decoder->frame_params.ftype == L2_frame ? 1 : 0);
+ if(m_fDropFrames && decoder->frame_params.ftype == L2_frame) return S_OK;
+ break;
+
+ case STATE_PICTURE_AVAIL:
+ TRACE(_T("STATE_PICTURE_AVAIL, frame_type=%d frame_num=%d\n"), decoder->frame_params.ftype, decoder->frame_params.fnum);
+ hr = Deliver(pIn, decoder->frame_params.fnum * m_rtAvgTimePerFrame - m_tStart, (decoder->frame_params.fnum + 1) * m_rtAvgTimePerFrame - m_tStart);
+ break;
+
+ case STATE_INVALID:
+ TRACE(_T("STATE_INVALID\n"));
+ return E_FAIL; // TODO: can we recover from this state?
+ // break;
+
+ default:
+ TRACE(_T("unknown state\n"));
+ continue;
+ }
+ }
+
+ return hr;
+}
+
+HRESULT CDiracVideoDecoder::Deliver(IMediaSample* pIn, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop)
+{
+ CheckPointer(pIn, E_POINTER);
+
+ HRESULT hr;
+
+ if(pIn->IsPreroll() == S_OK || rtStart < 0)
+ return S_OK;
+
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ TRACE(_T("CDiracVideoDecoder::Deliver(%I64d, %I64d)\n"), rtStart, rtStop);
+
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
+
+ pOut->SetDiscontinuity(pIn->IsDiscontinuity() == S_OK);
+ pOut->SetSyncPoint(TRUE);
+
+ if(GetCLSID(m_pOutput->GetConnected()) == CLSID_OverlayMixer)
+ pOut->SetDiscontinuity(TRUE);
+
+ Copy(pDataOut);
+
+ return m_pOutput->Deliver(pOut);
+}
+
+void CDiracVideoDecoder::Copy(BYTE* pOut)
+{
+ // FIXME: modes other than I420 and Y-only
+
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+
+ dirac_decoder_t* decoder = (dirac_decoder_t*)m_decoder;
+
+ int w = decoder->seq_params.width;
+ int h = decoder->seq_params.height;
+ int wc = decoder->seq_params.chroma_width;
+ int hc = decoder->seq_params.chroma_height;
+
+ int pitchIn = w;
+
+ BYTE* pY = m_pYUV[0];
+ BYTE* pU = w/2 == wc && h/2 == hc ? m_pYUV[1] : m_pYUV[3]; // FIXME
+ BYTE* pV = w/2 == wc && h/2 == hc ? m_pYUV[2] : m_pYUV[3]; // FIXME
+
+ if(bihOut.biCompression == '2YUY')
+ {
+ BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth*2, pY, pU, pV, pitchIn);
+ }
+ else if(bihOut.biCompression == 'I420' || bihOut.biCompression == 'VUYI')
+ {
+ BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth*h, pOut + bihOut.biWidth*h*5/4, bihOut.biWidth, pY, pU, pV, pitchIn);
+ }
+ else if(bihOut.biCompression == '21VY')
+ {
+ BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth*h*5/4, pOut + bihOut.biWidth*h, bihOut.biWidth, pY, pU, pV, pitchIn);
+ }
+ else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ int pitchOut = bihOut.biWidth*bihOut.biBitCount>>3;
+
+ if(bihOut.biHeight > 0)
+ {
+ pOut += pitchOut*(h-1);
+ pitchOut = -pitchOut;
+ }
+
+ if(!BitBltFromI420ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, pY, pU, pV, pitchIn))
+ {
+ for(DWORD y = 0; y < h; y++, pOut += pitchOut)
+ memset(pOut, 0, pitchOut);
+ }
+ }
+}
+
+HRESULT CDiracVideoDecoder::CheckInputType(const CMediaType* mtIn)
+{
+ DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)mtIn->Format();
+
+ if(mtIn->majortype != MEDIATYPE_Video
+ || mtIn->subtype != MEDIASUBTYPE_DiracVideo
+ || mtIn->formattype != FORMAT_DiracVideoInfo
+ || (dvih->hdr.bmiHeader.biWidth&1) || (dvih->hdr.bmiHeader.biHeight&1))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ return S_OK;
+}
+
+HRESULT CDiracVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ if(m_pOutput && m_pOutput->IsConnected())
+ {
+ BITMAPINFOHEADER bih1, bih2;
+ if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
+ && abs(bih1.biHeight) != abs(bih2.biHeight))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_DiracVideo
+ && mtOut->majortype == MEDIATYPE_Video && (mtOut->subtype == MEDIASUBTYPE_YUY2
+ || mtOut->subtype == MEDIASUBTYPE_YV12
+ || mtOut->subtype == MEDIASUBTYPE_I420
+ || mtOut->subtype == MEDIASUBTYPE_IYUV
+ || mtOut->subtype == MEDIASUBTYPE_ARGB32
+ || mtOut->subtype == MEDIASUBTYPE_RGB32
+ || mtOut->subtype == MEDIASUBTYPE_RGB24
+ || mtOut->subtype == MEDIASUBTYPE_RGB565
+ || mtOut->subtype == MEDIASUBTYPE_RGB555)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CDiracVideoDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = bih.biSizeImage;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CDiracVideoDecoder::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ struct {const GUID* subtype; WORD biPlanes, biBitCount; DWORD biCompression;} fmts[] =
+ {
+ {&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
+ {&MEDIASUBTYPE_I420, 3, 12, '024I'},
+ {&MEDIASUBTYPE_IYUV, 3, 12, 'VUYI'},
+ {&MEDIASUBTYPE_YUY2, 1, 16, '2YUY'},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_RGB},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_BITFIELDS},
+ };
+
+ if(m_pInput->CurrentMediaType().formattype == FORMAT_VideoInfo)
+ iPosition = iPosition*2 + 1;
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= 2*countof(fmts)) return VFW_S_NO_MORE_ITEMS;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = *fmts[iPosition/2].subtype;
+
+ BITMAPINFOHEADER bihOut;
+ memset(&bihOut, 0, sizeof(bihOut));
+ bihOut.biSize = sizeof(bihOut);
+ bihOut.biWidth = bih.biWidth;
+ bihOut.biHeight = bih.biHeight;
+ bihOut.biPlanes = fmts[iPosition/2].biPlanes;
+ bihOut.biBitCount = fmts[iPosition/2].biBitCount;
+ bihOut.biCompression = fmts[iPosition/2].biCompression;
+ bihOut.biSizeImage = bih.biWidth*bih.biHeight*bihOut.biBitCount>>3;
+
+ if(iPosition&1)
+ {
+ pmt->formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->bmiHeader = bihOut;
+
+ if(m_pInput->CurrentMediaType().formattype == FORMAT_VideoInfo2)
+ {
+ vih->bmiHeader.biWidth = ((VIDEOINFOHEADER2*)m_pInput->CurrentMediaType().Format())->dwPictAspectRatioX;
+ vih->bmiHeader.biHeight = ((VIDEOINFOHEADER2*)m_pInput->CurrentMediaType().Format())->dwPictAspectRatioY;
+ vih->bmiHeader.biSizeImage = vih->bmiHeader.biWidth*vih->bmiHeader.biHeight*vih->bmiHeader.biBitCount>>3;
+ }
+ }
+ else
+ {
+ pmt->formattype = FORMAT_VideoInfo2;
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
+ memset(vih2, 0, sizeof(VIDEOINFOHEADER2));
+ vih2->bmiHeader = bihOut;
+ vih2->dwPictAspectRatioX = ((VIDEOINFOHEADER2*)m_pInput->CurrentMediaType().Format())->dwPictAspectRatioX;
+ vih2->dwPictAspectRatioY = ((VIDEOINFOHEADER2*)m_pInput->CurrentMediaType().Format())->dwPictAspectRatioY;
+ }
+
+ CorrectMediaType(pmt);
+
+ return S_OK;
+}
+
+HRESULT CDiracVideoDecoder::StartStreaming()
+{
+ InitDecoder();
+ return __super::StartStreaming();
+}
+
+HRESULT CDiracVideoDecoder::StopStreaming()
+{
+ FreeDecoder();
+ return __super::StopStreaming();
+}
+
+HRESULT CDiracVideoDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ m_fDropFrames = false;
+ m_tStart = tStart;
+
+ return __super::NewSegment(tStart, tStop, dRate);
+}
+
+HRESULT CDiracVideoDecoder::AlterQuality(Quality q)
+{
+ if(q.Late > 500*10000i64) m_fDropFrames = true;
+ if(q.Late <= 0) m_fDropFrames = false;
+ return E_NOTIMPL;
+} \ No newline at end of file
diff --git a/src/filters/parser/diracsplitter/DiracSplitter.def b/src/filters/parser/diracsplitter/DiracSplitter.def
new file mode 100644
index 000000000..f500d11ee
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "DiracSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/diracsplitter/DiracSplitter.h b/src/filters/parser/diracsplitter/DiracSplitter.h
new file mode 100644
index 000000000..a95b4acb5
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitter.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+#include "DiracSplitterFile.h"
+
+[uuid("5899CFB9-948F-4869-A999-5544ECB38BA5")]
+class CDiracSplitterFilter : public CBaseSplitterFilter
+{
+protected:
+ CAutoPtr<CDiracSplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+public:
+ CDiracSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+};
+
+[uuid("09E7F58E-71A1-419D-B0A0-E524AE1454A9")]
+class CDiracSourceFilter : public CDiracSplitterFilter
+{
+public:
+ CDiracSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
+
+[uuid("F78CF248-180E-4713-B107-B13F7B5C31E1")]
+class CDiracVideoDecoder : public CTransformFilter
+{
+ void* m_decoder; // dirac_decoder_t*
+ void InitDecoder(), FreeDecoder();
+ BYTE* m_pYUV[4];
+ bool m_fDropFrames;
+ REFERENCE_TIME m_tStart, m_rtAvgTimePerFrame;
+
+ HRESULT Deliver(IMediaSample* pIn, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop);
+ void Copy(BYTE* pOut);
+
+public:
+ CDiracVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CDiracVideoDecoder();
+
+ HRESULT Receive(IMediaSample* pIn);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
+
+ HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+ HRESULT AlterQuality(Quality q);
+}; \ No newline at end of file
diff --git a/src/filters/parser/diracsplitter/DiracSplitter.rc b/src/filters/parser/diracsplitter/DiracSplitter.rc
new file mode 100644
index 000000000..e31676ef0
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Dirac Splitter"
+ VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "InternalName", "Dirac Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "DiracSplitter.ax"
+ VALUE "ProductName", "Dirac Splitter"
+ VALUE "ProductVersion", "1, 0, 0, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/diracsplitter/DiracSplitter.sln b/src/filters/parser/diracsplitter/DiracSplitter.sln
new file mode 100644
index 000000000..aab435881
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitter.sln
@@ -0,0 +1,115 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DiracSplitter", "DiracSplitter.vcproj", "{ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {12BE3440-A1F3-4C48-A229-30CB619EA276} = {12BE3440-A1F3-4C48-A229-30CB619EA276}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601} = {6BA829DC-20C1-4B6B-BF63-7601FEB64601}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{6BA829DC-20C1-4B6B-BF63-7601FEB64601}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdirac", "libdirac\libdirac.vcproj", "{12BE3440-A1F3-4C48-A229-30CB619EA276}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug.ActiveCfg = Debug|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug lib.ActiveCfg = Debug lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release.ActiveCfg = Release|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release lib.ActiveCfg = Release lib|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug.ActiveCfg = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug.Build.0 = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug lib.ActiveCfg = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug lib.Build.0 = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release.ActiveCfg = Release|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release.Build.0 = Release|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release lib.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release lib.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug.ActiveCfg = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug.Build.0 = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug lib.ActiveCfg = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug lib.Build.0 = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode.ActiveCfg = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode.Build.0 = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Debug Unicode lib.Build.0 = Debug|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release.ActiveCfg = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release.Build.0 = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release lib.ActiveCfg = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release lib.Build.0 = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode.ActiveCfg = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode.Build.0 = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode lib.ActiveCfg = Release|Win32
+ {12BE3440-A1F3-4C48-A229-30CB619EA276}.Release Unicode lib.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/diracsplitter/DiracSplitter.vcproj b/src/filters/parser/diracsplitter/DiracSplitter.vcproj
new file mode 100644
index 000000000..b8e3fe3a1
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitter.vcproj
@@ -0,0 +1,570 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="DiracSplitter"
+ ProjectGUID="{ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib libdiracD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib libdiracR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib libdiracD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib libdiracR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="DiracSplitter.cpp">
+ </File>
+ <File
+ RelativePath="DiracSplitter.def">
+ </File>
+ <File
+ RelativePath=".\DiracSplitterFile.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\DiracSplitter.h">
+ </File>
+ <File
+ RelativePath=".\DiracSplitterFile.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\DiracSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/diracsplitter/DiracSplitterFile.cpp b/src/filters/parser/diracsplitter/DiracSplitterFile.cpp
new file mode 100644
index 000000000..e50857503
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitterFile.cpp
@@ -0,0 +1,153 @@
+#include "StdAfx.h"
+#include <mmreg.h>
+#include "DiracSplitterFile.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+CDiracSplitterFile::CDiracSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
+ , m_rtDuration(0)
+{
+ if(SUCCEEDED(hr)) hr = Init();
+ m_pBuff.SetCount(1024, 1024);
+}
+
+HRESULT CDiracSplitterFile::Init()
+{
+ HRESULT hr = E_FAIL;
+
+ Seek(0);
+
+ UINT64 hdr;
+ if(FAILED(ByteRead((BYTE*)&hdr, sizeof(hdr))) || hdr != 0x43415249442D574Bui64) // KW-DIRAC
+ return E_FAIL;
+
+ dirac_decoder_t* decoder = dirac_decoder_init(0);
+
+ __int64 limit = min(GetLength(), 2048);
+
+ while(GetPos() < limit)
+ {
+ BYTE b;
+ if(!Next(b)) {ASSERT(0); break;}
+
+ if(b == RAP_START_CODE)
+ {
+ __int64 pos = GetPos() - 5;
+ if(!Next(b)) {ASSERT(0); break;}
+ __int64 len = GetPos() - pos;
+ Seek(pos);
+
+ m_mt.majortype = MEDIATYPE_Video;
+ m_mt.subtype = MEDIASUBTYPE_DiracVideo;
+ m_mt.formattype = FORMAT_DiracVideoInfo;
+ m_mt.SetSampleSize(1);
+
+ DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)m_mt.AllocFormatBuffer(FIELD_OFFSET(DIRACINFOHEADER, dwSequenceHeader) + len);
+ memset(m_mt.Format(), 0, m_mt.FormatLength());
+
+ dvih->cbSequenceHeader = len - 5;
+ ByteRead((BYTE*)&dvih->dwSequenceHeader[0], len);
+
+ dirac_buffer(decoder, (BYTE*)&dvih->dwSequenceHeader[0], (BYTE*)&dvih->dwSequenceHeader[0] + len);
+ if(dirac_parse(decoder) != STATE_SEQUENCE) {ASSERT(0); break;}
+
+ if(decoder->seq_params.frame_rate.denominator)
+ dvih->hdr.AvgTimePerFrame = 10000000i64 * decoder->seq_params.frame_rate.denominator / decoder->seq_params.frame_rate.numerator;
+ dvih->hdr.bmiHeader.biSize = sizeof(dvih->hdr.bmiHeader);
+ dvih->hdr.bmiHeader.biWidth = decoder->seq_params.width;
+ dvih->hdr.bmiHeader.biHeight = decoder->seq_params.height;
+ dvih->hdr.bmiHeader.biCompression = m_mt.subtype.Data1;
+ dvih->hdr.dwInterlaceFlags = 0;
+ if(decoder->seq_params.interlace) dvih->hdr.dwInterlaceFlags |= AMINTERLACE_IsInterlaced;
+ if(decoder->seq_params.topfieldfirst) dvih->hdr.dwInterlaceFlags |= AMINTERLACE_Field1First;
+ dvih->hdr.dwPictAspectRatioX = dvih->hdr.bmiHeader.biWidth;
+ dvih->hdr.dwPictAspectRatioY = dvih->hdr.bmiHeader.biHeight;
+
+ m_rtDuration = 0;// dvih->hdr.AvgTimePerFrame * decoder->seq_params.num_frames; // WTF
+
+ hr = S_OK;
+
+ break;
+ }
+ }
+
+ dirac_decoder_close(decoder);
+
+ return hr;
+}
+
+UINT64 CDiracSplitterFile::UnsignedGolombDecode()
+{
+ int M = 0;
+ while(M < 64 && !BitRead(1))
+ M++;
+
+ UINT64 info = 0;
+ for(int i = 0; i < M; i++)
+ info |= BitRead(1) << i;
+
+ return (1ui64<<M)-1 + info;
+}
+
+bool CDiracSplitterFile::Next(BYTE& code, __int64 len)
+{
+ BitByteAlign();
+ UINT64 qw = -1;
+ do
+ {
+ if(len-- == 0 || GetPos() >= GetLength()) return(false);
+ qw = (qw << 8) | (BYTE)BitRead(8);
+ }
+ while((qw&0xffffffff00) != ((UINT64)START_CODE_PREFIX<<8));
+ code = (BYTE)(qw & 0xff);
+ return(true);
+}
+
+const BYTE* CDiracSplitterFile::NextBlock(BYTE& code, int& size, int& fnum)
+{
+ BYTE* pBuff = m_pBuff.GetData();
+ code = NOT_START_CODE;
+ size = 0;
+
+ // TODO: make sure we are at a start code right now
+
+ while(GetPos() < GetLength())
+ {
+ if(GetPos() <= GetLength() - 5)
+ {
+ UINT64 qw = BitRead(40, true);
+
+ if(size == 0)
+ {
+ if((qw & 0xffffffff00) == ((UINT64)START_CODE_PREFIX<<8) && (qw & 0xff) != NOT_START_CODE)
+ code = (BYTE)(qw & 0xff);
+
+ if(isFrameStartCode(code))
+ {
+ __int64 pos = GetPos();
+ Seek(pos + 5);
+ fnum = (int)UnsignedGolombDecode();
+ Seek(pos);
+ }
+ }
+ else
+ {
+ if((qw & 0xffffffff00) == ((UINT64)START_CODE_PREFIX<<8) && (qw & 0xff) != NOT_START_CODE)
+ break;
+ }
+ }
+
+ if(size >= m_pBuff.GetCount())
+ {
+ int newsize = max(1024, size*2);
+ m_pBuff.SetCount(newsize, newsize);
+ pBuff = m_pBuff.GetData();
+ }
+
+ pBuff[size++] = (BYTE)BitRead(8);
+ }
+
+ return pBuff;
+}
diff --git a/src/filters/parser/diracsplitter/DiracSplitterFile.h b/src/filters/parser/diracsplitter/DiracSplitterFile.h
new file mode 100644
index 000000000..d5ca63099
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitterFile.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\BaseSplitter\BaseSplitter.h"
+
+class CDiracSplitterFile : public CBaseSplitterFile
+{
+ CMediaType m_mt;
+ REFERENCE_TIME m_rtDuration;
+ CAtlArray<BYTE> m_pBuff;
+
+ HRESULT Init();
+
+public:
+ CDiracSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+
+ //using CBaseSplitterFile::Read;
+
+ bool Next(BYTE& code, __int64 len = -1);
+ const BYTE* NextBlock(BYTE& code, int& size, int& fnum);
+ UINT64 UnsignedGolombDecode();
+
+ const CMediaType& GetMediaType() {return m_mt;}
+ REFERENCE_TIME GetDuration() {return m_rtDuration;}
+};
diff --git a/src/filters/parser/diracsplitter/DiracSplitter_vs2005.vcproj b/src/filters/parser/diracsplitter/DiracSplitter_vs2005.vcproj
new file mode 100644
index 000000000..600334270
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitter_vs2005.vcproj
@@ -0,0 +1,829 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="DiracSplitter"
+ ProjectGUID="{ECB1B3B7-196D-4809-A5E2-6F65CDBB6CCA}"
+ RootNamespace="DiracSplitter"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="../../../../lib/libdiracD.lib"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="../../../../lib/libdiracR.lib"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="../../../../lib/libdiracD.lib"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="../../../../lib/libdiracR.lib"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib libdiracD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib libdiracR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib libdiracD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="./libdirac"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib libdiracR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="DiracSplitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="DiracSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath=".\DiracSplitterFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\DiracSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\DiracSplitterFile.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\DiracSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/diracsplitter/DiracSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/diracsplitter/DiracSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/diracsplitter/DiracSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/diracsplitter/libdirac/AUTHORS b/src/filters/parser/diracsplitter/libdirac/AUTHORS
new file mode 100644
index 000000000..cf9c665fe
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/AUTHORS
@@ -0,0 +1,36 @@
+ORIGINAL AUTHORS
+~~~~~~~~~~~~~~~~
+
+Thomas Davies, BBC Research and Development
+dirac@rd.bbc.co.uk
+
+CONTRIBUTORS
+~~~~~~~~~~~~
+(in no particular order)
+
+Richard Felton, BBC Research and Development
+dirac@rd.bbc.co.uk
+
+Scott Robert Ladd, Coyote Gulch Productions
+coyote@coyotegulch.com
+
+Stuart Cunningham, BBC Research and Development
+dirac@rd.bbc.co.uk
+
+Anuradha Suraparaju, BBC Research and Development
+dirac@rd.bbc.co.uk
+
+Chris Bowley, BBC Research and Development
+dirac@rd.bbc.co.uk
+
+Tim Borer, BBC Research and Development
+dirac@rd.bbc.co.uk
+
+Peter Meerwald
+pmeerw@users.sourceforge.net
+
+Steve Bearcroft
+bearcrsw@users.sourceforge.net
+
+Zen
+ogg@illiminable.com
diff --git a/src/filters/parser/diracsplitter/libdirac/COPYING b/src/filters/parser/diracsplitter/libdirac/COPYING
new file mode 100644
index 000000000..dec63d24d
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/COPYING
@@ -0,0 +1,1332 @@
+The Dirac software source code is licensed under the Mozilla Public License
+Version 1.1, which is included below. The provisions of this license allow
+for relicensing under other licenses, which are specified in the license
+preamble at the beginning of each source-code file. For the purposes of this
+distribution, the licenses under which relicensing is possible are uniformly
+specified to be the GNU Public License Version 2.0 and the GNU Lesser Public
+License Version 2.1. These may be downloaded from www.gnu.org/licenses; however
+copies are also provided in Annex A and Annex B to this document.
+
+
+ MOZILLA PUBLIC LICENSE
+ Version 1.1
+
+ ---------------
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+ Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+ the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original
+ Code, prior Modifications used by a Contributor, and the Modifications
+ made by that particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+ combination of the Original Code and Modifications, in each case
+ including portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+ accepted in the software development community for the electronic
+ transfer of data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+ Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified
+ as the Initial Developer in the Source Code notice required by Exhibit
+ A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+ portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+ extent possible, whether at the time of the initial grant or
+ subsequently acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+ substance or structure of either the Original Code or any previous
+ Modifications. When Covered Code is released as a series of files, a
+ Modification is:
+ A. Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+ previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+ which is described in the Source Code notice required by Exhibit A as
+ Original Code, and which, at the time of its release under this
+ License is not already Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+ hereafter acquired, including without limitation, method, process,
+ and apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+ making modifications to it, including all modules it contains, plus
+ any associated interface definition files, scripts used to control
+ compilation and installation of an Executable, or source code
+ differential comparisons against either the Original Code or another
+ well known, available Covered Code of the Contributor's choice. The
+ Source Code can be in a compressed or archival form, provided the
+ appropriate decompression or de-archiving software is widely available
+ for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+ exercising rights under, and complying with all of the terms of, this
+ License or a future version of this License issued under Section 6.1.
+ For legal entities, "You" includes any entity which controls, is
+ controlled by, or is under common control with You. For purposes of
+ this definition, "control" means (a) the power, direct or indirect,
+ to cause the direction or management of such entity, whether by
+ contract or otherwise, or (b) ownership of more than fifty percent
+ (50%) of the outstanding shares or beneficial ownership of such
+ entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Initial Developer to use, reproduce,
+ modify, display, perform, sublicense and distribute the Original
+ Code (or portions thereof) with or without Modifications, and/or
+ as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or
+ selling of Original Code, to make, have made, use, practice,
+ sell, and offer for sale, and/or otherwise dispose of the
+ Original Code (or portions thereof).
+
+ (c) the licenses granted in this Section 2.1(a) and (b) are
+ effective on the date Initial Developer first distributes
+ Original Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+ granted: 1) for code that You delete from the Original Code; 2)
+ separate from the Original Code; or 3) for infringements caused
+ by: i) the modification of the Original Code or ii) the
+ combination of the Original Code with other software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+ hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Contributor, to use, reproduce, modify,
+ display, perform, sublicense and distribute the Modifications
+ created by such Contributor (or portions thereof) either on an
+ unmodified basis, with other Modifications, as Covered Code
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or
+ selling of Modifications made by that Contributor either alone
+ and/or in combination with its Contributor Version (or portions
+ of such combination), to make, use, sell, offer for sale, have
+ made, and/or otherwise dispose of: 1) Modifications made by that
+ Contributor (or portions thereof); and 2) the combination of
+ Modifications made by that Contributor with its Contributor
+ Version (or portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+ effective on the date Contributor first makes Commercial Use of
+ the Covered Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+ granted: 1) for any code that Contributor has deleted from the
+ Contributor Version; 2) separate from the Contributor Version;
+ 3) for infringements caused by: i) third party modifications of
+ Contributor Version or ii) the combination of Modifications made
+ by that Contributor with other software (except as part of the
+ Contributor Version) or other devices; or 4) under Patent Claims
+ infringed by Covered Code in the absence of Modifications made by
+ that Contributor.
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+ governed by the terms of this License, including without limitation
+ Section 2.2. The Source Code version of Covered Code may be
+ distributed only under the terms of this License or a future version
+ of this License released under Section 6.1, and You must include a
+ copy of this License with every copy of the Source Code You
+ distribute. You may not offer or impose any terms on any Source Code
+ version that alters or restricts the applicable version of this
+ License or the recipients' rights hereunder. However, You may include
+ an additional document offering the additional rights described in
+ Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+ made available in Source Code form under the terms of this License
+ either on the same media as an Executable version or via an accepted
+ Electronic Distribution Mechanism to anyone to whom you made an
+ Executable version available; and if made available via Electronic
+ Distribution Mechanism, must remain available for at least twelve (12)
+ months after the date it initially became available, or at least six
+ (6) months after a subsequent version of that particular Modification
+ has been made available to such recipients. You are responsible for
+ ensuring that the Source Code version remains available even if the
+ Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+ file documenting the changes You made to create that Covered Code and
+ the date of any change. You must include a prominent statement that
+ the Modification is derived, directly or indirectly, from Original
+ Code provided by the Initial Developer and including the name of the
+ Initial Developer in (a) the Source Code, and (b) in any notice in an
+ Executable version or related documentation in which You describe the
+ origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+ intellectual property rights is required to exercise the rights
+ granted by such Contributor under Sections 2.1 or 2.2,
+ Contributor must include a text file with the Source Code
+ distribution titled "LEGAL" which describes the claim and the
+ party making the claim in sufficient detail that a recipient will
+ know whom to contact. If Contributor obtains such knowledge after
+ the Modification is made available as described in Section 3.2,
+ Contributor shall promptly modify the LEGAL file in all copies
+ Contributor makes available thereafter and shall take other steps
+ (such as notifying appropriate mailing lists or newsgroups)
+ reasonably calculated to inform those who received the Covered
+ Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+ interface and Contributor has knowledge of patent licenses which
+ are reasonably necessary to implement that API, Contributor must
+ also include this information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+ Section 3.4(a) above, Contributor believes that Contributor's
+ Modifications are Contributor's original creation(s) and/or
+ Contributor has sufficient rights to grant the rights conveyed by
+ this License.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+ Code. If it is not possible to put such notice in a particular Source
+ Code file due to its structure, then You must include such notice in a
+ location (such as a relevant directory) where a user would be likely
+ to look for such a notice. If You created one or more Modification(s)
+ You may add your name as a Contributor to the notice described in
+ Exhibit A. You must also duplicate this License in any documentation
+ for the Source Code where You describe recipients' rights or ownership
+ rights relating to Covered Code. You may choose to offer, and to
+ charge a fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Code. However, You
+ may do so only on Your own behalf, and not on behalf of the Initial
+ Developer or any Contributor. You must make it absolutely clear than
+ any such warranty, support, indemnity or liability obligation is
+ offered by You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred by the
+ Initial Developer or such Contributor as a result of warranty,
+ support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+ requirements of Section 3.1-3.5 have been met for that Covered Code,
+ and if You include a notice stating that the Source Code version of
+ the Covered Code is available under the terms of this License,
+ including a description of how and where You have fulfilled the
+ obligations of Section 3.2. The notice must be conspicuously included
+ in any notice in an Executable version, related documentation or
+ collateral in which You describe recipients' rights relating to the
+ Covered Code. You may distribute the Executable version of Covered
+ Code or ownership rights under a license of Your choice, which may
+ contain terms different from this License, provided that You are in
+ compliance with the terms of this License and that the license for the
+ Executable version does not attempt to limit or alter the recipient's
+ rights in the Source Code version from the rights set forth in this
+ License. If You distribute the Executable version under a different
+ license You must make it absolutely clear that any terms which differ
+ from this License are offered by You alone, not by the Initial
+ Developer or any Contributor. You hereby agree to indemnify the
+ Initial Developer and every Contributor for any liability incurred by
+ the Initial Developer or such Contributor as a result of any such
+ terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+ not governed by the terms of this License and distribute the Larger
+ Work as a single product. In such a case, You must make sure the
+ requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+ License with respect to some or all of the Covered Code due to
+ statute, judicial order, or regulation then You must: (a) comply with
+ the terms of this License to the maximum extent possible; and (b)
+ describe the limitations and the code they affect. Such description
+ must be included in the LEGAL file described in Section 3.4 and must
+ be included with all distributions of the Source Code. Except to the
+ extent prohibited by statute or regulation, such description must be
+ sufficiently detailed for a recipient of ordinary skill to be able to
+ understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has
+ attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+ and/or new versions of the License from time to time. Each version
+ will be given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+ License, You may always continue to use it under the terms of that
+ version. You may also choose to use such Covered Code under the terms
+ of any subsequent version of the License published by Netscape. No one
+ other than Netscape has the right to modify the terms applicable to
+ Covered Code created under this License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+ only do in order to apply it to code which is not already Covered Code
+ governed by this License), You must (a) rename Your license so that
+ the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
+ "MPL", "NPL" or any confusingly similar phrase do not appear in your
+ license (except to note that your license differs from this License)
+ and (b) otherwise make it clear that Your version of the license
+ contains terms which differ from the Mozilla Public License and
+ Netscape Public License. (Filling in the name of the Initial
+ Developer, Original Code or Contributor in the notice described in
+ Exhibit A shall not of themselves be deemed to be modifications of
+ this License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
+ DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
+ IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
+ YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
+ COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
+ OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and fail to cure
+ such breach within 30 days of becoming aware of the breach. All
+ sublicenses to the Covered Code which are properly granted shall
+ survive any termination of this License. Provisions which, by their
+ nature, must remain in effect beyond the termination of this License
+ shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+ claim (excluding declatory judgment actions) against Initial Developer
+ or a Contributor (the Initial Developer or Contributor against whom
+ You file such action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+ infringes any patent, then any and all rights granted by such
+ Participant to You under Sections 2.1 and/or 2.2 of this License
+ shall, upon 60 days notice from Participant terminate prospectively,
+ unless if within 60 days after receipt of notice You either: (i)
+ agree in writing to pay Participant a mutually agreeable reasonable
+ royalty for Your past and future use of Modifications made by such
+ Participant, or (ii) withdraw Your litigation claim with respect to
+ the Contributor Version against such Participant. If within 60 days
+ of notice, a reasonable royalty and payment arrangement are not
+ mutually agreed upon in writing by the parties or the litigation claim
+ is not withdrawn, the rights granted by Participant to You under
+ Sections 2.1 and/or 2.2 automatically terminate at the expiration of
+ the 60 day notice period specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+ Contributor Version, directly or indirectly infringes any patent, then
+ any rights granted to You by such Participant under Sections 2.1(b)
+ and 2.2(b) are revoked effective as of the date You first made, used,
+ sold, distributed, or had made, Modifications made by that
+ Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+ alleging that such Participant's Contributor Version directly or
+ indirectly infringes any patent where such claim is resolved (such as
+ by license or settlement) prior to the initiation of patent
+ infringement litigation, then the reasonable value of the licenses
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
+ into account in determining the amount or value of any payment or
+ license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above,
+ all end user license agreements (excluding distributors and resellers)
+ which have been validly granted by You or any distributor hereunder
+ prior to termination shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+ DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
+ OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
+ ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+ CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
+ WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
+ RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+ THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in
+ 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+ software" and "commercial computer software documentation," as such
+ terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
+ C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
+ all U.S. Government End Users acquire Covered Code with only those
+ rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the extent
+ necessary to make it enforceable. This License shall be governed by
+ California law provisions (except to the extent applicable law, if
+ any, provides otherwise), excluding its conflict-of-law provisions.
+ With respect to disputes in which at least one party is a citizen of,
+ or an entity chartered or registered to do business in the United
+ States of America, any litigation relating to this License shall be
+ subject to the jurisdiction of the Federal Courts of the Northern
+ District of California, with venue lying in Santa Clara County,
+ California, with the losing party responsible for costs, including
+ without limitation, court costs and reasonable attorneys' fees and
+ expenses. The application of the United Nations Convention on
+ Contracts for the International Sale of Goods is expressly excluded.
+ Any law or regulation which provides that the language of a contract
+ shall be construed against the drafter shall not apply to this
+ License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or indirectly,
+ out of its utilization of rights under this License and You agree to
+ work with Initial Developer and Contributors to distribute such
+ responsibility on an equitable basis. Nothing herein is intended or
+ shall be deemed to constitute any admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+ "Multiple-Licensed". "Multiple-Licensed" means that the Initial
+ Developer permits you to utilize portions of the Covered Code under
+ Your choice of the NPL or the alternative licenses, if any, specified
+ by the Initial Developer in the file described in Exhibit A.
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+ Version 1.1 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ License for the specific language governing rights and limitations
+ under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+ Portions created by ______________________ are Copyright (C) ______
+ _______________________. All Rights Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms
+ of the _____ license (the "[___] License"), in which case the
+ provisions of [______] License are applicable instead of those
+ above. If you wish to allow use of your version of this file only
+ under the terms of the [____] License and not to allow others to use
+ your version of this file under the MPL, indicate your decision by
+ deleting the provisions above and replace them with the notice and
+ other provisions required by the [___] License. If you do not delete
+ the provisions above, a recipient may use your version of this file
+ under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+ the notices in the Source Code files of the Original Code. You should
+ use the text of this Exhibit A rather than the text found in the
+ Original Code Source Code for Your Modifications.]
+
+ANNEX A: The GNU GENERAL PUBLIC LICENSE
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+ANNEX B : THE GNU LESSER GENERAL PUBLIC LICENSE
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+
diff --git a/src/filters/parser/diracsplitter/libdirac/ChangeLog b/src/filters/parser/diracsplitter/libdirac/ChangeLog
new file mode 100644
index 000000000..7423ae0dd
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/ChangeLog
@@ -0,0 +1,2235 @@
+2004-12-01 14:40 asuraparaju
+
+ * NEWS: Included 0.5.0 release notes
+
+2004-12-01 14:39 asuraparaju
+
+ * README: Updated Section 3 (Building and installing) to reflect
+ changes to building the codec under UNIX-like envoroments and MS
+ Windows. Added sub-section on how to build Dirac coder on MS
+ Windows platform using MS VC++ .NET 2003. Updated make_header
+ usage in the File Formats suc-section. Update encoder app usage
+ information.
+
+2004-12-01 14:35 asuraparaju
+
+ * README.developers: New sub-section on namespaces to be used in
+ Dirac. Added note on new test target 'valgrind-check'
+
+2004-12-01 14:32 asuraparaju
+
+ * TODO: Replaced contents with link to the TODO list on Dirac
+ homepage
+
+2004-12-01 14:13 timborer
+
+ * util/conversion/YUV420toRGB.cpp: Fixed bug 1050816.
+
+2004-11-29 12:54 asuraparaju
+
+ * libdirac_common/arith_codec.h, libdirac_common/arrays.h,
+ libdirac_common/band_codec.h, libdirac_common/bit_manager.h,
+ libdirac_common/common.h, libdirac_common/mot_comp.h,
+ libdirac_common/mv_codec.h, libdirac_common/pic_io.h,
+ libdirac_common/upconvert.h, libdirac_common/wavelet_utils.h,
+ libdirac_decoder/seq_decompress.h,
+ libdirac_encoder/seq_compress.h,
+ libdirac_motionest/downconvert.h,
+ libdirac_motionest/me_mode_decn.h,
+ libdirac_motionest/me_subpel.h: Fix warnings reported by doxygen
+
+2004-11-26 13:36 asuraparaju
+
+ * unit_tests/: frames_test.cpp, frames_test.h,
+ motion_comp_test.cpp, motion_comp_test.h: Unit test for Motion
+ Compensation
+
+2004-11-26 13:36 asuraparaju
+
+ * unit_tests/Makefile.am: Added Motion compensation unit test
+ related files to list of targets
+
+2004-11-26 13:28 asuraparaju
+
+ * configure.ac: Modified check for cppunit test framework to ensure
+ that it can run without errors. This was required because unit
+ tests fail when built with icc. This is a temporary measure until
+ it is determined why unit tests fail when built with icc on
+ linux.
+
+2004-11-26 13:23 asuraparaju
+
+ * AUTHORS: Updated list of contributors
+
+2004-11-26 13:22 asuraparaju
+
+ * Makefile.am: Removed win directory from distribution list as
+ build with nmake is no longer supported. Added win32 to list of
+ target subdirectories
+
+2004-11-26 13:13 asuraparaju
+
+ * win32/: Makefile.am, VS2003/Makefile.am, VS2003/dirac.sln,
+ VS2003/ConversionUtils/ConversionUtils.vcproj,
+ VS2003/ConversionUtils/BMPtoRGB/BMPtoRGB.vcproj,
+ VS2003/ConversionUtils/RGBtoBMP/RGBtoBMP.vcproj,
+ VS2003/ConversionUtils/RGBtoUYVY/RGBtoUYVY.vcproj,
+ VS2003/ConversionUtils/RGBtoYUV411/RGBtoYUV411.vcproj,
+ VS2003/ConversionUtils/RGBtoYUV420/RGBtoYUV420.vcproj,
+ VS2003/ConversionUtils/RGBtoYUV422/RGBtoYUV422.vcproj,
+ VS2003/ConversionUtils/RGBtoYUV444/RGBtoYUV444.vcproj,
+ VS2003/ConversionUtils/UYVYtoRGB/UYVYtoRGB.vcproj,
+ VS2003/ConversionUtils/YUV411toRGB/YUV411toRGB.vcproj,
+ VS2003/ConversionUtils/YUV420toRGB/YUV420toRGB.vcproj,
+ VS2003/ConversionUtils/YUV422toRGB/YUV422toRGB.vcproj,
+ VS2003/ConversionUtils/YUV444toRGB/YUV444toRGB.vcproj,
+ VS2003/ConversionUtils/libconv_common/libconv_common.vcproj,
+ VS2003/DecodeDirac/DecodeDirac.vcproj,
+ VS2003/DiracDecoder/DiracDecoder.vcproj,
+ VS2003/DiracDecoder/libdirac_decoder/libdirac_decoder.vcproj,
+ VS2003/DiracEncoder/DiracEncoder.vcproj,
+ VS2003/DiracEncoder/libdirac_encoder/libdirac_encoder.vcproj,
+ VS2003/EncodeDirac/EncodeDirac.vcproj,
+ VS2003/Everything/Everything.vcproj,
+ VS2003/InstrumentDirac/InstrumentDirac.vcproj,
+ VS2003/InstrumentDirac/libdirac_instrument/libdirac_instrument.vcproj,
+ VS2003/MakeHeader/MakeHeader.vcproj,
+ VS2003/libdirac_common/libdirac_common.vcproj,
+ VS2003/libdirac_motionest/libdirac_motionest.vcproj: Solution and
+ Project files for building Dirac using MS Visual Studio 2003
+
+2004-11-25 13:42 asuraparaju
+
+ * decoder/decmain.cpp, encoder/encmain.cpp: Modified to use only
+ public API and none of the C++ classes
+
+2004-11-25 13:41 asuraparaju
+
+ * libdirac_common/dirac_types.h: Turn off _declspec for non-windows
+ builds and windows static builds
+
+2004-11-24 11:41 tjdwave
+
+ * doc/algorithm/rdo_mot_est.htm: Remaining mods to algorithmic
+ docs.
+
+2004-11-24 11:27 tjdwave
+
+ * doc/algorithm/: algorithm.htm, const_qual.htm, intra_pred.htm,
+ intro.htm, quantisation.htm, subband_rdo.htm: Mods to algorithm
+ docs; intra_pred.htm removed.
+
+2004-11-22 14:15 asuraparaju
+
+ * AUTHORS: Updated list of contributors.
+
+2004-11-22 14:05 asuraparaju
+
+ * libdirac_common/band_codec.cpp, libdirac_common/band_codec.h,
+ libdirac_common/cmd_line.cpp, libdirac_common/cmd_line.h,
+ libdirac_common/common_types.h,
+ libdirac_common/dirac_assertions.h, libdirac_common/frame.h,
+ libdirac_common/golomb.cpp, libdirac_common/golomb.h,
+ libdirac_common/mv_codec.cpp, libdirac_common/mv_codec.h,
+ libdirac_common/wavelet_utils.cpp,
+ libdirac_decoder/comp_decompress.cpp,
+ libdirac_decoder/comp_decompress.h,
+ libdirac_decoder/dirac_cppparser.cpp,
+ libdirac_decoder/dirac_cppparser.h,
+ libdirac_decoder/frame_decompress.h,
+ libdirac_decoder/seq_decompress.h,
+ libdirac_encoder/comp_compress.h,
+ libdirac_encoder/quality_monitor.cpp,
+ libdirac_encoder/quality_monitor.h,
+ libdirac_motionest/block_match.cpp,
+ libdirac_motionest/block_match.h,
+ libdirac_motionest/downconvert.cpp,
+ libdirac_motionest/downconvert.h,
+ libdirac_motionest/me_mode_decn.h,
+ libdirac_motionest/me_subpel.cpp, libdirac_motionest/me_subpel.h,
+ libdirac_motionest/me_utils.h,
+ libdirac_motionest/motion_estimate.cpp,
+ libdirac_motionest/motion_estimate.h,
+ libdirac_motionest/pixel_match.cpp,
+ libdirac_motionest/pixel_match.h: Added namespace support. All
+ core Dirac functionality is now in namespace dirac.
+
+2004-11-22 13:58 asuraparaju
+
+ * bootstrap: Added libtool support
+
+2004-11-22 13:57 asuraparaju
+
+ * dirac.pc.in: After the library restructuring, only two libraries
+ are required - the encoder and decoder libraries.
+
+2004-11-22 13:57 asuraparaju
+
+ * configure.ac: Added libtool support to build libraries.
+
+2004-11-22 13:56 asuraparaju
+
+ * INSTALL: Minor changes related to the main configure file and the
+ flags to use
+
+2004-11-22 13:56 asuraparaju
+
+ * README: Added descrition of additional flags available at
+ configure time
+
+2004-11-22 13:54 asuraparaju
+
+ * decoder/Makefile.am, encoder/Makefile.am,
+ libdirac_common/Makefile.am, libdirac_decoder/Makefile.am,
+ libdirac_encoder/Makefile.am, libdirac_motionest/Makefile.am,
+ util/conversion/common/Makefile.am,
+ util/instrumentation/Makefile.am,
+ util/instrumentation/libdirac_instrument/Makefile.am: Instead of
+ 4 libraries only two libraries are now built and installed -
+ libdirac_encoder and libdirac_decoder. Only the public "C" API
+ headers and libraries are copied to the installation directories
+ when 'make install' is used. Now using libtool to build
+ libraries. On GNU/Linux and UNIX-like platforms, shared and
+ static versions of the exported libraries are built. On MS
+ Windows platforms, only shared libraries or static libraries can
+ be built but not both.
+
+2004-11-22 13:51 asuraparaju
+
+ * tests/: Makefile.am, colourbars.at, unittests.at: Added valgrind
+ support while running tests. The 'make valgrind-check' command
+ now runs valgrind memory checks on all the tests. Note that the
+ tests take a very long time to run in this mode
+
+2004-11-22 13:50 asuraparaju
+
+ * util/: Makefile.am, conversion/Makefile.am: Include Id tag to
+ track revisions.
+
+2004-11-22 13:48 asuraparaju
+
+ * doc/: Makefile.am, algorithm/Makefile.am, api/Makefile.am,
+ programmers/Makefile.am: Included the Id tag to track revisions.
+
+2004-11-22 13:46 asuraparaju
+
+ * Makefile.am: Added support for 'valgrind-check' argument to make.
+
+2004-11-22 13:42 asuraparaju
+
+ * util/instrumentation/libdirac_instrument/: draw_overlay.cpp,
+ draw_overlay.h, gm_inliers.cpp, gm_inliers.h, motion_arrows.cpp,
+ motion_arrows.h, motion_colour.cpp, motion_colour.h,
+ motion_colour_arrows.cpp, motion_colour_arrows.h, overlay.cpp,
+ overlay.h, overlay_symbols.cpp, overlay_symbols.h, pred_mode.cpp,
+ pred_mode.h, sad.cpp, sad.h, split_mode.cpp, split_mode.h: Fixed
+ "invalid read" and "memory leak" errors reported by valgrind.
+ Added namespace support. All instrumentation library
+ functionality is in the namespace dirac_instr.
+
+2004-11-22 13:39 asuraparaju
+
+ * util/instrumentation/: process_sequence.cpp, process_sequence.h:
+ Replace all refrences to PicInput and PicOutput classes with
+ FileStreamInput and FileStreamOutput classes. m_zl (number of
+ frames in sequence) is no longer part of the Sequence header.
+ Changed function ProcessSequence::DoSequence to work around this.
+
+2004-11-22 13:39 asuraparaju
+
+ * util/instrumentation/instrmain.cpp: Replaces all references to
+ PicInput and PicOutput classes with FileStreamInput and
+ FileStreamOutput classes.
+
+2004-11-22 13:37 asuraparaju
+
+ * picheader/: Makefile.am, headmain.cpp: Number of frames in a
+ sequence is no longer required in encode/decode operations.
+
+2004-11-22 13:36 asuraparaju
+
+ * libdirac_encoder/: seq_compress.cpp, seq_compress.h: Restructured
+ SequenceCompressor class to separate frame loading and frame
+ compression functionality into two different functions. This was
+ necessary to implement the "C" interface to the encoder. Added
+ new access functions, GetFrameEncoded and GetMEData(), to return
+ the latest frame encoded and the motion estimation data
+ associated with it. Added function EndSequence that writes end of
+ sequence information the the output bitstream. Added namespace
+ support. All core Dirac functionality is now in namespace dirac.
+
+2004-11-22 13:35 asuraparaju
+
+ * libdirac_encoder/: frame_compress.cpp, frame_compress.h: Motion
+ Estimation data is no longer written to a file. Instead, added
+ new functions, IsMEDataAvail and GetMEdata, to enable class user
+ to access the Motion Estimation data. Added namespace support.
+ All core Dirac functionality is now in namespace dirac.
+
+2004-11-22 13:34 asuraparaju
+
+ * libdirac_encoder/comp_compress.cpp: Allowed a full range of
+ quantisers, so that lossless coding is possible. Replaced tabs
+ with spaces. Fixed MSVC++ compiler warnings. Added namespace
+ support.
+
+2004-11-22 13:33 asuraparaju
+
+ * libdirac_decoder/seq_decompress.cpp: Removed all depedency on the
+ m_zl (number of frames in sequence) parameter in the sequence
+ parameters which no longer exists.
+
+2004-11-22 13:32 asuraparaju
+
+ * decoder/decmain.cpp, libdirac_decoder/dirac_parser.cpp,
+ libdirac_decoder/dirac_parser.h: Moved structures common to the
+ encoder and decoder "C" interfaces into
+ librac_common/dirac_types.h
+
+2004-11-22 13:30 asuraparaju
+
+ * libdirac_common/bit_manager.h: Updated the bit stream version
+ since the the bitstream in release 0.5.0 differs from the
+ bitstream in version 0.4.x. Added namespace support. All core
+ Dirac functionality is now in namespace dirac.
+
+2004-11-22 13:29 asuraparaju
+
+ * libdirac_common/: frame_buffer.cpp, frame_buffer.h: FrameBuffer
+ functions now support all io classes derived from the abstract
+ pic io classes StreamPicInput and StreamPicOutput Added namespace
+ support. All core Dirac functionality is now in namespace dirac.
+
+2004-11-22 13:29 asuraparaju
+
+ * libdirac_common/: pic_io.cpp, pic_io.h: Restructured the PicIO
+ classes so that in addition to file io streams, memory based io
+ streams are also supported. Replaced PicInput and PicOutput
+ classes with FileStreamInput and FileStreamOutput classes.
+
+2004-11-22 13:28 asuraparaju
+
+ * libdirac_common/dirac_assertions.cpp: Modified dirac_assert
+ function always dump core irrespetive of whether the code was
+ built in debug mode or release mode. Added namespace support.
+ All core Dirac functionality is now in namespace dirac.
+
+2004-11-22 13:26 asuraparaju
+
+ * unit_tests/: core_suite.h, cppunit_testsuite.cpp, utmain.cpp:
+ Added licence declaration.
+
+2004-11-22 13:25 asuraparaju
+
+ * unit_tests/Makefile.am: Added wavelet transform test.
+
+2004-11-22 13:24 asuraparaju
+
+ * unit_tests/: arrays_test.cpp, arrays_test.h: Added unit test for
+ TwoDArray value constructor.
+
+2004-11-22 13:22 asuraparaju
+
+ * README.developers: Added text on bootstrapping to create the
+ configure script from the CVS repository. Also added text on how
+ to profile the code.
+
+2004-11-22 13:21 asuraparaju
+
+ * libdirac_common/frame.cpp: Modified clipping so that overshoots
+ are allowed wrt Rec 601 ranges. This is because the original data
+ may have overshoots too. Added namespace support. All core Dirac
+ functionality is now in namespace dirac.
+
+2004-11-22 13:20 asuraparaju
+
+ * libdirac_motionest/: me_mode_decn.cpp, me_utils.cpp: Minor code
+ tidy. Assignment = changed to copy construction for a number of
+ declarations. Added namespace support. All core Dirac
+ functionality is now in namespace dirac.
+
+2004-11-22 13:19 asuraparaju
+
+ * libdirac_decoder/frame_decompress.cpp: Changes related to
+ MotionCompensator constructor changes. Added namespace support.
+ All core Dirac functionality is now in namespace dirac.
+
+2004-11-22 13:16 asuraparaju
+
+ * libdirac_common/: arith_codec.h, arrays.h, bit_manager.cpp,
+ mot_comp.cpp, mot_comp.h, motion.cpp, motion.h, wavelet_utils.h:
+ Added constant-value constructor to arrays.h. Removed motion
+ compensation-specific functions from motion.h. Refactored
+ mot_comp.h for speed and to remove rounding errors, incorporating
+ patch supplied by Stephen Bearcroft. Also changed function for
+ computing overlapped block weights to remove potential rounding
+ errors here. Changed constructor to configure motion
+ compensation for addition or subtraction. Added namespace
+ support. All core Dirac functionality is now in namespace dirac.
+
+2004-11-22 13:13 asuraparaju
+
+ * encoder/encmain.cpp: Modified the encoder to use the new Encoder
+ Public API.
+
+2004-11-22 13:11 asuraparaju
+
+ * libdirac_common/: common.cpp, common.h: Enforced a maximum of
+ 100% overlap in setting block sizes. Removed m_zl (number of
+ frames) parameter from SeqParams class. The user need no longer
+ to specify the number of frames in the input sequence. Added new
+ functions ChromaWidth and ChromaHeight to SeqParams class which
+ return the width and height of the chroma component. Changed
+ m_output_path in EncParams to var type std::string to prevent
+ buffer overflow errors. Added namespace support. All core Dirac
+ functionality is now in namespace dirac.
+
+2004-11-22 13:09 asuraparaju
+
+ * libdirac_common/: upconvert.cpp, upconvert.h: Fixed bug in
+ interpolating at the edge of the picture. Also clarified variable
+ names. Added namespace support. All core Dirac functionality is
+ now in namespace dirac.
+
+2004-11-22 13:07 asuraparaju
+
+ * unit_tests/: wavelet_utils_test.cpp, wavelet_utils_test.h: Unit
+ test to test the Wavelet utilities
+
+2004-11-22 13:06 asuraparaju
+
+ * tests/at_wrap.in: Wrapper script around tests to use valgrind for
+ memory checks
+
+2004-11-22 13:05 asuraparaju
+
+ * libdirac_encoder/: dirac_encoder.cpp, dirac_encoder.h: Encoder
+ "C" Public API implementation files
+
+2004-11-22 13:04 asuraparaju
+
+ * libdirac_common/dirac_types.h: New header file to hold structures
+ common to the Dirac Encoder and Decoder public "C" API
+
+2004-11-04 12:54 asuraparaju
+
+ * encoder/encmain.cpp: Setting original frame dimensions to
+ codec_params for global motion
+
+2004-11-04 12:54 asuraparaju
+
+ * libdirac_common/arrays.h: Applied patch 1055707 and extended it
+ to use memcpy for assigment = and copy constructor in both One-D
+ and Two-D arrays.
+
+2004-11-04 12:53 asuraparaju
+
+ * libdirac_common/common.h: Including original frame dimensions in
+ codec_params for use in global motion
+
+2004-11-04 12:53 asuraparaju
+
+ * libdirac_common/: motion.cpp, motion.h: Including arrays to hold
+ global motion data in MvData and MEData
+
+2004-11-04 12:52 asuraparaju
+
+ * libdirac_common/: wavelet_utils.cpp, wavelet_utils.h: Refactored
+ wavelet transform (again). Code now does re-ordering separately
+ so that all the wavelet lifting stages can be done with in-place
+ calculation. All loops traverse contiguous data in memory to
+ facilitate future vectorisation.
+
+2004-11-04 12:52 asuraparaju
+
+ * libdirac_encoder/comp_compress.cpp: Fixed bug 1055692 which was
+ caused by integer overflow when calculating the quality based on
+ 4th powers of error. The integer overflow resulted in attempting
+ to determine the square root of a negative number which caused
+ the encoder to go into a permanent loop when using gcc 3.4.2.
+ Modified the Mean Square Error calculation to use double instead
+ of int type to fix this bug.
+
+2004-11-04 12:52 asuraparaju
+
+ * libdirac_motionest/me_utils.cpp: Applied patch 1055714. Now the
+ Difference calculator uses a CalcValueType accumulator rather
+ than float.
+
+2004-11-04 12:50 asuraparaju
+
+ * util/instrumentation/: instrmain.cpp,
+ libdirac_instrument/Makefile.am,
+ libdirac_instrument/gm_inliers.cpp,
+ libdirac_instrument/gm_inliers.h,
+ libdirac_instrument/overlay.cpp, libdirac_instrument/overlay.h:
+ Update instrumentation with changes related to handling global
+ motion
+
+2004-10-21 15:27 asuraparaju
+
+ * libdirac_common/motion.cpp: Fix "invalid write error" reported by
+ valgrind in function MEData::FindTransitions. This was causing
+ the encoder to seg fault when using video of size 352x576. (Bug#
+ 1050757)
+
+2004-10-21 15:26 asuraparaju
+
+ * libdirac_motionest/motion_estimate.cpp: Fix the error reported by
+ valgrind in SetChromaDC where an unitialised variable was being
+ used to initialise dcarray.
+
+2004-10-20 18:27 asuraparaju
+
+ * libdirac_motionest/block_match.cpp: Code tidy
+
+2004-10-20 18:26 asuraparaju
+
+ * libdirac_encoder/quality_monitor.h: Broke up extremely long
+ function prototype into multiple lines
+
+2004-10-20 18:24 asuraparaju
+
+ * libdirac_encoder/quality_monitor.cpp: Introduced clipping of the
+ feedback control signal to reduce overshoots due to inaccuracies
+ in the model.
+
+2004-10-20 18:23 asuraparaju
+
+ * libdirac_decoder/: frame_decompress.cpp, frame_decompress.h:
+ Fixed memory leak (Bug# 1044503)
+
+2004-10-20 18:21 asuraparaju
+
+ * libdirac_decoder/dirac_parser.cpp: Fixed memory leak (Bug#
+ 1044501)
+
+2004-10-20 18:20 asuraparaju
+
+ * libdirac_common/mot_comp.cpp: Fixed memory leak (Bug #1044499)
+
+2004-10-20 18:18 asuraparaju
+
+ * libdirac_common/band_codec.cpp: Added max value for the number of
+ symbols to be accumulated between resets. Prevents overflow in
+ the arithmetic coder.
+
+2004-10-20 18:17 asuraparaju
+
+ * encoder/encmain.cpp: Changed GOP structure for 720p to be 24,3
+ not 24,6
+
+2004-10-20 18:16 asuraparaju
+
+ * decoder/decmain.cpp: Fixed memory leak caused by not freeing up
+ frame buffer that was dynamically allocated
+
+2004-09-21 13:58 asuraparaju
+
+ * NEWS: Included 0.4.3 release notes
+
+2004-09-21 13:45 asuraparaju
+
+ * configure.ac: Updated release id to 0.4.3
+
+2004-09-21 11:56 asuraparaju
+
+ * encoder/encmain.cpp: Removed ambiguity between -HD720 and HD720p
+ options.
+
+2004-09-21 11:16 asuraparaju
+
+ * util/instrumentation/libdirac_instrument/overlay.cpp: Fixed bug
+ in setting x chroma factor for 4:1:1 input which caused the
+ diagnostics tool to crash.
+
+2004-09-21 11:15 asuraparaju
+
+ * libdirac_motionest/: downconvert.cpp, downconvert.h: Fixed bug
+ where downconverting a picture with odd valued dimensions.
+
+2004-09-21 11:14 asuraparaju
+
+ * libdirac_encoder/: quality_monitor.cpp, quality_monitor.h: Tidied
+ and changed terminology to refer to quality rather than PSNR.
+
+2004-09-21 11:14 asuraparaju
+
+ * libdirac_common/: common.cpp, common.h: Fixed bug with block
+ sizes for 411 coding.
+
+2004-09-21 11:14 asuraparaju
+
+ * doc/algorithm/: algorithm.htm, const_qual.htm, subband_rdo.htm:
+ Added detail of the constant quality coding revisions. Updated
+ version number.
+
+2004-09-17 16:46 asuraparaju
+
+ * libdirac_motionest/: block_match.cpp, me_mode_decn.cpp,
+ me_subpel.cpp, me_subpel.h, motion_estimate.cpp: Changed
+ structure to use a map for the different lambdas, which is
+ encpasulated in the MEData structure. Limited size of motion
+ vector costs to allow us to cope with motion transitions better.
+
+2004-09-17 16:44 asuraparaju
+
+ * libdirac_encoder/: comp_compress.cpp, frame_compress.cpp,
+ quality_monitor.cpp, quality_monitor.h: Changed quality metric
+ from PSNR to one based on 4th powers of errors, to give bigger
+ weighting to large errors.
+
+2004-09-17 16:43 asuraparaju
+
+ * libdirac_common/: common.h, frame.cpp, frame_buffer.cpp,
+ mot_comp.cpp, mot_comp.h, motion.cpp, motion.h,
+ wavelet_utils.cpp: Fixed bug with scaling motion vectors for
+ non-444 formats. Rationalised frame buffer functions. Added
+ comments to common.h. General tidying up of code.
+
+2004-09-10 14:05 asuraparaju
+
+ * NEWS: Included 0.4.2 release notes
+
+2004-09-10 14:04 asuraparaju
+
+ * configure.ac: Updated release id to 0.4.2
+
+2004-09-10 12:34 asuraparaju
+
+ * libdirac_common/pic_io.h, encoder/encmain.cpp: Ensure that the
+ number of frame in the output pic header is set to the number of
+ frames written to the file.
+
+2004-09-10 11:06 asuraparaju
+
+ * Makefile.am: Only Makefile and README from win directory are now
+ included in distribution
+
+2004-09-09 15:48 asuraparaju
+
+ * util/instrumentation/: process_sequence.cpp,
+ libdirac_instrument/draw_overlay.cpp,
+ libdirac_instrument/draw_overlay.h,
+ libdirac_instrument/overlay.cpp, libdirac_instrument/overlay.h:
+ Fixed bug with handling reference 2 when only one reference frame
+ is available
+
+2004-09-09 15:43 asuraparaju
+
+ * util/instrumentation/libdirac_instrument/split_mode.cpp: Fix
+ writng beyond end of array bug which caused the diagnostics tool
+ to crash when using split_mode.
+
+2004-09-09 15:42 asuraparaju
+
+ * util/instrumentation/README: Correct pathname to diagnostic tool
+
+2004-09-09 15:41 asuraparaju
+
+ * libdirac_encoder/seq_compress.cpp: Fixed bug with bit-rate being
+ miscalculated when only a section of the sequence is encoded.
+
+2004-09-09 15:40 asuraparaju
+
+ * libdirac_encoder/frame_compress.cpp: Restored mod which outputs
+ array dimensions for instrumentation output.
+
+2004-09-09 15:39 asuraparaju
+
+ * libdirac_common/wavelet_utils.cpp: Fixed bug with setting DC band
+ perceptual weight.
+
+2004-09-09 15:39 asuraparaju
+
+ * encoder/encmain.cpp: Fixed bug with setting length of output
+ sequence when coding a section of picture.
+
+2004-09-09 15:38 asuraparaju
+
+ * decoder/decmain.cpp: Print average frame decode time to stdout
+ instead of stderr so that stderr can be monitored for errors in
+ tests
+
+2004-09-09 15:37 asuraparaju
+
+ * configure.ac: Add diagnostic tool to test path
+
+2004-09-09 15:36 asuraparaju
+
+ * README.release: Add testing diagnostic tool to release checklist
+
+2004-08-26 12:05 asuraparaju
+
+ * NEWS: Included 0.4.1 release notes
+
+2004-08-26 12:02 asuraparaju
+
+ * configure.ac: Updated release id to 0.4.1
+
+2004-08-25 17:58 asuraparaju
+
+ * decoder/Makefile.am, encoder/Makefile.am,
+ libdirac_common/Makefile.am, libdirac_decoder/Makefile.am,
+ libdirac_encoder/Makefile.am, libdirac_motionest/Makefile.am,
+ picheader/Makefile.am, unit_tests/Makefile.am,
+ util/conversion/Makefile.am, util/conversion/common/Makefile.am,
+ util/instrumentation/Makefile.am,
+ util/instrumentation/libdirac_instrument/Makefile.am: Build under
+ windows using gnu autotools, MSys as a shell and the no-cost MS
+ VC++ 2003 compiler now supported.
+
+2004-08-25 17:56 asuraparaju
+
+ * configure.ac: Fixed bug in configure where configure passed but
+ make unit_tests failed when a version of cppunit older that
+ 1.10.2 is installed. Build under windows using gnu
+ autotools, MSys as a shell and MS C++ compiler 7.1 (free version)
+ now supported.
+
+2004-08-25 17:55 asuraparaju
+
+ * tests/Makefile.am: Set up CLEANFILES to the files created by
+ encoder and decoder so that they are deleted during 'make clean'
+ instead of manually deleting them.
+
+2004-08-25 17:54 asuraparaju
+
+ * README.release: Added compile and test under windows using MSYS
+ and cl to checklist Included updating project page on
+ www.freshmeat.net in check list. Corrected line numbering and
+ added note to send email to dirac-announce mailing list.
+
+2004-08-25 17:52 asuraparaju
+
+ * README: Added a section on compiling using MSYS shell and VC++
+ 2003 compiler under windows. Replaced all tabas with spaces.
+ Reformatted text to not exceed 80 chars per line.
+
+2004-08-25 17:51 asuraparaju
+
+ * doc/dirac_bitstream.txt: Fixed error concerning prefix codes.
+
+2004-08-25 17:51 asuraparaju
+
+ * encoder/encmain.cpp: Removed duplicate text output. Fixed char
+ buffer overflow bug which causes encoder to fail when file name
+ paths exceed 80 chars.
+
+2004-08-25 17:50 asuraparaju
+
+ * libdirac_common/common.h: Fixed bug where SeqParams.Interlace()
+ was returning the chroma format instead of interlace.
+
+2004-08-25 17:48 asuraparaju
+
+ * libdirac_common/pic_io.cpp: Removed text output if we've run out
+ of input.
+
+2004-08-25 17:47 asuraparaju
+
+ * libdirac_common/frame_buffer.cpp, libdirac_common/frame_buffer.h,
+ libdirac_common/motion.h, libdirac_encoder/frame_compress.cpp,
+ libdirac_encoder/frame_compress.h,
+ libdirac_encoder/quality_monitor.cpp,
+ libdirac_encoder/quality_monitor.h,
+ libdirac_encoder/seq_compress.cpp,
+ libdirac_encoder/seq_compress.h,
+ libdirac_motionest/block_match.cpp,
+ libdirac_motionest/me_mode_decn.cpp,
+ libdirac_motionest/me_mode_decn.h,
+ libdirac_motionest/me_subpel.cpp,
+ libdirac_motionest/me_utils.cpp, libdirac_motionest/me_utils.h,
+ libdirac_motionest/motion_estimate.cpp,
+ libdirac_motionest/pixel_match.cpp: Modified motion estimation so
+ that it's done on the uncompressed data. Changed the ME
+ utilities so that they compute SAD only. Modified mode decisions
+ to restore weights applied to different levels of decomposition.
+ Changed QualityMonitor class so that the internal model of rate
+ versus distortion is effectively reset if we have to recode a
+ frame. Fixed bug with measurement of PSNR.
+
+2004-08-20 16:05 asuraparaju
+
+ * tests/colourbars.at: Fix paths for out-of-tree builds
+
+2004-08-19 15:27 asuraparaju
+
+ * doc/api/dirac_api.doxygen: Include utilities in documentation
+
+2004-08-19 14:55 asuraparaju
+
+ * configure.ac: Update release id to 0.4.0
+
+2004-08-19 13:23 asuraparaju
+
+ * decoder/Makefile.am, encoder/Makefile.am,
+ libdirac_common/Makefile.am, libdirac_decoder/Makefile.am,
+ libdirac_encoder/Makefile.am, libdirac_motionest/Makefile.am,
+ picheader/Makefile.am, tests/Makefile.am, unit_tests/Makefile.am,
+ util/conversion/Makefile.am, util/conversion/common/Makefile.am,
+ util/instrumentation/Makefile.am,
+ util/instrumentation/libdirac_instrument/Makefile.am: Fixed build
+ errors when compiling out of source tree. Out-of-source-tree
+ builds are now successful.
+
+2004-08-19 13:21 asuraparaju
+
+ * NEWS: Included Alpha 0.4.0 release notes
+
+2004-08-19 13:20 asuraparaju
+
+ * decoder/decmain.cpp: Handling STATE_INVALID returned by parser.
+
+2004-08-19 13:20 asuraparaju
+
+ * encoder/encmain.cpp: Fixed bug with setting block sizes.
+
+2004-08-19 13:19 asuraparaju
+
+ * picheader/headmain.cpp: Replace tabs with spaces. Fixed a
+ character array overrun error.
+
+2004-08-19 13:17 asuraparaju
+
+ * util/instrumentation/README: Updated this document
+
+2004-08-19 13:16 asuraparaju
+
+ * win/Makefile: Updated Makefile to build correctly
+
+2004-08-19 13:14 asuraparaju
+
+ * TODO: Update todo list
+
+2004-08-19 13:13 asuraparaju
+
+ * README.release: Include tagging of files with release id in the
+ checklist
+
+2004-08-19 13:13 asuraparaju
+
+ * README: Updated for 0.4.0 release
+
+2004-08-19 13:12 asuraparaju
+
+ * AUTHORS: Updated list of contributors
+
+2004-08-19 13:11 asuraparaju
+
+ * dirac.pc.in: Setting include and libs vars to correct values so
+ that pkg-config shows the correct dependencies for Dirac.
+
+2004-08-19 13:10 asuraparaju
+
+ * configure.ac: Included additional condtional vars to check if
+ documentation can be built successfully. Included
+ -Wno-long-double flag on platforms where it is supported to
+ prevent compile time warnings.
+
+2004-08-19 13:08 asuraparaju
+
+ * doc/: Makefile.am, api/Makefile.am, api/dirac_api.doxygen,
+ api/dirac_api_foot.html, programmers/Makefile.am: Included
+ additional condtional vars to check if documentation can be built
+ successfully. Included dirac_bitstream.txt in distribution.
+
+2004-08-19 13:06 asuraparaju
+
+ * doc/algorithm/: algorithm.htm, rdo.htm, toc.htm,
+ transform_coding.htm: Added links to constant quality encoding
+ pages.
+
+2004-08-19 13:04 asuraparaju
+
+ * doc/algorithm/const_qual.htm: Added documentation on constant
+ quality encoding.
+
+2004-08-19 13:03 asuraparaju
+
+ * doc/faq.htm: Added details on patent position. Fixed broken
+ links. Minor text changes
+
+2004-08-19 13:02 asuraparaju
+
+ * doc/dirac_bitstream.txt: Initial bitstream syntax document for
+ Dirac bitstream v0.1
+
+2004-08-19 12:55 asuraparaju
+
+ * util/instrumentation/: instrmain.cpp, process_sequence.cpp,
+ process_sequence.h, libdirac_instrument/draw_overlay.cpp,
+ libdirac_instrument/draw_overlay.h,
+ libdirac_instrument/motion_arrows.cpp,
+ libdirac_instrument/motion_arrows.h,
+ libdirac_instrument/motion_colour.cpp,
+ libdirac_instrument/motion_colour_arrows.cpp,
+ libdirac_instrument/overlay.cpp,
+ libdirac_instrument/pred_mode.cpp, libdirac_instrument/sad.cpp,
+ libdirac_instrument/split_mode.cpp: Output all MEData members and
+ cope with monochrome sequences Fixed block dimensions bug. Fixed
+ padded pictures bug.
+
+2004-08-19 12:50 asuraparaju
+
+ * libdirac_common/bit_manager.h, libdirac_common/common.h,
+ libdirac_decoder/dirac_cppparser.cpp,
+ libdirac_decoder/dirac_cppparser.h,
+ libdirac_decoder/dirac_parser.cpp,
+ libdirac_decoder/dirac_parser.h,
+ libdirac_decoder/frame_decompress.cpp,
+ libdirac_decoder/seq_decompress.cpp: Bitstream v0.1 related
+ changes - Handling new start codes and bitstream version
+
+2004-08-19 12:46 asuraparaju
+
+ * libdirac_motionest/: me_mode_decn.cpp, me_utils.cpp,
+ motion_estimate.cpp, pixel_match.cpp: Tiffled motion estimation
+ parameters to improve performance.
+
+2004-08-19 12:45 asuraparaju
+
+ * libdirac_common/arith_codec.h: Minor mods to fix compile time
+ errors
+
+2004-08-19 12:45 asuraparaju
+
+ * libdirac_common/dirac_assertions.h: New debug test macros TEST,
+ TESTM, REPORT and REPORTM
+
+2004-08-19 12:44 asuraparaju
+
+ * libdirac_common/: motion.cpp, motion.h: Instrumentation update:
+ outputs all MEData members and copes with monochrome sequences
+
+2004-08-19 12:43 asuraparaju
+
+ * libdirac_common/: mot_comp.cpp, pic_io.cpp, wavelet_utils.cpp:
+ Cleansed code
+
+2004-08-19 12:40 asuraparaju
+
+ * libdirac_encoder/: frame_compress.cpp, quality_monitor.cpp,
+ quality_monitor.h, seq_compress.cpp: Handling new start codes and
+ bitstream version. Fixed bug in quality monitor code where
+ padding area was taken into account in calculating PSNR. Removed
+ unused code for calculating weighted PSNR. Removed commented
+ output from quality monitor. Instrumentation update: outputs all
+ MEData members and copes with monochrome sequences.
+
+2004-08-11 16:23 asuraparaju
+
+ * tests/Makefile.am: Deleting data files created by encode and
+ decode operation durng cleanup.
+
+2004-08-11 15:53 asuraparaju
+
+ * decoder/decmain.cpp: Decoder modified to use the "C" interface.
+
+2004-08-11 15:53 asuraparaju
+
+ * encoder/encmain.cpp: Added support for cut-detection and intra
+ frame insertion. Changed output structure to output frame by
+ frame, and added recoding to exploit this. Recoding takes place
+ if quality is not within a range of the target quality.
+
+ Replaced tabs with spaces.
+
+ Updated data file extension
+
+2004-08-11 15:48 asuraparaju
+
+ * libdirac_encoder/: Makefile.am, frame_compress.cpp,
+ frame_compress.h, quality_monitor.cpp, quality_monitor.h,
+ seq_compress.cpp, seq_compress.h: Fixed the bug where all header
+ files were being dumped into the same install directory. Now
+ headers are copied into the <installdir>/dirac/<module>
+ directory.
+
+ Added support for cut-detection and intra frame insertion.
+ Changed output structure to output frame by frame, and added
+ recoding to exploit this. Recoding takes place if quality is not
+ within a range of the target quality.
+
+ Writing frame start, sequence start and sequence end codes to
+ bitstream.
+
+ Modifications to build under WIN32
+
+2004-08-11 15:44 asuraparaju
+
+ * libdirac_decoder/: Makefile.am, frame_decompress.cpp,
+ frame_decompress.h, seq_decompress.cpp, seq_decompress.h:
+ Handling new "C" interface files. Handling bitstream changes in
+ frame and sequence decompress routines. Fixed the bug where all
+ header files were being dumped into the same install directory.
+ Now headers are copied into the
+ <installdir>/dirac/libdirac_decoder
+
+2004-08-11 15:40 asuraparaju
+
+ * libdirac_common/: Makefile.am, arith_codec.h, arrays.h,
+ band_codec.cpp, band_codec.h, bit_manager.cpp, bit_manager.h,
+ common.cpp, common.h, frame.cpp, frame.h, frame_buffer.cpp,
+ mot_comp.cpp, motion.cpp, mv_codec.cpp, mv_codec.h, pic_io.cpp,
+ pic_io.h: Renamed BitOutputManager to UnitOutputManager in
+ bit_manager.* Modified bit_manager.* to handle modifications to
+ bitstream. Moved enumerated types common to the encoder, decoder
+ and codec interfaces from common.h into common_types.h to avoid
+ duplication of declarations.
+
+ Added support for cut-detection and intra frame insertion.
+ Changed output structure to output frame by frame, and added
+ recoding to exploit this. Recoding takes place if quality is not
+ within a range of the target quality.
+
+ Modifications to build under WIN32 Fixed icc compiler warning 522
+ Fixed VC++ 2003 compiler warnings
+
+ Fixed the bug where all header files were being dumped into the
+ same install directory. Now headers are copied into the <install
+ dir>/dirac/libdirac_common directory.
+
+2004-08-11 15:30 asuraparaju
+
+ * libdirac_motionest/: Makefile.am, me_mode_decn.cpp,
+ me_subpel.cpp, motion_estimate.cpp, motion_estimate.h: Minor mods
+ to improve motion estimation: no lambda-smoothing on
+ pixel-accurate ME. Fixed the bug where all header files were
+ being dumped into the same install directory. Now headers are
+ copied into the <install dir>/dirac/libdirac_motionest
+ directory..
+
+2004-08-11 15:27 asuraparaju
+
+ * util/instrumentation/: Makefile.am, instrmain.cpp,
+ process_sequence.cpp, process_sequence.h,
+ libdirac_instrument/overlay.h: Restructured the code. Corrected
+ header file path in instrmain.cpp. Added a ProcessSequence
+ class. File extension of motion vector instrumentation file
+ changed from _mvdata to .imt
+
+2004-08-11 15:24 asuraparaju
+
+ * tests/: Makefile.am, colourbars.at: Deleting instrumentation
+ files during clean up. Ignoring stdout and stderr when running
+ decoder.
+
+2004-08-11 15:23 asuraparaju
+
+ * win/Makefile: Fixed VC++ 2003 compile and link errors
+
+2004-08-11 15:21 asuraparaju
+
+ * libdirac_common/: dirac_assertions.cpp, dirac_assertions.h: Added
+ functions for runtime testing in debug mode. Two new macros are
+ defined.
+
+ ASSERT( exp ) - if exp resolves to false, the program prints the
+ line number and file where the assertion failure occured. In
+ debug mode the program exits immediately dumping core.
+
+ ASSERT( exp, mesg ) - if exp resolves to false, the program
+ prints the line number, file name where the assertion failure
+ occured and mesg. In debug mode the program exits immediately
+
+2004-08-11 15:20 asuraparaju
+
+ * libdirac_common/common_types.h: Moved enumerated types common to
+ the encoder, decoder and codec interfaces from common.h into this
+ file to avoid duplication of declarations.
+
+2004-08-11 15:16 asuraparaju
+
+ * libdirac_decoder/: decoder_types.h, dirac_cppparser.cpp,
+ dirac_cppparser.h, dirac_parser.cpp, dirac_parser.h: These new
+ files define the "C" interface to the decoder. The bitstream has
+ been modified to be able to parse it for decoding.
+
+ BitStream Changes:
+
+ The new dirac bit stream is as follows <sequence-start-code>
+ <sequence header> <frame-start-code> <frame 1 data> . . .
+ <frame-start-code> <frame n data> <sequence-end-code>
+
+ Sequence start code: Each sequence begins with a 5 bytes start
+ code 0x01 0x02 0x03 0x04 0xB3
+
+ Frame start code: Each frame begins with a 5 bytes frame start
+ code 0x01 0x02 0x03 0x04 0xB4
+
+ Sequence End code: Each sequence ends with a 5 bytes sequence end
+ code 0x01 0x02 0x03 0x04 0xB7
+
+ Not a start code flag: If the arithmetic codec ouputs the start
+ code prefix 0x01 0x02 0x03 0x04, 0xFF is inserted into the
+ bitstream to flag that this is the output of the Arithmetic codec
+ and not a start code.
+
+2004-08-11 14:27 asuraparaju
+
+ * configure.ac: Added a new option --enable-profile to include the
+ profiling option -pg to them compile line. Setting up CXXFLAGS
+ correctly for Intel compiler when the --enable-debug option is
+ used.
+
+2004-08-11 14:26 asuraparaju
+
+ * README.release: A checklist for producing a new release
+
+2004-08-03 10:22 asuraparaju
+
+ * Makefile.am, configure.ac, dirac.pc.in, decoder/decmain.cpp,
+ encoder/encmain.cpp, libdirac_common/Makefile.am,
+ libdirac_common/arrays.h, libdirac_common/bit_manager.cpp,
+ libdirac_common/bit_manager.h, libdirac_common/common.cpp,
+ libdirac_common/common.h, libdirac_common/mot_comp.cpp,
+ libdirac_common/mot_comp.h, libdirac_common/motion.cpp,
+ libdirac_common/motion.h, libdirac_common/mv_codec.cpp,
+ libdirac_common/mv_codec.h, libdirac_common/wavelet_utils.cpp,
+ libdirac_common/wavelet_utils.h,
+ libdirac_decoder/frame_decompress.cpp,
+ libdirac_encoder/Makefile.am, libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/comp_compress.h,
+ libdirac_encoder/frame_compress.cpp,
+ libdirac_encoder/frame_compress.h,
+ libdirac_encoder/quality_monitor.cpp,
+ libdirac_encoder/seq_compress.cpp,
+ libdirac_encoder/seq_compress.h, libdirac_motionest/Makefile.am,
+ libdirac_motionest/block_match.cpp,
+ libdirac_motionest/block_match.h,
+ libdirac_motionest/downconvert.cpp,
+ libdirac_motionest/downconvert.h,
+ libdirac_motionest/me_mode_decn.cpp,
+ libdirac_motionest/me_mode_decn.h,
+ libdirac_motionest/me_subpel.cpp, libdirac_motionest/me_subpel.h,
+ libdirac_motionest/me_utils.cpp, libdirac_motionest/me_utils.h,
+ libdirac_motionest/motion_estimate.cpp,
+ libdirac_motionest/motion_estimate.h,
+ libdirac_motionest/pixel_match.cpp,
+ libdirac_motionest/pixel_match.h: libdirac_common,
+ libdirac_encoder, encoder: Incorporated diagnostic tool
+
+ libdirac_common, libdirac_encoder, libdirac_motionest: Added
+ lifting classes for wavelet transform. Refactored motion
+ estimation to make logic clearer, and added separate
+ pixel-accurate matching classes. Put in a longer temporal filter
+ in QualityMonitor class to reduce oscillation and changed
+ motion estimation Lagrangian parameter to improve
+ performance. TO DO: tune ME parameter for each picture
+ size/block size combination.
+
+ libdirac_common: Corrected bug with lifting functions not
+ returning a value. Modified MvData class to make member
+ variables private.
+
+ libdirac_encoder: Modified ME lambda value to improve
+ performance.
+
+ libdirac_decode, libdirac_encoder, libdirac_motionest,
+ libdirac_common: Modified MvData class to make member
+ variables private. Created MEData class as a subclass of
+ MvData for use in motion estimation.
+
+ libdirac_commonm libdirac_encoder: Refactored output classes
+ to create classes for unit, frame and sequence output, where
+ a unit is a subband or MV data, and consists of a header and
+ subsequent data. Output can only be effected at the sequence
+ level and occurs only after a whole frame of data has been
+ accumulated. This will allow for frames to be re-coded before
+ being output if their quality is not satisfactory.
+
+2004-08-03 10:07 asuraparaju
+
+ * util/: Makefile.am, instrumentation/Makefile.am,
+ instrumentation/README, instrumentation/instrmain.cpp,
+ instrumentation/libdirac_instrument/Makefile.am,
+ instrumentation/libdirac_instrument/draw_overlay.cpp,
+ instrumentation/libdirac_instrument/draw_overlay.h,
+ instrumentation/libdirac_instrument/motion_arrows.cpp,
+ instrumentation/libdirac_instrument/motion_arrows.h,
+ instrumentation/libdirac_instrument/motion_colour.cpp,
+ instrumentation/libdirac_instrument/motion_colour.h,
+ instrumentation/libdirac_instrument/motion_colour_arrows.cpp,
+ instrumentation/libdirac_instrument/motion_colour_arrows.h,
+ instrumentation/libdirac_instrument/overlay.cpp,
+ instrumentation/libdirac_instrument/overlay.h,
+ instrumentation/libdirac_instrument/overlay_symbols.cpp,
+ instrumentation/libdirac_instrument/overlay_symbols.h,
+ instrumentation/libdirac_instrument/pred_mode.cpp,
+ instrumentation/libdirac_instrument/pred_mode.h,
+ instrumentation/libdirac_instrument/sad.cpp,
+ instrumentation/libdirac_instrument/sad.h,
+ instrumentation/libdirac_instrument/split_mode.cpp,
+ instrumentation/libdirac_instrument/split_mode.h: Adding
+ instrumentation tool
+
+2004-07-16 16:29 asuraparaju
+
+ * libdirac_encoder/quality_monitor.cpp: Fixed bug with model
+ updating - limits of slope of linear model were inaccurate. Fixed
+ bug with numerical stability of lambda re-calculation.
+ Performance with cuts or shot-changes is still poor, however.
+
+2004-07-16 16:23 asuraparaju
+
+ * DCO.developers, README.developers: Added contents section. Added
+ text about licensing and contribution. Modified licensing
+ requirements so that contributors contribute under Mozilla too.
+ Added Developers Certificate of Origin, which developers are to
+ sign before their work is included.
+
+2004-07-12 11:59 asuraparaju
+
+ * libdirac_common/arrays.h, libdirac_common/band_codec.cpp,
+ libdirac_common/band_codec.h, libdirac_common/bit_manager.cpp,
+ libdirac_common/bit_manager.h, libdirac_common/cmd_line.cpp,
+ libdirac_common/cmd_line.h, libdirac_common/common.cpp,
+ libdirac_common/common.h, libdirac_common/frame.cpp,
+ libdirac_common/frame.h, libdirac_common/frame_buffer.cpp,
+ libdirac_common/frame_buffer.h, libdirac_common/golomb.cpp,
+ libdirac_common/golomb.h, libdirac_common/mot_comp.cpp,
+ libdirac_common/mot_comp.h, libdirac_common/motion.cpp,
+ libdirac_common/motion.h, libdirac_common/mv_codec.cpp,
+ libdirac_common/mv_codec.h, libdirac_common/pic_io.cpp,
+ libdirac_common/upconvert.cpp, libdirac_common/upconvert.h,
+ libdirac_common/wavelet_utils.cpp,
+ libdirac_common/wavelet_utils.h,
+ libdirac_decoder/comp_decompress.cpp,
+ libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/quality_monitor.cpp,
+ libdirac_encoder/quality_monitor.h,
+ libdirac_motionest/block_match.cpp,
+ libdirac_motionest/block_match.h,
+ libdirac_motionest/downconvert.cpp,
+ libdirac_motionest/downconvert.h,
+ libdirac_motionest/me_mode_decn.cpp,
+ libdirac_motionest/me_mode_decn.h,
+ libdirac_motionest/me_subpel.cpp, libdirac_motionest/me_subpel.h,
+ libdirac_motionest/me_utils.cpp, libdirac_motionest/me_utils.h,
+ libdirac_motionest/motion_estimate.cpp,
+ libdirac_motionest/motion_estimate.h: Changed order of
+ initialisation parameters for TwoDArray template class and
+ subclass PicArray. Tidied TwoDArray and OneDArray classes.
+ Removed all use of allocators. Replaced tabs with spaces in
+ libdirac_common. Fixed minor bug in quality_monitor PSNR
+ measurement. Made other typographical changes.
+
+2004-07-12 11:53 asuraparaju
+
+ * Makefile.am, configure.ac, tests/Makefile.am, tests/testsuite.at,
+ tests/unittests.at, unit_tests/Makefile.am,
+ unit_tests/arrays_test.cpp, unit_tests/arrays_test.h,
+ unit_tests/core_suite.h, unit_tests/cppunit_testsuite.cpp,
+ unit_tests/utmain.cpp: Added a unit test framework based on
+ Cppunit. The unit tests will reside in the directory unit_tests.
+ 'make check' command will now run the unit tests as well.
+ Currently unit test exists only for the TwoDArrays class. More
+ tests will be added in future.
+
+2004-07-06 12:26 asuraparaju
+
+ * Makefile.am, README, encoder/encmain.cpp,
+ libdirac_common/arith_codec.h, libdirac_common/common.cpp,
+ libdirac_common/common.h, libdirac_common/frame.cpp,
+ libdirac_common/frame_buffer.cpp, libdirac_common/frame_buffer.h,
+ libdirac_common/mot_comp.cpp, libdirac_common/motion.cpp,
+ libdirac_common/motion.h, libdirac_common/pic_io.cpp,
+ libdirac_common/wavelet_utils.cpp,
+ libdirac_common/wavelet_utils.h,
+ libdirac_decoder/frame_decompress.cpp,
+ libdirac_decoder/frame_decompress.h,
+ libdirac_decoder/seq_decompress.cpp,
+ libdirac_encoder/Makefile.am, libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/frame_compress.cpp,
+ libdirac_encoder/quality_monitor.cpp,
+ libdirac_encoder/quality_monitor.h,
+ libdirac_encoder/seq_compress.cpp,
+ libdirac_encoder/seq_compress.h,
+ libdirac_motionest/me_mode_decn.cpp,
+ libdirac_motionest/me_subpel.cpp,
+ libdirac_motionest/me_utils.cpp,
+ libdirac_motionest/motion_estimate.cpp, tests/colourbars.at:
+ README: Removed discussion of Iqf, L1qf and L2qf. Added text
+ explaining constant- quality encoding using -qf.
+
+ Makefile.am: Changed order of make, so that utilities can use the
+ common (and other) libraries.
+
+ libdirac_common: Changed EncoderParams to include a quality
+ parameter for constant-quality encoding. Changed perceptual
+ weighting to use an extension of CCIR 959 weights, with extra
+ weight for DC band, and lower weights for chroma bands.
+
+ Modified enumerated type CompSort to avoid name clashes by
+ using longer names. Refactored OLBParams class to have private
+ member variables and access functions.
+
+ libdirac_encoder: Added QualityMonitor class to do
+ constant-quality encoding. Class looks at difference between
+ locally decoded and original frames and adjusts Lagrangian
+ parameters appropriately. Simplified interface for encoding
+ results, where a single quality parameter is specified.
+
+ libdirac_decoder: FrameDecompressor::Decompress now returns
+ true upon success and false upon failure.
+
+ encoder/encmain.cpp: Simplified interface for encoding
+ results, where a single quality parameter is specified.
+
+2004-06-30 17:53 asuraparaju
+
+ * README.developers: Removed dollar signs around CVS tags which
+ cause them to be expanded
+
+2004-06-30 17:44 asuraparaju
+
+ * AUTHORS, README, README.developers, configure.ac,
+ decoder/decmain.cpp, encoder/encmain.cpp,
+ libdirac_common/Makefile.am, libdirac_common/arith_codec.h,
+ libdirac_common/arrays.h, libdirac_common/band_codec.cpp,
+ libdirac_common/band_codec.h, libdirac_common/bit_manager.cpp,
+ libdirac_common/bit_manager.h, libdirac_common/cmd_line.cpp,
+ libdirac_common/cmd_line.h, libdirac_common/common.cpp,
+ libdirac_common/common.h, libdirac_common/context.h,
+ libdirac_common/frame.cpp, libdirac_common/frame.h,
+ libdirac_common/frame_buffer.cpp, libdirac_common/frame_buffer.h,
+ libdirac_common/golomb.cpp, libdirac_common/golomb.h,
+ libdirac_common/mot_comp.cpp, libdirac_common/mot_comp.h,
+ libdirac_common/motion.cpp, libdirac_common/motion.h,
+ libdirac_common/mv_codec.cpp, libdirac_common/mv_codec.h,
+ libdirac_common/pic_io.cpp, libdirac_common/pic_io.h,
+ libdirac_common/upconvert.cpp, libdirac_common/upconvert.h,
+ libdirac_common/wavelet_utils.cpp,
+ libdirac_common/wavelet_utils.h,
+ libdirac_decoder/comp_decompress.cpp,
+ libdirac_decoder/comp_decompress.h,
+ libdirac_decoder/frame_decompress.cpp,
+ libdirac_decoder/frame_decompress.h,
+ libdirac_decoder/seq_decompress.cpp,
+ libdirac_decoder/seq_decompress.h,
+ libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/comp_compress.h,
+ libdirac_encoder/frame_compress.cpp,
+ libdirac_encoder/frame_compress.h,
+ libdirac_encoder/seq_compress.cpp,
+ libdirac_encoder/seq_compress.h,
+ libdirac_motionest/block_match.cpp,
+ libdirac_motionest/block_match.h,
+ libdirac_motionest/downconvert.cpp,
+ libdirac_motionest/downconvert.h,
+ libdirac_motionest/me_mode_decn.cpp,
+ libdirac_motionest/me_mode_decn.h,
+ libdirac_motionest/me_subpel.cpp, libdirac_motionest/me_subpel.h,
+ libdirac_motionest/me_utils.cpp, libdirac_motionest/me_utils.h,
+ libdirac_motionest/motion_estimate.cpp,
+ libdirac_motionest/motion_estimate.h, picheader/headmain.cpp,
+ util/conversion/BMPtoRGB.cpp, util/conversion/RGBtoBMP.cpp,
+ util/conversion/RGBtoUYVY.cpp, util/conversion/RGBtoYUV411.cpp,
+ util/conversion/RGBtoYUV420.cpp, util/conversion/RGBtoYUV422.cpp,
+ util/conversion/RGBtoYUV444.cpp, util/conversion/UYVYtoRGB.cpp,
+ util/conversion/YUV411toRGB.cpp, util/conversion/YUV420toRGB.cpp,
+ util/conversion/YUV422toRGB.cpp, util/conversion/YUV444toRGB.cpp,
+ util/conversion/common/bitmap.cpp,
+ util/conversion/common/bitmap.h,
+ util/conversion/common/setstdiomode.cpp,
+ util/conversion/common/setstdiomode.h:
+ - Included a coding style guidelines sub-section (Coding Style) in
+ README.developers under the section 'Software Practices'. This
+ sub-section describes the coding guidelines for developers and is to
+ be used as a reference by developers while writing code and while
+ peer-reviewing code.
+
+ - Removed the following CVS tags from all files
+ Author
+ Log
+ Revision
+
+ - Included the following CVS tags in all source and header files
+ Id
+ Name
+
+ - Included a new configuration option, --enable-debug, in
+ configure.ac. This option turns on the flags '-Wall -pedantic
+ -Werror' to trap warnings.
+ - Modified parameter classes in common.{h,cpp} to make member
+ variables private and accessible through class methods. Traced
+ through codec.
+
+ - Deleted context.h. The classes that were originally in this
+ file have been integrated as nested classes into ArithCodec
+ class in arith_codec.h
+
+ - Fixed bug on QCIF coding. The number of downconversions during
+ hierarchical motion estimation is now limited based on the
+ size of the picture
+
+ - Changed decoder and encoder params to be references throughout
+ frame and component (de)compression rather than being copied.
+
+ - Code cleansed to follow coding standards specified in
+ README.developers.
+ - Changed names of member variables to use m_ convention
+ - Used spaces to improve readability of code
+ - Accessing class member variables through accessor/mutator
+ function rather than directly
+ - Non-trivial member functions moved from headers to .cpp files
+
+ Changes mainly in the following directories:
+ libdirac_common
+ libdirac_decoder
+ libdirac_encoder
+
+ - Fixed g++ compiler warnings
+
+2004-06-22 11:10 asuraparaju
+
+ * libdirac_common/wavelet_utils.h: Modified doxygen comments to
+ match the declaration of member function SetBandWeights in class
+ WaveletTransform.
+
+2004-06-22 11:08 asuraparaju
+
+ * encoder/encmain.cpp: Fixed compilation errors caused by trying to
+ access non-existent cformat data member in class EncoderParams.
+
+2004-06-18 16:58 tjdwave
+
+ * libdirac_common/common.cpp, libdirac_common/common.h,
+ libdirac_common/frame.cpp, libdirac_common/mot_comp.cpp,
+ libdirac_common/mot_comp.h, libdirac_common/wavelet_utils.cpp,
+ libdirac_common/wavelet_utils.h,
+ libdirac_decoder/frame_decompress.cpp,
+ libdirac_decoder/frame_decompress.h,
+ libdirac_decoder/seq_decompress.cpp,
+ libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/frame_compress.cpp,
+ libdirac_encoder/seq_compress.cpp,
+ libdirac_motionest/motion_estimate.cpp,
+ libdirac_common/motion.cpp, libdirac_common/motion.h: Removed
+ chroma format parameter cformat from CodecParams and derived
+ classes to avoid duplication. Made consequential minor mods to
+ seq_{de}compress and frame_{de}compress code. Revised motion
+ compensation to use built-in arrays for weighting matrices and to
+ enforce their const-ness. Removed unnecessary memory
+ (de)allocations from Frame class copy constructor and assignment
+ operator.
+
+2004-06-16 17:06 asuraparaju
+
+ * decoder/Makefile.am, encoder/Makefile.am,
+ libdirac_common/Makefile.am, libdirac_decoder/Makefile.am,
+ libdirac_encoder/Makefile.am, libdirac_motionest/Makefile.am,
+ util/conversion/Makefile.am, util/conversion/common/Makefile.am:
+ Enable dependency tracking by removing the macro AUTOMAKE_OPTIONS
+ = no-dependencies from Makefile.am
+
+2004-06-16 09:25 tjdwave
+
+ * doc/algorithm/: algorithm.htm, toc.htm: Corrected link in TOC.
+ Put correct date in main page.
+
+2004-06-08 17:18 timborer
+
+ * NEWS: Updated release notes for version 0.3.1
+
+2004-06-08 17:03 timborer
+
+ * configure.ac, libdirac_common/golomb.cpp,
+ libdirac_common/mv_codec.h, libdirac_motionest/block_match.cpp,
+ util/conversion/BMPtoRGB.cpp, util/conversion/RGBtoBMP.cpp,
+ util/conversion/RGBtoUYVY.cpp, util/conversion/RGBtoYUV411.cpp,
+ util/conversion/RGBtoYUV420.cpp, util/conversion/RGBtoYUV422.cpp,
+ util/conversion/RGBtoYUV444.cpp, util/conversion/UYVYtoRGB.cpp,
+ util/conversion/YUV411toRGB.cpp, util/conversion/YUV420toRGB.cpp,
+ util/conversion/YUV422toRGB.cpp, util/conversion/YUV444toRGB.cpp,
+ util/conversion/common/bitmap.cpp,
+ util/conversion/common/bitmap.h,
+ util/conversion/common/setstdiomode.cpp,
+ util/conversion/common/setstdiomode.h, win/Makefile: Files
+ updated so that code compiles under Windows (previously broken
+ under Windows). Colour matrix coefficients corrected in video
+ conversion utilities Video conversion utilites now build with the
+ rest of the code.
+
+2004-06-03 14:07 stuart_hc
+
+ * README.developers: Added Profiling & optimisation section.
+
+2004-05-28 16:05 tjdwave
+
+ * NEWS, TODO: Added information about picture format conversion
+ utilities. Removed frame padding from the TODO list.
+
+2004-05-28 15:58 tjdwave
+
+ * README: Added text on how to use the conversion utilities to
+ provide test material for Dirac.
+
+2004-05-28 15:27 tjdwave
+
+ * util/conversion/: BMPtoRGB.cpp, Makefile.am, RGBtoBMP.cpp,
+ RGBtoUYVY.cpp, RGBtoYUV411.cpp, RGBtoYUV420.cpp, RGBtoYUV422.cpp,
+ RGBtoYUV444.cpp, UYVYtoRGB.cpp, YUV411toRGB.cpp, YUV420toRGB.cpp,
+ YUV422toRGB.cpp, YUV444toRGB.cpp: Initial commit of command-line
+ tools for converting between uncompressed picture formats. All
+ conversions use uncompressed RGB as an intermediate format.
+ There is a known bug with the colour matrixing which applies a
+ gain when going from YUV to RGB and back again. This will be
+ fixed in a subsequent release.
+
+2004-05-28 15:18 tjdwave
+
+ * util/conversion/common/: bitmap.cpp, bitmap.h, setstdiomode.cpp,
+ setstdiomode.h: Initial commit. Common tools for handling BMP
+ headers and stdio handling for Windows.
+
+2004-05-28 15:15 tjdwave
+
+ * util/conversion/common/Makefile.am: Initial commit. Builds common
+ library for use by all the conversion routines.
+
+2004-05-28 15:14 tjdwave
+
+ * util/conversion/Makefile.am: Initial commit. Builds file
+ conversion utilities.
+
+2004-05-28 15:12 tjdwave
+
+ * util/Makefile.am: Added Makefile to build utility subdirectories.
+
+2004-05-28 15:10 tjdwave
+
+ * Makefile.am, configure.ac: Updated to add utilities directory.
+
+2004-05-27 14:58 asuraparaju
+
+ * configure.ac, doc/Makefile.am, doc/algorithm/Makefile.am,
+ doc/api/Makefile.am, doc/programmers/Makefile.am: Corrected API
+ and programmer doc build and installation. Added algorithm doc
+ install (from CVS only - not distribution).
+
+2004-05-27 13:21 stuart_hc
+
+ * README.developers: Prevent unintended expansion of Id and Log
+ in description of keywords.
+
+2004-05-27 13:14 stuart_hc
+
+ * README.developers: Added section on the testsuite and on binary
+ files.
+
+2004-05-27 09:02 tjdwave
+
+ * doc/programmers/: programmers_guide.dvi, programmers_guide.log:
+ Removed LaTeX-generated .dvi and .log files from CVS control.
+
+2004-05-27 09:00 tjdwave
+
+ * doc/: algorithm/algorithm.htm, algorithm/var_size.htm,
+ algorithm/wlt_transform.htm, programmers/programmers_guide.dvi,
+ programmers/programmers_guide.log: Updated docs to take into
+ account that Dirac does edge-padding, not padding with black, in
+ order to avoid significant artefacts at low bit-rate.
+
+2004-05-26 17:01 tjdwave
+
+ * configure.ac, doc/Makefile.am, doc/faq.htm,
+ doc/algorithm/algorithm.htm, doc/algorithm/block_data.htm,
+ doc/algorithm/intra_pred.htm, doc/algorithm/intro.htm,
+ doc/algorithm/mb_structs.htm, doc/algorithm/mot_est.htm,
+ doc/algorithm/mot_est_and_comp.htm,
+ doc/algorithm/mv_coding_arch.htm,
+ doc/algorithm/mv_data_coding.htm, doc/algorithm/mv_data_pred.htm,
+ doc/algorithm/mv_entropy_code.htm, doc/algorithm/olb_mc.htm,
+ doc/algorithm/overall_arch.htm, doc/algorithm/parent_child.htm,
+ doc/algorithm/quantisation.htm, doc/algorithm/rdo.htm,
+ doc/algorithm/rdo_mot_est.htm, doc/algorithm/subband_rdo.htm,
+ doc/algorithm/temporal_prediction_structures.htm,
+ doc/algorithm/toc.htm, doc/algorithm/transform_coding.htm,
+ doc/algorithm/transform_coding_arch.htm,
+ doc/algorithm/var_size.htm, doc/algorithm/wlt_coeff_coding.htm,
+ doc/algorithm/wlt_transform.htm, doc/algorithm/figs/DC.jpg,
+ doc/algorithm/figs/DCSAD.jpg, doc/algorithm/figs/braces.jpg,
+ doc/algorithm/figs/d.jpg, doc/algorithm/figs/eqA.jpg,
+ doc/algorithm/figs/eqB.jpg, doc/algorithm/figs/eqC.jpg,
+ doc/algorithm/figs/eqD.jpg, doc/algorithm/figs/eqE.jpg,
+ doc/algorithm/figs/eqF.jpg, doc/algorithm/figs/eqG.jpg,
+ doc/algorithm/figs/eqH.jpg, doc/algorithm/figs/eqI.jpg,
+ doc/algorithm/figs/eqJ.jpg, doc/algorithm/figs/fig1.jpg,
+ doc/algorithm/figs/fig10.jpg, doc/algorithm/figs/fig12.jpg,
+ doc/algorithm/figs/fig13.jpg, doc/algorithm/figs/fig14.jpg,
+ doc/algorithm/figs/fig15.jpg, doc/algorithm/figs/fig16.jpg,
+ doc/algorithm/figs/fig17.jpg, doc/algorithm/figs/fig18.jpg,
+ doc/algorithm/figs/fig19.jpg, doc/algorithm/figs/fig2.jpg,
+ doc/algorithm/figs/fig20.jpg, doc/algorithm/figs/fig21.jpg,
+ doc/algorithm/figs/fig22.jpg, doc/algorithm/figs/fig23.jpg,
+ doc/algorithm/figs/fig24.jpg, doc/algorithm/figs/fig26.jpg,
+ doc/algorithm/figs/fig27.jpg, doc/algorithm/figs/fig3.jpg,
+ doc/algorithm/figs/fig4.jpg, doc/algorithm/figs/fig5.jpg,
+ doc/algorithm/figs/fig6.jpg, doc/algorithm/figs/fig7.bmp,
+ doc/algorithm/figs/fig7.jpg, doc/algorithm/figs/fig8.jpg,
+ doc/algorithm/figs/fig9.jpg, doc/algorithm/figs/fp.jpg,
+ doc/algorithm/figs/m.jpg, doc/algorithm/figs/nhood.jpg,
+ doc/algorithm/figs/nhoodresidue.jpg, doc/algorithm/figs/p.jpg,
+ doc/algorithm/figs/p2.jpg, doc/algorithm/figs/t.jpg,
+ doc/algorithm/figs/two.jpg, doc/algorithm/figs/var.jpg,
+ doc/algorithm/figs/vtilda.jpg, doc/algorithm/figs/vw.jpg,
+ doc/api/Makefile.am, doc/api/dirac_api.doxygen,
+ doc/api/dirac_api.doxygen.in, doc/api/dirac_api_foot.html,
+ doc/api/dirac_api_head.html,
+ doc/api/libdirac_encoder_api.doxygen,
+ doc/api/libdirac_encoder_api_foot.html,
+ doc/api/libdirac_encoder_api_head.html,
+ doc/programmers/Makefile.am,
+ doc/programmers/programmers_guide.aux,
+ doc/programmers/programmers_guide.dvi,
+ doc/programmers/programmers_guide.log,
+ doc/programmers/programmers_guide.tex: Added algorithm
+ documentation and FAQ. Changed name of Scott Ladd's programmers
+ guide to programmers_guide.tex from dirac_algor.tex to clarify
+ purpose. Created individual subdirectories for algorithm, api and
+ programmers guide docs. Modified make files and configure.ac
+ appropriately.
+
+2004-05-26 16:44 tjdwave
+
+ * doc/: dirac_algor.tex, dirac_api.doxygen, dirac_api.doxygen.in,
+ dirac_api_foot.html, dirac_api_head.html,
+ libdirac_encoder_api.doxygen, libdirac_encoder_api_foot.html,
+ libdirac_encoder_api_head.html: Removed old documentation
+ structure. New doc structure to be put in place.
+
+2004-05-26 16:18 tjdwave
+
+ * libdirac_decoder/seq_decompress.cpp: Corrected behaviour at end
+ of stream, so that decoder freezes on the last frame.
+
+2004-05-26 15:33 tjdwave
+
+ * libdirac_encoder/comp_compress.cpp,
+ libdirac_common/band_codec.cpp,
+ libdirac_decoder/comp_decompress.cpp: Updated default DC
+ prediction value to take into account the removal of scaling from
+ the wavelet transform.
+
+2004-05-26 15:31 tjdwave
+
+ * libdirac_common/wavelet_utils.h: Added doxygen comments to
+ describe how perceptual weighting now incorporates scaling
+ factors from the scaling.
+
+2004-05-24 12:03 tjdwave
+
+ * libdirac_decoder/: frame_decompress.cpp, frame_decompress.h,
+ seq_decompress.cpp: Support for IO error handling. Decoder
+ freezes on last frame if out of data.
+
+2004-05-24 11:57 tjdwave
+
+ * picheader/headmain.cpp, encoder/encmain.cpp, decoder/decmain.cpp:
+ Changed CLI names and functions to house style.
+
+2004-05-24 11:55 tjdwave
+
+ * libdirac_common/: cmd_line.cpp, cmd_line.h: Modified class name
+ to fit house style: ClassName, not class_name.
+
+2004-05-24 11:53 tjdwave
+
+ * libdirac_common/: pic_io.cpp, pic_io.h: Added error handling: IO
+ functions now return boolean values.
+
+2004-05-24 11:52 tjdwave
+
+ * tests/colourbars.at: Fixed test so that header file has correct
+ zlength=1.
+
+2004-05-24 11:51 tjdwave
+
+ * Makefile.am: Switched order so that docs are builts last.
+
+2004-05-24 08:38 tjdwave
+
+ * libdirac_common/mot_comp.cpp, libdirac_common/mot_comp.h,
+ libdirac_motionest/me_utils.cpp, libdirac_motionest/me_utils.h:
+ Replaced spagetti code for linear interpolation in motion
+ compensation and motion estimation routines with simple loops.
+ Code is much clearer, although possibly slightly slower.
+
+2004-05-21 13:46 asuraparaju
+
+ * Makefile.am, configure.ac, tests/Makefile.am,
+ tests/colourbars.at, tests/colourbars_420.yuv,
+ tests/testsuite.at: Initial support for autotest testsuite (run
+ "make check").
+
+2004-05-21 12:27 stuart_hc
+
+ * README.developers: Initial revision of software practice
+ guidelines for CVS developers.
+
+2004-05-21 10:17 tjdwave
+
+ * libdirac_common/mot_comp.cpp: Fixed bug with erroneous linear
+ interpolation for sub-pixel values.
+
+2004-05-20 08:44 tjdwave
+
+ * README: Minor edit of example of making a header, to reflect the
+ new CLI.
+
+2004-05-20 08:39 tjdwave
+
+ * picheader/headmain.cpp: Fixed help message for CLI.
+
+2004-05-20 08:38 tjdwave
+
+ * decoder/decmain.cpp: Fixed minor bug with -verbose option to make
+ it true boolean.
+
+2004-05-20 08:37 tjdwave
+
+ * encoder/encmain.cpp: Corrected help text for CLI.
+
+2004-05-20 06:50 stuart_hc
+
+ * doc/dirac_api.doxygen, doc/dirac_api_foot.html,
+ doc/dirac_api_head.html, doc/libdirac_encoder_api_foot.html,
+ doc/libdirac_encoder_api_head.html,
+ libdirac_common/band_codec.cpp: Corrected CRLF line-endings to LF
+ for consistency.
+
+2004-05-20 06:35 stuart_hc
+
+ * NEWS: Added mention of libtool removal, slight rearrangement for
+ clarity. Corrected CRLF line-endings to LF.
+
+2004-05-20 06:31 stuart_hc
+
+ * README: Fixed incorrect interlace argument in DV transcode
+ example. Minor grammatical errors fixed.
+
+2004-05-19 18:08 chaoticcoyote
+
+ * README: Updated for changes in command-line parser
+
+2004-05-19 18:00 chaoticcoyote
+
+ * AUTHORS: Added my middle name to credits Corrected company name
+
+2004-05-19 13:39 chaoticcoyote
+
+ * decoder/decmain.cpp, encoder/encmain.cpp,
+ libdirac_common/cmd_line.cpp, libdirac_common/cmd_line.h,
+ picheader/headmain.cpp: Modified command line parser to correctly
+ handle boolean options
+
+2004-05-19 12:27 stuart_hc
+
+ * README: Added example usage for MPlayer, display (ImageMagick),
+ and transcode. Reformatted all example commands to be indented
+ for clarity.
+
+2004-05-19 11:51 tjdwave
+
+ * NEWS: More details for 0.3.0 release
+
+2004-05-19 10:29 tjdwave
+
+ * NEWS: Include release notes for 0.2.0 & 0.3.0
+
+2004-05-19 10:19 tjdwave
+
+ * TODO: Removed mention of frame buffer class, since now complete.
+
+2004-05-19 10:14 tjdwave
+
+ * AUTHORS: Added contributers.
+
+2004-05-19 10:04 tjdwave
+
+ * libdirac_common/pic_io.cpp: Changed YUV output to output lines
+ instead of bytes, according to patch provided by Malcolm Parsons
+
+2004-05-19 05:16 tjdwave
+
+ * libdirac_common/: mot_comp.cpp, pic_io.cpp: Replaced zero-padding
+ with edge-padding to eliminate colour-fringeing at low bitrates.
+ Mod to set padded values to 0 when compensating frames.
+
+2004-05-18 03:46 tjdwave
+
+ * README, encoder/encmain.cpp, libdirac_common/frame_buffer.cpp,
+ libdirac_common/frame_buffer.h, libdirac_common/pic_io.cpp,
+ libdirac_decoder/comp_decompress.cpp,
+ libdirac_decoder/comp_decompress.h,
+ libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/comp_compress.h,
+ libdirac_encoder/seq_compress.cpp: Added support for I-frame only
+ coding by setting num_L1 equal 0; num_L1 negative gives a single
+ initial I-frame ('infinitely' many L1 frames). Revised quantiser
+ selection to cope with rounding error noise.
+
+2004-05-14 13:27 stuart_hc
+
+ * decoder/decmain.cpp: Added better error checking.
+
+2004-05-14 13:25 stuart_hc
+
+ * libdirac_common/pic_io.cpp, libdirac_common/pic_io.h,
+ picheader/headmain.cpp: Replaced binary header files with ASCII
+ text format to achieve cross-platform interoperability.
+ Rearranged PicOutput constructor to permit code reuse from
+ picheader/headmain.cpp
+
+2004-05-14 13:20 stuart_hc
+
+ * decoder/Makefile.am, encoder/Makefile.am, picheader/Makefile.am:
+ Use LDADD to ensure files which depend on libraries are rebuilt
+ when necessary.
+
+2004-05-14 10:21 tjdwave
+
+ * README: Build information now incorporated.
+
+2004-05-14 06:48 stuart_hc
+
+ * bootstrap: Avoid errors when mixing versions of autotools.
+
+2004-05-14 06:47 stuart_hc
+
+ * make_debug.sh: Rearranged to use "make" to be more maintainable.
+
+2004-05-12 12:04 tjdwave
+
+ * decoder/decmain.cpp, picheader/headmain.cpp,
+ libdirac_encoder/seq_compress.cpp:
+ Done general code tidy, implementing copy constructors,
+ assignment= and const correctness for most classes. Replaced Gop
+ class by FrameBuffer class throughout. Added support for frame
+ padding so that arbitrary block sizes and frame dimensions can be
+ supported.
+
+2004-05-12 12:03 tjdwave
+
+ * encoder/encmain.cpp:
+ Done general code tidy, implementing copy constructors,
+ assignment= and const correctness for most classes. Replaced Gop
+ class by FrameBuffer class throughout. Added support for frame
+ padding so that arbitrary block sizes and frame dimensions can
+ be supported.
+
+2004-05-12 05:23 tjdwave
+
+ * reconf: Removed since it duplicated the job of ./bootstrap.
+
+2004-05-12 05:20 tjdwave
+
+ * dirac_build_howto.txt: All build instructions are now in the
+ README file. Information on creating a distribution removed
+ since it is not indended for the target audience.
+
+2004-05-12 04:46 tjdwave
+
+ * win/xparam/README: XParam library is no longer needed to build
+ Dirac.
+
+2004-05-12 04:35 tjdwave
+
+ * libdirac_common/arith_codec.h, libdirac_common/arrays.h,
+ libdirac_common/band_codec.cpp, libdirac_common/band_codec.h,
+ libdirac_common/bit_manager.cpp, libdirac_common/bit_manager.h,
+ libdirac_common/common.cpp, libdirac_common/common.h,
+ libdirac_common/context.h, libdirac_common/frame.cpp,
+ libdirac_common/frame.h, libdirac_common/golomb.cpp,
+ libdirac_common/golomb.h, libdirac_common/mot_comp.cpp,
+ libdirac_common/mot_comp.h, libdirac_common/motion.cpp,
+ libdirac_common/motion.h, libdirac_common/mv_codec.cpp,
+ libdirac_common/mv_codec.h, libdirac_common/pic_io.cpp,
+ libdirac_common/pic_io.h, libdirac_common/upconvert.cpp,
+ libdirac_common/upconvert.h, libdirac_common/wavelet_utils.cpp,
+ libdirac_common/wavelet_utils.h,
+ libdirac_decoder/comp_decompress.cpp,
+ libdirac_decoder/comp_decompress.h,
+ libdirac_decoder/frame_decompress.cpp,
+ libdirac_decoder/frame_decompress.h,
+ libdirac_decoder/seq_decompress.cpp,
+ libdirac_decoder/seq_decompress.h,
+ libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/comp_compress.h,
+ libdirac_encoder/frame_compress.cpp,
+ libdirac_encoder/frame_compress.h,
+ libdirac_encoder/seq_compress.h,
+ libdirac_motionest/block_match.cpp,
+ libdirac_motionest/block_match.h,
+ libdirac_motionest/downconvert.cpp,
+ libdirac_motionest/downconvert.h,
+ libdirac_motionest/me_mode_decn.cpp,
+ libdirac_motionest/me_mode_decn.h,
+ libdirac_motionest/me_subpel.cpp, libdirac_motionest/me_subpel.h,
+ libdirac_motionest/me_utils.cpp, libdirac_motionest/me_utils.h,
+ libdirac_motionest/motion_estimate.cpp,
+ libdirac_motionest/motion_estimate.h: Done general code tidy,
+ implementing copy constructors, assignment= and const correctness
+ for most classes. Replaced Gop class by FrameBuffer class
+ throughout. Added support for frame padding so that arbitrary
+ block sizes and frame dimensions can be supported.
+
+2004-05-12 04:21 stuart_hc
+
+ * libdirac_common/: gop.cpp, gop.h, Makefile.am: FrameBuffer
+ classes (frame_buffer.{cpp,h}) now replace Gop classes
+ (gop.{cpp,h}).
+
+2004-05-12 04:14 tjdwave
+
+ * libdirac_common/: frame_buffer.cpp, frame_buffer.h: Initial
+ commit of FrameBuffer classes to handle free-style temporal
+ reference structures. Replaces Gop class (gop.{cpp,h}).
+
+2004-05-11 12:11 stuart_hc
+
+ * Makefile.am, bootstrap, configure.ac, decoder/Makefile.am,
+ doc/Makefile.am, encoder/Makefile.am,
+ libdirac_common/Makefile.am, libdirac_decoder/Makefile.am,
+ libdirac_encoder/Makefile.am, libdirac_motionest/Makefile.am,
+ picheader/Makefile.am: Removed use of libtool - all libraries and
+ binaries are now static for ease of development & debugging.
+ Added tests for documentation tools and added documentation to
+ default make target 'all'.
+
+2004-05-11 10:17 tjdwave
+
+ * Makefile.am, README, configure.ac, dirac_build_howto.txt,
+ decoder/Makefile.am, decoder/decmain.cpp, encoder/Makefile.am,
+ encoder/encmain.cpp, libdirac_common/cmd_line.cpp,
+ libdirac_common/cmd_line.h, libdirac_encoder/seq_compress.cpp,
+ picheader/Makefile.am, picheader/headmain.cpp, win/Makefile,
+ win/README, win/xparam/README: Removed dependency on XParam CLI
+ library for both encoder and decoder.
+
+2004-05-11 10:15 tjdwave
+
+ * doc/dirac_algor.tex: Removed inline comments and notes. Added
+ text describing frame types (I, L1 and L2) and relation to MPEG
+ types.
+
+2004-05-10 00:44 chaoticcoyote
+
+ * doc/dirac_algor.tex: Newest version of "programmer's guide"
+
+2004-05-10 00:43 chaoticcoyote
+
+ * libdirac_common/: cmd_line.cpp, cmd_line.h: Simple, portable
+ command-line parser (eliminates Xparam dependency)
+
+2004-05-10 00:41 chaoticcoyote
+
+ * doc/dirac_algor.tex, encoder/encmain.cpp,
+ libdirac_common/Makefile.am: Updated dirac algorithm document
+ Modified encoder to use simple, portable command-line parser
+
+2004-05-09 21:04 chaoticcoyote
+
+ * encoder/decmain.cpp: Removed spurious file
+
+2004-04-25 18:27 chaoticcoyote
+
+ * win/: README, xparam/README: Read Me files to explain the context
+ of this directory and Makefile
+
+2004-04-25 18:16 chaoticcoyote
+
+ * win/Makefile: Added nmake makefile for Microsoft Visual C++
+
+2004-04-22 18:14 chaoticcoyote
+
+ * make_debug.sh: Enhanced the debug build script to support
+ different architectures
+
+2004-04-22 17:11 chaoticcoyote
+
+ * misc/xparam-1.22-gcc-3.4.0.patch: A patch for xparam 1.22 to work
+ around a GCC 3.4.0 internal compiler error
+
+2004-04-22 17:08 chaoticcoyote
+
+ * make_debug.sh, libdirac_encoder/comp_compress.cpp: Fixed warning
+ generated by some versions of GCC for
+ libdirac_encoder/comp_compress.cpp Added make_debug.sh script to
+ build debuggable, profilable versions of encoder and decoder
+
+2004-04-15 23:12 chaoticcoyote
+
+ * doc/Makefile.in: Removed spurious file
+
+2004-04-15 23:11 chaoticcoyote
+
+ * doc/: Makefile.in, dirac_api.doxygen.in: Added additional
+ documentation build files
+
+2004-04-15 23:10 chaoticcoyote
+
+ * Makefile.am, doc/Makefile.am, doc/dirac_api.doxygen: Addiitonal
+ work on generating docs for distribution
+
+2004-04-15 21:41 chaoticcoyote
+
+ * doc/: dirac_algor.tex, dirac_algorithm2.tex: Renamed algorithm
+ document
+
+2004-04-15 21:28 chaoticcoyote
+
+ * Makefile.am, doc/Makefile.am: Added documentation targets to
+ makefiles
+
+2004-04-15 09:59 chaoticcoyote
+
+ * configure.ac: Added doc/Makefile
+
+2004-04-15 09:57 chaoticcoyote
+
+ * doc/Makefile.am: Added makefile boilerplate to generate docusment
+ via "docs" target
+
+2004-04-15 09:54 chaoticcoyote
+
+ * configure.ac: Added program checks for Doxygen and LaTeX
+
+2004-04-15 08:31 chaoticcoyote
+
+ * configure.ac: Updated to version 0.2.0
+
+2004-04-15 08:30 chaoticcoyote
+
+ * doc/dirac_algorithm2.tex: Dirac algorithm document added
+
+2004-04-11 21:57 chaoticcoyote
+
+ * Makefile.am, decoder/decmain.cpp, encoder/encmain.cpp,
+ libdirac_common/pic_io.cpp: Fixed problem Intel C++ had in
+ finding xparam headers on Linux Solved Segmentation Fault bug in
+ pic_io.cpp
+
+2004-04-11 18:54 chaoticcoyote
+
+ * libdirac_common/: arith_codec.h, bit_manager.h, context.h:
+ Additional comments
+
+2004-04-11 18:50 chaoticcoyote
+
+ * libdirac_common/arrays.h, libdirac_common/band_codec.h,
+ libdirac_common/bit_manager.cpp, libdirac_common/common.cpp,
+ libdirac_common/common.h, libdirac_common/golomb.cpp,
+ libdirac_common/gop.cpp, libdirac_common/motion.cpp,
+ libdirac_common/motion.h, libdirac_common/mv_codec.cpp,
+ libdirac_common/pic_io.cpp, libdirac_common/upconvert.cpp,
+ libdirac_common/upconvert.h, libdirac_common/wavelet_utils.cpp,
+ libdirac_decoder/seq_decompress.cpp,
+ libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/seq_compress.cpp,
+ libdirac_motionest/block_match.cpp,
+ libdirac_motionest/downconvert.cpp,
+ libdirac_motionest/downconvert.h,
+ libdirac_motionest/me_mode_decn.cpp,
+ libdirac_motionest/me_utils.cpp,
+ libdirac_motionest/motion_estimate.cpp: Modifications to allow
+ compilation by Visual C++ 6.0 Changed local for loop declarations
+ into function-wide definitions Replaced variable array
+ declarations with new/delete of dynamic array Added second
+ argument to allocator::alloc calls, since MS has no default Fixed
+ missing and namespace problems with min, max, cos, and abs Added
+ typedef unsigned int uint (MS does not have this) Added a few
+ missing std:: qualifiers that GCC didn't require
+
+2004-04-11 12:25 chaoticcoyote
+
+ * windows/dirac/: dirac.dsw, libdirac_common/libdirac_common.dsp,
+ libdirac_decoder/libdirac_decoder.dsp,
+ libdirac_encoder/libdirac_encoder.dsp,
+ libdirac_motionest/libdirac_motionest.dsp: Added initial Windows
+ Visual Studio C++ 6.0 project files
+
+2004-04-06 14:06 chaoticcoyote
+
+ * libdirac_common/: arith_codec.h, arrays.h, band_codec.h,
+ bit_manager.h, common.h, context.h, frame.h, gop.h, mot_comp.h,
+ motion.h, mv_codec.h, pic_io.h, upconvert.h, wavelet_utils.h:
+ Boilerplate for Doxygen comments; testing ability to commit into
+ SF CVS
+
+2004-04-04 23:05 chaoticcoyote
+
+ * libdirac_motionest/: downconvert.h, me_mode_decn.h, me_subpel.h,
+ me_utils.h, motion_estimate.h: Updated Doxygen API documentation
+ comments Test to see if Scott's CVS is now working correctly
+
+2004-03-30 10:52 chaoticcoyote
+
+ * doc/dirac_api.doxygen, libdirac_encoder/frame_compress.h,
+ libdirac_encoder/seq_compress.h: New Doxygen comments
+
+2004-03-28 20:52 chaoticcoyote
+
+ * libdirac_decoder/: comp_decompress.h, frame_decompress.h,
+ seq_decompress.h: Added Doxygen comments
+
+2004-03-21 20:33 chaoticcoyote
+
+ * doc/dirac_doc_howto.txt: Added more description of HTML and LATEX
+ document generation
+
+2004-03-21 20:04 chaoticcoyote
+
+ * libdirac_encoder/: comp_compress.cpp, comp_compress.h,
+ frame_compress.h, seq_compress.cpp, seq_compress.h: Added API
+ documentation to encoder library Moved large constructors so they
+ are no longer inlined
+
+2004-03-21 16:01 chaoticcoyote
+
+ * doc/: libdirac_encoder_api_foot.html,
+ libdirac_encoder_api_head.html: Adding custome header and footer
+ for HTML libdirac_encoder docs
+
+2004-03-21 16:00 chaoticcoyote
+
+ * doc/: libdirac_encoder_api.doxygen, libdirac_encoder_foot.html,
+ libdirac_encoder_head.html: Adjusting file names
+
+2004-03-21 15:51 chaoticcoyote
+
+ * doc/: libdirac_encoder_api.doxygen, libdirac_encoder_foot.html,
+ libdirac_encoder_head.html: Added files to generate socumentation
+ specific to libdirac_encoder
+
+2004-03-21 14:26 chaoticcoyote
+
+ * doc/dirac_api.doxygen: Change graphic configuration
+
+2004-03-21 09:05 chaoticcoyote
+
+ * dirac_build_howto.txt, doc/dirac_api.doxygen,
+ doc/dirac_api_foot.html, doc/dirac_api_head.html,
+ doc/dirac_doc_howto.txt: Updated documentation files
+
+2004-03-21 08:06 chaoticcoyote
+
+ * ltmain.sh, reconf: Updated autoconf to use libtoolize Removed
+ spurious ltmain.sh
+
+2004-03-19 02:43 chaoticcoyote
+
+ * doc/dirac_algorithm.doc: Removed Word doc because the conversion
+ didn't work
+
+2004-03-19 02:35 chaoticcoyote
+
+ * doc/: dirac_algorithm.doc, dirac_api.doxygen: Created document
+ diractory Populated doc directory with preliminary texts
+
+2004-03-13 12:34 chaoticcoyote
+
+ * decoder/Makefile.am, encoder/Makefile.am,
+ libdirac_decoder/Makefile.am, libdirac_encoder/Makefile.am,
+ libdirac_motionest/Makefile.am: Disabled auto-dependency checking
+ in newer versions of AutoMake
+
+2004-03-13 12:11 chaoticcoyote
+
+ * ltmain.sh, reconf, libdirac_common/Makefile.am: Required files
+ for for autoconf
+
+2004-03-12 12:09 chaoticcoyote
+
+ * NEWS: Minor change to test commit ability
+
+2004-03-11 12:45 timborer
+
+ * AUTHORS, COPYING, ChangeLog, INSTALL, Makefile.am, NEWS, README,
+ TODO, bootstrap, configure.ac, dirac.pc.in, decoder/Makefile.am,
+ decoder/decmain.cpp, encoder/Makefile.am, encoder/decmain.cpp,
+ encoder/encmain.cpp, libdirac_common/Makefile.am,
+ libdirac_common/arith_codec.h, libdirac_common/arrays.h,
+ libdirac_common/band_codec.cpp, libdirac_common/band_codec.h,
+ libdirac_common/bit_manager.cpp, libdirac_common/bit_manager.h,
+ libdirac_common/common.cpp, libdirac_common/common.h,
+ libdirac_common/context.h, libdirac_common/frame.cpp,
+ libdirac_common/frame.h, libdirac_common/golomb.cpp,
+ libdirac_common/golomb.h, libdirac_common/gop.cpp,
+ libdirac_common/gop.h, libdirac_common/mot_comp.cpp,
+ libdirac_common/mot_comp.h, libdirac_common/motion.cpp,
+ libdirac_common/motion.h, libdirac_common/mv_codec.cpp,
+ libdirac_common/mv_codec.h, libdirac_common/pic_io.cpp,
+ libdirac_common/pic_io.h, libdirac_common/upconvert.cpp,
+ libdirac_common/upconvert.h, libdirac_common/wavelet_utils.cpp,
+ libdirac_common/wavelet_utils.h, libdirac_decoder/Makefile.am,
+ libdirac_decoder/comp_decompress.cpp,
+ libdirac_decoder/comp_decompress.h,
+ libdirac_decoder/frame_decompress.cpp,
+ libdirac_decoder/frame_decompress.h,
+ libdirac_decoder/seq_decompress.cpp,
+ libdirac_decoder/seq_decompress.h, libdirac_encoder/Makefile.am,
+ libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/comp_compress.h,
+ libdirac_encoder/frame_compress.cpp,
+ libdirac_encoder/frame_compress.h,
+ libdirac_encoder/seq_compress.cpp,
+ libdirac_encoder/seq_compress.h, libdirac_motionest/Makefile.am,
+ libdirac_motionest/block_match.cpp,
+ libdirac_motionest/block_match.h,
+ libdirac_motionest/downconvert.cpp,
+ libdirac_motionest/downconvert.h,
+ libdirac_motionest/me_mode_decn.cpp,
+ libdirac_motionest/me_mode_decn.h,
+ libdirac_motionest/me_subpel.cpp, libdirac_motionest/me_subpel.h,
+ libdirac_motionest/me_utils.cpp, libdirac_motionest/me_utils.h,
+ libdirac_motionest/motion_estimate.cpp,
+ libdirac_motionest/motion_estimate.h, picheader/Makefile.am,
+ picheader/headmain.cpp: Initial import (well nearly!)
+
+2004-03-11 12:45 timborer
+
+ * AUTHORS, COPYING, ChangeLog, INSTALL, Makefile.am, NEWS, README,
+ TODO, bootstrap, configure.ac, dirac.pc.in, decoder/Makefile.am,
+ decoder/decmain.cpp, encoder/Makefile.am, encoder/decmain.cpp,
+ encoder/encmain.cpp, libdirac_common/Makefile.am,
+ libdirac_common/arith_codec.h, libdirac_common/arrays.h,
+ libdirac_common/band_codec.cpp, libdirac_common/band_codec.h,
+ libdirac_common/bit_manager.cpp, libdirac_common/bit_manager.h,
+ libdirac_common/common.cpp, libdirac_common/common.h,
+ libdirac_common/context.h, libdirac_common/frame.cpp,
+ libdirac_common/frame.h, libdirac_common/golomb.cpp,
+ libdirac_common/golomb.h, libdirac_common/gop.cpp,
+ libdirac_common/gop.h, libdirac_common/mot_comp.cpp,
+ libdirac_common/mot_comp.h, libdirac_common/motion.cpp,
+ libdirac_common/motion.h, libdirac_common/mv_codec.cpp,
+ libdirac_common/mv_codec.h, libdirac_common/pic_io.cpp,
+ libdirac_common/pic_io.h, libdirac_common/upconvert.cpp,
+ libdirac_common/upconvert.h, libdirac_common/wavelet_utils.cpp,
+ libdirac_common/wavelet_utils.h, libdirac_decoder/Makefile.am,
+ libdirac_decoder/comp_decompress.cpp,
+ libdirac_decoder/comp_decompress.h,
+ libdirac_decoder/frame_decompress.cpp,
+ libdirac_decoder/frame_decompress.h,
+ libdirac_decoder/seq_decompress.cpp,
+ libdirac_decoder/seq_decompress.h, libdirac_encoder/Makefile.am,
+ libdirac_encoder/comp_compress.cpp,
+ libdirac_encoder/comp_compress.h,
+ libdirac_encoder/frame_compress.cpp,
+ libdirac_encoder/frame_compress.h,
+ libdirac_encoder/seq_compress.cpp,
+ libdirac_encoder/seq_compress.h, libdirac_motionest/Makefile.am,
+ libdirac_motionest/block_match.cpp,
+ libdirac_motionest/block_match.h,
+ libdirac_motionest/downconvert.cpp,
+ libdirac_motionest/downconvert.h,
+ libdirac_motionest/me_mode_decn.cpp,
+ libdirac_motionest/me_mode_decn.h,
+ libdirac_motionest/me_subpel.cpp, libdirac_motionest/me_subpel.h,
+ libdirac_motionest/me_utils.cpp, libdirac_motionest/me_utils.h,
+ libdirac_motionest/motion_estimate.cpp,
+ libdirac_motionest/motion_estimate.h, picheader/Makefile.am,
+ picheader/headmain.cpp: Initial revision
+
diff --git a/src/filters/parser/diracsplitter/libdirac/ChangesForGuliverkli b/src/filters/parser/diracsplitter/libdirac/ChangesForGuliverkli
new file mode 100644
index 000000000..88cc42141
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/ChangesForGuliverkli
@@ -0,0 +1,39 @@
+libdirac_common:
+----------------
+
+array.h:
+
+ TwoDArray::Init, private -> public
+
+band_codec.cpp:
+
+ BandCodec::ChooseContext, reduced the number of if's (very frequently called function)
+
+mot_comp.cpp:
+
+ MotionCompensator::ReConfig, fixed a memory leak
+
+ for(int i = 0; i < 9; i++)
+ // m_block_weights[i] = *(new TwoDArray<CalcValueType>( m_bparams.Yblen() , m_bparams.Xblen() ));
+ // m_block_weights[i] = TwoDArray<CalcValueType>(m_bparams.Yblen(), m_bparams.Xblen());
+ m_block_weights[i].Init(m_bparams.Yblen(), m_bparams.Xblen());
+
+libdirac_decoder:
+-----------------
+
+dirac_parser.cpp:
+
+ dirac_decoder_close, fixed a memory leak (delete decoder->fbuf was missing)
+
+frame_decompress.cpp:
+
+ FrameDecompressor::ReadFrameHeader, fixed a memory leak (delete m_fparams was missing)
+
+seq_decompress.cpp:
+
+ SequenceDecompressor::SequenceDecompressor, changed the init value of m_current_code_fnum from 0 to -1
+
+ SequenceDecompressor::DecompressNextFrame, added a few lines to be able to start decoding from any I frame
+ // fixes random access
+ if (m_current_code_fnum < 0 && m_fdecoder->GetFrameParams().FSort() == I_frame)
+ m_current_code_fnum = m_fdecoder->GetFrameParams().FrameNum();
diff --git a/src/filters/parser/diracsplitter/libdirac/NEWS b/src/filters/parser/diracsplitter/libdirac/NEWS
new file mode 100644
index 000000000..a6d1c1e03
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/NEWS
@@ -0,0 +1,130 @@
+dirac_0.5.0
+===========
+ - Added C interface for the encoder application. Refer to the api
+ documentation in dirac_encoder.h or in the Programmer's Guide at
+ http://dirac.sourceforge.net/documentation/code/programmers_guide/index.htm
+ - Updated bitstream version. Encoder/Decoder apps in this release will not
+ be able to decode bitstreams generated by earlier versions.
+ - Improvements to Constant Quality encoding engine to improve stability.
+ - Speed-ups to motion compensation and wavelet transform for faster decoding
+ - Removed rounding errors from motion compensation.
+ - Fixed bugs with clipping and encoding black or white areas.
+ - Fixed bug with overflow in context modelling for arithmetic coding of
+ HD pictures.
+ - Added unit tests for motion compensation classes and wavelet classes.
+ - The number of frames parameter is no longer required. All existing picture
+ header files must be recreated using make_header for this parameter to be
+ omitted. Otherwise, incorrect bit rates will be reported by the encoder
+ application.
+ - Updated algortihm documentation.
+ - Restructured libraries so that only two libraries are generated - an encoder
+ library and a decoder library. 'make install' will now install only the
+ public API libraries and header files, the encoder and decoder apps and the
+ conversion and instrumentation utilities.
+ - Added support for building shared and/or static libraries using libtool
+ under UNIX, GNU/Linux. Shared and static libraries are built by default.
+ - Added support for building shared or static libraries under MS Windows
+ using MSYS and the no cost MSVC++ 2003 toolkit. Shared libraries are built
+ by default.
+ - Added support for building the codec using MS Visual C++ .NET 2003 under
+ MS Windows. Options are available to build Dlls and static libraries.
+ The _declspec mechanism is used to export the Encoder and Decoder public
+ "C" API.
+ - New target 'valgrind-check' added to make under Linux.
+ - Build under MS Windows using nmake no longer supported.
+ - Bug fixes: 1050816, 1055692, 1050757, 1044503, 1044501, 1044499
+ - Patches Applied: 1055714, 1055707, 1061923, 1071429, 1059342
+
+dirac-0.4.3
+===========
+ - Quality metric has changed from PSNR to one based on 4th powers of errors.
+ This results in pictures with more stable quality and fewer artefacts.
+ - Fixed bug with scaling motion vectors for non 4:4:4 formats.
+ - Fixed bug in encoder in downconverting a picture with odd valued dimensions
+ - Fixed bug in encoder in handling input with 4:1:1 chroma format.
+ - Fixed bug in diagnostics tool in handling input with 4:1:1 chroma format.
+ - Updated algorithm documentation
+
+dirac-0.4.2
+===========
+ - Fixed bugs in writing instrumentation data while encoding which
+ caused the diagnostics tool to go into an infinite loop
+ - Fixed bug in diagnostic tool when handling reference 2 and only
+ one reference frame is available
+ - Number of frames in encoded output header is now set correctly to
+ the number of frames encoded.
+ - Fixed bug with bit-rate being miscalculated when only a section of the
+ sequence is encoded.
+ - Fixed bug with setting DC band perceptual weight.
+
+dirac-0.4.1
+===========
+ - Added support for build under Microsoft Windows using gnu autotools,
+ MSYS and no-cost MS VC++ 2003 compiler
+
+ - Fixed bug in building unit tests when older versions of cppunit are
+ installed
+
+ - Fixed bugs in measurement of PSNR and motion estimation process
+
+dirac-0.4.0
+===========
+ - Added constant quality encoding interface using PSNR
+ as the quality measure, and using multi-pass frame
+ coding
+ - Added Intra-frame insertion and cut detection
+ - Added C interface for the decoder application to allow
+ interfacing to player software. Refer to the api documentation
+ in dirac_parser.h.
+ - Implemented unique frame headers to facilitate bit-stream
+ parsing
+ - Added instrumentation output from encoder and an
+ instrumentation display tool for visualising encoder
+ decisions to help with algorithmic development
+ - Cleansed and refactored numerous code files to add comments,
+ improve readability and modularity
+ - Added a unit testing framework based on cppunit for testing
+ classes
+ - Fixed bug with vertical block separation always being set
+ to 8 pixels
+ - Added feature to encode only a section of input video rather
+ than the whole sequence
+ - Tweaked motion estimation parameters to improve performance,
+ mostly for higher-res pictures
+ - Included document describing the syntax of Dirac bitstream v0.1
+ in the doc directory.
+ - Fixed bug 1008694 (Out-of-tree building fails)
+ - Fixed header and pkconfig installation
+ - Updated algorithm documentation
+
+Dirac-0.3.1
+===========
+ - Fixed compiling under Windows
+ - Video conversion utilites now build under Windows
+ - Colour conversion matrix coefficients corrected in conversion utilites
+
+Dirac-0.3.0
+===========
+ - Added conversion utilities for going to and from RGB and
+ various YUV formats, plus bitmaps
+ - Fixed serious artifacts when frame dimensions are not multiples of 32
+ - Performance speed up writing output to disk
+ - Changed .hdr format from binary to text for cross-platform interoperability
+ - Added autotest framework with simple colour-bars test
+ - Added format conversion, MPlayer and ImageMagick examples to README
+ - Added decoder support for arbitrary temporal prediction structures
+ - Added support for I-frame only coding
+ - Added support for coding with a single initial I-frame
+ - Extended code documentation to all major classes
+
+Dirac-0.2.0
+===========
+ - Fixed crash when frame dimensions are not multiples of 32
+ - Removed dependency on XParam library
+ - Removed libtool for faster compiles and ease of debugging
+ - Included doxygen documentation of major classes
+ - Initial "programmer's guide" documentation - doc/dirac_algor.tex
+
+Dirac-0.1.0
+===========
+ - Initial Sourceforge release.
diff --git a/src/filters/parser/diracsplitter/libdirac/README b/src/filters/parser/diracsplitter/libdirac/README
new file mode 100644
index 000000000..de145912d
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/README
@@ -0,0 +1,326 @@
+README for the Dirac video codec
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+by Thomas Davies, BBC R&D (dirac@rd.bbc.co.uk)
+
+
+1. Executive Summary
+~~~~~~~~~~~~~~~~~~~~
+
+Dirac is an open source video codec. It uses a traditional hybrid video codec
+architecture, but with the wavelet transform instead of the usual block
+transforms. Motion compensation uses overlapped blocks to reduce block
+artefacts that would upset the transform coding stage.
+
+Dirac can code just about any size of video, from streaming up to HD and
+beyond, although certain presets are defined for different applications and
+standards. These cover the parameters that need to be set for the encoder to
+work, such as block sizes and temporal prediction structures, which must
+otherwise be set by hand.
+
+Dirac is intended to develop into real coding and decoding software, capable
+of plugging into video processing applications and media players that need
+compression. It is intended to develop into a simple set of reliable but
+effective coding tools that work over a wide variety of content and formats,
+using well-understood compression techniques, in a clear and accessible
+software structure. It is not intended as a demonstration or reference coder.
+
+
+2. Documentation
+~~~~~~~~~~~~~~~~
+
+A user guide and a guide to the software is in progress. More details on
+running the codec can be found at http://dirac.sourceforge.net/
+
+
+3. Building and installing
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ GNU/Linux, Unix, MacOS X, Cygwin, Mingw
+ ---------------------------------------
+ ./configure --enable-debug
+ (to enable extra debug compile options)
+ OR
+ ./configure --enable-profile
+ (to enable the g++ profiling flag -pg)
+ OR
+ ./configure --enable-debug --enable-profile
+ (to enable extra debug compile options and profiling options)
+ OR
+ ./configure
+
+ By default, both shared and static libraries are built. To build all-static
+ libraries use
+ ./configure --disable-shared
+
+ To build shared libraries only use
+ ./configure --disable-static
+
+ make
+ make install
+
+ The INSTALL file documents arguments to ./configure such as
+ --prefix=/usr/local (specify the installation location prefix).
+
+
+ MSYS and Microsoft Visual C++
+ -----------------------------
+ Download and install the no-cost Microsoft C++ compiler from
+ http://msdn.microsoft.com/visualc/vctoolkit2003/
+
+ Download and install MSYS (the MinGW Minimal SYStem), MSYS-1.0.10.exe,
+ from http://www.mingw.org/download.shtml. An MSYS icon will be available
+ on the desktop.
+
+ Click on the MSYS icon on the desktop to open a MSYS shell window.
+
+ Create a .profile file to set up the environment variables required.
+ vi .profile
+
+ Include the following three lines in the .profile file.
+
+ export PATH=/c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/bin:$PATH
+ export INCLUDE=/c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/include
+ export LIB=/c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/lib
+
+ (Replace /c/Program\ Files/Microsoft\ Visual\ C++\ Toolkit\ 2003/ with
+ the location where VC++ 2003 is installed if necessary)
+
+
+ Exit from the MSYS shell and click on the MSYS icon on the desktop to open
+ a new MSYS shell window for the .profile to take effect.
+
+ Change directory to the directory where Dirac was unpacked. By default
+ only the dynamic libraries are built.
+
+ ./configure CXX=cl --enable-debug
+ (to enable extra debug compile options)
+ OR
+ ./configure CXX=cl --disable-shared
+ (to build static libraries)
+ OR
+ ./configure CXX=cl
+ make
+ make install
+
+ The INSTALL file documents arguments to ./configure such as
+ --prefix=/usr/local (specify the installation location prefix).
+
+ Microsoft Visual C++ .NET 2003
+ ------------------------------
+ The MS VC++ .NET 2003 solution and project files are in win32/VS2003
+ directory. Double-click on the solution file, dirac.sln, in the
+ win32/VS2003 directory. The target 'Everything' builds the codec
+ libraries and utilities. Four build-types are supported
+
+ Debug - builds unoptimised encoder and decoder dlls with debug symbols
+ Release - builds optimised encoder and decoder dlls
+ Static-Debug - builds unoptimised encoder and decoder static libraries
+ with debug symbols
+ Static-Release - builds optimised encoder and decoder static libraries
+
+ Static libraries are created in the win32/VS2003/lib/<build-type> directory.
+
+ Encoder and Decoder dlls and import libraries, encoder and decoder apps are
+ created in the win32/VS2003/bin/<build-type> directory. The "C" public API
+ is exported using the _declspec(dllexport) mechanism.
+
+ Conversion utilites are created in the
+ win32/VS2003/utils/conversion/<build-type> directory. Only static versions
+ are built.
+
+ Instrumentation utility is created in the
+ win32/VS2003/utils/instrumentation/<build-type> directory. Only static
+ versions are built.
+
+
+4. Running the example programs
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+4.1 Command-line parameters
+
+At the moment there is a simple command-line parser class which is
+used in all the executables. The general procedure for running a program
+is to type:
+
+ prog_name -<flag_name> flag_val ... param1 param2 ...
+
+In other words, options are prefixed by a dash; some options take values,
+while others are boolean options that enable specific features. For example:
+When running the encoder, the -qf options requires a numeric argument
+specifying the "quality factor" for encoding. The -verbose option enables
+detailed output and does not require an argument.
+
+Running any program without arguments will display a list of parameters and
+options.
+
+4.2 File formats
+
+The example coder and decoder use a temporary file format which consists of
+raw 8-bit planar YUV data together with a header file. This means that data
+is stored bytewise, with a frame of Y followed by a frame of U followed by
+a frame of V, all scanned in the usual raster order.
+
+Other file formats are supported by means of conversion utilities that
+may be found in the subdirectory util/conversion. These will convert to
+and from raw RGB format, and support all the standard raw YUV formats as
+well as bitmaps. Raw RGB can be obtained as an output from standard conversion
+utilities such as ImageMagick.
+
+Once a raw YUV file has been made, in order to run the codec, a header must be
+constructed. The header records such picture information as: the picture
+dimensions, which are taken to be those of the luminance or Y component, and
+other metadata. The other metadata consists of the chroma format, the frame
+rate in Hertz, a flag indicating interlace and, if interlace, a flag
+indicating whether the interlace is top-field first. The chroma format setting
+records whether the video is sampled 4:4:4, 4:2:2, 4:1:1 or 4:2:0, and is
+essential. The frame rate setting is used to calculate bit-rate for the
+encoder, and display rate for the decoder, and if omitted a rate of 12Hz is
+assumed.
+
+The header file is made using the make_header tool in subdirectory
+picheader/make_header. It's in text format so can also be edited manually.
+
+Example.
+ Compress an image sequence of 100 frames of 352x288 video in tiff format.
+
+ Step 1.
+
+ Use your favourite conversion routine to produce a single raw RGB file of
+ all the data. If your routine converts frame-by-frame then you will
+ need to concatenate the output.
+
+ Step 2.
+
+ Convert from RGB to the YUV format of your choice. For example, to do
+ 420, type
+
+ RGBtoYUV420 <file.rgb >file.yuv 352 288 100
+
+ Note that this uses stdin and stdout to read and write the data.
+
+ Step 3.
+
+ Make the appropriate header to accompany the raw data file:
+
+ make_header -xl 720 -yl 576 -cformat format420 -framerate 25 -interlace file
+
+ This writes file.hdr with the corresponding parameters.
+
+ Step 4.
+
+ Run the encoder. This will produce a locally decoded output in the
+ same format.
+
+ Step 5.
+
+ Convert back to RGB.
+
+ YUV420toRGB <file.yuv >file.rgb 352 288 100
+
+ Step 6.
+
+ Use your favourite conversion utility to convert to the format of your
+ choice.
+
+You can also use the transcode utility to convert data to and from Dirac's
+native formats (see http://zebra.fh-weingarten.de/~transcode/):
+
+ This example uses a 720x576x50 DV source, and transcodes to 720x576 YUV in
+ 4:2:0 chroma format. Cascading codecs (DV + Dirac) is generally a bad idea
+ - use this only if you don't have any other source of uncompressed video.
+
+ transcode -i source.dv -x auto,null --dv_yuy2_mode -k -V -y raw,null -o file.avi
+ tcextract -i test.avi -x rgb > file.yuv
+
+ make_header -xl 720 -yl 576 -cformat format420 -framerate 25 -interlace file
+
+Viewing and playback utilities for uncompressed video include MPlayer and
+ImageMagick's display command.
+
+ Continuing the 352x288 4:2:0 example above, to display a single frame
+ of raw YUV with ImageMagick use the following (use <spacebar> to see
+ subsequent frames):
+
+ display -size 352x288 test.yuv
+
+ Raw YUV 420 data can also be played back in MPlayer - use the following
+ MPlayer command:
+
+ mplayer -fps 15 -rawvideo on:size=152064:w=352:h=288 test.yuv
+
+ (at the time of writing MPlayer could not playback 4:2:2 or 4:4:4 YUV data)
+
+
+4.3 Encoding
+
+There are a large number of parameters that can be used to run the encoder,
+all of which are listed below, and which are set using the same conventions as
+for make_header. However, things are simplified by using presets for different
+applications. These set such things as block sizes and overlaps for motion
+estimation and compensation (the codec used overlapped blocks), and
+psychovisual weighting. They also define the context in which other parameters
+like quality factors, operate. The presets are:
+
+CIF : for CIF video
+SD576 : for standard definition video
+HD720 : for 1280x720 High Definition progressive video
+HD1080 : for 1920/1440x1080 High Definition progressive video [not yet supported]
+
+The other useful parameter is the quality factor qf. This is a number from 0
+to 10. The higher the number, the better the quality. The encoder attempts to
+adapt the encoding process to produce constant quality across the sequence.
+(Due to variations in the content, it may not exactly achieve this.)
+
+Simple coding example. Code an SD sequence to high quality.
+
+Solution.
+
+ dirac_encoder -SD576 -qf 9 test test_out
+
+will read test.yuv and test.hdr as input, and output a compressed bitstream
+test_out.drc as well as locally-decoded files test_out.yuv and test_out.hdr.
+
+Other parameters.
+
+verbose : turn on verbosity (if you don't, you won't see the final bitrate!)
+start : code from this frame number
+stop : code up until this frame number
+L1_sep : the separation between L1 frames (frames that are predicted but
+ also used as reference frames, like P frames in MPEG-2)
+num_L1 : the number of L1 frames before the next intra frame
+xblen : the width of blocks used for motion compensation
+yblen : the height of blocks used for motion compensation
+xbsep : the horizontal separation between blocks. Always <xblen
+ybsep : the vertical separation between blocks. Always <yblen
+cpd : normalised viewing distance parameter, in cycles per degree.
+nolocal : Do no generate diagnostics and locally decoded output
+
+Using -start and -stop allows a small section to be coded, rather than the
+whole thing.
+
+Modifying L1_sep and num_L1 allows for new GOP structures to be used, and
+should be entirely safe. There are two non-GOP modes that can also be used for
+encoding: setting num_L1=0 gives I-frame only coding, and setting num_L1<0
+will produce a sequence with infinitely many L1 frames i.e. with a single I
+frame at the beginning of the sequence.
+
+Modifying the block parameters is strongly deprecated: it's likely to break
+the encoder as there are many constraints. Modifying cpd will not break
+anything, but will change the way noise is distributed which may be more (or
+less) suitable for your application. Setting cpd equal zero turns off
+perceptual weighting altogether.
+
+Block separations must currently be set so that an integral number of
+macroblocks fits into the frame horizontally and vertically. A macroblock is a
+4x4 set of blocks, so 4xblen must divide the frame width and 4yblen the frame
+height.
+
+4.4 Decoding
+
+Decoding is much simpler. Just point the decoder input at the bitstream and the
+output to a file:
+
+ dirac_decoder -verbose test_enc test_dec
+
+will decode into test_dec.{yuv,hdr} with running commentary.
diff --git a/src/filters/parser/diracsplitter/libdirac/README.developers b/src/filters/parser/diracsplitter/libdirac/README.developers
new file mode 100644
index 000000000..74016dff8
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/README.developers
@@ -0,0 +1,406 @@
+Dirac software development practices
+====================================
+
+Contents
+--------
+
+1. Licenses and submitting work
+
+2. Sourceforge Developers forum
+
+3. Mailing lists
+
+4. Using the CVS repository
+
+5. CVS log messages
+
+6. Software practices
+
+7. Profiling & optimisation
+
+8. Line-endings
+
+9. Binary files in CVS
+
+
+
+1. Licenses and submitting work
+-------------------------------
+
+Developers submitting work to the Dirac project should print out,
+complete, and sign the Developer's Certificate of Origin contained
+in the DCO.developers file. It should be posted to:
+
+Dr Tim Borer
+BBC Research and Development
+Kingswood Warren
+Tadworth
+Surrey KT20 6NP
+United Kingdom
+
+For simplicity developers must submit code using the same
+license that we distribute under, which is the Mozilla Triple
+license (http://www.mozilla.org/MPL/). Using any other license
+causes complexity and FUD.
+
+Contributions should be in the form of a patch, which may be for a
+whole directory. For changes to an existing file all that is needed
+is to add the author's name to the list of contributors, since the
+license will remain the MPL. For new files, the header in each file
+should be completed from Exhibit A, the Mozilla Triple License (from the
+COPYING file). It should NOT be copied from files already obtained
+in the Dirac project, since some details may differ.
+
+To create a context diff patch run the command
+
+diff -ruN compress-orig compress-mods > patch.txt
+
+ where compress-orig is the directory with the original code and
+ compress-mods is the directory with the modified files.
+
+The patch.txt file should then be submitted to the Sourceforge Patch
+tracker.
+
+2. Sourceforge Developers forum
+-------------------------------
+The Developers forum is where Dirac core developers plan and coordinate
+changes to Dirac. All API changes, new features and implementation
+difficulties are announced and discussed here.
+
+Examples of changes which should be announced in the Developers forum:
+
+ - Pic API change: return bool instead of void for ReadNextFrame
+ - Pic API change: most methods can now throw ErrorState objects
+
+Changes which are small in scope and unlikely to affect developers
+should not be announced on the forum. Changes which touch
+many files can fall into this category - for example
+
+ - Fixed inconsistent CRLF line-endings to be LF.
+ - Fixed "use of uninitialised variable" cases found by gcc.
+ - Fixed memory leak in all instantiations of Pic (found by valgrind).
+ - Add feature test for stdint.h to be portable to Solaris.
+
+Developers should 'monitor' the forums by going to the forum page and
+clicking 'Monitor this forum'. Any new message will then be emailed
+to their username@users.sourceforge.net email address.
+ http://sourceforge.net/forum/forum.php?forum_id=353620
+
+
+3. Mailing lists
+----------------
+Developers should subscribe to the dirac-announce and dirac-commits
+mailing lists. dirac-announce is used to announce new releases and
+dirac-commits is sent mail automatically for every commit.
+
+
+4. Using the CVS repository
+---------------------------
+
+The latest (but non-stable) version of the code can be downloaded direct
+from the Sourceforge repository using anonymous CVS. Instructions for
+doing so can be found at the Dirac CVS page:
+
+http://sourceforge.net/cvs/?group_id=102564
+
+The Dirac codec module is called 'compress'.
+
+To compile the codec from the CVS sources, the configure script must be
+built using autotools. The required autotool operations have been
+collated in a bootstrap script - simply type
+
+./bootstrap
+
+at the command prompt in the installation directory. Then follow the
+usual install instructions in the INSTALL document.
+
+5. CVS log messages
+-------------------
+Always indicate why the change is necessary in addition to a succinct summary
+of what as changed. As the number of developers increases it becomes
+increasingly difficult for developers to understand the changes going on in
+areas they are not familiar with. If the changes relate to an API change
+developers may not realise this if it is not mentioned in the log message
+as the reason for the change.
+
+E.g.
+ Bad
+ ---
+ - Added gamma parameter
+ - Replace stricmp with strcasecmp
+
+ Good
+ ----
+ - Added gamma parameter to record more accurate data on source material
+ - Enhanced portability: stricmp replaced by strcasecmp (the POSIX standard)
+
+
+6. Software practices
+---------------------
+I. Portability
+ This project aims to be as portable as possible and to that end follows the
+ following standards:
+ POSIX 1003.1 - System Interfaces volume (XSH) & Threads
+ ISO C99 (1999)
+ ISO C++ (1998)
+ The only exception to this practice is for the Microsoft Visual C++ compiler
+ which continues to fall short of all the above standards. Where MS VC++
+ is incompatible with the standards, experiment is often necessary to find
+ an alternative usage which works under MS VC++. Use of the _MSC_VER macro
+ in conditional compilation is the accepted way to accommodate such
+ differences.
+
+II. Coding Style
+
+ The following guidelines must be adhered to while developing code.
+
+-- CVS related tags
+
+ - Include the following RCS tags in all new files (.cpp and .h). Include them
+ on the first line of the licence block
+
+ Id
+ Name
+
+ E.g.
+ /* ***** BEGIN LICENSE BLOCK *****
+ *
+ * $Id: README.developers 280 2005-01-30 05:11:46Z gabest $ $Name$
+ *
+ * rest of licence text
+ * ***** END LICENSE BLOCK ***** */
+
+
+ - Remove the following tags from all files. Do not include them in new files
+ Author
+ Revision
+ Log
+
+-- General Source code formatting
+
+ - Use spaces in assigment statements and compound statements to make code
+ more readable.
+
+ E.g.
+ a = b;
+ if (a < b)
+ for (i=0; i<10; i++)
+ c = (a < b) ? a : b;
+
+ - Curly braces go on a separate line
+
+ E.g.
+
+ if (a < b)
+ {
+ statment1;
+ statement2;
+ .
+ .
+ .
+ }
+
+ Curly braces can be ommitted if there is only one statment in the block.
+
+ - Use space between the comment marker and start of text
+ E.g.
+
+ // this is a comment
+
+ /*
+ * This is a multiple line
+ * comment
+ */
+
+ - Use spaces instead of tabs for indentation
+
+ - Indent Constructor initialiser lists from the constructor name
+
+ E.g.
+ MyClass::Myclass (int val) :
+ m_val(val)
+ {
+ }
+
+-- Use of Namespaces
+
+ - All core Dirac functionality must be in the namespace dirac.
+ - All other functionality must be defined in a namespace of its own. E.g.
+ conversion utilities are in the namespace dirac_vu, instrumentation utilities
+ are in the namespace dirac_instr.
+
+-- General naming standards
+
+ - Local variables are lowercase and use underscores to separate words.
+
+ E.g.
+
+ int outer_loop_idx;
+
+ - Use constants instead of macros
+
+ - Type definitions and Enumerations start with an uppercase letter and
+ use lowercase multi-word names using an uppercase letter for each new word.
+
+ E.g
+
+ typedef int CompressionType;
+ enum CompSort {...};
+
+-- Class Definition
+
+ - Class names start with an uppercase letter and the use lowercase with
+ multi-word names using an uppercase letter for each new word.
+ E.g. ArithCodec
+
+ - Class member variables are lowercase with a leading "m_". Use underscores to
+ separate words.
+
+ E.g.
+ int m_num_contexts;
+
+ - Group declaration of member functions and member variables in the class
+ defintion based on access type.
+
+ E.g
+
+ class MyClass
+ {
+ public:
+ //constructor
+ MyClass (int val);
+
+ //access functions
+ int Value(void);
+ void SetValue(int val);
+
+ private:
+ void Init(int val);
+
+ private:
+ int m_val;
+ };
+
+ - Avoid declaring public member variables. Make them private and define access
+ functions to set/get their values.
+
+ - Avoid defining functions in class definitions except for trivial functions
+
+ - The declaration syntax for accessor/mutator functions is as follows
+
+ void SetVariable (const VariableType& var);
+
+ VariableType Variable() const;
+ const VariableType& Variable() const;
+
+
+ - Use builtin copy constructors and assigment operators whenever appropriate
+ e.g. when the class does not use dynamic memory allocation, but their use
+ should be commented. This is to ensure that changes to the class are properly
+ reflected in these operators.
+
+ - Encapsulate enumerated types in the class definition if the enumerated type
+ is relevant only to that class.
+
+ - Nest classes within a class if they have no meaning outside the context of
+ the class.
+
+-- Function Definitions
+
+ - Function names start with an upperccase letter and the use lowercase with
+ multi-word names using an uppercase letter for each new word.
+ E.g. ArithCodec
+
+ - Function parameters are lowercase. Use underscores to separate words.
+
+ void BandCodec::Resize(const int& context_num)
+
+ - Use the following notation for reference parameters in a function
+ void BandCodec::Resize(const int& context_num)
+ OR
+ void BandCodec::Resize(const int &context_num)
+
+ - Dummy argument names, if used, should be the same in the function
+ declarations and definitions to avoid confusion.
+
+
+III. Code Review
+
+ All code will be peer-reviewed before being checked in to SourceForge
+ CVS. Developers should use the guidelines specified in the Coding Style
+ sub-section while reviewing code.
+
+IV. Testing with "make check"
+ Developers should aim to have all the regression tests succeed. If a
+ developer anticipates breaking the tests (while a significant body of work
+ is being undertaken) this must be announced on the Developer Forum, and
+ the fixing of the tests would be coordinated there.
+
+ Developers should also aim to have good test coverage especially when
+ adding functionality. When adding a new feature, expect to be asked
+ "Where's the test?"
+
+ A new target 'valgrind-check' has been included which uses valgrind, if
+ available, to check for memory leaks, uninitialised memory reads, invalid
+ writes etc.
+
+7. Profiling & optimisation
+---------------------------
+Dirac is alpha software so developers cannot expect optimisation improvements
+to survive algorithm improvements or code refactoring and restructuring. That
+being said, the Dirac maintainers would like to encourage profiling analysis
+and portable and modular optimisation. Developers are encouraged to share
+their profiling analysis techniques and results. The following guidelines
+should be followed:
+ - Any optimisation patch must be accompanied by at least a summary of
+ profile analysis and timing results for a range of video material. There
+ must be sufficient information for other developers to reproduce the
+ results.
+ - A good example of modular and portable optimisations for MMX/SSE (x86),
+ ALTIVEC (PowerPC), VIS (SPARC) and Alpha can be found in libmpeg2's
+ motion compensation code:
+ mpeg2dec/libmpeg2/motion_comp.c
+ mpeg2dec/libmpeg2/motion_comp_alpha.c
+ mpeg2dec/libmpeg2/motion_comp_altivec.c
+ mpeg2dec/libmpeg2/motion_comp_mmx.c
+ mpeg2dec/libmpeg2/motion_comp_vis.c
+ - For MMX/SSE/SSE2 optimisations developers must use a compiler-portable
+ macro approach such as that adopted by libmpeg2. The Dirac maintainers
+ plan to use identical macro names to those found in
+ http://cvs.sourceforge.net/viewcvs.py/libmpeg2/mpeg2dec/include/mmx.h
+ http://cvs.sourceforge.net/viewcvs.py/libmpeg2/mpeg2dec/include/sse.h
+ - x86-specific optimisations need not be limited to MMX since SSE is
+ readily available on PentiumIII and AMD Athlons. SSE2 optimisation is
+ encouraged since it becoming more commonly available (on Pentium4,
+ Athlon64 and Opteron), but take care to use a portable 16byte memory
+ alignment technique.
+
+Profiling can be supported by adding the following parameter to ./configure
+before building:
+
+--enable-profile
+
+The code can then be profiled by, for example, gprof.
+
+
+8. Line-endings
+---------------
+All source code and documentation will have LF line-endings, include makefiles
+and scripts. The only exception will be for .vcproj and .sln (and any other
+WIN32 specific) files which will not function under MS VC++ unless they use
+CR-LF line-endings.
+
+
+9. Binary files in CVS
+----------------------
+CVS will modify files during checkin and checkout unless they are tagged as
+binary. The modifications include translation of CR-LF <-> LF (depending on
+the OS of the CVS client) and expansion of CVS keywords such as $Id and $Log.
+
+Files which must not be modified in this way must be tagged as binary either
+using the add command or admin command:
+ cvs add -kb fig1.jpg
+ cvs admin -kb fig1.jpg (for files already in CVS)
+
+MS VC++ project files, such as .vcproj and .sln, fall into this category since
+they do not function if their line-endings are not CR-LF.
diff --git a/src/filters/parser/diracsplitter/libdirac/TODO b/src/filters/parser/diracsplitter/libdirac/TODO
new file mode 100644
index 000000000..bcd69f2b7
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/TODO
@@ -0,0 +1,9 @@
+TO DO
+~~~~~
+
+Last updated 29 Nov 2004
+
+The most current list can be found at
+http://dirac.sourceforge.net/todo.html
+
+The list covers both software and algorithmic issues.
diff --git a/src/filters/parser/diracsplitter/libdirac/doc/dirac_bitstream.txt b/src/filters/parser/diracsplitter/libdirac/doc/dirac_bitstream.txt
new file mode 100644
index 000000000..b2f761713
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/doc/dirac_bitstream.txt
@@ -0,0 +1,81 @@
+Dirac Bitstream Format
+by Anuradha Suraparaju (anuradha@rd.bbc.co.uk)
+v0.1: 18-Aug-2004
+
+[ This document is a temporary document. It will be replaced by full-fledged
+ bitstream syntax and decoding process document in alpha release 0.5.0 ]
+
+1. Introduction
+
+ A Dirac bitstream is made of up of a sequence of one or more frames. Each
+ frame is either intra or inter-coded. Intra frames are compressed without
+ references to any other frame. Inter frames are motion compensated with
+ respect to one or more reference frames.
+
+2. Sequence structure
+
+ The start of a sequence is the only random access point in this version of
+ the Dirac bitstream. A random access point is from where a decoder can
+ start decoding the bitstream without prior information.
+
+2.1 Start codes
+
+ Start codes are unique bit patterns that do not otherwise occur in the
+ bitstream. They identify specific points in the bitstream e.g. start of
+ frame, start of sequence, etc. A start code is made up of a 4 byte
+ start code prefix and a one byte code. The start code prefix is
+
+ 0x42 0x42 0x43 0x44 (BBCD)
+
+ Due to the nature of the arithmetic coded output, the first four bytes can
+ be output as part of the component data and therefore an additional code is
+ required to indicate that a header does not follow. The different start
+ codes are
+
+ Code Description
+ 0xD7 Start of Sequence
+ 0xD6 Start of an I Frame
+ 0xD5 Start of an L2 Frame
+ 0xD4 Start of an L1 Frame
+ 0xD0 End of Sequence
+ 0xFF Not a header code treat code prefix and next byte as
+ data
+
+2.2 Sequence data
+
+ A sequence commences with a start of sequence code followed by
+ the sequence header which is followed by one or more coded frames.
+ The order of the coded frames in the coded bistream is in the order
+ in which the the decoder processes them but not in the display
+ order. The sequence is terminated by a sequence end code.
+
+ TODO: list sequence header fields
+
+2.3. Frame structure
+
+ Each frame commences with a start of frame code (I or L1 or L2 depending
+ on the type of frame) and is followed by a frame header. A frame can be
+ either an intra frame (I frame) or inter frame. There are two types of
+ inter-coded frames: Level 1 (L1) frames which are also used as temporal
+ references for other pictures and Level 2 (L2) pictures which are
+ bi-directionally predicted and are not used as temporal references. The
+ frame header is followed by motion vector data (for L1 and L2 frames only)
+ and component data.
+
+ TODO: list frame header fields and frame data format
+
+3. Bitstream syntax
+
+ Field Value
+
+ stream-id 8 byte identfier set to KW-DIRAC
+ sequence start code 0x42424344D7
+ sequence header Golomb coded sequence header
+ frame start code 0x42424344D6 (I) or 0x42424344D5(L2) or
+ 0x42424344D5 (L1)
+ frame header Golomb coded frame header
+ frame data Arithmetic coder output
+ .
+ .
+ .
+ sequence end code 0x42424344D0
diff --git a/src/filters/parser/diracsplitter/libdirac/doc/dirac_doc_howto.txt b/src/filters/parser/diracsplitter/libdirac/doc/dirac_doc_howto.txt
new file mode 100644
index 000000000..c8031033b
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/doc/dirac_doc_howto.txt
@@ -0,0 +1,48 @@
+Dirac Documentation HOW-TO
+
+by Scott Robert Ladd (scott.ladd@coyotyegulch.com)
+
+
+The Dirac technical documentation comes in two forms:
+
+1) Embedded API documentation that is extract via Doxygen to produce
+ external documentation in HTML and LATEX formats.
+
+2) A description of the Dirac Algorithms, maintained as a LATEX file
+ that serves as the source code for PostScript, PDF, and HTML
+ documents.
+
+This document describes how to build the Dirac documentation, and lsist
+the tools required for its creation.
+
+Producing API Documentation with Doxygen
+----------------------------------------
+
+Doxygen (http://www.doxygen.org) is an industry-standard program for
+extracting documentation from specially-formatted source code. In
+concept, Doxygen is similar to Java's Javadoc utility. Doxygen uses
+the GraphViz (http://www.graphviz.org) package to produce professional
+class diagrams from an analysis of the source code.
+
+Use the following command to produce the documents with Doxygen:
+
+ # doxygen dirac_api.doxygen
+
+The above command generates three directories filled with documentation
+in three formats: HTML, LATEX, and Unix man pages.
+
+The HTML can simply be copied to any appropriate directory on a web
+server for display.
+
+To generate a final PDF file from the LATEX source, simply execute a
+"make" command in the codec/doc/latex directory.
+
+
+Producing the Dirac Algorithm document
+--------------------------------------
+
+The source for Dirac Algorithm document is a LATEX
+(http://www.latex.org)
+
+[TODO]
+
diff --git a/src/filters/parser/diracsplitter/libdirac/doc/faq.htm b/src/filters/parser/diracsplitter/libdirac/doc/faq.htm
new file mode 100644
index 000000000..4f287d9a3
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/doc/faq.htm
@@ -0,0 +1,216 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+
+<html>
+ <head>
+ <meta name="generator" content="HTML Tidy, see www.w3.org">
+
+ <title>Dirac: Frequently asked questions</title>
+ </head>
+
+ <body>
+ <h1>Frequently asked questions</h1>
+
+ Last revised by Thomas Davies, 18 August 2004.
+
+ <p><a href="#1"> Who are you guys?</a></p>
+
+ <p><a href="#2"> How did Dirac begin?</a></p>
+
+ <p><a href="#3"> Why is it called Dirac?</a></p>
+
+ <p><a href="#4"> Why are you releasing Dirac Open Source?</a></p>
+
+ <p><a href="#5"> Where can I get Dirac?</a></p>
+
+ <p><a href="#6"> What are the license conditions?</a></p>
+
+ <p><a href="#6A"> Are you going to charge for Dirac?</p>
+
+ <p><a href="#6B"> Do the BBC have patents in Dirac?</p>
+
+ <p><a href="#7"> Do you infringe any patents?</a></p>
+
+ <p><a href="#8"> What will you do if you infringe patents?</a></p>
+
+ <p><a href="#9"> Is the BBC going to stream video using Dirac?</a></p>
+
+ <p><a href="#10"> Are you going to broadcast TV using Dirac?</a></p>
+
+ <p><a href="#11"> What about Ogg Theora?</a></p>
+
+ <p><a href="#12"> How does it work?</a></p>
+
+ <p><a href="#13"> Why did you choose the techniques that you're using?</a></p>
+
+ <p><a href="#14"> What's with your picture file format?</a></p>
+
+ <p><a href="#15"> How do I play compressed video?</a></p>
+
+ <p><a href="#16"> How do I code video?</a></p>
+
+ <p><a href="#17"> How can I help?</a></p>
+
+ <p><a href="#18"> What needs doing?</a></p>
+
+ <p><a href="#19"> When will Dirac be ready?</a></p>
+
+
+ <p><b><u><a name="1"> Who are you guys?</a></u></b></p>
+
+ The BBC Dirac team is led by Tim Borer, Principal R&D Engineer in the BBC Research and Development Department.
+ The main algorithm developer is Thomas Davies, Senior R&D Engineer, who devised the Dirac algorithm. The
+ software is managed by Anu Suraparaju, Senior R&D Engineer.
+
+ <p><b><u><a name="2"> How did Dirac begin?</a></u></b></p>
+
+ BBC R&D has always been involved in video coding research as it's central to what the BBC does. Thomas began
+ experimenting with compression techniques in about 2001, and developed various prototypes of coding tools. In
+ January 2003 he had a rough research system in place which seemed to perform well. Since then he's been working
+ to translate the software into something that could be the basis of a working codec, and to streamline the
+ design. This involved rewriting the codec entirely in C++ to exploit the flexibility and modularity
+ of the language.
+
+ <p><b><u><a name="3"> Why is it called Dirac?</a></u></b></p>
+
+ Dirac is named after the British physicist (of Swiss extraction) Paul Dirac, who was one of the great figures
+ in modern physics. We've seen some good explanations on the 'net,
+ suggesting that we chose the name because the Dirac delta function is fundamental to signal processing
+ and that Dirac's work underpins wavelets. Sorry, but the stories aren't true. We thought of
+ hundreds of names, most of them awful, some of them good, and most of the good ones had been used already.
+ Tim suggested Dirac. It sounded good. It stuck. It was going to be called Camel, so maybe we had a lucky
+ escape.
+
+ You can find out more about Paul Dirac <a href="http://www.dirac.ch/PaulDirac.html">here</a>.
+
+ <p><b><u><a name="4"> Why are you releasing Dirac Open Source?</a></u></b></p>
+
+ The BBC has always advocated open standards, and has tried to use them where possible. So far, streaming
+ has been dominated by proprietary systems and existing licensing regimes for standards-based systems
+ have not been as attractive as they might be for large-scale broadcasting, particularly for Public
+ Service broadcasters.
+
+ <p><b><u><a name="5"> Where can I get Dirac?</a></u></b></p>
+
+ You can download the latest version from the <a href="http://www.sourceforge.net/projects/dirac">
+ Sourceforge project page</a>. You can also look at the developing code on the CVS there.
+
+ <p><u><b><a name="6"> What are the license conditions?</a></b></u></p>
+
+ Dirac is released under the Mozilla triple license (MPL). This is an Open Source license that allows both free and
+ commercial use of the software. It also allows for relicensing under the GPL or the LGPL.
+
+ <p><u><b><a name="6A"> Are you going to charge for Dirac?</a></b></u></p>
+
+ No. The terms of the MPL mean that as far as the BBC is concerned, there will be no charges or royalties
+ for the Dirac software.
+
+ <p><u><b><a name="6B"> Do the BBC have patents in Dirac?</a></b></u></p>
+
+ Yes. We have patent applications in train for some of the techniques involved in Dirac, and others that
+ we intend to put into Dirac in the future. There has been some FUD about this, so we'll be clear:
+ this does not affect the Open Source status of Dirac, nor does it affect its royalty-free status.
+ The conditions of the MPL mean that we're licensing these patents for use within the Dirac
+ software for free.
+
+ <p><u><b><a name="7"> Do you infringe any patents?</a></b></u></p>
+
+ The short answer is that we don't know for certain. We haven't employed armies of lawyers to trawl through the tens of
+ thousands of video compression techniques. That's not the way to invent a successful algorithm. Instead we've
+ tried to use techniques of long standing in novel ways. Where we think we're novel, <a href="#6B">we're in the process
+ of getting patent protection ourselves</a>, which will invalidate others' claims of priority.
+
+ There are some areas that are more heavily patented than others. Arithmetic coding is one such, even though
+ the technique itself has been around for 25 years. We're keeping an eye on the situation, and we'll adopt
+ alternative techniques if we have to.
+
+ <p><u><b><a name="8"> What will you do if you infringe any patents?</a></b></u></p>
+
+ Code round them, first and foremost. There are many alternative techniques to each of the technologies used
+ within Dirac. Dirac is relatively modular (which is one reason why it's a conventional hybrid codec rather
+ than, say, 3D wavelets) so removing or adding tools should be possible until it goes Beta and the
+ bitstream and decoder functionality are fixed. But we also need to see where in the world potentially problematic patents
+ apply, and how important they are.
+
+ <p><u><b><a name="9"> Is the BBC going to stream video using Dirac?</a></b></u></p>
+
+ The software is not quite ready for that yet - we need real-time decoding, integration with
+ players, a bitstream spec and a transport stream format. So this will probably have to wait until Dirac is
+ closer to beta, although it might be possible to set up something experimental sooner.
+
+ <p><u><b><a name="10"> Are you going to broadcast TV using Dirac?</a></b></u></p>
+
+ Broadcasting or multicasting over the web is likely to develop over the next few years, and the technology we use for
+ this is likely to be the same as for standard streaming. There is no likelihood at all of replacing our
+ existing Digital TV infrastructure, based on European DVB standards and using MPEG-2, with anything new - the
+ installed base of millions of customers is too large.
+
+ <p><u><b><a name="11"> What about Ogg Theora?</a></b></u></p>
+
+ We're glad that it looks like Theora will reach beta soon. We think you can't have too many free codecs, but that
+ the Open Source community also needs to continue to develop codecs with increasingly better performance.
+ We also think there could be a good deal in Theora that we could use in Dirac, and we'd like to work with
+ developers who've been closely involved in Theora.
+
+ We intend to pack the Dirac elementary stream into MXF, which has lots of useful features. That doesn't preclude
+ it packing into Ogg as well, and it's probably a good idea to have a variety of packing formats. For this the
+ elementary stream needs to be very well defined.
+
+ <p><u><b><a name="12"> How does it work?</a></b></u></p>
+
+ See the <a href="http://www.bbc.co.uk/rd/projects/dirac/documentation.shtml">algorithm documentation</a>
+
+ <p><u><b><a name="13"> Why did you choose the techniques that you're using?</b></u></a></p>
+
+ We chose wavelets for a number of reasons. They perform very well in still image compression, and can be said to be
+ state of the art there. They also provide a degree of scalability, so a codec based on wavelets can perform
+ well across a range of video standards. By scalability we don't mean embedded bitstreams or the ability to
+ extract lower-resolution video from higher-resolution bitstreams - Dirac doesn't do this as it's very
+ complex - only the flexibility to apply the same tools to a range of resolutions, perhaps with different
+ parameters. Wavelet coding is also a well-studied and well-understood field.
+
+ Overlapped block motion compensation is used to reduce blockiness and ease the job of the wavelet transform
+ in coding motion compensated differences. The wavelet transform may not be the best tool to do this, and
+ we'd welcome other contributions, but it does have the benefit of simplicity in that the tools for all
+ frame types are the same. Dirac supports more or less any block sizes for motion compensation and this
+ again helps in scaling the algorithms as larger blocks can be used for higher resolution pictures and smaller
+ ones for low resolution pictures.
+
+ <p><u><b><a name="14"> What's with your picture file format?</a></b></u></p>
+
+ It's a temporary fix. There is a dearth of good file formats for video sequences, most of them being multi-file
+ formats, with little or no metadata. We're going to release some tools for converting formats soon. The encoder and
+ decoder applications are just example programs: what really matters are the libraries, which just need classes
+ capable of reading and writing picture data. Ultimately we'll subclass these picture IO classes to cover every
+ file format we need to, and we'll also wrap uncompressed video in MXF as well, for which there are player utilities.
+
+ <p><u><b><a name="15"> How do I play compressed video?</a></b></u></p>
+
+ You can't yet play a compressed bitstream, but hopefully it won't take too long to get a DirectShow filter, for
+ example, sorted out. Bear in mind that any code written to play compressed video is liable to change until
+ the wrapping format and demuxing operations, at least, is determined.
+
+ <p><u><b><a name="16"> How do I code video?</a></b></u></p>
+
+ You need video in the right format, which is raw planar YUV with a separate header file. There's a program to make
+ the header. Then you need to start the encoder running. The latest version of the encoder does a rudimentary form
+ of constant quality encoding, where you set a quality level.
+
+ <p><u><b><a name="17"> How can I help?</a></b></u></p>
+
+ By telling people about Dirac. By contributing to the code: <a mailto="dirac@rd.bbc.co.uk">contact us</a> to find out
+ more.
+
+ <p><u><b><a name="18"> What needs doing?</a></b></u></p>
+
+ A very great deal. The Dirac algorithm is still evolving, and new tools (for interlaced video, for example) and
+ enhancements to the current tools are needed. The code needs optimisation for speed, in order to be able to
+ code and (especially) decode in real time. The bitstream formats (elementary stream and packing) need defining.
+ The decoder libraries need to be integrated with a variety of players. For a full(er) list, see the TODO list in the
+ distribution.
+
+ <p><u><b><a name="19"> When will Dirac be ready?</a></b></u></p>
+
+ At the moment, we have no idea, but we hope to get to beta by the middle of 2005, say.
+
+ </body>
+</html>
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac.vcproj b/src/filters/parser/diracsplitter/libdirac/libdirac.vcproj
new file mode 100644
index 000000000..833f53456
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac.vcproj
@@ -0,0 +1,337 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="libdirac"
+ ProjectGUID="{12BE3440-A1F3-4C48-A229-30CB619EA276}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="."
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../../lib/libdiracD.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="FALSE"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="."
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../../lib/libdiracR.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\libdirac_common\band_codec.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\bit_manager.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\block_match.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\cmd_line.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\common.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\comp_compress.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\comp_decompress.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\dirac_assertions.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\dirac_cppparser.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\dirac_encoder.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\dirac_parser.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\downconvert.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\frame.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\frame_buffer.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\frame_compress.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\frame_decompress.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\golomb.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_mode_decn.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_subpel.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_utils.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\mot_comp.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\motion.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\motion_estimate.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\mv_codec.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\pic_io.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\pixel_match.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\quality_monitor.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\seq_compress.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\seq_decompress.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\upconvert.cpp">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\wavelet_utils.cpp">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\libdirac_common\arith_codec.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\arrays.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\band_codec.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\bit_manager.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\block_match.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\cmd_line.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\common.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\common_types.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\comp_compress.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\comp_decompress.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\decoder_types.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\dirac_assertions.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\dirac_cppparser.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\dirac_encoder.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\dirac_parser.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\dirac_types.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\downconvert.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\frame.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\frame_buffer.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\frame_compress.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\frame_decompress.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\golomb.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_mode_decn.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_subpel.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_utils.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\mot_comp.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\motion.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\motion_estimate.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\mv_codec.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\pic_io.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\pixel_match.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\quality_monitor.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\seq_compress.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\seq_decompress.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\upconvert.h">
+ </File>
+ <File
+ RelativePath=".\libdirac_common\wavelet_utils.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ <File
+ RelativePath=".\ChangesForGuliverkli">
+ </File>
+ <File
+ RelativePath=".\ReadMe.txt">
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/Makefile.am b/src/filters/parser/diracsplitter/libdirac/libdirac_common/Makefile.am
new file mode 100644
index 000000000..6e7f01aed
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/Makefile.am
@@ -0,0 +1,36 @@
+# $Id: Makefile.am 280 2005-01-30 05:11:46Z gabest $
+#
+
+INCLUDES = -I$(top_srcdir) -I$(srcdir)
+
+h_sources = arith_codec.h arrays.h band_codec.h bit_manager.h \
+ common_types.h common.h frame.h golomb.h frame_buffer.h \
+ mot_comp.h motion.h mv_codec.h pic_io.h upconvert.h \
+ wavelet_utils.h cmd_line.h dirac_assertions.h dirac_types.h
+
+cpp_sources = band_codec.cpp bit_manager.cpp common.cpp \
+ frame.cpp golomb.cpp frame_buffer.cpp mot_comp.cpp motion.cpp \
+ mv_codec.cpp pic_io.cpp upconvert.cpp wavelet_utils.cpp \
+ cmd_line.cpp dirac_assertions.cpp
+
+
+if USE_MSVC
+noinst_LIBRARIES = libdirac_common.a
+libdirac_common_a_AR = link.exe -lib /out:libdirac_common.a $(libdirac_common_a_OBJECTS) ; echo
+libdirac_common_a_SOURCES = $(h_sources) $(cpp_sources)
+else
+libdirac_common_a_AR = ar crv
+noinst_LTLIBRARIES = libdirac_common.la
+libdirac_common_la_SOURCES = $(h_sources) $(cpp_sources)
+libdirac_common_la_CXXFLAGS = $(AM_CXXFLAGS)
+endif
+
+
+
+library_includedir=$(includedir)/$(GENERIC_LIBRARY_NAME)/libdirac_common
+library_include_HEADERS = common_types.h dirac_types.h
+
+if USE_MSVC
+CLEANFILES = *.pdb *.ilk
+endif
+
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/Makefile.in b/src/filters/parser/diracsplitter/libdirac/libdirac_common/Makefile.in
new file mode 100644
index 000000000..1e887f524
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/Makefile.in
@@ -0,0 +1,505 @@
+# Makefile.in generated by automake 1.8.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+SOURCES = $(libdirac_common_a_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = libdirac_common
+DIST_COMMON = $(library_include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(mkdir_p)
+CONFIG_CLEAN_FILES =
+AR = ar
+ARFLAGS = cru
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+libdirac_common_a_LIBADD =
+am__objects_1 =
+am__objects_2 = band_codec.$(OBJEXT) bit_manager.$(OBJEXT) \
+ common.$(OBJEXT) frame.$(OBJEXT) golomb.$(OBJEXT) \
+ frame_buffer.$(OBJEXT) mot_comp.$(OBJEXT) motion.$(OBJEXT) \
+ mv_codec.$(OBJEXT) pic_io.$(OBJEXT) upconvert.$(OBJEXT) \
+ wavelet_utils.$(OBJEXT) cmd_line.$(OBJEXT) \
+ dirac_assertions.$(OBJEXT)
+am_libdirac_common_a_OBJECTS = $(am__objects_1) $(am__objects_2)
+libdirac_common_a_OBJECTS = $(am_libdirac_common_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/band_codec.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/bit_manager.Po ./$(DEPDIR)/cmd_line.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/common.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/dirac_assertions.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/frame.Po ./$(DEPDIR)/frame_buffer.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/golomb.Po ./$(DEPDIR)/mot_comp.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/motion.Po ./$(DEPDIR)/mv_codec.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/pic_io.Po ./$(DEPDIR)/upconvert.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/wavelet_utils.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libdirac_common_a_SOURCES)
+DIST_SOURCES = $(libdirac_common_a_SOURCES)
+library_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(library_include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GENERIC_LIBRARY_NAME = @GENERIC_LIBRARY_NAME@
+GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@
+GENERIC_RELEASE = @GENERIC_RELEASE@
+GENERIC_VERSION = @GENERIC_VERSION@
+HAVE_ALGO_FALSE = @HAVE_ALGO_FALSE@
+HAVE_ALGO_TRUE = @HAVE_ALGO_TRUE@
+HAVE_CPPUNIT_FALSE = @HAVE_CPPUNIT_FALSE@
+HAVE_CPPUNIT_TRUE = @HAVE_CPPUNIT_TRUE@
+HAVE_DOT = @HAVE_DOT@
+HAVE_DOT_FALSE = @HAVE_DOT_FALSE@
+HAVE_DOT_TRUE = @HAVE_DOT_TRUE@
+HAVE_DOXYGEN = @HAVE_DOXYGEN@
+HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
+HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
+HAVE_DVIPDFM = @HAVE_DVIPDFM@
+HAVE_DVIPDFM_FALSE = @HAVE_DVIPDFM_FALSE@
+HAVE_DVIPDFM_TRUE = @HAVE_DVIPDFM_TRUE@
+HAVE_LATEX = @HAVE_LATEX@
+HAVE_LATEX_FALSE = @HAVE_LATEX_FALSE@
+HAVE_LATEX_TRUE = @HAVE_LATEX_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OVERLAY_FALSE = @OVERLAY_FALSE@
+OVERLAY_TRUE = @OVERLAY_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_MSVC_FALSE = @USE_MSVC_FALSE@
+USE_MSVC_TRUE = @USE_MSVC_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I$(top_srcdir) -I$(srcdir)
+h_sources = arith_codec.h arrays.h band_codec.h bit_manager.h \
+ common_types.h common.h frame.h golomb.h frame_buffer.h \
+ mot_comp.h motion.h mv_codec.h pic_io.h upconvert.h \
+ wavelet_utils.h cmd_line.h dirac_assertions.h
+
+cpp_sources = band_codec.cpp bit_manager.cpp common.cpp \
+ frame.cpp golomb.cpp frame_buffer.cpp mot_comp.cpp motion.cpp \
+ mv_codec.cpp pic_io.cpp upconvert.cpp wavelet_utils.cpp \
+ cmd_line.cpp dirac_assertions.cpp
+
+lib_LIBRARIES = libdirac_common.a
+libdirac_common_a_SOURCES = $(h_sources) $(cpp_sources)
+library_includedir = $(includedir)/$(GENERIC_LIBRARY_NAME)/libdirac_common
+library_include_HEADERS = $(h_sources)
+@USE_MSVC_TRUE@CLEANFILES = *.pdb *.ilk
+@USE_MSVC_FALSE@libdirac_common_a_AR = ar crv
+@USE_MSVC_TRUE@libdirac_common_a_AR = link.exe -lib /out:libdirac_common.a $(libdirac_common_a_OBJECTS) ; echo
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libdirac_common/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign libdirac_common/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libdirac_common.a: $(libdirac_common_a_OBJECTS) $(libdirac_common_a_DEPENDENCIES)
+ -rm -f libdirac_common.a
+ $(libdirac_common_a_AR) libdirac_common.a $(libdirac_common_a_OBJECTS) $(libdirac_common_a_LIBADD)
+ $(RANLIB) libdirac_common.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/band_codec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bit_manager.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmd_line.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirac_assertions.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame_buffer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/golomb.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mot_comp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motion.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mv_codec.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pic_io.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upconvert.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wavelet_utils.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-library_includeHEADERS: $(library_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(library_includedir)" || $(mkdir_p) "$(DESTDIR)$(library_includedir)"
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(library_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(library_includedir)/$$f'"; \
+ $(library_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+uninstall-library_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(library_includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-library_includeHEADERS
+
+install-exec-am: install-libLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLIBRARIES \
+ uninstall-library_includeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLIBRARIES \
+ install-library_includeHEADERS install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am uninstall-libLIBRARIES \
+ uninstall-library_includeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/arith_codec.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/arith_codec.h
new file mode 100644
index 000000000..d2ee92297
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/arith_codec.h
@@ -0,0 +1,643 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: arith_codec.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development m_code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Richard Felton (Original Author),
+ Thomas Davies,
+ Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#ifndef _ARITH_CODEC_H_
+#define _ARITH_CODEC_H_
+
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+//// ////
+////-----------Abstract binary arithmetic coding class---------------////
+////subclass this for coding motion vectors, subband residues etc ...////
+//// ////
+/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
+
+#include <libdirac_common/common.h>
+#include <libdirac_common/bit_manager.h>
+#include <vector>
+
+#ifdef _MSC_VER // define types for MSVC compiler on Windows
+ typedef unsigned short uint16_t;
+ typedef unsigned _int32 uint32_t;
+#else // include header file for types for Linux
+ #include <inttypes.h>
+#endif
+
+namespace dirac
+{
+ //! Abstract binary arithmetic coding class
+ /*!
+ This is an abtract binary arithmetic encoding class, used as the base
+ for concrete classes that encode motion vectors and subband residues.
+ \param T a container (most probably, or array) type
+ */
+ template<class T> //T is container/array type
+ class ArithCodec
+ {
+ public:
+
+ //! Constructor for encoding
+ /*!
+ Creates an ArithCodec object to decode input based on a set of
+ parameters.
+ \param bits_out output for encoded bits
+ \param number_of_contexts the number of contexts used
+ */
+ ArithCodec(BasicOutputManager * bits_out, size_t number_of_contexts);
+
+ //! Constructor for decoding
+ /*!
+ Creates an ArithCodec object to decode input based on a set of
+ parameters.
+ \param bits_in source of bits to be decoded
+ \param number_of_contexts the number of contexts used
+ */
+ ArithCodec(BitInputManager * bits_in, size_t number_of_contexts);
+
+ //! Destructor
+ /*!
+ Destructor is virtual as this class is abstract.
+ */
+ virtual ~ArithCodec();
+
+ //! Compresses the input and returns the number of bits written.
+ /*!
+ Compress takes a type T object (a container or array) and
+ compresses it using the abstract
+ function DoWorkCode() which is overridden in subclasses.
+ It returns the number of bits written.
+ \param in_data the input to be compressed. Non-const,
+ since the compression may be lossy.
+ */
+ int Compress(T & in_data);
+
+ //! Decompresses the bitstream and writes into the output.
+ /*!
+ Decompresses the bitstream, up to the number of bits specified
+ and writes into the output
+
+ subclasses.
+ \param out_data the output into which the decompressed data
+ is written.
+ \param num_bits the number of bits to be read from the
+ bitstream. [May be eliminated in
+ future revisions. TJD 13 April 2004.]
+ */
+ void Decompress(T & out_data, int num_bits);
+
+ protected:
+
+ // use explicity type sizes for portability
+ typedef uint16_t code_t;
+ typedef uint32_t calc_t;
+
+ // NOTE: These macros imply an unsigned 16-bit operand
+ static const code_t CODE_MAX = 0xffff;
+ static const code_t CODE_MSB = ((0xffff + 1) >> 1);
+ static const code_t CODE_2ND_MSB = ((0xffff + 1) >> 2);
+
+ //! A class for encapsulating interval fractions for use in arithmetic coding.
+ /*!
+ A class for encapsulating a subinterval of the unit interval
+ [0,1) (0<=x<1) as a start value, a stop value (numerators)
+ and a weight value (the denominator). The interval is the to be
+ interpreted as [m_start/m_weight,m_stop/m_weight).
+ */
+ class Triple
+ {
+ public:
+ //! Constructor.
+ Triple()
+ : m_start(0),
+ m_stop(0),
+ m_weight(0) {}
+
+ // value constructor
+ Triple(code_t start, code_t stop, code_t weight)
+ {
+ m_start = start;
+ m_stop = stop;
+ m_weight = weight;
+ }
+
+ //! copy constructor
+ Triple(const Triple& rhs)
+ : m_start(rhs.m_start),
+ m_stop(rhs.m_stop),
+ m_weight(rhs.m_weight) { }
+
+ //! assignment
+ Triple & operator = (const Triple& rhs)
+ {
+ m_start = rhs.m_start;
+ m_stop = rhs.m_stop;
+ m_weight = rhs.m_weight;
+ return *this;
+ }
+
+ // get the start value
+ code_t Start() const { return m_start; }
+
+ // get the stop value
+ code_t Stop() const { return m_stop; }
+
+ // get the weight value
+ code_t Weight() const { return m_weight; }
+
+ private:
+ //! The m_start value.
+ code_t m_start;
+
+ //! The m_stop value.Should be >=m_start.
+ code_t m_stop;
+
+ //! The denominator for interpreting m_start, m_stop. Should be >= m_start,m_stop.
+ code_t m_weight;
+ };
+
+ //! A class for binary contexts.
+ /*!
+ A class for binary contexts. Stores probabilities for 0 and 1 in
+ terms of counts of numbers of occurrences, and also as Triples
+ partitioning the interval [0,1) into two parts [0,p) and [p,1).
+ */
+ class Context
+ {
+ public:
+ //! Default Constructor.
+ /*!
+ Default constructor initialises counts to 1 each of 0 and 1.
+ */
+ Context()
+ {
+ SetCounts(1,1);
+ }
+
+ //! Constructor.
+ /*!
+ Constructor initialises the counts to those set.
+ */
+ Context(int cnt0,int cnt1)
+ {
+ SetCounts(cnt0,cnt1);
+ }
+
+ //! Copy constructor
+ Context(const Context & cpy)
+ : count0(cpy.count0),
+ count1(cpy.count1),
+ trip0(cpy.trip0),
+ trip1(cpy.trip1)
+ {}
+
+ //! Assignment=
+ Context & operator=(const Context& rhs)
+ {
+ count0 = rhs.count0;
+ count1 = rhs.count1;
+ trip0 = rhs.trip0;
+ trip1 = rhs.trip1;
+ return *this;
+ }
+
+ //! Destructor
+ ~Context() {}
+
+ //! Sets the counts according to the input.
+ /*!
+ Sets the counts, and then the triples to reflect the counts.
+ */
+ void SetCounts(int cnt0, int cnt1)
+ {
+ count0 = cnt0;
+ count1 = cnt1;
+ SetTriples();
+ }
+
+ //! Returns the count of zeroes.
+ code_t GetCount0() const { return count0; }
+
+ //! Returns the count of ones.
+ code_t GetCount1() const { return count1; }
+
+ //! Increment the count.
+ /*!
+ Increment the count of Symbol by amnt.
+ \param symbol the symbol whose count is to be
+ incremented (false=0, true=1)
+ \param amnt the amount to increment by
+ */
+ void IncrCount(bool symbol, int amnt)
+ {
+ if ( symbol )
+ count1 += amnt;
+ else
+ count0 += amnt;
+
+ SetTriples();
+ }
+
+ //! Divide the counts by 2, making sure neither ends up 0.
+ void HalveCounts()
+ {
+ count0 >>= 1;
+ count0++;
+ count1 >>= 1;
+ count1++;
+
+ SetTriples();
+ }
+
+ //! Return the m_m_weight, equal to the count of 0 plus the count of 1.
+ code_t Weight() const { return trip0.Weight(); }
+
+ //! Return the triple associated with Symbol.
+ const Triple & GetTriple( const bool symbol ) const { return (symbol ? trip1 : trip0); }
+
+ //! Given a number, return the corresponding symbol and triple.
+ /*!
+ Given a number, which should be in the range [0,m_weight)
+ return the corresponding symbol. The range [0,m_weight) is
+ partitioned into portions [0,count0), [count0,m_weight)
+ corresponding to 0 and 1.
+ */
+ bool GetSymbol(const code_t num, Triple & trip_val) const
+ {
+ if (num < trip0.Stop())
+ {
+ trip_val = trip0;
+ return false; //ie zero
+ }
+ else
+ {
+ trip_val = trip1;
+ return true; //ie 1
+ }
+ }
+
+ private:
+ code_t count0;
+ code_t count1;
+
+ Triple trip0;
+ Triple trip1;
+
+ void SetTriples()
+ {
+ //updates triples given counts
+ trip0 = Triple(0, trip0.Start() + count0, count0 + count1);
+ trip1 = Triple(trip0.Stop(), trip1.Start() + count1, trip0.Weight());
+ }
+ };
+
+ protected:
+
+ //! Return the context counts, perhaps so as to improve initialisation the next time around
+ //std::vector<Context> & ContextList() { return m_context_list; }
+
+ //virtual codec functions (to be overridden)
+ ////////////////////////////////////////////
+
+ //! The method by which the contexts are initialised
+ virtual void InitContexts()=0;
+
+ //! The method by which the counts are updated.
+ virtual void Update( const bool symbol , const int context_num )=0;
+
+ //! The method by which the counts are resized
+ virtual void Resize(const int context_num)=0;
+
+ //! The method by which _all_ the counts are resized.
+ virtual void ResetAll()=0;
+
+ //! Choose the context based on previous data.
+ virtual int ChooseContext(const T &data, const int bin_number) const =0;
+
+ //! Choose the context based on previous data.
+ virtual int ChooseContext(const T &data) const=0;
+
+ //virtual encode-only functions
+ ///////////////////////////////
+
+ //! Does the work of actually coding the data
+ virtual void DoWorkCode(T & in_data) = 0;
+
+ //core encode-only functions
+ ////////////////////////////
+
+ //! Initialises the Encoder
+ void InitEncoder();
+
+ //! encodes a triple and writes to output
+ void EncodeTriple(const Triple & c);
+
+ //! encodes a symbol and writes to output
+ void EncodeSymbol(const bool symbol, const int context_num);
+
+ //! flushes the output of the encoder.
+ void FlushEncoder();
+
+ //! flushes the input of the encoder by reading all the remaining bits
+ void FlushDecoder();
+
+ //! virtual decode-only functions
+ virtual void DoWorkDecode(T & out_data, int num_bits)=0;
+
+ // core decode-only functions
+ ////////////////////////////
+
+ //! Initialise the Decoder
+ void InitDecoder();
+
+ //! Remove the symbol from the coded input stream
+ void RemFromStream(const Triple & c);
+
+ //! Rescales the interval midpoint according to the context
+ void SetCurrentCount(const int context_num);
+
+ //! Decodes a symbol given a context number
+ void DecodeSymbol(bool& symbol, int context_num);
+
+ private:
+ //! count of the total number of bits input or output
+ int m_bit_count;
+
+ //! max number of bits to be input
+ int m_max_count;
+
+ //! Number of underflow bits
+ int m_underflow;
+
+ //! The present input code
+ code_t m_code;
+
+ //! Scaled midpoint of the decoding interval
+ code_t m_count;
+
+ //! Start of the current code range
+ code_t m_low_code;
+
+ //! End of the current code range
+ code_t m_high_code;
+
+ // Parameters for controlling coding/decoding
+ // codec_params_type cparams;
+
+ //! Manages interface with file/stream
+ BitInputManager* m_bit_input;
+
+ //! Manages interface with file/stream. Can be header or data
+ BasicOutputManager* m_bit_output;
+
+ //private, bodyless copy constructor: class should not be copied
+ ArithCodec(const ArithCodec & cpy);
+
+ //private, bodyless copy operator=: class should not be assigned
+ ArithCodec & operator = (const ArithCodec & rhs);
+
+
+ protected:
+
+ //! List of contexts
+ std::vector<Context> m_context_list;
+ };
+
+ //Implementation - core functions
+ /////////////////////////////////
+
+ template<class T>
+ ArithCodec<T>::ArithCodec(BitInputManager* bits_in, size_t number_of_contexts)
+ : m_bit_count(0),
+ m_bit_input(bits_in),
+ m_context_list(number_of_contexts)
+ {
+ // nothing needed here
+ }
+
+ //! Constructor for encoding
+ template<class T>
+ ArithCodec<T>::ArithCodec(BasicOutputManager* bits_out, size_t number_of_contexts)
+ : m_bit_count(0),
+ m_bit_output(bits_out),
+ m_context_list(number_of_contexts)
+ {
+ // nothing needed here
+ }
+
+ template<class T>
+ ArithCodec<T>::~ArithCodec()
+ {
+ // nothing needed here
+ }
+
+ template<class T>
+ int ArithCodec<T>::Compress(T &in_data)
+ {
+ InitEncoder();
+ DoWorkCode(in_data);
+ FlushEncoder();
+ return m_bit_count;
+ }
+
+ template<class T>
+ void ArithCodec<T>::Decompress(T &out_data, int num_bits)
+ {
+ m_max_count=num_bits;
+ InitDecoder();
+ DoWorkDecode(out_data,num_bits);
+ FlushDecoder();
+ m_bit_input->FlushInput();
+ }
+
+ template<class T>
+ void ArithCodec<T>::InitEncoder()
+ {
+ // Set the m_code word stuff
+ m_low_code = 0;
+ m_high_code = CODE_MAX;
+ m_underflow = 0;
+ }
+
+ template<class T>
+ void ArithCodec<T>::EncodeTriple(const Triple &c)
+ {
+ // Rescale m_high_code and m_low_code for the new symbol
+ calc_t range( static_cast<calc_t>(m_high_code - m_low_code) + 1 );
+
+ //formulae given we know we're binary coding
+ if (!c.Start()) // c.Start()=0, so symbol is 0, so m_low_code unchanged
+ m_high_code = m_low_code + static_cast<code_t>(( range * c.Stop() ) / c.Weight() - 1 );
+ else //symbol is 1, so m_high_code unchanged
+ m_low_code += static_cast<code_t>(( range * c.Start() ) / c.Weight() );
+
+ do
+ {
+ if (( m_high_code & CODE_MSB ) == ( m_low_code & CODE_MSB ))
+ {
+ m_bit_output->OutputBit( m_high_code & CODE_MSB, m_bit_count);
+ while ( m_underflow > 0 )
+ {
+ m_bit_output->OutputBit(~m_high_code & CODE_MSB, m_bit_count);
+ m_underflow--;
+ }
+ }
+
+ else if ( ( m_low_code & CODE_2ND_MSB ) && !( m_high_code & CODE_2ND_MSB ))
+ {
+ m_underflow += 1;
+ m_low_code &= (CODE_2ND_MSB) - 1;
+ m_high_code |= CODE_2ND_MSB;
+ }
+ else return ;
+
+ m_low_code <<= 1;
+ m_high_code <<= 1;
+ m_high_code |= 1;
+ }
+ while(true);
+ }
+
+ template<class T>
+ inline void ArithCodec<T>::EncodeSymbol(const bool symbol, const int context_num)
+ {
+ EncodeTriple(m_context_list[context_num].GetTriple(symbol));
+ Update( symbol , context_num );
+ }
+
+ template<class T>
+ void ArithCodec<T>::FlushEncoder()
+ {
+ // Flushes the output
+ m_bit_output->OutputBit(m_low_code & CODE_2ND_MSB,m_bit_count);
+ m_underflow++;
+
+ while ( m_underflow-- > 0 )
+ m_bit_output->OutputBit(~m_low_code & CODE_2ND_MSB, m_bit_count);
+ }
+
+ template<class T>
+ void ArithCodec<T>::InitDecoder()
+ {
+ //Read in a full word of data
+ code_t i;
+ m_code = 0;
+
+ for ( i = 0; i < (8 * sizeof(code_t)); i++ )
+ {
+ m_code <<= 1;
+
+ if (m_bit_input->InputBit(m_bit_count,m_max_count))
+ m_code++;
+ }
+
+ m_low_code = 0;
+ m_high_code = CODE_MAX;
+ m_underflow = 0;
+ }
+
+ template<class T>
+ void ArithCodec<T>::RemFromStream( const Triple &c )
+ {
+
+ calc_t range( static_cast<calc_t>( m_high_code - m_low_code ) + 1 );
+
+ if(!c.Start())//c.Start()=0, so symbol is 0, so m_low_code unchanged
+ m_high_code = m_low_code + static_cast<code_t>(( range * c.Stop() ) / c.Weight() - 1 );
+
+ else//symbol is 1, so m_high_code unchanged
+ m_low_code += static_cast<code_t>(( range * c.Start() ) / c.Weight() );
+
+ do
+ {
+ if ( ( m_high_code & CODE_MSB ) == ( m_low_code & CODE_MSB ) )
+ {
+ // Do nothing
+ }
+ else if ((m_low_code & CODE_2ND_MSB) == CODE_2ND_MSB && (m_high_code & CODE_2ND_MSB) == 0 )
+ {
+ m_code ^= CODE_2ND_MSB;
+ m_low_code &= (CODE_2ND_MSB) - 1;
+ m_high_code |= CODE_2ND_MSB;
+ }
+ else return;
+
+ m_low_code <<= 1;
+ m_high_code <<= 1;
+ m_high_code |= 1;
+ m_code <<= 1;
+
+ if ( m_bit_input->InputBit( m_bit_count , m_max_count ) )
+ m_code++;
+
+ } while (1);
+
+ }
+
+ template<class T>
+ void ArithCodec<T>::SetCurrentCount(const int context_num)
+ {
+ calc_t range;
+ range = static_cast<calc_t>( m_high_code - m_low_code ) + 1;
+ m_count = static_cast<code_t>(
+ ( ( static_cast<calc_t>( m_code - m_low_code ) + 1 ) * m_context_list[context_num].Weight() - 1 )
+ / range );
+ }
+
+ template<class T>
+ void ArithCodec<T>::DecodeSymbol(bool& symbol, const int context_num)
+ {
+ Triple limits;
+ SetCurrentCount( context_num );
+ symbol = m_context_list[context_num].GetSymbol( m_count , limits );
+ RemFromStream( limits );
+ Update( symbol , context_num );
+ }
+
+ template<class T>
+ void ArithCodec<T>::FlushDecoder()
+ {
+ // Flushes the input
+ while(m_bit_count < m_max_count)
+ m_bit_input->InputBit( m_bit_count , m_max_count );
+ }
+
+} //namespace dirac
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/arrays.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/arrays.h
new file mode 100644
index 000000000..c03170a2a
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/arrays.h
@@ -0,0 +1,546 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: arrays.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Peter Meerwald (pmeerw@users.sourceforge.net)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _ARRAYS_H_
+#define _ARRAYS_H_
+
+//basic array types used for pictures etc
+
+#include <memory>
+#include <cstddef>
+#include <stdexcept>
+#include <iostream>
+#include <algorithm>
+
+namespace dirac
+{
+ typedef short ValueType;
+ typedef int CalcValueType;
+
+ //! Range type.
+ /*!
+ Range type encapsulating a closed range of values [first,last].
+ Used to initialies OneDArrays.
+ */
+ class Range
+ {
+ public:
+ //! Constructor
+ /*!
+ Constructor taking a start and an end point for the range.
+ */
+ Range(int s, int e): m_fst(s), m_lst(e){}
+
+ //! Returns the start of the range.
+ const int First() const {return m_fst;}
+
+ //! Returns the end point of the range.
+ const int Last() const {return m_lst;}
+
+ private:
+ int m_fst ,m_lst;
+ };
+
+ //////////////////////////////
+ //One-Dimensional Array type//
+ //////////////////////////////
+
+ //! A template class for one-dimensional arrays.
+ /*!
+ A template class for one-D arrays. Can be used wherever built-in
+ arrays are used, and eliminates the need for explicit memory
+ (de-)allocation. Also supports arrays not based at zero.
+ */
+ template <class T> class OneDArray
+ {
+ public:
+ //! Default constructor.
+ /*!
+ Default constructor produces an empty array.
+ */
+ OneDArray();
+
+ //! 'Length' constructor.
+ /*!
+ Length constructor produces a zero-based array.
+ */
+ OneDArray(const int len);
+
+ //! Range constructor
+ /*!
+ Range constructor produces an array with values indexed within the
+ range parameters.
+ \param r a range of indexing values.
+ */
+ OneDArray(const Range& r);
+
+ //! Destructor.
+ /*!
+ Destructor frees the data allocated in the constructors.
+ */
+ ~OneDArray()
+ {
+ FreePtr();
+ }
+
+ //! Copy constructor.
+ /*!
+ Copy constructor copies both data and metadata.
+ */
+ OneDArray(const OneDArray<T>& cpy);
+
+ //! Assignment=
+ /*!
+ Assignment= assigns both data and metadata.
+ */
+ OneDArray<T>& operator=(const OneDArray<T>& rhs);
+
+ //! Resize the array, throwing away the current data.
+ void Resize(int l);
+
+ //! Element access.
+ T& operator[](const int pos){return m_ptr[pos-m_first];}
+
+ //! Element access.
+ const T& operator[](const int pos) const {return m_ptr[pos-m_first];}
+
+ //! Returns the length of the array.
+ int Length() const {return m_length;}
+
+ //! Returns the index of the first element.
+ int First() const {return m_first;}
+
+ //! Returns the index of the last element.
+ int Last() const {return m_last;}
+
+ private:
+ void Init(const int len);
+
+ void Init(const Range& r);
+
+ void FreePtr();
+
+ int m_first, m_last;
+ int m_length;
+ T* m_ptr;
+ };
+
+ //public member functions//
+ ///////////////////////////
+
+ template <class T>
+ OneDArray<T>::OneDArray()
+ {
+ Init(0);
+ }
+
+ template <class T>
+ OneDArray<T>::OneDArray(const int len)
+ {
+ Init(len);
+ }
+
+ template <class T>
+ OneDArray<T>::OneDArray(const Range& r)
+ {
+ Init(r);
+ }
+
+ template <class T>
+ OneDArray<T>::OneDArray(const OneDArray<T>& cpy)
+ {
+ m_first = cpy.m_first;
+ m_last = cpy.m_last;
+ m_length = m_last - m_first + 1;
+
+ if (m_first==0)
+ Init(m_length);
+ else
+ Init(Range(m_first , m_last));
+
+ memcpy( m_ptr , cpy.m_ptr , m_length * sizeof( T ) );
+ }
+
+ template <class T>
+ OneDArray<T>& OneDArray<T>::operator=(const OneDArray<T>& rhs)
+ {
+ if (&rhs != this)
+ {
+ FreePtr();
+ m_first = rhs.m_first;
+ m_last = rhs.m_last;
+ m_length = rhs.m_length;
+
+ if (m_first == 0)
+ Init(m_length);
+ else
+ Init(Range(m_first , m_last));
+
+ memcpy( m_ptr , rhs.m_ptr , m_length * sizeof( T ) );
+
+ }
+ return *this;
+ }
+
+ template <class T>
+ void OneDArray<T>::Resize(int l)
+ {
+ FreePtr();
+ Init(l);
+ }
+
+ //private member functions//
+ ////////////////////////////
+
+ template <class T>
+ void OneDArray<T>::Init(const int len)
+ {
+ Range r(0 , len-1);
+
+ Init(r);
+
+ }
+
+ template <class T>
+ void OneDArray<T>::Init(const Range& r)
+ {
+
+ m_first = r.First();
+ m_last = r.Last();
+ m_length = m_last - m_first + 1;
+
+ if ( m_length>0 )
+ {
+ m_ptr = new T[ m_length ];
+ }
+ else
+ {
+ m_length = 0;
+ m_first = 0;
+ m_last = -1;
+ }
+ }
+
+ template <class T>
+ void OneDArray<T>::FreePtr()
+ {
+ if ( m_length>0 )
+ delete[] m_ptr;
+ }
+
+
+ //////////////////////////////
+ //Two-Dimensional Array type//
+ //////////////////////////////
+
+ //! A template class for two-dimensional arrays.
+ /*!
+ A template class to do two-d arrays, so that explicit memory
+ (de-)allocation is not required. Only zero-based arrays are
+ currently supported so that access is fast. The array is viewed as a
+ (vertical) array of (horizontal) arrays. Accessing elements along
+ a row is therefore much faster than accessing them along a column.
+ */
+ template <class T> class TwoDArray
+ {
+ typedef T* element_type;
+
+ public:
+
+ //! Default constructor.
+ /*!
+ Default constructor creates an empty array.
+ */
+ TwoDArray(){ Init(0,0); }
+
+ //! Constructor.
+ /*!
+ The constructor creates an array of given width height.
+ */
+ TwoDArray( const int height , const int width ){Init(height , width);}
+
+ //! Constructor.
+ /*!
+ The constructor creates an array of given width and length height
+ and initialises it to a value
+ */
+ TwoDArray( const int height , const int width , T val);
+
+ //! Destructor
+ /*!
+ Destructor frees the data allocated in the constructor.
+ */
+ virtual ~TwoDArray(){
+ FreeData();
+ }
+
+ //! Copy constructor.
+ /*!
+ Copy constructor copies data and metadata.
+ */
+ TwoDArray(const TwoDArray<T>& Cpy);
+
+ //! Assignment =
+ /*!
+ Assignement = assigns both data and metadata.
+ */
+ TwoDArray<T>& operator=(const TwoDArray<T>& rhs);
+
+ //! Resizes the array, deleting the current data.
+ void Resize(const int height, const int width);
+
+ //! Element access.
+ /*!
+ Accesses the rows of the arrays, which are returned in the form
+ of pointers to the row data NOT OneDArray objects.
+ */
+ inline element_type& operator[](const int pos){return m_array_of_rows[pos];}
+
+ //! Element access.
+ /*!
+ Accesses the rows of the arrays, which are returned in the form of
+ pointers to the row data NOT OneDArray objects.
+ */
+ inline const element_type& operator[](const int pos) const {return m_array_of_rows[pos];}
+
+ //! Returns the width
+ const int LengthX() const { return m_length_x; }
+
+ //! Returns the height
+ const int LengthY() const { return m_length_y; }
+
+ //! Returns the index of the first element of a row
+ const int FirstX() const { return m_first_x; }
+
+ //! Returns the index of the first element of a column
+ const int FirstY() const { return m_first_y; }
+
+ //! Returns the index of the last element of a row
+ const int LastX() const { return m_last_x; }
+
+ //! Returns the index of the first element of a column
+ const int LastY() const { return m_last_y; }
+
+ private:
+ //! Initialise the array
+ void Init(const int height,const int width);
+
+ //! Free all the allocated data
+ void FreeData();
+
+ int m_first_x;
+ int m_first_y;
+
+ int m_last_x;
+ int m_last_y;
+
+ int m_length_x;
+ int m_length_y;
+
+ element_type* m_array_of_rows;
+ };
+
+ //public member functions//
+ ///////////////////////////
+
+ template <class T>
+ TwoDArray<T>::TwoDArray( const int height , const int width , const T val)
+ {
+ Init( height , width );
+ for (int j=0 ; j<m_length_y ; ++j)
+ std::fill_n( m_array_of_rows[j] , m_length_x , val);
+ }
+
+ template <class T>
+ TwoDArray<T>::TwoDArray(const TwoDArray<T>& Cpy)
+ {
+ m_first_x = Cpy.m_first_x;
+ m_first_y = Cpy.m_first_y;
+ m_last_x = Cpy.m_last_x;
+ m_last_y = Cpy.m_last_y;
+
+ m_length_x = m_last_x - m_first_x + 1;
+ m_length_y = m_last_y - m_first_y + 1;
+
+ if (m_first_x == 0 && m_first_y == 0)
+ Init(m_length_y , m_length_x);
+ else{
+ //based 2D arrays not yet supported
+ }
+ for (int j=0 ; j<m_length_y ; ++j)
+ memcpy( m_array_of_rows[j] , (Cpy.m_array_of_rows)[j] , m_length_x * sizeof( T ) );
+
+ }
+
+ template <class T>
+ TwoDArray<T>& TwoDArray<T>::operator=(const TwoDArray<T>& rhs)
+ {
+ if (&rhs != this)
+ {
+ FreeData();
+
+ m_first_x = rhs.m_first_x;
+ m_first_y = rhs.m_first_y;
+
+ m_last_x = rhs.m_last_x;
+ m_last_y = rhs.m_last_y;
+
+ m_length_x = m_last_x - m_first_x + 1;
+ m_length_y = m_last_y - m_first_y + 1;
+
+ if (m_first_x == 0 && m_first_y == 0)
+ Init(m_length_y , m_length_x);
+ else
+ {
+ //based 2D arrays not yet supported
+ }
+
+ for ( int j=0 ; j<m_length_y; ++j)
+ memcpy( m_array_of_rows[j] , (rhs.m_array_of_rows)[j] , m_length_x * sizeof( T ) );
+
+ }
+
+ return *this;
+
+ }
+
+ template <class T>
+ void TwoDArray<T>::Resize(const int height, const int width)
+ {
+ FreeData();
+ Init(height , width);
+ }
+
+ //private member functions//
+ ////////////////////////////
+
+ template <class T>
+ void TwoDArray<T>::Init(const int height , const int width)
+ {
+ m_length_x = width;
+ m_length_y = height;
+ m_first_x = 0;
+ m_first_y = 0;
+
+ m_last_x = m_length_x-1;
+ m_last_y = m_length_y-1;
+
+ if (m_length_y>0)
+ {
+ // allocate the array containing ptrs to all the rows
+ m_array_of_rows = new element_type[ m_length_y ];
+
+ if ( m_length_x>0 )
+ {
+ // next, allocate all the rows
+ for (int j=0 ; j<m_length_y ; ++j)
+ {
+ m_array_of_rows[j] = new T[ m_length_x ];
+ }// j
+ }
+ else
+ {
+ m_length_x = 0;
+ m_first_x = 0;
+ m_last_x = -1;
+ }
+ }
+ else
+ {
+ m_length_x = 0;
+ m_length_y = 0;
+ m_first_x = 0;
+ m_first_y = 0;
+ m_last_x = -1;
+ m_last_y = -1;
+ }
+ }
+
+ template <class T>
+ void TwoDArray<T>::FreeData()
+ {
+ if (m_length_y>0)
+ {
+ if (m_length_x>0)
+ {
+ // deallocate each row
+ for (int j=0 ; j<m_length_y ; ++j)
+ {
+ delete[] m_array_of_rows[j];
+ }// j
+ }
+
+ // deallocate the array of rows
+ delete[] m_array_of_rows;
+ }
+ }
+
+ // Related functions
+
+ //! A function for extracting array data
+ template <class T >
+ std::ostream & operator<< (std::ostream & stream, TwoDArray<T> & array)
+ {
+ for (int j=0 ; j<array.LengthY() ; ++j)
+ {
+ for (int i=0 ; i<array.LengthX() ; ++i)
+ {
+ stream << array[j][i] << " ";
+ }// i
+ stream << std::endl;
+ }// j
+
+ return stream;
+ }
+
+ //! A function for inserting array data
+ template <class T >
+ std::istream & operator>> (std::istream & stream, TwoDArray<T> & array)
+ {
+ for (int j=0 ; j<array.LengthY() ; ++j)
+ {
+ for (int i=0 ; i<array.LengthX() ; ++i)
+ {
+ stream >> array[j][i];
+ }// i
+ }// j
+
+ return stream;
+ }
+
+} //namespace dirac
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/band_codec.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/band_codec.cpp
new file mode 100644
index 000000000..25cecb311
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/band_codec.cpp
@@ -0,0 +1,561 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: band_codec.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (c) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_common/band_codec.h>
+using namespace dirac;
+
+//! Constructor for encoding.
+BandCodec::BandCodec(BasicOutputManager* bits_out,
+ size_t number_of_contexts,
+ const SubbandList & band_list,
+ int band_num):
+ ArithCodec<PicArray>(bits_out,number_of_contexts),
+ m_bnum(band_num),
+ m_node(band_list(band_num)),
+ m_xp(m_node.Xp()),
+ m_yp(m_node.Yp()),
+ m_xl(m_node.Xl()),
+ m_yl(m_node.Yl()),
+ m_vol(m_node.Xl()*m_node.Yl()),
+ m_reset_coeff_num( std::max( 25 , std::min(m_vol/32,800) ) ),
+ m_cut_off_point(m_node.Scale()>>1)
+{
+ if (m_node.Parent()!=0)
+ m_pnode=band_list(m_node.Parent());
+}
+
+//! Constructor for decoding.
+BandCodec::BandCodec(BitInputManager* bits_in,
+ size_t number_of_contexts,
+ const SubbandList& band_list,
+ int band_num):
+ ArithCodec<PicArray>(bits_in,number_of_contexts),
+ m_bnum(band_num),
+ m_node(band_list(band_num)),
+ m_xp(m_node.Xp()),
+ m_yp(m_node.Yp()),
+ m_xl(m_node.Xl()),
+ m_yl(m_node.Yl()),
+ m_vol(m_node.Xl()*m_node.Yl()),
+ m_reset_coeff_num( std::max( 25 , std::min(m_vol/32,800) ) ),
+ m_cut_off_point(m_node.Scale()>>1)
+{
+ if (m_node.Parent()!=0) m_pnode=band_list(m_node.Parent());
+}
+
+void BandCodec::InitContexts()
+{
+ //initialises the contexts.
+ //If _list does not already have values, then they're set to default values.
+ //This way, the constructor can override default initialisation.
+ Context tmp_ctx;
+
+ for (size_t i=0; i<m_context_list.size(); ++i)
+ {
+ if (i>=m_context_list.size())
+ m_context_list.push_back(tmp_ctx);
+ else
+ {
+ if (m_context_list[i].Weight()==0)
+ m_context_list[i].SetCounts(1,1);
+ }
+ }
+}
+
+void BandCodec::ResetAll()
+{
+ for (unsigned int c = 0; c < m_context_list.size(); ++c)
+ if (m_context_list[c].Weight()>16)
+ m_context_list[c].HalveCounts();
+}
+
+void BandCodec::Resize(const int context_num)
+{
+ m_context_list[context_num].HalveCounts();
+}
+
+void BandCodec::Update( const bool symbol , const int context_num )
+{
+ m_context_list[context_num].IncrCount(symbol,1);
+
+ if ( m_context_list[context_num].Weight() >= 1024 )
+ Resize( context_num );
+}
+
+int BandCodec::ChooseContext(const PicArray& data) const{ return NZ_BIN5plus_CTX; }
+
+//encoding function
+void BandCodec::DoWorkCode(PicArray& in_data)
+{
+
+ //main coding function, using binarisation
+ if (m_node.Parent()!=0)
+ {
+ m_pxp=m_pnode.Xp(); m_pyp=m_pnode.Yp();
+ m_pxl=m_pnode.Xl(); m_pyl=m_pnode.Yl();
+ }
+ else
+ {
+ m_pxp=0; m_pyp=0;
+ m_pxl=0; m_pyl=0;
+ }
+
+ ValueType val;
+ m_qf=m_node.Qf(0);
+ m_qfinv=(1<<17)/m_qf;
+ m_offset=(3*m_qf+4)>>3;
+ m_cut_off_point*=m_qf;
+
+ m_coeff_count=0;
+
+ for (m_ypos=m_yp,m_pypos=m_pyp;m_ypos<m_yp+m_yl;++m_ypos,m_pypos=((m_ypos-m_yp)>>1)+m_pyp)
+ {
+ for (m_xpos=m_xp,m_pxpos=m_pxp;m_xpos<m_xp+m_xl;++m_xpos,m_pxpos=((m_xpos-m_xp)>>1)+m_pxp)
+ {
+ if (m_xpos==m_xp)
+ m_nhood_sum = (m_ypos!=m_yp) ? std::abs(in_data[m_ypos-1][m_xpos]) : 0;
+ else
+ m_nhood_sum = (m_ypos!=m_yp) ?
+ (std::abs(in_data[m_ypos-1][m_xpos]) + std::abs(in_data[m_ypos][m_xpos-1]))
+ : std::abs(in_data[m_ypos][m_xpos-1]);
+
+ m_parent_notzero = static_cast<bool> ( in_data[m_pypos][m_pxpos] );
+ val = in_data[m_ypos][m_xpos];
+ in_data[m_ypos][m_xpos]=0;
+ CodeVal( in_data , val );
+
+ }//m_xpos
+ }//m_ypos
+
+#if defined(VERBOSE_DEBUG)
+ // Show the symbol counts
+ cerr<<endl<<"Context counts";
+
+ for (int c = 0; c < 16; ++c)
+ cerr << endl
+ << c
+ << ": Zero-"
+ << ContextList()[c].get_count0()
+ << ", One-"
+ << ContextList()[c].get_count1();
+#endif
+}
+
+void BandCodec::CodeVal( PicArray& in_data , const ValueType val )
+{
+ int abs_val( std::abs(val) );
+ abs_val *= m_qfinv;
+ abs_val >>= 17;
+
+ for ( int bin=1 ; bin<=abs_val ; ++bin )
+ EncodeSymbol( 0 , ChooseContext( in_data , bin ) );
+
+ EncodeSymbol( 1 , ChooseContext( in_data , abs_val+1 ) );
+
+ if ( abs_val )
+ {
+ abs_val *= m_qf;
+ in_data[m_ypos][m_xpos] = static_cast<ValueType>( abs_val );
+
+ if ( val>0 )
+ {
+ EncodeSymbol( 1 , ChooseSignContext( in_data ) );
+ in_data[m_ypos][m_xpos] += m_offset;
+ }
+ else
+ {
+ EncodeSymbol( 0 , ChooseSignContext(in_data) );
+ in_data[m_ypos][m_xpos] = -in_data[m_ypos][m_xpos];
+ in_data[m_ypos][m_xpos] -= m_offset;
+ }
+ }
+
+ m_coeff_count++;
+
+ if (m_coeff_count > m_reset_coeff_num)
+ {
+ m_coeff_count=0;
+ ResetAll();
+ }
+}
+
+void BandCodec::DoWorkDecode(PicArray& out_data, int num_bits)
+{
+
+ if (m_node.Parent()!=0)
+ {
+ m_pxp = m_pnode.Xp();
+ m_pyp = m_pnode.Yp();
+ m_pxl = m_pnode.Xl();
+ m_pyl = m_pnode.Yl();
+ }
+ else
+ {
+ m_pxp = 0;
+ m_pyp = 0;
+ m_pxl = 0;
+ m_pyl = 0;
+ }
+
+ m_qf = m_node.Qf(0);
+ m_offset = (3 * m_qf + 4) >> 3;
+ m_cut_off_point *= m_qf;
+
+ //Work
+ m_coeff_count=0;
+
+ for (m_ypos=m_yp,m_pypos=m_pyp;m_ypos<m_yp+m_yl;++m_ypos,m_pypos=((m_ypos-m_yp)>>1)+m_pyp)
+ {
+ for (m_xpos = m_xp, m_pxpos = m_pxp; m_xpos < m_xp+m_xl; ++m_xpos, m_pxpos=((m_xpos-m_xp)>>1)+m_pxp)
+ {
+ if (m_xpos == m_xp)
+ m_nhood_sum=(m_ypos!=m_yp) ? std::abs(out_data[m_ypos-1][m_xpos]): 0;
+ else
+ m_nhood_sum=(m_ypos!=m_yp) ?
+ (std::abs(out_data[m_ypos-1][m_xpos]) + std::abs(out_data[m_ypos][m_xpos-1]))
+ : std::abs(out_data[m_ypos][m_xpos-1]);
+
+ m_parent_notzero = static_cast<bool>( out_data[m_pypos][m_pxpos] );
+ DecodeVal(out_data);
+ }//m_xpos
+ }//m_ypos
+}
+
+void BandCodec::DecodeVal(PicArray& out_data)
+{
+ ValueType val = 0;
+ bool bit;
+ int bin = 1;
+
+ do
+ {
+ DecodeSymbol(bit,ChooseContext(out_data,bin));
+
+ if (!bit)
+ val++;
+
+ bin++;
+ }
+ while (!bit);
+
+ out_data[m_ypos][m_xpos] = val;
+
+ if (out_data[m_ypos][m_xpos])
+ {
+ out_data[m_ypos][m_xpos] *= m_qf;
+ out_data[m_ypos][m_xpos] += m_offset;
+ DecodeSymbol( bit , ChooseSignContext(out_data) );
+ }
+
+ if (!bit)
+ out_data[m_ypos][m_xpos]=-out_data[m_ypos][m_xpos];
+
+ m_coeff_count++;
+
+ if (m_coeff_count>m_reset_coeff_num)
+ {
+ ResetAll();
+ m_coeff_count=0;
+ }
+}
+
+int BandCodec::ChooseContext(const PicArray& data, const int BinNumber) const
+{
+ //condition on neighbouring values and parent values
+ if (!m_parent_notzero && (m_pxp != 0 || m_pyp != 0))
+ {
+ if (BinNumber == 1)
+ {
+ if(m_nhood_sum == 0)
+ return Z_BIN1z_CTX;
+ else
+ return Z_BIN1nz_CTX;
+ }
+ else if(BinNumber == 2)
+ return Z_BIN2_CTX;
+ else if(BinNumber == 3)
+ return Z_BIN3_CTX;
+ else if(BinNumber == 4)
+ return Z_BIN4_CTX;
+ else
+ return Z_BIN5plus_CTX;
+ }
+ else
+ {
+ if (BinNumber == 1)
+ {
+ if(m_nhood_sum == 0)
+ return NZ_BIN1z_CTX;
+ else if (m_nhood_sum>m_cut_off_point)
+ return NZ_BIN1b_CTX;
+ else
+ return NZ_BIN1a_CTX;
+ }
+ else if(BinNumber == 2)
+ return NZ_BIN2_CTX;
+ else if(BinNumber == 3)
+ return NZ_BIN3_CTX;
+ else if(BinNumber == 4)
+ return NZ_BIN4_CTX;
+ else
+ return NZ_BIN5plus_CTX;
+ }
+}
+
+int BandCodec::ChooseSignContext(const PicArray& data) const
+{
+ if (m_yp == 0 && m_xp != 0)
+ {
+ //we're in a vertically oriented subband
+ if (m_ypos == 0)
+ return SIGN0_CTX;
+ else
+ {
+ if (data[m_ypos-1][m_xpos]>0)
+ return SIGN_POS_CTX;
+ else if (data[m_ypos-1][m_xpos]<0)
+ return SIGN_NEG_CTX;
+ else
+ return SIGN0_CTX;
+ }
+ }
+ else if (m_xp == 0 && m_yp != 0)
+ {
+ //we're in a horizontally oriented subband
+ if (m_xpos == 0)
+ return SIGN0_CTX;
+ else
+ {
+ if ( data[m_ypos][m_xpos-1] > 0 )
+ return SIGN_POS_CTX;
+ else if ( data[m_ypos][m_xpos-1] < 0 )
+ return SIGN_NEG_CTX;
+ else
+ return SIGN0_CTX;
+ }
+ }
+ else
+ return SIGN0_CTX;
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//Now for special class for LF bands (since we don't want/can't refer to parent)//
+//////////////////////////////////////////////////////////////////////////////////
+
+void LFBandCodec::DoWorkCode(PicArray& in_data)
+{
+ //main coding function, using binarisation
+ m_pxp = 0;
+ m_pyp = 0;
+ m_parent_notzero = false; //set parent to always be zero
+ ValueType val;
+
+ m_qf = m_node.Qf(0);
+ m_qfinv = (1<<17)/m_qf;
+ m_offset = (3*m_qf+4)>>3;
+ m_cut_off_point*=m_qf;
+
+ m_coeff_count = 0;
+
+ for ( m_ypos=m_yp ; m_ypos<m_yp+m_yl ; ++m_ypos )
+ {
+ for ( m_xpos=m_xp ; m_xpos<m_xp+m_xl ; ++m_xpos )
+ {
+ if ( m_xpos == m_xp )
+ m_nhood_sum = (m_ypos!=m_yp) ? std::abs(in_data[m_ypos-1][m_xpos]) : 0;
+ else
+ m_nhood_sum = (m_ypos!=m_yp) ?
+ (std::abs(in_data[m_ypos-1][m_xpos]) + std::abs(in_data[m_ypos][m_xpos-1]))
+ : std::abs(in_data[m_ypos][m_xpos-1]);
+
+ val = in_data[m_ypos][m_xpos];
+ in_data[m_ypos][m_xpos] = 0;
+ CodeVal(in_data,val);
+ }//m_xpos
+ }//m_ypos
+}
+
+void LFBandCodec::DoWorkDecode(PicArray& out_data, int num_bits)
+{
+ m_pxp = 0;
+ m_pyp = 0;
+ m_parent_notzero = false;//set parent to always be zero
+ m_qf = m_node.Qf(0);
+ m_offset = (3*m_qf+4)>>3;
+ m_cut_off_point *= m_qf;
+
+ //Work
+ m_coeff_count = 0;
+
+ for ( m_ypos=m_yp ; m_ypos<m_yp+m_yl ; ++m_ypos )
+ {
+ for ( m_xpos=0 ; m_xpos<m_xp+m_xl; ++m_xpos )
+ {
+ if ( m_xpos == m_xp )
+ m_nhood_sum=(m_ypos!=m_yp) ? std::abs(out_data[m_ypos-1][m_xpos]) : 0;
+ else
+ m_nhood_sum=(m_ypos!=m_yp) ?
+ (std::abs(out_data[m_ypos-1][m_xpos]) + std::abs(out_data[m_ypos][m_xpos-1]))
+ : std::abs(out_data[m_ypos][m_xpos-1]);
+
+ DecodeVal(out_data);
+ }//m_xpos
+ }//m_ypos
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+//Finally,special class incorporating prediction for the DC band of intra frames//
+//////////////////////////////////////////////////////////////////////////////////
+
+void IntraDCBandCodec::DoWorkCode(PicArray& in_data)
+{
+ //main coding function, using binarisation
+ m_pxp = 0;
+ m_pyp = 0;
+
+ //set parent to always be zero
+ m_parent_notzero = false;
+ ValueType val;
+
+ //residues after prediction, quantisation and inverse quant
+ PicArray pred_res(m_yl , m_xl);
+ ValueType prediction;
+
+ m_qf = m_node.Qf(0);
+ m_qfinv = (1<<17) / m_qf;
+ m_offset = (3*m_qf+4) >> 3;
+ m_cut_off_point *= m_qf;
+
+ m_coeff_count=0;
+
+ for (m_ypos=m_yp; m_ypos < m_yp + m_yl; ++m_ypos)
+ {
+ for (m_xpos = m_xp; m_xpos < m_xp + m_xl; ++m_xpos)
+ {
+ if (m_xpos == m_xp)
+ m_nhood_sum = (m_ypos!=m_yp) ? std::abs(pred_res[m_ypos-1][m_xpos]) : 0;
+ else
+ m_nhood_sum = (m_ypos!=m_yp) ?
+ (std::abs(pred_res[m_ypos-1][m_xpos]) + std::abs(pred_res[m_ypos][m_xpos-1]))
+ : std::abs(pred_res[m_ypos][m_xpos-1]);
+
+ prediction = GetPrediction(in_data);
+ val = in_data[m_ypos][m_xpos]-prediction;
+ in_data[m_ypos][m_xpos] = 0;
+ CodeVal(in_data,val);
+ pred_res[m_ypos][m_xpos] = in_data[m_ypos][m_xpos];
+ in_data[m_ypos][m_xpos] += prediction;
+ }//m_xpos
+
+#if defined(VERBOSE_DEBUG)
+ cerr << endl
+ << "Val at "
+ << m_ypos
+ << " "
+ << m_xl-1
+ << " : "
+ << in_data[m_ypos][m_xl-1]
+ << endl
+ << "Contexts at "
+ << m_ypos
+ << " "
+ << m_xl-1
+ << " : ";
+
+ for (int c=0;c<18;++c)
+ cerr << endl
+ << c
+ << ": Zero "
+ << ContextList()[c].get_count0()
+ << ", One "
+ << ContextList()[c].get_count1();
+#endif
+
+ }//m_ypos
+}
+
+void IntraDCBandCodec::DoWorkDecode(PicArray& out_data, int num_bits)
+{
+ m_pxp = 0;
+ m_pyp = 0;
+ m_parent_notzero = false; //set parent to always be zero
+
+ //residues after prediction, quantisation and inverse quant
+ PicArray pred_res(m_yl , m_xl);
+
+ m_qf = m_node.Qf(0);
+ m_offset = (3*m_qf+4)>>3;
+ m_cut_off_point *= m_qf;
+
+ //Work
+ m_coeff_count=0;
+
+ for (m_ypos=m_yp;m_ypos<m_yp+m_yl;++m_ypos)
+ {
+ for (m_xpos=0;m_xpos<m_xp+m_xl;++m_xpos)
+ {
+ if (m_xpos==m_xp)
+ m_nhood_sum=(m_ypos!=m_yp) ? std::abs(pred_res[m_ypos - 1][m_xpos]) : 0;
+ else
+ m_nhood_sum=(m_ypos!=m_yp) ?
+ (std::abs(pred_res[m_ypos - 1][m_xpos]) + std::abs(pred_res[m_ypos][m_xpos - 1]))
+ : std::abs(pred_res[m_ypos][m_xpos-1]);
+
+ DecodeVal(out_data);
+ pred_res[m_ypos][m_xpos]=out_data[m_ypos][m_xpos];
+ out_data[m_ypos][m_xpos]+=GetPrediction(out_data);
+ }//m_xpos
+ }//m_ypos
+}
+
+ValueType IntraDCBandCodec::GetPrediction(const PicArray& data) const
+{
+ if (m_ypos!=0)
+ {
+ if (m_xpos!=0)
+ return (data[m_ypos][m_xpos - 1] + data[m_ypos - 1][m_xpos - 1] + data[m_ypos - 1][m_xpos]) / 3;
+ else
+ return data[m_ypos - 1][0];
+ }
+ else
+ {
+ if(m_xpos!=0)
+ return data[0][m_xpos - 1];
+ else
+ return 2692; // TODO: What does this mean? Literal constants like this are dangerous!
+ }
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/band_codec.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/band_codec.h
new file mode 100644
index 000000000..bed57a1f7
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/band_codec.h
@@ -0,0 +1,264 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: band_codec.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _BAND_CODEC_H_
+#define _BAND_CODEC_H_
+
+#include <libdirac_common/arith_codec.h>
+#include <libdirac_common/wavelet_utils.h>
+
+namespace dirac
+{
+ //Subclasses the arithmetic codec to produce a coding/decoding tool for subbands
+
+
+ //! A general class for coding and decoding wavelet subband data.
+ /*!
+ A general class for coding and decoding wavelet subband data, deriving
+ from the abstract ArithCodec class.
+ */
+ class BandCodec: public ArithCodec<PicArray >
+ {
+ public:
+
+ //! Constructor for encoding.
+ /*!
+ Creates a BandCodec object to encode subband data
+ \param bits_out the output for the encoded bits
+ \param number_of_contexts the contexts used in the encoding process
+ \param band_list the set of all the subbands
+ \param band_num the number of the subband being coded
+ */
+ BandCodec(BasicOutputManager* bits_out,
+ size_t number_of_contexts,
+ const SubbandList& band_list,
+ int band_num);
+
+ //! Constructor for decoding.
+ /*!
+ Creates a BandCodec object to decode subband data.
+ \param bits_in the input for the encoded bits
+ \param number_of_contexts the contexts used in the decoding process
+ \param band_list the set of all the subbands
+ \param band_num the number of the subband being decoded
+ */
+ BandCodec(BitInputManager* bits_in,
+ size_t number_of_contexts,
+ const SubbandList& band_list,
+ int band_num);
+
+ //! Initialise the contexts according to predefined counts.
+ void InitContexts();
+
+ protected:
+ // Code an individual value
+ void CodeVal(PicArray& in_data, const ValueType val);
+ // Decode an individual value
+ void DecodeVal(PicArray& out_data);
+
+ private:
+ // Functions
+ // Overridden from the base class
+ virtual void DoWorkCode(PicArray& in_data);
+ // Overridden from the base class
+ virtual void DoWorkDecode(PicArray& in_data, int num_bits);
+
+ void Update( const bool symbol , const int context_num );
+ void Resize(const int context_num);
+ void ResetAll();
+
+ int ChooseContext(const PicArray& data, const int bin_number) const;
+ int ChooseContext(const PicArray& data) const;
+ int ChooseSignContext(const PicArray& data) const;
+
+ // Private, bodyless copy constructor: class should not be copied
+ BandCodec(const BandCodec& cpy);
+ // Private, bodyless copy operator=: class should not be assigned
+ BandCodec& operator=(const BandCodec& rhs);
+
+ protected:
+ //! variables
+ int m_bnum;
+
+ //! the subband being coded
+ const Subband m_node;
+
+ //! dimensions of the subband
+ int m_xp, m_yp, m_xl, m_yl;
+
+ //! position within the subband
+ int m_xpos, m_ypos;
+
+ //! size of the subband
+ int m_vol;
+
+ //! the number of coefficients after which contexts are reset
+ int m_reset_coeff_num;
+
+ //! count of the coefficients since the last context reset
+ int m_coeff_count;
+
+ //! quantisation and inverse quantisation values
+ int m_qf, m_qfinv;
+
+ //! reconstruction point
+ ValueType m_offset;
+
+ //! sum of a neighbourhood of previously (de)coded values
+ ValueType m_nhood_sum;
+
+ //! the parent subband
+ Subband m_pnode;
+
+ //! coords of the parent subband
+ int m_pxp, m_pyp, m_pxl, m_pyl;
+
+ //! position of the parent coefficient
+ int m_pxpos, m_pypos;
+
+ //! True if the parent of a coeff is not zero
+ bool m_parent_notzero;
+
+ //! used in selecting a context
+ ValueType m_cut_off_point;
+ };
+
+ //! A class specially for coding the LF subbands
+ /*!
+ A class specially for coding the LF subbands, where we don't want
+ to/can't refer to the
+ parent subband.
+ */
+ class LFBandCodec: public BandCodec
+ {
+ public:
+ //! Constructor for encoding
+ /*!
+ Creates a LFBandCodec object to encode subband data.
+ \param bits_out the output for the encoded bits
+ \param number_of_contexts the contexts used in the encoding process
+ \param band_list the set of all the subbands
+ \param band_num the number of the subband being coded
+ */
+ LFBandCodec(BasicOutputManager* bits_out,
+ size_t number_of_contexts,
+ const SubbandList& band_list,
+ int band_num)
+ : BandCodec(bits_out,number_of_contexts,band_list,band_num){}
+
+ //! Constructor for decoding
+ /*!
+ Creates a LFBandCodec object to decode subband data.
+ \param bits_in the input for the encoded bits
+ \param number_of_contexts the contexts used in the decoding process
+ \param band_list the set of all the subbands
+ \param band_num the number of the subband being decoded
+ */
+ LFBandCodec(BitInputManager* bits_in,
+ size_t number_of_contexts,
+ const SubbandList& band_list,
+ int band_num)
+ : BandCodec(bits_in,number_of_contexts,band_list,band_num){}
+
+ private:
+ // Overridden from the base class
+ virtual void DoWorkCode(PicArray& InData);
+ // Overridden from the base class
+ virtual void DoWorkDecode(PicArray& OutData, int num_bits);
+ // Private, bodyless copy constructor: class should not be copied
+ LFBandCodec(const LFBandCodec& cpy);
+ // Private, bodyless copy operator=: class should not be assigned
+ LFBandCodec& operator=(const LFBandCodec& rhs);
+
+ };
+
+
+ //////////////////////////////////////////////////////////////////////////////////
+ //Finally,special class incorporating prediction for the DC band of intra frames//
+ //////////////////////////////////////////////////////////////////////////////////
+
+ //! A class specially for coding the DC subband of Intra frames
+ /*!
+ A class specially for coding the DC subband of Intra frames, using
+ intra-band prediction of coefficients.
+ */
+ class IntraDCBandCodec: public BandCodec
+ {
+ public:
+ //! Constructor for encoding
+ /*!
+ Creates a IntraDCBandCodec object to encode subband data, based on
+ parameters
+ \param bits_out the output for the encoded bits
+ \param number_of_contexts the contexts used in the encoding process
+ \param band_list the set of all the subbands
+ */
+ IntraDCBandCodec(BasicOutputManager* bits_out,
+ size_t number_of_contexts,
+ const SubbandList& band_list)
+ : BandCodec(bits_out,number_of_contexts,band_list,band_list.Length()){}
+
+ //! Constructor for decoding
+ /*!
+ Creates a LFBandCodec object to decode subband data, based on
+ parameters
+ \param bits_in the input for the encoded bits
+ \param number_of_contexts the contexts used in the decoding process
+ \param band_list the set of all the subbands
+ */
+ IntraDCBandCodec(BitInputManager* bits_in,
+ size_t number_of_contexts,
+ const SubbandList& band_list)
+ : BandCodec(bits_in,number_of_contexts,band_list,band_list.Length()){}
+
+ private:
+ // Overridden from the base class
+ virtual void DoWorkCode(PicArray& InData);
+ // Overridden from the base class
+ virtual void DoWorkDecode(PicArray& OutData, int num_bits);
+
+ // Private, bodyless copy constructor: class should not be copied
+ IntraDCBandCodec(const IntraDCBandCodec& cpy);
+ // Private, bodyless copy operator=: class should not be assigned
+ IntraDCBandCodec& operator=(const IntraDCBandCodec& rhs);
+
+ // Prediction of a DC value from its previously coded neighbours
+ ValueType GetPrediction(const PicArray& Data) const;
+ };
+
+} // namespace dirac
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/bit_manager.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/bit_manager.cpp
new file mode 100644
index 000000000..4e5b83f54
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/bit_manager.cpp
@@ -0,0 +1,422 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: bit_manager.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (original author),
+* Robert Scott Ladd,
+* Tim Borer
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_common/bit_manager.h>
+#include <libdirac_common/common.h>
+using namespace dirac;
+
+using std::vector;
+
+////////////////
+//Output stuff//
+////////////////
+
+//Constructor
+BasicOutputManager::BasicOutputManager(std::ostream* out_data ):
+ m_num_out_bytes(0),
+ m_op_ptr(out_data)
+{
+ InitOutputStream();
+}
+
+void BasicOutputManager::InitOutputStream()
+{
+ // Set byte pointer to start of buffer
+ m_current_byte = 0;
+ // Set output mask to MSB of byte
+ m_output_mask = 0x80;
+ // Reset the output buffer
+ m_buffer.clear();
+}
+
+void BasicOutputManager::OutputSkipInterpretStartPrefixByte()
+{
+ size_t buf_size = m_buffer.size();
+ if (buf_size >=4 &&
+ m_buffer[buf_size-1] == (char)START_CODE_PREFIX_BYTE3 &&
+ m_buffer[buf_size-2] == (char)START_CODE_PREFIX_BYTE2 &&
+ m_buffer[buf_size-3] == (char)START_CODE_PREFIX_BYTE1 &&
+ m_buffer[buf_size-4] == (char)START_CODE_PREFIX_BYTE0)
+ {
+ m_buffer.push_back((char)NOT_START_CODE);
+ std::cerr << "Wrote ignore code " << std::endl;
+ }
+}
+
+void BasicOutputManager::OutputBit(const bool& bit )
+{
+ m_current_byte |= (bit ? (m_output_mask):0);
+
+ // Shift mask to next bit in the output byte
+ m_output_mask >>= 1;
+
+ if ( m_output_mask == 0 )
+ {
+ // If a whole byte has been written, write out
+ m_output_mask = 0x80;
+ m_buffer.push_back(m_current_byte);
+ OutputSkipInterpretStartPrefixByte();
+ m_current_byte = 0;
+ }
+}
+
+void BasicOutputManager::OutputBit(const bool& bit, int& count)
+{
+ OutputBit(bit);
+ count++;
+}
+
+void BasicOutputManager::OutputByte(const char& byte)
+{
+ FlushOutput();
+ m_buffer.push_back( byte );
+ OutputSkipInterpretStartPrefixByte();
+}
+
+void BasicOutputManager::OutputBytes( char* str_array )
+{
+ FlushOutput();
+ while ( *str_array != 0 )
+ {
+ m_buffer.push_back( *str_array );
+ str_array++;
+ }
+}
+
+void BasicOutputManager::OutputBytes(char* str_array,int num)
+{
+ FlushOutput();
+ for ( int i=0 ; i<num ; ++i )
+ m_buffer.push_back( str_array[i] );
+}
+
+
+void BasicOutputManager::WriteToFile()
+{
+ FlushOutput();
+ for ( vector<char>::iterator it=m_buffer.begin() ; it!=m_buffer.end() ; ++it )
+ {
+ m_op_ptr->write( &( *it ) , 1 );
+ }
+ m_num_out_bytes = m_buffer.size();
+ InitOutputStream();
+}
+
+void BasicOutputManager::FlushOutput()
+{
+ // Flush the current byte to output buffer and reset
+ if ( m_output_mask != 0x80 )
+ {
+ m_buffer.push_back( m_current_byte );
+ m_current_byte = 0;
+ m_output_mask = 0x80;
+ }
+}
+
+// Unit output - a subband or the MV data, for example //
+
+UnitOutputManager::UnitOutputManager(std::ostream* out_data ):
+ m_header(out_data),
+ m_data(out_data),
+ m_unit_bytes(0),
+ m_unit_data_bytes(0),
+ m_unit_head_bytes(0)
+ {}
+
+void UnitOutputManager::WriteToFile()
+{
+ m_header.WriteToFile();
+ m_data.WriteToFile();
+
+ // after writing to file, get the number of unit bytes written
+ m_unit_data_bytes = m_data.GetNumBytes();
+ m_unit_head_bytes = m_header.GetNumBytes();
+ m_unit_bytes = m_unit_data_bytes + m_unit_head_bytes;
+
+}
+
+FrameOutputManager::FrameOutputManager( std::ostream* out_data , int num_bands ) :
+ m_data_array( 3 , num_bands ),
+ m_comp_bytes( 3 ),
+ m_comp_hdr_bytes( 3 ),
+ m_out_stream( out_data )
+{
+ Init( num_bands );
+}
+
+FrameOutputManager::~FrameOutputManager()
+{
+ DeleteAll();
+}
+
+void FrameOutputManager::WriteToFile()
+{
+
+ // Write out the frame header
+ m_frame_header->WriteToFile();
+ m_total_bytes = m_frame_header->GetNumBytes();
+ m_header_bytes = m_frame_header->GetNumBytes();
+
+ // Write out the motion vector data
+ m_mv_data->WriteToFile();
+
+ // after writing to file, get the number of bytes written
+ m_mv_hdr_bytes = m_mv_data->GetUnitHeaderBytes();
+ m_mv_bytes = m_mv_data->GetUnitBytes();
+
+ m_total_bytes += m_mv_bytes;
+ m_header_bytes += m_mv_hdr_bytes;
+
+ // Write out the component data
+ for ( int c=0 ; c<3 ; ++c)
+ {
+
+ m_comp_hdr_bytes[c] = 0;
+ m_comp_bytes[c] = 0;
+
+ for ( int b=m_data_array.LastX() ; b>=0 ; --b)
+ {
+ m_data_array[c][b]->WriteToFile();
+ // after writing to file, get the number of bytes written
+ m_comp_hdr_bytes[c] += m_data_array[c][b]->GetUnitHeaderBytes();
+ m_comp_bytes[c] += m_data_array[c][b]->GetUnitBytes();
+ }// b
+
+ }// c
+
+ for ( int c=0 ; c<m_data_array.LengthY() ; ++c)
+ {
+ m_total_bytes += m_comp_bytes[c];
+ m_header_bytes += m_comp_hdr_bytes[c];
+ }
+}
+
+UnitOutputManager& FrameOutputManager::BandOutput( const int csort , const int band_num)
+{
+ return *( m_data_array[csort][band_num-1] );
+}
+
+const UnitOutputManager& FrameOutputManager::BandOutput( const int csort , const int band_num) const
+{
+ return *( m_data_array[csort][band_num-1] );
+}
+
+// Frame stuff
+
+
+void FrameOutputManager::Init( int num_bands )
+{
+ // Initialise output for the frame header
+ m_frame_header = new BasicOutputManager( m_out_stream );
+
+ // Initialise output for the MV data
+ m_mv_data = new UnitOutputManager( m_out_stream );
+
+ // Initialise subband outputs
+ for ( int c=0 ; c<3 ; ++c)
+ for ( int b=0 ; b<num_bands ; ++b)
+ m_data_array[c][b] = new UnitOutputManager( m_out_stream );
+}
+
+void FrameOutputManager::Reset()
+{
+ const int num_bands = m_data_array.LengthX();
+ DeleteAll();
+ Init( num_bands );
+}
+
+void FrameOutputManager::DeleteAll()
+{
+ // Delete subband outputs
+ for ( int c=0 ; c<3 ; ++c)
+ for ( int b=0 ; b<m_data_array.LengthX() ; ++b )
+ delete m_data_array[c][b];
+
+ // Delete MV data op
+ delete m_mv_data;
+
+ // Delete frame header op
+ delete m_frame_header;
+}
+
+
+// Sequence stuff //
+
+SequenceOutputManager::SequenceOutputManager( std::ostream* out_data ):
+ m_frame_op_mgr( out_data ),
+ m_seq_header( out_data ),
+ m_seq_end( out_data ),
+ m_comp_bytes( 3 ),
+ m_comp_hdr_bytes( 3 ),
+ m_mv_hdr_bytes(0),
+ m_mv_bytes(0),
+ m_total_bytes(0),
+ m_header_bytes(0),
+ m_trailer_bytes(0)
+
+{
+ for (int c=0 ; c<3 ; ++c )
+ {
+ m_comp_hdr_bytes[c] = 0;
+ m_comp_bytes[c] = 0;
+ }
+}
+
+void SequenceOutputManager::WriteFrameData()
+{
+ m_frame_op_mgr.WriteToFile();
+
+ // Keep up with count of component bytes
+ for (int c=0 ; c<m_comp_hdr_bytes.Length(); ++c)
+ {
+ m_comp_hdr_bytes[c] += m_frame_op_mgr.ComponentHeadBytes( c );
+ m_comp_bytes[c] += m_frame_op_mgr.ComponentBytes( c );
+ }// c
+
+ // Keep up with count of MV bytes
+ m_mv_hdr_bytes += m_frame_op_mgr.MVHeadBytes();
+ m_mv_bytes += m_frame_op_mgr.MVBytes();
+
+ // Keep up with overall totals
+ m_header_bytes += m_frame_op_mgr.FrameHeadBytes();
+ m_total_bytes += m_frame_op_mgr.FrameBytes();
+
+}
+
+void SequenceOutputManager::WriteSeqHeaderToFile()
+{
+ m_seq_header.WriteToFile();
+ m_header_bytes += m_seq_header.GetNumBytes();
+ m_total_bytes += m_seq_header.GetNumBytes();
+}
+
+void SequenceOutputManager::WriteSeqTrailerToFile()
+{
+ m_seq_end.WriteToFile();
+ m_trailer_bytes += m_seq_end.GetNumBytes();
+ m_total_bytes += m_seq_end.GetNumBytes();
+}
+
+////////////////
+//Input stuff//
+////////////////
+
+//Constructor
+BitInputManager::BitInputManager(std::istream* in_data ):
+ m_ip_ptr(in_data)
+{
+ InitInputStream();
+}
+
+
+void BitInputManager::InitInputStream()
+{
+ m_shift = 0xffffffff;
+ m_input_bits_left = 0;
+}
+
+bool BitInputManager::InputBit()
+{
+ //assumes mode errors will be caught by iostream class
+
+ if (m_input_bits_left == 0)
+ {
+ m_ip_ptr->read(&m_current_byte,1);
+ m_input_bits_left = 8;
+ if (m_shift == START_CODE_PREFIX && (unsigned char)m_current_byte == NOT_START_CODE)
+ {
+ std::cerr << "Ignoring byte " << std::endl;
+ m_ip_ptr->read(&m_current_byte,1);
+ m_shift = 0xffffffff;
+ }
+ m_shift = (m_shift << 8) | m_current_byte;
+ }
+
+ m_input_bits_left--;
+
+ return bool( ( m_current_byte >> m_input_bits_left ) & 1 );
+
+}
+
+bool BitInputManager::InputBit(int& count)
+{
+ count++;
+ return InputBit();
+}
+
+bool BitInputManager::InputBit(int& count, const int max_count)
+{
+ if ( count<max_count )
+ {
+ count++;
+ return InputBit();
+ }
+ else
+ return false;
+}
+
+char BitInputManager::InputByte()
+{
+ // Forget about what's in the current byte
+ FlushInput();
+
+ char byte;
+ m_ip_ptr->read(&byte,1);
+
+ return byte;
+}
+
+void BitInputManager::InputBytes(char* cptr, int num)
+{
+ // Forget about what's in the current byte
+ FlushInput();
+
+ m_ip_ptr->read(cptr,num);
+}
+
+void BitInputManager::FlushInput()
+{
+ m_input_bits_left = 0;
+}
+
+bool BitInputManager::End() const
+{
+ return m_ip_ptr->eof();
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/bit_manager.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/bit_manager.h
new file mode 100644
index 000000000..71b8455f7
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/bit_manager.h
@@ -0,0 +1,512 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: bit_manager.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Robert Scott Ladd,
+* Tim Borer
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _BIT_MANAGER_H_
+#define _BIT_MANAGER_H_
+
+#include <libdirac_common/arrays.h>
+#include <cstring>
+#include <vector>
+#include <iostream>
+
+namespace dirac
+{
+ //! Prefix for all start codes
+ const unsigned int START_CODE_PREFIX = 0x42424344; //BBCD
+ const unsigned int START_CODE_PREFIX_BYTE0 =
+ (START_CODE_PREFIX >> 24) & 0xFF;
+ const unsigned int START_CODE_PREFIX_BYTE1 =
+ (START_CODE_PREFIX >> 16) & 0xFF;
+ const unsigned int START_CODE_PREFIX_BYTE2 =
+ (START_CODE_PREFIX >> 8) & 0xFF;
+ const unsigned int START_CODE_PREFIX_BYTE3 =
+ START_CODE_PREFIX & 0xFF;
+
+ //! Random Access Point (RAP) Intra Frame start Code
+ const unsigned char RAP_START_CODE = 0xD7;
+ //! Non-RAP Intra Frame start code
+ const unsigned char IFRAME_START_CODE = 0xD6;
+ //! L1 Frame start code
+ const unsigned char L1FRAME_START_CODE = 0xD4;
+ //! L2 Frame start code
+ const unsigned char L2FRAME_START_CODE = 0xD5;
+ //! Sequence end code
+ const unsigned char SEQ_END_CODE = 0xD0;
+ //! Not a start code but part of data
+ const unsigned char NOT_START_CODE = 0xFF;
+ //! Bitstream version
+ const unsigned char BITSTREAM_VERSION = 0x02; //0.2
+
+
+ ////////////////////////////////////////////////
+ //--------------Bit output stuff--------------//
+ ////////////////////////////////////////////////
+
+ class UnitOutputManager;
+ class FrameOutputManager;
+ class SequenceOutputManager;
+
+ //! Class for managing bit- and byte-oriented output.
+ /*!
+ A class for managing bit- and byte-oriented output. Wraps around
+ an ostream object but stores data in memory until told told to
+ write out in order to support data re-ordering - for example
+ writing a header once the subsequent data has been obtained.
+ Implementation to be reviewed in future. TJD 13 April 2004.
+ */
+ class BasicOutputManager
+ {
+ // Data cannot be written to file directly, only by other o/p classes
+ friend class UnitOutputManager;
+ friend class FrameOutputManager;
+ friend class SequenceOutputManager;
+
+ public:
+ //! Constructor
+ /*!
+ Constructor requires an ostream object pointer.
+ \param out_data the output stream object pointer
+ */
+ BasicOutputManager(std::ostream* out_data );
+
+ //Copy constructor is default shallow copy
+
+ //Operator= is default shallow=
+
+ //! Destructor
+ ~BasicOutputManager(){}
+
+ //! Write a bit out.
+ /*!
+ Write a bit out to the internal data cache.
+ */
+ void OutputBit(const bool& bit);
+
+ //! Write a bit out and increment count
+ /*!
+ Write a bit out to the internal data cache and increment the
+ count of bits written.
+ */
+ void OutputBit(const bool& bit,int& count);
+
+ //! Write a byte out.
+ /*!
+ Write a byte out to the internal data cache.
+ */
+ void OutputByte(const char& byte);
+
+ //! Write a null-terminated set of bytes out.
+ /*!
+ Write a null-terminated set of bytes out to the internal data cache.
+ */
+ void OutputBytes(char* str_array);
+
+ //! Write a number of bytes out.
+ /*!
+ Write a number of bytes out to the internal data cache.
+ */
+ void OutputBytes(char* str_array,int num);
+
+ //! Return the number of bytes last output to file.
+ /*!
+ Return the number of bytes last output to file.
+ */
+ size_t GetNumBytes() const {return m_num_out_bytes;}
+
+ //! Size of the internal data cache in bytes.
+ /*!
+ Size of the internal data cache in bytes.
+ */
+ size_t Size() const {return m_buffer.size();}
+
+ private:
+ // Number of output bytes written
+ size_t m_num_out_bytes;
+ std::ostream* m_op_ptr;
+ // Buffer used to store output prior to saving to file
+ std::vector<char> m_buffer;
+ // Char used for temporary storage of op data bits
+ char m_current_byte;
+ // Used to set individual bit within the current header byte
+ int m_output_mask;
+
+ //functions
+
+ //! Write all data to file.
+ /*!
+ Dump the internal data cache to the internal ostream object.
+ */
+ void WriteToFile();
+
+ //Initialise the output stream.
+ void InitOutputStream();
+
+ //Clean out any remaining output bits to the buffer
+ void FlushOutput();
+
+ //! Write an ignore code
+ /*!
+ Write a skip interpret start prefix byte out to the internal data
+ cache.
+ */
+ void OutputSkipInterpretStartPrefixByte();
+ };
+
+ //! A class for handling data output, including headers.
+ /*!
+ A class for handling data output, including headers and reordering.
+ */
+ class UnitOutputManager
+ {
+ // Only the FrameOutputManager can make this class write data to file
+ friend class FrameOutputManager;
+
+ public:
+ //! Constructor.
+ /*!
+ Constructor wraps around a pointer to an ostream object, and
+ initialises two BasicOutputManager objects for header and data
+ */
+ UnitOutputManager(std::ostream* out_data );
+
+ //Copy constructor is default shallow copy
+
+ //Operator= is default shallow=
+
+ //! Destructor
+ ~UnitOutputManager(){}
+
+ //! Handles the header bits.
+ /*!
+ A BasicOutputManager object for handling the header bits.
+ */
+ BasicOutputManager& Header(){return m_header;}
+
+ //! Handles the data bits.
+ /*!
+ A BasicOutputManager object for handling the data bits.
+ */
+ BasicOutputManager& Data(){return m_data;}
+
+ //! Returns the total number of bytes written in the last unit coded.
+ /*!
+ Returns the total number of bytes written in the last unit coded - header + data.
+ */
+ const size_t GetUnitBytes() const {return m_unit_bytes;}
+
+ //! Returns the total number of header bytes written in the last unit coded.
+ const size_t GetUnitHeaderBytes() const {return m_unit_head_bytes;}
+
+ private:
+ // basic output managers for the header and data
+ BasicOutputManager m_header,m_data;
+
+ // total number of bytes written in the last unit coded
+ size_t m_unit_bytes;
+
+ // number of data bytes for the last unit coded
+ size_t m_unit_data_bytes;
+
+ // number of data bytes for the last unit coded
+ size_t m_unit_head_bytes;
+
+ // functions
+
+ //! Writes the bit caches to file.
+ /*!
+ Writes the header bits to the ostream, followed by the data bits.
+ */
+ void WriteToFile();
+ };
+
+ class FrameOutputManager
+ {
+ public:
+
+ // Only the SequenceOutputManager can make this class write data to file
+ friend class SequenceOutputManager;
+
+ //! Constructor
+ /*
+ Constructs a class which manages output for an entire frame.
+ \param out_data pointer to the output stream
+ \param num_bands the number of subbands per component
+ */
+ FrameOutputManager( std::ostream* out_data , const int num_bands=13 );
+
+ //! Destructor
+ ~FrameOutputManager();
+
+ //! Set the number of bands there will be in a component
+ void SetNumBands( const int num_bands );
+
+ //! Get an output manager for a subband
+ /*!
+ Get an output manager for a subband.
+ \param csort the component (Y, U or V)
+ \param band_num the number of the subband
+ */
+ UnitOutputManager& BandOutput( const int csort , const int band_num );
+
+ //! Get an output manager for a subband
+ /*!
+ Get an output manager for a subband.
+ \param csort the component (Y, U or V)
+ \param band_num the number of the subband
+ */
+ const UnitOutputManager& BandOutput( const int csort , const int band_num ) const;
+
+ //! Get an output manager for MV data
+ /*!
+ Get an output manager for MV data
+ */
+ UnitOutputManager& MVOutput(){ return *m_mv_data; }
+
+ //! Get an output manager for MV data
+ /*!
+ Get an output manager for MV data
+ */
+ const UnitOutputManager& MVOutput() const { return *m_mv_data; }
+
+ //! Get an output manager for the frame header
+ BasicOutputManager& HeaderOutput(){ return *m_frame_header; }
+
+ //! Return the number of bytes used for each component
+ const size_t ComponentBytes( const int comp_num ) const { return m_comp_bytes[comp_num];}
+
+ //! Return the number of header bytes used for each component
+ const size_t ComponentHeadBytes( const int comp_num ) const { return m_comp_hdr_bytes[comp_num];}
+
+ //! Return the number of motion vector bytes used
+ const size_t MVBytes() const { return m_mv_bytes;}
+
+ //! Return the number of motion vector header bytes used
+ const size_t MVHeadBytes() const { return m_mv_hdr_bytes;}
+
+ //! Return the number of bytes used for the whole frame
+ const size_t FrameBytes() const { return m_total_bytes;}
+
+ //! Return the number of header bytes used throughout the frame
+ const size_t FrameHeadBytes() const { return m_header_bytes;}
+
+ private:
+
+ // Array of subband outputs, 1 for each component and subband
+ TwoDArray< UnitOutputManager* > m_data_array;
+
+ // Motion vector output
+ UnitOutputManager* m_mv_data;
+
+ // Frame header output
+ BasicOutputManager* m_frame_header;
+
+ // The total number of frame bytes
+ size_t m_total_bytes;
+
+ // The total number of header bytes
+ size_t m_header_bytes;
+
+ // The total number of MV header bytes
+ size_t m_mv_hdr_bytes;
+
+ // The total number of MV bytes
+ size_t m_mv_bytes;
+
+ // The total number of bytes in each component
+ OneDArray< size_t > m_comp_bytes;
+
+ // The total number of header bytes in each component
+ OneDArray< size_t > m_comp_hdr_bytes;
+
+ // A copy of a pointer to the output stream
+ std::ostream* m_out_stream;
+
+ // Functions
+
+ //! Initialise the band data
+ void Init( const int num_bands );
+
+ //! Reset all the data
+ void Reset();
+
+ //! Delete all the data
+ void DeleteAll();
+
+ //! Write all the frame data to file
+ void WriteToFile();
+ };
+
+ class SequenceOutputManager
+ {
+ public:
+ //! Constructor
+ SequenceOutputManager( std::ostream* out_data );
+
+ //! Return a reference to the output for a single frame
+ FrameOutputManager& FrameOutput(){ return m_frame_op_mgr; }
+
+ //! Return a reference to the output for a single frame
+ BasicOutputManager& HeaderOutput(){ return m_seq_header; }
+
+ //! Return a reference to the output for the sequence trailer
+ BasicOutputManager& TrailerOutput(){ return m_seq_end; }
+
+ //! Reset the frame data without outputting
+ void ResetFrame(){ m_frame_op_mgr.Reset(); }
+
+ //! Write the sequence header
+ void WriteSeqHeaderToFile();
+
+ //! Write all the frame data to file
+ void WriteFrameData();
+
+ //! Write the sequence trailer
+ void WriteSeqTrailerToFile();
+
+ //! Return the total number of bytes used for the sequence
+ const size_t SequenceBytes() { return m_total_bytes; }
+
+ //! Return the total number of header bytes used throughout the sequence
+ const size_t SequenceHeadBytes() { return m_header_bytes; }
+
+ //! Return the total number bytes used for MVs
+ const size_t MVBytes() { return m_mv_bytes; }
+
+ //! Return the total number bytes used for a component
+ const size_t ComponentBytes( const int comp_num ) { return m_comp_bytes[comp_num]; }
+
+ //! Reset the frame data
+ void ResetFrameData();
+
+
+ private:
+
+ // The frame output manager
+ FrameOutputManager m_frame_op_mgr;
+
+ // Output manager for the sequence header
+ BasicOutputManager m_seq_header;
+
+ // Output manager for the sequence end
+ BasicOutputManager m_seq_end;
+
+ // The total number of bytes in each component
+ OneDArray< size_t > m_comp_bytes;
+
+ // The total number of header bits in each component
+ OneDArray< size_t > m_comp_hdr_bytes;
+
+ // The number of MV header bytes
+ size_t m_mv_hdr_bytes;
+
+ // The total number of MV bytes
+ size_t m_mv_bytes;
+
+ // The total number of bytes written so far
+ size_t m_total_bytes;
+
+ // The total number of header bytes written so far
+ size_t m_header_bytes;
+
+ // The total number of trailer bytes written so far
+ size_t m_trailer_bytes;
+ };
+
+ ///////////////////////////////////////////////
+ //--------------Bit input stuff--------------//
+ ///////////////////////////////////////////////
+
+ //! A class for managing bit-wise and byte-wise input.
+ class BitInputManager
+ {
+
+ public:
+ //! Constructor.
+ /*!
+ Constructor. Wraps around an istream object.
+ */
+ BitInputManager(std::istream* in_data );
+
+ //Copy constructor is default shallow copy
+
+ //Operator= is default shallow=
+
+ //! Destructor
+ ~BitInputManager(){}
+
+ //input functions
+ //! Obtain the next bit.
+ bool InputBit();
+
+ //! Obtain the next bit, incrementing count.
+ bool InputBit(int& count);
+
+ //! Obtain the next bit, incrementing count, if count<max_count; else return 0 (false).
+ bool InputBit(int& count, const int max_count);
+
+ //! Obtain the next byte.
+ char InputByte();
+
+ //! Obtain a number of bytes.
+ void InputBytes(char* cptr,int num);
+
+ //! Move onto the next byte. Needed if a data unit is not an exact number of bytes.
+ void FlushInput();
+
+ //! Returns true if we're at the end of the input, false otherwise
+ bool End() const ;
+
+ private:
+
+ std::istream* m_ip_ptr;
+ // Char used for temporary storage of ip bits
+ char m_current_byte;
+ // The number of bits left withint the current input byte being decoded
+ int m_input_bits_left;
+
+ //used to check if start code is detected
+ unsigned int m_shift;
+ //functions
+ // Initialise the input stream
+ void InitInputStream();
+ };
+
+} // namespace dirac
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/cmd_line.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/cmd_line.cpp
new file mode 100644
index 000000000..0f9031a2f
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/cmd_line.cpp
@@ -0,0 +1,77 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: cmd_line.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Scott R Ladd (Original Author), Thomas Davies
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include "cmd_line.h"
+using namespace dirac;
+
+using namespace std;
+
+CommandLine::CommandLine(int argc, char * argv[], const set<string> & bool_opts)
+ : m_options(),
+ m_inputs(),
+ m_bool_opts(bool_opts)
+{
+ bool option_active = false;
+ vector<option>::iterator active_option;
+
+ for (int i = 1; i < argc; ++i)
+ {
+ // is it an option?
+ if ((strlen(argv[i]) > 1) && (argv[i][0] == '-'))
+ {
+ // store new key
+ string opt_key = string(&argv[i][1]);
+ m_options.push_back(option(opt_key));
+
+ // active option is now last in list
+ active_option = m_options.end();
+ --active_option;
+
+ // check option list to see if we're looking for an argument
+ option_active = (m_bool_opts.find(opt_key) == m_bool_opts.end());
+ }
+ else
+ {
+ if (option_active)
+ active_option->m_value = string(argv[i]);
+ else
+ m_inputs.push_back(string(argv[i]));
+
+ option_active = false;
+ }
+ }
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/cmd_line.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/cmd_line.h
new file mode 100644
index 000000000..1767f896c
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/cmd_line.h
@@ -0,0 +1,92 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: cmd_line.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Scott R Ladd (Original Author), Thomas Davies
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#if !defined(LIBDIRAC_CMD_LINE_H)
+#define LIBDIRAC_CMD_LINE_H
+
+// Standard C++
+#include <string>
+#include <vector>
+#include <set>
+
+namespace dirac
+{
+ // structure for defining the nature of options
+ // a very simple command-line parser
+ class CommandLine
+ {
+ public:
+ struct option
+ {
+ std::string m_name;
+ std::string m_value;
+
+ option(const std::string & a_name)
+ : m_name(a_name), m_value("")
+ {
+ // nada
+ }
+ };
+
+ //! Constructor
+ CommandLine(int argc, char * argv[], const std::set<std::string> & bool_opts);
+
+ const std::vector<option> & GetOptions() const
+ {
+ return m_options;
+ }
+
+ const std::vector<std::string> & GetInputs() const
+ {
+ return m_inputs;
+ }
+
+ // convenience property
+ size_t Count() const
+ {
+ return m_options.size();
+ }
+
+ private:
+ std::vector<option> m_options;
+ std::vector<std::string> m_inputs;
+ const std::set<std::string> & m_bool_opts;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/common.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/common.cpp
new file mode 100644
index 000000000..7dc4c1b5e
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/common.cpp
@@ -0,0 +1,440 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: common.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+ Scott R Ladd,
+ Tim Borer
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_common/common.h>
+#include <algorithm>
+using namespace dirac;
+
+
+//PicArray functions
+
+PicArray::PicArray(int height, int width, CompSort cs):
+ TwoDArray<ValueType>(height , width),
+ m_csort(cs)
+{
+ //Nothing
+}
+
+const CompSort& PicArray::CSort() const
+{
+ return m_csort;
+}
+
+void PicArray::SetCSort(const CompSort cs)
+{
+ m_csort=cs;
+}
+
+
+
+//EntropyCorrector functions
+
+EntropyCorrector::EntropyCorrector(int depth):
+ m_Yfctrs( 3 , 3*depth+1 ),
+ m_Ufctrs( 3 , 3*depth+1 ),
+ m_Vfctrs( 3 , 3*depth+1 )
+{
+ Init();
+}
+
+float EntropyCorrector::Factor(const int bandnum , const FrameSort fsort ,const CompSort c) const
+{
+
+ if (c == U_COMP)
+ return m_Ufctrs[fsort][bandnum-1];
+ else if (c == V_COMP)
+ return m_Vfctrs[fsort][bandnum-1];
+ else
+ return m_Yfctrs[fsort][bandnum-1];
+}
+
+void EntropyCorrector::Init()
+{
+
+ //do I-frames
+ for (int i=0 ; i<m_Yfctrs.LengthX() ; ++i )
+ {
+ if ( i == m_Yfctrs.LastX() )
+ {
+ m_Yfctrs[I_frame][i] = 1.0;
+ m_Ufctrs[I_frame][i] = 1.0;
+ m_Vfctrs[I_frame][i] = 1.0;
+ m_Yfctrs[L1_frame][i] = 0.85;
+ m_Ufctrs[L1_frame][i] = 0.85;
+ m_Vfctrs[L1_frame][i] = 0.85;
+ m_Yfctrs[L2_frame][i] = 0.85;
+ m_Ufctrs[L2_frame][i] = 0.85;
+ m_Vfctrs[L2_frame][i] = 0.85;
+ }
+ else if ( i >= m_Yfctrs.LastX()-3 )
+ {
+ m_Yfctrs[I_frame][i] = 0.85;
+ m_Ufctrs[I_frame][i] = 0.85;
+ m_Vfctrs[I_frame][i] = 0.85;
+ m_Yfctrs[L1_frame][i] = 0.75;
+ m_Ufctrs[L1_frame][i] = 0.75;
+ m_Vfctrs[L1_frame][i] = 0.75;
+ m_Yfctrs[L2_frame][i] = 0.75;
+ m_Ufctrs[L2_frame][i] = 0.75;
+ m_Vfctrs[L2_frame][i] = 0.75;
+ }
+ else
+ {
+ m_Yfctrs[I_frame][i] = 0.75;
+ m_Ufctrs[I_frame][i] = 0.75;
+ m_Vfctrs[I_frame][i] = 0.75;
+ m_Yfctrs[L1_frame][i] = 0.75;
+ m_Ufctrs[L1_frame][i] = 0.75;
+ m_Vfctrs[L1_frame][i] = 0.75;
+ m_Yfctrs[L2_frame][i] = 0.75;
+ m_Ufctrs[L2_frame][i] = 0.75;
+ m_Vfctrs[L2_frame][i] = 0.75;
+ }
+ }//i
+
+}
+
+void EntropyCorrector::Update(int bandnum , FrameSort fsort , CompSort c ,int est_bits , int actual_bits){
+ //updates the factors - note that the estimated bits are assumed to already include the correction factor
+
+ float multiplier;
+ if (actual_bits != 0 && est_bits != 0)
+ multiplier = float(actual_bits)/float(est_bits);
+ else
+ multiplier=1.0;
+ if (c == U_COMP)
+ m_Ufctrs[fsort][bandnum-1] *= multiplier;
+ else if (c == V_COMP)
+ m_Vfctrs[fsort][bandnum-1] *= multiplier;
+ else
+ m_Yfctrs[fsort][bandnum-1] *= multiplier;
+}
+
+// Overlapped block parameter functions
+
+OLBParams::OLBParams(const int xblen, int const yblen, int const xbsep, int const ybsep):
+ m_xblen(xblen),
+ m_yblen(yblen),
+ m_xbsep(xbsep),
+ m_ybsep(ybsep),
+ m_xoffset( (xblen-xbsep)/2 ),
+ m_yoffset( (yblen-ybsep)/2 )
+{}
+
+namespace dirac
+{
+std::ostream & operator<< (std::ostream & stream, OLBParams & params)
+{
+ stream << params.Ybsep() << " " << params.Xbsep();
+// stream << " " <<params.Yblen() << " " << params.Xblen();
+
+ return stream;
+}
+
+std::istream & operator>> (std::istream & stream, OLBParams & params)
+{
+ int temp;
+
+ stream >> temp;
+ params.SetYbsep(temp);
+
+ stream >> temp;
+ params.SetXbsep(temp);
+
+// stream >> temp;
+// params.SetYblen(temp);
+
+// stream >> temp;
+// params.SetXblen(temp);
+
+ return stream;
+}
+
+}
+
+// Codec params functions
+
+CodecParams::CodecParams():
+ m_x_num_mb(0),
+ m_y_num_mb(0),
+ m_x_num_blocks(0),
+ m_y_num_blocks(0),
+ m_verbose(false),
+ m_interlace(false),
+ m_topfieldfirst(false),
+ m_lbparams(3),
+ m_cbparams(3)
+{}
+
+void CodecParams::SetBlockSizes(const OLBParams& olbparams , const ChromaFormat cformat)
+{
+ //given the raw overlapped block parameters, set the modified internal parameters to
+ //take account of the chroma sampling format and overlapping requirements, as well
+ //as the equivalent parameters for sub-MBs and MBs.
+ //Does NOT set the number of blocks or macroblocks, as padding may be required.
+
+ // Factors for scaling chroma blocks
+ int xcfactor,ycfactor;
+
+ if (cformat == format420)
+ {
+ xcfactor = 2;
+ ycfactor = 2;
+ }
+ else if (cformat == format422)
+ {
+ xcfactor = 2;
+ ycfactor = 1;
+
+ }
+ else if (cformat==format411)
+ {
+ xcfactor = 4;
+ ycfactor = 1;
+ }
+ else
+ {// assume 444
+ xcfactor = 1;
+ ycfactor = 1;
+ }
+
+ m_lbparams[2] = olbparams;
+
+ // Check the separations aren't too small
+ m_lbparams[2].SetXbsep( std::max(m_lbparams[2].Xbsep() , 4) );
+ m_lbparams[2].SetYbsep( std::max(m_lbparams[2].Ybsep() , 4) );
+
+ // Check the lengths aren't too big (100% is max roll-off)
+ m_lbparams[2].SetXblen( std::min(m_lbparams[2].Xbsep()*2 , m_lbparams[2].Xblen()) );
+ m_lbparams[2].SetYblen( std::min(m_lbparams[2].Ybsep()*2 , m_lbparams[2].Yblen()) );
+
+ // Check overlap is divisible by 2
+ if (( m_lbparams[2].Xblen() - m_lbparams[2].Xbsep() )%2 != 0)
+ m_lbparams[2].SetXblen( m_lbparams[2].Xblen()-1 );
+ if (( m_lbparams[2].Yblen() - m_lbparams[2].Ybsep() )%2 != 0)
+ m_lbparams[2].SetYblen( m_lbparams[2].Yblen()-1 );
+
+ // Check there's now sufficient overlap
+ m_lbparams[2].SetXblen( std::max(m_lbparams[2].Xbsep()+2 , m_lbparams[2].Xblen()) );
+ m_lbparams[2].SetYblen( std::max(m_lbparams[2].Ybsep()+2 , m_lbparams[2].Yblen()) );
+
+
+ // If the overlapped blocks don't work for the chroma format, we have to iterate
+ if ( (m_lbparams[2].Xbsep()%xcfactor != 0) || (m_lbparams[2].Ybsep()%ycfactor != 0) )
+ {
+ OLBParams new_olbparams( m_lbparams[2] );
+
+ if (m_lbparams[2].Xbsep()%xcfactor != 0)
+ new_olbparams.SetXbsep( ( (m_lbparams[2].Xbsep()/xcfactor) + 1 )*xcfactor );
+
+ if (m_lbparams[2].Ybsep()%ycfactor != 0)
+ new_olbparams.SetYbsep( ( (m_lbparams[2].Ybsep()/ycfactor) + 1 )*ycfactor );
+
+ new_olbparams.SetXblen( std::max( new_olbparams.Xbsep()+2 , olbparams.Xblen() ) );
+ new_olbparams.SetYblen( std::max( new_olbparams.Xbsep()+2 , olbparams.Xblen() ) );
+
+ SetBlockSizes( new_olbparams , cformat );
+ }
+
+ // Now compute the resulting chroma block params
+
+ m_cbparams[2].SetXbsep( m_lbparams[2].Xbsep()/xcfactor );
+ m_cbparams[2].SetYbsep( m_lbparams[2].Ybsep()/ycfactor );
+ m_cbparams[2].SetXblen( std::max(m_lbparams[2].Xblen()/xcfactor , m_cbparams[2].Xbsep()+2) );
+ m_cbparams[2].SetYblen( std::max(m_lbparams[2].Yblen()/ycfactor , m_cbparams[2].Ybsep()+2) );
+
+ //check overlap is divisible by 2
+ if (( m_cbparams[2].Xblen() - m_cbparams[2].Xbsep() )%2 != 0)
+ m_cbparams[2].SetXblen( m_cbparams[2].Xblen()+1 );
+ if (( m_cbparams[2].Yblen() - m_cbparams[2].Ybsep() )%2 != 0)
+ m_cbparams[2].SetYblen( m_cbparams[2].Yblen()+1 );
+
+ //Now work out the overlaps for splitting levels 1 and 0
+ m_lbparams[1].SetXbsep( m_lbparams[2].Xbsep()*2 );
+ m_lbparams[1].SetXblen( m_lbparams[2].Xblen() + m_lbparams[2].Xbsep() );
+ m_lbparams[1].SetYbsep( m_lbparams[2].Ybsep()*2 );
+ m_lbparams[1].SetYblen( m_lbparams[2].Yblen() + m_lbparams[2].Xbsep() );
+
+ m_lbparams[0].SetXbsep( m_lbparams[1].Xbsep()*2 );
+ m_lbparams[0].SetXblen( m_lbparams[1].Xblen() + m_lbparams[1].Xbsep() );
+ m_lbparams[0].SetYbsep( m_lbparams[1].Ybsep()*2 );
+ m_lbparams[0].SetYblen( m_lbparams[1].Yblen() + m_lbparams[1].Xbsep() );
+
+ m_cbparams[1].SetXbsep( m_cbparams[2].Xbsep()*2 );
+ m_cbparams[1].SetXblen( m_cbparams[2].Xblen() + m_cbparams[2].Xbsep() );
+ m_cbparams[1].SetYbsep( m_cbparams[2].Ybsep()*2 );
+ m_cbparams[1].SetYblen( m_cbparams[2].Yblen() + m_cbparams[2].Xbsep() );
+
+ m_cbparams[0].SetXbsep( m_cbparams[1].Xbsep()*2 );
+ m_cbparams[0].SetXblen( m_cbparams[1].Xblen() + m_cbparams[1].Xbsep() );
+ m_cbparams[0].SetYbsep( m_cbparams[1].Ybsep()*2 );
+ m_cbparams[0].SetYblen( m_cbparams[1].Yblen() + m_cbparams[1].Xbsep() );
+
+}
+
+//EncoderParams functions
+
+//Default constructor
+EncoderParams::EncoderParams():
+ CodecParams(),
+ m_qf(5.0),
+ m_num_L1(0),
+ m_L1_sep(0),
+ m_ufactor(1.0),
+ m_vfactor(1.0),
+ m_cpd(20.0),
+ m_I_lambda(0.f),
+ m_L1_lambda(0.0f),
+ m_L2_lambda(0.0f),
+ m_L1_me_lambda(0.0f),
+ m_L2_me_lambda(0.0f),
+ m_ent_correct(0),
+ m_bit_out(0)
+{}
+
+float EncoderParams::Lambda(const FrameSort& fsort) const
+{
+ if (fsort == I_frame)
+ return ILambda();
+ else if (fsort == L1_frame)
+ return L1Lambda();
+ else
+ return L2Lambda();
+}
+
+
+void EncoderParams::SetLambda(const FrameSort& fsort, const float l)
+{
+ if (fsort == I_frame)
+ SetILambda(l);
+ else if (fsort == L1_frame)
+ SetL1Lambda(l);
+ else
+ SetL2Lambda(l);
+}
+
+//SeqParams functions
+//constructor
+SeqParams::SeqParams():
+ m_xl(0),
+ m_yl(0),
+ m_cformat(format422),
+ m_interlace(false),
+ m_topfieldfirst(true),
+ m_framerate(12)
+{}
+
+int SeqParams::ChromaWidth() const
+{
+ switch (m_cformat)
+ {
+ case Yonly:
+ return 0;
+ case format411:
+ return m_xl/4;
+
+ case format420:
+ case format422:
+ return m_xl/2;
+
+ case format444:
+ default:
+ return m_xl;
+ }
+}
+
+int SeqParams::ChromaHeight() const
+{
+ switch (m_cformat)
+ {
+ case Yonly:
+ return 0;
+ return m_yl;
+
+ case format420:
+ return m_yl/2;
+
+ case format422:
+ case format444:
+ case format411:
+ default:
+ return m_yl;
+ }
+}
+//FrameParams functions
+
+// Default constructor
+FrameParams::FrameParams():
+m_fsort(I_frame),
+m_output(false)
+{}
+
+// Constructor
+FrameParams::FrameParams(const ChromaFormat& cf, int xlen, int ylen):
+ m_cformat(cf),
+ m_xl(xlen),
+ m_yl(ylen),
+ m_fsort(I_frame),
+ m_output(false)
+{}
+
+// Constructor
+FrameParams::FrameParams(const ChromaFormat& cf, const FrameSort& fs):
+ m_cformat(cf),
+ m_fsort(fs),
+ m_output(false)
+{}
+
+// Constructor
+FrameParams::FrameParams(const SeqParams& sparams):
+ m_cformat(sparams.CFormat()),
+ m_xl(sparams.Xl()),
+ m_yl(sparams.Yl()),
+ m_fsort(I_frame),
+ m_output(false)
+{}
+
+// Constructor
+FrameParams::FrameParams(const SeqParams& sparams, const FrameSort& fs):
+ m_cformat(sparams.CFormat()),
+ m_xl(sparams.Xl()),
+ m_yl(sparams.Yl()),
+ m_fsort(fs),
+ m_output(false)
+{}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/common.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/common.h
new file mode 100644
index 000000000..b0726e3e1
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/common.h
@@ -0,0 +1,859 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: common.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd,
+* Tim Borer
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _COMMON_H_
+#define _COMMON_H_
+
+#include <libdirac_common/bit_manager.h>
+#include <libdirac_common/arrays.h>
+#include <libdirac_common/common_types.h>
+#include <vector>
+#include <cmath>
+
+namespace dirac
+{
+ /*! \file
+ This file contains common classes used throughout the encoder and
+ decoder. The main classes are the encoder and decoder parameters for
+ controlling the encode and decode processes. These are passed
+ throughout the codec. There are also parameter classes for sequences
+ and frames.
+ */
+
+
+ //Some basic enumeration types used throughout the codec ...//
+ //////////////////////////////////////////////////////////////
+
+ //! Prediction modes for blocks
+ enum PredMode{ INTRA , REF1_ONLY , REF2_ONLY , REF1AND2 };
+
+ //! Types of picture component
+ enum CompSort{ Y_COMP , U_COMP , V_COMP , R_COMP , G_COMP , B_COMP };
+
+ //! Addition or subtraction
+ enum AddOrSub{ ADD , SUBTRACT };
+
+ //! Forward or backward
+ enum Direction { FORWARD , BACKWARD };
+
+ //! Currently only Daubechies (DAUB) implemented
+ enum WltFilter { DAUB , HAAR };
+
+ //! Contexts used for coefficient coding
+ enum CtxAliases
+ {//used for residual coding
+ SIGN0_CTX, //0 -sign, previous symbol is 0
+ SIGN_POS_CTX, //1 -sign, previous symbol is +ve
+ SIGN_NEG_CTX, //2 -sign, previous symbol is -ve
+
+
+ Z_BIN1z_CTX, //3 -bin 1, parent is zero, neighbours zero
+ Z_BIN1nz_CTX, //4 -bin 1, parent is zero, neighbours non-zero
+ Z_BIN2_CTX, //5 -bin 2, parent is zero
+ Z_BIN3_CTX, //6 -bin 3, parent is zero
+ Z_BIN4_CTX, //7 -bin 4, parent is zero
+ Z_BIN5plus_CTX, //8 -bins 5 plus, parent is zero
+
+ NZ_BIN1z_CTX, //9 -bin 1, parent is non-zero, neighbours zero
+ NZ_BIN1a_CTX, //10 -bin 1, parent is non-zero, neighbours small
+ NZ_BIN1b_CTX, //11 -bin 1, parent is non-zero, neighbours large
+ NZ_BIN2_CTX, //12 -bin 2, parent is non-zero
+ NZ_BIN3_CTX, //13 -bin 3, parent is non-zero
+ NZ_BIN4_CTX, //14 -bin 4, parent is non-zero
+ NZ_BIN5plus_CTX, //15 -bins 5 plus, parent is non-zero
+
+ ZTz_CTX, //16 -zerotree, neighbouring symbols are zerotree elements
+ ZTnz_CTX, //17 -zerotree, neighbouring symbols are not zerotree elements
+ ZTzb_CTX, //16 -zerotree, neighbouring symbols are zerotree elements
+ ZTnzb_CTX //17 -zerotree, neighbouring symbols are not zerotree elements
+ };
+
+ //! Contexts used for MV data coding
+ enum MvCtxAliases
+ {
+
+ YDC_BIN1_CTX, //0 -1st bin of DC value for Y
+ YDC_BIN2plus_CTX, //1 -remaining DC bins
+ YDC_SIGN0_CTX, //2 -sign of Y DC value, previous value 0
+ UDC_BIN1_CTX, //3 --ditto
+ UDC_BIN2plus_CTX, //4 --for
+ UDC_SIGN0_CTX, //5 --U
+ VDC_BIN1_CTX, //6 --and
+ VDC_BIN2plus_CTX, //7 --V
+ VDC_SIGN0_CTX, //8 --components
+
+ REF1x_BIN1_CTX, //9 -bin 1, REF1 x vals
+ REF1x_BIN2_CTX, //10 -bin 2, REF1 x vals
+ REF1x_BIN3_CTX, //11 -bin 3, REF1 x vals
+ REF1x_BIN4_CTX, //12 -bin 4, REF1 x vals
+ REF1x_BIN5plus_CTX, //13 -bin 5, REF1 x vals
+ REF1x_SIGN0_CTX, //14 -sign, REF1 x vals, previous value 0
+ REF1x_SIGNP_CTX, //15 -sign, REF1 x vals, previous value +ve
+ REF1x_SIGNN_CTX, //16 -sign, REF1 x vals, previous value -ve
+
+ REF1y_BIN1_CTX, //17 -bin 1, REF1 y vals
+ REF1y_BIN2_CTX, //18 -bin 2, REF1 y vals
+ REF1y_BIN3_CTX, //19 -bin 3, REF1 y vals
+ REF1y_BIN4_CTX, //20 -bin 4, REF1 y vals
+ REF1y_BIN5plus_CTX, //21 -bin 5, REF1 y vals
+ REF1y_SIGN0_CTX, //22 -sign, REF1 y vals, previous value 0
+ REF1y_SIGNP_CTX, //23 -sign, REF1 y vals, previous value +ve
+ REF1y_SIGNN_CTX, //24 -sign, REF1 y vals, previous value -ve
+
+ REF2x_BIN1_CTX, //25 -bin 1, REF2 x vals
+ REF2x_BIN2_CTX, //26 -bin 2, REF2 x vals
+ REF2x_BIN3_CTX, //27 -bin 3, REF2 x vals
+ REF2x_BIN4_CTX, //28 -bin 4, REF2 x vals
+ REF2x_BIN5plus_CTX, //29 -bin 5, REF2 x vals
+ REF2x_SIGN0_CTX, //30 -sign, REF2 x vals, previous value 0
+ REF2x_SIGNP_CTX, //31 -sign, REF1 y vals, previous value +ve
+ REF2x_SIGNN_CTX, //32 -sign, REF1 y vals, previous value -ve
+
+ REF2y_BIN1_CTX, //33 -bin 1, REF2 y vals
+ REF2y_BIN2_CTX, //34 -bin 2, REF2 y vals
+ REF2y_BIN3_CTX, //35 -bin 3, REF2 y vals
+ REF2y_BIN4_CTX, //36 -bin 4, REF2 y vals
+ REF2y_BIN5plus_CTX, //37 -bin 5, REF2 y vals
+ REF2y_SIGN0_CTX, //38 -sign, REF2 y vals, previous value 0
+ REF2y_SIGNP_CTX, //39 -sign, REF2 y vals, previous value +ve
+ REF2y_SIGNN_CTX, //40 -sign, REF2 y vals, previous value -ve
+
+ PMODE_BIN1_CTX, //41 -bin 1, prediction mode value
+ PMODE_BIN2_CTX, //42 -bin 2, prediction mode value
+ PMODE_BIN3_CTX, //43 -bin 3, prediction mode value. Bin 4 not required
+
+ MB_CMODE_CTX, //44 -context for MB common block mode
+ MB_SPLIT_BIN1_CTX, //45 -bin1, MB split mode vals
+ MB_SPLIT_BIN2_CTX //46 -bin2, MB split mode vals. Bin 3 not required
+
+ };
+
+
+ //Classes used throughout the codec//
+ /////////////////////////////////////
+
+
+ //! A class for picture component data.
+ /*!
+ A class for encapsulating picture data, derived from TwoDArray. NB:
+ in the future there will be separate classes for input/output picture
+ data, difference picture data, and wavelet coefficient data. Currently
+ PicArray is used for all of these. TJD 13 April 2004.
+ */
+ class PicArray: public TwoDArray<ValueType>
+ {
+ public:
+ //! Default constructor
+ /*!
+ Default constructor creates an empty array.
+ */
+ PicArray(): TwoDArray<ValueType>(){}
+
+ //! Constructor.
+ /*!
+ Contructor creates a two-D array, with specified size and colour
+ format.
+ */
+ PicArray(int height, int width, CompSort cs=Y_COMP);
+
+ //copy constructor and assignment= derived by inheritance
+
+ //! Destructor
+ ~PicArray(){}
+
+ //! Return which component is stored
+ const CompSort& CSort() const;
+
+ //! Set the type of component being stored
+ void SetCSort(const CompSort cs);
+
+ private:
+
+ CompSort m_csort;
+ };
+
+
+ //! A structure for recording costs, particularly in quantisation.
+ class CostType
+ {
+ public:
+ //! The Mean Square Error
+ double MSE;
+
+ //! The entropy in bits per symbol.
+ double ENTROPY;
+
+ //! The Lagrangian combination of MSE+lambda*entropy
+ double TOTAL;
+ };
+
+
+ //! A class used for correcting estimates of entropy.
+ /*!
+ A class used by the encoder for correcting estimates of entropy. Used
+ for selecting quantisers in subband coefficient coding. Factors can be
+ adjusted in the light of previous experience.
+ */
+ class EntropyCorrector
+ {
+ public:
+ //! Constructor.
+ /*!
+ Constructs arrays of correction factors of size.
+ \param depth the depth of the wavelet transform.
+ */
+ EntropyCorrector(int depth);
+
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
+
+ //! Returns the correction factor.
+ /*!
+ Returns the correction factor for the band given also the type of
+ frame and component.
+ */
+ float Factor(const int bandnum, const FrameSort fsort,const CompSort c) const;
+
+ //! Update the correction factors.
+ /*!
+ Update the factors for a given subband, component and frame type.
+ \param bandnum the number of the subband to update
+ \param fsort frame type
+ \param c component type
+ \param est_bits the number of bits it was estimated would be used
+ \param actual_bits the number of bits that actually were used
+ */
+ void Update(int bandnum, FrameSort fsort, CompSort c,int est_bits,int actual_bits);
+
+ private:
+ //! Initialises the correction factors
+ void Init();
+
+ TwoDArray<float> m_Yfctrs;
+ TwoDArray<float> m_Ufctrs;
+ TwoDArray<float> m_Vfctrs;
+ };
+
+ //! Parameters for overlapped block motion compensation
+ class OLBParams
+ {
+
+ public:
+
+ //! Default constructor does nothing
+ OLBParams(){}
+
+ //! Constructor
+ /*
+ Constructor rationalises proposed parameters to allow suitable
+ overlap and fit in with
+ chroma format
+ \param xblen the horizontal block length
+ \param yblen the vertical block length
+ \param xblen the horizontal block separation
+ \param yblen the vertical block separation
+
+ */
+ OLBParams(const int xblen, int const yblen, int const xbsep, int const ybsep);
+
+ // Gets ...
+
+ //! Returns the horizontal block length
+ int Xblen() const {return m_xblen;}
+
+ //! Returns the vertical block length
+ int Yblen() const {return m_yblen;}
+
+ //! Returns the horizontal block separation
+ int Xbsep() const {return m_xbsep;}
+
+ //! Returns the vertical block separation
+ int Ybsep() const {return m_ybsep;}
+
+ //! The offset in the horizontal start of the block caused by overlap,=(XBLEN-XBSEP)/2
+ int Xoffset() const {return m_xoffset;}
+
+ //! The offset in the vertical start of the block caused by overlap,=(YBLEN-YBSEP)/2
+ int Yoffset() const {return m_yoffset;}
+
+ // ... and sets
+
+ //! Sets the block width
+ void SetXblen( int xblen ){ m_xblen = xblen; m_xoffset = (m_xblen-m_xbsep)/2;}
+
+ //! Sets the block height
+ void SetYblen( int yblen ){ m_yblen = yblen; m_yoffset = (m_yblen-m_ybsep)/2;}
+
+ //! Sets the block horizontal separation
+ void SetXbsep( int xbsep ){ m_xbsep = xbsep; m_xoffset = (m_xblen-m_xbsep)/2;}
+
+ //! Sets the block vertical separation
+ void SetYbsep( int ybsep ){ m_ybsep = ybsep; m_yoffset = (m_yblen-m_ybsep)/2;}
+
+ // overloaded stream operators
+ friend std::ostream & operator<< (std::ostream &, OLBParams &);
+ friend std::istream & operator>> (std::istream &, OLBParams &);
+
+
+ private:
+
+ int m_xblen;
+ int m_yblen;
+ int m_xbsep;
+ int m_ybsep;
+ int m_xoffset;
+ int m_yoffset;
+ };
+
+ //! Parameters relating to the video sequence being encoded/decoded
+ class SeqParams
+ {
+ public:
+ //! Default Constructor
+ SeqParams();
+
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
+
+ //gets ...
+ //! Returns the picture width
+ int Xl() const {return m_xl;}
+
+ //! Returns the picture height
+ int Yl() const {return m_yl;}
+
+ //! Returns the chroma format of the sequence (Y only, 420, 422 etc)
+ ChromaFormat CFormat() const {return m_cformat;}
+
+ //! Returns the chroma width
+ int ChromaWidth() const;
+
+ //! Returns the chroma height
+ int ChromaHeight() const;
+
+ //! Returns true if the sequence is interlaced
+ bool Interlace() const {return m_interlace;}
+
+ //! Returns true if the top field comes first in time
+ bool TopFieldFirst() const {return m_topfieldfirst;}
+
+ //! Returns the number of frames to be displayed per second
+ int FrameRate() const {return m_framerate;}
+
+ //! Returns the bitstream version
+ int BitstreamVersion() const {return m_bs_ver;}
+
+ // ... Sets
+
+ //! Sets the picture width
+ void SetXl(int xlen) {m_xl = xlen;}
+
+ //! Sets the picture height
+ void SetYl(int ylen) {m_yl = ylen;}
+
+ //! Sets the chroma format (Y only, 420, 422 etc)
+ void SetCFormat(ChromaFormat cf) {m_cformat=cf;}
+
+ //! Sets the interlace flag: true if the sequence is interlaced, false otherwise
+ void SetInterlace(bool ilace) {m_interlace=ilace;}
+
+ //! Sets the 'top field first' flag: true if the top field comes first in time
+ void SetTopFieldFirst(bool tff) {m_topfieldfirst=tff;}
+
+ //! Sets the number of frames to be displayed per second
+ void SetFrameRate(int fr){m_framerate=fr;}
+
+ //! Sets the bitstream version
+ void SetBitstreamVersion(int bs_ver){m_bs_ver=bs_ver;}
+
+ private:
+ //! Width of video
+ int m_xl;
+
+ //! Height of video
+ int m_yl;
+
+ //! Presence of chroma and/or chroma sampling structure
+ ChromaFormat m_cformat;
+
+ //! True if interlaced
+ bool m_interlace;
+
+ //! If interlaced, true if the top field is first in temporal order
+ bool m_topfieldfirst;
+
+ //! Frame rate, per second
+ int m_framerate;
+
+ //! Bitsream version.
+ unsigned char m_bs_ver;
+ };
+
+ //! Parameters for initialising frame class objects
+ class FrameParams
+ {
+
+ public:
+ //! Default constructor
+ FrameParams();
+
+ //! Constructor
+ /*!
+ Frame chroma format is set Frame sort defaults to I frame.
+ */
+ FrameParams(const ChromaFormat& cf, int xlen, int ylen);
+
+ //! Constructor
+ /*!
+ Frame chroma format and frame sort are set.
+ */
+ FrameParams(const ChromaFormat& cf, const FrameSort& fs);
+
+ //! Constructor
+ /*
+ All data is derived from the sequence parameters
+ */
+ FrameParams(const SeqParams& sparams);
+
+ //! Constructor
+ /*
+ All data is derived from the sequence parameters
+ */
+ FrameParams(const SeqParams& sparams, const FrameSort& fs);
+
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
+
+ // Gets ...
+
+ //! Returns the chroma format of the frame
+ const ChromaFormat& CFormat() const{return m_cformat;}
+
+ //! Returns the width of the frame
+ int Xl() const{return m_xl;}
+
+ //! Returns the height of the frame
+ int Yl() const{return m_yl;}
+
+ //! Returns the type of the frame (I, L1 or L2)
+ const FrameSort& FSort() const {return m_fsort;}
+
+ //! Returns the number of the frame (in time order)
+ int FrameNum() const {return m_fnum;}
+
+ //! Returns the number of frames after the current frame number after which the frame can be discarded
+ int ExpiryTime() const {return m_expiry_time;}
+
+ //! Returns an indication of whether the frame has been output yet
+ bool Output() const {return m_output;}
+
+ //! Returns a const C++ reference to the set of reference frame numbers (will be empty if the frame is an I frame)
+ const std::vector<int>& Refs() const {return m_refs;}
+
+ //! Returns non-const C++ referece to the vector of reference frames, to allow them to be set
+ std::vector<int>& Refs(){return m_refs;}
+
+
+ // ... Sets
+
+ //! Sets the type of frame to I, L1 or L2
+ void SetFSort( const FrameSort& fs ){ m_fsort=fs; }
+
+ //! Sets the frame number
+ void SetFrameNum( const int fn ){ m_fnum=fn; }
+
+ //! Sets how long the frame will stay in the buffer
+ void SetExpiryTime( const int expt ){ m_expiry_time=expt; }
+
+ //! Sets a flag to indicate that the frame has been output
+ void SetAsOutput(){m_output=true;}
+
+ private:
+
+ //! The chroma format
+ ChromaFormat m_cformat;
+
+ //! Frame width
+ int m_xl;
+
+ //! Frame height
+ int m_yl;
+
+ //! The frame sort
+ FrameSort m_fsort;
+
+ //! The set of frame numbers of reference frames
+ std::vector<int> m_refs;
+
+ //! The number of frames, after the current frame number, after the (de)coding of which the frame can be deleted
+ int m_expiry_time;
+
+ //! True if the frame has been output, false if not
+ bool m_output;
+
+ //! The frame number, in temporal order
+ int m_fnum;
+ };
+
+
+ //! Parameters common to coder and decoder operation
+ /*!
+ Parameters used throughout both the encoder and the decoder
+ */
+ class CodecParams
+ {
+ public:
+
+ //! Default constructor
+ CodecParams();
+
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
+
+ // Gets ...
+
+ //! Return the number of macroblocks horizontally
+ int XNumMB() const {return m_x_num_mb;}
+
+ //! Return the number of macroblocks vertically
+ int YNumMB() const {return m_y_num_mb;}
+
+ //! Return the number of blocks horizontally
+ int XNumBlocks() const {return m_x_num_blocks;}
+
+ //! Returns the number of blocks vertically
+ int YNumBlocks() const {return m_y_num_blocks;}
+
+ //! Returns true if we're operating verbosely, false otherwise
+ bool Verbose() const {return m_verbose;}
+
+ //! Returns true if we're operatung using interlace tools [not currently defined]
+ bool Interlace() const {return m_interlace;}
+
+ //! Returns true if the topmost field comes first in time [NB: TBD since this duplicates metadata in the sequence header]
+ bool TopFieldFirst() const {return m_topfieldfirst;}
+
+ //! Return the Luma block parameters for each macroblock splitting level
+ const OLBParams& LumaBParams(int n) const {return m_lbparams[n];}
+
+ //! Return the Chroma block parameters for each macroblock splitting level
+ const OLBParams& ChromaBParams(int n) const {return m_cbparams[n];}
+
+ //! Return the original frame width
+ int OrigXl() const {return m_orig_xl;}
+
+ //! Return the original frame height
+ int OrigYl() const {return m_orig_yl;}
+
+ // ... and Sets
+ //! Set how many MBs there are horizontally
+ void SetXNumMB(const int xn){m_x_num_mb=xn;}
+
+ //! Set how many MBs there are vertically
+ void SetYNumMB(const int yn){m_y_num_mb=yn;}
+
+ //! Set how many blocks there are horizontally
+ void SetXNumBlocks(const int xn){m_x_num_blocks=xn;}
+
+ //! Set how many blocks there are vertically
+ void SetYNumBlocks(const int yn){m_y_num_blocks=yn;}
+
+ //! Sets verbosity on or off
+ void SetVerbose(bool v){m_verbose=v;}
+
+ //! Sets whether interlace tools are to be used
+ void SetInterlace(bool intlc){m_interlace=intlc;}
+
+ //! Sets whether the topmost field comes first in time [NB: TBD since this duplicates metadata in the sequence header]
+ void SetTopFieldFirst(bool topf){m_topfieldfirst=topf;}
+
+ //! Set the block sizes for all MB splitting levels given these prototype block sizes for level=2
+ void SetBlockSizes(const OLBParams& olbparams , const ChromaFormat cformat);
+
+ //! Set the original frame width
+ void SetOrigXl(const int x){m_orig_xl=x;}
+
+ //! Set the original frame height
+ void SetOrigYl(const int y){m_orig_yl=y;}
+
+ private:
+
+ //! The number of macroblocks horizontally
+ int m_x_num_mb;
+
+ //! The number of macroblocks verticaly
+ int m_y_num_mb;
+
+ //! The number of blocks horizontally
+ int m_x_num_blocks;
+
+ //! The number of blocks vertically
+ int m_y_num_blocks;
+
+ //! Code/decode with commentary if true
+ bool m_verbose;
+
+ //! True if input is interlaced, false otherwise
+ bool m_interlace;
+
+ //! True if interlaced and top field is first in temporal order
+ bool m_topfieldfirst;
+
+ OneDArray<OLBParams> m_lbparams;
+ OneDArray<OLBParams> m_cbparams;
+
+ //! The original frame width
+ int m_orig_xl;
+
+ //! The original frame height
+ int m_orig_yl;
+ };
+
+ //! Parameters for the encoding process
+ /*!
+ Parameters for the encoding process, derived from CodecParams.
+ */
+ class EncoderParams: public CodecParams
+ {
+ //codec params plus parameters relating solely to the operation of the encoder
+
+ public:
+ //! Default constructor
+ EncoderParams();
+
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ //This means pointers are copied, not the objects they point to.////
+ ////////////////////////////////////////////////////////////////////
+
+ // Gets ...
+
+ //! Get the quality factor
+ float Qf() const {return m_qf;}
+
+ //! Return the nominal number of L1 frames before the next I frame
+ /*!
+ Return the nominal number of L1 frames before the next I frame. Can be
+ overridden by I-frame insertion
+
+ */
+ int NumL1() const {return m_num_L1;}
+
+ //! Return the separation between L1 frames (and between L1 and I frames)
+ int L1Sep() const {return m_L1_sep;}
+
+ //! Return the amount we're weighting noise in the U component
+ float UFactor() const {return m_ufactor;}
+
+ //! Return the amount we're weighting noise in the V component
+ float VFactor() const {return m_vfactor;}
+
+ //! Return the number of cycles per degree at the nominal viewing distance for the raster
+ float CPD() const {return m_cpd;}
+
+ //! Return the Lagrangian parameter to be used for I frames
+ float ILambda() const {return m_I_lambda;}
+
+ //! Return the Lagrangian parameter to be used for L1 frames
+ float L1Lambda() const {return m_L1_lambda;}
+
+ //! Return the Lagrangian parameter to be used for L2 frames
+ float L2Lambda() const {return m_L2_lambda;}
+
+ //! Return the Lagrangian parameter to be used for frames
+ float Lambda(const FrameSort& fsort) const;
+
+ //! Return the Lagrangian ME parameter to be used for L1 frames
+ float L1MELambda() const {return m_L1_me_lambda;}
+
+ //! Return the Lagrangian ME parameter to be used for L2 frames
+ float L2MELambda() const {return m_L2_me_lambda;}
+
+ //! Return the output path to be used for storing diagnositic data
+ char * OutputPath() const {return ( char* ) m_output_path.c_str();}
+
+ //! Return a reference to the entropy factors
+ const EntropyCorrector& EntropyFactors() const {return *m_ent_correct;}
+
+ //! Return a reference to the entropy factors - we need to be able to change the values of the entropy factors in situ
+ EntropyCorrector& EntropyFactors() {return *m_ent_correct;}
+
+ //!Return a reference to the bit output class
+ const SequenceOutputManager& BitsOut() const {return *m_bit_out;}
+
+ //!Return a reference to the bit output class - we need to output, so non-const
+ SequenceOutputManager& BitsOut() {return *m_bit_out;}
+
+ // ... and Sets
+
+ //! Set the quality factor
+ void SetQf(const float qfac){m_qf=qfac;}
+
+ //! Set the nominal number of L1 frames between I frames
+ void SetNumL1(const int nl){m_num_L1=nl;}
+
+ //! Set the separation between L1 frames
+ void SetL1Sep(const int lsep){m_L1_sep=lsep;}
+
+ //! Set the amount to weight noise in the U component
+ void SetUFactor(const float uf){m_ufactor=uf;}
+
+ //! Set the amount to weight noise in the V component
+ void SetVFactor(const float vf){m_vfactor=vf;}
+
+ //! Set the number of cycles per degree at the nominal viewing distance
+ void SetCPD(const float cpd){m_cpd=cpd;}
+
+ //! Set the Lagrangian parameter to be used for I frames
+ void SetILambda(const float l){m_I_lambda=l;}
+
+ //! Set the Lagrangian parameter to be used for L1 frames
+ void SetL1Lambda(const float l){m_L1_lambda=l;}
+
+ //! Set the Lagrangian parameter to be used for L2 frames
+ void SetL2Lambda(const float l){m_L2_lambda=l;}
+
+ //! Set the Lagrangian parameters to be used for frames
+ void SetLambda(const FrameSort& fsort, const float l);
+
+ //! Set the Lagrangian parameter to be used for L1 motion estimation
+ void SetL1MELambda(const float l){m_L1_me_lambda=l;}
+
+ //! Set the Lagrangian parameter to be used for L2 motion estimation
+ void SetL2MELambda(const float l){m_L2_me_lambda=l;}
+
+ //! Set the output path to be used for diagnostic data
+ void SetOutputPath(const char * op){ m_output_path = op; }
+
+ //! Sets the entropy factors - TBD: set this up in a constructor and pass encoder params around entirely by reference
+ void SetEntropyFactors(EntropyCorrector* entcorrect){m_ent_correct=entcorrect;}
+
+ //! Sets the bit output - TBD: set this up in a constructor and pass encoder params around entirely by reference
+ void SetBitsOut( SequenceOutputManager* so ){ m_bit_out=so; }
+
+ private:
+ //! Quality factor (between 0 and 10)
+ float m_qf;
+
+ //! Number of L1 frames before next I frame
+ int m_num_L1;
+
+ //! Separation between L1 frames
+ int m_L1_sep;
+
+ //! factor for weighting U component quantisation errors
+ float m_ufactor;
+
+ //! factor for weighting V component quantisation errors
+ float m_vfactor;
+
+ //! Cycles per degree assumed for viewing the video
+ float m_cpd;
+
+ //! Lagrangian parameter for Intra frame coding
+ float m_I_lambda;
+
+ //! Lagrangian parameter for L1 frame coding
+ float m_L1_lambda;
+
+ //! Lagrangian parameter for L2 frame coding
+ float m_L2_lambda;
+
+ //! Lagrangian param for L1 motion estimation
+ float m_L1_me_lambda;
+
+ //! Lagrangian param for L2 motion estimation
+ float m_L2_me_lambda;
+
+ //! Correction factors for quantiser selection
+ EntropyCorrector* m_ent_correct;
+
+ //! Pointer to object for managing bitstream output
+ SequenceOutputManager* m_bit_out;
+
+ //! Output file path
+ std::string m_output_path;
+ };
+
+ //! Parameters for the decoding process
+ /*!
+ Parameters for the decoding process. Derived from CodecParams.
+ */
+ class DecoderParams: public CodecParams
+ {
+ public:
+ //! Default constructor
+ DecoderParams():
+ CodecParams(),
+ m_bit_in(0){}
+
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ //This means pointers are copied, not the objects they point to.////
+ ////////////////////////////////////////////////////////////////////
+
+ //! Return a reference to the bit output class
+ const BitInputManager& BitsIn() const {return *m_bit_in;}
+
+ //! Return a reference to the bit output class - we need to output, so non-const
+ BitInputManager& BitsIn() {return *m_bit_in;}
+
+ //! Sets the bit input - TBD: set this up in a constructor and pass decoder params around entirely by reference
+ void SetBitsIn(BitInputManager* bi){m_bit_in=bi;}
+
+ private:
+ //! Pointer to the bitstream input manager
+ BitInputManager* m_bit_in;
+ };
+
+ //! A simple bounds checking function, very useful in a number of places
+ inline ValueType BChk(const ValueType &num, const ValueType &max)
+ {
+ if(num < 0) return 0;
+ else if(num >= max) return max-1;
+ else return num;
+ }
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/common_types.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/common_types.h
new file mode 100644
index 000000000..bc042e223
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/common_types.h
@@ -0,0 +1,65 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: common_types.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd,
+* Tim Borer
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _COMMON_TYPES_H_
+#define _COMMON_TYPES_H_
+
+
+/*! This file contains common enumerated types used throughout the encoder and
+ the end user interfaces to the encoder and decoder
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+* Some basic enumeration types used throughout the codec and by end user ...//
+*/
+
+/*! Types of chroma formatting (formatNK=format not known) */
+typedef enum { Yonly, format422, format444, format420, format411, formatNK } ChromaFormat;
+
+
+/*! Types of frame */
+typedef enum { I_frame, L1_frame, L2_frame} FrameSort;
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_assertions.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_assertions.cpp
new file mode 100644
index 000000000..520752284
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_assertions.cpp
@@ -0,0 +1,66 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: dirac_assertions.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <stdlib.h>
+#include <string>
+#include <iostream>
+
+#include "dirac_assertions.h"
+using namespace dirac;
+
+namespace dirac
+{
+void dirac_assert( const char *p_fname, int line_number, const char *p_mess )
+{
+ dirac_report( p_fname, line_number, p_mess );
+ // dump core
+ abort ();
+}
+
+void dirac_report( const char *p_fname, int line_number, const char *p_mess )
+{
+ std::string errMess("Assertion ");
+
+ if ( p_mess )
+ errMess = errMess + "^ " + std::string(p_mess) + " ^" +" failed";
+ else
+ errMess += " failure";
+
+ std::cerr << errMess << " in file " << p_fname << " at line " << line_number << std::endl;
+}
+} // namespace dirac
+
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_assertions.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_assertions.h
new file mode 100644
index 000000000..0f0f0f033
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_assertions.h
@@ -0,0 +1,80 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: dirac_assertions.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+#ifndef DIRAC_ASSERTIONS_H
+#define DIRAC_ASSERTIONS_H
+namespace dirac
+{
+
+#undef cmpCOND
+#define cmpCOND( exp, trueRes, falseRes ) ( (exp) ? (trueRes) : (falseRes) )
+
+#undef ERREXP
+#define ERREXP(exp,errfn,text) cmpCOND((exp), ((void)0), errfn(__FILE__,__LINE__,text))
+
+#undef dirac_ASSERT
+#define dirac_ASSERT(exp) ERREXP(exp,dirac_assert,NULL)
+
+#undef dirac_ASSERTM
+#define dirac_ASSERTM(exp,text) ERREXP(exp,dirac_assert,text)
+
+#undef TEST
+#undef TESTM
+#undef REPORT
+#undef REPORTM
+
+#ifdef DIRAC_DEBUG
+#define TEST(exp) dirac_ASSERT(exp)
+#define TESTM(exp,text) dirac_ASSERTM(exp,text)
+#define REPORT(exp) dirac_ASSERT(exp)
+#define REPORTM(exp,text) dirac_ASSERTM(exp,text)
+#else
+#define TEST(exp)
+#define TESTM(exp,text)
+#define REPORT(exp) ERREXP(exp,dirac_report,NULL)
+#define REPORTM(exp,text) ERREXP(exp,dirac_report,text)
+#endif
+
+
+/*! Print a message to standard error and abort if in debug mode */
+void dirac_assert( const char *p_fname, int line_number, const char *p_mess);
+
+/*! Print a message to standard error */
+void dirac_report( const char *p_fname, int line_number, const char *p_mess);
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_types.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_types.h
new file mode 100644
index 000000000..91c722dad
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/dirac_types.h
@@ -0,0 +1,115 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: dirac_types.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _DIRAC_TYPES_H
+#define _DIRAC_TYPES_H
+
+#include <libdirac_common/common_types.h>
+
+/*! This file contains common enumerated types used throughout
+ the end user interfaces to the encoder and decoder
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(WIN32) && defined(_WINDLL)
+#define DllExport __declspec( dllexport )
+#else
+#define DllExport
+#endif
+
+/*
+* Some basic enumeration types used by end user encoder and decoder ...//
+*/
+typedef ChromaFormat dirac_chroma_t;
+typedef FrameSort dirac_frame_type_t;
+
+typedef struct
+{
+ int numerator;
+ int denominator;
+} dirac_rational_t;
+
+typedef dirac_rational_t dirac_frame_rate_t;
+
+/*! Structure that holds the sequence parameters */
+typedef struct
+{
+ /*! numper of pixels per line */
+ int width;
+ /*! number of lines per frame */
+ int height;
+ /*! chroma type */
+ dirac_chroma_t chroma;
+ /*! numper of pixels of chroma per line */
+ int chroma_width;
+ /*! number of lines of chroma per frame */
+ int chroma_height;
+ /*! frame rate */
+ dirac_frame_rate_t frame_rate;
+ /*! interlace flag: 0 - progressive; 1 - interlaced */
+ int interlace;
+ /*! top field comes first : 0 - false; 1 - true */
+ int topfieldfirst;
+} dirac_seqparams_t;
+
+/*! Structure that holds the frame parameters */
+typedef struct
+{
+ /*! frame type */
+ dirac_frame_type_t ftype;
+ /*! frame number in decoded order */
+ int fnum;
+} dirac_frameparams_t;
+
+
+/*! Structure that holds the frame buffers into which data is written */
+typedef struct
+{
+ /*! buffers to hold the luma and chroma data */
+ unsigned char *buf[3];
+ /*! user data */
+ void *id;
+} dirac_framebuf_t;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame.cpp
new file mode 100644
index 000000000..f1fcd746c
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame.cpp
@@ -0,0 +1,393 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: frame.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+//Implementation of frame classes in frame.h
+
+#include <libdirac_common/frame.h>
+#include <libdirac_common/upconvert.h>
+using namespace dirac;
+
+#include <iostream>
+
+///////////////
+//---Frame---//
+///////////////
+
+Frame::Frame(const FrameParams& fp):
+ m_fparams(fp),
+ m_Y_data(0),
+ m_U_data(0),
+ m_V_data(0),
+ m_upY_data(0),
+ m_upU_data(0),
+ m_upV_data(0)
+{
+ Init();
+}
+
+Frame::Frame( const Frame& cpy ):
+ m_fparams(cpy.m_fparams),
+ m_Y_data(0),
+ m_U_data(0),
+ m_V_data(0),
+ m_upY_data(0),
+ m_upU_data(0),
+ m_upV_data(0)
+{
+ const ChromaFormat& cformat = m_fparams.CFormat();
+
+ //delete data to be overwritten
+ ClearData();
+
+ //now copy the data accross
+ m_Y_data = new PicArray( *(cpy.m_Y_data) );
+ if (cpy.m_upY_data != 0){
+ m_upY_data = new PicArray( *(cpy.m_upY_data) );
+ }
+
+ if (cformat != Yonly)
+ {
+ m_U_data = new PicArray( *(cpy.m_U_data) );
+ m_V_data = new PicArray( *(cpy.m_V_data) );
+
+ if ( cpy.m_upU_data != 0 )
+ {
+ m_upU_data = new PicArray( *(cpy.m_upU_data) );
+ }
+ if ( cpy.m_upV_data != 0 )
+ {
+ m_upV_data = new PicArray( *(cpy.m_upV_data) );
+ }
+
+ }
+
+}
+
+
+Frame::~Frame()
+{
+ ClearData();
+}
+
+Frame& Frame::operator=(const Frame& rhs)
+{
+ if ( &rhs != this)
+ {
+ m_fparams=rhs.m_fparams;
+ const ChromaFormat& cformat=m_fparams.CFormat();
+
+ // Delete current data
+ ClearData();
+
+ // Copy the data across
+ m_Y_data= new PicArray( *(rhs.m_Y_data) );
+
+ if ( rhs.m_upY_data != 0)
+ m_upY_data = new PicArray( *(rhs.m_upY_data) );
+
+ if (cformat != Yonly)
+ {
+ m_U_data= new PicArray( *(rhs.m_U_data) );
+ if (rhs.m_upU_data!=0)
+ m_upU_data = new PicArray(*(rhs.m_upU_data) );
+
+ m_V_data= new PicArray( *(rhs.m_V_data) );
+ if (rhs.m_upV_data!=0)
+ m_upV_data= new PicArray( *(rhs.m_upV_data) );
+ }
+ }
+
+ return *this;
+
+}
+
+//Other functions
+
+void Frame::Init()
+{
+ const ChromaFormat cformat=m_fparams.CFormat();
+
+ //first delete data if we need to
+ ClearData();
+
+ m_Y_data=new PicArray( m_fparams.Yl() , m_fparams.Xl());
+ m_Y_data->SetCSort( Y_COMP );
+
+ if(cformat == format422)
+ {
+ m_U_data = new PicArray( m_fparams.Yl() , m_fparams.Xl()/2 );
+ m_U_data->SetCSort( U_COMP );
+
+ m_V_data = new PicArray( m_fparams.Yl() , m_fparams.Xl()/2 );
+ m_V_data->SetCSort( V_COMP );
+ }
+ else if (cformat == format420)
+ {
+ m_U_data = new PicArray( m_fparams.Yl()/2 , m_fparams.Xl()/2 );
+ m_U_data->SetCSort( U_COMP );
+
+ m_V_data = new PicArray( m_fparams.Yl()/2 , m_fparams.Xl()/2 );
+ m_V_data->SetCSort(V_COMP);
+ }
+ else if (cformat == format411)
+ {
+ m_U_data = new PicArray( m_fparams.Yl() , m_fparams.Xl()/4 );
+ m_U_data->SetCSort( U_COMP );
+
+ m_V_data = new PicArray( m_fparams.Yl() , m_fparams.Xl()/4 );
+ m_V_data->SetCSort( V_COMP );
+ }
+ else if (cformat==format444){
+ m_U_data = new PicArray( m_fparams.Yl() , m_fparams.Xl() );
+ m_U_data->SetCSort( U_COMP );
+
+ m_V_data = new PicArray( m_fparams.Yl() , m_fparams.Xl() );
+ m_V_data->SetCSort( V_COMP );
+ }
+ //(other formats all assumed to be Yonly
+}
+
+PicArray& Frame::Data(CompSort cs)
+{//another way to access the data
+
+ if (cs == U_COMP) return *m_U_data;
+ else if (cs == V_COMP) return *m_V_data;
+ else return *m_Y_data;
+}
+
+const PicArray& Frame::Data(CompSort cs) const
+{//another way to access the data
+
+ if (cs == U_COMP) return *m_U_data;
+ else if (cs == V_COMP) return *m_V_data;
+ else return *m_Y_data;
+}
+
+PicArray& Frame::UpYdata()
+{
+ if (m_upY_data != 0)
+ return *m_upY_data;
+ else
+ {//we have to do the upconversion
+
+ m_upY_data = new PicArray( 2*m_Y_data->LengthY() , 2*m_Y_data->LengthX() );
+ UpConverter myupconv;
+ myupconv.DoUpConverter( *m_Y_data , *m_upY_data );
+
+ return *m_upY_data;
+
+ }
+}
+
+PicArray& Frame::UpUdata()
+{
+ if (m_upU_data != 0)
+ return *m_upU_data;
+ else
+ {//we have to do the upconversion
+
+ m_upU_data = new PicArray(2*m_U_data->LengthY() , 2*m_U_data->LengthX());
+ UpConverter myupconv;
+ myupconv.DoUpConverter( *m_U_data , *m_upU_data );
+
+ return *m_upU_data;
+
+ }
+}
+
+PicArray& Frame::UpVdata()
+{
+ if (m_upV_data != 0)
+ return *m_upV_data;
+ else
+ {//we have to do the upconversion
+
+ m_upV_data = new PicArray( 2*m_V_data->LengthY() , 2*m_V_data->LengthX() );
+ UpConverter myupconv;
+ myupconv.DoUpConverter( *m_V_data , *m_upV_data );
+
+ return *m_upV_data;
+
+ }
+}
+
+PicArray& Frame::UpData(CompSort cs)
+{
+ if (cs == U_COMP)
+ return UpUdata();
+ else if (cs == V_COMP)
+ return UpVdata();
+ else
+ return UpYdata();
+}
+
+const PicArray& Frame::UpYdata() const
+{
+ if (m_upY_data != 0)
+ return *m_upY_data;
+ else
+ {
+ //We have to do the upconversion
+ //Although we're changing a value - the pointer to the array - it doesn't affect the state of
+ //the object as viewable from outside. So the pointers to the upconveted data have been
+ //declared mutable.
+
+ m_upY_data = new PicArray( 2*m_Y_data->LengthY() , 2*m_Y_data->LengthX() );
+
+ UpConverter myupconv;
+ myupconv.DoUpConverter( *m_Y_data , *m_upY_data );
+
+ return *m_upY_data;
+
+ }
+}
+
+const PicArray& Frame::UpUdata() const
+{
+ if (m_upU_data != 0)
+ return *m_upU_data;
+ else
+ {
+ //We have to do the upconversion
+ //Although we're changing a value - the pointer to the array - it doesn't affect the state of
+ //the object as viewable from outside. So the pointers to the upconveted data have been
+ //declared mutable.
+
+ m_upU_data = new PicArray( 2*m_U_data->LengthY() , 2*m_U_data->LengthX() );
+
+ UpConverter myupconv;
+ myupconv.DoUpConverter( *m_U_data , *m_upU_data );
+
+ return *m_upU_data;
+
+ }
+}
+
+const PicArray& Frame::UpVdata() const
+{
+ if (m_upV_data != 0)
+ return *m_upV_data;
+ else
+ {
+ //We have to do the upconversion
+ //Although we're changing a value - the pointer to the array - it doesn't affect the state of
+ //the object as viewable from outside. So the pointers to the upconveted data have been
+ //declared mutable.
+
+ m_upV_data = new PicArray( 2*m_V_data->LengthY() , 2*m_V_data->LengthX() );
+
+ UpConverter myupconv;
+ myupconv.DoUpConverter( *m_V_data , *m_upV_data );
+
+ return *m_upV_data;
+
+ }
+}
+
+const PicArray& Frame::UpData(CompSort cs) const
+{
+ if (cs == U_COMP)
+ return UpUdata();
+ else if (cs == V_COMP)
+ return UpVdata();
+ else
+ return UpYdata();
+}
+
+void Frame::ClipComponent(PicArray& pic_data)
+{
+ for (int j=pic_data.FirstY() ; j<=pic_data.LastY() ; ++j)
+ {
+ for (int i=pic_data.FirstX() ; i<=pic_data.LastX() ; ++i)
+ {
+ pic_data[j][i] = std::min( pic_data[j][i] , ValueType( 1020 ) );
+ pic_data[j][i] = std::max( pic_data[j][i] , ValueType( 0 ) );
+ }// i
+ }// j
+}
+
+void Frame::Clip()
+{
+ //just clips the straight picture data, not the upconverted data
+
+ ClipComponent( *m_Y_data );
+
+ if (m_fparams.CFormat() != Yonly)
+ {
+ ClipComponent( *m_U_data );
+ ClipComponent( *m_V_data );
+ }
+}
+
+void Frame::ClearData()
+{
+ if (m_Y_data != 0)
+ {
+ delete m_Y_data;
+ m_Y_data = 0;
+ }
+
+ if (m_U_data!=0)
+ {
+ delete m_U_data;
+ m_U_data = 0;
+ }
+
+ if (m_V_data!=0)
+ {
+ delete m_V_data;
+ m_V_data = 0;
+ }
+
+ if (m_upY_data != 0)
+ {
+ delete m_upY_data;
+ m_upY_data = 0;
+ }
+
+ if (m_upU_data!=0)
+ {
+ delete m_upU_data;
+ m_upU_data = 0;
+ }
+
+ if (m_upV_data != 0)
+ {
+ delete m_upV_data;
+ m_upV_data = 0;
+ }
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame.h
new file mode 100644
index 000000000..066468b30
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame.h
@@ -0,0 +1,153 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: frame.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _FRAME_H_
+#define _FRAME_H_
+
+#include <libdirac_common/common.h>
+
+namespace dirac
+{
+ //! A class for encapsulating all the data relating to a frame.
+ /*!
+ A class for encapsulating all the data relating to a frame - all the
+ component data, including upconverted data.
+ */
+ class Frame
+ {
+
+ public:
+
+ //! Constructor
+ /*!
+ Constructor initialises the frame parameters and the data
+ */
+ Frame( const FrameParams& fp );
+
+ //! Copy constructor. Private as not currently used [may want to implement reference counting later.]
+ Frame(const Frame& cpy);
+
+ //! Destructor
+ virtual ~Frame();
+
+ //! Assignment =. Private as not currently used [may want to implement reference counting later.]
+ Frame& operator=( const Frame& rhs );
+
+ //gets and sets
+ //! Gets the frame parameters
+ const FrameParams& GetFparams() const {return m_fparams;}
+
+ //! Sets the frame sort
+ void SetFrameSort( const FrameSort fs ){m_fparams.SetFSort( fs ); }
+
+ //! Returns the luma data array
+ PicArray& Ydata() {return *m_Y_data;}
+
+ //! Returns the U component
+ PicArray& Udata() {return *m_U_data;}
+
+ //! Returns the V component
+ PicArray& Vdata() {return *m_V_data;}
+
+ //! Returns the luma data array
+ const PicArray& Ydata() const {return *m_Y_data;}
+
+ //! Returns the U component
+ const PicArray& Udata() const {return *m_U_data;}
+
+ //! Returns the V component
+ const PicArray& Vdata() const {return *m_V_data;}
+
+ //! Returns a given component
+ PicArray& Data(CompSort cs);
+
+ //! Returns a given component
+ const PicArray& Data(CompSort cs) const;
+
+ //! Returns upconverted Y data
+ PicArray& UpYdata();
+
+ //! Returns upconverted U data
+ PicArray& UpUdata();
+
+ //! Returns upconverted V data
+ PicArray& UpVdata();
+
+ //! Returns a given upconverted component
+ PicArray& UpData(CompSort cs);
+
+ //! Returns upconverted Y data
+ const PicArray& UpYdata() const;
+
+ //! Returns upconverted U data
+ const PicArray& UpUdata() const;
+
+ //! Returns upconverted V data
+ const PicArray& UpVdata() const;
+
+ //! Returns a given upconverted component
+ const PicArray& UpData(CompSort cs) const;
+
+ //! Clip the data to prevent overshoot
+ /*!
+ Clips the data to lie between 0 and 1020 (4*255) in 10-bit form to prevent overshoot/wraparound.
+ */
+ void Clip();
+
+ private:
+ FrameParams m_fparams;
+ PicArray* m_Y_data;//the
+ PicArray* m_U_data;//component
+ PicArray* m_V_data;//data
+ mutable PicArray* m_upY_data;//upconverted data. Mutable because we
+ mutable PicArray* m_upU_data;//create them on the fly even in const
+ mutable PicArray* m_upV_data;//functions.
+
+ //! Initialises the frame once the frame parameters have been set
+ void Init();
+
+ //! Delete all the data
+ void ClearData();
+
+ //! Clip an individual component
+ void ClipComponent(PicArray& pic_data);
+ };
+
+} // namespace dirac
+
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame_buffer.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame_buffer.cpp
new file mode 100644
index 000000000..b2d55f0fe
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame_buffer.cpp
@@ -0,0 +1,391 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: frame_buffer.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_common/frame_buffer.h>
+#include <algorithm>
+using namespace dirac;
+
+//Simple constructor for general operation
+FrameBuffer::FrameBuffer(ChromaFormat cf,int xlen,int ylen):
+ m_fparams(cf,xlen,ylen),
+ m_num_L1(0),
+ m_L1_sep(1),
+ m_gop_len(0)
+{}
+
+//Constructor for coding with an initial I-frame only
+FrameBuffer::FrameBuffer(ChromaFormat cf,int L1sep, int xlen, int ylen):
+ m_fparams(cf,xlen,ylen),
+ m_num_L1(0),
+ m_L1_sep(L1sep),
+ m_gop_len(0)
+{}
+
+//Constructor setting GOP parameters for use with a standard GOP
+FrameBuffer::FrameBuffer(ChromaFormat cf,int numL1,int L1sep,int xlen,int ylen):
+ m_fparams(cf,xlen,ylen),
+ m_num_L1(numL1),
+ m_L1_sep(L1sep)
+{
+ if (m_num_L1>0)
+ {// conventional GOP coding
+ m_gop_len = (m_num_L1+1)*m_L1_sep;
+ }
+ else if (m_num_L1==0)
+ {// I-frame only coding
+ m_gop_len = 1;
+ m_L1_sep = 0;
+ }
+ else
+ {// don't have a proper GOP, only an initial I-frame
+ m_gop_len = 0;
+ }
+}
+
+//Copy constructor. Why anyone would need this I don't know.
+FrameBuffer::FrameBuffer(const FrameBuffer& cpy)
+ {
+ // first delete all frames in the current buffer
+ for (size_t i=0 ; i<m_frame_data.size() ; ++i)
+ {
+ delete m_frame_data[i];
+ }//i
+
+ // next create new arrays, copying from the initialising buffer
+ m_frame_data.resize(cpy.m_frame_data.size());
+ for (size_t i=0 ; i<m_frame_data.size() ; ++i){
+ m_frame_data[i] = new Frame( *(cpy.m_frame_data[i]) );
+ }//i
+
+ // now copy the map
+ m_fnum_map = cpy.m_fnum_map;
+
+ // and the internal frame parameters
+ m_fparams = cpy.m_fparams;
+}
+
+//Assignment=. Not sure why this would be used either.
+FrameBuffer& FrameBuffer::operator=(const FrameBuffer& rhs){
+ if (&rhs!=this)
+ {
+ // delete all the frames in the lhs buffer
+ for (size_t i=0 ; i<m_frame_data.size() ; ++i)
+ {
+ delete m_frame_data[i];
+ }//i
+
+ // next create new arrays, copying from the rhs
+ m_frame_data.resize(rhs.m_frame_data.size());
+ for (size_t i=0 ; i<m_frame_data.size() ; ++i)
+ {
+ m_frame_data[i] = new Frame( *(rhs.m_frame_data[i]) );
+ }//i
+
+ // now copy the map
+ m_fnum_map = rhs.m_fnum_map;
+
+ // and the internal frame parameters
+ m_fparams = rhs.m_fparams;
+ }
+ return *this;
+}
+
+//Destructor
+FrameBuffer::~FrameBuffer()
+{
+ for (size_t i=0 ; i<m_frame_data.size() ;++i)
+ delete m_frame_data[i];
+
+}
+
+Frame& FrameBuffer::GetFrame( unsigned int fnum )
+{//get frame with a given frame number, NOT with a given position in the buffer.
+ //If the frame number does not occur, the first frame in the buffer is returned.
+
+ std::map<unsigned int,unsigned int>::iterator it = m_fnum_map.find(fnum);
+
+ unsigned int pos = 0;
+ if (it != m_fnum_map.end())
+ pos = it->second;
+
+ return *(m_frame_data[pos]);
+}
+
+const Frame& FrameBuffer::GetFrame( unsigned int fnum ) const
+{ //as above, but const version
+
+ std::map<unsigned int,unsigned int>::const_iterator it = m_fnum_map.find(fnum);
+
+ unsigned int pos=0;
+ if (it != m_fnum_map.end())
+ pos = it->second;
+
+ return *(m_frame_data[pos]);
+}
+
+PicArray& FrameBuffer::GetComponent( unsigned int fnum , CompSort c)
+{//as GetFrame, but returns corresponding component
+
+ std::map<unsigned int,unsigned int>::iterator it = m_fnum_map.find(fnum);
+
+ unsigned int pos = 0;
+ if (it!=m_fnum_map.end())
+ pos = it->second;
+
+ if (c == U_COMP)
+ return m_frame_data[pos]->Udata();
+ else if (c == V_COMP)
+ return m_frame_data[pos]->Vdata();
+ else
+ return m_frame_data[pos]->Ydata();
+}
+
+const PicArray& FrameBuffer::GetComponent( unsigned int fnum , CompSort c ) const
+{//as above, but const version
+
+ std::map<unsigned int,unsigned int>::const_iterator it = m_fnum_map.find(fnum);
+
+ unsigned int pos;
+ if (it!=m_fnum_map.end())
+ pos = it->second;
+
+ if (c==U_COMP)
+ return m_frame_data[pos]->Udata();
+ else if (c==V_COMP)
+ return m_frame_data[pos]->Vdata();
+ else
+ return m_frame_data[pos]->Ydata();
+}
+
+// as GetFrame, but returns corresponding upconverted component
+PicArray& FrameBuffer::GetUpComponent(unsigned int fnum, CompSort c){
+ std::map<unsigned int,unsigned int>::iterator it = m_fnum_map.find(fnum);
+
+ unsigned int pos = 0;
+ if (it!=m_fnum_map.end())
+ pos = it->second;
+
+ if (c == U_COMP)
+ return m_frame_data[pos]->UpUdata();
+ else if (c == V_COMP)
+ return m_frame_data[pos]->UpVdata();
+ else
+ return m_frame_data[pos]->UpYdata();
+
+}
+
+const PicArray& FrameBuffer::GetUpComponent(unsigned int fnum, CompSort c) const {//as above, but const version
+ std::map<unsigned int,unsigned int>::const_iterator it=m_fnum_map.find(fnum);
+
+ unsigned int pos = 0;
+ if (it!=m_fnum_map.end())
+ pos = it->second;
+
+ if (c == U_COMP)
+ return m_frame_data[pos]->UpUdata();
+ else if (c == V_COMP)
+ return m_frame_data[pos]->UpVdata();
+ else
+ return m_frame_data[pos]->UpYdata();
+
+}
+
+void FrameBuffer::PushFrame(unsigned int frame_num)
+{// Put a new frame onto the top of the stack using built-in frame parameters
+ // with frame number frame_num
+ m_fparams.SetFrameNum(frame_num);
+ Frame* fptr = new Frame(m_fparams);
+
+ // add the frame to the buffer
+ m_frame_data.push_back(fptr);
+
+ // put the frame number into the index table
+ std::pair<unsigned int,unsigned int> temp_pair(m_fparams.FrameNum() , m_frame_data.size()-1);
+ m_fnum_map.insert(temp_pair);
+}
+
+void FrameBuffer::PushFrame( const FrameParams& fp )
+{// Put a new frame onto the top of the stack
+
+ Frame* fptr = new Frame(fp);
+
+ // add the frame to the buffer
+ m_frame_data.push_back(fptr);
+
+ // put the frame number into the index table
+ std::pair<unsigned int,unsigned int> temp_pair(fp.FrameNum() , m_frame_data.size()-1);
+ m_fnum_map.insert(temp_pair);
+}
+
+void FrameBuffer::PushFrame( const Frame& frame )
+{
+ // Put a copy of a new frame onto the top of the stack
+
+ Frame* fptr = new Frame( frame );
+
+ // Add the frame to the buffer
+ m_frame_data.push_back(fptr);
+
+ // Put the frame number into the index table
+ std::pair<unsigned int,unsigned int> tmp_pair(frame.GetFparams().FrameNum() ,
+ m_frame_data.size()-1);
+ m_fnum_map.insert(tmp_pair);
+}
+
+void FrameBuffer::PushFrame(StreamPicInput* picin,const FrameParams& fp)
+{
+ //Read a frame onto the top of the stack
+
+ PushFrame(fp);
+ picin->ReadNextFrame( *(m_frame_data[m_frame_data.size()-1]) );
+}
+
+void FrameBuffer::PushFrame(StreamPicInput* picin, unsigned int fnum)
+{
+ //Read a frame onto the top of the stack
+ SetFrameParams( fnum );
+ PushFrame( picin , m_fparams );
+}
+
+void FrameBuffer::Remove(unsigned int pos)
+{//remove frame fnum from the buffer, shifting everything above down
+
+ std::pair<unsigned int,unsigned int>* tmp_pair;
+
+ if (pos<m_frame_data.size())
+ {
+
+ delete m_frame_data[pos];
+
+ m_frame_data.erase(m_frame_data.begin()+pos,m_frame_data.begin()+pos+1);
+
+ //make a new map
+ m_fnum_map.clear();
+ for (size_t i=0 ; i<m_frame_data.size() ; ++i)
+ {
+ tmp_pair = new std::pair<unsigned int,unsigned int>( m_frame_data[i]->GetFparams().FrameNum() , i);
+ m_fnum_map.insert(*tmp_pair);
+ delete tmp_pair;
+ }//i
+
+ }
+}
+
+void FrameBuffer::Clean(int fnum)
+{// clean out all frames that have expired
+
+ for (size_t i=0 ; i<m_frame_data.size() ; ++i)
+ {
+ if ((m_frame_data[i]->GetFparams().FrameNum() + m_frame_data[i]->GetFparams().ExpiryTime() ) <= fnum)
+ Remove(i);
+ }//i
+}
+
+void FrameBuffer::SetFrameParams( unsigned int fnum )
+{
+ // Set the frame parameters, given the GOP set-up and the frame number in display order
+ // This function can be ignored by setting the frame parameters directly if required
+
+ m_fparams.SetFrameNum( fnum );
+ m_fparams.Refs().clear();
+
+ if ( m_gop_len>0 )
+ {
+
+ if ( fnum % m_gop_len == 0)
+ {
+ m_fparams.SetFSort( I_frame );
+
+ // I frame expires after we've coded the next I frame
+ m_fparams.SetExpiryTime( m_gop_len );
+ }
+ else if (fnum % m_L1_sep == 0)
+ {
+ m_fparams.SetFSort( L1_frame );
+
+ // Ref the previous I or L1 frame
+ m_fparams.Refs().push_back( fnum - m_L1_sep );
+
+ // if we don't have the first L1 frame ...
+ if ((fnum-m_L1_sep) % m_gop_len>0)
+ // ... other ref is the prior I frame
+ m_fparams.Refs().push_back( ( fnum/m_gop_len ) * m_gop_len );
+
+ // Expires after the next L1 or I frame
+ m_fparams.SetExpiryTime( m_L1_sep );
+ }
+ else
+ {
+ m_fparams.SetFSort( L2_frame );
+ // Refs are the next or previous I or L1 frame
+ m_fparams.Refs().push_back((fnum/m_L1_sep)*m_L1_sep);
+ m_fparams.Refs().push_back(((fnum/m_L1_sep)+1)*m_L1_sep);
+
+ m_fparams.SetExpiryTime( 1 );
+ // ( L2 frames could expire directly after being coded, but putting in a delay of 1
+ // allows for frame-skipping to be done, since the frame will still be around to
+ // be used if the next frame is skipped. )
+ }
+ }
+ else{
+ if (fnum==0)
+ {
+ m_fparams.SetFSort( I_frame );
+ m_fparams.SetExpiryTime( 1<<30 );//ie never
+ }
+ else if (fnum % m_L1_sep==0)
+ {
+ m_fparams.SetFSort( L1_frame );
+ m_fparams.Refs().push_back(0);//frame 0 is the I frame
+
+ if (fnum != m_L1_sep)//we don't have the first L1 frame
+ m_fparams.Refs().push_back(fnum-m_L1_sep);//other ref is the prior L1 frame
+
+ //expires after the next L1 or I frame
+ m_fparams.SetExpiryTime( m_L1_sep );
+ }
+ else
+ {
+ m_fparams.SetFSort( L2_frame );
+ m_fparams.Refs().push_back((fnum/m_L1_sep)*m_L1_sep);
+ m_fparams.Refs().push_back(((fnum/m_L1_sep)+1)*m_L1_sep);
+ m_fparams.SetExpiryTime( 1 ); //L2 frames could expire directly after being coded, but putting in a delay of 1
+ //allows for frame-skipping to be done, since the frame will still be around to
+ //be used if the next frame is skipped.
+ }
+ }
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame_buffer.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame_buffer.h
new file mode 100644
index 000000000..94a718d92
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/frame_buffer.h
@@ -0,0 +1,234 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: frame_buffer.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _FRAME_BUFFER_H_
+#define _FRAME_BUFFER_H_
+
+#include <vector>
+#include <map>
+#include <libdirac_common/frame.h>
+#include <libdirac_common/common.h>
+#include <libdirac_common/pic_io.h>
+
+namespace dirac
+{
+ //! Holds frames both for reference and to overcome reordering delay
+ /*!
+ The buffer holds frames in a stack to overcome both reordering due to
+ bi-directional prediction and use as references for subsequence motion
+ estimation. Frames, and components of frames, can be accessed by their
+ frame numbers. GOP parameters can be included in the constructors so
+ that frames can be given types (I frame, L1 frame or L2 frame) on
+ being pushed onto the stack; alternatively, these parameters can be
+ overridden.
+ */
+ class FrameBuffer{
+ public:
+ //! Constructor
+ /*!
+ Creates a FrameBuffer using the chroma format. Suitable for
+ compressing when there are no L2 frames, or when the temporal
+ prediction structure is to be determined on the fly.
+
+ \param cf the Chroma format of frames in the buffer
+ \param xlen the width of frames in the buffer
+ \param ylen the hieght of frames in the buffer
+
+ */
+ FrameBuffer(ChromaFormat cf,int xlen,int ylen);
+
+ //! Constructor
+ /*!
+ Creates a FrameBuffer using the chroma format and the separation
+ in frames between L1 frames. Suitable for compressing when there
+ is no GOP structure, only an initial I-frame, or when the temporal
+ prediction structure is to be determined on the fly.
+
+ \param cf the Chroma format of frames in the buffer
+ \param L1sep the number of Layer 2 frames between Layer 1 frames
+ \param xlen the width of frames in the buffer
+ \param ylen the hieght of frames in the buffer
+
+ */
+ FrameBuffer(ChromaFormat cf,int L1sep,int xlen, int ylen);
+
+ //! Constructor
+ /*!
+ Creates a FrameBuffer using the chroma format, the number of L1
+ frames between I frames and the separation in frames between L1
+ frames. Suitable for compressing when there is a full GOP structure
+ or when the temporal prediction structure is to be determined on
+ the fly.
+
+ \param cf the Chroma format of frames in the buffer
+ \param numL1 the number of Layer 1 frames before the next I frame. 0 means that there is only one I frame.
+ \param L1sep the number of Layer 2 frames between Layer 1 frames
+ \param xlen the width of frames in the buffer
+ \param ylen the hieght of frames in the buffer
+ */
+ FrameBuffer(ChromaFormat cf,int numL1,int L1sep,int xlen,int ylen);
+
+ //! Copy constructor
+ /*!
+ Copy constructor. Removes the current contents of the frame buffer
+ and copies in the contents of the initialising buffer.
+ */
+ FrameBuffer(const FrameBuffer& cpy);
+
+ //! Operator=.
+ /*!
+ Operator=. Assigns all elements of the rhs to the lhs.
+ */
+ FrameBuffer& operator=(const FrameBuffer& rhs);
+
+ //! Destructor
+ ~FrameBuffer();
+
+ //! Get frame with a given frame number (NOT with a given position in the buffer)
+ Frame& GetFrame(unsigned int fnum);
+
+ //! Get frame with a given frame number (NOT with a given position in the buffer)
+ const Frame& GetFrame(unsigned int fnum) const;
+
+ //! Get component with a given component sort and frame number (NOT with a given position in the buffer)
+ PicArray& GetComponent(unsigned int frame_num, CompSort c);
+
+ //! Get component with a given component sort and frame number (NOT with a given position in the buffer)
+ const PicArray& GetComponent(unsigned int frame_num, CompSort c) const;
+
+ //! Get upconverted component with a given component sort and frame number (NOT with a given position in the buffer)
+ PicArray& GetUpComponent(unsigned int frame_num, CompSort c);
+
+ //! Get upconverted component with a given component sort and frame number (NOT with a given position in the buffer)
+ const PicArray& GetUpComponent(unsigned int frame_num, CompSort c) const;
+
+ //! Return the number of frames in the buffer
+ size_t Size() const {return m_frame_data.size();}
+
+ //! Put a new frame into the top of the buffer
+ /*!
+ Put a new frame into the top of the buffer. Frame parameters
+ associated with the frame will be the built-in parameters for the
+ buffer.
+
+ \param frame_num the number of the frame being inserted
+ */
+ void PushFrame(unsigned int frame_num);
+
+ //! Put a new frame into the top of the buffer
+ /*!
+ Put a new frame into the top of the buffer. Frame parameters
+ associated with the frame will be as given by the frame parameter
+ object.
+ */
+ void PushFrame(const FrameParams& fp);
+
+ //! Put a copy of a new frame into the top of the buffer
+ /*!
+ Put a copy of a new frame into the top of the buffer.
+ */
+ void PushFrame( const Frame& frame );
+
+ //! Read a new frame into the buffer.
+ /*!
+ Read a new frame into the buffer. Frame parameters associated with
+ the frame will be as given by the frame parameter object.
+
+ \param picin the picture input
+ \param fp the frame parameters to apply to the frame
+ */
+ void PushFrame(StreamPicInput* picin,const FrameParams& fp);
+
+ //! Read a new frame into the buffer.
+ /*!
+ Read a new frame into the buffer. Frame parameters associated with
+ the frame will be derived from the frame number and the internal
+ GOP parameters in the frame buffer.
+ \param picin the picture input
+ \param fnum the frame number
+ */
+ void PushFrame(StreamPicInput* picin,unsigned int fnum);
+
+ //! Delete expired frames
+ /*!
+ Delete frames which have been output and which are no longer
+ required for reference. Expiry times are set in each frame's
+ frame parameters.
+ */
+ void Clean(int fnum);
+
+ //! Return the default frame parameters
+ const FrameParams& GetFParams() const{return m_fparams;}
+
+ private:
+ //! the buffer storing all the values
+ std::vector<Frame*> m_frame_data;
+
+ //!the map from frame numbers to position in the buffer
+ std::map<unsigned int,unsigned int> m_fnum_map;
+
+ //! The frame parameters to use as a default if none are supplied with the frame
+ FrameParams m_fparams;
+
+ //! The number of L1 frames before next I frame
+ unsigned int m_num_L1;
+
+ //! The distance, in frames, between L1 frames
+ unsigned int m_L1_sep;
+
+ //! The length of the group of pictures (GOP)
+ unsigned int m_gop_len;
+
+
+
+ //! Set the frame parameters based on the frame number in display order and internal GOP parameters
+ void SetFrameParams(unsigned int fnum);
+
+ //! Remove a frame with a given frame number from the buffer
+ /*!
+ Remove a frame with a given frame number (in display order) from
+ the buffer. Searches through the buffer and removes frame(s) with
+ that number.
+ */
+ void Remove(unsigned int fnum);
+
+
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/golomb.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/golomb.cpp
new file mode 100644
index 000000000..f5e8655dc
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/golomb.cpp
@@ -0,0 +1,211 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: golomb.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_common/golomb.h>
+#include <libdirac_common/bit_manager.h>
+using namespace dirac;
+
+#include <cmath>
+#include <cstdlib>
+#include <iostream>
+
+using std::vector;
+namespace dirac
+{
+void UnsignedGolombCode(BasicOutputManager& bitman, const unsigned int val)
+{
+ unsigned int M = 0;
+ unsigned int info;
+ unsigned int val2 = val;
+
+ val2++;
+ while (val2>1)
+ {//get the log base 2 of val.
+ val2 >>= 1;
+ M++;
+ }
+ info = val - (1<<M) + 1;
+
+ //add length M+1 prefix
+ for ( unsigned int i=1 ; i<=M ; ++i)
+ bitman.OutputBit(0);
+
+ bitman.OutputBit(1);
+
+ //add info bits
+ for (unsigned int i=0 ; i<M ;++i)
+ bitman.OutputBit( info & (1<<i) );
+
+
+}
+void UnsignedGolombCode(std::vector<bool>& bitvec, const unsigned int val)
+{
+ unsigned int M = 0;
+ unsigned int info;
+ unsigned int val2 = val;
+
+ bitvec.clear();
+ val2++;
+ while ( val2>1 )
+ {//get the log base 2 of val.
+ val2 >>= 1;
+ M++;
+ }
+ info = val - (1<<M) + 1;
+
+ //add length M+1 prefix
+ for ( unsigned int i=1 ; i<=M ; ++i)
+ bitvec.push_back(0);
+
+ bitvec.push_back(1);
+
+ //add info bits
+ for ( unsigned int i=0 ; i<M ; ++i)
+ bitvec.push_back( info & (1<<i) );
+
+}
+
+void GolombCode(BasicOutputManager& bitman, const int val)
+{
+
+ //code the magnitude
+ UnsignedGolombCode(bitman,(unsigned int) abs(val));
+
+ //do sign
+ if (val>0) bitman.OutputBit(1);
+ else if (val<0) bitman.OutputBit(0);
+}
+
+void GolombCode(vector<bool>& bitvec, const int val)
+{
+
+ //code the magnitude
+ UnsignedGolombCode(bitvec,(unsigned int) abs(val));
+
+ //do sign
+ if (val>0) bitvec.push_back(1);
+ else if (val<0) bitvec.push_back(0);
+}
+
+unsigned int UnsignedGolombDecode(BitInputManager& bitman)
+{
+ unsigned int M = 0;
+ unsigned int info = 0;
+ bool bit = 0;
+ unsigned int val = 0;
+
+ do
+ {
+ bit = bitman.InputBit();
+ if ( !bit )
+ M++;
+ }
+ while( !bit && M<64 );//terminate if the number is too big!
+
+ //now get the M info bits
+ for ( unsigned int i=0 ; i<M ; ++i)
+ {
+ bit = bitman.InputBit();
+ if ( bit )
+ info |= (1<<i);
+ }// i
+ val = (1<<M) -1 + info;
+
+ return val;
+}
+
+unsigned int UnsignedGolombDecode(const std::vector<bool>& bitvec)
+{
+ unsigned int M = 0;
+ unsigned int info = 0;
+ bool bit = 0;
+ unsigned int val = 0;
+
+ unsigned int index = 0;//index into bitvec
+
+ do
+ {
+ bit = bitvec[++index];
+ if (!bit)
+ M++;
+ }
+ while( !bit && M<64 );//terminate if the number is too big!
+
+ //now get the M info bits
+ for ( unsigned int i=0 ;i<M ; ++i)
+ {
+ bit = bitvec[++index];
+ if (bit)
+ info |= (1<<i);
+ }
+ val = (1<<M) - 1 + info;
+
+ return val;
+}
+
+int GolombDecode(BitInputManager& bitman)
+{
+
+ int val = int(UnsignedGolombDecode(bitman));
+ bool bit;
+
+ //get the sign
+ if (val != 0)
+ {
+ bit = bitman.InputBit();
+ if ( !bit )
+ val = -val;
+ }
+ return val;
+}
+
+int GolombDecode(const vector<bool>& bitvec)
+{
+
+ int val = int(UnsignedGolombDecode(bitvec));
+ bool bit;
+
+ //get sign
+ if (val != 0)
+ {
+ bit = bitvec[bitvec.size()-1];
+ if (!bit)
+ val = -val;
+ }
+ return val;
+}
+} // namespace dirac
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/golomb.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/golomb.h
new file mode 100644
index 000000000..9edcaa69d
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/golomb.h
@@ -0,0 +1,74 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: golomb.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s):
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#ifndef _GOLOMB_H_
+#define _GOLOMB_H_
+
+#include <libdirac_common/bit_manager.h>
+
+namespace dirac
+{
+ //exp-golomb coding and decoding
+
+ //! Code a value using unsigned exp-Golomb coding and output it
+ void UnsignedGolombCode(BasicOutputManager& bitman, const unsigned int val);
+
+ //! Code a value using unsigned exp-Golomb coding and output it to a vector
+ void UnsignedGolombCode(std::vector<bool>& bitvec, const unsigned int val);
+
+ //! Code a value using signed exp-Golomb coding and output it
+ void GolombCode(BasicOutputManager& bitman, const int val);
+
+ //! Code a value using signed exp-Golomb coding and output it to a vector
+ void GolombCode(std::vector<bool>& bitvec, const int val);
+
+ //! Decode a value using unsigned exp-Golomb decoding and output it
+ unsigned int UnsignedGolombDecode(BitInputManager& bitman);//returning the value decoded
+
+ //! Decode a value using unsigned exp-Golomb decoding and output it
+ unsigned int UnsignedGolombDecode(const std::vector<bool>& bitvec);//returning the value decoded
+
+ //! Decode a value using signed exp-Golomb decoding and output it
+ int GolombDecode(BitInputManager& bitman);//returning the value decoded
+
+ //! Decode a value using signed exp-Golomb decoding and output it
+ int GolombDecode(const std::vector<bool>& bitvec);//returning the value decoded
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/mot_comp.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/mot_comp.cpp
new file mode 100644
index 000000000..5ad742488
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/mot_comp.cpp
@@ -0,0 +1,597 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: mot_comp.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Richard Felton (Original Author),
+* Thomas Davies,
+* Steve Bearcroft
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#include <libdirac_common/mot_comp.h>
+#include <libdirac_common/motion.h>
+#include <libdirac_common/frame_buffer.h>
+using namespace dirac;
+
+using std::vector;
+
+//--public member functions--//
+///////////////////////////////
+
+
+//Constructor
+//Initialises the lookup table that is needed for 1/8th pixel accuracy
+//motion estimation. Creates the necessary arithmetic objects and
+//calls ReConfig to create weighting blocks to fit the values within
+//m_cparams.
+MotionCompensator::MotionCompensator( const CodecParams &cp , const AddOrSub direction ):
+ m_cparams(cp),
+ luma_or_chroma(true),
+ m_add_or_sub( direction )
+{
+ //Configure weighting blocks for the first time
+ m_block_weights = NULL;
+ m_half_block_weights = NULL;
+ ReConfig();
+}
+
+//Destructor
+MotionCompensator::~MotionCompensator(){
+
+ //Tidy up the pointers
+ delete[] m_block_weights;
+ delete[] m_half_block_weights;
+}
+
+//Called to perform motion compensated addition/subtraction on an entire frame.
+void MotionCompensator::CompensateFrame(FrameBuffer& my_buffer,int fnum,const MvData& mv_data)
+{
+
+ int ref1_idx,ref2_idx;
+ Frame& my_frame=my_buffer.GetFrame(fnum);
+ const FrameSort& fsort=my_frame.GetFparams().FSort();
+
+ m_cformat = my_frame.GetFparams().CFormat();
+
+ if (fsort!=I_frame)
+ {//we can motion compensate
+
+ const vector<int>& refs=my_frame.GetFparams().Refs();
+ if (refs.size()>0)
+ {
+ //extract the references
+ ref1_idx=refs[0];
+ if (refs.size()>1)
+ ref2_idx=refs[1];
+ else
+ ref2_idx=refs[0];
+
+ const Frame& ref1frame=my_buffer.GetFrame(ref1_idx);
+ const Frame& ref2frame=my_buffer.GetFrame(ref2_idx);
+
+ luma_or_chroma = true;
+ //now do all the components
+ CompensateComponent( my_frame , ref1frame , ref2frame , mv_data , Y_COMP);
+
+ if ( m_cformat != Yonly )
+ {
+ luma_or_chroma = false;
+ CompensateComponent( my_frame , ref1frame , ref2frame , mv_data , U_COMP);
+ CompensateComponent( my_frame , ref1frame , ref2frame , mv_data , V_COMP);
+ }
+ }
+ }
+}
+
+//--private member functions--//
+////////////////////////////////
+
+//Needs to be called if the blocksize changes (and
+//on startup). This method creates an array of weighting
+//blocks that are used to acheive correctly overlapping
+//blocks.
+void MotionCompensator::ReConfig()
+{
+ if (luma_or_chroma)
+ m_bparams = m_cparams.LumaBParams(2);
+ else
+ m_bparams = m_cparams.ChromaBParams(2);
+
+ if(m_block_weights != NULL)
+ delete[] m_block_weights;
+
+ if(m_half_block_weights != NULL)
+ delete[] m_half_block_weights;
+
+ // Create new weights array.
+ m_block_weights = new TwoDArray<CalcValueType>[9];
+ m_half_block_weights = new TwoDArray<CalcValueType>[9];
+ for(int i = 0; i < 9; i++)
+ {
+ m_block_weights[i].Resize( m_bparams.Yblen() , m_bparams.Xblen() );
+ m_half_block_weights[i].Resize( m_bparams.Yblen() , m_bparams.Xblen() );
+ }
+ // We can create all nine weighting blocks by calculating values
+ // for four blocks and mirroring them to generate the others.
+ CreateBlock( m_bparams , false , false , m_half_block_weights[0] );
+ CreateBlock( m_bparams , false , true , m_half_block_weights[3] );
+ CreateBlock( m_bparams , true , false , m_half_block_weights[1] );
+ CreateBlock( m_bparams , true , true , m_half_block_weights[4] );
+
+ // Note order of flipping is important.
+ FlipX( m_half_block_weights[3] , m_bparams , m_half_block_weights[5] );
+ FlipX( m_half_block_weights[0] , m_bparams , m_half_block_weights[2] );
+ FlipY( m_half_block_weights[0] , m_bparams , m_half_block_weights[6] );
+ FlipX( m_half_block_weights[6] , m_bparams , m_half_block_weights[8] );
+ FlipY( m_half_block_weights[1] , m_bparams , m_half_block_weights[7] );
+
+ for( int k = 0; k < 9; k++)
+ {
+ for ( int j =m_half_block_weights[k].FirstY(); j <= m_half_block_weights[k].LastY(); j++)
+ {
+ for ( int i =m_half_block_weights[k].FirstX(); i <= m_half_block_weights[k].LastX(); i++)
+ {
+ m_block_weights[k][j][i] = m_half_block_weights[k][j][i] << 1;
+ }// i
+ }// j
+ }// k
+}
+
+void MotionCompensator::CompensateComponent(Frame& picframe, const Frame &ref1frame, const Frame& ref2frame,
+ const MvData& mv_data,const CompSort cs)
+{
+ // Set up references to pictures and references
+ PicArray& pic_data_out = picframe.Data( cs );
+
+ const PicArray& ref1up = ref1frame.UpData( cs );
+ const PicArray& ref2up = ref2frame.UpData( cs );
+
+ // Set up another picture which will contain the MC data, which
+ // we'll add or subtract to pic_data_out
+ TwoDArray<CalcValueType> pic_data(pic_data_out.LengthY(), pic_data_out.LengthX() , 0);
+
+ // Factors to compensate for subsampling of chroma
+ int xscale_factor = 1;
+ int yscale_factor = 1;
+
+ if ( cs != Y_COMP )
+ {
+ if (m_cformat == format420)
+ {
+ xscale_factor = 2;
+ yscale_factor = 2;
+ }
+ else if (m_cformat == format422)
+ {
+ xscale_factor = 2;
+ yscale_factor = 1;
+ }
+ else if (m_cformat == format411)
+ {
+ xscale_factor = 4;
+ yscale_factor = 1;
+ }
+
+ }
+
+ // Reference to the relevant DC array
+ const TwoDArray<ValueType>& dcarray = mv_data.DC( cs );
+
+ // Set up references to the vectors
+ const int num_refs = picframe.GetFparams().Refs().size();
+ const MvArray* mv_array1;
+ const MvArray* mv_array2;
+ mv_array1 = &mv_data.Vectors(1);
+ if (num_refs ==2 )
+ mv_array2 = &mv_data.Vectors(2);
+ else
+ mv_array2 = &mv_data.Vectors(1);
+
+ ReConfig();//set all the weighting blocks up
+
+ //Blocks are listed left to right, line by line.
+ MVector mv1,mv2;
+ PredMode block_mode;
+ ValueType dc;
+
+ //Coords of the top-left corner of a block
+ ImageCoords pos;
+
+ //Loop for each block in the output image.
+ //The CompensateBlock function will use the image pointed to by ref1up
+ //and add the compensated pixels to the image pointed to by pic_data.
+ size_t wgt_idx;
+
+ //Loop over all the block rows
+
+ pos.y = -m_bparams.Yoffset();
+ for(int yblock = 0; yblock < m_cparams.YNumBlocks(); ++yblock)
+ {
+ pos.x = -m_bparams.Xoffset();
+ //loop over all the blocks in a row
+ for(int xblock = 0 ; xblock < m_cparams.XNumBlocks(); ++xblock)
+ {
+
+ //Decide which weights to use.
+ if((xblock != 0)&&(xblock < m_cparams.XNumBlocks() - 1))
+ {
+ if((yblock != 0)&&(yblock < m_cparams.YNumBlocks() - 1))
+ wgt_idx = 4;
+ else if(yblock == 0)
+ wgt_idx = 1;
+ else
+ wgt_idx= 7;
+ }
+ else if(xblock == 0)
+ {
+ if((yblock != 0)&&(yblock < m_cparams.YNumBlocks() - 1))
+ wgt_idx = 3;
+ else if(yblock == 0)
+ wgt_idx = 0;
+ else
+ wgt_idx = 6;
+ }
+ else
+ {
+ if((yblock != 0)&&(yblock < m_cparams.YNumBlocks() - 1))
+ wgt_idx = 5;
+ else if(yblock == 0)
+ wgt_idx = 2;
+ else
+ wgt_idx = 8;
+ }
+
+ block_mode = mv_data.Mode()[yblock][xblock];
+ mv1 = (*mv_array1)[yblock][xblock];
+ mv1.x /= xscale_factor;
+ mv1.y /= yscale_factor;
+
+ mv2 = (*mv_array2)[yblock][xblock];
+ mv2.x /= xscale_factor;
+ mv2.y /= yscale_factor;
+
+
+ dc = dcarray[yblock][xblock]<<2;// DC is only given 8 bits,
+ // so need to shift to get 10-bit data
+
+ if(block_mode == REF1_ONLY)
+ {
+ CompensateBlock(pic_data, ref1up, mv1, pos, m_block_weights[wgt_idx]);
+ }
+ else if (block_mode == REF2_ONLY)
+ {
+ CompensateBlock(pic_data, ref2up, mv2, pos, m_block_weights[wgt_idx]);
+ }
+ else if(block_mode == REF1AND2)
+ {
+ CompensateBlock(pic_data, ref1up, mv1, pos, m_half_block_weights[wgt_idx]);
+ CompensateBlock(pic_data, ref2up, mv2, pos, m_half_block_weights[wgt_idx]);
+ }
+ else
+ {//we have a DC block.
+ DCBlock(pic_data, dc,pos, m_block_weights[wgt_idx]);
+ }
+
+ //Increment the block horizontal position
+ pos.x += m_bparams.Xbsep();
+
+ }//xblock
+
+ //Increment the block vertical position
+ pos.y += m_bparams.Ybsep();
+
+ }//yblock
+
+ if ( m_add_or_sub == SUBTRACT)
+ {
+ int x_end_data = std::min(pic_data.LastX(), m_cparams.XNumBlocks()*m_bparams.Xbsep() );
+ int y_end_data = std::min(pic_data.LastY(), m_cparams.YNumBlocks()*m_bparams.Ybsep() );
+
+ for ( int i =pic_data.FirstY(); i <= y_end_data; i++)
+ {
+ for ( int j =pic_data.FirstX(); j <= x_end_data; ++j)
+ {
+ pic_data_out[i][j] -= static_cast<ValueType>( (pic_data[i][j] + 1024) >> 11 );
+ }
+
+ // Okay, we've done all the actual blocks. Now if the picture is further padded
+ // we need to set the padded values to zero beyond the last block in the row,
+ // for all the picture lines in the block row. Need only do this when we're
+ // subtracting.
+
+ for (int j=( m_cparams.XNumBlocks()*m_bparams.Xbsep() ); j<pic_data.LengthX() ; ++j )
+ {
+ pic_data_out[i][j] = 0;
+ }
+ }
+ // Finally, now we've done all the blocks, we must set all padded lines below
+ // the last row equal to 0, if we're subtracting
+ for ( int y=m_cparams.YNumBlocks()*m_bparams.Ybsep() ; y<pic_data.LengthY() ; ++y )
+ {
+ for ( int x=0 ; x<pic_data.LengthX() ; ++x )
+ {
+ pic_data_out[y][x] = 0;
+ }
+
+ }
+ }
+ else
+ {
+ for ( int i =pic_data.FirstY(); i <= pic_data.LastY(); i++)
+ {
+ for ( int j =pic_data.FirstX(); j <= pic_data.LastX(); j++)
+ {
+ pic_data_out[i][j] += static_cast<ValueType>( (pic_data[i][j] + 1024) >> 11 );
+ }
+ }
+ }
+}
+
+void MotionCompensator::CompensateBlock( TwoDArray<CalcValueType> &pic_data , const PicArray &refup_data , const MVector &mv ,
+const ImageCoords& pos , const TwoDArray<CalcValueType>& wt_array )
+{
+
+ //Coordinates in the image being written to.
+ const ImageCoords start_pos( std::max(pos.x,0) , std::max(pos.y,0) );
+ const ImageCoords end_pos( std::min( pos.x + m_bparams.Xblen() , pic_data.LengthX() ) ,
+ std::min( pos.y + m_bparams.Yblen() , pic_data.LengthY() ) );
+
+ //The difference between the desired start point
+ //pos and the actual start point start_pos.
+ const ImageCoords diff( start_pos.x - pos.x , start_pos.y - pos.y );
+
+ //Set up the start point in the reference image by rounding the motion vector
+ //NB: bit shift rounds negative values DOWN, as required
+ const MVector roundvec( mv.x>>2 , mv.y>>2 );
+
+ //Get the remainder after rounding. NB rmdr values always 0,1,2 or 3
+ const MVector rmdr( mv.x - ( roundvec.x<<2 ) , mv.y - ( roundvec.y<<2 ) );
+
+ //Where to start in the upconverted image
+ const ImageCoords ref_start( ( start_pos.x<<1 ) + roundvec.x ,( start_pos.y<<1 ) + roundvec.y );
+
+ //weights for doing linear interpolation, calculated from the remainder values
+ const ValueType TLweight( (4 - rmdr.x) * (4 - rmdr.y) );
+ const ValueType TRweight( rmdr.x * ( 4 - rmdr.y ) );
+ const ValueType BLweight( ( 4 - rmdr.x ) * rmdr.y );
+ const ValueType BRweight( rmdr.x * rmdr.y );
+
+ //An additional stage to make sure the block to be copied does not fall outside
+ //the reference image.
+ const int refXlen = refup_data.LengthX();
+ const int refYlen = refup_data.LengthY();
+ bool do_bounds_checking = false;
+
+ //Check if there are going to be any problems copying the block from
+ //the upvconverted reference image.
+ if( ref_start.x < 0 )
+ do_bounds_checking = true;
+ else if( ref_start.x + ((end_pos.x - start_pos.x)<<1 ) >= refXlen )
+ do_bounds_checking = true;
+ if( ref_start.y < 0 )
+ do_bounds_checking = true;
+ else if( ref_start.y + ((end_pos.y - start_pos.y)<<1 ) >= refYlen)
+ do_bounds_checking = true;
+
+ if( !do_bounds_checking )
+ {
+ for(int c = start_pos.y, wY = diff.y, uY = ref_start.y; c < end_pos.y; ++c, ++wY, uY += 2)
+ {
+ for(int l = start_pos.x, wX = diff.x, uX = ref_start.x; l < end_pos.x; ++l, ++wX, uX += 2)
+ {
+
+ pic_data[c][l] += (( TLweight * refup_data[uY][uX] +
+ TRweight * refup_data[uY][uX+1] +
+ BLweight * refup_data[uY+1][uX] +
+ BRweight * refup_data[uY+1][uX+1] +
+ 8
+ ) >> 4) * wt_array[wY][wX];
+ }//l
+ }//c
+ }
+ else
+ {
+ //We're doing bounds checking because we'll fall off the edge of the reference otherwise.
+
+ for(int c = start_pos.y, wY = diff.y, uY = ref_start.y,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen);
+ c < end_pos.y; ++c, ++wY, uY += 2,BuY=BChk(uY,refYlen),BuY1=BChk(uY+1,refYlen))
+ {
+ for(int l = start_pos.x, wX = diff.x, uX = ref_start.x,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen);
+ l < end_pos.x; ++l, ++wX, uX += 2,BuX=BChk(uX,refXlen),BuX1=BChk(uX+1,refXlen))
+ {
+
+ pic_data[c][l] += (( TLweight * refup_data[BuY][BuX] +
+ TRweight * refup_data[BuY][BuX1] +
+ BLweight * refup_data[BuY1][BuX]+
+ BRweight * refup_data[BuY1][BuX1] +
+ 8
+ ) >> 4) * wt_array[wY][wX];
+ }//l
+ }//c
+
+ }
+
+}
+
+void MotionCompensator::DCBlock( TwoDArray<CalcValueType> &pic_data ,const ValueType dc , const ImageCoords& pos ,
+ const TwoDArray<CalcValueType>& wt_array)
+{
+
+ //Coordinates in the image being written to.
+ const ImageCoords start_pos( std::max(0 , pos.x) , std::max(0 , pos.y) );
+ const ImageCoords end_pos( std::min(pos.x + m_bparams.Xblen() , pic_data.LengthX() ) ,
+ std::min(pos.y + m_bparams.Yblen() , pic_data.LengthY() ) );
+
+ //The difference between the desired start point
+ //pos and the actual start point start_pos.
+ const ImageCoords diff(start_pos.x - pos.x , start_pos.y - pos.y);
+
+ //Quick process where we can just copy from the double size image.
+
+ for(int c = start_pos.y, wY = diff.y; c < end_pos.y; ++c, ++wY)
+ {
+ for(int l = start_pos.x, wX = diff.x; l < end_pos.x; ++l, ++wX)
+ {
+ pic_data[c][l] += dc * wt_array[wY][wX];
+ }
+ }
+}
+
+//Overlapping blocks are acheived by applying a 2D raised cosine shape
+//to them. This function facilitates the calculations
+float MotionCompensator::RaisedCosine(float t, float B)
+{
+ if(std::abs(t)>(B+1.0)/2.0)
+ return 0.0f;
+ else if(std::abs(t)<(1.0-B)/2.0)
+ return 1.0f;
+ else
+ return( 0.5 * ( 1.0 + std::cos( 3.141592654 * ( std::abs(t)-(1.0-B)/2.0 )/B ) ) );
+}
+
+//Calculates a weighting block.
+//bparams defines the block parameters so the relevant weighting arrays can be created.
+//FullX and FullY refer to whether the weight should be adjusted for the edge of an image.
+//eg. 1D Weighting shapes in x direction
+
+// FullX true FullX false
+// *** ********
+// * * *
+// * * *
+//* * *
+
+void MotionCompensator::CreateBlock(const OLBParams &bparams, bool FullX, bool FullY, TwoDArray<CalcValueType>& WeightArray)
+{
+ // Create temporary arrays
+ OneDArray<CalcValueType> HWts( WeightArray.LengthX() );
+ OneDArray<CalcValueType> VWts( WeightArray.LengthY() );
+
+ // Calculation variables
+ float rolloffX = (float(bparams.Xblen()+1)/float(bparams.Xbsep())) - 1;
+ float rolloffY = (float(bparams.Yblen()+1)/float(bparams.Ybsep())) - 1;
+ float val;
+
+ // Window in the x direction
+ for(int x = 0; x < bparams.Xblen(); ++x)
+ {
+ val = (float(x) - (float(bparams.Xblen()-1)/2.0))/float(bparams.Xbsep());
+ HWts[x] = static_cast<CalcValueType>( 32.0 * RaisedCosine(val,rolloffX) );
+ HWts[x] = std::max( HWts[x] , 1 );
+ HWts[x] = std::min( HWts[x] , 32 );
+ }// x
+
+ // Window in the y direction
+ for(int y = 0; y < bparams.Yblen(); ++y)
+ {
+ val = (float(y) - (float(bparams.Yblen()-1)/2.0))/float(bparams.Ybsep());
+ VWts[y] = static_cast<CalcValueType>( 32.0 * RaisedCosine(val,rolloffY) );
+ VWts[y] = std::max( VWts[y] , 1 );
+ VWts[y] = std::min( VWts[y] , 32 );
+ }// y
+
+ // Rationalise to avoid rounding errors
+ for(int x = HWts.Last(); x > HWts.Last()-bparams.Xoffset(); --x)
+ {
+ if (HWts[x] + HWts[HWts.Last()-(x-bparams.Xbsep())] > 32)
+ HWts[HWts.Last()-(x-bparams.Xbsep())] = 32-HWts[x];
+
+ else if (HWts[x] + HWts[HWts.Last()-(x-bparams.Xbsep())] < 32)
+ HWts[x] = 32-HWts[HWts.Last()-(x-bparams.Xbsep())];
+ }// x
+
+ // Now reflect or pad, as appropriate
+ if (!FullX)
+ {
+ for( int x = 0; x < (bparams.Xblen()>>1) ; ++x)
+ HWts[x] = 32;
+ }
+ else
+ {
+ for( int x = 0; x < (bparams.Xblen()>>1); ++x)
+ HWts[x] = HWts[HWts.Last()-x];
+ }
+
+ // Rationalise to avoid rounding errors
+ for(int y = VWts.Last(); y > VWts.Last()-bparams.Yoffset(); --y)
+ {
+ if (VWts[y] + VWts[VWts.Last()-(y-bparams.Ybsep())] > 32)
+ VWts[VWts.Last()-(y-bparams.Ybsep())] = 32-VWts[y];
+ else if (VWts[y] + VWts[VWts.Last()-(y-bparams.Ybsep())] < 32)
+ VWts[y] = 32-VWts[VWts.Last()-(y-bparams.Ybsep())];
+ }// x
+
+ // Reflect or pad, as appropriate
+ if (!FullY)
+ {
+ for( int y = 0 ; y < (bparams.Yblen()>>1); ++y)
+ VWts[y] = 32;
+ }
+ else
+ {
+ for( int y = 0 ; y < (bparams.Yblen()>>1); ++y)
+ VWts[y] = VWts[VWts.Last()-y];
+ }
+
+ for(int y = 0; y < bparams.Yblen(); ++y)
+ {
+ for(int x = 0; x < bparams.Xblen(); ++x)
+ {
+ WeightArray[y][x] = VWts[y] * HWts[x];
+ }// x
+ }// y
+
+}
+
+//Flips the values in an array in the x direction.
+void MotionCompensator::FlipX(const TwoDArray<CalcValueType>& Original, const OLBParams &bparams, TwoDArray<CalcValueType>& Flipped)
+{
+ for(int x = 0; x < bparams.Xblen(); ++x)
+ {
+ for(int y = 0; y < bparams.Yblen(); ++y)
+ {
+ Flipped[y][x] = Original[y][(bparams.Xblen()-1) - x];
+ }// y
+ }// x
+}
+
+//Flips the values in an array in the y direction.
+void MotionCompensator::FlipY(const TwoDArray<CalcValueType>& Original, const OLBParams &bparams, TwoDArray<CalcValueType>& Flipped)
+{
+ for(int x = 0; x < bparams.Xblen(); ++x)
+ {
+ for(int y = 0; y < bparams.Yblen(); ++y)
+ {
+ Flipped[y][x] = Original[(bparams.Yblen()-1) - y][x];
+ }// y
+ }// x
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/mot_comp.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/mot_comp.h
new file mode 100644
index 000000000..ea6412b3c
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/mot_comp.h
@@ -0,0 +1,157 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: mot_comp.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Richard Felton (Original Author), Thomas Davies
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+// Motion Compensation routines.
+// Supports different sizes of blocks as long as the parameters
+// describing them are 'legal'. Blocks overlap the edge of the image
+// being written to but blocks in the reference image are forced to
+// lie completely within the image bounds.
+
+#ifndef _INCLUDED_MOT_COMP
+#define _INCLUDED_MOT_COMP
+
+#include <cstdlib>
+#include <ctime>
+#include <iostream>
+#include <libdirac_common/common.h>
+#include <libdirac_common/upconvert.h>
+#include <libdirac_common/motion.h>
+
+namespace dirac
+{
+ class FrameBuffer;
+ class Frame;
+
+ //! Motion compensator class.
+ /*!
+ Motion compensator class, for doing motion compensation with two
+ references and overlapped blocks, using raised-cosine roll-off.
+ */
+ class MotionCompensator
+ {
+
+ public:
+ //! Constructor.
+ /*!
+ Constructor initialises using codec parameters.
+ */
+ MotionCompensator( const CodecParams &cp , const AddOrSub direction );
+ //! Destructor
+ ~MotionCompensator();
+
+ //! Compensate a frame
+ /*!
+ Perform motion compensated addition/subtraction on a frame using
+ parameters
+ \param fnum number of frame in the frame buffer to be compensated
+ \param my_buffer the FrameBuffer object containing the frame and the reference frames
+ ` \param mv_data the motion vector data
+ */
+ void CompensateFrame( FrameBuffer& my_buffer , int fnum , const MvData& mv_data );
+
+ private:
+ //private, body-less copy constructor: this class should not be copied
+ MotionCompensator( const MotionCompensator& cpy );
+ //private, body-less assignment=: this class should not be assigned
+ MotionCompensator& operator=( const MotionCompensator& rhs );
+
+ //functions
+
+ //! Motion-compensate a component
+ void CompensateComponent( Frame& picframe , const Frame& ref1frame ,
+ const Frame& ref2frame ,
+ const MvData& mv_data , const CompSort cs);
+
+ //! Motion-compensate an individual block
+ void CompensateBlock( TwoDArray<CalcValueType>& pic_data ,
+ const PicArray& refup_data , const MVector& Vec ,
+ const ImageCoords& Pos , const TwoDArray<CalcValueType>& Weights );
+
+ //! DC-compensate an individual block
+ void DCBlock( TwoDArray<CalcValueType> &pic_data , const ValueType dc ,
+ const ImageCoords& Pos , const TwoDArray<CalcValueType>& Weights);
+
+ //! Recalculate the weight matrix and store other key block related parameters.
+ void ReConfig();
+
+ // Overlapping blocks are acheived by applying a 2D raised cosine shape
+ // to them. This function facilitates the calculations
+ float RaisedCosine(float t, float B);
+
+ //! Calculates a weighting block.
+ /*!
+ Params defines the block parameters so the relevant weighting
+ arrays can be created. FullX and FullY refer to whether the
+ weight should be adjusted for the edge of an image. eg. 1D
+ Weighting shapes in x direction
+ FullX true FullX false
+ *** ********
+ * * *
+ * * *
+ * * *
+ */
+ void CreateBlock(const OLBParams &bparams, bool FullX, bool FullY, TwoDArray<CalcValueType>& WeightArray);
+
+ //! Flips the values in an array in the x direction
+ void FlipX(const TwoDArray<CalcValueType>& Original, const OLBParams &bparams, TwoDArray<CalcValueType>& Flipped);
+
+ //! Flips the values in an array in the y direction.
+ void FlipY(const TwoDArray<CalcValueType>& Original, const OLBParams &bparams, TwoDArray<CalcValueType>& Flipped);
+
+ private:
+ //variables
+
+ //! The codec parameters
+ CodecParams m_cparams;
+
+ //! The chroma format
+ ChromaFormat m_cformat;
+ bool luma_or_chroma; //true if we're doing luma, false if we're coding chroma
+
+ // A marker saying whether we're doing MC addition or subtraction
+ AddOrSub m_add_or_sub;
+
+ // Block information
+ OLBParams m_bparams;
+ TwoDArray<CalcValueType>* m_block_weights;
+ TwoDArray<CalcValueType>* m_half_block_weights;
+
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/motion.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/motion.cpp
new file mode 100644
index 000000000..f493dfc19
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/motion.cpp
@@ -0,0 +1,480 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: motion.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Chris Bowley
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+////////////////////////////////////////////////////////////////
+//classes and functions for motion estimation and compensation//
+////////////////////////////////////////////////////////////////
+
+#include <libdirac_common/motion.h>
+using namespace dirac;
+
+#include <cmath>
+
+using namespace std;
+
+//Motion vector and Motion Estimation structures//
+//////////////////////////////////////////////////
+
+MvData::MvData( const int xnumMB, const int ynumMB ,
+ const int xnumblocks, const int ynumblocks , const int num_refs ):
+ m_vectors( Range(1 , num_refs) ),
+ m_gm_vectors( Range(1 , num_refs) ),
+ m_modes( ynumblocks , xnumblocks ),
+ m_dc( 3 ),
+ m_mb_split( ynumMB , xnumMB ),
+ m_mb_common( ynumMB , xnumMB ),
+ m_gm_params( Range(1 , num_refs) )
+{
+
+ InitMvData();
+}
+
+MvData::MvData( const int xnumMB , const int ynumMB , const int num_refs ):
+ m_vectors( Range(1 , num_refs) ),
+ m_gm_vectors( Range(1 , num_refs) ),
+ m_modes( 4*ynumMB , 4*xnumMB ),
+ m_dc( 3 ),
+ m_mb_split( ynumMB , xnumMB ),
+ m_mb_common( ynumMB , xnumMB ),
+ m_gm_params( Range(1 , num_refs) )
+{
+ InitMvData();
+}
+
+void MvData::InitMvData()
+{
+ // Create the arrays of vectors
+ for ( int i=m_vectors.First() ; i<=m_vectors.Last() ; ++i ){
+ m_vectors[i] = new MvArray( Mode().LengthY() , Mode().LengthX() );
+ m_gm_vectors[i] = new MvArray( Mode().LengthY() , Mode().LengthX() );
+ }
+
+ // create global motion parameter arrays
+ for ( int i=m_gm_params.First() ; i<=m_gm_params.Last() ; ++i ){
+ m_gm_params[i] = new OneDArray<float> ( 8 );
+ }
+
+ // Create the arrays of dc values
+ for ( int i=0 ; i<3 ; ++i )
+ m_dc[i] = new TwoDArray<ValueType>( Mode().LengthY() , Mode().LengthX() );
+}
+
+MvData::~MvData()
+{
+ // Delete the arrays of vectors
+ for ( int i=m_vectors.First() ; i<=m_vectors.Last() ; ++i ){
+ delete m_vectors[i];
+ delete m_gm_vectors[i];
+ }
+
+ // delete array of global motion parameters
+ for ( int i=m_gm_params.First() ; i<=m_gm_params.Last() ; ++i ){
+ delete m_gm_params[i];
+ }
+
+ // Delete the arrays of dc values
+ for ( int i=0 ; i<3 ; ++i )
+ delete m_dc[i];
+}
+
+
+
+MEData::MEData(const int xnumMB , const int ynumMB ,
+ const int xnumblocks , const int ynumblocks , const int num_refs ):
+ MvData( xnumMB , ynumMB , xnumblocks , ynumblocks , num_refs ),
+ m_pred_costs( Range( 1 , num_refs ) ),
+ m_intra_costs( ynumblocks , xnumblocks ),
+ m_bipred_costs( ynumblocks , xnumblocks ),
+ m_MB_costs( ynumMB , xnumMB ),
+ m_lambda_map( ynumblocks , xnumblocks ),
+ m_inliers( Range( 1 , num_refs ) )
+{
+ InitMEData();
+}
+
+MEData::MEData( const int xnumMB , const int ynumMB , const int num_refs ):
+ MvData( xnumMB , ynumMB , num_refs ),
+ m_pred_costs( Range( 1 , num_refs ) ),
+ m_intra_costs( 4*ynumMB , 4*xnumMB ),
+ m_bipred_costs( 4*ynumMB , 4*xnumMB ),
+ m_MB_costs( ynumMB , xnumMB ),
+ m_lambda_map( 4*ynumMB , 4*xnumMB ),
+ m_inliers( Range( 1 , num_refs ) )
+{
+ InitMEData();
+
+}
+
+void MEData::InitMEData()
+{
+ // Create the arrays of prediction costs
+ for ( int i=m_pred_costs.First() ; i<=m_pred_costs.Last() ; ++i )
+ m_pred_costs[i] = new TwoDArray<MvCostData>( Mode().LengthY() , Mode().LengthX() );
+
+ // Create the arrays of vectors
+ for ( int i=m_inliers.First() ; i<=m_inliers.Last() ; ++i )
+ m_inliers[i] = new TwoDArray<int>( Mode().LengthY() , Mode().LengthX() );
+}
+
+void MEData::SetLambdaMap( const int num_refs , const float lambda )
+{
+ TwoDArray<bool> transition_map1( Mode().LengthY() , Mode().LengthX() );
+ TwoDArray<bool> transition_map2( Mode().LengthY() , Mode().LengthX() );
+
+ FindTransitions( transition_map1 , 1 );
+
+ for ( int j=0 ; j<m_lambda_map.LengthY() ; j++)
+ {
+ for ( int i=0 ; i<m_lambda_map.LengthX() ; i++)
+ {
+ if ( transition_map1[j][i] )
+ m_lambda_map[j][i] = 0.0;
+ else
+ m_lambda_map[j][i] = lambda;
+ if ( i<4 || j<4 )
+ m_lambda_map[j][i] /= 5.0;
+ }// i
+ }// j
+
+ if ( num_refs > 1 )
+ {
+ FindTransitions( transition_map2 , 2 );
+
+ for ( int j=0 ; j<m_lambda_map.LengthY() ; j++)
+ {
+ for ( int i=0 ; i<m_lambda_map.LengthX() ; i++)
+ {
+ if ( transition_map1[j][i] || transition_map2[j][i] )
+ m_lambda_map[j][i] = 0.0;
+ else
+ m_lambda_map[j][i] = lambda;
+ }// i
+ }// j
+ }
+
+}
+
+void MEData::SetLambdaMap( const int level , const TwoDArray<float>& l_map , const float wt )
+{
+
+ const int factor = 1<<(2-level);
+ int xstart , xend , ystart , yend;
+
+ for (int j = 0 ; j<m_lambda_map.LengthY() ; ++j )
+ {
+ for (int i = 0 ; i<m_lambda_map.LengthX() ; ++i )
+ {
+ xstart = factor * i;
+ ystart = factor * j;
+ xend = factor * ( i + 1 );
+ yend = factor * ( j + 1 );
+
+ m_lambda_map[j][i] = l_map[ystart][xstart];
+
+ for (int q = ystart ; q<yend ; ++q )
+ for (int p = xstart ; p<xend ; ++p )
+ m_lambda_map[j][i] = std::max( l_map[q][p] , m_lambda_map[j][i] );
+
+ m_lambda_map[j][i] *= wt;
+
+ }// i
+ }// j
+
+}
+
+void MEData::FindTransitions( TwoDArray<bool>& trans_map , const int ref_num )
+{
+ const MvArray& mv_array = Vectors( ref_num );
+
+ // Start with a statistical approach - determine thresholds later
+
+ // Compute mean and standard deviation of local motion vector variance //
+ /////////////////////////////////////////////////////////////////////////
+
+ long double total_cost = 0.0;
+ long double mean_cost;
+
+ // first, mean
+ for ( int j=0 ; j<mv_array.LengthY() ; ++j )
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
+ total_cost += PredCosts( ref_num )[j][i].SAD;
+
+ mean_cost = total_cost /
+ static_cast<long double>( mv_array.LengthX()*mv_array.LengthY() );
+
+ // next , Standard Deviation
+ long double sd_cost = 0.0;
+ double diff;
+
+ for ( int j=0 ; j<mv_array.LengthY() ; ++j )
+ {
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
+ {
+ diff = PredCosts( ref_num )[j][i].SAD - mean_cost;
+ diff *= diff;
+ sd_cost += diff;
+
+ }// i
+ }// j
+
+ // Get the variance ...
+ sd_cost /= static_cast<long double>( mv_array.LengthX()*mv_array.LengthY() );
+
+ // ... and then the SD
+ sd_cost = std::sqrt( sd_cost );
+
+ float threshold = static_cast<float>( mean_cost + 1.5*sd_cost );
+
+ // now go through and mark those that go above the threshold
+ for ( int j=0 ; j<mv_array.LengthY() ; ++j )
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
+ trans_map[j][i] = ( PredCosts( ref_num )[j][i].SAD >= threshold )? true : false;
+
+//
+ // Next look at motion-vector costs
+ TwoDArray<double> val_array( mv_array.LengthY() , mv_array.LengthX() );
+
+ // first, mean
+ total_cost = 0.0;
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
+ {
+ val_array[0][i] = 0.0;
+ val_array[val_array.LastY()][i] = 0.0;
+ }// i
+
+ for ( int j=1 ; j<mv_array.LengthY()-1 ; ++j )
+ {
+ val_array[j][0] = 0.0;
+ val_array[j][val_array.LastX()] = 0.0;
+ for ( int i=1 ; i<mv_array.LengthX()-1 ; ++i )
+ {
+ val_array[j][i] =0.0;
+ for (int q=-1 ; q<=1 ; ++q)
+ for (int p=-1 ; p<=1 ; ++p)
+ val_array[j][i] = std::max( val_array[j][i] , (double)Norm1( mv_array[j+q][i+p] - mv_array[j][i] ) );
+
+ total_cost += val_array[j][i];
+
+ }// i
+ }// j
+
+
+ mean_cost = total_cost /
+ static_cast<long double>( mv_array.LengthX()*mv_array.LengthY() );
+
+ // next , Standard Deviation
+ sd_cost = 0.0;
+
+ for ( int j=1 ; j<mv_array.LengthY()-1 ; ++j )
+ {
+ for ( int i=1 ; i<mv_array.LengthX()-1 ; ++i )
+ {
+ diff = val_array[j][i] - mean_cost;
+ diff *= diff;
+
+ sd_cost += diff;
+
+ }// i
+ }// j
+
+ // Get the variance ...
+ sd_cost /= static_cast<long double>( mv_array.LengthX()*mv_array.LengthY() );
+
+ // ... and then the SD
+ sd_cost = std::sqrt( sd_cost );
+
+ threshold = static_cast<float>( mean_cost + 1.5*sd_cost );
+
+ // now go through and mark those that go above the threshold
+ for ( int j=0 ; j<mv_array.LengthY() ; ++j )
+ for ( int i=0 ; i<mv_array.LengthX() ; ++i )
+// trans_map[j][i] = ( val_array[j][i] >= threshold )? true : false;
+trans_map[j][i] = false;
+
+// bool contains_trans;
+
+// for ( int j=0 ; j<mv_array.LengthY()/4 ; ++j )
+// {
+// for ( int i=0 ; i<mv_array.LengthX()/4 ; ++i )
+// {
+// contains_trans = false;
+// for ( int q=4*j ; q<4*(j+1) ; ++q )
+// {
+// for ( int p=4*i ; p<4*(i+1) ; ++p )
+// {
+// if (trans_map[q][p])
+// contains_trans = true;
+// }// p
+// }// q
+// for ( int q=4*j ; q<4*(j+1) ; ++q )
+// for ( int p=4*i ; p<4*(i+1) ; ++p )
+// trans_map[q][p] = contains_trans;
+
+// }// i
+// }// j
+
+
+}
+
+
+MEData::~MEData()
+{
+ // Delete the arrays of prediction costs
+ for ( int i=m_pred_costs.First() ; i<=m_pred_costs.Last() ; ++i )
+ delete m_pred_costs[i];
+
+ for ( int i=m_inliers.First() ; i<=m_inliers.Last() ; ++i )
+ delete m_inliers[i];
+}
+
+namespace dirac
+{
+//! Overloaded operator<< for MvCostData
+/*!
+ Only writes SAD value to stream
+*/
+ostream & operator<< (ostream & stream, MvCostData & cost)
+{
+ stream << cost.SAD << " " << cost.mvcost;
+
+ return stream;
+}
+
+//! Overloaded operator>> for MvCostData
+/*!
+ Only reads SAD value from stream
+*/
+istream & operator>> (istream & stream, MvCostData & cost)
+{
+ stream >> cost.SAD >> cost.mvcost;
+
+ return stream;
+}
+
+//! Overloaded operator>> for PredMode
+/*!
+ No operator<< is specified as enumeration is written as integers
+ operator>> required to specify PredMode input
+*/
+istream & operator>> (istream & stream, PredMode & mode)
+{
+ int temp;
+ stream >> temp;
+ mode = (PredMode)temp;
+
+ return stream;
+}
+
+// Overriden extractor operator for reading MvData data members
+istream &operator>> (istream & stream, MEData & me_data)
+{
+ stream.ignore(1000, '\n');
+
+ // input reference-independent information
+ stream >> me_data.MBSplit();
+ stream >> me_data.MBCommonMode();
+ stream >> me_data.MBCosts();
+ stream >> me_data.Mode();
+ stream >> me_data.IntraCosts();
+
+ if (me_data.m_pred_costs.Length() > 1)
+ stream >> me_data.BiPredCosts();
+
+ if (me_data.DC().Length() == 1)
+ {
+ stream >> me_data.DC( Y_COMP );
+ }
+ else if (me_data.DC().Length() == 3)
+ {
+ stream >> me_data.DC( Y_COMP );
+ stream >> me_data.DC( U_COMP );
+ stream >> me_data.DC( V_COMP );
+ }
+
+ // input reference information
+ for (int i=1; i<=me_data.m_pred_costs.Length(); ++i)
+ {
+ stream >> me_data.Vectors(i);
+ stream >> me_data.PredCosts(i);
+ //stream >> me_data.GlobalMotionParameters(i);
+ //stream >> me_data.GlobalMotionVectors(i);
+ //stream >> me_data.GlobalMotionInliers(i);
+ }
+
+ return stream;
+}
+
+// Overriden operator for output of MvData member data (to file)
+ostream &operator<< (ostream & stream, MEData & me_data)
+{
+ // output reference-independent information
+ stream << endl << endl << me_data.MBSplit();
+ stream << endl << me_data.MBCommonMode();
+ stream << endl << me_data.MBCosts();
+ stream << endl << me_data.Mode();
+ stream << endl << me_data.IntraCosts() << endl;
+
+ if (me_data.m_pred_costs.Length() > 1)
+ stream << me_data.BiPredCosts();
+
+ // output component DC values
+ if (me_data.DC().Length() == 1)
+ {
+ stream << endl << me_data.DC( Y_COMP );
+ }
+ else if (me_data.DC().Length() == 3)
+ {
+ stream << endl << me_data.DC( Y_COMP );
+ stream << endl << me_data.DC( U_COMP );
+ stream << endl << me_data.DC( V_COMP );
+ }
+
+ // output reference information
+ for (int i=1; i<=me_data.m_pred_costs.Length(); ++i)
+ {
+ stream << endl << me_data.Vectors(i);
+ stream << endl << me_data.PredCosts(i) << endl;
+ //stream << endl << me_data.GlobalMotionParameters(i) << endl;
+ //stream << endl << me_data.GlobalMotionVectors(i) << endl;
+ //stream << endl << me_data.GlobalMotionInliers(i) << endl;
+ }
+
+ return stream;
+}
+
+} // namespace dirac
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/motion.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/motion.h
new file mode 100644
index 000000000..4fd158a95
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/motion.h
@@ -0,0 +1,550 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: motion.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Chris Bowley
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_common/common.h>
+#include <algorithm>
+#ifndef _MOTION_H
+#define _MOTION_H
+
+namespace dirac
+{
+ ////////////////////////////////////////////////////////////////
+ //classes and functions for motion estimation and compensation//
+ ////////////////////////////////////////////////////////////////
+
+ //classes
+
+ //! Motion vector class - just a pair
+ template <class T>
+ class MotionVector
+ {
+ public:
+
+ //! Constructor
+ MotionVector<T>(T a, T b) : x(a), y(b) {};
+ //! Default construct - sets components to 0
+ MotionVector<T>() : x(0), y(0) {};
+ //! Constructor
+ MotionVector<T>(T a) : x(a), y(a) {};
+
+ //! Addition
+ inline MotionVector<T> operator+(const MotionVector<T>& argument) const;
+
+ //! Subtraction
+ inline MotionVector<T> operator-(const MotionVector<T>& argument) const;
+
+ //! Scalar multiplication
+ inline MotionVector<T> operator*(const float argument) const;
+
+ //! Scalar multiplication
+ inline MotionVector<T> operator*(const int argument) const;
+
+ //! Bitshift of each component
+ inline MotionVector<T> operator<<(const int argument) const;
+
+ //! Bitshift of each component
+ inline MotionVector<T> operator>>(const int argument) const;
+
+
+ //! x and y components
+ T x,y;
+
+ };
+
+
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator+(const MotionVector<T>& argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x + argument.x;
+ temp.y = y + argument.y;
+
+ return temp;
+ }
+
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator-(const MotionVector<T>& argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x-argument.x;
+ temp.y = y-argument.y;
+
+ return temp;
+ }
+
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator*(const float argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x*argument;
+ temp.y = y*argument;
+
+ return temp;
+ }
+
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator*(const int argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x*argument;
+ temp.y = y*argument;
+
+ return temp;
+ }
+
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator<<(const int argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x<<argument;
+ temp.y = y<<argument;
+
+ return temp;
+ }
+
+ template <class T>
+ inline MotionVector<T> MotionVector<T>::operator>>(const int argument) const
+ {
+ MotionVector<T> temp;
+ temp.x = x>>argument;
+ temp.y = y>>argument;
+
+ return temp;
+ }
+
+ //! Overloaded operator<< for MotionVector class for output to stream
+ template <class T>
+ std::ostream & operator<< (std::ostream & stream, MotionVector<T> & mv)
+ {
+ stream << mv.x << " " << mv.y;
+
+ return stream;
+ }
+
+ //! Overloaded operator>> for MotionVector class for input from stream
+ template <class T>
+ std::istream & operator>> (std::istream & stream, MotionVector<T> & mv)
+ {
+ stream >> mv.x;
+ stream >> mv.y;
+
+ return stream;
+ }
+
+ //! MVector class is a vector of ints
+ typedef MotionVector<int> MVector;
+
+ //! ImageCoords class is a vector of ints
+ typedef MotionVector<int> ImageCoords;
+
+ //! MvArray is a two-D array of MVectors
+ typedef TwoDArray<MVector> MvArray;
+
+ //! An array of float-based motion vectors for doing global motion calcs
+ typedef TwoDArray< MotionVector<float> > MvFloatArray;
+
+ //! Class for recording costs derived in motion estimation
+ class MvCostData
+ {
+ public:
+ //! Constructor
+ MvCostData():
+ SAD(0.0),
+ mvcost(0.0),
+ total(0.0){}
+
+ void SetTotal( const float lambda ){total = SAD + lambda*mvcost;}
+
+ //! The Sum of Absolute Differences - easier to compute than Sum-Squared Differences
+ float SAD;
+
+ //! The (Lagrangian-weighted) motion vector cost - the difference of a motion vector from its neighbouring vectors
+ float mvcost;
+
+ //! Total=SAD+mvcost
+ float total;
+ };
+
+
+ //! Class for all the motion vector data
+ /*!
+ Motion vector data: the motion vectors themselves, the blocks
+ and macroblock modes.
+ */
+ class MvData
+ {
+ public:
+ //! Constructor
+ /*!
+ Constructor takes:
+ \param xnumMB the number of MBs horizontally
+ \param ynumMB the number of MBs vertically
+ \param xnumblocks the number of blocks horizontally
+ \param ynumblocks the number of blocks vertically
+ \param num_refs the number of references being used for the frame
+ */
+ MvData( const int xnumMB, int ynumMB ,
+ const int xnumblocks, int ynumblocks , const int num_refs = 2);
+
+ //! Constructor
+ /*!
+ Constructor. Numbers of blocks derived from the number of MBs
+ \param xnumMB the number of MBs horizontally
+ \param ynumMB the number of MBs vertically
+ \param num_refs the number of references being used for the frame
+ */
+ MvData( const int xnumMB, int ynumMB , const int num_refs = 2);
+
+ //! Destructor
+ ~MvData();
+
+ //! Get the MVs for a reference
+ MvArray& Vectors(const int ref_id){return *( m_vectors[ref_id] );}
+
+ //! Get the MVs for a reference
+ const MvArray& Vectors(const int ref_id) const {return *( m_vectors[ref_id] );}
+
+ //! Get the global MVs for a reference
+ MvArray& GlobalMotionVectors(const int ref_id){return *( m_gm_vectors[ref_id] );}
+
+ //! Get the global MVs for a reference
+ const MvArray& GlobalMotionVectors(const int ref_id) const {return *( m_gm_vectors[ref_id] );}
+
+ //! Get the DC values for each component
+ TwoDArray<ValueType>& DC(CompSort cs){return *( m_dc[cs] );}
+
+ //! Get the DC values for each component
+ const TwoDArray<ValueType>& DC(CompSort cs) const {return *( m_dc[cs] );}
+
+ //! Get a reference to the vector holding component DC values
+ const OneDArray< TwoDArray<ValueType>* >& DC() const {return m_dc;}
+
+ //! Get the block prediction modes
+ TwoDArray<PredMode>& Mode(){return m_modes;}
+
+ //! Get the block prediction modes
+ const TwoDArray<PredMode>& Mode() const {return m_modes;}
+
+ //! Get the MB split level
+ TwoDArray<int>& MBSplit(){return m_mb_split;}
+
+ //! Get the MB split level
+ const TwoDArray<int>& MBSplit() const{return m_mb_split;}
+
+ //! Get the MB common mode parameters
+ TwoDArray<bool>& MBCommonMode(){return m_mb_common;}
+
+ //! Get the MB common mode parameters
+ const TwoDArray<bool>& MBCommonMode() const{return m_mb_common;}
+
+ //! Get the global motion model parameters
+ OneDArray<float>& GlobalMotionParameters(const int ref_id) { return *( m_gm_params[ref_id] ); }
+
+ //! Get the global motion model parameters
+ const OneDArray<float>& GlobalMotionParameters(const int ref_id) const { return *( m_gm_params[ref_id] ); }
+
+ private:
+ // Initialises the arrays of data
+ void InitMvData();
+
+ // The motion vectors
+ OneDArray<MvArray*> m_vectors;
+
+ // The global motion vectors
+ OneDArray<MvArray*> m_gm_vectors;
+
+ // The block modes
+ TwoDArray<PredMode> m_modes;
+
+ // The DC values
+ OneDArray< TwoDArray<ValueType>* > m_dc;
+
+ // The MB split levels
+ TwoDArray<int> m_mb_split;
+
+ // The MB common mode indicators
+ TwoDArray<bool> m_mb_common;
+
+ // Global motion model parameters
+ OneDArray< OneDArray<float>* > m_gm_params;
+ };
+
+ //! Class for all the motion estimation data
+ /*!
+ Motion estimation data: derived from MvData class, also
+ incorporates costs for blocks and macroblocks
+ */
+
+ class MEData: public MvData
+ {
+ public:
+
+ //! Constructor
+ /*!
+ Constructor takes:
+ \param xnumMB the number of MBs horizontally
+ \param ynumMB the number of MBs vertically
+ \param xnumblocks the number of blocks horizontally
+ \param ynumblocks the number of blocks vertically
+ \param num_refs the number of references being used for the frame
+ */
+ MEData( const int xnumMB, const int ynumMB ,
+ const int xnumblocks, const int ynumblocks , const int num_refs = 2);
+
+ //! Constructor
+ /*!
+ Constructor. Numbers of blocks derived from the number of MBs
+ \param xnumMB the number of MBs horizontally
+ \param ynumMB the number of MBs vertically
+ \param num_refs the number of references being used for the frame
+ */
+ MEData( const int xnumMB, const int ynumMB , const int num_refs = 2);
+
+ //! Destructor
+ ~MEData();
+
+ //! Get the block cost structures for each reference
+ TwoDArray<MvCostData>& PredCosts(const int ref_id){ return *( m_pred_costs[ref_id] ); }
+
+ //! Get the block cost structures for each reference
+ const TwoDArray<MvCostData>& PredCosts(const int ref_id) const { return *( m_pred_costs[ref_id] ); }
+
+ //! Get the intra costs
+ TwoDArray<float>& IntraCosts(){ return m_intra_costs; }
+
+ //! Get the intra costs
+ const TwoDArray<float>& IntraCosts() const { return m_intra_costs; }
+
+ //! Get the bipred costs
+ TwoDArray<MvCostData>& BiPredCosts(){ return m_bipred_costs; }
+
+ //! Get the bipred costs
+ const TwoDArray<MvCostData>& BiPredCosts() const { return m_bipred_costs; }
+
+ //! Get the MB costs
+ TwoDArray<float>& MBCosts(){ return m_MB_costs; }
+
+ //! Get the MB costs
+ const TwoDArray<float>& MBCosts() const { return m_MB_costs; }
+
+ //! Set up the lambda map by detecting motion discontinuities
+ void SetLambdaMap( const int num_refs , const float lambda );
+
+ //! Set up the lambda map by averaging the lambda map from a lower level
+ void SetLambdaMap( const int level , const TwoDArray<float>& l_map , const float wt );
+
+ //! Get a lambda value for a given block and level
+ const TwoDArray<float>& LambdaMap() const { return m_lambda_map; }
+
+ //! Get the inliers for each reference
+ TwoDArray<int>& GlobalMotionInliers(const int ref_id){ return *( m_inliers[ref_id] ); }
+
+ //! Get the inliers for each reference
+ const TwoDArray<int>& GlobalMotionInliers(const int ref_id) const { return *( m_inliers[ref_id] ); }
+
+ //! Overloaded operator<< for outputing to (file) stream
+ friend std::ostream &operator<< (std::ostream & stream, MEData & me_data);
+
+ //! Overloaded operator>> for input of data from (file) stream
+ friend std::istream &operator>> (std::istream & stream, MEData & me_data);
+
+ private:
+ // Initialises the arrays of data
+ void InitMEData();
+
+ // Finds transitions in the motion vectors
+ void FindTransitions( TwoDArray<bool>& trans_map , const int ref_num );
+
+ // The costs of predicting each block, for each reference
+ OneDArray< TwoDArray<MvCostData>* > m_pred_costs;
+
+ // The costs of predicting each block by DC
+ TwoDArray<float> m_intra_costs;
+
+ // The costs of predicting each block bidirectionally
+ TwoDArray<MvCostData> m_bipred_costs;
+
+ // The costs for each macroblock as a whole
+ TwoDArray<float> m_MB_costs;
+
+ // A map of the lambda values to use
+ TwoDArray<float> m_lambda_map;
+
+ // Global motion inliers
+ OneDArray< TwoDArray<int>* > m_inliers;
+
+ };
+
+ //motion estimation and coding stuff
+
+ //! Return the median of three motion vectors
+ inline MVector MvMedian(const MVector& mv1,const MVector& mv2,const MVector& mv3) {
+ //takes median of each vector component
+ MVector tmp_mv;
+
+ tmp_mv.x=mv1.x;
+ tmp_mv.x+=mv2.x;
+ tmp_mv.x+=mv3.x;
+
+ tmp_mv.x-=std::max(std::max(mv1.x,mv2.x),mv3.x);
+ tmp_mv.x-=std::min(std::min(mv1.x,mv2.x),mv3.x);
+
+ tmp_mv.y=mv1.y;
+ tmp_mv.y+=mv2.y;
+ tmp_mv.y+=mv3.y;
+
+ tmp_mv.y-=std::max(std::max(mv1.y,mv2.y),mv3.y);
+ tmp_mv.y-=std::min(std::min(mv1.y,mv2.y),mv3.y);
+
+ return tmp_mv;
+ }
+
+ //! Return the median of a set of motion vectors
+ inline MVector MvMedian(const std::vector<MVector>& vect_list){
+ //more general median. Takes the median of each vector component
+
+ MVector median;
+ int num_vals=int(vect_list.size());
+ if (num_vals>0) {
+ int pos=0;
+ std::vector<int> ordered_vals(vect_list.size());
+ //do x first
+ ordered_vals[0]=vect_list[0].x;
+ for (int I=1;I<num_vals;++I){
+ for (int K=0;K<I;++K){
+ if (vect_list[I].x<ordered_vals[K]){
+ pos=K;
+ break;
+ }
+ else
+ pos=K+1;
+ }//K
+ if (pos==I)
+ ordered_vals[I]=vect_list[I].x;
+ else{
+ for (int K=pos;K>=I-1;--K){
+ ordered_vals[K+1]=ordered_vals[K];
+ }
+ ordered_vals[pos]=vect_list[I].x;
+ }
+ }//I
+ if (vect_list.size()%2!=0)
+ median.x=ordered_vals[(num_vals-1)/2];
+ else
+ median.x=(ordered_vals[(num_vals/2)-1]+ordered_vals[num_vals/2])/2;
+
+ //now do y
+ ordered_vals[0]=vect_list[0].y;
+ for (int I=1;I<num_vals;++I){
+ for (int K=0;K<I;++K){
+ if (vect_list[I].y<ordered_vals[K]){
+ pos=K;
+ break;
+ }
+ else
+ pos=K+1;
+ }//K
+ if (pos==I)
+ ordered_vals[I]=vect_list[I].y;
+ else{
+ for (int K=pos;K>=I-1;--K){
+ ordered_vals[K+1]=ordered_vals[K];
+ }
+ ordered_vals[pos]=vect_list[I].y;
+ }
+ }//I
+ if (num_vals%2!=0)
+ median.y=ordered_vals[(num_vals-1)/2];
+ else
+ median.y=(ordered_vals[(num_vals/2)-1]+ordered_vals[num_vals/2])/2;
+
+ }
+ else{
+ median.x=0;
+ median.y=0;
+ }
+ return median;
+ }
+
+ //! Return the mean of two motion vectors
+ inline MVector MvMean(MVector& mv1,MVector& mv2) {
+ //takes median of each vector component
+ MVector tmp_mv;
+
+ tmp_mv.x=mv1.x;
+ tmp_mv.x+=mv2.x;
+ tmp_mv.x/=2;
+
+ tmp_mv.y=mv1.y;
+ tmp_mv.y+=mv2.y;
+ tmp_mv.y/=2;
+
+ return tmp_mv;
+ }
+
+ //! Return the squared length of a motion vector
+ inline int Norm2(const MVector& mv){//L^2 norm of a motion vector
+ return mv.x*mv.x+mv.y*mv.y;
+ }
+
+ //! Return the sum of the lengths of a motion vector's componets
+ inline int Norm1(const MVector& mv){//L^1 norm of a motion vector
+ return abs(mv.x)+abs(mv.y);
+ }
+
+ //! Return the mean of a set of integer values
+ inline int GetMean(std::vector<int>& values){
+ int sum=0;
+ for (unsigned int I=0;I<values.size();++I)
+ sum+=values[I];
+ sum/=int(values.size());
+ return sum;
+ }
+
+ //! Return the mean of a set of unsigned integer values
+ inline unsigned int GetMean(std::vector<unsigned int>& values){
+ int sum=0;
+ for (unsigned int I=0;I<values.size();++I)
+ sum+=values[I];
+ sum+=(values.size()>>1);
+ sum/=values.size();
+ return sum;
+ }
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/mv_codec.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/mv_codec.cpp
new file mode 100644
index 000000000..53bf5dc9a
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/mv_codec.cpp
@@ -0,0 +1,972 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: mv_codec.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_common/mv_codec.h>
+using namespace dirac;
+
+//public functions//
+////////////////////
+// Constructor for encoding
+MvDataCodec::MvDataCodec(BasicOutputManager* bits_out,
+ size_t number_of_contexts,
+ const ChromaFormat& cf)
+ : ArithCodec <MvData> (bits_out,number_of_contexts),
+ m_cformat(cf)
+{
+ // nada
+}
+
+// Constructor for decoding
+MvDataCodec::MvDataCodec(BitInputManager* bits_in,
+ size_t number_of_contexts,
+ const ChromaFormat& cf)
+ : ArithCodec <MvData> (bits_in,number_of_contexts),
+ m_cformat(cf)
+{
+ // nada
+}
+
+void MvDataCodec::InitContexts()
+{
+ for (size_t i = 0; i < m_context_list.size(); ++i)
+ m_context_list[i].SetCounts(1,1);
+}
+
+
+
+//protected functions//
+///////////////////////
+
+inline void MvDataCodec::Resize(const int context_num)
+{
+ m_context_list[context_num].HalveCounts();
+}
+
+
+inline void MvDataCodec::Update( const bool symbol , const int context_num )
+{
+ m_context_list[context_num].IncrCount( symbol , 1 );
+
+ if ( m_context_list[context_num].Weight() >= 1024 )
+ Resize( context_num );
+}
+inline void MvDataCodec::ResetAll() {}
+
+//coding functions//
+////////////////////
+
+//prediction functions
+
+//basic context functions
+
+inline int MvDataCodec::ChooseContext(const MvData& data, const int BinNumber) const
+{
+ return 0;
+}
+
+inline int MvDataCodec::ChooseContext(const MvData& data) const
+{
+ return 0;
+}
+
+inline int MvDataCodec::ChooseSignContext(const MvData& data) const
+{
+ return 0;
+}
+
+//proper context functions
+
+inline int MvDataCodec::ChooseMBSContext(const MvData& data, const int BinNumber) const
+{
+ if (BinNumber == 1)
+ return MB_SPLIT_BIN1_CTX;
+ else
+ return MB_SPLIT_BIN2_CTX;
+}
+
+inline int MvDataCodec::ChooseMBCContext(const MvData& data) const
+{
+ return MB_CMODE_CTX;
+}
+
+inline int MvDataCodec::ChoosePredContext(const MvData& data, const int BinNumber) const
+{
+ if (BinNumber == 1)
+ return PMODE_BIN1_CTX;
+ else if (BinNumber == 2)
+ return PMODE_BIN2_CTX;
+ else
+ return PMODE_BIN3_CTX;
+}
+
+inline int MvDataCodec::ChooseREF1xContext(const MvData& data, const int BinNumber) const
+{
+ if (BinNumber == 1)
+ return REF1x_BIN1_CTX;
+ else if (BinNumber == 2)
+ return REF1x_BIN2_CTX;
+ else if (BinNumber == 3)
+ return REF1x_BIN3_CTX;
+ else if (BinNumber == 4)
+ return REF1x_BIN4_CTX;
+ else
+ return REF1x_BIN5plus_CTX;
+}
+
+inline int MvDataCodec::ChooseREF1xSignContext(const MvData& data) const
+{
+ return REF1x_SIGN0_CTX;
+}
+
+inline int MvDataCodec::ChooseREF1yContext(const MvData& data, const int BinNumber) const
+{
+ if (BinNumber == 1)
+ return REF1y_BIN1_CTX;
+ else if (BinNumber == 2)
+ return REF1y_BIN2_CTX;
+ else if (BinNumber == 3)
+ return REF1y_BIN3_CTX;
+ else if (BinNumber == 4)
+ return REF1y_BIN4_CTX;
+ else
+ return REF1y_BIN5plus_CTX;
+}
+
+inline int MvDataCodec::ChooseREF1ySignContext(const MvData& data) const
+{
+ return REF1y_SIGN0_CTX;
+}
+
+inline int MvDataCodec::ChooseREF2xContext(const MvData& data, const int BinNumber) const
+{
+ if (BinNumber == 1)
+ return REF2x_BIN1_CTX;
+ else if (BinNumber == 2)
+ return REF2x_BIN2_CTX;
+ else if (BinNumber == 3)
+ return REF2x_BIN3_CTX;
+ else if (BinNumber == 4)
+ return REF2x_BIN4_CTX;
+ else
+ return REF2x_BIN5plus_CTX;
+}
+
+inline int MvDataCodec::ChooseREF2xSignContext(const MvData& data) const
+{
+ return REF2x_SIGN0_CTX;
+}
+
+inline int MvDataCodec::ChooseREF2yContext(const MvData& data, const int BinNumber) const
+{
+ if (BinNumber == 1)
+ return REF2y_BIN1_CTX;
+ else if (BinNumber == 2)
+ return REF2y_BIN2_CTX;
+ else if (BinNumber == 3)
+ return REF2y_BIN3_CTX;
+ else if (BinNumber == 4)
+ return REF2y_BIN4_CTX;
+ else
+ return REF2y_BIN5plus_CTX;
+}
+
+inline int MvDataCodec::ChooseREF2ySignContext(const MvData& data) const
+{
+ return REF2y_SIGN0_CTX;
+}
+
+inline int MvDataCodec::ChooseYDCContext(const MvData& data, const int BinNumber) const
+{
+ if (BinNumber == 1)
+ return YDC_BIN1_CTX;
+ else
+ return YDC_BIN2plus_CTX;
+}
+
+inline int MvDataCodec::ChooseUDCContext(const MvData& data, const int BinNumber) const
+{
+ if (BinNumber == 1)
+ return UDC_BIN1_CTX;
+ else
+ return UDC_BIN2plus_CTX;
+}
+
+inline int MvDataCodec::ChooseVDCContext(const MvData& data, const int BinNumber) const
+{
+ if (BinNumber == 1)
+ return VDC_BIN1_CTX;
+ else
+ return VDC_BIN2plus_CTX;
+}
+
+inline int MvDataCodec::ChooseYDCSignContext(const MvData& data) const
+{
+ return YDC_SIGN0_CTX;
+}
+
+inline int MvDataCodec::ChooseUDCSignContext(const MvData& data) const
+{
+ return UDC_SIGN0_CTX;
+}
+
+inline int MvDataCodec::ChooseVDCSignContext(const MvData& data) const
+{
+ return VDC_SIGN0_CTX;
+}
+
+inline unsigned int MvDataCodec::MBSplitPrediction(const TwoDArray<int> & split_data ) const
+{
+ int result = 0;
+
+ std::vector < unsigned int > nbrs;
+
+ if (mb_xp > 0 && mb_yp > 0)
+ {
+ nbrs.push_back( split_data[mb_yp-1][mb_xp] );
+ nbrs.push_back( split_data[mb_yp-1][mb_xp-1] );
+ nbrs.push_back( split_data[mb_yp][mb_xp-1] );
+
+ result = GetMean(nbrs);
+ }
+ else if (mb_xp > 0 && mb_yp == 0)
+ result = split_data[mb_yp][mb_xp-1];
+ else if (mb_xp == 0 && mb_yp > 0)
+ result = split_data[mb_yp-1][mb_xp];
+
+ return result;
+}
+
+inline bool MvDataCodec::MBCBModePrediction(const TwoDArray <bool> & cbm_data) const
+{
+ bool result = true;
+ std::vector < unsigned int > nbrs;
+
+ if (mb_xp > 0 && mb_yp > 0)
+ {
+ nbrs.push_back( (unsigned int)( cbm_data[mb_yp-1][mb_xp] ) );
+ nbrs.push_back( (unsigned int)( cbm_data[mb_yp-1][mb_xp-1] ) );
+ nbrs.push_back( (unsigned int)( cbm_data[mb_yp][mb_xp-1] ) );
+
+ result = bool(GetMean(nbrs));
+ }
+ else if (mb_xp > 0 && mb_yp == 0)
+ result = cbm_data[mb_yp][mb_xp-1];
+ else if (mb_xp == 0 && mb_yp > 0)
+ result = cbm_data[mb_yp-1][mb_xp];
+
+ return result;
+}
+
+inline unsigned int MvDataCodec::BlockModePrediction(const TwoDArray < PredMode > & preddata) const
+{
+ unsigned int result = (unsigned int)(REF1_ONLY);
+ std::vector <unsigned int> nbrs;
+
+ if (b_xp > 0 && b_yp > 0)
+ {
+ nbrs.push_back( (unsigned int)( preddata[b_yp-1][b_xp] ) );
+ nbrs.push_back( (unsigned int)( preddata[b_yp-1][b_xp-1] ) );
+ nbrs.push_back( (unsigned int)( preddata[b_yp][b_xp-1] ) );
+
+ result = GetMean(nbrs);
+ }
+ else if (b_xp > 0 && b_yp == 0)
+ result = preddata[b_yp][b_xp-1];
+ else if (b_xp == 0 && b_yp > 0)
+ result = preddata[b_yp-1][b_xp];
+
+ return result;
+}
+
+inline MVector MvDataCodec::Mv1Prediction(const MvArray& mvarray,
+ const TwoDArray < PredMode > & preddata) const
+{
+ std::vector <MVector> nbrs;
+ PredMode pmode;
+ MVector result;
+
+ if (b_xp > 0 && b_yp > 0)
+ {
+ pmode = preddata[b_yp-1][b_xp];
+ if (pmode == REF1_ONLY || pmode == REF1AND2)
+ nbrs.push_back(mvarray[b_yp-1][b_xp]);
+
+ pmode = preddata[b_yp-1][b_xp-1];
+ if (pmode == REF1_ONLY || pmode == REF1AND2)
+ nbrs.push_back(mvarray[b_yp-1][b_xp-1]);
+
+ pmode = preddata[b_yp][b_xp-1];
+ if (pmode == REF1_ONLY || pmode == REF1AND2)
+ nbrs.push_back(mvarray[b_yp][b_xp-1]);
+
+ if (nbrs.size() > 0)
+ result = MvMedian(nbrs);
+ }
+ else if (b_xp > 0 && b_yp == 0)
+ {
+ pmode = preddata[0][b_xp-1];
+ if (pmode == REF1_ONLY || pmode == REF1AND2)
+ result = mvarray[0][b_xp-1];
+ }
+ else if (b_xp == 0 && b_yp > 0)
+ {
+ pmode = preddata[b_yp-1][0];
+ if (pmode == REF1_ONLY || pmode == REF1AND2)
+ result = mvarray[b_yp-1][0];
+ }
+
+ return result;
+}
+
+inline MVector MvDataCodec::Mv2Prediction(const MvArray & mvarray,
+ const TwoDArray < PredMode > & preddata) const
+{
+ std::vector <MVector> nbrs;
+ PredMode pmode;
+ MVector result;
+
+ if (b_xp > 0 && b_yp > 0)
+ {
+ pmode = preddata[b_yp-1][b_xp];
+ if (pmode == REF2_ONLY || pmode == REF1AND2)
+ nbrs.push_back(mvarray[b_yp-1][b_xp]);
+
+ pmode = preddata[b_yp-1][b_xp-1];
+ if (pmode == REF2_ONLY || pmode == REF1AND2)
+ nbrs.push_back(mvarray[b_yp-1][b_xp-1]);
+
+ pmode = preddata[b_yp][b_xp-1];
+ if (pmode == REF2_ONLY || pmode == REF1AND2)
+ nbrs.push_back(mvarray[b_yp][b_xp-1]);
+
+ if (nbrs.size() > 0)
+ result = MvMedian(nbrs);
+ }
+ else if (b_xp > 0 && b_yp == 0)
+ {
+ pmode = preddata[0][b_xp-1];
+ if(pmode == REF2_ONLY || pmode == REF1AND2)
+ result = mvarray[0][b_xp-1];
+ }
+ else if (b_xp == 0 && b_yp > 0)
+ {
+ pmode = preddata[b_yp-1][0];
+ if(pmode == REF2_ONLY || pmode == REF1AND2)
+ result = mvarray[b_yp-1][0];
+ }
+
+ return result;
+}
+
+inline ValueType MvDataCodec::DCPrediction(const TwoDArray < ValueType > & dcdata,
+ const TwoDArray < PredMode > & preddata) const
+{
+ std::vector < int > nbrs;
+ PredMode pmode;
+ ValueType result = 128;
+
+ if (b_xp > 0 && b_yp > 0)
+ {
+ pmode = preddata[b_yp-1][b_xp];
+ if (pmode == INTRA)
+ nbrs.push_back(int(dcdata[b_yp-1][b_xp]));
+
+ pmode = preddata[b_yp-1][b_xp-1];
+ if (pmode == INTRA)
+ nbrs.push_back(int(dcdata[b_yp-1][b_xp-1]));
+
+ pmode = preddata[b_yp][b_xp-1];
+ if (pmode == INTRA)
+ nbrs.push_back(int(dcdata[b_yp][b_xp-1]));
+
+ if (nbrs.size() > 0)
+ result = ValueType(GetMean(nbrs));
+ }
+ else if (b_xp > 0 && b_yp == 0)
+ {
+ pmode = preddata[0][b_xp-1];
+ if (pmode == INTRA)
+ result = dcdata[0][b_xp-1];
+ }
+ else if (b_xp == 0 && b_yp > 0)
+ {
+ pmode = preddata[b_yp-1][0];
+ if (pmode == INTRA)
+ result = dcdata[b_yp-1][0];
+ }
+
+ return result;
+}
+
+
+void MvDataCodec::DoWorkCode( MvData& in_data )
+{
+ int step,max;
+ int pstep,pmax;
+ int split_depth;
+ bool common_ref;
+
+ MB_count = 0;
+
+ for (mb_yp = 0, mb_tlb_y = 0; mb_yp < in_data.MBSplit().LengthY(); ++mb_yp, mb_tlb_y += 4)
+ {
+ for (mb_xp = 0,mb_tlb_x = 0; mb_xp < in_data.MBSplit().LengthX(); ++mb_xp,mb_tlb_x += 4)
+ {
+ //start with split mode
+ CodeMBSplit(in_data);
+ split_depth = in_data.MBSplit()[mb_yp][mb_xp];
+
+ step = 4 >> (split_depth);
+ max = (1 << split_depth);
+
+ //next do common_ref
+ if(split_depth != 0)
+ {
+ CodeMBCom(in_data);
+ pstep = step;
+ pmax = max;
+ }
+ else
+ {
+ pstep = 4;
+ pmax = 1;
+ }
+ common_ref = in_data.MBCommonMode()[mb_yp][mb_xp];
+
+
+ //do prediction modes
+ for (b_yp = mb_tlb_y; b_yp < mb_tlb_y+4; b_yp += pstep)
+ for (b_xp = mb_tlb_x; b_xp < mb_tlb_x+4; b_xp += pstep)
+ CodePredmode(in_data);
+
+ step = 4 >> (split_depth);
+
+ //now do all the block mvs in the mb
+ for (b_yp = mb_tlb_y; b_yp < mb_tlb_y+4; b_yp += step)
+ {
+ for (b_xp = mb_tlb_x; b_xp < mb_tlb_x+4; b_xp += step)
+ {
+ if (in_data.Mode()[b_yp][b_xp] == REF1_ONLY || in_data.Mode()[b_yp][b_xp] == REF1AND2 )
+ CodeMv1(in_data);
+
+ if (in_data.Mode()[b_yp][b_xp] == REF2_ONLY || in_data.Mode()[b_yp][b_xp] == REF1AND2 )
+ CodeMv2(in_data);
+
+ if(in_data.Mode()[b_yp][b_xp] == INTRA)
+ CodeDC(in_data);
+ }//b_xp
+ }//b_yp
+
+ //TODO: Update all contexts here?
+
+ }//mb_xp
+ }//mb_yp
+
+}
+
+
+void MvDataCodec::CodeMBSplit(const MvData& in_data)
+{
+ int val = in_data.MBSplit()[mb_yp][mb_xp] - MBSplitPrediction( in_data.MBSplit() );
+
+ if (val < 0)
+ val += 3; //produce prediction mod 3
+
+ int ctx;
+
+ for (int bin = 1; bin <= val; ++bin)
+ {
+ ctx = ChooseMBSContext(in_data,bin);
+ EncodeSymbol(0,ctx);
+ }
+
+ if (val != 2)//if we've had two zeroes, know we must have value 2
+ EncodeSymbol(1,ChooseMBSContext(in_data,val+1));
+}
+
+void MvDataCodec::CodeMBCom(const MvData& in_data)
+{
+ bool val = in_data.MBCommonMode()[mb_yp][mb_xp];
+
+ if (val != MBCBModePrediction( in_data.MBCommonMode() ))
+ EncodeSymbol( 1 , ChooseMBCContext( in_data ) );
+ else
+ EncodeSymbol( 0 , ChooseMBCContext( in_data ) );
+}
+
+void MvDataCodec::CodePredmode(const MvData& in_data)
+{
+ int val = in_data.Mode()[b_yp][b_xp] - BlockModePrediction( in_data.Mode() );
+
+ if (val < 0)
+ val += 4; //produce value mod 4
+
+ for (int bin = 1; bin<= val; ++bin)
+ EncodeSymbol( 0 , ChoosePredContext( in_data , bin ) );
+
+ if (val != 3) //if we've had three zeroes, know we must have value 3
+ EncodeSymbol( 1 , ChoosePredContext( in_data , val + 1 ) );
+}
+
+void MvDataCodec::CodeMv1(const MvData& in_data )
+{
+ const MvArray& mv_array = in_data.Vectors(1);
+ const MVector pred = Mv1Prediction( mv_array , in_data.Mode() );
+
+ const int valx = mv_array[b_yp][b_xp].x - pred.x;
+ const int abs_valx = std::abs(valx);
+
+ for (int bin = 1; bin <= abs_valx; ++bin)
+ EncodeSymbol( 0 , ChooseREF1xContext( in_data , bin ) );
+
+ EncodeSymbol( 1 , ChooseREF1xContext( in_data , abs_valx + 1 ) );
+
+ if (valx != 0)
+ EncodeSymbol( ( (valx > 0)? 1 : 0) , ChooseREF1xSignContext( in_data ) );
+
+ const int valy = mv_array[b_yp][b_xp].y - pred.y;
+ const int abs_valy = std::abs( valy );
+
+ for (int bin = 1; bin<=abs_valy ; ++bin )
+ EncodeSymbol( 0 , ChooseREF1yContext( in_data , bin ) );
+
+ EncodeSymbol( 1 , ChooseREF1yContext( in_data , abs_valy + 1 ) );
+
+ if (valy != 0)
+ EncodeSymbol( ( (valy > 0)? 1 : 0) , ChooseREF1ySignContext( in_data ) );
+}
+
+void MvDataCodec::CodeMv2(const MvData& in_data)
+{
+ const MvArray& mv_array = in_data.Vectors(2);
+ const MVector pred = Mv2Prediction( mv_array , in_data.Mode() );
+
+ const int valx = mv_array[b_yp][b_xp].x - pred.x;
+ const int abs_valx = abs(valx);
+
+ for (int bin = 1; bin <= abs_valx; ++bin)
+ EncodeSymbol( 0 , ChooseREF2xContext( in_data , bin ) );
+
+ EncodeSymbol( 1 , ChooseREF2xContext( in_data , abs_valx + 1 ) );
+
+ if (valx != 0)
+ EncodeSymbol( ( (valx > 0)? 1 : 0) , ChooseREF2xSignContext( in_data ) );
+
+ const int valy = mv_array[b_yp][b_xp].y-pred.y;
+ const int abs_valy = std::abs(valy);
+
+ for (int bin = 1; bin<=abs_valy; ++bin )
+ EncodeSymbol( 0 , ChooseREF2yContext( in_data , bin ) );
+
+ EncodeSymbol( 1 , ChooseREF2yContext( in_data , abs_valy + 1 ) );
+
+ if (valy != 0)
+ EncodeSymbol( ( (valy > 0)? 1 : 0) , ChooseREF2ySignContext( in_data ) );
+}
+
+void MvDataCodec::CodeDC(const MvData& in_data)
+{
+ //begin with Y DC value
+ const ValueType valY = in_data.DC( Y_COMP )[b_yp][b_xp]
+ - DCPrediction( in_data.DC(Y_COMP) , in_data.Mode() );
+ const ValueType abs_valY = std::abs( valY );
+
+ for (ValueType bin = 1; bin <= abs_valY; ++bin)
+ EncodeSymbol( 0 , ChooseYDCContext( in_data , bin ) );
+
+ EncodeSymbol( 1 , ChooseYDCContext (in_data , abs_valY + 1 ) );
+
+ if (valY != 0)
+ EncodeSymbol( ( (valY > 0)? 1 : 0) , ChooseYDCSignContext( in_data ) );
+
+ //now do U and V if necessary
+ if (m_cformat != Yonly)
+ {
+ //continue with U and V DC values
+ const int valU = in_data.DC(U_COMP)[b_yp][b_xp]
+ - DCPrediction(in_data.DC( U_COMP ) , in_data.Mode());
+ const int abs_valU = std::abs( valU );
+
+ for (ValueType bin = 1; bin<=abs_valU ; ++bin)
+ EncodeSymbol( 0 , ChooseUDCContext( in_data , bin ) );
+
+ EncodeSymbol( 1 , ChooseUDCContext( in_data , abs_valU + 1 ) );
+
+ if (valU != 0)
+ EncodeSymbol( ( (valU > 0) ? 1 : 0) , ChooseUDCSignContext( in_data ) );
+
+ const int valV = in_data.DC( V_COMP )[b_yp][b_xp]
+ - DCPrediction( in_data.DC( V_COMP ) , in_data.Mode() );
+ const int abs_valV = std::abs( valV );
+
+ for (ValueType bin = 1; bin<=abs_valV ; ++bin)
+ EncodeSymbol( 0 , ChooseVDCContext( in_data , bin ) );
+
+ EncodeSymbol( 1 , ChooseVDCContext( in_data , abs_valV + 1 ) );
+
+ if (valV != 0)
+ EncodeSymbol( ( (valV > 0)? 1 : 0) , ChooseVDCSignContext( in_data ) );
+ }
+}
+
+//decoding functions//
+//////////////////////
+
+void MvDataCodec::DoWorkDecode( MvData& out_data, int num_bits)
+{
+ int step,max;
+ int pstep,pmax;
+ int split_depth;
+ bool common_ref;
+ int xstart,ystart;
+
+ for (mb_yp = 0,mb_tlb_y = 0; mb_yp < out_data.MBSplit().LengthY(); ++mb_yp,mb_tlb_y += 4)
+ {
+ for (mb_xp = 0,mb_tlb_x = 0; mb_xp < out_data.MBSplit().LengthX(); ++mb_xp,mb_tlb_x += 4)
+ {
+ //start with split mode
+ DecodeMBSplit( out_data );
+ split_depth = out_data.MBSplit()[mb_yp][mb_xp];
+ step = 4 >> (split_depth);
+ max = (1 << split_depth);
+
+ //next do common_ref
+ if(split_depth != 0)
+ {
+ DecodeMBCom( out_data );
+ pstep = step;
+ pmax = max;
+ }
+ else
+ {
+ out_data.MBCommonMode()[mb_yp][mb_xp] = true;
+ pstep = 4;
+ pmax = 1;
+ }
+
+ common_ref = out_data.MBCommonMode()[mb_yp][mb_xp];
+
+ // do prediction modes
+ for (b_yp = mb_tlb_y; b_yp < mb_tlb_y + 4; b_yp += pstep)
+ {
+ for (b_xp = mb_tlb_x; b_xp < mb_tlb_x + 4; b_xp += pstep)
+ {
+ DecodePredmode(out_data);
+
+ // propagate throughout MB
+ for (int y = b_yp; y < b_yp + pstep; y++)
+ for (int x = b_xp; x < b_xp + pstep; x++)
+ out_data.Mode()[y][x] = out_data.Mode()[b_yp][b_xp];
+ }
+ }
+
+ //now do all the block mvs in the mb
+ for (int j = 0; j < max; ++j)
+ {
+ for (int i = 0; i < max; ++i)
+ {
+ xstart = b_xp = mb_tlb_x + i * step;
+ ystart = b_yp = mb_tlb_y + j * step;
+
+ if (out_data.Mode()[b_yp][b_xp] == REF1_ONLY || out_data.Mode()[b_yp][b_xp] == REF1AND2 )
+ DecodeMv1( out_data );
+
+ if (out_data.Mode()[b_yp][b_xp] == REF2_ONLY || out_data.Mode()[b_yp][b_xp] == REF1AND2 )
+ DecodeMv2( out_data );
+
+ if(out_data.Mode()[b_yp][b_xp] == INTRA)
+ DecodeDC( out_data );
+
+ //propagate throughout MB
+ for (b_yp = ystart; b_yp < ystart+step; b_yp++)
+ {
+ for (b_xp = xstart; b_xp < xstart+step; b_xp++)
+ {
+ out_data.Vectors(1)[b_yp][b_xp].x = out_data.Vectors(1)[ystart][xstart].x;
+ out_data.Vectors(1)[b_yp][b_xp].y = out_data.Vectors(1)[ystart][xstart].y;
+ out_data.Vectors(2)[b_yp][b_xp].x = out_data.Vectors(2)[ystart][xstart].x;
+ out_data.Vectors(2)[b_yp][b_xp].y = out_data.Vectors(2)[ystart][xstart].y;
+ out_data.DC( Y_COMP )[b_yp][b_xp] = out_data.DC( Y_COMP )[ystart][xstart];
+ out_data.DC( U_COMP )[b_yp][b_xp] = out_data.DC( U_COMP )[ystart][xstart];
+ out_data.DC( V_COMP )[b_yp][b_xp] = out_data.DC( V_COMP )[ystart][xstart];
+ }//b_xp
+ }//b_yp
+ }//i
+ }//j
+
+ }//mb_xp
+ }//mb_yp
+
+}
+
+void MvDataCodec::DecodeMBSplit(MvData& out_data)
+{
+ int val = 0;
+ int bin = 1;
+ bool bit;
+
+ do
+ {
+ DecodeSymbol( bit , ChooseMBSContext( out_data , bin ) );
+
+ if (!bit)
+ val++;
+
+ bin++;
+ }
+ while (!bit && val != 2);
+
+ out_data.MBSplit()[mb_yp][mb_xp] = ( val + MBSplitPrediction( out_data.MBSplit() ) ) % 3;
+}
+
+void MvDataCodec::DecodeMBCom( MvData& out_data )
+{
+ bool bit;
+ DecodeSymbol( bit , ChooseMBCContext( out_data ) );
+
+ if ( bit )
+ out_data.MBCommonMode()[mb_yp][mb_xp] = !MBCBModePrediction( out_data.MBCommonMode() );
+ else
+ out_data.MBCommonMode()[mb_yp][mb_xp] = MBCBModePrediction( out_data.MBCommonMode() );
+}
+
+void MvDataCodec::DecodePredmode( MvData& out_data )
+{
+ int val = 0;
+ int bin = 1;
+ bool bit;
+
+ do
+ {
+ DecodeSymbol( bit , ChoosePredContext( out_data , bin ) );
+
+ if (!bit)
+ val++;
+
+ bin++;
+ }
+ while (!bit && val != 3);
+
+ out_data.Mode()[b_yp][b_xp] = PredMode( ( val + BlockModePrediction (out_data.Mode() ) ) %4);
+}
+
+void MvDataCodec::DecodeMv1( MvData& out_data )
+{
+ MVector pred = Mv1Prediction( out_data.Vectors(1) , out_data.Mode() );
+ int val = 0;
+ int bin = 1;
+ bool bit;
+
+ do
+ {
+ DecodeSymbol( bit , ChooseREF1xContext( out_data , bin ) );
+
+ if ( !bit )
+ val++;
+
+ bin++;
+ }
+ while ( !bit );
+
+ if (val != 0)
+ {
+ DecodeSymbol( bit , ChooseREF1xSignContext( out_data ) );
+
+ if (!bit)
+ val = -val;
+ }
+
+ out_data.Vectors(1)[b_yp][b_xp].x = val + pred.x;
+
+ val = 0;
+ bin = 1;
+
+ do
+ {
+ DecodeSymbol( bit , ChooseREF1yContext( out_data , bin ) );
+
+ if ( !bit )
+ val++;
+
+ bin++;
+ }
+ while ( !bit );
+
+ if (val != 0)
+ {
+ DecodeSymbol( bit , ChooseREF1ySignContext( out_data ) );
+
+ if (!bit)
+ val = -val;
+ }
+
+ out_data.Vectors(1)[b_yp][b_xp].y = val + pred.y;
+}
+
+void MvDataCodec::DecodeMv2( MvData& out_data )
+{
+ MVector pred = Mv2Prediction( out_data.Vectors(2) , out_data.Mode() );
+ int val = 0;
+ int bin = 1;
+ bool bit;
+
+ do
+ {
+ DecodeSymbol( bit , ChooseREF2xContext( out_data , bin ) );
+
+ if ( !bit )
+ val++;
+
+ bin++;
+ }
+ while ( !bit );
+
+ if (val != 0)
+ {
+ DecodeSymbol( bit , ChooseREF2xSignContext( out_data ) );
+
+ if (!bit)
+ val = -val;
+ }
+
+ out_data.Vectors(2)[b_yp][b_xp].x = val + pred.x;
+
+ val = 0;
+ bin = 1;
+
+ do
+ {
+ DecodeSymbol( bit , ChooseREF2yContext( out_data , bin ) );
+
+ if ( !bit )
+ val++;
+
+ bin++;
+ }
+ while ( !bit );
+
+ if (val != 0)
+ {
+ DecodeSymbol( bit , ChooseREF2ySignContext( out_data ) );
+
+ if ( !bit )
+ val = -val;
+ }
+
+ out_data.Vectors(2)[b_yp][b_xp].y = val + pred.y;
+}
+
+void MvDataCodec::DecodeDC( MvData& out_data )
+{
+ //begin with Y DC value
+ ValueType val = 0;
+ int bin = 1;
+ bool bit;
+
+ do
+ {
+ DecodeSymbol( bit , ChooseYDCContext( out_data , bin ) );
+
+ if ( !bit )
+ val++;
+
+ bin++;
+ }
+ while ( !bit );
+
+ if (val != 0)
+ {
+ DecodeSymbol( bit , ChooseYDCSignContext( out_data ) );
+
+ if (!bit)
+ val = -val;
+ }
+
+ out_data.DC( Y_COMP )[b_yp][b_xp] = val + DCPrediction( out_data.DC( Y_COMP ) , out_data.Mode());
+
+ if (m_cformat != Yonly)
+ {
+ //move onto U and V DC values
+ val = 0;
+ bin = 1;
+
+ do
+ {
+ DecodeSymbol( bit , ChooseUDCContext( out_data , bin ) );
+
+ if (!bit)
+ val++;
+
+ bin++;
+ }
+ while (!bit);
+
+ if (val != 0)
+ {
+ DecodeSymbol( bit , ChooseUDCSignContext ( out_data ) );
+
+ if (!bit)
+ val = -val;
+ }
+
+ out_data.DC( U_COMP )[b_yp][b_xp] = val + DCPrediction( out_data.DC( U_COMP ) , out_data.Mode());
+
+ val = 0;
+ bin = 1;
+
+ do
+ {
+ DecodeSymbol( bit , ChooseVDCContext( out_data , bin ) );
+
+ if ( !bit )
+ val++;
+
+ bin++;
+ }
+ while ( !bit );
+
+ if (val != 0)
+ {
+ DecodeSymbol( bit , ChooseVDCSignContext( out_data ) );
+
+ if ( !bit )
+ val = -val;
+ }
+
+ out_data.DC( V_COMP )[b_yp][b_xp] = val + DCPrediction( out_data.DC( V_COMP ) , out_data.Mode() );
+ }
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/mv_codec.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/mv_codec.h
new file mode 100644
index 000000000..a6d45f8cb
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/mv_codec.h
@@ -0,0 +1,156 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: mv_codec.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _MV_CODEC_H_
+#define _MV_CODEC_H_
+
+/////////////////////////////////////////////////
+//Class to do motion vector coding and decoding//
+//------using adaptive arithmetic coding-------//
+/////////////////////////////////////////////////
+
+#include <libdirac_common/arith_codec.h>
+#include <libdirac_common/common.h>
+#include <libdirac_common/motion.h>
+#include <libdirac_common/wavelet_utils.h>
+#include <vector>
+
+namespace dirac
+{
+ //! Codes and decodes all the Motion Vector data
+ /*!
+ Derived from the ArithCodec class, this codes and decodes all the
+ motion vector data.
+ */
+ class MvDataCodec: public ArithCodec<MvData>
+ {
+ public:
+ //! Constructor for encoding
+ /*!
+ Creates a MvDataCodec object to encode MV data, based on parameters
+ \param bits_out the output for the encoded bits
+ \param number_of_contexts the contexts used in the encoding process
+ \param cf the chroma format
+ */
+ MvDataCodec(BasicOutputManager* bits_out,
+ size_t number_of_contexts,
+ const ChromaFormat & cf);
+
+ //! Constructor for decoding
+ /*!
+ Creates a MvDataCodec object to encode MV data, based on parameters
+ \param bits_in the input for the encoded bits
+ \param number_of_contexts the contexts used in the encoding process
+ \param cf the chroma format
+ */
+ MvDataCodec(BitInputManager* bits_in,
+ size_t number_of_contexts,
+ const ChromaFormat & cf);
+
+ //! Initialises the contexts
+ void InitContexts();
+
+ private:
+ int MB_count;
+ const ChromaFormat & m_cformat;
+
+ int b_xp, b_yp; //position of current block
+ int mb_xp, mb_yp; //position of current MB
+ int mb_tlb_x, mb_tlb_y; //position of top-left block of current MB
+
+ // functions
+ MvDataCodec(const MvDataCodec& cpy); //private, bodyless copy constructor: class should not be copied
+ MvDataCodec& operator=(const MvDataCodec& rhs); //private, bodyless copy operator=: class should not be assigned
+
+ // coding functions
+ void CodeMBSplit(const MvData& in_data); //code the MB splitting mode
+ void CodeMBCom(const MvData& in_data); //code the MB common ref mode
+ void CodePredmode(const MvData& in_data); //code the block prediction mode
+ void CodeMv1(const MvData& in_data); //code the first motion vector
+ void CodeMv2(const MvData& in_data); //code the second motion vector
+ void CodeDC(const MvData& in_data); //code the dc value of intra blocks
+
+ // decoding functions
+ void DecodeMBSplit( MvData& out_data); //decode the MB splitting mode
+ void DecodeMBCom( MvData& out_data);//decode the MB common ref mode
+ void DecodePredmode(MvData& out_data);//decode the block prediction mode
+ void DecodeMv1( MvData& out_data); //decode the first motion vector
+ void DecodeMv2( MvData& out_data); //decode the second motion vector
+ void DecodeDC( MvData& out_data); //decode the dc value of intra blocks
+
+ void DoWorkCode( MvData& in_data );
+ void DoWorkDecode(MvData& out_data, int num_bits);
+
+ // Context stuff
+ void Update( const bool symbol , const int context_num );
+ void Resize(const int context_num);
+ void ResetAll();
+
+ int ChooseContext(const MvData& data, const int BinNumber) const;
+ int ChooseContext(const MvData& data) const;
+ int ChooseSignContext(const MvData& data) const;
+
+ int ChooseMBSContext(const MvData& data, const int BinNumber) const;
+ int ChooseMBCContext(const MvData& data) const;
+ int ChoosePredContext(const MvData& data, const int BinNumber) const;
+ int ChooseREF1xContext(const MvData& data, const int BinNumber) const;
+ int ChooseREF1xSignContext(const MvData& data) const;
+ int ChooseREF1yContext(const MvData& data, const int BinNumber) const;
+ int ChooseREF1ySignContext(const MvData& data) const;
+ int ChooseREF2xContext(const MvData& data, const int BinNumber) const;
+ int ChooseREF2xSignContext(const MvData& data) const;
+ int ChooseREF2yContext(const MvData& data, const int BinNumber) const;
+ int ChooseREF2ySignContext(const MvData& data) const;
+ int ChooseYDCContext(const MvData& data, const int BinNumber) const;
+ int ChooseUDCContext(const MvData& data, const int BinNumber) const;
+ int ChooseVDCContext(const MvData& data, const int BinNumber) const;
+ int ChooseYDCSignContext(const MvData& data) const;
+ int ChooseUDCSignContext(const MvData& data) const;
+ int ChooseVDCSignContext(const MvData& data) const;
+
+ //prediction stuff
+ unsigned int MBSplitPrediction(const TwoDArray<int>& mbdata) const;
+ bool MBCBModePrediction(const TwoDArray<bool>& mbdata) const;
+ unsigned int BlockModePrediction(const TwoDArray<PredMode>& preddata) const;
+ MVector Mv1Prediction(const MvArray& mvarray,const TwoDArray<PredMode>& preddata) const;
+ MVector Mv2Prediction(const MvArray& mvarray,const TwoDArray<PredMode>& preddata) const;
+ ValueType DCPrediction(const TwoDArray<ValueType>& dcdata,const TwoDArray<PredMode>& preddata) const;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/pic_io.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/pic_io.cpp
new file mode 100644
index 000000000..2dd7bdfce
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/pic_io.cpp
@@ -0,0 +1,455 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: pic_io.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott Robert Ladd,
+* Stuart Cunningham,
+* Tim Borer
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_common/pic_io.h>
+#include <libdirac_common/dirac_assertions.h>
+using namespace dirac;
+
+/*************************************Output***********************************/
+
+StreamPicOutput::StreamPicOutput()
+{}
+
+StreamPicOutput::~StreamPicOutput()
+{}
+
+StreamPicOutput::StreamPicOutput (const SeqParams& sp) :
+ m_sparams(sp),
+ m_op_pic_ptr(0)
+{ }
+
+
+bool StreamPicOutput::WriteNextFrame( const Frame& myframe )
+{
+ bool ret_val;
+
+ ret_val=WriteComponent(myframe.Ydata() , Y_COMP );
+
+ if ( m_sparams.CFormat() != Yonly )
+ {
+ ret_val|=WriteComponent( myframe.Udata() , U_COMP );
+ ret_val|=WriteComponent( myframe.Vdata() , V_COMP );
+ }
+
+ return ret_val;
+}
+
+bool StreamPicOutput::WriteComponent( const PicArray& pic_data , const CompSort& cs)
+{
+ //initially set up for 10-bit data input, rounded to 8 bits on file output
+ //This will throw out any padding to the right and bottom of a frame
+
+ int xl,yl;
+ if (cs == Y_COMP)
+ {
+ xl = m_sparams.Xl();
+ yl = m_sparams.Yl();
+ }
+ else
+ {
+ xl = m_sparams.ChromaWidth();
+ yl = m_sparams.ChromaHeight();
+ }
+
+ unsigned char* tempc=new unsigned char[xl];
+ ValueType tempv;
+
+ if (m_op_pic_ptr)
+ {
+ for (int j=0 ; j<yl ;++j)
+ {
+ for (int i=0 ; i<xl ; ++i)
+ {
+ tempv = pic_data[j][i]+2;
+ tempv >>= 2;
+ tempc[i] = (unsigned char) tempv;
+ }//I
+
+ m_op_pic_ptr->write((char*) tempc,xl);
+
+ }//J
+ }
+ else
+ {
+ std::cerr<<std::endl<<"Can't open picture data file for writing";
+
+ //tidy up
+ delete[] tempc;
+
+ //exit failure
+ return false;
+ }
+
+ m_op_pic_ptr->flush();
+
+ delete[] tempc;
+
+ //exit success
+ return true;
+}
+
+MemoryStreamOutput::MemoryStreamOutput()
+{
+ //picture input
+ m_op_pic_ptr =
+ new std::ostream(&m_membuf);
+}
+
+MemoryStreamOutput::~MemoryStreamOutput()
+{
+ delete m_op_pic_ptr;
+}
+
+void MemoryStreamOutput::SetMembufReference (unsigned char *buf, int buf_size)
+{
+ m_membuf.SetMembufReference(buf, buf_size);
+}
+
+
+FileStreamOutput::FileStreamOutput(const char* output_name,
+ const SeqParams& sp,
+ bool write_header_only) : StreamPicOutput(sp)
+{
+ m_op_head_ptr = NULL;
+
+ OpenHeader(output_name);
+ if (! write_header_only)
+ OpenYUV(output_name);
+}
+
+bool FileStreamOutput::OpenHeader(const char* output_name)
+{
+ char output_name_hdr[FILENAME_MAX];
+
+ strncpy(output_name_hdr, output_name, sizeof(output_name_hdr));
+ strcat(output_name_hdr, ".hdr");
+
+ //header output
+ m_op_head_ptr =
+ new std::ofstream(output_name_hdr,std::ios::out | std::ios::binary);
+
+ if (!(*m_op_head_ptr))
+ {
+ std::cerr <<std::endl <<
+ "Can't open output header file for output: " <<
+ output_name_hdr << std::endl;
+
+ return false;
+
+ }
+
+ return true;
+}
+
+bool FileStreamOutput::OpenYUV(const char* output_name)
+{
+ char output_name_yuv[FILENAME_MAX];
+
+ strncpy(output_name_yuv,output_name, sizeof(output_name_yuv));
+ strcat(output_name_yuv,".yuv");
+
+ //picture output
+ m_op_pic_ptr =
+ new std::ofstream(output_name_yuv,std::ios::out | std::ios::binary);
+
+ if (!(*m_op_pic_ptr))
+ {
+ std::cerr << std::endl <<
+ "Can't open output picture data file for output: " <<
+ output_name_yuv<<std::endl;
+
+ return false;
+
+ }
+
+ return true;
+}
+
+FileStreamOutput::~FileStreamOutput()
+{
+ if (m_op_head_ptr && *m_op_head_ptr)
+ {
+ m_op_head_ptr->close();
+ delete m_op_head_ptr;
+ }
+
+ if (m_op_pic_ptr && *m_op_pic_ptr)
+ {
+ static_cast<std::ofstream *>(m_op_pic_ptr)->close();
+ delete m_op_pic_ptr;
+ }
+}
+
+//write a human-readable picture header as separate file
+bool FileStreamOutput::WritePicHeader()
+{
+ if (!m_op_head_ptr || !*m_op_head_ptr)
+ return false;
+
+ *m_op_head_ptr << m_sparams.CFormat() << std::endl;
+ *m_op_head_ptr << m_sparams.Xl() << std::endl;
+ *m_op_head_ptr << m_sparams.Yl() << std::endl;
+ *m_op_head_ptr << m_sparams.Interlace() << std::endl;
+ *m_op_head_ptr << m_sparams.TopFieldFirst() << std::endl;
+ *m_op_head_ptr << m_sparams.FrameRate() << std::endl;
+
+ return true;
+
+}
+
+/**************************************Input***********************************/
+
+StreamPicInput::StreamPicInput () :
+ m_ip_pic_ptr(0),
+ m_xpad(0),
+ m_ypad(0)
+{}
+
+StreamPicInput::StreamPicInput (std::istream *ip_pic_ptr, const SeqParams &sparams) :
+ m_sparams(m_sparams),
+ m_ip_pic_ptr(ip_pic_ptr),
+ m_xpad(0),
+ m_ypad(0)
+{}
+
+StreamPicInput::~StreamPicInput ()
+{}
+
+void StreamPicInput::SetPadding(const int xpd, const int ypd)
+{
+ m_xpad=xpd;
+ m_ypad=ypd;
+}
+
+bool StreamPicInput::ReadNextFrame(Frame& myframe)
+{
+ //return value. Failure if one of the components can't be read,
+ //success otherwise/.
+
+ bool ret_val;
+ ret_val=ReadComponent( myframe.Ydata() , Y_COMP);
+
+ if (m_sparams.CFormat() != Yonly)
+ {
+ ret_val|=ReadComponent(myframe.Udata() , U_COMP);
+ ret_val|=ReadComponent(myframe.Vdata() , V_COMP);
+ }
+
+ return ret_val;
+}
+
+
+bool StreamPicInput::ReadComponent(PicArray& pic_data, const CompSort& cs)
+{
+ if (! *m_ip_pic_ptr)
+ return false;
+
+ //initially set up for 8-bit file input expanded to 10 bits for array output
+
+ int xl,yl;
+ if (cs == Y_COMP){
+ xl = m_sparams.Xl();
+ yl = m_sparams.Yl();
+ }
+ else{
+ if (m_sparams.CFormat() == format411)
+ {
+ xl = m_sparams.Xl()/4;
+ yl = m_sparams.Yl();
+ }
+ else if (m_sparams.CFormat()==format420)
+ {
+ xl = m_sparams.Xl()/2;
+ yl = m_sparams.Yl()/2;
+ }
+ else if (m_sparams.CFormat() == format422)
+ {
+ xl = m_sparams.Xl()/2;
+ yl = m_sparams.Yl();
+ }
+ else{
+ xl = m_sparams.Xl();
+ yl = m_sparams.Yl();
+ }
+ }
+
+ unsigned char * temp = new unsigned char[xl];//array big enough for one line
+
+ for (int j=0 ; j<yl ; ++j)
+ {
+ m_ip_pic_ptr->read((char*) temp, xl);
+
+ for (int i=0 ; i<xl ; ++i)
+ {
+ pic_data[j][i] = (ValueType) temp[i];
+ pic_data[j][i] <<= 2;
+ }//I
+
+ //pad the columns on the rhs using the edge value
+ for (int i=xl ; i<pic_data.LengthX() ; ++i ){
+ pic_data[j][i] = pic_data[j][xl-1];
+ }//I
+
+ }//J
+
+ delete [] temp;
+
+ //now do the padded lines, using the last true line
+ for (int j=yl ; j<pic_data.LengthY() ; ++j )
+ {
+ for (int i=0 ; i<pic_data.LengthX() ; ++i )
+ {
+ pic_data[j][i] = pic_data[yl-1][i];
+ }//I
+ }//J
+
+ return true;
+}
+
+MemoryStreamInput::MemoryStreamInput()
+{
+ //picture input
+ m_ip_pic_ptr =
+ new std::istream(&m_membuf);
+}
+
+MemoryStreamInput::~MemoryStreamInput()
+{
+ delete m_ip_pic_ptr;
+}
+
+void MemoryStreamInput::SetMembufReference (unsigned char *buf, int buf_size)
+{
+ m_membuf.SetMembufReference(buf, buf_size);
+}
+
+void MemoryStreamInput::Skip(const int num)
+{
+ REPORTM (false, "MemoryStreamInput::Skip - Reached unimplemented function");
+}
+
+FileStreamInput::FileStreamInput(const char* input_name)
+{
+
+ char input_name_yuv[FILENAME_MAX];
+ char input_name_hdr[FILENAME_MAX];
+
+ strncpy(input_name_yuv, input_name, sizeof(input_name_yuv));
+ strncpy(input_name_hdr, input_name, sizeof(input_name_hdr));
+ strcat(input_name_yuv, ".yuv");
+ strcat(input_name_hdr, ".hdr");
+
+ //header output
+ m_ip_head_ptr =
+ new std::ifstream(input_name_hdr,std::ios::in | std::ios::binary);
+ //picture output
+ m_ip_pic_ptr =
+ new std::ifstream(input_name_yuv,std::ios::in | std::ios::binary);
+
+ if (!(*m_ip_head_ptr))
+ std::cerr << std::endl <<
+ "Can't open input header file: " << input_name_hdr << std::endl;
+ if (!(*m_ip_pic_ptr))
+ std::cerr << std::endl<<
+ "Can't open input picture data file: " <<
+ input_name_yuv << std::endl;
+}
+
+FileStreamInput::~FileStreamInput()
+{
+ static_cast<std::ifstream *>(m_ip_pic_ptr)->close();
+ m_ip_head_ptr->close();
+ delete m_ip_pic_ptr;
+ delete m_ip_head_ptr;
+}
+
+//read a picture header from a separate file
+bool FileStreamInput::ReadPicHeader()
+{
+ if (! *m_ip_head_ptr)
+ return false;
+
+ int temp_int;
+ bool temp_bool;
+
+ *m_ip_head_ptr >> temp_int;
+ m_sparams.SetCFormat( (ChromaFormat)temp_int );
+
+ *m_ip_head_ptr >> temp_int;
+ m_sparams.SetXl( temp_int );
+
+ *m_ip_head_ptr >> temp_int;
+ m_sparams.SetYl( temp_int );
+
+ *m_ip_head_ptr >> temp_bool;
+ m_sparams.SetInterlace( temp_bool );
+
+ *m_ip_head_ptr >> temp_bool;
+ m_sparams.SetTopFieldFirst( temp_bool );
+
+ *m_ip_head_ptr >> temp_int;
+ m_sparams.SetFrameRate( temp_int );
+
+ return true;
+}
+
+void FileStreamInput::Skip(const int num)
+{
+ const int num_pels = m_sparams.Xl()*m_sparams.Yl();
+ int num_bytes;
+
+ const ChromaFormat cf = m_sparams.CFormat();
+
+ if ( cf == Yonly)
+ num_bytes = num_pels;
+ else if ( cf == format411 || cf == format420 )
+ num_bytes = (num_pels*3)/2;
+ else if ( cf == format422 )
+ num_bytes = num_pels*2;
+ else
+ num_bytes = num_pels*3;
+
+ m_ip_pic_ptr->seekg( num*num_bytes , std::ios::cur );
+}
+
+bool StreamPicInput::End() const
+{
+ return m_ip_pic_ptr->eof();
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/pic_io.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/pic_io.h
new file mode 100644
index 000000000..8b347be04
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/pic_io.h
@@ -0,0 +1,409 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: pic_io.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott Robert Ladd,
+* Stuart Cunningham,
+* Tim Borer,
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _PIC_IO_H_
+#define _PIC_IO_H_
+
+#include <iostream>
+#include <fstream>
+#include <streambuf>
+
+#include <libdirac_common/common.h>
+#include <libdirac_common/frame.h>
+
+namespace dirac
+{
+ //////////////////////////////////////////
+ //--------------------------------------//
+ //- -//
+ //-Uncompressed picture file IO wrapper-//
+ //- -//
+ //--------------------------------------//
+ //////////////////////////////////////////
+
+ // Stream classes for writing/reading frames of uncompressed/decoded data
+ // to stream. Streams currently supported are Memory based streams and
+ // File based streams. These classes need further restructuring.
+ // Anu - 19-11-2004
+
+ // Subclass these to provide functionality for different file formats and
+ // for streaming.
+
+
+ //! Class for outputting pictures
+
+
+ /*!
+ Abstract base class for classes that output frames to stream
+ */
+ class StreamPicOutput
+ {
+ public:
+
+ //! Default Constructor
+ StreamPicOutput();
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param sp the sequence parameters
+ */
+ StreamPicOutput( const SeqParams& sp);
+
+ //! virtual Destructor
+ virtual ~StreamPicOutput();
+
+ //! Write the next frame to the output
+ virtual bool WriteNextFrame(const Frame& myframe);
+
+ //! Get the sequence parameters
+ SeqParams& GetSeqParams() {return m_sparams;}
+
+ protected:
+
+ //! Sequence parameters
+ SeqParams m_sparams;
+ //! Output stream
+ std::ostream* m_op_pic_ptr;
+
+ //! Write a component to file
+ virtual bool WriteComponent(const PicArray& pic_data,
+ const CompSort& cs);
+ };
+
+ /*!
+ Outputs pictures to a memory buffer
+ */
+ class MemoryStreamOutput : public StreamPicOutput
+ {
+ public:
+ //! Default Constructor
+ MemoryStreamOutput();
+
+ //! Destructor
+ ~MemoryStreamOutput();
+
+ //! Set sequence parameters
+ void SetSequenceParams ( SeqParams &sparams)
+ { m_sparams = sparams; }
+
+ //! Set the memory buffer to write the data to
+ void SetMembufReference (unsigned char *buf, int buf_size);
+
+ //! Returns true if we're at the end of the input, false otherwise
+ bool End() const ;
+
+ protected:
+ //! Body-less copy constructor
+ MemoryStreamOutput(const MemoryStreamOutput&);
+ //! Body-less assignment operator
+ MemoryStreamOutput & operator =(const MemoryStreamOutput&);
+
+ protected:
+
+ //! local memory buffer
+ class OutputMemoryBuffer : public std::streambuf
+ {
+ public:
+ //! Memory buffer constructor
+ OutputMemoryBuffer () :
+ m_op_buf(0),
+ m_op_buf_size(0),
+ m_op_idx(0)
+ {}
+
+ //! Set the buffer variables
+ /*! Set the memory buffer variables
+ \param buffer buffer to write data to
+ \param buffer_size size of output buffer
+ */
+ void SetMembufReference (unsigned char *buffer, int buffer_size)
+ {
+ m_op_buf = buffer;
+ m_op_buf_size = buffer_size;
+ m_op_idx = 0;
+ }
+
+ protected:
+ //! Memory buffer to write data to
+ unsigned char *m_op_buf;
+ //! Memory buffer size
+ int m_op_buf_size;
+ //! Index of first available byte in buffer
+ int m_op_idx;
+
+ //! Write Overflow method to write one char at a time
+ virtual int overflow (int c)
+ {
+ if ( c != EOF)
+ {
+ if (m_op_idx == m_op_buf_size)
+ return EOF;
+
+ m_op_buf[m_op_idx] = (char)c;
+ m_op_idx++;
+ }
+ return c;
+ }
+
+ //! xsputn method to write one multiple chars at a time to buffer
+ virtual std::streamsize xsputn (const char *s,
+ std::streamsize num)
+ {
+ std::streamsize bytes_left = m_op_buf_size - m_op_idx;
+ std::streamsize bytes_written = bytes_left > num
+ ? num : bytes_left;
+ memcpy (&m_op_buf[m_op_idx], (unsigned char *)s,
+ bytes_written);
+ m_op_idx += bytes_written;
+ return bytes_written;
+ }
+
+ private:
+ //! Body-less copy constructor
+ OutputMemoryBuffer(const OutputMemoryBuffer&);
+ //! Body-less assignment operator
+ OutputMemoryBuffer& operator =(const OutputMemoryBuffer&);
+ };
+
+ //! Output stream Memory buffer
+ OutputMemoryBuffer m_membuf;
+ };
+
+ /*!
+ Outputs pictures to a file
+ */
+ class FileStreamOutput : public StreamPicOutput
+ {
+ public:
+
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param output_name the name of the output file
+ \param sp the sequence parameters
+ \param write_header_only optionally write only the header
+ */
+ FileStreamOutput (const char* output_name,
+ const SeqParams& sp,
+ bool write_header_only = false);
+
+ //! Destructor
+ virtual ~FileStreamOutput ();
+
+ //! Write the picture sequence header
+ virtual bool WritePicHeader();
+
+ protected:
+
+ //! Header output stream
+ std::ofstream* m_op_head_ptr;
+
+ //! Open picture's header file for output
+ virtual bool OpenHeader(const char* output_name);
+
+ //! Open picture's YUV data file for output
+ virtual bool OpenYUV(const char* output_name);
+ };
+
+ //! Picture input class
+ /*!
+ Abstract Class for reading picture data from a stream.
+ */
+
+ class StreamPicInput
+ {
+ public:
+
+ //! Default Constructor
+ StreamPicInput();
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param ip_pic_ptr input stream to read from
+ \param sparams Sequence parameters
+ */
+ StreamPicInput(std::istream *ip_pic_ptr, const SeqParams& sparams);
+
+ //! Destructor
+ virtual ~StreamPicInput();
+
+ //! Skip n frames of input
+ virtual void Skip( const int n) = 0;
+
+ //! Set padding values to take into account block and transform sizes
+ void SetPadding(const int xpd, const int ypd);
+
+ //! Read the next frame from the file
+ virtual bool ReadNextFrame(Frame& myframe);
+
+ //! Get the sequence parameters (got from the picture header)
+ const SeqParams& GetSeqParams() const {return m_sparams;}
+
+ //! Returns true if we're at the end of the input, false otherwise
+ bool End() const ;
+
+ protected:
+
+ //! Sequence parameters
+ SeqParams m_sparams;
+
+ //! Input stream
+ std::istream* m_ip_pic_ptr;
+
+ //!padding values
+ int m_xpad,m_ypad;
+
+ //! Read a component from the file
+ virtual bool ReadComponent(PicArray& pic_data,const CompSort& cs);
+ };
+
+ /*!
+ Class for reading picture data from memory
+ */
+ class MemoryStreamInput : public StreamPicInput
+ {
+ public:
+ //! Default constructor
+ MemoryStreamInput();
+
+ //! Destructor
+ ~MemoryStreamInput();
+
+ //! Set the seqence parameters
+ void SetSequenceParams ( SeqParams &sparams)
+ { m_sparams = sparams; }
+
+ //! Set Memory buffer
+ /*! Set the input memory buffer variables
+ \param buf Input Buffer to read data from
+ \param buf_size Input buffer size
+ */
+ void SetMembufReference (unsigned char *buf, int buf_size);
+
+ //! Returns true if we're at the end of the input, false otherwise
+ bool End() const ;
+
+ //! Skip n frame of input. Unimplemented to this class
+ virtual void Skip( const int n);
+
+ protected:
+ //! Body-less copy constructor
+ MemoryStreamInput(const MemoryStreamInput&);
+ //! Body-less assignment operator
+ MemoryStreamInput & operator =(const MemoryStreamInput&);
+
+ protected:
+ //! Class that defines the Input Stream Memory Buffer
+ class InputMemoryBuffer : public std::streambuf
+ {
+ public:
+ //! Constructor
+ InputMemoryBuffer() : m_buffer(0), m_buffer_size(0)
+ {
+ setg ((char *)m_buffer, (char *)m_buffer, (char *)m_buffer);
+ }
+
+ //! Destructor
+ ~InputMemoryBuffer(){}
+
+ //! Set Input Memory buffer variables
+ /*! Initialises the input memory buffer vars
+ \param buffer Input memory buffer
+ \param buffer_size Input memory buffer size
+ */
+ void SetMembufReference (unsigned char *buffer, int buffer_size)
+ {
+ m_buffer = buffer;
+ m_buffer_size = buffer_size;
+
+ setg ((char *)m_buffer, (char *)m_buffer,
+ (char *)(m_buffer + buffer_size));
+ }
+
+ private:
+ //! Body-less copy constructor
+ InputMemoryBuffer (const InputMemoryBuffer& inbuf);
+ //! Body-less assignment operator
+ InputMemoryBuffer& operator = (const InputMemoryBuffer& inbuf);
+
+ //! Input memory buffer
+ unsigned char *m_buffer;
+ //! Input memory buffer size
+ int m_buffer_size;
+ };
+
+ //! Input stream buffer
+ InputMemoryBuffer m_membuf;
+ };
+
+ //! Picture input class
+ /*!
+ Class for reading picture data from a file.
+ */
+ class FileStreamInput : public StreamPicInput
+ {
+ public:
+
+ //! Constructor
+ /*!
+ Constructor, takes
+ \param input_name the name of the input picture file
+ */
+ FileStreamInput (const char* input_name);
+
+ //! Destructor
+ virtual ~FileStreamInput ();
+
+ //! Read the picture header
+ virtual bool ReadPicHeader();
+
+ //! Skip n frames of input
+ virtual void Skip( const int n);
+
+
+ protected:
+ //! input header stream
+ std::ifstream* m_ip_head_ptr;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/upconvert.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/upconvert.cpp
new file mode 100644
index 000000000..76ad39b49
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/upconvert.cpp
@@ -0,0 +1,186 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: upconvert.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Richard Felton (Original Author), Thomas Davies
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_common/upconvert.h>
+using namespace dirac;
+
+#include <iostream>
+
+//Up-convert by a factor of two.
+void UpConverter::DoUpConverter(const PicArray& pic_data, PicArray& up_data)
+{
+
+ xOld = pic_data.LengthX();
+ yOld = pic_data.LengthY();
+ xNew = up_data.LengthX();
+ yNew = up_data.LengthY(); //assumes up_data has twice the x and y length of the pic_data.
+ //TBC: What to do if this is wrong?
+
+ //Variables that will be used by the filter calculations
+ int sum;
+ int ypos(0);
+
+ //There are three y loops to cope with the leading edge, middle
+ //and trailing edge of each column.
+
+ for(int y = 0 ; y < Stage_I_Size; ++y , ypos += 2)
+ {
+
+ //We are filtering each column but doing it bit by bit.
+ //This means our main loop is in the x direction and
+ //there is a much greater chance the data we need will
+ //be in the cache.
+ for(int x = 0 , xpos = 0; x < xOld; x++ , xpos+=2 )
+ {
+
+ // Copy a Pixel from the original image in each even position
+ up_data[ypos][xpos] = pic_data[y][x];
+
+ //Work out the next pixel from filtered values.
+ //Excuse the complicated ternary stuff but it sorts out the edge
+ sum = (pic_data[y][x] + pic_data[y+1][x])*StageI_I;
+ sum += (pic_data[(y>=1)?(y-1):0][x] + pic_data[y+2][x])*StageI_II;
+ sum += (pic_data[(y>=2)?(y-2):0][x] + pic_data[y+3][x])*StageI_III;
+ sum += (pic_data[(y>=3)?(y-3):0][x] + pic_data[y+4][x])*StageI_IV;
+ sum += (pic_data[(y>=4)?(y-4):0][x] + pic_data[y+5][x])*StageI_V;
+ sum += (pic_data[(y>=5)?(y-5):0][x] + pic_data[y+6][x])*StageI_VI;
+
+ up_data[ypos+1][xpos] = sum >> Stage_I_Shift;
+
+ }// x, xpos
+
+ // The row loop.
+ RowLoop(up_data, ypos);
+ }// y, ypos
+ // This loop is like the last one but it deals with the centre
+ // section of the image and so the ternary operations are dropped
+ // from the filter section.
+ for(int y = Stage_I_Size; y < yOld - Stage_I_Size; ++y , ypos += 2)
+ {
+ for(int x = 0 , xpos=0; x < xOld; x++ , xpos+=2 )
+ {
+
+ up_data[ypos][xpos] = pic_data[y][x];
+
+ sum = (pic_data[y][x] + pic_data[y+1][x])*StageI_I;
+ sum += (pic_data[y-1][x] + pic_data[y+2][x])*StageI_II;
+ sum += (pic_data[y-2][x] + pic_data[y+3][x])*StageI_III;
+ sum += (pic_data[y-3][x] + pic_data[y+4][x])*StageI_IV;
+ sum += (pic_data[y-4][x] + pic_data[y+5][x])*StageI_V;
+ sum += (pic_data[y-5][x] + pic_data[y+6][x])*StageI_VI;
+
+ up_data[ypos+1][xpos] = sum >> Stage_I_Shift;
+
+ }// x,xpos
+ RowLoop(up_data, ypos);
+
+ }// y, ypos
+ // Another similar loop! - this time we are dealing with
+ // the trailing edge so the ternary stuff is back in the
+ // filter calcs but in the second parameter.
+ for(int y = yOld - Stage_I_Size; y < yOld; ++y , ypos+=2)
+ {
+ for(int x = 0 , xpos=0 ; x < xOld; x++ , xpos+=2)
+ {
+
+ up_data[ypos][xpos]=pic_data[y][x];
+
+ sum = (pic_data[y][x] + pic_data[((y+1)<yOld)?(y+1):(yOld-1)][x])*StageI_I;
+ sum += (pic_data[y - 1][x] + pic_data[((y+2)<yOld)?(y+2):(yOld-1)][x])*StageI_II;
+ sum += (pic_data[y - 2][x] + pic_data[((y+3)<yOld)?(y+3):(yOld-1)][x])*StageI_III;
+ sum += (pic_data[y - 3][x] + pic_data[((y+4)<yOld)?(y+4):(yOld-1)][x])*StageI_IV;
+ sum += (pic_data[y - 4][x] + pic_data[((y+5)<yOld)?(y+5):(yOld-1)][x])*StageI_V;
+ sum += (pic_data[y - 5][x] + pic_data[((y+6)<yOld)?(y+6):(yOld-1)][x])*StageI_VI;
+ up_data[ypos+1][xpos] = sum >> Stage_I_Shift;
+
+ }//x,xpos
+ RowLoop(up_data, ypos);
+
+ }//y,ypos
+}
+
+
+void UpConverter::RowLoop(PicArray&up_data, const int row_num)
+{
+ //Calculation variable
+ int sum;
+ int ypos;
+
+ //Leading row Edge
+ //Note the factor of two difference as we only want to fill in every other
+ //line as the others have already been created
+ for(int i = 0; i < 2; ++i)
+ {
+ ypos = row_num + i;
+
+ for(int x = 0; x < (2*Stage_I_Size); x+=2)
+ {
+
+ sum = (up_data[ypos][x] + up_data[ypos][x+2])*StageI_I;
+ sum += (up_data[ypos][(x>=2)?(x-2):0] + up_data[ypos][x+4])*StageI_II;
+ sum += (up_data[ypos][(x>=4)?(x-4):0] + up_data[ypos][x+6])*StageI_III;
+ sum += (up_data[ypos][(x>=6)?(x-6):0] + up_data[ypos][x+8])*StageI_IV;
+ sum += (up_data[ypos][(x>=8)?(x-8):0] + up_data[ypos][x+10])*StageI_V;
+ sum += (up_data[ypos][(x>=10)?(x-10):0] + up_data[ypos][x+12])*StageI_VI;
+
+ up_data[ypos][x+1] = sum >> Stage_I_Shift;
+ }// x
+ //Middle of row
+ for(int x = (2*Stage_I_Size); x < xNew - (2*Stage_I_Size); x+=2)
+ {
+ sum = (up_data[ypos][x] + up_data[ypos][x+2])*StageI_I;
+ sum += (up_data[ypos][x-2] + up_data[ypos][x+4])*StageI_II;
+ sum += (up_data[ypos][x-4] + up_data[ypos][x+6])*StageI_III;
+ sum += (up_data[ypos][x-6] + up_data[ypos][x+8])*StageI_IV;
+ sum += (up_data[ypos][x-8] + up_data[ypos][x+10])*StageI_V;
+ sum += (up_data[ypos][x-10] + up_data[ypos][x+12])*StageI_VI;
+
+ up_data[ypos][x+1] = sum >> Stage_I_Shift;
+ }// x
+ //Trailing row edge
+ for(int x = xNew - (2*Stage_I_Size); x < xNew; x+=2)
+ {
+ sum = (up_data[ypos][x] + up_data[ypos][(((x+2)<xNew)?(x+2):(xNew-2))])*StageI_I;
+ sum += (up_data[ypos][x-2] + up_data[ypos][(((x+4)<xNew)?(x+4):(xNew-2))])*StageI_II;
+ sum += (up_data[ypos][x-4] + up_data[ypos][(((x+6)<xNew)?(x+6):(xNew-2))])*StageI_III;
+ sum += (up_data[ypos][x-6] + up_data[ypos][(((x+8)<xNew)?(x+8):(xNew-2))])*StageI_IV;
+ sum += (up_data[ypos][x-8] + up_data[ypos][(((x+10)<xNew)?(x+10):(xNew-2))])*StageI_V;
+ sum += (up_data[ypos][x-10] + up_data[ypos][(((x+12)<xNew)?(x+12):(xNew-2))])*StageI_VI;
+ up_data[ypos][x+1] = sum >> Stage_I_Shift;
+ }// x
+ }
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/upconvert.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/upconvert.h
new file mode 100644
index 000000000..82ff196fb
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/upconvert.h
@@ -0,0 +1,99 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: upconvert.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Richard Felton (Original Author), Thomas Davies
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _UPCONVERT_H_
+#define _UPCONVERT_H_
+
+#include <libdirac_common/common.h>
+
+namespace dirac
+{
+ //Optimised upconversion class - no array resizes.
+ //Uses integer math - no floats!
+ //
+
+ //! Upconversion class
+ /*!
+ Class to upconvert data by a factor of 2 in both dimensions
+ */
+ class UpConverter
+ {
+
+ public:
+
+ //! Constructor
+ UpConverter(){}
+ //! Destructor
+ ~UpConverter(){};
+
+ //! Upconvert the picture data
+ /*!
+ Upconvert the picture data, where the parameters are
+ \param pic_data is the original data
+ \param up_data is the upconverted data
+ */
+ void DoUpConverter(const PicArray& pic_data, PicArray& up_data);
+
+ private:
+ //! Private body-less copy constructor: class should not be copied
+ UpConverter(const UpConverter& cpy);
+
+ //! Private body-less assignment: class should not be assigned
+ UpConverter& operator=(const UpConverter& rhs);
+
+ //! Applies the filter to a row and its successor
+ void RowLoop(PicArray& up_data, const int row_num);
+
+ private:
+ //Variable to keep the loops in check
+ int xOld, yOld;
+ int xNew, yNew;
+
+ //Define first set of filter parameters
+ static const int Stage_I_Size = 6;
+ static const int StageI_I = 167;
+ static const int StageI_II = -56;
+ static const int StageI_III = 25;
+ static const int StageI_IV = -11;
+ static const int StageI_V = 4;
+ static const int StageI_VI = -1;
+ static const int Stage_I_Shift = 8;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/wavelet_utils.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_common/wavelet_utils.cpp
new file mode 100644
index 000000000..a245f8a39
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/wavelet_utils.cpp
@@ -0,0 +1,614 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: wavelet_utils.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#include <libdirac_common/wavelet_utils.h>
+#include <libdirac_common/common.h>
+using namespace dirac;
+
+#include <cstdlib>
+
+// Default constructor
+Subband::Subband()
+{
+ // this space intentionally left blank
+}
+
+// Constructor
+Subband::Subband(int xpos,int ypos, int xlen, int ylen):
+ xps(xpos),
+ yps(ypos),
+ xln(xlen),
+ yln(ylen),
+ wgt(1),
+ qfac(8)
+{
+ // this space intentionally left blank
+}
+
+// Constructor
+Subband::Subband(int xpos,int ypos, int xlen, int ylen, int d)
+ : xps(xpos),
+ yps(ypos),
+ xln(xlen),
+ yln(ylen),
+ wgt(1),
+ dpth(d),
+ qfac(8)
+{
+ // this space intentionally left blank
+}
+
+//! Destructor
+Subband::~Subband()
+{
+ // this space intentionally left blank
+}
+
+//subband list methods
+
+void SubbandList::Init(const int depth,const int xlen,const int ylen)
+{
+ int xl=xlen;
+ int yl=ylen;
+
+ Clear();
+ Subband* tmp;
+
+ for (int level = 1; level <= depth; ++level)
+ {
+ xl/=2;
+ yl/=2;
+
+ tmp=new Subband(xl , 0 , xl , yl , level);
+ AddBand( *tmp );
+ delete tmp;
+
+ tmp=new Subband( 0 , yl , xl , yl , level);
+ AddBand( *tmp );
+ delete tmp;
+
+ tmp=new Subband( xl , yl , xl , yl , level);
+ AddBand( *tmp );
+ delete tmp;
+
+ if (level == depth)
+ {
+ tmp=new Subband( 0 , 0 , xl , yl , level);
+ AddBand( *tmp );
+ delete tmp;
+ }
+ }
+ //now set the parent-child relationships
+ int len = bands.size();
+ (*this)(len).SetParent(0);
+ (*this)(len).AddChild(len-3);
+ (*this)(len-3).SetParent(len);
+ (*this)(len).AddChild(len-2);
+ (*this)(len-2).SetParent(len);
+ (*this)(len).AddChild(len-1);
+ (*this)(len-1).SetParent(len);
+
+ for (int level = 1; level < depth; ++level)
+ {
+ //do parent-child relationship for other bands
+ (*this)(3*level + 1).AddChild( 3*(level-1) + 1);
+ (*this)(3*(level-1) + 1).SetParent(3*level + 1);
+
+ (*this)(3*level + 2).AddChild(3*(level-1) + 2);
+ (*this)(3*(level-1) + 2).SetParent(3*level + 2);
+
+ (*this)(3*level + 3).AddChild(3*(level-1) + 3);
+ (*this)(3*(level-1) + 3).SetParent(3*level + 3);
+ }// level
+}
+
+//wavelet transform methods
+///////////////////////////
+
+//public methods
+
+WaveletTransform::WaveletTransform(int d, WltFilter f)
+ : depth(d),
+ filt_sort(f)
+{
+ // this space intentionally left blank
+}
+
+//! Destructor
+WaveletTransform::~WaveletTransform()
+{
+ // this space intentionally left blank
+}
+
+void WaveletTransform::Transform(const Direction d, PicArray& pic_data)
+{
+ int xl,yl;
+
+ if (d == FORWARD)
+ {
+ //do work
+ xl=pic_data.LengthX();
+ yl=pic_data.LengthY();
+
+ for (int l = 1; l <= depth; ++l)
+ {
+ VHSplit(0,0,xl,yl,pic_data);
+ xl /= 2;
+ yl /= 2;
+ }
+
+ band_list.Init( depth , pic_data.LengthX() , pic_data.LengthY() );
+ }
+ else
+ {
+ //do work
+ xl = pic_data.LengthX()/(1<<(depth-1));
+ yl = pic_data.LengthY()/(1<<(depth-1));
+
+ for (int l = 1; l <= depth; ++l)
+ {
+ VHSynth(0,0,xl,yl,pic_data);
+ xl *= 2;
+ yl *= 2;
+ }
+
+ //band list now inaccurate, so clear
+ band_list.Clear();
+ }
+}
+
+//private functions
+///////////////////
+
+void WaveletTransform::VHSplit(const int xp, const int yp, const int xl, const int yl, PicArray& pic_data)
+{
+
+ //version based on integer-like types
+ //using edge-extension rather than reflection
+
+ OneDArray<ValueType *> tmp_data(yl);
+ const int xl2 = xl/2;
+ const int yl2 = yl/2;
+ const int xend=xp+xl;
+ const int yend=yp+yl;
+
+ ValueType* line_data;
+
+ // Positional variables
+ int i,j,k,r,s;
+
+ // Objects to do lifting stages
+ // (in revese order and type from synthesis)
+ const PredictStep< 6497 > predictA;
+ const PredictStep< 217 > predictB;
+ const UpdateStep< 3616 > updateA;
+ const UpdateStep< 1817 > updateB;
+
+ //first do horizontal
+
+ for (j = yp; j < yend; ++j)
+ {
+ // First lifting stage
+ line_data = pic_data[j];
+
+ predictA.Filter( line_data[xp+1] , line_data[xp+2] , line_data[xp] );
+ predictB.Filter( line_data[xp] , line_data[xp+1] , line_data[xp+1] );
+
+ for (i = xp+2, k = xp+3; i < xend-2; i+=2, k+=2)
+ {
+ predictA.Filter( line_data[k] , line_data[i+2] , line_data[i] );
+ predictB.Filter( line_data[i] , line_data[k-2] , line_data[k] );
+ }// i
+
+ predictA.Filter( line_data[xend-1] , line_data[xend-2] , line_data[xend-2] );
+ predictB.Filter( line_data[xend-2] , line_data[xend-3] , line_data[xend-1] );
+
+
+ //second lifting stage
+
+ updateA.Filter( line_data[xp+1] , line_data[xp+2] , line_data[xp] );
+ updateB.Filter( line_data[xp] , line_data[xp+1] , line_data[xp+1] );
+
+ for (i = xp+2, k = xp+3; i < xend-2; i+=2 , k+=2)
+ {
+ updateA.Filter( line_data[k] , line_data[i+2] , line_data[i] );
+ updateB.Filter( line_data[i] , line_data[k-2] , line_data[k] );
+ }// i
+
+ updateA.Filter( line_data[xend-1] , line_data[xend-2] , line_data[xend-2] );
+ updateB.Filter( line_data[xend-2] , line_data[xend-3] , line_data[xend-1] );
+
+ }// j
+
+ // next do vertical
+
+ // First lifting stage
+
+ // top edge - j=xp
+ for ( i = xp ; i<xend ; ++ i)
+ {
+ predictA.Filter( pic_data[yp+1][i] , pic_data[yp+2][i] , pic_data[yp][i] );
+ predictB.Filter( pic_data[yp][i] , pic_data[yp+1][i] , pic_data[yp+1][i] );
+ }// i
+
+ // middle bit
+ for ( j = yp+2, k = yp+3 ; j<yend-2 ; j+=2 , k+=2)
+ {
+ for ( i = xp ; i<xend ; ++ i)
+ {
+ predictA.Filter( pic_data[k][i] , pic_data[j+2][i] , pic_data[j][i] );
+ predictB.Filter( pic_data[j][i] , pic_data[k-2][i] , pic_data[k][i] );
+ }// i
+ }// j
+ // bottom edge
+ for ( i = xp ; i<xend ; ++ i)
+ {
+ predictA.Filter( pic_data[yend-1][i] , pic_data[yend-2][i] , pic_data[yend-2][i] );
+ predictB.Filter( pic_data[yend-2][i] , pic_data[yend-3][i] , pic_data[yend-1][i] );
+ }// i
+
+ // Second lifting stage
+
+ // top edge - j=xp
+ for ( i = xp ; i<xend ; ++ i)
+ {
+ updateA.Filter( pic_data[yp+1][i] , pic_data[yp+2][i] , pic_data[yp][i] );
+ updateB.Filter( pic_data[yp][i] , pic_data[yp+1][i] , pic_data[yp+1][i] );
+ }// i
+
+ // middle bit
+ for ( j = yp+2, k = yp+3 ; j<yend-2 ; j+=2 , k+=2)
+ {
+ for ( i = xp ; i<xend ; ++ i)
+ {
+ updateA.Filter( pic_data[k][i] , pic_data[j+2][i] , pic_data[j][i] );
+ updateB.Filter( pic_data[j][i] , pic_data[k-2][i] , pic_data[k][i] );
+ }// i
+ }// j
+ // bottom edge
+ for ( i = xp ; i<xend ; ++ i)
+ {
+ updateA.Filter( pic_data[yend-1][i] , pic_data[yend-2][i] , pic_data[yend-2][i] );
+ updateB.Filter( pic_data[yend-2][i] , pic_data[yend-3][i] , pic_data[yend-1][i] );
+ }// i
+
+ // Lastly, have to reorder so that subbands are no longer interleaved
+
+ ValueType** temp_data = new ValueType*[yl];
+ for ( j = 0 ; j< yl ; ++ j)
+ temp_data[j] = new ValueType[xl];
+
+ // Make a temporary copy of the subband
+ for ( j = yp; j<yend ; j++ )
+ memcpy( temp_data[j-yp] , pic_data[j]+xp , xl * sizeof( ValueType ) );
+
+ // Re-order to de-interleave
+ for ( j = yp, s=0; j<yp+yl2 ; j++, s+=2)
+ {
+ for ( i = xp , r=0 ; i<xp+xl2 ; i++ , r += 2)
+ pic_data[j][i] = temp_data[s][r];
+ for ( i = xp+xl2, r=1; i<xend ; i++ , r += 2)
+ pic_data[j][i] = temp_data[s][r];
+ }// j
+
+ for ( j = yp+yl2, s=1 ; j<yend ; j++ , s += 2)
+ {
+ for ( i = xp , r=0 ; i<xp+xl2 ; i++ , r += 2)
+ pic_data[j][i] = temp_data[s][r];
+ for ( i = xp+xl2, r=1; i<xend ; i++ , r += 2)
+ pic_data[j][i] = temp_data[s][r];
+ }// j
+
+
+ for ( j = 0 ; j< yl ; ++ j)
+ delete[] temp_data[j];
+ delete[] temp_data;
+
+}
+
+void WaveletTransform::VHSynth(const int xp, const int yp, const int xl, const int yl, PicArray& pic_data)
+{
+ int i,j,k,r,s;
+
+ const int xend( xp+xl );
+ const int yend( yp+yl );
+ const int xl2( xl/2 );
+ const int yl2( yl/2 );
+
+ const PredictStep< 1817 > predictB;
+ const PredictStep< 3616 > predictA;
+ const UpdateStep< 217 > updateB;
+ const UpdateStep< 6497 > updateA;
+
+ ValueType* line_data;
+
+ // Firstly reorder to interleave subbands, so that subsequent calculations can be in-place
+
+ ValueType** temp_data = new ValueType*[yl];
+ for ( j = 0 ; j< yl ; ++ j)
+ temp_data[j] = new ValueType[xl];
+
+ // Make a temporary copy of the subband
+ for ( j = yp; j<yend ; j++ )
+ memcpy( temp_data[j-yp] , pic_data[j]+xp , xl * sizeof( ValueType ) );
+
+ // Re-order to interleave
+ for ( j = 0, s=yp; j<yl2 ; j++, s+=2)
+ {
+ for ( i = 0 , r=xp ; i<xl2 ; i++ , r += 2)
+ pic_data[s][r] = temp_data[j][i];
+ for ( i = xl2, r=xp+1; i<xl ; i++ , r += 2)
+ pic_data[s][r] = temp_data[j][i];
+ }// j
+
+ for ( j = yl2, s=yp+1 ; j<yl ; j++ , s += 2)
+ {
+ for ( i = 0 , r=xp ; i<xl2 ; i++ , r += 2)
+ pic_data[s][r] = temp_data[j][i];
+ for ( i = xl2, r=xp+1; i<xl ; i++ , r += 2)
+ pic_data[s][r] = temp_data[j][i];
+ }// j
+
+ for ( j = 0 ; j< yl ; ++ j)
+ delete[] temp_data[j];
+ delete[] temp_data;
+
+ // Next, do the vertical synthesis
+ // First lifting stage
+
+ // Begin with the bottom edge
+ for ( i = xend-1 ; i>=xp ; --i)
+ {
+ predictB.Filter( pic_data[yend-2][i] , pic_data[yend-3][i] , pic_data[yend-1][i] );
+ predictA.Filter( pic_data[yend-1][i] , pic_data[yend-2][i] , pic_data[yend-2][i] );
+ }// i
+ // Next, do the middle bit
+ for ( j = yend-4, k = yend-3 ; j>yp ; j-=2 , k-=2)
+ {
+ for ( i = xend-1 ; i>=xp ; --i)
+ {
+ predictB.Filter( pic_data[j][i] , pic_data[k-2][i] , pic_data[k][i] );
+ predictA.Filter( pic_data[k][i] , pic_data[j+2][i] , pic_data[j][i] );
+ }// i
+ }// j
+ // Then do the top edge
+ for ( i = xend-1 ; i>=xp ; --i)
+ {
+ predictB.Filter( pic_data[yp][i] , pic_data[yp+1][i] , pic_data[yp+1][i] );
+ predictA.Filter( pic_data[yp+1][i] , pic_data[yp+2][i] , pic_data[yp][i] );
+ }// i
+
+ // Second lifting stage
+
+ // Begin with the bottom edge
+ for ( i = xend-1 ; i>=xp ; --i)
+ {
+ updateB.Filter( pic_data[yend-2][i] , pic_data[yend-3][i] , pic_data[yend-1][i] );
+ updateA.Filter( pic_data[yend-1][i] , pic_data[yend-2][i] , pic_data[yend-2][i] );
+ }// i
+ // Next, do the middle bit
+ for ( j = yend-4, k = yend-3 ; j>yp ; j-=2 , k-=2)
+ {
+ for ( i = xend-1 ; i>=xp ; --i)
+ {
+ updateB.Filter( pic_data[j][i] , pic_data[k-2][i] , pic_data[k][i] );
+ updateA.Filter( pic_data[k][i] , pic_data[j+2][i] , pic_data[j][i] );
+ }// i
+ }// j
+ // Then do the top edge
+ for ( i = xend-1 ; i>=xp ; --i)
+ {
+ updateB.Filter( pic_data[yp][i] , pic_data[yp+1][i] , pic_data[yp+1][i] );
+ updateA.Filter( pic_data[yp+1][i] , pic_data[yp+2][i] , pic_data[yp][i] );
+ }// i
+
+
+ // Next do the horizontal synthesis
+ for (j = yend-1; j >= yp ; --j)
+ {
+ // First lifting stage
+ line_data = pic_data[j];
+
+ predictB.Filter( line_data[xend-2] , line_data[xend-3] , line_data[xend-1] );
+ predictA.Filter( line_data[xend-1] , line_data[xend-2] , line_data[xend-2] );
+
+ for (i = xend-4, k = xend-3; i > xp; i-=2 , k-=2)
+ {
+ predictB.Filter( line_data[i] , line_data[k-2] , line_data[k] );
+ predictA.Filter( line_data[k] , line_data[i+2] , line_data[i] );
+ }// i
+
+ predictB.Filter( line_data[xp] , line_data[xp+1] , line_data[xp+1] );
+ predictA.Filter( line_data[xp+1] , line_data[xp+2] , line_data[xp] );
+
+ // Second lifting stage
+
+ updateB.Filter( line_data[xend-2] , line_data[xend-3] , line_data[xend-1] );
+ updateA.Filter( line_data[xend-1] , line_data[xend-2] , line_data[xend-2] );
+
+ for (i = xend-4, k = xend-3; i > xp; i-=2 , k-=2)
+ {
+ updateB.Filter( line_data[i] , line_data[k-2] , line_data[k] );
+ updateA.Filter( line_data[k] , line_data[i+2] , line_data[i] );
+ }// i
+
+ updateB.Filter( line_data[xp] , line_data[xp+1] , line_data[xp+1] );
+ updateA.Filter( line_data[xp+1] , line_data[xp+2] , line_data[xp] );
+
+ }
+
+}
+
+//perceptual weighting stuff
+////////////////////////////
+
+// Returns a perceptual noise weighting based on extending CCIR 959 values
+// assuming a two-d isotropic response. Also has a fudge factor of 20% for chroma
+float WaveletTransform::PerceptualWeight( float xf , float yf , CompSort cs )
+{
+ double freq_sqd( xf*xf + yf*yf );
+
+ if ( cs != Y_COMP )
+ freq_sqd *= 1.2;
+
+ return 0.255 * std::pow( 1.0 + 0.2561*freq_sqd , 0.75) ;
+
+}
+
+void WaveletTransform::SetBandWeights (const float cpd,
+ const FrameSort& fsort,
+ const ChromaFormat& cformat,
+ const CompSort csort)
+{
+ //NB - only designed for progressive to date
+
+ int xlen, ylen, xl, yl, xp, yp, depth;
+ float xfreq, yfreq;
+ float temp;
+
+ // Compensate for chroma subsampling
+
+ float chroma_xfac(1.0);
+ float chroma_yfac(1.0);
+
+ if( csort != Y_COMP)
+ {
+ if( cformat == format422)
+ {
+ chroma_xfac = 2.0;
+ chroma_yfac = 1.0;
+ }
+ else if( cformat == format411 )
+ {
+ chroma_xfac = 4.0;
+ chroma_yfac = 1.0;
+ }
+ else if( cformat == format420 )
+ {
+ chroma_xfac = 2.0;
+ chroma_yfac = 2.0;
+ }
+
+ }
+
+ xlen = 2 * band_list(1).Xl();
+ ylen = 2 * band_list(1).Yl();
+
+ if (cpd != 0.0)
+ {
+ for( int i = 1; i<=band_list.Length() ; i++ )
+ {
+ xp = band_list(i).Xp();
+ yp = band_list(i).Yp();
+ xl = band_list(i).Xl();
+ yl = band_list(i).Yl();
+
+
+ xfreq = cpd * ( float(xp) + (float(xl)/2.0) ) / float(xlen);
+ yfreq = cpd * ( float(yp) + (float(yl)/2.0) ) / float(ylen);
+
+ if ( fsort != I_frame )
+ {
+ xfreq /= 8.0;
+ yfreq /= 8.0;
+ }
+
+
+ temp = PerceptualWeight( xfreq/chroma_xfac , yfreq/chroma_yfac , csort );
+
+ band_list(i).SetWt(temp);
+ }// i
+
+ // Give more welly to DC in a completely unscientific manner ...
+ // (should really relate this to the frame rate)
+ band_list( band_list.Length() ).SetWt(band_list(13).Wt()/6.0);
+
+ // Make sure dc is always the lowest weight
+ float min_weight=band_list(band_list.Length()).Wt();
+
+ for( int b=1 ; b<=band_list.Length()-1 ; b++ )
+ min_weight = ((min_weight>band_list(b).Wt()) ? band_list(b).Wt() : min_weight);
+
+ band_list( band_list.Length() ).SetWt( min_weight );
+
+ // Now normalize weights so that white noise is always weighted the same
+
+ // Overall factor to ensure that white noise ends up with the same RMS, whatever the weight
+ double overall_factor=0.0;
+ //fraction of the total number of samples belonging to each subband
+ double subband_fraction;
+
+ for( int i=1 ; i<=band_list.Length() ; i++ )
+ {
+ subband_fraction = 1.0/((double) band_list(i).Scale() * band_list(i).Scale());
+ overall_factor += subband_fraction/( band_list(i).Wt() * band_list(i).Wt() );
+ }
+ overall_factor = std::sqrt( overall_factor );
+
+ //go through and normalise
+
+ for( int i=band_list.Length() ; i>0 ; i-- )
+ band_list(i).SetWt( band_list(i).Wt() * overall_factor );
+ }
+ else
+ {//cpd=0 so set all weights to 1
+
+ for( int i=1 ; i<=band_list.Length() ; i++ )
+ band_list(i).SetWt( 1.0 );
+
+ }
+
+ //Finally, adjust to compensate for the absence of scaling in the transform
+ //Factor used to compensate:
+ const double alpha(1.149658203);
+ for ( int i=1 ; i<=band_list.Length() ; ++i )
+ {
+ depth=band_list(i).Depth();
+
+ if ( band_list(i).Xp() == 0 && band_list(i).Yp() == 0)
+ temp=std::pow(alpha,2*depth);
+ else if ( band_list(i).Xp() != 0 && band_list(i).Yp() != 0)
+ temp=std::pow(alpha,2*(depth-2));
+ else
+ temp=std::pow(alpha,2*(depth-1));
+
+ band_list(i).SetWt(band_list(i).Wt()/temp);
+
+ }// i
+
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_common/wavelet_utils.h b/src/filters/parser/diracsplitter/libdirac/libdirac_common/wavelet_utils.h
new file mode 100644
index 000000000..4e592fa86
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_common/wavelet_utils.h
@@ -0,0 +1,334 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: wavelet_utils.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _WAVELET_UTILS_H_
+#define _WAVELET_UTILS_H_
+
+#include <libdirac_common/arrays.h>
+#include <libdirac_common/common.h>
+#include <vector>
+#include <cmath>
+#include <iostream>
+
+namespace dirac
+{
+ //utilities for subband and wavelet transforms
+ //Includes fast transform using lifting
+
+ class PicArray;
+
+ //! Class encapsulating all the metadata relating to a wavelet subband
+ class Subband
+ {
+ public:
+
+ //! Default constructor
+ Subband();
+
+ //! Constructor
+ /*!
+ The constructor parameters are
+ \param xpos the xposition of the subband when packed into a big array with all the others
+ \param ypos the xposition of the subband
+ \param xlen the width of the subband
+ \param ylen the height of the subband
+ */
+ Subband(int xpos, int ypos, int xlen, int ylen);
+
+ //! Constructor
+ /*!
+ The constructor parameters are
+ \param xpos the xposition of the subband when packed into a big array with all the others
+ \param ypos the xposition of the subband
+ \param xlen the width of the subband
+ \param ylen the height of the subband
+ \param d the depth of the subband in the wavelet transform
+ */
+ Subband(int xpos, int ypos, int xlen, int ylen, int d);
+
+ //! Destructor
+ ~Subband();
+
+ //Default (shallow) copy constructor and operator= used
+
+ //! Return the width of the subband
+ int Xl() const {return xln;}
+
+ //! Return the horizontal position of the subband
+ int Xp() const {return xps;}
+
+ //! Return the height of the subband
+ int Yl() const {return yln;}
+
+ //! Return the vertical position of the subband
+ int Yp() const {return yps;}
+
+ //! Return the index of the maximum bit of the largest coefficient
+ int Max() const {return max_bit;}
+
+ //! Return the subband perceptual weight
+ double Wt() const {return wgt;}
+
+ //! Return the depth of the subband in the transform
+ int Depth() const {return dpth;}
+
+ //! Return the scale of the subband, viewed as a subsampled version of the picture
+ int Scale() const {return (1<<dpth);}
+
+ //! Return a quantisation factor
+ int Qf(int n) const {return qfac[n];}
+
+ //! Return the index of the parent subband
+ int Parent() const {return prt;}
+
+ //! Return the indices of any child subbands
+ std::vector<int> Children() const {return childvec;}
+
+ int Child(int n) const {return childvec[n];}
+
+ // ... and sets
+ //! Set the perceptual weight
+ void SetQf(int n, int q)
+ {
+ if (n >= qfac.First() && n<=qfac.Last() )
+ qfac[n]=q;
+ }
+
+ //! Set the perceptual weight
+ void SetWt(float w){wgt=w;}
+
+ //! Set the parent index
+ void SetParent(int p){prt=p;}
+
+ //! Set the subband depth
+ void SetDepth(int d){dpth=d;}
+
+ //! Set the index of the maximum bit of the largest coefficient
+ void SetMax(int m){max_bit=m;};
+
+ //! Set the indices of the children of the subband
+ void SetChildren(std::vector<int>& clist){childvec=clist;}
+
+ //! Add a child to the list of child subbands
+ void AddChild(int c){childvec.push_back(c);}
+
+ private:
+ int xps,yps,xln,yln; //subband bounds
+ double wgt; //perceptual weight for quantisation
+ int dpth; //depth in the transform
+ OneDArray<int> qfac; //quantisers
+ int prt; //position of parent in a subband list
+ std::vector<int> childvec; //positions of children in the subband list
+ int max_bit; //position of the MSB of the largest absolute value
+ };
+
+ //! A class encapulating all the subbands produced by a transform
+ class SubbandList
+ {
+ public:
+ //! Constructor
+ SubbandList(){}
+
+ //! Destructor
+ ~SubbandList(){}
+
+ //Default (shallow) copy constructor and operator= used
+ //! Initialise the list
+ void Init(const int depth,const int xlen,const int ylen);
+
+ //! Return the length of the subband list
+ int Length() const {return bands.size();}
+
+ //! Return the subband at position n (1<=n<=length)
+ Subband& operator()(int n){return bands[n-1];}
+
+ //! Return the subband at position n (1<=n<=length)
+ const Subband& operator()(int n) const {return bands[n-1];}
+
+ //! Add a band to the list
+ void AddBand(Subband& b){bands.push_back(b);}
+
+ //! Remove all the bands from the list
+ void Clear(){bands.clear();}
+
+ private:
+ std::vector<Subband> bands;
+ };
+
+
+ //! Class to do two-tap prediction lifting step
+ template <int gain> class PredictStep
+ {
+
+ public:
+
+ //! Constructor
+ PredictStep(){}
+
+ // Assume default copy constructor, assignment= and destructor //
+
+ //! Do the filtering
+ /*
+ Do the filtering.
+ \param in_val the value being predicted
+ \param val1 the first value being used for prediction
+ \param val2 the second value being used for prediction
+ */
+ void Filter(ValueType& in_val, const ValueType& val1, const ValueType& val2) const;
+
+ private:
+
+ };
+
+ template <int gain>
+ inline void PredictStep<gain>::Filter( ValueType& in_val,
+ const ValueType& val1,
+ const ValueType& val2) const
+ {
+ in_val -= static_cast< ValueType >( (gain * static_cast< int >( val1 + val2 )) >>12 );
+ }
+
+ //! Class to do two-tap updating lifting step
+ template <int gain> class UpdateStep
+ {
+
+ public:
+ //! Constructor
+ UpdateStep(){}
+
+ //! Do the filtering
+ /*
+ Do the filtering.
+ \param in_val the value being updated
+ \param val1 the first value being used for updating
+ \param val2 the second value being used for updating
+ */
+ void Filter(ValueType& in_val, const ValueType& val1, const ValueType& val2) const;
+
+ private:
+
+ };
+
+ template <int gain>
+ inline void UpdateStep<gain>::Filter(ValueType& in_val,
+ const ValueType& val1,
+ const ValueType& val2) const
+ {
+ in_val += static_cast< ValueType >( (gain * static_cast< int >( val1 + val2 )) >>12 );
+ }
+
+
+
+
+
+ //! A class to do wavelet transforms
+ /*!
+ A class to do forward and backward wavelet transforms by iteratively
+ splitting or merging the lowest frequency band.
+ */
+ class WaveletTransform
+ {
+ public:
+ //! Constructor
+ // WaveletTransform(WaveletTransformParams p);
+ WaveletTransform(int d = 4, WltFilter f = DAUB);
+
+ //! Destructor
+ virtual ~WaveletTransform();
+
+ //! Transforms the data to and from the wavelet domain
+ /*!
+ Transforms the data to and from the wavelet domain.
+ \param d the direction of the transform
+ \param pic_data the data to be transformed
+ */
+ void Transform(const Direction d, PicArray& pic_data);
+
+ //! Returns the set of subbands
+ SubbandList& BandList(){return band_list;}
+
+ //! Returns the set of subbands
+ const SubbandList& BandList() const {return band_list;}
+
+ //! Sets the subband weights
+ /*!
+ Sets perceptual weights for the subbands. Takes into account both
+ perceptual factors (weight noise less at higher spatial
+ frequencies) and the scaling needed for the wavelet transform.
+
+ \param cpd perctual factor - the number of cycles per degree
+ \param fsort the frame sort (I, L1 or L2)
+ \param cformat the chroma format
+ \param csort the component type (Y, U or V)
+ */
+ void SetBandWeights (const float cpd,
+ const FrameSort& fsort,
+ const ChromaFormat& cformat,
+ const CompSort csort);
+
+ private:
+ //other private variables
+ // WaveletTransformParams params;
+
+ SubbandList band_list;
+
+ //! Depth of the transform
+ int depth;
+
+ //! The filter set to be used (only Daubechies supported at present)
+ WltFilter filt_sort;
+
+ //functions
+ //! Private, bodyless copy constructor: class should not be copied
+ WaveletTransform(const WaveletTransform& cpy);
+
+ //! Private, bodyless copy operator=: class should not be assigned
+ WaveletTransform& operator=(const WaveletTransform& rhs);
+
+ //! Given x and y spatial frequencies in cycles per degree, returns a weighting value
+ float PerceptualWeight(float xf,float yf,CompSort cs);
+
+ //! Split a subband into 4
+ void VHSplit(const int xp, const int yp, const int xl, const int yl, PicArray&pic_data);
+
+ //! Synthesise a picture from 4 subbands
+ void VHSynth(const int xp, const int yp, const int xl, const int yl, PicArray& pic_data);
+};
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/Makefile.am b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/Makefile.am
new file mode 100644
index 000000000..d7e61b319
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/Makefile.am
@@ -0,0 +1,61 @@
+# $Id: Makefile.am 280 2005-01-30 05:11:46Z gabest $
+#
+
+INCLUDES = -I$(top_srcdir) -I$(srcdir)
+
+h_sources = comp_decompress.h frame_decompress.h seq_decompress.h \
+ decoder_types.h dirac_cppparser.h dirac_parser.h
+
+cpp_sources = comp_decompress.cpp frame_decompress.cpp seq_decompress.cpp \
+ dirac_cppparser.cpp dirac_parser.cpp
+
+if USE_MSVC
+lib_LIBRARIES = libdirac_decoder.a
+libdirac_decoder_a_AR = link -lib -out:libdirac_decoder.a $(libdirac_decoder_a_OBJECTS); link $(LIBFLAGS) -out:libdirac_decoder$(LIBEXT) $(LDFLAGS) $(libdirac_decoder_a_OBJECTS) $(libdirac_decoder_a_DEPENDENCIES); echo
+else
+lib_LTLIBRARIES = libdirac_decoder.la
+endif
+libdirac_decoder_a_SOURCES = $(h_sources) $(cpp_sources)
+
+libdirac_decoder_a_LIBADD = \
+ $(top_builddir)/libdirac_common/libdirac_common.a
+
+libdirac_decoder_la_SOURCES = $(h_sources) $(cpp_sources)
+libdirac_decoder_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+libdirac_decoder_la_LIBADD = $(top_builddir)/libdirac_common/libdirac_common.la
+
+libdirac_decoder_la_LDFLAGS= -no-undefined -version-info $(GENERIC_LIBRARY_VERSION)
+
+library_includedir=$(includedir)/$(GENERIC_LIBRARY_NAME)/libdirac_decoder
+library_include_HEADERS = dirac_parser.h decoder_types.h
+
+if USE_MSVC
+install-exec-local: libdirac_decoder.lib
+ $(mkinstalldirs) "$(DESTDIR)$(libdir)"; \
+ echo " $(INSTALL_PROGRAM) libdirac_decoder.lib $(DESTDIR)$(libdir)/libdirac_decoder.lib"; \
+ $(INSTALL_PROGRAM) libdirac_decoder.lib $(DESTDIR)$(libdir)/libdirac_decoder.lib || exit 1; \
+ for ext in dll pdb; do \
+ file="libdirac_decoder.$$ext"; \
+ if test -f "$$file"; then \
+ $(mkinstalldirs) "$(DESTDIR)$(bindir)"; \
+ echo " $(INSTALL_PROGRAM) $$file $(DESTDIR)$(bindir)/$$file"; \
+ $(INSTALL_PROGRAM) "$$file" "$(DESTDIR)$(bindir)/$$file" || exit 1; \
+ fi \
+ done
+
+uninstall-local:
+ for file in \
+ "$(DESTDIR)$(bindir)/libdirac_decoder.dll" \
+ "$(DESTDIR)$(bindir)/libdirac_decoder.pdb" \
+ "$(DESTDIR)$(libdir)/libdirac_decoder.lib"; \
+ do \
+ if test -f "$$file"; then \
+ echo " rm -f" "$$file"; \
+ rm -f "$$file"; \
+ fi \
+ done
+endif
+if USE_MSVC
+CLEANFILES = *.pdb *.ilk *.dll *.lib *.exp *.a
+endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/Makefile.in b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/Makefile.in
new file mode 100644
index 000000000..98f19b55f
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/Makefile.in
@@ -0,0 +1,485 @@
+# Makefile.in generated by automake 1.8.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+SOURCES = $(libdirac_decoder_a_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = libdirac_decoder
+DIST_COMMON = $(library_include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(mkdir_p)
+CONFIG_CLEAN_FILES =
+AR = ar
+ARFLAGS = cru
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+libdirac_decoder_a_LIBADD =
+am__objects_1 =
+am__objects_2 = comp_decompress.$(OBJEXT) frame_decompress.$(OBJEXT) \
+ seq_decompress.$(OBJEXT) dirac_cppparser.$(OBJEXT) \
+ dirac_parser.$(OBJEXT)
+am_libdirac_decoder_a_OBJECTS = $(am__objects_1) $(am__objects_2)
+libdirac_decoder_a_OBJECTS = $(am_libdirac_decoder_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/comp_decompress.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/dirac_cppparser.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/dirac_parser.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/frame_decompress.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/seq_decompress.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libdirac_decoder_a_SOURCES)
+DIST_SOURCES = $(libdirac_decoder_a_SOURCES)
+library_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(library_include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GENERIC_LIBRARY_NAME = @GENERIC_LIBRARY_NAME@
+GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@
+GENERIC_RELEASE = @GENERIC_RELEASE@
+GENERIC_VERSION = @GENERIC_VERSION@
+HAVE_ALGO_FALSE = @HAVE_ALGO_FALSE@
+HAVE_ALGO_TRUE = @HAVE_ALGO_TRUE@
+HAVE_CPPUNIT_FALSE = @HAVE_CPPUNIT_FALSE@
+HAVE_CPPUNIT_TRUE = @HAVE_CPPUNIT_TRUE@
+HAVE_DOT = @HAVE_DOT@
+HAVE_DOT_FALSE = @HAVE_DOT_FALSE@
+HAVE_DOT_TRUE = @HAVE_DOT_TRUE@
+HAVE_DOXYGEN = @HAVE_DOXYGEN@
+HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
+HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
+HAVE_DVIPDFM = @HAVE_DVIPDFM@
+HAVE_DVIPDFM_FALSE = @HAVE_DVIPDFM_FALSE@
+HAVE_DVIPDFM_TRUE = @HAVE_DVIPDFM_TRUE@
+HAVE_LATEX = @HAVE_LATEX@
+HAVE_LATEX_FALSE = @HAVE_LATEX_FALSE@
+HAVE_LATEX_TRUE = @HAVE_LATEX_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OVERLAY_FALSE = @OVERLAY_FALSE@
+OVERLAY_TRUE = @OVERLAY_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_MSVC_FALSE = @USE_MSVC_FALSE@
+USE_MSVC_TRUE = @USE_MSVC_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I$(top_srcdir) -I$(srcdir)
+h_sources = comp_decompress.h frame_decompress.h seq_decompress.h \
+ decoder_types.h dirac_cppparser.h dirac_parser.h
+
+cpp_sources = comp_decompress.cpp frame_decompress.cpp seq_decompress.cpp \
+ dirac_cppparser.cpp dirac_parser.cpp
+
+lib_LIBRARIES = libdirac_decoder.a
+libdirac_decoder_a_SOURCES = $(h_sources) $(cpp_sources)
+library_includedir = $(includedir)/$(GENERIC_LIBRARY_NAME)/libdirac_decoder
+library_include_HEADERS = $(h_sources)
+@USE_MSVC_TRUE@CLEANFILES = *.pdb *.ilk
+@USE_MSVC_FALSE@libdirac_decoder_a_AR = ar crv
+@USE_MSVC_TRUE@libdirac_decoder_a_AR = link.exe -lib /out:libdirac_decoder.a $(libdirac_decoder_a_OBJECTS) ; echo
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libdirac_decoder/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign libdirac_decoder/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libdirac_decoder.a: $(libdirac_decoder_a_OBJECTS) $(libdirac_decoder_a_DEPENDENCIES)
+ -rm -f libdirac_decoder.a
+ $(libdirac_decoder_a_AR) libdirac_decoder.a $(libdirac_decoder_a_OBJECTS) $(libdirac_decoder_a_LIBADD)
+ $(RANLIB) libdirac_decoder.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comp_decompress.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirac_cppparser.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirac_parser.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame_decompress.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seq_decompress.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-library_includeHEADERS: $(library_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(library_includedir)" || $(mkdir_p) "$(DESTDIR)$(library_includedir)"
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(library_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(library_includedir)/$$f'"; \
+ $(library_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+uninstall-library_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(library_includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-library_includeHEADERS
+
+install-exec-am: install-libLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLIBRARIES \
+ uninstall-library_includeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLIBRARIES \
+ install-library_includeHEADERS install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am uninstall-libLIBRARIES \
+ uninstall-library_includeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/comp_decompress.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/comp_decompress.cpp
new file mode 100644
index 000000000..d98cb9fab
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/comp_decompress.cpp
@@ -0,0 +1,184 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: comp_decompress.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#include <libdirac_decoder/comp_decompress.h>
+#include <libdirac_common/wavelet_utils.h>
+#include <libdirac_common/band_codec.h>
+#include <libdirac_common/golomb.h>
+using namespace dirac;
+
+#include <vector>
+
+#include <ctime>
+
+using std::vector;
+
+//Constructor
+CompDecompressor::CompDecompressor( DecoderParams& decp, const FrameParams& fp)
+:
+m_qflist(60),
+m_decparams(decp),
+m_fparams(fp)
+{}
+
+
+void CompDecompressor::Decompress(PicArray& pic_data)
+{
+ const FrameSort& fsort=m_fparams.FSort();
+ const int depth=4;
+ BandCodec* bdecoder;
+ const size_t CONTEXTS_REQUIRED = 24;
+ Subband node;
+ unsigned int max_bits;
+ int qf_idx;
+
+ WaveletTransform wtransform(depth);
+ SubbandList& bands=wtransform.BandList();
+ bands.Init(depth , pic_data.LengthX() , pic_data.LengthY());
+
+ GenQuantList();
+
+ for (int I=bands.Length();I>=1;--I)
+ {
+
+ //read the header data first
+ qf_idx=GolombDecode( m_decparams.BitsIn() );
+ if (qf_idx!=-1){
+ bands(I).SetQf(0,m_qflist[qf_idx]);
+ max_bits=UnsignedGolombDecode( m_decparams.BitsIn() );
+ m_decparams.BitsIn().FlushInput();
+
+ if (I>=bands.Length()){
+ if (fsort==I_frame && I==bands.Length())
+ bdecoder=new IntraDCBandCodec( &m_decparams.BitsIn() , CONTEXTS_REQUIRED ,bands);
+ else
+ bdecoder=new LFBandCodec( &m_decparams.BitsIn() , CONTEXTS_REQUIRED ,bands , I);
+ }
+ else
+ bdecoder=new BandCodec( &m_decparams.BitsIn() , CONTEXTS_REQUIRED , bands , I);
+
+ bdecoder->InitContexts();
+ bdecoder->Decompress(pic_data,max_bits);
+ delete bdecoder;
+ }
+ else{
+ m_decparams.BitsIn().FlushInput();
+ if (I==bands.Length() && fsort==I_frame)
+ SetToVal(pic_data,bands(I),2692);
+ else
+ SetToVal(pic_data,bands(I),0);
+ }
+ }
+ wtransform.Transform(BACKWARD,pic_data);
+}
+
+void CompDecompressor::SetToVal(PicArray& pic_data,const Subband& node,ValueType val){
+ for (int J=node.Yp();J<node.Yp()+node.Yl();++J)
+ {
+ for (int I=node.Xp();I<node.Xp()+node.Xl();++I)
+ {
+ pic_data[J][I]=val;
+ }
+ }
+}
+
+void CompDecompressor::GenQuantList(){//generates the list of quantisers and inverse quantisers
+ //there is some repetition in this list but at the moment this is easiest from the perspective of SelectQuant
+ //Need to remove this repetition later TJD 29 March 04.
+
+ m_qflist[0]=1;
+ m_qflist[1]=1;
+ m_qflist[2]=1;
+ m_qflist[3]=1;
+ m_qflist[4]=2;
+ m_qflist[5]=2;
+ m_qflist[6]=2;
+ m_qflist[7]=3;
+ m_qflist[8]=4;
+ m_qflist[9]=4;
+ m_qflist[10]=5;
+ m_qflist[11]=6;
+ m_qflist[12]=8;
+ m_qflist[13]=9;
+ m_qflist[14]=11;
+ m_qflist[15]=13;
+ m_qflist[16]=16;
+ m_qflist[17]=19;
+ m_qflist[18]=22;
+ m_qflist[19]=26;
+ m_qflist[20]=32;
+ m_qflist[21]=38;
+ m_qflist[22]=45;
+ m_qflist[23]=53;
+ m_qflist[24]=64;
+ m_qflist[25]=76;
+ m_qflist[26]=90;
+ m_qflist[27]=107;
+ m_qflist[28]=128;
+ m_qflist[29]=152;
+ m_qflist[30]=181;
+ m_qflist[31]=215;
+ m_qflist[32]=256;
+ m_qflist[33]=304;
+ m_qflist[34]=362;
+ m_qflist[35]=430;
+ m_qflist[36]=512;
+ m_qflist[37]=608;
+ m_qflist[38]=724;
+ m_qflist[39]=861;
+ m_qflist[40]=1024;
+ m_qflist[41]=1217;
+ m_qflist[42]=1448;
+ m_qflist[43]=1722;
+ m_qflist[44]=2048;
+ m_qflist[45]=2435;
+ m_qflist[46]=2896;
+ m_qflist[47]=3444;
+ m_qflist[48]=4096;
+ m_qflist[49]=4870;
+ m_qflist[50]=5792;
+ m_qflist[51]=6888;
+ m_qflist[52]=8192;
+ m_qflist[53]=9741;
+ m_qflist[54]=11585;
+ m_qflist[55]=13777;
+ m_qflist[56]=16384;
+ m_qflist[57]=19483;
+ m_qflist[58]=23170;
+ m_qflist[59]=27554;
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/comp_decompress.h b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/comp_decompress.h
new file mode 100644
index 000000000..530085fe5
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/comp_decompress.h
@@ -0,0 +1,118 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: comp_decompress.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+
+#ifndef _COMP_DECOMPRESS_H_
+#define _COMP_DECOMPRESS_H_
+
+#include <libdirac_common/arrays.h>
+#include <libdirac_common/wavelet_utils.h>
+#include <libdirac_common/common.h>
+
+namespace dirac
+{
+ //! Compress a frame component
+ /*!
+ This class compresses one of the three components (Y, U, or V) of a
+ frame according to a given set or parameters. CompCompressor is used
+ by FrameCompressor..
+ */
+ class CompDecompressor{
+ public:
+ //! Constructor
+ /*!
+ Create and initialize a component decompressor with the given
+ characteristics.
+ \param decp decoding parameters
+ \param fp frame parameters
+ */
+ CompDecompressor( DecoderParams& decp, const FrameParams& fp);
+
+ //! Decompress a frame component
+ /*!
+ Decompress a PicArray containing a frame component (Y, U, or V).
+
+ \param pic_data contains the component data to be decompressed
+ */
+ void Decompress(PicArray& pic_data);
+
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not
+ be copied.
+
+ */
+ CompDecompressor(const CompDecompressor& cpy);
+
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned.
+
+ */
+ CompDecompressor& operator=(const CompDecompressor& rhs);
+
+ //! Sets the data of a specific subband node to a given value
+ /*!
+ Sets the data of a specific subband node to a given value
+
+ \param pic_data contains the component data
+ \param node subband node
+ \param val the value to set
+ */
+ void SetToVal(PicArray& pic_data,const Subband& node,ValueType val);
+
+
+ //! Generate the list of possible quantisers and inverse quantisers
+ void GenQuantList();
+
+ //! Quantiser list generated by GenQuantList
+ OneDArray<int> m_qflist;
+
+ //! Copy of the decompression parameters provided to the constructor
+ DecoderParams& m_decparams;
+
+ //! Reference to the frame parameters provided to the constructor
+ const FrameParams& m_fparams;
+
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/decoder_types.h b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/decoder_types.h
new file mode 100644
index 000000000..bf3c001e7
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/decoder_types.h
@@ -0,0 +1,63 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: decoder_types.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+
+#ifndef DECODER_TYPES_H
+#define DECODER_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+* Different states the parser is in
+*/
+typedef enum {
+ STATE_BUFFER, /* need more data input */
+ STATE_SEQUENCE, /* start of sequence detected */
+ STATE_PICTURE_START, /* start of picture detected */
+ STATE_PICTURE_DECODE, /* decoding picture */
+ STATE_PICTURE_AVAIL, /* decoded picture available */
+ STATE_SEQUENCE_END, /* end of sequence detected */
+ STATE_INVALID /* invalid state. Stop further processing */
+ } DecoderState;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_cppparser.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_cppparser.cpp
new file mode 100644
index 000000000..a17f6b709
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_cppparser.cpp
@@ -0,0 +1,453 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: dirac_cppparser.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <sstream>
+#include <cstdio>
+#include <cstring>
+#include <libdirac_common/dirac_assertions.h>
+#include <libdirac_decoder/dirac_cppparser.h>
+#include <libdirac_decoder/seq_decompress.h>
+#include <libdirac_common/frame.h>
+using namespace dirac;
+
+
+InputStreamBuffer::InputStreamBuffer()
+{
+ m_chunk_buffer = new char[m_buffer_size];
+
+ setg (m_chunk_buffer, //beginning of read area
+ m_chunk_buffer, //read position
+ m_chunk_buffer); //end position
+}
+
+std::ios::pos_type InputStreamBuffer::Rewind()
+{
+ return Seek(0, std::ios::beg);
+}
+
+std::ios::pos_type InputStreamBuffer::Tell()
+{
+ return gptr() - eback();
+}
+
+std::ios::pos_type InputStreamBuffer::Seek(std::ios::pos_type bytes, std::ios::seekdir dir)
+{
+ char *new_pos;
+
+ switch (dir)
+ {
+ case std::ios::beg:
+ new_pos = eback() + bytes;
+ break;
+ case std::ios::end:
+ new_pos = egptr() + bytes;
+ break;
+ default:
+ new_pos = gptr() + bytes;
+ break;
+ }
+ if (new_pos > egptr() || new_pos < eback())
+ return -1;
+
+ setg(eback(), //start of read
+ new_pos, //current read position
+ egptr()); //end of stream positon
+
+ return 0;
+}
+
+void InputStreamBuffer::Copy(char *start, int bytes)
+{
+ //std::cerr << "eback=" << m_chunk_buffer - eback()
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
+
+ int bytes_left = m_buffer_size - (egptr() - m_chunk_buffer);
+ if (bytes_left < bytes)
+ {
+ char *temp = new char [m_buffer_size + bytes];
+ memcpy (temp, m_chunk_buffer, m_buffer_size);
+ setg (temp, temp+(gptr()-m_chunk_buffer), temp + (egptr() - m_chunk_buffer));
+ delete [] m_chunk_buffer;
+ m_chunk_buffer = temp;
+ }
+ //std::cerr << "eback=" << m_chunk_buffer - eback()
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
+
+ memcpy (egptr(), start, bytes);
+ setg(m_chunk_buffer, gptr(), egptr()+bytes);
+
+ //std::cerr << "eback=" << m_chunk_buffer - eback()
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
+}
+
+void InputStreamBuffer::PurgeProcessedData()
+{
+ //std::cerr << "eback=" << m_chunk_buffer - eback()
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
+
+ if (gptr() != m_chunk_buffer)
+ {
+ memmove (m_chunk_buffer, gptr(), egptr() - gptr());
+ setg(m_chunk_buffer, m_chunk_buffer, m_chunk_buffer+(egptr() - gptr()));
+ }
+ //std::cerr << "eback=" << m_chunk_buffer - eback()
+ // << "gptr=" << gptr() -m_chunk_buffer
+ // << "egptr=" << egptr() - m_chunk_buffer << endl;
+}
+
+InputStreamBuffer::~InputStreamBuffer()
+{
+ delete [] m_chunk_buffer;
+}
+
+
+DiracParser::DiracParser(bool verbose) :
+ m_state(STATE_BUFFER),
+ m_next_state(STATE_SEQUENCE),
+ m_show_fnum(-1),
+ m_decomp(0),
+ m_skip(false),
+ m_skip_type(L2_frame),
+ m_verbose(verbose),
+ m_found_start(false),
+ m_found_end(false),
+ m_shift (0xffffffff)
+{
+ m_istr = new std::istream(&m_sbuf);
+}
+
+DiracParser::~DiracParser()
+{
+ delete m_istr;
+ delete m_decomp;
+}
+
+void DiracParser::SetBuffer (char *start, char *end)
+{
+ TEST (end > start);
+ m_sbuf.Copy(start, end - start);
+
+}
+
+DecoderState DiracParser::Parse()
+{
+
+ while(true)
+ {
+ m_state = SeekChunk();
+ switch (m_state)
+ {
+ case STATE_BUFFER:
+ return m_state;
+
+ case STATE_SEQUENCE:
+ if (m_next_state == m_state)
+ {
+ if (m_decomp)
+ delete m_decomp;
+
+ m_decomp = new SequenceDecompressor (m_istr, m_verbose);
+ if (m_decomp->GetSeqParams().BitstreamVersion() != BITSTREAM_VERSION)
+ {
+ std::ostringstream errstr;
+ errstr << "Input Bitstream version " << m_decomp->GetSeqParams().BitstreamVersion() << " supported";
+ REPORTM(false, errstr.str().c_str());
+ return STATE_INVALID;
+ }
+ InitStateVars();
+ return m_state;
+ }
+ else
+ m_state = STATE_BUFFER;
+
+ break;
+
+ case STATE_PICTURE_START:
+ if (m_next_state == m_state)
+ {
+ m_decomp->ReadNextFrameHeader();
+ m_next_state = STATE_PICTURE_DECODE;
+ m_sbuf.PurgeProcessedData();
+ return m_state;
+ }
+ else
+ {
+ m_state = STATE_BUFFER;
+ }
+ break;
+
+ case STATE_PICTURE_DECODE:
+ {
+ Frame &my_frame = m_decomp->DecompressNextFrame(m_skip);
+ if (m_skip)
+ {
+ // Go pass start code so that we skip frame
+ m_sbuf.Seek(5);
+ }
+ else
+ {
+ int framenum_decoded = my_frame.GetFparams().FrameNum();
+ if (framenum_decoded != m_show_fnum)
+ {
+ m_show_fnum = my_frame.GetFparams().FrameNum();
+ if (m_verbose)
+ {
+ std::cerr << "Frame " << m_show_fnum << " available" << std::endl;
+ }
+ m_state = STATE_PICTURE_AVAIL;
+ }
+ }
+ InitStateVars();
+ if (m_state == STATE_PICTURE_AVAIL)
+ return m_state;
+
+ break;
+ }
+ case STATE_SEQUENCE_END:
+ {
+ //push last frame in sequence out
+ m_sbuf.Seek(5);
+ Frame &my_frame = m_decomp->DecompressNextFrame(m_skip);
+ if (!m_skip)
+ {
+ if (my_frame.GetFparams().FrameNum() != m_show_fnum)
+ {
+ m_show_fnum = my_frame.GetFparams().FrameNum();
+ if (m_verbose)
+ {
+ std::cerr << "Frame " << m_show_fnum << " available" << std::endl;
+ }
+ m_state = STATE_PICTURE_AVAIL;
+ m_next_state = STATE_SEQUENCE_END;
+ }
+ else
+ {
+ InitStateVars();
+ }
+ }
+ else
+ {
+ InitStateVars();
+ }
+ return m_state;
+
+ break;
+ }
+ default:
+ return STATE_INVALID;
+ }
+ }
+ return m_state;
+}
+
+const SeqParams& DiracParser::GetSeqParams() const
+{
+ return m_decomp->GetSeqParams();
+}
+
+const FrameParams& DiracParser::GetNextFrameParams() const
+{
+ return m_decomp->GetNextFrameParams();
+}
+
+const Frame& DiracParser::GetNextFrame() const
+{
+ return m_decomp->GetNextFrame();
+}
+
+const Frame& DiracParser::GetLastFrame() const
+{
+ return m_decomp->DecompressNextFrame();
+}
+
+void DiracParser::SetSkip(bool skip)
+{
+ const FrameParams& fparams = m_decomp->GetNextFrameParams();
+ // FIXME: need to change this logic once bitstream is finalised. so that
+ // we skip to next RAP when an L1 frame is skipped
+ if (skip == false)
+ {
+ if (m_skip_type == L2_frame)
+ m_skip = false;
+
+ else if (m_skip_type == L1_frame || m_skip_type == I_frame)
+ {
+ if (fparams.FSort() == L2_frame || fparams.FSort() == L1_frame)
+ m_skip = true;
+ else
+ {
+ m_skip_type = L2_frame;
+ m_skip = false;
+ }
+ }
+ }
+ else
+ {
+ m_skip = true;
+ if (m_skip_type != fparams.FSort())
+ {
+ switch (fparams.FSort())
+ {
+ case L2_frame:
+ break;
+
+ case L1_frame:
+ if (m_skip_type != I_frame)
+ m_skip_type = L1_frame;
+ break;
+ case I_frame:
+ m_skip_type = I_frame;
+ break;
+
+ default:
+ dirac_ASSERTM(false, "Frame type must be I or L1 or L2");
+ break;
+ }
+ }
+ }
+}
+
+
+DecoderState DiracParser::SeekChunk()
+{
+ char byte;
+ if (!m_found_start)
+ {
+ while (m_sbuf.sgetn(&byte, 1))
+ {
+ //Find start of next chunk to be processed
+ if (m_shift == START_CODE_PREFIX)
+ {
+ switch ((unsigned char)byte)
+ {
+ case NOT_START_CODE:
+ m_shift = 0xffffffff;
+ continue;
+
+ case RAP_START_CODE:
+ m_next_state = STATE_SEQUENCE;
+ break;
+
+ case IFRAME_START_CODE:
+ case L1FRAME_START_CODE:
+ case L2FRAME_START_CODE:
+ m_next_state = STATE_PICTURE_START;
+ break;
+
+ case SEQ_END_CODE:
+ m_next_state = STATE_SEQUENCE_END;
+ break;
+ default:
+ dirac_ASSERTM (false, "Should never have reached here!!!");
+ break;
+ }
+ m_found_start = true;
+ m_sbuf.Seek(-5);
+ m_sbuf.PurgeProcessedData();
+ m_sbuf.Seek(5);
+ m_shift = 0xffffffff;
+ break;
+ }
+ m_shift = (m_shift << 8) | byte;
+ }
+
+ if (!m_found_start)
+ {
+ m_next_state = STATE_BUFFER;
+ }
+ }
+
+ if (m_found_start && !m_found_end && m_next_state != STATE_SEQUENCE_END)
+ {
+ while (m_sbuf.sgetn(&byte, 1))
+ {
+ //Find start of next chunk to be processed
+ if (m_shift == START_CODE_PREFIX)
+ {
+ switch ((unsigned char)byte)
+ {
+ case NOT_START_CODE:
+ m_shift = 0xffffffff;
+ continue;
+
+ case RAP_START_CODE:
+ break;
+
+ case IFRAME_START_CODE:
+ case L1FRAME_START_CODE:
+ case L2FRAME_START_CODE:
+ break;
+
+ case SEQ_END_CODE:
+ break;
+
+ default:
+ dirac_ASSERTM (false, "Should never have reached here!!!");
+ break;
+ }
+ m_found_end = true;
+ break;
+
+ }
+ m_shift = (m_shift << 8) | byte;
+ }
+
+ if (!m_found_end)
+ {
+ if (m_next_state != STATE_SEQUENCE_END)
+ return STATE_BUFFER;
+ }
+ }
+
+ if (m_found_start && m_found_end)
+ {
+ m_sbuf.Rewind();
+ m_shift = 0xffffffff;
+ }
+ return m_next_state;
+}
+
+void DiracParser::InitStateVars()
+{
+ m_shift = 0xffffffff;
+ m_found_start = false;
+ m_found_end = false;
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_cppparser.h b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_cppparser.h
new file mode 100644
index 000000000..be4c85eba
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_cppparser.h
@@ -0,0 +1,211 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: dirac_cppparser.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+
+#ifndef DIRAC_CPPPARSER_H
+#define DIRAC_CPPPARSER_H
+
+#include <istream>
+#include <streambuf>
+#include <libdirac_decoder/decoder_types.h> //for DecoderState
+#include <libdirac_common/common.h>
+
+namespace dirac
+{
+ class SequenceDecompressor;
+ class Frame;
+
+ //! Input Stream Buffer Class.
+ class InputStreamBuffer : public std::streambuf
+ {
+ public:
+ //! Constructor
+ InputStreamBuffer ();
+
+ //! Destructor
+ ~InputStreamBuffer();
+
+ //! Rewind buffer to start of data
+ std::ios::pos_type Rewind();
+
+ //! Seek to position specified by bytes offset from pos
+ /*!
+ Seek takes
+ \param bytes offset in bytes
+ \param pos the position from which the offset is applied
+ */
+ std::ios::pos_type Seek(std::ios::pos_type bytes,
+ std::ios::seekdir pos = std::ios::cur);
+
+ //! Return the current read position in the buffer
+ std::ios::pos_type Tell();
+
+ //! Copy data into buffer
+ /*!
+ Copy take
+ \param start memory area start
+ \param bytes number of bytes to copy starting from start
+ */
+ void Copy(char *start, int bytes);
+
+ //! Delete all processed data from buffer
+ void PurgeProcessedData();
+
+ private:
+
+ //! Private body-less copy constructor
+ InputStreamBuffer (const InputStreamBuffer& inbuf);
+
+ //! Private body-less assignment operator
+ InputStreamBuffer& operator = (const InputStreamBuffer& inbuf);
+
+ //! Buffer size
+ static const int m_buffer_size = 1232896;
+
+ //! Buffere
+ char *m_chunk_buffer;
+ };
+
+ //! Dirac Stream Parser Class
+ /*!
+ This class is a wrapper around the SequenceDecompressor class. The
+ Sequence Decompressor class needs a full frame of data to be available
+ to decompress a frame successfully. So, the DiracParser class uses
+ the InputStreamBuffer class to store data until a chunk is available
+ to be processed and then invokes the SequenceDecompressor functions to
+ process data. A chunk of data can be a start of sequence, a frame or
+ end of sequence data. The istream used to instantiate the
+ SequenceDecompressor object is created using an InputStreamBuffer
+ object which is manipulated the DiracParser. This ensures that data is
+ always available for processing by the SequenceDecompressor object.
+ */
+ class DiracParser
+ {
+ public:
+ //! Constructor
+ /*!
+ Constructor takes
+ \param verbose boolean flag. Set to true for verbose output
+ */
+ DiracParser(bool verbose = false );
+
+ //! Destructor
+ ~DiracParser();
+
+ //! Copy data into the internal stream buffer
+ /*! SetBuffer takes
+ \param start Start of input buffer
+ \param end End of input buffer
+ */
+ void SetBuffer (char *start, char *end);
+
+ //! Parse the data in internal buffer
+ /*!
+ Parses the data in the input buffer. This function returns one
+ of the following values
+ \n STATE_BUFFER : Not enough data in internal buffer to process
+ \n STATE_SEQUENCE : Start of sequence detected
+ \n STATE_PICTURE_START : Start of picture detected
+ \n STATE_PICTURE_AVAIL : Decoded picture available
+ \n STATE_SEQUENCE_END : End of sequence detected
+ \n STATE_INVALID : Invalid stream. Stop further processing
+ */
+ DecoderState Parse();
+
+ //! Return the sequence parameters of the current sequence
+ const SeqParams& GetSeqParams() const;
+
+ //! Return the frame parameters of the next frame to be decoded
+ const FrameParams& GetNextFrameParams() const;
+
+ //! Return the decoded frame
+ const Frame& GetNextFrame() const;
+
+ //! Return the last frame in the sequence
+ const Frame& GetLastFrame() const;
+
+ //! Set the skip flag
+ /*! Set the skip flag to the value specified in skip. If skip is true,
+ the parser will skip decoding the next frame until the this
+ function is called again with skip set to false
+ */
+ void SetSkip (bool skip);
+
+ private:
+
+ //! Determine if enough data is available in internal buffer to process
+ DecoderState SeekChunk();
+
+ //! Initialise the parser's internal state variables
+ void InitStateVars();
+
+ private:
+
+ //! private body-less copy constructor
+ DiracParser (const DiracParser &dp);
+ //! private body-less assignement constructor
+ DiracParser& operator = (const DiracParser &dp);
+ //! Current state of parser
+ DecoderState m_state;
+ //! Next state the parser will enter
+ DecoderState m_next_state;
+ //! frame number of last frame decoded in display order
+ int m_show_fnum;
+ //! Sequence decompressor object
+ SequenceDecompressor *m_decomp;
+ //! Input stream object. Initialised using the external input buffer InputStreamBuffer
+ std::istream *m_istr;
+ //! Internal Stream Buffer
+ InputStreamBuffer m_sbuf;
+ //! skip next frame flag
+ bool m_skip;
+ //! skip frame type
+ FrameSort m_skip_type;
+ //! verbose flag
+ bool m_verbose;
+ //! start of chunk flag
+ bool m_found_start;
+ //! end of chunk flag
+ bool m_found_end;
+ //! used to detect start and end of chunk
+ unsigned m_shift;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_parser.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_parser.cpp
new file mode 100644
index 000000000..08f57c41a
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_parser.cpp
@@ -0,0 +1,272 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: dirac_parser.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <cstring>
+#include <libdirac_common/dirac_assertions.h>
+#include <libdirac_decoder/dirac_cppparser.h>
+#include <libdirac_decoder/dirac_parser.h>
+#include <libdirac_common/frame.h>
+using namespace dirac;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern DllExport dirac_decoder_t *dirac_decoder_init(int verbose)
+{
+ dirac_decoder_t* decoder = new dirac_decoder_t;
+ memset (decoder, 0, sizeof(dirac_decoder_t));
+
+ bool verbosity = verbose > 0 ? true : false;
+ DiracParser *parser = new DiracParser(verbosity);
+ decoder->parser = static_cast<void *>(parser);
+
+ decoder->fbuf = new dirac_framebuf_t;
+ decoder->fbuf->id = NULL;
+ decoder->fbuf->buf[0] = decoder->fbuf->buf[1] = decoder->fbuf->buf[2] = NULL;
+ return decoder;
+}
+
+extern DllExport void dirac_decoder_close(dirac_decoder_t *decoder)
+{
+ TEST (decoder != NULL);
+ TEST (decoder->parser != NULL);
+ DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
+
+ delete parser;
+
+ delete decoder->fbuf;
+
+ delete decoder;
+
+ decoder = NULL;
+}
+
+extern DllExport void dirac_buffer (dirac_decoder_t *decoder, unsigned char *start, unsigned char *end)
+{
+ TEST (decoder != NULL);
+ TEST (decoder->parser != NULL);
+ DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
+
+ parser->SetBuffer((char *)start, (char *)end);
+}
+
+static void set_sequence_params (const DiracParser * const parser, dirac_decoder_t *decoder)
+{
+ TEST (parser != NULL);
+ TEST (decoder != NULL);
+
+ dirac_seqparams_t *seq_params = &decoder->seq_params;
+ const SeqParams& sparams = parser->GetSeqParams();
+
+ seq_params->width = sparams.Xl();
+ seq_params->height = sparams.Yl();
+
+ ///TODO: how do we sync definition of Chroma in dirac_parser.cpp
+ // with Chroma is common.h
+ seq_params->chroma = (dirac_chroma_t)sparams.CFormat();
+ switch(seq_params->chroma)
+ {
+ case format411:
+ seq_params->chroma_width = seq_params->width/4;
+ seq_params->chroma_height = seq_params->height;
+ break;
+
+ case format420:
+ seq_params->chroma_width = seq_params->width/2;
+ seq_params->chroma_height = seq_params->height/2;
+ break;
+
+ case format422:
+ seq_params->chroma_width = seq_params->width/2;
+ seq_params->chroma_height = seq_params->height;
+ break;
+ default:
+ seq_params->chroma_width = seq_params->width;
+ seq_params->chroma_height = seq_params->height;
+ break;
+
+ }
+
+ // NOTE: frame rate will be replaced by a struct holding numerator
+ // and denominator values.
+ seq_params->frame_rate.numerator = sparams.FrameRate();
+ seq_params->frame_rate.denominator = 1;
+ seq_params->interlace = sparams.Interlace() ? 1 : 0;
+ seq_params->topfieldfirst = sparams.TopFieldFirst() ? 1 : 0;
+}
+
+static void set_component (const PicArray& pic_data, const CompSort cs, dirac_decoder_t *decoder)
+{
+ TEST (decoder->fbuf != NULL);
+ int xl, yl;
+
+ unsigned char *buf;
+
+ switch (cs)
+ {
+ case U_COMP:
+ xl = decoder->seq_params.chroma_width;
+ yl = decoder->seq_params.chroma_height;
+ buf = decoder->fbuf->buf[1];
+ break;
+ case V_COMP:
+ xl = decoder->seq_params.chroma_width;
+ yl = decoder->seq_params.chroma_height;
+ buf = decoder->fbuf->buf[2];
+ break;
+
+ case Y_COMP:
+ default:
+ xl = decoder->seq_params.width;
+ yl = decoder->seq_params.height;
+ buf = decoder->fbuf->buf[0];
+ break;
+ }
+
+ TEST (buf != NULL);
+ ValueType tempv;
+
+ for (int j=0 ; j<yl ;++j)
+ {
+ for (int i=0 ; i<xl ; ++i)
+ {
+ tempv=pic_data[j][i]+2;
+ tempv>>=2;
+ buf[j*xl+i]=(unsigned char) tempv;
+ }//i
+
+ }//j
+}
+
+static void set_frame_data (const DiracParser * const parser, dirac_decoder_t *decoder)
+{
+ TEST (parser != NULL);
+ TEST (decoder != NULL);
+ TEST (decoder->fbuf != NULL);
+ TEST (decoder->state == STATE_PICTURE_AVAIL);
+
+ const Frame& my_frame = parser->GetNextFrame();
+
+ set_component (my_frame.Ydata(), Y_COMP, decoder);
+ if (decoder->seq_params.chroma != Yonly)
+ {
+ set_component (my_frame.Udata(), U_COMP, decoder);
+ set_component (my_frame.Vdata(), V_COMP, decoder);
+ }
+
+ return;
+}
+
+static void set_frame_params (const FrameParams& my_frame_params, dirac_decoder_t *decoder)
+{
+ TEST (decoder != NULL);
+ dirac_frameparams_t *frame_params = &decoder->frame_params;
+
+ TEST (decoder->state == STATE_PICTURE_AVAIL ||
+ decoder->state == STATE_PICTURE_START);
+
+ frame_params->ftype = (dirac_frame_type_t)my_frame_params.FSort();
+ frame_params->fnum = my_frame_params.FrameNum();
+
+ return;
+}
+
+extern DllExport dirac_decoder_state_t dirac_parse (dirac_decoder_t *decoder)
+{
+ TEST (decoder != NULL);
+ TEST (decoder->parser != NULL);
+ DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
+
+ decoder->state = parser->Parse();
+
+ switch (decoder->state)
+ {
+ case STATE_BUFFER:
+ break;
+
+ case STATE_SEQUENCE:
+ set_sequence_params(parser, decoder);
+ decoder->frame_avail = 0;
+ break;
+
+ case STATE_PICTURE_START:
+ /* frame params of the frame being decoded in coding order */
+ set_frame_params (parser->GetNextFrameParams(), decoder);
+ decoder->frame_avail = 0;
+ break;
+
+ case STATE_PICTURE_AVAIL:
+ decoder->frame_avail = 1;
+ /* frame params of the frame available for display */
+ set_frame_params (parser->GetNextFrame().GetFparams(), decoder);
+ set_frame_data (parser, decoder);
+ break;
+
+ case STATE_INVALID:
+ break;
+
+ default:
+ break;
+ }
+ return decoder->state;
+}
+
+extern DllExport void dirac_skip (dirac_decoder_t *decoder, int skip)
+{
+ TEST (decoder != NULL);
+ TEST (decoder->parser != NULL);
+ DiracParser *parser = static_cast<DiracParser *>(decoder->parser);
+
+ parser->SetSkip(skip > 0 ? true : false);
+}
+
+
+extern DllExport void dirac_set_buf (dirac_decoder_t *decoder, unsigned char *buf[3], void *id)
+{
+ TEST (decoder != NULL);
+ TEST (decoder->fbuf != NULL);
+
+ decoder->fbuf->buf[0] = buf[0];
+ decoder->fbuf->buf[1] = buf[1];
+ decoder->fbuf->buf[2] = buf[2];
+ decoder->fbuf->id = id;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_parser.h b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_parser.h
new file mode 100644
index 000000000..8b5d981c9
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/dirac_parser.h
@@ -0,0 +1,194 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: dirac_parser.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef DIRAC_PARSER_H
+#define DIRAC_PARSER_H
+
+#include <libdirac_common/dirac_types.h>
+#include <libdirac_decoder/decoder_types.h>
+
+/*! \file
+\brief C interface to Dirac decoder.
+
+ A set of 'C' functions that define the public interface to the Dirac decoder.
+ Refer to the the reference decoder source code, decoder/decmain.cpp for
+ an example of how to use the "C" interface. The pseudocode below gives
+ a brief description of the "C" interface usage.
+
+\verbatim
+ #include <libdirac_decoder/dirac_parser.h>\n
+ Initialise the decodern
+
+ decoder_handle = dirac_decoder_init();
+ do
+ {
+ dirac_decoder_state_t state = dirac_parse (decoder);
+ switch (state)
+ {
+ case STATE_BUFFER:
+ read more data.
+ Pass data to the decoder.
+ dirac_buffer (decoder_handle, data_start, data_end)
+ break;
+
+ case STATE_SEQUENCE:
+ handle start of sequence.
+ The decoder returns the sequence parameters in the
+ seq_params member of the decoder handle.
+ Allocate space for the frame data buffers and pass
+ this to the decoder.
+ dirac_set_buf (decoder_handle, buf, NULL);
+ break;
+
+ case STATE_SEQUENCE_END:
+ Deallocate frame data buffers
+ break;
+
+ case STATE_PICTURE_START:
+ handle start of picture data
+ The decoder sets the frame_params member in the
+ decoder handle to the details of the next frame
+ to be processed.
+ break;
+
+ case STATE_PICTURE_AVAIL:
+ Handle picture data.
+ The decoder sets the fbuf member in the decoder
+ handle to the frame decoded.
+ break;
+
+ case STATE_INVALID:
+ Unrecoverable error. Stop all processing
+ break;
+ }
+ } while (data available && decoder state != STATE_INVALID
+
+ Free the decoder resources
+ dirac_decoder_close(decoder_handle)
+ \endverbatim
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef DecoderState dirac_decoder_state_t;
+
+/*! Structure that holds the information returned by the parser */
+typedef struct
+{
+ /*! parser state */
+ dirac_decoder_state_t state;
+ /*! sequence parameters */
+ dirac_seqparams_t seq_params;
+ /*! frame parameters */
+ dirac_frameparams_t frame_params;
+ /*! void pointer to internal parser */
+ void *parser;
+ /*! frame buffer to hold luma and chroma data */
+ dirac_framebuf_t *fbuf;
+ /*! boolean flag that indicates if a decoded frame is available */
+ int frame_avail;
+ /*! verbose output */
+ int verbose;
+
+} dirac_decoder_t;
+
+/*!
+ Decoder Init
+ Initialise the decoder.
+ \param verbose boolean flag to set verbose output
+ \return decoder handle
+*/
+extern DllExport dirac_decoder_t *dirac_decoder_init(int verbose);
+
+/*!
+ Release the decoder resources
+ \param decoder Decoder object
+*/
+extern DllExport void dirac_decoder_close(dirac_decoder_t *decoder);
+
+/*!
+ Parses the data in the input buffer. This function returns the
+ following values.
+ \n STATE_BUFFER: Not enough data in internal buffer to process
+ \n STATE_SEQUENCE: Start of sequence detected. The seq_params member
+ in the decoder object is set to the details of the
+ next sequence to be processed.
+ \n STATE_PICTURE_START: Start of picture detected. The frame_params member
+ of the decoder object is set to the details of the
+ next frame to be processed.
+ \n STATE_PICTURE_AVAIL: Decoded picture available. The frame_aprams member
+ of the decoder object is set the the details of
+ the decoded frame available. The fbuf member of
+ the decoder object has the luma and chroma data of
+ the decompressed frame.
+ \n STATE_SEQUENCE_END: End of sequence detected.
+ \n STATE_INVALID: Invalid stream. Stop further processing.
+
+ \param decoder Decoder object
+ \return Decoder state
+
+*/
+extern DllExport dirac_decoder_state_t dirac_parse (dirac_decoder_t *decoder);
+
+/*!
+ Copy data into internal buffer
+ \param decoder Decoder object
+ \param start Start of data
+ \param end End of data
+*/
+extern DllExport void dirac_buffer (dirac_decoder_t *decoder, unsigned char *start, unsigned char *end);
+
+/*!
+ Set the output buffer into which the decoder copies the decoded data
+ \param decoder Decoder object
+ \param buf Array of char buffers to hold luma and chroma data
+ \param id User data
+*/
+extern DllExport void dirac_set_buf (dirac_decoder_t *decoder, unsigned char *buf[3], void *id);
+
+/*!
+ Skip the next frame to be decoded
+ \param decoder Decoder object
+ \param skip Value 0 - decode next frame; 1 - skip next frame
+*/
+extern DllExport void dirac_skip(dirac_decoder_t *decoder, int skip);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/frame_decompress.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/frame_decompress.cpp
new file mode 100644
index 000000000..65ec5ac32
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/frame_decompress.cpp
@@ -0,0 +1,223 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: frame_decompress.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+//Decompression of frames
+/////////////////////////
+
+#include <libdirac_common/dirac_assertions.h>
+#include <libdirac_common/bit_manager.h>
+#include <libdirac_decoder/frame_decompress.h>
+#include <libdirac_decoder/comp_decompress.h>
+#include <libdirac_common/mot_comp.h>
+#include <libdirac_common/mv_codec.h>
+#include <libdirac_common/golomb.h>
+using namespace dirac;
+
+#include <iostream>
+
+using std::vector;
+
+FrameDecompressor::FrameDecompressor(DecoderParams& decp, ChromaFormat cf)
+:
+m_decparams(decp),
+m_cformat(cf)
+{}
+
+FrameDecompressor::~FrameDecompressor()
+{
+}
+
+bool FrameDecompressor::ReadFrameHeader(const FrameBuffer& my_buffer)
+{
+ FrameParams my_fparams (m_cformat , my_buffer.GetFParams().Xl(), my_buffer.GetFParams().Yl());
+ //Get the frame header (which includes the frame number)
+ m_fparams = my_fparams;
+ m_read_header = ReadFrameHeader(m_fparams);
+ return m_read_header;
+}
+
+bool FrameDecompressor::Decompress(FrameBuffer& my_buffer)
+{
+
+
+ if ( !(m_decparams.BitsIn().End())&& m_read_header )
+ {//if we've not finished the data, can proceed
+ TEST (my_buffer.GetFParams().Xl() == m_fparams.Xl());
+ TEST (my_buffer.GetFParams().Yl() == m_fparams.Yl());
+
+ if ( !m_skipped )
+ {//if we're not m_skipped then we can decode the rest of the frame
+
+ if ( m_decparams.Verbose() )
+ std::cerr<<std::endl<<"Decoding frame "<<m_fparams.FrameNum()<<" in display order";
+
+ //Add a frame into the buffer ready to receive the data
+ my_buffer.PushFrame(m_fparams);
+ Frame& my_frame = my_buffer.GetFrame(m_fparams.FrameNum());//Reference to the frame being decoded
+ FrameSort fsort = m_fparams.FSort();
+ MvData* mv_data;
+ unsigned int num_mv_bits;
+
+ if ( fsort != I_frame )
+ {//do all the MV stuff
+ mv_data = new MvData( m_decparams.XNumMB() , m_decparams.YNumMB() );
+
+ //decode mv data
+ if (m_decparams.Verbose())
+ std::cerr<<std::endl<<"Decoding motion data ...";
+ MvDataCodec my_mv_decoder( &m_decparams.BitsIn(), 50 , m_cformat );
+ my_mv_decoder.InitContexts();//may not be necessary
+ num_mv_bits = UnsignedGolombDecode( m_decparams.BitsIn() );
+
+ //Flush to the end of the header for the MV bits
+ m_decparams.BitsIn().FlushInput();
+
+ //Decompress the MV bits
+ my_mv_decoder.Decompress( *mv_data , num_mv_bits );
+ }
+
+ //decode components
+ CompDecompress( my_buffer,m_fparams.FrameNum() , Y_COMP );
+ if ( m_fparams.CFormat() != Yonly )
+ {
+ CompDecompress( my_buffer , m_fparams.FrameNum() , U_COMP );
+ CompDecompress( my_buffer , m_fparams.FrameNum() , V_COMP );
+ }
+
+ if ( fsort != I_frame )
+ {//motion compensate to add the data back in if we don't have an I frame
+ MotionCompensator mycomp(m_decparams , ADD );
+ mycomp.CompensateFrame(my_buffer , m_fparams.FrameNum() , *mv_data);
+ delete mv_data;
+ }
+ my_frame.Clip();
+
+ if (m_decparams.Verbose())
+ std::cerr<<std::endl;
+
+ }//?m_skipped,!End()
+ else if (m_skipped){
+ //TBD: decide what to return if we're m_skipped. Nearest frame in temporal order??
+
+ }
+
+ m_read_header = false;
+ //exit success
+ return true;
+ }
+ //exit failure
+ return false;
+}
+
+void FrameDecompressor::CompDecompress(FrameBuffer& my_buffer, int fnum,CompSort cs)
+{
+ if ( m_decparams.Verbose() )
+ std::cerr<<std::endl<<"Decoding component data ...";
+ CompDecompressor my_compdecoder( m_decparams , my_buffer.GetFrame(fnum).GetFparams() );
+ PicArray& comp_data=my_buffer.GetComponent( fnum , cs );
+ my_compdecoder.Decompress( comp_data );
+}
+
+bool FrameDecompressor::ReadFrameHeader( FrameParams& fparams )
+{
+
+ if ( !m_decparams.BitsIn().End() )
+ {
+ char frame_start[5];
+ for (int i=0;i<5;++i)
+ {
+ frame_start[i]=m_decparams.BitsIn().InputByte();
+ }
+ //read the frame number
+ int temp_int;
+
+ temp_int = (int)UnsignedGolombDecode( m_decparams.BitsIn() );
+ fparams.SetFrameNum(temp_int);
+
+ //read whether the frame is m_skipped or not
+ m_skipped=m_decparams.BitsIn().InputBit();
+
+ if (!m_skipped)
+ {
+
+ //read the expiry time relative to the frame number
+ fparams.SetExpiryTime( int( UnsignedGolombDecode( m_decparams.BitsIn() ) ) );
+
+ //read the frame sort
+ fparams.SetFSort( FrameSort( UnsignedGolombDecode( m_decparams.BitsIn() ) ) );
+
+ if ( fparams.FSort() != I_frame ){
+
+ //if not an I-frame, read how many references there are
+ fparams.Refs().clear();
+ fparams.Refs().resize( UnsignedGolombDecode( m_decparams.BitsIn() ) );
+
+ //for each reference, read the reference numbers
+ for ( size_t I = 0 ; I < fparams.Refs().size() ; ++I )
+ {
+ fparams.Refs()[I] = fparams.FrameNum() + GolombDecode( m_decparams.BitsIn() );
+ }//I
+
+ //determine whether or not there is global motion vector data
+ m_use_global= m_decparams.BitsIn().InputBit();
+
+ //determine whether or not there is block motion vector data
+ m_use_block_mv= m_decparams.BitsIn().InputBit();
+
+ //if there is global but no block motion vector data, determine the prediction mode to use
+ //for the whole frame
+ if ( m_use_global && !m_use_block_mv )
+ m_global_pred_mode= PredMode(UnsignedGolombDecode( m_decparams.BitsIn() ));
+
+ }//?is not an I frame
+ }//?m_skipped
+
+ //flush the header
+ m_decparams.BitsIn().FlushInput();
+
+ //exit success
+ return true;
+ }//?m_decparams.BitsIn().End()
+ else
+ {
+ //exit failure
+ return false;
+ }
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/frame_decompress.h b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/frame_decompress.h
new file mode 100644
index 000000000..fb22fca34
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/frame_decompress.h
@@ -0,0 +1,146 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: frame_decompress.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd,
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+
+#ifndef _FRAME_DECOMPRESS_H_
+#define _FRAME_DECOMPRESS_H_
+
+#include "libdirac_common/frame_buffer.h"
+#include "libdirac_common/common.h"
+
+namespace dirac
+{
+ //! Compress a single image frame
+ /*!
+ This class decompresses a single frame at a time, using parameters
+ supplied at its construction. FrameDecompressor is used by
+ SequenceDecompressor.
+ */
+ class FrameDecompressor{
+ public:
+ //! Constructor
+ /*!
+ Creates a FrameDecompressor with specific set of parameters the
+ control the decompression process. It decodes motion data before
+ decoding each component of the frame.
+
+ \param decp decoder parameters
+ \param cf the chroma format of the frame being decompressed
+ */
+ FrameDecompressor(DecoderParams& decp, ChromaFormat cf);
+
+ //! Destructor
+ /*!
+ Releases resources.
+ */
+ ~FrameDecompressor();
+
+ //! Decompress the next frame into the buffer
+ /*!
+ Decompresses the next frame from the stream and place at the end
+ of a frame buffer.
+ Returns true if able to decode successfully, false otherwise
+
+ \param my_buffer picture buffer into which the frame is placed
+ */
+ bool Decompress(FrameBuffer& my_buffer);
+
+ //! Reads the header data
+ /*!
+ Reads the header data associated with decompressing the frame
+ \param my_buffer picture buffer from which frame dimensions are obtained
+ */
+ bool ReadFrameHeader(const FrameBuffer& my_buffer);
+
+ //! Returns the frame parameters of the current frame being decoded
+ const FrameParams& GetFrameParams() const{ return m_fparams; }
+
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not be copied.
+
+ */
+ FrameDecompressor(const FrameDecompressor& cpy);
+
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned.
+ */
+ FrameDecompressor& operator=(const FrameDecompressor& rhs);
+
+ //! Decodes component data
+ void CompDecompress(FrameBuffer& my_buffer,int fnum, CompSort cs);
+
+ //! Reads the header data associated with decompressing the frame
+ bool ReadFrameHeader(FrameParams& fparams);
+
+ //Member variables
+
+ //! Parameters for the decompression, as provided in constructor
+ DecoderParams& m_decparams;
+
+ //! Chroma format of the frame being decompressed
+ ChromaFormat m_cformat;
+
+ //! An indicator which is true if the frame has been skipped, false otherwise
+ bool m_skipped;
+
+ //! An indicator that is true if we use global motion vectors, false otherwise
+ bool m_use_global;
+
+ //! An indicator that is true if we use block motion vectors, false otherwise
+ bool m_use_block_mv;
+
+ //! Prediction mode to use if we only have global motion vectors
+ PredMode m_global_pred_mode;
+
+ //! Current Frame Parameters
+ FrameParams m_fparams;
+
+ //! Read header successfully
+ bool m_read_header;
+
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/seq_decompress.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/seq_decompress.cpp
new file mode 100644
index 000000000..317f5fa5b
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/seq_decompress.cpp
@@ -0,0 +1,258 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: seq_decompress.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+///////////////////////////////////////////
+//---------------------------------------//
+//Class to manage decompressing sequences//
+//---------------------------------------//
+///////////////////////////////////////////
+
+#include <libdirac_common/dirac_assertions.h>
+#include <libdirac_decoder/seq_decompress.h>
+#include <libdirac_common/common.h>
+#include <libdirac_common/golomb.h>
+#include <libdirac_common/frame_buffer.h>
+#include <libdirac_decoder/frame_decompress.h>
+using namespace dirac;
+
+SequenceDecompressor::SequenceDecompressor(std::istream* ip,bool verbosity)
+:
+m_all_done(false),
+m_infile(ip),
+m_current_code_fnum(0),
+m_delay(1),
+m_last_frame_read(-1),
+m_show_fnum(-1)
+{
+ m_decparams.SetBitsIn( new BitInputManager(m_infile) );
+ m_decparams.SetVerbose( verbosity );
+ ReadStreamHeader();
+
+ //Amount of horizontal padding for Y,U and V components
+ int xpad_luma,xpad_chroma;
+
+ //Amount of vertical padding for Y,U and V components
+ int ypad_luma,ypad_chroma;
+
+ //scaling factors for chroma based on chroma format
+ int x_chroma_fac,y_chroma_fac;
+
+ //First, we need to have sufficient padding to take account of the blocksizes.
+ //It's sufficient to check for chroma
+
+ if ( m_sparams.CFormat() == format411 )
+ {
+ x_chroma_fac = 4;
+ y_chroma_fac = 1;
+ }
+ else if ( m_sparams.CFormat() == format420 )
+ {
+ x_chroma_fac = 2;
+ y_chroma_fac = 2;
+ }
+ else if ( m_sparams.CFormat() == format422 )
+ {
+ x_chroma_fac = 2;
+ y_chroma_fac = 1;
+ }
+ else
+ {
+ x_chroma_fac = 1;
+ y_chroma_fac = 1;
+ }
+
+ int xl_chroma=m_sparams.Xl() / x_chroma_fac;
+ int yl_chroma=m_sparams.Yl() / y_chroma_fac;
+
+ //make sure we have enough macroblocks to cover the pictures
+ m_decparams.SetXNumMB( m_sparams.Xl() / m_decparams.LumaBParams(0).Xbsep() );
+ m_decparams.SetYNumMB( m_sparams.Yl() / m_decparams.LumaBParams(0).Ybsep() );
+ if ( m_decparams.XNumMB() * m_decparams.ChromaBParams(0).Xbsep() < xl_chroma )
+ {
+ m_decparams.SetXNumMB( m_decparams.XNumMB() + 1 );
+ xpad_chroma = m_decparams.XNumMB() * m_decparams.ChromaBParams(0).Xbsep() - xl_chroma;
+ }
+ else
+ xpad_chroma=0;
+
+ if (m_decparams.YNumMB()*m_decparams.ChromaBParams(0).Ybsep()<yl_chroma)
+ {
+ m_decparams.SetYNumMB( m_decparams.YNumMB() + 1 );
+ ypad_chroma=m_decparams.YNumMB()*m_decparams.ChromaBParams(0).Ybsep()-yl_chroma;
+ }
+ else
+ ypad_chroma=0;
+
+ //Now we have an integral number of macroblocks in a picture and we set the number of blocks
+ m_decparams.SetXNumBlocks( 4*m_decparams.XNumMB() );
+ m_decparams.SetYNumBlocks( 4*m_decparams.YNumMB() );
+
+ //Next we work out the additional padding due to the wavelet transform
+ //For the moment, we'll fix the transform depth to be 4, so we need divisibility by 16.
+ //In the future we'll want arbitrary transform depths. It's sufficient to check for
+ //chroma only
+
+ int xpad_len = xl_chroma+xpad_chroma;
+ int ypad_len = yl_chroma+ypad_chroma;
+
+ if ( xpad_len%16 != 0 )
+ xpad_chroma=( ( xpad_len/16 ) + 1 )*16 - xl_chroma;
+ if ( ypad_len%16 != 0)
+ ypad_chroma = ( ( ypad_len/16 ) + 1 )*16 - yl_chroma;
+
+ xpad_luma = xpad_chroma*x_chroma_fac;
+ ypad_luma = ypad_chroma*y_chroma_fac;
+
+ //set up padded picture sizes, based on original picture sizes, the block parameters and the wavelet transform depth
+ m_fbuffer= new FrameBuffer( m_sparams.CFormat() , m_sparams.Xl() + xpad_luma , m_sparams.Yl() + ypad_luma );
+
+ m_fdecoder = new FrameDecompressor (m_decparams , m_sparams.CFormat() );
+}
+
+SequenceDecompressor::~SequenceDecompressor()
+{
+ delete m_fbuffer;
+ delete m_fdecoder;
+ delete &m_decparams.BitsIn();
+}
+
+bool SequenceDecompressor::ReadNextFrameHeader()
+{
+ return m_fdecoder->ReadFrameHeader(*m_fbuffer);
+}
+
+const FrameParams& SequenceDecompressor::GetNextFrameParams() const
+{
+ return m_fdecoder->GetFrameParams();
+}
+
+Frame& SequenceDecompressor::DecompressNextFrame(bool skip /* = false */)
+{
+ //this function decodes the next frame in coding order and returns the next frame in display order
+ //In general these will differ, and because of re-ordering there is a m_delay which needs to be imposed.
+ //This creates problems at the start and at the end of the sequence which must be dealt with.
+ //At the start we just keep outputting frame 0. At the end you will need to loop for longer to get all
+ //the frames out. It's up to the calling function to do something with the decoded frames as they
+ //come out - write them to screen or to file, as required.
+
+ TEST (m_fdecoder != NULL);
+
+ if (m_current_code_fnum!=0){
+ //if we're not at the beginning, clean the buffer of frames that can be discarded
+ m_fbuffer->Clean(m_show_fnum);
+ }
+
+ bool new_frame_to_display=false;
+
+ if (!skip)
+ new_frame_to_display = m_fdecoder->Decompress(*m_fbuffer);
+
+ //if we've exited with success, there's a new frame to display, so increment
+ //the counters. Otherwise, freeze on the last frame shown
+ m_show_fnum=std::max(m_current_code_fnum-m_delay,0);
+ if (new_frame_to_display || skip)
+ {
+ m_current_code_fnum++;
+ }
+
+ return m_fbuffer->GetFrame(m_show_fnum);
+}
+
+Frame& SequenceDecompressor::GetNextFrame()
+{
+ return m_fbuffer->GetFrame(m_show_fnum);
+}
+
+void SequenceDecompressor::ReadStreamHeader()
+{ //called from constructor
+
+ //read the stream header parameters
+ //begin with the identifying string
+ OLBParams bparams;
+ //char kwname[9];
+ //for (int i=0; i<8; ++i)
+ //{
+ // kwname[i]=m_decparams.BitsIn().InputByte();
+ //}
+ //kwname[8]='\0';
+
+ char seq_start[5];
+ for (int i=0;i<5;++i)
+ {
+ seq_start[i]=m_decparams.BitsIn().InputByte();
+ }
+ //TBC: test that kwname="KW-DIRAC"
+
+ //bit stream version
+ m_sparams.SetBitstreamVersion( m_decparams.BitsIn().InputByte() );
+
+ // TODO: test if this bit stream version is supported. Report an error
+ // otherwise
+ TESTM (m_sparams.BitstreamVersion() == BITSTREAM_VERSION, "Bitstream version match");
+
+ //picture dimensions
+ m_sparams.SetXl( int(UnsignedGolombDecode( m_decparams.BitsIn() )) );
+ m_sparams.SetYl( int(UnsignedGolombDecode( m_decparams.BitsIn() )) );
+
+ //picture rate
+ m_sparams.SetFrameRate( int(UnsignedGolombDecode( m_decparams.BitsIn() )) );
+
+ //block parameters
+ bparams.SetXblen( int(UnsignedGolombDecode( m_decparams.BitsIn() )) );
+ bparams.SetYblen( int(UnsignedGolombDecode( m_decparams.BitsIn() )) );
+ bparams.SetXbsep( int(UnsignedGolombDecode( m_decparams.BitsIn() )) );
+ bparams.SetYbsep( int(UnsignedGolombDecode( m_decparams.BitsIn() )) );
+
+ //dimensions of block arrays (remember there may need to be padding for some block and picture sizes)
+ m_decparams.SetXNumBlocks( int(UnsignedGolombDecode( m_decparams.BitsIn())) );
+ m_decparams.SetYNumBlocks( int(UnsignedGolombDecode( m_decparams.BitsIn())) );
+ m_decparams.SetXNumMB( m_decparams.XNumBlocks()/4 );
+ m_decparams.SetYNumMB( m_decparams.YNumBlocks()/4 );
+
+ //chroma format
+ m_sparams.SetCFormat( ChromaFormat(UnsignedGolombDecode( m_decparams.BitsIn())) );
+ m_decparams.SetBlockSizes( bparams , m_sparams.CFormat() );
+
+ //interlace marker
+ m_decparams.SetInterlace( m_decparams.BitsIn().InputBit() );
+ m_sparams.SetInterlace( m_decparams.Interlace() );
+
+ //Flush the input to the end of the header
+ m_decparams.BitsIn().FlushInput();
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/seq_decompress.h b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/seq_decompress.h
new file mode 100644
index 000000000..d6d57080d
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_decoder/seq_decompress.h
@@ -0,0 +1,174 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: seq_decompress.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd,
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#ifndef _SEQ_DECOMPRESS_H_
+#define _SEQ_DECOMPRESS_H_
+
+///////////////////////////////////////////
+//---------------------------------------//
+//Class to manage decompressing sequences//
+//---------------------------------------//
+///////////////////////////////////////////
+
+#include "libdirac_common/common.h"
+#include <iostream>
+
+namespace dirac
+{
+ class FrameBuffer;
+ class Frame;
+ class FrameDecompressor;
+
+ //! Decompresses a sequence of frames from a stream.
+ /*!
+ This class decompresses a sequence of frames, frame by frame.
+ */
+ class SequenceDecompressor{
+ public:
+
+ //! Constructor
+ /*!
+ Initializes the decompressor with an input stream and level of
+ output detail.
+ \param ip input data stream containing a sequence of compressed images
+ \param verbosity when true, increases the amount of information displayed during decompression
+ */
+ SequenceDecompressor(std::istream * ip, bool verbosity);
+
+ //! Destructor
+ /*!
+ Closes files and releases resources.
+ */
+ ~SequenceDecompressor();
+
+ //! Decompress the next frame in sequence
+ /*!
+ This function decodes the next frame in coding order and returns
+ the next frame in display order. In general these will differ, and
+ because of re-ordering there is a delay which needs to be imposed.
+ This creates problems at the start and at the end of the sequence
+ which must be dealt with. At the start we just keep outputting
+ frame 0. At the end you will need to loop for longer to get all
+ the frames out. It's up to the calling function to do something
+ with the decoded frames as they come out -- write them to screen
+ or to file, as required.
+
+ \param skip skip decoding next frame
+ \return reference to the next locally decoded frame available for display
+ */
+ Frame& DecompressNextFrame(bool skip = false);
+
+ //! Reads the header data associated with decompressing the frame
+ bool ReadNextFrameHeader();
+
+ //! Get the next frame available for display
+ Frame& GetNextFrame();
+
+ //! Get the next frame parameters
+ const FrameParams& GetNextFrameParams() const;
+ //! Determine if decompression is complete.
+ /*!
+ Indicates whether or not the last frame in the sequence has been
+ decompressed.
+ \return true if last frame has been compressed; false if not
+ */
+ bool Finished() { return m_all_done; }
+
+ //! Interrogates for decompression parameters.
+ /*!
+ Returns the parameters used for this decompression run.
+
+ \return decompression parameters originally provide din the constructor.
+ */
+ SeqParams & GetSeqParams() { return m_sparams; }
+
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not
+ be copied.
+
+ */
+ SequenceDecompressor(const SequenceDecompressor& cpy);
+
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned.
+
+ */
+ SequenceDecompressor& operator=(const SequenceDecompressor& rhs);
+
+ //! Read a sequence header from bitstream
+ /*!
+ Reads the sequence data from the bitstream. This contains all the
+ block information. Temporal prediction information is contained in
+ the frame headers so that a simple GOP need not be used, or if so,
+ can be reset on the fly.
+ */
+ void ReadStreamHeader();
+
+ //Member variables
+
+ //! Completion flag, returned via the Finished method
+ bool m_all_done;
+ //! Parameters for the decompression, as provided in constructor
+ DecoderParams m_decparams;
+ //! The sequence parameters obtained from the stream header
+ SeqParams m_sparams;
+ //! A picture buffer used for local storage of frames whilst pending re-ordering or being used for reference.
+ FrameBuffer* m_fbuffer;
+ //! Input file pointer, pointing at the bitstream
+ std::istream* m_infile;
+ //! Number of the frame in coded order which is to be decoded
+ int m_current_code_fnum;
+ //! A delay so that we don't display what we haven't decoded
+ int m_delay;
+ //! Index, in display order, of the last frame read
+ int m_last_frame_read;
+ //! Index, in display order of the frame to be displayed next - computed from delay and current_code_fnum
+ int m_show_fnum;
+ //! Frame decompressor object
+ FrameDecompressor *m_fdecoder;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/Makefile.am b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/Makefile.am
new file mode 100644
index 000000000..c0be01183
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/Makefile.am
@@ -0,0 +1,69 @@
+# $Id: Makefile.am 280 2005-01-30 05:11:46Z gabest $
+#
+
+INCLUDES = -I$(top_srcdir) -I$(srcdir)
+
+h_sources = comp_compress.h frame_compress.h quality_monitor.h \
+ seq_compress.h dirac_encoder.h
+
+cpp_sources = comp_compress.cpp frame_compress.cpp quality_monitor.cpp \
+ seq_compress.cpp dirac_encoder.cpp
+
+
+if USE_MSVC
+lib_LIBRARIES = libdirac_encoder.a
+libdirac_encoder_a_AR = link -lib -out:libdirac_encoder.a $(libdirac_encoder_a_OBJECTS); link $(LIBFLAGS) -out:libdirac_encoder$(LIBEXT) $(LDFLAGS) $(libdirac_encoder_a_OBJECTS) $(libdirac_encoder_a_DEPENDENCIES); echo
+else
+libdirac_encoder_a_AR = ar crv
+lib_LTLIBRARIES = libdirac_encoder.la
+endif
+
+libdirac_encoder_a_SOURCES = $(h_sources) $(cpp_sources)
+
+libdirac_encoder_a_LIBADD = \
+ $(top_builddir)/libdirac_motionest/libdirac_motionest.a \
+ $(top_builddir)/libdirac_common/libdirac_common.a
+
+libdirac_encoder_la_SOURCES = $(h_sources) $(cpp_sources)
+libdirac_encoder_la_CXXFLAGS = $(AM_CXXFLAGS)
+libdirac_encoder_la_LIBADD = \
+ $(top_builddir)/libdirac_motionest/libdirac_motionest.la \
+ $(top_builddir)/libdirac_common/libdirac_common.la
+
+libdirac_encoder_la_LDFLAGS= -no-undefined -version-info $(GENERIC_LIBRARY_VERSION)
+
+library_includedir=$(includedir)/$(GENERIC_LIBRARY_NAME)/libdirac_encoder
+library_include_HEADERS = dirac_encoder.h
+
+#Custom install rule for MSCV
+if USE_MSVC
+install-exec-local: libdirac_encoder.lib
+ $(mkinstalldirs) "$(DESTDIR)$(libdir)"; \
+ echo " $(INSTALL_PROGRAM) libdirac_encoder.lib $(DESTDIR)$(libdir)/libdirac_encoder.lib"; \
+ $(INSTALL_PROGRAM) libdirac_encoder.lib $(DESTDIR)$(libdir)/libdirac_encoder.lib || exit 1; \
+ for ext in lib dll pdb; do \
+ file="libdirac_encoder.$$ext"; \
+ if test -f "$$file"; then \
+ $(mkinstalldirs) "$(DESTDIR)$(bindir)"; \
+ echo " $(INSTALL_PROGRAM) $$file $(DESTDIR)$(bindir)/$$file"; \
+ $(INSTALL_PROGRAM) "$$file" "$(DESTDIR)$(bindir)/$$file" || exit 1; \
+ fi \
+ done
+
+uninstall-local:
+ for file in \
+ "$(DESTDIR)$(bindir)/libdirac_encoder.dll" \
+ "$(DESTDIR)$(bindir)/libdirac_encoder.pdb" \
+ "$(DESTDIR)$(libdir)/libdirac_encoder.lib"; \
+ do \
+ if test -f "$$file"; then \
+ echo " rm -f" "$$file"; \
+ rm -f "$$file"; \
+ fi \
+ done
+endif
+
+if USE_MSVC
+CLEANFILES = *.pdb *.ilk *.dll *.lib *.exp *.a
+endif
+
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/Makefile.in b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/Makefile.in
new file mode 100644
index 000000000..47301d4a5
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/Makefile.in
@@ -0,0 +1,478 @@
+# Makefile.in generated by automake 1.8.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+SOURCES = $(libdirac_encoder_a_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = libdirac_encoder
+DIST_COMMON = $(library_include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(mkdir_p)
+CONFIG_CLEAN_FILES =
+AR = ar
+ARFLAGS = cru
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+libdirac_encoder_a_LIBADD =
+am__objects_1 =
+am__objects_2 = comp_compress.$(OBJEXT) frame_compress.$(OBJEXT) \
+ quality_monitor.$(OBJEXT) seq_compress.$(OBJEXT)
+am_libdirac_encoder_a_OBJECTS = $(am__objects_1) $(am__objects_2)
+libdirac_encoder_a_OBJECTS = $(am_libdirac_encoder_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/comp_compress.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/frame_compress.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/quality_monitor.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/seq_compress.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libdirac_encoder_a_SOURCES)
+DIST_SOURCES = $(libdirac_encoder_a_SOURCES)
+library_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(library_include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GENERIC_LIBRARY_NAME = @GENERIC_LIBRARY_NAME@
+GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@
+GENERIC_RELEASE = @GENERIC_RELEASE@
+GENERIC_VERSION = @GENERIC_VERSION@
+HAVE_ALGO_FALSE = @HAVE_ALGO_FALSE@
+HAVE_ALGO_TRUE = @HAVE_ALGO_TRUE@
+HAVE_CPPUNIT_FALSE = @HAVE_CPPUNIT_FALSE@
+HAVE_CPPUNIT_TRUE = @HAVE_CPPUNIT_TRUE@
+HAVE_DOT = @HAVE_DOT@
+HAVE_DOT_FALSE = @HAVE_DOT_FALSE@
+HAVE_DOT_TRUE = @HAVE_DOT_TRUE@
+HAVE_DOXYGEN = @HAVE_DOXYGEN@
+HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
+HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
+HAVE_DVIPDFM = @HAVE_DVIPDFM@
+HAVE_DVIPDFM_FALSE = @HAVE_DVIPDFM_FALSE@
+HAVE_DVIPDFM_TRUE = @HAVE_DVIPDFM_TRUE@
+HAVE_LATEX = @HAVE_LATEX@
+HAVE_LATEX_FALSE = @HAVE_LATEX_FALSE@
+HAVE_LATEX_TRUE = @HAVE_LATEX_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OVERLAY_FALSE = @OVERLAY_FALSE@
+OVERLAY_TRUE = @OVERLAY_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_MSVC_FALSE = @USE_MSVC_FALSE@
+USE_MSVC_TRUE = @USE_MSVC_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I$(top_srcdir) -I$(srcdir)
+h_sources = comp_compress.h frame_compress.h quality_monitor.h seq_compress.h
+cpp_sources = comp_compress.cpp frame_compress.cpp quality_monitor.cpp seq_compress.cpp
+lib_LIBRARIES = libdirac_encoder.a
+libdirac_encoder_a_SOURCES = $(h_sources) $(cpp_sources)
+library_includedir = $(includedir)/$(GENERIC_LIBRARY_NAME)/libdirac_encoder
+library_include_HEADERS = $(h_sources)
+@USE_MSVC_TRUE@CLEANFILES = *.pdb *.ilk
+@USE_MSVC_FALSE@libdirac_encoder_a_AR = ar crv
+@USE_MSVC_TRUE@libdirac_encoder_a_AR = link.exe -lib /out:libdirac_encoder.a $(libdirac_encoder_a_OBJECTS) ; echo
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libdirac_encoder/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign libdirac_encoder/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libdirac_encoder.a: $(libdirac_encoder_a_OBJECTS) $(libdirac_encoder_a_DEPENDENCIES)
+ -rm -f libdirac_encoder.a
+ $(libdirac_encoder_a_AR) libdirac_encoder.a $(libdirac_encoder_a_OBJECTS) $(libdirac_encoder_a_LIBADD)
+ $(RANLIB) libdirac_encoder.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/comp_compress.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame_compress.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quality_monitor.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seq_compress.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-library_includeHEADERS: $(library_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(library_includedir)" || $(mkdir_p) "$(DESTDIR)$(library_includedir)"
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(library_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(library_includedir)/$$f'"; \
+ $(library_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+uninstall-library_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(library_includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-library_includeHEADERS
+
+install-exec-am: install-libLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLIBRARIES \
+ uninstall-library_includeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLIBRARIES \
+ install-library_includeHEADERS install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am uninstall-libLIBRARIES \
+ uninstall-library_includeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/comp_compress.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/comp_compress.cpp
new file mode 100644
index 000000000..61b73eb89
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/comp_compress.cpp
@@ -0,0 +1,684 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: comp_compress.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd,
+* Anuradha Suraparaju,
+* Peter Meerwald
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+//Compression of an individual component,
+//after motion compensation if appropriate
+//////////////////////////////////////////
+
+#include <libdirac_encoder/comp_compress.h>
+#include <libdirac_common/band_codec.h>
+#include <libdirac_common/golomb.h>
+using namespace dirac;
+
+#include <ctime>
+#include <vector>
+#include <iostream>
+
+using std::log;
+using std::floor;
+
+static inline double pow4 (double x)
+{
+ return x * x * x* x;
+}
+
+CompCompressor::CompCompressor( EncoderParams& encp,const FrameParams& fp)
+: m_encparams(encp),
+ m_fparams(fp),
+ m_fsort( m_fparams.FSort() ),
+ m_cformat( m_fparams.CFormat() ),
+ m_qflist(60),
+ m_qfinvlist(60),
+ m_offset(60)
+{}
+
+void CompCompressor::Compress(PicArray& pic_data)
+{
+
+ //need to transform, select quantisers for each band, and then compress each component in turn
+ m_csort=pic_data.CSort();
+ const int depth=4;
+ unsigned int num_band_bits;
+
+ // A pointer to an object for coding the subband data
+ BandCodec* bcoder;
+
+ // A pointer to an object for outputting the subband data
+ UnitOutputManager* band_op;
+
+ const size_t CONTEXTS_REQUIRED = 24;
+
+ Subband node;
+
+ //set up Lagrangian params
+ if (m_fsort == I_frame)
+ m_lambda= m_encparams.ILambda();
+ else if (m_fsort == L1_frame)
+ m_lambda= m_encparams.L1Lambda();
+ else
+ m_lambda= m_encparams.L2Lambda();
+
+ if (m_csort == U_COMP)
+ m_lambda*= m_encparams.UFactor();
+ if (m_csort == V_COMP)
+ m_lambda*= m_encparams.VFactor();
+
+ WaveletTransform wtransform(depth);
+
+ wtransform.Transform( FORWARD , pic_data );
+ wtransform.SetBandWeights( m_encparams.CPD() , m_fparams.FSort() , m_fparams.CFormat(), m_csort);
+
+ SubbandList& bands=wtransform.BandList();
+
+ // Generate all the quantisation data
+ GenQuantList();
+
+ // Choose all the quantisers
+ OneDArray<unsigned int> estimated_bits( Range( 1 , bands.Length() ) );
+ SelectQuantisers( pic_data , bands , estimated_bits );
+
+ // Loop over all the bands (from DC to HF) quantising and coding them
+ for (int b=bands.Length() ; b>=1 ; --b )
+ {
+ band_op = & m_encparams.BitsOut().FrameOutput().BandOutput( m_csort , b );
+
+ GolombCode( band_op->Header() , bands(b).Qf(0) );
+
+ if (bands(b).Qf(0) != -1)
+ { // If not skipped ...
+
+ bands(b).SetQf( 0 , m_qflist[bands(b).Qf(0)] );
+
+ // Pick the right codec according to the frame type and subband
+ if (b >= bands.Length())
+ {
+ if ( m_fsort == I_frame && b == bands.Length() )
+ bcoder=new IntraDCBandCodec( &( band_op->Data() ) , CONTEXTS_REQUIRED , bands);
+ else
+ bcoder=new LFBandCodec( &( band_op->Data() ) ,CONTEXTS_REQUIRED, bands , b);
+ }
+ else
+ bcoder=new BandCodec( &( band_op->Data() ) , CONTEXTS_REQUIRED , bands , b);
+
+ num_band_bits = bcoder->Compress(pic_data);
+
+ // Update the entropy correction factors
+ m_encparams.EntropyFactors().Update(b , m_fsort , m_csort , estimated_bits[b] , num_band_bits);
+
+ // Write the length of the data chunk into the header, and flush everything out to file
+ UnsignedGolombCode( band_op->Header() , num_band_bits);
+
+ delete bcoder;
+ }
+ else
+ { // ... skipped
+
+ if (b == bands.Length() && m_fsort == I_frame)
+ SetToVal( pic_data , bands(b) , 2692 );
+ else
+ SetToVal( pic_data , bands(b) , 0 );
+ }
+ }//b
+
+ // Transform back into the picture domain
+ wtransform.Transform( BACKWARD , pic_data );
+
+}
+
+void CompCompressor::GenQuantList()
+{ //generates the list of quantisers and inverse quantisers
+ //there is some repetition in this list but at the moment this is easiest from the perspective of SelectQuant
+ //Need to remove this repetition later
+
+ m_qflist[0]=1; m_qfinvlist[0]=131072; m_offset[0]=0;
+ m_qflist[1]=1; m_qfinvlist[1]=131072; m_offset[1]=0;
+ m_qflist[2]=1; m_qfinvlist[2]=131072; m_offset[2]=0;
+ m_qflist[3]=1; m_qfinvlist[3]=131072; m_offset[3]=0;
+ m_qflist[4]=2; m_qfinvlist[4]=65536; m_offset[4]=1;
+ m_qflist[5]=2; m_qfinvlist[5]=65536; m_offset[5]=1;
+ m_qflist[6]=2; m_qfinvlist[6]=65536; m_offset[6]=1;
+ m_qflist[7]=3; m_qfinvlist[7]=43690; m_offset[7]=1;
+ m_qflist[8]=4; m_qfinvlist[8]=32768; m_offset[8]=2;
+ m_qflist[9]=4; m_qfinvlist[9]=32768; m_offset[9]=2;
+ m_qflist[10]=5; m_qfinvlist[10]=26214; m_offset[10]=2;
+ m_qflist[11]=6; m_qfinvlist[11]=21845; m_offset[11]=2;
+ m_qflist[12]=8; m_qfinvlist[12]=16384; m_offset[12]=3;
+ m_qflist[13]=9; m_qfinvlist[13]=14563; m_offset[13]=3;
+ m_qflist[14]=11; m_qfinvlist[14]=11915; m_offset[14]=4;
+ m_qflist[15]=13; m_qfinvlist[15]=10082; m_offset[15]=5;
+ m_qflist[16]=16; m_qfinvlist[16]=8192; m_offset[16]=6;
+ m_qflist[17]=19; m_qfinvlist[17]=6898; m_offset[17]=7;
+ m_qflist[18]=22; m_qfinvlist[18]=5957; m_offset[18]=8;
+ m_qflist[19]=26; m_qfinvlist[19]=5041; m_offset[19]=10;
+ m_qflist[20]=32; m_qfinvlist[20]=4096; m_offset[20]=12;
+ m_qflist[21]=38; m_qfinvlist[21]=3449; m_offset[21]=14;
+ m_qflist[22]=45; m_qfinvlist[22]=2912; m_offset[22]=17;
+ m_qflist[23]=53; m_qfinvlist[23]=2473; m_offset[23]=20;
+ m_qflist[24]=64; m_qfinvlist[24]=2048; m_offset[24]=24;
+ m_qflist[25]=76; m_qfinvlist[25]=1724; m_offset[25]=29;
+ m_qflist[26]=90; m_qfinvlist[26]=1456; m_offset[26]=34;
+ m_qflist[27]=107; m_qfinvlist[27]=1224; m_offset[27]=40;
+ m_qflist[28]=128; m_qfinvlist[28]=1024; m_offset[28]=48;
+ m_qflist[29]=152; m_qfinvlist[29]=862; m_offset[29]=57;
+ m_qflist[30]=181; m_qfinvlist[30]=724; m_offset[30]=68;
+ m_qflist[31]=215; m_qfinvlist[31]=609; m_offset[31]=81;
+ m_qflist[32]=256; m_qfinvlist[32]=512; m_offset[32]=96;
+ m_qflist[33]=304; m_qfinvlist[33]=431; m_offset[33]=114;
+ m_qflist[34]=362; m_qfinvlist[34]=362; m_offset[34]=136;
+ m_qflist[35]=430; m_qfinvlist[35]=304; m_offset[35]=161;
+ m_qflist[36]=512; m_qfinvlist[36]=256; m_offset[36]=192;
+ m_qflist[37]=608; m_qfinvlist[37]=215; m_offset[37]=228;
+ m_qflist[38]=724; m_qfinvlist[38]=181; m_offset[38]=272;
+ m_qflist[39]=861; m_qfinvlist[39]=152; m_offset[39]=323;
+ m_qflist[40]=1024; m_qfinvlist[40]=128; m_offset[40]=384;
+ m_qflist[41]=1217; m_qfinvlist[41]=107; m_offset[41]=456;
+ m_qflist[42]=1448; m_qfinvlist[42]=90; m_offset[42]=543;
+ m_qflist[43]=1722; m_qfinvlist[43]=76; m_offset[43]=646;
+ m_qflist[44]=2048; m_qfinvlist[44]=64; m_offset[44]=768;
+ m_qflist[45]=2435; m_qfinvlist[45]=53; m_offset[45]=913;
+ m_qflist[46]=2896; m_qfinvlist[46]=45; m_offset[46]=1086;
+ m_qflist[47]=3444; m_qfinvlist[47]=38; m_offset[47]=1292;
+ m_qflist[48]=4096; m_qfinvlist[48]=32; m_offset[48]=1536;
+ m_qflist[49]=4870; m_qfinvlist[49]=26; m_offset[49]=1826;
+ m_qflist[50]=5792; m_qfinvlist[50]=22; m_offset[50]=2172;
+ m_qflist[51]=6888; m_qfinvlist[51]=19; m_offset[51]=2583;
+ m_qflist[52]=8192; m_qfinvlist[52]=16; m_offset[52]=3072;
+ m_qflist[53]=9741; m_qfinvlist[53]=13; m_offset[53]=3653;
+ m_qflist[54]=11585; m_qfinvlist[54]=11; m_offset[54]=4344;
+ m_qflist[55]=13777; m_qfinvlist[55]=9; m_offset[55]=5166;
+ m_qflist[56]=16384; m_qfinvlist[56]=8; m_offset[56]=6144;
+ m_qflist[57]=19483; m_qfinvlist[57]=6; m_offset[57]=7306;
+ m_qflist[58]=23170; m_qfinvlist[58]=5; m_offset[58]=8689;
+ m_qflist[59]=27554; m_qfinvlist[59]=4; m_offset[59]=10333;
+}
+
+
+
+void CompCompressor::SelectQuantisers( PicArray& pic_data , SubbandList& bands ,
+ OneDArray<unsigned int>& est_counts )
+{
+ // Select all the quantizers
+ for ( int b=bands.Length() ; b>=1 ; --b )
+ est_counts[b] = SelectQuant( pic_data , bands , b );
+}
+
+int CompCompressor::SelectQuant(PicArray& pic_data,SubbandList& bands,const int band_num)
+{
+
+ Subband& node=bands(band_num);
+
+ const int qf_start_idx = 4;
+
+ if (band_num==bands.Length())
+ AddSubAverage(pic_data,node.Xl(),node.Yl(),SUBTRACT);
+
+ int min_idx;
+ double bandmax=PicAbsMax(pic_data,node.Xp(),node.Yp(),node.Xl(),node.Yl());
+
+ if (bandmax>=1)
+ node.SetMax(int(floor(log(float(bandmax))/log(2.0))));
+ else
+ node.SetMax(0);
+ int length=4*node.Max()+5;//this is the number of quantisers that are possible
+
+ OneDArray<int> count0(length);
+ int count1;
+ OneDArray<int> countPOS(length);
+ OneDArray<int> countNEG(length);
+ OneDArray<double> error_total(length);
+ OneDArray<CostType> costs(length);
+ int quant_val;
+ ValueType val,abs_val;
+ int error;
+ double p0,p1;
+ double sign_entropy;
+
+ int xp=node.Xp();
+ int yp=node.Yp();
+ int xl=node.Xl();
+ int yl=node.Yl();
+ double vol;
+
+ if (bandmax < 1.0 )
+ {
+ //coefficients are zero so the subband can be skipped
+ node.SetQf(0,-1);//indicates that the subband is skipped
+
+ if ( band_num == bands.Length() )
+ AddSubAverage(pic_data,node.Xl(),node.Yl(),ADD);
+
+ return 0;
+ }
+ else
+ {
+ for ( int q=0 ; q<costs.Length() ; q++)
+ {
+ error_total[q] = 0.0;
+ count0[q] = 0;
+ countPOS[q] = 0;
+ countNEG[q] = 0;
+ }
+
+ //first, find to nearest integral number of bits using 1/4 of the data
+ //////////////////////////////////////////////////////////////////////
+ vol=double((yl/2)*(xl/2));//vol is only 1/4 of the coeffs
+ count1=int(vol);
+ for ( int j=yp+1 ; j<yp+yl ; j+=2 )
+ {
+ for ( int i=xp+((j-yp)%4)/2 ; i<xp+xl ; i+=2)
+ {
+
+ val = pic_data[j][i];
+ quant_val = abs(val);
+ abs_val = quant_val;
+
+ for ( int q=qf_start_idx ; q<costs.Length() ; q+=4)
+ {
+ quant_val >>= (q/4);
+
+ if (quant_val)
+ {
+ count0[q]+=quant_val;
+ quant_val <<= (q/4);
+ if (val>0)
+ countPOS[q]++;
+ else
+ countNEG[q]++;
+ }
+
+ error = abs_val-quant_val;
+
+ if ( quant_val != 0)
+ error -= m_offset[q];
+
+ error_total[q] += pow4( static_cast<double>(error) );
+ }// q
+ }// i
+ }// j
+
+ //do entropy calculation etc
+ for ( int q=qf_start_idx ; q<costs.Length() ; q+=4 )
+ {
+ costs[q].MSE = error_total[q]/( vol*node.Wt()*node.Wt() );
+//
+ costs[q].MSE = std::sqrt( costs[q].MSE );
+//
+ //calculate probabilities and entropy
+ p0 = double( count0[q] )/double( count0[q]+count1 );
+ p1 = 1.0-p0;
+
+ if ( p0 != 0.0 && p1 != 0.0)
+ costs[q].ENTROPY =- (p0*log(p0)+p1*log(p1))/log(2.0);
+ else
+ costs[q].ENTROPY = 0.0;
+
+ //we want the entropy *per symbol*, not per bit ...
+ costs[q].ENTROPY *= double(count0[q]+count1);
+ costs[q].ENTROPY /= vol;
+
+ //now add in the sign entropy
+ if ( countPOS[q]+countNEG[q] != 0 )
+ {
+ p0 = float(countNEG[q])/float( countPOS[q]+countNEG[q] );
+ p1 = 1.0-p0;
+ if ( p0 != 0.0 && p1 != 0.0)
+ sign_entropy = -( (p0*log(p0)+p1*log(p1) ) / log(2.0));
+ else
+ sign_entropy = 0.0;
+ }
+ else
+ sign_entropy=0.0;
+
+ //we want the entropy *per symbol*, not per bit ...
+ sign_entropy *= double( countNEG[q]+countPOS[q] );
+ sign_entropy /= vol;
+
+ costs[q].ENTROPY += sign_entropy;
+
+ //sort out correction factors
+ costs[q].ENTROPY *= m_encparams.EntropyFactors().Factor(band_num,m_fsort,m_csort);
+ costs[q].TOTAL = costs[q].MSE+m_lambda*costs[q].ENTROPY;
+
+ }// q
+
+ //find the qf with the lowest cost
+ min_idx=qf_start_idx;
+ for ( int q=qf_start_idx ; q<costs.Length() ; q+=4 )
+ {
+ if ( costs[q].TOTAL < costs[min_idx].TOTAL )
+ min_idx=q;
+ }
+
+ //now repeat to get to 1/2 bit accuracy
+ ///////////////////////////////////////
+ for ( int q=std::max(0,min_idx-2) ; q<=std::min(costs.Last(),min_idx+2) ; q+=2 )
+ {
+ if ( q != min_idx )
+ {
+ error_total[q] = 0.0;
+ count0[q] = 0;
+ countPOS[q] = 0;
+ countNEG[q] = 0;
+ }
+ }
+
+ vol = double( (yl/2) * (xl/2) );
+ count1 = int(vol);
+ int top_idx = std::min(costs.Last(),min_idx+2);
+ int bottom_idx = std::max(0,min_idx-2);
+
+ for (int j=yp+1 ; j<yp+yl ; j+=2 )
+ {
+ for (int i=xp+1 ; i<xp+xl ; i+=2 )
+ {
+ val = pic_data[j][i];
+ abs_val = abs(val);
+
+ for ( int q=bottom_idx ; q<=top_idx ; q+=2 )
+ {
+ if ( q != min_idx )
+ {
+ quant_val = int(abs_val);
+ quant_val *= m_qfinvlist[q];
+ quant_val >>= 17;
+
+ if ( quant_val )
+ {
+ count0[q] += quant_val;
+ quant_val *= m_qflist[q];
+
+ if (val>0.0)
+ countPOS[q]++;
+ else
+ countNEG[q]++;
+ }
+
+ error = abs_val-quant_val;
+
+ if ( quant_val != 0 )
+ error -= m_offset[q];
+
+ error_total[q] += pow4( static_cast<double>(error) );
+ }//end of if
+ }//q
+ }//J
+ }//I
+
+ //do entropy calculation
+ for ( int q=bottom_idx ; q<=top_idx ; q+=2 )
+ {
+ if ( q != min_idx )
+ {
+ costs[q].MSE = error_total[q] / (vol*node.Wt()*node.Wt());
+//
+ costs[q].MSE = std::sqrt( costs[q].MSE );
+//
+
+
+ //calculate probabilities and entropy
+ p0 = double(count0[q]) / double(count0[q]+count1);
+ p1 = 1.0-p0;
+
+ if (p0 != 0.0 && p1 != 0.0)
+ costs[q].ENTROPY =- (p0*log(p0) + p1*log(p1)) / log(2.0);
+ else
+ costs[q].ENTROPY = 0.0;
+ //we want the entropy *per symbol*, not per bit ...
+ costs[q].ENTROPY *= count0[q]+count1;
+ costs[q].ENTROPY /= vol;
+
+ //now add in the sign entropy
+ if (countPOS[q]+countNEG[q] != 0)
+ {
+ p0 = double( countNEG[q] )/double( countPOS[q] + countNEG[q] );
+ p1 = 1.0-p0;
+ if (p0 != 0.0 && p1 != 0.0)
+ sign_entropy =- ( (p0*log(p0)+p1*log(p1)) / log(2.0) );
+ else
+ sign_entropy = 0.0;
+ }
+ else
+ sign_entropy = 0.0;
+
+ //we want the entropy *per symbol*, not per bit ...
+ sign_entropy *= double(countNEG[q]+countPOS[q]);
+ sign_entropy /= vol;
+
+ costs[q].ENTROPY += sign_entropy;
+ //sort out correction factors
+ costs[q].ENTROPY *= m_encparams.EntropyFactors().Factor(band_num,m_fsort,m_csort);
+ costs[q].TOTAL = costs[q].MSE+m_lambda*costs[q].ENTROPY;
+ }
+ }//q
+
+ //find the qf with the lowest cost
+ for ( int q=bottom_idx ; q<=top_idx ; q+=2 )
+ {
+ if ( costs[q].TOTAL < costs[min_idx].TOTAL )
+ min_idx = q;
+ }
+
+ //finally use 1/2 the values to get 1/4 bit accuracy
+ ////////////////////////////////////////////////////
+
+ bottom_idx=std::max(0,min_idx-1);
+ top_idx=std::min(costs.Length()-1,min_idx+1);
+
+ for ( int q=bottom_idx ; q<=top_idx ; q++ )
+ {
+ error_total[q] = 0.0;
+ count0[q] = 0;
+ countPOS[q] = 0;
+ countNEG[q] = 0;
+ }
+
+ vol = double( (yl/2) * xl );
+ count1 = int( vol );
+
+ for (int j=yp ; j<yp+yl ; ++j )
+ {
+ for (int i=xp+1 ; i<xp+xl ; i+=2)
+ {
+ val = pic_data[j][i];
+ abs_val = abs(val);
+
+ for (int q=bottom_idx;q<=top_idx;q++)
+ {
+ quant_val = int(abs_val);
+ quant_val *= m_qfinvlist[q];
+ quant_val >>= 17;
+
+ if (quant_val)
+ {
+ count0[q] += quant_val;
+ quant_val *= m_qflist[q];
+
+ if ( val > 0 )
+ countPOS[q]++;
+ else
+ countNEG[q]++;
+ }
+
+ error = abs_val - quant_val;
+
+ if ( quant_val != 0 )
+ error -= m_offset[q];
+
+ error_total[q] += pow4( static_cast<double>(error) );
+ }//q
+ }//i
+ }//j
+
+ //do entropy calculation
+ for ( int q=bottom_idx ; q<=top_idx ; q++ )
+ {
+ costs[q].MSE = error_total[q]/(vol*node.Wt()*node.Wt());
+//
+ costs[q].MSE = std::sqrt( costs[q].MSE );
+//
+ //calculate probabilities and entropy
+ p0 = double( count0[q] )/ double( count0[q]+count1 );
+ p1 = 1.0 - p0;
+
+ if ( p0 != 0.0 && p1 != 0.0)
+ costs[q].ENTROPY = -( p0*log(p0)+p1*log(p1) ) / log(2.0);
+ else
+ costs[q].ENTROPY = 0.0;
+
+ //we want the entropy *per symbol*, not per bit ...
+ costs[q].ENTROPY *= double(count0[q]+count1);
+ costs[q].ENTROPY /= vol;
+
+ //now add in the sign entropy
+ if ( countPOS[q] + countNEG[q] != 0 )
+ {
+ p0 = double( countNEG[q] )/double( countPOS[q]+countNEG[q] );
+ p1 = 1.0-p0;
+ if ( p0 != 0.0 && p1 != 0.0)
+ sign_entropy = -( (p0*log(p0)+p1*log(p1) ) / log(2.0));
+ else
+ sign_entropy = 0.0;
+ }
+ else
+ sign_entropy = 0.0;
+
+ //we want the entropy *per symbol*, not per bit ...
+ sign_entropy *= double(countNEG[q]+countPOS[q]);
+ sign_entropy /= vol;
+
+ costs[q].ENTROPY += sign_entropy;
+
+ //sort out correction factors
+ costs[q].ENTROPY *= m_encparams.EntropyFactors().Factor(band_num,m_fsort,m_csort);
+ costs[q].TOTAL = costs[q].MSE+m_lambda*costs[q].ENTROPY;
+
+ }//q
+
+ //find the qf with the lowest cost
+ for ( int q=bottom_idx ; q<=top_idx ; q++ )
+ {
+ if ( costs[q].TOTAL < costs[min_idx].TOTAL )
+ min_idx=q;
+ }
+
+ if ( costs[min_idx].ENTROPY == 0.0 )//then can skip after all
+ node.SetQf(0,-1);
+ else
+ node.SetQf(0,min_idx);
+
+ if ( band_num == bands.Length())
+ AddSubAverage(pic_data,node.Xl(),node.Yl(),ADD);
+
+ return int(costs[min_idx].ENTROPY*double(xl*yl));
+ }
+
+}
+
+ValueType CompCompressor::PicAbsMax(const PicArray& pic_data) const
+{
+ //finds the maximum absolute value of the picture array
+ return PicAbsMax(pic_data,pic_data.FirstX() , pic_data.FirstY(),
+ pic_data.LengthX(),pic_data.LengthY());
+}
+
+ValueType CompCompressor::PicAbsMax(const PicArray& pic_data,int xp, int yp ,int xl ,int yl) const
+{
+
+ int first_x=std::max(pic_data.FirstX(),xp);
+ int first_y=std::max(pic_data.FirstY(),yp);
+ int last_x=std::min(pic_data.LastX(),xp+xl-1);
+ int last_y=std::min(pic_data.LastY(),yp+yl-1);
+ ValueType val=0;
+
+ for (int j=first_y ; j<=last_y; ++j)
+ {
+ for (int i=first_x ; i<=last_x; ++i)
+ {
+ val = std::max( val , pic_data[j][i] );
+ }// i
+ }// j
+
+ return val;
+}
+
+void CompCompressor::SetToVal(PicArray& pic_data,const Subband& node,ValueType val){
+
+ for (int j=node.Yp() ; j<node.Yp() + node.Yl() ; ++j)
+ {
+ for (int i=node.Xp(); i<node.Xp() + node.Xl() ; ++i)
+ {
+ pic_data[j][i] = val;
+ }// i
+ }// j
+
+}
+
+void CompCompressor::AddSubAverage(PicArray& pic_data,int xl,int yl,AddOrSub dirn){
+
+ ValueType last_val=2692;//corresponds to mid-grey in this DC band with these filters
+ //NB this is hard-wired for a level 4 transform
+ ValueType last_val2;
+
+ if ( dirn == SUBTRACT )
+ {
+ for ( int j=0 ; j<yl ; j++)
+ {
+ for ( int i=0 ; i<xl ; i++)
+ {
+ last_val2 = pic_data[j][i];
+ pic_data[j][i] -= last_val;
+ last_val = last_val2;
+ }// i
+ }// j
+ }
+ else
+ {
+ for ( int j=0 ; j<yl ; j++)
+ {
+ for ( int i=0 ; i<xl; i++ )
+ {
+ pic_data[j][i] += last_val;
+ last_val = pic_data[j][i];
+ }// i
+ }// j
+
+ }
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/comp_compress.h b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/comp_compress.h
new file mode 100644
index 000000000..6eab9d75f
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/comp_compress.h
@@ -0,0 +1,112 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: comp_compress.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Scott R Ladd
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#ifndef _COMP_COMPRESS_H_
+#define _COMP_COMPRESS_H_
+
+#include "libdirac_common/arrays.h"
+#include "libdirac_common/wavelet_utils.h"
+#include "libdirac_common/common.h"
+
+namespace dirac
+{
+ //! Compress a frame component
+ /*!
+ This class compresses one of the three components (Y, U, or V) of a
+ frame according to a given set or parameters. CompCompressor is used
+ by FrameCompressor.
+ */
+ class CompCompressor
+ {
+ public:
+ //! Constructor
+ /*!
+ Create and initialize a component compressor with the given
+ characteristics.
+ \param encp encoding parameters
+ \param fp frame parameters
+ */
+ CompCompressor( EncoderParams & encp, const FrameParams& fp);
+
+ //! Compress a frame component
+ /*!
+ Compress a PicArray containing a frame component (Y, U, or V).
+ \param pic_data the component data to be compressed
+ */
+ void Compress(PicArray & pic_data);
+
+ private:
+ //! Copy constructor is private and body-less. This class should not be copied.
+ CompCompressor(const CompCompressor& cpy);
+
+ //! Assignment = is private and body-less. This class should not be assigned.
+ CompCompressor& operator=(const CompCompressor& rhs);
+
+ void GenQuantList();
+
+ void SelectQuantisers( PicArray& pic_data , SubbandList& bands ,
+ OneDArray<unsigned int>& est_counts );
+
+ int SelectQuant(PicArray& pic_data,SubbandList& bands,int band_num);
+
+ ValueType PicAbsMax(const PicArray& pic_data,int xp, int yp ,int xl ,int yl) const;
+
+ ValueType PicAbsMax(const PicArray& pic_data) const;
+
+ void SetToVal(PicArray& pic_data,const Subband& node,ValueType val);
+
+ void AddSubAverage(PicArray& pic_data,int xl,int yl,AddOrSub dirn);
+
+ //member variables
+ EncoderParams& m_encparams;
+ const FrameParams& m_fparams;
+ const FrameSort& m_fsort;
+ const ChromaFormat& m_cformat;
+ CompSort m_csort;
+ OneDArray<int> m_qflist;
+ OneDArray<int> m_qfinvlist;
+ OneDArray<int> m_offset;
+ float m_lambda;
+
+ };
+
+} // namespace dirac
+
+
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/dirac_encoder.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/dirac_encoder.cpp
new file mode 100644
index 000000000..4300c9592
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/dirac_encoder.cpp
@@ -0,0 +1,947 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: dirac_encoder.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <cstring>
+#include <sstream>
+#include <fstream>
+#include <queue>
+#include <libdirac_common/dirac_assertions.h>
+#include <libdirac_common/common.h>
+#include <libdirac_common/frame.h>
+#include <libdirac_common/pic_io.h>
+#include <libdirac_encoder/dirac_encoder.h>
+#include <libdirac_encoder/seq_compress.h>
+using namespace dirac;
+
+template <class T >
+void copy_2dArray (const TwoDArray<T> & in, T *out)
+{
+ for (int j=0 ; j<in.LengthY() ; ++j)
+ {
+ for (int i=0 ; i<in.LengthX() ; ++i)
+ {
+ // out[j*in.LengthX() + i] = in[j][i];
+ *out++ = in[j][i];
+ }// i
+ }// j
+}
+
+void copy_2dArray (const TwoDArray<PredMode> & in, int *out)
+{
+ for (int j=0 ; j<in.LengthY() ; ++j)
+ {
+ for (int i=0 ; i<in.LengthX() ; ++i)
+ {
+ // out[j*in.LengthX() + i] = in[j][i];
+ *out++ = in[j][i];
+ }// i
+ }// j
+}
+
+void copy_2dArray (const TwoDArray<bool> & in, int *out)
+{
+ for (int j=0 ; j<in.LengthY() ; ++j)
+ {
+ for (int i=0 ; i<in.LengthX() ; ++i)
+ {
+ // out[j*in.LengthX() + i] = in[j][i];
+ *out++ = in[j][i];
+ }// i
+ }// j
+}
+
+void copy_mv ( const MvArray& mv, dirac_mv_t *dmv)
+{
+ for (int j=0 ; j<mv.LengthY() ; ++j)
+ {
+ for (int i=0 ; i<mv.LengthX() ; ++i)
+ {
+ //dmv[j*mv.LengthX() + i].x = mv[j][i].x;
+ //dmv[j*mv.LengthX() + i].y = mv[j][i].y;
+ (*dmv).x = mv[j][i].x;
+ (*dmv).y = mv[j][i].y;
+ dmv++;
+ }// i
+ }// j
+}
+
+void copy_mv_cost (const TwoDArray<MvCostData> &pc, dirac_mv_cost_t *dpc)
+{
+ for (int j=0 ; j<pc.LengthY() ; ++j)
+ {
+ for (int i=0 ; i<pc.LengthX() ; ++i)
+ {
+ //dpc[j*pc.LengthX() + i].SAD = pc[j][i].SAD;
+ //dpc[j*pc.LengthX() + i].mvcost = pc[j][i].mvcost;
+ (*dpc).SAD = pc[j][i].SAD;
+ (*dpc).mvcost = pc[j][i].mvcost;
+ dpc++;
+ }// i
+ }// j
+}
+
+/*
+ Function that allocates the locally managed instrumentation data
+*/
+void alloc_instr_data(dirac_instr_t *instr)
+{
+ instr->mb_split_mode = new int [instr->mb_ylen*instr->mb_xlen];
+ memset (instr->mb_split_mode, 0, sizeof(int)*instr->mb_ylen*instr->mb_xlen);
+
+ instr->mb_common_mode = new int [instr->mb_ylen*instr->mb_xlen];
+ memset (instr->mb_common_mode, 0,
+ sizeof(int)*instr->mb_ylen*instr->mb_xlen);
+
+ instr->mb_costs = new float [instr->mb_ylen*instr->mb_xlen];
+ memset (instr->mb_costs, 0, sizeof(float)*instr->mb_ylen*instr->mb_xlen);
+
+ instr->pred_mode = new int [instr->mv_ylen * instr->mv_xlen];
+ memset (instr->pred_mode, 0, sizeof(int)*instr->mv_ylen*instr->mv_xlen);
+
+ instr->intra_costs = new float [instr->mv_ylen * instr->mv_xlen];
+ memset (instr->intra_costs, 0, sizeof(float)*instr->mv_ylen*instr->mv_xlen);
+
+ instr->bipred_costs = new dirac_mv_cost_t [instr->mv_ylen * instr->mv_xlen];
+ memset (instr->bipred_costs, 0, sizeof(dirac_mv_cost_t)*instr->mv_ylen*instr->mv_xlen);
+
+ instr->dc_ycomp = new short [instr->mv_ylen * instr->mv_xlen];
+ memset (instr->dc_ycomp, 0, sizeof(short)*instr->mv_ylen*instr->mv_xlen);
+
+ instr->dc_ucomp = new short [instr->mv_ylen * instr->mv_xlen];
+ memset (instr->dc_ucomp, 0, sizeof(short)*instr->mv_ylen*instr->mv_xlen);
+
+ instr->dc_vcomp = new short [instr->mv_ylen * instr->mv_xlen];
+ memset (instr->dc_vcomp, 0, sizeof(short)*instr->mv_ylen*instr->mv_xlen);
+
+ for (int i = 0; i < 2; i++)
+ {
+ instr->mv[i] = new dirac_mv_t[instr->mv_ylen * instr->mv_xlen];
+ memset (instr->mv[i], 0,
+ sizeof(dirac_mv_t)*instr->mv_ylen*instr->mv_xlen);
+ }
+
+ for (int i = 0; i < 2; i++)
+ {
+ instr->pred_costs[i] = new dirac_mv_cost_t[instr->mv_ylen * instr->mv_xlen];
+ memset (instr->pred_costs[i], 0,
+ sizeof(dirac_mv_cost_t)*instr->mv_ylen*instr->mv_xlen);
+ }
+}
+
+/*
+ Function that frees the locally managed instrumentation data
+*/
+void dealloc_instr_data(dirac_instr_t *instr)
+{
+ if (instr->mb_split_mode)
+ delete [] instr->mb_split_mode;
+
+ if (instr->mb_common_mode)
+ delete [] instr->mb_common_mode;
+
+ if (instr->mb_costs)
+ delete [] instr->mb_costs;
+
+ if (instr->pred_mode)
+ delete [] instr->pred_mode;
+
+ if (instr->intra_costs)
+ delete [] instr->intra_costs;
+
+ if (instr->bipred_costs)
+ delete [] instr->bipred_costs;
+
+ if (instr->dc_ycomp)
+ delete [] instr->dc_ycomp;
+
+ if (instr->dc_ucomp)
+ delete [] instr->dc_ucomp;
+
+ if (instr->dc_vcomp)
+ delete [] instr->dc_vcomp;
+
+ for (int i = 0; i < 2; i++)
+ {
+ if (instr->mv[i])
+ delete [] instr->mv[i];
+ }
+ for (int i = 0; i < 2; i++)
+ {
+ if (instr->pred_costs[i])
+ delete [] instr->pred_costs[i];
+ }
+}
+
+/*
+ Wrapper class around the SequenceCompressor Class. This class is used
+ by the "C" encoder interface
+*/
+class DiracEncoder
+{
+public:
+ // constructor
+ DiracEncoder(const dirac_encoder_context_t *enc_ctx, bool verbose);
+ // destructor
+ ~DiracEncoder();
+
+ // Load the next frame of uncompressed data into the SequenceCompressor
+ bool LoadNextFrame(unsigned char *data, int size);
+ // Compress the next frame of data
+ int CompressNextFrame();
+
+ // Set the encode frame in encoder to the encoded frame data
+ int GetEncodedData(dirac_encoder_t *encoder);
+
+ // Set the locally decoded frame data in encoder
+ int GetDecodedData (dirac_encoder_t *encoder);
+
+ // Set the instrumentation data in encoder
+ void GetInstrumentationData (dirac_encoder_t *encoder);
+
+ // Set the end of sequence infomration in encoder
+ int GetSequenceEnd(dirac_encoder_t *encoder);
+
+ // Set the buffer to hold the locally decoded frame
+ void SetDecodeBuffer (unsigned char *buffer, int buffer_size);
+
+ // Return the sequence parameters
+ const SeqParams& GetSeqParams() const { return m_sparams; }
+
+ // Return the encoder parameters
+ const EncoderParams& GetEncParams() const { return m_encparams; }
+
+private:
+
+ // Set the sequence parameters
+ void SetSequenceParams (const dirac_encoder_context_t *enc_ctx);
+
+ // Set the encoder parameters
+ void SetEncoderParams (const dirac_encoder_context_t *enc_ctx);
+
+ // Get the frame statistics
+ void GetFrameStats(dirac_encoder_t *encoder);
+
+ // Get the seuqence statistics
+ void GetSequenceStats(dirac_encoder_t *encoder);
+
+private:
+ // sequence compressor
+ SequenceCompressor *m_comp;
+ // sequence parameters
+ SeqParams m_sparams;
+ // encoder parameters
+ EncoderParams m_encparams;
+ // stream to hold the compressed frame
+ std::ostringstream m_comp_stream;
+ // locally encoded frame in coded order
+ const Frame *m_enc_frame;
+ // locally encoded frame ME data
+ const MEData *m_enc_medata;
+ // locally decoded frame number in display order
+ int m_decfnum;
+ //locally decoded frame type
+ FrameSort m_decfsort;
+ // locally decoded frame number in display order
+ int m_show_fnum;
+ // total number of frame loaded so far
+ int m_num_loaded_frames;
+ // total number of frames encoded so far
+ int m_num_coded_frames;
+ // verbose flag
+ bool m_verbose;
+ // input stream for uncompressed input frame
+ MemoryStreamInput m_inp_ptr;
+ // output stream for locally decoded frame
+ MemoryStreamOutput m_out_ptr;
+ // buffer to hold locally decoded frame. Set by SetDecodeBuffer
+ unsigned char *m_dec_buf;
+ // size of buffer to hold locally decoded data. Set by SetDecodeBuffer
+ int m_dec_bufsize;
+ // Flag that determines if locally decoded frames are to be returned. Set
+ // in Constructor
+ bool m_return_decoded_frames;
+ // Flag that determines if instrumentation data is to be returned. Set
+ // in Constructor
+ bool m_return_instr_data;
+};
+
+/*
+ Instrumentation callback. This function is passed as a parameter to the
+ SequenceCompressor constructor. It is called by the
+ FrameCompressor::Compress function once the frame is successfully compressed
+*/
+void DiracEncoder::GetInstrumentationData (dirac_encoder_t *encoder)
+{
+ dirac_ASSERT (encoder != NULL);
+ dirac_instr_t *instr = &encoder->instr;
+ dirac_instr_t old_instr = *instr;
+
+ if (!m_return_instr_data)
+ return;
+
+ const FrameParams& fparams = m_enc_frame->GetFparams();
+ const FrameSort fsort = fparams.FSort();
+
+ instr->fnum = fparams.FrameNum();
+ instr->ftype = fsort;
+ instr->num_refs = 0;
+ encoder->instr_data_avail = 1;
+
+ if (fsort == I_frame)
+ {
+ // no MV data for Intra coded data
+ return;
+ }
+
+ TESTM (m_enc_medata != NULL, "ME data available");
+
+ // Reference info
+ instr->num_refs = fparams.Refs().size();
+ dirac_ASSERTM (instr->num_refs <= 2, "Max # reference frames is 2");
+
+ for (int i=0; i<instr->num_refs; ++i)
+ instr->refs[i] = fparams.Refs()[i];
+
+ // Block separation params
+ instr->ybsep = m_encparams.LumaBParams(2).Ybsep();
+ instr->xbsep = m_encparams.LumaBParams(2).Xbsep();
+
+ // Num macroblocks
+ instr->mb_ylen = m_enc_medata->MBSplit().LengthY();
+ instr->mb_xlen = m_enc_medata->MBSplit().LengthX();
+
+ // Motion vector array dimensions
+ instr->mv_ylen = m_enc_medata->Vectors(1).LengthY();
+ instr->mv_xlen = m_enc_medata->Vectors(1).LengthX();
+
+ if (old_instr.mb_ylen != instr->mb_ylen ||
+ old_instr.mb_xlen != instr->mb_xlen ||
+ old_instr.mv_ylen != instr->mv_ylen ||
+ old_instr.mv_xlen != instr->mv_xlen)
+ {
+ dealloc_instr_data(instr);
+ alloc_instr_data(instr);
+ }
+
+ copy_2dArray (m_enc_medata->MBSplit(), instr->mb_split_mode);
+ copy_2dArray (m_enc_medata->MBCommonMode(), instr->mb_common_mode);
+ copy_2dArray (m_enc_medata->MBCosts(), instr->mb_costs);
+ copy_2dArray (m_enc_medata->Mode(), instr->pred_mode);
+ copy_2dArray (m_enc_medata->IntraCosts(), instr->intra_costs);
+
+ // FIXME: Always allocating for bipred_costs even though no data available
+ // Since medata is always created assuming two references
+ // if (instr->num_refs > 1)
+ {
+ copy_mv_cost (m_enc_medata->BiPredCosts(), instr->bipred_costs);
+ }
+
+ copy_2dArray (m_enc_medata->DC( Y_COMP ), instr->dc_ycomp);
+ if (m_enc_medata->DC().Length() == 3 &&
+ encoder->enc_ctx.seq_params.chroma != Yonly)
+ {
+ copy_2dArray (m_enc_medata->DC( U_COMP ), instr->dc_ucomp);
+ copy_2dArray (m_enc_medata->DC( V_COMP ), instr->dc_vcomp);
+ }
+
+ // FIXME: Always allocating for bipred_costs even though no data available
+ // Since medata is always created assuming two references
+ // for (int i=1; i<=instr->num_refs; ++i)
+ for (int i=1; i<=2; ++i)
+ {
+ copy_mv (m_enc_medata->Vectors(i), instr->mv[i-1]);
+ copy_mv_cost (m_enc_medata->PredCosts(i), instr->pred_costs[i-1]);
+ }
+}
+
+DiracEncoder::DiracEncoder(const dirac_encoder_context_t *enc_ctx,
+ bool verbose) :
+ m_show_fnum(-1),
+ m_num_loaded_frames(0),
+ m_num_coded_frames(0),
+ m_verbose(verbose),
+ m_dec_buf(0),
+ m_dec_bufsize(0),
+ m_return_decoded_frames(enc_ctx->decode_flag > 0),
+ m_return_instr_data(enc_ctx->instr_flag > 0)
+{
+ // Setup sequence parameters
+ SetSequenceParams (enc_ctx);
+ // Setup encoder parameters
+ m_encparams.SetVerbose( verbose );
+ SetEncoderParams (enc_ctx);
+
+ // Set up the input data stream (uncompressed data)
+ m_inp_ptr.SetSequenceParams(m_sparams);
+ // Set up the output data stream (locally decoded frame)
+ m_out_ptr.SetSequenceParams(m_sparams);
+
+ // initialise the sequence compressor
+ m_comp = new SequenceCompressor (&m_inp_ptr, &m_comp_stream, m_encparams);
+}
+
+void DiracEncoder::SetDecodeBuffer (unsigned char *buffer, int buffer_size)
+{
+ m_dec_buf = buffer;
+ m_dec_bufsize = buffer_size;
+ m_return_decoded_frames = true;
+}
+
+DiracEncoder::~DiracEncoder()
+{
+ delete m_comp;
+}
+
+void DiracEncoder::SetSequenceParams (const dirac_encoder_context_t *enc_ctx)
+{
+ m_sparams.SetCFormat( enc_ctx->seq_params.chroma );
+ m_sparams.SetXl( enc_ctx->seq_params.width );
+ m_sparams.SetYl( enc_ctx->seq_params.height );
+ m_sparams.SetInterlace( enc_ctx->seq_params.interlace );
+ m_sparams.SetTopFieldFirst( enc_ctx->seq_params.topfieldfirst );
+ m_sparams.SetFrameRate( enc_ctx->seq_params.frame_rate.numerator /
+ enc_ctx->seq_params.frame_rate.denominator );
+}
+
+void DiracEncoder::SetEncoderParams (const dirac_encoder_context_t *enc_ctx)
+{
+ TEST (enc_ctx != NULL);
+ OLBParams bparams(12, 12, 8, 8);
+
+ m_encparams.SetQf(enc_ctx->enc_params.qf);
+ m_encparams.SetL1Sep(enc_ctx->enc_params.L1_sep);
+ m_encparams.SetNumL1(enc_ctx->enc_params.num_L1);
+ m_encparams.SetCPD(enc_ctx->enc_params.cpd);
+ m_encparams.SetUFactor(3.0f);
+ m_encparams.SetVFactor(1.75f);
+ bparams.SetYblen( enc_ctx->enc_params.yblen );
+ bparams.SetXbsep( enc_ctx->enc_params.xblen );
+ bparams.SetYbsep( enc_ctx->enc_params.ybsep );
+ bparams.SetXbsep( enc_ctx->enc_params.xbsep );
+
+ // Now rationalise the GOP options
+ // this stuff should really be done in a constructor!
+ if (m_encparams.NumL1()<0)
+ {
+ //don't have a proper GOP
+ m_encparams.SetL1Sep( std::max(1 , m_encparams.L1Sep()) );
+ }
+ else if (m_encparams.NumL1() == 0)
+ {
+ //have I-frame only coding
+ m_encparams.SetL1Sep(0);
+ }
+ m_encparams.SetOrigXl( enc_ctx->seq_params.width );
+ m_encparams.SetOrigYl( enc_ctx->seq_params.height );
+ m_encparams.SetBlockSizes( bparams , enc_ctx->seq_params.chroma );
+}
+
+
+bool DiracEncoder::LoadNextFrame (unsigned char *data, int size)
+{
+ TESTM (m_comp->Finished() != true, "Did not reach end of sequence");
+ m_inp_ptr.SetMembufReference(data, size);
+ if (m_comp->LoadNextFrame())
+ {
+ m_num_loaded_frames++;
+ return true;
+ }
+ return false;
+}
+
+int DiracEncoder::CompressNextFrame ()
+{
+ TESTM (m_comp->Finished() != true, "Did not reach end of sequence");
+
+ if (!m_num_loaded_frames)
+ return 0;
+
+ Frame &myframe = m_comp->CompressNextFrame();
+
+ m_enc_frame = m_comp->GetFrameEncoded();
+ m_enc_medata = m_comp->GetMEData();
+
+ m_decfnum = -1;
+ if (m_return_decoded_frames &&
+ myframe.GetFparams().FrameNum() != m_show_fnum)
+ {
+ int ret_val;
+ m_show_fnum = myframe.GetFparams().FrameNum();
+ TEST (! (m_return_decoded_frames && !m_dec_buf) );
+ if (m_return_decoded_frames && m_dec_buf)
+ {
+ // write locally decoded frame to decode buffer
+ m_out_ptr.SetMembufReference(m_dec_buf, m_dec_bufsize);
+ ret_val = m_out_ptr.WriteNextFrame(myframe);
+
+ if (ret_val)
+ {
+ m_decfnum = m_show_fnum;
+ m_decfsort = myframe.GetFparams().FSort();
+ }
+ }
+ }
+
+ int size = m_comp_stream.str().size();
+ if (size > 0)
+ {
+ m_num_coded_frames++;
+ TESTM (m_enc_frame != 0, "Encoder frame available");
+ }
+ return size;
+}
+
+void DiracEncoder::GetFrameStats(dirac_encoder_t *encoder)
+{
+ const FrameOutputManager& foutput = m_encparams.BitsOut().FrameOutput();
+ dirac_enc_framestats_t *fstats = &encoder->enc_fstats;
+
+ fstats->mv_bits = foutput.MVBytes() * 8;
+ fstats->mv_hdr_bits = foutput.MVBytes() * 8;
+
+ fstats->ycomp_bits = foutput.ComponentBytes( Y_COMP ) * 8;
+ fstats->ycomp_hdr_bits = foutput.ComponentHeadBytes( Y_COMP ) * 8;
+
+ fstats->ucomp_bits = foutput.ComponentBytes( U_COMP ) * 8;
+ fstats->ucomp_hdr_bits = foutput.ComponentHeadBytes( U_COMP ) * 8;
+
+ fstats->vcomp_bits = foutput.ComponentBytes( V_COMP ) * 8;
+ fstats->vcomp_hdr_bits = foutput.ComponentHeadBytes( V_COMP ) * 8;
+
+ fstats->frame_bits = foutput.FrameBytes() * 8;
+ fstats->frame_hdr_bits = foutput.FrameHeadBytes() * 8;
+}
+
+int DiracEncoder::GetEncodedData (dirac_encoder_t *encoder)
+{
+ int size = 0;
+ dirac_enc_data_t *encdata = &encoder->enc_buf;
+
+ size = m_comp_stream.str().size();
+ if (size > 0)
+ {
+ if (encdata->size < size )
+ {
+ return -1;
+ }
+ memmove (encdata->buffer, m_comp_stream.str().c_str(), size);
+ encoder->enc_fparams.fnum = m_enc_frame->GetFparams().FrameNum();
+ encoder->enc_fparams.ftype = m_enc_frame->GetFparams().FSort();
+
+ // Get frame statistics
+ GetFrameStats (encoder);
+ encdata->size = size;
+
+ GetInstrumentationData(encoder);
+ encoder->encoded_frame_avail = 1;
+
+ m_comp_stream.str("");
+ }
+ else
+ {
+ encdata->size = 0;
+ }
+ return size;
+}
+
+int DiracEncoder::GetDecodedData (dirac_encoder_t *encoder)
+{
+ dirac_frameparams_t *fp = &encoder->dec_fparams;
+
+ int ret_stat = (m_decfnum != -1);
+ if (m_return_decoded_frames && m_decfnum != -1)
+ {
+ fp->ftype = m_decfsort;
+ fp->fnum = m_decfnum;
+ encoder->decoded_frame_avail = 1;
+ m_decfnum = -1;
+ }
+ return ret_stat;
+}
+
+void DiracEncoder::GetSequenceStats(dirac_encoder_t *encoder)
+{
+ dirac_enc_seqstats_t *sstats = &encoder->enc_seqstats;
+ dirac_seqparams_t *sparams = &encoder->enc_ctx.seq_params;
+
+ sstats->seq_bits = m_encparams.BitsOut().SequenceBytes() * 8;
+ sstats->seq_hdr_bits = m_encparams.BitsOut().SequenceHeadBytes() * 8;
+
+ sstats->mv_bits = m_encparams.BitsOut().MVBytes() * 8;
+ sstats->ycomp_bits = m_encparams.BitsOut().ComponentBytes( Y_COMP ) * 8;
+ sstats->ucomp_bits = m_encparams.BitsOut().ComponentBytes( U_COMP ) * 8;
+ sstats->vcomp_bits = m_encparams.BitsOut().ComponentBytes( V_COMP ) * 8;
+
+ sstats->bit_rate = (sstats->seq_bits * sparams->frame_rate.numerator)/
+ (sparams->frame_rate.denominator * m_num_coded_frames);
+}
+
+int DiracEncoder::GetSequenceEnd (dirac_encoder_t *encoder)
+{
+ dirac_enc_data_t *encdata = &encoder->enc_buf;
+ m_comp_stream.str("");
+ m_comp->EndSequence();
+ int size = m_comp_stream.str().size();
+ if (size > 0)
+ {
+ if (encdata->size < size )
+ {
+ return -1;
+ }
+ memmove (encdata->buffer, m_comp_stream.str().c_str(), size);
+ GetSequenceStats(encoder);
+ m_comp_stream.str("");
+ encdata->size = size;
+ }
+ else
+ {
+ encdata->size = 0;
+ }
+ return size;
+}
+
+static bool InitialiseEncoder (const dirac_encoder_context_t *enc_ctx, bool verbose, dirac_encoder_t *encoder)
+{
+ TEST (enc_ctx != NULL);
+ TEST (encoder != NULL);
+
+ if (enc_ctx->seq_params.width == 0 || enc_ctx->seq_params.height == 0)
+ return false;
+
+ if (enc_ctx->seq_params.chroma < Yonly ||
+ enc_ctx->seq_params.chroma > formatNK)
+ return false;
+
+ if (!enc_ctx->seq_params.frame_rate.numerator ||
+ !enc_ctx->seq_params.frame_rate.denominator)
+ return false;
+
+ memmove (&encoder->enc_ctx, enc_ctx, sizeof(dirac_encoder_context_t));
+
+ encoder->dec_buf.id = 0;
+
+ switch ( enc_ctx->seq_params.chroma )
+ {
+ case Yonly:
+ encoder->enc_ctx.seq_params.chroma_width = 0;
+ encoder->enc_ctx.seq_params.chroma_height = 0;
+ break;
+ case format411:
+ encoder->enc_ctx.seq_params.chroma_width = enc_ctx->seq_params.width/4;
+ encoder->enc_ctx.seq_params.chroma_height = enc_ctx->seq_params.height;
+ break;
+ case format420:
+ encoder->enc_ctx.seq_params.chroma_width = enc_ctx->seq_params.width/2;
+ encoder->enc_ctx.seq_params.chroma_height = enc_ctx->seq_params.height/2;
+ break;
+ case format422:
+ encoder->enc_ctx.seq_params.chroma_width = enc_ctx->seq_params.width/2;
+ encoder->enc_ctx.seq_params.chroma_height = enc_ctx->seq_params.height;
+ break;
+ case format444:
+ default:
+ encoder->enc_ctx.seq_params.chroma_width = enc_ctx->seq_params.width;
+ encoder->enc_ctx.seq_params.chroma_height = enc_ctx->seq_params.height;
+ break;
+ }
+
+ try
+ {
+ DiracEncoder *comp = new DiracEncoder (&encoder->enc_ctx, verbose);
+
+ int bufsize = (encoder->enc_ctx.seq_params.width * encoder->enc_ctx.seq_params.height)+ 2*(encoder->enc_ctx.seq_params.chroma_width*encoder->enc_ctx.seq_params.chroma_height);
+
+ encoder->dec_buf.buf[0] = new unsigned char [bufsize];
+ encoder->dec_buf.buf[1] = encoder->dec_buf.buf[0] +
+ (encoder->enc_ctx.seq_params.width * encoder->enc_ctx.seq_params.height);
+ encoder->dec_buf.buf[2] = encoder->dec_buf.buf[1] +
+ (encoder->enc_ctx.seq_params.chroma_width*encoder->enc_ctx.seq_params.chroma_height);
+
+ encoder->compressor = comp;
+ if (encoder->enc_ctx.decode_flag)
+ {
+ comp->SetDecodeBuffer (encoder->dec_buf.buf[0], bufsize);
+ }
+ }
+ catch (...)
+ {
+ return false;
+ }
+ return true;
+}
+
+static void SetSequenceParameters (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset)
+{
+ TEST (enc_ctx != NULL);
+ dirac_seqparams_t &sparams = enc_ctx->seq_params;
+
+ sparams.chroma = format420;
+ switch (preset)
+ {
+ case SD576:
+ sparams.width = 720;
+ sparams.height = 576;
+ sparams.frame_rate.numerator = 25;
+ sparams.frame_rate.denominator = 1;
+ sparams.interlace = 1;
+ sparams.topfieldfirst = 1;
+ break;
+ case HD720:
+ sparams.width = 1280;
+ sparams.height = 720;
+ sparams.frame_rate.numerator = 50;
+ sparams.frame_rate.denominator = 1;
+ sparams.interlace = 0;
+ sparams.topfieldfirst = 0;
+ break;
+ case HD1080:
+ sparams.width = 1920;
+ sparams.height = 1080;
+ sparams.frame_rate.numerator = 25;
+ sparams.frame_rate.denominator = 1;
+ sparams.interlace = 1;
+ sparams.topfieldfirst = 1;
+ break;
+ case CIF:
+ default:
+ sparams.width = 352;
+ sparams.height = 288;
+ sparams.frame_rate.numerator = 13;
+ sparams.frame_rate.denominator = 1;
+ sparams.interlace = 0;
+ sparams.topfieldfirst = 0;
+ break;
+ }
+}
+
+static void SetEncoderParameters (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset)
+{
+ TEST (enc_ctx != NULL);
+
+ dirac_encparams_t &encparams = enc_ctx->enc_params;
+
+ encparams.qf = 7.0f;
+
+ switch (preset)
+ {
+ case SD576:
+ encparams.L1_sep = 3;
+ encparams.num_L1 = 3;
+ encparams.cpd = 32.0f;
+ encparams.xblen = 12;
+ encparams.yblen = 12;
+ encparams.xbsep = 8;
+ encparams.ybsep = 8;
+ break;
+ case HD720:
+ encparams.L1_sep = 3;
+ encparams.num_L1 = 7;
+ encparams.cpd = 20.0f;
+ encparams.xblen = 16;
+ encparams.yblen = 16;
+ encparams.xbsep = 10;
+ encparams.ybsep = 12;
+ break;
+ case HD1080:
+ encparams.L1_sep = 3;
+ encparams.num_L1 = 3;
+ encparams.cpd = 32.0f;
+ encparams.xblen = 20;
+ encparams.yblen = 20;
+ encparams.xbsep = 16;
+ encparams.ybsep = 16;
+ break;
+ case CIF:
+ default:
+ encparams.L1_sep = 3;
+ encparams.num_L1 = 11;
+ encparams.cpd = 20.0f;
+ encparams.xblen = 12;
+ encparams.yblen = 12;
+ encparams.xbsep = 8;
+ encparams.ybsep = 8;
+ break;
+ }
+}
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern DllExport void dirac_encoder_context_init ( dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset)
+{
+ TEST (enc_ctx != NULL);
+ memset (enc_ctx, 0, sizeof(dirac_encoder_context_t));
+ SetSequenceParameters (enc_ctx, preset);
+ SetEncoderParameters (enc_ctx, preset);
+}
+
+extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose)
+{
+ /* Allocate for encoder */
+ dirac_encoder_t *encoder = new dirac_encoder_t;
+
+ memset (encoder, 0, sizeof(dirac_encoder_t));
+
+ /* initialse the encoder context */
+ if (!InitialiseEncoder(enc_ctx, verbose>0, encoder))
+ {
+ delete encoder;
+ return NULL;
+ }
+
+ encoder->encoded_frame_avail = encoder->decoded_frame_avail = 0;
+ encoder->instr_data_avail = 0;
+
+
+ return encoder;
+}
+
+extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size)
+{
+ TEST (encoder != NULL);
+ TEST (encoder->compressor != NULL);
+ DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
+ int ret_stat = 0;
+ try
+ {
+ if ( compressor->LoadNextFrame (uncdata, uncdata_size))
+ {
+ ret_stat = uncdata_size;
+ }
+ }
+ catch (...)
+ {
+ if (compressor->GetEncParams().Verbose())
+ std::cerr << "dirac_encoder_load failed" << std::endl;
+ ret_stat = -1;
+ }
+ return ret_stat;
+}
+
+extern DllExport dirac_encoder_state_t
+ dirac_encoder_output (dirac_encoder_t *encoder)
+{
+ TEST (encoder != NULL);
+ TEST (encoder->compressor != NULL);
+ TEST (encoder->enc_buf.size != 0);
+ TEST (encoder->enc_buf.buffer != NULL);
+ DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
+ dirac_encoder_state_t ret_stat = ENC_STATE_BUFFER;
+
+ encoder->encoded_frame_avail = 0;
+ encoder->decoded_frame_avail = 0;
+ encoder->instr_data_avail = 0;
+
+ try
+ {
+ compressor->CompressNextFrame();
+ if (compressor->GetEncodedData (encoder) < 0)
+ ret_stat = ENC_STATE_INVALID;
+ else
+ {
+ if (encoder->enc_buf.size > 0)
+ {
+ ret_stat = ENC_STATE_AVAIL;
+ }
+
+ if (encoder->enc_ctx.decode_flag)
+ compressor->GetDecodedData(encoder);
+ }
+ }
+ catch (...)
+ {
+ if (compressor->GetEncParams().Verbose())
+ std::cerr << "GetEncodedData failed..." << std::endl;
+
+ ret_stat = ENC_STATE_INVALID;
+ }
+ return ret_stat;
+}
+
+extern DllExport int dirac_encoder_end_sequence (dirac_encoder_t *encoder)
+{
+ TEST (encoder != NULL);
+ TEST (encoder->compressor != NULL);
+ DiracEncoder *compressor = (DiracEncoder *)encoder->compressor;
+ int ret_stat;
+
+ encoder->encoded_frame_avail = 0;
+ encoder->decoded_frame_avail = 0;
+ encoder->instr_data_avail = 0;
+
+ try
+ {
+ ret_stat = compressor->GetSequenceEnd (encoder);
+ encoder->end_of_sequence = 1;
+
+ if (compressor->GetDecodedData(encoder))
+ {
+ encoder->decoded_frame_avail = 1;
+ }
+ }
+ catch (...)
+ {
+ if (compressor->GetEncParams().Verbose())
+ std::cerr << "GetSequenceEnd failed..." << std::endl;
+ ret_stat = -1;
+ }
+ return ret_stat;
+}
+
+extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder)
+{
+ TEST (encoder != NULL);
+ TEST (encoder->compressor != NULL);
+
+ delete (DiracEncoder *)(encoder->compressor);
+
+ if (encoder->enc_ctx.instr_flag)
+ {
+ dealloc_instr_data(&encoder->instr);
+ }
+
+ if (encoder->enc_ctx.decode_flag)
+ {
+ delete [] encoder->dec_buf.buf[0];
+ }
+ delete encoder;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/dirac_encoder.h b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/dirac_encoder.h
new file mode 100644
index 000000000..8faa4768f
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/dirac_encoder.h
@@ -0,0 +1,508 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: dirac_encoder.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Anuradha Suraparaju (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef DIRAC_ENCODER_H
+#define DIRAC_ENCODER_H
+
+#include <libdirac_common/dirac_types.h>
+
+/*! \file
+\brief C interface to Dirac Encoder.
+
+ A set of 'C' functions that define the public interface to the Dirac encoder.
+ Refer to the the reference encoder source code, encoder/encmain.cpp for
+ an example of how to use the "C" interface. The pseudocode below gives
+ a brief description of the "C" interface usage.
+
+\verbatim
+ #include <libdirac_decoder/dirac_encoder.h>
+
+ #define ENCBUF_SIZE 1024*1024;
+ unsigned char *buffer, enc_buf[ENC_BUFSIZE];
+ int buffer_size;
+ dirac_encoder_t *encoder;
+ dirac_encoder_context_t enc_ctx;
+
+ // Initialse the encoder context with the presets for SD576 - Standard
+ // Definition Digital
+ dirac_encoder_context_init (&enc_ctx, SD576);
+
+ // Override parameters if required
+ // interlace : 1 - interlaced; 0 - progressive
+ enc_ctx.seq_params.interlace = 0;
+ enc_ctx.seq_params.topfieldfirst = 0;
+ enc_ctx.enc_params.qf = 7.5;
+ // disable instrumentation flag
+ enc_ctx.instr_flag = 0;
+ // return locally decoded output
+ enc_ctx.decode_flag = 1;
+
+ // Initialise the encoder with the encoder context.
+ // Setting verbose output to false
+ encoder= dirac_encoder_init(&enc_ctx, false);
+
+ // Set the buffer size. For SD576 4:2:0 chroma
+ buffer_size = (720*576*3)/2;
+ buffer = (unsigned char *)malloc (buffer_size);
+
+ // Output buffer
+
+ dirac_encoder_state_t state;
+
+ while (read uncompressed frame data into buffer)
+ {
+ // load one frame of data into encoder
+ if (dirac_encoder_load(encoder, buffer, buffer_size) == 0)
+ {
+ // Retrieve encoded frames from encoder
+ do
+ {
+ encoder->enc_buf.buffer = enc_buf;
+ encoder->enc_buf.size = ENCBUF_SIZE;
+ state = dirac_encoder_output (encoder);
+ switch (state)
+ {
+ case ENC_STATE_AVAIL:
+ // Encoded frame available in encoder->enc_buf
+ // Encoded frame params available in enccoder->enc_fparams
+ // Encoded frame stats available in enccoder->enc_fstats
+ break;
+ case ENC_STATE_BUFFER:
+ break;
+ case ENC_STATE_INVALID:
+ default:
+ // Unrecoverable error encountered. Exit;
+ exit (exit code);
+ }
+ if (encoder->decoded_frame_avail)
+ {
+ //locally decoded frame is available in
+ //encoder->dec_buf
+ //locally decoded frame parameters available
+ //in encoder->dec_fparams
+ }
+ if (encoder->instr_data_avail)
+ {
+ //Instrumentation data (motion vectors etc.)
+ //available in encoder->instr
+ }
+ } while (state == ENC_STATE_AVAIL)
+ }
+ }
+ // Retrieve end of sequence info
+ encoder->enc_buf.buffer = video_buf;
+ encoder->enc_buf.size = VIDEO_BUFFER_SIZE;
+ dirac_encoder_end_sequence( encoder );
+ // End of sequence info is availale in encoder->enc_buf
+ // Sequence statistics available in encoder->enc_seqstats;
+
+ // Free the encoder resources
+ dirac_encoder_close(encoder)
+ // Free the uncompressed data buffer
+ free (buffer);
+
+ \endverbatim
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*! Enumerated type that defines encoder state */
+typedef enum
+{
+ ENC_STATE_INVALID = -1,
+ ENC_STATE_BUFFER,
+ ENC_STATE_AVAIL
+} dirac_encoder_state_t ;
+
+/*! Enumerated type that defines encoder presets that set the encoder and
+ sequence paramters. More presets may be added in future*/
+typedef enum
+{
+ CIF,
+ SD576,
+ HD720,
+ HD1080
+} dirac_encoder_presets_t;
+
+/*! Structure that holds the encoder specific parameters */
+typedef struct
+{
+ /*! Quality factor 0.0 to 10.0 */
+ float qf;
+ /*! The separation between L1 frames */
+ int L1_sep;
+ /*! The number of L1 frames before the next intra frame. Together
+ with L1_sep determines the GOP structure.
+ */
+ int num_L1;
+ /*! Normalised viewing distance parameter, in cycles per degree */
+ float cpd;
+ /*! The width of blocks used for motion compensation */
+ int xblen;
+ /*! The height of blocks used for motion compensation */
+ int yblen;
+ /*! The horizontal separation between blocks. Always <xblen */
+ int xbsep;
+ /*! The vertical separation between blocks. Always <yblen */
+ int ybsep;
+} dirac_encparams_t;
+
+/*! Structure that holds the parameters that set up the encoder context */
+typedef struct
+{
+ /*! Sequence parameters */
+ dirac_seqparams_t seq_params;
+ /*! Encoder parameters */
+ dirac_encparams_t enc_params;
+ /*! Return diagnostics info 1-return mv data, 0-no diagnostics returned */
+ int instr_flag;
+ /*! Return locally decoded frames 1-return locally decoded frames,
+ 0-no decoded frames returned */
+ int decode_flag;
+} dirac_encoder_context_t;
+
+/*! Function that creates an encoder context based on a preset value. The
+ values can then be overridden by the user by setting each field separately
+ \param enc_ctx pointer to Encoder context tp be initialised.
+ \param preset Preset to be used to initialise the encoder context
+ \verbatim
+ The sequence parameters and encoder parameters are initialised as follows
+
+ Sequence Parameters:
+ Preset Field Value
+ CIF width 352
+ height 288
+ chroma Planar YUV 4:2:0
+ chroma_width calculated from width and chroma
+ chroma_height calculated from height and chroma
+ frame_rate 13/1
+ interlace 0 (progressive)
+ topfieldfirst 0
+ SD576 width 720
+ height 576
+ chroma Planar YUV 4:2:0
+ chroma_width calculated from width and chroma
+ chroma_height calculated from height and chroma
+ frame_rate 25/1
+ interlace 1 (interlaced)
+ topfieldfirst 1
+ HD720 width 1280
+ height 720
+ chroma Planar YUV 4:2:0
+ chroma_width calculated from width and chroma
+ chroma_height calculated from height and chroma
+ frame_rate 50/1
+ interlace 0 (progressive)
+ topfieldfirst 0
+ HD1080 width 1920
+ height 1080
+ chroma Planar YUV 4:2:0
+ chroma_width calculated from width and chroma
+ chroma_height calculated from height and chroma
+ frame_rate 25/1
+ interlace 1 (interlaced)
+ topfieldfirst 1
+
+ Encoder params:
+ Preset Field Value
+ CIF qf 7
+ L1_sep 3
+ num_L1 11
+ cpd 20.0
+ xblen 12
+ yblen 12
+ xbsep 8
+ ybsep 8
+
+ SD576 qf 7
+ L1_sep 3
+ num_L1 3
+ cpd 32.0
+ xblen 12
+ yblen 12
+ xbsep 8
+ ybsep 8
+
+ HD720 qf 7
+ L1_sep 3
+ num_L1 7
+ cpd 20.0
+ xblen 16
+ yblen 16
+ xbsep 10
+ ybsep 12
+
+ HD1080 qf 7
+ L1_sep 3
+ num_L1 3
+ cpd 32.0
+ xblen 20
+ yblen 20
+ xbsep 16
+ ybsep 16
+
+ \endverbatim
+*/
+extern DllExport void dirac_encoder_context_init (dirac_encoder_context_t *enc_ctx, dirac_encoder_presets_t preset);
+
+
+/*! Structure that holds the encoded data*/
+typedef struct
+{
+ /*! Buffer to hold encoded. Allocated and managed by library user. */
+ unsigned char *buffer;
+ /*! Buffer size */
+ int size;
+} dirac_enc_data_t;
+
+/*! Structure that holds the statistics about the encoded frame */
+typedef struct
+{
+ /*! Number of motion vector bits */
+ unsigned int mv_bits;
+ /*! Number of motion vector header bits */
+ unsigned int mv_hdr_bits;
+ /*! Number of used to encode y component */
+ unsigned int ycomp_bits;
+ /*! y component header bits*/
+ unsigned int ycomp_hdr_bits;
+ /*! Number of used to encode u component */
+ unsigned int ucomp_bits;
+ /*! v component header bits*/
+ unsigned int ucomp_hdr_bits;
+ /*! Number of used to encode v component */
+ unsigned int vcomp_bits;
+ /*! v component header bits*/
+ unsigned int vcomp_hdr_bits;
+ /*! Total number of bits used to encode frame */
+ unsigned int frame_bits;
+ /*! Number of frame header bits */
+ unsigned int frame_hdr_bits;
+} dirac_enc_framestats_t;
+
+/*! Structure that holds the statistics about the encoded sequence */
+typedef struct
+{
+ /*! Number of motion vector bits */
+ unsigned int mv_bits;
+ /*! Total number of bits used to encode sequence */
+ unsigned int seq_bits;
+ /*! Number of sequence header bits */
+ unsigned int seq_hdr_bits;
+ /*! Number of used to encode y component */
+ unsigned int ycomp_bits;
+ /*! Number of used to encode u component */
+ unsigned int ucomp_bits;
+ /*! Number of used to encode v component */
+ unsigned int vcomp_bits;
+ /*! Average bit rate for the sequence */
+ unsigned int bit_rate;
+} dirac_enc_seqstats_t;
+
+/*! Structure that holds the motion vector information */
+typedef struct
+{
+ /*! X component */
+ int x;
+ /*! Y component */
+ int y;
+} dirac_mv_t;
+
+/*! Structure that holds the motion vector cost information*/
+typedef struct
+{
+ /*! The Sum of Absolute Differences */
+ float SAD;
+ /*! The (Lagrangian-weighted) motion vector cost */
+ float mvcost;
+} dirac_mv_cost_t;
+
+/*! Structure that diagnostics data returned by the encoder */
+typedef struct
+{
+ /*! Frame type */
+ dirac_frame_type_t ftype;
+ /*! Frame number */
+ int fnum;
+ /*! Number of reference frames */
+ int num_refs;
+ /*! Array of Reference frame numbers */
+ int refs[2];
+ /*! Block separation in X direction */
+ int xbsep;
+ /*! Block separation in Y direction */
+ int ybsep;
+ /*! MacroBlock length in X direction */
+ int mb_xlen;
+ /*! MacroBlock length in Y direction */
+ int mb_ylen;
+ /*! Motion Vector array length in X direction */
+ int mv_xlen;
+ /*! Motion Vector array length in Y direction */
+ int mv_ylen;
+ /*! Macro-block split mode array - mb_ylen*mb_xlen*/
+ int *mb_split_mode;
+ /*! Macro-block common mode array - mb_ylen*mb_xlen*/
+ int *mb_common_mode;
+ /*! Macro-block costs array - mb_ylen*mb_xlen*/
+ float *mb_costs;
+ /*! Block prediction mode - mv_xlen*mv_ylen */
+ int *pred_mode;
+ /*! Block intrac costs - mv_xlen*mv_ylen */
+ float *intra_costs;
+ /*! Bi prediction costs - mv_xlen*mv_ylen*2 */
+ dirac_mv_cost_t *bipred_costs;
+ /*! DC values of y_comp */
+ short *dc_ycomp;
+ /*! DC values of u_comp */
+ short *dc_ucomp;
+ /*! DC values of v_comp */
+ short *dc_vcomp;
+ /*! Motion vectors for Reference frames mv_ylen*mv_xlen */
+ dirac_mv_t *mv[2];
+ /*! Predictions costs for Reference frames mv_ylen*mv_xlen */
+ dirac_mv_cost_t *pred_costs[2];
+} dirac_instr_t;
+
+/*! Structure that holds the information returned by the encoder */
+typedef struct
+{
+ /*! Encoder context */
+ dirac_encoder_context_t enc_ctx;
+
+ /*! encoded frame avail flag */
+ int encoded_frame_avail;
+
+ /*!
+ encoded output. This buffer must be initialised by the user of the
+ library
+ */
+ dirac_enc_data_t enc_buf;
+
+ /*! encoded frame params */
+ dirac_frameparams_t enc_fparams;
+
+ /*! encoded frame stats */
+ dirac_enc_framestats_t enc_fstats;
+
+ /*! encoded frame stats */
+ dirac_enc_seqstats_t enc_seqstats;
+
+ /*! end of sequence */
+ int end_of_sequence;
+
+ /* locally decoded frame available flag.
+ 1 - locally decoded frame available in dec_buf.
+ 0 - locally decoded frame not available.
+ */
+ int decoded_frame_avail;
+
+ /*!
+ locally decoded output buffer. This buffer is allocated and managed by
+ the encoder library
+ */
+ dirac_framebuf_t dec_buf;
+
+ /*! locally decoded frame params */
+ dirac_frameparams_t dec_fparams;
+
+ /*!
+ instrumentation data buffer. This buffer is allocated and managed by
+ the encoder library. */
+ dirac_instr_t instr;
+
+ /*! instrumentation data available flag
+ 1 - instrumentation data available in instr
+ 0 - linstrumentation data not available.
+ */
+ int instr_data_avail;
+
+ /*! void pointer to internal sequence compressor */
+ const void *compressor;
+} dirac_encoder_t;
+
+/*!
+ Initialise encoder. Makes a copy of the enc_ctx passed to it.
+ \param enc_ctx Parameters to initialise encoder context
+ \param verbose boolean flag to set verbose output
+ \return encoder Handle to encoder if successful or NULL on failure
+*/
+extern DllExport dirac_encoder_t *dirac_encoder_init (const dirac_encoder_context_t *enc_ctx, int verbose);
+
+/*!
+ Load uncompressed data into the encoder. Expects one full frame of data
+ \param encoder Encoder Handle
+ \param uncdata Uncompressed data buffer
+ \param uncdata_size boolean flag to set verbose output
+ \return return status. >0 - successful; -1 failed
+ Failure may be due to input data size not matching
+ the required frame size.
+*/
+extern DllExport int dirac_encoder_load (dirac_encoder_t *encoder, unsigned char *uncdata, int uncdata_size);
+
+/*!
+ Retrieve an encoded frame from the encoder. Returns the state of the
+ encoder. The encoder buffer enc_buf in the encodermust be
+ set up with the buffer and buffer_size that will hold the encoded frame
+ \param encoder Encoder Handle
+ \return ENC_STATE_INVALID - unrecoverable error
+ ENC_STATE_BUFFER - load data into encoder
+ ENC_STATE_AVAIL - Encoded frame available
+*/
+extern DllExport dirac_encoder_state_t dirac_encoder_output (dirac_encoder_t *encoder);
+
+/*!
+ Retrieve end of sequence information from the encoder. The encoder buffer,
+ enc_buf, in the encodermust be set up with the buffer and
+ buffer_size that will hold the end of sequence information.
+ \param encoder Encoder Handle
+ \return return status. >=0 - successful; -1 failed
+*/
+extern DllExport int dirac_encoder_end_sequence (dirac_encoder_t *encoder);
+
+/*!
+ Free resources held by encoder
+ \param encoder Encoder Handle
+*/
+extern DllExport void dirac_encoder_close (dirac_encoder_t *encoder);
+
+#endif
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/frame_compress.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/frame_compress.cpp
new file mode 100644
index 000000000..fab6f0eeb
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/frame_compress.cpp
@@ -0,0 +1,255 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: frame_compress.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd,
+* Chris Bowley,
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+//Compression of frames//
+/////////////////////////
+
+#include <libdirac_encoder/frame_compress.h>
+#include <libdirac_encoder/comp_compress.h>
+#include <libdirac_common/mot_comp.h>
+#include <libdirac_motionest/motion_estimate.h>
+#include <libdirac_common/mv_codec.h>
+#include <libdirac_common/golomb.h>
+#include <libdirac_common/bit_manager.h>
+#include <libdirac_common/dirac_assertions.h>
+using namespace dirac;
+
+#include <iostream>
+#include <sstream>
+
+FrameCompressor::FrameCompressor( EncoderParams& encp ) :
+ m_encparams(encp),
+ m_me_data(0),
+ m_skipped(false),
+ m_use_global(false),
+ m_use_block_mv(true),
+ m_global_pred_mode(REF1_ONLY),
+ m_medata_avail(false)
+{
+}
+
+FrameCompressor::~FrameCompressor()
+{
+ if (m_me_data)
+ delete m_me_data;
+}
+
+void FrameCompressor::Compress( FrameBuffer& my_buffer, const FrameBuffer& orig_buffer , int fnum )
+{
+ FrameOutputManager& foutput = m_encparams.BitsOut().FrameOutput();
+
+ Frame& my_frame = my_buffer.GetFrame( fnum );
+ const FrameParams& fparams = my_frame.GetFparams();
+ const FrameSort& fsort = fparams.FSort();
+ const ChromaFormat cformat = fparams.CFormat();
+
+ // number of bits written, without byte alignment
+ unsigned int num_mv_bits;
+ m_medata_avail = false;
+
+ CompCompressor my_compcoder(m_encparams , fparams );
+
+ if (m_me_data)
+ {
+ delete m_me_data;
+ m_me_data = 0;
+ }
+
+ if ( fsort != I_frame )
+ {
+
+ m_me_data = new MEData( m_encparams.XNumMB() , m_encparams.YNumMB());
+
+ // Motion estimate first
+ MotionEstimator my_motEst( m_encparams );
+ bool is_a_cut = my_motEst.DoME( orig_buffer , fnum , *m_me_data );
+
+ // If we have a cut, and an L1 frame, then turn into an I-frame
+ if ( is_a_cut )
+ {
+ my_frame.SetFrameSort( I_frame );
+ if ( m_encparams.Verbose() )
+ std::cerr<<std::endl<<"Cut detected and I-frame inserted!";
+ }
+
+ }
+
+
+ // Write the frame header. We wait until after motion estimation, since
+ // this allows us to do cut-detection and (possibly) to decide whether
+ // or not to skip a frame before actually encoding anything. However we
+ // can do this at any point prior to actually writing any frame data.
+ WriteFrameHeader( my_frame.GetFparams() );
+
+
+ if ( !m_skipped )
+ { // If not skipped we continue with the coding ...
+
+ if ( fsort != I_frame)
+ {
+ // Code the MV data
+
+ // If we're using global motion parameters, code them
+ if (m_use_global)
+ {
+ /*
+ Code the global motion parameters
+ TBC ....
+ */
+ }
+
+ // If we're using block motion vectors, code them
+ if ( m_use_block_mv )
+ {
+ MvDataCodec my_mv_coder( &( foutput.MVOutput().Data() ) , 50 , cformat);
+
+ my_mv_coder.InitContexts();//may not be necessary
+ num_mv_bits = my_mv_coder.Compress( *m_me_data );
+
+ UnsignedGolombCode( foutput.MVOutput().Header() , num_mv_bits);
+ }
+
+ // Then motion compensate
+
+ MotionCompensator mycomp( m_encparams , SUBTRACT);
+ mycomp.CompensateFrame( my_buffer , fnum , *m_me_data );
+
+ }//?fsort
+
+ //code component data
+ my_compcoder.Compress( my_buffer.GetComponent( fnum , Y_COMP) );
+ if (cformat != Yonly)
+ {
+ my_compcoder.Compress( my_buffer.GetComponent( fnum , U_COMP) );
+ my_compcoder.Compress( my_buffer.GetComponent( fnum , V_COMP) );
+ }
+
+ //motion compensate again if necessary
+ if ( fsort != I_frame )
+ {
+ MotionCompensator mycomp( m_encparams , ADD);
+ mycomp.CompensateFrame( my_buffer , fnum , *m_me_data );
+ // Set me data available flag
+ m_medata_avail = true;
+ }//?fsort
+
+ //finally clip the data to keep it in range
+ my_buffer.GetFrame(fnum).Clip();
+
+ }//?m_skipped
+}
+
+void FrameCompressor::WriteFrameHeader( const FrameParams& fparams )
+{
+ BasicOutputManager& frame_header_op = m_encparams.BitsOut().FrameOutput().HeaderOutput();
+
+ // Write the frame start code
+ unsigned char frame_start[5] = { START_CODE_PREFIX_BYTE0,
+ START_CODE_PREFIX_BYTE1,
+ START_CODE_PREFIX_BYTE2,
+ START_CODE_PREFIX_BYTE3,
+ IFRAME_START_CODE };
+ switch(fparams.FSort())
+ {
+ case I_frame:
+ frame_start[4] = IFRAME_START_CODE;
+ break;
+
+ case L1_frame:
+ frame_start[4] = L1FRAME_START_CODE;
+ break;
+
+ case L2_frame:
+ frame_start[4] = L2FRAME_START_CODE;
+ break;
+
+ default:
+// dirac_ASSERTM (false, "Frame type is I_frame or L1_frame or L2_frame");
+ break;
+ }
+ frame_header_op.OutputBytes((char *)frame_start, 5);
+
+ // Write the frame number
+ UnsignedGolombCode(frame_header_op , fparams.FrameNum());
+
+ //write whether the frame is m_skipped or not
+ frame_header_op.OutputBit( m_skipped );
+
+ if (!m_skipped)
+ {// If we're not m_skipped, then we write the rest of the metadata
+
+ // Write the expiry time relative to the frame number
+ UnsignedGolombCode( frame_header_op , fparams.ExpiryTime() );
+
+ // Write the frame sort
+ UnsignedGolombCode( frame_header_op , (unsigned int) fparams.FSort() );
+ if (fparams.FSort() != I_frame)
+ {
+ // If not an I-frame, write how many references there are
+ UnsignedGolombCode( frame_header_op , (unsigned int) fparams.Refs().size() );
+
+ // For each reference, write the reference number relative to the frame number
+ for ( size_t i=0 ; i<fparams.Refs().size() ; ++i )
+ GolombCode( frame_header_op , fparams.Refs()[i]-fparams.FrameNum() );
+
+ // Indicate whether or not there is global motion vector data
+ frame_header_op.OutputBit( m_use_global );
+
+ // Indicate whether or not there is block motion vector data
+ frame_header_op.OutputBit( m_use_block_mv );
+
+ // If there is global but no block motion vector data, indicate the
+ // prediction mode to use for the whole frame
+ if ( m_use_global && !m_use_block_mv )
+ {
+ UnsignedGolombCode( frame_header_op , (unsigned int) m_global_pred_mode );
+ }
+ }
+
+ }// ?m_skipped
+}
+
+const MEData* FrameCompressor::GetMEData() const
+{
+ TESTM (m_me_data != NULL, "m_medata allocated");
+ TESTM (m_medata_avail == true, "ME Data available");
+
+ return m_me_data;
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/frame_compress.h b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/frame_compress.h
new file mode 100644
index 000000000..30152e4f6
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/frame_compress.h
@@ -0,0 +1,133 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: frame_compress.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd,
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#ifndef _FRAME_COMPRESS_H_
+#define _FRAME_COMPRESS_H_
+
+#include <libdirac_common/frame_buffer.h>
+#include <libdirac_common/common.h>
+#include <libdirac_common/motion.h>
+namespace dirac
+{
+
+ class MvData;
+
+ //! Compress a single image frame
+ /*!
+ This class compresses a single frame at a time, using parameters
+ supplied at its construction. FrameCompressor is used by
+ SequenceCompressor.
+ */
+ class FrameCompressor
+ {
+ public:
+ //! Constructor
+ /*!
+ Creates a FrameEncoder with specific set of parameters the control
+ the compression process. It encodes motion data before encoding
+ each component of the frame.
+ \param encp encoder parameters
+ */
+ FrameCompressor( EncoderParams& encp );
+
+ //! Destructor
+ ~FrameCompressor( );
+ //! Compress a specific frame within a group of pictures (GOP)
+ /*!
+ Compresses a specified frame within a group of pictures.
+ \param fbuffer picture buffer in which the frame resides
+ \param orig_buffer the corresponding picture buffer of uncoded originals
+ \param fnum frame number to compress
+ */
+ void Compress( FrameBuffer& fbuffer , const FrameBuffer& orig_buffer , int fnum );
+
+ //! Returns true if the frame has been skipped rather than coded normally
+ bool IsSkipped(){ return m_skipped; }
+
+ //! Returns true if Motion estimation data is available
+ bool IsMEDataAvail() const { return m_medata_avail; }
+
+ //! Returns the motion estimation data
+ const MEData* GetMEData() const;
+
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not
+ be copied.
+ */
+ FrameCompressor( const FrameCompressor& cpy );
+
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned.
+ */
+ FrameCompressor& operator=(const FrameCompressor& rhs);
+
+ //! Write the frame compression header
+ void WriteFrameHeader(const FrameParams& fparams);
+
+ //member variables
+ // a local copy of the encoder params
+ EncoderParams& m_encparams;
+
+ // Pointer to the motion vector data
+ MEData* m_me_data;
+
+ // True if the frame has been skipped, false otherwise
+ bool m_skipped;
+
+ // True if we use global motion vectors, false otherwise
+ bool m_use_global;
+
+ // True if we use block motion vectors, false otherwise
+ bool m_use_block_mv;
+
+ // Prediction mode to use if we only have global motion vectors
+ PredMode m_global_pred_mode;
+
+ // True if motion estimation data is available
+ bool m_medata_avail;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/quality_monitor.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/quality_monitor.cpp
new file mode 100644
index 000000000..2be84ef34
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/quality_monitor.cpp
@@ -0,0 +1,269 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: quality_monitor.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_encoder/quality_monitor.h>
+#include <libdirac_common/wavelet_utils.h>
+using namespace dirac;
+
+using std::log10;
+
+QualityMonitor::QualityMonitor(EncoderParams& encp,
+ const SeqParams& sparams)
+:
+ m_encparams(encp),
+ m_cformat( sparams.CFormat() ),
+ m_true_xl( sparams.Xl() ),
+ m_true_yl( sparams.Yl() ),
+ m_target_quality(3),
+ m_last_quality(3),
+ m_slope(3),
+ m_offset(3),
+ m_last_lambda(3)
+{
+ ResetAll();
+}
+
+void QualityMonitor::ResetAll()
+{
+ // set target qualities
+ m_target_quality[I_frame] = 0.28 * m_encparams.Qf()* m_encparams.Qf() + 20.0 ;
+ m_target_quality[L1_frame] = m_target_quality[I_frame] - 1.0;
+ m_target_quality[L2_frame] = m_target_quality[I_frame] - 2.0;
+
+ // assume we hit those targets last time
+ m_last_quality = m_target_quality;
+
+ // set defaults for the model
+ m_slope[I_frame] = -4.0;
+ m_slope[L1_frame] = -4.0;
+ m_slope[L2_frame] = -4.0;
+ m_offset[I_frame] = 38.5,
+ m_offset[L1_frame] = 43.3;
+ m_offset[L2_frame] = 43.3;
+
+ for (size_t fsort=0; fsort<3; ++fsort)
+ {
+ m_last_lambda[fsort] = std::pow( 10.0, (m_target_quality[fsort] - m_offset[fsort])/m_slope[fsort] );
+ }// fsort
+
+ // set a default ratio for the motion estimation lambda
+ // Exact value TBD - will incorporate stuff about blocks and so on
+ // Also need to think about how this can be adapted for sequences with more or less motion
+
+ m_me_ratio = 0.1;
+
+ // set up the Lagrangian parameters
+ for (size_t fsort=0; fsort<3; ++fsort)
+ {
+ m_encparams.SetLambda( FrameSort(fsort), m_last_lambda[fsort] );
+ }// fsort
+
+ m_encparams.SetL1MELambda( std::sqrt(m_encparams.L1Lambda())*m_me_ratio );
+ m_encparams.SetL2MELambda( std::sqrt(m_encparams.L2Lambda())*m_me_ratio );
+
+}
+
+bool QualityMonitor::UpdateModel(const Frame& ld_frame, const Frame& orig_frame , const int count)
+{
+ // The return value - true if we need to recode, false otherwise
+ bool recode = false;
+
+ const FrameSort& fsort = ld_frame.GetFparams().FSort();
+ double target_quality;
+
+ // Parameters relating to the last frame we measured
+ double last_lambda;
+ double last_quality;
+
+ // Parameters relating to the current frame
+ double current_lambda;
+ double current_quality;
+
+
+ // Set up local parameters for the particular frame type
+ current_lambda = m_encparams.Lambda(fsort);
+ last_lambda = m_last_lambda[fsort];
+ last_quality = m_last_quality[fsort];
+ target_quality = m_target_quality[fsort];
+
+ // Get the quality of the current frame
+ current_quality = QualityVal( ld_frame.Ydata() , orig_frame.Ydata() , 0.0 , fsort );
+
+ // Copy current data into memory for last frame data
+ m_last_lambda[fsort] = m_encparams.Lambda(fsort);
+ m_last_quality[fsort] = current_quality;
+
+ // Ok, so we've got an actual quality value to use. We know the lambda used before and the resulting
+ // quality then allows us to estimate the slope of the curve of quality versus log of lambda
+
+ if ( std::abs(current_quality - last_quality)> 0.2 &&
+ std::abs(log10(current_lambda) - log10(last_lambda)) > 0.1 )
+ {// if we can adjust model accurately, do so
+
+ double slope, offset;
+
+ // Calculate the slope of WPSNR versus log(lambda) from prior measurements
+ slope = (current_quality - last_quality)/( log10(current_lambda) - log10(last_lambda) );
+
+ //Restrict so that the value isn't too extreme
+ slope = std::min( std::max( -10.0 , slope ), -0.1);
+
+ // Calculate the resulting offset
+ offset = current_quality - ( log10(current_lambda) * slope );
+
+ if ( count != 1 )
+ {
+ // Update the default values using a simple recursive filter ...
+ m_slope[fsort] = (3.0*m_slope[fsort] + slope)/4.0;
+ m_offset[fsort] = (3.0*m_offset[fsort] + offset)/4.0;
+ }
+ else
+ {
+ // .. unless we're recoding a frame for the first time
+ m_slope[fsort] = (m_slope[fsort] + slope)/2.0;
+ m_offset[fsort] = (m_offset[fsort] + offset)/2.0;
+ }
+ m_slope[fsort] = std::min( std::max( -10.0 , m_slope[fsort] ), -1.5);
+ }
+
+ // If we need to adjust the lambdas, do so
+ if ( std::abs(current_quality - target_quality)> 0.2 )
+ {
+ // Update the lambdas as appropriate
+ float quality_diff = m_target_quality[fsort] - current_quality;
+
+ CalcNewLambdas(fsort , std::min( m_slope[fsort] , -1.0 ), quality_diff );
+ }
+
+ // if we have a large difference in quality, recode)
+ if ( std::abs( current_quality - target_quality )>1.5 )
+ recode = true;
+
+ return recode;
+}
+
+void QualityMonitor::CalcNewLambdas(const FrameSort fsort, const double slope, const double quality_diff )
+{
+ const double clipped_quality_ratio = std::min( 2.0 , std::max( quality_diff/slope , -2.0 ) );
+
+ if ( m_encparams.Lambda(fsort) > 100001.0 && clipped_quality_ratio > 0.0 )
+ m_encparams.SetLambda(fsort, 100000.0);
+ else
+ m_encparams.SetLambda(fsort, m_encparams.Lambda(fsort) *
+ std::pow( (double)10.0, clipped_quality_ratio ) );
+
+ if (fsort == L1_frame)
+ m_encparams.SetL1MELambda( std::sqrt(m_encparams.L1Lambda()) * m_me_ratio );
+ else if (fsort == L2_frame)
+ m_encparams.SetL2MELambda( std::sqrt(m_encparams.L2Lambda()) * m_me_ratio );
+
+}
+
+double QualityMonitor::QualityVal(const PicArray& coded_data, const PicArray& orig_data , double cpd , const FrameSort fsort)
+{
+
+ // The number of regions to look at in assessing quality
+ int xregions( 4 );
+ int yregions( 3 );
+
+ if ( fsort == I_frame )
+ {
+ xregions = 1;
+ yregions = 1;
+ }
+
+ TwoDArray<long double> diff_array( yregions , xregions);
+ long double diff;
+
+ OneDArray<int> xstart( diff_array.LengthX() );
+ OneDArray<int> xend( diff_array.LengthX() );
+ OneDArray<int> ystart( diff_array.LengthY() );
+ OneDArray<int> yend( diff_array.LengthX() );
+
+ for ( int i=0 ; i<xstart.Length() ; ++i)
+ {
+ xstart[i] =( i * m_true_xl )/xstart.Length();
+ xend[i] = ( (i+1) * m_true_xl )/xstart.Length();
+ }
+
+ for ( int i=0 ; i<ystart.Length() ; ++i)
+ {
+ ystart[i] =( i * m_true_yl )/ystart.Length();
+ yend[i] = ( (i+1) * m_true_yl )/ystart.Length();
+ }
+
+ for ( int q=0 ; q<diff_array.LengthY() ; ++q )
+ {
+ for ( int p=0 ; p<diff_array.LengthX() ; ++p )
+ {
+ diff_array[q][p] = 0.0;
+
+ for (int j=ystart[q]; j<yend[q]; ++j)
+ {
+ for (int i=xstart[p]; i<xend[p]; ++i)
+ {
+ diff = static_cast<long double> ( coded_data[j][i] - orig_data[j][i] );
+
+ diff *= diff;
+ diff *= diff;
+
+ diff_array[q][p] += diff;
+ }//i
+ }//j
+
+ diff_array[q][p] /= ( xend[p]-xstart[p] ) * ( yend[q]-ystart[q] );
+ diff_array[q][p] = std::sqrt( diff_array[q][p] );
+
+ // now compensate for the fact that we've got two extra bits
+ diff_array[q][p] /= 16.0;
+
+ }// p
+ }// q
+
+ // return the worst area
+ long double worst_diff = diff_array[0][0];
+ for ( int q=0 ; q<diff_array.LengthY() ; ++q )
+ {
+ for ( int p=0 ; p<diff_array.LengthX() ; ++p )
+ {
+ if ( diff_array[q][p] > worst_diff )
+ worst_diff = diff_array[q][p];
+ }// p
+ }// q
+
+ return static_cast<double> ( 10.0 * std::log10( 255.0*255.0 / worst_diff ) );
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/quality_monitor.h b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/quality_monitor.h
new file mode 100644
index 000000000..2e2b1ecbe
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/quality_monitor.h
@@ -0,0 +1,133 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: quality_monitor.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _QUALITY_MONITOR_H_
+#define _QUALITY_MONITOR_H_
+
+#include <libdirac_common/common.h>
+#include <libdirac_common/frame.h>
+#include <libdirac_common/wavelet_utils.h>
+namespace dirac
+{
+
+ //! Class to monitor the quality of pictures and adjust coding parameters appropriately
+ class QualityMonitor
+ {
+ public:
+
+ //! Constructor. Sets up initial Lagrangian values
+ /*
+ Constructor sets up initial Lagrangian values.
+ */
+ QualityMonitor(EncoderParams& ep,
+ const SeqParams& sparams );
+
+ ////////////////////////////////////////////////////////////
+ // //
+ // Assumes default copy constructor, assignment = //
+ // and destructor //
+ ////////////////////////////////////////////////////////////
+
+ //! Update the quality factors, returning true if we need to recode
+ /*!
+ Update the quality factors, returning true if we need to recode
+ \param ld_frame the locally-decoded frame
+ \param orig_frame the original frame
+ \param count the number of times we've tried to code this frame before
+ */
+ bool UpdateModel(const Frame& ld_frame, const Frame& orig_frame ,const int count);
+
+ //! Reset the quality factors (say if there's been a cut)
+ void ResetAll();
+
+ private:
+ //functions
+
+ //! Use the model parameters to calculate the resulting Lagrangian parameters
+ void CalcNewLambdas(const FrameSort fsort, const double slope, const double offset);
+
+ //! Calculate the quality of coded wrt original picture
+ double QualityVal( const PicArray& coded_data ,
+ const PicArray& orig_data ,
+ double cpd ,
+ const FrameSort fsort );
+
+ //member variables//
+ ////////////////////
+
+ //! A reference to the encoder parameters
+ EncoderParams& m_encparams;
+
+ //! The chroma format
+ const ChromaFormat m_cformat;
+
+ //! The true picture width, minus padding
+ const int m_true_xl;
+
+ //! The true picture height, minus padding
+ const int m_true_yl;
+
+ // target quality values for each frame type
+ OneDArray<double> m_target_quality;
+
+ // weighted PSNR values for last of each frame type
+ OneDArray<double> m_last_quality;
+
+ /* Default Model parameters for quality wrt to log10(lambda)
+ Model is :
+ quality = offset + slope * log10( lambda )
+ for each lambda parameter type.
+ Default parameters will be used if it's not possible to measure
+ them, and updated using measured data
+ */
+ OneDArray<double> m_slope;
+ OneDArray<double> m_offset;
+
+ //! Lagrangian parameters for the last I, L1 and L2 frames
+ OneDArray<double> m_last_lambda;
+
+ //! The Lagrangian ME parameters
+ double m_L1_me_lambda, m_L2_me_lambda;
+
+ //! The ratio of Lagrangian ME parameters to frame motion estimation parameters
+ double m_me_ratio;
+
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/seq_compress.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/seq_compress.cpp
new file mode 100644
index 000000000..e04d5d6e2
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/seq_compress.cpp
@@ -0,0 +1,442 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: seq_compress.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd,
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#include <libdirac_encoder/seq_compress.h>
+#include <libdirac_common/dirac_assertions.h>
+#include <libdirac_common/golomb.h>
+using namespace dirac;
+
+SequenceCompressor::SequenceCompressor( StreamPicInput* pin ,
+ std::ostream* outfile ,
+ EncoderParams& encp
+ ):
+ m_all_done(false),
+ m_just_finished(true),
+ m_encparams(encp),
+ m_pic_in(pin),
+ m_current_display_fnum(-1),
+ m_current_code_fnum(0),
+ m_show_fnum(-1),m_last_frame_read(-1),
+ m_delay(1),
+ m_qmonitor( m_encparams , m_pic_in->GetSeqParams() ),
+ m_fcoder( m_encparams )
+{
+ // Set up the compression of the sequence
+
+ const SeqParams& sparams=m_pic_in->GetSeqParams();
+
+ //TBD: put into the constructor for EncoderParams
+ m_encparams.SetEntropyFactors( new EntropyCorrector(4) );
+ m_encparams.SetBitsOut( new SequenceOutputManager( outfile ) );
+ WriteStreamHeader();
+
+ //We have to set up the block parameters and file padding. This needs to take into
+ //account both blocks for motion compensation and also wavelet transforms
+
+ //Amount of horizontal padding for Y,U and V components
+ int xpad_luma,xpad_chroma;
+
+ //Amount of vertical padding for Y,U and V components
+ int ypad_luma,ypad_chroma;
+
+ //scaling factors for chroma based on chroma format
+ int x_chroma_fac,y_chroma_fac;
+
+ //First, we need to have sufficient padding to take account of the blocksizes.
+ //It's sufficient to check for chroma
+
+
+ if (sparams.CFormat() == format411)
+ {
+ x_chroma_fac = 4;
+ y_chroma_fac = 1;
+ }
+ else if (sparams.CFormat()==format420)
+ {
+ x_chroma_fac = 2;
+ y_chroma_fac = 2;
+ }
+ else if (sparams.CFormat() == format422)
+ {
+ x_chroma_fac = 2;
+ y_chroma_fac = 1;
+ }
+ else
+ {
+ x_chroma_fac = 1;
+ y_chroma_fac = 1;
+ }
+
+ int xl_chroma = sparams.Xl() / x_chroma_fac;
+ int yl_chroma = sparams.Yl() / y_chroma_fac;
+
+ // Make sure we have enough macroblocks to cover the pictures
+ m_encparams.SetXNumMB( xl_chroma/m_encparams.ChromaBParams(0).Xbsep() );
+ m_encparams.SetYNumMB( yl_chroma/m_encparams.ChromaBParams(0).Ybsep() );
+ if ( m_encparams.XNumMB() * m_encparams.ChromaBParams(0).Xbsep() < xl_chroma )
+ {
+ m_encparams.SetXNumMB( m_encparams.XNumMB() + 1 );
+ xpad_chroma = m_encparams.XNumMB()*m_encparams.ChromaBParams(0).Xbsep()-xl_chroma;
+ }
+ else
+ xpad_chroma = 0;
+
+ if ( m_encparams.YNumMB() * m_encparams.ChromaBParams(0).Ybsep() < yl_chroma )
+ {
+ m_encparams.SetYNumMB( m_encparams.YNumMB() + 1 );
+ ypad_chroma = m_encparams.YNumMB() * m_encparams.ChromaBParams(0).Ybsep() - yl_chroma;
+ }
+ else
+ ypad_chroma = 0;
+
+ // Now we have an integral number of macroblocks in a picture and we set the number of blocks
+ m_encparams.SetXNumBlocks( 4 * m_encparams.XNumMB() );
+ m_encparams.SetYNumBlocks( 4 * m_encparams.YNumMB() );
+
+ // Next we work out the additional padding due to the wavelet transform
+ // For the moment, we'll fix the transform depth to be 4, so we need divisibility by 16.
+ // In the future we'll want arbitrary transform depths. It's sufficient to check for
+ // chroma only
+
+ int xpad_len = xl_chroma+xpad_chroma;
+ int ypad_len = yl_chroma+ypad_chroma;
+ if ( xpad_len%16 != 0 )
+ xpad_chroma = ( (xpad_len/16)+1 ) *16 - xl_chroma;
+ if ( ypad_len%16 != 0 )
+ ypad_chroma = ( (ypad_len/16)+1 ) * 16 - yl_chroma;
+
+ xpad_luma = xpad_chroma * x_chroma_fac;
+ ypad_luma = ypad_chroma * y_chroma_fac;
+
+
+ //Set the resulting padding values
+ m_pic_in->SetPadding(xpad_luma,ypad_luma);
+
+ // Set up the frame buffers with the PADDED picture sizes
+ m_fbuffer = new FrameBuffer( sparams.CFormat() , m_encparams.NumL1() , m_encparams.L1Sep() ,
+ sparams.Xl() + xpad_luma , sparams.Yl() + ypad_luma );
+
+ m_origbuffer = new FrameBuffer( sparams.CFormat() , m_encparams.NumL1() , m_encparams.L1Sep() ,
+ sparams.Xl() + xpad_luma , sparams.Yl() + ypad_luma );
+}
+
+SequenceCompressor::~SequenceCompressor()
+{
+
+ if ( m_encparams.Verbose())
+ MakeSequenceReport();
+
+ //TBD: put into the destructor for EncoderParams
+ delete &m_encparams.BitsOut();
+ delete &m_encparams.EntropyFactors();
+
+ delete m_fbuffer;
+ delete m_origbuffer;
+}
+
+bool SequenceCompressor::LoadNextFrame()
+{
+ m_fbuffer->PushFrame( m_pic_in , m_last_frame_read+1 );
+
+ if ( m_pic_in->End() )
+ {
+ m_all_done = true;
+ return false;
+ }
+ m_last_frame_read++;
+ m_origbuffer->PushFrame( m_fbuffer->GetFrame( m_last_frame_read ) );
+ return true;
+}
+
+Frame& SequenceCompressor::CompressNextFrame()
+{
+
+ // This function codes the next frame in coding order and returns the next frame in display order
+ // In general these will differ, and because of re-ordering there is a m_delay which needs to be imposed.
+ // This creates problems at the start and at the end of the sequence which must be dealt with.
+ // At the start we just keep outputting frame 0. At the end you will need to loop for longer to get all
+ // the frames out. It's up to the calling function to do something with the decoded frames as they
+ // come out - write them to screen or to file, or whatever. TJD 13Feb04.
+
+ // current_fnum is the number of the current frame being coded in display order
+ // m_current_code_fnum is the number of the current frame in coding order. This function increments
+ // m_current_code_fnum by 1 each time and works out what the number is in display order.
+ // m_show_fnum is the index of the frame number that can be shown when current_fnum has been coded.
+ // Var m_delay is the m_delay caused by reordering (as distinct from buffering)
+
+ TESTM (m_last_frame_read >= 0, "Data loaded before calling CompressNextFrame");
+ m_current_display_fnum = CodedToDisplay( m_current_code_fnum );
+
+ // If we're not at the beginning, clean the buffer
+ if ( m_current_code_fnum != 0 )
+ {
+ m_fbuffer->Clean( m_show_fnum );
+ m_origbuffer->Clean( m_show_fnum );
+ }
+
+ m_show_fnum = std::max( m_current_code_fnum - m_delay , 0 );
+
+ bool can_encode = false;
+
+ if (m_last_frame_read >= m_current_display_fnum )
+ can_encode = true;
+
+ if ( can_encode )
+ { // We haven't coded everything, so compress the next frame
+
+ // True if we need to recode
+ bool recode = false;
+
+ if ( m_encparams.Verbose() )
+ {
+ std::cerr<<std::endl<<std::endl<<"Compressing frame "<<m_current_code_fnum<<", ";
+ std::cerr<<m_current_display_fnum<<" in display order";
+ }
+
+ // A count of how many times we've recoded
+ int count = 0;
+ int max_count = 3;
+
+
+ do
+ {
+
+ // Compress the frame//
+ ///////////////////////
+
+ m_fcoder.Compress( *m_fbuffer , *m_origbuffer , m_current_display_fnum );
+
+ // Adjust the Lagrangian parameters and check if we need to re-do the frame
+ recode = m_qmonitor.UpdateModel( m_fbuffer->GetFrame( m_current_display_fnum ) ,
+ m_origbuffer->GetFrame( m_current_display_fnum ) , count );
+
+ ++count;
+
+ if ( recode && count<max_count )
+ {
+ if ( m_encparams.Verbose() )
+ std::cerr<<std::endl<<"Recoding!";
+
+ // Copy the original data back in
+ m_fbuffer->GetFrame( m_current_display_fnum ) = m_origbuffer->GetFrame( m_current_display_fnum );
+
+ // Reset the output
+ m_encparams.BitsOut().ResetFrame();
+ }
+
+ }
+ while ( recode && count <max_count );
+
+ // Finish by writing the compressed data out to file ...
+ m_encparams.BitsOut().WriteFrameData();
+
+ if ( m_encparams.Verbose() )
+ {
+ MakeFrameReport();
+ }
+
+ // Increment our position
+ m_current_code_fnum++;
+
+ }
+
+ // Return the latest frame that can be shown
+ return m_fbuffer->GetFrame(m_show_fnum);
+}
+
+const Frame *SequenceCompressor::GetFrameEncoded()
+{
+ if (m_current_display_fnum >= 0)
+ return &m_fbuffer->GetFrame( m_current_display_fnum );
+
+ return 0;
+}
+
+const MEData *SequenceCompressor::GetMEData()
+{
+ if ( m_fcoder.IsMEDataAvail())
+ return m_fcoder.GetMEData();
+
+ return 0;
+}
+void SequenceCompressor::EndSequence()
+{
+ if (m_just_finished)
+ {
+ //Write end of sequence
+ unsigned char seq_end[5] = { START_CODE_PREFIX_BYTE0,
+ START_CODE_PREFIX_BYTE1,
+ START_CODE_PREFIX_BYTE2,
+ START_CODE_PREFIX_BYTE3,
+ SEQ_END_CODE };
+ m_encparams.BitsOut().TrailerOutput().OutputBytes((char *)seq_end, 5);
+ m_encparams.BitsOut().WriteSeqTrailerToFile();
+ m_just_finished = false;
+ m_all_done = true;
+ }
+}
+
+
+
+void SequenceCompressor::MakeSequenceReport()
+{
+
+ std::cerr<<"Total bits for sequence="<<m_encparams.BitsOut().SequenceBytes() * 8;
+ std::cerr<<" ( "<<m_encparams.BitsOut().SequenceHeadBytes() * 8<<" header )";
+
+ std::cerr<<std::endl<<"Of these: "<<std::endl<<std::endl;
+ std::cerr<<m_encparams.BitsOut().ComponentBytes( Y_COMP ) * 8<<" were Y, ";
+ std::cerr<<std::endl<<m_encparams.BitsOut().ComponentBytes( U_COMP ) * 8<<" were U, ";
+ std::cerr<<std::endl<<m_encparams.BitsOut().ComponentBytes( V_COMP ) * 8<<" were V, and ";
+ std::cerr<<std::endl<<m_encparams.BitsOut().MVBytes() * 8<<" were motion vector data.";
+
+ std::cerr<<std::endl<<std::endl<<"The resulting bit-rate at "<<m_pic_in->GetSeqParams().FrameRate()<<"Hz is ";
+
+ std::cerr<<m_encparams.BitsOut().SequenceBytes() * 8 * ( m_pic_in->GetSeqParams().FrameRate() )
+ / m_current_code_fnum <<" bits/sec.";
+ std::cerr<<std::endl;
+
+}
+
+void SequenceCompressor::MakeFrameReport()
+{
+ // Write out to screen a report of the number of bits written
+ const FrameOutputManager& foutput = m_encparams.BitsOut().FrameOutput();
+
+ unsigned int unit_bits = foutput.MVBytes() * 8;
+ unsigned int unit_head_bits = foutput.MVHeadBytes() * 8;
+
+ std::cerr<<std::endl<<"Number of MV bits="<<unit_bits;
+ std::cerr<<" ( "<<unit_head_bits<<" header bits)";
+
+ unit_bits = foutput.ComponentBytes( Y_COMP ) * 8;
+ unit_head_bits = foutput.ComponentHeadBytes( Y_COMP ) * 8;
+
+ std::cerr<<std::endl<<"Number of bits for Y="<<unit_bits;
+ std::cerr<<" ( "<<unit_head_bits<<" header bits)";
+
+ unit_bits = foutput.ComponentBytes( U_COMP ) * 8;
+ unit_head_bits = foutput.ComponentHeadBytes( U_COMP ) * 8;
+
+ std::cerr<<std::endl<<"Number of bits for U="<<unit_bits;
+ std::cerr<<" ( "<<unit_head_bits<<" header bits)";
+
+ unit_bits = foutput.ComponentBytes( V_COMP ) * 8;
+ unit_head_bits = foutput.ComponentHeadBytes( V_COMP ) * 8;
+
+ std::cerr<<std::endl<<"Number of bits for V="<<unit_bits;
+ std::cerr<<" ( "<<unit_head_bits<<" header bits)";
+
+ unit_bits = foutput.FrameBytes() * 8;
+ unit_head_bits = foutput.FrameHeadBytes() * 8;
+
+ std::cerr<<std::endl<<std::endl<<"Total frame bits="<<unit_bits;
+ std::cerr<<" ( "<<unit_head_bits<<" header bits)"<<std::endl<<std::endl;
+
+}
+
+
+void SequenceCompressor::WriteStreamHeader()
+{
+ // Write out all the header data
+ BasicOutputManager& stream_header = m_encparams.BitsOut().HeaderOutput();
+
+ // Begin with the ID of the codec
+ stream_header.OutputBytes("KW-DIRAC");
+
+ unsigned char seq_start[5] = { START_CODE_PREFIX_BYTE0,
+ START_CODE_PREFIX_BYTE1,
+ START_CODE_PREFIX_BYTE2,
+ START_CODE_PREFIX_BYTE3,
+ RAP_START_CODE };
+
+ stream_header.OutputBytes((char *)seq_start, 5);
+
+ // bit stream version
+ stream_header.OutputByte((char)BITSTREAM_VERSION);
+
+ // Picture dimensions
+ UnsignedGolombCode( stream_header ,(unsigned int) m_pic_in->GetSeqParams().Xl() );
+ UnsignedGolombCode( stream_header ,(unsigned int) m_pic_in->GetSeqParams().Yl() );
+
+ // Picture rate
+ UnsignedGolombCode( stream_header , (unsigned int) m_pic_in->GetSeqParams().FrameRate());
+
+ // Block parameters
+ UnsignedGolombCode( stream_header ,(unsigned int) m_encparams.LumaBParams(2).Xblen() );
+ UnsignedGolombCode( stream_header ,(unsigned int) m_encparams.LumaBParams(2).Yblen() );
+ UnsignedGolombCode( stream_header ,(unsigned int) m_encparams.LumaBParams(2).Xbsep() );
+ UnsignedGolombCode( stream_header ,(unsigned int) m_encparams.LumaBParams(2).Ybsep() );
+
+ // Also send the number of blocks horizontally and vertically
+ UnsignedGolombCode( stream_header ,(unsigned int) m_encparams.XNumBlocks() );
+ UnsignedGolombCode( stream_header ,(unsigned int) m_encparams.YNumBlocks() );
+
+ // Chroma format
+ UnsignedGolombCode( stream_header ,(unsigned int) m_pic_in->GetSeqParams().CFormat() );
+
+ // Interlace marker
+ stream_header.OutputBit(m_pic_in->GetSeqParams().Interlace() );
+
+ m_encparams.BitsOut().WriteSeqHeaderToFile();
+}
+
+int SequenceCompressor::CodedToDisplay( const int fnum )
+{
+ int div;
+
+ if (m_encparams.L1Sep()>0)
+ {
+ // We have L1 and L2 frames
+ if (fnum==0)
+ return 0;
+ else if ((fnum-1)% m_encparams.L1Sep()==0)
+ {//we have L1 or subsequent I frames
+ div=(fnum-1)/m_encparams.L1Sep();
+ return fnum+m_encparams.L1Sep()-1;
+ }
+ else//we have L2 frames
+ return fnum-1;
+ }
+ else
+ {//we just have I-frames, so no re-ordering
+ return fnum;
+ }
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/seq_compress.h b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/seq_compress.h
new file mode 100644
index 000000000..362edcc5c
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_encoder/seq_compress.h
@@ -0,0 +1,219 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: seq_compress.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author),
+* Scott R Ladd,
+* Anuradha Suraparaju
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _SEQ_COMPRESS_H_
+#define _SEQ_COMPRESS_H_
+
+/////////////////////////////////////////
+//-------------------------------------//
+//Class to manage compressing sequences//
+//-------------------------------------//
+/////////////////////////////////////////
+
+#include <libdirac_common/common.h>
+#include <libdirac_common/frame_buffer.h>
+#include <libdirac_common/pic_io.h>
+#include <libdirac_encoder/quality_monitor.h>
+#include <libdirac_encoder/frame_compress.h>
+#include <fstream>
+
+namespace dirac
+{
+ //! Compresses a sequence of frames from a stream.
+ /*!
+ This class compresses a sequence of frames, frame by frame. It
+ currently uses GOP parameters set in the encoder parameters in order
+ to define the temporal prediction structure. A version to incorporate
+ non-GOP structures is TBC.
+ */
+ class SequenceCompressor{
+ public:
+ //! Constructor
+ /*!
+ Creates a sequence compressor, and prepares to begin compressing
+ with the first frame.Sets up frame padding in the picture input if
+ necesary
+ \param pin an input stream containing a sequence of frames
+ \param outfile an output stream for the compressed output
+ \param encp parameters for the encoding process
+ */
+ SequenceCompressor(StreamPicInput* pin, std::ostream* outfile, EncoderParams& encp);
+
+ //! Destructor
+ /*!
+ Destructor. Must delete IO objects created by constructor.
+ */
+ ~SequenceCompressor();
+
+ //! Load data
+ /*!
+ Load one frame of data into the Sequence Compressor. Sets
+ m_all_done to true if no more data is available to be loaded.
+ \return true - if frame load succeeded.
+ false - otherwise
+ */
+ bool LoadNextFrame();
+
+ //! Compress the next frame in sequence
+ /*!
+ This function codes the next frame in coding order and returns the
+ next frame in display order. In general these will differ, and
+ because of re-ordering there is a delay which needs to be imposed.
+ This creates problems at the start and at the end of the sequence
+ which must be dealt with. At the start we just keep outputting
+ frame 0. At the end you will need to loop for longer to get all
+ the frames out. It's up to the calling function to do something
+ with the decoded frames as they come out -- write them to screen
+ or to file, for example. .
+ If coding is fast enough the compressed version could be watched
+ real-time (with suitable buffering in the calling function to
+ account for encode-time variations).
+
+ NOTE: LoadNextFrame must be called atleast once before invoking this
+ method.
+
+ \return reference to the next locally decoded frame available for display
+ */
+ Frame &CompressNextFrame();
+
+ //! Return a pointer to the most recent frame encoded
+ const Frame *GetFrameEncoded();
+
+ //! Return Motion estimation info related to the most recent frame encoded
+ const MEData *GetMEData();
+
+ void EndSequence();
+
+ //! Determine if compression is complete.
+ /*!
+ Indicates whether or not the last frame in the sequence has been
+ compressed.
+ \return true if last frame has been compressed; false if not
+ */
+ bool Finished(){return m_all_done;}
+
+
+ private:
+ //! Copy constructor is private and body-less
+ /*!
+ Copy constructor is private and body-less. This class should not
+ be copied.
+ */
+ SequenceCompressor(const SequenceCompressor& cpy);
+
+ //! Assignment = is private and body-less
+ /*!
+ Assignment = is private and body-less. This class should not be
+ assigned..
+ */
+ SequenceCompressor& operator=(const SequenceCompressor& rhs);
+
+ //! Writes the sequence header data to the bitstream.
+ /*!
+ This contains all the block information used for motion
+ compensation. However, temporal prediction structures are defined
+ via the frame headers, and so a simple GOP need not be used or, if
+ so, can be altered on the fly.
+ */
+ void WriteStreamHeader();
+
+ //! Uses the GOP parameters to convert frame numbers in coded order to display order.
+ /*!
+ Uses the GOP parameters to convert frame numbers in coded order
+ to display order
+ \param fnum the frame number in coded order
+ */
+ int CodedToDisplay(const int fnum);
+
+ //! Make a report to screen on the coding results for the whole sequence
+ void MakeSequenceReport();
+
+ //! Make a report to screen on the coding results for a single frame
+ void MakeFrameReport();
+
+ //! Completion flag, returned via the Finished method.
+ bool m_all_done;
+
+ //! Flag indicating whether we've just finished.
+ /*!
+ Flag which is false if we've been all-done for more than one
+ frame, true otherwise (so that we can take actions on finishing
+ once only).
+ */
+ bool m_just_finished;
+
+ //! The parameters used for encoding.
+ EncoderParams& m_encparams;
+
+ //! Pointer pointing at the picture input.
+ StreamPicInput* m_pic_in;
+
+ //! A picture buffer used for local storage of frames whilst pending re-ordering or being used for reference.
+ FrameBuffer* m_fbuffer;
+
+ //! A picture buffer of original frames
+ FrameBuffer* m_origbuffer;
+
+ //state variables for CompressNextFrame
+
+ //! The number of the current frame to be coded, in display order
+ int m_current_display_fnum;
+
+ //! The number of the current frame to be coded, in coded order
+ int m_current_code_fnum;
+
+ //! The number of the frame which should be output for concurrent display or storage
+ int m_show_fnum;
+
+ //! The index, in display order, of the last frame read
+ int m_last_frame_read;
+
+ //! A delay so that we don't display what we haven't coded
+ int m_delay;
+
+ //! A class for monitoring the quality of pictures and adjusting parameters appropriately
+ QualityMonitor m_qmonitor;
+
+ //! A class to hold the frame compressor object
+ FrameCompressor m_fcoder;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/Makefile.am b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/Makefile.am
new file mode 100644
index 000000000..783f9c451
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/Makefile.am
@@ -0,0 +1,27 @@
+# $Id: Makefile.am 280 2005-01-30 05:11:46Z gabest $
+#
+
+INCLUDES = -I$(top_srcdir) -I$(srcdir)
+
+h_sources = block_match.h downconvert.h me_mode_decn.h me_subpel.h me_utils.h motion_estimate.h pixel_match.h
+
+cpp_sources = block_match.cpp downconvert.cpp me_mode_decn.cpp me_subpel.cpp me_utils.cpp motion_estimate.cpp pixel_match.cpp
+
+if USE_MSVC
+noinst_LIBRARIES = libdirac_motionest.a
+libdirac_motionest_a_AR = link.exe -lib /out:libdirac_motionest.a $(libdirac_motionest_a_OBJECTS) ; echo
+else
+libdirac_motionest_a_AR = ar crv
+noinst_LTLIBRARIES = libdirac_motionest.la
+endif
+
+libdirac_motionest_a_SOURCES = $(h_sources) $(cpp_sources)
+
+libdirac_motionest_la_SOURCES = $(h_sources) $(cpp_sources)
+libdirac_motionest_la_CXXFLAGS = $(AM_CXXFLAGS)
+
+
+if USE_MSVC
+CLEANFILES = *.pdb *.ilk
+endif
+
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/Makefile.in b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/Makefile.in
new file mode 100644
index 000000000..10c27ef3b
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/Makefile.in
@@ -0,0 +1,484 @@
+# Makefile.in generated by automake 1.8.3 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+SOURCES = $(libdirac_motionest_a_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = libdirac_motionest
+DIST_COMMON = $(library_include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(mkdir_p)
+CONFIG_CLEAN_FILES =
+AR = ar
+ARFLAGS = cru
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+libdirac_motionest_a_LIBADD =
+am__objects_1 =
+am__objects_2 = block_match.$(OBJEXT) downconvert.$(OBJEXT) \
+ me_mode_decn.$(OBJEXT) me_subpel.$(OBJEXT) me_utils.$(OBJEXT) \
+ motion_estimate.$(OBJEXT) pixel_match.$(OBJEXT)
+am_libdirac_motionest_a_OBJECTS = $(am__objects_1) $(am__objects_2)
+libdirac_motionest_a_OBJECTS = $(am_libdirac_motionest_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/block_match.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/downconvert.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/me_mode_decn.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/me_subpel.Po ./$(DEPDIR)/me_utils.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/motion_estimate.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/pixel_match.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libdirac_motionest_a_SOURCES)
+DIST_SOURCES = $(libdirac_motionest_a_SOURCES)
+library_includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(library_include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOM4TE = @AUTOM4TE@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GENERIC_LIBRARY_NAME = @GENERIC_LIBRARY_NAME@
+GENERIC_LIBRARY_VERSION = @GENERIC_LIBRARY_VERSION@
+GENERIC_RELEASE = @GENERIC_RELEASE@
+GENERIC_VERSION = @GENERIC_VERSION@
+HAVE_ALGO_FALSE = @HAVE_ALGO_FALSE@
+HAVE_ALGO_TRUE = @HAVE_ALGO_TRUE@
+HAVE_CPPUNIT_FALSE = @HAVE_CPPUNIT_FALSE@
+HAVE_CPPUNIT_TRUE = @HAVE_CPPUNIT_TRUE@
+HAVE_DOT = @HAVE_DOT@
+HAVE_DOT_FALSE = @HAVE_DOT_FALSE@
+HAVE_DOT_TRUE = @HAVE_DOT_TRUE@
+HAVE_DOXYGEN = @HAVE_DOXYGEN@
+HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
+HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
+HAVE_DVIPDFM = @HAVE_DVIPDFM@
+HAVE_DVIPDFM_FALSE = @HAVE_DVIPDFM_FALSE@
+HAVE_DVIPDFM_TRUE = @HAVE_DVIPDFM_TRUE@
+HAVE_LATEX = @HAVE_LATEX@
+HAVE_LATEX_FALSE = @HAVE_LATEX_FALSE@
+HAVE_LATEX_TRUE = @HAVE_LATEX_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OVERLAY_FALSE = @OVERLAY_FALSE@
+OVERLAY_TRUE = @OVERLAY_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_MSVC_FALSE = @USE_MSVC_FALSE@
+USE_MSVC_TRUE = @USE_MSVC_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I$(top_srcdir) -I$(srcdir)
+h_sources = block_match.h downconvert.h me_mode_decn.h me_subpel.h me_utils.h motion_estimate.h pixel_match.h
+cpp_sources = block_match.cpp downconvert.cpp me_mode_decn.cpp me_subpel.cpp me_utils.cpp motion_estimate.cpp pixel_match.cpp
+lib_LIBRARIES = libdirac_motionest.a
+libdirac_motionest_a_SOURCES = $(h_sources) $(cpp_sources)
+library_includedir = $(includedir)/$(GENERIC_LIBRARY_NAME)/libdirac_motionest
+library_include_HEADERS = $(h_sources)
+@USE_MSVC_TRUE@CLEANFILES = *.pdb *.ilk
+@USE_MSVC_FALSE@libdirac_motionest_a_AR = ar crv
+@USE_MSVC_TRUE@libdirac_motionest_a_AR = link.exe -lib /out:libdirac_motionest.a $(libdirac_motionest_a_OBJECTS) ; echo
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libdirac_motionest/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign libdirac_motionest/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLIBRARIES: $(lib_LIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+ @$(POST_INSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+ $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+ else :; fi; \
+ done
+
+uninstall-libLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLIBRARIES:
+ -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+libdirac_motionest.a: $(libdirac_motionest_a_OBJECTS) $(libdirac_motionest_a_DEPENDENCIES)
+ -rm -f libdirac_motionest.a
+ $(libdirac_motionest_a_AR) libdirac_motionest.a $(libdirac_motionest_a_OBJECTS) $(libdirac_motionest_a_LIBADD)
+ $(RANLIB) libdirac_motionest.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/block_match.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/downconvert.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/me_mode_decn.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/me_subpel.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/me_utils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/motion_estimate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixel_match.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+uninstall-info-am:
+install-library_includeHEADERS: $(library_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(library_includedir)" || $(mkdir_p) "$(DESTDIR)$(library_includedir)"
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(library_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(library_includedir)/$$f'"; \
+ $(library_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+uninstall-library_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(library_include_HEADERS)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(library_includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(library_includedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-library_includeHEADERS
+
+install-exec-am: install-libLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLIBRARIES \
+ uninstall-library_includeHEADERS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-libLIBRARIES \
+ install-library_includeHEADERS install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am uninstall-libLIBRARIES \
+ uninstall-library_includeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/block_match.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/block_match.cpp
new file mode 100644
index 000000000..6847a1685
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/block_match.cpp
@@ -0,0 +1,472 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: block_match.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_motionest/block_match.h>
+#include <libdirac_motionest/me_utils.h>
+using namespace dirac;
+
+#include <cmath>
+using std::vector;
+
+namespace dirac
+{
+
+ValueType GetVar( const MVector& predmv , const MVector& mv )
+{
+ MVector diff;
+ diff.x = mv.x-predmv.x;
+ diff.y = mv.y-predmv.y;
+
+ return std::max( Norm1( diff ) , 48 );
+}
+
+ValueType GetVar( const std::vector<MVector>& pred_list , const MVector& mv)
+{
+ ValueType sum=0;
+ MVector diff;
+ for (size_t i=0 ; i<pred_list.size() ; ++i)
+ {
+ diff.x = mv.x - pred_list[i].x;
+ diff.y = mv.y - pred_list[i].y;
+ sum += Norm1( diff );
+ }
+
+ return sum;
+}
+
+void AddNewVlist( CandidateList& vect_list, const MVector& mv, const int xr , const int yr , const int step )
+{
+ //Creates a new motion vector list in a square region around mv
+
+ vector<MVector> tmp_list;
+ vect_list.push_back(tmp_list);
+ int list_num=vect_list.size()-1;
+
+ MVector tmp_mv( mv );
+ AddVect(vect_list , tmp_mv , list_num );
+
+ for ( int i=1 ; i<=xr ; ++i )
+ {
+ tmp_mv.x = mv.x + i*step;
+ AddVect( vect_list , tmp_mv , list_num );
+
+ tmp_mv.x = mv.x - i*step;
+ AddVect( vect_list , tmp_mv , list_num );
+ }
+
+ for ( int j=1 ; j<=yr ; ++j)
+ {
+ for ( int i=-xr ; i<=xr ; ++i)
+ {
+ tmp_mv.x = mv.x + i*step;
+ tmp_mv.y = mv.y + j*step;
+ AddVect(vect_list,tmp_mv,list_num);
+
+ tmp_mv.y = mv.y -j*step;
+ AddVect(vect_list,tmp_mv,list_num);
+
+ }// i
+ }// j
+
+ // If we've not managed to add any element to the list
+ // remove the list so we don't ever have to check its size
+ if ( vect_list[list_num].size() == 0 )
+ vect_list.erase( vect_list.begin() + list_num );
+}
+
+void AddNewVlist( CandidateList& vect_list , const MVector& mv , const int xr , const int yr)
+{
+ // Creates a new motion vector list in a square region around mv
+
+ vector<MVector> tmp_list;
+ vect_list.push_back(tmp_list);
+ int list_num=vect_list.size()-1;
+
+ MVector tmp_mv(mv);
+ AddVect(vect_list,tmp_mv,list_num);
+
+ for ( int i=1 ; i<=xr ; ++i)
+ {
+ tmp_mv.x = mv.x + i;
+ AddVect( vect_list , tmp_mv , list_num );
+
+ tmp_mv.x = mv.x - i;
+ AddVect( vect_list , tmp_mv , list_num );
+ }
+
+ for ( int j=1 ; j<=yr ; ++j)
+ {
+ for ( int i=-xr ; i<=xr ; ++i)
+ {
+ tmp_mv.x = mv.x + i;
+ tmp_mv.y = mv.y + j;
+ AddVect( vect_list , tmp_mv , list_num );
+
+ tmp_mv.y = mv.y-j;
+ AddVect( vect_list , tmp_mv , list_num );
+ }
+ }
+
+ // If we've not managed to add any element to the list
+ // remove the list so we don't ever have to check its size
+ if ( vect_list[list_num].size() == 0 )
+ vect_list.erase( vect_list.begin() + list_num );
+}
+
+void AddNewVlistD( CandidateList& vect_list , const MVector& mv , const int xr , const int yr )
+{
+ //As above, but using a diamond pattern
+
+ vector<MVector> tmp_list;
+ vect_list.push_back( tmp_list );
+
+ int list_num=vect_list.size()-1;
+ int xlim;
+
+ MVector tmp_mv( mv );
+ AddVect( vect_list , tmp_mv , list_num );
+
+ for ( int i=1 ; i<=xr ; ++i)
+ {
+ tmp_mv.x = mv.x + i;
+ AddVect( vect_list , tmp_mv , list_num );
+
+ tmp_mv.x = mv.x - i;
+ AddVect( vect_list , tmp_mv , list_num );
+ }
+
+ for ( int j=1 ; j<=yr ; ++j)
+ {
+ xlim = xr * (yr-std::abs(j)) / yr;
+ for ( int i=-xlim ; i<=xlim ; ++i)
+ {
+ tmp_mv.x = mv.x + i;
+ tmp_mv.y = mv.y + j;
+ AddVect( vect_list , tmp_mv , list_num );
+
+ tmp_mv.y = mv.y - j;
+ AddVect( vect_list , tmp_mv , list_num );
+ }
+ }
+
+ // If we've not managed to add any element to the list
+ // remove the list so we don't ever have to check its size
+ if ( vect_list[list_num].size() == 0 )
+ vect_list.erase( vect_list.begin() + list_num );
+}
+
+void AddVect(CandidateList& vect_list,const MVector& mv,int list_num)
+{
+
+ bool is_in_list=false;
+
+ size_t lnum=0;
+ size_t i;
+
+ while( !is_in_list && lnum<vect_list.size() )
+ {
+ i=0;
+ while( !is_in_list && i<vect_list[lnum].size())
+ {
+ if ( vect_list[lnum][i].x == mv.x && vect_list[lnum][i].y == mv.y )
+ is_in_list=true;
+ ++i;
+ }
+ ++lnum;
+ }
+
+ if ( !is_in_list )
+ vect_list[list_num].push_back(mv);
+
+}
+
+BlockMatcher::BlockMatcher( const PicArray& pic_data , const PicArray& ref_data , const OLBParams& bparams ,
+ const MvArray& mv_array , const TwoDArray< MvCostData >& cost_array):
+ m_pic_data(pic_data),
+ m_ref_data(ref_data),
+ m_mv_array(mv_array),
+ m_cost_array(cost_array),
+ m_simplediff( ref_data , pic_data ), //NB: ORDER!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ m_checkdiff( ref_data , pic_data ),
+ m_simplediffup( ref_data , pic_data ),
+ m_checkdiffup( ref_data , pic_data ),
+ m_bparams(bparams)
+{}
+
+void BlockMatcher::FindBestMatch(int xpos , int ypos ,
+ const CandidateList& cand_list,
+ const MVector& mv_prediction,
+ float lambda)
+{
+ BlockDiffParams dparams;
+ dparams.SetBlockLimits( m_bparams , m_pic_data , xpos , ypos);
+ lambda /= m_bparams.Xblen()*m_bparams.Yblen();
+ lambda *= dparams.Xl()*dparams.Yl();
+
+ // Pointer to either a simple block diff object, or a bounds-checking one
+ BlockDiff* mydiff;
+
+ //now test against the offsets in the MV list to get the lowest cost//
+ //////////////////////////////////////////////////////////////////////
+
+ // Numbers of the lists to do more searching in
+ vector<int> list_nums;
+
+ // Costs of the initial vectors in each list
+ OneDArray<float> list_costs( cand_list.size() );
+
+ // The minimum cost so far
+ float min_cost;
+
+ // First test the first in each of the lists to choose which lists to pursue
+
+ MvCostData best_costs;
+ // Initialise so that we choose a valid vector to start with!
+ best_costs.total=100000000.0f;
+ MVector best_mv( cand_list[0][0] );
+
+ MVector cand_mv;
+ MvCostData cand_costs;
+
+ for (size_t lnum=0 ; lnum<cand_list.size() ; ++lnum )
+ {
+
+ cand_mv = cand_list[lnum][0];
+ cand_costs.mvcost = GetVar( mv_prediction , cand_mv );
+
+ // See whether we need to do bounds checking or not
+ if (( dparams.Xp()+cand_mv.x )<0 || ( dparams.Xp()+dparams.Xl()+cand_mv.x) >= m_ref_data.LengthX() ||
+ (dparams.Yp()+cand_mv.y)<0 || (dparams.Yp()+dparams.Yl()+cand_mv.y) >= m_ref_data.LengthY() )
+ mydiff = &m_checkdiff;
+ else
+ mydiff = &m_simplediff;
+
+ cand_costs.SAD = mydiff->Diff( dparams , cand_mv );
+ cand_costs.SetTotal( lambda );
+
+ if ( cand_costs.total < best_costs.total)
+ {
+ best_costs = cand_costs;
+ best_mv = cand_mv ;
+
+ }
+
+ list_costs[lnum] = cand_costs.total;
+
+ }// lnum
+
+
+ // Select which lists we're going to use //
+ ///////////////////////////////////////////
+
+ min_cost = list_costs[0];
+
+ for ( int lnum=1 ; lnum<list_costs.Length() ; ++lnum)
+ {
+ if ( list_costs[lnum]<min_cost )
+ min_cost = list_costs[lnum];
+ }// lnum
+
+ for ( int lnum=0 ; lnum<list_costs.Length() ; ++lnum)
+ {
+ // Only do lists whose 1st element isn't too far off best
+ if ( list_costs[lnum] < 1.5*min_cost ) // (value of 1.5 TBD)
+ list_nums.push_back( lnum );
+ }// lnum
+
+
+ // Ok, now we know which lists to pursue. Just go through all of them //
+ ////////////////////////////////////////////////////////////////////////
+ int list_num;
+
+ for ( size_t num=0 ; num<list_nums.size() ; ++num)
+ {
+ list_num = list_nums[num];
+
+ for (size_t i=1 ; i<cand_list[list_num].size() ; ++i)
+ {//start at 1 since did 0 above
+
+ cand_mv = cand_list[list_num][i];
+ cand_costs.mvcost = GetVar( mv_prediction , cand_mv);
+
+ if ((dparams.Xp()+cand_mv.x)<0 || (dparams.Xp()+dparams.Xl()+cand_mv.x) > m_ref_data.LengthX() ||
+ (dparams.Yp()+cand_mv.y)<0 || (dparams.Yp()+dparams.Yl()+cand_mv.y) > m_ref_data.LengthY() )
+ mydiff = &m_checkdiff;
+ else
+ mydiff = &m_simplediff;
+
+ cand_costs.SAD = mydiff->Diff( dparams , cand_mv );
+ cand_costs.SetTotal( lambda );
+
+ if ( cand_costs.total < best_costs.total)
+ {
+ best_costs = cand_costs;
+ best_mv = cand_mv;
+
+ }
+ }// i
+ }// num
+
+ // Write the results in the arrays //
+ /////////////////////////////////////
+
+ m_mv_array[ypos][xpos] = best_mv;
+ m_cost_array[ypos][xpos] = best_costs;
+}
+
+
+
+
+void BlockMatcher::FindBestMatchSubp(int xpos, int ypos,
+ const CandidateList& cand_list,
+ const MVector& mv_prediction,
+ float lambda)
+{
+
+ BlockDiffParams dparams;
+ dparams.SetBlockLimits( m_bparams , m_pic_data , xpos , ypos);
+
+ // Pointer to either a simple block diff object, or a bounds-checking one
+ BlockDiff* mydiff;
+
+ //now test against the offsets in the MV list to get the lowest cost//
+ //////////////////////////////////////////////////////////////////////
+
+ // Numbers of the lists to do more searching in
+ vector<int> list_nums;
+
+ // Costs of the initial vectors in each list
+ OneDArray<float> list_costs( cand_list.size() );
+
+ // The minimum cost so far
+ float min_cost;
+
+ // First test the first in each of the lists to choose which lists to pursue
+ MvCostData best_costs( m_cost_array[ypos][xpos] );
+ MVector best_mv( m_mv_array[ypos][xpos] );
+
+ MvCostData cand_costs;
+ MVector cand_mv;
+
+ for (size_t list_num=0 ; list_num<cand_list.size() ; ++list_num )
+ {
+
+ cand_mv = cand_list[list_num][0];
+ cand_costs.mvcost = GetVar( mv_prediction , cand_mv );
+
+ // See whether we need to do bounds checking or not
+ if ( (( dparams.Xp()<<1 )+(cand_mv.x>>2))<0
+ || ((( dparams.Xp()+dparams.Xl() )<<1)+(cand_mv.x>>2)) >= m_ref_data.LengthX()
+ || (( dparams.Yp()<<1)+(cand_mv.y>>2))<0
+ || (((dparams.Yp()+dparams.Yl())<<1)+(cand_mv.y>>2)) >= m_ref_data.LengthY() )
+ mydiff = &m_checkdiffup;
+ else
+ mydiff = &m_simplediffup;
+
+ cand_costs.SAD = mydiff->Diff( dparams , cand_mv );
+ cand_costs.SetTotal( lambda );
+
+ if (cand_costs.total< best_costs.total)
+ {
+ best_costs = cand_costs;
+ best_mv = cand_mv;
+ }
+
+ list_costs[list_num] = cand_costs.total;
+ }// list_num
+
+
+ // Select which lists we're going to use //
+ ///////////////////////////////////////////
+
+ min_cost = list_costs[0];
+
+ for ( int lnum=1 ; lnum<list_costs.Length() ; ++lnum)
+ {
+ if ( list_costs[lnum]<min_cost )
+ min_cost = list_costs[lnum];
+ }// lnum
+
+ for ( int lnum=0 ; lnum<list_costs.Length() ; ++lnum )
+ {
+ // Only do lists whose 1st element isn't too far off best
+ if ( list_costs[lnum] < 1.5*min_cost ) // (value of 1.5 TBD)
+ list_nums.push_back( lnum );
+ }// lnum
+
+ // Ok, now we know which lists to pursue. Just go through all of them //
+ ////////////////////////////////////////////////////////////////////////
+ int list_num;
+
+ for ( size_t num=0 ; num<list_nums.size() ; ++num)
+ {
+ list_num = list_nums[num];
+
+ for (size_t i=1 ; i<cand_list[list_num].size() ; ++i)
+ {//start at 1 since did 0 above
+
+ cand_mv = cand_list[list_num][i];
+ cand_costs.mvcost = GetVar( mv_prediction , cand_mv );
+
+ if ( (( dparams.Xp()<<1 )+( cand_mv.x>>2 ))<0
+ || ((( dparams.Xp()+dparams.Xl() )<<1)+( cand_mv.x>>2 )) >= m_ref_data.LengthX()
+ || (( dparams.Yp()<<1 )+( cand_mv.y>>2 ))<0
+ || ((( dparams.Yp()+dparams.Yl() )<<1)+(cand_mv.y>>2)) >= m_ref_data.LengthY() )
+ mydiff = &m_checkdiffup;
+ else
+ mydiff = &m_simplediffup;
+
+ cand_costs.SAD = mydiff->Diff( dparams , cand_mv );
+ cand_costs.SetTotal( lambda );
+
+ if (cand_costs.total< best_costs.total)
+ {
+ best_costs = cand_costs;
+ best_mv = cand_mv;
+ }
+
+ }// i
+ }// num
+
+ // Write the results in the arrays //
+ /////////////////////////////////////
+
+ m_mv_array[ypos][xpos] = best_mv;
+ m_cost_array[ypos][xpos] = best_costs;
+
+}
+} // namespace dirac
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/block_match.h b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/block_match.h
new file mode 100644
index 000000000..625686c04
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/block_match.h
@@ -0,0 +1,175 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: block_match.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _BLOCK_MATCH_H_
+#define _BLOCK_MATCH_H_
+
+#include <libdirac_motionest/me_utils.h>
+#include <vector>
+//handles the business of finding the best block match
+
+namespace dirac
+{
+
+ typedef std::vector< std::vector< MVector > > CandidateList;
+
+ //! Add a new motion vector list of neighbours of a vector to the set of lists
+ /*
+ Add a new motion vector list to the set of lists consisting of the
+ square neighbourhood [mv.x-xr,mv.x+xr] by
+ [mv.y-yr,mv.y+yr]. Vectors that already occur in previous lists are
+ not added.
+ */
+ void AddNewVlist( CandidateList& vect_list , const MVector& mv , const int xr , const int yr );
+
+ //! Add a new motion vector list to the set of lists for sub-pixel matching
+ /*
+ Add a new motion vector list to the set of lists consisting of the
+ vectors of the form (mv.x+m*step,mv.y+n*step) where m lies between
+ -xr and xr and n lies between -yr and yr. Vectors that already occur
+ in previous lists are not added.
+ */
+ void AddNewVlist( CandidateList& vect_list , const MVector& mv , const int xr , const int yr , const int step );
+
+ //! Add a new motion vector list of diagnonal neighbours of a vector to the set of lists
+ /*
+ Add a new motion vector list to the set of lists consisting of the
+ diagonal neighbourhood of height 2yr+1 pixels and width 2xr+1 centred
+ on \param mv.
+ Vectors that already occur in previous lists are not added.
+ */
+ void AddNewVlistD( CandidateList& vect_list , const MVector& mv , const int xr, const int yr);
+
+ //! Add a motion vector to the set of motion vector lists
+ /*!
+ Add a motion vector to the set of motion vector lists, making sure
+ it's not a duplicate.
+ */
+ void AddVect( CandidateList& vect_list , const MVector& mv , const int list_num);
+
+ //! Get the (absolute) variation between two motion vectors
+ /*!
+ Return the variation between two motion vectors, computed as the sum
+ of absolute differences of their components.
+ */
+ ValueType GetVar(const MVector& mv1,const MVector& mv2);
+
+ //! Get the (absolute) variation between a motion vector and a list of motion vectors
+ /*!
+ Return the variation between a motion vector and a list of motion
+ vectos, computed as the sum of absolute differences between the
+ components of the vector and the median vector produced by the list of
+ vectors
+ */
+ ValueType GetVar(const std::vector<MVector>& pred_list,const MVector& mv);
+
+
+ //! Class to do block matching
+
+ // Subsumes FindBestMatch and FindBestMatchSubpel
+ class BlockMatcher
+ {
+ public:
+ //! Constructor
+ /*!
+ Constructor
+ \param ref_data the reference picture component
+ \param pic_data the picture being matched
+ \param bparams the (overlapped) block parameters to be used for the matching
+ \param mv_array the array of vectors we're going to write into
+ \param cost_array the array of costs we're going to write into
+
+ */
+ BlockMatcher( const PicArray& ref_data ,
+ const PicArray& pic_data ,
+ const OLBParams& bparams ,
+ const MvArray& mv_array ,
+ const TwoDArray< MvCostData >& cost_array);
+
+ //! Find the best matching vector from a list of candidates
+ /*!
+ Find the best matching vector from a list of candidates.
+ \param xpos the horizontal location of the block being matched
+ \param ypos the vertical location of the block being matched
+ \param cand_list the list of candidate vectors
+ \param mv_prediction the prediction for the motion vector
+ \param lambda the Lagrangian parameter
+ */
+ void FindBestMatch(int xpos , int ypos,
+ const CandidateList& cand_list,
+ const MVector& mv_prediction,
+ float lambda);
+
+ //! Find the best matching vector from a list of candidates, to sub-pixel accuracy (TBC: merge with FindBestMatch)
+ /*!
+ Find the best matching vector from a list of candidates.
+ \param xpos the horizontal location of the block being matched
+ \param ypos the vertical location of the block being matched
+ \param cand_list the list of candidate vectors
+ \param mv_prediction the prediction for the motion vector
+ \param lambda the Lagrangian parameter
+ */
+ void FindBestMatchSubp(int xpos, int ypos,
+ const CandidateList& cand_list,
+ const MVector& mv_prediction,
+ float lambda);
+
+ private:
+ // Local copies of the picture and reference
+ const PicArray& m_pic_data;
+ const PicArray& m_ref_data;
+
+ // Local copy of the motion vector array being populated
+ const MvArray& m_mv_array;
+
+ // Local copy of the costs being determined through the matching
+ const TwoDArray< MvCostData >& m_cost_array;
+
+ // Block difference elements. Will choose between them depending
+ // on whether we're at the edge of the picture
+ SimpleBlockDiff m_simplediff;
+ BChkBlockDiff m_checkdiff;
+ SimpleBlockDiffUp m_simplediffup;
+ BChkBlockDiffUp m_checkdiffup;
+
+ // The block parameters we're using
+ OLBParams m_bparams;
+
+ };
+
+} // namespace dirac
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/downconvert.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/downconvert.cpp
new file mode 100644
index 000000000..335d8a46b
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/downconvert.cpp
@@ -0,0 +1,199 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: downconvert.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Richard Felton (Original Author),
+* Thomas Davies
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_motionest/downconvert.h>
+using namespace dirac;
+
+DownConverter::DownConverter()
+{}
+
+
+//General function - does some admin and calls the correct function
+void DownConverter::DoDownConvert(const PicArray& old_data, PicArray& new_data)
+{
+ //Down-convert by a factor of two.
+ m_row_buffer= new ValueType[old_data.LengthX()];
+ //Variables that will be used by the filter calculations
+ int sum;
+ int colpos;
+
+ // The area of the picture that will be downconverted
+ const int xlen = 2*new_data.LengthX();
+ const int ylen = 2*new_data.LengthY();
+
+
+ //There are three y loops to cope with the leading edge, middle
+ //and trailing edge of each column.
+ colpos=0;
+ for( int y=0; y<Stage_I_Size*2 ; y+=2 , colpos++ )
+ {
+ // We are filtering each column but doing it bit by bit.
+ // This means our main loop is in the x direction and
+ // there is a much greater chance the data we need will
+ // be in the cache.
+
+ for( int x=0 ; x<xlen ; x++ )
+ {
+ // In down conversion we interpolate every pixel
+ // so there is no copying.
+ // Excuse the complicated ternary stuff but it sorts out the edge
+ sum = (old_data[y][x] + old_data[y+1][x])*StageI_I;
+ sum += (old_data[((y-1)>=0)?(y-1):0][x] + old_data[y+2][x])*StageI_II;
+ sum += (old_data[((y-2)>=0)?(y-2):0][x] + old_data[y+3][x])*StageI_III;
+ sum += (old_data[((y-3)>=0)?(y-3):0][x] + old_data[y+4][x])*StageI_IV;
+ sum += (old_data[((y-4)>=0)?(y-4):0][x] + old_data[y+5][x])*StageI_V;
+ sum += (old_data[((y-5)>=0)?(y-5):0][x] + old_data[y+6][x])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
+ m_row_buffer[x] = sum >> StageI_Shift;
+ }// x
+ //Speaking of which - the row loop.
+
+ RowLoop(colpos,old_data,new_data);
+ }// y
+
+ // This loop is like the last one but it deals with the center
+ // section of the image and so the ternary operations are dropped
+ // from the filter section.
+ for( int y=Stage_I_Size*2 ; y<ylen-Stage_I_Size*2 ; y+=2 , colpos++ )
+ {
+ for( int x=0 ; x<xlen ; x++ )
+ {
+
+ sum = (old_data[y][x] + old_data[y+1][x])*StageI_I;
+ sum += (old_data[y-1][x] + old_data[y+2][x])*StageI_II;
+ sum += (old_data[y-2][x] + old_data[y+3][x])*StageI_III;
+ sum += (old_data[y-3][x] + old_data[y+4][x])*StageI_IV;
+ sum += (old_data[y-4][x] + old_data[y+5][x])*StageI_V;
+ sum += (old_data[y-5][x] + old_data[y+6][x])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
+ m_row_buffer[x] = sum >> StageI_Shift;
+ }// x
+
+ RowLoop( colpos , old_data , new_data );
+ }// y
+
+ // Another similar loop! - this time we are dealing with
+ // the trailing edge so the ternary stuff is back in the
+ // filter calcs but in the second parameter.
+
+ for( int y=ylen-(Stage_I_Size*2) ; y<ylen-1 ; y+=2 , colpos++ )
+ {
+ for( int x=0; x<xlen ; x++ )
+ {
+
+ sum = (old_data[y][x] + old_data[((y+1)<ylen)?(y+1):(ylen-1)][x])*StageI_I;
+ sum += (old_data[y-1][x] + old_data[((y+2)<ylen)?(y+2):(ylen-1)][x])*StageI_II;
+ sum += (old_data[y-2][x] + old_data[((y+3)<ylen)?(y+3):(ylen-1)][x])*StageI_III;
+ sum += (old_data[y-3][x] + old_data[((y+4)<ylen)?(y+4):(ylen-1)][x])*StageI_IV;
+ sum += (old_data[y-4][x] + old_data[((y+5)<ylen)?(y+5):(ylen-1)][x])*StageI_V;
+ sum += (old_data[y-5][x] + old_data[((y+6)<ylen)?(y+6):(ylen-1)][x])*StageI_VI;
+
+ // Do rounding right
+ sum += 1<<(StageI_Shift-1);
+ m_row_buffer[x] = sum >> StageI_Shift;
+
+ }// x
+
+ RowLoop( colpos , old_data , new_data );
+
+ }// y
+
+ // Tidy up the data
+ delete[] m_row_buffer;
+
+}
+
+
+// The loop over the columns is the same every time so lends itself to isolation
+// as an individual function.
+void DownConverter::RowLoop( const int colpos , const PicArray& old_data , PicArray& new_data)
+{
+
+ //Calculation variables
+ int sum;
+ const int xlen = 2*new_data.LengthX();
+ int linepos=0;
+
+ // Leading Column Edge
+ // Similar loops to the x case in ByHalf_opto, for explanation look there.
+ // Note the factor of two difference as we only want to fill in every other
+ // line as the others have already been created by the line loops.
+
+ for( int x=0; x<(2*Stage_I_Size) ; x+=2 , linepos++ )
+ {
+ sum = (m_row_buffer[((x)>=0)?(x):0] + m_row_buffer[x+1])*StageI_I;
+ sum += (m_row_buffer[((x-1)>=0)?(x-1):0] + m_row_buffer[x+2])*StageI_II;
+ sum += (m_row_buffer[((x-2)>=0)?(x-2):0] + m_row_buffer[x+3])*StageI_III;
+ sum += (m_row_buffer[((x-3)>=0)?(x-3):0] + m_row_buffer[x+4])*StageI_IV;
+ sum += (m_row_buffer[((x-4)>=0)?(x-4):0] + m_row_buffer[x+5])*StageI_V;
+ sum += (m_row_buffer[((x-5)>=0)?(x-5):0] + m_row_buffer[x+6])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
+
+ new_data[colpos][linepos] = sum >> StageI_Shift;
+
+ }
+ //Middle of column
+ for( int x=(2*Stage_I_Size) ; x<xlen-(2*Stage_I_Size) ; x+=2 , linepos++)
+ {
+ sum = (m_row_buffer[x] + m_row_buffer[x+1])*StageI_I;
+ sum += (m_row_buffer[x-1] + m_row_buffer[x+2])*StageI_II;
+ sum += (m_row_buffer[x-2] + m_row_buffer[x+3])*StageI_III;
+ sum += (m_row_buffer[x-3] + m_row_buffer[x+4])*StageI_IV;
+ sum += (m_row_buffer[x-4] + m_row_buffer[x+5])*StageI_V;
+ sum += (m_row_buffer[x-5] + m_row_buffer[x+6])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
+
+ new_data[colpos][linepos] = sum >> StageI_Shift;
+
+ }
+ //Trailing column edge
+ for( int x=xlen-(2*Stage_I_Size) ; x< xlen-1 ; x+=2 , linepos++ )
+ {
+ sum = (m_row_buffer[x] + m_row_buffer[((x+1)<xlen)?(x+1):(xlen-1)])*StageI_I;
+ sum += (m_row_buffer[x-1] + m_row_buffer[((x+2)<xlen)?(x+2):(xlen-1)])*StageI_II;
+ sum += (m_row_buffer[x-2] + m_row_buffer[((x+3)<xlen)?(x+3):(xlen-1)])*StageI_III;
+ sum += (m_row_buffer[x-3] + m_row_buffer[((x+4)<xlen)?(x+4):(xlen-1)])*StageI_IV;
+ sum += (m_row_buffer[x-4] + m_row_buffer[((x+5)<xlen)?(x+5):(xlen-1)])*StageI_V;
+ sum += (m_row_buffer[x-5] + m_row_buffer[((x+6)<xlen)?(x+6):(xlen-1)])*StageI_VI;
+ sum += 1<<(StageI_Shift-1);//do rounding right
+
+ new_data[colpos][linepos] = sum >> StageI_Shift;
+
+ }
+
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/downconvert.h b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/downconvert.h
new file mode 100644
index 000000000..78d298fc3
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/downconvert.h
@@ -0,0 +1,94 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: downconvert.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Richard Felton (Original Author),
+* Thomas Davies
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _DOWNCONVERT_H_
+#define _DOWNCONVERT_H_
+
+#include <libdirac_common/common.h>
+namespace dirac
+{
+
+ //! A class for fast downconversion of picture data
+ /*!
+ A class for fast down-conversion of picture data. The picture data is
+ downconverted by a factor of two in each dimension, using fast
+ filtering techniques. The filter is a half-band filter designed to
+ trade off frequency response, ringiness, and aliasing
+ */
+ class DownConverter{
+
+ public:
+
+ //! Constructor
+ DownConverter();
+ //! Destructor
+ ~DownConverter(){};
+
+ //! A function to do the actual down-conversion
+ /*!
+ A function to do the actual downconversion.
+ \param old_data the picture data to be downconverted
+ \param new_data the resulting down-converted data. The array must be of the correct size.
+ */
+ void DoDownConvert(const PicArray& old_data, PicArray& new_data);
+
+ private:
+ //Copy constructor
+ DownConverter(const DownConverter& cpy);//private, body-less: class should not be copied
+ //Assignment=
+ DownConverter& operator=(const DownConverter& rhs);//private, body-less: class should not be assigned
+
+ //Applies the filter to a single column
+ void RowLoop(const int colpos , const PicArray& old_data , PicArray& new_data );
+
+ ValueType* m_row_buffer;
+
+ //Define filter parameters
+ static const int Stage_I_Size = 6;
+ static const int StageI_I = 86;
+ static const int StageI_II = 46;
+ static const int StageI_III = 4;
+ static const int StageI_IV = -8;
+ static const int StageI_V = -4;
+ static const int StageI_VI = 4;
+ static const int StageI_Shift = 8;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_mode_decn.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_mode_decn.cpp
new file mode 100644
index 000000000..45493337d
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_mode_decn.cpp
@@ -0,0 +1,584 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: me_mode_decn.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_motionest/me_mode_decn.h>
+#include <libdirac_common/frame_buffer.h>
+using namespace dirac;
+
+#include <algorithm>
+
+using std::vector;
+
+ModeDecider::ModeDecider( const EncoderParams& encp):
+ m_encparams( encp ),
+ m_level_factor(3),
+ m_mode_factor(3),
+ m_me_data_set(3)
+{
+
+ // The following factors normalise costs for sub-MBs and MBs to those of
+ // blocks, so that the overlap is take into account (e.g. a sub-MB has
+ // length XBLEN+XBSEP and YBLEN+YBSEP). The MB costs for a 1x1
+ // decomposition are not directly comprable to those for other decompositions
+ // because of the block overlaps. These factors remove these effects, so that
+ // all SAD costs are normalised to the area corresponding to non-overlapping
+ // 16 blocks of size XBLEN*YBLEN.
+
+ m_level_factor[0] = float( 16 * m_encparams.LumaBParams(2).Xblen() * m_encparams.LumaBParams(2).Yblen() )/
+ float( m_encparams.LumaBParams(0).Xblen() * m_encparams.LumaBParams(0).Yblen() );
+
+ m_level_factor[1] = float( 4 * m_encparams.LumaBParams(2).Xblen() * m_encparams.LumaBParams(2).Yblen() )/
+ float( m_encparams.LumaBParams(1).Xblen() * m_encparams.LumaBParams(1).Yblen() );
+
+ m_level_factor[2] = 1.0f;
+
+ for (int i=0 ; i<=2 ; ++i)
+ m_mode_factor[i] = 160.0*std::pow(0.8 , 2-i);
+}
+
+
+ModeDecider::~ModeDecider()
+{
+ if (fsort != I_frame)
+ {
+ delete m_me_data_set[0];
+ delete m_me_data_set[1];
+ }
+}
+
+void ModeDecider::DoModeDecn(const FrameBuffer& my_buffer, int frame_num, MEData& me_data)
+{
+
+ // We've got 'raw' block motion vectors for up to two reference frames. Now we want
+ // to make a decision as to mode. In this initial implementation, this is bottom-up
+ // i.e. find mvs for MBs and sub-MBs and see whether it's worthwhile merging.
+
+ int ref1,ref2;
+
+ // Initialise //
+ ////////////////
+
+ fsort = my_buffer.GetFrame(frame_num).GetFparams().FSort();
+ if (fsort != I_frame)
+ {
+ // Extract the references
+ const vector<int>& refs = my_buffer.GetFrame(frame_num).GetFparams().Refs();
+ num_refs = refs.size();
+ ref1 = refs[0];
+
+ // The picture we're doing estimation from
+ m_pic_data = &(my_buffer.GetComponent( frame_num , Y_COMP));
+
+ // Set up the hierarchy of motion vector data objects
+ m_me_data_set[0] = new MEData( m_encparams.XNumMB() , m_encparams.YNumMB() ,
+ m_encparams.XNumBlocks()/4 , m_encparams.YNumBlocks()/4 );
+ m_me_data_set[1] = new MEData( m_encparams.XNumMB() , m_encparams.YNumMB() ,
+ m_encparams.XNumBlocks()/2 , m_encparams.YNumBlocks()/2 );
+
+ m_me_data_set[2] = &me_data;
+
+ // Set up the lambdas to use per block
+ m_me_data_set[0]->SetLambdaMap( 0 , me_data.LambdaMap() , 1.0/m_level_factor[0] );
+ m_me_data_set[1]->SetLambdaMap( 1 , me_data.LambdaMap() , 1.0/m_level_factor[1] );
+
+ // Set up the reference pictures
+ m_ref1_updata = &(my_buffer.GetUpComponent( ref1 , Y_COMP));
+
+ if (num_refs>1)
+ {
+ ref2 = refs[1];
+ m_ref2_updata = &(my_buffer.GetUpComponent( ref2 , Y_COMP));
+ // Create an object for computing bi-directional prediction calculations
+ m_bicheckdiff = new BiBChkBlockDiffUp( *m_ref1_updata ,
+ *m_ref2_updata ,
+ *m_pic_data );
+ }
+ else
+ {
+ ref2 = ref1;
+ }
+
+
+ // Create an object for doing intra calculations
+ m_intradiff = new IntraBlockDiff( *m_pic_data );
+
+ // Loop over all the macroblocks, doing the work //
+ ///////////////////////////////////////////////////
+
+ for (m_ymb_loc=0 ; m_ymb_loc<m_encparams.YNumMB() ; ++m_ymb_loc )
+ {
+ for (m_xmb_loc=0 ; m_xmb_loc<m_encparams.XNumMB(); ++m_xmb_loc )
+ {
+ DoMBDecn();
+ }//m_xmb_loc
+ }//m_ymb_loc
+
+ delete m_intradiff;
+ if (num_refs>1)
+ delete m_bicheckdiff;
+ }
+}
+
+void ModeDecider::DoMBDecn()
+{
+ // Does the mode decision for the given MB, in three stages
+
+ // Start with 4x4 modes
+ DoLevelDecn(2);
+ float old_best_MB_cost = m_me_data_set[2]->MBCosts()[m_ymb_loc][m_xmb_loc];
+
+ // Next do 2x2 modes
+ DoLevelDecn(1);
+
+ // Do 1x1 mode if merging worked before
+ if ( m_me_data_set[2]->MBCosts()[m_ymb_loc][m_xmb_loc] <= old_best_MB_cost)
+ {
+ old_best_MB_cost = m_me_data_set[2]->MBCosts()[m_ymb_loc][m_xmb_loc];
+ DoLevelDecn(0);
+ }
+
+}
+
+void ModeDecider::DoLevelDecn( int level )
+{
+ // Computes the best costs if we were to
+ // stick to a decomposition at this level
+
+ // Looks at two cases: the prediction mode is
+ // constant across the MB; and the pred mode
+ // for each constituent is different.
+
+ // The limits of the prediction units
+ const int xstart = m_xmb_loc <<level;
+ const int ystart = m_ymb_loc <<level;
+
+ const int xend = xstart + (1<<level);
+ const int yend = ystart + (1<<level);
+
+ // Case 1: prediction modes are all different
+
+ float MB_cost = 0.0;
+ for ( int j=ystart ; j<yend ; ++j)
+ {
+ for (int i=xstart ; i<xend ; ++i)
+ {
+ if ( level<2 )
+ DoME( i , j , level);
+ MB_cost += DoUnitDecn( i , j ,level );
+
+ }// i
+ }// j
+
+ // if we've improved on the best cost, we should propagate data in
+ // the base level motion vector set
+ if (level == 2)
+ {
+ m_me_data_set[2]->MBSplit()[m_ymb_loc][m_xmb_loc] = 2;
+ m_me_data_set[2]->MBCommonMode()[m_ymb_loc][m_xmb_loc] = false;
+ m_me_data_set[2]->MBCosts()[m_ymb_loc][m_xmb_loc] = MB_cost;
+ }
+
+ if ( level<2 && MB_cost <= m_me_data_set[2]->MBCosts()[m_ymb_loc][m_xmb_loc] )
+ {
+ m_me_data_set[2]->MBCosts()[m_ymb_loc][m_xmb_loc] = MB_cost;
+ m_me_data_set[2]->MBSplit()[m_ymb_loc][m_xmb_loc] = level;
+ m_me_data_set[2]->MBCommonMode()[m_ymb_loc][m_xmb_loc] = false;
+
+ // Parameters of the base-level blocks corresponding to each
+ // prediction unit
+ int xblock_start;
+ int yblock_start;
+ int xblock_end;
+ int yblock_end;
+
+ for ( int j=ystart ; j<yend ; ++j )
+ {
+ yblock_start = j<<(2-level);
+ yblock_end = (j+1)<<(2-level);
+ for ( int i=xstart ; i<xend ; ++i )
+ {
+ xblock_start = i<<(2-level);
+ xblock_end = (i+1)<<(2-level);
+
+ for ( int v=yblock_start ; v<yblock_end ; ++v )
+ {
+ for ( int u=xblock_start ; u<xblock_end ; ++u )
+ {
+ m_me_data_set[2]->Mode()[v][u] = m_me_data_set[level]->Mode()[j][i];
+ m_me_data_set[2]->DC( Y_COMP )[v][u] = m_me_data_set[level]->DC( Y_COMP )[j][i];
+ m_me_data_set[2]->Vectors(1)[v][u] = m_me_data_set[level]->Vectors(1)[j][i];
+ if ( num_refs>1 )
+ m_me_data_set[2]->Vectors(2)[v][u] = m_me_data_set[level]->Vectors(2)[j][i];
+
+ }// u
+ }// v
+
+ }// i
+ }// j
+
+ }
+
+ // Case 2: prediction modes are all the same
+
+ PredMode predmode;
+
+ MB_cost = DoCommonMode( predmode , level );
+
+ if ( MB_cost <= m_me_data_set[2]->MBCosts()[m_ymb_loc][m_xmb_loc] )
+ {
+ m_me_data_set[2]->MBCosts()[m_ymb_loc][m_xmb_loc] = MB_cost;
+ m_me_data_set[2]->MBSplit()[m_ymb_loc][m_xmb_loc] = level;
+ m_me_data_set[2]->MBCommonMode()[m_ymb_loc][m_xmb_loc] = true;
+ // Parameters of the base-level blocks corresponding to each
+ // prediction unit
+ int xblock_start;
+ int yblock_start;
+ int xblock_end;
+ int yblock_end;
+
+ for ( int j=ystart ; j<yend ; ++j )
+ {
+ yblock_start = j<<(2-level);
+ yblock_end = (j+1)<<(2-level);
+ for ( int i=xstart ; i<xend ; ++i )
+ {
+ xblock_start = i<<(2-level);
+ xblock_end = (i+1)<<(2-level);
+ for ( int v=yblock_start ; v<yblock_end ; ++v )
+ {
+ for ( int u=xblock_start ; u<xblock_end ; ++u )
+ {
+ m_me_data_set[2]->Vectors(1)[v][u] = m_me_data_set[level]->Vectors(1)[j][i];
+ m_me_data_set[2]->Mode()[v][u] = predmode;
+ m_me_data_set[2]->DC( Y_COMP )[v][u] = m_me_data_set[level]->DC( Y_COMP )[j][i];
+ if ( num_refs>1 )
+ m_me_data_set[2]->Vectors(2)[v][u] = m_me_data_set[level]->Vectors(2)[j][i];
+
+ }// u
+ }// v
+
+ }// i
+ }// j
+ }
+
+}
+
+
+void ModeDecider::DoME(const int xpos , const int ypos , const int level)
+{
+ // Do motion estimation for a prediction unit using the
+ // four vectors derived from the next level as a guide
+
+ MEData& me_data = *(m_me_data_set[level]);
+ const MEData& guide_data = *(m_me_data_set[level+1]);
+
+ // The corresponding location of the guide data
+ const int guide_xpos = xpos<<1;
+ const int guide_ypos = ypos<<1;
+
+ // The location of the lowest level vectors
+ const int xblock = xpos << ( 2 - level);
+ const int yblock = ypos << ( 2 - level);
+
+ // The list of potential candidate vectors
+ CandidateList cand_list;
+
+ // The lambda to use for motion estimation
+ const float lambda = me_data.LambdaMap()[ypos][xpos];
+
+ // The predicting motion vector
+ MVector mv_pred;
+
+ for ( int j=0 ; j<2 ; ++j )
+ for (int i=0 ; i<2 ; ++i )
+ AddNewVlist( cand_list , guide_data.Vectors(1)[guide_ypos+j][guide_xpos+i] , 1 , 1 );
+
+ if (xblock>0 && yblock>0)
+ mv_pred = MvMedian( m_me_data_set[2]->Vectors(1)[yblock][xblock-1] ,
+ m_me_data_set[2]->Vectors(1)[yblock-1][xblock-1],
+ m_me_data_set[2]->Vectors(1)[yblock-1][xblock]);
+ else if (xblock==0 && yblock>0)
+ mv_pred = MvMean( m_me_data_set[2]->Vectors(1)[yblock-1][xblock],
+ m_me_data_set[2]->Vectors(1)[yblock-1][xblock+1]);
+ else if (xblock>0 && yblock==0)
+ mv_pred = MvMean( m_me_data_set[2]->Vectors(1)[yblock][xblock-1],
+ m_me_data_set[2]->Vectors(1)[yblock+1][xblock-1]);
+ else{
+ mv_pred.x = 0;
+ mv_pred.y = 0;
+ }
+
+ BlockMatcher my_bmatch1( *m_pic_data , *m_ref1_updata , m_encparams.LumaBParams(level) ,
+ me_data.Vectors(1) , me_data.PredCosts(1) );
+ me_data.PredCosts(1)[ypos][xpos].total = 100000000.0f;
+ my_bmatch1.FindBestMatchSubp( xpos , ypos , cand_list, mv_pred, lambda );
+
+ if (num_refs>1)
+ {//do the same for the other reference
+
+ cand_list.clear();
+
+ for ( int j=0 ; j<2 ; ++j )
+ {
+ for (int i=0 ; i<2 ; ++i )
+ {
+ AddNewVlist( cand_list , guide_data.Vectors(2)[guide_ypos+j][guide_xpos+i] , 1 , 1 );
+ }// i
+ }// j
+
+ if (xblock>0 && yblock>0)
+ mv_pred = MvMedian( m_me_data_set[2]->Vectors(2)[yblock][xblock-1] ,
+ m_me_data_set[2]->Vectors(2)[yblock-1][xblock-1],
+ m_me_data_set[2]->Vectors(2)[yblock-1][xblock]);
+ else if (xblock==0 && yblock>0)
+ mv_pred = MvMean( m_me_data_set[2]->Vectors(2)[yblock-1][xblock],
+ m_me_data_set[2]->Vectors(2)[yblock-1][xblock+1]);
+ else if (xblock>0 && yblock==0)
+ mv_pred = MvMean( m_me_data_set[2]->Vectors(2)[yblock][xblock-1],
+ m_me_data_set[2]->Vectors(2)[yblock+1][xblock-1]);
+ else{
+ mv_pred.x = 0;
+ mv_pred.y = 0;
+ }
+
+ BlockMatcher my_bmatch2( *m_pic_data , *m_ref2_updata , m_encparams.LumaBParams(level) ,
+ me_data.Vectors(2) , me_data.PredCosts(2) );
+ me_data.PredCosts(2)[ypos][xpos].total = 100000000.0f;
+ my_bmatch2.FindBestMatchSubp( xpos , ypos , cand_list, mv_pred, lambda );
+
+ }
+}
+
+
+
+float ModeDecider::DoUnitDecn(const int xpos , const int ypos , const int level )
+{
+ // For a given prediction unit (MB, subMB or block) find the best
+ // mode, given that the REF1 and REF2 motion estimation has
+ // already been done.
+
+ MEData& me_data = *( m_me_data_set[level] );
+
+ // Coords of the top-leftmost block belonging to this unit
+ const int xblock = xpos<<(2-level);
+ const int yblock = ypos<<(2-level);
+
+ const float loc_lambda = me_data.LambdaMap()[ypos][xpos];
+
+ float unit_cost;
+ float mode_cost;
+ float min_unit_cost;
+
+ BlockDiffParams dparams;
+
+ dparams.SetBlockLimits( m_encparams.LumaBParams( level ) , *m_pic_data, xpos , ypos);
+
+ // First check REF1 costs //
+ /**************************/
+
+ mode_cost = ModeCost( xblock , yblock , REF1_ONLY)*m_mode_factor[level];
+ me_data.Mode()[ypos][xpos] = REF1_ONLY;
+ me_data.PredCosts(1)[ypos][xpos].total *= m_level_factor[level];
+ min_unit_cost = me_data.PredCosts(1)[ypos][xpos].total + mode_cost;
+
+ // Calculate the cost if we were to code the block as intra //
+ /************************************************************/
+
+ mode_cost = ModeCost( xblock , yblock , INTRA) * m_mode_factor[level];
+ me_data.IntraCosts()[ypos][xpos] = m_intradiff->Diff( dparams , me_data.DC( Y_COMP )[ypos][xpos] );
+ me_data.IntraCosts()[ypos][xpos] += loc_lambda *
+ GetDCVar( me_data.DC( Y_COMP )[ypos][xpos] , GetDCPred( xblock , yblock ) );
+ me_data.IntraCosts()[ypos][xpos] *= m_level_factor[level];
+ unit_cost = me_data.IntraCosts()[ypos][xpos] + mode_cost;
+
+ if ( unit_cost<min_unit_cost )
+ {
+ me_data.Mode()[ypos][xpos] = INTRA;
+ min_unit_cost = unit_cost;
+ }
+
+ if (num_refs>1)
+ {
+ // Next check REF2 costs //
+ /*************************/
+
+ mode_cost = ModeCost( xblock , yblock , REF2_ONLY)*m_mode_factor[level];
+ me_data.PredCosts(2)[ypos][xpos].total *= m_level_factor[level];
+ unit_cost = me_data.PredCosts(2)[ypos][xpos].total + mode_cost;
+ if ( unit_cost<min_unit_cost )
+ {
+ me_data.Mode()[ypos][xpos] = REF2_ONLY;
+ min_unit_cost = unit_cost;
+ }
+
+ // Finally, calculate the cost if we were to use bi-predictions //
+ /****************************************************************/
+/*
+ mode_cost = ModeCost( xpos , ypos , REF1AND2 )*m_mode_factor[level];
+
+ me_data.BiPredCosts()[ypos][xpos].mvcost =
+ me_data.PredCosts(1)[ypos][xpos].mvcost+
+ me_data.PredCosts(2)[ypos][xpos].mvcost;
+
+ me_data.BiPredCosts()[ypos][xpos].SAD = m_bicheckdiff->Diff(dparams ,
+ me_data.Vectors(1)[ypos][xpos] ,
+ me_data.Vectors(2)[ypos][xpos] );
+
+ me_data.BiPredCosts()[ypos][xpos].SetTotal( loc_lambda );
+
+ me_data.BiPredCosts()[ypos][xpos].total *= m_level_factor[level];
+ unit_cost = me_data.BiPredCosts()[ypos][xpos].total + mode_cost;
+
+ if ( unit_cost<min_unit_cost )
+ {
+ me_data.Mode()[ypos][xpos] = REF1AND2;
+ min_unit_cost = unit_cost;
+ }
+*/
+ }
+
+ return min_unit_cost;
+}
+
+float ModeDecider::DoCommonMode( PredMode& predmode , const int level)
+{
+ // For a given level, examine the costs in the constituent
+ // prediction units of the MB at that level and decide
+ // whether there should be a common prediction mode or not.
+
+ const MEData& me_data = *( m_me_data_set[level] );
+
+ // The total cost for the MB for each possible prediction mode
+ OneDArray<float> MB_cost(4);
+ for ( int i=0 ; i<4 ; ++i)
+ MB_cost[i] = ModeCost( m_xmb_loc<<2 , m_ymb_loc , PredMode(i) )*m_mode_factor[0];
+
+ // The limits of the prediction units
+ const int xstart = m_xmb_loc <<level;
+ const int ystart = m_ymb_loc <<level;
+
+ const int xend = xstart + (1<<level);
+ const int yend = ystart + (1<<level);
+
+ for (int j=ystart ; j<yend ; ++j)
+ {
+ for (int i=xstart ; i<xend ; ++i)
+ {
+ MB_cost[INTRA] += me_data.IntraCosts()[j][i];
+ MB_cost[REF1_ONLY] += me_data.PredCosts(1)[j][i].total;
+ if ( num_refs>1 )
+ {
+ MB_cost[REF2_ONLY] += me_data.PredCosts(2)[j][i].total;
+// MB_cost[REF1AND2] += me_data.BiPredCosts()[j][i].total;
+ }
+ }// i
+ }// i
+
+
+ // Find the minimum
+ predmode = INTRA;
+ if ( MB_cost[REF1_ONLY]<MB_cost[predmode] )
+ predmode = REF1_ONLY;
+
+ if ( num_refs>1)
+ {
+ if ( MB_cost[REF2_ONLY]<MB_cost[predmode] )
+ predmode = REF2_ONLY;
+// if ( MB_cost[REF1AND2]<MB_cost[predmode] )
+// predmode = REF1AND2;
+ }
+
+ return MB_cost[predmode];
+}
+
+ValueType ModeDecider::GetDCPred( int xblock , int yblock )
+{
+ ValueType dc_pred = 128;
+
+ if ( xblock>0 && m_me_data_set[2]->Mode()[yblock][xblock-1] == INTRA )
+ {
+ dc_pred = m_me_data_set[2]->DC( Y_COMP )[yblock][xblock-1];
+ if ( yblock>0 && m_me_data_set[2]->Mode()[yblock-1][xblock] == INTRA )
+ {
+ dc_pred += m_me_data_set[2]->DC( Y_COMP )[yblock-1][xblock];
+ dc_pred >>= 1;
+ }
+ }
+
+ return dc_pred;
+}
+
+float ModeDecider::ModeCost(const int xindex , const int yindex ,
+ const PredMode predmode )
+{
+ // Computes the variation of the given mode, predmode, from its immediate neighbours
+ // Currently, includes branches to cope with blocks on the edge of the picture.
+ int i ,j;
+ float diff;
+ float var = 0.0;
+
+ i = xindex-1;
+ j = yindex;
+ if ( i>=0)
+ {
+ diff = static_cast<float>( m_me_data_set[2]->Mode()[j][i] - predmode );
+ var = std::abs( diff );
+ }
+
+ i = xindex-1;
+ j = yindex-1;
+ if ( i>=0 && j>=0)
+ {
+ diff = static_cast<float>( m_me_data_set[2]->Mode()[j][i] - predmode);
+ var += std::abs( diff );
+ }
+
+ i = xindex;
+ j = yindex-1;
+ if ( j>=0 )
+ {
+ diff = static_cast<float>( m_me_data_set[2]->Mode()[j][i] - predmode );
+ var += std::abs( diff );
+ }
+
+ return var*m_me_data_set[2]->LambdaMap()[yindex][xindex];
+}
+
+float ModeDecider::GetDCVar( const ValueType dc_val , const ValueType dc_pred)
+{
+ return 8.0*std::abs( static_cast<float>( dc_val - dc_pred ) );
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_mode_decn.h b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_mode_decn.h
new file mode 100644
index 000000000..ddcbe9c5f
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_mode_decn.h
@@ -0,0 +1,163 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: me_mode_decn.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _ME_MODE_DECN_H_
+#define _ME_MODE_DECN_H_
+
+#include <libdirac_common/motion.h>
+#include <libdirac_motionest/block_match.h>
+
+namespace dirac
+{
+ class FrameBuffer;
+
+ //! Decides between macroblock and block prediction modes.
+ /*!
+ Loops over all the macroblocks and decides on the best modes. A
+ macroblock is a square of 16 blocks. There are three possible
+ splitting levels:
+ level 0 means the macroblock is considered as a single block;
+ level 1 means the macroblock is considered as 4 larger blocks,
+ termed sub-macroblocks;
+ level 0 means the macroblock is split right down to blocks.
+
+ In addition there is a common_ref mode which if true means the
+ prediction mode of all units within the MB are the same (e.g. all
+ sub-MBs are predicted only from reference 1). In deciding which modes
+ to adopt, the ModeDecider object calculates costs for all
+ permutations, doing motion estimation for the level 1 and level 0
+ modes as these have not been calculated before.
+ The process of decision for each is as follows. For each MB, we loop
+ over the levels, and call DoLevelDecn. DoLevelDecn does motion
+ estimation if it's necessary. Then it assumes that we don't have a
+ common block mode and calls DoUnitDecn which finds the best mode for
+ each unit in the MB at that level, individually. Then we consider the
+ case where we say that all the modes will be the same, and call
+ DoCommonMode to see if we'll get a lower cost. Then when we've got a
+ best cost for that level we go up to the next one.
+ */
+ class ModeDecider
+ {
+
+ public:
+ //! Constructor
+ /*!
+ The constructor creates arrays for handling the motion vector data
+ at splitting levels 0 and 1, as motion
+ estimation must be performed for these levels.
+ */
+ ModeDecider(const EncoderParams& encp );
+
+ //! Destructor
+ /*!
+ The destructor destroys the classes created in the constructor
+ */
+ ~ModeDecider();
+
+ //! Does the actual mode decision
+ /*!
+ Does the mode decision
+ \param my_buffer the buffer of all the relevant frames
+ \param frame_num the frame number for which motion estimation is being done
+ \param me_data the motion vector data into which decisions will be written
+ */
+ void DoModeDecn( const FrameBuffer& my_buffer , int frame_num , MEData& me_data);
+
+ private:
+ ModeDecider( const ModeDecider& cpy );//private, body-less copy constructor: this class should not be copied
+ ModeDecider& operator=( const ModeDecider& rhs );//private, body-less assignment=: this class should not be assigned
+
+ //functions
+ void DoMBDecn(); //called by do_mode_decn for each MB
+
+ //! Make a mode decision given a particular level of decomposition
+ void DoLevelDecn( int level );
+
+ //! Decide on a mode for a given prediction unit (block, sub-MB or MB)
+ float DoUnitDecn( const int xpos , const int ypos , const int level );
+
+ //! Choose a common mode for all units in a MB assuming a particular level of decomposition
+ float DoCommonMode( PredMode& predmode , const int level);
+
+ //! Do motion estimation for a prediction unit at a given level
+ void DoME( const int xpos , const int ypos , const int level );
+
+
+ //! Return a measure of the cost of coding a given mode
+ float ModeCost( const int xindex , const int yindex , const PredMode predmode );
+
+ //! Get a prediction for the dc value of a block
+ ValueType GetDCPred( int xblock , int yblock );
+
+ //! Get a measure of DC value variance
+ float GetDCVar( const ValueType dc_val , const ValueType dc_pred);
+
+ // Member data
+ FrameSort fsort;
+
+ //! A local reference to the encoder params
+ const EncoderParams& m_encparams;
+
+ //! The Lagrangian parameter for motion estimation
+ float m_lambda;
+
+ //! Correction factor for comparing SAD costs for different MB splittings
+ OneDArray<float> m_level_factor;
+
+
+ //! Correction factor for comparing mode costs for different MB splittings
+ OneDArray<float> m_mode_factor;
+
+ //! Motion vector data for each level of splitting
+ OneDArray< MEData* > m_me_data_set;
+
+ const PicArray* m_pic_data;
+ const PicArray* m_ref1_updata;
+ const PicArray* m_ref2_updata;
+ int num_refs;
+
+ IntraBlockDiff* m_intradiff;
+ BiBChkBlockDiffUp* m_bicheckdiff;
+
+ //position variables, used in all the mode decisions
+ int m_xmb_loc,m_ymb_loc; //coords of the current MB
+
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_subpel.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_subpel.cpp
new file mode 100644
index 000000000..8ad3bb047
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_subpel.cpp
@@ -0,0 +1,215 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: me_subpel.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_motionest/me_subpel.h>
+#include <libdirac_common/frame_buffer.h>
+using namespace dirac;
+
+#include <iostream>
+
+using std::vector;
+
+SubpelRefine::SubpelRefine(const EncoderParams& encp):
+ m_encparams(encp),
+ m_nshift(4)
+{
+ //define the relative coordinates of the four neighbours
+ m_nshift[0].x = -1;
+ m_nshift[0].y = 0;
+
+ m_nshift[1].x = -1;
+ m_nshift[1].y = -1;
+
+ m_nshift[2].x = 0;
+ m_nshift[2].y = -1;
+
+ m_nshift[3].x = 1;
+ m_nshift[3].y = -1;
+
+}
+
+void SubpelRefine::DoSubpel(const FrameBuffer& my_buffer,int frame_num, MEData& me_data)
+{
+ //main loop for the subpel refinement
+ int ref1,ref2;
+
+ const FrameSort fsort = my_buffer.GetFrame(frame_num).GetFparams().FSort();
+
+ if (fsort != I_frame)
+ {
+ float lambda;
+
+ if ( fsort == L1_frame )
+ lambda = m_encparams.L1MELambda();
+ else
+ lambda = m_encparams.L2MELambda();
+
+ // Get the references
+ const vector<int>& refs = my_buffer.GetFrame(frame_num).GetFparams().Refs();
+
+ int num_refs = refs.size();
+ ref1 = refs[0];
+ if (num_refs>1)
+ ref2 = refs[1];
+ else
+ ref2 = ref1;
+
+ // Set up the lambda to be used
+ me_data.SetLambdaMap( num_refs , lambda );
+
+ const PicArray& pic_data = my_buffer.GetComponent(frame_num , Y_COMP);
+ const PicArray& refup1_data = my_buffer.GetUpComponent( ref1 , Y_COMP);
+ const PicArray& refup2_data = my_buffer.GetUpComponent( ref2 , Y_COMP);
+
+ // Now match the pictures
+ MatchPic( pic_data , refup1_data , me_data ,1 );
+
+ if (ref1 != ref2 )
+ MatchPic( pic_data , refup2_data , me_data ,2 );
+
+ }
+}
+
+void SubpelRefine::MatchPic(const PicArray& pic_data , const PicArray& refup_data , MEData& me_data ,
+ int ref_id)
+{
+ // Match a picture against a single reference. Loop over all the blocks
+ // doing the matching
+
+ // Initialisation //
+ ////////////////////
+
+ // Provide aliases for the appropriate motion vector data components
+ MvArray& mv_array = me_data.Vectors( ref_id );
+ TwoDArray<MvCostData>& pred_costs = me_data.PredCosts( ref_id );
+
+ // Provide a block matching object to do the work
+ BlockMatcher my_bmatch( pic_data , refup_data , m_encparams.LumaBParams(2) ,
+ mv_array , pred_costs );
+
+ // Do the work //
+ /////////////////
+
+ // Loop over all the blocks, doing the work
+
+ for (int yblock=0 ; yblock<m_encparams.YNumBlocks() ; ++yblock)
+ {
+ for (int xblock=0 ; xblock<m_encparams.XNumBlocks() ; ++xblock)
+ {
+ DoBlock(xblock , yblock , my_bmatch , me_data , ref_id );
+ }// xblock
+ }// yblock
+}
+
+
+void SubpelRefine::DoBlock(const int xblock , const int yblock ,
+ BlockMatcher& my_bmatch, MEData& me_data , const int ref_id )
+{
+ // For each block, home into the sub-pixel vector
+
+ // Provide aliases for the appropriate motion vector data components
+ MvArray& mv_array = me_data.Vectors( ref_id );
+ TwoDArray<MvCostData>& pred_costs = me_data.PredCosts( ref_id );
+
+ // The list of potential candidates
+ CandidateList cand_list;
+
+ const float loc_lambda = me_data.LambdaMap()[yblock][xblock];
+
+ // The prediction for the motion vector
+ const MVector mv_pred = GetPred( xblock , yblock , mv_array );
+
+ // Will use the integer vector as a guide - must multiply by 8 since we're
+ // doing 1/8th pixel accuracy
+ mv_array[yblock][xblock] = mv_array[yblock][xblock]<<3;
+
+ // Re-calculate at pixel accuracy, with correct predictor
+ pred_costs[yblock][xblock].mvcost = GetVar(mv_pred , mv_array[yblock][xblock]);
+ pred_costs[yblock][xblock].SetTotal( loc_lambda );
+
+ AddNewVlist( cand_list , mv_array[yblock][xblock] , 0 , 0 , 1 );// (creates a singleton list)
+
+ // Do half-pel accuracy
+ AddNewVlist(cand_list , mv_array[yblock][xblock] , 1 , 1 , 4);
+ cand_list.erase( cand_list.begin() );
+ my_bmatch.FindBestMatchSubp( xblock , yblock , cand_list, mv_pred, loc_lambda );
+
+ // Next , go down to 1/4-pixel accuracy
+ AddNewVlist(cand_list , mv_array[yblock][xblock] , 1 , 1 , 2);
+ cand_list.erase( cand_list.begin() );
+ my_bmatch.FindBestMatchSubp( xblock , yblock , cand_list, mv_pred, loc_lambda );
+
+ // Finally, do 1/8-pixel accuracy
+ AddNewVlist(cand_list , mv_array[yblock][xblock] , 1 , 1 , 1);
+ cand_list.erase( cand_list.begin() );
+ my_bmatch.FindBestMatchSubp( xblock , yblock , cand_list, mv_pred, loc_lambda );
+
+}
+
+
+MVector SubpelRefine::GetPred(int xblock,int yblock,const MvArray& mvarray)
+{
+ MVector mv_pred;
+ ImageCoords n_coords;
+ vector<MVector> neighbours;
+
+ if (xblock>0 && yblock>0 && xblock<mvarray.LastX())
+ {
+
+ for (int i=0 ; i<m_nshift.Length() ; ++i)
+ {
+ n_coords.x = xblock+m_nshift[i].x;
+ n_coords.y = yblock+m_nshift[i].y;
+ neighbours.push_back(mvarray[n_coords.y][n_coords.x]);
+
+ }// i
+ }
+ else
+ {
+ for (int i=0 ; i<m_nshift.Length(); ++i )
+ {
+ n_coords.x = xblock+m_nshift[i].x;
+ n_coords.y = yblock+m_nshift[i].y;
+ if (n_coords.x>=0 && n_coords.y>=0 && n_coords.x<mvarray.LengthX() && n_coords.y<mvarray.LengthY())
+ neighbours.push_back(mvarray[n_coords.y][n_coords.x]);
+ }// i
+ }
+
+ mv_pred = MvMedian(neighbours);
+
+ return mv_pred;
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_subpel.h b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_subpel.h
new file mode 100644
index 000000000..1c11904c3
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_subpel.h
@@ -0,0 +1,116 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: me_subpel.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _ME_SUBPEL_H_
+#define _ME_SUBPEL_H_
+
+#include <libdirac_common/common.h>
+#include <libdirac_common/motion.h>
+#include <libdirac_motionest/block_match.h>
+namespace dirac
+{
+
+ class FrameBuffer;
+ class MvData;
+ class PicArray;
+
+ //! The SubpelRefine class takes pixel-accurate motion vectors and refines them to 1/8-pixel accuracy
+ /*!
+ The SubpelRefine class takes pixel-accurate motion vectors and refines
+ them to 1/8-pixel accuracy. It uses references upconverted by a factor
+ of 2 in each dimension, with the remaining precision gained by doing
+ linear interpolation between values on-the-fly.
+ */
+ class SubpelRefine
+ {
+
+ public:
+ //! Constructor
+ /*!
+ The constructor initialises the encoder parameters.
+ \param cp the parameters used for controlling encoding
+ */
+ SubpelRefine(const EncoderParams& cp);
+
+ //! Destructor
+ ~SubpelRefine(){}
+
+ //! Does the actual sub-pixel refinement
+ /*!
+ Does the actual sub-pixel refinement.
+ \param my_buffer the buffer of pictures being used
+ \param frame_num the frame number on which motion estimation is being performed
+ \param me_data the motion vector data, into which the results will be written
+ */
+ void DoSubpel( const FrameBuffer& my_buffer , int frame_num , MEData& me_data );
+
+ private:
+ //! Private, body-less copy constructor: this class should not be copied
+ SubpelRefine( const SubpelRefine& cpy );
+
+ //! Private, body-less assignment=: this class should not be assigned
+ SubpelRefine& operator=( const SubpelRefine& rhs );
+
+ //! Match a picture from its (upconverted) reference, and record the block mvs
+ void MatchPic(const PicArray& pic_data , const PicArray& refup_data , MEData& me_data ,
+ int ref_id);
+
+ //! Match an individual block
+ void DoBlock( const int xblock , const int yblock ,
+ BlockMatcher& my_bmatch, MEData& me_data , const int ref_id );
+
+ //! Get a prediction for a block MV from the neighbouring blocks
+ MVector GetPred( int xblock , int yblock , const MvArray& mvarray );
+
+ //member variables
+
+ //! A local reference to the encoder params
+ const EncoderParams& m_encparams;
+
+ //! The list of candidate vectors being tested
+ CandidateList m_cand_list;
+
+ //! The relative coords of the set of neighbours used to generate MV predictions
+ OneDArray<ImageCoords> m_nshift;
+
+
+
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_utils.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_utils.cpp
new file mode 100644
index 000000000..e95defe38
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_utils.cpp
@@ -0,0 +1,470 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: me_utils.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author), Peter Meerwald (pmeerw@users.sourceforge.net)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+///////////////////////////////////
+//-------------------------------//
+//utilities for motion estimation//
+//-------------------------------//
+///////////////////////////////////
+
+#include <libdirac_motionest/me_utils.h>
+#include <libdirac_common/common.h>
+using namespace dirac;
+
+#include <algorithm>
+
+void BlockDiffParams::SetBlockLimits( const OLBParams& bparams ,
+ const PicArray& pic_data ,
+ const int xbpos , const int ybpos)
+{
+ const int loc_xp = xbpos * bparams.Xbsep() - bparams.Xoffset();
+ const int loc_yp = ybpos * bparams.Ybsep() - bparams.Yoffset();
+
+ m_xp=std::max( loc_xp , 0 );
+ m_yp=std::max( loc_yp , 0 );
+
+ m_xl = bparams.Xblen() - m_xp + loc_xp;
+ m_yl = bparams.Yblen() - m_yp + loc_yp;
+
+ //constrain block lengths to fall within the picture
+ m_xl = ( ( m_xp + m_xl - 1) > pic_data.LastX() ) ? ( pic_data.LastX() + 1 - m_xp ): m_xl;
+ m_yl = ( ( m_yp + m_yl - 1) > pic_data.LastY() ) ? ( pic_data.LastY() + 1 - m_yp ) : m_yl;
+
+}
+
+// Block difference class functions
+
+// Constructors ...
+
+BlockDiff::BlockDiff(const PicArray& ref,const PicArray& pic) :
+ pic_data( pic ),
+ ref_data( ref )
+{}
+
+SimpleBlockDiff::SimpleBlockDiff( const PicArray& ref , const PicArray& pic ) :
+ BlockDiff( ref , pic )
+{}
+
+BChkBlockDiff::BChkBlockDiff( const PicArray& ref , const PicArray& pic ) :
+ BlockDiff( ref , pic )
+{}
+
+IntraBlockDiff::IntraBlockDiff( const PicArray& pic ) :
+ pic_data( pic )
+{}
+
+BiBlockDiff::BiBlockDiff( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic) :
+ pic_data( pic ),
+ ref_data1( ref1 ),
+ ref_data2( ref2 )
+{}
+
+BiSimpleBlockDiff::BiSimpleBlockDiff( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic) :
+ BiBlockDiff(ref1 , ref2 , pic)
+{}
+
+BiBChkBlockDiff::BiBChkBlockDiff( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic ) :
+ BiBlockDiff(ref1 , ref2 , pic)
+{}
+
+BlockDiffUp::BlockDiffUp( const PicArray& ref , const PicArray& pic):
+ BlockDiff( ref , pic )
+{}
+
+SimpleBlockDiffUp::SimpleBlockDiffUp( const PicArray& ref , const PicArray& pic ) :
+ BlockDiffUp( ref , pic )
+{}
+
+BChkBlockDiffUp::BChkBlockDiffUp(const PicArray& ref,const PicArray& pic) :
+ BlockDiffUp( ref , pic )
+{}
+
+BiBlockDiffUp::BiBlockDiffUp( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic) :
+ BiBlockDiff( ref1 , ref2 , pic )
+{}
+
+BiSimpleBlockDiffUp::BiSimpleBlockDiffUp( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic ):
+ BiBlockDiffUp( ref1 , ref2 , pic)
+{}
+
+BiBChkBlockDiffUp::BiBChkBlockDiffUp( const PicArray& ref1 , const PicArray& ref2 ,
+ const PicArray& pic ) :
+ BiBlockDiffUp( ref1 , ref2 , pic)
+{}
+
+// Difference functions ...
+
+float SimpleBlockDiff::Diff( const BlockDiffParams& dparams, const MVector& mv )
+{
+
+ ValueType diff;
+
+ CalcValueType sum( 0 );
+
+ for (int j=dparams.Yp() ; j != dparams.Yp()+dparams.Yl() ; ++j )
+ {
+ for(int i=dparams.Xp() ; i!= dparams.Xp()+dparams.Xl() ; ++i )
+ {
+ diff = pic_data[j][i]-ref_data[j+mv.y][i+mv.x];
+ sum += std::abs( diff );
+ }// i, k
+ }// j, l
+
+ return static_cast<float>( sum );
+}
+
+float BChkBlockDiff::Diff( const BlockDiffParams& dparams, const MVector& mv )
+{
+
+ const int xmax = ref_data.LengthX();
+ const int ymax = ref_data.LengthY();
+
+ ValueType diff;
+
+ CalcValueType sum( 0 );
+
+ for ( int j=dparams.Yp() ; j!=dparams.Yp()+dparams.Yl() ; ++j )
+ {
+ for( int i=dparams.Xp() ; i!=dparams.Xp()+dparams.Xl() ; ++i )
+ {
+ diff = pic_data[j][i] - ref_data[BChk(j+mv.y , ymax)][BChk(i+mv.x , xmax)];
+ sum += std::abs( diff );
+
+ }// i
+ }// j
+
+ return static_cast<float>( sum );
+}
+
+float IntraBlockDiff::Diff( const BlockDiffParams& dparams , ValueType& dc_val )
+{
+
+ //computes the cost if block is predicted by its dc component
+
+ CalcValueType int_dc( 0 );
+
+ for ( int j=dparams.Yp() ; j!=dparams.Yp()+dparams.Yl() ; ++j)
+ for(int i=dparams.Xp(); i!=dparams.Xp()+dparams.Xl() ; ++i )
+ int_dc += static_cast<int>( pic_data[j][i] );
+
+ int_dc /= ( dparams.Xl() * dparams.Yl() );
+
+ // Just give dc to 8-bit accuracy
+ dc_val = static_cast<ValueType>( (int_dc+2)>>2 );
+
+ // Now compute the resulting SAD
+ ValueType dc( dc_val<<2 );
+ CalcValueType intra_cost( 0 );
+
+ for (int j=dparams.Yp(); j!=dparams.Yp()+dparams.Yl() ; ++j)
+ for( int i=dparams.Xp() ; i!=dparams.Xp()+dparams.Xl() ;++i )
+ intra_cost += std::abs( pic_data[j][i] - dc );
+
+ return static_cast<float>( intra_cost );
+}
+
+float BiSimpleBlockDiff::Diff( const BlockDiffParams& dparams, const MVector& mv1,const MVector& mv2){
+
+ CalcValueType sum( 0 );
+
+ ValueType diff;
+
+ for ( int j=dparams.Yp(); j!=dparams.Yp()+dparams.Yl(); ++j )
+ {
+ for( int i=dparams.Xp() ; i!=dparams.Xp()+dparams.Xl() ; ++i )
+ {
+ diff = pic_data[j][i]-( ( ref_data1[j+mv1.y][i+mv1.x] + 1 )>>1 );
+ diff -= ( ( ref_data2[j+mv2.y][i+mv2.x] + 1 )>>1 );
+
+ sum += std::abs( diff );
+ }// i
+ }// j
+
+ return static_cast<float>( sum );
+}
+
+float BiBChkBlockDiff::Diff( const BlockDiffParams& dparams, const MVector& mv1,const MVector& mv2){
+
+ ValueType diff;
+ const int xmax1 = ref_data1.LengthX();
+ const int ymax1 = ref_data1.LengthY();
+
+ const int xmax2 = ref_data2.LengthX();
+ const int ymax2 = ref_data2.LengthY();
+
+ CalcValueType sum( 0 );
+
+ for ( int j=dparams.Yp() ; j!=dparams.Yp() + dparams.Yl() ; ++j )
+ {
+ for( int i=dparams.Xp() ; i!=dparams.Xp() + dparams.Xl() ; ++i )
+ {
+ diff = pic_data[j][i]-( ( ref_data1[BChk(j+mv1.y , ymax1)][BChk(i+mv1.x , xmax1)] + 1 )>>1 );
+ diff -= ( ( ref_data2[BChk(j+mv2.y , ymax2)][BChk(i+mv2.x , xmax2)] + 1 )>>1 );
+
+ sum += std::abs( diff );
+ }// i
+ }// j
+
+ return static_cast<float>( sum );
+}
+
+float SimpleBlockDiffUp::Diff( const BlockDiffParams& dparams, const MVector& mv )
+{
+
+ //Coordinates in the image being written to
+ const ImageCoords StartPos(dparams.Xp(),dparams.Yp());
+ const ImageCoords EndPos(StartPos.x+dparams.Xl(),StartPos.y+dparams.Yl());
+
+ //the rounded motion vectors, accurate to 1/2 pel
+ //NB: bitshift rounds negative numbers DOWN, as required
+ const MVector roundvec(mv.x>>2,mv.y>>2);
+
+ //remainder, giving 1/8 pel accuracy, needed for linear interp
+ const MVector rmdr(mv.x-(roundvec.x<<2),mv.y-(roundvec.y<<2));
+
+ //Set up the start point in the reference image.
+ const ImageCoords RefStart((StartPos.x<<1) + roundvec.x,(StartPos.y<<1) + roundvec.y);
+
+
+ //weights for doing linear interpolation, calculated from the remainder values
+
+ const ValueType TLweight((4-rmdr.x)*(4-rmdr.y));
+ const ValueType TRweight(rmdr.x*(4-rmdr.y));
+ const ValueType BLweight((4-rmdr.x)*rmdr.y);
+ const ValueType BRweight(rmdr.x*rmdr.y);
+
+ CalcValueType sum( 0 );
+
+ ValueType temp;
+
+ for(int c = StartPos.y, uY = RefStart.y; c < EndPos.y; ++c, uY += 2){
+ for(int l = StartPos.x, uX = RefStart.x; l < EndPos.x; ++l, uX += 2){
+ temp = (
+ TLweight * ref_data[uY][uX] +
+ TRweight * ref_data[uY][uX+1] +
+ BLweight * ref_data[uY+1][uX] +
+ BRweight * ref_data[uY+1][uX+1] +
+ 8
+ )>>4;
+
+ sum += std::abs( pic_data[c][l] - temp );
+ }//l
+ }//c
+
+ return static_cast<float>( sum );
+}
+
+float BChkBlockDiffUp::Diff( const BlockDiffParams& dparams, const MVector& mv )
+{
+
+ //the picture sizes
+ const int DoubleXdim=ref_data.LengthX();
+ const int DoubleYdim=ref_data.LengthY();
+
+ //Coordinates in the image being written to
+ const ImageCoords StartPos(dparams.Xp(),dparams.Yp());
+ const ImageCoords EndPos(StartPos.x+dparams.Xl(),StartPos.y+dparams.Yl());
+
+ //the rounded motion vectors, accurate to 1/2 pel
+ //NB: bitshift rounds negative numbers DOWN, as required
+ const MVector roundvec(mv.x>>2,mv.y>>2);
+
+ //remainder, giving 1/8 pel accuracy, needed for linear interp
+ const MVector rmdr(mv.x-(roundvec.x<<2),mv.y-(roundvec.y<<2));
+
+ //Set up the start point in the reference image.
+ const ImageCoords RefStart((StartPos.x<<1) + roundvec.x,(StartPos.y<<1) + roundvec.y);
+
+
+ //weights for doing linear interpolation, calculated from the remainder values
+
+ const ValueType TLweight((4-rmdr.x)*(4-rmdr.y));
+ const ValueType TRweight(rmdr.x*(4-rmdr.y));
+ const ValueType BLweight((4-rmdr.x)*rmdr.y);
+ const ValueType BRweight(rmdr.x*rmdr.y);
+
+ CalcValueType sum( 0 );
+
+ ValueType temp;
+
+ for(int c = StartPos.y, uY = RefStart.y; c < EndPos.y; ++c, uY += 2)
+ {
+ for(int l = StartPos.x, uX = RefStart.x; l < EndPos.x; ++l, uX += 2)
+ {
+ temp = (
+ TLweight * ref_data[BChk(uY,DoubleYdim)][BChk(uX,DoubleXdim)] +
+ TRweight * ref_data[BChk(uY,DoubleYdim)][BChk(uX+1,DoubleXdim)] +
+ BLweight * ref_data[BChk(uY+1,DoubleYdim)][BChk(uX,DoubleXdim)] +
+ BRweight * ref_data[BChk(uY+1,DoubleYdim)][BChk(uX+1,DoubleXdim)] +
+ 8
+ )>>4;
+
+ sum += ( std::abs( pic_data[c][l] - temp ) );
+ }//l
+ }//c
+
+ return static_cast<float>( sum );
+
+}
+
+float BiSimpleBlockDiffUp::Diff( const BlockDiffParams& dparams, const MVector& mv1, const MVector& mv2){
+
+ //the start and end points in the current frame
+ const ImageCoords StartPos(dparams.Xp(),dparams.Yp());//Coordinates in the current image
+ const ImageCoords EndPos(StartPos.x+dparams.Xl(),StartPos.y+dparams.Yl());
+
+ //the motion vectors rounded to 1/2 pel accuracy
+ const MVector roundvec1(mv1.x>>2,mv1.y>>2);
+ const MVector roundvec2(mv2.x>>2,mv2.y>>2);
+
+ //the remainders giving 1/8 pel accuracy
+ const MVector rmdr1(mv1.x-(roundvec1.x<<2),mv1.y-(roundvec1.y<<2));
+ const MVector rmdr2(mv2.x-(roundvec2.x<<2),mv2.y-(roundvec2.y<<2));
+
+ //the starting points of the reference blocks in the reference images, to 1/2 pel accuracy
+ const ImageCoords RefStart1((StartPos.x<<1) + roundvec1.x,(StartPos.y<<1) + roundvec1.y);
+ const ImageCoords RefStart2((StartPos.x<<1) + roundvec2.x,(StartPos.y<<1) + roundvec2.y);
+
+ //weights for doing linear interpolation, calculated from the remainder values
+ const ValueType TLweight1((4-rmdr1.x)*(4-rmdr1.y));
+ const ValueType TRweight1(rmdr1.x*(4-rmdr1.y));
+ const ValueType BLweight1((4-rmdr1.x)*rmdr1.y);
+ const ValueType BRweight1(rmdr1.x*rmdr1.y);
+
+ const ValueType TLweight2((4-rmdr2.x)*(4-rmdr2.y));
+ const ValueType TRweight2(rmdr2.x*(4-rmdr2.y));
+ const ValueType BLweight2((4-rmdr2.x)*rmdr2.y);
+ const ValueType BRweight2(rmdr2.x*rmdr2.y);
+
+ CalcValueType temp;
+
+ CalcValueType sum( 0 );
+
+ for(int c = StartPos.y, uY1 = RefStart1.y,uY2=RefStart2.y; c < EndPos.y; ++c, uY1 += 2,uY2 += 2){
+ for(int l = StartPos.x, uX1 = RefStart1.x,uX2=RefStart2.x; l < EndPos.x; ++l, uX1 += 2, uX2 += 2){
+ temp = (
+ TLweight1 * ref_data1[uY1][uX1] +
+ TRweight1 * ref_data1[uY1][uX1+1] +
+ BLweight1 * ref_data1[uY1+1][uX1] +
+ BRweight1 * ref_data1[uY1+1][uX1+1] +
+ 16
+ )>>5;
+
+ temp += (
+ TLweight2 * ref_data2[uY2][uX2] +
+ TRweight2 * ref_data2[uY2][uX2+1] +
+ BLweight2 * ref_data2[uY2+1][uX2] +
+ BRweight2 * ref_data2[uY2+1][uX2+1] +
+ 16
+ )>>5;
+
+ sum += std::abs( pic_data[c][l] - temp );
+ }//l
+ }//c
+
+ return static_cast<float>( sum );
+}
+
+float BiBChkBlockDiffUp::Diff( const BlockDiffParams& dparams, const MVector& mv1, const MVector& mv2)
+{
+
+ //as above, but with bounds checking
+ const int xmax1 = ref_data1.LengthX();
+ const int ymax1 = ref_data1.LengthY();
+ const int xmax2 = ref_data2.LengthX();
+ const int ymax2 = ref_data2.LengthY();
+
+ //the start and end points in the current frame
+ const ImageCoords StartPos(dparams.Xp(),dparams.Yp());//Coordinates in the current image
+ const ImageCoords EndPos(StartPos.x+dparams.Xl(),StartPos.y+dparams.Yl());
+
+ //the motion vectors rounded to 1/2 pel accuracy
+ const MVector roundvec1(mv1.x>>2,mv1.y>>2);
+ const MVector roundvec2(mv2.x>>2,mv2.y>>2);
+
+ //the remainders giving 1/8 pel accuracy
+ const MVector rmdr1(mv1.x-(roundvec1.x<<2),mv1.y-(roundvec1.y<<2));
+ const MVector rmdr2(mv2.x-(roundvec2.x<<2),mv2.y-(roundvec2.y<<2));
+
+ //the starting points of the reference blocks in the reference images, to 1/2 pel accuracy
+ const ImageCoords RefStart1((StartPos.x<<1) + roundvec1.x,(StartPos.y<<1) + roundvec1.y);
+ const ImageCoords RefStart2((StartPos.x<<1) + roundvec2.x,(StartPos.y<<1) + roundvec2.y);
+
+ //weights for doing linear interpolation, calculated from the remainder values
+ const ValueType TLweight1((4-rmdr1.x)*(4-rmdr1.y));
+ const ValueType TRweight1(rmdr1.x*(4-rmdr1.y));
+ const ValueType BLweight1((4-rmdr1.x)*rmdr1.y);
+ const ValueType BRweight1(rmdr1.x*rmdr1.y);
+
+ const ValueType TLweight2((4-rmdr2.x)*(4-rmdr2.y));
+ const ValueType TRweight2(rmdr2.x*(4-rmdr2.y));
+ const ValueType BLweight2((4-rmdr2.x)*rmdr2.y);
+ const ValueType BRweight2(rmdr2.x*rmdr2.y);
+
+ CalcValueType temp;
+
+ CalcValueType sum( 0 );
+
+ for(int c = StartPos.y, uY1 = RefStart1.y,uY2=RefStart2.y; c < EndPos.y; ++c, uY1 += 2,uY2 += 2)
+ {
+ for(int l = StartPos.x, uX1 = RefStart1.x,uX2=RefStart2.x; l < EndPos.x; ++l, uX1 += 2, uX2 += 2)
+ {
+ temp = (
+ TLweight1 * ref_data1[BChk(uY1,ymax1)][BChk(uX1,xmax1)] +
+ TRweight1 * ref_data1[BChk(uY1,ymax1)][BChk(uX1+1,xmax1)] +
+ BLweight1 * ref_data1[BChk(uY1+1,ymax1)][BChk(uX1,xmax1)] +
+ BRweight1 * ref_data1[BChk(uY1+1,ymax1)][BChk(uX1+1,xmax1)] +
+ 16)>>5;
+
+ temp += (
+ TLweight2 * ref_data2[BChk(uY2,ymax2)][BChk(uX2,xmax2)] +
+ TRweight2 * ref_data2[BChk(uY2,ymax2)][BChk(uX2+1,xmax2)] +
+ BLweight2 * ref_data2[BChk(uY2+1,ymax2)][BChk(uX2,xmax2)] +
+ BRweight2 * ref_data2[BChk(uY2+1,ymax2)][BChk(uX2+1,xmax2)]+
+ 16)>>5;
+
+ sum += std::abs( pic_data[c][l] - temp );
+ }//l
+ }//c
+
+ return static_cast<float>( sum );
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_utils.h b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_utils.h
new file mode 100644
index 000000000..f1315f1dc
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/me_utils.h
@@ -0,0 +1,518 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: me_utils.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _ME_UTILS_H_
+#define _ME_UTILS_H_
+
+#include <algorithm>
+#include <libdirac_common/motion.h>
+#include <libdirac_common/common.h>
+namespace dirac
+{
+
+ ///////////////////////////////////
+ //Utilities for motion estimation//
+ //-------------------------------//
+ ///////////////////////////////////
+
+ //! A class encapsulating parameters for calculating a block difference value (a single instance of matching)
+ class BlockDiffParams
+ {
+
+ public:
+ //! Constructor
+ BlockDiffParams(){}
+
+ //! Constructor
+ BlockDiffParams( const int x_p , const int y_p , const int x_l , const int y_l):
+ m_xp(x_p),
+ m_yp(y_p),
+ m_xl(x_l),
+ m_yl(y_l)
+ {}
+
+ ////////////////////////////////////////////////////////////////////
+ //NB: Assume default copy constructor, assignment = and destructor//
+ ////////////////////////////////////////////////////////////////////
+
+ // Sets ...
+
+
+ //! Set the limits of the block to fit in a picture
+
+ void SetBlockLimits( const OLBParams& bparams ,
+ const PicArray& pic_data ,
+ const int xbpos , const int ybpos);
+
+ // ... and gets
+
+ //! Return the x-position of the top-left block corner
+ const int Xp() const {return m_xp;}
+
+ //! Return the y-position of the top-left block corner
+ const int Yp() const {return m_yp;}
+
+ //! Return the block width
+ const int Xl() const {return m_xl;}
+
+ //! Return the block height
+ const int Yl() const {return m_yl;}
+
+ private:
+
+ int m_xp;
+ int m_yp;
+ int m_xl;
+ int m_yl;
+
+ };
+
+ //////////////////////////////////////////////////
+ //----Different difference classes, so that-----//
+ //bounds-checking need only be done as necessary//
+ //////////////////////////////////////////////////
+
+ //! An abstract class for doing block difference calculations
+ class BlockDiff
+ {
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ BlockDiff( const PicArray& ref , const PicArray& pic );
+
+ //! Destructor
+ virtual ~BlockDiff(){}
+
+ //! Do the actual difference - virtual function must be overridden
+ /*!
+ Do the actual difference
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv the motion vector being used
+ */
+ virtual float Diff( const BlockDiffParams& dparams , const MVector& mv )=0;
+
+ protected:
+
+ const PicArray& pic_data;
+ const PicArray& ref_data;
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BlockDiff( const BlockDiff& cpy );
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BlockDiff& operator=( const BlockDiff& rhs );
+ };
+
+ //! A class for doing block differences without bounds-checking, inherited from BlockDiff
+ class SimpleBlockDiff: public BlockDiff
+ {
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ SimpleBlockDiff( const PicArray& ref , const PicArray& pic );
+
+ //! Do the actual difference without bounds checking
+ /*!
+ Do the actual difference without bounds checking
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv the motion vector being used
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv );
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ SimpleBlockDiff(const SimpleBlockDiff& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ SimpleBlockDiff& operator=(const SimpleBlockDiff& rhs);
+ };
+
+ //! A class for doing block differences with bounds-checking, inherited from BlockDiff
+ class BChkBlockDiff: public BlockDiff
+ {
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ BChkBlockDiff( const PicArray& ref , const PicArray& pic );
+
+ //! Do the actual difference with bounds checking
+ /*!
+ Do the actual difference with bounds checking
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv the motion vector being used
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv );
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BChkBlockDiff(const BChkBlockDiff& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BChkBlockDiff& operator=(const BChkBlockDiff& rhs);
+ };
+
+ //! A class for calculating the difference between a block and its DC value (average)
+ class IntraBlockDiff
+ {
+ public:
+ //! Constructor, initialising the picture data
+ /*
+ Constructor, initialising the picture data
+ \param pic the picture being matched
+ */
+ IntraBlockDiff( const PicArray& pic );
+
+ //! Do the actual difference
+ /*!
+ Do the actual difference
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param dc_val DC value
+ */
+ float Diff( const BlockDiffParams& dparams , ValueType& dc_val );
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ IntraBlockDiff(const IntraBlockDiff& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ IntraBlockDiff& operator=(const IntraBlockDiff& rhs);
+
+ const PicArray& pic_data;
+ };
+
+ //! A virtual class for bi-directional differences
+ class BiBlockDiff
+ {
+ public:
+ //! Constructor, initialising the references and picture data
+ /*
+ Constructor, initialising the references and picture data
+ \param ref1 the first reference picture
+ \param ref2 the second reference picture
+ \param pic the picture being matched
+ */
+ BiBlockDiff( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
+
+ //! Do the actual difference
+ /*!
+ Do the actual difference
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ virtual float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 )=0;
+
+ protected:
+ const PicArray& pic_data;
+ const PicArray& ref_data1;
+ const PicArray& ref_data2;
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiBlockDiff(const BiBlockDiff& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiBlockDiff& operator=(const BiBlockDiff& rhs);
+ };
+
+
+ //! A class for bi-directional differences with two references, and no bounds checking
+ class BiSimpleBlockDiff: public BiBlockDiff
+ {
+ public:
+
+ //! Constructor, initialising the references and picture data
+ /*
+ Constructor, initialising the references and picture data
+ \param ref1 the first reference picture
+ \param ref2 the second reference picture
+ \param pic the picture being matched
+ */
+ BiSimpleBlockDiff( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
+
+ //! Do the actual difference without bounds checking
+ /*!
+ Do the actual difference without bounds checking
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiSimpleBlockDiff(const BiSimpleBlockDiff& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiSimpleBlockDiff& operator=(const BiSimpleBlockDiff& rhs);
+
+ };
+
+ //! A class for bi-directional differences with two references, with bounds checking
+ class BiBChkBlockDiff: public BiBlockDiff
+ {
+ public:
+ //! Constructor, initialising the references and picture data
+ BiBChkBlockDiff( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic );
+
+ //! Do the actual difference with bounds checking
+ /*!
+ Do the actual difference with bounds checking
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiBChkBlockDiff(const BiBChkBlockDiff& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiBChkBlockDiff& operator=(const BiBChkBlockDiff& rhs);
+
+ };
+
+ // Classes where the reference is upconverted
+
+ //! An abstract class for doing block differences with an upconverted reference
+ class BlockDiffUp: public BlockDiff
+ {
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ BlockDiffUp( const PicArray& ref , const PicArray& pic);
+
+ //! Destructor
+ virtual ~BlockDiffUp(){}
+
+ //! Do the actual difference
+ /*!
+ Do the actual difference
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv the motion vector being used
+ */
+ virtual float Diff( const BlockDiffParams& dparams , const MVector& mv )=0;
+
+ protected:
+ //! A lookup table to simplify the 1/8 pixel accuracy code
+ int InterpLookup[9][4];
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BlockDiffUp(const BlockDiffUp& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BlockDiffUp& operator=(const BlockDiffUp& rhs);
+
+ };
+
+ //! A class for doing block differences without bounds-checking with upconverted references, inherited from BlockDiffUp
+ class SimpleBlockDiffUp: public BlockDiffUp
+ {
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ SimpleBlockDiffUp( const PicArray& ref , const PicArray& pic );
+
+ //! Destructor
+ ~SimpleBlockDiffUp(){}
+
+ //! Do the actual difference without bounds checking
+ /*!
+ Do the actual difference without bounds checking
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv the motion vector being used
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv );
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ SimpleBlockDiffUp(const SimpleBlockDiffUp& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ SimpleBlockDiffUp& operator=(const SimpleBlockDiffUp& rhs);
+ };
+
+ //! A class for doing block differences with bounds-checking with upconverted references, inherited from BlockDiffUp
+ class BChkBlockDiffUp: public BlockDiffUp{
+
+ public:
+ //! Constructor, initialising the reference and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref the reference picture
+ \param pic the picture being matched
+ */
+ BChkBlockDiffUp(const PicArray& ref,const PicArray& pic);
+
+ //! Destructor
+ ~BChkBlockDiffUp(){}
+
+ //! Do the actual difference with bounds checking
+ /*!
+ Do the actual difference with bounds checking
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv the motion vector being used
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv );
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BChkBlockDiffUp(const BChkBlockDiffUp& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BChkBlockDiffUp& operator=(const BChkBlockDiffUp& rhs);
+ };
+
+ //! An abstract class for doing block differences with two upconverted references
+ class BiBlockDiffUp: public BiBlockDiff
+ {
+ public:
+ //! Constructor, initialising the references and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref1 the first reference picture
+ \param ref2 the second reference picture
+ \param pic the picture being matched
+ */
+ BiBlockDiffUp( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic);
+
+ //! Destructor
+ virtual ~BiBlockDiffUp(){}
+
+ //! Do the actual difference
+ /*!
+ Do the actual difference
+ \param dparams the block parameters
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ virtual float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 )=0;
+ protected:
+ //! A lookup table to simplify the 1/8 pixel accuracy code
+ int InterpLookup[9][4];
+
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiBlockDiffUp(const BlockDiffUp& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiBlockDiffUp& operator=(const BlockDiffUp& rhs);
+
+ };
+
+ //! A class for doing bi-directional block differences without bounds checking
+ class BiSimpleBlockDiffUp: public BiBlockDiffUp
+ {
+ public:
+ //! Constructor, initialising the references and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref1 the first reference picture
+ \param ref2 the second reference picture
+ \param pic the picture being matched
+ */
+ BiSimpleBlockDiffUp( const PicArray& ref1 , const PicArray& ref2 , const PicArray& pic );
+
+ //! Do the actual difference without bounds checking
+ /*!
+ Do the actual difference without bounds checking
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiSimpleBlockDiffUp(const BiSimpleBlockDiffUp& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiSimpleBlockDiffUp& operator=(const BiSimpleBlockDiffUp& rhs);
+ };
+
+ //! A class for doing bi-directional block differences with bounds checking
+ class BiBChkBlockDiffUp: public BiBlockDiffUp
+ {
+ public:
+ //! Constructor, initialising the references and picture data
+ /*
+ Constructor, initialising the reference and picture data
+ \param ref1 the first reference picture
+ \param ref2 the second reference picture
+ \param pic the picture being matched
+ */
+ BiBChkBlockDiffUp( const PicArray& ref , const PicArray& ref2 , const PicArray& pic );
+
+ //! Do the actual difference with bounds checking
+ /*!
+ Do the actual difference with bounds checking
+ \param dparams the parameters in which costs, block parameters etc are stored
+ \param mv1 the motion vector being used for reference 1
+ \param mv2 the motion vector being used for reference 2
+ */
+ float Diff( const BlockDiffParams& dparams , const MVector& mv1 , const MVector& mv2 );
+ private:
+ //! Private, bodyless copy-constructor: class should not be copied
+ BiBChkBlockDiffUp(const BiBChkBlockDiffUp& cpy);
+
+ //! Private, bodyless assignment=: class should not be assigned
+ BiBChkBlockDiffUp& operator=(const BiBChkBlockDiffUp& rhs);
+ };
+
+} // namespace dirac
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/motion_estimate.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/motion_estimate.cpp
new file mode 100644
index 000000000..4425d4451
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/motion_estimate.cpp
@@ -0,0 +1,242 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: motion_estimate.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#include <libdirac_common/frame_buffer.h>
+#include <libdirac_motionest/motion_estimate.h>
+#include <libdirac_motionest/pixel_match.h>
+#include <libdirac_motionest/me_subpel.h>
+#include <libdirac_motionest/me_mode_decn.h>
+using namespace dirac;
+
+#include <cmath>
+#include <vector>
+
+MotionEstimator::MotionEstimator( const EncoderParams& encp ):
+ m_encparams( encp )
+{}
+
+bool MotionEstimator::DoME(const FrameBuffer& my_buffer, int frame_num, MEData& me_data)
+{
+
+ const FrameParams& fparams = my_buffer.GetFrame(frame_num).GetFparams();
+
+ // Step 1.
+ //Initial search gives vectors for each reference accurate to 1 pixel
+
+ PixelMatcher pix_match( m_encparams );
+ pix_match.DoSearch( my_buffer , frame_num , me_data);
+
+ // Step 2.
+ // Pixel accurate vectors are then refined to 1/8 of a pixel
+
+ SubpelRefine pelrefine( m_encparams );
+ pelrefine.DoSubpel( my_buffer , frame_num , me_data );
+
+
+ // Step3.
+ // We now have to decide how each macroblock should be split
+ // and which references should be used, and so on.
+
+ ModeDecider my_mode_dec( m_encparams );
+ my_mode_dec.DoModeDecn( my_buffer , frame_num , me_data );
+
+ // Finally, although not strictly part of motion estimation,
+ // we have to assign DC values for chroma components for
+ // blocks we're decided are intra.
+
+ if (fparams.CFormat() != Yonly)
+ SetChromaDC( my_buffer , frame_num , me_data );
+
+ return IsACut( me_data );
+
+}
+
+ValueType MotionEstimator::GetChromaBlockDC(const PicArray& pic_data,
+ int xunit , int yunit , int split)
+{
+ BlockDiffParams dparams;
+ dparams.SetBlockLimits( m_encparams.ChromaBParams( split ) ,
+ pic_data, xunit , yunit);
+
+ ValueType dc;
+
+ IntraBlockDiff intradiff( pic_data );
+
+ intradiff.Diff( dparams , dc );
+
+ return dc;
+}
+
+void MotionEstimator::SetChromaDC( const PicArray& pic_data , MvData& mv_data , CompSort csort )
+{
+
+ // Lower limit of block coords in MB
+ int xtl,ytl;
+ // Upper limit of block coords in MB
+ int xbr,ybr;
+
+ // Ditto, for subMBs
+ int xsubMBtl,ysubMBtl;
+ int xsubMBbr,ysubMBbr;
+
+ TwoDArray<ValueType>& dcarray = mv_data.DC( csort );
+
+ ValueType dc = 0;
+
+ // Coords of the prediction units (at appropriate level)
+ int xunit, yunit;
+
+ // The delimiters of the blocks contained in the prediction unit
+ int xstart, ystart;
+ int xend, yend;
+
+ int level;
+
+ for ( int ymb=0 ; ymb<mv_data.MBSplit().LengthY() ; ++ymb )
+ {
+ for ( int xmb=0 ; xmb<mv_data.MBSplit().LengthX() ; ++xmb )
+ {
+
+ level = mv_data.MBSplit()[ymb][xmb];
+
+ xtl = xmb<<2;
+ ytl = ymb<<2;
+ xbr = xtl+4;
+ ybr = ytl+4;
+
+ xsubMBtl = xmb<<1;
+ ysubMBtl = ymb<<1;
+ xsubMBbr = xsubMBtl+2;
+ ysubMBbr = ysubMBtl+2;
+
+
+ for (int j = 0 ; j<(1<<level) ;++j)
+ {
+ for (int i = 0 ; i<(1<<level) ;++i)
+ {
+ xunit = ( xmb<<level ) + i;
+ yunit = ( ymb<<level ) + j;
+
+ xstart = xunit<<( 2-level );
+ ystart = yunit<<( 2-level );
+
+ xend = xstart + ( 1<<( 2-level ) );
+ yend = ystart + ( 1<<( 2-level ) );
+
+ if ( mv_data.Mode()[ystart][xstart] == INTRA )
+ // Get the DC value for the unit
+ dc = GetChromaBlockDC( pic_data , xunit , yunit , level );
+
+ // Copy it into the corresponding blocks
+ for ( int q=ystart ; q< yend ; ++q )
+ for ( int p=xstart ; p< xend ; ++p )
+ dcarray[q][p] = dc;
+
+ }// i
+ }// j
+
+ }// xmb
+ }// ymb
+}
+
+void MotionEstimator::SetChromaDC( const FrameBuffer& my_buffer , int frame_num , MvData& mv_data)
+{
+
+ SetChromaDC( my_buffer.GetComponent( frame_num , U_COMP) , mv_data , U_COMP );
+ SetChromaDC( my_buffer.GetComponent( frame_num , V_COMP) , mv_data , V_COMP );
+
+}
+
+bool MotionEstimator::IsACut( const MEData& me_data ) const
+{
+ // Count the number of intra blocks
+ const TwoDArray<PredMode>& modes = me_data.Mode();
+
+ int count_intra = 0;
+ for ( int j=0 ; j<modes.LengthY() ; ++j )
+ {
+ for ( int i=0 ; i<modes.LengthX() ; ++i )
+ {
+ if ( modes[j][i] == INTRA )
+ count_intra++;
+ }
+ }// j
+
+ double intra_percent = 100.0*static_cast<double>( count_intra ) /
+ static_cast<double>( modes.LengthX() * modes.LengthY() );
+
+ if ( m_encparams.Verbose() )
+ std::cerr<<std::endl<<intra_percent<<"% of blocks are intra ";
+
+ // Check the size of SAD errors across reference 1
+ const TwoDArray<MvCostData>& pcosts = me_data.PredCosts( 1 );
+
+ // averege SAD across all relevant blocks
+ long double sad_average = 0.0;
+ // average SAD in a given block
+ long double block_average;
+ // the block parameters
+ const OLBParams& bparams = m_encparams.LumaBParams( 2 );
+ //the count of the relevant blocks
+ int block_count = 0;
+
+ for ( int j=0 ; j<pcosts.LengthY() ; ++j )
+ {
+ for ( int i=0 ; i<pcosts.LengthX() ; ++i )
+ {
+
+ if ( modes[j][i] == REF1_ONLY || modes[j][i] == REF1AND2 )
+ {
+ block_average = pcosts[j][i].SAD /
+ static_cast<long double>( bparams.Xblen() * bparams.Yblen() * 4 );
+ sad_average += block_average;
+ block_count++;
+ }
+
+ }// i
+ }// j
+
+ if ( block_count != 0)
+ sad_average /= static_cast<long double>( block_count );
+
+ if ( (sad_average > 30.0) || (intra_percent > 50.0) )
+ return true;
+ else
+ return false;
+
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/motion_estimate.h b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/motion_estimate.h
new file mode 100644
index 000000000..52c70ae8d
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/motion_estimate.h
@@ -0,0 +1,108 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: motion_estimate.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+
+#ifndef _MOTION_ESTIMATE_H_
+#define _MOTION_ESTIMATE_H_
+
+#include <libdirac_common/motion.h>
+namespace dirac
+{
+
+ class FrameBuffer;
+
+
+ //! Class to handle the whole motion estimation process.
+ /*!
+
+ Class to handle the whole motion estimation process, which works in
+ three stages.
+
+ First a pixel-accurate estimate is formed by looking at the current
+ frame data and the data from the reference frame(s). Motion vectors
+ are found for every block.
+
+ Second, these pixel-accurate motion vectors are refined to sub-pixel
+ accuracy. This means some sort of upconversion needs to be applied to
+ the reference. This can be done by actually upconverting the reference
+ to create a bigger picture or by doing some interpolation of values
+ on the fly.
+
+ Third, mode decisions have to be made. This means choosing which (if
+ any) reference to use for each block, and whether to use the same
+ motion vectors for groups of blocks together. A 2x2 group of blocks is
+ called a sub-MB and a 4x4 group of blocks is a MB (Macroblock). All
+ the MV data is organised by MB.
+ */
+ class MotionEstimator{
+ public:
+ //! Constructor
+ MotionEstimator( const EncoderParams& encp );
+ //! Destructor
+ ~MotionEstimator(){}
+
+ //! Do the motion estimation
+ bool DoME(const FrameBuffer& my_buffer , int frame_num , MEData& me_data);
+
+ private:
+ //! Copy constructor: private, body-less - class should not be copied
+ MotionEstimator( const MotionEstimator& cpy );
+
+ //! Assignment= : //private, body-less - class should not be assigned
+ MotionEstimator& operator=( const MotionEstimator& rhs );
+
+ //! Go through all the intra blocks and extract the chroma dc values to be coded
+ void SetChromaDC(const FrameBuffer& my_buffer, int frame_num, MvData& mv_data);
+
+ //! Called by previous fn for each component
+ void SetChromaDC(const PicArray& pic_data, MvData& mv_data,CompSort csort);
+
+ //! Called by previous fn for each block
+ ValueType GetChromaBlockDC(const PicArray& pic_data, int xloc,int yloc,int split);
+
+ //! Analyses the ME data and returns true if a cut is detected, false otherwise
+ bool IsACut( const MEData& ) const;
+
+ // Member variables
+
+ //! A local reference to the encoder parameters
+ const EncoderParams& m_encparams;
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/pixel_match.cpp b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/pixel_match.cpp
new file mode 100644
index 000000000..2e7ff26be
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/pixel_match.cpp
@@ -0,0 +1,337 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: pixel_match.cpp 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copm_yright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#include <libdirac_motionest/pixel_match.h>
+#include <libdirac_motionest/block_match.h>
+#include <libdirac_common/motion.h>
+#include <libdirac_common/frame_buffer.h>
+#include <libdirac_motionest/downconvert.h>
+#include <libdirac_motionest/me_mode_decn.h>
+#include <libdirac_motionest/me_subpel.h>
+using namespace dirac;
+
+#include <cmath>
+#include <vector>
+
+using std::vector;
+using std::log;
+
+PixelMatcher::PixelMatcher( const EncoderParams& encp):
+ m_encparams(encp)
+{}
+
+
+void PixelMatcher::DoSearch(const FrameBuffer& my_buffer, int frame_num, MEData& me_data)
+{
+
+ //does an initial search using hierarchical matching to get guide vectors
+
+ // Frame numbers of references
+ int ref1,ref2;
+
+ // Use the luminance only for motion estimating
+ const PicArray& pic_data = my_buffer.GetComponent( frame_num , Y_COMP );
+
+ const vector<int>& refs = my_buffer.GetFrame( frame_num ).GetFparams().Refs();
+ ref1 = refs[0];
+ if (refs.size()>1)
+ ref2 = refs[1];
+ else
+ ref2 = ref1;
+
+ // Obtain C++ references to the reference picture luma components
+ const PicArray& ref1_data = my_buffer.GetComponent(ref1 , Y_COMP);
+ const PicArray& ref2_data = my_buffer.GetComponent(ref2 , Y_COMP);
+
+ // Determine the frame sort - this affects the motion estimation Lagrangian parameter
+ m_fsort = my_buffer.GetFrame(frame_num).GetFparams().FSort();
+
+ // Set the number of downconversion levels - not too many or we run out of picture!
+ m_depth = ( int) std::min( log(((double) pic_data.LengthX())/12.0)/log(2.0) ,
+ log(((double) pic_data.LengthY())/12.0)/log(2.0) );
+
+ // These arrays will contain the downconverted picture and MvData hierarchy
+ OneDArray<PicArray*> ref1_down( Range( 1 , m_depth ) );
+ OneDArray<PicArray*> ref2_down( Range( 1 , m_depth ) );
+ OneDArray<PicArray*> pic_down( Range( 1 , m_depth ) );
+ OneDArray<MEData*> me_data_set( Range( 1 , m_depth ) );
+
+ // Populate the hierarchies
+ MakePicHierarchy( pic_data , pic_down );
+ MakePicHierarchy( ref1_data , ref1_down );
+ if (ref1 != ref2)
+ MakePicHierarchy( ref2_data , ref2_down );
+
+ MakeMEDataHierarchy( pic_down , me_data_set );
+
+ // Now do the work! //
+ //////////////////////
+
+ // Start with motion estimating at the very lowest level
+ m_level = m_depth;
+
+ MatchPic( *(pic_down[m_depth]) , *(ref1_down[m_depth]) , *(me_data_set[m_depth]) ,
+ *(me_data_set[m_depth]) , 1 );
+ if ( ref1 != ref2 )
+ MatchPic( *(pic_down[m_depth]) , *(ref2_down[m_depth]) , *(me_data_set[m_depth]) ,
+ *(me_data_set[m_depth]) , 2 );
+
+ // Do the intervening levels - here we can have a genuine set of guide vectors
+ for ( m_level=m_depth-1 ; m_level>=1 ; --m_level )
+ {
+ MatchPic( *(pic_down[m_level]) , *(ref1_down[m_level]) , *(me_data_set[m_level]) ,
+ *(me_data_set[m_level+1]) , 1 );
+ if (ref1!=ref2)
+ MatchPic( *(pic_down[m_level]) , *(ref2_down[m_level]) , *(me_data_set[m_level]) ,
+ *(me_data_set[m_level+1]) , 2 );
+
+ }// level
+
+ // Finally, do the top level, with the pictures themselves
+ m_level = 0;
+ MatchPic( pic_data , ref1_data, me_data , *(me_data_set[1]) , 1 );
+ if ( ref1 != ref2 )
+ MatchPic( pic_data , ref2_data , me_data , *(me_data_set[1]) , 2 );
+
+ // Now we're finished, tidy everything up ...
+ TidyPics( pic_down );
+ TidyPics( ref1_down );
+ if (ref1 != ref2)
+ TidyPics( ref2_down );
+ TidyMEData( me_data_set );
+
+}
+
+void PixelMatcher::MakePicHierarchy(const PicArray& data ,
+ OneDArray< PicArray* >& down_data)
+{
+
+ DownConverter mydcon;
+
+ // Allocate
+ int scale_factor = 1;
+ for (int i=1 ; i<=m_depth;++i)
+ {
+ // Dimensions of pic_down[i] will be shrunk by a factor 2**i
+ scale_factor*=2;
+ down_data[i] = new PicArray( data.LengthY()/scale_factor , data.LengthX()/scale_factor);
+ }
+
+ //do all the downconversions
+ if (m_depth>0)
+ {
+ mydcon.DoDownConvert( data , *(down_data[1]) );
+
+ for (int i=1 ; i<m_depth ; ++i)
+ mydcon.DoDownConvert( *(down_data[i]) , *(down_data[i+1]) );
+
+ }
+}
+
+void PixelMatcher::MakeMEDataHierarchy(const OneDArray< PicArray*>& down_data,
+ OneDArray< MEData* >& me_data_set )
+{
+
+ int xnumblocks , ynumblocks;
+ const OLBParams bparams = m_encparams.LumaBParams(2);
+
+ for (int i=1 ; i<=m_depth;++i)
+ {
+
+ xnumblocks = down_data[i]->LengthX()/bparams.Xbsep();
+ ynumblocks = down_data[i]->LengthY()/bparams.Ybsep();
+
+ if (( down_data[i]->LengthX() )%bparams.Xbsep() != 0)
+ xnumblocks++;
+
+ if (( down_data[i]->LengthY() )%bparams.Ybsep() != 0)
+ ynumblocks++;
+
+ me_data_set[i] = new MEData( 0 , 0 , xnumblocks , ynumblocks );
+ }// i
+
+}
+
+void PixelMatcher::TidyPics( OneDArray< PicArray*>& down_data )
+{
+ for (int i=1 ; i <= m_depth ; ++i)
+ {
+ delete down_data[i];
+ }// i
+
+}
+
+void PixelMatcher::TidyMEData( OneDArray< MEData*>& me_data_set )
+{
+ for (int i=1 ; i <= m_depth ; ++i)
+ {
+ delete me_data_set[i];
+ }// i
+
+}
+
+
+
+void PixelMatcher::MatchPic(const PicArray& pic_data , const PicArray& ref_data , MEData& me_data ,
+ const MvData& guide_data, int ref_id)
+{
+
+ // Initialisation //
+ ////////////////////
+
+ // Set the search ranges according to the level
+ if ( m_level == m_depth )
+ {
+ m_xr = 5;
+ m_yr = 5;
+ }
+ else if ( m_level == m_depth-1 )
+ {
+ m_xr = 4;
+ m_yr = 4;
+ }
+ else
+ {
+ m_xr = 2;
+ m_yr = 2;
+ }
+
+ // Provide aliases for the appropriate motion vector data components
+
+ MvArray& mv_array = me_data.Vectors( ref_id );
+ const MvArray& guide_array = guide_data.Vectors( ref_id );
+ TwoDArray<MvCostData>& pred_costs = me_data.PredCosts( ref_id );
+
+ // Provide a block matching object to do the work
+ BlockMatcher my_bmatch( pic_data , ref_data , m_encparams.LumaBParams(2) , mv_array , pred_costs );
+
+ float loc_lambda( 0.0 );
+
+ // Do the work - loop over all the blocks, finding the best match //
+ ////////////////////////////////////////////////////////////////////
+
+ /*
+ The idea is for each block construct a list of candidate vectors,which will
+ be tested. This list is actually a list of lists, implemented as a C++
+ vector of C++ vectors. This is so that FindBestMatch can shorten the
+ search process by looking at the beginning of each sublist and
+ discarding that sub-list if it's too far off.
+ */
+
+ // Make a zero-based list that is always used
+ m_cand_list.clear();
+ MVector zero_mv( 0 , 0 );
+ AddNewVlistD( m_cand_list , zero_mv , m_xr , m_yr);
+
+ // Now loop over the blocks and find the best matches.
+ // The loop is unrolled because predictions are different at picture edges.
+ // The purpose of the loop is to create appropriate candidate lists, and then
+ // call the DoBlock() function which does the actual work.
+
+ // First do TL corner
+
+ // Set the prediction as the zero vector
+ m_mv_prediction = zero_mv;
+
+ // m_lambda is the Lagrangian smoothing parameter set to zero to get us started
+ m_lambda = 0.0;
+ DoBlock(0, 0 , pred_costs , mv_array, guide_array , my_bmatch);
+
+ // The rest of the first row
+ // ( use reduced lambda here )
+ m_lambda = loc_lambda / float( m_encparams.YNumBlocks() );
+ for ( int xpos=1 ; xpos<mv_array.LengthX() ; ++xpos )
+ {
+ m_mv_prediction = mv_array[0][xpos-1];
+ DoBlock(xpos, 0 , pred_costs , mv_array, guide_array , my_bmatch);
+ }// xpos
+
+ // All the remaining rows except the last
+ for ( int ypos=1 ; ypos<mv_array.LengthY() ; ++ypos )
+ {
+
+ // The first element of each row
+ m_mv_prediction = mv_array[ypos-1][0];
+ m_lambda = loc_lambda/float(m_encparams.XNumBlocks());
+ DoBlock(0, ypos , pred_costs , mv_array, guide_array , my_bmatch );
+
+ // The middle elementes of each row
+ m_lambda = loc_lambda;
+ for ( int xpos=1 ; xpos<mv_array.LastX() ; ++xpos )
+ {
+ m_mv_prediction = MvMedian( mv_array[ypos][xpos-1],
+ mv_array[ypos-1][xpos],
+ mv_array[ypos-1][xpos+1]);
+ DoBlock(xpos, ypos , pred_costs , mv_array, guide_array , my_bmatch );
+
+ }// xpos
+
+ // The last element in each row
+ m_lambda = loc_lambda/float( m_encparams.XNumBlocks() );
+ m_mv_prediction = MvMean( mv_array[ypos-1][ mv_array.LastX() ],
+ mv_array[ypos][ mv_array.LastX()-1 ]);
+ DoBlock(mv_array.LastX() , ypos , pred_costs , mv_array, guide_array , my_bmatch );
+
+ }//ypos
+
+}
+
+void PixelMatcher::DoBlock(int xpos, int ypos ,
+ TwoDArray<MvCostData>& pred_costs,
+ MvArray& mv_array,
+ const MvArray& guide_array,
+ BlockMatcher& block_match)
+{
+
+ // Find the best match for each block ...
+
+ // Use guide from lower down if one exists
+ if ( m_level<m_depth )
+ AddNewVlistD( m_cand_list , guide_array[ ypos>>1 ][ xpos>>1 ] * 2 , m_xr , m_yr );
+
+ // use the spatial prediction, also, as a guide
+ AddNewVlistD( m_cand_list , m_mv_prediction , m_xr , m_yr );
+
+ // Find the best motion vector //
+ /////////////////////////////////
+
+ block_match.FindBestMatch( xpos , ypos , m_cand_list, m_mv_prediction, m_lambda );
+
+ // Reset the lists ready for the next block (don't erase the first sublist as
+ // this is a neighbourhood of zero, which we always look at)
+ m_cand_list.erase( m_cand_list.begin()+1 , m_cand_list.end() );
+}
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/pixel_match.h b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/pixel_match.h
new file mode 100644
index 000000000..2211edbe9
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_motionest/pixel_match.h
@@ -0,0 +1,144 @@
+/* ***** BEGIN LICENSE BLOCK *****
+*
+* $Id: pixel_match.h 280 2005-01-30 05:11:46Z gabest $ $Name$
+*
+* Version: MPL 1.1/GPL 2.0/LGPL 2.1
+*
+* The contents of this file are subject to the Mozilla Public License
+* Version 1.1 (the "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+* http://www.mozilla.org/MPL/
+*
+* Software distributed under the License is distributed on an "AS IS" basis,
+* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+* the specific language governing rights and limitations under the License.
+*
+* The Original Code is BBC Research and Development code.
+*
+* The Initial Developer of the Original Code is the British Broadcasting
+* Corporation.
+* Portions created by the Initial Developer are Copyright (C) 2004.
+* All Rights Reserved.
+*
+* Contributor(s): Thomas Davies (Original Author)
+*
+* Alternatively, the contents of this file may be used under the terms of
+* the GNU General Public License Version 2 (the "GPL"), or the GNU Lesser
+* Public License Version 2.1 (the "LGPL"), in which case the provisions of
+* the GPL or the LGPL are applicable instead of those above. If you wish to
+* allow use of your version of this file only under the terms of the either
+* the GPL or LGPL and not to allow others to use your version of this file
+* under the MPL, indicate your decision by deleting the provisions above
+* and replace them with the notice and other provisions required by the GPL
+* or LGPL. If you do not delete the provisions above, a recipient may use
+* your version of this file under the terms of any one of the MPL, the GPL
+* or the LGPL.
+* ***** END LICENSE BLOCK ***** */
+
+#ifndef _PIXEL_MATCH_H_
+#define _PIXEL_MATCH_H_
+
+/* *************************************************************************
+*
+* Class for getting motion vectors to pixel-accuracy
+*
+* The class could be implemented in any number of ways. The approach taken
+* has been to do hierarchical matching, which means doing block matching
+* on smaller, downcoverted versions of the pictures in order to get a wider
+* effective search range. At each level of searching the vectors discovered
+* can be used as guides to the next level of searching, and in this way
+* large motions can be detected easily. The danger is that the motions of
+* small objects can be overlooked.
+*
+* *************************************************************************/
+
+#include <libdirac_common/common.h>
+#include <libdirac_common/motion.h>
+#include <libdirac_motionest/block_match.h>
+namespace dirac
+{
+ class FrameBuffer;
+ class MvData;
+ class EncoderParams;
+ class PicArray;
+
+
+ class PixelMatcher
+ {
+ public:
+
+ //! Constructor
+ PixelMatcher( const EncoderParams& encp);
+
+ //! Do the actual search
+ /* Do the searching.
+
+ \param my_buffer the buffer of pictures from which frames are taken
+ \param frame_num the number of the frame for which motion is to be estimated
+ \param mv_data class in which the measured motion vectors are stored, together with costs
+
+ */
+ void DoSearch(const FrameBuffer& my_buffer,
+ int frame_num,
+ MEData& me_data);
+
+ private:
+
+ // Member variables
+
+ //! Local reference to the encoder
+ const EncoderParams& m_encparams;
+
+ // the depth of the hierarchical match
+ int m_depth;
+
+ // the level we're at (from 0 to depth)
+ int m_level;
+
+ // the search-range sizes for the hierarchical match
+ int m_xr, m_yr;
+
+ // the frame sort - I, L1 or L2
+ FrameSort m_fsort;
+
+ // list of candidate vectors for checking
+ CandidateList m_cand_list;
+
+ // Lagrangian lambda used for matching
+ float m_lambda;
+
+ // Prediction used for each block. This is derived from neighbouring blocks
+ // and is used to control the variation in the motion vector field.
+ MVector m_mv_prediction;
+
+ // Functions
+
+ //! Make down-converted pictures
+ void MakePicHierarchy(const PicArray& data, OneDArray< PicArray* >& down_data);
+
+ //! Make a hierarchy of MvData structures
+ void MakeMEDataHierarchy(const OneDArray< PicArray*>& down_data,
+ OneDArray< MEData* >& me_data_set );
+
+ //! Tidy up the allocations made in building the picture hirearchy
+ void TidyPics( OneDArray< PicArray*>& down_data );
+
+ //! Tidy up the allocations made in building the MV data hirearchy
+ void TidyMEData( OneDArray< MEData*>& me_data_set );
+
+ //! Match the picture data
+ void MatchPic(const PicArray& ref_data , const PicArray& pic_data , MEData& me_data ,
+ const MvData& guide_data, int ref_id);
+
+ //! Do a given block
+ void DoBlock(int xpos, int ypos ,
+ TwoDArray<MvCostData>& pred_costs,
+ MvArray& mv_array,
+ const MvArray& guide_array,
+ BlockMatcher& block_match);
+
+ };
+
+} // namespace dirac
+
+#endif
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_vs2005.vcproj b/src/filters/parser/diracsplitter/libdirac/libdirac_vs2005.vcproj
new file mode 100644
index 000000000..00c74c8e8
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_vs2005.vcproj
@@ -0,0 +1,464 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="libdirac"
+ ProjectGUID="{12BE3440-A1F3-4C48-A229-30CB619EA276}"
+ RootNamespace="libdirac"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ AdditionalIncludeDirectories="."
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../../lib/libdiracD.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="false"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories="."
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../../lib/libdiracR.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\libdirac_common\band_codec.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\bit_manager.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\block_match.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\cmd_line.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\common.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\comp_compress.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\comp_decompress.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\dirac_assertions.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\dirac_cppparser.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\dirac_encoder.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\dirac_parser.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\downconvert.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\frame.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\frame_buffer.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\frame_compress.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\frame_decompress.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\golomb.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_mode_decn.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_subpel.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_utils.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\mot_comp.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\motion.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\motion_estimate.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\mv_codec.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\pic_io.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\pixel_match.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\quality_monitor.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\seq_compress.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\seq_decompress.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\upconvert.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\wavelet_utils.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\libdirac_common\arith_codec.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\arrays.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\band_codec.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\bit_manager.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\block_match.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\cmd_line.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\common.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\common_types.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\comp_compress.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\comp_decompress.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\decoder_types.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\dirac_assertions.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\dirac_cppparser.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\dirac_encoder.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\dirac_parser.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\dirac_types.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\downconvert.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\frame.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\frame_buffer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\frame_compress.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\frame_decompress.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\golomb.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_mode_decn.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_subpel.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\me_utils.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\mot_comp.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\motion.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\motion_estimate.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\mv_codec.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\pic_io.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_motionest\pixel_match.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\quality_monitor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_encoder\seq_compress.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_decoder\seq_decompress.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\upconvert.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libdirac_common\wavelet_utils.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <File
+ RelativePath=".\ChangesForGuliverkli"
+ >
+ </File>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/diracsplitter/libdirac/libdirac_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/diracsplitter/libdirac/libdirac_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..12444eaab
--- /dev/null
+++ b/src/filters/parser/diracsplitter/libdirac/libdirac_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/diracsplitter/resource.h b/src/filters/parser/diracsplitter/resource.h
new file mode 100644
index 000000000..bdcfbe8c4
--- /dev/null
+++ b/src/filters/parser/diracsplitter/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by DiracSplitter.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/diracsplitter/stdafx.cpp b/src/filters/parser/diracsplitter/stdafx.cpp
new file mode 100644
index 000000000..8d2e22fce
--- /dev/null
+++ b/src/filters/parser/diracsplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// DiracSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/diracsplitter/stdafx.h b/src/filters/parser/diracsplitter/stdafx.h
new file mode 100644
index 000000000..7bf875d44
--- /dev/null
+++ b/src/filters/parser/diracsplitter/stdafx.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
+
+#include <atlbase.h>
+#include <atlcoll.h>
+
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include "..\..\..\DSUtil\vd.h"
+
+#pragma warning(disable: 4355) // 'this' : used in base member initializer list
+
+#include <libdirac_common/common.h>
+#include <libdirac_common/dirac_assertions.h>
+#include <libdirac_decoder/dirac_parser.h>
+
+using namespace dirac;
+
+#define isFrameStartCode(code) ((code) == IFRAME_START_CODE || (code) == L1FRAME_START_CODE || (code) == L2FRAME_START_CODE)
+
+
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter.cpp b/src/filters/parser/dsmsplitter/DSMSplitter.cpp
new file mode 100644
index 000000000..f302e7cad
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitter.cpp
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "DSMSplitter.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_DirectShowMedia},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CDSMSplitterFilter), L"DSM Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins},
+ {&__uuidof(CDSMSourceFilter), L"DSM Source", MERIT_NORMAL, 0, NULL},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDSMSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CDSMSourceFilter>, NULL, &sudFilter[1]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ CString str;
+ str.Format(_T("0,%d,,%%0%dI64x"), DSMSW_SIZE, DSMSW_SIZE*2);
+ str.Format(CString(str), DSMSW);
+
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_DirectShowMedia,
+ str, NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ UnRegisterSourceFilter(MEDIASUBTYPE_DirectShowMedia);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CDSMSplitterFilter
+//
+
+CDSMSplitterFilter::CDSMSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("CDSMSplitterFilter"), pUnk, phr, __uuidof(this))
+{
+}
+
+CDSMSplitterFilter::~CDSMSplitterFilter()
+{
+}
+
+static int compare_id(const void* id1, const void* id2) {return (int)*(BYTE*)id1 - (int)*(BYTE*)id2;}
+
+HRESULT CDSMSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+ m_pFile.Attach(new CDSMSplitterFile(pAsyncReader, hr, *this, *this));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->m_rtDuration;
+
+ CAtlArray<BYTE> ids;
+
+ POSITION pos = m_pFile->m_mts.GetStartPosition();
+ while(pos)
+ {
+ BYTE id;
+ CMediaType mt;
+ m_pFile->m_mts.GetNextAssoc(pos, id, mt);
+ ids.Add(id);
+ }
+
+ qsort(ids.GetData(), ids.GetCount(), sizeof(BYTE), compare_id);
+
+ for(int i = 0; i < ids.GetCount(); i++)
+ {
+ BYTE id = ids[i];
+ CMediaType& mt = m_pFile->m_mts[id];
+
+ CStringW name, lang;
+ name.Format(L"Output %02d", id);
+
+ CAtlArray<CMediaType> mts;
+ mts.Add(mt);
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, name, this, this, &hr));
+
+ name.Empty();
+
+ pos = m_pFile->m_sim[id].GetStartPosition();
+ while(pos)
+ {
+ CStringA key; CStringW value;
+ m_pFile->m_sim[id].GetNextAssoc(pos, key, value);
+ pPinOut->SetProperty(CStringW(key), value);
+
+ if(key == "NAME") name = value;
+ if(key == "LANG") if((lang = ISO6392ToLanguage(CStringA(CString(value)))).IsEmpty()) lang = value;
+ }
+
+ if(!name.IsEmpty() || !lang.IsEmpty())
+ {
+ if(!name.IsEmpty()) {if(!lang.IsEmpty()) name += L" (" + lang + L")";}
+ else if(!lang.IsEmpty()) name = lang;
+ pPinOut->SetName(name);
+ }
+
+ EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(id, pPinOut)));
+ }
+
+ pos = m_pFile->m_fim.GetStartPosition();
+ while(pos)
+ {
+ CStringA key; CStringW value;
+ m_pFile->m_fim.GetNextAssoc(pos, key, value);
+ SetProperty(CStringW(key), value);
+ }
+
+ for(int i = 0; i < m_resources.GetCount(); i++)
+ {
+ const CDSMResource& r = m_resources[i];
+ if(r.mime == "application/x-truetype-font")
+ m_fontinst.InstallFont(r.data);
+ }
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool CDSMSplitterFilter::DemuxInit()
+{
+ return true;
+}
+
+void CDSMSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ m_pFile->Seek(m_pFile->FindSyncPoint(rt));
+}
+
+bool CDSMSplitterFilter::DemuxLoop()
+{
+ HRESULT hr = S_OK;
+
+ while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetLength())
+ {
+ dsmp_t type;
+ UINT64 len;
+
+ if(!m_pFile->Sync(type, len))
+ continue;
+
+ __int64 pos = m_pFile->GetPos();
+
+ if(type == DSMP_SAMPLE)
+ {
+ CAutoPtr<Packet> p(new Packet());
+ if(m_pFile->Read(len, p))
+ {
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ p->rtStart -= m_pFile->m_rtFirst;
+ p->rtStop -= m_pFile->m_rtFirst;
+ }
+
+ hr = DeliverPacket(p);
+ }
+ }
+
+ m_pFile->Seek(pos + len);
+ }
+
+ return(true);
+}
+
+// IKeyFrameInfo
+
+STDMETHODIMP CDSMSplitterFilter::GetKeyFrameCount(UINT& nKFs)
+{
+ CheckPointer(m_pFile, E_UNEXPECTED);
+ nKFs = m_pFile->m_sps.GetCount();
+ return S_OK;
+}
+
+STDMETHODIMP CDSMSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
+{
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
+ CheckPointer(m_pFile, E_UNEXPECTED);
+
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
+
+ // these aren't really the keyframes, but quicky accessable points in the stream
+ for(nKFs = 0; nKFs < m_pFile->m_sps.GetCount(); nKFs++)
+ pKFs[nKFs] = m_pFile->m_sps[nKFs].rt;
+
+ return S_OK;
+}
+
+//
+// CDSMSourceFilter
+//
+
+CDSMSourceFilter::CDSMSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CDSMSplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter.def b/src/filters/parser/dsmsplitter/DSMSplitter.def
new file mode 100644
index 000000000..c5768b981
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "DSMSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter.h b/src/filters/parser/dsmsplitter/DSMSplitter.h
new file mode 100644
index 000000000..4fdb9f850
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitter.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "DSMSplitterFile.h"
+#include "..\BaseSplitter\BaseSplitter.h"
+
+[uuid("0912B4DD-A30A-4568-B590-7179EBB420EC")]
+class CDSMSplitterFilter : public CBaseSplitterFilter
+{
+protected:
+ CAutoPtr<CDSMSplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+public:
+ CDSMSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CDSMSplitterFilter();
+
+ // IKeyFrameInfo
+
+ STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+};
+
+[uuid("803E8280-F3CE-4201-982C-8CD8FB512004")]
+class CDSMSourceFilter : public CDSMSplitterFilter
+{
+public:
+ CDSMSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter.rc b/src/filters/parser/dsmsplitter/DSMSplitter.rc
new file mode 100644
index 000000000..2d6c82ca1
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,5
+ PRODUCTVERSION 1,0,0,5
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "DSM Splitter"
+ VALUE "FileVersion", "1, 0, 0, 5"
+ VALUE "InternalName", "DSM Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006"
+ VALUE "OriginalFilename", "DSMSplitter.ax"
+ VALUE "ProductName", "DSM Splitter"
+ VALUE "ProductVersion", "1, 0, 0, 5"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter.sln b/src/filters/parser/dsmsplitter/DSMSplitter.sln
new file mode 100644
index 000000000..bc55c766d
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitter.sln
@@ -0,0 +1,94 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMSplitter", "DSMSplitter.vcproj", "{1E91F58C-0BAE-4021-8087-D1864D8EC066}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug.ActiveCfg = Debug|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug lib.ActiveCfg = Debug lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release.ActiveCfg = Release|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release lib.ActiveCfg = Release lib|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {1E91F58C-0BAE-4021-8087-D1864D8EC066}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter.vcproj b/src/filters/parser/dsmsplitter/DSMSplitter.vcproj
new file mode 100644
index 000000000..20974a85f
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitter.vcproj
@@ -0,0 +1,561 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="DSMSplitter"
+ ProjectGUID="{1E91F58C-0BAE-4021-8087-D1864D8EC066}"
+ RootNamespace="DSMSplitter"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ IgnoreDefaultLibraryNames="libc.lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="DSMSplitter.cpp">
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="DSMSplitter.def">
+ </File>
+ <File
+ RelativePath=".\DSMSplitterFile.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="DSMSplitter.h">
+ </File>
+ <File
+ RelativePath=".\DSMSplitterFile.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\DSMSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/dsmsplitter/DSMSplitterFile.cpp b/src/filters/parser/dsmsplitter/DSMSplitterFile.cpp
new file mode 100644
index 000000000..50720ebf5
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitterFile.cpp
@@ -0,0 +1,397 @@
+#include "StdAfx.h"
+#include "DSMSplitterFile.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\..\include\moreuuids.h"
+
+CDSMSplitterFile::CDSMSplitterFile(IAsyncReader* pReader, HRESULT& hr, IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap)
+ : CBaseSplitterFile(pReader, hr)
+ , m_rtFirst(0)
+ , m_rtDuration(0)
+{
+ if(FAILED(hr)) return;
+
+ hr = Init(res, chap);
+}
+
+HRESULT CDSMSplitterFile::Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap)
+{
+ Seek(0);
+
+ if(BitRead(DSMSW_SIZE<<3) != DSMSW || BitRead(5) != DSMP_FILEINFO)
+ return E_FAIL;
+
+ Seek(0);
+
+ m_mts.RemoveAll();
+ m_rtFirst = m_rtDuration = 0;
+ m_fim.RemoveAll();
+ m_sim.RemoveAll();
+ res.ResRemoveAll();
+ chap.ChapRemoveAll();
+
+ dsmp_t type;
+ UINT64 len;
+ int limit = 65536;
+
+ // examine the beginning of the file ...
+
+ while(Sync(type, len, 0))
+ {
+ __int64 pos = GetPos();
+
+ if(type == DSMP_MEDIATYPE)
+ {
+ BYTE id;
+ CMediaType mt;
+ if(Read(len, id, mt)) m_mts[id] = mt;
+ }
+ else if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
+ {
+ m_rtFirst = p.rtStart;
+ break;
+ }
+ }
+ else if(type == DSMP_FILEINFO) {if((BYTE)BitRead(8) > DSMF_VERSION) return E_FAIL; Read(len-1, m_fim);}
+ else if(type == DSMP_STREAMINFO) {Read(len-1, m_sim[(BYTE)BitRead(8)]);}
+ else if(type == DSMP_SYNCPOINTS) {Read(len, m_sps);}
+ else if(type == DSMP_RESOURCE) {Read(len, res);}
+ else if(type == DSMP_CHAPTERS) {Read(len, chap);}
+
+ Seek(pos + len);
+ }
+
+ if(type != DSMP_SAMPLE)
+ return E_FAIL;
+
+ // ... and the end
+
+ for(int i = 1, j = (int)((GetLength()+limit/2)/limit); i <= j; i++)
+ {
+ __int64 seekpos = max(0, (__int64)GetLength()-i*limit);
+ Seek(seekpos);
+
+ while(Sync(type, len, limit) && GetPos() < seekpos+limit)
+ {
+ __int64 pos = GetPos();
+
+ if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
+ {
+ m_rtDuration = max(m_rtDuration, p.rtStop - m_rtFirst); // max isn't really needed, only for safety
+ i = j;
+ }
+ }
+ else if(type == DSMP_FILEINFO) {if((BYTE)BitRead(8) > DSMF_VERSION) return E_FAIL; Read(len-1, m_fim);}
+ else if(type == DSMP_STREAMINFO) {Read(len-1, m_sim[(BYTE)BitRead(8)]);}
+ else if(type == DSMP_SYNCPOINTS) {Read(len, m_sps);}
+ else if(type == DSMP_RESOURCE) {Read(len, res);}
+ else if(type == DSMP_CHAPTERS) {Read(len, chap);}
+
+ Seek(pos + len);
+ }
+ }
+
+ if(m_rtFirst < 0)
+ {
+ m_rtDuration += m_rtFirst;
+ m_rtFirst = 0;
+ }
+
+ return m_mts.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool CDSMSplitterFile::Sync(dsmp_t& type, UINT64& len, __int64 limit)
+{
+ UINT64 pos;
+ return Sync(pos, type, len, limit);
+}
+
+bool CDSMSplitterFile::Sync(UINT64& syncpos, dsmp_t& type, UINT64& len, __int64 limit)
+{
+ BitByteAlign();
+
+ limit += DSMSW_SIZE;
+
+ for(UINT64 id = 0; (id&((1ui64<<(DSMSW_SIZE<<3))-1)) != DSMSW; id = (id << 8) | (BYTE)BitRead(8))
+ {
+ if(limit-- <= 0 || GetPos() >= GetLength()-2)
+ return(false);
+ }
+
+ syncpos = GetPos() - (DSMSW_SIZE<<3);
+ type = (dsmp_t)BitRead(5);
+ len = BitRead(((int)BitRead(3)+1)<<3);
+
+ return(true);
+}
+
+bool CDSMSplitterFile::Read(__int64 len, BYTE& id, CMediaType& mt)
+{
+ id = (BYTE)BitRead(8);
+ ByteRead((BYTE*)&mt.majortype, sizeof(mt.majortype));
+ ByteRead((BYTE*)&mt.subtype, sizeof(mt.subtype));
+ mt.bFixedSizeSamples = (BOOL)BitRead(1);
+ mt.bTemporalCompression = (BOOL)BitRead(1);
+ mt.lSampleSize = (ULONG)BitRead(30);
+ ByteRead((BYTE*)&mt.formattype, sizeof(mt.formattype));
+ len -= 5 + sizeof(GUID)*3;
+ ASSERT(len >= 0);
+ if(len > 0) {mt.AllocFormatBuffer((LONG)len); ByteRead(mt.Format(), mt.FormatLength());}
+ else mt.ResetFormatBuffer();
+ return true;
+}
+
+bool CDSMSplitterFile::Read(__int64 len, Packet* p, bool fData)
+{
+ if(!p) return false;
+
+ p->TrackNumber = (DWORD)BitRead(8);
+ p->bSyncPoint = (BOOL)BitRead(1);
+ bool fSign = !!BitRead(1);
+ int iTimeStamp = (int)BitRead(3);
+ int iDuration = (int)BitRead(3);
+
+ if(fSign && !iTimeStamp)
+ {
+ ASSERT(!iDuration);
+ p->rtStart = Packet::INVALID_TIME;
+ p->rtStop = Packet::INVALID_TIME + 1;
+ }
+ else
+ {
+ p->rtStart = (REFERENCE_TIME)BitRead(iTimeStamp<<3) * (fSign ? -1 : 1);
+ p->rtStop = p->rtStart + BitRead(iDuration<<3);
+ }
+
+ if(fData)
+ {
+ p->SetCount((INT_PTR)len - (2 + iTimeStamp + iDuration));
+ ByteRead(p->GetData(), p->GetCount());
+ }
+
+ return true;
+}
+
+bool CDSMSplitterFile::Read(__int64 len, CAtlArray<SyncPoint>& sps)
+{
+ SyncPoint sp = {0, 0};
+ sps.RemoveAll();
+
+ while(len > 0)
+ {
+ bool fSign = !!BitRead(1);
+ int iTimeStamp = (int)BitRead(3);
+ int iFilePos = (int)BitRead(3);
+ BitRead(1); // reserved
+
+ sp.rt += (REFERENCE_TIME)BitRead(iTimeStamp<<3) * (fSign ? -1 : 1);
+ sp.fp += BitRead(iFilePos<<3);
+ sps.Add(sp);
+
+ len -= 1 + iTimeStamp + iFilePos;
+ }
+
+ if(len != 0)
+ {
+ sps.RemoveAll();
+ return false;
+ }
+
+ // TODO: sort sps
+
+ return true;
+}
+
+bool CDSMSplitterFile::Read(__int64 len, CStreamInfoMap& im)
+{
+ while(len >= 5)
+ {
+ CStringA key;
+ ByteRead((BYTE*)key.GetBufferSetLength(4), 4);
+ len -= 4;
+ len -= Read(len, im[key]);
+ }
+
+ return len == 0;
+}
+
+bool CDSMSplitterFile::Read(__int64 len, IDSMResourceBagImpl& res)
+{
+ BYTE compression = (BYTE)BitRead(2);
+ BYTE reserved = (BYTE)BitRead(6);
+ len--;
+
+ CDSMResource r;
+ len -= Read(len, r.name);
+ len -= Read(len, r.desc);
+ len -= Read(len, r.mime);
+
+ if(compression != 0) return false; // TODO
+
+ r.data.SetCount(len);
+ ByteRead(r.data.GetData(), r.data.GetCount());
+
+ res += r;
+
+ return true;
+}
+
+bool CDSMSplitterFile::Read(__int64 len, IDSMChapterBagImpl& chap)
+{
+ CDSMChapter c(0, L"");
+
+ while(len > 0)
+ {
+ bool fSign = !!BitRead(1);
+ int iTimeStamp = (int)BitRead(3);
+ BitRead(4); // reserved
+ len--;
+
+ c.rt += (REFERENCE_TIME)BitRead(iTimeStamp<<3) * (fSign ? -1 : 1);
+ len -= iTimeStamp;
+ len -= Read(len, c.name);
+
+ chap += c;
+ }
+
+ chap.ChapSort();
+
+ return len == 0;
+}
+
+__int64 CDSMSplitterFile::Read(__int64 len, CStringW& str)
+{
+ char c;
+ CStringA s;
+ __int64 i = 0;
+ while(i++ < len && (c = (char)BitRead(8)) != 0) s += c;
+ str = UTF8To16(s);
+ return i;
+}
+
+__int64 CDSMSplitterFile::FindSyncPoint(REFERENCE_TIME rt)
+{
+ if(/*!m_sps.IsEmpty()*/ m_sps.GetCount() > 1)
+ {
+ int i = range_bsearch(m_sps, m_rtFirst + rt);
+ return i >= 0 ? m_sps[i].fp : 0;
+ }
+
+ if(m_rtDuration <= 0 || rt <= m_rtFirst)
+ return 0;
+
+ // ok, do the hard way then
+
+ dsmp_t type;
+ UINT64 syncpos, len;
+
+ // 1. find some boundaries close to rt's position (minpos, maxpos)
+
+ __int64 minpos = 0, maxpos = GetLength();
+
+ for(int i = 0; i < 10 && (maxpos - minpos) >= 1024*1024; i++)
+ {
+ Seek((minpos + maxpos) / 2);
+
+ while(GetPos() < maxpos)
+ {
+ if(!Sync(syncpos, type, len))
+ continue;
+
+ __int64 pos = GetPos();
+
+ if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
+ {
+ REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
+ if(dt >= 0) maxpos = max((__int64)syncpos - 65536, minpos);
+ else minpos = syncpos;
+ break;
+ }
+ }
+
+ Seek(pos + len);
+ }
+ }
+
+ // 2. find the first packet just after rt (maxpos)
+
+ Seek(minpos);
+
+ while(GetPos() < GetLength())
+ {
+ if(!Sync(syncpos, type, len))
+ continue;
+
+ __int64 pos = GetPos();
+
+ if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME)
+ {
+ REFERENCE_TIME dt = (p.rtStart -= m_rtFirst) - rt;
+ if(dt >= 0) {maxpos = (__int64)syncpos; break;}
+ }
+ }
+
+ Seek(pos + len);
+ }
+
+ // 3. iterate backwards from maxpos and find at least one syncpoint for every stream, except for subtitle streams
+
+ CAtlMap<BYTE,BYTE> ids;
+
+ {
+ POSITION pos = m_mts.GetStartPosition();
+ while(pos)
+ {
+ BYTE id;
+ CMediaType mt;
+ m_mts.GetNextAssoc(pos, id, mt);
+ if(mt.majortype != MEDIATYPE_Text && mt.majortype != MEDIATYPE_Subtitle)
+ ids[id] = 0;
+ }
+ }
+
+ __int64 ret = maxpos;
+
+ while(maxpos > 0 && !ids.IsEmpty())
+ {
+ minpos = max(0, maxpos - 65536);
+
+ Seek(minpos);
+
+ while(Sync(syncpos, type, len) && GetPos() < maxpos)
+ {
+ UINT64 pos = GetPos();
+
+ if(type == DSMP_SAMPLE)
+ {
+ Packet p;
+ if(Read(len, &p, false) && p.rtStart != Packet::INVALID_TIME && p.bSyncPoint)
+ {
+ BYTE id = (BYTE)p.TrackNumber, tmp;
+ if(ids.Lookup(id, tmp))
+ {
+ ids.RemoveKey((BYTE)p.TrackNumber);
+ ret = min(ret, (__int64)syncpos);
+ }
+ }
+ }
+
+ Seek(pos + len);
+ }
+
+ maxpos = minpos;
+ }
+
+ return ret;
+}
diff --git a/src/filters/parser/dsmsplitter/DSMSplitterFile.h b/src/filters/parser/dsmsplitter/DSMSplitterFile.h
new file mode 100644
index 000000000..cc7b70dd5
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitterFile.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+#include "..\..\..\..\include\dsm\dsm.h"
+#include "..\..\..\DSUtil\DSMPropertyBag.h"
+
+class CDSMSplitterFile : public CBaseSplitterFile
+{
+ HRESULT Init(IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap);
+
+public:
+ CDSMSplitterFile(IAsyncReader* pReader, HRESULT& hr, IDSMResourceBagImpl& res, IDSMChapterBagImpl& chap);
+
+ CAtlMap<BYTE, CMediaType> m_mts;
+ REFERENCE_TIME m_rtFirst, m_rtDuration;
+
+ struct SyncPoint {REFERENCE_TIME rt; __int64 fp;};
+ CAtlArray<SyncPoint> m_sps;
+
+ typedef CAtlMap<CStringA, CStringW, CStringElementTraits<CStringA>, CStringElementTraits<CStringW> > CStreamInfoMap;
+ CStreamInfoMap m_fim;
+ CAtlMap<BYTE, CStreamInfoMap> m_sim;
+
+ bool Sync(dsmp_t& type, UINT64& len, __int64 limit = 65536);
+ bool Sync(UINT64& syncpos, dsmp_t& type, UINT64& len, __int64 limit = 65536);
+ bool Read(__int64 len, BYTE& id, CMediaType& mt);
+ bool Read(__int64 len, Packet* p, bool fData = true);
+ bool Read(__int64 len, CAtlArray<SyncPoint>& sps);
+ bool Read(__int64 len, CStreamInfoMap& im);
+ bool Read(__int64 len, IDSMResourceBagImpl& res);
+ bool Read(__int64 len, IDSMChapterBagImpl& chap);
+ __int64 Read(__int64 len, CStringW& str);
+
+ __int64 FindSyncPoint(REFERENCE_TIME rt);
+};
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter_vs2005.vcproj b/src/filters/parser/dsmsplitter/DSMSplitter_vs2005.vcproj
new file mode 100644
index 000000000..39f92d556
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitter_vs2005.vcproj
@@ -0,0 +1,813 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="DSMSplitter"
+ ProjectGUID="{1E91F58C-0BAE-4021-8087-D1864D8EC066}"
+ RootNamespace="DSMSplitter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ IgnoreDefaultLibraryNames="libc.lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="DSMSplitter.cpp"
+ >
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="DSMSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath=".\DSMSplitterFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="DSMSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\DSMSplitterFile.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\DSMSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/dsmsplitter/DSMSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/dsmsplitter/DSMSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/DSMSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/dsmsplitter/resource.h b/src/filters/parser/dsmsplitter/resource.h
new file mode 100644
index 000000000..66d1331cb
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by DSMSplitter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/dsmsplitter/stdafx.cpp b/src/filters/parser/dsmsplitter/stdafx.cpp
new file mode 100644
index 000000000..0a00e1846
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// DSMSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/dsmsplitter/stdafx.h b/src/filters/parser/dsmsplitter/stdafx.h
new file mode 100644
index 000000000..67593bb9b
--- /dev/null
+++ b/src/filters/parser/dsmsplitter/stdafx.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+#include <atlcoll.h>
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/parser/matroskasplitter/MatroskaFile.cpp b/src/filters/parser/matroskasplitter/MatroskaFile.cpp
new file mode 100644
index 000000000..e4e23dfb3
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaFile.cpp
@@ -0,0 +1,1177 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "MatroskaFile.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\zlib\zlib.h"
+
+#define DOCTYPE _T("matroska")
+#define DOCTYPEVERSION 2
+
+static void LOG(LPCTSTR fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ if(FILE* f = _tfopen(_T("c:\\matroskasplitterlog.txt"), _T("at")))
+ {
+ fseek(f, 0, 2);
+ _vftprintf(f, fmt, args);
+ fclose(f);
+ }
+ va_end(args);
+}
+
+using namespace MatroskaReader;
+
+#define BeginChunk \
+ CheckPointer(pMN0, E_POINTER); \
+\
+ CAutoPtr<CMatroskaNode> pMN = pMN0->Child(); \
+ if(!pMN) return S_FALSE; \
+\
+ do \
+ { \
+ switch(pMN->m_id) \
+ { \
+
+#define EndChunk \
+ } \
+ } \
+ while(pMN->Next()); \
+\
+ return S_OK; \
+
+static void bswap(BYTE* s, int len)
+{
+ for(BYTE* d = s + len-1; s < d; s++, d--)
+ *s ^= *d, *d ^= *s, *s ^= *d;
+}
+
+//
+// CMatroskaFile
+//
+
+CMatroskaFile::CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
+ , m_rtOffset(0)
+{
+ if(FAILED(hr)) return;
+ hr = Init();
+}
+
+HRESULT CMatroskaFile::Init()
+{
+ DWORD dw;
+ if(FAILED(Read(dw)) || dw != 0x1A45DFA3)
+ return E_FAIL;
+
+ CMatroskaNode Root(this);
+ if(FAILED(Parse(&Root)))
+ return E_FAIL;
+
+ CAutoPtr<CMatroskaNode> pSegment, pCluster;
+ if((pSegment = Root.Child(0x18538067))
+ && (pCluster = pSegment->Child(0x1F43B675)))
+ {
+ Cluster c0;
+ c0.ParseTimeCode(pCluster);
+ m_rtOffset = m_segment.GetRefTime(c0.TimeCode);
+ }
+
+ return S_OK;
+}
+
+template <class T>
+HRESULT CMatroskaFile::Read(T& var)
+{
+ HRESULT hr = ByteRead((BYTE*)&var, sizeof(var));
+ if(S_OK == hr) bswap((BYTE*)&var, sizeof(var));
+ return hr;
+}
+
+HRESULT CMatroskaFile::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x1A45DFA3:
+ m_ebml.Parse(pMN);
+ if(m_ebml.DocType != DOCTYPE || m_ebml.DocTypeReadVersion > DOCTYPEVERSION)
+ return E_FAIL;
+ break;
+ case 0x18538067: if(m_segment.SegmentInfo.SegmentUID.IsEmpty()) m_segment.ParseMinimal(pMN); break;
+ EndChunk
+}
+
+//
+
+HRESULT EBML::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x4286: EBMLVersion.Parse(pMN); break;
+ case 0x42F7: EBMLReadVersion.Parse(pMN); break;
+ case 0x42F2: EBMLMaxIDLength.Parse(pMN); break;
+ case 0x42F3: EBMLMaxSizeLength.Parse(pMN); break;
+ case 0x4282: DocType.Parse(pMN); break;
+ case 0x4287: DocTypeVersion.Parse(pMN); break;
+ case 0x4285: DocTypeReadVersion.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT Segment::Parse(CMatroskaNode* pMN0)
+{
+ pos = pMN0->GetPos();
+
+ BeginChunk
+ case 0x1549A966: SegmentInfo.Parse(pMN); break;
+ case 0x114D9B74: MetaSeekInfo.Parse(pMN); break;
+ case 0x1654AE6B: Tracks.Parse(pMN); break;
+ case 0x1F43B675: Clusters.Parse(pMN); break;
+ case 0x1C53BB6B: Cues.Parse(pMN); break;
+ case 0x1941A469: Attachments.Parse(pMN); break;
+ case 0x1043A770: Chapters.Parse(pMN); break;
+// case 0x1254C367: Tags.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT Segment::ParseMinimal(CMatroskaNode* pMN0)
+{
+ CheckPointer(pMN0, E_POINTER);
+
+ pos = pMN0->GetPos();
+ len = pMN0->m_len;
+
+ CAutoPtr<CMatroskaNode> pMN = pMN0->Child();
+ if(!pMN) return S_FALSE;
+
+ int n = 0;
+
+ do
+ {
+ switch(pMN->m_id)
+ {
+ case 0x1549A966: SegmentInfo.Parse(pMN); n++; break;
+ case 0x114D9B74: MetaSeekInfo.Parse(pMN); n++; break;
+ case 0x1654AE6B: Tracks.Parse(pMN); n++; break;
+ case 0x1C53BB6B: Cues.Parse(pMN); break;
+ }
+ }
+ while(n < 3 && pMN->Next());
+
+ while(QWORD pos = pMN->FindPos(0x114D9B74, pMN->GetPos()))
+ {
+ pMN->SeekTo(pos);
+ pMN->Parse();
+ if(pMN->m_id != 0x114D9B74) {ASSERT(0); break;}
+ MetaSeekInfo.Parse(pMN);
+ }
+
+ if(n == 3)
+ {
+ if(Cues.IsEmpty() && (pMN = pMN0->Child(0x1C53BB6B, false)))
+ {
+ do {Cues.Parse(pMN);} while(pMN->Next(true));
+ }
+
+ if(Chapters.IsEmpty() && (pMN = pMN0->Child(0x1043A770, false)))
+ {
+ do {Chapters.Parse(pMN); /*BIG UGLY HACK:*/ break;} while(pMN->Next(true));
+ }
+
+ if(Attachments.IsEmpty() && (pMN = pMN0->Child(0x1941A469, false)))
+ {
+ do {Attachments.Parse(pMN); /*BIG UGLY HACK:*/ break;} while (pMN->Next(true));
+ }
+ }
+
+ return S_OK;
+}
+
+UINT64 Segment::GetMasterTrack()
+{
+ UINT64 TrackNumber = 0, AltTrackNumber = 0;
+
+ POSITION pos1 = Tracks.GetHeadPosition();
+ while(pos1 && TrackNumber == 0)
+ {
+ Track* pT = Tracks.GetNext(pos1);
+
+ POSITION pos2 = pT->TrackEntries.GetHeadPosition();
+ while(pos2 && TrackNumber == 0)
+ {
+ TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
+
+ if(pTE->TrackType == TrackEntry::TypeVideo)
+ {
+ TrackNumber = pTE->TrackNumber;
+ break;
+ }
+ else if(pTE->TrackType == TrackEntry::TypeAudio && AltTrackNumber == 0)
+ {
+ AltTrackNumber = pTE->TrackNumber;
+ }
+ }
+ }
+
+ if(TrackNumber == 0) TrackNumber = AltTrackNumber;
+ if(TrackNumber == 0) TrackNumber = 1;
+
+ return TrackNumber;
+}
+
+ChapterAtom* ChapterAtom::FindChapterAtom(UINT64 id)
+{
+ if(ChapterUID == id)
+ return(this);
+
+ POSITION pos = ChapterAtoms.GetHeadPosition();
+ while(pos)
+ {
+ ChapterAtom* ca = ChapterAtoms.GetNext(pos)->FindChapterAtom(id);
+ if(ca) return ca;
+ }
+
+ return(NULL);
+}
+
+ChapterAtom* Segment::FindChapterAtom(UINT64 id, int nEditionEntry)
+{
+ POSITION pos1 = Chapters.GetHeadPosition();
+ while(pos1)
+ {
+ Chapter* c = Chapters.GetNext(pos1);
+
+ POSITION pos2 = c->EditionEntries.GetHeadPosition();
+ while(pos2)
+ {
+ EditionEntry* ee = c->EditionEntries.GetNext(pos2);
+
+ if(nEditionEntry-- == 0)
+ {
+ return id == 0 ? ee : ee->FindChapterAtom(id);
+ }
+ }
+ }
+
+ return(NULL);
+}
+
+HRESULT Info::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x73A4: SegmentUID.Parse(pMN); break;
+ case 0x7384: SegmentFilename.Parse(pMN); break;
+ case 0x3CB923: PrevUID.Parse(pMN); break;
+ case 0x3C83AB: PrevFilename.Parse(pMN); break;
+ case 0x3EB923: NextUID.Parse(pMN); break;
+ case 0x3E83BB: NextFilename.Parse(pMN); break;
+ case 0x2AD7B1: TimeCodeScale.Parse(pMN); break;
+ case 0x4489: Duration.Parse(pMN); break;
+ case 0x4461: DateUTC.Parse(pMN); break;
+ case 0x7BA9: Title.Parse(pMN); break;
+ case 0x4D80: MuxingApp.Parse(pMN); break;
+ case 0x5741: WritingApp.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT Seek::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x4DBB: SeekHeads.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT SeekHead::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x53AB: SeekID.Parse(pMN); break;
+ case 0x53AC: SeekPosition.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT Track::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xAE: TrackEntries.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT TrackEntry::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xD7: TrackNumber.Parse(pMN); break;
+ case 0x73C5: TrackUID.Parse(pMN); break;
+ case 0x83: TrackType.Parse(pMN); break;
+ case 0xB9: FlagEnabled.Parse(pMN); break;
+ case 0x88: FlagDefault.Parse(pMN); break;
+ case 0x9C: FlagLacing.Parse(pMN); break;
+ case 0x6DE7: MinCache.Parse(pMN); break;
+ case 0x6DF8: MaxCache.Parse(pMN); break;
+ case 0x536E: Name.Parse(pMN); break;
+ case 0x22B59C: Language.Parse(pMN); break;
+ case 0x86: CodecID.Parse(pMN); break;
+ case 0x63A2: CodecPrivate.Parse(pMN); break;
+ case 0x258688: CodecName.Parse(pMN); break;
+ case 0x3A9697: CodecSettings.Parse(pMN); break;
+ case 0x3B4040: CodecInfoURL.Parse(pMN); break;
+ case 0x26B240: CodecDownloadURL.Parse(pMN); break;
+ case 0xAA: CodecDecodeAll.Parse(pMN); break;
+ case 0x6FAB: TrackOverlay.Parse(pMN); break;
+ case 0x23E383: case 0x2383E3: DefaultDuration.Parse(pMN); break;
+ case 0x23314F: TrackTimecodeScale.Parse(pMN); break;
+ case 0xE0: if(S_OK == v.Parse(pMN)) DescType |= DescVideo; break;
+ case 0xE1: if(S_OK == a.Parse(pMN)) DescType |= DescAudio; break;
+ case 0x6D80: ces.Parse(pMN); break;
+ EndChunk
+}
+
+static int cesort(const void* a, const void* b)
+{
+ UINT64 ce1 = ((ContentEncoding*)a)->ContentEncodingOrder;
+ UINT64 ce2 = ((ContentEncoding*)b)->ContentEncodingOrder;
+
+ return (int)ce1 - (int)ce2;
+}
+
+bool TrackEntry::Expand(CBinary& data, UINT64 Scope)
+{
+ if(ces.ce.GetCount() == 0) return(true);
+
+ CAtlArray<ContentEncoding*> cearray;
+ POSITION pos = ces.ce.GetHeadPosition();
+ while(pos) cearray.Add(ces.ce.GetNext(pos));
+ qsort(cearray.GetData(), cearray.GetCount(), sizeof(ContentEncoding*), cesort);
+
+ for(int i = cearray.GetCount()-1; i >= 0; i--)
+ {
+ ContentEncoding* ce = cearray[i];
+
+ if(!(ce->ContentEncodingScope & Scope))
+ continue;
+
+ if(ce->ContentEncodingType == ContentEncoding::Compression)
+ {
+ if(!data.Decompress(ce->cc))
+ return(false);
+ }
+ else if(ce->ContentEncodingType == ContentEncoding::Encryption)
+ {
+ // TODO
+ return(false);
+ }
+ }
+
+ return(true);
+}
+
+HRESULT Video::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x9A: FlagInterlaced.Parse(pMN); break;
+ case 0x53B8: StereoMode.Parse(pMN); break;
+ case 0xB0: PixelWidth.Parse(pMN); break;
+ case 0xBA: PixelHeight.Parse(pMN); break;
+ case 0x54B0: DisplayWidth.Parse(pMN); break;
+ case 0x54BA: DisplayHeight.Parse(pMN); break;
+ case 0x54B2: DisplayUnit.Parse(pMN); break;
+ case 0x54B3: AspectRatioType.Parse(pMN); break;
+ case 0x2EB524: ColourSpace.Parse(pMN); break;
+ case 0x2FB523: GammaValue.Parse(pMN); break;
+ case 0x2383E3: FramePerSec.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT Audio::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xB5: SamplingFrequency.Parse(pMN); break;
+ case 0x78B5: OutputSamplingFrequency.Parse(pMN); break;
+ case 0x9F: Channels.Parse(pMN); break;
+ case 0x7D7B: ChannelPositions.Parse(pMN); break;
+ case 0x6264: BitDepth.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT ContentEncodings::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x6240: ce.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT ContentEncoding::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x5031: ContentEncodingOrder.Parse(pMN); break;
+ case 0x5032: ContentEncodingScope.Parse(pMN); break;
+ case 0x5033: ContentEncodingType.Parse(pMN); break;
+ case 0x5034: cc.Parse(pMN); break;
+ case 0x5035: ce.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT ContentCompression::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x4254: ContentCompAlgo.Parse(pMN); break;
+ case 0x4255: ContentCompSettings.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT ContentEncryption::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x47e1: ContentEncAlgo.Parse(pMN); break;
+ case 0x47e2: ContentEncKeyID.Parse(pMN); break;
+ case 0x47e3: ContentSignature.Parse(pMN); break;
+ case 0x47e4: ContentSigKeyID.Parse(pMN); break;
+ case 0x47e5: ContentSigAlgo.Parse(pMN); break;
+ case 0x47e6: ContentSigHashAlgo.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT Cluster::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xE7: TimeCode.Parse(pMN); break;
+ case 0xA7: Position.Parse(pMN); break;
+ case 0xAB: PrevSize.Parse(pMN); break;
+ case 0xA0: BlockGroups.Parse(pMN, true); break;
+ case 0xA3: SimpleBlocks.Parse(pMN, true); break;
+ EndChunk
+}
+
+HRESULT Cluster::ParseTimeCode(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xE7: TimeCode.Parse(pMN); return S_OK;
+ EndChunk
+}
+
+HRESULT BlockGroup::Parse(CMatroskaNode* pMN0, bool fFull)
+{
+ BeginChunk
+ case 0xA1: Block.Parse(pMN, fFull); break;
+ case 0xA2: /* TODO: multiple virt blocks? */; break;
+ case 0x9B: BlockDuration.Parse(pMN); break;
+ case 0xFA: ReferencePriority.Parse(pMN); break;
+ case 0xFB: ReferenceBlock.Parse(pMN); break;
+ case 0xFD: ReferenceVirtual.Parse(pMN); break;
+ case 0xA4: CodecState.Parse(pMN); break;
+ case 0xE8: TimeSlices.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT SimpleBlock::Parse(CMatroskaNode* pMN, bool fFull)
+{
+ pMN->SeekTo(pMN->m_start);
+
+ TrackNumber.Parse(pMN);
+ CShort s; s.Parse(pMN); TimeCode.Set(s);
+ Lacing.Parse(pMN);
+
+ if(!fFull) return S_OK;
+
+ CAtlList<QWORD> lens;
+ QWORD tlen = 0;
+ QWORD FrameSize;
+ BYTE FramesInLaceLessOne;
+
+ switch((Lacing & 0x06) >> 1)
+ {
+ case 0:
+ // No lacing
+ lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
+ break;
+ case 1:
+ // Xiph lacing
+ BYTE n;
+ pMN->Read(n);
+ while(n-- > 0)
+ {
+ BYTE b;
+ QWORD len = 0;
+ do {pMN->Read(b); len += b;} while(b == 0xff);
+ lens.AddTail(len);
+ tlen += len;
+ }
+ lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
+ break;
+ case 2:
+ // Fixed-size lacing
+ pMN->Read(FramesInLaceLessOne);
+ FramesInLaceLessOne++;
+ FrameSize = ((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen)) / FramesInLaceLessOne;
+ while(FramesInLaceLessOne-- > 0)
+ lens.AddTail(FrameSize);
+ break;
+ case 3:
+ // EBML lacing
+ pMN->Read(FramesInLaceLessOne);
+
+ CLength FirstFrameSize;
+ FirstFrameSize.Parse(pMN);
+ lens.AddTail(FirstFrameSize);
+ FramesInLaceLessOne--;
+ tlen = FirstFrameSize;
+
+ CSignedLength DiffSize;
+ FrameSize = FirstFrameSize;
+ while(FramesInLaceLessOne--)
+ {
+ DiffSize.Parse(pMN);
+ FrameSize += DiffSize;
+ lens.AddTail(FrameSize);
+ tlen += FrameSize;
+ }
+ lens.AddTail((pMN->m_start+pMN->m_len) - (pMN->GetPos()+tlen));
+ break;
+ }
+
+ POSITION pos = lens.GetHeadPosition();
+ while(pos)
+ {
+ QWORD len = lens.GetNext(pos);
+ CAutoPtr<CBinary> p(new CBinary());
+ p->SetCount((INT_PTR)len);
+ pMN->Read(p->GetData(), len);
+ BlockData.AddTail(p);
+ }
+
+ return S_OK;
+}
+
+HRESULT TimeSlice::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xCC: LaceNumber.Parse(pMN); break;
+ case 0xCD: FrameNumber.Parse(pMN); break;
+ case 0xCE: Delay.Parse(pMN); break;
+ case 0xCF: Duration.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT Cue::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xBB: CuePoints.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT CuePoint::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xB3: CueTime.Parse(pMN); break;
+ case 0xB7: CueTrackPositions.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT CueTrackPosition::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xF7: CueTrack.Parse(pMN); break;
+ case 0xF1: CueClusterPosition.Parse(pMN); break;
+ case 0x5387: CueBlockNumber.Parse(pMN); break;
+ case 0xEA: CueCodecState.Parse(pMN); break;
+ case 0xDB: CueReferences.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT CueReference::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x96: CueRefTime.Parse(pMN); break;
+ case 0x97: CueRefCluster.Parse(pMN); break;
+ case 0x535F: CueRefNumber.Parse(pMN); break;
+ case 0xEB: CueRefCodecState.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT Attachment::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x61A7: AttachedFiles.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT AttachedFile::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x467E: FileDescription.Parse(pMN); break;
+ case 0x466E: FileName.Parse(pMN); break;
+ case 0x4660: FileMimeType.Parse(pMN); break;
+ case 0x465C: // binary
+ FileDataLen = (INT_PTR)pMN->m_len;
+ FileDataPos = pMN->m_start;
+ break;
+ case 0x46AE: FileUID.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT Chapter::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x45B9: EditionEntries.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT EditionEntry::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0xB6: ChapterAtoms.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT ChapterAtom::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x73C4: ChapterUID.Parse(pMN); break;
+ case 0x91: ChapterTimeStart.Parse(pMN); break;
+ case 0x92: ChapterTimeEnd.Parse(pMN); break;
+// case 0x8F: // TODO
+ case 0x80: ChapterDisplays.Parse(pMN); break;
+ case 0xB6: ChapterAtoms.Parse(pMN); break;
+ case 0x98: ChapterFlagHidden.Parse(pMN); break;
+ case 0x4598: ChapterFlagEnabled.Parse(pMN); break;
+ EndChunk
+}
+
+HRESULT ChapterDisplay::Parse(CMatroskaNode* pMN0)
+{
+ BeginChunk
+ case 0x85: ChapString.Parse(pMN); break;
+ case 0x437C: ChapLanguage.Parse(pMN); break;
+ case 0x437E: ChapCountry.Parse(pMN); break;
+ EndChunk
+}
+
+//
+
+HRESULT CBinary::Parse(CMatroskaNode* pMN)
+{
+ ASSERT(pMN->m_len <= INT_MAX);
+ SetCount((INT_PTR)pMN->m_len);
+ return pMN->Read(GetData(), pMN->m_len);
+}
+
+bool CBinary::Compress(ContentCompression& cc)
+{
+ if(cc.ContentCompAlgo == ContentCompression::ZLIB)
+ {
+ int res;
+ z_stream c_stream;
+
+ c_stream.zalloc = (alloc_func)0;
+ c_stream.zfree = (free_func)0;
+ c_stream.opaque = (voidpf)0;
+
+ if(Z_OK != (res = deflateInit(&c_stream, 9)))
+ return(false);
+
+ c_stream.next_in = GetData();
+ c_stream.avail_in = GetCount();
+
+ BYTE* dst = NULL;
+ int n = 0;
+ do
+ {
+ dst = (BYTE*)realloc(dst, ++n*10);
+ c_stream.next_out = &dst[(n-1)*10];
+ c_stream.avail_out = 10;
+ if(Z_OK != (res = deflate(&c_stream, Z_FINISH)) && Z_STREAM_END != res)
+ {
+ free(dst);
+ return(false);
+ }
+ }
+ while(0 == c_stream.avail_out && Z_STREAM_END != res);
+
+ deflateEnd(&c_stream);
+
+ SetCount(c_stream.total_out);
+ memcpy(GetData(), dst, GetCount());
+
+ free(dst);
+
+ return(true);
+ }
+
+ return(false);
+}
+
+bool CBinary::Decompress(ContentCompression& cc)
+{
+ if(cc.ContentCompAlgo == ContentCompression::ZLIB)
+ {
+ int res;
+ z_stream d_stream;
+
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+
+ if(Z_OK != (res = inflateInit(&d_stream)))
+ return(false);
+
+ d_stream.next_in = GetData();
+ d_stream.avail_in = GetCount();
+
+ BYTE* dst = NULL;
+ int n = 0;
+ do
+ {
+ dst = (unsigned char *)realloc(dst, ++n*1000);
+ d_stream.next_out = &dst[(n-1)*1000];
+ d_stream.avail_out = 1000;
+ if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res)
+ {
+ free(dst);
+ return(false);
+ }
+ }
+ while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
+
+ inflateEnd(&d_stream);
+
+ SetCount(d_stream.total_out);
+ memcpy(GetData(), dst, GetCount());
+
+ free(dst);
+
+ return(true);
+ }
+ else if(cc.ContentCompAlgo == ContentCompression::HDRSTRIP)
+ {
+ InsertArrayAt(0, &cc.ContentCompSettings);
+ }
+
+ return(false);
+}
+
+HRESULT CANSI::Parse(CMatroskaNode* pMN)
+{
+ Empty();
+
+ QWORD len = pMN->m_len;
+ CHAR c;
+ while(len-- > 0 && SUCCEEDED(pMN->Read(c)))
+ *this += c;
+
+ return(len == -1 ? S_OK : E_FAIL);
+}
+
+HRESULT CUTF8::Parse(CMatroskaNode* pMN)
+{
+ Empty();
+ CAutoVectorPtr<BYTE> buff;
+ if(!buff.Allocate((UINT)pMN->m_len + 1) || S_OK != pMN->Read(buff, pMN->m_len))
+ return E_FAIL;
+ buff[pMN->m_len] = 0;
+ CStringW::operator = (UTF8To16((LPCSTR)(BYTE*)buff));
+ return S_OK;
+}
+
+HRESULT CUInt::Parse(CMatroskaNode* pMN)
+{
+ m_val = 0;
+ for(int i = 0; i < (int)pMN->m_len; i++)
+ {
+ m_val <<= 8;
+ HRESULT hr = pMN->Read(*(BYTE*)&m_val);
+ if(FAILED(hr)) return hr;
+ }
+ m_fValid = true;
+ return S_OK;
+}
+
+HRESULT CInt::Parse(CMatroskaNode* pMN)
+{
+ m_val = 0;
+ for(int i = 0; i < (int)pMN->m_len; i++)
+ {
+ HRESULT hr = pMN->Read(*((BYTE*)&m_val+7-i));
+ if(FAILED(hr)) return hr;
+ }
+ m_val >>= (8-pMN->m_len)*8;
+ m_fValid = true;
+ return S_OK;
+}
+
+HRESULT CFloat::Parse(CMatroskaNode* pMN)
+{
+ HRESULT hr = E_FAIL;
+ m_val = 0;
+
+ if(pMN->m_len == 4)
+ {
+ float val = 0;
+ hr = pMN->Read(val);
+ m_val = val;
+ } else if(pMN->m_len == 8) {
+ hr = pMN->Read(m_val);
+ }
+ if(SUCCEEDED(hr))
+ m_fValid = true;
+ return hr;
+}
+
+
+template<class T, class BASE>
+HRESULT CSimpleVar<T, BASE>::Parse(CMatroskaNode* pMN)
+{
+ m_val = 0;
+ m_fValid = true;
+ return pMN->Read(m_val);
+}
+
+HRESULT CID::Parse(CMatroskaNode* pMN)
+{
+ m_val = 0;
+
+ BYTE b = 0;
+ HRESULT hr = pMN->Read(b);
+ if(FAILED(hr)) return hr;
+
+ int nMoreBytes = 0;
+
+ if((b&0x80) == 0x80) {m_val = b&0xff; nMoreBytes = 0;}
+ else if((b&0xc0) == 0x40) {m_val = b&0x7f; nMoreBytes = 1;}
+ else if((b&0xe0) == 0x20) {m_val = b&0x3f; nMoreBytes = 2;}
+ else if((b&0xf0) == 0x10) {m_val = b&0x1f; nMoreBytes = 3;}
+ else return E_FAIL;
+
+ while(nMoreBytes-- > 0)
+ {
+ m_val <<= 8;
+ hr = pMN->Read(*(BYTE*)&m_val);
+ if(FAILED(hr)) return hr;
+ }
+
+ m_fValid = true;
+
+ return S_OK;
+}
+
+HRESULT CLength::Parse(CMatroskaNode* pMN)
+{
+ m_val = 0;
+
+ BYTE b = 0;
+ HRESULT hr = pMN->Read(b);
+ if(FAILED(hr)) return hr;
+
+ int nMoreBytes = 0, nMoreBytesTmp = 0;
+
+ if((b&0x80) == 0x80) {m_val = b&0x7f; nMoreBytes = 0;}
+ else if((b&0xc0) == 0x40) {m_val = b&0x3f; nMoreBytes = 1;}
+ else if((b&0xe0) == 0x20) {m_val = b&0x1f; nMoreBytes = 2;}
+ else if((b&0xf0) == 0x10) {m_val = b&0x0f; nMoreBytes = 3;}
+ else if((b&0xf8) == 0x08) {m_val = b&0x07; nMoreBytes = 4;}
+ else if((b&0xfc) == 0x04) {m_val = b&0x03; nMoreBytes = 5;}
+ else if((b&0xfe) == 0x02) {m_val = b&0x01; nMoreBytes = 6;}
+ else if((b&0xff) == 0x01) {m_val = b&0x00; nMoreBytes = 7;}
+ else return E_FAIL;
+
+ nMoreBytesTmp = nMoreBytes;
+
+ QWORD UnknownSize = (1i64<<(7*(nMoreBytes+1)))-1;
+
+ while(nMoreBytes-- > 0)
+ {
+ m_val <<= 8;
+ hr = pMN->Read(*(BYTE*)&m_val);
+ if(FAILED(hr)) return hr;
+ }
+
+ if(m_val == UnknownSize)
+ {
+ m_val = pMN->GetLength() - pMN->GetPos();
+ TRACE(_T("CLength: Unspecified chunk size at %I64d (corrected to %I64d)\n"), pMN->GetPos(), m_val);
+ }
+
+ if(m_fSigned)
+ m_val -= (UnknownSize >> 1);
+
+ m_fValid = true;
+
+ return S_OK;
+}
+/*
+HRESULT CSignedLength::Parse(CMatroskaNode* pMN)
+{
+// HRESULT hr = __super::Parse(pMN);
+// if(FAILED(hr)) return hr;
+
+ m_val = 0;
+
+ BYTE b = 0;
+ HRESULT hr = pMN->Read(b);
+ if(FAILED(hr)) return hr;
+
+ int nMoreBytes = 0, nMoreBytesTmp = 0;
+
+ if((b&0x80) == 0x80) {m_val = b&0x7f; nMoreBytes = 0;}
+ else if((b&0xc0) == 0x40) {m_val = b&0x3f; nMoreBytes = 1;}
+ else if((b&0xe0) == 0x20) {m_val = b&0x1f; nMoreBytes = 2;}
+ else if((b&0xf0) == 0x10) {m_val = b&0x0f; nMoreBytes = 3;}
+ else if((b&0xf8) == 0x08) {m_val = b&0x07; nMoreBytes = 4;}
+ else if((b&0xfc) == 0x04) {m_val = b&0x03; nMoreBytes = 5;}
+ else if((b&0xfe) == 0x02) {m_val = b&0x01; nMoreBytes = 6;}
+ else if((b&0xff) == 0x01) {m_val = b&0x00; nMoreBytes = 7;}
+ else return E_FAIL;
+
+ nMoreBytesTmp = nMoreBytes;
+
+ QWORD UnknownSize = (1i64<<(7*(nMoreBytes+1)))-1;
+
+ while(nMoreBytes-- > 0)
+ {
+ m_val <<= 8;
+ hr = pMN->Read(*(BYTE*)&m_val);
+ if(FAILED(hr)) return hr;
+ }
+
+ if(m_val == UnknownSize)
+ {
+ m_val = pMN->GetLength() - pMN->GetPos();
+ TRACE(_T("CLength: Unspecified chunk size at %I64d (corrected to %I64d)\n"), pMN->GetPos(), m_val);
+ }
+
+ m_val -= (UnknownSize >> 1);
+
+ m_fValid = true;
+
+ return S_OK;
+}
+*/
+template<class T>
+HRESULT CNode<T>::Parse(CMatroskaNode* pMN)
+{
+ CAutoPtr<T> p(new T());
+ HRESULT hr = E_OUTOFMEMORY;
+ if(!p || FAILED(hr = p->Parse(pMN))) return hr;
+ AddTail(p);
+ return S_OK;
+}
+
+HRESULT CBlockGroupNode::Parse(CMatroskaNode* pMN, bool fFull)
+{
+ CAutoPtr<BlockGroup> p(new BlockGroup());
+ HRESULT hr = E_OUTOFMEMORY;
+ if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
+ AddTail(p);
+ return S_OK;
+}
+
+HRESULT CSimpleBlockNode::Parse(CMatroskaNode* pMN, bool fFull)
+{
+ CAutoPtr<SimpleBlock> p(new SimpleBlock());
+ HRESULT hr = E_OUTOFMEMORY;
+ if(!p || FAILED(hr = p->Parse(pMN, fFull))) return hr;
+ AddTail(p);
+ return S_OK;
+}
+
+///////////////////////////////
+
+CMatroskaNode::CMatroskaNode(CMatroskaFile* pMF)
+ : m_pMF(pMF)
+ , m_pParent(NULL)
+{
+ ASSERT(m_pMF);
+ m_start = m_filepos = 0;
+ m_len.Set(m_pMF ? m_pMF->GetLength() : 0);
+}
+
+CMatroskaNode::CMatroskaNode(CMatroskaNode* pParent)
+ : m_pMF(pParent->m_pMF)
+ , m_pParent(pParent)
+{
+ Parse();
+}
+
+HRESULT CMatroskaNode::Parse()
+{
+ m_filepos = GetPos();
+ if(FAILED(m_id.Parse(this)) || FAILED(m_len.Parse(this)))
+ return E_FAIL;
+ m_start = GetPos();
+ return S_OK;
+}
+
+CAutoPtr<CMatroskaNode> CMatroskaNode::Child(DWORD id, bool fSearch)
+{
+ if(m_len == 0) return CAutoPtr<CMatroskaNode>();
+ SeekTo(m_start);
+ CAutoPtr<CMatroskaNode> pMN(new CMatroskaNode(this));
+ if(id && !pMN->Find(id, fSearch)) pMN.Free();
+ return pMN;
+}
+
+bool CMatroskaNode::Next(bool fSame)
+{
+ if(!m_pParent)
+ return(false);
+
+ CID id = m_id;
+
+ while(m_start+m_len < m_pParent->m_start+m_pParent->m_len)
+ {
+ SeekTo(m_start+m_len);
+
+ if(FAILED(Parse()))
+ {
+ if(!Resync())
+ return(false);
+ }
+
+ if(!fSame || m_id == id)
+ return(true);
+ }
+
+ return(false);
+}
+
+bool CMatroskaNode::Find(DWORD id, bool fSearch)
+{
+ QWORD pos = m_pParent && m_pParent->m_id == 0x18538067 /*segment?*/
+ ? FindPos(id)
+ : 0;
+
+ if(pos)
+ {
+ SeekTo(pos);
+ Parse();
+ }
+ else if(fSearch)
+ {
+ while(m_id != id && Next());
+ }
+
+ return(m_id == id);
+}
+
+void CMatroskaNode::SeekTo(QWORD pos) {m_pMF->Seek(pos);}
+QWORD CMatroskaNode::GetPos() {return m_pMF->GetPos();}
+QWORD CMatroskaNode::GetLength() {return m_pMF->GetLength();}
+template <class T>
+HRESULT CMatroskaNode::Read(T& var) {return m_pMF->Read(var);}
+HRESULT CMatroskaNode::Read(BYTE* pData, QWORD len) {return m_pMF->ByteRead(pData, len);}
+
+QWORD CMatroskaNode::FindPos(DWORD id, QWORD start)
+{
+ Segment& sm = m_pMF->m_segment;
+
+ POSITION pos = sm.MetaSeekInfo.GetHeadPosition();
+ while(pos)
+ {
+ Seek* s = sm.MetaSeekInfo.GetNext(pos);
+
+ POSITION pos2 = s->SeekHeads.GetHeadPosition();
+ while(pos2)
+ {
+ SeekHead* sh = s->SeekHeads.GetNext(pos2);
+ if(sh->SeekID == id && sh->SeekPosition+sm.pos >= start)
+ return sh->SeekPosition+sm.pos;
+ }
+ }
+
+ return 0;
+}
+
+CAutoPtr<CMatroskaNode> CMatroskaNode::Copy()
+{
+ CAutoPtr<CMatroskaNode> pNewNode(new CMatroskaNode(m_pMF));
+ pNewNode->m_pParent = m_pParent;
+ pNewNode->m_id.Set(m_id);
+ pNewNode->m_len.Set(m_len);
+ pNewNode->m_filepos = m_filepos;
+ pNewNode->m_start = m_start;
+ return(pNewNode);
+}
+
+CAutoPtr<CMatroskaNode> CMatroskaNode::GetFirstBlock()
+{
+ CAutoPtr<CMatroskaNode> pNode = Child();
+ do {if(pNode->m_id == 0xA0 || pNode->m_id == 0xA3) return pNode;}
+ while(pNode->Next());
+ return CAutoPtr<CMatroskaNode>();
+}
+
+bool CMatroskaNode::NextBlock()
+{
+ if(!m_pParent)
+ return(false);
+
+ CID id = m_id;
+
+ while(m_start+m_len < m_pParent->m_start+m_pParent->m_len)
+ {
+ SeekTo(m_start+m_len);
+
+ if(FAILED(Parse()))
+ {
+ if(!Resync())
+ return(false);
+ }
+
+ if(m_id == 0xA0 || m_id == 0xA3)
+ return(true);
+ }
+
+ return(false);
+}
+
+bool CMatroskaNode::Resync()
+{
+ if(m_pParent->m_id == 0x18538067) /*segment?*/
+ {
+ SeekTo(m_filepos);
+
+ for(BYTE b = 0; S_OK == Read(b); b = 0)
+ {
+ if((b&0xf0) != 0x10)
+ continue;
+
+ DWORD dw = b;
+ Read((BYTE*)&dw+1, 3);
+ bswap((BYTE*)&dw, 4);
+
+ switch(dw)
+ {
+ case 0x1549A966: // SegmentInfo
+ case 0x114D9B74: // MetaSeekInfo
+ case 0x1654AE6B: // Tracks
+ case 0x1F43B675: // Clusters
+ case 0x1C53BB6B: // Cues
+ case 0x1941A469: // Attachments
+ case 0x1043A770: // Chapters
+ case 0x1254C367: // Tags
+ SeekTo(GetPos()-4);
+ return(SUCCEEDED(Parse()));
+ default:
+ SeekTo(GetPos()-3);
+ break;
+ }
+ }
+ }
+
+ return(false);
+}
diff --git a/src/filters/parser/matroskasplitter/MatroskaFile.h b/src/filters/parser/matroskasplitter/MatroskaFile.h
new file mode 100644
index 000000000..3d172a365
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaFile.h
@@ -0,0 +1,454 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\BaseSplitter\BaseSplitter.h"
+
+namespace MatroskaReader
+{
+ class CMatroskaNode;
+
+ typedef unsigned __int64 QWORD;
+
+ class CANSI : public CStringA {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CUTF8 : public CStringW {public: HRESULT Parse(CMatroskaNode* pMN);};
+
+ template<class T, class BASE>
+ class CSimpleVar
+ {
+ protected:
+ T m_val;
+ bool m_fValid;
+ public:
+ CSimpleVar(T val = 0) : m_val(val), m_fValid(false) {}
+ BASE& operator = (const BASE& v) {m_val = v.m_val; m_fValid = true; return(*this);}
+ BASE& operator = (T val) {m_val = val; m_fValid = true; return(*this);}
+ operator T() {return m_val;}
+ BASE& Set(T val) {m_val = val; m_fValid = true; return(*(BASE*)this);}
+ bool IsValid() {return m_fValid;}
+ virtual HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CUInt : public CSimpleVar<UINT64, CUInt> {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CInt : public CSimpleVar<INT64, CInt> {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CByte : public CSimpleVar<BYTE, CByte> {};
+ class CShort : public CSimpleVar<short, CShort> {};
+ class CFloat : public CSimpleVar<double, CFloat> {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CID : public CSimpleVar<DWORD, CID> {public: HRESULT Parse(CMatroskaNode* pMN);};
+ class CLength : public CSimpleVar<UINT64, CLength> {bool m_fSigned; public: CLength(bool fSigned = false) : m_fSigned(fSigned) {} HRESULT Parse(CMatroskaNode* pMN);};
+ class CSignedLength : public CLength {public: CSignedLength() : CLength(true) {}};
+
+ class ContentCompression;
+
+ class CBinary : public CAtlArray<BYTE>
+ {
+ public:
+ CBinary& operator = (const CBinary& b) {Copy(b); return(*this);}
+ CStringA ToString() {return CStringA((LPCSTR)GetData(), GetCount());}
+ bool Compress(ContentCompression& cc), Decompress(ContentCompression& cc);
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ template<class T>
+ class CNode : public CAutoPtrList<T> {public: HRESULT Parse(CMatroskaNode* pMN);};
+
+ class EBML
+ {
+ public:
+ CUInt EBMLVersion, EBMLReadVersion;
+ CUInt EBMLMaxIDLength, EBMLMaxSizeLength;
+ CANSI DocType;
+ CUInt DocTypeVersion, DocTypeReadVersion;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Info
+ {
+ public:
+ CBinary SegmentUID, PrevUID, NextUID;
+ CUTF8 SegmentFilename, PrevFilename, NextFilename;
+ CUInt TimeCodeScale; // [ns], default: 1.000.000
+ CFloat Duration;
+ CInt DateUTC;
+ CUTF8 Title, MuxingApp, WritingApp;
+
+ Info() {TimeCodeScale.Set(1000000ui64);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class SeekHead
+ {
+ public:
+ CID SeekID;
+ CUInt SeekPosition;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Seek
+ {
+ public:
+ CNode<SeekHead> SeekHeads;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class TimeSlice
+ {
+ public:
+ CUInt LaceNumber, FrameNumber;
+ CUInt Delay, Duration;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class SimpleBlock
+ {
+ public:
+ CLength TrackNumber;
+ CInt TimeCode;
+ CByte Lacing;
+ CAutoPtrList<CBinary> BlockData;
+
+ HRESULT Parse(CMatroskaNode* pMN, bool fFull);
+ };
+
+ class BlockGroup
+ {
+ public:
+ SimpleBlock Block;
+// BlockVirtual
+ CUInt BlockDuration;
+ CUInt ReferencePriority;
+ CInt ReferenceBlock;
+ CInt ReferenceVirtual;
+ CBinary CodecState;
+ CNode<TimeSlice> TimeSlices;
+
+ HRESULT Parse(CMatroskaNode* pMN, bool fFull);
+ };
+
+ class CBlockGroupNode : public CNode<BlockGroup>
+ {
+ public:
+ HRESULT Parse(CMatroskaNode* pMN, bool fFull);
+ };
+
+ class CSimpleBlockNode : public CNode<SimpleBlock>
+ {
+ public:
+ HRESULT Parse(CMatroskaNode* pMN, bool fFull);
+ };
+
+ class Cluster
+ {
+ public:
+ CUInt TimeCode, Position, PrevSize;
+ CBlockGroupNode BlockGroups;
+ CSimpleBlockNode SimpleBlocks;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ HRESULT ParseTimeCode(CMatroskaNode* pMN);
+ };
+
+ class Video
+ {
+ public:
+ CUInt FlagInterlaced, StereoMode;
+ CUInt PixelWidth, PixelHeight, DisplayWidth, DisplayHeight, DisplayUnit;
+ CUInt AspectRatioType;
+ CUInt ColourSpace;
+ CFloat GammaValue;
+ CFloat FramePerSec;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Audio
+ {
+ public:
+ CFloat SamplingFrequency;
+ CFloat OutputSamplingFrequency;
+ CUInt Channels;
+ CBinary ChannelPositions;
+ CUInt BitDepth;
+
+ Audio() {SamplingFrequency.Set(8000.0); Channels.Set(1);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ContentCompression
+ {
+ public:
+ CUInt ContentCompAlgo; enum {ZLIB, BZLIB, LZO1X, HDRSTRIP};
+ CBinary ContentCompSettings;
+
+ ContentCompression() {ContentCompAlgo.Set(ZLIB);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ContentEncryption
+ {
+ public:
+ CUInt ContentEncAlgo; enum {UNKE, DES, THREEDES, TWOFISH, BLOWFISH, AES};
+ CBinary ContentEncKeyID, ContentSignature, ContentSigKeyID;
+ CUInt ContentSigAlgo; enum {UNKS, RSA};
+ CUInt ContentSigHashAlgo; enum {UNKSH, SHA1_160, MD5};
+
+ ContentEncryption() {ContentEncAlgo.Set(0); ContentSigAlgo.Set(0); ContentSigHashAlgo.Set(0);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ContentEncoding
+ {
+ public:
+ CUInt ContentEncodingOrder;
+ CUInt ContentEncodingScope; enum {AllFrameContents = 1, TracksPrivateData = 2};
+ CUInt ContentEncodingType; enum {Compression, Encryption};
+ ContentCompression cc;
+ ContentEncryption ce;
+
+ ContentEncoding() {ContentEncodingOrder.Set(0); ContentEncodingScope.Set(AllFrameContents); ContentEncodingType.Set(Compression);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ContentEncodings
+ {
+ public:
+ CNode<ContentEncoding> ce;
+
+ ContentEncodings() {}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class TrackEntry
+ {
+ public:
+ enum {TypeVideo = 1, TypeAudio = 2, TypeComplex = 3, TypeLogo = 0x10, TypeSubtitle = 0x11, TypeControl = 0x20};
+ CUInt TrackNumber, TrackUID, TrackType;
+ CUInt FlagEnabled, FlagDefault, FlagLacing;
+ CUInt MinCache, MaxCache;
+ CUTF8 Name;
+ CANSI Language;
+ CBinary CodecID;
+ CBinary CodecPrivate;
+ CUTF8 CodecName;
+ CUTF8 CodecSettings;
+ CANSI CodecInfoURL;
+ CANSI CodecDownloadURL;
+ CUInt CodecDecodeAll;
+ CUInt TrackOverlay;
+ CUInt DefaultDuration;
+ CFloat TrackTimecodeScale;
+ enum {NoDesc = 0, DescVideo = 1, DescAudio = 2};
+ int DescType;
+ Video v;
+ Audio a;
+ ContentEncodings ces;
+ TrackEntry() {DescType = NoDesc; FlagEnabled.Set(1); FlagDefault.Set(1); FlagLacing.Set(1); }
+ HRESULT Parse(CMatroskaNode* pMN);
+
+ bool Expand(CBinary& data, UINT64 Scope);
+ };
+
+ class Track
+ {
+ public:
+ CNode<TrackEntry> TrackEntries;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CueReference
+ {
+ public:
+ CUInt CueRefTime, CueRefCluster, CueRefNumber, CueRefCodecState;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CueTrackPosition
+ {
+ public:
+ CUInt CueTrack, CueClusterPosition, CueBlockNumber, CueCodecState;
+ CNode<CueReference> CueReferences;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CuePoint
+ {
+ public:
+ CUInt CueTime;
+ CNode<CueTrackPosition> CueTrackPositions;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Cue
+ {
+ public:
+ CNode<CuePoint> CuePoints;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class AttachedFile
+ {
+ public:
+ CUTF8 FileDescription;
+ CUTF8 FileName;
+ CANSI FileMimeType;
+ QWORD FileDataPos, FileDataLen; // BYTE* FileData
+ CUInt FileUID;
+
+ AttachedFile() {FileDataPos = FileDataLen = 0;}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Attachment
+ {
+ public:
+ CNode<AttachedFile> AttachedFiles;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ChapterDisplay
+ {
+ public:
+ CUTF8 ChapString;
+ CANSI ChapLanguage;
+ CANSI ChapCountry;
+
+ ChapterDisplay() {ChapLanguage.CStringA::operator = ("eng");}
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class ChapterAtom
+ {
+ public:
+ CUInt ChapterUID;
+ CUInt ChapterTimeStart, ChapterTimeEnd, ChapterFlagHidden, ChapterFlagEnabled;
+// CNode<CUInt> ChapterTracks; // TODO
+ CNode<ChapterDisplay> ChapterDisplays;
+ CNode<ChapterAtom> ChapterAtoms;
+
+ ChapterAtom() {ChapterUID.Set(rand());ChapterFlagHidden.Set(0);ChapterFlagEnabled.Set(1);}
+ HRESULT Parse(CMatroskaNode* pMN);
+ ChapterAtom* FindChapterAtom(UINT64 id);
+ };
+
+ class EditionEntry : public ChapterAtom
+ {
+ public:
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Chapter
+ {
+ public:
+ CNode<EditionEntry> EditionEntries;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class Segment
+ {
+ public:
+ QWORD pos, len;
+ Info SegmentInfo;
+ CNode<Seek> MetaSeekInfo;
+ CNode<Cluster> Clusters;
+ CNode<Track> Tracks;
+ CNode<Cue> Cues;
+ CNode<Attachment> Attachments;
+ CNode<Chapter> Chapters;
+ // TODO: Chapters
+ // TODO: Tags
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ HRESULT ParseMinimal(CMatroskaNode* pMN);
+
+ UINT64 GetMasterTrack();
+
+ REFERENCE_TIME GetRefTime(INT64 t) {return t*(REFERENCE_TIME)(SegmentInfo.TimeCodeScale)/100;}
+ ChapterAtom* FindChapterAtom(UINT64 id, int nEditionEntry = 0);
+ };
+
+ class CMatroskaFile : public CBaseSplitterFile
+ {
+ public:
+ CMatroskaFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+ virtual ~CMatroskaFile() {}
+
+ HRESULT Init();
+
+ //using CBaseSplitterFile::Read;
+ template <class T> HRESULT Read(T& var);
+
+ EBML m_ebml;
+ Segment m_segment;
+ REFERENCE_TIME m_rtOffset;
+
+ HRESULT Parse(CMatroskaNode* pMN);
+ };
+
+ class CMatroskaNode
+ {
+ CMatroskaNode* m_pParent;
+ CMatroskaFile* m_pMF;
+
+ bool Resync();
+
+ public:
+ CID m_id;
+ CLength m_len;
+ QWORD m_filepos, m_start;
+
+ HRESULT Parse();
+
+ public:
+ CMatroskaNode(CMatroskaFile* pMF); // creates the root
+ CMatroskaNode(CMatroskaNode* pParent);
+
+ CMatroskaNode* Parent() {return m_pParent;}
+ CAutoPtr<CMatroskaNode> Child(DWORD id = 0, bool fSearch = true);
+ bool Next(bool fSame = false);
+ bool Find(DWORD id, bool fSearch = true);
+
+ QWORD FindPos(DWORD id, QWORD start = 0);
+
+ void SeekTo(QWORD pos);
+ QWORD GetPos(), GetLength();
+ template <class T> HRESULT Read(T& var);
+ HRESULT Read(BYTE* pData, QWORD len);
+
+ CAutoPtr<CMatroskaNode> Copy();
+
+ CAutoPtr<CMatroskaNode> GetFirstBlock();
+ bool NextBlock();
+ };
+}
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp b/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp
new file mode 100644
index 000000000..70ab87e80
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaSplitter.cpp
@@ -0,0 +1,1301 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include "MatroskaSplitter.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+using namespace MatroskaReader;
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Matroska},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CMatroskaSplitterFilter), L"Matroska Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins},
+ {&__uuidof(CMatroskaSourceFilter), L"Matroska Source", MERIT_NORMAL, 0, NULL},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMatroskaSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMatroskaSourceFilter>, NULL, &sudFilter[1]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_Matroska,
+ _T("0,4,,1A45DFA3"),
+ _T(".mkv"), _T(".mka"), _T(".mks"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ UnRegisterSourceFilter(MEDIASUBTYPE_Matroska);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CMatroskaSplitterFilter
+//
+
+CMatroskaSplitterFilter::CMatroskaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("CMatroskaSplitterFilter"), pUnk, phr, __uuidof(this))
+{
+}
+
+CMatroskaSplitterFilter::~CMatroskaSplitterFilter()
+{
+}
+
+STDMETHODIMP CMatroskaSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(ITrackInfo)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+#include <vector>
+
+HRESULT CMatroskaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+ m_pTrackEntryMap.RemoveAll();
+ m_pOrderedTrackArray.RemoveAll();
+
+ m_pFile.Attach(new CMatroskaFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = 0;
+
+ int iVideo = 1, iAudio = 1, iSubtitle = 1;
+
+ POSITION pos = m_pFile->m_segment.Tracks.GetHeadPosition();
+ while(pos)
+ {
+ Track* pT = m_pFile->m_segment.Tracks.GetNext(pos);
+
+ POSITION pos2 = pT->TrackEntries.GetHeadPosition();
+ while(pos2)
+ {
+ TrackEntry* pTE = pT->TrackEntries.GetNext(pos2);
+
+ if(!pTE->Expand(pTE->CodecPrivate, ContentEncoding::TracksPrivateData))
+ continue;
+
+ CStringA CodecID = pTE->CodecID.ToString();
+
+ CStringW Name;
+ Name.Format(L"Output %I64d", (UINT64)pTE->TrackNumber);
+
+ CMediaType mt;
+ CAtlArray<CMediaType> mts;
+
+ mt.SetSampleSize(1);
+
+ if(pTE->TrackType == TrackEntry::TypeVideo)
+ {
+ Name.Format(L"Video %d", iVideo++);
+
+ mt.majortype = MEDIATYPE_Video;
+
+ if(CodecID == "V_MS/VFW/FOURCC")
+ {
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount() - sizeof(BITMAPINFOHEADER));
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(&pvih->bmiHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ mt.subtype = FOURCCMap(pvih->bmiHeader.biCompression);
+ switch(pvih->bmiHeader.biCompression)
+ {
+ case BI_RGB: case BI_BITFIELDS: mt.subtype =
+ pvih->bmiHeader.biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
+ pvih->bmiHeader.biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
+ pvih->bmiHeader.biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
+ pvih->bmiHeader.biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
+ pvih->bmiHeader.biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
+ pvih->bmiHeader.biBitCount == 32 ? MEDIASUBTYPE_ARGB32 :
+ MEDIASUBTYPE_NULL;
+ break;
+// case BI_RLE8: mt.subtype = MEDIASUBTYPE_RGB8; break;
+// case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
+ }
+ mts.Add(mt);
+ }
+ else if(CodecID == "V_UNCOMPRESSED")
+ {
+ }
+ else if(CodecID.Find("V_MPEG4/ISO/AVC") == 0 && pTE->CodecPrivate.GetCount() >= 6)
+ {
+ BYTE sps = pTE->CodecPrivate[5] & 0x1f;
+
+ std::vector<BYTE> avcC;
+ for(int i = 0, j = pTE->CodecPrivate.GetCount(); i < j; i++)
+ avcC.push_back(pTE->CodecPrivate[i]);
+
+ std::vector<BYTE> sh;
+
+ unsigned jj = 6;
+
+ while (sps--) {
+ if (jj + 2 > avcC.size())
+ goto avcfail;
+ unsigned spslen = ((unsigned)avcC[jj] << 8) | avcC[jj+1];
+ if (jj + 2 + spslen > avcC.size())
+ goto avcfail;
+ unsigned cur = sh.size();
+ sh.resize(cur + spslen + 2, 0);
+ std::copy(avcC.begin() + jj, avcC.begin() + jj + 2 + spslen,sh.begin() + cur);
+ jj += 2 + spslen;
+ }
+
+ if (jj + 1 > avcC.size())
+ continue;
+
+ unsigned pps = avcC[jj++];
+
+ while (pps--) {
+ if (jj + 2 > avcC.size())
+ goto avcfail;
+ unsigned ppslen = ((unsigned)avcC[jj] << 8) | avcC[jj+1];
+ if (jj + 2 + ppslen > avcC.size())
+ goto avcfail;
+ unsigned cur = sh.size();
+ sh.resize(cur + ppslen + 2, 0);
+ std::copy(avcC.begin() + jj, avcC.begin() + jj + 2 + ppslen, sh.begin() + cur);
+ jj += 2 + ppslen;
+ }
+
+ goto avcsuccess;
+avcfail:
+ continue;
+avcsuccess:
+
+ CAtlArray<BYTE> data;
+ data.SetCount(sh.size());
+ std::copy(sh.begin(), sh.end(), data.GetData());
+
+ mt.subtype = FOURCCMap('1CVA');
+ mt.formattype = FORMAT_MPEG2Video;
+ MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + data.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ pm2vi->hdr.bmiHeader.biSize = sizeof(pm2vi->hdr.bmiHeader);
+ pm2vi->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
+ pm2vi->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
+ pm2vi->hdr.bmiHeader.biCompression = '1CVA';
+ pm2vi->hdr.bmiHeader.biPlanes = 1;
+ pm2vi->hdr.bmiHeader.biBitCount = 24;
+ pm2vi->dwProfile = pTE->CodecPrivate[1];
+ pm2vi->dwLevel = pTE->CodecPrivate[3];
+ pm2vi->dwFlags = (pTE->CodecPrivate[4] & 3) + 1;
+ BYTE* pSequenceHeader = (BYTE*)pm2vi->dwSequenceHeader;
+ memcpy(pSequenceHeader, data.GetData(), data.GetCount());
+ pm2vi->cbSequenceHeader = data.GetCount();
+ mts.Add(mt);
+ }
+ else if(CodecID.Find("V_MPEG4/") == 0)
+ {
+ mt.subtype = FOURCCMap('V4PM');
+ mt.formattype = FORMAT_MPEG2Video;
+ MPEG2VIDEOINFO* pm2vi = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ pm2vi->hdr.bmiHeader.biSize = sizeof(pm2vi->hdr.bmiHeader);
+ pm2vi->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
+ pm2vi->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
+ pm2vi->hdr.bmiHeader.biCompression = 'V4PM';
+ pm2vi->hdr.bmiHeader.biPlanes = 1;
+ pm2vi->hdr.bmiHeader.biBitCount = 24;
+ BYTE* pSequenceHeader = (BYTE*)pm2vi->dwSequenceHeader;
+ memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ pm2vi->cbSequenceHeader = pTE->CodecPrivate.GetCount();
+ mts.Add(mt);
+ }
+ else if(CodecID.Find("V_REAL/RV") == 0)
+ {
+ mt.subtype = FOURCCMap('00VR' + ((CodecID[9]-0x30)<<16));
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pTE->CodecPrivate.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(mt.Format() + sizeof(VIDEOINFOHEADER), pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
+ pvih->bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
+ pvih->bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
+ pvih->bmiHeader.biCompression = mt.subtype.Data1;
+ mts.Add(mt);
+ }
+ else if(CodecID == "V_DIRAC")
+ {
+ mt.subtype = MEDIASUBTYPE_DiracVideo;
+ mt.formattype = FORMAT_DiracVideoInfo;
+ DIRACINFOHEADER* dvih = (DIRACINFOHEADER*)mt.AllocFormatBuffer(FIELD_OFFSET(DIRACINFOHEADER, dwSequenceHeader) + pTE->CodecPrivate.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ dvih->hdr.bmiHeader.biSize = sizeof(dvih->hdr.bmiHeader);
+ dvih->hdr.bmiHeader.biWidth = (LONG)pTE->v.PixelWidth;
+ dvih->hdr.bmiHeader.biHeight = (LONG)pTE->v.PixelHeight;
+ dvih->hdr.dwPictAspectRatioX = dvih->hdr.bmiHeader.biWidth;
+ dvih->hdr.dwPictAspectRatioY = dvih->hdr.bmiHeader.biHeight;
+
+ BYTE* pSequenceHeader = (BYTE*)dvih->dwSequenceHeader;
+ memcpy(pSequenceHeader, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ dvih->cbSequenceHeader = pTE->CodecPrivate.GetCount();
+
+ mts.Add(mt);
+ }
+ else if(CodecID == "V_MPEG2")
+ {
+ BYTE* seqhdr = pTE->CodecPrivate.GetData();
+ DWORD len = pTE->CodecPrivate.GetCount();
+ int w = pTE->v.PixelWidth;
+ int h = pTE->v.PixelHeight;
+
+ if(MakeMPEG2MediaType(mt, seqhdr, len, w, h))
+ mts.Add(mt);
+ }
+/*
+ else if(CodecID == "V_DSHOW/MPEG1VIDEO") // V_MPEG1
+ {
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = MEDIASUBTYPE_MPEG1Payload;
+ mt.formattype = FORMAT_MPEGVideo;
+ MPEG1VIDEOINFO* pm1vi = (MPEG1VIDEOINFO*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
+ memcpy(pm1vi, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ mt.SetSampleSize(pm1vi->hdr.bmiHeader.biWidth*pm1vi->hdr.bmiHeader.biHeight*4);
+ mts.Add(mt);
+ }
+*/
+ REFERENCE_TIME AvgTimePerFrame = 0;
+
+ if(pTE->v.FramePerSec > 0)
+ AvgTimePerFrame = (REFERENCE_TIME)(10000000i64 / pTE->v.FramePerSec);
+ else if(pTE->DefaultDuration > 0)
+ AvgTimePerFrame = (REFERENCE_TIME)pTE->DefaultDuration / 100;
+
+ if(AvgTimePerFrame)
+ {
+ for(int i = 0; i < mts.GetCount(); i++)
+ {
+ if(mts[i].formattype == FORMAT_VideoInfo
+ || mts[i].formattype == FORMAT_VideoInfo2
+ || mts[i].formattype == FORMAT_MPEG2Video)
+ {
+ ((VIDEOINFOHEADER*)mts[i].Format())->AvgTimePerFrame = AvgTimePerFrame;
+ }
+ }
+ }
+
+ if(pTE->v.DisplayWidth != 0 && pTE->v.DisplayHeight != 0)
+ {
+ for(int i = 0; i < mts.GetCount(); i++)
+ {
+ if(mts[i].formattype == FORMAT_VideoInfo)
+ {
+ DWORD vih1 = FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
+ DWORD vih2 = FIELD_OFFSET(VIDEOINFOHEADER2, bmiHeader);
+ DWORD bmi = mts[i].FormatLength() - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader);
+ mt.formattype = FORMAT_VideoInfo2;
+ mt.AllocFormatBuffer(vih2 + bmi);
+ memcpy(mt.Format(), mts[i].Format(), vih1);
+ memset(mt.Format() + vih1, 0, vih2 - vih1);
+ memcpy(mt.Format() + vih2, mts[i].Format() + vih1, bmi);
+ ((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioX = (DWORD)pTE->v.DisplayWidth;
+ ((VIDEOINFOHEADER2*)mt.Format())->dwPictAspectRatioY = (DWORD)pTE->v.DisplayHeight;
+ mts.InsertAt(i++, mt);
+ }
+ else if(mts[i].formattype == FORMAT_MPEG2Video)
+ {
+ ((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioX = (DWORD)pTE->v.DisplayWidth;
+ ((MPEG2VIDEOINFO*)mts[i].Format())->hdr.dwPictAspectRatioY = (DWORD)pTE->v.DisplayHeight;
+ }
+ }
+ }
+ }
+ else if(pTE->TrackType == TrackEntry::TypeAudio)
+ {
+ Name.Format(L"Audio %d", iAudio++);
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, mt.FormatLength());
+ wfe->nChannels = (WORD)pTE->a.Channels;
+ wfe->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
+ wfe->wBitsPerSample = (WORD)pTE->a.BitDepth;
+ wfe->nBlockAlign = (WORD)((wfe->nChannels * wfe->wBitsPerSample) / 8);
+ wfe->nAvgBytesPerSec = wfe->nSamplesPerSec * wfe->nBlockAlign;
+ mt.SetSampleSize(256000);
+
+ static CAtlMap<CStringA, int, CStringElementTraits<CStringA> > id2ft;
+
+ if(id2ft.IsEmpty())
+ {
+ id2ft["A_MPEG/L3"] = WAVE_FORMAT_MP3;
+ id2ft["A_MPEG/L2"] = WAVE_FORMAT_MPEG;
+ id2ft["A_AC3"] = WAVE_FORMAT_DOLBY_AC3;
+ id2ft["A_DTS"] = WAVE_FORMAT_DVD_DTS;
+ id2ft["A_PCM/INT/LIT"] = WAVE_FORMAT_PCM;
+ id2ft["A_PCM/FLOAT/IEEE"] = WAVE_FORMAT_IEEE_FLOAT;
+ id2ft["A_AAC"] = -WAVE_FORMAT_AAC;
+ id2ft["A_FLAC"] = -WAVE_FORMAT_FLAC;
+ id2ft["A_WAVPACK4"] = -WAVE_FORMAT_WAVPACK4;
+ id2ft["A_TTA1"] = WAVE_FORMAT_TTA1;
+ }
+
+ int wFormatTag;
+ if(id2ft.Lookup(CodecID, wFormatTag))
+ {
+ if(wFormatTag < 0)
+ {
+ wFormatTag = -wFormatTag;
+ wfe->cbSize = pTE->CodecPrivate.GetCount();
+ wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
+ memcpy(wfe + 1, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ }
+
+ mt.subtype = FOURCCMap(wfe->wFormatTag = wFormatTag);
+ mts.Add(mt);
+
+ if(wFormatTag == WAVE_FORMAT_FLAC)
+ {
+ mt.subtype = MEDIASUBTYPE_FLAC_FRAMED;
+ mts.InsertAt(0, mt);
+ }
+ }
+ else if(CodecID == "A_VORBIS")
+ {
+ BYTE* p = pTE->CodecPrivate.GetData();
+ CAtlArray<int> sizes;
+ for(BYTE n = *p++; n > 0; n--)
+ {
+ int size = 0;
+ do {size += *p;} while(*p++ == 0xff);
+ sizes.Add(size);
+ }
+
+ int totalsize = 0;
+ for(int i = 0; i < sizes.GetCount(); i++)
+ totalsize += sizes[i];
+
+ sizes.Add(pTE->CodecPrivate.GetCount() - (p - pTE->CodecPrivate.GetData()) - totalsize);
+ totalsize += sizes[sizes.GetCount()-1];
+
+ if(sizes.GetCount() == 3)
+ {
+ mt.subtype = MEDIASUBTYPE_Vorbis2;
+ mt.formattype = FORMAT_VorbisFormat2;
+ VORBISFORMAT2* pvf2 = (VORBISFORMAT2*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT2) + totalsize);
+ memset(pvf2, 0, mt.FormatLength());
+ pvf2->Channels = (WORD)pTE->a.Channels;
+ pvf2->SamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
+ pvf2->BitsPerSample = (DWORD)pTE->a.BitDepth;
+ BYTE* p2 = mt.Format() + sizeof(VORBISFORMAT2);
+ for(int i = 0; i < sizes.GetCount(); p += sizes[i], p2 += sizes[i], i++)
+ memcpy(p2, p, pvf2->HeaderSize[i] = sizes[i]);
+
+ mts.Add(mt);
+ }
+
+ mt.subtype = MEDIASUBTYPE_Vorbis;
+ mt.formattype = FORMAT_VorbisFormat;
+ VORBISFORMAT* vf = (VORBISFORMAT*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT));
+ memset(vf, 0, mt.FormatLength());
+ vf->nChannels = (WORD)pTE->a.Channels;
+ vf->nSamplesPerSec = (DWORD)pTE->a.SamplingFrequency;
+ vf->nMinBitsPerSec = vf->nMaxBitsPerSec = vf->nAvgBitsPerSec = -1;
+ mts.Add(mt);
+ }
+ else if(CodecID == "A_MS/ACM")
+ {
+ wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(pTE->CodecPrivate.GetCount());
+ memcpy(wfe, (WAVEFORMATEX*)pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ mt.subtype = FOURCCMap(wfe->wFormatTag);
+ mts.Add(mt);
+ }
+ else if(CodecID.Find("A_AAC/") == 0)
+ {
+ mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
+ wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + 5);
+ wfe->cbSize = 2;
+
+ int profile;
+
+ if(CodecID.Find("/MAIN") > 0) profile = 0;
+ else if(CodecID.Find("/SBR") > 0) profile = -1;
+ else if(CodecID.Find("/LC") > 0) profile = 1;
+ else if(CodecID.Find("/SSR") > 0) profile = 2;
+ else if(CodecID.Find("/LTP") > 0) profile = 3;
+ else continue;
+
+ WORD cbSize = MakeAACInitData((BYTE*)(wfe + 1), profile, wfe->nSamplesPerSec, pTE->a.Channels);
+
+ mts.Add(mt);
+
+ if(profile < 0)
+ {
+ wfe->cbSize = cbSize;
+ wfe->nSamplesPerSec *= 2;
+ wfe->nAvgBytesPerSec *= 2;
+
+ mts.InsertAt(0, mt);
+ }
+ }
+ else if(CodecID.Find("A_REAL/") == 0 && CodecID.GetLength() >= 11)
+ {
+ mt.subtype = FOURCCMap((DWORD)CodecID[7]|((DWORD)CodecID[8]<<8)|((DWORD)CodecID[9]<<16)|((DWORD)CodecID[10]<<24));
+ mt.bTemporalCompression = TRUE;
+ wfe->cbSize = pTE->CodecPrivate.GetCount();
+ wfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + pTE->CodecPrivate.GetCount());
+ memcpy(wfe + 1, pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+ wfe->cbSize = 0; // IMPORTANT: this is screwed, but cbSize has to be 0 and the extra data from codec priv must be after WAVEFORMATEX
+ mts.Add(mt);
+ }
+ }
+ else if(pTE->TrackType == TrackEntry::TypeSubtitle)
+ {
+ if(iSubtitle == 1) InstallFonts();
+
+ Name.Format(L"Subtitle %d", iSubtitle++);
+
+ mt.SetSampleSize(1);
+
+ if(CodecID == "S_TEXT/ASCII")
+ {
+ mt.majortype = MEDIATYPE_Text;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mts.Add(mt);
+ }
+ else
+ {
+ mt.majortype = MEDIATYPE_Subtitle;
+ mt.formattype = FORMAT_SubtitleInfo;
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + pTE->CodecPrivate.GetCount());
+ memset(psi, 0, mt.FormatLength());
+ strncpy(psi->IsoLang, pTE->Language, countof(psi->IsoLang)-1);
+ wcsncpy(psi->TrackName, pTE->Name, countof(psi->TrackName)-1);
+ memcpy(mt.pbFormat + (psi->dwOffset = sizeof(SUBTITLEINFO)), pTE->CodecPrivate.GetData(), pTE->CodecPrivate.GetCount());
+
+ mt.subtype =
+ CodecID == "S_TEXT/UTF8" ? MEDIASUBTYPE_UTF8 :
+ CodecID == "S_TEXT/SSA" || CodecID == "S_SSA" ? MEDIASUBTYPE_SSA :
+ CodecID == "S_TEXT/ASS" || CodecID == "S_ASS" ? MEDIASUBTYPE_ASS :
+ CodecID == "S_TEXT/USF" || CodecID == "S_USF" ? MEDIASUBTYPE_USF :
+ CodecID == "S_VOBSUB" ? MEDIASUBTYPE_VOBSUB :
+ MEDIASUBTYPE_NULL;
+
+ if(mt.subtype != MEDIASUBTYPE_NULL)
+ mts.Add(mt);
+ }
+ }
+
+ if(mts.IsEmpty())
+ {
+ TRACE(_T("CMatroskaSourceFilter: Unsupported TrackType %s (%I64d)\n"), CString(CodecID), (UINT64)pTE->TrackType);
+ continue;
+ }
+
+ Name = CStringW(pTE->Language.IsEmpty() ? L"English" : CStringW(ISO6392ToLanguage(pTE->Language)))
+ + (pTE->Name.IsEmpty() ? L"" : L", " + pTE->Name)
+ + (L" (" + Name + L")");
+
+ HRESULT hr;
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CMatroskaSplitterOutputPin((int)pTE->MinCache, pTE->DefaultDuration/100, mts, Name, this, this, &hr));
+ if(!pTE->Name.IsEmpty()) pPinOut->SetProperty(L"NAME", pTE->Name);
+ if(pTE->Language.GetLength() == 3) pPinOut->SetProperty(L"LANG", CStringW(CString(pTE->Language)));
+ AddOutputPin((DWORD)pTE->TrackNumber, pPinOut);
+
+ m_pTrackEntryMap[(DWORD)pTE->TrackNumber] = pTE;
+ m_pOrderedTrackArray.Add(pTE);
+ }
+ }
+
+ Info& info = m_pFile->m_segment.SegmentInfo;
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = (REFERENCE_TIME)(info.Duration*info.TimeCodeScale/100);
+
+#ifdef DEBUG
+ /*
+ for(int i = 1, j = GetChapterCount(CHAPTER_ROOT_ID); i <= j; i++)
+ {
+ UINT id = GetChapterId(CHAPTER_ROOT_ID, i);
+ struct ChapterElement ce;
+ BOOL b = GetChapterInfo(id, &ce);
+ BSTR bstr = GetChapterStringInfo(id, "eng", "");
+ if(bstr) ::SysFreeString(bstr);
+ }
+ */
+#endif
+
+ SetProperty(L"TITL", info.Title);
+ // TODO
+
+ // resources
+
+ {
+ POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
+ while(pos)
+ {
+ Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
+
+ POSITION pos = pA->AttachedFiles.GetHeadPosition();
+ while(pos)
+ {
+ AttachedFile* pF = pA->AttachedFiles.GetNext(pos);
+
+ CAtlArray<BYTE> pData;
+ pData.SetCount(pF->FileDataLen);
+ m_pFile->Seek(pF->FileDataPos);
+ if(SUCCEEDED(m_pFile->ByteRead(pData.GetData(), pData.GetCount())))
+ ResAppend(pF->FileName, pF->FileDescription, CStringW(pF->FileMimeType), pData.GetData(), pData.GetCount());
+ }
+ }
+ }
+
+ // chapters
+
+ if(ChapterAtom* caroot = m_pFile->m_segment.FindChapterAtom(0))
+ {
+ CStringA str;
+ str.ReleaseBufferSetLength(GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, str.GetBuffer(3), 3));
+ CStringA ChapLanguage = CStringA(ISO6391To6392(str));
+ if(ChapLanguage.GetLength() < 3) ChapLanguage = "eng";
+
+ POSITION pos = caroot->ChapterAtoms.GetHeadPosition();
+ while(pos)
+ {
+ // ca == caroot->ChapterAtoms.GetNext(pos) ?
+ if(ChapterAtom* ca = m_pFile->m_segment.FindChapterAtom(caroot->ChapterAtoms.GetNext(pos)->ChapterUID))
+ {
+ CStringW name, first;
+
+ POSITION pos = ca->ChapterDisplays.GetHeadPosition();
+ while(pos)
+ {
+ ChapterDisplay* cd = ca->ChapterDisplays.GetNext(pos);
+ if(first.IsEmpty()) first = cd->ChapString;
+ if(cd->ChapLanguage == ChapLanguage) name = cd->ChapString;
+ }
+
+ ChapAppend(ca->ChapterTimeStart / 100 - m_pFile->m_rtOffset, !name.IsEmpty() ? name : first);
+ }
+ }
+ }
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+void CMatroskaSplitterFilter::InstallFonts()
+{
+ POSITION pos = m_pFile->m_segment.Attachments.GetHeadPosition();
+ while(pos)
+ {
+ Attachment* pA = m_pFile->m_segment.Attachments.GetNext(pos);
+
+ POSITION p2 = pA->AttachedFiles.GetHeadPosition();
+ while(p2)
+ {
+ AttachedFile* pF = pA->AttachedFiles.GetNext(p2);
+
+ if(pF->FileMimeType == "application/x-truetype-font")
+ {
+ // assume this is a font resource
+
+ if(BYTE* pData = new BYTE[(UINT)pF->FileDataLen])
+ {
+ m_pFile->Seek(pF->FileDataPos);
+
+ if(SUCCEEDED(m_pFile->ByteRead(pData, pF->FileDataLen)))
+ m_fontinst.InstallFont(pData, (UINT)pF->FileDataLen);
+
+ delete [] pData;
+ }
+ }
+ }
+ }
+}
+
+void CMatroskaSplitterFilter::SendVorbisHeaderSample()
+{
+ HRESULT hr;
+
+ POSITION pos = m_pTrackEntryMap.GetStartPosition();
+ while(pos)
+ {
+ DWORD TrackNumber = 0;
+ TrackEntry* pTE = NULL;
+ m_pTrackEntryMap.GetNextAssoc(pos, TrackNumber, pTE);
+
+ CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNumber);
+
+ if(!(pTE && pPin && pPin->IsConnected()))
+ continue;
+
+ if(pTE->CodecID.ToString() == "A_VORBIS" && pPin->CurrentMediaType().subtype == MEDIASUBTYPE_Vorbis
+ && pTE->CodecPrivate.GetCount() > 0)
+ {
+ BYTE* ptr = pTE->CodecPrivate.GetData();
+
+ CAtlList<int> sizes;
+ long last = 0;
+ for(BYTE n = *ptr++; n > 0; n--)
+ {
+ int size = 0;
+ do {size += *ptr;} while(*ptr++ == 0xff);
+ sizes.AddTail(size);
+ last += size;
+ }
+ sizes.AddTail(pTE->CodecPrivate.GetCount() - (ptr - pTE->CodecPrivate.GetData()) - last);
+
+ hr = S_OK;
+
+ POSITION pos = sizes.GetHeadPosition();
+ while(pos && SUCCEEDED(hr))
+ {
+ long len = sizes.GetNext(pos);
+
+ CAutoPtr<Packet> p(new Packet());
+ p->TrackNumber = (DWORD)pTE->TrackNumber;
+ p->rtStart = 0; p->rtStop = 1;
+ p->bSyncPoint = FALSE;
+
+ p->SetData(ptr, len);
+ ptr += len;
+
+ hr = DeliverPacket(p);
+ }
+
+ if(FAILED(hr))
+ TRACE(_T("ERROR: Vorbis initialization failed for stream %I64d\n"), TrackNumber);
+ }
+ }
+}
+
+bool CMatroskaSplitterFilter::DemuxInit()
+{
+ CMatroskaNode Root(m_pFile);
+ if(!m_pFile
+ || !(m_pSegment = Root.Child(0x18538067))
+ || !(m_pCluster = m_pSegment->Child(0x1F43B675)))
+ return(false);
+
+ // reindex if needed
+
+ if(m_pFile->m_segment.Cues.GetCount() == 0)
+ {
+ m_nOpenProgress = 0;
+ m_pFile->m_segment.SegmentInfo.Duration.Set(0);
+
+ UINT64 TrackNumber = m_pFile->m_segment.GetMasterTrack();
+
+ CAutoPtr<Cue> pCue(new Cue());
+
+ do
+ {
+ Cluster c;
+ c.ParseTimeCode(m_pCluster);
+
+ m_pFile->m_segment.SegmentInfo.Duration.Set((float)c.TimeCode - m_pFile->m_rtOffset/10000);
+
+ CAutoPtr<CuePoint> pCuePoint(new CuePoint());
+ CAutoPtr<CueTrackPosition> pCueTrackPosition(new CueTrackPosition());
+ pCuePoint->CueTime.Set(c.TimeCode);
+ pCueTrackPosition->CueTrack.Set(TrackNumber);
+ pCueTrackPosition->CueClusterPosition.Set(m_pCluster->m_filepos - m_pSegment->m_start);
+ pCuePoint->CueTrackPositions.AddTail(pCueTrackPosition);
+ pCue->CuePoints.AddTail(pCuePoint);
+
+ m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
+
+ DWORD cmd;
+ if(CheckRequest(&cmd))
+ {
+ if(cmd == CMD_EXIT) m_fAbort = true;
+ else Reply(S_OK);
+ }
+ }
+ while(!m_fAbort && m_pCluster->Next(true));
+
+ m_nOpenProgress = 100;
+
+ if(!m_fAbort) m_pFile->m_segment.Cues.AddTail(pCue);
+
+ m_fAbort = false;
+ }
+
+ m_pCluster.Free();
+ m_pBlock.Free();
+
+ return(true);
+}
+
+void CMatroskaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ m_pCluster = m_pSegment->Child(0x1F43B675);
+ m_pBlock.Free();
+
+ if(rt > 0)
+ {
+ rt += m_pFile->m_rtOffset;
+
+ QWORD lastCueClusterPosition = -1;
+
+ Segment& s = m_pFile->m_segment;
+
+ UINT64 TrackNumber = s.GetMasterTrack();
+
+ POSITION pos1 = s.Cues.GetHeadPosition();
+ while(pos1)
+ {
+ Cue* pCue = s.Cues.GetNext(pos1);
+
+ POSITION pos2 = pCue->CuePoints.GetTailPosition();
+ while(pos2)
+ {
+ CuePoint* pCuePoint = pCue->CuePoints.GetPrev(pos2);
+
+ if(rt < s.GetRefTime(pCuePoint->CueTime))
+ continue;
+
+ POSITION pos3 = pCuePoint->CueTrackPositions.GetHeadPosition();
+ while(pos3)
+ {
+ CueTrackPosition* pCueTrackPositions = pCuePoint->CueTrackPositions.GetNext(pos3);
+
+ if(TrackNumber != pCueTrackPositions->CueTrack)
+ continue;
+
+ if(lastCueClusterPosition == pCueTrackPositions->CueClusterPosition)
+ continue;
+
+ lastCueClusterPosition = pCueTrackPositions->CueClusterPosition;
+
+ m_pCluster->SeekTo(m_pSegment->m_start + pCueTrackPositions->CueClusterPosition);
+ m_pCluster->Parse();
+
+ bool fFoundKeyFrame = false;
+/*
+ if(pCueTrackPositions->CueBlockNumber > 0)
+ {
+ // TODO: CueBlockNumber only tells the block num of the track and not for all mixed in the cluster
+ m_nLastBlock = (int)pCueTrackPositions->CueBlockNumber;
+ fFoundKeyFrame = true;
+ }
+ else
+*/
+ {
+ Cluster c;
+ c.ParseTimeCode(m_pCluster);
+
+ if(CAutoPtr<CMatroskaNode> pBlock = m_pCluster->GetFirstBlock())
+ {
+ bool fPassedCueTime = false;
+
+ do
+ {
+ CBlockGroupNode bgn;
+
+ if(pBlock->m_id == 0xA0)
+ {
+ bgn.Parse(pBlock, true);
+ }
+ else if(pBlock->m_id == 0xA3)
+ {
+ CAutoPtr<BlockGroup> bg(new BlockGroup());
+ bg->Block.Parse(pBlock, true);
+ if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
+ bgn.AddTail(bg);
+ }
+
+ POSITION pos4 = bgn.GetHeadPosition();
+ while(!fPassedCueTime && pos4)
+ {
+ BlockGroup* bg = bgn.GetNext(pos4);
+
+ if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && rt < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)
+ || rt + 5000000i64 < s.GetRefTime(c.TimeCode + bg->Block.TimeCode)) // allow 500ms difference between tracks, just in case intreleaving wasn't that much precise
+ {
+ fPassedCueTime = true;
+ }
+ else if(bg->Block.TrackNumber == pCueTrackPositions->CueTrack && !bg->ReferenceBlock.IsValid())
+ {
+ fFoundKeyFrame = true;
+ m_pBlock = pBlock->Copy();
+ }
+ }
+ }
+ while(!fPassedCueTime && pBlock->NextBlock());
+ }
+ }
+
+ if(fFoundKeyFrame)
+ pos1 = pos2 = pos3 = NULL;
+ }
+ }
+ }
+
+ if(!m_pBlock)
+ {
+ m_pCluster = m_pSegment->Child(0x1F43B675);
+ }
+ }
+}
+
+bool CMatroskaSplitterFilter::DemuxLoop()
+{
+ HRESULT hr = S_OK;
+
+ SendVorbisHeaderSample(); // HACK: init vorbis decoder with the headers
+
+ do
+ {
+ Cluster c;
+ c.ParseTimeCode(m_pCluster);
+
+ if(!m_pBlock) m_pBlock = m_pCluster->GetFirstBlock();
+ if(!m_pBlock) continue;
+
+ do
+ {
+ CBlockGroupNode bgn;
+
+ if(m_pBlock->m_id == 0xA0)
+ {
+ bgn.Parse(m_pBlock, true);
+ }
+ else if(m_pBlock->m_id == 0xA3)
+ {
+ CAutoPtr<BlockGroup> bg(new BlockGroup());
+ bg->Block.Parse(m_pBlock, true);
+ if(!(bg->Block.Lacing & 0x80)) bg->ReferenceBlock.Set(0); // not a kf
+ bgn.AddTail(bg);
+ }
+
+ while(bgn.GetCount())
+ {
+ CAutoPtr<MatroskaPacket> p(new MatroskaPacket());
+ p->bg = bgn.RemoveHead();
+
+ p->bSyncPoint = !p->bg->ReferenceBlock.IsValid();
+ p->TrackNumber = (DWORD)p->bg->Block.TrackNumber;
+
+ TrackEntry* pTE = m_pTrackEntryMap[p->TrackNumber];
+ if(!pTE) continue;
+
+ p->rtStart = m_pFile->m_segment.GetRefTime((REFERENCE_TIME)c.TimeCode + p->bg->Block.TimeCode);
+ p->rtStop = p->rtStart + (p->bg->BlockDuration.IsValid() ? m_pFile->m_segment.GetRefTime(p->bg->BlockDuration) : 1);
+
+ // Fix subtitle with duration = 0
+ if(pTE->TrackType == TrackEntry::TypeSubtitle && !p->bg->BlockDuration.IsValid())
+ {
+ p->bg->BlockDuration.Set(1); // just setting it to be valid
+ p->rtStop = p->rtStart;
+ }
+
+ POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CBinary* pb = p->bg->Block.BlockData.GetNext(pos);
+ pTE->Expand(*pb, ContentEncoding::AllFrameContents);
+ }
+
+ // HACK
+ p->rtStart -= m_pFile->m_rtOffset;
+ p->rtStop -= m_pFile->m_rtOffset;
+
+ hr = DeliverPacket(p);
+ }
+ }
+ while(m_pBlock->NextBlock() && SUCCEEDED(hr) && !CheckRequest(NULL));
+
+ m_pBlock.Free();
+ }
+ while(m_pFile->GetPos() < m_pFile->m_segment.pos + m_pFile->m_segment.len
+ && m_pCluster->Next(true) && SUCCEEDED(hr) && !CheckRequest(NULL));
+
+ m_pCluster.Free();
+
+ return(true);
+}
+
+// IMediaSeeking
+
+STDMETHODIMP CMatroskaSplitterFilter::GetDuration(LONGLONG* pDuration)
+{
+ CheckPointer(pDuration, E_POINTER);
+ CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
+
+ Segment& s = m_pFile->m_segment;
+ *pDuration = s.GetRefTime((INT64)s.SegmentInfo.Duration);
+
+ return S_OK;
+}
+
+// IKeyFrameInfo
+
+STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
+{
+ if(!m_pFile) return E_UNEXPECTED;
+
+ HRESULT hr = S_OK;
+
+ nKFs = 0;
+
+ POSITION pos = m_pFile->m_segment.Cues.GetHeadPosition();
+ while(pos) nKFs += m_pFile->m_segment.Cues.GetNext(pos)->CuePoints.GetCount();
+
+ return hr;
+}
+
+STDMETHODIMP CMatroskaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
+{
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
+
+ if(!m_pFile) return E_UNEXPECTED;
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
+
+ UINT nKFsTmp = 0;
+
+ POSITION pos1 = m_pFile->m_segment.Cues.GetHeadPosition();
+ while(pos1 && nKFsTmp < nKFs)
+ {
+ Cue* pCue = m_pFile->m_segment.Cues.GetNext(pos1);
+
+ POSITION pos2 = pCue->CuePoints.GetHeadPosition();
+ while(pos2 && nKFsTmp < nKFs)
+ pKFs[nKFsTmp++] = m_pFile->m_segment.GetRefTime(pCue->CuePoints.GetNext(pos2)->CueTime);
+ }
+
+ nKFs = nKFsTmp;
+
+ return S_OK;
+}
+
+//
+// CMatroskaSourceFilter
+//
+
+CMatroskaSourceFilter::CMatroskaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CMatroskaSplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
+
+//
+// CMatroskaSplitterOutputPin
+//
+
+CMatroskaSplitterOutputPin::CMatroskaSplitterOutputPin(
+ int nMinCache, REFERENCE_TIME rtDefaultDuration,
+ CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+ , m_nMinCache(nMinCache), m_rtDefaultDuration(rtDefaultDuration)
+{
+ m_nMinCache = 1;//max(m_nMinCache, 1);
+}
+
+CMatroskaSplitterOutputPin::~CMatroskaSplitterOutputPin()
+{
+}
+
+HRESULT CMatroskaSplitterOutputPin::DeliverEndFlush()
+{
+ {
+ CAutoLock cAutoLock(&m_csQueue);
+ m_packets.RemoveAll();
+ m_rob.RemoveAll();
+ m_tos.RemoveAll();
+ }
+
+ return __super::DeliverEndFlush();
+}
+
+HRESULT CMatroskaSplitterOutputPin::DeliverEndOfStream()
+{
+ CAutoLock cAutoLock(&m_csQueue);
+
+ // send out the last remaining packets from the queue
+
+ while(m_rob.GetCount())
+ {
+ MatroskaPacket* mp = m_rob.RemoveHead();
+ if(m_rob.GetCount() && !mp->bg->BlockDuration.IsValid())
+ mp->rtStop = m_rob.GetHead()->rtStart;
+ else if(m_rob.GetCount() == 0 && m_rtDefaultDuration > 0)
+ mp->rtStop = mp->rtStart + m_rtDefaultDuration;
+
+ timeoverride to = {mp->rtStart, mp->rtStop};
+ m_tos.AddTail(to);
+ }
+
+ while(m_packets.GetCount())
+ {
+ HRESULT hr = DeliverBlock(m_packets.RemoveHead());
+ if(hr != S_OK) return hr;
+ }
+
+ return __super::DeliverEndOfStream();
+}
+
+HRESULT CMatroskaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
+{
+ MatroskaPacket* mp = dynamic_cast<MatroskaPacket*>(p.m_p);
+ if(!mp) return __super::DeliverPacket(p);
+
+ // don't try to understand what's happening here, it's magic
+
+ CAutoLock cAutoLock(&m_csQueue);
+
+ CAutoPtr<MatroskaPacket> p2;
+ p.Detach();
+ p2.Attach(mp);
+ m_packets.AddTail(p2);
+
+ POSITION pos = m_rob.GetTailPosition();
+ for(int i = m_nMinCache-1; i > 0 && pos && mp->bg->ReferencePriority < m_rob.GetAt(pos)->bg->ReferencePriority; i--)
+ m_rob.GetPrev(pos);
+
+ if(!pos) m_rob.AddHead(mp);
+ else m_rob.InsertAfter(pos, mp);
+
+ mp = NULL;
+
+ if(m_rob.GetCount() == m_nMinCache+1)
+ {
+ ASSERT(m_nMinCache > 0);
+ pos = m_rob.GetHeadPosition();
+ MatroskaPacket* mp1 = m_rob.GetNext(pos);
+ MatroskaPacket* mp2 = m_rob.GetNext(pos);
+ if(!mp1->bg->BlockDuration.IsValid())
+ {
+ mp1->bg->BlockDuration.Set(1); // just to set it valid
+
+ if(mp1->rtStart >= mp2->rtStart)
+ {
+/* CString str;
+ str.Format(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
+ AfxMessageBox(str);
+*/
+ // TRACE(_T("mp1->rtStart (%I64d) >= mp2->rtStart (%I64d)!!!\n"), mp1->rtStart, mp2->rtStart);
+ }
+ else
+ {
+ mp1->rtStop = mp2->rtStart;
+ }
+ }
+ }
+
+ while(m_packets.GetCount())
+ {
+ mp = m_packets.GetHead();
+ if(!mp->bg->BlockDuration.IsValid()) break;
+
+ mp = m_rob.RemoveHead();
+ timeoverride to = {mp->rtStart, mp->rtStop};
+ m_tos.AddTail(to);
+
+ HRESULT hr = DeliverBlock(m_packets.RemoveHead());
+ if(hr != S_OK) return hr;
+ }
+
+ return S_OK;
+}
+
+HRESULT CMatroskaSplitterOutputPin::DeliverBlock(MatroskaPacket* p)
+{
+ HRESULT hr = S_FALSE;
+
+ if(m_tos.GetCount())
+ {
+ timeoverride to = m_tos.RemoveHead();
+// if(p->TrackNumber == 2)
+ TRACE(_T("(track=%d) %I64d, %I64d -> %I64d, %I64d (buffcnt=%d)\n"),
+ p->TrackNumber, p->rtStart, p->rtStop, to.rtStart, to.rtStop,
+ QueueCount());
+/**/
+ p->rtStart = to.rtStart;
+ p->rtStop = to.rtStop;
+ }
+
+ REFERENCE_TIME
+ rtStart = p->rtStart,
+ rtDelta = (p->rtStop - p->rtStart) / p->bg->Block.BlockData.GetCount(),
+ rtStop = p->rtStart + rtDelta;
+
+ POSITION pos = p->bg->Block.BlockData.GetHeadPosition();
+ while(pos)
+ {
+ CAutoPtr<Packet> tmp(new Packet());
+ tmp->TrackNumber = p->TrackNumber;
+ tmp->bDiscontinuity = p->bDiscontinuity;
+ tmp->bSyncPoint = p->bSyncPoint;
+ tmp->rtStart = rtStart;
+ tmp->rtStop = rtStop;
+ tmp->Copy(*p->bg->Block.BlockData.GetNext(pos));
+ if(S_OK != (hr = DeliverPacket(tmp))) break;
+
+ rtStart += rtDelta;
+ rtStop += rtDelta;
+
+ p->bSyncPoint = false;
+ p->bDiscontinuity = false;
+ }
+
+ return hr;
+}
+
+// ITrackInfo
+
+TrackEntry* CMatroskaSplitterFilter::GetTrackEntryAt(UINT aTrackIdx)
+{
+ if(aTrackIdx < 0 || aTrackIdx >= m_pOrderedTrackArray.GetCount())
+ return NULL;
+ return m_pOrderedTrackArray[aTrackIdx];
+}
+
+STDMETHODIMP_(UINT) CMatroskaSplitterFilter::GetTrackCount()
+{
+ return m_pTrackEntryMap.GetCount();
+}
+
+STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackInfo(UINT aTrackIdx, struct TrackElement* pStructureToFill)
+{
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return FALSE;
+
+ pStructureToFill->FlagDefault = !!pTE->FlagDefault;
+ pStructureToFill->FlagLacing = !!pTE->FlagLacing;
+ strncpy(pStructureToFill->Language, pTE->Language, 3);
+ if(pStructureToFill->Language[0] == '\0')
+ strncpy(pStructureToFill->Language, "eng", 3);
+ pStructureToFill->Language[3] = '\0';
+ pStructureToFill->MaxCache = (UINT)pTE->MaxCache;
+ pStructureToFill->MinCache = (UINT)pTE->MinCache;
+ pStructureToFill->Type = (BYTE)pTE->TrackType;
+ return TRUE;
+}
+
+STDMETHODIMP_(BOOL) CMatroskaSplitterFilter::GetTrackExtendedInfo(UINT aTrackIdx, void* pStructureToFill)
+{
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return FALSE;
+
+ if(pTE->TrackType == TrackEntry::TypeVideo)
+ {
+ TrackExtendedInfoVideo* pTEIV = (TrackExtendedInfoVideo*)pStructureToFill;
+ pTEIV->AspectRatioType = (BYTE)pTE->v.AspectRatioType;
+ pTEIV->DisplayUnit = (BYTE)pTE->v.DisplayUnit;
+ pTEIV->DisplayWidth = (UINT)pTE->v.DisplayWidth;
+ pTEIV->DisplayHeight = (UINT)pTE->v.DisplayHeight;
+ pTEIV->Interlaced = !!pTE->v.FlagInterlaced;
+ pTEIV->PixelWidth = (UINT)pTE->v.PixelWidth;
+ pTEIV->PixelHeight = (UINT)pTE->v.PixelHeight;
+ } else if(pTE->TrackType == TrackEntry::TypeAudio) {
+ TrackExtendedInfoAudio* pTEIA = (TrackExtendedInfoAudio*)pStructureToFill;
+ pTEIA->BitDepth = (UINT)pTE->a.BitDepth;
+ pTEIA->Channels = (UINT)pTE->a.Channels;
+ pTEIA->OutputSamplingFrequency = pTE->a.OutputSamplingFrequency;
+ pTEIA->SamplingFreq = pTE->a.SamplingFrequency;
+ } else {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackName(UINT aTrackIdx)
+{
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->Name.AllocSysString();
+}
+
+STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecID(UINT aTrackIdx)
+{
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->CodecID.ToString().AllocSysString();
+}
+
+STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecName(UINT aTrackIdx)
+{
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->CodecName.AllocSysString();
+}
+
+STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecInfoURL(UINT aTrackIdx)
+{
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->CodecInfoURL.AllocSysString();
+}
+
+STDMETHODIMP_(BSTR) CMatroskaSplitterFilter::GetTrackCodecDownloadURL(UINT aTrackIdx)
+{
+ TrackEntry* pTE = GetTrackEntryAt(aTrackIdx);
+ if(pTE == NULL)
+ return NULL;
+ return pTE->CodecDownloadURL.AllocSysString();
+}
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.def b/src/filters/parser/matroskasplitter/MatroskaSplitter.def
new file mode 100644
index 000000000..3562761e9
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "MatroskaSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.h b/src/filters/parser/matroskasplitter/MatroskaSplitter.h
new file mode 100644
index 000000000..dfa17988f
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaSplitter.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "MatroskaFile.h"
+#include "..\BaseSplitter\BaseSplitter.h"
+#include "..\..\..\..\include\ITrackInfo.h"
+
+class MatroskaPacket : public Packet
+{
+protected:
+ int GetDataSize()
+ {
+ int size = 0;
+ POSITION pos = bg->Block.BlockData.GetHeadPosition();
+ while(pos) {size += bg->Block.BlockData.GetNext(pos)->GetCount();}
+ return size;
+ }
+public:
+ CAutoPtr<MatroskaReader::BlockGroup> bg;
+};
+
+class CMatroskaSplitterOutputPin : public CBaseSplitterOutputPin
+{
+ HRESULT DeliverBlock(MatroskaPacket* p);
+
+ int m_nMinCache;
+ REFERENCE_TIME m_rtDefaultDuration;
+
+ CCritSec m_csQueue;
+ CAutoPtrList<MatroskaPacket> m_packets;
+ CAtlList<MatroskaPacket*> m_rob;
+
+ typedef struct {REFERENCE_TIME rtStart, rtStop;} timeoverride;
+ CAtlList<timeoverride> m_tos;
+
+protected:
+ HRESULT DeliverPacket(CAutoPtr<Packet> p);
+
+public:
+ CMatroskaSplitterOutputPin(
+ int nMinCache, REFERENCE_TIME rtDefaultDuration,
+ CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CMatroskaSplitterOutputPin();
+
+ HRESULT DeliverEndFlush();
+ HRESULT DeliverEndOfStream();
+};
+
+[uuid("149D2E01-C32E-4939-80F6-C07B81015A7A")]
+class CMatroskaSplitterFilter : public CBaseSplitterFilter, public ITrackInfo
+{
+ void SendVorbisHeaderSample();
+ void InstallFonts();
+
+ CAutoPtr<MatroskaReader::CMatroskaNode> m_pSegment, m_pCluster, m_pBlock;
+
+protected:
+ CAutoPtr<MatroskaReader::CMatroskaFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ CAtlMap<DWORD, MatroskaReader::TrackEntry*> m_pTrackEntryMap;
+ CAtlArray<MatroskaReader::TrackEntry* > m_pOrderedTrackArray;
+ MatroskaReader::TrackEntry* GetTrackEntryAt(UINT aTrackIdx);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+public:
+ CMatroskaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CMatroskaSplitterFilter();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+
+ // IKeyFrameInfo
+
+ STDMETHODIMP GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+
+ // ITrackInfo
+
+ STDMETHODIMP_(UINT) GetTrackCount();
+ STDMETHODIMP_(BOOL) GetTrackInfo(UINT aTrackIdx, struct TrackElement* pStructureToFill);
+ STDMETHODIMP_(BOOL) GetTrackExtendedInfo(UINT aTrackIdx, void* pStructureToFill);
+ STDMETHODIMP_(BSTR) GetTrackName(UINT aTrackIdx);
+ STDMETHODIMP_(BSTR) GetTrackCodecID(UINT aTrackIdx);
+ STDMETHODIMP_(BSTR) GetTrackCodecName(UINT aTrackIdx);
+ STDMETHODIMP_(BSTR) GetTrackCodecInfoURL(UINT aTrackIdx);
+ STDMETHODIMP_(BSTR) GetTrackCodecDownloadURL(UINT aTrackIdx);
+};
+
+[uuid("0A68C3B5-9164-4a54-AFAF-995B2FF0E0D4")]
+class CMatroskaSourceFilter : public CMatroskaSplitterFilter
+{
+public:
+ CMatroskaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.rc b/src/filters/parser/matroskasplitter/MatroskaSplitter.rc
new file mode 100644
index 000000000..da2c185a0
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,2,8
+ PRODUCTVERSION 1,0,2,8
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Matroska Splitter"
+ VALUE "FileVersion", "1, 0, 2, 8"
+ VALUE "InternalName", "Matroska Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "MatroskaSplitter.ax"
+ VALUE "ProductName", "Matroska Splitter"
+ VALUE "ProductVersion", "1, 0, 2, 8"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.sln b/src/filters/parser/matroskasplitter/MatroskaSplitter.sln
new file mode 100644
index 000000000..0a14349b7
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaSplitter.sln
@@ -0,0 +1,81 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatroskaSplitter", "MatroskaSplitter.vcproj", "{3F5EA225-F4B7-4413-AEB3-4E4E5751E438}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug.ActiveCfg = Debug|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug.Build.0 = Debug|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug lib.ActiveCfg = Debug lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug lib.Build.0 = Debug lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release.ActiveCfg = Release|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release.Build.0 = Release|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release lib.ActiveCfg = Release lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release lib.Build.0 = Release lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode.Build.0 = Release Unicode|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {3F5EA225-F4B7-4413-AEB3-4E4E5751E438}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj b/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj
new file mode 100644
index 000000000..20895fafd
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaSplitter.vcproj
@@ -0,0 +1,558 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="MatroskaSplitter"
+ ProjectGUID="{3F5EA225-F4B7-4413-AEB3-4E4E5751E438}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="zlibD.lib strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="zlibR.lib strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="zlibD.lib strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="zlibR.lib strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\MatroskaFile.cpp">
+ </File>
+ <File
+ RelativePath="MatroskaSplitter.cpp">
+ </File>
+ <File
+ RelativePath="MatroskaSplitter.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\MatroskaFile.h">
+ </File>
+ <File
+ RelativePath="MatroskaSplitter.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\MatroskaSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter_vs2005.vcproj b/src/filters/parser/matroskasplitter/MatroskaSplitter_vs2005.vcproj
new file mode 100644
index 000000000..0ff165fbc
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaSplitter_vs2005.vcproj
@@ -0,0 +1,812 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="MatroskaSplitter"
+ ProjectGUID="{3F5EA225-F4B7-4413-AEB3-4E4E5751E438}"
+ RootNamespace="MatroskaSplitter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="zlibD.lib strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="zlibR.lib strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="zlibD.lib strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="zlibR.lib strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\MatroskaFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="MatroskaSplitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="MatroskaSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\MatroskaFile.h"
+ >
+ </File>
+ <File
+ RelativePath="MatroskaSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\MatroskaSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/matroskasplitter/MatroskaSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/matroskasplitter/MatroskaSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/MatroskaSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/matroskasplitter/resource.h b/src/filters/parser/matroskasplitter/resource.h
new file mode 100644
index 000000000..1cd7111d9
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by MatroskaSplitter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/matroskasplitter/stdafx.cpp b/src/filters/parser/matroskasplitter/stdafx.cpp
new file mode 100644
index 000000000..c3b346d99
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// MatroskaSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/matroskasplitter/stdafx.h b/src/filters/parser/matroskasplitter/stdafx.h
new file mode 100644
index 000000000..482cd4924
--- /dev/null
+++ b/src/filters/parser/matroskasplitter/stdafx.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
+#include "..\..\..\DSUtil\DSUtil.h"
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Config/Ap4Config.h b/src/filters/parser/mp4splitter/AP4/Source/Config/Ap4Config.h
new file mode 100644
index 000000000..2df5db91d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Config/Ap4Config.h
@@ -0,0 +1,69 @@
+/*****************************************************************
+|
+| AP4 - Target Platform and Compiler Configuration
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CONFIG_H_
+#define _AP4_CONFIG_H_
+
+/*----------------------------------------------------------------------
+| defaults
++---------------------------------------------------------------------*/
+#define AP4_CONFIG_HAVE_CPP_STRING_H
+#define AP4_CONFIG_HAVE_STDIO_H
+#define AP4_CONFIG_HAVE_ASSERT_H
+
+#define AP4_CONFIG_HAVE_CPP_STRING
+
+#define AP4_CONFIG_HAVE_SNPRINTF
+
+/*----------------------------------------------------------------------
+| byte order
++---------------------------------------------------------------------*/
+// define AP4_PLATFORM_BYTE_ORDER to one of these two choices
+#define AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN 0
+#define AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN 1
+
+#ifdef __ppc__
+#define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN
+#endif
+
+#define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN
+
+/*----------------------------------------------------------------------
+| Win32 specifics
++---------------------------------------------------------------------*/
+#ifdef WIN32
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#if defined(_DEBUG)
+#define AP4_DEBUG
+#endif
+#endif
+
+#endif // _AP4_CONFIG_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries
new file mode 100644
index 000000000..b317df77f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries
@@ -0,0 +1,2 @@
+/Ap4Config.h/1.1/Tue Oct 25 00:42:32 2005//
+D
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Extra b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Extra
new file mode 100644
index 000000000..3587c8435
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Extra
@@ -0,0 +1 @@
+/Ap4Config.h////
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Extra.Old b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Extra.Old
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Extra.Old
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Old b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Old
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Entries.Old
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Repository b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Repository
new file mode 100644
index 000000000..9923aa0ae
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Repository
@@ -0,0 +1 @@
+guliverkli/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Config
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Root b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Root
new file mode 100644
index 000000000..bec0b42bd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Config/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@cvs.sourceforge.net:/cvsroot/guliverkli
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4.h
new file mode 100644
index 000000000..3f9ea0518
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4.h
@@ -0,0 +1,41 @@
+/*****************************************************************
+|
+| AP4 - Main Header
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_H_
+#define _AP4_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Config.h"
+#include "Ap4Types.h"
+#include "Ap4Constants.h"
+#include "Ap4Results.h"
+#include "Ap4Debug.h"
+
+#endif // _AP4_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Array.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Array.h
new file mode 100644
index 000000000..0a057fe0c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Array.h
@@ -0,0 +1,152 @@
+/*****************************************************************
+|
+| AP4 - Arrays
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ARRAY_H_
+#define _AP4_ARRAY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_ARRAY_INITIAL_COUNT = 64;
+
+/*----------------------------------------------------------------------
+| AP4_Array
++---------------------------------------------------------------------*/
+template <typename T>
+class AP4_Array
+{
+public:
+ // methods
+ AP4_Array<T>(): m_AllocatedCount(0), m_ItemCount(0), m_Items(0) {}
+ virtual ~AP4_Array<T>();
+ AP4_Cardinal ItemCount() { return m_ItemCount; }
+ AP4_Result Append(const T& item);
+ T& operator[](unsigned long idx);
+ AP4_Result EnsureCapacity(AP4_Cardinal count);
+
+protected:
+ // members
+ AP4_Cardinal m_AllocatedCount;
+ AP4_Cardinal m_ItemCount;
+ T* m_Items;
+ T m_OverflowItem;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Array<T>::~AP4_Array<T>
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Array<T>::~AP4_Array<T>()
+{
+ delete[] m_Items;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Array<T>::EnsureCapacity
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_Array<T>::EnsureCapacity(AP4_Cardinal count)
+{
+ if (count <= m_AllocatedCount) return AP4_SUCCESS;
+
+ unsigned long new_count;
+ if (m_AllocatedCount) {
+ new_count = 2*m_AllocatedCount;
+ } else {
+ new_count = AP4_ARRAY_INITIAL_COUNT;
+ }
+
+ // (re)allocate the items
+ T* new_items = new T[new_count];
+ if (new_items == NULL) {
+ return AP4_ERROR_OUT_OF_MEMORY;
+ }
+ if (m_ItemCount && m_Items) {
+ for (unsigned int i=0; i<m_ItemCount; i++) {
+ new_items[i] = m_Items[i];
+ }
+ delete[] m_Items;
+ }
+ m_Items = new_items;
+ m_AllocatedCount = new_count;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Array<T>::operator[]
++---------------------------------------------------------------------*/
+template <typename T>
+T&
+AP4_Array<T>::operator[](unsigned long idx)
+{
+ if (idx >= m_ItemCount) {
+ return m_OverflowItem;
+ } else {
+ return m_Items[idx];
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Array<T>::Append
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_Array<T>::Append(const T& item)
+{
+ // ensure capacity
+ AP4_Result result = EnsureCapacity(m_ItemCount+1);
+ if (result != AP4_SUCCESS) return result;
+
+ // store the item
+ m_Items[m_ItemCount++] = item;
+
+ return AP4_SUCCESS;
+}
+
+#endif // _AP4_ARRAY_H_
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.cpp
new file mode 100644
index 000000000..d62a2f831
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.cpp
@@ -0,0 +1,433 @@
+/*****************************************************************
+|
+| AP4 - Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Utils.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| AP4_Atom::AP4_Atom
++---------------------------------------------------------------------*/
+AP4_Atom::AP4_Atom(Type type,
+ bool is_full) :
+ m_Type(type),
+ m_Size(is_full ? AP4_FULL_ATOM_HEADER_SIZE : AP4_ATOM_HEADER_SIZE),
+ m_IsFull(is_full),
+ m_Version(0),
+ m_Flags(0),
+ m_Parent(NULL)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::AP4_Atom
++---------------------------------------------------------------------*/
+AP4_Atom::AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full) :
+ m_Type(type),
+ m_Size(size),
+ m_IsFull(is_full),
+ m_Version(0),
+ m_Flags(0),
+ m_Parent(NULL)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::AP4_Atom
++---------------------------------------------------------------------*/
+AP4_Atom::AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream) :
+ m_Type(type),
+ m_Size(size),
+ m_IsFull(is_full),
+ m_Parent(NULL)
+{
+ // if this is a full atom, read the version and flags
+ if (is_full) {
+ AP4_UI32 header;
+ stream.ReadUI32(header);
+ m_Version = (header>>24)&0xFF;
+ m_Flags = (header&0xFFFFFF);
+ } else {
+ m_Version = 0;
+ m_Flags = 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::GetHeaderSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_Atom::GetHeaderSize()
+{
+ return m_IsFull ? AP4_FULL_ATOM_HEADER_SIZE : AP4_ATOM_HEADER_SIZE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::WriteHeader
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::WriteHeader(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the size
+ result = stream.WriteUI32(m_Size);
+ if (AP4_FAILED(result)) return result;
+
+ // write the type
+ result = stream.WriteUI32(m_Type);
+ if (AP4_FAILED(result)) return result;
+
+ // for full atoms, write version and flags
+ if (m_IsFull) {
+ result = stream.WriteUI08(m_Version);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI24(m_Flags);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::Write(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+#if defined(AP4_DEBUG)
+ AP4_Offset before;
+ stream.Tell(before);
+#endif
+
+ // write the header
+ result = WriteHeader(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // write the fields
+ result = WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+#if defined(AP4_DEBUG)
+ AP4_Offset after;
+ stream.Tell(after);
+ AP4_ASSERT(after-before == m_Size);
+#endif
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::Inspect(AP4_AtomInspector& inspector)
+{
+ InspectHeader(inspector);
+ InspectFields(inspector);
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::InspectHeader
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::InspectHeader(AP4_AtomInspector& inspector)
+{
+ // write atom name
+ char name[7];
+ name[0] = '[';
+ AP4_FormatFourChars(&name[1], m_Type);
+ name[5] = ']';
+ name[6] = '\0';
+ char size[64];
+ AP4_StringFormat(size, sizeof(size), "size=%ld+%ld", GetHeaderSize(),
+ m_Size-GetHeaderSize());
+ inspector.StartElement(name, size);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::Detach
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::Detach()
+{
+ if (m_Parent) {
+ return m_Parent->RemoveChild(this);
+ } else {
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownAtom::AP4_UnknownAtom
++---------------------------------------------------------------------*/
+AP4_UnknownAtom::AP4_UnknownAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream) :
+ AP4_Atom(type, size, is_full, stream),
+ m_SourceStream(&stream)
+{
+ // store source stream offset
+ stream.Tell(m_SourceOffset);
+
+ // keep a reference to the source stream
+ m_SourceStream->AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownAtom::~AP4_UnknownAtom
++---------------------------------------------------------------------*/
+AP4_UnknownAtom::~AP4_UnknownAtom()
+{
+ // release the source stream reference
+ if (m_SourceStream) {
+ m_SourceStream->Release();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_UnknownAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // check that we have a source stream
+ // and a normal size
+ if (m_SourceStream == NULL || m_Size < 8) {
+ return AP4_FAILURE;
+ }
+
+ // seek into the source at the stored offset
+ result = m_SourceStream->Seek(m_SourceOffset);
+ if (AP4_FAILED(result)) return result;
+
+ // copy the source stream to the output
+ result = m_SourceStream->CopyTo(stream, m_Size-GetHeaderSize());
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::~AP4_AtomParent
++---------------------------------------------------------------------*/
+AP4_AtomParent::~AP4_AtomParent()
+{
+ m_Children.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::AddChild
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomParent::AddChild(AP4_Atom* child, int position)
+{
+ // check that the child does not already have a parent
+ if (child->GetParent() != NULL) return AP4_ERROR_INVALID_PARAMETERS;
+
+ // attach the child
+ AP4_Result result;
+ if (position == -1) {
+ // insert at the tail
+ result = m_Children.Add(child);
+ } else if (position == 0) {
+ // insert at the head
+ result = m_Children.Insert(NULL, child);
+ } else {
+ // insert after <n-1>
+ AP4_List<AP4_Atom>::Item* insertion_point = m_Children.FirstItem();
+ unsigned int count = position;
+ while (insertion_point && --count) {
+ insertion_point = insertion_point->GetNext();
+ }
+ if (insertion_point) {
+ result = m_Children.Insert(insertion_point, child);
+ } else {
+ result = AP4_ERROR_OUT_OF_RANGE;
+ }
+ }
+ if (AP4_FAILED(result)) return result;
+
+ // notify the child of its parent
+ child->SetParent(this);
+
+ // get a chance to update
+ OnChildAdded(child);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::RemoveChild
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomParent::RemoveChild(AP4_Atom* child)
+{
+ // check that this is our child
+ if (child->GetParent() != this) return AP4_ERROR_INVALID_PARAMETERS;
+
+ // remove the child
+ AP4_Result result = m_Children.Remove(child);
+ if (AP4_FAILED(result)) return result;
+
+ // notify that child that it is orphaned
+ child->SetParent(NULL);
+
+ // get a chance to update
+ OnChildRemoved(child);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::DeleteChild
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomParent::DeleteChild(AP4_Atom::Type type)
+{
+ // find the child
+ AP4_Atom* child = GetChild(type);
+ if (child == NULL) return AP4_FAILURE;
+
+ // remove the child
+ AP4_Result result = RemoveChild(child);
+ if (AP4_FAILED(result)) return result;
+
+ // delete the child
+ delete child;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::GetChild
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_AtomParent::GetChild(AP4_Atom::Type type, AP4_Ordinal index /* = 0 */)
+{
+ AP4_Atom* atom;
+ AP4_Result result = m_Children.Find(AP4_AtomFinder(type, index), atom);
+ if (AP4_SUCCEEDED(result)) {
+ return atom;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::FindChild
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_AtomParent::FindChild(const char* path,
+ bool auto_create)
+{
+ // start from here
+ AP4_AtomParent* parent = this;
+
+ // walk the path
+ while (path[0] && path[1] && path[2] && path[3]) {
+ // we have 4 valid chars
+ const char* tail;
+ int index = 0;
+ if (path[4] == '\0') {
+ tail = NULL;
+ } else if (path[4] == '/') {
+ // separator
+ tail = &path[5];
+ } else if (path[4] == '[') {
+ const char* x = &path[5];
+ while (*x >= '0' && *x <= '9') {
+ index = 10*index+(*x++ - '0');
+ }
+ if (x[0] == ']') {
+ if (x[1] == '\0') {
+ tail = NULL;
+ } else {
+ tail = x+2;
+ }
+ } else {
+ // malformed path
+ return NULL;
+ }
+ } else {
+ // malformed path
+ return NULL;
+ }
+
+ // look for this atom in the current list
+ AP4_Atom::Type type = AP4_ATOM_TYPE(path[0], path[1], path[2], path[3]);
+ AP4_Atom* atom = parent->GetChild(type, index);
+ if (atom == NULL) {
+ // not found
+ if (auto_create && (index == 0)) {
+ AP4_ContainerAtom* container = dynamic_cast<AP4_ContainerAtom*>(parent);
+ if (parent) {
+ atom = new AP4_ContainerAtom(type, false);
+ container->AddChild(atom);
+ } else {
+ return NULL;
+ }
+ } else {
+ return NULL;
+ }
+ }
+
+ if (tail) {
+ path = tail;
+ // if this atom is an atom parent, recurse
+ parent = dynamic_cast<AP4_ContainerAtom*>(atom);
+ if (parent == NULL) return NULL;
+ } else {
+ return atom;
+ }
+ }
+
+ // not found
+ return NULL;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.h
new file mode 100644
index 000000000..48a3b6e73
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Atom.h
@@ -0,0 +1,344 @@
+/*****************************************************************
+|
+| AP4 - Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ATOM_H_
+#define _AP4_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4List.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define AP4_ATOM_TYPE(a,b,c,d) \
+ ((((unsigned long)a)<<24) | \
+ (((unsigned long)b)<<16) | \
+ (((unsigned long)c)<< 8) | \
+ (((unsigned long)d) ))
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_ATOM_HEADER_SIZE = 8;
+const int AP4_FULL_ATOM_HEADER_SIZE = 12;
+const int AP4_ATOM_MAX_NAME_SIZE = 256;
+const int AP4_ATOM_MAX_URI_SIZE = 512;
+
+/*----------------------------------------------------------------------
+| forward references
++---------------------------------------------------------------------*/
+class AP4_AtomParent;
+
+/*----------------------------------------------------------------------
+| AP4_AtomInspector
++---------------------------------------------------------------------*/
+class AP4_AtomInspector {
+public:
+ // types
+ typedef enum {
+ HINT_NONE,
+ HINT_HEX,
+ HINT_BOOLEAN
+ } FormatHint;
+
+ // constructor and destructor
+ AP4_AtomInspector() {}
+ virtual ~AP4_AtomInspector() {}
+
+ // methods
+ virtual void StartElement(const char* name, const char* extra = NULL) {}
+ virtual void EndElement() {}
+ virtual void AddField(const char* name, AP4_UI32 value, FormatHint hint = HINT_NONE) {}
+ virtual void AddField(const char* name, const char* value, FormatHint hint = HINT_NONE) {}
+};
+
+/*----------------------------------------------------------------------
+| AP4_Atom
++---------------------------------------------------------------------*/
+class AP4_Atom {
+ public:
+ // types
+ typedef AP4_UI32 Type;
+
+ // methods
+ AP4_Atom(Type type,
+ bool is_full = false);
+ AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full = false);
+ AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream);
+ virtual ~AP4_Atom() {}
+ Type GetType() { return m_Type; }
+ void SetType(Type type) { m_Type = type; }
+ AP4_Size GetHeaderSize();
+ virtual AP4_Size GetSize() { return m_Size; }
+ virtual AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Result WriteHeader(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream) = 0;
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual AP4_Result InspectHeader(AP4_AtomInspector& inspector);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector) {
+ return AP4_SUCCESS;
+ }
+
+ // parent/child realtionship methods
+ virtual AP4_Result SetParent(AP4_AtomParent* parent) {
+ m_Parent = parent;
+ return AP4_SUCCESS;
+ }
+ virtual AP4_AtomParent* GetParent() { return m_Parent; }
+ virtual AP4_Result Detach();
+
+ // override this if your want to make an atom cloneable
+ virtual AP4_Atom* Clone() { return NULL; }
+
+ protected:
+ // members
+ Type m_Type;
+ AP4_Size m_Size;
+ bool m_IsFull;
+ AP4_UI32 m_Version;
+ AP4_UI32 m_Flags;
+ AP4_AtomParent* m_Parent;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent
++---------------------------------------------------------------------*/
+class AP4_AtomParent {
+public:
+ // base methods
+ virtual ~AP4_AtomParent();
+ AP4_List<AP4_Atom>& GetChildren() { return m_Children; }
+ virtual AP4_Result AddChild(AP4_Atom* child, int position = -1);
+ virtual AP4_Result RemoveChild(AP4_Atom* child);
+ virtual AP4_Result DeleteChild(AP4_Atom::Type type);
+ virtual AP4_Atom* GetChild(AP4_Atom::Type type, AP4_Ordinal index = 0);
+ virtual AP4_Atom* FindChild(const char* path,
+ bool auto_create = false);
+
+ // methods designed to be overridden
+ virtual void OnChildChanged(AP4_Atom* child) {}
+ virtual void OnChildAdded(AP4_Atom* child) {}
+ virtual void OnChildRemoved(AP4_Atom* child) {}
+
+protected:
+ // members
+ AP4_List<AP4_Atom> m_Children;
+};
+
+/*----------------------------------------------------------------------
+| AP4_UnknownAtom
++---------------------------------------------------------------------*/
+class AP4_UnknownAtom : public AP4_Atom {
+public:
+ // constructor and destructor
+ AP4_UnknownAtom(AP4_Atom::Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream);
+ ~AP4_UnknownAtom();
+
+ // methods
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_ByteStream* m_SourceStream;
+ AP4_Offset m_SourceOffset;
+};
+
+/*----------------------------------------------------------------------
+| atom types
++---------------------------------------------------------------------*/
+const AP4_Atom::Type AP4_ATOM_TYPE_UDTA = AP4_ATOM_TYPE('u','d','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_URL = AP4_ATOM_TYPE('u','r','l',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_TRAK = AP4_ATOM_TYPE('t','r','a','k');
+const AP4_Atom::Type AP4_ATOM_TYPE_TKHD = AP4_ATOM_TYPE('t','k','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_STTS = AP4_ATOM_TYPE('s','t','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSZ = AP4_ATOM_TYPE('s','t','s','z');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSS = AP4_ATOM_TYPE('s','t','s','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSD = AP4_ATOM_TYPE('s','t','s','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSC = AP4_ATOM_TYPE('s','t','s','c');
+const AP4_Atom::Type AP4_ATOM_TYPE_STCO = AP4_ATOM_TYPE('s','t','c','o');
+const AP4_Atom::Type AP4_ATOM_TYPE_STBL = AP4_ATOM_TYPE('s','t','b','l');
+const AP4_Atom::Type AP4_ATOM_TYPE_SINF = AP4_ATOM_TYPE('s','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_SCHM = AP4_ATOM_TYPE('s','c','h','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_SCHI = AP4_ATOM_TYPE('s','c','h','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_MVHD = AP4_ATOM_TYPE('m','v','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4S = AP4_ATOM_TYPE('m','p','4','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4A = AP4_ATOM_TYPE('m','p','4','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4V = AP4_ATOM_TYPE('m','p','4','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_AVC1 = AP4_ATOM_TYPE('a','v','c','1');
+const AP4_Atom::Type AP4_ATOM_TYPE_ENCA = AP4_ATOM_TYPE('e','n','c','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_ENCV = AP4_ATOM_TYPE('e','n','c','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_MOOV = AP4_ATOM_TYPE('m','o','o','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_MINF = AP4_ATOM_TYPE('m','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_META = AP4_ATOM_TYPE('m','e','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDHD = AP4_ATOM_TYPE('m','d','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_ILST = AP4_ATOM_TYPE('i','l','s','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_HDLR = AP4_ATOM_TYPE('h','d','l','r');
+const AP4_Atom::Type AP4_ATOM_TYPE_FTYP = AP4_ATOM_TYPE('f','t','y','p');
+const AP4_Atom::Type AP4_ATOM_TYPE_ESDS = AP4_ATOM_TYPE('e','s','d','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_EDTS = AP4_ATOM_TYPE('e','d','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_DRMS = AP4_ATOM_TYPE('d','r','m','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_DREF = AP4_ATOM_TYPE('d','r','e','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_DINF = AP4_ATOM_TYPE('d','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_CTTS = AP4_ATOM_TYPE('c','t','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDIA = AP4_ATOM_TYPE('m','d','i','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_VMHD = AP4_ATOM_TYPE('v','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_SMHD = AP4_ATOM_TYPE('s','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_NMHD = AP4_ATOM_TYPE('n','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_HMHD = AP4_ATOM_TYPE('h','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_FRMA = AP4_ATOM_TYPE('f','r','m','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDAT = AP4_ATOM_TYPE('m','d','a','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_FREE = AP4_ATOM_TYPE('f','r','e','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_TIMS = AP4_ATOM_TYPE('t','i','m','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_RTP = AP4_ATOM_TYPE('r','t','p',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_HNTI = AP4_ATOM_TYPE('h','n','t','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_SDP = AP4_ATOM_TYPE('s','d','p',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_IKMS = AP4_ATOM_TYPE('i','K','M','S');
+const AP4_Atom::Type AP4_ATOM_TYPE_ISFM = AP4_ATOM_TYPE('i','S','F','M');
+const AP4_Atom::Type AP4_ATOM_TYPE_HINT = AP4_ATOM_TYPE('h','i','n','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_TREF = AP4_ATOM_TYPE('t','r','e','f');
+
+const AP4_Atom::Type AP4_ATOM_TYPE_AVCC = AP4_ATOM_TYPE('a','v','c','C');
+const AP4_Atom::Type AP4_ATOM_TYPE_TEXT = AP4_ATOM_TYPE('t','e','x','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_TX3G = AP4_ATOM_TYPE('t','x','3','g');
+const AP4_Atom::Type AP4_ATOM_TYPE_FTAB = AP4_ATOM_TYPE('f','t','a','b');
+const AP4_Atom::Type AP4_ATOM_TYPE_CVID = AP4_ATOM_TYPE('c','v','i','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_SVQ1 = AP4_ATOM_TYPE('S','V','Q','1');
+const AP4_Atom::Type AP4_ATOM_TYPE_SVQ2 = AP4_ATOM_TYPE('S','V','Q','2');
+const AP4_Atom::Type AP4_ATOM_TYPE_SVQ3 = AP4_ATOM_TYPE('S','V','Q','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_H263 = AP4_ATOM_TYPE('h','2','6','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_S263 = AP4_ATOM_TYPE('s','2','6','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_SAMR = AP4_ATOM_TYPE('s','a','m','r');
+const AP4_Atom::Type AP4_ATOM_TYPE__MP3 = AP4_ATOM_TYPE('.','m','p','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_IMA4 = AP4_ATOM_TYPE('i','m','a','4');
+const AP4_Atom::Type AP4_ATOM_TYPE_TWOS = AP4_ATOM_TYPE('t','w','o','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_SOWT = AP4_ATOM_TYPE('s','o','w','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_CHPL = AP4_ATOM_TYPE('c','h','p','l');
+const AP4_Atom::Type AP4_ATOM_TYPE_NAM = AP4_ATOM_TYPE(169,'n','a','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_ART = AP4_ATOM_TYPE(169,'A','R','T');
+const AP4_Atom::Type AP4_ATOM_TYPE_WRT = AP4_ATOM_TYPE(169,'w','r','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_ALB = AP4_ATOM_TYPE(169,'a','l','b');
+const AP4_Atom::Type AP4_ATOM_TYPE_DAY = AP4_ATOM_TYPE(169,'d','a','y');
+const AP4_Atom::Type AP4_ATOM_TYPE_TOO = AP4_ATOM_TYPE(169,'t','o','o');
+const AP4_Atom::Type AP4_ATOM_TYPE_CMT = AP4_ATOM_TYPE(169,'c','m','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_GEN = AP4_ATOM_TYPE(169,'g','e','n');
+const AP4_Atom::Type AP4_ATOM_TYPE_TRKN = AP4_ATOM_TYPE('t','r','k','n');
+const AP4_Atom::Type AP4_ATOM_TYPE_DATA = AP4_ATOM_TYPE('d','a','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_WAVE = AP4_ATOM_TYPE('w','a','v','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_CMOV = AP4_ATOM_TYPE('c','m','o','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_DCOM = AP4_ATOM_TYPE('d','c','o','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_CMVD = AP4_ATOM_TYPE('c','m','v','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_CO64 = AP4_ATOM_TYPE('c','o','6','4');
+
+
+/*----------------------------------------------------------------------
+| AP4_AtomListInspector
++---------------------------------------------------------------------*/
+class AP4_AtomListInspector : public AP4_List<AP4_Atom>::Item::Operator
+{
+ public:
+ AP4_AtomListInspector(AP4_AtomInspector& inspector) :
+ m_Inspector(inspector) {}
+ AP4_Result Action(AP4_Atom* atom) const {
+ atom->Inspect(m_Inspector);
+ return AP4_SUCCESS;
+ }
+
+ private:
+ AP4_AtomInspector& m_Inspector;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomListWriter
++---------------------------------------------------------------------*/
+class AP4_AtomListWriter : public AP4_List<AP4_Atom>::Item::Operator
+{
+ public:
+ AP4_AtomListWriter(AP4_ByteStream& stream) :
+ m_Stream(stream) {}
+ AP4_Result Action(AP4_Atom* atom) const {
+ atom->Write(m_Stream);
+ return AP4_SUCCESS;
+ }
+
+ private:
+ AP4_ByteStream& m_Stream;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomFinder
++---------------------------------------------------------------------*/
+class AP4_AtomFinder : public AP4_List<AP4_Atom>::Item::Finder
+{
+ public:
+ AP4_AtomFinder(AP4_Atom::Type type, AP4_Ordinal index = 0) :
+ m_Type(type), m_Index(index) {}
+ AP4_Result Test(AP4_Atom* atom) const {
+ if (atom->GetType() == m_Type) {
+ if (m_Index-- == 0) {
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+ private:
+ AP4_Atom::Type m_Type;
+ mutable AP4_Ordinal m_Index;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomSizeAdder
++---------------------------------------------------------------------*/
+class AP4_AtomSizeAdder : public AP4_List<AP4_Atom>::Item::Operator {
+public:
+ AP4_AtomSizeAdder(AP4_Size& size) : m_Size(size) {}
+
+private:
+ AP4_Result Action(AP4_Atom* atom) const {
+ m_Size += atom->GetSize();
+ return AP4_SUCCESS;
+ }
+ AP4_Size& m_Size;
+};
+
+#endif // _AP4_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.cpp
new file mode 100644
index 000000000..b8036429e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.cpp
@@ -0,0 +1,454 @@
+/*****************************************************************
+|
+| AP4 - Atom Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4SampleEntry.h"
+#include "Ap4IsmaCryp.h"
+#include "Ap4UrlAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4DrefAtom.h"
+#include "Ap4TkhdAtom.h"
+#include "Ap4MdhdAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4StscAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4Co64Atom.h"
+#include "Ap4StszAtom.h"
+#include "Ap4EsdsAtom.h"
+#include "Ap4SttsAtom.h"
+#include "Ap4CttsAtom.h"
+#include "Ap4StssAtom.h"
+#include "Ap4FtypAtom.h"
+#include "Ap4VmhdAtom.h"
+#include "Ap4SmhdAtom.h"
+#include "Ap4NmhdAtom.h"
+#include "Ap4HmhdAtom.h"
+#include "Ap4SchmAtom.h"
+#include "Ap4FrmaAtom.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4RtpAtom.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4IkmsAtom.h"
+#include "Ap4IsfmAtom.h"
+#include "Ap4TrefTypeAtom.h"
+#include "Ap4AvcCAtom.h"
+#include "Ap4FtabAtom.h"
+#include "Ap4ChplAtom.h"
+#include "Ap4DataAtom.h"
+#include "Ap4DcomAtom.h"
+#include "Ap4CmvdAtom.h"
+
+/*----------------------------------------------------------------------
+| class variables
++---------------------------------------------------------------------*/
+AP4_AtomFactory AP4_AtomFactory::DefaultFactory;
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::AddTypeHandler
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::AddTypeHandler(TypeHandler* handler)
+{
+ return m_TypeHandlers.Add(handler);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::RemoveTypeHandler
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::RemoveTypeHandler(TypeHandler* handler)
+{
+ return m_TypeHandlers.Remove(handler);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::CreateAtomFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Atom*& atom)
+{
+ AP4_Size bytes_available = 0;
+ if (AP4_FAILED(stream.GetSize(bytes_available)) ||
+ bytes_available == 0) {
+ bytes_available = (AP4_Size)((unsigned long)(-1));
+ }
+ return CreateAtomFromStream(stream, bytes_available, atom, NULL);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::CreateAtomFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Size& bytes_available,
+ AP4_Atom*& atom,
+ AP4_Atom* parent)
+{
+ AP4_Result result;
+
+ // NULL by default
+ atom = NULL;
+
+ // check that there are enough bytes for at least a header
+ if (bytes_available < 8) return AP4_ERROR_EOS;
+
+ // remember current stream offset
+ AP4_Offset start;
+ stream.Tell(start);
+
+ // read atom size
+ AP4_UI32 size;
+ result = stream.ReadUI32(size);
+ if (AP4_FAILED(result)) {
+ stream.Seek(start);
+ return result;
+ }
+
+ if (size == 0) {
+ // atom extends to end of file
+ AP4_Size streamSize = 0;
+ stream.GetSize(streamSize);
+ if (streamSize >= start) {
+ size = streamSize - start;
+ }
+ }
+
+ // check the size (we don't handle extended size yet)
+ if (size != 1 && size < 8 || size > bytes_available) {
+ stream.Seek(start);
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+
+ // read atom type
+ AP4_Atom::Type type;
+ result = stream.ReadUI32(type);
+ if (AP4_FAILED(result)) {
+ stream.Seek(start);
+ return result;
+ }
+
+ if (size == 1)
+ {
+ AP4_UI32 size_high;
+
+ result = stream.ReadUI32(size_high);
+ if (AP4_FAILED(result) || size_high) {
+ stream.Seek(start);
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+
+ result = stream.ReadUI32(size);
+ if (AP4_FAILED(result)) {
+ stream.Seek(start);
+ return result;
+ }
+ }
+
+ // create the atom
+ switch (type) {
+ case AP4_ATOM_TYPE_MOOV:
+ atom = new AP4_MoovAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_MVHD:
+ atom = new AP4_MvhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_TRAK:
+ atom = new AP4_TrakAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_HDLR:
+ atom = new AP4_HdlrAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_DREF:
+ atom = new AP4_DrefAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_URL:
+ atom = new AP4_UrlAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_TKHD:
+ atom = new AP4_TkhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_MDHD:
+ atom = new AP4_MdhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STSD:
+ atom = new AP4_StsdAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_STSC:
+ atom = new AP4_StscAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STCO:
+ atom = new AP4_StcoAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CO64:
+ atom = new AP4_Co64Atom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STSZ:
+ atom = new AP4_StszAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STTS:
+ atom = new AP4_SttsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CTTS:
+ atom = new AP4_CttsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STSS:
+ atom = new AP4_StssAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_MP4S:
+ atom = new AP4_Mp4sSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_MP4A:
+ atom = parent && parent->GetType() == AP4_ATOM_TYPE_STSD
+ ? (AP4_Atom*)new AP4_Mp4aSampleEntry(size, stream, *this)
+ : (AP4_Atom*)new AP4_UnknownAtom(type, size, false, stream);
+ break;
+
+ case AP4_ATOM_TYPE_MP4V:
+ atom = new AP4_Mp4vSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_AVC1:
+ atom = new AP4_Avc1SampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_ENCA:
+ atom = new AP4_EncaSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_ENCV:
+ atom = new AP4_EncvSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_ESDS:
+ atom = new AP4_EsdsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_VMHD:
+ atom = new AP4_VmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_SMHD:
+ atom = new AP4_SmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_NMHD:
+ atom = new AP4_NmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_HMHD:
+ atom = new AP4_HmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_FRMA:
+ atom = new AP4_FrmaAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_SCHM:
+ atom = new AP4_SchmAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_FTYP:
+ atom = new AP4_FtypAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_RTP:
+ if (m_Context == AP4_ATOM_TYPE_HNTI) {
+ atom = new AP4_RtpAtom(size, stream);
+ } else {
+ atom = new AP4_RtpHintSampleEntry(size, stream, *this);
+ }
+ break;
+
+ case AP4_ATOM_TYPE_TIMS:
+ atom = new AP4_TimsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_SDP:
+ atom = new AP4_SdpAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_IKMS:
+ atom = new AP4_IkmsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_ISFM:
+ atom = new AP4_IsfmAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_HINT:
+ atom = new AP4_TrefTypeAtom(type, size, stream);
+ break;
+
+ // container atoms
+ case AP4_ATOM_TYPE_TREF:
+ case AP4_ATOM_TYPE_HNTI:
+ case AP4_ATOM_TYPE_STBL:
+ case AP4_ATOM_TYPE_MDIA:
+ case AP4_ATOM_TYPE_DINF:
+ case AP4_ATOM_TYPE_MINF:
+ case AP4_ATOM_TYPE_SCHI:
+ case AP4_ATOM_TYPE_SINF:
+ case AP4_ATOM_TYPE_UDTA:
+ case AP4_ATOM_TYPE_ILST:
+ case AP4_ATOM_TYPE_NAM:
+ case AP4_ATOM_TYPE_ART:
+ case AP4_ATOM_TYPE_WRT:
+ case AP4_ATOM_TYPE_ALB:
+ case AP4_ATOM_TYPE_DAY:
+ case AP4_ATOM_TYPE_TOO:
+ case AP4_ATOM_TYPE_CMT:
+ case AP4_ATOM_TYPE_GEN:
+ case AP4_ATOM_TYPE_TRKN:
+ case AP4_ATOM_TYPE_EDTS:
+ case AP4_ATOM_TYPE_WAVE:
+ case AP4_ATOM_TYPE_CMOV: {
+ AP4_UI32 context = m_Context;
+ m_Context = type; // set the context for the children
+ atom = new AP4_ContainerAtom(type, size, false, stream, *this);
+ m_Context = context; // restore the previous context
+ break;
+ }
+
+ // full container atoms
+ case AP4_ATOM_TYPE_META:
+ atom = new AP4_ContainerAtom(type, size, true, stream, *this);
+ break;
+
+ // other
+
+ case AP4_ATOM_TYPE_AVCC:
+ atom = new AP4_AvcCAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_TEXT:
+ atom = new AP4_TextSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_TX3G:
+ atom = new AP4_Tx3gSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_FTAB:
+ atom = new AP4_FtabAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CVID:
+ case AP4_ATOM_TYPE_SVQ1:
+ case AP4_ATOM_TYPE_SVQ2:
+ case AP4_ATOM_TYPE_SVQ3:
+ case AP4_ATOM_TYPE_H263:
+ case AP4_ATOM_TYPE_S263:
+ atom = new AP4_VisualSampleEntry(type, size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_SAMR:
+ case AP4_ATOM_TYPE__MP3:
+ case AP4_ATOM_TYPE_IMA4:
+ case AP4_ATOM_TYPE_TWOS:
+ case AP4_ATOM_TYPE_SOWT:
+ atom = new AP4_AudioSampleEntry(type, size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_CHPL:
+ atom = new AP4_ChplAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_DATA:
+ atom = new AP4_DataAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_DCOM:
+ atom = new AP4_DcomAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CMVD:
+ atom = new AP4_CmvdAtom(size, stream, *this);
+ break;
+
+ default:
+
+ if(parent && parent->GetType() == AP4_ATOM_TYPE_STSD && (type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0))
+ {
+ atom = new AP4_AudioSampleEntry(type, size, stream, *this);
+ }
+ else // try all the external type handlers
+ {
+ atom = NULL;
+ AP4_List<TypeHandler>::Item* handler_item = m_TypeHandlers.FirstItem();
+ while (handler_item) {
+ TypeHandler* handler = handler_item->GetData();
+ if (AP4_SUCCEEDED(handler->CreateAtom(type, size, stream, atom))) {
+ break;
+ }
+ handler_item = handler_item->GetNext();
+ }
+ if (atom == NULL) {
+ // no custom handlers, create a generic atom
+ atom = new AP4_UnknownAtom(type, size, false, stream);
+ }
+ }
+
+ break;
+ }
+
+ // skip to the end of the atom
+ bytes_available -= size;
+ result = stream.Seek(start+size);
+ if (AP4_FAILED(result)) {
+ delete atom;
+ atom = NULL;
+ }
+
+ return result;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.h
new file mode 100644
index 000000000..f8faf5813
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomFactory.h
@@ -0,0 +1,84 @@
+/*****************************************************************
+|
+| AP4 - Atom Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ATOM_FACTORY_H_
+#define _AP4_ATOM_FACTORY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_ByteStream;
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory
++---------------------------------------------------------------------*/
+class AP4_AtomFactory {
+ public:
+ // types
+ class TypeHandler {
+ public:
+ virtual ~TypeHandler() {};
+ virtual AP4_Result CreateAtom(AP4_Atom::Type type,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_Atom*& atom) = 0;
+ };
+
+ // class members
+ static AP4_AtomFactory DefaultFactory;
+
+ // constructor
+ AP4_AtomFactory() : m_Context(0) {}
+
+ // methods
+ AP4_Result AddTypeHandler(TypeHandler* handler);
+ AP4_Result RemoveTypeHandler(TypeHandler* handler);
+ AP4_Result CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Size& bytes_available,
+ AP4_Atom*& atom,
+ AP4_Atom* parent);
+ AP4_Result CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Atom*& atom);
+
+ // context
+ void SetContext(AP4_Atom::Type context) { m_Context = context; }
+ AP4_Atom::Type GetContext() const { return m_Context; }
+
+private:
+ // members
+ AP4_Atom::Type m_Context;
+ AP4_List<TypeHandler> m_TypeHandlers;
+};
+
+#endif // _AP4_ATOM_FACTORY_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomSampleTable.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomSampleTable.cpp
new file mode 100644
index 000000000..b4a417a3d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomSampleTable.cpp
@@ -0,0 +1,228 @@
+/*****************************************************************
+|
+| AP4 - Atom Based Sample Tables
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This atom is part of AP4 (MP4 Audio Proatom Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the atom COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4AtomSampleTable.h"
+#include "Ap4ByteStream.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4StscAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4Co64Atom.h"
+#include "Ap4StszAtom.h"
+#include "Ap4SttsAtom.h"
+#include "Ap4CttsAtom.h"
+#include "Ap4StssAtom.h"
+#include "Ap4Sample.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::AP4_AtomSampleTable
++---------------------------------------------------------------------*/
+AP4_AtomSampleTable::AP4_AtomSampleTable(AP4_ContainerAtom* stbl,
+ AP4_ByteStream& sample_stream) :
+ m_SampleStream(sample_stream)
+{
+ m_StscAtom = dynamic_cast<AP4_StscAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSC));
+ m_StcoAtom = dynamic_cast<AP4_StcoAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STCO));
+ m_Co64Atom = dynamic_cast<AP4_Co64Atom*>(stbl->GetChild(AP4_ATOM_TYPE_CO64));
+ m_StszAtom = dynamic_cast<AP4_StszAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSZ));
+ m_CttsAtom = dynamic_cast<AP4_CttsAtom*>(stbl->GetChild(AP4_ATOM_TYPE_CTTS));
+ m_SttsAtom = dynamic_cast<AP4_SttsAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STTS));
+ m_StssAtom = dynamic_cast<AP4_StssAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSS));
+ m_StsdAtom = dynamic_cast<AP4_StsdAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSD));
+
+ // keep a reference to the sample stream
+ m_SampleStream.AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::~AP4_AtomSampleTable
++---------------------------------------------------------------------*/
+AP4_AtomSampleTable::~AP4_AtomSampleTable()
+{
+ m_SampleStream.Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetSample(AP4_Ordinal index,
+ AP4_Sample& sample)
+{
+ AP4_Result result;
+
+ // MP4 uses 1-based indexes internally, so adjust by one
+ index++;
+
+ // find out in which chunk this sample is located
+ AP4_Ordinal chunk, skip, desc;
+ result = m_StscAtom->GetChunkForSample(index, chunk, skip, desc);
+ if (AP4_FAILED(result)) return result;
+
+ // check that the result is within bounds
+ if (skip > index) return AP4_ERROR_INTERNAL;
+
+ // get the atom offset for this chunk
+ AP4_Offset offset;
+ if (m_StcoAtom) result = m_StcoAtom->GetChunkOffset(chunk, offset);
+ else if (m_Co64Atom) result = m_Co64Atom->GetChunkOffset(chunk, offset);
+ else result = AP4_ERROR_INTERNAL;
+ if (AP4_FAILED(result)) return result;
+/*
+ // compute the additional offset inside the chunk
+ for (unsigned int i = index-skip; i < index; i++) {
+ AP4_Size size;
+ result = m_StszAtom->GetSampleSize(i, size);
+ if (AP4_FAILED(result)) return result;
+ offset += size;
+ }
+*/
+ AP4_Size size;
+ result = m_StszAtom->GetSampleSize(index - skip, index, size);
+ if (AP4_FAILED(result)) return result;
+ offset += size;
+
+ // set the description index
+ sample.SetDescriptionIndex(desc-1); // adjust for 0-based indexes
+
+ // set the dts and cts
+ AP4_TimeStamp dts;
+ AP4_Duration duration;
+ result = m_SttsAtom->GetDts(index, dts, duration);
+ if (AP4_FAILED(result)) return result;
+ sample.SetDts(dts);
+ sample.SetDuration(duration);
+ if (m_CttsAtom == NULL) {
+ sample.SetCts(dts);
+ } else {
+ AP4_UI32 cts_offset;
+ result = m_CttsAtom->GetCtsOffset(index, cts_offset);
+ if (AP4_FAILED(result)) return result;
+ sample.SetCts(dts + *((signed long*)&cts_offset)); // HACK: it shouldn't be signed, but such files exist unfortunatelly
+ }
+
+ // set the size
+ AP4_Size sample_size;
+ result = m_StszAtom->GetSampleSize(index, sample_size);
+ if (AP4_FAILED(result)) return result;
+ sample.SetSize(sample_size);
+
+ // set the offset
+ sample.SetOffset(offset);
+
+ // set the data stream
+ sample.SetDataStream(m_SampleStream);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_AtomSampleTable::GetSampleCount()
+{
+ return m_StszAtom ? m_StszAtom->GetSampleCount() : 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_AtomSampleTable::GetSampleDescription(AP4_Ordinal index)
+{
+ return m_StsdAtom ? m_StsdAtom->GetSampleDescription(index) : NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSampleDescriptionCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_AtomSampleTable::GetSampleDescriptionCount()
+{
+ return m_StsdAtom ? m_StsdAtom->GetSampleDescriptionCount() : 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetChunkForSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description)
+{
+ return m_StscAtom ? m_StscAtom->GetChunkForSample(sample, chunk, skip, sample_description) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& offset)
+{
+ return
+ m_StcoAtom ? m_StcoAtom->GetChunkOffset(chunk, offset) :
+ m_Co64Atom ? m_Co64Atom->GetChunkOffset(chunk, offset) :
+ AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::SetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::SetChunkOffset(AP4_Ordinal chunk, AP4_Offset offset)
+{
+ return
+ m_StcoAtom ? m_StcoAtom->SetChunkOffset(chunk, offset) :
+ m_Co64Atom ? m_Co64Atom->SetChunkOffset(chunk, offset) :
+ AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::SetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::SetSampleSize(AP4_Ordinal sample, AP4_Size size)
+{
+ return m_StszAtom ? m_StszAtom->SetSampleSize(sample, size) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index)
+{
+ return m_SttsAtom ? m_SttsAtom->GetSampleIndexForTimeStamp(ts, index)
+ : AP4_FAILURE;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomSampleTable.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomSampleTable.h
new file mode 100644
index 000000000..68a71d13b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AtomSampleTable.h
@@ -0,0 +1,91 @@
+/*****************************************************************
+|
+| AP4 - Atom Based Sample Table
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This atom is part of AP4 (MP4 Audio Proatom Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the atom COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ATOM_SAMPLE_TABLE_H_
+#define _AP4_ATOM_SAMPLE_TABLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_Atom;
+class AP4_ByteStream;
+class AP4_StscAtom;
+class AP4_StcoAtom;
+class AP4_Co64Atom;
+class AP4_StszAtom;
+class AP4_SttsAtom;
+class AP4_CttsAtom;
+class AP4_StssAtom;
+class AP4_StsdAtom;
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable
++---------------------------------------------------------------------*/
+class AP4_AtomSampleTable : public AP4_SampleTable
+{
+ public:
+ // methods
+ AP4_AtomSampleTable(AP4_ContainerAtom* stbl_atom,
+ AP4_ByteStream& sample_stream);
+ virtual ~AP4_AtomSampleTable();
+
+ // AP4_SampleTable methods
+ virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
+ virtual AP4_Cardinal GetSampleCount();
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ virtual AP4_Cardinal GetSampleDescriptionCount();
+ virtual AP4_Result GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description);
+ virtual AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& offset);
+ virtual AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_Offset offset);
+ virtual AP4_Result SetSampleSize(AP4_Ordinal sample, AP4_Size size);
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index);
+
+private:
+ // members
+ AP4_ByteStream& m_SampleStream;
+ AP4_StscAtom* m_StscAtom;
+ AP4_StcoAtom* m_StcoAtom;
+ AP4_Co64Atom* m_Co64Atom;
+ AP4_StszAtom* m_StszAtom;
+ AP4_SttsAtom* m_SttsAtom;
+ AP4_CttsAtom* m_CttsAtom;
+ AP4_StsdAtom* m_StsdAtom;
+ AP4_StssAtom* m_StssAtom;
+};
+
+#endif // _AP4_ATOM_SAMPLE_TABLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AvcCAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AvcCAtom.cpp
new file mode 100644
index 000000000..52738ea75
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AvcCAtom.cpp
@@ -0,0 +1,46 @@
+/*****************************************************************
+|
+| AP4 - avcC Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4AvcCAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_AvcCAtom::AP4_AvcCAtom
++---------------------------------------------------------------------*/
+
+AP4_AvcCAtom::AP4_AvcCAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_AVCC)
+{
+ size -= AP4_ATOM_HEADER_SIZE;
+ m_DecoderInfo.SetDataSize(size);
+ stream.Read(m_DecoderInfo.UseData(), size);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AvcCAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AvcCAtom.h
new file mode 100644
index 000000000..00acf7e9e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4AvcCAtom.h
@@ -0,0 +1,57 @@
+/*****************************************************************
+|
+| AP4 - avcC Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_AVCC_ATOM_H_
+#define _AP4_AVCC_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_AvcCAtom
++---------------------------------------------------------------------*/
+class AP4_AvcCAtom : public AP4_Atom
+{
+public:
+ AP4_AvcCAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ const AP4_DataBuffer* GetDecoderInfo() const { return &m_DecoderInfo; }
+
+private:
+ AP4_DataBuffer m_DecoderInfo;
+};
+
+#endif // _AP4_AVCC_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.cpp
new file mode 100644
index 000000000..2e7052ab4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.cpp
@@ -0,0 +1,573 @@
+/*****************************************************************
+|
+| AP4 - Byte Stream support
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4ByteStream.h"
+#include "Ap4Utils.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_BYTE_STREAM_COPY_BUFFER_SIZE = 4096;
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteString
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteString(const char* buffer)
+{
+ AP4_Size string_length = static_cast<AP4_Size>(strlen(buffer));
+
+ // shortcut
+ if ((buffer == NULL) || (string_length == 0)) return AP4_SUCCESS;
+
+ // write the string
+ return Write((const void*)buffer, string_length);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI64
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI64(AP4_UI64 value)
+{
+ unsigned char buffer[8];
+
+ // convert value to bytes
+ AP4_BytesFromUInt64BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 8);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI32
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI32(AP4_UI32 value)
+{
+ unsigned char buffer[4];
+
+ // convert value to bytes
+ AP4_BytesFromUInt32BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 4);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI24
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI24(AP4_UI32 value)
+{
+ unsigned char buffer[3];
+
+ // convert value to bytes
+ AP4_BytesFromUInt24BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 3);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI16
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI16(AP4_UI16 value)
+{
+ unsigned char buffer[2];
+
+ // convert value to bytes
+ AP4_BytesFromUInt16BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 2);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI08
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI08(AP4_UI08 value)
+{
+ return Write((void*)&value, 1);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI64
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI64(AP4_UI64& value)
+{
+ unsigned char buffer[8];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 8);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt64BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI32
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI32(AP4_UI32& value)
+{
+ unsigned char buffer[4];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 4);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt32BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI24
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI24(AP4_UI32& value)
+{
+ unsigned char buffer[3];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 3);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt24BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI16
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI16(AP4_UI16& value)
+{
+ unsigned char buffer[2];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 2);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt16BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI08
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI08(AP4_UI08& value)
+{
+ unsigned char buffer[1];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 1);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = buffer[0];
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadString
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadString(char* buffer, AP4_Size size)
+{
+ if (buffer == NULL || size == 0) {
+ return AP4_ERROR_INVALID_PARAMETERS;
+ }
+
+ AP4_Size bytes_read = 0;
+ while (bytes_read < size-1) {
+ AP4_Result result;
+ result = Read(&buffer[bytes_read], 1, NULL);
+ if (AP4_FAILED(result)) {
+ buffer[bytes_read] = '\0';
+ return result;
+ }
+ if (buffer[bytes_read] == '\0') {
+ // end of string
+ return AP4_SUCCESS;
+ }
+ bytes_read++;
+ }
+
+ // the string was not null terminated, terminate it
+ buffer[size-1] = '\0';
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::CopyTo
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::CopyTo(AP4_ByteStream& stream, AP4_Size size)
+{
+ unsigned char buffer[AP4_BYTE_STREAM_COPY_BUFFER_SIZE];
+ while (size) {
+ AP4_Size bytes_read;
+ AP4_Size bytes_to_read;
+ AP4_Result result;
+
+ // decide how much to read
+ if (size >= sizeof(buffer)) {
+ bytes_to_read = sizeof(buffer);
+ } else {
+ bytes_to_read = size;
+ }
+
+ // read up to one buffer full
+ result = Read(buffer, bytes_to_read, &bytes_read);
+ if (AP4_FAILED(result)) return result;
+
+ // copy to destination
+ if (bytes_read != 0) {
+ result = stream.Write(buffer, bytes_read);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // update the size
+ size -= bytes_read;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::AP4_SubStream
++---------------------------------------------------------------------*/
+AP4_SubStream::AP4_SubStream(AP4_ByteStream& container,
+ AP4_Offset offset,
+ AP4_Size size) :
+ m_Container(container),
+ m_Offset(offset),
+ m_Size(size),
+ m_Position(0),
+ m_ReferenceCount(1)
+{
+ m_Container.AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::~AP4_SubStream
++---------------------------------------------------------------------*/
+AP4_SubStream::~AP4_SubStream()
+{
+ m_Container.Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Read
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SubStream::Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read)
+{
+ // default values
+ if (bytes_read) *bytes_read = 0;
+
+ // shortcut
+ if (bytes_to_read == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_read > m_Size) {
+ bytes_to_read = m_Size - m_Position;
+ }
+
+ // check for end of substream
+ if (bytes_to_read == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // seek inside container
+ //AP4_Result result;
+ //result = m_Container.Seek(m_Offset+m_Position);
+ //if (AP4_FAILED(result)) {
+ // return result;
+ //}
+
+ // read from the container
+ AP4_Size local_bytes_read;
+ AP4_Result result = m_Container.Read(buffer, bytes_to_read, &local_bytes_read);
+ if (bytes_read) *bytes_read = local_bytes_read;
+ if (AP4_SUCCEEDED(result)) {
+ m_Position += local_bytes_read;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SubStream::Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written)
+{
+ // default values
+ if (bytes_written) *bytes_written = 0;
+
+ // shortcut
+ if (bytes_to_write == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_write > m_Size) {
+ bytes_to_write = m_Size - m_Position;
+ }
+
+ // check for en of substream
+ if (bytes_to_write == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // seek inside container
+ //AP4_Result result;
+ //result = m_Container.Seek(m_Offset+m_Position);
+ //if (AP4_FAILED(result)) return result;
+
+ // write to container
+ AP4_Size local_bytes_written;
+ AP4_Result result = m_Container.Write(buffer, bytes_to_write, &local_bytes_written);
+ if (bytes_written) *bytes_written = local_bytes_written;
+ if (AP4_SUCCEEDED(result)) {
+ m_Position += local_bytes_written;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Seek
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SubStream::Seek(AP4_Offset offset)
+{
+ if (offset > m_Size) return AP4_FAILURE;
+ AP4_Result result;
+ result = m_Container.Seek(m_Offset+offset);
+ if (AP4_SUCCEEDED(result)) {
+ m_Position = offset;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_SubStream::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Release
++---------------------------------------------------------------------*/
+void
+AP4_SubStream::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_Size size) :
+ m_BufferIsLocal(true),
+ m_Size(size),
+ m_Position(0),
+ m_ReferenceCount(1)
+{
+ m_Buffer = new AP4_UI08[size];
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_UI08* buffer, AP4_Size size) :
+ m_BufferIsLocal(false),
+ m_Buffer(buffer),
+ m_Size(size),
+ m_Position(0),
+ m_ReferenceCount(1)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::~AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+AP4_MemoryByteStream::~AP4_MemoryByteStream()
+{
+ if (m_BufferIsLocal) delete[] m_Buffer;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Read
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MemoryByteStream::Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read)
+{
+ // default values
+ if (bytes_read) *bytes_read = 0;
+
+ // shortcut
+ if (bytes_to_read == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_read > m_Size) {
+ bytes_to_read = m_Size - m_Position;
+ }
+
+ // check for end of stream
+ if (bytes_to_read == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // read from the memory
+ memcpy(buffer, &m_Buffer[m_Position], bytes_to_read);
+ m_Position += bytes_to_read;
+
+ if (bytes_read) *bytes_read = bytes_to_read;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MemoryByteStream::Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written)
+{
+ // default values
+ if (bytes_written) *bytes_written = 0;
+
+ // shortcut
+ if (bytes_to_write == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_write > m_Size) {
+ bytes_to_write = m_Size - m_Position;
+ }
+
+ // check for en of stream
+ if (bytes_to_write == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // write to memory
+ memcpy(&m_Buffer[m_Position], buffer, bytes_to_write);
+ m_Position += bytes_to_write;
+
+ if (bytes_written) *bytes_written = bytes_to_write;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Seek
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MemoryByteStream::Seek(AP4_Offset offset)
+{
+ if (offset > m_Size) return AP4_FAILURE;
+ m_Position = offset;
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_MemoryByteStream::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Release
++---------------------------------------------------------------------*/
+void
+AP4_MemoryByteStream::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.h
new file mode 100644
index 000000000..2e0e99deb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ByteStream.h
@@ -0,0 +1,154 @@
+/*****************************************************************
+|
+| AP4 - ByteStream Interface
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_BYTE_STREAM_H_
+#define _AP4_BYTE_STREAM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Interfaces.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream
++---------------------------------------------------------------------*/
+class AP4_ByteStream : public AP4_Referenceable
+{
+ public:
+ // methods
+ virtual AP4_Result Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read = 0) = 0;
+ virtual AP4_Result ReadUI64(AP4_UI64& value);
+ virtual AP4_Result ReadUI32(AP4_UI32& value);
+ virtual AP4_Result ReadUI24(AP4_UI32& value);
+ virtual AP4_Result ReadUI16(AP4_UI16& value);
+ virtual AP4_Result ReadUI08(AP4_UI08& value);
+ virtual AP4_Result ReadString(char* buffer, AP4_Size size);
+ virtual AP4_Result Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written = 0) = 0;
+ virtual AP4_Result WriteString(const char* stringBuffer);
+ virtual AP4_Result WriteUI64(AP4_UI64 value);
+ virtual AP4_Result WriteUI32(AP4_UI32 value);
+ virtual AP4_Result WriteUI24(AP4_UI32 value);
+ virtual AP4_Result WriteUI16(AP4_UI16 value);
+ virtual AP4_Result WriteUI08(AP4_UI08 value);
+ virtual AP4_Result Seek(AP4_Offset offset) = 0;
+ virtual AP4_Result Tell(AP4_Offset& offset) = 0;
+ virtual AP4_Result GetSize(AP4_Size& size) = 0;
+ virtual AP4_Result CopyTo(AP4_ByteStream& stream, AP4_Size size);
+};
+
+/*----------------------------------------------------------------------
+| AP4_SubStream
++---------------------------------------------------------------------*/
+class AP4_SubStream : public AP4_ByteStream
+{
+ public:
+ AP4_SubStream(AP4_ByteStream& container, AP4_Offset offset, AP4_Size size);
+
+ // AP4_ByteStream methods
+ AP4_Result Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read = 0);
+ AP4_Result Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written = 0);
+ AP4_Result Seek(AP4_Offset offset);
+ AP4_Result Tell(AP4_Offset& offset) {
+ offset = m_Position;
+ return AP4_SUCCESS;
+ }
+ AP4_Result GetSize(AP4_Size& size) {
+ size = m_Size;
+ return AP4_SUCCESS;
+ }
+
+ // AP4_Referenceable methods
+ void AddReference();
+ void Release();
+
+ protected:
+ virtual ~AP4_SubStream();
+
+ private:
+ AP4_ByteStream& m_Container;
+ AP4_Offset m_Offset;
+ AP4_Size m_Size;
+ AP4_Offset m_Position;
+ AP4_Cardinal m_ReferenceCount;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+class AP4_MemoryByteStream : public AP4_ByteStream
+{
+public:
+ AP4_MemoryByteStream(AP4_Size size);
+ AP4_MemoryByteStream(AP4_UI08* buffer, AP4_Size size);
+
+ // AP4_ByteStream methods
+ AP4_Result Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read = 0);
+ AP4_Result Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written = 0);
+ AP4_Result Seek(AP4_Offset offset);
+ AP4_Result Tell(AP4_Offset& offset) {
+ offset = m_Position;
+ return AP4_SUCCESS;
+ }
+ AP4_Result GetSize(AP4_Size& size) {
+ size = m_Size;
+ return AP4_SUCCESS;
+ }
+
+ // AP4_Referenceable methods
+ void AddReference();
+ void Release();
+
+ // methods
+ AP4_UI08* GetBuffer() { return m_Buffer; }
+
+protected:
+ virtual ~AP4_MemoryByteStream();
+
+private:
+ bool m_BufferIsLocal;
+ AP4_UI08* m_Buffer;
+ AP4_Size m_Size;
+ AP4_Offset m_Position;
+ AP4_Cardinal m_ReferenceCount;
+};
+
+#endif // _AP4_BYTE_STREAM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ChplAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ChplAtom.cpp
new file mode 100644
index 000000000..fca8b5795
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ChplAtom.cpp
@@ -0,0 +1,71 @@
+/*****************************************************************
+|
+| AP4 - chpl Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4ChplAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_ChplAtom::AP4_ChplAtom
++---------------------------------------------------------------------*/
+
+AP4_ChplAtom::AP4_ChplAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_CHPL, size, true, stream)
+{
+ size -= AP4_FULL_ATOM_HEADER_SIZE;
+
+ stream.ReadUI32(m_Reserved);
+
+ AP4_UI08 cnt = 0;
+ stream.ReadUI08(cnt);
+
+ size -= 5;
+
+ while(size > 0 && cnt-- > 0)
+ {
+ AP4_Chapter chapter;
+
+ // time
+ stream.ReadUI64(chapter.Time);
+
+ // name
+ AP4_UI08 len = 0;
+ char buff[256];
+ stream.ReadUI08(len);
+ stream.Read(buff, len);
+ buff[len] = 0;
+ chapter.Name = buff;
+
+ m_Chapters.Append(chapter);
+
+ size -= 8+1+len;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ChplAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ChplAtom.h
new file mode 100644
index 000000000..7e6ba9b82
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ChplAtom.h
@@ -0,0 +1,62 @@
+/*****************************************************************
+|
+| AP4 - chpl Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CHPL_ATOM_H_
+#define _AP4_CHPL_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_ChplAtom
++---------------------------------------------------------------------*/
+class AP4_ChplAtom : public AP4_Atom
+{
+public:
+ AP4_ChplAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ struct AP4_Chapter {AP4_UI64 Time; AP4_String Name;};
+
+ AP4_Array<AP4_Chapter>& GetChapters() { return m_Chapters; }
+
+private:
+
+ // members
+ AP4_UI32 m_Reserved;
+ AP4_Array<AP4_Chapter> m_Chapters;
+};
+
+#endif // _AP4_CHPL_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CmvdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CmvdAtom.cpp
new file mode 100644
index 000000000..83e683617
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CmvdAtom.cpp
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - cmvd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4CmvdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_CmvdAtom::AP4_CmvdAtom
++---------------------------------------------------------------------*/
+AP4_CmvdAtom::AP4_CmvdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_CMVD, size, false, stream)
+{
+ size -= AP4_ATOM_HEADER_SIZE;
+
+ stream.ReadUI32(m_MovieResourceSize);
+
+ size -= 4;
+
+ m_Data.SetDataSize(size);
+ stream.Read(m_Data.UseData(), size);
+
+/*
+ // read children
+ AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ while (entry_count--) {
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom,
+ this))) {
+ m_Children.Add(atom);
+ }
+ }
+*/
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CmvdAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CmvdAtom.h
new file mode 100644
index 000000000..eea0628b9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CmvdAtom.h
@@ -0,0 +1,64 @@
+/*****************************************************************
+|
+| AP4 - cmvd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CMVD_ATOM_H_
+#define _AP4_CMVD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_CmvdAtom
++---------------------------------------------------------------------*/
+class AP4_CmvdAtom : public AP4_ContainerAtom
+{
+public:
+ // methods
+ AP4_CmvdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ AP4_UI32 GetMovieResourceSize() const { return m_MovieResourceSize; }
+ AP4_DataBuffer* GetData() { return &m_Data; }
+
+private:
+ AP4_UI32 m_MovieResourceSize;
+ AP4_DataBuffer m_Data;
+};
+
+#endif // _AP4_CMVD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.cpp
new file mode 100644
index 000000000..053b70fa2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.cpp
@@ -0,0 +1,153 @@
+/*****************************************************************
+|
+| AP4 - co64 Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Co64Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::AP4_Co64Atom
++---------------------------------------------------------------------*/
+AP4_Co64Atom::AP4_Co64Atom(AP4_UI64* entries, AP4_UI32 entry_count) :
+AP4_Atom(AP4_ATOM_TYPE_CO64,
+ AP4_FULL_ATOM_HEADER_SIZE+4+entry_count*8,
+ true),
+ m_Entries(new AP4_UI64[entry_count]),
+ m_EntryCount(entry_count)
+{
+ memcpy(m_Entries, entries, m_EntryCount*8);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::AP4_Co64Atom
++---------------------------------------------------------------------*/
+AP4_Co64Atom::AP4_Co64Atom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_CO64, size, true, stream)
+{
+ stream.ReadUI32(m_EntryCount);
+ if (m_EntryCount > (size-AP4_FULL_ATOM_HEADER_SIZE-4)/8) {
+ m_EntryCount = (size-AP4_FULL_ATOM_HEADER_SIZE-4)/8;
+ }
+ m_Entries = new AP4_UI64[m_EntryCount];
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ stream.ReadUI64(m_Entries[i]);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::~AP4_Co64Atom
++---------------------------------------------------------------------*/
+AP4_Co64Atom::~AP4_Co64Atom()
+{
+ delete[] m_Entries;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::GetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // FIXME!!!
+
+ // get the chunk offset
+ chunk_offset = m_Entries[chunk - 1]; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::SetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::SetChunkOffset(AP4_Ordinal chunk, AP4_Offset chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // get the chunk offset
+ m_Entries[chunk - 1] = chunk_offset; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::AdjustChunkOffsets
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::AdjustChunkOffsets(AP4_Offset offset)
+{
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ m_Entries[i] += offset;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ result = stream.WriteUI32(m_EntryCount);
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ result = stream.WriteUI64(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_EntryCount);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.h
new file mode 100644
index 000000000..aa0c6df06
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Co64Atom.h
@@ -0,0 +1,62 @@
+/*****************************************************************
+|
+| AP4 - co64 Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CO64_ATOM_H_
+#define _AP4_CO64_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom
++---------------------------------------------------------------------*/
+class AP4_Co64Atom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_Co64Atom(AP4_UI64* offsets, AP4_UI32 offset_count);
+ AP4_Co64Atom(AP4_Size size, AP4_ByteStream& stream);
+ ~AP4_Co64Atom();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ AP4_Cardinal GetChunkCount() { return m_EntryCount; }
+ AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& chunk_offset);
+ AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_Offset chunk_offset);
+ AP4_Result AdjustChunkOffsets(AP4_Offset offset);
+
+ private:
+ AP4_UI64* m_Entries;
+ AP4_UI32 m_EntryCount;
+};
+
+#endif // _AP4_CO64_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Constants.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Constants.h
new file mode 100644
index 000000000..5e693f3a7
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Constants.h
@@ -0,0 +1,39 @@
+/*****************************************************************
+|
+| AP4 - Shared Constants
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CONSTANTS_H_
+#define _AP4_CONSTANTS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#ifndef NULL
+#define NULL 0
+#endif
+
+#endif // _AP4_CONSTANTS_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ContainerAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ContainerAtom.cpp
new file mode 100644
index 000000000..f8774ffc1
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ContainerAtom.cpp
@@ -0,0 +1,164 @@
+/*****************************************************************
+|
+| AP4 - Container Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Utils.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type, bool is_full) :
+ AP4_Atom(type, is_full)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type, AP4_Size size, bool is_full) :
+ AP4_Atom(type, size, is_full)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_Atom(type, size, is_full, stream)
+{
+ ReadChildren(atom_factory, stream, size-GetHeaderSize());
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream) :
+ AP4_Atom(type, size, is_full, stream)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::ReadChildren
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::ReadChildren(AP4_AtomFactory& atom_factory,
+ AP4_ByteStream& stream,
+ AP4_Size size)
+{
+ AP4_Atom* atom;
+ AP4_Size bytes_available = size;
+ while (AP4_SUCCEEDED(
+ atom_factory.CreateAtomFromStream(stream, bytes_available, atom, this))) {
+ atom->SetParent(this);
+ m_Children.Add(atom);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ContainerAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ return InspectChildren(inspector);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::InspectChildren
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ContainerAtom::InspectChildren(AP4_AtomInspector& inspector)
+{
+ // inspect children
+ m_Children.Apply(AP4_AtomListInspector(inspector));
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ContainerAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // write all children
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::OnChildChanged
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::OnChildChanged(AP4_Atom*)
+{
+ // remcompute our size
+ m_Size = GetHeaderSize();
+ m_Children.Apply(AP4_AtomSizeAdder(m_Size));
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::OnChildAdded
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::OnChildAdded(AP4_Atom* child)
+{
+ // update our size
+ m_Size += child->GetSize();
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::OnChildRemoved
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::OnChildRemoved(AP4_Atom* child)
+{
+ // update our size
+ m_Size -= child->GetSize();
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ContainerAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ContainerAtom.h
new file mode 100644
index 000000000..ed68726b8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4ContainerAtom.h
@@ -0,0 +1,81 @@
+/*****************************************************************
+|
+| AP4 - Container Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CONTAINER_ATOM_H_
+#define _AP4_CONTAINER_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_ByteStream;
+class AP4_AtomFactory;
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom
++---------------------------------------------------------------------*/
+class AP4_ContainerAtom : public AP4_Atom, public AP4_AtomParent {
+public:
+ // methods
+ AP4_ContainerAtom(Type type, bool is_full = false);
+ AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream);
+ AP4_List<AP4_Atom>& GetChildren() { return m_Children; }
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result InspectChildren(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // AP4_AtomParent methods
+ void OnChildChanged(AP4_Atom* child);
+ void OnChildAdded(AP4_Atom* child);
+ void OnChildRemoved(AP4_Atom* child);
+
+protected:
+ // constructor
+ AP4_ContainerAtom(Type type, AP4_Size size, bool is_full = false);
+
+ // methods
+ void ReadChildren(AP4_AtomFactory& atom_factory,
+ AP4_ByteStream& stream,
+ AP4_Size size);
+};
+
+#endif // _AP4_CONTAINER_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CttsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CttsAtom.cpp
new file mode 100644
index 000000000..5cbdf17a0
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CttsAtom.cpp
@@ -0,0 +1,115 @@
+/*****************************************************************
+|
+| AP4 - ctts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4CttsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::AP4_CttsAtom
++---------------------------------------------------------------------*/
+AP4_CttsAtom::AP4_CttsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_CTTS, size, true, stream)
+{
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 sample_count;
+ AP4_UI32 sample_offset;
+ if (stream.ReadUI32(sample_count) == AP4_SUCCESS &&
+ stream.ReadUI32(sample_offset) == AP4_SUCCESS) {
+ m_Entries.Append(AP4_CttsTableEntry(sample_count,
+ sample_offset));
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::GetCtsOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_CttsAtom::GetCtsOffset(AP4_Ordinal sample, AP4_UI32& cts_offset)
+{
+ AP4_Ordinal current_sample = 0;
+
+ for (unsigned int i = 0; i < m_Entries.ItemCount(); i++) {
+ AP4_CttsTableEntry& entry = m_Entries[i];
+
+ current_sample += entry.m_SampleCount;
+ // check if we have the right entry
+ if (current_sample >= sample) {
+ cts_offset = entry.m_SampleOffset;
+ return AP4_SUCCESS;
+ }
+ }
+
+ // sample is greater than the number of samples
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_CttsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+ if (AP4_FAILED(result)) return result;
+
+ // write the entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ // sample count
+ result = stream.WriteUI32(m_Entries[i].m_SampleCount);
+ if (AP4_FAILED(result)) return result;
+
+ // time offset
+ result = stream.WriteUI32(m_Entries[i].m_SampleOffset);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_CttsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CttsAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CttsAtom.h
new file mode 100644
index 000000000..9f5dab8ff
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4CttsAtom.h
@@ -0,0 +1,73 @@
+/*****************************************************************
+|
+| AP4 - ctts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CTTS_ATOM_H_
+#define _AP4_CTTS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+
+/*----------------------------------------------------------------------
+| AP4_CttsTableEntry
++---------------------------------------------------------------------*/
+class AP4_CttsTableEntry {
+ public:
+ AP4_CttsTableEntry() :
+ m_SampleCount(0),
+ m_SampleOffset(0) {}
+ AP4_CttsTableEntry(AP4_Cardinal sample_count,
+ AP4_Offset sample_offset) :
+ m_SampleCount(sample_count),
+ m_SampleOffset(sample_offset) {}
+
+ AP4_Cardinal m_SampleCount;
+ AP4_Offset m_SampleOffset;
+};
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom
++---------------------------------------------------------------------*/
+class AP4_CttsAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_CttsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result GetCtsOffset(AP4_Ordinal sample,
+ AP4_UI32& cts_offset);
+
+ private:
+ AP4_Array<AP4_CttsTableEntry> m_Entries;
+};
+
+#endif // _AP4_CTTS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataAtom.cpp
new file mode 100644
index 000000000..97c72d283
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataAtom.cpp
@@ -0,0 +1,52 @@
+/*****************************************************************
+|
+| AP4 - data Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4DataAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_DataAtom::AP4_DataAtom
++---------------------------------------------------------------------*/
+
+AP4_DataAtom::AP4_DataAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_DATA)
+{
+ size -= AP4_ATOM_HEADER_SIZE;
+
+ stream.ReadUI32(m_Reserved1);
+ stream.ReadUI32(m_Reserved2);
+
+ size -= 8;
+
+ m_Data.SetDataSize(size);
+ stream.Read(m_Data.UseData(), size);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataAtom.h
new file mode 100644
index 000000000..2c339c1d2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataAtom.h
@@ -0,0 +1,59 @@
+/*****************************************************************
+|
+| AP4 - data Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DATA_ATOM_H_
+#define _AP4_DATA_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_DataAtom
++---------------------------------------------------------------------*/
+class AP4_DataAtom : public AP4_Atom
+{
+public:
+ AP4_DataAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ const AP4_DataBuffer* GetData() const { return &m_Data; }
+
+private:
+ AP4_UI32 m_Reserved1;
+ AP4_UI32 m_Reserved2;
+ AP4_DataBuffer m_Data;
+};
+
+#endif // _AP4_DATA_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.cpp
new file mode 100644
index 000000000..f73afbf3f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.cpp
@@ -0,0 +1,177 @@
+/*****************************************************************
+|
+| AP4 - Data Buffer
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::AP4_DataBuffer
++---------------------------------------------------------------------*/
+AP4_DataBuffer::AP4_DataBuffer() :
+ m_BufferIsLocal(true),
+ m_Buffer(NULL),
+ m_BufferSize(0),
+ m_DataSize(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::AP4_DataBuffer
++---------------------------------------------------------------------*/
+AP4_DataBuffer::AP4_DataBuffer(AP4_Size buffer_size) :
+ m_BufferIsLocal(true),
+ m_Buffer(NULL),
+ m_BufferSize(buffer_size),
+ m_DataSize(0)
+{
+ m_Buffer = new AP4_Byte[buffer_size];
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::AP4_DataBuffer
++---------------------------------------------------------------------*/
+AP4_DataBuffer::AP4_DataBuffer(const AP4_DataBuffer& other) :
+ m_BufferIsLocal(true),
+ m_Buffer(NULL),
+ m_BufferSize(other.m_DataSize),
+ m_DataSize(other.m_DataSize)
+{
+ m_Buffer = new AP4_Byte[m_BufferSize];
+ memcpy(m_Buffer, other.m_Buffer, m_BufferSize);
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::~AP4_DataBuffer
++---------------------------------------------------------------------*/
+AP4_DataBuffer::~AP4_DataBuffer()
+{
+ if (m_BufferIsLocal) {
+ delete[] m_Buffer;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::SetBuffer
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::SetBuffer(AP4_Byte* buffer, AP4_Size buffer_size)
+{
+ if (m_BufferIsLocal) {
+ // destroy the local buffer
+ delete[] m_Buffer;
+ }
+
+ // we're now using an external buffer
+ m_BufferIsLocal = false;
+ m_Buffer = buffer;
+ m_BufferSize = buffer_size;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::SetBufferSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::SetBufferSize(AP4_Size buffer_size)
+{
+ if (m_BufferIsLocal) {
+ return ReallocateBuffer(buffer_size);
+ } else {
+ return AP4_FAILURE; // you cannot change the
+ // buffer management mode
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::SetDataSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::SetDataSize(AP4_Size size)
+{
+ if (size > m_BufferSize) {
+ if (m_BufferIsLocal) {
+ AP4_Result result = ReallocateBuffer(size);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+ m_DataSize = size;
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::SetData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::SetData(AP4_Byte* data, AP4_Size size)
+{
+ if (size > m_BufferSize) {
+ if (m_BufferIsLocal) {
+ AP4_Result result = ReallocateBuffer(size);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+ memcpy(m_Buffer, data, size);
+ m_DataSize = size;
+
+ return AP4_SUCCESS;
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::ReallocateBuffer
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::ReallocateBuffer(AP4_Size size)
+{
+ // check that the existing data fits
+ if (m_DataSize > size) return AP4_FAILURE;
+
+ // allocate a new buffer
+ AP4_Byte* new_buffer = new AP4_Byte[size];
+
+ // copy the contents of the previous buffer ,is any
+ if (m_Buffer && m_DataSize) {
+ memcpy(new_buffer, m_Buffer, m_DataSize);
+ }
+
+ // destroy the previous buffer
+ delete[] m_Buffer;
+
+ // use the new buffer
+ m_Buffer = new_buffer;
+ m_BufferSize = size;
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.h
new file mode 100644
index 000000000..529e842d6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DataBuffer.h
@@ -0,0 +1,73 @@
+/*****************************************************************
+|
+| AP4 - Data Buffer Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DATA_BUFFER_H_
+#define _AP4_DATA_BUFFER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer
++---------------------------------------------------------------------*/
+class AP4_DataBuffer
+{
+ public:
+ // constructors & destructor
+ AP4_DataBuffer();
+ AP4_DataBuffer(AP4_Size size);
+ AP4_DataBuffer(const AP4_DataBuffer& other);
+ virtual ~AP4_DataBuffer();
+
+ // data buffer handling methods
+ virtual AP4_Result SetBuffer(AP4_Byte* buffer, AP4_Size buffer_size);
+ virtual AP4_Result SetBufferSize(AP4_Size buffer_size);
+ virtual AP4_Size GetBufferSize() const { return m_BufferSize; }
+
+ // data handling methods
+ virtual const AP4_Byte* GetData() const { return m_Buffer; }
+ virtual AP4_Byte* UseData() { return m_Buffer; };
+ virtual AP4_Size GetDataSize() const { return m_DataSize; }
+ virtual AP4_Result SetDataSize(AP4_Size size);
+ virtual AP4_Result SetData(AP4_Byte* data, AP4_Size data_size);
+
+ protected:
+ // members
+ bool m_BufferIsLocal;
+ AP4_Byte* m_Buffer;
+ AP4_Size m_BufferSize;
+ AP4_Size m_DataSize;
+
+ // methods
+ AP4_Result ReallocateBuffer(AP4_Size size);
+};
+
+#endif // _AP4_DATA_BUFFER_H_
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DcomAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DcomAtom.cpp
new file mode 100644
index 000000000..12878c43c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DcomAtom.cpp
@@ -0,0 +1,46 @@
+/*****************************************************************
+|
+| AP4 - dcom Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4DcomAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_DcomAtom::AP4_DcomAtom
++---------------------------------------------------------------------*/
+
+AP4_DcomAtom::AP4_DcomAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_DCOM)
+{
+ size -= AP4_ATOM_HEADER_SIZE;
+
+ stream.ReadUI32(m_CompressorSubType);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DcomAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DcomAtom.h
new file mode 100644
index 000000000..541bb3bfa
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DcomAtom.h
@@ -0,0 +1,55 @@
+/*****************************************************************
+|
+| AP4 - dcom Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DCOM_ATOM_H_
+#define _AP4_DCOM_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| AP4_DcomAtom
++---------------------------------------------------------------------*/
+class AP4_DcomAtom : public AP4_Atom
+{
+public:
+ AP4_DcomAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ AP4_Atom::Type GetCompressorSubType() const { return m_CompressorSubType; }
+
+private:
+ AP4_Atom::Type m_CompressorSubType;
+};
+
+#endif // _AP4_DCOM_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Debug.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Debug.cpp
new file mode 100644
index 000000000..b9903d5c5
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Debug.cpp
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - Debug Support
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "Ap4.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_DEBUG_MAX_BUFFER = 1024;
+
+/*----------------------------------------------------------------------
+| AP4_Print
++---------------------------------------------------------------------*/
+static void
+AP4_Print(const char* message)
+{
+ printf(message);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Debug
++---------------------------------------------------------------------*/
+void
+AP4_Debug(const char* format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+
+ char buffer[AP4_DEBUG_MAX_BUFFER];
+ vsnprintf(buffer, sizeof(buffer), format, args);
+ AP4_Print(buffer);
+
+ va_end(args);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Debug.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Debug.h
new file mode 100644
index 000000000..f99aaa79e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Debug.h
@@ -0,0 +1,51 @@
+/*****************************************************************
+|
+| AP4 - Debug Support
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DEBUG_H_
+#define _AP4_DEBUG_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Config.h"
+
+/*----------------------------------------------------------------------
+| AP4_Debug
++---------------------------------------------------------------------*/
+extern void AP4_Debug(const char* format, ...);
+
+/*----------------------------------------------------------------------
+| AP4_ASSERT
++---------------------------------------------------------------------*/
+#if defined (AP4_CONFIG_HAVE_ASSERT_H)
+#include <assert.h>
+#define AP4_ASSERT assert
+#endif
+
+
+#endif // _AP4_DEBUG_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp
new file mode 100644
index 000000000..dfaf40872
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp
@@ -0,0 +1,165 @@
+/*****************************************************************
+|
+| AP4 - DecoderConfig Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4DecoderConfigDescriptor.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
+ AP4_UI08 stream_type,
+ AP4_UI08 oti,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate,
+ AP4_DecoderSpecificInfoDescriptor* dsi) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_CONFIG, 2, 13),
+ m_StreamType(stream_type),
+ m_ObjectTypeIndication(oti),
+ m_BufferSize(buffer_size),
+ m_MaxBitrate(max_bitrate),
+ m_AverageBitrate(avg_bitrate)
+{
+ if (dsi) {
+ m_SubDescriptors.Add(dsi);
+ m_PayloadSize += dsi->GetSize();
+ m_HeaderSize = MinHeaderSize(m_PayloadSize);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
+ AP4_ByteStream& stream, AP4_Size header_size, AP4_Size payload_size) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_CONFIG,
+ header_size,
+ payload_size)
+{
+ // record the start position
+ AP4_Offset start;
+ stream.Tell(start);
+
+ // read descriptor fields
+ stream.ReadUI08(m_ObjectTypeIndication);
+ unsigned char bits;
+ stream.ReadUI08(bits);
+ m_StreamType = (bits>>2)&0x3F;
+ m_UpStream = bits&2 ? true:false;
+ stream.ReadUI24(m_BufferSize);
+ stream.ReadUI32(m_MaxBitrate);
+ stream.ReadUI32(m_AverageBitrate);
+
+ // read other descriptors
+ AP4_SubStream* substream = new AP4_SubStream(stream, start+13, payload_size-13);
+ AP4_Descriptor* descriptor = NULL;
+ while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
+ descriptor)
+ == AP4_SUCCESS) {
+ m_SubDescriptors.Add(descriptor);
+ }
+ substream->Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::~AP4_DecoderConfigDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderConfigDescriptor::~AP4_DecoderConfigDescriptor()
+{
+ m_SubDescriptors.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DecoderConfigDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ stream.WriteUI08(m_ObjectTypeIndication);
+ AP4_UI08 bits = (m_StreamType<<2) | (m_UpStream? 2 : 0) | 1;
+ stream.WriteUI08(bits);
+ stream.WriteUI24(m_BufferSize);
+ stream.WriteUI32(m_MaxBitrate);
+ stream.WriteUI32(m_AverageBitrate);
+
+ m_SubDescriptors.Apply(AP4_DescriptorListWriter(stream));
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DecoderConfigDescriptor::Inspect(AP4_AtomInspector& inspector)
+{
+ char info[64];
+ AP4_StringFormat(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),
+ m_PayloadSize);
+ inspector.StartElement("#[DecoderConfig]", info);
+ inspector.AddField("stream_type", m_StreamType);
+ inspector.AddField("object_type", m_ObjectTypeIndication);
+ inspector.AddField("up_stream", m_UpStream);
+ inspector.AddField("buffer_size", m_BufferSize);
+ inspector.AddField("max_bitrate", m_MaxBitrate);
+ inspector.AddField("avg_bitrate", m_AverageBitrate);
+
+ // inspect children
+ m_SubDescriptors.Apply(AP4_DescriptorListInspector(inspector));
+
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::GetDecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+const AP4_DecoderSpecificInfoDescriptor*
+AP4_DecoderConfigDescriptor::GetDecoderSpecificInfoDescriptor() const
+{
+ // find the decoder specific info
+ AP4_Descriptor* descriptor = NULL;
+ AP4_Result result =
+ m_SubDescriptors.Find(AP4_DescriptorFinder(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO),
+ descriptor);
+
+ // return it
+ if (AP4_SUCCEEDED(result)) {
+ return dynamic_cast<AP4_DecoderSpecificInfoDescriptor*>(descriptor);
+ } else {
+ return NULL;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.h
new file mode 100644
index 000000000..1b7e02a77
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderConfigDescriptor.h
@@ -0,0 +1,88 @@
+/*****************************************************************
+|
+| AP4 - DecoderConfig Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DECODER_CONFIG_DESCRIPTOR_H_
+#define _AP4_DECODER_CONFIG_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Descriptor.h"
+#include "Ap4DecoderSpecificInfoDescriptor.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_DECODER_CONFIG = 0x04;
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor
++---------------------------------------------------------------------*/
+class AP4_DecoderConfigDescriptor : public AP4_Descriptor
+{
+ public:
+ // methods
+ AP4_DecoderConfigDescriptor(AP4_UI08 stream_type,
+ AP4_UI08 oti,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate,
+ AP4_DecoderSpecificInfoDescriptor* dsi);
+ AP4_DecoderConfigDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size);
+ virtual ~AP4_DecoderConfigDescriptor();
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+
+ // accessors
+ virtual const AP4_DecoderSpecificInfoDescriptor*
+ GetDecoderSpecificInfoDescriptor() const;
+ virtual AP4_UI08 GetObjectTypeIndication() const {
+ return m_ObjectTypeIndication;
+ }
+ virtual AP4_UI08 GetStreamType() const { return m_StreamType; }
+ virtual AP4_UI32 GetBufferSize() const { return m_BufferSize; }
+ virtual AP4_UI32 GetMaxBitrate() const { return m_MaxBitrate; }
+ virtual AP4_UI32 GetAvgBitrate() const { return m_AverageBitrate; }
+
+ private:
+ // members
+ AP4_UI08 m_StreamType;
+ AP4_UI08 m_ObjectTypeIndication;
+ bool m_UpStream;
+ AP4_UI32 m_BufferSize;
+ AP4_UI32 m_MaxBitrate;
+ AP4_UI32 m_AverageBitrate;
+ mutable AP4_List<AP4_Descriptor> m_SubDescriptors;
+};
+
+#endif // _AP4_DECODER_CONFIG_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp
new file mode 100644
index 000000000..d04c9d57c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp
@@ -0,0 +1,98 @@
+/*****************************************************************
+|
+| AP4 - DecoderSpecificInfo Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4DecoderSpecificInfoDescriptor.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor(
+ const AP4_DataBuffer& data) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
+ MinHeaderSize(data.GetDataSize()),
+ data.GetDataSize()),
+ m_Info(data)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor(
+ AP4_ByteStream& stream, AP4_Size header_size, AP4_Size payload_size) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
+ header_size, payload_size)
+{
+ m_Info.SetDataSize(payload_size);
+ stream.Read(m_Info.UseData(), payload_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::~AP4_DecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderSpecificInfoDescriptor::~AP4_DecoderSpecificInfoDescriptor()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DecoderSpecificInfoDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ // write the info buffer
+ if (m_PayloadSize && m_Info.GetDataSize()) {
+ stream.Write(m_Info.GetData(), m_Info.GetDataSize());
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DecoderSpecificInfoDescriptor::Inspect(AP4_AtomInspector& inspector)
+{
+ char* info = new char[m_Info.GetDataSize()*3+1];
+ for (unsigned int i=0; i<m_Info.GetDataSize(); i++) {
+ AP4_StringFormat(&info[i*3], 3, "%02x ", m_Info.UseData()[i]);
+ }
+ info[m_Info.GetDataSize()*3] = '\0';
+ inspector.AddField("#[DecoderSpecificInfo]", info);
+ delete[] info;
+
+ return AP4_SUCCESS;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h
new file mode 100644
index 000000000..f5e6e3cd4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - DecoderSpecificInfo Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DECODER_SPECIFIC_INFO_DESCRIPTOR_H_
+#define _AP4_DECODER_SPECIFIC_INFO_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Descriptor.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO = 0x05;
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+class AP4_DecoderSpecificInfoDescriptor : public AP4_Descriptor
+{
+public:
+ // methods
+ AP4_DecoderSpecificInfoDescriptor(const AP4_DataBuffer& data);
+ AP4_DecoderSpecificInfoDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size);
+ virtual ~AP4_DecoderSpecificInfoDescriptor();
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual const AP4_DataBuffer& GetDecoderSpecificInfo() const { return m_Info; }
+
+private:
+ // members
+ AP4_DataBuffer m_Info;
+};
+
+#endif // _AP4_DECODER_SPECIFIC_INFO_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Descriptor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Descriptor.cpp
new file mode 100644
index 000000000..e9edafbf3
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Descriptor.cpp
@@ -0,0 +1,116 @@
+/*****************************************************************
+|
+| AP4 - Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Descriptor.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor::MinHeaderSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_Descriptor::MinHeaderSize(AP4_Size payload_size)
+{
+ // compute how many bytes are needed to encode the payload size
+ // plus tag
+ return 2+(payload_size/128);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor::AP4_Descriptor
++---------------------------------------------------------------------*/
+AP4_Descriptor::AP4_Descriptor(Tag tag,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
+ m_Tag(tag),
+ m_HeaderSize(header_size),
+ m_PayloadSize(payload_size)
+{
+ AP4_ASSERT(header_size >= 1+1);
+ AP4_ASSERT(header_size <= 1+4);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Descriptor::Write(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the tag
+ result = stream.WriteUI08(m_Tag);
+ if (AP4_FAILED(result)) return result;
+
+ // write the size
+ AP4_ASSERT(m_HeaderSize-1 <= 8);
+ AP4_ASSERT(m_HeaderSize >= 2);
+ unsigned int size = m_PayloadSize;
+ unsigned char bytes[8];
+
+ // last bytes of the encoded size
+ bytes[m_HeaderSize-2] = size&0x7F;
+
+ // leading bytes of the encoded size
+ for (int i=m_HeaderSize-3; i>=0; i--) {
+ // move to the next 7 bits
+ size >>= 7;
+
+ // output a byte with a top bit marker
+ bytes[i] = (size&0x7F) | 0x80;
+ }
+
+ result = stream.Write(bytes, m_HeaderSize-1);
+ if (AP4_FAILED(result)) return result;
+
+ // write the fields
+ WriteFields(stream);
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Descriptor::Inspect(AP4_AtomInspector& inspector)
+{
+ char name[6];
+ AP4_StringFormat(name, sizeof(name), "#[%02x]", m_Tag);
+ char info[64];
+ AP4_StringFormat(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),
+ m_PayloadSize);
+ inspector.StartElement(name, info);
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Descriptor.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Descriptor.h
new file mode 100644
index 000000000..e2e6689f9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Descriptor.h
@@ -0,0 +1,116 @@
+/*****************************************************************
+|
+| AP4 - Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DESCRIPTOR_H_
+#define _AP4_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor
++---------------------------------------------------------------------*/
+class AP4_Descriptor
+{
+ public:
+ // types
+ typedef unsigned char Tag;
+
+ // class methods
+ static AP4_Size MinHeaderSize(AP4_Size payload_size);
+
+ // methods
+ AP4_Descriptor(Tag tag, AP4_Size header_size, AP4_Size payload_size);
+ virtual ~AP4_Descriptor() {}
+ Tag GetTag() { return m_Tag; }
+ AP4_Size GetSize() { return m_PayloadSize+m_HeaderSize; }
+ AP4_Size GetHeaderSize() { return m_HeaderSize; }
+ virtual AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream) = 0;
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+
+ protected:
+ // members
+ Tag m_Tag;
+ AP4_Size m_HeaderSize;
+ AP4_Size m_PayloadSize;
+};
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorFinder
++---------------------------------------------------------------------*/
+class AP4_DescriptorFinder : public AP4_List<AP4_Descriptor>::Item::Finder
+{
+ public:
+ AP4_DescriptorFinder(AP4_Descriptor::Tag tag) : m_Tag(tag) {}
+ AP4_Result Test(AP4_Descriptor* descriptor) const {
+ return descriptor->GetTag() == m_Tag ? AP4_SUCCESS : AP4_FAILURE;
+ }
+ private:
+ AP4_Descriptor::Tag m_Tag;
+};
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorListWriter
++---------------------------------------------------------------------*/
+class AP4_DescriptorListWriter : public AP4_List<AP4_Descriptor>::Item::Operator
+{
+public:
+ AP4_DescriptorListWriter(AP4_ByteStream& stream) :
+ m_Stream(stream) {}
+ AP4_Result Action(AP4_Descriptor* descriptor) const {
+ return descriptor->Write(m_Stream);
+ }
+
+private:
+ AP4_ByteStream& m_Stream;
+};
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorListInspector
++---------------------------------------------------------------------*/
+class AP4_DescriptorListInspector : public AP4_List<AP4_Descriptor>::Item::Operator
+{
+ public:
+ AP4_DescriptorListInspector(AP4_AtomInspector& inspector) :
+ m_Inspector(inspector) {}
+ AP4_Result Action(AP4_Descriptor* descriptor) const {
+ descriptor->Inspect(m_Inspector);
+ return AP4_SUCCESS;
+ }
+
+ private:
+ AP4_AtomInspector& m_Inspector;
+};
+
+#endif // _AP4_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp
new file mode 100644
index 000000000..4db7b96f9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.cpp
@@ -0,0 +1,108 @@
+/*****************************************************************
+|
+| AP4 - Descriptor Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4EsDescriptor.h"
+#include "Ap4DecoderConfigDescriptor.h"
+#include "Ap4DecoderSpecificInfoDescriptor.h"
+#include "Ap4SLConfigDescriptor.h"
+#include "Ap4UnknownDescriptor.h"
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorFactory::CreateDescriptorFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream& stream,
+ AP4_Descriptor*& descriptor)
+{
+ AP4_Result result;
+
+ // NULL by default
+ descriptor = NULL;
+
+ // remember current stream offset
+ AP4_Offset offset;
+ stream.Tell(offset);
+
+ // read descriptor tag
+ unsigned char tag;
+ result = stream.ReadUI08(tag);
+ if (AP4_FAILED(result)) {
+ stream.Seek(offset);
+ return result;
+ }
+
+ // read descriptor size
+ unsigned long payload_size = 0;
+ unsigned int header_size = 1;
+ unsigned int max = 4;
+ unsigned char ext = 0;
+ do {
+ header_size++;
+ result = stream.ReadUI08(ext);
+ if (AP4_FAILED(result)) {
+ stream.Seek(offset);
+ return result;
+ }
+ payload_size = (payload_size<<7) + (ext&0x7F);
+ } while (--max && (ext&0x80));
+
+ // create the descriptor
+ switch (tag) {
+ case AP4_DESCRIPTOR_TAG_ES:
+ descriptor = new AP4_EsDescriptor(stream, header_size, payload_size);
+ break;
+
+ case AP4_DESCRIPTOR_TAG_DECODER_CONFIG:
+ descriptor = new AP4_DecoderConfigDescriptor(stream, header_size, payload_size);
+ break;
+
+ case AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO:
+ descriptor = new AP4_DecoderSpecificInfoDescriptor(stream, header_size, payload_size);
+ break;
+
+ case AP4_DESCRIPTOR_TAG_SL_CONFIG:
+ if (payload_size != 1) return AP4_ERROR_INVALID_FORMAT;
+ descriptor = new AP4_SLConfigDescriptor(header_size);
+ break;
+
+ default:
+ descriptor = new AP4_UnknownDescriptor(stream, tag, header_size, payload_size);
+ break;
+ }
+
+ // skip to the end of the descriptor
+ stream.Seek(offset+header_size+payload_size);
+
+ return AP4_SUCCESS;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.h
new file mode 100644
index 000000000..2d9ab4264
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DescriptorFactory.h
@@ -0,0 +1,50 @@
+/*****************************************************************
+|
+| AP4 - Descriptor Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DESCRIPTOR_FACTORY_H_
+#define _AP4_DESCRIPTOR_FACTORY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Descriptor.h"
+#include "Ap4ByteStream.h"
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorFactory
++---------------------------------------------------------------------*/
+class AP4_DescriptorFactory
+{
+ public:
+ // class methods
+ static AP4_Result CreateDescriptorFromStream(AP4_ByteStream& stream,
+ AP4_Descriptor*& descriptor);
+};
+
+#endif // _AP4_DESCRIPTOR_FACTORY_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DrefAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DrefAtom.cpp
new file mode 100644
index 000000000..0157c2969
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DrefAtom.cpp
@@ -0,0 +1,89 @@
+/*****************************************************************
+|
+| AP4 - dref Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4DrefAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom::AP4_DrefAtom
++---------------------------------------------------------------------*/
+AP4_DrefAtom::AP4_DrefAtom(AP4_Atom** refs, AP4_Cardinal refs_count) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, AP4_FULL_ATOM_HEADER_SIZE+4, true)
+{
+ for (unsigned i=0; i<refs_count; i++) {
+ m_Children.Add(refs[i]);
+ m_Size += refs[i]->GetSize();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom::AP4_DrefAtom
++---------------------------------------------------------------------*/
+AP4_DrefAtom::AP4_DrefAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, size, true, stream)
+{
+ // read the number of entries
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+
+ // read children
+ AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ while (entry_count--) {
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom,
+ this))) {
+ m_Children.Add(atom);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DrefAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the number of entries
+ result = stream.WriteUI32(m_Children.ItemCount());
+ if (AP4_FAILED(result)) return result;
+
+ // write the children
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DrefAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DrefAtom.h
new file mode 100644
index 000000000..55679f0be
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4DrefAtom.h
@@ -0,0 +1,56 @@
+/*****************************************************************
+|
+| AP4 - dref Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DREF_ATOM_H_
+#define _AP4_DREF_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom
++---------------------------------------------------------------------*/
+class AP4_DrefAtom : public AP4_ContainerAtom
+{
+public:
+ // methods
+ AP4_DrefAtom(AP4_Atom** refs, AP4_Cardinal refs_count);
+ AP4_DrefAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+};
+
+#endif // _AP4_DREF_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.cpp
new file mode 100644
index 000000000..059e15ba9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.cpp
@@ -0,0 +1,205 @@
+/*****************************************************************
+|
+| AP4 - ES Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4EsDescriptor.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::AP4_EsDescriptor
++---------------------------------------------------------------------*/
+AP4_EsDescriptor::AP4_EsDescriptor(AP4_UI16 es_id) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES, 2, 2+1),
+ m_EsId(es_id),
+ m_OcrEsId(0),
+ m_Flags(0),
+ m_StreamPriority(0),
+ m_DependsOn(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::AP4_EsDescriptor
++---------------------------------------------------------------------*/
+AP4_EsDescriptor::AP4_EsDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES, header_size, payload_size)
+{
+ AP4_Offset start;
+ stream.Tell(start);
+
+ // read descriptor fields
+ stream.ReadUI16(m_EsId);
+ unsigned char bits;
+ stream.ReadUI08(bits);
+ m_Flags = (bits>>5)&7;
+ m_StreamPriority = bits&0x1F;
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY) {
+ stream.ReadUI16(m_DependsOn);
+ } else {
+ m_DependsOn = 0;
+ }
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
+ unsigned char url_length;
+ stream.ReadUI08(url_length);
+ if (url_length) {
+ char* url = new char[url_length+1];
+ if (url) {
+ stream.Read(url, url_length, NULL);
+ url[url_length] = '\0';
+ m_Url = url;
+ delete[] url;
+ }
+ }
+ }
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
+ stream.ReadUI16(m_OcrEsId);
+ } else {
+ m_OcrEsId = 0;
+ }
+
+ // read other descriptors
+ AP4_Offset offset;
+ stream.Tell(offset);
+ AP4_SubStream* substream = new AP4_SubStream(stream, offset,
+ payload_size-(offset-start));
+ AP4_Descriptor* descriptor = NULL;
+ while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
+ descriptor)
+ == AP4_SUCCESS) {
+ m_SubDescriptors.Add(descriptor);
+ }
+ substream->Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::~AP4_EsDescriptor
++---------------------------------------------------------------------*/
+AP4_EsDescriptor::~AP4_EsDescriptor()
+{
+ m_SubDescriptors.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // es id
+ result = stream.WriteUI16(m_EsId);
+ if (AP4_FAILED(result)) return result;
+
+ // flags and other bits
+ AP4_UI08 bits = m_StreamPriority | (AP4_UI08)(m_Flags<<5);
+ result = stream.WriteUI08(bits);
+ if (AP4_FAILED(result)) return result;
+
+ // optional fields
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY) {
+ result = stream.WriteUI16(m_DependsOn);
+ if (AP4_FAILED(result)) return result;
+ }
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
+ result = stream.WriteUI08(m_Url.length());
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteString(m_Url.c_str());
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI08(0);
+ if (AP4_FAILED(result)) return result;
+ }
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM) {
+ result = stream.WriteUI16(m_OcrEsId);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // write the sub descriptors
+ m_SubDescriptors.Apply(AP4_DescriptorListWriter(stream));
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsDescriptor::Inspect(AP4_AtomInspector& inspector)
+{
+ char info[64];
+ AP4_StringFormat(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
+ inspector.StartElement("#[ES]", info);
+ inspector.AddField("es_id", m_EsId);
+ inspector.AddField("stream_priority", m_StreamPriority);
+
+ // inspect children
+ m_SubDescriptors.Apply(AP4_DescriptorListInspector(inspector));
+
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::AddSubDescriptor
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsDescriptor::AddSubDescriptor(AP4_Descriptor* descriptor)
+{
+ m_SubDescriptors.Add(descriptor);
+ m_PayloadSize += descriptor->GetSize();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::GetDecoderConfigDescriptor
++---------------------------------------------------------------------*/
+const AP4_DecoderConfigDescriptor*
+AP4_EsDescriptor::GetDecoderConfigDescriptor() const
+{
+ // find the decoder config descriptor
+ AP4_Descriptor* descriptor = NULL;
+ AP4_Result result =
+ m_SubDescriptors.Find(AP4_DescriptorFinder(AP4_DESCRIPTOR_TAG_DECODER_CONFIG),
+ descriptor);
+
+ // return it
+ if (AP4_SUCCEEDED(result)) {
+ return dynamic_cast<AP4_DecoderConfigDescriptor*>(descriptor);
+ } else {
+ return NULL;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.h
new file mode 100644
index 000000000..e52b67d1d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsDescriptor.h
@@ -0,0 +1,78 @@
+/*****************************************************************
+|
+| AP4 - ES Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ES_DESCRIPTOR_H_
+#define _AP4_ES_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Descriptor.h"
+#include "Ap4DecoderConfigDescriptor.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_ES = 0x03;
+
+const int AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY = 1;
+const int AP4_ES_DESCRIPTOR_FLAG_URL = 2;
+const int AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM = 4;
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor
++---------------------------------------------------------------------*/
+class AP4_EsDescriptor : public AP4_Descriptor
+{
+ public:
+ // methods
+ AP4_EsDescriptor(AP4_UI16 es_id);
+ AP4_EsDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size);
+ ~AP4_EsDescriptor();
+ virtual AP4_Result AddSubDescriptor(AP4_Descriptor* descriptor);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual const AP4_DecoderConfigDescriptor* GetDecoderConfigDescriptor() const;
+
+ private:
+ // members
+ unsigned short m_EsId;
+ unsigned short m_OcrEsId;
+ AP4_Flags m_Flags;
+ unsigned char m_StreamPriority;
+ unsigned short m_DependsOn;
+ AP4_String m_Url;
+ mutable AP4_List<AP4_Descriptor> m_SubDescriptors;
+};
+
+#endif // _AP4_ES_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsdsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsdsAtom.cpp
new file mode 100644
index 000000000..7be18b6f8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsdsAtom.cpp
@@ -0,0 +1,95 @@
+/*****************************************************************
+|
+| AP4 - esds Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4EsdsAtom.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::AP4_EsdsAtom
++---------------------------------------------------------------------*/
+AP4_EsdsAtom::AP4_EsdsAtom(AP4_EsDescriptor* descriptor) :
+ AP4_Atom(AP4_ATOM_TYPE_ESDS, AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_EsDescriptor(descriptor)
+{
+ if (m_EsDescriptor) m_Size += m_EsDescriptor->GetSize();
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::AP4_EsdsAtom
++---------------------------------------------------------------------*/
+AP4_EsdsAtom::AP4_EsdsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_ESDS, size, true, stream)
+{
+ // read descriptor
+ AP4_Descriptor* descriptor = NULL;
+ if (AP4_DescriptorFactory::CreateDescriptorFromStream(stream, descriptor)
+ == AP4_SUCCESS) {
+ m_EsDescriptor = dynamic_cast<AP4_EsDescriptor*>(descriptor);
+ } else {
+ m_EsDescriptor = NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::~AP4_EsdsAtom
++---------------------------------------------------------------------*/
+AP4_EsdsAtom::~AP4_EsdsAtom()
+{
+ delete m_EsDescriptor;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsdsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // write the es descriptor
+ if (m_EsDescriptor) return m_EsDescriptor->Write(stream);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsdsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ // inspect descriptor
+ if (m_EsDescriptor) {
+ m_EsDescriptor->Inspect(inspector);
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsdsAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsdsAtom.h
new file mode 100644
index 000000000..2e3a114cd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4EsdsAtom.h
@@ -0,0 +1,61 @@
+/*****************************************************************
+|
+| AP4 - esds Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ESDS_ATOM_H_
+#define _AP4_ESDS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4EsDescriptor.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom
++---------------------------------------------------------------------*/
+class AP4_EsdsAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_EsdsAtom(AP4_EsDescriptor* descriptor);
+ AP4_EsdsAtom(AP4_Size size, AP4_ByteStream& stream);
+ ~AP4_EsdsAtom();
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ const AP4_EsDescriptor* GetEsDescriptor() const { return m_EsDescriptor; }
+
+ private:
+ // members
+ AP4_EsDescriptor* m_EsDescriptor;
+};
+
+#endif // _AP4_ESDS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.cpp
new file mode 100644
index 000000000..8c65dd3ae
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.cpp
@@ -0,0 +1,90 @@
+/*****************************************************************
+|
+| AP4 - File
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4File.h"
+#include "Ap4Atom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_File::AP4_File
++---------------------------------------------------------------------*/
+AP4_File::AP4_File(AP4_Movie* movie) :
+ m_Movie(movie)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_File::AP4_File
++---------------------------------------------------------------------*/
+AP4_File::AP4_File(AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) :
+ m_Movie(NULL)
+{
+ // get all atoms
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream, atom))) {
+ switch (atom->GetType()) {
+ case AP4_ATOM_TYPE_MOOV:
+ m_Movie = new AP4_Movie(dynamic_cast<AP4_MoovAtom*>(atom),
+ stream);
+ break;
+
+ default:
+ m_OtherAtoms.Add(atom);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_File::~AP4_File
++---------------------------------------------------------------------*/
+AP4_File::~AP4_File()
+{
+ delete m_Movie;
+ m_OtherAtoms.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_File::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_File::Inspect(AP4_AtomInspector& inspector)
+{
+ // dump the moov atom first
+ if (m_Movie) m_Movie->Inspect(inspector);
+
+ // dump the other atoms
+ m_OtherAtoms.Apply(AP4_AtomListInspector(inspector));
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.h
new file mode 100644
index 000000000..6e091bd43
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4File.h
@@ -0,0 +1,65 @@
+/*****************************************************************
+|
+| AP4 - File
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FILE_H_
+#define _AP4_FILE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Track.h"
+#include "Ap4List.h"
+#include "Ap4Movie.h"
+#include "Ap4ByteStream.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_File
++---------------------------------------------------------------------*/
+class AP4_File {
+public:
+ // constructors and destructor
+ AP4_File(AP4_Movie* movie);
+ AP4_File(AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory = AP4_AtomFactory::DefaultFactory);
+ virtual ~AP4_File();
+
+ // methods
+ AP4_List<AP4_Atom>& GetOtherAtoms() { return m_OtherAtoms;}
+ AP4_Movie* GetMovie() { return m_Movie; }
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+
+private:
+ // members
+ AP4_Movie* m_Movie;
+ AP4_List<AP4_Atom> m_OtherAtoms;
+};
+
+#endif // _AP4_FILE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileByteStream.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileByteStream.h
new file mode 100644
index 000000000..564813597
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileByteStream.h
@@ -0,0 +1,90 @@
+/*****************************************************************
+|
+| AP4 - FileByteStream
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+
+#ifndef _AP4_FILE_BYTE_STREAM_H_
+#define _AP4_FILE_BYTE_STREAM_H_
+
+/*----------------------------------------------------------------------
+| AP4_FileByteStream
++---------------------------------------------------------------------*/
+class AP4_FileByteStream: public AP4_ByteStream
+{
+public:
+ // types
+ typedef enum {
+ STREAM_MODE_READ,
+ STREAM_MODE_WRITE
+ } Mode;
+
+ // methods
+ AP4_FileByteStream(const char* name, Mode mode);
+
+ // AP4_ByteStream methods
+ AP4_Result Read(void* buffer,
+ AP4_Size bytesToRead,
+ AP4_Size* bytesRead) {
+ return m_Delegate->Read(buffer, bytesToRead, bytesRead);
+ }
+ AP4_Result Write(const void* buffer,
+ AP4_Size bytesToWrite,
+ AP4_Size* bytesWritten) {
+ return m_Delegate->Write(buffer, bytesToWrite, bytesWritten);
+ }
+ AP4_Result Seek(AP4_Offset offset) { return m_Delegate->Seek(offset); }
+ AP4_Result Tell(AP4_Offset& offset) { return m_Delegate->Tell(offset); }
+ AP4_Result GetSize(AP4_Size& size) { return m_Delegate->GetSize(size);}
+
+ // AP4_Referenceable methods
+ void AddReference() { m_Delegate->AddReference(); }
+ void Release() { m_Delegate->Release(); }
+
+protected:
+ // methods
+ virtual ~AP4_FileByteStream() {
+ delete m_Delegate;
+ }
+
+ // members
+ AP4_ByteStream* m_Delegate;
+};
+
+#endif // _AP4_FILE_BYTE_STREAM_H_
+
+
+
+
+
+
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileWriter.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileWriter.cpp
new file mode 100644
index 000000000..663fe9286
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileWriter.cpp
@@ -0,0 +1,90 @@
+/*****************************************************************
+|
+| AP4 - File Writer
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4MoovAtom.h"
+#include "Ap4FileWriter.h"
+
+/*----------------------------------------------------------------------
+| AP4_FileWriter::AP4_FileWriter
++---------------------------------------------------------------------*/
+AP4_FileWriter::AP4_FileWriter(AP4_File& file) : m_File(file)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_FileWriter::~AP4_FileWriter
++---------------------------------------------------------------------*/
+AP4_FileWriter::~AP4_FileWriter()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_FileWriter::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FileWriter::Write(AP4_ByteStream& stream)
+{
+ //AP4_Result result;
+
+ // get the movie object
+ AP4_Movie* movie = m_File.GetMovie();
+ if (movie == NULL) return AP4_SUCCESS;
+
+ // compute the final offset of the sample data in mdat
+ AP4_Offset data_offset = movie->GetMoovAtom()->GetSize()+AP4_ATOM_HEADER_SIZE;
+
+ // adjust the tracks
+ AP4_List<AP4_Track>::Item* track_item = movie->GetTracks().FirstItem();
+ while (track_item) {
+ AP4_Track* track = track_item->GetData();
+ track->GetTrakAtom()->AdjustChunkOffsets(data_offset);
+ track_item = track_item->GetNext();
+ }
+
+ // write the moov atom
+ movie->GetMoovAtom()->Write(stream);
+
+ // create an mdat
+ stream.WriteUI32(0);
+ stream.Write("mdat", 4);
+ AP4_Track* track = movie->GetTracks().FirstItem()->GetData();
+ AP4_Cardinal sample_count = track->GetSampleCount();
+ for (AP4_Ordinal i=0; i<sample_count; i++) {
+ AP4_Sample sample;
+ AP4_DataBuffer data;
+ track->ReadSample(i, sample, data);
+ stream.Write(data.GetData(), data.GetDataSize());
+ }
+
+ // TODO: update the mdat size
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileWriter.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileWriter.h
new file mode 100644
index 000000000..b8f5b3df8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FileWriter.h
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - File Writer
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FILE_WRITER_H_
+#define _AP4_FILE_WRITER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Track.h"
+#include "Ap4List.h"
+#include "Ap4ByteStream.h"
+#include "Ap4File.h"
+
+/*----------------------------------------------------------------------
+| AP4_FileWriter
++---------------------------------------------------------------------*/
+class AP4_FileWriter {
+ public:
+ // constructors and destructor
+ AP4_FileWriter(AP4_File& file);
+ virtual ~AP4_FileWriter();
+
+ // methods
+ AP4_Result Write(AP4_ByteStream& stream);
+
+ private:
+ AP4_File& m_File;
+};
+
+#endif // _AP4_FILE_WRITER_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FrmaAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FrmaAtom.cpp
new file mode 100644
index 000000000..41a8a92f0
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FrmaAtom.cpp
@@ -0,0 +1,76 @@
+/*****************************************************************
+|
+| AP4 - frma Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4FrmaAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom::AP4_FrmaAtom
++---------------------------------------------------------------------*/
+AP4_FrmaAtom::AP4_FrmaAtom(AP4_UI32 original_format) :
+ AP4_Atom(AP4_ATOM_TYPE_FRMA, AP4_ATOM_HEADER_SIZE+4, false),
+ m_OriginalFormat(original_format)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom::AP4_FrmaAtom
++---------------------------------------------------------------------*/
+AP4_FrmaAtom::AP4_FrmaAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_FRMA, size, false, stream)
+{
+ stream.ReadUI32(m_OriginalFormat);
+}
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FrmaAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // write the original format
+ return stream.WriteUI32(m_OriginalFormat);
+}
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FrmaAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char format[5];
+ AP4_FormatFourChars(format, m_OriginalFormat);
+ inspector.AddField("original_format", format);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FrmaAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FrmaAtom.h
new file mode 100644
index 000000000..8e15d7654
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FrmaAtom.h
@@ -0,0 +1,60 @@
+/*****************************************************************
+|
+| AP4 - frma Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FRMA_ATOM_H_
+#define _AP4_FRMA_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom
++---------------------------------------------------------------------*/
+class AP4_FrmaAtom : public AP4_Atom
+{
+ public:
+ // constructors
+ AP4_FrmaAtom(AP4_Size size, AP4_ByteStream& stream);
+ AP4_FrmaAtom(AP4_UI32 original_format);
+
+ // methods
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ AP4_UI32 GetOriginalFormat() { return m_OriginalFormat; }
+
+ private:
+ // members
+ AP4_UI32 m_OriginalFormat;
+};
+
+#endif // _AP4_FRMA_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtabAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtabAtom.cpp
new file mode 100644
index 000000000..287238ebd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtabAtom.cpp
@@ -0,0 +1,64 @@
+/*****************************************************************
+|
+| AP4 - ftab Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4FtabAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_FtabAtom::AP4_FtabAtom
++---------------------------------------------------------------------*/
+
+AP4_FtabAtom::AP4_FtabAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_FTAB)
+{
+ AP4_UI16 entryCount;
+ stream.ReadUI16(entryCount);
+
+ m_FontRecords.EnsureCapacity(entryCount);
+
+ while(entryCount--)
+ {
+ AP4_Tx3gFontRecord fontRecord;
+
+ stream.ReadUI16(fontRecord.Id);
+
+ AP4_UI08 len;
+ stream.ReadUI08(len);
+
+ char buff[256];
+ stream.ReadString(buff, len+1);
+
+ fontRecord.Name = buff;
+
+ m_FontRecords.Append(fontRecord);
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtabAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtabAtom.h
new file mode 100644
index 000000000..0845347d5
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtabAtom.h
@@ -0,0 +1,78 @@
+/*****************************************************************
+|
+| AP4 - ftab Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FTAB_ATOM_H_
+#define _AP4_FTAB_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+
+/*----------------------------------------------------------------------
+| AP4_FtabAtom
++---------------------------------------------------------------------*/
+class AP4_FtabAtom : public AP4_Atom
+{
+public:
+ AP4_FtabAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ struct AP4_Tx3gFontRecord
+ {
+ AP4_UI16 Id;
+ AP4_String Name;
+ };
+
+ AP4_Array<AP4_Tx3gFontRecord>& GetFontRecords() { return m_FontRecords; }
+
+ AP4_Result LookupFont(AP4_UI16 Id, AP4_String& Name)
+ {
+ for(unsigned long i = 0; i < m_FontRecords.ItemCount(); i++)
+ {
+ if(m_FontRecords[i].Id == Id)
+ {
+ Name = m_FontRecords[i].Name;
+ return AP4_SUCCESS;
+ }
+ }
+
+ return AP4_FAILURE;
+ }
+
+private:
+
+ // members
+ AP4_Array<AP4_Tx3gFontRecord> m_FontRecords;
+};
+
+#endif // _AP4_FTAB_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtypAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtypAtom.cpp
new file mode 100644
index 000000000..a08637dbf
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtypAtom.cpp
@@ -0,0 +1,99 @@
+/*****************************************************************
+|
+| AP4 - ftyp Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4FtypAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_FtypAtom::AP4_FtypAtom
++---------------------------------------------------------------------*/
+AP4_FtypAtom::AP4_FtypAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_FTYP, size, false, stream)
+{
+ stream.ReadUI32(m_MajorBrand);
+ stream.ReadUI32(m_MinorVersion);
+ size -= 16;
+ while (size) {
+ AP4_UI32 compatible_brand;
+ stream.ReadUI32(compatible_brand);
+ m_CompatibleBrands.Append(compatible_brand);
+ size -= 4;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_FtypAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FtypAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // major brand
+ result = stream.WriteUI32(m_MajorBrand);
+ if (AP4_FAILED(result)) return result;
+
+ // minor version
+ result = stream.WriteUI32(m_MinorVersion);
+ if (AP4_FAILED(result)) return result;
+
+ // compatible brands
+ AP4_Cardinal compat_brand_count = m_CompatibleBrands.ItemCount();
+ for (AP4_Ordinal i=0; i<compat_brand_count; i++) {
+ result = stream.WriteUI32(m_CompatibleBrands[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_FtypAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FtypAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char name[5];
+ AP4_FormatFourChars(name, m_MajorBrand);
+ inspector.AddField("major_brand", name);
+ inspector.AddField("minor_version", m_MinorVersion);
+
+ // compatible brands
+ for (unsigned int i=0; i<m_CompatibleBrands.ItemCount(); i++) {
+ AP4_UI32 cb = m_CompatibleBrands[i];
+ AP4_FormatFourChars(name, cb);
+ inspector.AddField("compatible_brand", name);
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtypAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtypAtom.h
new file mode 100644
index 000000000..0eec5905b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4FtypAtom.h
@@ -0,0 +1,59 @@
+/*****************************************************************
+|
+| AP4 - ftyp Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FTYP_ATOM_H_
+#define _AP4_FTYP_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4Array.h"
+
+/*----------------------------------------------------------------------
+| AP4_FtypAtom
++---------------------------------------------------------------------*/
+class AP4_FtypAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_FtypAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ private:
+ // members
+ AP4_UI32 m_MajorBrand;
+ AP4_UI32 m_MinorVersion;
+ AP4_Array<AP4_UI32> m_CompatibleBrands;
+};
+
+#endif // _AP4_FTYP_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.cpp
new file mode 100644
index 000000000..353ef117e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.cpp
@@ -0,0 +1,110 @@
+/*****************************************************************
+|
+| AP4 - hdlr Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::AP4_HdlrAtom
++---------------------------------------------------------------------*/
+AP4_HdlrAtom::AP4_HdlrAtom(AP4_Atom::Type hdlr_type, const char* hdlr_name) :
+ AP4_Atom(AP4_ATOM_TYPE_HDLR, true),
+ m_HandlerType(hdlr_type),
+ m_HandlerName(hdlr_name)
+{
+ m_Size += 20+m_HandlerName.length()+1;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::AP4_HdlrAtom
++---------------------------------------------------------------------*/
+AP4_HdlrAtom::AP4_HdlrAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_HDLR, size, true, stream)
+{
+ unsigned char reserved[12];
+ stream.Read(reserved, 4, NULL);
+ stream.ReadUI32(m_HandlerType);
+ stream.Read(reserved, 12, NULL);
+
+ // read the name unless it is empty
+ int name_size = size-(AP4_FULL_ATOM_HEADER_SIZE+20);
+ if (name_size > 0) {
+ char* name = new char[name_size+1];
+ stream.Read(name, name_size);
+ name[name_size] = '\0'; // force a null termination
+ m_HandlerName = name;
+ delete[] name;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HdlrAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the data
+ unsigned char reserved[12];
+ memset(reserved, 0, sizeof(reserved));
+ result = stream.Write(reserved, 4);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_HandlerType);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Write(reserved, 12);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Write(m_HandlerName.c_str(),
+ m_HandlerName.length()+1);
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_FULL_ATOM_HEADER_SIZE+20+m_HandlerName.length()+1);
+ while (padding--) stream.WriteUI08(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HdlrAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char type[5];
+ AP4_FormatFourChars(type, m_HandlerType);
+ inspector.AddField("handler_type", type);
+ inspector.AddField("handler_name", m_HandlerName.c_str());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.h
new file mode 100644
index 000000000..63b9d1507
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HdlrAtom.h
@@ -0,0 +1,71 @@
+/*****************************************************************
+|
+| AP4 - hdlr Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_HDLR_ATOM_H_
+#define _AP4_HDLR_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_HANDLER_TYPE_SOUN = AP4_ATOM_TYPE('s','o','u','n');
+const AP4_UI32 AP4_HANDLER_TYPE_VIDE = AP4_ATOM_TYPE('v','i','d','e');
+const AP4_UI32 AP4_HANDLER_TYPE_TEXT = AP4_ATOM_TYPE('t','e','x','t');
+const AP4_UI32 AP4_HANDLER_TYPE_TX3G = AP4_ATOM_TYPE('t','x','3','g');
+const AP4_UI32 AP4_HANDLER_TYPE_SUBP = AP4_ATOM_TYPE('s','u','b','p');
+const AP4_UI32 AP4_HANDLER_TYPE_HINT = AP4_ATOM_TYPE('h','i','n','t');
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom
++---------------------------------------------------------------------*/
+class AP4_HdlrAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_HdlrAtom(AP4_UI32 hdlr_type, const char* hdlr_name);
+ AP4_HdlrAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_UI32 GetHandlerType() { return m_HandlerType; }
+ AP4_String GetHandlerName() { return m_HandlerName; }
+
+private:
+ // members
+ AP4_UI32 m_HandlerType;
+ AP4_String m_HandlerName;
+};
+
+#endif // _AP4_HDLR_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.cpp
new file mode 100644
index 000000000..73b566753
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.cpp
@@ -0,0 +1,323 @@
+/*****************************************************************
+|
+| AP4 - Hint Track Reader
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdlib.h>
+#include <time.h>
+#include "Ap4HintTrackReader.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Track.h"
+#include "Ap4Movie.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4RtpHint.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4TrefTypeAtom.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::AP4_HintTrackReader
++---------------------------------------------------------------------*/
+AP4_HintTrackReader::AP4_HintTrackReader(AP4_Track& hint_track,
+ AP4_Movie& movie,
+ AP4_UI32 ssrc /* = 0 */) :
+ m_HintTrack(hint_track),
+ m_MediaTrack(NULL),
+ m_MediaTimeScale(0),
+ m_RtpSampleData(NULL),
+ m_Ssrc(ssrc),
+ m_SampleIndex(0),
+ m_PacketIndex(0),
+ m_RtpSequenceStart(0),
+ m_RtpTimeStampStart(0),
+ m_RtpTimeScale(0)
+{
+ // check the type
+ if (m_HintTrack.GetType() != AP4_Track::TYPE_HINT)
+ throw AP4_Exception(AP4_ERROR_INVALID_TRACK_TYPE);
+
+ // get the media track
+ AP4_TrakAtom* hint_trak_atom = hint_track.GetTrakAtom();
+ AP4_Atom* atom = hint_trak_atom->FindChild("tref/hint");
+ if (atom != NULL) {
+ AP4_UI32 media_track_id = ((AP4_TrefTypeAtom*) atom)->m_TrackIds[0];
+ m_MediaTrack = movie.GetTrack(media_track_id);
+
+ // get the media time scale
+ m_MediaTimeScale = m_MediaTrack->GetMediaTimeScale();
+ }
+
+ // initiate random generator
+ srand(time(NULL));
+
+ // rtp sequence start init TODO!!
+ m_RtpSequenceStart = rand();
+
+ // rtp timestamp start init TODO!!
+ m_RtpTimeStampStart = rand();
+
+ // rtp time scale
+ atom = hint_trak_atom->FindChild("mdia/minf/stbl/rtp /tims");
+ if (atom) {
+ AP4_TimsAtom* tims = (AP4_TimsAtom*)atom;
+ m_RtpTimeScale = tims->GetTimeScale();
+ }
+
+ // generate a random ssrc if = 0
+ if (m_Ssrc == 0) {
+ m_Ssrc = rand();
+ }
+
+ // get the first sample
+ GetRtpSample(0);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::~AP4_HintTrackReader
++---------------------------------------------------------------------*/
+AP4_HintTrackReader::~AP4_HintTrackReader()
+{
+ delete m_RtpSampleData;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::GetRtpSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::GetRtpSample(AP4_Ordinal index)
+{
+ // get the sample
+ AP4_Result result = m_HintTrack.GetSample(index, m_CurrentHintSample);
+ if (AP4_FAILED(result)) return result;
+
+ // renew the sample data
+ delete m_RtpSampleData;
+ AP4_ByteStream& rtp_data_stream = *m_CurrentHintSample.GetDataStream();
+ rtp_data_stream.Seek(m_CurrentHintSample.GetOffset());
+ m_RtpSampleData = new AP4_RtpSampleData(rtp_data_stream,
+ m_CurrentHintSample.GetSize());
+
+ // reinit the packet index
+ m_PacketIndex = 0;
+
+ // release the stream
+ rtp_data_stream.Release();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::GetCurrentTimeStampMs
++---------------------------------------------------------------------*/
+AP4_TimeStamp
+AP4_HintTrackReader::GetCurrentTimeStampMs()
+{
+ return AP4_ConvertTime(m_CurrentHintSample.GetCts(),
+ m_HintTrack.GetMediaTimeScale(),
+ 1000);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::Rewind
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::Rewind()
+{
+ m_SampleIndex = 0;
+ return GetRtpSample(m_SampleIndex);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::GetSdpText
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::GetSdpText(AP4_String& sdp_text)
+{
+ AP4_Atom* sdp_atom = m_HintTrack.GetTrakAtom()->FindChild("udta/hnti/sdp ");
+ if (sdp_atom == NULL) return AP4_FAILURE;
+
+ // C cast is OK because we know the type of the atom
+ sdp_text = ((AP4_SdpAtom*) sdp_atom)->GetSdpText();
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::SeekToTimeStampMs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::SeekToTimeStampMs(AP4_TimeStamp desired_ts,
+ AP4_TimeStamp& actual_ts)
+{
+ // get the sample index
+ AP4_Cardinal index;
+ AP4_Result result = m_HintTrack.GetSampleIndexForTimeStampMs(desired_ts, index);
+ if (AP4_FAILED(result)) return result;
+
+ // get the current sample based on the index and renew the sample data
+ result = GetRtpSample(index);
+ if (AP4_FAILED(result)) return result;
+
+ // set the actual ts
+ actual_ts = GetCurrentTimeStampMs();
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::GetNextPacket
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::GetNextPacket(AP4_DataBuffer& packet_data,
+ AP4_TimeStamp& ts_ms)
+{
+ AP4_Result result = AP4_SUCCESS;
+
+ // get the next rtp sample if needed
+ AP4_List<AP4_RtpPacket>* packets = &m_RtpSampleData->GetPackets();
+ while (m_PacketIndex == packets->ItemCount()) { // while: handle the 0 packet case
+ result = GetRtpSample(++m_SampleIndex);
+ if (AP4_FAILED(result)) return result;
+ packets = &m_RtpSampleData->GetPackets();
+ }
+
+ // get the packet
+ AP4_RtpPacket* packet;
+ result = packets->Get(m_PacketIndex++, packet);
+ if (AP4_FAILED(result)) return result;
+
+ // build it
+ result = BuildRtpPacket(packet, packet_data);
+ if (AP4_FAILED(result)) return result;
+
+ // set the time stamp
+ ts_ms = GetCurrentTimeStampMs();
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::BuildRtpPacket
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::BuildRtpPacket(AP4_RtpPacket* packet,
+ AP4_DataBuffer& packet_data)
+{
+ // set the data size
+ AP4_Result result = packet_data.SetDataSize(packet->GetConstructedDataSize());
+ if (AP4_FAILED(result)) return result;
+
+ // now write
+ AP4_ByteStream* stream =
+ new AP4_MemoryByteStream(packet_data.UseData(), packet_data.GetDataSize());
+
+ // header + ssrc
+ stream->WriteUI08(0x80 | (packet->GetPBit() << 5) | (packet->GetXBit() << 4));
+ stream->WriteUI08((packet->GetMBit() << 7) | packet->GetPayloadType());
+ stream->WriteUI16(m_RtpSequenceStart + packet->GetSequenceSeed());
+ stream->WriteUI32(m_RtpTimeStampStart + m_CurrentHintSample.GetCts() + packet->GetTimeStampOffset());
+ stream->WriteUI32(m_Ssrc);
+
+ AP4_List<AP4_RtpConstructor>::Item* constructors_it
+ = packet->GetConstructors().FirstItem();
+ while (constructors_it != NULL) {
+ AP4_RtpConstructor* constructor = constructors_it->GetData();
+
+ // add data to the packet according to the constructor
+ switch (constructor->GetType()) {
+ case AP4_RTP_CONSTRUCTOR_TYPE_NOOP:
+ // nothing to do here
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE:
+ result = WriteImmediateRtpData(
+ (AP4_ImmediateRtpConstructor*) constructor, stream);
+ if (AP4_FAILED(result)) return result;
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE:
+ result = WriteSampleRtpData(
+ (AP4_SampleRtpConstructor*) constructor, stream);
+ if (AP4_FAILED(result)) return result;
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC:
+ return AP4_ERROR_NOT_SUPPORTED_YET;
+ default:
+ // unknown constructor type
+ return AP4_FAILURE;
+ }
+
+ // iterate
+ constructors_it = constructors_it->GetNext();
+ }
+
+ // release the stream
+ stream->Release();
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::WriteImmediateRtpData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::WriteImmediateRtpData(AP4_ImmediateRtpConstructor* constructor,
+ AP4_ByteStream* data_stream)
+{
+ const AP4_DataBuffer& data_buffer = constructor->GetData();
+ return data_stream->Write(data_buffer.GetData(), data_buffer.GetDataSize());
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::WriteSampleRtpData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::WriteSampleRtpData(AP4_SampleRtpConstructor* constructor,
+ AP4_ByteStream* data_stream)
+{
+ AP4_Track* referenced_track = NULL;
+ if (constructor->GetTrackRefIndex() == 0xFF) {
+ // data is in the hint track
+ referenced_track = &m_HintTrack;
+ } else {
+ // check if we have a media track
+ if (m_MediaTrack == NULL) return AP4_FAILURE;
+ referenced_track = m_MediaTrack;
+ }
+
+ // write the sample data
+ AP4_Sample sample;
+ AP4_Result result = referenced_track->GetSample(constructor->GetSampleNum()-1, // adjust
+ sample);
+ AP4_DataBuffer buffer(constructor->GetLength());
+ result = sample.ReadData(
+ buffer, constructor->GetLength(), constructor->GetSampleOffset());
+ if (AP4_FAILED(result)) return result;
+
+ // write the data
+ return data_stream->Write(buffer.GetData(), buffer.GetDataSize());
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.h
new file mode 100644
index 000000000..a17aa13ed
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HintTrackReader.h
@@ -0,0 +1,95 @@
+/*****************************************************************
+|
+| AP4 - Hint Track Reader
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_HINT_TRACK_READER_H_
+#define _AP4_HINT_TRACK_READER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Sample.h"
+
+/*----------------------------------------------------------------------
+| class declarations
++---------------------------------------------------------------------*/
+class AP4_DataBuffer;
+class AP4_Movie;
+class AP4_Track;
+class AP4_RtpSampleData;
+class AP4_RtpPacket;
+class AP4_ImmediateRtpConstructor;
+class AP4_SampleRtpConstructor;
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader
++---------------------------------------------------------------------*/
+class AP4_HintTrackReader
+{
+public:
+ // constructor and destructor
+ AP4_HintTrackReader(AP4_Track& hint_track,
+ AP4_Movie& movie,
+ AP4_UI32 ssrc = 0); // if 0, random value is chosen
+ ~AP4_HintTrackReader();
+
+ // methods
+ AP4_Result GetNextPacket(AP4_DataBuffer& packet,
+ AP4_TimeStamp& ts_ms);
+ AP4_Result SeekToTimeStampMs(AP4_TimeStamp desired_ts,
+ AP4_TimeStamp& actual_ts);
+ AP4_TimeStamp GetCurrentTimeStampMs();
+ AP4_Result Rewind();
+ AP4_Result GetSdpText(AP4_String& sdp);
+ AP4_Track* GetMediaTrack() { return m_MediaTrack; }
+
+private:
+ // methods
+ AP4_Result GetRtpSample(AP4_Ordinal index);
+ AP4_Result BuildRtpPacket(AP4_RtpPacket* packet,
+ AP4_DataBuffer& packet_data);
+ AP4_Result WriteImmediateRtpData(AP4_ImmediateRtpConstructor* constructor,
+ AP4_ByteStream* data_stream);
+ AP4_Result WriteSampleRtpData(AP4_SampleRtpConstructor* constructor,
+ AP4_ByteStream* data_stream);
+
+ // members
+ AP4_Track& m_HintTrack;
+ AP4_Track* m_MediaTrack;
+ AP4_UI32 m_MediaTimeScale;
+ AP4_Sample m_CurrentHintSample;
+ AP4_RtpSampleData* m_RtpSampleData;
+ AP4_UI32 m_Ssrc;
+ AP4_Ordinal m_SampleIndex;
+ AP4_Ordinal m_PacketIndex;
+ AP4_UI16 m_RtpSequenceStart;
+ AP4_TimeStamp m_RtpTimeStampStart;
+ AP4_UI32 m_RtpTimeScale;
+};
+
+#endif // _AP4_HINT_TRACK_READER_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HmhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HmhdAtom.cpp
new file mode 100644
index 000000000..cecac40da
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HmhdAtom.cpp
@@ -0,0 +1,93 @@
+/*****************************************************************
+|
+| AP4 - hmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4HmhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_HmhdAtom::AP4_HmhdAtom
++---------------------------------------------------------------------*/
+AP4_HmhdAtom::AP4_HmhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_HMHD, size, true, stream)
+{
+ stream.ReadUI16(m_MaxPduSize);
+ stream.ReadUI16(m_AvgPduSize);
+ stream.ReadUI32(m_MaxBitrate);
+ stream.ReadUI32(m_AvgBitrate);
+ stream.ReadUI32(m_Reserved);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HmhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HmhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // max pdu size
+ result = stream.WriteUI16(m_MaxPduSize);
+ if (AP4_FAILED(result)) return result;
+
+ // avg pdu size
+ result = stream.WriteUI16(m_AvgPduSize);
+ if (AP4_FAILED(result)) return result;
+
+ // max bitrate
+ result = stream.WriteUI32(m_MaxBitrate);
+ if (AP4_FAILED(result)) return result;
+
+ // avg bitrate
+ result = stream.WriteUI32(m_AvgBitrate);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved
+ result = stream.WriteUI32(m_Reserved);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HmhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HmhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("max_pdu_size", m_MaxPduSize);
+ inspector.AddField("avg_pdu_size", m_AvgPduSize);
+ inspector.AddField("max_bitrate", m_MaxBitrate);
+ inspector.AddField("avg_bitrate", m_AvgBitrate);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HmhdAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HmhdAtom.h
new file mode 100644
index 000000000..a645dd3cc
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4HmhdAtom.h
@@ -0,0 +1,59 @@
+/*****************************************************************
+|
+| AP4 - hmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_HMHD_ATOM_H_
+#define _AP4_HMHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_HmhdAtom
++---------------------------------------------------------------------*/
+class AP4_HmhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_HmhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI16 m_MaxPduSize;
+ AP4_UI16 m_AvgPduSize;
+ AP4_UI32 m_MaxBitrate;
+ AP4_UI32 m_AvgBitrate;
+ AP4_UI32 m_Reserved;
+};
+
+#endif // _AP4_HMHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.cpp
new file mode 100644
index 000000000..d34398ac6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.cpp
@@ -0,0 +1,96 @@
+/*****************************************************************
+|
+| AP4 - iKMS Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4IkmsAtom.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::AP4_IkmsAtom
++---------------------------------------------------------------------*/
+AP4_IkmsAtom::AP4_IkmsAtom(const char* kms_uri) :
+ AP4_Atom(AP4_ATOM_TYPE_IKMS, AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_KmsUri(kms_uri)
+{
+ m_Size += m_KmsUri.length()+1;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::AP4_IkmsAtom
++---------------------------------------------------------------------*/
+AP4_IkmsAtom::AP4_IkmsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_IKMS, size, true, stream)
+{
+ AP4_Size string_size = size-AP4_FULL_ATOM_HEADER_SIZE;
+ if (string_size) {
+ char* str = new char[string_size];
+ stream.Read(str, string_size);
+ str[string_size-1] = '\0'; // force null-termination
+ m_KmsUri = str;
+ delete[] str;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::Clone
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_IkmsAtom::Clone()
+{
+ return new AP4_IkmsAtom(m_KmsUri.c_str());
+}
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IkmsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // kms uri
+ AP4_Result result = stream.Write(m_KmsUri.c_str(), m_KmsUri.length()+1);
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_FULL_ATOM_HEADER_SIZE+m_KmsUri.length()+1);
+ while (padding--) stream.WriteUI08(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IkmsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("kms_uri", m_KmsUri.c_str());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.h
new file mode 100644
index 000000000..7ff6efb40
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IkmsAtom.h
@@ -0,0 +1,60 @@
+/*****************************************************************
+|
+| AP4 - iKMS Atom
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_IKMS_ATOM_H_
+#define _AP4_IKMS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom
++---------------------------------------------------------------------*/
+class AP4_IkmsAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_IkmsAtom(const char* kms_uri);
+ AP4_IkmsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Atom* Clone();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ const AP4_String& GetKmsUri() { return m_KmsUri; }
+
+private:
+ // members
+ AP4_String m_KmsUri;
+};
+
+#endif // _AP4_IKMS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Interfaces.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Interfaces.h
new file mode 100644
index 000000000..8b505e93c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Interfaces.h
@@ -0,0 +1,68 @@
+/*****************************************************************
+|
+| AP4 - Common Interfaces
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_INTERFACES_H_
+#define _AP4_INTERFACES_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define AP4_RELEASE(o) do { if (o) (o)->Release(); (o) = NULL; } while (0)
+#define AP4_ADD_REFERENCE(o) do { if (o) (o)->AddReference(); } while (0)
+
+/*----------------------------------------------------------------------
+| AP4_Exception
++---------------------------------------------------------------------*/
+class AP4_Exception
+{
+public:
+ // methods
+ AP4_Exception(AP4_Result error) : m_Error(error) {}
+
+ // members
+ AP4_Result m_Error;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Referenceable
++---------------------------------------------------------------------*/
+class AP4_Referenceable
+{
+ public:
+ // methods
+ virtual ~AP4_Referenceable() {}
+ virtual void AddReference() = 0;
+ virtual void Release() = 0;
+};
+
+#endif // _AP4_INTERFACES_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.cpp
new file mode 100644
index 000000000..c40ca3664
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.cpp
@@ -0,0 +1,106 @@
+/*****************************************************************
+|
+| AP4 - iSFM Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Utils.h"
+#include "Ap4IsfmAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::AP4_IsfmAtom
++---------------------------------------------------------------------*/
+AP4_IsfmAtom::AP4_IsfmAtom(bool selective_encryption,
+ AP4_UI08 key_length_indicator,
+ AP4_UI08 iv_length) :
+ AP4_Atom(AP4_ATOM_TYPE_ISFM, AP4_FULL_ATOM_HEADER_SIZE+3, true),
+ m_SelectiveEncryption(selective_encryption),
+ m_KeyIndicatorLength(key_length_indicator),
+ m_IvLength(iv_length)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::AP4_IsfmAtom
++---------------------------------------------------------------------*/
+AP4_IsfmAtom::AP4_IsfmAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_ISFM, size, true, stream)
+{
+ AP4_UI08 s;
+ stream.ReadUI08(s);
+ m_SelectiveEncryption = ((s&1) != 0);
+ stream.ReadUI08(m_KeyIndicatorLength);
+ stream.ReadUI08(m_IvLength);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::Clone
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_IsfmAtom::Clone()
+{
+ return new AP4_IsfmAtom(m_SelectiveEncryption,
+ m_KeyIndicatorLength,
+ m_IvLength);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsfmAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // selective encryption
+ result = stream.WriteUI08(m_SelectiveEncryption ? 1 : 0);
+ if (AP4_FAILED(result)) return result;
+
+ // key indicator length
+ result = stream.WriteUI08(m_KeyIndicatorLength);
+ if (AP4_FAILED(result)) return result;
+
+ // IV length
+ result = stream.WriteUI08(m_IvLength);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsfmAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("selective_encryption", m_SelectiveEncryption);
+ inspector.AddField("key_indicator_length", m_KeyIndicatorLength);
+ inspector.AddField("IV_length", m_IvLength);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.h
new file mode 100644
index 000000000..fd07277f2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsfmAtom.h
@@ -0,0 +1,66 @@
+/*****************************************************************
+|
+| AP4 - iSFM Atom
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_ISFM_ATOM_H_
+#define _AP4_ISFM_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom
++---------------------------------------------------------------------*/
+class AP4_IsfmAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_IsfmAtom(bool m_SelectiveEncryption,
+ AP4_UI08 m_KeyIndicatorLength,
+ AP4_UI08 m_IvLength);
+ AP4_IsfmAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Atom* Clone();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ bool GetSelectiveEncryption() { return m_SelectiveEncryption; }
+ AP4_UI08 GetKeyIndicatorLength() { return m_KeyIndicatorLength; }
+ AP4_UI08 GetIvLength() { return m_IvLength; }
+
+private:
+ // members
+ bool m_SelectiveEncryption;
+ AP4_UI08 m_KeyIndicatorLength;
+ AP4_UI08 m_IvLength;
+};
+
+#endif // _AP4_ISFM_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.cpp
new file mode 100644
index 000000000..02db0fc0b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.cpp
@@ -0,0 +1,716 @@
+/*****************************************************************
+|
+| AP4 - Sample Description Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4IsmaCryp.h"
+#include "Ap4SchmAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4Sample.h"
+#include "Ap4StreamCipher.h"
+#include "Ap4IsfmAtom.h"
+#include "Ap4FrmaAtom.h"
+#include "Ap4IkmsAtom.h"
+#include "Ap4IsfmAtom.h"
+#include "Ap4Utils.h"
+#include "Ap4TrakAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_EncaSampleEntry::AP4_EncaSampleEntry
++---------------------------------------------------------------------*/
+AP4_EncaSampleEntry::AP4_EncaSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor) :
+AP4_AudioSampleEntry(AP4_ATOM_TYPE_ENCA,
+ descriptor,
+ sample_rate,
+ sample_size,
+ channel_count)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncaSampleEntry::AP4_EncaSampleEntry
++---------------------------------------------------------------------*/
+AP4_EncaSampleEntry::AP4_EncaSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+AP4_AudioSampleEntry(AP4_ATOM_TYPE_ENCA, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncaSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_EncaSampleEntry::ToSampleDescription()
+{
+ // get the original sample format
+ AP4_FrmaAtom* frma = (AP4_FrmaAtom*)FindChild("sinf/frma");
+
+ // get the scheme info
+ AP4_SchmAtom* schm = (AP4_SchmAtom*)FindChild("sinf/schm");
+ if (schm == NULL) return NULL;
+
+ // get the sample description for the original sample entry
+ AP4_MpegAudioSampleDescription* original_sample_description =
+ (AP4_MpegAudioSampleDescription*)
+ AP4_AudioSampleEntry::ToSampleDescription();
+
+ // get the schi atom
+ AP4_ContainerAtom* schi;
+ schi = static_cast<AP4_ContainerAtom*>(FindChild("sinf/schi"));
+
+ // create the sample description
+ return new AP4_IsmaCrypSampleDescription(
+ original_sample_description,
+ frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4A,
+ schm->GetSchemeType(),
+ schm->GetSchemeVersion(),
+ schm->GetSchemeUri().c_str(),
+ schi);
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncvSampleEntry::AP4_EncaSampleEntry
++---------------------------------------------------------------------*/
+AP4_EncvSampleEntry::AP4_EncvSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_ENCV,
+ descriptor,
+ width,
+ height,
+ depth,
+ compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncvSampleEntry::AP4_EncvSampleEntry
++---------------------------------------------------------------------*/
+AP4_EncvSampleEntry::AP4_EncvSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_ENCV, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncvSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_EncvSampleEntry::ToSampleDescription()
+{
+ // get the original sample format
+ AP4_FrmaAtom* frma = (AP4_FrmaAtom*)FindChild("sinf/frma");
+
+ // get the scheme info
+ AP4_SchmAtom* schm = (AP4_SchmAtom*)FindChild("sinf/schm");
+ if (schm == NULL) return NULL;
+
+ // get the sample description for the original sample entry
+ AP4_MpegVideoSampleDescription* original_sample_description =
+ (AP4_MpegVideoSampleDescription*)
+ AP4_VisualSampleEntry::ToSampleDescription();
+
+ // get the schi atom
+ AP4_ContainerAtom* schi;
+ schi = static_cast<AP4_ContainerAtom*>(FindChild("sinf/schi"));
+
+ // create the sample description
+ return new AP4_IsmaCrypSampleDescription(
+ original_sample_description,
+ frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4V,
+ schm->GetSchemeType(),
+ schm->GetSchemeVersion(),
+ schm->GetSchemeUri().c_str(),
+ schi);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSampleDescription::AP4_IsmaCrypSampleDescription
++---------------------------------------------------------------------*/
+AP4_IsmaCrypSampleDescription::AP4_IsmaCrypSampleDescription(
+ AP4_MpegSampleDescription* original_sample_description,
+ AP4_UI32 original_format,
+ AP4_UI32 scheme_type,
+ AP4_UI32 scheme_version,
+ const char* scheme_uri,
+ AP4_ContainerAtom* schi) :
+ AP4_SampleDescription(TYPE_ISMACRYP),
+ m_OriginalSampleDescription(original_sample_description),
+ m_OriginalFormat(original_format),
+ m_SchemeType(scheme_type),
+ m_SchemeVersion(scheme_version),
+ m_SchemeUri(scheme_uri)
+{
+ m_SchemeInfo = new AP4_IsmaCrypSchemeInfo(schi);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSampleDescription::~AP4_IsmaCrypSampleDescription
++---------------------------------------------------------------------*/
+AP4_IsmaCrypSampleDescription::~AP4_IsmaCrypSampleDescription()
+{
+ delete m_SchemeInfo;
+ delete m_OriginalSampleDescription;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_IsmaCrypSampleDescription::ToAtom() const
+{
+ // TODO: not implemented yet
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSchemeInfo::AP4_IsmaCrypSchemeInfo
++---------------------------------------------------------------------*/
+AP4_IsmaCrypSchemeInfo::AP4_IsmaCrypSchemeInfo(AP4_ContainerAtom* schi) :
+ m_SchiAtom(AP4_ATOM_TYPE_SCHI)
+{
+ if (schi) {
+ AP4_List<AP4_Atom>& children = schi->GetChildren();
+ AP4_List<AP4_Atom>::Item* child_item = children.FirstItem();
+ while (child_item) {
+ AP4_Atom* child_atom = child_item->GetData();
+ AP4_Atom* clone = child_atom->Clone();
+ if (clone) m_SchiAtom.AddChild(clone);
+ child_item = child_item->GetNext();
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypCipher::AP4_IsmaCipher
++---------------------------------------------------------------------*/
+AP4_IsmaCipher::AP4_IsmaCipher(const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_Size iv_length,
+ AP4_Size key_indicator_length,
+ bool selective_encryption) :
+ m_IvLength(iv_length),
+ m_KeyIndicatorLength(key_indicator_length),
+ m_SelectiveEncryption(selective_encryption)
+{
+ // NOTE: we do not handle key indicators yey, so there is only one key.
+
+ // left-align the salt
+ unsigned char salt_128[AP4_ISMACRYP_IAEC_KEY_LENGTH];
+ for (unsigned int i=0; i<8; i++) {
+ salt_128[i] = salt[i];
+ }
+ for (unsigned int i=0; i<8; i++) {
+ salt_128[8+i] = 0;
+ }
+
+ // create a cipher
+ m_Cipher = new AP4_StreamCipher(key, salt_128);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCipher::~AP4_IsmaCipher
++---------------------------------------------------------------------*/
+AP4_IsmaCipher::~AP4_IsmaCipher()
+{
+ delete m_Cipher;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCipher::DecryptSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaCipher::DecryptSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out)
+{
+ bool is_encrypted = true;
+ const unsigned char* in = data_in.GetData();
+ if (m_SelectiveEncryption) {
+ is_encrypted = ((in[0]&1)==1);
+ in++;
+ }
+
+ // get the IV (this implementation only supports un to 32 bits of IV)
+ // so we skip anything beyond the last 4 bytes
+ unsigned int to_read = m_IvLength;
+ if (to_read > 16 || to_read == 0) return AP4_ERROR_INVALID_FORMAT;
+ while (to_read > 4) {
+ to_read--;
+ in++;
+ }
+ AP4_UI32 iv = 0;
+ while (to_read--) {
+ iv = (iv<<8) | *in++;
+ }
+
+ // get the key indicator (we only support up to 32 bits as well)
+ to_read = m_KeyIndicatorLength;
+ if (to_read > 4 ) return AP4_ERROR_INVALID_FORMAT;
+ while (to_read > 4) {
+ to_read--;
+ in++;
+ }
+ AP4_UI32 key_indicator = 0;
+ while (to_read--) {
+ key_indicator = (key_indicator<<8) | *in++;
+ }
+ // we only support key indicator = 0 for now... (TODO)
+ if (key_indicator != 0) {
+ return AP4_FAILURE;
+ }
+
+ // process the sample data
+ unsigned int header_size = in-data_in.GetData();
+ unsigned int payload_size = data_in.GetDataSize()-header_size;
+ data_out.SetDataSize(payload_size);
+ unsigned char* out = data_out.UseData();
+ if (is_encrypted) {
+ m_Cipher->SetStreamOffset(iv);
+ m_Cipher->ProcessBuffer(in, out, payload_size);
+ } else {
+ memcpy(out, in, payload_size);
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCipher::EncryptSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaCipher::EncryptSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out,
+ AP4_Offset iv,
+ bool skip_encryption)
+{
+ // setup the buffers
+ const unsigned char* in = data_in.GetData();
+ data_out.SetDataSize(data_in.GetDataSize()+4);
+ unsigned char* out = data_out.UseData();
+
+ // IV on 4 bytes
+ AP4_BytesFromUInt32BE(out, iv);
+ out += 4;
+
+ // encrypt the payload
+ m_Cipher->SetStreamOffset(iv);
+ m_Cipher->ProcessBuffer(in, out, data_in.GetDataSize());
+
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter
++---------------------------------------------------------------------*/
+class AP4_IsmaTrackDecrypter : public AP4_Processor::TrackHandler {
+public:
+ // constructor
+ AP4_IsmaTrackDecrypter(const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_IsmaCrypSampleDescription* sample_description,
+ AP4_SampleEntry* sample_entry);
+ virtual ~AP4_IsmaTrackDecrypter();
+
+ // methods
+ virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample);
+ virtual AP4_Result ProcessTrack();
+ virtual AP4_Result ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out);
+
+private:
+ // members
+ AP4_IsfmAtom* m_CipherParams;
+ AP4_IsmaCipher* m_Cipher;
+ AP4_SampleEntry* m_SampleEntry;
+ AP4_UI32 m_OriginalFormat;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter::AP4_IsmaTrackDecrypter
++---------------------------------------------------------------------*/
+AP4_IsmaTrackDecrypter::AP4_IsmaTrackDecrypter(
+ const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_IsmaCrypSampleDescription* sample_description,
+ AP4_SampleEntry* sample_entry) :
+ m_SampleEntry(sample_entry)
+{
+ // get the cipher params
+ m_CipherParams = (AP4_IsfmAtom*)sample_description->GetSchemeInfo()->GetSchiAtom().FindChild("iSFM");
+
+ // instantiate the cipher
+ m_Cipher = new AP4_IsmaCipher(key, salt,
+ m_CipherParams->GetIvLength(),
+ m_CipherParams->GetKeyIndicatorLength(),
+ m_CipherParams->GetSelectiveEncryption());
+
+ // get the sample entry details
+ m_OriginalFormat = sample_description->GetOriginalFormat();
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter::~AP4_IsmaTrackDecrypter
++---------------------------------------------------------------------*/
+AP4_IsmaTrackDecrypter::~AP4_IsmaTrackDecrypter()
+{
+ delete m_Cipher;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter::GetProcessedSampleSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_IsmaTrackDecrypter::GetProcessedSampleSize(AP4_Sample& sample)
+{
+ AP4_Size isma_header_size =
+ m_CipherParams->GetKeyIndicatorLength() +
+ m_CipherParams->GetIvLength();
+ if (m_CipherParams->GetSelectiveEncryption()) {
+ isma_header_size++;
+ }
+ return sample.GetSize()-isma_header_size;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter::ProcessTrack
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaTrackDecrypter::ProcessTrack()
+{
+ m_SampleEntry->SetType(m_OriginalFormat);
+ m_SampleEntry->DeleteChild(AP4_ATOM_TYPE_SINF);
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaDecrypter::ProcessSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaTrackDecrypter::ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out)
+{
+ return m_Cipher->DecryptSample(data_in, data_out);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaDecryptingProcessor:CreateTrackHandler
++---------------------------------------------------------------------*/
+AP4_Processor::TrackHandler*
+AP4_IsmaDecryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
+{
+ // find the stsd atom
+ AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
+ trak->FindChild("mdia/minf/stbl/stsd"));
+
+ // avoid tracks with no stsd atom (should not happen)
+ if (stsd == NULL) return NULL;
+
+ // we only look at the first sample description
+ AP4_SampleDescription* desc = stsd->GetSampleDescription(0);
+ AP4_SampleEntry* entry = stsd->GetSampleEntry(0);
+ if (desc == NULL || entry == NULL) return NULL;
+ if (desc->GetType() == AP4_SampleDescription::TYPE_ISMACRYP) {
+ // create a handler for this track
+ AP4_IsmaCrypSampleDescription* ismacryp_desc =
+ static_cast<AP4_IsmaCrypSampleDescription*>(desc);
+ if (ismacryp_desc->GetSchemeType() == AP4_ISMACRYP_SCHEME_TYPE_IAEC) {
+ const AP4_UI08* key;
+ const AP4_UI08* salt;
+ if (AP4_SUCCEEDED(m_KeyMap.GetKey(trak->GetId(), key, salt))) {
+ return new AP4_IsmaTrackDecrypter(key, salt, ismacryp_desc, entry);
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter
++---------------------------------------------------------------------*/
+class AP4_IsmaTrackEncrypter : public AP4_Processor::TrackHandler {
+public:
+ // constructor
+ AP4_IsmaTrackEncrypter(const char* kms_uri,
+ const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_SampleEntry* sample_entry,
+ AP4_UI32 format);
+ virtual ~AP4_IsmaTrackEncrypter();
+
+ // methods
+ virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample);
+ virtual AP4_Result ProcessTrack();
+ virtual AP4_Result ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out);
+
+private:
+ // members
+ AP4_String m_KmsUri;
+ AP4_IsmaCipher* m_Cipher;
+ AP4_SampleEntry* m_SampleEntry;
+ AP4_UI32 m_Format;
+ AP4_Offset m_ByteOffset;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::AP4_IsmaTrackEncrypter
++---------------------------------------------------------------------*/
+AP4_IsmaTrackEncrypter::AP4_IsmaTrackEncrypter(
+ const char* kms_uri,
+ const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_SampleEntry* sample_entry,
+ AP4_UI32 format) :
+ m_KmsUri(kms_uri),
+ m_SampleEntry(sample_entry),
+ m_Format(format),
+ m_ByteOffset(0)
+{
+ // instantiate the cipher (fixed params for now)
+ m_Cipher = new AP4_IsmaCipher(key, salt, 4, 0, false);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::~AP4_IsmaTrackEncrypter
++---------------------------------------------------------------------*/
+AP4_IsmaTrackEncrypter::~AP4_IsmaTrackEncrypter()
+{
+ delete m_Cipher;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::GetProcessedSampleSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_IsmaTrackEncrypter::GetProcessedSampleSize(AP4_Sample& sample)
+{
+ return sample.GetSize()+4; //fixed header size for now
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::ProcessTrack
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaTrackEncrypter::ProcessTrack()
+{
+ // sinf container
+ AP4_ContainerAtom* sinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_SINF);
+
+ // original format
+ AP4_FrmaAtom* frma = new AP4_FrmaAtom(m_SampleEntry->GetType());
+
+ // scheme
+ AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_ISMACRYP_SCHEME_TYPE_IAEC, 1);
+
+ // scheme info
+ AP4_ContainerAtom* schi = new AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI);
+ AP4_IkmsAtom* ikms = new AP4_IkmsAtom(m_KmsUri.c_str());
+ AP4_IsfmAtom* isfm = new AP4_IsfmAtom(false, 0, 4);
+
+ // populate the schi container
+ schi->AddChild(ikms);
+ schi->AddChild(isfm);
+
+ // populate the sinf container
+ sinf->AddChild(frma);
+ sinf->AddChild(schm);
+ sinf->AddChild(schi);
+
+ // add the sinf atom to the sample description
+ m_SampleEntry->AddChild(sinf);
+
+ // change the atom type of the sample description
+ m_SampleEntry->SetType(m_Format);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::ProcessSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaTrackEncrypter::ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out)
+{
+ AP4_Result result = m_Cipher->EncryptSample(data_in, data_out, m_ByteOffset, false);
+ if (AP4_FAILED(result)) return result;
+
+ m_ByteOffset += data_in.GetDataSize();
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaEncryptingProcessor::AP4_IsmaEncryptingProcessor
++---------------------------------------------------------------------*/
+AP4_IsmaEncryptingProcessor::AP4_IsmaEncryptingProcessor(const char* kms_uri) :
+ m_KmsUri(kms_uri)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaEncryptingProcessor:CreateTrackHandler
++---------------------------------------------------------------------*/
+AP4_Processor::TrackHandler*
+AP4_IsmaEncryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
+{
+ // find the stsd atom
+ AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
+ trak->FindChild("mdia/minf/stbl/stsd"));
+
+ // avoid tracks with no stsd atom (should not happen)
+ if (stsd == NULL) return NULL;
+
+ // only look at the first sample description
+ AP4_SampleEntry* entry = stsd->GetSampleEntry(0);
+ if (entry == NULL) return NULL;
+
+ // create a handler for this track if we have a key for it and we know
+ // how to map the type
+ const AP4_UI08* key;
+ const AP4_UI08* salt;
+ AP4_UI32 format = 0;
+ if (AP4_SUCCEEDED(m_KeyMap.GetKey(trak->GetId(), key, salt))) {
+ switch (entry->GetType()) {
+ case AP4_ATOM_TYPE_MP4A:
+ format = AP4_ATOM_TYPE_ENCA;
+ break;
+
+ case AP4_ATOM_TYPE_MP4V:
+ case AP4_ATOM_TYPE_AVC1:
+ format = AP4_ATOM_TYPE_ENCV;
+ break;
+ }
+ if (format) {
+ return new AP4_IsmaTrackEncrypter(m_KmsUri.c_str(),
+ key,
+ salt,
+ entry,
+ format);
+ }
+ }
+
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::AP4_IsmaKeyMap
++---------------------------------------------------------------------*/
+AP4_IsmaKeyMap::AP4_IsmaKeyMap()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::~AP4_IsmaKeyMap
++---------------------------------------------------------------------*/
+AP4_IsmaKeyMap::~AP4_IsmaKeyMap()
+{
+ m_KeyEntries.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::SetKey
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaKeyMap::SetKey(AP4_UI32 track_id, const AP4_UI08* key, const AP4_UI08* salt)
+{
+ KeyEntry* entry = GetEntry(track_id);
+ if (entry == NULL) {
+ m_KeyEntries.Add(new KeyEntry(track_id, key, salt));
+ } else {
+ entry->SetKey(key, salt);
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::GetKey
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaKeyMap::GetKey(AP4_UI32 track_id, const AP4_UI08*& key, const AP4_UI08*& salt)
+{
+ KeyEntry* entry = GetEntry(track_id);
+ if (entry) {
+ key = entry->m_Key;
+ salt = entry->m_Salt;
+ return AP4_SUCCESS;
+ } else {
+ return AP4_ERROR_NO_SUCH_ITEM;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::GetEntry
++---------------------------------------------------------------------*/
+AP4_IsmaKeyMap::KeyEntry*
+AP4_IsmaKeyMap::GetEntry(AP4_UI32 track_id)
+{
+ AP4_List<KeyEntry>::Item* item = m_KeyEntries.FirstItem();
+ while (item) {
+ KeyEntry* entry = (KeyEntry*)item->GetData();
+ if (entry->m_TrackId == track_id) return entry;
+ item = item->GetNext();
+ }
+
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::KeyEntry::KeyEntry
++---------------------------------------------------------------------*/
+AP4_IsmaKeyMap::KeyEntry::KeyEntry(AP4_UI32 track_id,
+ const AP4_UI08* key,
+ const AP4_UI08* salt /* = NULL */) :
+ m_TrackId(track_id)
+{
+ SetKey(key, salt);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::KeyEntry::SetKey
++---------------------------------------------------------------------*/
+void
+AP4_IsmaKeyMap::KeyEntry::SetKey(const AP4_UI08* key, const AP4_UI08* salt)
+{
+ memcpy(m_Key, key, sizeof(m_Key));
+ if (salt) {
+ memcpy(m_Salt, salt, sizeof(m_Salt));
+ } else {
+ memset(m_Salt, 0, sizeof(m_Salt));
+ }
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.h
new file mode 100644
index 000000000..fd1ac7de4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4IsmaCryp.h
@@ -0,0 +1,245 @@
+/*****************************************************************
+|
+| AP4 - Sample Description Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_ISMACRYP_H_
+#define _AP4_ISMACRYP_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4SampleEntry.h"
+#include "Ap4Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4Processor.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_StreamCipher;
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_ISMACRYP_SCHEME_TYPE_IAEC = AP4_ATOM_TYPE('i','A','E','C');
+const AP4_Size AP4_ISMACRYP_IAEC_KEY_LENGTH = 16;
+
+/*----------------------------------------------------------------------
+| AP4_EncaSampleEntry
++---------------------------------------------------------------------*/
+class AP4_EncaSampleEntry : public AP4_AudioSampleEntry
+{
+public:
+ // methods
+ AP4_EncaSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_EncaSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor);
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+};
+
+/*----------------------------------------------------------------------
+| AP4_EncvSampleEntry
++---------------------------------------------------------------------*/
+class AP4_EncvSampleEntry : public AP4_VisualSampleEntry
+{
+public:
+ // constructors
+ AP4_EncvSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_EncvSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor);
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap
++---------------------------------------------------------------------*/
+class AP4_IsmaKeyMap
+{
+public:
+ // constructors and destructor
+ AP4_IsmaKeyMap();
+ ~AP4_IsmaKeyMap();
+
+ // methods
+ AP4_Result SetKey(AP4_UI32 track_id, const AP4_UI08* key, const AP4_UI08* salt = NULL);
+ AP4_Result GetKey(AP4_UI32 track_id, const AP4_UI08*& key, const AP4_UI08*& salt);
+
+private:
+ // types
+ class KeyEntry {
+ public:
+ KeyEntry(AP4_UI32 track_id, const AP4_UI08* key, const AP4_UI08* salt = NULL);
+ void SetKey(const AP4_UI08* key, const AP4_UI08* salt);
+ AP4_Ordinal m_TrackId;
+ AP4_UI08 m_Key[AP4_ISMACRYP_IAEC_KEY_LENGTH];
+ AP4_UI08 m_Salt[AP4_ISMACRYP_IAEC_KEY_LENGTH];
+ };
+
+ // methods
+ KeyEntry* GetEntry(AP4_UI32 track_id);
+
+ // members
+ AP4_List<KeyEntry> m_KeyEntries;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaSchemeInfo
++---------------------------------------------------------------------*/
+class AP4_IsmaCrypSchemeInfo
+{
+public:
+ // constructors and destructor
+ AP4_IsmaCrypSchemeInfo(AP4_ContainerAtom* schi);
+ virtual ~AP4_IsmaCrypSchemeInfo(){}
+
+ // accessors
+ AP4_ContainerAtom& GetSchiAtom() { return m_SchiAtom; }
+
+protected:
+ AP4_ContainerAtom m_SchiAtom;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSampleDescription
++---------------------------------------------------------------------*/
+class AP4_IsmaCrypSampleDescription : public AP4_SampleDescription
+{
+public:
+ // constructor and destructor
+ AP4_IsmaCrypSampleDescription(AP4_MpegSampleDescription* original_sample_description,
+ AP4_UI32 original_format,
+ AP4_UI32 scheme_type,
+ AP4_UI32 scheme_version,
+ const char* scheme_uri,
+ AP4_ContainerAtom* schi_atom);
+ ~AP4_IsmaCrypSampleDescription();
+
+ // accessors
+ AP4_MpegSampleDescription* GetOriginalSampleDescription() {
+ return m_OriginalSampleDescription;
+ }
+ AP4_UI32 GetOriginalFormat() { return m_OriginalFormat; }
+ AP4_UI32 GetSchemeType() { return m_SchemeType; }
+ AP4_UI32 GetSchemeVersion() { return m_SchemeVersion; }
+ AP4_String& GetSchemeUri() { return m_SchemeUri; }
+ AP4_IsmaCrypSchemeInfo* GetSchemeInfo() { return m_SchemeInfo; }
+
+ // implementation of abstract base class methods
+ virtual AP4_Atom* ToAtom() const;
+
+private:
+ // members
+ AP4_MpegSampleDescription* m_OriginalSampleDescription;
+ AP4_UI32 m_OriginalFormat;
+ AP4_UI32 m_SchemeType;
+ AP4_UI32 m_SchemeVersion;
+ AP4_String m_SchemeUri;
+ AP4_IsmaCrypSchemeInfo* m_SchemeInfo;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCipher
++---------------------------------------------------------------------*/
+class AP4_IsmaCipher
+{
+public:
+ // constructor and destructor
+ AP4_IsmaCipher(const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_Size iv_length,
+ AP4_Size key_indicator_length,
+ bool selective_encryption);
+ ~AP4_IsmaCipher();
+ AP4_Result EncryptSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out,
+ AP4_Offset iv,
+ bool skip_encryption);
+ AP4_Result DecryptSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out);
+
+private:
+ // members
+ AP4_StreamCipher* m_Cipher;
+ AP4_Size m_IvLength;
+ AP4_Size m_KeyIndicatorLength;
+ bool m_SelectiveEncryption;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaDecryptingProcessor
++---------------------------------------------------------------------*/
+class AP4_IsmaDecryptingProcessor : public AP4_Processor
+{
+public:
+ // accessors
+ AP4_IsmaKeyMap& GetKeyMap() { return m_KeyMap; }
+
+ // methods
+ virtual AP4_Processor::TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
+
+private:
+ // members
+ AP4_IsmaKeyMap m_KeyMap;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaEncryptingProcessor
++---------------------------------------------------------------------*/
+class AP4_IsmaEncryptingProcessor : public AP4_Processor
+{
+public:
+ // constructors and destructor
+ AP4_IsmaEncryptingProcessor(const char* kms_uri);
+
+ // accessors
+ AP4_IsmaKeyMap& GetKeyMap() { return m_KeyMap; }
+
+ // methods
+ virtual AP4_Processor::TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
+
+private:
+ // members
+ AP4_IsmaKeyMap m_KeyMap;
+ AP4_String m_KmsUri;
+};
+
+#endif // _AP4_ISMACRYP_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4List.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4List.h
new file mode 100644
index 000000000..5a722f109
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4List.h
@@ -0,0 +1,474 @@
+/*****************************************************************
+|
+| AP4 - Lists
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_LIST_H_
+#define _AP4_LIST_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| forward references
++---------------------------------------------------------------------*/
+template <typename T> class AP4_List;
+
+/*----------------------------------------------------------------------
+| AP4_List
++---------------------------------------------------------------------*/
+template <typename T>
+class AP4_List
+{
+public:
+ // types
+ class Item
+ {
+ public:
+ // types
+ class Operator
+ {
+ public:
+ // methods
+ virtual ~Operator() {}
+ virtual AP4_Result Action(T* data) const = 0;
+ };
+
+ class Finder
+ {
+ public:
+ // methods
+ virtual ~Finder() {}
+ virtual AP4_Result Test(T* data) const = 0;
+ };
+
+ // methods
+ Item(T* data) : m_Data(data), m_Next(0), m_Prev(0) {}
+ ~Item() {}
+ Item* GetNext() { return m_Next; }
+ Item* GetPrev() { return m_Prev; }
+ T* GetData() { return m_Data; }
+
+ private:
+ // members
+ T* m_Data;
+ Item* m_Next;
+ Item* m_Prev;
+
+ // friends
+ friend class AP4_List;
+ };
+
+ // methods
+ AP4_List<T>(): m_ItemCount(0), m_Head(0), m_Tail(0) {}
+ virtual ~AP4_List<T>();
+ AP4_Result Add(T* data);
+ AP4_Result Add(Item* item);
+ AP4_Result Remove(T* data);
+ AP4_Result Insert(Item* where, T* data);
+ AP4_Result Get(AP4_Ordinal idx, T*& data);
+ AP4_Result PopHead(T*& data);
+ AP4_Result Apply(const typename Item::Operator& op);
+ AP4_Result ApplyUntilFailure(const typename Item::Operator& op);
+ AP4_Result ApplyUntilSuccess(const typename Item::Operator& op);
+ AP4_Result ReverseApply(const typename Item::Operator& op);
+ AP4_Result Find(const typename Item::Finder& finder, T*& data);
+ AP4_Result ReverseFind(const typename Item::Finder& finder, T*& data);
+ AP4_Result DeleteReferences();
+ AP4_Cardinal ItemCount() { return m_ItemCount; }
+ Item* FirstItem() { return m_Head; }
+ Item* LastItem() { return m_Tail; }
+
+protected:
+ // members
+ AP4_Cardinal m_ItemCount;
+ Item* m_Head;
+ Item* m_Tail;
+
+private:
+ // these cannot be used
+ AP4_List<T>(const AP4_List<T>&);
+ AP4_List<T>& operator=(const AP4_List<T>&);
+};
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::~AP4_List<T>
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_List<T>::~AP4_List<T>()
+{
+ Item* item = m_Head;
+
+ while (item) {
+ Item* next = item->m_Next;
+ delete item;
+ item = next;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Add
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::Add(T* data)
+{
+ return Add(new Item(data));
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Add
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::Add(Item* item)
+{
+ // add element at the tail
+ if (m_Tail) {
+ item->m_Prev = m_Tail;
+ item->m_Next = NULL;
+ m_Tail->m_Next = item;
+ m_Tail = item;
+ } else {
+ m_Head = item;
+ m_Tail = item;
+ item->m_Next = NULL;
+ item->m_Prev = NULL;
+ }
+
+ // one more item in the list now
+ m_ItemCount++;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Remove
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::Remove(T* data)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ if (item->m_Data == data) {
+ // delete item
+ if (item->m_Prev) {
+ // item is not the head
+ if (item->m_Next) {
+ // item is not the tail
+ item->m_Next->m_Prev = item->m_Prev;
+ item->m_Prev->m_Next = item->m_Next;
+ } else {
+ // item is the tail
+ m_Tail = item->m_Prev;
+ m_Tail->m_Next = NULL;
+ }
+ } else {
+ // item is the head
+ m_Head = item->m_Next;
+ if (m_Head) {
+ // item is not the tail
+ m_Head->m_Prev = NULL;
+ } else {
+ // item is also the tail
+ m_Tail = NULL;
+ }
+ }
+
+ // delete the item
+ delete item;
+
+ // one less item in the list now
+ m_ItemCount--;
+
+ return AP4_SUCCESS;
+ }
+ item = item->m_Next;
+ }
+
+ return AP4_ERROR_NO_SUCH_ITEM;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Insert
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::Insert(Item* where, T* data)
+{
+ Item* item = new Item(data);
+
+ if (where == NULL) {
+ // insert as the head
+ if (m_Head) {
+ // replace the current head
+ item->m_Prev = NULL;
+ item->m_Next = m_Head;
+ m_Head->m_Prev = item;
+ m_Head = item;
+ } else {
+ // this item becomes the head and tail
+ m_Head = item;
+ m_Tail = item;
+ item->m_Next = NULL;
+ item->m_Prev = NULL;
+ }
+ } else {
+ // insert after the 'where' item
+ if (where == m_Tail) {
+ // add the item at the end
+ return Add(item);
+ } else {
+ // update the links
+ item->m_Prev = where;
+ item->m_Next = where->m_Next;
+ where->m_Next->m_Prev = item;
+ where->m_Next = item;
+ }
+ }
+
+ // one more item in the list now
+ ++m_ItemCount;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Get
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::Get(AP4_Ordinal idx, T*& data)
+{
+ Item* item = m_Head;
+
+ if (idx < m_ItemCount) {
+ while (idx--) item = item->m_Next;
+ data = item->m_Data;
+ return AP4_SUCCESS;
+ } else {
+ data = NULL;
+ return AP4_ERROR_NO_SUCH_ITEM;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::PopHead
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::PopHead(T*& data)
+{
+ // check that we have at least one item
+ if (m_Head == NULL) {
+ return AP4_ERROR_LIST_EMPTY;
+ }
+
+ // remove the item and return it
+ data = m_Head->m_Data;
+ Item* head = m_Head;
+ m_Head = m_Head->m_Next;
+ if (m_Head) {
+ m_Head->m_Prev = NULL;
+ } else {
+ m_Tail = NULL;
+ }
+
+ // delete item
+ delete head;
+
+ // one less item in the list now
+ m_ItemCount--;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Apply
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::Apply(const typename Item::Operator& op)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ op.Action(item->m_Data);
+ item = item->m_Next;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::ApplyUntilFailure
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::ApplyUntilFailure(const typename Item::Operator& op)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ AP4_Result result;
+ result = op.Action(item->m_Data);
+ if (result != AP4_SUCCESS) return result;
+ item = item->m_Next;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::ApplyUntilSuccess
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::ApplyUntilSuccess(const typename Item::Operator& op)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ AP4_Result result;
+ result = op.Action(item->m_Data);
+ if (result == AP4_SUCCESS) return AP4_SUCCESS;
+ item = item->m_Next;
+ }
+
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::ReverseApply
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::ReverseApply(const typename Item::Operator& op)
+{
+ Item* item = m_Tail;
+
+ while (item) {
+ if (op.Action(item->m_Data) != AP4_SUCCESS) {
+ return AP4_ERROR_LIST_OPERATION_ABORTED;
+ }
+ item = item->m_Prev;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Find
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::Find(const typename Item::Finder& finder, T*& data)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ if (finder.Test(item->m_Data) == AP4_SUCCESS) {
+ data = item->m_Data;
+ return AP4_SUCCESS;
+ }
+ item = item->m_Next;
+ }
+
+ data = NULL;
+ return AP4_ERROR_NO_SUCH_ITEM;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::ReverseFind
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::ReverseFind(const typename Item::Finder& finder, T*& data)
+{
+ Item* item = m_Tail;
+
+ while (item) {
+ if (finder.Test(item->m_Data) == AP4_SUCCESS) {
+ data = item->m_Data;
+ return AP4_SUCCESS;
+ }
+ item = item->m_Prev;
+ }
+
+ data = NULL;
+ return AP4_ERROR_NO_SUCH_ITEM;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::DeleteReferences
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::DeleteReferences()
+{
+ Item* item = m_Head;
+
+ while (item) {
+ Item* next = item->m_Next;
+ delete item->m_Data;
+ delete item;
+ item = next;
+ }
+
+ // no more items
+ m_Head = m_Tail = NULL;
+ m_ItemCount = 0;
+
+ return AP4_SUCCESS;
+}
+
+#endif // _AP4_LIST_H_
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MdhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MdhdAtom.cpp
new file mode 100644
index 000000000..2e4c2bf50
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MdhdAtom.cpp
@@ -0,0 +1,172 @@
+/*****************************************************************
+|
+| AP4 - mdhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MdhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::AP4_MdhdAtom
++---------------------------------------------------------------------*/
+AP4_MdhdAtom::AP4_MdhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI64 duration,
+ const char* language) :
+ AP4_Atom(AP4_ATOM_TYPE_MDHD, 20+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CreationTime(creation_time),
+ m_ModificationTime(modification_time),
+ m_TimeScale(time_scale),
+ m_Duration(duration)
+{
+ m_Language[0] = language[0];
+ m_Language[1] = language[1];
+ m_Language[2] = language[2];
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::AP4_MdhdAtom
++---------------------------------------------------------------------*/
+AP4_MdhdAtom::AP4_MdhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_MDHD, size, true, stream),
+ m_CreationTime(0),
+ m_ModificationTime(0),
+ m_TimeScale(0),
+ m_Duration(0)
+{
+ m_Language[0] = 0;
+ m_Language[1] = 0;
+ m_Language[2] = 0;
+
+ if (m_Version == 0) {
+ AP4_UI32 tmp = 0;
+ stream.ReadUI32(tmp); m_CreationTime = tmp;
+ stream.ReadUI32(tmp); m_ModificationTime = tmp;
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI32(tmp); m_Duration = tmp;
+ } else if (m_Version == 1) {
+ stream.ReadUI64(m_CreationTime);
+ stream.ReadUI64(m_ModificationTime);
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI64(m_Duration);
+ } else {
+ // TODO
+ }
+
+ unsigned char lang[2];
+ stream.Read(lang, 2, NULL);
+ char l0 = ((lang[0]>>2)&0x1F);
+ char l1 = (((lang[0]&0x3)<<3) | ((lang[1]>>5)&0x7));
+ char l2 = ((lang[1]&0x1F));
+ if (l0) {
+ m_Language[0] = l0+0x60;
+ }
+ if (l1) {
+ m_Language[1] = l1+0x60;
+ }
+ if (l2) {
+ m_Language[2] = l2+0x60;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MdhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ if (m_Version == 0) {
+ // we only deal with version 0 for the moment
+ result = stream.WriteUI32((AP4_UI32)m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else if (m_Version == 1) {
+ result = stream.WriteUI64(m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ // TODO
+ }
+
+ // write the language
+ AP4_UI08 l0 = (m_Language[0]==0)?0:(m_Language[0]-0x60);
+ AP4_UI08 l1 = (m_Language[1]==0)?0:(m_Language[1]-0x60);
+ AP4_UI08 l2 = (m_Language[2]==0)?0:(m_Language[2]-0x60);
+ result = stream.WriteUI08(l0<<2 | l1>>3);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI08(l1<<5 | l2);
+ if (AP4_FAILED(result)) return result;
+
+ // pre-defined
+ return stream.WriteUI16(0);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_MdhdAtom::GetDurationMs()
+{
+ return AP4_DurationMsFromUnits(m_Duration, m_TimeScale);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MdhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("timescale", m_TimeScale);
+ inspector.AddField("duration", (AP4_UI32)m_Duration); // TODO
+ inspector.AddField("duration(ms)", GetDurationMs());
+ char language[4];
+ AP4_StringFormat(language, sizeof(language),
+ "%c%c%c",
+ m_Language[0] ? m_Language[0]:'-',
+ m_Language[1] ? m_Language[1]:'-',
+ m_Language[2] ? m_Language[2]:'-');
+ inspector.AddField("language", (const char*)language);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MdhdAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MdhdAtom.h
new file mode 100644
index 000000000..d5e0bba63
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MdhdAtom.h
@@ -0,0 +1,76 @@
+/*****************************************************************
+|
+| AP4 - mdhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MDHD_ATOM_H_
+#define _AP4_MDHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_MDHD_DEFAULT_GENERIC_TIMESCALE = 1000;
+const AP4_UI32 AP4_MDHD_DEFAULT_VIDEO_TIMESCALE = 90000;
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom
++---------------------------------------------------------------------*/
+class AP4_MdhdAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_MdhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI64 duration,
+ const char* language);
+ AP4_MdhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_UI32 GetDurationMs();
+ AP4_UI64 GetDuration() { return m_Duration; }
+ AP4_UI32 GetTimeScale() { return m_TimeScale; }
+ AP4_String GetLanguage() { return AP4_String(m_Language, 3); }
+
+ private:
+ // members
+ AP4_UI64 m_CreationTime;
+ AP4_UI64 m_ModificationTime;
+ AP4_UI32 m_TimeScale;
+ AP4_UI64 m_Duration;
+ char m_Language[3];
+};
+
+#endif // _AP4_MDHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.cpp
new file mode 100644
index 000000000..408248dd6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.cpp
@@ -0,0 +1,196 @@
+/*****************************************************************
+|
+| AP4 - moov Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4DcomAtom.h"
+#include "Ap4CmvdAtom.h"
+#include "..\..\..\..\..\..\zlib\zlib.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtomCollector
++---------------------------------------------------------------------*/
+class AP4_TrakAtomCollector : public AP4_List<AP4_Atom>::Item::Operator
+{
+public:
+ AP4_TrakAtomCollector(AP4_List<AP4_TrakAtom>* track_atoms) :
+ m_TrakAtoms(track_atoms) {}
+
+ AP4_Result Action(AP4_Atom* atom) const {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
+ AP4_TrakAtom* trak = dynamic_cast<AP4_TrakAtom*>(atom);
+ if (trak) {
+ m_TrakAtoms->Add(trak);
+ }
+ }
+ return AP4_SUCCESS;
+ }
+
+private:
+ AP4_List<AP4_TrakAtom>* m_TrakAtoms;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::AP4_MoovAtom
++---------------------------------------------------------------------*/
+AP4_MoovAtom::AP4_MoovAtom() :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_MOOV),
+ m_TimeScale(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::AP4_MoovAtom
++---------------------------------------------------------------------*/
+AP4_MoovAtom::AP4_MoovAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_MOOV, size, false, stream, atom_factory),
+ m_TimeScale(0)
+{
+ if(AP4_ContainerAtom* cmov = dynamic_cast<AP4_ContainerAtom*>(GetChild(AP4_ATOM_TYPE_CMOV)))
+ {
+ AP4_DcomAtom* dcom = dynamic_cast<AP4_DcomAtom*>(cmov->GetChild(AP4_ATOM_TYPE_DCOM));
+ AP4_CmvdAtom* cmvd = dynamic_cast<AP4_CmvdAtom*>(cmov->GetChild(AP4_ATOM_TYPE_CMVD));
+
+ if(dcom && dcom->GetCompressorSubType() == AP4_ATOM_TYPE('z','l','i','b') && cmvd)
+ {
+ AP4_DataBuffer* data = cmvd->GetData();
+
+ z_stream d_stream;
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+
+ int res;
+
+ if(Z_OK == (res = inflateInit(&d_stream)))
+ {
+ d_stream.next_in = data->UseData();
+ d_stream.avail_in = data->GetDataSize();
+
+ unsigned char* dst = NULL;
+ int n = 0;
+
+ do
+ {
+ dst = (unsigned char*)realloc(dst, ++n*1000);
+ d_stream.next_out = &dst[(n-1)*1000];
+ d_stream.avail_out = 1000;
+
+ if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res)
+ {
+ free(dst);
+ dst = NULL;
+ break;
+ }
+ }
+ while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
+
+ inflateEnd(&d_stream);
+
+ if(dst)
+ {
+ AP4_ByteStream* s = new AP4_MemoryByteStream(dst, d_stream.total_out);
+ ReadChildren(atom_factory, *s, d_stream.total_out);
+ s->Release();
+ free(dst);
+ }
+
+ if(AP4_MoovAtom* moov = dynamic_cast<AP4_MoovAtom*>(GetChild(AP4_ATOM_TYPE_MOOV)))
+ {
+ AP4_List<AP4_Atom> Children;
+
+ for(AP4_List<AP4_Atom>::Item* item = moov->GetChildren().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ Children.Add(item->GetData());
+ }
+
+ for(AP4_List<AP4_Atom>::Item* item = Children.FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ AP4_Atom* atom = item->GetData();
+ atom->Detach();
+ atom->SetParent(this);
+ m_Children.Add(atom);
+ }
+
+ moov->Detach();
+ delete moov;
+ }
+ }
+ }
+ }
+
+ // collect all trak atoms
+ m_Children.Apply(AP4_TrakAtomCollector(&m_TrakAtoms));
+}
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::OnChildAdded
++---------------------------------------------------------------------*/
+void
+AP4_MoovAtom::OnChildAdded(AP4_Atom* atom)
+{
+ // keep the atom in the list of trak atoms
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
+ AP4_TrakAtom* trak = dynamic_cast<AP4_TrakAtom*>(atom);
+ if (trak) {
+ m_TrakAtoms.Add(trak);
+ }
+ }
+
+ // call the base class implementation
+ AP4_ContainerAtom::OnChildAdded(atom);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::OnChildRemoved
++---------------------------------------------------------------------*/
+void
+AP4_MoovAtom::OnChildRemoved(AP4_Atom* atom)
+{
+ // remove the atom from the list of trak atoms
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
+ AP4_TrakAtom* trak = dynamic_cast<AP4_TrakAtom*>(atom);
+ if (trak) {
+ m_TrakAtoms.Remove(trak);
+ }
+ }
+
+ // call the base class implementation
+ AP4_ContainerAtom::OnChildRemoved(atom);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.h
new file mode 100644
index 000000000..215423173
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MoovAtom.h
@@ -0,0 +1,71 @@
+/*****************************************************************
+|
+| AP4 - moov Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MOOV_ATOM_H_
+#define _AP4_MOOV_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom
++---------------------------------------------------------------------*/
+class AP4_MoovAtom : public AP4_ContainerAtom
+{
+public:
+ // methods
+ AP4_MoovAtom();
+ AP4_MoovAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_List<AP4_TrakAtom>& GetTrakAtoms() {
+ return m_TrakAtoms;
+ }
+ AP4_UI32 GetTimeScale() {
+ return m_TimeScale;
+ }
+
+ // AP4_AtomParent methods
+ void OnChildAdded(AP4_Atom* atom);
+ void OnChildRemoved(AP4_Atom* atom);
+
+private:
+ // members
+ AP4_List<AP4_TrakAtom> m_TrakAtoms;
+ AP4_UI32 m_TimeScale;
+};
+
+#endif // _AP4_MOOV_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.cpp
new file mode 100644
index 000000000..51b17b780
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.cpp
@@ -0,0 +1,234 @@
+/*****************************************************************
+|
+| AP4 - Movie
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4File.h"
+#include "Ap4Atom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Movie.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrackFinderById
++---------------------------------------------------------------------*/
+class AP4_TrackFinderById : public AP4_List<AP4_Track>::Item::Finder
+{
+public:
+ AP4_TrackFinderById(AP4_UI32 track_id) : m_TrackId(track_id) {}
+ AP4_Result Test(AP4_Track* track) const {
+ return track->GetId() == m_TrackId ? AP4_SUCCESS : AP4_FAILURE;
+ }
+private:
+ AP4_UI32 m_TrackId;
+};
+
+/*----------------------------------------------------------------------
+| AP4_TrackFinderByType
++---------------------------------------------------------------------*/
+class AP4_TrackFinderByType : public AP4_List<AP4_Track>::Item::Finder
+{
+public:
+ AP4_TrackFinderByType(AP4_Track::Type type, AP4_Ordinal index = 0) :
+ m_Type(type), m_Index(index) {}
+ AP4_Result Test(AP4_Track* track) const {
+ if (track->GetType() == m_Type && m_Index-- == 0) {
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+private:
+ AP4_Track::Type m_Type;
+ mutable AP4_Ordinal m_Index;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Movie::AP4_Movie
++---------------------------------------------------------------------*/
+AP4_Movie::AP4_Movie(AP4_UI32 time_scale)
+{
+ m_MoovAtom = new AP4_MoovAtom();
+ m_MvhdAtom = new AP4_MvhdAtom(0, 0,
+ time_scale,
+ 0,
+ 0x00010000,
+ 0x0100);
+ m_MoovAtom->AddChild(m_MvhdAtom);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::AP4_Moovie
++---------------------------------------------------------------------*/
+AP4_Movie::AP4_Movie(AP4_MoovAtom* moov, AP4_ByteStream& mdat) :
+ m_MoovAtom(moov)
+{
+ // ignore null atoms
+ if (moov == NULL) return;
+
+ // get the time scale
+ AP4_UI32 time_scale;
+ m_MvhdAtom = dynamic_cast<AP4_MvhdAtom*>(moov->GetChild(AP4_ATOM_TYPE_MVHD));
+ if (m_MvhdAtom) {
+ time_scale = m_MvhdAtom->GetTimeScale();
+ } else {
+ time_scale = 0;
+ }
+
+ // get all tracks
+ AP4_List<AP4_TrakAtom>* trak_atoms;
+ trak_atoms = &moov->GetTrakAtoms();
+ AP4_List<AP4_TrakAtom>::Item* item = trak_atoms->FirstItem();
+ while (item) {
+ AP4_Track* track = new AP4_Track(*item->GetData(),
+ mdat,
+ time_scale);
+ m_Tracks.Add(track);
+ item = item->GetNext();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::~AP4_Movie
++---------------------------------------------------------------------*/
+AP4_Movie::~AP4_Movie()
+{
+ m_Tracks.DeleteReferences();
+ delete m_MoovAtom;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Movie::Inspect(AP4_AtomInspector& inspector)
+{
+ // dump the moov atom
+ return m_MoovAtom->Inspect(inspector);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetTrack
++---------------------------------------------------------------------*/
+AP4_Track*
+AP4_Movie::GetTrack(AP4_UI32 track_id)
+{
+ AP4_Track* track = NULL;
+ if (AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderById(track_id), track))) {
+ return track;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetTrack
++---------------------------------------------------------------------*/
+AP4_Track*
+AP4_Movie::GetTrack(AP4_Track::Type track_type, AP4_Ordinal index)
+{
+ AP4_Track* track = NULL;
+ if (AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderByType(track_type, index), track))) {
+ return track;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::AddTrack
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Movie::AddTrack(AP4_Track* track)
+{
+ // assign an ID to the track unless it already has one
+ if (track->GetId() == 0) {
+ track->SetId(m_Tracks.ItemCount()+1);
+ }
+
+ // if we don't have a time scale, use the one from the track
+ if (m_MvhdAtom->GetTimeScale() == 0) {
+ m_MvhdAtom->SetTimeScale(track->GetMediaTimeScale());
+ }
+
+ // adjust the parent time scale of the track
+ track->SetMovieTimeScale(m_MvhdAtom->GetTimeScale());
+
+ // update the movie duration
+ if (m_MvhdAtom->GetDuration() < track->GetDuration()) {
+ m_MvhdAtom->SetDuration(track->GetDuration());
+ }
+
+ // attach the track as a child
+ m_MoovAtom->AddChild(track->GetTrakAtom());
+ m_Tracks.Add(track);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetTimeScale
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Movie::GetTimeScale()
+{
+ if (m_MvhdAtom) {
+ return m_MvhdAtom->GetTimeScale();
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetDuration
++---------------------------------------------------------------------*/
+AP4_UI64
+AP4_Movie::GetDuration()
+{
+ if (m_MvhdAtom) {
+ return m_MvhdAtom->GetDuration();
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_Duration
+AP4_Movie::GetDurationMs()
+{
+ if (m_MvhdAtom) {
+ return m_MvhdAtom->GetDurationMs();
+ } else {
+ return 0;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.h
new file mode 100644
index 000000000..fbd338b66
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Movie.h
@@ -0,0 +1,70 @@
+/*****************************************************************
+|
+| AP4 - Movie
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MOVIE_H_
+#define _AP4_MOVIE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4Track.h"
+#include "Ap4List.h"
+#include "Ap4ByteStream.h"
+
+/*----------------------------------------------------------------------
+| AP4_Movie
++---------------------------------------------------------------------*/
+class AP4_Movie {
+public:
+ // methods
+ AP4_Movie(AP4_UI32 time_scale = 0);
+ AP4_Movie(AP4_MoovAtom* moov, AP4_ByteStream& mdat);
+ virtual ~AP4_Movie();
+ AP4_Result Inspect(AP4_AtomInspector& inspector);
+
+ AP4_MoovAtom* GetMoovAtom() { return m_MoovAtom;}
+ AP4_MvhdAtom* GetMvhdAtom() { return m_MvhdAtom;}
+ AP4_List<AP4_Track>& GetTracks() { return m_Tracks; }
+ AP4_Track* GetTrack(AP4_UI32 track_id);
+ AP4_Track* GetTrack(AP4_Track::Type type, AP4_Ordinal index = 0);
+ AP4_Result AddTrack(AP4_Track* track);
+ AP4_UI32 GetTimeScale();
+ AP4_Duration GetDuration();
+ AP4_Duration GetDurationMs();
+
+private:
+ // members
+ AP4_MoovAtom* m_MoovAtom;
+ AP4_MvhdAtom* m_MvhdAtom;
+ AP4_List<AP4_Track> m_Tracks;
+};
+
+#endif // _AP4_MOVIE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MvhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MvhdAtom.cpp
new file mode 100644
index 000000000..c6dfd15fb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MvhdAtom.cpp
@@ -0,0 +1,182 @@
+/*****************************************************************
+|
+| AP4 - mvhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::AP4_MvhdAtom
++---------------------------------------------------------------------*/
+AP4_MvhdAtom::AP4_MvhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI64 duration,
+ AP4_UI32 rate,
+ AP4_UI16 volume) :
+ AP4_Atom(AP4_ATOM_TYPE_MVHD, 96+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CreationTime(creation_time),
+ m_ModificationTime(modification_time),
+ m_TimeScale(time_scale),
+ m_Duration(duration),
+ m_Rate(rate),
+ m_Volume(volume),
+ m_NextTrackId(0xFFFFFFFF)
+{
+ m_Matrix[0] = 0x00010000;
+ m_Matrix[1] = 0;
+ m_Matrix[2] = 0;
+ m_Matrix[3] = 0;
+ m_Matrix[4] = 0x00010000;
+ m_Matrix[5] = 0;
+ m_Matrix[6] = 0;
+ m_Matrix[7] = 0;
+ m_Matrix[8] = 0x40000000;
+
+ memset(m_Reserved1, 0, sizeof(m_Reserved1));
+ memset(m_Reserved2, 0, sizeof(m_Reserved2));
+ memset(m_Predefined, 0, sizeof(m_Predefined));
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::AP4_MvhdAtom
++---------------------------------------------------------------------*/
+AP4_MvhdAtom::AP4_MvhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_MVHD, size, true, stream)
+{
+ if (m_Version == 0) {
+ AP4_UI32 tmp = 0;
+ stream.ReadUI32(tmp); m_CreationTime = tmp;
+ stream.ReadUI32(tmp); m_ModificationTime = tmp;
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI32(tmp); m_Duration = tmp;
+ } else if (m_Version == 1) {
+ stream.ReadUI64(m_CreationTime);
+ stream.ReadUI64(m_ModificationTime);
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI64(m_Duration);
+ } else {
+ // TODO
+ }
+
+ stream.ReadUI32(m_Rate);
+ stream.ReadUI16(m_Volume);
+ stream.Read(m_Reserved1, sizeof(m_Reserved1));
+ stream.Read(m_Reserved2, sizeof(m_Reserved2));
+ for (int i=0; i<9; i++) {
+ stream.ReadUI32(m_Matrix[i]);
+ }
+ stream.Read(m_Predefined, sizeof(m_Predefined));
+ stream.ReadUI32(m_NextTrackId);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MvhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ if (m_Version == 0) {
+ result = stream.WriteUI32((AP4_UI32)m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else if (m_Version == 1) {
+ result = stream.WriteUI64(m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ // TODO
+ }
+
+ // rate & volume
+ result = stream.WriteUI32(m_Rate);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_Volume);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved
+ result = stream.Write(m_Reserved1, sizeof(m_Reserved1));
+ if (AP4_FAILED(result)) return result;
+ result = stream.Write(m_Reserved2, sizeof(m_Reserved2));
+ if (AP4_FAILED(result)) return result;
+
+ // matrix
+ for (int i=0; i<9; i++) {
+ result = stream.WriteUI32(m_Matrix[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // pre-defined
+ result = stream.Write(m_Predefined, sizeof(m_Predefined));
+ if (AP4_FAILED(result)) return result;
+
+ // next track id
+ return stream.WriteUI32(m_NextTrackId);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_Duration
+AP4_MvhdAtom::GetDurationMs()
+{
+ if (m_TimeScale) {
+ return AP4_ConvertTime(m_Duration, m_TimeScale, 1000);
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MvhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("timescale", m_TimeScale);
+ inspector.AddField("duration", (AP4_UI32)m_Duration);
+ inspector.AddField("duration(ms)", (AP4_UI32)GetDurationMs());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MvhdAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MvhdAtom.h
new file mode 100644
index 000000000..b51ef174f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4MvhdAtom.h
@@ -0,0 +1,80 @@
+/*****************************************************************
+|
+| AP4 - mvhd Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MVHD_ATOM_H_
+#define _AP4_MVHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom
++---------------------------------------------------------------------*/
+class AP4_MvhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_MvhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI64 duration,
+ AP4_UI32 rate,
+ AP4_UI16 volume);
+ AP4_MvhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ AP4_UI64 GetDuration() { return m_Duration; }
+ void SetDuration(AP4_UI64 duration) { m_Duration = duration;}
+ AP4_Duration GetDurationMs();
+ AP4_UI32 GetTimeScale() { return m_TimeScale; }
+ AP4_Result SetTimeScale(AP4_UI32 time_scale) {
+ m_TimeScale = time_scale;
+ return AP4_SUCCESS;
+ }
+
+private:
+ // members
+ AP4_UI64 m_CreationTime;
+ AP4_UI64 m_ModificationTime;
+ AP4_UI32 m_TimeScale;
+ AP4_UI64 m_Duration;
+ AP4_UI32 m_Rate;
+ AP4_UI16 m_Volume;
+ AP4_UI08 m_Reserved1[2];
+ AP4_UI08 m_Reserved2[8];
+ AP4_UI32 m_Matrix[9];
+ AP4_UI08 m_Predefined[24];
+ AP4_UI32 m_NextTrackId;
+};
+
+#endif // _AP4_MVHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4NmhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4NmhdAtom.cpp
new file mode 100644
index 000000000..9a039b2d9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4NmhdAtom.cpp
@@ -0,0 +1,61 @@
+/*****************************************************************
+|
+| AP4 - nmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4NmhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_NmhdAtom::AP4_NmhdAtom
++---------------------------------------------------------------------*/
+AP4_NmhdAtom::AP4_NmhdAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_NMHD, AP4_FULL_ATOM_HEADER_SIZE, true)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_NmhdAtom::AP4_NmhdAtom
++---------------------------------------------------------------------*/
+AP4_NmhdAtom::AP4_NmhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_NMHD, size, true, stream)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_NmhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_NmhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // not implemented yet
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4NmhdAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4NmhdAtom.h
new file mode 100644
index 000000000..b7ad7d3ce
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4NmhdAtom.h
@@ -0,0 +1,51 @@
+/*****************************************************************
+|
+| AP4 - nmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_NMHD_ATOM_H_
+#define _AP4_NMHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_NmhdAtom
++---------------------------------------------------------------------*/
+class AP4_NmhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_NmhdAtom();
+ AP4_NmhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+};
+
+#endif // _AP4_NMHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.cpp
new file mode 100644
index 000000000..6019bd2f0
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.cpp
@@ -0,0 +1,296 @@
+/*****************************************************************
+|
+| AP4 - File Processor
+|
+| Copyright 2003-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Processor.h"
+#include "Ap4AtomSampleTable.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4Array.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+class AP4_SampleLocator {
+public:
+ AP4_SampleLocator() :
+ m_TrakIndex(0),
+ m_SampleTable(NULL),
+ m_SampleIndex(0),
+ m_Chunk(0) {}
+
+ AP4_Ordinal m_TrakIndex;
+ AP4_AtomSampleTable* m_SampleTable;
+ AP4_Ordinal m_SampleIndex;
+ AP4_Sample m_Sample;
+ AP4_Ordinal m_Chunk;
+};
+
+struct AP4_SampleCursor {
+ AP4_SampleLocator m_Locator;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Processor::Process
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Processor::Process(AP4_ByteStream& input,
+ AP4_ByteStream& output,
+ AP4_AtomFactory& atom_factory)
+{
+ // read all atoms
+ AP4_AtomParent top_level;
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(input, atom))) {
+ top_level.AddChild(atom);
+ }
+
+ // remove the [mdat] and [free] atoms, keep a ref to [moov]
+ AP4_MoovAtom* moov = NULL;
+ AP4_List<AP4_Atom>::Item* atom_item = top_level.GetChildren().FirstItem();
+ while (atom_item) {
+ atom = atom_item->GetData();
+ AP4_List<AP4_Atom>::Item* next = atom_item->GetNext();
+ if (//atom->GetType() == AP4_ATOM_TYPE_FREE ||
+ atom->GetType() == AP4_ATOM_TYPE_MDAT) {
+ atom->Detach();
+ delete atom;
+ } else if (atom->GetType() == AP4_ATOM_TYPE_MOOV) {
+ moov = (AP4_MoovAtom*)atom;
+ }
+ atom_item = next;
+ }
+
+ // check that we have a moov atom
+ if (moov == NULL) return AP4_FAILURE;
+
+ // initialize the processor
+ AP4_Result result = Initialize(top_level);
+ if (AP4_FAILED(result)) return result;
+
+ // build an array of track sample cursors
+ AP4_List<AP4_TrakAtom>& trak_atoms = moov->GetTrakAtoms();
+ AP4_Cardinal track_count = trak_atoms.ItemCount();
+ AP4_SampleCursor* cursors = new AP4_SampleCursor[track_count];
+ TrackHandler** handlers = new TrackHandler*[track_count];
+ AP4_List<AP4_TrakAtom>::Item* item = trak_atoms.FirstItem();
+ unsigned int index = 0;
+ while (item) {
+ // create the track handler // find the stsd atom
+ AP4_ContainerAtom* stbl = dynamic_cast<AP4_ContainerAtom*>(
+ item->GetData()->FindChild("mdia/minf/stbl"));
+ if (stbl == NULL) continue;
+ handlers[index] = CreateTrackHandler(item->GetData());
+ cursors[index].m_Locator.m_TrakIndex = index;
+ cursors[index].m_Locator.m_SampleTable = new AP4_AtomSampleTable(stbl, input);
+ cursors[index].m_Locator.m_SampleIndex = 0;
+ cursors[index].m_Locator.m_SampleTable->GetSample(0, cursors[index].m_Locator.m_Sample);
+ cursors[index].m_Locator.m_Chunk = 1;
+ index++;
+ item = item->GetNext();
+ }
+
+ // figure out the layout of the chunks
+ AP4_Array<AP4_SampleLocator> locators;
+ for (;;) {
+ // see which is the next sample to write
+ unsigned int min_offset = 0xFFFFFFFF;
+ int cursor = -1;
+ for (unsigned int i=0; i<track_count; i++) {
+ if (cursors[i].m_Locator.m_SampleTable &&
+ cursors[i].m_Locator.m_Sample.GetOffset() <= min_offset) {
+ min_offset = cursors[i].m_Locator.m_Sample.GetOffset();
+ cursor = i;
+ }
+ }
+
+ // stop if all cursors are exhausted
+ if (cursor == -1) break;
+
+ // append this locator to the layout list
+ AP4_SampleLocator& locator = cursors[cursor].m_Locator;
+ locators.Append(locator);
+ //AP4_Debug("NEXT: track %d, sample %d:%d: offset=%d, size=%d\n",
+ // locator.m_TrakIndex,
+ // locator.m_Chunk,
+ // locator.m_SampleIndex,
+ // locator.m_Sample.GetOffset(),
+ // locator.m_Sample.GetSize());
+
+ // move the cursor to the next sample
+ locator.m_SampleIndex++;
+ if (locator.m_SampleIndex == locator.m_SampleTable->GetSampleCount()) {
+ // mark this track as completed
+ locator.m_SampleTable = NULL;
+ } else {
+ // get the next sample info
+ locator.m_SampleTable->GetSample(locator.m_SampleIndex,
+ locator.m_Sample);
+ AP4_Ordinal skip, sdesc;
+ locator.m_SampleTable->GetChunkForSample(locator.m_SampleIndex+1, // the internal API is 1-based
+ locator.m_Chunk,
+ skip, sdesc);
+ }
+ }
+
+ // update the stbl atoms and compute the mdat size
+ AP4_Size mdat_size = 0;
+ int current_track = -1;
+ int current_chunk = -1;
+ AP4_Offset current_chunk_offset = 0;
+ AP4_Size current_chunk_size = 0;
+ for (AP4_Ordinal i=0; i<locators.ItemCount(); i++) {
+ AP4_SampleLocator& locator = locators[i];
+ if ((int)locator.m_TrakIndex != current_track ||
+ (int)locator.m_Chunk != current_chunk) {
+ // start a new chunk for this track
+ current_chunk_offset += current_chunk_size;
+ current_chunk_size = 0;
+ current_track = locator.m_TrakIndex;
+ current_chunk = locator.m_Chunk;
+ locator.m_SampleTable->SetChunkOffset(locator.m_Chunk,
+ current_chunk_offset);
+ }
+ AP4_Size sample_size;
+ TrackHandler* handler = handlers[locator.m_TrakIndex];
+ if (handler) {
+ sample_size = handler->GetProcessedSampleSize(locator.m_Sample);
+ locator.m_SampleTable->SetSampleSize(locator.m_SampleIndex+1, sample_size);
+ } else {
+ sample_size = locator.m_Sample.GetSize();
+ }
+ current_chunk_size += sample_size;
+ mdat_size += sample_size;
+ }
+
+ // process the tracks (ex: sample descriptions processing)
+ for (AP4_Ordinal i=0; i<track_count; i++) {
+ TrackHandler* handler = handlers[i];
+ if (handler) handler->ProcessTrack();
+ }
+
+ // initialize the processor
+ Finalize(top_level);
+
+ // calculate the size of all atoms combined
+ AP4_Size atoms_size = 0;
+ top_level.GetChildren().Apply(AP4_AtomSizeAdder(atoms_size));
+
+ // adjust the chunk offsets
+ for (AP4_Ordinal i=0; i<track_count; i++) {
+ AP4_TrakAtom* trak;
+ trak_atoms.Get(i, trak);
+ trak->AdjustChunkOffsets(atoms_size+AP4_ATOM_HEADER_SIZE);
+ }
+
+ // write all atoms
+ top_level.GetChildren().Apply(AP4_AtomListWriter(output));
+
+ // write mdat header
+ output.WriteUI32(mdat_size+AP4_ATOM_HEADER_SIZE);
+ output.WriteUI32(AP4_ATOM_TYPE_MDAT);
+
+#if defined(AP4_DEBUG)
+ AP4_Offset before;
+ output.Tell(before);
+#endif
+
+ // write the samples
+ AP4_Sample sample;
+ AP4_DataBuffer data_in;
+ AP4_DataBuffer data_out;
+ for (unsigned int i=0; i<locators.ItemCount(); i++) {
+ AP4_SampleLocator& locator = locators[i];
+ locator.m_Sample.ReadData(data_in);
+ TrackHandler* handler = handlers[locator.m_TrakIndex];
+ if (handler) {
+ handler->ProcessSample(data_in, data_out);
+ output.Write(data_out.GetData(), data_out.GetDataSize());
+ } else {
+ output.Write(data_in.GetData(), data_in.GetDataSize());
+ }
+ }
+
+#if defined(AP4_DEBUG)
+ AP4_Offset after;
+ output.Tell(after);
+ AP4_ASSERT(after-before == mdat_size);
+#endif
+
+ // cleanup
+ delete[] cursors;
+ for (unsigned int i=0; i<track_count; i++) {
+ delete handlers[i];
+ }
+ delete[] handlers;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Processor:Initialize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Processor::Initialize(AP4_AtomParent& top_level)
+{
+ // default implementation: do nothing
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Processor:Finalize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Processor::Finalize(AP4_AtomParent& top_level)
+{
+ // default implementation: do nothing
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Processor:CreateTrackHandler
++---------------------------------------------------------------------*/
+AP4_Processor::TrackHandler*
+AP4_Processor::CreateTrackHandler(AP4_TrakAtom* /* trak */)
+{
+ // default implementation: no handler
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Processor::TrackHandler::GetProcessedSampleSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_Processor::TrackHandler::GetProcessedSampleSize(AP4_Sample& sample)
+{
+ // default implementation: do no change the sample size
+ return sample.GetSize();
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.h
new file mode 100644
index 000000000..7d1f03d4f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Processor.h
@@ -0,0 +1,72 @@
+/*****************************************************************
+|
+| AP4 - File Processor
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_ContainerAtom;
+class AP4_Sample;
+class AP4_ByteStream;
+class AP4_DataBuffer;
+class AP4_TrakAtom;
+
+/*----------------------------------------------------------------------
+| AP4_Processor
++---------------------------------------------------------------------*/
+class AP4_Processor {
+public:
+ // types
+ class TrackHandler {
+ public:
+ virtual ~TrackHandler() {}
+ virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample);
+ virtual AP4_Result ProcessTrack() { return AP4_SUCCESS; }
+ virtual AP4_Result ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out) = 0;
+ };
+
+ // constructor and destructor
+ virtual ~AP4_Processor() {}
+
+ // abstract base class methods
+ AP4_Result Process(AP4_ByteStream& input,
+ AP4_ByteStream& output,
+ AP4_AtomFactory& atom_factory =
+ AP4_AtomFactory::DefaultFactory);
+
+ // overridable methods
+ virtual AP4_Result Initialize(AP4_AtomParent& top_level);
+ virtual AP4_Result Finalize(AP4_AtomParent& top_level);
+ virtual TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
+};
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Results.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Results.h
new file mode 100644
index 000000000..21d3cf5ed
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Results.h
@@ -0,0 +1,63 @@
+/*****************************************************************
+|
+| AP4 - Result Codes
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_RESULTS_H_
+#define _AP4_RESULTS_H_
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_SUCCESS = 0;
+const int AP4_FAILURE = -1;
+const int AP4_ERROR_OUT_OF_MEMORY = -2;
+const int AP4_ERROR_INVALID_PARAMETERS = -3;
+const int AP4_ERROR_NO_SUCH_FILE = -4;
+const int AP4_ERROR_PERMISSION_DENIED = -5;
+const int AP4_ERROR_CANNOT_OPEN_FILE = -6;
+const int AP4_ERROR_EOS = -7;
+const int AP4_ERROR_WRITE_FAILED = -8;
+const int AP4_ERROR_READ_FAILED = -9;
+const int AP4_ERROR_INVALID_FORMAT = -10;
+const int AP4_ERROR_NO_SUCH_ITEM = -11;
+const int AP4_ERROR_OUT_OF_RANGE = -12;
+const int AP4_ERROR_INTERNAL = -13;
+const int AP4_ERROR_INVALID_STATE = -14;
+const int AP4_ERROR_LIST_EMPTY = -15;
+const int AP4_ERROR_LIST_OPERATION_ABORTED = -16;
+const int AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE = -17;
+const int AP4_ERROR_NOT_SUPPORTED_YET = -18;
+const int AP4_ERROR_INVALID_TRACK_TYPE = -19;
+const int AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA = -20;
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define AP4_FAILED(result) ((result) != AP4_SUCCESS)
+#define AP4_SUCCEEDED(result) ((result) == AP4_SUCCESS)
+
+#endif // _AP4_RESULTS_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.cpp
new file mode 100644
index 000000000..1cf72cfa2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.cpp
@@ -0,0 +1,93 @@
+/*****************************************************************
+|
+| AP4 - sdp Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4RtpAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+
+/*----------------------------------------------------------------------
+| AP4_RtpAtom::AP4_RtpAtom
++---------------------------------------------------------------------*/
+AP4_RtpAtom::AP4_RtpAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_RTP, size, false, stream)
+{
+ // desc format
+ stream.ReadUI32(m_DescriptionFormat);
+
+ // sdptext
+ int str_size = size-(AP4_ATOM_HEADER_SIZE+4);
+ if (str_size) {
+ char* str = new char[str_size+1];
+ stream.Read(str, str_size);
+ str[str_size] = '\0'; // force null-termination
+ m_SdpText = str;
+ delete[] str;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // description format
+ result = stream.WriteUI32(m_DescriptionFormat);
+ if (AP4_FAILED(result)) return result;
+
+ // sdp text
+ result = stream.Write(m_SdpText.c_str(), m_SdpText.length());
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_ATOM_HEADER_SIZE+4+m_SdpText.length());
+ while (padding--) stream.WriteUI08(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char format_string[5];
+ AP4_FormatFourChars(format_string, m_DescriptionFormat);
+ inspector.AddField("description_format", format_string);
+ inspector.AddField("sdp_text", m_SdpText.c_str());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.h
new file mode 100644
index 000000000..1ae414f60
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpAtom.h
@@ -0,0 +1,59 @@
+/*****************************************************************
+|
+| AP4 - rtp Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_RTP_ATOM_H_
+#define _AP4_RTP_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_RtpAtom
++---------------------------------------------------------------------*/
+class AP4_RtpAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_RtpAtom(AP4_Size size, AP4_ByteStream& stream);
+ const AP4_String& GetSdpText() { return m_SdpText; }
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI32 m_DescriptionFormat;
+ AP4_String m_SdpText;
+};
+
+#endif // _AP4_RTP_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.cpp
new file mode 100644
index 000000000..e5545618c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.cpp
@@ -0,0 +1,638 @@
+/*****************************************************************
+|
+| AP4 - RTP Hint Objects
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4RtpHint.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::~AP4_RtpSampleData
++---------------------------------------------------------------------*/
+AP4_RtpSampleData::~AP4_RtpSampleData()
+{
+ AP4_List<AP4_RtpPacket>::Item* it = m_Packets.FirstItem();
+ while (it != NULL) {
+ it->GetData()->Release();
+ it = it->GetNext();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::AP4_RtpSampleData
++---------------------------------------------------------------------*/
+AP4_RtpSampleData::AP4_RtpSampleData(AP4_ByteStream& stream, AP4_Size size)
+{
+ // save the start position
+ AP4_Offset start, extra_data_start;
+ stream.Tell(start);
+
+ AP4_UI16 packet_count;
+ stream.ReadUI16(packet_count);
+
+ AP4_UI16 reserved;
+ stream.ReadUI16(reserved); // later, check that reserved is 0
+
+ // packets
+ for (AP4_UI16 i=0; i<packet_count; i++) {
+ AP4_RtpPacket* packet = new AP4_RtpPacket(stream);
+ m_Packets.Add(packet);
+ }
+
+ // extra data
+ stream.Tell(extra_data_start);
+ AP4_Size extra_data_size = size - (extra_data_start-start);
+ if (extra_data_size != 0) {
+ m_ExtraData.SetDataSize(extra_data_size);
+ stream.Read(m_ExtraData.UseData(), extra_data_size);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::GetSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_RtpSampleData::GetSize()
+{
+ // packet count and reserved
+ AP4_Size result = 4;
+
+ // packets
+ AP4_List<AP4_RtpPacket>::Item* it = m_Packets.FirstItem();
+ while (it != NULL) {
+ result = it->GetData()->GetSize();
+ it = it->GetNext();
+ }
+
+ // extra data
+ result += m_ExtraData.GetDataSize();
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::ToByteStream
++---------------------------------------------------------------------*/
+AP4_ByteStream*
+AP4_RtpSampleData::ToByteStream()
+{
+ // refresh the size
+ AP4_Size size = GetSize();
+
+ // create a memory stream
+ AP4_MemoryByteStream* stream = new AP4_MemoryByteStream(size);
+
+ // write in it
+ AP4_Result result = stream->WriteUI16(static_cast<AP4_UI16>(m_Packets.ItemCount()));
+ if (AP4_FAILED(result)) goto bail;
+
+ result = stream->WriteUI16(0); // reserved
+ if (AP4_FAILED(result)) goto bail;
+
+ {
+ AP4_List<AP4_RtpPacket>::Item* it = m_Packets.FirstItem();
+ while (it != NULL) {
+ result = it->GetData()->Write(*stream);
+ if (AP4_FAILED(result)) goto bail;
+ it = it->GetNext();
+ }
+ }
+
+ result = stream->Write(m_ExtraData.GetData(), m_ExtraData.GetDataSize());
+ if (AP4_FAILED(result)) goto bail;
+
+ // return
+ return stream;
+
+bail:
+ stream->Release();
+ return NULL;
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::AddPacket
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpSampleData::AddPacket(AP4_RtpPacket* packet)
+{
+ packet->AddReference();
+ return m_Packets.Add(packet);
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AP4_RtpPacket
++---------------------------------------------------------------------*/
+AP4_RtpPacket::AP4_RtpPacket(AP4_Integer relative_time,
+ bool p_bit,
+ bool x_bit,
+ bool m_bit,
+ AP4_UI08 payload_type,
+ AP4_UI16 sequence_seed,
+ AP4_Integer time_stamp_offset /* = 0 */,
+ bool bframe_flag /* = false */,
+ bool repeat_flag /* = false */) :
+ m_ReferenceCount(1),
+ m_RelativeTime(relative_time),
+ m_PBit(p_bit),
+ m_XBit(x_bit),
+ m_MBit(m_bit),
+ m_PayloadType(payload_type),
+ m_SequenceSeed(sequence_seed),
+ m_TimeStampOffset(time_stamp_offset),
+ m_BFrameFlag(bframe_flag),
+ m_RepeatFlag(repeat_flag)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AP4_RtpPacket
++---------------------------------------------------------------------*/
+AP4_RtpPacket::AP4_RtpPacket(AP4_ByteStream& stream) :
+ m_ReferenceCount(1),
+ m_TimeStampOffset(0)
+{
+ AP4_UI08 octet;
+
+ // relative time
+ AP4_UI32 relative_time;
+ stream.ReadUI32(relative_time);
+ m_RelativeTime = relative_time;
+
+ // pbit and xbit
+ stream.ReadUI08(octet);
+ m_PBit = (octet & 0x20) != 0;
+ m_XBit = (octet & 0x10) != 0;
+
+ // mbit and payload type
+ stream.ReadUI08(octet);
+ m_MBit = (octet & 0x80) != 0;
+ m_PayloadType = octet & 0x7F;
+
+ // sequence seed
+ stream.ReadUI16(m_SequenceSeed);
+
+ // extra, bframe and repeat flags
+ stream.ReadUI08(octet);
+ stream.ReadUI08(octet); // repeat on purpose
+ bool extra_flag = (octet & 0x04) != 0;
+
+ // bframe and repeat flags
+ m_BFrameFlag = (octet & 0x02) != 0;
+ m_RepeatFlag = (octet & 0x01) != 0;
+
+ // constructor count
+ AP4_UI16 constructor_count;
+ stream.ReadUI16(constructor_count);
+
+ // parse the packet extra data
+ if (extra_flag) {
+ // read the length
+ AP4_UI32 extra_length;
+ stream.ReadUI32(extra_length);
+
+ // check it
+ if (extra_length < 4)
+ throw AP4_Exception(AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA);
+
+ // now read the entries
+ extra_length -= 4;
+ while (extra_length > 0) {
+ AP4_UI32 entry_length;
+ AP4_UI32 entry_tag;
+ stream.ReadUI32(entry_length);
+ stream.ReadUI32(entry_tag);
+
+ // check the entry
+ if (entry_length < 8) {
+ throw AP4_Exception(AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA);
+ }
+
+ // parse the single entry that's currently defined in the spec
+ if (entry_tag == AP4_ATOM_TYPE('r','t','p','o') && entry_length == 12) {
+ AP4_UI32 time_stamp_offset;
+ stream.ReadUI32(time_stamp_offset);
+ m_TimeStampOffset = time_stamp_offset;
+ } else {
+ // ignore it
+ AP4_Offset cur_pos;
+ stream.Tell(cur_pos);
+ stream.Seek(cur_pos + entry_length - 8); // 8 = length + tag
+ }
+
+ extra_length -= entry_length;
+ }
+ }
+
+ // constructors
+ for (AP4_UI16 i=0; i<constructor_count; i++) {
+ AP4_RtpConstructor* constructor = NULL;
+ AP4_RtpConstructorFactory::CreateConstructorFromStream(stream, constructor);
+ m_Constructors.Add(constructor);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AP4_RtpPacket
++---------------------------------------------------------------------*/
+AP4_RtpPacket::~AP4_RtpPacket()
+{
+ AP4_List<AP4_RtpConstructor>::Item* it = m_Constructors.FirstItem();
+ while (it != NULL) {
+ it->GetData()->Release();
+ it = it->GetNext();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_RtpPacket::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::Release
++---------------------------------------------------------------------*/
+void
+AP4_RtpPacket::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::GetSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_RtpPacket::GetSize()
+{
+ AP4_Size result = 12 + (m_TimeStampOffset != 0)?16:0;
+ result += m_Constructors.ItemCount() * AP4_RTP_CONSTRUCTOR_SIZE;
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpPacket::Write(AP4_ByteStream& stream)
+{
+ // check the payload type
+ if (m_PayloadType > 128) return AP4_FAILURE;
+
+ // now write
+ AP4_Result result = stream.WriteUI32(m_RelativeTime);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI08(0x80 | m_PBit << 5 | m_XBit << 4);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI08(m_MBit << 7 | m_PayloadType);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI16(m_SequenceSeed);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI08(0);
+ if (AP4_FAILED(result)) return result;
+
+ // deal with extra flag
+ bool extra_flag = m_TimeStampOffset != 0;
+ result = stream.WriteUI08(0x00 | extra_flag << 2
+ | m_BFrameFlag << 1
+ | m_RepeatFlag << 0);
+ if (AP4_FAILED(result)) return result;
+
+
+ // constructor count
+ result = stream.WriteUI16(static_cast<AP4_UI16>(m_Constructors.ItemCount()));
+
+ // write extra data
+ if (extra_flag) {
+ // extra_length
+ result = stream.WriteUI32(16); // 4 (extra_length) + 12 (rtpo atom)
+ if (AP4_FAILED(result)) return result;
+
+ // rtpo atom
+ result = stream.WriteUI32(12); // size
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(AP4_ATOM_TYPE('r','t','p','o'));
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeStampOffset);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // constructors
+ AP4_List<AP4_RtpConstructor>::Item* it = m_Constructors.FirstItem();
+ while (it != NULL) {
+ result = it->GetData()->Write(stream);
+ if (AP4_FAILED(result)) return result;
+ it = it->GetNext();
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AddConstructor
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpPacket::AddConstructor(AP4_RtpConstructor* constructor)
+{
+ constructor->AddReference();
+ return m_Constructors.Add(constructor);
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructor::GetConstructedDataSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_RtpPacket::GetConstructedDataSize()
+{
+ // header + ssrc
+ AP4_Size size = 12;
+
+ // constructed data from constructors
+ AP4_List<AP4_RtpConstructor>::Item* constructors_it
+ = m_Constructors.FirstItem();
+ while (constructors_it != NULL) {
+ size += constructors_it->GetData()->GetConstructedDataSize();
+ constructors_it = constructors_it->GetNext();
+ }
+
+ return size;
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructor::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_RtpConstructor::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructor::Release
++---------------------------------------------------------------------*/
+void
+AP4_RtpConstructor::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
+/*----------------------------------------------------------------------
+| AP4_RtpConstructor::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpConstructor::Write(AP4_ByteStream& stream)
+{
+ AP4_Result result = stream.WriteUI08(m_Type);
+ if (AP4_FAILED(result)) return result;
+
+ return DoWrite(stream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_NoopRtpConstructor::AP4_NoopRtpConstructor
++---------------------------------------------------------------------*/
+AP4_NoopRtpConstructor::AP4_NoopRtpConstructor(AP4_ByteStream& stream) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_NOOP)
+{
+ AP4_Offset cur_offset;
+ stream.Tell(cur_offset);
+ stream.Seek(cur_offset+15);
+}
+
+/*----------------------------------------------------------------------
+| AP4_NoopRtpConstructor::DoWrite
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_NoopRtpConstructor::DoWrite(AP4_ByteStream& stream)
+{
+ AP4_UI08 pad[15];
+
+ return stream.Write(pad, sizeof(pad));
+}
+
+/*----------------------------------------------------------------------
+| AP4_ImmediateRtpConstructor::AP4_ImmediateRtpConstructor
++---------------------------------------------------------------------*/
+AP4_ImmediateRtpConstructor::AP4_ImmediateRtpConstructor(const AP4_DataBuffer& data) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE),
+ m_Data(data)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_ImmediateRtpConstructor::AP4_ImmediateRtpConstructor
++---------------------------------------------------------------------*/
+AP4_ImmediateRtpConstructor::AP4_ImmediateRtpConstructor(AP4_ByteStream& stream) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE)
+{
+ AP4_Offset cur_offset;
+ stream.Tell(cur_offset);
+
+ // data
+ AP4_UI08 data_size;
+ stream.ReadUI08(data_size);
+ m_Data.SetDataSize(data_size);
+ stream.Read(m_Data.UseData(), data_size);
+
+ // reposition the stream
+ stream.Seek(cur_offset+15);
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_ImmediateRtpConstructor::DoWrite
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ImmediateRtpConstructor::DoWrite(AP4_ByteStream& stream)
+{
+ // first check that the data is not too large
+ if (m_Data.GetDataSize() > 14) return AP4_FAILURE;
+
+ // now write
+ AP4_Result result = stream.WriteUI08(static_cast<AP4_UI08>(m_Data.GetDataSize()));
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.Write(m_Data.GetData(), m_Data.GetDataSize());
+ if (AP4_FAILED(result)) return result;
+
+ // pad
+ AP4_Byte pad[14];
+ return stream.Write(pad, sizeof(pad)-m_Data.GetDataSize());
+}
+/*----------------------------------------------------------------------
+| AP4_SampleRtpConstructor::AP4_SampleRtpConstructor
++---------------------------------------------------------------------*/
+AP4_SampleRtpConstructor::AP4_SampleRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_num,
+ AP4_UI32 sample_offset) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE),
+ m_TrackRefIndex(track_ref_index),
+ m_Length(length),
+ m_SampleNum(sample_num),
+ m_SampleOffset(sample_offset)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_SampleRtpConstructor::AP4_SampleRtpConstructor
++---------------------------------------------------------------------*/
+AP4_SampleRtpConstructor::AP4_SampleRtpConstructor(AP4_ByteStream& stream) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE)
+{
+ // offset
+ AP4_Offset cur_offset;
+ stream.Tell(cur_offset);
+
+ // data
+ stream.ReadUI08(m_TrackRefIndex);
+ stream.ReadUI16(m_Length);
+ stream.ReadUI32(m_SampleNum);
+ stream.ReadUI32(m_SampleOffset);
+
+ // reposition the stream
+ stream.Seek(cur_offset+15);
+}
+/*----------------------------------------------------------------------
+| AP4_SampleRtpConstructor::DoWrite
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleRtpConstructor::DoWrite(AP4_ByteStream& stream)
+{
+ AP4_Result result = stream.WriteUI08(m_TrackRefIndex);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI16(m_Length);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI32(m_SampleNum);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI32(m_SampleOffset);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI16(1); // bytes per block
+ if (AP4_FAILED(result)) return result;
+
+ return stream.WriteUI16(1); // samples per block
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor
++---------------------------------------------------------------------*/
+AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_desc_index,
+ AP4_UI32 sample_desc_offset) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC),
+ m_TrackRefIndex(track_ref_index),
+ m_Length(length),
+ m_SampleDescIndex(sample_desc_index),
+ m_SampleDescOffset(sample_desc_offset)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor
++---------------------------------------------------------------------*/
+AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor(AP4_ByteStream& stream) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC)
+{
+ // offset
+ AP4_Offset cur_offset;
+ stream.Tell(cur_offset);
+
+ // data
+ stream.ReadUI08(m_TrackRefIndex);
+ stream.ReadUI16(m_Length);
+ stream.ReadUI32(m_SampleDescIndex);
+ stream.ReadUI32(m_SampleDescOffset);
+
+ // reposition the stream
+ stream.Seek(cur_offset+15);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescRtpConstructor::DoWrite
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleDescRtpConstructor::DoWrite(AP4_ByteStream& stream)
+{
+ AP4_Result result = stream.WriteUI08(m_TrackRefIndex);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI16(m_Length);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI32(m_SampleDescIndex);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI32(m_SampleDescOffset);
+ if (AP4_FAILED(result)) return result;
+
+ return stream.WriteUI32(0); // reserved
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructorFactory::CreateConstructorFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpConstructorFactory::CreateConstructorFromStream(AP4_ByteStream& stream,
+ AP4_RtpConstructor*& constructor)
+{
+ // read the first byte (type)
+ AP4_RtpConstructor::Type type;
+ AP4_Result result = stream.ReadUI08(type);
+ if (AP4_FAILED(result)) return result;
+
+ switch(type) {
+ case AP4_RTP_CONSTRUCTOR_TYPE_NOOP:
+ constructor = new AP4_NoopRtpConstructor(stream);
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE:
+ constructor = new AP4_ImmediateRtpConstructor(stream);
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE:
+ constructor = new AP4_SampleRtpConstructor(stream);
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC:
+ constructor = new AP4_SampleDescRtpConstructor(stream);
+ break;
+ default:
+ return AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE;
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.h
new file mode 100644
index 000000000..b5cfd67f1
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4RtpHint.h
@@ -0,0 +1,297 @@
+/*****************************************************************
+|
+| AP4 - RTP Hint Objects
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_RTP_HINT_H_
+#define _AP4_RTP_HINT_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4List.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Interfaces.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_ByteStream;
+class AP4_RtpConstructor;
+class AP4_RtpPacket;
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData
++---------------------------------------------------------------------*/
+class AP4_RtpSampleData
+{
+public:
+ // constructors and destructor
+ AP4_RtpSampleData(AP4_ByteStream& stream, AP4_Size size);
+ AP4_RtpSampleData() {}
+ virtual ~AP4_RtpSampleData();
+
+ // methods
+ virtual AP4_Result AddPacket(AP4_RtpPacket* packet);
+ virtual AP4_Size GetSize();
+ virtual AP4_ByteStream* ToByteStream();
+
+ // accessors
+ AP4_List<AP4_RtpPacket>& GetPackets() {
+ return m_Packets;
+ }
+ const AP4_DataBuffer& GetExtraData() const {
+ return m_ExtraData;
+ }
+
+protected:
+ // members
+ AP4_List<AP4_RtpPacket> m_Packets;
+ AP4_DataBuffer m_ExtraData;
+};
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket
++---------------------------------------------------------------------*/
+class AP4_RtpPacket : public AP4_Referenceable
+{
+public:
+ // constructor and destructor
+ AP4_RtpPacket(AP4_ByteStream& stream);
+ AP4_RtpPacket(AP4_Integer relative_time,
+ bool p_bit,
+ bool x_bit,
+ bool m_bit,
+ AP4_UI08 payload_type,
+ AP4_UI16 sequence_seed,
+ AP4_Integer time_stamp_offset = 0,
+ bool bframe_flag = false,
+ bool repeat_flag = false);
+ ~AP4_RtpPacket();
+
+ // methods
+ AP4_Result Write(AP4_ByteStream& stream);
+ AP4_Result AddConstructor(AP4_RtpConstructor* constructor);
+ AP4_Size GetSize();
+ AP4_Size GetConstructedDataSize();
+
+ // Referenceable methods
+ void AddReference();
+ void Release();
+
+ // Accessors
+ AP4_Integer GetRelativeTime() const { return m_RelativeTime; }
+ bool GetPBit() const { return m_PBit; }
+ bool GetXBit() const { return m_XBit; }
+ bool GetMBit() const { return m_MBit; }
+ AP4_UI08 GetPayloadType() const { return m_PayloadType; }
+ AP4_UI16 GetSequenceSeed() const { return m_SequenceSeed; }
+ AP4_Integer GetTimeStampOffset() const { return m_TimeStampOffset; }
+ bool GetBFrameFlag() const { return m_BFrameFlag; }
+ bool GetRepeatFlag() const { return m_RepeatFlag; }
+ AP4_List<AP4_RtpConstructor>& GetConstructors() {
+ return m_Constructors;
+ }
+
+private:
+ // members
+ AP4_Cardinal m_ReferenceCount;
+ AP4_Integer m_RelativeTime;
+ bool m_PBit;
+ bool m_XBit;
+ bool m_MBit;
+ AP4_UI08 m_PayloadType;
+ AP4_UI16 m_SequenceSeed;
+ AP4_Integer m_TimeStampOffset;
+ bool m_BFrameFlag;
+ bool m_RepeatFlag;
+ AP4_List<AP4_RtpConstructor> m_Constructors;
+};
+
+/*----------------------------------------------------------------------
+| AP4_RtpContructor
++---------------------------------------------------------------------*/
+class AP4_RtpConstructor : public AP4_Referenceable
+{
+public:
+ // types
+ typedef AP4_UI08 Type;
+
+ // constructor & destructor
+ AP4_RtpConstructor(Type type) : m_ReferenceCount(1), m_Type(type) {}
+
+ // methods
+ Type GetType() const { return m_Type; }
+ AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Size GetConstructedDataSize() = 0;
+
+ // Referenceable methods
+ void AddReference();
+ void Release();
+
+protected:
+ // methods
+ virtual ~AP4_RtpConstructor() {}
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream) = 0;
+
+ // members
+ AP4_Cardinal m_ReferenceCount;
+ Type m_Type;
+};
+
+/*----------------------------------------------------------------------
+| constructor size
++---------------------------------------------------------------------*/
+const AP4_Size AP4_RTP_CONSTRUCTOR_SIZE = 16;
+
+/*----------------------------------------------------------------------
+| constructor types
++---------------------------------------------------------------------*/
+const AP4_RtpConstructor::Type AP4_RTP_CONSTRUCTOR_TYPE_NOOP = 0;
+const AP4_RtpConstructor::Type AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE = 1;
+const AP4_RtpConstructor::Type AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE = 2;
+const AP4_RtpConstructor::Type AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC = 3;
+
+/*----------------------------------------------------------------------
+| AP4_NoopRtpConstructor
++---------------------------------------------------------------------*/
+class AP4_NoopRtpConstructor : public AP4_RtpConstructor
+{
+public:
+ // constructor
+ AP4_NoopRtpConstructor(AP4_ByteStream& stream);
+ AP4_NoopRtpConstructor() : AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_NOOP) {}
+
+ // methods
+ virtual AP4_Size GetConstructedDataSize() { return 0; }
+
+protected:
+ // methods
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream);
+};
+
+/*----------------------------------------------------------------------
+| AP4_ImmediateRtpConstructor
++---------------------------------------------------------------------*/
+class AP4_ImmediateRtpConstructor : public AP4_RtpConstructor
+{
+public:
+ // constructor
+ AP4_ImmediateRtpConstructor(AP4_ByteStream& stream);
+ AP4_ImmediateRtpConstructor(const AP4_DataBuffer& data);
+
+ // accessors
+ const AP4_DataBuffer& GetData() const { return m_Data; }
+
+ // methods
+ virtual AP4_Size GetConstructedDataSize() { return m_Data.GetDataSize(); }
+
+protected:
+ // methods
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream);
+
+ // members
+ AP4_DataBuffer m_Data;
+};
+
+/*----------------------------------------------------------------------
+| AP4_SampleRtpConstructor
++---------------------------------------------------------------------*/
+class AP4_SampleRtpConstructor : public AP4_RtpConstructor
+{
+public:
+ // constructor
+ AP4_SampleRtpConstructor(AP4_ByteStream& stream);
+ AP4_SampleRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_num,
+ AP4_UI32 sample_offset);
+
+ // accessors
+ AP4_UI08 GetTrackRefIndex() const { return m_TrackRefIndex; }
+ AP4_UI16 GetLength() const { return m_Length; }
+ AP4_UI32 GetSampleNum() const { return m_SampleNum; }
+ AP4_UI32 GetSampleOffset() const { return m_SampleOffset; }
+
+ // methods
+ virtual AP4_Size GetConstructedDataSize() { return m_Length; }
+
+protected:
+ // methods
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream);
+
+ // members
+ AP4_UI08 m_TrackRefIndex;
+ AP4_UI16 m_Length;
+ AP4_UI32 m_SampleNum;
+ AP4_UI32 m_SampleOffset;
+};
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescRtpConstructor
++---------------------------------------------------------------------*/
+class AP4_SampleDescRtpConstructor : public AP4_RtpConstructor
+{
+public:
+ // constructor
+ AP4_SampleDescRtpConstructor(AP4_ByteStream& stream);
+ AP4_SampleDescRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_desc_index,
+ AP4_UI32 sample_desc_offset);
+
+ // accessors
+ AP4_UI08 GetTrackRefIndex() const { return m_TrackRefIndex; }
+ AP4_UI16 GetLength() const { return m_Length; }
+ AP4_UI32 GetSampleDescIndex() const { return m_SampleDescIndex; }
+ AP4_UI32 GetSampleDescOffset() const { return m_SampleDescOffset; }
+
+ // methods
+ virtual AP4_Size GetConstructedDataSize() { return m_Length; }
+
+protected:
+ // methods
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream);
+
+ // members
+ AP4_UI08 m_TrackRefIndex;
+ AP4_UI16 m_Length;
+ AP4_UI32 m_SampleDescIndex;
+ AP4_UI32 m_SampleDescOffset;
+};
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructorFactory
++---------------------------------------------------------------------*/
+class AP4_RtpConstructorFactory
+{
+public:
+ static AP4_Result CreateConstructorFromStream(AP4_ByteStream& stream,
+ AP4_RtpConstructor*& constructor);
+};
+
+#endif // _AP4_RTP_HINT_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SLConfigDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SLConfigDescriptor.cpp
new file mode 100644
index 000000000..e15821f8e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SLConfigDescriptor.cpp
@@ -0,0 +1,54 @@
+/*****************************************************************
+|
+| AP4 - SLConfig Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SLConfigDescriptor.h"
+
+/*----------------------------------------------------------------------
+| AP4_SLConfigDescriptor::AP4_SLConfigDescriptor
++---------------------------------------------------------------------*/
+AP4_SLConfigDescriptor::AP4_SLConfigDescriptor(AP4_Size header_size = 2) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_SL_CONFIG, header_size, 1),
+ m_Predefined(2)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SLConfigDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SLConfigDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ // write the payload
+ stream.WriteUI08(m_Predefined);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SLConfigDescriptor.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SLConfigDescriptor.h
new file mode 100644
index 000000000..19026b081
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SLConfigDescriptor.h
@@ -0,0 +1,62 @@
+/*****************************************************************
+|
+| AP4 - SLConfig Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_SLCONFIG_DESCRIPTOR_H_
+#define _AP4_SLCONFIG_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Descriptor.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_SL_CONFIG = 0x06;
+
+/*----------------------------------------------------------------------
+| AP4_SLConfigDescriptor
++---------------------------------------------------------------------*/
+class AP4_SLConfigDescriptor : public AP4_Descriptor
+{
+public:
+ // methods
+ AP4_SLConfigDescriptor(AP4_Size header_size);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI08 m_Predefined; // = 2 (fixed for MP4 files)
+};
+
+
+#endif // _AP4_SLCONFIG_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Sample.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Sample.cpp
new file mode 100644
index 000000000..9424e5982
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Sample.cpp
@@ -0,0 +1,160 @@
+/*****************************************************************
+|
+| AP4 - Sample Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Sample.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_Sample::AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::AP4_Sample() :
+ m_DataStream(NULL),
+ m_Offset(0),
+ m_Size(0),
+ m_DescriptionIndex(0),
+ m_Dts(0),
+ m_Cts(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::AP4_Sample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp dts,
+ AP4_TimeStamp cts_offset /* = 0 */ ) :
+ m_Offset(offset),
+ m_Size(size),
+ m_DescriptionIndex(description_index),
+ m_Dts(dts),
+ m_Cts(dts + cts_offset)
+{
+ m_DataStream = &data_stream;
+ AP4_ADD_REFERENCE(m_DataStream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::AP4_Sample(const AP4_Sample& other) :
+ m_DataStream(other.m_DataStream),
+ m_Offset(other.m_Offset),
+ m_Size(other.m_Size),
+ m_DescriptionIndex(other.m_DescriptionIndex),
+ m_Dts(other.m_Dts),
+ m_Cts(other.m_Cts)
+{
+ AP4_ADD_REFERENCE(m_DataStream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::~AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::~AP4_Sample()
+{
+ AP4_RELEASE(m_DataStream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::operator=
++---------------------------------------------------------------------*/
+AP4_Sample&
+AP4_Sample::operator=(const AP4_Sample& other)
+{
+ AP4_RELEASE(m_DataStream);
+ m_DataStream = other.m_DataStream;
+ AP4_ADD_REFERENCE(m_DataStream);
+
+ m_Offset = other.m_Offset;
+ m_Size = other.m_Size;
+ m_DescriptionIndex = other.m_DescriptionIndex;
+ m_Dts = other.m_Dts;
+ m_Cts = other.m_Cts;
+
+ return *this;
+}
+/*----------------------------------------------------------------------
+| AP4_Sample::ReadData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Sample::ReadData(AP4_DataBuffer& data)
+{
+ return ReadData(data, m_Size);
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_Sample::ReadData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Sample::ReadData(AP4_DataBuffer& data, AP4_Size size, AP4_Offset offset)
+{
+ // check that we have a stream
+ if (m_DataStream == NULL) return AP4_FAILURE;
+
+ // shortcut
+ if (size == 0) return AP4_SUCCESS;
+
+ // check the size
+ if (m_Size < size+offset) return AP4_FAILURE;
+
+ // set the buffer size
+ AP4_Result result = data.SetDataSize(size);
+ if (AP4_FAILED(result)) return result;
+
+ // get the data from the stream
+ m_DataStream->Seek(m_Offset+offset);
+ return m_DataStream->Read(data.UseData(), size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::GetDataStream
++---------------------------------------------------------------------*/
+AP4_ByteStream*
+AP4_Sample::GetDataStream()
+{
+ AP4_ADD_REFERENCE(m_DataStream);
+ return m_DataStream;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::SetDataStream
++---------------------------------------------------------------------*/
+void
+AP4_Sample::SetDataStream(AP4_ByteStream& stream)
+{
+ AP4_RELEASE(m_DataStream);
+ m_DataStream = &stream;
+ AP4_ADD_REFERENCE(m_DataStream);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Sample.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Sample.h
new file mode 100644
index 000000000..184499f70
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Sample.h
@@ -0,0 +1,91 @@
+/*****************************************************************
+|
+| AP4 - Sample Objects
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_H_
+#define _AP4_SAMPLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_Sample DO NOT DERIVE FROM THIS CLASS
++---------------------------------------------------------------------*/
+class AP4_Sample
+{
+public:
+ // constructors and destructor
+ AP4_Sample();
+ AP4_Sample(const AP4_Sample& other);
+ AP4_Sample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp dts,
+ AP4_TimeStamp cts_offset = 0);
+ ~AP4_Sample(); // not virtual on purpose: do not derive from it
+
+ // operators
+ AP4_Sample& operator=(const AP4_Sample& other);
+
+ // methods
+ AP4_Result ReadData(AP4_DataBuffer& data);
+ AP4_Result ReadData(AP4_DataBuffer& data,
+ AP4_Size size,
+ AP4_Offset offset = 0);
+
+ // sample properties accessors
+ AP4_ByteStream* GetDataStream();
+ void SetDataStream(AP4_ByteStream& stream);
+ AP4_Offset GetOffset() const { return m_Offset; }
+ void SetOffset(AP4_Offset offset) { m_Offset = offset; }
+ AP4_Size GetSize() { return m_Size; }
+ void SetSize(AP4_Size size) { m_Size = size; }
+ AP4_Ordinal GetDescriptionIndex() const { return m_DescriptionIndex; }
+ void SetDescriptionIndex(AP4_Ordinal index) { m_DescriptionIndex = index; }
+ AP4_TimeStamp GetDts() const { return m_Dts; }
+ void SetDts(AP4_TimeStamp dts) { m_Dts = dts; }
+ AP4_TimeStamp GetDuration() const { return m_Duration; }
+ void SetDuration(AP4_Duration duration) { m_Duration = duration;}
+ AP4_TimeStamp GetCts() const { return m_Cts; }
+ void SetCts(AP4_TimeStamp cts) { m_Cts = cts; }
+
+protected:
+ AP4_ByteStream* m_DataStream;
+ AP4_Offset m_Offset;
+ AP4_Size m_Size;
+ AP4_Ordinal m_DescriptionIndex;
+ AP4_TimeStamp m_Dts;
+ AP4_TimeStamp m_Cts;
+ AP4_Duration m_Duration;
+};
+
+#endif // _AP4_SAMPLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.cpp
new file mode 100644
index 000000000..3c299df57
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.cpp
@@ -0,0 +1,266 @@
+/*****************************************************************
+|
+| AP4 - Sample Description Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4SampleDescription.h"
+#include "Ap4EsDescriptor.h"
+#include "Ap4SampleEntry.h"
+
+/*----------------------------------------------------------------------
+| AP4_UnknownSampleDescription::AP4_UnknownSampleDescription
++---------------------------------------------------------------------*/
+AP4_UnknownSampleDescription::AP4_UnknownSampleDescription(AP4_SampleEntry* entry) :
+ AP4_SampleDescription(AP4_SampleDescription::TYPE_UNKNOWN),
+ m_SampleEntry(entry)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownSampleDescription::~AP4_UnknownSampleDescription
++---------------------------------------------------------------------*/
+AP4_UnknownSampleDescription::~AP4_UnknownSampleDescription()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_UnknownSampleDescription::ToAtom() const
+{
+ return new AP4_SampleEntry(m_SampleEntry->GetType(),
+ m_SampleEntry->GetDataReferenceIndex());
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::AP4_MpegSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegSampleDescription::AP4_MpegSampleDescription(
+ StreamType stream_type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate) :
+ AP4_SampleDescription(TYPE_MPEG),
+ m_StreamType(stream_type),
+ m_ObjectTypeId(oti),
+ m_DecoderInfo(NULL),
+ m_BufferSize(buffer_size),
+ m_MaxBitrate(max_bitrate),
+ m_AvgBitrate(avg_bitrate)
+{
+ if (decoder_info != NULL) {
+ m_DecoderInfo = new AP4_DataBuffer(*decoder_info);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::~AP4_MpegSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegSampleDescription::~AP4_MpegSampleDescription()
+{
+ delete m_DecoderInfo;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::CreateEsDescriptor
++---------------------------------------------------------------------*/
+AP4_EsDescriptor*
+AP4_MpegSampleDescription::CreateEsDescriptor() const
+{
+ AP4_EsDescriptor* desc = new AP4_EsDescriptor(0);
+ AP4_DecoderSpecificInfoDescriptor* dsi_desc;
+ if (m_DecoderInfo) {
+ dsi_desc = new AP4_DecoderSpecificInfoDescriptor(*m_DecoderInfo);
+ } else {
+ dsi_desc = NULL;
+ }
+ AP4_DecoderConfigDescriptor* decoder_config =
+ new AP4_DecoderConfigDescriptor(m_StreamType,
+ m_ObjectTypeId,
+ m_BufferSize,
+ m_MaxBitrate,
+ m_AvgBitrate,
+ dsi_desc);
+ desc->AddSubDescriptor(decoder_config);
+ return desc;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSystemSampleDescription::AP4_MpegSystemSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegSystemSampleDescription::AP4_MpegSystemSampleDescription(
+ StreamType stream_type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate) :
+ AP4_MpegSampleDescription(stream_type,
+ oti,
+ decoder_info,
+ buffer_size,
+ max_bitrate,
+ avg_bitrate)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSystemSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_MpegSystemSampleDescription::ToAtom() const
+{
+ return new AP4_Mp4sSampleEntry(CreateEsDescriptor());
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegAudioSampleDescription::AP4_MpegAudioSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegAudioSampleDescription::AP4_MpegAudioSampleDescription(
+ OTI oti,
+ unsigned int sample_rate,
+ unsigned int sample_size,
+ unsigned int channel_count,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate) :
+ AP4_MpegSampleDescription(AP4_AUDIO_STREAM_TYPE,
+ oti,
+ decoder_info, buffer_size,
+ max_bitrate, avg_bitrate),
+ m_SampleRate(sample_rate),
+ m_SampleSize(sample_size),
+ m_ChannelCount(channel_count)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegAudioSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_MpegAudioSampleDescription::ToAtom() const
+{
+ return new AP4_Mp4aSampleEntry(m_SampleRate<<16,
+ m_SampleSize,
+ m_ChannelCount,
+ CreateEsDescriptor());
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegVideoSampleDescription::AP4_MpegVideoSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegVideoSampleDescription::AP4_MpegVideoSampleDescription(
+ OTI oti,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate) :
+ AP4_MpegSampleDescription(AP4_VISUAL_STREAM_TYPE,
+ oti,
+ decoder_info,
+ buffer_size,
+ max_bitrate,
+ avg_bitrate),
+ m_Width(width),
+ m_Height(height),
+ m_Depth(depth),
+ m_CompressorName(compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegVideoSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_MpegVideoSampleDescription::ToAtom() const
+{
+ return new AP4_Mp4vSampleEntry(m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.c_str(),
+ CreateEsDescriptor());
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::GetStreamTypeString
++---------------------------------------------------------------------*/
+const char*
+AP4_MpegSampleDescription::GetStreamTypeString(StreamType type)
+{
+ switch (type) {
+ case AP4_FORBIDDEN_STREAM_TYPE: return "INVALID";
+ case AP4_OD_STREAM_TYPE: return "Object Descriptor";
+ case AP4_CR_STREAM_TYPE: return "CR";
+ case AP4_BIFS_STREAM_TYPE: return "BIFS";
+ case AP4_VISUAL_STREAM_TYPE: return "Visual";
+ case AP4_AUDIO_STREAM_TYPE: return "Audio";
+ case AP4_MPEG7_STREAM_TYPE: return "MPEG-7";
+ case AP4_IPMP_STREAM_TYPE: return "IPMP";
+ case AP4_OCI_STREAM_TYPE: return "OCI";
+ case AP4_MPEGJ_STREAM_TYPE: return "MPEG-J";
+ default: return "UNKNOWN";
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::GetObjectTypeString
++---------------------------------------------------------------------*/
+const char*
+AP4_MpegSampleDescription::GetObjectTypeString(OTI oti)
+{
+ switch (oti) {
+ case AP4_MPEG4_SYSTEM_OTI: return "MPEG-4 System";
+ case AP4_MPEG4_SYSTEM_COR_OTI: return "MPEG-4 System COR";
+ case AP4_MPEG4_VISUAL_OTI: return "MPEG-4 Video";
+ case AP4_MPEG4_AUDIO_OTI: return "MPEG-4 Audio";
+ case AP4_MPEG2_VISUAL_SIMPLE_OTI: return "MPEG-2 Video Simple Profile";
+ case AP4_MPEG2_VISUAL_MAIN_OTI: return "MPEG-2 Video Main Profile";
+ case AP4_MPEG2_VISUAL_SNR_OTI: return "MPEG-2 Video SNR";
+ case AP4_MPEG2_VISUAL_SPATIAL_OTI: return "MPEG-2 Video Spatial";
+ case AP4_MPEG2_VISUAL_HIGH_OTI: return "MPEG-2 Video High";
+ case AP4_MPEG2_VISUAL_422_OTI: return "MPEG-2 Video 4:2:2";
+ case AP4_MPEG2_AAC_AUDIO_MAIN_OTI: return "MPEG-2 Audio AAC Main Profile";
+ case AP4_MPEG2_AAC_AUDIO_LC_OTI: return "MPEG-2 Audio AAC Low Complexity";
+ case AP4_MPEG2_AAC_AUDIO_SSRP_OTI: return "MPEG-2 Audio AAC SSRP";
+ case AP4_MPEG2_PART3_AUDIO_OTI: return "MPEG-2 Audio Part-3";
+ case AP4_MPEG1_VISUAL_OTI: return "MPEG-1 Video";
+ case AP4_MPEG1_AUDIO_OTI: return "MPEG-1 Audio";
+ case AP4_JPEG_OTI: return "JPEG";
+ default: return "UNKNOWN";
+ }
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.h
new file mode 100644
index 000000000..1097f7b78
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleDescription.h
@@ -0,0 +1,252 @@
+/*****************************************************************
+|
+| AP4 - Sample Description Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_DESCRIPTION_H_
+#define _AP4_SAMPLE_DESCRIPTION_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Atom.h"
+#include "Ap4EsDescriptor.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_SampleEntry;
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescription
++---------------------------------------------------------------------*/
+class AP4_SampleDescription
+{
+ public:
+ // type constants of the sample description
+ enum Type {
+ TYPE_UNKNOWN = 0x00,
+ TYPE_MPEG = 0x01,
+ TYPE_ISMACRYP = 0x02
+ };
+
+ // constructors & destructor
+ AP4_SampleDescription(Type type) : m_Type(type) {}
+ virtual ~AP4_SampleDescription() {}
+
+ // accessors
+ Type GetType() const { return m_Type; }
+
+ // factories
+ virtual AP4_Atom* ToAtom() const = 0;
+
+ protected:
+ Type m_Type;
+};
+
+/*----------------------------------------------------------------------
+| AP4_UnknownSampleDescription
++---------------------------------------------------------------------*/
+class AP4_UnknownSampleDescription : public AP4_SampleDescription
+{
+ public:
+ // methods
+ AP4_UnknownSampleDescription(AP4_SampleEntry* sample_entry);
+ ~AP4_UnknownSampleDescription();
+ AP4_SampleEntry* GetSampleEntry() { return m_SampleEntry; }
+ AP4_Atom* ToAtom() const;
+
+ protected:
+ AP4_SampleEntry* m_SampleEntry;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegSampleDescription : public AP4_SampleDescription
+{
+ public:
+ // types
+ typedef AP4_UI08 StreamType;
+ typedef AP4_UI08 OTI;
+
+ // class methods
+ const char* GetStreamTypeString(StreamType type);
+ const char* GetObjectTypeString(OTI oti);
+
+ // constructors & destructor
+ AP4_MpegSampleDescription(StreamType stream_type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+ virtual ~AP4_MpegSampleDescription();
+
+ // accessors
+ AP4_Byte GetStreamType() const { return m_StreamType; }
+ AP4_Byte GetObjectTypeId() const { return m_ObjectTypeId; }
+ const AP4_DataBuffer* GetDecoderInfo() const { return m_DecoderInfo; }
+ AP4_UI32 GetBufferSize() const { return m_BufferSize; }
+ AP4_UI32 GetMaxBitrate() const { return m_MaxBitrate; }
+ AP4_UI32 GetAvgBitrate() const { return m_AvgBitrate; }
+
+ // methods
+ AP4_EsDescriptor* CreateEsDescriptor() const;
+
+ protected:
+ // members
+ StreamType m_StreamType;
+ OTI m_ObjectTypeId;
+ AP4_DataBuffer* m_DecoderInfo;
+ AP4_UI32 m_BufferSize;
+ AP4_UI32 m_MaxBitrate;
+ AP4_UI32 m_AvgBitrate;
+
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegSystemSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegSystemSampleDescription : public AP4_MpegSampleDescription
+{
+public:
+ // constructor
+ AP4_MpegSystemSampleDescription(StreamType type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+
+ // methods
+ AP4_Atom* ToAtom() const;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegAudioSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegAudioSampleDescription : public AP4_MpegSampleDescription
+{
+public:
+ // constructor
+ AP4_MpegAudioSampleDescription(OTI oti,
+ unsigned int sample_rate,
+ unsigned int sample_size,
+ unsigned int channel_count,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+
+ // accessors
+ AP4_UI32 GetSampleRate() { return m_SampleRate; }
+ AP4_UI16 GetSampleSize() { return m_SampleSize; }
+ AP4_UI16 GetChannelCount() { return m_ChannelCount; }
+
+ // methods
+ AP4_Atom* ToAtom() const;
+
+protected:
+ // members
+ AP4_UI32 m_SampleRate;
+ AP4_UI16 m_SampleSize;
+ AP4_UI16 m_ChannelCount;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegVideoSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegVideoSampleDescription : public AP4_MpegSampleDescription
+{
+public:
+ // constructor
+ AP4_MpegVideoSampleDescription(OTI oti,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+
+ // accessors
+ AP4_UI32 GetWidth() { return m_Width; }
+ AP4_UI16 GetHeight() { return m_Height; }
+ AP4_UI16 GetDepth() { return m_Depth; }
+ const char* GetCompressorName() { return m_CompressorName.c_str(); }
+
+ // methods
+ AP4_Atom* ToAtom() const;
+
+protected:
+ // members
+ AP4_UI16 m_Width;
+ AP4_UI16 m_Height;
+ AP4_UI16 m_Depth;
+ AP4_String m_CompressorName;
+};
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_MpegSampleDescription::StreamType AP4_FORBIDDEN_STREAM_TYPE = 0x00;
+const AP4_MpegSampleDescription::StreamType AP4_OD_STREAM_TYPE = 0x01;
+const AP4_MpegSampleDescription::StreamType AP4_CR_STREAM_TYPE = 0x02;
+const AP4_MpegSampleDescription::StreamType AP4_BIFS_STREAM_TYPE = 0x03;
+const AP4_MpegSampleDescription::StreamType AP4_VISUAL_STREAM_TYPE = 0x04;
+const AP4_MpegSampleDescription::StreamType AP4_AUDIO_STREAM_TYPE = 0x05;
+const AP4_MpegSampleDescription::StreamType AP4_MPEG7_STREAM_TYPE = 0x06;
+const AP4_MpegSampleDescription::StreamType AP4_IPMP_STREAM_TYPE = 0x07;
+const AP4_MpegSampleDescription::StreamType AP4_OCI_STREAM_TYPE = 0x08;
+const AP4_MpegSampleDescription::StreamType AP4_MPEGJ_STREAM_TYPE = 0x09;
+
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_SYSTEM_OTI = 0x01;
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_SYSTEM_COR_OTI = 0x02;
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_VISUAL_OTI = 0x20;
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_AUDIO_OTI = 0x40;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_SIMPLE_OTI = 0x60;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_MAIN_OTI = 0x61;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_SNR_OTI = 0x62;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_SPATIAL_OTI = 0x63;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_HIGH_OTI = 0x64;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_422_OTI = 0x65;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_AAC_AUDIO_MAIN_OTI = 0x66;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_AAC_AUDIO_LC_OTI = 0x67;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_AAC_AUDIO_SSRP_OTI = 0x68;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_PART3_AUDIO_OTI = 0x69;
+const AP4_MpegSampleDescription::OTI AP4_MPEG1_VISUAL_OTI = 0x6A;
+const AP4_MpegSampleDescription::OTI AP4_MPEG1_AUDIO_OTI = 0x6B;
+const AP4_MpegSampleDescription::OTI AP4_JPEG_OTI = 0x6C;
+
+const AP4_MpegSampleDescription::OTI AP4_NERO_VOBSUB = 0xE0;
+
+#endif // _AP4_SAMPLE_DESCRIPTION_H_
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.cpp
new file mode 100644
index 000000000..9b5a37101
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.cpp
@@ -0,0 +1,1136 @@
+/*****************************************************************
+|
+| AP4 - sample entries
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4SampleEntry.h"
+#include "Ap4Utils.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4FtabAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::AP4_SampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry::AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_UI16 data_reference_index) :
+ AP4_ContainerAtom(format, AP4_ATOM_HEADER_SIZE+8, false),
+ m_DataReferenceIndex(data_reference_index)
+{
+ m_Reserved1[0] = 0;
+ m_Reserved1[1] = 0;
+ m_Reserved1[2] = 0;
+ m_Reserved1[3] = 0;
+ m_Reserved1[4] = 0;
+ m_Reserved1[5] = 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::AP4_SampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry::AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_Size size) :
+ AP4_ContainerAtom(format, size)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::AP4_SampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry::AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(format, size)
+{
+ // read the fields before the children atoms
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_SampleEntry::GetFieldsSize()
+{
+ return 8;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ stream.Read(m_Reserved1, sizeof(m_Reserved1), NULL);
+ stream.ReadUI16(m_DataReferenceIndex);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // reserved1
+ result = stream.Write(m_Reserved1, sizeof(m_Reserved1));
+ if (AP4_FAILED(result)) return result;
+
+ // data reference index
+ result = stream.WriteUI16(m_DataReferenceIndex);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::Write(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the header
+ result = WriteHeader(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // write the fields
+ result = WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // write the children atoms
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("data_reference_index", m_DataReferenceIndex);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::Inspect(AP4_AtomInspector& inspector)
+{
+ // inspect the header
+ InspectHeader(inspector);
+
+ // inspect the fields
+ InspectFields(inspector);
+
+ // inspect children
+ m_Children.Apply(AP4_AtomListInspector(inspector));
+
+ // finish
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::OnChildChanged
++---------------------------------------------------------------------*/
+void
+AP4_SampleEntry::OnChildChanged(AP4_Atom*)
+{
+ // remcompute our size
+ m_Size = GetHeaderSize()+GetFieldsSize();
+ m_Children.Apply(AP4_AtomSizeAdder(m_Size));
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_SampleEntry::ToSampleDescription()
+{
+ return new AP4_UnknownSampleDescription(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor) :
+ AP4_SampleEntry(format)
+{
+ if (descriptor) AddChild(new AP4_EsdsAtom(descriptor));
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_Size size) :
+ AP4_SampleEntry(format, size)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_SampleEntry(format, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+const AP4_DecoderConfigDescriptor*
+AP4_MpegSampleEntry::GetDecoderConfigDescriptor()
+{
+ AP4_Atom* child = GetChild(AP4_ATOM_TYPE_ESDS);
+
+ if(!child && (child = GetChild(AP4_ATOM_TYPE_WAVE)))
+ {
+ if(AP4_ContainerAtom* wave = dynamic_cast<AP4_ContainerAtom*>(child))
+ {
+ child = wave->GetChild(AP4_ATOM_TYPE_ESDS);
+ }
+ }
+
+ if (child) {
+ AP4_EsdsAtom* esds = (AP4_EsdsAtom*)child;
+
+ // get the es descriptor
+ const AP4_EsDescriptor* es_desc = esds->GetEsDescriptor();
+ if (es_desc == NULL) return NULL;
+
+ // get the decoder config descriptor
+ return es_desc->GetDecoderConfigDescriptor();
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry(AP4_EsDescriptor* descriptor) :
+ AP4_MpegSampleEntry(AP4_ATOM_TYPE_MP4S, descriptor)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_MpegSampleEntry(AP4_ATOM_TYPE_MP4S, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_Mp4sSampleEntry::ToSampleDescription()
+{
+ // get the decoder config descriptor
+ const AP4_DecoderConfigDescriptor* dc_desc;
+ dc_desc = GetDecoderConfigDescriptor();
+ if (dc_desc == NULL) return NULL;
+ const AP4_DataBuffer* dsi = NULL;
+ const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
+ dc_desc->GetDecoderSpecificInfoDescriptor();
+ if (dsi_desc != NULL) {
+ dsi = &dsi_desc->GetDecoderSpecificInfo();
+ }
+
+ // create a sample description
+ return new AP4_MpegSystemSampleDescription(
+ dc_desc->GetStreamType(),
+ dc_desc->GetObjectTypeIndication(),
+ dsi,
+ dc_desc->GetBufferSize(),
+ dc_desc->GetMaxBitrate(),
+ dc_desc->GetAvgBitrate());
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::AP4_AudioSampleEntry
++---------------------------------------------------------------------*/
+AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count) :
+ AP4_MpegSampleEntry(format, descriptor),
+ m_DescriptionVersion(0),
+ m_RevisionLevel(0),
+ m_Vendor(0),
+ m_SampleRate(sample_rate),
+ m_ChannelCount(channel_count),
+ m_SampleSize(sample_size)
+{
+ m_Size += 20;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::AP4_AudioSampleEntry
++---------------------------------------------------------------------*/
+AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_MpegSampleEntry(format, size)
+{
+ // read fields
+ ReadFields(stream);
+
+ // must be called after m_DescriptionVersion was already set
+ AP4_Size fields_size = GetFieldsSize();
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_AudioSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize() + 20 + (m_DescriptionVersion == 1 ? 16 : 0);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AudioSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // read the fields of this class
+ stream.ReadUI16(m_DescriptionVersion);
+ stream.ReadUI16(m_RevisionLevel);
+ stream.ReadUI32(m_Vendor);
+
+ if(m_DescriptionVersion == 0 || m_DescriptionVersion == 1)
+ {
+ stream.ReadUI16(m_ChannelCount);
+ stream.ReadUI16(m_SampleSize);
+ stream.ReadUI16(m_CompressionID);
+ stream.ReadUI16(m_PacketSize);
+ stream.ReadUI32(m_SampleRate);
+
+ if(m_DescriptionVersion == 1)
+ {
+ stream.ReadUI32(m_SamplesPerPacket);
+ stream.ReadUI32(m_BytesPerPacket);
+ stream.ReadUI32(m_BytesPerFrame);
+ stream.ReadUI32(m_BytesPerSample);
+ }
+ }
+ else if(m_DescriptionVersion == 2)
+ {
+ char junk[16];
+
+ stream.Read(junk, 12); // always 00 03 00 10 FF FE 00 00 00 01 00 00
+
+ AP4_UI32 SizeOfStructOnly;
+ stream.ReadUI32(SizeOfStructOnly);
+ if(SizeOfStructOnly < 0x48) return AP4_FAILURE;
+
+ m_SampleSize = 0;
+
+ AP4_UI64 SampleRate;
+ stream.ReadUI64(SampleRate);
+ m_SampleRate = (AP4_UI32)(*(double*)&SampleRate * 65536);
+
+ AP4_UI32 ChannelCount;
+ stream.ReadUI32(ChannelCount);
+ m_ChannelCount = (AP4_UI16)ChannelCount;
+
+ stream.Read(junk, 4); // always 7f 00 00 00
+ stream.Read(junk, 16); // constBitsPerChannel, formatSpecificFlags, constBytesPerAudioPacket, constLPCMFramesPerAudioPacket
+
+ SizeOfStructOnly -= 0x48;
+
+ if(SizeOfStructOnly > 0)
+ {
+ AP4_Offset offset;
+ stream.Tell(offset);
+ stream.Seek(offset + SizeOfStructOnly);
+ }
+ }
+ else
+ {
+ return AP4_FAILURE;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AudioSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the fields of the base class
+ result = AP4_SampleEntry::WriteFields(stream);
+
+ //
+ result = stream.WriteUI16(m_DescriptionVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_RevisionLevel);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Vendor);
+ if (AP4_FAILED(result)) return result;
+
+ // channel count
+ result = stream.WriteUI16(m_ChannelCount);
+ if (AP4_FAILED(result)) return result;
+
+ // sample size
+ result = stream.WriteUI16(m_SampleSize);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined1
+ result = stream.WriteUI16(m_CompressionID);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved3
+ result = stream.WriteUI16(m_PacketSize);
+ if (AP4_FAILED(result)) return result;
+
+ // sample rate
+ result = stream.WriteUI32(m_SampleRate);
+ if (AP4_FAILED(result)) return result;
+
+ if(m_DescriptionVersion == 1)
+ {
+ result = stream.WriteUI32(m_SamplesPerPacket);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_BytesPerPacket);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_BytesPerFrame);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_BytesPerSample);
+ if (AP4_FAILED(result)) return result;
+ }
+ else if(m_DescriptionVersion != 0)
+ {
+ return AP4_FAILURE;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AudioSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // dump the fields from the base class
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // fields
+ inspector.AddField("channel_count", m_ChannelCount);
+ inspector.AddField("sample_size", m_SampleSize);
+ inspector.AddField("sample_rate", m_SampleRate>>16);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_AudioSampleEntry::ToSampleDescription()
+{
+ // get the decoder config descriptor
+ const AP4_DecoderConfigDescriptor* dc_desc;
+ dc_desc = GetDecoderConfigDescriptor();
+ if (dc_desc == NULL) return NULL;
+ const AP4_DataBuffer* dsi = NULL;
+ const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
+ dc_desc->GetDecoderSpecificInfoDescriptor();
+ if (dsi_desc != NULL) {
+ dsi = &dsi_desc->GetDecoderSpecificInfo();
+ }
+
+ // create a sample description
+ return new AP4_MpegAudioSampleDescription(
+ dc_desc->GetObjectTypeIndication(),
+ m_SampleRate>>16,
+ m_SampleSize,
+ m_ChannelCount,
+ dsi,
+ dc_desc->GetBufferSize(),
+ dc_desc->GetMaxBitrate(),
+ dc_desc->GetAvgBitrate());
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor) :
+ AP4_AudioSampleEntry(AP4_ATOM_TYPE_MP4A,
+ descriptor,
+ sample_rate,
+ sample_size,
+ channel_count)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_AudioSampleEntry(AP4_ATOM_TYPE_MP4A, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::AP4_VisualSampleEntry
++---------------------------------------------------------------------*/
+AP4_VisualSampleEntry::AP4_VisualSampleEntry(
+ AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name) :
+ AP4_MpegSampleEntry(format, descriptor),
+ m_Predefined1(0),
+ m_Reserved2(0),
+ m_Width(width),
+ m_Height(height),
+ m_HorizResolution(0x00480000),
+ m_VertResolution(0x00480000),
+ m_Reserved3(0),
+ m_FrameCount(1),
+ m_CompressorName(compressor_name),
+ m_Depth(depth),
+ m_Predefined3(0xFFFF)
+{
+ memset(m_Predefined2, 0, sizeof(m_Predefined2));
+ m_Size += 70;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::AP4_VisualSampleEntry
++---------------------------------------------------------------------*/
+AP4_VisualSampleEntry::AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_MpegSampleEntry(format, size)
+{
+ // read fields
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_VisualSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize()+70;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VisualSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // read fields from this class
+ stream.ReadUI16(m_Predefined1);
+ stream.ReadUI16(m_Reserved2);
+ stream.Read(m_Predefined2, sizeof(m_Predefined2), NULL);
+ stream.ReadUI16(m_Width);
+ stream.ReadUI16(m_Height);
+ stream.ReadUI32(m_HorizResolution);
+ stream.ReadUI32(m_VertResolution);
+ stream.ReadUI32(m_Reserved3);
+ stream.ReadUI16(m_FrameCount);
+
+ char compressor_name[33];
+ stream.Read(compressor_name, 32);
+ int name_length = compressor_name[0];
+ if (name_length < 32) {
+ compressor_name[name_length+1] = 0;
+ m_CompressorName = &compressor_name[1];
+ }
+
+ stream.ReadUI16(m_Depth);
+ stream.ReadUI16(m_Predefined3);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VisualSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the fields of the base class
+ result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined1
+ result = stream.WriteUI16(m_Predefined1);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved2
+ result = stream.WriteUI16(m_Reserved2);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined2
+ result = stream.Write(m_Predefined2, sizeof(m_Predefined2));
+ if (AP4_FAILED(result)) return result;
+
+ // width
+ result = stream.WriteUI16(m_Width);
+ if (AP4_FAILED(result)) return result;
+
+ // height
+ result = stream.WriteUI16(m_Height);
+ if (AP4_FAILED(result)) return result;
+
+ // horizontal resolution
+ result = stream.WriteUI32(m_HorizResolution);
+ if (AP4_FAILED(result)) return result;
+
+ // vertical resolution
+ result = stream.WriteUI32(m_VertResolution);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved3
+ result = stream.WriteUI32(m_Reserved3);
+ if (AP4_FAILED(result)) return result;
+
+ // frame count
+ result = stream.WriteUI16(m_FrameCount);
+ if (AP4_FAILED(result)) return result;
+
+ // compressor name
+ unsigned char compressor_name[32];
+ unsigned int name_length = m_CompressorName.length();
+ if (name_length > 31) name_length = 31;
+ compressor_name[0] = name_length;
+ for (unsigned int i=0; i<name_length; i++) {
+ compressor_name[i+1] = m_CompressorName[i];
+ }
+ for (unsigned int i=name_length+1; i<32; i++) {
+ compressor_name[i] = 0;
+ }
+ result = stream.Write(compressor_name, 32);
+ if (AP4_FAILED(result)) return result;
+
+ // depth
+ result = stream.WriteUI16(m_Depth);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined3
+ result = stream.WriteUI16(m_Predefined3);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VisualSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // dump the fields of the base class
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // fields
+ inspector.AddField("width", m_Width);
+ inspector.AddField("height", m_Height);
+ inspector.AddField("compressor", m_CompressorName.c_str());
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_VisualSampleEntry::ToSampleDescription()
+{
+ // get the decoder config descriptor
+ const AP4_DecoderConfigDescriptor* dc_desc;
+ dc_desc = GetDecoderConfigDescriptor();
+ if (dc_desc == NULL) return NULL;
+ const AP4_DataBuffer* dsi = NULL;
+ const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
+ dc_desc->GetDecoderSpecificInfoDescriptor();
+ if (dsi_desc != NULL) {
+ dsi = &dsi_desc->GetDecoderSpecificInfo();
+ }
+
+ // create a sample description
+ return new AP4_MpegVideoSampleDescription(
+ dc_desc->GetObjectTypeIndication(),
+ m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.c_str(),
+ dsi,
+ dc_desc->GetBufferSize(),
+ dc_desc->GetMaxBitrate(),
+ dc_desc->GetAvgBitrate());
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_MP4V,
+ descriptor,
+ width,
+ height,
+ depth,
+ compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4vSampleEntry::AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_MP4V, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Avc1SampleEntry::AP4_Avc1SampleEntry
++---------------------------------------------------------------------*/
+AP4_Avc1SampleEntry::AP4_Avc1SampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_AVC1,
+ descriptor,
+ width,
+ height,
+ depth,
+ compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Avc1SampleEntry::AP4_Avc1SampleEntry
++---------------------------------------------------------------------*/
+AP4_Avc1SampleEntry::AP4_Avc1SampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_AVC1, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_UI16 hint_track_version,
+ AP4_UI16 highest_compatible_version,
+ AP4_UI32 max_packet_size,
+ AP4_UI32 timescale):
+ AP4_SampleEntry(AP4_ATOM_TYPE_RTP),
+ m_HintTrackVersion(hint_track_version),
+ m_HighestCompatibleVersion(highest_compatible_version),
+ m_MaxPacketSize(max_packet_size)
+{
+ // build an atom for timescale
+ AddChild(new AP4_TimsAtom(timescale));
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
+ AP4_SampleEntry(AP4_ATOM_TYPE_RTP, size)
+{
+ // read fields
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::~AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+AP4_RtpHintSampleEntry::~AP4_RtpHintSampleEntry()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_RtpHintSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize()+8;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpHintSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // data
+ result = stream.ReadUI16(m_HintTrackVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_HighestCompatibleVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI32(m_MaxPacketSize);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpHintSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // data
+ result = stream.WriteUI16(m_HintTrackVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_HighestCompatibleVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_MaxPacketSize);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpHintSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // sample entry
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // fields
+ inspector.AddField("hint_track_version", m_HintTrackVersion);
+ inspector.AddField("highest_compatible_version", m_HighestCompatibleVersion);
+ inspector.AddField("max_packet_size", m_MaxPacketSize);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::AP4_TextSampleEntry
++---------------------------------------------------------------------*/
+AP4_TextSampleEntry::AP4_TextSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
+ AP4_SampleEntry(AP4_ATOM_TYPE_TEXT, size)
+{
+ // read fields
+ ReadFields(stream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::~AP4_TextSampleEntry
++---------------------------------------------------------------------*/
+AP4_TextSampleEntry::~AP4_TextSampleEntry()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TextSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // data
+ result = stream.ReadUI32(m_Description.DisplayFlags);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI32(m_Description.TextJustification);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Read(&m_Description.BackgroundColor, 4);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Top);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Left);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Bottom);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Right);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.StartChar);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.EndChar);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.Ascent);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.Font.Id);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.Style.Font.Face);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.Style.Font.Size);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Read(&m_Description.Style.Font.Color, 4);
+ if (AP4_FAILED(result)) return result;
+
+ // TODO: stream.ReadString(); -> m_Description.DefaultFontName
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TextSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // TODO: data
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TextSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // sample entry
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // TODO: fields
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::AP4_Tx3gSampleEntry
++---------------------------------------------------------------------*/
+AP4_Tx3gSampleEntry::AP4_Tx3gSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
+ AP4_SampleEntry(AP4_ATOM_TYPE_TX3G, size)
+{
+ // read fields
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (fdat? blnk?)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::~AP4_Tx3gSampleEntry
++---------------------------------------------------------------------*/
+AP4_Tx3gSampleEntry::~AP4_Tx3gSampleEntry()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_Tx3gSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize()+4+1+1+4+2+2+2+2+2+2+2+1+1+4;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Tx3gSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // data
+ result = stream.ReadUI32(m_Description.DisplayFlags);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.HorizontalJustification);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.VerticalJustification);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Read(&m_Description.BackgroundColor, 4);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Top);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Left);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Bottom);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Right);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.StartChar);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.EndChar);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.Font.Id);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.Style.Font.Face);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.Style.Font.Size);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Read(&m_Description.Style.Font.Color, 4);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Tx3gSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // TODO: data
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Tx3gSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // sample entry
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // TODO: fields
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::GetFontNameById
++---------------------------------------------------------------------*/
+
+AP4_Result
+AP4_Tx3gSampleEntry::GetFontNameById(AP4_Ordinal Id, AP4_String& Name)
+{
+ if(AP4_FtabAtom* ftab = dynamic_cast<AP4_FtabAtom*>(GetChild(AP4_ATOM_TYPE_FTAB)))
+ {
+ AP4_Array<AP4_FtabAtom::AP4_Tx3gFontRecord> FontRecords = ftab->GetFontRecords();
+
+ for(int i = 0, j = FontRecords.ItemCount(); i < j; i++)
+ {
+ if(Id == FontRecords[i].Id)
+ {
+ Name = FontRecords[i].Name;
+ return AP4_SUCCESS;
+ }
+ }
+ }
+
+ return AP4_FAILURE;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.h
new file mode 100644
index 000000000..f9ad35ddd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleEntry.h
@@ -0,0 +1,368 @@
+/*****************************************************************
+|
+| AP4 - sample entries
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_ENTRY_H_
+#define _AP4_SAMPLE_ENTRY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4EsdsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_SampleDescription;
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry
++---------------------------------------------------------------------*/
+class AP4_SampleEntry : public AP4_ContainerAtom
+{
+ public:
+ // methods
+ AP4_SampleEntry(AP4_Atom::Type format, AP4_UI16 data_ref_index = 1);
+ AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_UI16 GetDataReferenceIndex() { return m_DataReferenceIndex; }
+ virtual AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual AP4_SampleDescription* ToSampleDescription();
+
+ // AP4_AtomParent methods
+ virtual void OnChildChanged(AP4_Atom* child);
+
+ protected:
+ // constructor
+ AP4_SampleEntry(AP4_Atom::Type format, AP4_Size size);
+
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_UI08 m_Reserved1[6]; // = 0
+ AP4_UI16 m_DataReferenceIndex;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+class AP4_MpegSampleEntry : public AP4_SampleEntry
+{
+protected:
+ // constructor
+ AP4_MpegSampleEntry(AP4_Atom::Type format);
+ AP4_MpegSampleEntry(AP4_Atom::Type format, AP4_Size size);
+ AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor);
+ AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ // methods
+ const AP4_DecoderConfigDescriptor* GetDecoderConfigDescriptor();
+};
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Mp4sSampleEntry : public AP4_MpegSampleEntry
+{
+ public:
+ // constructors
+ AP4_Mp4sSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Mp4sSampleEntry(AP4_EsDescriptor* descriptor);
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+};
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry
++---------------------------------------------------------------------*/
+class AP4_AudioSampleEntry : public AP4_MpegSampleEntry
+{
+ public:
+ // methods
+ AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count);
+ AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ // accessors
+ AP4_UI32 GetSampleRate() { return m_SampleRate>>16; }
+ AP4_UI16 GetSampleSize() { return m_SampleSize; }
+ AP4_UI16 GetChannelCount() { return m_ChannelCount; }
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_UI16 m_DescriptionVersion;
+ AP4_UI16 m_RevisionLevel;
+ AP4_UI32 m_Vendor;
+ AP4_UI16 m_ChannelCount;
+ AP4_UI16 m_SampleSize;
+ AP4_UI16 m_CompressionID;
+ AP4_UI16 m_PacketSize;
+ AP4_UI32 m_SampleRate;
+ // m_Version == 1 ?
+ AP4_UI32 m_SamplesPerPacket;
+ AP4_UI32 m_BytesPerPacket;
+ AP4_UI32 m_BytesPerFrame;
+ AP4_UI32 m_BytesPerSample;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Mp4aSampleEntry : public AP4_AudioSampleEntry
+{
+ public:
+ // constructors
+ AP4_Mp4aSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor);
+};
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry
++---------------------------------------------------------------------*/
+class AP4_VisualSampleEntry : public AP4_MpegSampleEntry
+{
+ public:
+ // methods
+ AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name);
+ AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ // accessors
+ AP4_UI16 GetWidth() { return m_Width; }
+ AP4_UI16 GetHeight() { return m_Height; }
+ AP4_UI16 GetHorizResolution(){ return m_HorizResolution; }
+ AP4_UI16 GetVertResolution() { return m_VertResolution; }
+ AP4_UI16 GetDepth() { return m_Depth; }
+ const char* GetCompressorName() { return m_CompressorName.c_str(); }
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ //members
+ AP4_UI16 m_Predefined1; // = 0
+ AP4_UI16 m_Reserved2; // = 0
+ AP4_UI08 m_Predefined2[12]; // = 0
+ AP4_UI16 m_Width;
+ AP4_UI16 m_Height;
+ AP4_UI32 m_HorizResolution; // = 0x00480000 (72 dpi)
+ AP4_UI32 m_VertResolution; // = 0x00480000 (72 dpi)
+ AP4_UI32 m_Reserved3; // = 0
+ AP4_UI16 m_FrameCount; // = 1
+ AP4_String m_CompressorName;
+ AP4_UI16 m_Depth; // = 0x0018
+ AP4_UI16 m_Predefined3; // = 0xFFFF
+};
+
+/*----------------------------------------------------------------------
+| AP4_Mp4vSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Mp4vSampleEntry : public AP4_VisualSampleEntry
+{
+ public:
+ // constructors
+ AP4_Mp4vSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Mp4vSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor);
+};
+
+/*----------------------------------------------------------------------
+| AP4_Avc1SampleEntry
++---------------------------------------------------------------------*/
+class AP4_Avc1SampleEntry : public AP4_VisualSampleEntry
+{
+public:
+ // constructors
+ AP4_Avc1SampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Avc1SampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor);
+};
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+class AP4_RtpHintSampleEntry : public AP4_SampleEntry
+{
+public:
+ // methods
+ AP4_RtpHintSampleEntry(AP4_UI16 hint_track_version,
+ AP4_UI16 highest_compatible_version,
+ AP4_UI32 max_packet_size,
+ AP4_UI32 timescale);
+ AP4_RtpHintSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ virtual ~AP4_RtpHintSampleEntry();
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_UI16 m_HintTrackVersion;
+ AP4_UI16 m_HighestCompatibleVersion;
+ AP4_UI32 m_MaxPacketSize;
+};
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry
++---------------------------------------------------------------------*/
+class AP4_TextSampleEntry : public AP4_SampleEntry
+{
+public:
+ // methods
+ AP4_TextSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ virtual ~AP4_TextSampleEntry();
+
+ struct AP4_TextDescription
+ {
+ AP4_UI32 DisplayFlags;
+ AP4_UI32 TextJustification;
+ AP4_UI32 BackgroundColor;
+ struct {AP4_UI16 Top, Left, Bottom, Right;} TextBox;
+ struct {AP4_UI16 StartChar, EndChar, Ascent; struct {AP4_UI16 Id; AP4_UI08 Face, Size; AP4_UI32 Color;} Font;} Style;
+ AP4_String DefaultFontName;
+ };
+
+ const AP4_TextDescription& GetDescription() const { return m_Description; };
+
+protected:
+ // methods
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_TextDescription m_Description;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Tx3gSampleEntry : public AP4_SampleEntry
+{
+public:
+ // methods
+ AP4_Tx3gSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ virtual ~AP4_Tx3gSampleEntry();
+
+ struct AP4_Tx3gDescription
+ {
+ AP4_UI32 DisplayFlags;
+ AP4_UI08 HorizontalJustification;
+ AP4_UI08 VerticalJustification;
+ AP4_UI32 BackgroundColor;
+ struct {AP4_UI16 Top, Left, Bottom, Right;} TextBox;
+ struct {AP4_UI16 StartChar, EndChar; struct {AP4_UI16 Id; AP4_UI08 Face, Size; AP4_UI32 Color;} Font;} Style;
+ };
+
+ const AP4_Tx3gDescription& GetDescription() const { return m_Description; };
+
+ AP4_Result GetFontNameById(AP4_Ordinal Id, AP4_String& Name);
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_Tx3gDescription m_Description;
+};
+
+#endif // _AP4_SAMPLE_ENTRY_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.cpp
new file mode 100644
index 000000000..ab07f2b02
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.cpp
@@ -0,0 +1,113 @@
+/*****************************************************************
+|
+| AP4 - Sample Table Interface
+|
+| Copyright 2003-2004 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4SampleTable.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4StszAtom.h"
+#include "Ap4StscAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4SttsAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SampleTable::GenerateStblAtom
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl)
+{
+ // create the stbl container
+ stbl = new AP4_ContainerAtom(AP4_ATOM_TYPE_STBL);
+
+ // create the stsd atom
+ AP4_StsdAtom* stsd = new AP4_StsdAtom(this);
+
+ // create the stsz atom
+ AP4_StszAtom* stsz = new AP4_StszAtom();
+
+ // create the stsc atom
+ AP4_StscAtom* stsc = new AP4_StscAtom();
+
+ // start chunk table
+ AP4_Cardinal samples_in_chunk = 0;
+ AP4_Offset current_chunk_offset = 0;
+ AP4_Size current_chunk_size = 0;
+ AP4_Array<AP4_UI32> chunk_offsets;
+
+ // process all the samples
+ AP4_Cardinal sample_count = GetSampleCount();
+ for (AP4_Ordinal i=0; i<sample_count; i++) {
+ AP4_Sample sample;
+ GetSample(i, sample);
+
+ // add an entry into the stsz atom
+ stsz->AddEntry(sample.GetSize());
+
+ // adjust the current chunk info
+ current_chunk_size += sample.GetSize();
+
+ // count the sample
+ samples_in_chunk++;
+ if (samples_in_chunk == 10) {
+ // new chunk
+ chunk_offsets.Append(current_chunk_offset);
+ stsc->AddEntry(1, 10, 1);
+ samples_in_chunk = 0;
+
+ // adjust the chunk offset
+ current_chunk_offset += current_chunk_size;
+ current_chunk_size = 0;
+ }
+ }
+
+ // process any unfinished chunk
+ if (samples_in_chunk != 0) {
+ // new chunk
+ chunk_offsets.Append(current_chunk_offset);
+ stsc->AddEntry(1, samples_in_chunk, 1);
+ }
+
+ // create the stco atom
+ AP4_StcoAtom* stco = new AP4_StcoAtom(&chunk_offsets[0],
+ chunk_offsets.ItemCount());
+
+ // create the stts atom (for now, we assume sample of equal duration)
+ AP4_SttsAtom* stts = new AP4_SttsAtom();
+ stts->AddEntry(sample_count, 1000); // FIXME
+
+ // attach the children of stbl
+ stbl->AddChild(stsd);
+ stbl->AddChild(stsz);
+ stbl->AddChild(stsc);
+ stbl->AddChild(stco);
+ stbl->AddChild(stts);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.h
new file mode 100644
index 000000000..55f97a1b6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SampleTable.h
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - Sample Table Interface
+|
+| Copyright 2003-2004 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_TABLE_H_
+#define _AP4_SAMPLE_TABLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Sample.h"
+#include "Ap4Atom.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4SampleDescription.h"
+
+/*----------------------------------------------------------------------
+| AP4_SampleTable
++---------------------------------------------------------------------*/
+class AP4_SampleTable {
+public:
+ // constructors and destructor
+ virtual ~AP4_SampleTable() {};
+
+ // methods
+ virtual AP4_Result GenerateStblAtom(AP4_ContainerAtom*& stbl);
+ virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample) = 0;
+ virtual AP4_Cardinal GetSampleCount() = 0;
+ virtual AP4_Cardinal GetSampleDescriptionCount() = 0;
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index) = 0;
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index) = 0;
+};
+
+#endif // _AP4_SAMPLE_TABLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.cpp
new file mode 100644
index 000000000..e68b2e287
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.cpp
@@ -0,0 +1,120 @@
+/*****************************************************************
+|
+| AP4 - schm Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SchmAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom::AP4_SchmAtom
++---------------------------------------------------------------------*/
+AP4_SchmAtom::AP4_SchmAtom(AP4_UI32 scheme_type,
+ AP4_UI32 scheme_version,
+ const char* scheme_uri) :
+ AP4_Atom(AP4_ATOM_TYPE_SCHM, AP4_FULL_ATOM_HEADER_SIZE+8, true),
+ m_SchemeType(scheme_type),
+ m_SchemeVersion(scheme_version)
+{
+ if (scheme_uri) {
+ m_SchemeUri = scheme_uri;
+ m_Flags = 1;
+ m_Size += m_SchemeUri.length()+1;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom::AP4_SchmAtom
++---------------------------------------------------------------------*/
+AP4_SchmAtom::AP4_SchmAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_SCHM, size, true, stream)
+{
+ stream.ReadUI32(m_SchemeType);
+ stream.ReadUI32(m_SchemeVersion);
+ if (m_Flags & 1) {
+ int str_size = size-(AP4_FULL_ATOM_HEADER_SIZE+8);
+ if (str_size > 0) {
+ char* str = new char[str_size];
+ stream.Read(str, str_size);
+ str[str_size-1] = '\0'; // force null-termination
+ m_SchemeUri = str;
+ delete[] str;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SchmAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // scheme type
+ result = stream.WriteUI32(m_SchemeType);
+ if (AP4_FAILED(result)) return result;
+
+ // scheme version
+ result = stream.WriteUI32(m_SchemeVersion);
+ if (AP4_FAILED(result)) return result;
+
+ // uri if needed
+ if (m_Flags & 1) {
+ result = stream.Write(m_SchemeUri.c_str(), m_SchemeUri.length()+1);
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_FULL_ATOM_HEADER_SIZE+8+m_SchemeUri.length()+1);
+ while (padding--) {
+ stream.WriteUI08(0);
+ }
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SchmAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char st[5];
+ AP4_FormatFourChars(st, m_SchemeType);
+ inspector.AddField("scheme_type", st);
+ inspector.AddField("scheme_version", m_SchemeVersion);
+ if (m_Flags & 1) {
+ inspector.AddField("scheme_uri", m_SchemeUri.c_str());
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.h
new file mode 100644
index 000000000..d5149fa1c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SchmAtom.h
@@ -0,0 +1,68 @@
+/*****************************************************************
+|
+| AP4 - schm Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SCHM_ATOM_H_
+#define _AP4_SCHM_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom
++---------------------------------------------------------------------*/
+class AP4_SchmAtom : public AP4_Atom
+{
+ public:
+ // constructors
+ AP4_SchmAtom(AP4_UI32 scheme_type,
+ AP4_UI32 scheme_version,
+ const char* scheme_uri = NULL);
+ AP4_SchmAtom(AP4_Size size, AP4_ByteStream& stream);
+
+ // methods
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ AP4_UI32 GetSchemeType() { return m_SchemeType; }
+ AP4_UI32 GetSchemeVersion() { return m_SchemeVersion; }
+ AP4_String& GetSchemeUri() { return m_SchemeUri; }
+
+ private:
+ // members
+ AP4_UI32 m_SchemeType;
+ AP4_UI32 m_SchemeVersion;
+ AP4_String m_SchemeUri;
+};
+
+#endif // _AP4_SCHM_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.cpp
new file mode 100644
index 000000000..26d0e0410
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.cpp
@@ -0,0 +1,100 @@
+/*****************************************************************
+|
+| AP4 - sdp Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::AP4_SdpAtom
++---------------------------------------------------------------------*/
+AP4_SdpAtom::AP4_SdpAtom(const char* sdp_text) :
+ AP4_Atom(AP4_ATOM_TYPE_SDP, AP4_ATOM_HEADER_SIZE, false),
+ m_SdpText(sdp_text)
+{
+ m_Size += m_SdpText.length()+1;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::AP4_SdpAtom
++---------------------------------------------------------------------*/
+AP4_SdpAtom::AP4_SdpAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_SDP, size, false, stream)
+{
+ // sdptext
+ AP4_Size str_size = size-AP4_ATOM_HEADER_SIZE;
+ if (str_size > 0) {
+ char* str = new char[str_size+1];
+ stream.Read(str, str_size);
+ str[str_size] = '\0'; // force null-termination
+ m_SdpText = str;
+ delete[] str;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SdpAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // sdptext
+ AP4_Result result = stream.Write(m_SdpText.c_str(), m_SdpText.length());
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_ATOM_HEADER_SIZE+m_SdpText.length());
+ while (padding--) stream.WriteUI08(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SdpAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("sdp_text", m_SdpText.c_str());
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::GetSdpText
++---------------------------------------------------------------------*/
+const AP4_String&
+AP4_SdpAtom::GetSdpText() const
+{
+ return m_SdpText;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.h
new file mode 100644
index 000000000..5ed54c9c2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SdpAtom.h
@@ -0,0 +1,61 @@
+/*****************************************************************
+|
+| AP4 - sdp Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_SDP_ATOM_H_
+#define _AP4_SDP_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom
++---------------------------------------------------------------------*/
+class AP4_SdpAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_SdpAtom(AP4_Size size, AP4_ByteStream& stream);
+ AP4_SdpAtom(const char* sdp_text);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ const AP4_String& GetSdpText() const;
+
+private:
+ // members
+ AP4_String m_SdpText;
+};
+
+#endif // _AP4_SDP_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SmhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SmhdAtom.cpp
new file mode 100644
index 000000000..6aa5f7b58
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SmhdAtom.cpp
@@ -0,0 +1,85 @@
+/*****************************************************************
+|
+| AP4 - smhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SmhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom::AP4_SmhdAtom
++---------------------------------------------------------------------*/
+AP4_SmhdAtom::AP4_SmhdAtom(AP4_UI16 balance) :
+ AP4_Atom(AP4_ATOM_TYPE_SMHD, 4+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_Balance(balance)
+{
+ m_Reserved = 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom::AP4_SmhdAtom
++---------------------------------------------------------------------*/
+AP4_SmhdAtom::AP4_SmhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_SMHD, size, true, stream)
+{
+ stream.ReadUI16(m_Balance);
+ stream.ReadUI16(m_Reserved);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SmhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // balance
+ result = stream.WriteUI16(m_Balance);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved
+ result = stream.WriteUI16(m_Reserved);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SmhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("balance", m_Balance);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SmhdAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SmhdAtom.h
new file mode 100644
index 000000000..eaabb8458
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SmhdAtom.h
@@ -0,0 +1,57 @@
+/*****************************************************************
+|
+| AP4 - smhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_SMHD_ATOM_H_
+#define _AP4_SMHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom
++---------------------------------------------------------------------*/
+class AP4_SmhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_SmhdAtom(AP4_UI16 balance);
+ AP4_SmhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI16 m_Balance;
+ AP4_UI16 m_Reserved;
+};
+
+#endif // _AP4_SMHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.cpp
new file mode 100644
index 000000000..3e6a96bc9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.cpp
@@ -0,0 +1,151 @@
+/*****************************************************************
+|
+| AP4 - stco Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::AP4_StcoAtom
++---------------------------------------------------------------------*/
+AP4_StcoAtom::AP4_StcoAtom(AP4_UI32* entries, AP4_UI32 entry_count) :
+AP4_Atom(AP4_ATOM_TYPE_STCO,
+ AP4_FULL_ATOM_HEADER_SIZE+4+entry_count*4,
+ true),
+ m_Entries(new AP4_UI32[entry_count]),
+ m_EntryCount(entry_count)
+{
+ memcpy(m_Entries, entries, m_EntryCount*4);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::AP4_StcoAtom
++---------------------------------------------------------------------*/
+AP4_StcoAtom::AP4_StcoAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STCO, size, true, stream)
+{
+ stream.ReadUI32(m_EntryCount);
+ if (m_EntryCount > (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4) {
+ m_EntryCount = (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4;
+ }
+ m_Entries = new AP4_UI32[m_EntryCount];
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ stream.ReadUI32(m_Entries[i]);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::~AP4_StcoAtom
++---------------------------------------------------------------------*/
+AP4_StcoAtom::~AP4_StcoAtom()
+{
+ delete[] m_Entries;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::GetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // get the chunk offset
+ chunk_offset = m_Entries[chunk - 1]; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::SetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::SetChunkOffset(AP4_Ordinal chunk, AP4_Offset chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // get the chunk offset
+ m_Entries[chunk - 1] = chunk_offset; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::AdjustChunkOffsets
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::AdjustChunkOffsets(AP4_Offset offset)
+{
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ m_Entries[i] += offset;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ result = stream.WriteUI32(m_EntryCount);
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ result = stream.WriteUI32(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_EntryCount);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.h
new file mode 100644
index 000000000..7d34c932f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StcoAtom.h
@@ -0,0 +1,62 @@
+/*****************************************************************
+|
+| AP4 - stco Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STCO_ATOM_H_
+#define _AP4_STCO_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom
++---------------------------------------------------------------------*/
+class AP4_StcoAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StcoAtom(AP4_UI32* offsets, AP4_UI32 offset_count);
+ AP4_StcoAtom(AP4_Size size, AP4_ByteStream& stream);
+ ~AP4_StcoAtom();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ AP4_Cardinal GetChunkCount() { return m_EntryCount; }
+ AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& chunk_offset);
+ AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_Offset chunk_offset);
+ AP4_Result AdjustChunkOffsets(AP4_Offset offset);
+
+ private:
+ AP4_UI32* m_Entries;
+ AP4_UI32 m_EntryCount;
+};
+
+#endif // _AP4_STCO_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StscAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StscAtom.cpp
new file mode 100644
index 000000000..ce3101f02
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StscAtom.cpp
@@ -0,0 +1,224 @@
+/*****************************************************************
+|
+| AP4 - stsc Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StscAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::AP4_StscAtom
++---------------------------------------------------------------------*/
+AP4_StscAtom::AP4_StscAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_STSC, 4+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CachedChunkGroup(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::AP4_StscAtom
++---------------------------------------------------------------------*/
+AP4_StscAtom::AP4_StscAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STSC, size, true, stream),
+ m_CachedChunkGroup(0)
+{
+ AP4_UI32 first_sample = 1;
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 first_chunk;
+ AP4_UI32 samples_per_chunk;
+ AP4_UI32 sample_description_index;
+ if (stream.ReadUI32(first_chunk) == AP4_SUCCESS &&
+ stream.ReadUI32(samples_per_chunk) == AP4_SUCCESS &&
+ stream.ReadUI32(sample_description_index) == AP4_SUCCESS) {
+ if (m_Entries.ItemCount() != 0) {
+ AP4_Ordinal prev = m_Entries.ItemCount()-1;
+ m_Entries[prev].m_ChunkCount =
+ first_chunk-m_Entries[prev].m_FirstChunk;
+ first_sample +=
+ m_Entries[prev].m_ChunkCount *
+ m_Entries[prev].m_SamplesPerChunk;
+ }
+ m_Entries.Append(AP4_StscTableEntry(first_chunk,
+ first_sample,
+ samples_per_chunk,
+ sample_description_index));
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StscAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+
+ // entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ stream.WriteUI32(m_Entries[i].m_FirstChunk);
+ if (AP4_FAILED(result)) return result;
+ stream.WriteUI32(m_Entries[i].m_SamplesPerChunk);
+ if (AP4_FAILED(result)) return result;
+ stream.WriteUI32(m_Entries[i].m_SampleDescriptionIndex);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::AddEntry
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StscAtom::AddEntry(AP4_Cardinal chunk_count,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index)
+{
+ AP4_Ordinal first_chunk;
+ AP4_Ordinal first_sample;
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ if (entry_count == 0) {
+ // first entry
+ first_chunk = 1;
+ first_sample = 1;
+ } else {
+ first_chunk = m_Entries[entry_count-1].m_FirstChunk+
+ m_Entries[entry_count-1].m_ChunkCount;
+ first_sample = m_Entries[entry_count-1].m_FirstSample+
+ m_Entries[entry_count-1].m_ChunkCount*
+ m_Entries[entry_count-1].m_SamplesPerChunk;
+ }
+ m_Entries.Append(AP4_StscTableEntry(first_chunk, first_sample, chunk_count, samples_per_chunk, sample_description_index));
+
+ // update the atom size
+ m_Size += 12;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::GetChunkForSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StscAtom::GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description)
+{
+ // preconditions
+ AP4_ASSERT(sample > 0);
+
+ // decide whether to start the search from the cached index
+ // or from the start
+ AP4_Ordinal group;
+ if (m_CachedChunkGroup < m_Entries.ItemCount() &&
+ m_Entries[m_CachedChunkGroup].m_FirstSample <= sample) {
+ group = m_CachedChunkGroup;
+ } else {
+ group = 0;
+ }
+
+ // find which group of chunk contains this one
+ while (group < m_Entries.ItemCount()) {
+ AP4_Cardinal sample_count =
+ m_Entries[group].m_ChunkCount*m_Entries[group].m_SamplesPerChunk;
+ if (sample_count == 0) {
+ // unlimited samples in this group (last group)
+ if (m_Entries[group].m_FirstSample > sample) {
+ // something is wrong
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+ } else {
+ // normal group
+ if (m_Entries[group].m_FirstSample + sample_count <= sample) {
+ // the sample is not in this group
+ group++;
+ continue;
+ }
+ }
+
+ // the sample is in this group
+ if (m_Entries[group].m_SamplesPerChunk == 0) {
+ // something is wrong
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+ unsigned int chunk_offset =
+ ((sample-m_Entries[group].m_FirstSample) /
+ m_Entries[group].m_SamplesPerChunk);
+ chunk = m_Entries[group].m_FirstChunk + chunk_offset;
+ skip = sample -
+ (m_Entries[group].m_FirstSample +
+ m_Entries[group].m_SamplesPerChunk*chunk_offset);
+ sample_description = m_Entries[group].m_SampleDescriptionIndex;
+
+ // cache the result (to accelerate finding the right group
+ // next time around
+ m_CachedChunkGroup = group;
+
+ return AP4_SUCCESS;
+ }
+
+ // chunk not found
+ chunk = 0;
+ skip = 0;
+ sample_description = 0;
+ return AP4_ERROR_OUT_OF_RANGE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StscAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ // dump table entries
+ //for (unsigned int i=0; i<m_Entries.GetItemCount(); i++) {
+ // char dump[256];
+ // sprintf(dump, " f=%ld, spc=%ld, sdi=%ld\n",
+ // m_Entries[i].m_FirstChunk,
+ // m_Entries[i].m_SamplesPerChunk,
+ // m_Entries[i].m_SampleDescriptionIndex);
+ // stream.WriteString(prefix);
+ // stream.WriteString(dump);
+ //}
+
+ return AP4_SUCCESS;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StscAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StscAtom.h
new file mode 100644
index 000000000..1d2ff283c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StscAtom.h
@@ -0,0 +1,102 @@
+/*****************************************************************
+|
+| AP4 - stsc Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSC_ATOM_H_
+#define _AP4_STSC_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StscTableEntry
++---------------------------------------------------------------------*/
+class AP4_StscTableEntry {
+ public:
+ AP4_StscTableEntry() :
+ m_FirstChunk(0),
+ m_FirstSample(0),
+ m_ChunkCount(0),
+ m_SamplesPerChunk(0),
+ m_SampleDescriptionIndex(0) {}
+ AP4_StscTableEntry(AP4_Ordinal first_chunk,
+ AP4_Ordinal first_sample,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index) :
+ m_FirstChunk(first_chunk),
+ m_FirstSample(first_sample),
+ m_ChunkCount(0),
+ m_SamplesPerChunk(samples_per_chunk),
+ m_SampleDescriptionIndex(sample_description_index) {}
+ AP4_StscTableEntry(AP4_Ordinal first_chunk,
+ AP4_Ordinal first_sample,
+ AP4_Cardinal chunk_count,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index) :
+ m_FirstChunk(first_chunk),
+ m_FirstSample(first_sample),
+ m_ChunkCount(chunk_count),
+ m_SamplesPerChunk(samples_per_chunk),
+ m_SampleDescriptionIndex(sample_description_index) {}
+ AP4_Ordinal m_FirstChunk;
+ AP4_Ordinal m_FirstSample; // computed (not in file)
+ AP4_Cardinal m_ChunkCount; // computed (not in file)
+ AP4_Cardinal m_SamplesPerChunk;
+ AP4_Ordinal m_SampleDescriptionIndex;
+};
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom
++---------------------------------------------------------------------*/
+class AP4_StscAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StscAtom();
+ AP4_StscAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description);
+ virtual AP4_Result AddEntry(AP4_Cardinal chunk_count,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ private:
+ // data
+ AP4_Array<AP4_StscTableEntry> m_Entries;
+ AP4_Ordinal m_CachedChunkGroup;
+};
+
+#endif // _AP4_STSC_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.cpp
new file mode 100644
index 000000000..d2a2abb9e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.cpp
@@ -0,0 +1,190 @@
+/*****************************************************************
+|
+| AP4 - stsd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4SampleEntry.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::AP4_StsdAtom
++---------------------------------------------------------------------*/
+AP4_StsdAtom::AP4_StsdAtom(AP4_SampleTable* sample_table) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_STSD, 4+AP4_FULL_ATOM_HEADER_SIZE, true)
+{
+ AP4_Cardinal sample_description_count = sample_table->GetSampleDescriptionCount();
+ m_SampleDescriptions.EnsureCapacity(sample_description_count);
+ for (AP4_Ordinal i=0; i<sample_description_count; i++) {
+ // clear the cache entry
+ m_SampleDescriptions.Append(NULL);
+
+ // create an entry for the description
+ AP4_SampleDescription* sample_description = sample_table->GetSampleDescription(i);
+ AP4_Atom* entry = sample_description->ToAtom();
+ m_Children.Add(entry);
+
+ // update the size
+ m_Size += entry->GetSize();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::AP4_StsdAtom
++---------------------------------------------------------------------*/
+AP4_StsdAtom::AP4_StsdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_STSD, size, true, stream)
+{
+ // read the number of entries
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+
+ // read all entries
+ AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ for (unsigned int i=0; i<entry_count; i++) {
+ AP4_Atom* atom;
+ if (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom,
+ this))) {
+ atom->SetParent(this);
+ m_Children.Add(atom);
+ }
+ }
+
+ // initialize the sample description cache
+ m_SampleDescriptions.EnsureCapacity(m_Children.ItemCount());
+ for (AP4_Ordinal i=0; i<m_Children.ItemCount(); i++) {
+ m_SampleDescriptions.Append(NULL);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::~AP4_StsdAtom
++---------------------------------------------------------------------*/
+AP4_StsdAtom::~AP4_StsdAtom()
+{
+ for (AP4_Ordinal i=0; i<m_SampleDescriptions.ItemCount(); i++) {
+ delete m_SampleDescriptions[i];
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StsdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ result = stream.WriteUI32(m_Children.ItemCount());
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::OnChildChanged
++---------------------------------------------------------------------*/
+void
+AP4_StsdAtom::OnChildChanged(AP4_Atom*)
+{
+ // remcompute our size
+ m_Size = GetHeaderSize()+4;
+ m_Children.Apply(AP4_AtomSizeAdder(m_Size));
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_StsdAtom::GetSampleDescription(AP4_Ordinal index)
+{
+ // check index
+ if (index >= m_Children.ItemCount()) return NULL;
+
+ // return the description if we already have it in the internal table
+ if (m_SampleDescriptions[index]) return m_SampleDescriptions[index];
+
+ // create and cache a sample description for this entry
+ AP4_Atom* entry;
+ m_Children.Get(index, entry);
+ AP4_SampleEntry* sample_entry = dynamic_cast<AP4_SampleEntry*>(entry);
+ if (sample_entry == NULL) return NULL;
+ m_SampleDescriptions[index] = sample_entry->ToSampleDescription();
+ return m_SampleDescriptions[index];
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::GetSampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry*
+AP4_StsdAtom::GetSampleEntry(AP4_Ordinal index)
+{
+ // check index
+ if (index >= m_Children.ItemCount()) return NULL;
+
+ // return the sample entry
+ AP4_Atom* entry;
+ m_Children.Get(index, entry);
+ return dynamic_cast<AP4_SampleEntry*>(entry);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::GetSampleDescriptionCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_StsdAtom::GetSampleDescriptionCount()
+{
+ return m_Children.ItemCount();
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StsdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry-count", m_Children.ItemCount());
+
+ // inspect children
+ m_Children.Apply(AP4_AtomListInspector(inspector));
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.h
new file mode 100644
index 000000000..4ae6be58f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StsdAtom.h
@@ -0,0 +1,77 @@
+/*****************************************************************
+|
+| AP4 - stsd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSD_ATOM_H_
+#define _AP4_STSD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_SampleTable;
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom
++---------------------------------------------------------------------*/
+class AP4_StsdAtom : public AP4_ContainerAtom
+{
+ public:
+ // methods
+ AP4_StsdAtom(AP4_SampleTable* sample_table);
+ AP4_StsdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ ~AP4_StsdAtom();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Cardinal GetSampleDescriptionCount();
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ virtual AP4_SampleEntry* GetSampleEntry(AP4_Ordinal index);
+
+ // AP4_AtomParent methods
+ void OnChildChanged(AP4_Atom* child);
+
+ private:
+ // members
+ AP4_Array<AP4_SampleDescription*> m_SampleDescriptions;
+};
+
+#endif // _AP4_STSD_ATOM_H_
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StssAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StssAtom.cpp
new file mode 100644
index 000000000..e6eaaf284
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StssAtom.cpp
@@ -0,0 +1,104 @@
+/*****************************************************************
+|
+| AP4 - stss Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StssAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom::AP4_StssAtom
++---------------------------------------------------------------------*/
+AP4_StssAtom::AP4_StssAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STSS, size, true, stream)
+{
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 entry_sample_index;
+ if (stream.ReadUI32(entry_sample_index) == AP4_SUCCESS) {
+ m_Entries.Append(entry_sample_index);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StssAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ result = stream.WriteUI32(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom::IsSampleSync
++---------------------------------------------------------------------*/
+bool
+AP4_StssAtom::IsSampleSync(AP4_Ordinal sample)
+{
+ unsigned int entry_index = 0;
+
+ while (entry_index < m_Entries.ItemCount() &&
+ m_Entries[entry_index] >= sample) {
+ if (m_Entries[entry_index] == sample) {
+ return true;
+ }
+ entry_index++;
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StssAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StssAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StssAtom.h
new file mode 100644
index 000000000..ecd763097
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StssAtom.h
@@ -0,0 +1,56 @@
+/*****************************************************************
+|
+| AP4 - stss Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSS_ATOM_H_
+#define _AP4_STSS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom
++---------------------------------------------------------------------*/
+class AP4_StssAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StssAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual bool IsSampleSync(AP4_Ordinal sample);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_Array<AP4_UI32> m_Entries; // FIXME
+ private:
+};
+
+#endif // _AP4_STSS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StszAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StszAtom.cpp
new file mode 100644
index 000000000..1e84a475d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StszAtom.cpp
@@ -0,0 +1,194 @@
+/*****************************************************************
+|
+| AP4 - stsz Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StszAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::AP4_StszAtom
++---------------------------------------------------------------------*/
+AP4_StszAtom::AP4_StszAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_STSZ, AP4_FULL_ATOM_HEADER_SIZE+8, true),
+ m_SampleSize(0),
+ m_SampleCount(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::AP4_StszAtom
++---------------------------------------------------------------------*/
+AP4_StszAtom::AP4_StszAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STSZ, size, true, stream)
+{
+ stream.ReadUI32(m_SampleSize);
+ stream.ReadUI32(m_SampleCount);
+ unsigned long sample_count = m_SampleCount;
+ if (m_SampleSize == 0) { // means that the samples have different sizes
+ while (sample_count--) {
+ AP4_UI32 entry_size;
+ if (stream.ReadUI32(entry_size) == AP4_SUCCESS) {
+ m_Entries.Append(entry_size);
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // sample size
+ result = stream.WriteUI32(m_SampleSize);
+ if (AP4_FAILED(result)) return result;
+
+ // sample count
+ result = stream.WriteUI32(m_SampleCount);
+ if (AP4_FAILED(result)) return result;
+
+ // entries if needed (the samples have different sizes)
+ if (m_SampleSize == 0) {
+ for (AP4_UI32 i=0; i<m_SampleCount; i++) {
+ result = stream.WriteUI32(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_StszAtom::GetSampleCount()
+{
+ return m_SampleCount;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::GetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::GetSampleSize(AP4_Ordinal sample_start,
+ AP4_Ordinal sample_end,
+ AP4_Size& sample_size)
+{
+ sample_size = 0;
+
+ if(sample_start > m_SampleCount || sample_end > m_SampleCount)
+ {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ if(m_SampleSize != 0)
+ {
+ sample_size = m_SampleSize * (sample_end - sample_start);
+ }
+ else
+ {
+ // compute the additional offset inside the chunk
+ for (unsigned int i = sample_start; i < sample_end; i++) {
+ AP4_Size size;
+ AP4_Result result = GetSampleSize(i, size);
+ if (AP4_FAILED(result)) return result;
+ sample_size += size;
+ }
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::GetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::GetSampleSize(AP4_Ordinal sample, AP4_Size& sample_size)
+{
+ // check the sample index
+ if (sample > m_SampleCount) {
+ sample_size = 0;
+ return AP4_ERROR_OUT_OF_RANGE;
+ } else {
+ // find the size
+ if (m_SampleSize != 0) { // constant size
+ sample_size = m_SampleSize;
+ } else {
+ sample_size = m_Entries[sample - 1];
+ }
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::SetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::SetSampleSize(AP4_Ordinal sample, AP4_Size sample_size)
+{
+ // check the sample index
+ if (sample > m_SampleCount) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ } else {
+ m_Entries[sample - 1] = sample_size;
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::AddEntry
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::AddEntry(AP4_UI32 size)
+{
+ m_Entries.Append(size);
+ m_SampleCount++;
+ m_Size += 4;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("sample_size", m_SampleSize);
+ inspector.AddField("sample_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StszAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StszAtom.h
new file mode 100644
index 000000000..413884a19
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4StszAtom.h
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - stsz Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSZ_ATOM_H_
+#define _AP4_STSZ_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom
++---------------------------------------------------------------------*/
+class AP4_StszAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StszAtom();
+ AP4_StszAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_UI32 GetSampleCount();
+ virtual AP4_Result GetSampleSize(AP4_Ordinal sample_start,
+ AP4_Ordinal sample_end,
+ AP4_Size& sample_size);
+ virtual AP4_Result GetSampleSize(AP4_Ordinal sample,
+ AP4_Size& sample_size);
+ virtual AP4_Result SetSampleSize(AP4_Ordinal sample,
+ AP4_Size sample_size);
+ virtual AP4_Result AddEntry(AP4_UI32 size);
+
+ private:
+ AP4_UI32 m_SampleSize;
+ AP4_UI32 m_SampleCount;
+ AP4_Array<AP4_UI32> m_Entries;
+};
+
+#endif // _AP4_STSZ_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SttsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SttsAtom.cpp
new file mode 100644
index 000000000..666207113
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SttsAtom.cpp
@@ -0,0 +1,169 @@
+/*****************************************************************
+|
+| AP4 - stts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SttsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::AP4_SttsAtom
++---------------------------------------------------------------------*/
+AP4_SttsAtom::AP4_SttsAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_STTS, AP4_FULL_ATOM_HEADER_SIZE+4, true)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::AP4_SttsAtom
++---------------------------------------------------------------------*/
+AP4_SttsAtom::AP4_SttsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STTS, size, true, stream)
+{
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 sample_count;
+ AP4_UI32 sample_duration;
+ if (stream.ReadUI32(sample_count) == AP4_SUCCESS &&
+ stream.ReadUI32(sample_duration) == AP4_SUCCESS) {
+ m_Entries.Append(AP4_SttsTableEntry(sample_count,
+ sample_duration));
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::GetDts
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::GetDts(AP4_Ordinal sample, AP4_TimeStamp& dts, AP4_Duration& duration)
+{
+ AP4_Ordinal sample_count_in_entry = sample;
+ dts = 0;
+
+ for (AP4_UI32 i = 0; i < m_Entries.ItemCount(); i++) {
+ AP4_SttsTableEntry& entry = m_Entries[i];
+
+ // check if we have the correct entry
+ if (sample_count_in_entry <= entry.m_SampleCount) {
+ dts += (sample_count_in_entry - 1) * entry.m_SampleDuration;
+ duration = entry.m_SampleDuration;
+ return AP4_SUCCESS;
+ } else {
+ dts += entry.m_SampleCount * entry.m_SampleDuration;
+ sample_count_in_entry -= entry.m_SampleCount;
+ }
+ }
+
+ // sample is greater than the number of samples
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::AddEntry
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::AddEntry(AP4_UI32 sample_count, AP4_UI32 sample_duration)
+{
+ m_Entries.Append(AP4_SttsTableEntry(sample_count, sample_duration));
+ m_Size += 8;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+ if (AP4_FAILED(result)) return result;
+
+ // write the entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ // sample count
+ result = stream.WriteUI32(m_Entries[i].m_SampleCount);
+ if (AP4_FAILED(result)) return result;
+
+ // time offset
+ result = stream.WriteUI32(m_Entries[i].m_SampleDuration);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::GetSampleIndexForTimeStamp
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::GetSampleIndexForTimeStamp(AP4_TimeStamp ts, AP4_Ordinal& sample)
+{
+ // init
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ AP4_Duration accumulated = 0;
+ sample = 0;
+
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ AP4_Duration next_accumulated = accumulated
+ + m_Entries[i].m_SampleCount * m_Entries[i].m_SampleDuration;
+
+ // check if the ts is in the range of this entry
+ if (ts < next_accumulated) {
+ sample += (AP4_Ordinal) ((ts - accumulated) / m_Entries[i].m_SampleDuration);
+ return AP4_SUCCESS;
+ }
+
+ // update accumulated and sample
+ accumulated = next_accumulated;
+ sample += m_Entries[i].m_SampleCount;
+ }
+
+ // ts not in range of the table
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SttsAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SttsAtom.h
new file mode 100644
index 000000000..837a59496
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SttsAtom.h
@@ -0,0 +1,77 @@
+/*****************************************************************
+|
+| AP4 - stts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STTS_ATOM_H_
+#define _AP4_STTS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SttsTableEntry
++---------------------------------------------------------------------*/
+class AP4_SttsTableEntry {
+ public:
+ AP4_SttsTableEntry() :
+ m_SampleCount(0),
+ m_SampleDuration(0) {}
+ AP4_SttsTableEntry(AP4_Cardinal sample_count,
+ AP4_Duration sample_duration) :
+ m_SampleCount(sample_count),
+ m_SampleDuration(sample_duration) {}
+
+ AP4_Cardinal m_SampleCount;
+ AP4_Duration m_SampleDuration;
+};
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom
++---------------------------------------------------------------------*/
+class AP4_SttsAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_SttsAtom();
+ AP4_SttsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result GetDts(AP4_Ordinal sample, AP4_TimeStamp& dts, AP4_Duration& duration);
+ virtual AP4_Result AddEntry(AP4_UI32 sample_count, AP4_UI32 sample_duration);
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& sample);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ private:
+ AP4_Array<AP4_SttsTableEntry> m_Entries;
+};
+
+#endif // _AP4_STTS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SyntheticSampleTable.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SyntheticSampleTable.cpp
new file mode 100644
index 000000000..ae06d760a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SyntheticSampleTable.cpp
@@ -0,0 +1,130 @@
+/*****************************************************************
+|
+| AP4 - Synthetic Sample Table
+|
+| Copyright 2003-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4SyntheticSampleTable.h"
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::AP4_SyntheticSampleTable()
++---------------------------------------------------------------------*/
+AP4_SyntheticSampleTable::AP4_SyntheticSampleTable()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::~AP4_SyntheticSampleTable()
++---------------------------------------------------------------------*/
+AP4_SyntheticSampleTable::~AP4_SyntheticSampleTable()
+{
+ m_SampleDescriptions.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SyntheticSampleTable::GetSample(AP4_Ordinal index, AP4_Sample& sample)
+{
+ if (index < m_Samples.ItemCount()) {
+ sample = m_Samples[index];
+ return AP4_SUCCESS;
+ } else {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_SyntheticSampleTable::GetSampleCount()
+{
+ return m_Samples.ItemCount();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSampleDescriptionCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_SyntheticSampleTable::GetSampleDescriptionCount()
+{
+ return m_SampleDescriptions.ItemCount();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_SyntheticSampleTable::GetSampleDescription(AP4_Ordinal index)
+{
+ AP4_SampleDescription* description;
+ if (AP4_SUCCEEDED(m_SampleDescriptions.Get(index, description))) {
+ return description;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::AddSampleDescription
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SyntheticSampleTable::AddSampleDescription(AP4_SampleDescription* description)
+{
+ return m_SampleDescriptions.Add(description);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::AddSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SyntheticSampleTable::AddSample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp cts,
+ AP4_TimeStamp dts,
+ bool sync)
+{
+ AP4_Sample sample(data_stream, offset, size, description_index, dts, cts-dts);
+ return m_Samples.Append(sample);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SyntheticSampleTable::GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index)
+{
+ return AP4_ERROR_NOT_SUPPORTED_YET;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SyntheticSampleTable.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SyntheticSampleTable.h
new file mode 100644
index 000000000..b57639385
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4SyntheticSampleTable.h
@@ -0,0 +1,79 @@
+/*****************************************************************
+|
+| AP4 - Synthetic Sample Table
+|
+| Copyright 2003-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SYNTHETIC_SAMPLE_TABLE_H_
+#define _AP4_SYNTHETIC_SAMPLE_TABLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Array.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_ByteStream;
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable
++---------------------------------------------------------------------*/
+class AP4_SyntheticSampleTable : public AP4_SampleTable
+{
+ public:
+ // methods
+ AP4_SyntheticSampleTable();
+ virtual ~AP4_SyntheticSampleTable();
+
+ // AP4_SampleTable methods
+ virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
+ virtual AP4_Cardinal GetSampleCount();
+ virtual AP4_Cardinal GetSampleDescriptionCount();
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index);
+
+ // methods
+ virtual AP4_Result AddSampleDescription(AP4_SampleDescription* description);
+ virtual AP4_Result AddSample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp cts = 0,
+ AP4_TimeStamp dts = 0,
+ bool sync = false);
+
+private:
+ // members
+ AP4_Array<AP4_Sample> m_Samples;
+ AP4_List<AP4_SampleDescription> m_SampleDescriptions;
+};
+
+#endif // _AP4_SYNTHETIC_SAMPLE_TABLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TimsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TimsAtom.cpp
new file mode 100644
index 000000000..50ab62618
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TimsAtom.cpp
@@ -0,0 +1,76 @@
+/*****************************************************************
+|
+| AP4 - tims Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom::AP4_TimsAtom
++---------------------------------------------------------------------*/
+AP4_TimsAtom::AP4_TimsAtom(AP4_UI32 timescale) :
+ AP4_Atom(AP4_ATOM_TYPE_TIMS, 4, false),
+ m_TimeScale(timescale)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom::AP4_TimsAtom
++---------------------------------------------------------------------*/
+AP4_TimsAtom::AP4_TimsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_TIMS, size, false, stream)
+{
+ stream.ReadUI32(m_TimeScale);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TimsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // timescale
+ return stream.WriteUI32(m_TimeScale);
+
+}
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TimsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("timescale", m_TimeScale);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TimsAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TimsAtom.h
new file mode 100644
index 000000000..8ae79ab5a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TimsAtom.h
@@ -0,0 +1,60 @@
+/*****************************************************************
+|
+| AP4 - tims Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_TIMS_ATOM_H_
+#define _AP4_TIMS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom
++---------------------------------------------------------------------*/
+class AP4_TimsAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_TimsAtom(AP4_UI32 timescale);
+ AP4_TimsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ virtual AP4_UI32 GetTimeScale() { return m_TimeScale; }
+
+private:
+ // members
+ AP4_UI32 m_TimeScale;
+};
+
+#endif // _AP4_TIMS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TkhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TkhdAtom.cpp
new file mode 100644
index 000000000..560b2bedb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TkhdAtom.cpp
@@ -0,0 +1,187 @@
+/*****************************************************************
+|
+| AP4 - tkhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4TkhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::AP4_TkhdAtom
++---------------------------------------------------------------------*/
+AP4_TkhdAtom::AP4_TkhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 track_id,
+ AP4_UI64 duration,
+ AP4_UI16 volume,
+ AP4_UI32 width,
+ AP4_UI32 height) :
+ AP4_Atom(AP4_ATOM_TYPE_TKHD, 80+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CreationTime(creation_time),
+ m_ModificationTime(modification_time),
+ m_TrackId(track_id),
+ m_Reserved1(0),
+ m_Duration(duration),
+ m_Layer(0),
+ m_AlternateGroup(0),
+ m_Volume(volume),
+ m_Reserved3(0),
+ m_Width(width),
+ m_Height(height)
+{
+ m_Flags = AP4_TKHD_FLAG_DEFAULTS;
+
+ m_Matrix[0] = 0x00010000;
+ m_Matrix[1] = 0;
+ m_Matrix[2] = 0;
+ m_Matrix[3] = 0;
+ m_Matrix[4] = 0x00010000;
+ m_Matrix[5] = 0;
+ m_Matrix[6] = 0;
+ m_Matrix[7] = 0;
+ m_Matrix[8] = 0x40000000;
+
+ m_Reserved2[0] = 0;
+ m_Reserved2[1] = 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::AP4_TkhdAtom
++---------------------------------------------------------------------*/
+AP4_TkhdAtom::AP4_TkhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_TKHD, size, true, stream)
+{
+ if (m_Version == 0) {
+ AP4_UI32 tmp = 0;
+ stream.ReadUI32(tmp); m_CreationTime = tmp;
+ stream.ReadUI32(tmp); m_ModificationTime = tmp;
+ stream.ReadUI32(m_TrackId);
+ stream.ReadUI32(m_Reserved1);
+ stream.ReadUI32(tmp); m_Duration = tmp;
+ } else if (m_Version == 1) {
+ stream.ReadUI64(m_CreationTime);
+ stream.ReadUI64(m_ModificationTime);
+ stream.ReadUI32(m_TrackId);
+ stream.ReadUI32(m_Reserved1);
+ stream.ReadUI64(m_Duration);
+ } else {
+ // TODO
+ }
+
+ stream.Read((void*)m_Reserved2, 8, NULL);
+ stream.ReadUI16(m_Layer);
+ stream.ReadUI16(m_AlternateGroup);
+ stream.ReadUI16(m_Volume);
+ stream.ReadUI16(m_Reserved3);
+ for (int i=0; i<9; i++) {
+ stream.ReadUI32(m_Matrix[i]);
+ }
+ stream.ReadUI32(m_Width);
+ stream.ReadUI32(m_Height);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TkhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // creation/modification time, track id, reserved1 & duration
+ if (m_Version == 0) {
+ result = stream.WriteUI32((AP4_UI32)m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TrackId);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Reserved1);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else if (m_Version == 1) {
+ result = stream.WriteUI64(m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TrackId);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Reserved1);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ // TODO
+ }
+
+ // reserved2
+ result = stream.Write(m_Reserved2, sizeof(m_Reserved2));
+ if (AP4_FAILED(result)) return result;
+
+ // layer, alternate group & volume
+ result = stream.WriteUI16(m_Layer);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_AlternateGroup);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_Volume);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved3
+ result = stream.WriteUI16(m_Reserved3);
+
+ // matrix
+ for (int i=0; i<9; i++) {
+ result = stream.WriteUI32(m_Matrix[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // width & height
+ result = stream.WriteUI32(m_Width);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Height);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TkhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("enabled", ((m_Flags & AP4_TKHD_FLAG_TRACK_ENABLED) ? 1 : 0), AP4_AtomInspector::HINT_BOOLEAN);
+ inspector.AddField("id", m_TrackId);
+ inspector.AddField("duration", (AP4_UI32)m_Duration);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TkhdAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TkhdAtom.h
new file mode 100644
index 000000000..37b5c270f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TkhdAtom.h
@@ -0,0 +1,105 @@
+/*****************************************************************
+|
+| AP4 - tkhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TKHD_ATOM_H_
+#define _AP4_TKHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_TKHD_FLAG_TRACK_ENABLED = 1;
+const int AP4_TKHD_FLAG_TRACK_IN_MOVIE = 2;
+const int AP4_TKHD_FLAG_TRACK_IN_PREVIEW = 4;
+
+const int AP4_TKHD_FLAG_DEFAULTS = 7;
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom
++---------------------------------------------------------------------*/
+class AP4_TkhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_TkhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 track_id,
+ AP4_UI64 duration,
+ AP4_UI16 volume,
+ AP4_UI32 width,
+ AP4_UI32 height);
+ AP4_TkhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_UI64 GetDuration() { return m_Duration; }
+ AP4_Result SetDuration(AP4_UI64 duration) {
+ m_Duration = duration;
+ return AP4_SUCCESS;
+ }
+ AP4_UI32 GetTrackId() { return m_TrackId; }
+ AP4_Result SetTrackId(AP4_UI32 track_id) {
+ m_TrackId = track_id;
+ return AP4_SUCCESS;
+ }
+
+ void GetTranslation(AP4_Float& x, AP4_Float& y)
+ {
+ x = (AP4_Float)(*(int*)&m_Matrix[6]) / 65536;
+ y = (AP4_Float)(*(int*)&m_Matrix[7]) / 65536;
+ }
+
+ AP4_UI32 GetWidth() const {return m_Width;}
+ AP4_UI32 GetHeight() const {return m_Height;}
+
+ private:
+ // members
+ AP4_UI64 m_CreationTime;
+ AP4_UI64 m_ModificationTime;
+ AP4_UI32 m_TrackId;
+ AP4_UI32 m_Reserved1;
+ AP4_UI64 m_Duration;
+ AP4_UI08 m_DataVersion1[32];
+ AP4_UI32 m_Reserved2[2];
+ AP4_UI16 m_Layer;
+ AP4_UI16 m_AlternateGroup;
+ AP4_UI16 m_Volume;
+ AP4_UI16 m_Reserved3;
+ AP4_UI32 m_Matrix[9];
+ AP4_UI32 m_Width;
+ AP4_UI32 m_Height;
+};
+
+#endif // _AP4_TKHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.cpp
new file mode 100644
index 000000000..42dc42d99
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.cpp
@@ -0,0 +1,357 @@
+/*****************************************************************
+|
+| AP4 - Track Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4ByteStream.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4Track.h"
+#include "Ap4Utils.h"
+#include "Ap4Sample.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4AtomSampleTable.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4MdhdAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_Track::AP4_Track
++---------------------------------------------------------------------*/
+AP4_Track::AP4_Track(Type type,
+ AP4_SampleTable* sample_table,
+ AP4_UI32 track_id,
+ AP4_UI32 movie_time_scale,
+ AP4_UI32 media_time_scale,
+ AP4_UI64 media_duration,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 height) :
+ m_TrakAtomIsOwned(true),
+ m_Type(type),
+ m_SampleTable(sample_table),
+ m_SampleTableIsOwned(false),
+ m_MovieTimeScale(movie_time_scale ?
+ movie_time_scale :
+ AP4_TRACK_DEFAULT_MOVIE_TIMESCALE),
+ m_MediaTimeScale(media_time_scale)
+{
+ // compute the default volume value
+ unsigned int volume = 0;
+ if (type == TYPE_AUDIO) volume = 0x100;
+
+ // compute the handler type and name
+ AP4_Atom::Type hdlr_type;
+ const char* hdlr_name;
+ switch (type) {
+ case TYPE_AUDIO:
+ hdlr_type = AP4_HANDLER_TYPE_SOUN;
+ hdlr_name = "Bento4 Sound Handler";
+ break;
+
+ case TYPE_VIDEO:
+ hdlr_type = AP4_HANDLER_TYPE_VIDE;
+ hdlr_name = "Bento4 Video Handler";
+ break;
+
+ case TYPE_HINT:
+ hdlr_type = AP4_HANDLER_TYPE_HINT;
+ hdlr_name = "Bento4 Hint Handler";
+ break;
+
+ default:
+ hdlr_type = 0;
+ hdlr_name = NULL;
+ break;
+ }
+
+ // compute the track duration in units of the movie time scale
+ AP4_UI64 track_duration = AP4_ConvertTime(media_duration,
+ media_time_scale,
+ movie_time_scale);
+
+ // create a trak atom
+ m_TrakAtom = new AP4_TrakAtom(sample_table,
+ hdlr_type,
+ hdlr_name,
+ track_id,
+ 0,
+ 0,
+ track_duration,
+ media_time_scale,
+ media_duration,
+ volume,
+ language,
+ width,
+ height);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::AP4_Track
++---------------------------------------------------------------------*/
+AP4_Track::AP4_Track(AP4_TrakAtom& atom,
+ AP4_ByteStream& sample_stream,
+ AP4_UI32 movie_time_scale) :
+ m_TrakAtom(&atom),
+ m_TrakAtomIsOwned(false),
+ m_Type(TYPE_UNKNOWN),
+ m_SampleTable(NULL),
+ m_SampleTableIsOwned(true),
+ m_MovieTimeScale(movie_time_scale),
+ m_MediaTimeScale(0)
+{
+ // find the handler type
+ AP4_Atom* sub = atom.FindChild("mdia/hdlr");
+ if (sub) {
+ AP4_HdlrAtom* hdlr = dynamic_cast<AP4_HdlrAtom*>(sub);
+ if (hdlr) {
+ AP4_Atom::Type type = hdlr->GetHandlerType();
+ if (type == AP4_HANDLER_TYPE_SOUN) {
+ m_Type = TYPE_AUDIO;
+ } else if (type == AP4_HANDLER_TYPE_VIDE) {
+ m_Type = TYPE_VIDEO;
+ } else if (type == AP4_HANDLER_TYPE_TEXT) {
+ m_Type = TYPE_TEXT;
+ } else if (type == AP4_HANDLER_TYPE_TX3G) {
+ m_Type = TYPE_TEXT;
+ } else if (type == AP4_HANDLER_TYPE_SUBP) {
+ m_Type = TYPE_SUBP;
+ } else if (type == AP4_HANDLER_TYPE_HINT) {
+ m_Type = TYPE_HINT;
+ }
+ }
+ }
+
+ // get the media time scale
+ sub = atom.FindChild("mdia/mdhd");
+ if (sub) {
+ AP4_MdhdAtom* mdhd = dynamic_cast<AP4_MdhdAtom*>(sub);
+ if (mdhd) {
+ m_MediaTimeScale = mdhd->GetTimeScale();
+ }
+ }
+
+ // create a facade for the stbl atom
+ AP4_ContainerAtom* stbl = dynamic_cast<AP4_ContainerAtom*>(
+ atom.FindChild("mdia/minf/stbl"));
+ if (stbl) {
+ m_SampleTable = new AP4_AtomSampleTable(stbl, sample_stream);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::~AP4_Track
++---------------------------------------------------------------------*/
+AP4_Track::~AP4_Track()
+{
+ if (m_TrakAtomIsOwned) delete m_TrakAtom;
+ if (m_SampleTableIsOwned) delete m_SampleTable;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetId
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Track::GetId()
+{
+ return m_TrakAtom->GetId();
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::SetId
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::SetId(AP4_UI32 id)
+{
+ m_TrakAtom->SetId(id);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetDuration
++---------------------------------------------------------------------*/
+AP4_UI64
+AP4_Track::GetDuration()
+{
+ return m_TrakAtom->GetDuration();
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_Duration
+AP4_Track::GetDurationMs()
+{
+ AP4_UI64 duration = m_TrakAtom->GetDuration();
+ return AP4_DurationMsFromUnits(duration, m_MovieTimeScale);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_Track::GetSampleCount()
+{
+ // delegate to the sample table
+ return m_SampleTable ? m_SampleTable->GetSampleCount() : 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::GetSample(AP4_Ordinal index, AP4_Sample& sample)
+{
+ // delegate to the sample table
+ return m_SampleTable ? m_SampleTable->GetSample(index, sample) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_Track::GetSampleDescription(AP4_Ordinal index)
+{
+ // delegate to the sample table
+ return m_SampleTable ? m_SampleTable->GetSampleDescription(index) : NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::ReadSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::ReadSample(AP4_Ordinal index,
+ AP4_Sample& sample,
+ AP4_DataBuffer& data)
+{
+ AP4_Result result;
+
+ // get the sample
+ result = GetSample(index, sample);
+ if (AP4_FAILED(result)) return result;
+
+ // read the data
+ return sample.ReadData(data);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSampleIndexForTimeStampMs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::GetSampleIndexForTimeStampMs(AP4_TimeStamp ts, AP4_Ordinal& index)
+{
+ // convert the ts in the timescale of the track's media
+ ts = AP4_ConvertTime(ts, 1000, m_MediaTimeScale);
+
+ return m_SampleTable->GetSampleIndexForTimeStamp(ts, index);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::SetMovieTimeScale
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::SetMovieTimeScale(AP4_UI32 time_scale)
+{
+ // check that we can convert
+ if (m_MovieTimeScale == 0) return AP4_FAILURE;
+
+ // convert from one time scale to the other
+ m_TrakAtom->SetDuration(AP4_ConvertTime(m_TrakAtom->GetDuration(),
+ m_MovieTimeScale,
+ time_scale));
+
+ // keep the new movie timescale
+ m_MovieTimeScale = time_scale;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetMediaTimeScale
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Track::GetMediaTimeScale()
+{
+ return m_MediaTimeScale;
+}
+
+// save the implementation for later
+#if 0
+/*----------------------------------------------------------------------
+| AP4_HintTrack::SetSdpText
++---------------------------------------------------------------------*/
+void
+AP4_HintTrack::SetSdpText(const char* text)
+{
+ // build an sdp atom
+ AP4_SdpAtom* sdp = new AP4_SdpAtom(text);
+
+ // build the hnti
+ AP4_ContainerAtom* hnti = new AP4_ContainerAtom(AP4_ATOM_TYPE_HNTI);
+ hnti->AddChild(sdp);
+
+ // check if there's already a user data atom
+ AP4_ContainerAtom* udta = dynamic_cast<AP4_ContainerAtom*>(m_TrakAtom->FindChild("udta"));
+ if (udta == NULL) {
+ // otherwise create it
+ udta = new AP4_ContainerAtom(AP4_ATOM_TYPE_UDTA);
+ m_TrakAtom->AddChild(udta);
+ }
+ udta->AddChild(hnti);
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetTrackName
++---------------------------------------------------------------------*/
+
+AP4_String
+AP4_Track::GetTrackName()
+{
+ AP4_String TrackName;
+ if(AP4_HdlrAtom* hdlr = dynamic_cast<AP4_HdlrAtom*>(m_TrakAtom->FindChild("mdia/hdlr")))
+ TrackName = hdlr->GetHandlerName();
+ return TrackName;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetTrackLanguage
++---------------------------------------------------------------------*/
+
+AP4_String
+AP4_Track::GetTrackLanguage()
+{
+ AP4_String TrackLanguage;
+ if(AP4_MdhdAtom* mdhd = dynamic_cast<AP4_MdhdAtom*>(m_TrakAtom->FindChild("mdia/mdhd")))
+ TrackLanguage = mdhd->GetLanguage().c_str();
+ return TrackLanguage;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.h
new file mode 100644
index 000000000..4b901e159
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Track.h
@@ -0,0 +1,115 @@
+/*****************************************************************
+|
+| AP4 - Track Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TRAK_H_
+#define _AP4_TRAK_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Array.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_StblAtom;
+class AP4_ByteStream;
+class AP4_Sample;
+class AP4_DataBuffer;
+class AP4_TrakAtom;
+class AP4_MoovAtom;
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_TRACK_DEFAULT_MOVIE_TIMESCALE = 1000;
+
+/*----------------------------------------------------------------------
+| AP4_Track
++---------------------------------------------------------------------*/
+class AP4_Track {
+ public:
+ // types
+ typedef enum {
+ TYPE_UNKNOWN,
+ TYPE_AUDIO,
+ TYPE_VIDEO,
+ TYPE_TEXT,
+ TYPE_SUBP,
+ TYPE_HINT
+ } Type;
+
+ // methods
+ AP4_Track(Type type,
+ AP4_SampleTable* sample_table,
+ AP4_UI32 track_id,
+ AP4_UI32 movie_time_scale, // 0 = use default
+ AP4_UI32 media_time_scale,
+ AP4_UI64 media_duration,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 height);
+ AP4_Track(AP4_TrakAtom& atom,
+ AP4_ByteStream& sample_stream,
+ AP4_UI32 movie_time_scale);
+ virtual ~AP4_Track();
+ AP4_Track::Type GetType() { return m_Type; }
+ AP4_UI64 GetDuration();
+ AP4_Duration GetDurationMs();
+ AP4_Cardinal GetSampleCount();
+ AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
+ AP4_Result ReadSample(AP4_Ordinal index,
+ AP4_Sample& sample,
+ AP4_DataBuffer& data);
+ AP4_Result GetSampleIndexForTimeStampMs(AP4_TimeStamp ts,
+ AP4_Ordinal& index);
+ AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ AP4_UI32 GetId();
+ AP4_Result SetId(AP4_UI32 track_id);
+ AP4_TrakAtom* GetTrakAtom() { return m_TrakAtom; }
+ AP4_Result SetMovieTimeScale(AP4_UI32 time_scale);
+ AP4_UI32 GetMediaTimeScale();
+
+ AP4_String GetTrackName();
+ AP4_String GetTrackLanguage();
+
+ protected:
+ // members
+ AP4_TrakAtom* m_TrakAtom;
+ bool m_TrakAtomIsOwned;
+ Type m_Type;
+ AP4_SampleTable* m_SampleTable;
+ bool m_SampleTableIsOwned;
+ AP4_UI32 m_MovieTimeScale;
+ AP4_UI32 m_MediaTimeScale;
+};
+
+#endif // _AP4_TRAK_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.cpp
new file mode 100644
index 000000000..1b96ea120
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.cpp
@@ -0,0 +1,204 @@
+/*****************************************************************
+|
+| AP4 - trak Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MdhdAtom.h"
+#include "Ap4VmhdAtom.h"
+#include "Ap4SmhdAtom.h"
+#include "Ap4HmhdAtom.h"
+#include "Ap4NmhdAtom.h"
+#include "Ap4DrefAtom.h"
+#include "Ap4UrlAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4Co64Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::AP4_TrakAtom
++---------------------------------------------------------------------*/
+AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table,
+ AP4_Atom::Type hdlr_type,
+ const char* hdlr_name,
+ AP4_UI32 track_id,
+ AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI64 track_duration,
+ AP4_UI32 media_time_scale,
+ AP4_UI64 media_duration,
+ AP4_UI16 volume,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 height) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_TRAK)
+{
+ AP4_Result result;
+
+ // create a tkhd atom
+ m_TkhdAtom = new AP4_TkhdAtom(creation_time,
+ modification_time,
+ track_id,
+ track_duration,
+ volume,
+ width,
+ height);
+
+ // create an edts
+
+ // create a mdia atom
+ AP4_ContainerAtom* mdia = new AP4_ContainerAtom(AP4_ATOM_TYPE_MDIA);
+
+ // create a hdlr atom for the mdia atom
+ m_HdlrAtom = new AP4_HdlrAtom(hdlr_type, hdlr_name);
+
+ // create a minf atom
+ AP4_ContainerAtom* minf = new AP4_ContainerAtom(AP4_ATOM_TYPE_MINF);
+
+ // create a media header atom for minf (vmhd, smhd, hmhd or nmhd)
+ AP4_Atom* minf_header;
+ switch (hdlr_type) {
+ case AP4_HANDLER_TYPE_VIDE:
+ minf_header = new AP4_VmhdAtom(0, 0, 0, 0);
+ break;
+
+ case AP4_HANDLER_TYPE_SOUN:
+ minf_header = new AP4_SmhdAtom(0);
+ break;
+
+ default:
+ minf_header = new AP4_NmhdAtom();
+ break;
+ }
+
+ // create a dinf atom for minf
+ AP4_ContainerAtom* dinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_DINF);
+
+ // create a url atom as a ref for dref
+ AP4_Atom* url = new AP4_UrlAtom(); // local ref
+
+ // create a dref atom for dinf
+ AP4_DrefAtom* dref = new AP4_DrefAtom(&url, 1);
+
+ // create a stbl atom for minf
+ AP4_ContainerAtom* stbl;
+ result = sample_table->GenerateStblAtom(stbl);
+ if (AP4_FAILED(result)) stbl = NULL;
+
+ // populate the dinf atom
+ dinf->AddChild(dref);
+
+ // populate the minf atom
+ minf->AddChild(minf_header);
+ minf->AddChild(dinf);
+ if (stbl) minf->AddChild(stbl);
+
+ // create a mdhd atom for the mdia atom
+ AP4_MdhdAtom* mdhd = new AP4_MdhdAtom(creation_time,
+ modification_time,
+ media_time_scale,
+ media_duration,
+ language);
+
+ // populate the mdia atom
+ mdia->AddChild(mdhd);
+ mdia->AddChild(m_HdlrAtom);
+ mdia->AddChild(minf);
+
+ // attach the children
+ AddChild(m_TkhdAtom);
+ AddChild(mdia);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::AP4_TrakAtom
++---------------------------------------------------------------------*/
+AP4_TrakAtom::AP4_TrakAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_TRAK, size, false, stream, atom_factory),
+ m_HdlrAtom(NULL),
+ m_TkhdAtom(NULL)
+{
+ AP4_Atom* tkhd = FindChild("tkhd");
+ if (tkhd != NULL) {
+ m_TkhdAtom = dynamic_cast<AP4_TkhdAtom*>(tkhd);
+ } else {
+ m_TkhdAtom = NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::GetDuration
++---------------------------------------------------------------------*/
+AP4_UI64
+AP4_TrakAtom::GetDuration()
+{
+ if (m_TkhdAtom) {
+ return m_TkhdAtom->GetDuration();
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::SetDuration
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrakAtom::SetDuration(AP4_UI64 duration)
+{
+ if (m_TkhdAtom) {
+ return m_TkhdAtom->SetDuration(duration);
+ } else {
+ return AP4_FAILURE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::AdjustChunkOffsets
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrakAtom::AdjustChunkOffsets(AP4_Offset offset)
+{
+ if (AP4_Atom* atom = FindChild("mdia/minf/stbl/co64")) {
+ AP4_Co64Atom* co64 = dynamic_cast<AP4_Co64Atom*>(atom);
+ co64->AdjustChunkOffsets(offset);
+ }
+
+ AP4_Atom* atom = FindChild("mdia/minf/stbl/stco");
+ if (atom != NULL) {
+ AP4_StcoAtom* stco = dynamic_cast<AP4_StcoAtom*>(atom);
+ stco->AdjustChunkOffsets(offset);
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.h
new file mode 100644
index 000000000..6eaaaa6e2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrakAtom.h
@@ -0,0 +1,85 @@
+/*****************************************************************
+|
+| AP4 - trak Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TRAK_ATOM_H_
+#define _AP4_TRAK_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4TkhdAtom.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom
++---------------------------------------------------------------------*/
+class AP4_TrakAtom : public AP4_ContainerAtom
+{
+ public:
+ // methods
+ AP4_TrakAtom(AP4_SampleTable* sample_table,
+ AP4_Atom::Type hdlr_type,
+ const char* hdlr_name,
+ AP4_UI32 track_id,
+ AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI64 track_duration,
+ AP4_UI32 media_time_scale,
+ AP4_UI64 media_duration,
+ AP4_UI16 volume,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 heigh);
+ AP4_TrakAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Result AdjustChunkOffsets(AP4_Offset offset);
+ AP4_UI32 GetId() {
+ return m_TkhdAtom->GetTrackId();
+ }
+ AP4_Result SetId(AP4_UI32 track_id) {
+ return m_TkhdAtom->SetTrackId(track_id);
+ }
+ AP4_UI64 GetDuration();
+ AP4_Result SetDuration(AP4_UI64 duration);
+ AP4_TkhdAtom* GetTkhdAtom() { return m_TkhdAtom; }
+ AP4_HdlrAtom* GetHdlrAtom() { return m_HdlrAtom; }
+
+ private:
+ // members
+ AP4_HdlrAtom* m_HdlrAtom;
+ AP4_TkhdAtom* m_TkhdAtom;
+};
+
+#endif // _AP4_TRAK_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrefTypeAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrefTypeAtom.cpp
new file mode 100644
index 000000000..504d08e34
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrefTypeAtom.cpp
@@ -0,0 +1,81 @@
+/*****************************************************************
+|
+| AP4 - tref type Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4TrefTypeAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrefTypeAtom::AP4_TrefTypeAtom
++---------------------------------------------------------------------*/
+AP4_TrefTypeAtom::AP4_TrefTypeAtom(AP4_Atom::Type type,
+ AP4_Size size,
+ AP4_ByteStream& stream) :
+ AP4_Atom(type, size, false, stream)
+{
+ AP4_Size data_size = size - 8; // size and atom type
+
+ // read the track ids
+ while (data_size != 0) {
+ AP4_UI32 track_id;
+ stream.ReadUI32(track_id);
+ m_TrackIds.Append(track_id);
+ data_size -= 4;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrefTypeAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrefTypeAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result = AP4_SUCCESS;
+
+ AP4_Size track_id_count = m_TrackIds.ItemCount();
+ for (AP4_Ordinal i=0; i<track_id_count; i++) {
+ result = stream.WriteUI32(m_TrackIds[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrefTypeAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrefTypeAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("track_id_count", m_TrackIds.ItemCount());
+ for (AP4_Ordinal i=0; i<m_TrackIds.ItemCount(); i++) {
+ inspector.AddField("track id ", m_TrackIds[i]);
+ }
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrefTypeAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrefTypeAtom.h
new file mode 100644
index 000000000..2c2f1412a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4TrefTypeAtom.h
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - tref type Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_TREF_TYPE_ATOM_H_
+#define _AP4_TREF_TYPE_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Array.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrefTypeAtom
++---------------------------------------------------------------------*/
+class AP4_TrefTypeAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_TrefTypeAtom(AP4_Atom::Type type, AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ const AP4_Array<AP4_UI32>& GetTrackIds() { return m_TrackIds; }
+
+ // members
+ AP4_Array<AP4_UI32> m_TrackIds;
+};
+
+#endif
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Types.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Types.h
new file mode 100644
index 000000000..38a471069
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Types.h
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - Shared Types
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TYPES_H_
+#define _AP4_TYPES_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Config.h"
+#if defined(AP4_CONFIG_HAVE_CPP_STRING_H)
+#include <string>
+#endif
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+typedef int AP4_Result;
+typedef unsigned long AP4_Flags;
+typedef unsigned long AP4_Mask;
+typedef unsigned long AP4_Size;
+typedef unsigned long AP4_Offset;
+typedef unsigned long AP4_Range;
+typedef unsigned long AP4_Cardinal;
+typedef unsigned long AP4_Ordinal;
+// typedef unsigned long AP4_TimeStamp;
+// typedef unsigned long AP4_Duration;
+typedef int AP4_Coordinate;
+typedef int AP4_Distance;
+typedef int AP4_Integer;
+typedef unsigned int AP4_UI32;
+typedef unsigned short AP4_UI16;
+typedef unsigned char AP4_UI08;
+typedef float AP4_Float;
+typedef std::string AP4_String;
+typedef unsigned char AP4_Byte;
+
+typedef unsigned long long AP4_TimeStamp;
+typedef unsigned long long AP4_Duration;
+typedef unsigned long long AP4_UI64;
+
+#endif // _AP4_TYPES_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UnknownDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UnknownDescriptor.cpp
new file mode 100644
index 000000000..2b1c7414a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UnknownDescriptor.cpp
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - Unknown Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4UnknownDescriptor.h"
+
+/*----------------------------------------------------------------------
+| AP4_UnknownDescriptor::AP4_UnknownDescriptor
++---------------------------------------------------------------------*/
+AP4_UnknownDescriptor::AP4_UnknownDescriptor(AP4_ByteStream& stream,
+ unsigned char tag,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
+ AP4_Descriptor(tag, header_size, payload_size)
+{
+ m_Data.SetDataSize(payload_size);
+ stream.Read(m_Data.UseData(), payload_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_UnknownDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ // write the payload
+ stream.Write(m_Data.GetData(), m_Data.GetDataSize());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UnknownDescriptor.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UnknownDescriptor.h
new file mode 100644
index 000000000..60d5f5ae4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UnknownDescriptor.h
@@ -0,0 +1,60 @@
+/*****************************************************************
+|
+| AP4 - Unknown Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_UNKNOWN_DESCRIPTOR_H_
+#define _AP4_UNKNOWN_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Descriptor.h"
+
+/*----------------------------------------------------------------------
+| AP4_UnknownDescriptor
++---------------------------------------------------------------------*/
+class AP4_UnknownDescriptor : public AP4_Descriptor
+{
+public:
+ // methods
+ AP4_UnknownDescriptor(AP4_ByteStream& stream,
+ unsigned char tag,
+ AP4_Size header_size,
+ AP4_Size payload_size);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_DataBuffer m_Data;
+};
+
+
+#endif // _AP4_UNKNOWN_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.cpp
new file mode 100644
index 000000000..516126386
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.cpp
@@ -0,0 +1,99 @@
+/*****************************************************************
+|
+| AP4 - url Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4UrlAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom::AP4_UrlAtom
++---------------------------------------------------------------------*/
+AP4_UrlAtom::AP4_UrlAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_URL, AP4_FULL_ATOM_HEADER_SIZE, true)
+{
+ m_Flags = 1; // local ref
+}
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom::AP4_UrlAtom
++---------------------------------------------------------------------*/
+AP4_UrlAtom::AP4_UrlAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_URL, size, true, stream)
+{
+ if ((m_Flags & 1) == 0) {
+ // not self contained
+ AP4_Size str_size = size-AP4_FULL_ATOM_HEADER_SIZE;
+ if (str_size > 0) {
+ char* str = new char[str_size];
+ stream.Read(str, str_size);
+ str[str_size-1] = '\0'; // force null-termination
+ m_Url = str;
+ delete[] str;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_UrlAtom::WriteFields(AP4_ByteStream& stream)
+{
+ if (m_Flags & 1) {
+ // local ref (self contained)
+ return AP4_SUCCESS;
+ } else {
+ // url (not self contained)
+ AP4_Result result = stream.Write(m_Url.c_str(), m_Url.length()+1);
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_FULL_ATOM_HEADER_SIZE+m_Url.length()+1);
+ while (padding--) stream.WriteUI08(0);
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_UrlAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ if (m_Flags & 1) {
+ inspector.AddField("location", "[local to file]");
+ } else {
+ inspector.AddField("location", m_Url.c_str());
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.h
new file mode 100644
index 000000000..ee63e365e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4UrlAtom.h
@@ -0,0 +1,57 @@
+/*****************************************************************
+|
+| AP4 - url Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_URL_ATOM_H_
+#define _AP4_URL_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom
++---------------------------------------------------------------------*/
+class AP4_UrlAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_UrlAtom(); // local ref only (no URL string)
+ AP4_UrlAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ private:
+ // members
+ AP4_String m_Url;
+};
+
+#endif // _AP4_URL_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Utils.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Utils.cpp
new file mode 100644
index 000000000..29f208d00
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Utils.cpp
@@ -0,0 +1,335 @@
+/*****************************************************************
+|
+| AP4 - Utilities
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt64BE
++---------------------------------------------------------------------*/
+unsigned long long
+AP4_BytesToUInt64BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned long long)bytes[0])<<56 ) |
+ ( ((unsigned long long)bytes[1])<<48 ) |
+ ( ((unsigned long long)bytes[2])<<40 ) |
+ ( ((unsigned long long)bytes[3])<<32 ) |
+ ( ((unsigned long long)bytes[4])<<24 ) |
+ ( ((unsigned long long)bytes[5])<<16 ) |
+ ( ((unsigned long long)bytes[6])<<8 ) |
+ ( ((unsigned long long)bytes[7]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt32BE
++---------------------------------------------------------------------*/
+unsigned long
+AP4_BytesToUInt32BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned long)bytes[0])<<24 ) |
+ ( ((unsigned long)bytes[1])<<16 ) |
+ ( ((unsigned long)bytes[2])<<8 ) |
+ ( ((unsigned long)bytes[3]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt24BE
++---------------------------------------------------------------------*/
+unsigned long
+AP4_BytesToUInt24BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned long)bytes[0])<<16 ) |
+ ( ((unsigned long)bytes[1])<<8 ) |
+ ( ((unsigned long)bytes[2]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt16BE
++---------------------------------------------------------------------*/
+unsigned short
+AP4_BytesToUInt16BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned short)bytes[0])<<8 ) |
+ ( ((unsigned short)bytes[1]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt64BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt64BE(unsigned char* bytes, unsigned long long value)
+{
+ bytes[0] = (unsigned char)(value >> 56);
+ bytes[1] = (unsigned char)(value >> 48);
+ bytes[2] = (unsigned char)(value >> 40);
+ bytes[3] = (unsigned char)(value >> 32);
+ bytes[4] = (unsigned char)(value >> 24);
+ bytes[5] = (unsigned char)(value >> 16);
+ bytes[6] = (unsigned char)(value >> 8);
+ bytes[7] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt32BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt32BE(unsigned char* bytes, unsigned long value)
+{
+ bytes[0] = (unsigned char)(value >> 24);
+ bytes[1] = (unsigned char)(value >> 16);
+ bytes[2] = (unsigned char)(value >> 8);
+ bytes[3] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt24BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt24BE(unsigned char* bytes, unsigned long value)
+{
+ bytes[0] = (unsigned char)(value >> 16);
+ bytes[1] = (unsigned char)(value >> 8);
+ bytes[2] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt16BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt16BE(unsigned char* bytes, unsigned short value)
+{
+ bytes[0] = (unsigned char)(value >> 8);
+ bytes[1] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_MakePrefixString
++---------------------------------------------------------------------*/
+static void
+AP4_MakePrefixString(AP4_Offset indent, char* prefix, AP4_Size size)
+{
+ if (size == 0) return;
+ if (indent >= size-1) indent = size-1;
+ for (unsigned int i=0; i<indent; i++) {
+ prefix[i] = ' ';
+ }
+ prefix[indent] = '\0';
+}
+
+/*----------------------------------------------------------------------
+| AP4_DurationMsFromUnits
++---------------------------------------------------------------------*/
+unsigned long
+AP4_DurationMsFromUnits(AP4_UI64 units, unsigned long units_per_second)
+{
+ if (units_per_second == 0) return 0;
+ return (unsigned long)(((float)units*1000.0f)/(float)units_per_second);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ConvertTime
++---------------------------------------------------------------------*/
+AP4_UI64
+AP4_ConvertTime(AP4_UI64 time_value,
+ unsigned long from_time_scale,
+ unsigned long to_time_scale)
+{
+ if (from_time_scale == 0) return 0;
+ float ratio = (float)to_time_scale/(float)from_time_scale;
+ return ((AP4_UI64)((float)time_value*ratio));
+}
+
+/*----------------------------------------------------------------------
+| AP4_FormatFourChars
++---------------------------------------------------------------------*/
+void
+AP4_FormatFourChars(char* str, AP4_UI32 value) {
+ str[0] = (value >> 24) & 0xFF;
+ str[1] = (value >> 16) & 0xFF;
+ str[2] = (value >> 8) & 0xFF;
+ str[3] = (value ) & 0xFF;
+ str[4] = '\0';
+}
+
+/*----------------------------------------------------------------------
+| AP4_SplitArgs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1)
+{
+ arg0 = arg;
+ char* c = arg;
+ while (*c != 0 && *c != ':') {
+ c++;
+ }
+ if (*c == ':') {
+ *c++ = '\0';
+ arg1 = c;
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SplitArgs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1, char*& arg2)
+{
+ AP4_Result result = AP4_SplitArgs(arg, arg0, arg1);
+ if (AP4_FAILED(result)) return result;
+ return AP4_SplitArgs(arg1, arg1, arg2);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HexNibble
++---------------------------------------------------------------------*/
+static unsigned char
+AP4_HexNibble(char c)
+{
+ switch (c) {
+ case '0': return 0;
+ case '1': return 1;
+ case '2': return 2;
+ case '3': return 3;
+ case '4': return 4;
+ case '5': return 5;
+ case '6': return 6;
+ case '7': return 7;
+ case '8': return 8;
+ case '9': return 9;
+ case 'a': case 'A': return 10;
+ case 'b': case 'B': return 11;
+ case 'c': case 'C': return 12;
+ case 'd': case 'D': return 13;
+ case 'e': case 'E': return 14;
+ case 'f': case 'F': return 15;
+ default: return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_ParseHex
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ParseHex(const char* hex, unsigned char* bytes, unsigned int count)
+{
+ if (strlen(hex) != 2*count) return AP4_ERROR_INVALID_PARAMETERS;
+ for (unsigned int i=0; i<count; i++) {
+ bytes[i] = (AP4_HexNibble(hex[2*i]) << 4) | (AP4_HexNibble(hex[2*i+1]));
+ }
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::AP4_PrintInspector
++---------------------------------------------------------------------*/
+AP4_PrintInspector::AP4_PrintInspector(AP4_ByteStream& stream) :
+ m_Stream(&stream),
+ m_Indent(0)
+{
+ m_Stream->AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::~AP4_PrintInspector
++---------------------------------------------------------------------*/
+AP4_PrintInspector::~AP4_PrintInspector()
+{
+ m_Stream->Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::StartElement
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::StartElement(const char* name, const char* info)
+{
+ char prefix[256];
+ AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
+ m_Stream->WriteString(prefix);
+ m_Stream->WriteString(name);
+ if (info) {
+ m_Stream->Write(" ", 1);
+ m_Stream->WriteString(info);
+ }
+ m_Stream->Write("\n", 1);
+
+ m_Indent += 2;
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::EndElement
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::EndElement()
+{
+ m_Indent -= 2;
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::AddField
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::AddField(const char* name, const char* value, FormatHint hint)
+{
+ char prefix[256];
+ AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
+ m_Stream->WriteString(prefix);
+
+ m_Stream->WriteString(name);
+ m_Stream->WriteString(" = ");
+ m_Stream->WriteString(value);
+ m_Stream->Write("\n", 1);
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::AddField
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::AddField(const char* name, AP4_UI32 value, FormatHint hint)
+{
+ char prefix[256];
+ AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
+ m_Stream->WriteString(prefix);
+
+ char str[32];
+ AP4_StringFormat(str, sizeof(str), "%d", value);
+ m_Stream->WriteString(name);
+ m_Stream->WriteString(" = ");
+ m_Stream->WriteString(str);
+ m_Stream->Write("\n", 1);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Utils.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Utils.h
new file mode 100644
index 000000000..9943fe18a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4Utils.h
@@ -0,0 +1,103 @@
+/*****************************************************************
+|
+| AP4 - Utilities
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_UTILS_H_
+#define _AP4_UTILS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Config.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| MIN & MAX
++---------------------------------------------------------------------*/
+#define MIN(a,b) (a<b)?a:b
+#define MAX(a,b) (a>b)?a:b
+
+/*----------------------------------------------------------------------
+| byte I/O
++---------------------------------------------------------------------*/
+unsigned long long AP4_BytesToUInt64BE(const unsigned char* bytes);
+unsigned long AP4_BytesToUInt32BE(const unsigned char* bytes);
+unsigned long AP4_BytesToUInt24BE(const unsigned char* bytes);
+unsigned short AP4_BytesToUInt16BE(const unsigned char* bytes);
+void AP4_BytesFromUInt64BE(unsigned char* bytes, unsigned long long value);
+void AP4_BytesFromUInt32BE(unsigned char* bytes, unsigned long value);
+void AP4_BytesFromUInt24BE(unsigned char* bytes, unsigned long value);
+void AP4_BytesFromUInt16BE(unsigned char* bytes, unsigned short value);
+unsigned long AP4_DurationMsFromUnits(AP4_UI64 units,
+ unsigned long units_per_second);
+AP4_UI64 AP4_ConvertTime(AP4_UI64 time_value,
+ unsigned long from_time_scale,
+ unsigned long to_time_scale);
+
+/*----------------------------------------------------------------------
+| string utils
++---------------------------------------------------------------------*/
+#if defined (AP4_CONFIG_HAVE_STDIO_H)
+#include <stdio.h>
+#endif
+
+#if defined (AP4_CONFIG_HAVE_SNPRINTF)
+#define AP4_StringFormat snprintf
+#else
+int AP4_StringFormat(char* str, AP4_Size size, const char* format, ...);
+#endif
+
+void AP4_FormatFourChars(char* str, AP4_UI32 value);
+AP4_Result
+AP4_ParseHex(const char* hex, unsigned char* bytes, unsigned int count);
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1, char*& arg2);
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1);
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector
++---------------------------------------------------------------------*/
+class AP4_PrintInspector : public AP4_AtomInspector {
+public:
+ AP4_PrintInspector(AP4_ByteStream& stream);
+ ~AP4_PrintInspector();
+
+ // methods
+ void StartElement(const char* name, const char* info);
+ void EndElement();
+ void AddField(const char* name, AP4_UI32 value, FormatHint hint);
+ void AddField(const char* name, const char* value, FormatHint hint);
+
+private:
+ // members
+ AP4_ByteStream* m_Stream;
+ AP4_Cardinal m_Indent;
+};
+
+#endif // _AP4_UTILS_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4VmhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4VmhdAtom.cpp
new file mode 100644
index 000000000..fb0a5b032
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4VmhdAtom.cpp
@@ -0,0 +1,92 @@
+/*****************************************************************
+|
+| AP4 - vmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4VmhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom::AP4_VmhdAtom
++---------------------------------------------------------------------*/
+AP4_VmhdAtom::AP4_VmhdAtom(AP4_UI16 graphics_mode, AP4_UI16 r, AP4_UI16 g, AP4_UI16 b) :
+ AP4_Atom(AP4_ATOM_TYPE_VMHD, 8+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_GraphicsMode(graphics_mode)
+{
+ m_OpColor[0] = r;
+ m_OpColor[1] = g;
+ m_OpColor[2] = b;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom::AP4_VmhdAtom
++---------------------------------------------------------------------*/
+AP4_VmhdAtom::AP4_VmhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_VMHD, size, true, stream)
+{
+ stream.ReadUI16(m_GraphicsMode);
+ stream.Read(m_OpColor, sizeof(m_OpColor));
+}
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VmhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // graphics mode
+ result = stream.WriteUI16(m_GraphicsMode);
+ if (AP4_FAILED(result)) return result;
+
+ // op color
+ result = stream.Write(m_OpColor, sizeof(m_OpColor));
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VmhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("graphics_mode", m_GraphicsMode);
+ char formatted[16];
+ AP4_StringFormat(formatted, sizeof(formatted), "%04x,%04x,%04x",
+ m_OpColor[0], m_OpColor[1], m_OpColor[2]);
+ inspector.AddField("op_color", formatted);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4VmhdAtom.h b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4VmhdAtom.h
new file mode 100644
index 000000000..43c8ea2d5
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/Ap4VmhdAtom.h
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - vmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_VMHD_ATOM_H_
+#define _AP4_VMHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom
++---------------------------------------------------------------------*/
+class AP4_VmhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_VmhdAtom(AP4_UI16 graphics_mode, AP4_UI16 r, AP4_UI16 g, AP4_UI16 b);
+ AP4_VmhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI16 m_GraphicsMode;
+ AP4_UI16 m_OpColor[3];
+};
+
+#endif // _AP4_VMHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries
new file mode 100644
index 000000000..d9cf322cc
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries
@@ -0,0 +1,56 @@
+/Ap4Atom.h/1.9/Fri Feb 17 21:16:07 2006//
+/Ap4AtomFactory.cpp/1.9/Fri Feb 17 21:16:07 2006//
+/Ap4AtomFactory.h/1.1/Wed Jan 18 15:27:20 2006//
+/Ap4AtomSampleTable.cpp/1.4/Fri Feb 17 21:16:07 2006//
+/Ap4AtomSampleTable.h/1.1/Sat Oct 29 15:50:44 2005//
+/Ap4AvcCAtom.cpp/1.2/Sat Nov 5 23:19:43 2005//
+/Ap4AvcCAtom.h/1.1/Tue Oct 25 00:42:32 2005//
+/Ap4ByteStream.cpp/1.1/Sat Oct 29 15:50:44 2005//
+/Ap4ByteStream.h/1.1/Sat Oct 29 15:50:44 2005//
+/Ap4ChplAtom.cpp/1.1/Sun Oct 30 19:20:28 2005//
+/Ap4ChplAtom.h/1.1/Sun Oct 30 19:20:28 2005//
+/Ap4CmvdAtom.cpp/1.1/Mon Jan 23 04:04:49 2006//
+/Ap4CmvdAtom.h/1.1/Mon Jan 23 04:04:49 2006//
+/Ap4Co64Atom.cpp/1.2/Wed Jan 18 15:27:20 2006//
+/Ap4Co64Atom.h/1.1/Sat Oct 29 15:50:44 2005//
+/Ap4ContainerAtom.cpp/1.1/Wed Jan 18 15:27:20 2006//
+/Ap4CttsAtom.cpp/1.2/Wed Jan 18 15:27:20 2006//
+/Ap4CttsAtom.h/1.2/Wed Jan 18 15:27:20 2006//
+/Ap4DataAtom.cpp/1.1/Sat Nov 5 23:19:43 2005//
+/Ap4DataAtom.h/1.1/Sat Nov 5 23:19:43 2005//
+/Ap4DcomAtom.cpp/1.1/Mon Jan 23 04:04:49 2006//
+/Ap4DcomAtom.h/1.1/Mon Jan 23 04:04:49 2006//
+/Ap4DrefAtom.cpp/1.1/Wed Jan 18 15:27:20 2006//
+/Ap4File.cpp/1.1/Wed Jan 18 15:27:20 2006//
+/Ap4FtabAtom.cpp/1.1/Tue Oct 25 21:48:26 2005//
+/Ap4FtabAtom.h/1.4/Fri Jan 6 23:46:13 2006//
+/Ap4HdlrAtom.cpp/1.1/Wed Nov 9 19:59:50 2005//
+/Ap4HdlrAtom.h/1.2/Mon Feb 6 00:53:44 2006//
+/Ap4MdhdAtom.cpp/1.2/Fri Jan 6 23:46:13 2006//
+/Ap4MdhdAtom.h/1.3/Fri Jan 6 23:46:13 2006//
+/Ap4MoovAtom.cpp/1.1/Mon Jan 23 04:04:49 2006//
+/Ap4Movie.cpp/1.1/Fri Jan 6 23:46:13 2006//
+/Ap4Movie.h/1.1/Fri Jan 6 23:46:13 2006//
+/Ap4MvhdAtom.cpp/1.1/Fri Jan 6 23:46:13 2006//
+/Ap4MvhdAtom.h/1.1/Fri Jan 6 23:46:13 2006//
+/Ap4Sample.cpp/1.1/Fri Jan 6 23:46:13 2006//
+/Ap4Sample.h/1.1/Thu Jan 5 22:04:38 2006//
+/Ap4SampleDescription.h/1.1/Mon Feb 6 00:53:44 2006//
+/Ap4SampleEntry.cpp/1.5/Sat Jan 28 11:10:09 2006//
+/Ap4SampleEntry.h/1.3/Wed Jan 18 15:27:20 2006//
+/Ap4StsdAtom.cpp/1.1/Wed Jan 18 15:27:20 2006//
+/Ap4StssAtom.h/1.1/Tue Oct 25 00:42:32 2005//
+/Ap4StszAtom.cpp/1.1/Fri Feb 17 21:16:07 2006//
+/Ap4StszAtom.h/1.1/Fri Feb 17 21:16:07 2006//
+/Ap4SttsAtom.cpp/1.2/Fri Jan 6 23:46:13 2006//
+/Ap4SttsAtom.h/1.1/Thu Jan 5 22:04:38 2006//
+/Ap4TkhdAtom.cpp/1.1/Fri Jan 6 23:46:13 2006//
+/Ap4TkhdAtom.h/1.3/Mon Feb 6 00:53:44 2006//
+/Ap4Track.cpp/1.3/Mon Feb 6 00:53:44 2006//
+/Ap4Track.h/1.3/Mon Feb 6 00:53:44 2006//
+/Ap4TrakAtom.cpp/1.2/Fri Jan 6 23:46:13 2006//
+/Ap4TrakAtom.h/1.1/Fri Jan 6 23:46:13 2006//
+/Ap4Types.h/1.2/Fri Jan 6 23:46:13 2006//
+/Ap4Utils.cpp/1.2/Fri Jan 6 23:46:13 2006//
+/Ap4Utils.h/1.2/Fri Jan 6 23:46:13 2006//
+D
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Extra b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Extra
new file mode 100644
index 000000000..cc0175b6f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Extra
@@ -0,0 +1,55 @@
+/Ap4Atom.h////
+/Ap4AtomFactory.cpp////
+/Ap4AtomFactory.h////
+/Ap4AtomSampleTable.cpp////
+/Ap4AtomSampleTable.h////
+/Ap4AvcCAtom.cpp////
+/Ap4AvcCAtom.h////
+/Ap4ByteStream.cpp////
+/Ap4ByteStream.h////
+/Ap4ChplAtom.cpp////
+/Ap4ChplAtom.h////
+/Ap4CmvdAtom.cpp////
+/Ap4CmvdAtom.h////
+/Ap4Co64Atom.cpp////
+/Ap4Co64Atom.h////
+/Ap4ContainerAtom.cpp////
+/Ap4CttsAtom.cpp////
+/Ap4CttsAtom.h////
+/Ap4DataAtom.cpp////
+/Ap4DataAtom.h////
+/Ap4DcomAtom.cpp////
+/Ap4DcomAtom.h////
+/Ap4DrefAtom.cpp////
+/Ap4File.cpp////
+/Ap4FtabAtom.cpp////
+/Ap4FtabAtom.h////
+/Ap4HdlrAtom.cpp////
+/Ap4HdlrAtom.h////
+/Ap4MdhdAtom.cpp////
+/Ap4MdhdAtom.h////
+/Ap4MoovAtom.cpp////
+/Ap4Movie.cpp////
+/Ap4Movie.h////
+/Ap4MvhdAtom.cpp////
+/Ap4MvhdAtom.h////
+/Ap4Sample.cpp////
+/Ap4Sample.h////
+/Ap4SampleDescription.h////
+/Ap4SampleEntry.cpp////
+/Ap4SampleEntry.h////
+/Ap4StsdAtom.cpp////
+/Ap4StssAtom.h////
+/Ap4StszAtom.cpp////
+/Ap4StszAtom.h////
+/Ap4SttsAtom.cpp////
+/Ap4SttsAtom.h////
+/Ap4TkhdAtom.cpp////
+/Ap4TkhdAtom.h////
+/Ap4Track.cpp////
+/Ap4Track.h////
+/Ap4TrakAtom.cpp////
+/Ap4TrakAtom.h////
+/Ap4Types.h////
+/Ap4Utils.cpp////
+/Ap4Utils.h////
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Extra.Old b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Extra.Old
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Extra.Old
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Old b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Old
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Entries.Old
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Repository b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Repository
new file mode 100644
index 000000000..84c298ade
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Repository
@@ -0,0 +1 @@
+guliverkli/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Root b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Root
new file mode 100644
index 000000000..bec0b42bd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Core/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@cvs.sourceforge.net:/cvsroot/guliverkli
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4AesBlockCipher.cpp b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4AesBlockCipher.cpp
new file mode 100644
index 000000000..6b930ca40
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4AesBlockCipher.cpp
@@ -0,0 +1,1840 @@
+/*
+* AES Block cipher
+* (c) 2005 Gilles Boccon-Gibod
+* Portions (c) 2001, Dr Brian Gladman (see below)
+*/
+
+/*
+-------------------------------------------------------------------------
+Copyright (c) 2001, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
+All rights reserved.
+
+LICENSE TERMS
+
+The free distribution and use of this software in both source and binary
+form is allowed (with or without changes) provided that:
+
+1. distributions of this source code include the above copyright
+notice, this list of conditions and the following disclaimer;
+
+2. distributions in binary form include the above copyright
+notice, this list of conditions and the following disclaimer
+in the documentation and/or other associated materials;
+
+3. the copyright holder's name is not used to endorse products
+built using this software without specific written permission.
+
+DISCLAIMER
+
+This software is provided 'as is' with no explicit or implied warranties
+in respect of its properties, including, but not limited to, correctness
+and fitness for purpose.
+-------------------------------------------------------------------------
+Issue Date: 29/07/2002
+*/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4AesBlockCipher.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| build options
++---------------------------------------------------------------------*/
+#define ENCRYPTION_KEY_SCHEDULE
+#define ENCRYPTION
+#define BLOCK_SIZE AP4_AES_BLOCK_SIZE
+
+/*----------------------------------------------------------------------
+| options
++---------------------------------------------------------------------*/
+/* START OF CONFIGURATION OPTIONS
+
+ USE OF DEFINES
+
+ Later in this section there are a number of defines that control the
+ operation of the code. In each section, the purpose of each define is
+ explained so that the relevant form can be included or excluded by
+ setting either 1's or 0's respectively on the branches of the related
+ #if clauses.
+*/
+
+/* 1. BYTE ORDER IN 32-BIT WORDS
+
+ To obtain the highest speed on processors with 32-bit words, this code
+ needs to determine the order in which bytes are packed into such words.
+ The following block of code is an attempt to capture the most obvious
+ ways in which various environemnts define byte order. It may well fail,
+ in which case the definitions will need to be set by editing at the
+ points marked **** EDIT HERE IF NECESSARY **** below.
+*/
+#define AP4_PLATFORM_LITTLE_ENDIAN 1
+
+
+#define AES_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
+#define AES_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
+
+#if !defined(AP4_PLATFORM_BYTE_ORDER)
+# error AP4_PLATFORM_BYTE_ORDER is not set
+#endif
+
+#if AP4_PLATFORM_BYTE_ORDER == AP4_PLATFORM_BIG_ENDIAN
+#define PLATFORM_BYTE_ORDER AES_BIG_ENDIAN
+#elif AP4_PLATFORM_BYTE_ORDER == AP4_PLATFORM_LITTLE_ENDIAN
+#define PLATFORM_BYTE_ORDER AES_LITTLE_ENDIAN
+#else
+#error unsupported value for AP4_PLATFORM_BYTE_ORDER
+#endif
+
+
+
+/* 2. BYTE ORDER WITHIN 32 BIT WORDS
+
+ The fundamental data processing units in Rijndael are 8-bit bytes. The
+ input, output and key input are all enumerated arrays of bytes in which
+ bytes are numbered starting at zero and increasing to one less than the
+ number of bytes in the array in question. This enumeration is only used
+ for naming bytes and does not imply any adjacency or order relationship
+ from one byte to another. When these inputs and outputs are considered
+ as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to
+ byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte.
+ In this implementation bits are numbered from 0 to 7 starting at the
+ numerically least significant end of each byte (bit n represents 2^n).
+
+ However, Rijndael can be implemented more efficiently using 32-bit
+ words by packing bytes into words so that bytes 4*n to 4*n+3 are placed
+ into word[n]. While in principle these bytes can be assembled into words
+ in any positions, this implementation only supports the two formats in
+ which bytes in adjacent positions within words also have adjacent byte
+ numbers. This order is called big-endian if the lowest numbered bytes
+ in words have the highest numeric significance and little-endian if the
+ opposite applies.
+
+ This code can work in either order irrespective of the order used by the
+ machine on which it runs. Normally the internal byte order will be set
+ to the order of the processor on which the code is to be run but this
+ define can be used to reverse this in special situations
+*/
+#if 1
+#define INTERNAL_BYTE_ORDER PLATFORM_BYTE_ORDER
+#elif defined(AES_LITTLE_ENDIAN)
+#define INTERNAL_BYTE_ORDER AES_LITTLE_ENDIAN
+#elif defined(AES_BIG_ENDIAN)
+#define INTERNAL_BYTE_ORDER AES_BIG_ENDIAN
+#endif
+
+/* 3. FAST INPUT/OUTPUT OPERATIONS.
+
+ On some machines it is possible to improve speed by transferring the
+ bytes in the input and output arrays to and from the internal 32-bit
+ variables by addressing these arrays as if they are arrays of 32-bit
+ words. On some machines this will always be possible but there may
+ be a large performance penalty if the byte arrays are not aligned on
+ the normal word boundaries. On other machines this technique will
+ lead to memory access errors when such 32-bit word accesses are not
+ properly aligned. The option SAFE_IO avoids such problems but will
+ often be slower on those machines that support misaligned access
+ (especially so if care is taken to align the input and output byte
+ arrays on 32-bit word boundaries). If SAFE_IO is not defined it is
+ assumed that access to byte arrays as if they are arrays of 32-bit
+ words will not cause problems when such accesses are misaligned.
+*/
+#if 1
+#define SAFE_IO
+#endif
+
+/* 4. LOOP UNROLLING
+
+ The code for encryption and decrytpion cycles through a number of rounds
+ that can be implemented either in a loop or by expanding the code into a
+ long sequence of instructions, the latter producing a larger program but
+ one that will often be much faster. The latter is called loop unrolling.
+ There are also potential speed advantages in expanding two iterations in
+ a loop with half the number of iterations, which is called partial loop
+ unrolling. The following options allow partial or full loop unrolling
+ to be set independently for encryption and decryption
+*/
+#if 1
+#define ENC_UNROLL FULL
+#elif 0
+#define ENC_UNROLL PARTIAL
+#else
+#define ENC_UNROLL NONE
+#endif
+
+#if 1
+#define DEC_UNROLL FULL
+#elif 0
+#define DEC_UNROLL PARTIAL
+#else
+#define DEC_UNROLL NONE
+#endif
+
+/* 5. FIXED OR DYNAMIC TABLES
+
+ When this section is included the tables used by the code are comipled
+ statically into the binary file. Otherwise they are computed once when
+ the code is first used.
+*/
+#if 1
+#define FIXED_TABLES
+#endif
+
+/* 6. FAST FINITE FIELD OPERATIONS
+
+ If this section is included, tables are used to provide faster finite
+ field arithmetic (this has no effect if FIXED_TABLES is defined).
+*/
+#if 1
+#define FF_TABLES
+#endif
+
+/* 7. INTERNAL STATE VARIABLE FORMAT
+
+ The internal state of Rijndael is stored in a number of local 32-bit
+ word varaibles which can be defined either as an array or as individual
+ names variables. Include this section if you want to store these local
+ variables in arrays. Otherwise individual local variables will be used.
+*/
+#if 1
+#define ARRAYS
+#endif
+
+/* In this implementation the columns of the state array are each held in
+ 32-bit words. The state array can be held in various ways: in an array
+ of words, in a number of individual word variables or in a number of
+ processor registers. The following define maps a variable name x and
+ a column number c to the way the state array variable is to be held.
+ The first define below maps the state into an array x[c] whereas the
+ second form maps the state into a number of individual variables x0,
+ x1, etc. Another form could map individual state colums to machine
+ register names.
+*/
+
+#if defined(ARRAYS)
+#define s(x,c) x[c]
+#else
+#define s(x,c) x##c
+#endif
+
+/* 8. VARIABLE BLOCK SIZE SPEED
+
+ This section is only relevant if you wish to use the variable block
+ length feature of the code. Include this section if you place more
+ emphasis on speed rather than code size.
+*/
+#if 1
+#define FAST_VARIABLE
+#endif
+
+/* 9. INTERNAL TABLE CONFIGURATION
+
+ This cipher proceeds by repeating in a number of cycles known as 'rounds'
+ which are implemented by a round function which can optionally be speeded
+ up using tables. The basic tables are each 256 32-bit words, with either
+ one or four tables being required for each round function depending on
+ how much speed is required. The encryption and decryption round functions
+ are different and the last encryption and decrytpion round functions are
+ different again making four different round functions in all.
+
+ This means that:
+ 1. Normal encryption and decryption rounds can each use either 0, 1
+ or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
+ 2. The last encryption and decryption rounds can also use either 0, 1
+ or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
+
+ Include or exclude the appropriate definitions below to set the number
+ of tables used by this implementation.
+*/
+
+#if 1 /* set tables for the normal encryption round */
+#define ENC_ROUND FOUR_TABLES
+#elif 0
+#define ENC_ROUND ONE_TABLE
+#else
+#define ENC_ROUND NO_TABLES
+#endif
+
+#if 1 /* set tables for the last encryption round */
+#define LAST_ENC_ROUND FOUR_TABLES
+#elif 0
+#define LAST_ENC_ROUND ONE_TABLE
+#else
+#define LAST_ENC_ROUND NO_TABLES
+#endif
+
+#if 1 /* set tables for the normal decryption round */
+#define DEC_ROUND FOUR_TABLES
+#elif 0
+#define DEC_ROUND ONE_TABLE
+#else
+#define DEC_ROUND NO_TABLES
+#endif
+
+#if 1 /* set tables for the last decryption round */
+#define LAST_DEC_ROUND FOUR_TABLES
+#elif 0
+#define LAST_DEC_ROUND ONE_TABLE
+#else
+#define LAST_DEC_ROUND NO_TABLES
+#endif
+
+/* The decryption key schedule can be speeded up with tables in the same
+ way that the round functions can. Include or exclude the following
+ defines to set this requirement.
+*/
+#if 1
+#define KEY_SCHED FOUR_TABLES
+#elif 0
+#define KEY_SCHED ONE_TABLE
+#else
+#define KEY_SCHED NO_TABLES
+#endif
+
+/* END OF CONFIGURATION OPTIONS */
+
+#define NO_TABLES 0 /* DO NOT CHANGE */
+#define ONE_TABLE 1 /* DO NOT CHANGE */
+#define FOUR_TABLES 4 /* DO NOT CHANGE */
+#define NONE 0 /* DO NOT CHANGE */
+#define PARTIAL 1 /* DO NOT CHANGE */
+#define FULL 2 /* DO NOT CHANGE */
+
+#if defined(BLOCK_SIZE) && ((BLOCK_SIZE & 3) || BLOCK_SIZE < 16 || BLOCK_SIZE > 32)
+#error An illegal block size has been specified.
+#endif
+
+#if !defined(BLOCK_SIZE)
+#define RC_LENGTH 29
+#else
+#define RC_LENGTH 5 * BLOCK_SIZE / 4 - (BLOCK_SIZE == 16 ? 10 : 11)
+#endif
+
+/* Disable at least some poor combinations of options */
+
+#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES
+#undef LAST_ENC_ROUND
+#define LAST_ENC_ROUND NO_TABLES
+#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES
+#undef LAST_ENC_ROUND
+#define LAST_ENC_ROUND ONE_TABLE
+#endif
+
+#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE
+#undef ENC_UNROLL
+#define ENC_UNROLL NONE
+#endif
+
+#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES
+#undef LAST_DEC_ROUND
+#define LAST_DEC_ROUND NO_TABLES
+#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES
+#undef LAST_DEC_ROUND
+#define LAST_DEC_ROUND ONE_TABLE
+#endif
+
+#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE
+#undef DEC_UNROLL
+#define DEC_UNROLL NONE
+#endif
+
+/* upr(x,n): rotates bytes within words by n positions, moving bytes to
+ higher index positions with wrap around into low positions
+ ups(x,n): moves bytes by n positions to higher index positions in
+ words but without wrap around
+ bval(x,n): extracts a byte from a word
+
+ NOTE: The definitions given here are intended only for use with
+ unsigned variables and with shift counts that are compile
+ time constants
+*/
+
+#if (INTERNAL_BYTE_ORDER == AES_LITTLE_ENDIAN)
+#if defined(_MSC_VER)
+#define upr(x,n) _lrotl((aes_32t)(x), 8 * (n))
+#else
+#define upr(x,n) ((aes_32t)(x) << 8 * (n) | (aes_32t)(x) >> (32 - 8 * (n)))
+#endif
+#define ups(x,n) ((aes_32t)(x) << 8 * (n))
+#define bval(x,n) ((aes_08t)((x) >> 8 * (n)))
+#define bytes2word(b0, b1, b2, b3) \
+ (((aes_32t)(b3) << 24) | ((aes_32t)(b2) << 16) | ((aes_32t)(b1) << 8) | (b0))
+#endif
+
+#if (INTERNAL_BYTE_ORDER == AES_BIG_ENDIAN)
+#define upr(x,n) ((aes_32t)(x) >> 8 * (n) | (aes_32t)(x) << 32 - 8 * (n))
+#define ups(x,n) ((aes_32t)(x) >> 8 * (n)))
+#define bval(x,n) ((aes_08t)((x) >> (24 - 8 * (n))))
+#define bytes2word(b0, b1, b2, b3) \
+ (((aes_32t)(b0) << 24) | ((aes_32t)(b1) << 16) | ((aes_32t)(b2) << 8) | (b3))
+#endif
+
+#if defined(SAFE_IO)
+
+#define word_in(x) bytes2word((x)[0], (x)[1], (x)[2], (x)[3])
+#define word_out(x,v) { (x)[0] = bval(v,0); (x)[1] = bval(v,1); \
+ (x)[2] = bval(v,2); (x)[3] = bval(v,3); }
+
+#elif (INTERNAL_BYTE_ORDER == PLATFORM_BYTE_ORDER)
+
+#define word_in(x) *(aes_32t*)(x)
+#define word_out(x,v) *(aes_32t*)(x) = (v)
+
+#else
+
+#if !defined(bswap_32)
+#if !defined(_MSC_VER)
+#define _lrotl(x,n) ((((aes_32t)(x)) << n) | (((aes_32t)(x)) >> (32 - n)))
+#endif
+#define bswap_32(x) ((_lrotl((x),8) & 0x00ff00ff) | (_lrotl((x),24) & 0xff00ff00))
+#endif
+
+#define word_in(x) bswap_32(*(aes_32t*)(x))
+#define word_out(x,v) *(aes_32t*)(x) = bswap_32(v)
+
+#endif
+
+/* the finite field modular polynomial and elements */
+
+#define WPOLY 0x011b
+#define BPOLY 0x1b
+
+/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */
+
+#define m1 0x80808080
+#define m2 0x7f7f7f7f
+#define FFmulX(x) ((((x) & m2) << 1) ^ ((((x) & m1) >> 7) * BPOLY))
+
+/* The following defines provide alternative definitions of FFmulX that might
+ give improved performance if a fast 32-bit multiply is not available. Note
+ that a temporary variable u needs to be defined where FFmulX is used.
+
+#define FFmulX(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6))
+#define m4 (0x01010101 * BPOLY)
+#define FFmulX(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4)
+*/
+
+/* Work out which tables are needed for the different options */
+
+#ifdef AES_ASM
+#ifdef ENC_ROUND
+#undef ENC_ROUND
+#endif
+#define ENC_ROUND FOUR_TABLES
+#ifdef LAST_ENC_ROUND
+#undef LAST_ENC_ROUND
+#endif
+#define LAST_ENC_ROUND FOUR_TABLES
+#ifdef DEC_ROUND
+#undef DEC_ROUND
+#endif
+#define DEC_ROUND FOUR_TABLES
+#ifdef LAST_DEC_ROUND
+#undef LAST_DEC_ROUND
+#endif
+#define LAST_DEC_ROUND FOUR_TABLES
+#ifdef KEY_SCHED
+#undef KEY_SCHED
+#define KEY_SCHED FOUR_TABLES
+#endif
+#endif
+
+#if defined(ENCRYPTION) || defined(AES_ASM)
+#if ENC_ROUND == ONE_TABLE
+#define FT1_SET
+#elif ENC_ROUND == FOUR_TABLES
+#define FT4_SET
+#else
+#define SBX_SET
+#endif
+#if LAST_ENC_ROUND == ONE_TABLE
+#define FL1_SET
+#elif LAST_ENC_ROUND == FOUR_TABLES
+#define FL4_SET
+#elif !defined(SBX_SET)
+#define SBX_SET
+#endif
+#endif
+
+#if defined(DECRYPTION) || defined(AES_ASM)
+#if DEC_ROUND == ONE_TABLE
+#define IT1_SET
+#elif DEC_ROUND == FOUR_TABLES
+#define IT4_SET
+#else
+#define ISB_SET
+#endif
+#if LAST_DEC_ROUND == ONE_TABLE
+#define IL1_SET
+#elif LAST_DEC_ROUND == FOUR_TABLES
+#define IL4_SET
+#elif !defined(ISB_SET)
+#define ISB_SET
+#endif
+#endif
+
+#if defined(ENCRYPTION_KEY_SCHEDULE) || defined(DECRYPTION_KEY_SCHEDULE)
+#if KEY_SCHED == ONE_TABLE
+#define LS1_SET
+#define IM1_SET
+#elif KEY_SCHED == FOUR_TABLES
+#define LS4_SET
+#define IM4_SET
+#elif !defined(SBX_SET)
+#define SBX_SET
+#endif
+#endif
+
+#ifdef FIXED_TABLES
+#define prefx static const
+#else
+#define prefx extern
+extern aes_08t tab_init;
+void gen_tabs(void);
+#endif
+
+//prefx aes_32t rcon_tab[29];
+//
+//#ifdef SBX_SET
+//prefx aes_08t s_box[256];
+//#endif
+//
+//#ifdef ISB_SET
+//prefx aes_08t inv_s_box[256];
+//#endif
+//
+//#ifdef FT1_SET
+//prefx aes_32t ft_tab[256];
+//#endif
+//
+//#ifdef FT4_SET
+//prefx aes_32t ft_tab[4][256];
+//#endif
+//
+//#ifdef FL1_SET
+//prefx aes_32t fl_tab[256];
+//#endif
+//
+//#ifdef FL4_SET
+//prefx aes_32t fl_tab[4][256];
+//#endif
+//
+//#ifdef IT1_SET
+//prefx aes_32t it_tab[256];
+//#endif
+//
+//#ifdef IT4_SET
+//prefx aes_32t it_tab[4][256];
+//#endif
+//
+//#ifdef IL1_SET
+//prefx aes_32t il_tab[256];
+//#endif
+//
+//#ifdef IL4_SET
+//prefx aes_32t il_tab[4][256];
+//#endif
+//
+//#ifdef LS1_SET
+//#ifdef FL1_SET
+//#undef LS1_SET
+//#else
+//prefx aes_32t ls_tab[256];
+//#endif
+//#endif
+//
+//#ifdef LS4_SET
+//#ifdef FL4_SET
+//#undef LS4_SET
+//#else
+//prefx aes_32t ls_tab[4][256];
+//#endif
+//#endif
+//
+//#ifdef IM1_SET
+//prefx aes_32t im_tab[256];
+//#endif
+//
+//#ifdef IM4_SET
+//prefx aes_32t im_tab[4][256];
+//#endif
+
+/* Set the number of columns in nc. Note that it is important
+ that nc is a constant which is known at compile time if the
+ highest speed version of the code is needed.
+*/
+
+#if defined(BLOCK_SIZE)
+#define nc (BLOCK_SIZE >> 2)
+#else
+#define nc (cx->n_blk >> 2)
+#endif
+
+/* generic definitions of Rijndael macros that use tables */
+
+#define no_table(x,box,vf,rf,c) bytes2word( \
+ box[bval(vf(x,0,c),rf(0,c))], \
+ box[bval(vf(x,1,c),rf(1,c))], \
+ box[bval(vf(x,2,c),rf(2,c))], \
+ box[bval(vf(x,3,c),rf(3,c))])
+
+#define one_table(x,op,tab,vf,rf,c) \
+ ( tab[bval(vf(x,0,c),rf(0,c))] \
+ ^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \
+ ^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \
+ ^ op(tab[bval(vf(x,3,c),rf(3,c))],3))
+
+#define four_tables(x,tab,vf,rf,c) \
+ ( tab[0][bval(vf(x,0,c),rf(0,c))] \
+ ^ tab[1][bval(vf(x,1,c),rf(1,c))] \
+ ^ tab[2][bval(vf(x,2,c),rf(2,c))] \
+ ^ tab[3][bval(vf(x,3,c),rf(3,c))])
+
+#define vf1(x,r,c) (x)
+#define rf1(r,c) (r)
+#define rf2(r,c) ((r-c)&3)
+
+/* perform forward and inverse column mix operation on four bytes in long word x in */
+/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */
+
+#define dec_fmvars
+#if defined(FM4_SET) /* not currently used */
+#define fwd_mcol(x) four_tables(x,fm_tab,vf1,rf1,0)
+#elif defined(FM1_SET) /* not currently used */
+#define fwd_mcol(x) one_table(x,upr,fm_tab,vf1,rf1,0)
+#else
+#undef dec_fmvars
+#define dec_fmvars aes_32t f1, f2;
+#define fwd_mcol(x) (f1 = (x), f2 = FFmulX(f1), f2 ^ upr(f1 ^ f2, 3) ^ upr(f1, 2) ^ upr(f1, 1))
+#endif
+
+#define dec_imvars
+#if defined(IM4_SET)
+#define inv_mcol(x) four_tables(x,im_tab,vf1,rf1,0)
+#elif defined(IM1_SET)
+#define inv_mcol(x) one_table(x,upr,im_tab,vf1,rf1,0)
+#else
+#undef dec_imvars
+#define dec_imvars aes_32t f2, f4, f8, f9;
+#define inv_mcol(x) \
+ (f9 = (x), f2 = FFmulX(f9), f4 = FFmulX(f2), f8 = FFmulX(f4), f9 ^= f8, \
+ f2 ^= f4 ^ f8 ^ upr(f2 ^ f9,3) ^ upr(f4 ^ f9,2) ^ upr(f9,1))
+#endif
+
+#if defined(FL4_SET)
+#define ls_box(x,c) four_tables(x,fl_tab,vf1,rf2,c)
+#elif defined(LS4_SET)
+#define ls_box(x,c) four_tables(x,ls_tab,vf1,rf2,c)
+#elif defined(FL1_SET)
+#define ls_box(x,c) one_table(x,upr,fl_tab,vf1,rf2,c)
+#elif defined(LS1_SET)
+#define ls_box(x,c) one_table(x,upr,ls_tab,vf1,rf2,c)
+#else
+#define ls_box(x,c) no_table(x,s_box,vf1,rf2,c)
+#endif
+
+/*----------------------------------------------------------------------
+| tables
++---------------------------------------------------------------------*/
+#if defined(FIXED_TABLES) || !defined(FF_TABLES)
+
+/* finite field arithmetic operations */
+
+#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY))
+#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY))
+#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \
+ ^ (((x>>5) & 4) * WPOLY))
+#define f3(x) (f2(x) ^ x)
+#define f9(x) (f8(x) ^ x)
+#define fb(x) (f8(x) ^ f2(x) ^ x)
+#define fd(x) (f8(x) ^ f4(x) ^ x)
+#define fe(x) (f8(x) ^ f4(x) ^ f2(x))
+
+#endif
+
+#if defined(FIXED_TABLES)
+
+#define sb_data(w) \
+ w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\
+ w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\
+ w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\
+ w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\
+ w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\
+ w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\
+ w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\
+ w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\
+ w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\
+ w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\
+ w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\
+ w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\
+ w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\
+ w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\
+ w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\
+ w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\
+ w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\
+ w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\
+ w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\
+ w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\
+ w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\
+ w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\
+ w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\
+ w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\
+ w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\
+ w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\
+ w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\
+ w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\
+ w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\
+ w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\
+ w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\
+ w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16)
+
+#define isb_data(w) \
+ w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\
+ w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\
+ w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\
+ w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\
+ w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\
+ w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\
+ w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\
+ w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\
+ w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\
+ w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\
+ w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\
+ w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\
+ w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\
+ w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\
+ w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\
+ w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\
+ w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\
+ w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\
+ w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\
+ w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\
+ w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\
+ w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\
+ w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\
+ w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\
+ w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\
+ w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\
+ w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\
+ w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\
+ w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\
+ w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\
+ w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\
+ w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d),
+
+#define mm_data(w) \
+ w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\
+ w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\
+ w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\
+ w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\
+ w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\
+ w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\
+ w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\
+ w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\
+ w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\
+ w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\
+ w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\
+ w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\
+ w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\
+ w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\
+ w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\
+ w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\
+ w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\
+ w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\
+ w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\
+ w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\
+ w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\
+ w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\
+ w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\
+ w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\
+ w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\
+ w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\
+ w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\
+ w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\
+ w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\
+ w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\
+ w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\
+ w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff)
+
+#define h0(x) (x)
+
+/* These defines are used to ensure tables are generated in the
+ right format depending on the internal byte order required
+*/
+
+#define w0(p) bytes2word(p, 0, 0, 0)
+#define w1(p) bytes2word(0, p, 0, 0)
+#define w2(p) bytes2word(0, 0, p, 0)
+#define w3(p) bytes2word(0, 0, 0, p)
+
+/* Number of elements required in this table for different
+ block and key lengths is:
+
+ Rcon Table key length (bytes)
+ Length 16 20 24 28 32
+ ---------------------
+ block 16 | 10 9 8 7 7
+ length 20 | 14 11 10 9 9
+ (bytes) 24 | 19 15 12 11 11
+ 28 | 24 19 16 13 13
+ 32 | 29 23 19 17 14
+
+ this table can be a table of bytes if the key schedule
+ code is adjusted accordingly
+*/
+
+#define u0(p) bytes2word(f2(p), p, p, f3(p))
+#define u1(p) bytes2word(f3(p), f2(p), p, p)
+#define u2(p) bytes2word(p, f3(p), f2(p), p)
+#define u3(p) bytes2word(p, p, f3(p), f2(p))
+
+#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p))
+#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p))
+#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p))
+#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p))
+
+static const aes_32t rcon_tab[29] =
+{
+ w0(0x01), w0(0x02), w0(0x04), w0(0x08),
+ w0(0x10), w0(0x20), w0(0x40), w0(0x80),
+ w0(0x1b), w0(0x36), w0(0x6c), w0(0xd8),
+ w0(0xab), w0(0x4d), w0(0x9a), w0(0x2f),
+ w0(0x5e), w0(0xbc), w0(0x63), w0(0xc6),
+ w0(0x97), w0(0x35), w0(0x6a), w0(0xd4),
+ w0(0xb3), w0(0x7d), w0(0xfa), w0(0xef),
+ w0(0xc5)
+};
+
+#ifdef SBX_SET
+static const aes_08t s_box[256] = { sb_data(h0) };
+#endif
+#ifdef ISB_SET
+static const aes_08t inv_s_box[256] = { isb_data(h0) };
+#endif
+
+#ifdef FT1_SET
+static const aes_32t ft_tab[256] = { sb_data(u0) };
+#endif
+#ifdef FT4_SET
+static const aes_32t ft_tab[4][256] =
+ { { sb_data(u0) }, { sb_data(u1) }, { sb_data(u2) }, { sb_data(u3) } };
+#endif
+
+#ifdef FL1_SET
+static const aes_32t fl_tab[256] = { sb_data(w0) };
+#endif
+#ifdef FL4_SET
+static const aes_32t fl_tab[4][256] =
+ { { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
+#endif
+
+#ifdef IT1_SET
+static const aes_32t it_tab[256] = { isb_data(v0) };
+#endif
+#ifdef IT4_SET
+static const aes_32t it_tab[4][256] =
+ { { isb_data(v0) }, { isb_data(v1) }, { isb_data(v2) }, { isb_data(v3) } };
+#endif
+
+#ifdef IL1_SET
+static const aes_32t il_tab[256] = { isb_data(w0) };
+#endif
+#ifdef IL4_SET
+static const aes_32t il_tab[4][256] =
+ { { isb_data(w0) }, { isb_data(w1) }, { isb_data(w2) }, { isb_data(w3) } };
+#endif
+
+#ifdef LS1_SET
+static const aes_32t ls_tab[256] = { sb_data(w0) };
+#endif
+#ifdef LS4_SET
+static const aes_32t ls_tab[4][256] =
+ { { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
+#endif
+
+#ifdef IM1_SET
+static const aes_32t im_tab[256] = { mm_data(v0) };
+#endif
+#ifdef IM4_SET
+static const aes_32t im_tab[4][256] =
+ { { mm_data(v0) }, { mm_data(v1) }, { mm_data(v2) }, { mm_data(v3) } };
+#endif
+
+#else /* dynamic table generation */
+
+aes_08t tab_init = 0;
+
+#define const
+
+static aes_32t rcon_tab[RC_LENGTH];
+
+#ifdef SBX_SET
+aes_08t s_box[256];
+#endif
+#ifdef ISB_SET
+aes_08t inv_s_box[256];
+#endif
+
+#ifdef FT1_SET
+aes_32t ft_tab[256];
+#endif
+#ifdef FT4_SET
+aes_32t ft_tab[4][256];
+#endif
+
+#ifdef FL1_SET
+aes_32t fl_tab[256];
+#endif
+#ifdef FL4_SET
+aes_32t fl_tab[4][256];
+#endif
+
+#ifdef IT1_SET
+aes_32t it_tab[256];
+#endif
+#ifdef IT4_SET
+aes_32t it_tab[4][256];
+#endif
+
+#ifdef IL1_SET
+aes_32t il_tab[256];
+#endif
+#ifdef IL4_SET
+aes_32t il_tab[4][256];
+#endif
+
+#ifdef LS1_SET
+aes_32t ls_tab[256];
+#endif
+#ifdef LS4_SET
+aes_32t ls_tab[4][256];
+#endif
+
+#ifdef IM1_SET
+aes_32t im_tab[256];
+#endif
+#ifdef IM4_SET
+aes_32t im_tab[4][256];
+#endif
+
+#if !defined(FF_TABLES)
+
+/* Generate the tables for the dynamic table option
+
+ It will generally be sensible to use tables to compute finite
+ field multiplies and inverses but where memory is scarse this
+ code might sometimes be better. But it only has effect during
+ initialisation so its pretty unimportant in overall terms.
+*/
+
+/* return 2 ^ (n - 1) where n is the bit number of the highest bit
+ set in x with x in the range 1 < x < 0x00000200. This form is
+ used so that locals within fi can be bytes rather than words
+*/
+
+static aes_08t hibit(const aes_32t x)
+{ aes_08t r = (aes_08t)((x >> 1) | (x >> 2));
+
+ r |= (r >> 2);
+ r |= (r >> 4);
+ return (r + 1) >> 1;
+}
+
+/* return the inverse of the finite field element x */
+
+static aes_08t fi(const aes_08t x)
+{ aes_08t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0;
+
+ if(x < 2) return x;
+
+ for(;;)
+ {
+ if(!n1) return v1;
+
+ while(n2 >= n1)
+ {
+ n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2);
+ }
+
+ if(!n2) return v2;
+
+ while(n1 >= n2)
+ {
+ n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1);
+ }
+ }
+}
+
+#else
+
+/* define the finite field multiplies required for Rijndael */
+
+#define f2(x) ((x) ? pow[log[x] + 0x19] : 0)
+#define f3(x) ((x) ? pow[log[x] + 0x01] : 0)
+#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0)
+#define fb(x) ((x) ? pow[log[x] + 0x68] : 0)
+#define fd(x) ((x) ? pow[log[x] + 0xee] : 0)
+#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0)
+#define fi(x) ((x) ? pow[255 - log[x]]: 0)
+
+#endif
+
+/* The forward and inverse affine transformations used in the S-box */
+
+#define fwd_affine(x) \
+ (w = (aes_32t)x, w ^= (w<<1)^(w<<2)^(w<<3)^(w<<4), 0x63^(aes_08t)(w^(w>>8)))
+
+#define inv_affine(x) \
+ (w = (aes_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(aes_08t)(w^(w>>8)))
+
+void gen_tabs(void)
+{ aes_32t i, w;
+
+#if defined(FF_TABLES)
+
+ aes_08t pow[512], log[256];
+
+ /* log and power tables for GF(2^8) finite field with
+ WPOLY as modular polynomial - the simplest primitive
+ root is 0x03, used here to generate the tables
+ */
+
+ i = 0; w = 1;
+ do
+ {
+ pow[i] = (aes_08t)w;
+ pow[i + 255] = (aes_08t)w;
+ log[w] = (aes_08t)i++;
+ w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0);
+ }
+ while (w != 1);
+
+#endif
+
+ for(i = 0, w = 1; i < RC_LENGTH; ++i)
+ {
+ rcon_tab[i] = bytes2word(w, 0, 0, 0);
+ w = f2(w);
+ }
+
+ for(i = 0; i < 256; ++i)
+ { aes_08t b;
+
+ b = fwd_affine(fi((aes_08t)i));
+ w = bytes2word(f2(b), b, b, f3(b));
+
+#ifdef SBX_SET
+ s_box[i] = b;
+#endif
+
+#ifdef FT1_SET /* tables for a normal encryption round */
+ ft_tab[i] = w;
+#endif
+#ifdef FT4_SET
+ ft_tab[0][i] = w;
+ ft_tab[1][i] = upr(w,1);
+ ft_tab[2][i] = upr(w,2);
+ ft_tab[3][i] = upr(w,3);
+#endif
+ w = bytes2word(b, 0, 0, 0);
+
+#ifdef FL1_SET /* tables for last encryption round (may also */
+ fl_tab[i] = w; /* be used in the key schedule) */
+#endif
+#ifdef FL4_SET
+ fl_tab[0][i] = w;
+ fl_tab[1][i] = upr(w,1);
+ fl_tab[2][i] = upr(w,2);
+ fl_tab[3][i] = upr(w,3);
+#endif
+
+#ifdef LS1_SET /* table for key schedule if fl_tab above is */
+ ls_tab[i] = w; /* not of the required form */
+#endif
+#ifdef LS4_SET
+ ls_tab[0][i] = w;
+ ls_tab[1][i] = upr(w,1);
+ ls_tab[2][i] = upr(w,2);
+ ls_tab[3][i] = upr(w,3);
+#endif
+
+ b = fi(inv_affine((aes_08t)i));
+ w = bytes2word(fe(b), f9(b), fd(b), fb(b));
+
+#ifdef IM1_SET /* tables for the inverse mix column operation */
+ im_tab[b] = w;
+#endif
+#ifdef IM4_SET
+ im_tab[0][b] = w;
+ im_tab[1][b] = upr(w,1);
+ im_tab[2][b] = upr(w,2);
+ im_tab[3][b] = upr(w,3);
+#endif
+
+#ifdef ISB_SET
+ inv_s_box[i] = b;
+#endif
+#ifdef IT1_SET /* tables for a normal decryption round */
+ it_tab[i] = w;
+#endif
+#ifdef IT4_SET
+ it_tab[0][i] = w;
+ it_tab[1][i] = upr(w,1);
+ it_tab[2][i] = upr(w,2);
+ it_tab[3][i] = upr(w,3);
+#endif
+ w = bytes2word(b, 0, 0, 0);
+#ifdef IL1_SET /* tables for last decryption round */
+ il_tab[i] = w;
+#endif
+#ifdef IL4_SET
+ il_tab[0][i] = w;
+ il_tab[1][i] = upr(w,1);
+ il_tab[2][i] = upr(w,2);
+ il_tab[3][i] = upr(w,3);
+#endif
+ }
+
+ tab_init = 1;
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| key schedule
++---------------------------------------------------------------------*/
+#if !defined(BLOCK_SIZE)
+
+static aes_rval aes_blk_len(unsigned int blen, aes_ctx cx[1])
+{
+#if !defined(FIXED_TABLES)
+ if(!tab_init) gen_tabs();
+#endif
+
+ if((blen & 7) || blen < 16 || blen > 32)
+ {
+ cx->n_blk = 0; return aes_bad;
+ }
+
+ cx->n_blk = blen;
+ return aes_good;
+}
+
+#endif
+
+/* Initialise the key schedule from the user supplied key. The key
+ length is now specified in bytes - 16, 24 or 32 as appropriate.
+ This corresponds to bit lengths of 128, 192 and 256 bits, and
+ to Nk values of 4, 6 and 8 respectively.
+
+ The following macros implement a single cycle in the key
+ schedule generation process. The number of cycles needed
+ for each cx->n_col and nk value is:
+
+ nk = 4 5 6 7 8
+ ------------------------------
+ cx->n_col = 4 10 9 8 7 7
+ cx->n_col = 5 14 11 10 9 9
+ cx->n_col = 6 19 15 12 11 11
+ cx->n_col = 7 21 19 16 13 14
+ cx->n_col = 8 29 23 19 17 14
+*/
+
+#define ke4(k,i) \
+{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
+ k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
+}
+#define kel4(k,i) \
+{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
+ k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
+}
+
+#define ke6(k,i) \
+{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
+ k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
+ k[6*(i)+10] = ss[4] ^= ss[3]; k[6*(i)+11] = ss[5] ^= ss[4]; \
+}
+#define kel6(k,i) \
+{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
+ k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
+}
+
+#define ke8(k,i) \
+{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
+ k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
+ k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); k[8*(i)+13] = ss[5] ^= ss[4]; \
+ k[8*(i)+14] = ss[6] ^= ss[5]; k[8*(i)+15] = ss[7] ^= ss[6]; \
+}
+#define kel8(k,i) \
+{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
+ k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
+}
+
+#if defined(ENCRYPTION_KEY_SCHEDULE)
+
+static aes_rval aes_enc_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
+{ aes_32t ss[8];
+
+#if !defined(FIXED_TABLES)
+ if(!tab_init) gen_tabs();
+#endif
+
+#if !defined(BLOCK_SIZE)
+ if(!cx->n_blk) cx->n_blk = 16;
+#else
+ cx->n_blk = BLOCK_SIZE;
+#endif
+
+ cx->n_blk = (cx->n_blk & ~3) | 1;
+
+ cx->k_sch[0] = ss[0] = word_in(in_key );
+ cx->k_sch[1] = ss[1] = word_in(in_key + 4);
+ cx->k_sch[2] = ss[2] = word_in(in_key + 8);
+ cx->k_sch[3] = ss[3] = word_in(in_key + 12);
+
+#if (BLOCK_SIZE == 16) && (ENC_UNROLL != NONE)
+
+ switch(klen)
+ {
+ case 16: ke4(cx->k_sch, 0); ke4(cx->k_sch, 1);
+ ke4(cx->k_sch, 2); ke4(cx->k_sch, 3);
+ ke4(cx->k_sch, 4); ke4(cx->k_sch, 5);
+ ke4(cx->k_sch, 6); ke4(cx->k_sch, 7);
+ ke4(cx->k_sch, 8); kel4(cx->k_sch, 9);
+ cx->n_rnd = 10; break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ ke6(cx->k_sch, 0); ke6(cx->k_sch, 1);
+ ke6(cx->k_sch, 2); ke6(cx->k_sch, 3);
+ ke6(cx->k_sch, 4); ke6(cx->k_sch, 5);
+ ke6(cx->k_sch, 6); kel6(cx->k_sch, 7);
+ cx->n_rnd = 12; break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ ke8(cx->k_sch, 0); ke8(cx->k_sch, 1);
+ ke8(cx->k_sch, 2); ke8(cx->k_sch, 3);
+ ke8(cx->k_sch, 4); ke8(cx->k_sch, 5);
+ kel8(cx->k_sch, 6);
+ cx->n_rnd = 14; break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+#else
+ { aes_32t i, l;
+ cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
+ l = (nc * cx->n_rnd + nc - 1) / (klen >> 2);
+
+ switch(klen)
+ {
+ case 16: for(i = 0; i < l; ++i)
+ ke4(cx->k_sch, i);
+ break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ for(i = 0; i < l; ++i)
+ ke6(cx->k_sch, i);
+ break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ for(i = 0; i < l; ++i)
+ ke8(cx->k_sch, i);
+ break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+ }
+#endif
+
+ return aes_good;
+}
+
+#endif
+
+#if defined(DECRYPTION_KEY_SCHEDULE)
+
+#if (DEC_ROUND != NO_TABLES)
+#define d_vars dec_imvars
+#define ff(x) inv_mcol(x)
+#else
+#define ff(x) (x)
+#define d_vars
+#endif
+
+#if 1
+#define kdf4(k,i) \
+{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; ss[1] = ss[1] ^ ss[3]; ss[2] = ss[2] ^ ss[3]; ss[3] = ss[3]; \
+ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ rcon_tab[i]; ss[i % 4] ^= ss[4]; \
+ ss[4] ^= k[4*(i)]; k[4*(i)+4] = ff(ss[4]); ss[4] ^= k[4*(i)+1]; k[4*(i)+5] = ff(ss[4]); \
+ ss[4] ^= k[4*(i)+2]; k[4*(i)+6] = ff(ss[4]); ss[4] ^= k[4*(i)+3]; k[4*(i)+7] = ff(ss[4]); \
+}
+#define kd4(k,i) \
+{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ rcon_tab[i]; ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \
+ k[4*(i)+4] = ss[4] ^= k[4*(i)]; k[4*(i)+5] = ss[4] ^= k[4*(i)+1]; \
+ k[4*(i)+6] = ss[4] ^= k[4*(i)+2]; k[4*(i)+7] = ss[4] ^= k[4*(i)+3]; \
+}
+#define kdl4(k,i) \
+{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ rcon_tab[i]; ss[i % 4] ^= ss[4]; \
+ k[4*(i)+4] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; k[4*(i)+5] = ss[1] ^ ss[3]; \
+ k[4*(i)+6] = ss[0]; k[4*(i)+7] = ss[1]; \
+}
+#else
+#define kdf4(k,i) \
+{ ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+ 4] = ff(ss[0]); ss[1] ^= ss[0]; k[4*(i)+ 5] = ff(ss[1]); \
+ ss[2] ^= ss[1]; k[4*(i)+ 6] = ff(ss[2]); ss[3] ^= ss[2]; k[4*(i)+ 7] = ff(ss[3]); \
+}
+#define kd4(k,i) \
+{ ss[4] = ls_box(ss[3],3) ^ rcon_tab[i]; \
+ ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[4*(i)+ 4] = ss[4] ^= k[4*(i)]; \
+ ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[4] ^= k[4*(i)+ 1]; \
+ ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[4] ^= k[4*(i)+ 2]; \
+ ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[4] ^= k[4*(i)+ 3]; \
+}
+#define kdl4(k,i) \
+{ ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+ 4] = ss[0]; ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[1]; \
+ ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[2]; ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[3]; \
+}
+#endif
+
+#define kdf6(k,i) \
+{ ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 6] = ff(ss[0]); ss[1] ^= ss[0]; k[6*(i)+ 7] = ff(ss[1]); \
+ ss[2] ^= ss[1]; k[6*(i)+ 8] = ff(ss[2]); ss[3] ^= ss[2]; k[6*(i)+ 9] = ff(ss[3]); \
+ ss[4] ^= ss[3]; k[6*(i)+10] = ff(ss[4]); ss[5] ^= ss[4]; k[6*(i)+11] = ff(ss[5]); \
+}
+#define kd6(k,i) \
+{ ss[6] = ls_box(ss[5],3) ^ rcon_tab[i]; \
+ ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[6*(i)+ 6] = ss[6] ^= k[6*(i)]; \
+ ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[6] ^= k[6*(i)+ 1]; \
+ ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[6] ^= k[6*(i)+ 2]; \
+ ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[6] ^= k[6*(i)+ 3]; \
+ ss[4] ^= ss[3]; k[6*(i)+10] = ss[6] ^= k[6*(i)+ 4]; \
+ ss[5] ^= ss[4]; k[6*(i)+11] = ss[6] ^= k[6*(i)+ 5]; \
+}
+#define kdl6(k,i) \
+{ ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 6] = ss[0]; ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[1]; \
+ ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[2]; ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[3]; \
+}
+
+#define kdf8(k,i) \
+{ ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 8] = ff(ss[0]); ss[1] ^= ss[0]; k[8*(i)+ 9] = ff(ss[1]); \
+ ss[2] ^= ss[1]; k[8*(i)+10] = ff(ss[2]); ss[3] ^= ss[2]; k[8*(i)+11] = ff(ss[3]); \
+ ss[4] ^= ls_box(ss[3],0); k[8*(i)+12] = ff(ss[4]); ss[5] ^= ss[4]; k[8*(i)+13] = ff(ss[5]); \
+ ss[6] ^= ss[5]; k[8*(i)+14] = ff(ss[6]); ss[7] ^= ss[6]; k[8*(i)+15] = ff(ss[7]); \
+}
+#define kd8(k,i) \
+{ aes_32t g = ls_box(ss[7],3) ^ rcon_tab[i]; \
+ ss[0] ^= g; g = ff(g); k[8*(i)+ 8] = g ^= k[8*(i)]; \
+ ss[1] ^= ss[0]; k[8*(i)+ 9] = g ^= k[8*(i)+ 1]; \
+ ss[2] ^= ss[1]; k[8*(i)+10] = g ^= k[8*(i)+ 2]; \
+ ss[3] ^= ss[2]; k[8*(i)+11] = g ^= k[8*(i)+ 3]; \
+ g = ls_box(ss[3],0); \
+ ss[4] ^= g; g = ff(g); k[8*(i)+12] = g ^= k[8*(i)+ 4]; \
+ ss[5] ^= ss[4]; k[8*(i)+13] = g ^= k[8*(i)+ 5]; \
+ ss[6] ^= ss[5]; k[8*(i)+14] = g ^= k[8*(i)+ 6]; \
+ ss[7] ^= ss[6]; k[8*(i)+15] = g ^= k[8*(i)+ 7]; \
+}
+#define kdl8(k,i) \
+{ ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 8] = ss[0]; ss[1] ^= ss[0]; k[8*(i)+ 9] = ss[1]; \
+ ss[2] ^= ss[1]; k[8*(i)+10] = ss[2]; ss[3] ^= ss[2]; k[8*(i)+11] = ss[3]; \
+}
+
+static aes_rval aes_dec_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
+{ aes_32t ss[8];
+ d_vars
+
+#if !defined(FIXED_TABLES)
+ if(!tab_init) gen_tabs();
+#endif
+
+#if !defined(BLOCK_SIZE)
+ if(!cx->n_blk) cx->n_blk = 16;
+#else
+ cx->n_blk = BLOCK_SIZE;
+#endif
+
+ cx->n_blk = (cx->n_blk & ~3) | 2;
+
+ cx->k_sch[0] = ss[0] = word_in(in_key );
+ cx->k_sch[1] = ss[1] = word_in(in_key + 4);
+ cx->k_sch[2] = ss[2] = word_in(in_key + 8);
+ cx->k_sch[3] = ss[3] = word_in(in_key + 12);
+
+#if (BLOCK_SIZE == 16) && (DEC_UNROLL != NONE)
+
+ switch(klen)
+ {
+ case 16: kdf4(cx->k_sch, 0); kd4(cx->k_sch, 1);
+ kd4(cx->k_sch, 2); kd4(cx->k_sch, 3);
+ kd4(cx->k_sch, 4); kd4(cx->k_sch, 5);
+ kd4(cx->k_sch, 6); kd4(cx->k_sch, 7);
+ kd4(cx->k_sch, 8); kdl4(cx->k_sch, 9);
+ cx->n_rnd = 10; break;
+ case 24: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
+ cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
+ kdf6(cx->k_sch, 0); kd6(cx->k_sch, 1);
+ kd6(cx->k_sch, 2); kd6(cx->k_sch, 3);
+ kd6(cx->k_sch, 4); kd6(cx->k_sch, 5);
+ kd6(cx->k_sch, 6); kdl6(cx->k_sch, 7);
+ cx->n_rnd = 12; break;
+ case 32: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
+ cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
+ cx->k_sch[6] = ff(ss[6] = word_in(in_key + 24));
+ cx->k_sch[7] = ff(ss[7] = word_in(in_key + 28));
+ kdf8(cx->k_sch, 0); kd8(cx->k_sch, 1);
+ kd8(cx->k_sch, 2); kd8(cx->k_sch, 3);
+ kd8(cx->k_sch, 4); kd8(cx->k_sch, 5);
+ kdl8(cx->k_sch, 6);
+ cx->n_rnd = 14; break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+#else
+ { aes_32t i, l;
+ cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
+ l = (nc * cx->n_rnd + nc - 1) / (klen >> 2);
+
+ switch(klen)
+ {
+ case 16:
+ for(i = 0; i < l; ++i)
+ ke4(cx->k_sch, i);
+ break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ for(i = 0; i < l; ++i)
+ ke6(cx->k_sch, i);
+ break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ for(i = 0; i < l; ++i)
+ ke8(cx->k_sch, i);
+ break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+#if (DEC_ROUND != NO_TABLES)
+ for(i = nc; i < nc * cx->n_rnd; ++i)
+ cx->k_sch[i] = inv_mcol(cx->k_sch[i]);
+#endif
+ }
+#endif
+
+ return aes_good;
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| cipher
++---------------------------------------------------------------------*/
+#define unused 77 /* Sunset Strip */
+
+#define si(y,x,k,c) s(y,c) = word_in(x + 4 * c) ^ k[c]
+#define so(y,x,c) word_out(y + 4 * c, s(x,c))
+
+#if BLOCK_SIZE == 16
+
+#if defined(ARRAYS)
+#define locals(y,x) x[4],y[4]
+#else
+#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3
+ /*
+ the following defines prevent the compiler requiring the declaration
+ of generated but unused variables in the fwd_var and inv_var macros
+ */
+#define b04 unused
+#define b05 unused
+#define b06 unused
+#define b07 unused
+#define b14 unused
+#define b15 unused
+#define b16 unused
+#define b17 unused
+#endif
+#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
+ s(y,2) = s(x,2); s(y,3) = s(x,3);
+#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3)
+#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3)
+#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3)
+
+#elif BLOCK_SIZE == 24
+
+#if defined(ARRAYS)
+#define locals(y,x) x[6],y[6]
+#else
+#define locals(y,x) x##0,x##1,x##2,x##3,x##4,x##5, \
+ y##0,y##1,y##2,y##3,y##4,y##5
+#define b06 unused
+#define b07 unused
+#define b16 unused
+#define b17 unused
+#endif
+#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
+ s(y,2) = s(x,2); s(y,3) = s(x,3); \
+ s(y,4) = s(x,4); s(y,5) = s(x,5);
+#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); \
+ si(y,x,k,3); si(y,x,k,4); si(y,x,k,5)
+#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); \
+ so(y,x,3); so(y,x,4); so(y,x,5)
+#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); \
+ rm(y,x,k,3); rm(y,x,k,4); rm(y,x,k,5)
+#else
+
+#if defined(ARRAYS)
+#define locals(y,x) x[8],y[8]
+#else
+#define locals(y,x) x##0,x##1,x##2,x##3,x##4,x##5,x##6,x##7, \
+ y##0,y##1,y##2,y##3,y##4,y##5,y##6,y##7
+#endif
+#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
+ s(y,2) = s(x,2); s(y,3) = s(x,3); \
+ s(y,4) = s(x,4); s(y,5) = s(x,5); \
+ s(y,6) = s(x,6); s(y,7) = s(x,7);
+
+#if BLOCK_SIZE == 32
+
+#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3); \
+ si(y,x,k,4); si(y,x,k,5); si(y,x,k,6); si(y,x,k,7)
+#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3); \
+ so(y,x,4); so(y,x,5); so(y,x,6); so(y,x,7)
+#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3); \
+ rm(y,x,k,4); rm(y,x,k,5); rm(y,x,k,6); rm(y,x,k,7)
+#else
+
+#define state_in(y,x,k) \
+switch(nc) \
+{ case 8: si(y,x,k,7); si(y,x,k,6); \
+ case 6: si(y,x,k,5); si(y,x,k,4); \
+ case 4: si(y,x,k,3); si(y,x,k,2); \
+ si(y,x,k,1); si(y,x,k,0); \
+}
+
+#define state_out(y,x) \
+switch(nc) \
+{ case 8: so(y,x,7); so(y,x,6); \
+ case 6: so(y,x,5); so(y,x,4); \
+ case 4: so(y,x,3); so(y,x,2); \
+ so(y,x,1); so(y,x,0); \
+}
+
+#if defined(FAST_VARIABLE)
+
+#define round(rm,y,x,k) \
+switch(nc) \
+{ case 8: rm(y,x,k,7); rm(y,x,k,6); \
+ rm(y,x,k,5); rm(y,x,k,4); \
+ rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+ break; \
+ case 6: rm(y,x,k,5); rm(y,x,k,4); \
+ rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+ break; \
+ case 4: rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+ break; \
+}
+#else
+
+#define round(rm,y,x,k) \
+switch(nc) \
+{ case 8: rm(y,x,k,7); rm(y,x,k,6); \
+ case 6: rm(y,x,k,5); rm(y,x,k,4); \
+ case 4: rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+}
+
+#endif
+
+#endif
+#endif
+
+#if defined(ENCRYPTION)
+
+/* I am grateful to Frank Yellin for the following construction
+ (and that for decryption) which, given the column (c) of the
+ output state variable, gives the input state variables which
+ are needed in its computation for each row (r) of the state.
+
+ For the fixed block size options, compilers should be able to
+ reduce this complex expression (and the equivalent one for
+ decryption) to a static variable reference at compile time.
+ But for variable block size code, there will be some limbs on
+ which conditional clauses will be returned.
+*/
+
+/* y = output word, x = input word, r = row, c = column for r = 0,
+ 1, 2 and 3 = column accessed for row r.
+*/
+
+#define fwd_var(x,r,c)\
+ ( r == 0 ? \
+ ( c == 0 ? s(x,0) \
+ : c == 1 ? s(x,1) \
+ : c == 2 ? s(x,2) \
+ : c == 3 ? s(x,3) \
+ : c == 4 ? s(x,4) \
+ : c == 5 ? s(x,5) \
+ : c == 6 ? s(x,6) \
+ : s(x,7))\
+ : r == 1 ? \
+ ( c == 0 ? s(x,1) \
+ : c == 1 ? s(x,2) \
+ : c == 2 ? s(x,3) \
+ : c == 3 ? nc == 4 ? s(x,0) : s(x,4) \
+ : c == 4 ? s(x,5) \
+ : c == 5 ? nc == 8 ? s(x,6) : s(x,0) \
+ : c == 6 ? s(x,7) \
+ : s(x,0))\
+ : r == 2 ? \
+ ( c == 0 ? nc == 8 ? s(x,3) : s(x,2) \
+ : c == 1 ? nc == 8 ? s(x,4) : s(x,3) \
+ : c == 2 ? nc == 4 ? s(x,0) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 3 ? nc == 4 ? s(x,1) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 4 ? nc == 8 ? s(x,7) : s(x,0) \
+ : c == 5 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 6 ? s(x,1) \
+ : s(x,2))\
+ : \
+ ( c == 0 ? nc == 8 ? s(x,4) : s(x,3) \
+ : c == 1 ? nc == 4 ? s(x,0) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 2 ? nc == 4 ? s(x,1) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 3 ? nc == 4 ? s(x,2) : nc == 8 ? s(x,7) : s(x,0) \
+ : c == 4 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 5 ? nc == 8 ? s(x,1) : s(x,2) \
+ : c == 6 ? s(x,2) \
+ : s(x,3)))
+
+#if defined(FT4_SET)
+#undef dec_fmvars
+#define dec_fmvars
+#define fwd_rnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,ft_tab,fwd_var,rf1,c)
+#elif defined(FT1_SET)
+#undef dec_fmvars
+#define dec_fmvars
+#define fwd_rnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,upr,ft_tab,fwd_var,rf1,c)
+#else
+#define fwd_rnd(y,x,k,c) s(y,c) = fwd_mcol(no_table(x,s_box,fwd_var,rf1,c)) ^ (k)[c]
+#endif
+
+#if defined(FL4_SET)
+#define fwd_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,fl_tab,fwd_var,rf1,c)
+#elif defined(FL1_SET)
+#define fwd_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,ups,fl_tab,fwd_var,rf1,c)
+#else
+#define fwd_lrnd(y,x,k,c) s(y,c) = no_table(x,s_box,fwd_var,rf1,c) ^ (k)[c]
+#endif
+
+static aes_rval aes_enc_blk(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1])
+{ aes_32t locals(b0, b1);
+ const aes_32t *kp = cx->k_sch;
+ dec_fmvars /* declare variables for fwd_mcol() if needed */
+
+ if(!(cx->n_blk & 1)) return aes_bad;
+
+ state_in(b0, in_blk, kp);
+
+#if (ENC_UNROLL == FULL)
+
+ kp += (cx->n_rnd - 9) * nc;
+
+ switch(cx->n_rnd)
+ {
+ case 14: round(fwd_rnd, b1, b0, kp - 4 * nc);
+ round(fwd_rnd, b0, b1, kp - 3 * nc);
+ case 12: round(fwd_rnd, b1, b0, kp - 2 * nc);
+ round(fwd_rnd, b0, b1, kp - nc);
+ case 10: round(fwd_rnd, b1, b0, kp );
+ round(fwd_rnd, b0, b1, kp + nc);
+ round(fwd_rnd, b1, b0, kp + 2 * nc);
+ round(fwd_rnd, b0, b1, kp + 3 * nc);
+ round(fwd_rnd, b1, b0, kp + 4 * nc);
+ round(fwd_rnd, b0, b1, kp + 5 * nc);
+ round(fwd_rnd, b1, b0, kp + 6 * nc);
+ round(fwd_rnd, b0, b1, kp + 7 * nc);
+ round(fwd_rnd, b1, b0, kp + 8 * nc);
+ round(fwd_lrnd, b0, b1, kp + 9 * nc);
+ }
+#else
+
+#if (ENC_UNROLL == PARTIAL)
+ { aes_32t rnd;
+ for(rnd = 0; rnd < (cx->n_rnd >> 1) - 1; ++rnd)
+ {
+ kp += nc;
+ round(fwd_rnd, b1, b0, kp);
+ kp += nc;
+ round(fwd_rnd, b0, b1, kp);
+ }
+ kp += nc;
+ round(fwd_rnd, b1, b0, kp);
+#else
+ { aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
+ for(rnd = 0; rnd < cx->n_rnd - 1; ++rnd)
+ {
+ kp += nc;
+ round(fwd_rnd, p1, p0, kp);
+ pt = p0, p0 = p1, p1 = pt;
+ }
+#endif
+ kp += nc;
+ round(fwd_lrnd, b0, b1, kp);
+ }
+#endif
+
+ state_out(out_blk, b0);
+ return aes_good;
+}
+
+#endif
+
+#if defined(DECRYPTION)
+
+#define inv_var(x,r,c) \
+ ( r == 0 ? \
+ ( c == 0 ? s(x,0) \
+ : c == 1 ? s(x,1) \
+ : c == 2 ? s(x,2) \
+ : c == 3 ? s(x,3) \
+ : c == 4 ? s(x,4) \
+ : c == 5 ? s(x,5) \
+ : c == 6 ? s(x,6) \
+ : s(x,7))\
+ : r == 1 ? \
+ ( c == 0 ? nc == 4 ? s(x,3) : nc == 8 ? s(x,7) : s(x,5) \
+ : c == 1 ? s(x,0) \
+ : c == 2 ? s(x,1) \
+ : c == 3 ? s(x,2) \
+ : c == 4 ? s(x,3) \
+ : c == 5 ? s(x,4) \
+ : c == 6 ? s(x,5) \
+ : s(x,6))\
+ : r == 2 ? \
+ ( c == 0 ? nc == 4 ? s(x,2) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 1 ? nc == 4 ? s(x,3) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 2 ? nc == 8 ? s(x,7) : s(x,0) \
+ : c == 3 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 4 ? nc == 8 ? s(x,1) : s(x,2) \
+ : c == 5 ? nc == 8 ? s(x,2) : s(x,3) \
+ : c == 6 ? s(x,3) \
+ : s(x,4))\
+ : \
+ ( c == 0 ? nc == 4 ? s(x,1) : nc == 8 ? s(x,4) : s(x,3) \
+ : c == 1 ? nc == 4 ? s(x,2) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 2 ? nc == 4 ? s(x,3) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 3 ? nc == 8 ? s(x,7) : s(x,0) \
+ : c == 4 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 5 ? nc == 8 ? s(x,1) : s(x,2) \
+ : c == 6 ? s(x,2) \
+ : s(x,3)))
+
+#if defined(IT4_SET)
+#undef dec_imvars
+#define dec_imvars
+#define inv_rnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,it_tab,inv_var,rf1,c)
+#elif defined(IT1_SET)
+#undef dec_imvars
+#define dec_imvars
+#define inv_rnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,upr,it_tab,inv_var,rf1,c)
+#else
+#define inv_rnd(y,x,k,c) s(y,c) = inv_mcol(no_table(x,inv_s_box,inv_var,rf1,c) ^ (k)[c])
+#endif
+
+#if defined(IL4_SET)
+#define inv_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,il_tab,inv_var,rf1,c)
+#elif defined(IL1_SET)
+#define inv_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,ups,il_tab,inv_var,rf1,c)
+#else
+#define inv_lrnd(y,x,k,c) s(y,c) = no_table(x,inv_s_box,inv_var,rf1,c) ^ (k)[c]
+#endif
+
+static aes_rval aes_dec_blk(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1])
+{ aes_32t locals(b0, b1);
+ const aes_32t *kp = cx->k_sch + nc * cx->n_rnd;
+ dec_imvars /* declare variables for inv_mcol() if needed */
+
+ if(!(cx->n_blk & 2)) return aes_bad;
+
+ state_in(b0, in_blk, kp);
+
+#if (DEC_UNROLL == FULL)
+
+ kp = cx->k_sch + 9 * nc;
+ switch(cx->n_rnd)
+ {
+ case 14: round(inv_rnd, b1, b0, kp + 4 * nc);
+ round(inv_rnd, b0, b1, kp + 3 * nc);
+ case 12: round(inv_rnd, b1, b0, kp + 2 * nc);
+ round(inv_rnd, b0, b1, kp + nc );
+ case 10: round(inv_rnd, b1, b0, kp );
+ round(inv_rnd, b0, b1, kp - nc);
+ round(inv_rnd, b1, b0, kp - 2 * nc);
+ round(inv_rnd, b0, b1, kp - 3 * nc);
+ round(inv_rnd, b1, b0, kp - 4 * nc);
+ round(inv_rnd, b0, b1, kp - 5 * nc);
+ round(inv_rnd, b1, b0, kp - 6 * nc);
+ round(inv_rnd, b0, b1, kp - 7 * nc);
+ round(inv_rnd, b1, b0, kp - 8 * nc);
+ round(inv_lrnd, b0, b1, kp - 9 * nc);
+ }
+#else
+
+#if (DEC_UNROLL == PARTIAL)
+ { aes_32t rnd;
+ for(rnd = 0; rnd < (cx->n_rnd >> 1) - 1; ++rnd)
+ {
+ kp -= nc;
+ round(inv_rnd, b1, b0, kp);
+ kp -= nc;
+ round(inv_rnd, b0, b1, kp);
+ }
+ kp -= nc;
+ round(inv_rnd, b1, b0, kp);
+#else
+ { aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
+ for(rnd = 0; rnd < cx->n_rnd - 1; ++rnd)
+ {
+ kp -= nc;
+ round(inv_rnd, p1, p0, kp);
+ pt = p0, p0 = p1, p1 = pt;
+ }
+#endif
+ kp -= nc;
+ round(inv_lrnd, b0, b1, kp);
+ }
+#endif
+
+ state_out(out_blk, b0);
+ return aes_good;
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| AP4_AesBlockCipher::AP4_AesBlockCipher
++---------------------------------------------------------------------*/
+AP4_AesBlockCipher::AP4_AesBlockCipher(const AP4_UI08* key)
+{
+ aes_enc_key(key, AP4_AES_KEY_LENGTH, &m_Context);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AesBlockCipher::~AP4_AesBlockCipher
++---------------------------------------------------------------------*/
+AP4_AesBlockCipher::~AP4_AesBlockCipher()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_AesCipher::EncryptBlock
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AesBlockCipher::EncryptBlock(const AP4_UI08* block_in, AP4_UI08* block_out)
+{
+ aes_rval result;
+ result = aes_enc_blk(block_in, block_out, &m_Context);
+ return result == aes_good ? AP4_SUCCESS : AP4_FAILURE;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4AesBlockCipher.h b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4AesBlockCipher.h
new file mode 100644
index 000000000..71137a063
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4AesBlockCipher.h
@@ -0,0 +1,82 @@
+/*
+ * AES Block cipher
+ * (c) 2005 Gilles Boccon-Gibod
+ * Portions (c) 2001, Dr Brian Gladman (see below)
+ */
+
+/*
+ -------------------------------------------------------------------------
+ Copyright (c) 2001, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
+ All rights reserved.
+
+ LICENSE TERMS
+
+ The free distribution and use of this software in both source and binary
+ form is allowed (with or without changes) provided that:
+
+ 1. distributions of this source code include the above copyright
+ notice, this list of conditions and the following disclaimer;
+
+ 2. distributions in binary form include the above copyright
+ notice, this list of conditions and the following disclaimer
+ in the documentation and/or other associated materials;
+
+ 3. the copyright holder's name is not used to endorse products
+ built using this software without specific written permission.
+
+ DISCLAIMER
+
+ This software is provided 'as is' with no explicit or implied warranties
+ in respect of its properties, including, but not limited to, correctness
+ and fitness for purpose.
+ -------------------------------------------------------------------------
+ Issue Date: 29/07/2002
+*/
+
+#ifndef _AP4_AES_BLOCK_CIPHER_H_
+#define _AP4_AES_BLOCK_CIPHER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Config.h"
+
+/*----------------------------------------------------------------------
+| AES constants
++---------------------------------------------------------------------*/
+#define AP4_AES_BLOCK_SIZE 16
+#define AP4_AES_KEY_LENGTH 16
+
+/*----------------------------------------------------------------------
+| AES types
++---------------------------------------------------------------------*/
+typedef AP4_UI32 aes_32t;
+typedef AP4_UI08 aes_08t;
+typedef unsigned int aes_rval;
+typedef struct // the AES context for encryption
+{ aes_32t k_sch[4*AP4_AES_BLOCK_SIZE]; // the encryption key schedule
+ aes_32t n_rnd; // the number of cipher rounds
+ aes_32t n_blk; // the number of bytes in the state
+} aes_ctx;
+#define aes_bad 0 // bad function return value
+#define aes_good 1 // good function return value
+
+/*----------------------------------------------------------------------
+| AP4_AesBlockCipher class
++---------------------------------------------------------------------*/
+class AP4_AesBlockCipher
+{
+ public:
+ // constructor and destructor
+ AP4_AesBlockCipher(const AP4_UI08* key);
+ ~AP4_AesBlockCipher();
+
+ // methods
+ AP4_Result EncryptBlock(const AP4_UI08* block_in, AP4_UI08* block_out);
+
+ private:
+ aes_ctx m_Context;
+};
+
+#endif // _AP4_AES_BLOCK_CIPHER_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp
new file mode 100644
index 000000000..706f533d6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.cpp
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2005 Gilles Boccon-Gibod
+ */
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4StreamCipher.h"
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::AP4_StreamCipher
++---------------------------------------------------------------------*/
+AP4_StreamCipher::AP4_StreamCipher(const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_Size iv_size) :
+ m_StreamOffset(0),
+ m_IvSize(iv_size),
+ m_BlockCipher(NULL)
+{
+ // clamp the IV size to the max supported size
+ if (iv_size > 4) {
+ m_IvSize = 4;
+ }
+
+ // set the initial state
+ Reset(key, salt);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::~AP4_StreamCipher
++---------------------------------------------------------------------*/
+AP4_StreamCipher::~AP4_StreamCipher()
+{
+ // delete the block cipher
+ if (m_BlockCipher) {
+ delete m_BlockCipher;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::Reset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StreamCipher::Reset(const AP4_UI08* key, const AP4_UI08* salt)
+{
+ if (salt) {
+ // initialize the counter with a salting key
+ for (AP4_UI32 i=0; i<AP4_AES_BLOCK_SIZE; i++) {
+ m_CBlock[i] = salt[i];
+ }
+ } else {
+ // initialize the counter with no salting key
+ for (AP4_UI32 i = 0; i < AP4_AES_BLOCK_SIZE; i++) {
+ m_CBlock[i] = 0;
+ }
+ }
+
+ // (re)create the block cipher
+ if (key != NULL) {
+ // delete the block cipher if needed
+ if (m_BlockCipher) {
+ delete m_BlockCipher;
+ }
+
+ // (re)create one
+ m_BlockCipher = new AP4_AesBlockCipher(key);
+ }
+
+ // reset the stream offset
+ SetStreamOffset(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::SetCounter
++---------------------------------------------------------------------*/
+void
+AP4_StreamCipher::SetCounter(AP4_Offset block_offset)
+{
+ // set the counter bytes
+ for (AP4_UI32 i = 0; i < m_IvSize; i++) {
+ m_CBlock[AP4_AES_BLOCK_SIZE-1-i] =
+ (AP4_UI08)((block_offset>>(8*i)) & 0xFF);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::SetStreamOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StreamCipher::SetStreamOffset(AP4_Offset offset)
+{
+ // do nothing if we're already at that offset
+ if (offset == m_StreamOffset) return AP4_SUCCESS;
+
+ // update the offset
+ m_StreamOffset = offset;
+
+ // update the key stream if necessary
+ if (m_StreamOffset & 0xF) {
+ return UpdateKeyStream(m_StreamOffset/AP4_AES_BLOCK_SIZE);
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::UpdateKeyStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StreamCipher::UpdateKeyStream(AP4_Offset block_offset)
+{
+ // compute the new counter
+ SetCounter(block_offset);
+
+ // compute the key block (x) from the counter block (c)
+ return m_BlockCipher->EncryptBlock(m_CBlock, m_XBlock);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::ProcessBuffer
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StreamCipher::ProcessBuffer(const AP4_UI08* in,
+ AP4_UI08* out,
+ AP4_Size size)
+{
+ if (m_BlockCipher == NULL) return AP4_ERROR_INVALID_STATE;
+
+ while (size) {
+ // compute the number of bytes available in this chunk
+ AP4_UI32 index = m_StreamOffset & (AP4_AES_BLOCK_SIZE-1);
+ AP4_UI32 chunk;
+
+ // update the key stream if we are on a boundary
+ if (index == 0) {
+ UpdateKeyStream(m_StreamOffset/AP4_AES_BLOCK_SIZE);
+ chunk = AP4_AES_BLOCK_SIZE;
+ }
+
+ // compute the number of bytes remaining in the chunk
+ chunk = AP4_AES_BLOCK_SIZE - index;
+ if (chunk > size) chunk = size;
+
+ // encrypt/decrypt the chunk
+ AP4_UI08* x = &m_XBlock[index];
+ for (AP4_UI32 i = 0; i < chunk; i++) {
+ *out++ = *in++ ^ *x++;
+ }
+
+ // update offset and size
+ m_StreamOffset += chunk;
+ size -= chunk;
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.h b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.h
new file mode 100644
index 000000000..3328ac6be
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/Ap4StreamCipher.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2005 Gilles Boccon-Gibod
+ */
+
+
+#ifndef _AP4_STREAM_CIPHER_H_
+#define _AP4_STREAM_CIPHER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4AesBlockCipher.h"
+#include "Ap4Results.h"
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher class
++---------------------------------------------------------------------*/
+class AP4_StreamCipher
+{
+ public:
+ // methods
+ AP4_StreamCipher(const AP4_UI08* key = NULL,
+ const AP4_UI08* salt = NULL,
+ AP4_Size iv_size = 4);
+ ~AP4_StreamCipher();
+ AP4_Result SetStreamOffset(AP4_Offset offset);
+ AP4_Result Reset(const AP4_UI08* key, const AP4_UI08* salt);
+ AP4_Result ProcessBuffer(const AP4_UI08* in,
+ AP4_UI08* out,
+ AP4_Size size);
+ AP4_Offset GeStreamOffset() { return m_StreamOffset; }
+
+ private:
+ // members
+ AP4_Offset m_StreamOffset;
+ AP4_Size m_IvSize;
+ AP4_UI08 m_CBlock[AP4_AES_BLOCK_SIZE];
+ AP4_UI08 m_XBlock[AP4_AES_BLOCK_SIZE];
+ AP4_AesBlockCipher* m_BlockCipher;
+
+ // methods
+ void SetCounter(AP4_Offset block_offset);
+ AP4_Result UpdateKeyStream(AP4_Offset block_offset);
+};
+
+#endif // _AP4_STREAM_CIPHER_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries
new file mode 100644
index 000000000..bffd06595
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries
@@ -0,0 +1,2 @@
+/Ap4AesBlockCipher.cpp/1.1/Tue Oct 25 00:42:32 2005//
+D
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Extra b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Extra
new file mode 100644
index 000000000..f8a1c7730
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Extra
@@ -0,0 +1 @@
+/Ap4AesBlockCipher.cpp////
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Extra.Old b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Extra.Old
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Extra.Old
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Old b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Old
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Entries.Old
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Repository b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Repository
new file mode 100644
index 000000000..9ab422fa9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Repository
@@ -0,0 +1 @@
+guliverkli/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Crypto
diff --git a/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Root b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Root
new file mode 100644
index 000000000..bec0b42bd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Source/Crypto/CVS/Root
@@ -0,0 +1 @@
+:pserver:anonymous@cvs.sourceforge.net:/cvsroot/guliverkli
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001.7z b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001.7z
new file mode 100644
index 000000000..226fe512c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001.7z
Binary files differ
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/.cvsignore b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/.cvsignore
new file mode 100644
index 000000000..a4383358e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/.cvsignore
@@ -0,0 +1 @@
+*.d
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Aac2Mp4.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Aac2Mp4.mak
new file mode 100644
index 000000000..28a88a9fa
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Aac2Mp4.mak
@@ -0,0 +1,43 @@
+##########################################################################
+#
+# Aac2Mp4 Program
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+include $(BUILD_ROOT)/Makefiles/Codecs.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = Aac2Mp4.cpp
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Apps/Aac2Mp4
+
+##########################################################################
+# variables
+##########################################################################
+LINK = $(LINK_CPP_OPTIONS) $(OPTIMIZE_CPP) $(DEBUG_CPP) $(PROFILE_CPP)
+
+##########################################################################
+# rules
+##########################################################################
+aac2mp4: $(TARGET_SOURCES:.cpp=.o) $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
+ $(LINK) $^ -o $@
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Bootstrap.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Bootstrap.mak
new file mode 100644
index 000000000..970b15b4e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Bootstrap.mak
@@ -0,0 +1,16 @@
+#######################################################################
+#
+# bootstrap makefile
+#
+#######################################################################
+AP4_BUILD_CONFIG = Debug
+
+ifeq ($(MAKECMDGOALS),)
+ MAKECMDGOALS = default
+else
+ TARGETS = $(MAKECMDGOALS)
+endif
+
+$(MAKECMDGOALS):
+ @[ -d $(AP4_BUILD_CONFIG) ] || mkdir $(AP4_BUILD_CONFIG)
+ @$(MAKE) -C $(AP4_BUILD_CONFIG) AP4_BUILD_CONFIG=$(AP4_BUILD_CONFIG) -f ../Local.mak $(TARGETS) \ No newline at end of file
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Codecs.exp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Codecs.exp
new file mode 100644
index 000000000..8d9d6cfc4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Codecs.exp
@@ -0,0 +1,10 @@
+##########################################################################
+#
+# Codecs target exports
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+TARGET_LIBRARIES += AP4_Codecs
+INCLUDES_CPP += -I$(SOURCE_ROOT)/Codecs
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Codecs.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Codecs.mak
new file mode 100644
index 000000000..de895d29b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Codecs.mak
@@ -0,0 +1,35 @@
+##########################################################################
+#
+# Codecs target
+#
+# (c) 2001-2005 Gilles Boccon-Gibod
+# Author: Gilles Boccon-Gibod (bok@bok.net)
+#
+##########################################################################
+
+##########################################################################
+# sources
+##########################################################################
+CODECS_SOURCES = Ap4AdtsParser.cpp Ap4BitStream.cpp
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Core.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = $(CODECS_SOURCES)
+
+libAP4_Codecs.a: $(patsubst %.cpp,%.o,$(TARGET_SOURCES))
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Codecs
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Core.exp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Core.exp
new file mode 100644
index 000000000..97a87d523
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Core.exp
@@ -0,0 +1,10 @@
+##########################################################################
+#
+# Core target exports
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+TARGET_LIBRARIES += AP4_Core
+INCLUDES_CPP += -I$(SOURCE_ROOT)/Core -I$(SOURCE_ROOT)/Config
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Core.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Core.mak
new file mode 100644
index 000000000..0c79142be
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Core.mak
@@ -0,0 +1,93 @@
+##########################################################################
+#
+# Core target
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+# Author: Gilles Boccon-Gibod (bok@bok.net)
+#
+##########################################################################
+
+##########################################################################
+# source files
+##########################################################################
+CORE_SOURCES = \
+ Ap4Atom.cpp \
+ Ap4AtomFactory.cpp \
+ Ap4ContainerAtom.cpp \
+ Ap4FrmaAtom.cpp \
+ Ap4FtypAtom.cpp \
+ Ap4HdlrAtom.cpp \
+ Ap4MdhdAtom.cpp \
+ Ap4MoovAtom.cpp \
+ Ap4MvhdAtom.cpp \
+ Ap4SmhdAtom.cpp \
+ Ap4NmhdAtom.cpp \
+ Ap4HmhdAtom.cpp \
+ Ap4VmhdAtom.cpp \
+ Ap4SchmAtom.cpp \
+ Ap4StcoAtom.cpp \
+ Ap4StscAtom.cpp \
+ Ap4StsdAtom.cpp \
+ Ap4StssAtom.cpp \
+ Ap4StszAtom.cpp \
+ Ap4SttsAtom.cpp \
+ Ap4TkhdAtom.cpp \
+ Ap4IsmaCryp.cpp \
+ Ap4IsfmAtom.cpp \
+ Ap4IkmsAtom.cpp \
+ Ap4TimsAtom.cpp \
+ Ap4TrakAtom.cpp \
+ Ap4SdpAtom.cpp \
+ Ap4RtpAtom.cpp \
+ Ap4UrlAtom.cpp \
+ Ap4CttsAtom.cpp \
+ Ap4DrefAtom.cpp \
+ Ap4EsdsAtom.cpp \
+ Ap4Descriptor.cpp \
+ Ap4DescriptorFactory.cpp \
+ Ap4SLConfigDescriptor.cpp \
+ Ap4UnknownDescriptor.cpp \
+ Ap4DecoderConfigDescriptor.cpp \
+ Ap4DecoderSpecificInfoDescriptor.cpp \
+ Ap4EsDescriptor.cpp \
+ Ap4TrefTypeAtom.cpp \
+ Ap4File.cpp \
+ Ap4Track.cpp \
+ Ap4Utils.cpp \
+ Ap4Movie.cpp \
+ Ap4RtpHint.cpp \
+ Ap4Sample.cpp \
+ Ap4SampleTable.cpp \
+ Ap4AtomSampleTable.cpp \
+ Ap4SyntheticSampleTable.cpp \
+ Ap4SampleDescription.cpp \
+ Ap4SampleEntry.cpp \
+ Ap4FileWriter.cpp \
+ Ap4HintTrackReader.cpp \
+ Ap4Processor.cpp \
+ Ap4ByteStream.cpp \
+ Ap4DataBuffer.cpp \
+ Ap4Debug.cpp \
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = $(CORE_SOURCES)
+
+libAP4_Core.a: $(patsubst %.cpp,%.o,$(TARGET_SOURCES))
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Core
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Crypto.exp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Crypto.exp
new file mode 100644
index 000000000..d5aaf11c0
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Crypto.exp
@@ -0,0 +1,10 @@
+##########################################################################
+#
+# Crypto target exports
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+TARGET_LIBRARIES += AP4_Crypto
+INCLUDES_CPP += -I$(SOURCE_ROOT)/Crypto
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Crypto.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Crypto.mak
new file mode 100644
index 000000000..3b1d386e9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Crypto.mak
@@ -0,0 +1,36 @@
+##########################################################################
+#
+# Crypto target
+#
+# (c) 2001-2005 Gilles Boccon-Gibod
+# Author: Gilles Boccon-Gibod (bok@bok.net)
+#
+##########################################################################
+
+##########################################################################
+# sources
+##########################################################################
+CODECS_SOURCES = Ap4StreamCipher.cpp Ap4AesBlockCipher.cpp
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = $(CODECS_SOURCES)
+
+libAP4_Crypto.a: $(patsubst %.cpp,%.o,$(TARGET_SOURCES))
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Crypto
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp42Aac.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp42Aac.mak
new file mode 100644
index 000000000..e195c1d07
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp42Aac.mak
@@ -0,0 +1,38 @@
+##########################################################################
+#
+# Mp42Aac Program
+#
+# (c) 2002-2003 Gilles Boccon-Gibod & Julien Boeuf
+#
+##########################################################################
+all: mp42aac
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = Mp42Aac.cpp
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Apps/Mp42Aac
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+##########################################################################
+# rules
+##########################################################################
+mp42aac: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
+ $(LINK) $(TARGET_OBJECTS) -o $@
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Decrypt.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Decrypt.mak
new file mode 100644
index 000000000..5be78af9f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Decrypt.mak
@@ -0,0 +1,38 @@
+##########################################################################
+#
+# Mp4Decrypt Program
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+all: mp4decrypt
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = Mp4Decrypt.cpp
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Apps/Mp4Decrypt
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+##########################################################################
+# rules
+##########################################################################
+mp4decrypt: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
+ $(LINK) $(TARGET_OBJECTS) $(LIBRARIES_CPP) -o $@
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Dump.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Dump.mak
new file mode 100644
index 000000000..bf2ad2340
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Dump.mak
@@ -0,0 +1,38 @@
+##########################################################################
+#
+# Ap4Dump Program
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+all: mp4dump
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = Mp4Dump.cpp
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Apps/Mp4Dump
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+##########################################################################
+# rules
+##########################################################################
+mp4dump: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
+ $(LINK) $(TARGET_OBJECTS) -o $@
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Edit.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Edit.mak
new file mode 100644
index 000000000..650d61cca
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Edit.mak
@@ -0,0 +1,38 @@
+##########################################################################
+#
+# Mp4Edit Program
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+all: mp4edit
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = Mp4Edit.cpp
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Apps/Mp4Edit
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+##########################################################################
+# rules
+##########################################################################
+mp4edit: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
+ $(LINK) $(TARGET_OBJECTS) $(LIBRARIES_CPP) -o $@
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Encrypt.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Encrypt.mak
new file mode 100644
index 000000000..07ced326e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Encrypt.mak
@@ -0,0 +1,38 @@
+##########################################################################
+#
+# Mp4Encrypt Program
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+all: mp4encrypt
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = Mp4Encrypt.cpp
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Apps/Mp4Encrypt
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+##########################################################################
+# rules
+##########################################################################
+mp4encrypt: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
+ $(LINK) $(TARGET_OBJECTS) $(LIBRARIES_CPP) -o $@
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Extract.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Extract.mak
new file mode 100644
index 000000000..715df464f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Extract.mak
@@ -0,0 +1,38 @@
+##########################################################################
+#
+# Mp4Extract Program
+#
+# (c) 2001-2004 Gilles Boccon-Gibod
+#
+##########################################################################
+all: mp4extract
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = Mp4Extract.cpp
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Apps/Mp4Extract
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+##########################################################################
+# rules
+##########################################################################
+mp4extract: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
+ $(LINK) $(TARGET_OBJECTS) $(LIBRARIES_CPP) -o $@
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Info.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Info.mak
new file mode 100644
index 000000000..c9efb4cb8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4Info.mak
@@ -0,0 +1,37 @@
+##########################################################################
+#
+# Mp4Info Program
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+all: mp4info
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = Mp4Info.cpp
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Apps/Mp4Info
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+##########################################################################
+# rules
+##########################################################################
+mp4info: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
+ $(LINK) $(TARGET_OBJECTS) -o $@
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4RtpHintInfo.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4RtpHintInfo.mak
new file mode 100644
index 000000000..5a9abc21a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Mp4RtpHintInfo.mak
@@ -0,0 +1,37 @@
+##########################################################################
+#
+# Mp4RtpHintInfo Program
+#
+# (c) 2001-2005 Gilles Boccon-Gibod
+#
+##########################################################################
+all: mp4rtphintinfo
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = Mp4RtpHintInfo.cpp
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/Apps/Mp4RtpHintInfo
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+##########################################################################
+# rules
+##########################################################################
+mp4rtphintinfo: $(TARGET_OBJECTS) $(TARGET_LIBRARY_FILES)
+ $(LINK) $(TARGET_OBJECTS) -o $@
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Rules.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Rules.mak
new file mode 100644
index 000000000..bd5169ee3
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/Rules.mak
@@ -0,0 +1,76 @@
+##########################################################################
+#
+# common make rules and variables
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+# Author: Gilles Boccon-Gibod (bok@bok.net)
+#
+##########################################################################
+
+##########################################################################
+# build configurations
+##########################################################################
+VPATH += $(AP4_BUILD_CONFIG)
+
+COMPILE_CPP_OPTIONS = $(WARNINGS_CPP)
+
+ifeq ($(AP4_BUILD_CONFIG),Profile)
+COMPILE_CPP_OPTIONS += $(PROFILE_CPP)
+endif
+ifeq ($(AP4_BUILD_CONFIG),Debug)
+COMPILE_CPP_OPTIONS += $(DEBUG_CPP)
+else
+COMPILE_CPP_OPTIONS += $(OPTIMIZE_CPP)
+endif
+
+##########################################################################
+# default rules
+##########################################################################
+%.d: %.cpp
+ $(AUTODEP_CPP) $(DEFINES_CPP) $(INCLUDES_CPP) $< -o $@
+
+ifneq ($(AUTODEP_STDOUT),)
+%.d: %.c
+ $(AUTODEP_C) $(DEFINES_C) $(INCLUDES_C) $< > $@
+else
+%.d: %.c
+ $(AUTODEP_CPP) $(DEFINES_CPP) $(INCLUDES_CPP) $< -o $@
+endif
+
+%.o: %.cpp
+ $(COMPILE_CPP) $(COMPILE_CPP_OPTIONS) $($@_LOCAL_DEFINES_CPP) $(DEFINES_CPP) $(INCLUDES_CPP) -c $< -o $@
+
+%.a:
+ $(ARCHIVE) -o $@ $^
+
+.PHONY: clean
+clean:
+ @rm -rf $(TO_CLEAN)
+
+TITLE = @echo ============ making $@ =============
+INVOKE_SUBMAKE = $(MAKE) --no-print-directory
+
+##########################################################################
+# variables
+##########################################################################
+LINK = $(LINK_CPP) $(LINK_CPP_OPTIONS)
+LINK_CPP_OPTIONS += $(foreach lib,$(TARGET_LIBRARIES),-l$(lib))
+TARGET_LIBRARY_FILES = $(foreach lib,$(TARGET_LIBRARIES),lib$(lib).a)
+TARGET_OBJECTS = $(TARGET_SOURCES:.cpp=.o)
+
+##########################################################################
+# auto dependencies
+##########################################################################
+TARGET_DEPENDENCIES := $(patsubst %.c,%.d,$(TARGET_SOURCES))
+TARGET_DEPENDENCIES := $(patsubst %.cpp,%.d,$(TARGET_DEPENDENCIES))
+
+ifneq ($(TARGET_DEPENDENCIES),)
+include $(TARGET_DEPENDENCIES)
+endif
+
+##########################################################################
+# includes
+##########################################################################
+ifneq ($(LOCAL_RULES),)
+include $(LOCAL_RULES)
+endif
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/SDK.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/SDK.mak
new file mode 100644
index 000000000..30c99e695
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/SDK.mak
@@ -0,0 +1,50 @@
+##########################################################################
+#
+# SDK Makefile
+#
+# (c) 2001-2005 Gilles Boccon-Gibod
+#
+##########################################################################
+all: sdk
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Crypto.exp
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/Codecs.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# variables
+##########################################################################
+SDK_LIBRARY = SDK/lib/libAP4.a
+SDK_HEADERS := $(SOURCE_ROOT)/Core/*.h $(SOURCE_ROOT)/Config/*.h $(SOURCE_ROOT)/Crypto/*.h $(SOURCE_ROOT)/Codecs/*.h
+SDK_BINARIES = $(ALL_APPS)
+
+##########################################################################
+# rules
+##########################################################################
+.PHONY: sdk-dirs
+sdk-dirs:
+ @rm -rf SDK
+ @mkdir SDK
+ @mkdir SDK/lib
+ @mkdir SDK/include
+ @mkdir SDK/bin
+
+$(SDK_LIBRARY): $(foreach lib,$(TARGET_LIBRARIES),lib$(lib).a)
+ $(MAKELIB) $@ $^
+ $(RANLIB) $@
+
+sdk: sdk-dirs $(SDK_LIBRARY) $(SDK_HEADERS)
+ @cp $(SDK_HEADERS) SDK/include
+ @cp $(SDK_BINARIES) SDK/bin
+ @$(STRIP) SDK/bin/*
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/System.exp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/System.exp
new file mode 100644
index 000000000..ae875c980
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/System.exp
@@ -0,0 +1,10 @@
+##########################################################################
+#
+# System target exports
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+#
+##########################################################################
+TARGET_LIBRARIES += AP4_System
+INCLUDES_CPP += -I$(SOURCE_ROOT)/System/StdC
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/System.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/System.mak
new file mode 100644
index 000000000..709517935
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/System.mak
@@ -0,0 +1,36 @@
+##########################################################################
+#
+# System target
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+# Author: Gilles Boccon-Gibod (bok@bok.net)
+#
+##########################################################################
+
+##########################################################################
+# sources
+##########################################################################
+SYSTEM_SOURCES = $(FILE_BYTE_STREAM_IMPLEMENTATION).cpp
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Core.exp
+include $(BUILD_ROOT)/Makefiles/System.exp
+
+##########################################################################
+# targets
+##########################################################################
+TARGET_SOURCES = $(SYSTEM_SOURCES)
+
+libAP4_System.a: $(patsubst %.cpp,%.o,$(TARGET_SOURCES))
+
+##########################################################################
+# make path
+##########################################################################
+VPATH += $(SOURCE_ROOT)/System/StdC
+
+##########################################################################
+# includes
+##########################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/TopLevel.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/TopLevel.mak
new file mode 100644
index 000000000..5b5989166
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Makefiles/TopLevel.mak
@@ -0,0 +1,128 @@
+##########################################################################
+#
+# top level make rules and variables
+#
+# (c) 2001-2002 Gilles Boccon-Gibod
+# Author: Gilles Boccon-Gibod (bok@bok.net)
+#
+##########################################################################
+
+##########################################################################
+# exported variables
+##########################################################################
+export BUILD_ROOT
+export SOURCE_ROOT
+export TARGET
+
+export FILE_BYTE_STREAM_IMPLEMENTATION
+
+export CC
+export AUTODEP_CPP
+export AUTODEP_STDOUT
+export ARCHIVE
+export COMPILE_CPP
+export LINK_CPP
+export MAKELIB
+export MAKESHAREDLIB
+export RANLIB
+export STRIP
+export DEBUG_CPP
+export OPTIMIZE_CPP
+export PROFILE_CPP
+export DEFINES_CPP
+export WARNINGS_CPP
+export INCLUDES_CPP
+export LIBRARIES_CPP
+
+##########################################################################
+# modular targets
+##########################################################################
+
+# ------- Setup -------------
+.PHONY: Setup
+Setup:
+ mkdir $(OUTPUT_DIR)
+
+# ------- Core -------------
+Core: Crypto
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Core.mak
+
+# ------- System -----------
+System:
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/System.mak
+
+# ------- Codecs -----------
+Codecs:
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Codecs.mak
+
+# ------- Crypto -----------
+Crypto:
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Crypto.mak
+
+# ------- Apps -----------
+ALL_APPS = mp4dump mp4info mp42aac aac2mp4 mp4decrypt mp4encrypt mp4edit mp4extract mp4rtphintinfo
+export ALL_APPS
+Apps: $(ALL_APPS)
+
+##################################################################
+# cleanup
+##################################################################
+TO_CLEAN += *.d *.o *.a *.exe $(ALL_APPS) SDK
+
+##################################################################
+# end targets
+##################################################################
+sdk: Core System Codecs Crypto Apps
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/SDK.mak
+
+mp4dump: Core System
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Dump.mak
+
+mp4info: Core System
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Info.mak
+
+mp42aac: Core System
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp42Aac.mak
+
+aac2mp4: Codecs Core System
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Aac2Mp4.mak
+
+mp4decrypt: Crypto Core System
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Decrypt.mak
+
+mp4encrypt: Crypto Core System
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Encrypt.mak
+
+mp4edit: Crypto Core System
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Edit.mak
+
+mp4extract: Crypto Core System
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4Extract.mak
+
+mp4rtphintinfo: Crypto Core System
+ $(TITLE)
+ @$(INVOKE_SUBMAKE) -f $(BUILD_ROOT)/Makefiles/Mp4RtpHintInfo.mak
+
+##################################################################
+# includes
+##################################################################
+include $(BUILD_ROOT)/Makefiles/Rules.mak
+
+
+
+
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/any-sun-java/build.xml b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/any-sun-java/build.xml
new file mode 100644
index 000000000..99d1a47d1
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/any-sun-java/build.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<project name="Benta4" basedir="." default="build">
+
+<!--===========================================================================
+Setup properties
+============================================================================-->
+ <!-- home -->
+ <property name="bento4.home" value="../../.."/>
+
+ <!-- sources -->
+ <property name="src.dir" value="${bento4.home}/Source/Java"/>
+
+ <!-- build -->
+ <property name="build.dir" value="."/>
+ <property name="lib.dir" value="${build.dir}/lib"/>
+ <property name="classes.dir" value="${build.dir}/classes"/>
+ <property name="bento4.lib" value="${lib.dir}/bento4.jar"/>
+
+<!--===========================================================================
+Targets
+============================================================================-->
+<!--===========================================================================
+prepare Target
+============================================================================-->
+ <target name="prepare">
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${lib.dir}"/>
+ </target>
+
+<!--===========================================================================
+clean Target
+============================================================================-->
+ <target name="clean">
+ <delete dir="${classes.dir}"/>
+ <delete>
+ <!-- spare the svn directories -->
+ <fileset dir="${lib.dir}" includes="**/*.*"/>
+ </delete>
+ </target>
+
+<!--===========================================================================
+compile Target
+============================================================================-->
+ <target name="compile" depends="prepare">
+ <javac srcdir="${src.dir}" destdir="${classes.dir}"/>
+ </target>
+
+<!--===========================================================================
+jar Target
+============================================================================-->
+ <target name="jar" depends="compile">
+ <jar jarfile="${bento4.lib}" basedir="${classes.dir}"/>
+ </target>
+
+<!--===========================================================================
+build Target
+============================================================================-->
+ <target name="build" depends="jar"/>
+
+<!--===========================================================================
+all Target
+============================================================================-->
+ <target name="all" depends="clean, build"/>
+
+</project>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/ppc-apple-macosx/AP4.xcode/project.pbxproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/ppc-apple-macosx/AP4.xcode/project.pbxproj
new file mode 100644
index 000000000..56a049ca3
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/ppc-apple-macosx/AP4.xcode/project.pbxproj
@@ -0,0 +1,2644 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 39;
+ objects = {
+ 014CEA520018CE5811CA2923 = {
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ DEBUGGING_SYMBOLS = YES;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ OPTIMIZATION_CFLAGS = "-O0";
+ REZ_PREPROCESSOR_DEFINITIONS = "";
+ ZERO_LINK = YES;
+ };
+ isa = PBXBuildStyle;
+ name = Development;
+ };
+ 014CEA530018CE5811CA2923 = {
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ ZERO_LINK = NO;
+ };
+ isa = PBXBuildStyle;
+ name = Deployment;
+ };
+//010
+//011
+//012
+//013
+//014
+//080
+//081
+//082
+//083
+//084
+ 08FB7793FE84155DC02AAC07 = {
+ buildSettings = {
+ };
+ buildStyles = (
+ 014CEA520018CE5811CA2923,
+ 014CEA530018CE5811CA2923,
+ );
+ hasScannedForEncodings = 1;
+ isa = PBXProject;
+ mainGroup = 08FB7794FE84155DC02AAC07;
+ projectDirPath = "";
+ targets = (
+ D2AAC045055464E500DB518D,
+ CA7FEF2A08DCB12D0004D774,
+ CA7FEF4A08DCDCFC0004D774,
+ CA7FEF5608DCDD7B0004D774,
+ );
+ };
+ 08FB7794FE84155DC02AAC07 = {
+ children = (
+ 08FB7795FE84155DC02AAC07,
+ C6A0FF2B0290797F04C91782,
+ 1AB674ADFE9D54B511CA2CBB,
+ );
+ isa = PBXGroup;
+ name = AP4;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 08FB7795FE84155DC02AAC07 = {
+ children = (
+ CA2A29BA08DCE58C00805AE9,
+ CA7FEF1508DCAFEC0004D774,
+ F977E2470606C24C00B2ACD1,
+ F977E2490606C24C00B2ACD1,
+ F977E29B0606C24C00B2ACD1,
+ F993837406038FE300FCB9EC,
+ );
+ isa = PBXGroup;
+ name = Source;
+ path = "";
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+//080
+//081
+//082
+//083
+//084
+//1A0
+//1A1
+//1A2
+//1A3
+//1A4
+ 1AB674ADFE9D54B511CA2CBB = {
+ children = (
+ D2AAC046055464E500DB518D,
+ CA7FEF2B08DCB12D0004D774,
+ CA7FEF4B08DCDCFC0004D774,
+ CA7FEF5708DCDD7B0004D774,
+ );
+ isa = PBXGroup;
+ name = Products;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+//1A0
+//1A1
+//1A2
+//1A3
+//1A4
+//C60
+//C61
+//C62
+//C63
+//C64
+ C6A0FF2B0290797F04C91782 = {
+ children = (
+ );
+ isa = PBXGroup;
+ name = Documentation;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+//C60
+//C61
+//C62
+//C63
+//C64
+//CA0
+//CA1
+//CA2
+//CA3
+//CA4
+ CA2A295E08DCE3C900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4AtomSampleTable.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A295F08DCE3C900805AE9 = {
+ fileRef = CA2A295E08DCE3C900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A296208DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4AtomSampleTable.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296308DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4FileWriter.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296408DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4FileWriter.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296508DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4HmhdAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296608DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4HmhdAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296708DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4IkmsAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296808DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4IkmsAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296908DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4IsfmAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296A08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4IsfmAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296B08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4IsmaCryp.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296C08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4IsmaCryp.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296D08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4Movie.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296E08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Movie.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A296F08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4NmhdAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297008DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4NmhdAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297108DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4Processor.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297208DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Processor.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297308DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4RtpAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297408DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4RtpAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297508DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4RtpHint.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297608DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4RtpHint.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297708DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4SampleTable.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297808DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4SampleTable.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297908DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4SdpAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297A08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4SdpAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297B08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4SmhdAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297C08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4SmhdAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297D08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4SyntheticSampleTable.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297E08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4SyntheticSampleTable.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A297F08DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4TimsAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A298008DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4TimsAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A298108DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4UnknownDescriptor.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A298208DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4VmhdAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A298308DCE40900805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4VmhdAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A298408DCE40900805AE9 = {
+ fileRef = CA2A296208DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298508DCE40900805AE9 = {
+ fileRef = CA2A296308DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298608DCE40900805AE9 = {
+ fileRef = CA2A296408DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298708DCE40900805AE9 = {
+ fileRef = CA2A296508DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298808DCE40900805AE9 = {
+ fileRef = CA2A296608DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298908DCE40900805AE9 = {
+ fileRef = CA2A296708DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298A08DCE40900805AE9 = {
+ fileRef = CA2A296808DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298B08DCE40900805AE9 = {
+ fileRef = CA2A296908DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298C08DCE40900805AE9 = {
+ fileRef = CA2A296A08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298D08DCE40900805AE9 = {
+ fileRef = CA2A296B08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298E08DCE40900805AE9 = {
+ fileRef = CA2A296C08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A298F08DCE40900805AE9 = {
+ fileRef = CA2A296D08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299008DCE40900805AE9 = {
+ fileRef = CA2A296E08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299108DCE40900805AE9 = {
+ fileRef = CA2A296F08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299208DCE40900805AE9 = {
+ fileRef = CA2A297008DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299308DCE40900805AE9 = {
+ fileRef = CA2A297108DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299408DCE40900805AE9 = {
+ fileRef = CA2A297208DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299508DCE40900805AE9 = {
+ fileRef = CA2A297308DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299608DCE40900805AE9 = {
+ fileRef = CA2A297408DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299708DCE40900805AE9 = {
+ fileRef = CA2A297508DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299808DCE40900805AE9 = {
+ fileRef = CA2A297608DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299908DCE40900805AE9 = {
+ fileRef = CA2A297708DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299A08DCE40900805AE9 = {
+ fileRef = CA2A297808DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299B08DCE40900805AE9 = {
+ fileRef = CA2A297908DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299C08DCE40900805AE9 = {
+ fileRef = CA2A297A08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299D08DCE40900805AE9 = {
+ fileRef = CA2A297B08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299E08DCE40900805AE9 = {
+ fileRef = CA2A297C08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A299F08DCE40900805AE9 = {
+ fileRef = CA2A297D08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29A008DCE40900805AE9 = {
+ fileRef = CA2A297E08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29A108DCE40900805AE9 = {
+ fileRef = CA2A297F08DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29A208DCE40900805AE9 = {
+ fileRef = CA2A298008DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29A308DCE40900805AE9 = {
+ fileRef = CA2A298108DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29A408DCE40900805AE9 = {
+ fileRef = CA2A298208DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29A508DCE40900805AE9 = {
+ fileRef = CA2A298308DCE40900805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29BA08DCE58C00805AE9 = {
+ children = (
+ CA2A29BB08DCE58C00805AE9,
+ CA2A29BC08DCE58C00805AE9,
+ CA2A29BD08DCE58C00805AE9,
+ CA2A29BE08DCE58C00805AE9,
+ );
+ isa = PBXGroup;
+ name = Codecs;
+ path = ../../../Source/Codecs;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A29BB08DCE58C00805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4AdtsParser.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A29BC08DCE58C00805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4AdtsParser.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A29BD08DCE58C00805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4BitStream.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A29BE08DCE58C00805AE9 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4BitStream.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA2A29BF08DCE58C00805AE9 = {
+ fileRef = CA2A29BB08DCE58C00805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29C008DCE58C00805AE9 = {
+ fileRef = CA2A29BC08DCE58C00805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29C108DCE58C00805AE9 = {
+ fileRef = CA2A29BD08DCE58C00805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29C208DCE58C00805AE9 = {
+ fileRef = CA2A29BE08DCE58C00805AE9;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA2A29E008DCE6AD00805AE9 = {
+ fileRef = F993837606038FE300FCB9EC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA7FEF1508DCAFEC0004D774 = {
+ children = (
+ CA7FEF1608DCAFEC0004D774,
+ CA7FEF1708DCAFEC0004D774,
+ CA7FEF1808DCAFEC0004D774,
+ CA7FEF1908DCAFEC0004D774,
+ );
+ isa = PBXGroup;
+ name = Crypto;
+ path = ../../../Source/Crypto;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA7FEF1608DCAFEC0004D774 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4AesBlockCipher.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA7FEF1708DCAFEC0004D774 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4AesBlockCipher.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA7FEF1808DCAFEC0004D774 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4StreamCipher.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA7FEF1908DCAFEC0004D774 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4StreamCipher.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ CA7FEF1A08DCAFEC0004D774 = {
+ fileRef = CA7FEF1608DCAFEC0004D774;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA7FEF1B08DCAFEC0004D774 = {
+ fileRef = CA7FEF1708DCAFEC0004D774;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA7FEF1C08DCAFEC0004D774 = {
+ fileRef = CA7FEF1808DCAFEC0004D774;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA7FEF1D08DCAFEC0004D774 = {
+ fileRef = CA7FEF1908DCAFEC0004D774;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA7FEF2808DCB12D0004D774 = {
+ buildActionMask = 2147483647;
+ files = (
+ CA7FEF2F08DCB1650004D774,
+ );
+ isa = PBXSourcesBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ CA7FEF2908DCB12D0004D774 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ isa = PBXFrameworksBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ CA7FEF2A08DCB12D0004D774 = {
+ buildPhases = (
+ CA7FEF2808DCB12D0004D774,
+ CA7FEF2908DCB12D0004D774,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Ap4Info;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ };
+ dependencies = (
+ CA7FEF3108DCB1A20004D774,
+ );
+ isa = PBXNativeTarget;
+ name = Ap4Info;
+ productName = Ap4Info;
+ productReference = CA7FEF2B08DCB12D0004D774;
+ productType = "com.apple.product-type.tool";
+ };
+ CA7FEF2B08DCB12D0004D774 = {
+ explicitFileType = "compiled.mach-o.executable";
+ includeInIndex = 0;
+ isa = PBXFileReference;
+ path = Ap4Info;
+ refType = 3;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ CA7FEF2F08DCB1650004D774 = {
+ fileRef = F993837A06038FE300FCB9EC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA7FEF3008DCB1A20004D774 = {
+ containerPortal = 08FB7793FE84155DC02AAC07;
+ isa = PBXContainerItemProxy;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D;
+ remoteInfo = AP4;
+ };
+ CA7FEF3108DCB1A20004D774 = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D;
+ targetProxy = CA7FEF3008DCB1A20004D774;
+ };
+ CA7FEF4808DCDCFC0004D774 = {
+ buildActionMask = 2147483647;
+ files = (
+ CA7FEF5B08DCDD8A0004D774,
+ );
+ isa = PBXSourcesBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ CA7FEF4908DCDCFC0004D774 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ isa = PBXFrameworksBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ CA7FEF4A08DCDCFC0004D774 = {
+ buildPhases = (
+ CA7FEF4808DCDCFC0004D774,
+ CA7FEF4908DCDCFC0004D774,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Ap4Dump;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ };
+ dependencies = (
+ CA7FEF5108DCDD2A0004D774,
+ );
+ isa = PBXNativeTarget;
+ name = Ap4Dump;
+ productName = Ap4Dump;
+ productReference = CA7FEF4B08DCDCFC0004D774;
+ productType = "com.apple.product-type.tool";
+ };
+ CA7FEF4B08DCDCFC0004D774 = {
+ explicitFileType = "compiled.mach-o.executable";
+ includeInIndex = 0;
+ isa = PBXFileReference;
+ path = Ap4Dump;
+ refType = 3;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ CA7FEF4D08DCDD0E0004D774 = {
+ fileRef = F993837806038FE300FCB9EC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ CA7FEF5008DCDD2A0004D774 = {
+ containerPortal = 08FB7793FE84155DC02AAC07;
+ isa = PBXContainerItemProxy;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D;
+ remoteInfo = AP4;
+ };
+ CA7FEF5108DCDD2A0004D774 = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D;
+ targetProxy = CA7FEF5008DCDD2A0004D774;
+ };
+ CA7FEF5408DCDD7B0004D774 = {
+ buildActionMask = 2147483647;
+ files = (
+ CA2A29E008DCE6AD00805AE9,
+ );
+ isa = PBXSourcesBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ CA7FEF5508DCDD7B0004D774 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ isa = PBXFrameworksBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ CA7FEF5608DCDD7B0004D774 = {
+ buildPhases = (
+ CA7FEF5408DCDD7B0004D774,
+ CA7FEF5508DCDD7B0004D774,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Aac2Mp4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ };
+ dependencies = (
+ CA7FEF5A08DCDD800004D774,
+ );
+ isa = PBXNativeTarget;
+ name = Aac2Mp4;
+ productName = Aac2Mp4;
+ productReference = CA7FEF5708DCDD7B0004D774;
+ productType = "com.apple.product-type.tool";
+ };
+ CA7FEF5708DCDD7B0004D774 = {
+ explicitFileType = "compiled.mach-o.executable";
+ includeInIndex = 0;
+ isa = PBXFileReference;
+ path = Aac2Mp4;
+ refType = 3;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ CA7FEF5908DCDD800004D774 = {
+ containerPortal = 08FB7793FE84155DC02AAC07;
+ isa = PBXContainerItemProxy;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D;
+ remoteInfo = AP4;
+ };
+ CA7FEF5A08DCDD800004D774 = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D;
+ targetProxy = CA7FEF5908DCDD800004D774;
+ };
+ CA7FEF5B08DCDD8A0004D774 = {
+ fileRef = F993837606038FE300FCB9EC;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+//CA0
+//CA1
+//CA2
+//CA3
+//CA4
+//D20
+//D21
+//D22
+//D23
+//D24
+ D2AAC043055464E500DB518D = {
+ buildActionMask = 2147483647;
+ files = (
+ F977E29E0606C24C00B2ACD1,
+ F977E29F0606C24C00B2ACD1,
+ F977E2A00606C24C00B2ACD1,
+ F977E2A20606C24C00B2ACD1,
+ F977E2A40606C24C00B2ACD1,
+ F977E2A60606C24C00B2ACD1,
+ F977E2A70606C24C00B2ACD1,
+ F977E2A90606C24C00B2ACD1,
+ F977E2AB0606C24C00B2ACD1,
+ F977E2AD0606C24C00B2ACD1,
+ F977E2AF0606C24C00B2ACD1,
+ F977E2B10606C24C00B2ACD1,
+ F977E2B30606C24C00B2ACD1,
+ F977E2B50606C24C00B2ACD1,
+ F977E2B70606C24C00B2ACD1,
+ F977E2BB0606C24C00B2ACD1,
+ F977E2BD0606C24C00B2ACD1,
+ F977E2BF0606C24C00B2ACD1,
+ F977E2C00606C24C00B2ACD1,
+ F977E2C20606C24C00B2ACD1,
+ F977E2C40606C24C00B2ACD1,
+ F977E2C60606C24C00B2ACD1,
+ F977E2C70606C24C00B2ACD1,
+ F977E2C80606C24C00B2ACD1,
+ F977E2CA0606C24C00B2ACD1,
+ F977E2CC0606C24C00B2ACD1,
+ F977E2D00606C24C00B2ACD1,
+ F977E2D10606C24C00B2ACD1,
+ F977E2D20606C24C00B2ACD1,
+ F977E2D40606C24C00B2ACD1,
+ F977E2D60606C24C00B2ACD1,
+ F977E2DA0606C24C00B2ACD1,
+ F977E2DC0606C24C00B2ACD1,
+ F977E2DE0606C24C00B2ACD1,
+ F977E2E00606C24C00B2ACD1,
+ F977E2E20606C24C00B2ACD1,
+ F977E2E40606C24C00B2ACD1,
+ F977E2E60606C24C00B2ACD1,
+ F977E2E80606C24C00B2ACD1,
+ F977E2EA0606C24C00B2ACD1,
+ F977E2EB0606C24C00B2ACD1,
+ F977E2ED0606C24C00B2ACD1,
+ F977E2EF0606C24C00B2ACD1,
+ F96C90120606D9DD00F5E650,
+ F988A1BD060AC5CC00916ED3,
+ F93D65CC06128E1C0093F98C,
+ F91931EB06DC567E001B12C8,
+ CA7FEF1B08DCAFEC0004D774,
+ CA7FEF1D08DCAFEC0004D774,
+ CA2A298408DCE40900805AE9,
+ CA2A298608DCE40900805AE9,
+ CA2A298808DCE40900805AE9,
+ CA2A298A08DCE40900805AE9,
+ CA2A298C08DCE40900805AE9,
+ CA2A298E08DCE40900805AE9,
+ CA2A299008DCE40900805AE9,
+ CA2A299208DCE40900805AE9,
+ CA2A299408DCE40900805AE9,
+ CA2A299608DCE40900805AE9,
+ CA2A299808DCE40900805AE9,
+ CA2A299A08DCE40900805AE9,
+ CA2A299C08DCE40900805AE9,
+ CA2A299E08DCE40900805AE9,
+ CA2A29A008DCE40900805AE9,
+ CA2A29A208DCE40900805AE9,
+ CA2A29A308DCE40900805AE9,
+ CA2A29A508DCE40900805AE9,
+ CA2A29C008DCE58C00805AE9,
+ CA2A29C208DCE58C00805AE9,
+ );
+ isa = PBXHeadersBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ D2AAC044055464E500DB518D = {
+ buildActionMask = 2147483647;
+ files = (
+ F977E2A10606C24C00B2ACD1,
+ F977E2A30606C24C00B2ACD1,
+ F977E2A50606C24C00B2ACD1,
+ F977E2A80606C24C00B2ACD1,
+ F977E2AA0606C24C00B2ACD1,
+ F977E2AC0606C24C00B2ACD1,
+ F977E2AE0606C24C00B2ACD1,
+ F977E2B00606C24C00B2ACD1,
+ F977E2B20606C24C00B2ACD1,
+ F977E2B40606C24C00B2ACD1,
+ F977E2B60606C24C00B2ACD1,
+ F977E2BA0606C24C00B2ACD1,
+ F977E2BC0606C24C00B2ACD1,
+ F977E2BE0606C24C00B2ACD1,
+ F977E2C10606C24C00B2ACD1,
+ F977E2C30606C24C00B2ACD1,
+ F977E2C50606C24C00B2ACD1,
+ F977E2C90606C24C00B2ACD1,
+ F977E2CB0606C24C00B2ACD1,
+ F977E2CF0606C24C00B2ACD1,
+ F977E2D30606C24C00B2ACD1,
+ F977E2D50606C24C00B2ACD1,
+ F977E2D90606C24C00B2ACD1,
+ F977E2DB0606C24C00B2ACD1,
+ F977E2DD0606C24C00B2ACD1,
+ F977E2DF0606C24C00B2ACD1,
+ F977E2E10606C24C00B2ACD1,
+ F977E2E30606C24C00B2ACD1,
+ F977E2E50606C24C00B2ACD1,
+ F977E2E70606C24C00B2ACD1,
+ F977E2E90606C24C00B2ACD1,
+ F977E2EC0606C24C00B2ACD1,
+ F977E2EE0606C24C00B2ACD1,
+ F977E2F00606C24C00B2ACD1,
+ F988A1C1060AC84100916ED3,
+ F99D17B3060D57D500068537,
+ F9A022810616103C0039AF2E,
+ F91931DE06DC45B2001B12C8,
+ F91931ED06DC56BC001B12C8,
+ CA7FEF1A08DCAFEC0004D774,
+ CA7FEF1C08DCAFEC0004D774,
+ CA7FEF4D08DCDD0E0004D774,
+ CA2A295F08DCE3C900805AE9,
+ CA2A298508DCE40900805AE9,
+ CA2A298708DCE40900805AE9,
+ CA2A298908DCE40900805AE9,
+ CA2A298B08DCE40900805AE9,
+ CA2A298D08DCE40900805AE9,
+ CA2A298F08DCE40900805AE9,
+ CA2A299108DCE40900805AE9,
+ CA2A299308DCE40900805AE9,
+ CA2A299508DCE40900805AE9,
+ CA2A299708DCE40900805AE9,
+ CA2A299908DCE40900805AE9,
+ CA2A299B08DCE40900805AE9,
+ CA2A299D08DCE40900805AE9,
+ CA2A299F08DCE40900805AE9,
+ CA2A29A108DCE40900805AE9,
+ CA2A29A408DCE40900805AE9,
+ CA2A29BF08DCE58C00805AE9,
+ CA2A29C108DCE58C00805AE9,
+ );
+ isa = PBXSourcesBuildPhase;
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ D2AAC045055464E500DB518D = {
+ buildPhases = (
+ D2AAC043055464E500DB518D,
+ D2AAC044055464E500DB518D,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_PREPROCESSOR_DEFINITIONS = "AP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_BIG_ENDIAN";
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/lib;
+ LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = AP4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ };
+ dependencies = (
+ );
+ isa = PBXNativeTarget;
+ name = AP4;
+ productName = AP4;
+ productReference = D2AAC046055464E500DB518D;
+ productType = "com.apple.product-type.library.static";
+ };
+ D2AAC046055464E500DB518D = {
+ explicitFileType = archive.ar;
+ includeInIndex = 0;
+ isa = PBXFileReference;
+ path = libAP4.a;
+ refType = 3;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+//D20
+//D21
+//D22
+//D23
+//D24
+//F90
+//F91
+//F92
+//F93
+//F94
+ F91931DD06DC45B2001B12C8 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4UnknownDescriptor.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F91931DE06DC45B2001B12C8 = {
+ fileRef = F91931DD06DC45B2001B12C8;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F91931EA06DC567E001B12C8 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4SLConfigDescriptor.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F91931EB06DC567E001B12C8 = {
+ fileRef = F91931EA06DC567E001B12C8;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F91931EC06DC56BC001B12C8 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4SLConfigDescriptor.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F91931ED06DC56BC001B12C8 = {
+ fileRef = F91931EC06DC56BC001B12C8;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F93D65CB06128E1C0093F98C = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4SampleEntry.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F93D65CC06128E1C0093F98C = {
+ fileRef = F93D65CB06128E1C0093F98C;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F96C90110606D9DD00F5E650 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4SampleDescription.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F96C90120606D9DD00F5E650 = {
+ fileRef = F96C90110606D9DD00F5E650;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2470606C24C00B2ACD1 = {
+ children = (
+ F977E2480606C24C00B2ACD1,
+ );
+ isa = PBXGroup;
+ name = Config;
+ path = ../../../Source/Config;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2480606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Config.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2490606C24C00B2ACD1 = {
+ children = (
+ CA2A296208DCE40900805AE9,
+ CA2A296308DCE40900805AE9,
+ CA2A296408DCE40900805AE9,
+ CA2A296508DCE40900805AE9,
+ CA2A296608DCE40900805AE9,
+ CA2A296708DCE40900805AE9,
+ CA2A296808DCE40900805AE9,
+ CA2A296908DCE40900805AE9,
+ CA2A296A08DCE40900805AE9,
+ CA2A296B08DCE40900805AE9,
+ CA2A296C08DCE40900805AE9,
+ CA2A296D08DCE40900805AE9,
+ CA2A296E08DCE40900805AE9,
+ CA2A296F08DCE40900805AE9,
+ CA2A297008DCE40900805AE9,
+ CA2A297108DCE40900805AE9,
+ CA2A297208DCE40900805AE9,
+ CA2A297308DCE40900805AE9,
+ CA2A297408DCE40900805AE9,
+ CA2A297508DCE40900805AE9,
+ CA2A297608DCE40900805AE9,
+ CA2A297708DCE40900805AE9,
+ CA2A297808DCE40900805AE9,
+ CA2A297908DCE40900805AE9,
+ CA2A297A08DCE40900805AE9,
+ CA2A297B08DCE40900805AE9,
+ CA2A297C08DCE40900805AE9,
+ CA2A297D08DCE40900805AE9,
+ CA2A297E08DCE40900805AE9,
+ CA2A297F08DCE40900805AE9,
+ CA2A298008DCE40900805AE9,
+ CA2A298108DCE40900805AE9,
+ CA2A298208DCE40900805AE9,
+ CA2A298308DCE40900805AE9,
+ CA2A295E08DCE3C900805AE9,
+ F91931EC06DC56BC001B12C8,
+ F91931EA06DC567E001B12C8,
+ F91931DD06DC45B2001B12C8,
+ F977E24A0606C24C00B2ACD1,
+ F977E24B0606C24C00B2ACD1,
+ F977E24C0606C24C00B2ACD1,
+ F977E24D0606C24C00B2ACD1,
+ F977E24E0606C24C00B2ACD1,
+ F977E24F0606C24C00B2ACD1,
+ F977E2500606C24C00B2ACD1,
+ F977E2510606C24C00B2ACD1,
+ F977E2520606C24C00B2ACD1,
+ F977E2530606C24C00B2ACD1,
+ F977E2540606C24C00B2ACD1,
+ F977E2550606C24C00B2ACD1,
+ F977E2560606C24C00B2ACD1,
+ F977E2570606C24C00B2ACD1,
+ F977E2580606C24C00B2ACD1,
+ F977E2590606C24C00B2ACD1,
+ F977E25A0606C24C00B2ACD1,
+ F977E25B0606C24C00B2ACD1,
+ F977E25C0606C24C00B2ACD1,
+ F977E25D0606C24C00B2ACD1,
+ F977E25E0606C24C00B2ACD1,
+ F977E25F0606C24C00B2ACD1,
+ F977E2600606C24C00B2ACD1,
+ F977E2610606C24C00B2ACD1,
+ F977E2620606C24C00B2ACD1,
+ F977E2650606C24C00B2ACD1,
+ F977E2660606C24C00B2ACD1,
+ F977E2670606C24C00B2ACD1,
+ F977E2680606C24C00B2ACD1,
+ F977E2690606C24C00B2ACD1,
+ F977E26A0606C24C00B2ACD1,
+ F977E26B0606C24C00B2ACD1,
+ F977E26C0606C24C00B2ACD1,
+ F977E26D0606C24C00B2ACD1,
+ F977E26E0606C24C00B2ACD1,
+ F977E26F0606C24C00B2ACD1,
+ F977E2700606C24C00B2ACD1,
+ F977E2710606C24C00B2ACD1,
+ F977E2720606C24C00B2ACD1,
+ F977E2730606C24C00B2ACD1,
+ F977E2740606C24C00B2ACD1,
+ F977E2750606C24C00B2ACD1,
+ F977E2760606C24C00B2ACD1,
+ F977E2770606C24C00B2ACD1,
+ F977E27A0606C24C00B2ACD1,
+ F977E27B0606C24C00B2ACD1,
+ F977E27C0606C24C00B2ACD1,
+ F977E27D0606C24C00B2ACD1,
+ F977E27E0606C24C00B2ACD1,
+ F977E27F0606C24C00B2ACD1,
+ F977E2800606C24C00B2ACD1,
+ F977E2810606C24C00B2ACD1,
+ F977E2840606C24C00B2ACD1,
+ F977E2850606C24C00B2ACD1,
+ F977E2860606C24C00B2ACD1,
+ F977E2870606C24C00B2ACD1,
+ F977E2880606C24C00B2ACD1,
+ F977E2890606C24C00B2ACD1,
+ F977E28A0606C24C00B2ACD1,
+ F977E28B0606C24C00B2ACD1,
+ F977E28C0606C24C00B2ACD1,
+ F977E28D0606C24C00B2ACD1,
+ F977E28E0606C24C00B2ACD1,
+ F977E28F0606C24C00B2ACD1,
+ F977E2900606C24C00B2ACD1,
+ F977E2910606C24C00B2ACD1,
+ F977E2920606C24C00B2ACD1,
+ F977E2930606C24C00B2ACD1,
+ F977E2940606C24C00B2ACD1,
+ F977E2950606C24C00B2ACD1,
+ F977E2960606C24C00B2ACD1,
+ F977E2970606C24C00B2ACD1,
+ F977E2980606C24C00B2ACD1,
+ F977E2990606C24C00B2ACD1,
+ F977E29A0606C24C00B2ACD1,
+ F96C90110606D9DD00F5E650,
+ F988A1BC060AC5CC00916ED3,
+ F988A1C0060AC84100916ED3,
+ F99D17B2060D57D500068537,
+ F93D65CB06128E1C0093F98C,
+ F9A022800616103C0039AF2E,
+ );
+ isa = PBXGroup;
+ name = Core;
+ path = ../../../Source/Core;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E24A0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E24B0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Array.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E24C0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4Atom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E24D0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Atom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E24E0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4AtomFactory.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E24F0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4AtomFactory.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2500606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4ByteStream.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2510606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4ByteStream.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2520606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Constants.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2530606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4ContainerAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2540606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4ContainerAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2550606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4CttsAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2560606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4CttsAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2570606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4Debug.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2580606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Debug.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2590606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4DecoderConfigDescriptor.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E25A0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4DecoderConfigDescriptor.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E25B0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4DecoderSpecificInfoDescriptor.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E25C0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4DecoderSpecificInfoDescriptor.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E25D0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4Descriptor.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E25E0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Descriptor.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E25F0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4DescriptorFactory.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2600606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4DescriptorFactory.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2610606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4DrefAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2620606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4DrefAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2650606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4EsDescriptor.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2660606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4EsDescriptor.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2670606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4EsdsAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2680606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4EsdsAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2690606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4File.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E26A0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4File.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E26B0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4FileByteStream.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E26C0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4FrmaAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E26D0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4FrmaAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E26E0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4FtypAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E26F0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4FtypAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2700606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4HdlrAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2710606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4HdlrAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2720606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Interfaces.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2730606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4List.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2740606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4MdhdAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2750606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4MdhdAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2760606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4MoovAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2770606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4MoovAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E27A0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4MvhdAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E27B0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4MvhdAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E27C0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4OffsetArray.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E27D0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Results.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E27E0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4Sample.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E27F0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Sample.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2800606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4SchmAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2810606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4SchmAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2840606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4StcoAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2850606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4StcoAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2860606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4StscAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2870606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4StscAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2880606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4StsdAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2890606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4StsdAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E28A0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4StssAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E28B0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4StssAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E28C0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4StszAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E28D0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4StszAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E28E0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4SttsAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E28F0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4SttsAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2900606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4TkhdAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2910606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4TkhdAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2920606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4Track.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2930606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Track.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2940606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4TrakAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2950606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4TrakAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2960606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Types.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2970606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4UrlAtom.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2980606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4UrlAtom.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E2990606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4Utils.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E29A0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4Utils.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E29B0606C24C00B2ACD1 = {
+ children = (
+ F977E29C0606C24C00B2ACD1,
+ );
+ isa = PBXGroup;
+ name = System;
+ path = ../../../Source/System;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E29C0606C24C00B2ACD1 = {
+ children = (
+ F977E29D0606C24C00B2ACD1,
+ );
+ isa = PBXGroup;
+ path = StdC;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E29D0606C24C00B2ACD1 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4StdCFileByteStream.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F977E29E0606C24C00B2ACD1 = {
+ fileRef = F977E2480606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E29F0606C24C00B2ACD1 = {
+ fileRef = F977E24A0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A00606C24C00B2ACD1 = {
+ fileRef = F977E24B0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A10606C24C00B2ACD1 = {
+ fileRef = F977E24C0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A20606C24C00B2ACD1 = {
+ fileRef = F977E24D0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A30606C24C00B2ACD1 = {
+ fileRef = F977E24E0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A40606C24C00B2ACD1 = {
+ fileRef = F977E24F0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A50606C24C00B2ACD1 = {
+ fileRef = F977E2500606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A60606C24C00B2ACD1 = {
+ fileRef = F977E2510606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A70606C24C00B2ACD1 = {
+ fileRef = F977E2520606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A80606C24C00B2ACD1 = {
+ fileRef = F977E2530606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2A90606C24C00B2ACD1 = {
+ fileRef = F977E2540606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2AA0606C24C00B2ACD1 = {
+ fileRef = F977E2550606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2AB0606C24C00B2ACD1 = {
+ fileRef = F977E2560606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2AC0606C24C00B2ACD1 = {
+ fileRef = F977E2570606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2AD0606C24C00B2ACD1 = {
+ fileRef = F977E2580606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2AE0606C24C00B2ACD1 = {
+ fileRef = F977E2590606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2AF0606C24C00B2ACD1 = {
+ fileRef = F977E25A0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2B00606C24C00B2ACD1 = {
+ fileRef = F977E25B0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2B10606C24C00B2ACD1 = {
+ fileRef = F977E25C0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2B20606C24C00B2ACD1 = {
+ fileRef = F977E25D0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2B30606C24C00B2ACD1 = {
+ fileRef = F977E25E0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2B40606C24C00B2ACD1 = {
+ fileRef = F977E25F0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2B50606C24C00B2ACD1 = {
+ fileRef = F977E2600606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2B60606C24C00B2ACD1 = {
+ fileRef = F977E2610606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2B70606C24C00B2ACD1 = {
+ fileRef = F977E2620606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2BA0606C24C00B2ACD1 = {
+ fileRef = F977E2650606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2BB0606C24C00B2ACD1 = {
+ fileRef = F977E2660606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2BC0606C24C00B2ACD1 = {
+ fileRef = F977E2670606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2BD0606C24C00B2ACD1 = {
+ fileRef = F977E2680606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2BE0606C24C00B2ACD1 = {
+ fileRef = F977E2690606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2BF0606C24C00B2ACD1 = {
+ fileRef = F977E26A0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C00606C24C00B2ACD1 = {
+ fileRef = F977E26B0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C10606C24C00B2ACD1 = {
+ fileRef = F977E26C0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C20606C24C00B2ACD1 = {
+ fileRef = F977E26D0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C30606C24C00B2ACD1 = {
+ fileRef = F977E26E0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C40606C24C00B2ACD1 = {
+ fileRef = F977E26F0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C50606C24C00B2ACD1 = {
+ fileRef = F977E2700606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C60606C24C00B2ACD1 = {
+ fileRef = F977E2710606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C70606C24C00B2ACD1 = {
+ fileRef = F977E2720606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C80606C24C00B2ACD1 = {
+ fileRef = F977E2730606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2C90606C24C00B2ACD1 = {
+ fileRef = F977E2740606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2CA0606C24C00B2ACD1 = {
+ fileRef = F977E2750606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2CB0606C24C00B2ACD1 = {
+ fileRef = F977E2760606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2CC0606C24C00B2ACD1 = {
+ fileRef = F977E2770606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2CF0606C24C00B2ACD1 = {
+ fileRef = F977E27A0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2D00606C24C00B2ACD1 = {
+ fileRef = F977E27B0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2D10606C24C00B2ACD1 = {
+ fileRef = F977E27C0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2D20606C24C00B2ACD1 = {
+ fileRef = F977E27D0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2D30606C24C00B2ACD1 = {
+ fileRef = F977E27E0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2D40606C24C00B2ACD1 = {
+ fileRef = F977E27F0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2D50606C24C00B2ACD1 = {
+ fileRef = F977E2800606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2D60606C24C00B2ACD1 = {
+ fileRef = F977E2810606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2D90606C24C00B2ACD1 = {
+ fileRef = F977E2840606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2DA0606C24C00B2ACD1 = {
+ fileRef = F977E2850606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2DB0606C24C00B2ACD1 = {
+ fileRef = F977E2860606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2DC0606C24C00B2ACD1 = {
+ fileRef = F977E2870606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2DD0606C24C00B2ACD1 = {
+ fileRef = F977E2880606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2DE0606C24C00B2ACD1 = {
+ fileRef = F977E2890606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2DF0606C24C00B2ACD1 = {
+ fileRef = F977E28A0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E00606C24C00B2ACD1 = {
+ fileRef = F977E28B0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E10606C24C00B2ACD1 = {
+ fileRef = F977E28C0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E20606C24C00B2ACD1 = {
+ fileRef = F977E28D0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E30606C24C00B2ACD1 = {
+ fileRef = F977E28E0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E40606C24C00B2ACD1 = {
+ fileRef = F977E28F0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E50606C24C00B2ACD1 = {
+ fileRef = F977E2900606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E60606C24C00B2ACD1 = {
+ fileRef = F977E2910606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E70606C24C00B2ACD1 = {
+ fileRef = F977E2920606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E80606C24C00B2ACD1 = {
+ fileRef = F977E2930606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2E90606C24C00B2ACD1 = {
+ fileRef = F977E2940606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2EA0606C24C00B2ACD1 = {
+ fileRef = F977E2950606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2EB0606C24C00B2ACD1 = {
+ fileRef = F977E2960606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2EC0606C24C00B2ACD1 = {
+ fileRef = F977E2970606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2ED0606C24C00B2ACD1 = {
+ fileRef = F977E2980606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2EE0606C24C00B2ACD1 = {
+ fileRef = F977E2990606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2EF0606C24C00B2ACD1 = {
+ fileRef = F977E29A0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F977E2F00606C24C00B2ACD1 = {
+ fileRef = F977E29D0606C24C00B2ACD1;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F988A1BC060AC5CC00916ED3 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = Ap4DataBuffer.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F988A1BD060AC5CC00916ED3 = {
+ fileRef = F988A1BC060AC5CC00916ED3;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F988A1C0060AC84100916ED3 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4DataBuffer.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F988A1C1060AC84100916ED3 = {
+ fileRef = F988A1C0060AC84100916ED3;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F993837406038FE300FCB9EC = {
+ children = (
+ F993837506038FE300FCB9EC,
+ F993837706038FE300FCB9EC,
+ F993837906038FE300FCB9EC,
+ F993837B06038FE300FCB9EC,
+ F993837D06038FE300FCB9EC,
+ );
+ isa = PBXGroup;
+ name = Apps;
+ path = ../../../Source/Apps;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F993837506038FE300FCB9EC = {
+ children = (
+ F993837606038FE300FCB9EC,
+ );
+ isa = PBXGroup;
+ path = Aac2Mp4;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F993837606038FE300FCB9EC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = Aac2Mp4.cpp;
+ path = ../../../Source/Apps/Aac2Mp4/Aac2Mp4.cpp;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ F993837706038FE300FCB9EC = {
+ children = (
+ F993837806038FE300FCB9EC,
+ );
+ isa = PBXGroup;
+ path = Ap4Dump;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F993837806038FE300FCB9EC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = Ap4Dump.cpp;
+ path = ../../../Source/Apps/Ap4Dump/Ap4Dump.cpp;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ F993837906038FE300FCB9EC = {
+ children = (
+ F993837A06038FE300FCB9EC,
+ );
+ isa = PBXGroup;
+ path = Ap4Info;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F993837A06038FE300FCB9EC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = Ap4Info.cpp;
+ path = ../../../Source/Apps/Ap4Info/Ap4Info.cpp;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ F993837B06038FE300FCB9EC = {
+ children = (
+ F993837C06038FE300FCB9EC,
+ );
+ isa = PBXGroup;
+ path = Ap4Tag;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F993837C06038FE300FCB9EC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = Ap4Tag.cpp;
+ path = ../../../Source/Apps/Ap4Tag/Ap4Tag.cpp;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ F993837D06038FE300FCB9EC = {
+ children = (
+ F993837E06038FE300FCB9EC,
+ );
+ isa = PBXGroup;
+ path = Mp42Aac;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F993837E06038FE300FCB9EC = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ name = Mp42Aac.cpp;
+ path = ../../../Source/Apps/Mp42Aac/Mp42Aac.cpp;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ F99D17B2060D57D500068537 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4SampleDescription.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F99D17B3060D57D500068537 = {
+ fileRef = F99D17B2060D57D500068537;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F9A022800616103C0039AF2E = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = Ap4SampleEntry.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F9A022810616103C0039AF2E = {
+ fileRef = F9A022800616103C0039AF2E;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ };
+ rootObject = 08FB7793FE84155DC02AAC07;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/ppc-apple-macosx/AP4.xcodeproj/project.pbxproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/ppc-apple-macosx/AP4.xcodeproj/project.pbxproj
new file mode 100644
index 000000000..0b0f4c875
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/ppc-apple-macosx/AP4.xcodeproj/project.pbxproj
@@ -0,0 +1,1888 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ F91BDA4108E77E3F00653EAA /* Aac2Mp4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA2A08E77DA100653EAA /* Aac2Mp4.cpp */; };
+ F91BDA4208E77E5100653EAA /* Mp42Aac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA3808E77DA100653EAA /* Mp42Aac.cpp */; };
+ F91BDA4E08E77F1800653EAA /* libAP4.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libAP4.a */; };
+ F91BDA5308E77F3600653EAA /* Mp4Decrypt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA2C08E77DA100653EAA /* Mp4Decrypt.cpp */; };
+ F91BDA5B08E77F7000653EAA /* libAP4.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libAP4.a */; };
+ F91BDA6008E77F9500653EAA /* Mp4Dump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA2E08E77DA100653EAA /* Mp4Dump.cpp */; };
+ F91BDA6F08E7800E00653EAA /* Mp4Encrypt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA3208E77DA100653EAA /* Mp4Encrypt.cpp */; };
+ F91BDA7408E7806500653EAA /* Ap4AesBlockCipher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA7008E7806400653EAA /* Ap4AesBlockCipher.cpp */; };
+ F91BDA7508E7806500653EAA /* Ap4AesBlockCipher.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA7108E7806400653EAA /* Ap4AesBlockCipher.h */; };
+ F91BDA7608E7806500653EAA /* Ap4StreamCipher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA7208E7806400653EAA /* Ap4StreamCipher.cpp */; };
+ F91BDA7708E7806500653EAA /* Ap4StreamCipher.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA7308E7806500653EAA /* Ap4StreamCipher.h */; };
+ F91BDAF108E780BF00653EAA /* Ap4.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA7B08E780BF00653EAA /* Ap4.h */; };
+ F91BDAF208E780BF00653EAA /* Ap4Array.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA7C08E780BF00653EAA /* Ap4Array.h */; };
+ F91BDAF308E780BF00653EAA /* Ap4Atom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA7D08E780BF00653EAA /* Ap4Atom.cpp */; };
+ F91BDAF408E780BF00653EAA /* Ap4Atom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA7E08E780BF00653EAA /* Ap4Atom.h */; };
+ F91BDAF508E780BF00653EAA /* Ap4AtomFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA7F08E780BF00653EAA /* Ap4AtomFactory.cpp */; };
+ F91BDAF608E780BF00653EAA /* Ap4AtomFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA8008E780BF00653EAA /* Ap4AtomFactory.h */; };
+ F91BDAF708E780BF00653EAA /* Ap4AtomSampleTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA8108E780BF00653EAA /* Ap4AtomSampleTable.cpp */; };
+ F91BDAF808E780BF00653EAA /* Ap4AtomSampleTable.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA8208E780BF00653EAA /* Ap4AtomSampleTable.h */; };
+ F91BDAF908E780BF00653EAA /* Ap4ByteStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA8308E780BF00653EAA /* Ap4ByteStream.cpp */; };
+ F91BDAFA08E780BF00653EAA /* Ap4ByteStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA8408E780BF00653EAA /* Ap4ByteStream.h */; };
+ F91BDAFB08E780BF00653EAA /* Ap4Constants.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA8508E780BF00653EAA /* Ap4Constants.h */; };
+ F91BDAFC08E780BF00653EAA /* Ap4ContainerAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA8608E780BF00653EAA /* Ap4ContainerAtom.cpp */; };
+ F91BDAFD08E780BF00653EAA /* Ap4ContainerAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA8708E780BF00653EAA /* Ap4ContainerAtom.h */; };
+ F91BDAFE08E780BF00653EAA /* Ap4CttsAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA8808E780BF00653EAA /* Ap4CttsAtom.cpp */; };
+ F91BDAFF08E780BF00653EAA /* Ap4CttsAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA8908E780BF00653EAA /* Ap4CttsAtom.h */; };
+ F91BDB0008E780BF00653EAA /* Ap4DataBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA8A08E780BF00653EAA /* Ap4DataBuffer.cpp */; };
+ F91BDB0108E780BF00653EAA /* Ap4DataBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA8B08E780BF00653EAA /* Ap4DataBuffer.h */; };
+ F91BDB0208E780BF00653EAA /* Ap4Debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA8C08E780BF00653EAA /* Ap4Debug.cpp */; };
+ F91BDB0308E780BF00653EAA /* Ap4Debug.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA8D08E780BF00653EAA /* Ap4Debug.h */; };
+ F91BDB0408E780BF00653EAA /* Ap4DecoderConfigDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA8E08E780BF00653EAA /* Ap4DecoderConfigDescriptor.cpp */; };
+ F91BDB0508E780BF00653EAA /* Ap4DecoderConfigDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA8F08E780BF00653EAA /* Ap4DecoderConfigDescriptor.h */; };
+ F91BDB0608E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA9008E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.cpp */; };
+ F91BDB0708E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA9108E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.h */; };
+ F91BDB0808E780BF00653EAA /* Ap4Descriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA9208E780BF00653EAA /* Ap4Descriptor.cpp */; };
+ F91BDB0908E780BF00653EAA /* Ap4Descriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA9308E780BF00653EAA /* Ap4Descriptor.h */; };
+ F91BDB0A08E780BF00653EAA /* Ap4DescriptorFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA9408E780BF00653EAA /* Ap4DescriptorFactory.cpp */; };
+ F91BDB0B08E780BF00653EAA /* Ap4DescriptorFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA9508E780BF00653EAA /* Ap4DescriptorFactory.h */; };
+ F91BDB0C08E780BF00653EAA /* Ap4DrefAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA9608E780BF00653EAA /* Ap4DrefAtom.cpp */; };
+ F91BDB0D08E780BF00653EAA /* Ap4DrefAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA9708E780BF00653EAA /* Ap4DrefAtom.h */; };
+ F91BDB0E08E780BF00653EAA /* Ap4EsDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA9808E780BF00653EAA /* Ap4EsDescriptor.cpp */; };
+ F91BDB0F08E780BF00653EAA /* Ap4EsDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA9908E780BF00653EAA /* Ap4EsDescriptor.h */; };
+ F91BDB1008E780BF00653EAA /* Ap4EsdsAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA9A08E780BF00653EAA /* Ap4EsdsAtom.cpp */; };
+ F91BDB1108E780BF00653EAA /* Ap4EsdsAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA9B08E780BF00653EAA /* Ap4EsdsAtom.h */; };
+ F91BDB1208E780BF00653EAA /* Ap4File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA9C08E780BF00653EAA /* Ap4File.cpp */; };
+ F91BDB1308E780BF00653EAA /* Ap4File.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA9D08E780BF00653EAA /* Ap4File.h */; };
+ F91BDB1408E780BF00653EAA /* Ap4FileByteStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDA9E08E780BF00653EAA /* Ap4FileByteStream.h */; };
+ F91BDB1508E780BF00653EAA /* Ap4FileWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA9F08E780BF00653EAA /* Ap4FileWriter.cpp */; };
+ F91BDB1608E780BF00653EAA /* Ap4FileWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAA008E780BF00653EAA /* Ap4FileWriter.h */; };
+ F91BDB1708E780BF00653EAA /* Ap4FrmaAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAA108E780BF00653EAA /* Ap4FrmaAtom.cpp */; };
+ F91BDB1808E780BF00653EAA /* Ap4FrmaAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAA208E780BF00653EAA /* Ap4FrmaAtom.h */; };
+ F91BDB1908E780BF00653EAA /* Ap4FtypAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAA308E780BF00653EAA /* Ap4FtypAtom.cpp */; };
+ F91BDB1A08E780BF00653EAA /* Ap4FtypAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAA408E780BF00653EAA /* Ap4FtypAtom.h */; };
+ F91BDB1B08E780BF00653EAA /* Ap4HdlrAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAA508E780BF00653EAA /* Ap4HdlrAtom.cpp */; };
+ F91BDB1C08E780BF00653EAA /* Ap4HdlrAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAA608E780BF00653EAA /* Ap4HdlrAtom.h */; };
+ F91BDB1D08E780BF00653EAA /* Ap4HmhdAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAA708E780BF00653EAA /* Ap4HmhdAtom.cpp */; };
+ F91BDB1E08E780BF00653EAA /* Ap4HmhdAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAA808E780BF00653EAA /* Ap4HmhdAtom.h */; };
+ F91BDB1F08E780BF00653EAA /* Ap4IkmsAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAA908E780BF00653EAA /* Ap4IkmsAtom.cpp */; };
+ F91BDB2008E780BF00653EAA /* Ap4IkmsAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAAA08E780BF00653EAA /* Ap4IkmsAtom.h */; };
+ F91BDB2108E780BF00653EAA /* Ap4Interfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAAB08E780BF00653EAA /* Ap4Interfaces.h */; };
+ F91BDB2208E780BF00653EAA /* Ap4IsfmAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAAC08E780BF00653EAA /* Ap4IsfmAtom.cpp */; };
+ F91BDB2308E780BF00653EAA /* Ap4IsfmAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAAD08E780BF00653EAA /* Ap4IsfmAtom.h */; };
+ F91BDB2408E780BF00653EAA /* Ap4IsmaCryp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAAE08E780BF00653EAA /* Ap4IsmaCryp.cpp */; };
+ F91BDB2508E780BF00653EAA /* Ap4IsmaCryp.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAAF08E780BF00653EAA /* Ap4IsmaCryp.h */; };
+ F91BDB2608E780BF00653EAA /* Ap4List.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAB008E780BF00653EAA /* Ap4List.h */; };
+ F91BDB2708E780BF00653EAA /* Ap4MdhdAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAB108E780BF00653EAA /* Ap4MdhdAtom.cpp */; };
+ F91BDB2808E780BF00653EAA /* Ap4MdhdAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAB208E780BF00653EAA /* Ap4MdhdAtom.h */; };
+ F91BDB2908E780BF00653EAA /* Ap4MoovAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAB308E780BF00653EAA /* Ap4MoovAtom.cpp */; };
+ F91BDB2A08E780BF00653EAA /* Ap4MoovAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAB408E780BF00653EAA /* Ap4MoovAtom.h */; };
+ F91BDB2B08E780BF00653EAA /* Ap4Movie.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAB508E780BF00653EAA /* Ap4Movie.cpp */; };
+ F91BDB2C08E780BF00653EAA /* Ap4Movie.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAB608E780BF00653EAA /* Ap4Movie.h */; };
+ F91BDB2D08E780BF00653EAA /* Ap4MvhdAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAB708E780BF00653EAA /* Ap4MvhdAtom.cpp */; };
+ F91BDB2E08E780BF00653EAA /* Ap4MvhdAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAB808E780BF00653EAA /* Ap4MvhdAtom.h */; };
+ F91BDB2F08E780BF00653EAA /* Ap4NmhdAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAB908E780BF00653EAA /* Ap4NmhdAtom.cpp */; };
+ F91BDB3008E780BF00653EAA /* Ap4NmhdAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDABA08E780BF00653EAA /* Ap4NmhdAtom.h */; };
+ F91BDB3108E780BF00653EAA /* Ap4Processor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDABB08E780BF00653EAA /* Ap4Processor.cpp */; };
+ F91BDB3208E780BF00653EAA /* Ap4Processor.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDABC08E780BF00653EAA /* Ap4Processor.h */; };
+ F91BDB3308E780BF00653EAA /* Ap4Results.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDABD08E780BF00653EAA /* Ap4Results.h */; };
+ F91BDB3408E780BF00653EAA /* Ap4RtpAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDABE08E780BF00653EAA /* Ap4RtpAtom.cpp */; };
+ F91BDB3508E780BF00653EAA /* Ap4RtpAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDABF08E780BF00653EAA /* Ap4RtpAtom.h */; };
+ F91BDB3608E780BF00653EAA /* Ap4RtpHint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAC008E780BF00653EAA /* Ap4RtpHint.cpp */; };
+ F91BDB3708E780BF00653EAA /* Ap4RtpHint.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAC108E780BF00653EAA /* Ap4RtpHint.h */; };
+ F91BDB3808E780BF00653EAA /* Ap4Sample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAC208E780BF00653EAA /* Ap4Sample.cpp */; };
+ F91BDB3908E780BF00653EAA /* Ap4Sample.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAC308E780BF00653EAA /* Ap4Sample.h */; };
+ F91BDB3A08E780BF00653EAA /* Ap4SampleDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAC408E780BF00653EAA /* Ap4SampleDescription.cpp */; };
+ F91BDB3B08E780BF00653EAA /* Ap4SampleDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAC508E780BF00653EAA /* Ap4SampleDescription.h */; };
+ F91BDB3C08E780BF00653EAA /* Ap4SampleEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAC608E780BF00653EAA /* Ap4SampleEntry.cpp */; };
+ F91BDB3D08E780BF00653EAA /* Ap4SampleEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAC708E780BF00653EAA /* Ap4SampleEntry.h */; };
+ F91BDB3E08E780BF00653EAA /* Ap4SampleTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAC808E780BF00653EAA /* Ap4SampleTable.cpp */; };
+ F91BDB3F08E780BF00653EAA /* Ap4SampleTable.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAC908E780BF00653EAA /* Ap4SampleTable.h */; };
+ F91BDB4008E780BF00653EAA /* Ap4SchmAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDACA08E780BF00653EAA /* Ap4SchmAtom.cpp */; };
+ F91BDB4108E780BF00653EAA /* Ap4SchmAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDACB08E780BF00653EAA /* Ap4SchmAtom.h */; };
+ F91BDB4208E780BF00653EAA /* Ap4SdpAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDACC08E780BF00653EAA /* Ap4SdpAtom.cpp */; };
+ F91BDB4308E780BF00653EAA /* Ap4SdpAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDACD08E780BF00653EAA /* Ap4SdpAtom.h */; };
+ F91BDB4408E780BF00653EAA /* Ap4SLConfigDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDACE08E780BF00653EAA /* Ap4SLConfigDescriptor.cpp */; };
+ F91BDB4508E780BF00653EAA /* Ap4SLConfigDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDACF08E780BF00653EAA /* Ap4SLConfigDescriptor.h */; };
+ F91BDB4608E780BF00653EAA /* Ap4SmhdAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAD008E780BF00653EAA /* Ap4SmhdAtom.cpp */; };
+ F91BDB4708E780BF00653EAA /* Ap4SmhdAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAD108E780BF00653EAA /* Ap4SmhdAtom.h */; };
+ F91BDB4808E780BF00653EAA /* Ap4StcoAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAD208E780BF00653EAA /* Ap4StcoAtom.cpp */; };
+ F91BDB4908E780BF00653EAA /* Ap4StcoAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAD308E780BF00653EAA /* Ap4StcoAtom.h */; };
+ F91BDB4A08E780BF00653EAA /* Ap4StscAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAD408E780BF00653EAA /* Ap4StscAtom.cpp */; };
+ F91BDB4B08E780BF00653EAA /* Ap4StscAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAD508E780BF00653EAA /* Ap4StscAtom.h */; };
+ F91BDB4C08E780BF00653EAA /* Ap4StsdAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAD608E780BF00653EAA /* Ap4StsdAtom.cpp */; };
+ F91BDB4D08E780BF00653EAA /* Ap4StsdAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAD708E780BF00653EAA /* Ap4StsdAtom.h */; };
+ F91BDB4E08E780BF00653EAA /* Ap4StssAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAD808E780BF00653EAA /* Ap4StssAtom.cpp */; };
+ F91BDB4F08E780BF00653EAA /* Ap4StssAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAD908E780BF00653EAA /* Ap4StssAtom.h */; };
+ F91BDB5008E780BF00653EAA /* Ap4StszAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDADA08E780BF00653EAA /* Ap4StszAtom.cpp */; };
+ F91BDB5108E780BF00653EAA /* Ap4StszAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDADB08E780BF00653EAA /* Ap4StszAtom.h */; };
+ F91BDB5208E780BF00653EAA /* Ap4SttsAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDADC08E780BF00653EAA /* Ap4SttsAtom.cpp */; };
+ F91BDB5308E780BF00653EAA /* Ap4SttsAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDADD08E780BF00653EAA /* Ap4SttsAtom.h */; };
+ F91BDB5408E780BF00653EAA /* Ap4SyntheticSampleTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDADE08E780BF00653EAA /* Ap4SyntheticSampleTable.cpp */; };
+ F91BDB5508E780BF00653EAA /* Ap4SyntheticSampleTable.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDADF08E780BF00653EAA /* Ap4SyntheticSampleTable.h */; };
+ F91BDB5608E780BF00653EAA /* Ap4TimsAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAE008E780BF00653EAA /* Ap4TimsAtom.cpp */; };
+ F91BDB5708E780BF00653EAA /* Ap4TimsAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAE108E780BF00653EAA /* Ap4TimsAtom.h */; };
+ F91BDB5808E780BF00653EAA /* Ap4TkhdAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAE208E780BF00653EAA /* Ap4TkhdAtom.cpp */; };
+ F91BDB5908E780BF00653EAA /* Ap4TkhdAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAE308E780BF00653EAA /* Ap4TkhdAtom.h */; };
+ F91BDB5A08E780BF00653EAA /* Ap4Track.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAE408E780BF00653EAA /* Ap4Track.cpp */; };
+ F91BDB5B08E780BF00653EAA /* Ap4Track.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAE508E780BF00653EAA /* Ap4Track.h */; };
+ F91BDB5C08E780BF00653EAA /* Ap4TrakAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAE608E780BF00653EAA /* Ap4TrakAtom.cpp */; };
+ F91BDB5D08E780BF00653EAA /* Ap4TrakAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAE708E780BF00653EAA /* Ap4TrakAtom.h */; };
+ F91BDB5E08E780BF00653EAA /* Ap4Types.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAE808E780BF00653EAA /* Ap4Types.h */; };
+ F91BDB5F08E780BF00653EAA /* Ap4UnknownDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAE908E780BF00653EAA /* Ap4UnknownDescriptor.cpp */; };
+ F91BDB6008E780BF00653EAA /* Ap4UnknownDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAEA08E780BF00653EAA /* Ap4UnknownDescriptor.h */; };
+ F91BDB6108E780BF00653EAA /* Ap4UrlAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAEB08E780BF00653EAA /* Ap4UrlAtom.cpp */; };
+ F91BDB6208E780BF00653EAA /* Ap4UrlAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAEC08E780BF00653EAA /* Ap4UrlAtom.h */; };
+ F91BDB6308E780BF00653EAA /* Ap4Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAED08E780BF00653EAA /* Ap4Utils.cpp */; };
+ F91BDB6408E780BF00653EAA /* Ap4Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAEE08E780BF00653EAA /* Ap4Utils.h */; };
+ F91BDB6508E780BF00653EAA /* Ap4VmhdAtom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDAEF08E780BF00653EAA /* Ap4VmhdAtom.cpp */; };
+ F91BDB6608E780BF00653EAA /* Ap4VmhdAtom.h in Headers */ = {isa = PBXBuildFile; fileRef = F91BDAF008E780BF00653EAA /* Ap4VmhdAtom.h */; };
+ F91BDB7408E7887100653EAA /* libAP4.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libAP4.a */; };
+ F91BDB7C08E788AF00653EAA /* libAP4.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libAP4.a */; };
+ F91BDB8108E788D200653EAA /* Mp4Info.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA3408E77DA100653EAA /* Mp4Info.cpp */; };
+ F91BDB8908E7891400653EAA /* libAP4.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libAP4.a */; };
+ F91BDB8A08E7892A00653EAA /* Mp4Tag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F91BDA3608E77DA100653EAA /* Mp4Tag.cpp */; };
+ F98F76A308C40D390048D3AE /* Ap4AdtsParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F98F762608C40D380048D3AE /* Ap4AdtsParser.cpp */; };
+ F98F76A408C40D390048D3AE /* Ap4AdtsParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F98F762708C40D380048D3AE /* Ap4AdtsParser.h */; };
+ F98F76A508C40D390048D3AE /* Ap4BitStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F98F762808C40D380048D3AE /* Ap4BitStream.cpp */; };
+ F98F76A608C40D390048D3AE /* Ap4BitStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F98F762908C40D380048D3AE /* Ap4BitStream.h */; };
+ F98F76A708C40D390048D3AE /* Ap4Config.h in Headers */ = {isa = PBXBuildFile; fileRef = F98F762B08C40D380048D3AE /* Ap4Config.h */; };
+ F98F771508C40D390048D3AE /* Ap4StdCFileByteStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F98F769D08C40D390048D3AE /* Ap4StdCFileByteStream.cpp */; };
+ F9E684C60606AC4900B2B444 /* libAP4.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libAP4.a */; };
+ F9E684C90606AC6200B2B444 /* libAP4.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libAP4.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXBuildStyle section */
+ 014CEA520018CE5811CA2923 /* Development */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ DEBUGGING_SYMBOLS = YES;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ OPTIMIZATION_CFLAGS = "-O0";
+ ZERO_LINK = YES;
+ };
+ name = Development;
+ };
+ 014CEA530018CE5811CA2923 /* Deployment */ = {
+ isa = PBXBuildStyle;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ ZERO_LINK = NO;
+ };
+ name = Deployment;
+ };
+/* End PBXBuildStyle section */
+
+/* Begin PBXContainerItemProxy section */
+ F91BDA4808E77EF100653EAA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D /* AP4 */;
+ remoteInfo = AP4;
+ };
+ F91BDA5908E77F5900653EAA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D /* AP4 */;
+ remoteInfo = AP4;
+ };
+ F91BDA6908E77FEC00653EAA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D /* AP4 */;
+ remoteInfo = AP4;
+ };
+ F91BDB7A08E7889F00653EAA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D /* AP4 */;
+ remoteInfo = AP4;
+ };
+ F91BDB8708E7890800653EAA /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D /* AP4 */;
+ remoteInfo = AP4;
+ };
+ F993836806038E5C00FCB9EC /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D;
+ remoteInfo = AP4;
+ };
+ F993837006038E9A00FCB9EC /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D;
+ remoteInfo = AP4;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ D2AAC046055464E500DB518D /* libAP4.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libAP4.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ F91BDA2A08E77DA100653EAA /* Aac2Mp4.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Aac2Mp4.cpp; sourceTree = "<group>"; };
+ F91BDA2C08E77DA100653EAA /* Mp4Decrypt.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Mp4Decrypt.cpp; sourceTree = "<group>"; };
+ F91BDA2E08E77DA100653EAA /* Mp4Dump.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Mp4Dump.cpp; sourceTree = "<group>"; };
+ F91BDA3008E77DA100653EAA /* Mp4Edit.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Mp4Edit.cpp; sourceTree = "<group>"; };
+ F91BDA3208E77DA100653EAA /* Mp4Encrypt.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Mp4Encrypt.cpp; sourceTree = "<group>"; };
+ F91BDA3408E77DA100653EAA /* Mp4Info.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Mp4Info.cpp; sourceTree = "<group>"; };
+ F91BDA3608E77DA100653EAA /* Mp4Tag.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Mp4Tag.cpp; sourceTree = "<group>"; };
+ F91BDA3808E77DA100653EAA /* Mp42Aac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Mp42Aac.cpp; sourceTree = "<group>"; };
+ F91BDA4608E77EE200653EAA /* Mp4Decrypt */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Mp4Decrypt; sourceTree = BUILT_PRODUCTS_DIR; };
+ F91BDA5708E77F5100653EAA /* Mp4Dump */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Mp4Dump; sourceTree = BUILT_PRODUCTS_DIR; };
+ F91BDA6708E77FE000653EAA /* Mp4Encrypt */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Mp4Encrypt; sourceTree = BUILT_PRODUCTS_DIR; };
+ F91BDA7008E7806400653EAA /* Ap4AesBlockCipher.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4AesBlockCipher.cpp; sourceTree = "<group>"; };
+ F91BDA7108E7806400653EAA /* Ap4AesBlockCipher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4AesBlockCipher.h; sourceTree = "<group>"; };
+ F91BDA7208E7806400653EAA /* Ap4StreamCipher.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4StreamCipher.cpp; sourceTree = "<group>"; };
+ F91BDA7308E7806500653EAA /* Ap4StreamCipher.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4StreamCipher.h; sourceTree = "<group>"; };
+ F91BDA7B08E780BF00653EAA /* Ap4.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4.h; sourceTree = "<group>"; };
+ F91BDA7C08E780BF00653EAA /* Ap4Array.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Array.h; sourceTree = "<group>"; };
+ F91BDA7D08E780BF00653EAA /* Ap4Atom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4Atom.cpp; sourceTree = "<group>"; };
+ F91BDA7E08E780BF00653EAA /* Ap4Atom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Atom.h; sourceTree = "<group>"; };
+ F91BDA7F08E780BF00653EAA /* Ap4AtomFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4AtomFactory.cpp; sourceTree = "<group>"; };
+ F91BDA8008E780BF00653EAA /* Ap4AtomFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4AtomFactory.h; sourceTree = "<group>"; };
+ F91BDA8108E780BF00653EAA /* Ap4AtomSampleTable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4AtomSampleTable.cpp; sourceTree = "<group>"; };
+ F91BDA8208E780BF00653EAA /* Ap4AtomSampleTable.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4AtomSampleTable.h; sourceTree = "<group>"; };
+ F91BDA8308E780BF00653EAA /* Ap4ByteStream.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4ByteStream.cpp; sourceTree = "<group>"; };
+ F91BDA8408E780BF00653EAA /* Ap4ByteStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4ByteStream.h; sourceTree = "<group>"; };
+ F91BDA8508E780BF00653EAA /* Ap4Constants.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Constants.h; sourceTree = "<group>"; };
+ F91BDA8608E780BF00653EAA /* Ap4ContainerAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4ContainerAtom.cpp; sourceTree = "<group>"; };
+ F91BDA8708E780BF00653EAA /* Ap4ContainerAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4ContainerAtom.h; sourceTree = "<group>"; };
+ F91BDA8808E780BF00653EAA /* Ap4CttsAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4CttsAtom.cpp; sourceTree = "<group>"; };
+ F91BDA8908E780BF00653EAA /* Ap4CttsAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4CttsAtom.h; sourceTree = "<group>"; };
+ F91BDA8A08E780BF00653EAA /* Ap4DataBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4DataBuffer.cpp; sourceTree = "<group>"; };
+ F91BDA8B08E780BF00653EAA /* Ap4DataBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4DataBuffer.h; sourceTree = "<group>"; };
+ F91BDA8C08E780BF00653EAA /* Ap4Debug.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4Debug.cpp; sourceTree = "<group>"; };
+ F91BDA8D08E780BF00653EAA /* Ap4Debug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Debug.h; sourceTree = "<group>"; };
+ F91BDA8E08E780BF00653EAA /* Ap4DecoderConfigDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4DecoderConfigDescriptor.cpp; sourceTree = "<group>"; };
+ F91BDA8F08E780BF00653EAA /* Ap4DecoderConfigDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4DecoderConfigDescriptor.h; sourceTree = "<group>"; };
+ F91BDA9008E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4DecoderSpecificInfoDescriptor.cpp; sourceTree = "<group>"; };
+ F91BDA9108E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4DecoderSpecificInfoDescriptor.h; sourceTree = "<group>"; };
+ F91BDA9208E780BF00653EAA /* Ap4Descriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4Descriptor.cpp; sourceTree = "<group>"; };
+ F91BDA9308E780BF00653EAA /* Ap4Descriptor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Descriptor.h; sourceTree = "<group>"; };
+ F91BDA9408E780BF00653EAA /* Ap4DescriptorFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4DescriptorFactory.cpp; sourceTree = "<group>"; };
+ F91BDA9508E780BF00653EAA /* Ap4DescriptorFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4DescriptorFactory.h; sourceTree = "<group>"; };
+ F91BDA9608E780BF00653EAA /* Ap4DrefAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4DrefAtom.cpp; sourceTree = "<group>"; };
+ F91BDA9708E780BF00653EAA /* Ap4DrefAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4DrefAtom.h; sourceTree = "<group>"; };
+ F91BDA9808E780BF00653EAA /* Ap4EsDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4EsDescriptor.cpp; sourceTree = "<group>"; };
+ F91BDA9908E780BF00653EAA /* Ap4EsDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4EsDescriptor.h; sourceTree = "<group>"; };
+ F91BDA9A08E780BF00653EAA /* Ap4EsdsAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4EsdsAtom.cpp; sourceTree = "<group>"; };
+ F91BDA9B08E780BF00653EAA /* Ap4EsdsAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4EsdsAtom.h; sourceTree = "<group>"; };
+ F91BDA9C08E780BF00653EAA /* Ap4File.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4File.cpp; sourceTree = "<group>"; };
+ F91BDA9D08E780BF00653EAA /* Ap4File.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4File.h; sourceTree = "<group>"; };
+ F91BDA9E08E780BF00653EAA /* Ap4FileByteStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4FileByteStream.h; sourceTree = "<group>"; };
+ F91BDA9F08E780BF00653EAA /* Ap4FileWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4FileWriter.cpp; sourceTree = "<group>"; };
+ F91BDAA008E780BF00653EAA /* Ap4FileWriter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4FileWriter.h; sourceTree = "<group>"; };
+ F91BDAA108E780BF00653EAA /* Ap4FrmaAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4FrmaAtom.cpp; sourceTree = "<group>"; };
+ F91BDAA208E780BF00653EAA /* Ap4FrmaAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4FrmaAtom.h; sourceTree = "<group>"; };
+ F91BDAA308E780BF00653EAA /* Ap4FtypAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4FtypAtom.cpp; sourceTree = "<group>"; };
+ F91BDAA408E780BF00653EAA /* Ap4FtypAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4FtypAtom.h; sourceTree = "<group>"; };
+ F91BDAA508E780BF00653EAA /* Ap4HdlrAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4HdlrAtom.cpp; sourceTree = "<group>"; };
+ F91BDAA608E780BF00653EAA /* Ap4HdlrAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4HdlrAtom.h; sourceTree = "<group>"; };
+ F91BDAA708E780BF00653EAA /* Ap4HmhdAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4HmhdAtom.cpp; sourceTree = "<group>"; };
+ F91BDAA808E780BF00653EAA /* Ap4HmhdAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4HmhdAtom.h; sourceTree = "<group>"; };
+ F91BDAA908E780BF00653EAA /* Ap4IkmsAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4IkmsAtom.cpp; sourceTree = "<group>"; };
+ F91BDAAA08E780BF00653EAA /* Ap4IkmsAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4IkmsAtom.h; sourceTree = "<group>"; };
+ F91BDAAB08E780BF00653EAA /* Ap4Interfaces.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Interfaces.h; sourceTree = "<group>"; };
+ F91BDAAC08E780BF00653EAA /* Ap4IsfmAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4IsfmAtom.cpp; sourceTree = "<group>"; };
+ F91BDAAD08E780BF00653EAA /* Ap4IsfmAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4IsfmAtom.h; sourceTree = "<group>"; };
+ F91BDAAE08E780BF00653EAA /* Ap4IsmaCryp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4IsmaCryp.cpp; sourceTree = "<group>"; };
+ F91BDAAF08E780BF00653EAA /* Ap4IsmaCryp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4IsmaCryp.h; sourceTree = "<group>"; };
+ F91BDAB008E780BF00653EAA /* Ap4List.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4List.h; sourceTree = "<group>"; };
+ F91BDAB108E780BF00653EAA /* Ap4MdhdAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4MdhdAtom.cpp; sourceTree = "<group>"; };
+ F91BDAB208E780BF00653EAA /* Ap4MdhdAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4MdhdAtom.h; sourceTree = "<group>"; };
+ F91BDAB308E780BF00653EAA /* Ap4MoovAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4MoovAtom.cpp; sourceTree = "<group>"; };
+ F91BDAB408E780BF00653EAA /* Ap4MoovAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4MoovAtom.h; sourceTree = "<group>"; };
+ F91BDAB508E780BF00653EAA /* Ap4Movie.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4Movie.cpp; sourceTree = "<group>"; };
+ F91BDAB608E780BF00653EAA /* Ap4Movie.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Movie.h; sourceTree = "<group>"; };
+ F91BDAB708E780BF00653EAA /* Ap4MvhdAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4MvhdAtom.cpp; sourceTree = "<group>"; };
+ F91BDAB808E780BF00653EAA /* Ap4MvhdAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4MvhdAtom.h; sourceTree = "<group>"; };
+ F91BDAB908E780BF00653EAA /* Ap4NmhdAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4NmhdAtom.cpp; sourceTree = "<group>"; };
+ F91BDABA08E780BF00653EAA /* Ap4NmhdAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4NmhdAtom.h; sourceTree = "<group>"; };
+ F91BDABB08E780BF00653EAA /* Ap4Processor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4Processor.cpp; sourceTree = "<group>"; };
+ F91BDABC08E780BF00653EAA /* Ap4Processor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Processor.h; sourceTree = "<group>"; };
+ F91BDABD08E780BF00653EAA /* Ap4Results.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Results.h; sourceTree = "<group>"; };
+ F91BDABE08E780BF00653EAA /* Ap4RtpAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4RtpAtom.cpp; sourceTree = "<group>"; };
+ F91BDABF08E780BF00653EAA /* Ap4RtpAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4RtpAtom.h; sourceTree = "<group>"; };
+ F91BDAC008E780BF00653EAA /* Ap4RtpHint.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4RtpHint.cpp; sourceTree = "<group>"; };
+ F91BDAC108E780BF00653EAA /* Ap4RtpHint.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4RtpHint.h; sourceTree = "<group>"; };
+ F91BDAC208E780BF00653EAA /* Ap4Sample.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4Sample.cpp; sourceTree = "<group>"; };
+ F91BDAC308E780BF00653EAA /* Ap4Sample.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Sample.h; sourceTree = "<group>"; };
+ F91BDAC408E780BF00653EAA /* Ap4SampleDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4SampleDescription.cpp; sourceTree = "<group>"; };
+ F91BDAC508E780BF00653EAA /* Ap4SampleDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4SampleDescription.h; sourceTree = "<group>"; };
+ F91BDAC608E780BF00653EAA /* Ap4SampleEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4SampleEntry.cpp; sourceTree = "<group>"; };
+ F91BDAC708E780BF00653EAA /* Ap4SampleEntry.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4SampleEntry.h; sourceTree = "<group>"; };
+ F91BDAC808E780BF00653EAA /* Ap4SampleTable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4SampleTable.cpp; sourceTree = "<group>"; };
+ F91BDAC908E780BF00653EAA /* Ap4SampleTable.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4SampleTable.h; sourceTree = "<group>"; };
+ F91BDACA08E780BF00653EAA /* Ap4SchmAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4SchmAtom.cpp; sourceTree = "<group>"; };
+ F91BDACB08E780BF00653EAA /* Ap4SchmAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4SchmAtom.h; sourceTree = "<group>"; };
+ F91BDACC08E780BF00653EAA /* Ap4SdpAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4SdpAtom.cpp; sourceTree = "<group>"; };
+ F91BDACD08E780BF00653EAA /* Ap4SdpAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4SdpAtom.h; sourceTree = "<group>"; };
+ F91BDACE08E780BF00653EAA /* Ap4SLConfigDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4SLConfigDescriptor.cpp; sourceTree = "<group>"; };
+ F91BDACF08E780BF00653EAA /* Ap4SLConfigDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4SLConfigDescriptor.h; sourceTree = "<group>"; };
+ F91BDAD008E780BF00653EAA /* Ap4SmhdAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4SmhdAtom.cpp; sourceTree = "<group>"; };
+ F91BDAD108E780BF00653EAA /* Ap4SmhdAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4SmhdAtom.h; sourceTree = "<group>"; };
+ F91BDAD208E780BF00653EAA /* Ap4StcoAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4StcoAtom.cpp; sourceTree = "<group>"; };
+ F91BDAD308E780BF00653EAA /* Ap4StcoAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4StcoAtom.h; sourceTree = "<group>"; };
+ F91BDAD408E780BF00653EAA /* Ap4StscAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4StscAtom.cpp; sourceTree = "<group>"; };
+ F91BDAD508E780BF00653EAA /* Ap4StscAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4StscAtom.h; sourceTree = "<group>"; };
+ F91BDAD608E780BF00653EAA /* Ap4StsdAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4StsdAtom.cpp; sourceTree = "<group>"; };
+ F91BDAD708E780BF00653EAA /* Ap4StsdAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4StsdAtom.h; sourceTree = "<group>"; };
+ F91BDAD808E780BF00653EAA /* Ap4StssAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4StssAtom.cpp; sourceTree = "<group>"; };
+ F91BDAD908E780BF00653EAA /* Ap4StssAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4StssAtom.h; sourceTree = "<group>"; };
+ F91BDADA08E780BF00653EAA /* Ap4StszAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4StszAtom.cpp; sourceTree = "<group>"; };
+ F91BDADB08E780BF00653EAA /* Ap4StszAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4StszAtom.h; sourceTree = "<group>"; };
+ F91BDADC08E780BF00653EAA /* Ap4SttsAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4SttsAtom.cpp; sourceTree = "<group>"; };
+ F91BDADD08E780BF00653EAA /* Ap4SttsAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4SttsAtom.h; sourceTree = "<group>"; };
+ F91BDADE08E780BF00653EAA /* Ap4SyntheticSampleTable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4SyntheticSampleTable.cpp; sourceTree = "<group>"; };
+ F91BDADF08E780BF00653EAA /* Ap4SyntheticSampleTable.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4SyntheticSampleTable.h; sourceTree = "<group>"; };
+ F91BDAE008E780BF00653EAA /* Ap4TimsAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4TimsAtom.cpp; sourceTree = "<group>"; };
+ F91BDAE108E780BF00653EAA /* Ap4TimsAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4TimsAtom.h; sourceTree = "<group>"; };
+ F91BDAE208E780BF00653EAA /* Ap4TkhdAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4TkhdAtom.cpp; sourceTree = "<group>"; };
+ F91BDAE308E780BF00653EAA /* Ap4TkhdAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4TkhdAtom.h; sourceTree = "<group>"; };
+ F91BDAE408E780BF00653EAA /* Ap4Track.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4Track.cpp; sourceTree = "<group>"; };
+ F91BDAE508E780BF00653EAA /* Ap4Track.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Track.h; sourceTree = "<group>"; };
+ F91BDAE608E780BF00653EAA /* Ap4TrakAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4TrakAtom.cpp; sourceTree = "<group>"; };
+ F91BDAE708E780BF00653EAA /* Ap4TrakAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4TrakAtom.h; sourceTree = "<group>"; };
+ F91BDAE808E780BF00653EAA /* Ap4Types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Types.h; sourceTree = "<group>"; };
+ F91BDAE908E780BF00653EAA /* Ap4UnknownDescriptor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4UnknownDescriptor.cpp; sourceTree = "<group>"; };
+ F91BDAEA08E780BF00653EAA /* Ap4UnknownDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4UnknownDescriptor.h; sourceTree = "<group>"; };
+ F91BDAEB08E780BF00653EAA /* Ap4UrlAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4UrlAtom.cpp; sourceTree = "<group>"; };
+ F91BDAEC08E780BF00653EAA /* Ap4UrlAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4UrlAtom.h; sourceTree = "<group>"; };
+ F91BDAED08E780BF00653EAA /* Ap4Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4Utils.cpp; sourceTree = "<group>"; };
+ F91BDAEE08E780BF00653EAA /* Ap4Utils.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Utils.h; sourceTree = "<group>"; };
+ F91BDAEF08E780BF00653EAA /* Ap4VmhdAtom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4VmhdAtom.cpp; sourceTree = "<group>"; };
+ F91BDAF008E780BF00653EAA /* Ap4VmhdAtom.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4VmhdAtom.h; sourceTree = "<group>"; };
+ F91BDB7808E7889500653EAA /* Mp4Info */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Mp4Info; sourceTree = BUILT_PRODUCTS_DIR; };
+ F91BDB8508E7890000653EAA /* Mp4Tag */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Mp4Tag; sourceTree = BUILT_PRODUCTS_DIR; };
+ F98F762608C40D380048D3AE /* Ap4AdtsParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4AdtsParser.cpp; sourceTree = "<group>"; };
+ F98F762708C40D380048D3AE /* Ap4AdtsParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4AdtsParser.h; sourceTree = "<group>"; };
+ F98F762808C40D380048D3AE /* Ap4BitStream.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4BitStream.cpp; sourceTree = "<group>"; };
+ F98F762908C40D380048D3AE /* Ap4BitStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4BitStream.h; sourceTree = "<group>"; };
+ F98F762B08C40D380048D3AE /* Ap4Config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Ap4Config.h; sourceTree = "<group>"; };
+ F98F769D08C40D390048D3AE /* Ap4StdCFileByteStream.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Ap4StdCFileByteStream.cpp; sourceTree = "<group>"; };
+ F993835006038A1200FCB9EC /* Aac2Mp4 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Aac2Mp4; sourceTree = BUILT_PRODUCTS_DIR; };
+ F993836406038AAE00FCB9EC /* Mp42Aac */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Mp42Aac; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ F91BDA4408E77EE200653EAA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDA4E08E77F1800653EAA /* libAP4.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F91BDA5508E77F5100653EAA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDA5B08E77F7000653EAA /* libAP4.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F91BDA6508E77FE000653EAA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDB7408E7887100653EAA /* libAP4.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F91BDB7608E7889500653EAA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDB7C08E788AF00653EAA /* libAP4.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F91BDB8308E7890000653EAA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDB8908E7891400653EAA /* libAP4.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F9E684C10606ABC200B2B444 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F9E684C60606AC4900B2B444 /* libAP4.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F9E684C50606AC2B00B2B444 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F9E684C90606AC6200B2B444 /* libAP4.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 08FB7794FE84155DC02AAC07 /* AP4 */ = {
+ isa = PBXGroup;
+ children = (
+ F98F761908C40D380048D3AE /* Source */,
+ C6A0FF2B0290797F04C91782 /* Documentation */,
+ 1AB674ADFE9D54B511CA2CBB /* Products */,
+ );
+ name = AP4;
+ sourceTree = "<group>";
+ };
+ 1AB674ADFE9D54B511CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ D2AAC046055464E500DB518D /* libAP4.a */,
+ F993835006038A1200FCB9EC /* Aac2Mp4 */,
+ F993836406038AAE00FCB9EC /* Mp42Aac */,
+ F91BDA4608E77EE200653EAA /* Mp4Decrypt */,
+ F91BDA5708E77F5100653EAA /* Mp4Dump */,
+ F91BDA6708E77FE000653EAA /* Mp4Encrypt */,
+ F91BDB7808E7889500653EAA /* Mp4Info */,
+ F91BDB8508E7890000653EAA /* Mp4Tag */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ C6A0FF2B0290797F04C91782 /* Documentation */ = {
+ isa = PBXGroup;
+ children = (
+ );
+ name = Documentation;
+ sourceTree = "<group>";
+ };
+ F91BDA2908E77DA100653EAA /* Aac2Mp4 */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA2A08E77DA100653EAA /* Aac2Mp4.cpp */,
+ );
+ path = Aac2Mp4;
+ sourceTree = "<group>";
+ };
+ F91BDA2B08E77DA100653EAA /* Mp4Decrypt */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA2C08E77DA100653EAA /* Mp4Decrypt.cpp */,
+ );
+ path = Mp4Decrypt;
+ sourceTree = "<group>";
+ };
+ F91BDA2D08E77DA100653EAA /* Mp4Dump */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA2E08E77DA100653EAA /* Mp4Dump.cpp */,
+ );
+ path = Mp4Dump;
+ sourceTree = "<group>";
+ };
+ F91BDA2F08E77DA100653EAA /* Mp4Edit */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA3008E77DA100653EAA /* Mp4Edit.cpp */,
+ );
+ path = Mp4Edit;
+ sourceTree = "<group>";
+ };
+ F91BDA3108E77DA100653EAA /* Mp4Encrypt */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA3208E77DA100653EAA /* Mp4Encrypt.cpp */,
+ );
+ path = Mp4Encrypt;
+ sourceTree = "<group>";
+ };
+ F91BDA3308E77DA100653EAA /* Mp4Info */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA3408E77DA100653EAA /* Mp4Info.cpp */,
+ );
+ path = Mp4Info;
+ sourceTree = "<group>";
+ };
+ F91BDA3508E77DA100653EAA /* Mp4Tag */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA3608E77DA100653EAA /* Mp4Tag.cpp */,
+ );
+ path = Mp4Tag;
+ sourceTree = "<group>";
+ };
+ F91BDA3708E77DA100653EAA /* Mp42Aac */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA3808E77DA100653EAA /* Mp42Aac.cpp */,
+ );
+ path = Mp42Aac;
+ sourceTree = "<group>";
+ };
+ F98F761908C40D380048D3AE /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ F98F761A08C40D380048D3AE /* Apps */,
+ F98F762508C40D380048D3AE /* Codecs */,
+ F98F762A08C40D380048D3AE /* Config */,
+ F98F762C08C40D380048D3AE /* Core */,
+ F98F769A08C40D390048D3AE /* Crypto */,
+ F98F769B08C40D390048D3AE /* System */,
+ );
+ name = Source;
+ path = ../../../Source;
+ sourceTree = SOURCE_ROOT;
+ };
+ F98F761A08C40D380048D3AE /* Apps */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA2908E77DA100653EAA /* Aac2Mp4 */,
+ F91BDA2B08E77DA100653EAA /* Mp4Decrypt */,
+ F91BDA2D08E77DA100653EAA /* Mp4Dump */,
+ F91BDA2F08E77DA100653EAA /* Mp4Edit */,
+ F91BDA3108E77DA100653EAA /* Mp4Encrypt */,
+ F91BDA3308E77DA100653EAA /* Mp4Info */,
+ F91BDA3508E77DA100653EAA /* Mp4Tag */,
+ F91BDA3708E77DA100653EAA /* Mp42Aac */,
+ );
+ path = Apps;
+ sourceTree = "<group>";
+ };
+ F98F762508C40D380048D3AE /* Codecs */ = {
+ isa = PBXGroup;
+ children = (
+ F98F762608C40D380048D3AE /* Ap4AdtsParser.cpp */,
+ F98F762708C40D380048D3AE /* Ap4AdtsParser.h */,
+ F98F762808C40D380048D3AE /* Ap4BitStream.cpp */,
+ F98F762908C40D380048D3AE /* Ap4BitStream.h */,
+ );
+ path = Codecs;
+ sourceTree = "<group>";
+ };
+ F98F762A08C40D380048D3AE /* Config */ = {
+ isa = PBXGroup;
+ children = (
+ F98F762B08C40D380048D3AE /* Ap4Config.h */,
+ );
+ path = Config;
+ sourceTree = "<group>";
+ };
+ F98F762C08C40D380048D3AE /* Core */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA7B08E780BF00653EAA /* Ap4.h */,
+ F91BDA7C08E780BF00653EAA /* Ap4Array.h */,
+ F91BDA7D08E780BF00653EAA /* Ap4Atom.cpp */,
+ F91BDA7E08E780BF00653EAA /* Ap4Atom.h */,
+ F91BDA7F08E780BF00653EAA /* Ap4AtomFactory.cpp */,
+ F91BDA8008E780BF00653EAA /* Ap4AtomFactory.h */,
+ F91BDA8108E780BF00653EAA /* Ap4AtomSampleTable.cpp */,
+ F91BDA8208E780BF00653EAA /* Ap4AtomSampleTable.h */,
+ F91BDA8308E780BF00653EAA /* Ap4ByteStream.cpp */,
+ F91BDA8408E780BF00653EAA /* Ap4ByteStream.h */,
+ F91BDA8508E780BF00653EAA /* Ap4Constants.h */,
+ F91BDA8608E780BF00653EAA /* Ap4ContainerAtom.cpp */,
+ F91BDA8708E780BF00653EAA /* Ap4ContainerAtom.h */,
+ F91BDA8808E780BF00653EAA /* Ap4CttsAtom.cpp */,
+ F91BDA8908E780BF00653EAA /* Ap4CttsAtom.h */,
+ F91BDA8A08E780BF00653EAA /* Ap4DataBuffer.cpp */,
+ F91BDA8B08E780BF00653EAA /* Ap4DataBuffer.h */,
+ F91BDA8C08E780BF00653EAA /* Ap4Debug.cpp */,
+ F91BDA8D08E780BF00653EAA /* Ap4Debug.h */,
+ F91BDA8E08E780BF00653EAA /* Ap4DecoderConfigDescriptor.cpp */,
+ F91BDA8F08E780BF00653EAA /* Ap4DecoderConfigDescriptor.h */,
+ F91BDA9008E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.cpp */,
+ F91BDA9108E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.h */,
+ F91BDA9208E780BF00653EAA /* Ap4Descriptor.cpp */,
+ F91BDA9308E780BF00653EAA /* Ap4Descriptor.h */,
+ F91BDA9408E780BF00653EAA /* Ap4DescriptorFactory.cpp */,
+ F91BDA9508E780BF00653EAA /* Ap4DescriptorFactory.h */,
+ F91BDA9608E780BF00653EAA /* Ap4DrefAtom.cpp */,
+ F91BDA9708E780BF00653EAA /* Ap4DrefAtom.h */,
+ F91BDA9808E780BF00653EAA /* Ap4EsDescriptor.cpp */,
+ F91BDA9908E780BF00653EAA /* Ap4EsDescriptor.h */,
+ F91BDA9A08E780BF00653EAA /* Ap4EsdsAtom.cpp */,
+ F91BDA9B08E780BF00653EAA /* Ap4EsdsAtom.h */,
+ F91BDA9C08E780BF00653EAA /* Ap4File.cpp */,
+ F91BDA9D08E780BF00653EAA /* Ap4File.h */,
+ F91BDA9E08E780BF00653EAA /* Ap4FileByteStream.h */,
+ F91BDA9F08E780BF00653EAA /* Ap4FileWriter.cpp */,
+ F91BDAA008E780BF00653EAA /* Ap4FileWriter.h */,
+ F91BDAA108E780BF00653EAA /* Ap4FrmaAtom.cpp */,
+ F91BDAA208E780BF00653EAA /* Ap4FrmaAtom.h */,
+ F91BDAA308E780BF00653EAA /* Ap4FtypAtom.cpp */,
+ F91BDAA408E780BF00653EAA /* Ap4FtypAtom.h */,
+ F91BDAA508E780BF00653EAA /* Ap4HdlrAtom.cpp */,
+ F91BDAA608E780BF00653EAA /* Ap4HdlrAtom.h */,
+ F91BDAA708E780BF00653EAA /* Ap4HmhdAtom.cpp */,
+ F91BDAA808E780BF00653EAA /* Ap4HmhdAtom.h */,
+ F91BDAA908E780BF00653EAA /* Ap4IkmsAtom.cpp */,
+ F91BDAAA08E780BF00653EAA /* Ap4IkmsAtom.h */,
+ F91BDAAB08E780BF00653EAA /* Ap4Interfaces.h */,
+ F91BDAAC08E780BF00653EAA /* Ap4IsfmAtom.cpp */,
+ F91BDAAD08E780BF00653EAA /* Ap4IsfmAtom.h */,
+ F91BDAAE08E780BF00653EAA /* Ap4IsmaCryp.cpp */,
+ F91BDAAF08E780BF00653EAA /* Ap4IsmaCryp.h */,
+ F91BDAB008E780BF00653EAA /* Ap4List.h */,
+ F91BDAB108E780BF00653EAA /* Ap4MdhdAtom.cpp */,
+ F91BDAB208E780BF00653EAA /* Ap4MdhdAtom.h */,
+ F91BDAB308E780BF00653EAA /* Ap4MoovAtom.cpp */,
+ F91BDAB408E780BF00653EAA /* Ap4MoovAtom.h */,
+ F91BDAB508E780BF00653EAA /* Ap4Movie.cpp */,
+ F91BDAB608E780BF00653EAA /* Ap4Movie.h */,
+ F91BDAB708E780BF00653EAA /* Ap4MvhdAtom.cpp */,
+ F91BDAB808E780BF00653EAA /* Ap4MvhdAtom.h */,
+ F91BDAB908E780BF00653EAA /* Ap4NmhdAtom.cpp */,
+ F91BDABA08E780BF00653EAA /* Ap4NmhdAtom.h */,
+ F91BDABB08E780BF00653EAA /* Ap4Processor.cpp */,
+ F91BDABC08E780BF00653EAA /* Ap4Processor.h */,
+ F91BDABD08E780BF00653EAA /* Ap4Results.h */,
+ F91BDABE08E780BF00653EAA /* Ap4RtpAtom.cpp */,
+ F91BDABF08E780BF00653EAA /* Ap4RtpAtom.h */,
+ F91BDAC008E780BF00653EAA /* Ap4RtpHint.cpp */,
+ F91BDAC108E780BF00653EAA /* Ap4RtpHint.h */,
+ F91BDAC208E780BF00653EAA /* Ap4Sample.cpp */,
+ F91BDAC308E780BF00653EAA /* Ap4Sample.h */,
+ F91BDAC408E780BF00653EAA /* Ap4SampleDescription.cpp */,
+ F91BDAC508E780BF00653EAA /* Ap4SampleDescription.h */,
+ F91BDAC608E780BF00653EAA /* Ap4SampleEntry.cpp */,
+ F91BDAC708E780BF00653EAA /* Ap4SampleEntry.h */,
+ F91BDAC808E780BF00653EAA /* Ap4SampleTable.cpp */,
+ F91BDAC908E780BF00653EAA /* Ap4SampleTable.h */,
+ F91BDACA08E780BF00653EAA /* Ap4SchmAtom.cpp */,
+ F91BDACB08E780BF00653EAA /* Ap4SchmAtom.h */,
+ F91BDACC08E780BF00653EAA /* Ap4SdpAtom.cpp */,
+ F91BDACD08E780BF00653EAA /* Ap4SdpAtom.h */,
+ F91BDACE08E780BF00653EAA /* Ap4SLConfigDescriptor.cpp */,
+ F91BDACF08E780BF00653EAA /* Ap4SLConfigDescriptor.h */,
+ F91BDAD008E780BF00653EAA /* Ap4SmhdAtom.cpp */,
+ F91BDAD108E780BF00653EAA /* Ap4SmhdAtom.h */,
+ F91BDAD208E780BF00653EAA /* Ap4StcoAtom.cpp */,
+ F91BDAD308E780BF00653EAA /* Ap4StcoAtom.h */,
+ F91BDAD408E780BF00653EAA /* Ap4StscAtom.cpp */,
+ F91BDAD508E780BF00653EAA /* Ap4StscAtom.h */,
+ F91BDAD608E780BF00653EAA /* Ap4StsdAtom.cpp */,
+ F91BDAD708E780BF00653EAA /* Ap4StsdAtom.h */,
+ F91BDAD808E780BF00653EAA /* Ap4StssAtom.cpp */,
+ F91BDAD908E780BF00653EAA /* Ap4StssAtom.h */,
+ F91BDADA08E780BF00653EAA /* Ap4StszAtom.cpp */,
+ F91BDADB08E780BF00653EAA /* Ap4StszAtom.h */,
+ F91BDADC08E780BF00653EAA /* Ap4SttsAtom.cpp */,
+ F91BDADD08E780BF00653EAA /* Ap4SttsAtom.h */,
+ F91BDADE08E780BF00653EAA /* Ap4SyntheticSampleTable.cpp */,
+ F91BDADF08E780BF00653EAA /* Ap4SyntheticSampleTable.h */,
+ F91BDAE008E780BF00653EAA /* Ap4TimsAtom.cpp */,
+ F91BDAE108E780BF00653EAA /* Ap4TimsAtom.h */,
+ F91BDAE208E780BF00653EAA /* Ap4TkhdAtom.cpp */,
+ F91BDAE308E780BF00653EAA /* Ap4TkhdAtom.h */,
+ F91BDAE408E780BF00653EAA /* Ap4Track.cpp */,
+ F91BDAE508E780BF00653EAA /* Ap4Track.h */,
+ F91BDAE608E780BF00653EAA /* Ap4TrakAtom.cpp */,
+ F91BDAE708E780BF00653EAA /* Ap4TrakAtom.h */,
+ F91BDAE808E780BF00653EAA /* Ap4Types.h */,
+ F91BDAE908E780BF00653EAA /* Ap4UnknownDescriptor.cpp */,
+ F91BDAEA08E780BF00653EAA /* Ap4UnknownDescriptor.h */,
+ F91BDAEB08E780BF00653EAA /* Ap4UrlAtom.cpp */,
+ F91BDAEC08E780BF00653EAA /* Ap4UrlAtom.h */,
+ F91BDAED08E780BF00653EAA /* Ap4Utils.cpp */,
+ F91BDAEE08E780BF00653EAA /* Ap4Utils.h */,
+ F91BDAEF08E780BF00653EAA /* Ap4VmhdAtom.cpp */,
+ F91BDAF008E780BF00653EAA /* Ap4VmhdAtom.h */,
+ );
+ path = Core;
+ sourceTree = "<group>";
+ };
+ F98F769A08C40D390048D3AE /* Crypto */ = {
+ isa = PBXGroup;
+ children = (
+ F91BDA7008E7806400653EAA /* Ap4AesBlockCipher.cpp */,
+ F91BDA7108E7806400653EAA /* Ap4AesBlockCipher.h */,
+ F91BDA7208E7806400653EAA /* Ap4StreamCipher.cpp */,
+ F91BDA7308E7806500653EAA /* Ap4StreamCipher.h */,
+ );
+ path = Crypto;
+ sourceTree = "<group>";
+ };
+ F98F769B08C40D390048D3AE /* System */ = {
+ isa = PBXGroup;
+ children = (
+ F98F769C08C40D390048D3AE /* StdC */,
+ );
+ path = System;
+ sourceTree = "<group>";
+ };
+ F98F769C08C40D390048D3AE /* StdC */ = {
+ isa = PBXGroup;
+ children = (
+ F98F769D08C40D390048D3AE /* Ap4StdCFileByteStream.cpp */,
+ );
+ path = StdC;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ D2AAC043055464E500DB518D /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F98F76A408C40D390048D3AE /* Ap4AdtsParser.h in Headers */,
+ F98F76A608C40D390048D3AE /* Ap4BitStream.h in Headers */,
+ F98F76A708C40D390048D3AE /* Ap4Config.h in Headers */,
+ F91BDA7508E7806500653EAA /* Ap4AesBlockCipher.h in Headers */,
+ F91BDA7708E7806500653EAA /* Ap4StreamCipher.h in Headers */,
+ F91BDAF108E780BF00653EAA /* Ap4.h in Headers */,
+ F91BDAF208E780BF00653EAA /* Ap4Array.h in Headers */,
+ F91BDAF408E780BF00653EAA /* Ap4Atom.h in Headers */,
+ F91BDAF608E780BF00653EAA /* Ap4AtomFactory.h in Headers */,
+ F91BDAF808E780BF00653EAA /* Ap4AtomSampleTable.h in Headers */,
+ F91BDAFA08E780BF00653EAA /* Ap4ByteStream.h in Headers */,
+ F91BDAFB08E780BF00653EAA /* Ap4Constants.h in Headers */,
+ F91BDAFD08E780BF00653EAA /* Ap4ContainerAtom.h in Headers */,
+ F91BDAFF08E780BF00653EAA /* Ap4CttsAtom.h in Headers */,
+ F91BDB0108E780BF00653EAA /* Ap4DataBuffer.h in Headers */,
+ F91BDB0308E780BF00653EAA /* Ap4Debug.h in Headers */,
+ F91BDB0508E780BF00653EAA /* Ap4DecoderConfigDescriptor.h in Headers */,
+ F91BDB0708E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.h in Headers */,
+ F91BDB0908E780BF00653EAA /* Ap4Descriptor.h in Headers */,
+ F91BDB0B08E780BF00653EAA /* Ap4DescriptorFactory.h in Headers */,
+ F91BDB0D08E780BF00653EAA /* Ap4DrefAtom.h in Headers */,
+ F91BDB0F08E780BF00653EAA /* Ap4EsDescriptor.h in Headers */,
+ F91BDB1108E780BF00653EAA /* Ap4EsdsAtom.h in Headers */,
+ F91BDB1308E780BF00653EAA /* Ap4File.h in Headers */,
+ F91BDB1408E780BF00653EAA /* Ap4FileByteStream.h in Headers */,
+ F91BDB1608E780BF00653EAA /* Ap4FileWriter.h in Headers */,
+ F91BDB1808E780BF00653EAA /* Ap4FrmaAtom.h in Headers */,
+ F91BDB1A08E780BF00653EAA /* Ap4FtypAtom.h in Headers */,
+ F91BDB1C08E780BF00653EAA /* Ap4HdlrAtom.h in Headers */,
+ F91BDB1E08E780BF00653EAA /* Ap4HmhdAtom.h in Headers */,
+ F91BDB2008E780BF00653EAA /* Ap4IkmsAtom.h in Headers */,
+ F91BDB2108E780BF00653EAA /* Ap4Interfaces.h in Headers */,
+ F91BDB2308E780BF00653EAA /* Ap4IsfmAtom.h in Headers */,
+ F91BDB2508E780BF00653EAA /* Ap4IsmaCryp.h in Headers */,
+ F91BDB2608E780BF00653EAA /* Ap4List.h in Headers */,
+ F91BDB2808E780BF00653EAA /* Ap4MdhdAtom.h in Headers */,
+ F91BDB2A08E780BF00653EAA /* Ap4MoovAtom.h in Headers */,
+ F91BDB2C08E780BF00653EAA /* Ap4Movie.h in Headers */,
+ F91BDB2E08E780BF00653EAA /* Ap4MvhdAtom.h in Headers */,
+ F91BDB3008E780BF00653EAA /* Ap4NmhdAtom.h in Headers */,
+ F91BDB3208E780BF00653EAA /* Ap4Processor.h in Headers */,
+ F91BDB3308E780BF00653EAA /* Ap4Results.h in Headers */,
+ F91BDB3508E780BF00653EAA /* Ap4RtpAtom.h in Headers */,
+ F91BDB3708E780BF00653EAA /* Ap4RtpHint.h in Headers */,
+ F91BDB3908E780BF00653EAA /* Ap4Sample.h in Headers */,
+ F91BDB3B08E780BF00653EAA /* Ap4SampleDescription.h in Headers */,
+ F91BDB3D08E780BF00653EAA /* Ap4SampleEntry.h in Headers */,
+ F91BDB3F08E780BF00653EAA /* Ap4SampleTable.h in Headers */,
+ F91BDB4108E780BF00653EAA /* Ap4SchmAtom.h in Headers */,
+ F91BDB4308E780BF00653EAA /* Ap4SdpAtom.h in Headers */,
+ F91BDB4508E780BF00653EAA /* Ap4SLConfigDescriptor.h in Headers */,
+ F91BDB4708E780BF00653EAA /* Ap4SmhdAtom.h in Headers */,
+ F91BDB4908E780BF00653EAA /* Ap4StcoAtom.h in Headers */,
+ F91BDB4B08E780BF00653EAA /* Ap4StscAtom.h in Headers */,
+ F91BDB4D08E780BF00653EAA /* Ap4StsdAtom.h in Headers */,
+ F91BDB4F08E780BF00653EAA /* Ap4StssAtom.h in Headers */,
+ F91BDB5108E780BF00653EAA /* Ap4StszAtom.h in Headers */,
+ F91BDB5308E780BF00653EAA /* Ap4SttsAtom.h in Headers */,
+ F91BDB5508E780BF00653EAA /* Ap4SyntheticSampleTable.h in Headers */,
+ F91BDB5708E780BF00653EAA /* Ap4TimsAtom.h in Headers */,
+ F91BDB5908E780BF00653EAA /* Ap4TkhdAtom.h in Headers */,
+ F91BDB5B08E780BF00653EAA /* Ap4Track.h in Headers */,
+ F91BDB5D08E780BF00653EAA /* Ap4TrakAtom.h in Headers */,
+ F91BDB5E08E780BF00653EAA /* Ap4Types.h in Headers */,
+ F91BDB6008E780BF00653EAA /* Ap4UnknownDescriptor.h in Headers */,
+ F91BDB6208E780BF00653EAA /* Ap4UrlAtom.h in Headers */,
+ F91BDB6408E780BF00653EAA /* Ap4Utils.h in Headers */,
+ F91BDB6608E780BF00653EAA /* Ap4VmhdAtom.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F993834D06038A1200FCB9EC /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F993836106038AAE00FCB9EC /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ D2AAC045055464E500DB518D /* AP4 */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F98F75FB08C40CF20048D3AE /* Build configuration list for PBXNativeTarget "AP4" */;
+ buildPhases = (
+ D2AAC043055464E500DB518D /* Headers */,
+ D2AAC044055464E500DB518D /* Sources */,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/lib;
+ LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = AP4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ };
+ dependencies = (
+ );
+ name = AP4;
+ productName = AP4;
+ productReference = D2AAC046055464E500DB518D /* libAP4.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+ F91BDA4508E77EE200653EAA /* Mp4Decrypt */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F91BDA4A08E77F1000653EAA /* Build configuration list for PBXNativeTarget "Mp4Decrypt" */;
+ buildPhases = (
+ F91BDA4308E77EE200653EAA /* Sources */,
+ F91BDA4408E77EE200653EAA /* Frameworks */,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Decrypt;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ dependencies = (
+ F91BDA4908E77EF100653EAA /* PBXTargetDependency */,
+ );
+ name = Mp4Decrypt;
+ productName = Mp4Decrypt;
+ productReference = F91BDA4608E77EE200653EAA /* Mp4Decrypt */;
+ productType = "com.apple.product-type.tool";
+ };
+ F91BDA5608E77F5100653EAA /* Mp4Dump */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F91BDA5C08E77F8E00653EAA /* Build configuration list for PBXNativeTarget "Mp4Dump" */;
+ buildPhases = (
+ F91BDA5408E77F5100653EAA /* Sources */,
+ F91BDA5508E77F5100653EAA /* Frameworks */,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Dump;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ dependencies = (
+ F91BDA5A08E77F5900653EAA /* PBXTargetDependency */,
+ );
+ name = Mp4Dump;
+ productName = Mp4Dump;
+ productReference = F91BDA5708E77F5100653EAA /* Mp4Dump */;
+ productType = "com.apple.product-type.tool";
+ };
+ F91BDA6608E77FE000653EAA /* Mp4Encrypt */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F91BDA6B08E7800B00653EAA /* Build configuration list for PBXNativeTarget "Mp4Encrypt" */;
+ buildPhases = (
+ F91BDA6408E77FE000653EAA /* Sources */,
+ F91BDA6508E77FE000653EAA /* Frameworks */,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Encrypt;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ dependencies = (
+ F91BDA6A08E77FEC00653EAA /* PBXTargetDependency */,
+ );
+ name = Mp4Encrypt;
+ productName = Mp4Encrypt;
+ productReference = F91BDA6708E77FE000653EAA /* Mp4Encrypt */;
+ productType = "com.apple.product-type.tool";
+ };
+ F91BDB7708E7889500653EAA /* Mp4Info */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F91BDB7D08E788CD00653EAA /* Build configuration list for PBXNativeTarget "Mp4Info" */;
+ buildPhases = (
+ F91BDB7508E7889500653EAA /* Sources */,
+ F91BDB7608E7889500653EAA /* Frameworks */,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Info;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ dependencies = (
+ F91BDB7B08E7889F00653EAA /* PBXTargetDependency */,
+ );
+ name = Mp4Info;
+ productName = Mp4Info;
+ productReference = F91BDB7808E7889500653EAA /* Mp4Info */;
+ productType = "com.apple.product-type.tool";
+ };
+ F91BDB8408E7890000653EAA /* Mp4Tag */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F91BDB8B08E7894200653EAA /* Build configuration list for PBXNativeTarget "Mp4Tag" */;
+ buildPhases = (
+ F91BDB8208E7890000653EAA /* Sources */,
+ F91BDB8308E7890000653EAA /* Frameworks */,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Tag;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ dependencies = (
+ F91BDB8808E7890800653EAA /* PBXTargetDependency */,
+ );
+ name = Mp4Tag;
+ productName = Mp4Tag;
+ productReference = F91BDB8508E7890000653EAA /* Mp4Tag */;
+ productType = "com.apple.product-type.tool";
+ };
+ F993834F06038A1200FCB9EC /* Aac2Mp4 */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F98F75FF08C40CF20048D3AE /* Build configuration list for PBXNativeTarget "Aac2Mp4" */;
+ buildPhases = (
+ F993834D06038A1200FCB9EC /* Headers */,
+ F993834E06038A1200FCB9EC /* Sources */,
+ F9E684C10606ABC200B2B444 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/bin;
+ LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = Aac2Mp4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ };
+ dependencies = (
+ F993836906038E5C00FCB9EC /* PBXTargetDependency */,
+ );
+ name = Aac2Mp4;
+ productName = Aac2Mp4;
+ productReference = F993835006038A1200FCB9EC /* Aac2Mp4 */;
+ productType = "com.apple.product-type.tool";
+ };
+ F993836306038AAE00FCB9EC /* Mp42Aac */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F98F760F08C40CF20048D3AE /* Build configuration list for PBXNativeTarget "Mp42Aac" */;
+ buildPhases = (
+ F993836106038AAE00FCB9EC /* Headers */,
+ F993836206038AAE00FCB9EC /* Sources */,
+ F9E684C50606AC2B00B2B444 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ buildSettings = {
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/bin;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = Mp42Aac;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ };
+ dependencies = (
+ F993837106038E9A00FCB9EC /* PBXTargetDependency */,
+ );
+ name = Mp42Aac;
+ productName = Mp42Aac;
+ productReference = F993836406038AAE00FCB9EC /* Mp42Aac */;
+ productType = "com.apple.product-type.tool";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 08FB7793FE84155DC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = F98F761308C40CF20048D3AE /* Build configuration list for PBXProject "AP4" */;
+ buildSettings = {
+ };
+ buildStyles = (
+ 014CEA520018CE5811CA2923 /* Development */,
+ 014CEA530018CE5811CA2923 /* Deployment */,
+ );
+ hasScannedForEncodings = 1;
+ mainGroup = 08FB7794FE84155DC02AAC07 /* AP4 */;
+ projectDirPath = "";
+ targets = (
+ F993834F06038A1200FCB9EC /* Aac2Mp4 */,
+ D2AAC045055464E500DB518D /* AP4 */,
+ F993836306038AAE00FCB9EC /* Mp42Aac */,
+ F91BDA4508E77EE200653EAA /* Mp4Decrypt */,
+ F91BDA5608E77F5100653EAA /* Mp4Dump */,
+ F91BDA6608E77FE000653EAA /* Mp4Encrypt */,
+ F91BDB7708E7889500653EAA /* Mp4Info */,
+ F91BDB8408E7890000653EAA /* Mp4Tag */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ D2AAC044055464E500DB518D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F98F76A308C40D390048D3AE /* Ap4AdtsParser.cpp in Sources */,
+ F98F76A508C40D390048D3AE /* Ap4BitStream.cpp in Sources */,
+ F98F771508C40D390048D3AE /* Ap4StdCFileByteStream.cpp in Sources */,
+ F91BDA7408E7806500653EAA /* Ap4AesBlockCipher.cpp in Sources */,
+ F91BDA7608E7806500653EAA /* Ap4StreamCipher.cpp in Sources */,
+ F91BDAF308E780BF00653EAA /* Ap4Atom.cpp in Sources */,
+ F91BDAF508E780BF00653EAA /* Ap4AtomFactory.cpp in Sources */,
+ F91BDAF708E780BF00653EAA /* Ap4AtomSampleTable.cpp in Sources */,
+ F91BDAF908E780BF00653EAA /* Ap4ByteStream.cpp in Sources */,
+ F91BDAFC08E780BF00653EAA /* Ap4ContainerAtom.cpp in Sources */,
+ F91BDAFE08E780BF00653EAA /* Ap4CttsAtom.cpp in Sources */,
+ F91BDB0008E780BF00653EAA /* Ap4DataBuffer.cpp in Sources */,
+ F91BDB0208E780BF00653EAA /* Ap4Debug.cpp in Sources */,
+ F91BDB0408E780BF00653EAA /* Ap4DecoderConfigDescriptor.cpp in Sources */,
+ F91BDB0608E780BF00653EAA /* Ap4DecoderSpecificInfoDescriptor.cpp in Sources */,
+ F91BDB0808E780BF00653EAA /* Ap4Descriptor.cpp in Sources */,
+ F91BDB0A08E780BF00653EAA /* Ap4DescriptorFactory.cpp in Sources */,
+ F91BDB0C08E780BF00653EAA /* Ap4DrefAtom.cpp in Sources */,
+ F91BDB0E08E780BF00653EAA /* Ap4EsDescriptor.cpp in Sources */,
+ F91BDB1008E780BF00653EAA /* Ap4EsdsAtom.cpp in Sources */,
+ F91BDB1208E780BF00653EAA /* Ap4File.cpp in Sources */,
+ F91BDB1508E780BF00653EAA /* Ap4FileWriter.cpp in Sources */,
+ F91BDB1708E780BF00653EAA /* Ap4FrmaAtom.cpp in Sources */,
+ F91BDB1908E780BF00653EAA /* Ap4FtypAtom.cpp in Sources */,
+ F91BDB1B08E780BF00653EAA /* Ap4HdlrAtom.cpp in Sources */,
+ F91BDB1D08E780BF00653EAA /* Ap4HmhdAtom.cpp in Sources */,
+ F91BDB1F08E780BF00653EAA /* Ap4IkmsAtom.cpp in Sources */,
+ F91BDB2208E780BF00653EAA /* Ap4IsfmAtom.cpp in Sources */,
+ F91BDB2408E780BF00653EAA /* Ap4IsmaCryp.cpp in Sources */,
+ F91BDB2708E780BF00653EAA /* Ap4MdhdAtom.cpp in Sources */,
+ F91BDB2908E780BF00653EAA /* Ap4MoovAtom.cpp in Sources */,
+ F91BDB2B08E780BF00653EAA /* Ap4Movie.cpp in Sources */,
+ F91BDB2D08E780BF00653EAA /* Ap4MvhdAtom.cpp in Sources */,
+ F91BDB2F08E780BF00653EAA /* Ap4NmhdAtom.cpp in Sources */,
+ F91BDB3108E780BF00653EAA /* Ap4Processor.cpp in Sources */,
+ F91BDB3408E780BF00653EAA /* Ap4RtpAtom.cpp in Sources */,
+ F91BDB3608E780BF00653EAA /* Ap4RtpHint.cpp in Sources */,
+ F91BDB3808E780BF00653EAA /* Ap4Sample.cpp in Sources */,
+ F91BDB3A08E780BF00653EAA /* Ap4SampleDescription.cpp in Sources */,
+ F91BDB3C08E780BF00653EAA /* Ap4SampleEntry.cpp in Sources */,
+ F91BDB3E08E780BF00653EAA /* Ap4SampleTable.cpp in Sources */,
+ F91BDB4008E780BF00653EAA /* Ap4SchmAtom.cpp in Sources */,
+ F91BDB4208E780BF00653EAA /* Ap4SdpAtom.cpp in Sources */,
+ F91BDB4408E780BF00653EAA /* Ap4SLConfigDescriptor.cpp in Sources */,
+ F91BDB4608E780BF00653EAA /* Ap4SmhdAtom.cpp in Sources */,
+ F91BDB4808E780BF00653EAA /* Ap4StcoAtom.cpp in Sources */,
+ F91BDB4A08E780BF00653EAA /* Ap4StscAtom.cpp in Sources */,
+ F91BDB4C08E780BF00653EAA /* Ap4StsdAtom.cpp in Sources */,
+ F91BDB4E08E780BF00653EAA /* Ap4StssAtom.cpp in Sources */,
+ F91BDB5008E780BF00653EAA /* Ap4StszAtom.cpp in Sources */,
+ F91BDB5208E780BF00653EAA /* Ap4SttsAtom.cpp in Sources */,
+ F91BDB5408E780BF00653EAA /* Ap4SyntheticSampleTable.cpp in Sources */,
+ F91BDB5608E780BF00653EAA /* Ap4TimsAtom.cpp in Sources */,
+ F91BDB5808E780BF00653EAA /* Ap4TkhdAtom.cpp in Sources */,
+ F91BDB5A08E780BF00653EAA /* Ap4Track.cpp in Sources */,
+ F91BDB5C08E780BF00653EAA /* Ap4TrakAtom.cpp in Sources */,
+ F91BDB5F08E780BF00653EAA /* Ap4UnknownDescriptor.cpp in Sources */,
+ F91BDB6108E780BF00653EAA /* Ap4UrlAtom.cpp in Sources */,
+ F91BDB6308E780BF00653EAA /* Ap4Utils.cpp in Sources */,
+ F91BDB6508E780BF00653EAA /* Ap4VmhdAtom.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F91BDA4308E77EE200653EAA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDA5308E77F3600653EAA /* Mp4Decrypt.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F91BDA5408E77F5100653EAA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDA6008E77F9500653EAA /* Mp4Dump.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F91BDA6408E77FE000653EAA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDA6F08E7800E00653EAA /* Mp4Encrypt.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F91BDB7508E7889500653EAA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDB8108E788D200653EAA /* Mp4Info.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F91BDB8208E7890000653EAA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDB8A08E7892A00653EAA /* Mp4Tag.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F993834E06038A1200FCB9EC /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDA4108E77E3F00653EAA /* Aac2Mp4.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F993836206038AAE00FCB9EC /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ F91BDA4208E77E5100653EAA /* Mp42Aac.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ F91BDA4908E77EF100653EAA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D /* AP4 */;
+ targetProxy = F91BDA4808E77EF100653EAA /* PBXContainerItemProxy */;
+ };
+ F91BDA5A08E77F5900653EAA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D /* AP4 */;
+ targetProxy = F91BDA5908E77F5900653EAA /* PBXContainerItemProxy */;
+ };
+ F91BDA6A08E77FEC00653EAA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D /* AP4 */;
+ targetProxy = F91BDA6908E77FEC00653EAA /* PBXContainerItemProxy */;
+ };
+ F91BDB7B08E7889F00653EAA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D /* AP4 */;
+ targetProxy = F91BDB7A08E7889F00653EAA /* PBXContainerItemProxy */;
+ };
+ F91BDB8808E7890800653EAA /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D /* AP4 */;
+ targetProxy = F91BDB8708E7890800653EAA /* PBXContainerItemProxy */;
+ };
+ F993836906038E5C00FCB9EC /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D /* AP4 */;
+ targetProxy = F993836806038E5C00FCB9EC /* PBXContainerItemProxy */;
+ };
+ F993837106038E9A00FCB9EC /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = D2AAC045055464E500DB518D /* AP4 */;
+ targetProxy = F993837006038E9A00FCB9EC /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ F91BDA4B08E77F1000653EAA /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Decrypt;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Development;
+ };
+ F91BDA4C08E77F1000653EAA /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Decrypt;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Deployment;
+ };
+ F91BDA4D08E77F1000653EAA /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Decrypt;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Default;
+ };
+ F91BDA5D08E77F8E00653EAA /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Dump;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Development;
+ };
+ F91BDA5E08E77F8E00653EAA /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Dump;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Deployment;
+ };
+ F91BDA5F08E77F8E00653EAA /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Dump;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Default;
+ };
+ F91BDA6C08E7800B00653EAA /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Encrypt;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Development;
+ };
+ F91BDA6D08E7800B00653EAA /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Encrypt;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Deployment;
+ };
+ F91BDA6E08E7800B00653EAA /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Encrypt;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Default;
+ };
+ F91BDB7E08E788CD00653EAA /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Info;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Development;
+ };
+ F91BDB7F08E788CD00653EAA /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Info;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Deployment;
+ };
+ F91BDB8008E788CD00653EAA /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Info;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Default;
+ };
+ F91BDB8C08E7894200653EAA /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Tag;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Development;
+ };
+ F91BDB8D08E7894200653EAA /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Tag;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Deployment;
+ };
+ F91BDB8E08E7894200653EAA /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = "$(HOME)/bin";
+ OPTIMIZATION_CFLAGS = "";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PREBINDING = NO;
+ PRODUCT_NAME = Mp4Tag;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = (
+ "-Wmost",
+ "-Wno-four-char-constants",
+ "-Wno-unknown-pragmas",
+ );
+ };
+ name = Default;
+ };
+ F98F75FC08C40CF20048D3AE /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ DEBUGGING_SYMBOLS = YES;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/lib;
+ LIBRARY_STYLE = STATIC;
+ OPTIMIZATION_CFLAGS = "-O0";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = AP4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ ZERO_LINK = YES;
+ };
+ name = Development;
+ };
+ F98F75FD08C40CF20048D3AE /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/lib;
+ LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = AP4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ ZERO_LINK = NO;
+ };
+ name = Deployment;
+ };
+ F98F75FE08C40CF20048D3AE /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/lib;
+ LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = AP4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ };
+ name = Default;
+ };
+ F98F760008C40CF20048D3AE /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ DEBUGGING_SYMBOLS = YES;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/bin;
+ LIBRARY_STYLE = STATIC;
+ OPTIMIZATION_CFLAGS = "-O0";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = Aac2Mp4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ ZERO_LINK = YES;
+ };
+ name = Development;
+ };
+ F98F760108C40CF20048D3AE /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/bin;
+ LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = Aac2Mp4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ ZERO_LINK = NO;
+ };
+ name = Deployment;
+ };
+ F98F760208C40CF20048D3AE /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/bin;
+ LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = Aac2Mp4;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ };
+ name = Default;
+ };
+ F98F761008C40CF20048D3AE /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ DEBUGGING_SYMBOLS = YES;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/bin;
+ OPTIMIZATION_CFLAGS = "-O0";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = Mp42Aac;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ ZERO_LINK = YES;
+ };
+ name = Development;
+ };
+ F98F761108C40CF20048D3AE /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = YES;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/bin;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = Mp42Aac;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ ZERO_LINK = NO;
+ };
+ name = Deployment;
+ };
+ F98F761208C40CF20048D3AE /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO;
+ GCC_WARN_UNKNOWN_PRAGMAS = NO;
+ INSTALL_PATH = /usr/local/bin;
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ OTHER_REZFLAGS = "";
+ PRODUCT_NAME = Mp42Aac;
+ SECTORDER_FLAGS = "";
+ WARNING_CFLAGS = "-Wmost";
+ };
+ name = Default;
+ };
+ F98F761408C40CF20048D3AE /* Development */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ };
+ name = Development;
+ };
+ F98F761508C40CF20048D3AE /* Deployment */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ };
+ name = Deployment;
+ };
+ F98F761608C40CF20048D3AE /* Default */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ };
+ name = Default;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ F91BDA4A08E77F1000653EAA /* Build configuration list for PBXNativeTarget "Mp4Decrypt" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F91BDA4B08E77F1000653EAA /* Development */,
+ F91BDA4C08E77F1000653EAA /* Deployment */,
+ F91BDA4D08E77F1000653EAA /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+ F91BDA5C08E77F8E00653EAA /* Build configuration list for PBXNativeTarget "Mp4Dump" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F91BDA5D08E77F8E00653EAA /* Development */,
+ F91BDA5E08E77F8E00653EAA /* Deployment */,
+ F91BDA5F08E77F8E00653EAA /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+ F91BDA6B08E7800B00653EAA /* Build configuration list for PBXNativeTarget "Mp4Encrypt" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F91BDA6C08E7800B00653EAA /* Development */,
+ F91BDA6D08E7800B00653EAA /* Deployment */,
+ F91BDA6E08E7800B00653EAA /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+ F91BDB7D08E788CD00653EAA /* Build configuration list for PBXNativeTarget "Mp4Info" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F91BDB7E08E788CD00653EAA /* Development */,
+ F91BDB7F08E788CD00653EAA /* Deployment */,
+ F91BDB8008E788CD00653EAA /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+ F91BDB8B08E7894200653EAA /* Build configuration list for PBXNativeTarget "Mp4Tag" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F91BDB8C08E7894200653EAA /* Development */,
+ F91BDB8D08E7894200653EAA /* Deployment */,
+ F91BDB8E08E7894200653EAA /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+ F98F75FB08C40CF20048D3AE /* Build configuration list for PBXNativeTarget "AP4" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F98F75FC08C40CF20048D3AE /* Development */,
+ F98F75FD08C40CF20048D3AE /* Deployment */,
+ F98F75FE08C40CF20048D3AE /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+ F98F75FF08C40CF20048D3AE /* Build configuration list for PBXNativeTarget "Aac2Mp4" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F98F760008C40CF20048D3AE /* Development */,
+ F98F760108C40CF20048D3AE /* Deployment */,
+ F98F760208C40CF20048D3AE /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+ F98F760F08C40CF20048D3AE /* Build configuration list for PBXNativeTarget "Mp42Aac" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F98F761008C40CF20048D3AE /* Development */,
+ F98F761108C40CF20048D3AE /* Deployment */,
+ F98F761208C40CF20048D3AE /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+ F98F761308C40CF20048D3AE /* Build configuration list for PBXProject "AP4" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F98F761408C40CF20048D3AE /* Development */,
+ F98F761508C40CF20048D3AE /* Deployment */,
+ F98F761608C40CF20048D3AE /* Default */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Default;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4.sln b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4.sln
new file mode 100644
index 000000000..cac41e643
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4.sln
@@ -0,0 +1,196 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core.vcproj", "{20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "System", "System\System.vcproj", "{ED568A42-C87E-47F1-AE87-E0C13FF90F74}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp42Aac", "Mp42Aac\Mp42Aac.vcproj", "{1EA74D37-A069-425F-9E9C-F7F83B1FACBB}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Tag", "Mp4Tag\Mp4Tag.vcproj", "{73804182-47BC-4885-898D-939CA8672828}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Aac2Mp4", "Aac2Mp4\Aac2Mp4.vcproj", "{2FCE14C9-42A9-4335-96EF-8B52A321720E}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F90FCD13-0472-46B5-8C8F-0E45BE6E287B} = {F90FCD13-0472-46B5-8C8F-0E45BE6E287B}
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Dump", "Mp4Dump\Mp4Dump.vcproj", "{602F1304-0BE4-4C48-983E-9A4F84BD1585}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Info", "Mp4Info\Mp4Info.vcproj", "{52A6B013-A542-4F5C-838E-F582CC6EF903}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Codecs", "Codecs\Codecs.vcproj", "{F90FCD13-0472-46B5-8C8F-0E45BE6E287B}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Crypto", "Crypto\Crypto.vcproj", "{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Decrypt", "Mp4Decrypt\Mp4Decrypt.vcproj", "{C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Encrypt", "Mp4Encrypt\Mp4Encrypt.vcproj", "{D467C78F-53CD-4AE8-82D4-BAE42530262B}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Edit", "Mp4Edit\Mp4Edit.vcproj", "{1B0690B7-BD89-4F6E-9C4A-A76682898963}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AP4", "AP4\AP4.vcproj", "{A714AA1C-45A9-403D-A6E1-020E520119A2}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F90FCD13-0472-46B5-8C8F-0E45BE6E287B} = {F90FCD13-0472-46B5-8C8F-0E45BE6E287B}
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4Extract", "Mp4Extract\Mp4Extract.vcproj", "{F0B2195A-2027-4FA1-8CE9-F5600764CB4E}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2} = {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74} = {ED568A42-C87E-47F1-AE87-E0C13FF90F74}
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2} = {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mp4RtpHintInfo", "Mp4RtpHintInfo\Mp4RtpHintInfo.vcproj", "{D100E130-718D-4060-ACD9-1061A159DD79}"
+ ProjectSection(ProjectDependencies) = postProject
+ {A714AA1C-45A9-403D-A6E1-020E520119A2} = {A714AA1C-45A9-403D-A6E1-020E520119A2}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ ST = ST
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.Debug.ActiveCfg = Debug|Win32
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.Debug.Build.0 = Debug|Win32
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.Release.ActiveCfg = Release|Win32
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.Release.Build.0 = Release|Win32
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.ST.ActiveCfg = Release|Win32
+ {20CC19A5-73A7-44B3-B3D1-D956CDC66CE2}.ST.Build.0 = Release|Win32
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74}.Debug.ActiveCfg = Debug|Win32
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74}.Debug.Build.0 = Debug|Win32
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74}.Release.ActiveCfg = Release|Win32
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74}.Release.Build.0 = Release|Win32
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74}.ST.ActiveCfg = Release|Win32
+ {ED568A42-C87E-47F1-AE87-E0C13FF90F74}.ST.Build.0 = Release|Win32
+ {1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.Debug.ActiveCfg = Debug|Win32
+ {1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.Debug.Build.0 = Debug|Win32
+ {1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.Release.ActiveCfg = Release|Win32
+ {1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.Release.Build.0 = Release|Win32
+ {1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.ST.ActiveCfg = Release|Win32
+ {1EA74D37-A069-425F-9E9C-F7F83B1FACBB}.ST.Build.0 = Release|Win32
+ {73804182-47BC-4885-898D-939CA8672828}.Debug.ActiveCfg = Debug|Win32
+ {73804182-47BC-4885-898D-939CA8672828}.Debug.Build.0 = Debug|Win32
+ {73804182-47BC-4885-898D-939CA8672828}.Release.ActiveCfg = Release|Win32
+ {73804182-47BC-4885-898D-939CA8672828}.Release.Build.0 = Release|Win32
+ {73804182-47BC-4885-898D-939CA8672828}.ST.ActiveCfg = Release|Win32
+ {73804182-47BC-4885-898D-939CA8672828}.ST.Build.0 = Release|Win32
+ {2FCE14C9-42A9-4335-96EF-8B52A321720E}.Debug.ActiveCfg = Debug|Win32
+ {2FCE14C9-42A9-4335-96EF-8B52A321720E}.Debug.Build.0 = Debug|Win32
+ {2FCE14C9-42A9-4335-96EF-8B52A321720E}.Release.ActiveCfg = Release|Win32
+ {2FCE14C9-42A9-4335-96EF-8B52A321720E}.Release.Build.0 = Release|Win32
+ {2FCE14C9-42A9-4335-96EF-8B52A321720E}.ST.ActiveCfg = Release|Win32
+ {2FCE14C9-42A9-4335-96EF-8B52A321720E}.ST.Build.0 = Release|Win32
+ {602F1304-0BE4-4C48-983E-9A4F84BD1585}.Debug.ActiveCfg = Debug|Win32
+ {602F1304-0BE4-4C48-983E-9A4F84BD1585}.Debug.Build.0 = Debug|Win32
+ {602F1304-0BE4-4C48-983E-9A4F84BD1585}.Release.ActiveCfg = Release|Win32
+ {602F1304-0BE4-4C48-983E-9A4F84BD1585}.Release.Build.0 = Release|Win32
+ {602F1304-0BE4-4C48-983E-9A4F84BD1585}.ST.ActiveCfg = Release|Win32
+ {602F1304-0BE4-4C48-983E-9A4F84BD1585}.ST.Build.0 = Release|Win32
+ {52A6B013-A542-4F5C-838E-F582CC6EF903}.Debug.ActiveCfg = Debug|Win32
+ {52A6B013-A542-4F5C-838E-F582CC6EF903}.Debug.Build.0 = Debug|Win32
+ {52A6B013-A542-4F5C-838E-F582CC6EF903}.Release.ActiveCfg = Release|Win32
+ {52A6B013-A542-4F5C-838E-F582CC6EF903}.Release.Build.0 = Release|Win32
+ {52A6B013-A542-4F5C-838E-F582CC6EF903}.ST.ActiveCfg = Release|Win32
+ {52A6B013-A542-4F5C-838E-F582CC6EF903}.ST.Build.0 = Release|Win32
+ {F90FCD13-0472-46B5-8C8F-0E45BE6E287B}.Debug.ActiveCfg = Debug|Win32
+ {F90FCD13-0472-46B5-8C8F-0E45BE6E287B}.Debug.Build.0 = Debug|Win32
+ {F90FCD13-0472-46B5-8C8F-0E45BE6E287B}.Release.ActiveCfg = Release|Win32
+ {F90FCD13-0472-46B5-8C8F-0E45BE6E287B}.Release.Build.0 = Release|Win32
+ {F90FCD13-0472-46B5-8C8F-0E45BE6E287B}.ST.ActiveCfg = Release|Win32
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.Debug.ActiveCfg = Debug|Win32
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.Debug.Build.0 = Debug|Win32
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.Release.ActiveCfg = Release|Win32
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.Release.Build.0 = Release|Win32
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.ST.ActiveCfg = Release|Win32
+ {1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}.ST.Build.0 = Release|Win32
+ {C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.Debug.ActiveCfg = Debug|Win32
+ {C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.Debug.Build.0 = Debug|Win32
+ {C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.Release.ActiveCfg = Release|Win32
+ {C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.Release.Build.0 = Release|Win32
+ {C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.ST.ActiveCfg = Release|Win32
+ {C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}.ST.Build.0 = Release|Win32
+ {D467C78F-53CD-4AE8-82D4-BAE42530262B}.Debug.ActiveCfg = Debug|Win32
+ {D467C78F-53CD-4AE8-82D4-BAE42530262B}.Debug.Build.0 = Debug|Win32
+ {D467C78F-53CD-4AE8-82D4-BAE42530262B}.Release.ActiveCfg = Release|Win32
+ {D467C78F-53CD-4AE8-82D4-BAE42530262B}.Release.Build.0 = Release|Win32
+ {D467C78F-53CD-4AE8-82D4-BAE42530262B}.ST.ActiveCfg = Release|Win32
+ {D467C78F-53CD-4AE8-82D4-BAE42530262B}.ST.Build.0 = Release|Win32
+ {1B0690B7-BD89-4F6E-9C4A-A76682898963}.Debug.ActiveCfg = Debug|Win32
+ {1B0690B7-BD89-4F6E-9C4A-A76682898963}.Debug.Build.0 = Debug|Win32
+ {1B0690B7-BD89-4F6E-9C4A-A76682898963}.Release.ActiveCfg = Release|Win32
+ {1B0690B7-BD89-4F6E-9C4A-A76682898963}.Release.Build.0 = Release|Win32
+ {1B0690B7-BD89-4F6E-9C4A-A76682898963}.ST.ActiveCfg = Release|Win32
+ {1B0690B7-BD89-4F6E-9C4A-A76682898963}.ST.Build.0 = Release|Win32
+ {A714AA1C-45A9-403D-A6E1-020E520119A2}.Debug.ActiveCfg = Debug|Win32
+ {A714AA1C-45A9-403D-A6E1-020E520119A2}.Debug.Build.0 = Debug|Win32
+ {A714AA1C-45A9-403D-A6E1-020E520119A2}.Release.ActiveCfg = Release|Win32
+ {A714AA1C-45A9-403D-A6E1-020E520119A2}.Release.Build.0 = Release|Win32
+ {A714AA1C-45A9-403D-A6E1-020E520119A2}.ST.ActiveCfg = Release|Win32
+ {A714AA1C-45A9-403D-A6E1-020E520119A2}.ST.Build.0 = Release|Win32
+ {F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.Debug.ActiveCfg = Debug|Win32
+ {F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.Debug.Build.0 = Debug|Win32
+ {F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.Release.ActiveCfg = Release|Win32
+ {F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.Release.Build.0 = Release|Win32
+ {F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.ST.ActiveCfg = Release|Win32
+ {F0B2195A-2027-4FA1-8CE9-F5600764CB4E}.ST.Build.0 = Release|Win32
+ {D100E130-718D-4060-ACD9-1061A159DD79}.Debug.ActiveCfg = Debug|Win32
+ {D100E130-718D-4060-ACD9-1061A159DD79}.Debug.Build.0 = Debug|Win32
+ {D100E130-718D-4060-ACD9-1061A159DD79}.Release.ActiveCfg = Release|Win32
+ {D100E130-718D-4060-ACD9-1061A159DD79}.Release.Build.0 = Release|Win32
+ {D100E130-718D-4060-ACD9-1061A159DD79}.ST.ActiveCfg = Release|Win32
+ {D100E130-718D-4060-ACD9-1061A159DD79}.ST.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4/AP4.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4/AP4.vcproj
new file mode 100644
index 000000000..8c3055898
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4/AP4.vcproj
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="AP4"
+ ProjectGUID="{A714AA1C-45A9-403D-A6E1-020E520119A2}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="5"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/AP4.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/AP4.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="ST|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="4"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/AP4.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\Ap4Lib.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4/Ap4Lib.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4/Ap4Lib.cpp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/AP4/Ap4Lib.cpp
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Aac2Mp4/Aac2Mp4.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Aac2Mp4/Aac2Mp4.vcproj
new file mode 100644
index 000000000..82f0ada5c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Aac2Mp4/Aac2Mp4.vcproj
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Aac2Mp4"
+ ProjectGUID="{2FCE14C9-42A9-4335-96EF-8B52A321720E}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core;..\..\..\..\Source\Config;..\..\..\..\Source\Codecs"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Aac2Mp4.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/Aac2Mp4.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core;..\..\..\..\Source\Config;..\..\..\..\Source\Codecs"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Aac2Mp4.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="..\..\..\..\Source\Apps\Aac2Mp4\Aac2Mp4.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Codecs/Codecs.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Codecs/Codecs.vcproj
new file mode 100644
index 000000000..59463b064
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Codecs/Codecs.vcproj
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Codecs"
+ ProjectGUID="{F90FCD13-0472-46B5-8C8F-0E45BE6E287B}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Core"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/Codecs.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Core"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/Codecs.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="ST|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Core"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/Codecs.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="..\..\..\..\Source\Codecs\Ap4AdtsParser.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Codecs\Ap4BitStream.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath="..\..\..\..\Source\Codecs\Ap4AdtsParser.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Codecs\Ap4BitStream.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Core/Core.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Core/Core.vcproj
new file mode 100644
index 000000000..f20ef96c8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Core/Core.vcproj
@@ -0,0 +1,554 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Core"
+ RootNamespace="Core"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Crypto"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/Core.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Debug\Core.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Crypto"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/Core.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Release\Core.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="ST|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Crypto"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="4"
+ EnableFunctionLevelLinking="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/Core.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Release\Core.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Atom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4AtomFactory.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4AtomSampleTable.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4ByteStream.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4ContainerAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4CttsAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DataBuffer.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Debug.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DecoderConfigDescriptor.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DecoderSpecificInfoDescriptor.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Descriptor.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DescriptorFactory.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DrefAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4EsDescriptor.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4EsdsAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4File.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4FileWriter.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4FrmaAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4FtypAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4HdlrAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4HintTrackReader.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4HmhdAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4IkmsAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4IsfmAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4IsmaCryp.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4MdhdAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4MoovAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Movie.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4MvhdAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4NmhdAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Processor.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4RtpAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4RtpHint.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Sample.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SampleDescription.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SampleEntry.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SampleTable.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SchmAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SdpAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SLConfigDescriptor.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SmhdAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StcoAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StscAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StsdAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StssAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StszAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SttsAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SyntheticSampleTable.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4TimsAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4TkhdAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Track.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4TrakAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4TrefTypeAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4UnknownDescriptor.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4UrlAtom.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Utils.cpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4VmhdAtom.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Array.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Atom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4AtomFactory.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4AtomSampleTable.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4ByteStream.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Config\Ap4Config.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Constants.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4ContainerAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4CttsAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DataBuffer.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Debug.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DecoderConfigDescriptor.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DecoderSpecificInfoDescriptor.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Descriptor.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DescriptorFactory.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4DrefAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4EsDescriptor.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4EsdsAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4File.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4FileByteStream.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4FileWriter.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4FrmaAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4FtypAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4HdlrAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4HintTrackReader.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4HmhdAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4IkmsAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Interfaces.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4IsfmAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4IsmaCryp.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4List.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4MdhdAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4MoovAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Movie.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4MvhdAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4NmhdAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Processor.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Results.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4RtpAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4RtpHint.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Sample.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SampleDescription.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SampleEntry.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SampleTable.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SchmAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SdpAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SLConfigDescriptor.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SmhdAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StcoAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StscAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StsdAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StssAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4StszAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SttsAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4SyntheticSampleTable.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4TimsAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4TkhdAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Track.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4TrakAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4TrefTypeAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Types.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4UnknownDescriptor.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4UrlAtom.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4Utils.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Core\Ap4VmhdAtom.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Crypto/Crypto.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Crypto/Crypto.vcproj
new file mode 100644
index 000000000..f87443e0f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Crypto/Crypto.vcproj
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Crypto"
+ ProjectGUID="{1B7A8040-695A-4EFA-9C0D-BF497B93F6E2}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Core"
+ PreprocessorDefinitions="AP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/Crypto.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Core"
+ PreprocessorDefinitions="AP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/Crypto.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="ST|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Core"
+ PreprocessorDefinitions="AP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN"
+ RuntimeLibrary="4"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)/Crypto.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="..\..\..\..\Source\Crypto\Ap4AesBlockCipher.cpp">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="4"
+ GlobalOptimizations="FALSE"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ EnableFiberSafeOptimizations="TRUE"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Crypto\Ap4StreamCipher.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath="..\..\..\..\Source\Crypto\Ap4AesBlockCipher.h">
+ </File>
+ <File
+ RelativePath="..\..\..\..\Source\Crypto\Ap4StreamCipher.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp42Aac/Mp42Aac.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp42Aac/Mp42Aac.vcproj
new file mode 100644
index 000000000..d7b32b380
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp42Aac/Mp42Aac.vcproj
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mp42Aac"
+ ProjectGUID="{1EA74D37-A069-425F-9E9C-F7F83B1FACBB}"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/Ap42Aac.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Debug/Mp42Aac.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="TRUE"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\Debug/Ap42Aac.pdb"
+ SubSystem="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Ap42Aac.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1036"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
+ StringPooling="TRUE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/Ap42Aac.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Release/Mp42Aac.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ ProgramDatabaseFile=".\Release/Ap42Aac.pdb"
+ SubSystem="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Ap42Aac.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1036"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="..\..\..\..\Source\Apps\Mp42Aac\Mp42Aac.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Decrypt/Mp4Decrypt.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Decrypt/Mp4Decrypt.vcproj
new file mode 100644
index 000000000..9a33246fa
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Decrypt/Mp4Decrypt.vcproj
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mp4Decrypt"
+ ProjectGUID="{C5AE742F-4F4D-4BA9-BF6A-A9EE97364B90}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core;..\..\..\..\Source\Config;..\..\..\..\Source\Crypto"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Decrypt.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/Mp4Decrypt.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core;..\..\..\..\Source\Config;..\..\..\..\Source\Crypto"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Decrypt.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="..\..\..\..\source\apps\mp4decrypt\Mp4Decrypt.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Dump/Mp4Dump.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Dump/Mp4Dump.vcproj
new file mode 100644
index 000000000..b34ba6706
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Dump/Mp4Dump.vcproj
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mp4Dump"
+ ProjectGUID="{602F1304-0BE4-4C48-983E-9A4F84BD1585}"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/Mp4Dump.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Debug/Mp4Dump.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="TRUE"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\Debug/Mp4Dump.pdb"
+ SubSystem="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Mp4Dump.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
+ StringPooling="TRUE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/Mp4Dump.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Release/Mp4Dump.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ ProgramDatabaseFile=".\Release/Mp4Dump.pdb"
+ SubSystem="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Mp4Dump.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="..\..\..\..\Source\Apps\Mp4Dump\Mp4Dump.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Edit/Mp4Edit.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Edit/Mp4Edit.vcproj
new file mode 100644
index 000000000..55e08f750
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Edit/Mp4Edit.vcproj
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mp4Edit"
+ ProjectGUID="{1B0690B7-BD89-4F6E-9C4A-A76682898963}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Edit.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/Mp4Process.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Edit.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="FALSE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="..\..\..\..\Source\Apps\Mp4Edit\Mp4Edit.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Encrypt/Mp4Encrypt.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Encrypt/Mp4Encrypt.vcproj
new file mode 100644
index 000000000..390eb61df
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Encrypt/Mp4Encrypt.vcproj
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mp4Encrypt"
+ ProjectGUID="{D467C78F-53CD-4AE8-82D4-BAE42530262B}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core;..\..\..\..\Source\Config;..\..\..\..\Source\Crypto"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Encrypt.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/Mp4Encrypt.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core;..\..\..\..\Source\Config;..\..\..\..\Source\Crypto"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Encrypt.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="FALSE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="..\..\..\..\Source\Apps\Mp4Encrypt\Mp4Encrypt.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Extract/Mp4Extract.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Extract/Mp4Extract.vcproj
new file mode 100644
index 000000000..5a7c2fbbe
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Extract/Mp4Extract.vcproj
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mp4Extract"
+ ProjectGUID="{F0B2195A-2027-4FA1-8CE9-F5600764CB4E}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Extract.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/Mp4Extract.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Extract.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="FALSE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="..\..\..\..\Source\Apps\Mp4Extract\Mp4Extract.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Info/Mp4Info.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Info/Mp4Info.vcproj
new file mode 100644
index 000000000..91e86bf14
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Info/Mp4Info.vcproj
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mp4Info"
+ ProjectGUID="{52A6B013-A542-4F5C-838E-F582CC6EF903}"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/Mp4Info.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Debug/Mp4Info.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="TRUE"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\Debug/Mp4Info.pdb"
+ SubSystem="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/Mp4Info.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
+ StringPooling="TRUE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/Mp4Info.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="odbc32.lib odbccp32.lib"
+ OutputFile=".\Release/Mp4Info.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ ProgramDatabaseFile=".\Release/Mp4Info.pdb"
+ SubSystem="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/Mp4Info.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1036"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="..\..\..\..\Source\Apps\Mp4Info\Mp4Info.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4RtpHintInfo/Mp4RtpHintInfo.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4RtpHintInfo/Mp4RtpHintInfo.vcproj
new file mode 100644
index 000000000..950306f0c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4RtpHintInfo/Mp4RtpHintInfo.vcproj
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mp4RtpHintInfo"
+ ProjectGUID="{D100E130-718D-4060-ACD9-1061A159DD79}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Core"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4RtpHintInfo.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/Mp4RtpHintInfo.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Config;..\..\..\..\Source\Core"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4RtpHintInfo.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="FALSE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath="..\..\..\..\Source\Apps\Mp4RtpHintInfo\Mp4RtpHintInfo.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Tag/Mp4Tag.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Tag/Mp4Tag.vcproj
new file mode 100644
index 000000000..406bb31bb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/Mp4Tag/Mp4Tag.vcproj
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mp4Tag"
+ ProjectGUID="{73804182-47BC-4885-898D-939CA8672828}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Tag.exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/Mp4Tag.pdb"
+ SubSystem="1"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ StringPooling="TRUE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)/Mp4Tag.exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="FALSE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="..\..\..\..\Source\Apps\Mp4Tag\Mp4Tag.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/System/System.vcproj b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/System/System.vcproj
new file mode 100644
index 000000000..f3b3ab08c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/System/System.vcproj
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="System"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\..\..\Source\System\StdC,..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32,_DEBUG,_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/System.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Debug\System.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\..\Source\System\StdC,..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/System.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Release\System.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="ST|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\..\Source\System\StdC,..\..\..\..\Source\Core,..\..\..\..\Source\Config"
+ PreprocessorDefinitions="WIN32,NDEBUG,_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="4"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/System.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile=".\Release\System.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="..\..\..\..\Source\System\StdC\Ap4StdCFileByteStream.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath="..\..\..\..\Source\Config\Ap4Config.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/make-sdk.sh b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/make-sdk.sh
new file mode 100644
index 000000000..193d60fd6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-microsoft-win32/make-sdk.sh
@@ -0,0 +1,20 @@
+AP4_ROOT=../../..
+SOURCE_ROOT=$AP4_ROOT/Source
+BUILD_TARGET_DIR=$AP4_ROOT/Build/Targets/x86-microsoft-win32
+
+CP="cp"
+MKDIR="mkdir -p"
+for config in Debug Release
+do
+ SDK_DIR=$config/SDK
+ $MKDIR $SDK_DIR
+ $MKDIR $SDK_DIR/include
+ $MKDIR $SDK_DIR/bin
+ $MKDIR $SDK_DIR/lib
+ $CP $SOURCE_ROOT/Config/*.h $SDK_DIR/include
+ $CP $SOURCE_ROOT/Core/*.h $SDK_DIR/include
+ $CP $SOURCE_ROOT/Codecs/*.h $SDK_DIR/include
+ $CP $SOURCE_ROOT/Crypto/*.h $SDK_DIR/include
+ $CP $BUILD_TARGET_DIR/AP4/$config/AP4.lib $SDK_DIR/lib
+ $CP $BUILD_TARGET_DIR/*/$config/*.exe $SDK_DIR/bin
+done
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-cygwin/Local.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-cygwin/Local.mak
new file mode 100644
index 000000000..e48370e4e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-cygwin/Local.mak
@@ -0,0 +1,67 @@
+#######################################################################
+#
+# AP4 Makefile for x86-unknown-cygwin
+#
+#######################################################################
+all: Apps
+
+#######################################################################
+# configuration variables
+#######################################################################
+TARGET = x86-unknown-cygwin
+BUILD_ROOT = ../../..
+SOURCE_ROOT = ../../../../Source
+
+#######################################################################
+# tools
+#######################################################################
+# how to make dependencies
+AUTODEP_CPP = gcc -MM
+
+# how to archive of object files
+ARCHIVE = ld -r
+
+# how to make a library
+MAKELIB = ar rs
+
+# how to optimize the layout of a library
+RANLIB = ranlib
+
+# how to strip executables
+STRIP = strip
+
+# how to compile source code
+COMPILE_CPP = g++
+
+# how to link object files
+LINK_CPP = g++ -L.
+
+# optimization flags
+OPTIMIZE_CPP = -O6
+
+# debug flags
+DEBUG_CPP = -g
+
+# profiling flags
+PROFILE_CPP = -pg
+
+# compilation flags
+DEFINES_CPP = -D_REENTRANT -DAP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN
+
+# warning flags
+WARNINGS_CPP = -Wall -Werror -Wshadow -Wpointer-arith -Wcast-qual
+# include directories
+INCLUDES_CPP =
+
+# libraries
+LIBRARIES_CPP =
+
+#######################################################################
+# module selection
+#######################################################################
+FILE_BYTE_STREAM_IMPLEMENTATION = Ap4StdCFileByteStream
+
+#######################################################################
+# includes
+#######################################################################
+include $(BUILD_ROOT)/Makefiles/TopLevel.mak
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-cygwin/Makefile b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-cygwin/Makefile
new file mode 100644
index 000000000..b845e1124
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-cygwin/Makefile
@@ -0,0 +1 @@
+include ../../Makefiles/Bootstrap.mak
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/.cdtproject b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/.cdtproject
new file mode 100644
index 000000000..5b8b35754
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/.cdtproject
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse-cdt version="2.0"?>
+
+<cdtproject id="org.eclipse.cdt.make.core.make">
+<extension point="org.eclipse.cdt.core.BinaryParser" id="org.eclipse.cdt.core.ELF"/>
+<extension point="org.eclipse.cdt.core.CIndexer" id="org.eclipse.cdt.core.domsourceindexer"/>
+<data>
+
+<item id="org.eclipse.cdt.make.core.buildtargets">
+<buildTargets>
+<target name="all" path="" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
+<buildCommand>make</buildCommand>
+<buildTarget>all</buildTarget>
+<stopOnError>false</stopOnError>
+<useDefaultCommand>true</useDefaultCommand>
+</target>
+</buildTargets>
+</item>
+<item id="cdt_indexer">
+<indexEnabled indexValue="false"/>
+<indexerProblemsEnabled indexProblemsValue="0"/>
+</item>
+<item id="cdt_resolver">
+<custom value="false"/>
+</item>
+<item id="org.eclipse.cdt.core.pathentry">
+<pathentry kind="src" path="" excluding="Debug/|.cdtproject|.project|README.eclipse"/>
+<pathentry kind="out" path=""/>
+<pathentry kind="out" path="Debug"/>
+</item>
+</data>
+</cdtproject>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/.project b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/.project
new file mode 100644
index 000000000..82b94c241
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/.project
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>AP4</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.make.core.makeBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>org.eclipse.cdt.core.errorOutputParser</key>
+ <value>org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+ <value>clean all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.incrementalBuildTarget</key>
+ <value>all</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildLocation</key>
+ <value></value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+ <value>clean</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.buildCommand</key>
+ <value>make</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.stopOnError</key>
+ <value>false</value>
+ </dictionary>
+ <dictionary>
+ <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+ <value>all</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.make.core.makeNature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>Makefiles</name>
+ <type>2</type>
+ <location>AP4_HOME/Build/Makefiles</location>
+ </link>
+ <link>
+ <name>Source</name>
+ <type>2</type>
+ <location>AP4_HOME/Source</location>
+ </link>
+ </linkedResources>
+</projectDescription>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/Local.mak b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/Local.mak
new file mode 100644
index 000000000..eec867e5b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/Local.mak
@@ -0,0 +1,67 @@
+#######################################################################
+#
+# AP4 Makefile for x86-unknown-linux
+#
+#######################################################################
+all: Apps
+
+#######################################################################
+# configuration variables
+#######################################################################
+TARGET = x86-unknown-linux
+BUILD_ROOT = ../../..
+SOURCE_ROOT = ../../../../Source
+
+#######################################################################
+# tools
+#######################################################################
+# how to make dependencies
+AUTODEP_CPP = gcc -MM
+
+# how to archive of object files
+ARCHIVE = ld -r
+
+# how to make a library
+MAKELIB = ar rs
+
+# how to optimize the layout of a library
+RANLIB = ranlib
+
+# how to strip executables
+STRIP = strip
+
+# how to compile source code
+COMPILE_CPP = g++
+
+# how to link object files
+LINK_CPP = g++ -L.
+
+# optimization flags
+OPTIMIZE_CPP = -O6
+
+# debug flags
+DEBUG_CPP = -g
+
+# profiling flags
+PROFILE_CPP = -pg
+
+# compilation flags
+DEFINES_CPP = -D_REENTRANT -DAP4_PLATFORM_BYTE_ORDER=AP4_PLATFORM_LITTLE_ENDIAN
+
+# warning flags
+WARNINGS_CPP = -Wall -Werror -Wshadow -Wpointer-arith -Wcast-qual
+# include directories
+INCLUDES_CPP =
+
+# libraries
+LIBRARIES_CPP =
+
+#######################################################################
+# module selection
+#######################################################################
+FILE_BYTE_STREAM_IMPLEMENTATION = Ap4StdCFileByteStream
+
+#######################################################################
+# includes
+#######################################################################
+include $(BUILD_ROOT)/Makefiles/TopLevel.mak
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/Makefile b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/Makefile
new file mode 100644
index 000000000..b845e1124
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/Makefile
@@ -0,0 +1 @@
+include ../../Makefiles/Bootstrap.mak
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/README.eclipse b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/README.eclipse
new file mode 100644
index 000000000..2eb06b13a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Build/Targets/x86-unknown-linux/README.eclipse
@@ -0,0 +1,5 @@
+The eclipse project has been successfully tested with Eclipse 3.0 M8 and the CDT plugin 2.0 M8 (http://www.eclipse.org/cdt).
+
+in order to make the eclipse project work, you must define a linked resource variable AP4_HOME pointing on the root of your local copy the AP4 module.
+
+Go to >Windows>Preferences>Workbench>Linked Resources and define the AP4_HOME variable.
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/README b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/README
new file mode 100644
index 000000000..ce0136250
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/README
@@ -0,0 +1 @@
+hello
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Aac2Mp4/Aac2Mp4.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Aac2Mp4/Aac2Mp4.cpp
new file mode 100644
index 000000000..aa3e6c149
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Aac2Mp4/Aac2Mp4.cpp
@@ -0,0 +1,194 @@
+/*****************************************************************
+|
+| AP4 - AAC to MP4 Converter
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4File.h"
+#include "Ap4FileWriter.h"
+#include "Ap4FileByteStream.h"
+#include "Ap4SyntheticSampleTable.h"
+#include "Ap4AdtsParser.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "AAC to MP4 Converter - Version 0.1a - (c) 2002-2005 Gilles Boccon-Gibod"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\nusage: aac2mp4 [options] <input> <output>\n");
+ exit(1);
+}
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ AP4_Result result;
+
+ if (argc < 2) {
+ PrintUsageAndExit();
+ }
+
+ // open the input
+ AP4_ByteStream* input;
+ try {
+ input = new AP4_FileByteStream(argv[1], AP4_FileByteStream::STREAM_MODE_READ);
+ } catch (AP4_Exception&) {
+ AP4_Debug("ERROR: cannot open input (%s)\n", argv[1]);
+ return 1;
+ }
+
+ // open the output
+ AP4_ByteStream* output = new AP4_FileByteStream(
+ argv[2],
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+
+ // create a sample table
+ AP4_SyntheticSampleTable* sample_table = new AP4_SyntheticSampleTable();
+
+ // create an ADTS parser
+ AP4_AdtsParser parser;
+ bool initialized = false;
+ unsigned int sample_description_index = 0;
+
+ // read from the input, feed, and get AAC frames
+ AP4_UI32 sample_rate = 0;
+ AP4_Cardinal sample_count = 0;
+ bool eos = false;
+ for(;;) {
+ // try to get a frame
+ AP4_AacFrame frame;
+ result = parser.FindFrame(frame);
+ if (AP4_SUCCEEDED(result)) {
+ AP4_Debug("AAC frame [%06d]: size = %d, %d kHz, %d ch\n",
+ sample_count,
+ frame.m_Info.m_FrameLength,
+ frame.m_Info.m_SamplingFrequency,
+ frame.m_Info.m_ChannelConfiguration);
+ if (!initialized) {
+ initialized = true;
+
+ // create a sample description for our samples
+ AP4_DataBuffer dsi;
+ unsigned char aac_dsi[2] = {0x12, 0x10};
+ dsi.SetData(aac_dsi, 2);
+ AP4_MpegAudioSampleDescription* sample_description =
+ new AP4_MpegAudioSampleDescription(
+ AP4_MPEG4_AUDIO_OTI, // object type
+ frame.m_Info.m_SamplingFrequency,
+ 16, // sample size
+ frame.m_Info.m_ChannelConfiguration,
+ &dsi, // decoder info
+ 6144, // buffer size
+ 128000, // max bitrate
+ 128000); // average bitrate
+ sample_description_index = sample_table->AddSampleDescription(sample_description);
+ sample_rate = frame.m_Info.m_SamplingFrequency;
+ }
+
+ AP4_MemoryByteStream* sample_data = new AP4_MemoryByteStream(frame.m_Info.m_FrameLength);
+ frame.m_Source->ReadBytes(sample_data->GetBuffer(), frame.m_Info.m_FrameLength);
+ printf("%02x %02x %02x %02x\n",
+ sample_data->GetBuffer()[0],
+ sample_data->GetBuffer()[1],
+ sample_data->GetBuffer()[2],
+ sample_data->GetBuffer()[3]);
+ sample_table->AddSample(*sample_data, 0, frame.m_Info.m_FrameLength, sample_description_index);
+ sample_data->Release();
+ sample_count++;
+ } else {
+ if (eos) break;
+ }
+
+ // read some data and feed the parser
+ AP4_UI08 input_buffer[4096];
+ AP4_Size bytes_read = 0;
+ AP4_Size to_read = parser.GetBytesFree();
+ if (to_read) {
+ if (to_read > sizeof(input_buffer)) to_read = sizeof(input_buffer);
+ result = input->Read(input_buffer, to_read, &bytes_read);
+ if (AP4_SUCCEEDED(result)) {
+ AP4_Size to_feed = bytes_read;
+ result = parser.Feed(input_buffer, &to_feed);
+ if (AP4_FAILED(result)) {
+ AP4_Debug("ERROR: parser.Feed() failed (%d)\n", result);
+ return 1;
+ }
+ } else {
+ if (result == AP4_ERROR_EOS) {
+ eos = true;
+ }
+ }
+ }
+ }
+
+ // create an audio track
+ AP4_Track* track = new AP4_Track(AP4_Track::TYPE_AUDIO,
+ sample_table,
+ 0, // track id
+ sample_rate, // movie time scale
+ sample_rate, // track time scale
+ sample_count*1024, // track duration
+ "eng", // language
+ 0, 0); // width, height
+
+ // create a movie
+ AP4_Movie* movie = new AP4_Movie();
+
+ // add the track to the movie
+ movie->AddTrack(track);
+
+ // create a multimedia file
+ AP4_File* file = new AP4_File(movie);
+
+ // create a writer to write the file
+ AP4_FileWriter* writer = new AP4_FileWriter(*file);
+
+ // write the file to the output
+ writer->Write(*output);
+
+ delete writer;
+ delete file;
+ delete output;
+
+ return 0;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp42Aac/Mp42Aac.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp42Aac/Mp42Aac.cpp
new file mode 100644
index 000000000..b5d4ec004
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp42Aac/Mp42Aac.cpp
@@ -0,0 +1,160 @@
+/*****************************************************************
+|
+| AP4 - MP4 to AAC File Converter
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4FileByteStream.h"
+#include "Ap4Atom.h"
+#include "Ap4File.h"
+#include "Ap4Sample.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "MP4 To AAC File Converter - Version 0.1a\n"\
+ "(c) 2003-2005 Gilles Boccon-Gibod & Julien Boeuf"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\nusage: ap42aac [options] <input> <output>\n");
+ exit(1);
+}
+
+/*----------------------------------------------------------------------
+| WriteAdtsHeader
++---------------------------------------------------------------------*/
+static AP4_Result
+WriteAdtsHeader(AP4_ByteStream* output, unsigned int frame_size)
+{
+ unsigned char bits[7];
+
+ bits[0] = 0xFF;
+ bits[1] = 0xF1; // 0xF9 (MPEG2)
+ bits[2] = 0x50;
+ bits[3] = 0x80 | ((frame_size+7) >> 11);
+ bits[4] = ((frame_size+7) >> 3)&0xFF;
+ bits[5] = (((frame_size+7) << 5)&0xFF) | 0x1F;
+ bits[6] = 0xFC;
+
+ return output->Write(bits, 7);
+
+ /*
+0: syncword 12 always: '111111111111'
+12: ID 1 0: MPEG-4, 1: MPEG-2
+13: layer 2 always: '00'
+15: protection_absent 1
+16: profile 2
+18: sampling_frequency_index 4
+22: private_bit 1
+23: channel_configuration 3
+26: original/copy 1
+27: home 1
+28: emphasis 2 only if ID == 0
+
+ADTS Variable header: these can change from frame to frame
+28: copyright_identification_bit 1
+29: copyright_identification_start 1
+30: aac_frame_length 13 length of the frame including header (in bytes)
+43: adts_buffer_fullness 11 0x7FF indicates VBR
+54: no_raw_data_blocks_in_frame 2
+ADTS Error check
+crc_check 16 only if protection_absent == 0
+*/
+}
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ if (argc < 3) {
+ PrintUsageAndExit();
+ }
+
+ // create the input stream
+ AP4_ByteStream* input =
+ new AP4_FileByteStream(argv[1],
+ AP4_FileByteStream::STREAM_MODE_READ);
+
+ // create the output stream
+ AP4_ByteStream* output =
+ new AP4_FileByteStream(argv[2],
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+
+ // open the file
+ AP4_File* input_file = new AP4_File(*input);
+
+ // get the movie
+ AP4_Movie* movie = input_file->GetMovie();
+ if (movie != NULL) {
+ AP4_List<AP4_Track>& tracks = movie->GetTracks();
+ AP4_Debug("Found %d Tracks\n", tracks.ItemCount());
+ // get audio track
+ AP4_Track* audio_track = movie->GetTrack(AP4_Track::TYPE_AUDIO);
+ if (audio_track != NULL) {
+ // show info
+ AP4_Debug("Audio Track:\n");
+ AP4_Debug(" duration: %ld ms\n", audio_track->GetDurationMs());
+ AP4_Debug(" sample count: %ld\n", audio_track->GetSampleCount());
+
+ AP4_Sample sample;
+ AP4_DataBuffer data;
+ AP4_Ordinal index = 0;
+ while (AP4_SUCCEEDED(audio_track->ReadSample(index, sample, data))) {
+ WriteAdtsHeader(output, sample.GetSize());
+ output->Write(data.GetData(), data.GetDataSize());
+ AP4_Debug(" [%d] writing %ld bytes of data...\n",
+ index, sample.GetSize());
+ index++;
+ }
+ } else {
+ AP4_Debug("No Audio Track found\n");
+ }
+ } else {
+ AP4_Debug("No Movie in file\n");
+ }
+
+ delete input_file;
+ input->Release();
+ output->Release();
+
+ return 0;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Decrypt/Mp4Decrypt.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Decrypt/Mp4Decrypt.cpp
new file mode 100644
index 000000000..68791de7f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Decrypt/Mp4Decrypt.cpp
@@ -0,0 +1,157 @@
+/*****************************************************************
+|
+| AP4 - MP4 Decrypter
+|
+| Copyright 2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4FileByteStream.h"
+#include "Ap4Atom.h"
+#include "Ap4File.h"
+#include "Ap4Sample.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4IsmaCryp.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "MP4 Decrypter - Version 0.1a\n"\
+ "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\n"
+ "usage: mp4decrypt [--key <n>:<k>:<salt>] <input> <output>\n"
+ " where <n> is a track index, <k> a 128-bit key in hex\n"
+ " and <salt> a 128-bit salting key\n"
+ " (several --key options can be used, one for each track)\n");
+ exit(1);
+}
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ if (argc < 3) {
+ PrintUsageAndExit();
+ }
+
+ // create a decrypting processor
+ AP4_IsmaDecryptingProcessor processor;
+
+ // parse options
+ const char* input_filename = NULL;
+ const char* output_filename = NULL;
+
+ char* arg;
+ while ((arg = *++argv)) {
+ if (!strcmp(arg, "--key")) {
+ arg = *++argv;
+ if (arg == NULL) {
+ fprintf(stderr, "ERROR: missing argument after --key option\n");
+ return 1;
+ }
+ char* track_ascii = NULL;
+ char* key_ascii = NULL;
+ char* salt_ascii = NULL;
+ if (AP4_SplitArgs(arg, track_ascii, key_ascii, salt_ascii)) {
+ fprintf(stderr, "ERROR: invalid argument for --key option\n");
+ return 1;
+ }
+ unsigned char key[16];
+ unsigned char salt[16];
+ unsigned int track = strtoul(track_ascii, NULL, 10);
+ if (AP4_ParseHex(key_ascii, key, 16)) {
+ fprintf(stderr, "ERROR: invalid hex format for key\n");
+ }
+ if (AP4_ParseHex(salt_ascii, salt, 8)) {
+ fprintf(stderr, "ERROR: invalid hex format for salt\n");
+ }
+ // set the key in the map
+ processor.GetKeyMap().SetKey(track, key, salt);
+ } else if (input_filename == NULL) {
+ input_filename = arg;
+ } else if (output_filename == NULL) {
+ output_filename = arg;
+ } else {
+ fprintf(stderr, "ERROR: unexpected argument (%s)\n", arg);
+ return 1;
+ }
+ }
+
+ // check the arguments
+ if (input_filename == NULL) {
+ fprintf(stderr, "ERROR: missing input filename\n");
+ return 1;
+ }
+ if (output_filename == NULL) {
+ fprintf(stderr, "ERROR: missing output filename\n");
+ return 1;
+ }
+
+ // create the input stream
+ AP4_ByteStream* input;
+ try{
+ input = new AP4_FileByteStream(input_filename,
+ AP4_FileByteStream::STREAM_MODE_READ);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename);
+ return 1;
+ }
+
+ // create the output stream
+ AP4_ByteStream* output;
+ try {
+ output = new AP4_FileByteStream(output_filename,
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename);
+ return 1;
+ }
+
+ // process/decrypt the file
+ processor.Process(*input, *output);
+
+ // cleanup
+ input->Release();
+ output->Release();
+
+ return 0;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Dump/Mp4Dump.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Dump/Mp4Dump.cpp
new file mode 100644
index 000000000..07654b954
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Dump/Mp4Dump.cpp
@@ -0,0 +1,164 @@
+/*****************************************************************
+|
+| AP4 - MP4 File Dumper
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4FileByteStream.h"
+#include "Ap4Atom.h"
+#include "Ap4File.h"
+#include "Ap4Sample.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "MP4 File Dumper - Version 0.2a\n"\
+ "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\nusage: mp4dump [options] <input>\n"
+ "options are:\n"
+ " -track <track_id> <data_file>: writes the track data in data_file");
+ exit(1);
+}
+
+#if 0
+/*----------------------------------------------------------------------
+| DumpTrackData
++---------------------------------------------------------------------*/
+void
+DumpTrackData(AP4_File* mp4_file, AP4_UI32 track_id, AP4_ByteStream* track_data)
+{
+ // get the track
+ AP4_Track* track = NULL;
+ AP4_Result result = mp4_file->GetTrack(track_id, track);
+ if (AP4_FAILED(result)) {
+ fprintf(stderr, "track not found (id = %d)", track_id);
+ return;
+ }
+
+ // write the data
+ AP4_Sample sample;
+ AP4_DataBuffer sample_data;
+ AP4_Ordinal index = 0;
+ while (AP4_SUCCEEDED(track->ReadSample(index, sample, sample_data))) {
+ track_data->Write(sample_data.GetData(), sample_data.GetDataSize());
+ index++;
+ }
+}
+#endif
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ if (argc < 2) {
+ PrintUsageAndExit();
+ }
+
+ // init the variables
+ AP4_UI32 track_id = 0;
+ AP4_ByteStream* input = NULL;
+ AP4_ByteStream* track_data = NULL;
+
+ // parse the command line
+ argv++;
+ char* arg;
+ while ((arg = *argv++)) {
+ if (!strcmp(arg, "-track")) {
+ if (argv[0] && argv[1] && argv[2]) {
+ track_id = atoi(argv[0]);
+ if (track_id == 0) PrintUsageAndExit();
+ track_data =
+ new AP4_FileByteStream(argv[1],
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+ argv += 2;
+ } else {
+ PrintUsageAndExit();
+ }
+ } else {
+ try {
+ input =
+ new AP4_FileByteStream(arg,
+ AP4_FileByteStream::STREAM_MODE_READ);
+ } catch(AP4_Exception e) {
+ AP4_Debug("ERROR: cannot open input (%d)\n", e.m_Error);
+ return 1;
+ }
+ }
+ }
+
+ // open the output
+ AP4_ByteStream* output =
+ new AP4_FileByteStream("-stdout",
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+
+ // create an inspector
+ AP4_PrintInspector inspector(*output);
+
+ // inspect the atoms one by one
+ AP4_Atom* atom;
+ //for (int i=0; i<1000; i++) {
+ AP4_AtomFactory& atom_factory = AP4_AtomFactory::DefaultFactory;
+ //MyTypeHandler my_type_handler;
+ //atom_factory.AddTypeHandler(&my_type_handler);
+ while (atom_factory.CreateAtomFromStream(*input, atom) ==
+ AP4_SUCCESS) {
+ atom->Inspect(inspector);
+ delete atom;
+ }
+ //input->Seek(0);
+ //}
+
+ // inspect the track data if needed
+ if ((track_id != 0) && (track_data != NULL)) {
+ //DumpTrackData(file, track_id, track_data);
+ }
+
+ if (input) input->Release();
+ if (output) output->Release();
+ if (track_data) track_data->Release();
+
+ return 0;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Edit/Mp4Edit.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Edit/Mp4Edit.cpp
new file mode 100644
index 000000000..d28aba1d2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Edit/Mp4Edit.cpp
@@ -0,0 +1,400 @@
+/*****************************************************************
+|
+| AP4 - MP4 File Processor
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4FileByteStream.h"
+#include "Ap4Processor.h"
+#include "Ap4Utils.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "MP4 File Editor - Version 0.5a\n"\
+ "(c) 2003-2005 Gilles Boccon-Gibod & Julien Boeuf"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\nusage: mp4edit [commands] <input> <output>\n"
+ " where commands include one or more of:\n"
+ " --insert <atom_name>:<source_file>[:<position>]\n"
+ " --remove <atom_name>\n"
+ " --replace <atom_name>:<source_file>\n");
+ exit(1);
+}
+
+/*----------------------------------------------------------------------
+| AP4_EditingProcessor
++---------------------------------------------------------------------*/
+class AP4_EditingProcessor : public AP4_Processor
+{
+public:
+ // types
+ class Command {
+ public:
+ // types
+ typedef enum {
+ TYPE_INSERT,
+ TYPE_REMOVE,
+ TYPE_REPLACE
+ } Type;
+
+ // constructor
+ Command(Type type, const char* atom_path,
+ const char* file_path,
+ int position = -1) :
+ m_Type(type),
+ m_AtomPath(atom_path),
+ m_FilePath(file_path),
+ m_Position(position) {}
+
+ // members
+ Type m_Type;
+ AP4_String m_AtomPath;
+ AP4_String m_FilePath;
+ int m_Position;
+ };
+
+ // constructor and destructor
+ virtual ~AP4_EditingProcessor();
+
+ // methods
+ virtual AP4_Result Initialize(AP4_AtomParent& top_level);
+ AP4_Result AddCommand(Command::Type type,
+ const char* atom_path,
+ const char* file_path,
+ int position = -1);
+
+private:
+ // methods
+ AP4_Result InsertAtom(const char* file_path,
+ AP4_AtomParent* container,
+ int position);
+ AP4_Result DoRemove(Command* command, AP4_AtomParent& top_level);
+ AP4_Result DoInsert(Command* command, AP4_AtomParent& top_level);
+ AP4_Result DoReplace(Command* command, AP4_AtomParent& top_level);
+
+ // members
+ AP4_List<Command> m_Commands;
+ AP4_AtomParent m_TopLevelParent;
+};
+
+/*----------------------------------------------------------------------
+| AP4_EditingProcessor::~AP4_EditingProcessor
++---------------------------------------------------------------------*/
+AP4_EditingProcessor::~AP4_EditingProcessor()
+{
+ m_Commands.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_EditingProcessor::AddCommand
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EditingProcessor::AddCommand(Command::Type type,
+ const char* atom_path,
+ const char* file_path,
+ int position)
+{
+ return m_Commands.Add(new Command(type, atom_path, file_path, position));
+}
+
+/*----------------------------------------------------------------------
+| AP4_EditingProcessor::Initialize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EditingProcessor::Initialize(AP4_AtomParent& top_level)
+{
+ AP4_Result result;
+
+ AP4_List<Command>::Item* command_item = m_Commands.FirstItem();
+ while (command_item) {
+ Command* command = command_item->GetData();
+ switch (command->m_Type) {
+ case Command::TYPE_REMOVE:
+ result = DoRemove(command, top_level);
+ if (AP4_FAILED(result)) return result;
+ break;
+
+ case Command::TYPE_INSERT:
+ result = DoInsert(command, top_level);
+ if (AP4_FAILED(result)) return result;
+ break;
+
+ case Command::TYPE_REPLACE:
+ result = DoReplace(command, top_level);
+ if (AP4_FAILED(result)) return result;
+ break;
+ }
+ command_item = command_item->GetNext();
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EditingProcessor::DoRemove
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EditingProcessor::DoRemove(Command* command, AP4_AtomParent& top_level)
+{
+ AP4_Atom* atom = top_level.FindChild(command->m_AtomPath.c_str());
+ if (atom == NULL) {
+ fprintf(stderr, "ERROR: atom '%s' not found\n", command->m_AtomPath.c_str());
+ return AP4_FAILURE;
+ } else {
+ atom->Detach();
+ delete atom;
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_EditingProcessor::InsertAtom
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EditingProcessor::InsertAtom(const char* file_path,
+ AP4_AtomParent* container,
+ int position)
+{
+ // read the atom to insert
+ AP4_Atom* child = NULL;
+ AP4_ByteStream* input;
+ try {
+ input = new AP4_FileByteStream(file_path,
+ AP4_FileByteStream::STREAM_MODE_READ);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open atom file (%s)\n", file_path);
+ return AP4_FAILURE;
+ }
+ AP4_Result result;
+ result = AP4_AtomFactory::DefaultFactory.CreateAtomFromStream(*input, child);
+ input->Release();
+ if (AP4_FAILED(result)) {
+ fprintf(stderr, "ERROR: failed to create atom\n");
+ return AP4_FAILURE;
+ }
+
+ // insert the atom
+ result = container->AddChild(child, position);
+ if (AP4_FAILED(result)) {
+ fprintf(stderr, "ERROR: failed to insert atom\n");
+ delete child;
+ return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EditingProcessor::DoInsert
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EditingProcessor::DoInsert(Command* command, AP4_AtomParent& top_level)
+{
+ AP4_AtomParent* parent = NULL;
+ if (command->m_AtomPath.length() == 0) {
+ // insert into the toplevel list
+ parent = &top_level;
+ } else {
+ // find the atom to insert into
+ AP4_Atom* atom = top_level.FindChild(command->m_AtomPath.c_str(), true);
+ if (atom == NULL) {
+ fprintf(stderr, "ERROR: atom '%s' not found\n",
+ command->m_AtomPath.c_str());
+ return AP4_FAILURE;
+ }
+
+ // check that the atom is a container
+ parent = dynamic_cast<AP4_AtomParent*>(atom);
+ }
+
+ // check that we have a place to insert into
+ if (parent == NULL) {
+ fprintf(stderr, "ERROR: atom '%s' is not a container\n",
+ command->m_AtomPath.c_str());
+ return AP4_FAILURE;
+ }
+
+ return InsertAtom(command->m_FilePath.c_str(), parent, command->m_Position);
+}
+
+/*----------------------------------------------------------------------
+| AP4_EditingProcessor::DoReplace
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EditingProcessor::DoReplace(Command* command, AP4_AtomParent& top_level)
+{
+ // remove the atom
+ AP4_Atom* atom = top_level.FindChild(command->m_AtomPath.c_str());
+ if (atom == NULL) {
+ fprintf(stderr, "ERROR: atom '%s' not found\n", command->m_AtomPath.c_str());
+ return AP4_FAILURE;
+ } else {
+ // find the position of the atom in the parent
+ AP4_AtomParent* parent = atom->GetParent();
+ int position = 0;
+ AP4_List<AP4_Atom>::Item* list_item = parent->GetChildren().FirstItem();
+ while (list_item) {
+ if (list_item->GetData() == atom) break;
+ position++;
+ list_item = list_item->GetNext();
+ }
+
+ // remove the atom from the parent
+ atom->Detach();
+ delete atom;
+
+ // insert the replacement
+ return InsertAtom(command->m_FilePath.c_str(), parent, position);
+ }
+}
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ if (argc < 3) {
+ PrintUsageAndExit();
+ }
+
+ // create initial objects
+ AP4_EditingProcessor processor;
+
+ // parse arguments
+ const char* input_filename = NULL;
+ const char* output_filename = NULL;
+ char* arg;
+ while ((arg = *++argv)) {
+ if (!strcmp(arg, "--insert")) {
+ char* param = *++argv;
+ if (param == NULL) {
+ fprintf(stderr, "ERROR: missing argument for --insert command\n");
+ return 1;
+ }
+ char* atom_path = NULL;
+ char* file_path = NULL;
+ if (AP4_SUCCEEDED(AP4_SplitArgs(param, atom_path, file_path))) {
+ int position = -1;
+ char* position_str = NULL;
+ if (AP4_SUCCEEDED(AP4_SplitArgs(file_path, file_path, position_str))) {
+ if (position_str) {
+ position = strtoul(position_str, NULL, 10);
+ }
+ }
+ processor.AddCommand(AP4_EditingProcessor::Command::TYPE_INSERT, atom_path, file_path, position);
+ } else {
+ fprintf(stderr, "ERROR: invalid format for --insert command argument\n");
+ return 1;
+ }
+ } else if (!strcmp(arg, "--remove")) {
+ char* atom_path = *++argv;
+ if (atom_path == NULL) {
+ fprintf(stderr, "ERROR: missing argument for --remove command\n");
+ return 1;
+ }
+ processor.AddCommand(AP4_EditingProcessor::Command::TYPE_REMOVE, atom_path, "");
+ } else if (!strcmp(arg, "--replace")) {
+ char* param = *++argv;
+ if (param == NULL) {
+ fprintf(stderr, "ERROR: missing argument for --replace command\n");
+ return 1;
+ }
+ char* atom_path = NULL;
+ char* file_path = NULL;
+ if (AP4_SUCCEEDED(AP4_SplitArgs(param, atom_path, file_path))) {
+ processor.AddCommand(AP4_EditingProcessor::Command::TYPE_REPLACE, atom_path, file_path);
+ } else {
+ fprintf(stderr, "ERROR: invalid format for --replace command argument\n");
+ return 1;
+ }
+ } else if (input_filename == NULL) {
+ input_filename = arg;
+ } else if (output_filename == NULL) {
+ output_filename = arg;
+ } else {
+ fprintf(stderr, "ERROR: invalid command line argument (%s)\n", arg);
+ return 1;
+ }
+ }
+
+ // check arguments
+ if (input_filename == NULL) {
+ fprintf(stderr, "ERROR: missing input filename\n");
+ return 1;
+ }
+ if (output_filename == NULL) {
+ fprintf(stderr, "ERROR: missing output filename\n");
+ return 1;
+ }
+
+ // create the input stream
+ AP4_ByteStream* input = NULL;
+ try {
+ input = new AP4_FileByteStream(input_filename,
+ AP4_FileByteStream::STREAM_MODE_READ);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename);
+ return 1;
+ }
+
+ // create the output stream
+ AP4_ByteStream* output = NULL;
+ try {
+ output = new AP4_FileByteStream(output_filename,
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename);
+ input->Release();
+ return 1;
+ }
+
+ // process!
+ processor.Process(*input, *output);
+
+ // cleanup
+ input->Release();
+ output->Release();
+
+ return 0;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Encrypt/Mp4Encrypt.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Encrypt/Mp4Encrypt.cpp
new file mode 100644
index 000000000..7be866bc1
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Encrypt/Mp4Encrypt.cpp
@@ -0,0 +1,168 @@
+/*****************************************************************
+|
+| AP4 - MP4 Encrypter
+|
+| Copyright 2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4FileByteStream.h"
+#include "Ap4Atom.h"
+#include "Ap4File.h"
+#include "Ap4Sample.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4IsmaCryp.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "MP4 Encrypter - Version 0.1a\n"\
+ "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\n"
+ "usage: mp4encrypt --kms-uri <uri> [--key <n>:<k>:<salt>] <input> <output>\n"
+ " where <n> is a track index, <k> a 128-bit key in hex\n"
+ " and <salt> a 128-bit salting key\n"
+ " (several --key options can be used, one for each track)\n");
+ exit(1);
+}
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ if (argc < 5) {
+ PrintUsageAndExit();
+ }
+
+ // parse options
+ if (strcmp(*++argv, "--kms-uri")) {
+ fprintf(stderr, "ERROR: the first option must be --kms-uri\n");
+ return 1;
+ }
+ const char* kms_uri = *++argv;
+
+ // create an encrypting processor
+ AP4_IsmaEncryptingProcessor processor(kms_uri);
+
+ // setup default values
+ const char* input_filename = NULL;
+ const char* output_filename = NULL;
+
+ char* arg;
+ while ((arg = *++argv)) {
+ if (!strcmp(arg, "--key")) {
+ arg = *++argv;
+ if (arg == NULL) {
+ fprintf(stderr, "ERROR: missing argument for --key option\n");
+ return 1;
+ }
+ char* track_ascii = NULL;
+ char* key_ascii = NULL;
+ char* salt_ascii = NULL;
+ if (AP4_FAILED(AP4_SplitArgs(arg, track_ascii, key_ascii, salt_ascii))) {
+ fprintf(stderr, "ERROR: invalid argument for --key option\n");
+ return 1;
+ }
+ unsigned char key[16];
+ unsigned char salt[8];
+ unsigned int track = strtoul(track_ascii, NULL, 10);
+ if (AP4_ParseHex(key_ascii, key, 16)) {
+ fprintf(stderr, "ERROR: invalid hex format for key\n");
+ }
+ if (AP4_ParseHex(salt_ascii, salt, 8)) {
+ fprintf(stderr, "ERROR: invalid hex format for salt\n");
+ }
+ // set the key in the map
+ processor.GetKeyMap().SetKey(track, key, salt);
+ } else if (input_filename == NULL) {
+ input_filename = arg;
+ } else if (output_filename == NULL) {
+ output_filename = arg;
+ } else {
+ fprintf(stderr, "ERROR: unexpected argument (%s)\n", arg);
+ return 1;
+ }
+ }
+
+ // check the arguments
+ if (input_filename == NULL) {
+ fprintf(stderr, "ERROR: missing input filename\n");
+ return 1;
+ }
+ if (output_filename == NULL) {
+ fprintf(stderr, "ERROR: missing output filename\n");
+ return 1;
+ }
+ if (kms_uri == NULL) {
+ fprintf(stderr, "ERROR: missing kms uri\n");
+ return 1;
+ }
+
+ // create the input stream
+ AP4_ByteStream* input;
+ try{
+ input = new AP4_FileByteStream(input_filename,
+ AP4_FileByteStream::STREAM_MODE_READ);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename);
+ return 1;
+ }
+
+ // create the output stream
+ AP4_ByteStream* output;
+ try {
+ output = new AP4_FileByteStream(output_filename,
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename);
+ return 1;
+ }
+
+ // process/decrypt the file
+ processor.Process(*input, *output);
+
+ // cleanup
+ input->Release();
+ output->Release();
+
+ return 0;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Extract/Mp4Extract.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Extract/Mp4Extract.cpp
new file mode 100644
index 000000000..c669ab09d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Extract/Mp4Extract.cpp
@@ -0,0 +1,155 @@
+/*****************************************************************
+|
+| AP4 - MP4 File Processor
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4FileByteStream.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "MP4 Atom Extractor - Version 0.5a\n"\
+ "(c) 2003-2005 Gilles Boccon-Gibod & Julien Boeuf"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\nusage: mp4extract [options] <atom_path> <input> <output>\n"
+ " options:\n"
+ " --payload-only : ommit the atom header\n");
+ exit(1);
+}
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ if (argc < 4) {
+ PrintUsageAndExit();
+ }
+
+ // parse arguments
+ const char* atom_path = NULL;
+ const char* input_filename = NULL;
+ const char* output_filename = NULL;
+ bool payload_only = false;
+ char* arg;
+ while ((arg = *++argv)) {
+ if (!strcmp(arg, "--payload-only")) {
+ payload_only = true;
+ } else if (atom_path == NULL) {
+ atom_path = arg;
+ } else if (input_filename == NULL) {
+ input_filename = arg;
+ } else if (output_filename == NULL) {
+ output_filename = arg;
+ } else {
+ fprintf(stderr, "ERROR: invalid command line argument (%s)\n", arg);
+ return 1;
+ }
+ }
+
+ // check arguments
+ if (atom_path == NULL) {
+ fprintf(stderr, "ERROR: missing atom path\n");
+ return 1;
+ }
+ if (input_filename == NULL) {
+ fprintf(stderr, "ERROR: missing input filename\n");
+ return 1;
+ }
+ if (output_filename == NULL) {
+ fprintf(stderr, "ERROR: missing output filename\n");
+ return 1;
+ }
+
+ // create the input stream
+ AP4_ByteStream* input;
+ try {
+ input = new AP4_FileByteStream(input_filename,
+ AP4_FileByteStream::STREAM_MODE_READ);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open input file (%s)\n", input_filename);
+ return 1;
+ }
+
+ // parse the atoms
+ AP4_AtomParent top_level;
+ AP4_Atom* atom;
+ AP4_AtomFactory& atom_factory = AP4_AtomFactory::DefaultFactory;
+ while (atom_factory.CreateAtomFromStream(*input, atom) == AP4_SUCCESS) {
+ top_level.AddChild(atom);
+ }
+
+ // release the input
+ input->Release();
+
+ // find the atom
+ atom = top_level.FindChild(atom_path);
+ if (atom == NULL) {
+ fprintf(stderr, "ERROR: atom '%s' not found\n", atom_path);
+ return 1;
+ }
+
+ // create the output stream
+ AP4_ByteStream* output;
+ try {
+ output = new AP4_FileByteStream(output_filename,
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open output file (%s)\n", output_filename);
+ return 1;
+ }
+
+ // write the atom
+ if (payload_only) {
+ atom->WriteFields(*output);
+ } else {
+ atom->Write(*output);
+ }
+
+ // cleanup
+ output->Release();
+
+ return 0;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Info/Mp4Info.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Info/Mp4Info.cpp
new file mode 100644
index 000000000..d03667f0e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Info/Mp4Info.cpp
@@ -0,0 +1,227 @@
+/*****************************************************************
+|
+| AP4 - MP4 File Info
+|
+| Copyright 2002-2205 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4FileByteStream.h"
+#include "Ap4Atom.h"
+#include "Ap4File.h"
+#include "Ap4Sample.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4IsmaCryp.h"
+#include "Ap4IsfmAtom.h"
+#include "Ap4IkmsAtom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "MP4 File Info - Version 0.1a\n"\
+ "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\nusage: mp4info [options] <input>\n");
+ exit(1);
+}
+
+/*----------------------------------------------------------------------
+| ShowIsmaSampleDescription
++---------------------------------------------------------------------*/
+static void
+ShowIsmaSampleDescription(AP4_IsmaCrypSampleDescription* description)
+{
+ if (description == NULL) return;
+ AP4_Debug(" [ENCRYPTED]\n");
+ AP4_UI32 st = description->GetSchemeType();
+ AP4_Debug(" Scheme Type: %c%c%c%c\n",
+ (char)((st>>24) & 0xFF),
+ (char)((st>>16) & 0xFF),
+ (char)((st>> 8) & 0xFF),
+ (char)((st ) & 0xFF));
+ AP4_Debug(" Scheme Version: %d\n", description->GetSchemeVersion());
+ AP4_Debug(" Scheme URI: %s\n", description->GetSchemeUri().c_str());
+ AP4_IsmaCrypSchemeInfo* scheme_info = description->GetSchemeInfo();
+ if (scheme_info == NULL) return;
+ if (description->GetSchemeType() != AP4_ISMACRYP_SCHEME_TYPE_IAEC) {
+ return;
+ }
+
+ AP4_Debug(" iAEC Scheme Info:\n");
+ AP4_IkmsAtom* ikms = (AP4_IkmsAtom*)scheme_info->GetSchiAtom().FindChild("iKMS");
+ if (ikms) {
+ AP4_Debug(" KMS URI: %s\n", ikms->GetKmsUri().c_str());
+ }
+ AP4_IsfmAtom* isfm = (AP4_IsfmAtom*)scheme_info->GetSchiAtom().FindChild("iSFM");
+ if (isfm) {
+ AP4_Debug(" Selective Encryption: %s\n", isfm->GetSelectiveEncryption()?"yes":"no");
+ AP4_Debug(" Key Indicator Length: %d\n", isfm->GetKeyIndicatorLength());
+ AP4_Debug(" IV Length: %d\n", isfm->GetIvLength());
+ }
+}
+
+/*----------------------------------------------------------------------
+| ShowSampleDescription
++---------------------------------------------------------------------*/
+static void
+ShowSampleDescription(AP4_SampleDescription* desc)
+{
+ AP4_SampleDescription::Type type = desc->GetType();
+
+ AP4_MpegSampleDescription* mpeg_desc = NULL;
+ if (type == AP4_SampleDescription::TYPE_MPEG) {
+ mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(desc);
+ } else if (type == AP4_SampleDescription::TYPE_ISMACRYP) {
+ AP4_IsmaCrypSampleDescription* isma_desc = dynamic_cast<AP4_IsmaCrypSampleDescription*>(desc);
+ ShowIsmaSampleDescription(isma_desc);
+ mpeg_desc = isma_desc->GetOriginalSampleDescription();
+ }
+ if (mpeg_desc) {
+ AP4_Debug(" Stream Type: %s\n", mpeg_desc->GetStreamTypeString(mpeg_desc->GetStreamType()));
+ AP4_Debug(" Object Type: %s\n", mpeg_desc->GetObjectTypeString(mpeg_desc->GetObjectTypeId()));
+ AP4_Debug(" Max Bitrate: %d\n", mpeg_desc->GetMaxBitrate());
+ AP4_Debug(" Avg Bitrate: %d\n", mpeg_desc->GetAvgBitrate());
+ AP4_Debug(" Buffer Size: %d\n", mpeg_desc->GetBufferSize());
+ if (mpeg_desc->GetStreamType() == AP4_AUDIO_STREAM_TYPE) {
+ AP4_MpegAudioSampleDescription* audio_desc =
+ dynamic_cast<AP4_MpegAudioSampleDescription*>(mpeg_desc);
+ AP4_Debug(" Sample Rate: %d\n", audio_desc->GetSampleRate());
+ AP4_Debug(" Sample Size: %d\n", audio_desc->GetSampleSize());
+ AP4_Debug(" Channels: %d\n", audio_desc->GetChannelCount());
+ } else if (mpeg_desc->GetStreamType() == AP4_VISUAL_STREAM_TYPE) {
+ AP4_MpegVideoSampleDescription* video_desc =
+ dynamic_cast<AP4_MpegVideoSampleDescription*>(mpeg_desc);
+ AP4_Debug(" Width: %d\n", video_desc->GetWidth());
+ AP4_Debug(" Height: %d\n", video_desc->GetHeight());
+ AP4_Debug(" Depth: %d\n", video_desc->GetDepth());
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| ShowTrackInfo
++---------------------------------------------------------------------*/
+static void
+ShowTrackInfo(AP4_Track* track)
+{
+ AP4_Debug(" type: ");
+ switch (track->GetType()) {
+ case AP4_Track::TYPE_AUDIO: AP4_Debug("Audio\n"); break;
+ case AP4_Track::TYPE_VIDEO: AP4_Debug("Video\n"); break;
+ case AP4_Track::TYPE_HINT: AP4_Debug("Hint\n"); break;
+ default: AP4_Debug("System\n");break;
+ }
+ AP4_Debug(" duration: %ld ms\n", track->GetDurationMs());
+ AP4_Debug(" timescale: %ld\n", track->GetMediaTimeScale());
+ AP4_Debug(" sample count: %ld\n", track->GetSampleCount());
+ AP4_Sample sample;
+ AP4_Ordinal index = 0;
+ AP4_Ordinal desc_index = 0xFFFFFFFF;
+ while (AP4_SUCCEEDED(track->GetSample(index, sample))) {
+ if (sample.GetDescriptionIndex() != desc_index) {
+ desc_index = sample.GetDescriptionIndex();
+ AP4_Debug(" [%d]: Format %d\n", index, desc_index);
+
+ // get the sample description
+ AP4_SampleDescription* sample_desc =
+ track->GetSampleDescription(desc_index);
+ if (sample_desc != NULL) {
+ ShowSampleDescription(sample_desc);
+ }
+ }
+ index++;
+ }
+}
+
+/*----------------------------------------------------------------------
+| ShowMovieInfo
++---------------------------------------------------------------------*/
+static void
+ShowMovieInfo(AP4_Movie* movie)
+{
+ AP4_Debug("Movie:\n");
+ AP4_Debug(" duration: %ld ms\n", movie->GetDurationMs());
+ AP4_Debug(" time scale: %ld\n", movie->GetTimeScale());
+ AP4_Debug("\n");
+}
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ if (argc < 2) {
+ PrintUsageAndExit();
+ }
+
+ AP4_ByteStream* input;
+ try {
+ input = new AP4_FileByteStream(argv[1],
+ AP4_FileByteStream::STREAM_MODE_READ);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open input file (%s)\n", argv[1]);
+ return 1;
+ }
+
+ AP4_File* file = new AP4_File(*input);
+
+ AP4_Movie* movie = file->GetMovie();
+ if (movie != NULL) {
+ ShowMovieInfo(movie);
+
+ AP4_List<AP4_Track>& tracks = movie->GetTracks();
+ AP4_Debug("Found %d Tracks\n", tracks.ItemCount());
+
+ AP4_List<AP4_Track>::Item* track_item = tracks.FirstItem();
+ int index = 1;
+ while (track_item) {
+ AP4_Debug("Track %d:\n", index);
+ index++;
+ ShowTrackInfo(track_item->GetData());
+ track_item = track_item->GetNext();
+ }
+ } else {
+ AP4_Debug("No movie found in the file\n");
+ }
+
+ delete file;
+ input->Release();
+
+ return 0;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4RtpHintInfo/Mp4RtpHintInfo.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4RtpHintInfo/Mp4RtpHintInfo.cpp
new file mode 100644
index 000000000..d54b7f371
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4RtpHintInfo/Mp4RtpHintInfo.cpp
@@ -0,0 +1,146 @@
+/*****************************************************************
+|
+| AP4 - MP4 Rtp Hint Info
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4HintTrackReader.h"
+#include "Ap4ByteStream.h"
+#include "Ap4File.h"
+#include "Ap4Movie.h"
+#include "Ap4FileByteStream.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "MP4 Rtp Hint Info - Version 0.1a\n"\
+ "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\nusage: mp4rtphintinfo [options] <input>\n");
+ exit(1);
+}
+
+/*----------------------------------------------------------------------
+| DumpRtpPackets
++---------------------------------------------------------------------*/
+static AP4_Result
+DumpRtpPackets(AP4_HintTrackReader& reader, const char* file_name)
+{
+ // create the output stream
+ AP4_ByteStream* output;
+ try {
+ output = new AP4_FileByteStream(file_name,
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open output file (%s)\n", file_name);
+ return AP4_FAILURE;
+ }
+
+ // read the packets from the reader and write them in the output stream
+ AP4_DataBuffer data(1500);
+ AP4_TimeStamp ts;
+ while(AP4_SUCCEEDED(reader.GetNextPacket(data, ts))) {
+ output->Write(data.GetData(), data.GetDataSize());
+ AP4_Debug("#########\n\tpacket contains %d bytes\n", data.GetDataSize());
+ AP4_Debug("\tsent at time stamp %d\n\n", ts);
+ }
+
+ output->Release();
+
+ return AP4_SUCCESS;
+}
+
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ AP4_Result result = AP4_SUCCESS;
+
+ // parse the command line
+ if (argc != 2) PrintUsageAndExit();
+
+ // create the input stream
+ AP4_ByteStream* input;
+ try {
+ input = new AP4_FileByteStream(argv[1],
+ AP4_FileByteStream::STREAM_MODE_READ);
+ } catch (AP4_Exception) {
+ fprintf(stderr, "ERROR: cannot open input file (%s)\n", argv[1]);
+ return 1;
+ }
+
+ AP4_File* file = new AP4_File(*input);
+
+
+ AP4_Movie* movie = file->GetMovie();
+ if (movie != NULL) {
+ // get a hint track reader
+ AP4_Track* hint_track = movie->GetTrack(AP4_Track::TYPE_HINT, 1);
+ if (hint_track == NULL) {
+ AP4_Debug("No hint track in this movie\n");
+ return AP4_FAILURE;
+ }
+ AP4_HintTrackReader reader(*hint_track, *movie, 0x01020304);
+ AP4_String rtp_file_name(argv[1]);
+ rtp_file_name += ".rtp";
+
+ // display the sdp
+ AP4_String sdp;
+ reader.GetSdpText(sdp);
+ AP4_Debug("sdp:\n%s\n\n", sdp.c_str());
+
+ // dump the packet
+ result = DumpRtpPackets(reader, rtp_file_name.c_str());
+ if (AP4_FAILED(result)) goto bail;
+
+ } else {
+ AP4_Debug("No movie found in the file\n");
+ return AP4_FAILURE;
+ }
+
+bail:
+ delete file;
+ input->Release();
+
+ return result;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Tag/Mp4Tag.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Tag/Mp4Tag.cpp
new file mode 100644
index 000000000..1dcff3c73
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Apps/Mp4Tag/Mp4Tag.cpp
@@ -0,0 +1,85 @@
+/*****************************************************************
+|
+| AP4 - MP4 File Tagger
+|
+| Copyright 2002-2003 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "Ap4.h"
+#include "Ap4FileByteStream.h"
+#include "Ap4Atom.h"
+#include "Ap4File.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define BANNER "MP4 File Tagger - Version 0.1a\n"\
+ "(c) 2002-2005 Gilles Boccon-Gibod & Julien Boeuf"
+
+/*----------------------------------------------------------------------
+| PrintUsageAndExit
++---------------------------------------------------------------------*/
+static void
+PrintUsageAndExit()
+{
+ fprintf(stderr,
+ BANNER
+ "\n\nusage: mp4tag [options] <input> <output>\n");
+ exit(1);
+}
+
+/*----------------------------------------------------------------------
+| main
++---------------------------------------------------------------------*/
+int
+main(int argc, char** argv)
+{
+ if (argc < 3) {
+ PrintUsageAndExit();
+ }
+
+ AP4_ByteStream* input =
+ new AP4_FileByteStream(argv[1],
+ AP4_FileByteStream::STREAM_MODE_READ);
+ AP4_ByteStream* output =
+ new AP4_FileByteStream(argv[2],
+ AP4_FileByteStream::STREAM_MODE_WRITE);
+
+ AP4_File* file = new AP4_File(*input);
+ //file->Write(output);
+
+ printf("Successfully wrote %s in %s\n", argv[1], argv[2]);
+
+ delete file;
+ delete input;
+ delete output;
+
+ return 0;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4AdtsParser.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4AdtsParser.cpp
new file mode 100644
index 000000000..c5f050d0c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4AdtsParser.cpp
@@ -0,0 +1,303 @@
+
+/*****************************************************************
+|
+| File: Ap4AdtsParser.c
+|
+| AP4 - ADTS Parser
+|
+| (c) 2005 Gilles Boccon-Gibod
+| Author: Gilles Boccon-Gibod (bok@bok.net)
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4BitStream.h"
+#include "Ap4AdtsParser.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define AP4_ADTS_HEADER_SIZE 7
+
+#define AP4_ADTS_SYNC_MASK 0xFFF6 /* 12 sync bits plus 2 layer bits */
+#define AP4_ADTS_SYNC_PATTERN 0xFFF0 /* 12 sync bits=1 layer=0 */
+
+const unsigned long
+AP4_AdtsSamplingFrequencyTable[16] =
+{
+ 96000,
+ 88200,
+ 64000,
+ 48000,
+ 44100,
+ 32000,
+ 24000,
+ 22050,
+ 16000,
+ 12000,
+ 11025,
+ 8000,
+ 7350,
+ 0, /* Reserved */
+ 0, /* Reserved */
+ 0 /* Escape code */
+};
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsHeader::AP4_AdtsHeader
++----------------------------------------------------------------------*/
+AP4_AdtsHeader::AP4_AdtsHeader(const AP4_UI08* bytes)
+{
+ // fixed part
+ m_Id = ( bytes[1] & 0x08) >> 3;
+ m_ProtectionAbsent = bytes[1] & 0x01;
+ m_ProfileObjectType = ( bytes[2] & 0xC0) >> 6;
+ m_SamplingFrequencyIndex = ( bytes[2] & 0x3C) >> 2;
+ m_ChannelConfiguration = ((bytes[2] & 0x01) << 2) |
+ ((bytes[3] & 0xC0) >> 6);
+ // variable part
+ m_FrameLength = ((unsigned int)(bytes[3] & 0x03) << 11) |
+ ((unsigned int)(bytes[4] ) << 3) |
+ ((unsigned int)(bytes[5] & 0xE0) >> 5);
+ m_RawDataBlocks = bytes[6] & 0x03;
+}
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsHeader::MatchFixed
+|
+| Check that two fixed headers are the same
+|
++----------------------------------------------------------------------*/
+bool
+AP4_AdtsHeader::MatchFixed(unsigned char* a, unsigned char* b)
+{
+ if (a[0] == b[0] &&
+ a[1] == b[1] &&
+ a[2] == b[2] &&
+ (a[3] & 0xF0) == (b[3] & 0xF0)) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsHeader::Check
++----------------------------------------------------------------------*/
+AP4_Result
+AP4_AdtsHeader::Check()
+{
+ // check that the sampling frequency index is valid
+ if (m_SamplingFrequencyIndex >= 0xD) {
+ return AP4_FAILURE;
+ }
+
+ /* MPEG2 does not use all profiles */
+ if (m_Id == 1 && m_ProfileObjectType == 3) {
+ return AP4_FAILURE;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsParser::AP4_AdtsParser
++----------------------------------------------------------------------*/
+AP4_AdtsParser::AP4_AdtsParser()
+{
+}
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsParser::~AP4_AdtsParser
++----------------------------------------------------------------------*/
+AP4_AdtsParser::~AP4_AdtsParser()
+{
+}
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsParser::Reset
++----------------------------------------------------------------------*/
+AP4_Result
+AP4_AdtsParser::Reset()
+{
+ m_FrameCount = 0;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsParser::Feed
++----------------------------------------------------------------------*/
+AP4_Result
+AP4_AdtsParser::Feed(const AP4_UI08* buffer,
+ AP4_Size* buffer_size,
+ AP4_Flags flags)
+{
+ AP4_Size free_space;
+
+ /* update flags */
+ m_Bits.m_Flags = flags;
+
+ /* possible shortcut */
+ if (buffer == NULL ||
+ buffer_size == NULL ||
+ *buffer_size == 0) {
+ return AP4_SUCCESS;
+ }
+
+ /* see how much data we can write */
+ free_space = m_Bits.GetBytesFree();
+ if (*buffer_size > free_space) *buffer_size = free_space;
+
+ /* write the data */
+ return m_Bits.WriteBytes(buffer, *buffer_size);
+}
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsParser::FindHeader
++----------------------------------------------------------------------*/
+AP4_Result
+AP4_AdtsParser::FindHeader(AP4_UI08* header)
+{
+ int available = m_Bits.GetBytesAvailable();
+ unsigned int sync = 0;
+ long nbr_skipped_bytes = 0;
+
+ /* look for the sync pattern */
+ while (available-- >= AP4_ADTS_HEADER_SIZE) {
+ sync = (m_Bits.ReadByte() << 8) | m_Bits.PeekByte();
+
+ if ((sync & AP4_ADTS_SYNC_MASK) == AP4_ADTS_SYNC_PATTERN) {
+ /* found a sync pattern, read the rest of the header */
+ header[0] = (sync >> 8) & 0xFF;
+ m_Bits.ReadBytes(&header[1], AP4_ADTS_HEADER_SIZE-1);
+
+ return AP4_SUCCESS;
+ } else {
+ ++ nbr_skipped_bytes;
+ }
+ }
+
+ return AP4_ERROR_NOT_ENOUGH_DATA;
+}
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsParser::FindFrame
++----------------------------------------------------------------------*/
+AP4_Result
+AP4_AdtsParser::FindFrame(AP4_AacFrame& frame)
+{
+ unsigned int available;
+ unsigned char raw_header[AP4_ADTS_HEADER_SIZE];
+ AP4_Result result;
+
+ /* align to the start of the next byte */
+ m_Bits.ByteAlign();
+
+ /* find a frame header */
+ result = FindHeader(raw_header);
+ if (AP4_FAILED(result)) return result;
+
+ /* parse the header */
+ AP4_AdtsHeader adts_header(raw_header);
+
+ /* check the header */
+ result = adts_header.Check();
+ if (AP4_FAILED(result)) goto fail;
+
+ /* check that we have enough data to peek at the next header */
+ available = AP4_ADTS_HEADER_SIZE + m_Bits.GetBytesAvailable();
+ if (m_Bits.m_Flags & AP4_BITSTREAM_FLAG_EOS) {
+ /* we're at the end of the stream, we only need the entire frame */
+ if (available < adts_header.m_FrameLength) {
+ return AP4_ERROR_NOT_ENOUGH_DATA;
+ }
+ } else {
+ /* peek at the header of the next frame */
+ unsigned char peek_raw_header[AP4_ADTS_HEADER_SIZE];
+
+ if (available < adts_header.m_FrameLength+AP4_ADTS_HEADER_SIZE) {
+ return AP4_ERROR_NOT_ENOUGH_DATA;
+ }
+ m_Bits.SkipBytes(adts_header.m_FrameLength-AP4_ADTS_HEADER_SIZE);
+ m_Bits.PeekBytes(peek_raw_header, AP4_ADTS_HEADER_SIZE);
+ m_Bits.SkipBytes(-((int)adts_header.m_FrameLength-AP4_ADTS_HEADER_SIZE));
+
+ /* check the header */
+ AP4_AdtsHeader peek_adts_header(peek_raw_header);
+ result = peek_adts_header.Check();
+ if (AP4_FAILED(result)) goto fail;
+
+ /* check that the fixed part of this header is the same as the */
+ /* fixed part of the previous header */
+ if (!AP4_AdtsHeader::MatchFixed(peek_raw_header, raw_header)) {
+ goto fail;
+ }
+ }
+
+ /* fill in the frame info */
+ frame.m_Info.m_Standard = (adts_header.m_Id == 1 ?
+ AP4_AAC_STANDARD_MPEG2 :
+ AP4_AAC_STANDARD_MPEG4);
+ switch (adts_header.m_ProfileObjectType) {
+ case 0:
+ frame.m_Info.m_Profile = AP4_AAC_PROFILE_MAIN;
+ break;
+
+ case 1:
+ frame.m_Info.m_Profile = AP4_AAC_PROFILE_LC;
+ break;
+
+ case 2:
+ frame.m_Info.m_Profile = AP4_AAC_PROFILE_SSR;
+ break;
+
+ case 3:
+ frame.m_Info.m_Profile = AP4_AAC_PROFILE_LTP;
+ }
+ frame.m_Info.m_FrameLength = adts_header.m_FrameLength-AP4_ADTS_HEADER_SIZE;
+ frame.m_Info.m_ChannelConfiguration = adts_header.m_ChannelConfiguration;
+ frame.m_Info.m_SamplingFrequencyIndex = adts_header.m_SamplingFrequencyIndex;
+ frame.m_Info.m_SamplingFrequency = AP4_AdtsSamplingFrequencyTable[adts_header.m_SamplingFrequencyIndex];
+
+ /* skip crc if present */
+ if (adts_header.m_ProtectionAbsent == 0) {
+ m_Bits.SkipBits(16);
+ }
+
+ /* set the frame source */
+ frame.m_Source = &m_Bits;
+
+ return AP4_SUCCESS;
+
+fail:
+ /* skip the header and return (only skip the first byte in */
+ /* case this was a false header that hides one just after) */
+ //m_Bits.SkipBytes(-(AP4_ADTS_HEADER_SIZE-1));
+ return AP4_ERROR_CORRUPTED_BITSTREAM;
+}
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsParser::GetBytesFree
++----------------------------------------------------------------------*/
+AP4_Size
+AP4_AdtsParser::GetBytesFree()
+{
+ return (m_Bits.GetBytesFree());
+}
+
+
+
+/*----------------------------------------------------------------------+
+| AP4_AdtsParser::GetBytesAvailable
++----------------------------------------------------------------------*/
+AP4_Size
+AP4_AdtsParser::GetBytesAvailable()
+{
+ return (m_Bits.GetBytesAvailable());
+}
+
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4AdtsParser.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4AdtsParser.h
new file mode 100644
index 000000000..606fe8919
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4AdtsParser.h
@@ -0,0 +1,105 @@
+/*****************************************************************
+|
+| File: Ap4AdtsParser.h
+|
+| AP4 - ADTS Parser
+|
+| (c) 2005 Gilles Boccon-Gibod
+| Author: Gilles Boccon-Gibod (bok@bok.net)
+|
+ ****************************************************************/
+
+#ifndef _AP4_ADTS_PARSER_H_
+#define _AP4_ADTS_PARSER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4BitStream.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+extern const unsigned long AP4_AdtsSamplingFrequencyTable[16];
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+class AP4_AdtsHeader {
+public:
+ // constructor
+ AP4_AdtsHeader(const AP4_UI08* bytes);
+
+ // methods
+ AP4_Result Check();
+
+ // members
+
+ // fixed part
+ unsigned int m_Id;
+ unsigned int m_ProtectionAbsent;
+ unsigned int m_ProfileObjectType;
+ unsigned int m_SamplingFrequencyIndex;
+ unsigned int m_ChannelConfiguration;
+
+ // variable part
+ unsigned int m_FrameLength;
+ unsigned int m_RawDataBlocks;
+
+ // class methods
+ static bool MatchFixed(unsigned char* a, unsigned char* b);
+};
+
+typedef enum {
+ AP4_AAC_STANDARD_MPEG2,
+ AP4_AAC_STANDARD_MPEG4
+} AP4_AacStandard;
+
+typedef enum {
+ AP4_AAC_PROFILE_MAIN,
+ AP4_AAC_PROFILE_LC,
+ AP4_AAC_PROFILE_SSR,
+ AP4_AAC_PROFILE_LTP
+} AP4_AacProfile;
+
+typedef struct {
+ AP4_AacStandard m_Standard;
+ AP4_AacProfile m_Profile;
+ unsigned int m_SamplingFrequencyIndex;
+ unsigned long m_SamplingFrequency;
+ unsigned int m_ChannelConfiguration;
+ unsigned int m_FrameLength;
+} AP4_AacFrameInfo;
+
+typedef struct {
+ AP4_BitStream* m_Source;
+ AP4_AacFrameInfo m_Info;
+} AP4_AacFrame;
+
+class AP4_AdtsParser {
+public:
+ // constructor and destructor
+ AP4_AdtsParser();
+ virtual ~AP4_AdtsParser();
+
+ // methods
+ AP4_Result Reset();
+ AP4_Result Feed(const AP4_UI08* buffer,
+ AP4_Size* buffer_size,
+ AP4_Flags flags = 0);
+ AP4_Result FindFrame(AP4_AacFrame& frame);
+ AP4_Result Skip(AP4_Size size);
+ AP4_Size GetBytesFree();
+ AP4_Size GetBytesAvailable();
+
+private:
+ // methods
+ AP4_Result FindHeader(AP4_UI08* header);
+
+ // members
+ AP4_BitStream m_Bits;
+ AP4_Cardinal m_FrameCount;
+};
+
+#endif // _AP4_ADTS_PARSER_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4BitStream.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4BitStream.cpp
new file mode 100644
index 000000000..368acc8ec
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4BitStream.cpp
@@ -0,0 +1,250 @@
+/*****************************************************************
+|
+| File: Ap4BitStream.c
+|
+| AP4 - Bit Streams
+|
+| (c) 2004 Gilles Boccon-Gibod
+| Author: Gilles Boccon-Gibod (bok@bok.net)
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| For efficiency reasons, this bitstream library only handles
+| data buffers that are a power of 2 in size
++---------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4BitStream.h"
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::AP4_BitStream
++---------------------------------------------------------------------*/
+AP4_BitStream::AP4_BitStream()
+{
+ m_Buffer = new AP4_UI08[AP4_BITSTREAM_BUFFER_SIZE];
+ Reset();
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::~AP4_BitStream
++---------------------------------------------------------------------*/
+AP4_BitStream::~AP4_BitStream()
+{
+ delete[] m_Buffer;
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::Reset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_BitStream::Reset()
+{
+ m_In = 0;
+ m_Out = 0;
+ m_BitsCached = 0;
+ m_Cache = 0;
+ m_Flags = 0;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::ByteAlign
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_BitStream::ByteAlign()
+{
+ unsigned int to_flush = m_BitsCached & 7;
+ if (to_flush > 0) SkipBits(to_flush);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::GetContiguousBytesFree
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_BitStream::GetContiguousBytesFree()
+{
+ return
+ (m_In < m_Out) ?
+ (m_Out - m_In - 1) :
+ (m_Out == 0 ? (AP4_BITSTREAM_BUFFER_SIZE - m_In - 1) :
+ (AP4_BITSTREAM_BUFFER_SIZE - m_In));
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream_GetBytesFree
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_BitStream::GetBytesFree()
+{
+ return
+ (m_In < m_Out) ?
+ (m_Out - m_In - 1) :
+ (AP4_BITSTREAM_BUFFER_SIZE + (m_Out - m_In) - 1);
+}
+
+/*----------------------------------------------------------------------+
+| AP4_BitStream::WriteBytes
++----------------------------------------------------------------------*/
+AP4_Result
+AP4_BitStream::WriteBytes(const AP4_UI08* bytes,
+ AP4_Size byte_count)
+{
+ /* check parameters */
+ if (byte_count == 0) return AP4_SUCCESS;
+ if (bytes == NULL) return AP4_ERROR_INVALID_PARAMETERS;
+
+ /* check that we have enough space */
+ if (GetBytesFree() < byte_count) {
+ return AP4_FAILURE;
+ }
+
+ /* write the bytes */
+ if (m_In < m_Out) {
+ memcpy(m_Buffer+m_In, bytes, byte_count);
+ AP4_BITSTREAM_POINTER_ADD(m_In, byte_count);
+ } else {
+ unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - m_In;
+ if (chunk > byte_count) chunk = byte_count;
+
+ memcpy(m_Buffer+m_In, bytes, chunk);
+ AP4_BITSTREAM_POINTER_ADD(m_In, chunk);
+
+ if (chunk != byte_count) {
+ memcpy(m_Buffer+m_In,
+ bytes+chunk, byte_count-chunk);
+ AP4_BITSTREAM_POINTER_ADD(m_In, byte_count-chunk);
+ }
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream_GetContiguousBytesAvailable
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_BitStream::GetContiguousBytesAvailable()
+{
+ return
+ (m_Out <= m_In) ?
+ (m_In - m_Out) :
+ (AP4_BITSTREAM_BUFFER_SIZE - m_Out);
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::GetBytesAvailable
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_BitStream::GetBytesAvailable()
+{
+ return
+ (m_Out <= m_In) ?
+ (m_In - m_Out) :
+ (m_In + (AP4_BITSTREAM_BUFFER_SIZE - m_Out));
+}
+
+/*----------------------------------------------------------------------+
+| AP4_BitStream::ReadBytes
++----------------------------------------------------------------------*/
+AP4_Result
+AP4_BitStream::ReadBytes(AP4_UI08* bytes,
+ AP4_Size byte_count)
+{
+ if (byte_count == 0 || bytes == NULL) {
+ return AP4_ERROR_INVALID_PARAMETERS;
+ }
+
+ /* Gets bytes from the cache */
+ ByteAlign();
+ while (m_BitsCached > 0 && byte_count > 0) {
+ *bytes = ReadBits(8);
+ ++ bytes;
+ -- byte_count;
+ }
+
+ /* Get other bytes */
+ if (byte_count > 0) {
+ if (m_Out < m_In) {
+ memcpy(bytes, m_Buffer + m_Out, byte_count);
+ AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count);
+ } else {
+ unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - m_Out;
+ if (chunk >= byte_count) chunk = byte_count;
+
+ memcpy(bytes, m_Buffer+m_Out, chunk);
+ AP4_BITSTREAM_POINTER_ADD(m_Out, chunk);
+
+ if (chunk != byte_count) {
+ memcpy(bytes+chunk,
+ m_Buffer+m_Out,
+ byte_count-chunk);
+ AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count-chunk);
+ }
+ }
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------+
+| AP4_BitStream::PeekBytes
++----------------------------------------------------------------------*/
+AP4_Result
+AP4_BitStream::PeekBytes(AP4_UI08* bytes,
+ AP4_Size byte_count)
+{
+ int bits_cached_byte;
+
+ if (byte_count == 0 || bytes == NULL) {
+ return AP4_ERROR_INVALID_PARAMETERS;
+ }
+
+ /* Gets bytes from the cache */
+ bits_cached_byte = m_BitsCached & ~7;
+ while (bits_cached_byte > 0 && byte_count > 0) {
+ *bytes = (m_Cache >> bits_cached_byte) & 0xFF;
+ ++ bytes;
+ -- byte_count;
+ bits_cached_byte -= 8;
+ }
+
+ /* Get other bytes */
+ if (byte_count > 0) {
+ if (m_In > m_Out) {
+ memcpy(bytes, m_Buffer + m_Out, byte_count);
+ } else {
+ unsigned int out = m_Out;
+ unsigned int chunk = AP4_BITSTREAM_BUFFER_SIZE - out;
+ if (chunk >= byte_count) {
+ chunk = byte_count;
+ }
+
+ memcpy(bytes, m_Buffer+out, chunk);
+ AP4_BITSTREAM_POINTER_ADD(out, chunk);
+
+ if (chunk != byte_count) {
+ memcpy(bytes+chunk,
+ m_Buffer+out,
+ byte_count-chunk);
+ }
+ }
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------+
+| AP4_BitStream::SkipBytes
++----------------------------------------------------------------------*/
+AP4_Result
+AP4_BitStream::SkipBytes(AP4_Size byte_count)
+{
+ AP4_BITSTREAM_POINTER_ADD(m_Out, byte_count);
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4BitStream.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4BitStream.h
new file mode 100644
index 000000000..0bc71947e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Codecs/Ap4BitStream.h
@@ -0,0 +1,292 @@
+/*****************************************************************
+|
+| File: Ap4BitStream.h
+|
+| AP4 - Bit Streams
+|
+| (c) 2005 Gilles Boccon-Gibod
+| Author: Gilles Boccon-Gibod (bok@bok.net)
+|
+ ****************************************************************/
+
+#ifndef _AP4_BIT_STREAM_H_
+#define _AP4_BIT_STREAM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+#define AP4_ERROR_BASE_BITSTREAM -10000
+
+/* the max frame size we can handle */
+#define AP4_BITSTREAM_BUFFER_SIZE 8192
+
+/* flags */
+#define AP4_BITSTREAM_FLAG_EOS 0x01
+
+/* error codes */
+#define AP4_ERROR_NOT_ENOUGH_DATA (AP4_ERROR_BASE_BITSTREAM - 0)
+#define AP4_ERROR_CORRUPTED_BITSTREAM (AP4_ERROR_BASE_BITSTREAM - 1)
+#define AP4_ERROR_NOT_ENOUGH_FREE_BUFFER (AP4_ERROR_BASE_BITSTREAM - 2)
+
+/*----------------------------------------------------------------------
+| types helpers
++---------------------------------------------------------------------*/
+/* use long by default */
+typedef unsigned int AP4_BitsWord;
+#define AP4_WORD_BITS 32
+#define AP4_WORD_BYTES 4
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+class AP4_BitStream
+{
+public:
+ // constructor and destructor
+ AP4_BitStream();
+ ~AP4_BitStream();
+
+ // methods
+ AP4_Result Reset();
+ AP4_Size GetContiguousBytesFree();
+ AP4_Size GetBytesFree();
+ AP4_Result WriteBytes(const AP4_UI08* bytes, AP4_Size byte_count);
+ AP4_Size GetContiguousBytesAvailable();
+ AP4_Size GetBytesAvailable();
+ AP4_UI08 ReadByte();
+ AP4_Result ReadBytes(AP4_UI08* bytes, AP4_Size byte_count);
+ AP4_UI08 PeekByte();
+ AP4_Result PeekBytes(AP4_UI08* bytes, AP4_Size byte_count);
+ int ReadBit();
+ AP4_UI32 ReadBits(unsigned int bit_count);
+ int PeekBit();
+ AP4_UI32 PeekBits(unsigned int bit_count);
+ AP4_Result SkipBytes(AP4_Size byte_count);
+ void SkipBit();
+ void SkipBits(unsigned int bit_count);
+ AP4_Result ByteAlign();
+
+ // members
+ AP4_UI08* m_Buffer;
+ unsigned int m_In;
+ unsigned int m_Out;
+ AP4_BitsWord m_Cache;
+ unsigned int m_BitsCached;
+ unsigned int m_Flags;
+
+private:
+ // methods
+ AP4_BitsWord ReadCache() const;
+};
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define AP4_BIT_MASK(_n) ((1<<(_n))-1)
+
+#define AP4_BITSTREAM_POINTER_VAL(offset) \
+ ((offset)&(AP4_BITSTREAM_BUFFER_SIZE-1))
+
+#define AP4_BITSTREAM_POINTER_OFFSET(pointer, offset) \
+ (AP4_BITSTREAM_POINTER_VAL((pointer)+(offset)))
+
+#define AP4_BITSTREAM_POINTER_ADD(pointer, offset) \
+ ((pointer) = AP4_BITSTREAM_POINTER_OFFSET(pointer, offset))
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::ReadCache
++---------------------------------------------------------------------*/
+inline AP4_BitsWord
+AP4_BitStream::ReadCache() const
+{
+ unsigned int pos = m_Out;
+ AP4_BitsWord cache;
+
+#if AP4_WORD_BITS != 32
+#error unsupported word size /* 64 and other word size not yet implemented */
+#endif
+
+ if (pos <= AP4_BITSTREAM_BUFFER_SIZE - AP4_WORD_BYTES) {
+ unsigned char* out_ptr = &m_Buffer[pos];
+ cache = (((AP4_BitsWord) out_ptr[0]) << 24)
+ | (((AP4_BitsWord) out_ptr[1]) << 16)
+ | (((AP4_BitsWord) out_ptr[2]) << 8)
+ | (((AP4_BitsWord) out_ptr[3]) );
+ } else {
+ unsigned char* buf_ptr = m_Buffer;
+ cache = (((AP4_BitsWord) buf_ptr[ pos ]) << 24)
+ | (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET (pos, 1)]) << 16)
+ | (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET (pos, 2)]) << 8)
+ | (((AP4_BitsWord) buf_ptr[AP4_BITSTREAM_POINTER_OFFSET (pos, 3)]) );
+ }
+
+ return cache;
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::ReadBits
++---------------------------------------------------------------------*/
+inline AP4_UI32
+AP4_BitStream::ReadBits(unsigned int n)
+{
+ AP4_BitsWord result;
+ if (m_BitsCached >= n) {
+ /* we have enough bits in the cache to satisfy the request */
+ m_BitsCached -= n;
+ result = (m_Cache >> m_BitsCached) & AP4_BIT_MASK(n);
+ } else {
+ /* not enough bits in the cache */
+ AP4_BitsWord word;
+
+ /* read the next word */
+ {
+ word = ReadCache();
+ m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
+ }
+
+ /* combine the new word and the cache, and update the state */
+ {
+ AP4_BitsWord cache = m_Cache & AP4_BIT_MASK(m_BitsCached);
+ n -= m_BitsCached;
+ m_BitsCached = AP4_WORD_BITS - n;
+ result = (word >> m_BitsCached) | (cache << n);
+ m_Cache = word;
+ }
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::ReadBit
++---------------------------------------------------------------------*/
+inline int
+AP4_BitStream::ReadBit()
+{
+ AP4_BitsWord result;
+ if (m_BitsCached == 0) {
+ /* the cache is empty */
+
+ /* read the next word into the cache */
+ m_Cache = ReadCache();
+ m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
+ m_BitsCached = AP4_WORD_BITS - 1;
+
+ /* return the first bit */
+ result = m_Cache >> (AP4_WORD_BITS - 1);
+ } else {
+ /* get the bit from the cache */
+ result = (m_Cache >> (--m_BitsCached)) & 1;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::PeekBits
++---------------------------------------------------------------------*/
+inline AP4_UI32
+AP4_BitStream::PeekBits(unsigned int n)
+{
+ /* we have enough bits in the cache to satisfy the request */
+ if (m_BitsCached >= n) {
+ return (m_Cache >> (m_BitsCached - n)) & AP4_BIT_MASK(n);
+ } else {
+ /* not enough bits in the cache, read the next word */
+ AP4_BitsWord word = ReadCache();
+
+ /* combine the new word and the cache, and update the state */
+ AP4_BitsWord cache = m_Cache & AP4_BIT_MASK(m_BitsCached);
+ n -= m_BitsCached;
+ return (word >> (AP4_WORD_BITS - n)) | (cache << n);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::PeekBit
++---------------------------------------------------------------------*/
+inline int
+AP4_BitStream::PeekBit()
+{
+ /* the cache is empty */
+ if (m_BitsCached == 0) {
+ /* read the next word into the cache */
+ AP4_BitsWord cache = ReadCache();
+
+ /* return the first bit */
+ return cache >> (AP4_WORD_BITS - 1);
+ } else {
+ /* get the bit from the cache */
+ return (m_Cache >> (m_BitsCached-1)) & 1;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::SkipBits
++---------------------------------------------------------------------*/
+inline void
+AP4_BitStream::SkipBits(unsigned int n)
+{
+ if (n <= m_BitsCached) {
+ m_BitsCached -= n;
+ } else {
+ n -= m_BitsCached;
+ while (n >= AP4_WORD_BITS) {
+ m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
+ n -= AP4_WORD_BITS;
+ }
+ if (n) {
+ m_Cache = ReadCache();
+ m_BitsCached = AP4_WORD_BITS-n;
+ m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
+ } else {
+ m_BitsCached = 0;
+ m_Cache = 0;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::SkipBit
++---------------------------------------------------------------------*/
+inline void
+AP4_BitStream::SkipBit()
+{
+ if (m_BitsCached == 0) {
+ m_Cache = ReadCache();
+ m_Out = AP4_BITSTREAM_POINTER_OFFSET(m_Out, AP4_WORD_BYTES);
+ m_BitsCached = AP4_WORD_BITS - 1;
+ } else {
+ --m_BitsCached;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::ReadByte
++---------------------------------------------------------------------*/
+inline AP4_UI08
+AP4_BitStream::ReadByte()
+{
+ SkipBits(m_BitsCached & 7);
+ return ReadBits(8);
+}
+
+/*----------------------------------------------------------------------
+| AP4_BitStream::PeekByte
++---------------------------------------------------------------------*/
+inline AP4_UI08
+AP4_BitStream::PeekByte()
+{
+ int extra_bits = m_BitsCached & 7;
+ int data = PeekBits(extra_bits + 8);
+ int byte = data & 0xFF;
+
+ return byte;
+}
+
+#endif // _AP4_BIT_STREAM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Config/Ap4Config.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Config/Ap4Config.h
new file mode 100644
index 000000000..19da47e1c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Config/Ap4Config.h
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - Target Platform and Compiler Configuration
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CONFIG_H_
+#define _AP4_CONFIG_H_
+
+/*----------------------------------------------------------------------
+| defaults
++---------------------------------------------------------------------*/
+#define AP4_CONFIG_HAVE_CPP_STRING_H
+#define AP4_CONFIG_HAVE_STDIO_H
+#define AP4_CONFIG_HAVE_ASSERT_H
+
+#define AP4_CONFIG_HAVE_CPP_STRING
+
+#define AP4_CONFIG_HAVE_SNPRINTF
+
+/*----------------------------------------------------------------------
+| byte order
++---------------------------------------------------------------------*/
+// define AP4_PLATFORM_BYTE_ORDER to one of these two choices
+#define AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN 0
+#define AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN 1
+
+#ifdef __ppc__
+#define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN
+#endif
+
+/*----------------------------------------------------------------------
+| Win32 specifics
++---------------------------------------------------------------------*/
+#ifdef WIN32
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#if defined(_DEBUG)
+#define AP4_DEBUG
+#endif
+#endif
+
+#endif // _AP4_CONFIG_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4.h
new file mode 100644
index 000000000..3f9ea0518
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4.h
@@ -0,0 +1,41 @@
+/*****************************************************************
+|
+| AP4 - Main Header
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_H_
+#define _AP4_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Config.h"
+#include "Ap4Types.h"
+#include "Ap4Constants.h"
+#include "Ap4Results.h"
+#include "Ap4Debug.h"
+
+#endif // _AP4_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Array.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Array.h
new file mode 100644
index 000000000..0a057fe0c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Array.h
@@ -0,0 +1,152 @@
+/*****************************************************************
+|
+| AP4 - Arrays
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ARRAY_H_
+#define _AP4_ARRAY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_ARRAY_INITIAL_COUNT = 64;
+
+/*----------------------------------------------------------------------
+| AP4_Array
++---------------------------------------------------------------------*/
+template <typename T>
+class AP4_Array
+{
+public:
+ // methods
+ AP4_Array<T>(): m_AllocatedCount(0), m_ItemCount(0), m_Items(0) {}
+ virtual ~AP4_Array<T>();
+ AP4_Cardinal ItemCount() { return m_ItemCount; }
+ AP4_Result Append(const T& item);
+ T& operator[](unsigned long idx);
+ AP4_Result EnsureCapacity(AP4_Cardinal count);
+
+protected:
+ // members
+ AP4_Cardinal m_AllocatedCount;
+ AP4_Cardinal m_ItemCount;
+ T* m_Items;
+ T m_OverflowItem;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Array<T>::~AP4_Array<T>
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Array<T>::~AP4_Array<T>()
+{
+ delete[] m_Items;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Array<T>::EnsureCapacity
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_Array<T>::EnsureCapacity(AP4_Cardinal count)
+{
+ if (count <= m_AllocatedCount) return AP4_SUCCESS;
+
+ unsigned long new_count;
+ if (m_AllocatedCount) {
+ new_count = 2*m_AllocatedCount;
+ } else {
+ new_count = AP4_ARRAY_INITIAL_COUNT;
+ }
+
+ // (re)allocate the items
+ T* new_items = new T[new_count];
+ if (new_items == NULL) {
+ return AP4_ERROR_OUT_OF_MEMORY;
+ }
+ if (m_ItemCount && m_Items) {
+ for (unsigned int i=0; i<m_ItemCount; i++) {
+ new_items[i] = m_Items[i];
+ }
+ delete[] m_Items;
+ }
+ m_Items = new_items;
+ m_AllocatedCount = new_count;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Array<T>::operator[]
++---------------------------------------------------------------------*/
+template <typename T>
+T&
+AP4_Array<T>::operator[](unsigned long idx)
+{
+ if (idx >= m_ItemCount) {
+ return m_OverflowItem;
+ } else {
+ return m_Items[idx];
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Array<T>::Append
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_Array<T>::Append(const T& item)
+{
+ // ensure capacity
+ AP4_Result result = EnsureCapacity(m_ItemCount+1);
+ if (result != AP4_SUCCESS) return result;
+
+ // store the item
+ m_Items[m_ItemCount++] = item;
+
+ return AP4_SUCCESS;
+}
+
+#endif // _AP4_ARRAY_H_
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Atom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Atom.cpp
new file mode 100644
index 000000000..d62a2f831
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Atom.cpp
@@ -0,0 +1,433 @@
+/*****************************************************************
+|
+| AP4 - Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Utils.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| AP4_Atom::AP4_Atom
++---------------------------------------------------------------------*/
+AP4_Atom::AP4_Atom(Type type,
+ bool is_full) :
+ m_Type(type),
+ m_Size(is_full ? AP4_FULL_ATOM_HEADER_SIZE : AP4_ATOM_HEADER_SIZE),
+ m_IsFull(is_full),
+ m_Version(0),
+ m_Flags(0),
+ m_Parent(NULL)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::AP4_Atom
++---------------------------------------------------------------------*/
+AP4_Atom::AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full) :
+ m_Type(type),
+ m_Size(size),
+ m_IsFull(is_full),
+ m_Version(0),
+ m_Flags(0),
+ m_Parent(NULL)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::AP4_Atom
++---------------------------------------------------------------------*/
+AP4_Atom::AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream) :
+ m_Type(type),
+ m_Size(size),
+ m_IsFull(is_full),
+ m_Parent(NULL)
+{
+ // if this is a full atom, read the version and flags
+ if (is_full) {
+ AP4_UI32 header;
+ stream.ReadUI32(header);
+ m_Version = (header>>24)&0xFF;
+ m_Flags = (header&0xFFFFFF);
+ } else {
+ m_Version = 0;
+ m_Flags = 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::GetHeaderSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_Atom::GetHeaderSize()
+{
+ return m_IsFull ? AP4_FULL_ATOM_HEADER_SIZE : AP4_ATOM_HEADER_SIZE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::WriteHeader
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::WriteHeader(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the size
+ result = stream.WriteUI32(m_Size);
+ if (AP4_FAILED(result)) return result;
+
+ // write the type
+ result = stream.WriteUI32(m_Type);
+ if (AP4_FAILED(result)) return result;
+
+ // for full atoms, write version and flags
+ if (m_IsFull) {
+ result = stream.WriteUI08(m_Version);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI24(m_Flags);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::Write(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+#if defined(AP4_DEBUG)
+ AP4_Offset before;
+ stream.Tell(before);
+#endif
+
+ // write the header
+ result = WriteHeader(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // write the fields
+ result = WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+#if defined(AP4_DEBUG)
+ AP4_Offset after;
+ stream.Tell(after);
+ AP4_ASSERT(after-before == m_Size);
+#endif
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::Inspect(AP4_AtomInspector& inspector)
+{
+ InspectHeader(inspector);
+ InspectFields(inspector);
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::InspectHeader
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::InspectHeader(AP4_AtomInspector& inspector)
+{
+ // write atom name
+ char name[7];
+ name[0] = '[';
+ AP4_FormatFourChars(&name[1], m_Type);
+ name[5] = ']';
+ name[6] = '\0';
+ char size[64];
+ AP4_StringFormat(size, sizeof(size), "size=%ld+%ld", GetHeaderSize(),
+ m_Size-GetHeaderSize());
+ inspector.StartElement(name, size);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Atom::Detach
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Atom::Detach()
+{
+ if (m_Parent) {
+ return m_Parent->RemoveChild(this);
+ } else {
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownAtom::AP4_UnknownAtom
++---------------------------------------------------------------------*/
+AP4_UnknownAtom::AP4_UnknownAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream) :
+ AP4_Atom(type, size, is_full, stream),
+ m_SourceStream(&stream)
+{
+ // store source stream offset
+ stream.Tell(m_SourceOffset);
+
+ // keep a reference to the source stream
+ m_SourceStream->AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownAtom::~AP4_UnknownAtom
++---------------------------------------------------------------------*/
+AP4_UnknownAtom::~AP4_UnknownAtom()
+{
+ // release the source stream reference
+ if (m_SourceStream) {
+ m_SourceStream->Release();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_UnknownAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // check that we have a source stream
+ // and a normal size
+ if (m_SourceStream == NULL || m_Size < 8) {
+ return AP4_FAILURE;
+ }
+
+ // seek into the source at the stored offset
+ result = m_SourceStream->Seek(m_SourceOffset);
+ if (AP4_FAILED(result)) return result;
+
+ // copy the source stream to the output
+ result = m_SourceStream->CopyTo(stream, m_Size-GetHeaderSize());
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::~AP4_AtomParent
++---------------------------------------------------------------------*/
+AP4_AtomParent::~AP4_AtomParent()
+{
+ m_Children.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::AddChild
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomParent::AddChild(AP4_Atom* child, int position)
+{
+ // check that the child does not already have a parent
+ if (child->GetParent() != NULL) return AP4_ERROR_INVALID_PARAMETERS;
+
+ // attach the child
+ AP4_Result result;
+ if (position == -1) {
+ // insert at the tail
+ result = m_Children.Add(child);
+ } else if (position == 0) {
+ // insert at the head
+ result = m_Children.Insert(NULL, child);
+ } else {
+ // insert after <n-1>
+ AP4_List<AP4_Atom>::Item* insertion_point = m_Children.FirstItem();
+ unsigned int count = position;
+ while (insertion_point && --count) {
+ insertion_point = insertion_point->GetNext();
+ }
+ if (insertion_point) {
+ result = m_Children.Insert(insertion_point, child);
+ } else {
+ result = AP4_ERROR_OUT_OF_RANGE;
+ }
+ }
+ if (AP4_FAILED(result)) return result;
+
+ // notify the child of its parent
+ child->SetParent(this);
+
+ // get a chance to update
+ OnChildAdded(child);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::RemoveChild
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomParent::RemoveChild(AP4_Atom* child)
+{
+ // check that this is our child
+ if (child->GetParent() != this) return AP4_ERROR_INVALID_PARAMETERS;
+
+ // remove the child
+ AP4_Result result = m_Children.Remove(child);
+ if (AP4_FAILED(result)) return result;
+
+ // notify that child that it is orphaned
+ child->SetParent(NULL);
+
+ // get a chance to update
+ OnChildRemoved(child);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::DeleteChild
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomParent::DeleteChild(AP4_Atom::Type type)
+{
+ // find the child
+ AP4_Atom* child = GetChild(type);
+ if (child == NULL) return AP4_FAILURE;
+
+ // remove the child
+ AP4_Result result = RemoveChild(child);
+ if (AP4_FAILED(result)) return result;
+
+ // delete the child
+ delete child;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::GetChild
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_AtomParent::GetChild(AP4_Atom::Type type, AP4_Ordinal index /* = 0 */)
+{
+ AP4_Atom* atom;
+ AP4_Result result = m_Children.Find(AP4_AtomFinder(type, index), atom);
+ if (AP4_SUCCEEDED(result)) {
+ return atom;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent::FindChild
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_AtomParent::FindChild(const char* path,
+ bool auto_create)
+{
+ // start from here
+ AP4_AtomParent* parent = this;
+
+ // walk the path
+ while (path[0] && path[1] && path[2] && path[3]) {
+ // we have 4 valid chars
+ const char* tail;
+ int index = 0;
+ if (path[4] == '\0') {
+ tail = NULL;
+ } else if (path[4] == '/') {
+ // separator
+ tail = &path[5];
+ } else if (path[4] == '[') {
+ const char* x = &path[5];
+ while (*x >= '0' && *x <= '9') {
+ index = 10*index+(*x++ - '0');
+ }
+ if (x[0] == ']') {
+ if (x[1] == '\0') {
+ tail = NULL;
+ } else {
+ tail = x+2;
+ }
+ } else {
+ // malformed path
+ return NULL;
+ }
+ } else {
+ // malformed path
+ return NULL;
+ }
+
+ // look for this atom in the current list
+ AP4_Atom::Type type = AP4_ATOM_TYPE(path[0], path[1], path[2], path[3]);
+ AP4_Atom* atom = parent->GetChild(type, index);
+ if (atom == NULL) {
+ // not found
+ if (auto_create && (index == 0)) {
+ AP4_ContainerAtom* container = dynamic_cast<AP4_ContainerAtom*>(parent);
+ if (parent) {
+ atom = new AP4_ContainerAtom(type, false);
+ container->AddChild(atom);
+ } else {
+ return NULL;
+ }
+ } else {
+ return NULL;
+ }
+ }
+
+ if (tail) {
+ path = tail;
+ // if this atom is an atom parent, recurse
+ parent = dynamic_cast<AP4_ContainerAtom*>(atom);
+ if (parent == NULL) return NULL;
+ } else {
+ return atom;
+ }
+ }
+
+ // not found
+ return NULL;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Atom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Atom.h
new file mode 100644
index 000000000..a36782b6c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Atom.h
@@ -0,0 +1,311 @@
+/*****************************************************************
+|
+| AP4 - Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ATOM_H_
+#define _AP4_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4List.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define AP4_ATOM_TYPE(a,b,c,d) \
+ ((((unsigned long)a)<<24) | \
+ (((unsigned long)b)<<16) | \
+ (((unsigned long)c)<< 8) | \
+ (((unsigned long)d) ))
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_ATOM_HEADER_SIZE = 8;
+const int AP4_FULL_ATOM_HEADER_SIZE = 12;
+const int AP4_ATOM_MAX_NAME_SIZE = 256;
+const int AP4_ATOM_MAX_URI_SIZE = 512;
+
+/*----------------------------------------------------------------------
+| forward references
++---------------------------------------------------------------------*/
+class AP4_AtomParent;
+
+/*----------------------------------------------------------------------
+| AP4_AtomInspector
++---------------------------------------------------------------------*/
+class AP4_AtomInspector {
+public:
+ // types
+ typedef enum {
+ HINT_NONE,
+ HINT_HEX,
+ HINT_BOOLEAN
+ } FormatHint;
+
+ // constructor and destructor
+ AP4_AtomInspector() {}
+ virtual ~AP4_AtomInspector() {}
+
+ // methods
+ virtual void StartElement(const char* name, const char* extra = NULL) {}
+ virtual void EndElement() {}
+ virtual void AddField(const char* name, AP4_UI32 value, FormatHint hint = HINT_NONE) {}
+ virtual void AddField(const char* name, const char* value, FormatHint hint = HINT_NONE) {}
+};
+
+/*----------------------------------------------------------------------
+| AP4_Atom
++---------------------------------------------------------------------*/
+class AP4_Atom {
+ public:
+ // types
+ typedef AP4_UI32 Type;
+
+ // methods
+ AP4_Atom(Type type,
+ bool is_full = false);
+ AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full = false);
+ AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream);
+ virtual ~AP4_Atom() {}
+ Type GetType() { return m_Type; }
+ void SetType(Type type) { m_Type = type; }
+ AP4_Size GetHeaderSize();
+ virtual AP4_Size GetSize() { return m_Size; }
+ virtual AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Result WriteHeader(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream) = 0;
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual AP4_Result InspectHeader(AP4_AtomInspector& inspector);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector) {
+ return AP4_SUCCESS;
+ }
+
+ // parent/child realtionship methods
+ virtual AP4_Result SetParent(AP4_AtomParent* parent) {
+ m_Parent = parent;
+ return AP4_SUCCESS;
+ }
+ virtual AP4_AtomParent* GetParent() { return m_Parent; }
+ virtual AP4_Result Detach();
+
+ // override this if your want to make an atom cloneable
+ virtual AP4_Atom* Clone() { return NULL; }
+
+ protected:
+ // members
+ Type m_Type;
+ AP4_Size m_Size;
+ bool m_IsFull;
+ AP4_UI32 m_Version;
+ AP4_UI32 m_Flags;
+ AP4_AtomParent* m_Parent;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent
++---------------------------------------------------------------------*/
+class AP4_AtomParent {
+public:
+ // base methods
+ virtual ~AP4_AtomParent();
+ AP4_List<AP4_Atom>& GetChildren() { return m_Children; }
+ virtual AP4_Result AddChild(AP4_Atom* child, int position = -1);
+ virtual AP4_Result RemoveChild(AP4_Atom* child);
+ virtual AP4_Result DeleteChild(AP4_Atom::Type type);
+ virtual AP4_Atom* GetChild(AP4_Atom::Type type, AP4_Ordinal index = 0);
+ virtual AP4_Atom* FindChild(const char* path,
+ bool auto_create = false);
+
+ // methods designed to be overridden
+ virtual void OnChildChanged(AP4_Atom* child) {}
+ virtual void OnChildAdded(AP4_Atom* child) {}
+ virtual void OnChildRemoved(AP4_Atom* child) {}
+
+protected:
+ // members
+ AP4_List<AP4_Atom> m_Children;
+};
+
+/*----------------------------------------------------------------------
+| AP4_UnknownAtom
++---------------------------------------------------------------------*/
+class AP4_UnknownAtom : public AP4_Atom {
+public:
+ // constructor and destructor
+ AP4_UnknownAtom(AP4_Atom::Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream);
+ ~AP4_UnknownAtom();
+
+ // methods
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_ByteStream* m_SourceStream;
+ AP4_Offset m_SourceOffset;
+};
+
+/*----------------------------------------------------------------------
+| atom types
++---------------------------------------------------------------------*/
+const AP4_Atom::Type AP4_ATOM_TYPE_UDTA = AP4_ATOM_TYPE('u','d','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_URL = AP4_ATOM_TYPE('u','r','l',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_TRAK = AP4_ATOM_TYPE('t','r','a','k');
+const AP4_Atom::Type AP4_ATOM_TYPE_TKHD = AP4_ATOM_TYPE('t','k','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_STTS = AP4_ATOM_TYPE('s','t','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSZ = AP4_ATOM_TYPE('s','t','s','z');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSS = AP4_ATOM_TYPE('s','t','s','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSD = AP4_ATOM_TYPE('s','t','s','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSC = AP4_ATOM_TYPE('s','t','s','c');
+const AP4_Atom::Type AP4_ATOM_TYPE_STCO = AP4_ATOM_TYPE('s','t','c','o');
+const AP4_Atom::Type AP4_ATOM_TYPE_STBL = AP4_ATOM_TYPE('s','t','b','l');
+const AP4_Atom::Type AP4_ATOM_TYPE_SINF = AP4_ATOM_TYPE('s','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_SCHM = AP4_ATOM_TYPE('s','c','h','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_SCHI = AP4_ATOM_TYPE('s','c','h','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_MVHD = AP4_ATOM_TYPE('m','v','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4S = AP4_ATOM_TYPE('m','p','4','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4A = AP4_ATOM_TYPE('m','p','4','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4V = AP4_ATOM_TYPE('m','p','4','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_AVC1 = AP4_ATOM_TYPE('a','v','c','1');
+const AP4_Atom::Type AP4_ATOM_TYPE_ENCA = AP4_ATOM_TYPE('e','n','c','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_ENCV = AP4_ATOM_TYPE('e','n','c','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_MOOV = AP4_ATOM_TYPE('m','o','o','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_MINF = AP4_ATOM_TYPE('m','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_META = AP4_ATOM_TYPE('m','e','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDHD = AP4_ATOM_TYPE('m','d','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_ILST = AP4_ATOM_TYPE('i','l','s','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_HDLR = AP4_ATOM_TYPE('h','d','l','r');
+const AP4_Atom::Type AP4_ATOM_TYPE_FTYP = AP4_ATOM_TYPE('f','t','y','p');
+const AP4_Atom::Type AP4_ATOM_TYPE_ESDS = AP4_ATOM_TYPE('e','s','d','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_EDTS = AP4_ATOM_TYPE('e','d','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_DRMS = AP4_ATOM_TYPE('d','r','m','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_DREF = AP4_ATOM_TYPE('d','r','e','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_DINF = AP4_ATOM_TYPE('d','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_CTTS = AP4_ATOM_TYPE('c','t','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDIA = AP4_ATOM_TYPE('m','d','i','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_VMHD = AP4_ATOM_TYPE('v','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_SMHD = AP4_ATOM_TYPE('s','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_NMHD = AP4_ATOM_TYPE('n','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_HMHD = AP4_ATOM_TYPE('h','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_FRMA = AP4_ATOM_TYPE('f','r','m','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDAT = AP4_ATOM_TYPE('m','d','a','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_FREE = AP4_ATOM_TYPE('f','r','e','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_TIMS = AP4_ATOM_TYPE('t','i','m','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_RTP = AP4_ATOM_TYPE('r','t','p',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_HNTI = AP4_ATOM_TYPE('h','n','t','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_SDP = AP4_ATOM_TYPE('s','d','p',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_IKMS = AP4_ATOM_TYPE('i','K','M','S');
+const AP4_Atom::Type AP4_ATOM_TYPE_ISFM = AP4_ATOM_TYPE('i','S','F','M');
+const AP4_Atom::Type AP4_ATOM_TYPE_HINT = AP4_ATOM_TYPE('h','i','n','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_TREF = AP4_ATOM_TYPE('t','r','e','f');
+
+/*----------------------------------------------------------------------
+| AP4_AtomListInspector
++---------------------------------------------------------------------*/
+class AP4_AtomListInspector : public AP4_List<AP4_Atom>::Item::Operator
+{
+ public:
+ AP4_AtomListInspector(AP4_AtomInspector& inspector) :
+ m_Inspector(inspector) {}
+ AP4_Result Action(AP4_Atom* atom) const {
+ atom->Inspect(m_Inspector);
+ return AP4_SUCCESS;
+ }
+
+ private:
+ AP4_AtomInspector& m_Inspector;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomListWriter
++---------------------------------------------------------------------*/
+class AP4_AtomListWriter : public AP4_List<AP4_Atom>::Item::Operator
+{
+ public:
+ AP4_AtomListWriter(AP4_ByteStream& stream) :
+ m_Stream(stream) {}
+ AP4_Result Action(AP4_Atom* atom) const {
+ atom->Write(m_Stream);
+ return AP4_SUCCESS;
+ }
+
+ private:
+ AP4_ByteStream& m_Stream;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomFinder
++---------------------------------------------------------------------*/
+class AP4_AtomFinder : public AP4_List<AP4_Atom>::Item::Finder
+{
+ public:
+ AP4_AtomFinder(AP4_Atom::Type type, AP4_Ordinal index = 0) :
+ m_Type(type), m_Index(index) {}
+ AP4_Result Test(AP4_Atom* atom) const {
+ if (atom->GetType() == m_Type) {
+ if (m_Index-- == 0) {
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+ private:
+ AP4_Atom::Type m_Type;
+ mutable AP4_Ordinal m_Index;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomSizeAdder
++---------------------------------------------------------------------*/
+class AP4_AtomSizeAdder : public AP4_List<AP4_Atom>::Item::Operator {
+public:
+ AP4_AtomSizeAdder(AP4_Size& size) : m_Size(size) {}
+
+private:
+ AP4_Result Action(AP4_Atom* atom) const {
+ m_Size += atom->GetSize();
+ return AP4_SUCCESS;
+ }
+ AP4_Size& m_Size;
+};
+
+#endif // _AP4_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomFactory.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomFactory.cpp
new file mode 100644
index 000000000..133ffbe20
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomFactory.cpp
@@ -0,0 +1,355 @@
+/*****************************************************************
+|
+| AP4 - Atom Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4SampleEntry.h"
+#include "Ap4IsmaCryp.h"
+#include "Ap4UrlAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4DrefAtom.h"
+#include "Ap4TkhdAtom.h"
+#include "Ap4MdhdAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4StscAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4StszAtom.h"
+#include "Ap4EsdsAtom.h"
+#include "Ap4SttsAtom.h"
+#include "Ap4CttsAtom.h"
+#include "Ap4StssAtom.h"
+#include "Ap4FtypAtom.h"
+#include "Ap4VmhdAtom.h"
+#include "Ap4SmhdAtom.h"
+#include "Ap4NmhdAtom.h"
+#include "Ap4HmhdAtom.h"
+#include "Ap4SchmAtom.h"
+#include "Ap4FrmaAtom.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4RtpAtom.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4IkmsAtom.h"
+#include "Ap4IsfmAtom.h"
+#include "Ap4TrefTypeAtom.h"
+
+/*----------------------------------------------------------------------
+| class variables
++---------------------------------------------------------------------*/
+AP4_AtomFactory AP4_AtomFactory::DefaultFactory;
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::AddTypeHandler
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::AddTypeHandler(TypeHandler* handler)
+{
+ return m_TypeHandlers.Add(handler);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::RemoveTypeHandler
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::RemoveTypeHandler(TypeHandler* handler)
+{
+ return m_TypeHandlers.Remove(handler);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::CreateAtomFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Atom*& atom)
+{
+ AP4_Size bytes_available = 0;
+ if (AP4_FAILED(stream.GetSize(bytes_available)) ||
+ bytes_available == 0) {
+ bytes_available = (AP4_Size)((unsigned long)(-1));
+ }
+ return CreateAtomFromStream(stream, bytes_available, atom);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::CreateAtomFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Size& bytes_available,
+ AP4_Atom*& atom)
+{
+ AP4_Result result;
+
+ // NULL by default
+ atom = NULL;
+
+ // check that there are enough bytes for at least a header
+ if (bytes_available < 8) return AP4_ERROR_EOS;
+
+ // remember current stream offset
+ AP4_Offset start;
+ stream.Tell(start);
+
+ // read atom size
+ AP4_UI32 size;
+ result = stream.ReadUI32(size);
+ if (AP4_FAILED(result)) {
+ stream.Seek(start);
+ return result;
+ }
+
+ if (size == 0) {
+ // atom extends to end of file
+ AP4_Size streamSize = 0;
+ stream.GetSize(streamSize);
+ if (streamSize >= start) {
+ size = streamSize - start;
+ }
+ }
+
+ // check the size (we don't handle extended size yet)
+ if (size < 8 || size > bytes_available) {
+ stream.Seek(start);
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+
+ // read atom type
+ AP4_Atom::Type type;
+ result = stream.ReadUI32(type);
+ if (AP4_FAILED(result)) {
+ stream.Seek(start);
+ return result;
+ }
+
+ // create the atom
+ switch (type) {
+ case AP4_ATOM_TYPE_MOOV:
+ atom = new AP4_MoovAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_MVHD:
+ atom = new AP4_MvhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_TRAK:
+ atom = new AP4_TrakAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_HDLR:
+ atom = new AP4_HdlrAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_DREF:
+ atom = new AP4_DrefAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_URL:
+ atom = new AP4_UrlAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_TKHD:
+ atom = new AP4_TkhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_MDHD:
+ atom = new AP4_MdhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STSD:
+ atom = new AP4_StsdAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_STSC:
+ atom = new AP4_StscAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STCO:
+ atom = new AP4_StcoAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STSZ:
+ atom = new AP4_StszAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STTS:
+ atom = new AP4_SttsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CTTS:
+ atom = new AP4_CttsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STSS:
+ atom = new AP4_StssAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_MP4S:
+ atom = new AP4_Mp4sSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_MP4A:
+ atom = new AP4_Mp4aSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_MP4V:
+ atom = new AP4_Mp4vSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_AVC1:
+ atom = new AP4_Avc1SampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_ENCA:
+ atom = new AP4_EncaSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_ENCV:
+ atom = new AP4_EncvSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_ESDS:
+ atom = new AP4_EsdsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_VMHD:
+ atom = new AP4_VmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_SMHD:
+ atom = new AP4_SmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_NMHD:
+ atom = new AP4_NmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_HMHD:
+ atom = new AP4_HmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_FRMA:
+ atom = new AP4_FrmaAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_SCHM:
+ atom = new AP4_SchmAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_FTYP:
+ atom = new AP4_FtypAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_RTP:
+ if (m_Context == AP4_ATOM_TYPE_HNTI) {
+ atom = new AP4_RtpAtom(size, stream);
+ } else {
+ atom = new AP4_RtpHintSampleEntry(size, stream, *this);
+ }
+ break;
+
+ case AP4_ATOM_TYPE_TIMS:
+ atom = new AP4_TimsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_SDP:
+ atom = new AP4_SdpAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_IKMS:
+ atom = new AP4_IkmsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_ISFM:
+ atom = new AP4_IsfmAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_HINT:
+ atom = new AP4_TrefTypeAtom(type, size, stream);
+ break;
+
+ // container atoms
+ case AP4_ATOM_TYPE_TREF:
+ case AP4_ATOM_TYPE_HNTI:
+ case AP4_ATOM_TYPE_STBL:
+ case AP4_ATOM_TYPE_MDIA:
+ case AP4_ATOM_TYPE_DINF:
+ case AP4_ATOM_TYPE_MINF:
+ case AP4_ATOM_TYPE_SCHI:
+ case AP4_ATOM_TYPE_SINF:
+ case AP4_ATOM_TYPE_UDTA:
+ case AP4_ATOM_TYPE_ILST:
+ case AP4_ATOM_TYPE_EDTS: {
+ AP4_UI32 context = m_Context;
+ m_Context = type; // set the context for the children
+ atom = new AP4_ContainerAtom(type, size, false, stream, *this);
+ m_Context = context; // restore the previous context
+ break;
+ }
+
+ // full container atoms
+ case AP4_ATOM_TYPE_META:
+ atom = new AP4_ContainerAtom(type, size, true, stream, *this);
+ break;
+
+ default:
+ // try all the external type handlers
+ {
+ atom = NULL;
+ AP4_List<TypeHandler>::Item* handler_item = m_TypeHandlers.FirstItem();
+ while (handler_item) {
+ TypeHandler* handler = handler_item->GetData();
+ if (AP4_SUCCEEDED(handler->CreateAtom(type, size, stream, atom))) {
+ break;
+ }
+ handler_item = handler_item->GetNext();
+ }
+ if (atom == NULL) {
+ // no custom handlers, create a generic atom
+ atom = new AP4_UnknownAtom(type, size, false, stream);
+ }
+ break;
+ }
+ }
+
+ // skip to the end of the atom
+ bytes_available -= size;
+ result = stream.Seek(start+size);
+ if (AP4_FAILED(result)) {
+ delete atom;
+ atom = NULL;
+ }
+
+ return result;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomFactory.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomFactory.h
new file mode 100644
index 000000000..71098ec41
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomFactory.h
@@ -0,0 +1,83 @@
+/*****************************************************************
+|
+| AP4 - Atom Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ATOM_FACTORY_H_
+#define _AP4_ATOM_FACTORY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_ByteStream;
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory
++---------------------------------------------------------------------*/
+class AP4_AtomFactory {
+ public:
+ // types
+ class TypeHandler {
+ public:
+ virtual ~TypeHandler() {};
+ virtual AP4_Result CreateAtom(AP4_Atom::Type type,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_Atom*& atom) = 0;
+ };
+
+ // class members
+ static AP4_AtomFactory DefaultFactory;
+
+ // constructor
+ AP4_AtomFactory() : m_Context(0) {}
+
+ // methods
+ AP4_Result AddTypeHandler(TypeHandler* handler);
+ AP4_Result RemoveTypeHandler(TypeHandler* handler);
+ AP4_Result CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Size& bytes_available,
+ AP4_Atom*& atom);
+ AP4_Result CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Atom*& atom);
+
+ // context
+ void SetContext(AP4_Atom::Type context) { m_Context = context; }
+ AP4_Atom::Type GetContext() const { return m_Context; }
+
+private:
+ // members
+ AP4_Atom::Type m_Context;
+ AP4_List<TypeHandler> m_TypeHandlers;
+};
+
+#endif // _AP4_ATOM_FACTORY_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomSampleTable.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomSampleTable.cpp
new file mode 100644
index 000000000..5b09d8437
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomSampleTable.cpp
@@ -0,0 +1,210 @@
+/*****************************************************************
+|
+| AP4 - Atom Based Sample Tables
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This atom is part of AP4 (MP4 Audio Proatom Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the atom COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4AtomSampleTable.h"
+#include "Ap4ByteStream.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4StscAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4StszAtom.h"
+#include "Ap4SttsAtom.h"
+#include "Ap4CttsAtom.h"
+#include "Ap4StssAtom.h"
+#include "Ap4Sample.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::AP4_AtomSampleTable
++---------------------------------------------------------------------*/
+AP4_AtomSampleTable::AP4_AtomSampleTable(AP4_ContainerAtom* stbl,
+ AP4_ByteStream& sample_stream) :
+ m_SampleStream(sample_stream)
+{
+ m_StscAtom = dynamic_cast<AP4_StscAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSC));
+ m_StcoAtom = dynamic_cast<AP4_StcoAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STCO));
+ m_StszAtom = dynamic_cast<AP4_StszAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSZ));
+ m_CttsAtom = dynamic_cast<AP4_CttsAtom*>(stbl->GetChild(AP4_ATOM_TYPE_CTTS));
+ m_SttsAtom = dynamic_cast<AP4_SttsAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STTS));
+ m_StssAtom = dynamic_cast<AP4_StssAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSS));
+ m_StsdAtom = dynamic_cast<AP4_StsdAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSD));
+
+ // keep a reference to the sample stream
+ m_SampleStream.AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::~AP4_AtomSampleTable
++---------------------------------------------------------------------*/
+AP4_AtomSampleTable::~AP4_AtomSampleTable()
+{
+ m_SampleStream.Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetSample(AP4_Ordinal index,
+ AP4_Sample& sample)
+{
+ AP4_Result result;
+
+ // MP4 uses 1-based indexes internally, so adjust by one
+ index++;
+
+ // find out in which chunk this sample is located
+ AP4_Ordinal chunk, skip, desc;
+ result = m_StscAtom->GetChunkForSample(index, chunk, skip, desc);
+ if (AP4_FAILED(result)) return result;
+
+ // check that the result is within bounds
+ if (skip > index) return AP4_ERROR_INTERNAL;
+
+ // get the atom offset for this chunk
+ AP4_Offset offset;
+ result = m_StcoAtom->GetChunkOffset(chunk, offset);
+ if (AP4_FAILED(result)) return result;
+
+ // compute the additional offset inside the chunk
+ for (unsigned int i = index-skip; i < index; i++) {
+ AP4_Size size;
+ result = m_StszAtom->GetSampleSize(i, size);
+ if (AP4_FAILED(result)) return result;
+ offset += size;
+ }
+
+ // set the description index
+ sample.SetDescriptionIndex(desc-1); // adjust for 0-based indexes
+
+ // set the dts and cts
+ AP4_TimeStamp cts_offset, dts;
+ result = m_SttsAtom->GetDts(index, dts);
+ if (AP4_FAILED(result)) return result;
+ sample.SetDts(dts);
+ if (m_CttsAtom == NULL) {
+ sample.SetCts(dts);
+ } else {
+ result = m_CttsAtom->GetCtsOffset(index, cts_offset);
+ if (AP4_FAILED(result)) return result;
+ sample.SetCts(dts + cts_offset);
+ }
+
+ // set the size
+ AP4_Size sample_size;
+ result = m_StszAtom->GetSampleSize(index, sample_size);
+ if (AP4_FAILED(result)) return result;
+ sample.SetSize(sample_size);
+
+ // set the offset
+ sample.SetOffset(offset);
+
+ // set the data stream
+ sample.SetDataStream(m_SampleStream);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_AtomSampleTable::GetSampleCount()
+{
+ return m_StszAtom ? m_StszAtom->GetSampleCount() : 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_AtomSampleTable::GetSampleDescription(AP4_Ordinal index)
+{
+ return m_StsdAtom ? m_StsdAtom->GetSampleDescription(index) : NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSampleDescriptionCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_AtomSampleTable::GetSampleDescriptionCount()
+{
+ return m_StsdAtom ? m_StsdAtom->GetSampleDescriptionCount() : 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetChunkForSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description)
+{
+ return m_StscAtom ? m_StscAtom->GetChunkForSample(sample, chunk, skip, sample_description) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& offset)
+{
+ return m_StcoAtom ? m_StcoAtom->GetChunkOffset(chunk, offset) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::SetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::SetChunkOffset(AP4_Ordinal chunk, AP4_Offset offset)
+{
+ return m_StcoAtom ? m_StcoAtom->SetChunkOffset(chunk, offset) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::SetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::SetSampleSize(AP4_Ordinal sample, AP4_Size size)
+{
+ return m_StszAtom ? m_StszAtom->SetSampleSize(sample, size) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index)
+{
+ return m_SttsAtom ? m_SttsAtom->GetSampleIndexForTimeStamp(ts, index)
+ : AP4_FAILURE;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomSampleTable.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomSampleTable.h
new file mode 100644
index 000000000..dfdd83250
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4AtomSampleTable.h
@@ -0,0 +1,89 @@
+/*****************************************************************
+|
+| AP4 - Atom Based Sample Table
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This atom is part of AP4 (MP4 Audio Proatom Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the atom COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ATOM_SAMPLE_TABLE_H_
+#define _AP4_ATOM_SAMPLE_TABLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_Atom;
+class AP4_ByteStream;
+class AP4_StscAtom;
+class AP4_StcoAtom;
+class AP4_StszAtom;
+class AP4_SttsAtom;
+class AP4_CttsAtom;
+class AP4_StssAtom;
+class AP4_StsdAtom;
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable
++---------------------------------------------------------------------*/
+class AP4_AtomSampleTable : public AP4_SampleTable
+{
+ public:
+ // methods
+ AP4_AtomSampleTable(AP4_ContainerAtom* stbl_atom,
+ AP4_ByteStream& sample_stream);
+ virtual ~AP4_AtomSampleTable();
+
+ // AP4_SampleTable methods
+ virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
+ virtual AP4_Cardinal GetSampleCount();
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ virtual AP4_Cardinal GetSampleDescriptionCount();
+ virtual AP4_Result GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description);
+ virtual AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& offset);
+ virtual AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_Offset offset);
+ virtual AP4_Result SetSampleSize(AP4_Ordinal sample, AP4_Size size);
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index);
+
+private:
+ // members
+ AP4_ByteStream& m_SampleStream;
+ AP4_StscAtom* m_StscAtom;
+ AP4_StcoAtom* m_StcoAtom;
+ AP4_StszAtom* m_StszAtom;
+ AP4_SttsAtom* m_SttsAtom;
+ AP4_CttsAtom* m_CttsAtom;
+ AP4_StsdAtom* m_StsdAtom;
+ AP4_StssAtom* m_StssAtom;
+};
+
+#endif // _AP4_ATOM_SAMPLE_TABLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ByteStream.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ByteStream.cpp
new file mode 100644
index 000000000..cf611a12c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ByteStream.cpp
@@ -0,0 +1,536 @@
+/*****************************************************************
+|
+| AP4 - Byte Stream support
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4ByteStream.h"
+#include "Ap4Utils.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_BYTE_STREAM_COPY_BUFFER_SIZE = 4096;
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteString
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteString(const char* buffer)
+{
+ AP4_Size string_length = static_cast<AP4_Size>(strlen(buffer));
+
+ // shortcut
+ if ((buffer == NULL) || (string_length == 0)) return AP4_SUCCESS;
+
+ // write the string
+ return Write((const void*)buffer, string_length);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI32
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI32(AP4_UI32 value)
+{
+ unsigned char buffer[4];
+
+ // convert value to bytes
+ AP4_BytesFromUInt32BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 4);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI24
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI24(AP4_UI32 value)
+{
+ unsigned char buffer[3];
+
+ // convert value to bytes
+ AP4_BytesFromUInt24BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 3);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI16
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI16(AP4_UI16 value)
+{
+ unsigned char buffer[2];
+
+ // convert value to bytes
+ AP4_BytesFromUInt16BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 2);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI08
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI08(AP4_UI08 value)
+{
+ return Write((void*)&value, 1);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI32
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI32(AP4_UI32& value)
+{
+ unsigned char buffer[4];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 4);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt32BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI24
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI24(AP4_UI32& value)
+{
+ unsigned char buffer[3];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 3);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt24BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI16
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI16(AP4_UI16& value)
+{
+ unsigned char buffer[2];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 2);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt16BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI08
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI08(AP4_UI08& value)
+{
+ unsigned char buffer[1];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 1);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = buffer[0];
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadString
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadString(char* buffer, AP4_Size size)
+{
+ if (buffer == NULL || size == 0) {
+ return AP4_ERROR_INVALID_PARAMETERS;
+ }
+
+ AP4_Size bytes_read = 0;
+ while (bytes_read < size-1) {
+ AP4_Result result;
+ result = Read(&buffer[bytes_read], 1, NULL);
+ if (AP4_FAILED(result)) {
+ buffer[bytes_read] = '\0';
+ return result;
+ }
+ if (buffer[bytes_read] == '\0') {
+ // end of string
+ return AP4_SUCCESS;
+ }
+ bytes_read++;
+ }
+
+ // the string was not null terminated, terminate it
+ buffer[size-1] = '\0';
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::CopyTo
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::CopyTo(AP4_ByteStream& stream, AP4_Size size)
+{
+ unsigned char buffer[AP4_BYTE_STREAM_COPY_BUFFER_SIZE];
+ while (size) {
+ AP4_Size bytes_read;
+ AP4_Size bytes_to_read;
+ AP4_Result result;
+
+ // decide how much to read
+ if (size >= sizeof(buffer)) {
+ bytes_to_read = sizeof(buffer);
+ } else {
+ bytes_to_read = size;
+ }
+
+ // read up to one buffer full
+ result = Read(buffer, bytes_to_read, &bytes_read);
+ if (AP4_FAILED(result)) return result;
+
+ // copy to destination
+ if (bytes_read != 0) {
+ result = stream.Write(buffer, bytes_read);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // update the size
+ size -= bytes_read;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::AP4_SubStream
++---------------------------------------------------------------------*/
+AP4_SubStream::AP4_SubStream(AP4_ByteStream& container,
+ AP4_Offset offset,
+ AP4_Size size) :
+ m_Container(container),
+ m_Offset(offset),
+ m_Size(size),
+ m_Position(0),
+ m_ReferenceCount(1)
+{
+ m_Container.AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::~AP4_SubStream
++---------------------------------------------------------------------*/
+AP4_SubStream::~AP4_SubStream()
+{
+ m_Container.Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Read
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SubStream::Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read)
+{
+ // default values
+ if (bytes_read) *bytes_read = 0;
+
+ // shortcut
+ if (bytes_to_read == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_read > m_Size) {
+ bytes_to_read = m_Size - m_Position;
+ }
+
+ // check for end of substream
+ if (bytes_to_read == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // seek inside container
+ //AP4_Result result;
+ //result = m_Container.Seek(m_Offset+m_Position);
+ //if (AP4_FAILED(result)) {
+ // return result;
+ //}
+
+ // read from the container
+ AP4_Size local_bytes_read;
+ AP4_Result result = m_Container.Read(buffer, bytes_to_read, &local_bytes_read);
+ if (bytes_read) *bytes_read = local_bytes_read;
+ if (AP4_SUCCEEDED(result)) {
+ m_Position += local_bytes_read;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SubStream::Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written)
+{
+ // default values
+ if (bytes_written) *bytes_written = 0;
+
+ // shortcut
+ if (bytes_to_write == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_write > m_Size) {
+ bytes_to_write = m_Size - m_Position;
+ }
+
+ // check for en of substream
+ if (bytes_to_write == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // seek inside container
+ //AP4_Result result;
+ //result = m_Container.Seek(m_Offset+m_Position);
+ //if (AP4_FAILED(result)) return result;
+
+ // write to container
+ AP4_Size local_bytes_written;
+ AP4_Result result = m_Container.Write(buffer, bytes_to_write, &local_bytes_written);
+ if (bytes_written) *bytes_written = local_bytes_written;
+ if (AP4_SUCCEEDED(result)) {
+ m_Position += local_bytes_written;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Seek
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SubStream::Seek(AP4_Offset offset)
+{
+ if (offset > m_Size) return AP4_FAILURE;
+ AP4_Result result;
+ result = m_Container.Seek(m_Offset+offset);
+ if (AP4_SUCCEEDED(result)) {
+ m_Position = offset;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_SubStream::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Release
++---------------------------------------------------------------------*/
+void
+AP4_SubStream::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_Size size) :
+ m_BufferIsLocal(true),
+ m_Size(size),
+ m_Position(0),
+ m_ReferenceCount(1)
+{
+ m_Buffer = new AP4_UI08[size];
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_UI08* buffer, AP4_Size size) :
+ m_BufferIsLocal(false),
+ m_Buffer(buffer),
+ m_Size(size),
+ m_Position(0),
+ m_ReferenceCount(1)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::~AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+AP4_MemoryByteStream::~AP4_MemoryByteStream()
+{
+ if (m_BufferIsLocal) delete[] m_Buffer;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Read
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MemoryByteStream::Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read)
+{
+ // default values
+ if (bytes_read) *bytes_read = 0;
+
+ // shortcut
+ if (bytes_to_read == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_read > m_Size) {
+ bytes_to_read = m_Size - m_Position;
+ }
+
+ // check for end of stream
+ if (bytes_to_read == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // read from the memory
+ memcpy(buffer, &m_Buffer[m_Position], bytes_to_read);
+ m_Position += bytes_to_read;
+
+ if (bytes_read) *bytes_read = bytes_to_read;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MemoryByteStream::Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written)
+{
+ // default values
+ if (bytes_written) *bytes_written = 0;
+
+ // shortcut
+ if (bytes_to_write == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_write > m_Size) {
+ bytes_to_write = m_Size - m_Position;
+ }
+
+ // check for en of stream
+ if (bytes_to_write == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // write to memory
+ memcpy(&m_Buffer[m_Position], buffer, bytes_to_write);
+ m_Position += bytes_to_write;
+
+ if (bytes_written) *bytes_written = bytes_to_write;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Seek
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MemoryByteStream::Seek(AP4_Offset offset)
+{
+ if (offset > m_Size) return AP4_FAILURE;
+ m_Position = offset;
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_MemoryByteStream::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Release
++---------------------------------------------------------------------*/
+void
+AP4_MemoryByteStream::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ByteStream.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ByteStream.h
new file mode 100644
index 000000000..e8ff5083c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ByteStream.h
@@ -0,0 +1,152 @@
+/*****************************************************************
+|
+| AP4 - ByteStream Interface
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_BYTE_STREAM_H_
+#define _AP4_BYTE_STREAM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Interfaces.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream
++---------------------------------------------------------------------*/
+class AP4_ByteStream : public AP4_Referenceable
+{
+ public:
+ // methods
+ virtual AP4_Result Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read = 0) = 0;
+ virtual AP4_Result ReadUI32(AP4_UI32& value);
+ virtual AP4_Result ReadUI24(AP4_UI32& value);
+ virtual AP4_Result ReadUI16(AP4_UI16& value);
+ virtual AP4_Result ReadUI08(AP4_UI08& value);
+ virtual AP4_Result ReadString(char* buffer, AP4_Size size);
+ virtual AP4_Result Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written = 0) = 0;
+ virtual AP4_Result WriteString(const char* stringBuffer);
+ virtual AP4_Result WriteUI32(AP4_UI32 value);
+ virtual AP4_Result WriteUI24(AP4_UI32 value);
+ virtual AP4_Result WriteUI16(AP4_UI16 value);
+ virtual AP4_Result WriteUI08(AP4_UI08 value);
+ virtual AP4_Result Seek(AP4_Offset offset) = 0;
+ virtual AP4_Result Tell(AP4_Offset& offset) = 0;
+ virtual AP4_Result GetSize(AP4_Size& size) = 0;
+ virtual AP4_Result CopyTo(AP4_ByteStream& stream, AP4_Size size);
+};
+
+/*----------------------------------------------------------------------
+| AP4_SubStream
++---------------------------------------------------------------------*/
+class AP4_SubStream : public AP4_ByteStream
+{
+ public:
+ AP4_SubStream(AP4_ByteStream& container, AP4_Offset offset, AP4_Size size);
+
+ // AP4_ByteStream methods
+ AP4_Result Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read = 0);
+ AP4_Result Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written = 0);
+ AP4_Result Seek(AP4_Offset offset);
+ AP4_Result Tell(AP4_Offset& offset) {
+ offset = m_Position;
+ return AP4_SUCCESS;
+ }
+ AP4_Result GetSize(AP4_Size& size) {
+ size = m_Size;
+ return AP4_SUCCESS;
+ }
+
+ // AP4_Referenceable methods
+ void AddReference();
+ void Release();
+
+ protected:
+ virtual ~AP4_SubStream();
+
+ private:
+ AP4_ByteStream& m_Container;
+ AP4_Offset m_Offset;
+ AP4_Size m_Size;
+ AP4_Offset m_Position;
+ AP4_Cardinal m_ReferenceCount;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+class AP4_MemoryByteStream : public AP4_ByteStream
+{
+public:
+ AP4_MemoryByteStream(AP4_Size size);
+ AP4_MemoryByteStream(AP4_UI08* buffer, AP4_Size size);
+
+ // AP4_ByteStream methods
+ AP4_Result Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read = 0);
+ AP4_Result Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written = 0);
+ AP4_Result Seek(AP4_Offset offset);
+ AP4_Result Tell(AP4_Offset& offset) {
+ offset = m_Position;
+ return AP4_SUCCESS;
+ }
+ AP4_Result GetSize(AP4_Size& size) {
+ size = m_Size;
+ return AP4_SUCCESS;
+ }
+
+ // AP4_Referenceable methods
+ void AddReference();
+ void Release();
+
+ // methods
+ AP4_UI08* GetBuffer() { return m_Buffer; }
+
+protected:
+ virtual ~AP4_MemoryByteStream();
+
+private:
+ bool m_BufferIsLocal;
+ AP4_UI08* m_Buffer;
+ AP4_Size m_Size;
+ AP4_Offset m_Position;
+ AP4_Cardinal m_ReferenceCount;
+};
+
+#endif // _AP4_BYTE_STREAM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Constants.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Constants.h
new file mode 100644
index 000000000..5e693f3a7
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Constants.h
@@ -0,0 +1,39 @@
+/*****************************************************************
+|
+| AP4 - Shared Constants
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CONSTANTS_H_
+#define _AP4_CONSTANTS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#ifndef NULL
+#define NULL 0
+#endif
+
+#endif // _AP4_CONSTANTS_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ContainerAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ContainerAtom.cpp
new file mode 100644
index 000000000..a23155477
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ContainerAtom.cpp
@@ -0,0 +1,164 @@
+/*****************************************************************
+|
+| AP4 - Container Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Utils.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type, bool is_full) :
+ AP4_Atom(type, is_full)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type, AP4_Size size, bool is_full) :
+ AP4_Atom(type, size, is_full)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_Atom(type, size, is_full, stream)
+{
+ ReadChildren(atom_factory, stream, size-GetHeaderSize());
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream) :
+ AP4_Atom(type, size, is_full, stream)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::ReadChildren
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::ReadChildren(AP4_AtomFactory& atom_factory,
+ AP4_ByteStream& stream,
+ AP4_Size size)
+{
+ AP4_Atom* atom;
+ AP4_Size bytes_available = size;
+ while (AP4_SUCCEEDED(
+ atom_factory.CreateAtomFromStream(stream, bytes_available, atom))) {
+ atom->SetParent(this);
+ m_Children.Add(atom);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ContainerAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ return InspectChildren(inspector);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::InspectChildren
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ContainerAtom::InspectChildren(AP4_AtomInspector& inspector)
+{
+ // inspect children
+ m_Children.Apply(AP4_AtomListInspector(inspector));
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ContainerAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // write all children
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::OnChildChanged
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::OnChildChanged(AP4_Atom*)
+{
+ // remcompute our size
+ m_Size = GetHeaderSize();
+ m_Children.Apply(AP4_AtomSizeAdder(m_Size));
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::OnChildAdded
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::OnChildAdded(AP4_Atom* child)
+{
+ // update our size
+ m_Size += child->GetSize();
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::OnChildRemoved
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::OnChildRemoved(AP4_Atom* child)
+{
+ // update our size
+ m_Size -= child->GetSize();
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ContainerAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ContainerAtom.h
new file mode 100644
index 000000000..ed68726b8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4ContainerAtom.h
@@ -0,0 +1,81 @@
+/*****************************************************************
+|
+| AP4 - Container Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CONTAINER_ATOM_H_
+#define _AP4_CONTAINER_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_ByteStream;
+class AP4_AtomFactory;
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom
++---------------------------------------------------------------------*/
+class AP4_ContainerAtom : public AP4_Atom, public AP4_AtomParent {
+public:
+ // methods
+ AP4_ContainerAtom(Type type, bool is_full = false);
+ AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream);
+ AP4_List<AP4_Atom>& GetChildren() { return m_Children; }
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result InspectChildren(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // AP4_AtomParent methods
+ void OnChildChanged(AP4_Atom* child);
+ void OnChildAdded(AP4_Atom* child);
+ void OnChildRemoved(AP4_Atom* child);
+
+protected:
+ // constructor
+ AP4_ContainerAtom(Type type, AP4_Size size, bool is_full = false);
+
+ // methods
+ void ReadChildren(AP4_AtomFactory& atom_factory,
+ AP4_ByteStream& stream,
+ AP4_Size size);
+};
+
+#endif // _AP4_CONTAINER_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4CttsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4CttsAtom.cpp
new file mode 100644
index 000000000..a34952a7b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4CttsAtom.cpp
@@ -0,0 +1,115 @@
+/*****************************************************************
+|
+| AP4 - ctts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4CttsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::AP4_CttsAtom
++---------------------------------------------------------------------*/
+AP4_CttsAtom::AP4_CttsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_CTTS, size, true, stream)
+{
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 sample_count;
+ AP4_UI32 sample_offset;
+ if (stream.ReadUI32(sample_count) == AP4_SUCCESS &&
+ stream.ReadUI32(sample_offset) == AP4_SUCCESS) {
+ m_Entries.Append(AP4_CttsTableEntry(sample_count,
+ sample_offset));
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::GetCtsOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_CttsAtom::GetCtsOffset(AP4_Ordinal sample, AP4_Offset& cts_offset)
+{
+ AP4_Ordinal current_sample = 0;
+
+ for (unsigned int i = 0; i < m_Entries.ItemCount(); i++) {
+ AP4_CttsTableEntry& entry = m_Entries[i];
+
+ current_sample += entry.m_SampleCount;
+ // check if we have the right entry
+ if (current_sample >= sample) {
+ cts_offset = entry.m_SampleOffset;
+ return AP4_SUCCESS;
+ }
+ }
+
+ // sample is greater than the number of samples
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_CttsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+ if (AP4_FAILED(result)) return result;
+
+ // write the entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ // sample count
+ result = stream.WriteUI32(m_Entries[i].m_SampleCount);
+ if (AP4_FAILED(result)) return result;
+
+ // time offset
+ result = stream.WriteUI32(m_Entries[i].m_SampleOffset);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_CttsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4CttsAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4CttsAtom.h
new file mode 100644
index 000000000..26ef1e36c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4CttsAtom.h
@@ -0,0 +1,73 @@
+/*****************************************************************
+|
+| AP4 - ctts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CTTS_ATOM_H_
+#define _AP4_CTTS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+
+/*----------------------------------------------------------------------
+| AP4_CttsTableEntry
++---------------------------------------------------------------------*/
+class AP4_CttsTableEntry {
+ public:
+ AP4_CttsTableEntry() :
+ m_SampleCount(0),
+ m_SampleOffset(0) {}
+ AP4_CttsTableEntry(AP4_Cardinal sample_count,
+ AP4_Offset sample_offset) :
+ m_SampleCount(sample_count),
+ m_SampleOffset(sample_offset) {}
+
+ AP4_Cardinal m_SampleCount;
+ AP4_Offset m_SampleOffset;
+};
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom
++---------------------------------------------------------------------*/
+class AP4_CttsAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_CttsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result GetCtsOffset(AP4_Ordinal sample,
+ AP4_Offset& cts_offset);
+
+ private:
+ AP4_Array<AP4_CttsTableEntry> m_Entries;
+};
+
+#endif // _AP4_CTTS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DataBuffer.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DataBuffer.cpp
new file mode 100644
index 000000000..f73afbf3f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DataBuffer.cpp
@@ -0,0 +1,177 @@
+/*****************************************************************
+|
+| AP4 - Data Buffer
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::AP4_DataBuffer
++---------------------------------------------------------------------*/
+AP4_DataBuffer::AP4_DataBuffer() :
+ m_BufferIsLocal(true),
+ m_Buffer(NULL),
+ m_BufferSize(0),
+ m_DataSize(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::AP4_DataBuffer
++---------------------------------------------------------------------*/
+AP4_DataBuffer::AP4_DataBuffer(AP4_Size buffer_size) :
+ m_BufferIsLocal(true),
+ m_Buffer(NULL),
+ m_BufferSize(buffer_size),
+ m_DataSize(0)
+{
+ m_Buffer = new AP4_Byte[buffer_size];
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::AP4_DataBuffer
++---------------------------------------------------------------------*/
+AP4_DataBuffer::AP4_DataBuffer(const AP4_DataBuffer& other) :
+ m_BufferIsLocal(true),
+ m_Buffer(NULL),
+ m_BufferSize(other.m_DataSize),
+ m_DataSize(other.m_DataSize)
+{
+ m_Buffer = new AP4_Byte[m_BufferSize];
+ memcpy(m_Buffer, other.m_Buffer, m_BufferSize);
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::~AP4_DataBuffer
++---------------------------------------------------------------------*/
+AP4_DataBuffer::~AP4_DataBuffer()
+{
+ if (m_BufferIsLocal) {
+ delete[] m_Buffer;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::SetBuffer
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::SetBuffer(AP4_Byte* buffer, AP4_Size buffer_size)
+{
+ if (m_BufferIsLocal) {
+ // destroy the local buffer
+ delete[] m_Buffer;
+ }
+
+ // we're now using an external buffer
+ m_BufferIsLocal = false;
+ m_Buffer = buffer;
+ m_BufferSize = buffer_size;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::SetBufferSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::SetBufferSize(AP4_Size buffer_size)
+{
+ if (m_BufferIsLocal) {
+ return ReallocateBuffer(buffer_size);
+ } else {
+ return AP4_FAILURE; // you cannot change the
+ // buffer management mode
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::SetDataSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::SetDataSize(AP4_Size size)
+{
+ if (size > m_BufferSize) {
+ if (m_BufferIsLocal) {
+ AP4_Result result = ReallocateBuffer(size);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+ m_DataSize = size;
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::SetData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::SetData(AP4_Byte* data, AP4_Size size)
+{
+ if (size > m_BufferSize) {
+ if (m_BufferIsLocal) {
+ AP4_Result result = ReallocateBuffer(size);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+ memcpy(m_Buffer, data, size);
+ m_DataSize = size;
+
+ return AP4_SUCCESS;
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer::ReallocateBuffer
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DataBuffer::ReallocateBuffer(AP4_Size size)
+{
+ // check that the existing data fits
+ if (m_DataSize > size) return AP4_FAILURE;
+
+ // allocate a new buffer
+ AP4_Byte* new_buffer = new AP4_Byte[size];
+
+ // copy the contents of the previous buffer ,is any
+ if (m_Buffer && m_DataSize) {
+ memcpy(new_buffer, m_Buffer, m_DataSize);
+ }
+
+ // destroy the previous buffer
+ delete[] m_Buffer;
+
+ // use the new buffer
+ m_Buffer = new_buffer;
+ m_BufferSize = size;
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DataBuffer.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DataBuffer.h
new file mode 100644
index 000000000..529e842d6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DataBuffer.h
@@ -0,0 +1,73 @@
+/*****************************************************************
+|
+| AP4 - Data Buffer Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DATA_BUFFER_H_
+#define _AP4_DATA_BUFFER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+
+/*----------------------------------------------------------------------
+| AP4_DataBuffer
++---------------------------------------------------------------------*/
+class AP4_DataBuffer
+{
+ public:
+ // constructors & destructor
+ AP4_DataBuffer();
+ AP4_DataBuffer(AP4_Size size);
+ AP4_DataBuffer(const AP4_DataBuffer& other);
+ virtual ~AP4_DataBuffer();
+
+ // data buffer handling methods
+ virtual AP4_Result SetBuffer(AP4_Byte* buffer, AP4_Size buffer_size);
+ virtual AP4_Result SetBufferSize(AP4_Size buffer_size);
+ virtual AP4_Size GetBufferSize() const { return m_BufferSize; }
+
+ // data handling methods
+ virtual const AP4_Byte* GetData() const { return m_Buffer; }
+ virtual AP4_Byte* UseData() { return m_Buffer; };
+ virtual AP4_Size GetDataSize() const { return m_DataSize; }
+ virtual AP4_Result SetDataSize(AP4_Size size);
+ virtual AP4_Result SetData(AP4_Byte* data, AP4_Size data_size);
+
+ protected:
+ // members
+ bool m_BufferIsLocal;
+ AP4_Byte* m_Buffer;
+ AP4_Size m_BufferSize;
+ AP4_Size m_DataSize;
+
+ // methods
+ AP4_Result ReallocateBuffer(AP4_Size size);
+};
+
+#endif // _AP4_DATA_BUFFER_H_
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Debug.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Debug.cpp
new file mode 100644
index 000000000..b9903d5c5
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Debug.cpp
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - Debug Support
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "Ap4.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_DEBUG_MAX_BUFFER = 1024;
+
+/*----------------------------------------------------------------------
+| AP4_Print
++---------------------------------------------------------------------*/
+static void
+AP4_Print(const char* message)
+{
+ printf(message);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Debug
++---------------------------------------------------------------------*/
+void
+AP4_Debug(const char* format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+
+ char buffer[AP4_DEBUG_MAX_BUFFER];
+ vsnprintf(buffer, sizeof(buffer), format, args);
+ AP4_Print(buffer);
+
+ va_end(args);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Debug.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Debug.h
new file mode 100644
index 000000000..f99aaa79e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Debug.h
@@ -0,0 +1,51 @@
+/*****************************************************************
+|
+| AP4 - Debug Support
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DEBUG_H_
+#define _AP4_DEBUG_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Config.h"
+
+/*----------------------------------------------------------------------
+| AP4_Debug
++---------------------------------------------------------------------*/
+extern void AP4_Debug(const char* format, ...);
+
+/*----------------------------------------------------------------------
+| AP4_ASSERT
++---------------------------------------------------------------------*/
+#if defined (AP4_CONFIG_HAVE_ASSERT_H)
+#include <assert.h>
+#define AP4_ASSERT assert
+#endif
+
+
+#endif // _AP4_DEBUG_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp
new file mode 100644
index 000000000..dfaf40872
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderConfigDescriptor.cpp
@@ -0,0 +1,165 @@
+/*****************************************************************
+|
+| AP4 - DecoderConfig Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4DecoderConfigDescriptor.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
+ AP4_UI08 stream_type,
+ AP4_UI08 oti,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate,
+ AP4_DecoderSpecificInfoDescriptor* dsi) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_CONFIG, 2, 13),
+ m_StreamType(stream_type),
+ m_ObjectTypeIndication(oti),
+ m_BufferSize(buffer_size),
+ m_MaxBitrate(max_bitrate),
+ m_AverageBitrate(avg_bitrate)
+{
+ if (dsi) {
+ m_SubDescriptors.Add(dsi);
+ m_PayloadSize += dsi->GetSize();
+ m_HeaderSize = MinHeaderSize(m_PayloadSize);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderConfigDescriptor::AP4_DecoderConfigDescriptor(
+ AP4_ByteStream& stream, AP4_Size header_size, AP4_Size payload_size) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_CONFIG,
+ header_size,
+ payload_size)
+{
+ // record the start position
+ AP4_Offset start;
+ stream.Tell(start);
+
+ // read descriptor fields
+ stream.ReadUI08(m_ObjectTypeIndication);
+ unsigned char bits;
+ stream.ReadUI08(bits);
+ m_StreamType = (bits>>2)&0x3F;
+ m_UpStream = bits&2 ? true:false;
+ stream.ReadUI24(m_BufferSize);
+ stream.ReadUI32(m_MaxBitrate);
+ stream.ReadUI32(m_AverageBitrate);
+
+ // read other descriptors
+ AP4_SubStream* substream = new AP4_SubStream(stream, start+13, payload_size-13);
+ AP4_Descriptor* descriptor = NULL;
+ while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
+ descriptor)
+ == AP4_SUCCESS) {
+ m_SubDescriptors.Add(descriptor);
+ }
+ substream->Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::~AP4_DecoderConfigDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderConfigDescriptor::~AP4_DecoderConfigDescriptor()
+{
+ m_SubDescriptors.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DecoderConfigDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ stream.WriteUI08(m_ObjectTypeIndication);
+ AP4_UI08 bits = (m_StreamType<<2) | (m_UpStream? 2 : 0) | 1;
+ stream.WriteUI08(bits);
+ stream.WriteUI24(m_BufferSize);
+ stream.WriteUI32(m_MaxBitrate);
+ stream.WriteUI32(m_AverageBitrate);
+
+ m_SubDescriptors.Apply(AP4_DescriptorListWriter(stream));
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DecoderConfigDescriptor::Inspect(AP4_AtomInspector& inspector)
+{
+ char info[64];
+ AP4_StringFormat(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),
+ m_PayloadSize);
+ inspector.StartElement("#[DecoderConfig]", info);
+ inspector.AddField("stream_type", m_StreamType);
+ inspector.AddField("object_type", m_ObjectTypeIndication);
+ inspector.AddField("up_stream", m_UpStream);
+ inspector.AddField("buffer_size", m_BufferSize);
+ inspector.AddField("max_bitrate", m_MaxBitrate);
+ inspector.AddField("avg_bitrate", m_AverageBitrate);
+
+ // inspect children
+ m_SubDescriptors.Apply(AP4_DescriptorListInspector(inspector));
+
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor::GetDecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+const AP4_DecoderSpecificInfoDescriptor*
+AP4_DecoderConfigDescriptor::GetDecoderSpecificInfoDescriptor() const
+{
+ // find the decoder specific info
+ AP4_Descriptor* descriptor = NULL;
+ AP4_Result result =
+ m_SubDescriptors.Find(AP4_DescriptorFinder(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO),
+ descriptor);
+
+ // return it
+ if (AP4_SUCCEEDED(result)) {
+ return dynamic_cast<AP4_DecoderSpecificInfoDescriptor*>(descriptor);
+ } else {
+ return NULL;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderConfigDescriptor.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderConfigDescriptor.h
new file mode 100644
index 000000000..1b7e02a77
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderConfigDescriptor.h
@@ -0,0 +1,88 @@
+/*****************************************************************
+|
+| AP4 - DecoderConfig Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DECODER_CONFIG_DESCRIPTOR_H_
+#define _AP4_DECODER_CONFIG_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Descriptor.h"
+#include "Ap4DecoderSpecificInfoDescriptor.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_DECODER_CONFIG = 0x04;
+
+/*----------------------------------------------------------------------
+| AP4_DecoderConfigDescriptor
++---------------------------------------------------------------------*/
+class AP4_DecoderConfigDescriptor : public AP4_Descriptor
+{
+ public:
+ // methods
+ AP4_DecoderConfigDescriptor(AP4_UI08 stream_type,
+ AP4_UI08 oti,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate,
+ AP4_DecoderSpecificInfoDescriptor* dsi);
+ AP4_DecoderConfigDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size);
+ virtual ~AP4_DecoderConfigDescriptor();
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+
+ // accessors
+ virtual const AP4_DecoderSpecificInfoDescriptor*
+ GetDecoderSpecificInfoDescriptor() const;
+ virtual AP4_UI08 GetObjectTypeIndication() const {
+ return m_ObjectTypeIndication;
+ }
+ virtual AP4_UI08 GetStreamType() const { return m_StreamType; }
+ virtual AP4_UI32 GetBufferSize() const { return m_BufferSize; }
+ virtual AP4_UI32 GetMaxBitrate() const { return m_MaxBitrate; }
+ virtual AP4_UI32 GetAvgBitrate() const { return m_AverageBitrate; }
+
+ private:
+ // members
+ AP4_UI08 m_StreamType;
+ AP4_UI08 m_ObjectTypeIndication;
+ bool m_UpStream;
+ AP4_UI32 m_BufferSize;
+ AP4_UI32 m_MaxBitrate;
+ AP4_UI32 m_AverageBitrate;
+ mutable AP4_List<AP4_Descriptor> m_SubDescriptors;
+};
+
+#endif // _AP4_DECODER_CONFIG_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp
new file mode 100644
index 000000000..d04c9d57c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.cpp
@@ -0,0 +1,98 @@
+/*****************************************************************
+|
+| AP4 - DecoderSpecificInfo Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4DecoderSpecificInfoDescriptor.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor(
+ const AP4_DataBuffer& data) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
+ MinHeaderSize(data.GetDataSize()),
+ data.GetDataSize()),
+ m_Info(data)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderSpecificInfoDescriptor::AP4_DecoderSpecificInfoDescriptor(
+ AP4_ByteStream& stream, AP4_Size header_size, AP4_Size payload_size) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO,
+ header_size, payload_size)
+{
+ m_Info.SetDataSize(payload_size);
+ stream.Read(m_Info.UseData(), payload_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::~AP4_DecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+AP4_DecoderSpecificInfoDescriptor::~AP4_DecoderSpecificInfoDescriptor()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DecoderSpecificInfoDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ // write the info buffer
+ if (m_PayloadSize && m_Info.GetDataSize()) {
+ stream.Write(m_Info.GetData(), m_Info.GetDataSize());
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DecoderSpecificInfoDescriptor::Inspect(AP4_AtomInspector& inspector)
+{
+ char* info = new char[m_Info.GetDataSize()*3+1];
+ for (unsigned int i=0; i<m_Info.GetDataSize(); i++) {
+ AP4_StringFormat(&info[i*3], 3, "%02x ", m_Info.UseData()[i]);
+ }
+ info[m_Info.GetDataSize()*3] = '\0';
+ inspector.AddField("#[DecoderSpecificInfo]", info);
+ delete[] info;
+
+ return AP4_SUCCESS;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h
new file mode 100644
index 000000000..f5e6e3cd4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DecoderSpecificInfoDescriptor.h
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - DecoderSpecificInfo Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DECODER_SPECIFIC_INFO_DESCRIPTOR_H_
+#define _AP4_DECODER_SPECIFIC_INFO_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Descriptor.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO = 0x05;
+
+/*----------------------------------------------------------------------
+| AP4_DecoderSpecificInfoDescriptor
++---------------------------------------------------------------------*/
+class AP4_DecoderSpecificInfoDescriptor : public AP4_Descriptor
+{
+public:
+ // methods
+ AP4_DecoderSpecificInfoDescriptor(const AP4_DataBuffer& data);
+ AP4_DecoderSpecificInfoDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size);
+ virtual ~AP4_DecoderSpecificInfoDescriptor();
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual const AP4_DataBuffer& GetDecoderSpecificInfo() const { return m_Info; }
+
+private:
+ // members
+ AP4_DataBuffer m_Info;
+};
+
+#endif // _AP4_DECODER_SPECIFIC_INFO_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Descriptor.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Descriptor.cpp
new file mode 100644
index 000000000..e9edafbf3
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Descriptor.cpp
@@ -0,0 +1,116 @@
+/*****************************************************************
+|
+| AP4 - Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Descriptor.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor::MinHeaderSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_Descriptor::MinHeaderSize(AP4_Size payload_size)
+{
+ // compute how many bytes are needed to encode the payload size
+ // plus tag
+ return 2+(payload_size/128);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor::AP4_Descriptor
++---------------------------------------------------------------------*/
+AP4_Descriptor::AP4_Descriptor(Tag tag,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
+ m_Tag(tag),
+ m_HeaderSize(header_size),
+ m_PayloadSize(payload_size)
+{
+ AP4_ASSERT(header_size >= 1+1);
+ AP4_ASSERT(header_size <= 1+4);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Descriptor::Write(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the tag
+ result = stream.WriteUI08(m_Tag);
+ if (AP4_FAILED(result)) return result;
+
+ // write the size
+ AP4_ASSERT(m_HeaderSize-1 <= 8);
+ AP4_ASSERT(m_HeaderSize >= 2);
+ unsigned int size = m_PayloadSize;
+ unsigned char bytes[8];
+
+ // last bytes of the encoded size
+ bytes[m_HeaderSize-2] = size&0x7F;
+
+ // leading bytes of the encoded size
+ for (int i=m_HeaderSize-3; i>=0; i--) {
+ // move to the next 7 bits
+ size >>= 7;
+
+ // output a byte with a top bit marker
+ bytes[i] = (size&0x7F) | 0x80;
+ }
+
+ result = stream.Write(bytes, m_HeaderSize-1);
+ if (AP4_FAILED(result)) return result;
+
+ // write the fields
+ WriteFields(stream);
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Descriptor::Inspect(AP4_AtomInspector& inspector)
+{
+ char name[6];
+ AP4_StringFormat(name, sizeof(name), "#[%02x]", m_Tag);
+ char info[64];
+ AP4_StringFormat(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),
+ m_PayloadSize);
+ inspector.StartElement(name, info);
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Descriptor.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Descriptor.h
new file mode 100644
index 000000000..e2e6689f9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Descriptor.h
@@ -0,0 +1,116 @@
+/*****************************************************************
+|
+| AP4 - Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DESCRIPTOR_H_
+#define _AP4_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_Descriptor
++---------------------------------------------------------------------*/
+class AP4_Descriptor
+{
+ public:
+ // types
+ typedef unsigned char Tag;
+
+ // class methods
+ static AP4_Size MinHeaderSize(AP4_Size payload_size);
+
+ // methods
+ AP4_Descriptor(Tag tag, AP4_Size header_size, AP4_Size payload_size);
+ virtual ~AP4_Descriptor() {}
+ Tag GetTag() { return m_Tag; }
+ AP4_Size GetSize() { return m_PayloadSize+m_HeaderSize; }
+ AP4_Size GetHeaderSize() { return m_HeaderSize; }
+ virtual AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream) = 0;
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+
+ protected:
+ // members
+ Tag m_Tag;
+ AP4_Size m_HeaderSize;
+ AP4_Size m_PayloadSize;
+};
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorFinder
++---------------------------------------------------------------------*/
+class AP4_DescriptorFinder : public AP4_List<AP4_Descriptor>::Item::Finder
+{
+ public:
+ AP4_DescriptorFinder(AP4_Descriptor::Tag tag) : m_Tag(tag) {}
+ AP4_Result Test(AP4_Descriptor* descriptor) const {
+ return descriptor->GetTag() == m_Tag ? AP4_SUCCESS : AP4_FAILURE;
+ }
+ private:
+ AP4_Descriptor::Tag m_Tag;
+};
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorListWriter
++---------------------------------------------------------------------*/
+class AP4_DescriptorListWriter : public AP4_List<AP4_Descriptor>::Item::Operator
+{
+public:
+ AP4_DescriptorListWriter(AP4_ByteStream& stream) :
+ m_Stream(stream) {}
+ AP4_Result Action(AP4_Descriptor* descriptor) const {
+ return descriptor->Write(m_Stream);
+ }
+
+private:
+ AP4_ByteStream& m_Stream;
+};
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorListInspector
++---------------------------------------------------------------------*/
+class AP4_DescriptorListInspector : public AP4_List<AP4_Descriptor>::Item::Operator
+{
+ public:
+ AP4_DescriptorListInspector(AP4_AtomInspector& inspector) :
+ m_Inspector(inspector) {}
+ AP4_Result Action(AP4_Descriptor* descriptor) const {
+ descriptor->Inspect(m_Inspector);
+ return AP4_SUCCESS;
+ }
+
+ private:
+ AP4_AtomInspector& m_Inspector;
+};
+
+#endif // _AP4_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DescriptorFactory.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DescriptorFactory.cpp
new file mode 100644
index 000000000..4db7b96f9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DescriptorFactory.cpp
@@ -0,0 +1,108 @@
+/*****************************************************************
+|
+| AP4 - Descriptor Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4EsDescriptor.h"
+#include "Ap4DecoderConfigDescriptor.h"
+#include "Ap4DecoderSpecificInfoDescriptor.h"
+#include "Ap4SLConfigDescriptor.h"
+#include "Ap4UnknownDescriptor.h"
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorFactory::CreateDescriptorFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DescriptorFactory::CreateDescriptorFromStream(AP4_ByteStream& stream,
+ AP4_Descriptor*& descriptor)
+{
+ AP4_Result result;
+
+ // NULL by default
+ descriptor = NULL;
+
+ // remember current stream offset
+ AP4_Offset offset;
+ stream.Tell(offset);
+
+ // read descriptor tag
+ unsigned char tag;
+ result = stream.ReadUI08(tag);
+ if (AP4_FAILED(result)) {
+ stream.Seek(offset);
+ return result;
+ }
+
+ // read descriptor size
+ unsigned long payload_size = 0;
+ unsigned int header_size = 1;
+ unsigned int max = 4;
+ unsigned char ext = 0;
+ do {
+ header_size++;
+ result = stream.ReadUI08(ext);
+ if (AP4_FAILED(result)) {
+ stream.Seek(offset);
+ return result;
+ }
+ payload_size = (payload_size<<7) + (ext&0x7F);
+ } while (--max && (ext&0x80));
+
+ // create the descriptor
+ switch (tag) {
+ case AP4_DESCRIPTOR_TAG_ES:
+ descriptor = new AP4_EsDescriptor(stream, header_size, payload_size);
+ break;
+
+ case AP4_DESCRIPTOR_TAG_DECODER_CONFIG:
+ descriptor = new AP4_DecoderConfigDescriptor(stream, header_size, payload_size);
+ break;
+
+ case AP4_DESCRIPTOR_TAG_DECODER_SPECIFIC_INFO:
+ descriptor = new AP4_DecoderSpecificInfoDescriptor(stream, header_size, payload_size);
+ break;
+
+ case AP4_DESCRIPTOR_TAG_SL_CONFIG:
+ if (payload_size != 1) return AP4_ERROR_INVALID_FORMAT;
+ descriptor = new AP4_SLConfigDescriptor(header_size);
+ break;
+
+ default:
+ descriptor = new AP4_UnknownDescriptor(stream, tag, header_size, payload_size);
+ break;
+ }
+
+ // skip to the end of the descriptor
+ stream.Seek(offset+header_size+payload_size);
+
+ return AP4_SUCCESS;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DescriptorFactory.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DescriptorFactory.h
new file mode 100644
index 000000000..2d9ab4264
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DescriptorFactory.h
@@ -0,0 +1,50 @@
+/*****************************************************************
+|
+| AP4 - Descriptor Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DESCRIPTOR_FACTORY_H_
+#define _AP4_DESCRIPTOR_FACTORY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Descriptor.h"
+#include "Ap4ByteStream.h"
+
+/*----------------------------------------------------------------------
+| AP4_DescriptorFactory
++---------------------------------------------------------------------*/
+class AP4_DescriptorFactory
+{
+ public:
+ // class methods
+ static AP4_Result CreateDescriptorFromStream(AP4_ByteStream& stream,
+ AP4_Descriptor*& descriptor);
+};
+
+#endif // _AP4_DESCRIPTOR_FACTORY_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DrefAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DrefAtom.cpp
new file mode 100644
index 000000000..5b245e6f4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DrefAtom.cpp
@@ -0,0 +1,88 @@
+/*****************************************************************
+|
+| AP4 - dref Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4DrefAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom::AP4_DrefAtom
++---------------------------------------------------------------------*/
+AP4_DrefAtom::AP4_DrefAtom(AP4_Atom** refs, AP4_Cardinal refs_count) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, AP4_FULL_ATOM_HEADER_SIZE+4, true)
+{
+ for (unsigned i=0; i<refs_count; i++) {
+ m_Children.Add(refs[i]);
+ m_Size += refs[i]->GetSize();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom::AP4_DrefAtom
++---------------------------------------------------------------------*/
+AP4_DrefAtom::AP4_DrefAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, size, true, stream)
+{
+ // read the number of entries
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+
+ // read children
+ AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ while (entry_count--) {
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom))) {
+ m_Children.Add(atom);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DrefAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the number of entries
+ result = stream.WriteUI32(m_Children.ItemCount());
+ if (AP4_FAILED(result)) return result;
+
+ // write the children
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DrefAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DrefAtom.h
new file mode 100644
index 000000000..55679f0be
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4DrefAtom.h
@@ -0,0 +1,56 @@
+/*****************************************************************
+|
+| AP4 - dref Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DREF_ATOM_H_
+#define _AP4_DREF_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom
++---------------------------------------------------------------------*/
+class AP4_DrefAtom : public AP4_ContainerAtom
+{
+public:
+ // methods
+ AP4_DrefAtom(AP4_Atom** refs, AP4_Cardinal refs_count);
+ AP4_DrefAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+};
+
+#endif // _AP4_DREF_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsDescriptor.cpp
new file mode 100644
index 000000000..059e15ba9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsDescriptor.cpp
@@ -0,0 +1,205 @@
+/*****************************************************************
+|
+| AP4 - ES Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4EsDescriptor.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::AP4_EsDescriptor
++---------------------------------------------------------------------*/
+AP4_EsDescriptor::AP4_EsDescriptor(AP4_UI16 es_id) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES, 2, 2+1),
+ m_EsId(es_id),
+ m_OcrEsId(0),
+ m_Flags(0),
+ m_StreamPriority(0),
+ m_DependsOn(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::AP4_EsDescriptor
++---------------------------------------------------------------------*/
+AP4_EsDescriptor::AP4_EsDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_ES, header_size, payload_size)
+{
+ AP4_Offset start;
+ stream.Tell(start);
+
+ // read descriptor fields
+ stream.ReadUI16(m_EsId);
+ unsigned char bits;
+ stream.ReadUI08(bits);
+ m_Flags = (bits>>5)&7;
+ m_StreamPriority = bits&0x1F;
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY) {
+ stream.ReadUI16(m_DependsOn);
+ } else {
+ m_DependsOn = 0;
+ }
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
+ unsigned char url_length;
+ stream.ReadUI08(url_length);
+ if (url_length) {
+ char* url = new char[url_length+1];
+ if (url) {
+ stream.Read(url, url_length, NULL);
+ url[url_length] = '\0';
+ m_Url = url;
+ delete[] url;
+ }
+ }
+ }
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
+ stream.ReadUI16(m_OcrEsId);
+ } else {
+ m_OcrEsId = 0;
+ }
+
+ // read other descriptors
+ AP4_Offset offset;
+ stream.Tell(offset);
+ AP4_SubStream* substream = new AP4_SubStream(stream, offset,
+ payload_size-(offset-start));
+ AP4_Descriptor* descriptor = NULL;
+ while (AP4_DescriptorFactory::CreateDescriptorFromStream(*substream,
+ descriptor)
+ == AP4_SUCCESS) {
+ m_SubDescriptors.Add(descriptor);
+ }
+ substream->Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::~AP4_EsDescriptor
++---------------------------------------------------------------------*/
+AP4_EsDescriptor::~AP4_EsDescriptor()
+{
+ m_SubDescriptors.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // es id
+ result = stream.WriteUI16(m_EsId);
+ if (AP4_FAILED(result)) return result;
+
+ // flags and other bits
+ AP4_UI08 bits = m_StreamPriority | (AP4_UI08)(m_Flags<<5);
+ result = stream.WriteUI08(bits);
+ if (AP4_FAILED(result)) return result;
+
+ // optional fields
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY) {
+ result = stream.WriteUI16(m_DependsOn);
+ if (AP4_FAILED(result)) return result;
+ }
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_URL) {
+ result = stream.WriteUI08(m_Url.length());
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteString(m_Url.c_str());
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI08(0);
+ if (AP4_FAILED(result)) return result;
+ }
+ if (m_Flags & AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM) {
+ result = stream.WriteUI16(m_OcrEsId);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // write the sub descriptors
+ m_SubDescriptors.Apply(AP4_DescriptorListWriter(stream));
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsDescriptor::Inspect(AP4_AtomInspector& inspector)
+{
+ char info[64];
+ AP4_StringFormat(info, sizeof(info), "size=%ld+%ld",
+ GetHeaderSize(),m_PayloadSize);
+ inspector.StartElement("#[ES]", info);
+ inspector.AddField("es_id", m_EsId);
+ inspector.AddField("stream_priority", m_StreamPriority);
+
+ // inspect children
+ m_SubDescriptors.Apply(AP4_DescriptorListInspector(inspector));
+
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::AddSubDescriptor
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsDescriptor::AddSubDescriptor(AP4_Descriptor* descriptor)
+{
+ m_SubDescriptors.Add(descriptor);
+ m_PayloadSize += descriptor->GetSize();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor::GetDecoderConfigDescriptor
++---------------------------------------------------------------------*/
+const AP4_DecoderConfigDescriptor*
+AP4_EsDescriptor::GetDecoderConfigDescriptor() const
+{
+ // find the decoder config descriptor
+ AP4_Descriptor* descriptor = NULL;
+ AP4_Result result =
+ m_SubDescriptors.Find(AP4_DescriptorFinder(AP4_DESCRIPTOR_TAG_DECODER_CONFIG),
+ descriptor);
+
+ // return it
+ if (AP4_SUCCEEDED(result)) {
+ return dynamic_cast<AP4_DecoderConfigDescriptor*>(descriptor);
+ } else {
+ return NULL;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsDescriptor.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsDescriptor.h
new file mode 100644
index 000000000..e52b67d1d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsDescriptor.h
@@ -0,0 +1,78 @@
+/*****************************************************************
+|
+| AP4 - ES Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ES_DESCRIPTOR_H_
+#define _AP4_ES_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Descriptor.h"
+#include "Ap4DecoderConfigDescriptor.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_ES = 0x03;
+
+const int AP4_ES_DESCRIPTOR_FLAG_STREAM_DEPENDENCY = 1;
+const int AP4_ES_DESCRIPTOR_FLAG_URL = 2;
+const int AP4_ES_DESCRIPTOR_FLAG_OCR_STREAM = 4;
+
+/*----------------------------------------------------------------------
+| AP4_EsDescriptor
++---------------------------------------------------------------------*/
+class AP4_EsDescriptor : public AP4_Descriptor
+{
+ public:
+ // methods
+ AP4_EsDescriptor(AP4_UI16 es_id);
+ AP4_EsDescriptor(AP4_ByteStream& stream,
+ AP4_Size header_size,
+ AP4_Size payload_size);
+ ~AP4_EsDescriptor();
+ virtual AP4_Result AddSubDescriptor(AP4_Descriptor* descriptor);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual const AP4_DecoderConfigDescriptor* GetDecoderConfigDescriptor() const;
+
+ private:
+ // members
+ unsigned short m_EsId;
+ unsigned short m_OcrEsId;
+ AP4_Flags m_Flags;
+ unsigned char m_StreamPriority;
+ unsigned short m_DependsOn;
+ AP4_String m_Url;
+ mutable AP4_List<AP4_Descriptor> m_SubDescriptors;
+};
+
+#endif // _AP4_ES_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsdsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsdsAtom.cpp
new file mode 100644
index 000000000..7be18b6f8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsdsAtom.cpp
@@ -0,0 +1,95 @@
+/*****************************************************************
+|
+| AP4 - esds Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4EsdsAtom.h"
+#include "Ap4DescriptorFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::AP4_EsdsAtom
++---------------------------------------------------------------------*/
+AP4_EsdsAtom::AP4_EsdsAtom(AP4_EsDescriptor* descriptor) :
+ AP4_Atom(AP4_ATOM_TYPE_ESDS, AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_EsDescriptor(descriptor)
+{
+ if (m_EsDescriptor) m_Size += m_EsDescriptor->GetSize();
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::AP4_EsdsAtom
++---------------------------------------------------------------------*/
+AP4_EsdsAtom::AP4_EsdsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_ESDS, size, true, stream)
+{
+ // read descriptor
+ AP4_Descriptor* descriptor = NULL;
+ if (AP4_DescriptorFactory::CreateDescriptorFromStream(stream, descriptor)
+ == AP4_SUCCESS) {
+ m_EsDescriptor = dynamic_cast<AP4_EsDescriptor*>(descriptor);
+ } else {
+ m_EsDescriptor = NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::~AP4_EsdsAtom
++---------------------------------------------------------------------*/
+AP4_EsdsAtom::~AP4_EsdsAtom()
+{
+ delete m_EsDescriptor;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsdsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // write the es descriptor
+ if (m_EsDescriptor) return m_EsDescriptor->Write(stream);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_EsdsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ // inspect descriptor
+ if (m_EsDescriptor) {
+ m_EsDescriptor->Inspect(inspector);
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsdsAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsdsAtom.h
new file mode 100644
index 000000000..2e3a114cd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4EsdsAtom.h
@@ -0,0 +1,61 @@
+/*****************************************************************
+|
+| AP4 - esds Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ESDS_ATOM_H_
+#define _AP4_ESDS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4EsDescriptor.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_EsdsAtom
++---------------------------------------------------------------------*/
+class AP4_EsdsAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_EsdsAtom(AP4_EsDescriptor* descriptor);
+ AP4_EsdsAtom(AP4_Size size, AP4_ByteStream& stream);
+ ~AP4_EsdsAtom();
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ const AP4_EsDescriptor* GetEsDescriptor() const { return m_EsDescriptor; }
+
+ private:
+ // members
+ AP4_EsDescriptor* m_EsDescriptor;
+};
+
+#endif // _AP4_ESDS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4File.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4File.cpp
new file mode 100644
index 000000000..5daa720d5
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4File.cpp
@@ -0,0 +1,90 @@
+/*****************************************************************
+|
+| AP4 - File
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4File.h"
+#include "Ap4Atom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_File::AP4_File
++---------------------------------------------------------------------*/
+AP4_File::AP4_File(AP4_Movie* movie) :
+ m_Movie(movie)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_File::AP4_File
++---------------------------------------------------------------------*/
+AP4_File::AP4_File(AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) :
+ m_Movie(NULL)
+{
+ // get all atoms
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream, atom))) {
+ switch (atom->GetType()) {
+ case AP4_ATOM_TYPE_MOOV:
+ m_Movie = new AP4_Movie(dynamic_cast<AP4_MoovAtom*>(atom),
+ stream);
+ break;
+
+ default:
+ m_OtherAtoms.Add(atom);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_File::~AP4_File
++---------------------------------------------------------------------*/
+AP4_File::~AP4_File()
+{
+ delete m_Movie;
+ m_OtherAtoms.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_File::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_File::Inspect(AP4_AtomInspector& inspector)
+{
+ // dump the moov atom first
+ if (m_Movie) m_Movie->Inspect(inspector);
+
+ // dump the other atoms
+ m_OtherAtoms.Apply(AP4_AtomListInspector(inspector));
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4File.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4File.h
new file mode 100644
index 000000000..6e091bd43
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4File.h
@@ -0,0 +1,65 @@
+/*****************************************************************
+|
+| AP4 - File
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FILE_H_
+#define _AP4_FILE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Track.h"
+#include "Ap4List.h"
+#include "Ap4Movie.h"
+#include "Ap4ByteStream.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_File
++---------------------------------------------------------------------*/
+class AP4_File {
+public:
+ // constructors and destructor
+ AP4_File(AP4_Movie* movie);
+ AP4_File(AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory = AP4_AtomFactory::DefaultFactory);
+ virtual ~AP4_File();
+
+ // methods
+ AP4_List<AP4_Atom>& GetOtherAtoms() { return m_OtherAtoms;}
+ AP4_Movie* GetMovie() { return m_Movie; }
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+
+private:
+ // members
+ AP4_Movie* m_Movie;
+ AP4_List<AP4_Atom> m_OtherAtoms;
+};
+
+#endif // _AP4_FILE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileByteStream.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileByteStream.h
new file mode 100644
index 000000000..564813597
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileByteStream.h
@@ -0,0 +1,90 @@
+/*****************************************************************
+|
+| AP4 - FileByteStream
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+
+#ifndef _AP4_FILE_BYTE_STREAM_H_
+#define _AP4_FILE_BYTE_STREAM_H_
+
+/*----------------------------------------------------------------------
+| AP4_FileByteStream
++---------------------------------------------------------------------*/
+class AP4_FileByteStream: public AP4_ByteStream
+{
+public:
+ // types
+ typedef enum {
+ STREAM_MODE_READ,
+ STREAM_MODE_WRITE
+ } Mode;
+
+ // methods
+ AP4_FileByteStream(const char* name, Mode mode);
+
+ // AP4_ByteStream methods
+ AP4_Result Read(void* buffer,
+ AP4_Size bytesToRead,
+ AP4_Size* bytesRead) {
+ return m_Delegate->Read(buffer, bytesToRead, bytesRead);
+ }
+ AP4_Result Write(const void* buffer,
+ AP4_Size bytesToWrite,
+ AP4_Size* bytesWritten) {
+ return m_Delegate->Write(buffer, bytesToWrite, bytesWritten);
+ }
+ AP4_Result Seek(AP4_Offset offset) { return m_Delegate->Seek(offset); }
+ AP4_Result Tell(AP4_Offset& offset) { return m_Delegate->Tell(offset); }
+ AP4_Result GetSize(AP4_Size& size) { return m_Delegate->GetSize(size);}
+
+ // AP4_Referenceable methods
+ void AddReference() { m_Delegate->AddReference(); }
+ void Release() { m_Delegate->Release(); }
+
+protected:
+ // methods
+ virtual ~AP4_FileByteStream() {
+ delete m_Delegate;
+ }
+
+ // members
+ AP4_ByteStream* m_Delegate;
+};
+
+#endif // _AP4_FILE_BYTE_STREAM_H_
+
+
+
+
+
+
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileWriter.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileWriter.cpp
new file mode 100644
index 000000000..663fe9286
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileWriter.cpp
@@ -0,0 +1,90 @@
+/*****************************************************************
+|
+| AP4 - File Writer
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4MoovAtom.h"
+#include "Ap4FileWriter.h"
+
+/*----------------------------------------------------------------------
+| AP4_FileWriter::AP4_FileWriter
++---------------------------------------------------------------------*/
+AP4_FileWriter::AP4_FileWriter(AP4_File& file) : m_File(file)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_FileWriter::~AP4_FileWriter
++---------------------------------------------------------------------*/
+AP4_FileWriter::~AP4_FileWriter()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_FileWriter::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FileWriter::Write(AP4_ByteStream& stream)
+{
+ //AP4_Result result;
+
+ // get the movie object
+ AP4_Movie* movie = m_File.GetMovie();
+ if (movie == NULL) return AP4_SUCCESS;
+
+ // compute the final offset of the sample data in mdat
+ AP4_Offset data_offset = movie->GetMoovAtom()->GetSize()+AP4_ATOM_HEADER_SIZE;
+
+ // adjust the tracks
+ AP4_List<AP4_Track>::Item* track_item = movie->GetTracks().FirstItem();
+ while (track_item) {
+ AP4_Track* track = track_item->GetData();
+ track->GetTrakAtom()->AdjustChunkOffsets(data_offset);
+ track_item = track_item->GetNext();
+ }
+
+ // write the moov atom
+ movie->GetMoovAtom()->Write(stream);
+
+ // create an mdat
+ stream.WriteUI32(0);
+ stream.Write("mdat", 4);
+ AP4_Track* track = movie->GetTracks().FirstItem()->GetData();
+ AP4_Cardinal sample_count = track->GetSampleCount();
+ for (AP4_Ordinal i=0; i<sample_count; i++) {
+ AP4_Sample sample;
+ AP4_DataBuffer data;
+ track->ReadSample(i, sample, data);
+ stream.Write(data.GetData(), data.GetDataSize());
+ }
+
+ // TODO: update the mdat size
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileWriter.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileWriter.h
new file mode 100644
index 000000000..b8f5b3df8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FileWriter.h
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - File Writer
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FILE_WRITER_H_
+#define _AP4_FILE_WRITER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Track.h"
+#include "Ap4List.h"
+#include "Ap4ByteStream.h"
+#include "Ap4File.h"
+
+/*----------------------------------------------------------------------
+| AP4_FileWriter
++---------------------------------------------------------------------*/
+class AP4_FileWriter {
+ public:
+ // constructors and destructor
+ AP4_FileWriter(AP4_File& file);
+ virtual ~AP4_FileWriter();
+
+ // methods
+ AP4_Result Write(AP4_ByteStream& stream);
+
+ private:
+ AP4_File& m_File;
+};
+
+#endif // _AP4_FILE_WRITER_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FrmaAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FrmaAtom.cpp
new file mode 100644
index 000000000..41a8a92f0
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FrmaAtom.cpp
@@ -0,0 +1,76 @@
+/*****************************************************************
+|
+| AP4 - frma Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4FrmaAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom::AP4_FrmaAtom
++---------------------------------------------------------------------*/
+AP4_FrmaAtom::AP4_FrmaAtom(AP4_UI32 original_format) :
+ AP4_Atom(AP4_ATOM_TYPE_FRMA, AP4_ATOM_HEADER_SIZE+4, false),
+ m_OriginalFormat(original_format)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom::AP4_FrmaAtom
++---------------------------------------------------------------------*/
+AP4_FrmaAtom::AP4_FrmaAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_FRMA, size, false, stream)
+{
+ stream.ReadUI32(m_OriginalFormat);
+}
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FrmaAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // write the original format
+ return stream.WriteUI32(m_OriginalFormat);
+}
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FrmaAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char format[5];
+ AP4_FormatFourChars(format, m_OriginalFormat);
+ inspector.AddField("original_format", format);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FrmaAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FrmaAtom.h
new file mode 100644
index 000000000..8e15d7654
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FrmaAtom.h
@@ -0,0 +1,60 @@
+/*****************************************************************
+|
+| AP4 - frma Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FRMA_ATOM_H_
+#define _AP4_FRMA_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_FrmaAtom
++---------------------------------------------------------------------*/
+class AP4_FrmaAtom : public AP4_Atom
+{
+ public:
+ // constructors
+ AP4_FrmaAtom(AP4_Size size, AP4_ByteStream& stream);
+ AP4_FrmaAtom(AP4_UI32 original_format);
+
+ // methods
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ AP4_UI32 GetOriginalFormat() { return m_OriginalFormat; }
+
+ private:
+ // members
+ AP4_UI32 m_OriginalFormat;
+};
+
+#endif // _AP4_FRMA_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FtypAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FtypAtom.cpp
new file mode 100644
index 000000000..a08637dbf
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FtypAtom.cpp
@@ -0,0 +1,99 @@
+/*****************************************************************
+|
+| AP4 - ftyp Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4FtypAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_FtypAtom::AP4_FtypAtom
++---------------------------------------------------------------------*/
+AP4_FtypAtom::AP4_FtypAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_FTYP, size, false, stream)
+{
+ stream.ReadUI32(m_MajorBrand);
+ stream.ReadUI32(m_MinorVersion);
+ size -= 16;
+ while (size) {
+ AP4_UI32 compatible_brand;
+ stream.ReadUI32(compatible_brand);
+ m_CompatibleBrands.Append(compatible_brand);
+ size -= 4;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_FtypAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FtypAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // major brand
+ result = stream.WriteUI32(m_MajorBrand);
+ if (AP4_FAILED(result)) return result;
+
+ // minor version
+ result = stream.WriteUI32(m_MinorVersion);
+ if (AP4_FAILED(result)) return result;
+
+ // compatible brands
+ AP4_Cardinal compat_brand_count = m_CompatibleBrands.ItemCount();
+ for (AP4_Ordinal i=0; i<compat_brand_count; i++) {
+ result = stream.WriteUI32(m_CompatibleBrands[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_FtypAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_FtypAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char name[5];
+ AP4_FormatFourChars(name, m_MajorBrand);
+ inspector.AddField("major_brand", name);
+ inspector.AddField("minor_version", m_MinorVersion);
+
+ // compatible brands
+ for (unsigned int i=0; i<m_CompatibleBrands.ItemCount(); i++) {
+ AP4_UI32 cb = m_CompatibleBrands[i];
+ AP4_FormatFourChars(name, cb);
+ inspector.AddField("compatible_brand", name);
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FtypAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FtypAtom.h
new file mode 100644
index 000000000..0eec5905b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4FtypAtom.h
@@ -0,0 +1,59 @@
+/*****************************************************************
+|
+| AP4 - ftyp Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FTYP_ATOM_H_
+#define _AP4_FTYP_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4Array.h"
+
+/*----------------------------------------------------------------------
+| AP4_FtypAtom
++---------------------------------------------------------------------*/
+class AP4_FtypAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_FtypAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ private:
+ // members
+ AP4_UI32 m_MajorBrand;
+ AP4_UI32 m_MinorVersion;
+ AP4_Array<AP4_UI32> m_CompatibleBrands;
+};
+
+#endif // _AP4_FTYP_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HdlrAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HdlrAtom.cpp
new file mode 100644
index 000000000..6a5915261
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HdlrAtom.cpp
@@ -0,0 +1,110 @@
+/*****************************************************************
+|
+| AP4 - hdlr Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::AP4_HdlrAtom
++---------------------------------------------------------------------*/
+AP4_HdlrAtom::AP4_HdlrAtom(AP4_Atom::Type hdlr_type, const char* hdlr_name) :
+ AP4_Atom(AP4_ATOM_TYPE_HDLR, true),
+ m_HandlerType(hdlr_type),
+ m_HandlerName(hdlr_name)
+{
+ m_Size += 20+m_HandlerName.length()+1;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::AP4_HdlrAtom
++---------------------------------------------------------------------*/
+AP4_HdlrAtom::AP4_HdlrAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_HDLR, size, true, stream)
+{
+ unsigned char reserved[12];
+ stream.Read(reserved, 4, NULL);
+ stream.ReadUI32(m_HandlerType);
+ stream.Read(reserved, 12, NULL);
+
+ // read the name unless it is empty
+ int name_size = size-(AP4_FULL_ATOM_HEADER_SIZE+20);
+ if (name_size > 0) {
+ char* name = new char[name_size];
+ stream.Read(name, name_size);
+ name[name_size-1] = '\0'; // force a null termination
+ m_HandlerName = name;
+ delete[] name;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HdlrAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the data
+ unsigned char reserved[12];
+ memset(reserved, 0, sizeof(reserved));
+ result = stream.Write(reserved, 4);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_HandlerType);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Write(reserved, 12);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Write(m_HandlerName.c_str(),
+ m_HandlerName.length()+1);
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_FULL_ATOM_HEADER_SIZE+20+m_HandlerName.length()+1);
+ while (padding--) stream.WriteUI08(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HdlrAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char type[5];
+ AP4_FormatFourChars(type, m_HandlerType);
+ inspector.AddField("handler_type", type);
+ inspector.AddField("handler_name", m_HandlerName.c_str());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HdlrAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HdlrAtom.h
new file mode 100644
index 000000000..600819770
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HdlrAtom.h
@@ -0,0 +1,68 @@
+/*****************************************************************
+|
+| AP4 - hdlr Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_HDLR_ATOM_H_
+#define _AP4_HDLR_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_HANDLER_TYPE_SOUN = AP4_ATOM_TYPE('s','o','u','n');
+const AP4_UI32 AP4_HANDLER_TYPE_VIDE = AP4_ATOM_TYPE('v','i','d','e');
+const AP4_UI32 AP4_HANDLER_TYPE_HINT = AP4_ATOM_TYPE('h','i','n','t');
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom
++---------------------------------------------------------------------*/
+class AP4_HdlrAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_HdlrAtom(AP4_UI32 hdlr_type, const char* hdlr_name);
+ AP4_HdlrAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ AP4_UI32 GetHandlerType() {
+ return m_HandlerType;
+ }
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI32 m_HandlerType;
+ AP4_String m_HandlerName;
+};
+
+#endif // _AP4_HDLR_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HintTrackReader.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HintTrackReader.cpp
new file mode 100644
index 000000000..73b566753
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HintTrackReader.cpp
@@ -0,0 +1,323 @@
+/*****************************************************************
+|
+| AP4 - Hint Track Reader
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdlib.h>
+#include <time.h>
+#include "Ap4HintTrackReader.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Track.h"
+#include "Ap4Movie.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4RtpHint.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4TrefTypeAtom.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::AP4_HintTrackReader
++---------------------------------------------------------------------*/
+AP4_HintTrackReader::AP4_HintTrackReader(AP4_Track& hint_track,
+ AP4_Movie& movie,
+ AP4_UI32 ssrc /* = 0 */) :
+ m_HintTrack(hint_track),
+ m_MediaTrack(NULL),
+ m_MediaTimeScale(0),
+ m_RtpSampleData(NULL),
+ m_Ssrc(ssrc),
+ m_SampleIndex(0),
+ m_PacketIndex(0),
+ m_RtpSequenceStart(0),
+ m_RtpTimeStampStart(0),
+ m_RtpTimeScale(0)
+{
+ // check the type
+ if (m_HintTrack.GetType() != AP4_Track::TYPE_HINT)
+ throw AP4_Exception(AP4_ERROR_INVALID_TRACK_TYPE);
+
+ // get the media track
+ AP4_TrakAtom* hint_trak_atom = hint_track.GetTrakAtom();
+ AP4_Atom* atom = hint_trak_atom->FindChild("tref/hint");
+ if (atom != NULL) {
+ AP4_UI32 media_track_id = ((AP4_TrefTypeAtom*) atom)->m_TrackIds[0];
+ m_MediaTrack = movie.GetTrack(media_track_id);
+
+ // get the media time scale
+ m_MediaTimeScale = m_MediaTrack->GetMediaTimeScale();
+ }
+
+ // initiate random generator
+ srand(time(NULL));
+
+ // rtp sequence start init TODO!!
+ m_RtpSequenceStart = rand();
+
+ // rtp timestamp start init TODO!!
+ m_RtpTimeStampStart = rand();
+
+ // rtp time scale
+ atom = hint_trak_atom->FindChild("mdia/minf/stbl/rtp /tims");
+ if (atom) {
+ AP4_TimsAtom* tims = (AP4_TimsAtom*)atom;
+ m_RtpTimeScale = tims->GetTimeScale();
+ }
+
+ // generate a random ssrc if = 0
+ if (m_Ssrc == 0) {
+ m_Ssrc = rand();
+ }
+
+ // get the first sample
+ GetRtpSample(0);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::~AP4_HintTrackReader
++---------------------------------------------------------------------*/
+AP4_HintTrackReader::~AP4_HintTrackReader()
+{
+ delete m_RtpSampleData;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::GetRtpSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::GetRtpSample(AP4_Ordinal index)
+{
+ // get the sample
+ AP4_Result result = m_HintTrack.GetSample(index, m_CurrentHintSample);
+ if (AP4_FAILED(result)) return result;
+
+ // renew the sample data
+ delete m_RtpSampleData;
+ AP4_ByteStream& rtp_data_stream = *m_CurrentHintSample.GetDataStream();
+ rtp_data_stream.Seek(m_CurrentHintSample.GetOffset());
+ m_RtpSampleData = new AP4_RtpSampleData(rtp_data_stream,
+ m_CurrentHintSample.GetSize());
+
+ // reinit the packet index
+ m_PacketIndex = 0;
+
+ // release the stream
+ rtp_data_stream.Release();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::GetCurrentTimeStampMs
++---------------------------------------------------------------------*/
+AP4_TimeStamp
+AP4_HintTrackReader::GetCurrentTimeStampMs()
+{
+ return AP4_ConvertTime(m_CurrentHintSample.GetCts(),
+ m_HintTrack.GetMediaTimeScale(),
+ 1000);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::Rewind
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::Rewind()
+{
+ m_SampleIndex = 0;
+ return GetRtpSample(m_SampleIndex);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::GetSdpText
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::GetSdpText(AP4_String& sdp_text)
+{
+ AP4_Atom* sdp_atom = m_HintTrack.GetTrakAtom()->FindChild("udta/hnti/sdp ");
+ if (sdp_atom == NULL) return AP4_FAILURE;
+
+ // C cast is OK because we know the type of the atom
+ sdp_text = ((AP4_SdpAtom*) sdp_atom)->GetSdpText();
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::SeekToTimeStampMs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::SeekToTimeStampMs(AP4_TimeStamp desired_ts,
+ AP4_TimeStamp& actual_ts)
+{
+ // get the sample index
+ AP4_Cardinal index;
+ AP4_Result result = m_HintTrack.GetSampleIndexForTimeStampMs(desired_ts, index);
+ if (AP4_FAILED(result)) return result;
+
+ // get the current sample based on the index and renew the sample data
+ result = GetRtpSample(index);
+ if (AP4_FAILED(result)) return result;
+
+ // set the actual ts
+ actual_ts = GetCurrentTimeStampMs();
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::GetNextPacket
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::GetNextPacket(AP4_DataBuffer& packet_data,
+ AP4_TimeStamp& ts_ms)
+{
+ AP4_Result result = AP4_SUCCESS;
+
+ // get the next rtp sample if needed
+ AP4_List<AP4_RtpPacket>* packets = &m_RtpSampleData->GetPackets();
+ while (m_PacketIndex == packets->ItemCount()) { // while: handle the 0 packet case
+ result = GetRtpSample(++m_SampleIndex);
+ if (AP4_FAILED(result)) return result;
+ packets = &m_RtpSampleData->GetPackets();
+ }
+
+ // get the packet
+ AP4_RtpPacket* packet;
+ result = packets->Get(m_PacketIndex++, packet);
+ if (AP4_FAILED(result)) return result;
+
+ // build it
+ result = BuildRtpPacket(packet, packet_data);
+ if (AP4_FAILED(result)) return result;
+
+ // set the time stamp
+ ts_ms = GetCurrentTimeStampMs();
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::BuildRtpPacket
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::BuildRtpPacket(AP4_RtpPacket* packet,
+ AP4_DataBuffer& packet_data)
+{
+ // set the data size
+ AP4_Result result = packet_data.SetDataSize(packet->GetConstructedDataSize());
+ if (AP4_FAILED(result)) return result;
+
+ // now write
+ AP4_ByteStream* stream =
+ new AP4_MemoryByteStream(packet_data.UseData(), packet_data.GetDataSize());
+
+ // header + ssrc
+ stream->WriteUI08(0x80 | (packet->GetPBit() << 5) | (packet->GetXBit() << 4));
+ stream->WriteUI08((packet->GetMBit() << 7) | packet->GetPayloadType());
+ stream->WriteUI16(m_RtpSequenceStart + packet->GetSequenceSeed());
+ stream->WriteUI32(m_RtpTimeStampStart + m_CurrentHintSample.GetCts() + packet->GetTimeStampOffset());
+ stream->WriteUI32(m_Ssrc);
+
+ AP4_List<AP4_RtpConstructor>::Item* constructors_it
+ = packet->GetConstructors().FirstItem();
+ while (constructors_it != NULL) {
+ AP4_RtpConstructor* constructor = constructors_it->GetData();
+
+ // add data to the packet according to the constructor
+ switch (constructor->GetType()) {
+ case AP4_RTP_CONSTRUCTOR_TYPE_NOOP:
+ // nothing to do here
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE:
+ result = WriteImmediateRtpData(
+ (AP4_ImmediateRtpConstructor*) constructor, stream);
+ if (AP4_FAILED(result)) return result;
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE:
+ result = WriteSampleRtpData(
+ (AP4_SampleRtpConstructor*) constructor, stream);
+ if (AP4_FAILED(result)) return result;
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC:
+ return AP4_ERROR_NOT_SUPPORTED_YET;
+ default:
+ // unknown constructor type
+ return AP4_FAILURE;
+ }
+
+ // iterate
+ constructors_it = constructors_it->GetNext();
+ }
+
+ // release the stream
+ stream->Release();
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::WriteImmediateRtpData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::WriteImmediateRtpData(AP4_ImmediateRtpConstructor* constructor,
+ AP4_ByteStream* data_stream)
+{
+ const AP4_DataBuffer& data_buffer = constructor->GetData();
+ return data_stream->Write(data_buffer.GetData(), data_buffer.GetDataSize());
+}
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader::WriteSampleRtpData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HintTrackReader::WriteSampleRtpData(AP4_SampleRtpConstructor* constructor,
+ AP4_ByteStream* data_stream)
+{
+ AP4_Track* referenced_track = NULL;
+ if (constructor->GetTrackRefIndex() == 0xFF) {
+ // data is in the hint track
+ referenced_track = &m_HintTrack;
+ } else {
+ // check if we have a media track
+ if (m_MediaTrack == NULL) return AP4_FAILURE;
+ referenced_track = m_MediaTrack;
+ }
+
+ // write the sample data
+ AP4_Sample sample;
+ AP4_Result result = referenced_track->GetSample(constructor->GetSampleNum()-1, // adjust
+ sample);
+ AP4_DataBuffer buffer(constructor->GetLength());
+ result = sample.ReadData(
+ buffer, constructor->GetLength(), constructor->GetSampleOffset());
+ if (AP4_FAILED(result)) return result;
+
+ // write the data
+ return data_stream->Write(buffer.GetData(), buffer.GetDataSize());
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HintTrackReader.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HintTrackReader.h
new file mode 100644
index 000000000..a17aa13ed
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HintTrackReader.h
@@ -0,0 +1,95 @@
+/*****************************************************************
+|
+| AP4 - Hint Track Reader
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_HINT_TRACK_READER_H_
+#define _AP4_HINT_TRACK_READER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Sample.h"
+
+/*----------------------------------------------------------------------
+| class declarations
++---------------------------------------------------------------------*/
+class AP4_DataBuffer;
+class AP4_Movie;
+class AP4_Track;
+class AP4_RtpSampleData;
+class AP4_RtpPacket;
+class AP4_ImmediateRtpConstructor;
+class AP4_SampleRtpConstructor;
+
+/*----------------------------------------------------------------------
+| AP4_HintTrackReader
++---------------------------------------------------------------------*/
+class AP4_HintTrackReader
+{
+public:
+ // constructor and destructor
+ AP4_HintTrackReader(AP4_Track& hint_track,
+ AP4_Movie& movie,
+ AP4_UI32 ssrc = 0); // if 0, random value is chosen
+ ~AP4_HintTrackReader();
+
+ // methods
+ AP4_Result GetNextPacket(AP4_DataBuffer& packet,
+ AP4_TimeStamp& ts_ms);
+ AP4_Result SeekToTimeStampMs(AP4_TimeStamp desired_ts,
+ AP4_TimeStamp& actual_ts);
+ AP4_TimeStamp GetCurrentTimeStampMs();
+ AP4_Result Rewind();
+ AP4_Result GetSdpText(AP4_String& sdp);
+ AP4_Track* GetMediaTrack() { return m_MediaTrack; }
+
+private:
+ // methods
+ AP4_Result GetRtpSample(AP4_Ordinal index);
+ AP4_Result BuildRtpPacket(AP4_RtpPacket* packet,
+ AP4_DataBuffer& packet_data);
+ AP4_Result WriteImmediateRtpData(AP4_ImmediateRtpConstructor* constructor,
+ AP4_ByteStream* data_stream);
+ AP4_Result WriteSampleRtpData(AP4_SampleRtpConstructor* constructor,
+ AP4_ByteStream* data_stream);
+
+ // members
+ AP4_Track& m_HintTrack;
+ AP4_Track* m_MediaTrack;
+ AP4_UI32 m_MediaTimeScale;
+ AP4_Sample m_CurrentHintSample;
+ AP4_RtpSampleData* m_RtpSampleData;
+ AP4_UI32 m_Ssrc;
+ AP4_Ordinal m_SampleIndex;
+ AP4_Ordinal m_PacketIndex;
+ AP4_UI16 m_RtpSequenceStart;
+ AP4_TimeStamp m_RtpTimeStampStart;
+ AP4_UI32 m_RtpTimeScale;
+};
+
+#endif // _AP4_HINT_TRACK_READER_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HmhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HmhdAtom.cpp
new file mode 100644
index 000000000..cecac40da
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HmhdAtom.cpp
@@ -0,0 +1,93 @@
+/*****************************************************************
+|
+| AP4 - hmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4HmhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_HmhdAtom::AP4_HmhdAtom
++---------------------------------------------------------------------*/
+AP4_HmhdAtom::AP4_HmhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_HMHD, size, true, stream)
+{
+ stream.ReadUI16(m_MaxPduSize);
+ stream.ReadUI16(m_AvgPduSize);
+ stream.ReadUI32(m_MaxBitrate);
+ stream.ReadUI32(m_AvgBitrate);
+ stream.ReadUI32(m_Reserved);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HmhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HmhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // max pdu size
+ result = stream.WriteUI16(m_MaxPduSize);
+ if (AP4_FAILED(result)) return result;
+
+ // avg pdu size
+ result = stream.WriteUI16(m_AvgPduSize);
+ if (AP4_FAILED(result)) return result;
+
+ // max bitrate
+ result = stream.WriteUI32(m_MaxBitrate);
+ if (AP4_FAILED(result)) return result;
+
+ // avg bitrate
+ result = stream.WriteUI32(m_AvgBitrate);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved
+ result = stream.WriteUI32(m_Reserved);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HmhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HmhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("max_pdu_size", m_MaxPduSize);
+ inspector.AddField("avg_pdu_size", m_AvgPduSize);
+ inspector.AddField("max_bitrate", m_MaxBitrate);
+ inspector.AddField("avg_bitrate", m_AvgBitrate);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HmhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HmhdAtom.h
new file mode 100644
index 000000000..a645dd3cc
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4HmhdAtom.h
@@ -0,0 +1,59 @@
+/*****************************************************************
+|
+| AP4 - hmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_HMHD_ATOM_H_
+#define _AP4_HMHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_HmhdAtom
++---------------------------------------------------------------------*/
+class AP4_HmhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_HmhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI16 m_MaxPduSize;
+ AP4_UI16 m_AvgPduSize;
+ AP4_UI32 m_MaxBitrate;
+ AP4_UI32 m_AvgBitrate;
+ AP4_UI32 m_Reserved;
+};
+
+#endif // _AP4_HMHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IkmsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IkmsAtom.cpp
new file mode 100644
index 000000000..d34398ac6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IkmsAtom.cpp
@@ -0,0 +1,96 @@
+/*****************************************************************
+|
+| AP4 - iKMS Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4IkmsAtom.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::AP4_IkmsAtom
++---------------------------------------------------------------------*/
+AP4_IkmsAtom::AP4_IkmsAtom(const char* kms_uri) :
+ AP4_Atom(AP4_ATOM_TYPE_IKMS, AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_KmsUri(kms_uri)
+{
+ m_Size += m_KmsUri.length()+1;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::AP4_IkmsAtom
++---------------------------------------------------------------------*/
+AP4_IkmsAtom::AP4_IkmsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_IKMS, size, true, stream)
+{
+ AP4_Size string_size = size-AP4_FULL_ATOM_HEADER_SIZE;
+ if (string_size) {
+ char* str = new char[string_size];
+ stream.Read(str, string_size);
+ str[string_size-1] = '\0'; // force null-termination
+ m_KmsUri = str;
+ delete[] str;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::Clone
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_IkmsAtom::Clone()
+{
+ return new AP4_IkmsAtom(m_KmsUri.c_str());
+}
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IkmsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // kms uri
+ AP4_Result result = stream.Write(m_KmsUri.c_str(), m_KmsUri.length()+1);
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_FULL_ATOM_HEADER_SIZE+m_KmsUri.length()+1);
+ while (padding--) stream.WriteUI08(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IkmsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("kms_uri", m_KmsUri.c_str());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IkmsAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IkmsAtom.h
new file mode 100644
index 000000000..7ff6efb40
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IkmsAtom.h
@@ -0,0 +1,60 @@
+/*****************************************************************
+|
+| AP4 - iKMS Atom
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_IKMS_ATOM_H_
+#define _AP4_IKMS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_IkmsAtom
++---------------------------------------------------------------------*/
+class AP4_IkmsAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_IkmsAtom(const char* kms_uri);
+ AP4_IkmsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Atom* Clone();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ const AP4_String& GetKmsUri() { return m_KmsUri; }
+
+private:
+ // members
+ AP4_String m_KmsUri;
+};
+
+#endif // _AP4_IKMS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Interfaces.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Interfaces.h
new file mode 100644
index 000000000..8b505e93c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Interfaces.h
@@ -0,0 +1,68 @@
+/*****************************************************************
+|
+| AP4 - Common Interfaces
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_INTERFACES_H_
+#define _AP4_INTERFACES_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define AP4_RELEASE(o) do { if (o) (o)->Release(); (o) = NULL; } while (0)
+#define AP4_ADD_REFERENCE(o) do { if (o) (o)->AddReference(); } while (0)
+
+/*----------------------------------------------------------------------
+| AP4_Exception
++---------------------------------------------------------------------*/
+class AP4_Exception
+{
+public:
+ // methods
+ AP4_Exception(AP4_Result error) : m_Error(error) {}
+
+ // members
+ AP4_Result m_Error;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Referenceable
++---------------------------------------------------------------------*/
+class AP4_Referenceable
+{
+ public:
+ // methods
+ virtual ~AP4_Referenceable() {}
+ virtual void AddReference() = 0;
+ virtual void Release() = 0;
+};
+
+#endif // _AP4_INTERFACES_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsfmAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsfmAtom.cpp
new file mode 100644
index 000000000..c40ca3664
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsfmAtom.cpp
@@ -0,0 +1,106 @@
+/*****************************************************************
+|
+| AP4 - iSFM Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Utils.h"
+#include "Ap4IsfmAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::AP4_IsfmAtom
++---------------------------------------------------------------------*/
+AP4_IsfmAtom::AP4_IsfmAtom(bool selective_encryption,
+ AP4_UI08 key_length_indicator,
+ AP4_UI08 iv_length) :
+ AP4_Atom(AP4_ATOM_TYPE_ISFM, AP4_FULL_ATOM_HEADER_SIZE+3, true),
+ m_SelectiveEncryption(selective_encryption),
+ m_KeyIndicatorLength(key_length_indicator),
+ m_IvLength(iv_length)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::AP4_IsfmAtom
++---------------------------------------------------------------------*/
+AP4_IsfmAtom::AP4_IsfmAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_ISFM, size, true, stream)
+{
+ AP4_UI08 s;
+ stream.ReadUI08(s);
+ m_SelectiveEncryption = ((s&1) != 0);
+ stream.ReadUI08(m_KeyIndicatorLength);
+ stream.ReadUI08(m_IvLength);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::Clone
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_IsfmAtom::Clone()
+{
+ return new AP4_IsfmAtom(m_SelectiveEncryption,
+ m_KeyIndicatorLength,
+ m_IvLength);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsfmAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // selective encryption
+ result = stream.WriteUI08(m_SelectiveEncryption ? 1 : 0);
+ if (AP4_FAILED(result)) return result;
+
+ // key indicator length
+ result = stream.WriteUI08(m_KeyIndicatorLength);
+ if (AP4_FAILED(result)) return result;
+
+ // IV length
+ result = stream.WriteUI08(m_IvLength);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsfmAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("selective_encryption", m_SelectiveEncryption);
+ inspector.AddField("key_indicator_length", m_KeyIndicatorLength);
+ inspector.AddField("IV_length", m_IvLength);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsfmAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsfmAtom.h
new file mode 100644
index 000000000..fd07277f2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsfmAtom.h
@@ -0,0 +1,66 @@
+/*****************************************************************
+|
+| AP4 - iSFM Atom
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_ISFM_ATOM_H_
+#define _AP4_ISFM_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_IsfmAtom
++---------------------------------------------------------------------*/
+class AP4_IsfmAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_IsfmAtom(bool m_SelectiveEncryption,
+ AP4_UI08 m_KeyIndicatorLength,
+ AP4_UI08 m_IvLength);
+ AP4_IsfmAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Atom* Clone();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ bool GetSelectiveEncryption() { return m_SelectiveEncryption; }
+ AP4_UI08 GetKeyIndicatorLength() { return m_KeyIndicatorLength; }
+ AP4_UI08 GetIvLength() { return m_IvLength; }
+
+private:
+ // members
+ bool m_SelectiveEncryption;
+ AP4_UI08 m_KeyIndicatorLength;
+ AP4_UI08 m_IvLength;
+};
+
+#endif // _AP4_ISFM_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsmaCryp.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsmaCryp.cpp
new file mode 100644
index 000000000..02db0fc0b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsmaCryp.cpp
@@ -0,0 +1,716 @@
+/*****************************************************************
+|
+| AP4 - Sample Description Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4IsmaCryp.h"
+#include "Ap4SchmAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4Sample.h"
+#include "Ap4StreamCipher.h"
+#include "Ap4IsfmAtom.h"
+#include "Ap4FrmaAtom.h"
+#include "Ap4IkmsAtom.h"
+#include "Ap4IsfmAtom.h"
+#include "Ap4Utils.h"
+#include "Ap4TrakAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_EncaSampleEntry::AP4_EncaSampleEntry
++---------------------------------------------------------------------*/
+AP4_EncaSampleEntry::AP4_EncaSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor) :
+AP4_AudioSampleEntry(AP4_ATOM_TYPE_ENCA,
+ descriptor,
+ sample_rate,
+ sample_size,
+ channel_count)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncaSampleEntry::AP4_EncaSampleEntry
++---------------------------------------------------------------------*/
+AP4_EncaSampleEntry::AP4_EncaSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+AP4_AudioSampleEntry(AP4_ATOM_TYPE_ENCA, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncaSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_EncaSampleEntry::ToSampleDescription()
+{
+ // get the original sample format
+ AP4_FrmaAtom* frma = (AP4_FrmaAtom*)FindChild("sinf/frma");
+
+ // get the scheme info
+ AP4_SchmAtom* schm = (AP4_SchmAtom*)FindChild("sinf/schm");
+ if (schm == NULL) return NULL;
+
+ // get the sample description for the original sample entry
+ AP4_MpegAudioSampleDescription* original_sample_description =
+ (AP4_MpegAudioSampleDescription*)
+ AP4_AudioSampleEntry::ToSampleDescription();
+
+ // get the schi atom
+ AP4_ContainerAtom* schi;
+ schi = static_cast<AP4_ContainerAtom*>(FindChild("sinf/schi"));
+
+ // create the sample description
+ return new AP4_IsmaCrypSampleDescription(
+ original_sample_description,
+ frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4A,
+ schm->GetSchemeType(),
+ schm->GetSchemeVersion(),
+ schm->GetSchemeUri().c_str(),
+ schi);
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncvSampleEntry::AP4_EncaSampleEntry
++---------------------------------------------------------------------*/
+AP4_EncvSampleEntry::AP4_EncvSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_ENCV,
+ descriptor,
+ width,
+ height,
+ depth,
+ compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncvSampleEntry::AP4_EncvSampleEntry
++---------------------------------------------------------------------*/
+AP4_EncvSampleEntry::AP4_EncvSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_ENCV, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_EncvSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_EncvSampleEntry::ToSampleDescription()
+{
+ // get the original sample format
+ AP4_FrmaAtom* frma = (AP4_FrmaAtom*)FindChild("sinf/frma");
+
+ // get the scheme info
+ AP4_SchmAtom* schm = (AP4_SchmAtom*)FindChild("sinf/schm");
+ if (schm == NULL) return NULL;
+
+ // get the sample description for the original sample entry
+ AP4_MpegVideoSampleDescription* original_sample_description =
+ (AP4_MpegVideoSampleDescription*)
+ AP4_VisualSampleEntry::ToSampleDescription();
+
+ // get the schi atom
+ AP4_ContainerAtom* schi;
+ schi = static_cast<AP4_ContainerAtom*>(FindChild("sinf/schi"));
+
+ // create the sample description
+ return new AP4_IsmaCrypSampleDescription(
+ original_sample_description,
+ frma?frma->GetOriginalFormat():AP4_ATOM_TYPE_MP4V,
+ schm->GetSchemeType(),
+ schm->GetSchemeVersion(),
+ schm->GetSchemeUri().c_str(),
+ schi);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSampleDescription::AP4_IsmaCrypSampleDescription
++---------------------------------------------------------------------*/
+AP4_IsmaCrypSampleDescription::AP4_IsmaCrypSampleDescription(
+ AP4_MpegSampleDescription* original_sample_description,
+ AP4_UI32 original_format,
+ AP4_UI32 scheme_type,
+ AP4_UI32 scheme_version,
+ const char* scheme_uri,
+ AP4_ContainerAtom* schi) :
+ AP4_SampleDescription(TYPE_ISMACRYP),
+ m_OriginalSampleDescription(original_sample_description),
+ m_OriginalFormat(original_format),
+ m_SchemeType(scheme_type),
+ m_SchemeVersion(scheme_version),
+ m_SchemeUri(scheme_uri)
+{
+ m_SchemeInfo = new AP4_IsmaCrypSchemeInfo(schi);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSampleDescription::~AP4_IsmaCrypSampleDescription
++---------------------------------------------------------------------*/
+AP4_IsmaCrypSampleDescription::~AP4_IsmaCrypSampleDescription()
+{
+ delete m_SchemeInfo;
+ delete m_OriginalSampleDescription;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_IsmaCrypSampleDescription::ToAtom() const
+{
+ // TODO: not implemented yet
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSchemeInfo::AP4_IsmaCrypSchemeInfo
++---------------------------------------------------------------------*/
+AP4_IsmaCrypSchemeInfo::AP4_IsmaCrypSchemeInfo(AP4_ContainerAtom* schi) :
+ m_SchiAtom(AP4_ATOM_TYPE_SCHI)
+{
+ if (schi) {
+ AP4_List<AP4_Atom>& children = schi->GetChildren();
+ AP4_List<AP4_Atom>::Item* child_item = children.FirstItem();
+ while (child_item) {
+ AP4_Atom* child_atom = child_item->GetData();
+ AP4_Atom* clone = child_atom->Clone();
+ if (clone) m_SchiAtom.AddChild(clone);
+ child_item = child_item->GetNext();
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypCipher::AP4_IsmaCipher
++---------------------------------------------------------------------*/
+AP4_IsmaCipher::AP4_IsmaCipher(const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_Size iv_length,
+ AP4_Size key_indicator_length,
+ bool selective_encryption) :
+ m_IvLength(iv_length),
+ m_KeyIndicatorLength(key_indicator_length),
+ m_SelectiveEncryption(selective_encryption)
+{
+ // NOTE: we do not handle key indicators yey, so there is only one key.
+
+ // left-align the salt
+ unsigned char salt_128[AP4_ISMACRYP_IAEC_KEY_LENGTH];
+ for (unsigned int i=0; i<8; i++) {
+ salt_128[i] = salt[i];
+ }
+ for (unsigned int i=0; i<8; i++) {
+ salt_128[8+i] = 0;
+ }
+
+ // create a cipher
+ m_Cipher = new AP4_StreamCipher(key, salt_128);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCipher::~AP4_IsmaCipher
++---------------------------------------------------------------------*/
+AP4_IsmaCipher::~AP4_IsmaCipher()
+{
+ delete m_Cipher;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCipher::DecryptSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaCipher::DecryptSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out)
+{
+ bool is_encrypted = true;
+ const unsigned char* in = data_in.GetData();
+ if (m_SelectiveEncryption) {
+ is_encrypted = ((in[0]&1)==1);
+ in++;
+ }
+
+ // get the IV (this implementation only supports un to 32 bits of IV)
+ // so we skip anything beyond the last 4 bytes
+ unsigned int to_read = m_IvLength;
+ if (to_read > 16 || to_read == 0) return AP4_ERROR_INVALID_FORMAT;
+ while (to_read > 4) {
+ to_read--;
+ in++;
+ }
+ AP4_UI32 iv = 0;
+ while (to_read--) {
+ iv = (iv<<8) | *in++;
+ }
+
+ // get the key indicator (we only support up to 32 bits as well)
+ to_read = m_KeyIndicatorLength;
+ if (to_read > 4 ) return AP4_ERROR_INVALID_FORMAT;
+ while (to_read > 4) {
+ to_read--;
+ in++;
+ }
+ AP4_UI32 key_indicator = 0;
+ while (to_read--) {
+ key_indicator = (key_indicator<<8) | *in++;
+ }
+ // we only support key indicator = 0 for now... (TODO)
+ if (key_indicator != 0) {
+ return AP4_FAILURE;
+ }
+
+ // process the sample data
+ unsigned int header_size = in-data_in.GetData();
+ unsigned int payload_size = data_in.GetDataSize()-header_size;
+ data_out.SetDataSize(payload_size);
+ unsigned char* out = data_out.UseData();
+ if (is_encrypted) {
+ m_Cipher->SetStreamOffset(iv);
+ m_Cipher->ProcessBuffer(in, out, payload_size);
+ } else {
+ memcpy(out, in, payload_size);
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCipher::EncryptSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaCipher::EncryptSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out,
+ AP4_Offset iv,
+ bool skip_encryption)
+{
+ // setup the buffers
+ const unsigned char* in = data_in.GetData();
+ data_out.SetDataSize(data_in.GetDataSize()+4);
+ unsigned char* out = data_out.UseData();
+
+ // IV on 4 bytes
+ AP4_BytesFromUInt32BE(out, iv);
+ out += 4;
+
+ // encrypt the payload
+ m_Cipher->SetStreamOffset(iv);
+ m_Cipher->ProcessBuffer(in, out, data_in.GetDataSize());
+
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter
++---------------------------------------------------------------------*/
+class AP4_IsmaTrackDecrypter : public AP4_Processor::TrackHandler {
+public:
+ // constructor
+ AP4_IsmaTrackDecrypter(const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_IsmaCrypSampleDescription* sample_description,
+ AP4_SampleEntry* sample_entry);
+ virtual ~AP4_IsmaTrackDecrypter();
+
+ // methods
+ virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample);
+ virtual AP4_Result ProcessTrack();
+ virtual AP4_Result ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out);
+
+private:
+ // members
+ AP4_IsfmAtom* m_CipherParams;
+ AP4_IsmaCipher* m_Cipher;
+ AP4_SampleEntry* m_SampleEntry;
+ AP4_UI32 m_OriginalFormat;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter::AP4_IsmaTrackDecrypter
++---------------------------------------------------------------------*/
+AP4_IsmaTrackDecrypter::AP4_IsmaTrackDecrypter(
+ const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_IsmaCrypSampleDescription* sample_description,
+ AP4_SampleEntry* sample_entry) :
+ m_SampleEntry(sample_entry)
+{
+ // get the cipher params
+ m_CipherParams = (AP4_IsfmAtom*)sample_description->GetSchemeInfo()->GetSchiAtom().FindChild("iSFM");
+
+ // instantiate the cipher
+ m_Cipher = new AP4_IsmaCipher(key, salt,
+ m_CipherParams->GetIvLength(),
+ m_CipherParams->GetKeyIndicatorLength(),
+ m_CipherParams->GetSelectiveEncryption());
+
+ // get the sample entry details
+ m_OriginalFormat = sample_description->GetOriginalFormat();
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter::~AP4_IsmaTrackDecrypter
++---------------------------------------------------------------------*/
+AP4_IsmaTrackDecrypter::~AP4_IsmaTrackDecrypter()
+{
+ delete m_Cipher;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter::GetProcessedSampleSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_IsmaTrackDecrypter::GetProcessedSampleSize(AP4_Sample& sample)
+{
+ AP4_Size isma_header_size =
+ m_CipherParams->GetKeyIndicatorLength() +
+ m_CipherParams->GetIvLength();
+ if (m_CipherParams->GetSelectiveEncryption()) {
+ isma_header_size++;
+ }
+ return sample.GetSize()-isma_header_size;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackDecrypter::ProcessTrack
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaTrackDecrypter::ProcessTrack()
+{
+ m_SampleEntry->SetType(m_OriginalFormat);
+ m_SampleEntry->DeleteChild(AP4_ATOM_TYPE_SINF);
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaDecrypter::ProcessSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaTrackDecrypter::ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out)
+{
+ return m_Cipher->DecryptSample(data_in, data_out);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaDecryptingProcessor:CreateTrackHandler
++---------------------------------------------------------------------*/
+AP4_Processor::TrackHandler*
+AP4_IsmaDecryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
+{
+ // find the stsd atom
+ AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
+ trak->FindChild("mdia/minf/stbl/stsd"));
+
+ // avoid tracks with no stsd atom (should not happen)
+ if (stsd == NULL) return NULL;
+
+ // we only look at the first sample description
+ AP4_SampleDescription* desc = stsd->GetSampleDescription(0);
+ AP4_SampleEntry* entry = stsd->GetSampleEntry(0);
+ if (desc == NULL || entry == NULL) return NULL;
+ if (desc->GetType() == AP4_SampleDescription::TYPE_ISMACRYP) {
+ // create a handler for this track
+ AP4_IsmaCrypSampleDescription* ismacryp_desc =
+ static_cast<AP4_IsmaCrypSampleDescription*>(desc);
+ if (ismacryp_desc->GetSchemeType() == AP4_ISMACRYP_SCHEME_TYPE_IAEC) {
+ const AP4_UI08* key;
+ const AP4_UI08* salt;
+ if (AP4_SUCCEEDED(m_KeyMap.GetKey(trak->GetId(), key, salt))) {
+ return new AP4_IsmaTrackDecrypter(key, salt, ismacryp_desc, entry);
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter
++---------------------------------------------------------------------*/
+class AP4_IsmaTrackEncrypter : public AP4_Processor::TrackHandler {
+public:
+ // constructor
+ AP4_IsmaTrackEncrypter(const char* kms_uri,
+ const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_SampleEntry* sample_entry,
+ AP4_UI32 format);
+ virtual ~AP4_IsmaTrackEncrypter();
+
+ // methods
+ virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample);
+ virtual AP4_Result ProcessTrack();
+ virtual AP4_Result ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out);
+
+private:
+ // members
+ AP4_String m_KmsUri;
+ AP4_IsmaCipher* m_Cipher;
+ AP4_SampleEntry* m_SampleEntry;
+ AP4_UI32 m_Format;
+ AP4_Offset m_ByteOffset;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::AP4_IsmaTrackEncrypter
++---------------------------------------------------------------------*/
+AP4_IsmaTrackEncrypter::AP4_IsmaTrackEncrypter(
+ const char* kms_uri,
+ const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_SampleEntry* sample_entry,
+ AP4_UI32 format) :
+ m_KmsUri(kms_uri),
+ m_SampleEntry(sample_entry),
+ m_Format(format),
+ m_ByteOffset(0)
+{
+ // instantiate the cipher (fixed params for now)
+ m_Cipher = new AP4_IsmaCipher(key, salt, 4, 0, false);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::~AP4_IsmaTrackEncrypter
++---------------------------------------------------------------------*/
+AP4_IsmaTrackEncrypter::~AP4_IsmaTrackEncrypter()
+{
+ delete m_Cipher;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::GetProcessedSampleSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_IsmaTrackEncrypter::GetProcessedSampleSize(AP4_Sample& sample)
+{
+ return sample.GetSize()+4; //fixed header size for now
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::ProcessTrack
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaTrackEncrypter::ProcessTrack()
+{
+ // sinf container
+ AP4_ContainerAtom* sinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_SINF);
+
+ // original format
+ AP4_FrmaAtom* frma = new AP4_FrmaAtom(m_SampleEntry->GetType());
+
+ // scheme
+ AP4_SchmAtom* schm = new AP4_SchmAtom(AP4_ISMACRYP_SCHEME_TYPE_IAEC, 1);
+
+ // scheme info
+ AP4_ContainerAtom* schi = new AP4_ContainerAtom(AP4_ATOM_TYPE_SCHI);
+ AP4_IkmsAtom* ikms = new AP4_IkmsAtom(m_KmsUri.c_str());
+ AP4_IsfmAtom* isfm = new AP4_IsfmAtom(false, 0, 4);
+
+ // populate the schi container
+ schi->AddChild(ikms);
+ schi->AddChild(isfm);
+
+ // populate the sinf container
+ sinf->AddChild(frma);
+ sinf->AddChild(schm);
+ sinf->AddChild(schi);
+
+ // add the sinf atom to the sample description
+ m_SampleEntry->AddChild(sinf);
+
+ // change the atom type of the sample description
+ m_SampleEntry->SetType(m_Format);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaTrackEncrypter::ProcessSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaTrackEncrypter::ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out)
+{
+ AP4_Result result = m_Cipher->EncryptSample(data_in, data_out, m_ByteOffset, false);
+ if (AP4_FAILED(result)) return result;
+
+ m_ByteOffset += data_in.GetDataSize();
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaEncryptingProcessor::AP4_IsmaEncryptingProcessor
++---------------------------------------------------------------------*/
+AP4_IsmaEncryptingProcessor::AP4_IsmaEncryptingProcessor(const char* kms_uri) :
+ m_KmsUri(kms_uri)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaEncryptingProcessor:CreateTrackHandler
++---------------------------------------------------------------------*/
+AP4_Processor::TrackHandler*
+AP4_IsmaEncryptingProcessor::CreateTrackHandler(AP4_TrakAtom* trak)
+{
+ // find the stsd atom
+ AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
+ trak->FindChild("mdia/minf/stbl/stsd"));
+
+ // avoid tracks with no stsd atom (should not happen)
+ if (stsd == NULL) return NULL;
+
+ // only look at the first sample description
+ AP4_SampleEntry* entry = stsd->GetSampleEntry(0);
+ if (entry == NULL) return NULL;
+
+ // create a handler for this track if we have a key for it and we know
+ // how to map the type
+ const AP4_UI08* key;
+ const AP4_UI08* salt;
+ AP4_UI32 format = 0;
+ if (AP4_SUCCEEDED(m_KeyMap.GetKey(trak->GetId(), key, salt))) {
+ switch (entry->GetType()) {
+ case AP4_ATOM_TYPE_MP4A:
+ format = AP4_ATOM_TYPE_ENCA;
+ break;
+
+ case AP4_ATOM_TYPE_MP4V:
+ case AP4_ATOM_TYPE_AVC1:
+ format = AP4_ATOM_TYPE_ENCV;
+ break;
+ }
+ if (format) {
+ return new AP4_IsmaTrackEncrypter(m_KmsUri.c_str(),
+ key,
+ salt,
+ entry,
+ format);
+ }
+ }
+
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::AP4_IsmaKeyMap
++---------------------------------------------------------------------*/
+AP4_IsmaKeyMap::AP4_IsmaKeyMap()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::~AP4_IsmaKeyMap
++---------------------------------------------------------------------*/
+AP4_IsmaKeyMap::~AP4_IsmaKeyMap()
+{
+ m_KeyEntries.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::SetKey
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaKeyMap::SetKey(AP4_UI32 track_id, const AP4_UI08* key, const AP4_UI08* salt)
+{
+ KeyEntry* entry = GetEntry(track_id);
+ if (entry == NULL) {
+ m_KeyEntries.Add(new KeyEntry(track_id, key, salt));
+ } else {
+ entry->SetKey(key, salt);
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::GetKey
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_IsmaKeyMap::GetKey(AP4_UI32 track_id, const AP4_UI08*& key, const AP4_UI08*& salt)
+{
+ KeyEntry* entry = GetEntry(track_id);
+ if (entry) {
+ key = entry->m_Key;
+ salt = entry->m_Salt;
+ return AP4_SUCCESS;
+ } else {
+ return AP4_ERROR_NO_SUCH_ITEM;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::GetEntry
++---------------------------------------------------------------------*/
+AP4_IsmaKeyMap::KeyEntry*
+AP4_IsmaKeyMap::GetEntry(AP4_UI32 track_id)
+{
+ AP4_List<KeyEntry>::Item* item = m_KeyEntries.FirstItem();
+ while (item) {
+ KeyEntry* entry = (KeyEntry*)item->GetData();
+ if (entry->m_TrackId == track_id) return entry;
+ item = item->GetNext();
+ }
+
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::KeyEntry::KeyEntry
++---------------------------------------------------------------------*/
+AP4_IsmaKeyMap::KeyEntry::KeyEntry(AP4_UI32 track_id,
+ const AP4_UI08* key,
+ const AP4_UI08* salt /* = NULL */) :
+ m_TrackId(track_id)
+{
+ SetKey(key, salt);
+}
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap::KeyEntry::SetKey
++---------------------------------------------------------------------*/
+void
+AP4_IsmaKeyMap::KeyEntry::SetKey(const AP4_UI08* key, const AP4_UI08* salt)
+{
+ memcpy(m_Key, key, sizeof(m_Key));
+ if (salt) {
+ memcpy(m_Salt, salt, sizeof(m_Salt));
+ } else {
+ memset(m_Salt, 0, sizeof(m_Salt));
+ }
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsmaCryp.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsmaCryp.h
new file mode 100644
index 000000000..fd1ac7de4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4IsmaCryp.h
@@ -0,0 +1,245 @@
+/*****************************************************************
+|
+| AP4 - Sample Description Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_ISMACRYP_H_
+#define _AP4_ISMACRYP_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4SampleEntry.h"
+#include "Ap4Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4Processor.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_StreamCipher;
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_ISMACRYP_SCHEME_TYPE_IAEC = AP4_ATOM_TYPE('i','A','E','C');
+const AP4_Size AP4_ISMACRYP_IAEC_KEY_LENGTH = 16;
+
+/*----------------------------------------------------------------------
+| AP4_EncaSampleEntry
++---------------------------------------------------------------------*/
+class AP4_EncaSampleEntry : public AP4_AudioSampleEntry
+{
+public:
+ // methods
+ AP4_EncaSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_EncaSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor);
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+};
+
+/*----------------------------------------------------------------------
+| AP4_EncvSampleEntry
++---------------------------------------------------------------------*/
+class AP4_EncvSampleEntry : public AP4_VisualSampleEntry
+{
+public:
+ // constructors
+ AP4_EncvSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_EncvSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor);
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaKeyMap
++---------------------------------------------------------------------*/
+class AP4_IsmaKeyMap
+{
+public:
+ // constructors and destructor
+ AP4_IsmaKeyMap();
+ ~AP4_IsmaKeyMap();
+
+ // methods
+ AP4_Result SetKey(AP4_UI32 track_id, const AP4_UI08* key, const AP4_UI08* salt = NULL);
+ AP4_Result GetKey(AP4_UI32 track_id, const AP4_UI08*& key, const AP4_UI08*& salt);
+
+private:
+ // types
+ class KeyEntry {
+ public:
+ KeyEntry(AP4_UI32 track_id, const AP4_UI08* key, const AP4_UI08* salt = NULL);
+ void SetKey(const AP4_UI08* key, const AP4_UI08* salt);
+ AP4_Ordinal m_TrackId;
+ AP4_UI08 m_Key[AP4_ISMACRYP_IAEC_KEY_LENGTH];
+ AP4_UI08 m_Salt[AP4_ISMACRYP_IAEC_KEY_LENGTH];
+ };
+
+ // methods
+ KeyEntry* GetEntry(AP4_UI32 track_id);
+
+ // members
+ AP4_List<KeyEntry> m_KeyEntries;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaSchemeInfo
++---------------------------------------------------------------------*/
+class AP4_IsmaCrypSchemeInfo
+{
+public:
+ // constructors and destructor
+ AP4_IsmaCrypSchemeInfo(AP4_ContainerAtom* schi);
+ virtual ~AP4_IsmaCrypSchemeInfo(){}
+
+ // accessors
+ AP4_ContainerAtom& GetSchiAtom() { return m_SchiAtom; }
+
+protected:
+ AP4_ContainerAtom m_SchiAtom;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCrypSampleDescription
++---------------------------------------------------------------------*/
+class AP4_IsmaCrypSampleDescription : public AP4_SampleDescription
+{
+public:
+ // constructor and destructor
+ AP4_IsmaCrypSampleDescription(AP4_MpegSampleDescription* original_sample_description,
+ AP4_UI32 original_format,
+ AP4_UI32 scheme_type,
+ AP4_UI32 scheme_version,
+ const char* scheme_uri,
+ AP4_ContainerAtom* schi_atom);
+ ~AP4_IsmaCrypSampleDescription();
+
+ // accessors
+ AP4_MpegSampleDescription* GetOriginalSampleDescription() {
+ return m_OriginalSampleDescription;
+ }
+ AP4_UI32 GetOriginalFormat() { return m_OriginalFormat; }
+ AP4_UI32 GetSchemeType() { return m_SchemeType; }
+ AP4_UI32 GetSchemeVersion() { return m_SchemeVersion; }
+ AP4_String& GetSchemeUri() { return m_SchemeUri; }
+ AP4_IsmaCrypSchemeInfo* GetSchemeInfo() { return m_SchemeInfo; }
+
+ // implementation of abstract base class methods
+ virtual AP4_Atom* ToAtom() const;
+
+private:
+ // members
+ AP4_MpegSampleDescription* m_OriginalSampleDescription;
+ AP4_UI32 m_OriginalFormat;
+ AP4_UI32 m_SchemeType;
+ AP4_UI32 m_SchemeVersion;
+ AP4_String m_SchemeUri;
+ AP4_IsmaCrypSchemeInfo* m_SchemeInfo;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaCipher
++---------------------------------------------------------------------*/
+class AP4_IsmaCipher
+{
+public:
+ // constructor and destructor
+ AP4_IsmaCipher(const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_Size iv_length,
+ AP4_Size key_indicator_length,
+ bool selective_encryption);
+ ~AP4_IsmaCipher();
+ AP4_Result EncryptSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out,
+ AP4_Offset iv,
+ bool skip_encryption);
+ AP4_Result DecryptSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out);
+
+private:
+ // members
+ AP4_StreamCipher* m_Cipher;
+ AP4_Size m_IvLength;
+ AP4_Size m_KeyIndicatorLength;
+ bool m_SelectiveEncryption;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaDecryptingProcessor
++---------------------------------------------------------------------*/
+class AP4_IsmaDecryptingProcessor : public AP4_Processor
+{
+public:
+ // accessors
+ AP4_IsmaKeyMap& GetKeyMap() { return m_KeyMap; }
+
+ // methods
+ virtual AP4_Processor::TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
+
+private:
+ // members
+ AP4_IsmaKeyMap m_KeyMap;
+};
+
+/*----------------------------------------------------------------------
+| AP4_IsmaEncryptingProcessor
++---------------------------------------------------------------------*/
+class AP4_IsmaEncryptingProcessor : public AP4_Processor
+{
+public:
+ // constructors and destructor
+ AP4_IsmaEncryptingProcessor(const char* kms_uri);
+
+ // accessors
+ AP4_IsmaKeyMap& GetKeyMap() { return m_KeyMap; }
+
+ // methods
+ virtual AP4_Processor::TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
+
+private:
+ // members
+ AP4_IsmaKeyMap m_KeyMap;
+ AP4_String m_KmsUri;
+};
+
+#endif // _AP4_ISMACRYP_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4List.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4List.h
new file mode 100644
index 000000000..5a722f109
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4List.h
@@ -0,0 +1,474 @@
+/*****************************************************************
+|
+| AP4 - Lists
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_LIST_H_
+#define _AP4_LIST_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| forward references
++---------------------------------------------------------------------*/
+template <typename T> class AP4_List;
+
+/*----------------------------------------------------------------------
+| AP4_List
++---------------------------------------------------------------------*/
+template <typename T>
+class AP4_List
+{
+public:
+ // types
+ class Item
+ {
+ public:
+ // types
+ class Operator
+ {
+ public:
+ // methods
+ virtual ~Operator() {}
+ virtual AP4_Result Action(T* data) const = 0;
+ };
+
+ class Finder
+ {
+ public:
+ // methods
+ virtual ~Finder() {}
+ virtual AP4_Result Test(T* data) const = 0;
+ };
+
+ // methods
+ Item(T* data) : m_Data(data), m_Next(0), m_Prev(0) {}
+ ~Item() {}
+ Item* GetNext() { return m_Next; }
+ Item* GetPrev() { return m_Prev; }
+ T* GetData() { return m_Data; }
+
+ private:
+ // members
+ T* m_Data;
+ Item* m_Next;
+ Item* m_Prev;
+
+ // friends
+ friend class AP4_List;
+ };
+
+ // methods
+ AP4_List<T>(): m_ItemCount(0), m_Head(0), m_Tail(0) {}
+ virtual ~AP4_List<T>();
+ AP4_Result Add(T* data);
+ AP4_Result Add(Item* item);
+ AP4_Result Remove(T* data);
+ AP4_Result Insert(Item* where, T* data);
+ AP4_Result Get(AP4_Ordinal idx, T*& data);
+ AP4_Result PopHead(T*& data);
+ AP4_Result Apply(const typename Item::Operator& op);
+ AP4_Result ApplyUntilFailure(const typename Item::Operator& op);
+ AP4_Result ApplyUntilSuccess(const typename Item::Operator& op);
+ AP4_Result ReverseApply(const typename Item::Operator& op);
+ AP4_Result Find(const typename Item::Finder& finder, T*& data);
+ AP4_Result ReverseFind(const typename Item::Finder& finder, T*& data);
+ AP4_Result DeleteReferences();
+ AP4_Cardinal ItemCount() { return m_ItemCount; }
+ Item* FirstItem() { return m_Head; }
+ Item* LastItem() { return m_Tail; }
+
+protected:
+ // members
+ AP4_Cardinal m_ItemCount;
+ Item* m_Head;
+ Item* m_Tail;
+
+private:
+ // these cannot be used
+ AP4_List<T>(const AP4_List<T>&);
+ AP4_List<T>& operator=(const AP4_List<T>&);
+};
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::~AP4_List<T>
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_List<T>::~AP4_List<T>()
+{
+ Item* item = m_Head;
+
+ while (item) {
+ Item* next = item->m_Next;
+ delete item;
+ item = next;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Add
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::Add(T* data)
+{
+ return Add(new Item(data));
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Add
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::Add(Item* item)
+{
+ // add element at the tail
+ if (m_Tail) {
+ item->m_Prev = m_Tail;
+ item->m_Next = NULL;
+ m_Tail->m_Next = item;
+ m_Tail = item;
+ } else {
+ m_Head = item;
+ m_Tail = item;
+ item->m_Next = NULL;
+ item->m_Prev = NULL;
+ }
+
+ // one more item in the list now
+ m_ItemCount++;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Remove
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::Remove(T* data)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ if (item->m_Data == data) {
+ // delete item
+ if (item->m_Prev) {
+ // item is not the head
+ if (item->m_Next) {
+ // item is not the tail
+ item->m_Next->m_Prev = item->m_Prev;
+ item->m_Prev->m_Next = item->m_Next;
+ } else {
+ // item is the tail
+ m_Tail = item->m_Prev;
+ m_Tail->m_Next = NULL;
+ }
+ } else {
+ // item is the head
+ m_Head = item->m_Next;
+ if (m_Head) {
+ // item is not the tail
+ m_Head->m_Prev = NULL;
+ } else {
+ // item is also the tail
+ m_Tail = NULL;
+ }
+ }
+
+ // delete the item
+ delete item;
+
+ // one less item in the list now
+ m_ItemCount--;
+
+ return AP4_SUCCESS;
+ }
+ item = item->m_Next;
+ }
+
+ return AP4_ERROR_NO_SUCH_ITEM;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Insert
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::Insert(Item* where, T* data)
+{
+ Item* item = new Item(data);
+
+ if (where == NULL) {
+ // insert as the head
+ if (m_Head) {
+ // replace the current head
+ item->m_Prev = NULL;
+ item->m_Next = m_Head;
+ m_Head->m_Prev = item;
+ m_Head = item;
+ } else {
+ // this item becomes the head and tail
+ m_Head = item;
+ m_Tail = item;
+ item->m_Next = NULL;
+ item->m_Prev = NULL;
+ }
+ } else {
+ // insert after the 'where' item
+ if (where == m_Tail) {
+ // add the item at the end
+ return Add(item);
+ } else {
+ // update the links
+ item->m_Prev = where;
+ item->m_Next = where->m_Next;
+ where->m_Next->m_Prev = item;
+ where->m_Next = item;
+ }
+ }
+
+ // one more item in the list now
+ ++m_ItemCount;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Get
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::Get(AP4_Ordinal idx, T*& data)
+{
+ Item* item = m_Head;
+
+ if (idx < m_ItemCount) {
+ while (idx--) item = item->m_Next;
+ data = item->m_Data;
+ return AP4_SUCCESS;
+ } else {
+ data = NULL;
+ return AP4_ERROR_NO_SUCH_ITEM;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::PopHead
++---------------------------------------------------------------------*/
+template <typename T>
+AP4_Result
+AP4_List<T>::PopHead(T*& data)
+{
+ // check that we have at least one item
+ if (m_Head == NULL) {
+ return AP4_ERROR_LIST_EMPTY;
+ }
+
+ // remove the item and return it
+ data = m_Head->m_Data;
+ Item* head = m_Head;
+ m_Head = m_Head->m_Next;
+ if (m_Head) {
+ m_Head->m_Prev = NULL;
+ } else {
+ m_Tail = NULL;
+ }
+
+ // delete item
+ delete head;
+
+ // one less item in the list now
+ m_ItemCount--;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Apply
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::Apply(const typename Item::Operator& op)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ op.Action(item->m_Data);
+ item = item->m_Next;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::ApplyUntilFailure
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::ApplyUntilFailure(const typename Item::Operator& op)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ AP4_Result result;
+ result = op.Action(item->m_Data);
+ if (result != AP4_SUCCESS) return result;
+ item = item->m_Next;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::ApplyUntilSuccess
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::ApplyUntilSuccess(const typename Item::Operator& op)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ AP4_Result result;
+ result = op.Action(item->m_Data);
+ if (result == AP4_SUCCESS) return AP4_SUCCESS;
+ item = item->m_Next;
+ }
+
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::ReverseApply
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::ReverseApply(const typename Item::Operator& op)
+{
+ Item* item = m_Tail;
+
+ while (item) {
+ if (op.Action(item->m_Data) != AP4_SUCCESS) {
+ return AP4_ERROR_LIST_OPERATION_ABORTED;
+ }
+ item = item->m_Prev;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::Find
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::Find(const typename Item::Finder& finder, T*& data)
+{
+ Item* item = m_Head;
+
+ while (item) {
+ if (finder.Test(item->m_Data) == AP4_SUCCESS) {
+ data = item->m_Data;
+ return AP4_SUCCESS;
+ }
+ item = item->m_Next;
+ }
+
+ data = NULL;
+ return AP4_ERROR_NO_SUCH_ITEM;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::ReverseFind
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::ReverseFind(const typename Item::Finder& finder, T*& data)
+{
+ Item* item = m_Tail;
+
+ while (item) {
+ if (finder.Test(item->m_Data) == AP4_SUCCESS) {
+ data = item->m_Data;
+ return AP4_SUCCESS;
+ }
+ item = item->m_Prev;
+ }
+
+ data = NULL;
+ return AP4_ERROR_NO_SUCH_ITEM;
+}
+
+/*----------------------------------------------------------------------
+| AP4_List<T>::DeleteReferences
++---------------------------------------------------------------------*/
+template <typename T>
+inline
+AP4_Result
+AP4_List<T>::DeleteReferences()
+{
+ Item* item = m_Head;
+
+ while (item) {
+ Item* next = item->m_Next;
+ delete item->m_Data;
+ delete item;
+ item = next;
+ }
+
+ // no more items
+ m_Head = m_Tail = NULL;
+ m_ItemCount = 0;
+
+ return AP4_SUCCESS;
+}
+
+#endif // _AP4_LIST_H_
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MdhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MdhdAtom.cpp
new file mode 100644
index 000000000..c265b023a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MdhdAtom.cpp
@@ -0,0 +1,159 @@
+/*****************************************************************
+|
+| AP4 - mdhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MdhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::AP4_MdhdAtom
++---------------------------------------------------------------------*/
+AP4_MdhdAtom::AP4_MdhdAtom(AP4_UI32 creation_time,
+ AP4_UI32 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI32 duration,
+ const char* language) :
+ AP4_Atom(AP4_ATOM_TYPE_MDHD, 20+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CreationTime(creation_time),
+ m_ModificationTime(modification_time),
+ m_TimeScale(time_scale),
+ m_Duration(duration)
+{
+ m_Language[0] = language[0];
+ m_Language[1] = language[1];
+ m_Language[2] = language[2];
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::AP4_MdhdAtom
++---------------------------------------------------------------------*/
+AP4_MdhdAtom::AP4_MdhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_MDHD, size, true, stream),
+ m_CreationTime(0),
+ m_ModificationTime(0),
+ m_TimeScale(0),
+ m_Duration(0)
+{
+ m_Language[0] = 0;
+ m_Language[1] = 0;
+ m_Language[2] = 0;
+
+ if (m_Version == 0) {
+ // we only deal with version 0 for now
+ stream.ReadUI32(m_CreationTime);
+ stream.ReadUI32(m_ModificationTime);
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI32(m_Duration);
+ } else {
+ stream.Read((void*)m_Reserved1, sizeof(m_Reserved1));
+ }
+
+ unsigned char lang[2];
+ stream.Read(lang, 2, NULL);
+ char l0 = ((lang[0]>>2)&0x1F);
+ char l1 = (((lang[0]&0x3)<<3) | ((lang[1]>>5)&0x7));
+ char l2 = ((lang[1]&0x1F));
+ if (l0) {
+ m_Language[0] = l0+0x60;
+ }
+ if (l1) {
+ m_Language[1] = l1+0x60;
+ }
+ if (l2) {
+ m_Language[2] = l2+0x60;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MdhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ if (m_Version == 0) {
+ // we only deal with version 0 for the moment
+ result = stream.WriteUI32(m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ result = stream.Write(m_Reserved1, sizeof(m_Reserved1));
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // write the language
+ AP4_UI08 l0 = (m_Language[0]==0)?0:(m_Language[0]-0x60);
+ AP4_UI08 l1 = (m_Language[1]==0)?0:(m_Language[1]-0x60);
+ AP4_UI08 l2 = (m_Language[2]==0)?0:(m_Language[2]-0x60);
+ result = stream.WriteUI08(l0<<2 | l1>>3);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI08(l1<<5 | l2);
+ if (AP4_FAILED(result)) return result;
+
+ // pre-defined
+ return stream.WriteUI16(0);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_MdhdAtom::GetDurationMs()
+{
+ return AP4_DurationMsFromUnits(m_Duration, m_TimeScale);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MdhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("timescale", m_TimeScale);
+ inspector.AddField("duration", m_Duration);
+ inspector.AddField("duration(ms)", GetDurationMs());
+ char language[4];
+ AP4_StringFormat(language, sizeof(language),
+ "%c%c%c",
+ m_Language[0] ? m_Language[0]:'-',
+ m_Language[1] ? m_Language[1]:'-',
+ m_Language[2] ? m_Language[2]:'-');
+ inspector.AddField("language", (const char*)language);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MdhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MdhdAtom.h
new file mode 100644
index 000000000..cbccf7c0f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MdhdAtom.h
@@ -0,0 +1,76 @@
+/*****************************************************************
+|
+| AP4 - mdhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MDHD_ATOM_H_
+#define _AP4_MDHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_MDHD_DEFAULT_GENERIC_TIMESCALE = 1000;
+const AP4_UI32 AP4_MDHD_DEFAULT_VIDEO_TIMESCALE = 90000;
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom
++---------------------------------------------------------------------*/
+class AP4_MdhdAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_MdhdAtom(AP4_UI32 creation_time,
+ AP4_UI32 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI32 duration,
+ const char* language);
+ AP4_MdhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_UI32 GetDurationMs();
+ AP4_UI32 GetDuration() { return m_Duration; }
+ AP4_UI32 GetTimeScale() { return m_TimeScale; }
+
+ private:
+ // members
+ AP4_UI32 m_CreationTime;
+ AP4_UI32 m_ModificationTime;
+ AP4_UI32 m_TimeScale;
+ AP4_UI32 m_Duration;
+ char m_Language[3];
+ AP4_UI08 m_Reserved1[28];
+};
+
+#endif // _AP4_MDHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MoovAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MoovAtom.cpp
new file mode 100644
index 000000000..aaf2c62de
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MoovAtom.cpp
@@ -0,0 +1,116 @@
+/*****************************************************************
+|
+| AP4 - moov Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtomCollector
++---------------------------------------------------------------------*/
+class AP4_TrakAtomCollector : public AP4_List<AP4_Atom>::Item::Operator
+{
+public:
+ AP4_TrakAtomCollector(AP4_List<AP4_TrakAtom>* track_atoms) :
+ m_TrakAtoms(track_atoms) {}
+
+ AP4_Result Action(AP4_Atom* atom) const {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
+ AP4_TrakAtom* trak = dynamic_cast<AP4_TrakAtom*>(atom);
+ if (trak) {
+ m_TrakAtoms->Add(trak);
+ }
+ }
+ return AP4_SUCCESS;
+ }
+
+private:
+ AP4_List<AP4_TrakAtom>* m_TrakAtoms;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::AP4_MoovAtom
++---------------------------------------------------------------------*/
+AP4_MoovAtom::AP4_MoovAtom() :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_MOOV),
+ m_TimeScale(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::AP4_MoovAtom
++---------------------------------------------------------------------*/
+AP4_MoovAtom::AP4_MoovAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_MOOV, size, false, stream, atom_factory),
+ m_TimeScale(0)
+{
+ // collect all trak atoms
+ m_Children.Apply(AP4_TrakAtomCollector(&m_TrakAtoms));
+}
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::OnChildAdded
++---------------------------------------------------------------------*/
+void
+AP4_MoovAtom::OnChildAdded(AP4_Atom* atom)
+{
+ // keep the atom in the list of trak atoms
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
+ AP4_TrakAtom* trak = dynamic_cast<AP4_TrakAtom*>(atom);
+ if (trak) {
+ m_TrakAtoms.Add(trak);
+ }
+ }
+
+ // call the base class implementation
+ AP4_ContainerAtom::OnChildAdded(atom);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::OnChildRemoved
++---------------------------------------------------------------------*/
+void
+AP4_MoovAtom::OnChildRemoved(AP4_Atom* atom)
+{
+ // remove the atom from the list of trak atoms
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
+ AP4_TrakAtom* trak = dynamic_cast<AP4_TrakAtom*>(atom);
+ if (trak) {
+ m_TrakAtoms.Remove(trak);
+ }
+ }
+
+ // call the base class implementation
+ AP4_ContainerAtom::OnChildRemoved(atom);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MoovAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MoovAtom.h
new file mode 100644
index 000000000..215423173
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MoovAtom.h
@@ -0,0 +1,71 @@
+/*****************************************************************
+|
+| AP4 - moov Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MOOV_ATOM_H_
+#define _AP4_MOOV_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom
++---------------------------------------------------------------------*/
+class AP4_MoovAtom : public AP4_ContainerAtom
+{
+public:
+ // methods
+ AP4_MoovAtom();
+ AP4_MoovAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_List<AP4_TrakAtom>& GetTrakAtoms() {
+ return m_TrakAtoms;
+ }
+ AP4_UI32 GetTimeScale() {
+ return m_TimeScale;
+ }
+
+ // AP4_AtomParent methods
+ void OnChildAdded(AP4_Atom* atom);
+ void OnChildRemoved(AP4_Atom* atom);
+
+private:
+ // members
+ AP4_List<AP4_TrakAtom> m_TrakAtoms;
+ AP4_UI32 m_TimeScale;
+};
+
+#endif // _AP4_MOOV_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Movie.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Movie.cpp
new file mode 100644
index 000000000..793188d45
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Movie.cpp
@@ -0,0 +1,234 @@
+/*****************************************************************
+|
+| AP4 - Movie
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4File.h"
+#include "Ap4Atom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Movie.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrackFinderById
++---------------------------------------------------------------------*/
+class AP4_TrackFinderById : public AP4_List<AP4_Track>::Item::Finder
+{
+public:
+ AP4_TrackFinderById(AP4_UI32 track_id) : m_TrackId(track_id) {}
+ AP4_Result Test(AP4_Track* track) const {
+ return track->GetId() == m_TrackId ? AP4_SUCCESS : AP4_FAILURE;
+ }
+private:
+ AP4_UI32 m_TrackId;
+};
+
+/*----------------------------------------------------------------------
+| AP4_TrackFinderByType
++---------------------------------------------------------------------*/
+class AP4_TrackFinderByType : public AP4_List<AP4_Track>::Item::Finder
+{
+public:
+ AP4_TrackFinderByType(AP4_Track::Type type, AP4_Ordinal index = 0) :
+ m_Type(type), m_Index(index) {}
+ AP4_Result Test(AP4_Track* track) const {
+ if (track->GetType() == m_Type && m_Index-- == 0) {
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+private:
+ AP4_Track::Type m_Type;
+ mutable AP4_Ordinal m_Index;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Movie::AP4_Movie
++---------------------------------------------------------------------*/
+AP4_Movie::AP4_Movie(AP4_UI32 time_scale)
+{
+ m_MoovAtom = new AP4_MoovAtom();
+ m_MvhdAtom = new AP4_MvhdAtom(0, 0,
+ time_scale,
+ 0,
+ 0x00010000,
+ 0x0100);
+ m_MoovAtom->AddChild(m_MvhdAtom);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::AP4_Moovie
++---------------------------------------------------------------------*/
+AP4_Movie::AP4_Movie(AP4_MoovAtom* moov, AP4_ByteStream& mdat) :
+ m_MoovAtom(moov)
+{
+ // ignore null atoms
+ if (moov == NULL) return;
+
+ // get the time scale
+ AP4_UI32 time_scale;
+ m_MvhdAtom = dynamic_cast<AP4_MvhdAtom*>(moov->GetChild(AP4_ATOM_TYPE_MVHD));
+ if (m_MvhdAtom) {
+ time_scale = m_MvhdAtom->GetTimeScale();
+ } else {
+ time_scale = 0;
+ }
+
+ // get all tracks
+ AP4_List<AP4_TrakAtom>* trak_atoms;
+ trak_atoms = &moov->GetTrakAtoms();
+ AP4_List<AP4_TrakAtom>::Item* item = trak_atoms->FirstItem();
+ while (item) {
+ AP4_Track* track = new AP4_Track(*item->GetData(),
+ mdat,
+ time_scale);
+ m_Tracks.Add(track);
+ item = item->GetNext();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::~AP4_Movie
++---------------------------------------------------------------------*/
+AP4_Movie::~AP4_Movie()
+{
+ m_Tracks.DeleteReferences();
+ delete m_MoovAtom;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Movie::Inspect(AP4_AtomInspector& inspector)
+{
+ // dump the moov atom
+ return m_MoovAtom->Inspect(inspector);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetTrack
++---------------------------------------------------------------------*/
+AP4_Track*
+AP4_Movie::GetTrack(AP4_UI32 track_id)
+{
+ AP4_Track* track = NULL;
+ if (AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderById(track_id), track))) {
+ return track;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetTrack
++---------------------------------------------------------------------*/
+AP4_Track*
+AP4_Movie::GetTrack(AP4_Track::Type track_type, AP4_Ordinal index)
+{
+ AP4_Track* track = NULL;
+ if (AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderByType(track_type, index), track))) {
+ return track;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::AddTrack
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Movie::AddTrack(AP4_Track* track)
+{
+ // assign an ID to the track unless it already has one
+ if (track->GetId() == 0) {
+ track->SetId(m_Tracks.ItemCount()+1);
+ }
+
+ // if we don't have a time scale, use the one from the track
+ if (m_MvhdAtom->GetTimeScale() == 0) {
+ m_MvhdAtom->SetTimeScale(track->GetMediaTimeScale());
+ }
+
+ // adjust the parent time scale of the track
+ track->SetMovieTimeScale(m_MvhdAtom->GetTimeScale());
+
+ // update the movie duration
+ if (m_MvhdAtom->GetDuration() < track->GetDuration()) {
+ m_MvhdAtom->SetDuration(track->GetDuration());
+ }
+
+ // attach the track as a child
+ m_MoovAtom->AddChild(track->GetTrakAtom());
+ m_Tracks.Add(track);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetTimeScale
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Movie::GetTimeScale()
+{
+ if (m_MvhdAtom) {
+ return m_MvhdAtom->GetTimeScale();
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetDuration
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Movie::GetDuration()
+{
+ if (m_MvhdAtom) {
+ return m_MvhdAtom->GetDuration();
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Movie::GetDurationMs()
+{
+ if (m_MvhdAtom) {
+ return m_MvhdAtom->GetDurationMs();
+ } else {
+ return 0;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Movie.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Movie.h
new file mode 100644
index 000000000..ded61b824
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Movie.h
@@ -0,0 +1,70 @@
+/*****************************************************************
+|
+| AP4 - Movie
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MOVIE_H_
+#define _AP4_MOVIE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4Track.h"
+#include "Ap4List.h"
+#include "Ap4ByteStream.h"
+
+/*----------------------------------------------------------------------
+| AP4_Movie
++---------------------------------------------------------------------*/
+class AP4_Movie {
+public:
+ // methods
+ AP4_Movie(AP4_UI32 time_scale = 0);
+ AP4_Movie(AP4_MoovAtom* moov, AP4_ByteStream& mdat);
+ virtual ~AP4_Movie();
+ AP4_Result Inspect(AP4_AtomInspector& inspector);
+
+ AP4_MoovAtom* GetMoovAtom() { return m_MoovAtom;}
+ AP4_MvhdAtom* GetMvhdAtom() { return m_MvhdAtom;}
+ AP4_List<AP4_Track>& GetTracks() { return m_Tracks; }
+ AP4_Track* GetTrack(AP4_UI32 track_id);
+ AP4_Track* GetTrack(AP4_Track::Type type, AP4_Ordinal index = 0);
+ AP4_Result AddTrack(AP4_Track* track);
+ AP4_UI32 GetTimeScale();
+ AP4_UI32 GetDuration();
+ AP4_UI32 GetDurationMs();
+
+private:
+ // members
+ AP4_MoovAtom* m_MoovAtom;
+ AP4_MvhdAtom* m_MvhdAtom;
+ AP4_List<AP4_Track> m_Tracks;
+};
+
+#endif // _AP4_MOVIE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MvhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MvhdAtom.cpp
new file mode 100644
index 000000000..18da70fc6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MvhdAtom.cpp
@@ -0,0 +1,168 @@
+/*****************************************************************
+|
+| AP4 - mvhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::AP4_MvhdAtom
++---------------------------------------------------------------------*/
+AP4_MvhdAtom::AP4_MvhdAtom(AP4_UI32 creation_time,
+ AP4_UI32 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI32 duration,
+ AP4_UI32 rate,
+ AP4_UI16 volume) :
+ AP4_Atom(AP4_ATOM_TYPE_MVHD, 96+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CreationTime(creation_time),
+ m_ModificationTime(modification_time),
+ m_TimeScale(time_scale),
+ m_Duration(duration),
+ m_Rate(rate),
+ m_Volume(volume),
+ m_NextTrackId(0xFFFFFFFF)
+{
+ m_Matrix[0] = 0x00010000;
+ m_Matrix[1] = 0;
+ m_Matrix[2] = 0;
+ m_Matrix[3] = 0;
+ m_Matrix[4] = 0x00010000;
+ m_Matrix[5] = 0;
+ m_Matrix[6] = 0;
+ m_Matrix[7] = 0;
+ m_Matrix[8] = 0x40000000;
+
+ memset(m_Reserved1, 0, sizeof(m_Reserved1));
+ memset(m_Reserved2, 0, sizeof(m_Reserved2));
+ memset(m_Predefined, 0, sizeof(m_Predefined));
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::AP4_MvhdAtom
++---------------------------------------------------------------------*/
+AP4_MvhdAtom::AP4_MvhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_MVHD, size, true, stream)
+{
+ if (m_Version == 0) {
+ // we only deal with version 0 for now
+ stream.ReadUI32(m_CreationTime);
+ stream.ReadUI32(m_ModificationTime);
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI32(m_Duration);
+ } else {
+ stream.Read(m_DataVersion1, sizeof(m_DataVersion1));
+ }
+
+ stream.ReadUI32(m_Rate);
+ stream.ReadUI16(m_Volume);
+ stream.Read(m_Reserved1, sizeof(m_Reserved1));
+ stream.Read(m_Reserved2, sizeof(m_Reserved2));
+ for (int i=0; i<9; i++) {
+ stream.ReadUI32(m_Matrix[i]);
+ }
+ stream.Read(m_Predefined, sizeof(m_Predefined));
+ stream.ReadUI32(m_NextTrackId);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MvhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ if (m_Version == 0) {
+ // we only deal with version 0 for now
+ result = stream.WriteUI32(m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Duration);
+ } else {
+ stream.Write(m_DataVersion1, sizeof(m_DataVersion1));
+ }
+
+ // rate & volume
+ result = stream.WriteUI32(m_Rate);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_Volume);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved
+ result = stream.Write(m_Reserved1, sizeof(m_Reserved1));
+ if (AP4_FAILED(result)) return result;
+ result = stream.Write(m_Reserved2, sizeof(m_Reserved2));
+ if (AP4_FAILED(result)) return result;
+
+ // matrix
+ for (int i=0; i<9; i++) {
+ result = stream.WriteUI32(m_Matrix[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // pre-defined
+ result = stream.Write(m_Predefined, sizeof(m_Predefined));
+ if (AP4_FAILED(result)) return result;
+
+ // next track id
+ return stream.WriteUI32(m_NextTrackId);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::GetDurationMs
++---------------------------------------------------------------------*/
+unsigned long
+AP4_MvhdAtom::GetDurationMs()
+{
+ if (m_TimeScale) {
+ return AP4_ConvertTime(m_Duration, m_TimeScale, 1000);
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MvhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("timescale", m_TimeScale);
+ inspector.AddField("duration", m_Duration);
+ inspector.AddField("duration(ms)", GetDurationMs());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MvhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MvhdAtom.h
new file mode 100644
index 000000000..ebda4dc83
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4MvhdAtom.h
@@ -0,0 +1,81 @@
+/*****************************************************************
+|
+| AP4 - mvhd Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MVHD_ATOM_H_
+#define _AP4_MVHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom
++---------------------------------------------------------------------*/
+class AP4_MvhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_MvhdAtom(AP4_UI32 creation_time,
+ AP4_UI32 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI32 duration,
+ AP4_UI32 rate,
+ AP4_UI16 volume);
+ AP4_MvhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ AP4_UI32 GetDuration() { return m_Duration; }
+ void SetDuration(AP4_UI32 duration) { m_Duration = duration;}
+ AP4_Duration GetDurationMs();
+ AP4_UI32 GetTimeScale() { return m_TimeScale; }
+ AP4_Result SetTimeScale(AP4_UI32 time_scale) {
+ m_TimeScale = time_scale;
+ return AP4_SUCCESS;
+ }
+
+private:
+ // members
+ AP4_UI32 m_CreationTime;
+ AP4_UI32 m_ModificationTime;
+ AP4_UI32 m_TimeScale;
+ AP4_UI32 m_Duration;
+ AP4_UI08 m_DataVersion1[28];
+ AP4_UI32 m_Rate;
+ AP4_UI16 m_Volume;
+ AP4_UI08 m_Reserved1[2];
+ AP4_UI08 m_Reserved2[8];
+ AP4_UI32 m_Matrix[9];
+ AP4_UI08 m_Predefined[24];
+ AP4_UI32 m_NextTrackId;
+};
+
+#endif // _AP4_MVHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4NmhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4NmhdAtom.cpp
new file mode 100644
index 000000000..9a039b2d9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4NmhdAtom.cpp
@@ -0,0 +1,61 @@
+/*****************************************************************
+|
+| AP4 - nmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4NmhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_NmhdAtom::AP4_NmhdAtom
++---------------------------------------------------------------------*/
+AP4_NmhdAtom::AP4_NmhdAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_NMHD, AP4_FULL_ATOM_HEADER_SIZE, true)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_NmhdAtom::AP4_NmhdAtom
++---------------------------------------------------------------------*/
+AP4_NmhdAtom::AP4_NmhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_NMHD, size, true, stream)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_NmhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_NmhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // not implemented yet
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4NmhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4NmhdAtom.h
new file mode 100644
index 000000000..b7ad7d3ce
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4NmhdAtom.h
@@ -0,0 +1,51 @@
+/*****************************************************************
+|
+| AP4 - nmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_NMHD_ATOM_H_
+#define _AP4_NMHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_NmhdAtom
++---------------------------------------------------------------------*/
+class AP4_NmhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_NmhdAtom();
+ AP4_NmhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+};
+
+#endif // _AP4_NMHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Processor.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Processor.cpp
new file mode 100644
index 000000000..6019bd2f0
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Processor.cpp
@@ -0,0 +1,296 @@
+/*****************************************************************
+|
+| AP4 - File Processor
+|
+| Copyright 2003-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Processor.h"
+#include "Ap4AtomSampleTable.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4Array.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+class AP4_SampleLocator {
+public:
+ AP4_SampleLocator() :
+ m_TrakIndex(0),
+ m_SampleTable(NULL),
+ m_SampleIndex(0),
+ m_Chunk(0) {}
+
+ AP4_Ordinal m_TrakIndex;
+ AP4_AtomSampleTable* m_SampleTable;
+ AP4_Ordinal m_SampleIndex;
+ AP4_Sample m_Sample;
+ AP4_Ordinal m_Chunk;
+};
+
+struct AP4_SampleCursor {
+ AP4_SampleLocator m_Locator;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Processor::Process
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Processor::Process(AP4_ByteStream& input,
+ AP4_ByteStream& output,
+ AP4_AtomFactory& atom_factory)
+{
+ // read all atoms
+ AP4_AtomParent top_level;
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(input, atom))) {
+ top_level.AddChild(atom);
+ }
+
+ // remove the [mdat] and [free] atoms, keep a ref to [moov]
+ AP4_MoovAtom* moov = NULL;
+ AP4_List<AP4_Atom>::Item* atom_item = top_level.GetChildren().FirstItem();
+ while (atom_item) {
+ atom = atom_item->GetData();
+ AP4_List<AP4_Atom>::Item* next = atom_item->GetNext();
+ if (//atom->GetType() == AP4_ATOM_TYPE_FREE ||
+ atom->GetType() == AP4_ATOM_TYPE_MDAT) {
+ atom->Detach();
+ delete atom;
+ } else if (atom->GetType() == AP4_ATOM_TYPE_MOOV) {
+ moov = (AP4_MoovAtom*)atom;
+ }
+ atom_item = next;
+ }
+
+ // check that we have a moov atom
+ if (moov == NULL) return AP4_FAILURE;
+
+ // initialize the processor
+ AP4_Result result = Initialize(top_level);
+ if (AP4_FAILED(result)) return result;
+
+ // build an array of track sample cursors
+ AP4_List<AP4_TrakAtom>& trak_atoms = moov->GetTrakAtoms();
+ AP4_Cardinal track_count = trak_atoms.ItemCount();
+ AP4_SampleCursor* cursors = new AP4_SampleCursor[track_count];
+ TrackHandler** handlers = new TrackHandler*[track_count];
+ AP4_List<AP4_TrakAtom>::Item* item = trak_atoms.FirstItem();
+ unsigned int index = 0;
+ while (item) {
+ // create the track handler // find the stsd atom
+ AP4_ContainerAtom* stbl = dynamic_cast<AP4_ContainerAtom*>(
+ item->GetData()->FindChild("mdia/minf/stbl"));
+ if (stbl == NULL) continue;
+ handlers[index] = CreateTrackHandler(item->GetData());
+ cursors[index].m_Locator.m_TrakIndex = index;
+ cursors[index].m_Locator.m_SampleTable = new AP4_AtomSampleTable(stbl, input);
+ cursors[index].m_Locator.m_SampleIndex = 0;
+ cursors[index].m_Locator.m_SampleTable->GetSample(0, cursors[index].m_Locator.m_Sample);
+ cursors[index].m_Locator.m_Chunk = 1;
+ index++;
+ item = item->GetNext();
+ }
+
+ // figure out the layout of the chunks
+ AP4_Array<AP4_SampleLocator> locators;
+ for (;;) {
+ // see which is the next sample to write
+ unsigned int min_offset = 0xFFFFFFFF;
+ int cursor = -1;
+ for (unsigned int i=0; i<track_count; i++) {
+ if (cursors[i].m_Locator.m_SampleTable &&
+ cursors[i].m_Locator.m_Sample.GetOffset() <= min_offset) {
+ min_offset = cursors[i].m_Locator.m_Sample.GetOffset();
+ cursor = i;
+ }
+ }
+
+ // stop if all cursors are exhausted
+ if (cursor == -1) break;
+
+ // append this locator to the layout list
+ AP4_SampleLocator& locator = cursors[cursor].m_Locator;
+ locators.Append(locator);
+ //AP4_Debug("NEXT: track %d, sample %d:%d: offset=%d, size=%d\n",
+ // locator.m_TrakIndex,
+ // locator.m_Chunk,
+ // locator.m_SampleIndex,
+ // locator.m_Sample.GetOffset(),
+ // locator.m_Sample.GetSize());
+
+ // move the cursor to the next sample
+ locator.m_SampleIndex++;
+ if (locator.m_SampleIndex == locator.m_SampleTable->GetSampleCount()) {
+ // mark this track as completed
+ locator.m_SampleTable = NULL;
+ } else {
+ // get the next sample info
+ locator.m_SampleTable->GetSample(locator.m_SampleIndex,
+ locator.m_Sample);
+ AP4_Ordinal skip, sdesc;
+ locator.m_SampleTable->GetChunkForSample(locator.m_SampleIndex+1, // the internal API is 1-based
+ locator.m_Chunk,
+ skip, sdesc);
+ }
+ }
+
+ // update the stbl atoms and compute the mdat size
+ AP4_Size mdat_size = 0;
+ int current_track = -1;
+ int current_chunk = -1;
+ AP4_Offset current_chunk_offset = 0;
+ AP4_Size current_chunk_size = 0;
+ for (AP4_Ordinal i=0; i<locators.ItemCount(); i++) {
+ AP4_SampleLocator& locator = locators[i];
+ if ((int)locator.m_TrakIndex != current_track ||
+ (int)locator.m_Chunk != current_chunk) {
+ // start a new chunk for this track
+ current_chunk_offset += current_chunk_size;
+ current_chunk_size = 0;
+ current_track = locator.m_TrakIndex;
+ current_chunk = locator.m_Chunk;
+ locator.m_SampleTable->SetChunkOffset(locator.m_Chunk,
+ current_chunk_offset);
+ }
+ AP4_Size sample_size;
+ TrackHandler* handler = handlers[locator.m_TrakIndex];
+ if (handler) {
+ sample_size = handler->GetProcessedSampleSize(locator.m_Sample);
+ locator.m_SampleTable->SetSampleSize(locator.m_SampleIndex+1, sample_size);
+ } else {
+ sample_size = locator.m_Sample.GetSize();
+ }
+ current_chunk_size += sample_size;
+ mdat_size += sample_size;
+ }
+
+ // process the tracks (ex: sample descriptions processing)
+ for (AP4_Ordinal i=0; i<track_count; i++) {
+ TrackHandler* handler = handlers[i];
+ if (handler) handler->ProcessTrack();
+ }
+
+ // initialize the processor
+ Finalize(top_level);
+
+ // calculate the size of all atoms combined
+ AP4_Size atoms_size = 0;
+ top_level.GetChildren().Apply(AP4_AtomSizeAdder(atoms_size));
+
+ // adjust the chunk offsets
+ for (AP4_Ordinal i=0; i<track_count; i++) {
+ AP4_TrakAtom* trak;
+ trak_atoms.Get(i, trak);
+ trak->AdjustChunkOffsets(atoms_size+AP4_ATOM_HEADER_SIZE);
+ }
+
+ // write all atoms
+ top_level.GetChildren().Apply(AP4_AtomListWriter(output));
+
+ // write mdat header
+ output.WriteUI32(mdat_size+AP4_ATOM_HEADER_SIZE);
+ output.WriteUI32(AP4_ATOM_TYPE_MDAT);
+
+#if defined(AP4_DEBUG)
+ AP4_Offset before;
+ output.Tell(before);
+#endif
+
+ // write the samples
+ AP4_Sample sample;
+ AP4_DataBuffer data_in;
+ AP4_DataBuffer data_out;
+ for (unsigned int i=0; i<locators.ItemCount(); i++) {
+ AP4_SampleLocator& locator = locators[i];
+ locator.m_Sample.ReadData(data_in);
+ TrackHandler* handler = handlers[locator.m_TrakIndex];
+ if (handler) {
+ handler->ProcessSample(data_in, data_out);
+ output.Write(data_out.GetData(), data_out.GetDataSize());
+ } else {
+ output.Write(data_in.GetData(), data_in.GetDataSize());
+ }
+ }
+
+#if defined(AP4_DEBUG)
+ AP4_Offset after;
+ output.Tell(after);
+ AP4_ASSERT(after-before == mdat_size);
+#endif
+
+ // cleanup
+ delete[] cursors;
+ for (unsigned int i=0; i<track_count; i++) {
+ delete handlers[i];
+ }
+ delete[] handlers;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Processor:Initialize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Processor::Initialize(AP4_AtomParent& top_level)
+{
+ // default implementation: do nothing
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Processor:Finalize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Processor::Finalize(AP4_AtomParent& top_level)
+{
+ // default implementation: do nothing
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Processor:CreateTrackHandler
++---------------------------------------------------------------------*/
+AP4_Processor::TrackHandler*
+AP4_Processor::CreateTrackHandler(AP4_TrakAtom* /* trak */)
+{
+ // default implementation: no handler
+ return NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Processor::TrackHandler::GetProcessedSampleSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_Processor::TrackHandler::GetProcessedSampleSize(AP4_Sample& sample)
+{
+ // default implementation: do no change the sample size
+ return sample.GetSize();
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Processor.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Processor.h
new file mode 100644
index 000000000..7d1f03d4f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Processor.h
@@ -0,0 +1,72 @@
+/*****************************************************************
+|
+| AP4 - File Processor
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_ContainerAtom;
+class AP4_Sample;
+class AP4_ByteStream;
+class AP4_DataBuffer;
+class AP4_TrakAtom;
+
+/*----------------------------------------------------------------------
+| AP4_Processor
++---------------------------------------------------------------------*/
+class AP4_Processor {
+public:
+ // types
+ class TrackHandler {
+ public:
+ virtual ~TrackHandler() {}
+ virtual AP4_Size GetProcessedSampleSize(AP4_Sample& sample);
+ virtual AP4_Result ProcessTrack() { return AP4_SUCCESS; }
+ virtual AP4_Result ProcessSample(AP4_DataBuffer& data_in,
+ AP4_DataBuffer& data_out) = 0;
+ };
+
+ // constructor and destructor
+ virtual ~AP4_Processor() {}
+
+ // abstract base class methods
+ AP4_Result Process(AP4_ByteStream& input,
+ AP4_ByteStream& output,
+ AP4_AtomFactory& atom_factory =
+ AP4_AtomFactory::DefaultFactory);
+
+ // overridable methods
+ virtual AP4_Result Initialize(AP4_AtomParent& top_level);
+ virtual AP4_Result Finalize(AP4_AtomParent& top_level);
+ virtual TrackHandler* CreateTrackHandler(AP4_TrakAtom* trak);
+};
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Results.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Results.h
new file mode 100644
index 000000000..21d3cf5ed
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Results.h
@@ -0,0 +1,63 @@
+/*****************************************************************
+|
+| AP4 - Result Codes
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_RESULTS_H_
+#define _AP4_RESULTS_H_
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_SUCCESS = 0;
+const int AP4_FAILURE = -1;
+const int AP4_ERROR_OUT_OF_MEMORY = -2;
+const int AP4_ERROR_INVALID_PARAMETERS = -3;
+const int AP4_ERROR_NO_SUCH_FILE = -4;
+const int AP4_ERROR_PERMISSION_DENIED = -5;
+const int AP4_ERROR_CANNOT_OPEN_FILE = -6;
+const int AP4_ERROR_EOS = -7;
+const int AP4_ERROR_WRITE_FAILED = -8;
+const int AP4_ERROR_READ_FAILED = -9;
+const int AP4_ERROR_INVALID_FORMAT = -10;
+const int AP4_ERROR_NO_SUCH_ITEM = -11;
+const int AP4_ERROR_OUT_OF_RANGE = -12;
+const int AP4_ERROR_INTERNAL = -13;
+const int AP4_ERROR_INVALID_STATE = -14;
+const int AP4_ERROR_LIST_EMPTY = -15;
+const int AP4_ERROR_LIST_OPERATION_ABORTED = -16;
+const int AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE = -17;
+const int AP4_ERROR_NOT_SUPPORTED_YET = -18;
+const int AP4_ERROR_INVALID_TRACK_TYPE = -19;
+const int AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA = -20;
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define AP4_FAILED(result) ((result) != AP4_SUCCESS)
+#define AP4_SUCCEEDED(result) ((result) == AP4_SUCCESS)
+
+#endif // _AP4_RESULTS_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpAtom.cpp
new file mode 100644
index 000000000..1cf72cfa2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpAtom.cpp
@@ -0,0 +1,93 @@
+/*****************************************************************
+|
+| AP4 - sdp Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4RtpAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+
+/*----------------------------------------------------------------------
+| AP4_RtpAtom::AP4_RtpAtom
++---------------------------------------------------------------------*/
+AP4_RtpAtom::AP4_RtpAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_RTP, size, false, stream)
+{
+ // desc format
+ stream.ReadUI32(m_DescriptionFormat);
+
+ // sdptext
+ int str_size = size-(AP4_ATOM_HEADER_SIZE+4);
+ if (str_size) {
+ char* str = new char[str_size+1];
+ stream.Read(str, str_size);
+ str[str_size] = '\0'; // force null-termination
+ m_SdpText = str;
+ delete[] str;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // description format
+ result = stream.WriteUI32(m_DescriptionFormat);
+ if (AP4_FAILED(result)) return result;
+
+ // sdp text
+ result = stream.Write(m_SdpText.c_str(), m_SdpText.length());
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_ATOM_HEADER_SIZE+4+m_SdpText.length());
+ while (padding--) stream.WriteUI08(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char format_string[5];
+ AP4_FormatFourChars(format_string, m_DescriptionFormat);
+ inspector.AddField("description_format", format_string);
+ inspector.AddField("sdp_text", m_SdpText.c_str());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpAtom.h
new file mode 100644
index 000000000..1ae414f60
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpAtom.h
@@ -0,0 +1,59 @@
+/*****************************************************************
+|
+| AP4 - rtp Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_RTP_ATOM_H_
+#define _AP4_RTP_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_RtpAtom
++---------------------------------------------------------------------*/
+class AP4_RtpAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_RtpAtom(AP4_Size size, AP4_ByteStream& stream);
+ const AP4_String& GetSdpText() { return m_SdpText; }
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI32 m_DescriptionFormat;
+ AP4_String m_SdpText;
+};
+
+#endif // _AP4_RTP_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpHint.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpHint.cpp
new file mode 100644
index 000000000..e5545618c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpHint.cpp
@@ -0,0 +1,638 @@
+/*****************************************************************
+|
+| AP4 - RTP Hint Objects
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4RtpHint.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::~AP4_RtpSampleData
++---------------------------------------------------------------------*/
+AP4_RtpSampleData::~AP4_RtpSampleData()
+{
+ AP4_List<AP4_RtpPacket>::Item* it = m_Packets.FirstItem();
+ while (it != NULL) {
+ it->GetData()->Release();
+ it = it->GetNext();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::AP4_RtpSampleData
++---------------------------------------------------------------------*/
+AP4_RtpSampleData::AP4_RtpSampleData(AP4_ByteStream& stream, AP4_Size size)
+{
+ // save the start position
+ AP4_Offset start, extra_data_start;
+ stream.Tell(start);
+
+ AP4_UI16 packet_count;
+ stream.ReadUI16(packet_count);
+
+ AP4_UI16 reserved;
+ stream.ReadUI16(reserved); // later, check that reserved is 0
+
+ // packets
+ for (AP4_UI16 i=0; i<packet_count; i++) {
+ AP4_RtpPacket* packet = new AP4_RtpPacket(stream);
+ m_Packets.Add(packet);
+ }
+
+ // extra data
+ stream.Tell(extra_data_start);
+ AP4_Size extra_data_size = size - (extra_data_start-start);
+ if (extra_data_size != 0) {
+ m_ExtraData.SetDataSize(extra_data_size);
+ stream.Read(m_ExtraData.UseData(), extra_data_size);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::GetSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_RtpSampleData::GetSize()
+{
+ // packet count and reserved
+ AP4_Size result = 4;
+
+ // packets
+ AP4_List<AP4_RtpPacket>::Item* it = m_Packets.FirstItem();
+ while (it != NULL) {
+ result = it->GetData()->GetSize();
+ it = it->GetNext();
+ }
+
+ // extra data
+ result += m_ExtraData.GetDataSize();
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::ToByteStream
++---------------------------------------------------------------------*/
+AP4_ByteStream*
+AP4_RtpSampleData::ToByteStream()
+{
+ // refresh the size
+ AP4_Size size = GetSize();
+
+ // create a memory stream
+ AP4_MemoryByteStream* stream = new AP4_MemoryByteStream(size);
+
+ // write in it
+ AP4_Result result = stream->WriteUI16(static_cast<AP4_UI16>(m_Packets.ItemCount()));
+ if (AP4_FAILED(result)) goto bail;
+
+ result = stream->WriteUI16(0); // reserved
+ if (AP4_FAILED(result)) goto bail;
+
+ {
+ AP4_List<AP4_RtpPacket>::Item* it = m_Packets.FirstItem();
+ while (it != NULL) {
+ result = it->GetData()->Write(*stream);
+ if (AP4_FAILED(result)) goto bail;
+ it = it->GetNext();
+ }
+ }
+
+ result = stream->Write(m_ExtraData.GetData(), m_ExtraData.GetDataSize());
+ if (AP4_FAILED(result)) goto bail;
+
+ // return
+ return stream;
+
+bail:
+ stream->Release();
+ return NULL;
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData::AddPacket
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpSampleData::AddPacket(AP4_RtpPacket* packet)
+{
+ packet->AddReference();
+ return m_Packets.Add(packet);
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AP4_RtpPacket
++---------------------------------------------------------------------*/
+AP4_RtpPacket::AP4_RtpPacket(AP4_Integer relative_time,
+ bool p_bit,
+ bool x_bit,
+ bool m_bit,
+ AP4_UI08 payload_type,
+ AP4_UI16 sequence_seed,
+ AP4_Integer time_stamp_offset /* = 0 */,
+ bool bframe_flag /* = false */,
+ bool repeat_flag /* = false */) :
+ m_ReferenceCount(1),
+ m_RelativeTime(relative_time),
+ m_PBit(p_bit),
+ m_XBit(x_bit),
+ m_MBit(m_bit),
+ m_PayloadType(payload_type),
+ m_SequenceSeed(sequence_seed),
+ m_TimeStampOffset(time_stamp_offset),
+ m_BFrameFlag(bframe_flag),
+ m_RepeatFlag(repeat_flag)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AP4_RtpPacket
++---------------------------------------------------------------------*/
+AP4_RtpPacket::AP4_RtpPacket(AP4_ByteStream& stream) :
+ m_ReferenceCount(1),
+ m_TimeStampOffset(0)
+{
+ AP4_UI08 octet;
+
+ // relative time
+ AP4_UI32 relative_time;
+ stream.ReadUI32(relative_time);
+ m_RelativeTime = relative_time;
+
+ // pbit and xbit
+ stream.ReadUI08(octet);
+ m_PBit = (octet & 0x20) != 0;
+ m_XBit = (octet & 0x10) != 0;
+
+ // mbit and payload type
+ stream.ReadUI08(octet);
+ m_MBit = (octet & 0x80) != 0;
+ m_PayloadType = octet & 0x7F;
+
+ // sequence seed
+ stream.ReadUI16(m_SequenceSeed);
+
+ // extra, bframe and repeat flags
+ stream.ReadUI08(octet);
+ stream.ReadUI08(octet); // repeat on purpose
+ bool extra_flag = (octet & 0x04) != 0;
+
+ // bframe and repeat flags
+ m_BFrameFlag = (octet & 0x02) != 0;
+ m_RepeatFlag = (octet & 0x01) != 0;
+
+ // constructor count
+ AP4_UI16 constructor_count;
+ stream.ReadUI16(constructor_count);
+
+ // parse the packet extra data
+ if (extra_flag) {
+ // read the length
+ AP4_UI32 extra_length;
+ stream.ReadUI32(extra_length);
+
+ // check it
+ if (extra_length < 4)
+ throw AP4_Exception(AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA);
+
+ // now read the entries
+ extra_length -= 4;
+ while (extra_length > 0) {
+ AP4_UI32 entry_length;
+ AP4_UI32 entry_tag;
+ stream.ReadUI32(entry_length);
+ stream.ReadUI32(entry_tag);
+
+ // check the entry
+ if (entry_length < 8) {
+ throw AP4_Exception(AP4_ERROR_INVALID_RTP_PACKET_EXTRA_DATA);
+ }
+
+ // parse the single entry that's currently defined in the spec
+ if (entry_tag == AP4_ATOM_TYPE('r','t','p','o') && entry_length == 12) {
+ AP4_UI32 time_stamp_offset;
+ stream.ReadUI32(time_stamp_offset);
+ m_TimeStampOffset = time_stamp_offset;
+ } else {
+ // ignore it
+ AP4_Offset cur_pos;
+ stream.Tell(cur_pos);
+ stream.Seek(cur_pos + entry_length - 8); // 8 = length + tag
+ }
+
+ extra_length -= entry_length;
+ }
+ }
+
+ // constructors
+ for (AP4_UI16 i=0; i<constructor_count; i++) {
+ AP4_RtpConstructor* constructor = NULL;
+ AP4_RtpConstructorFactory::CreateConstructorFromStream(stream, constructor);
+ m_Constructors.Add(constructor);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AP4_RtpPacket
++---------------------------------------------------------------------*/
+AP4_RtpPacket::~AP4_RtpPacket()
+{
+ AP4_List<AP4_RtpConstructor>::Item* it = m_Constructors.FirstItem();
+ while (it != NULL) {
+ it->GetData()->Release();
+ it = it->GetNext();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_RtpPacket::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::Release
++---------------------------------------------------------------------*/
+void
+AP4_RtpPacket::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::GetSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_RtpPacket::GetSize()
+{
+ AP4_Size result = 12 + (m_TimeStampOffset != 0)?16:0;
+ result += m_Constructors.ItemCount() * AP4_RTP_CONSTRUCTOR_SIZE;
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpPacket::Write(AP4_ByteStream& stream)
+{
+ // check the payload type
+ if (m_PayloadType > 128) return AP4_FAILURE;
+
+ // now write
+ AP4_Result result = stream.WriteUI32(m_RelativeTime);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI08(0x80 | m_PBit << 5 | m_XBit << 4);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI08(m_MBit << 7 | m_PayloadType);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI16(m_SequenceSeed);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI08(0);
+ if (AP4_FAILED(result)) return result;
+
+ // deal with extra flag
+ bool extra_flag = m_TimeStampOffset != 0;
+ result = stream.WriteUI08(0x00 | extra_flag << 2
+ | m_BFrameFlag << 1
+ | m_RepeatFlag << 0);
+ if (AP4_FAILED(result)) return result;
+
+
+ // constructor count
+ result = stream.WriteUI16(static_cast<AP4_UI16>(m_Constructors.ItemCount()));
+
+ // write extra data
+ if (extra_flag) {
+ // extra_length
+ result = stream.WriteUI32(16); // 4 (extra_length) + 12 (rtpo atom)
+ if (AP4_FAILED(result)) return result;
+
+ // rtpo atom
+ result = stream.WriteUI32(12); // size
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(AP4_ATOM_TYPE('r','t','p','o'));
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeStampOffset);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // constructors
+ AP4_List<AP4_RtpConstructor>::Item* it = m_Constructors.FirstItem();
+ while (it != NULL) {
+ result = it->GetData()->Write(stream);
+ if (AP4_FAILED(result)) return result;
+ it = it->GetNext();
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket::AddConstructor
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpPacket::AddConstructor(AP4_RtpConstructor* constructor)
+{
+ constructor->AddReference();
+ return m_Constructors.Add(constructor);
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructor::GetConstructedDataSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_RtpPacket::GetConstructedDataSize()
+{
+ // header + ssrc
+ AP4_Size size = 12;
+
+ // constructed data from constructors
+ AP4_List<AP4_RtpConstructor>::Item* constructors_it
+ = m_Constructors.FirstItem();
+ while (constructors_it != NULL) {
+ size += constructors_it->GetData()->GetConstructedDataSize();
+ constructors_it = constructors_it->GetNext();
+ }
+
+ return size;
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructor::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_RtpConstructor::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructor::Release
++---------------------------------------------------------------------*/
+void
+AP4_RtpConstructor::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
+/*----------------------------------------------------------------------
+| AP4_RtpConstructor::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpConstructor::Write(AP4_ByteStream& stream)
+{
+ AP4_Result result = stream.WriteUI08(m_Type);
+ if (AP4_FAILED(result)) return result;
+
+ return DoWrite(stream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_NoopRtpConstructor::AP4_NoopRtpConstructor
++---------------------------------------------------------------------*/
+AP4_NoopRtpConstructor::AP4_NoopRtpConstructor(AP4_ByteStream& stream) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_NOOP)
+{
+ AP4_Offset cur_offset;
+ stream.Tell(cur_offset);
+ stream.Seek(cur_offset+15);
+}
+
+/*----------------------------------------------------------------------
+| AP4_NoopRtpConstructor::DoWrite
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_NoopRtpConstructor::DoWrite(AP4_ByteStream& stream)
+{
+ AP4_UI08 pad[15];
+
+ return stream.Write(pad, sizeof(pad));
+}
+
+/*----------------------------------------------------------------------
+| AP4_ImmediateRtpConstructor::AP4_ImmediateRtpConstructor
++---------------------------------------------------------------------*/
+AP4_ImmediateRtpConstructor::AP4_ImmediateRtpConstructor(const AP4_DataBuffer& data) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE),
+ m_Data(data)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_ImmediateRtpConstructor::AP4_ImmediateRtpConstructor
++---------------------------------------------------------------------*/
+AP4_ImmediateRtpConstructor::AP4_ImmediateRtpConstructor(AP4_ByteStream& stream) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE)
+{
+ AP4_Offset cur_offset;
+ stream.Tell(cur_offset);
+
+ // data
+ AP4_UI08 data_size;
+ stream.ReadUI08(data_size);
+ m_Data.SetDataSize(data_size);
+ stream.Read(m_Data.UseData(), data_size);
+
+ // reposition the stream
+ stream.Seek(cur_offset+15);
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_ImmediateRtpConstructor::DoWrite
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ImmediateRtpConstructor::DoWrite(AP4_ByteStream& stream)
+{
+ // first check that the data is not too large
+ if (m_Data.GetDataSize() > 14) return AP4_FAILURE;
+
+ // now write
+ AP4_Result result = stream.WriteUI08(static_cast<AP4_UI08>(m_Data.GetDataSize()));
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.Write(m_Data.GetData(), m_Data.GetDataSize());
+ if (AP4_FAILED(result)) return result;
+
+ // pad
+ AP4_Byte pad[14];
+ return stream.Write(pad, sizeof(pad)-m_Data.GetDataSize());
+}
+/*----------------------------------------------------------------------
+| AP4_SampleRtpConstructor::AP4_SampleRtpConstructor
++---------------------------------------------------------------------*/
+AP4_SampleRtpConstructor::AP4_SampleRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_num,
+ AP4_UI32 sample_offset) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE),
+ m_TrackRefIndex(track_ref_index),
+ m_Length(length),
+ m_SampleNum(sample_num),
+ m_SampleOffset(sample_offset)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_SampleRtpConstructor::AP4_SampleRtpConstructor
++---------------------------------------------------------------------*/
+AP4_SampleRtpConstructor::AP4_SampleRtpConstructor(AP4_ByteStream& stream) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE)
+{
+ // offset
+ AP4_Offset cur_offset;
+ stream.Tell(cur_offset);
+
+ // data
+ stream.ReadUI08(m_TrackRefIndex);
+ stream.ReadUI16(m_Length);
+ stream.ReadUI32(m_SampleNum);
+ stream.ReadUI32(m_SampleOffset);
+
+ // reposition the stream
+ stream.Seek(cur_offset+15);
+}
+/*----------------------------------------------------------------------
+| AP4_SampleRtpConstructor::DoWrite
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleRtpConstructor::DoWrite(AP4_ByteStream& stream)
+{
+ AP4_Result result = stream.WriteUI08(m_TrackRefIndex);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI16(m_Length);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI32(m_SampleNum);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI32(m_SampleOffset);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI16(1); // bytes per block
+ if (AP4_FAILED(result)) return result;
+
+ return stream.WriteUI16(1); // samples per block
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor
++---------------------------------------------------------------------*/
+AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_desc_index,
+ AP4_UI32 sample_desc_offset) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC),
+ m_TrackRefIndex(track_ref_index),
+ m_Length(length),
+ m_SampleDescIndex(sample_desc_index),
+ m_SampleDescOffset(sample_desc_offset)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor
++---------------------------------------------------------------------*/
+AP4_SampleDescRtpConstructor::AP4_SampleDescRtpConstructor(AP4_ByteStream& stream) :
+ AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC)
+{
+ // offset
+ AP4_Offset cur_offset;
+ stream.Tell(cur_offset);
+
+ // data
+ stream.ReadUI08(m_TrackRefIndex);
+ stream.ReadUI16(m_Length);
+ stream.ReadUI32(m_SampleDescIndex);
+ stream.ReadUI32(m_SampleDescOffset);
+
+ // reposition the stream
+ stream.Seek(cur_offset+15);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescRtpConstructor::DoWrite
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleDescRtpConstructor::DoWrite(AP4_ByteStream& stream)
+{
+ AP4_Result result = stream.WriteUI08(m_TrackRefIndex);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI16(m_Length);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI32(m_SampleDescIndex);
+ if (AP4_FAILED(result)) return result;
+
+ result = stream.WriteUI32(m_SampleDescOffset);
+ if (AP4_FAILED(result)) return result;
+
+ return stream.WriteUI32(0); // reserved
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructorFactory::CreateConstructorFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpConstructorFactory::CreateConstructorFromStream(AP4_ByteStream& stream,
+ AP4_RtpConstructor*& constructor)
+{
+ // read the first byte (type)
+ AP4_RtpConstructor::Type type;
+ AP4_Result result = stream.ReadUI08(type);
+ if (AP4_FAILED(result)) return result;
+
+ switch(type) {
+ case AP4_RTP_CONSTRUCTOR_TYPE_NOOP:
+ constructor = new AP4_NoopRtpConstructor(stream);
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE:
+ constructor = new AP4_ImmediateRtpConstructor(stream);
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE:
+ constructor = new AP4_SampleRtpConstructor(stream);
+ break;
+ case AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC:
+ constructor = new AP4_SampleDescRtpConstructor(stream);
+ break;
+ default:
+ return AP4_ERROR_INVALID_RTP_CONSTRUCTOR_TYPE;
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpHint.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpHint.h
new file mode 100644
index 000000000..b5cfd67f1
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4RtpHint.h
@@ -0,0 +1,297 @@
+/*****************************************************************
+|
+| AP4 - RTP Hint Objects
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_RTP_HINT_H_
+#define _AP4_RTP_HINT_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4List.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Interfaces.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_ByteStream;
+class AP4_RtpConstructor;
+class AP4_RtpPacket;
+
+/*----------------------------------------------------------------------
+| AP4_RtpSampleData
++---------------------------------------------------------------------*/
+class AP4_RtpSampleData
+{
+public:
+ // constructors and destructor
+ AP4_RtpSampleData(AP4_ByteStream& stream, AP4_Size size);
+ AP4_RtpSampleData() {}
+ virtual ~AP4_RtpSampleData();
+
+ // methods
+ virtual AP4_Result AddPacket(AP4_RtpPacket* packet);
+ virtual AP4_Size GetSize();
+ virtual AP4_ByteStream* ToByteStream();
+
+ // accessors
+ AP4_List<AP4_RtpPacket>& GetPackets() {
+ return m_Packets;
+ }
+ const AP4_DataBuffer& GetExtraData() const {
+ return m_ExtraData;
+ }
+
+protected:
+ // members
+ AP4_List<AP4_RtpPacket> m_Packets;
+ AP4_DataBuffer m_ExtraData;
+};
+
+/*----------------------------------------------------------------------
+| AP4_RtpPacket
++---------------------------------------------------------------------*/
+class AP4_RtpPacket : public AP4_Referenceable
+{
+public:
+ // constructor and destructor
+ AP4_RtpPacket(AP4_ByteStream& stream);
+ AP4_RtpPacket(AP4_Integer relative_time,
+ bool p_bit,
+ bool x_bit,
+ bool m_bit,
+ AP4_UI08 payload_type,
+ AP4_UI16 sequence_seed,
+ AP4_Integer time_stamp_offset = 0,
+ bool bframe_flag = false,
+ bool repeat_flag = false);
+ ~AP4_RtpPacket();
+
+ // methods
+ AP4_Result Write(AP4_ByteStream& stream);
+ AP4_Result AddConstructor(AP4_RtpConstructor* constructor);
+ AP4_Size GetSize();
+ AP4_Size GetConstructedDataSize();
+
+ // Referenceable methods
+ void AddReference();
+ void Release();
+
+ // Accessors
+ AP4_Integer GetRelativeTime() const { return m_RelativeTime; }
+ bool GetPBit() const { return m_PBit; }
+ bool GetXBit() const { return m_XBit; }
+ bool GetMBit() const { return m_MBit; }
+ AP4_UI08 GetPayloadType() const { return m_PayloadType; }
+ AP4_UI16 GetSequenceSeed() const { return m_SequenceSeed; }
+ AP4_Integer GetTimeStampOffset() const { return m_TimeStampOffset; }
+ bool GetBFrameFlag() const { return m_BFrameFlag; }
+ bool GetRepeatFlag() const { return m_RepeatFlag; }
+ AP4_List<AP4_RtpConstructor>& GetConstructors() {
+ return m_Constructors;
+ }
+
+private:
+ // members
+ AP4_Cardinal m_ReferenceCount;
+ AP4_Integer m_RelativeTime;
+ bool m_PBit;
+ bool m_XBit;
+ bool m_MBit;
+ AP4_UI08 m_PayloadType;
+ AP4_UI16 m_SequenceSeed;
+ AP4_Integer m_TimeStampOffset;
+ bool m_BFrameFlag;
+ bool m_RepeatFlag;
+ AP4_List<AP4_RtpConstructor> m_Constructors;
+};
+
+/*----------------------------------------------------------------------
+| AP4_RtpContructor
++---------------------------------------------------------------------*/
+class AP4_RtpConstructor : public AP4_Referenceable
+{
+public:
+ // types
+ typedef AP4_UI08 Type;
+
+ // constructor & destructor
+ AP4_RtpConstructor(Type type) : m_ReferenceCount(1), m_Type(type) {}
+
+ // methods
+ Type GetType() const { return m_Type; }
+ AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Size GetConstructedDataSize() = 0;
+
+ // Referenceable methods
+ void AddReference();
+ void Release();
+
+protected:
+ // methods
+ virtual ~AP4_RtpConstructor() {}
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream) = 0;
+
+ // members
+ AP4_Cardinal m_ReferenceCount;
+ Type m_Type;
+};
+
+/*----------------------------------------------------------------------
+| constructor size
++---------------------------------------------------------------------*/
+const AP4_Size AP4_RTP_CONSTRUCTOR_SIZE = 16;
+
+/*----------------------------------------------------------------------
+| constructor types
++---------------------------------------------------------------------*/
+const AP4_RtpConstructor::Type AP4_RTP_CONSTRUCTOR_TYPE_NOOP = 0;
+const AP4_RtpConstructor::Type AP4_RTP_CONSTRUCTOR_TYPE_IMMEDIATE = 1;
+const AP4_RtpConstructor::Type AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE = 2;
+const AP4_RtpConstructor::Type AP4_RTP_CONSTRUCTOR_TYPE_SAMPLE_DESC = 3;
+
+/*----------------------------------------------------------------------
+| AP4_NoopRtpConstructor
++---------------------------------------------------------------------*/
+class AP4_NoopRtpConstructor : public AP4_RtpConstructor
+{
+public:
+ // constructor
+ AP4_NoopRtpConstructor(AP4_ByteStream& stream);
+ AP4_NoopRtpConstructor() : AP4_RtpConstructor(AP4_RTP_CONSTRUCTOR_TYPE_NOOP) {}
+
+ // methods
+ virtual AP4_Size GetConstructedDataSize() { return 0; }
+
+protected:
+ // methods
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream);
+};
+
+/*----------------------------------------------------------------------
+| AP4_ImmediateRtpConstructor
++---------------------------------------------------------------------*/
+class AP4_ImmediateRtpConstructor : public AP4_RtpConstructor
+{
+public:
+ // constructor
+ AP4_ImmediateRtpConstructor(AP4_ByteStream& stream);
+ AP4_ImmediateRtpConstructor(const AP4_DataBuffer& data);
+
+ // accessors
+ const AP4_DataBuffer& GetData() const { return m_Data; }
+
+ // methods
+ virtual AP4_Size GetConstructedDataSize() { return m_Data.GetDataSize(); }
+
+protected:
+ // methods
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream);
+
+ // members
+ AP4_DataBuffer m_Data;
+};
+
+/*----------------------------------------------------------------------
+| AP4_SampleRtpConstructor
++---------------------------------------------------------------------*/
+class AP4_SampleRtpConstructor : public AP4_RtpConstructor
+{
+public:
+ // constructor
+ AP4_SampleRtpConstructor(AP4_ByteStream& stream);
+ AP4_SampleRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_num,
+ AP4_UI32 sample_offset);
+
+ // accessors
+ AP4_UI08 GetTrackRefIndex() const { return m_TrackRefIndex; }
+ AP4_UI16 GetLength() const { return m_Length; }
+ AP4_UI32 GetSampleNum() const { return m_SampleNum; }
+ AP4_UI32 GetSampleOffset() const { return m_SampleOffset; }
+
+ // methods
+ virtual AP4_Size GetConstructedDataSize() { return m_Length; }
+
+protected:
+ // methods
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream);
+
+ // members
+ AP4_UI08 m_TrackRefIndex;
+ AP4_UI16 m_Length;
+ AP4_UI32 m_SampleNum;
+ AP4_UI32 m_SampleOffset;
+};
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescRtpConstructor
++---------------------------------------------------------------------*/
+class AP4_SampleDescRtpConstructor : public AP4_RtpConstructor
+{
+public:
+ // constructor
+ AP4_SampleDescRtpConstructor(AP4_ByteStream& stream);
+ AP4_SampleDescRtpConstructor(AP4_UI08 track_ref_index,
+ AP4_UI16 length,
+ AP4_UI32 sample_desc_index,
+ AP4_UI32 sample_desc_offset);
+
+ // accessors
+ AP4_UI08 GetTrackRefIndex() const { return m_TrackRefIndex; }
+ AP4_UI16 GetLength() const { return m_Length; }
+ AP4_UI32 GetSampleDescIndex() const { return m_SampleDescIndex; }
+ AP4_UI32 GetSampleDescOffset() const { return m_SampleDescOffset; }
+
+ // methods
+ virtual AP4_Size GetConstructedDataSize() { return m_Length; }
+
+protected:
+ // methods
+ virtual AP4_Result DoWrite(AP4_ByteStream& stream);
+
+ // members
+ AP4_UI08 m_TrackRefIndex;
+ AP4_UI16 m_Length;
+ AP4_UI32 m_SampleDescIndex;
+ AP4_UI32 m_SampleDescOffset;
+};
+
+/*----------------------------------------------------------------------
+| AP4_RtpConstructorFactory
++---------------------------------------------------------------------*/
+class AP4_RtpConstructorFactory
+{
+public:
+ static AP4_Result CreateConstructorFromStream(AP4_ByteStream& stream,
+ AP4_RtpConstructor*& constructor);
+};
+
+#endif // _AP4_RTP_HINT_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SLConfigDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SLConfigDescriptor.cpp
new file mode 100644
index 000000000..e15821f8e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SLConfigDescriptor.cpp
@@ -0,0 +1,54 @@
+/*****************************************************************
+|
+| AP4 - SLConfig Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SLConfigDescriptor.h"
+
+/*----------------------------------------------------------------------
+| AP4_SLConfigDescriptor::AP4_SLConfigDescriptor
++---------------------------------------------------------------------*/
+AP4_SLConfigDescriptor::AP4_SLConfigDescriptor(AP4_Size header_size = 2) :
+ AP4_Descriptor(AP4_DESCRIPTOR_TAG_SL_CONFIG, header_size, 1),
+ m_Predefined(2)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SLConfigDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SLConfigDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ // write the payload
+ stream.WriteUI08(m_Predefined);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SLConfigDescriptor.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SLConfigDescriptor.h
new file mode 100644
index 000000000..19026b081
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SLConfigDescriptor.h
@@ -0,0 +1,62 @@
+/*****************************************************************
+|
+| AP4 - SLConfig Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_SLCONFIG_DESCRIPTOR_H_
+#define _AP4_SLCONFIG_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Descriptor.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_Descriptor::Tag AP4_DESCRIPTOR_TAG_SL_CONFIG = 0x06;
+
+/*----------------------------------------------------------------------
+| AP4_SLConfigDescriptor
++---------------------------------------------------------------------*/
+class AP4_SLConfigDescriptor : public AP4_Descriptor
+{
+public:
+ // methods
+ AP4_SLConfigDescriptor(AP4_Size header_size);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI08 m_Predefined; // = 2 (fixed for MP4 files)
+};
+
+
+#endif // _AP4_SLCONFIG_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Sample.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Sample.cpp
new file mode 100644
index 000000000..dc282895d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Sample.cpp
@@ -0,0 +1,160 @@
+/*****************************************************************
+|
+| AP4 - Sample Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Sample.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_Sample::AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::AP4_Sample() :
+ m_DataStream(NULL),
+ m_Offset(0),
+ m_Size(0),
+ m_DescriptionIndex(0),
+ m_Dts(0),
+ m_Cts(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::AP4_Sample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp dts,
+ AP4_Offset cts_offset /* = 0 */ ) :
+ m_Offset(offset),
+ m_Size(size),
+ m_DescriptionIndex(description_index),
+ m_Dts(dts),
+ m_Cts(dts + cts_offset)
+{
+ m_DataStream = &data_stream;
+ AP4_ADD_REFERENCE(m_DataStream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::AP4_Sample(const AP4_Sample& other) :
+ m_DataStream(other.m_DataStream),
+ m_Offset(other.m_Offset),
+ m_Size(other.m_Size),
+ m_DescriptionIndex(other.m_DescriptionIndex),
+ m_Dts(other.m_Dts),
+ m_Cts(other.m_Cts)
+{
+ AP4_ADD_REFERENCE(m_DataStream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::~AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::~AP4_Sample()
+{
+ AP4_RELEASE(m_DataStream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::operator=
++---------------------------------------------------------------------*/
+AP4_Sample&
+AP4_Sample::operator=(const AP4_Sample& other)
+{
+ AP4_RELEASE(m_DataStream);
+ m_DataStream = other.m_DataStream;
+ AP4_ADD_REFERENCE(m_DataStream);
+
+ m_Offset = other.m_Offset;
+ m_Size = other.m_Size;
+ m_DescriptionIndex = other.m_DescriptionIndex;
+ m_Dts = other.m_Dts;
+ m_Cts = other.m_Cts;
+
+ return *this;
+}
+/*----------------------------------------------------------------------
+| AP4_Sample::ReadData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Sample::ReadData(AP4_DataBuffer& data)
+{
+ return ReadData(data, m_Size);
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_Sample::ReadData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Sample::ReadData(AP4_DataBuffer& data, AP4_Size size, AP4_Offset offset)
+{
+ // check that we have a stream
+ if (m_DataStream == NULL) return AP4_FAILURE;
+
+ // shortcut
+ if (size == 0) return AP4_SUCCESS;
+
+ // check the size
+ if (m_Size < size+offset) return AP4_FAILURE;
+
+ // set the buffer size
+ AP4_Result result = data.SetDataSize(size);
+ if (AP4_FAILED(result)) return result;
+
+ // get the data from the stream
+ m_DataStream->Seek(m_Offset+offset);
+ return m_DataStream->Read(data.UseData(), size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::GetDataStream
++---------------------------------------------------------------------*/
+AP4_ByteStream*
+AP4_Sample::GetDataStream()
+{
+ AP4_ADD_REFERENCE(m_DataStream);
+ return m_DataStream;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::SetDataStream
++---------------------------------------------------------------------*/
+void
+AP4_Sample::SetDataStream(AP4_ByteStream& stream)
+{
+ AP4_RELEASE(m_DataStream);
+ m_DataStream = &stream;
+ AP4_ADD_REFERENCE(m_DataStream);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Sample.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Sample.h
new file mode 100644
index 000000000..6f796710c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Sample.h
@@ -0,0 +1,88 @@
+/*****************************************************************
+|
+| AP4 - Sample Objects
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_H_
+#define _AP4_SAMPLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_Sample DO NOT DERIVE FROM THIS CLASS
++---------------------------------------------------------------------*/
+class AP4_Sample
+{
+public:
+ // constructors and destructor
+ AP4_Sample();
+ AP4_Sample(const AP4_Sample& other);
+ AP4_Sample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp dts,
+ AP4_TimeStamp cts_offset = 0);
+ ~AP4_Sample(); // not virtual on purpose: do not derive from it
+
+ // operators
+ AP4_Sample& operator=(const AP4_Sample& other);
+
+ // methods
+ AP4_Result ReadData(AP4_DataBuffer& data);
+ AP4_Result ReadData(AP4_DataBuffer& data,
+ AP4_Size size,
+ AP4_Offset offset = 0);
+
+ // sample properties accessors
+ AP4_ByteStream* GetDataStream();
+ void SetDataStream(AP4_ByteStream& stream);
+ AP4_Offset GetOffset() const { return m_Offset; }
+ void SetOffset(AP4_Offset offset) { m_Offset = offset; }
+ AP4_Size GetSize() { return m_Size; }
+ void SetSize(AP4_Size size) { m_Size = size; }
+ AP4_Ordinal GetDescriptionIndex() const { return m_DescriptionIndex; }
+ void SetDescriptionIndex(AP4_Ordinal index) { m_DescriptionIndex = index; }
+ AP4_TimeStamp GetDts() const { return m_Dts; }
+ void SetDts(AP4_TimeStamp dts) { m_Dts = dts; }
+ AP4_TimeStamp GetCts() const { return m_Cts; }
+ void SetCts(AP4_TimeStamp cts) { m_Cts = cts; }
+
+protected:
+ AP4_ByteStream* m_DataStream;
+ AP4_Offset m_Offset;
+ AP4_Size m_Size;
+ AP4_Ordinal m_DescriptionIndex;
+ AP4_TimeStamp m_Dts;
+ AP4_TimeStamp m_Cts;
+};
+
+#endif // _AP4_SAMPLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleDescription.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleDescription.cpp
new file mode 100644
index 000000000..3c299df57
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleDescription.cpp
@@ -0,0 +1,266 @@
+/*****************************************************************
+|
+| AP4 - Sample Description Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4SampleDescription.h"
+#include "Ap4EsDescriptor.h"
+#include "Ap4SampleEntry.h"
+
+/*----------------------------------------------------------------------
+| AP4_UnknownSampleDescription::AP4_UnknownSampleDescription
++---------------------------------------------------------------------*/
+AP4_UnknownSampleDescription::AP4_UnknownSampleDescription(AP4_SampleEntry* entry) :
+ AP4_SampleDescription(AP4_SampleDescription::TYPE_UNKNOWN),
+ m_SampleEntry(entry)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownSampleDescription::~AP4_UnknownSampleDescription
++---------------------------------------------------------------------*/
+AP4_UnknownSampleDescription::~AP4_UnknownSampleDescription()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_UnknownSampleDescription::ToAtom() const
+{
+ return new AP4_SampleEntry(m_SampleEntry->GetType(),
+ m_SampleEntry->GetDataReferenceIndex());
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::AP4_MpegSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegSampleDescription::AP4_MpegSampleDescription(
+ StreamType stream_type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate) :
+ AP4_SampleDescription(TYPE_MPEG),
+ m_StreamType(stream_type),
+ m_ObjectTypeId(oti),
+ m_DecoderInfo(NULL),
+ m_BufferSize(buffer_size),
+ m_MaxBitrate(max_bitrate),
+ m_AvgBitrate(avg_bitrate)
+{
+ if (decoder_info != NULL) {
+ m_DecoderInfo = new AP4_DataBuffer(*decoder_info);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::~AP4_MpegSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegSampleDescription::~AP4_MpegSampleDescription()
+{
+ delete m_DecoderInfo;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::CreateEsDescriptor
++---------------------------------------------------------------------*/
+AP4_EsDescriptor*
+AP4_MpegSampleDescription::CreateEsDescriptor() const
+{
+ AP4_EsDescriptor* desc = new AP4_EsDescriptor(0);
+ AP4_DecoderSpecificInfoDescriptor* dsi_desc;
+ if (m_DecoderInfo) {
+ dsi_desc = new AP4_DecoderSpecificInfoDescriptor(*m_DecoderInfo);
+ } else {
+ dsi_desc = NULL;
+ }
+ AP4_DecoderConfigDescriptor* decoder_config =
+ new AP4_DecoderConfigDescriptor(m_StreamType,
+ m_ObjectTypeId,
+ m_BufferSize,
+ m_MaxBitrate,
+ m_AvgBitrate,
+ dsi_desc);
+ desc->AddSubDescriptor(decoder_config);
+ return desc;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSystemSampleDescription::AP4_MpegSystemSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegSystemSampleDescription::AP4_MpegSystemSampleDescription(
+ StreamType stream_type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate) :
+ AP4_MpegSampleDescription(stream_type,
+ oti,
+ decoder_info,
+ buffer_size,
+ max_bitrate,
+ avg_bitrate)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSystemSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_MpegSystemSampleDescription::ToAtom() const
+{
+ return new AP4_Mp4sSampleEntry(CreateEsDescriptor());
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegAudioSampleDescription::AP4_MpegAudioSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegAudioSampleDescription::AP4_MpegAudioSampleDescription(
+ OTI oti,
+ unsigned int sample_rate,
+ unsigned int sample_size,
+ unsigned int channel_count,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate) :
+ AP4_MpegSampleDescription(AP4_AUDIO_STREAM_TYPE,
+ oti,
+ decoder_info, buffer_size,
+ max_bitrate, avg_bitrate),
+ m_SampleRate(sample_rate),
+ m_SampleSize(sample_size),
+ m_ChannelCount(channel_count)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegAudioSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_MpegAudioSampleDescription::ToAtom() const
+{
+ return new AP4_Mp4aSampleEntry(m_SampleRate<<16,
+ m_SampleSize,
+ m_ChannelCount,
+ CreateEsDescriptor());
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegVideoSampleDescription::AP4_MpegVideoSampleDescription
++---------------------------------------------------------------------*/
+AP4_MpegVideoSampleDescription::AP4_MpegVideoSampleDescription(
+ OTI oti,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate) :
+ AP4_MpegSampleDescription(AP4_VISUAL_STREAM_TYPE,
+ oti,
+ decoder_info,
+ buffer_size,
+ max_bitrate,
+ avg_bitrate),
+ m_Width(width),
+ m_Height(height),
+ m_Depth(depth),
+ m_CompressorName(compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegVideoSampleDescription::ToAtom
++---------------------------------------------------------------------*/
+AP4_Atom*
+AP4_MpegVideoSampleDescription::ToAtom() const
+{
+ return new AP4_Mp4vSampleEntry(m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.c_str(),
+ CreateEsDescriptor());
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::GetStreamTypeString
++---------------------------------------------------------------------*/
+const char*
+AP4_MpegSampleDescription::GetStreamTypeString(StreamType type)
+{
+ switch (type) {
+ case AP4_FORBIDDEN_STREAM_TYPE: return "INVALID";
+ case AP4_OD_STREAM_TYPE: return "Object Descriptor";
+ case AP4_CR_STREAM_TYPE: return "CR";
+ case AP4_BIFS_STREAM_TYPE: return "BIFS";
+ case AP4_VISUAL_STREAM_TYPE: return "Visual";
+ case AP4_AUDIO_STREAM_TYPE: return "Audio";
+ case AP4_MPEG7_STREAM_TYPE: return "MPEG-7";
+ case AP4_IPMP_STREAM_TYPE: return "IPMP";
+ case AP4_OCI_STREAM_TYPE: return "OCI";
+ case AP4_MPEGJ_STREAM_TYPE: return "MPEG-J";
+ default: return "UNKNOWN";
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription::GetObjectTypeString
++---------------------------------------------------------------------*/
+const char*
+AP4_MpegSampleDescription::GetObjectTypeString(OTI oti)
+{
+ switch (oti) {
+ case AP4_MPEG4_SYSTEM_OTI: return "MPEG-4 System";
+ case AP4_MPEG4_SYSTEM_COR_OTI: return "MPEG-4 System COR";
+ case AP4_MPEG4_VISUAL_OTI: return "MPEG-4 Video";
+ case AP4_MPEG4_AUDIO_OTI: return "MPEG-4 Audio";
+ case AP4_MPEG2_VISUAL_SIMPLE_OTI: return "MPEG-2 Video Simple Profile";
+ case AP4_MPEG2_VISUAL_MAIN_OTI: return "MPEG-2 Video Main Profile";
+ case AP4_MPEG2_VISUAL_SNR_OTI: return "MPEG-2 Video SNR";
+ case AP4_MPEG2_VISUAL_SPATIAL_OTI: return "MPEG-2 Video Spatial";
+ case AP4_MPEG2_VISUAL_HIGH_OTI: return "MPEG-2 Video High";
+ case AP4_MPEG2_VISUAL_422_OTI: return "MPEG-2 Video 4:2:2";
+ case AP4_MPEG2_AAC_AUDIO_MAIN_OTI: return "MPEG-2 Audio AAC Main Profile";
+ case AP4_MPEG2_AAC_AUDIO_LC_OTI: return "MPEG-2 Audio AAC Low Complexity";
+ case AP4_MPEG2_AAC_AUDIO_SSRP_OTI: return "MPEG-2 Audio AAC SSRP";
+ case AP4_MPEG2_PART3_AUDIO_OTI: return "MPEG-2 Audio Part-3";
+ case AP4_MPEG1_VISUAL_OTI: return "MPEG-1 Video";
+ case AP4_MPEG1_AUDIO_OTI: return "MPEG-1 Audio";
+ case AP4_JPEG_OTI: return "JPEG";
+ default: return "UNKNOWN";
+ }
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleDescription.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleDescription.h
new file mode 100644
index 000000000..8946c41c8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleDescription.h
@@ -0,0 +1,250 @@
+/*****************************************************************
+|
+| AP4 - Sample Description Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_DESCRIPTION_H_
+#define _AP4_SAMPLE_DESCRIPTION_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Atom.h"
+#include "Ap4EsDescriptor.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_SampleEntry;
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescription
++---------------------------------------------------------------------*/
+class AP4_SampleDescription
+{
+ public:
+ // type constants of the sample description
+ enum Type {
+ TYPE_UNKNOWN = 0x00,
+ TYPE_MPEG = 0x01,
+ TYPE_ISMACRYP = 0x02
+ };
+
+ // constructors & destructor
+ AP4_SampleDescription(Type type) : m_Type(type) {}
+ virtual ~AP4_SampleDescription() {}
+
+ // accessors
+ Type GetType() const { return m_Type; }
+
+ // factories
+ virtual AP4_Atom* ToAtom() const = 0;
+
+ protected:
+ Type m_Type;
+};
+
+/*----------------------------------------------------------------------
+| AP4_UnknownSampleDescription
++---------------------------------------------------------------------*/
+class AP4_UnknownSampleDescription : public AP4_SampleDescription
+{
+ public:
+ // methods
+ AP4_UnknownSampleDescription(AP4_SampleEntry* sample_entry);
+ ~AP4_UnknownSampleDescription();
+ AP4_SampleEntry* GetSampleEntry() { return m_SampleEntry; }
+ AP4_Atom* ToAtom() const;
+
+ protected:
+ AP4_SampleEntry* m_SampleEntry;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegSampleDescription : public AP4_SampleDescription
+{
+ public:
+ // types
+ typedef AP4_UI08 StreamType;
+ typedef AP4_UI08 OTI;
+
+ // class methods
+ const char* GetStreamTypeString(StreamType type);
+ const char* GetObjectTypeString(OTI oti);
+
+ // constructors & destructor
+ AP4_MpegSampleDescription(StreamType stream_type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+ virtual ~AP4_MpegSampleDescription();
+
+ // accessors
+ AP4_Byte GetStreamType() const { return m_StreamType; }
+ AP4_Byte GetObjectTypeId() const { return m_ObjectTypeId; }
+ const AP4_DataBuffer* GetDecoderInfo() const { return m_DecoderInfo; }
+ AP4_UI32 GetBufferSize() const { return m_BufferSize; }
+ AP4_UI32 GetMaxBitrate() const { return m_MaxBitrate; }
+ AP4_UI32 GetAvgBitrate() const { return m_AvgBitrate; }
+
+ // methods
+ AP4_EsDescriptor* CreateEsDescriptor() const;
+
+ protected:
+ // members
+ StreamType m_StreamType;
+ OTI m_ObjectTypeId;
+ AP4_DataBuffer* m_DecoderInfo;
+ AP4_UI32 m_BufferSize;
+ AP4_UI32 m_MaxBitrate;
+ AP4_UI32 m_AvgBitrate;
+
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegSystemSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegSystemSampleDescription : public AP4_MpegSampleDescription
+{
+public:
+ // constructor
+ AP4_MpegSystemSampleDescription(StreamType type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+
+ // methods
+ AP4_Atom* ToAtom() const;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegAudioSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegAudioSampleDescription : public AP4_MpegSampleDescription
+{
+public:
+ // constructor
+ AP4_MpegAudioSampleDescription(OTI oti,
+ unsigned int sample_rate,
+ unsigned int sample_size,
+ unsigned int channel_count,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+
+ // accessors
+ AP4_UI32 GetSampleRate() { return m_SampleRate; }
+ AP4_UI16 GetSampleSize() { return m_SampleSize; }
+ AP4_UI16 GetChannelCount() { return m_ChannelCount; }
+
+ // methods
+ AP4_Atom* ToAtom() const;
+
+protected:
+ // members
+ AP4_UI32 m_SampleRate;
+ AP4_UI16 m_SampleSize;
+ AP4_UI16 m_ChannelCount;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegVideoSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegVideoSampleDescription : public AP4_MpegSampleDescription
+{
+public:
+ // constructor
+ AP4_MpegVideoSampleDescription(OTI oti,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+
+ // accessors
+ AP4_UI32 GetWidth() { return m_Width; }
+ AP4_UI16 GetHeight() { return m_Height; }
+ AP4_UI16 GetDepth() { return m_Depth; }
+ const char* GetCompressorName() { return m_CompressorName.c_str(); }
+
+ // methods
+ AP4_Atom* ToAtom() const;
+
+protected:
+ // members
+ AP4_UI16 m_Width;
+ AP4_UI16 m_Height;
+ AP4_UI16 m_Depth;
+ AP4_String m_CompressorName;
+};
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_MpegSampleDescription::StreamType AP4_FORBIDDEN_STREAM_TYPE = 0x00;
+const AP4_MpegSampleDescription::StreamType AP4_OD_STREAM_TYPE = 0x01;
+const AP4_MpegSampleDescription::StreamType AP4_CR_STREAM_TYPE = 0x02;
+const AP4_MpegSampleDescription::StreamType AP4_BIFS_STREAM_TYPE = 0x03;
+const AP4_MpegSampleDescription::StreamType AP4_VISUAL_STREAM_TYPE = 0x04;
+const AP4_MpegSampleDescription::StreamType AP4_AUDIO_STREAM_TYPE = 0x05;
+const AP4_MpegSampleDescription::StreamType AP4_MPEG7_STREAM_TYPE = 0x06;
+const AP4_MpegSampleDescription::StreamType AP4_IPMP_STREAM_TYPE = 0x07;
+const AP4_MpegSampleDescription::StreamType AP4_OCI_STREAM_TYPE = 0x08;
+const AP4_MpegSampleDescription::StreamType AP4_MPEGJ_STREAM_TYPE = 0x09;
+
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_SYSTEM_OTI = 0x01;
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_SYSTEM_COR_OTI = 0x02;
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_VISUAL_OTI = 0x20;
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_AUDIO_OTI = 0x40;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_SIMPLE_OTI = 0x60;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_MAIN_OTI = 0x61;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_SNR_OTI = 0x62;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_SPATIAL_OTI = 0x63;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_HIGH_OTI = 0x64;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_422_OTI = 0x65;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_AAC_AUDIO_MAIN_OTI = 0x66;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_AAC_AUDIO_LC_OTI = 0x67;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_AAC_AUDIO_SSRP_OTI = 0x68;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_PART3_AUDIO_OTI = 0x69;
+const AP4_MpegSampleDescription::OTI AP4_MPEG1_VISUAL_OTI = 0x6A;
+const AP4_MpegSampleDescription::OTI AP4_MPEG1_AUDIO_OTI = 0x6B;
+const AP4_MpegSampleDescription::OTI AP4_JPEG_OTI = 0x6C;
+
+#endif // _AP4_SAMPLE_DESCRIPTION_H_
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleEntry.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleEntry.cpp
new file mode 100644
index 000000000..d79607397
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleEntry.cpp
@@ -0,0 +1,834 @@
+/*****************************************************************
+|
+| AP4 - sample entries
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4SampleEntry.h"
+#include "Ap4Utils.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4SampleDescription.h"
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::AP4_SampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry::AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_UI16 data_reference_index) :
+ AP4_ContainerAtom(format, AP4_ATOM_HEADER_SIZE+8, false),
+ m_DataReferenceIndex(data_reference_index)
+{
+ m_Reserved1[0] = 0;
+ m_Reserved1[1] = 0;
+ m_Reserved1[2] = 0;
+ m_Reserved1[3] = 0;
+ m_Reserved1[4] = 0;
+ m_Reserved1[5] = 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::AP4_SampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry::AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_Size size) :
+ AP4_ContainerAtom(format, size)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::AP4_SampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry::AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(format, size)
+{
+ // read the fields before the children atoms
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_SampleEntry::GetFieldsSize()
+{
+ return 8;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ stream.Read(m_Reserved1, sizeof(m_Reserved1), NULL);
+ stream.ReadUI16(m_DataReferenceIndex);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // reserved1
+ result = stream.Write(m_Reserved1, sizeof(m_Reserved1));
+ if (AP4_FAILED(result)) return result;
+
+ // data reference index
+ result = stream.WriteUI16(m_DataReferenceIndex);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::Write(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the header
+ result = WriteHeader(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // write the fields
+ result = WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // write the children atoms
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("data_reference_index", m_DataReferenceIndex);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::Inspect(AP4_AtomInspector& inspector)
+{
+ // inspect the header
+ InspectHeader(inspector);
+
+ // inspect the fields
+ InspectFields(inspector);
+
+ // inspect children
+ m_Children.Apply(AP4_AtomListInspector(inspector));
+
+ // finish
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::OnChildChanged
++---------------------------------------------------------------------*/
+void
+AP4_SampleEntry::OnChildChanged(AP4_Atom*)
+{
+ // remcompute our size
+ m_Size = GetHeaderSize()+GetFieldsSize();
+ m_Children.Apply(AP4_AtomSizeAdder(m_Size));
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_SampleEntry::ToSampleDescription()
+{
+ return new AP4_UnknownSampleDescription(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor) :
+ AP4_SampleEntry(format)
+{
+ if (descriptor) AddChild(new AP4_EsdsAtom(descriptor));
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_Size size) :
+ AP4_SampleEntry(format, size)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_SampleEntry(format, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+const AP4_DecoderConfigDescriptor*
+AP4_MpegSampleEntry::GetDecoderConfigDescriptor()
+{
+ AP4_Atom* child = GetChild(AP4_ATOM_TYPE_ESDS);
+ if (child) {
+ AP4_EsdsAtom* esds = (AP4_EsdsAtom*)child;
+
+ // get the es descriptor
+ const AP4_EsDescriptor* es_desc = esds->GetEsDescriptor();
+ if (es_desc == NULL) return NULL;
+
+ // get the decoder config descriptor
+ return es_desc->GetDecoderConfigDescriptor();
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry(AP4_EsDescriptor* descriptor) :
+ AP4_MpegSampleEntry(AP4_ATOM_TYPE_MP4S, descriptor)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_MpegSampleEntry(AP4_ATOM_TYPE_MP4S, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_Mp4sSampleEntry::ToSampleDescription()
+{
+ // get the decoder config descriptor
+ const AP4_DecoderConfigDescriptor* dc_desc;
+ dc_desc = GetDecoderConfigDescriptor();
+ if (dc_desc == NULL) return NULL;
+ const AP4_DataBuffer* dsi = NULL;
+ const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
+ dc_desc->GetDecoderSpecificInfoDescriptor();
+ if (dsi_desc != NULL) {
+ dsi = &dsi_desc->GetDecoderSpecificInfo();
+ }
+
+ // create a sample description
+ return new AP4_MpegSystemSampleDescription(
+ dc_desc->GetStreamType(),
+ dc_desc->GetObjectTypeIndication(),
+ dsi,
+ dc_desc->GetBufferSize(),
+ dc_desc->GetMaxBitrate(),
+ dc_desc->GetAvgBitrate());
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::AP4_AudioSampleEntry
++---------------------------------------------------------------------*/
+AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count) :
+ AP4_MpegSampleEntry(format, descriptor),
+ m_SampleRate(sample_rate),
+ m_ChannelCount(channel_count),
+ m_SampleSize(sample_size)
+{
+ m_Predefined1 = 0;
+ memset(m_Reserved2, 0, sizeof(m_Reserved2));
+ m_Reserved3 = 0;
+
+ m_Size += 20;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::AP4_AudioSampleEntry
++---------------------------------------------------------------------*/
+AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_MpegSampleEntry(format, size)
+{
+ // read fields
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_AudioSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize()+20;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AudioSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // read the fields of this class
+ stream.Read(m_Reserved2, sizeof(m_Reserved2), NULL);
+ stream.ReadUI16(m_ChannelCount);
+ stream.ReadUI16(m_SampleSize);
+ stream.ReadUI16(m_Predefined1);
+ stream.ReadUI16(m_Reserved3);
+ stream.ReadUI32(m_SampleRate);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AudioSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the fields of the base class
+ result = AP4_SampleEntry::WriteFields(stream);
+
+ // reserved2
+ result = stream.Write(m_Reserved2, sizeof(m_Reserved2));
+ if (AP4_FAILED(result)) return result;
+
+ // channel count
+ result = stream.WriteUI16(m_ChannelCount);
+ if (AP4_FAILED(result)) return result;
+
+ // sample size
+ result = stream.WriteUI16(m_SampleSize);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined1
+ result = stream.WriteUI16(m_Predefined1);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved3
+ result = stream.WriteUI16(m_Reserved3);
+ if (AP4_FAILED(result)) return result;
+
+ // sample rate
+ result = stream.WriteUI32(m_SampleRate);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AudioSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // dump the fields from the base class
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // fields
+ inspector.AddField("channel_count", m_ChannelCount);
+ inspector.AddField("sample_size", m_SampleSize);
+ inspector.AddField("sample_rate", m_SampleRate>>16);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_AudioSampleEntry::ToSampleDescription()
+{
+ // get the decoder config descriptor
+ const AP4_DecoderConfigDescriptor* dc_desc;
+ dc_desc = GetDecoderConfigDescriptor();
+ if (dc_desc == NULL) return NULL;
+ const AP4_DataBuffer* dsi = NULL;
+ const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
+ dc_desc->GetDecoderSpecificInfoDescriptor();
+ if (dsi_desc != NULL) {
+ dsi = &dsi_desc->GetDecoderSpecificInfo();
+ }
+
+ // create a sample description
+ return new AP4_MpegAudioSampleDescription(
+ dc_desc->GetObjectTypeIndication(),
+ m_SampleRate>>16,
+ m_SampleSize,
+ m_ChannelCount,
+ dsi,
+ dc_desc->GetBufferSize(),
+ dc_desc->GetMaxBitrate(),
+ dc_desc->GetAvgBitrate());
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor) :
+ AP4_AudioSampleEntry(AP4_ATOM_TYPE_MP4A,
+ descriptor,
+ sample_rate,
+ sample_size,
+ channel_count)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_AudioSampleEntry(AP4_ATOM_TYPE_MP4A, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::AP4_VisualSampleEntry
++---------------------------------------------------------------------*/
+AP4_VisualSampleEntry::AP4_VisualSampleEntry(
+ AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name) :
+ AP4_MpegSampleEntry(format, descriptor),
+ m_Predefined1(0),
+ m_Reserved2(0),
+ m_Width(width),
+ m_Height(height),
+ m_HorizResolution(0x00480000),
+ m_VertResolution(0x00480000),
+ m_Reserved3(0),
+ m_FrameCount(1),
+ m_CompressorName(compressor_name),
+ m_Depth(depth),
+ m_Predefined3(0xFFFF)
+{
+ memset(m_Predefined2, 0, sizeof(m_Predefined2));
+ m_Size += 70;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::AP4_VisualSampleEntry
++---------------------------------------------------------------------*/
+AP4_VisualSampleEntry::AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_MpegSampleEntry(format, size)
+{
+ // read fields
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_VisualSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize()+70;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VisualSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // read fields from this class
+ stream.ReadUI16(m_Predefined1);
+ stream.ReadUI16(m_Reserved2);
+ stream.Read(m_Predefined2, sizeof(m_Predefined2), NULL);
+ stream.ReadUI16(m_Width);
+ stream.ReadUI16(m_Height);
+ stream.ReadUI32(m_HorizResolution);
+ stream.ReadUI32(m_VertResolution);
+ stream.ReadUI32(m_Reserved3);
+ stream.ReadUI16(m_FrameCount);
+
+ char compressor_name[33];
+ stream.Read(compressor_name, 32);
+ int name_length = compressor_name[0];
+ if (name_length < 32) {
+ compressor_name[name_length+1] = 0;
+ m_CompressorName = &compressor_name[1];
+ }
+
+ stream.ReadUI16(m_Depth);
+ stream.ReadUI16(m_Predefined3);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VisualSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the fields of the base class
+ result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined1
+ result = stream.WriteUI16(m_Predefined1);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved2
+ result = stream.WriteUI16(m_Reserved2);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined2
+ result = stream.Write(m_Predefined2, sizeof(m_Predefined2));
+ if (AP4_FAILED(result)) return result;
+
+ // width
+ result = stream.WriteUI16(m_Width);
+ if (AP4_FAILED(result)) return result;
+
+ // height
+ result = stream.WriteUI16(m_Height);
+ if (AP4_FAILED(result)) return result;
+
+ // horizontal resolution
+ result = stream.WriteUI32(m_HorizResolution);
+ if (AP4_FAILED(result)) return result;
+
+ // vertical resolution
+ result = stream.WriteUI32(m_VertResolution);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved3
+ result = stream.WriteUI32(m_Reserved3);
+ if (AP4_FAILED(result)) return result;
+
+ // frame count
+ result = stream.WriteUI16(m_FrameCount);
+ if (AP4_FAILED(result)) return result;
+
+ // compressor name
+ unsigned char compressor_name[32];
+ unsigned int name_length = m_CompressorName.length();
+ if (name_length > 31) name_length = 31;
+ compressor_name[0] = name_length;
+ for (unsigned int i=0; i<name_length; i++) {
+ compressor_name[i+1] = m_CompressorName[i];
+ }
+ for (unsigned int i=name_length+1; i<32; i++) {
+ compressor_name[i] = 0;
+ }
+ result = stream.Write(compressor_name, 32);
+ if (AP4_FAILED(result)) return result;
+
+ // depth
+ result = stream.WriteUI16(m_Depth);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined3
+ result = stream.WriteUI16(m_Predefined3);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VisualSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // dump the fields of the base class
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // fields
+ inspector.AddField("width", m_Width);
+ inspector.AddField("height", m_Height);
+ inspector.AddField("compressor", m_CompressorName.c_str());
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_VisualSampleEntry::ToSampleDescription()
+{
+ // get the decoder config descriptor
+ const AP4_DecoderConfigDescriptor* dc_desc;
+ dc_desc = GetDecoderConfigDescriptor();
+ if (dc_desc == NULL) return NULL;
+ const AP4_DataBuffer* dsi = NULL;
+ const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
+ dc_desc->GetDecoderSpecificInfoDescriptor();
+ if (dsi_desc != NULL) {
+ dsi = &dsi_desc->GetDecoderSpecificInfo();
+ }
+
+ // create a sample description
+ return new AP4_MpegVideoSampleDescription(
+ dc_desc->GetObjectTypeIndication(),
+ m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.c_str(),
+ dsi,
+ dc_desc->GetBufferSize(),
+ dc_desc->GetMaxBitrate(),
+ dc_desc->GetAvgBitrate());
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_MP4V,
+ descriptor,
+ width,
+ height,
+ depth,
+ compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4vSampleEntry::AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_MP4V, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Avc1SampleEntry::AP4_Avc1SampleEntry
++---------------------------------------------------------------------*/
+AP4_Avc1SampleEntry::AP4_Avc1SampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_AVC1,
+ descriptor,
+ width,
+ height,
+ depth,
+ compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Avc1SampleEntry::AP4_Avc1SampleEntry
++---------------------------------------------------------------------*/
+AP4_Avc1SampleEntry::AP4_Avc1SampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_AVC1, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_UI16 hint_track_version,
+ AP4_UI16 highest_compatible_version,
+ AP4_UI32 max_packet_size,
+ AP4_UI32 timescale):
+ AP4_SampleEntry(AP4_ATOM_TYPE_RTP),
+ m_HintTrackVersion(hint_track_version),
+ m_HighestCompatibleVersion(highest_compatible_version),
+ m_MaxPacketSize(max_packet_size)
+{
+ // build an atom for timescale
+ AddChild(new AP4_TimsAtom(timescale));
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
+ AP4_SampleEntry(AP4_ATOM_TYPE_RTP, size)
+{
+ // read fields
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::~AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+AP4_RtpHintSampleEntry::~AP4_RtpHintSampleEntry()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_RtpHintSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize()+8;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpHintSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // data
+ result = stream.ReadUI16(m_HintTrackVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_HighestCompatibleVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI32(m_MaxPacketSize);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpHintSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // data
+ result = stream.WriteUI16(m_HintTrackVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_HighestCompatibleVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_MaxPacketSize);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpHintSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // sample entry
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // fields
+ inspector.AddField("hint_track_version", m_HintTrackVersion);
+ inspector.AddField("highest_compatible_version", m_HighestCompatibleVersion);
+ inspector.AddField("max_packet_size", m_MaxPacketSize);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleEntry.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleEntry.h
new file mode 100644
index 000000000..dcae7a2c5
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleEntry.h
@@ -0,0 +1,288 @@
+/*****************************************************************
+|
+| AP4 - sample entries
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_ENTRY_H_
+#define _AP4_SAMPLE_ENTRY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4EsdsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_SampleDescription;
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry
++---------------------------------------------------------------------*/
+class AP4_SampleEntry : public AP4_ContainerAtom
+{
+ public:
+ // methods
+ AP4_SampleEntry(AP4_Atom::Type format, AP4_UI16 data_ref_index = 1);
+ AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_UI16 GetDataReferenceIndex() { return m_DataReferenceIndex; }
+ virtual AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual AP4_SampleDescription* ToSampleDescription();
+
+ // AP4_AtomParent methods
+ virtual void OnChildChanged(AP4_Atom* child);
+
+ protected:
+ // constructor
+ AP4_SampleEntry(AP4_Atom::Type format, AP4_Size size);
+
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_UI08 m_Reserved1[6]; // = 0
+ AP4_UI16 m_DataReferenceIndex;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+class AP4_MpegSampleEntry : public AP4_SampleEntry
+{
+protected:
+ // constructor
+ AP4_MpegSampleEntry(AP4_Atom::Type format);
+ AP4_MpegSampleEntry(AP4_Atom::Type format, AP4_Size size);
+ AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor);
+ AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ // methods
+ const AP4_DecoderConfigDescriptor* GetDecoderConfigDescriptor();
+};
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Mp4sSampleEntry : public AP4_MpegSampleEntry
+{
+ public:
+ // constructors
+ AP4_Mp4sSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Mp4sSampleEntry(AP4_EsDescriptor* descriptor);
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+};
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry
++---------------------------------------------------------------------*/
+class AP4_AudioSampleEntry : public AP4_MpegSampleEntry
+{
+ public:
+ // methods
+ AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count);
+ AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ // accessors
+ AP4_UI32 GetSampleRate() { return m_SampleRate>>16; }
+ AP4_UI16 GetSampleSize() { return m_SampleSize; }
+ AP4_UI16 GetChannelCount() { return m_ChannelCount; }
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_UI08 m_Reserved2[8]; // = 0
+ AP4_UI32 m_SampleRate;
+ AP4_UI16 m_ChannelCount; // = 2
+ AP4_UI16 m_SampleSize; // = 16
+ AP4_UI16 m_Predefined1; // = 0
+ AP4_UI16 m_Reserved3; // = 0
+};
+
+/*----------------------------------------------------------------------
+| AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Mp4aSampleEntry : public AP4_AudioSampleEntry
+{
+ public:
+ // constructors
+ AP4_Mp4aSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor);
+};
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry
++---------------------------------------------------------------------*/
+class AP4_VisualSampleEntry : public AP4_MpegSampleEntry
+{
+ public:
+ // methods
+ AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name);
+ AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ // accessors
+ AP4_UI16 GetWidth() { return m_Width; }
+ AP4_UI16 GetHeight() { return m_Height; }
+ AP4_UI16 GetDepth() { return m_Depth; }
+ const char* GetCompressorName() { return m_CompressorName.c_str(); }
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ //members
+ AP4_UI16 m_Predefined1; // = 0
+ AP4_UI16 m_Reserved2; // = 0
+ AP4_UI08 m_Predefined2[12]; // = 0
+ AP4_UI16 m_Width;
+ AP4_UI16 m_Height;
+ AP4_UI32 m_HorizResolution; // = 0x00480000 (72 dpi)
+ AP4_UI32 m_VertResolution; // = 0x00480000 (72 dpi)
+ AP4_UI32 m_Reserved3; // = 0
+ AP4_UI16 m_FrameCount; // = 1
+ AP4_String m_CompressorName;
+ AP4_UI16 m_Depth; // = 0x0018
+ AP4_UI16 m_Predefined3; // = 0xFFFF
+};
+
+/*----------------------------------------------------------------------
+| AP4_Mp4vSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Mp4vSampleEntry : public AP4_VisualSampleEntry
+{
+ public:
+ // constructors
+ AP4_Mp4vSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Mp4vSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor);
+};
+
+/*----------------------------------------------------------------------
+| AP4_Avc1SampleEntry
++---------------------------------------------------------------------*/
+class AP4_Avc1SampleEntry : public AP4_VisualSampleEntry
+{
+public:
+ // constructors
+ AP4_Avc1SampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Avc1SampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor);
+};
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+class AP4_RtpHintSampleEntry : public AP4_SampleEntry
+{
+public:
+ // methods
+ AP4_RtpHintSampleEntry(AP4_UI16 hint_track_version,
+ AP4_UI16 highest_compatible_version,
+ AP4_UI32 max_packet_size,
+ AP4_UI32 timescale);
+ AP4_RtpHintSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ virtual ~AP4_RtpHintSampleEntry();
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_UI16 m_HintTrackVersion;
+ AP4_UI16 m_HighestCompatibleVersion;
+ AP4_UI32 m_MaxPacketSize;
+};
+
+#endif // _AP4_SAMPLE_ENTRY_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleTable.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleTable.cpp
new file mode 100644
index 000000000..ab07f2b02
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleTable.cpp
@@ -0,0 +1,113 @@
+/*****************************************************************
+|
+| AP4 - Sample Table Interface
+|
+| Copyright 2003-2004 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4SampleTable.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4StszAtom.h"
+#include "Ap4StscAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4SttsAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SampleTable::GenerateStblAtom
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleTable::GenerateStblAtom(AP4_ContainerAtom*& stbl)
+{
+ // create the stbl container
+ stbl = new AP4_ContainerAtom(AP4_ATOM_TYPE_STBL);
+
+ // create the stsd atom
+ AP4_StsdAtom* stsd = new AP4_StsdAtom(this);
+
+ // create the stsz atom
+ AP4_StszAtom* stsz = new AP4_StszAtom();
+
+ // create the stsc atom
+ AP4_StscAtom* stsc = new AP4_StscAtom();
+
+ // start chunk table
+ AP4_Cardinal samples_in_chunk = 0;
+ AP4_Offset current_chunk_offset = 0;
+ AP4_Size current_chunk_size = 0;
+ AP4_Array<AP4_UI32> chunk_offsets;
+
+ // process all the samples
+ AP4_Cardinal sample_count = GetSampleCount();
+ for (AP4_Ordinal i=0; i<sample_count; i++) {
+ AP4_Sample sample;
+ GetSample(i, sample);
+
+ // add an entry into the stsz atom
+ stsz->AddEntry(sample.GetSize());
+
+ // adjust the current chunk info
+ current_chunk_size += sample.GetSize();
+
+ // count the sample
+ samples_in_chunk++;
+ if (samples_in_chunk == 10) {
+ // new chunk
+ chunk_offsets.Append(current_chunk_offset);
+ stsc->AddEntry(1, 10, 1);
+ samples_in_chunk = 0;
+
+ // adjust the chunk offset
+ current_chunk_offset += current_chunk_size;
+ current_chunk_size = 0;
+ }
+ }
+
+ // process any unfinished chunk
+ if (samples_in_chunk != 0) {
+ // new chunk
+ chunk_offsets.Append(current_chunk_offset);
+ stsc->AddEntry(1, samples_in_chunk, 1);
+ }
+
+ // create the stco atom
+ AP4_StcoAtom* stco = new AP4_StcoAtom(&chunk_offsets[0],
+ chunk_offsets.ItemCount());
+
+ // create the stts atom (for now, we assume sample of equal duration)
+ AP4_SttsAtom* stts = new AP4_SttsAtom();
+ stts->AddEntry(sample_count, 1000); // FIXME
+
+ // attach the children of stbl
+ stbl->AddChild(stsd);
+ stbl->AddChild(stsz);
+ stbl->AddChild(stsc);
+ stbl->AddChild(stco);
+ stbl->AddChild(stts);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleTable.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleTable.h
new file mode 100644
index 000000000..55f97a1b6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SampleTable.h
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - Sample Table Interface
+|
+| Copyright 2003-2004 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_TABLE_H_
+#define _AP4_SAMPLE_TABLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Sample.h"
+#include "Ap4Atom.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4SampleDescription.h"
+
+/*----------------------------------------------------------------------
+| AP4_SampleTable
++---------------------------------------------------------------------*/
+class AP4_SampleTable {
+public:
+ // constructors and destructor
+ virtual ~AP4_SampleTable() {};
+
+ // methods
+ virtual AP4_Result GenerateStblAtom(AP4_ContainerAtom*& stbl);
+ virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample) = 0;
+ virtual AP4_Cardinal GetSampleCount() = 0;
+ virtual AP4_Cardinal GetSampleDescriptionCount() = 0;
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index) = 0;
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index) = 0;
+};
+
+#endif // _AP4_SAMPLE_TABLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SchmAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SchmAtom.cpp
new file mode 100644
index 000000000..e68b2e287
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SchmAtom.cpp
@@ -0,0 +1,120 @@
+/*****************************************************************
+|
+| AP4 - schm Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SchmAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom::AP4_SchmAtom
++---------------------------------------------------------------------*/
+AP4_SchmAtom::AP4_SchmAtom(AP4_UI32 scheme_type,
+ AP4_UI32 scheme_version,
+ const char* scheme_uri) :
+ AP4_Atom(AP4_ATOM_TYPE_SCHM, AP4_FULL_ATOM_HEADER_SIZE+8, true),
+ m_SchemeType(scheme_type),
+ m_SchemeVersion(scheme_version)
+{
+ if (scheme_uri) {
+ m_SchemeUri = scheme_uri;
+ m_Flags = 1;
+ m_Size += m_SchemeUri.length()+1;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom::AP4_SchmAtom
++---------------------------------------------------------------------*/
+AP4_SchmAtom::AP4_SchmAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_SCHM, size, true, stream)
+{
+ stream.ReadUI32(m_SchemeType);
+ stream.ReadUI32(m_SchemeVersion);
+ if (m_Flags & 1) {
+ int str_size = size-(AP4_FULL_ATOM_HEADER_SIZE+8);
+ if (str_size > 0) {
+ char* str = new char[str_size];
+ stream.Read(str, str_size);
+ str[str_size-1] = '\0'; // force null-termination
+ m_SchemeUri = str;
+ delete[] str;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SchmAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // scheme type
+ result = stream.WriteUI32(m_SchemeType);
+ if (AP4_FAILED(result)) return result;
+
+ // scheme version
+ result = stream.WriteUI32(m_SchemeVersion);
+ if (AP4_FAILED(result)) return result;
+
+ // uri if needed
+ if (m_Flags & 1) {
+ result = stream.Write(m_SchemeUri.c_str(), m_SchemeUri.length()+1);
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_FULL_ATOM_HEADER_SIZE+8+m_SchemeUri.length()+1);
+ while (padding--) {
+ stream.WriteUI08(0);
+ }
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SchmAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char st[5];
+ AP4_FormatFourChars(st, m_SchemeType);
+ inspector.AddField("scheme_type", st);
+ inspector.AddField("scheme_version", m_SchemeVersion);
+ if (m_Flags & 1) {
+ inspector.AddField("scheme_uri", m_SchemeUri.c_str());
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SchmAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SchmAtom.h
new file mode 100644
index 000000000..d5149fa1c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SchmAtom.h
@@ -0,0 +1,68 @@
+/*****************************************************************
+|
+| AP4 - schm Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SCHM_ATOM_H_
+#define _AP4_SCHM_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SchmAtom
++---------------------------------------------------------------------*/
+class AP4_SchmAtom : public AP4_Atom
+{
+ public:
+ // constructors
+ AP4_SchmAtom(AP4_UI32 scheme_type,
+ AP4_UI32 scheme_version,
+ const char* scheme_uri = NULL);
+ AP4_SchmAtom(AP4_Size size, AP4_ByteStream& stream);
+
+ // methods
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ AP4_UI32 GetSchemeType() { return m_SchemeType; }
+ AP4_UI32 GetSchemeVersion() { return m_SchemeVersion; }
+ AP4_String& GetSchemeUri() { return m_SchemeUri; }
+
+ private:
+ // members
+ AP4_UI32 m_SchemeType;
+ AP4_UI32 m_SchemeVersion;
+ AP4_String m_SchemeUri;
+};
+
+#endif // _AP4_SCHM_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SdpAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SdpAtom.cpp
new file mode 100644
index 000000000..26d0e0410
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SdpAtom.cpp
@@ -0,0 +1,100 @@
+/*****************************************************************
+|
+| AP4 - sdp Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::AP4_SdpAtom
++---------------------------------------------------------------------*/
+AP4_SdpAtom::AP4_SdpAtom(const char* sdp_text) :
+ AP4_Atom(AP4_ATOM_TYPE_SDP, AP4_ATOM_HEADER_SIZE, false),
+ m_SdpText(sdp_text)
+{
+ m_Size += m_SdpText.length()+1;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::AP4_SdpAtom
++---------------------------------------------------------------------*/
+AP4_SdpAtom::AP4_SdpAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_SDP, size, false, stream)
+{
+ // sdptext
+ AP4_Size str_size = size-AP4_ATOM_HEADER_SIZE;
+ if (str_size > 0) {
+ char* str = new char[str_size+1];
+ stream.Read(str, str_size);
+ str[str_size] = '\0'; // force null-termination
+ m_SdpText = str;
+ delete[] str;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SdpAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // sdptext
+ AP4_Result result = stream.Write(m_SdpText.c_str(), m_SdpText.length());
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_ATOM_HEADER_SIZE+m_SdpText.length());
+ while (padding--) stream.WriteUI08(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SdpAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("sdp_text", m_SdpText.c_str());
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom::GetSdpText
++---------------------------------------------------------------------*/
+const AP4_String&
+AP4_SdpAtom::GetSdpText() const
+{
+ return m_SdpText;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SdpAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SdpAtom.h
new file mode 100644
index 000000000..5ed54c9c2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SdpAtom.h
@@ -0,0 +1,61 @@
+/*****************************************************************
+|
+| AP4 - sdp Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_SDP_ATOM_H_
+#define _AP4_SDP_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_SdpAtom
++---------------------------------------------------------------------*/
+class AP4_SdpAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_SdpAtom(AP4_Size size, AP4_ByteStream& stream);
+ AP4_SdpAtom(const char* sdp_text);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ const AP4_String& GetSdpText() const;
+
+private:
+ // members
+ AP4_String m_SdpText;
+};
+
+#endif // _AP4_SDP_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SmhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SmhdAtom.cpp
new file mode 100644
index 000000000..6aa5f7b58
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SmhdAtom.cpp
@@ -0,0 +1,85 @@
+/*****************************************************************
+|
+| AP4 - smhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SmhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom::AP4_SmhdAtom
++---------------------------------------------------------------------*/
+AP4_SmhdAtom::AP4_SmhdAtom(AP4_UI16 balance) :
+ AP4_Atom(AP4_ATOM_TYPE_SMHD, 4+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_Balance(balance)
+{
+ m_Reserved = 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom::AP4_SmhdAtom
++---------------------------------------------------------------------*/
+AP4_SmhdAtom::AP4_SmhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_SMHD, size, true, stream)
+{
+ stream.ReadUI16(m_Balance);
+ stream.ReadUI16(m_Reserved);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SmhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // balance
+ result = stream.WriteUI16(m_Balance);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved
+ result = stream.WriteUI16(m_Reserved);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SmhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("balance", m_Balance);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SmhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SmhdAtom.h
new file mode 100644
index 000000000..eaabb8458
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SmhdAtom.h
@@ -0,0 +1,57 @@
+/*****************************************************************
+|
+| AP4 - smhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_SMHD_ATOM_H_
+#define _AP4_SMHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SmhdAtom
++---------------------------------------------------------------------*/
+class AP4_SmhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_SmhdAtom(AP4_UI16 balance);
+ AP4_SmhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI16 m_Balance;
+ AP4_UI16 m_Reserved;
+};
+
+#endif // _AP4_SMHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StcoAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StcoAtom.cpp
new file mode 100644
index 000000000..3e6a96bc9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StcoAtom.cpp
@@ -0,0 +1,151 @@
+/*****************************************************************
+|
+| AP4 - stco Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::AP4_StcoAtom
++---------------------------------------------------------------------*/
+AP4_StcoAtom::AP4_StcoAtom(AP4_UI32* entries, AP4_UI32 entry_count) :
+AP4_Atom(AP4_ATOM_TYPE_STCO,
+ AP4_FULL_ATOM_HEADER_SIZE+4+entry_count*4,
+ true),
+ m_Entries(new AP4_UI32[entry_count]),
+ m_EntryCount(entry_count)
+{
+ memcpy(m_Entries, entries, m_EntryCount*4);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::AP4_StcoAtom
++---------------------------------------------------------------------*/
+AP4_StcoAtom::AP4_StcoAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STCO, size, true, stream)
+{
+ stream.ReadUI32(m_EntryCount);
+ if (m_EntryCount > (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4) {
+ m_EntryCount = (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4;
+ }
+ m_Entries = new AP4_UI32[m_EntryCount];
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ stream.ReadUI32(m_Entries[i]);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::~AP4_StcoAtom
++---------------------------------------------------------------------*/
+AP4_StcoAtom::~AP4_StcoAtom()
+{
+ delete[] m_Entries;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::GetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // get the chunk offset
+ chunk_offset = m_Entries[chunk - 1]; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::SetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::SetChunkOffset(AP4_Ordinal chunk, AP4_Offset chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // get the chunk offset
+ m_Entries[chunk - 1] = chunk_offset; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::AdjustChunkOffsets
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::AdjustChunkOffsets(AP4_Offset offset)
+{
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ m_Entries[i] += offset;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ result = stream.WriteUI32(m_EntryCount);
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ result = stream.WriteUI32(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_EntryCount);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StcoAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StcoAtom.h
new file mode 100644
index 000000000..7d34c932f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StcoAtom.h
@@ -0,0 +1,62 @@
+/*****************************************************************
+|
+| AP4 - stco Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STCO_ATOM_H_
+#define _AP4_STCO_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom
++---------------------------------------------------------------------*/
+class AP4_StcoAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StcoAtom(AP4_UI32* offsets, AP4_UI32 offset_count);
+ AP4_StcoAtom(AP4_Size size, AP4_ByteStream& stream);
+ ~AP4_StcoAtom();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ AP4_Cardinal GetChunkCount() { return m_EntryCount; }
+ AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& chunk_offset);
+ AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_Offset chunk_offset);
+ AP4_Result AdjustChunkOffsets(AP4_Offset offset);
+
+ private:
+ AP4_UI32* m_Entries;
+ AP4_UI32 m_EntryCount;
+};
+
+#endif // _AP4_STCO_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StscAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StscAtom.cpp
new file mode 100644
index 000000000..ce3101f02
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StscAtom.cpp
@@ -0,0 +1,224 @@
+/*****************************************************************
+|
+| AP4 - stsc Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StscAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::AP4_StscAtom
++---------------------------------------------------------------------*/
+AP4_StscAtom::AP4_StscAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_STSC, 4+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CachedChunkGroup(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::AP4_StscAtom
++---------------------------------------------------------------------*/
+AP4_StscAtom::AP4_StscAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STSC, size, true, stream),
+ m_CachedChunkGroup(0)
+{
+ AP4_UI32 first_sample = 1;
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 first_chunk;
+ AP4_UI32 samples_per_chunk;
+ AP4_UI32 sample_description_index;
+ if (stream.ReadUI32(first_chunk) == AP4_SUCCESS &&
+ stream.ReadUI32(samples_per_chunk) == AP4_SUCCESS &&
+ stream.ReadUI32(sample_description_index) == AP4_SUCCESS) {
+ if (m_Entries.ItemCount() != 0) {
+ AP4_Ordinal prev = m_Entries.ItemCount()-1;
+ m_Entries[prev].m_ChunkCount =
+ first_chunk-m_Entries[prev].m_FirstChunk;
+ first_sample +=
+ m_Entries[prev].m_ChunkCount *
+ m_Entries[prev].m_SamplesPerChunk;
+ }
+ m_Entries.Append(AP4_StscTableEntry(first_chunk,
+ first_sample,
+ samples_per_chunk,
+ sample_description_index));
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StscAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+
+ // entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ stream.WriteUI32(m_Entries[i].m_FirstChunk);
+ if (AP4_FAILED(result)) return result;
+ stream.WriteUI32(m_Entries[i].m_SamplesPerChunk);
+ if (AP4_FAILED(result)) return result;
+ stream.WriteUI32(m_Entries[i].m_SampleDescriptionIndex);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::AddEntry
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StscAtom::AddEntry(AP4_Cardinal chunk_count,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index)
+{
+ AP4_Ordinal first_chunk;
+ AP4_Ordinal first_sample;
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ if (entry_count == 0) {
+ // first entry
+ first_chunk = 1;
+ first_sample = 1;
+ } else {
+ first_chunk = m_Entries[entry_count-1].m_FirstChunk+
+ m_Entries[entry_count-1].m_ChunkCount;
+ first_sample = m_Entries[entry_count-1].m_FirstSample+
+ m_Entries[entry_count-1].m_ChunkCount*
+ m_Entries[entry_count-1].m_SamplesPerChunk;
+ }
+ m_Entries.Append(AP4_StscTableEntry(first_chunk, first_sample, chunk_count, samples_per_chunk, sample_description_index));
+
+ // update the atom size
+ m_Size += 12;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::GetChunkForSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StscAtom::GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description)
+{
+ // preconditions
+ AP4_ASSERT(sample > 0);
+
+ // decide whether to start the search from the cached index
+ // or from the start
+ AP4_Ordinal group;
+ if (m_CachedChunkGroup < m_Entries.ItemCount() &&
+ m_Entries[m_CachedChunkGroup].m_FirstSample <= sample) {
+ group = m_CachedChunkGroup;
+ } else {
+ group = 0;
+ }
+
+ // find which group of chunk contains this one
+ while (group < m_Entries.ItemCount()) {
+ AP4_Cardinal sample_count =
+ m_Entries[group].m_ChunkCount*m_Entries[group].m_SamplesPerChunk;
+ if (sample_count == 0) {
+ // unlimited samples in this group (last group)
+ if (m_Entries[group].m_FirstSample > sample) {
+ // something is wrong
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+ } else {
+ // normal group
+ if (m_Entries[group].m_FirstSample + sample_count <= sample) {
+ // the sample is not in this group
+ group++;
+ continue;
+ }
+ }
+
+ // the sample is in this group
+ if (m_Entries[group].m_SamplesPerChunk == 0) {
+ // something is wrong
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+ unsigned int chunk_offset =
+ ((sample-m_Entries[group].m_FirstSample) /
+ m_Entries[group].m_SamplesPerChunk);
+ chunk = m_Entries[group].m_FirstChunk + chunk_offset;
+ skip = sample -
+ (m_Entries[group].m_FirstSample +
+ m_Entries[group].m_SamplesPerChunk*chunk_offset);
+ sample_description = m_Entries[group].m_SampleDescriptionIndex;
+
+ // cache the result (to accelerate finding the right group
+ // next time around
+ m_CachedChunkGroup = group;
+
+ return AP4_SUCCESS;
+ }
+
+ // chunk not found
+ chunk = 0;
+ skip = 0;
+ sample_description = 0;
+ return AP4_ERROR_OUT_OF_RANGE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StscAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ // dump table entries
+ //for (unsigned int i=0; i<m_Entries.GetItemCount(); i++) {
+ // char dump[256];
+ // sprintf(dump, " f=%ld, spc=%ld, sdi=%ld\n",
+ // m_Entries[i].m_FirstChunk,
+ // m_Entries[i].m_SamplesPerChunk,
+ // m_Entries[i].m_SampleDescriptionIndex);
+ // stream.WriteString(prefix);
+ // stream.WriteString(dump);
+ //}
+
+ return AP4_SUCCESS;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StscAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StscAtom.h
new file mode 100644
index 000000000..1d2ff283c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StscAtom.h
@@ -0,0 +1,102 @@
+/*****************************************************************
+|
+| AP4 - stsc Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSC_ATOM_H_
+#define _AP4_STSC_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StscTableEntry
++---------------------------------------------------------------------*/
+class AP4_StscTableEntry {
+ public:
+ AP4_StscTableEntry() :
+ m_FirstChunk(0),
+ m_FirstSample(0),
+ m_ChunkCount(0),
+ m_SamplesPerChunk(0),
+ m_SampleDescriptionIndex(0) {}
+ AP4_StscTableEntry(AP4_Ordinal first_chunk,
+ AP4_Ordinal first_sample,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index) :
+ m_FirstChunk(first_chunk),
+ m_FirstSample(first_sample),
+ m_ChunkCount(0),
+ m_SamplesPerChunk(samples_per_chunk),
+ m_SampleDescriptionIndex(sample_description_index) {}
+ AP4_StscTableEntry(AP4_Ordinal first_chunk,
+ AP4_Ordinal first_sample,
+ AP4_Cardinal chunk_count,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index) :
+ m_FirstChunk(first_chunk),
+ m_FirstSample(first_sample),
+ m_ChunkCount(chunk_count),
+ m_SamplesPerChunk(samples_per_chunk),
+ m_SampleDescriptionIndex(sample_description_index) {}
+ AP4_Ordinal m_FirstChunk;
+ AP4_Ordinal m_FirstSample; // computed (not in file)
+ AP4_Cardinal m_ChunkCount; // computed (not in file)
+ AP4_Cardinal m_SamplesPerChunk;
+ AP4_Ordinal m_SampleDescriptionIndex;
+};
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom
++---------------------------------------------------------------------*/
+class AP4_StscAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StscAtom();
+ AP4_StscAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description);
+ virtual AP4_Result AddEntry(AP4_Cardinal chunk_count,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ private:
+ // data
+ AP4_Array<AP4_StscTableEntry> m_Entries;
+ AP4_Ordinal m_CachedChunkGroup;
+};
+
+#endif // _AP4_STSC_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StsdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StsdAtom.cpp
new file mode 100644
index 000000000..4c17c1421
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StsdAtom.cpp
@@ -0,0 +1,189 @@
+/*****************************************************************
+|
+| AP4 - stsd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4SampleEntry.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::AP4_StsdAtom
++---------------------------------------------------------------------*/
+AP4_StsdAtom::AP4_StsdAtom(AP4_SampleTable* sample_table) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_STSD, 4+AP4_FULL_ATOM_HEADER_SIZE, true)
+{
+ AP4_Cardinal sample_description_count = sample_table->GetSampleDescriptionCount();
+ m_SampleDescriptions.EnsureCapacity(sample_description_count);
+ for (AP4_Ordinal i=0; i<sample_description_count; i++) {
+ // clear the cache entry
+ m_SampleDescriptions.Append(NULL);
+
+ // create an entry for the description
+ AP4_SampleDescription* sample_description = sample_table->GetSampleDescription(i);
+ AP4_Atom* entry = sample_description->ToAtom();
+ m_Children.Add(entry);
+
+ // update the size
+ m_Size += entry->GetSize();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::AP4_StsdAtom
++---------------------------------------------------------------------*/
+AP4_StsdAtom::AP4_StsdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_STSD, size, true, stream)
+{
+ // read the number of entries
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+
+ // read all entries
+ AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ for (unsigned int i=0; i<entry_count; i++) {
+ AP4_Atom* atom;
+ if (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom))) {
+ atom->SetParent(this);
+ m_Children.Add(atom);
+ }
+ }
+
+ // initialize the sample description cache
+ m_SampleDescriptions.EnsureCapacity(m_Children.ItemCount());
+ for (AP4_Ordinal i=0; i<m_Children.ItemCount(); i++) {
+ m_SampleDescriptions.Append(NULL);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::~AP4_StsdAtom
++---------------------------------------------------------------------*/
+AP4_StsdAtom::~AP4_StsdAtom()
+{
+ for (AP4_Ordinal i=0; i<m_SampleDescriptions.ItemCount(); i++) {
+ delete m_SampleDescriptions[i];
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StsdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ result = stream.WriteUI32(m_Children.ItemCount());
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::OnChildChanged
++---------------------------------------------------------------------*/
+void
+AP4_StsdAtom::OnChildChanged(AP4_Atom*)
+{
+ // remcompute our size
+ m_Size = GetHeaderSize()+4;
+ m_Children.Apply(AP4_AtomSizeAdder(m_Size));
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_StsdAtom::GetSampleDescription(AP4_Ordinal index)
+{
+ // check index
+ if (index >= m_Children.ItemCount()) return NULL;
+
+ // return the description if we already have it in the internal table
+ if (m_SampleDescriptions[index]) return m_SampleDescriptions[index];
+
+ // create and cache a sample description for this entry
+ AP4_Atom* entry;
+ m_Children.Get(index, entry);
+ AP4_SampleEntry* sample_entry = dynamic_cast<AP4_SampleEntry*>(entry);
+ if (sample_entry == NULL) return NULL;
+ m_SampleDescriptions[index] = sample_entry->ToSampleDescription();
+ return m_SampleDescriptions[index];
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::GetSampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry*
+AP4_StsdAtom::GetSampleEntry(AP4_Ordinal index)
+{
+ // check index
+ if (index >= m_Children.ItemCount()) return NULL;
+
+ // return the sample entry
+ AP4_Atom* entry;
+ m_Children.Get(index, entry);
+ return dynamic_cast<AP4_SampleEntry*>(entry);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::GetSampleDescriptionCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_StsdAtom::GetSampleDescriptionCount()
+{
+ return m_Children.ItemCount();
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StsdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry-count", m_Children.ItemCount());
+
+ // inspect children
+ m_Children.Apply(AP4_AtomListInspector(inspector));
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StsdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StsdAtom.h
new file mode 100644
index 000000000..4ae6be58f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StsdAtom.h
@@ -0,0 +1,77 @@
+/*****************************************************************
+|
+| AP4 - stsd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSD_ATOM_H_
+#define _AP4_STSD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_SampleTable;
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom
++---------------------------------------------------------------------*/
+class AP4_StsdAtom : public AP4_ContainerAtom
+{
+ public:
+ // methods
+ AP4_StsdAtom(AP4_SampleTable* sample_table);
+ AP4_StsdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ ~AP4_StsdAtom();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Cardinal GetSampleDescriptionCount();
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ virtual AP4_SampleEntry* GetSampleEntry(AP4_Ordinal index);
+
+ // AP4_AtomParent methods
+ void OnChildChanged(AP4_Atom* child);
+
+ private:
+ // members
+ AP4_Array<AP4_SampleDescription*> m_SampleDescriptions;
+};
+
+#endif // _AP4_STSD_ATOM_H_
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StssAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StssAtom.cpp
new file mode 100644
index 000000000..e6eaaf284
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StssAtom.cpp
@@ -0,0 +1,104 @@
+/*****************************************************************
+|
+| AP4 - stss Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StssAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom::AP4_StssAtom
++---------------------------------------------------------------------*/
+AP4_StssAtom::AP4_StssAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STSS, size, true, stream)
+{
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 entry_sample_index;
+ if (stream.ReadUI32(entry_sample_index) == AP4_SUCCESS) {
+ m_Entries.Append(entry_sample_index);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StssAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ result = stream.WriteUI32(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom::IsSampleSync
++---------------------------------------------------------------------*/
+bool
+AP4_StssAtom::IsSampleSync(AP4_Ordinal sample)
+{
+ unsigned int entry_index = 0;
+
+ while (entry_index < m_Entries.ItemCount() &&
+ m_Entries[entry_index] >= sample) {
+ if (m_Entries[entry_index] == sample) {
+ return true;
+ }
+ entry_index++;
+ }
+
+ return false;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StssAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StssAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StssAtom.h
new file mode 100644
index 000000000..e71e2edc3
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StssAtom.h
@@ -0,0 +1,56 @@
+/*****************************************************************
+|
+| AP4 - stss Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSS_ATOM_H_
+#define _AP4_STSS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom
++---------------------------------------------------------------------*/
+class AP4_StssAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StssAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual bool IsSampleSync(AP4_Ordinal sample);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ private:
+ AP4_Array<AP4_UI32> m_Entries;
+};
+
+#endif // _AP4_STSS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StszAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StszAtom.cpp
new file mode 100644
index 000000000..399373e3e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StszAtom.cpp
@@ -0,0 +1,161 @@
+/*****************************************************************
+|
+| AP4 - stsz Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StszAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::AP4_StszAtom
++---------------------------------------------------------------------*/
+AP4_StszAtom::AP4_StszAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_STSZ, AP4_FULL_ATOM_HEADER_SIZE+8, true),
+ m_SampleSize(0),
+ m_SampleCount(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::AP4_StszAtom
++---------------------------------------------------------------------*/
+AP4_StszAtom::AP4_StszAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STSZ, size, true, stream)
+{
+ stream.ReadUI32(m_SampleSize);
+ stream.ReadUI32(m_SampleCount);
+ unsigned long sample_count = m_SampleCount;
+ if (m_SampleSize == 0) { // means that the samples have different sizes
+ while (sample_count--) {
+ AP4_UI32 entry_size;
+ if (stream.ReadUI32(entry_size) == AP4_SUCCESS) {
+ m_Entries.Append(entry_size);
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // sample size
+ result = stream.WriteUI32(m_SampleSize);
+ if (AP4_FAILED(result)) return result;
+
+ // sample count
+ result = stream.WriteUI32(m_SampleCount);
+ if (AP4_FAILED(result)) return result;
+
+ // entries if needed (the samples have different sizes)
+ if (m_SampleSize == 0) {
+ for (AP4_UI32 i=0; i<m_SampleCount; i++) {
+ result = stream.WriteUI32(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_StszAtom::GetSampleCount()
+{
+ return m_SampleCount;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::GetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::GetSampleSize(AP4_Ordinal sample, AP4_Size& sample_size)
+{
+ // check the sample index
+ if (sample > m_SampleCount) {
+ sample_size = 0;
+ return AP4_ERROR_OUT_OF_RANGE;
+ } else {
+ // find the size
+ if (m_SampleSize != 0) { // constant size
+ sample_size = m_SampleSize;
+ } else {
+ sample_size = m_Entries[sample - 1];
+ }
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::SetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::SetSampleSize(AP4_Ordinal sample, AP4_Size sample_size)
+{
+ // check the sample index
+ if (sample > m_SampleCount) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ } else {
+ m_Entries[sample - 1] = sample_size;
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::AddEntry
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::AddEntry(AP4_UI32 size)
+{
+ m_Entries.Append(size);
+ m_SampleCount++;
+ m_Size += 4;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("sample_size", m_SampleSize);
+ inspector.AddField("sample_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StszAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StszAtom.h
new file mode 100644
index 000000000..36412e080
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4StszAtom.h
@@ -0,0 +1,64 @@
+/*****************************************************************
+|
+| AP4 - stsz Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSZ_ATOM_H_
+#define _AP4_STSZ_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom
++---------------------------------------------------------------------*/
+class AP4_StszAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StszAtom();
+ AP4_StszAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_UI32 GetSampleCount();
+ virtual AP4_Result GetSampleSize(AP4_Ordinal sample,
+ AP4_Size& sample_size);
+ virtual AP4_Result SetSampleSize(AP4_Ordinal sample,
+ AP4_Size sample_size);
+ virtual AP4_Result AddEntry(AP4_UI32 size);
+
+ private:
+ AP4_UI32 m_SampleSize;
+ AP4_UI32 m_SampleCount;
+ AP4_Array<AP4_UI32> m_Entries;
+};
+
+#endif // _AP4_STSZ_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SttsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SttsAtom.cpp
new file mode 100644
index 000000000..0042489d4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SttsAtom.cpp
@@ -0,0 +1,168 @@
+/*****************************************************************
+|
+| AP4 - stts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SttsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::AP4_SttsAtom
++---------------------------------------------------------------------*/
+AP4_SttsAtom::AP4_SttsAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_STTS, AP4_FULL_ATOM_HEADER_SIZE+4, true)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::AP4_SttsAtom
++---------------------------------------------------------------------*/
+AP4_SttsAtom::AP4_SttsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STTS, size, true, stream)
+{
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 sample_count;
+ AP4_UI32 sample_duration;
+ if (stream.ReadUI32(sample_count) == AP4_SUCCESS &&
+ stream.ReadUI32(sample_duration) == AP4_SUCCESS) {
+ m_Entries.Append(AP4_SttsTableEntry(sample_count,
+ sample_duration));
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::GetDts
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::GetDts(AP4_Ordinal sample, AP4_TimeStamp& dts)
+{
+ AP4_Ordinal sample_count_in_entry = sample;
+ dts = 0;
+
+ for (AP4_UI32 i = 0; i < m_Entries.ItemCount(); i++) {
+ AP4_SttsTableEntry& entry = m_Entries[i];
+
+ // check if we have the correct entry
+ if (sample_count_in_entry <= entry.m_SampleCount) {
+ dts += (sample_count_in_entry - 1) * entry.m_SampleDuration;
+ return AP4_SUCCESS;
+ } else {
+ dts += entry.m_SampleCount * entry.m_SampleDuration;
+ sample_count_in_entry -= entry.m_SampleCount;
+ }
+ }
+
+ // sample is greater than the number of samples
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::AddEntry
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::AddEntry(AP4_UI32 sample_count, AP4_UI32 sample_duration)
+{
+ m_Entries.Append(AP4_SttsTableEntry(sample_count, sample_duration));
+ m_Size += 8;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+ if (AP4_FAILED(result)) return result;
+
+ // write the entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ // sample count
+ result = stream.WriteUI32(m_Entries[i].m_SampleCount);
+ if (AP4_FAILED(result)) return result;
+
+ // time offset
+ result = stream.WriteUI32(m_Entries[i].m_SampleDuration);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::GetSampleIndexForTimeStamp
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::GetSampleIndexForTimeStamp(AP4_TimeStamp ts, AP4_Ordinal& sample)
+{
+ // init
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ AP4_Duration accumulated = 0;
+ sample = 0;
+
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ AP4_Duration next_accumulated = accumulated
+ + m_Entries[i].m_SampleCount * m_Entries[i].m_SampleDuration;
+
+ // check if the ts is in the range of this entry
+ if (ts < next_accumulated) {
+ sample += (ts - accumulated) / m_Entries[i].m_SampleDuration;
+ return AP4_SUCCESS;
+ }
+
+ // update accumulated and sample
+ accumulated = next_accumulated;
+ sample += m_Entries[i].m_SampleCount;
+ }
+
+ // ts not in range of the table
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SttsAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SttsAtom.h
new file mode 100644
index 000000000..5bde4fbc9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SttsAtom.h
@@ -0,0 +1,77 @@
+/*****************************************************************
+|
+| AP4 - stts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STTS_ATOM_H_
+#define _AP4_STTS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SttsTableEntry
++---------------------------------------------------------------------*/
+class AP4_SttsTableEntry {
+ public:
+ AP4_SttsTableEntry() :
+ m_SampleCount(0),
+ m_SampleDuration(0) {}
+ AP4_SttsTableEntry(AP4_Cardinal sample_count,
+ AP4_Duration sample_duration) :
+ m_SampleCount(sample_count),
+ m_SampleDuration(sample_duration) {}
+
+ AP4_Cardinal m_SampleCount;
+ AP4_Duration m_SampleDuration;
+};
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom
++---------------------------------------------------------------------*/
+class AP4_SttsAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_SttsAtom();
+ AP4_SttsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result GetDts(AP4_Ordinal sample, AP4_TimeStamp& dts);
+ virtual AP4_Result AddEntry(AP4_UI32 sample_count, AP4_UI32 sample_duration);
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& sample);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ private:
+ AP4_Array<AP4_SttsTableEntry> m_Entries;
+};
+
+#endif // _AP4_STTS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SyntheticSampleTable.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SyntheticSampleTable.cpp
new file mode 100644
index 000000000..ae06d760a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SyntheticSampleTable.cpp
@@ -0,0 +1,130 @@
+/*****************************************************************
+|
+| AP4 - Synthetic Sample Table
+|
+| Copyright 2003-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4SyntheticSampleTable.h"
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::AP4_SyntheticSampleTable()
++---------------------------------------------------------------------*/
+AP4_SyntheticSampleTable::AP4_SyntheticSampleTable()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::~AP4_SyntheticSampleTable()
++---------------------------------------------------------------------*/
+AP4_SyntheticSampleTable::~AP4_SyntheticSampleTable()
+{
+ m_SampleDescriptions.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SyntheticSampleTable::GetSample(AP4_Ordinal index, AP4_Sample& sample)
+{
+ if (index < m_Samples.ItemCount()) {
+ sample = m_Samples[index];
+ return AP4_SUCCESS;
+ } else {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_SyntheticSampleTable::GetSampleCount()
+{
+ return m_Samples.ItemCount();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSampleDescriptionCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_SyntheticSampleTable::GetSampleDescriptionCount()
+{
+ return m_SampleDescriptions.ItemCount();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_SyntheticSampleTable::GetSampleDescription(AP4_Ordinal index)
+{
+ AP4_SampleDescription* description;
+ if (AP4_SUCCEEDED(m_SampleDescriptions.Get(index, description))) {
+ return description;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::AddSampleDescription
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SyntheticSampleTable::AddSampleDescription(AP4_SampleDescription* description)
+{
+ return m_SampleDescriptions.Add(description);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::AddSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SyntheticSampleTable::AddSample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp cts,
+ AP4_TimeStamp dts,
+ bool sync)
+{
+ AP4_Sample sample(data_stream, offset, size, description_index, dts, cts-dts);
+ return m_Samples.Append(sample);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SyntheticSampleTable::GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index)
+{
+ return AP4_ERROR_NOT_SUPPORTED_YET;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SyntheticSampleTable.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SyntheticSampleTable.h
new file mode 100644
index 000000000..b57639385
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4SyntheticSampleTable.h
@@ -0,0 +1,79 @@
+/*****************************************************************
+|
+| AP4 - Synthetic Sample Table
+|
+| Copyright 2003-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SYNTHETIC_SAMPLE_TABLE_H_
+#define _AP4_SYNTHETIC_SAMPLE_TABLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Array.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_ByteStream;
+
+/*----------------------------------------------------------------------
+| AP4_SyntheticSampleTable
++---------------------------------------------------------------------*/
+class AP4_SyntheticSampleTable : public AP4_SampleTable
+{
+ public:
+ // methods
+ AP4_SyntheticSampleTable();
+ virtual ~AP4_SyntheticSampleTable();
+
+ // AP4_SampleTable methods
+ virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
+ virtual AP4_Cardinal GetSampleCount();
+ virtual AP4_Cardinal GetSampleDescriptionCount();
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index);
+
+ // methods
+ virtual AP4_Result AddSampleDescription(AP4_SampleDescription* description);
+ virtual AP4_Result AddSample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp cts = 0,
+ AP4_TimeStamp dts = 0,
+ bool sync = false);
+
+private:
+ // members
+ AP4_Array<AP4_Sample> m_Samples;
+ AP4_List<AP4_SampleDescription> m_SampleDescriptions;
+};
+
+#endif // _AP4_SYNTHETIC_SAMPLE_TABLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TimsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TimsAtom.cpp
new file mode 100644
index 000000000..50ab62618
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TimsAtom.cpp
@@ -0,0 +1,76 @@
+/*****************************************************************
+|
+| AP4 - tims Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom::AP4_TimsAtom
++---------------------------------------------------------------------*/
+AP4_TimsAtom::AP4_TimsAtom(AP4_UI32 timescale) :
+ AP4_Atom(AP4_ATOM_TYPE_TIMS, 4, false),
+ m_TimeScale(timescale)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom::AP4_TimsAtom
++---------------------------------------------------------------------*/
+AP4_TimsAtom::AP4_TimsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_TIMS, size, false, stream)
+{
+ stream.ReadUI32(m_TimeScale);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TimsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // timescale
+ return stream.WriteUI32(m_TimeScale);
+
+}
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TimsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("timescale", m_TimeScale);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TimsAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TimsAtom.h
new file mode 100644
index 000000000..8ae79ab5a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TimsAtom.h
@@ -0,0 +1,60 @@
+/*****************************************************************
+|
+| AP4 - tims Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_TIMS_ATOM_H_
+#define _AP4_TIMS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_TimsAtom
++---------------------------------------------------------------------*/
+class AP4_TimsAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_TimsAtom(AP4_UI32 timescale);
+ AP4_TimsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ virtual AP4_UI32 GetTimeScale() { return m_TimeScale; }
+
+private:
+ // members
+ AP4_UI32 m_TimeScale;
+};
+
+#endif // _AP4_TIMS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TkhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TkhdAtom.cpp
new file mode 100644
index 000000000..44c638f0c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TkhdAtom.cpp
@@ -0,0 +1,170 @@
+/*****************************************************************
+|
+| AP4 - tkhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4TkhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::AP4_TkhdAtom
++---------------------------------------------------------------------*/
+AP4_TkhdAtom::AP4_TkhdAtom(AP4_UI32 creation_time,
+ AP4_UI32 modification_time,
+ AP4_UI32 track_id,
+ AP4_UI32 duration,
+ AP4_UI16 volume,
+ AP4_UI32 width,
+ AP4_UI32 height) :
+ AP4_Atom(AP4_ATOM_TYPE_TKHD, 80+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CreationTime(creation_time),
+ m_ModificationTime(modification_time),
+ m_TrackId(track_id),
+ m_Reserved1(0),
+ m_Duration(duration),
+ m_Layer(0),
+ m_AlternateGroup(0),
+ m_Volume(volume),
+ m_Reserved3(0),
+ m_Width(width),
+ m_Height(height)
+{
+ m_Flags = AP4_TKHD_FLAG_DEFAULTS;
+
+ m_Matrix[0] = 0x00010000;
+ m_Matrix[1] = 0;
+ m_Matrix[2] = 0;
+ m_Matrix[3] = 0;
+ m_Matrix[4] = 0x00010000;
+ m_Matrix[5] = 0;
+ m_Matrix[6] = 0;
+ m_Matrix[7] = 0;
+ m_Matrix[8] = 0x40000000;
+
+ m_Reserved2[0] = 0;
+ m_Reserved2[1] = 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::AP4_TkhdAtom
++---------------------------------------------------------------------*/
+AP4_TkhdAtom::AP4_TkhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_TKHD, size, true, stream)
+{
+ if (m_Version == 0) {
+ // we only deal with version 0 for now
+ stream.ReadUI32(m_CreationTime);
+ stream.ReadUI32(m_ModificationTime);
+ stream.ReadUI32(m_TrackId);
+ stream.ReadUI32(m_Reserved1);
+ stream.ReadUI32(m_Duration);
+ } else {
+ stream.Read(m_DataVersion1, 32, NULL);
+ }
+
+ stream.Read((void*)m_Reserved2, 8, NULL);
+ stream.ReadUI16(m_Layer);
+ stream.ReadUI16(m_AlternateGroup);
+ stream.ReadUI16(m_Volume);
+ stream.ReadUI16(m_Reserved3);
+ for (int i=0; i<9; i++) {
+ stream.ReadUI32(m_Matrix[i]);
+ }
+ stream.ReadUI32(m_Width);
+ stream.ReadUI32(m_Height);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TkhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // creation/modification time, track id, reserved1 & duration
+ if (m_Version == 0) {
+ result = stream.WriteUI32(m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TrackId);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Reserved1);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ result = stream.Write(m_DataVersion1, sizeof(m_DataVersion1));
+ }
+
+ // reserved2
+ result = stream.Write(m_Reserved2, sizeof(m_Reserved2));
+ if (AP4_FAILED(result)) return result;
+
+ // layer, alternate group & volume
+ result = stream.WriteUI16(m_Layer);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_AlternateGroup);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_Volume);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved3
+ result = stream.WriteUI16(m_Reserved3);
+
+ // matrix
+ for (int i=0; i<9; i++) {
+ result = stream.WriteUI32(m_Matrix[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // width & height
+ result = stream.WriteUI32(m_Width);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Height);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TkhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("enabled", ((m_Flags & AP4_TKHD_FLAG_TRACK_ENABLED) ? 1 : 0), AP4_AtomInspector::HINT_BOOLEAN);
+ inspector.AddField("id", m_TrackId);
+ inspector.AddField("duration", m_Duration);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TkhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TkhdAtom.h
new file mode 100644
index 000000000..99c6038cd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TkhdAtom.h
@@ -0,0 +1,96 @@
+/*****************************************************************
+|
+| AP4 - tkhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TKHD_ATOM_H_
+#define _AP4_TKHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_TKHD_FLAG_TRACK_ENABLED = 1;
+const int AP4_TKHD_FLAG_TRACK_IN_MOVIE = 2;
+const int AP4_TKHD_FLAG_TRACK_IN_PREVIEW = 4;
+
+const int AP4_TKHD_FLAG_DEFAULTS = 7;
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom
++---------------------------------------------------------------------*/
+class AP4_TkhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_TkhdAtom(AP4_UI32 creation_time,
+ AP4_UI32 modification_time,
+ AP4_UI32 track_id,
+ AP4_UI32 duration,
+ AP4_UI16 volume,
+ AP4_UI32 width,
+ AP4_UI32 height);
+ AP4_TkhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_UI32 GetDuration() { return m_Duration; }
+ AP4_Result SetDuration(AP4_UI32 duration) {
+ m_Duration = duration;
+ return AP4_SUCCESS;
+ }
+ AP4_UI32 GetTrackId() { return m_TrackId; }
+ AP4_Result SetTrackId(AP4_UI32 track_id) {
+ m_TrackId = track_id;
+ return AP4_SUCCESS;
+ }
+
+ private:
+ // members
+ AP4_UI32 m_CreationTime;
+ AP4_UI32 m_ModificationTime;
+ AP4_UI32 m_TrackId;
+ AP4_UI32 m_Reserved1;
+ AP4_UI32 m_Duration;
+ AP4_UI08 m_DataVersion1[32];
+ AP4_UI32 m_Reserved2[2];
+ AP4_UI16 m_Layer;
+ AP4_UI16 m_AlternateGroup;
+ AP4_UI16 m_Volume;
+ AP4_UI16 m_Reserved3;
+ AP4_UI32 m_Matrix[9];
+ AP4_UI32 m_Width;
+ AP4_UI32 m_Height;
+};
+
+#endif // _AP4_TKHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Track.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Track.cpp
new file mode 100644
index 000000000..79dcfd0c4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Track.cpp
@@ -0,0 +1,325 @@
+/*****************************************************************
+|
+| AP4 - Track Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4ByteStream.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4Track.h"
+#include "Ap4Utils.h"
+#include "Ap4Sample.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4AtomSampleTable.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4MdhdAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_Track::AP4_Track
++---------------------------------------------------------------------*/
+AP4_Track::AP4_Track(Type type,
+ AP4_SampleTable* sample_table,
+ AP4_UI32 track_id,
+ AP4_UI32 movie_time_scale,
+ AP4_UI32 media_time_scale,
+ AP4_UI32 media_duration,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 height) :
+ m_TrakAtomIsOwned(true),
+ m_Type(type),
+ m_SampleTable(sample_table),
+ m_SampleTableIsOwned(false),
+ m_MovieTimeScale(movie_time_scale ?
+ movie_time_scale :
+ AP4_TRACK_DEFAULT_MOVIE_TIMESCALE),
+ m_MediaTimeScale(media_time_scale)
+{
+ // compute the default volume value
+ unsigned int volume = 0;
+ if (type == TYPE_AUDIO) volume = 0x100;
+
+ // compute the handler type and name
+ AP4_Atom::Type hdlr_type;
+ const char* hdlr_name;
+ switch (type) {
+ case TYPE_AUDIO:
+ hdlr_type = AP4_HANDLER_TYPE_SOUN;
+ hdlr_name = "Bento4 Sound Handler";
+ break;
+
+ case TYPE_VIDEO:
+ hdlr_type = AP4_HANDLER_TYPE_VIDE;
+ hdlr_name = "Bento4 Video Handler";
+ break;
+
+ case TYPE_HINT:
+ hdlr_type = AP4_HANDLER_TYPE_HINT;
+ hdlr_name = "Bento4 Hint Handler";
+ break;
+
+ default:
+ hdlr_type = 0;
+ hdlr_name = NULL;
+ break;
+ }
+
+ // compute the track duration in units of the movie time scale
+ AP4_UI32 track_duration = AP4_ConvertTime(media_duration,
+ media_time_scale,
+ movie_time_scale);
+
+ // create a trak atom
+ m_TrakAtom = new AP4_TrakAtom(sample_table,
+ hdlr_type,
+ hdlr_name,
+ track_id,
+ 0,
+ 0,
+ track_duration,
+ media_time_scale,
+ media_duration,
+ volume,
+ language,
+ width,
+ height);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::AP4_Track
++---------------------------------------------------------------------*/
+AP4_Track::AP4_Track(AP4_TrakAtom& atom,
+ AP4_ByteStream& sample_stream,
+ AP4_UI32 movie_time_scale) :
+ m_TrakAtom(&atom),
+ m_TrakAtomIsOwned(false),
+ m_Type(TYPE_UNKNOWN),
+ m_SampleTable(NULL),
+ m_SampleTableIsOwned(true),
+ m_MovieTimeScale(movie_time_scale),
+ m_MediaTimeScale(0)
+{
+ // find the handler type
+ AP4_Atom* sub = atom.FindChild("mdia/hdlr");
+ if (sub) {
+ AP4_HdlrAtom* hdlr = dynamic_cast<AP4_HdlrAtom*>(sub);
+ if (hdlr) {
+ AP4_Atom::Type type = hdlr->GetHandlerType();
+ if (type == AP4_HANDLER_TYPE_SOUN) {
+ m_Type = TYPE_AUDIO;
+ } else if (type == AP4_HANDLER_TYPE_VIDE) {
+ m_Type = TYPE_VIDEO;
+ } else if (type == AP4_HANDLER_TYPE_HINT) {
+ m_Type = TYPE_HINT;
+ }
+ }
+ }
+
+ // get the media time scale
+ sub = atom.FindChild("mdia/mdhd");
+ if (sub) {
+ AP4_MdhdAtom* mdhd = dynamic_cast<AP4_MdhdAtom*>(sub);
+ if (mdhd) {
+ m_MediaTimeScale = mdhd->GetTimeScale();
+ }
+ }
+
+ // create a facade for the stbl atom
+ AP4_ContainerAtom* stbl = dynamic_cast<AP4_ContainerAtom*>(
+ atom.FindChild("mdia/minf/stbl"));
+ if (stbl) {
+ m_SampleTable = new AP4_AtomSampleTable(stbl, sample_stream);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::~AP4_Track
++---------------------------------------------------------------------*/
+AP4_Track::~AP4_Track()
+{
+ if (m_TrakAtomIsOwned) delete m_TrakAtom;
+ if (m_SampleTableIsOwned) delete m_SampleTable;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetId
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Track::GetId()
+{
+ return m_TrakAtom->GetId();
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::SetId
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::SetId(AP4_UI32 id)
+{
+ m_TrakAtom->SetId(id);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetDuration
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Track::GetDuration()
+{
+ return m_TrakAtom->GetDuration();
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_Duration
+AP4_Track::GetDurationMs()
+{
+ AP4_UI32 duration = m_TrakAtom->GetDuration();
+ return AP4_DurationMsFromUnits(duration, m_MovieTimeScale);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_Track::GetSampleCount()
+{
+ // delegate to the sample table
+ return m_SampleTable ? m_SampleTable->GetSampleCount() : 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::GetSample(AP4_Ordinal index, AP4_Sample& sample)
+{
+ // delegate to the sample table
+ return m_SampleTable ? m_SampleTable->GetSample(index, sample) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_Track::GetSampleDescription(AP4_Ordinal index)
+{
+ // delegate to the sample table
+ return m_SampleTable ? m_SampleTable->GetSampleDescription(index) : NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::ReadSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::ReadSample(AP4_Ordinal index,
+ AP4_Sample& sample,
+ AP4_DataBuffer& data)
+{
+ AP4_Result result;
+
+ // get the sample
+ result = GetSample(index, sample);
+ if (AP4_FAILED(result)) return result;
+
+ // read the data
+ return sample.ReadData(data);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSampleIndexForTimeStampMs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::GetSampleIndexForTimeStampMs(AP4_TimeStamp ts, AP4_Ordinal& index)
+{
+ // convert the ts in the timescale of the track's media
+ ts = AP4_ConvertTime(ts, 1000, m_MediaTimeScale);
+
+ return m_SampleTable->GetSampleIndexForTimeStamp(ts, index);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::SetMovieTimeScale
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::SetMovieTimeScale(AP4_UI32 time_scale)
+{
+ // check that we can convert
+ if (m_MovieTimeScale == 0) return AP4_FAILURE;
+
+ // convert from one time scale to the other
+ m_TrakAtom->SetDuration(AP4_ConvertTime(m_TrakAtom->GetDuration(),
+ m_MovieTimeScale,
+ time_scale));
+
+ // keep the new movie timescale
+ m_MovieTimeScale = time_scale;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetMediaTimeScale
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Track::GetMediaTimeScale()
+{
+ return m_MediaTimeScale;
+}
+
+// save the implementation for later
+#if 0
+/*----------------------------------------------------------------------
+| AP4_HintTrack::SetSdpText
++---------------------------------------------------------------------*/
+void
+AP4_HintTrack::SetSdpText(const char* text)
+{
+ // build an sdp atom
+ AP4_SdpAtom* sdp = new AP4_SdpAtom(text);
+
+ // build the hnti
+ AP4_ContainerAtom* hnti = new AP4_ContainerAtom(AP4_ATOM_TYPE_HNTI);
+ hnti->AddChild(sdp);
+
+ // check if there's already a user data atom
+ AP4_ContainerAtom* udta = dynamic_cast<AP4_ContainerAtom*>(m_TrakAtom->FindChild("udta"));
+ if (udta == NULL) {
+ // otherwise create it
+ udta = new AP4_ContainerAtom(AP4_ATOM_TYPE_UDTA);
+ m_TrakAtom->AddChild(udta);
+ }
+ udta->AddChild(hnti);
+}
+
+#endif
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Track.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Track.h
new file mode 100644
index 000000000..467996304
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Track.h
@@ -0,0 +1,110 @@
+/*****************************************************************
+|
+| AP4 - Track Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TRAK_H_
+#define _AP4_TRAK_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Array.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_StblAtom;
+class AP4_ByteStream;
+class AP4_Sample;
+class AP4_DataBuffer;
+class AP4_TrakAtom;
+class AP4_MoovAtom;
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_TRACK_DEFAULT_MOVIE_TIMESCALE = 1000;
+
+/*----------------------------------------------------------------------
+| AP4_Track
++---------------------------------------------------------------------*/
+class AP4_Track {
+ public:
+ // types
+ typedef enum {
+ TYPE_UNKNOWN,
+ TYPE_AUDIO,
+ TYPE_VIDEO,
+ TYPE_HINT
+ } Type;
+
+ // methods
+ AP4_Track(Type type,
+ AP4_SampleTable* sample_table,
+ AP4_UI32 track_id,
+ AP4_UI32 movie_time_scale, // 0 = use default
+ AP4_UI32 media_time_scale,
+ AP4_UI32 media_duration,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 height);
+ AP4_Track(AP4_TrakAtom& atom,
+ AP4_ByteStream& sample_stream,
+ AP4_UI32 movie_time_scale);
+ virtual ~AP4_Track();
+ AP4_Track::Type GetType() { return m_Type; }
+ AP4_UI32 GetDuration();
+ AP4_Duration GetDurationMs();
+ AP4_Cardinal GetSampleCount();
+ AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
+ AP4_Result ReadSample(AP4_Ordinal index,
+ AP4_Sample& sample,
+ AP4_DataBuffer& data);
+ AP4_Result GetSampleIndexForTimeStampMs(AP4_TimeStamp ts,
+ AP4_Ordinal& index);
+ AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ AP4_UI32 GetId();
+ AP4_Result SetId(AP4_UI32 track_id);
+ AP4_TrakAtom* GetTrakAtom() { return m_TrakAtom; }
+ AP4_Result SetMovieTimeScale(AP4_UI32 time_scale);
+ AP4_UI32 GetMediaTimeScale();
+
+ protected:
+ // members
+ AP4_TrakAtom* m_TrakAtom;
+ bool m_TrakAtomIsOwned;
+ Type m_Type;
+ AP4_SampleTable* m_SampleTable;
+ bool m_SampleTableIsOwned;
+ AP4_UI32 m_MovieTimeScale;
+ AP4_UI32 m_MediaTimeScale;
+};
+
+#endif // _AP4_TRAK_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrakAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrakAtom.cpp
new file mode 100644
index 000000000..4c10b32f8
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrakAtom.cpp
@@ -0,0 +1,199 @@
+/*****************************************************************
+|
+| AP4 - trak Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MdhdAtom.h"
+#include "Ap4VmhdAtom.h"
+#include "Ap4SmhdAtom.h"
+#include "Ap4HmhdAtom.h"
+#include "Ap4NmhdAtom.h"
+#include "Ap4DrefAtom.h"
+#include "Ap4UrlAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::AP4_TrakAtom
++---------------------------------------------------------------------*/
+AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table,
+ AP4_Atom::Type hdlr_type,
+ const char* hdlr_name,
+ AP4_UI32 track_id,
+ AP4_UI32 creation_time,
+ AP4_UI32 modification_time,
+ AP4_UI32 track_duration,
+ AP4_UI32 media_time_scale,
+ AP4_UI32 media_duration,
+ AP4_UI16 volume,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 height) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_TRAK)
+{
+ AP4_Result result;
+
+ // create a tkhd atom
+ m_TkhdAtom = new AP4_TkhdAtom(creation_time,
+ modification_time,
+ track_id,
+ track_duration,
+ volume,
+ width,
+ height);
+
+ // create an edts
+
+ // create a mdia atom
+ AP4_ContainerAtom* mdia = new AP4_ContainerAtom(AP4_ATOM_TYPE_MDIA);
+
+ // create a hdlr atom for the mdia atom
+ m_HdlrAtom = new AP4_HdlrAtom(hdlr_type, hdlr_name);
+
+ // create a minf atom
+ AP4_ContainerAtom* minf = new AP4_ContainerAtom(AP4_ATOM_TYPE_MINF);
+
+ // create a media header atom for minf (vmhd, smhd, hmhd or nmhd)
+ AP4_Atom* minf_header;
+ switch (hdlr_type) {
+ case AP4_HANDLER_TYPE_VIDE:
+ minf_header = new AP4_VmhdAtom(0, 0, 0, 0);
+ break;
+
+ case AP4_HANDLER_TYPE_SOUN:
+ minf_header = new AP4_SmhdAtom(0);
+ break;
+
+ default:
+ minf_header = new AP4_NmhdAtom();
+ break;
+ }
+
+ // create a dinf atom for minf
+ AP4_ContainerAtom* dinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_DINF);
+
+ // create a url atom as a ref for dref
+ AP4_Atom* url = new AP4_UrlAtom(); // local ref
+
+ // create a dref atom for dinf
+ AP4_DrefAtom* dref = new AP4_DrefAtom(&url, 1);
+
+ // create a stbl atom for minf
+ AP4_ContainerAtom* stbl;
+ result = sample_table->GenerateStblAtom(stbl);
+ if (AP4_FAILED(result)) stbl = NULL;
+
+ // populate the dinf atom
+ dinf->AddChild(dref);
+
+ // populate the minf atom
+ minf->AddChild(minf_header);
+ minf->AddChild(dinf);
+ if (stbl) minf->AddChild(stbl);
+
+ // create a mdhd atom for the mdia atom
+ AP4_MdhdAtom* mdhd = new AP4_MdhdAtom(creation_time,
+ modification_time,
+ media_time_scale,
+ media_duration,
+ language);
+
+ // populate the mdia atom
+ mdia->AddChild(mdhd);
+ mdia->AddChild(m_HdlrAtom);
+ mdia->AddChild(minf);
+
+ // attach the children
+ AddChild(m_TkhdAtom);
+ AddChild(mdia);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::AP4_TrakAtom
++---------------------------------------------------------------------*/
+AP4_TrakAtom::AP4_TrakAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_TRAK, size, false, stream, atom_factory),
+ m_HdlrAtom(NULL),
+ m_TkhdAtom(NULL)
+{
+ AP4_Atom* tkhd = FindChild("tkhd");
+ if (tkhd != NULL) {
+ m_TkhdAtom = dynamic_cast<AP4_TkhdAtom*>(tkhd);
+ } else {
+ m_TkhdAtom = NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::GetDuration
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_TrakAtom::GetDuration()
+{
+ if (m_TkhdAtom) {
+ return m_TkhdAtom->GetDuration();
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::SetDuration
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrakAtom::SetDuration(AP4_UI32 duration)
+{
+ if (m_TkhdAtom) {
+ return m_TkhdAtom->SetDuration(duration);
+ } else {
+ return AP4_FAILURE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::AdjustChunkOffsets
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrakAtom::AdjustChunkOffsets(AP4_Offset offset)
+{
+
+ AP4_Atom* atom = FindChild("mdia/minf/stbl/stco");
+ if (atom != NULL) {
+ AP4_StcoAtom* stco = dynamic_cast<AP4_StcoAtom*>(atom);
+ stco->AdjustChunkOffsets(offset);
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrakAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrakAtom.h
new file mode 100644
index 000000000..cd647c6e7
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrakAtom.h
@@ -0,0 +1,85 @@
+/*****************************************************************
+|
+| AP4 - trak Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TRAK_ATOM_H_
+#define _AP4_TRAK_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4TkhdAtom.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom
++---------------------------------------------------------------------*/
+class AP4_TrakAtom : public AP4_ContainerAtom
+{
+ public:
+ // methods
+ AP4_TrakAtom(AP4_SampleTable* sample_table,
+ AP4_Atom::Type hdlr_type,
+ const char* hdlr_name,
+ AP4_UI32 track_id,
+ AP4_UI32 creation_time,
+ AP4_UI32 modification_time,
+ AP4_UI32 track_duration,
+ AP4_UI32 media_time_scale,
+ AP4_UI32 media_duration,
+ AP4_UI16 volume,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 heigh);
+ AP4_TrakAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Result AdjustChunkOffsets(AP4_Offset offset);
+ AP4_UI32 GetId() {
+ return m_TkhdAtom->GetTrackId();
+ }
+ AP4_Result SetId(AP4_UI32 track_id) {
+ return m_TkhdAtom->SetTrackId(track_id);
+ }
+ AP4_UI32 GetDuration();
+ AP4_Result SetDuration(AP4_UI32 duration);
+ AP4_TkhdAtom* GetTkhdAtom() { return m_TkhdAtom; }
+ AP4_HdlrAtom* GetHdlrAtom() { return m_HdlrAtom; }
+
+ private:
+ // members
+ AP4_HdlrAtom* m_HdlrAtom;
+ AP4_TkhdAtom* m_TkhdAtom;
+};
+
+#endif // _AP4_TRAK_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrefTypeAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrefTypeAtom.cpp
new file mode 100644
index 000000000..504d08e34
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrefTypeAtom.cpp
@@ -0,0 +1,81 @@
+/*****************************************************************
+|
+| AP4 - tref type Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4TrefTypeAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrefTypeAtom::AP4_TrefTypeAtom
++---------------------------------------------------------------------*/
+AP4_TrefTypeAtom::AP4_TrefTypeAtom(AP4_Atom::Type type,
+ AP4_Size size,
+ AP4_ByteStream& stream) :
+ AP4_Atom(type, size, false, stream)
+{
+ AP4_Size data_size = size - 8; // size and atom type
+
+ // read the track ids
+ while (data_size != 0) {
+ AP4_UI32 track_id;
+ stream.ReadUI32(track_id);
+ m_TrackIds.Append(track_id);
+ data_size -= 4;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrefTypeAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrefTypeAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result = AP4_SUCCESS;
+
+ AP4_Size track_id_count = m_TrackIds.ItemCount();
+ for (AP4_Ordinal i=0; i<track_id_count; i++) {
+ result = stream.WriteUI32(m_TrackIds[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrefTypeAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrefTypeAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("track_id_count", m_TrackIds.ItemCount());
+ for (AP4_Ordinal i=0; i<m_TrackIds.ItemCount(); i++) {
+ inspector.AddField("track id ", m_TrackIds[i]);
+ }
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrefTypeAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrefTypeAtom.h
new file mode 100644
index 000000000..2c2f1412a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4TrefTypeAtom.h
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - tref type Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_TREF_TYPE_ATOM_H_
+#define _AP4_TREF_TYPE_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Array.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrefTypeAtom
++---------------------------------------------------------------------*/
+class AP4_TrefTypeAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_TrefTypeAtom(AP4_Atom::Type type, AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // accessors
+ const AP4_Array<AP4_UI32>& GetTrackIds() { return m_TrackIds; }
+
+ // members
+ AP4_Array<AP4_UI32> m_TrackIds;
+};
+
+#endif
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Types.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Types.h
new file mode 100644
index 000000000..dc7446e0f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Types.h
@@ -0,0 +1,63 @@
+/*****************************************************************
+|
+| AP4 - Shared Types
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TYPES_H_
+#define _AP4_TYPES_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Config.h"
+#if defined(AP4_CONFIG_HAVE_CPP_STRING_H)
+#include <string>
+#endif
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+typedef int AP4_Result;
+typedef unsigned long AP4_Flags;
+typedef unsigned long AP4_Mask;
+typedef unsigned long AP4_Size;
+typedef unsigned long AP4_Offset;
+typedef unsigned long AP4_Range;
+typedef unsigned long AP4_Cardinal;
+typedef unsigned long AP4_Ordinal;
+typedef unsigned long AP4_TimeStamp;
+typedef unsigned long AP4_Duration;
+typedef int AP4_Coordinate;
+typedef int AP4_Distance;
+typedef int AP4_Integer;
+typedef unsigned int AP4_UI32;
+typedef unsigned short AP4_UI16;
+typedef unsigned char AP4_UI08;
+typedef float AP4_Float;
+typedef std::string AP4_String;
+typedef unsigned char AP4_Byte;
+
+#endif // _AP4_TYPES_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UnknownDescriptor.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UnknownDescriptor.cpp
new file mode 100644
index 000000000..2b1c7414a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UnknownDescriptor.cpp
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - Unknown Descriptors
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4UnknownDescriptor.h"
+
+/*----------------------------------------------------------------------
+| AP4_UnknownDescriptor::AP4_UnknownDescriptor
++---------------------------------------------------------------------*/
+AP4_UnknownDescriptor::AP4_UnknownDescriptor(AP4_ByteStream& stream,
+ unsigned char tag,
+ AP4_Size header_size,
+ AP4_Size payload_size) :
+ AP4_Descriptor(tag, header_size, payload_size)
+{
+ m_Data.SetDataSize(payload_size);
+ stream.Read(m_Data.UseData(), payload_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_UnknownDescriptor::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_UnknownDescriptor::WriteFields(AP4_ByteStream& stream)
+{
+ // write the payload
+ stream.Write(m_Data.GetData(), m_Data.GetDataSize());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UnknownDescriptor.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UnknownDescriptor.h
new file mode 100644
index 000000000..60d5f5ae4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UnknownDescriptor.h
@@ -0,0 +1,60 @@
+/*****************************************************************
+|
+| AP4 - Unknown Descriptor
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_UNKNOWN_DESCRIPTOR_H_
+#define _AP4_UNKNOWN_DESCRIPTOR_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Descriptor.h"
+
+/*----------------------------------------------------------------------
+| AP4_UnknownDescriptor
++---------------------------------------------------------------------*/
+class AP4_UnknownDescriptor : public AP4_Descriptor
+{
+public:
+ // methods
+ AP4_UnknownDescriptor(AP4_ByteStream& stream,
+ unsigned char tag,
+ AP4_Size header_size,
+ AP4_Size payload_size);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_DataBuffer m_Data;
+};
+
+
+#endif // _AP4_UNKNOWN_DESCRIPTOR_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UrlAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UrlAtom.cpp
new file mode 100644
index 000000000..516126386
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UrlAtom.cpp
@@ -0,0 +1,99 @@
+/*****************************************************************
+|
+| AP4 - url Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4UrlAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom::AP4_UrlAtom
++---------------------------------------------------------------------*/
+AP4_UrlAtom::AP4_UrlAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_URL, AP4_FULL_ATOM_HEADER_SIZE, true)
+{
+ m_Flags = 1; // local ref
+}
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom::AP4_UrlAtom
++---------------------------------------------------------------------*/
+AP4_UrlAtom::AP4_UrlAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_URL, size, true, stream)
+{
+ if ((m_Flags & 1) == 0) {
+ // not self contained
+ AP4_Size str_size = size-AP4_FULL_ATOM_HEADER_SIZE;
+ if (str_size > 0) {
+ char* str = new char[str_size];
+ stream.Read(str, str_size);
+ str[str_size-1] = '\0'; // force null-termination
+ m_Url = str;
+ delete[] str;
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_UrlAtom::WriteFields(AP4_ByteStream& stream)
+{
+ if (m_Flags & 1) {
+ // local ref (self contained)
+ return AP4_SUCCESS;
+ } else {
+ // url (not self contained)
+ AP4_Result result = stream.Write(m_Url.c_str(), m_Url.length()+1);
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_FULL_ATOM_HEADER_SIZE+m_Url.length()+1);
+ while (padding--) stream.WriteUI08(0);
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_UrlAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ if (m_Flags & 1) {
+ inspector.AddField("location", "[local to file]");
+ } else {
+ inspector.AddField("location", m_Url.c_str());
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UrlAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UrlAtom.h
new file mode 100644
index 000000000..ee63e365e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4UrlAtom.h
@@ -0,0 +1,57 @@
+/*****************************************************************
+|
+| AP4 - url Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_URL_ATOM_H_
+#define _AP4_URL_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_UrlAtom
++---------------------------------------------------------------------*/
+class AP4_UrlAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_UrlAtom(); // local ref only (no URL string)
+ AP4_UrlAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ private:
+ // members
+ AP4_String m_Url;
+};
+
+#endif // _AP4_URL_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Utils.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Utils.cpp
new file mode 100644
index 000000000..c4295b6d1
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Utils.cpp
@@ -0,0 +1,302 @@
+/*****************************************************************
+|
+| AP4 - Utilities
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt32BE
++---------------------------------------------------------------------*/
+unsigned long
+AP4_BytesToUInt32BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned long)bytes[0])<<24 ) |
+ ( ((unsigned long)bytes[1])<<16 ) |
+ ( ((unsigned long)bytes[2])<<8 ) |
+ ( ((unsigned long)bytes[3]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt24BE
++---------------------------------------------------------------------*/
+unsigned long
+AP4_BytesToUInt24BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned long)bytes[0])<<16 ) |
+ ( ((unsigned long)bytes[1])<<8 ) |
+ ( ((unsigned long)bytes[2]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt16BE
++---------------------------------------------------------------------*/
+unsigned short
+AP4_BytesToUInt16BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned short)bytes[0])<<8 ) |
+ ( ((unsigned short)bytes[1]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt32BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt32BE(unsigned char* bytes, unsigned long value)
+{
+ bytes[0] = (unsigned char)(value >> 24);
+ bytes[1] = (unsigned char)(value >> 16);
+ bytes[2] = (unsigned char)(value >> 8);
+ bytes[3] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt24BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt24BE(unsigned char* bytes, unsigned long value)
+{
+ bytes[0] = (unsigned char)(value >> 16);
+ bytes[1] = (unsigned char)(value >> 8);
+ bytes[2] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt16BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt16BE(unsigned char* bytes, unsigned short value)
+{
+ bytes[0] = (unsigned char)(value >> 8);
+ bytes[1] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_MakePrefixString
++---------------------------------------------------------------------*/
+static void
+AP4_MakePrefixString(AP4_Offset indent, char* prefix, AP4_Size size)
+{
+ if (size == 0) return;
+ if (indent >= size-1) indent = size-1;
+ for (unsigned int i=0; i<indent; i++) {
+ prefix[i] = ' ';
+ }
+ prefix[indent] = '\0';
+}
+
+/*----------------------------------------------------------------------
+| AP4_DurationMsFromUnits
++---------------------------------------------------------------------*/
+unsigned long
+AP4_DurationMsFromUnits(unsigned long units, unsigned long units_per_second)
+{
+ if (units_per_second == 0) return 0;
+ return (unsigned long)(((float)units*1000.0f)/(float)units_per_second);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ConvertTime
++---------------------------------------------------------------------*/
+unsigned long
+AP4_ConvertTime(unsigned long time_value,
+ unsigned long from_time_scale,
+ unsigned long to_time_scale)
+{
+ if (from_time_scale == 0) return 0;
+ float ratio = (float)to_time_scale/(float)from_time_scale;
+ return ((unsigned long)((float)time_value*ratio));
+}
+
+/*----------------------------------------------------------------------
+| AP4_FormatFourChars
++---------------------------------------------------------------------*/
+void
+AP4_FormatFourChars(char* str, AP4_UI32 value) {
+ str[0] = (value >> 24) & 0xFF;
+ str[1] = (value >> 16) & 0xFF;
+ str[2] = (value >> 8) & 0xFF;
+ str[3] = (value ) & 0xFF;
+ str[4] = '\0';
+}
+
+/*----------------------------------------------------------------------
+| AP4_SplitArgs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1)
+{
+ arg0 = arg;
+ char* c = arg;
+ while (*c != 0 && *c != ':') {
+ c++;
+ }
+ if (*c == ':') {
+ *c++ = '\0';
+ arg1 = c;
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SplitArgs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1, char*& arg2)
+{
+ AP4_Result result = AP4_SplitArgs(arg, arg0, arg1);
+ if (AP4_FAILED(result)) return result;
+ return AP4_SplitArgs(arg1, arg1, arg2);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HexNibble
++---------------------------------------------------------------------*/
+static unsigned char
+AP4_HexNibble(char c)
+{
+ switch (c) {
+ case '0': return 0;
+ case '1': return 1;
+ case '2': return 2;
+ case '3': return 3;
+ case '4': return 4;
+ case '5': return 5;
+ case '6': return 6;
+ case '7': return 7;
+ case '8': return 8;
+ case '9': return 9;
+ case 'a': case 'A': return 10;
+ case 'b': case 'B': return 11;
+ case 'c': case 'C': return 12;
+ case 'd': case 'D': return 13;
+ case 'e': case 'E': return 14;
+ case 'f': case 'F': return 15;
+ default: return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_ParseHex
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ParseHex(const char* hex, unsigned char* bytes, unsigned int count)
+{
+ if (strlen(hex) != 2*count) return AP4_ERROR_INVALID_PARAMETERS;
+ for (unsigned int i=0; i<count; i++) {
+ bytes[i] = (AP4_HexNibble(hex[2*i]) << 4) | (AP4_HexNibble(hex[2*i+1]));
+ }
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::AP4_PrintInspector
++---------------------------------------------------------------------*/
+AP4_PrintInspector::AP4_PrintInspector(AP4_ByteStream& stream) :
+ m_Stream(&stream),
+ m_Indent(0)
+{
+ m_Stream->AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::~AP4_PrintInspector
++---------------------------------------------------------------------*/
+AP4_PrintInspector::~AP4_PrintInspector()
+{
+ m_Stream->Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::StartElement
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::StartElement(const char* name, const char* info)
+{
+ char prefix[256];
+ AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
+ m_Stream->WriteString(prefix);
+ m_Stream->WriteString(name);
+ if (info) {
+ m_Stream->Write(" ", 1);
+ m_Stream->WriteString(info);
+ }
+ m_Stream->Write("\n", 1);
+
+ m_Indent += 2;
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::EndElement
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::EndElement()
+{
+ m_Indent -= 2;
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::AddField
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::AddField(const char* name, const char* value, FormatHint hint)
+{
+ char prefix[256];
+ AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
+ m_Stream->WriteString(prefix);
+
+ m_Stream->WriteString(name);
+ m_Stream->WriteString(" = ");
+ m_Stream->WriteString(value);
+ m_Stream->Write("\n", 1);
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::AddField
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::AddField(const char* name, AP4_UI32 value, FormatHint hint)
+{
+ char prefix[256];
+ AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
+ m_Stream->WriteString(prefix);
+
+ char str[32];
+ AP4_StringFormat(str, sizeof(str), "%d", value);
+ m_Stream->WriteString(name);
+ m_Stream->WriteString(" = ");
+ m_Stream->WriteString(str);
+ m_Stream->Write("\n", 1);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Utils.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Utils.h
new file mode 100644
index 000000000..f7c07213b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4Utils.h
@@ -0,0 +1,101 @@
+/*****************************************************************
+|
+| AP4 - Utilities
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_UTILS_H_
+#define _AP4_UTILS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Config.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| MIN & MAX
++---------------------------------------------------------------------*/
+#define MIN(a,b) (a<b)?a:b
+#define MAX(a,b) (a>b)?a:b
+
+/*----------------------------------------------------------------------
+| byte I/O
++---------------------------------------------------------------------*/
+unsigned long AP4_BytesToUInt32BE(const unsigned char* bytes);
+unsigned long AP4_BytesToUInt24BE(const unsigned char* bytes);
+unsigned short AP4_BytesToUInt16BE(const unsigned char* bytes);
+void AP4_BytesFromUInt32BE(unsigned char* bytes, unsigned long value);
+void AP4_BytesFromUInt24BE(unsigned char* bytes, unsigned long value);
+void AP4_BytesFromUInt16BE(unsigned char* bytes, unsigned short value);
+unsigned long AP4_DurationMsFromUnits(unsigned long units,
+ unsigned long units_per_second);
+unsigned long AP4_ConvertTime(unsigned long time_value,
+ unsigned long from_time_scale,
+ unsigned long to_time_scale);
+
+/*----------------------------------------------------------------------
+| string utils
++---------------------------------------------------------------------*/
+#if defined (AP4_CONFIG_HAVE_STDIO_H)
+#include <stdio.h>
+#endif
+
+#if defined (AP4_CONFIG_HAVE_SNPRINTF)
+#define AP4_StringFormat snprintf
+#else
+int AP4_StringFormat(char* str, AP4_Size size, const char* format, ...);
+#endif
+
+void AP4_FormatFourChars(char* str, AP4_UI32 value);
+AP4_Result
+AP4_ParseHex(const char* hex, unsigned char* bytes, unsigned int count);
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1, char*& arg2);
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1);
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector
++---------------------------------------------------------------------*/
+class AP4_PrintInspector : public AP4_AtomInspector {
+public:
+ AP4_PrintInspector(AP4_ByteStream& stream);
+ ~AP4_PrintInspector();
+
+ // methods
+ void StartElement(const char* name, const char* info);
+ void EndElement();
+ void AddField(const char* name, AP4_UI32 value, FormatHint hint);
+ void AddField(const char* name, const char* value, FormatHint hint);
+
+private:
+ // members
+ AP4_ByteStream* m_Stream;
+ AP4_Cardinal m_Indent;
+};
+
+#endif // _AP4_UTILS_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4VmhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4VmhdAtom.cpp
new file mode 100644
index 000000000..fb0a5b032
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4VmhdAtom.cpp
@@ -0,0 +1,92 @@
+/*****************************************************************
+|
+| AP4 - vmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4VmhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom::AP4_VmhdAtom
++---------------------------------------------------------------------*/
+AP4_VmhdAtom::AP4_VmhdAtom(AP4_UI16 graphics_mode, AP4_UI16 r, AP4_UI16 g, AP4_UI16 b) :
+ AP4_Atom(AP4_ATOM_TYPE_VMHD, 8+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_GraphicsMode(graphics_mode)
+{
+ m_OpColor[0] = r;
+ m_OpColor[1] = g;
+ m_OpColor[2] = b;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom::AP4_VmhdAtom
++---------------------------------------------------------------------*/
+AP4_VmhdAtom::AP4_VmhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_VMHD, size, true, stream)
+{
+ stream.ReadUI16(m_GraphicsMode);
+ stream.Read(m_OpColor, sizeof(m_OpColor));
+}
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VmhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // graphics mode
+ result = stream.WriteUI16(m_GraphicsMode);
+ if (AP4_FAILED(result)) return result;
+
+ // op color
+ result = stream.Write(m_OpColor, sizeof(m_OpColor));
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VmhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("graphics_mode", m_GraphicsMode);
+ char formatted[16];
+ AP4_StringFormat(formatted, sizeof(formatted), "%04x,%04x,%04x",
+ m_OpColor[0], m_OpColor[1], m_OpColor[2]);
+ inspector.AddField("op_color", formatted);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4VmhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4VmhdAtom.h
new file mode 100644
index 000000000..43c8ea2d5
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Core/Ap4VmhdAtom.h
@@ -0,0 +1,58 @@
+/*****************************************************************
+|
+| AP4 - vmhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+****************************************************************/
+
+#ifndef _AP4_VMHD_ATOM_H_
+#define _AP4_VMHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_VmhdAtom
++---------------------------------------------------------------------*/
+class AP4_VmhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_VmhdAtom(AP4_UI16 graphics_mode, AP4_UI16 r, AP4_UI16 g, AP4_UI16 b);
+ AP4_VmhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_UI16 m_GraphicsMode;
+ AP4_UI16 m_OpColor[3];
+};
+
+#endif // _AP4_VMHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4AesBlockCipher.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4AesBlockCipher.cpp
new file mode 100644
index 000000000..23af1dd5d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4AesBlockCipher.cpp
@@ -0,0 +1,1837 @@
+/*
+* AES Block cipher
+* (c) 2005 Gilles Boccon-Gibod
+* Portions (c) 2001, Dr Brian Gladman (see below)
+*/
+
+/*
+-------------------------------------------------------------------------
+Copyright (c) 2001, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
+All rights reserved.
+
+LICENSE TERMS
+
+The free distribution and use of this software in both source and binary
+form is allowed (with or without changes) provided that:
+
+1. distributions of this source code include the above copyright
+notice, this list of conditions and the following disclaimer;
+
+2. distributions in binary form include the above copyright
+notice, this list of conditions and the following disclaimer
+in the documentation and/or other associated materials;
+
+3. the copyright holder's name is not used to endorse products
+built using this software without specific written permission.
+
+DISCLAIMER
+
+This software is provided 'as is' with no explicit or implied warranties
+in respect of its properties, including, but not limited to, correctness
+and fitness for purpose.
+-------------------------------------------------------------------------
+Issue Date: 29/07/2002
+*/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4AesBlockCipher.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| build options
++---------------------------------------------------------------------*/
+#define ENCRYPTION_KEY_SCHEDULE
+#define ENCRYPTION
+#define BLOCK_SIZE AP4_AES_BLOCK_SIZE
+
+/*----------------------------------------------------------------------
+| options
++---------------------------------------------------------------------*/
+/* START OF CONFIGURATION OPTIONS
+
+ USE OF DEFINES
+
+ Later in this section there are a number of defines that control the
+ operation of the code. In each section, the purpose of each define is
+ explained so that the relevant form can be included or excluded by
+ setting either 1's or 0's respectively on the branches of the related
+ #if clauses.
+*/
+
+/* 1. BYTE ORDER IN 32-BIT WORDS
+
+ To obtain the highest speed on processors with 32-bit words, this code
+ needs to determine the order in which bytes are packed into such words.
+ The following block of code is an attempt to capture the most obvious
+ ways in which various environemnts define byte order. It may well fail,
+ in which case the definitions will need to be set by editing at the
+ points marked **** EDIT HERE IF NECESSARY **** below.
+*/
+#define AES_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
+#define AES_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
+
+#if !defined(AP4_PLATFORM_BYTE_ORDER)
+# error AP4_PLATFORM_BYTE_ORDER is not set
+#endif
+
+#if AP4_PLATFORM_BYTE_ORDER == AP4_PLATFORM_BIG_ENDIAN
+#define PLATFORM_BYTE_ORDER AES_BIG_ENDIAN
+#elif AP4_PLATFORM_BYTE_ORDER == AP4_PLATFORM_LITTLE_ENDIAN
+#define PLATFORM_BYTE_ORDER AES_LITTLE_ENDIAN
+#else
+#error unsupported value for AP4_PLATFORM_BYTE_ORDER
+#endif
+
+
+
+/* 2. BYTE ORDER WITHIN 32 BIT WORDS
+
+ The fundamental data processing units in Rijndael are 8-bit bytes. The
+ input, output and key input are all enumerated arrays of bytes in which
+ bytes are numbered starting at zero and increasing to one less than the
+ number of bytes in the array in question. This enumeration is only used
+ for naming bytes and does not imply any adjacency or order relationship
+ from one byte to another. When these inputs and outputs are considered
+ as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to
+ byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte.
+ In this implementation bits are numbered from 0 to 7 starting at the
+ numerically least significant end of each byte (bit n represents 2^n).
+
+ However, Rijndael can be implemented more efficiently using 32-bit
+ words by packing bytes into words so that bytes 4*n to 4*n+3 are placed
+ into word[n]. While in principle these bytes can be assembled into words
+ in any positions, this implementation only supports the two formats in
+ which bytes in adjacent positions within words also have adjacent byte
+ numbers. This order is called big-endian if the lowest numbered bytes
+ in words have the highest numeric significance and little-endian if the
+ opposite applies.
+
+ This code can work in either order irrespective of the order used by the
+ machine on which it runs. Normally the internal byte order will be set
+ to the order of the processor on which the code is to be run but this
+ define can be used to reverse this in special situations
+*/
+#if 1
+#define INTERNAL_BYTE_ORDER PLATFORM_BYTE_ORDER
+#elif defined(AES_LITTLE_ENDIAN)
+#define INTERNAL_BYTE_ORDER AES_LITTLE_ENDIAN
+#elif defined(AES_BIG_ENDIAN)
+#define INTERNAL_BYTE_ORDER AES_BIG_ENDIAN
+#endif
+
+/* 3. FAST INPUT/OUTPUT OPERATIONS.
+
+ On some machines it is possible to improve speed by transferring the
+ bytes in the input and output arrays to and from the internal 32-bit
+ variables by addressing these arrays as if they are arrays of 32-bit
+ words. On some machines this will always be possible but there may
+ be a large performance penalty if the byte arrays are not aligned on
+ the normal word boundaries. On other machines this technique will
+ lead to memory access errors when such 32-bit word accesses are not
+ properly aligned. The option SAFE_IO avoids such problems but will
+ often be slower on those machines that support misaligned access
+ (especially so if care is taken to align the input and output byte
+ arrays on 32-bit word boundaries). If SAFE_IO is not defined it is
+ assumed that access to byte arrays as if they are arrays of 32-bit
+ words will not cause problems when such accesses are misaligned.
+*/
+#if 1
+#define SAFE_IO
+#endif
+
+/* 4. LOOP UNROLLING
+
+ The code for encryption and decrytpion cycles through a number of rounds
+ that can be implemented either in a loop or by expanding the code into a
+ long sequence of instructions, the latter producing a larger program but
+ one that will often be much faster. The latter is called loop unrolling.
+ There are also potential speed advantages in expanding two iterations in
+ a loop with half the number of iterations, which is called partial loop
+ unrolling. The following options allow partial or full loop unrolling
+ to be set independently for encryption and decryption
+*/
+#if 1
+#define ENC_UNROLL FULL
+#elif 0
+#define ENC_UNROLL PARTIAL
+#else
+#define ENC_UNROLL NONE
+#endif
+
+#if 1
+#define DEC_UNROLL FULL
+#elif 0
+#define DEC_UNROLL PARTIAL
+#else
+#define DEC_UNROLL NONE
+#endif
+
+/* 5. FIXED OR DYNAMIC TABLES
+
+ When this section is included the tables used by the code are comipled
+ statically into the binary file. Otherwise they are computed once when
+ the code is first used.
+*/
+#if 1
+#define FIXED_TABLES
+#endif
+
+/* 6. FAST FINITE FIELD OPERATIONS
+
+ If this section is included, tables are used to provide faster finite
+ field arithmetic (this has no effect if FIXED_TABLES is defined).
+*/
+#if 1
+#define FF_TABLES
+#endif
+
+/* 7. INTERNAL STATE VARIABLE FORMAT
+
+ The internal state of Rijndael is stored in a number of local 32-bit
+ word varaibles which can be defined either as an array or as individual
+ names variables. Include this section if you want to store these local
+ variables in arrays. Otherwise individual local variables will be used.
+*/
+#if 1
+#define ARRAYS
+#endif
+
+/* In this implementation the columns of the state array are each held in
+ 32-bit words. The state array can be held in various ways: in an array
+ of words, in a number of individual word variables or in a number of
+ processor registers. The following define maps a variable name x and
+ a column number c to the way the state array variable is to be held.
+ The first define below maps the state into an array x[c] whereas the
+ second form maps the state into a number of individual variables x0,
+ x1, etc. Another form could map individual state colums to machine
+ register names.
+*/
+
+#if defined(ARRAYS)
+#define s(x,c) x[c]
+#else
+#define s(x,c) x##c
+#endif
+
+/* 8. VARIABLE BLOCK SIZE SPEED
+
+ This section is only relevant if you wish to use the variable block
+ length feature of the code. Include this section if you place more
+ emphasis on speed rather than code size.
+*/
+#if 1
+#define FAST_VARIABLE
+#endif
+
+/* 9. INTERNAL TABLE CONFIGURATION
+
+ This cipher proceeds by repeating in a number of cycles known as 'rounds'
+ which are implemented by a round function which can optionally be speeded
+ up using tables. The basic tables are each 256 32-bit words, with either
+ one or four tables being required for each round function depending on
+ how much speed is required. The encryption and decryption round functions
+ are different and the last encryption and decrytpion round functions are
+ different again making four different round functions in all.
+
+ This means that:
+ 1. Normal encryption and decryption rounds can each use either 0, 1
+ or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
+ 2. The last encryption and decryption rounds can also use either 0, 1
+ or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
+
+ Include or exclude the appropriate definitions below to set the number
+ of tables used by this implementation.
+*/
+
+#if 1 /* set tables for the normal encryption round */
+#define ENC_ROUND FOUR_TABLES
+#elif 0
+#define ENC_ROUND ONE_TABLE
+#else
+#define ENC_ROUND NO_TABLES
+#endif
+
+#if 1 /* set tables for the last encryption round */
+#define LAST_ENC_ROUND FOUR_TABLES
+#elif 0
+#define LAST_ENC_ROUND ONE_TABLE
+#else
+#define LAST_ENC_ROUND NO_TABLES
+#endif
+
+#if 1 /* set tables for the normal decryption round */
+#define DEC_ROUND FOUR_TABLES
+#elif 0
+#define DEC_ROUND ONE_TABLE
+#else
+#define DEC_ROUND NO_TABLES
+#endif
+
+#if 1 /* set tables for the last decryption round */
+#define LAST_DEC_ROUND FOUR_TABLES
+#elif 0
+#define LAST_DEC_ROUND ONE_TABLE
+#else
+#define LAST_DEC_ROUND NO_TABLES
+#endif
+
+/* The decryption key schedule can be speeded up with tables in the same
+ way that the round functions can. Include or exclude the following
+ defines to set this requirement.
+*/
+#if 1
+#define KEY_SCHED FOUR_TABLES
+#elif 0
+#define KEY_SCHED ONE_TABLE
+#else
+#define KEY_SCHED NO_TABLES
+#endif
+
+/* END OF CONFIGURATION OPTIONS */
+
+#define NO_TABLES 0 /* DO NOT CHANGE */
+#define ONE_TABLE 1 /* DO NOT CHANGE */
+#define FOUR_TABLES 4 /* DO NOT CHANGE */
+#define NONE 0 /* DO NOT CHANGE */
+#define PARTIAL 1 /* DO NOT CHANGE */
+#define FULL 2 /* DO NOT CHANGE */
+
+#if defined(BLOCK_SIZE) && ((BLOCK_SIZE & 3) || BLOCK_SIZE < 16 || BLOCK_SIZE > 32)
+#error An illegal block size has been specified.
+#endif
+
+#if !defined(BLOCK_SIZE)
+#define RC_LENGTH 29
+#else
+#define RC_LENGTH 5 * BLOCK_SIZE / 4 - (BLOCK_SIZE == 16 ? 10 : 11)
+#endif
+
+/* Disable at least some poor combinations of options */
+
+#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES
+#undef LAST_ENC_ROUND
+#define LAST_ENC_ROUND NO_TABLES
+#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES
+#undef LAST_ENC_ROUND
+#define LAST_ENC_ROUND ONE_TABLE
+#endif
+
+#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE
+#undef ENC_UNROLL
+#define ENC_UNROLL NONE
+#endif
+
+#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES
+#undef LAST_DEC_ROUND
+#define LAST_DEC_ROUND NO_TABLES
+#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES
+#undef LAST_DEC_ROUND
+#define LAST_DEC_ROUND ONE_TABLE
+#endif
+
+#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE
+#undef DEC_UNROLL
+#define DEC_UNROLL NONE
+#endif
+
+/* upr(x,n): rotates bytes within words by n positions, moving bytes to
+ higher index positions with wrap around into low positions
+ ups(x,n): moves bytes by n positions to higher index positions in
+ words but without wrap around
+ bval(x,n): extracts a byte from a word
+
+ NOTE: The definitions given here are intended only for use with
+ unsigned variables and with shift counts that are compile
+ time constants
+*/
+
+#if (INTERNAL_BYTE_ORDER == AES_LITTLE_ENDIAN)
+#if defined(_MSC_VER)
+#define upr(x,n) _lrotl((aes_32t)(x), 8 * (n))
+#else
+#define upr(x,n) ((aes_32t)(x) << 8 * (n) | (aes_32t)(x) >> (32 - 8 * (n)))
+#endif
+#define ups(x,n) ((aes_32t)(x) << 8 * (n))
+#define bval(x,n) ((aes_08t)((x) >> 8 * (n)))
+#define bytes2word(b0, b1, b2, b3) \
+ (((aes_32t)(b3) << 24) | ((aes_32t)(b2) << 16) | ((aes_32t)(b1) << 8) | (b0))
+#endif
+
+#if (INTERNAL_BYTE_ORDER == AES_BIG_ENDIAN)
+#define upr(x,n) ((aes_32t)(x) >> 8 * (n) | (aes_32t)(x) << 32 - 8 * (n))
+#define ups(x,n) ((aes_32t)(x) >> 8 * (n)))
+#define bval(x,n) ((aes_08t)((x) >> (24 - 8 * (n))))
+#define bytes2word(b0, b1, b2, b3) \
+ (((aes_32t)(b0) << 24) | ((aes_32t)(b1) << 16) | ((aes_32t)(b2) << 8) | (b3))
+#endif
+
+#if defined(SAFE_IO)
+
+#define word_in(x) bytes2word((x)[0], (x)[1], (x)[2], (x)[3])
+#define word_out(x,v) { (x)[0] = bval(v,0); (x)[1] = bval(v,1); \
+ (x)[2] = bval(v,2); (x)[3] = bval(v,3); }
+
+#elif (INTERNAL_BYTE_ORDER == PLATFORM_BYTE_ORDER)
+
+#define word_in(x) *(aes_32t*)(x)
+#define word_out(x,v) *(aes_32t*)(x) = (v)
+
+#else
+
+#if !defined(bswap_32)
+#if !defined(_MSC_VER)
+#define _lrotl(x,n) ((((aes_32t)(x)) << n) | (((aes_32t)(x)) >> (32 - n)))
+#endif
+#define bswap_32(x) ((_lrotl((x),8) & 0x00ff00ff) | (_lrotl((x),24) & 0xff00ff00))
+#endif
+
+#define word_in(x) bswap_32(*(aes_32t*)(x))
+#define word_out(x,v) *(aes_32t*)(x) = bswap_32(v)
+
+#endif
+
+/* the finite field modular polynomial and elements */
+
+#define WPOLY 0x011b
+#define BPOLY 0x1b
+
+/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */
+
+#define m1 0x80808080
+#define m2 0x7f7f7f7f
+#define FFmulX(x) ((((x) & m2) << 1) ^ ((((x) & m1) >> 7) * BPOLY))
+
+/* The following defines provide alternative definitions of FFmulX that might
+ give improved performance if a fast 32-bit multiply is not available. Note
+ that a temporary variable u needs to be defined where FFmulX is used.
+
+#define FFmulX(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6))
+#define m4 (0x01010101 * BPOLY)
+#define FFmulX(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4)
+*/
+
+/* Work out which tables are needed for the different options */
+
+#ifdef AES_ASM
+#ifdef ENC_ROUND
+#undef ENC_ROUND
+#endif
+#define ENC_ROUND FOUR_TABLES
+#ifdef LAST_ENC_ROUND
+#undef LAST_ENC_ROUND
+#endif
+#define LAST_ENC_ROUND FOUR_TABLES
+#ifdef DEC_ROUND
+#undef DEC_ROUND
+#endif
+#define DEC_ROUND FOUR_TABLES
+#ifdef LAST_DEC_ROUND
+#undef LAST_DEC_ROUND
+#endif
+#define LAST_DEC_ROUND FOUR_TABLES
+#ifdef KEY_SCHED
+#undef KEY_SCHED
+#define KEY_SCHED FOUR_TABLES
+#endif
+#endif
+
+#if defined(ENCRYPTION) || defined(AES_ASM)
+#if ENC_ROUND == ONE_TABLE
+#define FT1_SET
+#elif ENC_ROUND == FOUR_TABLES
+#define FT4_SET
+#else
+#define SBX_SET
+#endif
+#if LAST_ENC_ROUND == ONE_TABLE
+#define FL1_SET
+#elif LAST_ENC_ROUND == FOUR_TABLES
+#define FL4_SET
+#elif !defined(SBX_SET)
+#define SBX_SET
+#endif
+#endif
+
+#if defined(DECRYPTION) || defined(AES_ASM)
+#if DEC_ROUND == ONE_TABLE
+#define IT1_SET
+#elif DEC_ROUND == FOUR_TABLES
+#define IT4_SET
+#else
+#define ISB_SET
+#endif
+#if LAST_DEC_ROUND == ONE_TABLE
+#define IL1_SET
+#elif LAST_DEC_ROUND == FOUR_TABLES
+#define IL4_SET
+#elif !defined(ISB_SET)
+#define ISB_SET
+#endif
+#endif
+
+#if defined(ENCRYPTION_KEY_SCHEDULE) || defined(DECRYPTION_KEY_SCHEDULE)
+#if KEY_SCHED == ONE_TABLE
+#define LS1_SET
+#define IM1_SET
+#elif KEY_SCHED == FOUR_TABLES
+#define LS4_SET
+#define IM4_SET
+#elif !defined(SBX_SET)
+#define SBX_SET
+#endif
+#endif
+
+#ifdef FIXED_TABLES
+#define prefx static const
+#else
+#define prefx extern
+extern aes_08t tab_init;
+void gen_tabs(void);
+#endif
+
+//prefx aes_32t rcon_tab[29];
+//
+//#ifdef SBX_SET
+//prefx aes_08t s_box[256];
+//#endif
+//
+//#ifdef ISB_SET
+//prefx aes_08t inv_s_box[256];
+//#endif
+//
+//#ifdef FT1_SET
+//prefx aes_32t ft_tab[256];
+//#endif
+//
+//#ifdef FT4_SET
+//prefx aes_32t ft_tab[4][256];
+//#endif
+//
+//#ifdef FL1_SET
+//prefx aes_32t fl_tab[256];
+//#endif
+//
+//#ifdef FL4_SET
+//prefx aes_32t fl_tab[4][256];
+//#endif
+//
+//#ifdef IT1_SET
+//prefx aes_32t it_tab[256];
+//#endif
+//
+//#ifdef IT4_SET
+//prefx aes_32t it_tab[4][256];
+//#endif
+//
+//#ifdef IL1_SET
+//prefx aes_32t il_tab[256];
+//#endif
+//
+//#ifdef IL4_SET
+//prefx aes_32t il_tab[4][256];
+//#endif
+//
+//#ifdef LS1_SET
+//#ifdef FL1_SET
+//#undef LS1_SET
+//#else
+//prefx aes_32t ls_tab[256];
+//#endif
+//#endif
+//
+//#ifdef LS4_SET
+//#ifdef FL4_SET
+//#undef LS4_SET
+//#else
+//prefx aes_32t ls_tab[4][256];
+//#endif
+//#endif
+//
+//#ifdef IM1_SET
+//prefx aes_32t im_tab[256];
+//#endif
+//
+//#ifdef IM4_SET
+//prefx aes_32t im_tab[4][256];
+//#endif
+
+/* Set the number of columns in nc. Note that it is important
+ that nc is a constant which is known at compile time if the
+ highest speed version of the code is needed.
+*/
+
+#if defined(BLOCK_SIZE)
+#define nc (BLOCK_SIZE >> 2)
+#else
+#define nc (cx->n_blk >> 2)
+#endif
+
+/* generic definitions of Rijndael macros that use tables */
+
+#define no_table(x,box,vf,rf,c) bytes2word( \
+ box[bval(vf(x,0,c),rf(0,c))], \
+ box[bval(vf(x,1,c),rf(1,c))], \
+ box[bval(vf(x,2,c),rf(2,c))], \
+ box[bval(vf(x,3,c),rf(3,c))])
+
+#define one_table(x,op,tab,vf,rf,c) \
+ ( tab[bval(vf(x,0,c),rf(0,c))] \
+ ^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \
+ ^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \
+ ^ op(tab[bval(vf(x,3,c),rf(3,c))],3))
+
+#define four_tables(x,tab,vf,rf,c) \
+ ( tab[0][bval(vf(x,0,c),rf(0,c))] \
+ ^ tab[1][bval(vf(x,1,c),rf(1,c))] \
+ ^ tab[2][bval(vf(x,2,c),rf(2,c))] \
+ ^ tab[3][bval(vf(x,3,c),rf(3,c))])
+
+#define vf1(x,r,c) (x)
+#define rf1(r,c) (r)
+#define rf2(r,c) ((r-c)&3)
+
+/* perform forward and inverse column mix operation on four bytes in long word x in */
+/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */
+
+#define dec_fmvars
+#if defined(FM4_SET) /* not currently used */
+#define fwd_mcol(x) four_tables(x,fm_tab,vf1,rf1,0)
+#elif defined(FM1_SET) /* not currently used */
+#define fwd_mcol(x) one_table(x,upr,fm_tab,vf1,rf1,0)
+#else
+#undef dec_fmvars
+#define dec_fmvars aes_32t f1, f2;
+#define fwd_mcol(x) (f1 = (x), f2 = FFmulX(f1), f2 ^ upr(f1 ^ f2, 3) ^ upr(f1, 2) ^ upr(f1, 1))
+#endif
+
+#define dec_imvars
+#if defined(IM4_SET)
+#define inv_mcol(x) four_tables(x,im_tab,vf1,rf1,0)
+#elif defined(IM1_SET)
+#define inv_mcol(x) one_table(x,upr,im_tab,vf1,rf1,0)
+#else
+#undef dec_imvars
+#define dec_imvars aes_32t f2, f4, f8, f9;
+#define inv_mcol(x) \
+ (f9 = (x), f2 = FFmulX(f9), f4 = FFmulX(f2), f8 = FFmulX(f4), f9 ^= f8, \
+ f2 ^= f4 ^ f8 ^ upr(f2 ^ f9,3) ^ upr(f4 ^ f9,2) ^ upr(f9,1))
+#endif
+
+#if defined(FL4_SET)
+#define ls_box(x,c) four_tables(x,fl_tab,vf1,rf2,c)
+#elif defined(LS4_SET)
+#define ls_box(x,c) four_tables(x,ls_tab,vf1,rf2,c)
+#elif defined(FL1_SET)
+#define ls_box(x,c) one_table(x,upr,fl_tab,vf1,rf2,c)
+#elif defined(LS1_SET)
+#define ls_box(x,c) one_table(x,upr,ls_tab,vf1,rf2,c)
+#else
+#define ls_box(x,c) no_table(x,s_box,vf1,rf2,c)
+#endif
+
+/*----------------------------------------------------------------------
+| tables
++---------------------------------------------------------------------*/
+#if defined(FIXED_TABLES) || !defined(FF_TABLES)
+
+/* finite field arithmetic operations */
+
+#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY))
+#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY))
+#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \
+ ^ (((x>>5) & 4) * WPOLY))
+#define f3(x) (f2(x) ^ x)
+#define f9(x) (f8(x) ^ x)
+#define fb(x) (f8(x) ^ f2(x) ^ x)
+#define fd(x) (f8(x) ^ f4(x) ^ x)
+#define fe(x) (f8(x) ^ f4(x) ^ f2(x))
+
+#endif
+
+#if defined(FIXED_TABLES)
+
+#define sb_data(w) \
+ w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\
+ w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\
+ w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\
+ w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\
+ w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\
+ w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\
+ w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\
+ w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\
+ w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\
+ w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\
+ w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\
+ w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\
+ w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\
+ w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\
+ w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\
+ w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\
+ w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\
+ w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\
+ w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\
+ w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\
+ w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\
+ w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\
+ w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\
+ w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\
+ w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\
+ w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\
+ w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\
+ w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\
+ w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\
+ w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\
+ w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\
+ w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16)
+
+#define isb_data(w) \
+ w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\
+ w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\
+ w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\
+ w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\
+ w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\
+ w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\
+ w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\
+ w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\
+ w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\
+ w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\
+ w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\
+ w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\
+ w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\
+ w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\
+ w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\
+ w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\
+ w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\
+ w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\
+ w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\
+ w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\
+ w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\
+ w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\
+ w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\
+ w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\
+ w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\
+ w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\
+ w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\
+ w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\
+ w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\
+ w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\
+ w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\
+ w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d),
+
+#define mm_data(w) \
+ w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\
+ w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\
+ w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\
+ w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\
+ w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\
+ w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\
+ w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\
+ w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\
+ w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\
+ w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\
+ w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\
+ w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\
+ w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\
+ w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\
+ w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\
+ w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\
+ w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\
+ w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\
+ w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\
+ w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\
+ w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\
+ w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\
+ w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\
+ w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\
+ w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\
+ w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\
+ w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\
+ w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\
+ w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\
+ w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\
+ w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\
+ w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff)
+
+#define h0(x) (x)
+
+/* These defines are used to ensure tables are generated in the
+ right format depending on the internal byte order required
+*/
+
+#define w0(p) bytes2word(p, 0, 0, 0)
+#define w1(p) bytes2word(0, p, 0, 0)
+#define w2(p) bytes2word(0, 0, p, 0)
+#define w3(p) bytes2word(0, 0, 0, p)
+
+/* Number of elements required in this table for different
+ block and key lengths is:
+
+ Rcon Table key length (bytes)
+ Length 16 20 24 28 32
+ ---------------------
+ block 16 | 10 9 8 7 7
+ length 20 | 14 11 10 9 9
+ (bytes) 24 | 19 15 12 11 11
+ 28 | 24 19 16 13 13
+ 32 | 29 23 19 17 14
+
+ this table can be a table of bytes if the key schedule
+ code is adjusted accordingly
+*/
+
+#define u0(p) bytes2word(f2(p), p, p, f3(p))
+#define u1(p) bytes2word(f3(p), f2(p), p, p)
+#define u2(p) bytes2word(p, f3(p), f2(p), p)
+#define u3(p) bytes2word(p, p, f3(p), f2(p))
+
+#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p))
+#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p))
+#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p))
+#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p))
+
+static const aes_32t rcon_tab[29] =
+{
+ w0(0x01), w0(0x02), w0(0x04), w0(0x08),
+ w0(0x10), w0(0x20), w0(0x40), w0(0x80),
+ w0(0x1b), w0(0x36), w0(0x6c), w0(0xd8),
+ w0(0xab), w0(0x4d), w0(0x9a), w0(0x2f),
+ w0(0x5e), w0(0xbc), w0(0x63), w0(0xc6),
+ w0(0x97), w0(0x35), w0(0x6a), w0(0xd4),
+ w0(0xb3), w0(0x7d), w0(0xfa), w0(0xef),
+ w0(0xc5)
+};
+
+#ifdef SBX_SET
+static const aes_08t s_box[256] = { sb_data(h0) };
+#endif
+#ifdef ISB_SET
+static const aes_08t inv_s_box[256] = { isb_data(h0) };
+#endif
+
+#ifdef FT1_SET
+static const aes_32t ft_tab[256] = { sb_data(u0) };
+#endif
+#ifdef FT4_SET
+static const aes_32t ft_tab[4][256] =
+ { { sb_data(u0) }, { sb_data(u1) }, { sb_data(u2) }, { sb_data(u3) } };
+#endif
+
+#ifdef FL1_SET
+static const aes_32t fl_tab[256] = { sb_data(w0) };
+#endif
+#ifdef FL4_SET
+static const aes_32t fl_tab[4][256] =
+ { { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
+#endif
+
+#ifdef IT1_SET
+static const aes_32t it_tab[256] = { isb_data(v0) };
+#endif
+#ifdef IT4_SET
+static const aes_32t it_tab[4][256] =
+ { { isb_data(v0) }, { isb_data(v1) }, { isb_data(v2) }, { isb_data(v3) } };
+#endif
+
+#ifdef IL1_SET
+static const aes_32t il_tab[256] = { isb_data(w0) };
+#endif
+#ifdef IL4_SET
+static const aes_32t il_tab[4][256] =
+ { { isb_data(w0) }, { isb_data(w1) }, { isb_data(w2) }, { isb_data(w3) } };
+#endif
+
+#ifdef LS1_SET
+static const aes_32t ls_tab[256] = { sb_data(w0) };
+#endif
+#ifdef LS4_SET
+static const aes_32t ls_tab[4][256] =
+ { { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
+#endif
+
+#ifdef IM1_SET
+static const aes_32t im_tab[256] = { mm_data(v0) };
+#endif
+#ifdef IM4_SET
+static const aes_32t im_tab[4][256] =
+ { { mm_data(v0) }, { mm_data(v1) }, { mm_data(v2) }, { mm_data(v3) } };
+#endif
+
+#else /* dynamic table generation */
+
+aes_08t tab_init = 0;
+
+#define const
+
+static aes_32t rcon_tab[RC_LENGTH];
+
+#ifdef SBX_SET
+aes_08t s_box[256];
+#endif
+#ifdef ISB_SET
+aes_08t inv_s_box[256];
+#endif
+
+#ifdef FT1_SET
+aes_32t ft_tab[256];
+#endif
+#ifdef FT4_SET
+aes_32t ft_tab[4][256];
+#endif
+
+#ifdef FL1_SET
+aes_32t fl_tab[256];
+#endif
+#ifdef FL4_SET
+aes_32t fl_tab[4][256];
+#endif
+
+#ifdef IT1_SET
+aes_32t it_tab[256];
+#endif
+#ifdef IT4_SET
+aes_32t it_tab[4][256];
+#endif
+
+#ifdef IL1_SET
+aes_32t il_tab[256];
+#endif
+#ifdef IL4_SET
+aes_32t il_tab[4][256];
+#endif
+
+#ifdef LS1_SET
+aes_32t ls_tab[256];
+#endif
+#ifdef LS4_SET
+aes_32t ls_tab[4][256];
+#endif
+
+#ifdef IM1_SET
+aes_32t im_tab[256];
+#endif
+#ifdef IM4_SET
+aes_32t im_tab[4][256];
+#endif
+
+#if !defined(FF_TABLES)
+
+/* Generate the tables for the dynamic table option
+
+ It will generally be sensible to use tables to compute finite
+ field multiplies and inverses but where memory is scarse this
+ code might sometimes be better. But it only has effect during
+ initialisation so its pretty unimportant in overall terms.
+*/
+
+/* return 2 ^ (n - 1) where n is the bit number of the highest bit
+ set in x with x in the range 1 < x < 0x00000200. This form is
+ used so that locals within fi can be bytes rather than words
+*/
+
+static aes_08t hibit(const aes_32t x)
+{ aes_08t r = (aes_08t)((x >> 1) | (x >> 2));
+
+ r |= (r >> 2);
+ r |= (r >> 4);
+ return (r + 1) >> 1;
+}
+
+/* return the inverse of the finite field element x */
+
+static aes_08t fi(const aes_08t x)
+{ aes_08t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0;
+
+ if(x < 2) return x;
+
+ for(;;)
+ {
+ if(!n1) return v1;
+
+ while(n2 >= n1)
+ {
+ n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2);
+ }
+
+ if(!n2) return v2;
+
+ while(n1 >= n2)
+ {
+ n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1);
+ }
+ }
+}
+
+#else
+
+/* define the finite field multiplies required for Rijndael */
+
+#define f2(x) ((x) ? pow[log[x] + 0x19] : 0)
+#define f3(x) ((x) ? pow[log[x] + 0x01] : 0)
+#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0)
+#define fb(x) ((x) ? pow[log[x] + 0x68] : 0)
+#define fd(x) ((x) ? pow[log[x] + 0xee] : 0)
+#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0)
+#define fi(x) ((x) ? pow[255 - log[x]]: 0)
+
+#endif
+
+/* The forward and inverse affine transformations used in the S-box */
+
+#define fwd_affine(x) \
+ (w = (aes_32t)x, w ^= (w<<1)^(w<<2)^(w<<3)^(w<<4), 0x63^(aes_08t)(w^(w>>8)))
+
+#define inv_affine(x) \
+ (w = (aes_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(aes_08t)(w^(w>>8)))
+
+void gen_tabs(void)
+{ aes_32t i, w;
+
+#if defined(FF_TABLES)
+
+ aes_08t pow[512], log[256];
+
+ /* log and power tables for GF(2^8) finite field with
+ WPOLY as modular polynomial - the simplest primitive
+ root is 0x03, used here to generate the tables
+ */
+
+ i = 0; w = 1;
+ do
+ {
+ pow[i] = (aes_08t)w;
+ pow[i + 255] = (aes_08t)w;
+ log[w] = (aes_08t)i++;
+ w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0);
+ }
+ while (w != 1);
+
+#endif
+
+ for(i = 0, w = 1; i < RC_LENGTH; ++i)
+ {
+ rcon_tab[i] = bytes2word(w, 0, 0, 0);
+ w = f2(w);
+ }
+
+ for(i = 0; i < 256; ++i)
+ { aes_08t b;
+
+ b = fwd_affine(fi((aes_08t)i));
+ w = bytes2word(f2(b), b, b, f3(b));
+
+#ifdef SBX_SET
+ s_box[i] = b;
+#endif
+
+#ifdef FT1_SET /* tables for a normal encryption round */
+ ft_tab[i] = w;
+#endif
+#ifdef FT4_SET
+ ft_tab[0][i] = w;
+ ft_tab[1][i] = upr(w,1);
+ ft_tab[2][i] = upr(w,2);
+ ft_tab[3][i] = upr(w,3);
+#endif
+ w = bytes2word(b, 0, 0, 0);
+
+#ifdef FL1_SET /* tables for last encryption round (may also */
+ fl_tab[i] = w; /* be used in the key schedule) */
+#endif
+#ifdef FL4_SET
+ fl_tab[0][i] = w;
+ fl_tab[1][i] = upr(w,1);
+ fl_tab[2][i] = upr(w,2);
+ fl_tab[3][i] = upr(w,3);
+#endif
+
+#ifdef LS1_SET /* table for key schedule if fl_tab above is */
+ ls_tab[i] = w; /* not of the required form */
+#endif
+#ifdef LS4_SET
+ ls_tab[0][i] = w;
+ ls_tab[1][i] = upr(w,1);
+ ls_tab[2][i] = upr(w,2);
+ ls_tab[3][i] = upr(w,3);
+#endif
+
+ b = fi(inv_affine((aes_08t)i));
+ w = bytes2word(fe(b), f9(b), fd(b), fb(b));
+
+#ifdef IM1_SET /* tables for the inverse mix column operation */
+ im_tab[b] = w;
+#endif
+#ifdef IM4_SET
+ im_tab[0][b] = w;
+ im_tab[1][b] = upr(w,1);
+ im_tab[2][b] = upr(w,2);
+ im_tab[3][b] = upr(w,3);
+#endif
+
+#ifdef ISB_SET
+ inv_s_box[i] = b;
+#endif
+#ifdef IT1_SET /* tables for a normal decryption round */
+ it_tab[i] = w;
+#endif
+#ifdef IT4_SET
+ it_tab[0][i] = w;
+ it_tab[1][i] = upr(w,1);
+ it_tab[2][i] = upr(w,2);
+ it_tab[3][i] = upr(w,3);
+#endif
+ w = bytes2word(b, 0, 0, 0);
+#ifdef IL1_SET /* tables for last decryption round */
+ il_tab[i] = w;
+#endif
+#ifdef IL4_SET
+ il_tab[0][i] = w;
+ il_tab[1][i] = upr(w,1);
+ il_tab[2][i] = upr(w,2);
+ il_tab[3][i] = upr(w,3);
+#endif
+ }
+
+ tab_init = 1;
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| key schedule
++---------------------------------------------------------------------*/
+#if !defined(BLOCK_SIZE)
+
+static aes_rval aes_blk_len(unsigned int blen, aes_ctx cx[1])
+{
+#if !defined(FIXED_TABLES)
+ if(!tab_init) gen_tabs();
+#endif
+
+ if((blen & 7) || blen < 16 || blen > 32)
+ {
+ cx->n_blk = 0; return aes_bad;
+ }
+
+ cx->n_blk = blen;
+ return aes_good;
+}
+
+#endif
+
+/* Initialise the key schedule from the user supplied key. The key
+ length is now specified in bytes - 16, 24 or 32 as appropriate.
+ This corresponds to bit lengths of 128, 192 and 256 bits, and
+ to Nk values of 4, 6 and 8 respectively.
+
+ The following macros implement a single cycle in the key
+ schedule generation process. The number of cycles needed
+ for each cx->n_col and nk value is:
+
+ nk = 4 5 6 7 8
+ ------------------------------
+ cx->n_col = 4 10 9 8 7 7
+ cx->n_col = 5 14 11 10 9 9
+ cx->n_col = 6 19 15 12 11 11
+ cx->n_col = 7 21 19 16 13 14
+ cx->n_col = 8 29 23 19 17 14
+*/
+
+#define ke4(k,i) \
+{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
+ k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
+}
+#define kel4(k,i) \
+{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
+ k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
+}
+
+#define ke6(k,i) \
+{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
+ k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
+ k[6*(i)+10] = ss[4] ^= ss[3]; k[6*(i)+11] = ss[5] ^= ss[4]; \
+}
+#define kel6(k,i) \
+{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
+ k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
+}
+
+#define ke8(k,i) \
+{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
+ k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
+ k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); k[8*(i)+13] = ss[5] ^= ss[4]; \
+ k[8*(i)+14] = ss[6] ^= ss[5]; k[8*(i)+15] = ss[7] ^= ss[6]; \
+}
+#define kel8(k,i) \
+{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
+ k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
+}
+
+#if defined(ENCRYPTION_KEY_SCHEDULE)
+
+static aes_rval aes_enc_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
+{ aes_32t ss[8];
+
+#if !defined(FIXED_TABLES)
+ if(!tab_init) gen_tabs();
+#endif
+
+#if !defined(BLOCK_SIZE)
+ if(!cx->n_blk) cx->n_blk = 16;
+#else
+ cx->n_blk = BLOCK_SIZE;
+#endif
+
+ cx->n_blk = (cx->n_blk & ~3) | 1;
+
+ cx->k_sch[0] = ss[0] = word_in(in_key );
+ cx->k_sch[1] = ss[1] = word_in(in_key + 4);
+ cx->k_sch[2] = ss[2] = word_in(in_key + 8);
+ cx->k_sch[3] = ss[3] = word_in(in_key + 12);
+
+#if (BLOCK_SIZE == 16) && (ENC_UNROLL != NONE)
+
+ switch(klen)
+ {
+ case 16: ke4(cx->k_sch, 0); ke4(cx->k_sch, 1);
+ ke4(cx->k_sch, 2); ke4(cx->k_sch, 3);
+ ke4(cx->k_sch, 4); ke4(cx->k_sch, 5);
+ ke4(cx->k_sch, 6); ke4(cx->k_sch, 7);
+ ke4(cx->k_sch, 8); kel4(cx->k_sch, 9);
+ cx->n_rnd = 10; break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ ke6(cx->k_sch, 0); ke6(cx->k_sch, 1);
+ ke6(cx->k_sch, 2); ke6(cx->k_sch, 3);
+ ke6(cx->k_sch, 4); ke6(cx->k_sch, 5);
+ ke6(cx->k_sch, 6); kel6(cx->k_sch, 7);
+ cx->n_rnd = 12; break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ ke8(cx->k_sch, 0); ke8(cx->k_sch, 1);
+ ke8(cx->k_sch, 2); ke8(cx->k_sch, 3);
+ ke8(cx->k_sch, 4); ke8(cx->k_sch, 5);
+ kel8(cx->k_sch, 6);
+ cx->n_rnd = 14; break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+#else
+ { aes_32t i, l;
+ cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
+ l = (nc * cx->n_rnd + nc - 1) / (klen >> 2);
+
+ switch(klen)
+ {
+ case 16: for(i = 0; i < l; ++i)
+ ke4(cx->k_sch, i);
+ break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ for(i = 0; i < l; ++i)
+ ke6(cx->k_sch, i);
+ break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ for(i = 0; i < l; ++i)
+ ke8(cx->k_sch, i);
+ break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+ }
+#endif
+
+ return aes_good;
+}
+
+#endif
+
+#if defined(DECRYPTION_KEY_SCHEDULE)
+
+#if (DEC_ROUND != NO_TABLES)
+#define d_vars dec_imvars
+#define ff(x) inv_mcol(x)
+#else
+#define ff(x) (x)
+#define d_vars
+#endif
+
+#if 1
+#define kdf4(k,i) \
+{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; ss[1] = ss[1] ^ ss[3]; ss[2] = ss[2] ^ ss[3]; ss[3] = ss[3]; \
+ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ rcon_tab[i]; ss[i % 4] ^= ss[4]; \
+ ss[4] ^= k[4*(i)]; k[4*(i)+4] = ff(ss[4]); ss[4] ^= k[4*(i)+1]; k[4*(i)+5] = ff(ss[4]); \
+ ss[4] ^= k[4*(i)+2]; k[4*(i)+6] = ff(ss[4]); ss[4] ^= k[4*(i)+3]; k[4*(i)+7] = ff(ss[4]); \
+}
+#define kd4(k,i) \
+{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ rcon_tab[i]; ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \
+ k[4*(i)+4] = ss[4] ^= k[4*(i)]; k[4*(i)+5] = ss[4] ^= k[4*(i)+1]; \
+ k[4*(i)+6] = ss[4] ^= k[4*(i)+2]; k[4*(i)+7] = ss[4] ^= k[4*(i)+3]; \
+}
+#define kdl4(k,i) \
+{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ rcon_tab[i]; ss[i % 4] ^= ss[4]; \
+ k[4*(i)+4] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; k[4*(i)+5] = ss[1] ^ ss[3]; \
+ k[4*(i)+6] = ss[0]; k[4*(i)+7] = ss[1]; \
+}
+#else
+#define kdf4(k,i) \
+{ ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+ 4] = ff(ss[0]); ss[1] ^= ss[0]; k[4*(i)+ 5] = ff(ss[1]); \
+ ss[2] ^= ss[1]; k[4*(i)+ 6] = ff(ss[2]); ss[3] ^= ss[2]; k[4*(i)+ 7] = ff(ss[3]); \
+}
+#define kd4(k,i) \
+{ ss[4] = ls_box(ss[3],3) ^ rcon_tab[i]; \
+ ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[4*(i)+ 4] = ss[4] ^= k[4*(i)]; \
+ ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[4] ^= k[4*(i)+ 1]; \
+ ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[4] ^= k[4*(i)+ 2]; \
+ ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[4] ^= k[4*(i)+ 3]; \
+}
+#define kdl4(k,i) \
+{ ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+ 4] = ss[0]; ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[1]; \
+ ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[2]; ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[3]; \
+}
+#endif
+
+#define kdf6(k,i) \
+{ ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 6] = ff(ss[0]); ss[1] ^= ss[0]; k[6*(i)+ 7] = ff(ss[1]); \
+ ss[2] ^= ss[1]; k[6*(i)+ 8] = ff(ss[2]); ss[3] ^= ss[2]; k[6*(i)+ 9] = ff(ss[3]); \
+ ss[4] ^= ss[3]; k[6*(i)+10] = ff(ss[4]); ss[5] ^= ss[4]; k[6*(i)+11] = ff(ss[5]); \
+}
+#define kd6(k,i) \
+{ ss[6] = ls_box(ss[5],3) ^ rcon_tab[i]; \
+ ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[6*(i)+ 6] = ss[6] ^= k[6*(i)]; \
+ ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[6] ^= k[6*(i)+ 1]; \
+ ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[6] ^= k[6*(i)+ 2]; \
+ ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[6] ^= k[6*(i)+ 3]; \
+ ss[4] ^= ss[3]; k[6*(i)+10] = ss[6] ^= k[6*(i)+ 4]; \
+ ss[5] ^= ss[4]; k[6*(i)+11] = ss[6] ^= k[6*(i)+ 5]; \
+}
+#define kdl6(k,i) \
+{ ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 6] = ss[0]; ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[1]; \
+ ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[2]; ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[3]; \
+}
+
+#define kdf8(k,i) \
+{ ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 8] = ff(ss[0]); ss[1] ^= ss[0]; k[8*(i)+ 9] = ff(ss[1]); \
+ ss[2] ^= ss[1]; k[8*(i)+10] = ff(ss[2]); ss[3] ^= ss[2]; k[8*(i)+11] = ff(ss[3]); \
+ ss[4] ^= ls_box(ss[3],0); k[8*(i)+12] = ff(ss[4]); ss[5] ^= ss[4]; k[8*(i)+13] = ff(ss[5]); \
+ ss[6] ^= ss[5]; k[8*(i)+14] = ff(ss[6]); ss[7] ^= ss[6]; k[8*(i)+15] = ff(ss[7]); \
+}
+#define kd8(k,i) \
+{ aes_32t g = ls_box(ss[7],3) ^ rcon_tab[i]; \
+ ss[0] ^= g; g = ff(g); k[8*(i)+ 8] = g ^= k[8*(i)]; \
+ ss[1] ^= ss[0]; k[8*(i)+ 9] = g ^= k[8*(i)+ 1]; \
+ ss[2] ^= ss[1]; k[8*(i)+10] = g ^= k[8*(i)+ 2]; \
+ ss[3] ^= ss[2]; k[8*(i)+11] = g ^= k[8*(i)+ 3]; \
+ g = ls_box(ss[3],0); \
+ ss[4] ^= g; g = ff(g); k[8*(i)+12] = g ^= k[8*(i)+ 4]; \
+ ss[5] ^= ss[4]; k[8*(i)+13] = g ^= k[8*(i)+ 5]; \
+ ss[6] ^= ss[5]; k[8*(i)+14] = g ^= k[8*(i)+ 6]; \
+ ss[7] ^= ss[6]; k[8*(i)+15] = g ^= k[8*(i)+ 7]; \
+}
+#define kdl8(k,i) \
+{ ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 8] = ss[0]; ss[1] ^= ss[0]; k[8*(i)+ 9] = ss[1]; \
+ ss[2] ^= ss[1]; k[8*(i)+10] = ss[2]; ss[3] ^= ss[2]; k[8*(i)+11] = ss[3]; \
+}
+
+static aes_rval aes_dec_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
+{ aes_32t ss[8];
+ d_vars
+
+#if !defined(FIXED_TABLES)
+ if(!tab_init) gen_tabs();
+#endif
+
+#if !defined(BLOCK_SIZE)
+ if(!cx->n_blk) cx->n_blk = 16;
+#else
+ cx->n_blk = BLOCK_SIZE;
+#endif
+
+ cx->n_blk = (cx->n_blk & ~3) | 2;
+
+ cx->k_sch[0] = ss[0] = word_in(in_key );
+ cx->k_sch[1] = ss[1] = word_in(in_key + 4);
+ cx->k_sch[2] = ss[2] = word_in(in_key + 8);
+ cx->k_sch[3] = ss[3] = word_in(in_key + 12);
+
+#if (BLOCK_SIZE == 16) && (DEC_UNROLL != NONE)
+
+ switch(klen)
+ {
+ case 16: kdf4(cx->k_sch, 0); kd4(cx->k_sch, 1);
+ kd4(cx->k_sch, 2); kd4(cx->k_sch, 3);
+ kd4(cx->k_sch, 4); kd4(cx->k_sch, 5);
+ kd4(cx->k_sch, 6); kd4(cx->k_sch, 7);
+ kd4(cx->k_sch, 8); kdl4(cx->k_sch, 9);
+ cx->n_rnd = 10; break;
+ case 24: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
+ cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
+ kdf6(cx->k_sch, 0); kd6(cx->k_sch, 1);
+ kd6(cx->k_sch, 2); kd6(cx->k_sch, 3);
+ kd6(cx->k_sch, 4); kd6(cx->k_sch, 5);
+ kd6(cx->k_sch, 6); kdl6(cx->k_sch, 7);
+ cx->n_rnd = 12; break;
+ case 32: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
+ cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
+ cx->k_sch[6] = ff(ss[6] = word_in(in_key + 24));
+ cx->k_sch[7] = ff(ss[7] = word_in(in_key + 28));
+ kdf8(cx->k_sch, 0); kd8(cx->k_sch, 1);
+ kd8(cx->k_sch, 2); kd8(cx->k_sch, 3);
+ kd8(cx->k_sch, 4); kd8(cx->k_sch, 5);
+ kdl8(cx->k_sch, 6);
+ cx->n_rnd = 14; break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+#else
+ { aes_32t i, l;
+ cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
+ l = (nc * cx->n_rnd + nc - 1) / (klen >> 2);
+
+ switch(klen)
+ {
+ case 16:
+ for(i = 0; i < l; ++i)
+ ke4(cx->k_sch, i);
+ break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ for(i = 0; i < l; ++i)
+ ke6(cx->k_sch, i);
+ break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ for(i = 0; i < l; ++i)
+ ke8(cx->k_sch, i);
+ break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+#if (DEC_ROUND != NO_TABLES)
+ for(i = nc; i < nc * cx->n_rnd; ++i)
+ cx->k_sch[i] = inv_mcol(cx->k_sch[i]);
+#endif
+ }
+#endif
+
+ return aes_good;
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| cipher
++---------------------------------------------------------------------*/
+#define unused 77 /* Sunset Strip */
+
+#define si(y,x,k,c) s(y,c) = word_in(x + 4 * c) ^ k[c]
+#define so(y,x,c) word_out(y + 4 * c, s(x,c))
+
+#if BLOCK_SIZE == 16
+
+#if defined(ARRAYS)
+#define locals(y,x) x[4],y[4]
+#else
+#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3
+ /*
+ the following defines prevent the compiler requiring the declaration
+ of generated but unused variables in the fwd_var and inv_var macros
+ */
+#define b04 unused
+#define b05 unused
+#define b06 unused
+#define b07 unused
+#define b14 unused
+#define b15 unused
+#define b16 unused
+#define b17 unused
+#endif
+#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
+ s(y,2) = s(x,2); s(y,3) = s(x,3);
+#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3)
+#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3)
+#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3)
+
+#elif BLOCK_SIZE == 24
+
+#if defined(ARRAYS)
+#define locals(y,x) x[6],y[6]
+#else
+#define locals(y,x) x##0,x##1,x##2,x##3,x##4,x##5, \
+ y##0,y##1,y##2,y##3,y##4,y##5
+#define b06 unused
+#define b07 unused
+#define b16 unused
+#define b17 unused
+#endif
+#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
+ s(y,2) = s(x,2); s(y,3) = s(x,3); \
+ s(y,4) = s(x,4); s(y,5) = s(x,5);
+#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); \
+ si(y,x,k,3); si(y,x,k,4); si(y,x,k,5)
+#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); \
+ so(y,x,3); so(y,x,4); so(y,x,5)
+#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); \
+ rm(y,x,k,3); rm(y,x,k,4); rm(y,x,k,5)
+#else
+
+#if defined(ARRAYS)
+#define locals(y,x) x[8],y[8]
+#else
+#define locals(y,x) x##0,x##1,x##2,x##3,x##4,x##5,x##6,x##7, \
+ y##0,y##1,y##2,y##3,y##4,y##5,y##6,y##7
+#endif
+#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
+ s(y,2) = s(x,2); s(y,3) = s(x,3); \
+ s(y,4) = s(x,4); s(y,5) = s(x,5); \
+ s(y,6) = s(x,6); s(y,7) = s(x,7);
+
+#if BLOCK_SIZE == 32
+
+#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3); \
+ si(y,x,k,4); si(y,x,k,5); si(y,x,k,6); si(y,x,k,7)
+#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3); \
+ so(y,x,4); so(y,x,5); so(y,x,6); so(y,x,7)
+#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3); \
+ rm(y,x,k,4); rm(y,x,k,5); rm(y,x,k,6); rm(y,x,k,7)
+#else
+
+#define state_in(y,x,k) \
+switch(nc) \
+{ case 8: si(y,x,k,7); si(y,x,k,6); \
+ case 6: si(y,x,k,5); si(y,x,k,4); \
+ case 4: si(y,x,k,3); si(y,x,k,2); \
+ si(y,x,k,1); si(y,x,k,0); \
+}
+
+#define state_out(y,x) \
+switch(nc) \
+{ case 8: so(y,x,7); so(y,x,6); \
+ case 6: so(y,x,5); so(y,x,4); \
+ case 4: so(y,x,3); so(y,x,2); \
+ so(y,x,1); so(y,x,0); \
+}
+
+#if defined(FAST_VARIABLE)
+
+#define round(rm,y,x,k) \
+switch(nc) \
+{ case 8: rm(y,x,k,7); rm(y,x,k,6); \
+ rm(y,x,k,5); rm(y,x,k,4); \
+ rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+ break; \
+ case 6: rm(y,x,k,5); rm(y,x,k,4); \
+ rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+ break; \
+ case 4: rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+ break; \
+}
+#else
+
+#define round(rm,y,x,k) \
+switch(nc) \
+{ case 8: rm(y,x,k,7); rm(y,x,k,6); \
+ case 6: rm(y,x,k,5); rm(y,x,k,4); \
+ case 4: rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+}
+
+#endif
+
+#endif
+#endif
+
+#if defined(ENCRYPTION)
+
+/* I am grateful to Frank Yellin for the following construction
+ (and that for decryption) which, given the column (c) of the
+ output state variable, gives the input state variables which
+ are needed in its computation for each row (r) of the state.
+
+ For the fixed block size options, compilers should be able to
+ reduce this complex expression (and the equivalent one for
+ decryption) to a static variable reference at compile time.
+ But for variable block size code, there will be some limbs on
+ which conditional clauses will be returned.
+*/
+
+/* y = output word, x = input word, r = row, c = column for r = 0,
+ 1, 2 and 3 = column accessed for row r.
+*/
+
+#define fwd_var(x,r,c)\
+ ( r == 0 ? \
+ ( c == 0 ? s(x,0) \
+ : c == 1 ? s(x,1) \
+ : c == 2 ? s(x,2) \
+ : c == 3 ? s(x,3) \
+ : c == 4 ? s(x,4) \
+ : c == 5 ? s(x,5) \
+ : c == 6 ? s(x,6) \
+ : s(x,7))\
+ : r == 1 ? \
+ ( c == 0 ? s(x,1) \
+ : c == 1 ? s(x,2) \
+ : c == 2 ? s(x,3) \
+ : c == 3 ? nc == 4 ? s(x,0) : s(x,4) \
+ : c == 4 ? s(x,5) \
+ : c == 5 ? nc == 8 ? s(x,6) : s(x,0) \
+ : c == 6 ? s(x,7) \
+ : s(x,0))\
+ : r == 2 ? \
+ ( c == 0 ? nc == 8 ? s(x,3) : s(x,2) \
+ : c == 1 ? nc == 8 ? s(x,4) : s(x,3) \
+ : c == 2 ? nc == 4 ? s(x,0) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 3 ? nc == 4 ? s(x,1) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 4 ? nc == 8 ? s(x,7) : s(x,0) \
+ : c == 5 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 6 ? s(x,1) \
+ : s(x,2))\
+ : \
+ ( c == 0 ? nc == 8 ? s(x,4) : s(x,3) \
+ : c == 1 ? nc == 4 ? s(x,0) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 2 ? nc == 4 ? s(x,1) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 3 ? nc == 4 ? s(x,2) : nc == 8 ? s(x,7) : s(x,0) \
+ : c == 4 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 5 ? nc == 8 ? s(x,1) : s(x,2) \
+ : c == 6 ? s(x,2) \
+ : s(x,3)))
+
+#if defined(FT4_SET)
+#undef dec_fmvars
+#define dec_fmvars
+#define fwd_rnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,ft_tab,fwd_var,rf1,c)
+#elif defined(FT1_SET)
+#undef dec_fmvars
+#define dec_fmvars
+#define fwd_rnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,upr,ft_tab,fwd_var,rf1,c)
+#else
+#define fwd_rnd(y,x,k,c) s(y,c) = fwd_mcol(no_table(x,s_box,fwd_var,rf1,c)) ^ (k)[c]
+#endif
+
+#if defined(FL4_SET)
+#define fwd_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,fl_tab,fwd_var,rf1,c)
+#elif defined(FL1_SET)
+#define fwd_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,ups,fl_tab,fwd_var,rf1,c)
+#else
+#define fwd_lrnd(y,x,k,c) s(y,c) = no_table(x,s_box,fwd_var,rf1,c) ^ (k)[c]
+#endif
+
+static aes_rval aes_enc_blk(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1])
+{ aes_32t locals(b0, b1);
+ const aes_32t *kp = cx->k_sch;
+ dec_fmvars /* declare variables for fwd_mcol() if needed */
+
+ if(!(cx->n_blk & 1)) return aes_bad;
+
+ state_in(b0, in_blk, kp);
+
+#if (ENC_UNROLL == FULL)
+
+ kp += (cx->n_rnd - 9) * nc;
+
+ switch(cx->n_rnd)
+ {
+ case 14: round(fwd_rnd, b1, b0, kp - 4 * nc);
+ round(fwd_rnd, b0, b1, kp - 3 * nc);
+ case 12: round(fwd_rnd, b1, b0, kp - 2 * nc);
+ round(fwd_rnd, b0, b1, kp - nc);
+ case 10: round(fwd_rnd, b1, b0, kp );
+ round(fwd_rnd, b0, b1, kp + nc);
+ round(fwd_rnd, b1, b0, kp + 2 * nc);
+ round(fwd_rnd, b0, b1, kp + 3 * nc);
+ round(fwd_rnd, b1, b0, kp + 4 * nc);
+ round(fwd_rnd, b0, b1, kp + 5 * nc);
+ round(fwd_rnd, b1, b0, kp + 6 * nc);
+ round(fwd_rnd, b0, b1, kp + 7 * nc);
+ round(fwd_rnd, b1, b0, kp + 8 * nc);
+ round(fwd_lrnd, b0, b1, kp + 9 * nc);
+ }
+#else
+
+#if (ENC_UNROLL == PARTIAL)
+ { aes_32t rnd;
+ for(rnd = 0; rnd < (cx->n_rnd >> 1) - 1; ++rnd)
+ {
+ kp += nc;
+ round(fwd_rnd, b1, b0, kp);
+ kp += nc;
+ round(fwd_rnd, b0, b1, kp);
+ }
+ kp += nc;
+ round(fwd_rnd, b1, b0, kp);
+#else
+ { aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
+ for(rnd = 0; rnd < cx->n_rnd - 1; ++rnd)
+ {
+ kp += nc;
+ round(fwd_rnd, p1, p0, kp);
+ pt = p0, p0 = p1, p1 = pt;
+ }
+#endif
+ kp += nc;
+ round(fwd_lrnd, b0, b1, kp);
+ }
+#endif
+
+ state_out(out_blk, b0);
+ return aes_good;
+}
+
+#endif
+
+#if defined(DECRYPTION)
+
+#define inv_var(x,r,c) \
+ ( r == 0 ? \
+ ( c == 0 ? s(x,0) \
+ : c == 1 ? s(x,1) \
+ : c == 2 ? s(x,2) \
+ : c == 3 ? s(x,3) \
+ : c == 4 ? s(x,4) \
+ : c == 5 ? s(x,5) \
+ : c == 6 ? s(x,6) \
+ : s(x,7))\
+ : r == 1 ? \
+ ( c == 0 ? nc == 4 ? s(x,3) : nc == 8 ? s(x,7) : s(x,5) \
+ : c == 1 ? s(x,0) \
+ : c == 2 ? s(x,1) \
+ : c == 3 ? s(x,2) \
+ : c == 4 ? s(x,3) \
+ : c == 5 ? s(x,4) \
+ : c == 6 ? s(x,5) \
+ : s(x,6))\
+ : r == 2 ? \
+ ( c == 0 ? nc == 4 ? s(x,2) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 1 ? nc == 4 ? s(x,3) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 2 ? nc == 8 ? s(x,7) : s(x,0) \
+ : c == 3 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 4 ? nc == 8 ? s(x,1) : s(x,2) \
+ : c == 5 ? nc == 8 ? s(x,2) : s(x,3) \
+ : c == 6 ? s(x,3) \
+ : s(x,4))\
+ : \
+ ( c == 0 ? nc == 4 ? s(x,1) : nc == 8 ? s(x,4) : s(x,3) \
+ : c == 1 ? nc == 4 ? s(x,2) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 2 ? nc == 4 ? s(x,3) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 3 ? nc == 8 ? s(x,7) : s(x,0) \
+ : c == 4 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 5 ? nc == 8 ? s(x,1) : s(x,2) \
+ : c == 6 ? s(x,2) \
+ : s(x,3)))
+
+#if defined(IT4_SET)
+#undef dec_imvars
+#define dec_imvars
+#define inv_rnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,it_tab,inv_var,rf1,c)
+#elif defined(IT1_SET)
+#undef dec_imvars
+#define dec_imvars
+#define inv_rnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,upr,it_tab,inv_var,rf1,c)
+#else
+#define inv_rnd(y,x,k,c) s(y,c) = inv_mcol(no_table(x,inv_s_box,inv_var,rf1,c) ^ (k)[c])
+#endif
+
+#if defined(IL4_SET)
+#define inv_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,il_tab,inv_var,rf1,c)
+#elif defined(IL1_SET)
+#define inv_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,ups,il_tab,inv_var,rf1,c)
+#else
+#define inv_lrnd(y,x,k,c) s(y,c) = no_table(x,inv_s_box,inv_var,rf1,c) ^ (k)[c]
+#endif
+
+static aes_rval aes_dec_blk(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1])
+{ aes_32t locals(b0, b1);
+ const aes_32t *kp = cx->k_sch + nc * cx->n_rnd;
+ dec_imvars /* declare variables for inv_mcol() if needed */
+
+ if(!(cx->n_blk & 2)) return aes_bad;
+
+ state_in(b0, in_blk, kp);
+
+#if (DEC_UNROLL == FULL)
+
+ kp = cx->k_sch + 9 * nc;
+ switch(cx->n_rnd)
+ {
+ case 14: round(inv_rnd, b1, b0, kp + 4 * nc);
+ round(inv_rnd, b0, b1, kp + 3 * nc);
+ case 12: round(inv_rnd, b1, b0, kp + 2 * nc);
+ round(inv_rnd, b0, b1, kp + nc );
+ case 10: round(inv_rnd, b1, b0, kp );
+ round(inv_rnd, b0, b1, kp - nc);
+ round(inv_rnd, b1, b0, kp - 2 * nc);
+ round(inv_rnd, b0, b1, kp - 3 * nc);
+ round(inv_rnd, b1, b0, kp - 4 * nc);
+ round(inv_rnd, b0, b1, kp - 5 * nc);
+ round(inv_rnd, b1, b0, kp - 6 * nc);
+ round(inv_rnd, b0, b1, kp - 7 * nc);
+ round(inv_rnd, b1, b0, kp - 8 * nc);
+ round(inv_lrnd, b0, b1, kp - 9 * nc);
+ }
+#else
+
+#if (DEC_UNROLL == PARTIAL)
+ { aes_32t rnd;
+ for(rnd = 0; rnd < (cx->n_rnd >> 1) - 1; ++rnd)
+ {
+ kp -= nc;
+ round(inv_rnd, b1, b0, kp);
+ kp -= nc;
+ round(inv_rnd, b0, b1, kp);
+ }
+ kp -= nc;
+ round(inv_rnd, b1, b0, kp);
+#else
+ { aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
+ for(rnd = 0; rnd < cx->n_rnd - 1; ++rnd)
+ {
+ kp -= nc;
+ round(inv_rnd, p1, p0, kp);
+ pt = p0, p0 = p1, p1 = pt;
+ }
+#endif
+ kp -= nc;
+ round(inv_lrnd, b0, b1, kp);
+ }
+#endif
+
+ state_out(out_blk, b0);
+ return aes_good;
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| AP4_AesBlockCipher::AP4_AesBlockCipher
++---------------------------------------------------------------------*/
+AP4_AesBlockCipher::AP4_AesBlockCipher(const AP4_UI08* key)
+{
+ aes_enc_key(key, AP4_AES_KEY_LENGTH, &m_Context);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AesBlockCipher::~AP4_AesBlockCipher
++---------------------------------------------------------------------*/
+AP4_AesBlockCipher::~AP4_AesBlockCipher()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_AesCipher::EncryptBlock
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AesBlockCipher::EncryptBlock(const AP4_UI08* block_in, AP4_UI08* block_out)
+{
+ aes_rval result;
+ result = aes_enc_blk(block_in, block_out, &m_Context);
+ return result == aes_good ? AP4_SUCCESS : AP4_FAILURE;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4AesBlockCipher.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4AesBlockCipher.h
new file mode 100644
index 000000000..71137a063
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4AesBlockCipher.h
@@ -0,0 +1,82 @@
+/*
+ * AES Block cipher
+ * (c) 2005 Gilles Boccon-Gibod
+ * Portions (c) 2001, Dr Brian Gladman (see below)
+ */
+
+/*
+ -------------------------------------------------------------------------
+ Copyright (c) 2001, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
+ All rights reserved.
+
+ LICENSE TERMS
+
+ The free distribution and use of this software in both source and binary
+ form is allowed (with or without changes) provided that:
+
+ 1. distributions of this source code include the above copyright
+ notice, this list of conditions and the following disclaimer;
+
+ 2. distributions in binary form include the above copyright
+ notice, this list of conditions and the following disclaimer
+ in the documentation and/or other associated materials;
+
+ 3. the copyright holder's name is not used to endorse products
+ built using this software without specific written permission.
+
+ DISCLAIMER
+
+ This software is provided 'as is' with no explicit or implied warranties
+ in respect of its properties, including, but not limited to, correctness
+ and fitness for purpose.
+ -------------------------------------------------------------------------
+ Issue Date: 29/07/2002
+*/
+
+#ifndef _AP4_AES_BLOCK_CIPHER_H_
+#define _AP4_AES_BLOCK_CIPHER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Config.h"
+
+/*----------------------------------------------------------------------
+| AES constants
++---------------------------------------------------------------------*/
+#define AP4_AES_BLOCK_SIZE 16
+#define AP4_AES_KEY_LENGTH 16
+
+/*----------------------------------------------------------------------
+| AES types
++---------------------------------------------------------------------*/
+typedef AP4_UI32 aes_32t;
+typedef AP4_UI08 aes_08t;
+typedef unsigned int aes_rval;
+typedef struct // the AES context for encryption
+{ aes_32t k_sch[4*AP4_AES_BLOCK_SIZE]; // the encryption key schedule
+ aes_32t n_rnd; // the number of cipher rounds
+ aes_32t n_blk; // the number of bytes in the state
+} aes_ctx;
+#define aes_bad 0 // bad function return value
+#define aes_good 1 // good function return value
+
+/*----------------------------------------------------------------------
+| AP4_AesBlockCipher class
++---------------------------------------------------------------------*/
+class AP4_AesBlockCipher
+{
+ public:
+ // constructor and destructor
+ AP4_AesBlockCipher(const AP4_UI08* key);
+ ~AP4_AesBlockCipher();
+
+ // methods
+ AP4_Result EncryptBlock(const AP4_UI08* block_in, AP4_UI08* block_out);
+
+ private:
+ aes_ctx m_Context;
+};
+
+#endif // _AP4_AES_BLOCK_CIPHER_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4StreamCipher.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4StreamCipher.cpp
new file mode 100644
index 000000000..706f533d6
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4StreamCipher.cpp
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2005 Gilles Boccon-Gibod
+ */
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4StreamCipher.h"
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::AP4_StreamCipher
++---------------------------------------------------------------------*/
+AP4_StreamCipher::AP4_StreamCipher(const AP4_UI08* key,
+ const AP4_UI08* salt,
+ AP4_Size iv_size) :
+ m_StreamOffset(0),
+ m_IvSize(iv_size),
+ m_BlockCipher(NULL)
+{
+ // clamp the IV size to the max supported size
+ if (iv_size > 4) {
+ m_IvSize = 4;
+ }
+
+ // set the initial state
+ Reset(key, salt);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::~AP4_StreamCipher
++---------------------------------------------------------------------*/
+AP4_StreamCipher::~AP4_StreamCipher()
+{
+ // delete the block cipher
+ if (m_BlockCipher) {
+ delete m_BlockCipher;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::Reset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StreamCipher::Reset(const AP4_UI08* key, const AP4_UI08* salt)
+{
+ if (salt) {
+ // initialize the counter with a salting key
+ for (AP4_UI32 i=0; i<AP4_AES_BLOCK_SIZE; i++) {
+ m_CBlock[i] = salt[i];
+ }
+ } else {
+ // initialize the counter with no salting key
+ for (AP4_UI32 i = 0; i < AP4_AES_BLOCK_SIZE; i++) {
+ m_CBlock[i] = 0;
+ }
+ }
+
+ // (re)create the block cipher
+ if (key != NULL) {
+ // delete the block cipher if needed
+ if (m_BlockCipher) {
+ delete m_BlockCipher;
+ }
+
+ // (re)create one
+ m_BlockCipher = new AP4_AesBlockCipher(key);
+ }
+
+ // reset the stream offset
+ SetStreamOffset(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::SetCounter
++---------------------------------------------------------------------*/
+void
+AP4_StreamCipher::SetCounter(AP4_Offset block_offset)
+{
+ // set the counter bytes
+ for (AP4_UI32 i = 0; i < m_IvSize; i++) {
+ m_CBlock[AP4_AES_BLOCK_SIZE-1-i] =
+ (AP4_UI08)((block_offset>>(8*i)) & 0xFF);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::SetStreamOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StreamCipher::SetStreamOffset(AP4_Offset offset)
+{
+ // do nothing if we're already at that offset
+ if (offset == m_StreamOffset) return AP4_SUCCESS;
+
+ // update the offset
+ m_StreamOffset = offset;
+
+ // update the key stream if necessary
+ if (m_StreamOffset & 0xF) {
+ return UpdateKeyStream(m_StreamOffset/AP4_AES_BLOCK_SIZE);
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::UpdateKeyStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StreamCipher::UpdateKeyStream(AP4_Offset block_offset)
+{
+ // compute the new counter
+ SetCounter(block_offset);
+
+ // compute the key block (x) from the counter block (c)
+ return m_BlockCipher->EncryptBlock(m_CBlock, m_XBlock);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher::ProcessBuffer
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StreamCipher::ProcessBuffer(const AP4_UI08* in,
+ AP4_UI08* out,
+ AP4_Size size)
+{
+ if (m_BlockCipher == NULL) return AP4_ERROR_INVALID_STATE;
+
+ while (size) {
+ // compute the number of bytes available in this chunk
+ AP4_UI32 index = m_StreamOffset & (AP4_AES_BLOCK_SIZE-1);
+ AP4_UI32 chunk;
+
+ // update the key stream if we are on a boundary
+ if (index == 0) {
+ UpdateKeyStream(m_StreamOffset/AP4_AES_BLOCK_SIZE);
+ chunk = AP4_AES_BLOCK_SIZE;
+ }
+
+ // compute the number of bytes remaining in the chunk
+ chunk = AP4_AES_BLOCK_SIZE - index;
+ if (chunk > size) chunk = size;
+
+ // encrypt/decrypt the chunk
+ AP4_UI08* x = &m_XBlock[index];
+ for (AP4_UI32 i = 0; i < chunk; i++) {
+ *out++ = *in++ ^ *x++;
+ }
+
+ // update offset and size
+ m_StreamOffset += chunk;
+ size -= chunk;
+ }
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4StreamCipher.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4StreamCipher.h
new file mode 100644
index 000000000..3328ac6be
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Crypto/Ap4StreamCipher.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2005 Gilles Boccon-Gibod
+ */
+
+
+#ifndef _AP4_STREAM_CIPHER_H_
+#define _AP4_STREAM_CIPHER_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4AesBlockCipher.h"
+#include "Ap4Results.h"
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| AP4_StreamCipher class
++---------------------------------------------------------------------*/
+class AP4_StreamCipher
+{
+ public:
+ // methods
+ AP4_StreamCipher(const AP4_UI08* key = NULL,
+ const AP4_UI08* salt = NULL,
+ AP4_Size iv_size = 4);
+ ~AP4_StreamCipher();
+ AP4_Result SetStreamOffset(AP4_Offset offset);
+ AP4_Result Reset(const AP4_UI08* key, const AP4_UI08* salt);
+ AP4_Result ProcessBuffer(const AP4_UI08* in,
+ AP4_UI08* out,
+ AP4_Size size);
+ AP4_Offset GeStreamOffset() { return m_StreamOffset; }
+
+ private:
+ // members
+ AP4_Offset m_StreamOffset;
+ AP4_Size m_IvSize;
+ AP4_UI08 m_CBlock[AP4_AES_BLOCK_SIZE];
+ AP4_UI08 m_XBlock[AP4_AES_BLOCK_SIZE];
+ AP4_AesBlockCipher* m_BlockCipher;
+
+ // methods
+ void SetCounter(AP4_Offset block_offset);
+ AP4_Result UpdateKeyStream(AP4_Offset block_offset);
+};
+
+#endif // _AP4_STREAM_CIPHER_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/.classpath b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/.classpath
new file mode 100644
index 000000000..233be1d2c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path=""/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/.project b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/.project
new file mode 100644
index 000000000..a7c1d0d05
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Bento4</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Atom.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Atom.java
new file mode 100644
index 000000000..be0dd49e9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Atom.java
@@ -0,0 +1,130 @@
+package com.axiosys.bento4;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public abstract class Atom {
+ public final static int TYPE_MOOV = 0x6d6f6f76;
+ public final static int TYPE_TRAK = 0x7472616b;
+ public final static int TYPE_HNTI = 0x686e7469;
+ public final static int TYPE_STBL = 0x7374626c;
+ public final static int TYPE_MDIA = 0x6d646961;
+ public final static int TYPE_DINF = 0x64696e66;
+ public final static int TYPE_MINF = 0x6d696e66;
+ public final static int TYPE_SCHI = 0x73636869;
+ public final static int TYPE_SINF = 0x73696e66;
+ public final static int TYPE_UDTA = 0x75647461;
+ public final static int TYPE_ILST = 0x696c7374;
+ public final static int TYPE_EDTS = 0x65647473;
+ public final static int TYPE_META = 0x6d657461;
+ public final static int TYPE_STSD = 0x73747364;
+ public final static int TYPE_MP4A = 0x6d703461;
+ public final static int TYPE_ENCA = 0x656e6361;
+ public final static int TYPE_MP4V = 0x6d703476;
+ public final static int TYPE_ENCV = 0x656e6376;
+ public final static int TYPE_IKMS = 0x694b4d53;
+ public final static int TYPE_TKHD = 0x746b6864;
+ public final static int TYPE_SCHM = 0x7363686d;
+ public final static int TYPE_HDLR = 0x68646c72;
+
+ public final static int HEADER_SIZE = 8;
+ public final static int FULL_HEADER_SIZE = 12;
+
+ // members
+ protected int type;
+ protected int size;
+ protected int flags;
+ protected int version;
+ protected boolean isFull;
+
+ public static String typeString(int type) {
+ StringBuffer result = new StringBuffer(4);
+
+ result.append((char)((type>>24)&0xFF));
+ result.append((char)((type>>16)&0xFF));
+ result.append((char)((type>> 8)&0xFF));
+ result.append((char)((type )&0xFF));
+
+ return result.toString();
+ }
+
+ public static int nameToType(String name) {
+ return ((name.charAt(0)&0xFF)<<24) |
+ ((name.charAt(1)&0xFF)<<16) |
+ ((name.charAt(2)&0xFF)<< 8) |
+ ((name.charAt(3)&0xFF));
+ }
+
+ public Atom(int type, int size, boolean isFull) {
+ this.type = type;
+ this.size = size;
+ this.isFull = isFull;
+ }
+
+ public Atom(int type, int size, boolean isFull, RandomAccessFile source) throws IOException {
+ this(type, size, isFull);
+ if (isFull) {
+ // read the version and flags
+ int extension = source.readInt();
+ version = (extension>>24)&0xFF;
+ flags = extension&0xFFFFFF;
+ } else {
+ this.flags = 0;
+ this.version = 0;
+ }
+ }
+
+ public int getType() { return type; }
+ public int getSize() { return size; }
+ public int getHeaderSize() { return isFull?FULL_HEADER_SIZE:HEADER_SIZE; }
+ public int getPayloadSize() { return size-getHeaderSize(); }
+
+ public void write(DataOutputStream stream) throws IOException {
+ // write the header
+ writeHeader(stream);
+
+ // write the fields
+ writeFields(stream);
+ }
+
+ public void writeHeader(DataOutputStream stream) throws IOException {
+ // write the size
+ stream.writeInt(size);
+
+ // write the type
+ stream.writeInt(type);
+
+ // for full atoms, write version and flags
+ if (isFull) {
+ stream.writeInt(version<<24 | flags);
+ }
+ }
+
+ protected abstract void writeFields(DataOutputStream stream) throws IOException;
+
+ public byte[] toBytes() throws IOException {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ DataOutputStream output = new DataOutputStream(stream);
+ write(output);
+
+ return stream.toByteArray();
+ }
+
+ public byte[] getPayload() throws IOException {
+ byte[] bytes = toBytes();
+ byte[] result = new byte[getPayloadSize()];
+ System.arraycopy(bytes, getHeaderSize(), result, 0, result.length);
+
+ return result;
+ }
+
+ public String toString(String indentation) {
+ return indentation+"[" + typeString(type) + "] size=" + getHeaderSize() + "+" + getPayloadSize();
+ }
+
+ public String toString() {
+ return toString("");
+ }
+} \ No newline at end of file
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomFactory.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomFactory.java
new file mode 100644
index 000000000..0d39b686c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomFactory.java
@@ -0,0 +1,129 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+import com.axiosys.bento4.ismacryp.EncaSampleEntry;
+import com.axiosys.bento4.ismacryp.EncvSampleEntry;
+import com.axiosys.bento4.ismacryp.IkmsAtom;
+import com.axiosys.bento4.ismacryp.SchmAtom;
+
+public class AtomFactory {
+ public static final AtomFactory DefaultFactory = new AtomFactory();
+
+ private int context = 0;
+
+ public Atom createAtom(RandomAccessFile file) throws IOException, InvalidFormatException {
+ return createAtom(file, new int[] { (int) (file.length()-file.getFilePointer()) });
+ }
+
+ Atom createAtom(RandomAccessFile source, int[] bytesAvailable /* by reference */) throws IOException, InvalidFormatException {
+ Atom atom = null;
+
+ // check that there are enough bytes for at least a header
+ if (bytesAvailable[0] < Atom.HEADER_SIZE) return null;
+
+ // remember current file offset
+ long start = source.getFilePointer();
+
+ // read atom size
+ int size = source.readInt();
+
+ if (size == 0) {
+ // atom extends to end of file
+ size = (int)(source.length()-start);
+ }
+
+ // check the size (we don't handle extended size yet)
+ if (size > bytesAvailable[0]) {
+ source.seek(start);
+ return null;
+ }
+
+ if (size < 0) {
+ // something is corrupted
+ throw new InvalidFormatException("invalid atom size");
+ }
+
+ // read atom type
+ int type = source.readInt();
+
+ // create the atom
+ switch (type) {
+ case Atom.TYPE_STSD:
+ atom = new StsdAtom(size, source, this);
+ break;
+
+ case Atom.TYPE_SCHM:
+ atom = new SchmAtom(size, source);
+ break;
+
+ case Atom.TYPE_IKMS:
+ atom = new IkmsAtom(size, source);
+ break;
+
+ case Atom.TYPE_TRAK:
+ atom = new TrakAtom(size, source, this);
+ break;
+
+ case Atom.TYPE_TKHD:
+ atom = new TkhdAtom(size, source);
+ break;
+
+ case Atom.TYPE_HDLR:
+ atom = new HdlrAtom(size, source);
+ break;
+
+ // container atoms
+ case Atom.TYPE_MOOV:
+ case Atom.TYPE_HNTI:
+ case Atom.TYPE_STBL:
+ case Atom.TYPE_MDIA:
+ case Atom.TYPE_DINF:
+ case Atom.TYPE_MINF:
+ case Atom.TYPE_SCHI:
+ case Atom.TYPE_SINF:
+ case Atom.TYPE_UDTA:
+ case Atom.TYPE_ILST:
+ case Atom.TYPE_EDTS: {
+ int previousContext = context;
+ context = type; // set the context for the children
+ atom = new ContainerAtom(type, size, false, source, this);
+ context = previousContext; // restore the previous context
+ break;
+ }
+
+ // full container atoms
+ case Atom.TYPE_META:
+ atom = new ContainerAtom(type, size, false, source, this);
+ break;
+
+ // sample entries
+ case Atom.TYPE_MP4A:
+ atom = new Mp4aSampleEntry(size, source, this);
+ break;
+
+ case Atom.TYPE_MP4V:
+ atom = new Mp4vSampleEntry(size, source, this);
+ break;
+
+ case Atom.TYPE_ENCA:
+ atom = new EncaSampleEntry(size, source, this);
+ break;
+
+ case Atom.TYPE_ENCV:
+ atom = new EncvSampleEntry(size, source, this);
+ break;
+
+ default:
+ atom = new UnknownAtom(type, size, source);
+ break;
+ }
+
+ // skip to the end of the atom
+ bytesAvailable[0] -= size;
+ source.seek(start+size);
+
+ return atom;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomList.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomList.java
new file mode 100644
index 000000000..b3104e8a2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomList.java
@@ -0,0 +1,43 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.ArrayList;
+
+public class AtomList implements AtomParent {
+ private final ArrayList atoms = new ArrayList();
+
+ public AtomList(String filename) throws IOException, InvalidFormatException {
+ RandomAccessFile input = new RandomAccessFile(filename, "r");
+ Atom atom;
+ do {
+ atom = AtomFactory.DefaultFactory.createAtom(input);
+ if (atom != null) atoms.add(atom);
+ } while (atom != null);
+ //input.close(); do not close the input here as some atoms may need to read from it later
+ }
+
+ public int getChildrenCount() {
+ return atoms.size();
+ }
+
+ public Atom getChild(int index) {
+ return (Atom)atoms.get(index);
+ }
+
+ public Atom getChild(int type, int index) {
+ return AtomUtils.findChild(atoms, type, index);
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer();
+ String sep = "";
+ for (int i=0; i<atoms.size(); i++) {
+ Atom atom = (Atom)atoms.get(i);
+ result.append(atom.toString() + sep);
+ sep = "\n";
+ }
+
+ return result.toString();
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomParent.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomParent.java
new file mode 100644
index 000000000..042645c10
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomParent.java
@@ -0,0 +1,7 @@
+package com.axiosys.bento4;
+
+public interface AtomParent {
+ int getChildrenCount();
+ Atom getChild(int index);
+ Atom getChild(int type, int index);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomUtils.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomUtils.java
new file mode 100644
index 000000000..76b421a3f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AtomUtils.java
@@ -0,0 +1,56 @@
+package com.axiosys.bento4;
+
+import java.util.Iterator;
+import java.util.List;
+
+public class AtomUtils {
+ public static Atom findAtom(AtomParent parent, String path) {
+ Atom atom = null;
+ while (path != null) {
+ int separator = path.indexOf('/');
+ String atomName;
+ int index = 0;
+ if (separator > 0) {
+ atomName = path.substring(0, separator);
+ path = path.substring(separator+1);
+ } else {
+ atomName = path;
+ path = null;
+ }
+
+ if (atomName.length() != 4) {
+ // we need at least 3 more chars
+ if (atomName.length() < 7) return null;
+
+ // parse the name trailer
+ if (atomName.charAt(4) != '[' || atomName.charAt(atomName.length()-1) != ']') {
+ return null;
+ }
+ String indexString = atomName.substring(5, atomName.length()-1);
+ index = Integer.parseInt(indexString);
+ }
+
+ int type = Atom.nameToType(atomName);
+ atom = parent.getChild(type, index);
+ if (path == null) return atom;
+ if (atom instanceof AtomParent) {
+ parent = (AtomParent)atom;
+ } else {
+ return null;
+ }
+ }
+
+ return atom;
+ }
+
+ public static Atom findChild(List atoms, int type, int index) {
+ for (Iterator i = atoms.iterator(); i.hasNext();) {
+ Atom atom = (Atom)i.next();
+ if (atom.getType() == type) {
+ if (index-- == 0) return atom;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AudioSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AudioSampleEntry.java
new file mode 100644
index 000000000..99bceb7c7
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/AudioSampleEntry.java
@@ -0,0 +1,42 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class AudioSampleEntry extends MpegSampleEntry {
+ private int sampleRate;
+ private int channelCount;
+ private int sampleSize;
+
+ protected AudioSampleEntry(int format, int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(format, size, source, atomFactory);
+ }
+
+ int getSampleRate() { return (sampleRate>>16)&0xFFFF; }
+ int getSampleSize() { return sampleSize; }
+ int getChannelCount() { return channelCount; }
+
+ protected void readFields(RandomAccessFile source) throws IOException {
+ super.readFields(source);
+
+ source.skipBytes(8);
+ channelCount = source.readUnsignedShort();
+ sampleSize = source.readUnsignedShort();
+ source.skipBytes(4);
+ sampleRate = source.readInt();
+ }
+
+ public String toString(String indentation) {
+ StringBuffer result = new StringBuffer();
+ result.append(indentation+"[" + typeString(type) + "] size=" + getHeaderSize() + "+" + getPayloadSize());
+ result.append("\n" + indentation + " sample_rate = " + getSampleRate());
+ result.append("\n" + indentation + " sample_size = " + sampleSize);
+ result.append("\n" + indentation + " channel_count = " + channelCount);
+ for (int i=0; i<children.size(); i++) {
+ result.append("\n");
+ result.append(((Atom)children.get(i)).toString(indentation+" "));
+ }
+
+ return result.toString();
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ContainerAtom.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ContainerAtom.java
new file mode 100644
index 000000000..eed46f4cb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ContainerAtom.java
@@ -0,0 +1,66 @@
+package com.axiosys.bento4;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.ArrayList;
+
+public class ContainerAtom extends Atom implements AtomParent {
+ protected final ArrayList children = new ArrayList();
+
+ public ContainerAtom(int type, int size, boolean isFull, RandomAccessFile source) throws IOException {
+ super(type, size, isFull, source);
+ }
+
+ public ContainerAtom(int type, int size, boolean isFull, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(type, size, isFull, source);
+ readChildren(atomFactory, source, getPayloadSize());
+ }
+
+ public Atom findAtom(String path) {
+ return AtomUtils.findAtom(this, path);
+ }
+
+ protected void writeFields(DataOutputStream stream) throws IOException {
+ writeChildren(stream);
+ }
+
+ protected void readChildren(AtomFactory atomFactory, RandomAccessFile source, int size) throws IOException, InvalidFormatException {
+ int[] bytesAvailable = new int[] { size };
+ Atom atom;
+ do {
+ atom = atomFactory.createAtom(source, bytesAvailable);
+ if (atom != null) children.add(atom);
+ } while (atom != null);
+ }
+
+ protected void writeChildren(DataOutputStream stream) throws IOException {
+ for (int i=0; i<children.size(); i++) {
+ Atom atom = (Atom)children.get(i);
+ atom.write(stream);
+ }
+ }
+
+ public int getChildrenCount() {
+ return children.size();
+ }
+
+ public Atom getChild(int index) {
+ return (Atom)children.get(index);
+ }
+
+ public Atom getChild(int type, int index) {
+ return AtomUtils.findChild(children, type, index);
+ }
+
+ public String toString(String indentation) {
+ StringBuffer result = new StringBuffer();
+ result.append(super.toString(indentation));
+ for (int i=0; i<children.size(); i++) {
+ result.append("\n");
+ result.append(((Atom)children.get(i)).toString(indentation+" "));
+ }
+
+ return result.toString();
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/File.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/File.java
new file mode 100644
index 000000000..9c2181722
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/File.java
@@ -0,0 +1,22 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+
+public class File {
+ private AtomList atoms;
+ private Movie movie;
+
+ public File(String filename) throws IOException, InvalidFormatException {
+ atoms = new AtomList(filename);
+ ContainerAtom moov = (ContainerAtom)atoms.getChild(Atom.TYPE_MOOV, 0);
+ if (moov == null) {
+ movie = null;
+ } else {
+ movie = new Movie(moov);
+ }
+ }
+
+ public Movie getMovie() {
+ return movie;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/HdlrAtom.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/HdlrAtom.java
new file mode 100644
index 000000000..9db7923a2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/HdlrAtom.java
@@ -0,0 +1,49 @@
+package com.axiosys.bento4;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class HdlrAtom extends Atom {
+ private int handlerType;
+ private String handlerName;
+
+ public HdlrAtom(int size, RandomAccessFile source) throws IOException {
+ super(TYPE_HDLR, size, true, source);
+
+ source.skipBytes(4);
+ handlerType = source.readInt();
+ source.skipBytes(12);
+
+ // read the name unless it is empty
+ int nameSize = size-(FULL_HEADER_SIZE+20);
+ if (nameSize > 0) {
+ byte[] name = new byte[nameSize];
+ source.read(name);
+ int nameChars = 0;
+ while (nameChars < name.length && name[nameChars] != 0) nameChars++;
+ handlerName = new String(name, 0, nameChars, "UTF-8");
+ }
+ }
+
+ public String getHandlerName() {
+ return handlerName;
+ }
+
+ public int getHandlerType() {
+ return handlerType;
+ }
+
+ protected void writeFields(DataOutputStream stream) throws IOException {
+ // not implemented yet
+ throw new RuntimeException("not implemented yet");
+ }
+
+ public String toString(String indentation) {
+ StringBuffer result = new StringBuffer(super.toString(indentation));
+ result.append("\n" + indentation + " handler_type = " + Atom.typeString(handlerType));
+ result.append("\n" + indentation +" handler_name = " + handlerName);
+
+ return result.toString();
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/InvalidFormatException.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/InvalidFormatException.java
new file mode 100644
index 000000000..89b940347
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/InvalidFormatException.java
@@ -0,0 +1,20 @@
+package com.axiosys.bento4;
+
+public class InvalidFormatException extends Exception {
+
+ public InvalidFormatException() {
+ super();
+ }
+
+ public InvalidFormatException(String message) {
+ super(message);
+ }
+
+ public InvalidFormatException(Throwable cause) {
+ super(cause);
+ }
+
+ public InvalidFormatException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Movie.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Movie.java
new file mode 100644
index 000000000..bb8e3ee2f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Movie.java
@@ -0,0 +1,58 @@
+package com.axiosys.bento4;
+
+import java.util.ArrayList;
+
+public class Movie {
+ private ContainerAtom moov;
+ private ArrayList tracks = new ArrayList();
+
+ public Movie(ContainerAtom moov) {
+ this.moov = moov;
+
+ for (int i=0; i<moov.getChildrenCount(); i++) {
+ Atom child = moov.getChild(i);
+ if (child.getType() == Atom.TYPE_TRAK) {
+ TrakAtom trak = (TrakAtom)child;
+ tracks.add(new Track(trak));
+ }
+ }
+ }
+
+ public Atom findAtom(String path) {
+ return AtomUtils.findAtom(moov, path);
+ }
+
+ public Track[] getTracks() {
+ Track[] result = new Track[tracks.size()];
+ tracks.toArray(result);
+ return result;
+ }
+
+ public int[] getTrackIds() {
+ int[] result = new int[tracks.size()];
+ for (int i=0; i<result.length; i++) {
+ Track track = (Track)tracks.get(i);
+ result[i] = track.getId();
+ }
+
+ return result;
+ }
+
+ public Track getTrackById(int id) {
+ for (int i=0; i<tracks.size(); i++) {
+ Track track = (Track)tracks.get(i);
+ if (track.getId() == id) return track;
+ }
+
+ return null;
+ }
+
+ public int getTrackIndex(int id) {
+ for (int i=0; i<tracks.size(); i++) {
+ Track track = (Track)tracks.get(i);
+ if (track.getId() == id) return i;
+ }
+
+ return -1;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Mp4aSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Mp4aSampleEntry.java
new file mode 100644
index 000000000..c10995e9e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Mp4aSampleEntry.java
@@ -0,0 +1,10 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class Mp4aSampleEntry extends AudioSampleEntry {
+ Mp4aSampleEntry(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(TYPE_MP4A, size, source, atomFactory);
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Mp4vSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Mp4vSampleEntry.java
new file mode 100644
index 000000000..88bfab53a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Mp4vSampleEntry.java
@@ -0,0 +1,10 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class Mp4vSampleEntry extends VideoSampleEntry {
+ Mp4vSampleEntry(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(TYPE_MP4V, size, source, atomFactory);
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/MpegSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/MpegSampleEntry.java
new file mode 100644
index 000000000..8c1d83f18
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/MpegSampleEntry.java
@@ -0,0 +1,10 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class MpegSampleEntry extends SampleEntry {
+ MpegSampleEntry(int format, int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(format, size, source, atomFactory);
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/SampleEntry.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/SampleEntry.java
new file mode 100644
index 000000000..d4c403798
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/SampleEntry.java
@@ -0,0 +1,46 @@
+package com.axiosys.bento4;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class SampleEntry extends ContainerAtom {
+ private int dataReferenceIndex;
+
+ SampleEntry(int format, int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(format, size, false, source);
+
+ // read the fields before the children atoms
+ int fieldsSize = getFieldsSize();
+ readFields(source);
+
+ // read children atoms (ex: esds and maybe others)
+ readChildren(atomFactory, source, size-HEADER_SIZE-fieldsSize);
+ }
+
+ public void write(DataOutputStream stream) throws IOException {
+ // write the header
+ writeHeader(stream);
+
+ // write the fields
+ writeFields(stream);
+
+ // write the children atoms
+ writeChildren(stream);
+ }
+
+ protected int getFieldsSize() {
+ return 8;
+ }
+
+ protected void readFields(RandomAccessFile source) throws IOException {
+ source.skipBytes(6);
+ dataReferenceIndex = source.readUnsignedShort();
+ }
+
+ protected void writeFields(DataOutputStream stream) throws IOException {
+ byte[] reserved = new byte[] { 0,0,0,0,0,0 };
+ stream.write(reserved);
+ stream.writeShort(dataReferenceIndex);
+ }
+ }
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/StsdAtom.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/StsdAtom.java
new file mode 100644
index 000000000..908fce7d2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/StsdAtom.java
@@ -0,0 +1,61 @@
+package com.axiosys.bento4;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.ArrayList;
+
+public class StsdAtom extends Atom implements AtomParent {
+ private ArrayList entries = new ArrayList();
+
+ public StsdAtom(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(TYPE_STSD, size, true, source);
+
+ // read the number of entries
+ int entryCount = source.readInt();
+ int[] bytesAvailable = new int[] { size-FULL_HEADER_SIZE-4 };
+ for (int i=0; i<entryCount; i++) {
+ Atom atom = atomFactory.createAtom(source, bytesAvailable);
+ if (atom != null) {
+ entries.add(atom);
+ }
+ }
+ }
+
+ public void writeFields(DataOutputStream stream) throws IOException {
+ stream.writeInt(entries.size());
+
+ for (int i=0; i<entries.size(); i++) {
+ Atom atom = (Atom)entries.get(i);
+ atom.write(stream);
+ }
+ }
+
+
+ public int getChildrenCount() {
+ return entries.size();
+ }
+
+ public Atom getChild(int index) {
+ return (Atom)entries.get(index);
+ }
+
+ public Atom getChild(int type, int index) {
+ return AtomUtils.findChild(entries, type, index);
+ }
+
+ public String toString(String indentation) {
+ StringBuffer result = new StringBuffer();
+ result.append(super.toString(indentation));
+ for (int i=0; i<entries.size(); i++) {
+ result.append("\n");
+ result.append(((Atom)entries.get(i)).toString(indentation+" "));
+ }
+
+ return result.toString();
+ }
+
+ public String toString() {
+ return toString("");
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Test.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Test.java
new file mode 100644
index 000000000..6ea3e82ef
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Test.java
@@ -0,0 +1,26 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+
+public class Test {
+
+ /**
+ * @param args
+ * @throws IOException
+ * @throws InvalidFormatException
+ */
+ public static void main(String[] args) throws IOException, InvalidFormatException {
+ AtomList atoms = new AtomList(args[0]);
+
+ if (args.length > 1) {
+ Atom atom = AtomUtils.findAtom(atoms, args[1]);
+ if (atom != null) {
+ System.out.println(atom);
+ byte[] payload = atom.getPayload();
+ System.out.println(new String(payload));
+ }
+ } else {
+ System.out.println(atoms);
+ }
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/TkhdAtom.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/TkhdAtom.java
new file mode 100644
index 000000000..69cb77050
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/TkhdAtom.java
@@ -0,0 +1,63 @@
+package com.axiosys.bento4;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class TkhdAtom extends Atom {
+ private int trackId;
+ private int duration;
+ private int creationTime;
+ private int modificationTime;
+ private int width;
+ private int height;
+ private int layer;
+ private int alternateGroup;
+ private int volume;
+
+ int getDuration() { return duration; }
+ int getTrackId() { return trackId; }
+
+ public TkhdAtom(int size, RandomAccessFile source) throws IOException {
+ super(TYPE_TKHD, size, true, source);
+
+ if (version == 0) {
+ // we only deal with version 0 for now
+ creationTime = source.readInt();
+ modificationTime = source.readInt();
+ trackId = source.readInt();
+ source.skipBytes(4);
+ duration = source.readInt();
+ } else {
+ source.skipBytes(32);
+ }
+
+ source.skipBytes(8);
+ layer = source.readUnsignedShort();
+ alternateGroup = source.readUnsignedShort();
+ volume = source.readUnsignedShort();
+ source.skipBytes(2+9*4);
+ width = source.readInt();
+ height = source.readInt();
+ }
+
+ protected void writeFields(DataOutputStream stream) throws IOException {
+ // not implemented yet
+ throw new RuntimeException("not implemented yet");
+ }
+
+ public String toString(String indentation) {
+ StringBuffer result = new StringBuffer(super.toString(indentation));
+ result.append("\n" + indentation + " track_id = " + trackId);
+ result.append("\n" + indentation +" duration = " + duration);
+ result.append("\n" + indentation +" creation_time = " + creationTime);
+ result.append("\n" + indentation +" modification_time = " + modificationTime);
+ result.append("\n" + indentation +" width = " + width);
+ result.append("\n" + indentation +" height = " + height);
+ result.append("\n" + indentation +" alternate_group = " + alternateGroup);
+ result.append("\n" + indentation +" layer = " + layer);
+ result.append("\n" + indentation +" volume = " + volume);
+
+ return result.toString();
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Track.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Track.java
new file mode 100644
index 000000000..71392c81f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/Track.java
@@ -0,0 +1,64 @@
+package com.axiosys.bento4;
+
+public class Track {
+
+ public static final Type TYPE_UNKNOWN = new Type("Unknown");
+ public static final Type TYPE_AUDIO = new Type("Audio");
+ public static final Type TYPE_VIDEO = new Type("Video");
+ public static final Type TYPE_HINT = new Type("Hint");
+ public static final Type TYPE_SYSTEMS = new Type("Systems");
+
+ public static class Type {
+ public static final int SOUN = 0x736f756e;
+ public static final int VIDE = 0x76696465;
+ public static final int HINT = 0x68696e74;
+ public static final int SDSM = 0x7364736d;
+ public static final int ODSM = 0x6f64736d;
+
+ private String description;
+
+ public static Type findType(int handlerType) {
+ switch (handlerType) {
+ case SOUN: return TYPE_AUDIO;
+ case VIDE: return TYPE_VIDEO;
+ case HINT: return TYPE_HINT;
+ case SDSM:
+ case ODSM: return TYPE_SYSTEMS;
+ default: return TYPE_UNKNOWN;
+ }
+ }
+
+ public Type(String description) {
+ this.description = description;
+ }
+
+ public String toString() {
+ return description;
+ }
+ }
+
+ private Type type;
+ private TrakAtom trakAtom;
+
+ public Track(TrakAtom trak) {
+ trakAtom = trak;
+ HdlrAtom hdlr = (HdlrAtom)trak.findAtom("mdia/hdlr");
+ if (hdlr != null) {
+ type = Type.findType(hdlr.getHandlerType());
+ } else {
+ type = TYPE_UNKNOWN;
+ }
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public int getId() {
+ return trakAtom.getId();
+ }
+
+ public TrakAtom getTrakAtom() {
+ return trakAtom;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/TrakAtom.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/TrakAtom.java
new file mode 100644
index 000000000..1e1337f8f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/TrakAtom.java
@@ -0,0 +1,19 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class TrakAtom extends ContainerAtom {
+ public TrakAtom(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(TYPE_TRAK, size, false, source, atomFactory);
+ }
+
+ public int getId() {
+ TkhdAtom tkhd = (TkhdAtom)getChild(TYPE_TKHD, 0);
+ if (tkhd == null) {
+ return 0;
+ } else {
+ return tkhd.getTrackId();
+ }
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/UnknownAtom.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/UnknownAtom.java
new file mode 100644
index 000000000..900020214
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/UnknownAtom.java
@@ -0,0 +1,36 @@
+package com.axiosys.bento4;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class UnknownAtom extends Atom {
+ private final static int CHUNK_SIZE = 4096;
+
+ private final RandomAccessFile source;
+ private final int offset;
+
+ public UnknownAtom(int type, int size, RandomAccessFile source, int offset) {
+ super(type, size, false);
+ this.source = source;
+ this.offset = offset;
+ }
+
+ public UnknownAtom(int type, int size, RandomAccessFile source) throws IOException {
+ this(type, size, source, (int)source.getFilePointer());
+ }
+
+ public void writeFields(DataOutputStream stream) throws IOException {
+ int position = offset;
+ byte[] buffer = new byte[CHUNK_SIZE];
+ int toCopy = getPayloadSize();
+ while (toCopy > 0) {
+ int chunk = toCopy > CHUNK_SIZE ? CHUNK_SIZE : toCopy;
+ source.seek(position);
+ source.readFully(buffer, 0, chunk);
+ stream.write(buffer, 0, chunk);
+ toCopy -= chunk;
+ position += chunk;
+ }
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/VideoSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/VideoSampleEntry.java
new file mode 100644
index 000000000..4ee2bb352
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/VideoSampleEntry.java
@@ -0,0 +1,69 @@
+package com.axiosys.bento4;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+public class VideoSampleEntry extends MpegSampleEntry {
+ private int width;
+ private int height;
+ private int horizontalResolution;
+ private int verticalResolution;
+ private int frameCount;
+ private int depth;
+ private String compressorName;
+
+ protected VideoSampleEntry(int format, int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(format, size, source, atomFactory);
+ }
+
+ int getWidth() { return width; }
+ int getHeight() { return height; }
+ int getHorizontalResolution() { return horizontalResolution; }
+ int getVerticalResolution() { return verticalResolution; }
+ int getFrameCount() { return frameCount; }
+ int getDepth() { return depth; }
+ String getCompressorName() { return compressorName; }
+
+ protected void readFields(RandomAccessFile source) throws IOException {
+ super.readFields(source);
+
+ source.skipBytes(16);
+ width = source.readUnsignedShort();
+ height = source.readUnsignedShort();
+ horizontalResolution = source.readInt();
+ verticalResolution = source.readInt();
+ source.skipBytes(4);
+ frameCount = source.readUnsignedShort();
+
+ byte[] str = new byte[32];
+ source.readFully(str);
+ int str_size = 0;
+ while (str[str_size] != 0) str_size++;
+ compressorName = new String(str, 0, str_size);
+
+ depth = source.readUnsignedShort();
+ source.skipBytes(2);
+ }
+
+ public String toString(String indentation) {
+ StringBuffer result = new StringBuffer();
+ result.append(indentation+"[" + typeString(type) + "] size=" + getHeaderSize() + "+" + getPayloadSize());
+ result.append("\n" + indentation + " width = " + width);
+ result.append("\n" + indentation + " height = " + height);
+ result.append("\n" + indentation + " horizontal_resolution = " + horizontalResolution);
+ result.append("\n" + indentation + " vertical_resolution = " + verticalResolution);
+ result.append("\n" + indentation + " frame_count = " + frameCount);
+ result.append("\n" + indentation + " depth = " + depth);
+ result.append("\n" + indentation + " compressor_name = " + compressorName);
+ for (int i=0; i<children.size(); i++) {
+ result.append("\n");
+ result.append(((Atom)children.get(i)).toString(indentation+" "));
+ }
+
+ return result.toString();
+ }
+
+ public String toString() {
+ return toString("");
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncaSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncaSampleEntry.java
new file mode 100644
index 000000000..824e4f4f2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncaSampleEntry.java
@@ -0,0 +1,14 @@
+package com.axiosys.bento4.ismacryp;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+import com.axiosys.bento4.AtomFactory;
+import com.axiosys.bento4.AudioSampleEntry;
+import com.axiosys.bento4.InvalidFormatException;
+
+public class EncaSampleEntry extends AudioSampleEntry {
+ public EncaSampleEntry(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(TYPE_ENCA, size, source, atomFactory);
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncvSampleEntry.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncvSampleEntry.java
new file mode 100644
index 000000000..e54257429
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/EncvSampleEntry.java
@@ -0,0 +1,14 @@
+package com.axiosys.bento4.ismacryp;
+
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+import com.axiosys.bento4.AtomFactory;
+import com.axiosys.bento4.InvalidFormatException;
+import com.axiosys.bento4.VideoSampleEntry;
+
+public class EncvSampleEntry extends VideoSampleEntry {
+ public EncvSampleEntry(int size, RandomAccessFile source, AtomFactory atomFactory) throws IOException, InvalidFormatException {
+ super(TYPE_ENCV, size, source, atomFactory);
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/IkmsAtom.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/IkmsAtom.java
new file mode 100644
index 000000000..1b0b2478a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/IkmsAtom.java
@@ -0,0 +1,41 @@
+package com.axiosys.bento4.ismacryp;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+import com.axiosys.bento4.Atom;
+
+public class IkmsAtom extends Atom {
+ private final String kmsUri;
+
+ public IkmsAtom(int size, RandomAccessFile source) throws IOException {
+ super(TYPE_IKMS, size, true, source);
+
+ byte[] str = new byte[size-getHeaderSize()];
+ source.read(str);
+ int str_size = 0;
+ while (str[str_size] != 0) str_size++;
+ kmsUri = new String(str, 0, str_size, "UTF-8");
+ }
+
+ public String getKmsUri() {
+ return kmsUri;
+ }
+
+ protected void writeFields(DataOutputStream stream) throws IOException {
+ byte[] bytes = kmsUri.getBytes("UTF-8");
+ stream.write(bytes);
+ int termination = size-getHeaderSize()-bytes.length;
+ for (int i=0; i<termination; i++) {
+ stream.writeByte(0);
+ }
+ }
+
+ public String toString(String indentation) {
+ StringBuffer result = new StringBuffer(super.toString(indentation));
+ result.append("\n");
+ result.append(indentation + " kms_uri = " + kmsUri);
+ return result.toString();
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/IsmaCryp.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/IsmaCryp.java
new file mode 100644
index 000000000..c27318efd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/IsmaCryp.java
@@ -0,0 +1,5 @@
+package com.axiosys.bento4.ismacryp;
+
+public final class IsmaCryp {
+ public static final int SCHEME_TYPE_IAEC = 0x69414543;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/SchmAtom.java b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/SchmAtom.java
new file mode 100644
index 000000000..22b1d2759
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/Java/com/axiosys/bento4/ismacryp/SchmAtom.java
@@ -0,0 +1,58 @@
+package com.axiosys.bento4.ismacryp;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+import com.axiosys.bento4.Atom;
+
+public class SchmAtom extends Atom {
+ private int schemeType;
+ private int schemeVersion;
+ private String schemeUri;
+
+ public SchmAtom(int size, RandomAccessFile source) throws IOException {
+ super(TYPE_SCHM, size, true, source);
+
+ schemeType = source.readInt();
+ schemeVersion = source.readInt();
+
+ byte[] str = new byte[size-getHeaderSize()-8];
+ source.read(str);
+ int str_size = 0;
+ while (str_size < str.length && str[str_size] != 0) str_size++;
+ schemeUri = new String(str, 0, str_size, "UTF-8");
+
+ }
+
+ public int getSchemeType() {
+ return schemeType;
+ }
+
+ public String getSchemeUri() {
+ return schemeUri;
+ }
+
+ public int getSchemeVersion() {
+ return schemeVersion;
+ }
+
+ protected void writeFields(DataOutputStream stream) throws IOException {
+ stream.writeInt(schemeType);
+ stream.writeInt(schemeVersion);
+ byte[] uri_bytes = schemeUri.getBytes("UTF-8");
+ stream.write(uri_bytes);
+ int termination = size-getHeaderSize()-8-uri_bytes.length;
+ for (int i=0; i<termination; i++) {
+ stream.writeByte(0);
+ }
+ }
+
+ public String toString(String indentation) {
+ StringBuffer result = new StringBuffer(super.toString(indentation));
+ result.append("\n" + indentation + " scheme_type = " + Atom.typeString(schemeType));
+ result.append("\n" + indentation + " scheme_version = " + schemeVersion);
+ result.append("\n" + indentation + " scheme_uri = " + schemeUri);
+ return result.toString();
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/System/StdC/Ap4StdCFileByteStream.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/System/StdC/Ap4StdCFileByteStream.cpp
new file mode 100644
index 000000000..a4b6e7174
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Bento4_0.6.3-001/AP4/Source/System/StdC/Ap4StdCFileByteStream.cpp
@@ -0,0 +1,233 @@
+/*****************************************************************
+|
+| File Byte Stream
+|
+| (c) 2001-2002 Gilles Boccon-Gibod
+|
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include <stdio.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+#include "Ap4FileByteStream.h"
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream
++---------------------------------------------------------------------*/
+class AP4_StdcFileByteStream: public AP4_ByteStream
+{
+public:
+ // methods
+ AP4_StdcFileByteStream(AP4_ByteStream* delegator,
+ const char* name,
+ AP4_FileByteStream::Mode mode);
+ ~AP4_StdcFileByteStream();
+
+ // AP4_ByteStream methods
+ AP4_Result Read(void* buffer,
+ AP4_Size bytesToRead,
+ AP4_Size* bytesRead);
+ AP4_Result Write(const void* buffer,
+ AP4_Size bytesToWrite,
+ AP4_Size* bytesWritten);
+ AP4_Result Seek(AP4_Offset offset);
+ AP4_Result Tell(AP4_Offset& offset);
+ AP4_Result GetSize(AP4_Size& size);
+
+ // AP4_Referenceable methods
+ void AddReference();
+ void Release();
+
+private:
+ // members
+ AP4_ByteStream* m_Delegator;
+ AP4_Cardinal m_ReferenceCount;
+ FILE* m_File;
+};
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream::AP4_StdcFileByteStream
++---------------------------------------------------------------------*/
+AP4_StdcFileByteStream::AP4_StdcFileByteStream(
+ AP4_ByteStream * delegator,
+ const char* name,
+ AP4_FileByteStream::Mode mode) :
+ m_Delegator(delegator),
+ m_ReferenceCount(1),
+ m_File(NULL)
+{
+ if (!strcmp(name, "-stdin")) {
+ m_File = stdin;
+ } else if (!strcmp(name, "-stdout")) {
+ m_File = stdout;
+ } else if (!strcmp(name, "-stderr")) {
+ m_File = stderr;
+ } else {
+ switch (mode) {
+ case AP4_FileByteStream::STREAM_MODE_READ:
+ m_File = fopen(name, "rb");
+ break;
+
+ case AP4_FileByteStream::STREAM_MODE_WRITE:
+ m_File = fopen(name, "wb+");
+ break;
+
+ default:
+ throw AP4_Exception(AP4_ERROR_INVALID_PARAMETERS);
+ }
+
+ if (m_File == NULL) {
+ if (errno == ENOENT) {
+ throw AP4_Exception(AP4_ERROR_NO_SUCH_FILE);
+ } else if (errno == EACCES) {
+ throw AP4_Exception(AP4_ERROR_PERMISSION_DENIED);
+ } else {
+ throw AP4_Exception(AP4_ERROR_CANNOT_OPEN_FILE);
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream::~AP4_StdcFileByteStream
++---------------------------------------------------------------------*/
+AP4_StdcFileByteStream::~AP4_StdcFileByteStream()
+{
+ if (m_File && m_File != stdin && m_File != stdout && m_File != stderr) {
+ fclose(m_File);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_StdcFileByteStream::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream::Release
++---------------------------------------------------------------------*/
+void
+AP4_StdcFileByteStream::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete m_Delegator;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream::Read
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StdcFileByteStream::Read(void* buffer,
+ AP4_Size bytesToRead,
+ AP4_Size* bytesRead)
+{
+ size_t nbRead;
+
+ nbRead = fread(buffer, 1, bytesToRead, m_File);
+
+ if (nbRead > 0) {
+ if (bytesRead) *bytesRead = nbRead;
+ return AP4_SUCCESS;
+ } else if (feof(m_File)) {
+ if (bytesRead) *bytesRead = 0;
+ return AP4_ERROR_EOS;
+ } else {
+ if (bytesRead) *bytesRead = 0;
+ return AP4_ERROR_READ_FAILED;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StdcFileByteStream::Write(const void* buffer,
+ AP4_Size bytesToWrite,
+ AP4_Size* bytesWritten)
+{
+ size_t nbWritten;
+
+ nbWritten = fwrite(buffer, 1, bytesToWrite, m_File);
+
+ if (nbWritten > 0) {
+ if (bytesWritten) *bytesWritten = nbWritten;
+ return AP4_SUCCESS;
+ } else {
+ if (bytesWritten) *bytesWritten = 0;
+ return AP4_ERROR_WRITE_FAILED;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream::Seek
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StdcFileByteStream::Seek(AP4_Offset offset)
+{
+ size_t result;
+
+ result = fseek(m_File, offset, SEEK_SET);
+ if (result == 0) {
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream::Tell
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StdcFileByteStream::Tell(AP4_Offset& offset)
+{
+ offset = ftell(m_File);
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StdcFileByteStream::GetSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StdcFileByteStream::GetSize(AP4_Size& size)
+{
+ struct stat info;
+ int result;
+
+ result = fstat(fileno(m_File), &info);
+ if (result == 0) {
+ size = info.st_size;
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_FileByteStream::AP4_FileByteStream
++---------------------------------------------------------------------*/
+AP4_FileByteStream::AP4_FileByteStream(const char* name,
+ AP4_FileByteStream::Mode mode)
+{
+ m_Delegate = new AP4_StdcFileByteStream(this, name, mode);
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Config/Ap4Config.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Config/Ap4Config.h
new file mode 100644
index 000000000..2df5db91d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Config/Ap4Config.h
@@ -0,0 +1,69 @@
+/*****************************************************************
+|
+| AP4 - Target Platform and Compiler Configuration
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CONFIG_H_
+#define _AP4_CONFIG_H_
+
+/*----------------------------------------------------------------------
+| defaults
++---------------------------------------------------------------------*/
+#define AP4_CONFIG_HAVE_CPP_STRING_H
+#define AP4_CONFIG_HAVE_STDIO_H
+#define AP4_CONFIG_HAVE_ASSERT_H
+
+#define AP4_CONFIG_HAVE_CPP_STRING
+
+#define AP4_CONFIG_HAVE_SNPRINTF
+
+/*----------------------------------------------------------------------
+| byte order
++---------------------------------------------------------------------*/
+// define AP4_PLATFORM_BYTE_ORDER to one of these two choices
+#define AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN 0
+#define AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN 1
+
+#ifdef __ppc__
+#define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_BIG_ENDIAN
+#endif
+
+#define AP4_PLATFORM_BYTE_ORDER AP4_PLATFORM_BYTE_ORDER_LITTLE_ENDIAN
+
+/*----------------------------------------------------------------------
+| Win32 specifics
++---------------------------------------------------------------------*/
+#ifdef WIN32
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#if defined(_DEBUG)
+#define AP4_DEBUG
+#endif
+#endif
+
+#endif // _AP4_CONFIG_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Atom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Atom.h
new file mode 100644
index 000000000..84e33d4a9
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Atom.h
@@ -0,0 +1,345 @@
+/*****************************************************************
+|
+| AP4 - Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ATOM_H_
+#define _AP4_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4List.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| macros
++---------------------------------------------------------------------*/
+#define AP4_ATOM_TYPE(a,b,c,d) \
+ ((((unsigned long)a)<<24) | \
+ (((unsigned long)b)<<16) | \
+ (((unsigned long)c)<< 8) | \
+ (((unsigned long)d) ))
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_ATOM_HEADER_SIZE = 8;
+const int AP4_FULL_ATOM_HEADER_SIZE = 12;
+const int AP4_ATOM_MAX_NAME_SIZE = 256;
+const int AP4_ATOM_MAX_URI_SIZE = 512;
+
+/*----------------------------------------------------------------------
+| forward references
++---------------------------------------------------------------------*/
+class AP4_AtomParent;
+
+/*----------------------------------------------------------------------
+| AP4_AtomInspector
++---------------------------------------------------------------------*/
+class AP4_AtomInspector {
+public:
+ // types
+ typedef enum {
+ HINT_NONE,
+ HINT_HEX,
+ HINT_BOOLEAN
+ } FormatHint;
+
+ // constructor and destructor
+ AP4_AtomInspector() {}
+ virtual ~AP4_AtomInspector() {}
+
+ // methods
+ virtual void StartElement(const char* name, const char* extra = NULL) {}
+ virtual void EndElement() {}
+ virtual void AddField(const char* name, AP4_UI32 value, FormatHint hint = HINT_NONE) {}
+ virtual void AddField(const char* name, const char* value, FormatHint hint = HINT_NONE) {}
+};
+
+/*----------------------------------------------------------------------
+| AP4_Atom
++---------------------------------------------------------------------*/
+class AP4_Atom {
+ public:
+ // types
+ typedef AP4_UI32 Type;
+
+ // methods
+ AP4_Atom(Type type,
+ bool is_full = false);
+ AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full = false);
+ AP4_Atom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream);
+ virtual ~AP4_Atom() {}
+ Type GetType() { return m_Type; }
+ void SetType(Type type) { m_Type = type; }
+ AP4_Size GetHeaderSize();
+ virtual AP4_Size GetSize() { return m_Size; }
+ virtual AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Result WriteHeader(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream) = 0;
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual AP4_Result InspectHeader(AP4_AtomInspector& inspector);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector) {
+ return AP4_SUCCESS;
+ }
+
+ // parent/child realtionship methods
+ virtual AP4_Result SetParent(AP4_AtomParent* parent) {
+ m_Parent = parent;
+ return AP4_SUCCESS;
+ }
+ virtual AP4_AtomParent* GetParent() { return m_Parent; }
+ virtual AP4_Result Detach();
+
+ // override this if your want to make an atom cloneable
+ virtual AP4_Atom* Clone() { return NULL; }
+
+ protected:
+ // members
+ Type m_Type;
+ AP4_Size m_Size;
+ bool m_IsFull;
+ AP4_UI32 m_Version;
+ AP4_UI32 m_Flags;
+ AP4_AtomParent* m_Parent;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomParent
++---------------------------------------------------------------------*/
+class AP4_AtomParent {
+public:
+ // base methods
+ virtual ~AP4_AtomParent();
+ AP4_List<AP4_Atom>& GetChildren() { return m_Children; }
+ virtual AP4_Result AddChild(AP4_Atom* child, int position = -1);
+ virtual AP4_Result RemoveChild(AP4_Atom* child);
+ virtual AP4_Result DeleteChild(AP4_Atom::Type type);
+ virtual AP4_Atom* GetChild(AP4_Atom::Type type, AP4_Ordinal index = 0);
+ virtual AP4_Atom* FindChild(const char* path,
+ bool auto_create = false);
+
+ // methods designed to be overridden
+ virtual void OnChildChanged(AP4_Atom* child) {}
+ virtual void OnChildAdded(AP4_Atom* child) {}
+ virtual void OnChildRemoved(AP4_Atom* child) {}
+
+protected:
+ // members
+ AP4_List<AP4_Atom> m_Children;
+};
+
+/*----------------------------------------------------------------------
+| AP4_UnknownAtom
++---------------------------------------------------------------------*/
+class AP4_UnknownAtom : public AP4_Atom {
+public:
+ // constructor and destructor
+ AP4_UnknownAtom(AP4_Atom::Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream);
+ ~AP4_UnknownAtom();
+
+ // methods
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+private:
+ // members
+ AP4_ByteStream* m_SourceStream;
+ AP4_Offset m_SourceOffset;
+};
+
+/*----------------------------------------------------------------------
+| atom types
++---------------------------------------------------------------------*/
+const AP4_Atom::Type AP4_ATOM_TYPE_UDTA = AP4_ATOM_TYPE('u','d','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_URL = AP4_ATOM_TYPE('u','r','l',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_TRAK = AP4_ATOM_TYPE('t','r','a','k');
+const AP4_Atom::Type AP4_ATOM_TYPE_TKHD = AP4_ATOM_TYPE('t','k','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_STTS = AP4_ATOM_TYPE('s','t','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSZ = AP4_ATOM_TYPE('s','t','s','z');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSS = AP4_ATOM_TYPE('s','t','s','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSD = AP4_ATOM_TYPE('s','t','s','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_STSC = AP4_ATOM_TYPE('s','t','s','c');
+const AP4_Atom::Type AP4_ATOM_TYPE_STCO = AP4_ATOM_TYPE('s','t','c','o');
+const AP4_Atom::Type AP4_ATOM_TYPE_CO64 = AP4_ATOM_TYPE('c','o','6','4');
+const AP4_Atom::Type AP4_ATOM_TYPE_STBL = AP4_ATOM_TYPE('s','t','b','l');
+const AP4_Atom::Type AP4_ATOM_TYPE_SINF = AP4_ATOM_TYPE('s','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_SCHM = AP4_ATOM_TYPE('s','c','h','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_SCHI = AP4_ATOM_TYPE('s','c','h','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_MVHD = AP4_ATOM_TYPE('m','v','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4S = AP4_ATOM_TYPE('m','p','4','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4A = AP4_ATOM_TYPE('m','p','4','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MP4V = AP4_ATOM_TYPE('m','p','4','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_AVC1 = AP4_ATOM_TYPE('a','v','c','1');
+const AP4_Atom::Type AP4_ATOM_TYPE_ENCA = AP4_ATOM_TYPE('e','n','c','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_ENCV = AP4_ATOM_TYPE('e','n','c','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_MOOV = AP4_ATOM_TYPE('m','o','o','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_MINF = AP4_ATOM_TYPE('m','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_META = AP4_ATOM_TYPE('m','e','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDHD = AP4_ATOM_TYPE('m','d','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_ILST = AP4_ATOM_TYPE('i','l','s','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_HDLR = AP4_ATOM_TYPE('h','d','l','r');
+const AP4_Atom::Type AP4_ATOM_TYPE_FTYP = AP4_ATOM_TYPE('f','t','y','p');
+const AP4_Atom::Type AP4_ATOM_TYPE_ESDS = AP4_ATOM_TYPE('e','s','d','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_EDTS = AP4_ATOM_TYPE('e','d','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_DRMS = AP4_ATOM_TYPE('d','r','m','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_DREF = AP4_ATOM_TYPE('d','r','e','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_DINF = AP4_ATOM_TYPE('d','i','n','f');
+const AP4_Atom::Type AP4_ATOM_TYPE_CTTS = AP4_ATOM_TYPE('c','t','t','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDIA = AP4_ATOM_TYPE('m','d','i','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_VMHD = AP4_ATOM_TYPE('v','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_SMHD = AP4_ATOM_TYPE('s','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_NMHD = AP4_ATOM_TYPE('n','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_HMHD = AP4_ATOM_TYPE('h','m','h','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_FRMA = AP4_ATOM_TYPE('f','r','m','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_MDAT = AP4_ATOM_TYPE('m','d','a','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_FREE = AP4_ATOM_TYPE('f','r','e','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_TIMS = AP4_ATOM_TYPE('t','i','m','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_RTP = AP4_ATOM_TYPE('r','t','p',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_HNTI = AP4_ATOM_TYPE('h','n','t','i');
+const AP4_Atom::Type AP4_ATOM_TYPE_SDP = AP4_ATOM_TYPE('s','d','p',' ');
+const AP4_Atom::Type AP4_ATOM_TYPE_IKMS = AP4_ATOM_TYPE('i','K','M','S');
+const AP4_Atom::Type AP4_ATOM_TYPE_ISFM = AP4_ATOM_TYPE('i','S','F','M');
+const AP4_Atom::Type AP4_ATOM_TYPE_HINT = AP4_ATOM_TYPE('h','i','n','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_TREF = AP4_ATOM_TYPE('t','r','e','f');
+
+const AP4_Atom::Type AP4_ATOM_TYPE_AVCC = AP4_ATOM_TYPE('a','v','c','C');
+const AP4_Atom::Type AP4_ATOM_TYPE_TEXT = AP4_ATOM_TYPE('t','e','x','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_TX3G = AP4_ATOM_TYPE('t','x','3','g');
+const AP4_Atom::Type AP4_ATOM_TYPE_FTAB = AP4_ATOM_TYPE('f','t','a','b');
+const AP4_Atom::Type AP4_ATOM_TYPE_CVID = AP4_ATOM_TYPE('c','v','i','d');
+const AP4_Atom::Type AP4_ATOM_TYPE_SVQ1 = AP4_ATOM_TYPE('S','V','Q','1');
+const AP4_Atom::Type AP4_ATOM_TYPE_SVQ2 = AP4_ATOM_TYPE('S','V','Q','2');
+const AP4_Atom::Type AP4_ATOM_TYPE_SVQ3 = AP4_ATOM_TYPE('S','V','Q','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_H263 = AP4_ATOM_TYPE('h','2','6','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_S263 = AP4_ATOM_TYPE('s','2','6','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_SAMR = AP4_ATOM_TYPE('s','a','m','r');
+const AP4_Atom::Type AP4_ATOM_TYPE__MP3 = AP4_ATOM_TYPE('.','m','p','3');
+const AP4_Atom::Type AP4_ATOM_TYPE_IMA4 = AP4_ATOM_TYPE('i','m','a','4');
+const AP4_Atom::Type AP4_ATOM_TYPE_QDMC = AP4_ATOM_TYPE('Q','D','M','C');
+const AP4_Atom::Type AP4_ATOM_TYPE_QDM2 = AP4_ATOM_TYPE('Q','D','M','2');
+const AP4_Atom::Type AP4_ATOM_TYPE_TWOS = AP4_ATOM_TYPE('t','w','o','s');
+const AP4_Atom::Type AP4_ATOM_TYPE_SOWT = AP4_ATOM_TYPE('s','o','w','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_CHPL = AP4_ATOM_TYPE('c','h','p','l');
+const AP4_Atom::Type AP4_ATOM_TYPE_NAM = AP4_ATOM_TYPE(169,'n','a','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_ART = AP4_ATOM_TYPE(169,'A','R','T');
+const AP4_Atom::Type AP4_ATOM_TYPE_WRT = AP4_ATOM_TYPE(169,'w','r','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_ALB = AP4_ATOM_TYPE(169,'a','l','b');
+const AP4_Atom::Type AP4_ATOM_TYPE_DAY = AP4_ATOM_TYPE(169,'d','a','y');
+const AP4_Atom::Type AP4_ATOM_TYPE_TOO = AP4_ATOM_TYPE(169,'t','o','o');
+const AP4_Atom::Type AP4_ATOM_TYPE_CMT = AP4_ATOM_TYPE(169,'c','m','t');
+const AP4_Atom::Type AP4_ATOM_TYPE_GEN = AP4_ATOM_TYPE(169,'g','e','n');
+const AP4_Atom::Type AP4_ATOM_TYPE_TRKN = AP4_ATOM_TYPE('t','r','k','n');
+const AP4_Atom::Type AP4_ATOM_TYPE_DATA = AP4_ATOM_TYPE('d','a','t','a');
+const AP4_Atom::Type AP4_ATOM_TYPE_WAVE = AP4_ATOM_TYPE('w','a','v','e');
+const AP4_Atom::Type AP4_ATOM_TYPE_CMOV = AP4_ATOM_TYPE('c','m','o','v');
+const AP4_Atom::Type AP4_ATOM_TYPE_DCOM = AP4_ATOM_TYPE('d','c','o','m');
+const AP4_Atom::Type AP4_ATOM_TYPE_CMVD = AP4_ATOM_TYPE('c','m','v','d');
+
+/*----------------------------------------------------------------------
+| AP4_AtomListInspector
++---------------------------------------------------------------------*/
+class AP4_AtomListInspector : public AP4_List<AP4_Atom>::Item::Operator
+{
+ public:
+ AP4_AtomListInspector(AP4_AtomInspector& inspector) :
+ m_Inspector(inspector) {}
+ AP4_Result Action(AP4_Atom* atom) const {
+ atom->Inspect(m_Inspector);
+ return AP4_SUCCESS;
+ }
+
+ private:
+ AP4_AtomInspector& m_Inspector;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomListWriter
++---------------------------------------------------------------------*/
+class AP4_AtomListWriter : public AP4_List<AP4_Atom>::Item::Operator
+{
+ public:
+ AP4_AtomListWriter(AP4_ByteStream& stream) :
+ m_Stream(stream) {}
+ AP4_Result Action(AP4_Atom* atom) const {
+ atom->Write(m_Stream);
+ return AP4_SUCCESS;
+ }
+
+ private:
+ AP4_ByteStream& m_Stream;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomFinder
++---------------------------------------------------------------------*/
+class AP4_AtomFinder : public AP4_List<AP4_Atom>::Item::Finder
+{
+ public:
+ AP4_AtomFinder(AP4_Atom::Type type, AP4_Ordinal index = 0) :
+ m_Type(type), m_Index(index) {}
+ AP4_Result Test(AP4_Atom* atom) const {
+ if (atom->GetType() == m_Type) {
+ if (m_Index-- == 0) {
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+ private:
+ AP4_Atom::Type m_Type;
+ mutable AP4_Ordinal m_Index;
+};
+
+/*----------------------------------------------------------------------
+| AP4_AtomSizeAdder
++---------------------------------------------------------------------*/
+class AP4_AtomSizeAdder : public AP4_List<AP4_Atom>::Item::Operator {
+public:
+ AP4_AtomSizeAdder(AP4_Size& size) : m_Size(size) {}
+
+private:
+ AP4_Result Action(AP4_Atom* atom) const {
+ m_Size += atom->GetSize();
+ return AP4_SUCCESS;
+ }
+ AP4_Size& m_Size;
+};
+
+#endif // _AP4_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomFactory.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomFactory.cpp
new file mode 100644
index 000000000..efb9d13b3
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomFactory.cpp
@@ -0,0 +1,456 @@
+/*****************************************************************
+|
+| AP4 - Atom Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4SampleEntry.h"
+#include "Ap4IsmaCryp.h"
+#include "Ap4UrlAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4DrefAtom.h"
+#include "Ap4TkhdAtom.h"
+#include "Ap4MdhdAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4StscAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4Co64Atom.h"
+#include "Ap4StszAtom.h"
+#include "Ap4EsdsAtom.h"
+#include "Ap4SttsAtom.h"
+#include "Ap4CttsAtom.h"
+#include "Ap4StssAtom.h"
+#include "Ap4FtypAtom.h"
+#include "Ap4VmhdAtom.h"
+#include "Ap4SmhdAtom.h"
+#include "Ap4NmhdAtom.h"
+#include "Ap4HmhdAtom.h"
+#include "Ap4SchmAtom.h"
+#include "Ap4FrmaAtom.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4RtpAtom.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4IkmsAtom.h"
+#include "Ap4IsfmAtom.h"
+#include "Ap4TrefTypeAtom.h"
+#include "Ap4AvcCAtom.h"
+#include "Ap4FtabAtom.h"
+#include "Ap4ChplAtom.h"
+#include "Ap4DataAtom.h"
+#include "Ap4DcomAtom.h"
+#include "Ap4CmvdAtom.h"
+
+/*----------------------------------------------------------------------
+| class variables
++---------------------------------------------------------------------*/
+AP4_AtomFactory AP4_AtomFactory::DefaultFactory;
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::AddTypeHandler
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::AddTypeHandler(TypeHandler* handler)
+{
+ return m_TypeHandlers.Add(handler);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::RemoveTypeHandler
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::RemoveTypeHandler(TypeHandler* handler)
+{
+ return m_TypeHandlers.Remove(handler);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::CreateAtomFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Atom*& atom)
+{
+ AP4_Size bytes_available = 0;
+ if (AP4_FAILED(stream.GetSize(bytes_available)) ||
+ bytes_available == 0) {
+ bytes_available = (AP4_Size)((unsigned long)(-1));
+ }
+ return CreateAtomFromStream(stream, bytes_available, atom, NULL);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory::CreateAtomFromStream
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomFactory::CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Size& bytes_available,
+ AP4_Atom*& atom,
+ AP4_Atom* parent)
+{
+ AP4_Result result;
+
+ // NULL by default
+ atom = NULL;
+
+ // check that there are enough bytes for at least a header
+ if (bytes_available < 8) return AP4_ERROR_EOS;
+
+ // remember current stream offset
+ AP4_Offset start;
+ stream.Tell(start);
+
+ // read atom size
+ AP4_UI32 size;
+ result = stream.ReadUI32(size);
+ if (AP4_FAILED(result)) {
+ stream.Seek(start);
+ return result;
+ }
+
+ if (size == 0) {
+ // atom extends to end of file
+ AP4_Size streamSize = 0;
+ stream.GetSize(streamSize);
+ if (streamSize >= start) {
+ size = streamSize - start;
+ }
+ }
+
+ // check the size (we don't handle extended size yet)
+ if (size != 1 && size < 8 || size > bytes_available) {
+ stream.Seek(start);
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+
+ // read atom type
+ AP4_Atom::Type type;
+ result = stream.ReadUI32(type);
+ if (AP4_FAILED(result)) {
+ stream.Seek(start);
+ return result;
+ }
+
+ if (size == 1)
+ {
+ AP4_UI32 size_high;
+
+ result = stream.ReadUI32(size_high);
+ if (AP4_FAILED(result) || size_high) {
+ stream.Seek(start);
+ return AP4_ERROR_INVALID_FORMAT;
+ }
+
+ result = stream.ReadUI32(size);
+ if (AP4_FAILED(result)) {
+ stream.Seek(start);
+ return result;
+ }
+ }
+
+ // create the atom
+ switch (type) {
+ case AP4_ATOM_TYPE_MOOV:
+ atom = new AP4_MoovAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_MVHD:
+ atom = new AP4_MvhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_TRAK:
+ atom = new AP4_TrakAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_HDLR:
+ atom = new AP4_HdlrAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_DREF:
+ atom = new AP4_DrefAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_URL:
+ atom = new AP4_UrlAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_TKHD:
+ atom = new AP4_TkhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_MDHD:
+ atom = new AP4_MdhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STSD:
+ atom = new AP4_StsdAtom(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_STSC:
+ atom = new AP4_StscAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STCO:
+ atom = new AP4_StcoAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CO64:
+ atom = new AP4_Co64Atom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STSZ:
+ atom = new AP4_StszAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STTS:
+ atom = new AP4_SttsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CTTS:
+ atom = new AP4_CttsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_STSS:
+ atom = new AP4_StssAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_MP4S:
+ atom = new AP4_Mp4sSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_MP4A:
+ atom = parent && parent->GetType() == AP4_ATOM_TYPE_STSD
+ ? (AP4_Atom*)new AP4_Mp4aSampleEntry(size, stream, *this)
+ : (AP4_Atom*)new AP4_UnknownAtom(type, size, false, stream);
+ break;
+
+ case AP4_ATOM_TYPE_MP4V:
+ atom = new AP4_Mp4vSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_AVC1:
+ atom = new AP4_Avc1SampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_ENCA:
+ atom = new AP4_EncaSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_ENCV:
+ atom = new AP4_EncvSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_ESDS:
+ atom = new AP4_EsdsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_VMHD:
+ atom = new AP4_VmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_SMHD:
+ atom = new AP4_SmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_NMHD:
+ atom = new AP4_NmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_HMHD:
+ atom = new AP4_HmhdAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_FRMA:
+ atom = new AP4_FrmaAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_SCHM:
+ atom = new AP4_SchmAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_FTYP:
+ atom = new AP4_FtypAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_RTP:
+ if (m_Context == AP4_ATOM_TYPE_HNTI) {
+ atom = new AP4_RtpAtom(size, stream);
+ } else {
+ atom = new AP4_RtpHintSampleEntry(size, stream, *this);
+ }
+ break;
+
+ case AP4_ATOM_TYPE_TIMS:
+ atom = new AP4_TimsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_SDP:
+ atom = new AP4_SdpAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_IKMS:
+ atom = new AP4_IkmsAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_ISFM:
+ atom = new AP4_IsfmAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_HINT:
+ atom = new AP4_TrefTypeAtom(type, size, stream);
+ break;
+
+ // container atoms
+ case AP4_ATOM_TYPE_TREF:
+ case AP4_ATOM_TYPE_HNTI:
+ case AP4_ATOM_TYPE_STBL:
+ case AP4_ATOM_TYPE_MDIA:
+ case AP4_ATOM_TYPE_DINF:
+ case AP4_ATOM_TYPE_MINF:
+ case AP4_ATOM_TYPE_SCHI:
+ case AP4_ATOM_TYPE_SINF:
+ case AP4_ATOM_TYPE_UDTA:
+ case AP4_ATOM_TYPE_ILST:
+ case AP4_ATOM_TYPE_NAM:
+ case AP4_ATOM_TYPE_ART:
+ case AP4_ATOM_TYPE_WRT:
+ case AP4_ATOM_TYPE_ALB:
+ case AP4_ATOM_TYPE_DAY:
+ case AP4_ATOM_TYPE_TOO:
+ case AP4_ATOM_TYPE_CMT:
+ case AP4_ATOM_TYPE_GEN:
+ case AP4_ATOM_TYPE_TRKN:
+ case AP4_ATOM_TYPE_EDTS:
+ case AP4_ATOM_TYPE_WAVE:
+ case AP4_ATOM_TYPE_CMOV: {
+ AP4_UI32 context = m_Context;
+ m_Context = type; // set the context for the children
+ atom = new AP4_ContainerAtom(type, size, false, stream, *this);
+ m_Context = context; // restore the previous context
+ break;
+ }
+
+ // full container atoms
+ case AP4_ATOM_TYPE_META:
+ atom = new AP4_ContainerAtom(type, size, true, stream, *this);
+ break;
+
+ // other
+
+ case AP4_ATOM_TYPE_AVCC:
+ atom = new AP4_AvcCAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_TEXT:
+ atom = new AP4_TextSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_TX3G:
+ atom = new AP4_Tx3gSampleEntry(size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_FTAB:
+ atom = new AP4_FtabAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CVID:
+ case AP4_ATOM_TYPE_SVQ1:
+ case AP4_ATOM_TYPE_SVQ2:
+ case AP4_ATOM_TYPE_SVQ3:
+ case AP4_ATOM_TYPE_H263:
+ case AP4_ATOM_TYPE_S263:
+ atom = new AP4_VisualSampleEntry(type, size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_SAMR:
+ case AP4_ATOM_TYPE__MP3:
+ case AP4_ATOM_TYPE_IMA4:
+ case AP4_ATOM_TYPE_QDMC:
+ case AP4_ATOM_TYPE_QDM2:
+ case AP4_ATOM_TYPE_TWOS:
+ case AP4_ATOM_TYPE_SOWT:
+ atom = new AP4_AudioSampleEntry(type, size, stream, *this);
+ break;
+
+ case AP4_ATOM_TYPE_CHPL:
+ atom = new AP4_ChplAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_DATA:
+ atom = new AP4_DataAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_DCOM:
+ atom = new AP4_DcomAtom(size, stream);
+ break;
+
+ case AP4_ATOM_TYPE_CMVD:
+ atom = new AP4_CmvdAtom(size, stream, *this);
+ break;
+
+ default:
+
+ if(parent && parent->GetType() == AP4_ATOM_TYPE_STSD && (type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0))
+ {
+ atom = new AP4_AudioSampleEntry(type, size, stream, *this);
+ }
+ else // try all the external type handlers
+ {
+ atom = NULL;
+ AP4_List<TypeHandler>::Item* handler_item = m_TypeHandlers.FirstItem();
+ while (handler_item) {
+ TypeHandler* handler = handler_item->GetData();
+ if (AP4_SUCCEEDED(handler->CreateAtom(type, size, stream, atom))) {
+ break;
+ }
+ handler_item = handler_item->GetNext();
+ }
+ if (atom == NULL) {
+ // no custom handlers, create a generic atom
+ atom = new AP4_UnknownAtom(type, size, false, stream);
+ }
+ }
+
+ break;
+ }
+
+ // skip to the end of the atom
+ bytes_available -= size;
+ result = stream.Seek(start+size);
+ if (AP4_FAILED(result)) {
+ delete atom;
+ atom = NULL;
+ }
+
+ return result;
+}
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomFactory.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomFactory.h
new file mode 100644
index 000000000..f8faf5813
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomFactory.h
@@ -0,0 +1,84 @@
+/*****************************************************************
+|
+| AP4 - Atom Factory
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ATOM_FACTORY_H_
+#define _AP4_ATOM_FACTORY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_ByteStream;
+
+/*----------------------------------------------------------------------
+| AP4_AtomFactory
++---------------------------------------------------------------------*/
+class AP4_AtomFactory {
+ public:
+ // types
+ class TypeHandler {
+ public:
+ virtual ~TypeHandler() {};
+ virtual AP4_Result CreateAtom(AP4_Atom::Type type,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_Atom*& atom) = 0;
+ };
+
+ // class members
+ static AP4_AtomFactory DefaultFactory;
+
+ // constructor
+ AP4_AtomFactory() : m_Context(0) {}
+
+ // methods
+ AP4_Result AddTypeHandler(TypeHandler* handler);
+ AP4_Result RemoveTypeHandler(TypeHandler* handler);
+ AP4_Result CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Size& bytes_available,
+ AP4_Atom*& atom,
+ AP4_Atom* parent);
+ AP4_Result CreateAtomFromStream(AP4_ByteStream& stream,
+ AP4_Atom*& atom);
+
+ // context
+ void SetContext(AP4_Atom::Type context) { m_Context = context; }
+ AP4_Atom::Type GetContext() const { return m_Context; }
+
+private:
+ // members
+ AP4_Atom::Type m_Context;
+ AP4_List<TypeHandler> m_TypeHandlers;
+};
+
+#endif // _AP4_ATOM_FACTORY_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomSampleTable.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomSampleTable.cpp
new file mode 100644
index 000000000..c142d0193
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomSampleTable.cpp
@@ -0,0 +1,266 @@
+/*****************************************************************
+|
+| AP4 - Atom Based Sample Tables
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This atom is part of AP4 (MP4 Audio Proatom Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the atom COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4AtomSampleTable.h"
+#include "Ap4ByteStream.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4StscAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4Co64Atom.h"
+#include "Ap4StszAtom.h"
+#include "Ap4SttsAtom.h"
+#include "Ap4CttsAtom.h"
+#include "Ap4StssAtom.h"
+#include "Ap4Sample.h"
+#include "Ap4SampleEntry.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::AP4_AtomSampleTable
++---------------------------------------------------------------------*/
+AP4_AtomSampleTable::AP4_AtomSampleTable(AP4_ContainerAtom* stbl,
+ AP4_ByteStream& sample_stream) :
+ m_SampleStream(sample_stream)
+{
+ m_StscAtom = dynamic_cast<AP4_StscAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSC));
+ m_StcoAtom = dynamic_cast<AP4_StcoAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STCO));
+ m_Co64Atom = dynamic_cast<AP4_Co64Atom*>(stbl->GetChild(AP4_ATOM_TYPE_CO64));
+ m_StszAtom = dynamic_cast<AP4_StszAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSZ));
+ m_CttsAtom = dynamic_cast<AP4_CttsAtom*>(stbl->GetChild(AP4_ATOM_TYPE_CTTS));
+ m_SttsAtom = dynamic_cast<AP4_SttsAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STTS));
+ m_StssAtom = dynamic_cast<AP4_StssAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSS));
+ m_StsdAtom = dynamic_cast<AP4_StsdAtom*>(stbl->GetChild(AP4_ATOM_TYPE_STSD));
+
+ // keep a reference to the sample stream
+ m_SampleStream.AddReference();
+
+ if(m_StsdAtom && m_StszAtom && m_StscAtom && m_SttsAtom
+ && m_StszAtom->m_SampleSize == 1)
+ {
+ // fix mov files
+ for(AP4_List<AP4_Atom>::Item* item = m_StsdAtom->GetChildren().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ AP4_Atom* atom = item->GetData();
+
+ if(AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom))
+ {
+ AP4_UI32 SamplesPerPacket = ase->GetSamplesPerPacket();
+ AP4_UI32 BytesPerFrame = ase->GetBytesPerFrame();
+
+ if(SamplesPerPacket > 0 && BytesPerFrame > 0)
+ {
+ for(int i = 0, j = m_StscAtom->m_Entries.ItemCount(); i < j; i++)
+ {
+ AP4_StscTableEntry& e = m_StscAtom->m_Entries[i];
+ AP4_ASSERT(e.m_SamplesPerChunk % SamplesPerPacket == 0);
+ e.m_SamplesPerChunk = e.m_SamplesPerChunk / SamplesPerPacket;
+ e.m_FirstSample = (e.m_FirstSample-1) / SamplesPerPacket + 1;
+ }
+
+ AP4_ASSERT(m_StszAtom->m_SampleCount % SamplesPerPacket == 0);
+ m_StszAtom->m_SampleCount = m_StszAtom->m_SampleCount / SamplesPerPacket;
+ m_StszAtom->m_SampleSize = BytesPerFrame;
+
+ AP4_ASSERT(m_SttsAtom->m_Entries.ItemCount() == 1);
+ m_SttsAtom->m_Entries[0].m_SampleCount = m_StszAtom->m_SampleCount;
+ m_SttsAtom->m_Entries[0].m_SampleDuration = SamplesPerPacket;
+ }
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::~AP4_AtomSampleTable
++---------------------------------------------------------------------*/
+AP4_AtomSampleTable::~AP4_AtomSampleTable()
+{
+ m_SampleStream.Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetSample(AP4_Ordinal index,
+ AP4_Sample& sample)
+{
+ AP4_Result result;
+
+ // MP4 uses 1-based indexes internally, so adjust by one
+ index++;
+
+ // find out in which chunk this sample is located
+ AP4_Ordinal chunk, skip, desc;
+ result = m_StscAtom->GetChunkForSample(index, chunk, skip, desc);
+ if (AP4_FAILED(result)) return result;
+
+ // check that the result is within bounds
+ if (skip > index) return AP4_ERROR_INTERNAL;
+
+ // get the atom offset for this chunk
+ AP4_Offset offset;
+ if (m_StcoAtom) result = m_StcoAtom->GetChunkOffset(chunk, offset);
+ else if (m_Co64Atom) result = m_Co64Atom->GetChunkOffset(chunk, offset);
+ else result = AP4_ERROR_INTERNAL;
+ if (AP4_FAILED(result)) return result;
+/*
+ // compute the additional offset inside the chunk
+ for (unsigned int i = index-skip; i < index; i++) {
+ AP4_Size size;
+ result = m_StszAtom->GetSampleSize(i, size);
+ if (AP4_FAILED(result)) return result;
+ offset += size;
+ }
+*/
+ AP4_Size size;
+ result = m_StszAtom->GetSampleSize(index - skip, index, size);
+ if (AP4_FAILED(result)) return result;
+ offset += size;
+
+ // set the description index
+ sample.SetDescriptionIndex(desc-1); // adjust for 0-based indexes
+
+ // set the dts and cts
+ AP4_TimeStamp dts;
+ AP4_Duration duration;
+ result = m_SttsAtom->GetDts(index, dts, duration);
+ if (AP4_FAILED(result)) return result;
+ sample.SetDts(dts);
+ sample.SetDuration(duration);
+ if (m_CttsAtom == NULL) {
+ sample.SetCts(dts);
+ } else {
+ AP4_UI32 cts_offset;
+ result = m_CttsAtom->GetCtsOffset(index, cts_offset);
+ if (AP4_FAILED(result)) return result;
+ sample.SetCts(dts + *((signed long*)&cts_offset)); // HACK: it shouldn't be signed, but such files exist unfortunatelly
+ }
+
+ // set the size
+ AP4_Size sample_size;
+ result = m_StszAtom->GetSampleSize(index, sample_size);
+ if (AP4_FAILED(result)) return result;
+ sample.SetSize(sample_size);
+
+ // set the offset
+ sample.SetOffset(offset);
+
+ // set the data stream
+ sample.SetDataStream(m_SampleStream);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_AtomSampleTable::GetSampleCount()
+{
+ return m_StszAtom ? m_StszAtom->GetSampleCount() : 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_AtomSampleTable::GetSampleDescription(AP4_Ordinal index)
+{
+ return m_StsdAtom ? m_StsdAtom->GetSampleDescription(index) : NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSampleDescriptionCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_AtomSampleTable::GetSampleDescriptionCount()
+{
+ return m_StsdAtom ? m_StsdAtom->GetSampleDescriptionCount() : 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetChunkForSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description)
+{
+ return m_StscAtom ? m_StscAtom->GetChunkForSample(sample, chunk, skip, sample_description) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& offset)
+{
+ return
+ m_StcoAtom ? m_StcoAtom->GetChunkOffset(chunk, offset) :
+ m_Co64Atom ? m_Co64Atom->GetChunkOffset(chunk, offset) :
+ AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::SetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::SetChunkOffset(AP4_Ordinal chunk, AP4_Offset offset)
+{
+ return
+ m_StcoAtom ? m_StcoAtom->SetChunkOffset(chunk, offset) :
+ m_Co64Atom ? m_Co64Atom->SetChunkOffset(chunk, offset) :
+ AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::SetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::SetSampleSize(AP4_Ordinal sample, AP4_Size size)
+{
+ return m_StszAtom ? m_StszAtom->SetSampleSize(sample, size) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AtomSampleTable::GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index)
+{
+ return m_SttsAtom ? m_SttsAtom->GetSampleIndexForTimeStamp(ts, index)
+ : AP4_FAILURE;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomSampleTable.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomSampleTable.h
new file mode 100644
index 000000000..68a71d13b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AtomSampleTable.h
@@ -0,0 +1,91 @@
+/*****************************************************************
+|
+| AP4 - Atom Based Sample Table
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This atom is part of AP4 (MP4 Audio Proatom Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the atom COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_ATOM_SAMPLE_TABLE_H_
+#define _AP4_ATOM_SAMPLE_TABLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_Atom;
+class AP4_ByteStream;
+class AP4_StscAtom;
+class AP4_StcoAtom;
+class AP4_Co64Atom;
+class AP4_StszAtom;
+class AP4_SttsAtom;
+class AP4_CttsAtom;
+class AP4_StssAtom;
+class AP4_StsdAtom;
+
+/*----------------------------------------------------------------------
+| AP4_AtomSampleTable
++---------------------------------------------------------------------*/
+class AP4_AtomSampleTable : public AP4_SampleTable
+{
+ public:
+ // methods
+ AP4_AtomSampleTable(AP4_ContainerAtom* stbl_atom,
+ AP4_ByteStream& sample_stream);
+ virtual ~AP4_AtomSampleTable();
+
+ // AP4_SampleTable methods
+ virtual AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
+ virtual AP4_Cardinal GetSampleCount();
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ virtual AP4_Cardinal GetSampleDescriptionCount();
+ virtual AP4_Result GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description);
+ virtual AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& offset);
+ virtual AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_Offset offset);
+ virtual AP4_Result SetSampleSize(AP4_Ordinal sample, AP4_Size size);
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& index);
+
+private:
+ // members
+ AP4_ByteStream& m_SampleStream;
+ AP4_StscAtom* m_StscAtom;
+ AP4_StcoAtom* m_StcoAtom;
+ AP4_Co64Atom* m_Co64Atom;
+ AP4_StszAtom* m_StszAtom;
+ AP4_SttsAtom* m_SttsAtom;
+ AP4_CttsAtom* m_CttsAtom;
+ AP4_StsdAtom* m_StsdAtom;
+ AP4_StssAtom* m_StssAtom;
+};
+
+#endif // _AP4_ATOM_SAMPLE_TABLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AvcCAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AvcCAtom.cpp
new file mode 100644
index 000000000..52738ea75
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AvcCAtom.cpp
@@ -0,0 +1,46 @@
+/*****************************************************************
+|
+| AP4 - avcC Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4AvcCAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_AvcCAtom::AP4_AvcCAtom
++---------------------------------------------------------------------*/
+
+AP4_AvcCAtom::AP4_AvcCAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_AVCC)
+{
+ size -= AP4_ATOM_HEADER_SIZE;
+ m_DecoderInfo.SetDataSize(size);
+ stream.Read(m_DecoderInfo.UseData(), size);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AvcCAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AvcCAtom.h
new file mode 100644
index 000000000..00acf7e9e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4AvcCAtom.h
@@ -0,0 +1,57 @@
+/*****************************************************************
+|
+| AP4 - avcC Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_AVCC_ATOM_H_
+#define _AP4_AVCC_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_AvcCAtom
++---------------------------------------------------------------------*/
+class AP4_AvcCAtom : public AP4_Atom
+{
+public:
+ AP4_AvcCAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ const AP4_DataBuffer* GetDecoderInfo() const { return &m_DecoderInfo; }
+
+private:
+ AP4_DataBuffer m_DecoderInfo;
+};
+
+#endif // _AP4_AVCC_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ByteStream.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ByteStream.cpp
new file mode 100644
index 000000000..2e7052ab4
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ByteStream.cpp
@@ -0,0 +1,573 @@
+/*****************************************************************
+|
+| AP4 - Byte Stream support
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4ByteStream.h"
+#include "Ap4Utils.h"
+#include "Ap4Debug.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_BYTE_STREAM_COPY_BUFFER_SIZE = 4096;
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteString
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteString(const char* buffer)
+{
+ AP4_Size string_length = static_cast<AP4_Size>(strlen(buffer));
+
+ // shortcut
+ if ((buffer == NULL) || (string_length == 0)) return AP4_SUCCESS;
+
+ // write the string
+ return Write((const void*)buffer, string_length);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI64
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI64(AP4_UI64 value)
+{
+ unsigned char buffer[8];
+
+ // convert value to bytes
+ AP4_BytesFromUInt64BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 8);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI32
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI32(AP4_UI32 value)
+{
+ unsigned char buffer[4];
+
+ // convert value to bytes
+ AP4_BytesFromUInt32BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 4);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI24
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI24(AP4_UI32 value)
+{
+ unsigned char buffer[3];
+
+ // convert value to bytes
+ AP4_BytesFromUInt24BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 3);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI16
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI16(AP4_UI16 value)
+{
+ unsigned char buffer[2];
+
+ // convert value to bytes
+ AP4_BytesFromUInt16BE(buffer, value);
+
+ // write bytes to the stream
+ return Write((void*)buffer, 2);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::WriteUI08
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::WriteUI08(AP4_UI08 value)
+{
+ return Write((void*)&value, 1);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI64
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI64(AP4_UI64& value)
+{
+ unsigned char buffer[8];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 8);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt64BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI32
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI32(AP4_UI32& value)
+{
+ unsigned char buffer[4];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 4);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt32BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI24
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI24(AP4_UI32& value)
+{
+ unsigned char buffer[3];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 3);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt24BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI16
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI16(AP4_UI16& value)
+{
+ unsigned char buffer[2];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 2);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = AP4_BytesToUInt16BE(buffer);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadUI08
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadUI08(AP4_UI08& value)
+{
+ unsigned char buffer[1];
+
+ // read bytes from the stream
+ AP4_Result result;
+ result = Read((void*)buffer, 1);
+ if (AP4_FAILED(result)) {
+ value = 0;
+ return result;
+ }
+
+ // convert bytes to value
+ value = buffer[0];
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::ReadString
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::ReadString(char* buffer, AP4_Size size)
+{
+ if (buffer == NULL || size == 0) {
+ return AP4_ERROR_INVALID_PARAMETERS;
+ }
+
+ AP4_Size bytes_read = 0;
+ while (bytes_read < size-1) {
+ AP4_Result result;
+ result = Read(&buffer[bytes_read], 1, NULL);
+ if (AP4_FAILED(result)) {
+ buffer[bytes_read] = '\0';
+ return result;
+ }
+ if (buffer[bytes_read] == '\0') {
+ // end of string
+ return AP4_SUCCESS;
+ }
+ bytes_read++;
+ }
+
+ // the string was not null terminated, terminate it
+ buffer[size-1] = '\0';
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream::CopyTo
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ByteStream::CopyTo(AP4_ByteStream& stream, AP4_Size size)
+{
+ unsigned char buffer[AP4_BYTE_STREAM_COPY_BUFFER_SIZE];
+ while (size) {
+ AP4_Size bytes_read;
+ AP4_Size bytes_to_read;
+ AP4_Result result;
+
+ // decide how much to read
+ if (size >= sizeof(buffer)) {
+ bytes_to_read = sizeof(buffer);
+ } else {
+ bytes_to_read = size;
+ }
+
+ // read up to one buffer full
+ result = Read(buffer, bytes_to_read, &bytes_read);
+ if (AP4_FAILED(result)) return result;
+
+ // copy to destination
+ if (bytes_read != 0) {
+ result = stream.Write(buffer, bytes_read);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // update the size
+ size -= bytes_read;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::AP4_SubStream
++---------------------------------------------------------------------*/
+AP4_SubStream::AP4_SubStream(AP4_ByteStream& container,
+ AP4_Offset offset,
+ AP4_Size size) :
+ m_Container(container),
+ m_Offset(offset),
+ m_Size(size),
+ m_Position(0),
+ m_ReferenceCount(1)
+{
+ m_Container.AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::~AP4_SubStream
++---------------------------------------------------------------------*/
+AP4_SubStream::~AP4_SubStream()
+{
+ m_Container.Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Read
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SubStream::Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read)
+{
+ // default values
+ if (bytes_read) *bytes_read = 0;
+
+ // shortcut
+ if (bytes_to_read == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_read > m_Size) {
+ bytes_to_read = m_Size - m_Position;
+ }
+
+ // check for end of substream
+ if (bytes_to_read == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // seek inside container
+ //AP4_Result result;
+ //result = m_Container.Seek(m_Offset+m_Position);
+ //if (AP4_FAILED(result)) {
+ // return result;
+ //}
+
+ // read from the container
+ AP4_Size local_bytes_read;
+ AP4_Result result = m_Container.Read(buffer, bytes_to_read, &local_bytes_read);
+ if (bytes_read) *bytes_read = local_bytes_read;
+ if (AP4_SUCCEEDED(result)) {
+ m_Position += local_bytes_read;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SubStream::Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written)
+{
+ // default values
+ if (bytes_written) *bytes_written = 0;
+
+ // shortcut
+ if (bytes_to_write == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_write > m_Size) {
+ bytes_to_write = m_Size - m_Position;
+ }
+
+ // check for en of substream
+ if (bytes_to_write == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // seek inside container
+ //AP4_Result result;
+ //result = m_Container.Seek(m_Offset+m_Position);
+ //if (AP4_FAILED(result)) return result;
+
+ // write to container
+ AP4_Size local_bytes_written;
+ AP4_Result result = m_Container.Write(buffer, bytes_to_write, &local_bytes_written);
+ if (bytes_written) *bytes_written = local_bytes_written;
+ if (AP4_SUCCEEDED(result)) {
+ m_Position += local_bytes_written;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Seek
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SubStream::Seek(AP4_Offset offset)
+{
+ if (offset > m_Size) return AP4_FAILURE;
+ AP4_Result result;
+ result = m_Container.Seek(m_Offset+offset);
+ if (AP4_SUCCEEDED(result)) {
+ m_Position = offset;
+ }
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_SubStream::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SubStream::Release
++---------------------------------------------------------------------*/
+void
+AP4_SubStream::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_Size size) :
+ m_BufferIsLocal(true),
+ m_Size(size),
+ m_Position(0),
+ m_ReferenceCount(1)
+{
+ m_Buffer = new AP4_UI08[size];
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+AP4_MemoryByteStream::AP4_MemoryByteStream(AP4_UI08* buffer, AP4_Size size) :
+ m_BufferIsLocal(false),
+ m_Buffer(buffer),
+ m_Size(size),
+ m_Position(0),
+ m_ReferenceCount(1)
+{}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::~AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+AP4_MemoryByteStream::~AP4_MemoryByteStream()
+{
+ if (m_BufferIsLocal) delete[] m_Buffer;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Read
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MemoryByteStream::Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read)
+{
+ // default values
+ if (bytes_read) *bytes_read = 0;
+
+ // shortcut
+ if (bytes_to_read == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_read > m_Size) {
+ bytes_to_read = m_Size - m_Position;
+ }
+
+ // check for end of stream
+ if (bytes_to_read == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // read from the memory
+ memcpy(buffer, &m_Buffer[m_Position], bytes_to_read);
+ m_Position += bytes_to_read;
+
+ if (bytes_read) *bytes_read = bytes_to_read;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MemoryByteStream::Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written)
+{
+ // default values
+ if (bytes_written) *bytes_written = 0;
+
+ // shortcut
+ if (bytes_to_write == 0) {
+ return AP4_SUCCESS;
+ }
+
+ // clamp to range
+ if (m_Position+bytes_to_write > m_Size) {
+ bytes_to_write = m_Size - m_Position;
+ }
+
+ // check for en of stream
+ if (bytes_to_write == 0) {
+ return AP4_ERROR_EOS;
+ }
+
+ // write to memory
+ memcpy(&m_Buffer[m_Position], buffer, bytes_to_write);
+ m_Position += bytes_to_write;
+
+ if (bytes_written) *bytes_written = bytes_to_write;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Seek
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MemoryByteStream::Seek(AP4_Offset offset)
+{
+ if (offset > m_Size) return AP4_FAILURE;
+ m_Position = offset;
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::AddReference
++---------------------------------------------------------------------*/
+void
+AP4_MemoryByteStream::AddReference()
+{
+ m_ReferenceCount++;
+}
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream::Release
++---------------------------------------------------------------------*/
+void
+AP4_MemoryByteStream::Release()
+{
+ if (--m_ReferenceCount == 0) {
+ delete this;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ByteStream.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ByteStream.h
new file mode 100644
index 000000000..2e0e99deb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ByteStream.h
@@ -0,0 +1,154 @@
+/*****************************************************************
+|
+| AP4 - ByteStream Interface
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_BYTE_STREAM_H_
+#define _AP4_BYTE_STREAM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Types.h"
+#include "Ap4Interfaces.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| AP4_ByteStream
++---------------------------------------------------------------------*/
+class AP4_ByteStream : public AP4_Referenceable
+{
+ public:
+ // methods
+ virtual AP4_Result Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read = 0) = 0;
+ virtual AP4_Result ReadUI64(AP4_UI64& value);
+ virtual AP4_Result ReadUI32(AP4_UI32& value);
+ virtual AP4_Result ReadUI24(AP4_UI32& value);
+ virtual AP4_Result ReadUI16(AP4_UI16& value);
+ virtual AP4_Result ReadUI08(AP4_UI08& value);
+ virtual AP4_Result ReadString(char* buffer, AP4_Size size);
+ virtual AP4_Result Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written = 0) = 0;
+ virtual AP4_Result WriteString(const char* stringBuffer);
+ virtual AP4_Result WriteUI64(AP4_UI64 value);
+ virtual AP4_Result WriteUI32(AP4_UI32 value);
+ virtual AP4_Result WriteUI24(AP4_UI32 value);
+ virtual AP4_Result WriteUI16(AP4_UI16 value);
+ virtual AP4_Result WriteUI08(AP4_UI08 value);
+ virtual AP4_Result Seek(AP4_Offset offset) = 0;
+ virtual AP4_Result Tell(AP4_Offset& offset) = 0;
+ virtual AP4_Result GetSize(AP4_Size& size) = 0;
+ virtual AP4_Result CopyTo(AP4_ByteStream& stream, AP4_Size size);
+};
+
+/*----------------------------------------------------------------------
+| AP4_SubStream
++---------------------------------------------------------------------*/
+class AP4_SubStream : public AP4_ByteStream
+{
+ public:
+ AP4_SubStream(AP4_ByteStream& container, AP4_Offset offset, AP4_Size size);
+
+ // AP4_ByteStream methods
+ AP4_Result Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read = 0);
+ AP4_Result Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written = 0);
+ AP4_Result Seek(AP4_Offset offset);
+ AP4_Result Tell(AP4_Offset& offset) {
+ offset = m_Position;
+ return AP4_SUCCESS;
+ }
+ AP4_Result GetSize(AP4_Size& size) {
+ size = m_Size;
+ return AP4_SUCCESS;
+ }
+
+ // AP4_Referenceable methods
+ void AddReference();
+ void Release();
+
+ protected:
+ virtual ~AP4_SubStream();
+
+ private:
+ AP4_ByteStream& m_Container;
+ AP4_Offset m_Offset;
+ AP4_Size m_Size;
+ AP4_Offset m_Position;
+ AP4_Cardinal m_ReferenceCount;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MemoryByteStream
++---------------------------------------------------------------------*/
+class AP4_MemoryByteStream : public AP4_ByteStream
+{
+public:
+ AP4_MemoryByteStream(AP4_Size size);
+ AP4_MemoryByteStream(AP4_UI08* buffer, AP4_Size size);
+
+ // AP4_ByteStream methods
+ AP4_Result Read(void* buffer,
+ AP4_Size bytes_to_read,
+ AP4_Size* bytes_read = 0);
+ AP4_Result Write(const void* buffer,
+ AP4_Size bytes_to_write,
+ AP4_Size* bytes_written = 0);
+ AP4_Result Seek(AP4_Offset offset);
+ AP4_Result Tell(AP4_Offset& offset) {
+ offset = m_Position;
+ return AP4_SUCCESS;
+ }
+ AP4_Result GetSize(AP4_Size& size) {
+ size = m_Size;
+ return AP4_SUCCESS;
+ }
+
+ // AP4_Referenceable methods
+ void AddReference();
+ void Release();
+
+ // methods
+ AP4_UI08* GetBuffer() { return m_Buffer; }
+
+protected:
+ virtual ~AP4_MemoryByteStream();
+
+private:
+ bool m_BufferIsLocal;
+ AP4_UI08* m_Buffer;
+ AP4_Size m_Size;
+ AP4_Offset m_Position;
+ AP4_Cardinal m_ReferenceCount;
+};
+
+#endif // _AP4_BYTE_STREAM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ChplAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ChplAtom.cpp
new file mode 100644
index 000000000..fca8b5795
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ChplAtom.cpp
@@ -0,0 +1,71 @@
+/*****************************************************************
+|
+| AP4 - chpl Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4ChplAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_ChplAtom::AP4_ChplAtom
++---------------------------------------------------------------------*/
+
+AP4_ChplAtom::AP4_ChplAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_CHPL, size, true, stream)
+{
+ size -= AP4_FULL_ATOM_HEADER_SIZE;
+
+ stream.ReadUI32(m_Reserved);
+
+ AP4_UI08 cnt = 0;
+ stream.ReadUI08(cnt);
+
+ size -= 5;
+
+ while(size > 0 && cnt-- > 0)
+ {
+ AP4_Chapter chapter;
+
+ // time
+ stream.ReadUI64(chapter.Time);
+
+ // name
+ AP4_UI08 len = 0;
+ char buff[256];
+ stream.ReadUI08(len);
+ stream.Read(buff, len);
+ buff[len] = 0;
+ chapter.Name = buff;
+
+ m_Chapters.Append(chapter);
+
+ size -= 8+1+len;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ChplAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ChplAtom.h
new file mode 100644
index 000000000..7e6ba9b82
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ChplAtom.h
@@ -0,0 +1,62 @@
+/*****************************************************************
+|
+| AP4 - chpl Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CHPL_ATOM_H_
+#define _AP4_CHPL_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_ChplAtom
++---------------------------------------------------------------------*/
+class AP4_ChplAtom : public AP4_Atom
+{
+public:
+ AP4_ChplAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ struct AP4_Chapter {AP4_UI64 Time; AP4_String Name;};
+
+ AP4_Array<AP4_Chapter>& GetChapters() { return m_Chapters; }
+
+private:
+
+ // members
+ AP4_UI32 m_Reserved;
+ AP4_Array<AP4_Chapter> m_Chapters;
+};
+
+#endif // _AP4_CHPL_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CmvdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CmvdAtom.cpp
new file mode 100644
index 000000000..83e683617
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CmvdAtom.cpp
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - cmvd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4CmvdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_CmvdAtom::AP4_CmvdAtom
++---------------------------------------------------------------------*/
+AP4_CmvdAtom::AP4_CmvdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_CMVD, size, false, stream)
+{
+ size -= AP4_ATOM_HEADER_SIZE;
+
+ stream.ReadUI32(m_MovieResourceSize);
+
+ size -= 4;
+
+ m_Data.SetDataSize(size);
+ stream.Read(m_Data.UseData(), size);
+
+/*
+ // read children
+ AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ while (entry_count--) {
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom,
+ this))) {
+ m_Children.Add(atom);
+ }
+ }
+*/
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CmvdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CmvdAtom.h
new file mode 100644
index 000000000..e61664724
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CmvdAtom.h
@@ -0,0 +1,64 @@
+/*****************************************************************
+|
+| AP4 - cmvd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CMVD_ATOM_H_
+#define _AP4_CMVD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_CmvdAtom
++---------------------------------------------------------------------*/
+class AP4_CmvdAtom : public AP4_ContainerAtom
+{
+public:
+ // methods
+ AP4_CmvdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ AP4_UI32 GetMovieResourceSize() const { return m_MovieResourceSize; }
+ const AP4_DataBuffer& GetDataBuffer() { return m_Data; }
+
+private:
+ AP4_UI32 m_MovieResourceSize;
+ AP4_DataBuffer m_Data;
+};
+
+#endif // _AP4_CMVD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Co64Atom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Co64Atom.cpp
new file mode 100644
index 000000000..053b70fa2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Co64Atom.cpp
@@ -0,0 +1,153 @@
+/*****************************************************************
+|
+| AP4 - co64 Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Co64Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::AP4_Co64Atom
++---------------------------------------------------------------------*/
+AP4_Co64Atom::AP4_Co64Atom(AP4_UI64* entries, AP4_UI32 entry_count) :
+AP4_Atom(AP4_ATOM_TYPE_CO64,
+ AP4_FULL_ATOM_HEADER_SIZE+4+entry_count*8,
+ true),
+ m_Entries(new AP4_UI64[entry_count]),
+ m_EntryCount(entry_count)
+{
+ memcpy(m_Entries, entries, m_EntryCount*8);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::AP4_Co64Atom
++---------------------------------------------------------------------*/
+AP4_Co64Atom::AP4_Co64Atom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_CO64, size, true, stream)
+{
+ stream.ReadUI32(m_EntryCount);
+ if (m_EntryCount > (size-AP4_FULL_ATOM_HEADER_SIZE-4)/8) {
+ m_EntryCount = (size-AP4_FULL_ATOM_HEADER_SIZE-4)/8;
+ }
+ m_Entries = new AP4_UI64[m_EntryCount];
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ stream.ReadUI64(m_Entries[i]);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::~AP4_Co64Atom
++---------------------------------------------------------------------*/
+AP4_Co64Atom::~AP4_Co64Atom()
+{
+ delete[] m_Entries;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::GetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // FIXME!!!
+
+ // get the chunk offset
+ chunk_offset = m_Entries[chunk - 1]; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::SetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::SetChunkOffset(AP4_Ordinal chunk, AP4_Offset chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // get the chunk offset
+ m_Entries[chunk - 1] = chunk_offset; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::AdjustChunkOffsets
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::AdjustChunkOffsets(AP4_Offset offset)
+{
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ m_Entries[i] += offset;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ result = stream.WriteUI32(m_EntryCount);
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ result = stream.WriteUI64(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Co64Atom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_EntryCount);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Co64Atom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Co64Atom.h
new file mode 100644
index 000000000..aa0c6df06
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Co64Atom.h
@@ -0,0 +1,62 @@
+/*****************************************************************
+|
+| AP4 - co64 Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CO64_ATOM_H_
+#define _AP4_CO64_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_Co64Atom
++---------------------------------------------------------------------*/
+class AP4_Co64Atom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_Co64Atom(AP4_UI64* offsets, AP4_UI32 offset_count);
+ AP4_Co64Atom(AP4_Size size, AP4_ByteStream& stream);
+ ~AP4_Co64Atom();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ AP4_Cardinal GetChunkCount() { return m_EntryCount; }
+ AP4_Result GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& chunk_offset);
+ AP4_Result SetChunkOffset(AP4_Ordinal chunk, AP4_Offset chunk_offset);
+ AP4_Result AdjustChunkOffsets(AP4_Offset offset);
+
+ private:
+ AP4_UI64* m_Entries;
+ AP4_UI32 m_EntryCount;
+};
+
+#endif // _AP4_CO64_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ContainerAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ContainerAtom.cpp
new file mode 100644
index 000000000..f8774ffc1
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4ContainerAtom.cpp
@@ -0,0 +1,164 @@
+/*****************************************************************
+|
+| AP4 - Container Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Atom.h"
+#include "Ap4Utils.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type, bool is_full) :
+ AP4_Atom(type, is_full)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type, AP4_Size size, bool is_full) :
+ AP4_Atom(type, size, is_full)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_Atom(type, size, is_full, stream)
+{
+ ReadChildren(atom_factory, stream, size-GetHeaderSize());
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::AP4_ContainerAtom
++---------------------------------------------------------------------*/
+AP4_ContainerAtom::AP4_ContainerAtom(Type type,
+ AP4_Size size,
+ bool is_full,
+ AP4_ByteStream& stream) :
+ AP4_Atom(type, size, is_full, stream)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::ReadChildren
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::ReadChildren(AP4_AtomFactory& atom_factory,
+ AP4_ByteStream& stream,
+ AP4_Size size)
+{
+ AP4_Atom* atom;
+ AP4_Size bytes_available = size;
+ while (AP4_SUCCEEDED(
+ atom_factory.CreateAtomFromStream(stream, bytes_available, atom, this))) {
+ atom->SetParent(this);
+ m_Children.Add(atom);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ContainerAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ return InspectChildren(inspector);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::InspectChildren
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ContainerAtom::InspectChildren(AP4_AtomInspector& inspector)
+{
+ // inspect children
+ m_Children.Apply(AP4_AtomListInspector(inspector));
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ContainerAtom::WriteFields(AP4_ByteStream& stream)
+{
+ // write all children
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::OnChildChanged
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::OnChildChanged(AP4_Atom*)
+{
+ // remcompute our size
+ m_Size = GetHeaderSize();
+ m_Children.Apply(AP4_AtomSizeAdder(m_Size));
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::OnChildAdded
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::OnChildAdded(AP4_Atom* child)
+{
+ // update our size
+ m_Size += child->GetSize();
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ContainerAtom::OnChildRemoved
++---------------------------------------------------------------------*/
+void
+AP4_ContainerAtom::OnChildRemoved(AP4_Atom* child)
+{
+ // update our size
+ m_Size -= child->GetSize();
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CttsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CttsAtom.cpp
new file mode 100644
index 000000000..5cbdf17a0
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CttsAtom.cpp
@@ -0,0 +1,115 @@
+/*****************************************************************
+|
+| AP4 - ctts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4CttsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::AP4_CttsAtom
++---------------------------------------------------------------------*/
+AP4_CttsAtom::AP4_CttsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_CTTS, size, true, stream)
+{
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 sample_count;
+ AP4_UI32 sample_offset;
+ if (stream.ReadUI32(sample_count) == AP4_SUCCESS &&
+ stream.ReadUI32(sample_offset) == AP4_SUCCESS) {
+ m_Entries.Append(AP4_CttsTableEntry(sample_count,
+ sample_offset));
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::GetCtsOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_CttsAtom::GetCtsOffset(AP4_Ordinal sample, AP4_UI32& cts_offset)
+{
+ AP4_Ordinal current_sample = 0;
+
+ for (unsigned int i = 0; i < m_Entries.ItemCount(); i++) {
+ AP4_CttsTableEntry& entry = m_Entries[i];
+
+ current_sample += entry.m_SampleCount;
+ // check if we have the right entry
+ if (current_sample >= sample) {
+ cts_offset = entry.m_SampleOffset;
+ return AP4_SUCCESS;
+ }
+ }
+
+ // sample is greater than the number of samples
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_CttsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+ if (AP4_FAILED(result)) return result;
+
+ // write the entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ // sample count
+ result = stream.WriteUI32(m_Entries[i].m_SampleCount);
+ if (AP4_FAILED(result)) return result;
+
+ // time offset
+ result = stream.WriteUI32(m_Entries[i].m_SampleOffset);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_CttsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CttsAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CttsAtom.h
new file mode 100644
index 000000000..9f5dab8ff
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4CttsAtom.h
@@ -0,0 +1,73 @@
+/*****************************************************************
+|
+| AP4 - ctts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_CTTS_ATOM_H_
+#define _AP4_CTTS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+
+/*----------------------------------------------------------------------
+| AP4_CttsTableEntry
++---------------------------------------------------------------------*/
+class AP4_CttsTableEntry {
+ public:
+ AP4_CttsTableEntry() :
+ m_SampleCount(0),
+ m_SampleOffset(0) {}
+ AP4_CttsTableEntry(AP4_Cardinal sample_count,
+ AP4_Offset sample_offset) :
+ m_SampleCount(sample_count),
+ m_SampleOffset(sample_offset) {}
+
+ AP4_Cardinal m_SampleCount;
+ AP4_Offset m_SampleOffset;
+};
+
+/*----------------------------------------------------------------------
+| AP4_CttsAtom
++---------------------------------------------------------------------*/
+class AP4_CttsAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_CttsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result GetCtsOffset(AP4_Ordinal sample,
+ AP4_UI32& cts_offset);
+
+ private:
+ AP4_Array<AP4_CttsTableEntry> m_Entries;
+};
+
+#endif // _AP4_CTTS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DataAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DataAtom.cpp
new file mode 100644
index 000000000..97c72d283
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DataAtom.cpp
@@ -0,0 +1,52 @@
+/*****************************************************************
+|
+| AP4 - data Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4DataAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_DataAtom::AP4_DataAtom
++---------------------------------------------------------------------*/
+
+AP4_DataAtom::AP4_DataAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_DATA)
+{
+ size -= AP4_ATOM_HEADER_SIZE;
+
+ stream.ReadUI32(m_Reserved1);
+ stream.ReadUI32(m_Reserved2);
+
+ size -= 8;
+
+ m_Data.SetDataSize(size);
+ stream.Read(m_Data.UseData(), size);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DataAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DataAtom.h
new file mode 100644
index 000000000..2c339c1d2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DataAtom.h
@@ -0,0 +1,59 @@
+/*****************************************************************
+|
+| AP4 - data Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DATA_ATOM_H_
+#define _AP4_DATA_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_DataAtom
++---------------------------------------------------------------------*/
+class AP4_DataAtom : public AP4_Atom
+{
+public:
+ AP4_DataAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ const AP4_DataBuffer* GetData() const { return &m_Data; }
+
+private:
+ AP4_UI32 m_Reserved1;
+ AP4_UI32 m_Reserved2;
+ AP4_DataBuffer m_Data;
+};
+
+#endif // _AP4_DATA_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DcomAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DcomAtom.cpp
new file mode 100644
index 000000000..12878c43c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DcomAtom.cpp
@@ -0,0 +1,46 @@
+/*****************************************************************
+|
+| AP4 - dcom Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4DcomAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_DcomAtom::AP4_DcomAtom
++---------------------------------------------------------------------*/
+
+AP4_DcomAtom::AP4_DcomAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_DCOM)
+{
+ size -= AP4_ATOM_HEADER_SIZE;
+
+ stream.ReadUI32(m_CompressorSubType);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DcomAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DcomAtom.h
new file mode 100644
index 000000000..541bb3bfa
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DcomAtom.h
@@ -0,0 +1,55 @@
+/*****************************************************************
+|
+| AP4 - dcom Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_DCOM_ATOM_H_
+#define _AP4_DCOM_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+
+/*----------------------------------------------------------------------
+| AP4_DcomAtom
++---------------------------------------------------------------------*/
+class AP4_DcomAtom : public AP4_Atom
+{
+public:
+ AP4_DcomAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ AP4_Atom::Type GetCompressorSubType() const { return m_CompressorSubType; }
+
+private:
+ AP4_Atom::Type m_CompressorSubType;
+};
+
+#endif // _AP4_DCOM_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DrefAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DrefAtom.cpp
new file mode 100644
index 000000000..0157c2969
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4DrefAtom.cpp
@@ -0,0 +1,89 @@
+/*****************************************************************
+|
+| AP4 - dref Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4DrefAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom::AP4_DrefAtom
++---------------------------------------------------------------------*/
+AP4_DrefAtom::AP4_DrefAtom(AP4_Atom** refs, AP4_Cardinal refs_count) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, AP4_FULL_ATOM_HEADER_SIZE+4, true)
+{
+ for (unsigned i=0; i<refs_count; i++) {
+ m_Children.Add(refs[i]);
+ m_Size += refs[i]->GetSize();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom::AP4_DrefAtom
++---------------------------------------------------------------------*/
+AP4_DrefAtom::AP4_DrefAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_DREF, size, true, stream)
+{
+ // read the number of entries
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+
+ // read children
+ AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+ while (entry_count--) {
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream,
+ bytes_available,
+ atom,
+ this))) {
+ m_Children.Add(atom);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_DrefAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_DrefAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the number of entries
+ result = stream.WriteUI32(m_Children.ItemCount());
+ if (AP4_FAILED(result)) return result;
+
+ // write the children
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4File.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4File.cpp
new file mode 100644
index 000000000..8c65dd3ae
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4File.cpp
@@ -0,0 +1,90 @@
+/*****************************************************************
+|
+| AP4 - File
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4File.h"
+#include "Ap4Atom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4AtomFactory.h"
+
+/*----------------------------------------------------------------------
+| AP4_File::AP4_File
++---------------------------------------------------------------------*/
+AP4_File::AP4_File(AP4_Movie* movie) :
+ m_Movie(movie)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_File::AP4_File
++---------------------------------------------------------------------*/
+AP4_File::AP4_File(AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) :
+ m_Movie(NULL)
+{
+ // get all atoms
+ AP4_Atom* atom;
+ while (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(stream, atom))) {
+ switch (atom->GetType()) {
+ case AP4_ATOM_TYPE_MOOV:
+ m_Movie = new AP4_Movie(dynamic_cast<AP4_MoovAtom*>(atom),
+ stream);
+ break;
+
+ default:
+ m_OtherAtoms.Add(atom);
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_File::~AP4_File
++---------------------------------------------------------------------*/
+AP4_File::~AP4_File()
+{
+ delete m_Movie;
+ m_OtherAtoms.DeleteReferences();
+}
+
+/*----------------------------------------------------------------------
+| AP4_File::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_File::Inspect(AP4_AtomInspector& inspector)
+{
+ // dump the moov atom first
+ if (m_Movie) m_Movie->Inspect(inspector);
+
+ // dump the other atoms
+ m_OtherAtoms.Apply(AP4_AtomListInspector(inspector));
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4FtabAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4FtabAtom.cpp
new file mode 100644
index 000000000..287238ebd
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4FtabAtom.cpp
@@ -0,0 +1,64 @@
+/*****************************************************************
+|
+| AP4 - ftab Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+
+#include "Ap4FtabAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_FtabAtom::AP4_FtabAtom
++---------------------------------------------------------------------*/
+
+AP4_FtabAtom::AP4_FtabAtom(AP4_Size size,
+ AP4_ByteStream& stream)
+ : AP4_Atom(AP4_ATOM_TYPE_FTAB)
+{
+ AP4_UI16 entryCount;
+ stream.ReadUI16(entryCount);
+
+ m_FontRecords.EnsureCapacity(entryCount);
+
+ while(entryCount--)
+ {
+ AP4_Tx3gFontRecord fontRecord;
+
+ stream.ReadUI16(fontRecord.Id);
+
+ AP4_UI08 len;
+ stream.ReadUI08(len);
+
+ char buff[256];
+ stream.ReadString(buff, len+1);
+
+ fontRecord.Name = buff;
+
+ m_FontRecords.Append(fontRecord);
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4FtabAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4FtabAtom.h
new file mode 100644
index 000000000..0845347d5
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4FtabAtom.h
@@ -0,0 +1,78 @@
+/*****************************************************************
+|
+| AP4 - ftab Atom
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_FTAB_ATOM_H_
+#define _AP4_FTAB_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Atom.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+
+/*----------------------------------------------------------------------
+| AP4_FtabAtom
++---------------------------------------------------------------------*/
+class AP4_FtabAtom : public AP4_Atom
+{
+public:
+ AP4_FtabAtom(AP4_Size size,
+ AP4_ByteStream& stream);
+
+ AP4_Result WriteFields(AP4_ByteStream& stream) { return AP4_FAILURE; }
+
+ struct AP4_Tx3gFontRecord
+ {
+ AP4_UI16 Id;
+ AP4_String Name;
+ };
+
+ AP4_Array<AP4_Tx3gFontRecord>& GetFontRecords() { return m_FontRecords; }
+
+ AP4_Result LookupFont(AP4_UI16 Id, AP4_String& Name)
+ {
+ for(unsigned long i = 0; i < m_FontRecords.ItemCount(); i++)
+ {
+ if(m_FontRecords[i].Id == Id)
+ {
+ Name = m_FontRecords[i].Name;
+ return AP4_SUCCESS;
+ }
+ }
+
+ return AP4_FAILURE;
+ }
+
+private:
+
+ // members
+ AP4_Array<AP4_Tx3gFontRecord> m_FontRecords;
+};
+
+#endif // _AP4_FTAB_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4HdlrAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4HdlrAtom.cpp
new file mode 100644
index 000000000..353ef117e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4HdlrAtom.cpp
@@ -0,0 +1,110 @@
+/*****************************************************************
+|
+| AP4 - hdlr Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::AP4_HdlrAtom
++---------------------------------------------------------------------*/
+AP4_HdlrAtom::AP4_HdlrAtom(AP4_Atom::Type hdlr_type, const char* hdlr_name) :
+ AP4_Atom(AP4_ATOM_TYPE_HDLR, true),
+ m_HandlerType(hdlr_type),
+ m_HandlerName(hdlr_name)
+{
+ m_Size += 20+m_HandlerName.length()+1;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::AP4_HdlrAtom
++---------------------------------------------------------------------*/
+AP4_HdlrAtom::AP4_HdlrAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_HDLR, size, true, stream)
+{
+ unsigned char reserved[12];
+ stream.Read(reserved, 4, NULL);
+ stream.ReadUI32(m_HandlerType);
+ stream.Read(reserved, 12, NULL);
+
+ // read the name unless it is empty
+ int name_size = size-(AP4_FULL_ATOM_HEADER_SIZE+20);
+ if (name_size > 0) {
+ char* name = new char[name_size+1];
+ stream.Read(name, name_size);
+ name[name_size] = '\0'; // force a null termination
+ m_HandlerName = name;
+ delete[] name;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HdlrAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the data
+ unsigned char reserved[12];
+ memset(reserved, 0, sizeof(reserved));
+ result = stream.Write(reserved, 4);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_HandlerType);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Write(reserved, 12);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Write(m_HandlerName.c_str(),
+ m_HandlerName.length()+1);
+ if (AP4_FAILED(result)) return result;
+
+ // pad with zeros if necessary
+ AP4_Size padding = m_Size-(AP4_FULL_ATOM_HEADER_SIZE+20+m_HandlerName.length()+1);
+ while (padding--) stream.WriteUI08(0);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_HdlrAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ char type[5];
+ AP4_FormatFourChars(type, m_HandlerType);
+ inspector.AddField("handler_type", type);
+ inspector.AddField("handler_name", m_HandlerName.c_str());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4HdlrAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4HdlrAtom.h
new file mode 100644
index 000000000..63b9d1507
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4HdlrAtom.h
@@ -0,0 +1,71 @@
+/*****************************************************************
+|
+| AP4 - hdlr Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_HDLR_ATOM_H_
+#define _AP4_HDLR_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_HANDLER_TYPE_SOUN = AP4_ATOM_TYPE('s','o','u','n');
+const AP4_UI32 AP4_HANDLER_TYPE_VIDE = AP4_ATOM_TYPE('v','i','d','e');
+const AP4_UI32 AP4_HANDLER_TYPE_TEXT = AP4_ATOM_TYPE('t','e','x','t');
+const AP4_UI32 AP4_HANDLER_TYPE_TX3G = AP4_ATOM_TYPE('t','x','3','g');
+const AP4_UI32 AP4_HANDLER_TYPE_SUBP = AP4_ATOM_TYPE('s','u','b','p');
+const AP4_UI32 AP4_HANDLER_TYPE_HINT = AP4_ATOM_TYPE('h','i','n','t');
+
+/*----------------------------------------------------------------------
+| AP4_HdlrAtom
++---------------------------------------------------------------------*/
+class AP4_HdlrAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_HdlrAtom(AP4_UI32 hdlr_type, const char* hdlr_name);
+ AP4_HdlrAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_UI32 GetHandlerType() { return m_HandlerType; }
+ AP4_String GetHandlerName() { return m_HandlerName; }
+
+private:
+ // members
+ AP4_UI32 m_HandlerType;
+ AP4_String m_HandlerName;
+};
+
+#endif // _AP4_HDLR_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MdhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MdhdAtom.cpp
new file mode 100644
index 000000000..2e4c2bf50
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MdhdAtom.cpp
@@ -0,0 +1,172 @@
+/*****************************************************************
+|
+| AP4 - mdhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MdhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::AP4_MdhdAtom
++---------------------------------------------------------------------*/
+AP4_MdhdAtom::AP4_MdhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI64 duration,
+ const char* language) :
+ AP4_Atom(AP4_ATOM_TYPE_MDHD, 20+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CreationTime(creation_time),
+ m_ModificationTime(modification_time),
+ m_TimeScale(time_scale),
+ m_Duration(duration)
+{
+ m_Language[0] = language[0];
+ m_Language[1] = language[1];
+ m_Language[2] = language[2];
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::AP4_MdhdAtom
++---------------------------------------------------------------------*/
+AP4_MdhdAtom::AP4_MdhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_MDHD, size, true, stream),
+ m_CreationTime(0),
+ m_ModificationTime(0),
+ m_TimeScale(0),
+ m_Duration(0)
+{
+ m_Language[0] = 0;
+ m_Language[1] = 0;
+ m_Language[2] = 0;
+
+ if (m_Version == 0) {
+ AP4_UI32 tmp = 0;
+ stream.ReadUI32(tmp); m_CreationTime = tmp;
+ stream.ReadUI32(tmp); m_ModificationTime = tmp;
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI32(tmp); m_Duration = tmp;
+ } else if (m_Version == 1) {
+ stream.ReadUI64(m_CreationTime);
+ stream.ReadUI64(m_ModificationTime);
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI64(m_Duration);
+ } else {
+ // TODO
+ }
+
+ unsigned char lang[2];
+ stream.Read(lang, 2, NULL);
+ char l0 = ((lang[0]>>2)&0x1F);
+ char l1 = (((lang[0]&0x3)<<3) | ((lang[1]>>5)&0x7));
+ char l2 = ((lang[1]&0x1F));
+ if (l0) {
+ m_Language[0] = l0+0x60;
+ }
+ if (l1) {
+ m_Language[1] = l1+0x60;
+ }
+ if (l2) {
+ m_Language[2] = l2+0x60;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MdhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ if (m_Version == 0) {
+ // we only deal with version 0 for the moment
+ result = stream.WriteUI32((AP4_UI32)m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else if (m_Version == 1) {
+ result = stream.WriteUI64(m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ // TODO
+ }
+
+ // write the language
+ AP4_UI08 l0 = (m_Language[0]==0)?0:(m_Language[0]-0x60);
+ AP4_UI08 l1 = (m_Language[1]==0)?0:(m_Language[1]-0x60);
+ AP4_UI08 l2 = (m_Language[2]==0)?0:(m_Language[2]-0x60);
+ result = stream.WriteUI08(l0<<2 | l1>>3);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI08(l1<<5 | l2);
+ if (AP4_FAILED(result)) return result;
+
+ // pre-defined
+ return stream.WriteUI16(0);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_MdhdAtom::GetDurationMs()
+{
+ return AP4_DurationMsFromUnits(m_Duration, m_TimeScale);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MdhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("timescale", m_TimeScale);
+ inspector.AddField("duration", (AP4_UI32)m_Duration); // TODO
+ inspector.AddField("duration(ms)", GetDurationMs());
+ char language[4];
+ AP4_StringFormat(language, sizeof(language),
+ "%c%c%c",
+ m_Language[0] ? m_Language[0]:'-',
+ m_Language[1] ? m_Language[1]:'-',
+ m_Language[2] ? m_Language[2]:'-');
+ inspector.AddField("language", (const char*)language);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MdhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MdhdAtom.h
new file mode 100644
index 000000000..d5e0bba63
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MdhdAtom.h
@@ -0,0 +1,76 @@
+/*****************************************************************
+|
+| AP4 - mdhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MDHD_ATOM_H_
+#define _AP4_MDHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_MDHD_DEFAULT_GENERIC_TIMESCALE = 1000;
+const AP4_UI32 AP4_MDHD_DEFAULT_VIDEO_TIMESCALE = 90000;
+
+/*----------------------------------------------------------------------
+| AP4_MdhdAtom
++---------------------------------------------------------------------*/
+class AP4_MdhdAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_MdhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI64 duration,
+ const char* language);
+ AP4_MdhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_UI32 GetDurationMs();
+ AP4_UI64 GetDuration() { return m_Duration; }
+ AP4_UI32 GetTimeScale() { return m_TimeScale; }
+ AP4_String GetLanguage() { return AP4_String(m_Language, 3); }
+
+ private:
+ // members
+ AP4_UI64 m_CreationTime;
+ AP4_UI64 m_ModificationTime;
+ AP4_UI32 m_TimeScale;
+ AP4_UI64 m_Duration;
+ char m_Language[3];
+};
+
+#endif // _AP4_MDHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MoovAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MoovAtom.cpp
new file mode 100644
index 000000000..b252084ce
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MoovAtom.cpp
@@ -0,0 +1,196 @@
+/*****************************************************************
+|
+| AP4 - moov Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4DcomAtom.h"
+#include "Ap4CmvdAtom.h"
+#include "..\..\..\..\..\..\zlib\zlib.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtomCollector
++---------------------------------------------------------------------*/
+class AP4_TrakAtomCollector : public AP4_List<AP4_Atom>::Item::Operator
+{
+public:
+ AP4_TrakAtomCollector(AP4_List<AP4_TrakAtom>* track_atoms) :
+ m_TrakAtoms(track_atoms) {}
+
+ AP4_Result Action(AP4_Atom* atom) const {
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
+ AP4_TrakAtom* trak = dynamic_cast<AP4_TrakAtom*>(atom);
+ if (trak) {
+ m_TrakAtoms->Add(trak);
+ }
+ }
+ return AP4_SUCCESS;
+ }
+
+private:
+ AP4_List<AP4_TrakAtom>* m_TrakAtoms;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::AP4_MoovAtom
++---------------------------------------------------------------------*/
+AP4_MoovAtom::AP4_MoovAtom() :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_MOOV),
+ m_TimeScale(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::AP4_MoovAtom
++---------------------------------------------------------------------*/
+AP4_MoovAtom::AP4_MoovAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_MOOV, size, false, stream, atom_factory),
+ m_TimeScale(0)
+{
+ if(AP4_ContainerAtom* cmov = dynamic_cast<AP4_ContainerAtom*>(GetChild(AP4_ATOM_TYPE_CMOV)))
+ {
+ AP4_DcomAtom* dcom = dynamic_cast<AP4_DcomAtom*>(cmov->GetChild(AP4_ATOM_TYPE_DCOM));
+ AP4_CmvdAtom* cmvd = dynamic_cast<AP4_CmvdAtom*>(cmov->GetChild(AP4_ATOM_TYPE_CMVD));
+
+ if(dcom && dcom->GetCompressorSubType() == AP4_ATOM_TYPE('z','l','i','b') && cmvd)
+ {
+ const AP4_DataBuffer& data = cmvd->GetDataBuffer();
+
+ z_stream d_stream;
+ d_stream.zalloc = (alloc_func)0;
+ d_stream.zfree = (free_func)0;
+ d_stream.opaque = (voidpf)0;
+
+ int res;
+
+ if(Z_OK == (res = inflateInit(&d_stream)))
+ {
+ d_stream.next_in = (Bytef*)data.GetData();
+ d_stream.avail_in = data.GetDataSize();
+
+ unsigned char* dst = NULL;
+ int n = 0;
+
+ do
+ {
+ dst = (unsigned char*)realloc(dst, ++n*1000);
+ d_stream.next_out = &dst[(n-1)*1000];
+ d_stream.avail_out = 1000;
+
+ if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res)
+ {
+ free(dst);
+ dst = NULL;
+ break;
+ }
+ }
+ while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res);
+
+ inflateEnd(&d_stream);
+
+ if(dst)
+ {
+ AP4_ByteStream* s = new AP4_MemoryByteStream(dst, d_stream.total_out);
+ ReadChildren(atom_factory, *s, d_stream.total_out);
+ s->Release();
+ free(dst);
+ }
+
+ if(AP4_MoovAtom* moov = dynamic_cast<AP4_MoovAtom*>(GetChild(AP4_ATOM_TYPE_MOOV)))
+ {
+ AP4_List<AP4_Atom> Children;
+
+ for(AP4_List<AP4_Atom>::Item* item = moov->GetChildren().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ Children.Add(item->GetData());
+ }
+
+ for(AP4_List<AP4_Atom>::Item* item = Children.FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ AP4_Atom* atom = item->GetData();
+ atom->Detach();
+ atom->SetParent(this);
+ m_Children.Add(atom);
+ }
+
+ moov->Detach();
+ delete moov;
+ }
+ }
+ }
+ }
+
+ // collect all trak atoms
+ m_Children.Apply(AP4_TrakAtomCollector(&m_TrakAtoms));
+}
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::OnChildAdded
++---------------------------------------------------------------------*/
+void
+AP4_MoovAtom::OnChildAdded(AP4_Atom* atom)
+{
+ // keep the atom in the list of trak atoms
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
+ AP4_TrakAtom* trak = dynamic_cast<AP4_TrakAtom*>(atom);
+ if (trak) {
+ m_TrakAtoms.Add(trak);
+ }
+ }
+
+ // call the base class implementation
+ AP4_ContainerAtom::OnChildAdded(atom);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MoovAtom::OnChildRemoved
++---------------------------------------------------------------------*/
+void
+AP4_MoovAtom::OnChildRemoved(AP4_Atom* atom)
+{
+ // remove the atom from the list of trak atoms
+ if (atom->GetType() == AP4_ATOM_TYPE_TRAK) {
+ AP4_TrakAtom* trak = dynamic_cast<AP4_TrakAtom*>(atom);
+ if (trak) {
+ m_TrakAtoms.Remove(trak);
+ }
+ }
+
+ // call the base class implementation
+ AP4_ContainerAtom::OnChildRemoved(atom);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Movie.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Movie.cpp
new file mode 100644
index 000000000..51b17b780
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Movie.cpp
@@ -0,0 +1,234 @@
+/*****************************************************************
+|
+| AP4 - Movie
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4File.h"
+#include "Ap4Atom.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Movie.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrackFinderById
++---------------------------------------------------------------------*/
+class AP4_TrackFinderById : public AP4_List<AP4_Track>::Item::Finder
+{
+public:
+ AP4_TrackFinderById(AP4_UI32 track_id) : m_TrackId(track_id) {}
+ AP4_Result Test(AP4_Track* track) const {
+ return track->GetId() == m_TrackId ? AP4_SUCCESS : AP4_FAILURE;
+ }
+private:
+ AP4_UI32 m_TrackId;
+};
+
+/*----------------------------------------------------------------------
+| AP4_TrackFinderByType
++---------------------------------------------------------------------*/
+class AP4_TrackFinderByType : public AP4_List<AP4_Track>::Item::Finder
+{
+public:
+ AP4_TrackFinderByType(AP4_Track::Type type, AP4_Ordinal index = 0) :
+ m_Type(type), m_Index(index) {}
+ AP4_Result Test(AP4_Track* track) const {
+ if (track->GetType() == m_Type && m_Index-- == 0) {
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+ }
+private:
+ AP4_Track::Type m_Type;
+ mutable AP4_Ordinal m_Index;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Movie::AP4_Movie
++---------------------------------------------------------------------*/
+AP4_Movie::AP4_Movie(AP4_UI32 time_scale)
+{
+ m_MoovAtom = new AP4_MoovAtom();
+ m_MvhdAtom = new AP4_MvhdAtom(0, 0,
+ time_scale,
+ 0,
+ 0x00010000,
+ 0x0100);
+ m_MoovAtom->AddChild(m_MvhdAtom);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::AP4_Moovie
++---------------------------------------------------------------------*/
+AP4_Movie::AP4_Movie(AP4_MoovAtom* moov, AP4_ByteStream& mdat) :
+ m_MoovAtom(moov)
+{
+ // ignore null atoms
+ if (moov == NULL) return;
+
+ // get the time scale
+ AP4_UI32 time_scale;
+ m_MvhdAtom = dynamic_cast<AP4_MvhdAtom*>(moov->GetChild(AP4_ATOM_TYPE_MVHD));
+ if (m_MvhdAtom) {
+ time_scale = m_MvhdAtom->GetTimeScale();
+ } else {
+ time_scale = 0;
+ }
+
+ // get all tracks
+ AP4_List<AP4_TrakAtom>* trak_atoms;
+ trak_atoms = &moov->GetTrakAtoms();
+ AP4_List<AP4_TrakAtom>::Item* item = trak_atoms->FirstItem();
+ while (item) {
+ AP4_Track* track = new AP4_Track(*item->GetData(),
+ mdat,
+ time_scale);
+ m_Tracks.Add(track);
+ item = item->GetNext();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::~AP4_Movie
++---------------------------------------------------------------------*/
+AP4_Movie::~AP4_Movie()
+{
+ m_Tracks.DeleteReferences();
+ delete m_MoovAtom;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Movie::Inspect(AP4_AtomInspector& inspector)
+{
+ // dump the moov atom
+ return m_MoovAtom->Inspect(inspector);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetTrack
++---------------------------------------------------------------------*/
+AP4_Track*
+AP4_Movie::GetTrack(AP4_UI32 track_id)
+{
+ AP4_Track* track = NULL;
+ if (AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderById(track_id), track))) {
+ return track;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetTrack
++---------------------------------------------------------------------*/
+AP4_Track*
+AP4_Movie::GetTrack(AP4_Track::Type track_type, AP4_Ordinal index)
+{
+ AP4_Track* track = NULL;
+ if (AP4_SUCCEEDED(m_Tracks.Find(AP4_TrackFinderByType(track_type, index), track))) {
+ return track;
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::AddTrack
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Movie::AddTrack(AP4_Track* track)
+{
+ // assign an ID to the track unless it already has one
+ if (track->GetId() == 0) {
+ track->SetId(m_Tracks.ItemCount()+1);
+ }
+
+ // if we don't have a time scale, use the one from the track
+ if (m_MvhdAtom->GetTimeScale() == 0) {
+ m_MvhdAtom->SetTimeScale(track->GetMediaTimeScale());
+ }
+
+ // adjust the parent time scale of the track
+ track->SetMovieTimeScale(m_MvhdAtom->GetTimeScale());
+
+ // update the movie duration
+ if (m_MvhdAtom->GetDuration() < track->GetDuration()) {
+ m_MvhdAtom->SetDuration(track->GetDuration());
+ }
+
+ // attach the track as a child
+ m_MoovAtom->AddChild(track->GetTrakAtom());
+ m_Tracks.Add(track);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetTimeScale
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Movie::GetTimeScale()
+{
+ if (m_MvhdAtom) {
+ return m_MvhdAtom->GetTimeScale();
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetDuration
++---------------------------------------------------------------------*/
+AP4_UI64
+AP4_Movie::GetDuration()
+{
+ if (m_MvhdAtom) {
+ return m_MvhdAtom->GetDuration();
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Movie::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_Duration
+AP4_Movie::GetDurationMs()
+{
+ if (m_MvhdAtom) {
+ return m_MvhdAtom->GetDurationMs();
+ } else {
+ return 0;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Movie.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Movie.h
new file mode 100644
index 000000000..fbd338b66
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Movie.h
@@ -0,0 +1,70 @@
+/*****************************************************************
+|
+| AP4 - Movie
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MOVIE_H_
+#define _AP4_MOVIE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4Track.h"
+#include "Ap4List.h"
+#include "Ap4ByteStream.h"
+
+/*----------------------------------------------------------------------
+| AP4_Movie
++---------------------------------------------------------------------*/
+class AP4_Movie {
+public:
+ // methods
+ AP4_Movie(AP4_UI32 time_scale = 0);
+ AP4_Movie(AP4_MoovAtom* moov, AP4_ByteStream& mdat);
+ virtual ~AP4_Movie();
+ AP4_Result Inspect(AP4_AtomInspector& inspector);
+
+ AP4_MoovAtom* GetMoovAtom() { return m_MoovAtom;}
+ AP4_MvhdAtom* GetMvhdAtom() { return m_MvhdAtom;}
+ AP4_List<AP4_Track>& GetTracks() { return m_Tracks; }
+ AP4_Track* GetTrack(AP4_UI32 track_id);
+ AP4_Track* GetTrack(AP4_Track::Type type, AP4_Ordinal index = 0);
+ AP4_Result AddTrack(AP4_Track* track);
+ AP4_UI32 GetTimeScale();
+ AP4_Duration GetDuration();
+ AP4_Duration GetDurationMs();
+
+private:
+ // members
+ AP4_MoovAtom* m_MoovAtom;
+ AP4_MvhdAtom* m_MvhdAtom;
+ AP4_List<AP4_Track> m_Tracks;
+};
+
+#endif // _AP4_MOVIE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MvhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MvhdAtom.cpp
new file mode 100644
index 000000000..c6dfd15fb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MvhdAtom.cpp
@@ -0,0 +1,182 @@
+/*****************************************************************
+|
+| AP4 - mvhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::AP4_MvhdAtom
++---------------------------------------------------------------------*/
+AP4_MvhdAtom::AP4_MvhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI64 duration,
+ AP4_UI32 rate,
+ AP4_UI16 volume) :
+ AP4_Atom(AP4_ATOM_TYPE_MVHD, 96+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CreationTime(creation_time),
+ m_ModificationTime(modification_time),
+ m_TimeScale(time_scale),
+ m_Duration(duration),
+ m_Rate(rate),
+ m_Volume(volume),
+ m_NextTrackId(0xFFFFFFFF)
+{
+ m_Matrix[0] = 0x00010000;
+ m_Matrix[1] = 0;
+ m_Matrix[2] = 0;
+ m_Matrix[3] = 0;
+ m_Matrix[4] = 0x00010000;
+ m_Matrix[5] = 0;
+ m_Matrix[6] = 0;
+ m_Matrix[7] = 0;
+ m_Matrix[8] = 0x40000000;
+
+ memset(m_Reserved1, 0, sizeof(m_Reserved1));
+ memset(m_Reserved2, 0, sizeof(m_Reserved2));
+ memset(m_Predefined, 0, sizeof(m_Predefined));
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::AP4_MvhdAtom
++---------------------------------------------------------------------*/
+AP4_MvhdAtom::AP4_MvhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_MVHD, size, true, stream)
+{
+ if (m_Version == 0) {
+ AP4_UI32 tmp = 0;
+ stream.ReadUI32(tmp); m_CreationTime = tmp;
+ stream.ReadUI32(tmp); m_ModificationTime = tmp;
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI32(tmp); m_Duration = tmp;
+ } else if (m_Version == 1) {
+ stream.ReadUI64(m_CreationTime);
+ stream.ReadUI64(m_ModificationTime);
+ stream.ReadUI32(m_TimeScale);
+ stream.ReadUI64(m_Duration);
+ } else {
+ // TODO
+ }
+
+ stream.ReadUI32(m_Rate);
+ stream.ReadUI16(m_Volume);
+ stream.Read(m_Reserved1, sizeof(m_Reserved1));
+ stream.Read(m_Reserved2, sizeof(m_Reserved2));
+ for (int i=0; i<9; i++) {
+ stream.ReadUI32(m_Matrix[i]);
+ }
+ stream.Read(m_Predefined, sizeof(m_Predefined));
+ stream.ReadUI32(m_NextTrackId);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MvhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ if (m_Version == 0) {
+ result = stream.WriteUI32((AP4_UI32)m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else if (m_Version == 1) {
+ result = stream.WriteUI64(m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TimeScale);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ // TODO
+ }
+
+ // rate & volume
+ result = stream.WriteUI32(m_Rate);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_Volume);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved
+ result = stream.Write(m_Reserved1, sizeof(m_Reserved1));
+ if (AP4_FAILED(result)) return result;
+ result = stream.Write(m_Reserved2, sizeof(m_Reserved2));
+ if (AP4_FAILED(result)) return result;
+
+ // matrix
+ for (int i=0; i<9; i++) {
+ result = stream.WriteUI32(m_Matrix[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // pre-defined
+ result = stream.Write(m_Predefined, sizeof(m_Predefined));
+ if (AP4_FAILED(result)) return result;
+
+ // next track id
+ return stream.WriteUI32(m_NextTrackId);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_Duration
+AP4_MvhdAtom::GetDurationMs()
+{
+ if (m_TimeScale) {
+ return AP4_ConvertTime(m_Duration, m_TimeScale, 1000);
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_MvhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("timescale", m_TimeScale);
+ inspector.AddField("duration", (AP4_UI32)m_Duration);
+ inspector.AddField("duration(ms)", (AP4_UI32)GetDurationMs());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MvhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MvhdAtom.h
new file mode 100644
index 000000000..b51ef174f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4MvhdAtom.h
@@ -0,0 +1,80 @@
+/*****************************************************************
+|
+| AP4 - mvhd Atoms
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_MVHD_ATOM_H_
+#define _AP4_MVHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_MvhdAtom
++---------------------------------------------------------------------*/
+class AP4_MvhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_MvhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 time_scale,
+ AP4_UI64 duration,
+ AP4_UI32 rate,
+ AP4_UI16 volume);
+ AP4_MvhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ AP4_UI64 GetDuration() { return m_Duration; }
+ void SetDuration(AP4_UI64 duration) { m_Duration = duration;}
+ AP4_Duration GetDurationMs();
+ AP4_UI32 GetTimeScale() { return m_TimeScale; }
+ AP4_Result SetTimeScale(AP4_UI32 time_scale) {
+ m_TimeScale = time_scale;
+ return AP4_SUCCESS;
+ }
+
+private:
+ // members
+ AP4_UI64 m_CreationTime;
+ AP4_UI64 m_ModificationTime;
+ AP4_UI32 m_TimeScale;
+ AP4_UI64 m_Duration;
+ AP4_UI32 m_Rate;
+ AP4_UI16 m_Volume;
+ AP4_UI08 m_Reserved1[2];
+ AP4_UI08 m_Reserved2[8];
+ AP4_UI32 m_Matrix[9];
+ AP4_UI08 m_Predefined[24];
+ AP4_UI32 m_NextTrackId;
+};
+
+#endif // _AP4_MVHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Sample.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Sample.cpp
new file mode 100644
index 000000000..9424e5982
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Sample.cpp
@@ -0,0 +1,160 @@
+/*****************************************************************
+|
+| AP4 - Sample Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Sample.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_Sample::AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::AP4_Sample() :
+ m_DataStream(NULL),
+ m_Offset(0),
+ m_Size(0),
+ m_DescriptionIndex(0),
+ m_Dts(0),
+ m_Cts(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::AP4_Sample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp dts,
+ AP4_TimeStamp cts_offset /* = 0 */ ) :
+ m_Offset(offset),
+ m_Size(size),
+ m_DescriptionIndex(description_index),
+ m_Dts(dts),
+ m_Cts(dts + cts_offset)
+{
+ m_DataStream = &data_stream;
+ AP4_ADD_REFERENCE(m_DataStream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::AP4_Sample(const AP4_Sample& other) :
+ m_DataStream(other.m_DataStream),
+ m_Offset(other.m_Offset),
+ m_Size(other.m_Size),
+ m_DescriptionIndex(other.m_DescriptionIndex),
+ m_Dts(other.m_Dts),
+ m_Cts(other.m_Cts)
+{
+ AP4_ADD_REFERENCE(m_DataStream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::~AP4_Sample
++---------------------------------------------------------------------*/
+AP4_Sample::~AP4_Sample()
+{
+ AP4_RELEASE(m_DataStream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::operator=
++---------------------------------------------------------------------*/
+AP4_Sample&
+AP4_Sample::operator=(const AP4_Sample& other)
+{
+ AP4_RELEASE(m_DataStream);
+ m_DataStream = other.m_DataStream;
+ AP4_ADD_REFERENCE(m_DataStream);
+
+ m_Offset = other.m_Offset;
+ m_Size = other.m_Size;
+ m_DescriptionIndex = other.m_DescriptionIndex;
+ m_Dts = other.m_Dts;
+ m_Cts = other.m_Cts;
+
+ return *this;
+}
+/*----------------------------------------------------------------------
+| AP4_Sample::ReadData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Sample::ReadData(AP4_DataBuffer& data)
+{
+ return ReadData(data, m_Size);
+}
+
+
+/*----------------------------------------------------------------------
+| AP4_Sample::ReadData
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Sample::ReadData(AP4_DataBuffer& data, AP4_Size size, AP4_Offset offset)
+{
+ // check that we have a stream
+ if (m_DataStream == NULL) return AP4_FAILURE;
+
+ // shortcut
+ if (size == 0) return AP4_SUCCESS;
+
+ // check the size
+ if (m_Size < size+offset) return AP4_FAILURE;
+
+ // set the buffer size
+ AP4_Result result = data.SetDataSize(size);
+ if (AP4_FAILED(result)) return result;
+
+ // get the data from the stream
+ m_DataStream->Seek(m_Offset+offset);
+ return m_DataStream->Read(data.UseData(), size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::GetDataStream
++---------------------------------------------------------------------*/
+AP4_ByteStream*
+AP4_Sample::GetDataStream()
+{
+ AP4_ADD_REFERENCE(m_DataStream);
+ return m_DataStream;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Sample::SetDataStream
++---------------------------------------------------------------------*/
+void
+AP4_Sample::SetDataStream(AP4_ByteStream& stream)
+{
+ AP4_RELEASE(m_DataStream);
+ m_DataStream = &stream;
+ AP4_ADD_REFERENCE(m_DataStream);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Sample.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Sample.h
new file mode 100644
index 000000000..184499f70
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Sample.h
@@ -0,0 +1,91 @@
+/*****************************************************************
+|
+| AP4 - Sample Objects
+|
+| Copyright 2002-2005 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_H_
+#define _AP4_SAMPLE_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4DataBuffer.h"
+
+/*----------------------------------------------------------------------
+| AP4_Sample DO NOT DERIVE FROM THIS CLASS
++---------------------------------------------------------------------*/
+class AP4_Sample
+{
+public:
+ // constructors and destructor
+ AP4_Sample();
+ AP4_Sample(const AP4_Sample& other);
+ AP4_Sample(AP4_ByteStream& data_stream,
+ AP4_Offset offset,
+ AP4_Size size,
+ AP4_Ordinal description_index,
+ AP4_TimeStamp dts,
+ AP4_TimeStamp cts_offset = 0);
+ ~AP4_Sample(); // not virtual on purpose: do not derive from it
+
+ // operators
+ AP4_Sample& operator=(const AP4_Sample& other);
+
+ // methods
+ AP4_Result ReadData(AP4_DataBuffer& data);
+ AP4_Result ReadData(AP4_DataBuffer& data,
+ AP4_Size size,
+ AP4_Offset offset = 0);
+
+ // sample properties accessors
+ AP4_ByteStream* GetDataStream();
+ void SetDataStream(AP4_ByteStream& stream);
+ AP4_Offset GetOffset() const { return m_Offset; }
+ void SetOffset(AP4_Offset offset) { m_Offset = offset; }
+ AP4_Size GetSize() { return m_Size; }
+ void SetSize(AP4_Size size) { m_Size = size; }
+ AP4_Ordinal GetDescriptionIndex() const { return m_DescriptionIndex; }
+ void SetDescriptionIndex(AP4_Ordinal index) { m_DescriptionIndex = index; }
+ AP4_TimeStamp GetDts() const { return m_Dts; }
+ void SetDts(AP4_TimeStamp dts) { m_Dts = dts; }
+ AP4_TimeStamp GetDuration() const { return m_Duration; }
+ void SetDuration(AP4_Duration duration) { m_Duration = duration;}
+ AP4_TimeStamp GetCts() const { return m_Cts; }
+ void SetCts(AP4_TimeStamp cts) { m_Cts = cts; }
+
+protected:
+ AP4_ByteStream* m_DataStream;
+ AP4_Offset m_Offset;
+ AP4_Size m_Size;
+ AP4_Ordinal m_DescriptionIndex;
+ AP4_TimeStamp m_Dts;
+ AP4_TimeStamp m_Cts;
+ AP4_Duration m_Duration;
+};
+
+#endif // _AP4_SAMPLE_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleDescription.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleDescription.h
new file mode 100644
index 000000000..1097f7b78
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleDescription.h
@@ -0,0 +1,252 @@
+/*****************************************************************
+|
+| AP4 - Sample Description Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_DESCRIPTION_H_
+#define _AP4_SAMPLE_DESCRIPTION_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4Atom.h"
+#include "Ap4EsDescriptor.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_SampleEntry;
+
+/*----------------------------------------------------------------------
+| AP4_SampleDescription
++---------------------------------------------------------------------*/
+class AP4_SampleDescription
+{
+ public:
+ // type constants of the sample description
+ enum Type {
+ TYPE_UNKNOWN = 0x00,
+ TYPE_MPEG = 0x01,
+ TYPE_ISMACRYP = 0x02
+ };
+
+ // constructors & destructor
+ AP4_SampleDescription(Type type) : m_Type(type) {}
+ virtual ~AP4_SampleDescription() {}
+
+ // accessors
+ Type GetType() const { return m_Type; }
+
+ // factories
+ virtual AP4_Atom* ToAtom() const = 0;
+
+ protected:
+ Type m_Type;
+};
+
+/*----------------------------------------------------------------------
+| AP4_UnknownSampleDescription
++---------------------------------------------------------------------*/
+class AP4_UnknownSampleDescription : public AP4_SampleDescription
+{
+ public:
+ // methods
+ AP4_UnknownSampleDescription(AP4_SampleEntry* sample_entry);
+ ~AP4_UnknownSampleDescription();
+ AP4_SampleEntry* GetSampleEntry() { return m_SampleEntry; }
+ AP4_Atom* ToAtom() const;
+
+ protected:
+ AP4_SampleEntry* m_SampleEntry;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegSampleDescription : public AP4_SampleDescription
+{
+ public:
+ // types
+ typedef AP4_UI08 StreamType;
+ typedef AP4_UI08 OTI;
+
+ // class methods
+ const char* GetStreamTypeString(StreamType type);
+ const char* GetObjectTypeString(OTI oti);
+
+ // constructors & destructor
+ AP4_MpegSampleDescription(StreamType stream_type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+ virtual ~AP4_MpegSampleDescription();
+
+ // accessors
+ AP4_Byte GetStreamType() const { return m_StreamType; }
+ AP4_Byte GetObjectTypeId() const { return m_ObjectTypeId; }
+ const AP4_DataBuffer* GetDecoderInfo() const { return m_DecoderInfo; }
+ AP4_UI32 GetBufferSize() const { return m_BufferSize; }
+ AP4_UI32 GetMaxBitrate() const { return m_MaxBitrate; }
+ AP4_UI32 GetAvgBitrate() const { return m_AvgBitrate; }
+
+ // methods
+ AP4_EsDescriptor* CreateEsDescriptor() const;
+
+ protected:
+ // members
+ StreamType m_StreamType;
+ OTI m_ObjectTypeId;
+ AP4_DataBuffer* m_DecoderInfo;
+ AP4_UI32 m_BufferSize;
+ AP4_UI32 m_MaxBitrate;
+ AP4_UI32 m_AvgBitrate;
+
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegSystemSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegSystemSampleDescription : public AP4_MpegSampleDescription
+{
+public:
+ // constructor
+ AP4_MpegSystemSampleDescription(StreamType type,
+ OTI oti,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+
+ // methods
+ AP4_Atom* ToAtom() const;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegAudioSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegAudioSampleDescription : public AP4_MpegSampleDescription
+{
+public:
+ // constructor
+ AP4_MpegAudioSampleDescription(OTI oti,
+ unsigned int sample_rate,
+ unsigned int sample_size,
+ unsigned int channel_count,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+
+ // accessors
+ AP4_UI32 GetSampleRate() { return m_SampleRate; }
+ AP4_UI16 GetSampleSize() { return m_SampleSize; }
+ AP4_UI16 GetChannelCount() { return m_ChannelCount; }
+
+ // methods
+ AP4_Atom* ToAtom() const;
+
+protected:
+ // members
+ AP4_UI32 m_SampleRate;
+ AP4_UI16 m_SampleSize;
+ AP4_UI16 m_ChannelCount;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegVideoSampleDescription
++---------------------------------------------------------------------*/
+class AP4_MpegVideoSampleDescription : public AP4_MpegSampleDescription
+{
+public:
+ // constructor
+ AP4_MpegVideoSampleDescription(OTI oti,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ const AP4_DataBuffer* decoder_info,
+ AP4_UI32 buffer_size,
+ AP4_UI32 max_bitrate,
+ AP4_UI32 avg_bitrate);
+
+ // accessors
+ AP4_UI32 GetWidth() { return m_Width; }
+ AP4_UI16 GetHeight() { return m_Height; }
+ AP4_UI16 GetDepth() { return m_Depth; }
+ const char* GetCompressorName() { return m_CompressorName.c_str(); }
+
+ // methods
+ AP4_Atom* ToAtom() const;
+
+protected:
+ // members
+ AP4_UI16 m_Width;
+ AP4_UI16 m_Height;
+ AP4_UI16 m_Depth;
+ AP4_String m_CompressorName;
+};
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_MpegSampleDescription::StreamType AP4_FORBIDDEN_STREAM_TYPE = 0x00;
+const AP4_MpegSampleDescription::StreamType AP4_OD_STREAM_TYPE = 0x01;
+const AP4_MpegSampleDescription::StreamType AP4_CR_STREAM_TYPE = 0x02;
+const AP4_MpegSampleDescription::StreamType AP4_BIFS_STREAM_TYPE = 0x03;
+const AP4_MpegSampleDescription::StreamType AP4_VISUAL_STREAM_TYPE = 0x04;
+const AP4_MpegSampleDescription::StreamType AP4_AUDIO_STREAM_TYPE = 0x05;
+const AP4_MpegSampleDescription::StreamType AP4_MPEG7_STREAM_TYPE = 0x06;
+const AP4_MpegSampleDescription::StreamType AP4_IPMP_STREAM_TYPE = 0x07;
+const AP4_MpegSampleDescription::StreamType AP4_OCI_STREAM_TYPE = 0x08;
+const AP4_MpegSampleDescription::StreamType AP4_MPEGJ_STREAM_TYPE = 0x09;
+
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_SYSTEM_OTI = 0x01;
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_SYSTEM_COR_OTI = 0x02;
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_VISUAL_OTI = 0x20;
+const AP4_MpegSampleDescription::OTI AP4_MPEG4_AUDIO_OTI = 0x40;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_SIMPLE_OTI = 0x60;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_MAIN_OTI = 0x61;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_SNR_OTI = 0x62;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_SPATIAL_OTI = 0x63;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_HIGH_OTI = 0x64;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_VISUAL_422_OTI = 0x65;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_AAC_AUDIO_MAIN_OTI = 0x66;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_AAC_AUDIO_LC_OTI = 0x67;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_AAC_AUDIO_SSRP_OTI = 0x68;
+const AP4_MpegSampleDescription::OTI AP4_MPEG2_PART3_AUDIO_OTI = 0x69;
+const AP4_MpegSampleDescription::OTI AP4_MPEG1_VISUAL_OTI = 0x6A;
+const AP4_MpegSampleDescription::OTI AP4_MPEG1_AUDIO_OTI = 0x6B;
+const AP4_MpegSampleDescription::OTI AP4_JPEG_OTI = 0x6C;
+
+const AP4_MpegSampleDescription::OTI AP4_NERO_VOBSUB = 0xE0;
+
+#endif // _AP4_SAMPLE_DESCRIPTION_H_
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleEntry.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleEntry.cpp
new file mode 100644
index 000000000..b5af0373e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleEntry.cpp
@@ -0,0 +1,1141 @@
+/*****************************************************************
+|
+| AP4 - sample entries
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4SampleEntry.h"
+#include "Ap4Utils.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4TimsAtom.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4FtabAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::AP4_SampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry::AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_UI16 data_reference_index) :
+ AP4_ContainerAtom(format, AP4_ATOM_HEADER_SIZE+8, false),
+ m_DataReferenceIndex(data_reference_index)
+{
+ m_Reserved1[0] = 0;
+ m_Reserved1[1] = 0;
+ m_Reserved1[2] = 0;
+ m_Reserved1[3] = 0;
+ m_Reserved1[4] = 0;
+ m_Reserved1[5] = 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::AP4_SampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry::AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_Size size) :
+ AP4_ContainerAtom(format, size)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::AP4_SampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry::AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(format, size)
+{
+ // read the fields before the children atoms
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_SampleEntry::GetFieldsSize()
+{
+ return 8;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ stream.Read(m_Reserved1, sizeof(m_Reserved1), NULL);
+ stream.ReadUI16(m_DataReferenceIndex);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // reserved1
+ result = stream.Write(m_Reserved1, sizeof(m_Reserved1));
+ if (AP4_FAILED(result)) return result;
+
+ // data reference index
+ result = stream.WriteUI16(m_DataReferenceIndex);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::Write
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::Write(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the header
+ result = WriteHeader(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // write the fields
+ result = WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // write the children atoms
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("data_reference_index", m_DataReferenceIndex);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::Inspect
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SampleEntry::Inspect(AP4_AtomInspector& inspector)
+{
+ // inspect the header
+ InspectHeader(inspector);
+
+ // inspect the fields
+ InspectFields(inspector);
+
+ // inspect children
+ m_Children.Apply(AP4_AtomListInspector(inspector));
+
+ // finish
+ inspector.EndElement();
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::OnChildChanged
++---------------------------------------------------------------------*/
+void
+AP4_SampleEntry::OnChildChanged(AP4_Atom*)
+{
+ // remcompute our size
+ m_Size = GetHeaderSize()+GetFieldsSize();
+ m_Children.Apply(AP4_AtomSizeAdder(m_Size));
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_SampleEntry::ToSampleDescription()
+{
+ return new AP4_UnknownSampleDescription(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor) :
+ AP4_SampleEntry(format)
+{
+ if (descriptor) AddChild(new AP4_EsdsAtom(descriptor));
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_Size size) :
+ AP4_SampleEntry(format, size)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+AP4_MpegSampleEntry::AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_SampleEntry(format, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry::AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+const AP4_DecoderConfigDescriptor*
+AP4_MpegSampleEntry::GetDecoderConfigDescriptor()
+{
+ AP4_Atom* child = GetChild(AP4_ATOM_TYPE_ESDS);
+
+ if(!child && (child = GetChild(AP4_ATOM_TYPE_WAVE)))
+ {
+ if(AP4_ContainerAtom* wave = dynamic_cast<AP4_ContainerAtom*>(child))
+ {
+ child = wave->GetChild(AP4_ATOM_TYPE_ESDS);
+ }
+ }
+
+ if (child) {
+ AP4_EsdsAtom* esds = (AP4_EsdsAtom*)child;
+
+ // get the es descriptor
+ const AP4_EsDescriptor* es_desc = esds->GetEsDescriptor();
+ if (es_desc == NULL) return NULL;
+
+ // get the decoder config descriptor
+ return es_desc->GetDecoderConfigDescriptor();
+ } else {
+ return NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry(AP4_EsDescriptor* descriptor) :
+ AP4_MpegSampleEntry(AP4_ATOM_TYPE_MP4S, descriptor)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4sSampleEntry::AP4_Mp4sSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_MpegSampleEntry(AP4_ATOM_TYPE_MP4S, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_Mp4sSampleEntry::ToSampleDescription()
+{
+ // get the decoder config descriptor
+ const AP4_DecoderConfigDescriptor* dc_desc;
+ dc_desc = GetDecoderConfigDescriptor();
+ if (dc_desc == NULL) return NULL;
+ const AP4_DataBuffer* dsi = NULL;
+ const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
+ dc_desc->GetDecoderSpecificInfoDescriptor();
+ if (dsi_desc != NULL) {
+ dsi = &dsi_desc->GetDecoderSpecificInfo();
+ }
+
+ // create a sample description
+ return new AP4_MpegSystemSampleDescription(
+ dc_desc->GetStreamType(),
+ dc_desc->GetObjectTypeIndication(),
+ dsi,
+ dc_desc->GetBufferSize(),
+ dc_desc->GetMaxBitrate(),
+ dc_desc->GetAvgBitrate());
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::AP4_AudioSampleEntry
++---------------------------------------------------------------------*/
+AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count) :
+ AP4_MpegSampleEntry(format, descriptor),
+ m_DescriptionVersion(0),
+ m_RevisionLevel(0),
+ m_Vendor(0),
+ m_SampleRate(sample_rate),
+ m_ChannelCount(channel_count),
+ m_SampleSize(sample_size)
+{
+ m_Size += 20;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::AP4_AudioSampleEntry
++---------------------------------------------------------------------*/
+AP4_AudioSampleEntry::AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_MpegSampleEntry(format, size)
+{
+ // read fields
+ ReadFields(stream);
+
+ // must be called after m_DescriptionVersion was already set
+ AP4_Size fields_size = GetFieldsSize();
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_AudioSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize() + 20 + (m_DescriptionVersion == 1 ? 16 : 0);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AudioSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // read the fields of this class
+ stream.ReadUI16(m_DescriptionVersion);
+ stream.ReadUI16(m_RevisionLevel);
+ stream.ReadUI32(m_Vendor);
+
+ m_SamplesPerPacket = 0;
+ m_BytesPerPacket = 0;
+ m_BytesPerSample = 0;
+ m_BytesPerFrame = 0;
+
+ if(m_DescriptionVersion == 0 || m_DescriptionVersion == 1)
+ {
+ stream.ReadUI16(m_ChannelCount);
+ stream.ReadUI16(m_SampleSize);
+ stream.ReadUI16(m_CompressionID);
+ stream.ReadUI16(m_PacketSize);
+ stream.ReadUI32(m_SampleRate);
+
+ if(m_DescriptionVersion == 1)
+ {
+ stream.ReadUI32(m_SamplesPerPacket);
+ stream.ReadUI32(m_BytesPerPacket);
+ stream.ReadUI32(m_BytesPerFrame);
+ stream.ReadUI32(m_BytesPerSample);
+ }
+ }
+ else if(m_DescriptionVersion == 2)
+ {
+ char junk[16];
+
+ stream.Read(junk, 12); // always 00 03 00 10 FF FE 00 00 00 01 00 00
+
+ AP4_UI32 SizeOfStructOnly;
+ stream.ReadUI32(SizeOfStructOnly);
+ if(SizeOfStructOnly < 0x48) return AP4_FAILURE;
+
+ m_SampleSize = 0;
+
+ AP4_UI64 SampleRate;
+ stream.ReadUI64(SampleRate);
+ m_SampleRate = (AP4_UI32)(*(double*)&SampleRate * 65536);
+
+ AP4_UI32 ChannelCount;
+ stream.ReadUI32(ChannelCount);
+ m_ChannelCount = (AP4_UI16)ChannelCount;
+
+ stream.Read(junk, 4); // always 7f 00 00 00
+ stream.Read(junk, 16); // constBitsPerChannel, formatSpecificFlags, constBytesPerAudioPacket, constLPCMFramesPerAudioPacket
+
+ SizeOfStructOnly -= 0x48;
+
+ if(SizeOfStructOnly > 0)
+ {
+ AP4_Offset offset;
+ stream.Tell(offset);
+ stream.Seek(offset + SizeOfStructOnly);
+ }
+ }
+ else
+ {
+ return AP4_FAILURE;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AudioSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the fields of the base class
+ result = AP4_SampleEntry::WriteFields(stream);
+
+ //
+ result = stream.WriteUI16(m_DescriptionVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_RevisionLevel);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Vendor);
+ if (AP4_FAILED(result)) return result;
+
+ // channel count
+ result = stream.WriteUI16(m_ChannelCount);
+ if (AP4_FAILED(result)) return result;
+
+ // sample size
+ result = stream.WriteUI16(m_SampleSize);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined1
+ result = stream.WriteUI16(m_CompressionID);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved3
+ result = stream.WriteUI16(m_PacketSize);
+ if (AP4_FAILED(result)) return result;
+
+ // sample rate
+ result = stream.WriteUI32(m_SampleRate);
+ if (AP4_FAILED(result)) return result;
+
+ if(m_DescriptionVersion == 1)
+ {
+ result = stream.WriteUI32(m_SamplesPerPacket);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_BytesPerPacket);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_BytesPerFrame);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_BytesPerSample);
+ if (AP4_FAILED(result)) return result;
+ }
+ else if(m_DescriptionVersion != 0)
+ {
+ return AP4_FAILURE;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AudioSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // dump the fields from the base class
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // fields
+ inspector.AddField("channel_count", m_ChannelCount);
+ inspector.AddField("sample_size", m_SampleSize);
+ inspector.AddField("sample_rate", m_SampleRate>>16);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_AudioSampleEntry::ToSampleDescription()
+{
+ // get the decoder config descriptor
+ const AP4_DecoderConfigDescriptor* dc_desc;
+ dc_desc = GetDecoderConfigDescriptor();
+ if (dc_desc == NULL) return NULL;
+ const AP4_DataBuffer* dsi = NULL;
+ const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
+ dc_desc->GetDecoderSpecificInfoDescriptor();
+ if (dsi_desc != NULL) {
+ dsi = &dsi_desc->GetDecoderSpecificInfo();
+ }
+
+ // create a sample description
+ return new AP4_MpegAudioSampleDescription(
+ dc_desc->GetObjectTypeIndication(),
+ m_SampleRate>>16,
+ m_SampleSize,
+ m_ChannelCount,
+ dsi,
+ dc_desc->GetBufferSize(),
+ dc_desc->GetMaxBitrate(),
+ dc_desc->GetAvgBitrate());
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor) :
+ AP4_AudioSampleEntry(AP4_ATOM_TYPE_MP4A,
+ descriptor,
+ sample_rate,
+ sample_size,
+ channel_count)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4aSampleEntry::AP4_Mp4aSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_AudioSampleEntry(AP4_ATOM_TYPE_MP4A, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::AP4_VisualSampleEntry
++---------------------------------------------------------------------*/
+AP4_VisualSampleEntry::AP4_VisualSampleEntry(
+ AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name) :
+ AP4_MpegSampleEntry(format, descriptor),
+ m_Predefined1(0),
+ m_Reserved2(0),
+ m_Width(width),
+ m_Height(height),
+ m_HorizResolution(0x00480000),
+ m_VertResolution(0x00480000),
+ m_Reserved3(0),
+ m_FrameCount(1),
+ m_CompressorName(compressor_name),
+ m_Depth(depth),
+ m_Predefined3(0xFFFF)
+{
+ memset(m_Predefined2, 0, sizeof(m_Predefined2));
+ m_Size += 70;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::AP4_VisualSampleEntry
++---------------------------------------------------------------------*/
+AP4_VisualSampleEntry::AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_MpegSampleEntry(format, size)
+{
+ // read fields
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_VisualSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize()+70;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VisualSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // read fields from this class
+ stream.ReadUI16(m_Predefined1);
+ stream.ReadUI16(m_Reserved2);
+ stream.Read(m_Predefined2, sizeof(m_Predefined2), NULL);
+ stream.ReadUI16(m_Width);
+ stream.ReadUI16(m_Height);
+ stream.ReadUI32(m_HorizResolution);
+ stream.ReadUI32(m_VertResolution);
+ stream.ReadUI32(m_Reserved3);
+ stream.ReadUI16(m_FrameCount);
+
+ char compressor_name[33];
+ stream.Read(compressor_name, 32);
+ int name_length = compressor_name[0];
+ if (name_length < 32) {
+ compressor_name[name_length+1] = 0;
+ m_CompressorName = &compressor_name[1];
+ }
+
+ stream.ReadUI16(m_Depth);
+ stream.ReadUI16(m_Predefined3);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VisualSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the fields of the base class
+ result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined1
+ result = stream.WriteUI16(m_Predefined1);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved2
+ result = stream.WriteUI16(m_Reserved2);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined2
+ result = stream.Write(m_Predefined2, sizeof(m_Predefined2));
+ if (AP4_FAILED(result)) return result;
+
+ // width
+ result = stream.WriteUI16(m_Width);
+ if (AP4_FAILED(result)) return result;
+
+ // height
+ result = stream.WriteUI16(m_Height);
+ if (AP4_FAILED(result)) return result;
+
+ // horizontal resolution
+ result = stream.WriteUI32(m_HorizResolution);
+ if (AP4_FAILED(result)) return result;
+
+ // vertical resolution
+ result = stream.WriteUI32(m_VertResolution);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved3
+ result = stream.WriteUI32(m_Reserved3);
+ if (AP4_FAILED(result)) return result;
+
+ // frame count
+ result = stream.WriteUI16(m_FrameCount);
+ if (AP4_FAILED(result)) return result;
+
+ // compressor name
+ unsigned char compressor_name[32];
+ unsigned int name_length = m_CompressorName.length();
+ if (name_length > 31) name_length = 31;
+ compressor_name[0] = name_length;
+ for (unsigned int i=0; i<name_length; i++) {
+ compressor_name[i+1] = m_CompressorName[i];
+ }
+ for (unsigned int i=name_length+1; i<32; i++) {
+ compressor_name[i] = 0;
+ }
+ result = stream.Write(compressor_name, 32);
+ if (AP4_FAILED(result)) return result;
+
+ // depth
+ result = stream.WriteUI16(m_Depth);
+ if (AP4_FAILED(result)) return result;
+
+ // predefined3
+ result = stream.WriteUI16(m_Predefined3);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_VisualSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // dump the fields of the base class
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // fields
+ inspector.AddField("width", m_Width);
+ inspector.AddField("height", m_Height);
+ inspector.AddField("compressor", m_CompressorName.c_str());
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry::ToSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_VisualSampleEntry::ToSampleDescription()
+{
+ // get the decoder config descriptor
+ const AP4_DecoderConfigDescriptor* dc_desc;
+ dc_desc = GetDecoderConfigDescriptor();
+ if (dc_desc == NULL) return NULL;
+ const AP4_DataBuffer* dsi = NULL;
+ const AP4_DecoderSpecificInfoDescriptor* dsi_desc =
+ dc_desc->GetDecoderSpecificInfoDescriptor();
+ if (dsi_desc != NULL) {
+ dsi = &dsi_desc->GetDecoderSpecificInfo();
+ }
+
+ // create a sample description
+ return new AP4_MpegVideoSampleDescription(
+ dc_desc->GetObjectTypeIndication(),
+ m_Width,
+ m_Height,
+ m_Depth,
+ m_CompressorName.c_str(),
+ dsi,
+ dc_desc->GetBufferSize(),
+ dc_desc->GetMaxBitrate(),
+ dc_desc->GetAvgBitrate());
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_MP4V,
+ descriptor,
+ width,
+ height,
+ depth,
+ compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Mp4vSampleEntry::AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+AP4_Mp4vSampleEntry::AP4_Mp4vSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_MP4V, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Avc1SampleEntry::AP4_Avc1SampleEntry
++---------------------------------------------------------------------*/
+AP4_Avc1SampleEntry::AP4_Avc1SampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_AVC1,
+ descriptor,
+ width,
+ height,
+ depth,
+ compressor_name)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Avc1SampleEntry::AP4_Avc1SampleEntry
++---------------------------------------------------------------------*/
+AP4_Avc1SampleEntry::AP4_Avc1SampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_VisualSampleEntry(AP4_ATOM_TYPE_AVC1, size, stream, atom_factory)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_UI16 hint_track_version,
+ AP4_UI16 highest_compatible_version,
+ AP4_UI32 max_packet_size,
+ AP4_UI32 timescale):
+ AP4_SampleEntry(AP4_ATOM_TYPE_RTP),
+ m_HintTrackVersion(hint_track_version),
+ m_HighestCompatibleVersion(highest_compatible_version),
+ m_MaxPacketSize(max_packet_size)
+{
+ // build an atom for timescale
+ AddChild(new AP4_TimsAtom(timescale));
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+AP4_RtpHintSampleEntry::AP4_RtpHintSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
+ AP4_SampleEntry(AP4_ATOM_TYPE_RTP, size)
+{
+ // read fields
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (ex: esds and maybe others)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::~AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+AP4_RtpHintSampleEntry::~AP4_RtpHintSampleEntry()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_RtpHintSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize()+8;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpHintSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // data
+ result = stream.ReadUI16(m_HintTrackVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_HighestCompatibleVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI32(m_MaxPacketSize);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpHintSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // data
+ result = stream.WriteUI16(m_HintTrackVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_HighestCompatibleVersion);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_MaxPacketSize);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_RtpHintSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // sample entry
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // fields
+ inspector.AddField("hint_track_version", m_HintTrackVersion);
+ inspector.AddField("highest_compatible_version", m_HighestCompatibleVersion);
+ inspector.AddField("max_packet_size", m_MaxPacketSize);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::AP4_TextSampleEntry
++---------------------------------------------------------------------*/
+AP4_TextSampleEntry::AP4_TextSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
+ AP4_SampleEntry(AP4_ATOM_TYPE_TEXT, size)
+{
+ // read fields
+ ReadFields(stream);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::~AP4_TextSampleEntry
++---------------------------------------------------------------------*/
+AP4_TextSampleEntry::~AP4_TextSampleEntry()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TextSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // data
+ result = stream.ReadUI32(m_Description.DisplayFlags);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI32(m_Description.TextJustification);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Read(&m_Description.BackgroundColor, 4);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Top);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Left);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Bottom);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Right);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.StartChar);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.EndChar);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.Ascent);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.Font.Id);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.Style.Font.Face);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.Style.Font.Size);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Read(&m_Description.Style.Font.Color, 4);
+ if (AP4_FAILED(result)) return result;
+
+ // TODO: stream.ReadString(); -> m_Description.DefaultFontName
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TextSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // TODO: data
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TextSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // sample entry
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // TODO: fields
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::AP4_Tx3gSampleEntry
++---------------------------------------------------------------------*/
+AP4_Tx3gSampleEntry::AP4_Tx3gSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory):
+ AP4_SampleEntry(AP4_ATOM_TYPE_TX3G, size)
+{
+ // read fields
+ AP4_Size fields_size = GetFieldsSize();
+ ReadFields(stream);
+
+ // read children atoms (fdat? blnk?)
+ ReadChildren(atom_factory, stream, size-AP4_ATOM_HEADER_SIZE-fields_size);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::~AP4_Tx3gSampleEntry
++---------------------------------------------------------------------*/
+AP4_Tx3gSampleEntry::~AP4_Tx3gSampleEntry()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::GetFieldsSize
++---------------------------------------------------------------------*/
+AP4_Size
+AP4_Tx3gSampleEntry::GetFieldsSize()
+{
+ return AP4_SampleEntry::GetFieldsSize()+4+1+1+4+2+2+2+2+2+2+2+1+1+4;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::ReadFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Tx3gSampleEntry::ReadFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::ReadFields(stream);
+ if (result < 0) return result;
+
+ // data
+ result = stream.ReadUI32(m_Description.DisplayFlags);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.HorizontalJustification);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.VerticalJustification);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Read(&m_Description.BackgroundColor, 4);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Top);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Left);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Bottom);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.TextBox.Right);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.StartChar);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.EndChar);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI16(m_Description.Style.Font.Id);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.Style.Font.Face);
+ if (AP4_FAILED(result)) return result;
+ result = stream.ReadUI08(m_Description.Style.Font.Size);
+ if (AP4_FAILED(result)) return result;
+ result = stream.Read(&m_Description.Style.Font.Color, 4);
+ if (AP4_FAILED(result)) return result;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Tx3gSampleEntry::WriteFields(AP4_ByteStream& stream)
+{
+ // sample entry
+ AP4_Result result = AP4_SampleEntry::WriteFields(stream);
+ if (AP4_FAILED(result)) return result;
+
+ // TODO: data
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Tx3gSampleEntry::InspectFields(AP4_AtomInspector& inspector)
+{
+ // sample entry
+ AP4_SampleEntry::InspectFields(inspector);
+
+ // TODO: fields
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry::GetFontNameById
++---------------------------------------------------------------------*/
+
+AP4_Result
+AP4_Tx3gSampleEntry::GetFontNameById(AP4_Ordinal Id, AP4_String& Name)
+{
+ if(AP4_FtabAtom* ftab = dynamic_cast<AP4_FtabAtom*>(GetChild(AP4_ATOM_TYPE_FTAB)))
+ {
+ AP4_Array<AP4_FtabAtom::AP4_Tx3gFontRecord> FontRecords = ftab->GetFontRecords();
+
+ for(int i = 0, j = FontRecords.ItemCount(); i < j; i++)
+ {
+ if(Id == FontRecords[i].Id)
+ {
+ Name = FontRecords[i].Name;
+ return AP4_SUCCESS;
+ }
+ }
+ }
+
+ return AP4_FAILURE;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleEntry.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleEntry.h
new file mode 100644
index 000000000..ba657f77f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SampleEntry.h
@@ -0,0 +1,372 @@
+/*****************************************************************
+|
+| AP4 - sample entries
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_SAMPLE_ENTRY_H_
+#define _AP4_SAMPLE_ENTRY_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4EsdsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_SampleDescription;
+
+/*----------------------------------------------------------------------
+| AP4_SampleEntry
++---------------------------------------------------------------------*/
+class AP4_SampleEntry : public AP4_ContainerAtom
+{
+ public:
+ // methods
+ AP4_SampleEntry(AP4_Atom::Type format, AP4_UI16 data_ref_index = 1);
+ AP4_SampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_UI16 GetDataReferenceIndex() { return m_DataReferenceIndex; }
+ virtual AP4_Result Write(AP4_ByteStream& stream);
+ virtual AP4_Result Inspect(AP4_AtomInspector& inspector);
+ virtual AP4_SampleDescription* ToSampleDescription();
+
+ // AP4_AtomParent methods
+ virtual void OnChildChanged(AP4_Atom* child);
+
+ protected:
+ // constructor
+ AP4_SampleEntry(AP4_Atom::Type format, AP4_Size size);
+
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_UI08 m_Reserved1[6]; // = 0
+ AP4_UI16 m_DataReferenceIndex;
+};
+
+/*----------------------------------------------------------------------
+| AP4_MpegSampleEntry
++---------------------------------------------------------------------*/
+class AP4_MpegSampleEntry : public AP4_SampleEntry
+{
+protected:
+ // constructor
+ AP4_MpegSampleEntry(AP4_Atom::Type format);
+ AP4_MpegSampleEntry(AP4_Atom::Type format, AP4_Size size);
+ AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor);
+ AP4_MpegSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ // methods
+ const AP4_DecoderConfigDescriptor* GetDecoderConfigDescriptor();
+};
+
+/*----------------------------------------------------------------------
+| AP4_Mp4sSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Mp4sSampleEntry : public AP4_MpegSampleEntry
+{
+ public:
+ // constructors
+ AP4_Mp4sSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Mp4sSampleEntry(AP4_EsDescriptor* descriptor);
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+};
+
+/*----------------------------------------------------------------------
+| AP4_AudioSampleEntry
++---------------------------------------------------------------------*/
+class AP4_AudioSampleEntry : public AP4_MpegSampleEntry
+{
+ public:
+ // methods
+ AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count);
+ AP4_AudioSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ // accessors
+ AP4_UI32 GetSampleRate() { return m_SampleRate>>16; }
+ AP4_UI16 GetSampleSize() { return m_SampleSize; }
+ AP4_UI16 GetChannelCount() { return m_ChannelCount; }
+ AP4_UI32 GetSamplesPerPacket(){ return m_SamplesPerPacket; }
+ AP4_UI32 GetBytesPerPacket(){ return m_BytesPerPacket; }
+ AP4_UI32 GetBytesPerFrame(){ return m_BytesPerFrame; }
+ AP4_UI32 GetBytesPerSample(){ return m_BytesPerSample; }
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_UI16 m_DescriptionVersion;
+ AP4_UI16 m_RevisionLevel;
+ AP4_UI32 m_Vendor;
+ AP4_UI16 m_ChannelCount;
+ AP4_UI16 m_SampleSize;
+ AP4_UI16 m_CompressionID;
+ AP4_UI16 m_PacketSize;
+ AP4_UI32 m_SampleRate;
+ // m_Version == 1 ?
+ AP4_UI32 m_SamplesPerPacket;
+ AP4_UI32 m_BytesPerPacket;
+ AP4_UI32 m_BytesPerFrame;
+ AP4_UI32 m_BytesPerSample;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Mp4aSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Mp4aSampleEntry : public AP4_AudioSampleEntry
+{
+ public:
+ // constructors
+ AP4_Mp4aSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Mp4aSampleEntry(AP4_UI32 sample_rate,
+ AP4_UI16 sample_size,
+ AP4_UI16 channel_count,
+ AP4_EsDescriptor* descriptor);
+};
+
+/*----------------------------------------------------------------------
+| AP4_VisualSampleEntry
++---------------------------------------------------------------------*/
+class AP4_VisualSampleEntry : public AP4_MpegSampleEntry
+{
+ public:
+ // methods
+ AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_EsDescriptor* descriptor,
+ AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name);
+ AP4_VisualSampleEntry(AP4_Atom::Type format,
+ AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+
+ // accessors
+ AP4_UI16 GetWidth() { return m_Width; }
+ AP4_UI16 GetHeight() { return m_Height; }
+ AP4_UI16 GetHorizResolution(){ return m_HorizResolution; }
+ AP4_UI16 GetVertResolution() { return m_VertResolution; }
+ AP4_UI16 GetDepth() { return m_Depth; }
+ const char* GetCompressorName() { return m_CompressorName.c_str(); }
+
+ // methods
+ AP4_SampleDescription* ToSampleDescription();
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ //members
+ AP4_UI16 m_Predefined1; // = 0
+ AP4_UI16 m_Reserved2; // = 0
+ AP4_UI08 m_Predefined2[12]; // = 0
+ AP4_UI16 m_Width;
+ AP4_UI16 m_Height;
+ AP4_UI32 m_HorizResolution; // = 0x00480000 (72 dpi)
+ AP4_UI32 m_VertResolution; // = 0x00480000 (72 dpi)
+ AP4_UI32 m_Reserved3; // = 0
+ AP4_UI16 m_FrameCount; // = 1
+ AP4_String m_CompressorName;
+ AP4_UI16 m_Depth; // = 0x0018
+ AP4_UI16 m_Predefined3; // = 0xFFFF
+};
+
+/*----------------------------------------------------------------------
+| AP4_Mp4vSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Mp4vSampleEntry : public AP4_VisualSampleEntry
+{
+ public:
+ // constructors
+ AP4_Mp4vSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Mp4vSampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor);
+};
+
+/*----------------------------------------------------------------------
+| AP4_Avc1SampleEntry
++---------------------------------------------------------------------*/
+class AP4_Avc1SampleEntry : public AP4_VisualSampleEntry
+{
+public:
+ // constructors
+ AP4_Avc1SampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Avc1SampleEntry(AP4_UI16 width,
+ AP4_UI16 height,
+ AP4_UI16 depth,
+ const char* compressor_name,
+ AP4_EsDescriptor* descriptor);
+};
+
+/*----------------------------------------------------------------------
+| AP4_RtpHintSampleEntry
++---------------------------------------------------------------------*/
+class AP4_RtpHintSampleEntry : public AP4_SampleEntry
+{
+public:
+ // methods
+ AP4_RtpHintSampleEntry(AP4_UI16 hint_track_version,
+ AP4_UI16 highest_compatible_version,
+ AP4_UI32 max_packet_size,
+ AP4_UI32 timescale);
+ AP4_RtpHintSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ virtual ~AP4_RtpHintSampleEntry();
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_UI16 m_HintTrackVersion;
+ AP4_UI16 m_HighestCompatibleVersion;
+ AP4_UI32 m_MaxPacketSize;
+};
+
+/*----------------------------------------------------------------------
+| AP4_TextSampleEntry
++---------------------------------------------------------------------*/
+class AP4_TextSampleEntry : public AP4_SampleEntry
+{
+public:
+ // methods
+ AP4_TextSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ virtual ~AP4_TextSampleEntry();
+
+ struct AP4_TextDescription
+ {
+ AP4_UI32 DisplayFlags;
+ AP4_UI32 TextJustification;
+ AP4_UI32 BackgroundColor;
+ struct {AP4_UI16 Top, Left, Bottom, Right;} TextBox;
+ struct {AP4_UI16 StartChar, EndChar, Ascent; struct {AP4_UI16 Id; AP4_UI08 Face, Size; AP4_UI32 Color;} Font;} Style;
+ AP4_String DefaultFontName;
+ };
+
+ const AP4_TextDescription& GetDescription() const { return m_Description; };
+
+protected:
+ // methods
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_TextDescription m_Description;
+};
+
+/*----------------------------------------------------------------------
+| AP4_Tx3gSampleEntry
++---------------------------------------------------------------------*/
+class AP4_Tx3gSampleEntry : public AP4_SampleEntry
+{
+public:
+ // methods
+ AP4_Tx3gSampleEntry(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ virtual ~AP4_Tx3gSampleEntry();
+
+ struct AP4_Tx3gDescription
+ {
+ AP4_UI32 DisplayFlags;
+ AP4_UI08 HorizontalJustification;
+ AP4_UI08 VerticalJustification;
+ AP4_UI32 BackgroundColor;
+ struct {AP4_UI16 Top, Left, Bottom, Right;} TextBox;
+ struct {AP4_UI16 StartChar, EndChar; struct {AP4_UI16 Id; AP4_UI08 Face, Size; AP4_UI32 Color;} Font;} Style;
+ };
+
+ const AP4_Tx3gDescription& GetDescription() const { return m_Description; };
+
+ AP4_Result GetFontNameById(AP4_Ordinal Id, AP4_String& Name);
+
+protected:
+ // methods
+ virtual AP4_Size GetFieldsSize();
+ virtual AP4_Result ReadFields(AP4_ByteStream& stream);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+
+ // members
+ AP4_Tx3gDescription m_Description;
+};
+
+#endif // _AP4_SAMPLE_ENTRY_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StcoAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StcoAtom.cpp
new file mode 100644
index 000000000..feee85716
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StcoAtom.cpp
@@ -0,0 +1,152 @@
+/*****************************************************************
+|
+| AP4 - stco Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::AP4_StcoAtom
++---------------------------------------------------------------------*/
+AP4_StcoAtom::AP4_StcoAtom(AP4_UI32* entries, AP4_UI32 entry_count) :
+AP4_Atom(AP4_ATOM_TYPE_STCO,
+ AP4_FULL_ATOM_HEADER_SIZE+4+entry_count*4,
+ true),
+ m_Entries(new AP4_UI32[entry_count]),
+ m_EntryCount(entry_count)
+{
+ memcpy(m_Entries, entries, m_EntryCount*4);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::AP4_StcoAtom
++---------------------------------------------------------------------*/
+AP4_StcoAtom::AP4_StcoAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STCO, size, true, stream)
+{
+ stream.ReadUI32(m_EntryCount);
+ if (m_EntryCount > (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4) {
+ m_EntryCount = (size-AP4_FULL_ATOM_HEADER_SIZE-4)/4;
+ }
+ m_Entries = new AP4_UI32[m_EntryCount];
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ stream.ReadUI32(m_Entries[i]);
+ i = i;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::~AP4_StcoAtom
++---------------------------------------------------------------------*/
+AP4_StcoAtom::~AP4_StcoAtom()
+{
+ delete[] m_Entries;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::GetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::GetChunkOffset(AP4_Ordinal chunk, AP4_Offset& chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // get the chunk offset
+ chunk_offset = m_Entries[chunk - 1]; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::SetChunkOffset
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::SetChunkOffset(AP4_Ordinal chunk, AP4_Offset chunk_offset)
+{
+ // check the bounds
+ if (chunk > m_EntryCount || chunk == 0) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ // get the chunk offset
+ m_Entries[chunk - 1] = chunk_offset; // m_Entries is zero index based
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::AdjustChunkOffsets
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::AdjustChunkOffsets(AP4_Offset offset)
+{
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ m_Entries[i] += offset;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ result = stream.WriteUI32(m_EntryCount);
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ for (AP4_Ordinal i=0; i<m_EntryCount; i++) {
+ result = stream.WriteUI32(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StcoAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StcoAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_EntryCount);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StscAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StscAtom.h
new file mode 100644
index 000000000..09d4b905d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StscAtom.h
@@ -0,0 +1,105 @@
+/*****************************************************************
+|
+| AP4 - stsc Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSC_ATOM_H_
+#define _AP4_STSC_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StscTableEntry
++---------------------------------------------------------------------*/
+class AP4_StscTableEntry {
+ public:
+ AP4_StscTableEntry() :
+ m_FirstChunk(0),
+ m_FirstSample(0),
+ m_ChunkCount(0),
+ m_SamplesPerChunk(0),
+ m_SampleDescriptionIndex(0) {}
+ AP4_StscTableEntry(AP4_Ordinal first_chunk,
+ AP4_Ordinal first_sample,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index) :
+ m_FirstChunk(first_chunk),
+ m_FirstSample(first_sample),
+ m_ChunkCount(0),
+ m_SamplesPerChunk(samples_per_chunk),
+ m_SampleDescriptionIndex(sample_description_index) {}
+ AP4_StscTableEntry(AP4_Ordinal first_chunk,
+ AP4_Ordinal first_sample,
+ AP4_Cardinal chunk_count,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index) :
+ m_FirstChunk(first_chunk),
+ m_FirstSample(first_sample),
+ m_ChunkCount(chunk_count),
+ m_SamplesPerChunk(samples_per_chunk),
+ m_SampleDescriptionIndex(sample_description_index) {}
+ AP4_Ordinal m_FirstChunk;
+ AP4_Ordinal m_FirstSample; // computed (not in file)
+ AP4_Cardinal m_ChunkCount; // computed (not in file)
+ AP4_Cardinal m_SamplesPerChunk;
+ AP4_Ordinal m_SampleDescriptionIndex;
+};
+
+/*----------------------------------------------------------------------
+| AP4_StscAtom
++---------------------------------------------------------------------*/
+class AP4_StscAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StscAtom();
+ AP4_StscAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result GetChunkForSample(AP4_Ordinal sample,
+ AP4_Ordinal& chunk,
+ AP4_Ordinal& skip,
+ AP4_Ordinal& sample_description);
+ virtual AP4_Result AddEntry(AP4_Cardinal chunk_count,
+ AP4_Cardinal samples_per_chunk,
+ AP4_Ordinal sample_description_index);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // FIXME
+ friend class AP4_AtomSampleTable;
+
+ private:
+ // data
+ AP4_Array<AP4_StscTableEntry> m_Entries;
+ AP4_Ordinal m_CachedChunkGroup;
+};
+
+#endif // _AP4_STSC_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StsdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StsdAtom.cpp
new file mode 100644
index 000000000..852c33516
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StsdAtom.cpp
@@ -0,0 +1,196 @@
+/*****************************************************************
+|
+| AP4 - stsd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+#include "Ap4SampleEntry.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::AP4_StsdAtom
++---------------------------------------------------------------------*/
+AP4_StsdAtom::AP4_StsdAtom(AP4_SampleTable* sample_table) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_STSD, 4+AP4_FULL_ATOM_HEADER_SIZE, true)
+{
+ AP4_Cardinal sample_description_count = sample_table->GetSampleDescriptionCount();
+ m_SampleDescriptions.EnsureCapacity(sample_description_count);
+ for (AP4_Ordinal i=0; i<sample_description_count; i++) {
+ // clear the cache entry
+ m_SampleDescriptions.Append(NULL);
+
+ // create an entry for the description
+ AP4_SampleDescription* sample_description = sample_table->GetSampleDescription(i);
+ AP4_Atom* entry = sample_description->ToAtom();
+ m_Children.Add(entry);
+
+ // update the size
+ m_Size += entry->GetSize();
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::AP4_StsdAtom
++---------------------------------------------------------------------*/
+AP4_StsdAtom::AP4_StsdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_STSD, size, true, stream)
+{
+ // read the number of entries
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+
+ // read all entries
+ AP4_Size bytes_available = size-AP4_FULL_ATOM_HEADER_SIZE-4;
+
+ m_Data.SetDataSize(bytes_available);
+ stream.Read(m_Data.UseData(), m_Data.GetDataSize());
+
+ AP4_ByteStream* s = new AP4_MemoryByteStream(m_Data.UseData(), m_Data.GetDataSize());
+ for (unsigned int i=0; i<entry_count; i++) {
+ AP4_Atom* atom;
+ if (AP4_SUCCEEDED(atom_factory.CreateAtomFromStream(*s,
+ bytes_available,
+ atom,
+ this))) {
+ atom->SetParent(this);
+ m_Children.Add(atom);
+ }
+ }
+ s->Release();
+
+ // initialize the sample description cache
+ m_SampleDescriptions.EnsureCapacity(m_Children.ItemCount());
+ for (AP4_Ordinal i=0; i<m_Children.ItemCount(); i++) {
+ m_SampleDescriptions.Append(NULL);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::~AP4_StsdAtom
++---------------------------------------------------------------------*/
+AP4_StsdAtom::~AP4_StsdAtom()
+{
+ for (AP4_Ordinal i=0; i<m_SampleDescriptions.ItemCount(); i++) {
+ delete m_SampleDescriptions[i];
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StsdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // entry count
+ result = stream.WriteUI32(m_Children.ItemCount());
+ if (AP4_FAILED(result)) return result;
+
+ // entries
+ return m_Children.Apply(AP4_AtomListWriter(stream));
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::OnChildChanged
++---------------------------------------------------------------------*/
+void
+AP4_StsdAtom::OnChildChanged(AP4_Atom*)
+{
+ // remcompute our size
+ m_Size = GetHeaderSize()+4;
+ m_Children.Apply(AP4_AtomSizeAdder(m_Size));
+
+ // update our parent
+ if (m_Parent) m_Parent->OnChildChanged(this);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_StsdAtom::GetSampleDescription(AP4_Ordinal index)
+{
+ // check index
+ if (index >= m_Children.ItemCount()) return NULL;
+
+ // return the description if we already have it in the internal table
+ if (m_SampleDescriptions[index]) return m_SampleDescriptions[index];
+
+ // create and cache a sample description for this entry
+ AP4_Atom* entry;
+ m_Children.Get(index, entry);
+ AP4_SampleEntry* sample_entry = dynamic_cast<AP4_SampleEntry*>(entry);
+ if (sample_entry == NULL) return NULL;
+ m_SampleDescriptions[index] = sample_entry->ToSampleDescription();
+ return m_SampleDescriptions[index];
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::GetSampleEntry
++---------------------------------------------------------------------*/
+AP4_SampleEntry*
+AP4_StsdAtom::GetSampleEntry(AP4_Ordinal index)
+{
+ // check index
+ if (index >= m_Children.ItemCount()) return NULL;
+
+ // return the sample entry
+ AP4_Atom* entry;
+ m_Children.Get(index, entry);
+ return dynamic_cast<AP4_SampleEntry*>(entry);
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::GetSampleDescriptionCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_StsdAtom::GetSampleDescriptionCount()
+{
+ return m_Children.ItemCount();
+}
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StsdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry-count", m_Children.ItemCount());
+
+ // inspect children
+ m_Children.Apply(AP4_AtomListInspector(inspector));
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StsdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StsdAtom.h
new file mode 100644
index 000000000..83f1b036d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StsdAtom.h
@@ -0,0 +1,80 @@
+/*****************************************************************
+|
+| AP4 - stsd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSD_ATOM_H_
+#define _AP4_STSD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Types.h"
+#include "Ap4Array.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4ContainerAtom.h"
+
+/*----------------------------------------------------------------------
+| class references
++---------------------------------------------------------------------*/
+class AP4_SampleTable;
+
+/*----------------------------------------------------------------------
+| AP4_StsdAtom
++---------------------------------------------------------------------*/
+class AP4_StsdAtom : public AP4_ContainerAtom
+{
+ public:
+ // methods
+ AP4_StsdAtom(AP4_SampleTable* sample_table);
+ AP4_StsdAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ ~AP4_StsdAtom();
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_Cardinal GetSampleDescriptionCount();
+ virtual AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ virtual AP4_SampleEntry* GetSampleEntry(AP4_Ordinal index);
+
+ // AP4_AtomParent methods
+ void OnChildChanged(AP4_Atom* child);
+
+ const AP4_DataBuffer& GetDataBuffer() { return m_Data; }
+
+private:
+ // members
+ AP4_DataBuffer m_Data;
+ AP4_Array<AP4_SampleDescription*> m_SampleDescriptions;
+};
+
+#endif // _AP4_STSD_ATOM_H_
+
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StssAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StssAtom.h
new file mode 100644
index 000000000..ecd763097
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StssAtom.h
@@ -0,0 +1,56 @@
+/*****************************************************************
+|
+| AP4 - stss Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSS_ATOM_H_
+#define _AP4_STSS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StssAtom
++---------------------------------------------------------------------*/
+class AP4_StssAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StssAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual bool IsSampleSync(AP4_Ordinal sample);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_Array<AP4_UI32> m_Entries; // FIXME
+ private:
+};
+
+#endif // _AP4_STSS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StszAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StszAtom.cpp
new file mode 100644
index 000000000..1e84a475d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StszAtom.cpp
@@ -0,0 +1,194 @@
+/*****************************************************************
+|
+| AP4 - stsz Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4StszAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::AP4_StszAtom
++---------------------------------------------------------------------*/
+AP4_StszAtom::AP4_StszAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_STSZ, AP4_FULL_ATOM_HEADER_SIZE+8, true),
+ m_SampleSize(0),
+ m_SampleCount(0)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::AP4_StszAtom
++---------------------------------------------------------------------*/
+AP4_StszAtom::AP4_StszAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STSZ, size, true, stream)
+{
+ stream.ReadUI32(m_SampleSize);
+ stream.ReadUI32(m_SampleCount);
+ unsigned long sample_count = m_SampleCount;
+ if (m_SampleSize == 0) { // means that the samples have different sizes
+ while (sample_count--) {
+ AP4_UI32 entry_size;
+ if (stream.ReadUI32(entry_size) == AP4_SUCCESS) {
+ m_Entries.Append(entry_size);
+ }
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // sample size
+ result = stream.WriteUI32(m_SampleSize);
+ if (AP4_FAILED(result)) return result;
+
+ // sample count
+ result = stream.WriteUI32(m_SampleCount);
+ if (AP4_FAILED(result)) return result;
+
+ // entries if needed (the samples have different sizes)
+ if (m_SampleSize == 0) {
+ for (AP4_UI32 i=0; i<m_SampleCount; i++) {
+ result = stream.WriteUI32(m_Entries[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+ }
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_StszAtom::GetSampleCount()
+{
+ return m_SampleCount;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::GetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::GetSampleSize(AP4_Ordinal sample_start,
+ AP4_Ordinal sample_end,
+ AP4_Size& sample_size)
+{
+ sample_size = 0;
+
+ if(sample_start > m_SampleCount || sample_end > m_SampleCount)
+ {
+ return AP4_ERROR_OUT_OF_RANGE;
+ }
+
+ if(m_SampleSize != 0)
+ {
+ sample_size = m_SampleSize * (sample_end - sample_start);
+ }
+ else
+ {
+ // compute the additional offset inside the chunk
+ for (unsigned int i = sample_start; i < sample_end; i++) {
+ AP4_Size size;
+ AP4_Result result = GetSampleSize(i, size);
+ if (AP4_FAILED(result)) return result;
+ sample_size += size;
+ }
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::GetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::GetSampleSize(AP4_Ordinal sample, AP4_Size& sample_size)
+{
+ // check the sample index
+ if (sample > m_SampleCount) {
+ sample_size = 0;
+ return AP4_ERROR_OUT_OF_RANGE;
+ } else {
+ // find the size
+ if (m_SampleSize != 0) { // constant size
+ sample_size = m_SampleSize;
+ } else {
+ sample_size = m_Entries[sample - 1];
+ }
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::SetSampleSize
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::SetSampleSize(AP4_Ordinal sample, AP4_Size sample_size)
+{
+ // check the sample index
+ if (sample > m_SampleCount) {
+ return AP4_ERROR_OUT_OF_RANGE;
+ } else {
+ m_Entries[sample - 1] = sample_size;
+ return AP4_SUCCESS;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::AddEntry
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::AddEntry(AP4_UI32 size)
+{
+ m_Entries.Append(size);
+ m_SampleCount++;
+ m_Size += 4;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_StszAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("sample_size", m_SampleSize);
+ inspector.AddField("sample_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StszAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StszAtom.h
new file mode 100644
index 000000000..91fd38aad
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4StszAtom.h
@@ -0,0 +1,70 @@
+/*****************************************************************
+|
+| AP4 - stsz Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STSZ_ATOM_H_
+#define _AP4_STSZ_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_StszAtom
++---------------------------------------------------------------------*/
+class AP4_StszAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_StszAtom();
+ AP4_StszAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+ virtual AP4_UI32 GetSampleCount();
+ virtual AP4_Result GetSampleSize(AP4_Ordinal sample_start,
+ AP4_Ordinal sample_end,
+ AP4_Size& sample_size);
+ virtual AP4_Result GetSampleSize(AP4_Ordinal sample,
+ AP4_Size& sample_size);
+ virtual AP4_Result SetSampleSize(AP4_Ordinal sample,
+ AP4_Size sample_size);
+ virtual AP4_Result AddEntry(AP4_UI32 size);
+
+ // FIXME
+ friend class AP4_AtomSampleTable;
+
+ private:
+ AP4_UI32 m_SampleSize;
+ AP4_UI32 m_SampleCount;
+ AP4_Array<AP4_UI32> m_Entries;
+};
+
+#endif // _AP4_STSZ_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SttsAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SttsAtom.cpp
new file mode 100644
index 000000000..666207113
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SttsAtom.cpp
@@ -0,0 +1,169 @@
+/*****************************************************************
+|
+| AP4 - stts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4SttsAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::AP4_SttsAtom
++---------------------------------------------------------------------*/
+AP4_SttsAtom::AP4_SttsAtom() :
+ AP4_Atom(AP4_ATOM_TYPE_STTS, AP4_FULL_ATOM_HEADER_SIZE+4, true)
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::AP4_SttsAtom
++---------------------------------------------------------------------*/
+AP4_SttsAtom::AP4_SttsAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_STTS, size, true, stream)
+{
+ AP4_UI32 entry_count;
+ stream.ReadUI32(entry_count);
+ while (entry_count--) {
+ AP4_UI32 sample_count;
+ AP4_UI32 sample_duration;
+ if (stream.ReadUI32(sample_count) == AP4_SUCCESS &&
+ stream.ReadUI32(sample_duration) == AP4_SUCCESS) {
+ m_Entries.Append(AP4_SttsTableEntry(sample_count,
+ sample_duration));
+ }
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::GetDts
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::GetDts(AP4_Ordinal sample, AP4_TimeStamp& dts, AP4_Duration& duration)
+{
+ AP4_Ordinal sample_count_in_entry = sample;
+ dts = 0;
+
+ for (AP4_UI32 i = 0; i < m_Entries.ItemCount(); i++) {
+ AP4_SttsTableEntry& entry = m_Entries[i];
+
+ // check if we have the correct entry
+ if (sample_count_in_entry <= entry.m_SampleCount) {
+ dts += (sample_count_in_entry - 1) * entry.m_SampleDuration;
+ duration = entry.m_SampleDuration;
+ return AP4_SUCCESS;
+ } else {
+ dts += entry.m_SampleCount * entry.m_SampleDuration;
+ sample_count_in_entry -= entry.m_SampleCount;
+ }
+ }
+
+ // sample is greater than the number of samples
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::AddEntry
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::AddEntry(AP4_UI32 sample_count, AP4_UI32 sample_duration)
+{
+ m_Entries.Append(AP4_SttsTableEntry(sample_count, sample_duration));
+ m_Size += 8;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // write the entry count
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ result = stream.WriteUI32(entry_count);
+ if (AP4_FAILED(result)) return result;
+
+ // write the entries
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ // sample count
+ result = stream.WriteUI32(m_Entries[i].m_SampleCount);
+ if (AP4_FAILED(result)) return result;
+
+ // time offset
+ result = stream.WriteUI32(m_Entries[i].m_SampleDuration);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::GetSampleIndexForTimeStamp
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::GetSampleIndexForTimeStamp(AP4_TimeStamp ts, AP4_Ordinal& sample)
+{
+ // init
+ AP4_Cardinal entry_count = m_Entries.ItemCount();
+ AP4_Duration accumulated = 0;
+ sample = 0;
+
+ for (AP4_Ordinal i=0; i<entry_count; i++) {
+ AP4_Duration next_accumulated = accumulated
+ + m_Entries[i].m_SampleCount * m_Entries[i].m_SampleDuration;
+
+ // check if the ts is in the range of this entry
+ if (ts < next_accumulated) {
+ sample += (AP4_Ordinal) ((ts - accumulated) / m_Entries[i].m_SampleDuration);
+ return AP4_SUCCESS;
+ }
+
+ // update accumulated and sample
+ accumulated = next_accumulated;
+ sample += m_Entries[i].m_SampleCount;
+ }
+
+ // ts not in range of the table
+ return AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SttsAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("entry_count", m_Entries.ItemCount());
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SttsAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SttsAtom.h
new file mode 100644
index 000000000..2f56e2b5a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4SttsAtom.h
@@ -0,0 +1,80 @@
+/*****************************************************************
+|
+| AP4 - stts Atoms
+|
+| Copyright 2003 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_STTS_ATOM_H_
+#define _AP4_STTS_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4Array.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| AP4_SttsTableEntry
++---------------------------------------------------------------------*/
+class AP4_SttsTableEntry {
+ public:
+ AP4_SttsTableEntry() :
+ m_SampleCount(0),
+ m_SampleDuration(0) {}
+ AP4_SttsTableEntry(AP4_Cardinal sample_count,
+ AP4_Duration sample_duration) :
+ m_SampleCount(sample_count),
+ m_SampleDuration(sample_duration) {}
+
+ AP4_Cardinal m_SampleCount;
+ AP4_Duration m_SampleDuration;
+};
+
+/*----------------------------------------------------------------------
+| AP4_SttsAtom
++---------------------------------------------------------------------*/
+class AP4_SttsAtom : public AP4_Atom
+{
+ public:
+ // methods
+ AP4_SttsAtom();
+ AP4_SttsAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result GetDts(AP4_Ordinal sample, AP4_TimeStamp& dts, AP4_Duration& duration);
+ virtual AP4_Result AddEntry(AP4_UI32 sample_count, AP4_UI32 sample_duration);
+ virtual AP4_Result GetSampleIndexForTimeStamp(AP4_TimeStamp ts,
+ AP4_Ordinal& sample);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ // FIXME
+ friend class AP4_AtomSampleTable;
+
+ private:
+ AP4_Array<AP4_SttsTableEntry> m_Entries;
+};
+
+#endif // _AP4_STTS_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TkhdAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TkhdAtom.cpp
new file mode 100644
index 000000000..560b2bedb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TkhdAtom.cpp
@@ -0,0 +1,187 @@
+/*****************************************************************
+|
+| AP4 - tkhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4TkhdAtom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::AP4_TkhdAtom
++---------------------------------------------------------------------*/
+AP4_TkhdAtom::AP4_TkhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 track_id,
+ AP4_UI64 duration,
+ AP4_UI16 volume,
+ AP4_UI32 width,
+ AP4_UI32 height) :
+ AP4_Atom(AP4_ATOM_TYPE_TKHD, 80+AP4_FULL_ATOM_HEADER_SIZE, true),
+ m_CreationTime(creation_time),
+ m_ModificationTime(modification_time),
+ m_TrackId(track_id),
+ m_Reserved1(0),
+ m_Duration(duration),
+ m_Layer(0),
+ m_AlternateGroup(0),
+ m_Volume(volume),
+ m_Reserved3(0),
+ m_Width(width),
+ m_Height(height)
+{
+ m_Flags = AP4_TKHD_FLAG_DEFAULTS;
+
+ m_Matrix[0] = 0x00010000;
+ m_Matrix[1] = 0;
+ m_Matrix[2] = 0;
+ m_Matrix[3] = 0;
+ m_Matrix[4] = 0x00010000;
+ m_Matrix[5] = 0;
+ m_Matrix[6] = 0;
+ m_Matrix[7] = 0;
+ m_Matrix[8] = 0x40000000;
+
+ m_Reserved2[0] = 0;
+ m_Reserved2[1] = 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::AP4_TkhdAtom
++---------------------------------------------------------------------*/
+AP4_TkhdAtom::AP4_TkhdAtom(AP4_Size size, AP4_ByteStream& stream) :
+ AP4_Atom(AP4_ATOM_TYPE_TKHD, size, true, stream)
+{
+ if (m_Version == 0) {
+ AP4_UI32 tmp = 0;
+ stream.ReadUI32(tmp); m_CreationTime = tmp;
+ stream.ReadUI32(tmp); m_ModificationTime = tmp;
+ stream.ReadUI32(m_TrackId);
+ stream.ReadUI32(m_Reserved1);
+ stream.ReadUI32(tmp); m_Duration = tmp;
+ } else if (m_Version == 1) {
+ stream.ReadUI64(m_CreationTime);
+ stream.ReadUI64(m_ModificationTime);
+ stream.ReadUI32(m_TrackId);
+ stream.ReadUI32(m_Reserved1);
+ stream.ReadUI64(m_Duration);
+ } else {
+ // TODO
+ }
+
+ stream.Read((void*)m_Reserved2, 8, NULL);
+ stream.ReadUI16(m_Layer);
+ stream.ReadUI16(m_AlternateGroup);
+ stream.ReadUI16(m_Volume);
+ stream.ReadUI16(m_Reserved3);
+ for (int i=0; i<9; i++) {
+ stream.ReadUI32(m_Matrix[i]);
+ }
+ stream.ReadUI32(m_Width);
+ stream.ReadUI32(m_Height);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::WriteFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TkhdAtom::WriteFields(AP4_ByteStream& stream)
+{
+ AP4_Result result;
+
+ // creation/modification time, track id, reserved1 & duration
+ if (m_Version == 0) {
+ result = stream.WriteUI32((AP4_UI32)m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TrackId);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Reserved1);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32((AP4_UI32)m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else if (m_Version == 1) {
+ result = stream.WriteUI64(m_CreationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_ModificationTime);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_TrackId);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Reserved1);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI64(m_Duration);
+ if (AP4_FAILED(result)) return result;
+ } else {
+ // TODO
+ }
+
+ // reserved2
+ result = stream.Write(m_Reserved2, sizeof(m_Reserved2));
+ if (AP4_FAILED(result)) return result;
+
+ // layer, alternate group & volume
+ result = stream.WriteUI16(m_Layer);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_AlternateGroup);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI16(m_Volume);
+ if (AP4_FAILED(result)) return result;
+
+ // reserved3
+ result = stream.WriteUI16(m_Reserved3);
+
+ // matrix
+ for (int i=0; i<9; i++) {
+ result = stream.WriteUI32(m_Matrix[i]);
+ if (AP4_FAILED(result)) return result;
+ }
+
+ // width & height
+ result = stream.WriteUI32(m_Width);
+ if (AP4_FAILED(result)) return result;
+ result = stream.WriteUI32(m_Height);
+ if (AP4_FAILED(result)) return result;
+
+ return result;
+}
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom::InspectFields
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TkhdAtom::InspectFields(AP4_AtomInspector& inspector)
+{
+ inspector.AddField("enabled", ((m_Flags & AP4_TKHD_FLAG_TRACK_ENABLED) ? 1 : 0), AP4_AtomInspector::HINT_BOOLEAN);
+ inspector.AddField("id", m_TrackId);
+ inspector.AddField("duration", (AP4_UI32)m_Duration);
+
+ return AP4_SUCCESS;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TkhdAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TkhdAtom.h
new file mode 100644
index 000000000..37b5c270f
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TkhdAtom.h
@@ -0,0 +1,105 @@
+/*****************************************************************
+|
+| AP4 - tkhd Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TKHD_ATOM_H_
+#define _AP4_TKHD_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const int AP4_TKHD_FLAG_TRACK_ENABLED = 1;
+const int AP4_TKHD_FLAG_TRACK_IN_MOVIE = 2;
+const int AP4_TKHD_FLAG_TRACK_IN_PREVIEW = 4;
+
+const int AP4_TKHD_FLAG_DEFAULTS = 7;
+
+/*----------------------------------------------------------------------
+| AP4_TkhdAtom
++---------------------------------------------------------------------*/
+class AP4_TkhdAtom : public AP4_Atom
+{
+public:
+ // methods
+ AP4_TkhdAtom(AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI32 track_id,
+ AP4_UI64 duration,
+ AP4_UI16 volume,
+ AP4_UI32 width,
+ AP4_UI32 height);
+ AP4_TkhdAtom(AP4_Size size, AP4_ByteStream& stream);
+ virtual AP4_Result InspectFields(AP4_AtomInspector& inspector);
+ virtual AP4_Result WriteFields(AP4_ByteStream& stream);
+
+ AP4_UI64 GetDuration() { return m_Duration; }
+ AP4_Result SetDuration(AP4_UI64 duration) {
+ m_Duration = duration;
+ return AP4_SUCCESS;
+ }
+ AP4_UI32 GetTrackId() { return m_TrackId; }
+ AP4_Result SetTrackId(AP4_UI32 track_id) {
+ m_TrackId = track_id;
+ return AP4_SUCCESS;
+ }
+
+ void GetTranslation(AP4_Float& x, AP4_Float& y)
+ {
+ x = (AP4_Float)(*(int*)&m_Matrix[6]) / 65536;
+ y = (AP4_Float)(*(int*)&m_Matrix[7]) / 65536;
+ }
+
+ AP4_UI32 GetWidth() const {return m_Width;}
+ AP4_UI32 GetHeight() const {return m_Height;}
+
+ private:
+ // members
+ AP4_UI64 m_CreationTime;
+ AP4_UI64 m_ModificationTime;
+ AP4_UI32 m_TrackId;
+ AP4_UI32 m_Reserved1;
+ AP4_UI64 m_Duration;
+ AP4_UI08 m_DataVersion1[32];
+ AP4_UI32 m_Reserved2[2];
+ AP4_UI16 m_Layer;
+ AP4_UI16 m_AlternateGroup;
+ AP4_UI16 m_Volume;
+ AP4_UI16 m_Reserved3;
+ AP4_UI32 m_Matrix[9];
+ AP4_UI32 m_Width;
+ AP4_UI32 m_Height;
+};
+
+#endif // _AP4_TKHD_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Track.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Track.cpp
new file mode 100644
index 000000000..42dc42d99
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Track.cpp
@@ -0,0 +1,357 @@
+/*****************************************************************
+|
+| AP4 - Track Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod & Julien Boeuf
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4ByteStream.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4MvhdAtom.h"
+#include "Ap4Track.h"
+#include "Ap4Utils.h"
+#include "Ap4Sample.h"
+#include "Ap4DataBuffer.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MoovAtom.h"
+#include "Ap4AtomSampleTable.h"
+#include "Ap4SdpAtom.h"
+#include "Ap4MdhdAtom.h"
+
+/*----------------------------------------------------------------------
+| AP4_Track::AP4_Track
++---------------------------------------------------------------------*/
+AP4_Track::AP4_Track(Type type,
+ AP4_SampleTable* sample_table,
+ AP4_UI32 track_id,
+ AP4_UI32 movie_time_scale,
+ AP4_UI32 media_time_scale,
+ AP4_UI64 media_duration,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 height) :
+ m_TrakAtomIsOwned(true),
+ m_Type(type),
+ m_SampleTable(sample_table),
+ m_SampleTableIsOwned(false),
+ m_MovieTimeScale(movie_time_scale ?
+ movie_time_scale :
+ AP4_TRACK_DEFAULT_MOVIE_TIMESCALE),
+ m_MediaTimeScale(media_time_scale)
+{
+ // compute the default volume value
+ unsigned int volume = 0;
+ if (type == TYPE_AUDIO) volume = 0x100;
+
+ // compute the handler type and name
+ AP4_Atom::Type hdlr_type;
+ const char* hdlr_name;
+ switch (type) {
+ case TYPE_AUDIO:
+ hdlr_type = AP4_HANDLER_TYPE_SOUN;
+ hdlr_name = "Bento4 Sound Handler";
+ break;
+
+ case TYPE_VIDEO:
+ hdlr_type = AP4_HANDLER_TYPE_VIDE;
+ hdlr_name = "Bento4 Video Handler";
+ break;
+
+ case TYPE_HINT:
+ hdlr_type = AP4_HANDLER_TYPE_HINT;
+ hdlr_name = "Bento4 Hint Handler";
+ break;
+
+ default:
+ hdlr_type = 0;
+ hdlr_name = NULL;
+ break;
+ }
+
+ // compute the track duration in units of the movie time scale
+ AP4_UI64 track_duration = AP4_ConvertTime(media_duration,
+ media_time_scale,
+ movie_time_scale);
+
+ // create a trak atom
+ m_TrakAtom = new AP4_TrakAtom(sample_table,
+ hdlr_type,
+ hdlr_name,
+ track_id,
+ 0,
+ 0,
+ track_duration,
+ media_time_scale,
+ media_duration,
+ volume,
+ language,
+ width,
+ height);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::AP4_Track
++---------------------------------------------------------------------*/
+AP4_Track::AP4_Track(AP4_TrakAtom& atom,
+ AP4_ByteStream& sample_stream,
+ AP4_UI32 movie_time_scale) :
+ m_TrakAtom(&atom),
+ m_TrakAtomIsOwned(false),
+ m_Type(TYPE_UNKNOWN),
+ m_SampleTable(NULL),
+ m_SampleTableIsOwned(true),
+ m_MovieTimeScale(movie_time_scale),
+ m_MediaTimeScale(0)
+{
+ // find the handler type
+ AP4_Atom* sub = atom.FindChild("mdia/hdlr");
+ if (sub) {
+ AP4_HdlrAtom* hdlr = dynamic_cast<AP4_HdlrAtom*>(sub);
+ if (hdlr) {
+ AP4_Atom::Type type = hdlr->GetHandlerType();
+ if (type == AP4_HANDLER_TYPE_SOUN) {
+ m_Type = TYPE_AUDIO;
+ } else if (type == AP4_HANDLER_TYPE_VIDE) {
+ m_Type = TYPE_VIDEO;
+ } else if (type == AP4_HANDLER_TYPE_TEXT) {
+ m_Type = TYPE_TEXT;
+ } else if (type == AP4_HANDLER_TYPE_TX3G) {
+ m_Type = TYPE_TEXT;
+ } else if (type == AP4_HANDLER_TYPE_SUBP) {
+ m_Type = TYPE_SUBP;
+ } else if (type == AP4_HANDLER_TYPE_HINT) {
+ m_Type = TYPE_HINT;
+ }
+ }
+ }
+
+ // get the media time scale
+ sub = atom.FindChild("mdia/mdhd");
+ if (sub) {
+ AP4_MdhdAtom* mdhd = dynamic_cast<AP4_MdhdAtom*>(sub);
+ if (mdhd) {
+ m_MediaTimeScale = mdhd->GetTimeScale();
+ }
+ }
+
+ // create a facade for the stbl atom
+ AP4_ContainerAtom* stbl = dynamic_cast<AP4_ContainerAtom*>(
+ atom.FindChild("mdia/minf/stbl"));
+ if (stbl) {
+ m_SampleTable = new AP4_AtomSampleTable(stbl, sample_stream);
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::~AP4_Track
++---------------------------------------------------------------------*/
+AP4_Track::~AP4_Track()
+{
+ if (m_TrakAtomIsOwned) delete m_TrakAtom;
+ if (m_SampleTableIsOwned) delete m_SampleTable;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetId
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Track::GetId()
+{
+ return m_TrakAtom->GetId();
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::SetId
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::SetId(AP4_UI32 id)
+{
+ m_TrakAtom->SetId(id);
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetDuration
++---------------------------------------------------------------------*/
+AP4_UI64
+AP4_Track::GetDuration()
+{
+ return m_TrakAtom->GetDuration();
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetDurationMs
++---------------------------------------------------------------------*/
+AP4_Duration
+AP4_Track::GetDurationMs()
+{
+ AP4_UI64 duration = m_TrakAtom->GetDuration();
+ return AP4_DurationMsFromUnits(duration, m_MovieTimeScale);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSampleCount
++---------------------------------------------------------------------*/
+AP4_Cardinal
+AP4_Track::GetSampleCount()
+{
+ // delegate to the sample table
+ return m_SampleTable ? m_SampleTable->GetSampleCount() : 0;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::GetSample(AP4_Ordinal index, AP4_Sample& sample)
+{
+ // delegate to the sample table
+ return m_SampleTable ? m_SampleTable->GetSample(index, sample) : AP4_FAILURE;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSampleDescription
++---------------------------------------------------------------------*/
+AP4_SampleDescription*
+AP4_Track::GetSampleDescription(AP4_Ordinal index)
+{
+ // delegate to the sample table
+ return m_SampleTable ? m_SampleTable->GetSampleDescription(index) : NULL;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::ReadSample
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::ReadSample(AP4_Ordinal index,
+ AP4_Sample& sample,
+ AP4_DataBuffer& data)
+{
+ AP4_Result result;
+
+ // get the sample
+ result = GetSample(index, sample);
+ if (AP4_FAILED(result)) return result;
+
+ // read the data
+ return sample.ReadData(data);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetSampleIndexForTimeStampMs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::GetSampleIndexForTimeStampMs(AP4_TimeStamp ts, AP4_Ordinal& index)
+{
+ // convert the ts in the timescale of the track's media
+ ts = AP4_ConvertTime(ts, 1000, m_MediaTimeScale);
+
+ return m_SampleTable->GetSampleIndexForTimeStamp(ts, index);
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::SetMovieTimeScale
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_Track::SetMovieTimeScale(AP4_UI32 time_scale)
+{
+ // check that we can convert
+ if (m_MovieTimeScale == 0) return AP4_FAILURE;
+
+ // convert from one time scale to the other
+ m_TrakAtom->SetDuration(AP4_ConvertTime(m_TrakAtom->GetDuration(),
+ m_MovieTimeScale,
+ time_scale));
+
+ // keep the new movie timescale
+ m_MovieTimeScale = time_scale;
+
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetMediaTimeScale
++---------------------------------------------------------------------*/
+AP4_UI32
+AP4_Track::GetMediaTimeScale()
+{
+ return m_MediaTimeScale;
+}
+
+// save the implementation for later
+#if 0
+/*----------------------------------------------------------------------
+| AP4_HintTrack::SetSdpText
++---------------------------------------------------------------------*/
+void
+AP4_HintTrack::SetSdpText(const char* text)
+{
+ // build an sdp atom
+ AP4_SdpAtom* sdp = new AP4_SdpAtom(text);
+
+ // build the hnti
+ AP4_ContainerAtom* hnti = new AP4_ContainerAtom(AP4_ATOM_TYPE_HNTI);
+ hnti->AddChild(sdp);
+
+ // check if there's already a user data atom
+ AP4_ContainerAtom* udta = dynamic_cast<AP4_ContainerAtom*>(m_TrakAtom->FindChild("udta"));
+ if (udta == NULL) {
+ // otherwise create it
+ udta = new AP4_ContainerAtom(AP4_ATOM_TYPE_UDTA);
+ m_TrakAtom->AddChild(udta);
+ }
+ udta->AddChild(hnti);
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetTrackName
++---------------------------------------------------------------------*/
+
+AP4_String
+AP4_Track::GetTrackName()
+{
+ AP4_String TrackName;
+ if(AP4_HdlrAtom* hdlr = dynamic_cast<AP4_HdlrAtom*>(m_TrakAtom->FindChild("mdia/hdlr")))
+ TrackName = hdlr->GetHandlerName();
+ return TrackName;
+}
+
+/*----------------------------------------------------------------------
+| AP4_Track::GetTrackLanguage
++---------------------------------------------------------------------*/
+
+AP4_String
+AP4_Track::GetTrackLanguage()
+{
+ AP4_String TrackLanguage;
+ if(AP4_MdhdAtom* mdhd = dynamic_cast<AP4_MdhdAtom*>(m_TrakAtom->FindChild("mdia/mdhd")))
+ TrackLanguage = mdhd->GetLanguage().c_str();
+ return TrackLanguage;
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Track.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Track.h
new file mode 100644
index 000000000..4b901e159
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Track.h
@@ -0,0 +1,115 @@
+/*****************************************************************
+|
+| AP4 - Track Objects
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TRAK_H_
+#define _AP4_TRAK_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Array.h"
+#include "Ap4SampleDescription.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| forward declarations
++---------------------------------------------------------------------*/
+class AP4_StblAtom;
+class AP4_ByteStream;
+class AP4_Sample;
+class AP4_DataBuffer;
+class AP4_TrakAtom;
+class AP4_MoovAtom;
+
+/*----------------------------------------------------------------------
+| constants
++---------------------------------------------------------------------*/
+const AP4_UI32 AP4_TRACK_DEFAULT_MOVIE_TIMESCALE = 1000;
+
+/*----------------------------------------------------------------------
+| AP4_Track
++---------------------------------------------------------------------*/
+class AP4_Track {
+ public:
+ // types
+ typedef enum {
+ TYPE_UNKNOWN,
+ TYPE_AUDIO,
+ TYPE_VIDEO,
+ TYPE_TEXT,
+ TYPE_SUBP,
+ TYPE_HINT
+ } Type;
+
+ // methods
+ AP4_Track(Type type,
+ AP4_SampleTable* sample_table,
+ AP4_UI32 track_id,
+ AP4_UI32 movie_time_scale, // 0 = use default
+ AP4_UI32 media_time_scale,
+ AP4_UI64 media_duration,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 height);
+ AP4_Track(AP4_TrakAtom& atom,
+ AP4_ByteStream& sample_stream,
+ AP4_UI32 movie_time_scale);
+ virtual ~AP4_Track();
+ AP4_Track::Type GetType() { return m_Type; }
+ AP4_UI64 GetDuration();
+ AP4_Duration GetDurationMs();
+ AP4_Cardinal GetSampleCount();
+ AP4_Result GetSample(AP4_Ordinal index, AP4_Sample& sample);
+ AP4_Result ReadSample(AP4_Ordinal index,
+ AP4_Sample& sample,
+ AP4_DataBuffer& data);
+ AP4_Result GetSampleIndexForTimeStampMs(AP4_TimeStamp ts,
+ AP4_Ordinal& index);
+ AP4_SampleDescription* GetSampleDescription(AP4_Ordinal index);
+ AP4_UI32 GetId();
+ AP4_Result SetId(AP4_UI32 track_id);
+ AP4_TrakAtom* GetTrakAtom() { return m_TrakAtom; }
+ AP4_Result SetMovieTimeScale(AP4_UI32 time_scale);
+ AP4_UI32 GetMediaTimeScale();
+
+ AP4_String GetTrackName();
+ AP4_String GetTrackLanguage();
+
+ protected:
+ // members
+ AP4_TrakAtom* m_TrakAtom;
+ bool m_TrakAtomIsOwned;
+ Type m_Type;
+ AP4_SampleTable* m_SampleTable;
+ bool m_SampleTableIsOwned;
+ AP4_UI32 m_MovieTimeScale;
+ AP4_UI32 m_MediaTimeScale;
+};
+
+#endif // _AP4_TRAK_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TrakAtom.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TrakAtom.cpp
new file mode 100644
index 000000000..1b96ea120
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TrakAtom.cpp
@@ -0,0 +1,204 @@
+/*****************************************************************
+|
+| AP4 - trak Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4TrakAtom.h"
+#include "Ap4MdhdAtom.h"
+#include "Ap4VmhdAtom.h"
+#include "Ap4SmhdAtom.h"
+#include "Ap4HmhdAtom.h"
+#include "Ap4NmhdAtom.h"
+#include "Ap4DrefAtom.h"
+#include "Ap4UrlAtom.h"
+#include "Ap4StcoAtom.h"
+#include "Ap4Co64Atom.h"
+#include "Ap4AtomFactory.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::AP4_TrakAtom
++---------------------------------------------------------------------*/
+AP4_TrakAtom::AP4_TrakAtom(AP4_SampleTable* sample_table,
+ AP4_Atom::Type hdlr_type,
+ const char* hdlr_name,
+ AP4_UI32 track_id,
+ AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI64 track_duration,
+ AP4_UI32 media_time_scale,
+ AP4_UI64 media_duration,
+ AP4_UI16 volume,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 height) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_TRAK)
+{
+ AP4_Result result;
+
+ // create a tkhd atom
+ m_TkhdAtom = new AP4_TkhdAtom(creation_time,
+ modification_time,
+ track_id,
+ track_duration,
+ volume,
+ width,
+ height);
+
+ // create an edts
+
+ // create a mdia atom
+ AP4_ContainerAtom* mdia = new AP4_ContainerAtom(AP4_ATOM_TYPE_MDIA);
+
+ // create a hdlr atom for the mdia atom
+ m_HdlrAtom = new AP4_HdlrAtom(hdlr_type, hdlr_name);
+
+ // create a minf atom
+ AP4_ContainerAtom* minf = new AP4_ContainerAtom(AP4_ATOM_TYPE_MINF);
+
+ // create a media header atom for minf (vmhd, smhd, hmhd or nmhd)
+ AP4_Atom* minf_header;
+ switch (hdlr_type) {
+ case AP4_HANDLER_TYPE_VIDE:
+ minf_header = new AP4_VmhdAtom(0, 0, 0, 0);
+ break;
+
+ case AP4_HANDLER_TYPE_SOUN:
+ minf_header = new AP4_SmhdAtom(0);
+ break;
+
+ default:
+ minf_header = new AP4_NmhdAtom();
+ break;
+ }
+
+ // create a dinf atom for minf
+ AP4_ContainerAtom* dinf = new AP4_ContainerAtom(AP4_ATOM_TYPE_DINF);
+
+ // create a url atom as a ref for dref
+ AP4_Atom* url = new AP4_UrlAtom(); // local ref
+
+ // create a dref atom for dinf
+ AP4_DrefAtom* dref = new AP4_DrefAtom(&url, 1);
+
+ // create a stbl atom for minf
+ AP4_ContainerAtom* stbl;
+ result = sample_table->GenerateStblAtom(stbl);
+ if (AP4_FAILED(result)) stbl = NULL;
+
+ // populate the dinf atom
+ dinf->AddChild(dref);
+
+ // populate the minf atom
+ minf->AddChild(minf_header);
+ minf->AddChild(dinf);
+ if (stbl) minf->AddChild(stbl);
+
+ // create a mdhd atom for the mdia atom
+ AP4_MdhdAtom* mdhd = new AP4_MdhdAtom(creation_time,
+ modification_time,
+ media_time_scale,
+ media_duration,
+ language);
+
+ // populate the mdia atom
+ mdia->AddChild(mdhd);
+ mdia->AddChild(m_HdlrAtom);
+ mdia->AddChild(minf);
+
+ // attach the children
+ AddChild(m_TkhdAtom);
+ AddChild(mdia);
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::AP4_TrakAtom
++---------------------------------------------------------------------*/
+AP4_TrakAtom::AP4_TrakAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory) :
+ AP4_ContainerAtom(AP4_ATOM_TYPE_TRAK, size, false, stream, atom_factory),
+ m_HdlrAtom(NULL),
+ m_TkhdAtom(NULL)
+{
+ AP4_Atom* tkhd = FindChild("tkhd");
+ if (tkhd != NULL) {
+ m_TkhdAtom = dynamic_cast<AP4_TkhdAtom*>(tkhd);
+ } else {
+ m_TkhdAtom = NULL;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::GetDuration
++---------------------------------------------------------------------*/
+AP4_UI64
+AP4_TrakAtom::GetDuration()
+{
+ if (m_TkhdAtom) {
+ return m_TkhdAtom->GetDuration();
+ } else {
+ return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::SetDuration
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrakAtom::SetDuration(AP4_UI64 duration)
+{
+ if (m_TkhdAtom) {
+ return m_TkhdAtom->SetDuration(duration);
+ } else {
+ return AP4_FAILURE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom::AdjustChunkOffsets
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_TrakAtom::AdjustChunkOffsets(AP4_Offset offset)
+{
+ if (AP4_Atom* atom = FindChild("mdia/minf/stbl/co64")) {
+ AP4_Co64Atom* co64 = dynamic_cast<AP4_Co64Atom*>(atom);
+ co64->AdjustChunkOffsets(offset);
+ }
+
+ AP4_Atom* atom = FindChild("mdia/minf/stbl/stco");
+ if (atom != NULL) {
+ AP4_StcoAtom* stco = dynamic_cast<AP4_StcoAtom*>(atom);
+ stco->AdjustChunkOffsets(offset);
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TrakAtom.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TrakAtom.h
new file mode 100644
index 000000000..6eaaaa6e2
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4TrakAtom.h
@@ -0,0 +1,85 @@
+/*****************************************************************
+|
+| AP4 - trak Atoms
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TRAK_ATOM_H_
+#define _AP4_TRAK_ATOM_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4ByteStream.h"
+#include "Ap4List.h"
+#include "Ap4Atom.h"
+#include "Ap4HdlrAtom.h"
+#include "Ap4TkhdAtom.h"
+#include "Ap4ContainerAtom.h"
+#include "Ap4SampleTable.h"
+
+/*----------------------------------------------------------------------
+| AP4_TrakAtom
++---------------------------------------------------------------------*/
+class AP4_TrakAtom : public AP4_ContainerAtom
+{
+ public:
+ // methods
+ AP4_TrakAtom(AP4_SampleTable* sample_table,
+ AP4_Atom::Type hdlr_type,
+ const char* hdlr_name,
+ AP4_UI32 track_id,
+ AP4_UI64 creation_time,
+ AP4_UI64 modification_time,
+ AP4_UI64 track_duration,
+ AP4_UI32 media_time_scale,
+ AP4_UI64 media_duration,
+ AP4_UI16 volume,
+ const char* language,
+ AP4_UI32 width,
+ AP4_UI32 heigh);
+ AP4_TrakAtom(AP4_Size size,
+ AP4_ByteStream& stream,
+ AP4_AtomFactory& atom_factory);
+ AP4_Result AdjustChunkOffsets(AP4_Offset offset);
+ AP4_UI32 GetId() {
+ return m_TkhdAtom->GetTrackId();
+ }
+ AP4_Result SetId(AP4_UI32 track_id) {
+ return m_TkhdAtom->SetTrackId(track_id);
+ }
+ AP4_UI64 GetDuration();
+ AP4_Result SetDuration(AP4_UI64 duration);
+ AP4_TkhdAtom* GetTkhdAtom() { return m_TkhdAtom; }
+ AP4_HdlrAtom* GetHdlrAtom() { return m_HdlrAtom; }
+
+ private:
+ // members
+ AP4_HdlrAtom* m_HdlrAtom;
+ AP4_TkhdAtom* m_TkhdAtom;
+};
+
+#endif // _AP4_TRAK_ATOM_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Types.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Types.h
new file mode 100644
index 000000000..38a471069
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Types.h
@@ -0,0 +1,67 @@
+/*****************************************************************
+|
+| AP4 - Shared Types
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_TYPES_H_
+#define _AP4_TYPES_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4Config.h"
+#if defined(AP4_CONFIG_HAVE_CPP_STRING_H)
+#include <string>
+#endif
+
+/*----------------------------------------------------------------------
+| types
++---------------------------------------------------------------------*/
+typedef int AP4_Result;
+typedef unsigned long AP4_Flags;
+typedef unsigned long AP4_Mask;
+typedef unsigned long AP4_Size;
+typedef unsigned long AP4_Offset;
+typedef unsigned long AP4_Range;
+typedef unsigned long AP4_Cardinal;
+typedef unsigned long AP4_Ordinal;
+// typedef unsigned long AP4_TimeStamp;
+// typedef unsigned long AP4_Duration;
+typedef int AP4_Coordinate;
+typedef int AP4_Distance;
+typedef int AP4_Integer;
+typedef unsigned int AP4_UI32;
+typedef unsigned short AP4_UI16;
+typedef unsigned char AP4_UI08;
+typedef float AP4_Float;
+typedef std::string AP4_String;
+typedef unsigned char AP4_Byte;
+
+typedef unsigned long long AP4_TimeStamp;
+typedef unsigned long long AP4_Duration;
+typedef unsigned long long AP4_UI64;
+
+#endif // _AP4_TYPES_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Utils.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Utils.cpp
new file mode 100644
index 000000000..29f208d00
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Utils.cpp
@@ -0,0 +1,335 @@
+/*****************************************************************
+|
+| AP4 - Utilities
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Utils.h"
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt64BE
++---------------------------------------------------------------------*/
+unsigned long long
+AP4_BytesToUInt64BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned long long)bytes[0])<<56 ) |
+ ( ((unsigned long long)bytes[1])<<48 ) |
+ ( ((unsigned long long)bytes[2])<<40 ) |
+ ( ((unsigned long long)bytes[3])<<32 ) |
+ ( ((unsigned long long)bytes[4])<<24 ) |
+ ( ((unsigned long long)bytes[5])<<16 ) |
+ ( ((unsigned long long)bytes[6])<<8 ) |
+ ( ((unsigned long long)bytes[7]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt32BE
++---------------------------------------------------------------------*/
+unsigned long
+AP4_BytesToUInt32BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned long)bytes[0])<<24 ) |
+ ( ((unsigned long)bytes[1])<<16 ) |
+ ( ((unsigned long)bytes[2])<<8 ) |
+ ( ((unsigned long)bytes[3]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt24BE
++---------------------------------------------------------------------*/
+unsigned long
+AP4_BytesToUInt24BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned long)bytes[0])<<16 ) |
+ ( ((unsigned long)bytes[1])<<8 ) |
+ ( ((unsigned long)bytes[2]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesToUInt16BE
++---------------------------------------------------------------------*/
+unsigned short
+AP4_BytesToUInt16BE(const unsigned char* bytes)
+{
+ return
+ ( ((unsigned short)bytes[0])<<8 ) |
+ ( ((unsigned short)bytes[1]) );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt64BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt64BE(unsigned char* bytes, unsigned long long value)
+{
+ bytes[0] = (unsigned char)(value >> 56);
+ bytes[1] = (unsigned char)(value >> 48);
+ bytes[2] = (unsigned char)(value >> 40);
+ bytes[3] = (unsigned char)(value >> 32);
+ bytes[4] = (unsigned char)(value >> 24);
+ bytes[5] = (unsigned char)(value >> 16);
+ bytes[6] = (unsigned char)(value >> 8);
+ bytes[7] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt32BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt32BE(unsigned char* bytes, unsigned long value)
+{
+ bytes[0] = (unsigned char)(value >> 24);
+ bytes[1] = (unsigned char)(value >> 16);
+ bytes[2] = (unsigned char)(value >> 8);
+ bytes[3] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt24BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt24BE(unsigned char* bytes, unsigned long value)
+{
+ bytes[0] = (unsigned char)(value >> 16);
+ bytes[1] = (unsigned char)(value >> 8);
+ bytes[2] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_BytesFromUInt16BE
++---------------------------------------------------------------------*/
+void
+AP4_BytesFromUInt16BE(unsigned char* bytes, unsigned short value)
+{
+ bytes[0] = (unsigned char)(value >> 8);
+ bytes[1] = (unsigned char)(value );
+}
+
+/*----------------------------------------------------------------------
+| AP4_MakePrefixString
++---------------------------------------------------------------------*/
+static void
+AP4_MakePrefixString(AP4_Offset indent, char* prefix, AP4_Size size)
+{
+ if (size == 0) return;
+ if (indent >= size-1) indent = size-1;
+ for (unsigned int i=0; i<indent; i++) {
+ prefix[i] = ' ';
+ }
+ prefix[indent] = '\0';
+}
+
+/*----------------------------------------------------------------------
+| AP4_DurationMsFromUnits
++---------------------------------------------------------------------*/
+unsigned long
+AP4_DurationMsFromUnits(AP4_UI64 units, unsigned long units_per_second)
+{
+ if (units_per_second == 0) return 0;
+ return (unsigned long)(((float)units*1000.0f)/(float)units_per_second);
+}
+
+/*----------------------------------------------------------------------
+| AP4_ConvertTime
++---------------------------------------------------------------------*/
+AP4_UI64
+AP4_ConvertTime(AP4_UI64 time_value,
+ unsigned long from_time_scale,
+ unsigned long to_time_scale)
+{
+ if (from_time_scale == 0) return 0;
+ float ratio = (float)to_time_scale/(float)from_time_scale;
+ return ((AP4_UI64)((float)time_value*ratio));
+}
+
+/*----------------------------------------------------------------------
+| AP4_FormatFourChars
++---------------------------------------------------------------------*/
+void
+AP4_FormatFourChars(char* str, AP4_UI32 value) {
+ str[0] = (value >> 24) & 0xFF;
+ str[1] = (value >> 16) & 0xFF;
+ str[2] = (value >> 8) & 0xFF;
+ str[3] = (value ) & 0xFF;
+ str[4] = '\0';
+}
+
+/*----------------------------------------------------------------------
+| AP4_SplitArgs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1)
+{
+ arg0 = arg;
+ char* c = arg;
+ while (*c != 0 && *c != ':') {
+ c++;
+ }
+ if (*c == ':') {
+ *c++ = '\0';
+ arg1 = c;
+ return AP4_SUCCESS;
+ } else {
+ return AP4_FAILURE;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_SplitArgs
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1, char*& arg2)
+{
+ AP4_Result result = AP4_SplitArgs(arg, arg0, arg1);
+ if (AP4_FAILED(result)) return result;
+ return AP4_SplitArgs(arg1, arg1, arg2);
+}
+
+/*----------------------------------------------------------------------
+| AP4_HexNibble
++---------------------------------------------------------------------*/
+static unsigned char
+AP4_HexNibble(char c)
+{
+ switch (c) {
+ case '0': return 0;
+ case '1': return 1;
+ case '2': return 2;
+ case '3': return 3;
+ case '4': return 4;
+ case '5': return 5;
+ case '6': return 6;
+ case '7': return 7;
+ case '8': return 8;
+ case '9': return 9;
+ case 'a': case 'A': return 10;
+ case 'b': case 'B': return 11;
+ case 'c': case 'C': return 12;
+ case 'd': case 'D': return 13;
+ case 'e': case 'E': return 14;
+ case 'f': case 'F': return 15;
+ default: return 0;
+ }
+}
+
+/*----------------------------------------------------------------------
+| AP4_ParseHex
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_ParseHex(const char* hex, unsigned char* bytes, unsigned int count)
+{
+ if (strlen(hex) != 2*count) return AP4_ERROR_INVALID_PARAMETERS;
+ for (unsigned int i=0; i<count; i++) {
+ bytes[i] = (AP4_HexNibble(hex[2*i]) << 4) | (AP4_HexNibble(hex[2*i+1]));
+ }
+ return AP4_SUCCESS;
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::AP4_PrintInspector
++---------------------------------------------------------------------*/
+AP4_PrintInspector::AP4_PrintInspector(AP4_ByteStream& stream) :
+ m_Stream(&stream),
+ m_Indent(0)
+{
+ m_Stream->AddReference();
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::~AP4_PrintInspector
++---------------------------------------------------------------------*/
+AP4_PrintInspector::~AP4_PrintInspector()
+{
+ m_Stream->Release();
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::StartElement
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::StartElement(const char* name, const char* info)
+{
+ char prefix[256];
+ AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
+ m_Stream->WriteString(prefix);
+ m_Stream->WriteString(name);
+ if (info) {
+ m_Stream->Write(" ", 1);
+ m_Stream->WriteString(info);
+ }
+ m_Stream->Write("\n", 1);
+
+ m_Indent += 2;
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::EndElement
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::EndElement()
+{
+ m_Indent -= 2;
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::AddField
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::AddField(const char* name, const char* value, FormatHint hint)
+{
+ char prefix[256];
+ AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
+ m_Stream->WriteString(prefix);
+
+ m_Stream->WriteString(name);
+ m_Stream->WriteString(" = ");
+ m_Stream->WriteString(value);
+ m_Stream->Write("\n", 1);
+}
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector::AddField
++---------------------------------------------------------------------*/
+void
+AP4_PrintInspector::AddField(const char* name, AP4_UI32 value, FormatHint hint)
+{
+ char prefix[256];
+ AP4_MakePrefixString(m_Indent, prefix, sizeof(prefix));
+ m_Stream->WriteString(prefix);
+
+ char str[32];
+ AP4_StringFormat(str, sizeof(str), "%d", value);
+ m_Stream->WriteString(name);
+ m_Stream->WriteString(" = ");
+ m_Stream->WriteString(str);
+ m_Stream->Write("\n", 1);
+}
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Utils.h b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Utils.h
new file mode 100644
index 000000000..9943fe18a
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Core/Ap4Utils.h
@@ -0,0 +1,103 @@
+/*****************************************************************
+|
+| AP4 - Utilities
+|
+| Copyright 2002 Gilles Boccon-Gibod
+|
+|
+| This file is part of Bento4/AP4 (MP4 Atom Processing Library).
+|
+| Unless you have obtained Bento4 under a difference license,
+| this version of Bento4 is Bento4|GPL.
+| Bento4|GPL 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; either version 2, or (at your option)
+| any later version.
+|
+| Bento4|GPL 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 Bento4|GPL; see the file COPYING. If not, write to the
+| Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+| 02111-1307, USA.
+|
+ ****************************************************************/
+
+#ifndef _AP4_UTILS_H_
+#define _AP4_UTILS_H_
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4.h"
+#include "Ap4Config.h"
+#include "Ap4Atom.h"
+
+/*----------------------------------------------------------------------
+| MIN & MAX
++---------------------------------------------------------------------*/
+#define MIN(a,b) (a<b)?a:b
+#define MAX(a,b) (a>b)?a:b
+
+/*----------------------------------------------------------------------
+| byte I/O
++---------------------------------------------------------------------*/
+unsigned long long AP4_BytesToUInt64BE(const unsigned char* bytes);
+unsigned long AP4_BytesToUInt32BE(const unsigned char* bytes);
+unsigned long AP4_BytesToUInt24BE(const unsigned char* bytes);
+unsigned short AP4_BytesToUInt16BE(const unsigned char* bytes);
+void AP4_BytesFromUInt64BE(unsigned char* bytes, unsigned long long value);
+void AP4_BytesFromUInt32BE(unsigned char* bytes, unsigned long value);
+void AP4_BytesFromUInt24BE(unsigned char* bytes, unsigned long value);
+void AP4_BytesFromUInt16BE(unsigned char* bytes, unsigned short value);
+unsigned long AP4_DurationMsFromUnits(AP4_UI64 units,
+ unsigned long units_per_second);
+AP4_UI64 AP4_ConvertTime(AP4_UI64 time_value,
+ unsigned long from_time_scale,
+ unsigned long to_time_scale);
+
+/*----------------------------------------------------------------------
+| string utils
++---------------------------------------------------------------------*/
+#if defined (AP4_CONFIG_HAVE_STDIO_H)
+#include <stdio.h>
+#endif
+
+#if defined (AP4_CONFIG_HAVE_SNPRINTF)
+#define AP4_StringFormat snprintf
+#else
+int AP4_StringFormat(char* str, AP4_Size size, const char* format, ...);
+#endif
+
+void AP4_FormatFourChars(char* str, AP4_UI32 value);
+AP4_Result
+AP4_ParseHex(const char* hex, unsigned char* bytes, unsigned int count);
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1, char*& arg2);
+AP4_Result
+AP4_SplitArgs(char* arg, char*& arg0, char*& arg1);
+
+/*----------------------------------------------------------------------
+| AP4_PrintInspector
++---------------------------------------------------------------------*/
+class AP4_PrintInspector : public AP4_AtomInspector {
+public:
+ AP4_PrintInspector(AP4_ByteStream& stream);
+ ~AP4_PrintInspector();
+
+ // methods
+ void StartElement(const char* name, const char* info);
+ void EndElement();
+ void AddField(const char* name, AP4_UI32 value, FormatHint hint);
+ void AddField(const char* name, const char* value, FormatHint hint);
+
+private:
+ // members
+ AP4_ByteStream* m_Stream;
+ AP4_Cardinal m_Indent;
+};
+
+#endif // _AP4_UTILS_H_
diff --git a/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Crypto/Ap4AesBlockCipher.cpp b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Crypto/Ap4AesBlockCipher.cpp
new file mode 100644
index 000000000..95eff4b7e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/AP4/Update/v0.6.3/Source/Crypto/Ap4AesBlockCipher.cpp
@@ -0,0 +1,1840 @@
+/*
+* AES Block cipher
+* (c) 2005 Gilles Boccon-Gibod
+* Portions (c) 2001, Dr Brian Gladman (see below)
+*/
+
+/*
+-------------------------------------------------------------------------
+Copyright (c) 2001, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
+All rights reserved.
+
+LICENSE TERMS
+
+The free distribution and use of this software in both source and binary
+form is allowed (with or without changes) provided that:
+
+1. distributions of this source code include the above copyright
+notice, this list of conditions and the following disclaimer;
+
+2. distributions in binary form include the above copyright
+notice, this list of conditions and the following disclaimer
+in the documentation and/or other associated materials;
+
+3. the copyright holder's name is not used to endorse products
+built using this software without specific written permission.
+
+DISCLAIMER
+
+This software is provided 'as is' with no explicit or implied warranties
+in respect of its properties, including, but not limited to, correctness
+and fitness for purpose.
+-------------------------------------------------------------------------
+Issue Date: 29/07/2002
+*/
+
+/*----------------------------------------------------------------------
+| includes
++---------------------------------------------------------------------*/
+#include "Ap4AesBlockCipher.h"
+#include "Ap4Results.h"
+
+/*----------------------------------------------------------------------
+| build options
++---------------------------------------------------------------------*/
+#define ENCRYPTION_KEY_SCHEDULE
+#define ENCRYPTION
+#define BLOCK_SIZE AP4_AES_BLOCK_SIZE
+
+/*----------------------------------------------------------------------
+| options
++---------------------------------------------------------------------*/
+/* START OF CONFIGURATION OPTIONS
+
+ USE OF DEFINES
+
+ Later in this section there are a number of defines that control the
+ operation of the code. In each section, the purpose of each define is
+ explained so that the relevant form can be included or excluded by
+ setting either 1's or 0's respectively on the branches of the related
+ #if clauses.
+*/
+
+/* 1. BYTE ORDER IN 32-BIT WORDS
+
+ To obtain the highest speed on processors with 32-bit words, this code
+ needs to determine the order in which bytes are packed into such words.
+ The following block of code is an attempt to capture the most obvious
+ ways in which various environemnts define byte order. It may well fail,
+ in which case the definitions will need to be set by editing at the
+ points marked **** EDIT HERE IF NECESSARY **** below.
+*/
+#define AES_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
+#define AES_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
+
+#if !defined(AP4_PLATFORM_BYTE_ORDER)
+# error AP4_PLATFORM_BYTE_ORDER is not set
+#endif
+
+#if 0
+#if AP4_PLATFORM_BYTE_ORDER == AP4_PLATFORM_BIG_ENDIAN
+#define PLATFORM_BYTE_ORDER AES_BIG_ENDIAN
+#elif AP4_PLATFORM_BYTE_ORDER == AP4_PLATFORM_LITTLE_ENDIAN
+#define PLATFORM_BYTE_ORDER AES_LITTLE_ENDIAN
+#else
+#error unsupported value for AP4_PLATFORM_BYTE_ORDER
+#endif
+#endif
+
+#define PLATFORM_BYTE_ORDER AES_LITTLE_ENDIAN
+
+
+/* 2. BYTE ORDER WITHIN 32 BIT WORDS
+
+ The fundamental data processing units in Rijndael are 8-bit bytes. The
+ input, output and key input are all enumerated arrays of bytes in which
+ bytes are numbered starting at zero and increasing to one less than the
+ number of bytes in the array in question. This enumeration is only used
+ for naming bytes and does not imply any adjacency or order relationship
+ from one byte to another. When these inputs and outputs are considered
+ as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to
+ byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte.
+ In this implementation bits are numbered from 0 to 7 starting at the
+ numerically least significant end of each byte (bit n represents 2^n).
+
+ However, Rijndael can be implemented more efficiently using 32-bit
+ words by packing bytes into words so that bytes 4*n to 4*n+3 are placed
+ into word[n]. While in principle these bytes can be assembled into words
+ in any positions, this implementation only supports the two formats in
+ which bytes in adjacent positions within words also have adjacent byte
+ numbers. This order is called big-endian if the lowest numbered bytes
+ in words have the highest numeric significance and little-endian if the
+ opposite applies.
+
+ This code can work in either order irrespective of the order used by the
+ machine on which it runs. Normally the internal byte order will be set
+ to the order of the processor on which the code is to be run but this
+ define can be used to reverse this in special situations
+*/
+#if 1
+#define INTERNAL_BYTE_ORDER PLATFORM_BYTE_ORDER
+#elif defined(AES_LITTLE_ENDIAN)
+#define INTERNAL_BYTE_ORDER AES_LITTLE_ENDIAN
+#elif defined(AES_BIG_ENDIAN)
+#define INTERNAL_BYTE_ORDER AES_BIG_ENDIAN
+#endif
+
+/* 3. FAST INPUT/OUTPUT OPERATIONS.
+
+ On some machines it is possible to improve speed by transferring the
+ bytes in the input and output arrays to and from the internal 32-bit
+ variables by addressing these arrays as if they are arrays of 32-bit
+ words. On some machines this will always be possible but there may
+ be a large performance penalty if the byte arrays are not aligned on
+ the normal word boundaries. On other machines this technique will
+ lead to memory access errors when such 32-bit word accesses are not
+ properly aligned. The option SAFE_IO avoids such problems but will
+ often be slower on those machines that support misaligned access
+ (especially so if care is taken to align the input and output byte
+ arrays on 32-bit word boundaries). If SAFE_IO is not defined it is
+ assumed that access to byte arrays as if they are arrays of 32-bit
+ words will not cause problems when such accesses are misaligned.
+*/
+#if 1
+#define SAFE_IO
+#endif
+
+/* 4. LOOP UNROLLING
+
+ The code for encryption and decrytpion cycles through a number of rounds
+ that can be implemented either in a loop or by expanding the code into a
+ long sequence of instructions, the latter producing a larger program but
+ one that will often be much faster. The latter is called loop unrolling.
+ There are also potential speed advantages in expanding two iterations in
+ a loop with half the number of iterations, which is called partial loop
+ unrolling. The following options allow partial or full loop unrolling
+ to be set independently for encryption and decryption
+*/
+#if 1
+#define ENC_UNROLL FULL
+#elif 0
+#define ENC_UNROLL PARTIAL
+#else
+#define ENC_UNROLL NONE
+#endif
+
+#if 1
+#define DEC_UNROLL FULL
+#elif 0
+#define DEC_UNROLL PARTIAL
+#else
+#define DEC_UNROLL NONE
+#endif
+
+/* 5. FIXED OR DYNAMIC TABLES
+
+ When this section is included the tables used by the code are comipled
+ statically into the binary file. Otherwise they are computed once when
+ the code is first used.
+*/
+#if 1
+#define FIXED_TABLES
+#endif
+
+/* 6. FAST FINITE FIELD OPERATIONS
+
+ If this section is included, tables are used to provide faster finite
+ field arithmetic (this has no effect if FIXED_TABLES is defined).
+*/
+#if 1
+#define FF_TABLES
+#endif
+
+/* 7. INTERNAL STATE VARIABLE FORMAT
+
+ The internal state of Rijndael is stored in a number of local 32-bit
+ word varaibles which can be defined either as an array or as individual
+ names variables. Include this section if you want to store these local
+ variables in arrays. Otherwise individual local variables will be used.
+*/
+#if 1
+#define ARRAYS
+#endif
+
+/* In this implementation the columns of the state array are each held in
+ 32-bit words. The state array can be held in various ways: in an array
+ of words, in a number of individual word variables or in a number of
+ processor registers. The following define maps a variable name x and
+ a column number c to the way the state array variable is to be held.
+ The first define below maps the state into an array x[c] whereas the
+ second form maps the state into a number of individual variables x0,
+ x1, etc. Another form could map individual state colums to machine
+ register names.
+*/
+
+#if defined(ARRAYS)
+#define s(x,c) x[c]
+#else
+#define s(x,c) x##c
+#endif
+
+/* 8. VARIABLE BLOCK SIZE SPEED
+
+ This section is only relevant if you wish to use the variable block
+ length feature of the code. Include this section if you place more
+ emphasis on speed rather than code size.
+*/
+#if 1
+#define FAST_VARIABLE
+#endif
+
+/* 9. INTERNAL TABLE CONFIGURATION
+
+ This cipher proceeds by repeating in a number of cycles known as 'rounds'
+ which are implemented by a round function which can optionally be speeded
+ up using tables. The basic tables are each 256 32-bit words, with either
+ one or four tables being required for each round function depending on
+ how much speed is required. The encryption and decryption round functions
+ are different and the last encryption and decrytpion round functions are
+ different again making four different round functions in all.
+
+ This means that:
+ 1. Normal encryption and decryption rounds can each use either 0, 1
+ or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
+ 2. The last encryption and decryption rounds can also use either 0, 1
+ or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
+
+ Include or exclude the appropriate definitions below to set the number
+ of tables used by this implementation.
+*/
+
+#if 1 /* set tables for the normal encryption round */
+#define ENC_ROUND FOUR_TABLES
+#elif 0
+#define ENC_ROUND ONE_TABLE
+#else
+#define ENC_ROUND NO_TABLES
+#endif
+
+#if 1 /* set tables for the last encryption round */
+#define LAST_ENC_ROUND FOUR_TABLES
+#elif 0
+#define LAST_ENC_ROUND ONE_TABLE
+#else
+#define LAST_ENC_ROUND NO_TABLES
+#endif
+
+#if 1 /* set tables for the normal decryption round */
+#define DEC_ROUND FOUR_TABLES
+#elif 0
+#define DEC_ROUND ONE_TABLE
+#else
+#define DEC_ROUND NO_TABLES
+#endif
+
+#if 1 /* set tables for the last decryption round */
+#define LAST_DEC_ROUND FOUR_TABLES
+#elif 0
+#define LAST_DEC_ROUND ONE_TABLE
+#else
+#define LAST_DEC_ROUND NO_TABLES
+#endif
+
+/* The decryption key schedule can be speeded up with tables in the same
+ way that the round functions can. Include or exclude the following
+ defines to set this requirement.
+*/
+#if 1
+#define KEY_SCHED FOUR_TABLES
+#elif 0
+#define KEY_SCHED ONE_TABLE
+#else
+#define KEY_SCHED NO_TABLES
+#endif
+
+/* END OF CONFIGURATION OPTIONS */
+
+#define NO_TABLES 0 /* DO NOT CHANGE */
+#define ONE_TABLE 1 /* DO NOT CHANGE */
+#define FOUR_TABLES 4 /* DO NOT CHANGE */
+#define NONE 0 /* DO NOT CHANGE */
+#define PARTIAL 1 /* DO NOT CHANGE */
+#define FULL 2 /* DO NOT CHANGE */
+
+#if defined(BLOCK_SIZE) && ((BLOCK_SIZE & 3) || BLOCK_SIZE < 16 || BLOCK_SIZE > 32)
+#error An illegal block size has been specified.
+#endif
+
+#if !defined(BLOCK_SIZE)
+#define RC_LENGTH 29
+#else
+#define RC_LENGTH 5 * BLOCK_SIZE / 4 - (BLOCK_SIZE == 16 ? 10 : 11)
+#endif
+
+/* Disable at least some poor combinations of options */
+
+#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES
+#undef LAST_ENC_ROUND
+#define LAST_ENC_ROUND NO_TABLES
+#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES
+#undef LAST_ENC_ROUND
+#define LAST_ENC_ROUND ONE_TABLE
+#endif
+
+#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE
+#undef ENC_UNROLL
+#define ENC_UNROLL NONE
+#endif
+
+#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES
+#undef LAST_DEC_ROUND
+#define LAST_DEC_ROUND NO_TABLES
+#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES
+#undef LAST_DEC_ROUND
+#define LAST_DEC_ROUND ONE_TABLE
+#endif
+
+#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE
+#undef DEC_UNROLL
+#define DEC_UNROLL NONE
+#endif
+
+/* upr(x,n): rotates bytes within words by n positions, moving bytes to
+ higher index positions with wrap around into low positions
+ ups(x,n): moves bytes by n positions to higher index positions in
+ words but without wrap around
+ bval(x,n): extracts a byte from a word
+
+ NOTE: The definitions given here are intended only for use with
+ unsigned variables and with shift counts that are compile
+ time constants
+*/
+
+#if (INTERNAL_BYTE_ORDER == AES_LITTLE_ENDIAN)
+#if defined(_MSC_VER)
+#define upr(x,n) _lrotl((aes_32t)(x), 8 * (n))
+#else
+#define upr(x,n) ((aes_32t)(x) << 8 * (n) | (aes_32t)(x) >> (32 - 8 * (n)))
+#endif
+#define ups(x,n) ((aes_32t)(x) << 8 * (n))
+#define bval(x,n) ((aes_08t)((x) >> 8 * (n)))
+#define bytes2word(b0, b1, b2, b3) \
+ (((aes_32t)(b3) << 24) | ((aes_32t)(b2) << 16) | ((aes_32t)(b1) << 8) | (b0))
+#endif
+
+#if (INTERNAL_BYTE_ORDER == AES_BIG_ENDIAN)
+#define upr(x,n) ((aes_32t)(x) >> 8 * (n) | (aes_32t)(x) << 32 - 8 * (n))
+#define ups(x,n) ((aes_32t)(x) >> 8 * (n)))
+#define bval(x,n) ((aes_08t)((x) >> (24 - 8 * (n))))
+#define bytes2word(b0, b1, b2, b3) \
+ (((aes_32t)(b0) << 24) | ((aes_32t)(b1) << 16) | ((aes_32t)(b2) << 8) | (b3))
+#endif
+
+#if defined(SAFE_IO)
+
+#define word_in(x) bytes2word((x)[0], (x)[1], (x)[2], (x)[3])
+#define word_out(x,v) { (x)[0] = bval(v,0); (x)[1] = bval(v,1); \
+ (x)[2] = bval(v,2); (x)[3] = bval(v,3); }
+
+#elif (INTERNAL_BYTE_ORDER == PLATFORM_BYTE_ORDER)
+
+#define word_in(x) *(aes_32t*)(x)
+#define word_out(x,v) *(aes_32t*)(x) = (v)
+
+#else
+
+#if !defined(bswap_32)
+#if !defined(_MSC_VER)
+#define _lrotl(x,n) ((((aes_32t)(x)) << n) | (((aes_32t)(x)) >> (32 - n)))
+#endif
+#define bswap_32(x) ((_lrotl((x),8) & 0x00ff00ff) | (_lrotl((x),24) & 0xff00ff00))
+#endif
+
+#define word_in(x) bswap_32(*(aes_32t*)(x))
+#define word_out(x,v) *(aes_32t*)(x) = bswap_32(v)
+
+#endif
+
+/* the finite field modular polynomial and elements */
+
+#define WPOLY 0x011b
+#define BPOLY 0x1b
+
+/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */
+
+#define m1 0x80808080
+#define m2 0x7f7f7f7f
+#define FFmulX(x) ((((x) & m2) << 1) ^ ((((x) & m1) >> 7) * BPOLY))
+
+/* The following defines provide alternative definitions of FFmulX that might
+ give improved performance if a fast 32-bit multiply is not available. Note
+ that a temporary variable u needs to be defined where FFmulX is used.
+
+#define FFmulX(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6))
+#define m4 (0x01010101 * BPOLY)
+#define FFmulX(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4)
+*/
+
+/* Work out which tables are needed for the different options */
+
+#ifdef AES_ASM
+#ifdef ENC_ROUND
+#undef ENC_ROUND
+#endif
+#define ENC_ROUND FOUR_TABLES
+#ifdef LAST_ENC_ROUND
+#undef LAST_ENC_ROUND
+#endif
+#define LAST_ENC_ROUND FOUR_TABLES
+#ifdef DEC_ROUND
+#undef DEC_ROUND
+#endif
+#define DEC_ROUND FOUR_TABLES
+#ifdef LAST_DEC_ROUND
+#undef LAST_DEC_ROUND
+#endif
+#define LAST_DEC_ROUND FOUR_TABLES
+#ifdef KEY_SCHED
+#undef KEY_SCHED
+#define KEY_SCHED FOUR_TABLES
+#endif
+#endif
+
+#if defined(ENCRYPTION) || defined(AES_ASM)
+#if ENC_ROUND == ONE_TABLE
+#define FT1_SET
+#elif ENC_ROUND == FOUR_TABLES
+#define FT4_SET
+#else
+#define SBX_SET
+#endif
+#if LAST_ENC_ROUND == ONE_TABLE
+#define FL1_SET
+#elif LAST_ENC_ROUND == FOUR_TABLES
+#define FL4_SET
+#elif !defined(SBX_SET)
+#define SBX_SET
+#endif
+#endif
+
+#if defined(DECRYPTION) || defined(AES_ASM)
+#if DEC_ROUND == ONE_TABLE
+#define IT1_SET
+#elif DEC_ROUND == FOUR_TABLES
+#define IT4_SET
+#else
+#define ISB_SET
+#endif
+#if LAST_DEC_ROUND == ONE_TABLE
+#define IL1_SET
+#elif LAST_DEC_ROUND == FOUR_TABLES
+#define IL4_SET
+#elif !defined(ISB_SET)
+#define ISB_SET
+#endif
+#endif
+
+#if defined(ENCRYPTION_KEY_SCHEDULE) || defined(DECRYPTION_KEY_SCHEDULE)
+#if KEY_SCHED == ONE_TABLE
+#define LS1_SET
+#define IM1_SET
+#elif KEY_SCHED == FOUR_TABLES
+#define LS4_SET
+#define IM4_SET
+#elif !defined(SBX_SET)
+#define SBX_SET
+#endif
+#endif
+
+#ifdef FIXED_TABLES
+#define prefx static const
+#else
+#define prefx extern
+extern aes_08t tab_init;
+void gen_tabs(void);
+#endif
+
+//prefx aes_32t rcon_tab[29];
+//
+//#ifdef SBX_SET
+//prefx aes_08t s_box[256];
+//#endif
+//
+//#ifdef ISB_SET
+//prefx aes_08t inv_s_box[256];
+//#endif
+//
+//#ifdef FT1_SET
+//prefx aes_32t ft_tab[256];
+//#endif
+//
+//#ifdef FT4_SET
+//prefx aes_32t ft_tab[4][256];
+//#endif
+//
+//#ifdef FL1_SET
+//prefx aes_32t fl_tab[256];
+//#endif
+//
+//#ifdef FL4_SET
+//prefx aes_32t fl_tab[4][256];
+//#endif
+//
+//#ifdef IT1_SET
+//prefx aes_32t it_tab[256];
+//#endif
+//
+//#ifdef IT4_SET
+//prefx aes_32t it_tab[4][256];
+//#endif
+//
+//#ifdef IL1_SET
+//prefx aes_32t il_tab[256];
+//#endif
+//
+//#ifdef IL4_SET
+//prefx aes_32t il_tab[4][256];
+//#endif
+//
+//#ifdef LS1_SET
+//#ifdef FL1_SET
+//#undef LS1_SET
+//#else
+//prefx aes_32t ls_tab[256];
+//#endif
+//#endif
+//
+//#ifdef LS4_SET
+//#ifdef FL4_SET
+//#undef LS4_SET
+//#else
+//prefx aes_32t ls_tab[4][256];
+//#endif
+//#endif
+//
+//#ifdef IM1_SET
+//prefx aes_32t im_tab[256];
+//#endif
+//
+//#ifdef IM4_SET
+//prefx aes_32t im_tab[4][256];
+//#endif
+
+/* Set the number of columns in nc. Note that it is important
+ that nc is a constant which is known at compile time if the
+ highest speed version of the code is needed.
+*/
+
+#if defined(BLOCK_SIZE)
+#define nc (BLOCK_SIZE >> 2)
+#else
+#define nc (cx->n_blk >> 2)
+#endif
+
+/* generic definitions of Rijndael macros that use tables */
+
+#define no_table(x,box,vf,rf,c) bytes2word( \
+ box[bval(vf(x,0,c),rf(0,c))], \
+ box[bval(vf(x,1,c),rf(1,c))], \
+ box[bval(vf(x,2,c),rf(2,c))], \
+ box[bval(vf(x,3,c),rf(3,c))])
+
+#define one_table(x,op,tab,vf,rf,c) \
+ ( tab[bval(vf(x,0,c),rf(0,c))] \
+ ^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \
+ ^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \
+ ^ op(tab[bval(vf(x,3,c),rf(3,c))],3))
+
+#define four_tables(x,tab,vf,rf,c) \
+ ( tab[0][bval(vf(x,0,c),rf(0,c))] \
+ ^ tab[1][bval(vf(x,1,c),rf(1,c))] \
+ ^ tab[2][bval(vf(x,2,c),rf(2,c))] \
+ ^ tab[3][bval(vf(x,3,c),rf(3,c))])
+
+#define vf1(x,r,c) (x)
+#define rf1(r,c) (r)
+#define rf2(r,c) ((r-c)&3)
+
+/* perform forward and inverse column mix operation on four bytes in long word x in */
+/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */
+
+#define dec_fmvars
+#if defined(FM4_SET) /* not currently used */
+#define fwd_mcol(x) four_tables(x,fm_tab,vf1,rf1,0)
+#elif defined(FM1_SET) /* not currently used */
+#define fwd_mcol(x) one_table(x,upr,fm_tab,vf1,rf1,0)
+#else
+#undef dec_fmvars
+#define dec_fmvars aes_32t f1, f2;
+#define fwd_mcol(x) (f1 = (x), f2 = FFmulX(f1), f2 ^ upr(f1 ^ f2, 3) ^ upr(f1, 2) ^ upr(f1, 1))
+#endif
+
+#define dec_imvars
+#if defined(IM4_SET)
+#define inv_mcol(x) four_tables(x,im_tab,vf1,rf1,0)
+#elif defined(IM1_SET)
+#define inv_mcol(x) one_table(x,upr,im_tab,vf1,rf1,0)
+#else
+#undef dec_imvars
+#define dec_imvars aes_32t f2, f4, f8, f9;
+#define inv_mcol(x) \
+ (f9 = (x), f2 = FFmulX(f9), f4 = FFmulX(f2), f8 = FFmulX(f4), f9 ^= f8, \
+ f2 ^= f4 ^ f8 ^ upr(f2 ^ f9,3) ^ upr(f4 ^ f9,2) ^ upr(f9,1))
+#endif
+
+#if defined(FL4_SET)
+#define ls_box(x,c) four_tables(x,fl_tab,vf1,rf2,c)
+#elif defined(LS4_SET)
+#define ls_box(x,c) four_tables(x,ls_tab,vf1,rf2,c)
+#elif defined(FL1_SET)
+#define ls_box(x,c) one_table(x,upr,fl_tab,vf1,rf2,c)
+#elif defined(LS1_SET)
+#define ls_box(x,c) one_table(x,upr,ls_tab,vf1,rf2,c)
+#else
+#define ls_box(x,c) no_table(x,s_box,vf1,rf2,c)
+#endif
+
+/*----------------------------------------------------------------------
+| tables
++---------------------------------------------------------------------*/
+#if defined(FIXED_TABLES) || !defined(FF_TABLES)
+
+/* finite field arithmetic operations */
+
+#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY))
+#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY))
+#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \
+ ^ (((x>>5) & 4) * WPOLY))
+#define f3(x) (f2(x) ^ x)
+#define f9(x) (f8(x) ^ x)
+#define fb(x) (f8(x) ^ f2(x) ^ x)
+#define fd(x) (f8(x) ^ f4(x) ^ x)
+#define fe(x) (f8(x) ^ f4(x) ^ f2(x))
+
+#endif
+
+#if defined(FIXED_TABLES)
+
+#define sb_data(w) \
+ w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\
+ w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\
+ w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\
+ w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\
+ w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\
+ w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\
+ w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\
+ w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\
+ w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\
+ w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\
+ w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\
+ w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\
+ w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\
+ w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\
+ w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\
+ w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\
+ w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\
+ w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\
+ w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\
+ w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\
+ w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\
+ w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\
+ w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\
+ w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\
+ w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\
+ w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\
+ w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\
+ w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\
+ w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\
+ w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\
+ w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\
+ w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16)
+
+#define isb_data(w) \
+ w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\
+ w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\
+ w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\
+ w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\
+ w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\
+ w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\
+ w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\
+ w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\
+ w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\
+ w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\
+ w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\
+ w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\
+ w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\
+ w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\
+ w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\
+ w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\
+ w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\
+ w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\
+ w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\
+ w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\
+ w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\
+ w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\
+ w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\
+ w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\
+ w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\
+ w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\
+ w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\
+ w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\
+ w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\
+ w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\
+ w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\
+ w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d),
+
+#define mm_data(w) \
+ w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\
+ w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\
+ w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\
+ w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\
+ w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\
+ w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\
+ w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\
+ w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\
+ w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\
+ w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\
+ w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\
+ w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\
+ w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\
+ w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\
+ w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\
+ w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\
+ w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\
+ w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\
+ w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\
+ w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\
+ w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\
+ w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\
+ w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\
+ w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\
+ w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\
+ w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\
+ w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\
+ w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\
+ w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\
+ w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\
+ w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\
+ w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff)
+
+#define h0(x) (x)
+
+/* These defines are used to ensure tables are generated in the
+ right format depending on the internal byte order required
+*/
+
+#define w0(p) bytes2word(p, 0, 0, 0)
+#define w1(p) bytes2word(0, p, 0, 0)
+#define w2(p) bytes2word(0, 0, p, 0)
+#define w3(p) bytes2word(0, 0, 0, p)
+
+/* Number of elements required in this table for different
+ block and key lengths is:
+
+ Rcon Table key length (bytes)
+ Length 16 20 24 28 32
+ ---------------------
+ block 16 | 10 9 8 7 7
+ length 20 | 14 11 10 9 9
+ (bytes) 24 | 19 15 12 11 11
+ 28 | 24 19 16 13 13
+ 32 | 29 23 19 17 14
+
+ this table can be a table of bytes if the key schedule
+ code is adjusted accordingly
+*/
+
+#define u0(p) bytes2word(f2(p), p, p, f3(p))
+#define u1(p) bytes2word(f3(p), f2(p), p, p)
+#define u2(p) bytes2word(p, f3(p), f2(p), p)
+#define u3(p) bytes2word(p, p, f3(p), f2(p))
+
+#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p))
+#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p))
+#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p))
+#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p))
+
+static const aes_32t rcon_tab[29] =
+{
+ w0(0x01), w0(0x02), w0(0x04), w0(0x08),
+ w0(0x10), w0(0x20), w0(0x40), w0(0x80),
+ w0(0x1b), w0(0x36), w0(0x6c), w0(0xd8),
+ w0(0xab), w0(0x4d), w0(0x9a), w0(0x2f),
+ w0(0x5e), w0(0xbc), w0(0x63), w0(0xc6),
+ w0(0x97), w0(0x35), w0(0x6a), w0(0xd4),
+ w0(0xb3), w0(0x7d), w0(0xfa), w0(0xef),
+ w0(0xc5)
+};
+
+#ifdef SBX_SET
+static const aes_08t s_box[256] = { sb_data(h0) };
+#endif
+#ifdef ISB_SET
+static const aes_08t inv_s_box[256] = { isb_data(h0) };
+#endif
+
+#ifdef FT1_SET
+static const aes_32t ft_tab[256] = { sb_data(u0) };
+#endif
+#ifdef FT4_SET
+static const aes_32t ft_tab[4][256] =
+ { { sb_data(u0) }, { sb_data(u1) }, { sb_data(u2) }, { sb_data(u3) } };
+#endif
+
+#ifdef FL1_SET
+static const aes_32t fl_tab[256] = { sb_data(w0) };
+#endif
+#ifdef FL4_SET
+static const aes_32t fl_tab[4][256] =
+ { { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
+#endif
+
+#ifdef IT1_SET
+static const aes_32t it_tab[256] = { isb_data(v0) };
+#endif
+#ifdef IT4_SET
+static const aes_32t it_tab[4][256] =
+ { { isb_data(v0) }, { isb_data(v1) }, { isb_data(v2) }, { isb_data(v3) } };
+#endif
+
+#ifdef IL1_SET
+static const aes_32t il_tab[256] = { isb_data(w0) };
+#endif
+#ifdef IL4_SET
+static const aes_32t il_tab[4][256] =
+ { { isb_data(w0) }, { isb_data(w1) }, { isb_data(w2) }, { isb_data(w3) } };
+#endif
+
+#ifdef LS1_SET
+static const aes_32t ls_tab[256] = { sb_data(w0) };
+#endif
+#ifdef LS4_SET
+static const aes_32t ls_tab[4][256] =
+ { { sb_data(w0) }, { sb_data(w1) }, { sb_data(w2) }, { sb_data(w3) } };
+#endif
+
+#ifdef IM1_SET
+static const aes_32t im_tab[256] = { mm_data(v0) };
+#endif
+#ifdef IM4_SET
+static const aes_32t im_tab[4][256] =
+ { { mm_data(v0) }, { mm_data(v1) }, { mm_data(v2) }, { mm_data(v3) } };
+#endif
+
+#else /* dynamic table generation */
+
+aes_08t tab_init = 0;
+
+#define const
+
+static aes_32t rcon_tab[RC_LENGTH];
+
+#ifdef SBX_SET
+aes_08t s_box[256];
+#endif
+#ifdef ISB_SET
+aes_08t inv_s_box[256];
+#endif
+
+#ifdef FT1_SET
+aes_32t ft_tab[256];
+#endif
+#ifdef FT4_SET
+aes_32t ft_tab[4][256];
+#endif
+
+#ifdef FL1_SET
+aes_32t fl_tab[256];
+#endif
+#ifdef FL4_SET
+aes_32t fl_tab[4][256];
+#endif
+
+#ifdef IT1_SET
+aes_32t it_tab[256];
+#endif
+#ifdef IT4_SET
+aes_32t it_tab[4][256];
+#endif
+
+#ifdef IL1_SET
+aes_32t il_tab[256];
+#endif
+#ifdef IL4_SET
+aes_32t il_tab[4][256];
+#endif
+
+#ifdef LS1_SET
+aes_32t ls_tab[256];
+#endif
+#ifdef LS4_SET
+aes_32t ls_tab[4][256];
+#endif
+
+#ifdef IM1_SET
+aes_32t im_tab[256];
+#endif
+#ifdef IM4_SET
+aes_32t im_tab[4][256];
+#endif
+
+#if !defined(FF_TABLES)
+
+/* Generate the tables for the dynamic table option
+
+ It will generally be sensible to use tables to compute finite
+ field multiplies and inverses but where memory is scarse this
+ code might sometimes be better. But it only has effect during
+ initialisation so its pretty unimportant in overall terms.
+*/
+
+/* return 2 ^ (n - 1) where n is the bit number of the highest bit
+ set in x with x in the range 1 < x < 0x00000200. This form is
+ used so that locals within fi can be bytes rather than words
+*/
+
+static aes_08t hibit(const aes_32t x)
+{ aes_08t r = (aes_08t)((x >> 1) | (x >> 2));
+
+ r |= (r >> 2);
+ r |= (r >> 4);
+ return (r + 1) >> 1;
+}
+
+/* return the inverse of the finite field element x */
+
+static aes_08t fi(const aes_08t x)
+{ aes_08t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0;
+
+ if(x < 2) return x;
+
+ for(;;)
+ {
+ if(!n1) return v1;
+
+ while(n2 >= n1)
+ {
+ n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2);
+ }
+
+ if(!n2) return v2;
+
+ while(n1 >= n2)
+ {
+ n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1);
+ }
+ }
+}
+
+#else
+
+/* define the finite field multiplies required for Rijndael */
+
+#define f2(x) ((x) ? pow[log[x] + 0x19] : 0)
+#define f3(x) ((x) ? pow[log[x] + 0x01] : 0)
+#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0)
+#define fb(x) ((x) ? pow[log[x] + 0x68] : 0)
+#define fd(x) ((x) ? pow[log[x] + 0xee] : 0)
+#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0)
+#define fi(x) ((x) ? pow[255 - log[x]]: 0)
+
+#endif
+
+/* The forward and inverse affine transformations used in the S-box */
+
+#define fwd_affine(x) \
+ (w = (aes_32t)x, w ^= (w<<1)^(w<<2)^(w<<3)^(w<<4), 0x63^(aes_08t)(w^(w>>8)))
+
+#define inv_affine(x) \
+ (w = (aes_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(aes_08t)(w^(w>>8)))
+
+void gen_tabs(void)
+{ aes_32t i, w;
+
+#if defined(FF_TABLES)
+
+ aes_08t pow[512], log[256];
+
+ /* log and power tables for GF(2^8) finite field with
+ WPOLY as modular polynomial - the simplest primitive
+ root is 0x03, used here to generate the tables
+ */
+
+ i = 0; w = 1;
+ do
+ {
+ pow[i] = (aes_08t)w;
+ pow[i + 255] = (aes_08t)w;
+ log[w] = (aes_08t)i++;
+ w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0);
+ }
+ while (w != 1);
+
+#endif
+
+ for(i = 0, w = 1; i < RC_LENGTH; ++i)
+ {
+ rcon_tab[i] = bytes2word(w, 0, 0, 0);
+ w = f2(w);
+ }
+
+ for(i = 0; i < 256; ++i)
+ { aes_08t b;
+
+ b = fwd_affine(fi((aes_08t)i));
+ w = bytes2word(f2(b), b, b, f3(b));
+
+#ifdef SBX_SET
+ s_box[i] = b;
+#endif
+
+#ifdef FT1_SET /* tables for a normal encryption round */
+ ft_tab[i] = w;
+#endif
+#ifdef FT4_SET
+ ft_tab[0][i] = w;
+ ft_tab[1][i] = upr(w,1);
+ ft_tab[2][i] = upr(w,2);
+ ft_tab[3][i] = upr(w,3);
+#endif
+ w = bytes2word(b, 0, 0, 0);
+
+#ifdef FL1_SET /* tables for last encryption round (may also */
+ fl_tab[i] = w; /* be used in the key schedule) */
+#endif
+#ifdef FL4_SET
+ fl_tab[0][i] = w;
+ fl_tab[1][i] = upr(w,1);
+ fl_tab[2][i] = upr(w,2);
+ fl_tab[3][i] = upr(w,3);
+#endif
+
+#ifdef LS1_SET /* table for key schedule if fl_tab above is */
+ ls_tab[i] = w; /* not of the required form */
+#endif
+#ifdef LS4_SET
+ ls_tab[0][i] = w;
+ ls_tab[1][i] = upr(w,1);
+ ls_tab[2][i] = upr(w,2);
+ ls_tab[3][i] = upr(w,3);
+#endif
+
+ b = fi(inv_affine((aes_08t)i));
+ w = bytes2word(fe(b), f9(b), fd(b), fb(b));
+
+#ifdef IM1_SET /* tables for the inverse mix column operation */
+ im_tab[b] = w;
+#endif
+#ifdef IM4_SET
+ im_tab[0][b] = w;
+ im_tab[1][b] = upr(w,1);
+ im_tab[2][b] = upr(w,2);
+ im_tab[3][b] = upr(w,3);
+#endif
+
+#ifdef ISB_SET
+ inv_s_box[i] = b;
+#endif
+#ifdef IT1_SET /* tables for a normal decryption round */
+ it_tab[i] = w;
+#endif
+#ifdef IT4_SET
+ it_tab[0][i] = w;
+ it_tab[1][i] = upr(w,1);
+ it_tab[2][i] = upr(w,2);
+ it_tab[3][i] = upr(w,3);
+#endif
+ w = bytes2word(b, 0, 0, 0);
+#ifdef IL1_SET /* tables for last decryption round */
+ il_tab[i] = w;
+#endif
+#ifdef IL4_SET
+ il_tab[0][i] = w;
+ il_tab[1][i] = upr(w,1);
+ il_tab[2][i] = upr(w,2);
+ il_tab[3][i] = upr(w,3);
+#endif
+ }
+
+ tab_init = 1;
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| key schedule
++---------------------------------------------------------------------*/
+#if !defined(BLOCK_SIZE)
+
+static aes_rval aes_blk_len(unsigned int blen, aes_ctx cx[1])
+{
+#if !defined(FIXED_TABLES)
+ if(!tab_init) gen_tabs();
+#endif
+
+ if((blen & 7) || blen < 16 || blen > 32)
+ {
+ cx->n_blk = 0; return aes_bad;
+ }
+
+ cx->n_blk = blen;
+ return aes_good;
+}
+
+#endif
+
+/* Initialise the key schedule from the user supplied key. The key
+ length is now specified in bytes - 16, 24 or 32 as appropriate.
+ This corresponds to bit lengths of 128, 192 and 256 bits, and
+ to Nk values of 4, 6 and 8 respectively.
+
+ The following macros implement a single cycle in the key
+ schedule generation process. The number of cycles needed
+ for each cx->n_col and nk value is:
+
+ nk = 4 5 6 7 8
+ ------------------------------
+ cx->n_col = 4 10 9 8 7 7
+ cx->n_col = 5 14 11 10 9 9
+ cx->n_col = 6 19 15 12 11 11
+ cx->n_col = 7 21 19 16 13 14
+ cx->n_col = 8 29 23 19 17 14
+*/
+
+#define ke4(k,i) \
+{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
+ k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
+}
+#define kel4(k,i) \
+{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
+ k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
+}
+
+#define ke6(k,i) \
+{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
+ k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
+ k[6*(i)+10] = ss[4] ^= ss[3]; k[6*(i)+11] = ss[5] ^= ss[4]; \
+}
+#define kel6(k,i) \
+{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
+ k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
+}
+
+#define ke8(k,i) \
+{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
+ k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
+ k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); k[8*(i)+13] = ss[5] ^= ss[4]; \
+ k[8*(i)+14] = ss[6] ^= ss[5]; k[8*(i)+15] = ss[7] ^= ss[6]; \
+}
+#define kel8(k,i) \
+{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
+ k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
+}
+
+#if defined(ENCRYPTION_KEY_SCHEDULE)
+
+static aes_rval aes_enc_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
+{ aes_32t ss[8];
+
+#if !defined(FIXED_TABLES)
+ if(!tab_init) gen_tabs();
+#endif
+
+#if !defined(BLOCK_SIZE)
+ if(!cx->n_blk) cx->n_blk = 16;
+#else
+ cx->n_blk = BLOCK_SIZE;
+#endif
+
+ cx->n_blk = (cx->n_blk & ~3) | 1;
+
+ cx->k_sch[0] = ss[0] = word_in(in_key );
+ cx->k_sch[1] = ss[1] = word_in(in_key + 4);
+ cx->k_sch[2] = ss[2] = word_in(in_key + 8);
+ cx->k_sch[3] = ss[3] = word_in(in_key + 12);
+
+#if (BLOCK_SIZE == 16) && (ENC_UNROLL != NONE)
+
+ switch(klen)
+ {
+ case 16: ke4(cx->k_sch, 0); ke4(cx->k_sch, 1);
+ ke4(cx->k_sch, 2); ke4(cx->k_sch, 3);
+ ke4(cx->k_sch, 4); ke4(cx->k_sch, 5);
+ ke4(cx->k_sch, 6); ke4(cx->k_sch, 7);
+ ke4(cx->k_sch, 8); kel4(cx->k_sch, 9);
+ cx->n_rnd = 10; break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ ke6(cx->k_sch, 0); ke6(cx->k_sch, 1);
+ ke6(cx->k_sch, 2); ke6(cx->k_sch, 3);
+ ke6(cx->k_sch, 4); ke6(cx->k_sch, 5);
+ ke6(cx->k_sch, 6); kel6(cx->k_sch, 7);
+ cx->n_rnd = 12; break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ ke8(cx->k_sch, 0); ke8(cx->k_sch, 1);
+ ke8(cx->k_sch, 2); ke8(cx->k_sch, 3);
+ ke8(cx->k_sch, 4); ke8(cx->k_sch, 5);
+ kel8(cx->k_sch, 6);
+ cx->n_rnd = 14; break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+#else
+ { aes_32t i, l;
+ cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
+ l = (nc * cx->n_rnd + nc - 1) / (klen >> 2);
+
+ switch(klen)
+ {
+ case 16: for(i = 0; i < l; ++i)
+ ke4(cx->k_sch, i);
+ break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ for(i = 0; i < l; ++i)
+ ke6(cx->k_sch, i);
+ break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ for(i = 0; i < l; ++i)
+ ke8(cx->k_sch, i);
+ break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+ }
+#endif
+
+ return aes_good;
+}
+
+#endif
+
+#if defined(DECRYPTION_KEY_SCHEDULE)
+
+#if (DEC_ROUND != NO_TABLES)
+#define d_vars dec_imvars
+#define ff(x) inv_mcol(x)
+#else
+#define ff(x) (x)
+#define d_vars
+#endif
+
+#if 1
+#define kdf4(k,i) \
+{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; ss[1] = ss[1] ^ ss[3]; ss[2] = ss[2] ^ ss[3]; ss[3] = ss[3]; \
+ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ rcon_tab[i]; ss[i % 4] ^= ss[4]; \
+ ss[4] ^= k[4*(i)]; k[4*(i)+4] = ff(ss[4]); ss[4] ^= k[4*(i)+1]; k[4*(i)+5] = ff(ss[4]); \
+ ss[4] ^= k[4*(i)+2]; k[4*(i)+6] = ff(ss[4]); ss[4] ^= k[4*(i)+3]; k[4*(i)+7] = ff(ss[4]); \
+}
+#define kd4(k,i) \
+{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ rcon_tab[i]; ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \
+ k[4*(i)+4] = ss[4] ^= k[4*(i)]; k[4*(i)+5] = ss[4] ^= k[4*(i)+1]; \
+ k[4*(i)+6] = ss[4] ^= k[4*(i)+2]; k[4*(i)+7] = ss[4] ^= k[4*(i)+3]; \
+}
+#define kdl4(k,i) \
+{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ rcon_tab[i]; ss[i % 4] ^= ss[4]; \
+ k[4*(i)+4] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; k[4*(i)+5] = ss[1] ^ ss[3]; \
+ k[4*(i)+6] = ss[0]; k[4*(i)+7] = ss[1]; \
+}
+#else
+#define kdf4(k,i) \
+{ ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+ 4] = ff(ss[0]); ss[1] ^= ss[0]; k[4*(i)+ 5] = ff(ss[1]); \
+ ss[2] ^= ss[1]; k[4*(i)+ 6] = ff(ss[2]); ss[3] ^= ss[2]; k[4*(i)+ 7] = ff(ss[3]); \
+}
+#define kd4(k,i) \
+{ ss[4] = ls_box(ss[3],3) ^ rcon_tab[i]; \
+ ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[4*(i)+ 4] = ss[4] ^= k[4*(i)]; \
+ ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[4] ^= k[4*(i)+ 1]; \
+ ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[4] ^= k[4*(i)+ 2]; \
+ ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[4] ^= k[4*(i)+ 3]; \
+}
+#define kdl4(k,i) \
+{ ss[0] ^= ls_box(ss[3],3) ^ rcon_tab[i]; k[4*(i)+ 4] = ss[0]; ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[1]; \
+ ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[2]; ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[3]; \
+}
+#endif
+
+#define kdf6(k,i) \
+{ ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 6] = ff(ss[0]); ss[1] ^= ss[0]; k[6*(i)+ 7] = ff(ss[1]); \
+ ss[2] ^= ss[1]; k[6*(i)+ 8] = ff(ss[2]); ss[3] ^= ss[2]; k[6*(i)+ 9] = ff(ss[3]); \
+ ss[4] ^= ss[3]; k[6*(i)+10] = ff(ss[4]); ss[5] ^= ss[4]; k[6*(i)+11] = ff(ss[5]); \
+}
+#define kd6(k,i) \
+{ ss[6] = ls_box(ss[5],3) ^ rcon_tab[i]; \
+ ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[6*(i)+ 6] = ss[6] ^= k[6*(i)]; \
+ ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[6] ^= k[6*(i)+ 1]; \
+ ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[6] ^= k[6*(i)+ 2]; \
+ ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[6] ^= k[6*(i)+ 3]; \
+ ss[4] ^= ss[3]; k[6*(i)+10] = ss[6] ^= k[6*(i)+ 4]; \
+ ss[5] ^= ss[4]; k[6*(i)+11] = ss[6] ^= k[6*(i)+ 5]; \
+}
+#define kdl6(k,i) \
+{ ss[0] ^= ls_box(ss[5],3) ^ rcon_tab[i]; k[6*(i)+ 6] = ss[0]; ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[1]; \
+ ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[2]; ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[3]; \
+}
+
+#define kdf8(k,i) \
+{ ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 8] = ff(ss[0]); ss[1] ^= ss[0]; k[8*(i)+ 9] = ff(ss[1]); \
+ ss[2] ^= ss[1]; k[8*(i)+10] = ff(ss[2]); ss[3] ^= ss[2]; k[8*(i)+11] = ff(ss[3]); \
+ ss[4] ^= ls_box(ss[3],0); k[8*(i)+12] = ff(ss[4]); ss[5] ^= ss[4]; k[8*(i)+13] = ff(ss[5]); \
+ ss[6] ^= ss[5]; k[8*(i)+14] = ff(ss[6]); ss[7] ^= ss[6]; k[8*(i)+15] = ff(ss[7]); \
+}
+#define kd8(k,i) \
+{ aes_32t g = ls_box(ss[7],3) ^ rcon_tab[i]; \
+ ss[0] ^= g; g = ff(g); k[8*(i)+ 8] = g ^= k[8*(i)]; \
+ ss[1] ^= ss[0]; k[8*(i)+ 9] = g ^= k[8*(i)+ 1]; \
+ ss[2] ^= ss[1]; k[8*(i)+10] = g ^= k[8*(i)+ 2]; \
+ ss[3] ^= ss[2]; k[8*(i)+11] = g ^= k[8*(i)+ 3]; \
+ g = ls_box(ss[3],0); \
+ ss[4] ^= g; g = ff(g); k[8*(i)+12] = g ^= k[8*(i)+ 4]; \
+ ss[5] ^= ss[4]; k[8*(i)+13] = g ^= k[8*(i)+ 5]; \
+ ss[6] ^= ss[5]; k[8*(i)+14] = g ^= k[8*(i)+ 6]; \
+ ss[7] ^= ss[6]; k[8*(i)+15] = g ^= k[8*(i)+ 7]; \
+}
+#define kdl8(k,i) \
+{ ss[0] ^= ls_box(ss[7],3) ^ rcon_tab[i]; k[8*(i)+ 8] = ss[0]; ss[1] ^= ss[0]; k[8*(i)+ 9] = ss[1]; \
+ ss[2] ^= ss[1]; k[8*(i)+10] = ss[2]; ss[3] ^= ss[2]; k[8*(i)+11] = ss[3]; \
+}
+
+static aes_rval aes_dec_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1])
+{ aes_32t ss[8];
+ d_vars
+
+#if !defined(FIXED_TABLES)
+ if(!tab_init) gen_tabs();
+#endif
+
+#if !defined(BLOCK_SIZE)
+ if(!cx->n_blk) cx->n_blk = 16;
+#else
+ cx->n_blk = BLOCK_SIZE;
+#endif
+
+ cx->n_blk = (cx->n_blk & ~3) | 2;
+
+ cx->k_sch[0] = ss[0] = word_in(in_key );
+ cx->k_sch[1] = ss[1] = word_in(in_key + 4);
+ cx->k_sch[2] = ss[2] = word_in(in_key + 8);
+ cx->k_sch[3] = ss[3] = word_in(in_key + 12);
+
+#if (BLOCK_SIZE == 16) && (DEC_UNROLL != NONE)
+
+ switch(klen)
+ {
+ case 16: kdf4(cx->k_sch, 0); kd4(cx->k_sch, 1);
+ kd4(cx->k_sch, 2); kd4(cx->k_sch, 3);
+ kd4(cx->k_sch, 4); kd4(cx->k_sch, 5);
+ kd4(cx->k_sch, 6); kd4(cx->k_sch, 7);
+ kd4(cx->k_sch, 8); kdl4(cx->k_sch, 9);
+ cx->n_rnd = 10; break;
+ case 24: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
+ cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
+ kdf6(cx->k_sch, 0); kd6(cx->k_sch, 1);
+ kd6(cx->k_sch, 2); kd6(cx->k_sch, 3);
+ kd6(cx->k_sch, 4); kd6(cx->k_sch, 5);
+ kd6(cx->k_sch, 6); kdl6(cx->k_sch, 7);
+ cx->n_rnd = 12; break;
+ case 32: cx->k_sch[4] = ff(ss[4] = word_in(in_key + 16));
+ cx->k_sch[5] = ff(ss[5] = word_in(in_key + 20));
+ cx->k_sch[6] = ff(ss[6] = word_in(in_key + 24));
+ cx->k_sch[7] = ff(ss[7] = word_in(in_key + 28));
+ kdf8(cx->k_sch, 0); kd8(cx->k_sch, 1);
+ kd8(cx->k_sch, 2); kd8(cx->k_sch, 3);
+ kd8(cx->k_sch, 4); kd8(cx->k_sch, 5);
+ kdl8(cx->k_sch, 6);
+ cx->n_rnd = 14; break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+#else
+ { aes_32t i, l;
+ cx->n_rnd = ((klen >> 2) > nc ? (klen >> 2) : nc) + 6;
+ l = (nc * cx->n_rnd + nc - 1) / (klen >> 2);
+
+ switch(klen)
+ {
+ case 16:
+ for(i = 0; i < l; ++i)
+ ke4(cx->k_sch, i);
+ break;
+ case 24: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ for(i = 0; i < l; ++i)
+ ke6(cx->k_sch, i);
+ break;
+ case 32: cx->k_sch[4] = ss[4] = word_in(in_key + 16);
+ cx->k_sch[5] = ss[5] = word_in(in_key + 20);
+ cx->k_sch[6] = ss[6] = word_in(in_key + 24);
+ cx->k_sch[7] = ss[7] = word_in(in_key + 28);
+ for(i = 0; i < l; ++i)
+ ke8(cx->k_sch, i);
+ break;
+ default: cx->n_rnd = 0; return aes_bad;
+ }
+#if (DEC_ROUND != NO_TABLES)
+ for(i = nc; i < nc * cx->n_rnd; ++i)
+ cx->k_sch[i] = inv_mcol(cx->k_sch[i]);
+#endif
+ }
+#endif
+
+ return aes_good;
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| cipher
++---------------------------------------------------------------------*/
+#define unused 77 /* Sunset Strip */
+
+#define si(y,x,k,c) s(y,c) = word_in(x + 4 * c) ^ k[c]
+#define so(y,x,c) word_out(y + 4 * c, s(x,c))
+
+#if BLOCK_SIZE == 16
+
+#if defined(ARRAYS)
+#define locals(y,x) x[4],y[4]
+#else
+#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3
+ /*
+ the following defines prevent the compiler requiring the declaration
+ of generated but unused variables in the fwd_var and inv_var macros
+ */
+#define b04 unused
+#define b05 unused
+#define b06 unused
+#define b07 unused
+#define b14 unused
+#define b15 unused
+#define b16 unused
+#define b17 unused
+#endif
+#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
+ s(y,2) = s(x,2); s(y,3) = s(x,3);
+#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3)
+#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3)
+#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3)
+
+#elif BLOCK_SIZE == 24
+
+#if defined(ARRAYS)
+#define locals(y,x) x[6],y[6]
+#else
+#define locals(y,x) x##0,x##1,x##2,x##3,x##4,x##5, \
+ y##0,y##1,y##2,y##3,y##4,y##5
+#define b06 unused
+#define b07 unused
+#define b16 unused
+#define b17 unused
+#endif
+#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
+ s(y,2) = s(x,2); s(y,3) = s(x,3); \
+ s(y,4) = s(x,4); s(y,5) = s(x,5);
+#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); \
+ si(y,x,k,3); si(y,x,k,4); si(y,x,k,5)
+#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); \
+ so(y,x,3); so(y,x,4); so(y,x,5)
+#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); \
+ rm(y,x,k,3); rm(y,x,k,4); rm(y,x,k,5)
+#else
+
+#if defined(ARRAYS)
+#define locals(y,x) x[8],y[8]
+#else
+#define locals(y,x) x##0,x##1,x##2,x##3,x##4,x##5,x##6,x##7, \
+ y##0,y##1,y##2,y##3,y##4,y##5,y##6,y##7
+#endif
+#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
+ s(y,2) = s(x,2); s(y,3) = s(x,3); \
+ s(y,4) = s(x,4); s(y,5) = s(x,5); \
+ s(y,6) = s(x,6); s(y,7) = s(x,7);
+
+#if BLOCK_SIZE == 32
+
+#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3); \
+ si(y,x,k,4); si(y,x,k,5); si(y,x,k,6); si(y,x,k,7)
+#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3); \
+ so(y,x,4); so(y,x,5); so(y,x,6); so(y,x,7)
+#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3); \
+ rm(y,x,k,4); rm(y,x,k,5); rm(y,x,k,6); rm(y,x,k,7)
+#else
+
+#define state_in(y,x,k) \
+switch(nc) \
+{ case 8: si(y,x,k,7); si(y,x,k,6); \
+ case 6: si(y,x,k,5); si(y,x,k,4); \
+ case 4: si(y,x,k,3); si(y,x,k,2); \
+ si(y,x,k,1); si(y,x,k,0); \
+}
+
+#define state_out(y,x) \
+switch(nc) \
+{ case 8: so(y,x,7); so(y,x,6); \
+ case 6: so(y,x,5); so(y,x,4); \
+ case 4: so(y,x,3); so(y,x,2); \
+ so(y,x,1); so(y,x,0); \
+}
+
+#if defined(FAST_VARIABLE)
+
+#define round(rm,y,x,k) \
+switch(nc) \
+{ case 8: rm(y,x,k,7); rm(y,x,k,6); \
+ rm(y,x,k,5); rm(y,x,k,4); \
+ rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+ break; \
+ case 6: rm(y,x,k,5); rm(y,x,k,4); \
+ rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+ break; \
+ case 4: rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+ break; \
+}
+#else
+
+#define round(rm,y,x,k) \
+switch(nc) \
+{ case 8: rm(y,x,k,7); rm(y,x,k,6); \
+ case 6: rm(y,x,k,5); rm(y,x,k,4); \
+ case 4: rm(y,x,k,3); rm(y,x,k,2); \
+ rm(y,x,k,1); rm(y,x,k,0); \
+}
+
+#endif
+
+#endif
+#endif
+
+#if defined(ENCRYPTION)
+
+/* I am grateful to Frank Yellin for the following construction
+ (and that for decryption) which, given the column (c) of the
+ output state variable, gives the input state variables which
+ are needed in its computation for each row (r) of the state.
+
+ For the fixed block size options, compilers should be able to
+ reduce this complex expression (and the equivalent one for
+ decryption) to a static variable reference at compile time.
+ But for variable block size code, there will be some limbs on
+ which conditional clauses will be returned.
+*/
+
+/* y = output word, x = input word, r = row, c = column for r = 0,
+ 1, 2 and 3 = column accessed for row r.
+*/
+
+#define fwd_var(x,r,c)\
+ ( r == 0 ? \
+ ( c == 0 ? s(x,0) \
+ : c == 1 ? s(x,1) \
+ : c == 2 ? s(x,2) \
+ : c == 3 ? s(x,3) \
+ : c == 4 ? s(x,4) \
+ : c == 5 ? s(x,5) \
+ : c == 6 ? s(x,6) \
+ : s(x,7))\
+ : r == 1 ? \
+ ( c == 0 ? s(x,1) \
+ : c == 1 ? s(x,2) \
+ : c == 2 ? s(x,3) \
+ : c == 3 ? nc == 4 ? s(x,0) : s(x,4) \
+ : c == 4 ? s(x,5) \
+ : c == 5 ? nc == 8 ? s(x,6) : s(x,0) \
+ : c == 6 ? s(x,7) \
+ : s(x,0))\
+ : r == 2 ? \
+ ( c == 0 ? nc == 8 ? s(x,3) : s(x,2) \
+ : c == 1 ? nc == 8 ? s(x,4) : s(x,3) \
+ : c == 2 ? nc == 4 ? s(x,0) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 3 ? nc == 4 ? s(x,1) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 4 ? nc == 8 ? s(x,7) : s(x,0) \
+ : c == 5 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 6 ? s(x,1) \
+ : s(x,2))\
+ : \
+ ( c == 0 ? nc == 8 ? s(x,4) : s(x,3) \
+ : c == 1 ? nc == 4 ? s(x,0) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 2 ? nc == 4 ? s(x,1) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 3 ? nc == 4 ? s(x,2) : nc == 8 ? s(x,7) : s(x,0) \
+ : c == 4 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 5 ? nc == 8 ? s(x,1) : s(x,2) \
+ : c == 6 ? s(x,2) \
+ : s(x,3)))
+
+#if defined(FT4_SET)
+#undef dec_fmvars
+#define dec_fmvars
+#define fwd_rnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,ft_tab,fwd_var,rf1,c)
+#elif defined(FT1_SET)
+#undef dec_fmvars
+#define dec_fmvars
+#define fwd_rnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,upr,ft_tab,fwd_var,rf1,c)
+#else
+#define fwd_rnd(y,x,k,c) s(y,c) = fwd_mcol(no_table(x,s_box,fwd_var,rf1,c)) ^ (k)[c]
+#endif
+
+#if defined(FL4_SET)
+#define fwd_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,fl_tab,fwd_var,rf1,c)
+#elif defined(FL1_SET)
+#define fwd_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,ups,fl_tab,fwd_var,rf1,c)
+#else
+#define fwd_lrnd(y,x,k,c) s(y,c) = no_table(x,s_box,fwd_var,rf1,c) ^ (k)[c]
+#endif
+
+static aes_rval aes_enc_blk(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1])
+{ aes_32t locals(b0, b1);
+ const aes_32t *kp = cx->k_sch;
+ dec_fmvars /* declare variables for fwd_mcol() if needed */
+
+ if(!(cx->n_blk & 1)) return aes_bad;
+
+ state_in(b0, in_blk, kp);
+
+#if (ENC_UNROLL == FULL)
+
+ kp += (cx->n_rnd - 9) * nc;
+
+ switch(cx->n_rnd)
+ {
+ case 14: round(fwd_rnd, b1, b0, kp - 4 * nc);
+ round(fwd_rnd, b0, b1, kp - 3 * nc);
+ case 12: round(fwd_rnd, b1, b0, kp - 2 * nc);
+ round(fwd_rnd, b0, b1, kp - nc);
+ case 10: round(fwd_rnd, b1, b0, kp );
+ round(fwd_rnd, b0, b1, kp + nc);
+ round(fwd_rnd, b1, b0, kp + 2 * nc);
+ round(fwd_rnd, b0, b1, kp + 3 * nc);
+ round(fwd_rnd, b1, b0, kp + 4 * nc);
+ round(fwd_rnd, b0, b1, kp + 5 * nc);
+ round(fwd_rnd, b1, b0, kp + 6 * nc);
+ round(fwd_rnd, b0, b1, kp + 7 * nc);
+ round(fwd_rnd, b1, b0, kp + 8 * nc);
+ round(fwd_lrnd, b0, b1, kp + 9 * nc);
+ }
+#else
+
+#if (ENC_UNROLL == PARTIAL)
+ { aes_32t rnd;
+ for(rnd = 0; rnd < (cx->n_rnd >> 1) - 1; ++rnd)
+ {
+ kp += nc;
+ round(fwd_rnd, b1, b0, kp);
+ kp += nc;
+ round(fwd_rnd, b0, b1, kp);
+ }
+ kp += nc;
+ round(fwd_rnd, b1, b0, kp);
+#else
+ { aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
+ for(rnd = 0; rnd < cx->n_rnd - 1; ++rnd)
+ {
+ kp += nc;
+ round(fwd_rnd, p1, p0, kp);
+ pt = p0, p0 = p1, p1 = pt;
+ }
+#endif
+ kp += nc;
+ round(fwd_lrnd, b0, b1, kp);
+ }
+#endif
+
+ state_out(out_blk, b0);
+ return aes_good;
+}
+
+#endif
+
+#if defined(DECRYPTION)
+
+#define inv_var(x,r,c) \
+ ( r == 0 ? \
+ ( c == 0 ? s(x,0) \
+ : c == 1 ? s(x,1) \
+ : c == 2 ? s(x,2) \
+ : c == 3 ? s(x,3) \
+ : c == 4 ? s(x,4) \
+ : c == 5 ? s(x,5) \
+ : c == 6 ? s(x,6) \
+ : s(x,7))\
+ : r == 1 ? \
+ ( c == 0 ? nc == 4 ? s(x,3) : nc == 8 ? s(x,7) : s(x,5) \
+ : c == 1 ? s(x,0) \
+ : c == 2 ? s(x,1) \
+ : c == 3 ? s(x,2) \
+ : c == 4 ? s(x,3) \
+ : c == 5 ? s(x,4) \
+ : c == 6 ? s(x,5) \
+ : s(x,6))\
+ : r == 2 ? \
+ ( c == 0 ? nc == 4 ? s(x,2) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 1 ? nc == 4 ? s(x,3) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 2 ? nc == 8 ? s(x,7) : s(x,0) \
+ : c == 3 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 4 ? nc == 8 ? s(x,1) : s(x,2) \
+ : c == 5 ? nc == 8 ? s(x,2) : s(x,3) \
+ : c == 6 ? s(x,3) \
+ : s(x,4))\
+ : \
+ ( c == 0 ? nc == 4 ? s(x,1) : nc == 8 ? s(x,4) : s(x,3) \
+ : c == 1 ? nc == 4 ? s(x,2) : nc == 8 ? s(x,5) : s(x,4) \
+ : c == 2 ? nc == 4 ? s(x,3) : nc == 8 ? s(x,6) : s(x,5) \
+ : c == 3 ? nc == 8 ? s(x,7) : s(x,0) \
+ : c == 4 ? nc == 8 ? s(x,0) : s(x,1) \
+ : c == 5 ? nc == 8 ? s(x,1) : s(x,2) \
+ : c == 6 ? s(x,2) \
+ : s(x,3)))
+
+#if defined(IT4_SET)
+#undef dec_imvars
+#define dec_imvars
+#define inv_rnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,it_tab,inv_var,rf1,c)
+#elif defined(IT1_SET)
+#undef dec_imvars
+#define dec_imvars
+#define inv_rnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,upr,it_tab,inv_var,rf1,c)
+#else
+#define inv_rnd(y,x,k,c) s(y,c) = inv_mcol(no_table(x,inv_s_box,inv_var,rf1,c) ^ (k)[c])
+#endif
+
+#if defined(IL4_SET)
+#define inv_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ four_tables(x,il_tab,inv_var,rf1,c)
+#elif defined(IL1_SET)
+#define inv_lrnd(y,x,k,c) s(y,c)= (k)[c] ^ one_table(x,ups,il_tab,inv_var,rf1,c)
+#else
+#define inv_lrnd(y,x,k,c) s(y,c) = no_table(x,inv_s_box,inv_var,rf1,c) ^ (k)[c]
+#endif
+
+static aes_rval aes_dec_blk(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1])
+{ aes_32t locals(b0, b1);
+ const aes_32t *kp = cx->k_sch + nc * cx->n_rnd;
+ dec_imvars /* declare variables for inv_mcol() if needed */
+
+ if(!(cx->n_blk & 2)) return aes_bad;
+
+ state_in(b0, in_blk, kp);
+
+#if (DEC_UNROLL == FULL)
+
+ kp = cx->k_sch + 9 * nc;
+ switch(cx->n_rnd)
+ {
+ case 14: round(inv_rnd, b1, b0, kp + 4 * nc);
+ round(inv_rnd, b0, b1, kp + 3 * nc);
+ case 12: round(inv_rnd, b1, b0, kp + 2 * nc);
+ round(inv_rnd, b0, b1, kp + nc );
+ case 10: round(inv_rnd, b1, b0, kp );
+ round(inv_rnd, b0, b1, kp - nc);
+ round(inv_rnd, b1, b0, kp - 2 * nc);
+ round(inv_rnd, b0, b1, kp - 3 * nc);
+ round(inv_rnd, b1, b0, kp - 4 * nc);
+ round(inv_rnd, b0, b1, kp - 5 * nc);
+ round(inv_rnd, b1, b0, kp - 6 * nc);
+ round(inv_rnd, b0, b1, kp - 7 * nc);
+ round(inv_rnd, b1, b0, kp - 8 * nc);
+ round(inv_lrnd, b0, b1, kp - 9 * nc);
+ }
+#else
+
+#if (DEC_UNROLL == PARTIAL)
+ { aes_32t rnd;
+ for(rnd = 0; rnd < (cx->n_rnd >> 1) - 1; ++rnd)
+ {
+ kp -= nc;
+ round(inv_rnd, b1, b0, kp);
+ kp -= nc;
+ round(inv_rnd, b0, b1, kp);
+ }
+ kp -= nc;
+ round(inv_rnd, b1, b0, kp);
+#else
+ { aes_32t rnd, *p0 = b0, *p1 = b1, *pt;
+ for(rnd = 0; rnd < cx->n_rnd - 1; ++rnd)
+ {
+ kp -= nc;
+ round(inv_rnd, p1, p0, kp);
+ pt = p0, p0 = p1, p1 = pt;
+ }
+#endif
+ kp -= nc;
+ round(inv_lrnd, b0, b1, kp);
+ }
+#endif
+
+ state_out(out_blk, b0);
+ return aes_good;
+}
+
+#endif
+
+/*----------------------------------------------------------------------
+| AP4_AesBlockCipher::AP4_AesBlockCipher
++---------------------------------------------------------------------*/
+AP4_AesBlockCipher::AP4_AesBlockCipher(const AP4_UI08* key)
+{
+ aes_enc_key(key, AP4_AES_KEY_LENGTH, &m_Context);
+}
+
+/*----------------------------------------------------------------------
+| AP4_AesBlockCipher::~AP4_AesBlockCipher
++---------------------------------------------------------------------*/
+AP4_AesBlockCipher::~AP4_AesBlockCipher()
+{
+}
+
+/*----------------------------------------------------------------------
+| AP4_AesCipher::EncryptBlock
++---------------------------------------------------------------------*/
+AP4_Result
+AP4_AesBlockCipher::EncryptBlock(const AP4_UI08* block_in, AP4_UI08* block_out)
+{
+ aes_rval result;
+ result = aes_enc_blk(block_in, block_out, &m_Context);
+ return result == aes_good ? AP4_SUCCESS : AP4_FAILURE;
+}
+
diff --git a/src/filters/parser/mp4splitter/Ap4AsyncReaderStream.cpp b/src/filters/parser/mp4splitter/Ap4AsyncReaderStream.cpp
new file mode 100644
index 000000000..bd1144d1b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/Ap4AsyncReaderStream.cpp
@@ -0,0 +1,74 @@
+#include "StdAfx.h"
+#include "Ap4AsyncReaderStream.h"
+
+AP4_AsyncReaderStream::AP4_AsyncReaderStream(CBaseSplitterFile* pFile)
+ : m_refs(1)
+ , m_pFile(pFile)
+{
+ ASSERT(pFile);
+}
+
+AP4_AsyncReaderStream::~AP4_AsyncReaderStream()
+{
+ ASSERT(m_refs == 0);
+}
+
+void AP4_AsyncReaderStream::AddReference()
+{
+ ASSERT(m_refs > 0);
+ ++m_refs;
+}
+
+void AP4_AsyncReaderStream::Release()
+{
+ ASSERT(m_refs > 0);
+ if(--m_refs == 0) delete this;
+}
+
+AP4_Result AP4_AsyncReaderStream::Read(void* buffer, AP4_Size bytesToRead, AP4_Size* bytesRead)
+{
+ AP4_Size bytesAvail = (AP4_Size)(m_pFile->GetLength() - m_pFile->GetPos());
+
+ if(bytesAvail < bytesToRead)
+ {
+ if(bytesRead) *bytesRead = bytesAvail;
+ bytesToRead = bytesAvail;
+ }
+
+ if(bytesAvail == 0)
+ {
+ return AP4_ERROR_EOS;
+ }
+
+ if(FAILED(m_pFile->ByteRead((BYTE*)buffer, bytesToRead)))
+ {
+ if(bytesRead) *bytesRead = 0;
+ return AP4_ERROR_READ_FAILED;
+ }
+
+ if(bytesRead) *bytesRead = bytesToRead;
+ return AP4_SUCCESS;
+}
+
+AP4_Result AP4_AsyncReaderStream::Write(const void* buffer, AP4_Size bytesToWrite, AP4_Size* bytesWritten)
+{
+ return AP4_ERROR_WRITE_FAILED;
+}
+
+AP4_Result AP4_AsyncReaderStream::Seek(AP4_Offset offset)
+{
+ m_pFile->Seek(offset);
+ return m_pFile->GetPos() == offset ? AP4_SUCCESS : AP4_FAILURE;
+}
+
+AP4_Result AP4_AsyncReaderStream::Tell(AP4_Offset& offset)
+{
+ offset = (AP4_Offset)m_pFile->GetPos();
+ return AP4_SUCCESS;
+}
+
+AP4_Result AP4_AsyncReaderStream::GetSize(AP4_Size& size)
+{
+ size = (AP4_Size)m_pFile->GetLength();
+ return AP4_SUCCESS;
+} \ No newline at end of file
diff --git a/src/filters/parser/mp4splitter/Ap4AsyncReaderStream.h b/src/filters/parser/mp4splitter/Ap4AsyncReaderStream.h
new file mode 100644
index 000000000..3ac34e4ad
--- /dev/null
+++ b/src/filters/parser/mp4splitter/Ap4AsyncReaderStream.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+
+#include "Ap4.h"
+#include "Ap4File.h"
+//#include "Ap4Utils.h"
+//#include "Ap4Sample.h"
+#include "Ap4ByteStream.h"
+//#include "Ap4SampleEntry.h"
+//#include "Ap4IsmaCryp.h"
+//#include "Ap4AvcCAtom.h"
+//#include "Ap4FtabAtom.h"
+//#include "Ap4MdhdAtom.h"
+//#include "Ap4HdlrAtom.h"
+
+class AP4_AsyncReaderStream : public AP4_ByteStream
+{
+ int m_refs;
+ CBaseSplitterFile* m_pFile;
+
+public:
+ AP4_AsyncReaderStream(CBaseSplitterFile* pFile);
+ virtual ~AP4_AsyncReaderStream();
+
+ void AddReference();
+ void Release();
+
+ AP4_Result Read(void* buffer, AP4_Size bytesToRead, AP4_Size* bytesRead);
+ AP4_Result Write(const void* buffer, AP4_Size bytesToWrite, AP4_Size* bytesWritten);
+ AP4_Result Seek(AP4_Offset offset);
+ AP4_Result Tell(AP4_Offset& offset);
+ AP4_Result GetSize(AP4_Size& size);
+}; \ No newline at end of file
diff --git a/src/filters/parser/mp4splitter/MP4Splitter.cpp b/src/filters/parser/mp4splitter/MP4Splitter.cpp
new file mode 100644
index 000000000..01ccf03eb
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4Splitter.cpp
@@ -0,0 +1,1307 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "Mmreg.h"
+#include "MP4Splitter.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#include "Ap4.h"
+#include "Ap4File.h"
+#include "Ap4StssAtom.h"
+#include "Ap4StsdAtom.h"
+#include "Ap4IsmaCryp.h"
+#include "Ap4AvcCAtom.h"
+#include "Ap4ChplAtom.h"
+#include "Ap4FtabAtom.h"
+#include "Ap4DataAtom.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MP4},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CMP4SplitterFilter), L"MP4 Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins},
+ {&__uuidof(CMP4SourceFilter), L"MP4 Source", MERIT_NORMAL, 0, NULL},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMP4SplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMP4SourceFilter>, NULL, &sudFilter[1]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".mp4"));
+ DeleteRegKey(_T("Media Type\\Extensions\\"), _T(".mov"));
+
+ CAtlList<CString> chkbytes;
+
+ chkbytes.AddTail(_T("4,4,,66747970")); // ftyp
+ chkbytes.AddTail(_T("4,4,,6d6f6f76")); // moov
+ chkbytes.AddTail(_T("4,4,,6d646174")); // mdat
+ chkbytes.AddTail(_T("4,4,,736b6970")); // skip
+ chkbytes.AddTail(_T("4,12,ffffffff00000000ffffffff,77696465027fe3706d646174")); // wide ? mdat
+
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MP4, chkbytes, NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ UnRegisterSourceFilter(MEDIASUBTYPE_MP4);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CMP4SplitterFilter
+//
+
+CMP4SplitterFilter::CMP4SplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("CMP4SplitterFilter"), pUnk, phr, __uuidof(this))
+{
+}
+
+CMP4SplitterFilter::~CMP4SplitterFilter()
+{
+}
+
+HRESULT CMP4SplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_trackpos.RemoveAll();
+
+ m_pFile.Free();
+ m_pFile.Attach(new CMP4SplitterFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ m_framesize.SetSize(640, 480);
+
+ if(AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie())
+ {
+ for(AP4_List<AP4_Track>::Item* item = movie->GetTracks().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ AP4_Track* track = item->GetData();
+
+ if(track->GetType() != AP4_Track::TYPE_VIDEO
+ && track->GetType() != AP4_Track::TYPE_AUDIO
+ && track->GetType() != AP4_Track::TYPE_TEXT
+ && track->GetType() != AP4_Track::TYPE_SUBP)
+ continue;
+
+ AP4_Sample sample;
+
+ if(!AP4_SUCCEEDED(track->GetSample(0, sample)) || sample.GetDescriptionIndex() == 0xFFFFFFFF)
+ continue;
+
+ CStringW TrackName = UTF8To16(track->GetTrackName().c_str());
+ CStringA TrackLanguage = track->GetTrackLanguage().c_str();
+
+ CAtlArray<CMediaType> mts;
+
+ CMediaType mt;
+ mt.SetSampleSize(1);
+
+ VIDEOINFOHEADER* vih = NULL;
+ WAVEFORMATEX* wfe = NULL;
+
+ AP4_DataBuffer empty;
+
+ if(AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex()))
+ {
+ AP4_MpegSampleDescription* mpeg_desc = NULL;
+
+ if(desc->GetType() == AP4_SampleDescription::TYPE_MPEG)
+ {
+ mpeg_desc = dynamic_cast<AP4_MpegSampleDescription*>(desc);
+ }
+ else if(desc->GetType() == AP4_SampleDescription::TYPE_ISMACRYP)
+ {
+ AP4_IsmaCrypSampleDescription* isma_desc = dynamic_cast<AP4_IsmaCrypSampleDescription*>(desc);
+ mpeg_desc = isma_desc->GetOriginalSampleDescription();
+ }
+
+ if(AP4_MpegVideoSampleDescription* video_desc =
+ dynamic_cast<AP4_MpegVideoSampleDescription*>(mpeg_desc))
+ {
+ const AP4_DataBuffer* di = video_desc->GetDecoderInfo();
+ if(!di) di = &empty;
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.formattype = FORMAT_VideoInfo;
+ vih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + di->GetDataSize());
+ memset(vih, 0, mt.FormatLength());
+ vih->dwBitRate = video_desc->GetAvgBitrate()/8;
+ vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
+ vih->bmiHeader.biWidth = (LONG)video_desc->GetWidth();
+ vih->bmiHeader.biHeight = (LONG)video_desc->GetHeight();
+ memcpy(vih + 1, di->GetData(), di->GetDataSize());
+
+ switch(video_desc->GetObjectTypeId())
+ {
+ case AP4_MPEG4_VISUAL_OTI:
+ mt.subtype = FOURCCMap('v4pm');
+ mt.formattype = FORMAT_MPEG2Video;
+ {
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + di->GetDataSize());
+ memset(vih, 0, mt.FormatLength());
+ vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
+ vih->hdr.bmiHeader.biWidth = (LONG)video_desc->GetWidth();
+ vih->hdr.bmiHeader.biHeight = (LONG)video_desc->GetHeight();
+ vih->hdr.bmiHeader.biCompression = 'v4pm';
+ vih->hdr.bmiHeader.biPlanes = 1;
+ vih->hdr.bmiHeader.biBitCount = 24;
+ vih->hdr.dwPictAspectRatioX = vih->hdr.bmiHeader.biWidth;
+ vih->hdr.dwPictAspectRatioY = vih->hdr.bmiHeader.biHeight;
+ vih->cbSequenceHeader = di->GetDataSize();
+ memcpy(vih->dwSequenceHeader, di->GetData(), di->GetDataSize());
+ mts.Add(mt);
+ mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = 'V4PM');
+ mts.Add(mt);
+ }
+ break;
+ case AP4_MPEG2_VISUAL_SIMPLE_OTI:
+ case AP4_MPEG2_VISUAL_MAIN_OTI:
+ case AP4_MPEG2_VISUAL_SNR_OTI:
+ case AP4_MPEG2_VISUAL_SPATIAL_OTI:
+ case AP4_MPEG2_VISUAL_HIGH_OTI:
+ case AP4_MPEG2_VISUAL_422_OTI:
+ mt.subtype = MEDIASUBTYPE_MPEG2_VIDEO;
+ {
+ m_pFile->Seek(sample.GetOffset());
+ CBaseSplitterFileEx::seqhdr h;
+ CMediaType mt2;
+ if(m_pFile->Read(h, sample.GetSize(), &mt2))
+ mt = mt2;
+ }
+ mts.Add(mt);
+ break;
+ case AP4_MPEG1_VISUAL_OTI: // ???
+ mt.subtype = MEDIASUBTYPE_MPEG1Payload;
+ {
+ m_pFile->Seek(sample.GetOffset());
+ CBaseSplitterFileEx::seqhdr h;
+ CMediaType mt2;
+ if(m_pFile->Read(h, sample.GetSize(), &mt2))
+ mt = mt2;
+ }
+ mts.Add(mt);
+ break;
+ }
+
+ if(mt.subtype == GUID_NULL)
+ {
+ TRACE(_T("Unknown video OBI: %02x\n"), video_desc->GetObjectTypeId());
+ }
+ }
+ else if(AP4_MpegAudioSampleDescription* audio_desc =
+ dynamic_cast<AP4_MpegAudioSampleDescription*>(mpeg_desc))
+ {
+ const AP4_DataBuffer* di = audio_desc->GetDecoderInfo();
+ if(!di) di = &empty;
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.formattype = FORMAT_WaveFormatEx;
+
+ wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + di->GetDataSize());
+ memset(wfe, 0, mt.FormatLength());
+ wfe->nSamplesPerSec = audio_desc->GetSampleRate();
+ wfe->nAvgBytesPerSec = audio_desc->GetAvgBitrate()/8;
+ wfe->nChannels = audio_desc->GetChannelCount();
+ wfe->wBitsPerSample = audio_desc->GetSampleSize();
+ wfe->cbSize = (WORD)di->GetDataSize();
+ memcpy(wfe + 1, di->GetData(), di->GetDataSize());
+
+ switch(audio_desc->GetObjectTypeId())
+ {
+ case AP4_MPEG4_AUDIO_OTI:
+ case AP4_MPEG2_AAC_AUDIO_MAIN_OTI: // ???
+ case AP4_MPEG2_AAC_AUDIO_LC_OTI: // ???
+ case AP4_MPEG2_AAC_AUDIO_SSRP_OTI: // ???
+ mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_AAC);
+ if(wfe->cbSize >= 2) wfe->nChannels = (((BYTE*)(wfe+1))[1]>>3) & 0xf;
+ mts.Add(mt);
+ break;
+ case AP4_MPEG2_PART3_AUDIO_OTI: // ???
+ break;
+ case AP4_MPEG1_AUDIO_OTI:
+ mt.subtype = FOURCCMap(wfe->wFormatTag = WAVE_FORMAT_MP3);
+ {
+ m_pFile->Seek(sample.GetOffset());
+ CBaseSplitterFileEx::mpahdr h;
+ CMediaType mt2;
+ if(m_pFile->Read(h, sample.GetSize(), false, &mt2))
+ mt = mt2;
+ }
+ mts.Add(mt);
+ break;
+ }
+
+ if(mt.subtype == GUID_NULL)
+ {
+ TRACE(_T("Unknown audio OBI: %02x\n"), audio_desc->GetObjectTypeId());
+ }
+ }
+ else if(AP4_MpegSystemSampleDescription* system_desc =
+ dynamic_cast<AP4_MpegSystemSampleDescription*>(desc))
+ {
+ const AP4_DataBuffer* di = system_desc->GetDecoderInfo();
+ if(!di) di = &empty;
+
+ switch(system_desc->GetObjectTypeId())
+ {
+ case AP4_NERO_VOBSUB:
+ if(di->GetDataSize() >= 16*4)
+ {
+ CSize size(720, 576);
+ if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD)))
+ {
+ size.cx = tkhd->GetWidth()>>16;
+ size.cy = tkhd->GetHeight()>>16;
+ }
+
+ const AP4_Byte* pal = di->GetData();
+ CAtlList<CStringA> sl;
+ for(int i = 0; i < 16*4; i += 4)
+ {
+ BYTE y = (pal[i+1]-16)*255/219;
+ BYTE u = pal[i+2];
+ BYTE v = pal[i+3];
+ BYTE r = (BYTE)min(max(1.0*y + 1.4022*(u-128), 0), 255);
+ BYTE g = (BYTE)min(max(1.0*y - 0.3456*(u-128) - 0.7145*(v-128), 0), 255);
+ BYTE b = (BYTE)min(max(1.0*y + 1.7710*(v-128), 0) , 255);
+ CStringA str;
+ str.Format("%02x%02x%02x", r, g, b);
+ sl.AddTail(str);
+ }
+
+ CStringA hdr;
+ hdr.Format(
+ "# VobSub index file, v7 (do not modify this line!)\n"
+ "size: %dx%d\n"
+ "palette: %s\n",
+ size.cx, size.cy,
+ Implode(sl, ','));
+
+ mt.majortype = MEDIATYPE_Subtitle;
+ mt.subtype = MEDIASUBTYPE_VOBSUB;
+ mt.formattype = FORMAT_SubtitleInfo;
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + hdr.GetLength());
+ memset(si, 0, mt.FormatLength());
+ si->dwOffset = sizeof(SUBTITLEINFO);
+ strcpy(si->IsoLang, CStringA(TrackLanguage));
+ wcscpy(si->TrackName, TrackName);
+ memcpy(si + 1, (LPCSTR)hdr, hdr.GetLength());
+ mts.Add(mt);
+ }
+ break;
+ }
+
+ if(mt.subtype == GUID_NULL)
+ {
+ TRACE(_T("Unknown audio OBI: %02x\n"), system_desc->GetObjectTypeId());
+ }
+ }
+ else if(AP4_UnknownSampleDescription* unknown_desc =
+ dynamic_cast<AP4_UnknownSampleDescription*>(desc)) // TEMP
+ {
+ AP4_SampleEntry* sample_entry = unknown_desc->GetSampleEntry();
+
+ if(dynamic_cast<AP4_TextSampleEntry*>(sample_entry)
+ || dynamic_cast<AP4_Tx3gSampleEntry*>(sample_entry))
+ {
+ mt.majortype = MEDIATYPE_Subtitle;
+ mt.subtype = MEDIASUBTYPE_ASS2;
+ mt.formattype = FORMAT_SubtitleInfo;
+ CStringA hdr;
+ hdr.Format(
+ "[Script Info]\n"
+ "ScriptType: v4.00++\n"
+ "ScaledBorderAndShadow: yes\n"
+ "PlayResX: %d\n"
+ "PlayResY: %d\n"
+ "[V4++ Styles]\n"
+ "Style: Text,Arial,12,&H00ffffff,&H0000ffff,&H00000000,&H80000000,0,0,0,0,100,100,0,0.00,3,0,0,2,0,0,0,0,1,1\n",
+ // "Style: Text,Arial,12,&H00ffffff,&H0000ffff,&H00000000,&H80000000,0,0,0,0,100,100,0,0.00,1,0,0,2,0,0,0,0,1,1\n",
+ m_framesize.cx,
+ m_framesize.cy);
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mt.AllocFormatBuffer(sizeof(SUBTITLEINFO) + hdr.GetLength());
+ memset(si, 0, mt.FormatLength());
+ si->dwOffset = sizeof(SUBTITLEINFO);
+ strcpy(si->IsoLang, CStringA(TrackLanguage));
+ wcscpy(si->TrackName, TrackName);
+ memcpy(si + 1, (LPCSTR)hdr, hdr.GetLength());
+ mts.Add(mt);
+ }
+ }
+ }
+ else if(AP4_Avc1SampleEntry* avc1 = dynamic_cast<AP4_Avc1SampleEntry*>(
+ track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd/avc1")))
+ {
+ if(AP4_AvcCAtom* avcC = dynamic_cast<AP4_AvcCAtom*>(avc1->GetChild(AP4_ATOM_TYPE_AVCC)))
+ {
+ const AP4_DataBuffer* di = avcC->GetDecoderInfo();
+ if(!di) di = &empty;
+
+ const AP4_Byte* data = di->GetData();
+ AP4_Size size = di->GetDataSize();
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap('1cva');
+ mt.formattype = FORMAT_MPEG2Video;
+
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mt.AllocFormatBuffer(FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader) + size - 7);
+ memset(vih, 0, mt.FormatLength());
+ vih->hdr.bmiHeader.biSize = sizeof(vih->hdr.bmiHeader);
+ vih->hdr.bmiHeader.biWidth = (LONG)avc1->GetWidth();
+ vih->hdr.bmiHeader.biHeight = (LONG)avc1->GetHeight();
+ vih->hdr.bmiHeader.biCompression = '1cva';
+ vih->hdr.bmiHeader.biPlanes = 1;
+ vih->hdr.bmiHeader.biBitCount = 24;
+ vih->hdr.dwPictAspectRatioX = vih->hdr.bmiHeader.biWidth;
+ vih->hdr.dwPictAspectRatioY = vih->hdr.bmiHeader.biHeight;
+ vih->dwProfile = data[1];
+ vih->dwLevel = data[3];
+ vih->dwFlags = (data[4] & 3) + 1;
+
+ vih->cbSequenceHeader = 0;
+
+ BYTE* src = (BYTE*)data + 5;
+ BYTE* dst = (BYTE*)vih->dwSequenceHeader;
+
+ BYTE* src_end = (BYTE*)data + size;
+ BYTE* dst_end = (BYTE*)vih->dwSequenceHeader + size;
+
+ for(int i = 0; i < 2; i++)
+ {
+ for(int n = *src++ & 0x1f; n > 0; n--)
+ {
+ int len = ((src[0] << 8) | src[1]) + 2;
+ if(src + len > src_end || dst + len > dst_end) {ASSERT(0); break;}
+ memcpy(dst, src, len);
+ src += len;
+ dst += len;
+ vih->cbSequenceHeader += len;
+ }
+ }
+
+ mts.Add(mt);
+
+ mt.subtype = FOURCCMap(vih->hdr.bmiHeader.biCompression = '1CVA');
+ mts.Add(mt);
+ }
+ }
+ else if(AP4_StsdAtom* stsd = dynamic_cast<AP4_StsdAtom*>(
+ track->GetTrakAtom()->FindChild("mdia/minf/stbl/stsd")))
+ {
+ const AP4_DataBuffer db;// = stsd->GetDataBuffer();
+
+ for(AP4_List<AP4_Atom>::Item* item = stsd->GetChildren().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ AP4_Atom* atom = item->GetData();
+
+ AP4_Atom::Type type = atom->GetType();
+
+ if((type & 0xffff0000) == AP4_ATOM_TYPE('m', 's', 0, 0))
+ {
+ type &= 0xffff;
+ }
+ else if(type == AP4_ATOM_TYPE__MP3)
+ {
+ type = 0x0055;
+ }
+ else
+ {
+ type =
+ ((type >> 24) & 0x000000ff) |
+ ((type >> 8) & 0x0000ff00) |
+ ((type << 8) & 0x00ff0000) |
+ ((type << 24) & 0xff000000);
+ }
+
+ if(AP4_VisualSampleEntry* vse = dynamic_cast<AP4_VisualSampleEntry*>(atom))
+ {
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap(type);
+ mt.formattype = FORMAT_VideoInfo;
+ vih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER)+db.GetDataSize());
+ memset(vih, 0, mt.FormatLength());
+ vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
+ vih->bmiHeader.biWidth = (LONG)vse->GetWidth();
+ vih->bmiHeader.biHeight = (LONG)vse->GetHeight();
+ vih->bmiHeader.biCompression = type;
+ memcpy(vih+1, db.GetData(), db.GetDataSize());
+ mts.Add(mt);
+
+ char buff[5];
+ memcpy(buff, &type, 4);
+ buff[4] = 0;
+
+ strlwr((char*)&buff);
+ AP4_Atom::Type typelwr = *(AP4_Atom::Type*)buff;
+
+ if(typelwr != type)
+ {
+ mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typelwr);
+ mts.Add(mt);
+ }
+
+ strupr((char*)&buff);
+ AP4_Atom::Type typeupr = *(AP4_Atom::Type*)buff;
+
+ if(typeupr != type)
+ {
+ mt.subtype = FOURCCMap(vih->bmiHeader.biCompression = typeupr);
+ mts.Add(mt);
+ }
+
+ break;
+ }
+ else if(AP4_AudioSampleEntry* ase = dynamic_cast<AP4_AudioSampleEntry*>(atom))
+ {
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = FOURCCMap(type);
+ mt.formattype = FORMAT_WaveFormatEx;
+ wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + db.GetDataSize());
+ memset(wfe, 0, mt.FormatLength());
+ if(!(type & 0xffff0000)) wfe->wFormatTag = (WORD)type;
+ wfe->nSamplesPerSec = ase->GetSampleRate();
+ wfe->nChannels = ase->GetChannelCount();
+ wfe->wBitsPerSample = ase->GetSampleSize();
+// wfe->nBlockAlign = ase->GetBytesPerFrame();
+ wfe->cbSize = db.GetDataSize();
+ memcpy(wfe+1, db.GetData(), db.GetDataSize());
+ mts.Add(mt);
+ break;
+ }
+ }
+ }
+
+ if(mts.IsEmpty()) continue;
+
+ REFERENCE_TIME rtDuration = 10000i64 * track->GetDurationMs();
+ if(m_rtDuration < rtDuration) m_rtDuration = rtDuration;
+
+ DWORD id = track->GetId();
+
+ CStringW name, lang;
+ name.Format(L"Output %d", id);
+
+ if(!TrackName.IsEmpty())
+ {
+ name = TrackName;
+ }
+
+ if(!TrackLanguage.IsEmpty())
+ {
+ if(TrackLanguage != L"und") name += " (" + TrackLanguage + ")";
+ }
+
+ for(int i = 0, j = mts.GetCount(); i < j; i++)
+ {
+ BITMAPINFOHEADER bih;
+ if(ExtractBIH(&mts[i], &bih))
+ {
+ m_framesize.cx = bih.biWidth;
+ m_framesize.cy = abs(bih.biHeight);
+ }
+ }
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, name, this, this, &hr));
+
+ if(!TrackName.IsEmpty()) pPinOut->SetProperty(L"NAME", TrackName);
+ if(!TrackLanguage.IsEmpty()) pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
+
+ EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(id, pPinOut)));
+
+ m_trackpos[id] = trackpos();
+
+ if(mts.GetCount() == 1 && mts[0].subtype == MEDIASUBTYPE_ASS2)
+ {
+ LPCWSTR postfix = L" (plain text)";
+
+ mts[0].subtype = MEDIASUBTYPE_UTF8;
+
+ SUBTITLEINFO* si = (SUBTITLEINFO*)mts[0].ReallocFormatBuffer(sizeof(SUBTITLEINFO));
+ wcscat(si->TrackName, postfix);
+
+ id ^= 0x80402010; // FIXME: until fixing, let's hope there won't be another track like this...
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, name + postfix, this, this, &hr));
+
+ if(!TrackName.IsEmpty()) pPinOut->SetProperty(L"NAME", TrackName + postfix);
+ if(!TrackLanguage.IsEmpty()) pPinOut->SetProperty(L"LANG", CStringW(TrackLanguage));
+
+ EXECUTE_ASSERT(SUCCEEDED(AddOutputPin(id, pPinOut)));
+ }
+ }
+
+ if(AP4_ChplAtom* chpl = dynamic_cast<AP4_ChplAtom*>(movie->GetMoovAtom()->FindChild("udta/chpl")))
+ {
+ AP4_Array<AP4_ChplAtom::AP4_Chapter>& chapters = chpl->GetChapters();
+
+ for(AP4_Cardinal i = 0; i < chapters.ItemCount(); i++)
+ {
+ AP4_ChplAtom::AP4_Chapter& chapter = chapters[i];
+ ChapAppend(chapter.Time, UTF8To16(ConvertMBCS(chapter.Name.c_str(), ANSI_CHARSET, CP_UTF8)));
+ }
+
+ ChapSort();
+ }
+
+ if(AP4_ContainerAtom* ilst = dynamic_cast<AP4_ContainerAtom*>(movie->GetMoovAtom()->FindChild("udta/meta/ilst")))
+ {
+ CStringW title, artist, writer, album, year, appl, desc, gen, track;
+
+ for(AP4_List<AP4_Atom>::Item* item = ilst->GetChildren().FirstItem();
+ item;
+ item = item->GetNext())
+ {
+ if(AP4_ContainerAtom* atom = dynamic_cast<AP4_ContainerAtom*>(item->GetData()))
+ {
+ if(AP4_DataAtom* data = dynamic_cast<AP4_DataAtom*>(atom->GetChild(AP4_ATOM_TYPE_DATA)))
+ {
+ const AP4_DataBuffer* db = data->GetData();
+
+ if(atom->GetType() == AP4_ATOM_TYPE_TRKN)
+ {
+ if(db->GetDataSize() >= 4)
+ {
+ unsigned short n = (db->GetData()[2] << 8) | db->GetData()[3];
+ if(n > 0 && n < 100) track.Format(L"%02d", n);
+ else if(n >= 100) track.Format(L"%d", n);
+ }
+ }
+ else
+ {
+ CStringW str = UTF8To16(CStringA((LPCSTR)db->GetData(), db->GetDataSize()));
+
+ switch(atom->GetType())
+ {
+ case AP4_ATOM_TYPE_NAM: title = str; break;
+ case AP4_ATOM_TYPE_ART: artist = str; break;
+ case AP4_ATOM_TYPE_WRT: writer = str; break;
+ case AP4_ATOM_TYPE_ALB: album = str; break;
+ case AP4_ATOM_TYPE_DAY: year = str; break;
+ case AP4_ATOM_TYPE_TOO: appl = str; break;
+ case AP4_ATOM_TYPE_CMT: desc = str; break;
+ case AP4_ATOM_TYPE_GEN: gen = str; break;
+ }
+ }
+ }
+ }
+ }
+
+ if(!title.IsEmpty())
+ {
+ if(!track.IsEmpty()) title = track + L" - " + title;
+ if(!album.IsEmpty()) title = album + L" - " + title;
+ if(!year.IsEmpty()) title += L" - " + year;
+ if(!gen.IsEmpty()) title += L" - " + gen;
+ SetProperty(L"TITL", title);
+ }
+
+ if(!artist.IsEmpty()) SetProperty(L"AUTH", artist);
+ else if(!writer.IsEmpty()) SetProperty(L"AUTH", writer);
+
+ if(!appl.IsEmpty()) SetProperty(L"APPL", appl);
+
+ if(!desc.IsEmpty()) SetProperty(L"DESC", desc);
+ }
+ }
+
+ m_rtNewStop = m_rtStop = m_rtDuration;
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool CMP4SplitterFilter::DemuxInit()
+{
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+
+ pPair->m_value.index = 0;
+ pPair->m_value.ts = 0;
+
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
+
+ AP4_Sample sample;
+ if(AP4_SUCCEEDED(track->GetSample(0, sample)))
+ pPair->m_value.ts = sample.GetCts();
+ }
+
+ return true;
+}
+
+void CMP4SplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ AP4_TimeStamp ts = (AP4_TimeStamp)(rt / 10000);
+
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
+
+ if(AP4_FAILED(track->GetSampleIndexForTimeStampMs(ts, pPair->m_value.index)))
+ pPair->m_value.index = 0;
+
+ AP4_Sample sample;
+ if(AP4_SUCCEEDED(track->GetSample(pPair->m_value.index, sample)))
+ pPair->m_value.ts = sample.GetCts();
+
+ // FIXME: slow search & stss->m_Entries is private
+
+ if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
+ {
+ if(stss->m_Entries.ItemCount() > 0)
+ {
+ AP4_Cardinal i = -1;
+ while(++i < stss->m_Entries.ItemCount() && stss->m_Entries[i]-1 <= pPair->m_value.index);
+ if(i > 0) i--;
+ pPair->m_value.index = stss->m_Entries[i]-1;
+ }
+ }
+ }
+}
+
+struct SSACharacter {CString pre, post; WCHAR c;};
+
+static CStringW ConvertTX3GToSSA(
+ CStringW str,
+ const AP4_Tx3gSampleEntry::AP4_Tx3gDescription& desc,
+ CStringW font,
+ const AP4_Byte* mods,
+ int size,
+ CSize framesize,
+ CPoint translation,
+ int durationms,
+ CRect& rbox)
+{
+ int str_len = str.GetLength();
+
+ SSACharacter* chars = new SSACharacter[str_len];
+ for(int i = 0; i < str_len; i++) chars[i].c = str[i];
+ str.Empty();
+
+ //
+
+ rbox.SetRect(desc.TextBox.Left, desc.TextBox.Top, desc.TextBox.Right, desc.TextBox.Bottom);
+
+ int align = 2;
+ signed char h = (signed char)desc.HorizontalJustification;
+ signed char v = (signed char)desc.VerticalJustification;
+ if(h == 0 && v < 0) align = 1;
+ else if(h > 0 && v < 0) align = 2;
+ else if(h < 0 && v < 0) align = 3;
+ else if(h == 0 && v > 0) align = 4;
+ else if(h > 0 && v > 0) align = 5;
+ else if(h < 0 && v > 0) align = 6;
+ else if(h == 0 && v == 0) align = 7;
+ else if(h > 0 && v == 0) align = 8;
+ else if(h < 0 && v == 0) align = 9;
+ str.Format(L"{\\an%d}%s", align, CStringW(str));
+
+ if(!font.CompareNoCase(L"serif")) font = L"Times New Roman";
+ else if(!font.CompareNoCase(L"sans-serif")) font = L"Arial";
+ else if(!font.CompareNoCase(L"monospace")) font = L"Courier New";
+ str.Format(L"{\\fn%s}%s", font, CStringW(str));
+
+ const AP4_Byte* fclr = (const AP4_Byte*)&desc.Style.Font.Color;
+
+ CStringW font_color;
+ font_color.Format(L"{\\1c%02x%02x%02x\\1a%02x}", fclr[2], fclr[1], fclr[0], 255 - fclr[3]);
+ str = font_color + str;
+
+ str.Format(L"%s{\\2c%02x%02x%02x\\2a%02x}", CString(str), fclr[2], fclr[1], fclr[0], 255 - fclr[3]);
+
+ CStringW font_size;
+ font_size.Format(L"{\\fs%d}", desc.Style.Font.Size);
+ str = font_size + str;
+
+ CStringW font_flags;
+ font_flags.Format(L"{\\b%d\\i%d\\u%d}",
+ (desc.Style.Font.Face&1) ? 1 : 0,
+ (desc.Style.Font.Face&2) ? 1 : 0,
+ (desc.Style.Font.Face&4) ? 1 : 0);
+ str = font_flags + str;
+
+ //
+
+ const AP4_Byte* hclr = (const AP4_Byte*)&desc.BackgroundColor;
+
+ while(size > 8)
+ {
+ DWORD tag_size = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]); mods += 4;
+ DWORD tag = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]); mods += 4;
+
+ size -= tag_size;
+ tag_size -= 8;
+ const AP4_Byte* next = mods + tag_size;
+
+ if(tag == 'styl')
+ {
+ WORD styl_count = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ while(styl_count-- > 0)
+ {
+ WORD start = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD end = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD font_id = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD flags = mods[0]; mods += 1;
+ WORD size = mods[0]; mods += 1;
+ const AP4_Byte* color = mods; mods += 4;
+
+ if(end > str_len) end = str_len;
+
+ if(start < end)
+ {
+ CStringW s;
+
+ s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", color[2], color[1], color[0], 255 - color[3]);
+ chars[start].pre += s;
+ chars[end-1].post += font_color;
+
+ s.Format(L"{\\fs%d}", size);
+ chars[start].pre += s;
+ chars[end-1].post += font_size;
+
+ s.Format(L"{\\b%d\\i%d\\u%d}", (flags&1) ? 1 : 0, (flags&2) ? 1 : 0, (flags&4) ? 1 : 0);
+ chars[start].pre += s;
+ chars[end-1].post += font_flags;
+ }
+ }
+ }
+ else if(tag == 'hclr')
+ {
+ hclr = mods;
+ }
+ else if(tag == 'hlit')
+ {
+ WORD start = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD end = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ if(end > str_len) end = str_len;
+
+ if(start < end)
+ {
+ CStringW s;
+
+ s.Format(L"{\\3c%02x%02x%02x\\3a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
+ chars[start].pre += s;
+ chars[end-1].post += font_color;
+
+ chars[start].pre += L"{\\bord0.1}";
+ chars[end-1].post += L"{\\bord}";
+ }
+ }
+ else if(tag == 'blnk')
+ {
+ WORD start = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD end = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ if(end > str_len) end = str_len;
+
+ if(start < end)
+ {
+ // cheap...
+
+ for(int i = 0, alpha = 255; i < durationms; i += 750, alpha = 255 - alpha)
+ {
+ CStringW s;
+ s.Format(L"{\\t(%d, %d, \\alpha&H%02x&)}", i, i + 750, alpha);
+ chars[start].pre += s;
+ }
+
+ chars[end-1].post += L"{\\alpha}";
+ }
+ }
+ else if(tag == 'tbox')
+ {
+ rbox.top = (mods[0]<<8)|(mods[1]); mods += 2;
+ rbox.left = (mods[0]<<8)|(mods[1]); mods += 2;
+ rbox.bottom = (mods[0]<<8)|(mods[1]); mods += 2;
+ rbox.right = (mods[0]<<8)|(mods[1]); mods += 2;
+ }
+ else if(tag == 'krok' && !(desc.DisplayFlags & 0x800))
+ {
+ DWORD start_time = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]); mods += 4;
+ WORD krok_count = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ while(krok_count-- > 0)
+ {
+ DWORD end_time = (mods[0]<<24)|(mods[1]<<16)|(mods[2]<<8)|(mods[3]); mods += 4;
+ WORD start = (mods[0]<<8)|(mods[1]); mods += 2;
+ WORD end = (mods[0]<<8)|(mods[1]); mods += 2;
+
+ if(end > str_len) end = str_len;
+
+ if(start < end)
+ {
+ CStringW s;
+
+ s.Format(L"{\\kt%d\\kf%d}", start_time/10, (end_time - start_time)/10);
+ chars[start].pre += s;
+ s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
+ chars[start].pre += s;
+ chars[end-1].post += L"{\\kt}" + font_color;
+ }
+
+ start_time = end_time;
+ }
+ }
+
+ mods = next;
+ }
+
+ // continous karaoke
+
+ if(desc.DisplayFlags & 0x800)
+ {
+ CStringW s;
+
+ s.Format(L"{\\1c%02x%02x%02x\\1a%02x}", hclr[2], hclr[1], hclr[0], 255 - hclr[3]);
+ str += s;
+
+ int breaks = 0;
+
+ for(int i = 0, j = 0; i <= str_len; i++)
+ {
+ if(chars[i].c == '\n' /*|| chars[i].c == ' '*/)
+ {
+ breaks++;
+ }
+ }
+
+ if(str_len > breaks)
+ {
+ float dur = (float)max(durationms - 500, 0) / 10;
+
+ for(int i = 0, j = 0; i <= str_len; i++)
+ {
+ if(i == str_len || chars[i].c == '\n' /*|| chars[i].c == ' '*/)
+ {
+ s.Format(L"{\\kf%d}", (int)(dur * (i - j) / (str_len - breaks)));
+ chars[j].pre += s;
+ j = i+1;
+ }
+ }
+ }
+ }
+
+ //
+
+ for(int i = 0; i < str_len; i++)
+ {
+ str += chars[i].pre;
+ str += chars[i].c;
+ if(desc.DisplayFlags & 0x20000) str += L"\\N";
+ str += chars[i].post;
+ }
+
+ delete [] chars;
+
+ //
+
+ if(rbox.IsRectEmpty()) rbox.SetRect(0, 0, framesize.cx, framesize.cy);
+ rbox.OffsetRect(translation);
+
+ CRect rbox2 = rbox;
+ rbox2.DeflateRect(2, 2);
+
+ CRect r(0,0,0,0);
+ if(rbox2.Height() > 0) {r.top = rbox2.top; r.bottom = framesize.cy - rbox2.bottom;}
+ if(rbox2.Width() > 0) {r.left = rbox2.left; r.right = framesize.cx - rbox2.right;}
+
+ CStringW hdr;
+ hdr.Format(L"0,0,Text,,%d,%d,%d,%d,,{\\clip(%d,%d,%d,%d)}",
+ r.left, r.right, r.top, r.bottom,
+ rbox.left, rbox.top, rbox.right, rbox.bottom);
+
+ //
+
+ return hdr + str;
+}
+
+bool CMP4SplitterFilter::DemuxLoop()
+{
+ HRESULT hr = S_OK;
+
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+
+ while(SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ CAtlMap<DWORD, trackpos>::CPair* pPairNext = NULL;
+ REFERENCE_TIME rtNext = 0;
+
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
+
+ CBaseSplitterOutputPin* pPin = GetOutputPin((DWORD)track->GetId());
+ if(!pPin->IsConnected()) continue;
+
+ REFERENCE_TIME rt = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * pPair->m_value.ts);
+
+ if(pPair->m_value.index < track->GetSampleCount() && (!pPairNext || rt < rtNext))
+ {
+ pPairNext = pPair;
+ rtNext = rt;
+ }
+ }
+
+ if(!pPairNext) break;
+
+ AP4_Track* track = movie->GetTrack(pPairNext->m_key);
+
+ CBaseSplitterOutputPin* pPin = GetOutputPin((DWORD)track->GetId());
+
+ AP4_Sample sample;
+ AP4_DataBuffer data;
+
+ if(pPin && pPin->IsConnected() && AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data)))
+ {
+ const CMediaType& mt = pPin->CurrentMediaType();
+
+ CAutoPtr<Packet> p(new Packet());
+ p->TrackNumber = (DWORD)track->GetId();
+ p->rtStart = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetCts());
+ p->rtStop = p->rtStart + (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetDuration());
+ p->bSyncPoint = TRUE;
+
+ // FIXME: slow search & stss->m_Entries is private
+
+ if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
+ {
+ if(stss->m_Entries.ItemCount() > 0)
+ {
+ p->bSyncPoint = FALSE;
+
+ AP4_Cardinal i = -1;
+ while(++i < stss->m_Entries.ItemCount())
+ if(stss->m_Entries[i]-1 == pPairNext->m_value.index)
+ p->bSyncPoint = TRUE;
+ }
+ }
+
+ //
+
+ if(track->GetType() == AP4_Track::TYPE_AUDIO && data.GetDataSize() == 1)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ int nBlockAlign = 1200;
+
+ if(wfe->nBlockAlign > 1)
+ {
+ nBlockAlign = wfe->nBlockAlign;
+ pPairNext->m_value.index -= pPairNext->m_value.index % wfe->nBlockAlign;
+ }
+
+ p->rtStop = p->rtStart;
+
+ int fFirst = true;
+
+ while(AP4_SUCCEEDED(track->ReadSample(pPairNext->m_value.index, sample, data)))
+ {
+ AP4_Size size = data.GetDataSize();
+ const AP4_Byte* ptr = data.GetData();
+ for(int i = 0; i < size; i++) p->Add(ptr[i]);
+
+ if(fFirst) {p->rtStart = p->rtStop = (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetCts()); fFirst = false;}
+ p->rtStop += (REFERENCE_TIME)(10000000.0 / track->GetMediaTimeScale() * sample.GetDuration());
+
+ if(pPairNext->m_value.index+1 >= track->GetSampleCount() || p->GetCount() >= nBlockAlign)
+ break;
+
+ pPairNext->m_value.index++;
+ }
+ }
+ else if(track->GetType() == AP4_Track::TYPE_TEXT)
+ {
+ CStringA dlgln_bkg, dlgln_plaintext;
+
+ const AP4_Byte* ptr = data.GetData();
+ AP4_Size avail = data.GetDataSize();
+
+ if(avail > 2)
+ {
+ AP4_UI16 size = (ptr[0] << 8) | ptr[1];
+
+ if(size <= avail-2)
+ {
+ CStringA str;
+
+ if(size >= 2 && ptr[2] == 0xfe && ptr[3] == 0xff)
+ {
+ CStringW wstr = CStringW((LPCWSTR)&ptr[2], size/2);
+ for(int i = 0; i < wstr.GetLength(); i++) wstr.SetAt(i, ((WORD)wstr[i] >> 8) | ((WORD)wstr[i] << 8));
+ str = UTF16To8(wstr);
+ }
+ else
+ {
+ str = CStringA((LPCSTR)&ptr[2], size);
+ }
+
+ CStringA dlgln = str;
+
+ if(mt.subtype == MEDIASUBTYPE_ASS2)
+ {
+ AP4_SampleDescription* desc = track->GetSampleDescription(sample.GetDescriptionIndex());
+
+ dlgln = "0,0,Text,,0000,0000,0000,0000,," + str;
+ dlgln_plaintext = str;
+
+ CPoint translation(0, 0);
+ if(AP4_TkhdAtom* tkhd = dynamic_cast<AP4_TkhdAtom*>(track->GetTrakAtom()->GetChild(AP4_ATOM_TYPE_TKHD)))
+ {
+ AP4_Float x, y;
+ tkhd->GetTranslation(x, y);
+ translation.SetPoint((int)x, (int)y);
+ }
+
+ if(AP4_UnknownSampleDescription* unknown_desc = dynamic_cast<AP4_UnknownSampleDescription*>(desc)) // TEMP
+ {
+ AP4_SampleEntry* sample_entry = unknown_desc->GetSampleEntry();
+
+ if(AP4_TextSampleEntry* text = dynamic_cast<AP4_TextSampleEntry*>(sample_entry))
+ {
+ const AP4_TextSampleEntry::AP4_TextDescription& d = text->GetDescription();
+
+ // TODO
+ }
+ else if(AP4_Tx3gSampleEntry* tx3g = dynamic_cast<AP4_Tx3gSampleEntry*>(sample_entry))
+ {
+ const AP4_Tx3gSampleEntry::AP4_Tx3gDescription& desc = tx3g->GetDescription();
+
+ CStringW font = L"Arial";
+
+ if(AP4_FtabAtom* ftab = dynamic_cast<AP4_FtabAtom*>(tx3g->GetChild(AP4_ATOM_TYPE_FTAB)))
+ {
+ AP4_String Name;
+ if(AP4_SUCCEEDED(ftab->LookupFont(desc.Style.Font.Id, Name)))
+ font = Name.c_str();
+ }
+
+ CRect rbox;
+ CStringW ssa = ConvertTX3GToSSA(
+ UTF8To16(str), desc, font,
+ ptr + (2 + size), avail - (2 + size),
+ m_framesize, translation,
+ (p->rtStop - p->rtStart)/10000,
+ rbox);
+ dlgln = UTF16To8(ssa);
+
+ const AP4_Byte* bclr = (const AP4_Byte*)&desc.BackgroundColor;
+
+ if(bclr[3])
+ {
+ CPoint tl = rbox.TopLeft();
+ rbox.OffsetRect(-tl.x, -tl.y);
+
+ dlgln_bkg.Format(
+ "0,-1,Text,,0,0,0,0,,{\\an7\\pos(%d,%d)\\1c%02x%02x%02x\\1a%02x\\bord0\\shad0}{\\p1}m %d %d l %d %d l %d %d l %d %d {\\p0}",
+ tl.x, tl.y,
+ bclr[2], bclr[1], bclr[0],
+ 255 - bclr[3],
+ rbox.left, rbox.top,
+ rbox.right, rbox.top,
+ rbox.right, rbox.bottom,
+ rbox.left, rbox.bottom);
+ }
+ }
+ }
+ }
+
+ dlgln.Replace("\r", "");
+ dlgln.Replace("\n", "\\N");
+
+ p->SetData((LPCSTR)dlgln, dlgln.GetLength());
+ }
+ }
+
+ if(!dlgln_bkg.IsEmpty())
+ {
+ CAutoPtr<Packet> p2(new Packet());
+ p2->TrackNumber = p->TrackNumber;
+ p2->rtStart = p->rtStart;
+ p2->rtStop = p->rtStop;
+ p2->bSyncPoint = p->bSyncPoint;
+ p2->SetData((LPCSTR)dlgln_bkg, dlgln_bkg.GetLength());
+ hr = DeliverPacket(p2);
+ }
+
+ if(!dlgln_plaintext.IsEmpty())
+ {
+ CAutoPtr<Packet> p2(new Packet());
+ p2->TrackNumber = p->TrackNumber ^ 0x80402010;
+ p2->rtStart = p->rtStart;
+ p2->rtStop = p->rtStop;
+ p2->bSyncPoint = p->bSyncPoint;
+ p2->SetData((LPCSTR)dlgln_plaintext, dlgln_plaintext.GetLength());
+ hr = DeliverPacket(p2);
+ }
+ }
+ else
+ {
+ p->SetData(data.GetData(), data.GetDataSize());
+ }
+
+ hr = DeliverPacket(p);
+ }
+
+ {
+ AP4_Sample sample;
+ if(AP4_SUCCEEDED(track->GetSample(++pPairNext->m_value.index, sample)))
+ pPairNext->m_value.ts = sample.GetCts();
+ }
+
+ }
+
+ return true;
+}
+
+// IKeyFrameInfo
+
+STDMETHODIMP CMP4SplitterFilter::GetKeyFrameCount(UINT& nKFs)
+{
+ CheckPointer(m_pFile, E_UNEXPECTED);
+
+ if(!m_pFile) return E_UNEXPECTED;
+
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
+
+ if(track->GetType() != AP4_Track::TYPE_VIDEO)
+ continue;
+
+ if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
+ {
+ nKFs = stss->m_Entries.ItemCount();
+ return S_OK;
+ }
+ }
+
+ return E_FAIL;
+}
+
+STDMETHODIMP CMP4SplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
+{
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
+ CheckPointer(m_pFile, E_UNEXPECTED);
+
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
+
+ if(!m_pFile) return E_UNEXPECTED;
+
+ AP4_Movie* movie = (AP4_Movie*)m_pFile->GetMovie();
+
+ POSITION pos = m_trackpos.GetStartPosition();
+ while(pos)
+ {
+ CAtlMap<DWORD, trackpos>::CPair* pPair = m_trackpos.GetNext(pos);
+
+ AP4_Track* track = movie->GetTrack(pPair->m_key);
+
+ if(track->GetType() != AP4_Track::TYPE_VIDEO)
+ continue;
+
+ if(AP4_StssAtom* stss = dynamic_cast<AP4_StssAtom*>(track->GetTrakAtom()->FindChild("mdia/minf/stbl/stss")))
+ {
+ nKFs = 0;
+
+ for(AP4_Cardinal i = 0; i < stss->m_Entries.ItemCount(); i++)
+ {
+ AP4_Sample sample;
+ if(AP4_SUCCEEDED(track->GetSample(stss->m_Entries[i]-1, sample)))
+ pKFs[nKFs++] = 10000000i64 * sample.GetCts() / track->GetMediaTimeScale();
+ }
+
+ return S_OK;
+ }
+ }
+
+ return E_FAIL;
+}
+
+//
+// CMP4SourceFilter
+//
+
+CMP4SourceFilter::CMP4SourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CMP4SplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
diff --git a/src/filters/parser/mp4splitter/MP4Splitter.def b/src/filters/parser/mp4splitter/MP4Splitter.def
new file mode 100644
index 000000000..b84374bfe
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4Splitter.def
@@ -0,0 +1,7 @@
+LIBRARY "MP4Splitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/mp4splitter/MP4Splitter.h b/src/filters/parser/mp4splitter/MP4Splitter.h
new file mode 100644
index 000000000..7fb8c650c
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4Splitter.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "MP4SplitterFile.h"
+#include "..\BaseSplitter\BaseSplitter.h"
+
+[uuid("61F47056-E400-43d3-AF1E-AB7DFFD4C4AD")]
+class CMP4SplitterFilter : public CBaseSplitterFilter
+{
+ struct trackpos {DWORD /*AP4_Ordinal*/ index; unsigned __int64 /*AP4_TimeStamp*/ ts;};
+ CAtlMap<DWORD, trackpos> m_trackpos;
+ CSize m_framesize;
+
+protected:
+ CAutoPtr<CMP4SplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+public:
+ CMP4SplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CMP4SplitterFilter();
+
+ // IKeyFrameInfo
+
+ STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+};
+
+[uuid("3CCC052E-BDEE-408a-BEA7-90914EF2964B")]
+class CMP4SourceFilter : public CMP4SplitterFilter
+{
+public:
+ CMP4SourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
diff --git a/src/filters/parser/mp4splitter/MP4Splitter.rc b/src/filters/parser/mp4splitter/MP4Splitter.rc
new file mode 100644
index 000000000..e2888cb1d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4Splitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,2
+ PRODUCTVERSION 1,0,0,2
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "MP4 Splitter"
+ VALUE "FileVersion", "1, 0, 0, 2"
+ VALUE "InternalName", "MP4 Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2005-2006 Gabest"
+ VALUE "OriginalFilename", "MP4Splitter.ax"
+ VALUE "ProductName", "MP4 Splitter"
+ VALUE "ProductVersion", "1, 0, 0, 2"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/mp4splitter/MP4Splitter.vcproj b/src/filters/parser/mp4splitter/MP4Splitter.vcproj
new file mode 100644
index 000000000..f4c47111e
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4Splitter.vcproj
@@ -0,0 +1,1004 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="MP4Splitter"
+ ProjectGUID="{9ED4B036-7399-4128-868D-6E71188E0277}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="AP4\Source\Config; AP4\Source\Core; AP4\Source\Crypto"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ AdditionalIncludeDirectories="AP4\Source\Config; AP4\Source\Core; AP4\Source\Crypto"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="MP4Splitter.cpp">
+ </File>
+ <File
+ RelativePath="MP4Splitter.def">
+ </File>
+ <File
+ RelativePath=".\MP4SplitterFile.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\MP4Splitter.h">
+ </File>
+ <File
+ RelativePath=".\MP4SplitterFile.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\MP4Splitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="AP4"
+ Filter="">
+ <Filter
+ Name="Core"
+ Filter="">
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Array.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Atom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Atom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4AtomFactory.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4AtomFactory.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4AtomSampleTable.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4AtomSampleTable.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4AvcCAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4AvcCAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4ByteStream.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4ByteStream.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4ChplAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4ChplAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4CmvdAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4CmvdAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Co64Atom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Co64Atom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Constants.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4ContainerAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4ContainerAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4CttsAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4CttsAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DataAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DataAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DataBuffer.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DataBuffer.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DcomAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DcomAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Debug.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Debug.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DecoderConfigDescriptor.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DecoderConfigDescriptor.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DecoderSpecificInfoDescriptor.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DecoderSpecificInfoDescriptor.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Descriptor.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Descriptor.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DescriptorFactory.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DescriptorFactory.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DrefAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4DrefAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4EsDescriptor.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4EsDescriptor.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4EsdsAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4EsdsAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4File.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4File.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4FileByteStream.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4FileWriter.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4FileWriter.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4FrmaAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4FrmaAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4FtabAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4FtabAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4FtypAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4FtypAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4HdlrAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4HdlrAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4HintTrackReader.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4HintTrackReader.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4HmhdAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4HmhdAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4IkmsAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4IkmsAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Interfaces.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4IsfmAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4IsfmAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4IsmaCryp.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4IsmaCryp.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4List.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4MdhdAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4MdhdAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4MoovAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4MoovAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Movie.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Movie.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4MvhdAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4MvhdAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4NmhdAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4NmhdAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Processor.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Processor.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Results.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4RtpAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4RtpAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4RtpHint.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4RtpHint.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Sample.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Sample.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SampleDescription.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SampleDescription.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SampleEntry.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SampleEntry.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SampleTable.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SampleTable.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SchmAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SchmAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SdpAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SdpAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SLConfigDescriptor.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SLConfigDescriptor.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SmhdAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SmhdAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StcoAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StcoAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StscAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StscAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StsdAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StsdAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StssAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StssAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StszAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4StszAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SttsAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SttsAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SyntheticSampleTable.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4SyntheticSampleTable.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4TimsAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4TimsAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4TkhdAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4TkhdAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Track.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Track.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4TrakAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4TrakAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4TrefTypeAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4TrefTypeAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Types.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4UnknownDescriptor.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4UnknownDescriptor.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4UrlAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4UrlAtom.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Utils.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4Utils.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4VmhdAtom.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Core\Ap4VmhdAtom.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Crypto"
+ Filter="">
+ <File
+ RelativePath=".\Ap4\Source\Crypto\Ap4AesBlockCipher.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Crypto\Ap4AesBlockCipher.h">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Crypto\Ap4StreamCipher.cpp">
+ </File>
+ <File
+ RelativePath=".\Ap4\Source\Crypto\Ap4StreamCipher.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Config"
+ Filter="">
+ <File
+ RelativePath=".\Ap4\Source\Config\Ap4Config.h">
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/MP4SplitterFile.cpp b/src/filters/parser/mp4splitter/MP4SplitterFile.cpp
new file mode 100644
index 000000000..8bc040121
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4SplitterFile.cpp
@@ -0,0 +1,40 @@
+#include "StdAfx.h"
+#include "MP4SplitterFile.h"
+#include "Ap4AsyncReaderStream.cpp" // FIXME
+
+CMP4SplitterFile::CMP4SplitterFile(IAsyncReader* pReader, HRESULT& hr)
+ : CBaseSplitterFileEx(pReader, hr)
+ , m_pAp4File(NULL)
+{
+ if(FAILED(hr)) return;
+
+ hr = Init();
+}
+
+CMP4SplitterFile::~CMP4SplitterFile()
+{
+ delete (AP4_File*)m_pAp4File;
+}
+
+void* /* AP4_Movie* */ CMP4SplitterFile::GetMovie()
+{
+ ASSERT(m_pAp4File);
+ return m_pAp4File ? ((AP4_File*)m_pAp4File)->GetMovie() : NULL;
+}
+
+HRESULT CMP4SplitterFile::Init()
+{
+ Seek(0);
+
+ delete (AP4_File*)m_pAp4File;
+
+ AP4_ByteStream* stream = new AP4_AsyncReaderStream(this);
+
+ m_pAp4File = new AP4_File(*stream);
+
+ AP4_Movie* movie = ((AP4_File*)m_pAp4File)->GetMovie();
+
+ stream->Release();
+
+ return movie ? S_OK : E_FAIL;
+}
diff --git a/src/filters/parser/mp4splitter/MP4SplitterFile.h b/src/filters/parser/mp4splitter/MP4SplitterFile.h
new file mode 100644
index 000000000..78494727b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4SplitterFile.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+// #include "Ap4AsyncReaderStream.h" // FIXME
+
+class CMP4SplitterFile : public CBaseSplitterFileEx
+{
+ void* /* AP4_File* */ m_pAp4File;
+
+ HRESULT Init();
+
+public:
+ CMP4SplitterFile(IAsyncReader* pReader, HRESULT& hr);
+ virtual ~CMP4SplitterFile();
+
+ void* /* AP4_Movie* */ GetMovie();
+};
diff --git a/src/filters/parser/mp4splitter/MP4Splitter_vs2005.sln b/src/filters/parser/mp4splitter/MP4Splitter_vs2005.sln
new file mode 100644
index 000000000..3ff075c8b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4Splitter_vs2005.sln
@@ -0,0 +1,92 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MP4Splitter", "MP4Splitter_vs2005.vcproj", "{9ED4B036-7399-4128-868D-6E71188E0277}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baseclasses", "C:\Program Files\Microsoft DirectX 9.0 SDK\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter_vs2005.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil_vs2005.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug lib|Win32 = Debug lib|Win32
+ Debug Unicode lib|Win32 = Debug Unicode lib|Win32
+ Debug Unicode|Win32 = Debug Unicode|Win32
+ Debug|Win32 = Debug|Win32
+ Release lib|Win32 = Release lib|Win32
+ Release Unicode lib|Win32 = Release Unicode lib|Win32
+ Release Unicode|Win32 = Release Unicode|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug lib|Win32.ActiveCfg = Debug lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug lib|Win32.Build.0 = Debug lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode lib|Win32.Build.0 = Debug Unicode lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Debug|Win32.Build.0 = Debug|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release lib|Win32.ActiveCfg = Release lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release lib|Win32.Build.0 = Release lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode lib|Win32.ActiveCfg = Release Unicode lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode lib|Win32.Build.0 = Release Unicode lib|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release|Win32.ActiveCfg = Release|Win32
+ {9ED4B036-7399-4128-868D-6E71188E0277}.Release|Win32.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib|Win32.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug|Win32.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib|Win32.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib|Win32.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release|Win32.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release|Win32.Build.0 = Release|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib|Win32.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib|Win32.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib|Win32.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug|Win32.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug|Win32.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib|Win32.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib|Win32.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib|Win32.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib|Win32.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release|Win32.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release|Win32.Build.0 = Release lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib|Win32.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib|Win32.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib|Win32.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug|Win32.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib|Win32.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib|Win32.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib|Win32.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib|Win32.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release|Win32.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/mp4splitter/MP4Splitter_vs2005.vcproj b/src/filters/parser/mp4splitter/MP4Splitter_vs2005.vcproj
new file mode 100644
index 000000000..4010491ab
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4Splitter_vs2005.vcproj
@@ -0,0 +1,1400 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="MP4Splitter"
+ ProjectGUID="{9ED4B036-7399-4128-868D-6E71188E0277}"
+ RootNamespace="MP4Splitter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996;4812"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996;4812"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996;4812"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996;4812"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996;4812"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="zlibD.lib strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996;4812"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="zlibR.lib strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996;4812"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="zlibD.lib strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ IgnoreDefaultLibraryNames="libc.lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ AdditionalIncludeDirectories=".\AP4\Source\Core;.\AP4\Source\Config;.\AP4\Source\Crypto"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4995;4996;4812"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="zlibR.lib strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="MP4Splitter.cpp"
+ >
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="MP4Splitter.def"
+ >
+ </File>
+ <File
+ RelativePath=".\MP4SplitterFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="MP4Splitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MP4SplitterFile.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\MP4Splitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="AP4"
+ >
+ <Filter
+ Name="Core"
+ >
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Array.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Atom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Atom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4AtomFactory.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4AtomFactory.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4AtomSampleTable.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4AtomSampleTable.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4AvcCAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4AvcCAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4ByteStream.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4ByteStream.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4ChplAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4ChplAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4CmvdAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4CmvdAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Co64Atom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Co64Atom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Constants.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4ContainerAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4ContainerAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4CttsAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4CttsAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DataAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DataAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DataBuffer.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DataBuffer.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DcomAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DcomAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Debug.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Debug.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DecoderConfigDescriptor.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DecoderConfigDescriptor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DecoderSpecificInfoDescriptor.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DecoderSpecificInfoDescriptor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Descriptor.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Descriptor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DescriptorFactory.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DescriptorFactory.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DrefAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4DrefAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4EsDescriptor.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4EsDescriptor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4EsdsAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4EsdsAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4File.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4File.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4FileByteStream.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4FileWriter.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4FileWriter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4FrmaAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4FrmaAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4FtabAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4FtabAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4FtypAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4FtypAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4HdlrAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4HdlrAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4HintTrackReader.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4HintTrackReader.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4HmhdAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4HmhdAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4IkmsAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4IkmsAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Interfaces.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4IsfmAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4IsfmAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4IsmaCryp.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4IsmaCryp.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4List.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4MdhdAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4MdhdAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4MoovAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4MoovAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Movie.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Movie.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4MvhdAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4MvhdAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4NmhdAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4NmhdAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Processor.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Processor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Results.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4RtpAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4RtpAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4RtpHint.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4RtpHint.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Sample.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Sample.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SampleDescription.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SampleDescription.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SampleEntry.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SampleEntry.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SampleTable.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SampleTable.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SchmAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SchmAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SdpAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SdpAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SLConfigDescriptor.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SLConfigDescriptor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SmhdAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SmhdAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StcoAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StcoAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StscAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StscAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StsdAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StsdAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StssAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StssAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StszAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4StszAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SttsAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SttsAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SyntheticSampleTable.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4SyntheticSampleTable.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4TimsAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4TimsAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4TkhdAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4TkhdAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Track.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Track.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4TrakAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4TrakAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4TrefTypeAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4TrefTypeAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Types.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4UnknownDescriptor.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4UnknownDescriptor.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4UrlAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4UrlAtom.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Utils.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4Utils.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4VmhdAtom.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Core\Ap4VmhdAtom.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Config"
+ >
+ <File
+ RelativePath=".\AP4\Source\Config\Ap4Config.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Crypto"
+ >
+ <File
+ RelativePath=".\AP4\Source\Crypto\Ap4AesBlockCipher.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Crypto\Ap4AesBlockCipher.h"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Crypto\Ap4StreamCipher.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\AP4\Source\Crypto\Ap4StreamCipher.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mp4splitter/MP4Splitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/mp4splitter/MP4Splitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/mp4splitter/MP4Splitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/mp4splitter/readme.txt b/src/filters/parser/mp4splitter/readme.txt
new file mode 100644
index 000000000..66af88a89
--- /dev/null
+++ b/src/filters/parser/mp4splitter/readme.txt
@@ -0,0 +1,9 @@
+In order to build this splitter the source of Bento4 has to be extracted into the AP4 directory.
+
+Location: http://sourceforge.net/projects/bento4/
+
+!!!IMPORTANT!!!
+
+There are a few necessary changes need to be done before it can be compiled. Just overwrite the original library files with what you can find at .\AP4\Update\<version>.
+
+There are only project files for vc2k5b2 because I don't have vc2k3 anymore. So if you want to build with that you have to create them yourself. (just decreasing the version number of sln/vcproj works usually...) \ No newline at end of file
diff --git a/src/filters/parser/mp4splitter/resource.h b/src/filters/parser/mp4splitter/resource.h
new file mode 100644
index 000000000..f9afd652d
--- /dev/null
+++ b/src/filters/parser/mp4splitter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by MP4Splitter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/mp4splitter/stdafx.cpp b/src/filters/parser/mp4splitter/stdafx.cpp
new file mode 100644
index 000000000..ae7410104
--- /dev/null
+++ b/src/filters/parser/mp4splitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// MP4Splitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/mp4splitter/stdafx.h b/src/filters/parser/mp4splitter/stdafx.h
new file mode 100644
index 000000000..67593bb9b
--- /dev/null
+++ b/src/filters/parser/mp4splitter/stdafx.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+#include <atlcoll.h>
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/parser/mpasplitter/MpaSplitter.cpp b/src/filters/parser/mpasplitter/MpaSplitter.cpp
new file mode 100644
index 000000000..518e9f98b
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitter.cpp
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include <initguid.h>
+#include "MpaSplitter.h"
+#include "..\..\..\..\include\moreuuids.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CMpaSplitterFilter), L"Mpa Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins},
+ {&__uuidof(CMpaSourceFilter), L"Mpa Source", MERIT_NORMAL+1, 0, NULL},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMpaSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMpaSourceFilter>, NULL, &sudFilter[1]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ CAtlList<CString> chkbytes;
+ chkbytes.AddTail(_T("0,2,FFE0,FFE0"));
+ chkbytes.AddTail(_T("0,10,FFFFFF00000080808080,49443300000000000000"));
+
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_MPEG1Audio,
+ chkbytes,
+ NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CMpaSplitterFilter
+//
+
+CMpaSplitterFilter::CMpaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("CMpaSplitterFilter"), pUnk, phr, __uuidof(this))
+{
+}
+
+STDMETHODIMP CMpaSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CMpaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ m_pFile.Attach(new CMpaSplitterFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ CAtlArray<CMediaType> mts;
+ mts.Add(m_pFile->GetMediaType());
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
+ AddOutputPin(0, pPinOut);
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->GetDuration();
+
+ CStringW str, title;
+ if(m_pFile->m_tags.Lookup('TIT2', str)) title = str;
+ if(m_pFile->m_tags.Lookup('TYER', str) && !title.IsEmpty() && !str.IsEmpty()) title += L" (" + str + L")";
+ if(!title.IsEmpty()) SetProperty(L"TITL", title);
+ if(m_pFile->m_tags.Lookup('TPE1', str)) SetProperty(L"AUTH", str);
+ if(m_pFile->m_tags.Lookup('TCOP', str)) SetProperty(L"CPYR", str);
+ if(m_pFile->m_tags.Lookup('COMM', str)) SetProperty(L"DESC", str);
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CMpaSplitterFilter::GetDuration(LONGLONG* pDuration)
+{
+ CheckPointer(pDuration, E_POINTER);
+ CheckPointer(m_pFile, VFW_E_NOT_CONNECTED);
+
+ *pDuration = m_pFile->GetDuration();
+
+ return S_OK;
+}
+
+bool CMpaSplitterFilter::DemuxInit()
+{
+ if(!m_pFile) return(false);
+
+ // TODO
+
+ return(true);
+}
+
+void CMpaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ __int64 startpos = m_pFile->GetStartPos();
+ __int64 endpos = m_pFile->GetEndPos();
+
+ if(rt <= 0 || m_pFile->GetDuration() <= 0)
+ {
+ m_pFile->Seek(startpos);
+ m_rtStart = 0;
+ }
+ else
+ {
+ m_pFile->Seek(startpos + (__int64)((1.0 * rt / m_pFile->GetDuration()) * (endpos - startpos)));
+ m_rtStart = rt;
+ }
+
+}
+
+bool CMpaSplitterFilter::DemuxLoop()
+{
+ HRESULT hr = S_OK;
+
+ int FrameSize;
+ REFERENCE_TIME rtDuration;
+
+ while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetEndPos() - 9)
+ {
+ if(!m_pFile->Sync(FrameSize, rtDuration)) {Sleep(1); continue;}
+
+ CAutoPtr<Packet> p(new Packet());
+ p->SetCount(FrameSize);
+ m_pFile->ByteRead(p->GetData(), FrameSize);
+
+ p->TrackNumber = 0;
+ p->rtStart = m_rtStart;
+ p->rtStop = m_rtStart + rtDuration;
+ p->bSyncPoint = TRUE;
+
+ hr = DeliverPacket(p);
+
+ m_rtStart += rtDuration;
+ }
+
+ return(true);
+}
+
+//
+// CMpaSourceFilter
+//
+
+CMpaSourceFilter::CMpaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CMpaSplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
diff --git a/src/filters/parser/mpasplitter/MpaSplitter.def b/src/filters/parser/mpasplitter/MpaSplitter.def
new file mode 100644
index 000000000..f4737ee4b
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "MpaSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/mpasplitter/MpaSplitter.h b/src/filters/parser/mpasplitter/MpaSplitter.h
new file mode 100644
index 000000000..97dced5cc
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitter.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+#include "MpaSplitterFile.h"
+
+[uuid("0E9D4BF7-CBCB-46C7-BD80-4EF223A3DC2B")]
+class CMpaSplitterFilter : public CBaseSplitterFilter
+{
+ REFERENCE_TIME m_rtStart;
+
+protected:
+ CAutoPtr<CMpaSplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+public:
+ CMpaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+};
+
+[uuid("59A0DB73-0287-4C9A-9D3C-8CFF39F8E5DB")]
+class CMpaSourceFilter : public CMpaSplitterFilter
+{
+public:
+ CMpaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+}; \ No newline at end of file
diff --git a/src/filters/parser/mpasplitter/MpaSplitter.rc b/src/filters/parser/mpasplitter/MpaSplitter.rc
new file mode 100644
index 000000000..e544e41b3
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,2
+ PRODUCTVERSION 1,0,0,2
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Mpa Splitter"
+ VALUE "FileVersion", "1, 0, 0, 2"
+ VALUE "InternalName", "Mpa Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "MpaSplitter.ax"
+ VALUE "ProductName", "Mpa Splitter"
+ VALUE "ProductVersion", "1, 0, 0, 2"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/mpasplitter/MpaSplitter.sln b/src/filters/parser/mpasplitter/MpaSplitter.sln
new file mode 100644
index 000000000..f0e649ddf
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitter.sln
@@ -0,0 +1,94 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpaSplitter", "MpaSplitter.vcproj", "{C0F7A036-FC2D-40df-9852-C37518DB6B3E}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601} = {6BA829DC-20C1-4B6B-BF63-7601FEB64601}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{6BA829DC-20C1-4B6B-BF63-7601FEB64601}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {C0F7A036-FC2D-40df-9852-C37518DB6B3E}.Debug.ActiveCfg = Debug|Win32
+ {C0F7A036-FC2D-40df-9852-C37518DB6B3E}.Debug lib.ActiveCfg = Debug lib|Win32
+ {C0F7A036-FC2D-40df-9852-C37518DB6B3E}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {C0F7A036-FC2D-40df-9852-C37518DB6B3E}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {C0F7A036-FC2D-40df-9852-C37518DB6B3E}.Release.ActiveCfg = Release|Win32
+ {C0F7A036-FC2D-40df-9852-C37518DB6B3E}.Release lib.ActiveCfg = Release lib|Win32
+ {C0F7A036-FC2D-40df-9852-C37518DB6B3E}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {C0F7A036-FC2D-40df-9852-C37518DB6B3E}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug.ActiveCfg = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug.Build.0 = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug lib.ActiveCfg = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug lib.Build.0 = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release.ActiveCfg = Release|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release.Build.0 = Release|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release lib.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release lib.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/mpasplitter/MpaSplitter.vcproj b/src/filters/parser/mpasplitter/MpaSplitter.vcproj
new file mode 100644
index 000000000..8c3cb1232
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitter.vcproj
@@ -0,0 +1,562 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="MpaSplitter"
+ ProjectGUID="{C0F7A036-FC2D-40DF-9852-C37518DB6B3E}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="MpaSplitter.cpp">
+ </File>
+ <File
+ RelativePath="MpaSplitter.def">
+ </File>
+ <File
+ RelativePath=".\MpaSplitterFile.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\MpaSplitter.h">
+ </File>
+ <File
+ RelativePath=".\MpaSplitterFile.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\MpaSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mpasplitter/MpaSplitterFile.cpp b/src/filters/parser/mpasplitter/MpaSplitterFile.cpp
new file mode 100644
index 000000000..a08bceba5
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitterFile.cpp
@@ -0,0 +1,345 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include "MpaSplitterFile.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+//
+
+static const LPCTSTR s_genre[] =
+{
+ _T("Blues"), _T("Classic Rock"), _T("Country"), _T("Dance"),
+ _T("Disco"), _T("Funk"), _T("Grunge"), _T("Hip-Hop"),
+ _T("Jazz"), _T("Metal"), _T("New Age"), _T("Oldies"),
+ _T("Other"), _T("Pop"), _T("R&B"), _T("Rap"),
+ _T("Reggae"), _T("Rock"), _T("Techno"), _T("Industrial"),
+ _T("Alternative"), _T("Ska"), _T("Death Metal"), _T("Pranks"),
+ _T("Soundtrack"), _T("Euro-Techno"), _T("Ambient"), _T("Trip-Hop"),
+ _T("Vocal"), _T("Jazz+Funk"), _T("Fusion"), _T("Trance"),
+ _T("Classical"), _T("Instrumental"), _T("Acid"), _T("House"),
+ _T("Game"), _T("Sound Clip"), _T("Gospel"), _T("Noise"),
+ _T("Alternative Rock"), _T("Bass"), _T("Soul"), _T("Punk"),
+ _T("Space"), _T("Meditative"), _T("Instrumental Pop"), _T("Instrumental Rock"),
+ _T("Ethnic"), _T("Gothic"), _T("Darkwave"), _T("Techno-Industrial"),
+ _T("Electronic"), _T("Pop-Folk"), _T("Eurodance"), _T("Dream"),
+ _T("Southern Rock"), _T("Comedy"), _T("Cult"), _T("Gangsta"),
+ _T("Top 40"), _T("Christian Rap"), _T("Pop/Funk"), _T("Jungle"),
+ _T("Native US"), _T("Cabaret"), _T("New Wave"), _T("Psychadelic"),
+ _T("Rave"), _T("Showtunes"), _T("Trailer"), _T("Lo-Fi"),
+ _T("Tribal"), _T("Acid Punk"), _T("Acid Jazz"), _T("Polka"),
+ _T("Retro"), _T("Musical"), _T("Rock & Roll"), _T("Hard Rock"),
+ _T("Folk"), _T("Folk-Rock"), _T("National Folk"), _T("Swing"),
+ _T("Fast Fusion"), _T("Bebob"), _T("Latin"), _T("Revival"),
+ _T("Celtic"), _T("Bluegrass"), _T("Avantgarde"), _T("Gothic Rock"),
+ _T("Progressive Rock"), _T("Psychedelic Rock"), _T("Symphonic Rock"), _T("Slow Rock"),
+ _T("Big Band"), _T("Chorus"), _T("Easy Listening"), _T("Acoustic"),
+ _T("Humour"), _T("Speech"), _T("Chanson"), _T("Opera"),
+ _T("Chamber Music"), _T("Sonata"), _T("Symphony"), _T("Booty Bass"),
+ _T("Primus"), _T("Porn Groove"), _T("Satire"), _T("Slow Jam"),
+ _T("Club"), _T("Tango"), _T("Samba"), _T("Folklore"),
+ _T("Ballad"), _T("Power Ballad"), _T("Rhytmic Soul"), _T("Freestyle"),
+ _T("Duet"), _T("Punk Rock"), _T("Drum Solo"), _T("Acapella"),
+ _T("Euro-House"), _T("Dance Hall"), _T("Goa"), _T("Drum & Bass"),
+ _T("Club-House"), _T("Hardcore"), _T("Terror"), _T("Indie"),
+ _T("BritPop"), _T("Negerpunk"), _T("Polsk Punk"), _T("Beat"),
+ _T("Christian Gangsta"), _T("Heavy Metal"), _T("Black Metal"),
+ _T("Crossover"), _T("Contemporary C"), _T("Christian Rock"), _T("Merengue"), _T("Salsa"),
+ _T("Thrash Metal"), _T("Anime"), _T("JPop"), _T("SynthPop"),
+};
+
+//
+
+CMpaSplitterFile::CMpaSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr)
+ : CBaseSplitterFileEx(pAsyncReader, hr)
+ , m_mode(none)
+ , m_rtDuration(0)
+ , m_startpos(0)
+ , m_endpos(0)
+ , m_totalbps(0)
+{
+ if(SUCCEEDED(hr)) hr = Init();
+}
+
+HRESULT CMpaSplitterFile::Init()
+{
+ m_startpos = 0;
+ m_endpos = GetLength();
+
+ if(m_endpos > 128)
+ {
+ Seek(m_endpos - 128);
+
+ if(BitRead(24) == 'TAG')
+ {
+ m_endpos -= 128;
+
+ CStringA str;
+
+ // title
+ ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
+ m_tags['TIT2'] = CStringW(str).Trim();
+
+ // artist
+ ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
+ m_tags['TPE1'] = CStringW(str).Trim();
+
+ // album
+ ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
+ m_tags['TALB'] = CStringW(str).Trim();
+
+ // year
+ ByteRead((BYTE*)str.GetBufferSetLength(4), 4);
+ m_tags['TYER'] = CStringW(str).Trim();
+
+ // comment
+ ByteRead((BYTE*)str.GetBufferSetLength(30), 30);
+ m_tags['COMM'] = CStringW(str).Trim();
+
+ // track
+ LPCSTR s = str;
+ if(s[28] == 0 && s[29] != 0)
+ m_tags['TRCK'].Format(L"%d", s[29]);
+
+ // genre
+ BYTE genre = (BYTE)BitRead(8);
+ if(genre < countof(s_genre))
+ m_tags['TCON'] = CStringW(s_genre[genre]);
+ }
+ }
+
+ Seek(0);
+
+ while(BitRead(24, true) == 'ID3')
+ {
+ BitRead(24);
+
+ BYTE major = (BYTE)BitRead(8);
+ BYTE revision = (BYTE)BitRead(8);
+
+ BYTE flags = (BYTE)BitRead(8);
+ DWORD size = 0;
+ if(BitRead(1) != 0) return E_FAIL;
+ size |= BitRead(7) << 21;
+ if(BitRead(1) != 0) return E_FAIL;
+ size |= BitRead(7) << 14;
+ if(BitRead(1) != 0) return E_FAIL;
+ size |= BitRead(7) << 7;
+ if(BitRead(1) != 0) return E_FAIL;
+ size |= BitRead(7);
+
+ m_startpos = GetPos() + size;
+
+ // TODO: read extended header
+
+ if(major <= 4)
+ {
+ __int64 pos = GetPos();
+
+ while(pos < m_startpos)
+ {
+ Seek(pos);
+
+ DWORD tag = (DWORD)BitRead(32);
+ DWORD size = 0;
+ size |= BitRead(8) << 24;
+ size |= BitRead(8) << 16;
+ size |= BitRead(8) << 8;
+ size |= BitRead(8);
+ WORD flags = (WORD)BitRead(16);
+
+ pos += 4+4+2+size;
+
+ if(!size || pos >= m_startpos)
+ break;
+
+ if(tag == 'TIT2'
+ || tag == 'TPE1'
+ || tag == 'TALB'
+ || tag == 'TYER'
+ || tag == 'COMM'
+ || tag == 'TRCK')
+ {
+ BYTE encoding = (BYTE)BitRead(8);
+ size--;
+
+ WORD bom = (WORD)BitRead(16, true);
+
+ CStringA str;
+ CStringW wstr;
+
+ if(encoding > 0 && size >= 2 && bom == 0xfffe)
+ {
+ BitRead(16);
+ ByteRead((BYTE*)wstr.GetBufferSetLength((size-2+1)/2), size);
+ m_tags[tag] = wstr.Trim();
+ }
+ else if(encoding > 0 && size >= 2 && bom == 0xfeff)
+ {
+ BitRead(16);
+ ByteRead((BYTE*)wstr.GetBufferSetLength((size-2+1)/2), size);
+ for(int i = 0, j = wstr.GetLength(); i < j; i++) wstr.SetAt(i, (wstr[i]<<8)|(wstr[i]>>8));
+ m_tags[tag] = wstr.Trim();
+ }
+ else
+ {
+ ByteRead((BYTE*)str.GetBufferSetLength(size), size);
+ m_tags[tag] = (encoding > 0 ? UTF8To16(str) : CStringW(str)).Trim();
+ }
+ }
+ }
+ }
+
+ Seek(m_startpos);
+
+ while(m_startpos < m_endpos && BitRead(8, true) == 0)
+ BitRead(8), m_startpos++;
+ }
+
+ while(m_startpos < m_endpos && BitRead(8, true) == 0)
+ BitRead(8), m_startpos++;
+
+ __int64 searchlen = min(m_endpos - m_startpos, m_startpos > 0 ? 0x200 : 7);
+
+ __int64 startpos;
+
+ Seek(m_startpos);
+
+ if(m_mode == none && Read(m_mpahdr, searchlen, true, &m_mt))
+ {
+ m_mode = mpa;
+
+ startpos = GetPos() - 4;
+
+ // make sure the first frame is followed by another of the same kind (validates m_mpahdr basically)
+ Seek(startpos + m_mpahdr.FrameSize);
+ if(!Sync(4)) m_mode = none;
+ }
+
+ Seek(m_startpos);
+
+ if(m_mode == none && Read(m_aachdr, searchlen, &m_mt))
+ {
+ m_mode = mp4a;
+
+ startpos = GetPos() - (m_aachdr.fcrc?7:9);
+
+ // make sure the first frame is followed by another of the same kind (validates m_aachdr basically)
+ Seek(startpos + m_aachdr.aac_frame_length);
+ if(!Sync(9)) m_mode = none;
+ }
+
+ if(m_mode == none)
+ return E_FAIL;
+
+ m_startpos = startpos;
+
+ int FrameSize;
+ REFERENCE_TIME rtFrameDur, rtPrevDur = -1;
+ clock_t start = clock();
+ int i = 0;
+ while(Sync(FrameSize, rtFrameDur) && (clock() - start) < CLOCKS_PER_SEC)
+ {
+ TRACE(_T("%I64d\n"), m_rtDuration);
+ Seek(GetPos() + FrameSize);
+ i = rtPrevDur == m_rtDuration ? i+1 : 0;
+ if(i == 10) break;
+ rtPrevDur = m_rtDuration;
+ }
+
+ return S_OK;
+}
+
+bool CMpaSplitterFile::Sync(int limit)
+{
+ int FrameSize;
+ REFERENCE_TIME rtDuration;
+ return Sync(FrameSize, rtDuration, limit);
+}
+
+bool CMpaSplitterFile::Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limit)
+{
+ __int64 endpos = min(m_endpos, GetPos() + limit);
+
+ if(m_mode == mpa)
+ {
+ while(GetPos() <= endpos - 4)
+ {
+ mpahdr h;
+
+ if(Read(h, endpos - GetPos(), true)
+ && m_mpahdr.version == h.version
+ && m_mpahdr.layer == h.layer
+ && m_mpahdr.channels == h.channels)
+ {
+ Seek(GetPos() - 4);
+ AdjustDuration(h.nBytesPerSec);
+
+ FrameSize = h.FrameSize;
+ rtDuration = h.rtDuration;
+
+ return true;
+ }
+ }
+ }
+ else if(m_mode == mp4a)
+ {
+ while(GetPos() <= endpos - 9)
+ {
+ aachdr h;
+
+ if(Read(h, endpos - GetPos())
+ && m_aachdr.version == h.version
+ && m_aachdr.layer == h.layer
+ && m_aachdr.channels == h.channels)
+ {
+ Seek(GetPos() - (h.fcrc?7:9));
+ AdjustDuration(h.nBytesPerSec);
+ Seek(GetPos() + (h.fcrc?7:9));
+
+ FrameSize = h.FrameSize;
+ rtDuration = h.rtDuration;
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+void CMpaSplitterFile::AdjustDuration(int nBytesPerSec)
+{
+ ASSERT(nBytesPerSec);
+
+ int rValue;
+ if(!m_pos2bps.Lookup(GetPos(), rValue))
+ {
+ m_totalbps += nBytesPerSec;
+ if(!m_totalbps) return;
+ m_pos2bps.SetAt(GetPos(), nBytesPerSec);
+ __int64 avgbps = m_totalbps / m_pos2bps.GetCount();
+ m_rtDuration = 10000000i64 * (m_endpos - m_startpos) / avgbps;
+ }
+}
diff --git a/src/filters/parser/mpasplitter/MpaSplitterFile.h b/src/filters/parser/mpasplitter/MpaSplitterFile.h
new file mode 100644
index 000000000..d511ae7bb
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitterFile.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+
+class CMpaSplitterFile : public CBaseSplitterFileEx
+{
+ CMediaType m_mt;
+ REFERENCE_TIME m_rtDuration;
+
+ enum {none, mpa, mp4a} m_mode;
+
+ mpahdr m_mpahdr;
+ aachdr m_aachdr;
+ __int64 m_startpos, m_endpos;
+
+ __int64 m_totalbps;
+ CRBMap<__int64, int> m_pos2bps;
+
+ HRESULT Init();
+ void AdjustDuration(int nBytesPerSec);
+
+public:
+ CMpaSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+
+ CAtlMap<DWORD, CStringW> m_tags;
+
+ const CMediaType& GetMediaType() {return m_mt;}
+ REFERENCE_TIME GetDuration() {return m_rtDuration;}
+
+ __int64 GetStartPos() {return m_startpos;}
+ __int64 GetEndPos() {return m_endpos;}
+
+ bool Sync(int limit = 0x2000);
+ bool Sync(int& FrameSize, REFERENCE_TIME& rtDuration, int limit = 0x2000);
+};
diff --git a/src/filters/parser/mpasplitter/MpaSplitter_vs2005.vcproj b/src/filters/parser/mpasplitter/MpaSplitter_vs2005.vcproj
new file mode 100644
index 000000000..4d3764ff7
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitter_vs2005.vcproj
@@ -0,0 +1,815 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="MpaSplitter"
+ ProjectGUID="{C0F7A036-FC2D-40DF-9852-C37518DB6B3E}"
+ RootNamespace="MpaSplitter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="MpaSplitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="MpaSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath=".\MpaSplitterFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\MpaSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MpaSplitterFile.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\MpaSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mpasplitter/MpaSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/mpasplitter/MpaSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/mpasplitter/MpaSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/mpasplitter/resource.h b/src/filters/parser/mpasplitter/resource.h
new file mode 100644
index 000000000..c2fcfb22b
--- /dev/null
+++ b/src/filters/parser/mpasplitter/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by MpaSplitter.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/mpasplitter/stdafx.cpp b/src/filters/parser/mpasplitter/stdafx.cpp
new file mode 100644
index 000000000..8d2e22fce
--- /dev/null
+++ b/src/filters/parser/mpasplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// DiracSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/mpasplitter/stdafx.h b/src/filters/parser/mpasplitter/stdafx.h
new file mode 100644
index 000000000..bf33c5dd2
--- /dev/null
+++ b/src/filters/parser/mpasplitter/stdafx.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include "..\..\..\DSUtil\vd.h"
+
+#pragma warning(disable: 4355) // 'this' : used in base member initializer list
+
+
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter.aps b/src/filters/parser/mpegsplitter/MpegSplitter.aps
new file mode 100644
index 000000000..b6c0a87f2
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitter.aps
Binary files differ
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter.cpp b/src/filters/parser/mpegsplitter/MpegSplitter.cpp
new file mode 100644
index 000000000..630e3c88c
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitter.cpp
@@ -0,0 +1,731 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include <initguid.h>
+#include "MpegSplitter.h"
+#include "..\..\..\..\include\moreuuids.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1System},
+// {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1VideoCD}, // cdxa filter should take care of this
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_PROGRAM},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_TRANSPORT},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_PVA},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL},
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CMpegSplitterFilter), L"Mpeg Splitter", MERIT_NORMAL+1 /*MERIT_DO_NOT_USE*/, countof(sudpPins), sudpPins},
+ {&__uuidof(CMpegSourceFilter), L"Mpeg Source", MERIT_DO_NOT_USE, 0, NULL},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMpegSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CMpegSourceFilter>, NULL, &sudFilter[1]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG1System, _T("0,16,FFFFFFFFF100010001800001FFFFFFFF,000001BA2100010001800001000001BB"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_PROGRAM, _T("0,5,FFFFFFFFC0,000001BA40"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_TRANSPORT, _T("0,1,,47,188,1,,47,376,1,,47"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_TRANSPORT, _T("4,1,,47,196,1,,47,388,1,,47"), NULL);
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_MPEG2_PVA, _T("0,8,fffffc00ffe00000,4156000055000000"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+// UnRegisterSourceFilter(MEDIASUBTYPE_MPEG1System);
+// UnRegisterSourceFilter(MEDIASUBTYPE_MPEG2_PROGRAM);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CMpegSplitterFilter
+//
+
+CMpegSplitterFilter::CMpegSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
+ : CBaseSplitterFilter(NAME("CMpegSplitterFilter"), pUnk, phr, clsid)
+{
+}
+
+STDMETHODIMP CMpegSplitterFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IAMStreamSelect)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+//
+
+HRESULT CMpegSplitterFilter::DemuxNextPacket(REFERENCE_TIME rtStartOffset)
+{
+ HRESULT hr;
+ BYTE b;
+
+ if(m_pFile->m_type == CMpegSplitterFile::ps || m_pFile->m_type == CMpegSplitterFile::es)
+ {
+ if(!m_pFile->NextMpegStartCode(b))
+ return S_FALSE;
+
+ if(b == 0xba) // program stream header
+ {
+ CMpegSplitterFile::pshdr h;
+ if(!m_pFile->Read(h)) return S_FALSE;
+ }
+ else if(b == 0xbb) // program stream system header
+ {
+ CMpegSplitterFile::pssyshdr h;
+ if(!m_pFile->Read(h)) return S_FALSE;
+ }
+ else if(b >= 0xbd && b < 0xf0) // pes packet
+ {
+ CMpegSplitterFile::peshdr h;
+ if(!m_pFile->Read(h, b) || !h.len) return S_FALSE;
+
+ if(h.type == CMpegSplitterFile::mpeg2 && h.scrambling) {ASSERT(0); return E_FAIL;}
+
+ __int64 pos = m_pFile->GetPos();
+
+ DWORD TrackNumber = m_pFile->AddStream(0, b, h.len);
+
+ if(GetOutputPin(TrackNumber))
+ {
+ CAutoPtr<Packet> p(new Packet());
+ p->TrackNumber = TrackNumber;
+ p->bSyncPoint = !!h.fpts;
+ p->bAppendable = !h.fpts;
+ p->rtStart = h.fpts ? (h.pts - rtStartOffset) : Packet::INVALID_TIME;
+ p->rtStop = p->rtStart+1;
+ p->SetCount(h.len - (m_pFile->GetPos() - pos));
+ m_pFile->ByteRead(p->GetData(), h.len - (m_pFile->GetPos() - pos));
+ hr = DeliverPacket(p);
+ }
+
+ m_pFile->Seek(pos + h.len);
+ }
+ }
+ else if(m_pFile->m_type == CMpegSplitterFile::ts)
+ {
+ CMpegSplitterFile::trhdr h;
+ if(!m_pFile->Read(h))
+ return S_FALSE;
+
+ //if(h.scrambling) {ASSERT(0); m_pFile->Seek(h.next); return S_FALSE;}
+
+ __int64 pos = m_pFile->GetPos();
+
+ if(h.payload && h.payloadstart)
+ {
+ m_pFile->UpdatePrograms(h);
+ }
+
+ if(h.payload && h.pid >= 16 && h.pid < 0x1fff && !h.scrambling)
+ {
+ DWORD TrackNumber = h.pid;
+
+ CMpegSplitterFile::peshdr h2;
+ if(h.payloadstart && m_pFile->NextMpegStartCode(b, 4) && m_pFile->Read(h2, b)) // pes packet
+ {
+ if(h2.type == CMpegSplitterFile::mpeg2 && h2.scrambling) {ASSERT(0); return E_FAIL;}
+ TrackNumber = m_pFile->AddStream(h.pid, b, h.bytes - (m_pFile->GetPos() - pos));
+ }
+
+ if(GetOutputPin(TrackNumber))
+ {
+ CAutoPtr<Packet> p(new Packet());
+ p->TrackNumber = TrackNumber;
+ p->bSyncPoint = !!h2.fpts;
+ p->bAppendable = !h2.fpts;
+ p->rtStart = h2.fpts ? (h2.pts - rtStartOffset) : Packet::INVALID_TIME;
+ p->rtStop = p->rtStart+1;
+ p->SetCount(h.bytes - (m_pFile->GetPos() - pos));
+ m_pFile->ByteRead(p->GetData(), h.bytes - (m_pFile->GetPos() - pos));
+ hr = DeliverPacket(p);
+ }
+ }
+
+ m_pFile->Seek(h.next);
+ }
+ else if(m_pFile->m_type == CMpegSplitterFile::pva)
+ {
+ CMpegSplitterFile::pvahdr h;
+ if(!m_pFile->Read(h))
+ return S_FALSE;
+
+ DWORD TrackNumber = h.streamid;
+
+ __int64 pos = m_pFile->GetPos();
+
+ if(GetOutputPin(TrackNumber))
+ {
+ CAutoPtr<Packet> p(new Packet());
+ p->TrackNumber = TrackNumber;
+ p->bSyncPoint = !!h.fpts;
+ p->bAppendable = !h.fpts;
+ p->rtStart = h.fpts ? (h.pts - rtStartOffset) : Packet::INVALID_TIME;
+ p->rtStop = p->rtStart+1;
+ p->SetCount(h.length);
+ m_pFile->ByteRead(p->GetData(), h.length);
+ hr = DeliverPacket(p);
+ }
+
+ m_pFile->Seek(pos + h.length);
+ }
+
+ return S_OK;
+}
+
+//
+
+HRESULT CMpegSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ m_pFile.Attach(new CMpegSplitterFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ //
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ for(int i = 0; i < countof(m_pFile->m_streams); i++)
+ {
+ POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
+ while(pos)
+ {
+ CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetNext(pos);
+
+ CAtlArray<CMediaType> mts;
+ mts.Add(s.mt);
+
+ CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
+
+ HRESULT hr;
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CMpegSplitterOutputPin(mts, name, this, this, &hr));
+ if(S_OK == AddOutputPin(s, pPinOut))
+ break;
+ }
+ }
+
+ m_rtNewStop = m_rtStop = m_rtDuration = m_pFile->IsStreaming() ? 0 : 10000000i64 * m_pFile->GetLength() / m_pFile->m_rate;
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool CMpegSplitterFilter::DemuxInit()
+{
+ if(!m_pFile) return(false);
+
+ m_rtStartOffset = 0;
+
+ return(true);
+}
+
+void CMpegSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ CAtlList<CMpegSplitterFile::stream>* pMasterStream =
+ !m_pFile->m_streams[CMpegSplitterFile::video].IsEmpty() ? &m_pFile->m_streams[CMpegSplitterFile::video] :
+ !m_pFile->m_streams[CMpegSplitterFile::audio].IsEmpty() ? &m_pFile->m_streams[CMpegSplitterFile::audio] :
+ !m_pFile->m_streams[CMpegSplitterFile::subpic].IsEmpty() ? &m_pFile->m_streams[CMpegSplitterFile::subpic] :
+ NULL;
+
+ if(!pMasterStream) {ASSERT(0); return;}
+
+ if(m_pFile->IsStreaming())
+ {
+ m_pFile->Seek(max(0, m_pFile->GetLength() - 100*1024));
+ m_rtStartOffset = m_pFile->m_rtMin + m_pFile->NextPTS(pMasterStream->GetHead());
+ return;
+ }
+
+ REFERENCE_TIME rtPreroll = 10000000;
+
+ if(rt <= rtPreroll || m_rtDuration <= 0)
+ {
+ m_pFile->Seek(0);
+ }
+ else
+ {
+ __int64 len = m_pFile->GetLength();
+ __int64 seekpos = (__int64)(1.0*rt/m_rtDuration*len);
+ __int64 minseekpos = _I64_MAX;
+
+ REFERENCE_TIME rtmax = rt - rtPreroll;
+ REFERENCE_TIME rtmin = rtmax - 5000000;
+
+ if(m_rtStartOffset == 0)
+ for(int i = 0; i < countof(m_pFile->m_streams)-1; i++)
+ {
+ POSITION pos = m_pFile->m_streams[i].GetHeadPosition();
+ while(pos)
+ {
+ DWORD TrackNum = m_pFile->m_streams[i].GetNext(pos);
+
+ CBaseSplitterOutputPin* pPin = GetOutputPin(TrackNum);
+ if(pPin && pPin->IsConnected())
+ {
+ m_pFile->Seek(seekpos);
+
+ REFERENCE_TIME pdt = _I64_MIN;
+
+ for(int j = 0; j < 10; j++)
+ {
+ REFERENCE_TIME rt = m_pFile->NextPTS(TrackNum);
+ // TRACE(_T("[%d/%04x]: rt=%I64d, fp=%I64d\n"), i, TrackNum, rt, m_pFile->GetPos());
+
+ if(rt < 0) break;
+
+ REFERENCE_TIME dt = rt - rtmax;
+ if(dt > 0 && dt == pdt) dt = 10000000i64;
+
+ // TRACE(_T("dt=%I64d\n"), dt);
+
+ if(rtmin <= rt && rt <= rtmax || pdt > 0 && dt < 0)
+ {
+ // TRACE(_T("minseekpos: %I64d -> "), minseekpos);
+ minseekpos = min(minseekpos, m_pFile->GetPos());
+ // TRACE(_T("%I64d\n"), minseekpos);
+ break;
+ }
+
+ m_pFile->Seek(m_pFile->GetPos() - (__int64)(1.0*dt/m_rtDuration*len));
+
+ pdt = dt;
+ }
+ }
+ }
+ }
+
+ if(minseekpos != _I64_MAX)
+ {
+ seekpos = minseekpos;
+ }
+ else
+ {
+ // this file is probably screwed up, try plan B, seek simply by bitrate
+
+ rt -= rtPreroll;
+ seekpos = (__int64)(1.0*rt/m_rtDuration*len);
+ m_pFile->Seek(seekpos);
+ m_rtStartOffset = m_pFile->m_rtMin + m_pFile->NextPTS(pMasterStream->GetHead()) - rt;
+ }
+
+ m_pFile->Seek(seekpos);
+ }
+}
+
+bool CMpegSplitterFilter::DemuxLoop()
+{
+ REFERENCE_TIME rtStartOffset = m_rtStartOffset ? m_rtStartOffset : m_pFile->m_rtMin;
+
+ HRESULT hr = S_OK;
+ while(SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ if((hr = m_pFile->HasMoreData(1024*500)) == S_OK)
+ if((hr = DemuxNextPacket(rtStartOffset)) == S_FALSE)
+ Sleep(1);
+ }
+
+ return(true);
+}
+
+// IAMStreamSelect
+
+STDMETHODIMP CMpegSplitterFilter::Count(DWORD* pcStreams)
+{
+ CheckPointer(pcStreams, E_POINTER);
+
+ *pcStreams = 0;
+
+ for(int i = 0; i < countof(m_pFile->m_streams); i++)
+ (*pcStreams) += m_pFile->m_streams[i].GetCount();
+
+ return S_OK;
+}
+
+STDMETHODIMP CMpegSplitterFilter::Enable(long lIndex, DWORD dwFlags)
+{
+ if(!(dwFlags & AMSTREAMSELECTENABLE_ENABLE))
+ return E_NOTIMPL;
+
+ for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++)
+ {
+ int cnt = m_pFile->m_streams[i].GetCount();
+
+ if(lIndex >= j && lIndex < j+cnt)
+ {
+ lIndex -= j;
+
+ POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
+ if(!pos) return E_UNEXPECTED;
+
+ CMpegSplitterFile::stream& to = m_pFile->m_streams[i].GetAt(pos);
+
+ pos = m_pFile->m_streams[i].GetHeadPosition();
+ while(pos)
+ {
+ CMpegSplitterFile::stream& from = m_pFile->m_streams[i].GetNext(pos);
+ if(!GetOutputPin(from)) continue;
+
+ HRESULT hr;
+ if(FAILED(hr = RenameOutputPin(from, to, &to.mt)))
+ return hr;
+
+ if(const CMpegSplitterFile::program* p = m_pFile->FindProgram(to.pid))
+ {
+ for(int k = 0; k < countof(m_pFile->m_streams); k++)
+ {
+ if(k == i) continue;
+
+ pos = m_pFile->m_streams[k].GetHeadPosition();
+ while(pos)
+ {
+ CMpegSplitterFile::stream& from = m_pFile->m_streams[k].GetNext(pos);
+ if(!GetOutputPin(from)) continue;
+
+ for(int l = 0; l < countof(p->pid); l++)
+ {
+ if(const CMpegSplitterFile::stream* s = m_pFile->m_streams[k].FindStream(p->pid[l]))
+ {
+ if(from != *s) hr = RenameOutputPin(from, *s, &s->mt);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return S_OK;
+ }
+ }
+
+ j += cnt;
+ }
+
+ return S_FALSE;
+}
+
+STDMETHODIMP CMpegSplitterFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk)
+{
+ for(int i = 0, j = 0; i < countof(m_pFile->m_streams); i++)
+ {
+ int cnt = m_pFile->m_streams[i].GetCount();
+
+ if(lIndex >= j && lIndex < j+cnt)
+ {
+ lIndex -= j;
+
+ POSITION pos = m_pFile->m_streams[i].FindIndex(lIndex);
+ if(!pos) return E_UNEXPECTED;
+
+ CMpegSplitterFile::stream& s = m_pFile->m_streams[i].GetAt(pos);
+
+ if(ppmt) *ppmt = CreateMediaType(&s.mt);
+ if(pdwFlags) *pdwFlags = GetOutputPin(s) ? (AMSTREAMSELECTINFO_ENABLED|AMSTREAMSELECTINFO_EXCLUSIVE) : 0;
+ if(plcid) *plcid = 0;
+ if(pdwGroup) *pdwGroup = i;
+ if(ppObject) *ppObject = NULL;
+ if(ppUnk) *ppUnk = NULL;
+
+ if(ppszName)
+ {
+ CStringW name = CMpegSplitterFile::CStreamList::ToString(i);
+
+ CStringW str;
+ str.Format(L"%s (%04x,%02x,%02x)", name, s.pid, s.pesid, s.ps1id); // TODO: make this nicer
+
+ *ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
+ if(*ppszName == NULL) return E_OUTOFMEMORY;
+ wcscpy(*ppszName, str);
+ }
+ }
+
+ j += cnt;
+ }
+
+ return S_OK;
+}
+
+//
+// CMpegSourceFilter
+//
+
+CMpegSourceFilter::CMpegSourceFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid)
+ : CMpegSplitterFilter(pUnk, phr, clsid)
+{
+ m_pInput.Free();
+}
+
+//
+// CMpegSplitterOutputPin
+//
+
+CMpegSplitterOutputPin::CMpegSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+{
+}
+
+CMpegSplitterOutputPin::~CMpegSplitterOutputPin()
+{
+}
+
+HRESULT CMpegSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ {
+ CAutoLock cAutoLock(this);
+ m_rtPrev = Packet::INVALID_TIME;
+ m_rtOffset = 0;
+ }
+
+ return __super::DeliverNewSegment(tStart, tStop, dRate);
+}
+
+HRESULT CMpegSplitterOutputPin::DeliverEndFlush()
+{
+ {
+ CAutoLock cAutoLock(this);
+ m_p.Free();
+ m_pl.RemoveAll();
+ }
+
+ return __super::DeliverEndFlush();
+}
+
+HRESULT CMpegSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
+{
+ CAutoLock cAutoLock(this);
+
+ if(p->rtStart != Packet::INVALID_TIME)
+ {
+ REFERENCE_TIME rt = p->rtStart + m_rtOffset;
+
+ if(m_rtPrev != Packet::INVALID_TIME)
+ if(abs(rt - m_rtPrev) > 50000000)
+ m_rtOffset += m_rtPrev - rt;
+
+ p->rtStart += m_rtOffset;
+ p->rtStop += m_rtOffset;
+TRACE(_T("%I64d, %I64d (%I64d)\n"), p->rtStart, m_rtPrev, m_rtOffset);
+ m_rtPrev = p->rtStart;
+ }
+
+ if(m_mt.subtype == MEDIASUBTYPE_AAC) // special code for aac, the currently available decoders only like whole frame samples
+ {
+ if(m_p && m_p->GetCount() == 1 && m_p->GetAt(0) == 0xff
+ && !(!p->IsEmpty() && (p->GetAt(0) & 0xf6) == 0xf0))
+ m_p.Free();
+
+ if(!m_p)
+ {
+ BYTE* base = p->GetData();
+ BYTE* s = base;
+ BYTE* e = s + p->GetCount();
+
+ for(; s < e; s++)
+ {
+ if(*s != 0xff) continue;
+
+ if(s == e-1 || (s[1]&0xf6) == 0xf0)
+ {
+ memmove(base, s, e - s);
+ p->SetCount(e - s);
+ m_p = p;
+ break;
+ }
+ }
+ }
+ else
+ {
+ m_p->Append(*p);
+ }
+
+ while(m_p && m_p->GetCount() > 9)
+ {
+ BYTE* base = m_p->GetData();
+ BYTE* s = base;
+ BYTE* e = s + m_p->GetCount();
+ //bool layer0 = ((s[3]>>1)&3) == 0;
+ int len = ((s[3]&3)<<11)|(s[4]<<3)|(s[5]>>5);
+ bool crc = !(s[1]&1);
+ s += 7; len -= 7;
+ if(crc) s += 2, len -= 2;
+
+ if(e - s < len)
+ {
+ break;
+ }
+
+ if(len <= 0 || e - s >= len + 2 && (s[len] != 0xff || (s[len+1]&0xf6) != 0xf0))
+ {
+ m_p.Free();
+ break;
+ }
+
+ CAutoPtr<Packet> p(new Packet());
+ p->TrackNumber = m_p->TrackNumber;
+ p->bDiscontinuity |= m_p->bDiscontinuity; m_p->bDiscontinuity = false;
+ p->bSyncPoint = m_p->rtStart != Packet::INVALID_TIME;
+ p->rtStart = m_p->rtStart; m_p->rtStart = Packet::INVALID_TIME;
+ p->rtStop = m_p->rtStop; m_p->rtStop = Packet::INVALID_TIME;
+ p->pmt = m_p->pmt; m_p->pmt = NULL;
+ p->SetData(s, len);
+ s += len;
+ memmove(base, s, e - s);
+ m_p->SetCount(e - s);
+
+ HRESULT hr = __super::DeliverPacket(p);
+ if(hr != S_OK) return hr;
+ }
+
+ if(m_p && p)
+ {
+ if(!m_p->bDiscontinuity) m_p->bDiscontinuity = p->bDiscontinuity;
+ if(!m_p->bSyncPoint) m_p->bSyncPoint = p->bSyncPoint;
+ if(m_p->rtStart == Packet::INVALID_TIME) m_p->rtStart = p->rtStart, m_p->rtStop = p->rtStop;
+ if(m_p->pmt) DeleteMediaType(m_p->pmt); m_p->pmt = p->pmt; p->pmt = NULL;
+ }
+
+ return S_OK;
+ }
+ else if(m_mt.subtype == FOURCCMap('1CVA') || m_mt.subtype == FOURCCMap('1cva')) // just like aac, this has to be starting nalus, more can be packed together
+ {
+ if(!m_p)
+ {
+ m_p.Attach(new Packet());
+ m_p->TrackNumber = p->TrackNumber;
+ m_p->bDiscontinuity = p->bDiscontinuity; p->bDiscontinuity = FALSE;
+ m_p->bSyncPoint = p->bSyncPoint; p->bSyncPoint = FALSE;
+ m_p->rtStart = p->rtStart; p->rtStart = Packet::INVALID_TIME;
+ m_p->rtStop = p->rtStop; p->rtStop = Packet::INVALID_TIME;
+ }
+
+ m_p->Append(*p);
+
+ BYTE* start = m_p->GetData();
+ BYTE* end = start + m_p->GetCount();
+
+ while(start <= end-4 && *(DWORD*)start != 0x01000000) start++;
+
+ while(start <= end-4)
+ {
+ BYTE* next = start+1;
+
+ while(next <= end-4 && *(DWORD*)next != 0x01000000) next++;
+
+ if(next >= end-4) break;
+
+ int size = next - start - 4;
+
+ *(DWORD*)start =
+ ((size >> 24) & 0x000000ff) |
+ ((size >> 8) & 0x0000ff00) |
+ ((size << 8) & 0x00ff0000) |
+ ((size << 24) & 0xff000000);
+
+ CAutoPtr<Packet> p2(new Packet());
+ p2->TrackNumber = m_p->TrackNumber;
+ p2->bDiscontinuity = m_p->bDiscontinuity; m_p->bDiscontinuity = FALSE;
+ p2->bSyncPoint = m_p->bSyncPoint; m_p->bSyncPoint = FALSE;
+ p2->rtStart = m_p->rtStart; m_p->rtStart = Packet::INVALID_TIME;
+ p2->rtStop = m_p->rtStop; m_p->rtStop = Packet::INVALID_TIME;
+ p2->pmt = m_p->pmt; m_p->pmt = NULL;
+ p2->SetData(start, next - start);
+ m_pl.AddTail(p2);
+
+ if(p->rtStart != Packet::INVALID_TIME) {m_p->rtStart = p->rtStart; m_p->rtStop = p->rtStop; p->rtStart = Packet::INVALID_TIME;}
+ if(p->bDiscontinuity) {m_p->bDiscontinuity = p->bDiscontinuity; p->bDiscontinuity = FALSE;}
+ if(p->bSyncPoint) {m_p->bSyncPoint = p->bSyncPoint; p->bSyncPoint = FALSE;}
+ if(m_p->pmt) DeleteMediaType(m_p->pmt); m_p->pmt = p->pmt; p->pmt = NULL;
+
+ start = next;
+ }
+
+ if(start > m_p->GetData())
+ {
+ m_p->RemoveAt(0, start - m_p->GetData());
+ }
+
+ for(POSITION pos = m_pl.GetHeadPosition(); pos; m_pl.GetNext(pos))
+ {
+ if(pos == m_pl.GetHeadPosition())
+ continue;
+
+ Packet* pPacket = m_pl.GetAt(pos);
+ BYTE* pData = pPacket->GetData();
+
+ if(pPacket->rtStart != Packet::INVALID_TIME || (pData[4]&0x1f) == 0x09)
+ {
+ p = m_pl.RemoveHead();
+
+ while(pos != m_pl.GetHeadPosition())
+ {
+ CAutoPtr<Packet> p2 = m_pl.RemoveHead();
+ p->Append(*p2);
+ }
+
+ HRESULT hr = __super::DeliverPacket(p);
+ if(hr != S_OK) return hr;
+ }
+ }
+
+ return S_OK;
+ }
+ else
+ {
+ m_p.Free();
+ m_pl.RemoveAll();
+ }
+
+ return __super::DeliverPacket(p);
+}
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter.def b/src/filters/parser/mpegsplitter/MpegSplitter.def
new file mode 100644
index 000000000..f0116ff1b
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "MpegSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter.h b/src/filters/parser/mpegsplitter/MpegSplitter.h
new file mode 100644
index 000000000..4e0790b8f
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitter.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+#include "MpegSplitterFile.h"
+
+[uuid("DC257063-045F-4BE2-BD5B-E12279C464F0")]
+class CMpegSplitterFilter : public CBaseSplitterFilter, public IAMStreamSelect
+{
+ REFERENCE_TIME m_rtStartOffset;
+
+protected:
+ CAutoPtr<CMpegSplitterFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+ HRESULT DemuxNextPacket(REFERENCE_TIME rtStartOffset);
+
+public:
+ CMpegSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid = __uuidof(CMpegSplitterFilter));
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IAMStreamSelect
+
+ STDMETHODIMP Count(DWORD* pcStreams);
+ STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
+ STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
+};
+
+[uuid("1365BE7A-C86A-473C-9A41-C0A6E82C9FA3")]
+class CMpegSourceFilter : public CMpegSplitterFilter
+{
+public:
+ CMpegSourceFilter(LPUNKNOWN pUnk, HRESULT* phr, const CLSID& clsid = __uuidof(CMpegSourceFilter));
+};
+
+class CMpegSplitterOutputPin : public CBaseSplitterOutputPin, protected CCritSec
+{
+ CAutoPtr<Packet> m_p;
+ CAutoPtrList<Packet> m_pl;
+ REFERENCE_TIME m_rtPrev, m_rtOffset;
+
+protected:
+ HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ HRESULT DeliverPacket(CAutoPtr<Packet> p);
+ HRESULT DeliverEndFlush();
+
+public:
+ CMpegSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CMpegSplitterOutputPin();
+};
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter.rc b/src/filters/parser/mpegsplitter/MpegSplitter.rc
new file mode 100644
index 000000000..ce768c225
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,3
+ PRODUCTVERSION 1,0,0,3
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Mpeg Splitter"
+ VALUE "FileVersion", "1, 0, 0, 3"
+ VALUE "InternalName", "Mpeg Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "MpegSplitter.ax"
+ VALUE "ProductName", "Mpeg Splitter"
+ VALUE "ProductVersion", "1, 0, 0, 3"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter.sln b/src/filters/parser/mpegsplitter/MpegSplitter.sln
new file mode 100644
index 000000000..f3c29d651
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitter.sln
@@ -0,0 +1,94 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpegSplitter", "MpegSplitter.vcproj", "{4628C665-EDE4-40d2-B525-32BE8B8551C8}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {4628C665-EDE4-40d2-B525-32BE8B8551C8}.Debug.ActiveCfg = Debug|Win32
+ {4628C665-EDE4-40d2-B525-32BE8B8551C8}.Debug lib.ActiveCfg = Debug lib|Win32
+ {4628C665-EDE4-40d2-B525-32BE8B8551C8}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4628C665-EDE4-40d2-B525-32BE8B8551C8}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {4628C665-EDE4-40d2-B525-32BE8B8551C8}.Release.ActiveCfg = Release|Win32
+ {4628C665-EDE4-40d2-B525-32BE8B8551C8}.Release lib.ActiveCfg = Release lib|Win32
+ {4628C665-EDE4-40d2-B525-32BE8B8551C8}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4628C665-EDE4-40d2-B525-32BE8B8551C8}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter.vcproj b/src/filters/parser/mpegsplitter/MpegSplitter.vcproj
new file mode 100644
index 000000000..71dfac79d
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitter.vcproj
@@ -0,0 +1,558 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="MpegSplitter"
+ ProjectGUID="{4628C665-EDE4-40D2-B525-32BE8B8551C8}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="MpegSplitter.cpp">
+ </File>
+ <File
+ RelativePath="MpegSplitter.def">
+ </File>
+ <File
+ RelativePath=".\MpegSplitterFile.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\MpegSplitter.h">
+ </File>
+ <File
+ RelativePath=".\MpegSplitterFile.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\MpegSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mpegsplitter/MpegSplitterFile.cpp b/src/filters/parser/mpegsplitter/MpegSplitterFile.cpp
new file mode 100644
index 000000000..956855715
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitterFile.cpp
@@ -0,0 +1,605 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmreg.h>
+#include "MpegSplitterFile.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#define MEGABYTE 1024*1024
+#define ISVALIDPID(pid) (pid >= 0x10 && pid < 0x1fff)
+
+CMpegSplitterFile::CMpegSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr)
+ : CBaseSplitterFileEx(pAsyncReader, hr)
+ , m_type(us)
+ , m_rate(0)
+{
+ if(SUCCEEDED(hr)) hr = Init();
+}
+
+HRESULT CMpegSplitterFile::Init()
+{
+ HRESULT hr;
+
+ // get the type first
+
+ m_type = us;
+
+ Seek(0);
+
+ if(m_type == us)
+ {
+ int cnt = 0, limit = 4;
+ for(trhdr h; cnt < limit && Read(h); cnt++) Seek(h.next);
+ if(cnt >= limit) m_type = ts;
+ }
+
+ Seek(0);
+
+ if(m_type == us)
+ {
+ int cnt = 0, limit = 4;
+ for(pvahdr h; cnt < limit && Read(h); cnt++) Seek(GetPos() + h.length);
+ if(cnt >= limit) m_type = pva;
+ }
+
+ Seek(0);
+
+ if(m_type == us)
+ {
+ BYTE b;
+ for(int i = 0; (i < 4 || GetPos() < 65536) && m_type == us && NextMpegStartCode(b); i++)
+ {
+ if(b == 0xba)
+ {
+ pshdr h;
+ if(Read(h))
+ {
+ m_type = ps;
+ m_rate = h.bitrate/8;
+ break;
+ }
+ }
+ else if((b&0xe0) == 0xc0 // audio, 110xxxxx, mpeg1/2/3
+ || (b&0xf0) == 0xe0 // video, 1110xxxx, mpeg1/2
+ // || (b&0xbd) == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
+ || b == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
+ {
+ peshdr h;
+ if(Read(h, b) && BitRead(24, true) == 0x000001)
+ {
+ m_type = es;
+ }
+ }
+ }
+ }
+
+ Seek(0);
+
+ if(m_type == us)
+ {
+ return E_FAIL;
+ }
+
+ //
+
+ if(IsStreaming())
+ {
+ for(int i = 0; i < 50 && GetLength() < 1024*100 || i < 20; i++)
+ Sleep(100);
+ }
+
+ // min/max pts & bitrate
+
+ m_rtMin = m_posMin = _I64_MAX;
+ m_rtMax = m_posMax = 0;
+
+ CAtlList<__int64> fps;
+ for(int i = 0, j = 5; i <= j; i++)
+ fps.AddTail(i*GetLength()/j);
+
+ for(__int64 pfp = 0; fps.GetCount(); )
+ {
+ __int64 fp = fps.RemoveHead();
+ fp = min(GetLength() - MEGABYTE/8, fp);
+ fp = max(pfp, fp);
+ __int64 nfp = fp + (pfp == 0 ? 5*MEGABYTE : MEGABYTE/8);
+ if(FAILED(hr = SearchStreams(fp, nfp)))
+ return hr;
+ pfp = nfp;
+ }
+
+ if(m_posMax - m_posMin <= 0 || m_rtMax - m_rtMin <= 0)
+ return E_FAIL;
+
+ int indicated_rate = m_rate;
+ int detected_rate = 10000000i64 * (m_posMax - m_posMin) / (m_rtMax - m_rtMin);
+ // normally "detected" should always be less than "indicated", but sometimes it can be a few percent higher (+10% is allowed here)
+ // (update: also allowing +/-50k/s)
+ if(indicated_rate == 0 || ((float)detected_rate / indicated_rate) < 1.1
+ || abs(detected_rate - indicated_rate) < 50*1024)
+ m_rate = detected_rate;
+ else ; // TODO: in this case disable seeking, or try doing something less drastical...
+
+#ifndef DEBUG
+ if(m_streams[video].GetCount() || m_streams[subpic].GetCount())
+ {
+ stream s;
+ s.mt.majortype = MEDIATYPE_Video;
+ s.mt.subtype = MEDIASUBTYPE_DVD_SUBPICTURE;
+ s.mt.formattype = FORMAT_None;
+ m_streams[subpic].Insert(s);
+ }
+#endif
+
+ Seek(0);
+
+ return S_OK;
+}
+
+REFERENCE_TIME CMpegSplitterFile::NextPTS(DWORD TrackNum)
+{
+ REFERENCE_TIME rt = -1;
+ __int64 rtpos = -1;
+
+ BYTE b;
+
+ while(GetPos() < GetLength())
+ {
+ if(m_type == ps || m_type == es)
+ {
+ if(!NextMpegStartCode(b)) // continue;
+ {ASSERT(0); break;}
+
+ rtpos = GetPos()-4;
+
+ if(b >= 0xbd && b < 0xf0)
+ {
+ peshdr h;
+ if(!Read(h, b) || !h.len) continue;
+
+ __int64 pos = GetPos();
+
+ if(h.fpts && AddStream(0, b, h.len) == TrackNum)
+ {
+ ASSERT(h.pts >= m_rtMin && h.pts <= m_rtMax);
+ rt = h.pts;
+ break;
+ }
+
+ Seek(pos + h.len);
+ }
+ }
+ else if(m_type == ts)
+ {
+ trhdr h;
+ if(!Read(h)) continue;
+
+ rtpos = GetPos()-4;
+
+ if(h.payload && h.payloadstart && ISVALIDPID(h.pid))
+ {
+ peshdr h2;
+ if(NextMpegStartCode(b, 4) && Read(h2, b)) // pes packet
+ {
+ if(h2.fpts && AddStream(h.pid, b, h.bytes - (GetPos() - rtpos)) == TrackNum)
+ {
+ ASSERT(h2.pts >= m_rtMin && h2.pts <= m_rtMax);
+ rt = h2.pts;
+ break;
+ }
+ }
+ }
+
+ Seek(h.next);
+ }
+ else if(m_type == pva)
+ {
+ pvahdr h;
+ if(!Read(h)) continue;
+
+ if(h.fpts)
+ {
+ rt = h.pts;
+ break;
+ }
+ }
+ }
+
+ if(rtpos >= 0) Seek(rtpos);
+ if(rt >= 0) rt -= m_rtMin;
+
+ return rt;
+}
+
+HRESULT CMpegSplitterFile::SearchStreams(__int64 start, __int64 stop)
+{
+ Seek(start);
+ stop = min(stop, GetLength());
+
+ while(GetPos() < stop)
+ {
+ BYTE b;
+
+ if(m_type == ps || m_type == es)
+ {
+ if(!NextMpegStartCode(b)) continue;
+
+ if(b == 0xba) // program stream header
+ {
+ pshdr h;
+ if(!Read(h)) continue;
+ }
+ else if(b == 0xbb) // program stream system header
+ {
+ pssyshdr h;
+ if(!Read(h)) continue;
+ }
+ else if(b >= 0xbd && b < 0xf0) // pes packet
+ {
+ peshdr h;
+ if(!Read(h, b)) continue;
+
+ if(h.type == mpeg2 && h.scrambling) {ASSERT(0); return E_FAIL;}
+
+ if(h.fpts)
+ {
+ if(m_rtMin == _I64_MAX) {m_rtMin = h.pts; m_posMin = GetPos();}
+ if(m_rtMin < h.pts && m_rtMax < h.pts) {m_rtMax = h.pts; m_posMax = GetPos();}
+/*
+int rate = 10000000i64 * (m_posMax - m_posMin) / (m_rtMax - m_rtMin);
+if(m_rate == 0) m_rate = rate;
+TRACE(_T("rate = %d (%d), (h.pts = %I64d)\n"), rate, rate - m_rate, h.pts);
+m_rate = rate;
+*/
+ }
+
+ __int64 pos = GetPos();
+ AddStream(0, b, h.len);
+ if(h.len) Seek(pos + h.len);
+ }
+ }
+ else if(m_type == ts)
+ {
+ trhdr h;
+ if(!Read(h)) continue;
+
+ // if(h.scrambling) {ASSERT(0); return E_FAIL;}
+
+ __int64 pos = GetPos();
+
+ if(h.payload && h.payloadstart)
+ {
+ UpdatePrograms(h);
+ }
+
+ if(h.payload && ISVALIDPID(h.pid))
+ {
+ peshdr h2;
+ if(h.payloadstart && NextMpegStartCode(b, 4) && Read(h2, b)) // pes packet
+ {
+ if(h2.type == mpeg2 && h2.scrambling) {ASSERT(0); return E_FAIL;}
+
+ if(h2.fpts)
+ {
+ if(m_rtMin == _I64_MAX) {m_rtMin = h2.pts; m_posMin = GetPos();}
+ if(m_rtMin < h2.pts && m_rtMax < h2.pts) {m_rtMax = h2.pts; m_posMax = GetPos();}
+ }
+ }
+ else
+ {
+ b = 0;
+ }
+
+ AddStream(h.pid, b, h.bytes - (GetPos() - pos));
+ }
+
+ Seek(h.next);
+ }
+ else if(m_type == pva)
+ {
+ pvahdr h;
+ if(!Read(h)) continue;
+
+ if(h.fpts)
+ {
+ if(m_rtMin == _I64_MAX) {m_rtMin = h.pts; m_posMin = GetPos();}
+ if(m_rtMin < h.pts && m_rtMax < h.pts) {m_rtMax = h.pts; m_posMax = GetPos();}
+ }
+
+ __int64 pos = GetPos();
+ if(h.streamid == 1) AddStream(h.streamid, 0xe0, h.length);
+ else if(h.streamid == 2) AddStream(h.streamid, 0xc0, h.length);
+ if(h.length) Seek(pos + h.length);
+ }
+ }
+
+ return S_OK;
+}
+
+DWORD CMpegSplitterFile::AddStream(WORD pid, BYTE pesid, DWORD len)
+{
+ if(pid)
+ {
+ if(pesid) m_pid2pes[pid] = pesid;
+ else m_pid2pes.Lookup(pid, pesid);
+ }
+
+ stream s;
+ s.pid = pid;
+ s.pesid = pesid;
+
+ int type = unknown;
+
+ if(pesid >= 0xe0 && pesid < 0xf0) // mpeg video
+ {
+ __int64 pos = GetPos();
+
+ if(type == unknown)
+ {
+ CMpegSplitterFile::seqhdr h;
+ if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
+ type = video;
+ }
+
+ Seek(pos);
+
+ if(type == unknown)
+ {
+ CMpegSplitterFile::avchdr h;
+ if(!m_streams[video].Find(s) && Read(h, len, &s.mt))
+ type = video;
+ }
+ }
+ else if(pesid >= 0xc0 && pesid < 0xe0) // mpeg audio
+ {
+ __int64 pos = GetPos();
+
+ if(type == unknown)
+ {
+ CMpegSplitterFile::mpahdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, false, &s.mt))
+ type = audio;
+ }
+
+ Seek(pos);
+
+ if(type == unknown)
+ {
+ CMpegSplitterFile::aachdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
+ type = audio;
+ }
+ }
+ else if(pesid == 0xbd) // private stream 1
+ {
+ if(s.pid)
+ {
+ if(!m_streams[audio].Find(s))
+ {
+ __int64 pos = GetPos();
+
+ if(type == unknown)
+ {
+ CMpegSplitterFile::ac3hdr h;
+ if(Read(h, len, &s.mt))
+ type = audio;
+ }
+
+ Seek(pos);
+
+ if(type == unknown)
+ {
+ CMpegSplitterFile::dtshdr h;
+ if(Read(h, len, &s.mt))
+ type = audio;
+ }
+ }
+ }
+ else
+ {
+ BYTE b = (BYTE)BitRead(8, true);
+ WORD w = (WORD)BitRead(16, true);
+ DWORD dw = (DWORD)BitRead(32, true);
+
+ if(b >= 0x80 && b < 0x88 || w == 0x0b77) // ac3
+ {
+ s.ps1id = (b >= 0x80 && b < 0x88) ? (BYTE)(BitRead(32) >> 24) : 0x80;
+
+ CMpegSplitterFile::ac3hdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
+ type = audio;
+ }
+ else if(b >= 0x88 && b < 0x90 || dw == 0x7ffe8001) // dts
+ {
+ s.ps1id = (b >= 0x88 && b < 0x90) ? (BYTE)(BitRead(32) >> 24) : 0x88;
+
+ CMpegSplitterFile::dtshdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
+ type = audio;
+ }
+ else if(b >= 0xa0 && b < 0xa8) // lpcm
+ {
+ s.ps1id = (b >= 0xa0 && b < 0xa8) ? (BYTE)(BitRead(32) >> 24) : 0xa0;
+
+ CMpegSplitterFile::lpcmhdr h;
+ if(Read(h, &s.mt) && !m_streams[audio].Find(s)) // note the reversed order, the header should be stripped always even if it's not a new stream
+ type = audio;
+ }
+ else if(b >= 0x20 && b < 0x40) // DVD subpic
+ {
+ s.ps1id = (BYTE)BitRead(8);
+
+ CMpegSplitterFile::dvdspuhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
+ type = subpic;
+ }
+ else if(b >= 0x70 && b < 0x80) // SVCD subpic
+ {
+ s.ps1id = (BYTE)BitRead(8);
+
+ CMpegSplitterFile::svcdspuhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
+ type = subpic;
+ }
+ else if(b >= 0x00 && b < 0x10) // CVD subpic
+ {
+ s.ps1id = (BYTE)BitRead(8);
+
+ CMpegSplitterFile::cvdspuhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
+ type = subpic;
+ }
+ else if(w == 0xffa0 || w == 0xffa1) // ps2-mpg audio
+ {
+ s.ps1id = (BYTE)BitRead(8);
+ s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0xa000 | track id
+
+ CMpegSplitterFile::ps2audhdr h;
+ if(!m_streams[audio].Find(s) && Read(h, &s.mt))
+ type = audio;
+ }
+ else if(w == 0xff90) // ps2-mpg ac3 or subtitles
+ {
+ s.ps1id = (BYTE)BitRead(8);
+ s.pid = (WORD)((BitRead(8) << 8) | BitRead(16)); // pid = 0x9000 | track id
+
+ w = (WORD)BitRead(16, true);
+
+ if(w == 0x0b77)
+ {
+ CMpegSplitterFile::ac3hdr h;
+ if(!m_streams[audio].Find(s) && Read(h, len, &s.mt))
+ type = audio;
+ }
+ else if(w == 0x0000) // usually zero...
+ {
+ CMpegSplitterFile::ps2subhdr h;
+ if(!m_streams[subpic].Find(s) && Read(h, &s.mt))
+ type = subpic;
+ }
+ }
+ }
+ }
+ else if(pesid == 0xbe) // padding
+ {
+ }
+ else if(pesid == 0xbf) // private stream 2
+ {
+ }
+
+ if(type != unknown && !m_streams[type].Find(s))
+ {
+ if(s.pid)
+ {
+ for(int i = 0; i < unknown; i++)
+ {
+ if(m_streams[i].Find(s)) {/*ASSERT(0);*/ return s;}
+ }
+ }
+
+ m_streams[type].Insert(s);
+ }
+
+ return s;
+}
+
+void CMpegSplitterFile::UpdatePrograms(const trhdr& h)
+{
+ CAutoLock cAutoLock(&m_csProps);
+
+ if(h.pid == 0)
+ {
+ trsechdr h2;
+ if(Read(h2) && h2.table_id == 0)
+ {
+ CAtlMap<WORD, bool> newprograms;
+
+ int len = h2.section_length;
+ len -= 5+4;
+ for(int i = len/4; i > 0; i--)
+ {
+ WORD program_number = (WORD)BitRead(16);
+ BYTE reserved = (BYTE)BitRead(3);
+ WORD pid = (WORD)BitRead(13);
+ if(program_number != 0)
+ {
+ m_programs[pid].program_number = program_number;
+ newprograms[program_number] = true;
+ }
+ }
+
+ POSITION pos = m_programs.GetStartPosition();
+ while(pos)
+ {
+ const CAtlMap<WORD, program>::CPair* pPair = m_programs.GetNext(pos);
+
+ if(!newprograms.Lookup(pPair->m_value.program_number))
+ {
+ m_programs.RemoveKey(pPair->m_key);
+ }
+ }
+ }
+ }
+ else if(CAtlMap<WORD, program>::CPair* pPair = m_programs.Lookup(h.pid))
+ {
+ trsechdr h2;
+ if(Read(h2) && h2.table_id == 2)
+ {
+ memset(pPair->m_value.pid, 0, sizeof(pPair->m_value.pid));
+
+ int len = h2.section_length;
+ len -= 5+4;
+ BYTE reserved1 = (BYTE)BitRead(3);
+ WORD PCR_PID = (WORD)BitRead(13);
+ BYTE reserved2 = (BYTE)BitRead(4);
+ WORD program_info_length = (WORD)BitRead(12);
+ len -= 4+program_info_length;
+ while(program_info_length-- > 0) BitRead(8);
+ for(int i = 0; i < countof(pPair->m_value.pid) && len >= 5; i++)
+ {
+ BYTE stream_type = (BYTE)BitRead(8);
+ BYTE reserved1 = (BYTE)BitRead(3);
+ WORD pid = (WORD)BitRead(13);
+ BYTE reserved2 = (BYTE)BitRead(4);
+ WORD ES_info_length = (WORD)BitRead(12);
+ len -= 5+ES_info_length;
+ while(ES_info_length-- > 0) BitRead(8);
+ pPair->m_value.pid[i] = pid;
+ }
+ }
+ }
+}
+
+const CMpegSplitterFile::program* CMpegSplitterFile::FindProgram(WORD pid)
+{
+ POSITION pos = m_programs.GetStartPosition();
+ while(pos)
+ {
+ const program* p = &m_programs.GetNextValue(pos);
+ for(int i = 0; i < countof(p->pid); i++)
+ if(p->pid[i] == pid) return p;
+ }
+
+ return NULL;
+}
diff --git a/src/filters/parser/mpegsplitter/MpegSplitterFile.h b/src/filters/parser/mpegsplitter/MpegSplitterFile.h
new file mode 100644
index 000000000..e35d522d4
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitterFile.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\BaseSplitter\BaseSplitter.h"
+
+class CMpegSplitterFile : public CBaseSplitterFileEx
+{
+ CAtlMap<WORD, BYTE> m_pid2pes;
+
+ HRESULT Init();
+
+public:
+ CMpegSplitterFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+
+ REFERENCE_TIME NextPTS(DWORD TrackNum);
+
+ CCritSec m_csProps;
+
+ enum {us, ps, ts, es, pva} m_type;
+
+ REFERENCE_TIME m_rtMin, m_rtMax;
+ __int64 m_posMin, m_posMax;
+ int m_rate; // byte/sec
+
+ struct stream
+ {
+ CMediaType mt;
+ WORD pid;
+ BYTE pesid, ps1id;
+ struct stream() {pid = pesid = ps1id = 0;}
+ operator DWORD() const {return pid ? pid : ((pesid<<8)|ps1id);}
+ bool operator == (const struct stream& s) const {return (DWORD)*this == (DWORD)s;}
+ };
+
+ enum {video, audio, subpic, unknown};
+
+ class CStreamList : public CAtlList<stream>
+ {
+ public:
+ void Insert(stream& s)
+ {
+ for(POSITION pos = GetHeadPosition(); pos; GetNext(pos))
+ {
+ stream& s2 = GetAt(pos);
+ if(s < s2) {InsertBefore(pos, s); return;}
+ }
+
+ AddTail(s);
+ }
+
+ static CStringW ToString(int type)
+ {
+ return
+ type == video ? L"Video" :
+ type == audio ? L"Audio" :
+ type == subpic ? L"Subtitle" :
+ L"Unknown";
+ }
+
+ const stream* FindStream(int pid)
+ {
+ for(POSITION pos = GetHeadPosition(); pos; GetNext(pos))
+ {
+ const stream& s = GetAt(pos);
+ if(s.pid == pid) return &s;
+ }
+
+ return NULL;
+ }
+
+ } m_streams[unknown];
+
+ HRESULT SearchStreams(__int64 start, __int64 stop);
+ DWORD AddStream(WORD pid, BYTE pesid, DWORD len);
+
+ struct program
+ {
+ WORD program_number;
+ WORD pid[16];
+ struct program() {memset(this, 0, sizeof(*this));}
+ };
+
+ CAtlMap<WORD, program> m_programs;
+
+ void UpdatePrograms(const trhdr& h);
+ const program* FindProgram(WORD pid);
+};
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter_vs2005.vcproj b/src/filters/parser/mpegsplitter/MpegSplitter_vs2005.vcproj
new file mode 100644
index 000000000..51ff39794
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitter_vs2005.vcproj
@@ -0,0 +1,811 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="MpegSplitter"
+ ProjectGUID="{4628C665-EDE4-40D2-B525-32BE8B8551C8}"
+ RootNamespace="MpegSplitter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="MpegSplitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="MpegSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath=".\MpegSplitterFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\MpegSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MpegSplitterFile.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\MpegSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/mpegsplitter/MpegSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/mpegsplitter/MpegSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/MpegSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/mpegsplitter/resource.h b/src/filters/parser/mpegsplitter/resource.h
new file mode 100644
index 000000000..1ae4564c5
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by MpegSplitter.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/mpegsplitter/stdafx.cpp b/src/filters/parser/mpegsplitter/stdafx.cpp
new file mode 100644
index 000000000..4284c08d9
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// RoQSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/mpegsplitter/stdafx.h b/src/filters/parser/mpegsplitter/stdafx.h
new file mode 100644
index 000000000..a4dc73d2b
--- /dev/null
+++ b/src/filters/parser/mpegsplitter/stdafx.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include "..\..\..\DSUtil\vd.h"
+
+#pragma warning(disable: 4355) // 'this' : used in base member initializer list
diff --git a/src/filters/parser/nutsplitter/NutFile.cpp b/src/filters/parser/nutsplitter/NutFile.cpp
new file mode 100644
index 000000000..cc8de4eb1
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutFile.cpp
@@ -0,0 +1,191 @@
+#include "StdAfx.h"
+#include "NutFile.h"
+
+CNutFile::CNutFile(IAsyncReader* pAsyncReader, HRESULT& hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
+{
+ if(FAILED(hr)) return;
+ hr = Init();
+}
+
+HRESULT CNutFile::Init()
+{
+ Seek(0);
+
+ if(BitRead(64) != NUTM)
+ return E_FAIL;
+
+ m_streams.RemoveAll();
+
+ Seek(0);
+
+ while(GetPos() < GetLength())
+ {
+ frame_header fh;
+ fh.checksum_flag = 1;
+
+ UINT64 id = 0;
+
+ if(BitRead(1, true) == 0
+ || (id = BitRead(64)) == NUTK)
+ break;
+
+ packet_header ph;
+ Read(ph);
+
+ if(id == NUTM)
+ {
+ Read(m_mh);
+ }
+ else if(id == NUTS)
+ {
+ CAutoPtr<stream_header> sh(new stream_header());
+ Read(*sh);
+ if(sh->stream_class == SC_VIDEO) Read(sh->vsh);
+ else if(sh->stream_class == SC_AUDIO) Read(sh->ash);
+ // else if(sh->stream_class == SC_SUBTITLE) ; // nothing to do
+ m_streams.AddTail(sh);
+ }
+ else if(id == NUTX)
+ {
+ index_header ih;
+ Read(ih);
+ }
+ else if(id == NUTI)
+ {
+ info_header ih;
+ Read(ih);
+ }
+ else if(id == 0) // frame
+ {
+ ASSERT(0);
+ break;
+ }
+
+ if(fh.checksum_flag)
+ {
+ Seek(ph.pos + ph.fptr - 4);
+ ph.checksum = (UINT32)BitRead(32);
+ }
+
+ Seek(ph.pos + ph.fptr);
+ }
+
+ Seek(0);
+
+ return m_streams.GetCount() ? S_OK : E_FAIL;
+}
+
+void CNutFile::Read(vint& vi)
+{
+ vi = 0;
+ bool more;
+ do {more = !!BitRead(1); vi = (vi << 7) | BitRead(7);}
+ while(more);
+}
+
+void CNutFile::Read(svint& svi)
+{
+ vint vi;
+ Read(vi);
+ vi++;
+ if(vi&1) svi = -((svint)vi>>1);
+ else svi = ((svint)vi>>1);
+}
+
+void CNutFile::Read(binary& b)
+{
+ vint len;
+ Read(len);
+ b.SetCount((INT_PTR)len);
+ for(BYTE* buff = b.GetData(); len-- > 0; *buff++ = (BYTE)BitRead(8));
+}
+
+void CNutFile::Read(packet_header& ph)
+{
+ ph.pos = GetPos();
+ Read(ph.fptr);
+ Read(ph.bptr);
+}
+
+void CNutFile::Read(main_header& mh)
+{
+ Read(mh.version);
+ Read(mh.stream_count);
+}
+
+void CNutFile::Read(stream_header& sh)
+{
+ Read(sh.stream_id);
+ Read(sh.stream_class);
+ Read(sh.fourcc);
+ Read(sh.average_bitrate);
+ Read(sh.language_code);
+ Read(sh.time_base_nom);
+ Read(sh.time_base_denom);
+ Read(sh.msb_timestamp_shift);
+ Read(sh.shuffle_type);
+ sh.fixed_fps = BitRead(1);
+ sh.index_flag = BitRead(1);
+ sh.reserved = BitRead(6);
+ while(1)
+ {
+ CAutoPtr<codec_specific> p(new codec_specific());
+ Read(p->type);
+ if(p->type == 0) break;
+ Read(p->data);
+ sh.cs.AddTail(p);
+ }
+}
+
+void CNutFile::Read(video_stream_header& vsh)
+{
+ Read(vsh.width);
+ Read(vsh.height);
+ Read(vsh.sample_width);
+ Read(vsh.sample_height);
+ Read(vsh.colorspace_type);
+}
+
+void CNutFile::Read(audio_stream_header& ash)
+{
+ Read(ash.samplerate_mul);
+ Read(ash.channel_count);
+}
+
+void CNutFile::Read(index_header& ih)
+{
+ Read(ih.stream_id);
+
+ vint len;
+ Read(len);
+ ih.ie.SetCount((INT_PTR)len);
+ for(index_entry* p = ih.ie.GetData(); len-- > 0;)
+ {
+ Read(p->timestamp);
+ Read(p->position);
+ }
+}
+
+void CNutFile::Read(info_header& ih)
+{
+ // TODO
+/*
+ for(;;){
+ id v
+ if(id==0) break
+ name= info_table[id][0]
+ type= info_table[id][1]
+ if(type==NULL)
+ type b
+ if(name==NULL)
+ name b
+ if(type=="v")
+ value v
+ else if(type=="s")
+ value s
+ else
+ value b
+ }
+*/
+}
diff --git a/src/filters/parser/nutsplitter/NutFile.h b/src/filters/parser/nutsplitter/NutFile.h
new file mode 100644
index 000000000..970edf571
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutFile.h
@@ -0,0 +1,124 @@
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+
+class CNutFile : public CBaseSplitterFile
+{
+ HRESULT Init();
+
+public:
+
+#pragma pack(push, 1)
+
+ typedef UINT64 vint;
+ typedef INT64 svint;
+ typedef CAtlArray<BYTE> binary;
+ typedef CAtlArray<BYTE> string;
+
+ struct packet_header
+ {
+ __int64 pos;
+ vint fptr, bptr;
+ UINT32 checksum;
+ };
+
+ struct main_header
+ {
+ vint version;
+ vint stream_count;
+ };
+
+ struct codec_specific
+ {
+ vint type;
+ binary data;
+ };
+
+ struct video_stream_header
+ {
+ vint width, height;
+ vint sample_width, sample_height;
+ vint colorspace_type;
+ };
+
+ struct audio_stream_header
+ {
+ vint samplerate_mul;
+ vint channel_count;
+ };
+
+ struct stream_header
+ {
+ vint stream_id;
+ vint stream_class;
+ string fourcc;
+ vint average_bitrate;
+ string language_code;
+ vint time_base_nom;
+ vint time_base_denom;
+ vint msb_timestamp_shift;
+ vint shuffle_type;
+ int fixed_fps:1;
+ int index_flag:1;
+ int reserved:6;
+ CAutoPtrList<codec_specific> cs;
+ union {video_stream_header vsh; audio_stream_header ash;};
+ vint msb_timestamp;
+ };
+
+ struct frame_header
+ {
+ BYTE zero_bit:1;
+ BYTE priority:2;
+ BYTE checksum_flag:1;
+ BYTE msb_timestamp_flag:2;
+ BYTE subpacket_type:2;
+ BYTE reserved:1;
+ };
+
+ struct index_entry
+ {
+ vint timestamp;
+ vint position;
+ };
+
+ struct index_header
+ {
+ vint stream_id;
+ CAtlArray<index_entry> ie;
+ };
+
+ struct info_header
+ {
+ // TODO
+ vint dummy;
+ };
+
+#pragma pack(pop)
+
+ #define NUTM 0xF9526A624E55544Dui64
+ #define NUTS 0xD667773F4E555453ui64
+ #define NUTK 0xCB8630874E55544Bui64
+ #define NUTX 0xEBFCDE0E4E555458ui64
+ #define NUTI 0xA37B64354E555449ui64
+
+ enum {SC_VIDEO = 0, SC_AUDIO = 32, SC_SUBTITLE = 64};
+
+ void Read(vint& v);
+ void Read(svint& sv);
+ void Read(binary& b);
+ void Read(packet_header& ph);
+ void Read(main_header& mh);
+ void Read(stream_header& sh);
+ void Read(video_stream_header& vsh);
+ void Read(audio_stream_header& ash);
+ void Read(index_header& ih);
+ void Read(info_header& ih);
+
+public:
+
+ CNutFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+
+ main_header m_mh;
+ CAutoPtrList<stream_header> m_streams;
+};
diff --git a/src/filters/parser/nutsplitter/NutSplitter.cpp b/src/filters/parser/nutsplitter/NutSplitter.cpp
new file mode 100644
index 000000000..14f22e10d
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutSplitter.cpp
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <initguid.h>
+#include "NutSplitter.h"
+#include "..\..\..\..\include\moreuuids.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_Nut},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CNutSplitterFilter), L"Nut Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins},
+ {&__uuidof(CNutSourceFilter), L"Nut Source", MERIT_NORMAL+1, 0, NULL},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CNutSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CNutSourceFilter>, NULL, &sudFilter[1]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_Nut, _T("0,8,,F9526A624E55544D"), _T(".nut"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ UnRegisterSourceFilter(MEDIASUBTYPE_Nut);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CNutSplitterFilter
+//
+
+CNutSplitterFilter::CNutSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("CNutSplitterFilter"), pUnk, phr, __uuidof(this))
+{
+}
+
+HRESULT CNutSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ m_pFile.Attach(new CNutFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ // pins
+
+ POSITION pos = m_pFile->m_streams.GetHeadPosition();
+ while(pos)
+ {
+ CNutFile::stream_header* sh = m_pFile->m_streams.GetNext(pos);
+
+ CAtlArray<CMediaType> mts;
+ CMediaType mt;
+
+ if(sh->stream_class == CNutFile::SC_VIDEO)
+ {
+ CNutFile::video_stream_header& vsh = sh->vsh;
+
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap(*(DWORD*)sh->fourcc.GetData());
+ mt.formattype = FORMAT_VideoInfo;
+
+ VIDEOINFOHEADER vih;
+ memset(&vih, 0, sizeof(vih));
+ vih.dwBitRate = (DWORD)sh->average_bitrate;
+ vih.AvgTimePerFrame = 10000000i64 * sh->time_base_nom / sh->time_base_denom;
+ vih.bmiHeader.biSize = sizeof(vih.bmiHeader);
+ vih.bmiHeader.biCompression = mt.subtype.Data1;
+ vih.bmiHeader.biWidth = (LONG)vsh.width;
+ vih.bmiHeader.biHeight = (LONG)vsh.height;
+ mt.SetFormat((BYTE*)&vih, sizeof(vih));
+
+ mts.Add(mt);
+
+ if(vsh.sample_width && vsh.sample_height)
+ {
+ VIDEOINFOHEADER2 vih2;
+ memset(&vih2, 0, sizeof(vih2));
+ vih2.dwBitRate = vih.dwBitRate;
+ vih2.AvgTimePerFrame = vih.AvgTimePerFrame;
+ vih2.dwPictAspectRatioX = (DWORD)vsh.sample_width;
+ vih2.dwPictAspectRatioY = (DWORD)vsh.sample_height;
+ vih2.bmiHeader = vih.bmiHeader;
+ mt.SetFormat((BYTE*)&vih2, sizeof(vih2));
+
+ mts.InsertAt(0, mt);
+ }
+ }
+ else if(sh->stream_class == CNutFile::SC_AUDIO)
+ {
+ CNutFile::audio_stream_header& ash = sh->ash;
+ // TODO
+ }
+ else if(sh->stream_class == CNutFile::SC_SUBTITLE)
+ {
+ // TODO
+ }
+
+ if(mts.GetCount() > 0)
+ {
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ AddOutputPin((DWORD)sh->stream_id, pPinOut);
+ }
+ }
+
+ // TODO
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool CNutSplitterFilter::DemuxInit()
+{
+ if(!m_pFile) return(false);
+ m_pFile->Seek(0);
+ return(true);
+}
+
+void CNutSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ POSITION pos = m_pFile->m_streams.GetHeadPosition();
+ while(pos) m_pFile->m_streams.GetNext(pos)->msb_timestamp = 0;
+
+ if(rt <= 0)
+ {
+ m_pFile->Seek(0);
+ }
+ else
+ {
+ m_pFile->Seek(0);
+ // TODO
+ }
+}
+
+bool CNutSplitterFilter::DemuxLoop()
+{
+ bool fKeyFrame = false;
+
+ while(!CheckRequest(NULL) && m_pFile->GetPos() < m_pFile->GetLength())
+ {
+ CNutFile::frame_header fh;
+ fh.checksum_flag = 1;
+
+ UINT64 id = 0;
+
+ if(m_pFile->BitRead(1, true) == 0)
+ {
+ fh.zero_bit = m_pFile->BitRead(1);
+ fh.priority = m_pFile->BitRead(2);
+ fh.checksum_flag = m_pFile->BitRead(1);
+ fh.msb_timestamp_flag = m_pFile->BitRead(1);
+ fh.subpacket_type = m_pFile->BitRead(2);
+ fh.reserved = m_pFile->BitRead(1);
+ }
+ else
+ {
+ if((id = m_pFile->BitRead(64)) == NUTK)
+ {
+ fKeyFrame = true;
+ continue;
+ }
+ }
+
+ CNutFile::packet_header ph;
+ m_pFile->Read(ph);
+
+ if(id == 0)
+ {
+ CNutFile::vint stream_id;
+ m_pFile->Read(stream_id);
+
+ CNutFile::stream_header* sh = NULL;
+
+ POSITION pos = m_pFile->m_streams.GetHeadPosition();
+ while(pos)
+ {
+ CNutFile::stream_header* tmp = m_pFile->m_streams.GetNext(pos);
+ if(tmp->stream_id == stream_id) {sh = tmp; break;}
+ }
+
+ if(sh)
+ {
+ if(fh.msb_timestamp_flag)
+ m_pFile->Read(sh->msb_timestamp);
+
+ CNutFile::svint lsb_timestamp = 0;
+ m_pFile->Read(lsb_timestamp);
+
+TRACE(_T("[%I64d]: %I64d:%I64d\n"), stream_id, sh->msb_timestamp, lsb_timestamp);
+
+ CAutoPtr<Packet> p(new Packet());
+ p->TrackNumber = (DWORD)stream_id;
+ p->bSyncPoint = fKeyFrame;
+ p->rtStart = 10000i64 * ((sh->msb_timestamp << sh->msb_timestamp_shift) + lsb_timestamp)
+ * sh->time_base_nom / sh->time_base_denom;
+ p->rtStop = p->rtStart+1;
+
+ fKeyFrame = false;
+
+ CNutFile::vint len = ph.fptr - (m_pFile->GetPos() - ph.pos);
+ if(fh.checksum_flag) len -= 4;
+
+ if(fh.subpacket_type == 1)
+ {
+ p->SetCount(len);
+ m_pFile->ByteRead(p->GetData(), p->GetCount());
+
+ if(FAILED(DeliverPacket(p)))
+ break;
+ }
+ else
+ {
+ // TODO
+/*
+ vint subpacket_count;
+ Read(subpacket_count);
+
+ if(fh.subpacket_type & 1)
+ {
+ CArray<vint> keyframe_run;
+ keyframe_run.SetSize(subpacket_count);
+ for(int i = 0; i < subpacket_count; i++)
+ Read(keyframe_run[i]);
+ }
+
+ CArray<vint> timestamp_diff;
+ timestamp_diff.SetSize(subpacket_count);
+ CArray<vint> timestamp_diff_run;
+ timestamp_diff_run.SetSize(subpacket_count);
+ for(int i = 0; i < subpacket_count; i++)
+ {
+ Read(timestamp_diff[i]);
+ if(timestamp_diff[i] & 1)
+ Read(timestamp_diff_run[i]);
+ }
+
+ if(fh.subpacket_type & 2)
+ {
+ CArray<string> subpacket_size_diff;
+ for(int i = 0; i < subpacket_count-1; i++)
+ {
+ Read(subpacket_size_diff[i]);
+ }
+ }
+
+ for(int i = 0; i < subpacket_count; i++)
+ {
+ }
+*/
+ }
+ }
+ }
+
+ if(fh.checksum_flag)
+ {
+ m_pFile->Seek(ph.pos + ph.fptr - 4);
+ ph.checksum = (UINT32)m_pFile->BitRead(32);
+ }
+
+ m_pFile->Seek(ph.pos + ph.fptr);
+ }
+
+ return(true);
+}
+
+// IMediaSeeking
+
+STDMETHODIMP CNutSplitterFilter::GetDuration(LONGLONG* pDuration)
+{
+ CheckPointer(pDuration, E_POINTER);
+ *pDuration = m_rtDuration;
+ return S_OK;
+}
+
+//
+// CNutSourceFilter
+//
+
+CNutSourceFilter::CNutSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CNutSplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
diff --git a/src/filters/parser/nutsplitter/NutSplitter.def b/src/filters/parser/nutsplitter/NutSplitter.def
new file mode 100644
index 000000000..9de74a3e1
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "NutSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/nutsplitter/NutSplitter.h b/src/filters/parser/nutsplitter/NutSplitter.h
new file mode 100644
index 000000000..29d9ca9fd
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutSplitter.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+#include "NutFile.h"
+
+// {5EB7173E-AA71-4a54-BDD1-1CA57D20405F}
+DEFINE_GUID(MEDIASUBTYPE_Nut,
+0x5eb7173e, 0xaa71, 0x4a54, 0xbd, 0xd1, 0x1c, 0xa5, 0x7d, 0x20, 0x40, 0x5f);
+
+[uuid("90514D6A-76B7-4405-88A8-B4B1EF6061C6")]
+class CNutSplitterFilter : public CBaseSplitterFilter
+{
+ CAutoPtr<CNutFile> m_pFile;
+
+protected:
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+public:
+ CNutSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+
+ // IMediaSeeking
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+};
+
+[uuid("918B5A9F-DFED-4532-83A9-9B16D83ED73F")]
+class CNutSourceFilter : public CNutSplitterFilter
+{
+public:
+ CNutSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
diff --git a/src/filters/parser/nutsplitter/NutSplitter.rc b/src/filters/parser/nutsplitter/NutSplitter.rc
new file mode 100644
index 000000000..800849045
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Nut Splitter"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "Nut Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2006 Gabest"
+ VALUE "OriginalFilename", "NutSplitter.ax"
+ VALUE "ProductName", "Nut Splitter"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/nutsplitter/NutSplitter.sln b/src/filters/parser/nutsplitter/NutSplitter.sln
new file mode 100644
index 000000000..1d8c81a1d
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutSplitter.sln
@@ -0,0 +1,94 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NutSplitter", "NutSplitter.vcproj", "{E776D3C2-5BFA-41b9-B998-A35B549AF737}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {E776D3C2-5BFA-41b9-B998-A35B549AF737}.Debug.ActiveCfg = Debug|Win32
+ {E776D3C2-5BFA-41b9-B998-A35B549AF737}.Debug lib.ActiveCfg = Debug lib|Win32
+ {E776D3C2-5BFA-41b9-B998-A35B549AF737}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {E776D3C2-5BFA-41b9-B998-A35B549AF737}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {E776D3C2-5BFA-41b9-B998-A35B549AF737}.Release.ActiveCfg = Release|Win32
+ {E776D3C2-5BFA-41b9-B998-A35B549AF737}.Release lib.ActiveCfg = Release lib|Win32
+ {E776D3C2-5BFA-41b9-B998-A35B549AF737}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {E776D3C2-5BFA-41b9-B998-A35B549AF737}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/nutsplitter/NutSplitter.vcproj b/src/filters/parser/nutsplitter/NutSplitter.vcproj
new file mode 100644
index 000000000..8f2b946c1
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutSplitter.vcproj
@@ -0,0 +1,559 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="NutSplitter"
+ ProjectGUID="{E776D3C2-5BFA-41B9-B998-A35B549AF737}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\NutFile.cpp">
+ </File>
+ <File
+ RelativePath="NutSplitter.cpp">
+ </File>
+ <File
+ RelativePath="NutSplitter.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\NutFile.h">
+ </File>
+ <File
+ RelativePath=".\NutSplitter.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\NutSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/nutsplitter/NutSplitter_vs2005.vcproj b/src/filters/parser/nutsplitter/NutSplitter_vs2005.vcproj
new file mode 100644
index 000000000..112df2a91
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutSplitter_vs2005.vcproj
@@ -0,0 +1,814 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="NutSplitter"
+ ProjectGUID="{E776D3C2-5BFA-41B9-B998-A35B549AF737}"
+ RootNamespace="NutSplitter"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\NutFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="NutSplitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="NutSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\NutFile.h"
+ >
+ </File>
+ <File
+ RelativePath=".\NutSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\NutSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/nutsplitter/NutSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/nutsplitter/NutSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/nutsplitter/NutSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/nutsplitter/resource.h b/src/filters/parser/nutsplitter/resource.h
new file mode 100644
index 000000000..80ef35412
--- /dev/null
+++ b/src/filters/parser/nutsplitter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by NutSplitter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/nutsplitter/stdafx.cpp b/src/filters/parser/nutsplitter/stdafx.cpp
new file mode 100644
index 000000000..4284c08d9
--- /dev/null
+++ b/src/filters/parser/nutsplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// RoQSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/nutsplitter/stdafx.h b/src/filters/parser/nutsplitter/stdafx.h
new file mode 100644
index 000000000..a4dc73d2b
--- /dev/null
+++ b/src/filters/parser/nutsplitter/stdafx.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include "..\..\..\DSUtil\vd.h"
+
+#pragma warning(disable: 4355) // 'this' : used in base member initializer list
diff --git a/src/filters/parser/oggsplitter/OggFile.cpp b/src/filters/parser/oggsplitter/OggFile.cpp
new file mode 100644
index 000000000..d2d0bc408
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggFile.cpp
@@ -0,0 +1,77 @@
+#include "StdAfx.h"
+#include ".\oggfile.h"
+
+COggFile::COggFile(IAsyncReader* pAsyncReader, HRESULT& hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
+{
+ if(FAILED(hr)) return;
+ hr = Init();
+}
+
+HRESULT COggFile::Init()
+{
+ Seek(0);
+ if(!Sync()) return E_FAIL;
+
+ return S_OK;
+}
+
+bool COggFile::Sync(HANDLE hBreak)
+{
+ __int64 start = GetPos();
+
+ DWORD dw;
+ for(__int64 i = 0, j = hBreak ? GetLength() - start : 65536;
+ i < j && S_OK == ByteRead((BYTE*)&dw, sizeof(dw))
+ && ((i&0xffff) || !hBreak || WaitForSingleObject(hBreak, 0) != WAIT_OBJECT_0);
+ i++, Seek(start + i))
+ {
+ if(dw == 'SggO')
+ {
+ Seek(start + i);
+ return(true);
+ }
+ }
+
+ Seek(start);
+
+ return(false);
+}
+
+bool COggFile::Read(OggPageHeader& hdr, HANDLE hBreak)
+{
+ return Sync(hBreak) && S_OK == ByteRead((BYTE*)&hdr, sizeof(hdr)) && hdr.capture_pattern == 'SggO';
+}
+
+bool COggFile::Read(OggPage& page, bool fFull, HANDLE hBreak)
+{
+ memset(&page.m_hdr, 0, sizeof(page.m_hdr));
+ page.m_lens.RemoveAll();
+ page.SetCount(0);
+
+ if(!Read(page.m_hdr, hBreak))
+ return(false);
+
+ int pagelen = 0, packetlen = 0;
+ for(BYTE i = 0; i < page.m_hdr.number_page_segments; i++)
+ {
+ BYTE b;
+ if(S_OK != ByteRead(&b, 1)) return(false);
+ packetlen += b;
+ if(1/*b < 0xff*/) {page.m_lens.AddTail(packetlen); pagelen += packetlen; packetlen = 0;}
+ }
+
+ if(fFull)
+ {
+ page.SetCount(pagelen);
+ if(S_OK != ByteRead(page.GetData(), page.GetCount()))
+ return(false);
+ }
+ else
+ {
+ Seek(GetPos() + pagelen);
+ page.m_lens.RemoveAll();
+ }
+
+ return(true);
+}
diff --git a/src/filters/parser/oggsplitter/OggFile.h b/src/filters/parser/oggsplitter/OggFile.h
new file mode 100644
index 000000000..fcc506d89
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggFile.h
@@ -0,0 +1,76 @@
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+
+#pragma pack(push, 1)
+
+struct OggPageHeader
+{
+ DWORD capture_pattern;
+ BYTE stream_structure_version;
+ BYTE header_type_flag; enum {continued=1, first=2, last=4};
+ __int64 granule_position;
+ DWORD bitstream_serial_number;
+ DWORD page_sequence_number;
+ DWORD CRC_checksum;
+ BYTE number_page_segments;
+};
+
+struct OggVorbisIdHeader
+{
+ DWORD vorbis_version;
+ BYTE audio_channels;
+ DWORD audio_sample_rate;
+ DWORD bitrate_maximum;
+ DWORD bitrate_nominal;
+ DWORD bitrate_minimum;
+ BYTE blocksize_0:4;
+ BYTE blocksize_1:4;
+ BYTE framing_flag;
+};
+
+struct OggVideoHeader
+{
+ DWORD w, h;
+};
+
+struct OggAudioHeader
+{
+ WORD nChannels, nBlockAlign;
+ DWORD nAvgBytesPerSec;
+};
+
+struct OggStreamHeader
+{
+ char streamtype[8], subtype[4];
+ DWORD size;
+ __int64 time_unit, samples_per_unit;
+ DWORD default_len;
+ DWORD buffersize;
+ WORD bps;
+ WORD alignmentfix1;
+ union {OggVideoHeader v; OggAudioHeader a;};
+ DWORD alignmentfix2;
+};
+
+#pragma pack(pop)
+
+class OggPage : public CAtlArray<BYTE>
+{
+public:
+ OggPageHeader m_hdr;
+ CAtlList<int> m_lens;
+ OggPage() {memset(&m_hdr, 0, sizeof(m_hdr));}
+};
+
+class COggFile : public CBaseSplitterFile
+{
+ HRESULT Init();
+
+public:
+ COggFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+
+ bool Sync(HANDLE hBreak = NULL);
+ bool Read(OggPageHeader& hdr, HANDLE hBreak = NULL);
+ bool Read(OggPage& page, bool fFull = true, HANDLE hBreak = NULL);
+};
diff --git a/src/filters/parser/oggsplitter/OggSplitter.cpp b/src/filters/parser/oggsplitter/OggSplitter.cpp
new file mode 100644
index 000000000..4324719cd
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggSplitter.cpp
@@ -0,0 +1,1046 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "OggSplitter.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(COggSplitterFilter), L"Ogg Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins},
+ {&__uuidof(COggSourceFilter), L"Ogg Source", MERIT_NORMAL+1, 0, NULL},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<COggSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<COggSourceFilter>, NULL, &sudFilter[1]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_Ogg,
+ _T("0,4,,4F676753"), // OggS
+ _T(".ogg"), _T(".ogm"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ UnRegisterSourceFilter(MEDIASUBTYPE_Ogg);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// bitstream
+//
+
+class bitstream
+{
+ BYTE* m_p;
+ int m_len, m_pos;
+public:
+ bitstream(BYTE* p, int len, bool rev = false) : m_p(p), m_len(len*8) {m_pos = !rev ? 0 : len*8;}
+ bool hasbits(int cnt)
+ {
+ int pos = m_pos+cnt;
+ return(pos >= 0 && pos < m_len);
+ }
+ unsigned int showbits(int cnt) // a bit unclean, but works and can read backwards too! :P
+ {
+ if(!hasbits(cnt)) {ASSERT(0); return 0;}
+ unsigned int ret = 0, off = 0;
+ BYTE* p = m_p;
+ if(cnt < 0)
+ {
+ p += (m_pos+cnt)>>3;
+ off = (m_pos+cnt)&7;
+ cnt = abs(cnt);
+ ret = (*p++&(~0<<off))>>off; off = 8 - off; cnt -= off;
+ }
+ else
+ {
+ p += m_pos>>3;
+ off = m_pos&7;
+ ret = (*p++>>off)&((1<<min(cnt,8))-1); off = 0; cnt -= 8 - off;
+ }
+ while(cnt > 0) {ret |= (*p++&((1<<min(cnt,8))-1)) << off; off += 8; cnt -= 8;}
+ return ret;
+ }
+ unsigned int getbits(int cnt)
+ {
+ unsigned int ret = showbits(cnt);
+ m_pos += cnt;
+ return ret;
+ }
+};
+
+//
+// COggSplitterFilter
+//
+
+COggSplitterFilter::COggSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("COggSplitterFilter"), pUnk, phr, __uuidof(this))
+{
+}
+
+COggSplitterFilter::~COggSplitterFilter()
+{
+}
+
+HRESULT COggSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ m_pFile.Attach(new COggFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = 0;
+
+ m_rtDuration = 0;
+
+ m_pFile->Seek(0);
+ OggPage page;
+ for(int i = 0, nWaitForMore = 0; m_pFile->Read(page); i++)
+ {
+ BYTE* p = page.GetData();
+
+ if(!(page.m_hdr.header_type_flag & OggPageHeader::continued))
+ {
+ BYTE type = *p++;
+
+ CStringW name;
+ name.Format(L"Stream %d", i);
+
+ HRESULT hr;
+
+ if(type == 1 && (page.m_hdr.header_type_flag & OggPageHeader::first))
+ {
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut;
+
+ if(!memcmp(p, "vorbis", 6))
+ {
+ name.Format(L"Vorbis %d", i);
+ pPinOut.Attach(new COggVorbisOutputPin((OggVorbisIdHeader*)(p+6), name, this, this, &hr));
+ nWaitForMore++;
+ }
+ else if(!memcmp(p, "video", 5))
+ {
+ name.Format(L"Video %d", i);
+ pPinOut.Attach(new COggVideoOutputPin((OggStreamHeader*)p, name, this, this, &hr));
+ }
+ else if(!memcmp(p, "audio", 5))
+ {
+ name.Format(L"Audio %d", i);
+ pPinOut.Attach(new COggAudioOutputPin((OggStreamHeader*)p, name, this, this, &hr));
+ }
+ else if(!memcmp(p, "text", 4))
+ {
+ name.Format(L"Text %d", i);
+ pPinOut.Attach(new COggTextOutputPin((OggStreamHeader*)p, name, this, this, &hr));
+ }
+ else if(!memcmp(p, "Direct Show Samples embedded in Ogg", 35))
+ {
+ name.Format(L"DirectShow %d", i);
+ pPinOut.Attach(new COggDirectShowOutputPin((AM_MEDIA_TYPE*)(p+35+sizeof(GUID)), name, this, this, &hr));
+ }
+
+ AddOutputPin(page.m_hdr.bitstream_serial_number, pPinOut);
+ }
+ else if(type == 3 && !memcmp(p, "vorbis", 6))
+ {
+ if(COggSplitterOutputPin* pOggPin =
+ dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
+ {
+ pOggPin->AddComment(p+6, page.GetCount()-6-1);
+ }
+ }
+ else if(!(type&1) && nWaitForMore == 0)
+ {
+ break;
+ }
+ }
+
+ if(COggVorbisOutputPin* p = dynamic_cast<COggVorbisOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
+ {
+ p->UnpackInitPage(page);
+ if(p->IsInitialized()) nWaitForMore--;
+ }
+ }
+
+ if(m_pOutputs.IsEmpty())
+ return E_FAIL;
+
+ m_pFile->Seek(max(m_pFile->GetLength()-65536, 0));
+ while(m_pFile->Read(page))
+ {
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
+ if(!pOggPin || page.m_hdr.granule_position == -1) continue;
+ REFERENCE_TIME rt = pOggPin->GetRefTime(page.m_hdr.granule_position);
+ m_rtDuration = max(rt, m_rtDuration);
+ }
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration;
+
+ // comments
+
+ {
+ CAtlMap<CStringW, CStringW, CStringElementTraits<CStringW> > tagmap;
+ tagmap[L"TITLE"] = L"TITL";
+ tagmap[L"ARTIST"] = L"AUTH"; // not quite
+ tagmap[L"COPYRIGHT"] = L"CPYR";
+ tagmap[L"DESCRIPTION"] = L"DESC";
+
+ POSITION pos2 = tagmap.GetStartPosition();
+ while(pos2)
+ {
+ CStringW oggtag, dsmtag;
+ tagmap.GetNextAssoc(pos2, oggtag, dsmtag);
+
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos)
+ {
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
+ if(!pOggPin) continue;
+
+ CStringW value = pOggPin->GetComment(oggtag);
+ if(!value.IsEmpty())
+ {
+ SetProperty(dsmtag, value);
+ break;
+ }
+ }
+ }
+
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos && !ChapGetCount())
+ {
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>((CBaseOutputPin*)m_pOutputs.GetNext(pos));
+ if(!pOggPin) continue;
+
+ for(int i = 1; pOggPin; i++)
+ {
+ CStringW key;
+ key.Format(L"CHAPTER%02d", i);
+ CStringW time = pOggPin->GetComment(key);
+ if(time.IsEmpty()) break;
+ key.Format(L"CHAPTER%02dNAME", i);
+ CStringW name = pOggPin->GetComment(key);
+ if(name.IsEmpty()) name.Format(L"Chapter %d", i);
+ int h, m, s, ms;
+ WCHAR c;
+ if(7 != swscanf(time, L"%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms)) break;
+ REFERENCE_TIME rt = ((((REFERENCE_TIME)h*60+m)*60+s)*1000+ms)*10000;
+ ChapAppend(rt, name);
+ }
+ }
+ }
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool COggSplitterFilter::DemuxInit()
+{
+ if(!m_pFile) return(false);
+
+ return(true);
+}
+
+void COggSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ if(rt <= 0 )
+ {
+ m_pFile->Seek(0);
+ }
+ else if(m_rtDuration > 0)
+ {
+ // oh, the horror...
+
+ __int64 len = m_pFile->GetLength();
+ __int64 startpos = len * rt/m_rtDuration;
+ __int64 diff = 0;
+
+ REFERENCE_TIME rtMinDiff = _I64_MAX;
+
+ while(1)
+ {
+ __int64 endpos = startpos;
+ REFERENCE_TIME rtPos = -1;
+
+ OggPage page;
+ m_pFile->Seek(startpos);
+ while(m_pFile->Read(page, false))
+ {
+ if(page.m_hdr.granule_position == -1) continue;
+
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
+ if(!pOggPin) {ASSERT(0); continue;}
+
+ rtPos = pOggPin->GetRefTime(page.m_hdr.granule_position);
+ endpos = m_pFile->GetPos();
+
+ break;
+ }
+
+ __int64 rtDiff = rtPos - rt;
+
+ if(rtDiff < 0)
+ {
+ rtDiff = -rtDiff;
+
+ if(rtDiff < 1000000 || rtDiff >= rtMinDiff)
+ {
+ m_pFile->Seek(startpos);
+ break;
+ }
+
+ rtMinDiff = rtDiff;
+ }
+
+ __int64 newpos = startpos;
+
+ if(rtPos < rt && rtPos < m_rtDuration)
+ {
+ newpos = startpos + (__int64)((1.0*(rt - rtPos)/(m_rtDuration - rtPos)) * (len - startpos)) + 1024;
+ if(newpos < endpos) newpos = endpos + 1024;
+ }
+ else if(rtPos > rt && rtPos > 0)
+ {
+ newpos = startpos - (__int64)((1.0*(rtPos - rt)/(rtPos - 0)) * (startpos - 0)) - 1024;
+ if(newpos >= startpos) newpos = startpos - 1024;
+ }
+ else if(rtPos == rt)
+ {
+ m_pFile->Seek(startpos);
+ break;
+ }
+ else
+ {
+ ASSERT(0);
+ m_pFile->Seek(0);
+ break;
+ }
+
+ diff = newpos - startpos;
+
+ startpos = max(min(newpos, len), 0);
+ }
+
+ m_pFile->Seek(startpos);
+
+ POSITION pos = m_pOutputs.GetHeadPosition();
+ while(pos)
+ {
+ COggSplitterOutputPin* pPin = dynamic_cast<COggSplitterOutputPin*>((CBaseSplitterOutputPin*)m_pOutputs.GetNext(pos));
+
+ if(!dynamic_cast<COggVideoOutputPin*>(pPin))
+ continue;
+
+ bool fKeyFrameFound = false, fSkipKeyFrame = true;
+ __int64 endpos = _I64_MAX;
+
+ while(!(fKeyFrameFound && !fSkipKeyFrame) && startpos > 0)
+ {
+ OggPage page;
+ while(!(fKeyFrameFound && !fSkipKeyFrame) && m_pFile->GetPos() < endpos && m_pFile->Read(page))
+ {
+ if(page.m_hdr.granule_position == -1)
+ continue;
+
+ if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
+ continue;
+
+ if(pPin->GetRefTime(page.m_hdr.granule_position) > rt)
+ break;
+
+ if(!fKeyFrameFound)
+ {
+ pPin->UnpackPage(page);
+
+ CAutoPtr<OggPacket> p;
+ while(p = pPin->GetPacket())
+ {
+ if(p->bSyncPoint)
+ {
+ fKeyFrameFound = true;
+ fSkipKeyFrame = p->fSkip;
+ }
+ }
+
+ if(fKeyFrameFound) break;
+ }
+ else
+ {
+ pPin->UnpackPage(page);
+
+ CAutoPtr<OggPacket> p;
+ while(p = pPin->GetPacket())
+ {
+ if(!p->fSkip)
+ {
+ fSkipKeyFrame = false;
+ break;
+ }
+ }
+ }
+ }
+
+ if(!(fKeyFrameFound && !fSkipKeyFrame)) {endpos = startpos; startpos = max(startpos - 10*65536, 0);}
+
+ m_pFile->Seek(startpos);
+ }
+
+#ifdef DEBUG
+ // verify kf
+
+ {
+ fKeyFrameFound = false;
+
+ OggPage page;
+ while(!fKeyFrameFound && m_pFile->Read(page))
+ {
+ if(page.m_hdr.granule_position == -1) continue;
+
+ if(pPin != dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number)))
+ continue;
+
+ REFERENCE_TIME rtPos = pPin->GetRefTime(page.m_hdr.granule_position);
+ if(rtPos > rt)
+ break;
+
+ pPin->UnpackPage(page);
+
+ CAutoPtr<OggPacket> p;
+ while(p = pPin->GetPacket())
+ {
+ if(p->bSyncPoint)
+ {
+ fKeyFrameFound = true;
+ break;
+ }
+ }
+ }
+
+ ASSERT(fKeyFrameFound);
+
+ m_pFile->Seek(startpos);
+ }
+#endif
+ break;
+ }
+ }
+}
+
+bool COggSplitterFilter::DemuxLoop()
+{
+ HRESULT hr = S_OK;
+
+ OggPage page;
+ while(SUCCEEDED(hr) && !CheckRequest(NULL) && m_pFile->Read(page, true, GetRequestHandle()))
+ {
+ COggSplitterOutputPin* pOggPin = dynamic_cast<COggSplitterOutputPin*>(GetOutputPin(page.m_hdr.bitstream_serial_number));
+ if(!pOggPin) {ASSERT(0); continue;}
+ if(!pOggPin->IsConnected()) continue;
+ if(FAILED(hr = pOggPin->UnpackPage(page))) {ASSERT(0); break;}
+ CAutoPtr<OggPacket> p;
+ while(!CheckRequest(NULL) && SUCCEEDED(hr) && (p = pOggPin->GetPacket()))
+ {
+ if(!p->fSkip)
+ hr = DeliverPacket(p);
+ }
+ }
+
+ return(true);
+}
+
+//
+// COggSourceFilter
+//
+
+COggSourceFilter::COggSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : COggSplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
+
+//
+// COggSplitterOutputPin
+//
+
+COggSplitterOutputPin::COggSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseSplitterOutputPin(pName, pFilter, pLock, phr)
+{
+ ResetState(-1);
+}
+
+void COggSplitterOutputPin::AddComment(BYTE* p, int len)
+{
+ bitstream bs(p, len);
+ bs.getbits(bs.getbits(32)*8);
+ for(int n = bs.getbits(32); n-- > 0; )
+ {
+ CStringA str;
+ for(int len = bs.getbits(32); len-- > 0; )
+ str += (CHAR)bs.getbits(8);
+
+ CAtlList<CStringA> sl;
+ Explode(str, sl, '=', 2);
+ if(sl.GetCount() == 2)
+ {
+ CAutoPtr<CComment> p(new CComment(UTF8To16(sl.GetHead()), UTF8To16(sl.GetTail())));
+
+ if(p->m_key == L"LANGUAGE")
+ {
+ CString lang = ISO6392ToLanguage(sl.GetTail()), iso6392 = LanguageToISO6392(CString(p->m_value));
+
+ if(p->m_value.GetLength() == 3 && !lang.IsEmpty())
+ {
+ SetName(CStringW(lang));
+ SetProperty(L"LANG", p->m_value);
+ }
+ else if(!iso6392.IsEmpty())
+ {
+ SetName(p->m_value);
+ SetProperty(L"LANG", CStringW(iso6392));
+ }
+ else
+ {
+ SetName(p->m_value);
+ SetProperty(L"NAME", p->m_value);
+ }
+ }
+
+ m_pComments.AddTail(p);
+ }
+ }
+ ASSERT(bs.getbits(1) == 1);
+}
+
+CStringW COggSplitterOutputPin::GetComment(CStringW key)
+{
+ key.MakeUpper();
+ CAtlList<CStringW> sl;
+ POSITION pos = m_pComments.GetHeadPosition();
+ while(pos)
+ {
+ CComment* p = m_pComments.GetNext(pos);
+ if(key == p->m_key) sl.AddTail(p->m_value);
+ }
+ return Implode(sl, ';');
+}
+
+void COggSplitterOutputPin::ResetState(DWORD seqnum)
+{
+ CAutoLock csAutoLock(&m_csPackets);
+ m_packets.RemoveAll();
+ m_lastpacket.Free();
+ m_lastseqnum = seqnum;
+ m_rtLast = 0;
+ m_fSkip = true;
+}
+
+HRESULT COggSplitterOutputPin::UnpackPage(OggPage& page)
+{
+ if(m_lastseqnum != page.m_hdr.page_sequence_number-1)
+ {
+ ResetState(page.m_hdr.page_sequence_number);
+ return S_FALSE; // FIXME
+ }
+ else
+ {
+ m_lastseqnum = page.m_hdr.page_sequence_number;
+ }
+
+ POSITION first = page.m_lens.GetHeadPosition();
+ while(first && page.m_lens.GetAt(first) == 255) page.m_lens.GetNext(first);
+ if(!first) first = page.m_lens.GetTailPosition();
+
+ POSITION last = page.m_lens.GetTailPosition();
+ while(last && page.m_lens.GetAt(last) == 255) page.m_lens.GetPrev(last);
+ if(!last) last = page.m_lens.GetTailPosition();
+
+ BYTE* pData = page.GetData();
+
+ int i = 0, j = 0, len = 0;
+
+ for(POSITION pos = page.m_lens.GetHeadPosition(); pos; page.m_lens.GetNext(pos))
+ {
+ len = page.m_lens.GetAt(pos);
+ j += len;
+
+ if(len < 255 || pos == page.m_lens.GetTailPosition())
+ {
+ if(first == pos && (page.m_hdr.header_type_flag & OggPageHeader::continued))
+ {
+// ASSERT(m_lastpacket);
+
+ if(m_lastpacket)
+ {
+ int size = m_lastpacket->GetCount();
+ m_lastpacket->SetCount(size + j-i);
+ memcpy(m_lastpacket->GetData() + size, pData + i, j-i);
+
+ CAutoLock csAutoLock(&m_csPackets);
+
+ if(len < 255) m_packets.AddTail(m_lastpacket);
+ }
+ }
+ else
+ {
+ CAutoPtr<OggPacket> p(new OggPacket());
+
+ if(last == pos && page.m_hdr.granule_position != -1)
+ {
+ p->bDiscontinuity = m_fSkip;
+REFERENCE_TIME rtLast = m_rtLast;
+ m_rtLast = GetRefTime(page.m_hdr.granule_position);
+// some bad encodings have a +/-1 frame difference from the normal timeline,
+// but these seem to cancel eachother out nicely so we can just ignore them
+// to make it play a bit more smooth.
+if(abs(rtLast - m_rtLast) == GetRefTime(1)) m_rtLast = rtLast; // FIXME
+ m_fSkip = false;
+ }
+
+ p->TrackNumber = page.m_hdr.bitstream_serial_number;
+
+ if(S_OK == UnpackPacket(p, pData + i, j-i))
+ {
+//if(p->TrackNumber == 1)
+TRACE(_T("[%d]: %d, %I64d -> %I64d (skip=%d, disc=%d, sync=%d)\n"),
+ (int)p->TrackNumber, p->GetCount(), p->rtStart, p->rtStop,
+ (int)m_fSkip, (int)p->bDiscontinuity, (int)p->bSyncPoint);
+
+ if(p->rtStart <= p->rtStop && p->rtStop <= p->rtStart + 10000000i64*60)
+ {
+ CAutoLock csAutoLock(&m_csPackets);
+
+ m_rtLast = p->rtStop;
+ p->fSkip = m_fSkip;
+
+ if(len < 255) m_packets.AddTail(p);
+ else m_lastpacket = p;
+ }
+ else
+ {
+ ASSERT(0);
+ }
+ }
+ }
+
+ i = j;
+ }
+ }
+
+ return S_OK;
+}
+
+CAutoPtr<OggPacket> COggSplitterOutputPin::GetPacket()
+{
+ CAutoPtr<OggPacket> p;
+ CAutoLock csAutoLock(&m_csPackets);
+ if(m_packets.GetCount()) p = m_packets.RemoveHead();
+ return p;
+}
+
+HRESULT COggSplitterOutputPin::DeliverEndFlush()
+{
+ ResetState();
+ return __super::DeliverEndFlush();
+}
+
+HRESULT COggSplitterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ ResetState();
+ return __super::DeliverNewSegment(tStart, tStop, dRate);
+}
+
+//
+// COggVorbisOutputPin
+//
+
+COggVorbisOutputPin::COggVorbisOutputPin(OggVorbisIdHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : COggSplitterOutputPin(pName, pFilter, pLock, phr)
+{
+ m_audio_sample_rate = h->audio_sample_rate;
+ m_blocksize[0] = 1<<h->blocksize_0;
+ m_blocksize[1] = 1<<h->blocksize_1;
+ m_lastblocksize = 0;
+
+ CMediaType mt;
+
+ mt.InitMediaType();
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = MEDIASUBTYPE_Vorbis;
+ mt.formattype = FORMAT_VorbisFormat;
+ VORBISFORMAT* vf = (VORBISFORMAT*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT));
+ memset(mt.Format(), 0, mt.FormatLength());
+ vf->nChannels = h->audio_channels;
+ vf->nSamplesPerSec = h->audio_sample_rate;
+ vf->nAvgBitsPerSec = h->bitrate_nominal;
+ vf->nMinBitsPerSec = h->bitrate_minimum;
+ vf->nMaxBitsPerSec = h->bitrate_maximum;
+ vf->fQuality = -1;
+ mt.SetSampleSize(8192);
+ m_mts.Add(mt);
+
+ mt.InitMediaType();
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = MEDIASUBTYPE_Vorbis2;
+ mt.formattype = FORMAT_VorbisFormat2;
+ VORBISFORMAT2* vf2 = (VORBISFORMAT2*)mt.AllocFormatBuffer(sizeof(VORBISFORMAT2));
+ memset(mt.Format(), 0, mt.FormatLength());
+ vf2->Channels = h->audio_channels;
+ vf2->SamplesPerSec = h->audio_sample_rate;
+ mt.SetSampleSize(8192);
+ m_mts.InsertAt(0, mt);
+}
+
+HRESULT COggVorbisOutputPin::UnpackInitPage(OggPage& page)
+{
+ HRESULT hr = __super::UnpackPage(page);
+
+ while(m_packets.GetCount())
+ {
+ Packet* p = m_packets.GetHead();
+
+ if(p->GetCount() >= 6 && p->GetAt(0) == 0x05)
+ {
+ // yeah, right, we are going to be parsing this backwards! :P
+ bitstream bs(p->GetData(), p->GetCount(), true);
+ while(bs.hasbits(-1) && bs.getbits(-1) != 1);
+ for(int cnt = 0; bs.hasbits(-8-16-16-1-6); cnt++)
+ {
+ unsigned int modes = bs.showbits(-6)+1;
+
+ unsigned int mapping = bs.getbits(-8);
+ unsigned int transformtype = bs.getbits(-16);
+ unsigned int windowtype = bs.getbits(-16);
+ unsigned int blockflag = bs.getbits(-1);
+
+ if(transformtype != 0 || windowtype != 0)
+ {
+ ASSERT(modes == cnt);
+ break;
+ }
+
+ m_blockflags.InsertAt(0, !!blockflag);
+ }
+ }
+
+ int cnt = m_initpackets.GetCount();
+ if(cnt <= 3)
+ {
+ ASSERT(p->GetCount() >= 6 && p->GetAt(0) == 1+cnt*2);
+ VORBISFORMAT2* vf2 = (VORBISFORMAT2*)m_mts[0].Format();
+ vf2->HeaderSize[cnt] = p->GetCount();
+ int len = m_mts[0].FormatLength();
+ memcpy(
+ m_mts[0].ReallocFormatBuffer(len + p->GetCount()) + len,
+ p->GetData(), p->GetCount());
+ }
+
+ m_initpackets.AddTail(m_packets.RemoveHead());
+ }
+
+ return hr;
+}
+
+REFERENCE_TIME COggVorbisOutputPin::GetRefTime(__int64 granule_position)
+{
+ REFERENCE_TIME rt = granule_position * 10000000 / m_audio_sample_rate;
+ return rt;
+}
+
+HRESULT COggVorbisOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
+{
+ if(len > 0 && m_blockflags.GetCount())
+ {
+ bitstream bs(pData, len);
+ if(bs.getbits(1) == 0)
+ {
+ int x = m_blockflags.GetCount()-1, n = 0;
+ while(x) {n++; x >>= 1;}
+ DWORD blocksize = m_blocksize[m_blockflags[bs.getbits(n)]?1:0];
+ if(m_lastblocksize) m_rtLast += GetRefTime((m_lastblocksize + blocksize) >> 2);
+ m_lastblocksize = blocksize;
+ }
+ }
+
+ p->bSyncPoint = TRUE;
+ p->rtStart = m_rtLast;
+ p->rtStop = m_rtLast+1;
+ p->SetData(pData, len);
+
+ return S_OK;
+}
+
+HRESULT COggVorbisOutputPin::DeliverPacket(CAutoPtr<OggPacket> p)
+{
+ if(p->GetCount() > 0 && (p->GetAt(0)&1))
+ return S_OK;
+
+ return __super::DeliverPacket(p);
+}
+
+HRESULT COggVorbisOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ HRESULT hr = __super::DeliverNewSegment(tStart, tStop, dRate);
+
+ m_lastblocksize = 0;
+
+ if(m_mt.subtype == MEDIASUBTYPE_Vorbis)
+ {
+ POSITION pos = m_initpackets.GetHeadPosition();
+ while(pos)
+ {
+ Packet* pi = m_initpackets.GetNext(pos);
+ CAutoPtr<OggPacket> p(new OggPacket());
+ p->TrackNumber = pi->TrackNumber;
+ p->bDiscontinuity = p->bSyncPoint = FALSE;//TRUE;
+ p->rtStart = p->rtStop = 0;
+ p->Copy(*pi);
+ __super::DeliverPacket(p);
+ }
+ }
+
+ return hr;
+}
+
+//
+// COggDirectShowOutputPin
+//
+
+COggDirectShowOutputPin::COggDirectShowOutputPin(AM_MEDIA_TYPE* pmt, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : COggSplitterOutputPin(pName, pFilter, pLock, phr)
+{
+ CMediaType mt;
+ memcpy((AM_MEDIA_TYPE*)&mt, pmt, FIELD_OFFSET(AM_MEDIA_TYPE, pUnk));
+ mt.SetFormat((BYTE*)(pmt+1), pmt->cbFormat);
+ mt.SetSampleSize(1);
+ if(mt.majortype == MEDIATYPE_Video) // TODO: find samples for audio and find out what to return in GetRefTime...
+ m_mts.Add(mt);
+}
+
+REFERENCE_TIME COggDirectShowOutputPin::GetRefTime(__int64 granule_position)
+{
+ REFERENCE_TIME rt = 0;
+
+ if(m_mt.majortype == MEDIATYPE_Video)
+ {
+ rt = granule_position * ((VIDEOINFOHEADER*)m_mt.Format())->AvgTimePerFrame;
+ }
+ else if(m_mt.majortype == MEDIATYPE_Audio)
+ {
+ rt = granule_position; // ((WAVEFORMATEX*)m_mt.Format())-> // TODO
+ }
+
+ return rt;
+}
+
+HRESULT COggDirectShowOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
+{
+ int i = 0;
+
+ BYTE hdr = pData[i++];
+
+ if(!(hdr&1))
+ {
+ // TODO: verify if this was still present in the old format (haven't found one sample yet)
+ BYTE nLenBytes = (hdr>>6)|((hdr&2)<<1);
+ __int64 Length = 0;
+ for(int j = 0; j < nLenBytes; j++)
+ Length |= (__int64)pData[i++] << (j << 3);
+
+ if(len < i) {ASSERT(0); return E_FAIL;}
+
+ p->bSyncPoint = !!(hdr&8);
+ p->rtStart = m_rtLast;
+ p->rtStop = m_rtLast + (nLenBytes ? GetRefTime(Length) : GetRefTime(1));
+ p->SetData(&pData[i], len - i);
+
+ return S_OK;
+ }
+
+ return S_FALSE;
+}
+
+//
+// COggStreamOutputPin
+//
+
+COggStreamOutputPin::COggStreamOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : COggSplitterOutputPin(pName, pFilter, pLock, phr)
+{
+ m_time_unit = h->time_unit;
+ m_samples_per_unit = h->samples_per_unit;
+ m_default_len = h->default_len;
+}
+
+REFERENCE_TIME COggStreamOutputPin::GetRefTime(__int64 granule_position)
+{
+ return granule_position * m_time_unit / m_samples_per_unit;
+}
+
+HRESULT COggStreamOutputPin::UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len)
+{
+ int i = 0;
+
+ BYTE hdr = pData[i++];
+
+ if(!(hdr&1))
+ {
+ BYTE nLenBytes = (hdr>>6)|((hdr&2)<<1);
+ __int64 Length = 0;
+ for(int j = 0; j < nLenBytes; j++)
+ Length |= (__int64)pData[i++] << (j << 3);
+
+ if(len < i) {ASSERT(0); return E_FAIL;}
+
+ p->bSyncPoint = !!(hdr&8);
+ p->rtStart = m_rtLast;
+ p->rtStop = m_rtLast + (nLenBytes ? GetRefTime(Length) : GetRefTime(m_default_len));
+ p->SetData(&pData[i], len - i);
+
+ return S_OK;
+ }
+
+ return S_FALSE;
+}
+
+//
+// COggVideoOutputPin
+//
+
+COggVideoOutputPin::COggVideoOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : COggStreamOutputPin(h, pName, pFilter, pLock, phr)
+{
+ int extra = (int)h->size - sizeof(OggStreamHeader);
+ extra = max(extra, 0);
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = FOURCCMap(MAKEFOURCC(h->subtype[0],h->subtype[1],h->subtype[2],h->subtype[3]));
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + extra);
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(mt.Format() + sizeof(VIDEOINFOHEADER), h+1, extra);
+ pvih->AvgTimePerFrame = h->time_unit / h->samples_per_unit;
+ pvih->bmiHeader.biWidth = h->v.w;
+ pvih->bmiHeader.biHeight = h->v.h;
+ pvih->bmiHeader.biBitCount = (WORD)h->bps;
+ pvih->bmiHeader.biCompression = mt.subtype.Data1;
+ switch(pvih->bmiHeader.biCompression)
+ {
+ case BI_RGB: case BI_BITFIELDS: mt.subtype =
+ pvih->bmiHeader.biBitCount == 1 ? MEDIASUBTYPE_RGB1 :
+ pvih->bmiHeader.biBitCount == 4 ? MEDIASUBTYPE_RGB4 :
+ pvih->bmiHeader.biBitCount == 8 ? MEDIASUBTYPE_RGB8 :
+ pvih->bmiHeader.biBitCount == 16 ? MEDIASUBTYPE_RGB565 :
+ pvih->bmiHeader.biBitCount == 24 ? MEDIASUBTYPE_RGB24 :
+ pvih->bmiHeader.biBitCount == 32 ? MEDIASUBTYPE_RGB32 :
+ MEDIASUBTYPE_NULL;
+ break;
+ case BI_RLE8: mt.subtype = MEDIASUBTYPE_RGB8; break;
+ case BI_RLE4: mt.subtype = MEDIASUBTYPE_RGB4; break;
+ }
+ mt.SetSampleSize(max(h->buffersize, 1));
+ m_mts.Add(mt);
+}
+
+//
+// COggAudioOutputPin
+//
+
+COggAudioOutputPin::COggAudioOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : COggStreamOutputPin(h, pName, pFilter, pLock, phr)
+{
+ int extra = (int)h->size - sizeof(OggStreamHeader);
+ extra = max(extra, 0);
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = FOURCCMap(strtol(CStringA(h->subtype, 4), NULL, 16));
+ mt.formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + extra);
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(mt.Format() + sizeof(WAVEFORMATEX), h+1, extra);
+ wfe->cbSize = extra;
+ wfe->wFormatTag = (WORD)mt.subtype.Data1;
+ wfe->nChannels = h->a.nChannels;
+ wfe->nSamplesPerSec = (DWORD)(10000000i64 * h->samples_per_unit / h->time_unit);
+ wfe->wBitsPerSample = (WORD)h->bps;
+ wfe->nAvgBytesPerSec = h->a.nAvgBytesPerSec; // TODO: verify for PCM
+ wfe->nBlockAlign = h->a.nBlockAlign; // TODO: verify for PCM
+ mt.SetSampleSize(max(h->buffersize, 1));
+ m_mts.Add(mt);
+}
+
+//
+// COggTextOutputPin
+//
+
+COggTextOutputPin::COggTextOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : COggStreamOutputPin(h, pName, pFilter, pLock, phr)
+{
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Text;
+ mt.subtype = MEDIASUBTYPE_NULL;
+ mt.formattype = FORMAT_None;
+ mt.SetSampleSize(1);
+ m_mts.Add(mt);
+}
+
diff --git a/src/filters/parser/oggsplitter/OggSplitter.def b/src/filters/parser/oggsplitter/OggSplitter.def
new file mode 100644
index 000000000..aa9066fd0
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "OggSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/oggsplitter/OggSplitter.h b/src/filters/parser/oggsplitter/OggSplitter.h
new file mode 100644
index 000000000..fecea1569
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggSplitter.h
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "OggFile.h"
+#include "..\BaseSplitter\BaseSplitter.h"
+
+class OggPacket : public Packet
+{
+public:
+ OggPacket() {fSkip = false;}
+ bool fSkip;
+};
+
+class COggSplitterOutputPin : public CBaseSplitterOutputPin
+{
+ class CComment
+ {
+ public:
+ CStringW m_key, m_value;
+ CComment(CStringW key, CStringW value) : m_key(key), m_value(value) {m_key.MakeUpper();}
+ };
+
+ CAutoPtrList<CComment> m_pComments;
+
+protected:
+ CCritSec m_csPackets;
+ CAutoPtrList<OggPacket> m_packets;
+ CAutoPtr<OggPacket> m_lastpacket;
+ int m_lastseqnum;
+ REFERENCE_TIME m_rtLast;
+ bool m_fSkip;
+
+ void ResetState(DWORD seqnum = -1);
+
+public:
+ COggSplitterOutputPin(LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+
+ void AddComment(BYTE* p, int len);
+ CStringW GetComment(CStringW key);
+
+ HRESULT UnpackPage(OggPage& page);
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len) = 0;
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position) = 0;
+ CAutoPtr<OggPacket> GetPacket();
+
+ HRESULT DeliverEndFlush();
+ HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+};
+
+class COggVorbisOutputPin : public COggSplitterOutputPin
+{
+ CAutoPtrList<OggPacket> m_initpackets;
+
+ DWORD m_audio_sample_rate;
+ DWORD m_blocksize[2], m_lastblocksize;
+ CAtlArray<bool> m_blockflags;
+
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
+
+ HRESULT DeliverPacket(CAutoPtr<OggPacket> p);
+ HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+public:
+ COggVorbisOutputPin(OggVorbisIdHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+
+ HRESULT UnpackInitPage(OggPage& page);
+ bool IsInitialized() {return m_initpackets.GetCount() >= 3;}
+};
+
+class COggDirectShowOutputPin : public COggSplitterOutputPin
+{
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
+
+public:
+ COggDirectShowOutputPin(AM_MEDIA_TYPE* pmt, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+};
+
+class COggStreamOutputPin : public COggSplitterOutputPin
+{
+ __int64 m_time_unit, m_samples_per_unit;
+ DWORD m_default_len;
+
+ virtual HRESULT UnpackPacket(CAutoPtr<OggPacket>& p, BYTE* pData, int len);
+ virtual REFERENCE_TIME GetRefTime(__int64 granule_position);
+
+public:
+ COggStreamOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+};
+
+class COggVideoOutputPin : public COggStreamOutputPin
+{
+public:
+ COggVideoOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+};
+
+class COggAudioOutputPin : public COggStreamOutputPin
+{
+public:
+ COggAudioOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+};
+
+class COggTextOutputPin : public COggStreamOutputPin
+{
+public:
+ COggTextOutputPin(OggStreamHeader* h, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+};
+
+[uuid("9FF48807-E133-40AA-826F-9B2959E5232D")]
+class COggSplitterFilter : public CBaseSplitterFilter
+{
+protected:
+ CAutoPtr<COggFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+public:
+ COggSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~COggSplitterFilter();
+};
+
+[uuid("6D3688CE-3E9D-42F4-92CA-8A11119D25CD")]
+class COggSourceFilter : public COggSplitterFilter
+{
+public:
+ COggSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
diff --git a/src/filters/parser/oggsplitter/OggSplitter.rc b/src/filters/parser/oggsplitter/OggSplitter.rc
new file mode 100644
index 000000000..926e0fab8
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Ogg Splitter"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "Ogg Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "OggSplitter.ax"
+ VALUE "ProductName", "Ogg Splitter"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/oggsplitter/OggSplitter.sln b/src/filters/parser/oggsplitter/OggSplitter.sln
new file mode 100644
index 000000000..7e3e911da
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggSplitter.sln
@@ -0,0 +1,94 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OggSplitter", "OggSplitter.vcproj", "{7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug.ActiveCfg = Debug|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug lib.ActiveCfg = Debug lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release.ActiveCfg = Release|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release lib.ActiveCfg = Release lib|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/oggsplitter/OggSplitter.vcproj b/src/filters/parser/oggsplitter/OggSplitter.vcproj
new file mode 100644
index 000000000..28468cb88
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggSplitter.vcproj
@@ -0,0 +1,559 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="OggSplitter"
+ ProjectGUID="{7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\OggFile.cpp">
+ </File>
+ <File
+ RelativePath="OggSplitter.cpp">
+ </File>
+ <File
+ RelativePath="OggSplitter.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\OggFile.h">
+ </File>
+ <File
+ RelativePath="OggSplitter.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\OggSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/oggsplitter/OggSplitter_vs2005.vcproj b/src/filters/parser/oggsplitter/OggSplitter_vs2005.vcproj
new file mode 100644
index 000000000..e1cfdc364
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggSplitter_vs2005.vcproj
@@ -0,0 +1,811 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="OggSplitter"
+ ProjectGUID="{7FE0A205-3F39-4AC3-BC3C-C2D9E4D02475}"
+ RootNamespace="OggSplitter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\OggFile.cpp"
+ >
+ </File>
+ <File
+ RelativePath="OggSplitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="OggSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\OggFile.h"
+ >
+ </File>
+ <File
+ RelativePath="OggSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\OggSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/oggsplitter/OggSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/oggsplitter/OggSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/oggsplitter/OggSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/oggsplitter/resource.h b/src/filters/parser/oggsplitter/resource.h
new file mode 100644
index 000000000..3bf040c0b
--- /dev/null
+++ b/src/filters/parser/oggsplitter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by OggSplitter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/oggsplitter/stdafx.cpp b/src/filters/parser/oggsplitter/stdafx.cpp
new file mode 100644
index 000000000..804db5e5a
--- /dev/null
+++ b/src/filters/parser/oggsplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// OggSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/oggsplitter/stdafx.h b/src/filters/parser/oggsplitter/stdafx.h
new file mode 100644
index 000000000..d3b034114
--- /dev/null
+++ b/src/filters/parser/oggsplitter/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
+#include "..\..\..\DSUtil\DSUtil.h"
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter.cpp b/src/filters/parser/realmediasplitter/RealMediaSplitter.cpp
new file mode 100644
index 000000000..c1c4b00d9
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/RealMediaSplitter.cpp
@@ -0,0 +1,2353 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <Shlwapi.h>
+#include <atlpath.h>
+#include <mmreg.h>
+#include <ks.h>
+#include <ksmedia.h>
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include "RealMediaSplitter.h"
+#include "..\..\..\subtitles\SubtitleInputPin.h"
+
+//
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+template<typename T>
+static void bswap(T& var)
+{
+ BYTE* s = (BYTE*)&var;
+ for(BYTE* d = s + sizeof(var)-1; s < d; s++, d--)
+ *s ^= *d, *d ^= *s, *s ^= *d;
+}
+
+void rvinfo::bswap()
+{
+ ::bswap(dwSize);
+ ::bswap(w); ::bswap(h); ::bswap(bpp);
+ ::bswap(unk1); ::bswap(fps);
+ ::bswap(type1); ::bswap(type2);
+}
+
+void rainfo::bswap()
+{
+ ::bswap(version1);
+ ::bswap(version2);
+ ::bswap(header_size);
+ ::bswap(flavor);
+ ::bswap(coded_frame_size);
+ ::bswap(sub_packet_h);
+ ::bswap(frame_size);
+ ::bswap(sub_packet_size);
+}
+
+void rainfo4::bswap()
+{
+ __super::bswap();
+ ::bswap(sample_rate);
+ ::bswap(sample_size);
+ ::bswap(channels);
+}
+
+void rainfo5::bswap()
+{
+ __super::bswap();
+ ::bswap(sample_rate);
+ ::bswap(sample_size);
+ ::bswap(channels);
+}
+
+using namespace RMFF;
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn2[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RV20},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RV30},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RV40},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RV41},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut2[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins2[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn2), sudPinTypesIn2},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut2), sudPinTypesOut2}
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn3[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_14_4},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_28_8},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_ATRC},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_COOK},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DNET},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_SIPR},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_RAAC},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_RACP},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut3[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
+};
+
+const AMOVIESETUP_PIN sudpPins3[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn3), sudPinTypesIn3},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut3), sudPinTypesOut3}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CRealMediaSplitterFilter), L"RealMedia Splitter", MERIT_NORMAL, countof(sudpPins), sudpPins},
+ {&__uuidof(CRealMediaSourceFilter), L"RealMedia Source", MERIT_NORMAL, 0, NULL},
+ {&__uuidof(CRealVideoDecoder), L"RealVideo Decoder", MERIT_UNLIKELY, countof(sudpPins2), sudpPins2},
+ {&__uuidof(CRealAudioDecoder), L"RealAudio Decoder", MERIT_UNLIKELY, countof(sudpPins3), sudpPins3},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CRealMediaSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CRealMediaSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CRealVideoDecoder>, NULL, &sudFilter[2]},
+ {sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CRealAudioDecoder>, NULL, &sudFilter[3]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ RegisterSourceFilter(
+ CLSID_AsyncReader,
+ MEDIASUBTYPE_RealMedia,
+ _T("0,4,,2E524D46"),
+ _T(".rm"), _T(".rmvb"), _T(".ram"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ UnRegisterSourceFilter(MEDIASUBTYPE_RealMedia);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CRealMediaSplitterFilter
+//
+
+CRealMediaSplitterFilter::CRealMediaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("CRealMediaSplitterFilter"), pUnk, phr, __uuidof(this))
+{
+}
+
+CRealMediaSplitterFilter::~CRealMediaSplitterFilter()
+{
+}
+
+HRESULT CRealMediaSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ {
+ DWORD dw;
+ if(FAILED(pAsyncReader->SyncRead(0, 4, (BYTE*)&dw)) || dw != 'FMR.')
+ return E_FAIL;
+ }
+
+ HRESULT hr = E_FAIL;
+
+ m_pFile.Free();
+
+ m_pFile.Attach(new CRMFile(pAsyncReader, hr));
+ if(!m_pFile) return E_OUTOFMEMORY;
+ if(FAILED(hr)) {m_pFile.Free(); return hr;}
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = 0;
+
+ m_rtStop = 10000i64*m_pFile->m_p.tDuration;
+
+ POSITION pos = m_pFile->m_mps.GetHeadPosition();
+ while(pos)
+ {
+ MediaProperies* pmp = m_pFile->m_mps.GetNext(pos);
+
+ CStringW name;
+ name.Format(L"Output %02d", pmp->stream);
+ if(!pmp->name.IsEmpty()) name += L" (" + CStringW(pmp->name) + L")";
+
+ CAtlArray<CMediaType> mts;
+
+ CMediaType mt;
+ mt.SetSampleSize(max(pmp->maxPacketSize*16/**/, 1));
+
+ if(pmp->mime == "video/x-pn-realvideo")
+ {
+ mt.majortype = MEDIATYPE_Video;
+ mt.formattype = FORMAT_VideoInfo;
+
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER) + pmp->typeSpecData.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(pvih + 1, pmp->typeSpecData.GetData(), pmp->typeSpecData.GetCount());
+
+ rvinfo rvi = *(rvinfo*)pmp->typeSpecData.GetData();
+ rvi.bswap();
+
+ ASSERT(rvi.dwSize >= FIELD_OFFSET(rvinfo, morewh));
+ ASSERT(rvi.fcc1 == 'ODIV');
+
+ mt.subtype = FOURCCMap(rvi.fcc2);
+ if(rvi.fps > 0x10000) pvih->AvgTimePerFrame = REFERENCE_TIME(10000000i64 / ((float)rvi.fps/0x10000));
+ pvih->dwBitRate = pmp->avgBitRate;
+ pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
+ pvih->bmiHeader.biWidth = rvi.w;
+ pvih->bmiHeader.biHeight = rvi.h;
+ pvih->bmiHeader.biPlanes = 3;
+ pvih->bmiHeader.biBitCount = rvi.bpp;
+ pvih->bmiHeader.biCompression = rvi.fcc2;
+ pvih->bmiHeader.biSizeImage = rvi.w*rvi.h*3/2;
+
+ mts.Add(mt);
+
+ if(pmp->width > 0 && pmp->height > 0)
+ {
+ BITMAPINFOHEADER bmi = pvih->bmiHeader;
+ mt.formattype = FORMAT_VideoInfo2;
+ VIDEOINFOHEADER2* pvih2 = (VIDEOINFOHEADER2*)mt.ReallocFormatBuffer(sizeof(VIDEOINFOHEADER2) + pmp->typeSpecData.GetCount());
+ memset(mt.Format() + FIELD_OFFSET(VIDEOINFOHEADER2, dwInterlaceFlags), 0, mt.FormatLength() - FIELD_OFFSET(VIDEOINFOHEADER2, dwInterlaceFlags));
+ memcpy(pvih2 + 1, pmp->typeSpecData.GetData(), pmp->typeSpecData.GetCount());
+ pvih2->bmiHeader = bmi;
+ pvih2->bmiHeader.biWidth = (DWORD)pmp->width;
+ pvih2->bmiHeader.biHeight = (DWORD)pmp->height;
+ pvih2->dwPictAspectRatioX = rvi.w;
+ pvih2->dwPictAspectRatioY = rvi.h;
+
+ mts.InsertAt(0, mt);
+ }
+ }
+ else if(pmp->mime == "audio/x-pn-realaudio")
+ {
+ mt.majortype = MEDIATYPE_Audio;
+ mt.formattype = FORMAT_WaveFormatEx;
+ mt.bTemporalCompression = 1;
+
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.AllocFormatBuffer(sizeof(WAVEFORMATEX) + pmp->typeSpecData.GetCount());
+ memset(mt.Format(), 0, mt.FormatLength());
+ memcpy(pwfe + 1, pmp->typeSpecData.GetData(), pmp->typeSpecData.GetCount());
+
+ union {
+ DWORD fcc;
+ char fccstr[5];
+ };
+
+ fcc = 0;
+ fccstr[4] = 0;
+
+ BYTE* fmt = pmp->typeSpecData.GetData();
+ for(int i = 0; i < pmp->typeSpecData.GetCount()-4; i++, fmt++)
+ {
+ if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a')
+ break;
+ }
+
+ rainfo rai = *(rainfo*)fmt;
+ rai.bswap();
+
+ BYTE* extra = NULL;
+
+ if(rai.version2 == 4)
+ {
+ rainfo4 rai4 = *(rainfo4*)fmt;
+ rai4.bswap();
+ pwfe->nChannels = rai4.channels;
+ pwfe->wBitsPerSample = rai4.sample_size;
+ pwfe->nSamplesPerSec = rai4.sample_rate;
+ pwfe->nBlockAlign = rai4.frame_size;
+ BYTE* p = (BYTE*)((rainfo4*)fmt+1);
+ int len = *p++; p += len; len = *p++; ASSERT(len == 4);
+ if(len == 4)
+ fcc = MAKEFOURCC(p[0],p[1],p[2],p[3]);
+ extra = p + len + 3;
+ }
+ else if(rai.version2 == 5)
+ {
+ rainfo5 rai5 = *(rainfo5*)fmt;
+ rai5.bswap();
+ pwfe->nChannels = rai5.channels;
+ pwfe->wBitsPerSample = rai5.sample_size;
+ pwfe->nSamplesPerSec = rai5.sample_rate;
+ pwfe->nBlockAlign = rai5.frame_size;
+ fcc = rai5.fourcc3;
+ extra = fmt + sizeof(rainfo5) + 4;
+ }
+ else
+ {
+ continue;
+ }
+
+ _strupr(fccstr);
+
+ mt.subtype = FOURCCMap(fcc);
+
+ bswap(fcc);
+
+ switch(fcc)
+ {
+ case '14_4': pwfe->wFormatTag = WAVE_FORMAT_14_4; break;
+ case '28_8': pwfe->wFormatTag = WAVE_FORMAT_28_8; break;
+ case 'ATRC': pwfe->wFormatTag = WAVE_FORMAT_ATRC; break;
+ case 'COOK': pwfe->wFormatTag = WAVE_FORMAT_COOK; break;
+ case 'DNET': pwfe->wFormatTag = WAVE_FORMAT_DNET; break;
+ case 'SIPR': pwfe->wFormatTag = WAVE_FORMAT_SIPR; break;
+ case 'RAAC': pwfe->wFormatTag = WAVE_FORMAT_RAAC; break;
+ case 'RACP': pwfe->wFormatTag = WAVE_FORMAT_RACP; break;
+ }
+
+ if(pwfe->wFormatTag)
+ {
+ mts.Add(mt);
+
+ if(fcc == 'DNET')
+ {
+ mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3);
+ mts.InsertAt(0, mt);
+ }
+ else if(fcc == 'RAAC' || fcc == 'RACP')
+ {
+ mt.subtype = FOURCCMap(pwfe->wFormatTag = WAVE_FORMAT_AAC);
+ int extralen = *(DWORD*)extra; extra += 4;
+ ::bswap(extralen);
+ ASSERT(*extra == 2); // always 2? why? what does it mean?
+ if(*extra == 2)
+ {
+ extra++; extralen--;
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + extralen);
+ pwfe->cbSize = extralen;
+ memcpy(pwfe + 1, extra, extralen);
+ }
+ else
+ {
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)mt.ReallocFormatBuffer(sizeof(WAVEFORMATEX) + 5);
+ pwfe->cbSize = MakeAACInitData((BYTE*)(pwfe+1), 0, pwfe->nSamplesPerSec, pwfe->nChannels);
+ }
+ mts.InsertAt(0, mt);
+ }
+ }
+ }
+ else if(pmp->mime == "logical-fileinfo")
+ {
+ CAtlMap<CStringA, CStringA, CStringElementTraits<CStringA> > lfi;
+ CStringA key, value;
+
+ BYTE* p = pmp->typeSpecData.GetData();
+ BYTE* end = p + pmp->typeSpecData.GetCount();
+ p += 8;
+
+ DWORD cnt = p <= end-4 ? *(DWORD*)p : 0; bswap(cnt); p += 4;
+
+ if(cnt > 0xffff) // different format?
+ {
+ p += 2;
+ cnt = p <= end-4 ? *(DWORD*)p : 0; bswap(cnt); p += 4;
+ }
+
+ while(p < end-4 && cnt-- > 0)
+ {
+ BYTE* base = p;
+ DWORD len = *(DWORD*)p; bswap(len); p += 4;
+ if(base + len > end) break;
+
+ p++;
+ WORD keylen = *(WORD*)p; bswap(keylen); p += 2;
+ memcpy(key.GetBufferSetLength(keylen), p, keylen);
+ p += keylen;
+
+ p+=4;
+ WORD valuelen = *(WORD*)p; bswap(valuelen); p += 2;
+ memcpy(value.GetBufferSetLength(valuelen), p, valuelen);
+ p += valuelen;
+
+ ASSERT(p == base + len);
+ p = base + len;
+
+ lfi[key] = value;
+ }
+
+ POSITION pos = lfi.GetStartPosition();
+ while(pos)
+ {
+ lfi.GetNextAssoc(pos, key, value);
+
+ int n;
+ if(key.Find("CHAPTER") == 0 && key.Find("TIME") == key.GetLength()-4
+ && (n = strtol(key.Mid(7), NULL, 10)) > 0)
+ {
+ int h, m, s, ms;
+ char c;
+ if(7 != sscanf(value, "%d%c%d%c%d%c%d", &h, &c, &m, &c, &s, &c, &ms))
+ continue;
+
+ key.Format("CHAPTER%02dNAME", n);
+ if(!lfi.Lookup(key, value) || value.IsEmpty())
+ value.Format("Chapter %d", n);
+
+ ChapAppend(
+ ((((REFERENCE_TIME)h*60+m)*60+s)*1000+ms)*10000,
+ CStringW(CString(value)));
+ }
+ }
+ }
+
+ if(mts.IsEmpty())
+ {
+ TRACE(_T("Unsupported RealMedia stream (%d): %s\n"), pmp->stream, CString(pmp->mime));
+ continue;
+ }
+
+ HRESULT hr;
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
+ if(SUCCEEDED(AddOutputPin((DWORD)pmp->stream, pPinOut)))
+ {
+ if(!m_rtStop)
+ m_pFile->m_p.tDuration = max(m_pFile->m_p.tDuration, pmp->tDuration);
+ }
+ }
+
+ pos = m_pFile->m_subs.GetHeadPosition();
+ for(DWORD stream = 0; pos; stream++)
+ {
+ CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
+
+ CStringW name;
+ name.Format(L"Subtitle %02d", stream);
+ if(!s.name.IsEmpty()) name += L" (" + CStringW(CString(s.name)) + L")";
+
+ CMediaType mt;
+ mt.SetSampleSize(1);
+ mt.majortype = MEDIATYPE_Text;
+
+ CAtlArray<CMediaType> mts;
+ mts.Add(mt);
+
+ HRESULT hr;
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CRealMediaSplitterOutputPin(mts, name, this, this, &hr));
+ AddOutputPin((DWORD)~stream, pPinOut);
+ }
+
+ m_rtDuration = m_rtNewStop = m_rtStop = 10000i64*m_pFile->m_p.tDuration;
+
+ SetProperty(L"TITL", CStringW(m_pFile->m_cd.title));
+ SetProperty(L"AUTH", CStringW(m_pFile->m_cd.author));
+ SetProperty(L"CPYR", CStringW(m_pFile->m_cd.copyright));
+ SetProperty(L"DESC", CStringW(m_pFile->m_cd.comment));
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool CRealMediaSplitterFilter::DemuxInit()
+{
+ if(!m_pFile) return(false);
+
+ // reindex if needed
+
+ if(m_pFile->m_irs.GetCount() == 0)
+ {
+ m_nOpenProgress = 0;
+ m_rtDuration = 0;
+
+ int stream = m_pFile->GetMasterStream();
+
+ UINT32 tLastStart = -1;
+ UINT32 nPacket = 0;
+
+ POSITION pos = m_pFile->m_dcs.GetHeadPosition();
+ while(pos && !m_fAbort)
+ {
+ DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
+
+ m_pFile->Seek(pdc->pos);
+
+ for(UINT32 i = 0; i < pdc->nPackets && !m_fAbort; i++, nPacket++)
+ {
+ UINT64 filepos = m_pFile->GetPos();
+
+ HRESULT hr;
+
+ MediaPacketHeader mph;
+ if(S_OK != (hr = m_pFile->Read(mph, false)))
+ break;
+
+ m_rtDuration = max((__int64)(10000i64*mph.tStart), m_rtDuration);
+
+ if(mph.stream == stream && (mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG) && tLastStart != mph.tStart)
+ {
+ CAutoPtr<IndexRecord> pir(new IndexRecord());
+ pir->tStart = mph.tStart;
+ pir->ptrFilePos = (UINT32)filepos;
+ pir->packet = nPacket;
+ m_pFile->m_irs.AddTail(pir);
+
+ tLastStart = mph.tStart;
+ }
+
+ m_nOpenProgress = m_pFile->GetPos()*100/m_pFile->GetLength();
+
+ DWORD cmd;
+ if(CheckRequest(&cmd))
+ {
+ if(cmd == CMD_EXIT) m_fAbort = true;
+ else Reply(S_OK);
+ }
+ }
+ }
+
+ m_nOpenProgress = 100;
+
+ if(m_fAbort) m_pFile->m_irs.RemoveAll();
+
+ m_fAbort = false;
+ }
+
+ m_seekpos = NULL;
+ m_seekpacket = 0;
+ m_seekfilepos = 0;
+
+ return(true);
+}
+
+void CRealMediaSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ if(rt <= 0)
+ {
+ m_seekpos = m_pFile->m_dcs.GetHeadPosition();
+ m_seekpacket = 0;
+ m_seekfilepos = m_pFile->m_dcs.GetHead()->pos;
+ }
+ else
+ {
+ m_seekpos = NULL;
+
+ POSITION pos = m_pFile->m_irs.GetTailPosition();
+ while(pos && !m_seekpos)
+ {
+ IndexRecord* pir = m_pFile->m_irs.GetPrev(pos);
+ if(pir->tStart <= rt/10000)
+ {
+ m_seekpacket = pir->packet;
+
+ pos = m_pFile->m_dcs.GetTailPosition();
+ while(pos && !m_seekpos)
+ {
+ POSITION tmp = pos;
+
+ DataChunk* pdc = m_pFile->m_dcs.GetPrev(pos);
+
+ if(pdc->pos <= pir->ptrFilePos)
+ {
+ m_seekpos = tmp;
+ m_seekfilepos = pir->ptrFilePos;
+
+ POSITION pos = m_pFile->m_dcs.GetHeadPosition();
+ while(pos != m_seekpos)
+ {
+ m_seekpacket -= m_pFile->m_dcs.GetNext(pos)->nPackets;
+ }
+ }
+ }
+
+ // search the closest keyframe to the seek time (commented out 'cause rm seems to index all of its keyframes...)
+/*
+ if(m_seekpos)
+ {
+ DataChunk* pdc = m_pFile->m_dcs.GetAt(m_seekpos);
+
+ m_pFile->Seek(m_seekfilepos);
+
+ REFERENCE_TIME seektime = -1;
+ UINT32 seekstream = -1;
+
+ for(UINT32 i = m_seekpacket; i < pdc->nPackets; i++)
+ {
+ UINT64 filepos = m_pFile->GetPos();
+
+ MediaPacketHeader mph;
+ if(S_OK != m_pFile->Read(mph, false))
+ break;
+
+ if(seekstream == -1) seekstream = mph.stream;
+ if(seekstream != mph.stream) continue;
+
+ if(seektime == 10000i64*mph.tStart) continue;
+ if(rt < 10000i64*mph.tStart) break;
+
+ if((mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG))
+ {
+ m_seekpacket = i;
+ m_seekfilepos = filepos;
+ seektime = 10000i64*mph.tStart;
+ }
+ }
+ }
+*/
+ }
+ }
+
+ if(!m_seekpos)
+ {
+ m_seekpos = m_pFile->m_dcs.GetHeadPosition();
+ m_seekpacket = 0;
+ m_seekfilepos = m_pFile->m_dcs.GetAt(m_seekpos)->pos;
+ }
+ }
+}
+
+bool CRealMediaSplitterFilter::DemuxLoop()
+{
+ HRESULT hr = S_OK;
+ POSITION pos;
+
+ pos = m_pFile->m_subs.GetHeadPosition();
+ for(DWORD stream = 0; pos && SUCCEEDED(hr) && !CheckRequest(NULL); stream++)
+ {
+ CRMFile::subtitle& s = m_pFile->m_subs.GetNext(pos);
+
+ CAutoPtr<Packet> p(new Packet);
+
+ p->TrackNumber = ~stream;
+ p->bSyncPoint = TRUE;
+ p->rtStart = 0;
+ p->rtStop = 1;
+
+ p->SetCount((4+1) + (2+4+(s.name.GetLength()+1)*2) + (2+4+s.data.GetLength()));
+ BYTE* ptr = p->GetData();
+
+ strcpy((char*)ptr, "GAB2"); ptr += 4+1;
+
+ *(WORD*)ptr = 2; ptr += 2;
+ *(DWORD*)ptr = (s.name.GetLength()+1)*2; ptr += 4;
+ wcscpy((WCHAR*)ptr, CStringW(s.name)); ptr += (s.name.GetLength()+1)*2;
+
+ *(WORD*)ptr = 4; ptr += 2;
+ *(DWORD*)ptr = s.data.GetLength(); ptr += 4;
+ memcpy((char*)ptr, s.data, s.data.GetLength()); ptr += s.name.GetLength();
+
+ hr = DeliverPacket(p);
+ }
+
+ pos = m_seekpos;
+ while(pos && SUCCEEDED(hr) && !CheckRequest(NULL))
+ {
+ DataChunk* pdc = m_pFile->m_dcs.GetNext(pos);
+
+ m_pFile->Seek(m_seekfilepos > 0 ? m_seekfilepos : pdc->pos);
+
+ for(UINT32 i = m_seekpacket; i < pdc->nPackets && SUCCEEDED(hr) && !CheckRequest(NULL); i++)
+ {
+ MediaPacketHeader mph;
+ if(S_OK != (hr = m_pFile->Read(mph)))
+ break;
+
+ CAutoPtr<Packet> p(new Packet);
+ p->TrackNumber = mph.stream;
+ p->bSyncPoint = !!(mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG);
+ p->rtStart = 10000i64*(mph.tStart);
+ p->rtStop = p->rtStart+1;
+ p->Copy(mph.pData);
+ hr = DeliverPacket(p);
+ }
+
+ m_seekpacket = 0;
+ m_seekfilepos = 0;
+ }
+
+ return(true);
+}
+
+// IKeyFrameInfo
+
+STDMETHODIMP CRealMediaSplitterFilter::GetKeyFrameCount(UINT& nKFs)
+{
+ if(!m_pFile) return E_UNEXPECTED;
+ nKFs = m_pFile->m_irs.GetCount();
+ return S_OK;
+}
+
+STDMETHODIMP CRealMediaSplitterFilter::GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs)
+{
+ CheckPointer(pFormat, E_POINTER);
+ CheckPointer(pKFs, E_POINTER);
+
+ if(!m_pFile) return E_UNEXPECTED;
+ if(*pFormat != TIME_FORMAT_MEDIA_TIME) return E_INVALIDARG;
+
+ UINT nKFsTmp = 0;
+ POSITION pos = m_pFile->m_irs.GetHeadPosition();
+ for(int i = 0; pos && nKFsTmp < nKFs; i++)
+ pKFs[nKFsTmp++] = 10000i64*m_pFile->m_irs.GetNext(pos)->tStart;
+ nKFs = nKFsTmp;
+
+ return S_OK;
+}
+
+//
+// CRealMediaSplitterOutputPin
+//
+
+CRealMediaSplitterOutputPin::CRealMediaSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseSplitterOutputPin(mts, pName, pFilter, pLock, phr)
+{
+}
+
+CRealMediaSplitterOutputPin::~CRealMediaSplitterOutputPin()
+{
+}
+
+HRESULT CRealMediaSplitterOutputPin::DeliverEndFlush()
+{
+ {
+ CAutoLock cAutoLock(&m_csQueue);
+ m_segments.Clear();
+ }
+
+ return __super::DeliverEndFlush();
+}
+
+HRESULT CRealMediaSplitterOutputPin::DeliverSegments()
+{
+ HRESULT hr;
+
+ if(m_segments.GetCount() == 0)
+ {
+ m_segments.Clear();
+ return S_OK;
+ }
+
+ CAutoPtr<Packet> p(new Packet());
+
+ p->TrackNumber = -1;
+ p->bDiscontinuity = m_segments.fDiscontinuity;
+ p->bSyncPoint = m_segments.fSyncPoint;
+ p->rtStart = m_segments.rtStart;
+ p->rtStop = m_segments.rtStart+1;
+
+ DWORD len = 0, total = 0;
+ POSITION pos = m_segments.GetHeadPosition();
+ while(pos)
+ {
+ segment* s = m_segments.GetNext(pos);
+ len = max(len, s->offset + s->data.GetCount());
+ total += s->data.GetCount();
+ }
+ ASSERT(len == total);
+ len += 1 + 2*4*(!m_segments.fMerged ? m_segments.GetCount() : 1);
+
+ p->SetCount(len);
+
+ BYTE* pData = p->GetData();
+
+ *pData++ = m_segments.fMerged ? 0 : m_segments.GetCount()-1;
+
+ if(m_segments.fMerged)
+ {
+ *((DWORD*)pData) = 1; pData += 4;
+ *((DWORD*)pData) = 0; pData += 4;
+ }
+ else
+ {
+ pos = m_segments.GetHeadPosition();
+ while(pos)
+ {
+ *((DWORD*)pData) = 1; pData += 4;
+ *((DWORD*)pData) = m_segments.GetNext(pos)->offset; pData += 4;
+ }
+ }
+
+ pos = m_segments.GetHeadPosition();
+ while(pos)
+ {
+ segment* s = m_segments.GetNext(pos);
+ memcpy(pData + s->offset, s->data.GetData(), s->data.GetCount());
+ }
+
+ hr = __super::DeliverPacket(p);
+
+ m_segments.Clear();
+
+ return hr;
+}
+
+HRESULT CRealMediaSplitterOutputPin::DeliverPacket(CAutoPtr<Packet> p)
+{
+ HRESULT hr = S_OK;
+
+ ASSERT(p->rtStart < p->rtStop);
+
+ if(m_mt.subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
+ {
+ WORD* s = (WORD*)p->GetData();
+ WORD* e = s + p->GetCount()/2;
+ while(s < e) bswap(*s++);
+ }
+
+ if(m_mt.subtype == MEDIASUBTYPE_RV10 || m_mt.subtype == MEDIASUBTYPE_RV20
+ || m_mt.subtype == MEDIASUBTYPE_RV30 || m_mt.subtype == MEDIASUBTYPE_RV40
+ || m_mt.subtype == MEDIASUBTYPE_RV41)
+ {
+ CAutoLock cAutoLock(&m_csQueue);
+
+ int len = p->GetCount();
+ BYTE* pIn = p->GetData();
+ BYTE* pInOrg = pIn;
+
+ if(m_segments.rtStart != p->rtStart)
+ {
+ if(S_OK != (hr = DeliverSegments()))
+ return hr;
+ }
+
+ if(!m_segments.fDiscontinuity && p->bDiscontinuity)
+ m_segments.fDiscontinuity = true;
+ m_segments.fSyncPoint = !!p->bSyncPoint;
+ m_segments.rtStart = p->rtStart;
+
+ while(pIn - pInOrg < len)
+ {
+ BYTE hdr = *pIn++, subseq = 0, seqnum = 0;
+ DWORD packetlen = 0, packetoffset = 0;
+
+ if((hdr&0xc0) == 0x40)
+ {
+ pIn++;
+ packetlen = len - (pIn - pInOrg);
+ }
+ else
+ {
+ if((hdr&0x40) == 0)
+ subseq = (*pIn++)&0x7f;
+
+ #define GetWORD(var) \
+ var = (var<<8)|(*pIn++); \
+ var = (var<<8)|(*pIn++); \
+
+ GetWORD(packetlen);
+ if(packetlen&0x8000) m_segments.fMerged = true;
+ if((packetlen&0x4000) == 0) {GetWORD(packetlen); packetlen &= 0x3fffffff;}
+ else packetlen &= 0x3fff;
+
+ GetWORD(packetoffset);
+ if((packetoffset&0x4000) == 0) {GetWORD(packetoffset); packetoffset &= 0x3fffffff;}
+ else packetoffset &= 0x3fff;
+
+ #undef GetWORD
+
+ if((hdr&0xc0) == 0xc0)
+ m_segments.rtStart = 10000i64*packetoffset - m_rtStart, packetoffset = 0;
+ else if((hdr&0xc0) == 0x80)
+ packetoffset = packetlen - packetoffset;
+
+ seqnum = *pIn++;
+ }
+
+ int len2 = min(len - (pIn - pInOrg), packetlen - packetoffset);
+
+ CAutoPtr<segment> s(new segment);
+ s->offset = packetoffset;
+ s->data.SetCount(len2);
+ memcpy(s->data.GetData(), pIn, len2);
+ m_segments.AddTail(s);
+
+ pIn += len2;
+
+ if((hdr&0x80) || packetoffset+len2 >= packetlen)
+ {
+ if(S_OK != (hr = DeliverSegments()))
+ return hr;
+ }
+ }
+ }
+ else if(m_mt.subtype == MEDIASUBTYPE_RAAC || m_mt.subtype == MEDIASUBTYPE_RACP
+ || m_mt.subtype == MEDIASUBTYPE_AAC)
+ {
+ BYTE* ptr = p->GetData()+2;
+
+ CAtlList<WORD> sizes;
+ int total = 0;
+ int remaining = p->GetCount()-2;
+ int expected = *(ptr-1)>>4;
+
+ while(total < remaining)
+ {
+ int size = (ptr[0]<<8)|(ptr[1]);
+ sizes.AddTail(size);
+ total += size;
+ ptr += 2;
+ remaining -= 2;
+ expected--;
+ }
+
+ ASSERT(total == remaining);
+ ASSERT(expected == 0);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_mt.pbFormat;
+ REFERENCE_TIME rtDur = 10240000000i64/wfe->nSamplesPerSec * (wfe->cbSize>2?2:1);
+ REFERENCE_TIME rtStart = p->rtStart;
+ BOOL bDiscontinuity = p->bDiscontinuity;
+
+ POSITION pos = sizes.GetHeadPosition();
+ while(pos)
+ {
+ WORD size = sizes.GetNext(pos);
+
+ CAutoPtr<Packet> p(new Packet);
+ p->bDiscontinuity = bDiscontinuity;
+ p->bSyncPoint = true;
+ p->rtStart = rtStart;
+ p->rtStop = rtStart += rtDur;
+ p->SetData(ptr, size);
+ ptr += size;
+ bDiscontinuity = false;
+ if(S_OK != (hr = __super::DeliverPacket(p)))
+ break;
+ }
+ }
+ else
+ {
+ hr = __super::DeliverPacket(p);
+ }
+
+ return hr;
+}
+
+//
+// CRealMediaSourceFilter
+//
+
+CRealMediaSourceFilter::CRealMediaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CRealMediaSplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
+
+//
+// CRMFile
+//
+
+CRMFile::CRMFile(IAsyncReader* pAsyncReader, HRESULT& hr)
+ : CBaseSplitterFile(pAsyncReader, hr)
+{
+ if(FAILED(hr)) return;
+ hr = Init();
+}
+
+template<typename T>
+HRESULT CRMFile::Read(T& var)
+{
+ HRESULT hr = ByteRead((BYTE*)&var, sizeof(var));
+ bswap(var);
+ return hr;
+}
+
+HRESULT CRMFile::Read(ChunkHdr& hdr)
+{
+ memset(&hdr, 0, sizeof(hdr));
+ HRESULT hr;
+ if(S_OK != (hr = Read(hdr.object_id))
+ || S_OK != (hr = Read(hdr.size))
+ || S_OK != (hr = Read(hdr.object_version)))
+ return hr;
+ return S_OK;
+}
+
+HRESULT CRMFile::Read(MediaPacketHeader& mph, bool fFull)
+{
+ memset(&mph, 0, FIELD_OFFSET(MediaPacketHeader, pData));
+ mph.stream = -1;
+
+ HRESULT hr;
+
+ UINT16 object_version;
+ if(S_OK != (hr = Read(object_version))) return hr;
+ if(object_version != 0 && object_version != 1) return S_OK;
+
+ UINT8 flags;
+ if(S_OK != (hr = Read(mph.len))
+ || S_OK != (hr = Read(mph.stream))
+ || S_OK != (hr = Read(mph.tStart))
+ || S_OK != (hr = Read(mph.reserved))
+ || S_OK != (hr = Read(flags)))
+ return hr;
+ mph.flags = (MediaPacketHeader::flag_t)flags;
+
+ LONG len = mph.len;
+ len -= sizeof(object_version);
+ len -= FIELD_OFFSET(MediaPacketHeader, flags);
+ len -= sizeof(flags);
+ ASSERT(len >= 0);
+ len = max(len, 0);
+
+ if(fFull)
+ {
+ mph.pData.SetCount(len);
+ if(mph.len > 0 && S_OK != (hr = ByteRead(mph.pData.GetData(), len)))
+ return hr;
+ }
+ else
+ {
+ Seek(GetPos() + len);
+ }
+
+ return S_OK;
+}
+
+
+HRESULT CRMFile::Init()
+{
+ Seek(0);
+
+ bool fFirstChunk = true;
+
+ HRESULT hr;
+
+ ChunkHdr hdr;
+ while(GetPos() < GetLength() && S_OK == (hr = Read(hdr)))
+ {
+ __int64 pos = GetPos() - sizeof(hdr);
+
+ if(fFirstChunk && hdr.object_id != '.RMF')
+ return E_FAIL;
+
+ fFirstChunk = false;
+
+ if(pos + hdr.size > GetLength() && hdr.object_id != 'DATA') // truncated?
+ break;
+
+ if(hdr.object_id == 0x2E7261FD) // '.ra+0xFD'
+ return E_FAIL;
+
+ if(hdr.object_version == 0)
+ {
+ switch(hdr.object_id)
+ {
+ case '.RMF':
+ if(S_OK != (hr = Read(m_fh.version))) return hr;
+ if(hdr.size == 0x10) {WORD w = 0; if(S_OK != (hr = Read(w))) return hr; m_fh.nHeaders = w;}
+ else if(S_OK != (hr = Read(m_fh.nHeaders))) return hr;
+ break;
+ case 'CONT':
+ UINT16 slen;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.title.GetBufferSetLength(slen), slen))) return hr;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.author.GetBufferSetLength(slen), slen))) return hr;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.copyright.GetBufferSetLength(slen), slen))) return hr;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)m_cd.comment.GetBufferSetLength(slen), slen))) return hr;
+ break;
+ case 'PROP':
+ if(S_OK != (hr = Read(m_p.maxBitRate))) return hr;
+ if(S_OK != (hr = Read(m_p.avgBitRate))) return hr;
+ if(S_OK != (hr = Read(m_p.maxPacketSize))) return hr;
+ if(S_OK != (hr = Read(m_p.avgPacketSize))) return hr;
+ if(S_OK != (hr = Read(m_p.nPackets))) return hr;
+ if(S_OK != (hr = Read(m_p.tDuration))) return hr;
+ if(S_OK != (hr = Read(m_p.tPreroll))) return hr;
+ if(S_OK != (hr = Read(m_p.ptrIndex))) return hr;
+ if(S_OK != (hr = Read(m_p.ptrData))) return hr;
+ if(S_OK != (hr = Read(m_p.nStreams))) return hr;
+ UINT16 flags;
+ if(S_OK != (hr = Read(flags))) return hr;
+ m_p.flags = (Properies::flags_t)flags;
+ break;
+ case 'MDPR':
+ {
+ CAutoPtr<MediaProperies> mp(new MediaProperies);
+ if(S_OK != (hr = Read(mp->stream))) return hr;
+ if(S_OK != (hr = Read(mp->maxBitRate))) return hr;
+ if(S_OK != (hr = Read(mp->avgBitRate))) return hr;
+ if(S_OK != (hr = Read(mp->maxPacketSize))) return hr;
+ if(S_OK != (hr = Read(mp->avgPacketSize))) return hr;
+ if(S_OK != (hr = Read(mp->tStart))) return hr;
+ if(S_OK != (hr = Read(mp->tPreroll))) return hr;
+ if(S_OK != (hr = Read(mp->tDuration))) return hr;
+ UINT8 slen;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->name.GetBufferSetLength(slen), slen))) return hr;
+ if(S_OK != (hr = Read(slen))) return hr;
+ if(slen > 0 && S_OK != (hr = ByteRead((BYTE*)mp->mime.GetBufferSetLength(slen), slen))) return hr;
+ UINT32 tsdlen;
+ if(S_OK != (hr = Read(tsdlen))) return hr;
+ mp->typeSpecData.SetCount(tsdlen);
+ if(tsdlen > 0 && S_OK != (hr = ByteRead(mp->typeSpecData.GetData(), tsdlen))) return hr;
+ mp->width = mp->height = 0;
+ mp->interlaced = mp->top_field_first = false;
+ m_mps.AddTail(mp);
+ break;
+ }
+ case 'DATA':
+ {
+ CAutoPtr<DataChunk> dc(new DataChunk);
+ if(S_OK != (hr = Read(dc->nPackets))) return hr;
+ if(S_OK != (hr = Read(dc->ptrNext))) return hr;
+ dc->pos = GetPos();
+ m_dcs.AddTail(dc);
+ GetDimensions();
+ break;
+ }
+ case 'INDX':
+ {
+ IndexChunkHeader ich;
+ if(S_OK != (hr = Read(ich.nIndices))) return hr;
+ if(S_OK != (hr = Read(ich.stream))) return hr;
+ if(S_OK != (hr = Read(ich.ptrNext))) return hr;
+ int stream = GetMasterStream();
+ while(ich.nIndices-- > 0)
+ {
+ UINT16 object_version;
+ if(S_OK != (hr = Read(object_version))) return hr;
+ if(object_version == 0)
+ {
+ CAutoPtr<IndexRecord> ir(new IndexRecord);
+ if(S_OK != (hr = Read(ir->tStart))) return hr;
+ if(S_OK != (hr = Read(ir->ptrFilePos))) return hr;
+ if(S_OK != (hr = Read(ir->packet))) return hr;
+ if(ich.stream == stream) m_irs.AddTail(ir);
+ }
+ }
+ break;
+ }
+ case '.SUB':
+ if(hdr.size > sizeof(hdr))
+ {
+ int size = hdr.size - sizeof(hdr);
+ CAutoVectorPtr<char> buff;
+ if(!buff.Allocate(size)) return E_OUTOFMEMORY;
+ char* p = buff;
+ if(S_OK != (hr = ByteRead((BYTE*)p, size))) return hr;
+ for(char* end = p + size; p < end; )
+ {
+ subtitle s;
+ s.name = p; p += s.name.GetLength()+1;
+ CStringA len(p); p += len.GetLength()+1;
+ s.data = CStringA(p, strtol(len, NULL, 10)); p += s.data.GetLength();
+ m_subs.AddTail(s);
+ }
+ }
+ break;
+ }
+ }
+
+ ASSERT(hdr.object_id == 'DATA'
+ || GetPos() == pos + hdr.size
+ || GetPos() == pos + sizeof(hdr));
+
+ pos += hdr.size;
+ if(pos > GetPos())
+ Seek(pos);
+ }
+
+ return S_OK;
+}
+
+#define GetBits(n) GetBits2(n, p, bit_offset, bit_buffer)
+
+unsigned int GetBits2(int n, unsigned char*& p, unsigned int& bit_offset, unsigned int& bit_buffer)
+{
+ unsigned int ret = ((unsigned int)bit_buffer >> (32-(n)));
+
+ bit_offset += n;
+ bit_buffer <<= n;
+ if(bit_offset > (32-16))
+ {
+ p += bit_offset >> 3;
+ bit_offset &= 7;
+ bit_buffer = (unsigned int)p[0] << 24;
+ bit_buffer |= (unsigned int)p[1] << 16;
+ bit_buffer |= (unsigned int)p[2] << 8;
+ bit_buffer |= (unsigned int)p[3];
+ bit_buffer <<= bit_offset;
+ }
+
+ return ret;
+}
+
+void GetDimensions(unsigned char* p, unsigned int* wi, unsigned int* hi)
+{
+ unsigned int w, h, c;
+
+ const unsigned int cw[8] = {160, 176, 240, 320, 352, 640, 704, 0};
+ const unsigned int ch1[8] = {120, 132, 144, 240, 288, 480, 0, 0};
+ const unsigned int ch2[4] = {180, 360, 576, 0};
+
+ unsigned int bit_offset = 0;
+ unsigned int bit_buffer = *(unsigned int*)p;
+ bswap(bit_buffer);
+
+ GetBits(13);
+
+ GetBits(13);
+
+ w = cw[GetBits(3)];
+ if(w == 0)
+ {
+ do
+ {
+ c = GetBits(8);
+ w += (c << 2);
+ }
+ while(c == 255);
+ }
+
+ c = GetBits(3);
+
+ h = ch1[c];
+ if(h == 0)
+ {
+ c = ((c << 1) | GetBits(1)) & 3;
+
+ h = ch2[c];
+ if(h == 0)
+ {
+ do
+ {
+ c = GetBits(8);
+ h += (c << 2);
+ }
+ while(c == 255);
+ }
+ }
+
+ *wi = w;
+ *hi = h;
+}
+
+void GetDimensions_X10(unsigned char* p, unsigned int* wi, unsigned int* hi,
+ bool *interlaced, bool *top_field_first, bool *repeat_field)
+{
+ unsigned int w, h, c;
+
+ const unsigned int cw[8] = {160, 176, 240, 320, 352, 640, 704, 0};
+ const unsigned int ch1[8] = {120, 132, 144, 240, 288, 480, 0, 0};
+ const unsigned int ch2[4] = {180, 360, 576, 0};
+
+ unsigned int bit_offset = 0;
+ unsigned int bit_buffer = *(unsigned int*)p;
+ bswap(bit_buffer);
+
+ GetBits(9);
+
+ *interlaced = false;
+ *top_field_first = false;
+ *repeat_field = false;
+ c = GetBits(1);
+ if (c)
+ {
+ c = GetBits(1);
+ if (c)
+ *interlaced = true;
+ c = GetBits(1);
+ if (c)
+ *top_field_first = true;
+ c = GetBits(1);
+ if (c)
+ *repeat_field = true;
+
+ c = GetBits(1);
+ c = GetBits(1);
+ if (c)
+ GetBits(2);
+ }
+
+ GetBits(16);
+
+ w = cw[GetBits(3)];
+ if(w == 0)
+ {
+ do
+ {
+ c = GetBits(8);
+ w += (c << 2);
+ }
+ while(c == 255);
+ }
+
+ c = GetBits(3);
+
+ h = ch1[c];
+ if(h == 0)
+ {
+ c = ((c << 1) | GetBits(1)) & 3;
+
+ h = ch2[c];
+ if(h == 0)
+ {
+ do
+ {
+ c = GetBits(8);
+ h += (c << 2);
+ }
+ while(c == 255);
+ }
+ }
+
+ *wi = w;
+ *hi = h;
+}
+
+void CRMFile::GetDimensions()
+{
+ POSITION pos = m_mps.GetHeadPosition();
+ while(pos)
+ {
+ UINT64 filepos = GetPos();
+
+ MediaProperies* pmp = m_mps.GetNext(pos);
+ if(pmp->mime == "video/x-pn-realvideo")
+ {
+ pmp->width = pmp->height = 0;
+
+ rvinfo rvi = *(rvinfo*)pmp->typeSpecData.GetData();
+ rvi.bswap();
+
+ if(rvi.fcc2 != '04VR' && rvi.fcc2 != '14VR')
+ continue;
+
+ MediaPacketHeader mph;
+ while(S_OK == Read(mph))
+ {
+ if(mph.stream != pmp->stream || mph.len == 0
+ || !(mph.flags&MediaPacketHeader::PN_KEYFRAME_FLAG))
+ continue;
+
+ BYTE* p = mph.pData.GetData();
+ BYTE* p0 = p;
+ int len = mph.pData.GetCount();
+
+ BYTE hdr = *p++;
+ DWORD packetlen = 0, packetoffset = 0;
+
+ if((hdr&0xc0) == 0x40)
+ {
+ packetlen = len - (++p - p0);
+ }
+ else
+ {
+ if((hdr&0x40) == 0) p++;
+
+ #define GetWORD(var) \
+ var = (var<<8)|(*p++); \
+ var = (var<<8)|(*p++); \
+
+ GetWORD(packetlen);
+ if((packetlen&0x4000) == 0) {GetWORD(packetlen); packetlen &= 0x3fffffff;}
+ else packetlen &= 0x3fff;
+
+ GetWORD(packetoffset);
+ if((packetoffset&0x4000) == 0) {GetWORD(packetoffset); packetoffset &= 0x3fffffff;}
+ else packetoffset &= 0x3fff;
+
+ #undef GetWORD
+
+ if((hdr&0xc0) == 0xc0) packetoffset = 0;
+ else if((hdr&0xc0) == 0x80) packetoffset = packetlen - packetoffset;
+
+ p++;
+ }
+
+ len = min(len - (p - p0), packetlen - packetoffset);
+
+ if(len > 0)
+ {
+ bool repeat_field;
+ if(rvi.fcc2 == '14VR') ::GetDimensions_X10(p, &pmp->width, &pmp->height, &pmp->interlaced, &pmp->top_field_first, &repeat_field);
+ else ::GetDimensions(p, &pmp->width, &pmp->height);
+
+ if(rvi.w == pmp->width && rvi.h == pmp->height)
+ pmp->width = pmp->height = 0;
+
+ break;
+ }
+ }
+ }
+
+ Seek(filepos);
+ }
+}
+
+int CRMFile::GetMasterStream()
+{
+ int s1 = -1, s2 = -1;
+
+ POSITION pos = m_mps.GetHeadPosition();
+ while(pos)
+ {
+ MediaProperies* pmp = m_mps.GetNext(pos);
+ if(pmp->mime == "video/x-pn-realvideo") {s1 = pmp->stream; break;}
+ else if(pmp->mime == "audio/x-pn-realaudio" && s2 == -1) s2 = pmp->stream;
+ }
+
+ if(s1 == -1)
+ s1 = s2;
+
+ return s1;
+}
+
+
+////////////////////////////
+
+//
+// CRealVideoDecoder
+//
+
+CRealVideoDecoder::CRealVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr)
+ : CBaseVideoFilter(NAME("CRealVideoDecoder"), lpunk, phr, __uuidof(this))
+ , m_hDrvDll(NULL)
+ , m_dwCookie(0)
+{
+}
+
+CRealVideoDecoder::~CRealVideoDecoder()
+{
+ if(m_hDrvDll) FreeLibrary(m_hDrvDll);
+}
+
+HRESULT CRealVideoDecoder::InitRV(const CMediaType* pmt)
+{
+ FreeRV();
+
+ HRESULT hr = VFW_E_TYPE_NOT_ACCEPTED;
+
+ rvinfo rvi = *(rvinfo*)(pmt->Format() + (pmt->formattype == FORMAT_VideoInfo ? sizeof(VIDEOINFOHEADER) : sizeof(VIDEOINFOHEADER2)));
+ rvi.bswap();
+
+ #pragma pack(push, 1)
+ struct {WORD unk1, w, h, unk3; DWORD unk2, subformat, unk5, format;} i =
+ {11, rvi.w, rvi.h, 0, 0, rvi.type1, 1, rvi.type2};
+ #pragma pack(pop)
+
+ if(FAILED(hr = RVInit(&i, &m_dwCookie)))
+ return hr;
+
+ if(rvi.fcc2 <= '03VR' && rvi.type2 >= 0x20200002)
+ {
+ int nWidthHeight = (1+((rvi.type1>>16)&7));
+ UINT32* pWH = new UINT32[nWidthHeight*2];
+ pWH[0] = rvi.w; pWH[1] = rvi.h;
+ for(int i = 2; i < nWidthHeight*2; i++)
+ pWH[i] = rvi.morewh[i-2]*4;
+ #pragma pack(push, 1)
+ struct {UINT32 data1; UINT32 data2; UINT32* dimensions;} cmsg_data =
+ {0x24, nWidthHeight, pWH};
+ #pragma pack(pop)
+ hr = RVCustomMessage(&cmsg_data, m_dwCookie);
+ delete [] pWH;
+ }
+
+ return hr;
+}
+
+void CRealVideoDecoder::FreeRV()
+{
+ if(m_dwCookie)
+ {
+ RVFree(m_dwCookie);
+ m_dwCookie = 0;
+ }
+}
+
+HRESULT CRealVideoDecoder::Transform(IMediaSample* pIn)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr;
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn)))
+ return hr;
+
+ long len = pIn->GetActualDataLength();
+ if(len <= 0) return S_OK; // nothing to do
+
+ REFERENCE_TIME rtStart, rtStop;
+ pIn->GetTime(&rtStart, &rtStop);
+
+ rtStart += m_tStart;
+
+ int offset = 1+((*pDataIn)+1)*8;
+
+ #pragma pack(push, 1)
+ struct {DWORD len, unk1, chunks; DWORD* extra; DWORD unk2, timestamp;} transform_in =
+ {len - offset, 0, *pDataIn, (DWORD*)(pDataIn+1), 0, (DWORD)(rtStart/10000)};
+ struct {DWORD unk1, unk2, timestamp, w, h;} transform_out =
+ {0,0,0,0,0};
+ #pragma pack(pop)
+
+ pDataIn += offset;
+
+ if(m_fDropFrames && m_timestamp+1 == transform_in.timestamp)
+ {
+ m_timestamp = transform_in.timestamp;
+ return S_OK;
+ }
+
+ hr = RVTransform(pDataIn, (BYTE*)m_pI420, &transform_in, &transform_out, m_dwCookie);
+
+ unsigned int tmp1, tmp2;
+ bool interlaced = false, tmp3, tmp4;
+ ::GetDimensions_X10(pDataIn, &tmp1, &tmp2, &interlaced, &tmp3, &tmp4);
+
+ m_timestamp = transform_in.timestamp;
+
+ if(FAILED(hr))
+ {
+ TRACE(_T("RV returned an error code!!!\n"));
+ ASSERT(!(transform_out.unk1&1)); // error allowed when the "render" flag is not set
+// return hr;
+ }
+
+ if(pIn->IsPreroll() == S_OK || rtStart < 0 || !(transform_out.unk1&1))
+ return S_OK;
+
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(/*FAILED(hr = GetDeliveryBuffer(transform_out.w, transform_out.h, &pOut)) // TODO
+ && */ FAILED(hr = GetDeliveryBuffer(m_w, m_h, &pOut))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ BYTE* pI420[3] = {m_pI420, m_pI420Tmp, NULL};
+
+ if(interlaced)
+ {
+ int size = m_w*m_h;
+ DeinterlaceBlend(pI420[1], pI420[0], m_w, m_h, m_w, m_w);
+ DeinterlaceBlend(pI420[1]+size, pI420[0]+size, m_w/2, m_h/2, m_w/2, m_w/2);
+ DeinterlaceBlend(pI420[1]+size*5/4, pI420[0]+size*5/4, m_w/2, m_h/2, m_w/2, m_w/2);
+ pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
+ }
+
+ if(transform_out.w != m_w || transform_out.h != m_h)
+ {
+ Resize(pI420[0], transform_out.w, transform_out.h, pI420[1], m_w, m_h);
+ // only one of these can be true, and when it happens the result image must be in the tmp buffer
+ if(transform_out.w == m_w || transform_out.h == m_h)
+ pI420[2] = pI420[1], pI420[1] = pI420[0], pI420[0] = pI420[2];
+ }
+
+ rtStart = 10000i64*transform_out.timestamp - m_tStart;
+ rtStop = rtStart + 1;
+ pOut->SetTime(&rtStart, /*NULL*/&rtStop);
+
+ pOut->SetDiscontinuity(pIn->IsDiscontinuity() == S_OK);
+
+ CopyBuffer(pDataOut, pI420[0], m_w, m_h, m_w, MEDIASUBTYPE_I420);
+
+DbgLog((LOG_TRACE, 0, _T("V: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
+ rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
+
+ return m_pOutput->Deliver(pOut);
+}
+
+void CRealVideoDecoder::Resize(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
+{
+ int si = wi*hi, so = wo*ho;
+ ASSERT(((si*so)&3) == 0);
+
+ if(wi < wo)
+ {
+ ResizeWidth(pIn, wi, hi, pOut, wo, ho);
+ ResizeWidth(pIn + si, wi/2, hi/2, pOut + so, wo/2, ho/2);
+ ResizeWidth(pIn + si + si/4, wi/2, hi/2, pOut + so + so/4, wo/2, ho/2);
+ if(hi == ho) return;
+ ResizeHeight(pOut, wo, hi, pIn, wo, ho);
+ ResizeHeight(pOut + so, wo/2, hi/2, pIn + so, wo/2, ho/2);
+ ResizeHeight(pOut + so + so/4, wo/2, hi/2, pIn + so + so/4, wo/2, ho/2);
+ }
+ else if(hi < ho)
+ {
+ ResizeHeight(pIn, wi, hi, pOut, wo, ho);
+ ResizeHeight(pIn + si, wi/2, hi/2, pOut + so, wo/2, ho/2);
+ ResizeHeight(pIn + si + si/4, wi/2, hi/2, pOut + so + so/4, wo/2, ho/2);
+ if(wi == wo) return;
+ ASSERT(0); // this is uncreachable code, but anyway... looks nice being so symmetric
+ ResizeWidth(pOut, wi, ho, pIn, wo, ho);
+ ResizeWidth(pOut + so, wi/2, ho/2, pIn + so, wo/2, ho/2);
+ ResizeWidth(pOut + so + so/4, wi/2, ho/2, pIn + so + so/4, wo/2, ho/2);
+ }
+}
+
+void CRealVideoDecoder::ResizeWidth(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
+{
+ for(DWORD y = 0; y < hi; y++, pIn += wi, pOut += wo)
+ {
+ if(wi == wo) memcpy(pOut, pIn, wo);
+ else ResizeRow(pIn, wi, 1, pOut, wo, 1);
+ }
+}
+
+void CRealVideoDecoder::ResizeHeight(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho)
+{
+ if(hi == ho)
+ {
+ memcpy(pOut, pIn, wo*ho);
+ }
+ else
+ {
+ for(DWORD x = 0; x < wo; x++, pIn++, pOut++)
+ ResizeRow(pIn, hi, wo, pOut, ho, wo);
+ }
+}
+
+void CRealVideoDecoder::ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DWORD wo, DWORD dpo)
+{
+ ASSERT(wi < wo);
+
+ if(dpo == 1)
+ {
+ for(DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut++, j += dj)
+// pOut[i] = pIn[j>>16];
+ {
+ BYTE* p = &pIn[j>>16];
+ DWORD jf = j&0xffff;
+ *pOut = ((p[0]*(0xffff-jf) + p[1]*jf) + 0x7fff) >> 16;
+ }
+
+ *pOut = pIn[wi-1];
+ }
+ else
+ {
+ for(DWORD i = 0, j = 0, dj = (wi<<16)/wo; i < wo-1; i++, pOut += dpo, j += dj)
+// *pOut = pIn[dpi*(j>>16)];
+ {
+ BYTE* p = &pIn[dpi*(j>>16)];
+ DWORD jf = j&0xffff;
+ *pOut = ((p[0]*(0xffff-jf) + p[dpi]*jf) + 0x7fff) >> 16;
+ }
+
+ *pOut = pIn[dpi*(wi-1)];
+ }
+}
+
+HRESULT CRealVideoDecoder::CheckInputType(const CMediaType* mtIn)
+{
+ if(mtIn->majortype != MEDIATYPE_Video
+ || mtIn->subtype != MEDIASUBTYPE_RV20
+ && mtIn->subtype != MEDIASUBTYPE_RV30
+ && mtIn->subtype != MEDIASUBTYPE_RV40
+ && mtIn->subtype != MEDIASUBTYPE_RV41)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(mtIn->formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mtIn->Format();
+ if(vih2->dwPictAspectRatioX < vih2->bmiHeader.biWidth
+ || vih2->dwPictAspectRatioY < vih2->bmiHeader.biHeight)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ if(!m_pInput->IsConnected())
+ {
+ if(m_hDrvDll) {FreeLibrary(m_hDrvDll); m_hDrvDll = NULL;}
+
+ CAtlList<CString> paths;
+ CString olddll, newdll, oldpath, newpath;
+
+ olddll.Format(_T("drv%c3260.dll"), (TCHAR)((mtIn->subtype.Data1>>16)&0xff));
+ newdll =
+ mtIn->subtype == FOURCCMap('14VR') ? _T("drvi.dll") :
+ mtIn->subtype == FOURCCMap('02VR') ? _T("drv2.dll") :
+ _T("drvc.dll");
+
+ CRegKey key;
+ TCHAR buff[MAX_PATH];
+ ULONG len = sizeof(buff);
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
+ {
+ oldpath = buff;
+ TCHAR c = oldpath[oldpath.GetLength()-1];
+ if(c != '\\' && c != '/') oldpath += '\\';
+ key.Close();
+ }
+ len = sizeof(buff);
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
+ {
+ newpath = buff;
+ TCHAR c = newpath[newpath.GetLength()-1];
+ if(c != '\\' && c != '/') newpath += '\\';
+ key.Close();
+ }
+
+ if(!newpath.IsEmpty()) paths.AddTail(newpath + newdll);
+ if(!oldpath.IsEmpty()) paths.AddTail(oldpath + newdll);
+ paths.AddTail(newdll); // default dll paths
+ if(!newpath.IsEmpty()) paths.AddTail(newpath + olddll);
+ if(!oldpath.IsEmpty()) paths.AddTail(oldpath + olddll);
+ paths.AddTail(olddll); // default dll paths
+
+ POSITION pos = paths.GetHeadPosition();
+ while(pos && !(m_hDrvDll = LoadLibrary(paths.GetNext(pos))));
+
+ if(m_hDrvDll)
+ {
+ RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420CustomMessage");
+ RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV20toYUV420Free");
+ RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV20toYUV420HiveMessage");
+ RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV20toYUV420Init");
+ RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV20toYUV420Transform");
+
+ if(!RVCustomMessage) RVCustomMessage = (PRVCustomMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420CustomMessage");
+ if(!RVFree) RVFree = (PRVFree)GetProcAddress(m_hDrvDll, "RV40toYUV420Free");
+ if(!RVHiveMessage) RVHiveMessage = (PRVHiveMessage)GetProcAddress(m_hDrvDll, "RV40toYUV420HiveMessage");
+ if(!RVInit) RVInit = (PRVInit)GetProcAddress(m_hDrvDll, "RV40toYUV420Init");
+ if(!RVTransform) RVTransform = (PRVTransform)GetProcAddress(m_hDrvDll, "RV40toYUV420Transform");
+ }
+
+ if(!m_hDrvDll || !RVCustomMessage
+ || !RVFree || !RVHiveMessage
+ || !RVInit || !RVTransform)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(FAILED(InitRV(mtIn)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return S_OK;
+}
+
+HRESULT CRealVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ if(m_pOutput && m_pOutput->IsConnected())
+ {
+ BITMAPINFOHEADER bih1, bih2;
+ if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
+ && abs(bih1.biHeight) != abs(bih2.biHeight))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return __super::CheckTransform(mtIn, mtOut);
+}
+
+HRESULT CRealVideoDecoder::StartStreaming()
+{
+ const CMediaType& mt = m_pInput->CurrentMediaType();
+ if(FAILED(InitRV(&mt)))
+ return E_FAIL;
+
+ int size = m_w*m_h;
+ m_pI420.Allocate(size*3/2);
+ memset(m_pI420, 0, size);
+ memset(m_pI420 + size, 0x80, size/2);
+ m_pI420Tmp.Allocate(size*3/2);
+ memset(m_pI420Tmp, 0, size);
+ memset(m_pI420Tmp + size, 0x80, size/2);
+
+ return __super::StartStreaming();
+}
+
+HRESULT CRealVideoDecoder::StopStreaming()
+{
+ m_pI420.Free();
+ m_pI420Tmp.Free();
+
+ FreeRV();
+
+ return __super::StopStreaming();
+}
+
+HRESULT CRealVideoDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ m_timestamp = ~0;
+ m_fDropFrames = false;
+
+ DWORD tmp[2] = {20, 0};
+ RVHiveMessage(tmp, m_dwCookie);
+
+ m_tStart = tStart;
+ return __super::NewSegment(tStart, tStop, dRate);
+}
+
+HRESULT CRealVideoDecoder::AlterQuality(Quality q)
+{
+ if(q.Late > 500*10000i64) m_fDropFrames = true;
+ if(q.Late <= 0) m_fDropFrames = false;
+// TRACE(_T("CRealVideoDecoder::AlterQuality: Type=%d, Proportion=%d, Late=%I64d, TimeStamp=%I64d\n"), q.Type, q.Proportion, q.Late, q.TimeStamp);
+ return E_NOTIMPL;
+}
+
+/////////////////////////
+
+//
+// CRealAudioDecoder
+//
+
+CRealAudioDecoder::CRealAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CRealAudioDecoder"), lpunk, __uuidof(this))
+ , m_hDrvDll(NULL)
+ , m_dwCookie(0)
+{
+ if(phr) *phr = S_OK;
+}
+
+CRealAudioDecoder::~CRealAudioDecoder()
+{
+// FreeRA();
+ if(m_hDrvDll) FreeLibrary(m_hDrvDll);
+}
+
+HRESULT CRealAudioDecoder::InitRA(const CMediaType* pmt)
+{
+ FreeRA();
+
+ HRESULT hr;
+
+ if(RAOpenCodec2 && FAILED(hr = RAOpenCodec2(&m_dwCookie, m_dllpath))
+ || RAOpenCodec && FAILED(hr = RAOpenCodec(&m_dwCookie)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)pmt->Format();
+
+ // someone might be doing cbSize = sizeof(WAVEFORMATEX), chances of
+ // cbSize being really sizeof(WAVEFORMATEX) is less than this,
+ // especially with our rm splitter ;)
+ DWORD cbSize = pwfe->cbSize;
+ if(cbSize == sizeof(WAVEFORMATEX)) {ASSERT(0); cbSize = 0;}
+
+ WORD wBitsPerSample = pwfe->wBitsPerSample;
+ if(!wBitsPerSample) wBitsPerSample = 16;
+
+ #pragma pack(push, 1)
+ struct {DWORD freq; WORD bpsample, channels, quality; DWORD bpframe, packetsize, extralen; void* extra;} initdata =
+ {pwfe->nSamplesPerSec, wBitsPerSample, pwfe->nChannels, 100,
+ 0, 0, 0, NULL};
+ #pragma pack(pop)
+
+ CAutoVectorPtr<BYTE> pBuff;
+
+ if(pmt->subtype == MEDIASUBTYPE_AAC)
+ {
+ pBuff.Allocate(cbSize+1);
+ pBuff[0] = 0x02;
+ memcpy(pBuff+1, pwfe+1, cbSize);
+ initdata.extralen = cbSize+1;
+ initdata.extra = pBuff;
+ }
+ else
+ {
+ if(pmt->FormatLength() <= sizeof(WAVEFORMATEX) + cbSize) // must have type_specific_data appended
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ BYTE* fmt = pmt->Format() + sizeof(WAVEFORMATEX) + cbSize;
+
+ for(int i = 0, len = pmt->FormatLength() - (sizeof(WAVEFORMATEX) + cbSize); i < len-4; i++, fmt++)
+ {
+ if(fmt[0] == '.' || fmt[1] == 'r' || fmt[2] == 'a')
+ break;
+ }
+
+ m_rai = *(rainfo*)fmt;
+ m_rai.bswap();
+
+ BYTE* p;
+
+ if(m_rai.version2 == 4)
+ {
+ p = (BYTE*)((rainfo4*)fmt+1);
+ int len = *p++; p += len; len = *p++; p += len;
+ ASSERT(len == 4);
+ }
+ else if(m_rai.version2 == 5)
+ {
+ p = (BYTE*)((rainfo5*)fmt+1);
+ }
+ else
+ {
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ p += 3;
+ if(m_rai.version2 == 5) p++;
+
+ initdata.bpframe = m_rai.sub_packet_size;
+ initdata.packetsize = m_rai.coded_frame_size;
+ initdata.extralen = *(DWORD*)p;
+ initdata.extra = p + 4;
+ }
+
+ if(FAILED(hr = RAInitDecoder(m_dwCookie, &initdata)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(RASetPwd)
+ RASetPwd(m_dwCookie, "Ardubancel Quazanga");
+
+ if(RASetFlavor && FAILED(hr = RASetFlavor(m_dwCookie, m_rai.flavor)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ return S_OK;
+}
+
+void CRealAudioDecoder::FreeRA()
+{
+ if(m_dwCookie)
+ {
+ RAFreeDecoder(m_dwCookie);
+ RACloseCodec(m_dwCookie);
+ m_dwCookie = 0;
+ }
+}
+
+HRESULT CRealAudioDecoder::Receive(IMediaSample* pIn)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr;
+
+ AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
+ if(pProps->dwStreamId != AM_STREAM_MEDIA)
+ return m_pOutput->Deliver(pIn);
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+ BYTE* pDataInOrg = pDataIn;
+
+ long len = pIn->GetActualDataLength();
+ if(len <= 0) return S_OK;
+
+ REFERENCE_TIME rtStart, rtStop;
+ pIn->GetTime(&rtStart, &rtStop);
+/*
+ if(pIn->IsPreroll() == S_OK || rtStart < 0)
+ return S_OK;
+*/
+ //
+
+ if(S_OK == pIn->IsSyncPoint())
+ {
+ m_bufflen = 0;
+ m_rtBuffStart = rtStart;
+ m_fBuffDiscontinuity = pIn->IsDiscontinuity() == S_OK;
+ }
+
+ BYTE* src = NULL;
+ BYTE* dst = NULL;
+
+ int w = m_rai.coded_frame_size;
+ int h = m_rai.sub_packet_h;
+ int sps = m_rai.sub_packet_size;
+
+ if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RAAC
+ || m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_RACP
+ || m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_AAC)
+ {
+ src = pDataIn;
+ dst = pDataIn + len;
+ w = len;
+ }
+ else
+ {
+ memcpy(&m_buff[m_bufflen], pDataIn, len);
+ m_bufflen += len;
+
+ len = w*h;
+
+ if(m_bufflen >= len)
+ {
+ ASSERT(m_bufflen == len);
+
+ src = m_buff;
+ dst = m_buff + len;
+
+ if(sps > 0
+ && (m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_COOK
+ || m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_ATRC))
+ {
+ for(int y = 0; y < h; y++)
+ {
+ for(int x = 0, w2 = w / sps; x < w2; x++)
+ {
+ // TRACE(_T("--- %d, %d\n"), (h*x+((h+1)/2)*(y&1)+(y>>1)), sps*(h*x+((h+1)/2)*(y&1)+(y>>1)));
+ memcpy(dst + sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), src, sps);
+ src += sps;
+ }
+ }
+
+ src = m_buff + len;
+ dst = m_buff + len*2;
+ }
+ else if(m_pInput->CurrentMediaType().subtype == MEDIASUBTYPE_SIPR)
+ {
+ // http://mplayerhq.hu/pipermail/mplayer-dev-eng/2002-August/010569.html
+
+ static BYTE sipr_swaps[38][2]={
+ {0,63},{1,22},{2,44},{3,90},{5,81},{7,31},{8,86},{9,58},{10,36},{12,68},
+ {13,39},{14,73},{15,53},{16,69},{17,57},{19,88},{20,34},{21,71},{24,46},
+ {25,94},{26,54},{28,75},{29,50},{32,70},{33,92},{35,74},{38,85},{40,56},
+ {42,87},{43,65},{45,59},{48,79},{49,93},{51,89},{55,95},{61,76},{67,83},
+ {77,80} };
+
+ int bs=h*w*2/96; // nibbles per subpacket
+ for(int n=0;n<38;n++){
+ int i=bs*sipr_swaps[n][0];
+ int o=bs*sipr_swaps[n][1];
+ // swap nibbles of block 'i' with 'o' TODO: optimize
+ for(int j=0;j<bs;j++){
+ int x=(i&1) ? (src[(i>>1)]>>4) : (src[(i>>1)]&15);
+ int y=(o&1) ? (src[(o>>1)]>>4) : (src[(o>>1)]&15);
+ if(o&1) src[(o>>1)]=(src[(o>>1)]&0x0F)|(x<<4);
+ else src[(o>>1)]=(src[(o>>1)]&0xF0)|x;
+ if(i&1) src[(i>>1)]=(src[(i>>1)]&0x0F)|(y<<4);
+ else src[(i>>1)]=(src[(i>>1)]&0xF0)|y;
+ ++i;++o;
+ }
+ }
+ }
+
+ m_bufflen = 0;
+ }
+ }
+
+ rtStart = m_rtBuffStart;
+
+ for(; src < dst; src += w)
+ {
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ hr = RADecode(m_dwCookie, src, w, pDataOut, &len, -1);
+
+ if(FAILED(hr))
+ {
+ TRACE(_T("RA returned an error code!!!\n"));
+ continue;
+// return hr;
+ }
+
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+
+ rtStop = rtStart + 1000i64*len/pwfe->nAvgBytesPerSec*10000;
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
+
+ pOut->SetDiscontinuity(m_fBuffDiscontinuity); m_fBuffDiscontinuity = false;
+ pOut->SetSyncPoint(TRUE);
+
+ pOut->SetActualDataLength(len);
+
+DbgLog((LOG_TRACE, 0, _T("A: rtStart=%I64d, rtStop=%I64d, disc=%d, sync=%d"),
+rtStart, rtStop, pOut->IsDiscontinuity() == S_OK, pOut->IsSyncPoint() == S_OK));
+
+ if(rtStart >= 0 && S_OK != (hr = m_pOutput->Deliver(pOut)))
+ return hr;
+
+ rtStart = rtStop;
+ }
+
+ m_rtBuffStart = rtStart;
+
+ return S_OK;
+}
+
+HRESULT CRealAudioDecoder::CheckInputType(const CMediaType* mtIn)
+{
+ if(mtIn->majortype != MEDIATYPE_Audio
+ || mtIn->subtype != MEDIASUBTYPE_14_4
+ && mtIn->subtype != MEDIASUBTYPE_28_8
+ && mtIn->subtype != MEDIASUBTYPE_ATRC
+ && mtIn->subtype != MEDIASUBTYPE_COOK
+ && mtIn->subtype != MEDIASUBTYPE_DNET
+ && mtIn->subtype != MEDIASUBTYPE_SIPR
+ && mtIn->subtype != MEDIASUBTYPE_RAAC
+ && mtIn->subtype != MEDIASUBTYPE_RACP
+ && mtIn->subtype != MEDIASUBTYPE_AAC)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(!m_pInput->IsConnected())
+ {
+ if(m_hDrvDll) {FreeLibrary(m_hDrvDll); m_hDrvDll = NULL;}
+
+ CAtlList<CString> paths;
+ CString olddll, newdll, oldpath, newpath;
+
+ TCHAR fourcc[5] =
+ {
+ (TCHAR)((mtIn->subtype.Data1>>0)&0xff),
+ (TCHAR)((mtIn->subtype.Data1>>8)&0xff),
+ (TCHAR)((mtIn->subtype.Data1>>16)&0xff),
+ (TCHAR)((mtIn->subtype.Data1>>24)&0xff),
+ 0
+ };
+
+ if(!_tcscmp(_T("RACP"), fourcc) || !_tcscmp(_T("\xff"), fourcc))
+ _tcscpy(fourcc, _T("RAAC"));
+
+ olddll.Format(_T("%s3260.dll"), fourcc);
+ newdll.Format(_T("%s.dll"), fourcc);
+
+ CRegKey key;
+ TCHAR buff[MAX_PATH];
+ ULONG len = sizeof(buff);
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Software\\RealNetworks\\Preferences\\DT_Codecs"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
+ {
+ oldpath = buff;
+ TCHAR c = oldpath[oldpath.GetLength()-1];
+ if(c != '\\' && c != '/') oldpath += '\\';
+ key.Close();
+ }
+ len = sizeof(buff);
+ if(ERROR_SUCCESS == key.Open(HKEY_CLASSES_ROOT, _T("Helix\\HelixSDK\\10.0\\Preferences\\DT_Codecs"), KEY_READ)
+ && ERROR_SUCCESS == key.QueryStringValue(NULL, buff, &len) && _tcslen(buff) > 0)
+ {
+ newpath = buff;
+ TCHAR c = newpath[newpath.GetLength()-1];
+ if(c != '\\' && c != '/') newpath += '\\';
+ key.Close();
+ }
+
+ if(!newpath.IsEmpty()) paths.AddTail(newpath + newdll);
+ if(!oldpath.IsEmpty()) paths.AddTail(oldpath + newdll);
+ paths.AddTail(newdll); // default dll paths
+ if(!newpath.IsEmpty()) paths.AddTail(newpath + olddll);
+ if(!oldpath.IsEmpty()) paths.AddTail(oldpath + olddll);
+ paths.AddTail(olddll); // default dll paths
+
+ POSITION pos = paths.GetHeadPosition();
+ while(pos && !(m_hDrvDll = LoadLibrary(paths.GetNext(pos))));
+
+ if(m_hDrvDll)
+ {
+ RACloseCodec = (PCloseCodec)GetProcAddress(m_hDrvDll, "RACloseCodec");
+ RADecode = (PDecode)GetProcAddress(m_hDrvDll, "RADecode");
+ RAFlush = (PFlush)GetProcAddress(m_hDrvDll, "RAFlush");
+ RAFreeDecoder = (PFreeDecoder)GetProcAddress(m_hDrvDll, "RAFreeDecoder");
+ RAGetFlavorProperty = (PGetFlavorProperty)GetProcAddress(m_hDrvDll, "RAGetFlavorProperty");
+ RAInitDecoder = (PInitDecoder)GetProcAddress(m_hDrvDll, "RAInitDecoder");
+ RAOpenCodec = (POpenCodec)GetProcAddress(m_hDrvDll, "RAOpenCodec");
+ RAOpenCodec2 = (POpenCodec2)GetProcAddress(m_hDrvDll, "RAOpenCodec2");
+ RASetFlavor = (PSetFlavor)GetProcAddress(m_hDrvDll, "RASetFlavor");
+ RASetDLLAccessPath = (PSetDLLAccessPath)GetProcAddress(m_hDrvDll, "RASetDLLAccessPath");
+ RASetPwd = (PSetPwd)GetProcAddress(m_hDrvDll, "RASetPwd");
+ }
+
+ if(!m_hDrvDll || !RACloseCodec || !RADecode /*|| !RAFlush*/
+ || !RAFreeDecoder || !RAGetFlavorProperty || !RAInitDecoder
+ || !(RAOpenCodec || RAOpenCodec2) /*|| !RASetFlavor*/)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(m_hDrvDll)
+ {
+ char buff[MAX_PATH];
+ GetModuleFileNameA(m_hDrvDll, buff, MAX_PATH);
+ CPathA p(buff);
+ p.RemoveFileSpec();
+ p.AddBackslash();
+ m_dllpath = p.m_strPath;
+ if(RASetDLLAccessPath)
+ RASetDLLAccessPath("DT_Codecs=" + m_dllpath);
+ }
+
+ if(FAILED(InitRA(mtIn)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return S_OK;
+}
+
+HRESULT CRealAudioDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return mtIn->majortype == MEDIATYPE_Audio && (mtIn->subtype == MEDIASUBTYPE_14_4
+ || mtIn->subtype == MEDIASUBTYPE_28_8
+ || mtIn->subtype == MEDIASUBTYPE_ATRC
+ || mtIn->subtype == MEDIASUBTYPE_COOK
+ || mtIn->subtype == MEDIASUBTYPE_DNET
+ || mtIn->subtype == MEDIASUBTYPE_SIPR
+ || mtIn->subtype == MEDIASUBTYPE_RAAC
+ || mtIn->subtype == MEDIASUBTYPE_RACP
+ || mtIn->subtype == MEDIASUBTYPE_AAC)
+ && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CRealAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
+
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+
+ WORD wBitsPerSample = pwfe->wBitsPerSample;
+ if(!wBitsPerSample) wBitsPerSample = 16;
+
+ // ok, maybe this is too much...
+ pProperties->cBuffers = 8;
+ pProperties->cbBuffer = pwfe->nChannels*pwfe->nSamplesPerSec*wBitsPerSample>>3; // nAvgBytesPerSec;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CRealAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ *pmt = m_pInput->CurrentMediaType();
+ pmt->subtype = MEDIASUBTYPE_PCM;
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEX));
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > (pwfe->nChannels > 2 && pwfe->nChannels <= 6 ? 1 : 0)) return VFW_S_NO_MORE_ITEMS;
+
+ if(!pwfe->wBitsPerSample) pwfe->wBitsPerSample = 16;
+
+ pwfe->cbSize = 0;
+ pwfe->wFormatTag = WAVE_FORMAT_PCM;
+ pwfe->nBlockAlign = pwfe->nChannels*pwfe->wBitsPerSample>>3;
+ pwfe->nAvgBytesPerSec = pwfe->nSamplesPerSec*pwfe->nBlockAlign;
+
+ if(iPosition == 0 && pwfe->nChannels > 2 && pwfe->nChannels <= 6)
+ {
+ static DWORD chmask[] =
+ {
+ KSAUDIO_SPEAKER_DIRECTOUT,
+ KSAUDIO_SPEAKER_MONO,
+ KSAUDIO_SPEAKER_STEREO,
+ KSAUDIO_SPEAKER_STEREO|SPEAKER_FRONT_CENTER,
+ KSAUDIO_SPEAKER_QUAD,
+ KSAUDIO_SPEAKER_QUAD|SPEAKER_FRONT_CENTER,
+ KSAUDIO_SPEAKER_5POINT1
+ };
+
+ WAVEFORMATEXTENSIBLE* pwfex = (WAVEFORMATEXTENSIBLE*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEXTENSIBLE));
+ pwfex->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
+ pwfex->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+ pwfex->dwChannelMask = chmask[pwfex->Format.nChannels];
+ pwfex->Samples.wValidBitsPerSample = pwfex->Format.wBitsPerSample;
+ pwfex->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+ }
+
+ return S_OK;
+}
+
+HRESULT CRealAudioDecoder::StartStreaming()
+{
+ int w = m_rai.coded_frame_size;
+ int h = m_rai.sub_packet_h;
+ int sps = m_rai.sub_packet_size;
+
+ int len = w*h;
+
+ m_buff.Allocate(len*2);
+ m_bufflen = 0;
+ m_rtBuffStart = 0;
+
+ return __super::StartStreaming();
+}
+
+HRESULT CRealAudioDecoder::StopStreaming()
+{
+ m_buff.Free();
+ m_bufflen = 0;
+
+ return __super::StopStreaming();
+}
+
+HRESULT CRealAudioDecoder::EndOfStream()
+{
+ return __super::EndOfStream();
+}
+
+HRESULT CRealAudioDecoder::BeginFlush()
+{
+ return __super::BeginFlush();
+}
+
+HRESULT CRealAudioDecoder::EndFlush()
+{
+ return __super::EndFlush();
+}
+
+HRESULT CRealAudioDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+ m_tStart = tStart;
+ m_bufflen = 0;
+ m_rtBuffStart = 0;
+ return __super::NewSegment(tStart, tStop, dRate);
+}
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter.def b/src/filters/parser/realmediasplitter/RealMediaSplitter.def
new file mode 100644
index 000000000..811c5c891
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/RealMediaSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "RealMediaSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter.h b/src/filters/parser/realmediasplitter/RealMediaSplitter.h
new file mode 100644
index 000000000..6eea6cd68
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/RealMediaSplitter.h
@@ -0,0 +1,325 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\BaseSplitter\BaseSplitter.h"
+#include "..\..\transform\BaseVideoFilter\BaseVideoFilter.h"
+
+#pragma pack(push, 1)
+
+namespace RMFF
+{
+ typedef struct {union {char id[4]; UINT32 object_id;}; UINT32 size; UINT16 object_version;} ChunkHdr;
+ typedef struct {UINT32 version, nHeaders;} FileHdr;
+ typedef struct
+ {
+ UINT32 maxBitRate, avgBitRate;
+ UINT32 maxPacketSize, avgPacketSize, nPackets;
+ UINT32 tDuration, tPreroll;
+ UINT32 ptrIndex, ptrData;
+ UINT16 nStreams;
+ enum flags_t {PN_SAVE_ENABLED=1, PN_PERFECT_PLAY_ENABLED=2, PN_LIVE_BROADCAST=4} flags;
+ } Properies;
+ typedef struct
+ {
+ UINT16 stream;
+ UINT32 maxBitRate, avgBitRate;
+ UINT32 maxPacketSize, avgPacketSize;
+ UINT32 tStart, tPreroll, tDuration;
+ CStringA name, mime;
+ CAtlArray<BYTE> typeSpecData;
+ UINT32 width, height;
+ bool interlaced, top_field_first;
+ } MediaProperies;
+ typedef struct {CStringA title, author, copyright, comment;} ContentDesc;
+ typedef struct {UINT64 pos; UINT32 nPackets, ptrNext;} DataChunk;
+ typedef struct
+ {
+ UINT16 len, stream;
+ UINT32 tStart;
+ UINT8 reserved;
+ enum flag_t {PN_RELIABLE_FLAG=1, PN_KEYFRAME_FLAG=2} flags; // UINT8
+ CAtlArray<BYTE> pData;
+ } MediaPacketHeader;
+ typedef struct {UINT32 nIndices; UINT16 stream; UINT32 ptrNext;} IndexChunkHeader;
+ typedef struct {UINT32 tStart, ptrFilePos, packet;} IndexRecord;
+}
+
+struct rvinfo
+{
+ DWORD dwSize, fcc1, fcc2;
+ WORD w, h, bpp;
+ DWORD unk1, fps, type1, type2;
+ BYTE morewh[14];
+ void bswap();
+};
+
+struct rainfo
+{
+ DWORD fourcc1; // '.', 'r', 'a', 0xfd
+ WORD version1; // 4 or 5
+ WORD unknown1; // 00 000
+ DWORD fourcc2; // .ra4 or .ra5
+ DWORD unknown2; // ???
+ WORD version2; // 4 or 5
+ DWORD header_size; // == 0x4e
+ WORD flavor; // codec flavor id
+ DWORD coded_frame_size; // coded frame size
+ DWORD unknown3; // big number
+ DWORD unknown4; // bigger number
+ DWORD unknown5; // yet another number
+ WORD sub_packet_h;
+ WORD frame_size;
+ WORD sub_packet_size;
+ WORD unknown6; // 00 00
+ void bswap();
+};
+
+struct rainfo4 : rainfo
+{
+ WORD sample_rate;
+ WORD unknown8; // 0
+ WORD sample_size;
+ WORD channels;
+ void bswap();
+};
+
+struct rainfo5 : rainfo
+{
+ BYTE unknown7[6]; // 0, srate, 0
+ WORD sample_rate;
+ WORD unknown8; // 0
+ WORD sample_size;
+ WORD channels;
+ DWORD genr; // "genr"
+ DWORD fourcc3; // fourcc
+ void bswap();
+};
+
+#pragma pack(pop)
+
+class CRMFile : public CBaseSplitterFile
+{
+ // using CBaseSplitterFile::Read;
+
+ HRESULT Init();
+ void GetDimensions();
+
+public:
+ CRMFile(IAsyncReader* pAsyncReader, HRESULT& hr);
+
+ template<typename T> HRESULT Read(T& var);
+ HRESULT Read(RMFF::ChunkHdr& hdr);
+ HRESULT Read(RMFF::MediaPacketHeader& mph, bool fFull = true);
+
+ RMFF::FileHdr m_fh;
+ RMFF::ContentDesc m_cd;
+ RMFF::Properies m_p;
+ CAutoPtrList<RMFF::MediaProperies> m_mps;
+ CAutoPtrList<RMFF::DataChunk> m_dcs;
+ CAutoPtrList<RMFF::IndexRecord> m_irs;
+
+ typedef struct {CStringA name, data;} subtitle;
+ CAtlList<subtitle> m_subs;
+
+ int GetMasterStream();
+};
+
+class CRealMediaSplitterOutputPin : public CBaseSplitterOutputPin
+{
+private:
+ typedef struct {CAtlArray<BYTE> data; DWORD offset;} segment;
+
+ class CSegments : public CAutoPtrList<segment>, public CCritSec
+ {
+ public:
+ REFERENCE_TIME rtStart;
+ bool fDiscontinuity, fSyncPoint, fMerged;
+ void Clear()
+ {
+ CAutoLock cAutoLock(this);
+ rtStart = 0;
+ fDiscontinuity = fSyncPoint = fMerged = false;
+ RemoveAll();
+ }
+ } m_segments;
+
+ CCritSec m_csQueue;
+
+ HRESULT DeliverSegments();
+
+protected:
+ HRESULT DeliverPacket(CAutoPtr<Packet> p);
+
+public:
+ CRealMediaSplitterOutputPin(CAtlArray<CMediaType>& mts, LPCWSTR pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CRealMediaSplitterOutputPin();
+
+ HRESULT DeliverEndFlush();
+};
+
+[uuid("E21BE468-5C18-43EB-B0CC-DB93A847D769")]
+class CRealMediaSplitterFilter : public CBaseSplitterFilter
+{
+protected:
+ CAutoPtr<CRMFile> m_pFile;
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+ POSITION m_seekpos;
+ UINT32 m_seekpacket;
+ UINT64 m_seekfilepos;
+
+public:
+ CRealMediaSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CRealMediaSplitterFilter();
+
+ // IKeyFrameInfo
+
+ STDMETHODIMP_(HRESULT) GetKeyFrameCount(UINT& nKFs);
+ STDMETHODIMP_(HRESULT) GetKeyFrames(const GUID* pFormat, REFERENCE_TIME* pKFs, UINT& nKFs);
+};
+
+[uuid("765035B3-5944-4A94-806B-20EE3415F26F")]
+class CRealMediaSourceFilter : public CRealMediaSplitterFilter
+{
+public:
+ CRealMediaSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
+
+////////////
+
+[uuid("238D0F23-5DC9-45A6-9BE2-666160C324DD")]
+class CRealVideoDecoder : public CBaseVideoFilter
+{
+ typedef HRESULT (WINAPI *PRVCustomMessage)(void*, DWORD);
+ typedef HRESULT (WINAPI *PRVFree)(DWORD);
+ typedef HRESULT (WINAPI *PRVHiveMessage)(void*, DWORD);
+ typedef HRESULT (WINAPI *PRVInit)(void*, DWORD* dwCookie);
+ typedef HRESULT (WINAPI *PRVTransform)(BYTE*, BYTE*, void*, void*, DWORD);
+
+ PRVCustomMessage RVCustomMessage;
+ PRVFree RVFree;
+ PRVHiveMessage RVHiveMessage;
+ PRVInit RVInit;
+ PRVTransform RVTransform;
+
+ HMODULE m_hDrvDll;
+ DWORD m_dwCookie;
+
+ HRESULT InitRV(const CMediaType* pmt);
+ void FreeRV();
+
+ REFERENCE_TIME m_tStart;
+
+ void Resize(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho);
+ void ResizeWidth(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho);
+ void ResizeHeight(BYTE* pIn, DWORD wi, DWORD hi, BYTE* pOut, DWORD wo, DWORD ho);
+ void ResizeRow(BYTE* pIn, DWORD wi, DWORD dpi, BYTE* pOut, DWORD wo, DWORD dpo);
+
+ CAutoVectorPtr<BYTE> m_pI420, m_pI420Tmp;
+
+public:
+ CRealVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CRealVideoDecoder();
+
+ HRESULT Transform(IMediaSample* pIn);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
+
+ HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+ DWORD m_timestamp;
+ bool m_fDropFrames;
+ HRESULT AlterQuality(Quality q);
+};
+
+[uuid("941A4793-A705-4312-8DFC-C11CA05F397E")]
+class CRealAudioDecoder : public CTransformFilter
+{
+ typedef HRESULT (WINAPI *PCloseCodec)(DWORD);
+ typedef HRESULT (WINAPI *PDecode)(DWORD,BYTE*,long,BYTE*,long*,long);
+ typedef HRESULT (WINAPI *PFlush)(DWORD,DWORD,DWORD);
+ typedef HRESULT (WINAPI *PFreeDecoder)(DWORD);
+ typedef void* (WINAPI *PGetFlavorProperty)(void*,DWORD,DWORD,int*);
+ typedef HRESULT (WINAPI *PInitDecoder)(DWORD, void*);
+ typedef HRESULT (WINAPI *POpenCodec)(void*);
+ typedef HRESULT (WINAPI *POpenCodec2)(void*, const char*);
+ typedef HRESULT (WINAPI *PSetFlavor)(DWORD, WORD);
+ typedef void (WINAPI *PSetDLLAccessPath)(const char*);
+ typedef void (WINAPI *PSetPwd)(DWORD, const char*);
+
+ PCloseCodec RACloseCodec;
+ PDecode RADecode;
+ PFlush RAFlush;
+ PFreeDecoder RAFreeDecoder;
+ PGetFlavorProperty RAGetFlavorProperty;
+ PInitDecoder RAInitDecoder;
+ POpenCodec RAOpenCodec;
+ POpenCodec2 RAOpenCodec2;
+ PSetFlavor RASetFlavor;
+ PSetDLLAccessPath RASetDLLAccessPath;
+ PSetPwd RASetPwd;
+
+ CStringA m_dllpath;
+ HMODULE m_hDrvDll;
+ DWORD m_dwCookie;
+
+ HRESULT InitRA(const CMediaType* pmt);
+ void FreeRA();
+
+ REFERENCE_TIME m_tStart;
+
+ rainfo m_rai;
+ CAutoVectorPtr<BYTE> m_buff;
+ int m_bufflen;
+ REFERENCE_TIME m_rtBuffStart;
+ bool m_fBuffDiscontinuity;
+
+public:
+ CRealAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CRealAudioDecoder();
+
+ HRESULT Receive(IMediaSample* pIn);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
+
+ HRESULT EndOfStream();
+ HRESULT BeginFlush();
+ HRESULT EndFlush();
+ HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+};
+
+
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter.rc b/src/filters/parser/realmediasplitter/RealMediaSplitter.rc
new file mode 100644
index 000000000..29c37afe5
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/RealMediaSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,1,1
+ PRODUCTVERSION 1,0,1,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "RealMedia Splitter"
+ VALUE "FileVersion", "1, 0, 1, 1"
+ VALUE "InternalName", "RealMedia Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006"
+ VALUE "OriginalFilename", "RealMediaSplitter.ax"
+ VALUE "ProductName", "RealMedia Splitter"
+ VALUE "ProductVersion", "1, 0, 1, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter.sln b/src/filters/parser/realmediasplitter/RealMediaSplitter.sln
new file mode 100644
index 000000000..ef97a59c3
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/RealMediaSplitter.sln
@@ -0,0 +1,94 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RealMediaSplitter", "RealMediaSplitter.vcproj", "{53CF9195-19DB-457D-8F55-8DB1706DFA84}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug.ActiveCfg = Debug|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug lib.ActiveCfg = Debug lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release.ActiveCfg = Release|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release lib.ActiveCfg = Release lib|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {53CF9195-19DB-457D-8F55-8DB1706DFA84}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter.vcproj b/src/filters/parser/realmediasplitter/RealMediaSplitter.vcproj
new file mode 100644
index 000000000..5236b6540
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/RealMediaSplitter.vcproj
@@ -0,0 +1,555 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="RealMediaSplitter"
+ ProjectGUID="{53CF9195-19DB-457D-8F55-8DB1706DFA84}"
+ RootNamespace="RealMediaSplitter"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib basevideofilterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib basevideofilterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib basevideofilterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ IgnoreDefaultLibraryNames="libc.lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib basevideofilterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="RealMediaSplitter.cpp">
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="RealMediaSplitter.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="RealMediaSplitter.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\RealMediaSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter_vs2005.vcproj b/src/filters/parser/realmediasplitter/RealMediaSplitter_vs2005.vcproj
new file mode 100644
index 000000000..702a23fc1
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/RealMediaSplitter_vs2005.vcproj
@@ -0,0 +1,814 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="RealMediaSplitter"
+ ProjectGUID="{53CF9195-19DB-457D-8F55-8DB1706DFA84}"
+ RootNamespace="RealMediaSplitter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="basesplitterD.lib basevideofilterD.lib"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="basesplitterR.lib basevideofilterR.lib"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="basesplitterDU.lib basevideofilterDU.lib"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="basesplitterRU.lib basevideofilterRU.lib"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib basevideofilterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib basevideofilterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib basevideofilterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ IgnoreDefaultLibraryNames="libc.lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib basevideofilterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="RealMediaSplitter.cpp"
+ >
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ GeneratePreprocessedFile="0"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="RealMediaSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="RealMediaSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\RealMediaSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/realmediasplitter/RealMediaSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/realmediasplitter/RealMediaSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/RealMediaSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/realmediasplitter/resource.h b/src/filters/parser/realmediasplitter/resource.h
new file mode 100644
index 000000000..68f7b566d
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by RealMediaSplitter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/realmediasplitter/stdafx.cpp b/src/filters/parser/realmediasplitter/stdafx.cpp
new file mode 100644
index 000000000..8a7154bc7
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// RealMediaSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/realmediasplitter/stdafx.h b/src/filters/parser/realmediasplitter/stdafx.h
new file mode 100644
index 000000000..dd0d28f25
--- /dev/null
+++ b/src/filters/parser/realmediasplitter/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/parser/roqsplitter/RoQSplitter.cpp b/src/filters/parser/roqsplitter/RoQSplitter.cpp
new file mode 100644
index 000000000..49c52c5e1
--- /dev/null
+++ b/src/filters/parser/roqsplitter/RoQSplitter.cpp
@@ -0,0 +1,1005 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <initguid.h>
+#include "RoQSplitter.h"
+#include "..\..\..\..\include\moreuuids.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_RoQ},
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, 0, NULL}
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn2[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RoQV},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut2[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins2[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn2), sudPinTypesIn2},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut2), sudPinTypesOut2}
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn3[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_RoQA},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut3[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
+};
+
+const AMOVIESETUP_PIN sudpPins3[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn3), sudPinTypesIn3},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut3), sudPinTypesOut3}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CRoQSplitterFilter), L"RoQ Splitter", MERIT_NORMAL+1, countof(sudpPins), sudpPins},
+ {&__uuidof(CRoQSourceFilter), L"RoQ Source", MERIT_NORMAL+1, 0, NULL},
+ {&__uuidof(CRoQVideoDecoder), L"RoQ Video Decoder", MERIT_UNLIKELY, countof(sudpPins2), sudpPins2},
+ {&__uuidof(CRoQAudioDecoder), L"RoQ Audio Decoder", MERIT_UNLIKELY, countof(sudpPins3), sudpPins3},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CRoQSplitterFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CRoQSourceFilter>, NULL, &sudFilter[1]},
+ {sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CRoQVideoDecoder>, NULL, &sudFilter[2]},
+ {sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CRoQAudioDecoder>, NULL, &sudFilter[3]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ RegisterSourceFilter(CLSID_AsyncReader, MEDIASUBTYPE_RoQ, _T("0,8,,8410FFFFFFFF1E00"), _T(".roq"), NULL);
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ UnRegisterSourceFilter(MEDIASUBTYPE_RoQ);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CRoQSplitterFilter
+//
+
+CRoQSplitterFilter::CRoQSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseSplitterFilter(NAME("CRoQSplitterFilter"), pUnk, phr, __uuidof(this))
+{
+}
+
+HRESULT CRoQSplitterFilter::CreateOutputs(IAsyncReader* pAsyncReader)
+{
+ CheckPointer(pAsyncReader, E_POINTER);
+
+ HRESULT hr = E_FAIL;
+
+ m_pAsyncReader = pAsyncReader;
+
+ UINT64 hdr = 0, hdrchk = 0x001effffffff1084;
+ m_pAsyncReader->SyncRead(0, 8, (BYTE*)&hdr);
+ if(hdr != hdrchk) return E_FAIL;
+
+ //
+
+ m_rtNewStart = m_rtCurrent = 0;
+ m_rtNewStop = m_rtStop = m_rtDuration = 0;
+
+ // pins
+
+ CMediaType mt;
+ CAtlArray<CMediaType> mts;
+
+ int iHasVideo = 0;
+ int iHasAudio = 0;
+
+ m_index.RemoveAll();
+ __int64 audiosamples = 0;
+
+ roq_info ri;
+ memset(&ri, 0, sizeof(ri));
+
+ roq_chunk rc;
+
+ UINT64 pos = 8;
+
+ while(S_OK == m_pAsyncReader->SyncRead(pos, sizeof(rc), (BYTE*)&rc))
+ {
+ pos += sizeof(rc);
+
+ if(rc.id == 0x1001)
+ {
+ if(S_OK != m_pAsyncReader->SyncRead(pos, sizeof(ri), (BYTE*)&ri) || ri.w == 0 || ri.h == 0)
+ break;
+ }
+ else if(rc.id == 0x1002 || rc.id == 0x1011)
+ {
+ if(!iHasVideo && ri.w > 0 && ri.h > 0)
+ {
+ mts.RemoveAll();
+
+ mt.InitMediaType();
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = MEDIASUBTYPE_RoQV;
+ mt.formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER vih;
+ memset(&vih, 0, sizeof(vih));
+ vih.AvgTimePerFrame = 10000000i64/30;
+ vih.bmiHeader.biSize = sizeof(vih.bmiHeader.biSize);
+ vih.bmiHeader.biWidth = ri.w;
+ vih.bmiHeader.biHeight = ri.h;
+ vih.bmiHeader.biCompression = MEDIASUBTYPE_RoQV.Data1;
+ mt.SetFormat((BYTE*)&vih, sizeof(vih));
+ mt.lSampleSize = 1;
+
+ mts.Add(mt);
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Video", this, this, &hr));
+ AddOutputPin(0, pPinOut);
+ }
+
+ if(rc.id == 0x1002)
+ {
+ iHasVideo++;
+
+ index i;
+ i.rtv = 10000000i64*m_index.GetCount()/30;
+ i.rta = 10000000i64*audiosamples/22050;
+ i.fp = pos - sizeof(rc);
+ m_index.AddTail(i);
+ }
+ }
+ else if(rc.id == 0x1020 || rc.id == 0x1021)
+ {
+ if(!iHasAudio)
+ {
+ mts.RemoveAll();
+
+ mt.InitMediaType();
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = MEDIASUBTYPE_RoQA;
+ mt.formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX wfe;
+ memset(&wfe, 0, sizeof(wfe));
+ wfe.wFormatTag = (WORD)WAVE_FORMAT_RoQA; // cut into half, hehe, like anyone would care
+ wfe.nChannels = (rc.id&1)+1;
+ wfe.nSamplesPerSec = 22050;
+ wfe.wBitsPerSample = 16;
+ mt.SetFormat((BYTE*)&wfe, sizeof(wfe));
+ mt.lSampleSize = 1;
+ mts.Add(mt);
+
+ CAutoPtr<CBaseSplitterOutputPin> pPinOut(new CBaseSplitterOutputPin(mts, L"Audio", this, this, &hr));
+ AddOutputPin(1, pPinOut);
+ }
+
+ iHasAudio++;
+
+ audiosamples += rc.size / ((rc.id&1)+1);
+ }
+
+ pos += rc.size;
+ }
+
+ //
+
+ m_rtNewStop = m_rtStop = m_rtDuration = 10000000i64*iHasVideo/30;
+
+ return m_pOutputs.GetCount() > 0 ? S_OK : E_FAIL;
+}
+
+bool CRoQSplitterFilter::DemuxInit()
+{
+ m_indexpos = m_index.GetHeadPosition();
+
+ return(true);
+}
+
+void CRoQSplitterFilter::DemuxSeek(REFERENCE_TIME rt)
+{
+ if(rt <= 0)
+ {
+ m_indexpos = m_index.GetHeadPosition();
+ }
+ else
+ {
+ m_indexpos = m_index.GetTailPosition();
+ while(m_indexpos && m_index.GetPrev(m_indexpos).rtv > rt);
+ }
+}
+
+bool CRoQSplitterFilter::DemuxLoop()
+{
+ if(!m_indexpos) return(true);
+
+ index& i = m_index.GetAt(m_indexpos);
+
+ REFERENCE_TIME rtVideo = i.rtv, rtAudio = i.rta;
+
+ HRESULT hr = S_OK;
+
+ UINT64 pos = i.fp;
+
+ roq_chunk rc;
+ while(S_OK == (hr = m_pAsyncReader->SyncRead(pos, sizeof(rc), (BYTE*)&rc))
+ && !CheckRequest(NULL))
+ {
+ pos += sizeof(rc);
+
+ CAutoPtr<Packet> p(new Packet());
+
+ if(rc.id == 0x1002 || rc.id == 0x1011 || rc.id == 0x1020 || rc.id == 0x1021)
+ {
+ p->SetCount(sizeof(rc) + rc.size);
+ memcpy(p->GetData(), &rc, sizeof(rc));
+ if(S_OK != (hr = m_pAsyncReader->SyncRead(pos, rc.size, p->GetData() + sizeof(rc))))
+ break;
+ }
+
+ if(rc.id == 0x1002 || rc.id == 0x1011)
+ {
+ p->TrackNumber = 0;
+ p->bSyncPoint = rtVideo == 0;
+ p->rtStart = rtVideo;
+ p->rtStop = rtVideo += (rc.id == 0x1011 ? 10000000i64/30 : 0);
+ TRACE(_T("v: %I64d - %I64d (%d)\n"), p->rtStart/10000, p->rtStop/10000, p->GetCount());
+ }
+ else if(rc.id == 0x1020 || rc.id == 0x1021)
+ {
+ int nChannels = (rc.id&1)+1;
+
+ p->TrackNumber = 1;
+ p->bSyncPoint = TRUE;
+ p->rtStart = rtAudio;
+ p->rtStop = rtAudio += 10000000i64*rc.size/(nChannels*22050);
+ TRACE(_T("a: %I64d - %I64d (%d)\n"), p->rtStart/10000, p->rtStop/10000, p->GetCount());
+ }
+
+ if(rc.id == 0x1002 || rc.id == 0x1011 || rc.id == 0x1020 || rc.id == 0x1021)
+ {
+ hr = DeliverPacket(p);
+ }
+
+ pos += rc.size;
+ }
+
+ return(true);
+}
+
+//
+// CRoQSourceFilter
+//
+
+CRoQSourceFilter::CRoQSourceFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CRoQSplitterFilter(pUnk, phr)
+{
+ m_clsid = __uuidof(this);
+ m_pInput.Free();
+}
+
+//
+// CRoQVideoDecoder
+//
+
+CRoQVideoDecoder::CRoQVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CRoQVideoDecoder"), lpunk, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+}
+
+CRoQVideoDecoder::~CRoQVideoDecoder()
+{
+}
+
+void CRoQVideoDecoder::apply_vector_2x2(int x, int y, roq_cell* cell)
+{
+ unsigned char* yptr;
+ yptr = m_y[0] + (y * m_pitch) + x;
+ *yptr++ = cell->y0;
+ *yptr++ = cell->y1;
+ yptr += (m_pitch - 2);
+ *yptr++ = cell->y2;
+ *yptr++ = cell->y3;
+ m_u[0][(y/2) * (m_pitch/2) + x/2] = cell->u;
+ m_v[0][(y/2) * (m_pitch/2) + x/2] = cell->v;
+}
+
+void CRoQVideoDecoder::apply_vector_4x4(int x, int y, roq_cell* cell)
+{
+ unsigned long row_inc, c_row_inc;
+ register unsigned char y0, y1, u, v;
+ unsigned char *yptr, *uptr, *vptr;
+
+ yptr = m_y[0] + (y * m_pitch) + x;
+ uptr = m_u[0] + (y/2) * (m_pitch/2) + x/2;
+ vptr = m_v[0] + (y/2) * (m_pitch/2) + x/2;
+
+ row_inc = m_pitch - 4;
+ c_row_inc = (m_pitch/2) - 2;
+ *yptr++ = y0 = cell->y0; *uptr++ = u = cell->u; *vptr++ = v = cell->v;
+ *yptr++ = y0;
+ *yptr++ = y1 = cell->y1; *uptr++ = u; *vptr++ = v;
+ *yptr++ = y1;
+
+ yptr += row_inc;
+
+ *yptr++ = y0;
+ *yptr++ = y0;
+ *yptr++ = y1;
+ *yptr++ = y1;
+
+ yptr += row_inc; uptr += c_row_inc; vptr += c_row_inc;
+
+ *yptr++ = y0 = cell->y2; *uptr++ = u; *vptr++ = v;
+ *yptr++ = y0;
+ *yptr++ = y1 = cell->y3; *uptr++ = u; *vptr++ = v;
+ *yptr++ = y1;
+
+ yptr += row_inc;
+
+ *yptr++ = y0;
+ *yptr++ = y0;
+ *yptr++ = y1;
+ *yptr++ = y1;
+}
+
+void CRoQVideoDecoder::apply_motion_4x4(int x, int y, unsigned char mv, char mean_x, char mean_y)
+{
+ int i, mx, my;
+ unsigned char *pa, *pb;
+
+ mx = x + 8 - (mv >> 4) - mean_x;
+ my = y + 8 - (mv & 0xf) - mean_y;
+
+ pa = m_y[0] + (y * m_pitch) + x;
+ pb = m_y[1] + (my * m_pitch) + mx;
+ for(i = 0; i < 4; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa[2] = pb[2];
+ pa[3] = pb[3];
+ pa += m_pitch;
+ pb += m_pitch;
+ }
+
+ pa = m_u[0] + (y/2) * (m_pitch/2) + x/2;
+ pb = m_u[1] + (my/2) * (m_pitch/2) + (mx + 1)/2;
+ for(i = 0; i < 2; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa += m_pitch/2;
+ pb += m_pitch/2;
+ }
+
+ pa = m_v[0] + (y/2) * (m_pitch/2) + x/2;
+ pb = m_v[1] + (my/2) * (m_pitch/2) + (mx + 1)/2;
+ for(i = 0; i < 2; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa += m_pitch/2;
+ pb += m_pitch/2;
+ }
+}
+
+void CRoQVideoDecoder::apply_motion_8x8(int x, int y, unsigned char mv, char mean_x, char mean_y)
+{
+ int mx, my, i;
+ unsigned char *pa, *pb;
+
+ mx = x + 8 - (mv >> 4) - mean_x;
+ my = y + 8 - (mv & 0xf) - mean_y;
+
+ pa = m_y[0] + (y * m_pitch) + x;
+ pb = m_y[1] + (my * m_pitch) + mx;
+ for(i = 0; i < 8; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa[2] = pb[2];
+ pa[3] = pb[3];
+ pa[4] = pb[4];
+ pa[5] = pb[5];
+ pa[6] = pb[6];
+ pa[7] = pb[7];
+ pa += m_pitch;
+ pb += m_pitch;
+ }
+
+ pa = m_u[0] + (y/2) * (m_pitch/2) + x/2;
+ pb = m_u[1] + (my/2) * (m_pitch/2) + (mx + 1)/2;
+ for(i = 0; i < 4; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa[2] = pb[2];
+ pa[3] = pb[3];
+ pa += m_pitch/2;
+ pb += m_pitch/2;
+ }
+
+ pa = m_v[0] + (y/2) * (m_pitch/2) + x/2;
+ pb = m_v[1] + (my/2) * (m_pitch/2) + (mx + 1)/2;
+ for(i = 0; i < 4; i++)
+ {
+ pa[0] = pb[0];
+ pa[1] = pb[1];
+ pa[2] = pb[2];
+ pa[3] = pb[3];
+ pa += m_pitch/2;
+ pb += m_pitch/2;
+ }
+}
+
+HRESULT CRoQVideoDecoder::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ m_rtStart = tStart;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
+
+ int size = bih.biWidth*bih.biHeight;
+
+ memset(m_y[0], 0, size);
+ memset(m_u[0], 0x80, size/2);
+ memset(m_y[1], 0, size);
+ memset(m_u[1], 0x80, size/2);
+
+ return __super::NewSegment(tStart, tStop, dRate);
+}
+
+HRESULT CRoQVideoDecoder::Transform(IMediaSample* pIn, IMediaSample* pOut)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+
+ long len = pIn->GetActualDataLength();
+ if(len <= 0) return S_OK; // nothing to do
+
+ REFERENCE_TIME rtStart = 0, rtStop = 0;
+ pIn->GetTime(&rtStart, &rtStop);
+
+ if(pIn->IsPreroll() == S_OK || rtStart < 0)
+ return S_OK;
+
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
+
+ int w = bih.biWidth, h = bih.biHeight;
+
+ // TODO: decode picture into m_pI420
+
+ roq_chunk* rc = (roq_chunk*)pDataIn;
+
+ pDataIn += sizeof(roq_chunk);
+
+ if(rc->id == 0x1002)
+ {
+ DWORD nv1 = rc->arg>>8;
+ if(nv1 == 0) nv1 = 256;
+
+ DWORD nv2 = rc->arg&0xff;
+ if(nv2 == 0 && nv1 * 6 < rc->size) nv2 = 256;
+
+ memcpy(m_cells, pDataIn, sizeof(m_cells[0])*nv1);
+ pDataIn += sizeof(m_cells[0])*nv1;
+
+ for(int i = 0; i < (int)nv2; i++)
+ for(int j = 0; j < 4; j++)
+ m_qcells[i].idx[j] = &m_cells[*pDataIn++];
+
+ return S_FALSE;
+ }
+ else if(rc->id == 0x1011)
+ {
+ int bpos = 0, xpos = 0, ypos = 0;
+ int vqflg = 0, vqflg_pos = -1, vqid;
+ roq_qcell* qcell = NULL;
+
+ BYTE* buf = pDataIn;
+
+ while(bpos < (int)rc->size && ypos < h)
+ {
+ for(int yp = ypos; yp < ypos + 16; yp += 8)
+ {
+ for(int xp = xpos; xp < xpos + 16; xp += 8)
+ {
+ if(vqflg_pos < 0)
+ {
+ vqflg = buf[bpos++];
+ vqflg |= buf[bpos++]<<8;
+ vqflg_pos = 7;
+ }
+
+ vqid = (vqflg >> (vqflg_pos * 2)) & 3;
+ vqflg_pos--;
+
+ switch(vqid)
+ {
+ case 0:
+ break;
+ case 1:
+ apply_motion_8x8(xp, yp, buf[bpos++], rc->arg >> 8, rc->arg & 0xff);
+ break;
+ case 2:
+ qcell = m_qcells + buf[bpos++];
+ apply_vector_4x4(xp, yp, qcell->idx[0]);
+ apply_vector_4x4(xp+4, yp, qcell->idx[1]);
+ apply_vector_4x4(xp, yp+4, qcell->idx[2]);
+ apply_vector_4x4(xp+4, yp+4, qcell->idx[3]);
+ break;
+ case 3:
+ for(int k = 0; k < 4; k++)
+ {
+ int x = xp, y = yp;
+ if(k&1) x += 4;
+ if(k&2) y += 4;
+
+ if(vqflg_pos < 0)
+ {
+ vqflg = buf[bpos++];
+ vqflg |= buf[bpos++]<<8;
+ vqflg_pos = 7;
+ }
+
+ vqid = (vqflg >> (vqflg_pos * 2)) & 3;
+ vqflg_pos--;
+
+ switch(vqid)
+ {
+ case 0:
+ break;
+ case 1:
+ apply_motion_4x4(x, y, buf[bpos++], rc->arg >> 8, rc->arg & 0xff);
+ break;
+ case 2:
+ qcell = m_qcells + buf[bpos++];
+ apply_vector_2x2(x, y, qcell->idx[0]);
+ apply_vector_2x2(x+2, y, qcell->idx[1]);
+ apply_vector_2x2(x, y+2, qcell->idx[2]);
+ apply_vector_2x2(x+2, y+2, qcell->idx[3]);
+ break;
+ case 3:
+ apply_vector_2x2(x, y, &m_cells[buf[bpos++]]);
+ apply_vector_2x2(x+2, y, &m_cells[buf[bpos++]]);
+ apply_vector_2x2(x, y+2, &m_cells[buf[bpos++]]);
+ apply_vector_2x2(x+2, y+2, &m_cells[buf[bpos++]]);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ xpos += 16;
+ if(xpos >= w) {xpos -= w; ypos += 16;}
+ }
+
+ if(m_rtStart+rtStart == 0)
+ {
+ memcpy(m_y[1], m_y[0], w*h*3/2);
+ }
+ else
+ {
+ BYTE* tmp;
+ tmp = m_y[0]; m_y[0] = m_y[1]; m_y[1] = tmp;
+ tmp = m_u[0]; m_u[0] = m_u[1]; m_u[1] = tmp;
+ tmp = m_v[0]; m_v[0] = m_v[1]; m_v[1] = tmp;
+ }
+ }
+ else
+ {
+ return E_UNEXPECTED;
+ }
+
+ if(rtStart < 0)
+ return S_FALSE;
+
+ Copy(pDataOut, m_y[1], w, h);
+
+ pOut->SetTime(&rtStart, &rtStop);
+
+ return S_OK;
+}
+
+void CRoQVideoDecoder::Copy(BYTE* pOut, BYTE* pIn, DWORD w, DWORD h)
+{
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+
+ int pitchIn = w;
+ int pitchInUV = pitchIn>>1;
+ BYTE* pInU = pIn + pitchIn*h;
+ BYTE* pInV = pInU + pitchInUV*h/2;
+
+ if(bihOut.biCompression == '2YUY')
+ {
+ BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth*2, pIn, pInU, pInV, pitchIn);
+ }
+ else if(bihOut.biCompression == 'I420' || bihOut.biCompression == 'VUYI')
+ {
+ BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth*h, pOut + bihOut.biWidth*h*5/4, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
+ }
+ else if(bihOut.biCompression == '21VY')
+ {
+ BitBltFromI420ToI420(w, h, pOut, pOut + bihOut.biWidth*h*5/4, pOut + bihOut.biWidth*h, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
+ }
+ else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ int pitchOut = bihOut.biWidth*bihOut.biBitCount>>3;
+
+ if(bihOut.biHeight > 0)
+ {
+ pOut += pitchOut*(h-1);
+ pitchOut = -pitchOut;
+ }
+
+ if(!BitBltFromI420ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, pIn, pInU, pInV, pitchIn))
+ {
+ for(DWORD y = 0; y < h; y++, pIn += pitchIn, pOut += pitchOut)
+ memset(pOut, 0, pitchOut);
+ }
+ }
+}
+
+HRESULT CRoQVideoDecoder::CheckInputType(const CMediaType* mtIn)
+{
+ return mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_RoQV
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CRoQVideoDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ if(m_pOutput && m_pOutput->IsConnected())
+ {
+ BITMAPINFOHEADER bih1, bih2;
+ if(ExtractBIH(mtOut, &bih1) && ExtractBIH(&m_pOutput->CurrentMediaType(), &bih2)
+ && abs(bih1.biHeight) != abs(bih2.biHeight))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return SUCCEEDED(CheckInputType(mtIn))
+ && mtOut->majortype == MEDIATYPE_Video && (mtOut->subtype == MEDIASUBTYPE_YUY2
+ || mtOut->subtype == MEDIASUBTYPE_YV12
+ || mtOut->subtype == MEDIASUBTYPE_I420
+ || mtOut->subtype == MEDIASUBTYPE_IYUV
+ || mtOut->subtype == MEDIASUBTYPE_ARGB32
+ || mtOut->subtype == MEDIASUBTYPE_RGB32
+ || mtOut->subtype == MEDIASUBTYPE_RGB24
+ || mtOut->subtype == MEDIASUBTYPE_RGB565
+ || mtOut->subtype == MEDIASUBTYPE_RGB555)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CRoQVideoDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = bih.biSizeImage;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CRoQVideoDecoder::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ struct {const GUID* subtype; WORD biPlanes, biBitCount; DWORD biCompression;} fmts[] =
+ {
+ {&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
+ {&MEDIASUBTYPE_I420, 3, 12, '024I'},
+ {&MEDIASUBTYPE_IYUV, 3, 12, 'VUYI'},
+ {&MEDIASUBTYPE_YUY2, 1, 16, '2YUY'},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_RGB},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_BITFIELDS},
+ };
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= countof(fmts)) return VFW_S_NO_MORE_ITEMS;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = *fmts[iPosition].subtype;
+ pmt->formattype = FORMAT_VideoInfo;
+
+ BITMAPINFOHEADER bihOut;
+ memset(&bihOut, 0, sizeof(bihOut));
+ bihOut.biSize = sizeof(bihOut);
+ bihOut.biWidth = bih.biWidth;
+ bihOut.biHeight = bih.biHeight;
+ bihOut.biPlanes = fmts[iPosition].biPlanes;
+ bihOut.biBitCount = fmts[iPosition].biBitCount;
+ bihOut.biCompression = fmts[iPosition].biCompression;
+ bihOut.biSizeImage = bih.biWidth*bih.biHeight*bihOut.biBitCount>>3;
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->bmiHeader = bihOut;
+
+ CorrectMediaType(pmt);
+
+ return S_OK;
+}
+
+HRESULT CRoQVideoDecoder::StartStreaming()
+{
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bih);
+
+ int size = bih.biWidth*bih.biHeight;
+
+ m_y[0] = new BYTE[size*3/2];
+ m_u[0] = m_y[0] + size;
+ m_v[0] = m_y[0] + size*5/4;
+ m_y[1] = new BYTE[size*3/2];
+ m_u[1] = m_y[1] + size;
+ m_v[1] = m_y[1] + size*5/4;
+
+ m_pitch = bih.biWidth;
+
+ return __super::StartStreaming();
+}
+
+HRESULT CRoQVideoDecoder::StopStreaming()
+{
+ delete [] m_y[0]; m_y[0] = NULL;
+ delete [] m_y[1]; m_y[1] = NULL;
+
+ return __super::StopStreaming();
+}
+
+//
+// CRealAudioDecoder
+//
+
+CRoQAudioDecoder::CRoQAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CRoQAudioDecoder"), lpunk, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+}
+
+CRoQAudioDecoder::~CRoQAudioDecoder()
+{
+}
+
+HRESULT CRoQAudioDecoder::Transform(IMediaSample* pIn, IMediaSample* pOut)
+{
+ HRESULT hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ WAVEFORMATEX* pwfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn)))
+ return hr;
+
+ long len = pIn->GetActualDataLength();
+ if(len <= 0) return S_OK;
+
+ REFERENCE_TIME rtStart, rtStop;
+ pIn->GetTime(&rtStart, &rtStop);
+
+ if(pIn->IsPreroll() == S_OK || rtStart < 0)
+ return S_OK;
+
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ long size = pOut->GetSize();
+ if(size <= 0)
+ return E_FAIL;
+
+ roq_chunk* rc = (roq_chunk*)pDataIn;
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+
+ if(wfe->nChannels == 1)
+ {
+ int mono = (short)rc->arg;
+ unsigned char* src = pDataIn + sizeof(roq_chunk);
+ short* dst = (short*)pDataOut;
+ for(int i = sizeof(roq_chunk); i < len; i++, src++, dst++)
+ {
+ short diff = (*src&0x7f)*(*src&0x7f);
+ if(*src&0x80) diff = -diff;
+ mono += diff;
+ *dst = (short)mono;
+ }
+ }
+ else if(wfe->nChannels == 2)
+ {
+ int left = (char)(rc->arg>>8)<<8;
+ int right = (char)(rc->arg)<<8;
+ unsigned char* src = pDataIn + sizeof(roq_chunk);
+ short* dst = (short*)pDataOut;
+ for(int i = sizeof(roq_chunk); i < len; i+=2, src++, dst++)
+ {
+ short diff = (*src&0x7f)*(*src&0x7f);
+ if(*src&0x80) diff = -diff;
+ ASSERT((int)left + diff <= SHRT_MAX && (int)left + diff >= SHRT_MIN);
+ left += diff;
+ *dst = (short)left;
+
+ src++; dst++;
+
+ diff = (*src&0x7f)*(*src&0x7f);
+ if(*src&0x80) diff = -diff;
+ ASSERT((int)right + diff <= SHRT_MAX && (int)right + diff >= SHRT_MIN);
+ right += diff;
+ *dst = (short)right;
+ }
+ }
+ else
+ {
+ return E_UNEXPECTED;
+ }
+
+ pOut->SetTime(&rtStart, &rtStop);
+
+ pOut->SetActualDataLength(2*(len-sizeof(roq_chunk)));
+
+ return S_OK;
+}
+
+HRESULT CRoQAudioDecoder::CheckInputType(const CMediaType* mtIn)
+{
+ return mtIn->majortype == MEDIATYPE_Audio && mtIn->subtype == MEDIASUBTYPE_RoQA
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CRoQAudioDecoder::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return SUCCEEDED(CheckInputType(mtIn))
+ && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CRoQAudioDecoder::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+
+ // ok, maybe this is too much...
+ pProperties->cBuffers = 8;
+ pProperties->cbBuffer = wfe->nChannels*wfe->nSamplesPerSec*wfe->wBitsPerSample>>3; // nAvgBytesPerSec;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR;
+}
+
+HRESULT CRoQAudioDecoder::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ *pmt = m_pInput->CurrentMediaType();
+ pmt->subtype = MEDIASUBTYPE_PCM;
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->ReallocFormatBuffer(sizeof(WAVEFORMATEX));
+ wfe->cbSize = 0;
+ wfe->wFormatTag = WAVE_FORMAT_PCM;
+ wfe->nBlockAlign = wfe->nChannels*wfe->wBitsPerSample>>3;
+ wfe->nAvgBytesPerSec = wfe->nSamplesPerSec*wfe->nBlockAlign;
+
+ return S_OK;
+}
diff --git a/src/filters/parser/roqsplitter/RoQSplitter.def b/src/filters/parser/roqsplitter/RoQSplitter.def
new file mode 100644
index 000000000..69e3407a5
--- /dev/null
+++ b/src/filters/parser/roqsplitter/RoQSplitter.def
@@ -0,0 +1,7 @@
+LIBRARY "RoQSplitter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/roqsplitter/RoQSplitter.h b/src/filters/parser/roqsplitter/RoQSplitter.h
new file mode 100644
index 000000000..e3abb3330
--- /dev/null
+++ b/src/filters/parser/roqsplitter/RoQSplitter.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\BaseSplitter\BaseSplitter.h"
+
+// {48B93619-A959-45d9-B5FD-E12A67A96CF1}
+DEFINE_GUID(MEDIASUBTYPE_RoQ,
+0x48b93619, 0xa959, 0x45d9, 0xb5, 0xfd, 0xe1, 0x2a, 0x67, 0xa9, 0x6c, 0xf1);
+
+// 56516F52-0000-0010-8000-00AA00389B71 'RoQV' == MEDIASUBTYPE_RoQV
+DEFINE_GUID(MEDIASUBTYPE_RoQV,
+0x56516F52, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+
+#define WAVE_FORMAT_RoQA 0x41516F52
+
+// 41516F52-0000-0010-8000-00AA00389B71 'RoQA' == MEDIASUBTYPE_RoQA
+DEFINE_GUID(MEDIASUBTYPE_RoQA,
+WAVE_FORMAT_RoQA, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+
+#pragma pack(push, 1)
+struct roq_chunk {WORD id; DWORD size; WORD arg;};
+struct roq_info {WORD w, h, unk1, unk2;};
+#pragma pack(pop)
+
+[uuid("C73DF7C1-21F2-44C7-A430-D35FB9BB298F")]
+class CRoQSplitterFilter : public CBaseSplitterFilter
+{
+ CComPtr<IAsyncReader> m_pAsyncReader;
+
+ struct index {REFERENCE_TIME rtv, rta; __int64 fp;};
+ CAtlList<index> m_index;
+ POSITION m_indexpos;
+
+protected:
+ HRESULT CreateOutputs(IAsyncReader* pAsyncReader);
+
+ bool DemuxInit();
+ void DemuxSeek(REFERENCE_TIME rt);
+ bool DemuxLoop();
+
+public:
+ CRoQSplitterFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
+
+[uuid("02B8E5C2-4E1F-45D3-9A8E-B8F1EDE6DE09")]
+class CRoQSourceFilter : public CRoQSplitterFilter
+{
+public:
+ CRoQSourceFilter(LPUNKNOWN pUnk, HRESULT* phr);
+};
+
+[uuid("FBEFC5EC-ABA0-4E6C-ACA3-D05FDFEFB853")]
+class CRoQVideoDecoder : public CTransformFilter
+{
+ CCritSec m_csReceive;
+
+ REFERENCE_TIME m_rtStart;
+
+ BYTE* m_y[2];
+ BYTE* m_u[2];
+ BYTE* m_v[2];
+ int m_pitch;
+
+ void Copy(BYTE* pOut, BYTE* pIn, DWORD w, DWORD h);
+
+ #pragma pack(push, 1)
+ struct roq_cell {BYTE y0, y1, y2, y3, u, v;} m_cells[256];
+ struct roq_qcell {roq_cell* idx[4];} m_qcells[256];
+ #pragma pack(pop)
+ void apply_vector_2x2(int x, int y, roq_cell* cell);
+ void apply_vector_4x4(int x, int y, roq_cell* cell);
+ void apply_motion_4x4(int x, int y, unsigned char mv, char mean_x, char mean_y);
+ void apply_motion_8x8(int x, int y, unsigned char mv, char mean_x, char mean_y);
+
+public:
+ CRoQVideoDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CRoQVideoDecoder();
+
+ HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
+};
+
+[uuid("226FAF85-E358-4502-8C98-F4224BE76953")]
+class CRoQAudioDecoder : public CTransformFilter
+{
+public:
+ CRoQAudioDecoder(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CRoQAudioDecoder();
+
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+};
+
diff --git a/src/filters/parser/roqsplitter/RoQSplitter.rc b/src/filters/parser/roqsplitter/RoQSplitter.rc
new file mode 100644
index 000000000..fdbb7f6eb
--- /dev/null
+++ b/src/filters/parser/roqsplitter/RoQSplitter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "RoQ Splitter (based on Tim Ferguson's decoder)"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "RoQ Splitter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "RoQSplitter.ax"
+ VALUE "ProductName", "RoQGt Splitter"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/roqsplitter/RoQSplitter.sln b/src/filters/parser/roqsplitter/RoQSplitter.sln
new file mode 100644
index 000000000..e7035db1a
--- /dev/null
+++ b/src/filters/parser/roqsplitter/RoQSplitter.sln
@@ -0,0 +1,94 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RoQSplitter", "RoQSplitter.vcproj", "{23E1898F-8262-435c-8848-D4D8824E6D71}"
+ ProjectSection(ProjectDependencies) = postProject
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F} = {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesplitter", "..\basesplitter\basesplitter.vcproj", "{37768B3F-89BC-4C16-B2A8-767C5DA84C3F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {23E1898F-8262-435c-8848-D4D8824E6D71}.Debug.ActiveCfg = Debug|Win32
+ {23E1898F-8262-435c-8848-D4D8824E6D71}.Debug lib.ActiveCfg = Debug lib|Win32
+ {23E1898F-8262-435c-8848-D4D8824E6D71}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {23E1898F-8262-435c-8848-D4D8824E6D71}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {23E1898F-8262-435c-8848-D4D8824E6D71}.Release.ActiveCfg = Release|Win32
+ {23E1898F-8262-435c-8848-D4D8824E6D71}.Release lib.ActiveCfg = Release lib|Win32
+ {23E1898F-8262-435c-8848-D4D8824E6D71}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {23E1898F-8262-435c-8848-D4D8824E6D71}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.ActiveCfg = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug lib.Build.0 = Debug lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.ActiveCfg = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release lib.Build.0 = Release lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {37768B3F-89BC-4C16-B2A8-767C5DA84C3F}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/roqsplitter/RoQSplitter.vcproj b/src/filters/parser/roqsplitter/RoQSplitter.vcproj
new file mode 100644
index 000000000..6bd5c1fa7
--- /dev/null
+++ b/src/filters/parser/roqsplitter/RoQSplitter.vcproj
@@ -0,0 +1,553 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="RoQSplitter"
+ ProjectGUID="{23E1898F-8262-435C-8848-D4D8824E6D71}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="RoQSplitter.cpp">
+ </File>
+ <File
+ RelativePath="RoQSplitter.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\RoQSplitter.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\RoQSplitter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/roqsplitter/RoQSplitter_vs2005.vcproj b/src/filters/parser/roqsplitter/RoQSplitter_vs2005.vcproj
new file mode 100644
index 000000000..4e2a93919
--- /dev/null
+++ b/src/filters/parser/roqsplitter/RoQSplitter_vs2005.vcproj
@@ -0,0 +1,806 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="RoQSplitter"
+ ProjectGUID="{23E1898F-8262-435C-8848-D4D8824E6D71}"
+ RootNamespace="RoQSplitter"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib basesplitterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib basesplitterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib basesplitterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib basesplitterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="RoQSplitter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="RoQSplitter.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\RoQSplitter.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\RoQSplitter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/roqsplitter/RoQSplitter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/roqsplitter/RoQSplitter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/roqsplitter/RoQSplitter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/parser/roqsplitter/resource.h b/src/filters/parser/roqsplitter/resource.h
new file mode 100644
index 000000000..9bee95d26
--- /dev/null
+++ b/src/filters/parser/roqsplitter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by RoQSplitter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/roqsplitter/stdafx.cpp b/src/filters/parser/roqsplitter/stdafx.cpp
new file mode 100644
index 000000000..4284c08d9
--- /dev/null
+++ b/src/filters/parser/roqsplitter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// RoQSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/roqsplitter/stdafx.h b/src/filters/parser/roqsplitter/stdafx.h
new file mode 100644
index 000000000..a4dc73d2b
--- /dev/null
+++ b/src/filters/parser/roqsplitter/stdafx.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include "..\..\..\DSUtil\vd.h"
+
+#pragma warning(disable: 4355) // 'this' : used in base member initializer list
diff --git a/src/filters/parser/streamdrivethru/StreamDriveThru.cpp b/src/filters/parser/streamdrivethru/StreamDriveThru.cpp
new file mode 100644
index 000000000..e60dd6784
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/StreamDriveThru.cpp
@@ -0,0 +1,562 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "streamdrivethru.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CStreamDriveThruFilter), L"StreamDriveThru", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CStreamDriveThruFilter>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CStreamDriveThruFilter
+//
+
+CStreamDriveThruFilter::CStreamDriveThruFilter(LPUNKNOWN pUnk, HRESULT* phr)
+ : CBaseFilter(NAME("CStreamDriveThruFilter"), pUnk, &m_csLock, __uuidof(this))
+ , m_position(0)
+{
+ if(phr) *phr = S_OK;
+
+ m_pInput = new CStreamDriveThruInputPin(NAME("CStreamDriveThruInputPin"), this, &m_csLock, phr);
+ m_pOutput = new CStreamDriveThruOutputPin(NAME("CStreamDriveThruOutputPin"), this, &m_csLock, phr);
+
+ CAMThread::Create();
+}
+
+CStreamDriveThruFilter::~CStreamDriveThruFilter()
+{
+ CAutoLock csAutoLock(&m_csLock);
+
+ CAMThread::CallWorker(CMD_EXIT);
+ CAMThread::Close();
+
+ delete m_pInput;
+ delete m_pOutput;
+}
+
+STDMETHODIMP CStreamDriveThruFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IMediaSeeking)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+#define PACKETSIZE 65536
+
+DWORD CStreamDriveThruFilter::ThreadProc()
+{
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+
+ switch(cmd)
+ {
+ default:
+ case CMD_EXIT:
+ Reply(S_OK);
+ return 0;
+ case CMD_STOP:
+ Reply(S_OK);
+ break;
+ case CMD_PAUSE:
+ Reply(S_OK);
+ break;
+ case CMD_RUN:
+ Reply(S_OK);
+
+ do
+ {
+ CComPtr<IAsyncReader> pAsyncReader;
+ CComPtr<IStream> pStream;
+
+ if(!m_pInput || !m_pInput->IsConnected() || FAILED(m_pInput->GetAsyncReader(&pAsyncReader))
+ || !m_pOutput || !m_pOutput->IsConnected() || FAILED(m_pOutput->GetStream(&pStream)))
+ break;
+
+ LARGE_INTEGER li = {0};
+ ULARGE_INTEGER uli = {0};
+
+ if(FAILED(pStream->Seek(li, STREAM_SEEK_SET, NULL))
+ || FAILED(pStream->SetSize(uli)))
+ break;
+
+ if(CComQIPtr<IFileSinkFilter2> pFSF = GetFilterFromPin(m_pOutput->GetConnected()))
+ {
+ pFSF->SetMode(AM_FILE_OVERWRITE);
+
+ LPOLESTR pfn;
+ if(SUCCEEDED(pFSF->GetCurFile(&pfn, NULL)))
+ {
+ pFSF->SetFileName(pfn, NULL);
+ CoTaskMemFree(pfn);
+ }
+ }
+
+ m_position = 0;
+ BYTE buff[PACKETSIZE];
+
+ do
+ {
+ while(!CheckRequest(&cmd))
+ {
+ CAutoLock csAutoLock(&m_csLock);
+
+ LONGLONG total = 0, available = 0;
+ if(FAILED(pAsyncReader->Length(&total, &available)) || m_position >= total)
+ {
+ cmd = CMD_STOP;
+ break;
+ }
+
+ LONG size = (LONG)min(PACKETSIZE, total - m_position);
+ if(FAILED(pAsyncReader->SyncRead(m_position, size, buff)))
+ {
+ cmd = CMD_STOP;
+ break;
+ }
+
+ ULONG written = 0;
+ if(FAILED(pStream->Write(buff, (ULONG)size, &written)) || (ULONG)size != written)
+ {
+ cmd = CMD_STOP;
+ break;
+ }
+
+ m_position += size;
+ }
+
+ if(cmd == CMD_PAUSE)
+ {
+ Reply(S_OK); // reply to CMD_PAUSE
+
+ while(!CheckRequest(&cmd))
+ Sleep(50);
+
+ Reply(S_OK); // reply to something
+ }
+ }
+ while(cmd == CMD_RUN);
+
+ uli.QuadPart = m_position;
+ pStream->SetSize(uli);
+
+ if(CComPtr<IPin> pPin = m_pOutput->GetConnected())
+ pPin->EndOfStream();
+ }
+ while(false);
+
+ break;
+ }
+ }
+
+ return 0;
+}
+
+int CStreamDriveThruFilter::GetPinCount()
+{
+ return 2;
+}
+
+CBasePin* CStreamDriveThruFilter::GetPin(int n)
+{
+ CAutoLock csAutoLock(&m_csLock);
+
+ if(n == 0) return m_pInput;
+ else if(n == 1) return m_pOutput;
+
+ return NULL;
+}
+
+STDMETHODIMP CStreamDriveThruFilter::Stop()
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Stop()))
+ return hr;
+
+ CallWorker(CMD_STOP);
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamDriveThruFilter::Pause()
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Pause()))
+ return hr;
+
+ CallWorker(CMD_PAUSE);
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamDriveThruFilter::Run(REFERENCE_TIME tStart)
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::Run(tStart)))
+ return hr;
+
+ CallWorker(CMD_RUN);
+
+ return S_OK;
+}
+
+// IMediaSeeking
+
+STDMETHODIMP CStreamDriveThruFilter::GetCapabilities(DWORD* pCapabilities)
+{
+ return pCapabilities ? *pCapabilities = AM_SEEKING_CanGetCurrentPos|AM_SEEKING_CanGetStopPos|AM_SEEKING_CanGetDuration, S_OK : E_POINTER;
+}
+STDMETHODIMP CStreamDriveThruFilter::CheckCapabilities(DWORD* pCapabilities)
+{
+ CheckPointer(pCapabilities, E_POINTER);
+
+ if(*pCapabilities == 0) return S_OK;
+
+ DWORD caps;
+ GetCapabilities(&caps);
+
+ DWORD caps2 = caps & *pCapabilities;
+
+ return caps2 == 0 ? E_FAIL : caps2 == *pCapabilities ? S_OK : S_FALSE;
+}
+STDMETHODIMP CStreamDriveThruFilter::IsFormatSupported(const GUID* pFormat)
+{
+ return !pFormat ? E_POINTER : *pFormat == TIME_FORMAT_MEDIA_TIME ? S_OK : S_FALSE;
+}
+STDMETHODIMP CStreamDriveThruFilter::QueryPreferredFormat(GUID* pFormat)
+{
+ return GetTimeFormat(pFormat);
+}
+STDMETHODIMP CStreamDriveThruFilter::GetTimeFormat(GUID* pFormat)
+{
+ return pFormat ? *pFormat = TIME_FORMAT_MEDIA_TIME, S_OK : E_POINTER;
+}
+STDMETHODIMP CStreamDriveThruFilter::IsUsingTimeFormat(const GUID* pFormat)
+{
+ return IsFormatSupported(pFormat);
+}
+STDMETHODIMP CStreamDriveThruFilter::SetTimeFormat(const GUID* pFormat)
+{
+ return S_OK == IsFormatSupported(pFormat) ? S_OK : E_INVALIDARG;
+}
+STDMETHODIMP CStreamDriveThruFilter::GetDuration(LONGLONG* pDuration)
+{
+ CheckPointer(pDuration, E_POINTER);
+ CheckPointer(m_pInput, VFW_E_NOT_CONNECTED);
+
+ if(CComQIPtr<IAsyncReader> pAsyncReader = m_pInput->GetConnected())
+ {
+ LONGLONG total, available;
+ if(SUCCEEDED(pAsyncReader->Length(&total, &available)))
+ {
+ *pDuration = total;
+ return S_OK;
+ }
+ }
+
+ return E_NOINTERFACE;
+}
+STDMETHODIMP CStreamDriveThruFilter::GetStopPosition(LONGLONG* pStop)
+{
+ return GetDuration(pStop);
+}
+STDMETHODIMP CStreamDriveThruFilter::GetCurrentPosition(LONGLONG* pCurrent)
+{
+ return pCurrent ? *pCurrent = m_position, S_OK : E_POINTER;
+}
+STDMETHODIMP CStreamDriveThruFilter::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::SetRate(double dRate) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::GetRate(double* pdRate) {return E_NOTIMPL;}
+STDMETHODIMP CStreamDriveThruFilter::GetPreroll(LONGLONG* pllPreroll)
+{
+ return pllPreroll ? *pllPreroll = 0, S_OK : E_POINTER;
+}
+
+//
+// CStreamDriveThruInputPin
+//
+
+CStreamDriveThruInputPin::CStreamDriveThruInputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBasePin(pName, pFilter, pLock, phr, L"Input", PINDIR_INPUT)
+{
+}
+
+CStreamDriveThruInputPin::~CStreamDriveThruInputPin()
+{
+}
+
+HRESULT CStreamDriveThruInputPin::GetAsyncReader(IAsyncReader** ppAsyncReader)
+{
+ CheckPointer(ppAsyncReader, E_POINTER);
+
+ *ppAsyncReader = NULL;
+
+ CheckPointer(m_pAsyncReader, VFW_E_NOT_CONNECTED);
+
+ (*ppAsyncReader = m_pAsyncReader)->AddRef();
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamDriveThruInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CStreamDriveThruInputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Stream
+ ? S_OK
+ : E_INVALIDARG;
+}
+
+HRESULT CStreamDriveThruInputPin::CheckConnect(IPin* pPin)
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::CheckConnect(pPin)))
+ return hr;
+
+ if(!CComQIPtr<IAsyncReader>(pPin))
+ return E_NOINTERFACE;
+
+ return S_OK;
+}
+
+HRESULT CStreamDriveThruInputPin::BreakConnect()
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::BreakConnect()))
+ return hr;
+
+ m_pAsyncReader.Release();
+
+ return S_OK;
+}
+
+HRESULT CStreamDriveThruInputPin::CompleteConnect(IPin* pPin)
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::CompleteConnect(pPin)))
+ return hr;
+
+ CheckPointer(pPin, E_POINTER);
+ m_pAsyncReader = pPin;
+ CheckPointer(m_pAsyncReader, E_NOINTERFACE);
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamDriveThruInputPin::BeginFlush()
+{
+ return E_UNEXPECTED;
+}
+
+STDMETHODIMP CStreamDriveThruInputPin::EndFlush()
+{
+ return E_UNEXPECTED;
+}
+
+//
+// CStreamDriveThruOutputPin
+//
+
+CStreamDriveThruOutputPin::CStreamDriveThruOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseOutputPin(pName, pFilter, pLock, phr, L"Output")
+{
+}
+
+CStreamDriveThruOutputPin::~CStreamDriveThruOutputPin()
+{
+}
+
+HRESULT CStreamDriveThruOutputPin::GetStream(IStream** ppStream)
+{
+ CheckPointer(ppStream, E_POINTER);
+
+ *ppStream = NULL;
+
+ CheckPointer(m_pStream, VFW_E_NOT_CONNECTED);
+
+ (*ppStream = m_pStream)->AddRef();
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamDriveThruOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CStreamDriveThruOutputPin::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = PACKETSIZE;
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
+
+ return NOERROR;
+}
+
+HRESULT CStreamDriveThruOutputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Stream
+ ? S_OK
+ : E_INVALIDARG;
+}
+
+HRESULT CStreamDriveThruOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ CAutoLock cAutoLock(m_pLock);
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pmt->majortype = MEDIATYPE_Stream;
+ pmt->subtype = GUID_NULL;
+ pmt->formattype = GUID_NULL;
+ pmt->SetSampleSize(PACKETSIZE);
+
+ return S_OK;
+}
+
+HRESULT CStreamDriveThruOutputPin::CheckConnect(IPin* pPin)
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::CheckConnect(pPin)))
+ return hr;
+
+ if(!CComQIPtr<IStream>(pPin))
+ return E_NOINTERFACE;
+
+ return S_OK;
+}
+
+HRESULT CStreamDriveThruOutputPin::BreakConnect()
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::BreakConnect()))
+ return hr;
+
+ m_pStream.Release();
+
+ return S_OK;
+}
+
+HRESULT CStreamDriveThruOutputPin::CompleteConnect(IPin* pPin)
+{
+ HRESULT hr;
+
+ if(FAILED(hr = __super::CompleteConnect(pPin)))
+ return hr;
+
+ CheckPointer(pPin, E_POINTER);
+ m_pStream = pPin;
+ CheckPointer(m_pStream, E_NOINTERFACE);
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamDriveThruOutputPin::BeginFlush()
+{
+ return E_UNEXPECTED;
+}
+
+STDMETHODIMP CStreamDriveThruOutputPin::EndFlush()
+{
+ return E_UNEXPECTED;
+}
+
+STDMETHODIMP CStreamDriveThruOutputPin::Notify(IBaseFilter* pSender, Quality q)
+{
+ return E_NOTIMPL;
+}
diff --git a/src/filters/parser/streamdrivethru/StreamDriveThru.def b/src/filters/parser/streamdrivethru/StreamDriveThru.def
new file mode 100644
index 000000000..5e898f10a
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/StreamDriveThru.def
@@ -0,0 +1,7 @@
+LIBRARY "StreamDriveThru.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/parser/streamdrivethru/StreamDriveThru.h b/src/filters/parser/streamdrivethru/StreamDriveThru.h
new file mode 100644
index 000000000..9c5c36be8
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/StreamDriveThru.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include "..\..\..\DSUtil\DSUtil.h"
+
+
+class CStreamDriveThruInputPin : public CBasePin
+{
+ CComQIPtr<IAsyncReader> m_pAsyncReader;
+
+public:
+ CStreamDriveThruInputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CStreamDriveThruInputPin();
+
+ HRESULT GetAsyncReader(IAsyncReader** ppAsyncReader);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pPin);
+
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
+};
+
+class CStreamDriveThruOutputPin : public CBaseOutputPin
+{
+ CComQIPtr<IStream> m_pStream;
+
+public:
+ CStreamDriveThruOutputPin(TCHAR* pName, CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+ virtual ~CStreamDriveThruOutputPin();
+
+ HRESULT GetStream(IStream** ppStream);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pPin);
+
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+};
+
+[uuid("534FE6FD-F1F0-4aec-9F45-FF397320CE33")]
+class CStreamDriveThruFilter : public CBaseFilter, protected CAMThread, public IMediaSeeking
+{
+ CCritSec m_csLock;
+
+ CStreamDriveThruInputPin* m_pInput;
+ CStreamDriveThruOutputPin* m_pOutput;
+
+protected:
+ enum {CMD_EXIT, CMD_STOP, CMD_PAUSE, CMD_RUN};
+ DWORD ThreadProc();
+
+ LONGLONG m_position;
+
+public:
+ CStreamDriveThruFilter(LPUNKNOWN pUnk, HRESULT* phr);
+ virtual ~CStreamDriveThruFilter();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+
+ STDMETHODIMP Stop();
+ STDMETHODIMP Pause();
+ STDMETHODIMP Run(REFERENCE_TIME tStart);
+
+ // IMediaSeeking
+
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD dwCurrentFlags, LONGLONG* pStop, DWORD dwStopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+};
+
diff --git a/src/filters/parser/streamdrivethru/resource.h b/src/filters/parser/streamdrivethru/resource.h
new file mode 100644
index 000000000..16eef629e
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by streamdrivethru.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/parser/streamdrivethru/stdafx.cpp b/src/filters/parser/streamdrivethru/stdafx.cpp
new file mode 100644
index 000000000..6915aebce
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// streamdrivethru.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/parser/streamdrivethru/stdafx.h b/src/filters/parser/streamdrivethru/stdafx.h
new file mode 100644
index 000000000..30c5835b5
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
diff --git a/src/filters/parser/streamdrivethru/streamdrivethru.rc b/src/filters/parser/streamdrivethru/streamdrivethru.rc
new file mode 100644
index 000000000..a73fda7b4
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/streamdrivethru.rc
@@ -0,0 +1,114 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "StreamDriverThru Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "StreamDriverThru.ax"
+ VALUE "ProductName", "StreamDriverThru Filter"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/parser/streamdrivethru/streamdrivethru.sln b/src/filters/parser/streamdrivethru/streamdrivethru.sln
new file mode 100644
index 000000000..e633f0a14
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/streamdrivethru.sln
@@ -0,0 +1,60 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "streamdrivethru", "streamdrivethru.vcproj", "{AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug.ActiveCfg = Debug|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug.Build.0 = Debug|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug lib.ActiveCfg = Debug lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug lib.Build.0 = Debug lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release.ActiveCfg = Release|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release.Build.0 = Release|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release lib.ActiveCfg = Release lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release lib.Build.0 = Release lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode.Build.0 = Release Unicode|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/parser/streamdrivethru/streamdrivethru.vcproj b/src/filters/parser/streamdrivethru/streamdrivethru.vcproj
new file mode 100644
index 000000000..00ca43335
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/streamdrivethru.vcproj
@@ -0,0 +1,541 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="streamdrivethru"
+ ProjectGUID="{AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="dsutilD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="dsutilR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="dsutilDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="dsutilRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="StreamDriveThru.cpp">
+ </File>
+ <File
+ RelativePath="StreamDriveThru.def">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="StreamDriveThru.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\streamdrivethru.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/streamdrivethru/streamdrivethru_vs2005.vcproj b/src/filters/parser/streamdrivethru/streamdrivethru_vs2005.vcproj
new file mode 100644
index 000000000..30452bb49
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/streamdrivethru_vs2005.vcproj
@@ -0,0 +1,794 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="streamdrivethru"
+ ProjectGUID="{AE399B7E-2B2C-4A96-9016-C5C74B0A2FA0}"
+ RootNamespace="streamdrivethru"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="dsutilD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="dsutilR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="dsutilDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="dsutilRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="StreamDriveThru.cpp"
+ >
+ </File>
+ <File
+ RelativePath="StreamDriveThru.def"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath="StreamDriveThru.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\streamdrivethru.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/parser/streamdrivethru/streamdrivethru_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/parser/streamdrivethru/streamdrivethru_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..56517eb75
--- /dev/null
+++ b/src/filters/parser/streamdrivethru/streamdrivethru_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/reader/asyncreader/asyncio.cpp b/src/filters/reader/asyncreader/asyncio.cpp
new file mode 100644
index 000000000..9428dd052
--- /dev/null
+++ b/src/filters/reader/asyncreader/asyncio.cpp
@@ -0,0 +1,644 @@
+//------------------------------------------------------------------------------
+// File: AsyncIo.cpp
+//
+// Desc: DirectShow sample code - base library with I/O functionality.
+//
+// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
+//------------------------------------------------------------------------------
+
+
+#include "stdafx.h"
+#include "asyncio.h"
+
+// --- CAsyncRequest ---
+
+
+// implementation of CAsyncRequest representing a single
+// outstanding request. All the i/o for this object is done
+// in the Complete method.
+
+
+// init the params for this request.
+// Read is not issued until the complete call
+HRESULT
+CAsyncRequest::Request(
+ CAsyncIo *pIo,
+ CAsyncStream *pStream,
+ LONGLONG llPos,
+ LONG lLength,
+ BOOL bAligned,
+ BYTE* pBuffer,
+ LPVOID pContext, // filter's context
+ DWORD dwUser) // downstream filter's context
+{
+ m_pIo = pIo;
+ m_pStream = pStream;
+ m_llPos = llPos;
+ m_lLength = lLength;
+ m_bAligned = bAligned;
+ m_pBuffer = pBuffer;
+ m_pContext = pContext;
+ m_dwUser = dwUser;
+ m_hr = VFW_E_TIMEOUT; // not done yet
+
+ return S_OK;
+}
+
+
+// issue the i/o if not overlapped, and block until i/o complete.
+// returns error code of file i/o
+//
+//
+HRESULT
+CAsyncRequest::Complete()
+{
+ m_pStream->Lock();
+
+ m_hr = m_pStream->SetPointer(m_llPos);
+ if (S_OK == m_hr) {
+
+ DWORD dwActual;
+
+ m_hr = m_pStream->Read(m_pBuffer, m_lLength, m_bAligned, &dwActual);
+ if (m_hr == OLE_S_FIRST) {
+ if (m_pContext) {
+ IMediaSample *pSample = reinterpret_cast<IMediaSample *>(m_pContext);
+ pSample->SetDiscontinuity(TRUE);
+ m_hr = S_OK;
+ }
+ }
+
+ if (FAILED(m_hr)) {
+ } else if (dwActual != (DWORD)m_lLength) {
+ // tell caller size changed - probably because of EOF
+ m_lLength = (LONG) dwActual;
+ m_hr = S_FALSE;
+ } else {
+ m_hr = S_OK;
+ }
+ }
+
+ m_pStream->Unlock();
+ return m_hr;
+}
+
+
+
+// --- CAsyncIo ---
+
+// note - all events created manual reset
+
+CAsyncIo::CAsyncIo(CAsyncStream *pStream)
+ : m_hThread(NULL),
+ m_evWork(TRUE),
+ m_evDone(TRUE),
+ m_evStop(TRUE),
+ m_listWork(NAME("Work list")),
+ m_listDone(NAME("Done list")),
+ m_bFlushing(FALSE),
+ m_cItemsOut(0),
+ m_bWaiting(FALSE),
+ m_pStream(pStream)
+{
+
+}
+
+
+CAsyncIo::~CAsyncIo()
+{
+ // move everything to the done list
+ BeginFlush();
+
+ // shutdown worker thread
+ CloseThread();
+
+ // empty the done list
+ POSITION pos = m_listDone.GetHeadPosition();
+ while (pos) {
+ CAsyncRequest* pRequest = m_listDone.GetNext(pos);
+ delete pRequest;
+ }
+ m_listDone.RemoveAll();
+}
+
+// ready for async activity - call this before calling Request.
+//
+// start the worker thread if we need to
+//
+// !!! use overlapped i/o if possible
+HRESULT
+CAsyncIo::AsyncActive(void)
+{
+ return StartThread();
+}
+
+// call this when no more async activity will happen before
+// the next AsyncActive call
+//
+// stop the worker thread if active
+HRESULT
+CAsyncIo::AsyncInactive(void)
+{
+ return CloseThread();
+}
+
+
+// add a request to the queue.
+HRESULT
+CAsyncIo::Request(
+ LONGLONG llPos,
+ LONG lLength,
+ BOOL bAligned,
+ BYTE* pBuffer,
+ LPVOID pContext,
+ DWORD dwUser)
+{
+ if (bAligned) {
+ if (!IsAligned(llPos) ||
+ !IsAligned(lLength) ||
+ !IsAligned((LONG) pBuffer)) {
+ return VFW_E_BADALIGN;
+ }
+ }
+
+ CAsyncRequest* pRequest = new CAsyncRequest;
+
+ HRESULT hr = pRequest->Request(
+ this,
+ m_pStream,
+ llPos,
+ lLength,
+ bAligned,
+ pBuffer,
+ pContext,
+ dwUser);
+ if (SUCCEEDED(hr)) {
+ // might fail if flushing
+ hr = PutWorkItem(pRequest);
+ }
+
+ if (FAILED(hr)) {
+ delete pRequest;
+ }
+ return hr;
+}
+
+
+// wait for the next request to complete
+HRESULT
+CAsyncIo::WaitForNext(
+ DWORD dwTimeout,
+ LPVOID *ppContext,
+ DWORD * pdwUser,
+ LONG* pcbActual)
+{
+ // some errors find a sample, others don't. Ensure that
+ // *ppContext is NULL if no sample found
+ *ppContext = NULL;
+
+ // wait until the event is set, but since we are not
+ // holding the critsec when waiting, we may need to re-wait
+ for (;;) {
+
+ if (!m_evDone.Wait(dwTimeout)) {
+ // timeout occurred
+ return VFW_E_TIMEOUT;
+ }
+
+ // get next event from list
+ CAsyncRequest* pRequest = GetDoneItem();
+ if (pRequest) {
+ // found a completed request
+
+ // check if ok
+ HRESULT hr = pRequest->GetHResult();
+ if (hr == S_FALSE) {
+
+ // this means the actual length was less than
+ // requested - may be ok if he aligned the end of file
+ if ((pRequest->GetActualLength() +
+ pRequest->GetStart()) == Size()) {
+ hr = S_OK;
+ } else {
+ // it was an actual read error
+ hr = E_FAIL;
+ }
+ }
+
+ // return actual bytes read
+ *pcbActual = pRequest->GetActualLength();
+
+ // return his context
+ *ppContext = pRequest->GetContext();
+ *pdwUser = pRequest->GetUser();
+
+ delete pRequest;
+ return hr;
+ } else {
+ // Hold the critical section while checking the list state
+ CAutoLock lck(&m_csLists);
+ if (m_bFlushing && !m_bWaiting) {
+
+ // can't block as we are between BeginFlush and EndFlush
+
+ // but note that if m_bWaiting is set, then there are some
+ // items not yet complete that we should block for.
+
+ return VFW_E_WRONG_STATE;
+ }
+ }
+
+ // done item was grabbed between completion and
+ // us locking m_csLists.
+ }
+}
+
+// perform a synchronous read request on this thread.
+// Need to hold m_csFile while doing this (done in request object)
+HRESULT
+CAsyncIo::SyncReadAligned(
+ LONGLONG llPos,
+ LONG lLength,
+ BYTE* pBuffer,
+ LONG* pcbActual,
+ PVOID pvContext
+ )
+{
+ if (!IsAligned(llPos) ||
+ !IsAligned(lLength) ||
+ !IsAligned((LONG) pBuffer)) {
+ return VFW_E_BADALIGN;
+ }
+
+ CAsyncRequest request;
+
+ HRESULT hr = request.Request(
+ this,
+ m_pStream,
+ llPos,
+ lLength,
+ TRUE,
+ pBuffer,
+ pvContext,
+ 0);
+
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ hr = request.Complete();
+
+ // return actual data length
+ *pcbActual = request.GetActualLength();
+ return hr;
+}
+
+HRESULT
+CAsyncIo::Length(LONGLONG *pllTotal, LONGLONG* pllAvailable)
+{
+ *pllTotal = m_pStream->Size(pllAvailable);
+ return S_OK;
+}
+
+// cancel all items on the worklist onto the done list
+// and refuse further requests or further WaitForNext calls
+// until the end flush
+//
+// WaitForNext must return with NULL only if there are no successful requests.
+// So Flush does the following:
+// 1. set m_bFlushing ensures no more requests succeed
+// 2. move all items from work list to the done list.
+// 3. If there are any outstanding requests, then we need to release the
+// critsec to allow them to complete. The m_bWaiting as well as ensuring
+// that we are signalled when they are all done is also used to indicate
+// to WaitForNext that it should continue to block.
+// 4. Once all outstanding requests are complete, we force m_evDone set and
+// m_bFlushing set and m_bWaiting false. This ensures that WaitForNext will
+// not block when the done list is empty.
+HRESULT
+CAsyncIo::BeginFlush()
+{
+ // hold the lock while emptying the work list
+ {
+ CAutoLock lock(&m_csLists);
+
+ // prevent further requests being queued.
+ // Also WaitForNext will refuse to block if this is set
+ // unless m_bWaiting is also set which it will be when we release
+ // the critsec if there are any outstanding).
+ m_bFlushing = TRUE;
+
+ CAsyncRequest * preq;
+ while((preq = GetWorkItem()) != 0) {
+ preq->Cancel();
+ PutDoneItem(preq);
+ }
+
+ // now wait for any outstanding requests to complete
+ if (m_cItemsOut > 0) {
+
+ // can be only one person waiting
+ ASSERT(!m_bWaiting);
+
+ // this tells the completion routine that we need to be
+ // signalled via m_evAllDone when all outstanding items are
+ // done. It also tells WaitForNext to continue blocking.
+ m_bWaiting = TRUE;
+ } else {
+ // all done
+
+ // force m_evDone set so that even if list is empty,
+ // WaitForNext will not block
+ // don't do this until we are sure that all
+ // requests are on the done list.
+ m_evDone.Set();
+ return S_OK;
+ }
+ }
+
+ ASSERT(m_bWaiting);
+
+ // wait without holding critsec
+ for (;;) {
+ m_evAllDone.Wait();
+ {
+ // hold critsec to check
+ CAutoLock lock(&m_csLists);
+
+ if (m_cItemsOut == 0) {
+
+ // now we are sure that all outstanding requests are on
+ // the done list and no more will be accepted
+ m_bWaiting = FALSE;
+
+ // force m_evDone set so that even if list is empty,
+ // WaitForNext will not block
+ // don't do this until we are sure that all
+ // requests are on the done list.
+ m_evDone.Set();
+
+ return S_OK;
+ }
+ }
+ }
+}
+
+// end a flushing state
+HRESULT
+CAsyncIo::EndFlush()
+{
+ CAutoLock lock(&m_csLists);
+
+ m_bFlushing = FALSE;
+
+ ASSERT(!m_bWaiting);
+
+ // m_evDone might have been set by BeginFlush - ensure it is
+ // set IFF m_listDone is non-empty
+ if (m_listDone.GetCount() > 0) {
+ m_evDone.Set();
+ } else {
+ m_evDone.Reset();
+ }
+
+ return S_OK;
+}
+
+// start the thread
+HRESULT
+CAsyncIo::StartThread(void)
+{
+ if (m_hThread) {
+ return S_OK;
+ }
+
+ // clear the stop event before starting
+ m_evStop.Reset();
+
+ DWORD dwThreadID;
+ m_hThread = CreateThread(
+ NULL,
+ 0,
+ InitialThreadProc,
+ this,
+ 0,
+ &dwThreadID);
+ if (!m_hThread) {
+ DWORD dwErr = GetLastError();
+ return HRESULT_FROM_WIN32(dwErr);
+ }
+ return S_OK;
+}
+
+// stop the thread and close the handle
+HRESULT
+CAsyncIo::CloseThread(void)
+{
+ // signal the thread-exit object
+ m_evStop.Set();
+
+ if (m_hThread) {
+
+ WaitForSingleObject(m_hThread, INFINITE);
+ CloseHandle(m_hThread);
+ m_hThread = NULL;
+ }
+ return S_OK;
+}
+
+
+// manage the list of requests. hold m_csLists and ensure
+// that the (manual reset) event hevList is set when things on
+// the list but reset when the list is empty.
+// returns null if list empty
+CAsyncRequest*
+CAsyncIo::GetWorkItem()
+{
+ CAutoLock lck(&m_csLists);
+
+ CAsyncRequest * preq = m_listWork.RemoveHead();
+
+ // force event set correctly
+ if (m_listWork.GetCount() == 0) {
+ m_evWork.Reset();
+ }
+ return preq;
+}
+
+// get an item from the done list
+CAsyncRequest*
+CAsyncIo::GetDoneItem()
+{
+ CAutoLock lock(&m_csLists);
+
+ CAsyncRequest * preq = m_listDone.RemoveHead();
+
+ // force event set correctly if list now empty
+ // or we're in the final stages of flushing
+ // Note that during flushing the way it's supposed to work is that
+ // everything is shoved on the Done list then the application is
+ // supposed to pull until it gets nothing more
+ //
+ // Thus we should not set m_evDone unconditionally until everything
+ // has moved to the done list which means we must wait until
+ // cItemsOut is 0 (which is guaranteed by m_bWaiting being TRUE).
+
+ if (m_listDone.GetCount() == 0 &&
+ (!m_bFlushing || m_bWaiting)) {
+ m_evDone.Reset();
+ }
+
+ return preq;
+}
+
+// put an item on the work list - fail if bFlushing
+HRESULT
+CAsyncIo::PutWorkItem(CAsyncRequest* pRequest)
+{
+ CAutoLock lock(&m_csLists);
+ HRESULT hr;
+
+ if (m_bFlushing) {
+ hr = VFW_E_WRONG_STATE;
+ }
+ else if (m_listWork.AddTail(pRequest)) {
+
+ // event should now be in a set state - force this
+ m_evWork.Set();
+
+ // start the thread now if not already started
+ hr = StartThread();
+
+ } else {
+ hr = E_OUTOFMEMORY;
+ }
+
+ return(hr);
+}
+
+// put an item on the done list - ok to do this when
+// flushing
+HRESULT
+CAsyncIo::PutDoneItem(CAsyncRequest* pRequest)
+{
+ ASSERT(CritCheckIn(&m_csLists));
+
+ if (m_listDone.AddTail(pRequest)) {
+
+ // event should now be in a set state - force this
+ m_evDone.Set();
+ return S_OK;
+ } else {
+ return E_OUTOFMEMORY;
+ }
+}
+
+// called on thread to process any active requests
+void
+CAsyncIo::ProcessRequests(void)
+{
+ // lock to get the item and increment the outstanding count
+ CAsyncRequest * preq = NULL;
+ for (;;) {
+ {
+ CAutoLock lock(&m_csLists);
+
+ preq = GetWorkItem();
+ if (preq == NULL) {
+ // done
+ return;
+ }
+
+ // one more item not on the done or work list
+ m_cItemsOut++;
+
+ // release critsec
+ }
+
+ preq->Complete();
+
+ // regain critsec to replace on done list
+ {
+ CAutoLock l(&m_csLists);
+
+ PutDoneItem(preq);
+
+ if (--m_cItemsOut == 0) {
+ if (m_bWaiting) {
+ m_evAllDone.Set();
+ }
+ }
+ }
+ }
+}
+
+// the thread proc - assumes that DWORD thread param is the
+// this pointer
+DWORD
+CAsyncIo::ThreadProc(void)
+{
+ HANDLE ahev[] = {m_evStop, m_evWork};
+
+ for (;;) {
+ DWORD dw = WaitForMultipleObjects(
+ 2,
+ ahev,
+ FALSE,
+ INFINITE);
+ if (dw == WAIT_OBJECT_0+1) {
+
+ // requests need processing
+ ProcessRequests();
+ } else {
+ // any error or stop event - we should exit
+ return 0;
+ }
+ }
+}
+
+
+
+// perform a synchronous read request on this thread.
+// may not be aligned - so we will have to buffer.
+HRESULT
+CAsyncIo::SyncRead(
+ LONGLONG llPos,
+ LONG lLength,
+ BYTE* pBuffer)
+{
+ if (IsAligned(llPos) &&
+ IsAligned(lLength) &&
+ IsAligned((LONG) pBuffer)) {
+ LONG cbUnused;
+ return SyncReadAligned(llPos, lLength, pBuffer, &cbUnused, NULL);
+ }
+
+ // not aligned with requirements - use buffered file handle.
+ //!!! might want to fix this to buffer the data ourselves?
+
+ CAsyncRequest request;
+
+ HRESULT hr = request.Request(
+ this,
+ m_pStream,
+ llPos,
+ lLength,
+ FALSE,
+ pBuffer,
+ NULL,
+ 0);
+
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ return request.Complete();
+}
+
+// Return the alignment
+HRESULT
+CAsyncIo::Alignment(LONG *pl)
+{
+ *pl = Alignment();
+ return S_OK;
+}
diff --git a/src/filters/reader/asyncreader/asyncio.h b/src/filters/reader/asyncreader/asyncio.h
new file mode 100644
index 000000000..590eb9167
--- /dev/null
+++ b/src/filters/reader/asyncreader/asyncio.h
@@ -0,0 +1,267 @@
+//------------------------------------------------------------------------------
+// File: AsyncIo.h
+//
+// Desc: DirectShow sample code - base library for I/O functionality.
+//
+// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
+//------------------------------------------------------------------------------
+
+#pragma once
+
+//
+// definition of CAsyncFile object that performs file access. It provides
+// asynchronous, unbuffered, aligned reads from a file, using a worker thread
+// on win95 and potentially overlapped i/o if available.
+
+// !!! Need to use real overlapped i/o if available
+// currently only uses worker thread, not overlapped i/o
+
+class CAsyncIo;
+class CAsyncStream;
+
+//
+// Model the stream we read from based on a file-like interface
+//
+class CAsyncStream
+{
+public:
+ virtual ~CAsyncStream() {};
+ virtual HRESULT SetPointer(LONGLONG llPos) = 0;
+ virtual HRESULT Read(PBYTE pbBuffer,
+ DWORD dwBytesToRead,
+ BOOL bAlign,
+ LPDWORD pdwBytesRead) = 0;
+ virtual LONGLONG Size(LONGLONG *pSizeAvailable = NULL) = 0;
+ virtual DWORD Alignment() = 0;
+ virtual void Lock() = 0;
+ virtual void Unlock() = 0;
+ //virtual void SetStopHandle(HANDLE hevStop) {}
+};
+
+// represents a single request and performs the i/o. Can be called on either
+// worker thread or app thread, but must hold pcsFile across file accesses.
+// (ie across SetFilePointer/ReadFile pairs)
+class CAsyncRequest
+{
+ CAsyncIo *m_pIo;
+ CAsyncStream *m_pStream;
+ LONGLONG m_llPos;
+ BOOL m_bAligned;
+ LONG m_lLength;
+ BYTE* m_pBuffer;
+ LPVOID m_pContext;
+ DWORD m_dwUser;
+ HRESULT m_hr;
+
+public:
+ // init the params for this request. Issue the i/o
+ // if overlapped i/o is possible.
+ HRESULT Request(
+ CAsyncIo *pIo,
+ CAsyncStream *pStream,
+ LONGLONG llPos,
+ LONG lLength,
+ BOOL bAligned,
+ BYTE* pBuffer,
+ LPVOID pContext, // filter's context
+ DWORD dwUser); // downstream filter's context
+
+ // issue the i/o if not overlapped, and block until i/o complete.
+ // returns error code of file i/o
+ HRESULT Complete();
+
+ // cancels the i/o. blocks until i/o is no longer pending
+ HRESULT Cancel()
+ {
+ return S_OK;
+ };
+
+ // accessor functions
+ LPVOID GetContext()
+ {
+ return m_pContext;
+ };
+
+ DWORD GetUser()
+ {
+ return m_dwUser;
+ };
+
+ HRESULT GetHResult() {
+ return m_hr;
+ };
+
+ // we set m_lLength to the actual length
+ LONG GetActualLength() {
+ return m_lLength;
+ };
+
+ LONGLONG GetStart() {
+ return m_llPos;
+ };
+};
+
+
+typedef CGenericList<CAsyncRequest> CRequestList;
+
+// this class needs a worker thread, but the ones defined in classes\base
+// are not suitable (they assume you have one message sent or posted per
+// request, whereas here for efficiency we want just to set an event when
+// there is work on the queue).
+//
+// we create CAsyncRequest objects and queue them on m_listWork. The worker
+// thread pulls them off, completes them and puts them on m_listDone.
+// The events m_evWork and m_evDone are set when the corresponding lists are
+// not empty.
+//
+// Synchronous requests are done on the caller thread. These should be
+// synchronised by the caller, but to make sure we hold m_csFile across
+// the SetFilePointer/ReadFile code.
+//
+// Flush by calling BeginFlush. This rejects all further requests (by
+// setting m_bFlushing within m_csLists), cancels all requests and moves them
+// to the done list, and sets m_evDone to ensure that no WaitForNext operations
+// will block. Call EndFlush to cancel this state.
+//
+// we support unaligned calls to SyncRead. This is done by opening the file
+// twice if we are using unbuffered i/o (m_dwAlign > 1).
+// !!!fix this to buffer on top of existing file handle?
+class CAsyncIo
+{
+
+ CCritSec m_csReader;
+ CAsyncStream *m_pStream;
+
+ CCritSec m_csLists; // locks access to the list and events
+ BOOL m_bFlushing; // true if between BeginFlush/EndFlush
+ CRequestList m_listWork;
+ CRequestList m_listDone;
+ CAMEvent m_evWork; // set when list is not empty
+ CAMEvent m_evDone;
+
+ // for correct flush behaviour: all protected by m_csLists
+ LONG m_cItemsOut; // nr of items not on listDone or listWork
+ BOOL m_bWaiting; // TRUE if someone waiting for m_evAllDone
+ CAMEvent m_evAllDone; // signal when m_cItemsOut goes to 0 if m_cWaiting
+
+
+ CAMEvent m_evStop; // set when thread should exit
+ HANDLE m_hThread;
+
+ LONGLONG Size() {
+ ASSERT(m_pStream != NULL);
+ return m_pStream->Size();
+ };
+
+ // start the thread
+ HRESULT StartThread(void);
+
+ // stop the thread and close the handle
+ HRESULT CloseThread(void);
+
+ // manage the list of requests. hold m_csLists and ensure
+ // that the (manual reset) event hevList is set when things on
+ // the list but reset when the list is empty.
+ // returns null if list empty
+ CAsyncRequest* GetWorkItem();
+
+ // get an item from the done list
+ CAsyncRequest* GetDoneItem();
+
+ // put an item on the work list
+ HRESULT PutWorkItem(CAsyncRequest* pRequest);
+
+ // put an item on the done list
+ HRESULT PutDoneItem(CAsyncRequest* pRequest);
+
+ // called on thread to process any active requests
+ void ProcessRequests(void);
+
+ // initial static thread proc calls ThreadProc with DWORD
+ // param as this
+ static DWORD WINAPI InitialThreadProc(LPVOID pv) {
+ CAsyncIo * pThis = (CAsyncIo*) pv;
+ return pThis->ThreadProc();
+ };
+
+ DWORD ThreadProc(void);
+
+public:
+
+ CAsyncIo(CAsyncStream *pStream);
+ ~CAsyncIo();
+
+ // open the file
+ HRESULT Open(LPCTSTR pName);
+
+ // ready for async activity - call this before
+ // calling Request
+ HRESULT AsyncActive(void);
+
+ // call this when no more async activity will happen before
+ // the next AsyncActive call
+ HRESULT AsyncInactive(void);
+
+ // queue a requested read. must be aligned.
+ HRESULT Request(
+ LONGLONG llPos,
+ LONG lLength,
+ BOOL bAligned,
+ BYTE* pBuffer,
+ LPVOID pContext,
+ DWORD dwUser);
+
+ // wait for the next read to complete
+ HRESULT WaitForNext(
+ DWORD dwTimeout,
+ LPVOID *ppContext,
+ DWORD * pdwUser,
+ LONG * pcbActual
+ );
+
+ // perform a read of an already aligned buffer
+ HRESULT SyncReadAligned(
+ LONGLONG llPos,
+ LONG lLength,
+ BYTE* pBuffer,
+ LONG* pcbActual,
+ PVOID pvContext
+ );
+
+ // perform a synchronous read. will be buffered
+ // if not aligned.
+ HRESULT SyncRead(
+ LONGLONG llPos,
+ LONG lLength,
+ BYTE* pBuffer);
+
+ // return length
+ HRESULT Length(LONGLONG *pllTotal, LONGLONG* pllAvailable);
+
+ // all Reader positions, read lengths and memory locations must
+ // be aligned to this.
+ HRESULT Alignment(LONG* pl);
+
+ HRESULT BeginFlush();
+ HRESULT EndFlush();
+
+ LONG Alignment()
+ {
+ return m_pStream->Alignment();
+ };
+
+ BOOL IsAligned(LONG l) {
+ if ((l & (Alignment() -1)) == 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ };
+
+ BOOL IsAligned(LONGLONG ll) {
+ return IsAligned( (LONG) (ll & 0xffffffff));
+ };
+
+ // Accessor
+ HANDLE StopEvent() const { return m_evDone; }
+};
diff --git a/src/filters/reader/asyncreader/asyncrdr.cpp b/src/filters/reader/asyncreader/asyncrdr.cpp
new file mode 100644
index 000000000..f289a95d5
--- /dev/null
+++ b/src/filters/reader/asyncreader/asyncrdr.cpp
@@ -0,0 +1,407 @@
+//------------------------------------------------------------------------------
+// File: AsyncRdr.cpp
+//
+// Desc: DirectShow sample code - base library with I/O functionality.
+// This file implements I/O source filter methods and output pin
+// methods for CAsyncReader and CAsyncOutputPin.
+//
+// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
+//------------------------------------------------------------------------------
+
+
+#include "stdafx.h"
+#include "asyncio.h"
+#include "asyncrdr.h"
+
+// --- CAsyncOutputPin implementation ---
+
+CAsyncOutputPin::CAsyncOutputPin(
+ HRESULT * phr,
+ CAsyncReader *pReader,
+ CAsyncIo *pIo,
+ CCritSec * pLock)
+ : CBasePin(
+ NAME("Async output pin"),
+ pReader,
+ pLock,
+ phr,
+ L"Output",
+ PINDIR_OUTPUT),
+ m_pReader(pReader),
+ m_pIo(pIo)
+{
+}
+
+CAsyncOutputPin::~CAsyncOutputPin()
+{
+}
+
+STDMETHODIMP
+CAsyncOutputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv,E_POINTER);
+
+ if (riid == IID_IAsyncReader) {
+ m_bQueriedForAsyncReader = TRUE;
+ return GetInterface((IAsyncReader*) this, ppv);
+ } else {
+ return CBasePin::NonDelegatingQueryInterface(riid, ppv);
+ }
+}
+
+HRESULT
+CAsyncOutputPin::GetMediaType(int iPosition, CMediaType *pMediaType)
+{
+ if (iPosition < 0) {
+ return E_INVALIDARG;
+ }
+ if (iPosition > 0) {
+ return VFW_S_NO_MORE_ITEMS;
+ }
+
+ *pMediaType = *m_pReader->LoadType();
+ return S_OK;
+}
+
+HRESULT
+CAsyncOutputPin::CheckMediaType(const CMediaType* pType)
+{
+ CAutoLock lck(m_pLock);
+
+ /* We treat MEDIASUBTYPE_NULL subtype as a wild card */
+ if ((m_pReader->LoadType()->majortype == pType->majortype) &&
+ (m_pReader->LoadType()->subtype == MEDIASUBTYPE_NULL ||
+ m_pReader->LoadType()->subtype == pType->subtype)) {
+ return S_OK;
+ }
+ return S_FALSE;
+}
+
+HRESULT
+CAsyncOutputPin::InitAllocator(IMemAllocator **ppAlloc)
+{
+ HRESULT hr = NOERROR;
+ *ppAlloc = NULL;
+ CMemAllocator *pMemObject = NULL;
+
+ /* Create a default memory allocator */
+ pMemObject = new CMemAllocator(NAME("Base memory allocator"),NULL, &hr);
+ if (pMemObject == NULL) {
+ return E_OUTOFMEMORY;
+ }
+
+ if (FAILED(hr)) {
+ delete pMemObject;
+ return hr;
+ }
+
+ /* Get a reference counted IID_IMemAllocator interface */
+ hr = pMemObject->QueryInterface(IID_IMemAllocator,(void **)ppAlloc);
+ if (FAILED(hr)) {
+ delete pMemObject;
+ return E_NOINTERFACE;
+ }
+
+ ASSERT(*ppAlloc != NULL);
+ return NOERROR;
+}
+
+// we need to return an addrefed allocator, even if it is the preferred
+// one, since he doesn't know whether it is the preferred one or not.
+STDMETHODIMP
+CAsyncOutputPin::RequestAllocator(
+ IMemAllocator* pPreferred,
+ ALLOCATOR_PROPERTIES* pProps,
+ IMemAllocator ** ppActual)
+{
+ // we care about alignment but nothing else
+ if (!pProps->cbAlign || !m_pIo->IsAligned(pProps->cbAlign)) {
+ m_pIo->Alignment(&pProps->cbAlign);
+ }
+
+ ALLOCATOR_PROPERTIES Actual;
+ HRESULT hr;
+
+ if (pPreferred) {
+ hr = pPreferred->SetProperties(pProps, &Actual);
+ if (SUCCEEDED(hr) && m_pIo->IsAligned(Actual.cbAlign)) {
+ pPreferred->AddRef();
+ *ppActual = pPreferred;
+ return S_OK;
+ }
+ }
+
+ // create our own allocator
+ IMemAllocator* pAlloc;
+ hr = InitAllocator(&pAlloc);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ //...and see if we can make it suitable
+ hr = pAlloc->SetProperties(pProps, &Actual);
+ if (SUCCEEDED(hr) && m_pIo->IsAligned(Actual.cbAlign)) {
+ // we need to release our refcount on pAlloc, and addref
+ // it to pass a refcount to the caller - this is a net nothing.
+ *ppActual = pAlloc;
+ return S_OK;
+ }
+
+ // failed to find a suitable allocator
+ pAlloc->Release();
+
+ // if we failed because of the IsAligned test, the error code will
+ // not be failure
+ if (SUCCEEDED(hr)) {
+ hr = VFW_E_BADALIGN;
+ }
+ return hr;
+}
+
+
+// queue an aligned read request. call WaitForNext to get
+// completion.
+STDMETHODIMP
+CAsyncOutputPin::Request(
+ IMediaSample* pSample,
+ DWORD dwUser) // user context
+{
+ REFERENCE_TIME tStart, tStop;
+ HRESULT hr = pSample->GetTime(&tStart, &tStop);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ LONGLONG llPos = tStart / UNITS;
+ LONG lLength = (LONG) ((tStop - tStart) / UNITS);
+ LONGLONG llTotal;
+ LONGLONG llAvailable;
+
+ hr = m_pIo->Length(&llTotal, &llAvailable);
+ if (llPos + lLength > llTotal) {
+
+ // the end needs to be aligned, but may have been aligned
+ // on a coarser alignment.
+ LONG lAlign;
+ m_pIo->Alignment(&lAlign);
+ llTotal = (llTotal + lAlign -1) & ~(lAlign-1);
+
+ if (llPos + lLength > llTotal) {
+ lLength = (LONG) (llTotal - llPos);
+
+ // must be reducing this!
+ ASSERT((llTotal * UNITS) <= tStop);
+ tStop = llTotal * UNITS;
+ pSample->SetTime(&tStart, &tStop);
+ }
+ }
+
+
+ BYTE* pBuffer;
+ hr = pSample->GetPointer(&pBuffer);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ return m_pIo->Request(
+ llPos,
+ lLength,
+ TRUE,
+ pBuffer,
+ (LPVOID)pSample,
+ dwUser);
+}
+
+// sync-aligned request. just like a request/waitfornext pair.
+STDMETHODIMP
+CAsyncOutputPin::SyncReadAligned(
+ IMediaSample* pSample)
+{
+ REFERENCE_TIME tStart, tStop;
+ HRESULT hr = pSample->GetTime(&tStart, &tStop);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ LONGLONG llPos = tStart / UNITS;
+ LONG lLength = (LONG) ((tStop - tStart) / UNITS);
+ LONGLONG llTotal;
+ LONGLONG llAvailable;
+
+ hr = m_pIo->Length(&llTotal, &llAvailable);
+ if (llPos + lLength > llTotal) {
+
+ // the end needs to be aligned, but may have been aligned
+ // on a coarser alignment.
+ LONG lAlign;
+ m_pIo->Alignment(&lAlign);
+ llTotal = (llTotal + lAlign -1) & ~(lAlign-1);
+
+ if (llPos + lLength > llTotal) {
+ lLength = (LONG) (llTotal - llPos);
+
+ // must be reducing this!
+ ASSERT((llTotal * UNITS) <= tStop);
+ tStop = llTotal * UNITS;
+ pSample->SetTime(&tStart, &tStop);
+ }
+ }
+
+
+ BYTE* pBuffer;
+ hr = pSample->GetPointer(&pBuffer);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ LONG cbActual;
+ hr = m_pIo->SyncReadAligned(
+ llPos,
+ lLength,
+ pBuffer,
+ &cbActual,
+ pSample
+ );
+
+ pSample->SetActualDataLength(cbActual);
+ return hr;
+}
+
+
+//
+// collect the next ready sample
+STDMETHODIMP
+CAsyncOutputPin::WaitForNext(
+ DWORD dwTimeout,
+ IMediaSample** ppSample, // completed sample
+ DWORD * pdwUser) // user context
+{
+ LONG cbActual;
+ IMediaSample* pSample;
+
+ HRESULT hr = m_pIo->WaitForNext(
+ dwTimeout,
+ (LPVOID*) &pSample,
+ pdwUser,
+ &cbActual
+ );
+
+ if (SUCCEEDED(hr)) {
+ pSample->SetActualDataLength(cbActual);
+ }
+
+ *ppSample = pSample;
+ return hr;
+}
+
+
+//
+// synchronous read that need not be aligned.
+STDMETHODIMP
+CAsyncOutputPin::SyncRead(
+ LONGLONG llPosition, // absolute Io position
+ LONG lLength, // nr bytes required
+ BYTE* pBuffer) // write data here
+{
+ return m_pIo->SyncRead(llPosition, lLength, pBuffer);
+}
+
+// return the length of the file, and the length currently
+// available locally. We only support locally accessible files,
+// so they are always the same
+STDMETHODIMP
+CAsyncOutputPin::Length(
+ LONGLONG* pTotal,
+ LONGLONG* pAvailable)
+{
+ HRESULT hr = m_pIo->Length(pTotal, pAvailable);
+ return hr;
+}
+
+STDMETHODIMP
+CAsyncOutputPin::BeginFlush(void)
+{
+ return m_pIo->BeginFlush();
+}
+
+STDMETHODIMP
+CAsyncOutputPin::EndFlush(void)
+{
+ return m_pIo->EndFlush();
+}
+
+
+STDMETHODIMP
+CAsyncOutputPin::Connect(
+ IPin * pReceivePin,
+ const AM_MEDIA_TYPE *pmt // optional media type
+)
+{
+ return m_pReader->Connect(pReceivePin, pmt);
+}
+
+
+// --- CAsyncReader implementation ---
+
+#pragma warning(disable:4355)
+
+CAsyncReader::CAsyncReader(
+ TCHAR *pName,
+ LPUNKNOWN pUnk,
+ CAsyncStream *pStream,
+ HRESULT *phr,
+ const CLSID& clsid)
+ : CBaseFilter(
+ pName,
+ pUnk,
+ &m_csFilter,
+ clsid,
+ NULL
+ ),
+ m_OutputPin(
+ phr,
+ this,
+ &m_Io,
+ &m_csFilter),
+ m_Io(pStream)
+{
+}
+
+CAsyncReader::~CAsyncReader()
+{
+}
+
+STDMETHODIMP CAsyncReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ (riid == __uuidof(IAMFilterMiscFlags)) ? GetInterface((IAMFilterMiscFlags*)this, ppv) :
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IAMFilterMiscFlags
+
+ULONG CAsyncReader::GetMiscFlags()
+{
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+}
+
+
+int
+CAsyncReader::GetPinCount()
+{
+ return 1;
+}
+
+CBasePin *
+CAsyncReader::GetPin(int n)
+{
+ if ((GetPinCount() > 0) && (n == 0)) {
+ return &m_OutputPin;
+ } else {
+ return NULL;
+ }
+}
+
+
diff --git a/src/filters/reader/asyncreader/asyncrdr.h b/src/filters/reader/asyncreader/asyncrdr.h
new file mode 100644
index 000000000..5dc8c778e
--- /dev/null
+++ b/src/filters/reader/asyncreader/asyncrdr.h
@@ -0,0 +1,216 @@
+#pragma once
+
+//
+// AsyncRdr
+//
+// Defines an IO source filter.
+//
+// This filter (CAsyncReader) supports IBaseFilter and IFileSourceFilter interfaces from the
+// filter object itself. It has a single output pin (CAsyncOutputPin)
+// which supports IPin and IAsyncReader.
+//
+// This filter is essentially a wrapper for the CAsyncFile class that does
+// all the work.
+//
+
+// the filter class (defined below)
+class CAsyncReader;
+
+
+// the output pin class
+class CAsyncOutputPin
+ : public IAsyncReader,
+ public CBasePin
+{
+protected:
+ CAsyncReader* m_pReader;
+ CAsyncIo * m_pIo;
+
+ // This is set every time we're asked to return an IAsyncReader
+ // interface
+ // This allows us to know if the downstream pin can use
+ // this transport, otherwise we can hook up to thinks like the
+ // dump filter and nothing happens
+ BOOL m_bQueriedForAsyncReader;
+
+ HRESULT InitAllocator(IMemAllocator **ppAlloc);
+
+public:
+ // constructor and destructor
+ CAsyncOutputPin(
+ HRESULT * phr,
+ CAsyncReader *pReader,
+ CAsyncIo *pIo,
+ CCritSec * pLock);
+
+ ~CAsyncOutputPin();
+
+ // --- CUnknown ---
+
+ // need to expose IAsyncReader
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID, void**);
+
+ // --- IPin methods ---
+ STDMETHODIMP Connect(
+ IPin * pReceivePin,
+ const AM_MEDIA_TYPE *pmt // optional media type
+ );
+
+ // --- CBasePin methods ---
+
+ // return the types we prefer - this will return the known
+ // file type
+ HRESULT GetMediaType(int iPosition, CMediaType *pMediaType);
+
+ // can we support this type?
+ HRESULT CheckMediaType(const CMediaType* pType);
+
+ // Clear the flag so we see if IAsyncReader is queried for
+ HRESULT CheckConnect(IPin *pPin)
+ {
+ m_bQueriedForAsyncReader = FALSE;
+ return CBasePin::CheckConnect(pPin);
+ }
+
+ // See if it was asked for
+ HRESULT CompleteConnect(IPin *pReceivePin)
+ {
+ if (m_bQueriedForAsyncReader) {
+ return CBasePin::CompleteConnect(pReceivePin);
+ } else {
+#ifdef VFW_E_NO_TRANSPORT
+ return VFW_E_NO_TRANSPORT;
+#else
+ return E_FAIL;
+#endif
+ }
+ }
+
+ // Remove our connection status
+ HRESULT BreakConnect()
+ {
+ m_bQueriedForAsyncReader = FALSE;
+ return CBasePin::BreakConnect();
+ }
+
+ // --- IAsyncReader methods ---
+ // pass in your preferred allocator and your preferred properties.
+ // method returns the actual allocator to be used. Call GetProperties
+ // on returned allocator to learn alignment and prefix etc chosen.
+ // this allocator will be not be committed and decommitted by
+ // the async reader, only by the consumer.
+ STDMETHODIMP RequestAllocator(
+ IMemAllocator* pPreferred,
+ ALLOCATOR_PROPERTIES* pProps,
+ IMemAllocator ** ppActual);
+
+ // queue a request for data.
+ // media sample start and stop times contain the requested absolute
+ // byte position (start inclusive, stop exclusive).
+ // may fail if sample not obtained from agreed allocator.
+ // may fail if start/stop position does not match agreed alignment.
+ // samples allocated from source pin's allocator may fail
+ // GetPointer until after returning from WaitForNext.
+ STDMETHODIMP Request(
+ IMediaSample* pSample,
+ DWORD dwUser); // user context
+
+ // block until the next sample is completed or the timeout occurs.
+ // timeout (millisecs) may be 0 or INFINITE. Samples may not
+ // be delivered in order. If there is a read error of any sort, a
+ // notification will already have been sent by the source filter,
+ // and STDMETHODIMP will be an error.
+ STDMETHODIMP WaitForNext(
+ DWORD dwTimeout,
+ IMediaSample** ppSample, // completed sample
+ DWORD * pdwUser); // user context
+
+ // sync read of data. Sample passed in must have been acquired from
+ // the agreed allocator. Start and stop position must be aligned.
+ // equivalent to a Request/WaitForNext pair, but may avoid the
+ // need for a thread on the source filter.
+ STDMETHODIMP SyncReadAligned(
+ IMediaSample* pSample);
+
+
+ // sync read. works in stopped state as well as run state.
+ // need not be aligned. Will fail if read is beyond actual total
+ // length.
+ STDMETHODIMP SyncRead(
+ LONGLONG llPosition, // absolute file position
+ LONG lLength, // nr bytes required
+ BYTE* pBuffer); // write data here
+
+ // return total length of stream, and currently available length.
+ // reads for beyond the available length but within the total length will
+ // normally succeed but may block for a long period.
+ STDMETHODIMP Length(
+ LONGLONG* pTotal,
+ LONGLONG* pAvailable);
+
+ // cause all outstanding reads to return, possibly with a failure code
+ // (VFW_E_TIMEOUT) indicating they were cancelled.
+ // these are defined on IAsyncReader and IPin
+ STDMETHODIMP BeginFlush(void);
+ STDMETHODIMP EndFlush(void);
+
+};
+
+
+//
+// The filter object itself. Supports IBaseFilter through
+// CBaseFilter and also IFileSourceFilter directly in this object
+
+class CAsyncReader : public CBaseFilter, public IAMFilterMiscFlags
+{
+
+protected:
+ // filter-wide lock
+ CCritSec m_csFilter;
+
+ // all i/o done here
+ CAsyncIo m_Io;
+
+ // our output pin
+ CAsyncOutputPin m_OutputPin;
+
+ // Type we think our data is
+ CMediaType m_mt;
+
+public:
+
+ // construction / destruction
+
+ CAsyncReader(
+ TCHAR *pName,
+ LPUNKNOWN pUnk,
+ CAsyncStream *pStream,
+ HRESULT *phr,
+ const CLSID& clsid);
+ ~CAsyncReader();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IAMFilterMiscFlags
+ STDMETHODIMP_(ULONG) GetMiscFlags();
+
+ // --- CBaseFilter methods ---
+ int GetPinCount();
+ CBasePin *GetPin(int n);
+
+ // --- Access our media type
+ const CMediaType *LoadType() const
+ {
+ return &m_mt;
+ }
+
+ virtual HRESULT Connect(
+ IPin * pReceivePin,
+ const AM_MEDIA_TYPE *pmt // optional media type
+ )
+ {
+ return m_OutputPin.CBasePin::Connect(pReceivePin, pmt);
+ }
+};
diff --git a/src/filters/reader/asyncreader/asyncreader.sln b/src/filters/reader/asyncreader/asyncreader.sln
new file mode 100644
index 000000000..dec845057
--- /dev/null
+++ b/src/filters/reader/asyncreader/asyncreader.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asyncreader", "asyncreader.vcproj", "{9F31D122-E84D-485A-A58D-09DAD01A56CE}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Debug Unicode
+ ConfigName.2 = Release
+ ConfigName.3 = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug.ActiveCfg = Debug|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug.Build.0 = Debug|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release.ActiveCfg = Release|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release.Build.0 = Release|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {9F31D122-E84D-485A-A58D-09DAD01A56CE}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/reader/asyncreader/asyncreader.vcproj b/src/filters/reader/asyncreader/asyncreader.vcproj
new file mode 100644
index 000000000..d4cddfd34
--- /dev/null
+++ b/src/filters/reader/asyncreader/asyncreader.vcproj
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="asyncreader"
+ ProjectGUID="{9F31D122-E84D-485A-A58D-09DAD01A56CE}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="4"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="4"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="asyncio.cpp">
+ </File>
+ <File
+ RelativePath="asyncrdr.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="asyncio.h">
+ </File>
+ <File
+ RelativePath="asyncrdr.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/asyncreader/asyncreader_vs2005.vcproj b/src/filters/reader/asyncreader/asyncreader_vs2005.vcproj
new file mode 100644
index 000000000..390787662
--- /dev/null
+++ b/src/filters/reader/asyncreader/asyncreader_vs2005.vcproj
@@ -0,0 +1,359 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="asyncreader"
+ ProjectGUID="{9F31D122-E84D-485A-A58D-09DAD01A56CE}"
+ RootNamespace="asyncreader"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="4"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="4"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="asyncio.cpp"
+ >
+ </File>
+ <File
+ RelativePath="asyncrdr.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="asyncio.h"
+ >
+ </File>
+ <File
+ RelativePath="asyncrdr.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/asyncreader/asyncreader_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/reader/asyncreader/asyncreader_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..c5c73095a
--- /dev/null
+++ b/src/filters/reader/asyncreader/asyncreader_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/reader/asyncreader/stdafx.cpp b/src/filters/reader/asyncreader/stdafx.cpp
new file mode 100644
index 000000000..0c3775605
--- /dev/null
+++ b/src/filters/reader/asyncreader/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// asyncreader.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/reader/asyncreader/stdafx.h b/src/filters/reader/asyncreader/stdafx.h
new file mode 100644
index 000000000..2f0ead283
--- /dev/null
+++ b/src/filters/reader/asyncreader/stdafx.h
@@ -0,0 +1,13 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+
diff --git a/src/filters/reader/cddareader/CDDAReader.cpp b/src/filters/reader/cddareader/CDDAReader.cpp
new file mode 100644
index 000000000..eff435498
--- /dev/null
+++ b/src/filters/reader/cddareader/CDDAReader.cpp
@@ -0,0 +1,435 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <initguid.h>
+#include "cddareader.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#define RAW_SECTOR_SIZE 2352
+#define MSF2UINT(hgs) ((hgs[1]*4500)+(hgs[2]*75)+(hgs[3]))
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE},
+};
+
+const AMOVIESETUP_PIN sudOpPin[] =
+{
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut},
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CCDDAReader), L"CDDA Reader", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CCDDAReader>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ if(GetVersion()&0x80000000)
+ {
+ ::MessageBox(NULL, _T("Sorry, this will only run on Windows NT based operating system."), _T("CDDA Reader"), MB_OK);
+ return E_NOTIMPL;
+ }
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"),
+ _T("0"), _T("0,4,,52494646,8,4,,43444441")); // "RIFFxxxxCDDA"
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"),
+ _T("Source Filter"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"));
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".cda"),
+ _T("Source Filter"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"));
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{54A35221-2C8D-4a31-A5DF-6D809847E393}"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".cda"));
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CCDDAReader
+//
+
+CCDDAReader::CCDDAReader(IUnknown* pUnk, HRESULT* phr)
+ : CAsyncReader(NAME("CCDDAReader"), pUnk, &m_stream, phr, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+
+ if(GetVersion()&0x80000000)
+ {
+ if(phr) *phr = E_NOTIMPL;
+ return;
+ }
+}
+
+CCDDAReader::~CCDDAReader()
+{
+}
+
+STDMETHODIMP CCDDAReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IFileSourceFilter)
+ QI2(IAMMediaContent)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IFileSourceFilter
+
+STDMETHODIMP CCDDAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+{
+ if(!m_stream.Load(pszFileName))
+ return E_FAIL;
+
+ m_fn = pszFileName;
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Stream;
+ mt.subtype = MEDIASUBTYPE_WAVE;
+ m_mt = mt;
+
+ return S_OK;
+}
+
+STDMETHODIMP CCDDAReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+{
+ CheckPointer(ppszFileName, E_POINTER);
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppszFileName, m_fn);
+
+ return S_OK;
+}
+
+// IAMMediaContent
+
+STDMETHODIMP CCDDAReader::GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) {return E_NOTIMPL;}
+
+STDMETHODIMP CCDDAReader::get_AuthorName(BSTR* pbstrAuthorName)
+{
+ CheckPointer(pbstrAuthorName, E_POINTER);
+ CString str = m_stream.m_trackArtist;
+ if(str.IsEmpty()) str = m_stream.m_discArtist;
+ *pbstrAuthorName = str.AllocSysString();
+ return S_OK;
+}
+
+STDMETHODIMP CCDDAReader::get_Title(BSTR* pbstrTitle)
+{
+ CheckPointer(pbstrTitle, E_POINTER);
+ CString str = m_stream.m_trackTitle;
+ if(str.IsEmpty()) str = m_stream.m_discTitle;
+ *pbstrTitle = str.AllocSysString();
+ return S_OK;
+}
+
+STDMETHODIMP CCDDAReader::get_Rating(BSTR* pbstrRating) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_Description(BSTR* pbstrDescription) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_Copyright(BSTR* pbstrCopyright) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_BaseURL(BSTR* pbstrBaseURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_LogoURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_LogoIconURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_WatermarkURL(BSTR* pbstrWatermarkURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_MoreInfoURL(BSTR* pbstrMoreInfoURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL) {return E_NOTIMPL;}
+STDMETHODIMP CCDDAReader::get_MoreInfoText(BSTR* pbstrMoreInfoText) {return E_NOTIMPL;}
+
+// CCDDAStream
+
+CCDDAStream::CCDDAStream()
+{
+ m_hDrive = INVALID_HANDLE_VALUE;
+
+ m_llPosition = m_llLength = 0;
+
+ memset(&m_TOC, 0, sizeof(m_TOC));
+ m_nStartSector = m_nStopSector = 0;
+
+ memset(&m_header, 0, sizeof(m_header));
+ m_header.riff.hdr.chunkID = RIFFID;
+ m_header.riff.WAVE = WAVEID;
+ m_header.frm.hdr.chunkID = FormatID;
+ m_header.frm.hdr.chunkSize = sizeof(m_header.frm.pcm);
+ m_header.frm.pcm.wf.wFormatTag = WAVE_FORMAT_PCM;
+ m_header.frm.pcm.wf.nSamplesPerSec = 44100;
+ m_header.frm.pcm.wf.nChannels = 2;
+ m_header.frm.pcm.wBitsPerSample = 16;
+ m_header.frm.pcm.wf.nBlockAlign = m_header.frm.pcm.wf.nChannels * m_header.frm.pcm.wBitsPerSample / 8;
+ m_header.frm.pcm.wf.nAvgBytesPerSec = m_header.frm.pcm.wf.nSamplesPerSec * m_header.frm.pcm.wf.nBlockAlign;
+ m_header.data.hdr.chunkID = DataID;
+}
+
+CCDDAStream::~CCDDAStream()
+{
+ if(m_hDrive != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(m_hDrive);
+ m_hDrive = INVALID_HANDLE_VALUE;
+ }
+}
+
+bool CCDDAStream::Load(const WCHAR* fnw)
+{
+ CString path(fnw);
+
+ int iDriveLetter = path.Find(_T(":\\"))-1;
+ int iTrackIndex = CString(path).MakeLower().Find(_T(".cda"))-1;
+ if(iDriveLetter < 0 || iTrackIndex <= iDriveLetter)
+ return(false);
+
+ CString drive = CString(_T("\\\\.\\")) + path[iDriveLetter] + _T(":");
+ while(iTrackIndex > 0 && _istdigit(path[iTrackIndex-1])) iTrackIndex--;
+ if(1 != _stscanf(path.Mid(iTrackIndex), _T("%d"), &iTrackIndex))
+ return(false);
+
+ if(m_hDrive != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(m_hDrive);
+ m_hDrive = INVALID_HANDLE_VALUE;
+ }
+
+ m_hDrive = CreateFile(drive, GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_READONLY|FILE_FLAG_SEQUENTIAL_SCAN, (HANDLE)NULL);
+ if(m_hDrive == INVALID_HANDLE_VALUE)
+ {
+ return(false);
+ }
+
+ DWORD BytesReturned;
+ if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC, NULL, 0, &m_TOC, sizeof(m_TOC), &BytesReturned, 0)
+ || !(m_TOC.FirstTrack <= iTrackIndex && iTrackIndex <= m_TOC.LastTrack))
+ {
+ CloseHandle(m_hDrive);
+ m_hDrive = INVALID_HANDLE_VALUE;
+ return(false);
+ }
+
+ // MMC-3 Draft Revision 10g: Table 222 – Q Sub-channel control field
+ m_TOC.TrackData[iTrackIndex-1].Control &= 5;
+ if(!(m_TOC.TrackData[iTrackIndex-1].Control == 0 || m_TOC.TrackData[iTrackIndex-1].Control == 1))
+ {
+ CloseHandle(m_hDrive);
+ m_hDrive = INVALID_HANDLE_VALUE;
+ return(false);
+ }
+
+ if(m_TOC.TrackData[iTrackIndex-1].Control&8)
+ m_header.frm.pcm.wf.nChannels = 4;
+
+ m_nStartSector = MSF2UINT(m_TOC.TrackData[iTrackIndex-1].Address) - 150;//MSF2UINT(m_TOC.TrackData[0].Address);
+ m_nStopSector = MSF2UINT(m_TOC.TrackData[iTrackIndex].Address) - 150;//MSF2UINT(m_TOC.TrackData[0].Address);
+
+ m_llLength = (m_nStopSector-m_nStartSector)*RAW_SECTOR_SIZE;
+
+ m_header.riff.hdr.chunkSize = (long)(m_llLength + sizeof(m_header) - 8);
+ m_header.data.hdr.chunkSize = (long)(m_llLength);
+
+ do
+ {
+ CDROM_READ_TOC_EX TOCEx;
+ memset(&TOCEx, 0, sizeof(TOCEx));
+ TOCEx.Format = CDROM_READ_TOC_EX_FORMAT_CDTEXT;
+ TOCEx.SessionTrack = iTrackIndex;
+ WORD size = 0;
+ ASSERT(MINIMUM_CDROM_READ_TOC_EX_SIZE == sizeof(size));
+ if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), &size, sizeof(size), &BytesReturned, 0))
+ break;
+
+ size = ((size>>8)|(size<<8)) + sizeof(size);
+
+ CAutoVectorPtr<BYTE> pCDTextData;
+ pCDTextData.Allocate(size);
+ memset(pCDTextData, 0, size);
+
+ if(!DeviceIoControl(m_hDrive, IOCTL_CDROM_READ_TOC_EX, &TOCEx, sizeof(TOCEx), pCDTextData, size, &BytesReturned, 0))
+ break;
+
+ size = (WORD)(BytesReturned - sizeof(CDROM_TOC_CD_TEXT_DATA));
+ CDROM_TOC_CD_TEXT_DATA_BLOCK* pDesc = ((CDROM_TOC_CD_TEXT_DATA*)(BYTE*)pCDTextData)->Descriptors;
+
+ CStringArray str[16];
+ for(int i = 0; i < 16; i++) str[i].SetSize(1+m_TOC.LastTrack);
+ CString last;
+
+ for(int i = 0; size >= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK); i++, size -= sizeof(CDROM_TOC_CD_TEXT_DATA_BLOCK), pDesc++)
+ {
+ if(pDesc->TrackNumber > m_TOC.LastTrack)
+ continue;
+
+ const int len = countof(pDesc->Text);
+
+ CString text = !pDesc->Unicode
+ ? CString(CStringA((CHAR*)pDesc->Text, len))
+ : CString(CStringW((WCHAR*)pDesc->WText, len));
+
+ int tlen = text.GetLength();
+ CString tmp = (tlen < 12-1)
+ ? (!pDesc->Unicode
+ ? CString(CStringA((CHAR*)pDesc->Text+tlen+1, len-(tlen+1)))
+ : CString(CStringW((WCHAR*)pDesc->WText+tlen+1, len-(tlen+1))))
+ : _T("");
+
+ if((pDesc->PackType -= 0x80) >= 0x10)
+ continue;
+
+ if(pDesc->CharacterPosition == 0)
+ {
+ str[pDesc->PackType][pDesc->TrackNumber] = text;
+ }
+ else if(pDesc->CharacterPosition <= 0xf)
+ {
+ if(pDesc->CharacterPosition < 0xf && last.GetLength() > 0)
+ {
+ str[pDesc->PackType][pDesc->TrackNumber] = last + text;
+ }
+ else
+ {
+ str[pDesc->PackType][pDesc->TrackNumber] += text;
+ }
+ }
+
+ last = tmp;
+ }
+
+ m_discTitle = str[0][0];
+ m_trackTitle = str[0][iTrackIndex];
+ m_discArtist = str[1][0];
+ m_trackArtist = str[1][iTrackIndex];
+ }
+ while(0);
+
+
+ return(true);
+}
+
+HRESULT CCDDAStream::SetPointer(LONGLONG llPos)
+{
+ if(llPos < 0 || llPos > m_llLength) return S_FALSE;
+ m_llPosition = llPos;
+ return S_OK;
+}
+
+HRESULT CCDDAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead)
+{
+ CAutoLock lck(&m_csLock);
+
+ BYTE buff[RAW_SECTOR_SIZE];
+
+ PBYTE pbBufferOrg = pbBuffer;
+ LONGLONG pos = m_llPosition;
+ size_t len = (size_t)dwBytesToRead;
+
+ if(pos < sizeof(m_header) && len > 0)
+ {
+ size_t l = (size_t)min(len, sizeof(m_header) - pos);
+ memcpy(pbBuffer, &((BYTE*)&m_header)[pos], l);
+ pbBuffer += l;
+ pos += l;
+ len -= l;
+ }
+
+ pos -= sizeof(m_header);
+
+ while(pos >= 0 && pos < m_llLength && len > 0)
+ {
+ RAW_READ_INFO rawreadinfo;
+ rawreadinfo.SectorCount = 1;
+ rawreadinfo.TrackMode = CDDA;
+
+ UINT sector = m_nStartSector + int(pos/RAW_SECTOR_SIZE);
+ __int64 offset = pos%RAW_SECTOR_SIZE;
+
+ rawreadinfo.DiskOffset.QuadPart = sector*2048;
+ DWORD BytesReturned = 0;
+ BOOL b = DeviceIoControl(
+ m_hDrive, IOCTL_CDROM_RAW_READ,
+ &rawreadinfo, sizeof(rawreadinfo),
+ buff, RAW_SECTOR_SIZE,
+ &BytesReturned, 0);
+
+ size_t l = (size_t)min(min(len, RAW_SECTOR_SIZE - offset), m_llLength - pos);
+ memcpy(pbBuffer, &buff[offset], l);
+
+ pbBuffer += l;
+ pos += l;
+ len -= l;
+ }
+
+ if(pdwBytesRead) *pdwBytesRead = pbBuffer - pbBufferOrg;
+ m_llPosition += pbBuffer - pbBufferOrg;
+
+ return S_OK;
+}
+
+LONGLONG CCDDAStream::Size(LONGLONG* pSizeAvailable)
+{
+ LONGLONG size = sizeof(m_header) + m_llLength;
+ if(pSizeAvailable) *pSizeAvailable = size;
+ return size;
+}
+
+DWORD CCDDAStream::Alignment()
+{
+ return 1;
+}
+
+void CCDDAStream::Lock()
+{
+ m_csLock.Lock();
+}
+
+void CCDDAStream::Unlock()
+{
+ m_csLock.Unlock();
+}
+
diff --git a/src/filters/reader/cddareader/CDDAReader.def b/src/filters/reader/cddareader/CDDAReader.def
new file mode 100644
index 000000000..f9de25219
--- /dev/null
+++ b/src/filters/reader/cddareader/CDDAReader.def
@@ -0,0 +1,7 @@
+LIBRARY "CDDAReader.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/reader/cddareader/CDDAReader.h b/src/filters/reader/cddareader/CDDAReader.h
new file mode 100644
index 000000000..329da086f
--- /dev/null
+++ b/src/filters/reader/cddareader/CDDAReader.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include "..\..\..\..\include\winddk\devioctl.h"
+#include "..\..\..\..\include\winddk\ntddcdrm.h"
+#include <qnetwork.h>
+#include "..\asyncreader\asyncio.h"
+#include "..\asyncreader\asyncrdr.h"
+
+typedef struct {UINT chunkID; long chunkSize;} ChunkHeader;
+
+#define RIFFID 'FFIR'
+#define WAVEID 'EVAW'
+typedef struct {ChunkHeader hdr; UINT WAVE;} RIFFChunk;
+
+#define FormatID ' tmf'
+typedef struct {ChunkHeader hdr; PCMWAVEFORMAT pcm;} FormatChunk;
+
+#define DataID 'atad'
+typedef struct {ChunkHeader hdr;} DataChunk;
+
+typedef struct {RIFFChunk riff; FormatChunk frm; DataChunk data;} WAVEChunck;
+
+class CCDDAStream : public CAsyncStream
+{
+private:
+ CCritSec m_csLock;
+
+ LONGLONG m_llPosition, m_llLength;
+
+ HANDLE m_hDrive;
+ CDROM_TOC m_TOC;
+ UINT m_nFirstSector, m_nStartSector, m_nStopSector;
+
+ WAVEChunck m_header;
+
+public:
+ CCDDAStream();
+ virtual ~CCDDAStream();
+
+ CString m_discTitle, m_trackTitle;
+ CString m_discArtist, m_trackArtist;
+
+ bool Load(const WCHAR* fnw);
+
+ // overrides
+ HRESULT SetPointer(LONGLONG llPos);
+ HRESULT Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead);
+ LONGLONG Size(LONGLONG* pSizeAvailable);
+ DWORD Alignment();
+ void Lock();
+ void Unlock();
+};
+
+[uuid("54A35221-2C8D-4a31-A5DF-6D809847E393")]
+class CCDDAReader
+ : public CAsyncReader
+ , public IFileSourceFilter
+ , public IAMMediaContent
+{
+ CCDDAStream m_stream;
+ CStringW m_fn;
+
+public:
+ CCDDAReader(IUnknown* pUnk, HRESULT* phr);
+ ~CCDDAReader();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IFileSourceFilter
+
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+
+ // IAMMediaContent
+
+ STDMETHODIMP GetTypeInfoCount(UINT* pctinfo);
+ STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo);
+ STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid);
+ STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr);
+
+ STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName);
+ STDMETHODIMP get_Title(BSTR* pbstrTitle);
+ STDMETHODIMP get_Rating(BSTR* pbstrRating);
+ STDMETHODIMP get_Description(BSTR* pbstrDescription);
+ STDMETHODIMP get_Copyright(BSTR* pbstrCopyright);
+ STDMETHODIMP get_BaseURL(BSTR* pbstrBaseURL);
+ STDMETHODIMP get_LogoURL(BSTR* pbstrLogoURL);
+ STDMETHODIMP get_LogoIconURL(BSTR* pbstrLogoURL);
+ STDMETHODIMP get_WatermarkURL(BSTR* pbstrWatermarkURL);
+ STDMETHODIMP get_MoreInfoURL(BSTR* pbstrMoreInfoURL);
+ STDMETHODIMP get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage);
+ STDMETHODIMP get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL);
+ STDMETHODIMP get_MoreInfoText(BSTR* pbstrMoreInfoText);
+};
+
diff --git a/src/filters/reader/cddareader/cddareader.rc b/src/filters/reader/cddareader/cddareader.rc
new file mode 100644
index 000000000..753191418
--- /dev/null
+++ b/src/filters/reader/cddareader/cddareader.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "CDDA Reader Filter"
+ VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "InternalName", "CDDA Reader Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "CDDAReader.ax"
+ VALUE "ProductName", "CDDA Reader Filter"
+ VALUE "ProductVersion", "1, 0, 0, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/reader/cddareader/cddareader.sln b/src/filters/reader/cddareader/cddareader.sln
new file mode 100644
index 000000000..9d4c1b005
--- /dev/null
+++ b/src/filters/reader/cddareader/cddareader.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cddareader", "cddareader.vcproj", "{543D40E9-8CA6-4E4B-9936-90CBA562B268}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug.ActiveCfg = Debug|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug.Build.0 = Debug|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug lib.ActiveCfg = Debug lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug lib.Build.0 = Debug lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release.ActiveCfg = Release|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release.Build.0 = Release|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release lib.ActiveCfg = Release lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release lib.Build.0 = Release lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode.Build.0 = Release Unicode|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {543D40E9-8CA6-4E4B-9936-90CBA562B268}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/reader/cddareader/cddareader.vcproj b/src/filters/reader/cddareader/cddareader.vcproj
new file mode 100644
index 000000000..cdef14c46
--- /dev/null
+++ b/src/filters/reader/cddareader/cddareader.vcproj
@@ -0,0 +1,545 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="cddareader"
+ ProjectGUID="{543D40E9-8CA6-4E4B-9936-90CBA562B268}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="asyncreaderD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDDAReader.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="asyncreaderR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDDAReader.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="asyncreaderDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDDAReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="asyncreaderRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDDAReader.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="CDDAReader.cpp">
+ </File>
+ <File
+ RelativePath="CDDAReader.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="CDDAReader.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\cddareader.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/cddareader/cddareader_vs2005.vcproj b/src/filters/reader/cddareader/cddareader_vs2005.vcproj
new file mode 100644
index 000000000..f21e87d08
--- /dev/null
+++ b/src/filters/reader/cddareader/cddareader_vs2005.vcproj
@@ -0,0 +1,795 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="cddareader"
+ ProjectGUID="{543D40E9-8CA6-4E4B-9936-90CBA562B268}"
+ RootNamespace="cddareader"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="asyncreaderD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDDAReader.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="asyncreaderR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDDAReader.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="asyncreaderDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDDAReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="asyncreaderRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDDAReader.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="CDDAReader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="CDDAReader.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="CDDAReader.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\cddareader.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/cddareader/cddareader_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/reader/cddareader/cddareader_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/reader/cddareader/cddareader_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/reader/cddareader/resource.h b/src/filters/reader/cddareader/resource.h
new file mode 100644
index 000000000..0d07f7b10
--- /dev/null
+++ b/src/filters/reader/cddareader/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by cddareader.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/reader/cddareader/stdafx.cpp b/src/filters/reader/cddareader/stdafx.cpp
new file mode 100644
index 000000000..d431dab84
--- /dev/null
+++ b/src/filters/reader/cddareader/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// cddareader.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/reader/cddareader/stdafx.h b/src/filters/reader/cddareader/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/reader/cddareader/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/reader/cdxareader/CDXAReader.cpp b/src/filters/reader/cdxareader/CDXAReader.cpp
new file mode 100644
index 000000000..5c9595311
--- /dev/null
+++ b/src/filters/reader/cdxareader/CDXAReader.cpp
@@ -0,0 +1,536 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "cdxareader.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+#include <initguid.h>
+#include <uuids.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+/////////
+
+static DWORD EDC_crctable[256] =
+{
+ 0x00000000l, 0x90910101l, 0x91210201l, 0x01b00300l,
+ 0x92410401l, 0x02d00500l, 0x03600600l, 0x93f10701l,
+ 0x94810801l, 0x04100900l, 0x05a00a00l, 0x95310b01l,
+ 0x06c00c00l, 0x96510d01l, 0x97e10e01l, 0x07700f00l,
+ 0x99011001l, 0x09901100l, 0x08201200l, 0x98b11301l,
+ 0x0b401400l, 0x9bd11501l, 0x9a611601l, 0x0af01700l,
+ 0x0d801800l, 0x9d111901l, 0x9ca11a01l, 0x0c301b00l,
+ 0x9fc11c01l, 0x0f501d00l, 0x0ee01e00l, 0x9e711f01l,
+ 0x82012001l, 0x12902100l, 0x13202200l, 0x83b12301l,
+ 0x10402400l, 0x80d12501l, 0x81612601l, 0x11f02700l,
+ 0x16802800l, 0x86112901l, 0x87a12a01l, 0x17302b00l,
+ 0x84c12c01l, 0x14502d00l, 0x15e02e00l, 0x85712f01l,
+ 0x1b003000l, 0x8b913101l, 0x8a213201l, 0x1ab03300l,
+ 0x89413401l, 0x19d03500l, 0x18603600l, 0x88f13701l,
+ 0x8f813801l, 0x1f103900l, 0x1ea03a00l, 0x8e313b01l,
+ 0x1dc03c00l, 0x8d513d01l, 0x8ce13e01l, 0x1c703f00l,
+ 0xb4014001l, 0x24904100l, 0x25204200l, 0xb5b14301l,
+ 0x26404400l, 0xb6d14501l, 0xb7614601l, 0x27f04700l,
+ 0x20804800l, 0xb0114901l, 0xb1a14a01l, 0x21304b00l,
+ 0xb2c14c01l, 0x22504d00l, 0x23e04e00l, 0xb3714f01l,
+ 0x2d005000l, 0xbd915101l, 0xbc215201l, 0x2cb05300l,
+ 0xbf415401l, 0x2fd05500l, 0x2e605600l, 0xbef15701l,
+ 0xb9815801l, 0x29105900l, 0x28a05a00l, 0xb8315b01l,
+ 0x2bc05c00l, 0xbb515d01l, 0xbae15e01l, 0x2a705f00l,
+ 0x36006000l, 0xa6916101l, 0xa7216201l, 0x37b06300l,
+ 0xa4416401l, 0x34d06500l, 0x35606600l, 0xa5f16701l,
+ 0xa2816801l, 0x32106900l, 0x33a06a00l, 0xa3316b01l,
+ 0x30c06c00l, 0xa0516d01l, 0xa1e16e01l, 0x31706f00l,
+ 0xaf017001l, 0x3f907100l, 0x3e207200l, 0xaeb17301l,
+ 0x3d407400l, 0xadd17501l, 0xac617601l, 0x3cf07700l,
+ 0x3b807800l, 0xab117901l, 0xaaa17a01l, 0x3a307b00l,
+ 0xa9c17c01l, 0x39507d00l, 0x38e07e00l, 0xa8717f01l,
+ 0xd8018001l, 0x48908100l, 0x49208200l, 0xd9b18301l,
+ 0x4a408400l, 0xdad18501l, 0xdb618601l, 0x4bf08700l,
+ 0x4c808800l, 0xdc118901l, 0xdda18a01l, 0x4d308b00l,
+ 0xdec18c01l, 0x4e508d00l, 0x4fe08e00l, 0xdf718f01l,
+ 0x41009000l, 0xd1919101l, 0xd0219201l, 0x40b09300l,
+ 0xd3419401l, 0x43d09500l, 0x42609600l, 0xd2f19701l,
+ 0xd5819801l, 0x45109900l, 0x44a09a00l, 0xd4319b01l,
+ 0x47c09c00l, 0xd7519d01l, 0xd6e19e01l, 0x46709f00l,
+ 0x5a00a000l, 0xca91a101l, 0xcb21a201l, 0x5bb0a300l,
+ 0xc841a401l, 0x58d0a500l, 0x5960a600l, 0xc9f1a701l,
+ 0xce81a801l, 0x5e10a900l, 0x5fa0aa00l, 0xcf31ab01l,
+ 0x5cc0ac00l, 0xcc51ad01l, 0xcde1ae01l, 0x5d70af00l,
+ 0xc301b001l, 0x5390b100l, 0x5220b200l, 0xc2b1b301l,
+ 0x5140b400l, 0xc1d1b501l, 0xc061b601l, 0x50f0b700l,
+ 0x5780b800l, 0xc711b901l, 0xc6a1ba01l, 0x5630bb00l,
+ 0xc5c1bc01l, 0x5550bd00l, 0x54e0be00l, 0xc471bf01l,
+ 0x6c00c000l, 0xfc91c101l, 0xfd21c201l, 0x6db0c300l,
+ 0xfe41c401l, 0x6ed0c500l, 0x6f60c600l, 0xfff1c701l,
+ 0xf881c801l, 0x6810c900l, 0x69a0ca00l, 0xf931cb01l,
+ 0x6ac0cc00l, 0xfa51cd01l, 0xfbe1ce01l, 0x6b70cf00l,
+ 0xf501d001l, 0x6590d100l, 0x6420d200l, 0xf4b1d301l,
+ 0x6740d400l, 0xf7d1d501l, 0xf661d601l, 0x66f0d700l,
+ 0x6180d800l, 0xf111d901l, 0xf0a1da01l, 0x6030db00l,
+ 0xf3c1dc01l, 0x6350dd00l, 0x62e0de00l, 0xf271df01l,
+ 0xee01e001l, 0x7e90e100l, 0x7f20e200l, 0xefb1e301l,
+ 0x7c40e400l, 0xecd1e501l, 0xed61e601l, 0x7df0e700l,
+ 0x7a80e800l, 0xea11e901l, 0xeba1ea01l, 0x7b30eb00l,
+ 0xe8c1ec01l, 0x7850ed00l, 0x79e0ee00l, 0xe971ef01l,
+ 0x7700f000l, 0xe791f101l, 0xe621f201l, 0x76b0f300l,
+ 0xe541f401l, 0x75d0f500l, 0x7460f600l, 0xe4f1f701l,
+ 0xe381f801l, 0x7310f900l, 0x72a0fa00l, 0xe231fb01l,
+ 0x71c0fc00l, 0xe151fd01l, 0xe0e1fe01l, 0x7070ff00l
+};
+
+static DWORD build_edc(const void* in, unsigned from, unsigned upto)
+{
+ const BYTE* p = (BYTE*)in + from;
+ DWORD result = 0;
+
+ for(; from < upto; from++)
+ result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);
+
+ return result;
+}
+
+/////////
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL}
+};
+
+const AMOVIESETUP_PIN sudOpPin[] =
+{
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CCDXAReader), L"CDXA Reader", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CCDXAReader>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"),
+ _T("0"), _T("0,4,,52494646,8,4,,43445841")); // "RIFFxxxxCDXA"
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"),
+ _T("Source Filter"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"));
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{D367878E-F3B8-4235-A968-F378EF1B9A44}"));
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CCDXAReader
+//
+
+CCDXAReader::CCDXAReader(IUnknown* pUnk, HRESULT* phr)
+ : CAsyncReader(NAME("CCDXAReader"), pUnk, &m_stream, phr, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+}
+
+CCDXAReader::~CCDXAReader()
+{
+}
+
+STDMETHODIMP CCDXAReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(IFileSourceFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+STDMETHODIMP CCDXAReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE *pmt)
+{
+ CMediaType mt;
+ m_mt = mt;
+
+ if(!m_stream.Load(pszFileName))
+ return E_FAIL;
+
+ m_fn = pszFileName;
+
+ mt.majortype = MEDIATYPE_Stream;
+ mt.subtype = m_stream.m_subtype;
+ m_mt = mt;
+
+ return S_OK;
+}
+
+STDMETHODIMP CCDXAReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+{
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppszFileName, m_fn);
+
+ return S_OK;
+}
+
+// CCDXAStream
+
+CCDXAStream::CCDXAStream()
+{
+ m_subtype = MEDIASUBTYPE_NULL;
+
+ m_hFile = INVALID_HANDLE_VALUE;
+
+ m_llPosition = m_llLength = 0;
+ m_nFirstSector = 0;
+ m_nBufferedSector = -1;
+}
+
+CCDXAStream::~CCDXAStream()
+{
+ if(m_hFile != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(m_hFile);
+ m_hFile = INVALID_HANDLE_VALUE;
+ }
+}
+
+bool CCDXAStream::Load(const WCHAR* fnw)
+{
+ if(m_hFile != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(m_hFile);
+ m_hFile = INVALID_HANDLE_VALUE;
+ }
+
+ m_hFile = CreateFile(CString(fnw), GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_READONLY|FILE_FLAG_SEQUENTIAL_SCAN, (HANDLE)NULL);
+ if(m_hFile == INVALID_HANDLE_VALUE)
+ {
+ return(false);
+ }
+
+ BYTE hdr[RIFFCDXA_HEADER_SIZE];
+ DWORD NumberOfBytesRead;
+ if(!ReadFile(m_hFile, (LPVOID)hdr, RIFFCDXA_HEADER_SIZE, &NumberOfBytesRead, NULL)
+ || *((DWORD*)&hdr[0]) != 'FFIR' || *((DWORD*)&hdr[8]) != 'AXDC'
+ || *((DWORD*)&hdr[4]) != (*((DWORD*)&hdr[0x28])+0x24))
+ {
+ CloseHandle(m_hFile);
+ m_hFile = INVALID_HANDLE_VALUE;
+ return(false);
+ }
+
+ LARGE_INTEGER size = {0, 0};
+ size.LowPart = (LONG)GetFileSize(m_hFile, (LPDWORD)&size.HighPart);
+
+ m_llLength = int((size.QuadPart - RIFFCDXA_HEADER_SIZE) / RAW_SECTOR_SIZE) * RAW_DATA_SIZE;
+
+ if(!LookForMediaSubType())
+ {
+ m_llPosition = m_llLength = 0;
+ CloseHandle(m_hFile);
+ m_hFile = INVALID_HANDLE_VALUE;
+ return(false);
+ }
+
+ m_llPosition = 0;
+
+ m_nBufferedSector = -1;
+
+ return(true);
+}
+
+HRESULT CCDXAStream::SetPointer(LONGLONG llPos)
+{
+ return (llPos >= 0 && llPos < m_llLength) ? m_llPosition = llPos, S_OK : S_FALSE;
+}
+
+HRESULT CCDXAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead)
+{
+ CAutoLock lck(&m_csLock);
+
+ PBYTE pbBufferOrg = pbBuffer;
+ LONGLONG pos = m_llPosition;
+
+ while(pos >= 0 && pos < m_llLength && dwBytesToRead > 0)
+ {
+ UINT sector = m_nFirstSector + int(pos/RAW_DATA_SIZE);
+ __int64 offset = pos%RAW_DATA_SIZE;
+
+ if(m_nBufferedSector != sector)
+ {
+ LARGE_INTEGER FilePointer;
+ FilePointer.QuadPart = RIFFCDXA_HEADER_SIZE + sector*RAW_SECTOR_SIZE;
+ SetFilePointer(m_hFile, (LONG)FilePointer.LowPart, (PLONG)&FilePointer.HighPart, FILE_BEGIN);
+
+ memset(m_sector, 0, sizeof(m_sector));
+
+ DWORD NumberOfBytesRead = 0;
+
+ int nRetries = 3;
+ while(nRetries--)
+ {
+ NumberOfBytesRead = 0;
+ if(!ReadFile(m_hFile, m_sector, RAW_SECTOR_SIZE, &NumberOfBytesRead, NULL)
+ || NumberOfBytesRead != RAW_SECTOR_SIZE)
+ break;
+
+ if(*(DWORD*)&m_sector[RAW_SECTOR_SIZE-4] == 0) // no CRC? it happens...
+ break;
+
+ if(build_edc(m_sector, RAW_SYNC_SIZE + RAW_HEADER_SIZE, RAW_SECTOR_SIZE) == 0)
+ break;
+
+ TRACE(_T("CCDXAStream: CRC error at sector %d (fp=0x%I64x, retriesleft=%d)\n"), sector, FilePointer.QuadPart, nRetries);
+ }
+
+ m_nBufferedSector = sector;
+ }
+
+ DWORD l = min(min(dwBytesToRead, RAW_DATA_SIZE - offset), m_llLength - pos);
+ memcpy(pbBuffer, &m_sector[RAW_SYNC_SIZE + RAW_HEADER_SIZE + RAW_SUBHEADER_SIZE + offset], l);
+
+ pbBuffer += l;
+ pos += l;
+ dwBytesToRead -= l;
+ }
+
+ if(pdwBytesRead) *pdwBytesRead = pbBuffer - pbBufferOrg;
+ m_llPosition += pbBuffer - pbBufferOrg;
+
+ if(dwBytesToRead != 0) return S_FALSE;
+
+ return S_OK;
+}
+
+LONGLONG CCDXAStream::Size(LONGLONG* pSizeAvailable)
+{
+ if(pSizeAvailable) *pSizeAvailable = m_llLength;
+ return m_llLength;
+}
+
+DWORD CCDXAStream::Alignment()
+{
+ return 1;
+}
+
+void CCDXAStream::Lock()
+{
+ m_csLock.Lock();
+}
+
+void CCDXAStream::Unlock()
+{
+ m_csLock.Unlock();
+}
+
+//
+
+bool CCDXAStream::LookForMediaSubType()
+{
+ BYTE buff[RAW_DATA_SIZE];
+
+ m_subtype = MEDIASUBTYPE_NULL;
+
+ m_llPosition = 0;
+
+ for(int iSectorsRead = 0;
+ Read(buff, RAW_DATA_SIZE, 1, NULL) == S_OK && iSectorsRead < 1000;
+ iSectorsRead++)
+ {
+ if(*((DWORD*)&buff[0]) == 0xba010000)
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ if((buff[4]&0xc4) == 0x44) m_subtype = MEDIASUBTYPE_MPEG2_PROGRAM;
+ else if((buff[4]&0xf1) == 0x21) m_subtype = MEDIASUBTYPE_MPEG1System;
+
+ return m_subtype != MEDIASUBTYPE_NULL;
+ }
+ else if(*((DWORD*)&buff[0]) == 'SggO')
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_Ogg;
+
+ return(true);
+ }
+ else if(*((DWORD*)&buff[0]) == 0xA3DF451A)
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_Matroska;
+
+ return(true);
+ }
+ else if(*((DWORD*)&buff[0]) == 'FMR.')
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_RealMedia;
+
+ return(true);
+ }
+ else if(*((DWORD*)&buff[0]) == 'FFIR' && *((DWORD*)&buff[8]) == ' IVA')
+ {
+ m_llPosition = 0;
+ m_llLength = min(m_llLength, *((DWORD*)&buff[4])+8);
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_Avi;
+
+ return(true);
+ }
+ else if(*((DWORD*)&buff[4]) == 'voom' || *((DWORD*)&buff[4]) == 'tadm'
+ || *((DWORD*)&buff[4]) == 'pytf' && *((DWORD*)&buff[8]) == 'mosi' && *((DWORD*)&buff[16]) == '14pm')
+ {
+ m_llPosition = 0;
+ m_llLength -= iSectorsRead*RAW_DATA_SIZE;
+ m_nFirstSector = iSectorsRead;
+
+ m_subtype = MEDIASUBTYPE_QTMovie;
+
+ return(true);
+ }
+ }
+
+ m_llPosition = 0;
+
+ CRegKey majorkey;
+ CString majortype = _T("\\Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}");
+ if(ERROR_SUCCESS == majorkey.Open(HKEY_CLASSES_ROOT, majortype, KEY_READ))
+ {
+ TCHAR subtype[256+1];
+ DWORD len = 256;
+ for(int i = 0; ERROR_SUCCESS == majorkey.EnumKey(i, subtype, &len); i++, len = 256)
+ {
+ CRegKey subkey;
+ if(ERROR_SUCCESS != subkey.Open(HKEY_CLASSES_ROOT, majortype + _T("\\") + subtype, KEY_READ))
+ continue;
+
+ for(int j = 0; true; j++)
+ {
+ TCHAR number[10];
+ _stprintf(number, _T("%d"), j);
+
+ TCHAR pattern[256+1];
+ ULONG len = 256;
+ if(ERROR_SUCCESS != subkey.QueryStringValue(number, pattern, &len))
+ break;
+
+ CString p = pattern;
+ p += ',';
+
+ __int64 offset = 0;
+ DWORD cb = 0;
+ CAtlArray<BYTE> mask, val;
+
+ int nMatches = 0, nTries = 0;
+
+ for(int k = 0, l; nTries >= 0 && (l = p.Find(',', k)) >= 0; k = l+1, nTries++)
+ {
+ CString s = p.Mid(k, l-k);
+ TRACE(s + '\n');
+
+ TCHAR* end = NULL;
+
+ switch(nTries&3)
+ {
+ case 0: offset = _tcstol(s, &end, 10); break;
+ case 1: cb = _tcstol(s, &end, 10); break;
+ case 2: CStringToBin(s, mask); break;
+ case 3: CStringToBin(s, val); break;
+ default: nTries = -1; break;
+ }
+
+ if(nTries >= 0 && (nTries&3) == 3)
+ {
+ if(cb > 0 && val.GetCount() > 0 && cb == val.GetCount())
+ {
+ if(offset >= 0 && S_OK == SetPointer(offset)
+ || S_OK == SetPointer(m_llLength + offset))
+ {
+ CAutoVectorPtr<BYTE> pData;
+ if(pData.Allocate(cb))
+ {
+ DWORD BytesRead = 0;
+ if(S_OK == Read(pData, cb, 1, &BytesRead) && cb == BytesRead)
+ {
+ if(mask.GetCount() < cb)
+ {
+ int i = mask.GetCount();
+ mask.SetCount(cb);
+ for(; i < cb; i++) mask[i] = 0xff;
+ }
+
+ for(int i = 0; i < cb; i++)
+ pData[i] &= (BYTE)mask[i];
+
+ if(memcmp(pData, val.GetData(), cb) == 0)
+ nMatches++;
+ }
+ }
+ }
+
+ offset = 0; cb = 0;
+ mask.RemoveAll(); val.RemoveAll();
+ }
+ }
+ }
+
+ if(nMatches > 0 && nMatches*4 == nTries)
+ {
+ m_subtype = GUIDFromCString(subtype);
+ return S_OK;
+ }
+ }
+ }
+ }
+
+ return(false);
+}
diff --git a/src/filters/reader/cdxareader/CDXAReader.def b/src/filters/reader/cdxareader/CDXAReader.def
new file mode 100644
index 000000000..3ca400c76
--- /dev/null
+++ b/src/filters/reader/cdxareader/CDXAReader.def
@@ -0,0 +1,7 @@
+LIBRARY "CDXAReader.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/reader/cdxareader/CDXAReader.h b/src/filters/reader/cdxareader/CDXAReader.h
new file mode 100644
index 000000000..79c63cfbc
--- /dev/null
+++ b/src/filters/reader/cdxareader/CDXAReader.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include "..\asyncreader\asyncio.h"
+#include "..\asyncreader\asyncrdr.h"
+
+class CCDXAStream : public CAsyncStream
+{
+private:
+ enum
+ {
+ RIFFCDXA_HEADER_SIZE = 44, // usually...
+ RAW_SYNC_SIZE = 12, // 00 FF .. FF 00
+ RAW_HEADER_SIZE = 4,
+ RAW_SUBHEADER_SIZE = 8,
+ RAW_DATA_SIZE = 2324,
+ RAW_EDC_SIZE = 4,
+ RAW_SECTOR_SIZE = 2352
+ };
+
+ CCritSec m_csLock;
+
+ HANDLE m_hFile;
+ LONGLONG m_llPosition, m_llLength;
+ int m_nFirstSector;
+
+ int m_nBufferedSector;
+ BYTE m_sector[RAW_SECTOR_SIZE];
+
+ bool LookForMediaSubType();
+
+public:
+ CCDXAStream();
+ virtual ~CCDXAStream();
+
+ bool Load(const WCHAR* fnw);
+
+ HRESULT SetPointer(LONGLONG llPos);
+ HRESULT Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead);
+ LONGLONG Size(LONGLONG* pSizeAvailable);
+ DWORD Alignment();
+ void Lock();
+ void Unlock();
+
+ GUID m_subtype;
+};
+
+[uuid("D367878E-F3B8-4235-A968-F378EF1B9A44")]
+class CCDXAReader
+ : public CAsyncReader
+ , public IFileSourceFilter
+{
+ CCDXAStream m_stream;
+ CStringW m_fn;
+
+public:
+ CCDXAReader(IUnknown* pUnk, HRESULT* phr);
+ ~CCDXAReader();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+};
diff --git a/src/filters/reader/cdxareader/cdxareader.rc b/src/filters/reader/cdxareader/cdxareader.rc
new file mode 100644
index 000000000..40e20b9b4
--- /dev/null
+++ b/src/filters/reader/cdxareader/cdxareader.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "CDXA Reader Filter"
+ VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "InternalName", "CDXA Reader Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "CDXAReader.ax"
+ VALUE "ProductName", "CDXA Reader Filter"
+ VALUE "ProductVersion", "1, 0, 0, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/reader/cdxareader/cdxareader.sln b/src/filters/reader/cdxareader/cdxareader.sln
new file mode 100644
index 000000000..7056a9c9c
--- /dev/null
+++ b/src/filters/reader/cdxareader/cdxareader.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdxareader", "cdxareader.vcproj", "{4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug.ActiveCfg = Debug|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug.Build.0 = Debug|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug lib.ActiveCfg = Debug lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug lib.Build.0 = Debug lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release.ActiveCfg = Release|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release.Build.0 = Release|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release lib.ActiveCfg = Release lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release lib.Build.0 = Release lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode.Build.0 = Release Unicode|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/reader/cdxareader/cdxareader.vcproj b/src/filters/reader/cdxareader/cdxareader.vcproj
new file mode 100644
index 000000000..aaa4d8eda
--- /dev/null
+++ b/src/filters/reader/cdxareader/cdxareader.vcproj
@@ -0,0 +1,544 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="cdxareader"
+ ProjectGUID="{4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="asyncreaderD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDXAReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="asyncreaderR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDXAReader.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="asyncreaderDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDXAReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="asyncreaderRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDXAReader.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="CDXAReader.cpp">
+ </File>
+ <File
+ RelativePath="CDXAReader.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="CDXAReader.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\cdxareader.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/cdxareader/cdxareader_vs2005.vcproj b/src/filters/reader/cdxareader/cdxareader_vs2005.vcproj
new file mode 100644
index 000000000..3f416c761
--- /dev/null
+++ b/src/filters/reader/cdxareader/cdxareader_vs2005.vcproj
@@ -0,0 +1,794 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="cdxareader"
+ ProjectGUID="{4D3B4FF4-535A-4201-AB7D-9AEC1E737A95}"
+ RootNamespace="cdxareader"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="asyncreaderD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDXAReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="asyncreaderR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDXAReader.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="asyncreaderDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDXAReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="asyncreaderRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="CDXAReader.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="CDXAReader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="CDXAReader.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="CDXAReader.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\cdxareader.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/cdxareader/cdxareader_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/reader/cdxareader/cdxareader_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/reader/cdxareader/cdxareader_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/reader/cdxareader/resource.h b/src/filters/reader/cdxareader/resource.h
new file mode 100644
index 000000000..35951cffd
--- /dev/null
+++ b/src/filters/reader/cdxareader/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by cdxareader.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/reader/cdxareader/stdafx.cpp b/src/filters/reader/cdxareader/stdafx.cpp
new file mode 100644
index 000000000..d5332bbe6
--- /dev/null
+++ b/src/filters/reader/cdxareader/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// cdxareader.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/reader/cdxareader/stdafx.h b/src/filters/reader/cdxareader/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/reader/cdxareader/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/reader/udpreader/UDPReader.cpp b/src/filters/reader/udpreader/UDPReader.cpp
new file mode 100644
index 000000000..bddb11fb7
--- /dev/null
+++ b/src/filters/reader/udpreader/UDPReader.cpp
@@ -0,0 +1,434 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "udpreader.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudOpPin[] =
+{
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CUDPReader), L"UDP Reader", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CUDPReader>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ SetRegKeyValue(_T("udp"), 0, _T("Source Filter"), CStringFromGUID(__uuidof(CUDPReader)));
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ // TODO
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+#define BUFF_SIZE (256*1024)
+#define BUFF_SIZE_FIRST (4*BUFF_SIZE)
+
+//
+// CUDPReader
+//
+
+CUDPReader::CUDPReader(IUnknown* pUnk, HRESULT* phr)
+ : CAsyncReader(NAME("CUDPReader"), pUnk, &m_stream, phr, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+}
+
+CUDPReader::~CUDPReader()
+{
+}
+
+STDMETHODIMP CUDPReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IFileSourceFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IFileSourceFilter
+
+STDMETHODIMP CUDPReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+{
+ if(!m_stream.Load(pszFileName))
+ return E_FAIL;
+
+ m_fn = pszFileName;
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Stream;
+ mt.subtype = m_stream.GetSubType();
+ m_mt = mt;
+
+ return S_OK;
+}
+
+STDMETHODIMP CUDPReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+{
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppszFileName, m_fn);
+
+ return S_OK;
+}
+
+// CUDPStream
+
+CUDPStream::CUDPStream()
+{
+ m_port = 0;
+ m_socket = -1;
+ m_subtype = MEDIASUBTYPE_NULL;
+}
+
+CUDPStream::~CUDPStream()
+{
+ Clear();
+}
+
+void CUDPStream::Clear()
+{
+ if(m_socket >= 0) {closesocket(m_socket); m_socket = -1;}
+ if(CAMThread::ThreadExists())
+ {
+ CAMThread::CallWorker(CMD_EXIT);
+ CAMThread::Close();
+ }
+ while(!m_packets.IsEmpty()) delete m_packets.RemoveHead();
+ m_pos = m_len = 0;
+ m_drop = false;
+}
+
+void CUDPStream::Append(BYTE* buff, int len)
+{
+ CAutoLock cAutoLock(&m_csLock);
+
+ if(m_packets.GetCount() > 1)
+ {
+ __int64 size = m_packets.GetTail()->m_end - m_packets.GetHead()->m_start;
+
+ if(!m_drop && (m_pos >= BUFF_SIZE_FIRST && size >= BUFF_SIZE_FIRST || size >= 2*BUFF_SIZE_FIRST))
+ {
+ m_drop = true;
+ TRACE(_T("DROP ON\n"));
+ }
+ else if(m_drop && size <= BUFF_SIZE_FIRST)
+ {
+ m_drop = false;
+ TRACE(_T("DROP OFF\n"));
+ }
+
+ if(m_drop) return;
+ }
+
+ m_packets.AddTail(new packet_t(buff, m_len, m_len + len));
+ m_len += len;
+}
+
+bool CUDPStream::Load(const WCHAR* fnw)
+{
+ Clear();
+
+ CStringW url = CStringW(fnw);
+
+#ifdef DEBUG
+// url = L"udp://:1234/";
+// url = L"udp://239.255.255.250:1234/{e436eb8e-524f-11ce-9f53-0020af0ba770}";
+#endif
+
+ CAtlList<CStringW> sl;
+ Explode(url, sl, ':');
+ if(sl.GetCount() != 3) return false;
+
+ CStringW protocol = sl.RemoveHead();
+ if(protocol != L"udp") return false;
+
+ m_ip = CString(sl.RemoveHead()).TrimLeft('/');
+
+ int port = _wtoi(Explode(sl.RemoveHead(), sl, '/', 2));
+ if(port < 0 || port > 0xffff) return false;
+ m_port = port;
+
+ if(sl.GetCount() != 2 || FAILED(GUIDFromCString(CString(sl.GetTail()), m_subtype)))
+ m_subtype = MEDIASUBTYPE_NULL; // TODO: detect subtype
+
+ CAMThread::Create();
+ if(FAILED(CAMThread::CallWorker(CMD_RUN)))
+ {
+ Clear();
+ return false;
+ }
+
+ return true;
+}
+
+HRESULT CUDPStream::SetPointer(LONGLONG llPos)
+{
+ CAutoLock cAutoLock(&m_csLock);
+
+ if(m_packets.IsEmpty() && llPos != 0
+ || !m_packets.IsEmpty() && llPos < m_packets.GetHead()->m_start
+ || !m_packets.IsEmpty() && llPos > m_packets.GetTail()->m_end)
+ {
+ ASSERT(0);
+ return E_FAIL;
+ }
+
+ m_pos = llPos;
+
+ return S_OK;
+}
+
+HRESULT CUDPStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead)
+{
+ CAutoLock cAutoLock(&m_csLock);
+
+ DWORD len = dwBytesToRead;
+ BYTE* ptr = pbBuffer;
+
+ while(len > 0 && !m_packets.IsEmpty())
+ {
+ POSITION pos = m_packets.GetHeadPosition();
+ while(pos && len > 0)
+ {
+ packet_t* p = m_packets.GetNext(pos);
+
+ if(p->m_start <= m_pos && m_pos < p->m_end)
+ {
+ int size;
+
+ if(m_pos < p->m_start)
+ {
+ ASSERT(0);
+ size = min(len, p->m_start - m_pos);
+ memset(ptr, 0, size);
+ }
+ else
+ {
+ size = min(len, p->m_end - m_pos);
+ memcpy(ptr, &p->m_buff[m_pos - p->m_start], size);
+ }
+
+ m_pos += size;
+
+ ptr += size;
+ len -= size;
+ }
+
+ if(p->m_end <= m_pos - 2048 && BUFF_SIZE_FIRST <= m_pos)
+ {
+ while(m_packets.GetHeadPosition() != pos)
+ delete m_packets.RemoveHead();
+ }
+
+ }
+ }
+
+ if(pdwBytesRead)
+ *pdwBytesRead = ptr - pbBuffer;
+
+ return S_OK;
+}
+
+LONGLONG CUDPStream::Size(LONGLONG* pSizeAvailable)
+{
+ CAutoLock cAutoLock(&m_csLock);
+ if(pSizeAvailable) *pSizeAvailable = m_len;
+ return 0;
+}
+
+DWORD CUDPStream::Alignment()
+{
+ return 1;
+}
+
+void CUDPStream::Lock()
+{
+ m_csLock.Lock();
+}
+
+void CUDPStream::Unlock()
+{
+ m_csLock.Unlock();
+}
+
+DWORD CUDPStream::ThreadProc()
+{
+ WSADATA wsaData;
+ int init = WSAStartup(MAKEWORD(2, 0), &wsaData);
+ if(init != 0) init = WSAStartup(MAKEWORD(1, 0), &wsaData);
+
+ sockaddr_in addr;
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ addr.sin_port = htons((u_short)m_port);
+
+ ip_mreq imr;
+ imr.imr_multiaddr.s_addr = inet_addr(CStringA(m_ip));
+ imr.imr_interface.s_addr = INADDR_ANY;
+
+ if((m_socket = socket(AF_INET, SOCK_DGRAM, 0)) >= 0)
+ {
+/* u_long argp = 1;
+ ioctlsocket(m_socket, FIONBIO, &argp);
+*/
+ if(bind(m_socket, (struct sockaddr*)&addr, sizeof(addr)) < 0)
+ {
+ closesocket(m_socket);
+ m_socket = -1;
+ }
+
+ if((htonl(imr.imr_multiaddr.s_addr) & 0xf0000000) == 0xe0000000)
+ {
+ setsockopt(m_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char*)&imr, sizeof(imr));
+ }
+ }
+
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_TIME_CRITICAL);
+
+ FILE* dump = NULL;
+// dump = _tfopen(_T("c:\\udp.ts"), _T("wb"));
+ FILE* log = NULL;
+// log = _tfopen(_T("c:\\udp.txt"), _T("wt"));
+
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+
+ switch(cmd)
+ {
+ default:
+ case CMD_EXIT:
+ if(m_socket >= 0) {closesocket(m_socket); m_socket = -1;}
+ if(init == 0) WSACleanup();
+ if(dump) fclose(dump);
+ if(log) fclose(log);
+ Reply(S_OK);
+ return 0;
+ case CMD_RUN:
+ Reply(m_socket >= 0 ? S_OK : E_FAIL);
+
+ {
+ char buff[65536*2];
+ int buffsize = 0;
+ sockaddr_in from;
+
+ for(unsigned int i = 0; ; i++)
+ {
+ if(!(i&0xff))
+ {
+ if(CheckRequest(NULL))
+ break;
+ }
+
+ int fromlen = sizeof(from);
+ int len = recvfrom(m_socket, &buff[buffsize], 65536, 0, (SOCKADDR*)&from, &fromlen);
+ if(len <= 0) {Sleep(1); continue;}
+
+ if(log)
+ {
+ if(buffsize >= len && !memcmp(&buff[buffsize-len], &buff[buffsize], len))
+ {
+ DWORD pid = ((buff[buffsize+1]<<8)|buff[buffsize+2])&0x1fff;
+ DWORD counter = buff[buffsize+3]&0xf;
+ _ftprintf(log, _T("%04d %2d DUP\n"), pid, counter);
+ }
+ }
+
+ buffsize += len;
+
+ if(buffsize >= 65536 || m_len == 0)
+ {
+ if(dump)
+ {
+ fwrite(buff, buffsize, 1, dump);
+ }
+
+ if(log)
+ {
+ static BYTE pid2counter[0x2000];
+ static bool init = false;
+ if(!init) {memset(pid2counter, 0, sizeof(pid2counter)); init = true;}
+
+ for(int i = 0; i < buffsize; i += 188)
+ {
+ DWORD pid = ((buff[i+1]<<8)|buff[i+2])&0x1fff;
+ DWORD counter = buff[i+3]&0xf;
+ if(pid2counter[pid] != ((counter-1+16)&15))
+ _ftprintf(log, _T("%04x %2d -> %2d\n"), pid, pid2counter[pid], counter);
+ pid2counter[pid] = counter;
+ }
+ }
+
+ Append((BYTE*)buff, buffsize);
+ buffsize = 0;
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ ASSERT(0);
+ return -1;
+}
+
+CUDPStream::packet_t::packet_t(BYTE* p, __int64 start, __int64 end)
+ : m_start(start)
+ , m_end(end)
+{
+ int size = end - start;
+ m_buff = new BYTE[size];
+ memcpy(m_buff, p, size);
+}
diff --git a/src/filters/reader/udpreader/UDPReader.def b/src/filters/reader/udpreader/UDPReader.def
new file mode 100644
index 000000000..6c0dbfe6e
--- /dev/null
+++ b/src/filters/reader/udpreader/UDPReader.def
@@ -0,0 +1,7 @@
+LIBRARY "UDPReader.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/reader/udpreader/UDPReader.h b/src/filters/reader/udpreader/UDPReader.h
new file mode 100644
index 000000000..961d068fb
--- /dev/null
+++ b/src/filters/reader/udpreader/UDPReader.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include "..\asyncreader\asyncio.h"
+#include "..\asyncreader\asyncrdr.h"
+
+class CUDPStream : public CAsyncStream, public CAMThread
+{
+private:
+ CCritSec m_csLock;
+
+ class packet_t
+ {
+ public:
+ BYTE* m_buff;
+ __int64 m_start, m_end;
+ packet_t(BYTE* p, __int64 start, __int64 end);
+ virtual ~packet_t() {delete [] m_buff;}
+ };
+
+ int m_port;
+ CString m_ip;
+ SOCKET m_socket;
+ GUID m_subtype;
+ __int64 m_pos, m_len;
+ bool m_drop;
+ CAtlList<packet_t*> m_packets;
+
+ void Clear();
+ void Append(BYTE* buff, int len);
+
+ enum {CMD_EXIT, CMD_RUN};
+ DWORD ThreadProc();
+
+public:
+ CUDPStream();
+ virtual ~CUDPStream();
+
+ bool Load(const WCHAR* fnw);
+ const GUID& GetSubType() {return m_subtype;}
+
+ HRESULT SetPointer(LONGLONG llPos);
+ HRESULT Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead);
+ LONGLONG Size(LONGLONG* pSizeAvailable);
+ DWORD Alignment();
+ void Lock();
+ void Unlock();
+};
+
+[uuid("0E4221A9-9718-48D5-A5CF-4493DAD4A015")]
+class CUDPReader
+ : public CAsyncReader
+ , public IFileSourceFilter
+{
+ CUDPStream m_stream;
+ CStringW m_fn;
+
+public:
+ CUDPReader(IUnknown* pUnk, HRESULT* phr);
+ ~CUDPReader();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+};
diff --git a/src/filters/reader/udpreader/UDPReader.vcproj b/src/filters/reader/udpreader/UDPReader.vcproj
new file mode 100644
index 000000000..9e50627df
--- /dev/null
+++ b/src/filters/reader/udpreader/UDPReader.vcproj
@@ -0,0 +1,544 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="UDPReader"
+ ProjectGUID="{3020FF9B-8202-488D-B137-11DECC510E6E}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssD.lib asyncreaderD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="UDPReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssDU.lib asyncreaderDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="UDPReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssR.lib asyncreaderR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="UDPReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssRU.lib asyncreaderRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="UDPReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="UDPReader.cpp">
+ </File>
+ <File
+ RelativePath="UDPReader.def">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="UDPReader.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\UDPReader.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/udpreader/resource.h b/src/filters/reader/udpreader/resource.h
new file mode 100644
index 000000000..320510fa1
--- /dev/null
+++ b/src/filters/reader/udpreader/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by udpreader.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/reader/udpreader/stdafx.cpp b/src/filters/reader/udpreader/stdafx.cpp
new file mode 100644
index 000000000..a416647fd
--- /dev/null
+++ b/src/filters/reader/udpreader/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// udpreader.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/reader/udpreader/stdafx.h b/src/filters/reader/udpreader/stdafx.h
new file mode 100644
index 000000000..4f7b860b0
--- /dev/null
+++ b/src/filters/reader/udpreader/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+#include <afxsock.h>
+#include <atlcoll.h>
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
diff --git a/src/filters/reader/udpreader/udpreader.rc b/src/filters/reader/udpreader/udpreader.rc
new file mode 100644
index 000000000..1568dea26
--- /dev/null
+++ b/src/filters/reader/udpreader/udpreader.rc
@@ -0,0 +1,116 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x37L
+#ifdef _DEBUG
+ FILEFLAGS 0x21L
+#else
+ FILEFLAGS 0x20L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "UDP Reader Filter"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "UDP Reader Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "UDPReader.ax"
+ VALUE "ProductName", "UDP Reader Filter"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ VALUE "SpecialBuild", "UDP Reader Filter"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/reader/udpreader/udpreader_vs2005.sln b/src/filters/reader/udpreader/udpreader_vs2005.sln
new file mode 100644
index 000000000..5f84fbfa4
--- /dev/null
+++ b/src/filters/reader/udpreader/udpreader_vs2005.sln
@@ -0,0 +1,37 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "udpreader", "udpreader_vs2005.vcproj", "{3020FF9B-8202-488D-B137-11DECC510E6E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug lib|Win32 = Debug lib|Win32
+ Debug Unicode lib|Win32 = Debug Unicode lib|Win32
+ Debug Unicode|Win32 = Debug Unicode|Win32
+ Debug|Win32 = Debug|Win32
+ Release lib|Win32 = Release lib|Win32
+ Release Unicode lib|Win32 = Release Unicode lib|Win32
+ Release Unicode|Win32 = Release Unicode|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug lib|Win32.ActiveCfg = Debug lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug lib|Win32.Build.0 = Debug lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode lib|Win32.Build.0 = Debug Unicode lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Debug|Win32.Build.0 = Debug|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release lib|Win32.ActiveCfg = Release lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release lib|Win32.Build.0 = Release lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode lib|Win32.ActiveCfg = Release Unicode lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode lib|Win32.Build.0 = Release Unicode lib|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release|Win32.ActiveCfg = Release|Win32
+ {3020FF9B-8202-488D-B137-11DECC510E6E}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/reader/udpreader/udpreader_vs2005.vcproj b/src/filters/reader/udpreader/udpreader_vs2005.vcproj
new file mode 100644
index 000000000..45a642844
--- /dev/null
+++ b/src/filters/reader/udpreader/udpreader_vs2005.vcproj
@@ -0,0 +1,803 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="udpreader"
+ ProjectGUID="{3020FF9B-8202-488D-B137-11DECC510E6E}"
+ RootNamespace="udpreader"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="asyncreaderD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="UDPReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="asyncreaderDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="UDPReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="asyncreaderR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="UDPReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="asyncreaderRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="UDPReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="UDPReader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="UDPReader.def"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath="UDPReader.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\udpreader.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/udpreader/udpreader_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/reader/udpreader/udpreader_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..f2fd09b6d
--- /dev/null
+++ b/src/filters/reader/udpreader/udpreader_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/reader/vtsreader/VTSReader.cpp b/src/filters/reader/vtsreader/VTSReader.cpp
new file mode 100644
index 000000000..b171b09c0
--- /dev/null
+++ b/src/filters/reader/vtsreader/VTSReader.cpp
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "..\..\..\decss\VobFile.h"
+#include "vtsreader.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG2_PROGRAM},
+};
+
+const AMOVIESETUP_PIN sudOpPin[] =
+{
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CVTSReader), L"VTS Reader", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CVTSReader>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ if(GetVersion()&0x80000000)
+ return E_NOTIMPL;
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"),
+ _T("0"), _T("0,12,,445644564944454F2D565453")); // "DVDVIDEO-VTS"
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"),
+ _T("Source Filter"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"));
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73}"));
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CVTSReader
+//
+
+CVTSReader::CVTSReader(IUnknown* pUnk, HRESULT* phr)
+ : CAsyncReader(NAME("CVTSReader"), pUnk, &m_stream, phr, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+
+ if(GetVersion()&0x80000000)
+ {
+ if(phr) *phr = E_NOTIMPL;
+ return;
+ }
+}
+
+CVTSReader::~CVTSReader()
+{
+}
+
+STDMETHODIMP CVTSReader::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IFileSourceFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IFileSourceFilter
+
+STDMETHODIMP CVTSReader::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+{
+ if(!m_stream.Load(pszFileName))
+ return E_FAIL;
+
+ m_fn = pszFileName;
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Stream;
+ mt.subtype = MEDIASUBTYPE_MPEG2_PROGRAM;
+ m_mt = mt;
+
+ return S_OK;
+}
+
+STDMETHODIMP CVTSReader::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+{
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppszFileName, m_fn);
+
+ return S_OK;
+}
+
+// CVTSStream
+
+CVTSStream::CVTSStream() : m_off(0)
+{
+ m_vob.Attach(new CVobFile());
+}
+
+CVTSStream::~CVTSStream()
+{
+}
+
+bool CVTSStream::Load(const WCHAR* fnw)
+{
+ CAtlList<CString> sl;
+ return(m_vob && m_vob->Open(CString(fnw), sl) /*&& m_vob->IsDVD()*/);
+}
+
+HRESULT CVTSStream::SetPointer(LONGLONG llPos)
+{
+ m_off = (int)(llPos&2047);
+ int lba = (int)(llPos/2048);
+
+ return lba == m_vob->Seek(lba) ? S_OK : S_FALSE;
+}
+
+HRESULT CVTSStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead)
+{
+ CAutoLock lck(&m_csLock);
+
+ DWORD len = dwBytesToRead;
+ BYTE* ptr = pbBuffer;
+
+ while(len > 0)
+ {
+ BYTE buff[2048];
+ if(!m_vob->Read(buff))
+ break;
+
+ int size = min(2048 - m_off, min(len, 2048));
+
+ memcpy(ptr, &buff[m_off], size);
+
+ m_off = (m_off + size)&2047;
+
+ if(m_off > 0)
+ m_vob->Seek(m_vob->GetPosition()-1);
+
+ ptr += size;
+ len -= size;
+ }
+
+ if(pdwBytesRead)
+ *pdwBytesRead = ptr - pbBuffer;
+
+ return S_OK;
+}
+
+LONGLONG CVTSStream::Size(LONGLONG* pSizeAvailable)
+{
+ LONGLONG len = 2048i64*m_vob->GetLength();
+ if(pSizeAvailable) *pSizeAvailable = len;
+ return(len);
+}
+
+DWORD CVTSStream::Alignment()
+{
+ return 1;
+}
+
+void CVTSStream::Lock()
+{
+ m_csLock.Lock();
+}
+
+void CVTSStream::Unlock()
+{
+ m_csLock.Unlock();
+}
+
diff --git a/src/filters/reader/vtsreader/VTSReader.def b/src/filters/reader/vtsreader/VTSReader.def
new file mode 100644
index 000000000..a3e1d992a
--- /dev/null
+++ b/src/filters/reader/vtsreader/VTSReader.def
@@ -0,0 +1,7 @@
+LIBRARY "VTSReader.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/reader/vtsreader/VTSReader.h b/src/filters/reader/vtsreader/VTSReader.h
new file mode 100644
index 000000000..020240e42
--- /dev/null
+++ b/src/filters/reader/vtsreader/VTSReader.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include "..\asyncreader\asyncio.h"
+#include "..\asyncreader\asyncrdr.h"
+
+class CVobFile;
+
+class CVTSStream : public CAsyncStream
+{
+private:
+ CCritSec m_csLock;
+
+ CAutoPtr<CVobFile> m_vob;
+ int m_off;
+
+public:
+ CVTSStream();
+ virtual ~CVTSStream();
+
+ bool Load(const WCHAR* fnw);
+
+ HRESULT SetPointer(LONGLONG llPos);
+ HRESULT Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead);
+ LONGLONG Size(LONGLONG* pSizeAvailable);
+ DWORD Alignment();
+ void Lock();
+ void Unlock();
+};
+
+[uuid("773EAEDE-D5EE-4fce-9C8F-C4F53D0A2F73")]
+class CVTSReader
+ : public CAsyncReader
+ , public IFileSourceFilter
+{
+ CVTSStream m_stream;
+ CStringW m_fn;
+
+public:
+ CVTSReader(IUnknown* pUnk, HRESULT* phr);
+ ~CVTSReader();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+};
diff --git a/src/filters/reader/vtsreader/resource.h b/src/filters/reader/vtsreader/resource.h
new file mode 100644
index 000000000..de42e25ad
--- /dev/null
+++ b/src/filters/reader/vtsreader/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by vtsreader.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/reader/vtsreader/stdafx.cpp b/src/filters/reader/vtsreader/stdafx.cpp
new file mode 100644
index 000000000..edb7e9517
--- /dev/null
+++ b/src/filters/reader/vtsreader/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// vtsreader.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/reader/vtsreader/stdafx.h b/src/filters/reader/vtsreader/stdafx.h
new file mode 100644
index 000000000..b971954ab
--- /dev/null
+++ b/src/filters/reader/vtsreader/stdafx.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
diff --git a/src/filters/reader/vtsreader/vtsreader.rc b/src/filters/reader/vtsreader/vtsreader.rc
new file mode 100644
index 000000000..1597c16b0
--- /dev/null
+++ b/src/filters/reader/vtsreader/vtsreader.rc
@@ -0,0 +1,116 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x37L
+#ifdef _DEBUG
+ FILEFLAGS 0x21L
+#else
+ FILEFLAGS 0x20L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "VTS Reader Filter"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "VTS Reader Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "VTSReader.ax"
+ VALUE "ProductName", "VTS Reader Filter"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ VALUE "SpecialBuild", "VTS Reader Filter"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/reader/vtsreader/vtsreader.sln b/src/filters/reader/vtsreader/vtsreader.sln
new file mode 100644
index 000000000..4301fc710
--- /dev/null
+++ b/src/filters/reader/vtsreader/vtsreader.sln
@@ -0,0 +1,60 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vtsreader", "vtsreader.vcproj", "{664E726B-EEEE-403A-AC15-345D9C9E1375}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575} = {1A2DFD1A-3C6C-44D1-909D-294AF646B575}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decss", "..\..\..\decss\decss.vcproj", "{1A2DFD1A-3C6C-44D1-909D-294AF646B575}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug.ActiveCfg = Debug|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug.Build.0 = Debug|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug lib.ActiveCfg = Debug lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug lib.Build.0 = Debug lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release.ActiveCfg = Release|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release.Build.0 = Release|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release lib.ActiveCfg = Release lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release lib.Build.0 = Release lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode.Build.0 = Release Unicode|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {664E726B-EEEE-403A-AC15-345D9C9E1375}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.ActiveCfg = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.Build.0 = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug lib.ActiveCfg = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug lib.Build.0 = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.ActiveCfg = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.Build.0 = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release lib.ActiveCfg = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release lib.Build.0 = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.Build.0 = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/reader/vtsreader/vtsreader.vcproj b/src/filters/reader/vtsreader/vtsreader.vcproj
new file mode 100644
index 000000000..5bdbe1e1d
--- /dev/null
+++ b/src/filters/reader/vtsreader/vtsreader.vcproj
@@ -0,0 +1,544 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="vtsreader"
+ ProjectGUID="{664E726B-EEEE-403A-AC15-345D9C9E1375}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssD.lib asyncreaderD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="VTSReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssDU.lib asyncreaderDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="VTSReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssR.lib asyncreaderR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="VTSReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssRU.lib asyncreaderRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="VTSReader.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="VTSReader.cpp">
+ </File>
+ <File
+ RelativePath="VTSReader.def">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="VTSReader.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\vtsreader.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/vtsreader/vtsreader_vs2005.vcproj b/src/filters/reader/vtsreader/vtsreader_vs2005.vcproj
new file mode 100644
index 000000000..7590154ae
--- /dev/null
+++ b/src/filters/reader/vtsreader/vtsreader_vs2005.vcproj
@@ -0,0 +1,796 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="vtsreader"
+ ProjectGUID="{664E726B-EEEE-403A-AC15-345D9C9E1375}"
+ RootNamespace="vtsreader"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="decssD.lib asyncreaderD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="VTSReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="decssDU.lib asyncreaderDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="VTSReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="decssR.lib asyncreaderR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="VTSReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="decssRU.lib asyncreaderRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="VTSReader.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="VTSReader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="VTSReader.def"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath="VTSReader.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\vtsreader.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/reader/vtsreader/vtsreader_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/reader/vtsreader/vtsreader_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..f2fd09b6d
--- /dev/null
+++ b/src/filters/reader/vtsreader/vtsreader_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/source/basesource/BaseSource.cpp b/src/filters/source/basesource/BaseSource.cpp
new file mode 100644
index 000000000..6fe6eca98
--- /dev/null
+++ b/src/filters/source/basesource/BaseSource.cpp
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "BaseSource.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+//
+// CBaseSource
+//
+
+//
+// CBaseStream
+//
+
+CBaseStream::CBaseStream(TCHAR* name, CSource* pParent, HRESULT* phr)
+ : CSourceStream(name, phr, pParent, L"Output")
+ , CSourceSeeking(name, (IPin*)this, phr, &m_cSharedState)
+ , m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+
+ m_AvgTimePerFrame = 0;
+ m_rtDuration = 0;
+ m_rtStop = m_rtDuration;
+}
+
+CBaseStream::~CBaseStream()
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+}
+
+STDMETHODIMP CBaseStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv)
+ : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
+}
+
+void CBaseStream::UpdateFromSeek()
+{
+ if(ThreadExists())
+ {
+ // next time around the loop, the worker thread will
+ // pick up the position change.
+ // We need to flush all the existing data - we must do that here
+ // as our thread will probably be blocked in GetBuffer otherwise
+
+ m_bFlushing = TRUE;
+
+ DeliverBeginFlush();
+ // make sure we have stopped pushing
+ Stop();
+ // complete the flush
+ DeliverEndFlush();
+
+ m_bFlushing = FALSE;
+
+ // restart
+ Run();
+ }
+}
+
+HRESULT CBaseStream::SetRate(double dRate)
+{
+ if(dRate <= 0)
+ return E_INVALIDARG;
+
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ m_dRateSeeking = dRate;
+ }
+
+ UpdateFromSeek();
+
+ return S_OK;
+}
+
+HRESULT CBaseStream::OnThreadStartPlay()
+{
+ m_bDiscontinuity = TRUE;
+ return DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
+}
+
+HRESULT CBaseStream::ChangeStart()
+{
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ m_rtSampleTime = 0;
+ m_rtPosition = m_rtStart;
+ }
+
+ UpdateFromSeek();
+
+ return S_OK;
+}
+
+HRESULT CBaseStream::ChangeStop()
+{
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ if(m_rtPosition < m_rtStop)
+ return S_OK;
+ }
+
+ // We're already past the new stop time -- better flush the graph.
+ UpdateFromSeek();
+
+ return S_OK;
+}
+
+HRESULT CBaseStream::OnThreadCreate()
+{
+ CAutoLock cAutoLockShared(&m_cSharedState);
+
+ m_rtSampleTime = 0;
+ m_rtPosition = m_rtStart;
+
+ return CSourceStream::OnThreadCreate();
+}
+
+HRESULT CBaseStream::FillBuffer(IMediaSample* pSample)
+{
+ HRESULT hr;
+
+ {
+ CAutoLock cAutoLockShared(&m_cSharedState);
+
+ if(m_rtPosition >= m_rtStop)
+ return S_FALSE;
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pOut)) || !pOut)
+ return S_FALSE;
+
+ int nFrame = m_rtPosition / m_AvgTimePerFrame; // (int)(1.0 * m_rtPosition / m_AvgTimePerFrame + 0.5);
+
+ long len = pSample->GetSize();
+
+ hr = FillBuffer(pSample, nFrame, pOut, len);
+ if(hr != S_OK) return hr;
+
+ pSample->SetActualDataLength(len);
+
+ REFERENCE_TIME rtStart, rtStop;
+ // The sample times are modified by the current rate.
+ rtStart = static_cast<REFERENCE_TIME>(m_rtSampleTime / m_dRateSeeking);
+ rtStop = rtStart + static_cast<int>(m_AvgTimePerFrame / m_dRateSeeking);
+ pSample->SetTime(&rtStart, &rtStop);
+
+ m_rtSampleTime += m_AvgTimePerFrame;
+ m_rtPosition += m_AvgTimePerFrame;
+ }
+
+ pSample->SetSyncPoint(TRUE);
+
+ if(m_bDiscontinuity)
+ {
+ pSample->SetDiscontinuity(TRUE);
+ m_bDiscontinuity = FALSE;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CBaseStream::Notify(IBaseFilter* pSender, Quality q)
+{
+ return E_NOTIMPL;
+}
diff --git a/src/filters/source/basesource/BaseSource.h b/src/filters/source/basesource/BaseSource.h
new file mode 100644
index 000000000..f2ee9f908
--- /dev/null
+++ b/src/filters/source/basesource/BaseSource.h
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\..\DSUtil\DSUtil.h"
+
+template<class TStream>
+class CBaseSource
+ : public CSource
+ , public IFileSourceFilter
+ , public IAMFilterMiscFlags
+{
+protected:
+ CStringW m_fn;
+
+public:
+ CBaseSource(TCHAR* name, LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
+ : CSource(name, lpunk, clsid)
+ {
+ if(phr) *phr = S_OK;
+ }
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
+ {
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IFileSourceFilter)
+ QI(IAMFilterMiscFlags)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+ }
+
+ // IFileSourceFilter
+
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+ {
+ // TODO: destroy any already existing pins and create new, now we are just going die nicely instead of doing it :)
+ if(GetPinCount() > 0)
+ return VFW_E_ALREADY_CONNECTED;
+
+ HRESULT hr = S_OK;
+ if(!(new TStream(pszFileName, this, &hr)))
+ return E_OUTOFMEMORY;
+
+ if(FAILED(hr))
+ return hr;
+
+ m_fn = pszFileName;
+
+ return S_OK;
+ }
+
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+ {
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppszFileName, m_fn);
+
+ return S_OK;
+ }
+
+ // IAMFilterMiscFlags
+
+ STDMETHODIMP_(ULONG) GetMiscFlags()
+ {
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+ }
+};
+
+class CBaseStream
+ : public CSourceStream
+ , public CSourceSeeking
+{
+protected:
+ CCritSec m_cSharedState;
+
+ REFERENCE_TIME m_AvgTimePerFrame;
+ REFERENCE_TIME m_rtSampleTime, m_rtPosition;
+
+ BOOL m_bDiscontinuity, m_bFlushing;
+
+ HRESULT OnThreadStartPlay();
+ HRESULT OnThreadCreate();
+
+private:
+ void UpdateFromSeek();
+ STDMETHODIMP SetRate(double dRate);
+
+ HRESULT ChangeStart();
+ HRESULT ChangeStop();
+ HRESULT ChangeRate() {return S_OK;}
+
+public:
+ CBaseStream(TCHAR* name, CSource* pParent, HRESULT* phr);
+ virtual ~CBaseStream();
+
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT FillBuffer(IMediaSample* pSample);
+
+ virtual HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len /*in+out*/) = 0;
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+};
diff --git a/src/filters/source/basesource/basesource.sln b/src/filters/source/basesource/basesource.sln
new file mode 100644
index 000000000..e542743d7
--- /dev/null
+++ b/src/filters/source/basesource/basesource.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basesource", "basesource.vcproj", "{F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug lib
+ ConfigName.1 = Debug Unicode lib
+ ConfigName.2 = Release lib
+ ConfigName.3 = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug lib.ActiveCfg = Debug lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug lib.Build.0 = Debug lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release lib.ActiveCfg = Release lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release lib.Build.0 = Release lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/source/basesource/basesource.vcproj b/src/filters/source/basesource/basesource.vcproj
new file mode 100644
index 000000000..c94d9bcc0
--- /dev/null
+++ b/src/filters/source/basesource/basesource.vcproj
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="basesource"
+ ProjectGUID="{F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="BaseSource.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="BaseSource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/basesource/basesource_vs2005.vcproj b/src/filters/source/basesource/basesource_vs2005.vcproj
new file mode 100644
index 000000000..e668b4488
--- /dev/null
+++ b/src/filters/source/basesource/basesource_vs2005.vcproj
@@ -0,0 +1,355 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="basesource"
+ ProjectGUID="{F50E74C2-5BE7-4C9B-B1E7-6CA19CFAD34E}"
+ RootNamespace="basesource"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="BaseSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="BaseSource.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/basesource/basesource_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/source/basesource/basesource_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..19de06174
--- /dev/null
+++ b/src/filters/source/basesource/basesource_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/source/basesource/stdafx.cpp b/src/filters/source/basesource/stdafx.cpp
new file mode 100644
index 000000000..7407b6b89
--- /dev/null
+++ b/src/filters/source/basesource/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// basesource.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/source/basesource/stdafx.h b/src/filters/source/basesource/stdafx.h
new file mode 100644
index 000000000..dd0d28f25
--- /dev/null
+++ b/src/filters/source/basesource/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/source/d2vsource/D2VSource.cpp b/src/filters/source/d2vsource/D2VSource.cpp
new file mode 100644
index 000000000..d986f919a
--- /dev/null
+++ b/src/filters/source/d2vsource/D2VSource.cpp
@@ -0,0 +1,283 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include "stdafx.h"
+#include "D2VSource.h"
+#include "mpeg2dec.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2}
+};
+
+const AMOVIESETUP_PIN sudOpPin[] =
+{
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CD2VSource), L"D2VSource", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CD2VSource>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
+ _T("0"), _T("0,18,,4456443241564950726F6A65637446696C65")); // "DVD2AVIProjectFile"
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"),
+ _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".d2v"),
+ _T("Source Filter"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{47CE0591-C4D5-4b41-BED7-28F59AD76228}"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".d2v"));
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CD2VSource
+//
+
+CD2VSource::CD2VSource(LPUNKNOWN lpunk, HRESULT* phr)
+ : CBaseSource<CD2VStream>(NAME("CD2VSource"), lpunk, phr, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+}
+
+CD2VSource::~CD2VSource()
+{
+}
+
+//
+// CD2VStream
+//
+
+CD2VStream::CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr)
+ : CBaseStream(NAME("D2VSourceStream"), pParent, phr)
+ , m_pFrameBuffer(NULL)
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+
+ m_pDecoder.Attach(new CMPEG2Dec());
+ if(!m_pDecoder)
+ {
+ if(phr) *phr = E_OUTOFMEMORY;
+ return;
+ }
+
+ if(!m_pDecoder->Open(CString(fn), CMPEG2Dec::YUY2))
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ if(!m_pFrameBuffer.Allocate(m_pDecoder->Clip_Width*m_pDecoder->Clip_Height*4))
+ {
+ if(phr) *phr = E_OUTOFMEMORY;
+ return;
+ }
+
+ m_AvgTimePerFrame = 10000000000i64/m_pDecoder->VF_FrameRate;
+ m_rtDuration = m_rtStop = m_AvgTimePerFrame*m_pDecoder->VF_FrameLimit;
+
+ if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+}
+
+CD2VStream::~CD2VStream()
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+}
+
+HRESULT CD2VStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+// CAutoLock cAutoLock(m_pFilter->pStateLock());
+
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ int w, h, bpp;
+ if(!GetDim(w, h, bpp))
+ return E_FAIL;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = w*h*bpp>>3;
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
+
+ return NOERROR;
+}
+
+HRESULT CD2VStream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len)
+{
+ if(!m_pDecoder)
+ return S_FALSE;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ SetMediaType(&mt);
+
+ DeleteMediaType(pmt);
+ }
+
+ int w, h, bpp;
+ if(!GetDim(w, h, bpp))
+ return S_FALSE;
+
+ BYTE* pIn = m_pFrameBuffer;
+
+ int pitchIn, pitchOut = 0;
+
+ pitchIn = m_pDecoder->Clip_Width*bpp>>3;
+ pitchOut = w*bpp>>3;
+
+ m_pDecoder->Decode(pIn, (unsigned long)(nFrame), pitchIn);
+
+ for(int y = 0, p = min(pitchIn, pitchOut);
+ y < h;
+ y++, pIn += pitchIn, pOut += pitchOut)
+ {
+ memcpy(pOut, pIn, p);
+ }
+
+ len = pitchOut*h;
+
+ return S_OK;
+}
+
+HRESULT CD2VStream::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ CAutoLock cAutoLock(m_pFilter->pStateLock());
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pmt->SetType(&MEDIATYPE_Video);
+ pmt->SetSubtype(&MEDIASUBTYPE_YUY2);
+ pmt->SetFormatType(&FORMAT_VideoInfo);
+ pmt->SetTemporalCompression(FALSE);
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->AvgTimePerFrame = m_AvgTimePerFrame;
+ vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
+ vih->bmiHeader.biWidth = m_pDecoder->Clip_Width;
+ vih->bmiHeader.biHeight = m_pDecoder->Clip_Height;
+ vih->bmiHeader.biPlanes = 1;
+ vih->bmiHeader.biBitCount = 16;
+ vih->bmiHeader.biCompression = '2YUY';
+ vih->bmiHeader.biSizeImage = vih->bmiHeader.biWidth*abs(vih->bmiHeader.biHeight)*vih->bmiHeader.biBitCount>>3;
+
+ pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
+
+ return NOERROR;
+}
+
+HRESULT CD2VStream::SetMediaType(const CMediaType* pmt)
+{
+ if(m_pDecoder)
+ {
+ if(pmt->subtype == MEDIASUBTYPE_YUY2)
+ m_pDecoder->m_dstFormat = CMPEG2Dec::YUY2;
+ else
+ return E_FAIL;
+ }
+
+ return CSourceStream::SetMediaType(pmt);
+}
+
+HRESULT CD2VStream::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Video
+ && pmt->subtype == MEDIASUBTYPE_YUY2
+ && pmt->formattype == FORMAT_VideoInfo
+ ? S_OK
+ : E_INVALIDARG;
+}
+
+STDMETHODIMP CD2VStream::Notify(IBaseFilter* pSender, Quality q)
+{
+ if(q.Late > 0 && q.Late < 100000000)
+ {
+ CAutoLock cAutoLockShared(&m_cSharedState);
+
+ m_rtSampleTime += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
+ m_rtPosition += (q.Late/m_AvgTimePerFrame)*m_AvgTimePerFrame;
+ }
+
+ return S_OK;
+}
+
+//
+
+bool CD2VStream::GetDim(int& w, int& h, int& bpp)
+{
+ if(m_mt.formattype == FORMAT_VideoInfo)
+ {
+ w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo2)
+ {
+ w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else
+ {
+ return(false);
+ }
+
+ return(true);
+}
diff --git a/src/filters/source/d2vsource/D2VSource.def b/src/filters/source/d2vsource/D2VSource.def
new file mode 100644
index 000000000..465cb0f61
--- /dev/null
+++ b/src/filters/source/d2vsource/D2VSource.def
@@ -0,0 +1,7 @@
+LIBRARY "D2VSource.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/source/d2vsource/D2VSource.h b/src/filters/source/d2vsource/D2VSource.h
new file mode 100644
index 000000000..4fb92faa2
--- /dev/null
+++ b/src/filters/source/d2vsource/D2VSource.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#pragma once
+#include <atlbase.h>
+#include "..\BaseSource\BaseSource.h"
+
+class CD2VStream;
+
+[uuid("47CE0591-C4D5-4b41-BED7-28F59AD76228")]
+class CD2VSource : public CBaseSource<CD2VStream>
+{
+public:
+ CD2VSource(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CD2VSource();
+};
+
+class CMPEG2Dec;
+
+class CD2VStream : public CBaseStream
+{
+private:
+ CAutoPtr<CMPEG2Dec> m_pDecoder;
+ CAutoVectorPtr<BYTE> m_pFrameBuffer;
+
+ bool GetDim(int& w, int& h, int& bpp);
+
+public:
+ CD2VStream(const WCHAR* fn, CSource* pParent, HRESULT* phr);
+ virtual ~CD2VStream();
+
+ HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len /*in+out*/);
+
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT CheckMediaType(const CMediaType* pMediaType);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ HRESULT SetMediaType(const CMediaType* pmt);
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+};
diff --git a/src/filters/source/d2vsource/MPEG2Dec.cpp b/src/filters/source/d2vsource/MPEG2Dec.cpp
new file mode 100644
index 000000000..611f57320
--- /dev/null
+++ b/src/filters/source/d2vsource/MPEG2Dec.cpp
@@ -0,0 +1,4489 @@
+#include "stdafx.h"
+#include "MPEG2Dec.h"
+
+int testint;
+
+struct CPU {
+ BOOL mmx;
+ BOOL _3dnow;
+ BOOL ssemmx;
+ BOOL ssefpu;
+} cpu;
+
+void CheckCPU()
+{
+ __asm
+ {
+ mov eax, 1
+ cpuid
+ test edx, 0x00800000 // STD MMX
+ jz TEST_SSE
+ mov [cpu.mmx], 1
+TEST_SSE:
+ test edx, 0x02000000 // STD SSE
+ jz TEST_3DNOW
+ mov [cpu.ssemmx], 1
+ mov [cpu.ssefpu], 1
+TEST_3DNOW:
+ mov eax, 0x80000001
+ cpuid
+ test edx, 0x80000000 // 3D NOW
+ jz TEST_SSEMMX
+ mov [cpu._3dnow], 1
+TEST_SSEMMX:
+ test edx, 0x00400000 // SSE MMX
+ jz TEST_END
+ mov [cpu.ssemmx], 1
+TEST_END:
+ }
+}
+
+
+// idct
+extern "C" void __fastcall MMX_IDCT(short *block);
+extern "C" void __fastcall SSEMMX_IDCT(short *block);
+extern void Initialize_FPU_IDCT(void);
+extern void FPU_IDCT(short *block);
+extern void Initialize_REF_IDCT(void);
+extern void REF_IDCT(short *block);
+
+/* default intra quantization matrix */
+static unsigned char default_intra_quantizer_matrix[64] =
+{
+ 8, 16, 19, 22, 26, 27, 29, 34,
+ 16, 16, 22, 24, 27, 29, 34, 37,
+ 19, 22, 26, 27, 29, 34, 34, 38,
+ 22, 22, 26, 27, 29, 34, 37, 40,
+ 22, 26, 27, 29, 32, 35, 40, 48,
+ 26, 27, 29, 32, 35, 40, 48, 58,
+ 26, 27, 29, 34, 38, 46, 56, 69,
+ 27, 29, 35, 38, 46, 56, 69, 83
+};
+
+/* zig-zag and alternate scan patterns */
+static unsigned char scan[2][64] =
+{
+ { /* Zig-Zag scan pattern */
+ 0, 1, 8, 16, 9, 2, 3, 10,
+ 17, 24, 32, 25, 18, 11, 4, 5,
+ 12, 19, 26, 33, 40, 48, 41, 34,
+ 27, 20, 13, 6, 7, 14, 21, 28,
+ 35, 42, 49, 56, 57, 50, 43, 36,
+ 29, 22, 15, 23, 30, 37, 44, 51,
+ 58, 59, 52, 45, 38, 31, 39, 46,
+ 53, 60, 61, 54, 47, 55, 62, 63
+ }
+ ,
+ { /* Alternate scan pattern */
+ 0, 8, 16, 24, 1, 9, 2, 10,
+ 17, 25, 32, 40, 48, 56, 57, 49,
+ 41, 33, 26, 18, 3, 11, 4, 12,
+ 19, 27, 34, 42, 50, 58, 35, 43,
+ 51, 59, 20, 28, 5, 13, 6, 14,
+ 21, 29, 36, 44, 52, 60, 37, 45,
+ 53, 61, 22, 30, 7, 15, 23, 31,
+ 38, 46, 54, 62, 39, 47, 55, 63
+ }
+};
+
+/* non-linear quantization coefficient table */
+static unsigned char Non_Linear_quantizer_scale[32] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 10, 12, 14, 16, 18, 20, 22,
+ 24, 28, 32, 36, 40, 44, 48, 52,
+ 56, 64, 72, 80, 88, 96, 104, 112
+};
+
+#define ERROR_VALUE (-1)
+
+typedef struct {
+ char run, level, len;
+} DCTtab;
+
+typedef struct {
+ char val, len;
+} VLCtab;
+
+/* Table B-10, motion_code, codes 0001 ... 01xx */
+static VLCtab MVtab0[8] =
+{
+ {ERROR_VALUE,0}, {3,3}, {2,2}, {2,2}, {1,1}, {1,1}, {1,1}, {1,1}
+};
+
+/* Table B-10, motion_code, codes 0000011 ... 000011x */
+static VLCtab MVtab1[8] =
+{
+ {ERROR_VALUE,0}, {ERROR_VALUE,0}, {ERROR_VALUE,0}, {7,6}, {6,6}, {5,6}, {4,5}, {4,5}
+};
+
+/* Table B-10, motion_code, codes 0000001100 ... 000001011x */
+static VLCtab MVtab2[12] =
+{
+ {16,9}, {15,9}, {14,9}, {13,9},
+ {12,9}, {11,9}, {10,8}, {10,8},
+ {9,8}, {9,8}, {8,8}, {8,8}
+};
+
+/* Table B-9, coded_block_pattern, codes 01000 ... 111xx */
+static VLCtab CBPtab0[32] =
+{
+ {ERROR_VALUE,0}, {ERROR_VALUE,0}, {ERROR_VALUE,0}, {ERROR_VALUE,0},
+ {ERROR_VALUE,0}, {ERROR_VALUE,0}, {ERROR_VALUE,0}, {ERROR_VALUE,0},
+ {62,5}, {2,5}, {61,5}, {1,5}, {56,5}, {52,5}, {44,5}, {28,5},
+ {40,5}, {20,5}, {48,5}, {12,5}, {32,4}, {32,4}, {16,4}, {16,4},
+ {8,4}, {8,4}, {4,4}, {4,4}, {60,3}, {60,3}, {60,3}, {60,3}
+};
+
+/* Table B-9, coded_block_pattern, codes 00000100 ... 001111xx */
+static VLCtab CBPtab1[64] =
+{
+ {ERROR_VALUE,0}, {ERROR_VALUE,0}, {ERROR_VALUE,0}, {ERROR_VALUE,0},
+ {58,8}, {54,8}, {46,8}, {30,8},
+ {57,8}, {53,8}, {45,8}, {29,8}, {38,8}, {26,8}, {37,8}, {25,8},
+ {43,8}, {23,8}, {51,8}, {15,8}, {42,8}, {22,8}, {50,8}, {14,8},
+ {41,8}, {21,8}, {49,8}, {13,8}, {35,8}, {19,8}, {11,8}, {7,8},
+ {34,7}, {34,7}, {18,7}, {18,7}, {10,7}, {10,7}, {6,7}, {6,7},
+ {33,7}, {33,7}, {17,7}, {17,7}, {9,7}, {9,7}, {5,7}, {5,7},
+ {63,6}, {63,6}, {63,6}, {63,6}, {3,6}, {3,6}, {3,6}, {3,6},
+ {36,6}, {36,6}, {36,6}, {36,6}, {24,6}, {24,6}, {24,6}, {24,6}
+};
+
+/* Table B-9, coded_block_pattern, codes 000000001 ... 000000111 */
+static VLCtab CBPtab2[8] =
+{
+ {ERROR_VALUE,0}, {0,9}, {39,9}, {27,9}, {59,9}, {55,9}, {47,9}, {31,9}
+};
+
+/* Table B-1, macroblock_address_increment, codes 00010 ... 011xx */
+static VLCtab MBAtab1[16] =
+{
+ {ERROR_VALUE,0}, {ERROR_VALUE,0}, {7,5}, {6,5}, {5,4}, {5,4}, {4,4},
+ {4,4}, {3,3}, {3,3}, {3,3}, {3,3}, {2,3}, {2,3}, {2,3}, {2,3}
+};
+
+/* Table B-1, macroblock_address_increment, codes 00000011000 ... 0000111xxxx */
+static VLCtab MBAtab2[104] =
+{
+ {33,11}, {32,11}, {31,11}, {30,11}, {29,11}, {28,11}, {27,11}, {26,11},
+ {25,11}, {24,11}, {23,11}, {22,11}, {21,10}, {21,10}, {20,10}, {20,10},
+ {19,10}, {19,10}, {18,10}, {18,10}, {17,10}, {17,10}, {16,10}, {16,10},
+ {15,8}, {15,8}, {15,8}, {15,8}, {15,8}, {15,8}, {15,8}, {15,8},
+ {14,8}, {14,8}, {14,8}, {14,8}, {14,8}, {14,8}, {14,8}, {14,8},
+ {13,8}, {13,8}, {13,8}, {13,8}, {13,8}, {13,8}, {13,8}, {13,8},
+ {12,8}, {12,8}, {12,8}, {12,8}, {12,8}, {12,8}, {12,8}, {12,8},
+ {11,8}, {11,8}, {11,8}, {11,8}, {11,8}, {11,8}, {11,8}, {11,8},
+ {10,8}, {10,8}, {10,8}, {10,8}, {10,8}, {10,8}, {10,8}, {10,8},
+ {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7},
+ {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7}, {9,7},
+ {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7},
+ {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}, {8,7}
+};
+
+/* Table B-12, dct_dc_size_luminance, codes 00xxx ... 11110 */
+static VLCtab DClumtab0[32] =
+{
+ {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
+ {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
+ {0, 3}, {0, 3}, {0, 3}, {0, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
+ {4, 3}, {4, 3}, {4, 3}, {4, 3}, {5, 4}, {5, 4}, {6, 5}, {ERROR_VALUE, 0}
+};
+
+/* Table B-12, dct_dc_size_luminance, codes 111110xxx ... 111111111 */
+static VLCtab DClumtab1[16] =
+{
+ {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6},
+ {8, 7}, {8, 7}, {8, 7}, {8, 7}, {9, 8}, {9, 8}, {10,9}, {11,9}
+};
+
+/* Table B-13, dct_dc_size_chrominance, codes 00xxx ... 11110 */
+static VLCtab DCchromtab0[32] =
+{
+ {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
+ {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
+ {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
+ {3, 3}, {3, 3}, {3, 3}, {3, 3}, {4, 4}, {4, 4}, {5, 5}, {ERROR_VALUE, 0}
+};
+
+/* Table B-13, dct_dc_size_chrominance, codes 111110xxxx ... 1111111111 */
+static VLCtab DCchromtab1[32] =
+{
+ {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6},
+ {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6},
+ {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7},
+ {8, 8}, {8, 8}, {8, 8}, {8, 8}, {9, 9}, {9, 9}, {10,10}, {11,10}
+};
+
+/* Table B-14, DCT coefficients table zero,
+ * codes 0100 ... 1xxx (used for first (DC) coefficient)
+ */
+static DCTtab DCTtabfirst[12] =
+{
+ {0,2,4}, {2,1,4}, {1,1,3}, {1,1,3},
+ {0,1,1}, {0,1,1}, {0,1,1}, {0,1,1},
+ {0,1,1}, {0,1,1}, {0,1,1}, {0,1,1}
+};
+
+/* Table B-14, DCT coefficients table zero,
+ * codes 0100 ... 1xxx (used for all other coefficients)
+ */
+static DCTtab DCTtabnext[12] =
+{
+ {0,2,4}, {2,1,4}, {1,1,3}, {1,1,3},
+ {64,0,2}, {64,0,2}, {64,0,2}, {64,0,2}, /* EOB */
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2}
+};
+
+/* Table B-14, DCT coefficients table zero,
+ * codes 000001xx ... 00111xxx
+ */
+static DCTtab DCTtab0[60] =
+{
+ {65,0,6}, {65,0,6}, {65,0,6}, {65,0,6}, /* Escape */
+ {2,2,7}, {2,2,7}, {9,1,7}, {9,1,7},
+ {0,4,7}, {0,4,7}, {8,1,7}, {8,1,7},
+ {7,1,6}, {7,1,6}, {7,1,6}, {7,1,6},
+ {6,1,6}, {6,1,6}, {6,1,6}, {6,1,6},
+ {1,2,6}, {1,2,6}, {1,2,6}, {1,2,6},
+ {5,1,6}, {5,1,6}, {5,1,6}, {5,1,6},
+ {13,1,8}, {0,6,8}, {12,1,8}, {11,1,8},
+ {3,2,8}, {1,3,8}, {0,5,8}, {10,1,8},
+ {0,3,5}, {0,3,5}, {0,3,5}, {0,3,5},
+ {0,3,5}, {0,3,5}, {0,3,5}, {0,3,5},
+ {4,1,5}, {4,1,5}, {4,1,5}, {4,1,5},
+ {4,1,5}, {4,1,5}, {4,1,5}, {4,1,5},
+ {3,1,5}, {3,1,5}, {3,1,5}, {3,1,5},
+ {3,1,5}, {3,1,5}, {3,1,5}, {3,1,5}
+};
+
+/* Table B-15, DCT coefficients table one,
+ * codes 000001xx ... 11111111
+*/
+static DCTtab DCTtab0a[252] =
+{
+ {65,0,6}, {65,0,6}, {65,0,6}, {65,0,6}, /* Escape */
+ {7,1,7}, {7,1,7}, {8,1,7}, {8,1,7},
+ {6,1,7}, {6,1,7}, {2,2,7}, {2,2,7},
+ {0,7,6}, {0,7,6}, {0,7,6}, {0,7,6},
+ {0,6,6}, {0,6,6}, {0,6,6}, {0,6,6},
+ {4,1,6}, {4,1,6}, {4,1,6}, {4,1,6},
+ {5,1,6}, {5,1,6}, {5,1,6}, {5,1,6},
+ {1,5,8}, {11,1,8}, {0,11,8}, {0,10,8},
+ {13,1,8}, {12,1,8}, {3,2,8}, {1,4,8},
+ {2,1,5}, {2,1,5}, {2,1,5}, {2,1,5},
+ {2,1,5}, {2,1,5}, {2,1,5}, {2,1,5},
+ {1,2,5}, {1,2,5}, {1,2,5}, {1,2,5},
+ {1,2,5}, {1,2,5}, {1,2,5}, {1,2,5},
+ {3,1,5}, {3,1,5}, {3,1,5}, {3,1,5},
+ {3,1,5}, {3,1,5}, {3,1,5}, {3,1,5},
+ {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
+ {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
+ {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
+ {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
+ {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
+ {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
+ {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
+ {1,1,3}, {1,1,3}, {1,1,3}, {1,1,3},
+ {64,0,4}, {64,0,4}, {64,0,4}, {64,0,4}, /* EOB */
+ {64,0,4}, {64,0,4}, {64,0,4}, {64,0,4},
+ {64,0,4}, {64,0,4}, {64,0,4}, {64,0,4},
+ {64,0,4}, {64,0,4}, {64,0,4}, {64,0,4},
+ {0,3,4}, {0,3,4}, {0,3,4}, {0,3,4},
+ {0,3,4}, {0,3,4}, {0,3,4}, {0,3,4},
+ {0,3,4}, {0,3,4}, {0,3,4}, {0,3,4},
+ {0,3,4}, {0,3,4}, {0,3,4}, {0,3,4},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,1,2}, {0,1,2}, {0,1,2}, {0,1,2},
+ {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
+ {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
+ {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
+ {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
+ {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
+ {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
+ {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
+ {0,2,3}, {0,2,3}, {0,2,3}, {0,2,3},
+ {0,4,5}, {0,4,5}, {0,4,5}, {0,4,5},
+ {0,4,5}, {0,4,5}, {0,4,5}, {0,4,5},
+ {0,5,5}, {0,5,5}, {0,5,5}, {0,5,5},
+ {0,5,5}, {0,5,5}, {0,5,5}, {0,5,5},
+ {9,1,7}, {9,1,7}, {1,3,7}, {1,3,7},
+ {10,1,7}, {10,1,7}, {0,8,7}, {0,8,7},
+ {0,9,7}, {0,9,7}, {0,12,8}, {0,13,8},
+ {2,3,8}, {4,2,8}, {0,14,8}, {0,15,8}
+};
+
+/* Table B-14, DCT coefficients table zero,
+ * codes 0000001000 ... 0000001111
+ */
+static DCTtab DCTtab1[8] =
+{
+ {16,1,10}, {5,2,10}, {0,7,10}, {2,3,10},
+ {1,4,10}, {15,1,10}, {14,1,10}, {4,2,10}
+};
+
+/* Table B-15, DCT coefficients table one,
+ * codes 000000100x ... 000000111x
+ */
+static DCTtab DCTtab1a[8] =
+{
+ {5,2,9}, {5,2,9}, {14,1,9}, {14,1,9},
+ {2,4,10}, {16,1,10}, {15,1,9}, {15,1,9}
+};
+
+/* Table B-14/15, DCT coefficients table zero / one,
+ * codes 000000010000 ... 000000011111
+ */
+static DCTtab DCTtab2[16] =
+{
+ {0,11,12}, {8,2,12}, {4,3,12}, {0,10,12},
+ {2,4,12}, {7,2,12}, {21,1,12}, {20,1,12},
+ {0,9,12}, {19,1,12}, {18,1,12}, {1,5,12},
+ {3,3,12}, {0,8,12}, {6,2,12}, {17,1,12}
+};
+
+/* Table B-14/15, DCT coefficients table zero / one,
+ * codes 0000000010000 ... 0000000011111
+ */
+static DCTtab DCTtab3[16] =
+{
+ {10,2,13}, {9,2,13}, {5,3,13}, {3,4,13},
+ {2,5,13}, {1,7,13}, {1,6,13}, {0,15,13},
+ {0,14,13}, {0,13,13}, {0,12,13}, {26,1,13},
+ {25,1,13}, {24,1,13}, {23,1,13}, {22,1,13}
+};
+
+/* Table B-14/15, DCT coefficients table zero / one,
+ * codes 00000000010000 ... 00000000011111
+ */
+static DCTtab DCTtab4[16] =
+{
+ {0,31,14}, {0,30,14}, {0,29,14}, {0,28,14},
+ {0,27,14}, {0,26,14}, {0,25,14}, {0,24,14},
+ {0,23,14}, {0,22,14}, {0,21,14}, {0,20,14},
+ {0,19,14}, {0,18,14}, {0,17,14}, {0,16,14}
+};
+
+/* Table B-14/15, DCT coefficients table zero / one,
+ * codes 000000000010000 ... 000000000011111
+ */
+static DCTtab DCTtab5[16] =
+{
+ {0,40,15}, {0,39,15}, {0,38,15}, {0,37,15},
+ {0,36,15}, {0,35,15}, {0,34,15}, {0,33,15},
+ {0,32,15}, {1,14,15}, {1,13,15}, {1,12,15},
+ {1,11,15}, {1,10,15}, {1,9,15}, {1,8,15}
+};
+
+/* Table B-14/15, DCT coefficients table zero / one,
+ * codes 0000000000010000 ... 0000000000011111
+ */
+static DCTtab DCTtab6[16] =
+{
+ {1,18,16}, {1,17,16}, {1,16,16}, {1,15,16},
+ {6,3,16}, {16,2,16}, {15,2,16}, {14,2,16},
+ {13,2,16}, {12,2,16}, {11,2,16}, {31,1,16},
+ {30,1,16}, {29,1,16}, {28,1,16}, {27,1,16}
+};
+
+/* Table B-3, macroblock_type in P-pictures, codes 001..1xx */
+static VLCtab PMBtab0[8] =
+{
+ {ERROR_VALUE,0},
+ {MACROBLOCK_MOTION_FORWARD,3},
+ {MACROBLOCK_PATTERN,2}, {MACROBLOCK_PATTERN,2},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_PATTERN,1},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_PATTERN,1},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_PATTERN,1},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_PATTERN,1}
+};
+
+/* Table B-3, macroblock_type in P-pictures, codes 000001..00011x */
+static VLCtab PMBtab1[8] =
+{
+ {ERROR_VALUE,0},
+ {MACROBLOCK_QUANT|MACROBLOCK_INTRA,6},
+ {MACROBLOCK_QUANT|MACROBLOCK_PATTERN,5}, {MACROBLOCK_QUANT|MACROBLOCK_PATTERN,5},
+ {MACROBLOCK_QUANT|MACROBLOCK_MOTION_FORWARD|MACROBLOCK_PATTERN,5}, {MACROBLOCK_QUANT|MACROBLOCK_MOTION_FORWARD|MACROBLOCK_PATTERN,5},
+ {MACROBLOCK_INTRA,5}, {MACROBLOCK_INTRA,5}
+};
+
+/* Table B-4, macroblock_type in B-pictures, codes 0010..11xx */
+static VLCtab BMBtab0[16] =
+{
+ {ERROR_VALUE,0},
+ {ERROR_VALUE,0},
+ {MACROBLOCK_MOTION_FORWARD,4},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_PATTERN,4},
+ {MACROBLOCK_MOTION_BACKWARD,3},
+ {MACROBLOCK_MOTION_BACKWARD,3},
+ {MACROBLOCK_MOTION_BACKWARD|MACROBLOCK_PATTERN,3},
+ {MACROBLOCK_MOTION_BACKWARD|MACROBLOCK_PATTERN,3},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD,2},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD,2},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD,2},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD,2},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD|MACROBLOCK_PATTERN,2},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD|MACROBLOCK_PATTERN,2},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD|MACROBLOCK_PATTERN,2},
+ {MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD|MACROBLOCK_PATTERN,2}
+};
+
+/* Table B-4, macroblock_type in B-pictures, codes 000001..00011x */
+static VLCtab BMBtab1[8] =
+{
+ {ERROR_VALUE,0},
+ {MACROBLOCK_QUANT|MACROBLOCK_INTRA,6},
+ {MACROBLOCK_QUANT|MACROBLOCK_MOTION_BACKWARD|MACROBLOCK_PATTERN,6},
+ {MACROBLOCK_QUANT|MACROBLOCK_MOTION_FORWARD|MACROBLOCK_PATTERN,6},
+ {MACROBLOCK_QUANT|MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD|MACROBLOCK_PATTERN,5},
+ {MACROBLOCK_QUANT|MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD|MACROBLOCK_PATTERN,5},
+ {MACROBLOCK_INTRA,5},
+ {MACROBLOCK_INTRA,5}
+};
+
+//
+// getbit
+//
+
+void CMPEG2Dec::Initialize_Buffer()
+{
+ Rdptr = Rdbfr + BUFFER_SIZE;
+ Rdmax = Rdptr;
+
+ if (SystemStream_Flag)
+ {
+ if (Rdptr >= Rdmax)
+ Next_Packet();
+ CurrentBfr = *Rdptr++ << 24;
+
+ if (Rdptr >= Rdmax)
+ Next_Packet();
+ CurrentBfr += *Rdptr++ << 16;
+
+ if (Rdptr >= Rdmax)
+ Next_Packet();
+ CurrentBfr += *Rdptr++ << 8;
+
+ if (Rdptr >= Rdmax)
+ Next_Packet();
+ CurrentBfr += *Rdptr++;
+
+ Fill_Next();
+ }
+ else
+ {
+ Fill_Buffer();
+
+ CurrentBfr = (*Rdptr << 24) + (*(Rdptr+1) << 16) + (*(Rdptr+2) << 8) + *(Rdptr+3);
+ Rdptr += 4;
+
+ Fill_Next();
+ }
+
+ BitsLeft = 32;
+}
+
+unsigned int CMPEG2Dec::Get_Bits_All(unsigned int N)
+{
+ N -= BitsLeft;
+ Val = (CurrentBfr << (32 - BitsLeft)) >> (32 - BitsLeft);
+
+ if (N != 0)
+ Val = (Val << N) + (NextBfr >> (32 - N));
+
+ CurrentBfr = NextBfr;
+ BitsLeft = 32 - N;
+ Fill_Next();
+
+ return Val;
+}
+
+void CMPEG2Dec::Flush_Buffer_All(unsigned int N)
+{
+ CurrentBfr = NextBfr;
+ BitsLeft = BitsLeft + 32 - N;
+ Fill_Next();
+}
+
+void CMPEG2Dec::Next_Packet()
+{
+ unsigned int code, Packet_Length, Packet_Header_Length;
+
+ for (;;)
+ {
+ code = Get_Short();
+ code = (code<<16) + Get_Short();
+
+ // remove system layer byte stuffing
+ while ((code & 0xffffff00) != 0x00000100)
+ code = (code<<8) + Get_Byte();
+
+ switch (code)
+ {
+ case PACK_START_CODE:
+ Rdptr += 8;
+ break;
+
+ case VIDEO_ELEMENTARY_STREAM:
+ Packet_Length = Get_Short();
+ Rdmax = Rdptr + Packet_Length;
+
+ code = Get_Byte();
+
+ if ((code & 0xc0)==0x80)
+ {
+ code = Get_Byte();
+ Packet_Header_Length = Get_Byte();
+
+ Rdptr += Packet_Header_Length;
+ return;
+ }
+ else
+ Rdptr += Packet_Length-1;
+ break;
+
+ default:
+ if (code>=SYSTEM_START_CODE)
+ {
+ code = Get_Short();
+ Rdptr += code;
+ }
+ break;
+ }
+ }
+}
+
+void CMPEG2Dec::Fill_Buffer()
+{
+ Read = _read(Infile[File_Flag], Rdbfr, BUFFER_SIZE);
+
+ if (Read < BUFFER_SIZE)
+ Next_File();
+
+ if (KeyOp_Flag && (Rdbfr[20] & 0x10))
+ {
+ BufferOp(Rdbfr, lfsr0, lfsr1);
+ Rdbfr[20] &= ~0x10;
+ }
+
+ Rdptr = Rdbfr;
+
+ if (SystemStream_Flag)
+ Rdmax -= BUFFER_SIZE;
+}
+
+void CMPEG2Dec::Next_File()
+{
+ if (File_Flag < File_Limit-1)
+ File_Flag ++;
+
+ _lseeki64(Infile[File_Flag], 0, SEEK_SET);
+ _read(Infile[File_Flag], Rdbfr + Read, BUFFER_SIZE - Read);
+}
+
+
+unsigned int CMPEG2Dec::Show_Bits(unsigned int N)
+{
+ if (N <= BitsLeft)
+ return (CurrentBfr << (32 - BitsLeft)) >> (32 - N);
+ else
+ {
+ N -= BitsLeft;
+ return (((CurrentBfr << (32 - BitsLeft)) >> (32 - BitsLeft)) << N) + (NextBfr >> (32 - N));
+ }
+}
+
+unsigned int CMPEG2Dec::Get_Bits(unsigned int N)
+{
+ if (N < BitsLeft)
+ {
+ Val = (CurrentBfr << (32 - BitsLeft)) >> (32 - N);
+ BitsLeft -= N;
+ return Val;
+ }
+ else
+ return Get_Bits_All(N);
+}
+
+void CMPEG2Dec::Flush_Buffer(unsigned int N)
+{
+ if (N < BitsLeft)
+ BitsLeft -= N;
+ else
+ Flush_Buffer_All(N);
+}
+
+void CMPEG2Dec::Fill_Next()
+{
+ if (SystemStream_Flag && Rdptr>=Rdmax-4)
+ {
+ if (Rdptr >= Rdmax)
+ Next_Packet();
+ NextBfr = Get_Byte() << 24;
+
+ if (Rdptr >= Rdmax)
+ Next_Packet();
+ NextBfr += Get_Byte() << 16;
+
+ if (Rdptr >= Rdmax)
+ Next_Packet();
+ NextBfr += Get_Byte() << 8;
+
+ if (Rdptr >= Rdmax)
+ Next_Packet();
+ NextBfr += Get_Byte();
+ }
+ else if (Rdptr < Rdbfr+BUFFER_SIZE-4)
+ {
+ NextBfr = (*Rdptr << 24) + (*(Rdptr+1) << 16) + (*(Rdptr+2) << 8) + *(Rdptr+3);
+ Rdptr += 4;
+ }
+ else
+ {
+ if (Rdptr >= Rdbfr+BUFFER_SIZE)
+ Fill_Buffer();
+ NextBfr = *Rdptr++ << 24;
+
+ if (Rdptr >= Rdbfr+BUFFER_SIZE)
+ Fill_Buffer();
+ NextBfr += *Rdptr++ << 16;
+
+ if (Rdptr >= Rdbfr+BUFFER_SIZE)
+ Fill_Buffer();
+ NextBfr += *Rdptr++ << 8;
+
+ if (Rdptr >= Rdbfr+BUFFER_SIZE)
+ Fill_Buffer();
+ NextBfr += *Rdptr++;
+ }
+}
+
+unsigned int CMPEG2Dec::Get_Byte()
+{
+ while (Rdptr >= (Rdbfr + BUFFER_SIZE))
+ {
+ Read = _read(Infile[File_Flag], Rdbfr, BUFFER_SIZE);
+
+ if (Read < BUFFER_SIZE)
+ Next_File();
+
+ if (KeyOp_Flag && (Rdbfr[20] & 0x10))
+ {
+ BufferOp(Rdbfr, lfsr0, lfsr1);
+ Rdbfr[20] &= ~0x10;
+ }
+
+ Rdptr -= BUFFER_SIZE;
+ Rdmax -= BUFFER_SIZE;
+ }
+
+ return *Rdptr++;
+}
+
+unsigned int CMPEG2Dec::Get_Short()
+{
+ unsigned int i = Get_Byte();
+ return (i<<8) + Get_Byte();
+}
+
+void CMPEG2Dec::next_start_code()
+{
+ Flush_Buffer(BitsLeft & 7);
+
+ while (Show_Bits(24) != 1)
+ Flush_Buffer(8);
+}
+
+//
+// gethdr
+//
+
+int CMPEG2Dec::Get_Hdr()
+{
+ for (;;)
+ {
+ /* look for next_start_code */
+ next_start_code();
+
+ switch (Get_Bits(32))
+ {
+ case SEQUENCE_HEADER_CODE:
+ sequence_header();
+ break;
+
+ case GROUP_START_CODE:
+ group_of_pictures_header();
+ break;
+
+ case PICTURE_START_CODE:
+ picture_header();
+ return 1;
+ }
+ }
+}
+
+/* decode group of pictures header */
+/* ISO/IEC 13818-2 section 6.2.2.6 */
+void CMPEG2Dec::group_of_pictures_header()
+{
+ int gop_hour;
+ int gop_minute;
+ int gop_sec;
+ int gop_frame;
+
+ int drop_flag;
+ int closed_gop;
+ int broken_link;
+
+ drop_flag = Get_Bits(1);
+ gop_hour = Get_Bits(5);
+ gop_minute = Get_Bits(6);
+ Flush_Buffer(1); // marker bit
+ gop_sec = Get_Bits(6);
+ gop_frame = Get_Bits(6);
+ closed_gop = Get_Bits(1);
+ broken_link = Get_Bits(1);
+
+ extension_and_user_data();
+}
+
+/* decode picture header */
+/* ISO/IEC 13818-2 section 6.2.3 */
+void CMPEG2Dec::picture_header()
+{
+ int vbv_delay;
+ int full_pel_forward_vector;
+ int forward_f_code;
+ int full_pel_backward_vector;
+ int backward_f_code;
+ int Extra_Information_Byte_Count;
+
+ temporal_reference = Get_Bits(10);
+ picture_coding_type = Get_Bits(3);
+ vbv_delay = Get_Bits(16);
+
+ if (picture_coding_type==P_TYPE || picture_coding_type==B_TYPE)
+ {
+ full_pel_forward_vector = Get_Bits(1);
+ forward_f_code = Get_Bits(3);
+ }
+
+ if (picture_coding_type==B_TYPE)
+ {
+ full_pel_backward_vector = Get_Bits(1);
+ backward_f_code = Get_Bits(3);
+ }
+
+ Extra_Information_Byte_Count = extra_bit_information();
+ extension_and_user_data();
+}
+
+/* decode sequence header */
+void CMPEG2Dec::sequence_header()
+{
+ int frame_rate_code;
+ int vbv_buffer_size;
+ int aspect_ratio_information;
+ int bit_rate_value;
+
+ int constrained_parameters_flag;
+ int i;
+
+ horizontal_size = Get_Bits(12);
+ vertical_size = Get_Bits(12);
+ aspect_ratio_information = Get_Bits(4);
+ frame_rate_code = Get_Bits(4);
+ bit_rate_value = Get_Bits(18);
+ Flush_Buffer(1); // marker bit
+ vbv_buffer_size = Get_Bits(10);
+ constrained_parameters_flag = Get_Bits(1);
+
+ if (load_intra_quantizer_matrix = Get_Bits(1))
+ {
+ for (i=0; i<64; i++)
+ intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
+ }
+ else
+ {
+ for (i=0; i<64; i++)
+ intra_quantizer_matrix[i] = default_intra_quantizer_matrix[i];
+ }
+
+ if (load_non_intra_quantizer_matrix = Get_Bits(1))
+ {
+ for (i=0; i<64; i++)
+ non_intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
+ }
+ else
+ {
+ for (i=0; i<64; i++)
+ non_intra_quantizer_matrix[i] = 16;
+ }
+
+ /* copy luminance to chrominance matrices */
+ for (i=0; i<64; i++)
+ {
+ chroma_intra_quantizer_matrix[i] = intra_quantizer_matrix[i];
+ chroma_non_intra_quantizer_matrix[i] = non_intra_quantizer_matrix[i];
+ }
+ extension_and_user_data();
+}
+
+/* decode slice header */
+/* ISO/IEC 13818-2 section 6.2.4 */
+int CMPEG2Dec::slice_header()
+{
+ int slice_vertical_position_extension;
+ int quantizer_scale_code;
+ int slice_picture_id_enable = 0;
+ int slice_picture_id = 0;
+ int extra_information_slice = 0;
+
+ slice_vertical_position_extension = vertical_size>2800 ? Get_Bits(3) : 0;
+
+ quantizer_scale_code = Get_Bits(5);
+ quantizer_scale = q_scale_type ? Non_Linear_quantizer_scale[quantizer_scale_code] : quantizer_scale_code<<1;
+
+ /* slice_id introduced in March 1995 as part of the video corridendum
+ (after the IS was drafted in November 1994) */
+ if (Get_Bits(1))
+ {
+ Get_Bits(1); // intra slice
+
+ slice_picture_id_enable = Get_Bits(1);
+ slice_picture_id = Get_Bits(6);
+
+ extra_information_slice = extra_bit_information();
+ }
+
+ return slice_vertical_position_extension;
+}
+
+/* decode extension and user data */
+/* ISO/IEC 13818-2 section 6.2.2.2 */
+void CMPEG2Dec::extension_and_user_data()
+{
+ int code, ext_ID;
+
+ next_start_code();
+
+ while ((code = Show_Bits(32))==EXTENSION_START_CODE || code==USER_DATA_START_CODE)
+ {
+ if (code==EXTENSION_START_CODE)
+ {
+ Flush_Buffer(32);
+ ext_ID = Get_Bits(4);
+
+ switch (ext_ID)
+ {
+ case SEQUENCE_EXTENSION_ID:
+ sequence_extension();
+ break;
+
+ case SEQUENCE_DISPLAY_EXTENSION_ID:
+ sequence_display_extension();
+ break;
+
+ case QUANT_MATRIX_EXTENSION_ID:
+ quant_matrix_extension();
+ break;
+
+ case PICTURE_DISPLAY_EXTENSION_ID:
+ picture_display_extension();
+ break;
+
+ case PICTURE_CODING_EXTENSION_ID:
+ picture_coding_extension();
+ break;
+
+ case COPYRIGHT_EXTENSION_ID:
+ copyright_extension();
+ break;
+ }
+ next_start_code();
+ }
+ else
+ {
+ Flush_Buffer(32);
+ next_start_code();
+ }
+ }
+}
+
+/* decode sequence extension */
+/* ISO/IEC 13818-2 section 6.2.2.3 */
+void CMPEG2Dec::sequence_extension()
+{
+ int profile_and_level_indication;
+ int low_delay;
+ int frame_rate_extension_n;
+ int frame_rate_extension_d;
+
+ int horizontal_size_extension;
+ int vertical_size_extension;
+ int bit_rate_extension;
+ int vbv_buffer_size_extension;
+
+ profile_and_level_indication = Get_Bits(8);
+ progressive_sequence = Get_Bits(1);
+ chroma_format = Get_Bits(2);
+ horizontal_size_extension = Get_Bits(2);
+ vertical_size_extension = Get_Bits(2);
+ bit_rate_extension = Get_Bits(12);
+ Flush_Buffer(1); // marker bit
+ vbv_buffer_size_extension = Get_Bits(8);
+ low_delay = Get_Bits(1);
+
+ frame_rate_extension_n = Get_Bits(2);
+ frame_rate_extension_d = Get_Bits(5);
+
+ horizontal_size = (horizontal_size_extension<<12) | (horizontal_size&0x0fff);
+ vertical_size = (vertical_size_extension<<12) | (vertical_size&0x0fff);
+}
+
+/* decode sequence display extension */
+void CMPEG2Dec::sequence_display_extension()
+{
+ int video_format;
+ int color_description;
+ int color_primaries;
+ int transfer_characteristics;
+ int matrix_coefficients;
+ int display_horizontal_size;
+ int display_vertical_size;
+
+ video_format = Get_Bits(3);
+ color_description = Get_Bits(1);
+
+ if (color_description)
+ {
+ color_primaries = Get_Bits(8);
+ transfer_characteristics = Get_Bits(8);
+ matrix_coefficients = Get_Bits(8);
+ }
+
+ display_horizontal_size = Get_Bits(14);
+ Flush_Buffer(1); // marker bit
+ display_vertical_size = Get_Bits(14);
+}
+
+/* decode quant matrix entension */
+/* ISO/IEC 13818-2 section 6.2.3.2 */
+void CMPEG2Dec::quant_matrix_extension()
+{
+ int i;
+
+ if (load_intra_quantizer_matrix = Get_Bits(1))
+ for (i=0; i<64; i++)
+ chroma_intra_quantizer_matrix[scan[ZIG_ZAG][i]]
+ = intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
+
+ if (load_non_intra_quantizer_matrix = Get_Bits(1))
+ for (i=0; i<64; i++)
+ chroma_non_intra_quantizer_matrix[scan[ZIG_ZAG][i]]
+ = non_intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
+
+ if (load_chroma_intra_quantizer_matrix = Get_Bits(1))
+ for (i=0; i<64; i++)
+ chroma_intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
+
+ if (load_chroma_non_intra_quantizer_matrix = Get_Bits(1))
+ for (i=0; i<64; i++)
+ chroma_non_intra_quantizer_matrix[scan[ZIG_ZAG][i]] = Get_Bits(8);
+}
+
+/* decode picture display extension */
+/* ISO/IEC 13818-2 section 6.2.3.3. */
+void CMPEG2Dec::picture_display_extension()
+{
+ int frame_center_horizontal_offset[3];
+ int frame_center_vertical_offset[3];
+
+ int i;
+ int number_of_frame_center_offsets;
+
+ /* based on ISO/IEC 13818-2 section 6.3.12
+ (November 1994) Picture display extensions */
+
+ /* derive number_of_frame_center_offsets */
+ if (progressive_sequence)
+ {
+ if (repeat_first_field)
+ {
+ if (top_field_first)
+ number_of_frame_center_offsets = 3;
+ else
+ number_of_frame_center_offsets = 2;
+ }
+ else
+ number_of_frame_center_offsets = 1;
+ }
+ else
+ {
+ if (picture_structure!=FRAME_PICTURE)
+ number_of_frame_center_offsets = 1;
+ else
+ {
+ if (repeat_first_field)
+ number_of_frame_center_offsets = 3;
+ else
+ number_of_frame_center_offsets = 2;
+ }
+ }
+
+ /* now parse */
+ for (i=0; i<number_of_frame_center_offsets; i++)
+ {
+ frame_center_horizontal_offset[i] = Get_Bits(16);
+ Flush_Buffer(1); // marker bit
+
+ frame_center_vertical_offset[i] = Get_Bits(16);
+ Flush_Buffer(1); // marker bit
+ }
+}
+
+/* decode picture coding extension */
+void CMPEG2Dec::picture_coding_extension()
+{
+ int chroma_420_type;
+ int composite_display_flag;
+ int v_axis;
+ int field_sequence;
+ int sub_carrier;
+ int burst_amplitude;
+ int sub_carrier_phase;
+
+ f_code[0][0] = Get_Bits(4);
+ f_code[0][1] = Get_Bits(4);
+ f_code[1][0] = Get_Bits(4);
+ f_code[1][1] = Get_Bits(4);
+
+ intra_dc_precision = Get_Bits(2);
+ picture_structure = Get_Bits(2);
+ top_field_first = Get_Bits(1);
+ frame_pred_frame_dct = Get_Bits(1);
+ concealment_motion_vectors = Get_Bits(1);
+ q_scale_type = Get_Bits(1);
+ intra_vlc_format = Get_Bits(1);
+ alternate_scan = Get_Bits(1);
+ repeat_first_field = Get_Bits(1);
+ chroma_420_type = Get_Bits(1);
+ progressive_frame = Get_Bits(1);
+ composite_display_flag = Get_Bits(1);
+
+ pf_current = progressive_frame;
+
+ if (composite_display_flag)
+ {
+ v_axis = Get_Bits(1);
+ field_sequence = Get_Bits(3);
+ sub_carrier = Get_Bits(1);
+ burst_amplitude = Get_Bits(7);
+ sub_carrier_phase = Get_Bits(8);
+ }
+}
+
+/* decode extra bit information */
+/* ISO/IEC 13818-2 section 6.2.3.4. */
+int CMPEG2Dec::extra_bit_information()
+{
+ int Byte_Count = 0;
+
+ while (Get_Bits(1))
+ {
+ Flush_Buffer(8);
+ Byte_Count ++;
+ }
+
+ return(Byte_Count);
+}
+
+/* Copyright extension */
+/* ISO/IEC 13818-2 section 6.2.3.6. */
+/* (header added in November, 1994 to the IS document) */
+void CMPEG2Dec::copyright_extension()
+{
+ int copyright_flag;
+ int copyright_identifier;
+ int original_or_copy;
+ int copyright_number_1;
+ int copyright_number_2;
+ int copyright_number_3;
+
+ int reserved_data;
+
+ copyright_flag = Get_Bits(1);
+ copyright_identifier = Get_Bits(8);
+ original_or_copy = Get_Bits(1);
+
+ /* reserved */
+ reserved_data = Get_Bits(7);
+
+ Flush_Buffer(1); // marker bit
+ copyright_number_1 = Get_Bits(20);
+ Flush_Buffer(1); // marker bit
+ copyright_number_2 = Get_Bits(22);
+ Flush_Buffer(1); // marker bit
+ copyright_number_3 = Get_Bits(22);
+}
+
+//
+// getpic
+//
+
+static const unsigned char cc_table[12] = {
+ 0, 0, 0, 0, 1, 2, 1, 2, 1, 2, 1, 2
+};
+
+void CMPEG2Dec::Decode_Picture(int ref, unsigned char *dst, int pitch)
+{
+ if (picture_structure==FRAME_PICTURE && Second_Field)
+ Second_Field = 0;
+
+ if (picture_coding_type!=B_TYPE)
+ {
+ pf_forward = pf_backward;
+ pf_backward = pf_current;
+ }
+
+ Update_Picture_Buffers();
+
+ picture_data();
+
+ if (ref && (picture_structure==FRAME_PICTURE || Second_Field))
+ {
+ if (picture_coding_type==B_TYPE)
+ assembleFrame(auxframe, pf_current, dst, pitch);
+ else
+ assembleFrame(forward_reference_frame, pf_forward, dst, pitch);
+ }
+
+ if (picture_structure!=FRAME_PICTURE)
+ Second_Field = !Second_Field;
+}
+
+/* reuse old picture buffers as soon as they are no longer needed */
+void CMPEG2Dec::Update_Picture_Buffers()
+{
+ int cc; /* color component index */
+ unsigned char *tmp; /* temporary swap pointer */
+
+ for (cc=0; cc<3; cc++)
+ {
+ /* B pictures do not need to be save for future reference */
+ if (picture_coding_type==B_TYPE)
+ current_frame[cc] = auxframe[cc];
+ else
+ {
+ if (!Second_Field)
+ {
+ /* only update at the beginning of the coded frame */
+ tmp = forward_reference_frame[cc];
+
+ /* the previously decoded reference frame is stored coincident with the
+ location where the backward reference frame is stored (backwards
+ prediction is not needed in P pictures) */
+ forward_reference_frame[cc] = backward_reference_frame[cc];
+
+ /* update pointer for potential future B pictures */
+ backward_reference_frame[cc] = tmp;
+ }
+
+ /* can erase over old backward reference frame since it is not used
+ in a P picture, and since any subsequent B pictures will use the
+ previously decoded I or P frame as the backward_reference_frame */
+ current_frame[cc] = backward_reference_frame[cc];
+ }
+
+ if (picture_structure==BOTTOM_FIELD)
+ current_frame[cc] += (cc==0) ? Coded_Picture_Width : Chroma_Width;
+ }
+}
+
+/* decode all macroblocks of the current picture */
+/* stages described in ISO/IEC 13818-2 section 7 */
+void CMPEG2Dec::picture_data()
+{
+ int MBAmax;
+
+ /* number of macroblocks per picture */
+ MBAmax = mb_width*mb_height;
+
+ if (picture_structure!=FRAME_PICTURE)
+ MBAmax>>=1;
+
+ for (;;)
+ if (slice(MBAmax)<0)
+ return;
+}
+
+/* decode all macroblocks of the current picture */
+/* ISO/IEC 13818-2 section 6.3.16 */
+/* return 0 : go to next slice */
+/* return -1: go to next picture */
+int CMPEG2Dec::slice(int MBAmax)
+{
+ int MBA = 0, MBAinc =0, macroblock_type, motion_type, dct_type, ret;
+ int dc_dct_pred[3], PMV[2][2][2], motion_vertical_field_select[2][2], dmvector[2];
+
+ if ((ret=start_of_slice(&MBA, &MBAinc, dc_dct_pred, PMV))!=1)
+ return ret;
+
+ for (;;)
+ {
+ /* this is how we properly exit out of picture */
+ if (MBA>=MBAmax) return -1; // all macroblocks decoded
+
+ if (MBAinc==0)
+ {
+ if (!Show_Bits(23) || Fault_Flag) // next_start_code or fault
+ {
+resync:
+ Fault_Flag = 0;
+ return 0; // trigger: go to next slice
+ }
+ else /* neither next_start_code nor Fault_Flag */
+ {
+ /* decode macroblock address increment */
+ MBAinc = Get_macroblock_address_increment();
+ if (Fault_Flag) goto resync;
+ }
+ }
+
+ if (MBAinc==1) /* not skipped */
+ {
+ if (!decode_macroblock(&macroblock_type, &motion_type, &dct_type, PMV,
+ dc_dct_pred, motion_vertical_field_select, dmvector))
+ goto resync;
+ }
+ else /* MBAinc!=1: skipped macroblock */
+ /* ISO/IEC 13818-2 section 7.6.6 */
+ skipped_macroblock(dc_dct_pred, PMV, &motion_type, motion_vertical_field_select, &macroblock_type);
+
+ /* ISO/IEC 13818-2 section 7.6 */
+ motion_compensation(MBA, macroblock_type, motion_type, PMV,
+ motion_vertical_field_select, dmvector, dct_type);
+
+ /* advance to next macroblock */
+ MBA++; MBAinc--;
+
+ if (MBA>=MBAmax) return -1; // all macroblocks decoded
+ }
+}
+
+/* ISO/IEC 13818-2 section 6.3.17.1: Macroblock modes */
+void CMPEG2Dec::macroblock_modes(int *pmacroblock_type, int *pmotion_type,
+ int *pmotion_vector_count, int *pmv_format,
+ int *pdmv, int *pmvscale, int *pdct_type)
+{
+ int macroblock_type, motion_type = 0, motion_vector_count;
+ int mv_format, dmv, mvscale, dct_type;
+
+ /* get macroblock_type */
+ macroblock_type = Get_macroblock_type();
+ if (Fault_Flag) return;
+
+ /* get frame/field motion type */
+ if (macroblock_type & (MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD))
+ {
+ if (picture_structure==FRAME_PICTURE)
+ motion_type = frame_pred_frame_dct ? MC_FRAME : Get_Bits(2);
+ else
+ motion_type = Get_Bits(2);
+ }
+ else if ((macroblock_type & MACROBLOCK_INTRA) && concealment_motion_vectors)
+ motion_type = (picture_structure==FRAME_PICTURE) ? MC_FRAME : MC_FIELD;
+
+ /* derive motion_vector_count, mv_format and dmv, (table 6-17, 6-18) */
+ if (picture_structure==FRAME_PICTURE)
+ {
+ motion_vector_count = (motion_type==MC_FIELD) ? 2 : 1;
+ mv_format = (motion_type==MC_FRAME) ? MV_FRAME : MV_FIELD;
+ }
+ else
+ {
+ motion_vector_count = (motion_type==MC_16X8) ? 2 : 1;
+ mv_format = MV_FIELD;
+ }
+
+ dmv = (motion_type==MC_DMV); /* dual prime */
+
+ /*
+ field mv predictions in frame pictures have to be scaled
+ ISO/IEC 13818-2 section 7.6.3.1 Decoding the motion vectors
+ */
+ mvscale = (mv_format==MV_FIELD && picture_structure==FRAME_PICTURE);
+
+ /* get dct_type (frame DCT / field DCT) */
+ dct_type = (picture_structure==FRAME_PICTURE) && (!frame_pred_frame_dct)
+ && (macroblock_type & (MACROBLOCK_PATTERN|MACROBLOCK_INTRA)) ? Get_Bits(1) : 0;
+
+ /* return values */
+ *pmacroblock_type = macroblock_type;
+ *pmotion_type = motion_type;
+ *pmotion_vector_count = motion_vector_count;
+ *pmv_format = mv_format;
+ *pdmv = dmv;
+ *pmvscale = mvscale;
+ *pdct_type = dct_type;
+}
+
+/* move/add 8x8-Block from block[comp] to backward_reference_frame */
+/* copy reconstructed 8x8 block from block[comp] to current_frame[]
+ ISO/IEC 13818-2 section 7.6.8: Adding prediction and coefficient data
+ This stage also embodies some of the operations implied by:
+ - ISO/IEC 13818-2 section 7.6.7: Combining predictions
+ - ISO/IEC 13818-2 section 6.1.3: Macroblock
+*/
+void CMPEG2Dec::Add_Block(int count, int bx, int by, int dct_type, int addflag)
+{
+ static const __int64 mmmask_128 = 0x0080008000800080;
+
+ int comp, cc, iincr, bxh, byh;
+ unsigned char *rfp;
+ short *Block_Ptr;
+
+ for (comp=0; comp<count; comp++)
+ {
+ Block_Ptr = block[comp];
+ cc = cc_table[comp];
+
+ bxh = bx; byh = by;
+
+ if (cc==0)
+ {
+ if (picture_structure==FRAME_PICTURE)
+ {
+ if (dct_type)
+ {
+ rfp = current_frame[0] + Coded_Picture_Width*(by+((comp&2)>>1)) + bx + ((comp&1)<<3);
+ iincr = Coded_Picture_Width<<1;
+ }
+ else
+ {
+ rfp = current_frame[0] + Coded_Picture_Width*(by+((comp&2)<<2)) + bx + ((comp&1)<<3);
+ iincr = Coded_Picture_Width;
+ }
+ }
+ else
+ {
+ rfp = current_frame[0] + (Coded_Picture_Width<<1)*(by+((comp&2)<<2)) + bx + ((comp&1)<<3);
+ iincr = Coded_Picture_Width<<1;
+ }
+ }
+ else
+ {
+ if (chroma_format!=CHROMA444)
+ bxh >>= 1;
+ if (chroma_format==CHROMA420)
+ byh >>= 1;
+
+ if (picture_structure==FRAME_PICTURE)
+ {
+ if (dct_type && chroma_format!=CHROMA420)
+ {
+ /* field DCT coding */
+ rfp = current_frame[cc] + Chroma_Width*(byh+((comp&2)>>1)) + bxh + (comp&8);
+ iincr = Chroma_Width<<1;
+ }
+ else
+ {
+ /* frame DCT coding */
+ rfp = current_frame[cc] + Chroma_Width*(byh+((comp&2)<<2)) + bxh + (comp&8);
+ iincr = Chroma_Width;
+ }
+ }
+ else
+ {
+ /* field picture */
+ rfp = current_frame[cc] + (Chroma_Width<<1)*(byh+((comp&2)<<2)) + bxh + (comp&8);
+ iincr = Chroma_Width<<1;
+ }
+ }
+
+ if (addflag)
+ {
+ __asm
+ {
+ pxor mm0, mm0
+ mov eax, [rfp]
+ mov ebx, [Block_Ptr]
+ mov edi, 8
+addon:
+ movq mm2, [ebx+8]
+
+ movq mm3, [eax]
+ movq mm4, mm3
+
+ movq mm1, [ebx]
+ punpckhbw mm3, mm0
+
+ paddsw mm3, mm2
+ packuswb mm3, mm0
+
+ punpcklbw mm4, mm0
+ psllq mm3, 32
+
+ paddsw mm4, mm1
+ packuswb mm4, mm0
+
+ por mm3, mm4
+ add ebx, 16
+
+ dec edi
+ movq [eax], mm3
+
+ add eax, [iincr]
+ cmp edi, 0x00
+ jg addon
+ }
+ }
+ else
+ {
+ __asm
+ {
+ mov eax, [rfp]
+ mov ebx, [Block_Ptr]
+ mov edi, 8
+
+ pxor mm0, mm0
+ movq mm7, [mmmask_128]
+addoff:
+ movq mm3, [ebx+8]
+ movq mm4, [ebx]
+
+ paddsw mm3, mm7
+ paddsw mm4, mm7
+
+ packuswb mm3, mm0
+ packuswb mm4, mm0
+
+ psllq mm3, 32
+ por mm3, mm4
+
+ add ebx, 16
+ dec edi
+
+ movq [eax], mm3
+
+ add eax, [iincr]
+ cmp edi, 0x00
+ jg addoff
+ }
+ }
+ }
+}
+
+/* set scratch pad macroblock to zero */
+void CMPEG2Dec::Clear_Block(int count)
+{
+ int comp;
+ short *Block_Ptr;
+
+ for (comp=0; comp<count; comp++)
+ {
+ Block_Ptr = block[comp];
+
+ __asm
+ {
+ mov eax, [Block_Ptr];
+ pxor mm0, mm0;
+ movq [eax+0 ], mm0;
+ movq [eax+8 ], mm0;
+ movq [eax+16], mm0;
+ movq [eax+24], mm0;
+ movq [eax+32], mm0;
+ movq [eax+40], mm0;
+ movq [eax+48], mm0;
+ movq [eax+56], mm0;
+ movq [eax+64], mm0;
+ movq [eax+72], mm0;
+ movq [eax+80], mm0;
+ movq [eax+88], mm0;
+ movq [eax+96], mm0;
+ movq [eax+104],mm0;
+ movq [eax+112],mm0;
+ movq [eax+120],mm0;
+ }
+ }
+}
+
+/* ISO/IEC 13818-2 section 7.6 */
+void CMPEG2Dec::motion_compensation(int MBA, int macroblock_type, int motion_type,
+ int PMV[2][2][2], int motion_vertical_field_select[2][2],
+ int dmvector[2], int dct_type)
+{
+ int bx, by;
+ int comp;
+
+ /* derive current macroblock position within picture */
+ /* ISO/IEC 13818-2 section 6.3.1.6 and 6.3.1.7 */
+ bx = 16*(MBA%mb_width);
+ by = 16*(MBA/mb_width);
+
+ /* motion compensation */
+ if (!(macroblock_type & MACROBLOCK_INTRA))
+ form_predictions(bx, by, macroblock_type, motion_type, PMV,
+ motion_vertical_field_select, dmvector);
+
+ switch (IDCT_Flag)
+ {
+ case IDCT_MMX:
+ for (comp=0; comp<block_count; comp++)
+ MMX_IDCT(block[comp]);
+ break;
+
+ case IDCT_SSEMMX:
+ for (comp=0; comp<block_count; comp++)
+ SSEMMX_IDCT(block[comp]);
+ break;
+
+ case IDCT_FPU:
+ __asm emms;
+ for (comp=0; comp<block_count; comp++)
+ FPU_IDCT(block[comp]);
+ break;
+
+ case IDCT_REF:
+ __asm emms;
+ for (comp=0; comp<block_count; comp++)
+ REF_IDCT(block[comp]);
+ break;
+ }
+
+ Add_Block(block_count, bx, by, dct_type, (macroblock_type & MACROBLOCK_INTRA)==0);
+}
+
+/* ISO/IEC 13818-2 section 7.6.6 */
+void CMPEG2Dec::skipped_macroblock(int dc_dct_pred[3], int PMV[2][2][2], int *motion_type,
+ int motion_vertical_field_select[2][2], int *macroblock_type)
+{
+ Clear_Block(block_count);
+
+ /* reset intra_dc predictors */
+ /* ISO/IEC 13818-2 section 7.2.1: DC coefficients in intra blocks */
+ dc_dct_pred[0]=dc_dct_pred[1]=dc_dct_pred[2]=0;
+
+ /* reset motion vector predictors */
+ /* ISO/IEC 13818-2 section 7.6.3.4: Resetting motion vector predictors */
+ if (picture_coding_type==P_TYPE)
+ PMV[0][0][0]=PMV[0][0][1]=PMV[1][0][0]=PMV[1][0][1]=0;
+
+ /* derive motion_type */
+ if (picture_structure==FRAME_PICTURE)
+ *motion_type = MC_FRAME;
+ else
+ {
+ *motion_type = MC_FIELD;
+ motion_vertical_field_select[0][0] = motion_vertical_field_select[0][1] =
+ (picture_structure==BOTTOM_FIELD);
+ }
+
+ /* clear MACROBLOCK_INTRA */
+ *macroblock_type&= ~MACROBLOCK_INTRA;
+}
+
+/* return==-1 means go to next picture */
+/* the expression "start of slice" is used throughout the normative
+ body of the MPEG specification */
+int CMPEG2Dec::start_of_slice(int *MBA, int *MBAinc,
+ int dc_dct_pred[3], int PMV[2][2][2])
+{
+ unsigned int code;
+ int slice_vert_pos_ext;
+
+ next_start_code();
+ code = Get_Bits(32);
+
+ if (code<SLICE_START_CODE_MIN || code>SLICE_START_CODE_MAX)
+ {
+ // only slice headers are allowed in picture_data
+ Fault_Flag = 10;
+ return -1;
+ }
+
+ /* decode slice header (may change quantizer_scale) */
+ slice_vert_pos_ext = slice_header();
+
+ /* decode macroblock address increment */
+ *MBAinc = Get_macroblock_address_increment();
+ if (Fault_Flag) return -1;
+
+ /* set current location */
+ /* NOTE: the arithmetic used to derive macroblock_address below is
+ equivalent to ISO/IEC 13818-2 section 6.3.17: Macroblock */
+ *MBA = ((slice_vert_pos_ext<<7) + (code&255) - 1)*mb_width + *MBAinc - 1;
+ *MBAinc = 1; // first macroblock in slice: not skipped
+
+ /* reset all DC coefficient and motion vector predictors */
+ /* ISO/IEC 13818-2 section 7.2.1: DC coefficients in intra blocks */
+ dc_dct_pred[0]=dc_dct_pred[1]=dc_dct_pred[2]=0;
+
+ /* ISO/IEC 13818-2 section 7.6.3.4: Resetting motion vector predictors */
+ PMV[0][0][0]=PMV[0][0][1]=PMV[1][0][0]=PMV[1][0][1]=0;
+ PMV[0][1][0]=PMV[0][1][1]=PMV[1][1][0]=PMV[1][1][1]=0;
+
+ /* successfull: trigger decode macroblocks in slice */
+ return 1;
+}
+
+/* ISO/IEC 13818-2 sections 7.2 through 7.5 */
+int CMPEG2Dec::decode_macroblock(int *macroblock_type, int *motion_type, int *dct_type,
+ int PMV[2][2][2], int dc_dct_pred[3],
+ int motion_vertical_field_select[2][2], int dmvector[2])
+{
+ int quantizer_scale_code, comp, motion_vector_count, mv_format;
+ int dmv, mvscale, coded_block_pattern;
+
+ /* ISO/IEC 13818-2 section 6.3.17.1: Macroblock modes */
+ macroblock_modes(macroblock_type, motion_type, &motion_vector_count, &mv_format,
+ &dmv, &mvscale, dct_type);
+ if (Fault_Flag) return 0; // trigger: go to next slice
+
+ if (*macroblock_type & MACROBLOCK_QUANT)
+ {
+ quantizer_scale_code = Get_Bits(5);
+
+ /* ISO/IEC 13818-2 section 7.4.2.2: Quantizer scale factor */
+ quantizer_scale = q_scale_type ?
+ Non_Linear_quantizer_scale[quantizer_scale_code] : (quantizer_scale_code << 1);
+ }
+
+ /* ISO/IEC 13818-2 section 6.3.17.2: Motion vectors */
+ /* decode forward motion vectors */
+ if ((*macroblock_type & MACROBLOCK_MOTION_FORWARD)
+ || ((*macroblock_type & MACROBLOCK_INTRA) && concealment_motion_vectors))
+ motion_vectors(PMV, dmvector, motion_vertical_field_select, 0,
+ motion_vector_count, mv_format, f_code[0][0]-1, f_code[0][1]-1, dmv, mvscale);
+ if (Fault_Flag) return 0; // trigger: go to next slice
+
+ /* decode backward motion vectors */
+ if (*macroblock_type & MACROBLOCK_MOTION_BACKWARD)
+ motion_vectors(PMV, dmvector, motion_vertical_field_select, 1,
+ motion_vector_count,mv_format, f_code[1][0]-1, f_code[1][1]-1, 0, mvscale);
+ if (Fault_Flag) return 0; // trigger: go to next slice
+
+ if ((*macroblock_type & MACROBLOCK_INTRA) && concealment_motion_vectors)
+ Flush_Buffer(1); // marker bit
+
+ /* macroblock_pattern */
+ /* ISO/IEC 13818-2 section 6.3.17.4: Coded block pattern */
+ if (*macroblock_type & MACROBLOCK_PATTERN)
+ {
+ coded_block_pattern = Get_coded_block_pattern();
+
+ if (chroma_format==CHROMA422)
+ coded_block_pattern = (coded_block_pattern<<2) | Get_Bits(2);
+ else if (chroma_format==CHROMA444)
+ coded_block_pattern = (coded_block_pattern<<6) | Get_Bits(6);
+ }
+ else
+ coded_block_pattern = (*macroblock_type & MACROBLOCK_INTRA) ? (1<<block_count)-1 : 0;
+
+ if (Fault_Flag) return 0; // trigger: go to next slice
+
+ Clear_Block(block_count);
+
+ /* decode blocks */
+ for (comp=0; comp<block_count; comp++)
+ {
+ if (coded_block_pattern & (1<<(block_count-1-comp)))
+ {
+ if (*macroblock_type & MACROBLOCK_INTRA)
+ Decode_MPEG2_Intra_Block(comp, dc_dct_pred);
+ else
+ Decode_MPEG2_Non_Intra_Block(comp);
+ if (Fault_Flag) return 0; // trigger: go to next slice
+ }
+ }
+
+ /* reset intra_dc predictors */
+ /* ISO/IEC 13818-2 section 7.2.1: DC coefficients in intra blocks */
+ if (!(*macroblock_type & MACROBLOCK_INTRA))
+ dc_dct_pred[0]=dc_dct_pred[1]=dc_dct_pred[2]=0;
+
+ /* reset motion vector predictors */
+ if ((*macroblock_type & MACROBLOCK_INTRA) && !concealment_motion_vectors)
+ {
+ /* intra mb without concealment motion vectors */
+ /* ISO/IEC 13818-2 section 7.6.3.4: Resetting motion vector predictors */
+ PMV[0][0][0]=PMV[0][0][1]=PMV[1][0][0]=PMV[1][0][1]=0;
+ PMV[0][1][0]=PMV[0][1][1]=PMV[1][1][0]=PMV[1][1][1]=0;
+ }
+
+ /* special "No_MC" macroblock_type case */
+ /* ISO/IEC 13818-2 section 7.6.3.5: Prediction in P pictures */
+ if ((picture_coding_type==P_TYPE)
+ && !(*macroblock_type & (MACROBLOCK_MOTION_FORWARD|MACROBLOCK_INTRA)))
+ {
+ /* non-intra mb without forward mv in a P picture */
+ /* ISO/IEC 13818-2 section 7.6.3.4: Resetting motion vector predictors */
+ PMV[0][0][0]=PMV[0][0][1]=PMV[1][0][0]=PMV[1][0][1]=0;
+
+ /* derive motion_type */
+ /* ISO/IEC 13818-2 section 6.3.17.1: Macroblock modes, frame_motion_type */
+ if (picture_structure==FRAME_PICTURE)
+ *motion_type = MC_FRAME;
+ else
+ {
+ *motion_type = MC_FIELD;
+ motion_vertical_field_select[0][0] = (picture_structure==BOTTOM_FIELD);
+ }
+ }
+ /* successfully decoded macroblock */
+ return 1 ;
+}
+
+/* decode one intra coded MPEG-2 block */
+void CMPEG2Dec::Decode_MPEG2_Intra_Block(int comp, int dc_dct_pred[])
+{
+ int val, i, j, sign, *qmat;
+ unsigned int code;
+ DCTtab *tab;
+ short *bp;
+
+ bp = block[comp];
+ qmat = (comp<4 || chroma_format==CHROMA420)
+ ? intra_quantizer_matrix : chroma_intra_quantizer_matrix;
+
+ /* ISO/IEC 13818-2 section 7.2.1: decode DC coefficients */
+ switch (cc_table[comp])
+ {
+ case 0:
+ val = (dc_dct_pred[0]+= Get_Luma_DC_dct_diff());
+ break;
+
+ case 1:
+ val = (dc_dct_pred[1]+= Get_Chroma_DC_dct_diff());
+ break;
+
+ case 2:
+ val = (dc_dct_pred[2]+= Get_Chroma_DC_dct_diff());
+ break;
+ }
+
+ bp[0] = val << (3-intra_dc_precision);
+
+ /* decode AC coefficients */
+ for (i=1; ; i++)
+ {
+ code = Show_Bits(16);
+
+ if (code>=16384 && !intra_vlc_format)
+ tab = &DCTtabnext[(code>>12)-4];
+ else if (code>=1024)
+ {
+ if (intra_vlc_format)
+ tab = &DCTtab0a[(code>>8)-4];
+ else
+ tab = &DCTtab0[(code>>8)-4];
+ }
+ else if (code>=512)
+ {
+ if (intra_vlc_format)
+ tab = &DCTtab1a[(code>>6)-8];
+ else
+ tab = &DCTtab1[(code>>6)-8];
+ }
+ else if (code>=256)
+ tab = &DCTtab2[(code>>4)-16];
+ else if (code>=128)
+ tab = &DCTtab3[(code>>3)-16];
+ else if (code>=64)
+ tab = &DCTtab4[(code>>2)-16];
+ else if (code>=32)
+ tab = &DCTtab5[(code>>1)-16];
+ else if (code>=16)
+ tab = &DCTtab6[code-16];
+ else
+ {
+ Fault_Flag = 1;
+ return;
+ }
+
+ Flush_Buffer(tab->len);
+
+ if (tab->run<64)
+ {
+ i+= tab->run;
+ val = tab->level;
+ sign = Get_Bits(1);
+ }
+ else if (tab->run==64) /* end_of_block */
+ return;
+ else /* escape */
+ {
+ i+= Get_Bits(6);
+ val = Get_Bits(12);
+
+ if (sign = (val>=2048))
+ val = 4096 - val;
+ }
+
+ j = scan[alternate_scan][i];
+
+ val = (val * quantizer_scale * qmat[j]) >> 4;
+ bp[j] = sign ? -val : val;
+ }
+}
+
+/* decode one non-intra coded MPEG-2 block */
+void CMPEG2Dec::Decode_MPEG2_Non_Intra_Block(int comp)
+{
+ int val, i, j, sign, *qmat;
+ unsigned int code;
+ DCTtab *tab;
+ short *bp;
+
+ bp = block[comp];
+ qmat = (comp<4 || chroma_format==CHROMA420)
+ ? non_intra_quantizer_matrix : chroma_non_intra_quantizer_matrix;
+
+ /* decode AC coefficients */
+ for (i=0; ; i++)
+ {
+ code = Show_Bits(16);
+
+ if (code>=16384)
+ {
+ if (i==0)
+ tab = &DCTtabfirst[(code>>12)-4];
+ else
+ tab = &DCTtabnext[(code>>12)-4];
+ }
+ else if (code>=1024)
+ tab = &DCTtab0[(code>>8)-4];
+ else if (code>=512)
+ tab = &DCTtab1[(code>>6)-8];
+ else if (code>=256)
+ tab = &DCTtab2[(code>>4)-16];
+ else if (code>=128)
+ tab = &DCTtab3[(code>>3)-16];
+ else if (code>=64)
+ tab = &DCTtab4[(code>>2)-16];
+ else if (code>=32)
+ tab = &DCTtab5[(code>>1)-16];
+ else if (code>=16)
+ tab = &DCTtab6[code-16];
+ else
+ {
+ Fault_Flag = 1;
+ return;
+ }
+
+ Flush_Buffer(tab->len);
+
+ if (tab->run<64)
+ {
+ i+= tab->run;
+ val = tab->level;
+ sign = Get_Bits(1);
+ }
+ else if (tab->run==64) /* end_of_block */
+ return;
+ else /* escape */
+ {
+ i+= Get_Bits(6);
+ val = Get_Bits(12);
+
+ if (sign = (val>=2048))
+ val = 4096 - val;
+ }
+
+ j = scan[alternate_scan][i];
+
+ val = (((val<<1)+1) * quantizer_scale * qmat[j]) >> 5;
+ bp[j] = sign ? -val : val;
+ }
+}
+
+int CMPEG2Dec::Get_macroblock_type()
+{
+ int macroblock_type;
+
+ switch (picture_coding_type)
+ {
+ case I_TYPE:
+ macroblock_type = Get_I_macroblock_type();
+ break;
+
+ case P_TYPE:
+ macroblock_type = Get_P_macroblock_type();
+ break;
+
+ case B_TYPE:
+ macroblock_type = Get_B_macroblock_type();
+ break;
+ }
+
+ return macroblock_type;
+}
+
+int CMPEG2Dec::Get_I_macroblock_type()
+{
+ if (Get_Bits(1))
+ return 1;
+
+ if (!Get_Bits(1))
+ Fault_Flag = 2;
+
+ return 17;
+}
+
+int CMPEG2Dec::Get_P_macroblock_type()
+{
+ int code;
+
+ if ((code = Show_Bits(6))>=8)
+ {
+ code >>= 3;
+ Flush_Buffer(PMBtab0[code].len);
+
+ return PMBtab0[code].val;
+ }
+
+ if (code==0)
+ {
+ Fault_Flag = 2;
+ return 0;
+ }
+
+ Flush_Buffer(PMBtab1[code].len);
+
+ return PMBtab1[code].val;
+}
+
+int CMPEG2Dec::Get_B_macroblock_type()
+{
+ int code;
+
+ if ((code = Show_Bits(6))>=8)
+ {
+ code >>= 2;
+ Flush_Buffer(BMBtab0[code].len);
+
+ return BMBtab0[code].val;
+ }
+
+ if (code==0)
+ {
+ Fault_Flag = 2;
+ return 0;
+ }
+
+ Flush_Buffer(BMBtab1[code].len);
+
+ return BMBtab1[code].val;
+}
+
+int CMPEG2Dec::Get_coded_block_pattern()
+{
+ int code;
+
+ if ((code = Show_Bits(9))>=128)
+ {
+ code >>= 4;
+ Flush_Buffer(CBPtab0[code].len);
+
+ return CBPtab0[code].val;
+ }
+
+ if (code>=8)
+ {
+ code >>= 1;
+ Flush_Buffer(CBPtab1[code].len);
+
+ return CBPtab1[code].val;
+ }
+
+ if (code<1)
+ {
+ Fault_Flag = 3;
+ return 0;
+ }
+
+ Flush_Buffer(CBPtab2[code].len);
+
+ return CBPtab2[code].val;
+}
+
+int CMPEG2Dec::Get_macroblock_address_increment()
+{
+ int code, val;
+
+ val = 0;
+
+ while ((code = Show_Bits(11))<24)
+ {
+ if (code!=15) /* if not macroblock_stuffing */
+ {
+ if (code==8) /* if macroblock_escape */
+ val+= 33;
+ else
+ {
+ Fault_Flag = 4;
+ return 1;
+ }
+ }
+ Flush_Buffer(11);
+ }
+
+ /* macroblock_address_increment == 1 */
+ /* ('1' is in the MSB position of the lookahead) */
+ if (code>=1024)
+ {
+ Flush_Buffer(1);
+ return val + 1;
+ }
+
+ /* codes 00010 ... 011xx */
+ if (code>=128)
+ {
+ /* remove leading zeros */
+ code >>= 6;
+ Flush_Buffer(MBAtab1[code].len);
+
+ return val + MBAtab1[code].val;
+ }
+
+ /* codes 00000011000 ... 0000111xxxx */
+ code-= 24; /* remove common base */
+ Flush_Buffer(MBAtab2[code].len);
+
+ return val + MBAtab2[code].val;
+}
+
+/*
+ parse VLC and perform dct_diff arithmetic.
+ MPEG-2: ISO/IEC 13818-2 section 7.2.1
+
+ Note: the arithmetic here is presented more elegantly than
+ the spec, yet the results, dct_diff, are the same.
+*/
+int CMPEG2Dec::Get_Luma_DC_dct_diff()
+{
+ int code, size, dct_diff;
+
+ /* decode length */
+ code = Show_Bits(5);
+
+ if (code<31)
+ {
+ size = DClumtab0[code].val;
+ Flush_Buffer(DClumtab0[code].len);
+ }
+ else
+ {
+ code = Show_Bits(9) - 0x1f0;
+ size = DClumtab1[code].val;
+ Flush_Buffer(DClumtab1[code].len);
+ }
+
+ if (size==0)
+ dct_diff = 0;
+ else
+ {
+ dct_diff = Get_Bits(size);
+
+ if ((dct_diff & (1<<(size-1)))==0)
+ dct_diff-= (1<<size) - 1;
+ }
+
+ return dct_diff;
+}
+
+int CMPEG2Dec::Get_Chroma_DC_dct_diff()
+{
+ int code, size, dct_diff;
+
+ /* decode length */
+ code = Show_Bits(5);
+
+ if (code<31)
+ {
+ size = DCchromtab0[code].val;
+ Flush_Buffer(DCchromtab0[code].len);
+ }
+ else
+ {
+ code = Show_Bits(10) - 0x3e0;
+ size = DCchromtab1[code].val;
+ Flush_Buffer(DCchromtab1[code].len);
+ }
+
+ if (size==0)
+ dct_diff = 0;
+ else
+ {
+ dct_diff = Get_Bits(size);
+
+ if ((dct_diff & (1<<(size-1)))==0)
+ dct_diff-= (1<<size) - 1;
+ }
+
+ return dct_diff;
+}
+
+/*
+static int currentfield;
+static unsigned char **predframe;
+static int DMV[2][2];
+static int stw;
+*/
+
+void CMPEG2Dec::form_predictions(int bx, int by, int macroblock_type, int motion_type,
+ int PMV[2][2][2], int motion_vertical_field_select[2][2],
+ int dmvector[2])
+{
+ int currentfield;
+ unsigned char **predframe;
+ int DMV[2][2];
+ int stw;
+
+ stw = 0;
+
+ if ((macroblock_type & MACROBLOCK_MOTION_FORWARD) || (picture_coding_type==P_TYPE))
+ {
+ if (picture_structure==FRAME_PICTURE)
+ {
+ if ((motion_type==MC_FRAME) || !(macroblock_type & MACROBLOCK_MOTION_FORWARD))
+ {
+ /* frame-based prediction (broken into top and bottom halves
+ for spatial scalability prediction purposes) */
+ form_prediction(forward_reference_frame, 0, current_frame, 0, Coded_Picture_Width,
+ Coded_Picture_Width<<1, 16, 8, bx, by, PMV[0][0][0], PMV[0][0][1], stw);
+
+ form_prediction(forward_reference_frame, 1, current_frame, 1, Coded_Picture_Width,
+ Coded_Picture_Width<<1, 16, 8, bx, by, PMV[0][0][0], PMV[0][0][1], stw);
+ }
+ else if (motion_type==MC_FIELD) /* field-based prediction */
+ {
+ /* top field prediction */
+ form_prediction(forward_reference_frame, motion_vertical_field_select[0][0],
+ current_frame, 0, Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8,
+ bx, by>>1, PMV[0][0][0], PMV[0][0][1]>>1, stw);
+
+ /* bottom field prediction */
+ form_prediction(forward_reference_frame, motion_vertical_field_select[1][0],
+ current_frame, 1, Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8,
+ bx, by>>1, PMV[1][0][0], PMV[1][0][1]>>1, stw);
+ }
+ else if (motion_type==MC_DMV) /* dual prime prediction */
+ {
+ /* calculate derived motion vectors */
+ Dual_Prime_Arithmetic(DMV, dmvector, PMV[0][0][0], PMV[0][0][1]>>1);
+
+ /* predict top field from top field */
+ form_prediction(forward_reference_frame, 0, current_frame, 0,
+ Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8, bx, by>>1,
+ PMV[0][0][0], PMV[0][0][1]>>1, 0);
+
+ /* predict and add to top field from bottom field */
+ form_prediction(forward_reference_frame, 1, current_frame, 0,
+ Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8, bx, by>>1,
+ DMV[0][0], DMV[0][1], 1);
+
+ /* predict bottom field from bottom field */
+ form_prediction(forward_reference_frame, 1, current_frame, 1,
+ Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8, bx, by>>1,
+ PMV[0][0][0], PMV[0][0][1]>>1, 0);
+
+ /* predict and add to bottom field from top field */
+ form_prediction(forward_reference_frame, 0, current_frame, 1,
+ Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8, bx, by>>1,
+ DMV[1][0], DMV[1][1], 1);
+ }
+ else
+ Fault_Flag = 5;
+ }
+ else
+ {
+ /* field picture */
+ currentfield = (picture_structure==BOTTOM_FIELD);
+
+ /* determine which frame to use for prediction */
+ if (picture_coding_type==P_TYPE && Second_Field && currentfield!=motion_vertical_field_select[0][0])
+ predframe = backward_reference_frame;
+ else
+ predframe = forward_reference_frame;
+
+ if ((motion_type==MC_FIELD) || !(macroblock_type & MACROBLOCK_MOTION_FORWARD))
+ {
+ form_prediction(predframe, motion_vertical_field_select[0][0], current_frame, 0,
+ Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 16, bx, by,
+ PMV[0][0][0], PMV[0][0][1], stw);
+ }
+ else if (motion_type==MC_16X8)
+ {
+ form_prediction(predframe, motion_vertical_field_select[0][0], current_frame, 0,
+ Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8, bx, by,
+ PMV[0][0][0], PMV[0][0][1], stw);
+
+ if (picture_coding_type==P_TYPE && Second_Field && currentfield!=motion_vertical_field_select[1][0])
+ predframe = backward_reference_frame;
+ else
+ predframe = forward_reference_frame;
+
+ form_prediction(predframe, motion_vertical_field_select[1][0], current_frame,
+ 0, Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8, bx, by+8,
+ PMV[1][0][0], PMV[1][0][1], stw);
+ }
+ else if (motion_type==MC_DMV)
+ {
+ if (Second_Field)
+ predframe = backward_reference_frame;
+ else
+ predframe = forward_reference_frame;
+
+ /* calculate derived motion vectors */
+ Dual_Prime_Arithmetic(DMV, dmvector, PMV[0][0][0], PMV[0][0][1]);
+
+ /* predict from field of same parity */
+ form_prediction(forward_reference_frame, currentfield, current_frame, 0,
+ Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 16, bx, by,
+ PMV[0][0][0], PMV[0][0][1], 0);
+
+ /* predict from field of opposite parity */
+ form_prediction(predframe, !currentfield, current_frame, 0,
+ Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 16, bx, by,
+ DMV[0][0], DMV[0][1], 1);
+ }
+ else
+ Fault_Flag = 5;
+ }
+
+ stw = 1;
+ }
+
+ if (macroblock_type & MACROBLOCK_MOTION_BACKWARD)
+ {
+ if (picture_structure==FRAME_PICTURE)
+ {
+ if (motion_type==MC_FRAME)
+ {
+ /* frame-based prediction */
+ form_prediction(backward_reference_frame, 0, current_frame, 0,
+ Coded_Picture_Width, Coded_Picture_Width<<1, 16, 8, bx, by,
+ PMV[0][1][0], PMV[0][1][1], stw);
+
+ form_prediction(backward_reference_frame, 1, current_frame, 1,
+ Coded_Picture_Width, Coded_Picture_Width<<1, 16, 8, bx, by,
+ PMV[0][1][0], PMV[0][1][1], stw);
+ }
+ else /* field-based prediction */
+ {
+ /* top field prediction */
+ form_prediction(backward_reference_frame, motion_vertical_field_select[0][1],
+ current_frame, 0, Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8,
+ bx, by>>1, PMV[0][1][0], PMV[0][1][1]>>1, stw);
+
+ /* bottom field prediction */
+ form_prediction(backward_reference_frame, motion_vertical_field_select[1][1],
+ current_frame, 1, Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8,
+ bx, by>>1, PMV[1][1][0], PMV[1][1][1]>>1, stw);
+ }
+ }
+ else
+ {
+ /* field picture */
+ if (motion_type==MC_FIELD)
+ {
+ /* field-based prediction */
+ form_prediction(backward_reference_frame, motion_vertical_field_select[0][1],
+ current_frame, 0, Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 16,
+ bx, by, PMV[0][1][0], PMV[0][1][1], stw);
+ }
+ else if (motion_type==MC_16X8)
+ {
+ form_prediction(backward_reference_frame, motion_vertical_field_select[0][1],
+ current_frame, 0, Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8,
+ bx, by, PMV[0][1][0], PMV[0][1][1], stw);
+
+ form_prediction(backward_reference_frame, motion_vertical_field_select[1][1],
+ current_frame, 0, Coded_Picture_Width<<1, Coded_Picture_Width<<1, 16, 8,
+ bx, by+8, PMV[1][1][0], PMV[1][1][1], stw);
+ }
+ else
+ Fault_Flag = 5;
+ }
+ }
+}
+
+void CMPEG2Dec::form_prediction(unsigned char *src[], int sfield, unsigned char *dst[],
+ int dfield, int lx, int lx2, int w, int h, int x, int y,
+ int dx, int dy, int average_flag)
+{
+ form_component_prediction(src[0]+(sfield?lx2>>1:0), dst[0]+(dfield?lx2>>1:0),
+ lx, lx2, w, h, x, y, dx, dy, average_flag);
+
+ if (chroma_format!=CHROMA444)
+ {
+ lx>>=1; lx2>>=1; w>>=1; x>>=1; dx/=2;
+ }
+
+ if (chroma_format==CHROMA420)
+ {
+ h>>=1; y>>=1; dy/=2;
+ }
+
+ /* Cb */
+ form_component_prediction(src[1]+(sfield?lx2>>1:0), dst[1]+(dfield?lx2>>1:0),
+ lx, lx2, w, h, x, y, dx, dy, average_flag);
+
+ /* Cr */
+ form_component_prediction(src[2]+(sfield?lx2>>1:0), dst[2]+(dfield?lx2>>1:0),
+ lx, lx2, w, h, x, y, dx, dy, average_flag);
+}
+
+/* ISO/IEC 13818-2 section 7.6.4: Forming predictions */
+void CMPEG2Dec::form_component_prediction(unsigned char *src, unsigned char *dst,
+ int lx, int lx2, int w, int h, int x, int y,
+ int dx, int dy, int average_flag)
+{
+ static const __int64 mmmask_0001 = 0x0001000100010001;
+ static const __int64 mmmask_0002 = 0x0002000200020002;
+ static const __int64 mmmask_0003 = 0x0003000300030003;
+ static const __int64 mmmask_0006 = 0x0006000600060006;
+
+ unsigned char *s = src + lx * (y + (dy>>1)) + x + (dx>>1);
+ unsigned char *d = dst + lx * y + x;
+ int flag = (average_flag<<2) + ((dx & 1)<<1) + (dy & 1);
+
+ switch (flag)
+ {
+ case 0:
+ // d[i] = s[i];
+ __asm
+ {
+ mov eax, [s]
+ mov ebx, [d]
+ mov esi, 0x00
+ mov edi, [h]
+mc0:
+ movq mm1, [eax+esi]
+ add esi, 0x08
+ cmp esi, [w]
+ movq [ebx+esi-8], mm1
+ jl mc0
+
+ add eax, [lx2]
+ add ebx, [lx2]
+ dec edi
+ mov esi, 0x00
+ cmp edi, 0x00
+ jg mc0
+ }
+ break;
+
+ case 1:
+ // d[i] = (s[i]+s[i+lx]+1)>>1;
+ __asm
+ {
+ pxor mm0, mm0
+ movq mm7, [mmmask_0001]
+ mov eax, [s]
+ mov ebx, [d]
+ mov ecx, eax
+ add ecx, [lx]
+ mov esi, 0x00
+ mov edi, [h]
+mc1:
+ movq mm1, [eax+esi]
+ movq mm2, [ecx+esi]
+
+ movq mm3, mm1
+ movq mm4, mm2
+
+ punpcklbw mm1, mm0
+ punpckhbw mm3, mm0
+ punpcklbw mm2, mm0
+ punpckhbw mm4, mm0
+
+ paddsw mm1, mm2
+ paddsw mm3, mm4
+
+ paddsw mm1, mm7
+ paddsw mm3, mm7
+
+ psrlw mm1, 1
+ psrlw mm3, 1
+
+ packuswb mm1, mm0
+ packuswb mm3, mm0
+
+ psllq mm3, 32
+ por mm1, mm3
+
+ add esi, 0x08
+ cmp esi, [w]
+ movq [ebx+esi-8], mm1
+ jl mc1
+
+ add eax, [lx2]
+ add ebx, [lx2]
+ add ecx, [lx2]
+ dec edi
+ mov esi, 0x00
+ cmp edi, 0x00
+ jg mc1
+ }
+ break;
+
+ case 2:
+ // d[i] = (s[i]+s[i+1]+1)>>1;
+ __asm
+ {
+ pxor mm0, mm0
+ movq mm7, [mmmask_0001]
+ mov eax, [s]
+ mov ebx, [d]
+ mov esi, 0x00
+ mov edi, [h]
+mc2:
+ movq mm1, [eax+esi]
+ movq mm2, [eax+esi+1]
+
+ movq mm3, mm1
+ movq mm4, mm2
+
+ punpcklbw mm1, mm0
+ punpckhbw mm3, mm0
+
+ punpcklbw mm2, mm0
+ punpckhbw mm4, mm0
+
+ paddsw mm1, mm2
+ paddsw mm3, mm4
+
+ paddsw mm1, mm7
+ paddsw mm3, mm7
+
+ psrlw mm1, 1
+ psrlw mm3, 1
+
+ packuswb mm1, mm0
+ packuswb mm3, mm0
+
+ psllq mm3, 32
+ por mm1, mm3
+
+ add esi, 0x08
+ cmp esi, [w]
+ movq [ebx+esi-8], mm1
+ jl mc2
+
+ add eax, [lx2]
+ add ebx, [lx2]
+ dec edi
+ mov esi, 0x00
+ cmp edi, 0x00
+ jg mc2
+ }
+ break;
+
+ case 3:
+ // d[i] = (s[i]+s[i+1]+s[i+lx]+s[i+lx+1]+2)>>2;
+ __asm
+ {
+ pxor mm0, mm0
+ movq mm7, [mmmask_0002]
+ mov eax, [s]
+ mov ebx, [d]
+ mov ecx, eax
+ add ecx, [lx]
+ mov esi, 0x00
+ mov edi, [h]
+mc3:
+ movq mm1, [eax+esi]
+ movq mm2, [eax+esi+1]
+ movq mm3, mm1
+ movq mm4, mm2
+
+ punpcklbw mm1, mm0
+ punpckhbw mm3, mm0
+
+ punpcklbw mm2, mm0
+ punpckhbw mm4, mm0
+
+ paddsw mm1, mm2
+ paddsw mm3, mm4
+
+ movq mm5, [ecx+esi]
+ paddsw mm1, mm7
+
+ movq mm6, [ecx+esi+1]
+ paddsw mm3, mm7
+
+ movq mm2, mm5
+ movq mm4, mm6
+
+ punpcklbw mm2, mm0
+ punpckhbw mm5, mm0
+
+ punpcklbw mm4, mm0
+ punpckhbw mm6, mm0
+
+ paddsw mm2, mm4
+ paddsw mm5, mm6
+
+ paddsw mm1, mm2
+ paddsw mm3, mm5
+
+ psrlw mm1, 2
+ psrlw mm3, 2
+
+ packuswb mm1, mm0
+ packuswb mm3, mm0
+
+ psllq mm3, 32
+ por mm1, mm3
+
+ add esi, 0x08
+ cmp esi, [w]
+ movq [ebx+esi-8], mm1
+ jl mc3
+
+ add eax, [lx2]
+ add ebx, [lx2]
+ add ecx, [lx2]
+ dec edi
+ mov esi, 0x00
+ cmp edi, 0x00
+ jg mc3
+ }
+ break;
+
+ case 4:
+ // d[i] = (s[i]+d[i]+1)>>1;
+ __asm
+ {
+ pxor mm0, mm0
+ movq mm7, [mmmask_0001]
+ mov eax, [s]
+ mov ebx, [d]
+ mov esi, 0x00
+ mov edi, [h]
+mc4:
+ movq mm1, [eax+esi]
+ movq mm2, [ebx+esi]
+ movq mm3, mm1
+ movq mm4, mm2
+
+ punpcklbw mm1, mm0
+ punpckhbw mm3, mm0
+
+ punpcklbw mm2, mm0
+ punpckhbw mm4, mm0
+
+ paddsw mm1, mm2
+ paddsw mm3, mm4
+
+ paddsw mm1, mm7
+ paddsw mm3, mm7
+
+ psrlw mm1, 1
+ psrlw mm3, 1
+
+ packuswb mm1, mm0
+ packuswb mm3, mm0
+
+ psllq mm3, 32
+ por mm1, mm3
+
+ add esi, 0x08
+ cmp esi, [w]
+ movq [ebx+esi-8], mm1
+ jl mc4
+
+ add eax, [lx2]
+ add ebx, [lx2]
+ dec edi
+ mov esi, 0x00
+ cmp edi, 0x00
+ jg mc4
+ }
+ break;
+
+ case 5:
+ // d[i] = ((d[i]<<1) + s[i]+s[i+lx] + 3)>>2;
+ __asm
+ {
+ pxor mm0, mm0
+ movq mm7, [mmmask_0003]
+ mov eax, [s]
+ mov ebx, [d]
+ mov ecx, eax
+ add ecx, [lx]
+ mov esi, 0x00
+ mov edi, [h]
+mc5:
+ movq mm1, [eax+esi]
+ movq mm2, [ecx+esi]
+ movq mm3, mm1
+ movq mm4, mm2
+
+ punpcklbw mm1, mm0
+ punpckhbw mm3, mm0
+
+ punpcklbw mm2, mm0
+ punpckhbw mm4, mm0
+
+ paddsw mm1, mm2
+ paddsw mm3, mm4
+
+ movq mm5, [ebx+esi]
+
+ paddsw mm1, mm7
+ paddsw mm3, mm7
+
+ movq mm6, mm5
+ punpcklbw mm5, mm0
+ punpckhbw mm6, mm0
+
+ psllw mm5, 1
+ psllw mm6, 1
+
+ paddsw mm1, mm5
+ paddsw mm3, mm6
+
+ psrlw mm1, 2
+ psrlw mm3, 2
+
+ packuswb mm1, mm0
+ packuswb mm3, mm0
+
+ psllq mm3, 32
+ por mm1, mm3
+
+ add esi, 0x08
+ cmp esi, [w]
+ movq [ebx+esi-8], mm1
+ jl mc5
+
+ add eax, [lx2]
+ add ebx, [lx2]
+ add ecx, [lx2]
+ dec edi
+ mov esi, 0x00
+ cmp edi, 0x00
+ jg mc5
+ }
+ break;
+
+ case 6:
+ // d[i] = ((d[i]<<1) + s[i]+s[i+1] + 3) >> 2;
+ __asm
+ {
+ pxor mm0, mm0
+ movq mm7, [mmmask_0003]
+ mov eax, [s]
+ mov ebx, [d]
+ mov esi, 0x00
+ mov edi, [h]
+mc6:
+ movq mm1, [eax+esi]
+ movq mm2, [eax+esi+1]
+ movq mm3, mm1
+ movq mm4, mm2
+
+ punpcklbw mm1, mm0
+ punpckhbw mm3, mm0
+
+ punpcklbw mm2, mm0
+ punpckhbw mm4, mm0
+
+ paddsw mm1, mm2
+ paddsw mm3, mm4
+
+ movq mm5, [ebx+esi]
+
+ paddsw mm1, mm7
+ paddsw mm3, mm7
+
+ movq mm6, mm5
+ punpcklbw mm5, mm0
+ punpckhbw mm6, mm0
+
+ psllw mm5, 1
+ psllw mm6, 1
+
+ paddsw mm1, mm5
+ paddsw mm3, mm6
+
+ psrlw mm1, 2
+ psrlw mm3, 2
+
+ packuswb mm1, mm0
+ packuswb mm3, mm0
+
+ psllq mm3, 32
+ por mm1, mm3
+
+ add esi, 0x08
+ cmp esi, [w]
+ movq [ebx+esi-8], mm1
+ jl mc6
+
+ add eax, [lx2]
+ add ebx, [lx2]
+ dec edi
+ mov esi, 0x00
+ cmp edi, 0x00
+ jg mc6
+ }
+ break;
+
+ case 7:
+ // d[i] = ((d[i]<<2) + s[i]+s[i+1]+s[i+lx]+s[i+lx+1] + 6)>>3;
+ __asm
+ {
+ pxor mm0, mm0
+ movq mm7, [mmmask_0006]
+ mov eax, [s]
+ mov ebx, [d]
+ mov ecx, eax
+ add ecx, [lx]
+ mov esi, 0x00
+ mov edi, [h]
+mc7:
+ movq mm1, [eax+esi]
+ movq mm2, [eax+esi+1]
+ movq mm3, mm1
+ movq mm4, mm2
+
+ punpcklbw mm1, mm0
+ punpckhbw mm3, mm0
+
+ punpcklbw mm2, mm0
+ punpckhbw mm4, mm0
+
+ paddsw mm1, mm2
+ paddsw mm3, mm4
+
+ movq mm5, [ecx+esi]
+ paddsw mm1, mm7
+
+ movq mm6, [ecx+esi+1]
+ paddsw mm3, mm7
+
+ movq mm2, mm5
+ movq mm4, mm6
+
+ punpcklbw mm2, mm0
+ punpckhbw mm5, mm0
+
+ punpcklbw mm4, mm0
+ punpckhbw mm6, mm0
+
+ paddsw mm2, mm4
+ paddsw mm5, mm6
+
+ paddsw mm1, mm2
+ paddsw mm3, mm5
+
+ movq mm6, [ebx+esi]
+
+ movq mm4, mm6
+ punpcklbw mm4, mm0
+ punpckhbw mm6, mm0
+
+ psllw mm4, 2
+ psllw mm6, 2
+
+ paddsw mm1, mm4
+ paddsw mm3, mm6
+
+ psrlw mm1, 3
+ psrlw mm3, 3
+
+ packuswb mm1, mm0
+ packuswb mm3, mm0
+
+ psllq mm3, 32
+ por mm1, mm3
+
+ add esi, 0x08
+ cmp esi, [w]
+ movq [ebx+esi-8], mm1
+ jl mc7
+
+ add eax, [lx2]
+ add ebx, [lx2]
+ add ecx, [lx2]
+ dec edi
+ mov esi, 0x00
+ cmp edi, 0x00
+ jg mc7
+ }
+ break;
+ }
+}
+
+//
+// motion
+//
+
+/* ISO/IEC 13818-2 sections 6.2.5.2, 6.3.17.2, and 7.6.3: Motion vectors */
+void CMPEG2Dec::motion_vectors(int PMV[2][2][2],int dmvector[2],
+ int motion_vertical_field_select[2][2], int s,
+ int motion_vector_count, int mv_format, int h_r_size,
+ int v_r_size, int dmv, int mvscale)
+{
+ if (motion_vector_count==1)
+ {
+ if (mv_format==MV_FIELD && !dmv)
+ motion_vertical_field_select[1][s] =
+ motion_vertical_field_select[0][s] = Get_Bits(1);
+
+ motion_vector(PMV[0][s],dmvector,h_r_size,v_r_size,dmv,mvscale,0);
+
+ /* update other motion vector predictors */
+ PMV[1][s][0] = PMV[0][s][0];
+ PMV[1][s][1] = PMV[0][s][1];
+ }
+ else
+ {
+ motion_vertical_field_select[0][s] = Get_Bits(1);
+ motion_vector(PMV[0][s],dmvector,h_r_size,v_r_size,dmv,mvscale,0);
+ motion_vertical_field_select[1][s] = Get_Bits(1);
+ motion_vector(PMV[1][s],dmvector,h_r_size,v_r_size,dmv,mvscale,0);
+ }
+}
+
+
+/* ISO/IEC 13818-2 section 7.6.3.6: Dual prime additional arithmetic */
+void CMPEG2Dec::Dual_Prime_Arithmetic(int DMV[][2],int *dmvector, int mvx,int mvy)
+{
+ if (picture_structure==FRAME_PICTURE)
+ {
+ if (top_field_first)
+ {
+ /* vector for prediction of top field from bottom field */
+ DMV[0][0] = ((mvx +(mvx>0))>>1) + dmvector[0];
+ DMV[0][1] = ((mvy +(mvy>0))>>1) + dmvector[1] - 1;
+
+ /* vector for prediction of bottom field from top field */
+ DMV[1][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0];
+ DMV[1][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] + 1;
+ }
+ else
+ {
+ /* vector for prediction of top field from bottom field */
+ DMV[0][0] = ((3*mvx+(mvx>0))>>1) + dmvector[0];
+ DMV[0][1] = ((3*mvy+(mvy>0))>>1) + dmvector[1] - 1;
+
+ /* vector for prediction of bottom field from top field */
+ DMV[1][0] = ((mvx +(mvx>0))>>1) + dmvector[0];
+ DMV[1][1] = ((mvy +(mvy>0))>>1) + dmvector[1] + 1;
+ }
+ }
+ else
+ {
+ /* vector for prediction from field of opposite 'parity' */
+ DMV[0][0] = ((mvx+(mvx>0))>>1) + dmvector[0];
+ DMV[0][1] = ((mvy+(mvy>0))>>1) + dmvector[1];
+
+ /* correct for vertical field shift */
+ if (picture_structure==TOP_FIELD)
+ DMV[0][1]--;
+ else
+ DMV[0][1]++;
+ }
+}
+
+/* get and decode motion vector and differential motion vector for one prediction */
+void CMPEG2Dec::motion_vector(int *PMV, int *dmvector, int h_r_size, int v_r_size,
+ int dmv, int mvscale, int full_pel_vector)
+{
+ int motion_code, motion_residual;
+
+ /* horizontal component */
+ /* ISO/IEC 13818-2 Table B-10 */
+ motion_code = Get_motion_code();
+
+ motion_residual = (h_r_size!=0 && motion_code!=0) ? Get_Bits(h_r_size) : 0;
+
+ decode_motion_vector(&PMV[0],h_r_size,motion_code,motion_residual,full_pel_vector);
+
+ if (dmv)
+ dmvector[0] = Get_dmvector();
+
+ /* vertical component */
+ motion_code = Get_motion_code();
+ motion_residual = (v_r_size!=0 && motion_code!=0) ? Get_Bits(v_r_size) : 0;
+
+ if (mvscale)
+ PMV[1] >>= 1; /* DIV 2 */
+
+ decode_motion_vector(&PMV[1],v_r_size,motion_code,motion_residual,full_pel_vector);
+
+ if (mvscale)
+ PMV[1] <<= 1;
+
+ if (dmv)
+ dmvector[1] = Get_dmvector();
+}
+
+/* calculate motion vector component */
+/* ISO/IEC 13818-2 section 7.6.3.1: Decoding the motion vectors */
+/* Note: the arithmetic here is more elegant than that which is shown
+ in 7.6.3.1. The end results (PMV[][][]) should, however, be the same. */
+void CMPEG2Dec::decode_motion_vector(int *pred, int r_size, int motion_code,
+ int motion_residual, int full_pel_vector)
+{
+ int lim, vec;
+
+ lim = 16<<r_size;
+ vec = full_pel_vector ? (*pred >> 1) : (*pred);
+
+ if (motion_code>0)
+ {
+ vec+= ((motion_code-1)<<r_size) + motion_residual + 1;
+ if (vec>=lim)
+ vec-= lim + lim;
+ }
+ else if (motion_code<0)
+ {
+ vec-= ((-motion_code-1)<<r_size) + motion_residual + 1;
+ if (vec<-lim)
+ vec+= lim + lim;
+ }
+
+ *pred = full_pel_vector ? (vec<<1) : vec;
+}
+
+int CMPEG2Dec::Get_motion_code()
+{
+ int code;
+
+ if (Get_Bits(1))
+ return 0;
+
+ if ((code = Show_Bits(9))>=64)
+ {
+ code >>= 6;
+ Flush_Buffer(MVtab0[code].len);
+
+ return Get_Bits(1)?-MVtab0[code].val:MVtab0[code].val;
+ }
+
+ if (code>=24)
+ {
+ code >>= 3;
+ Flush_Buffer(MVtab1[code].len);
+
+ return Get_Bits(1)?-MVtab1[code].val:MVtab1[code].val;
+ }
+
+ if ((code-=12)<0)
+ {
+ Fault_Flag = 10;
+ return 0;
+ }
+
+ Flush_Buffer(MVtab2[code].len);
+
+ return Get_Bits(1) ? -MVtab2[code].val : MVtab2[code].val;
+}
+
+/* get differential motion vector (for dual prime prediction) */
+int CMPEG2Dec::Get_dmvector()
+{
+ if (Get_Bits(1))
+ return Get_Bits(1) ? -1 : 1;
+ else
+ return 0;
+}
+
+//
+// store
+//
+
+static const __int64 mmmask_0001 = 0x0001000100010001;
+static const __int64 mmmask_0002 = 0x0002000200020002;
+static const __int64 mmmask_0003 = 0x0003000300030003;
+static const __int64 mmmask_0004 = 0x0004000400040004;
+static const __int64 mmmask_0005 = 0x0005000500050005;
+static const __int64 mmmask_0007 = 0x0007000700070007;
+static const __int64 mmmask_0016 = 0x0010001000100010;
+static const __int64 mmmask_0040 = 0x0040004000400040;
+static const __int64 mmmask_0128 = 0x0080008000800080;
+
+void CMPEG2Dec::assembleFrame(unsigned char *src[], int pf, unsigned char *dst, int pitch)
+{
+ unsigned char *y444;
+
+ if (Fault_Flag)
+ Fault_Flag = 0;
+
+ if (Luminance_Flag)
+ {
+ Luminance_Filter(src[0], lum);
+ y444 = lum;
+ }
+ else
+ y444 = src[0];
+
+ if (chroma_format==CHROMA420)
+ {
+ conv420to422(src[1], u422, pf);
+ conv420to422(src[2], v422, pf);
+
+ if (!dstYUY2())
+ {
+ conv422to444(u422, u444);
+ conv422to444(v422, v444);
+ }
+ }
+ else if (!dstYUY2())
+ {
+ conv422to444(src[1], u444);
+ conv422to444(src[2], v444);
+ }
+
+ if (dstYUY2())
+ conv422toYUY2(y444, u422, v422, dst, pitch);
+ else
+ conv444toRGB24(y444, u444, v444, dst, pitch);
+}
+
+void CMPEG2Dec::Luminance_Filter(unsigned char *src, unsigned char *dst)
+{
+ src += CLIP_AREA;
+ dst += CLIP_AREA;
+
+ __asm
+ {
+ mov edx, this
+ mov eax, [src]
+ mov ebx, [dst]
+ mov esi, 0x00
+ mov edi, [edx].LUM_AREA
+ pxor mm0, mm0
+ movq mm5, [edx].LumOffsetMask
+ movq mm6, [edx].LumGainMask
+ movq mm7, mmmask_0040
+
+lumconv:
+ movq mm1, [eax+esi]
+ movq mm2, mm1
+
+ punpcklbw mm1, mm0
+ punpckhbw mm2, mm0
+
+ pmullw mm1, mm6
+ pmullw mm2, mm6
+
+ paddw mm1, mm7
+ paddw mm2, mm7
+
+ psrlw mm1, 7
+ psrlw mm2, 7
+
+ paddw mm1, mm5
+ paddw mm2, mm5
+
+ packuswb mm1, mm0
+ packuswb mm2, mm0
+
+ add esi, 0x08
+ cmp esi, edi
+ movq [ebx+esi-8], mm1
+ movq [ebx+esi-4], mm2
+ jl lumconv
+ }
+}
+
+void CMPEG2Dec::conv422to444(unsigned char *src, unsigned char *dst)
+{
+ src += HALF_CLIP_AREA;
+ dst += CLIP_AREA;
+
+ __asm
+ {
+ mov edx, this
+ mov eax, [src]
+ mov ebx, [dst]
+ mov edi, [edx].Clip_Height
+
+ movq mm1, [mmmask_0001]
+ pxor mm0, mm0
+
+convyuv444init:
+ movq mm7, [eax]
+ mov esi, 0x00
+
+convyuv444:
+ movq mm2, mm7
+ movq mm7, [eax+esi+8]
+ movq mm3, mm2
+ movq mm4, mm7
+
+ psrlq mm3, 8
+ psllq mm4, 56
+ por mm3, mm4
+
+ movq mm4, mm2
+ movq mm5, mm3
+
+ punpcklbw mm4, mm0
+ punpcklbw mm5, mm0
+
+ movq mm6, mm4
+ paddusw mm4, mm1
+ paddusw mm4, mm5
+ psrlw mm4, 1
+ psllq mm4, 8
+ por mm4, mm6
+
+ punpckhbw mm2, mm0
+ punpckhbw mm3, mm0
+
+ movq mm6, mm2
+ paddusw mm2, mm1
+ paddusw mm2, mm3
+
+ movq [ebx+esi*2], mm4
+
+ psrlw mm2, 1
+ psllq mm2, 8
+ por mm2, mm6
+
+ add esi, 0x08
+ cmp esi, [edx].HALF_WIDTH_D8
+ movq [ebx+esi*2-8], mm2
+ jl convyuv444
+
+ movq mm2, mm7
+ punpcklbw mm2, mm0
+ movq mm3, mm2
+
+ psllq mm2, 8
+ por mm2, mm3
+
+ movq [ebx+esi*2], mm2
+
+ punpckhbw mm7, mm0
+ movq mm6, mm7
+
+ psllq mm6, 8
+ por mm6, mm7
+
+ movq [ebx+esi*2+8], mm6
+
+ add eax, [edx].HALF_WIDTH
+ add ebx, [edx].Coded_Picture_Width
+ dec edi
+ cmp edi, 0x00
+ jg convyuv444init
+ }
+}
+
+void CMPEG2Dec::conv420to422(unsigned char *src, unsigned char *dst, int frame_type)
+{
+ if (frame_type)
+ {
+ __asm
+ {
+ push ebp
+ mov eax, [src]
+ mov ebx, [dst]
+ mov ebp, this
+ mov ecx, ebx
+ add ecx, ds:[ebp].HALF_WIDTH
+ mov esi, 0x00
+ movq mm3, [mmmask_0003]
+ pxor mm0, mm0
+ movq mm4, [mmmask_0002]
+
+ mov edx, eax
+ add edx, ds:[ebp].HALF_WIDTH
+convyuv422topp:
+ movd mm1, [eax+esi]
+ movd mm2, [edx+esi]
+ movd [ebx+esi], mm1
+ punpcklbw mm1, mm0
+ pmullw mm1, mm3
+ paddusw mm1, mm4
+ punpcklbw mm2, mm0
+ paddusw mm2, mm1
+ psrlw mm2, 0x02
+ packuswb mm2, mm0
+
+ add esi, 0x04
+ cmp esi, ds:[ebp].HALF_WIDTH
+ movd [ecx+esi-4], mm2
+ jl convyuv422topp
+
+ add eax, ds:[ebp].HALF_WIDTH
+ add ebx, ds:[ebp].Coded_Picture_Width
+ add ecx, ds:[ebp].Coded_Picture_Width
+ mov esi, 0x00
+
+ mov edi, ds:[ebp].PROGRESSIVE_HEIGHT
+convyuv422p:
+ movd mm1, [eax+esi]
+
+ punpcklbw mm1, mm0
+ mov edx, eax
+
+ pmullw mm1, mm3
+ sub edx, ds:[ebp].HALF_WIDTH
+
+ movd mm5, [edx+esi]
+ movd mm2, [edx+esi]
+
+ punpcklbw mm5, mm0
+ punpcklbw mm2, mm0
+ paddusw mm5, mm1
+ paddusw mm2, mm1
+ paddusw mm5, mm4
+ paddusw mm2, mm4
+ psrlw mm5, 0x02
+ psrlw mm2, 0x02
+ packuswb mm5, mm0
+ packuswb mm2, mm0
+
+ mov edx, eax
+ add edx, ds:[ebp].HALF_WIDTH
+ add esi, 0x04
+ cmp esi, ds:[ebp].HALF_WIDTH
+ movd [ebx+esi-4], mm5
+ movd [ecx+esi-4], mm2
+
+ jl convyuv422p
+
+ add eax, ds:[ebp].HALF_WIDTH
+ add ebx, ds:[ebp].Coded_Picture_Width
+ add ecx, ds:[ebp].Coded_Picture_Width
+ mov esi, 0x00
+ dec edi
+ cmp edi, 0x00
+ jg convyuv422p
+
+ mov edx, eax
+ sub edx, ds:[ebp].HALF_WIDTH
+convyuv422bottomp:
+ movd mm1, [eax+esi]
+ movd mm5, [edx+esi]
+ punpcklbw mm5, mm0
+ movd [ecx+esi], mm1
+
+ punpcklbw mm1, mm0
+ pmullw mm1, mm3
+ paddusw mm5, mm1
+ paddusw mm5, mm4
+ psrlw mm5, 0x02
+ packuswb mm5, mm0
+
+ add esi, 0x04
+ cmp esi, ds:[ebp].HALF_WIDTH
+ movd [ebx+esi-4], mm5
+ jl convyuv422bottomp
+ pop ebp
+ }
+ }
+ else
+ {
+ __asm
+ {
+ push ebp
+ mov eax, [src]
+ mov ecx, [dst]
+ mov ebp, this
+ mov esi, 0x00
+ pxor mm0, mm0
+ movq mm3, [mmmask_0003]
+ movq mm4, [mmmask_0004]
+ movq mm5, [mmmask_0005]
+
+convyuv422topi:
+ movd mm1, [eax+esi]
+ mov ebx, eax
+ add ebx, ds:[ebp].HALF_WIDTH
+ movd mm2, [ebx+esi]
+ movd [ecx+esi], mm1
+ punpcklbw mm1, mm0
+ movq mm6, mm1
+ pmullw mm1, mm3
+
+ punpcklbw mm2, mm0
+ movq mm7, mm2
+ pmullw mm2, mm5
+ paddusw mm2, mm1
+ paddusw mm2, mm4
+ psrlw mm2, 0x03
+ packuswb mm2, mm0
+
+ mov edx, ecx
+ add edx, ds:[ebp].HALF_WIDTH
+ pmullw mm6, mm5
+ movd [edx+esi], mm2
+
+ add ebx, ds:[ebp].HALF_WIDTH
+ movd mm2, [ebx+esi]
+ punpcklbw mm2, mm0
+ pmullw mm2, mm3
+ paddusw mm2, mm6
+ paddusw mm2, mm4
+ psrlw mm2, 0x03
+ packuswb mm2, mm0
+
+ add edx, ds:[ebp].HALF_WIDTH
+ add ebx, ds:[ebp].HALF_WIDTH
+ pmullw mm7, [mmmask_0007]
+ movd [edx+esi], mm2
+
+ movd mm2, [ebx+esi]
+ punpcklbw mm2, mm0
+ paddusw mm2, mm7
+ paddusw mm2, mm4
+ psrlw mm2, 0x03
+ packuswb mm2, mm0
+
+ add edx, ds:[ebp].HALF_WIDTH
+ add esi, 0x04
+ cmp esi, ds:[ebp].HALF_WIDTH
+ movd [edx+esi-4], mm2
+
+ jl convyuv422topi
+
+ add eax, ds:[ebp].Coded_Picture_Width
+ add ecx, ds:[ebp].DOUBLE_WIDTH
+ mov esi, 0x00
+
+ mov edi, ds:[ebp].INTERLACED_HEIGHT
+convyuv422i:
+ movd mm1, [eax+esi]
+ punpcklbw mm1, mm0
+ movq mm6, mm1
+ mov ebx, eax
+ sub ebx, ds:[ebp].Coded_Picture_Width
+ movd mm3, [ebx+esi]
+ pmullw mm1, [mmmask_0007]
+ punpcklbw mm3, mm0
+ paddusw mm3, mm1
+ paddusw mm3, mm4
+ psrlw mm3, 0x03
+ packuswb mm3, mm0
+
+ add ebx, ds:[ebp].HALF_WIDTH
+ movq mm1, [ebx+esi]
+ add ebx, ds:[ebp].Coded_Picture_Width
+ movd [ecx+esi], mm3
+
+ movq mm3, [mmmask_0003]
+ movd mm2, [ebx+esi]
+
+ punpcklbw mm1, mm0
+ pmullw mm1, mm3
+ punpcklbw mm2, mm0
+ movq mm7, mm2
+ pmullw mm2, mm5
+ paddusw mm2, mm1
+ paddusw mm2, mm4
+ psrlw mm2, 0x03
+ packuswb mm2, mm0
+
+ pmullw mm6, mm5
+ mov edx, ecx
+ add edx, ds:[ebp].HALF_WIDTH
+ movd [edx+esi], mm2
+
+ add ebx, ds:[ebp].HALF_WIDTH
+ movd mm2, [ebx+esi]
+ punpcklbw mm2, mm0
+ pmullw mm2, mm3
+ paddusw mm2, mm6
+ paddusw mm2, mm4
+ psrlw mm2, 0x03
+ packuswb mm2, mm0
+
+ pmullw mm7, [mmmask_0007]
+ add edx, ds:[ebp].HALF_WIDTH
+ add ebx, ds:[ebp].HALF_WIDTH
+ movd [edx+esi], mm2
+
+ movd mm2, [ebx+esi]
+ punpcklbw mm2, mm0
+ paddusw mm2, mm7
+ paddusw mm2, mm4
+ psrlw mm2, 0x03
+ packuswb mm2, mm0
+
+ add edx, ds:[ebp].HALF_WIDTH
+ add esi, 0x04
+ cmp esi, ds:[ebp].HALF_WIDTH
+ movd [edx+esi-4], mm2
+
+ jl convyuv422i
+ add eax, ds:[ebp].Coded_Picture_Width
+ add ecx, ds:[ebp].DOUBLE_WIDTH
+ mov esi, 0x00
+ dec edi
+ cmp edi, 0x00
+ jg convyuv422i
+
+convyuv422bottomi:
+ movd mm1, [eax+esi]
+ movq mm6, mm1
+ punpcklbw mm1, mm0
+ mov ebx, eax
+ sub ebx, ds:[ebp].Coded_Picture_Width
+ movd mm3, [ebx+esi]
+ punpcklbw mm3, mm0
+ pmullw mm1, [mmmask_0007]
+ paddusw mm3, mm1
+ paddusw mm3, mm4
+ psrlw mm3, 0x03
+ packuswb mm3, mm0
+
+ add ebx, ds:[ebp].HALF_WIDTH
+ movq mm1, [ebx+esi]
+ punpcklbw mm1, mm0
+ movd [ecx+esi], mm3
+
+ pmullw mm1, [mmmask_0003]
+ add ebx, ds:[ebp].Coded_Picture_Width
+ movd mm2, [ebx+esi]
+ punpcklbw mm2, mm0
+ movq mm7, mm2
+ pmullw mm2, mm5
+ paddusw mm2, mm1
+ paddusw mm2, mm4
+ psrlw mm2, 0x03
+ packuswb mm2, mm0
+
+ mov edx, ecx
+ add edx, ds:[ebp].HALF_WIDTH
+ pmullw mm7, [mmmask_0007]
+ movd [edx+esi], mm2
+
+ add edx, ds:[ebp].HALF_WIDTH
+ movd [edx+esi], mm6
+
+ punpcklbw mm6, mm0
+ paddusw mm6, mm7
+ paddusw mm6, mm4
+ psrlw mm6, 0x03
+ packuswb mm6, mm0
+
+ add edx, ds:[ebp].HALF_WIDTH
+ add esi, 0x04
+ cmp esi, ds:[ebp].HALF_WIDTH
+ movd [edx+esi-4], mm6
+
+ jl convyuv422bottomi
+ pop ebp
+ }
+ }
+}
+
+void CMPEG2Dec::conv444toRGB24(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch)
+{
+ int PWIDTH = pitch - DSTBYTES;
+
+ py += CLIP_STEP;
+ pu += CLIP_STEP;
+ pv += CLIP_STEP;
+
+ int Clip_Height = this->Clip_Height;
+ __int64 RGB_Offset = this->RGB_Offset;
+ __int64 RGB_Scale = this->RGB_Scale;
+ __int64 RGB_CBU = this->RGB_CBU;
+ __int64 RGB_CRV = this->RGB_CRV;
+ __int64 RGB_CGX = this->RGB_CGX;
+ int Clip_Width = this->Clip_Width;
+ int Coded_Picture_Width = this->Coded_Picture_Width;
+
+ __asm
+ {
+ mov eax, [py]
+ mov ebx, [pu]
+ mov ecx, [pv]
+ mov edx, [dst]
+ mov edi, Clip_Height
+ mov esi, 0x00
+ pxor mm0, mm0
+
+convRGB24:
+ movd mm1, [eax+esi]
+ movd mm3, [ebx+esi]
+ punpcklbw mm1, mm0
+ punpcklbw mm3, mm0
+ movd mm5, [ecx+esi]
+ punpcklbw mm5, mm0
+ movq mm7, [mmmask_0128]
+ psubw mm3, mm7
+ psubw mm5, mm7
+
+ psubw mm1, RGB_Offset
+ movq mm2, mm1
+ movq mm7, [mmmask_0001]
+ punpcklwd mm1, mm7
+ punpckhwd mm2, mm7
+ movq mm7, RGB_Scale
+ pmaddwd mm1, mm7
+ pmaddwd mm2, mm7
+
+ movq mm4, mm3
+ punpcklwd mm3, mm0
+ punpckhwd mm4, mm0
+ movq mm7, RGB_CBU
+ pmaddwd mm3, mm7
+ pmaddwd mm4, mm7
+ paddd mm3, mm1
+ paddd mm4, mm2
+ psrld mm3, 13
+ psrld mm4, 13
+ packuswb mm3, mm0
+ packuswb mm4, mm0
+
+ movq mm6, mm5
+ punpcklwd mm5, mm0
+ punpckhwd mm6, mm0
+ movq mm7, RGB_CRV
+ pmaddwd mm5, mm7
+ pmaddwd mm6, mm7
+ paddd mm5, mm1
+ paddd mm6, mm2
+ psrld mm5, 13
+ psrld mm6, 13
+ packuswb mm5, mm0
+ packuswb mm6, mm0
+
+ punpcklbw mm3, mm5
+ punpcklbw mm4, mm6
+ movq mm5, mm3
+ movq mm6, mm4
+ psrlq mm5, 16
+ psrlq mm6, 16
+ por mm3, mm5
+ por mm4, mm6
+
+ movd mm5, [ebx+esi]
+ movd mm6, [ecx+esi]
+ punpcklbw mm5, mm0
+ punpcklbw mm6, mm0
+ movq mm7, [mmmask_0128]
+ psubw mm5, mm7
+ psubw mm6, mm7
+
+ movq mm7, mm6
+ punpcklwd mm6, mm5
+ punpckhwd mm7, mm5
+ movq mm5, RGB_CGX
+ pmaddwd mm6, mm5
+ pmaddwd mm7, mm5
+ paddd mm6, mm1
+ paddd mm7, mm2
+
+ psrld mm6, 13
+ psrld mm7, 13
+ packuswb mm6, mm0
+ packuswb mm7, mm0
+
+ punpcklbw mm3, mm6
+ punpcklbw mm4, mm7
+
+ movq mm1, mm3
+ movq mm5, mm4
+ movq mm6, mm4
+
+ psrlq mm1, 32
+ psllq mm1, 24
+ por mm1, mm3
+
+ psrlq mm3, 40
+ psllq mm6, 16
+ por mm3, mm6
+ movd [edx], mm1
+
+ psrld mm4, 16
+ psrlq mm5, 24
+ por mm5, mm4
+ movd [edx+4], mm3
+
+ add edx, 0x0c
+ add esi, 0x04
+ cmp esi, Clip_Width
+ movd [edx-4], mm5
+
+ jl convRGB24
+
+ add eax, Coded_Picture_Width
+ add ebx, Coded_Picture_Width
+ add ecx, Coded_Picture_Width
+ add edx, PWIDTH
+ mov esi, 0x00
+ dec edi
+ cmp edi, 0x00
+ jg convRGB24
+
+ emms
+ }
+}
+
+// YUV 4:2:2 Format:
+// YUYV YUYV ...
+void CMPEG2Dec::conv422toYUY2(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch)
+{
+ py += CLIP_STEP;
+ pu += CLIP_STEP;
+ pv += CLIP_STEP;
+
+ int y = this->Clip_Height;
+ int Clip_Width_2 = this->Clip_Width / 2;
+ int Coded_Picture_Width = this->Coded_Picture_Width;
+ int Coded_Picture_Width_2 = this->Coded_Picture_Width / 2;
+
+ __asm
+ {
+ emms
+ mov eax, [py]
+ mov ebx, [pu]
+ mov ecx, [pv]
+ mov edx, [dst]
+ mov edi, Clip_Width_2
+ yloop:
+ xor esi, esi
+ xloop:
+ movd mm1, [eax+esi*2] ;0000YYYY
+ movd mm2, [ebx+esi] ;0000UUUU
+ movd mm3, [ecx+esi] ;0000VVVV
+ ;interleave this to VYUYVYUY
+ punpcklbw mm2, mm3 ;VUVUVUVU
+ punpcklbw mm1, mm2 ;VYUYVYUY
+ movq [edx+esi*4], mm1
+ movd mm1, [eax+esi*2+4] ;0000YYYY
+ punpckhdq mm2, mm2 ;xxxxVUVU
+ punpcklbw mm1, mm2 ;VYUYVYUY
+ movq [edx+esi*4+8], mm1
+ add esi, 4
+ cmp esi, edi
+ jb xloop
+ add edx, pitch
+ add eax, Coded_Picture_Width
+ add ebx, Coded_Picture_Width_2
+ add ecx, Coded_Picture_Width_2
+ dec y
+ jnz yloop
+ emms
+ }
+}
+
+//
+// codec
+//
+
+static const int ChromaFormat[4] = {
+ 0, 6, 8, 12
+};
+
+CMPEG2Dec::CMPEG2Dec()
+{
+ VF_File = 0;
+ VF_FrameLimit = VF_FrameBound = VF_GOPLimit = VF_GOPNow = VF_GOPSize =
+ VF_OldFrame = VF_OldRef = 0;
+ VF_FrameSize = VF_FrameRate = 0;
+ memset(Rdbfr, 0, sizeof(Rdbfr));
+ Rdptr = Rdmax = 0;
+ CurrentBfr = NextBfr = BitsLeft = Val = Read = 0;
+ Fault_Flag = File_Flag = File_Limit = FO_Flag = IDCT_Flag = SystemStream_Flag = 0;
+ Luminance_Flag = Resize_Flag = KeyOp_Flag = lfsr0 = lfsr1 = 0;
+ BufferOp = 0;
+ memset(intra_quantizer_matrix, 0, sizeof(intra_quantizer_matrix));
+ memset(non_intra_quantizer_matrix, 0, sizeof(non_intra_quantizer_matrix));
+ memset(chroma_intra_quantizer_matrix, 0, sizeof(chroma_intra_quantizer_matrix));
+ memset(chroma_non_intra_quantizer_matrix, 0, sizeof(chroma_non_intra_quantizer_matrix));
+ load_intra_quantizer_matrix =
+ load_non_intra_quantizer_matrix =
+ load_chroma_intra_quantizer_matrix =
+ load_chroma_non_intra_quantizer_matrix = 0;
+ q_scale_type =
+ alternate_scan =
+ quantizer_scale = 0;
+
+ int i;
+ for (i=0; i<MAX_FILE_NUMBER; i++) Infilename[i] = NULL;
+ for (i=0; i<8; i++) p_block[i] = block[i] = NULL;
+ p_fTempArray = fTempArray = NULL;
+ for (i=0; i<3; i++) backward_reference_frame[i] = forward_reference_frame[i] = auxframe[i] = NULL;
+ lum = NULL;
+ u422 = v422 = u444 = v444 = dstFrame = NULL;
+ hLibrary = NULL;
+
+ CheckCPU();
+}
+
+static char* myfgets(char* buff, int len, FILE* file)
+{
+ char* ret = buff;
+
+ ret[0] = 0;
+
+ while(ret = fgets(buff, len, file))
+ {
+ while(isspace(*ret)) ret++;
+ if(*ret) break;
+ }
+
+ return(ret);
+}
+
+int CMPEG2Dec::Open(LPCTSTR path, DstFormat dstFormat)
+{
+ m_dstFormat = dstFormat;
+ char ID[19], PASS[19] = "DVD2AVIProjectFile";
+ DWORD i, j, size, code, type, tff, rff, film, ntsc, gop, top, bottom, mapping;
+ int repeat_on, repeat_off, repeat_init;
+ int Clip_Top, Clip_Bottom, Clip_Left, Clip_Right, Squeeze_Width, Squeeze_Height;
+
+ HKEY key; DWORD value = REG_SZ; DWORD length = 256;
+ char *ext, buffer[256];
+
+ CMPEG2Dec* out = this;
+
+ out->VF_File = _tfopen(path, _T("r"));
+ if (out->VF_File==NULL)
+ return 0;
+ if (fgets(ID, 19, out->VF_File)==NULL)
+ return 0;
+ if (strcmp(ID, PASS))
+ return 0;
+
+ // load DLL
+ if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\VFPlugin", 0, KEY_ALL_ACCESS, &key)==ERROR_SUCCESS)
+ {
+ RegQueryValueExA(key, "DVD2AVI", NULL, &value, (unsigned char*)buffer, &length);
+
+ ext = strrchr(buffer, '\\');
+ sprintf(buffer + (int)(ext-buffer) + 1, "OpenDVD.dll");
+ RegCloseKey(key);
+ }
+
+ if ((hLibrary = LoadLibraryA(buffer)) != NULL)
+ BufferOp = (PBufferOp) GetProcAddress(hLibrary, "BufferOp");
+
+ for (i=0; i<MAX_FILE_NUMBER; i++)
+ Infilename[i] = new char[_MAX_PATH];
+
+ if(1 != fscanf(out->VF_File, "%d", &File_Limit))
+ return 0;
+
+ i = File_Limit;
+ while (i)
+ {
+ if(1 != fscanf(out->VF_File, "%d ", &j))
+ return 0;
+ fgets(Infilename[File_Limit-i], j+1, out->VF_File);
+ if ((Infile[File_Limit-i] = _open(Infilename[File_Limit-i], _O_RDONLY | _O_BINARY))==-1)
+ return 0;
+ i--;
+ }
+
+ if(3 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "\nStream_Type=%d,%X,%X\n", &SystemStream_Flag, &lfsr0, &lfsr1))
+ return 0;
+ if (lfsr0 || lfsr1)
+ KeyOp_Flag = 1;
+ else
+ KeyOp_Flag = 0;
+
+ if(1 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "iDCT_Algorithm=%d\n", &IDCT_Flag))
+ return 0;
+
+ switch (IDCT_Flag)
+ {
+ case IDCT_SSEMMX:
+ if (!cpu.ssemmx)
+ IDCT_Flag = IDCT_MMX;
+ break;
+
+ case IDCT_FPU:
+ Initialize_FPU_IDCT();
+ break;
+
+ case IDCT_REF:
+ Initialize_REF_IDCT();
+ break;
+ }
+
+ File_Flag = 0;
+ _lseeki64(Infile[0], 0, SEEK_SET);
+ Initialize_Buffer();
+
+ do
+ {
+ next_start_code();
+ code = Get_Bits(32);
+ }
+ while (code!=SEQUENCE_HEADER_CODE);
+
+ sequence_header();
+
+ mb_width = (horizontal_size+15)/16;
+ mb_height = progressive_sequence ? (vertical_size+15)/16 : 2*((vertical_size+31)/32);
+
+ Coded_Picture_Width = 16 * mb_width;
+ Coded_Picture_Height = 16 * mb_height;
+
+ Chroma_Width = (chroma_format==CHROMA444) ? Coded_Picture_Width : Coded_Picture_Width>>1;
+ Chroma_Height = (chroma_format!=CHROMA420) ? Coded_Picture_Height : Coded_Picture_Height>>1;
+
+ block_count = ChromaFormat[chroma_format];
+
+ for (i=0; i<8; i++)
+ {
+ p_block[i] = (short *)new BYTE[sizeof(short)*64 + 64];
+ block[i] = (short *)((long)p_block[i] + 64 - (long)p_block[i]%64);
+ }
+
+ p_fTempArray = (void *)new BYTE[sizeof(float)*128 + 64];
+ fTempArray = (void *)((long)p_fTempArray + 64 - (long)p_fTempArray%64);
+
+ for (i=0; i<3; i++)
+ {
+ if (i==0)
+ size = Coded_Picture_Width * Coded_Picture_Height;
+ else
+ size = Chroma_Width * Chroma_Height;
+
+ backward_reference_frame[i] = new unsigned char[size];
+ forward_reference_frame[i] = new unsigned char[size];
+ auxframe[i] = new unsigned char[size];
+ }
+
+ if(1 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "YUVRGB_Scale=%d\n", &i))
+ return 0;
+
+ if (i)
+ {
+ RGB_Scale = 0x1000254310002543;
+ RGB_Offset = 0x0010001000100010;
+ RGB_CBU = 0x0000408D0000408D;
+ RGB_CGX = 0xF377E5FCF377E5FC;
+ RGB_CRV = 0x0000331300003313;
+ }
+ else
+ {
+ RGB_Scale = 0x1000200010002000;
+ RGB_Offset = 0x0000000000000000;
+ RGB_CBU = 0x000038B4000038B4;
+ RGB_CGX = 0xF4FDE926F4FDE926;
+ RGB_CRV = 0x00002CDD00002CDD;
+ }
+
+ char* tmp = myfgets(buffer, sizeof(buffer), out->VF_File);
+ if(2 != sscanf(tmp, "Luminance=%d,%d\n", &i, &j))
+ {
+ if(2 != sscanf(tmp, "Luminance_Filter=%d,%d\n", &i, &j))
+ return 0;
+ i=128; j=0;
+ }
+
+ if (i==128 && j==0)
+ Luminance_Flag = 0;
+ else
+ {
+ Luminance_Flag = 1;
+ LumGainMask = ((__int64)i<<48) + ((__int64)i<<32) + ((__int64)i<<16) + (__int64)i;
+ LumOffsetMask = ((__int64)j<<48) + ((__int64)j<<32) + ((__int64)j<<16) + (__int64)j;
+
+ lum = new unsigned char[Coded_Picture_Width * Coded_Picture_Height];
+ }
+
+ if(6 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "Picture_Size=%d,%d,%d,%d,%d,%d\n",
+ &Clip_Top, &Clip_Bottom, &Clip_Left, &Clip_Right, &Squeeze_Width, &Squeeze_Height))
+ return 0;
+
+ Resize_Flag = 0;
+ Resize_Width = Clip_Width = Coded_Picture_Width;
+ Resize_Height = Clip_Height = Coded_Picture_Height;
+ CLIP_AREA = HALF_CLIP_AREA = CLIP_STEP = 0;
+
+ if (Clip_Top || Clip_Bottom || Clip_Left || Clip_Right)
+ {
+ Clip_Width -= Clip_Left+Clip_Right;
+ Clip_Height -= Clip_Top+Clip_Bottom;
+ Resize_Width = Clip_Width;
+ Resize_Height = Clip_Height;
+
+ CLIP_AREA = Coded_Picture_Width * Clip_Top;
+ HALF_CLIP_AREA = (Coded_Picture_Width>>1) * Clip_Top;
+ CLIP_STEP = Coded_Picture_Width * Clip_Top + Clip_Left;
+ }
+
+ if (Squeeze_Width || Squeeze_Height)
+ {
+ Resize_Flag = 1;
+ Resize_Width -= Squeeze_Width;
+ Resize_Height -= Squeeze_Height;
+ }
+
+ DSTBYTES = Clip_Width * (dstRGB24() ? 3 : 2);
+ DSTBYTES2 = DSTBYTES * 2;
+ LUM_AREA = Coded_Picture_Width * Clip_Height;
+ PROGRESSIVE_HEIGHT = (Coded_Picture_Height>>1) - 2;
+ INTERLACED_HEIGHT = (Coded_Picture_Height>>2) - 2;
+ HALF_WIDTH = Coded_Picture_Width>>1;
+ HALF_WIDTH_D8 = (Coded_Picture_Width>>1) - 8;
+ DOUBLE_WIDTH = Coded_Picture_Width<<1;
+
+ u422 = new unsigned char[Coded_Picture_Width * Coded_Picture_Height / 2];
+ v422 = new unsigned char[Coded_Picture_Width * Coded_Picture_Height / 2];
+ u444 = new unsigned char[Coded_Picture_Width * Coded_Picture_Height];
+ v444 = new unsigned char[Coded_Picture_Width * Coded_Picture_Height];
+ dstFrame = new unsigned char[Clip_Width * Clip_Height * 4]; // max value (super set)
+
+ if(1 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "Field_Operation=%d\n", &FO_Flag))
+ return 0;
+ if(1 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "Frame_Rate=%d\n", &(out->VF_FrameRate)))
+ return 0;
+ if(4 != sscanf(myfgets(buffer, sizeof(buffer), out->VF_File), "Location=%d,%X,%d,%X\n", &i, &j, &i, &j))
+ return 0;
+
+ ntsc = film = top = bottom = gop = mapping = repeat_on = repeat_off = repeat_init = 0;
+
+ while (1 == fscanf(out->VF_File, "%d", &type) && type<9)
+ {
+ if (type==7) // I frame
+ {
+ GOPList[gop] = reinterpret_cast<GOPLIST*>(calloc(1, sizeof(GOPLIST)));
+ GOPList[gop]->number = film;
+ if(2 != fscanf(out->VF_File, "%d %X", &(GOPList[gop]->file), &j))
+ break;
+
+ GOPList[gop]->position = (__int64)j*BUFFER_SIZE;
+ gop ++;
+
+ if(1 != fscanf(out->VF_File, "%d", &j))
+ break;
+
+ tff = j>>1;
+ rff = j & 1;
+ }
+ else // P, B frame
+ {
+ tff = type>>1;
+ rff = type & 1;
+ }
+
+ if (!film)
+ {
+ if (tff)
+ Field_Order = 1;
+ else
+ Field_Order = 0;
+ }
+
+ if (FO_Flag==FO_FILM)
+ {
+ if (rff)
+ repeat_on++;
+ else
+ repeat_off++;
+
+ if (repeat_init)
+ {
+ if (repeat_off-repeat_on == 5)
+ {
+ repeat_on = repeat_off = 0;
+ }
+ else
+ {
+ FrameList[mapping] = reinterpret_cast<FRAMELIST*>(calloc(1, sizeof(FRAMELIST)));
+ FrameList[mapping]->top = FrameList[mapping]->bottom = film;
+ mapping ++;
+ }
+
+ if (repeat_on-repeat_off == 5)
+ {
+ repeat_on = repeat_off = 0;
+ FrameList[mapping] = reinterpret_cast<FRAMELIST*>(calloc(1, sizeof(FRAMELIST)));
+ FrameList[mapping]->top = FrameList[mapping]->bottom = film;
+ mapping ++;
+ }
+ }
+ else
+ {
+ if (repeat_off-repeat_on == 3)
+ {
+ repeat_on = repeat_off = 0;
+ repeat_init = 1;
+ }
+ else
+ {
+ FrameList[mapping] = reinterpret_cast<FRAMELIST*>(calloc(1, sizeof(FRAMELIST)));
+ FrameList[mapping]->top = FrameList[mapping]->bottom = film;
+ mapping ++;
+ }
+
+ if (repeat_on-repeat_off == 3)
+ {
+ repeat_on = repeat_off = 0;
+ repeat_init = 1;
+
+ FrameList[mapping] = reinterpret_cast<FRAMELIST*>(calloc(1, sizeof(FRAMELIST)));
+ FrameList[mapping]->top = FrameList[mapping]->bottom = film;
+ mapping ++;
+ }
+ }
+ }
+ else
+ {
+ if (top)
+ {
+ FrameList[ntsc]->bottom = film;
+ ntsc ++;
+ FrameList[ntsc] = reinterpret_cast<FRAMELIST*>(calloc(1, sizeof(FRAMELIST)));
+ FrameList[ntsc]->top = film;
+ }
+ else if (bottom)
+ {
+ FrameList[ntsc]->top = film;
+ ntsc ++;
+ FrameList[ntsc] = reinterpret_cast<FRAMELIST*>(calloc(1, sizeof(FRAMELIST)));
+ FrameList[ntsc]->bottom = film;
+ }
+ else
+ {
+ FrameList[ntsc] = reinterpret_cast<FRAMELIST*>(calloc(1, sizeof(FRAMELIST)));
+ FrameList[ntsc]->top = film;
+ FrameList[ntsc]->bottom = film;
+ ntsc ++;
+ }
+
+ if (rff)
+ {
+ if (!top && !bottom)
+ FrameList[ntsc] = reinterpret_cast<FRAMELIST*>(calloc(1, sizeof(FRAMELIST)));
+
+ if (tff)
+ {
+ FrameList[ntsc]->top = film;
+ top = 1;
+ }
+ else
+ {
+ FrameList[ntsc]->bottom = film;
+ bottom = 1;
+ }
+
+ if (top && bottom)
+ {
+ top = bottom = 0;
+ ntsc ++;
+ }
+ }
+ }
+
+ film ++;
+ }
+
+ out->VF_FrameBound = film;
+ film -= 2;
+
+ if (FO_Flag==FO_FILM)
+ {
+ while (FrameList[mapping-1]->top >= film)
+ mapping --;
+
+ out->VF_FrameLimit = mapping;
+ }
+ else
+ {
+ if (FO_Flag==FO_SWAP)
+ {
+ Field_Order = !Field_Order;
+
+ if (Field_Order)
+ for (i=0; i<ntsc-1; i++)
+ FrameList[i]->bottom = FrameList[i+1]->bottom;
+ else
+ for (i=0; i<ntsc-1; i++)
+ FrameList[i]->top = FrameList[i+1]->top;
+ }
+
+ while ((FrameList[ntsc-1]->top >= film) || (FrameList[ntsc-1]->bottom >= film))
+ ntsc --;
+
+ out->VF_FrameLimit = ntsc;
+
+ for (i=0; i<out->VF_FrameLimit-1; i++)
+ if (FrameList[i]->top==FrameList[i+1]->top || FrameList[i]->top==FrameList[i+1]->bottom ||
+ FrameList[i]->bottom==FrameList[i+1]->top || FrameList[i]->bottom==FrameList[i+1]->bottom)
+ {
+ FrameList[i]->forward = 1;
+ FrameList[i+1]->backward = 1;
+ }
+ }
+
+ Full_Frame = 1;
+ for (i=0; i<out->VF_FrameLimit; i++)
+ if (FrameList[i]->top!=FrameList[i]->bottom)
+ {
+ Full_Frame = 0;
+ break;
+ }
+
+ out->VF_GOPNow = out->VF_GOPLimit = gop;
+ out->VF_OldFrame = out->VF_FrameLimit;
+ out->VF_FrameSize = Clip_Width * Clip_Height * 3;
+
+ return 1;
+}
+
+void CMPEG2Dec::Decode(unsigned char *dst, DWORD frame, int pitch)
+{
+ DWORD i, now, size, origin, ref, fo;
+ int remain;
+
+ CMPEG2Dec* in = this;
+
+ if (FO_Flag==FO_FILM)
+ {
+ fo = 0;
+ frame = FrameList[frame]->top;
+ }
+
+ origin = frame;
+
+ if (FO_Flag!=FO_FILM)
+ {
+ if (FrameList[frame]->top == FrameList[frame]->bottom)
+ {
+ fo = 0;
+ frame = FrameList[frame]->top;
+ }
+ else if (FrameList[frame]->top < FrameList[frame]->bottom)
+ {
+ fo = 1;
+ frame = FrameList[frame]->top;
+ }
+ else
+ {
+ fo = 2;
+ frame = FrameList[frame]->bottom;
+ }
+ }
+
+ ref = frame;
+
+ if (frame >= GOPList[in->VF_GOPLimit-1]->number)
+ {
+ now = in->VF_GOPLimit-1;
+ ref -= GOPList[in->VF_GOPLimit-1]->number;
+ size = in->VF_FrameBound - GOPList[in->VF_GOPLimit-1]->number + 1;
+ }
+ else
+ for (now = 0; now < (in->VF_GOPLimit-1); now++)
+ {
+ if (frame>=GOPList[now]->number && frame<GOPList[now+1]->number)
+ {
+ ref -= GOPList[now]->number;
+ size = GOPList[now+1]->number - GOPList[now]->number + 1;
+ break;
+ }
+ }
+
+ if (fo)
+ ref ++;
+
+ if (now != in->VF_GOPNow)
+ {
+ if ((in->VF_OldFrame + 1)==origin)
+ {
+ if (Full_Frame)
+ {
+ Get_Hdr();
+ Decode_Picture(1, dst, pitch);
+
+ if (picture_structure!=FRAME_PICTURE)
+ {
+ Get_Hdr();
+ Decode_Picture(1, dst, pitch);
+ }
+ }
+ else
+ switch (fo)
+ {
+ case 0:
+ if (!FrameList[origin]->backward)
+ {
+ Get_Hdr();
+ Decode_Picture(1, dst, pitch);
+
+ if (picture_structure!=FRAME_PICTURE)
+ {
+ Get_Hdr();
+ Decode_Picture(1, dst, pitch);
+ }
+
+ if (FrameList[origin]->forward)
+ {
+ if (Field_Order)
+ Copyodd(dst, dstFrame, pitch, 1);
+ else
+ Copyeven(dst, dstFrame, pitch, 1);
+ }
+ }
+ else
+ {
+ Copyodd(dstFrame, dst, pitch, 0);
+ Copyeven(dstFrame, dst, pitch, 0);
+ }
+ break;
+
+ case 1:
+ Copyodd(dstFrame, dst, pitch, 0);
+
+ Get_Hdr();
+ Decode_Picture(1, dstFrame, DSTBYTES);
+
+ if (picture_structure!=FRAME_PICTURE)
+ {
+ Get_Hdr();
+ Decode_Picture(1, dstFrame, DSTBYTES);
+ }
+
+ Copyeven(dstFrame, dst, pitch, 0);
+ break;
+
+ case 2:
+ Copyeven(dstFrame, dst, pitch, 0);
+
+ Get_Hdr();
+ Decode_Picture(1, dstFrame, DSTBYTES);
+
+ if (picture_structure!=FRAME_PICTURE)
+ {
+ Get_Hdr();
+ Decode_Picture(1, dstFrame, DSTBYTES);
+ }
+
+ Copyodd(dstFrame, dst, pitch, 0);
+ break;
+ }
+
+ if (in->VF_GOPSize)
+ {
+ for (i=0; i < in->VF_GOPSize; i++)
+ free(GOPBuffer[i]);
+
+ in->VF_GOPSize = 0;
+ }
+
+ in->VF_GOPNow = in->VF_GOPLimit;
+ in->VF_OldFrame = origin;
+ return;
+ }
+
+ remain = ref;
+ in->VF_OldRef = ref;
+ in->VF_GOPNow = now;
+ Second_Field = 0;
+
+ if (size < in->VF_GOPSize)
+ for (i=0; i < (in->VF_GOPSize - size); i++)
+ free(GOPBuffer[size+i]);
+ else if (size > in->VF_GOPSize)
+ for (i=0; i < (size - in->VF_GOPSize); i++)
+ GOPBuffer[in->VF_GOPSize+i] = reinterpret_cast<unsigned char*>(malloc(in->VF_FrameSize));
+
+ in->VF_GOPSize = size;
+
+ File_Flag = GOPList[now]->file;
+ _lseeki64(Infile[GOPList[now]->file], GOPList[now]->position, SEEK_SET);
+ Initialize_Buffer();
+
+ while (Get_Hdr() && picture_coding_type!=I_TYPE);
+
+ Decode_Picture(0, dst, pitch);
+
+ while (Get_Hdr() && picture_coding_type==B_TYPE);
+
+ if (picture_structure!=FRAME_PICTURE)
+ {
+ Decode_Picture(0, dst, pitch);
+ Get_Hdr();
+ }
+
+ Decode_Picture(1, dst, pitch);
+
+ if (picture_structure!=FRAME_PICTURE)
+ {
+ Get_Hdr();
+ Decode_Picture(1, dst, pitch);
+ }
+
+ Copyodd(dst, GOPBuffer[0], pitch, 1);
+ Copyeven(dst, GOPBuffer[0], pitch, 1);
+
+ while (remain && Get_Hdr())
+ {
+ Decode_Picture(1, dst, pitch);
+
+ if (picture_structure!=FRAME_PICTURE)
+ {
+ Get_Hdr();
+ Decode_Picture(1, dst, pitch);
+ }
+
+ Copyodd(dst, GOPBuffer[ref - remain + 1], pitch, 1);
+ Copyeven(dst, GOPBuffer[ref - remain + 1], pitch, 1);
+
+ remain--;
+ }
+
+ if (!Full_Frame && ref>=(size-2))
+ {
+ Copyodd(dst, dstFrame, pitch, 1);
+ Copyeven(dst, dstFrame, pitch, 1);
+ }
+ }
+ else
+ {
+ remain = ref - in->VF_OldRef;
+
+ if (remain > 0)
+ {
+ in->VF_OldRef = ref;
+
+ while (remain && Get_Hdr())
+ {
+ Decode_Picture(1, dst, pitch);
+
+ if (picture_structure!=FRAME_PICTURE)
+ {
+ Get_Hdr();
+ Decode_Picture(1, dst, pitch);
+ }
+
+ Copyodd(dst, GOPBuffer[ref - remain + 1], pitch, 1);
+ Copyeven(dst, GOPBuffer[ref - remain + 1], pitch, 1);
+
+ remain--;
+ }
+
+ if (!Full_Frame && ref>=(size-2))
+ {
+ Copyodd(dst, dstFrame, pitch, 1);
+ Copyeven(dst, dstFrame, pitch, 1);
+ }
+ }
+ }
+
+ switch (fo)
+ {
+ case 0:
+ Copyodd(GOPBuffer[ref], dst, pitch, 0);
+ Copyeven(GOPBuffer[ref], dst, pitch, 0);
+ break;
+
+ case 1:
+ Copyodd(GOPBuffer[ref-1], dst, pitch, 0);
+ Copyeven(GOPBuffer[ref], dst, pitch, 0);
+ break;
+
+ case 2:
+ Copyodd(GOPBuffer[ref], dst, pitch, 0);
+ Copyeven(GOPBuffer[ref-1], dst, pitch, 0);
+ break;
+ }
+
+ in->VF_OldFrame = origin;
+}
+
+void CMPEG2Dec::Close()
+{
+ int i;
+
+ for(i = 0; i < VF_GOPLimit; i++) free(GOPList[i]);
+ for(i = 0; i < VF_FrameLimit; i++) free(FrameList[i]);
+
+ if (VF_File != NULL)
+ fclose(VF_File);
+
+ while (VF_GOPSize)
+ {
+ VF_GOPSize--;
+ free(GOPBuffer[VF_GOPSize]);
+ }
+
+ while (File_Limit)
+ {
+ File_Limit--;
+ _close(Infile[File_Limit]);
+ }
+
+ for (i=0; i<MAX_FILE_NUMBER; i++)
+ delete [] Infilename[i];
+
+ for (i=0; i<3; i++)
+ {
+ delete [] backward_reference_frame[i];
+ delete [] forward_reference_frame[i];
+ delete [] auxframe[i];
+ }
+
+ delete [] u422;
+ delete [] v422;
+ delete [] u444;
+ delete [] v444;
+ delete [] dstFrame;
+
+ if(Luminance_Flag)
+ delete [] lum;
+
+ for (i=0; i<8; i++)
+ delete [] p_block[i];
+
+ delete [] p_fTempArray;
+
+ if (hLibrary)
+ FreeLibrary(hLibrary);
+}
+
+void CMPEG2Dec::Copyodd(unsigned char *src, unsigned char *dst, int pitch, int forward)
+{
+ int i;
+ int PWIDTH = forward ? (pitch<<1) : DSTBYTES2;
+ int QWIDTH = forward ? DSTBYTES2 : (pitch<<1);
+
+ for (i=0; i<(Clip_Height>>1); i++)
+ {
+ memcpy (dst, src, DSTBYTES);
+ src += PWIDTH;
+ dst += QWIDTH;
+ }
+}
+
+void CMPEG2Dec::Copyeven(unsigned char *src, unsigned char *dst, int pitch, int forward)
+{
+ int i;
+ int PWIDTH = forward ? (pitch<<1) : DSTBYTES2;
+ int QWIDTH = forward ? DSTBYTES2 : (pitch<<1);
+ src += forward ? pitch : DSTBYTES;
+ dst += forward ? DSTBYTES : pitch;
+
+ for (i=0; i<(Clip_Height>>1); i++)
+ {
+ memcpy (dst, src, DSTBYTES);
+ src += PWIDTH;
+ dst += QWIDTH;
+ }
+}
diff --git a/src/filters/source/d2vsource/MPEG2Dec.h b/src/filters/source/d2vsource/MPEG2Dec.h
new file mode 100644
index 000000000..34368208b
--- /dev/null
+++ b/src/filters/source/d2vsource/MPEG2Dec.h
@@ -0,0 +1,304 @@
+#pragma once
+
+#include <windows.h>
+#include <winreg.h>
+#include <stdio.h>
+#include <io.h>
+#include <fcntl.h>
+
+/* code definition */
+#define PICTURE_START_CODE 0x100
+#define SLICE_START_CODE_MIN 0x101
+#define SLICE_START_CODE_MAX 0x1AF
+#define USER_DATA_START_CODE 0x1B2
+#define SEQUENCE_HEADER_CODE 0x1B3
+#define EXTENSION_START_CODE 0x1B5
+#define SEQUENCE_END_CODE 0x1B7
+#define GROUP_START_CODE 0x1B8
+
+#define SYSTEM_END_CODE 0x1B9
+#define PACK_START_CODE 0x1BA
+#define SYSTEM_START_CODE 0x1BB
+#define PRIVATE_STREAM_1 0x1BD
+#define VIDEO_ELEMENTARY_STREAM 0x1E0
+
+/* extension start code IDs */
+#define SEQUENCE_EXTENSION_ID 1
+#define SEQUENCE_DISPLAY_EXTENSION_ID 2
+#define QUANT_MATRIX_EXTENSION_ID 3
+#define COPYRIGHT_EXTENSION_ID 4
+#define PICTURE_DISPLAY_EXTENSION_ID 7
+#define PICTURE_CODING_EXTENSION_ID 8
+
+#define ZIG_ZAG 0
+#define MB_WEIGHT 32
+#define MB_CLASS4 64
+
+#define I_TYPE 1
+#define P_TYPE 2
+#define B_TYPE 3
+
+#define TOP_FIELD 1
+#define BOTTOM_FIELD 2
+#define FRAME_PICTURE 3
+
+#define MACROBLOCK_INTRA 1
+#define MACROBLOCK_PATTERN 2
+#define MACROBLOCK_MOTION_BACKWARD 4
+#define MACROBLOCK_MOTION_FORWARD 8
+#define MACROBLOCK_QUANT 16
+
+#define MC_FIELD 1
+#define MC_FRAME 2
+#define MC_16X8 2
+#define MC_DMV 3
+
+#define MV_FIELD 0
+#define MV_FRAME 1
+
+#define CHROMA420 1
+#define CHROMA422 2
+#define CHROMA444 3
+
+#define BUFFER_SIZE 2048
+#define MAX_FILE_NUMBER 256
+
+#define IDCT_MMX 1
+#define IDCT_SSEMMX 2
+#define IDCT_FPU 3
+#define IDCT_REF 4
+
+#define FO_NONE 0
+#define FO_FILM 1
+#define FO_SWAP 2
+
+
+typedef void (WINAPI *PBufferOp) (unsigned char*, int, int);
+
+#define MAX_FRAME_NUMBER 1000000
+#define MAX_GOP_SIZE 1024
+
+
+class CMPEG2Dec
+{
+protected:
+
+ // getbit.cpp
+ void Initialize_Buffer();
+ void Fill_Buffer();
+ void Next_Packet();
+ void Flush_Buffer_All(unsigned int N);
+ unsigned int Get_Bits_All(unsigned int N);
+ void Next_File();
+
+ unsigned int Show_Bits(unsigned int N);
+ unsigned int Get_Bits(unsigned int N);
+ void Flush_Buffer(unsigned int N);
+ void Fill_Next();
+ unsigned int Get_Byte();
+ unsigned int Get_Short();
+ void next_start_code();
+
+ unsigned char Rdbfr[BUFFER_SIZE], *Rdptr, *Rdmax;
+ unsigned int CurrentBfr, NextBfr, BitsLeft, Val, Read;
+
+ // gethdr.cpp
+ int Get_Hdr();
+ void sequence_header();
+ int slice_header();
+private:
+ void group_of_pictures_header();
+ void picture_header();
+ void sequence_extension();
+ void sequence_display_extension();
+ void quant_matrix_extension();
+ void picture_display_extension();
+ void picture_coding_extension();
+ void copyright_extension();
+ int extra_bit_information();
+ void extension_and_user_data();
+
+protected:
+ // getpic.cpp
+ void Decode_Picture(int ref, unsigned char *dst, int pitch);
+private:
+ void Update_Picture_Buffers();
+ void picture_data();
+ int slice(int MBAmax);
+ void macroblock_modes(int *pmacroblock_type, int *pmotion_type,
+ int *pmotion_vector_count, int *pmv_format, int *pdmv, int *pmvscale, int *pdct_type);
+ void Clear_Block(int count);
+ void Add_Block(int count, int bx, int by, int dct_type, int addflag);
+ void motion_compensation(int MBA, int macroblock_type, int motion_type,
+ int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2], int dct_type);
+ void skipped_macroblock(int dc_dct_pred[3], int PMV[2][2][2],
+ int *motion_type, int motion_vertical_field_select[2][2], int *macroblock_type);
+ int start_of_slice(int *MBA, int *MBAinc, int dc_dct_pred[3], int PMV[2][2][2]);
+ int decode_macroblock(int *macroblock_type, int *motion_type, int *dct_type,
+ int PMV[2][2][2], int dc_dct_pred[3], int motion_vertical_field_select[2][2], int dmvector[2]);
+ void Decode_MPEG2_Intra_Block(int comp, int dc_dct_pred[]);
+ void Decode_MPEG2_Non_Intra_Block(int comp);
+
+ int Get_macroblock_type();
+ int Get_I_macroblock_type();
+ int Get_P_macroblock_type();
+ int Get_B_macroblock_type();
+ int Get_D_macroblock_type();
+ int Get_coded_block_pattern();
+ int Get_macroblock_address_increment();
+ int Get_Luma_DC_dct_diff();
+ int Get_Chroma_DC_dct_diff();
+
+ void form_predictions(int bx, int by, int macroblock_type, int motion_type,
+ int PMV[2][2][2], int motion_vertical_field_select[2][2], int dmvector[2]);
+ void form_prediction(unsigned char *src[], int sfield, unsigned char *dst[], int dfield,
+ int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
+ void form_component_prediction(unsigned char *src, unsigned char *dst,
+ int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int average_flag);
+
+ // motion.cpp
+ void motion_vectors(int PMV[2][2][2], int dmvector[2], int motion_vertical_field_select[2][2],
+ int s, int motion_vector_count, int mv_format,
+ int h_r_size, int v_r_size, int dmv, int mvscale);
+ void Dual_Prime_Arithmetic(int DMV[][2], int *dmvector, int mvx, int mvy);
+private:
+ void motion_vector(int *PMV, int *dmvector, int h_r_size, int v_r_size,
+ int dmv, int mvscale, int full_pel_vector);
+ void decode_motion_vector(int *pred, int r_size, int motion_code,
+ int motion_residualesidual, int full_pel_vector);
+ int Get_motion_code();
+ int Get_dmvector();
+
+protected:
+ // store.cpp
+ void assembleFrame(unsigned char *src[], int pf, unsigned char *dst, int pitch);
+private:
+ void Luminance_Filter(unsigned char *src, unsigned char *dst);
+ void conv420to422(unsigned char *src, unsigned char *dst, int frame_type);
+ void conv422to444(unsigned char *src, unsigned char *dst);
+ void conv444toRGB24(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
+ void conv422toYUY2(unsigned char *py, unsigned char *pu, unsigned char *pv, unsigned char *dst, int pitch);
+
+protected:
+ // decoder operation control flags
+ int Fault_Flag;
+ int File_Flag;
+ int File_Limit;
+ int FO_Flag;
+ int IDCT_Flag;
+ int SystemStream_Flag;
+
+ int Luminance_Flag;
+ int Resize_Flag;
+
+ int KeyOp_Flag;
+ int lfsr0, lfsr1;
+ PBufferOp BufferOp;
+
+ int Infile[MAX_FILE_NUMBER];
+ char *Infilename[MAX_FILE_NUMBER];
+
+ int intra_quantizer_matrix[64];
+ int non_intra_quantizer_matrix[64];
+ int chroma_intra_quantizer_matrix[64];
+ int chroma_non_intra_quantizer_matrix[64];
+
+ int load_intra_quantizer_matrix;
+ int load_non_intra_quantizer_matrix;
+ int load_chroma_intra_quantizer_matrix;
+ int load_chroma_non_intra_quantizer_matrix;
+
+ int q_scale_type;
+ int alternate_scan;
+ int quantizer_scale;
+
+ void *fTempArray, *p_fTempArray;
+ short *block[8], *p_block[8];
+ int pf_backward, pf_forward, pf_current;
+
+ // global values
+ unsigned char *backward_reference_frame[3], *forward_reference_frame[3];
+ unsigned char *auxframe[3], *current_frame[3];
+ unsigned char *u422, *v422, *u444, *v444, /* *rgb24,*/ *lum;
+ unsigned char *dstFrame; // replaces rgb24
+ __int64 RGB_Scale, RGB_Offset, RGB_CRV, RGB_CBU, RGB_CGX, LumOffsetMask, LumGainMask;
+
+ int HALF_WIDTH, PROGRESSIVE_HEIGHT, INTERLACED_HEIGHT, DOUBLE_WIDTH;
+ int /*TWIDTH, SWIDTH,*/ HALF_WIDTH_D8, LUM_AREA, CLIP_AREA, HALF_CLIP_AREA, CLIP_STEP;
+ int DSTBYTES, DSTBYTES2; // these replace TWIDTH and SWIDTH
+public:
+ int Clip_Width, Clip_Height, Resize_Width, Resize_Height;
+protected:
+
+ int Coded_Picture_Width, Coded_Picture_Height, Chroma_Width, Chroma_Height;
+ int block_count, Second_Field;
+ int horizontal_size, vertical_size, mb_width, mb_height;
+
+ /* ISO/IEC 13818-2 section 6.2.2.3: sequence_extension() */
+ int progressive_sequence;
+ int chroma_format;
+
+ /* ISO/IEC 13818-2 section 6.2.3: picture_header() */
+ int picture_coding_type;
+ int temporal_reference;
+
+ /* ISO/IEC 13818-2 section 6.2.3.1: picture_coding_extension() header */
+ int f_code[2][2];
+ int picture_structure;
+ int frame_pred_frame_dct;
+ int progressive_frame;
+ int concealment_motion_vectors;
+ int intra_dc_precision;
+ int top_field_first;
+ int repeat_first_field;
+ int intra_vlc_format;
+
+ // interface
+ typedef struct {
+ DWORD number;
+ int file;
+ __int64 position;
+ } GOPLIST;
+ GOPLIST *GOPList[MAX_FRAME_NUMBER];
+
+ typedef struct {
+ DWORD top;
+ DWORD bottom;
+ char forward;
+ char backward;
+ } FRAMELIST;
+ FRAMELIST *FrameList[MAX_FRAME_NUMBER];
+
+ unsigned char *GOPBuffer[MAX_GOP_SIZE];
+public:
+ BOOL Field_Order, Full_Frame;
+protected:
+ HINSTANCE hLibrary;
+
+ void Copyodd(unsigned char *src, unsigned char *dst, int pitch, int forward);
+ void Copyeven(unsigned char *src, unsigned char *dst, int pitch, int forward);
+public:
+ FILE *VF_File;
+ int VF_FrameRate;
+ DWORD VF_FrameLimit;
+ DWORD VF_FrameBound;
+ DWORD VF_GOPLimit;
+ DWORD VF_GOPNow;
+ DWORD VF_GOPSize;
+ int VF_FrameSize;
+ DWORD VF_OldFrame;
+ DWORD VF_OldRef;
+
+ enum DstFormat {
+ RGB24, YUY2
+ };
+ DstFormat m_dstFormat;
+
+ CMPEG2Dec();
+ ~CMPEG2Dec() {Close();}
+ int Open(LPCTSTR path, DstFormat);
+ void Close();
+ void Decode(unsigned char *dst, DWORD frame, int pitch);
+ bool dstRGB24() const { return m_dstFormat == RGB24; }
+ bool dstYUY2() const { return m_dstFormat == YUY2; }
+};
diff --git a/src/filters/source/d2vsource/d2vsource.rc b/src/filters/source/d2vsource/d2vsource.rc
new file mode 100644
index 000000000..eb1d93802
--- /dev/null
+++ b/src/filters/source/d2vsource/d2vsource.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "D2V Source Filter"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "D2V Source Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2004"
+ VALUE "OriginalFilename", "D2VSource.ax"
+ VALUE "ProductName", "D2V Source Filter"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/source/d2vsource/d2vsource.sln b/src/filters/source/d2vsource/d2vsource.sln
new file mode 100644
index 000000000..cb6c4d624
--- /dev/null
+++ b/src/filters/source/d2vsource/d2vsource.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "d2vsource", "d2vsource.vcproj", "{83CC6B88-A112-4192-BD5A-F2A249AF2277}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug.ActiveCfg = Debug|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug.Build.0 = Debug|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug lib.ActiveCfg = Debug lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug lib.Build.0 = Debug lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release.ActiveCfg = Release|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release.Build.0 = Release|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release lib.ActiveCfg = Release lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release lib.Build.0 = Release lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode.Build.0 = Release Unicode|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {83CC6B88-A112-4192-BD5A-F2A249AF2277}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/source/d2vsource/d2vsource.vcproj b/src/filters/source/d2vsource/d2vsource.vcproj
new file mode 100644
index 000000000..b2b2544ec
--- /dev/null
+++ b/src/filters/source/d2vsource/d2vsource.vcproj
@@ -0,0 +1,623 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="d2vsource"
+ ProjectGUID="{83CC6B88-A112-4192-BD5A-F2A249AF2277}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib basesourceD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="D2VSource.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib basesourceR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="D2VSource.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib basesourceDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="D2VSource.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib basesourceRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="D2VSource.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="D2VSource.cpp">
+ </File>
+ <File
+ RelativePath="D2VSource.def">
+ </File>
+ <File
+ RelativePath="idctfpu.cpp">
+ </File>
+ <File
+ RelativePath="idctmmx.asm">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)
+"
+ Outputs="$(OutDir)\$(InputName).obj"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="idctref.cpp">
+ </File>
+ <File
+ RelativePath="MPEG2Dec.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="D2VSource.h">
+ </File>
+ <File
+ RelativePath="MPEG2Dec.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\d2vsource.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/d2vsource/d2vsource_vs2005.vcproj b/src/filters/source/d2vsource/d2vsource_vs2005.vcproj
new file mode 100644
index 000000000..cae2244e5
--- /dev/null
+++ b/src/filters/source/d2vsource/d2vsource_vs2005.vcproj
@@ -0,0 +1,889 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="d2vsource"
+ ProjectGUID="{83CC6B88-A112-4192-BD5A-F2A249AF2277}"
+ RootNamespace="d2vsource"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib basesourceD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="D2VSource.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib basesourceR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="D2VSource.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib basesourceDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="D2VSource.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib basesourceRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="D2VSource.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="D2VSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="D2VSource.def"
+ >
+ </File>
+ <File
+ RelativePath="idctfpu.cpp"
+ >
+ </File>
+ <File
+ RelativePath="idctmmx.asm"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&#x0D;&#x0A;"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&#x0D;&#x0A;"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&#x0D;&#x0A;"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&#x0D;&#x0A;"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&#x0D;&#x0A;"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&#x0D;&#x0A;"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&#x0D;&#x0A;"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="ml /c /coff /Cx /nologo /Fo&quot;$(OutDir)\$(InputName).obj&quot; &quot;$(InputPath)&#x0D;&#x0A;"
+ Outputs="$(OutDir)\$(InputName).obj"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="idctref.cpp"
+ >
+ </File>
+ <File
+ RelativePath="MPEG2Dec.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="D2VSource.h"
+ >
+ </File>
+ <File
+ RelativePath="MPEG2Dec.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\d2vsource.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/d2vsource/d2vsource_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/source/d2vsource/d2vsource_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/source/d2vsource/d2vsource_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/source/d2vsource/idctfpu.cpp b/src/filters/source/d2vsource/idctfpu.cpp
new file mode 100644
index 000000000..92fcd3954
--- /dev/null
+++ b/src/filters/source/d2vsource/idctfpu.cpp
@@ -0,0 +1,456 @@
+#include "stdafx.h"
+
+/* idct.c, inverse fast discrete cosine transform */
+
+
+/*************************************************************/
+/* inverse two dimensional DCT, Chen-Wang algorithm */
+/* (cf. IEEE ASSP-32, pp. 803-816, Aug. 1984) */
+/* */
+/* floating point conversion by Miha Peternel */
+/* x87 hand-optimized assembly by Miha Peternel */
+/* 27.11. - 11.12.2000 */
+/* */
+/* You are free to use this code in your project if: */
+/* - no changes are made to this message */
+/* - any changes to this code are publicly available */
+/* - your project documentation contains the following text: */
+/* "This software contains fast high-quality IDCT decoder */
+/* by Miha Peternel." */
+/* */
+/*************************************************************/
+
+
+/////////////////////////////////////////////////////
+//
+// TODO:
+// - loops can be easily vectorized for SIMD
+//
+/////////////////////////////////////////////////////
+
+#include <math.h>
+# define PI 3.1415926535897932384626433832795
+
+#define FLOAT double
+
+const static double RC = 1.0*1024*1024*1024*1024*256*16 + 1024; // magic + clip center
+
+static FLOAT W1; // /* sqrt(2)*cos(1*pi/16) */
+static FLOAT W2; // /* sqrt(2)*cos(2*pi/16) */
+static FLOAT W5; // /* sqrt(2)*cos(5*pi/16) */
+
+static FLOAT W1_8;
+static FLOAT W2_8;
+static FLOAT W5_8;
+
+static FLOAT W7; // /* sqrt(2)*cos(7*pi/16) */
+static FLOAT W1mW7; // W1-W7
+static FLOAT W1pW7; // W1+W7
+
+static FLOAT W3; // /* sqrt(2)*cos(3*pi/16) */
+static FLOAT W3mW5; // W3-W5
+static FLOAT W3pW5; // W3+W5
+
+static FLOAT W6; // /* sqrt(2)*cos(6*pi/16) */
+static FLOAT W2mW6; // W2-W6
+static FLOAT W2pW6; // W2+W6
+
+static FLOAT S2; // 1/sqrt(2)
+static FLOAT D8 = 1.0/8;
+
+static FLOAT W7_8;
+static FLOAT W1mW7_8;
+static FLOAT W1pW7_8;
+
+static FLOAT W3_8;
+static FLOAT W3mW5_8;
+static FLOAT W3pW5_8;
+
+static FLOAT W6_8;
+static FLOAT W2mW6_8;
+static FLOAT W2pW6_8;
+
+/* global declarations */
+
+/* private data */
+static short iclip[1024+1024]; /* clipping table */
+static short *iclp;
+
+void Initialize_FPU_IDCT()
+{
+ int i;
+
+ S2 = sqrt(0.5); // 1.0/sqrt(2);
+
+ W1 = sqrt(2.0)*cos(PI*(1.0/16));
+ W1_8 = W1/8;
+ W2 = sqrt(2.0)*cos(PI*(2.0/16));
+ W2_8 = W2/8;
+ W3 = sqrt(2.0)*cos(PI*(3.0/16));
+ W3_8 = W3/8;
+ W5 = sqrt(2.0)*cos(PI*(5.0/16));
+ W5_8 = W5/8;
+ W6 = sqrt(2.0)*cos(PI*(6.0/16));
+ W6_8 = W6/8;
+ W7 = sqrt(2.0)*cos(PI*(7.0/16));
+ W7_8 = W7/8;
+
+ W1mW7 = W1-W7; W1mW7_8 = W1mW7/8;
+ W1pW7 = W1+W7; W1pW7_8 = W1pW7/8;
+ W3mW5 = W3-W5; W3mW5_8 = W3mW5/8;
+ W3pW5 = W3+W5; W3pW5_8 = W3pW5/8;
+ W2mW6 = W2-W6; W2mW6_8 = W2mW6/8;
+ W2pW6 = W2+W6; W2pW6_8 = W2pW6/8;
+
+ iclp = iclip+1024;
+ for (i= -1024; i<1024; i++)
+ iclp[i] = (i<-256) ? -256 : ((i>255) ? 255 : i);
+}
+
+void FPU_IDCT(short *block)
+{
+ int *b = (int *) block;
+ if( b[0]==0 && (b[31]==0x10000 || b[31]==0) )
+ {
+ if( b[ 1]|b[ 2]|b[ 3]|b[ 4]|b[ 5] )
+ goto normal;
+ if( b[ 6]|b[ 7]|b[ 8]|b[ 9]|b[10] )
+ goto normal;
+ if( b[11]|b[12]|b[13]|b[14]|b[15] )
+ goto normal;
+ if( b[16]|b[17]|b[18]|b[19]|b[20] )
+ goto normal;
+ if( b[21]|b[22]|b[23]|b[24]|b[25] )
+ goto normal;
+ if( b[26]|b[27]|b[28]|b[29]|b[30] )
+ goto normal;
+ b[31]=0;
+ ////empty++;
+ return;
+ }
+normal:
+
+#define tmp ebx
+#define tmp1 ebx-1*8
+#define tmp2 ebx-2*8
+#define tmp3 ebx-3*8
+#define int0 ebx-3*8-1*4
+#define int1 ebx-3*8-2*4
+#define int2 ebx-3*8-3*4
+#define int3 ebx-3*8-4*4
+#define int4 ebx-3*8-5*4
+#define int5 ebx-3*8-6*4
+#define int6 ebx-3*8-7*4
+#define int7 ebx-3*8-8*4
+#define SIZE 8*8*8+3*8+8*4+16 // locals + 16-byte alignment area
+ __asm
+ {
+ lea ebx,[esp-8*8*8]
+ sub esp,SIZE
+ and ebx,-16 // force 16-byte alignment of locals
+
+// rows
+ mov esi,[block]
+ lea edi,[tmp]
+ mov ecx,8
+
+ align 16
+Lrows:
+ movsx eax,word ptr [esi+2]
+ or eax, [esi+4]
+ or eax, [esi+8]
+ or eax, [esi+12]
+ jnz L1
+
+ fild word ptr [esi+0*2]
+ fst qword ptr [edi+7*8]
+ fst qword ptr [edi+6*8]
+ fst qword ptr [edi+5*8]
+ fst qword ptr [edi+4*8]
+ fst qword ptr [edi+3*8]
+ fst qword ptr [edi+2*8]
+ fst qword ptr [edi+1*8]
+ fstp qword ptr [edi+0*8]
+ jmp L2
+
+ align 16
+ L1:
+
+ fild word ptr [esi+7*2]
+ fld st(0)
+ fild word ptr [esi+1*2]
+ fadd st(1),st(0)
+ fld qword ptr [W7]
+ fxch st(1)
+ fmul qword ptr [W1mW7]
+ fxch st(1)
+ fmulp st(2),st(0)
+ fadd st(0),st(1)
+ fstp qword ptr [tmp1]
+ fild word ptr [esi+3*2]
+ fld st(0)
+ fxch st(3)
+ fmul qword ptr [W1pW7]
+ fild word ptr [esi+5*2]
+ fadd st(4),st(0)
+ fmul qword ptr [W3mW5]
+ fxch st(1)
+ fsubp st(3),st(0)//fsubrp
+ fld qword ptr [W3]
+ fmulp st(4),st(0)
+ fsubr st(0),st(3)
+ fstp qword ptr [tmp2]
+ fmul qword ptr [W3pW5]
+ fsubp st(2),st(0)//fsubrp
+ fxch st(1)
+ fstp qword ptr [tmp3]
+ fild word ptr [esi+0*2]
+ fild word ptr [esi+4*2]
+ fild word ptr [esi+2*2]
+ fld st(0)
+ fmul qword ptr [W2mW6]
+ fld st(3)
+ fild word ptr [esi+6*2]
+ fxch st(5)
+ fsub st(0),st(4)
+ fxch st(3)
+ fadd st(0),st(5)
+ fxch st(1)
+ faddp st(4),st(0)
+ fld qword ptr [W6]
+ fmulp st(1),st(0)
+ fxch st(4)
+ fmul qword ptr [W2pW6]
+ fld qword ptr [tmp1]
+ fsub qword ptr [tmp2]
+ fld st(5)
+ fxch st(3)
+ faddp st(6),st(0)
+ fld qword ptr [tmp1]
+ fxch st(1)
+ fstp qword ptr [tmp1]
+ fld st(6)
+ fadd qword ptr [tmp3]
+ fxch st(1)
+ fadd qword ptr [tmp2]
+ fxch st(7)
+ fsub qword ptr [tmp3]
+ fxch st(1)
+ fstp qword ptr [tmp2]
+ fld st(4)
+ fxch st(3)
+ fsubrp st(2),st(0)//fsubp
+ fxch st(4)
+ fsub st(0),st(5)
+ fxch st(2)
+ faddp st(5),st(0)
+ fld st(2)
+ fsub st(0),st(1)
+ fxch st(5)
+ fstp qword ptr [tmp3]
+ fld qword ptr [tmp1]
+ fld qword ptr [S2]
+ fxch st(4)
+ faddp st(2),st(0)
+ fld st(3)
+ fxch st(1)
+ fadd st(0),st(5)
+ fmulp st(1),st(0)
+
+ fld qword ptr [tmp3]
+ fadd st(0),st(7)
+ fxch st(5)
+ fsubr qword ptr [tmp1]
+ fxch st(5)
+ fstp qword ptr [edi+0*8]
+ fxch st(6)
+ fsubr qword ptr [tmp3]
+ fld st(2)
+ fxch st(1)
+ fstp qword ptr [edi+7*8]
+ fadd qword ptr [tmp2]
+ fxch st(3)
+ fmulp st(4),st(0)
+ fxch st(2)
+ fstp qword ptr [edi+3*8]
+ fld st(1)
+ fadd st(0),st(5)
+ fxch st(1)
+ fsub qword ptr [tmp2]
+ fxch st(2)
+ fsubrp st(5),st(0)//fsubp
+ fstp qword ptr [edi+1*8]
+ fld st(2)
+ fxch st(1)
+ fstp qword ptr [edi+4*8]
+ fxch st(2)
+ fsub st(0),st(1)
+ fxch st(2)
+ faddp st(1),st(0)
+ fxch st(2)
+ fstp qword ptr [edi+6*8]
+ fstp qword ptr [edi+5*8]
+ fstp qword ptr [edi+2*8]
+ L2:
+ add esi,8*2
+ add edi,8*8
+ dec ecx
+ jnz Lrows
+
+// columns
+ lea esi,[tmp]
+ mov edi,[block]
+ lea edx,[iclip+1024*2]
+ mov ecx,8
+
+ align 16
+Lcols:
+ fld qword ptr [esi+7*8*8]
+ fld st(0)
+ fld qword ptr [esi+1*8*8]
+ fadd st(1),st(0)
+ fld qword ptr [W7_8]
+ fxch st(1)
+ fmul qword ptr [W1mW7_8]
+ fxch st(1)
+ fmulp st(2),st(0)
+ fadd st(0),st(1)
+ fstp qword ptr [tmp2]
+ fld qword ptr [esi+3*8*8]
+ fld st(0)
+ fxch st(3)
+ fmul qword ptr [W1pW7_8]
+ fld qword ptr [esi+5*8*8]
+ fadd st(4),st(0)
+ fmul qword ptr [W3mW5_8]
+ fxch st(1)
+ fsubp st(3),st(0)//fsubrp
+ fld qword ptr [W3_8]
+ fmulp st(4),st(0)
+ fsubr st(0),st(3)
+ fstp qword ptr [tmp3]
+ fld qword ptr [D8]
+ fld qword ptr [esi+0*8*8]
+ fmul st(0),st(1)
+ fxch st(2)
+ fmul qword ptr [W3pW5_8]
+ fld qword ptr [esi+4*8*8]
+ fmulp st(2),st(0)
+ fld qword ptr [esi+6*8*8]
+ fld st(3)
+ fxch st(6)
+ fsubrp st(2),st(0)//fsubp
+ fld qword ptr [esi+2*8*8]
+ fld st(0)
+ fxch st(5)
+ fsub st(0),st(4)
+ fxch st(7)
+ faddp st(4),st(0)
+ fxch st(4)
+ fadd st(0),st(1)
+ fld qword ptr [W6_8]
+ fxch st(2)
+ fmul qword ptr [W2pW6_8]
+ fxch st(2)
+ fmulp st(1),st(0)
+ fxch st(4)
+ fmul qword ptr [W2mW6_8]
+ fld qword ptr [tmp2]
+ fsub qword ptr [tmp3]
+ fxch st(2)
+ fsubr st(0),st(5)
+ fxch st(1)
+ faddp st(5),st(0)
+ fld qword ptr [tmp2]
+ fxch st(2)
+ fstp qword ptr [tmp2]
+ fld st(5)
+ fxch st(2)
+ fadd qword ptr [tmp3]
+ fxch st(6)
+ fsub st(0),st(3)
+ fxch st(2)
+ faddp st(3),st(0)
+ fld st(3)
+ fsub st(0),st(5)
+ fxch st(3)
+ fstp qword ptr [tmp3]
+ fxch st(3)
+ faddp st(4),st(0)
+ fld st(5)
+ fld qword ptr [tmp2]
+ fxch st(7)
+ fsub st(0),st(4)
+ fxch st(7)
+ fadd st(0),st(2)
+ fxch st(1)
+ faddp st(4),st(0)
+ fld qword ptr [S2]
+ fmul st(1),st(0)
+ fxch st(1)
+ fstp qword ptr [tmp1]
+ fld st(4)
+ fadd st(0),st(6)
+ fxch st(2)
+ fsubr qword ptr [tmp2]
+ fxch st(5)
+ fsubrp st(6),st(0)//fsubp
+ fxch st(1)
+ fistp dword ptr [int0]
+ fxch st(4)
+ mov eax,[int0]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+0*8*2],ax
+ fistp dword ptr [int7]
+ mov eax,[int7]
+ fld st(0)
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+7*8*2],ax
+ fadd qword ptr [tmp3]
+ fistp dword ptr [int3]
+ mov eax,[int3]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+3*8*2],ax
+ fsub qword ptr [tmp3]
+ fld st(1)
+ fxch st(1)
+ fistp dword ptr [int4]
+ mov eax,[int4]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+4*8*2],ax
+ fadd qword ptr [tmp1]
+ fxch st(3)
+ fmulp st(2),st(0)
+ fxch st(2)
+ fistp dword ptr [int1]
+ fxch st(1)
+ mov eax,[int1]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+1*8*2],ax
+ fsub qword ptr [tmp1]
+ fld st(2)
+ fsub st(0),st(2)
+ fxch st(1)
+ fistp dword ptr [int6]
+ fxch st(2)
+ mov eax,[int6]
+ faddp st(1),st(0)
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+6*8*2],ax
+ fistp dword ptr [int2]
+ mov eax,[int2]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+2*8*2],ax
+ fistp dword ptr [int5]
+ mov eax,[int5]
+ movsx eax,word ptr [edx+2*eax]
+ mov [edi+5*8*2],ax
+
+ add esi,8
+ add edi,2
+ dec ecx
+ jnz Lcols
+
+ add esp,SIZE
+ }
+}
diff --git a/src/filters/source/d2vsource/idctmmx.asm b/src/filters/source/d2vsource/idctmmx.asm
new file mode 100644
index 000000000..7ebe4d7e3
--- /dev/null
+++ b/src/filters/source/d2vsource/idctmmx.asm
@@ -0,0 +1,738 @@
+;
+; idct8x8_xmm.asm
+;
+; Originally provided by Intel at AP-922
+; http://developer.intel.com/vtune/cbts/strmsimd/922down.htm
+; (See more app notes at http://developer.intel.com/vtune/cbts/strmsimd/appnotes.htm)
+; but in a limited edition.
+; New macro implements a column part for precise iDCT
+; The routine precision now satisfies IEEE standard 1180-1990.
+;
+; Copyright (c) 2000-2001 Peter Gubanov <peter@elecard.net.ru>
+; Rounding trick Copyright (c) 2000 Michel Lespinasse <walken@zoy.org>
+;
+; http://www.elecard.com/peter/idct.html
+; http://www.linuxvideo.org/mpeg2dec/
+;
+;=============================================================================
+;
+; These examples contain code fragments for first stage iDCT 8x8
+; (for rows) and first stage DCT 8x8 (for columns)
+;
+;=============================================================================
+mword typedef qword
+mptr equ mword ptr
+
+BITS_INV_ACC = 5 ; 4 or 5 for IEEE
+SHIFT_INV_ROW = 16 - BITS_INV_ACC
+SHIFT_INV_COL = 1 + BITS_INV_ACC
+RND_INV_ROW = 1024 * (6 - BITS_INV_ACC) ; 1 << (SHIFT_INV_ROW-1)
+RND_INV_COL = 16 * (BITS_INV_ACC - 3) ; 1 << (SHIFT_INV_COL-1)
+RND_INV_CORR = RND_INV_COL - 1 ; correction -1.0 and round
+
+BITS_FRW_ACC = 3 ; 2 or 3 for accuracy
+SHIFT_FRW_COL = BITS_FRW_ACC
+SHIFT_FRW_ROW = BITS_FRW_ACC + 17
+RND_FRW_ROW = 262144 * (BITS_FRW_ACC - 1) ; 1 << (SHIFT_FRW_ROW-1)
+
+_MMX = 1
+
+.nolist
+
+.586
+
+if @version GE 612
+.mmx
+;mmword TEXTEQU <QWORD>
+else
+include IAMMX.INC
+endif
+
+if @version GE 614
+.xmm
+;mm2word TEXTEQU <QWORD> ; needed for Streaming SIMD Extensions macros
+else
+include iaxmm.inc ; Streaming SIMD Extensions Emulator Macros
+endif
+
+ .list
+ .model flat
+
+_DATA SEGMENT PARA PUBLIC USE32 'DATA'
+
+one_corr sword 1, 1, 1, 1
+round_inv_row dword RND_INV_ROW, RND_INV_ROW
+round_inv_col sword RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL
+round_inv_corr sword RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR
+round_frw_row dword RND_FRW_ROW, RND_FRW_ROW
+ tg_1_16 sword 13036, 13036, 13036, 13036 ; tg * (2<<16) + 0.5
+ tg_2_16 sword 27146, 27146, 27146, 27146 ; tg * (2<<16) + 0.5
+ tg_3_16 sword -21746, -21746, -21746, -21746 ; tg * (2<<16) + 0.5
+ cos_4_16 sword -19195, -19195, -19195, -19195 ; cos * (2<<16) + 0.5
+ocos_4_16 sword 23170, 23170, 23170, 23170 ; cos * (2<<15) + 0.5
+
+ otg_3_16 sword 21895, 21895, 21895, 21895 ; tg * (2<<16) + 0.5
+
+; assume SHIFT_INV_ROW == 12
+;rounder_0 dword 65536, 65536
+;rounder_4 dword 0, 0
+;rounder_1 dword 7195, 7195
+;rounder_7 dword 1024, 1024
+;rounder_2 dword 4520, 4520
+;rounder_6 dword 1024, 1024
+;rounder_3 dword 2407, 2407
+;rounder_5 dword 240, 240
+
+; assume SHIFT_INV_ROW == 11
+rounder_0 dword 65536, 65536
+rounder_4 dword 0, 0
+rounder_1 dword 3597, 3597
+rounder_7 dword 512, 512
+rounder_2 dword 2260, 2260
+rounder_6 dword 512, 512
+rounder_3 dword 1203, 1203
+rounder_5 dword 120, 120
+
+;=============================================================================
+;
+; The first stage iDCT 8x8 - inverse DCTs of rows
+;
+;-----------------------------------------------------------------------------
+; The 8-point inverse DCT direct algorithm
+;-----------------------------------------------------------------------------
+;
+; static const short w[32] = {
+; FIX(cos_4_16), FIX(cos_2_16), FIX(cos_4_16), FIX(cos_6_16),
+; FIX(cos_4_16), FIX(cos_6_16), -FIX(cos_4_16), -FIX(cos_2_16),
+; FIX(cos_4_16), -FIX(cos_6_16), -FIX(cos_4_16), FIX(cos_2_16),
+; FIX(cos_4_16), -FIX(cos_2_16), FIX(cos_4_16), -FIX(cos_6_16),
+; FIX(cos_1_16), FIX(cos_3_16), FIX(cos_5_16), FIX(cos_7_16),
+; FIX(cos_3_16), -FIX(cos_7_16), -FIX(cos_1_16), -FIX(cos_5_16),
+; FIX(cos_5_16), -FIX(cos_1_16), FIX(cos_7_16), FIX(cos_3_16),
+; FIX(cos_7_16), -FIX(cos_5_16), FIX(cos_3_16), -FIX(cos_1_16) };
+;
+; #define DCT_8_INV_ROW(x, y)
+; {
+; int a0, a1, a2, a3, b0, b1, b2, b3;
+;
+; a0 =x[0]*w[0]+x[2]*w[1]+x[4]*w[2]+x[6]*w[3];
+; a1 =x[0]*w[4]+x[2]*w[5]+x[4]*w[6]+x[6]*w[7];
+; a2 = x[0] * w[ 8] + x[2] * w[ 9] + x[4] * w[10] + x[6] * w[11];
+; a3 = x[0] * w[12] + x[2] * w[13] + x[4] * w[14] + x[6] * w[15];
+; b0 = x[1] * w[16] + x[3] * w[17] + x[5] * w[18] + x[7] * w[19];
+; b1 = x[1] * w[20] + x[3] * w[21] + x[5] * w[22] + x[7] * w[23];
+; b2 = x[1] * w[24] + x[3] * w[25] + x[5] * w[26] + x[7] * w[27];
+; b3 = x[1] * w[28] + x[3] * w[29] + x[5] * w[30] + x[7] * w[31];
+;
+; y[0] = SHIFT_ROUND ( a0 + b0 );
+; y[1] = SHIFT_ROUND ( a1 + b1 );
+; y[2] = SHIFT_ROUND ( a2 + b2 );
+; y[3] = SHIFT_ROUND ( a3 + b3 );
+; y[4] = SHIFT_ROUND ( a3 - b3 );
+; y[5] = SHIFT_ROUND ( a2 - b2 );
+; y[6] = SHIFT_ROUND ( a1 - b1 );
+; y[7] = SHIFT_ROUND ( a0 - b0 );
+; }
+;
+;-----------------------------------------------------------------------------
+;
+; In this implementation the outputs of the iDCT-1D are multiplied
+; for rows 0,4 - by cos_4_16,
+; for rows 1,7 - by cos_1_16,
+; for rows 2,6 - by cos_2_16,
+; for rows 3,5 - by cos_3_16
+; and are shifted to the left for better accuracy
+;
+; For the constants used,
+; FIX(float_const) = (short) (float_const * (1<<15) + 0.5)
+;
+;=============================================================================
+
+;=============================================================================
+; MMX code
+;=============================================================================
+
+; Table for rows 0,4 - constants are multiplied by cos_4_16
+
+tab_i_04 sword 16384, 16384, 16384, -16384 ; movq-> w06 w04 w02 w00
+ sword 21407, 8867, 8867, -21407 ; w07 w05 w03 w01
+ sword 16384, -16384, 16384, 16384 ; w14 w12 w10 w08
+ sword -8867, 21407, -21407, -8867 ; w15 w13 w11 w09
+ sword 22725, 12873, 19266, -22725 ; w22 w20 w18 w16
+ sword 19266, 4520, -4520, -12873 ; w23 w21 w19 w17
+ sword 12873, 4520, 4520, 19266 ; w30 w28 w26 w24
+ sword -22725, 19266, -12873, -22725 ; w31 w29 w27 w25
+
+; Table for rows 1,7 - constants are multiplied by cos_1_16
+
+tab_i_17 sword 22725, 22725, 22725, -22725 ; movq-> w06 w04 w02 w00
+ sword 29692, 12299, 12299, -29692 ; w07 w05 w03 w01
+ sword 22725, -22725, 22725, 22725 ; w14 w12 w10 w08
+ sword -12299, 29692, -29692, -12299 ; w15 w13 w11 w09
+ sword 31521, 17855, 26722, -31521 ; w22 w20 w18 w16
+ sword 26722, 6270, -6270, -17855 ; w23 w21 w19 w17
+ sword 17855, 6270, 6270, 26722 ; w30 w28 w26 w24
+ sword -31521, 26722, -17855, -31521 ; w31 w29 w27 w25
+
+; Table for rows 2,6 - constants are multiplied by cos_2_16
+
+tab_i_26 sword 21407, 21407, 21407, -21407 ; movq-> w06 w04 w02 w00
+ sword 27969, 11585, 11585, -27969 ; w07 w05 w03 w01
+ sword 21407, -21407, 21407, 21407 ; w14 w12 w10 w08
+ sword -11585, 27969, -27969, -11585 ; w15 w13 w11 w09
+ sword 29692, 16819, 25172, -29692 ; w22 w20 w18 w16
+ sword 25172, 5906, -5906, -16819 ; w23 w21 w19 w17
+ sword 16819, 5906, 5906, 25172 ; w30 w28 w26 w24
+ sword -29692, 25172, -16819, -29692 ; w31 w29 w27 w25
+
+; Table for rows 3,5 - constants are multiplied by cos_3_16
+
+tab_i_35 sword 19266, 19266, 19266, -19266 ; movq-> w06 w04 w02 w00
+ sword 25172, 10426, 10426, -25172 ; w07 w05 w03 w01
+ sword 19266, -19266, 19266, 19266 ; w14 w12 w10 w08
+ sword -10426, 25172, -25172, -10426 ; w15 w13 w11 w09
+ sword 26722, 15137, 22654, -26722 ; w22 w20 w18 w16
+ sword 22654, 5315, -5315, -15137 ; w23 w21 w19 w17
+ sword 15137, 5315, 5315, 22654 ; w30 w28 w26 w24
+ sword -26722, 22654, -15137, -26722 ; w31 w29 w27 w25
+
+;-----------------------------------------------------------------------------
+
+DCT_8_INV_ROW_1 MACRO INP:REQ, OUT:REQ, TABLE:REQ, ROUNDER:REQ
+
+ movq mm0, mptr [INP] ; 0 ; x3 x2 x1 x0
+
+ movq mm1, mptr [INP+8] ; 1 ; x7 x6 x5 x4
+ movq mm2, mm0 ; 2 ; x3 x2 x1 x0
+
+ movq mm3, mptr [TABLE] ; 3 ; w06 w04 w02 w00
+ punpcklwd mm0, mm1 ; x5 x1 x4 x0
+
+ movq mm5, mm0 ; 5 ; x5 x1 x4 x0
+ punpckldq mm0, mm0 ; x4 x0 x4 x0
+
+ movq mm4, mptr [TABLE+8] ; 4 ; w07 w05 w03 w01
+ punpckhwd mm2, mm1 ; 1 ; x7 x3 x6 x2
+
+ pmaddwd mm3, mm0 ; x4*w06+x0*w04 x4*w02+x0*w00
+ movq mm6, mm2 ; 6 ; x7 x3 x6 x2
+
+ movq mm1, mptr [TABLE+32] ; 1 ; w22 w20 w18 w16
+ punpckldq mm2, mm2 ; x6 x2 x6 x2
+
+ pmaddwd mm4, mm2 ; x6*w07+x2*w05 x6*w03+x2*w01
+ punpckhdq mm5, mm5 ; x5 x1 x5 x1
+
+ pmaddwd mm0, mptr [TABLE+16] ; x4*w14+x0*w12 x4*w10+x0*w08
+ punpckhdq mm6, mm6 ; x7 x3 x7 x3
+
+ movq mm7, mptr [TABLE+40] ; 7 ; w23 w21 w19 w17
+ pmaddwd mm1, mm5 ; x5*w22+x1*w20 x5*w18+x1*w16
+
+ paddd mm3, mptr [ROUNDER] ; +rounder
+ pmaddwd mm7, mm6 ; x7*w23+x3*w21 x7*w19+x3*w17
+
+ pmaddwd mm2, mptr [TABLE+24] ; x6*w15+x2*w13 x6*w11+x2*w09
+ paddd mm3, mm4 ; 4 ; a1=sum(even1) a0=sum(even0)
+
+ pmaddwd mm5, mptr [TABLE+48] ; x5*w30+x1*w28 x5*w26+x1*w24
+ movq mm4, mm3 ; 4 ; a1 a0
+
+ pmaddwd mm6, mptr [TABLE+56] ; x7*w31+x3*w29 x7*w27+x3*w25
+ paddd mm1, mm7 ; 7 ; b1=sum(odd1) b0=sum(odd0)
+
+ paddd mm0, mptr [ROUNDER] ; +rounder
+ psubd mm3, mm1 ; a1-b1 a0-b0
+
+ psrad mm3, SHIFT_INV_ROW ; y6=a1-b1 y7=a0-b0
+ paddd mm1, mm4 ; 4 ; a1+b1 a0+b0
+
+ paddd mm0, mm2 ; 2 ; a3=sum(even3) a2=sum(even2)
+ psrad mm1, SHIFT_INV_ROW ; y1=a1+b1 y0=a0+b0
+
+ paddd mm5, mm6 ; 6 ; b3=sum(odd3) b2=sum(odd2)
+ movq mm4, mm0 ; 4 ; a3 a2
+
+ paddd mm0, mm5 ; a3+b3 a2+b2
+ psubd mm4, mm5 ; 5 ; a3-b3 a2-b2
+
+ psrad mm0, SHIFT_INV_ROW ; y3=a3+b3 y2=a2+b2
+ psrad mm4, SHIFT_INV_ROW ; y4=a3-b3 y5=a2-b2
+
+ packssdw mm1, mm0 ; 0 ; y3 y2 y1 y0
+ packssdw mm4, mm3 ; 3 ; y6 y7 y4 y5
+
+ movq mm7, mm4 ; 7 ; y6 y7 y4 y5
+ psrld mm4, 16 ; 0 y6 0 y4
+
+ pslld mm7, 16 ; y7 0 y5 0
+ movq mptr [OUT], mm1 ; 1 ; save y3 y2 y1 y0
+
+ por mm7, mm4 ; 4 ; y7 y6 y5 y4
+ movq mptr [OUT+8], mm7 ; 7 ; save y7 y6 y5 y4
+ENDM
+
+;=============================================================================
+; code for Pentium III
+;=============================================================================
+
+; Table for rows 0,4 - constants are multiplied by cos_4_16
+
+tab_i_04_s sword 16384, 21407, 16384, 8867 ; movq-> w05 w04 w01 w00
+ sword 16384, 8867, -16384, -21407 ; w07 w06 w03 w02
+ sword 16384, -8867, 16384, -21407 ; w13 w12 w09 w08
+ sword -16384, 21407, 16384, -8867 ; w15 w14 w11 w10
+ sword 22725, 19266, 19266, -4520 ; w21 w20 w17 w16
+ sword 12873, 4520, -22725, -12873 ; w23 w22 w19 w18
+ sword 12873, -22725, 4520, -12873 ; w29 w28 w25 w24
+ sword 4520, 19266, 19266, -22725 ; w31 w30 w27 w26
+
+; Table for rows 1,7 - constants are multiplied by cos_1_16
+
+tab_i_17_s sword 22725, 29692, 22725, 12299 ; movq-> w05 w04 w01 w00
+ sword 22725, 12299, -22725, -29692 ; w07 w06 w03 w02
+ sword 22725, -12299, 22725, -29692 ; w13 w12 w09 w08
+ sword -22725, 29692, 22725, -12299 ; w15 w14 w11 w10
+ sword 31521, 26722, 26722, -6270 ; w21 w20 w17 w16
+ sword 17855, 6270, -31521, -17855 ; w23 w22 w19 w18
+ sword 17855, -31521, 6270, -17855 ; w29 w28 w25 w24
+ sword 6270, 26722, 26722, -31521 ; w31 w30 w27 w26
+
+; Table for rows 2,6 - constants are multiplied by cos_2_16
+
+tab_i_26_s sword 21407, 27969, 21407, 11585 ; movq-> w05 w04 w01 w00
+ sword 21407, 11585, -21407, -27969 ; w07 w06 w03 w02
+ sword 21407, -11585, 21407, -27969 ; w13 w12 w09 w08
+ sword -21407, 27969, 21407, -11585 ; w15 w14 w11 w10
+ sword 29692, 25172, 25172, -5906 ; w21 w20 w17 w16
+ sword 16819, 5906, -29692, -16819 ; w23 w22 w19 w18
+ sword 16819, -29692, 5906, -16819 ; w29 w28 w25 w24
+ sword 5906, 25172, 25172, -29692 ; w31 w30 w27 w26
+
+; Table for rows 3,5 - constants are multiplied by cos_3_16
+
+tab_i_35_s sword 19266, 25172, 19266, 10426 ; movq-> w05 w04 w01 w00
+ sword 19266, 10426, -19266, -25172 ; w07 w06 w03 w02
+ sword 19266, -10426, 19266, -25172 ; w13 w12 w09 w08
+ sword -19266, 25172, 19266, -10426 ; w15 w14 w11 w10
+ sword 26722, 22654, 22654, -5315 ; w21 w20 w17 w16
+ sword 15137, 5315, -26722, -15137 ; w23 w22 w19 w18
+ sword 15137, -26722, 5315, -15137 ; w29 w28 w25 w24
+ sword 5315, 22654, 22654, -26722 ; w31 w30 w27 w26
+
+;-----------------------------------------------------------------------------
+
+DCT_8_INV_ROW_1_s MACRO INP:REQ, OUT:REQ, TABLE:REQ, ROUNDER:REQ
+
+ movq mm0, mptr [INP] ; 0 ; x3 x2 x1 x0
+
+ movq mm1, mptr [INP+8] ; 1 ; x7 x6 x5 x4
+ movq mm2, mm0 ; 2 ; x3 x2 x1 x0
+
+ movq mm3, mptr [TABLE] ; 3 ; w05 w04 w01 w00
+ pshufw mm0, mm0, 10001000b ; x2 x0 x2 x0
+
+ movq mm4, mptr [TABLE+8] ; 4 ; w07 w06 w03 w02
+ movq mm5, mm1 ; 5 ; x7 x6 x5 x4
+ pmaddwd mm3, mm0 ; x2*w05+x0*w04 x2*w01+x0*w00
+
+ movq mm6, mptr [TABLE+32] ; 6 ; w21 w20 w17 w16
+ pshufw mm1, mm1, 10001000b ; x6 x4 x6 x4
+ pmaddwd mm4, mm1 ; x6*w07+x4*w06 x6*w03+x4*w02
+
+ movq mm7, mptr [TABLE+40] ; 7 ; w23 w22 w19 w18
+ pshufw mm2, mm2, 11011101b ; x3 x1 x3 x1
+ pmaddwd mm6, mm2 ; x3*w21+x1*w20 x3*w17+x1*w16
+
+ pshufw mm5, mm5, 11011101b ; x7 x5 x7 x5
+ pmaddwd mm7, mm5 ; x7*w23+x5*w22 x7*w19+x5*w18
+
+ paddd mm3, mptr [ROUNDER] ; +rounder
+
+ pmaddwd mm0, mptr [TABLE+16] ; x2*w13+x0*w12 x2*w09+x0*w08
+ paddd mm3, mm4 ; 4 ; a1=sum(even1) a0=sum(even0)
+
+ pmaddwd mm1, mptr [TABLE+24] ; x6*w15+x4*w14 x6*w11+x4*w10
+ movq mm4, mm3 ; 4 ; a1 a0
+
+ pmaddwd mm2, mptr [TABLE+48] ; x3*w29+x1*w28 x3*w25+x1*w24
+ paddd mm6, mm7 ; 7 ; b1=sum(odd1) b0=sum(odd0)
+
+ pmaddwd mm5, mptr [TABLE+56] ; x7*w31+x5*w30 x7*w27+x5*w26
+ paddd mm3, mm6 ; a1+b1 a0+b0
+
+ paddd mm0, mptr [ROUNDER] ; +rounder
+ psrad mm3, SHIFT_INV_ROW ; y1=a1+b1 y0=a0+b0
+
+ paddd mm0, mm1 ; 1 ; a3=sum(even3) a2=sum(even2)
+ psubd mm4, mm6 ; 6 ; a1-b1 a0-b0
+
+ movq mm7, mm0 ; 7 ; a3 a2
+ paddd mm2, mm5 ; 5 ; b3=sum(odd3) b2=sum(odd2)
+
+ paddd mm0, mm2 ; a3+b3 a2+b2
+ psrad mm4, SHIFT_INV_ROW ; y6=a1-b1 y7=a0-b0
+
+ psubd mm7, mm2 ; 2 ; a3-b3 a2-b2
+ psrad mm0, SHIFT_INV_ROW ; y3=a3+b3 y2=a2+b2
+
+ psrad mm7, SHIFT_INV_ROW ; y4=a3-b3 y5=a2-b2
+
+ packssdw mm3, mm0 ; 0 ; y3 y2 y1 y0
+
+ packssdw mm7, mm4 ; 4 ; y6 y7 y4 y5
+
+ movq mptr [OUT], mm3 ; 3 ; save y3 y2 y1 y0
+ pshufw mm7, mm7, 10110001b ; y7 y6 y5 y4
+
+ movq mptr [OUT+8], mm7 ; 7 ; save y7 y6 y5 y4
+ENDM
+
+;=============================================================================
+;
+;=============================================================================
+
+;=============================================================================
+;
+; The first stage DCT 8x8 - forward DCTs of columns
+;
+; The outputs are multiplied
+; for rows 0,4 - on cos_4_16,
+; for rows 1,7 - on cos_1_16,
+; for rows 2,6 - on cos_2_16,
+; for rows 3,5 - on cos_3_16
+; and are shifted to the left for rise of accuracy
+;
+;-----------------------------------------------------------------------------
+;
+; The 8-point scaled forward DCT algorithm (26a8m)
+;
+;-----------------------------------------------------------------------------
+;
+; #define DCT_8_FRW_COL(x, y)
+;{
+; short t0, t1, t2, t3, t4, t5, t6, t7;
+; short tp03, tm03, tp12, tm12, tp65, tm65;
+; short tp465, tm465, tp765, tm765;
+;
+; t0 = LEFT_SHIFT ( x[0] + x[7] );
+; t1 = LEFT_SHIFT ( x[1] + x[6] );
+; t2 = LEFT_SHIFT ( x[2] + x[5] );
+; t3 = LEFT_SHIFT ( x[3] + x[4] );
+; t4 = LEFT_SHIFT ( x[3] - x[4] );
+; t5 = LEFT_SHIFT ( x[2] - x[5] );
+; t6 = LEFT_SHIFT ( x[1] - x[6] );
+; t7 = LEFT_SHIFT ( x[0] - x[7] );
+;
+; tp03 = t0 + t3;
+; tm03 = t0 - t3;
+; tp12 = t1 + t2;
+; tm12 = t1 - t2;
+;
+; y[0] = tp03 + tp12;
+; y[4] = tp03 - tp12;
+;
+; y[2] = tm03 + tm12 * tg_2_16;
+; y[6] = tm03 * tg_2_16 - tm12;
+;
+; tp65 =(t6 +t5 )*cos_4_16;
+; tm65 =(t6 -t5 )*cos_4_16;
+;
+; tp765 = t7 + tp65;
+; tm765 = t7 - tp65;
+; tp465 = t4 + tm65;
+; tm465 = t4 - tm65;
+;
+; y[1] = tp765 + tp465 * tg_1_16;
+; y[7] = tp765 * tg_1_16 - tp465;
+; y[5] = tm765 * tg_3_16 + tm465;
+; y[3] = tm765 - tm465 * tg_3_16;
+;}
+;
+;=============================================================================
+DCT_8_FRW_COL_4 MACRO INP:REQ, OUT:REQ
+LOCAL x0, x1, x2, x3, x4, x5, x6, x7
+LOCAL y0, y1, y2, y3, y4, y5, y6, y7
+x0 equ [INP + 0*16]
+x1 equ [INP + 1*16]
+x2 equ [INP + 2*16]
+x3 equ [INP + 3*16]
+x4 equ [INP + 4*16]
+x5 equ [INP + 5*16]
+x6 equ [INP + 6*16]
+x7 equ [INP + 7*16]
+y0 equ [OUT + 0*16]
+y1 equ [OUT + 1*16]
+y2 equ [OUT + 2*16]
+y3 equ [OUT + 3*16]
+y4 equ [OUT + 4*16]
+y5 equ [OUT + 5*16]
+y6 equ [OUT + 6*16]
+y7 equ [OUT + 7*16]
+movq mm0, x1 ; 0 ; x1
+movq mm1, x6 ; 1 ; x6
+movq mm2, mm0 ; 2 ; x1
+movq mm3, x2 ; 3 ; x2
+paddsw mm0, mm1 ; t1 = x[1] + x[6]
+movq mm4, x5 ; 4 ; x5
+psllw mm0, SHIFT_FRW_COL ; t1
+movq mm5, x0 ; 5 ; x0
+paddsw mm4, mm3 ; t2 = x[2] + x[5]
+paddsw mm5, x7 ; t0 = x[0] + x[7]
+psllw mm4, SHIFT_FRW_COL ; t2
+movq mm6, mm0 ; 6 ; t1
+psubsw mm2, mm1 ; 1 ; t6 = x[1] - x[6]
+movq mm1, mptr tg_2_16 ; 1 ; tg_2_16
+psubsw mm0, mm4 ; tm12 = t1 - t2
+movq mm7, x3 ; 7 ; x3
+pmulhw mm1, mm0 ; tm12*tg_2_16
+paddsw mm7, x4 ; t3 = x[3] + x[4]
+psllw mm5, SHIFT_FRW_COL ; t0
+paddsw mm6, mm4 ; 4 ; tp12 = t1 + t2
+psllw mm7, SHIFT_FRW_COL ; t3
+movq mm4, mm5 ; 4 ; t0
+psubsw mm5, mm7 ; tm03 = t0 - t3
+paddsw mm1, mm5 ; y2 = tm03 + tm12*tg_2_16
+paddsw mm4, mm7 ; 7 ; tp03 = t0 + t3
+por mm1, mptr one_corr ; correction y2 +0.5
+psllw mm2, SHIFT_FRW_COL+1 ; t6
+pmulhw mm5, mptr tg_2_16 ; tm03*tg_2_16
+movq mm7, mm4 ; 7 ; tp03
+psubsw mm3, x5 ; t5 = x[2] - x[5]
+psubsw mm4, mm6 ; y4 = tp03 - tp12
+movq y2, mm1 ; 1 ; save y2
+paddsw mm7, mm6 ; 6 ; y0 = tp03 + tp12
+movq mm1, x3 ; 1 ; x3
+psllw mm3, SHIFT_FRW_COL+1 ; t5
+psubsw mm1, x4 ; t4 = x[3] - x[4]
+movq mm6, mm2 ; 6 ; t6
+movq y4, mm4 ; 4 ; save y4
+paddsw mm2, mm3 ; t6 + t5
+pmulhw mm2, mptr ocos_4_16 ; tp65 = (t6 + t5)*cos_4_16
+psubsw mm6, mm3 ; 3 ; t6 - t5
+pmulhw mm6, mptr ocos_4_16 ; tm65 = (t6 - t5)*cos_4_16
+psubsw mm5, mm0 ; 0 ; y6 = tm03*tg_2_16 - tm12
+por mm5, mptr one_corr ; correction y6 +0.5
+psllw mm1, SHIFT_FRW_COL ; t4
+por mm2, mptr one_corr ; correction tp65 +0.5
+movq mm4, mm1 ; 4 ; t4
+movq mm3, x0 ; 3 ; x0
+paddsw mm1, mm6 ; tp465 = t4 + tm65
+psubsw mm3, x7 ; t7 = x[0] - x[7]
+psubsw mm4, mm6 ; 6 ; tm465 = t4 - tm65
+movq mm0, mptr tg_1_16 ; 0 ; tg_1_16
+psllw mm3, SHIFT_FRW_COL ; t7
+movq mm6, mptr tg_3_16 ; 6 ; tg_3_16
+pmulhw mm0, mm1 ; tp465*tg_1_16
+movq y0, mm7 ; 7 ; save y0
+pmulhw mm6, mm4 ; tm465*tg_3_16
+movq y6, mm5 ; 5 ; save y6
+movq mm7, mm3 ; 7 ; t7
+movq mm5, mptr tg_3_16 ; 5 ; tg_3_16
+psubsw mm7, mm2 ; tm765 = t7 - tp65
+paddsw mm3, mm2 ; 2 ; tp765 = t7 + tp65
+pmulhw mm5, mm7 ; tm765*tg_3_16
+paddsw mm0, mm3 ; y1 = tp765 + tp465*tg_1_16
+paddsw mm6, mm4 ; tm465*tg_3_16
+pmulhw mm3, mptr tg_1_16 ; tp765*tg_1_16
+por mm0, mptr one_corr ; correction y1 +0.5
+paddsw mm5, mm7 ; tm765*tg_3_16
+psubsw mm7, mm6 ; 6 ; y3 = tm765 - tm465*tg_3_16
+movq y1, mm0 ; 0 ; save y1
+paddsw mm5, mm4 ; 4 ; y5 = tm765*tg_3_16 + tm465
+movq y3, mm7 ; 7 ; save y3
+psubsw mm3, mm1 ; 1 ; y7 = tp765*tg_1_16 - tp465
+movq y5, mm5 ; 5 ; save y5
+movq y7, mm3 ; 3 ; save y7
+ENDM
+
+DCT_8_INV_COL_4 MACRO INP:REQ, OUT:REQ
+ movq mm0, qword ptr tg_3_16
+
+ movq mm3, qword ptr [INP+16*3]
+ movq mm1, mm0 ; tg_3_16
+
+ movq mm5, qword ptr [INP+16*5]
+ pmulhw mm0, mm3 ; x3*(tg_3_16-1)
+
+ movq mm4, qword ptr tg_1_16
+ pmulhw mm1, mm5 ; x5*(tg_3_16-1)
+
+ movq mm7, qword ptr [INP+16*7]
+ movq mm2, mm4 ; tg_1_16
+
+ movq mm6, qword ptr [INP+16*1]
+ pmulhw mm4, mm7 ; x7*tg_1_16
+
+ paddsw mm0, mm3 ; x3*tg_3_16
+ pmulhw mm2, mm6 ; x1*tg_1_16
+
+ paddsw mm1, mm3 ; x3+x5*(tg_3_16-1)
+ psubsw mm0, mm5 ; x3*tg_3_16-x5 = tm35
+
+ movq mm3, qword ptr ocos_4_16
+ paddsw mm1, mm5 ; x3+x5*tg_3_16 = tp35
+
+ paddsw mm4, mm6 ; x1+tg_1_16*x7 = tp17
+ psubsw mm2, mm7 ; x1*tg_1_16-x7 = tm17
+
+ movq mm5, mm4 ; tp17
+ movq mm6, mm2 ; tm17
+
+ paddsw mm5, mm1 ; tp17+tp35 = b0
+ psubsw mm6, mm0 ; tm17-tm35 = b3
+
+ psubsw mm4, mm1 ; tp17-tp35 = t1
+ paddsw mm2, mm0 ; tm17+tm35 = t2
+
+ movq mm7, qword ptr tg_2_16
+ movq mm1, mm4 ; t1
+
+; movq qword ptr [SCRATCH+0], mm5 ; save b0
+ movq qword ptr [OUT+3*16], mm5 ; save b0
+ paddsw mm1, mm2 ; t1+t2
+
+; movq qword ptr [SCRATCH+8], mm6 ; save b3
+ movq qword ptr [OUT+5*16], mm6 ; save b3
+ psubsw mm4, mm2 ; t1-t2
+
+ movq mm5, qword ptr [INP+2*16]
+ movq mm0, mm7 ; tg_2_16
+
+ movq mm6, qword ptr [INP+6*16]
+ pmulhw mm0, mm5 ; x2*tg_2_16
+
+ pmulhw mm7, mm6 ; x6*tg_2_16
+; slot
+ pmulhw mm1, mm3 ; ocos_4_16*(t1+t2) = b1/2
+; slot
+ movq mm2, qword ptr [INP+0*16]
+ pmulhw mm4, mm3 ; ocos_4_16*(t1-t2) = b2/2
+
+ psubsw mm0, mm6 ; t2*tg_2_16-x6 = tm26
+ movq mm3, mm2 ; x0
+
+ movq mm6, qword ptr [INP+4*16]
+ paddsw mm7, mm5 ; x2+x6*tg_2_16 = tp26
+
+ paddsw mm2, mm6 ; x0+x4 = tp04
+ psubsw mm3, mm6 ; x0-x4 = tm04
+
+ movq mm5, mm2 ; tp04
+ movq mm6, mm3 ; tm04
+
+ psubsw mm2, mm7 ; tp04-tp26 = a3
+ paddsw mm3, mm0 ; tm04+tm26 = a1
+
+ paddsw mm1, mm1 ; b1
+ paddsw mm4, mm4 ; b2
+
+ paddsw mm5, mm7 ; tp04+tp26 = a0
+ psubsw mm6, mm0 ; tm04-tm26 = a2
+
+ movq mm7, mm3 ; a1
+ movq mm0, mm6 ; a2
+
+ paddsw mm3, mm1 ; a1+b1
+ paddsw mm6, mm4 ; a2+b2
+
+ psraw mm3, SHIFT_INV_COL ; dst1
+ psubsw mm7, mm1 ; a1-b1
+
+ psraw mm6, SHIFT_INV_COL ; dst2
+ psubsw mm0, mm4 ; a2-b2
+
+; movq mm1, qword ptr [SCRATCH+0] ; load b0
+ movq mm1, qword ptr [OUT+3*16] ; load b0
+ psraw mm7, SHIFT_INV_COL ; dst6
+
+ movq mm4, mm5 ; a0
+ psraw mm0, SHIFT_INV_COL ; dst5
+
+ movq qword ptr [OUT+1*16], mm3
+ paddsw mm5, mm1 ; a0+b0
+
+ movq qword ptr [OUT+2*16], mm6
+ psubsw mm4, mm1 ; a0-b0
+
+; movq mm3, qword ptr [SCRATCH+8] ; load b3
+ movq mm3, qword ptr [OUT+5*16] ; load b3
+ psraw mm5, SHIFT_INV_COL ; dst0
+
+ movq mm6, mm2 ; a3
+ psraw mm4, SHIFT_INV_COL ; dst7
+
+ movq qword ptr [OUT+5*16], mm0
+ paddsw mm2, mm3 ; a3+b3
+
+ movq qword ptr [OUT+6*16], mm7
+ psubsw mm6, mm3 ; a3-b3
+
+ movq qword ptr [OUT+0*16], mm5
+ psraw mm2, SHIFT_INV_COL ; dst3
+
+ movq qword ptr [OUT+7*16], mm4
+ psraw mm6, SHIFT_INV_COL ; dst4
+
+ movq qword ptr [OUT+3*16], mm2
+
+ movq qword ptr [OUT+4*16], mm6
+ENDM
+
+_TEXT SEGMENT PARA PUBLIC USE32 'CODE'
+
+;
+; extern "C" __fastcall void idct8x8_mmx (short *src_result);
+;
+public @MMX_IDCT@4
+
+@MMX_IDCT@4 proc near
+ mov eax, ecx ; source
+
+ DCT_8_INV_ROW_1 [eax+0], [eax+0], tab_i_04, rounder_0
+ DCT_8_INV_ROW_1 [eax+16], [eax+16], tab_i_17, rounder_1
+ DCT_8_INV_ROW_1 [eax+32], [eax+32], tab_i_26, rounder_2
+ DCT_8_INV_ROW_1 [eax+48], [eax+48], tab_i_35, rounder_3
+ DCT_8_INV_ROW_1 [eax+64], [eax+64], tab_i_04, rounder_4
+ DCT_8_INV_ROW_1 [eax+80], [eax+80], tab_i_35, rounder_5
+ DCT_8_INV_ROW_1 [eax+96], [eax+96], tab_i_26, rounder_6
+ DCT_8_INV_ROW_1 [eax+112], [eax+112], tab_i_17, rounder_7
+
+ DCT_8_INV_COL_4 [eax+0],[eax+0]
+ DCT_8_INV_COL_4 [eax+8],[eax+8]
+
+ ret
+
+@MMX_IDCT@4 ENDP
+
+_TEXT ENDS
+
+_TEXT SEGMENT PARA PUBLIC USE32 'CODE'
+
+;
+; extern "C" __fastcall void idct8x8_sse (short *src_result);
+;
+public @SSEMMX_IDCT@4
+
+@SSEMMX_IDCT@4 proc near
+ mov eax, ecx ; source
+
+ DCT_8_INV_ROW_1_s [eax+0], [eax+0], tab_i_04_s, rounder_0
+ DCT_8_INV_ROW_1_s [eax+16], [eax+16], tab_i_17_s, rounder_1
+ DCT_8_INV_ROW_1_s [eax+32], [eax+32], tab_i_26_s, rounder_2
+ DCT_8_INV_ROW_1_s [eax+48], [eax+48], tab_i_35_s, rounder_3
+ DCT_8_INV_ROW_1_s [eax+64], [eax+64], tab_i_04_s, rounder_4
+ DCT_8_INV_ROW_1_s [eax+80], [eax+80], tab_i_35_s, rounder_5
+ DCT_8_INV_ROW_1_s [eax+96], [eax+96], tab_i_26_s, rounder_6
+ DCT_8_INV_ROW_1_s [eax+112], [eax+112], tab_i_17_s, rounder_7
+
+ DCT_8_INV_COL_4 [eax+0],[eax+0]
+ DCT_8_INV_COL_4 [eax+8],[eax+8]
+
+ ret
+
+@SSEMMX_IDCT@4 ENDP
+
+_TEXT ENDS
+
+END \ No newline at end of file
diff --git a/src/filters/source/d2vsource/idctref.cpp b/src/filters/source/d2vsource/idctref.cpp
new file mode 100644
index 000000000..74b695ce1
--- /dev/null
+++ b/src/filters/source/d2vsource/idctref.cpp
@@ -0,0 +1,362 @@
+#include "stdafx.h"
+
+/* idctref_miha.c, Inverse Discrete Fourier Transform, double precision */
+
+/*************************************************************/
+/* */
+/* x87 hand-optimized assembly by Miha Peternel */
+/* 27.11. - 20.1.2001 */
+/* */
+/* You are free to use this code in your project if: */
+/* - no changes are made to this message */
+/* - any changes to this code are publicly available */
+/* - your project documentation contains the following text: */
+/* "This software contains fast high-quality IDCT decoder */
+/* by Miha Peternel." */
+/* */
+/*************************************************************/
+
+/* Perform IEEE 1180 reference (64-bit floating point, separable 8x1
+ * direct matrix multiply) Inverse Discrete Cosine Transform
+*/
+
+#define ModelX 123 // enable C-level optimizations by Miha Peternel
+
+/* Here we use math.h to generate constants. Compiler results may
+ vary a little */
+
+#include <math.h>
+
+#define M_PI 3.1415926535897932384626433832795
+const static double HALF = 0.5;
+
+/* private data */
+static short iclip[1024+1024]; /* clipping table */
+static short *iclp;
+
+/* cosine transform matrix for 8x1 IDCT */
+static double c[8][8];
+
+/* initialize DCT coefficient matrix */
+void Initialize_REF_IDCT()
+{
+ int freq, time, i;
+ double scale;
+
+ for (freq=0; freq < 8; freq++)
+ {
+ scale = (freq == 0) ? sqrt(0.125) : 0.5;
+ for (time=0; time<8; time++)
+ c[freq][time] = scale*cos((M_PI/8.0)*freq*(time + 0.5));
+ }
+
+#ifdef ModelX
+ iclp = iclip+1024;
+ for (i= -1024; i<1024; i++)
+ iclp[i] = (i<-256) ? -256 : ((i>255) ? 255 : i);
+#endif
+}
+
+void REF_IDCT(short *block)
+{
+ double tmp[64];
+ double rnd[64];
+ int int0, int1, int2, int3, int4, int5, int6, int7;
+ unsigned short fpold;
+ unsigned short fpnew;
+
+ int *b = (int *) block;
+
+ if( !(b[0]|(b[31]&~0x10000)) )
+ {
+ if( b[ 1]|b[ 2]|b[ 3]|b[ 4]|b[ 5]|b[ 6] )
+ goto normal;
+ if( b[ 7]|b[ 8]|b[ 9]|b[10]|b[11]|b[12] )
+ goto normal;
+ if( b[13]|b[14]|b[15]|b[16]|b[17]|b[18] )
+ goto normal;
+ if( b[19]|b[20]|b[21]|b[22]|b[23]|b[24] )
+ goto normal;
+ if( b[25]|b[26]|b[27]|b[28]|b[29]|b[30] )
+ goto normal;
+ b[31]=0;
+ return;
+ }
+normal:
+
+ __asm
+ {
+ // do the IDCT
+ mov esi,[block]
+ lea eax,[c]
+ lea edi,[tmp]
+ //mov ebx,8
+ mov ebx,8 // 0x77000000 // 8
+ align 16
+ __col1:
+ movzx edx,[esi+1*2]
+ mov ecx,[esi+2*2]
+ or edx,[esi+4*2]
+ or ecx,[esi+6*2]
+ or edx,ecx
+ //mov ecx,8
+ mov ecx,8/2 // 0x77000000 // 8
+
+ jnz __row1
+ fild word ptr [esi+0*2]
+ fmul qword ptr [eax+0*8*8]
+ fst qword ptr [edi+0*8]
+ fst qword ptr [edi+1*8]
+ fst qword ptr [edi+2*8]
+ fst qword ptr [edi+3*8]
+ fst qword ptr [edi+4*8]
+ fst qword ptr [edi+5*8]
+ fst qword ptr [edi+6*8]
+ fstp qword ptr [edi+7*8]
+ add edi,8*8
+ jmp __next1
+ align 16
+ __row1:
+ fild word ptr [esi+0*2]
+ fmul qword ptr [eax+0*8*8]
+ fild word ptr [esi+1*2]
+ fmul qword ptr [eax+1*8*8]
+ fadd
+ fild word ptr [esi+2*2]
+ fmul qword ptr [eax+2*8*8]
+ fadd
+ fild word ptr [esi+3*2]
+ fmul qword ptr [eax+3*8*8]
+ fadd
+ fild word ptr [esi+4*2]
+ fmul qword ptr [eax+4*8*8]
+ fadd
+ fild word ptr [esi+5*2]
+ fmul qword ptr [eax+5*8*8]
+ fadd
+ fild word ptr [esi+6*2]
+ fmul qword ptr [eax+6*8*8]
+ fadd
+ fild word ptr [esi+7*2]
+ fmul qword ptr [eax+7*8*8]
+ fadd
+
+ fild word ptr [esi+0*2]
+ fmul qword ptr [eax+0*8*8+8]
+ fild word ptr [esi+1*2]
+ fmul qword ptr [eax+1*8*8+8]
+ fadd
+ fild word ptr [esi+2*2]
+ fmul qword ptr [eax+2*8*8+8]
+ fadd
+ fild word ptr [esi+3*2]
+ fmul qword ptr [eax+3*8*8+8]
+ fadd
+ fild word ptr [esi+4*2]
+ fmul qword ptr [eax+4*8*8+8]
+ fadd
+ fild word ptr [esi+5*2]
+ fmul qword ptr [eax+5*8*8+8]
+ fadd
+ fild word ptr [esi+6*2]
+ fmul qword ptr [eax+6*8*8+8]
+ fadd
+ fild word ptr [esi+7*2]
+ fmul qword ptr [eax+7*8*8+8]
+ fadd
+ add eax,8*2
+ fxch st(1)
+ fstp qword ptr [edi]//
+ fstp qword ptr [edi+8]
+ add edi,8*2
+ dec ecx
+
+ jnz __row1
+ add eax,-8*8
+ //align 16
+ __next1:
+ add esi,+8*2
+
+ sub ebx,0x80000001 // add ebx,ebx
+ js __col1
+ //align 16
+ test ebx,ebx // align jump &| redo flags
+ jnz __col1
+
+ lea esi,[tmp]
+ lea eax,[c]
+ lea edi,[rnd]
+ //mov edi,[block]
+ fld qword ptr [HALF]
+ mov ebx,8
+ __row2:
+ mov ecx,8/2
+ align 16
+ __col2:
+ fld qword ptr [esi+0*8*8]
+ fmul qword ptr [eax+0*8*8]
+ fld qword ptr [esi+1*8*8]
+ fmul qword ptr [eax+1*8*8]
+ fadd
+ fld qword ptr [esi+2*8*8]
+ fmul qword ptr [eax+2*8*8]
+ fadd
+ fld qword ptr [esi+3*8*8]
+ fmul qword ptr [eax+3*8*8]
+ fadd
+ fld qword ptr [esi+4*8*8]
+ fmul qword ptr [eax+4*8*8]
+ fadd
+ fld qword ptr [esi+5*8*8]
+ fmul qword ptr [eax+5*8*8]
+ fadd
+ fld qword ptr [esi+6*8*8]
+ fmul qword ptr [eax+6*8*8]
+ fadd
+ fld qword ptr [esi+7*8*8]
+ fmul qword ptr [eax+7*8*8]
+ fadd
+ fadd st(0),st(1)
+
+ fxch st(1)
+
+ fld qword ptr [esi+0*8*8]
+ fmul qword ptr [eax+0*8*8+8]
+ fld qword ptr [esi+1*8*8]
+ fmul qword ptr [eax+1*8*8+8]
+ fadd
+ fld qword ptr [esi+2*8*8]
+ fmul qword ptr [eax+2*8*8+8]
+ fadd
+ fld qword ptr [esi+3*8*8]
+ fmul qword ptr [eax+3*8*8+8]
+ fadd
+ fld qword ptr [esi+4*8*8]
+ fmul qword ptr [eax+4*8*8+8]
+ fadd
+ fld qword ptr [esi+5*8*8]
+ fmul qword ptr [eax+5*8*8+8]
+ fadd
+ fld qword ptr [esi+6*8*8]
+ fmul qword ptr [eax+6*8*8+8]
+ fadd
+ fld qword ptr [esi+7*8*8]
+ fmul qword ptr [eax+7*8*8+8]
+ fadd
+ fadd st(0),st(1)
+ add eax,8*2
+
+ fxch st(2)
+ fstp qword ptr [edi]
+ fxch st(1)
+ fstp qword ptr [edi+8*8]
+ add edi,8*8*2
+
+ dec ecx
+
+ jnz __col2
+ add eax,-8*8
+ add esi,+8
+ add edi,8-8*8*8
+
+ sub ebx,0x80000001
+ js __row2
+ //align 16
+ test ebx,ebx // align jump &| redo flags
+ jnz __row2
+ ffree st(0) // bye bye 0.5
+
+ // set x87 to floor mode
+ fstcw [fpold]
+ movzx eax, [fpold]
+
+ or eax, 0x0400 // round down - floor
+ mov [fpnew], ax
+ fldcw [fpnew]
+
+ // now floor the damn array
+ lea esi, [rnd]
+ mov edi, [block]
+ mov ebx, -256 // clip min
+ mov edx, +255 // clip max
+ mov ecx, 8
+ align 16
+ __floor:
+ fld qword ptr [esi+0*8]
+ fistp dword ptr [int0]
+ mov eax,[int0]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+1*8]
+ fistp dword ptr [int1]
+ mov word ptr [edi+0*2],ax
+ mov eax,[int1]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+2*8]
+ fistp dword ptr [int2]
+ mov word ptr [edi+1*2],ax
+ mov eax,[int2]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+3*8]
+ fistp dword ptr [int3]
+ mov word ptr [edi+2*2],ax
+ mov eax,[int3]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+4*8]
+ fistp dword ptr [int4]
+ mov word ptr [edi+3*2],ax
+ mov eax,[int4]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+5*8]
+ fistp dword ptr [int5]
+ mov word ptr [edi+4*2],ax
+ mov eax,[int5]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+6*8]
+ fistp dword ptr [int6]
+ mov word ptr [edi+5*2],ax
+ mov eax,[int6]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ fld qword ptr [esi+7*8]
+ fistp dword ptr [int7]
+ mov word ptr [edi+6*2],ax
+ mov eax,[int7]
+ cmp eax,ebx
+ cmovl eax,ebx
+ cmp eax,edx
+ cmovg eax,edx
+ mov word ptr [edi+7*2],ax
+
+ add esi, 8*8
+ add edi, 8*2
+
+ sub ecx,0x80000001
+ js __floor
+ //align 16
+ test ecx,ecx // align jump &| redo flags
+ jnz __floor
+
+ // set x87 to default mode
+ fldcw [fpold]
+ };
+}
diff --git a/src/filters/source/d2vsource/resource.h b/src/filters/source/d2vsource/resource.h
new file mode 100644
index 000000000..1d1658441
--- /dev/null
+++ b/src/filters/source/d2vsource/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by d2vsource.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/source/d2vsource/stdafx.cpp b/src/filters/source/d2vsource/stdafx.cpp
new file mode 100644
index 000000000..0d549c051
--- /dev/null
+++ b/src/filters/source/d2vsource/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// d2vsource.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/source/d2vsource/stdafx.h b/src/filters/source/d2vsource/stdafx.h
new file mode 100644
index 000000000..f75685894
--- /dev/null
+++ b/src/filters/source/d2vsource/stdafx.h
@@ -0,0 +1,21 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/source/dtsac3source/DTSAC3Source.cpp b/src/filters/source/dtsac3source/DTSAC3Source.cpp
new file mode 100644
index 000000000..c73fa7307
--- /dev/null
+++ b/src/filters/source/dtsac3source/DTSAC3Source.cpp
@@ -0,0 +1,400 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <mmreg.h>
+#include <ks.h>
+#include <initguid.h>
+#include <uuids.h>
+#include "..\..\..\..\include\moreuuids.h"
+#include "dtsac3source.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_AC3},
+};
+
+const AMOVIESETUP_PIN sudOpPin[] =
+{
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CDTSAC3Source), L"DTS/AC3 Source", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDTSAC3Source>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("0"), _T("0,4,,7FFE8001"));
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("1"), _T("0,2,,0B77"));
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("2"), _T("0,2,,770B"));
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"),
+ _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".dts"),
+ _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ac3"),
+ _T("Source Filter"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{B4A7BE85-551D-4594-BDC7-832B09185041}"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".dts"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".ac3"));
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CDTSAC3Source
+//
+
+CDTSAC3Source::CDTSAC3Source(LPUNKNOWN lpunk, HRESULT* phr)
+ : CBaseSource<CDTSAC3Stream>(NAME("CDTSAC3Source"), lpunk, phr, __uuidof(this))
+{
+}
+
+CDTSAC3Source::~CDTSAC3Source()
+{
+}
+
+// CDTSAC3Stream
+
+CDTSAC3Stream::CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr)
+ : CBaseStream(NAME("CDTSAC3Stream"), pParent, phr)
+ , m_nFileOffset(0)
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+
+ m_subtype = GUID_NULL;
+ m_wFormatTag = 0;
+ m_streamid = 0;
+
+ CString fn(wfn);
+
+ if(!m_file.Open(fn, CFile::modeRead|CFile::shareDenyWrite))
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ DWORD id = 0;
+ if(m_file.Read(&id, sizeof(id)) != sizeof(id)
+ || id != 0x0180FE7F && (WORD)id != 0x0b77 && (WORD)id != 0x770b)
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ if(id == 0x0180FE7F)
+ {
+ BYTE buff[8];
+ m_file.Read(buff, 8);
+
+ int frametype = (buff[0]>>7); // 1
+ int deficitsamplecount = (buff[0]>>2)&31; // 5
+ int crcpresent = (buff[0]>>1)&1; // 1
+ int npcmsampleblocks = ((buff[0]&1)<<6)|(buff[1]>>2); // 7
+ int framebytes = (((buff[1]&3)<<12)|(buff[2]<<4)|(buff[3]>>4)) + 1; // 14
+ int audiochannelarrangement = (buff[3]&15)<<2|(buff[4]>>6); // 6
+ int freq = (buff[4]>>2)&15; // 4
+ int transbitrate = ((buff[4]&3)<<3)|(buff[5]>>5); // 5
+
+ int freqtbl[] =
+ {
+ 0,8000,16000,32000,
+ 0,0,
+ 11025,22050,44100,
+ 0,0,
+ 12000,24000,48000,
+ 0,0
+ };
+
+ int bitratetbl[] =
+ {
+ 32000,56000,64000,96000,112000,128000,192000,224000,
+ 256000,320000,384000,448000,512000,576000,640000,754500,
+ 960000,1024000,1152000,1280000,1344000,1408000,1411200,1472000,
+ 1509750,1920000,2048000,3072000,3840000,0,0,0
+ };
+
+ m_nSamplesPerSec = freqtbl[freq];
+ m_nAvgBytesPerSec = (bitratetbl[transbitrate] + 4) / 8;
+// m_nBytesPerFrame = m_nAvgBytesPerSec*10.656063618290258449304174950298/1000 + 0.5;
+ m_nBytesPerFrame = framebytes;
+ m_AvgTimePerFrame = 10000000i64 * m_nBytesPerFrame * 8 / bitratetbl[transbitrate];
+
+ m_subtype = MEDIASUBTYPE_DTS;
+ m_wFormatTag = WAVE_FORMAT_DVD_DTS;
+ m_streamid = 0x88;
+ }
+ else
+ {
+ BYTE info;
+ if((BYTE)id == 0x77) m_file.Seek(1, CFile::current); // LE
+ m_file.Read(&info, 1);
+
+ BYTE freq = info>>6;
+ BYTE bitrate = info&0x3f;
+
+ if(bitrate >= 38)
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ int freqtbl[] = {48000,44000,32000,48000};
+
+ int bitratetbl[] =
+ {
+ 32000,32000,40000,40000,48000,48000,56000,56000,64000,64000,
+ 80000,80000,96000,96000,112000,112000,128000,128000,160000,160000,
+ 192000,192000,224000,224000,256000,256000,320000,320000,384000,384000,
+ 448000,448000,512000,512000,576000,576000,640000,640000
+ };
+
+ m_nSamplesPerSec = freqtbl[freq];
+ m_nAvgBytesPerSec = (bitratetbl[bitrate] + 4) / 8;
+ m_nBytesPerFrame = m_nAvgBytesPerSec*32/1000;
+ m_AvgTimePerFrame = 10000000i64 * m_nBytesPerFrame * 8 / bitratetbl[bitrate];
+
+ m_subtype = MEDIASUBTYPE_DOLBY_AC3;
+ m_wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+ m_streamid = 0x80;
+ }
+
+ m_rtDuration = m_AvgTimePerFrame * m_file.GetLength() / m_nBytesPerFrame;
+ m_rtStop = m_rtDuration;
+}
+
+CDTSAC3Stream::~CDTSAC3Stream()
+{
+}
+
+HRESULT CDTSAC3Stream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = m_nBytesPerFrame+35;
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
+
+ return NOERROR;
+}
+
+HRESULT CDTSAC3Stream::FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len)
+{
+ BYTE* pOutOrg = pOut;
+
+ const GUID* majortype = &m_mt.majortype;
+ const GUID* subtype = &m_mt.subtype;
+
+ if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ {
+ BYTE PESHeader[] =
+ {
+ 0x00,0x00,0x01,0xBA, // PES id
+ 0x44,0x00,0x04,0x00,0x04,0x01, // SCR (0)
+ 0x01,0x89,0xC3,0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
+ };
+
+ memcpy(pOut, &PESHeader, sizeof(PESHeader));
+ pOut += sizeof(PESHeader);
+
+ majortype = &MEDIATYPE_MPEG2_PES;
+ }
+
+ if(*majortype == MEDIATYPE_MPEG2_PES)
+ {
+ BYTE Private1Header[] =
+ {
+ 0x00,0x00,0x01,0xBD, // private stream 1 id
+ 0x07,0xEC, // packet length (TODO: modify it later)
+ 0x81,0x80, // marker, original, PTS - flags
+ 0x08, // packet data starting offset
+ 0x21,0x00,0x01,0x00,0x01, // PTS (0)
+ 0xFF,0xFF,0xFF, // stuffing
+ m_streamid, // stream id (0)
+ 0x01,0x00,0x01, // no idea about this (might be the current sector on the disc), but dvd2avi doesn't output it to the ac3/dts file so we have to put it back
+ };
+
+ memcpy(pOut, &Private1Header, sizeof(Private1Header));
+ pOut += sizeof(Private1Header);
+
+ majortype = &MEDIATYPE_Audio;
+ }
+
+ if(*majortype == MEDIATYPE_Audio)
+ {
+ m_file.Seek(m_nFileOffset + nFrame*m_nBytesPerFrame, CFile::begin);
+ if(m_file.Read(pOut, m_nBytesPerFrame) < m_nBytesPerFrame) return S_FALSE;
+ pOut += m_nBytesPerFrame;
+ }
+
+ len = pOut - pOutOrg;
+
+ return S_OK;
+}
+
+bool CDTSAC3Stream::CheckDTS(const CMediaType* pmt)
+{
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DTS;
+}
+
+bool CDTSAC3Stream::CheckWAVEDTS(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_WAVE_DTS
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS;
+}
+
+bool CDTSAC3Stream::CheckAC3(const CMediaType* pmt)
+{
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
+}
+
+bool CDTSAC3Stream::CheckWAVEAC3(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
+}
+
+HRESULT CDTSAC3Stream::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ CAutoLock cAutoLock(m_pFilter->pStateLock());
+
+ if(iPosition >= 0 && iPosition < 5)
+ {
+ pmt->subtype = m_subtype;
+ pmt->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->wFormatTag = WAVE_FORMAT_PCM;
+ wfe->nSamplesPerSec = m_nSamplesPerSec;
+ wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
+ wfe->nChannels = 6;
+
+ switch(iPosition)
+ {
+ case 0:
+ pmt->majortype = MEDIATYPE_Audio;
+ break;
+ case 1:
+ pmt->ResetFormatBuffer();
+ pmt->formattype = FORMAT_None;
+ case 2:
+ pmt->majortype = MEDIATYPE_MPEG2_PES;
+ break;
+ case 3:
+ pmt->ResetFormatBuffer();
+ pmt->formattype = FORMAT_None;
+ case 4:
+ pmt->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
+ break;
+ default:
+ return E_INVALIDARG;
+ }
+ }
+ else if(iPosition == 5)
+ {
+ pmt->majortype = MEDIATYPE_Audio;
+ pmt->subtype = FOURCCMap(m_wFormatTag);
+ pmt->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->wFormatTag = m_wFormatTag;
+ wfe->nSamplesPerSec = m_nSamplesPerSec;
+ wfe->nAvgBytesPerSec = m_nAvgBytesPerSec;
+ wfe->nChannels = 2;
+ wfe->nBlockAlign = 1;
+ }
+ else
+ {
+ return VFW_S_NO_MORE_ITEMS;
+ }
+
+ pmt->SetTemporalCompression(FALSE);
+
+ return S_OK;
+}
+
+HRESULT CDTSAC3Stream::CheckMediaType(const CMediaType* pmt)
+{
+ return CheckDTS(pmt) || CheckWAVEDTS(pmt)
+ || CheckAC3(pmt) || CheckWAVEAC3(pmt)
+ ? S_OK
+ : E_INVALIDARG;
+}
diff --git a/src/filters/source/dtsac3source/DTSAC3Source.def b/src/filters/source/dtsac3source/DTSAC3Source.def
new file mode 100644
index 000000000..655ff2113
--- /dev/null
+++ b/src/filters/source/dtsac3source/DTSAC3Source.def
@@ -0,0 +1,7 @@
+LIBRARY "DTSAC3Source.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/source/dtsac3source/DTSAC3Source.h b/src/filters/source/dtsac3source/DTSAC3Source.h
new file mode 100644
index 000000000..8b40d6e7a
--- /dev/null
+++ b/src/filters/source/dtsac3source/DTSAC3Source.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include "..\BaseSource\BaseSource.h"
+
+class CDTSAC3Stream;
+
+[uuid("B4A7BE85-551D-4594-BDC7-832B09185041")]
+class CDTSAC3Source : public CBaseSource<CDTSAC3Stream>
+{
+public:
+ CDTSAC3Source(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CDTSAC3Source();
+};
+
+class CDTSAC3Stream : public CBaseStream
+{
+ CFile m_file;
+ int m_nFileOffset, m_nBytesPerFrame, m_nAvgBytesPerSec, m_nSamplesPerSec;
+ GUID m_subtype;
+ WORD m_wFormatTag;
+ BYTE m_streamid;
+
+ bool CheckDTS(const CMediaType* pmt);
+ bool CheckWAVEDTS(const CMediaType* pmt);
+ bool CheckAC3(const CMediaType* pmt);
+ bool CheckWAVEAC3(const CMediaType* pmt);
+
+public:
+ CDTSAC3Stream(const WCHAR* wfn, CSource* pParent, HRESULT* phr);
+ virtual ~CDTSAC3Stream();
+
+ HRESULT FillBuffer(IMediaSample* pSample, int nFrame, BYTE* pOut, long& len);
+
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT CheckMediaType(const CMediaType* pMediaType);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+};
diff --git a/src/filters/source/dtsac3source/dtsac3source.rc b/src/filters/source/dtsac3source/dtsac3source.rc
new file mode 100644
index 000000000..91cd374aa
--- /dev/null
+++ b/src/filters/source/dtsac3source/dtsac3source.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x7L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "DTS/AC3 Sorce Filter"
+ VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "InternalName", "DTS/AC3 Sorce Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "DTSAC3Sorce.ax"
+ VALUE "ProductName", "DTS/AC3 Sorce Filter"
+ VALUE "ProductVersion", "1, 0, 0, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/source/dtsac3source/dtsac3source.sln b/src/filters/source/dtsac3source/dtsac3source.sln
new file mode 100644
index 000000000..2b211d5cd
--- /dev/null
+++ b/src/filters/source/dtsac3source/dtsac3source.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtsac3source", "dtsac3source.vcproj", "{30D48874-899F-41C6-9B26-A40C96C91102}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug.ActiveCfg = Debug|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug.Build.0 = Debug|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug lib.ActiveCfg = Debug lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug lib.Build.0 = Debug lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release.ActiveCfg = Release|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release.Build.0 = Release|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release lib.ActiveCfg = Release lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release lib.Build.0 = Release lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode.Build.0 = Release Unicode|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {30D48874-899F-41C6-9B26-A40C96C91102}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/source/dtsac3source/dtsac3source.vcproj b/src/filters/source/dtsac3source/dtsac3source.vcproj
new file mode 100644
index 000000000..e4d125622
--- /dev/null
+++ b/src/filters/source/dtsac3source/dtsac3source.vcproj
@@ -0,0 +1,540 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="dtsac3source"
+ ProjectGUID="{30D48874-899F-41C6-9B26-A40C96C91102}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="dsutilD.lib strmbaseD.lib basesourceD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="dsutilDU.lib strmbaseDU.lib basesourceDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="dsutilR.lib strmbaseR.lib basesourceR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="dsutilRU.lib strmbaseRU.lib basesourceRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="DTSAC3Source.cpp">
+ </File>
+ <File
+ RelativePath="DTSAC3Source.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="DTSAC3Source.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\dtsac3source.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/dtsac3source/dtsac3source_vs2005.vcproj b/src/filters/source/dtsac3source/dtsac3source_vs2005.vcproj
new file mode 100644
index 000000000..005692662
--- /dev/null
+++ b/src/filters/source/dtsac3source/dtsac3source_vs2005.vcproj
@@ -0,0 +1,790 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="dtsac3source"
+ ProjectGUID="{30D48874-899F-41C6-9B26-A40C96C91102}"
+ RootNamespace="dtsac3source"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="dsutilD.lib strmbaseD.lib basesourceD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="dsutilDU.lib strmbaseDU.lib basesourceDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="dsutilR.lib strmbaseR.lib basesourceR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="dsutilRU.lib strmbaseRU.lib basesourceRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="DTSAC3Source.cpp"
+ >
+ </File>
+ <File
+ RelativePath="DTSAC3Source.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="DTSAC3Source.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\dtsac3source.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/dtsac3source/dtsac3source_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/source/dtsac3source/dtsac3source_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..f2fd09b6d
--- /dev/null
+++ b/src/filters/source/dtsac3source/dtsac3source_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/source/dtsac3source/resource.h b/src/filters/source/dtsac3source/resource.h
new file mode 100644
index 000000000..3507c6e74
--- /dev/null
+++ b/src/filters/source/dtsac3source/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by dtsac3source.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/source/dtsac3source/stdafx.cpp b/src/filters/source/dtsac3source/stdafx.cpp
new file mode 100644
index 000000000..396f14d73
--- /dev/null
+++ b/src/filters/source/dtsac3source/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// dtsac3source.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/source/dtsac3source/stdafx.h b/src/filters/source/dtsac3source/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/source/dtsac3source/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/source/flicsource/FLICSource.cpp b/src/filters/source/flicsource/FLICSource.cpp
new file mode 100644
index 000000000..b4ead25b4
--- /dev/null
+++ b/src/filters/source/flicsource/FLICSource.cpp
@@ -0,0 +1,751 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "flicsource.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
+};
+
+const AMOVIESETUP_PIN sudOpPin[] =
+{
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CFLICSource), L"FLICSource", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CFLICSource>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
+ _T("0"), _T("4,2,,11AF"));
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
+ _T("1"), _T("4,2,,12AF"));
+
+ SetRegKeyValue(
+ _T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"),
+ _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".fli"),
+ _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".flc"),
+ _T("Source Filter"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ DeleteRegKey(_T("Media Type\\{e436eb83-524f-11ce-9f53-0020af0ba770}"), _T("{17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4}"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".fli"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".flc"));
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CFLICSource
+//
+
+CFLICSource::CFLICSource(LPUNKNOWN lpunk, HRESULT* phr)
+ : CSource(NAME("CFLICSource"), lpunk, __uuidof(this))
+{
+}
+
+CFLICSource::~CFLICSource()
+{
+}
+
+STDMETHODIMP CFLICSource::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IFileSourceFilter)
+ QI(IAMFilterMiscFlags)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IFileSourceFilter
+
+STDMETHODIMP CFLICSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+{
+ if(GetPinCount() > 0)
+ return VFW_E_ALREADY_CONNECTED;
+
+ HRESULT hr = S_OK;
+ if(!(new CFLICStream(pszFileName, this, &hr)))
+ return E_OUTOFMEMORY;
+
+ if(FAILED(hr))
+ return hr;
+
+ m_fn = pszFileName;
+
+ return S_OK;
+}
+
+STDMETHODIMP CFLICSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+{
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppszFileName, m_fn);
+
+ return S_OK;
+}
+
+// IAMFilterMiscFlags
+
+ULONG CFLICSource::GetMiscFlags()
+{
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+}
+
+// CFLICStream
+
+CFLICStream::CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr)
+ : CSourceStream(NAME("FLICStream"), phr, pParent, L"Output")
+ , CSourceSeeking(NAME("FLICStream"), (IPin*)this, phr, &m_cSharedState)
+ , m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+
+ CString fn(wfn);
+
+ if(!m_flic.Open(fn, CFile::modeRead|CFile::shareDenyWrite))
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ if(m_flic.Read(&m_hdr, sizeof(m_hdr)) != sizeof(m_hdr)
+ || (m_hdr.id != 0xaf11 && m_hdr.id != 0xaf12)
+ || m_hdr.bpp != 8)
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ m_AvgTimePerFrame = (m_hdr.id == 0xaf11)
+ ? 10000000i64 * max(m_hdr.ticks, 1) / 70
+ : 10000000i64 * max(m_hdr.ticks, 1) / 1000;
+
+ // not tested (lack of test files)
+ {
+ __int64 pos = m_flic.GetPosition();
+ FLIC_PREFIX fp;
+ if(m_flic.Read(&fp, sizeof(fp)) != sizeof(fp) || fp.id != 0xf100)
+ m_flic.Seek(pos, CFile::begin);
+ else
+ m_flic.Seek(pos + fp.size, CFile::begin);
+ }
+
+ do
+ {
+ FLIC_FRAME_ENTRY ffe;
+ if(m_flic.Read(&ffe.hdr, sizeof(ffe.hdr)) != sizeof(ffe.hdr) || ffe.hdr.id != 0xf1fa)
+ break;
+ ffe.pos = m_flic.GetPosition();
+ ffe.fKeyframe = (m_frames.GetCount() == 0);
+
+ int chunk = 0;
+ while(chunk < ffe.hdr.chunks)
+ {
+ FLIC_CHUNK fc;
+ if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc))
+ break;
+/*
+ switch(fc.type)
+ {
+ case FLIC_COLOR: _colorchunk(); break;
+ case FLIC_256_COLOR: _color256chunk(); break;
+ case FLIC_BRUN: _brunchunk(); break;
+ case FLIC_LC: _lcchunk(); break;
+ case FLIC_DELTA: _deltachunk(); break;
+ case FLIC_BLACK: _blackchunk(); break;
+ case FLIC_COPY: _copychunk(); break;
+ case FLIC_MINI: break;
+ default: break;
+ }
+*/
+ ffe.fKeyframe =
+ (/*fc.type == FLIC_256_COLOR
+ || fc.type == FLIC_64_COLOR
+ ||*/ fc.type == FLIC_BRUN
+ || fc.type == FLIC_BLACK
+ || fc.type == FLIC_COPY);
+
+ __int64 pos = m_flic.GetPosition() + fc.size - sizeof(fc);
+ if(m_flic.Seek(pos, CFile::begin) != pos)
+ break;
+
+ chunk++;
+ }
+ if(chunk < ffe.hdr.chunks)
+ break;
+
+ __int64 pos = ffe.pos + ffe.hdr.size - sizeof(ffe.hdr);
+ if(m_flic.Seek(pos, CFile::begin) != pos)
+ break;
+
+ m_frames.Add(ffe);
+ }
+ while(1);
+
+ m_nLastFrameNum = -1;
+ memset(m_pPalette, 0, sizeof(m_pPalette));
+ if(!m_pFrameBuffer.Allocate(m_hdr.x*m_hdr.y*32>>3))
+ {
+ if(phr) *phr = E_OUTOFMEMORY;
+ return;
+ }
+
+ m_rtDuration = m_rtStop = m_AvgTimePerFrame*m_frames.GetCount();
+
+ if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+}
+
+CFLICStream::~CFLICStream()
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+}
+
+STDMETHODIMP CFLICStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv) //GetInterface((IMediaSeeking*)this, ppv)
+ : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
+}
+
+void CFLICStream::UpdateFromSeek()
+{
+ if(ThreadExists())
+ {
+ // next time around the loop, the worker thread will
+ // pick up the position change.
+ // We need to flush all the existing data - we must do that here
+ // as our thread will probably be blocked in GetBuffer otherwise
+
+ m_bFlushing = TRUE;
+
+ DeliverBeginFlush();
+ // make sure we have stopped pushing
+ Stop();
+ // complete the flush
+ DeliverEndFlush();
+
+ m_bFlushing = FALSE;
+
+ // restart
+ Run();
+ }
+}
+
+HRESULT CFLICStream::SetRate(double dRate)
+{
+ if(dRate <= 0)
+ return E_INVALIDARG;
+
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ m_dRateSeeking = dRate;
+ }
+
+ UpdateFromSeek();
+
+ return S_OK;
+}
+
+HRESULT CFLICStream::OnThreadStartPlay()
+{
+ m_bDiscontinuity = TRUE;
+ return DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
+}
+
+HRESULT CFLICStream::ChangeStart()
+{
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ m_rtSampleTime = 0;
+ m_rtPosition = m_rtStart;
+ }
+
+ UpdateFromSeek();
+
+ return S_OK;
+}
+
+HRESULT CFLICStream::ChangeStop()
+{
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ if(m_rtPosition < m_rtStop)
+ return S_OK;
+ }
+
+ // We're already past the new stop time -- better flush the graph.
+ UpdateFromSeek();
+
+ return S_OK;
+}
+
+HRESULT CFLICStream::OnThreadCreate()
+{
+ CAutoLock cAutoLockShared(&m_cSharedState);
+ m_rtSampleTime = 0;
+ m_rtPosition = m_rtStart;
+
+ return CSourceStream::OnThreadCreate();
+}
+
+HRESULT CFLICStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+// CAutoLock cAutoLock(m_pFilter->pStateLock());
+
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = m_hdr.x*m_hdr.y*32>>3;
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
+
+ return NOERROR;
+}
+
+HRESULT CFLICStream::FillBuffer(IMediaSample* pSample)
+{
+ HRESULT hr;
+
+ {
+ CAutoLock cAutoLockShared(&m_cSharedState);
+
+ if(m_rtPosition >= m_rtStop)
+ return S_FALSE;
+
+ BYTE* pDataIn = m_pFrameBuffer;
+ BYTE* pDataOut = NULL;
+ if(!pDataIn || FAILED(hr = pSample->GetPointer(&pDataOut)) || !pDataOut)
+ return S_FALSE;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ SetMediaType(&mt);
+
+ DeleteMediaType(pmt);
+ }
+
+ int w, h, bpp;
+ if(m_mt.formattype == FORMAT_VideoInfo)
+ {
+ w = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else if(m_mt.formattype == FORMAT_VideoInfo2)
+ {
+ w = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biWidth;
+ h = abs(((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biHeight);
+ bpp = ((VIDEOINFOHEADER2*)m_mt.pbFormat)->bmiHeader.biBitCount;
+ }
+ else
+ {
+ return S_FALSE;
+ }
+
+ int pitchIn = m_hdr.x;
+ int pitchOut = w*bpp>>3;
+
+ int nFrame = m_rtPosition / m_AvgTimePerFrame; // (int)(1.0 * m_rtPosition / m_AvgTimePerFrame + 0.5);
+
+ {
+ SeekToNearestKeyFrame(nFrame);
+
+ while(m_nLastFrameNum < nFrame && !m_bFlushing)
+ ExtractFrame(++m_nLastFrameNum);
+
+ for(int y = 0, p = min(pitchIn, pitchOut);
+ y < h;
+ y++, pDataIn += pitchIn, pDataOut += pitchOut)
+ {
+ BYTE* src = pDataIn;
+ BYTE* end = src + p;
+ DWORD* dst = (DWORD*)pDataOut;
+ while(src < end) *dst++ = m_pPalette[*src++];
+ }
+ }
+
+ pSample->SetActualDataLength(pitchOut*h);
+
+ REFERENCE_TIME rtStart, rtStop;
+ // The sample times are modified by the current rate.
+ rtStart = static_cast<REFERENCE_TIME>(m_rtSampleTime / m_dRateSeeking);
+ rtStop = rtStart + static_cast<int>(m_AvgTimePerFrame / m_dRateSeeking);
+ pSample->SetTime(&rtStart, &rtStop);
+
+ m_rtSampleTime += m_AvgTimePerFrame;
+ m_rtPosition += m_AvgTimePerFrame;
+ }
+
+ pSample->SetSyncPoint(TRUE);
+
+ if(m_bDiscontinuity)
+ {
+ pSample->SetDiscontinuity(TRUE);
+ m_bDiscontinuity = FALSE;
+ }
+
+ return S_OK;
+}
+
+HRESULT CFLICStream::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ CAutoLock cAutoLock(m_pFilter->pStateLock());
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pmt->SetType(&MEDIATYPE_Video);
+ pmt->SetSubtype(&MEDIASUBTYPE_RGB32);
+ pmt->SetFormatType(&FORMAT_VideoInfo);
+ pmt->SetTemporalCompression(TRUE);
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->AvgTimePerFrame = m_AvgTimePerFrame;
+ vih->bmiHeader.biSize = sizeof(vih->bmiHeader);
+ vih->bmiHeader.biWidth = m_hdr.x;
+ vih->bmiHeader.biHeight = -m_hdr.y;
+ vih->bmiHeader.biPlanes = 1;
+ vih->bmiHeader.biBitCount = 32;
+ vih->bmiHeader.biCompression = BI_RGB;
+ vih->bmiHeader.biSizeImage = m_hdr.x*m_hdr.y*32>>3;
+
+ pmt->SetSampleSize(vih->bmiHeader.biSizeImage);
+
+ return NOERROR;
+}
+
+HRESULT CFLICStream::CheckConnect(IPin* pPin)
+{
+ return CSourceStream::CheckConnect(pPin);
+}
+
+HRESULT CFLICStream::CheckMediaType(const CMediaType* pmt)
+{
+ if(pmt->majortype == MEDIATYPE_Video
+ && pmt->subtype == MEDIASUBTYPE_RGB32
+ && pmt->formattype == FORMAT_VideoInfo) return S_OK;
+
+ return E_INVALIDARG;
+}
+
+STDMETHODIMP CFLICStream::Notify(IBaseFilter* pSender, Quality q)
+{
+ return E_NOTIMPL;
+}
+
+////////
+
+void CFLICStream::SeekToNearestKeyFrame(int nFrame)
+{
+ if(m_nLastFrameNum == nFrame)
+ return;
+
+ if(m_nLastFrameNum > nFrame)
+ m_nLastFrameNum = -1;
+
+ for(int i = m_nLastFrameNum+1, j = min(m_frames.GetCount(), nFrame); i < j; i++)
+ {
+ FLIC_FRAME_ENTRY& ffe = m_frames[i];
+ if(ffe.fKeyframe)
+ m_nLastFrameNum = i-1;
+ }
+}
+
+void CFLICStream::ExtractFrame(int nFrame)
+{
+ FLIC_FRAME_ENTRY& ffe = m_frames[nFrame];
+
+ bool fNewPalette = false;
+ bool fNewFrame = false;
+
+ m_flic.Seek(ffe.pos, CFile::begin);
+
+ int chunk = 0;
+ while(chunk < ffe.hdr.chunks)
+ {
+ FLIC_CHUNK fc;
+ if(m_flic.Read(&fc, sizeof(fc)) != sizeof(fc))
+ break;
+
+ __int64 next = m_flic.GetPosition() + fc.size - sizeof(fc);
+
+ switch(fc.type)
+ {
+ case FLIC_64_COLOR: fNewPalette = _colorchunk(true); break;
+ case FLIC_256_COLOR: fNewPalette = _colorchunk(false); break;
+ case FLIC_BRUN: _brunchunk(); fNewFrame = true; break;
+ case FLIC_LC: _lcchunk(); break;
+ case FLIC_DELTA: _deltachunk(); break;
+ case FLIC_BLACK: _blackchunk(); fNewFrame = true; break;
+ case FLIC_COPY: _copychunk(); fNewFrame = true; break;
+ case FLIC_MINI: break;
+ default: break;
+ }
+
+ if(m_flic.Seek(next, CFile::begin) != next)
+ break;
+
+ chunk++;
+ }
+
+ if(chunk < ffe.hdr.chunks)
+ ASSERT(0);
+
+ ffe.fKeyframe = (fNewPalette && fNewFrame);
+}
+
+void CFLICStream::_blackchunk()
+{
+ memset(m_pFrameBuffer, 0, m_hdr.x*m_hdr.y*32>>3);
+}
+
+void CFLICStream::_copychunk()
+{
+ m_flic.Read(m_pFrameBuffer, m_hdr.x*m_hdr.y*32>>3);
+}
+
+bool CFLICStream::_colorchunk(bool f64)
+{
+ int nColorsUpdated = 0;
+
+ BYTE skip = 0;
+
+ WORD packets;
+ m_flic.Read(&packets, sizeof(packets));
+
+ while(packets--)
+ {
+ BYTE skip2;
+ m_flic.Read(&skip2, sizeof(skip2));
+ skip += skip2;
+
+ BYTE count;
+ m_flic.Read(&count, sizeof(count));
+
+ int len = (count == 0 ? (256-skip) : count);
+ while(len-- > 0)
+ {
+ BYTE r, g, b;
+ m_flic.Read(&r, sizeof(r));
+ m_flic.Read(&g, sizeof(g));
+ m_flic.Read(&b, sizeof(b));
+ m_pPalette[skip++] = f64
+ ? ((r << 18)&0xff0000) | ((g << 10)&0xff00) | ((b << 2)&0xff)
+ : ((r << 16)&0xff0000) | ((g << 8)&0xff00) | ((b << 0)&0xff);
+ nColorsUpdated++;
+ }
+ }
+
+ return(nColorsUpdated == 256);
+}
+
+void CFLICStream::_brunchunk()
+{
+ BYTE* tmp = m_pFrameBuffer;
+
+ int lines = m_hdr.y;
+ while(lines--)
+ {
+ BYTE packets;
+ m_flic.Read(&packets, sizeof(packets));
+
+ BYTE* ptr = tmp;
+
+ while(ptr < tmp + m_hdr.x)
+ {
+ signed char count;
+ m_flic.Read(&count, sizeof(count));
+
+ if(count >= 0)
+ {
+ BYTE c;
+ m_flic.Read(&c, sizeof(c));
+ memset(ptr, c, count);
+ ptr += count;
+ }
+ else
+ {
+ m_flic.Read(ptr, -count);
+ ptr += -count;
+ }
+ }
+
+ tmp += m_hdr.x;
+ }
+}
+
+void CFLICStream::_lcchunk()
+{
+ WORD y;
+ m_flic.Read(&y, sizeof(y));
+
+ BYTE* tmp = &m_pFrameBuffer[y*m_hdr.x];
+
+ WORD lines;
+ m_flic.Read(&lines, sizeof(lines));
+
+ while(lines--)
+ {
+ BYTE* ptr = tmp;
+
+ BYTE packets;
+ m_flic.Read(&packets, sizeof(packets));
+
+ while(packets--)
+ {
+ BYTE skip;
+ m_flic.Read(&skip, sizeof(skip));
+
+ ptr += skip;
+
+ signed char count;
+ m_flic.Read(&count, sizeof(count));
+
+ if(count >= 0)
+ {
+ m_flic.Read(ptr, count);
+ ptr += count;
+ }
+ else
+ {
+ BYTE c;
+ m_flic.Read(&c, sizeof(c));
+ memset(ptr, c, -count);
+ ptr += -count;
+ }
+ }
+
+ tmp += m_hdr.x;
+ }
+}
+
+void CFLICStream::_deltachunk()
+{
+ BYTE* tmp = m_pFrameBuffer;
+
+ WORD lines;
+ m_flic.Read(&lines, sizeof(lines));
+
+ while(lines--)
+ {
+ signed short packets;
+ m_flic.Read(&packets, sizeof(packets));
+
+ if(packets < 0)
+ {
+ if(packets&0x4000)
+ {
+ tmp += -packets * m_hdr.x;
+ lines++;
+ }
+ else
+ {
+ signed char count;
+ m_flic.Read(&count, sizeof(count));
+ tmp[m_hdr.x-1] = (BYTE)packets;
+ }
+ }
+ else
+ {
+ BYTE* ptr = tmp;
+
+ while(packets--)
+ {
+ BYTE skip;
+ m_flic.Read(&skip, sizeof(skip));
+
+ ptr += skip;
+
+ signed char count;
+ m_flic.Read(&count, sizeof(count));
+
+ if(count >= 0)
+ {
+ m_flic.Read(ptr, count << 1);
+ ptr += count << 1;
+ }
+ else
+ {
+ WORD c;
+ m_flic.Read(&c, sizeof(c));
+ count = -count;
+ while(count-- > 0)
+ {
+ *ptr++ = c>>8;
+ *ptr++ = c&0xff;
+ }
+ }
+ }
+
+ tmp += m_hdr.x;
+ }
+ }
+}
diff --git a/src/filters/source/flicsource/FLICSource.def b/src/filters/source/flicsource/FLICSource.def
new file mode 100644
index 000000000..956b2b50e
--- /dev/null
+++ b/src/filters/source/flicsource/FLICSource.def
@@ -0,0 +1,7 @@
+LIBRARY "FLICSource.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/source/flicsource/FLICSource.h b/src/filters/source/flicsource/FLICSource.h
new file mode 100644
index 000000000..21386e687
--- /dev/null
+++ b/src/filters/source/flicsource/FLICSource.h
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+
+#pragma pack(push, 1)
+enum
+{
+ FLIC_256_COLOR = 4,
+ FLIC_DELTA = 7,
+ FLIC_64_COLOR = 11,
+ FLIC_LC = 12,
+ FLIC_BLACK = 13,
+ FLIC_BRUN = 15,
+ FLIC_COPY = 16,
+ FLIC_MINI = 18
+};
+
+struct FLIC
+{
+ DWORD size;
+ WORD id; // 0xaf11 or 0xaf12
+ WORD frames, x, y, bpp;
+ WORD flags, ticks;
+ DWORD next, frit;
+ BYTE reserved[102];
+};
+
+struct FLIC_PREFIX
+{
+ DWORD size;
+ WORD id; // 0xf100
+ WORD chunks;
+ BYTE reserved[8];
+};
+
+struct FLIC_FRAME
+{
+ DWORD size;
+ WORD id; // 0xf1fa
+ WORD chunks;
+ BYTE reserved[8];
+};
+
+struct FLIC_CHUNK
+{
+ DWORD size;
+ WORD type;
+};
+#pragma pack(pop)
+
+struct FLIC_FRAME_ENTRY
+{
+ __int64 pos;
+ bool fKeyframe;
+ FLIC_FRAME hdr;
+};
+
+[uuid("17DB5CF6-39BB-4d5b-B0AA-BEBA44673AD4")]
+class CFLICSource
+ : public CSource
+ , public IFileSourceFilter
+ , public IAMFilterMiscFlags
+{
+ CStringW m_fn;
+
+public:
+ CFLICSource(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CFLICSource();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+
+ // IAMFilterMiscFlags
+ STDMETHODIMP_(ULONG) GetMiscFlags();
+};
+
+class CFLICStream
+ : public CSourceStream
+ , public CSourceSeeking
+{
+ CFile m_flic;
+ FLIC m_hdr;
+ CAtlArray<FLIC_FRAME_ENTRY> m_frames;
+
+ CCritSec m_cSharedState;
+
+ REFERENCE_TIME m_AvgTimePerFrame;
+ REFERENCE_TIME m_rtSampleTime, m_rtPosition;
+
+ BOOL m_bDiscontinuity, m_bFlushing;
+
+ HRESULT OnThreadStartPlay();
+ HRESULT OnThreadCreate();
+
+ void UpdateFromSeek();
+ STDMETHODIMP SetRate(double dRate);
+
+ HRESULT ChangeStart();
+ HRESULT ChangeStop();
+ HRESULT ChangeRate() {return S_OK;}
+
+private:
+ int m_nLastFrameNum;
+ DWORD m_pPalette[256];
+ CAutoVectorPtr<BYTE> m_pFrameBuffer;
+
+ void SeekToNearestKeyFrame(int nFrame);
+ void ExtractFrame(int nFrame);
+ void _blackchunk();
+ void _copychunk();
+ bool _colorchunk(bool f64);
+ void _brunchunk();
+ void _lcchunk();
+ void _deltachunk();
+
+public:
+ CFLICStream(const WCHAR* wfn, CFLICSource* pParent, HRESULT* phr);
+ virtual ~CFLICStream();
+
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT FillBuffer(IMediaSample* pSample);
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT CheckMediaType(const CMediaType* pMediaType);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+};
+
diff --git a/src/filters/source/flicsource/flicsource.rc b/src/filters/source/flicsource/flicsource.rc
new file mode 100644
index 000000000..589632ad3
--- /dev/null
+++ b/src/filters/source/flicsource/flicsource.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "FLICSource Filter"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "FLICSource Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "FLICSource.ax"
+ VALUE "ProductName", "FLICSource Filter"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/source/flicsource/flicsource.sln b/src/filters/source/flicsource/flicsource.sln
new file mode 100644
index 000000000..c439c09cc
--- /dev/null
+++ b/src/filters/source/flicsource/flicsource.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flicsource", "flicsource.vcproj", "{431DD5B6-3F2F-47EE-A23F-514BC044B704}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug.ActiveCfg = Debug|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug.Build.0 = Debug|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug lib.ActiveCfg = Debug lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug lib.Build.0 = Debug lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release.ActiveCfg = Release|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release.Build.0 = Release|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release lib.ActiveCfg = Release lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release lib.Build.0 = Release lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode.Build.0 = Release Unicode|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {431DD5B6-3F2F-47EE-A23F-514BC044B704}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/source/flicsource/flicsource.vcproj b/src/filters/source/flicsource/flicsource.vcproj
new file mode 100644
index 000000000..7e4488885
--- /dev/null
+++ b/src/filters/source/flicsource/flicsource.vcproj
@@ -0,0 +1,544 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="flicsource"
+ ProjectGUID="{431DD5B6-3F2F-47EE-A23F-514BC044B704}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="FLICSource.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="FLICSource.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="FLICSource.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="FLICSource.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="FLICSource.cpp">
+ </File>
+ <File
+ RelativePath="FLICSource.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="FLICSource.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\flicsource.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/flicsource/flicsource_vs2005.vcproj b/src/filters/source/flicsource/flicsource_vs2005.vcproj
new file mode 100644
index 000000000..2b1af198c
--- /dev/null
+++ b/src/filters/source/flicsource/flicsource_vs2005.vcproj
@@ -0,0 +1,797 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="flicsource"
+ ProjectGUID="{431DD5B6-3F2F-47EE-A23F-514BC044B704}"
+ RootNamespace="flicsource"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="FLICSource.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="FLICSource.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="FLICSource.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib dsutilRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="FLICSource.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="FLICSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="FLICSource.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="FLICSource.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\flicsource.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/flicsource/flicsource_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/source/flicsource/flicsource_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/source/flicsource/flicsource_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/source/flicsource/resource.h b/src/filters/source/flicsource/resource.h
new file mode 100644
index 000000000..43aa0620e
--- /dev/null
+++ b/src/filters/source/flicsource/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by flicsource.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/source/flicsource/stdafx.cpp b/src/filters/source/flicsource/stdafx.cpp
new file mode 100644
index 000000000..5158d6e51
--- /dev/null
+++ b/src/filters/source/flicsource/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// flicsource.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/source/flicsource/stdafx.h b/src/filters/source/flicsource/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/source/flicsource/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/source/shoutcastsource/ShoutcastSource.cpp b/src/filters/source/shoutcastsource/ShoutcastSource.cpp
new file mode 100644
index 000000000..f1ac770f9
--- /dev/null
+++ b/src/filters/source/shoutcastsource/ShoutcastSource.cpp
@@ -0,0 +1,693 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <initguid.h>
+#include "shoutcastsource.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\..\include\moreuuids.h"
+
+#define MAXFRAMESIZE ((144 * 320000 / 8000) + 1)
+#define BUFFERS 2
+#define MINBUFFERLENGTH 1000000i64
+#define AVGBUFFERLENGTH 30000000i64
+#define MAXBUFFERLENGTH 100000000i64
+
+static const DWORD s_bitrate[2][16] =
+{
+ {1,8,16,24,32,40,48,56,64,80,96,112,128,144,160,0},
+ {1,32,40,48,56,64,80,96,112,128,160,192,224,256,320,0}
+};
+static const DWORD s_freq[4][4] =
+{
+ {11025,12000,8000,0},
+ {0,0,0,0},
+ {22050,24000,16000,0},
+ {44100,48000,32000,0}
+};
+static const BYTE s_channels[4] =
+{
+ 2,2,2,1 // stereo, joint stereo, dual, mono
+};
+
+typedef struct
+{
+ WORD sync;
+ BYTE version;
+ BYTE layer;
+ DWORD bitrate;
+ DWORD freq;
+ BYTE channels;
+ DWORD framesize;
+
+ bool ExtractHeader(CSocket& socket)
+ {
+ BYTE buff[4];
+ if(4 != socket.Receive(buff, 4, MSG_PEEK))
+ return(false);
+
+ sync = (buff[0]<<4)|(buff[1]>>4)|1;
+ version = (buff[1]>>3)&3;
+ layer = 4 - ((buff[1]>>1)&3);
+ bitrate = s_bitrate[version&1][buff[2]>>4]*1000;
+ freq = s_freq[version][(buff[2]>>2)&3];
+ channels = s_channels[(buff[3]>>6)&3];
+ framesize = freq ? ((((version&1)?144:72) * bitrate / freq) + ((buff[2]>>1)&1)) : 0;
+
+ return(sync == 0xfff && layer == 3 && bitrate != 0 && freq != 0);
+ }
+
+} mp3hdr;
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3},
+};
+
+const AMOVIESETUP_PIN sudOpPin[] =
+{
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CShoutcastSource), L"ShoutcastSource", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CShoutcastSource>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+class CShoutcastSourceApp : public CFilterApp
+{
+public:
+ BOOL InitInstance()
+ {
+ if(!__super::InitInstance()) return FALSE;
+/*
+ if(!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
+ {
+ AfxMessageBox(_T("AfxWinInit failed!"));
+ return FALSE;
+ }
+*/
+ if(!AfxSocketInit(NULL))
+ {
+ AfxMessageBox(_T("AfxSocketInit failed!"));
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+};
+
+CShoutcastSourceApp theApp;
+
+#endif
+
+//
+// CShoutcastSource
+//
+
+CShoutcastSource::CShoutcastSource(LPUNKNOWN lpunk, HRESULT* phr)
+ : CSource(NAME("CShoutcastSource"), lpunk, __uuidof(this))
+{
+#ifndef REGISTER_FILTER
+ AfxSocketInit();
+#endif
+}
+
+CShoutcastSource::~CShoutcastSource()
+{
+}
+
+STDMETHODIMP CShoutcastSource::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IFileSourceFilter)
+ QI(IAMFilterMiscFlags)
+ QI(IAMOpenProgress)
+ QI2(IAMMediaContent)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IFileSourceFilter
+
+STDMETHODIMP CShoutcastSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+{
+ if(GetPinCount() > 0)
+ return VFW_E_ALREADY_CONNECTED;
+
+ HRESULT hr = E_OUTOFMEMORY;
+
+ if(!(new CShoutcastStream(pszFileName, this, &hr)) || FAILED(hr))
+ return hr;
+
+ m_fn = pszFileName;
+
+ return S_OK;
+}
+
+STDMETHODIMP CShoutcastSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+{
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppszFileName, m_fn);
+
+ return S_OK;
+}
+
+// IAMFilterMiscFlags
+
+ULONG CShoutcastSource::GetMiscFlags()
+{
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+}
+
+// IAMOpenProgress
+
+STDMETHODIMP CShoutcastSource::QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent)
+{
+ if(m_iPins == 1)
+ {
+ if(pllTotal) *pllTotal = 100;
+ if(pllCurrent) *pllCurrent = ((CShoutcastStream*)m_paStreams[0])->GetBufferFullness();
+ return S_OK;
+ }
+
+ return E_UNEXPECTED;
+}
+
+STDMETHODIMP CShoutcastSource::AbortOperation()
+{
+ return E_NOTIMPL;
+}
+
+// IAMMediaContent
+
+STDMETHODIMP CShoutcastSource::get_Title(BSTR* pbstrTitle)
+{
+ CheckPointer(pbstrTitle, E_POINTER);
+
+ if(m_iPins == 1)
+ {
+ *pbstrTitle = ((CShoutcastStream*)m_paStreams[0])->GetTitle().AllocSysString();
+ return S_OK;
+ }
+
+ return E_UNEXPECTED;
+}
+
+// CShoutcastStream
+
+CShoutcastStream::CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent, HRESULT* phr)
+ : CSourceStream(NAME("ShoutcastStream"), phr, pParent, L"Output")
+ , m_fBuffering(false)
+{
+ ASSERT(phr);
+
+ *phr = S_OK;
+
+ CString fn(wfn);
+ if(fn.Find(_T("://")) < 0) fn = _T("http://") + fn;
+
+#if defined(REGISTER_FILTER) && defined(DEBUG)
+//fn = _T("http://localhost:8000/");
+//fn = _T("http://64.236.34.141/stream/1005");
+//fn = _T("http://218.145.30.106:11000"); // 128kbps korean
+//fn = _T("http://65.206.46.110:8020"); // 96kbps
+//fn = _T("http://64.236.34.72:80/stream/1003");
+fn = _T("http://64.236.34.72:80/stream/1011");
+//fn = _T("http://218.145.30.106:11000");
+//fn = _T("http://radio.sluchaj.com:8000/radio.ogg"); // ogg
+// http://www.oddsock.org/icecast2yp/ // more ogg via icecast2
+#endif
+
+ if(!m_url.CrackUrl(fn))
+ {
+ *phr = E_FAIL;
+ return;
+ }
+
+ if(m_url.GetUrlPathLength() == 0)
+ m_url.SetUrlPath(_T("/"));
+
+ if(m_url.GetPortNumber() == ATL_URL_INVALID_PORT_NUMBER)
+ m_url.SetPortNumber(ATL_URL_DEFAULT_HTTP_PORT);
+
+ if(m_url.GetScheme() != ATL_URL_SCHEME_HTTP)
+ {
+ *phr = E_FAIL;
+ return;
+ }
+
+ if(!m_socket.Create() || !m_socket.Connect(m_url))
+ {
+ *phr = E_FAIL;
+ return;
+ }
+
+ m_socket.Close();
+}
+
+CShoutcastStream::~CShoutcastStream()
+{
+}
+
+void CShoutcastStream::EmptyBuffer()
+{
+ CAutoLock cAutoLock(&m_queue);
+ m_queue.RemoveAll();
+}
+
+LONGLONG CShoutcastStream::GetBufferFullness()
+{
+ CAutoLock cAutoLock(&m_queue);
+ if(!m_fBuffering) return 100;
+ if(m_queue.IsEmpty()) return 0;
+ LONGLONG ret = 100i64*(m_queue.GetTail().rtStart - m_queue.GetHead().rtStart) / AVGBUFFERLENGTH;
+ return(min(ret, 100));
+}
+
+CString CShoutcastStream::GetTitle()
+{
+ CAutoLock cAutoLock(&m_queue);
+ return(m_title);
+}
+
+HRESULT CShoutcastStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ pProperties->cBuffers = BUFFERS;
+ pProperties->cbBuffer = MAXFRAMESIZE;
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
+
+ return NOERROR;
+}
+
+HRESULT CShoutcastStream::FillBuffer(IMediaSample* pSample)
+{
+ HRESULT hr;
+
+ BYTE* pData = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pData)) || !pData)
+ return S_FALSE;
+
+ do
+ {
+ // do we have to refill our buffer?
+ {
+ CAutoLock cAutoLock(&m_queue);
+ if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - MINBUFFERLENGTH)
+ break; // nope, that's great
+ }
+
+ TRACE(_T("START BUFFERING\n"));
+ m_fBuffering = true;
+
+ while(1)
+ {
+ if(fExitThread) // playback stopped?
+ return S_FALSE;
+
+ Sleep(50);
+
+ CAutoLock cAutoLock(&m_queue);
+ if(!m_queue.IsEmpty() && m_queue.GetHead().rtStart < m_queue.GetTail().rtStart - AVGBUFFERLENGTH)
+ break; // this is enough
+ }
+
+ pSample->SetDiscontinuity(TRUE);
+
+ DeliverBeginFlush();
+ DeliverEndFlush();
+
+ DeliverNewSegment(0, ~0, 1.0);
+
+ TRACE(_T("END BUFFERING\n"));
+ m_fBuffering = false;
+ }
+ while(false);
+
+ {
+ CAutoLock cAutoLock(&m_queue);
+ ASSERT(!m_queue.IsEmpty());
+ if(!m_queue.IsEmpty())
+ {
+ mp3frame f = m_queue.RemoveHead();
+ DWORD len = min(pSample->GetSize(), f.len);
+ memcpy(pData, f.pData, len);
+ pSample->SetActualDataLength(len);
+ pSample->SetTime(&f.rtStart, &f.rtStop);
+ m_title = f.title;
+ }
+ }
+
+ pSample->SetSyncPoint(TRUE);
+
+ return S_OK;
+}
+
+HRESULT CShoutcastStream::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ CAutoLock cAutoLock(m_pFilter->pStateLock());
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pmt->SetType(&MEDIATYPE_Audio);
+ pmt->SetSubtype(&MEDIASUBTYPE_MP3);
+ pmt->SetFormatType(&FORMAT_WaveFormatEx);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pmt->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->wFormatTag = (WORD)MEDIASUBTYPE_MP3.Data1;
+ wfe->nChannels = (WORD)m_socket.m_channels;
+ wfe->nSamplesPerSec = m_socket.m_freq;
+ wfe->nAvgBytesPerSec = m_socket.m_bitrate/8;
+ wfe->nBlockAlign = 1;
+ wfe->wBitsPerSample = 0;
+
+ return NOERROR;
+}
+
+HRESULT CShoutcastStream::CheckMediaType(const CMediaType* pmt)
+{
+ if(pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_MP3
+ && pmt->formattype == FORMAT_WaveFormatEx) return S_OK;
+
+ return E_INVALIDARG;
+}
+
+static UINT SocketThreadProc(LPVOID pParam)
+{
+ return ((CShoutcastStream*)pParam)->SocketThreadProc();
+}
+
+UINT CShoutcastStream::SocketThreadProc()
+{
+ fExitThread = false;
+
+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
+
+ AfxSocketInit();
+
+ CAutoVectorPtr<BYTE> pData;
+ if(!m_socket.Create() || !m_socket.Connect(m_url)
+ || !pData.Allocate(max(m_socket.m_metaint, MAXFRAMESIZE)))
+ {
+ m_socket.Close();
+ return 1;
+ }
+
+ REFERENCE_TIME m_rtSampleTime = 0;
+
+ while(!fExitThread)
+ {
+ int len = MAXFRAMESIZE;
+ len = m_socket.Receive(pData, len);
+ if(len <= 0) break;
+
+ mp3frame f(len);
+ memcpy(f.pData, pData, len);
+ f.rtStop = (f.rtStart = m_rtSampleTime) + (10000000i64 * len * 8/m_socket.m_bitrate);
+ m_rtSampleTime = f.rtStop;
+ f.title = m_socket.m_title;
+ if(f.title.IsEmpty()) f.title = m_socket.m_url;
+
+ CAutoLock cAutoLock(&m_queue);
+ m_queue.AddTail(f);
+ }
+
+ m_socket.Close();
+
+ return 0;
+}
+
+HRESULT CShoutcastStream::OnThreadCreate()
+{
+ EmptyBuffer();
+
+ fExitThread = true;
+ m_hSocketThread = AfxBeginThread(::SocketThreadProc, this)->m_hThread;
+ while(fExitThread) Sleep(10);
+
+ return NOERROR;
+}
+
+HRESULT CShoutcastStream::OnThreadDestroy()
+{
+ EmptyBuffer();
+
+ fExitThread = true;
+ m_socket.CancelBlockingCall();
+ WaitForSingleObject(m_hSocketThread, -1);
+
+ return NOERROR;
+}
+
+HRESULT CShoutcastStream::Inactive()
+{
+ fExitThread = true;
+ return __super::Inactive();
+}
+
+//
+
+int CShoutcastStream::CShoutcastSocket::Receive(void* lpBuf, int nBufLen, int nFlags)
+{
+ if(nFlags&MSG_PEEK)
+ return __super::Receive(lpBuf, nBufLen, nFlags);
+
+ if(m_metaint > 0 && m_nBytesRead + nBufLen > m_metaint)
+ nBufLen = m_metaint - m_nBytesRead;
+
+ int len = __super::Receive(lpBuf, nBufLen, nFlags);
+ if(len <= 0) return len;
+
+ if((m_nBytesRead += len) == m_metaint)
+ {
+ m_nBytesRead = 0;
+
+ static BYTE buff[255*16], b = 0;
+ memset(buff, 0, sizeof(buff));
+ if(1 == __super::Receive(&b, 1) && b && b*16 == __super::Receive(buff, b*16))
+ {
+ CStringA str = (LPCSTR)buff;
+
+ TRACE(_T("Metainfo: %s\n"), CString(str));
+
+ CStringA title("StreamTitle='"), url("StreamUrl='");
+
+ int i = str.Find(title);
+ if(i >= 0)
+ {
+ i += title.GetLength();
+ int j = str.Find('\'', i);
+ if(j > i) m_title = str.Mid(i, j - i);
+ }
+ else
+ {
+ TRACE(_T("!!!!!!!!!Missing StreamTitle!!!!!!!!!\n"));
+ }
+
+ i = str.Find(url);
+ if(i >= 0)
+ {
+ i += url.GetLength();
+ int j = str.Find('\'', i);
+ if(j > i) m_url = str.Mid(i, j - i);
+ }
+ }
+ }
+ else if(m_metaint > 0)
+ {
+ char* p = (char*)lpBuf;
+ char* p0 = p;
+ char* pend = p + len - 13;
+ for(; p < pend; p++)
+ {
+ if(strncmp(p, "StreamTitle='", 13))
+ continue;
+
+TRACE(_T("!!!!!!!!!StreamTitle found inside mp3 data!!!!!!!!! offset=%d\n"), p - p0);
+TRACE(_T("resyncing...\n"));
+ while(p-- > p0)
+ {
+ if((BYTE)*p >= 0x20)
+ continue;
+
+TRACE(_T("found possible length byte: %d, skipping %d bytes\n"), *p, 1 + *p*16);
+ p += 1 + *p*16;
+ len = (p0 + len) - p;
+TRACE(_T("returning the remaining bytes in the packet: %d\n"), len);
+ if(len <= 0)
+ {
+TRACE(_T("nothing to return, reading a bit more in\n"));
+ if(len < 0) __super::Receive(lpBuf, -len, nFlags);
+
+ int len = __super::Receive(lpBuf, nBufLen, nFlags);
+ if(len <= 0) return len;
+ }
+
+ m_nBytesRead = len;
+ memcpy(lpBuf, p, len);
+
+ break;
+ }
+
+ break;
+ }
+ }
+
+ return len;
+}
+
+bool CShoutcastStream::CShoutcastSocket::Connect(CUrl& url)
+{
+ if(!__super::Connect(url.GetHostName(), url.GetPortNumber()))
+ return(false);
+
+ CStringA str;
+ str.Format(
+ "GET %s HTTP/1.0\r\n"
+ "Icy-MetaData:1\r\n"
+ "User-Agent: shoutcastsource\r\n"
+ "Host: %s\r\n"
+ "Accept: */*\r\n"
+ "Connection: Keep-Alive\r\n"
+ "\r\n", CStringA(url.GetUrlPath()), CStringA(url.GetHostName()));
+
+ bool fOK = false;
+ bool fTryAgain = false;
+ int metaint = 0;
+
+ do
+ {
+ int len = Send((BYTE*)(LPCSTR)str, str.GetLength());
+
+ m_nBytesRead = 0;
+ m_metaint = metaint = 0;
+ m_bitrate = 0;
+
+ str.Empty();
+ BYTE cur = 0, prev = 0;
+ while(Receive(&cur, 1) == 1 && cur && !(cur == '\n' && prev == '\n'))
+ {
+ if(cur == '\r')
+ continue;
+
+ if(cur == '\n')
+ {
+ str.MakeLower();
+ if(str.Find("icy 200 ok") >= 0) fOK = true;
+ else if(1 == sscanf(str, "icy-br:%d", &m_bitrate)) m_bitrate *= 1000;
+ else if(1 == sscanf(str, "icy-metaint:%d", &metaint)) metaint = metaint;
+ str.Empty();
+ }
+ else
+ {
+ str += cur;
+ }
+
+ prev = cur;
+ cur = 0;
+ }
+
+ if(!fOK && GetLastError() == WSAECONNRESET && !fTryAgain)
+ {
+ str.Format(
+ "GET %s HTTP/1.0\r\n"
+ "Icy-MetaData:1\r\n"
+ "Host: %s\r\n"
+ "Accept: */*\r\n"
+ "Connection: Keep-Alive\r\n"
+ "\r\n", CStringA(url.GetUrlPath()), CStringA(url.GetHostName()));
+
+ fTryAgain = true;
+ }
+ else
+ {
+ fTryAgain = false;
+ }
+ }
+ while(fTryAgain);
+
+ if(!fOK || m_bitrate == 0) {Close(); return(false);}
+
+ m_metaint = metaint;
+ m_nBytesRead = 0;
+
+ return(FindSync());
+}
+
+bool CShoutcastStream::CShoutcastSocket::FindSync()
+{
+ m_freq = -1;
+ m_channels = -1;
+
+ BYTE b;
+ for(int i = MAXFRAMESIZE; i > 0; i--, Receive(&b, 1))
+ {
+ mp3hdr h;
+ if(h.ExtractHeader(*this) && m_bitrate == h.bitrate)
+ {
+ if(h.bitrate > 1) m_bitrate = h.bitrate;
+ m_freq = h.freq;
+ m_channels = h.channels;
+ return(true);
+ }
+ }
+
+ return(false);
+}
diff --git a/src/filters/source/shoutcastsource/ShoutcastSource.def b/src/filters/source/shoutcastsource/ShoutcastSource.def
new file mode 100644
index 000000000..38d2e5796
--- /dev/null
+++ b/src/filters/source/shoutcastsource/ShoutcastSource.def
@@ -0,0 +1,7 @@
+LIBRARY "ShoutcastSource.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/source/shoutcastsource/ShoutcastSource.h b/src/filters/source/shoutcastsource/ShoutcastSource.h
new file mode 100644
index 000000000..c6b18880c
--- /dev/null
+++ b/src/filters/source/shoutcastsource/ShoutcastSource.h
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlutil.h>
+#include <afxinet.h>
+#include <afxsock.h>
+#include <qnetwork.h>
+
+[uuid("68F540E9-766F-44d2-AB07-E26CC6D27A79")]
+class CShoutcastSource
+ : public CSource
+ , public IFileSourceFilter
+ , public IAMFilterMiscFlags
+ , public IAMOpenProgress
+ , public IAMMediaContent
+{
+ CStringW m_fn;
+
+public:
+ CShoutcastSource(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CShoutcastSource();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+
+ // IAMFilterMiscFlags
+ STDMETHODIMP_(ULONG) GetMiscFlags();
+
+ // IAMOpenProgress
+ STDMETHODIMP QueryProgress(LONGLONG* pllTotal, LONGLONG* pllCurrent);
+ STDMETHODIMP AbortOperation();
+
+ // IAMMediaContent
+ STDMETHODIMP GetTypeInfoCount(UINT* pctinfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) {return E_NOTIMPL;}
+ STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) {return E_NOTIMPL;}
+ STDMETHODIMP Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) {return E_NOTIMPL;}
+ STDMETHODIMP get_AuthorName(BSTR* pbstrAuthorName) {return E_NOTIMPL;}
+ STDMETHODIMP get_Title(BSTR* pbstrTitle);
+ STDMETHODIMP get_Rating(BSTR* pbstrRating) {return E_NOTIMPL;}
+ STDMETHODIMP get_Description(BSTR* pbstrDescription) {return E_NOTIMPL;}
+ STDMETHODIMP get_Copyright(BSTR* pbstrCopyright) {return E_NOTIMPL;}
+ STDMETHODIMP get_BaseURL(BSTR* pbstrBaseURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_LogoURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_LogoIconURL(BSTR* pbstrLogoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_WatermarkURL(BSTR* pbstrWatermarkURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoURL(BSTR* pbstrMoreInfoURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoBannerImage(BSTR* pbstrMoreInfoBannerImage) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoBannerURL(BSTR* pbstrMoreInfoBannerURL) {return E_NOTIMPL;}
+ STDMETHODIMP get_MoreInfoText(BSTR* pbstrMoreInfoText) {return E_NOTIMPL;}
+};
+
+class CShoutcastStream : public CSourceStream
+{
+ class mp3frame
+ {
+ public:
+ DWORD len;
+ BYTE* pData;
+ REFERENCE_TIME rtStart, rtStop;
+ CString title;
+ mp3frame(DWORD len = 0) {pData = (this->len = len) ? new BYTE[len] : NULL; rtStart = rtStop = 0;}
+ mp3frame(const mp3frame& f) {*this = f;}
+ ~mp3frame() {delete pData;}
+ void operator = (const mp3frame& f)
+ {
+ len = f.len;
+ pData = f.pData;
+ rtStart = f.rtStart;
+ rtStop = f.rtStop;
+ title = f.title;
+ ((mp3frame*)&f)->pData = NULL;
+ }
+ };
+
+ class mp3queue : public CAtlList<mp3frame>, public CCritSec {} m_queue;
+
+ class CShoutcastSocket : public CSocket
+ {
+ DWORD m_nBytesRead;
+
+ public:
+ CShoutcastSocket() {m_metaint = m_bitrate = m_freq = m_channels = 0;}
+ int Receive(void* lpBuf, int nBufLen, int nFlags = 0);
+
+ DWORD m_metaint, m_bitrate, m_freq, m_channels;
+ CString m_title, m_url;
+ bool Connect(CUrl& url);
+ bool FindSync();
+ } m_socket;
+
+ HANDLE m_hSocketThread;
+
+ CUrl m_url;
+
+ bool m_fBuffering;
+ CString m_title;
+
+public:
+ CShoutcastStream(const WCHAR* wfn, CShoutcastSource* pParent, HRESULT* phr);
+ virtual ~CShoutcastStream();
+
+ bool fExitThread;
+ UINT SocketThreadProc();
+
+ void EmptyBuffer();
+ LONGLONG GetBufferFullness();
+ CString GetTitle();
+
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT FillBuffer(IMediaSample* pSample);
+ HRESULT CheckMediaType(const CMediaType* pMediaType);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q) {return E_NOTIMPL;}
+
+ HRESULT OnThreadCreate();
+ HRESULT OnThreadDestroy();
+ HRESULT Inactive();
+ HRESULT Pause();
+};
diff --git a/src/filters/source/shoutcastsource/resource.h b/src/filters/source/shoutcastsource/resource.h
new file mode 100644
index 000000000..ae3ca9687
--- /dev/null
+++ b/src/filters/source/shoutcastsource/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by shoutcastsource.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/source/shoutcastsource/shoutcastsource.rc b/src/filters/source/shoutcastsource/shoutcastsource.rc
new file mode 100644
index 000000000..a4603e943
--- /dev/null
+++ b/src/filters/source/shoutcastsource/shoutcastsource.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Shoutcast Source Filter"
+ VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "InternalName", "Shoutcast Source Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "ShoutcastSource.ax"
+ VALUE "ProductName", "Shoutcast Source Filter"
+ VALUE "ProductVersion", "1, 0, 0, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/source/shoutcastsource/shoutcastsource.sln b/src/filters/source/shoutcastsource/shoutcastsource.sln
new file mode 100644
index 000000000..dc05f219f
--- /dev/null
+++ b/src/filters/source/shoutcastsource/shoutcastsource.sln
@@ -0,0 +1,52 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shoutcastsource", "shoutcastsource.vcproj", "{42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug.ActiveCfg = Debug|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug lib.ActiveCfg = Debug lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release.ActiveCfg = Release|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release lib.ActiveCfg = Release lib|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/source/shoutcastsource/shoutcastsource.vcproj b/src/filters/source/shoutcastsource/shoutcastsource.vcproj
new file mode 100644
index 000000000..550f16a79
--- /dev/null
+++ b/src/filters/source/shoutcastsource/shoutcastsource.vcproj
@@ -0,0 +1,544 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="shoutcastsource"
+ ProjectGUID="{42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="ShoutcastSource.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="ShoutcastSource.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="ShoutcastSource.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="ShoutcastSource.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="ShoutcastSource.cpp">
+ </File>
+ <File
+ RelativePath="ShoutcastSource.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ShoutcastSource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\shoutcastsource.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/shoutcastsource/shoutcastsource_vs2005.vcproj b/src/filters/source/shoutcastsource/shoutcastsource_vs2005.vcproj
new file mode 100644
index 000000000..b96736f06
--- /dev/null
+++ b/src/filters/source/shoutcastsource/shoutcastsource_vs2005.vcproj
@@ -0,0 +1,797 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="shoutcastsource"
+ ProjectGUID="{42B599D7-BB84-481F-A42A-2DBE0E2E2D7E}"
+ RootNamespace="shoutcastsource"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="ShoutcastSource.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="ShoutcastSource.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="ShoutcastSource.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="ShoutcastSource.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="ShoutcastSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="ShoutcastSource.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ShoutcastSource.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\shoutcastsource.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/shoutcastsource/shoutcastsource_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/source/shoutcastsource/shoutcastsource_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/source/shoutcastsource/shoutcastsource_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/source/shoutcastsource/stdafx.cpp b/src/filters/source/shoutcastsource/stdafx.cpp
new file mode 100644
index 000000000..8905f2db5
--- /dev/null
+++ b/src/filters/source/shoutcastsource/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// shoutcastsource.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/source/shoutcastsource/stdafx.h b/src/filters/source/shoutcastsource/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/source/shoutcastsource/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/source/subtitlesource/SubtitleSource.cpp b/src/filters/source/subtitlesource/SubtitleSource.cpp
new file mode 100644
index 000000000..753682374
--- /dev/null
+++ b/src/filters/source/subtitlesource/SubtitleSource.cpp
@@ -0,0 +1,785 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "subtitlesource.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+static int _WIDTH = 640;
+static int _HEIGHT = 480;
+static int _ATPF = 400000;
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Subtitle, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Text, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
+};
+
+const AMOVIESETUP_PIN sudOpPin[] =
+{
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut},
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CSubtitleSourceASCII), L"SubtitleSource (S_TEXT/ASCII)", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin},
+ {&__uuidof(CSubtitleSourceUTF8), L"SubtitleSource (S_TEXT/UTF8)", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin},
+ {&__uuidof(CSubtitleSourceSSA), L"SubtitleSource (S_TEXT/SSA)", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin},
+ {&__uuidof(CSubtitleSourceASS), L"SubtitleSource (S_TEXT/ASS)", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin},
+ {&__uuidof(CSubtitleSourceUSF), L"SubtitleSource (S_TEXT/USF)", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin},
+ {&__uuidof(CSubtitleSourcePreview), L"SubtitleSource (Preview)", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin},
+ {&__uuidof(CSubtitleSourceARGB), L"SubtitleSource (ARGB)", MERIT_UNLIKELY, countof(sudOpPin), sudOpPin},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CSubtitleSourceASCII>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CSubtitleSourceUTF8>, NULL, &sudFilter[1]},
+ {sudFilter[2].strName, sudFilter[2].clsID, CreateInstance<CSubtitleSourceSSA>, NULL, &sudFilter[2]},
+ {sudFilter[3].strName, sudFilter[3].clsID, CreateInstance<CSubtitleSourceASS>, NULL, &sudFilter[3]},
+// {sudFilter[4].strName, sudFilter[4].clsID, CreateInstance<CSubtitleSourceUSF>, NULL, &sudFilter[4]},
+ {sudFilter[5].strName, sudFilter[5].clsID, CreateInstance<CSubtitleSourcePreview>, NULL, &sudFilter[5]},
+ {sudFilter[6].strName, sudFilter[6].clsID, CreateInstance<CSubtitleSourceARGB>, NULL, &sudFilter[6]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+/*
+ CString clsid = CStringFromGUID(__uuidof(CSubtitleSourcePreview));
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".sub"),
+ _T("Source Filter"), clsid);
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".srt"),
+ _T("Source Filter"), clsid);
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".smi"),
+ _T("Source Filter"), clsid);
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ssa"),
+ _T("Source Filter"), clsid);
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".ass"),
+ _T("Source Filter"), clsid);
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".xss"),
+ _T("Source Filter"), clsid);
+
+ SetRegKeyValue(
+ _T("Media Type\\Extensions"), _T(".usf"),
+ _T("Source Filter"), clsid);
+*/
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".sub"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".srt"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".smi"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".ssa"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".ass"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".xss"));
+ DeleteRegKey(_T("Media Type\\Extensions"), _T(".usf"));
+/**/
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+class CSubtitleSourceApp : public CFilterApp
+{
+public:
+ BOOL InitInstance()
+ {
+ if(!__super::InitInstance()) return FALSE;
+
+ _WIDTH = GetProfileInt(_T("SubtitleSource"), _T("w"), 640);
+ _HEIGHT = GetProfileInt(_T("SubtitleSource"), _T("h"), 480);
+ _ATPF = GetProfileInt(_T("SubtitleSource"), _T("atpf"), 400000);
+ if(_ATPF <= 0) _ATPF = 400000;
+ WriteProfileInt(_T("SubtitleSource"), _T("w"), _WIDTH);
+ WriteProfileInt(_T("SubtitleSource"), _T("h"), _HEIGHT);
+ WriteProfileInt(_T("SubtitleSource"), _T("atpf"), _ATPF);
+
+ return TRUE;
+ }
+};
+
+CSubtitleSourceApp theApp;
+
+#endif
+
+//
+// CSubtitleSource
+//
+
+CSubtitleSource::CSubtitleSource(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
+ : CSource(NAME("CSubtitleSource"), lpunk, clsid)
+{
+}
+
+CSubtitleSource::~CSubtitleSource()
+{
+}
+
+STDMETHODIMP CSubtitleSource::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IFileSourceFilter)
+ QI(IAMFilterMiscFlags)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IFileSourceFilter
+
+STDMETHODIMP CSubtitleSource::Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt)
+{
+ if(GetPinCount() > 0)
+ return VFW_E_ALREADY_CONNECTED;
+
+ HRESULT hr = S_OK;
+ if(!(new CSubtitleStream(pszFileName, this, &hr)))
+ return E_OUTOFMEMORY;
+
+ if(FAILED(hr))
+ return hr;
+
+ m_fn = pszFileName;
+
+ return S_OK;
+}
+
+STDMETHODIMP CSubtitleSource::GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt)
+{
+ if(!ppszFileName) return E_POINTER;
+
+ if(!(*ppszFileName = (LPOLESTR)CoTaskMemAlloc((m_fn.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppszFileName, m_fn);
+
+ return S_OK;
+}
+
+// IAMFilterMiscFlags
+
+ULONG CSubtitleSource::GetMiscFlags()
+{
+ return AM_FILTER_MISC_FLAGS_IS_SOURCE;
+}
+
+//
+// CSubtitleStream
+//
+
+CSubtitleStream::CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr)
+ : CSourceStream(NAME("SubtitleStream"), phr, pParent, L"Output")
+ , CSourceSeeking(NAME("SubtitleStream"), (IPin*)this, phr, &m_cSharedState)
+ , m_bDiscontinuity(FALSE), m_bFlushing(FALSE)
+ , m_nPosition(0)
+ , m_rts(NULL)
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+
+ CString fn(wfn);
+
+ if(!m_rts.Open(fn, DEFAULT_CHARSET))
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+
+ m_rts.CreateDefaultStyle(DEFAULT_CHARSET);
+ m_rts.ConvertToTimeBased(25);
+ m_rts.Sort();
+
+ m_rtDuration = 0;
+ for(int i = 0, cnt = m_rts.GetCount(); i < cnt; i++)
+ m_rtDuration = max(m_rtDuration, 10000i64*m_rts[i].end);
+
+ m_rtStop = m_rtDuration;
+
+ if(phr) *phr = m_rtDuration > 0 ? S_OK : E_FAIL;
+}
+
+CSubtitleStream::~CSubtitleStream()
+{
+ CAutoLock cAutoLock(&m_cSharedState);
+}
+
+STDMETHODIMP CSubtitleStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return (riid == IID_IMediaSeeking) ? CSourceSeeking::NonDelegatingQueryInterface(riid, ppv) //GetInterface((IMediaSeeking*)this, ppv)
+ : CSourceStream::NonDelegatingQueryInterface(riid, ppv);
+}
+
+void CSubtitleStream::UpdateFromSeek()
+{
+ if(ThreadExists())
+ {
+ // next time around the loop, the worker thread will
+ // pick up the position change.
+ // We need to flush all the existing data - we must do that here
+ // as our thread will probably be blocked in GetBuffer otherwise
+
+ m_bFlushing = TRUE;
+
+ DeliverBeginFlush();
+ // make sure we have stopped pushing
+ Stop();
+ // complete the flush
+ DeliverEndFlush();
+
+ m_bFlushing = FALSE;
+
+ // restart
+ Run();
+ }
+}
+
+HRESULT CSubtitleStream::SetRate(double dRate)
+{
+ if(dRate <= 0)
+ return E_INVALIDARG;
+
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ m_dRateSeeking = dRate;
+ }
+
+ UpdateFromSeek();
+
+ return S_OK;
+}
+
+HRESULT CSubtitleStream::OnThreadStartPlay()
+{
+ m_bDiscontinuity = TRUE;
+ return DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
+}
+
+HRESULT CSubtitleStream::ChangeStart()
+{
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+
+ OnThreadCreate();
+/*
+ if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
+ {
+ m_nPosition = (int)(m_rtStart/10000)*1/1000;
+ }
+ else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
+ {
+ int m_nSegments = 0;
+ if(!m_rts.SearchSubs((int)(m_rtStart/10000), 25, &m_nPosition, &m_nSegments))
+ m_nPosition = m_nSegments;
+ }
+ else
+ {
+ m_nPosition = m_rts.SearchSub((int)(m_rtStart/10000), 25);
+ if(m_nPosition < 0) m_nPosition = 0;
+ else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) m_nPosition++;
+ }
+*/ }
+
+ UpdateFromSeek();
+
+ return S_OK;
+}
+
+HRESULT CSubtitleStream::ChangeStop()
+{
+/*
+ {
+ CAutoLock lock(CSourceSeeking::m_pLock);
+ if(m_rtPosition < m_rtStop)
+ return S_OK;
+ }
+*/
+ // We're already past the new stop time -- better flush the graph.
+ UpdateFromSeek();
+
+ return S_OK;
+}
+
+HRESULT CSubtitleStream::OnThreadCreate()
+{
+ CAutoLock cAutoLockShared(&m_cSharedState);
+
+ if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
+ {
+ m_nPosition = m_rtStart/_ATPF;
+ }
+ else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
+ {
+ int m_nSegments = 0;
+ if(!m_rts.SearchSubs((int)(m_rtStart/10000), 10000000/_ATPF, &m_nPosition, &m_nSegments))
+ m_nPosition = m_nSegments;
+ }
+ else
+ {
+ m_nPosition = m_rts.SearchSub((int)(m_rtStart/10000), 25);
+ if(m_nPosition < 0) m_nPosition = 0;
+ else if(m_rts[m_nPosition].end <= (int)(m_rtStart/10000)) m_nPosition++;
+ }
+
+ return CSourceStream::OnThreadCreate();
+}
+
+HRESULT CSubtitleStream::DecideBufferSize(IMemAllocator* pAlloc, ALLOCATOR_PROPERTIES* pProperties)
+{
+// CAutoLock cAutoLock(m_pFilter->pStateLock());
+
+ ASSERT(pAlloc);
+ ASSERT(pProperties);
+
+ HRESULT hr = NOERROR;
+
+ if(m_mt.majortype == MEDIATYPE_Video)
+ {
+ pProperties->cBuffers = 2;
+ pProperties->cbBuffer = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader.biSizeImage;
+ }
+ else
+ {
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 0x10000;
+ }
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAlloc->SetProperties(pProperties, &Actual))) return hr;
+
+ if(Actual.cbBuffer < pProperties->cbBuffer) return E_FAIL;
+ ASSERT(Actual.cBuffers == pProperties->cBuffers);
+
+ return NOERROR;
+}
+
+HRESULT CSubtitleStream::FillBuffer(IMediaSample* pSample)
+{
+ HRESULT hr;
+
+ {
+ CAutoLock cAutoLockShared(&m_cSharedState);
+
+ BYTE* pData = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pData)) || !pData)
+ return S_FALSE;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ int len = 0;
+ REFERENCE_TIME rtStart, rtStop;
+
+ if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_ARGB32)
+ {
+ rtStart = (REFERENCE_TIME)((m_nPosition*_ATPF - m_rtStart) / m_dRateSeeking);
+ rtStop = (REFERENCE_TIME)(((m_nPosition+1)*_ATPF - m_rtStart) / m_dRateSeeking);
+ if(m_rtStart+rtStart >= m_rtDuration)
+ return S_FALSE;
+
+ BITMAPINFOHEADER& bmi = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader;
+
+ SubPicDesc spd;
+ spd.w = _WIDTH;
+ spd.h = _HEIGHT;
+ spd.bpp = 32;
+ spd.pitch = bmi.biWidth*4;
+ spd.bits = pData;
+
+ len = spd.h*spd.pitch;
+
+ for(int y = 0; y < spd.h; y++)
+ memsetd((DWORD*)(pData + spd.pitch*y), 0xff000000, spd.w*4);
+
+ RECT bbox;
+ m_rts.Render(spd, m_nPosition*_ATPF, 10000000.0/_ATPF, bbox);
+
+ for(int y = 0; y < spd.h; y++)
+ {
+ DWORD* p = (DWORD*)(pData + spd.pitch*y);
+ for(int x = 0; x < spd.w; x++, p++)
+ *p = (0xff000000-(*p&0xff000000))|(*p&0xffffff);
+ }
+ }
+ else if(m_mt.majortype == MEDIATYPE_Video && m_mt.subtype == MEDIASUBTYPE_RGB32)
+ {
+ const STSSegment* stss = m_rts.GetSegment(m_nPosition);
+ if(!stss) return S_FALSE;
+
+ BITMAPINFOHEADER& bmi = ((VIDEOINFOHEADER*)m_mt.pbFormat)->bmiHeader;
+
+ SubPicDesc spd;
+ spd.w = _WIDTH;
+ spd.h = _HEIGHT;
+ spd.bpp = 32;
+ spd.pitch = bmi.biWidth*4;
+ spd.bits = pData;
+
+ len = spd.h*spd.pitch;
+
+ for(int y = 0; y < spd.h; y++)
+ {
+ DWORD c1 = 0xff606060, c2 = 0xffa0a0a0;
+ if(y&32) c1 ^= c2, c2 ^= c1, c1 ^= c2;
+ DWORD* p = (DWORD*)(pData + spd.pitch*y);
+ for(int x = 0; x < spd.w; x+=32, p+=32)
+ memsetd(p, (x&32) ? c1 : c2, min(spd.w-x,32)*4);
+ }
+
+ RECT bbox;
+ m_rts.Render(spd, 10000i64*(stss->start+stss->end)/2, 10000000.0/_ATPF, bbox);
+
+ rtStart = (REFERENCE_TIME)((10000i64*stss->start - m_rtStart) / m_dRateSeeking);
+ rtStop = (REFERENCE_TIME)((10000i64*stss->end - m_rtStart) / m_dRateSeeking);
+ }
+ else
+ {
+ if(m_nPosition >= m_rts.GetCount())
+ return S_FALSE;
+
+ STSEntry& stse = m_rts[m_nPosition];
+
+ if(stse.start >= m_rtStop/10000)
+ return S_FALSE;
+
+ if(m_mt.majortype == MEDIATYPE_Subtitle && m_mt.subtype == MEDIASUBTYPE_UTF8)
+ {
+ CStringA str = UTF16To8(m_rts.GetStrW(m_nPosition, false));
+ memcpy((char*)pData, str, len = str.GetLength());
+ }
+ else if(m_mt.majortype == MEDIATYPE_Subtitle && (m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS))
+ {
+ CStringW line;
+ line.Format(L"%d,%d,%s,%s,%d,%d,%d,%s,%s",
+ stse.readorder, stse.layer, CStringW(stse.style), CStringW(stse.actor),
+ stse.marginRect.left, stse.marginRect.right, (stse.marginRect.top+stse.marginRect.bottom)/2,
+ CStringW(stse.effect), m_rts.GetStrW(m_nPosition, true));
+
+ CStringA str = UTF16To8(line);
+ memcpy((char*)pData, str, len = str.GetLength());
+ }
+ else if(m_mt.majortype == MEDIATYPE_Text && m_mt.subtype == MEDIASUBTYPE_NULL)
+ {
+ CStringA str = m_rts.GetStrA(m_nPosition, false);
+ memcpy((char*)pData, str, len = str.GetLength());
+ }
+ else
+ {
+ return S_FALSE;
+ }
+
+ rtStart = (REFERENCE_TIME)((10000i64*stse.start - m_rtStart) / m_dRateSeeking);
+ rtStop = (REFERENCE_TIME)((10000i64*stse.end - m_rtStart) / m_dRateSeeking);
+ }
+
+ pSample->SetTime(&rtStart, &rtStop);
+ pSample->SetActualDataLength(len);
+
+ m_nPosition++;
+ }
+
+ pSample->SetSyncPoint(TRUE);
+
+ if(m_bDiscontinuity)
+ {
+ pSample->SetDiscontinuity(TRUE);
+ m_bDiscontinuity = FALSE;
+ }
+
+ return S_OK;
+}
+
+HRESULT CSubtitleStream::GetMediaType(CMediaType* pmt)
+{
+ return ((CSubtitleSource*)m_pFilter)->GetMediaType(pmt);
+}
+
+HRESULT CSubtitleStream::CheckMediaType(const CMediaType* pmt)
+{
+ CAutoLock lock(m_pFilter->pStateLock());
+
+ CMediaType mt;
+ GetMediaType(&mt);
+
+ if(mt.majortype == pmt->majortype && mt.subtype == pmt->subtype)
+ {
+ return NOERROR;
+ }
+
+ return E_FAIL;
+}
+
+STDMETHODIMP CSubtitleStream::Notify(IBaseFilter* pSender, Quality q)
+{
+ return E_NOTIMPL;
+}
+
+//
+// CSubtitleSourceASCII
+//
+
+CSubtitleSourceASCII::CSubtitleSourceASCII(LPUNKNOWN lpunk, HRESULT* phr)
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
+{
+}
+
+HRESULT CSubtitleSourceASCII::GetMediaType(CMediaType* pmt)
+{
+ CAutoLock cAutoLock(pStateLock());
+
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Text);
+ pmt->SetSubtype(&MEDIASUBTYPE_NULL);
+ pmt->SetFormatType(&FORMAT_None);
+ pmt->ResetFormatBuffer();
+
+ return NOERROR;
+}
+
+//
+// CSubtitleSourceUTF8
+//
+
+CSubtitleSourceUTF8::CSubtitleSourceUTF8(LPUNKNOWN lpunk, HRESULT* phr)
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
+{
+}
+
+HRESULT CSubtitleSourceUTF8::GetMediaType(CMediaType* pmt)
+{
+ CAutoLock cAutoLock(pStateLock());
+
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Subtitle);
+ pmt->SetSubtype(&MEDIASUBTYPE_UTF8);
+ pmt->SetFormatType(&FORMAT_SubtitleInfo);
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO));
+ memset(psi, 0, pmt->FormatLength());
+ strcpy(psi->IsoLang, "eng");
+
+ return NOERROR;
+}
+
+//
+// CSubtitleSourceSSA
+//
+
+CSubtitleSourceSSA::CSubtitleSourceSSA(LPUNKNOWN lpunk, HRESULT* phr)
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
+{
+}
+
+HRESULT CSubtitleSourceSSA::GetMediaType(CMediaType* pmt)
+{
+ CAutoLock cAutoLock(pStateLock());
+
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Subtitle);
+ pmt->SetSubtype(&MEDIASUBTYPE_SSA);
+ pmt->SetFormatType(&FORMAT_SubtitleInfo);
+
+ CSimpleTextSubtitle sts;
+ sts.Open(CString(m_fn), DEFAULT_CHARSET);
+ sts.RemoveAll();
+
+ CFile f;
+ TCHAR path[MAX_PATH], fn[MAX_PATH];
+ if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn))
+ return E_FAIL;
+
+ _tcscat(fn, _T(".ssa"));
+
+ if(!sts.SaveAs(fn, EXTSSA, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead))
+ return E_FAIL;
+
+ int len = (int)f.GetLength()-3;
+ f.Seek(3, CFile::begin);
+
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO) + len);
+ memset(psi, 0, pmt->FormatLength());
+ psi->dwOffset = sizeof(SUBTITLEINFO);
+ strcpy(psi->IsoLang, "eng");
+ f.Read(pmt->pbFormat + psi->dwOffset, len);
+ f.Close();
+
+ _tremove(fn);
+
+ return NOERROR;
+}
+
+//
+// CSubtitleSourceASS
+//
+
+CSubtitleSourceASS::CSubtitleSourceASS(LPUNKNOWN lpunk, HRESULT* phr)
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
+{
+}
+
+HRESULT CSubtitleSourceASS::GetMediaType(CMediaType* pmt)
+{
+ CAutoLock cAutoLock(pStateLock());
+
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Subtitle);
+ pmt->SetSubtype(&MEDIASUBTYPE_ASS);
+ pmt->SetFormatType(&FORMAT_SubtitleInfo);
+
+ CSimpleTextSubtitle sts;
+ sts.Open(CString(m_fn), DEFAULT_CHARSET);
+ sts.RemoveAll();
+
+ CFile f;
+ TCHAR path[MAX_PATH], fn[MAX_PATH];
+ if(!GetTempPath(MAX_PATH, path) || !GetTempFileName(path, _T("mpc_sts"), 0, fn))
+ return E_FAIL;
+
+ _tcscat(fn, _T(".ass"));
+
+ if(!sts.SaveAs(fn, EXTASS, -1, CTextFile::UTF8) || !f.Open(fn, CFile::modeRead))
+ return E_FAIL;
+
+ int len = (int)f.GetLength();
+
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO) + len);
+ memset(psi, 0, pmt->FormatLength());
+ psi->dwOffset = sizeof(SUBTITLEINFO);
+ strcpy(psi->IsoLang, "eng");
+ f.Read(pmt->pbFormat + psi->dwOffset, len);
+ f.Close();
+
+ _tremove(fn);
+
+ return NOERROR;
+}
+
+//
+// CSubtitleSourceUSF
+//
+
+CSubtitleSourceUSF::CSubtitleSourceUSF(LPUNKNOWN lpunk, HRESULT* phr)
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
+{
+}
+
+HRESULT CSubtitleSourceUSF::GetMediaType(CMediaType* pmt)
+{
+ CAutoLock cAutoLock(pStateLock());
+
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Subtitle);
+ pmt->SetSubtype(&MEDIASUBTYPE_USF);
+ pmt->SetFormatType(&FORMAT_SubtitleInfo);
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)pmt->AllocFormatBuffer(sizeof(SUBTITLEINFO));
+ memset(psi, 0, pmt->FormatLength());
+ strcpy(psi->IsoLang, "eng");
+ // TODO: ...
+
+ return NOERROR;
+}
+
+//
+// CSubtitleSourcePreview
+//
+
+CSubtitleSourcePreview::CSubtitleSourcePreview(LPUNKNOWN lpunk, HRESULT* phr)
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
+{
+}
+
+HRESULT CSubtitleSourcePreview::GetMediaType(CMediaType* pmt)
+{
+ CAutoLock cAutoLock(pStateLock());
+
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Video);
+ pmt->SetSubtype(&MEDIASUBTYPE_RGB32);
+ pmt->SetFormatType(&FORMAT_VideoInfo);
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(pvih, 0, pmt->FormatLength());
+ pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
+ pvih->bmiHeader.biWidth = _WIDTH;
+ pvih->bmiHeader.biHeight = _HEIGHT;
+ pvih->bmiHeader.biBitCount = 32;
+ pvih->bmiHeader.biCompression = BI_RGB;
+ pvih->bmiHeader.biPlanes = 1;
+ pvih->bmiHeader.biSizeImage = pvih->bmiHeader.biWidth*abs(pvih->bmiHeader.biHeight)*pvih->bmiHeader.biBitCount>>3;
+
+ return NOERROR;
+}
+
+//
+// CSubtitleSourceARGB
+//
+
+CSubtitleSourceARGB::CSubtitleSourceARGB(LPUNKNOWN lpunk, HRESULT* phr)
+ : CSubtitleSource(lpunk, phr, __uuidof(this))
+{
+}
+
+HRESULT CSubtitleSourceARGB::GetMediaType(CMediaType* pmt)
+{
+ CAutoLock cAutoLock(pStateLock());
+
+ pmt->InitMediaType();
+ pmt->SetType(&MEDIATYPE_Video);
+ pmt->SetSubtype(&MEDIASUBTYPE_ARGB32);
+ pmt->SetFormatType(&FORMAT_VideoInfo);
+ VIDEOINFOHEADER* pvih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(pvih, 0, pmt->FormatLength());
+ pvih->bmiHeader.biSize = sizeof(pvih->bmiHeader);
+ // TODO: read w,h,fps from a config file or registry
+ pvih->bmiHeader.biWidth = _WIDTH;
+ pvih->bmiHeader.biHeight = _HEIGHT;
+ pvih->bmiHeader.biBitCount = 32;
+ pvih->bmiHeader.biCompression = BI_RGB;
+ pvih->bmiHeader.biPlanes = 1;
+ pvih->bmiHeader.biSizeImage = pvih->bmiHeader.biWidth*abs(pvih->bmiHeader.biHeight)*pvih->bmiHeader.biBitCount>>3;
+
+ return NOERROR;
+}
diff --git a/src/filters/source/subtitlesource/SubtitleSource.def b/src/filters/source/subtitlesource/SubtitleSource.def
new file mode 100644
index 000000000..707f02d5d
--- /dev/null
+++ b/src/filters/source/subtitlesource/SubtitleSource.def
@@ -0,0 +1,7 @@
+LIBRARY "SubtitleSource.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/source/subtitlesource/SubtitleSource.h b/src/filters/source/subtitlesource/SubtitleSource.h
new file mode 100644
index 000000000..c3501f0ff
--- /dev/null
+++ b/src/filters/source/subtitlesource/SubtitleSource.h
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include "..\..\..\subtitles\RTS.h"
+
+class CSubtitleSource
+ : public CSource
+ , public IFileSourceFilter
+ , public IAMFilterMiscFlags
+{
+protected:
+ CStringW m_fn;
+
+public:
+ CSubtitleSource(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid);
+ virtual ~CSubtitleSource();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IFileSourceFilter
+ STDMETHODIMP Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetCurFile(LPOLESTR* ppszFileName, AM_MEDIA_TYPE* pmt);
+
+ // IAMFilterMiscFlags
+ STDMETHODIMP_(ULONG) GetMiscFlags();
+
+ virtual HRESULT GetMediaType(CMediaType* pmt) = 0;
+};
+
+class CSubtitleStream
+ : public CSourceStream
+ , public CSourceSeeking
+{
+ CCritSec m_cSharedState;
+
+ int m_nPosition;
+
+ BOOL m_bDiscontinuity, m_bFlushing;
+
+ HRESULT OnThreadStartPlay();
+ HRESULT OnThreadCreate();
+
+ void UpdateFromSeek();
+ STDMETHODIMP SetRate(double dRate);
+
+ HRESULT ChangeStart();
+ HRESULT ChangeStop();
+ HRESULT ChangeRate() {return S_OK;}
+
+protected:
+ CRenderedTextSubtitle m_rts;
+
+public:
+ CSubtitleStream(const WCHAR* wfn, CSubtitleSource* pParent, HRESULT* phr);
+ virtual ~CSubtitleStream();
+
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT DecideBufferSize(IMemAllocator* pIMemAlloc, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT FillBuffer(IMediaSample* pSample);
+ HRESULT GetMediaType(CMediaType* pmt);
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+};
+
+[uuid("E44CA3B5-A0FF-41A0-AF16-42429B1095EA")]
+class CSubtitleSourceASCII : public CSubtitleSource
+{
+public:
+ CSubtitleSourceASCII(LPUNKNOWN lpunk, HRESULT* phr);
+
+ HRESULT GetMediaType(CMediaType* pmt);
+};
+
+[uuid("87864E0F-7073-4E39-B802-143DE0ED4964")]
+class CSubtitleSourceUTF8 : public CSubtitleSource
+{
+public:
+ CSubtitleSourceUTF8(LPUNKNOWN lpunk, HRESULT* phr);
+
+ HRESULT GetMediaType(CMediaType* pmt);
+};
+
+[uuid("18316B1A-5877-4CC4-85FD-EDE65CD489EC")]
+class CSubtitleSourceSSA : public CSubtitleSource
+{
+public:
+ CSubtitleSourceSSA(LPUNKNOWN lpunk, HRESULT* phr);
+
+ HRESULT GetMediaType(CMediaType* pmt);
+};
+
+[uuid("416782BC-1D87-48C0-8F65-F113A5CB8E15")]
+class CSubtitleSourceASS : public CSubtitleSource
+{
+public:
+ CSubtitleSourceASS(LPUNKNOWN lpunk, HRESULT* phr);
+
+ HRESULT GetMediaType(CMediaType* pmt);
+};
+
+[uuid("D7215AFC-DFE6-483B-9AF3-6BBECFF14CF4")]
+class CSubtitleSourceUSF : public CSubtitleSource
+{
+public:
+ CSubtitleSourceUSF(LPUNKNOWN lpunk, HRESULT* phr);
+
+ HRESULT GetMediaType(CMediaType* pmt);
+};
+
+[uuid("932E75D4-BBD4-4A0F-9071-6728FBDC4C98")]
+class CSubtitleSourcePreview : public CSubtitleSource
+{
+public:
+ CSubtitleSourcePreview(LPUNKNOWN lpunk, HRESULT* phr);
+
+ HRESULT GetMediaType(CMediaType* pmt);
+};
+
+[uuid("CF0D7280-527D-415E-BA02-56017484D73E")]
+class CSubtitleSourceARGB : public CSubtitleSource
+{
+public:
+ CSubtitleSourceARGB(LPUNKNOWN lpunk, HRESULT* phr);
+
+ HRESULT GetMediaType(CMediaType* pmt);
+};
+
diff --git a/src/filters/source/subtitlesource/resource.h b/src/filters/source/subtitlesource/resource.h
new file mode 100644
index 000000000..fb6ab9443
--- /dev/null
+++ b/src/filters/source/subtitlesource/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by subtitlesource.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/source/subtitlesource/stdafx.cpp b/src/filters/source/subtitlesource/stdafx.cpp
new file mode 100644
index 000000000..f08539cb9
--- /dev/null
+++ b/src/filters/source/subtitlesource/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// subtitlesource.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/source/subtitlesource/stdafx.h b/src/filters/source/subtitlesource/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/source/subtitlesource/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/source/subtitlesource/subtitlesource.rc b/src/filters/source/subtitlesource/subtitlesource.rc
new file mode 100644
index 000000000..75e8186d1
--- /dev/null
+++ b/src/filters/source/subtitlesource/subtitlesource.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "SubtitleSource Filter"
+ VALUE "FileVersion", "1, 0, 0, 1"
+ VALUE "InternalName", "SubtitleSource Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "SubtitleSource.ax"
+ VALUE "ProductName", "SubtitleSource Filter"
+ VALUE "ProductVersion", "1, 0, 0, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/source/subtitlesource/subtitlesource.sln b/src/filters/source/subtitlesource/subtitlesource.sln
new file mode 100644
index 000000000..af636d0fb
--- /dev/null
+++ b/src/filters/source/subtitlesource/subtitlesource.sln
@@ -0,0 +1,52 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitlesource", "subtitlesource.vcproj", "{8F998497-9C51-4FAA-83E4-1D85B22CBA13}"
+ ProjectSection(ProjectDependencies) = postProject
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitles", "..\..\..\subtitles\subtitles.vcproj", "{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug.ActiveCfg = Debug|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug lib.ActiveCfg = Debug lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release.ActiveCfg = Release|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release lib.ActiveCfg = Release lib|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {8F998497-9C51-4FAA-83E4-1D85B22CBA13}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug lib.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug lib.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.Build.0 = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release lib.ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release lib.Build.0 = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.Build.0 = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/source/subtitlesource/subtitlesource.vcproj b/src/filters/source/subtitlesource/subtitlesource.vcproj
new file mode 100644
index 000000000..9db940a76
--- /dev/null
+++ b/src/filters/source/subtitlesource/subtitlesource.vcproj
@@ -0,0 +1,533 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="subtitlesource"
+ ProjectGUID="{8F998497-9C51-4FAA-83E4-1D85B22CBA13}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib subtitlesD.lib subpicD.lib dsutilD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="SubtitleSource.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib subtitlesR.lib subpicR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="SubtitleSource.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib subtitlesDU.lib subpicDU.lib dsutilDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="SubtitleSource.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib subtitlesRU.lib subpicRU.lib dsutilRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="SubtitleSource.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="SubtitleSource.cpp">
+ </File>
+ <File
+ RelativePath="SubtitleSource.def">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="SubtitleSource.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\subtitlesource.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/subtitlesource/subtitlesource_vs2005.vcproj b/src/filters/source/subtitlesource/subtitlesource_vs2005.vcproj
new file mode 100644
index 000000000..18140d6ac
--- /dev/null
+++ b/src/filters/source/subtitlesource/subtitlesource_vs2005.vcproj
@@ -0,0 +1,785 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="subtitlesource"
+ ProjectGUID="{8F998497-9C51-4FAA-83E4-1D85B22CBA13}"
+ RootNamespace="subtitlesource"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib subtitlesD.lib subpicD.lib dsutilD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="SubtitleSource.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib subtitlesR.lib subpicR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="SubtitleSource.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib subtitlesDU.lib subpicDU.lib dsutilDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="SubtitleSource.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib subtitlesRU.lib subpicRU.lib dsutilRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile="SubtitleSource.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="SubtitleSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="SubtitleSource.def"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath="SubtitleSource.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\subtitlesource.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/source/subtitlesource/subtitlesource_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/source/subtitlesource/subtitlesource_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/source/subtitlesource/subtitlesource_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/stdafx.cpp b/src/filters/stdafx.cpp
new file mode 100644
index 000000000..fd94566f5
--- /dev/null
+++ b/src/filters/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// misc.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/stdafx.h b/src/filters/stdafx.h
new file mode 100644
index 000000000..dd0d28f25
--- /dev/null
+++ b/src/filters/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <dshow.h>
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/switcher/audioswitcher/Audio.cpp b/src/filters/switcher/audioswitcher/Audio.cpp
new file mode 100644
index 000000000..878fb337d
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/Audio.cpp
@@ -0,0 +1,314 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// originally from virtualdub
+
+#include "stdafx.h"
+#include "Audio.h"
+
+static long audio_pointsample_8(void *dst, void *src, long accum, long samp_frac, long cnt) {
+ unsigned char *d = (unsigned char *)dst;
+ unsigned char *s = (unsigned char *)src;
+
+ do {
+ *d++ = s[accum>>19];
+ accum += samp_frac;
+ } while(--cnt);
+
+ return accum;
+}
+
+static long audio_pointsample_16(void *dst, void *src, long accum, long samp_frac, long cnt) {
+ unsigned short *d = (unsigned short *)dst;
+ unsigned short *s = (unsigned short *)src;
+
+ do {
+ *d++ = s[accum>>19];
+ accum += samp_frac;
+ } while(--cnt);
+
+ return accum;
+}
+
+static long audio_pointsample_32(void *dst, void *src, long accum, long samp_frac, long cnt) {
+ unsigned long *d = (unsigned long *)dst;
+ unsigned long *s = (unsigned long *)src;
+
+ do {
+ *d++ = s[accum>>19];
+ accum += samp_frac;
+ } while(--cnt);
+
+ return accum;
+}
+
+static long audio_downsample_mono8(void *dst, void *src, long *filter_bank, int filter_width, long accum, long samp_frac, long cnt) {
+ unsigned char *d = (unsigned char *)dst;
+ unsigned char *s = (unsigned char *)src;
+
+ do {
+ long sum = 0;
+ int w;
+ long *fb_ptr;
+ unsigned char *s_ptr;
+
+ w = filter_width;
+ fb_ptr = filter_bank + filter_width * ((accum>>11)&0xff);
+ s_ptr = s + (accum>>19);
+ do {
+ sum += *fb_ptr++ * (int)*s_ptr++;
+ } while(--w);
+
+ if (sum < 0)
+ *d++ = 0;
+ else if (sum > 0x3fffff)
+ *d++ = 0xff;
+ else
+ *d++ = ((sum + 0x2000)>>14);
+
+ accum += samp_frac;
+ } while(--cnt);
+
+ return accum;
+}
+
+static long audio_downsample_mono16(void *dst, void *src, long *filter_bank, int filter_width, long accum, long samp_frac, long cnt) {
+ signed short *d = (signed short *)dst;
+ signed short *s = (signed short *)src;
+
+ do {
+ long sum = 0;
+ int w;
+ long *fb_ptr;
+ signed short *s_ptr;
+
+ w = filter_width;
+ fb_ptr = filter_bank + filter_width * ((accum>>11)&0xff);
+ s_ptr = s + (accum>>19);
+ do {
+ sum += *fb_ptr++ * (int)*s_ptr++;
+ } while(--w);
+
+ if (sum < -0x20000000)
+ *d++ = -0x8000;
+ else if (sum > 0x1fffffff)
+ *d++ = 0x7fff;
+ else
+ *d++ = ((sum + 0x2000)>>14);
+
+ accum += samp_frac;
+ } while(--cnt);
+
+ return accum;
+}
+
+
+static int permute_index(int a, int b) {
+ return (b-(a>>8)-1) + (a&255)*b;
+}
+
+static void make_downsample_filter(long *filter_bank, int filter_width, long samp_frac) {
+ int i, j, v;
+ double filt_max;
+ double filtwidth_frac;
+
+ filtwidth_frac = samp_frac/2048.0;
+
+ filter_bank[filter_width-1] = 0;
+
+ filt_max = (16384.0 * 524288.0) / samp_frac;
+
+ for(i=0; i<128*filter_width; i++) {
+ int y = 0;
+ double d = i / filtwidth_frac;
+
+ if (d<1.0)
+ y = (int)(0.5 + filt_max*(1.0 - d));
+
+ filter_bank[permute_index(128*filter_width + i, filter_width)]
+ = filter_bank[permute_index(128*filter_width - i, filter_width)]
+ = y;
+ }
+
+ // Normalize the filter to correct for integer roundoff errors
+
+ for(i=0; i<256*filter_width; i+=filter_width) {
+ v=0;
+ for(j=0; j<filter_width; j++)
+ v += filter_bank[i+j];
+
+// _RPT2(0,"error[%02x] = %04x\n", i/filter_width, 0x4000 - v);
+
+ v = (0x4000 - v)/filter_width;
+ for(j=0; j<filter_width; j++)
+ filter_bank[i+j] += v;
+ }
+
+// _CrtCheckMemory();
+}
+
+AudioStreamResampler::AudioStreamResampler(int bps, long org_rate, long new_rate, bool fHighQuality)
+{
+ samp_frac = 0x80000;
+
+ this->bps = bps;
+
+ if(bps == 1)
+ {
+ ptsampleRout = audio_pointsample_8;
+ dnsampleRout = audio_downsample_mono8;
+ }
+ else if(bps >= 2)
+ {
+ ptsampleRout = audio_pointsample_16;
+ dnsampleRout = audio_downsample_mono16;
+ }
+ else
+ {
+ return;
+ }
+
+// org_rate > new_rate!
+ samp_frac = MulDiv(org_rate, 0x80000, new_rate);
+
+ holdover = 0;
+ filter_bank = NULL;
+ filter_width = 1;
+ accum = 0;
+
+ // If this is a high-quality downsample, allocate memory for the filter bank
+
+ if(fHighQuality)
+ {
+ if(samp_frac>0x80000)
+ {
+ // HQ downsample: allocate filter bank
+
+ filter_width = ((samp_frac + 0x7ffff)>>19)<<1 <<1;
+
+ if(!(filter_bank = new long[filter_width * 256]))
+ {
+ filter_width = 1;
+ return;
+ }
+
+ make_downsample_filter(filter_bank, filter_width, samp_frac);
+
+ // Clear lower samples
+
+ memset(cbuffer, bps >= 2 ? 0 : 0x80, bps*filter_width);
+
+ holdover = filter_width/2;
+ }
+ }
+}
+
+AudioStreamResampler::~AudioStreamResampler()
+{
+ delete [] filter_bank;
+}
+
+long AudioStreamResampler::Downsample(void* input, long samplesin, void* output, long samplesout)
+{
+ long lActualSamples = 0;
+
+ // Downsampling is even worse because we have overlap to the left and to the
+ // right of the interpolated point.
+ //
+ // We need (n/2) points to the left and (n/2-1) points to the right.
+
+ while(samplesin > 0 && samplesout > 0)
+ {
+ long srcSamples, dstSamples;
+ int nhold;
+
+ // Figure out how many source samples we need.
+ //
+ // To do this, compute the highest fixed-point accumulator we'll reach.
+ // Truncate that, and add the filter width. Then subtract however many
+ // samples are sitting at the bottom of the buffer.
+
+ srcSamples = (long)(((__int64)samp_frac*(samplesout-1) + accum) >> 19) + filter_width - holdover;
+
+ // Don't exceed the buffer (BUFFER_SIZE - holdover).
+
+ if(srcSamples > BUFFER_SIZE - holdover)
+ srcSamples = BUFFER_SIZE - holdover;
+
+ // Read into buffer.
+
+ srcSamples = min(srcSamples, samplesin);
+ if(!srcSamples) break;
+
+ memcpy((char*)cbuffer + holdover*bps, (char*)input, srcSamples*bps);
+ input = (void *)((char *)input + srcSamples*bps);
+
+ // Figure out how many destination samples we'll get out of what we
+ // read. We'll have (srcSamples+holdover) bytes, so the maximum
+ // fixed-pt accumulator we can hit is
+ // (srcSamples+holdover-filter_width)<<16 + 0xffff.
+
+ dstSamples = (((__int64)(srcSamples+holdover-filter_width)<<19) + 0x7ffff - accum) / samp_frac + 1;
+
+ if(dstSamples > samplesout)
+ dstSamples = samplesout;
+
+ if(dstSamples >= 1)
+ {
+ if(filter_bank)
+ accum = dnsampleRout(output, cbuffer, filter_bank, filter_width, accum, samp_frac, dstSamples);
+ else
+ accum = ptsampleRout(output, cbuffer, accum, samp_frac, dstSamples);
+
+ output = (void *)((char *)output + bps * dstSamples);
+ lActualSamples += dstSamples;
+ samplesout -= dstSamples;
+ }
+
+ // We're "shifting" the new samples down to the bottom by discarding
+ // all the samples in the buffer, so adjust the fixed-pt accum
+ // accordingly.
+
+ accum -= ((srcSamples+holdover)<<19);
+
+ // Oops, did we need some of those?
+ //
+ // If accum=0, we need (n/2) samples back. accum>=0x10000 is fewer,
+ // accum<0 is more.
+
+ nhold = - (accum>>19);
+
+// _ASSERT(nhold<=(filter_width/2));
+
+ if (nhold>0) {
+ memmove(cbuffer, (char *)cbuffer+bps*(srcSamples+holdover-nhold), bps*nhold);
+ holdover = nhold;
+ accum += nhold<<19;
+ } else
+ holdover = 0;
+
+// _ASSERT(accum>=0);
+ }
+
+ int Bytes = lActualSamples * bps;
+
+ return lActualSamples;
+}
diff --git a/src/filters/switcher/audioswitcher/Audio.h b/src/filters/switcher/audioswitcher/Audio.h
new file mode 100644
index 000000000..81688d93c
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/Audio.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <windows.h>
+#include <MMREG.H>
+#include <mmsystem.h>
+#include <msacm.h>
+
+typedef long (*AudioPointSampler)(void *, void *, long, long, long);
+typedef long (*AudioDownSampler)(void *, void *, long *, int, long, long, long);
+
+class AudioStreamResampler
+{
+private:
+ AudioPointSampler ptsampleRout;
+ AudioDownSampler dnsampleRout;
+ long samp_frac;
+ long accum;
+ int holdover;
+ long *filter_bank;
+ int filter_width;
+ bool fHighQuality;
+
+ enum { BUFFER_SIZE=512 };
+ BYTE cbuffer[4*BUFFER_SIZE];
+ int bps;
+
+public:
+ AudioStreamResampler(int bps, long org_rate, long new_rate, bool fHighQuality);
+ ~AudioStreamResampler();
+
+ long Downsample(void* input, long samplesin, void* output, long samplesout);
+};
+
diff --git a/src/filters/switcher/audioswitcher/AudioSwitcher.cpp b/src/filters/switcher/audioswitcher/AudioSwitcher.cpp
new file mode 100644
index 000000000..f85a69ae4
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/AudioSwitcher.cpp
@@ -0,0 +1,616 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+
+#include "Shlwapi.h"
+#include <math.h>
+#include <atlpath.h>
+#include <mmreg.h>
+#include <ks.h>
+#include <ksmedia.h>
+#include "AudioSwitcher.h"
+#include "Audio.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL}
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL}
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CAudioSwitcherFilter), L"AudioSwitcher", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CAudioSwitcherFilter>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CAudioSwitcherFilter
+//
+
+CAudioSwitcherFilter::CAudioSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CStreamSwitcherFilter(lpunk, phr, __uuidof(this))
+ , m_fCustomChannelMapping(false)
+ , m_fDownSampleTo441(false)
+ , m_rtAudioTimeShift(0)
+ , m_rtNextStart(0)
+ , m_rtNextStop(1)
+ , m_fNormalize(false)
+ , m_fNormalizeRecover(false)
+ , m_boost(1)
+ , m_sample_max(0.1f)
+{
+ memset(m_pSpeakerToChannelMap, 0, sizeof(m_pSpeakerToChannelMap));
+
+ if(phr)
+ {
+ if(FAILED(*phr)) return;
+ else *phr = S_OK;
+ }
+}
+
+STDMETHODIMP CAudioSwitcherFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(IAudioSwitcherFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CAudioSwitcherFilter::CheckMediaType(const CMediaType* pmt)
+{
+ if(pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->nChannels > 2
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag != WAVE_FORMAT_EXTENSIBLE)
+ return VFW_E_INVALIDMEDIATYPE; // stupid iviaudio tries to fool us
+
+ return (pmt->majortype == MEDIATYPE_Audio
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && (((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 8
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 16
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 24
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wBitsPerSample == 32)
+ && (((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_PCM
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_IEEE_FLOAT
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3_SPDIF
+ || ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_EXTENSIBLE))
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+template<class T, class U, int Umin, int Umax>
+void mix(DWORD mask, int ch, int bps, BYTE* src, BYTE* dst)
+{
+ U sum = 0;
+
+ for(int i = 0, j = min(18, ch); i < j; i++)
+ {
+ if(mask & (1<<i))
+ {
+ sum += *(T*)&src[bps*i];
+ }
+ }
+
+ if(sum < Umin) sum = Umin;
+ if(sum > Umax) sum = Umax;
+
+ *(T*)dst = (T)sum;
+}
+
+template<>
+void mix<int, INT64, (-1<<24), (+1<<24)-1>(DWORD mask, int ch, int bps, BYTE* src, BYTE* dst)
+{
+ INT64 sum = 0;
+
+ for(int i = 0, j = min(18, ch); i < j; i++)
+ {
+ if(mask & (1<<i))
+ {
+ int tmp;
+ memcpy((BYTE*)&tmp+1, &src[bps*i], 3);
+ sum += tmp >> 8;
+ }
+ }
+
+ sum = min(max(sum, (-1<<24)), (+1<<24)-1);
+
+ memcpy(dst, (BYTE*)&sum, 3);
+}
+
+template<class T>
+T clamp(double s, T smin, T smax)
+{
+ if(s < -1) s = -1;
+ else if(s > 1) s = 1;
+ T t = (T)(s * smax);
+ if(t < smin) t = smin;
+ else if(t > smax) t = smax;
+ return t;
+}
+
+HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
+{
+ CStreamSwitcherInputPin* pInPin = GetInputPin();
+ CStreamSwitcherOutputPin* pOutPin = GetOutputPin();
+ if(!pInPin || !pOutPin)
+ return __super::Transform(pIn, pOut);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
+ WAVEFORMATEX* wfeout = (WAVEFORMATEX*)pOutPin->CurrentMediaType().pbFormat;
+ WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)wfe;
+ WAVEFORMATEXTENSIBLE* wfexout = (WAVEFORMATEXTENSIBLE*)wfeout;
+
+ int bps = wfe->wBitsPerSample>>3;
+
+ int len = pIn->GetActualDataLength() / (bps*wfe->nChannels);
+ int lenout = len * wfeout->nSamplesPerSec / wfe->nSamplesPerSec;
+
+ REFERENCE_TIME rtStart, rtStop;
+ if(SUCCEEDED(pIn->GetTime(&rtStart, &rtStop)))
+ {
+ rtStart += m_rtAudioTimeShift;
+ rtStop += m_rtAudioTimeShift;
+ pOut->SetTime(&rtStart, &rtStop);
+
+ m_rtNextStart = rtStart;
+ m_rtNextStop = rtStop;
+ }
+ else
+ {
+ pOut->SetTime(&m_rtNextStart, &m_rtNextStop);
+ }
+
+ REFERENCE_TIME rtDur = 10000000i64*len/wfe->nSamplesPerSec;
+
+ m_rtNextStart += rtDur;
+ m_rtNextStop += rtDur;
+
+ if(pIn->IsDiscontinuity() == S_OK)
+ {
+ m_sample_max = 0.1f;
+ }
+
+ WORD tag = wfe->wFormatTag;
+ bool fPCM = tag == WAVE_FORMAT_PCM || tag == WAVE_FORMAT_EXTENSIBLE && wfex->SubFormat == KSDATAFORMAT_SUBTYPE_PCM;
+ bool fFloat = tag == WAVE_FORMAT_IEEE_FLOAT || tag == WAVE_FORMAT_EXTENSIBLE && wfex->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+ if(!fPCM && !fFloat) return __super::Transform(pIn, pOut);
+
+ BYTE* pDataIn = NULL;
+ BYTE* pDataOut = NULL;
+
+ HRESULT hr;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut))) return hr;
+
+ if(!pDataIn || !pDataOut || len <= 0 || lenout <= 0) return S_FALSE;
+
+ memset(pDataOut, 0, pOut->GetSize());
+
+ if(m_fCustomChannelMapping)
+ {
+ if(m_chs[wfe->nChannels-1].GetCount() > 0)
+ {
+ for(int i = 0; i < wfeout->nChannels; i++)
+ {
+ DWORD mask = m_chs[wfe->nChannels-1][i].Channel;
+
+ BYTE* src = pDataIn;
+ BYTE* dst = &pDataOut[bps*i];
+
+ int srcstep = bps*wfe->nChannels;
+ int dststep = bps*wfeout->nChannels;
+
+ if(fPCM && wfe->wBitsPerSample == 8)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<unsigned char, INT64, 0, UCHAR_MAX>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fPCM && wfe->wBitsPerSample == 16)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<short, INT64, SHRT_MIN, SHRT_MAX>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fPCM && wfe->wBitsPerSample == 24)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<int, INT64, (-1<<24), (+1<<24)-1>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fPCM && wfe->wBitsPerSample == 32)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<int, __int64, INT_MIN, INT_MAX>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fFloat && wfe->wBitsPerSample == 32)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<float, double, -1, 1>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ else if(fFloat && wfe->wBitsPerSample == 64)
+ {
+ for(int k = 0; k < len; k++, src += srcstep, dst += dststep)
+ {
+ mix<double, double, -1, 1>(mask, wfe->nChannels, bps, src, dst);
+ }
+ }
+ }
+ }
+ else
+ {
+ BYTE* pDataOut = NULL;
+ HRESULT hr;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut)) || !pDataOut) return hr;
+ memset(pDataOut, 0, pOut->GetSize());
+ }
+ }
+ else
+ {
+ HRESULT hr;
+ if(S_OK != (hr = __super::Transform(pIn, pOut)))
+ return hr;
+ }
+
+ if(m_fDownSampleTo441
+ && wfe->nSamplesPerSec > 44100 && wfeout->nSamplesPerSec == 44100
+ && wfe->wBitsPerSample <= 16 && fPCM)
+ {
+ if(BYTE* buff = new BYTE[len*bps])
+ {
+ for(int ch = 0; ch < wfeout->nChannels; ch++)
+ {
+ memset(buff, 0, len*bps);
+
+ for(int i = 0; i < len; i++)
+ memcpy(buff + i*bps, (char*)pDataOut + (ch + i*wfeout->nChannels)*bps, bps);
+
+ m_pResamplers[ch]->Downsample(buff, len, buff, lenout);
+
+ for(int i = 0; i < lenout; i++)
+ memcpy((char*)pDataOut + (ch + i*wfeout->nChannels)*bps, buff + i*bps, bps);
+ }
+
+ delete [] buff;
+ }
+ }
+
+ if(m_fNormalize || m_boost > 1)
+ {
+ int samples = lenout*wfeout->nChannels;
+
+ if(double* buff = new double[samples])
+ {
+ for(int i = 0; i < samples; i++)
+ {
+ if(fPCM && wfe->wBitsPerSample == 8) buff[i] = (double)((BYTE*)pDataOut)[i] / UCHAR_MAX;
+ else if(fPCM && wfe->wBitsPerSample == 16) buff[i] = (double)((short*)pDataOut)[i] / SHRT_MAX;
+ else if(fPCM && wfe->wBitsPerSample == 24) {int tmp; memcpy(((BYTE*)&tmp)+1, &pDataOut[i*3], 3); buff[i] = (float)(tmp >> 8) / ((1<<23)-1);}
+ else if(fPCM && wfe->wBitsPerSample == 32) buff[i] = (double)((int*)pDataOut)[i] / INT_MAX;
+ else if(fFloat && wfe->wBitsPerSample == 32) buff[i] = (double)((float*)pDataOut)[i];
+ else if(fFloat && wfe->wBitsPerSample == 64) buff[i] = ((double*)pDataOut)[i];
+ }
+
+ double sample_mul = 1;
+
+ if(m_fNormalize)
+ {
+ for(int i = 0; i < samples; i++)
+ {
+ double s = buff[i];
+ if(s < 0) s = -s;
+ if(s > 1) s = 1;
+ if(m_sample_max < s) m_sample_max = s;
+ }
+
+ sample_mul = 1.0f / m_sample_max;
+
+ if(m_fNormalizeRecover) m_sample_max -= 1.0*rtDur/200000000; // -5%/sec
+ if(m_sample_max < 0.1) m_sample_max = 0.1;
+ }
+
+ if(m_boost > 1)
+ {
+ sample_mul *= (1+log10(m_boost));
+ }
+
+ for(int i = 0; i < samples; i++)
+ {
+ double s = buff[i] * sample_mul;
+
+ if(fPCM && wfe->wBitsPerSample == 8) ((BYTE*)pDataOut)[i] = clamp<BYTE>(s, 0, UCHAR_MAX);
+ else if(fPCM && wfe->wBitsPerSample == 16) ((short*)pDataOut)[i] = clamp<short>(s, SHRT_MIN, SHRT_MAX);
+ else if(fPCM && wfe->wBitsPerSample == 24) {int tmp = clamp<int>(s, -1<<23, (1<<23)-1); memcpy(&pDataOut[i*3], &tmp, 3);}
+ else if(fPCM && wfe->wBitsPerSample == 32) ((int*)pDataOut)[i] = clamp<int>(s, INT_MIN, INT_MAX);
+ else if(fFloat && wfe->wBitsPerSample == 32) ((float*)pDataOut)[i] = clamp<float>(s, -1, +1);
+ else if(fFloat && wfe->wBitsPerSample == 64) ((double*)pDataOut)[i] = clamp<double>(s, -1, +1);
+ }
+
+ delete buff;
+ }
+ }
+
+ pOut->SetActualDataLength(lenout*bps*wfeout->nChannels);
+
+ return S_OK;
+}
+
+CMediaType CAudioSwitcherFilter::CreateNewOutputMediaType(CMediaType mt, long& cbBuffer)
+{
+ CStreamSwitcherInputPin* pInPin = GetInputPin();
+ CStreamSwitcherOutputPin* pOutPin = GetOutputPin();
+ if(!pInPin || !pOutPin || ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3_SPDIF)
+ return __super::CreateNewOutputMediaType(mt, cbBuffer);
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
+
+ if(m_fCustomChannelMapping)
+ {
+ m_chs[wfe->nChannels-1].RemoveAll();
+
+ DWORD mask = DWORD((__int64(1)<<wfe->nChannels)-1);
+ for(int i = 0; i < 18; i++)
+ {
+ if(m_pSpeakerToChannelMap[wfe->nChannels-1][i]&mask)
+ {
+ ChMap cm = {1<<i, m_pSpeakerToChannelMap[wfe->nChannels-1][i]};
+ m_chs[wfe->nChannels-1].Add(cm);
+ }
+ }
+
+ if(m_chs[wfe->nChannels-1].GetCount() > 0)
+ {
+ mt.ReallocFormatBuffer(sizeof(WAVEFORMATEXTENSIBLE));
+ WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)mt.pbFormat;
+ wfex->Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
+ wfex->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+ wfex->Samples.wValidBitsPerSample = wfe->wBitsPerSample;
+ wfex->SubFormat =
+ wfe->wFormatTag == WAVE_FORMAT_PCM ? KSDATAFORMAT_SUBTYPE_PCM :
+ wfe->wFormatTag == WAVE_FORMAT_IEEE_FLOAT ? KSDATAFORMAT_SUBTYPE_IEEE_FLOAT :
+ wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE ? ((WAVEFORMATEXTENSIBLE*)wfe)->SubFormat :
+ KSDATAFORMAT_SUBTYPE_PCM; // can't happen
+
+ wfex->dwChannelMask = 0;
+ for(int i = 0; i < m_chs[wfe->nChannels-1].GetCount(); i++)
+ wfex->dwChannelMask |= m_chs[wfe->nChannels-1][i].Speaker;
+
+ wfex->Format.nChannels = (WORD)m_chs[wfe->nChannels-1].GetCount();
+ wfex->Format.nBlockAlign = wfex->Format.nChannels*wfex->Format.wBitsPerSample>>3;
+ wfex->Format.nAvgBytesPerSec = wfex->Format.nBlockAlign*wfex->Format.nSamplesPerSec;
+ }
+ }
+
+ WAVEFORMATEX* wfeout = (WAVEFORMATEX*)mt.pbFormat;
+
+ if(m_fDownSampleTo441)
+ {
+ if(wfeout->nSamplesPerSec > 44100 && wfeout->wBitsPerSample <= 16)
+ {
+ wfeout->nSamplesPerSec = 44100;
+ wfeout->nAvgBytesPerSec = wfeout->nBlockAlign*wfeout->nSamplesPerSec;
+ }
+ }
+
+ int bps = wfe->wBitsPerSample>>3;
+ int len = cbBuffer / (bps*wfe->nChannels);
+ int lenout = len * wfeout->nSamplesPerSec / wfe->nSamplesPerSec;
+ cbBuffer = lenout*bps*wfeout->nChannels;
+
+// mt.lSampleSize = (ULONG)max(mt.lSampleSize, wfe->nAvgBytesPerSec * rtLen / 10000000i64);
+// mt.lSampleSize = (mt.lSampleSize + (wfe->nBlockAlign-1)) & ~(wfe->nBlockAlign-1);
+
+ return mt;
+}
+
+void CAudioSwitcherFilter::OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut)
+{
+ const WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn.pbFormat;
+ const WAVEFORMATEX* wfeout = (WAVEFORMATEX*)mtOut.pbFormat;
+
+ m_pResamplers.RemoveAll();
+ for(int i = 0; i < wfeout->nChannels; i++)
+ {
+ CAutoPtr<AudioStreamResampler> pResampler;
+ pResampler.Attach(new AudioStreamResampler(wfeout->wBitsPerSample>>3, wfe->nSamplesPerSec, wfeout->nSamplesPerSec, true));
+ m_pResamplers.Add(pResampler);
+ }
+
+ TRACE(_T("CAudioSwitcherFilter::OnNewOutputMediaType\n"));
+ m_sample_max = 0.1f;
+}
+
+HRESULT CAudioSwitcherFilter::DeliverEndFlush()
+{
+ TRACE(_T("CAudioSwitcherFilter::DeliverEndFlush\n"));
+ m_sample_max = 0.1f;
+ return __super::DeliverEndFlush();
+}
+
+HRESULT CAudioSwitcherFilter::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ TRACE(_T("CAudioSwitcherFilter::DeliverNewSegment\n"));
+ m_sample_max = 0.1f;
+ return __super::DeliverNewSegment(tStart, tStop, dRate);
+}
+
+// IAudioSwitcherFilter
+
+STDMETHODIMP CAudioSwitcherFilter::GetInputSpeakerConfig(DWORD* pdwChannelMask)
+{
+ if(!pdwChannelMask)
+ return E_POINTER;
+
+ *pdwChannelMask = 0;
+
+ CStreamSwitcherInputPin* pInPin = GetInputPin();
+ if(!pInPin || !pInPin->IsConnected())
+ return E_UNEXPECTED;
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat;
+
+ if(wfe->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
+ {
+ WAVEFORMATEXTENSIBLE* wfex = (WAVEFORMATEXTENSIBLE*)wfe;
+ *pdwChannelMask = wfex->dwChannelMask;
+ }
+ else
+ {
+ *pdwChannelMask = 0/*wfe->nChannels == 1 ? 4 : wfe->nChannels == 2 ? 3 : 0*/;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CAudioSwitcherFilter::GetSpeakerConfig(bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18])
+{
+ if(pfCustomChannelMapping) *pfCustomChannelMapping = m_fCustomChannelMapping;
+ memcpy(pSpeakerToChannelMap, m_pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap));
+
+ return S_OK;
+}
+
+STDMETHODIMP CAudioSwitcherFilter::SetSpeakerConfig(bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18])
+{
+ if(m_State == State_Stopped || m_fCustomChannelMapping != fCustomChannelMapping
+ || memcmp(m_pSpeakerToChannelMap, pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap)))
+ {
+ PauseGraph;
+
+ CStreamSwitcherInputPin* pInput = GetInputPin();
+
+ SelectInput(NULL);
+
+ m_fCustomChannelMapping = fCustomChannelMapping;
+ memcpy(m_pSpeakerToChannelMap, pSpeakerToChannelMap, sizeof(m_pSpeakerToChannelMap));
+
+ SelectInput(pInput);
+
+ ResumeGraph;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP_(int) CAudioSwitcherFilter::GetNumberOfInputChannels()
+{
+ CStreamSwitcherInputPin* pInPin = GetInputPin();
+ return pInPin ? ((WAVEFORMATEX*)pInPin->CurrentMediaType().pbFormat)->nChannels : 0;
+}
+
+STDMETHODIMP_(bool) CAudioSwitcherFilter::IsDownSamplingTo441Enabled()
+{
+ return m_fDownSampleTo441;
+}
+
+STDMETHODIMP CAudioSwitcherFilter::EnableDownSamplingTo441(bool fEnable)
+{
+ if(m_fDownSampleTo441 != fEnable)
+ {
+ PauseGraph;
+ m_fDownSampleTo441 = fEnable;
+ ResumeGraph;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CAudioSwitcherFilter::GetAudioTimeShift()
+{
+ return m_rtAudioTimeShift;
+}
+
+STDMETHODIMP CAudioSwitcherFilter::SetAudioTimeShift(REFERENCE_TIME rtAudioTimeShift)
+{
+ m_rtAudioTimeShift = rtAudioTimeShift;
+ return S_OK;
+}
+
+STDMETHODIMP CAudioSwitcherFilter::GetNormalizeBoost(bool& fNormalize, bool& fNormalizeRecover, float& boost)
+{
+ fNormalize = m_fNormalize;
+ fNormalizeRecover = m_fNormalizeRecover;
+ boost = m_boost;
+ return S_OK;
+}
+
+STDMETHODIMP CAudioSwitcherFilter::SetNormalizeBoost(bool fNormalize, bool fNormalizeRecover, float boost)
+{
+ if(m_fNormalize != fNormalize) m_sample_max = 0.1f;
+ m_fNormalize = fNormalize;
+ m_fNormalizeRecover = fNormalizeRecover;
+ m_boost = boost;
+ return S_OK;
+}
+
+// IAMStreamSelect
+
+STDMETHODIMP CAudioSwitcherFilter::Enable(long lIndex, DWORD dwFlags)
+{
+ HRESULT hr = __super::Enable(lIndex, dwFlags);
+ if(S_OK == hr) m_sample_max = 0.1f;
+ return hr;
+} \ No newline at end of file
diff --git a/src/filters/switcher/audioswitcher/AudioSwitcher.def b/src/filters/switcher/audioswitcher/AudioSwitcher.def
new file mode 100644
index 000000000..c17ba99d2
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/AudioSwitcher.def
@@ -0,0 +1,7 @@
+LIBRARY "AudioSwitcher.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/switcher/audioswitcher/AudioSwitcher.h b/src/filters/switcher/audioswitcher/AudioSwitcher.h
new file mode 100644
index 000000000..bef3a11c8
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/AudioSwitcher.h
@@ -0,0 +1,85 @@
+// Copyright 2003 Gabest.
+// http://www.gabest.org
+//
+// 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; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
+// http://www.gnu.org/copyleft/gpl.html
+
+#pragma once
+
+#include "StreamSwitcher.h"
+
+[uuid("CEDB2890-53AE-4231-91A3-B0AAFCD1DBDE")]
+interface IAudioSwitcherFilter : public IUnknown
+{
+ STDMETHOD(GetInputSpeakerConfig) (DWORD* pdwChannelMask) = 0;
+ STDMETHOD(GetSpeakerConfig) (bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]) = 0;
+ STDMETHOD(SetSpeakerConfig) (bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]) = 0;
+ STDMETHOD_(int, GetNumberOfInputChannels) () = 0;
+ STDMETHOD_(bool, IsDownSamplingTo441Enabled) () = 0;
+ STDMETHOD(EnableDownSamplingTo441) (bool fEnable) = 0;
+ STDMETHOD_(REFERENCE_TIME, GetAudioTimeShift) () = 0;
+ STDMETHOD(SetAudioTimeShift) (REFERENCE_TIME rtAudioTimeShift) = 0;
+ STDMETHOD(GetNormalizeBoost) (bool& fNormalize, bool& fNormalizeRecover, float& boost) = 0;
+ STDMETHOD(SetNormalizeBoost) (bool fNormalize, bool fNormalizeRecover, float boost) = 0;
+};
+
+class AudioStreamResampler;
+
+[uuid("18C16B08-6497-420e-AD14-22D21C2CEAB7")]
+class CAudioSwitcherFilter : public CStreamSwitcherFilter, public IAudioSwitcherFilter
+{
+ typedef struct {DWORD Speaker, Channel;} ChMap;
+ CAtlArray<ChMap> m_chs[18];
+
+ bool m_fCustomChannelMapping;
+ DWORD m_pSpeakerToChannelMap[18][18];
+ bool m_fDownSampleTo441;
+ REFERENCE_TIME m_rtAudioTimeShift;
+ CAutoPtrArray<AudioStreamResampler> m_pResamplers;
+ double m_sample_max;
+ bool m_fNormalize, m_fNormalizeRecover;
+ float m_boost;
+
+ REFERENCE_TIME m_rtNextStart, m_rtNextStop;
+
+public:
+ CAudioSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ CMediaType CreateNewOutputMediaType(CMediaType mt, long& cbBuffer);
+ void OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut);
+
+ HRESULT DeliverEndFlush();
+ HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+ // IAudioSwitcherFilter
+ STDMETHODIMP GetInputSpeakerConfig(DWORD* pdwChannelMask);
+ STDMETHODIMP GetSpeakerConfig(bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]);
+ STDMETHODIMP SetSpeakerConfig(bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]);
+ STDMETHODIMP_(int) GetNumberOfInputChannels();
+ STDMETHODIMP_(bool) IsDownSamplingTo441Enabled();
+ STDMETHODIMP EnableDownSamplingTo441(bool fEnable);
+ STDMETHODIMP_(REFERENCE_TIME) GetAudioTimeShift();
+ STDMETHODIMP SetAudioTimeShift(REFERENCE_TIME rtAudioTimeShift);
+ STDMETHODIMP GetNormalizeBoost(bool& fNormalize, bool& fNormalizeRecover, float& boost);
+ STDMETHODIMP SetNormalizeBoost(bool fNormalize, bool fNormalizeRecover, float boost);
+
+ // IAMStreamSelect
+ STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
+};
diff --git a/src/filters/switcher/audioswitcher/StreamSwitcher.cpp b/src/filters/switcher/audioswitcher/StreamSwitcher.cpp
new file mode 100644
index 000000000..a470059b9
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/StreamSwitcher.cpp
@@ -0,0 +1,1295 @@
+// Copyright 2003 Gabest.
+// http://www.gabest.org
+//
+// 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; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
+// http://www.gnu.org/copyleft/gpl.html
+
+#include "StdAfx.h"
+#include "StreamSwitcher.h"
+
+#include "Shlwapi.h"
+#include <atlpath.h>
+#include <mmreg.h>
+#include <ks.h>
+#include <ksmedia.h>
+#include "AudioSwitcher.h"
+#include "Audio.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#define BLOCKSTREAM
+
+//
+// CStreamSwitcherPassThru
+//
+
+CStreamSwitcherPassThru::CStreamSwitcherPassThru(LPUNKNOWN pUnk, HRESULT* phr, CStreamSwitcherFilter* pFilter)
+ : CMediaPosition(NAME("CStreamSwitcherPassThru"), pUnk)
+ , m_pFilter(pFilter)
+{
+}
+
+STDMETHODIMP CStreamSwitcherPassThru::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+ *ppv = NULL;
+
+ return
+ QI(IMediaSeeking)
+ CMediaPosition::NonDelegatingQueryInterface(riid, ppv);
+}
+
+template<class T>
+HRESULT GetPeer(CStreamSwitcherFilter* pFilter, T** ppT)
+{
+ *ppT = NULL;
+
+ CBasePin* pPin = pFilter->GetInputPin();
+ if(!pPin) return E_NOTIMPL;
+
+ CComPtr<IPin> pConnected;
+ if(FAILED(pPin->ConnectedTo(&pConnected)))
+ return E_NOTIMPL;
+
+ if(CComQIPtr<T> pT = pConnected)
+ {
+ *ppT = pT.Detach();
+ return S_OK;
+ }
+
+ return E_NOTIMPL;
+}
+
+#define CallPeerSeeking(call) \
+ CComPtr<IMediaSeeking> pMS; \
+ if(FAILED(GetPeer(m_pFilter, &pMS))) return E_NOTIMPL; \
+ return pMS->##call; \
+
+#define CallPeer(call) \
+ CComPtr<IMediaPosition> pMP; \
+ if(FAILED(GetPeer(m_pFilter, &pMP))) return E_NOTIMPL; \
+ return pMP->##call; \
+
+#define CallPeerSeekingAll(call) \
+ HRESULT hr = E_NOTIMPL; \
+ POSITION pos = m_pFilter->m_pInputs.GetHeadPosition(); \
+ while(pos) \
+ { \
+ CBasePin* pPin = m_pFilter->m_pInputs.GetNext(pos); \
+ CComPtr<IPin> pConnected; \
+ if(FAILED(pPin->ConnectedTo(&pConnected))) \
+ continue; \
+ if(CComQIPtr<IMediaSeeking> pMS = pConnected) \
+ { \
+ HRESULT hr2 = pMS->call; \
+ if(pPin == m_pFilter->GetInputPin()) \
+ hr = hr2; \
+ } \
+ } \
+ return hr; \
+
+#define CallPeerAll(call) \
+ HRESULT hr = E_NOTIMPL; \
+ POSITION pos = m_pFilter->m_pInputs.GetHeadPosition(); \
+ while(pos) \
+ { \
+ CBasePin* pPin = m_pFilter->m_pInputs.GetNext(pos); \
+ CComPtr<IPin> pConnected; \
+ if(FAILED(pPin->ConnectedTo(&pConnected))) \
+ continue; \
+ if(CComQIPtr<IMediaPosition> pMP = pConnected) \
+ { \
+ HRESULT hr2 = pMP->call; \
+ if(pPin == m_pFilter->GetInputPin()) \
+ hr = hr2; \
+ } \
+ } \
+ return hr; \
+
+
+// IMediaSeeking
+
+STDMETHODIMP CStreamSwitcherPassThru::GetCapabilities(DWORD* pCaps)
+ {CallPeerSeeking(GetCapabilities(pCaps));}
+STDMETHODIMP CStreamSwitcherPassThru::CheckCapabilities(DWORD* pCaps)
+ {CallPeerSeeking(CheckCapabilities(pCaps));}
+STDMETHODIMP CStreamSwitcherPassThru::IsFormatSupported(const GUID* pFormat)
+ {CallPeerSeeking(IsFormatSupported(pFormat));}
+STDMETHODIMP CStreamSwitcherPassThru::QueryPreferredFormat(GUID* pFormat)
+ {CallPeerSeeking(QueryPreferredFormat(pFormat));}
+STDMETHODIMP CStreamSwitcherPassThru::SetTimeFormat(const GUID* pFormat)
+ {CallPeerSeeking(SetTimeFormat(pFormat));}
+STDMETHODIMP CStreamSwitcherPassThru::GetTimeFormat(GUID* pFormat)
+ {CallPeerSeeking(GetTimeFormat(pFormat));}
+STDMETHODIMP CStreamSwitcherPassThru::IsUsingTimeFormat(const GUID* pFormat)
+ {CallPeerSeeking(IsUsingTimeFormat(pFormat));}
+STDMETHODIMP CStreamSwitcherPassThru::ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat)
+ {CallPeerSeeking(ConvertTimeFormat(pTarget, pTargetFormat, Source, pSourceFormat));}
+STDMETHODIMP CStreamSwitcherPassThru::SetPositions(LONGLONG* pCurrent, DWORD CurrentFlags, LONGLONG* pStop, DWORD StopFlags)
+ {CallPeerSeekingAll(SetPositions(pCurrent, CurrentFlags, pStop, StopFlags));}
+STDMETHODIMP CStreamSwitcherPassThru::GetPositions(LONGLONG* pCurrent, LONGLONG* pStop)
+ {CallPeerSeeking(GetPositions(pCurrent, pStop));}
+STDMETHODIMP CStreamSwitcherPassThru::GetCurrentPosition(LONGLONG* pCurrent)
+ {CallPeerSeeking(GetCurrentPosition(pCurrent));}
+STDMETHODIMP CStreamSwitcherPassThru::GetStopPosition(LONGLONG* pStop)
+ {CallPeerSeeking(GetStopPosition(pStop));}
+STDMETHODIMP CStreamSwitcherPassThru::GetDuration(LONGLONG* pDuration)
+ {CallPeerSeeking(GetDuration(pDuration));}
+STDMETHODIMP CStreamSwitcherPassThru::GetPreroll(LONGLONG* pllPreroll)
+ {CallPeerSeeking(GetPreroll(pllPreroll));}
+STDMETHODIMP CStreamSwitcherPassThru::GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest)
+ {CallPeerSeeking(GetAvailable(pEarliest, pLatest));}
+STDMETHODIMP CStreamSwitcherPassThru::GetRate(double* pdRate)
+ {CallPeerSeeking(GetRate(pdRate));}
+STDMETHODIMP CStreamSwitcherPassThru::SetRate(double dRate)
+ {if(0.0 == dRate) return E_INVALIDARG;
+ CallPeerSeekingAll(SetRate(dRate));}
+
+// IMediaPosition
+
+STDMETHODIMP CStreamSwitcherPassThru::get_Duration(REFTIME* plength)
+ {CallPeer(get_Duration(plength));}
+STDMETHODIMP CStreamSwitcherPassThru::get_CurrentPosition(REFTIME* pllTime)
+ {CallPeer(get_CurrentPosition(pllTime));}
+STDMETHODIMP CStreamSwitcherPassThru::put_CurrentPosition(REFTIME llTime)
+ {CallPeerAll(put_CurrentPosition(llTime));}
+STDMETHODIMP CStreamSwitcherPassThru::get_StopTime(REFTIME* pllTime)
+ {CallPeer(get_StopTime(pllTime));}
+STDMETHODIMP CStreamSwitcherPassThru::put_StopTime(REFTIME llTime)
+ {CallPeerAll(put_StopTime(llTime));}
+STDMETHODIMP CStreamSwitcherPassThru::get_PrerollTime(REFTIME * pllTime)
+ {CallPeer(get_PrerollTime(pllTime));}
+STDMETHODIMP CStreamSwitcherPassThru::put_PrerollTime(REFTIME llTime)
+ {CallPeerAll(put_PrerollTime(llTime));}
+STDMETHODIMP CStreamSwitcherPassThru::get_Rate(double* pdRate)
+ {CallPeer(get_Rate(pdRate));}
+STDMETHODIMP CStreamSwitcherPassThru::put_Rate(double dRate)
+ {if(0.0 == dRate) return E_INVALIDARG;
+ CallPeerAll(put_Rate(dRate));}
+STDMETHODIMP CStreamSwitcherPassThru::CanSeekForward(LONG* pCanSeekForward)
+ {CallPeer(CanSeekForward(pCanSeekForward));}
+STDMETHODIMP CStreamSwitcherPassThru::CanSeekBackward(LONG* pCanSeekBackward)
+ {CallPeer(CanSeekBackward(pCanSeekBackward));}
+
+//
+// CStreamSwitcherAllocator
+//
+
+CStreamSwitcherAllocator::CStreamSwitcherAllocator(CStreamSwitcherInputPin* pPin, HRESULT* phr)
+ : CMemAllocator(NAME("CStreamSwitcherAllocator"), NULL, phr)
+ , m_pPin(pPin)
+ , m_fMediaTypeChanged(false)
+{
+ ASSERT(phr);
+ ASSERT(pPin);
+}
+
+#ifdef DEBUG
+CStreamSwitcherAllocator::~CStreamSwitcherAllocator()
+{
+ ASSERT(m_bCommitted == FALSE);
+}
+#endif
+
+STDMETHODIMP_(ULONG) CStreamSwitcherAllocator::NonDelegatingAddRef()
+{
+ return m_pPin->m_pFilter->AddRef();
+}
+
+STDMETHODIMP_(ULONG) CStreamSwitcherAllocator::NonDelegatingRelease()
+{
+ return m_pPin->m_pFilter->Release();
+}
+
+STDMETHODIMP CStreamSwitcherAllocator::GetBuffer(
+ IMediaSample** ppBuffer,
+ REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime,
+ DWORD dwFlags)
+{
+ HRESULT hr = VFW_E_NOT_COMMITTED;
+
+ if(!m_bCommitted)
+ return hr;
+/*
+TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() + %x\n"), this);
+ m_pPin->m_evBlock.Wait();
+TRACE(_T("CStreamSwitcherAllocator::GetBuffer m_pPin->m_evBlock.Wait() - %x\n"), this);
+*/
+ if(m_fMediaTypeChanged)
+ {
+ if(!m_pPin || !m_pPin->m_pFilter)
+ return hr;
+
+ CStreamSwitcherOutputPin* pOut = ((CStreamSwitcherFilter*)m_pPin->m_pFilter)->GetOutputPin();
+ if(!pOut || !pOut->CurrentAllocator())
+ return hr;
+
+ ALLOCATOR_PROPERTIES Properties, Actual;
+ if(FAILED(pOut->CurrentAllocator()->GetProperties(&Actual)))
+ return hr;
+ if(FAILED(GetProperties(&Properties)))
+ return hr;
+
+ if(!m_bCommitted || Properties.cbBuffer < Actual.cbBuffer)
+ {
+ Properties.cbBuffer = Actual.cbBuffer;
+ if(FAILED(Decommit())) return hr;
+ if(FAILED(SetProperties(&Properties, &Actual))) return hr;
+ if(FAILED(Commit())) return hr;
+ ASSERT(Actual.cbBuffer >= Properties.cbBuffer);
+ if(Actual.cbBuffer < Properties.cbBuffer) return hr;
+ }
+ }
+
+ hr = CMemAllocator::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags);
+
+ if(m_fMediaTypeChanged && SUCCEEDED(hr))
+ {
+ (*ppBuffer)->SetMediaType(&m_mt);
+ m_fMediaTypeChanged = false;
+ }
+
+ return hr;
+}
+
+void CStreamSwitcherAllocator::NotifyMediaType(const CMediaType& mt)
+{
+ CopyMediaType(&m_mt, &mt);
+ m_fMediaTypeChanged = true;
+}
+
+
+//
+// CStreamSwitcherInputPin
+//
+
+CStreamSwitcherInputPin::CStreamSwitcherInputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr, LPCWSTR pName)
+ : CBaseInputPin(NAME("CStreamSwitcherInputPin"), pFilter, &pFilter->m_csState, phr, pName)
+ , m_Allocator(this, phr)
+ , m_bSampleSkipped(FALSE)
+ , m_bQualityChanged(FALSE)
+ , m_bUsingOwnAllocator(FALSE)
+ , m_evBlock(TRUE)
+ , m_fCanBlock(false)
+ , m_hNotifyEvent(NULL)
+{
+ m_bCanReconnectWhenActive = TRUE;
+}
+
+[uuid("138130AF-A79B-45D5-B4AA-87697457BA87")]
+class NeroAudioDecoder {};
+
+STDMETHODIMP CStreamSwitcherInputPin::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(IStreamSwitcherInputPin)
+ IsConnected() && GetCLSID(GetFilterFromPin(GetConnected())) == __uuidof(NeroAudioDecoder) && QI(IPinConnection)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IPinConnection
+
+STDMETHODIMP CStreamSwitcherInputPin::DynamicQueryAccept(const AM_MEDIA_TYPE* pmt)
+{
+ return QueryAccept(pmt);
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::NotifyEndOfStream(HANDLE hNotifyEvent)
+{
+ if(m_hNotifyEvent) SetEvent(m_hNotifyEvent);
+ m_hNotifyEvent = hNotifyEvent;
+ return S_OK;
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::IsEndPin()
+{
+ return S_OK;
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::DynamicDisconnect()
+{
+ CAutoLock cAutoLock(&m_csReceive);
+ Disconnect();
+ return S_OK;
+}
+
+// IStreamSwitcherInputPin
+
+STDMETHODIMP_(bool) CStreamSwitcherInputPin::IsActive()
+{
+ // TODO: lock onto something here
+ return(this == ((CStreamSwitcherFilter*)m_pFilter)->GetInputPin());
+}
+
+//
+
+HRESULT CStreamSwitcherInputPin::QueryAcceptDownstream(const AM_MEDIA_TYPE* pmt)
+{
+ HRESULT hr = S_OK;
+
+ CStreamSwitcherOutputPin* pOut = ((CStreamSwitcherFilter*)m_pFilter)->GetOutputPin();
+
+ if(pOut && pOut->IsConnected())
+ {
+ if(CComPtr<IPinConnection> pPC = pOut->CurrentPinConnection())
+ {
+ hr = pPC->DynamicQueryAccept(pmt);
+ if(hr == S_OK) return S_OK;
+ }
+
+ hr = pOut->GetConnected()->QueryAccept(pmt);
+ }
+
+ return hr;
+}
+
+void CStreamSwitcherInputPin::Block(bool fBlock)
+{
+ if(fBlock) m_evBlock.Reset();
+ else m_evBlock.Set();
+}
+
+HRESULT CStreamSwitcherInputPin::InitializeOutputSample(IMediaSample* pInSample, IMediaSample** ppOutSample)
+{
+ if(!pInSample || !ppOutSample)
+ return E_POINTER;
+
+ CStreamSwitcherOutputPin* pOut = ((CStreamSwitcherFilter*)m_pFilter)->GetOutputPin();
+ ASSERT(pOut->GetConnected());
+
+ CComPtr<IMediaSample> pOutSample;
+
+ DWORD dwFlags = m_bSampleSkipped ? AM_GBF_PREVFRAMESKIPPED : 0;
+
+ if(!(m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT))
+ dwFlags |= AM_GBF_NOTASYNCPOINT;
+
+ HRESULT hr = pOut->GetDeliveryBuffer(&pOutSample
+ , m_SampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID ? &m_SampleProps.tStart : NULL
+ , m_SampleProps.dwSampleFlags & AM_SAMPLE_STOPVALID ? &m_SampleProps.tStop : NULL
+ , dwFlags);
+
+ if(FAILED(hr))
+ return hr;
+
+ if(!pOutSample)
+ return E_FAIL;
+
+ if(CComQIPtr<IMediaSample2> pOutSample2 = pOutSample)
+ {
+ AM_SAMPLE2_PROPERTIES OutProps;
+ EXECUTE_ASSERT(SUCCEEDED(pOutSample2->GetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, tStart), (PBYTE)&OutProps)));
+ OutProps.dwTypeSpecificFlags = m_SampleProps.dwTypeSpecificFlags;
+ OutProps.dwSampleFlags =
+ (OutProps.dwSampleFlags & AM_SAMPLE_TYPECHANGED) |
+ (m_SampleProps.dwSampleFlags & ~AM_SAMPLE_TYPECHANGED);
+
+ OutProps.tStart = m_SampleProps.tStart;
+ OutProps.tStop = m_SampleProps.tStop;
+ OutProps.cbData = FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId);
+
+ hr = pOutSample2->SetProperties(FIELD_OFFSET(AM_SAMPLE2_PROPERTIES, dwStreamId), (PBYTE)&OutProps);
+ if(m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY)
+ m_bSampleSkipped = FALSE;
+ }
+ else
+ {
+ if(m_SampleProps.dwSampleFlags & AM_SAMPLE_TIMEVALID)
+ pOutSample->SetTime(&m_SampleProps.tStart, &m_SampleProps.tStop);
+
+ if(m_SampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT)
+ pOutSample->SetSyncPoint(TRUE);
+
+ if(m_SampleProps.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY)
+ {
+ pOutSample->SetDiscontinuity(TRUE);
+ m_bSampleSkipped = FALSE;
+ }
+
+ LONGLONG MediaStart, MediaEnd;
+ if(pInSample->GetMediaTime(&MediaStart, &MediaEnd) == NOERROR)
+ pOutSample->SetMediaTime(&MediaStart, &MediaEnd);
+ }
+
+ *ppOutSample = pOutSample.Detach();
+
+ return S_OK;
+}
+
+// pure virtual
+
+HRESULT CStreamSwitcherInputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return ((CStreamSwitcherFilter*)m_pFilter)->CheckMediaType(pmt);
+}
+
+// virtual
+
+HRESULT CStreamSwitcherInputPin::CheckConnect(IPin* pPin)
+{
+ return (IPin*)((CStreamSwitcherFilter*)m_pFilter)->GetOutputPin() == pPin
+ ? E_FAIL
+ : __super::CheckConnect(pPin);
+}
+
+HRESULT CStreamSwitcherInputPin::CompleteConnect(IPin* pReceivePin)
+{
+ HRESULT hr = __super::CompleteConnect(pReceivePin);
+ if(FAILED(hr)) return hr;
+
+ ((CStreamSwitcherFilter*)m_pFilter)->CompleteConnect(PINDIR_INPUT, this, pReceivePin);
+
+ m_fCanBlock = false;
+ bool fForkedSomewhere = false;
+
+ CStringW fileName;
+ CStringW pinName;
+
+ IPin* pPin = (IPin*)this;
+ IBaseFilter* pBF = (IBaseFilter*)m_pFilter;
+
+ while((pPin = GetUpStreamPin(pBF, pPin)) && (pBF = GetFilterFromPin(pPin)))
+ {
+ if(IsSplitter(pBF))
+ {
+ pinName = GetPinName(pPin);
+ }
+
+ CLSID clsid = GetCLSID(pBF);
+ if(clsid == CLSID_AviSplitter || clsid == CLSID_OggSplitter)
+ m_fCanBlock = true;
+
+ int nIn, nOut, nInC, nOutC;
+ CountPins(pBF, nIn, nOut, nInC, nOutC);
+ fForkedSomewhere = fForkedSomewhere || nIn > 1 || nOut > 1;
+
+ if(CComQIPtr<IFileSourceFilter> pFSF = pBF)
+ {
+ WCHAR* pszName = NULL;
+ AM_MEDIA_TYPE mt;
+ if(SUCCEEDED(pFSF->GetCurFile(&pszName, &mt)) && pszName)
+ {
+ fileName = pszName;
+ CoTaskMemFree(pszName);
+
+ fileName.Replace('\\', '/');
+ CStringW fn = fileName.Mid(fileName.ReverseFind('/')+1);
+ if(!fn.IsEmpty()) fileName = fn;
+
+ if(!pinName.IsEmpty()) fileName += L" / " + pinName;
+
+ WCHAR* pName = new WCHAR[fileName.GetLength()+1];
+ if(pName)
+ {
+ wcscpy(pName, fileName);
+ if(m_pName) delete [] m_pName;
+ m_pName = pName;
+ }
+ }
+
+ break;
+ }
+
+ pPin = GetFirstPin(pBF);
+ }
+
+ if(!fForkedSomewhere)
+ m_fCanBlock = true;
+
+ m_hNotifyEvent = NULL;
+
+ return S_OK;
+}
+
+HRESULT CStreamSwitcherInputPin::Active()
+{
+ Block(!IsActive());
+
+ return __super::Active();
+}
+
+HRESULT CStreamSwitcherInputPin::Inactive()
+{
+ Block(false);
+
+ return __super::Inactive();
+}
+
+// IPin
+
+STDMETHODIMP CStreamSwitcherInputPin::QueryAccept(const AM_MEDIA_TYPE* pmt)
+{
+ HRESULT hr = __super::QueryAccept(pmt);
+ if(S_OK != hr) return hr;
+
+ return QueryAcceptDownstream(pmt);
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt)
+{
+ // FIXME: this locked up once
+// CAutoLock cAutoLock(&((CStreamSwitcherFilter*)m_pFilter)->m_csReceive);
+
+ HRESULT hr;
+ if(S_OK != (hr = QueryAcceptDownstream(pmt)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(m_Connected && m_Connected != pConnector)
+ return VFW_E_ALREADY_CONNECTED;
+
+ if(m_Connected)
+ m_Connected->Release(), m_Connected = NULL;
+
+ return SUCCEEDED(__super::ReceiveConnection(pConnector, pmt)) ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::GetAllocator(IMemAllocator** ppAllocator)
+{
+ CheckPointer(ppAllocator, E_POINTER);
+
+ if(m_pAllocator == NULL)
+ {
+ (m_pAllocator = &m_Allocator)->AddRef();
+ }
+
+ (*ppAllocator = m_pAllocator)->AddRef();
+
+ return NOERROR;
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::NotifyAllocator(IMemAllocator* pAllocator, BOOL bReadOnly)
+{
+ HRESULT hr = __super::NotifyAllocator(pAllocator, bReadOnly);
+ if(FAILED(hr)) return hr;
+
+ m_bUsingOwnAllocator = (pAllocator == (IMemAllocator*)&m_Allocator);
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::BeginFlush()
+{
+ CAutoLock cAutoLock(&((CStreamSwitcherFilter*)m_pFilter)->m_csState);
+
+ HRESULT hr;
+
+ CStreamSwitcherFilter* pSSF = (CStreamSwitcherFilter*)m_pFilter;
+
+ CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
+ if(!IsConnected() || !pOut || !pOut->IsConnected())
+ return VFW_E_NOT_CONNECTED;
+
+ if(FAILED(hr = __super::BeginFlush()))
+ return hr;
+
+ return IsActive() ? pSSF->DeliverBeginFlush() : Block(false), S_OK;
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::EndFlush()
+{
+ CAutoLock cAutoLock(&((CStreamSwitcherFilter*)m_pFilter)->m_csState);
+
+ HRESULT hr;
+
+ CStreamSwitcherFilter* pSSF = (CStreamSwitcherFilter*)m_pFilter;
+
+ CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
+ if(!IsConnected() || !pOut || !pOut->IsConnected())
+ return VFW_E_NOT_CONNECTED;
+
+ if(FAILED(hr = __super::EndFlush()))
+ return hr;
+
+ return IsActive() ? pSSF->DeliverEndFlush() : Block(true), S_OK;
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::EndOfStream()
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ CStreamSwitcherFilter* pSSF = (CStreamSwitcherFilter*)m_pFilter;
+
+ CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
+ if(!IsConnected() || !pOut || !pOut->IsConnected())
+ return VFW_E_NOT_CONNECTED;
+
+ if(m_hNotifyEvent)
+ {
+ SetEvent(m_hNotifyEvent), m_hNotifyEvent = NULL;
+ return S_OK;
+ }
+
+ return IsActive() ? pSSF->DeliverEndOfStream() : S_OK;
+}
+
+// IMemInputPin
+
+STDMETHODIMP CStreamSwitcherInputPin::Receive(IMediaSample* pSample)
+{
+ AM_MEDIA_TYPE* pmt = NULL;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ const CMediaType mt(*pmt);
+ DeleteMediaType(pmt), pmt = NULL;
+ SetMediaType(&mt);
+ }
+
+ // DAMN!!!!!! this doesn't work if the stream we are blocking
+ // shares the same thread with another stream, mpeg splitters
+ // are usually like that. Our nicely built up multithreaded
+ // strategy is useless because of this, ARRRRRRGHHHHHH.
+
+#ifdef BLOCKSTREAM
+ if(m_fCanBlock)
+ m_evBlock.Wait();
+#endif
+
+ if(!IsActive())
+ {
+#ifdef BLOCKSTREAM
+ if(m_fCanBlock)
+ return S_FALSE;
+#endif
+
+ TRACE(_T("&^%$#@\n"));
+//Sleep(32);
+ return E_FAIL; // a stupid fix for this stupid problem
+ }
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ CStreamSwitcherOutputPin* pOut = ((CStreamSwitcherFilter*)m_pFilter)->GetOutputPin();
+ ASSERT(pOut->GetConnected());
+
+ HRESULT hr = __super::Receive(pSample);
+ if(S_OK != hr) return hr;
+
+ if(m_SampleProps.dwStreamId != AM_STREAM_MEDIA)
+ {
+ return pOut->Deliver(pSample);
+ }
+
+ //
+
+ ALLOCATOR_PROPERTIES props, actual;
+ hr = m_pAllocator->GetProperties(&props);
+ hr = pOut->CurrentAllocator()->GetProperties(&actual);
+
+ REFERENCE_TIME rtStart = 0, rtStop = 0;
+ if(S_OK == pSample->GetTime(&rtStart, &rtStop))
+ {
+ //
+ }
+
+ long cbBuffer = pSample->GetActualDataLength();
+
+ CMediaType mtOut = m_mt;
+ mtOut = ((CStreamSwitcherFilter*)m_pFilter)->CreateNewOutputMediaType(mtOut, cbBuffer);
+
+ bool fTypeChanged = false;
+
+ if(mtOut != pOut->CurrentMediaType() || cbBuffer > actual.cbBuffer)
+ {
+ fTypeChanged = true;
+
+ m_SampleProps.dwSampleFlags |= AM_SAMPLE_TYPECHANGED/*|AM_SAMPLE_DATADISCONTINUITY|AM_SAMPLE_TIMEDISCONTINUITY*/;
+
+/*
+ if(CComQIPtr<IPinConnection> pPC = pOut->CurrentPinConnection())
+ {
+ HANDLE hEOS = CreateEvent(NULL, FALSE, FALSE, NULL);
+ hr = pPC->NotifyEndOfStream(hEOS);
+ hr = pOut->DeliverEndOfStream();
+ WaitForSingleObject(hEOS, 3000);
+ CloseHandle(hEOS);
+ hr = pOut->DeliverBeginFlush();
+ hr = pOut->DeliverEndFlush();
+ }
+*/
+
+ if(props.cBuffers < 8 && mtOut.majortype == MEDIATYPE_Audio)
+ props.cBuffers = 8;
+
+ props.cbBuffer = cbBuffer;
+
+ if(actual.cbAlign != props.cbAlign
+ || actual.cbPrefix != props.cbPrefix
+ || actual.cBuffers < props.cBuffers
+ || actual.cbBuffer < props.cbBuffer)
+ {
+ hr = pOut->DeliverBeginFlush();
+ hr = pOut->DeliverEndFlush();
+ hr = pOut->CurrentAllocator()->Decommit();
+ hr = pOut->CurrentAllocator()->SetProperties(&props, &actual);
+ hr = pOut->CurrentAllocator()->Commit();
+ }
+ }
+
+ CComPtr<IMediaSample> pOutSample;
+ if(FAILED(InitializeOutputSample(pSample, &pOutSample)))
+ return E_FAIL;
+
+ pmt = NULL;
+ if(SUCCEEDED(pOutSample->GetMediaType(&pmt)) && pmt)
+ {
+ const CMediaType mt(*pmt);
+ DeleteMediaType(pmt), pmt = NULL;
+ // TODO
+ ASSERT(0);
+ }
+
+ if(fTypeChanged)
+ {
+ pOut->SetMediaType(&mtOut);
+ ((CStreamSwitcherFilter*)m_pFilter)->OnNewOutputMediaType(m_mt, mtOut);
+ pOutSample->SetMediaType(&mtOut);
+ }
+
+ // Transform
+
+ hr = ((CStreamSwitcherFilter*)m_pFilter)->Transform(pSample, pOutSample);
+
+ //
+
+ if(S_OK == hr)
+ {
+ hr = pOut->Deliver(pOutSample);
+ m_bSampleSkipped = FALSE;
+/*
+ if(FAILED(hr))
+ {
+ ASSERT(0);
+ }
+*/
+ }
+ else if(S_FALSE == hr)
+ {
+ hr = S_OK;
+ pOutSample = NULL;
+ m_bSampleSkipped = TRUE;
+
+ if(!m_bQualityChanged)
+ {
+ m_pFilter->NotifyEvent(EC_QUALITY_CHANGE, 0, 0);
+ m_bQualityChanged = TRUE;
+ }
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CStreamSwitcherInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ if(!IsConnected())
+ return S_OK;
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ CStreamSwitcherFilter* pSSF = (CStreamSwitcherFilter*)m_pFilter;
+
+ CStreamSwitcherOutputPin* pOut = pSSF->GetOutputPin();
+ if(!pOut || !pOut->IsConnected())
+ return VFW_E_NOT_CONNECTED;
+
+ return pSSF->DeliverNewSegment(tStart, tStop, dRate);
+}
+
+//
+// CStreamSwitcherOutputPin
+//
+
+CStreamSwitcherOutputPin::CStreamSwitcherOutputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr)
+ : CBaseOutputPin(NAME("CStreamSwitcherOutputPin"), pFilter, &pFilter->m_csState, phr, L"Out")
+{
+// m_bCanReconnectWhenActive = TRUE;
+}
+
+STDMETHODIMP CStreamSwitcherOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
+{
+ CheckPointer(ppv,E_POINTER);
+ ValidateReadWritePtr(ppv, sizeof(PVOID));
+ *ppv = NULL;
+
+ if(riid == IID_IMediaPosition || riid == IID_IMediaSeeking)
+ {
+ if(m_pStreamSwitcherPassThru == NULL)
+ {
+ HRESULT hr = S_OK;
+ m_pStreamSwitcherPassThru = (IUnknown*)(INonDelegatingUnknown*)
+ new CStreamSwitcherPassThru(GetOwner(), &hr, (CStreamSwitcherFilter*)m_pFilter);
+
+ if(!m_pStreamSwitcherPassThru) return E_OUTOFMEMORY;
+ if(FAILED(hr)) return hr;
+ }
+
+ return m_pStreamSwitcherPassThru->QueryInterface(riid, ppv);
+ }
+/*
+ else if(riid == IID_IStreamBuilder)
+ {
+ return GetInterface((IStreamBuilder*)this, ppv);
+ }
+*/
+ return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CStreamSwitcherOutputPin::QueryAcceptUpstream(const AM_MEDIA_TYPE* pmt)
+{
+ HRESULT hr = S_FALSE;
+
+ CStreamSwitcherInputPin* pIn = ((CStreamSwitcherFilter*)m_pFilter)->GetInputPin();
+
+ if(pIn && pIn->IsConnected() && (pIn->IsUsingOwnAllocator() || pIn->CurrentMediaType() == *pmt))
+ {
+ if(CComQIPtr<IPin> pPinTo = pIn->GetConnected())
+ {
+ if(S_OK != (hr = pPinTo->QueryAccept(pmt)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else
+ {
+ return E_FAIL;
+ }
+ }
+
+ return hr;
+}
+
+// pure virtual
+
+HRESULT CStreamSwitcherOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ CStreamSwitcherInputPin* pIn = ((CStreamSwitcherFilter*)m_pFilter)->GetInputPin();
+ if(!pIn || !pIn->IsConnected()) return E_UNEXPECTED;
+
+ CComPtr<IMemAllocator> pAllocatorIn;
+ pIn->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
+
+ HRESULT hr;
+ if(FAILED(hr = pAllocatorIn->GetProperties(pProperties)))
+ return hr;
+
+ if(pProperties->cBuffers < 8 && pIn->CurrentMediaType().majortype == MEDIATYPE_Audio)
+ pProperties->cBuffers = 8;
+
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+// virtual
+
+[uuid("AEFA5024-215A-4FC7-97A4-1043C86FD0B8")]
+class MatrixMixer {};
+
+HRESULT CStreamSwitcherOutputPin::CheckConnect(IPin* pPin)
+{
+ CComPtr<IBaseFilter> pBF = GetFilterFromPin(pPin);
+
+ return
+ IsAudioWaveRenderer(pBF) || GetCLSID(pBF) == __uuidof(MatrixMixer)
+ ? __super::CheckConnect(pPin)
+ : E_FAIL;
+
+// return CComQIPtr<IPinConnection>(pPin) ? CBaseOutputPin::CheckConnect(pPin) : E_NOINTERFACE;
+// return CBaseOutputPin::CheckConnect(pPin);
+}
+
+HRESULT CStreamSwitcherOutputPin::BreakConnect()
+{
+ m_pPinConnection = NULL;
+ return __super::BreakConnect();
+}
+
+HRESULT CStreamSwitcherOutputPin::CompleteConnect(IPin* pReceivePin)
+{
+ m_pPinConnection = CComQIPtr<IPinConnection>(pReceivePin);
+ return __super::CompleteConnect(pReceivePin);
+}
+
+HRESULT CStreamSwitcherOutputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return ((CStreamSwitcherFilter*)m_pFilter)->CheckMediaType(pmt);
+}
+
+HRESULT CStreamSwitcherOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ CStreamSwitcherInputPin* pIn = ((CStreamSwitcherFilter*)m_pFilter)->GetInputPin();
+ if(!pIn || !pIn->IsConnected()) return E_UNEXPECTED;
+
+ CComPtr<IEnumMediaTypes> pEM;
+ if(FAILED(pIn->GetConnected()->EnumMediaTypes(&pEM)))
+ return VFW_S_NO_MORE_ITEMS;
+
+ if(iPosition > 0 && FAILED(pEM->Skip(iPosition)))
+ return VFW_S_NO_MORE_ITEMS;
+
+ AM_MEDIA_TYPE* tmp = NULL;
+ if(S_OK != pEM->Next(1, &tmp, NULL) || !tmp)
+ return VFW_S_NO_MORE_ITEMS;
+
+ CopyMediaType(pmt, tmp);
+ DeleteMediaType(tmp);
+/*
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ CopyMediaType(pmt, &pIn->CurrentMediaType());
+*/
+ return S_OK;
+}
+
+// IPin
+
+STDMETHODIMP CStreamSwitcherOutputPin::QueryAccept(const AM_MEDIA_TYPE* pmt)
+{
+ HRESULT hr = __super::QueryAccept(pmt);
+ if(S_OK != hr) return hr;
+
+ return QueryAcceptUpstream(pmt);
+}
+
+// IQualityControl
+
+STDMETHODIMP CStreamSwitcherOutputPin::Notify(IBaseFilter* pSender, Quality q)
+{
+ CStreamSwitcherInputPin* pIn = ((CStreamSwitcherFilter*)m_pFilter)->GetInputPin();
+ if(!pIn || !pIn->IsConnected()) return VFW_E_NOT_CONNECTED;
+ return pIn->PassNotify(q);
+}
+
+// IStreamBuilder
+
+STDMETHODIMP CStreamSwitcherOutputPin::Render(IPin* ppinOut, IGraphBuilder* pGraph)
+{
+ CComPtr<IBaseFilter> pBF;
+ pBF.CoCreateInstance(CLSID_DSoundRender);
+ if(!pBF || FAILED(pGraph->AddFilter(pBF, L"Default DirectSound Device")))
+ {
+ return E_FAIL;
+ }
+
+ if(FAILED(pGraph->ConnectDirect(ppinOut, GetFirstDisconnectedPin(pBF, PINDIR_INPUT), NULL)))
+ {
+ pGraph->RemoveFilter(pBF);
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamSwitcherOutputPin::Backout(IPin* ppinOut, IGraphBuilder* pGraph)
+{
+ return S_OK;
+}
+
+//
+// CStreamSwitcherFilter
+//
+
+CStreamSwitcherFilter::CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid)
+ : CBaseFilter(NAME("CStreamSwitcherFilter"), lpunk, &m_csState, clsid)
+{
+ if(phr) *phr = S_OK;
+
+ HRESULT hr = S_OK;
+
+ do
+ {
+ CAutoPtr<CStreamSwitcherInputPin> pInput;
+ CAutoPtr<CStreamSwitcherOutputPin> pOutput;
+
+ hr = S_OK;
+ pInput.Attach(new CStreamSwitcherInputPin(this, &hr, L"Channel 1"));
+ if(!pInput || FAILED(hr)) break;
+
+ hr = S_OK;
+ pOutput.Attach(new CStreamSwitcherOutputPin(this, &hr));
+ if(!pOutput || FAILED(hr)) break;
+
+ CAutoLock cAutoLock(&m_csPins);
+
+ m_pInputs.AddHead(m_pInput = pInput.Detach());
+ m_pOutput = pOutput.Detach();
+
+ return;
+ }
+ while(false);
+
+ if(phr) *phr = E_FAIL;
+}
+
+CStreamSwitcherFilter::~CStreamSwitcherFilter()
+{
+ CAutoLock cAutoLock(&m_csPins);
+
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos) delete m_pInputs.GetNext(pos);
+ m_pInputs.RemoveAll();
+ m_pInput = NULL;
+
+ delete m_pOutput;
+ m_pOutput = NULL;
+}
+
+STDMETHODIMP CStreamSwitcherFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(IAMStreamSelect)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+//
+
+int CStreamSwitcherFilter::GetPinCount()
+{
+ CAutoLock cAutoLock(&m_csPins);
+
+ return(1 + (int)m_pInputs.GetCount());
+}
+
+CBasePin* CStreamSwitcherFilter::GetPin(int n)
+{
+ CAutoLock cAutoLock(&m_csPins);
+
+ if(n < 0 || n >= GetPinCount()) return NULL;
+ else if(n == 0) return m_pOutput;
+ else return m_pInputs.GetAt(m_pInputs.FindIndex(n-1));
+}
+
+int CStreamSwitcherFilter::GetConnectedInputPinCount()
+{
+ CAutoLock cAutoLock(&m_csPins);
+
+ int nConnected = 0;
+
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ if(m_pInputs.GetNext(pos)->IsConnected())
+ nConnected++;
+ }
+
+ return(nConnected);
+}
+
+CStreamSwitcherInputPin* CStreamSwitcherFilter::GetConnectedInputPin(int n)
+{
+ if(n >= 0)
+ {
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CStreamSwitcherInputPin* pPin = m_pInputs.GetNext(pos);
+ if(pPin->IsConnected())
+ {
+ if(n == 0) return(pPin);
+ n--;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+CStreamSwitcherInputPin* CStreamSwitcherFilter::GetInputPin()
+{
+ return m_pInput;
+}
+
+CStreamSwitcherOutputPin* CStreamSwitcherFilter::GetOutputPin()
+{
+ return m_pOutput;
+}
+
+//
+
+HRESULT CStreamSwitcherFilter::CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin, IPin* pReceivePin)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ CAutoLock cAutoLock(&m_csPins);
+
+ int nConnected = GetConnectedInputPinCount();
+
+ if(nConnected == 1)
+ {
+ m_pInput = (CStreamSwitcherInputPin*)pPin;
+ }
+
+ if(nConnected == m_pInputs.GetCount())
+ {
+ CStringW name;
+ name.Format(L"Channel %d", ++m_PinVersion);
+
+ HRESULT hr = S_OK;
+ CStreamSwitcherInputPin* pPin = new CStreamSwitcherInputPin(this, &hr, name);
+ if(!pPin || FAILED(hr)) return E_FAIL;
+ m_pInputs.AddTail(pPin);
+ }
+ }
+
+ return S_OK;
+}
+
+// this should be very thread safe, I hope it is, it must be... :)
+
+void CStreamSwitcherFilter::SelectInput(CStreamSwitcherInputPin* pInput)
+{
+ // make sure no input thinks it is active
+ m_pInput = NULL;
+
+ // release blocked GetBuffer in our own allocator & block all Receive
+ POSITION pos = m_pInputs.GetHeadPosition();
+ while(pos)
+ {
+ CStreamSwitcherInputPin* pPin = m_pInputs.GetNext(pos);
+ pPin->Block(false);
+ // a few Receive calls can arrive here, but since m_pInput == NULL neighter of them gets delivered
+ pPin->Block(true);
+ }
+
+ // this will let waiting GetBuffer() calls go on inside our Receive()
+ if(m_pOutput)
+ {
+ m_pOutput->DeliverBeginFlush();
+ m_pOutput->DeliverEndFlush();
+ }
+
+ if(!pInput) return;
+
+ // set new input
+ m_pInput = pInput;
+
+ // let it go
+ m_pInput->Block(false);
+}
+
+//
+
+HRESULT CStreamSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
+{
+ BYTE* pDataIn = NULL;
+ BYTE* pDataOut = NULL;
+
+ HRESULT hr;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+ if(FAILED(hr = pOut->GetPointer(&pDataOut))) return hr;
+
+ long len = pIn->GetActualDataLength();
+ long size = pOut->GetSize();
+
+ if(!pDataIn || !pDataOut /*|| len > size || len <= 0*/) return S_FALSE; // FIXME
+
+ memcpy(pDataOut, pDataIn, min(len, size));
+ pOut->SetActualDataLength(min(len, size));
+
+ return S_OK;
+}
+
+CMediaType CStreamSwitcherFilter::CreateNewOutputMediaType(CMediaType mt, long& cbBuffer)
+{
+ return mt;
+}
+
+HRESULT CStreamSwitcherFilter::DeliverEndOfStream()
+{
+ return m_pOutput ? m_pOutput->DeliverEndOfStream() : E_FAIL;
+}
+
+HRESULT CStreamSwitcherFilter::DeliverBeginFlush()
+{
+ return m_pOutput ? m_pOutput->DeliverBeginFlush() : E_FAIL;
+}
+
+HRESULT CStreamSwitcherFilter::DeliverEndFlush()
+{
+ return m_pOutput ? m_pOutput->DeliverEndFlush() : E_FAIL;
+}
+
+HRESULT CStreamSwitcherFilter::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ return m_pOutput ? m_pOutput->DeliverNewSegment(tStart, tStop, dRate) : E_FAIL;
+}
+
+// IAMStreamSelect
+
+STDMETHODIMP CStreamSwitcherFilter::Count(DWORD* pcStreams)
+{
+ if(!pcStreams) return E_POINTER;
+
+ CAutoLock cAutoLock(&m_csPins);
+
+ *pcStreams = GetConnectedInputPinCount();
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamSwitcherFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk)
+{
+ CAutoLock cAutoLock(&m_csPins);
+
+ CBasePin* pPin = GetConnectedInputPin(lIndex);
+ if(!pPin) return E_INVALIDARG;
+
+ if(ppmt)
+ *ppmt = CreateMediaType(&m_pOutput->CurrentMediaType());
+
+ if(pdwFlags)
+ *pdwFlags = (m_pInput == pPin) ? AMSTREAMSELECTINFO_EXCLUSIVE : 0;
+
+ if(plcid)
+ *plcid = 0;
+
+ if(pdwGroup)
+ *pdwGroup = 0;
+
+ if(ppszName && (*ppszName = (WCHAR*)CoTaskMemAlloc((wcslen(pPin->Name())+1)*sizeof(WCHAR))))
+ wcscpy(*ppszName, pPin->Name());
+
+ if(ppObject)
+ *ppObject = NULL;
+
+ if(ppUnk)
+ *ppUnk = NULL;
+
+ return S_OK;
+}
+
+STDMETHODIMP CStreamSwitcherFilter::Enable(long lIndex, DWORD dwFlags)
+{
+ if(dwFlags != AMSTREAMSELECTENABLE_ENABLE)
+ return E_NOTIMPL;
+
+ PauseGraph;
+
+ CStreamSwitcherInputPin* pNewInput = GetConnectedInputPin(lIndex);
+ if(!pNewInput) return E_INVALIDARG;
+
+ SelectInput(pNewInput);
+
+ ResumeGraph;
+
+ return S_OK;
+}
+
+////////// \ No newline at end of file
diff --git a/src/filters/switcher/audioswitcher/StreamSwitcher.h b/src/filters/switcher/audioswitcher/StreamSwitcher.h
new file mode 100644
index 000000000..e6a7f17b7
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/StreamSwitcher.h
@@ -0,0 +1,279 @@
+// Copyright 2003 Gabest.
+// http://www.gabest.org
+//
+// 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; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
+// http://www.gnu.org/copyleft/gpl.html
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+
+#define PauseGraph \
+ CComQIPtr<IMediaControl> _pMC(m_pGraph); \
+ OAFilterState _fs = -1; \
+ if(_pMC) _pMC->GetState(1000, &_fs); \
+ if(_fs == State_Running) \
+ _pMC->Pause(); \
+ \
+ HRESULT _hr = E_FAIL; \
+ CComQIPtr<IMediaSeeking> _pMS((IUnknown*)(INonDelegatingUnknown*)m_pGraph); \
+ LONGLONG _rtNow = 0; \
+ if(_pMS) _hr = _pMS->GetCurrentPosition(&_rtNow); \
+
+#define ResumeGraph \
+ if(SUCCEEDED(_hr) && _pMS && _fs != State_Stopped) \
+ _hr = _pMS->SetPositions(&_rtNow, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); \
+ \
+ if(_fs == State_Running && _pMS) \
+ _pMC->Run(); \
+
+class CStreamSwitcherFilter;
+
+class CStreamSwitcherPassThru : public IMediaSeeking, public CMediaPosition
+{
+protected:
+ CStreamSwitcherFilter* m_pFilter;
+
+public:
+ CStreamSwitcherPassThru(LPUNKNOWN, HRESULT* phr, CStreamSwitcherFilter* pFilter);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IMediaSeeking methods
+ STDMETHODIMP GetCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP CheckCapabilities(DWORD* pCapabilities);
+ STDMETHODIMP SetTimeFormat(const GUID* pFormat);
+ STDMETHODIMP GetTimeFormat(GUID* pFormat);
+ STDMETHODIMP IsUsingTimeFormat(const GUID* pFormat);
+ STDMETHODIMP IsFormatSupported(const GUID* pFormat);
+ STDMETHODIMP QueryPreferredFormat(GUID* pFormat);
+ STDMETHODIMP ConvertTimeFormat(LONGLONG* pTarget, const GUID* pTargetFormat, LONGLONG Source, const GUID* pSourceFormat);
+ STDMETHODIMP SetPositions(LONGLONG* pCurrent, DWORD CurrentFlags, LONGLONG* pStop, DWORD StopFlags);
+ STDMETHODIMP GetPositions(LONGLONG* pCurrent, LONGLONG* pStop);
+ STDMETHODIMP GetCurrentPosition(LONGLONG* pCurrent);
+ STDMETHODIMP GetStopPosition(LONGLONG* pStop);
+ STDMETHODIMP SetRate(double dRate);
+ STDMETHODIMP GetRate(double* pdRate);
+ STDMETHODIMP GetDuration(LONGLONG* pDuration);
+ STDMETHODIMP GetAvailable(LONGLONG* pEarliest, LONGLONG* pLatest);
+ STDMETHODIMP GetPreroll(LONGLONG* pllPreroll);
+
+ // IMediaPosition properties
+ STDMETHODIMP get_Duration(REFTIME* plength);
+ STDMETHODIMP put_CurrentPosition(REFTIME llTime);
+ STDMETHODIMP get_StopTime(REFTIME* pllTime);
+ STDMETHODIMP put_StopTime(REFTIME llTime);
+ STDMETHODIMP get_PrerollTime(REFTIME* pllTime);
+ STDMETHODIMP put_PrerollTime(REFTIME llTime);
+ STDMETHODIMP get_Rate(double* pdRate);
+ STDMETHODIMP put_Rate(double dRate);
+ STDMETHODIMP get_CurrentPosition(REFTIME* pllTime);
+ STDMETHODIMP CanSeekForward(LONG* pCanSeekForward);
+ STDMETHODIMP CanSeekBackward(LONG* pCanSeekBackward);
+};
+
+class CStreamSwitcherInputPin;
+
+class CStreamSwitcherAllocator : public CMemAllocator
+{
+protected:
+ CStreamSwitcherInputPin* m_pPin;
+
+ CMediaType m_mt;
+ bool m_fMediaTypeChanged;
+
+public:
+ CStreamSwitcherAllocator(CStreamSwitcherInputPin* pPin, HRESULT* phr);
+#ifdef DEBUG
+ ~CStreamSwitcherAllocator();
+#endif
+
+ STDMETHODIMP_(ULONG) NonDelegatingAddRef();
+ STDMETHODIMP_(ULONG) NonDelegatingRelease();
+
+ STDMETHODIMP GetBuffer(
+ IMediaSample** ppBuffer,
+ REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime,
+ DWORD dwFlags);
+
+ void NotifyMediaType(const CMediaType& mt);
+};
+
+[uuid("DA395FA3-4A3E-4D85-805E-0BEFF53D4BCD")]
+interface IStreamSwitcherInputPin : public IUnknown
+{
+ STDMETHOD_(bool, IsActive)() = 0;
+};
+
+class CStreamSwitcherInputPin : public CBaseInputPin, public IPinConnection, public IStreamSwitcherInputPin
+{
+ friend class CStreamSwitcherAllocator;
+
+ CStreamSwitcherAllocator m_Allocator;
+
+ BOOL m_bSampleSkipped;
+ BOOL m_bQualityChanged;
+ BOOL m_bUsingOwnAllocator;
+
+ CAMEvent m_evBlock;
+ bool m_fCanBlock;
+ HRESULT Active();
+ HRESULT Inactive();
+
+ HRESULT QueryAcceptDownstream(const AM_MEDIA_TYPE* pmt);
+
+ HRESULT InitializeOutputSample(IMediaSample* pInSample, IMediaSample** ppOutSample);
+
+ HANDLE m_hNotifyEvent;
+
+public:
+ CStreamSwitcherInputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr, LPCWSTR pName);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ CMediaType& CurrentMediaType() {return m_mt;}
+ IMemAllocator* CurrentAllocator() {return m_pAllocator;}
+
+ bool IsUsingOwnAllocator() {return m_bUsingOwnAllocator == TRUE;}
+
+ void Block(bool fBlock);
+
+ CCritSec m_csReceive;
+
+ // pure virtual
+ HRESULT CheckMediaType(const CMediaType* pmt);
+
+ // virtual
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT CompleteConnect(IPin* pReceivePin);
+
+ // IPin
+ STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);
+ STDMETHODIMP NotifyAllocator(IMemAllocator* pAllocator, BOOL bReadOnly);
+ STDMETHODIMP BeginFlush();
+ STDMETHODIMP EndFlush();
+ STDMETHODIMP EndOfStream();
+
+ // IMemInputPin
+ STDMETHODIMP Receive(IMediaSample* pSample);
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+ // IPinConnection
+ STDMETHODIMP DynamicQueryAccept(const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP NotifyEndOfStream(HANDLE hNotifyEvent);
+ STDMETHODIMP IsEndPin();
+ STDMETHODIMP DynamicDisconnect();
+
+ // IStreamSwitcherInputPin
+ STDMETHODIMP_(bool) IsActive();
+};
+
+class CStreamSwitcherOutputPin : public CBaseOutputPin, public IStreamBuilder
+{
+ CComPtr<IUnknown> m_pStreamSwitcherPassThru;
+ CComPtr<IPinConnection> m_pPinConnection;
+
+ HRESULT QueryAcceptUpstream(const AM_MEDIA_TYPE* pmt);
+
+public:
+ CStreamSwitcherOutputPin(CStreamSwitcherFilter* pFilter, HRESULT* phr);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ CMediaType& CurrentMediaType() {return m_mt;}
+ IMemAllocator* CurrentAllocator() {return m_pAllocator;}
+ IPinConnection* CurrentPinConnection() {return m_pPinConnection;}
+
+ // pure virtual
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+
+ // virtual
+ HRESULT CheckConnect(IPin* pPin);
+ HRESULT BreakConnect();
+ HRESULT CompleteConnect(IPin* pReceivePin);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+
+ // IPin
+ STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE* pmt);
+
+ // IQualityControl
+ STDMETHODIMP Notify(IBaseFilter* pSender, Quality q);
+
+ // IStreamBuilder
+ STDMETHODIMP Render(IPin* ppinOut, IGraphBuilder* pGraph);
+ STDMETHODIMP Backout(IPin* ppinOut, IGraphBuilder* pGraph);
+};
+
+class CStreamSwitcherFilter : public CBaseFilter, public IAMStreamSelect
+{
+ friend class CStreamSwitcherInputPin;
+ friend class CStreamSwitcherOutputPin;
+ friend class CStreamSwitcherPassThru;
+
+ CAtlList<CStreamSwitcherInputPin*> m_pInputs;
+ CStreamSwitcherInputPin* m_pInput;
+ CStreamSwitcherOutputPin* m_pOutput;
+
+ CCritSec m_csState, m_csPins;
+
+ HRESULT CompleteConnect(PIN_DIRECTION dir, CBasePin* pPin, IPin* pReceivePin);
+
+protected:
+ void SelectInput(CStreamSwitcherInputPin* pInput);
+
+public:
+ CStreamSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr, const CLSID& clsid);
+ virtual ~CStreamSwitcherFilter();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+
+ int GetConnectedInputPinCount();
+ CStreamSwitcherInputPin* GetConnectedInputPin(int n);
+ CStreamSwitcherInputPin* GetInputPin();
+ CStreamSwitcherOutputPin* GetOutputPin();
+
+ bool m_fResetOutputMediaType;
+ void ResetOutputMediaType() {m_fResetOutputMediaType = true;}
+
+ // override these
+ virtual HRESULT CheckMediaType(const CMediaType* pmt) = 0;
+ virtual HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ virtual CMediaType CreateNewOutputMediaType(CMediaType mt, long& cbBuffer);
+ virtual void OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut) {}
+
+ // and maybe these
+ virtual HRESULT DeliverEndOfStream();
+ virtual HRESULT DeliverBeginFlush();
+ virtual HRESULT DeliverEndFlush();
+ virtual HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+ // IAMStreamSelect
+ STDMETHODIMP Count(DWORD* pcStreams);
+ STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
+ STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
+};
+
diff --git a/src/filters/switcher/audioswitcher/audioswitcher.sln b/src/filters/switcher/audioswitcher/audioswitcher.sln
new file mode 100644
index 000000000..eef134057
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/audioswitcher.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "audioswitcher", "audioswitcher.vcproj", "{D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug.ActiveCfg = Debug|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug.Build.0 = Debug|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug lib.ActiveCfg = Debug lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug lib.Build.0 = Debug lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release.ActiveCfg = Release|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release.Build.0 = Release|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release lib.ActiveCfg = Release lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release lib.Build.0 = Release lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode.Build.0 = Release Unicode|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/switcher/audioswitcher/audioswitcher.vcproj b/src/filters/switcher/audioswitcher/audioswitcher.vcproj
new file mode 100644
index 000000000..3ec1db3bb
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/audioswitcher.vcproj
@@ -0,0 +1,502 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="audioswitcher"
+ ProjectGUID="{D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AudioSwitcher.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AudioSwitcher.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AudioSwitcher.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AudioSwitcher.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="Audio.cpp">
+ </File>
+ <File
+ RelativePath="AudioSwitcher.cpp">
+ </File>
+ <File
+ RelativePath="AudioSwitcher.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\StreamSwitcher.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="Audio.h">
+ </File>
+ <File
+ RelativePath="AudioSwitcher.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath=".\StreamSwitcher.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/switcher/audioswitcher/audioswitcher_vs2005.vcproj b/src/filters/switcher/audioswitcher/audioswitcher_vs2005.vcproj
new file mode 100644
index 000000000..a5a8001c9
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/audioswitcher_vs2005.vcproj
@@ -0,0 +1,740 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="audioswitcher"
+ ProjectGUID="{D8DB3E7E-D50E-4EC3-A9B9-DAD18F5FE466}"
+ RootNamespace="audioswitcher"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AudioSwitcher.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AudioSwitcher.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AudioSwitcher.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AudioSwitcher.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="Audio.cpp"
+ >
+ </File>
+ <File
+ RelativePath="AudioSwitcher.cpp"
+ >
+ </File>
+ <File
+ RelativePath="AudioSwitcher.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\StreamSwitcher.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="Audio.h"
+ >
+ </File>
+ <File
+ RelativePath="AudioSwitcher.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath=".\StreamSwitcher.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/switcher/audioswitcher/audioswitcher_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/switcher/audioswitcher/audioswitcher_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/audioswitcher_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/switcher/audioswitcher/stdafx.cpp b/src/filters/switcher/audioswitcher/stdafx.cpp
new file mode 100644
index 000000000..f1f712075
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// audioswitcher.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/switcher/audioswitcher/stdafx.h b/src/filters/switcher/audioswitcher/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/switcher/audioswitcher/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/transform/QTDec/Copy (2) of QTDec.cpp b/src/filters/transform/QTDec/Copy (2) of QTDec.cpp
new file mode 100644
index 000000000..d5c508a4c
--- /dev/null
+++ b/src/filters/transform/QTDec/Copy (2) of QTDec.cpp
@@ -0,0 +1,485 @@
+#include "StdAfx.h"
+#include <atlbase.h>
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include <initguid.h>
+#include "qtdec.h"
+
+using namespace QT;
+
+static DWORD DWSWAP(DWORD dw) {return(((dw&0xff)<<24)|((dw&0xff00)<<8)|((dw&0xff0000)>>8)|((dw&0xff000000)>>24));}
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ { L"Input", // Pins string name
+ FALSE, // Is it rendered
+ FALSE, // Is it an output
+ FALSE, // Are we allowed none
+ FALSE, // And allowed many
+ &CLSID_NULL, // Connects to filter
+ NULL, // Connects to pin
+ countof(sudPinTypesIn), // Number of types
+ sudPinTypesIn // Pin information
+ },
+ { L"Output", // Pins string name
+ FALSE, // Is it rendered
+ TRUE, // Is it an output
+ FALSE, // Are we allowed none
+ FALSE, // And allowed many
+ &CLSID_NULL, // Connects to filter
+ NULL, // Connects to pin
+ countof(sudPinTypesOut), // Number of types
+ sudPinTypesOut // Pin information
+ }
+};
+
+const AMOVIESETUP_FILTER sudFilter =
+{
+ &CLSID_QTDec, // Filter CLSID
+ L"QuickTime Decoder", // String name
+ MERIT_DO_NOT_USE/*MERIT_NORMAL*/, // Filter merit
+ countof(sudpPins), // Number of pins
+ sudpPins // Pin information
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ { L"QuickTime Decoder"
+ , &CLSID_QTDec
+ , CQTDec::CreateInstance
+ , NULL
+ , &sudFilter }
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
+
+BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
+{
+ return DllEntryPoint((HINSTANCE)hModule, dwReason, 0); // "DllMain" of the dshow baseclasses;
+}
+
+//
+// CQTDec
+//
+
+CUnknown* WINAPI CQTDec::CreateInstance(LPUNKNOWN lpunk, HRESULT* phr)
+{
+ CUnknown* punk = new CQTDec(lpunk, phr);
+ if(punk == NULL) *phr = E_OUTOFMEMORY;
+ return punk;
+}
+
+#endif
+
+CQTDec::CQTDec(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CQTDec"), lpunk, CLSID_QTDec)
+ , m_fQtInitialized(false)
+ , m_pImageGWorld(NULL)
+ , m_hImageDesc(NULL)
+ , m_cinst(NULL)
+{
+ if(phr) *phr = S_OK;
+
+ m_fQtInitialized = false;
+ if(InitializeQTML(0) != 0) {if(phr) *phr = E_FAIL; return;}
+// if(EnterMovies() != 0) {TerminateQTML(); if(phr) *phr = E_FAIL; return;}
+ m_fQtInitialized = true;
+}
+
+CQTDec::~CQTDec()
+{
+ if(m_cinst)
+ CloseComponent(m_cinst),
+ m_cinst = NULL;
+
+ if(m_hImageDesc)
+ DisposeHandle((Handle)m_hImageDesc),
+ m_hImageDesc = NULL;
+
+ FreeGWorld(m_pImageGWorld);
+
+ if(m_fQtInitialized)
+ {
+// ExitMovies();
+ TerminateQTML();
+ }
+}
+
+//
+
+GWorldPtr CQTDec::MakeGWorld()
+{
+ if(!m_pOutput->IsConnected())
+ return NULL;
+
+ const CMediaType& mt = m_pOutput->CurrentMediaType();
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ GWorldPtr pImageWorld = NULL;
+ Rect rect = {0, 0, (short)abs(bih.biHeight), (short)bih.biWidth};
+
+ OSType PixelFormat =
+ mt.subtype == MEDIASUBTYPE_YUY2 ? kYUVSPixelFormat : // 'yuvs'
+ mt.subtype == MEDIASUBTYPE_UYVY ? k2vuyPixelFormat : // '2vuy'
+ mt.subtype == MEDIASUBTYPE_RGB32 ? k32BGRAPixelFormat : // 'BGRA'
+ mt.subtype == MEDIASUBTYPE_RGB565 ? k16LE565PixelFormat : // 'L565'
+ mt.subtype == MEDIASUBTYPE_RGB555 ? k16LE555PixelFormat : // 'L555'
+ 0;
+
+ if(!PixelFormat || noErr != QTNewGWorld(&pImageWorld, PixelFormat, &rect, NULL, NULL, 0))
+ pImageWorld = NULL;
+
+ if(pImageWorld)
+ LockPixels(GetGWorldPixMap(pImageWorld));
+
+ return pImageWorld;
+}
+
+void CQTDec::FreeGWorld(GWorldPtr& pImageGWorld)
+{
+ if(pImageGWorld)
+ {
+ UnlockPixels(GetGWorldPixMap(pImageGWorld));
+ DisposeGWorld(pImageGWorld);
+ pImageGWorld = NULL;
+ }
+}
+
+bool CQTDec::InitComponent()
+{
+ if(m_cinst)
+ CloseComponent(m_cinst),
+ m_cinst = NULL;
+
+ if(m_hImageDesc)
+ DisposeHandle((Handle)m_hImageDesc),
+ m_hImageDesc = NULL;
+
+ if(!m_pInput->IsConnected())
+ return NULL;
+
+ BITMAPINFOHEADER& bih = ((VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat)->bmiHeader;
+
+ ComponentDescription cd = {decompressorComponentType, DWSWAP(bih.biCompression), 0, 0, 0};
+ Component c = FindNextComponent(0, &cd);
+ if(!c) return(false);
+
+ m_cinst = OpenComponent(c);
+ if(!m_cinst) return(false);
+
+ ComponentResult cres;
+
+ ImageSubCodecDecompressCapabilities icap;
+ memset(&icap, 0, sizeof(icap));
+ cres = ImageCodecInitialize(m_cinst, &icap);
+
+ CodecInfo cinfo;
+ memset(&cinfo, 0, sizeof(cinfo));
+ cres = ImageCodecGetCodecInfo(m_cinst, &cinfo);
+
+ m_hImageDesc = (ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription));
+ if(!m_hImageDesc)
+ return(false);
+
+ (**m_hImageDesc).idSize = sizeof(ImageDescription);
+ (**m_hImageDesc).cType = DWSWAP(bih.biCompression);
+ (**m_hImageDesc).temporalQuality = 0;
+ (**m_hImageDesc).spatialQuality = codecNormalQuality;
+ (**m_hImageDesc).width = (short)bih.biWidth;
+ (**m_hImageDesc).height = (short)abs(bih.biHeight);
+ (**m_hImageDesc).hRes = 72 << 16;
+ (**m_hImageDesc).vRes = 72 << 16;
+ (**m_hImageDesc).frameCount = 1; // ?
+ (**m_hImageDesc).depth = bih.biBitCount; // should be 24 for unknown/compressed types
+ (**m_hImageDesc).clutID = -1;
+
+ memset(&m_cdpar, 0, sizeof(m_cdpar));
+ m_cdpar.imageDescription = m_hImageDesc;
+ m_cdpar.startLine = 0;
+ m_cdpar.stopLine = (**m_hImageDesc).height;
+ m_cdpar.frameNumber = 1;
+ m_cdpar.matrixFlags = 0;
+ m_cdpar.matrixType = 0;
+ m_cdpar.matrix = 0;
+ m_cdpar.capabilities = &m_ccap;
+ memset(&m_ccap, 0, sizeof(m_ccap));
+ m_cdpar.accuracy = codecNormalQuality;
+ m_cdpar.port = m_pImageGWorld;
+ Rect rect = {0, 0, (**m_hImageDesc).height, (**m_hImageDesc).width};
+ m_cdpar.srcRect = rect;
+ m_cdpar.transferMode = srcCopy;
+ m_cdpar.dstPixMap = **GetGWorldPixMap(m_pImageGWorld);
+
+ cres = ImageCodecPreDecompress(m_cinst, &m_cdpar);
+
+ return(true);
+}
+
+//
+
+HRESULT CQTDec::BreakConnect(PIN_DIRECTION dir)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ m_mts.RemoveAll();
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ FreeGWorld(m_pImageGWorld);
+ }
+
+ return __super::BreakConnect(dir);
+}
+
+HRESULT CQTDec::CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ m_mts.RemoveAll();
+
+ VIDEOINFOHEADER* vihin = (VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bihin = vihin->bmiHeader;
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = MEDIASUBTYPE_None;
+ mt.formattype = FORMAT_VideoInfo;
+ mt.bFixedSizeSamples = TRUE;
+ mt.bTemporalCompression = FALSE;
+ mt.lSampleSize = 0;
+ mt.pUnk = NULL;
+
+ VIDEOINFOHEADER vih;
+ memset(&vih, 0, sizeof(vih));
+ vih.AvgTimePerFrame = vihin->AvgTimePerFrame;
+ vih.rcSource = vihin->rcSource;
+ vih.rcTarget = vihin->rcTarget;
+ vih.dwBitRate = vihin->dwBitRate;
+ vih.dwBitErrorRate = vihin->dwBitErrorRate;
+
+ BITMAPINFOHEADER& bih = vih.bmiHeader;
+ bih.biSize = sizeof(bih);
+ bih.biWidth = bihin.biWidth;
+ bih.biHeight = abs(bihin.biHeight);
+ bih.biPlanes = 1;
+ bih.biXPelsPerMeter = bih.biYPelsPerMeter = 0;
+ bih.biClrUsed = bih.biClrImportant = 0;
+
+// if(fRGB32) // always can decompress to (?)
+ {
+ VIDEOINFOHEADER* vihout = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memcpy(vihout, &vih, sizeof(vih));
+
+ BITMAPINFOHEADER& bihout = vihout->bmiHeader;
+ bihout.biBitCount = 32;
+ bihout.biSizeImage = bihout.biWidth*abs(bihout.biHeight)*bihout.biBitCount>>3;
+
+ mt.subtype = MEDIASUBTYPE_RGB32;
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_BITFIELDS;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = -bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_RGB;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+ }
+
+// if(fRGB16) // always can decompress to (?)
+ {
+ VIDEOINFOHEADER* vihout = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memcpy(vihout, &vih, sizeof(vih));
+
+ BITMAPINFOHEADER& bihout = vihout->bmiHeader;
+ bihout.biBitCount = 16;
+ bihout.biSizeImage = bihout.biWidth*abs(bihout.biHeight)*bihout.biBitCount>>3;
+
+ mt.subtype = MEDIASUBTYPE_RGB565;
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_BITFIELDS;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = -bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_RGB;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ mt.subtype = MEDIASUBTYPE_RGB555;
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_BITFIELDS;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = -bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_RGB;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+ }
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ FreeGWorld(m_pImageGWorld);
+ m_pImageGWorld = MakeGWorld();
+ }
+
+ return __super::CompleteConnect(dir, pReceivePin);
+}
+
+HRESULT CQTDec::Transform(IMediaSample* pSample, IMediaSample* pOutSample)
+{
+ HRESULT hr;
+
+ BYTE* pIn = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pIn))) return hr;
+ long len = pSample->GetActualDataLength();
+ if(len <= 0) return S_FALSE;
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
+ int size = pOutSample->GetSize();
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_pOutput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ bool fInitialized = true;
+
+ if(m_cinst)
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+ if(S_OK == pSample->GetMediaType((AM_MEDIA_TYPE**)&pmt) && pmt)
+ {
+ CMediaType mt(*pmt);
+ DeleteMediaType(pmt), pmt = NULL;
+
+ if(mt != m_pInput->CurrentMediaType())
+ {
+ m_pInput->SetMediaType(&mt);
+ fInitialized = InitComponent();
+ }
+ }
+ }
+ else
+ {
+ fInitialized = InitComponent();
+ }
+
+ if(!fInitialized)
+ return E_FAIL;
+
+ m_cdpar.data = (Ptr)pIn;
+ m_cdpar.bufferSize = len;
+ (**m_cdpar.imageDescription).dataSize = len;
+ ComponentResult cres = ImageCodecBandDecompress(m_cinst, &m_cdpar);
+ m_cdpar.frameNumber++;
+
+ if(cres == noErr)
+ {
+ PixMapHandle hPixMap = GetGWorldPixMap(m_pImageGWorld);
+ Ptr pPixels = GetPixBaseAddr(hPixMap);
+ long theRowBytes = QTGetPixMapHandleRowBytes(hPixMap);
+
+ DWORD pitch = bih.biWidth*bih.biBitCount>>3;
+
+ for(int i = 0, h = abs(bih.biHeight); i < h; i++)
+ {
+ memcpy(pOut + i*pitch, (BYTE*)pPixels + i*theRowBytes, min(pitch, theRowBytes));
+ }
+ }
+
+ return S_OK;
+}
+
+HRESULT CQTDec::CheckInputType(const CMediaType* mtIn)
+{
+ if(mtIn->majortype != MEDIATYPE_Video || mtIn->formattype != FORMAT_VideoInfo)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mtIn->pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ OSErr err;
+ ComponentInstance ci;
+ if(noErr == (err = OpenADefaultComponent('imdc', DWSWAP(bih.biCompression), &ci)))
+ {
+ err = CloseComponent(ci);
+ return S_OK;
+ }
+
+ return VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CQTDec::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return S_OK;
+ // TODO
+ return VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CQTDec::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
+
+ pAllocatorIn->GetProperties(pProperties);
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = bih.biWidth*abs(bih.biHeight)*4; // TODO
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CQTDec::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= m_mts.GetCount()) return VFW_S_NO_MORE_ITEMS;
+
+ *pmt = m_mts[iPosition];
+
+ return S_OK;
+}
diff --git a/src/filters/transform/QTDec/Copy (2) of QTDec.h b/src/filters/transform/QTDec/Copy (2) of QTDec.h
new file mode 100644
index 000000000..f0c0954ca
--- /dev/null
+++ b/src/filters/transform/QTDec/Copy (2) of QTDec.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#include <afxtempl.h>
+#include "..\..\..\..\include\qt\qt.h"
+
+//
+// CQTDec
+//
+
+// {2D261619-3822-4856-A422-DC77BF0FB947}
+DEFINE_GUID(CLSID_QTDec,
+0x2d261619, 0x3822, 0x4856, 0xa4, 0x22, 0xdc, 0x77, 0xbf, 0xf, 0xb9, 0x47);
+
+class CQTDec : public CTransformFilter
+{
+ bool m_fQtInitialized;
+ CArray<CMediaType> m_mts;
+
+ QT::GWorldPtr m_pImageGWorld;
+ QT::GWorldPtr MakeGWorld();
+ void FreeGWorld(QT::GWorldPtr& pImageGWorld);
+
+ QT::ComponentInstance m_cinst;
+ QT::CodecCapabilities m_ccap;
+ QT::CodecDecompressParams m_cdpar;
+ QT::ImageDescriptionHandle m_hImageDesc;
+ bool InitComponent();
+
+public:
+ CQTDec(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CQTDec();
+
+#ifdef REGISTER_FILTER
+ static CUnknown* WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT* phr);
+#endif
+
+ HRESULT BreakConnect(PIN_DIRECTION dir);
+ HRESULT CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin);
+
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+};
diff --git a/src/filters/transform/QTDec/Copy of QTDec.cpp b/src/filters/transform/QTDec/Copy of QTDec.cpp
new file mode 100644
index 000000000..97e518daf
--- /dev/null
+++ b/src/filters/transform/QTDec/Copy of QTDec.cpp
@@ -0,0 +1,606 @@
+#include "StdAfx.h"
+#include <atlbase.h>
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include <initguid.h>
+#include "qtdec.h"
+
+using namespace QT;
+
+static DWORD DWSWAP(DWORD dw) {return(((dw&0xff)<<24)|((dw&0xff00)<<8)|((dw&0xff0000)>>8)|((dw&0xff000000)>>24));}
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ { L"Input", // Pins string name
+ FALSE, // Is it rendered
+ FALSE, // Is it an output
+ FALSE, // Are we allowed none
+ FALSE, // And allowed many
+ &CLSID_NULL, // Connects to filter
+ NULL, // Connects to pin
+ countof(sudPinTypesIn), // Number of types
+ sudPinTypesIn // Pin information
+ },
+ { L"Output", // Pins string name
+ FALSE, // Is it rendered
+ TRUE, // Is it an output
+ FALSE, // Are we allowed none
+ FALSE, // And allowed many
+ &CLSID_NULL, // Connects to filter
+ NULL, // Connects to pin
+ countof(sudPinTypesOut), // Number of types
+ sudPinTypesOut // Pin information
+ }
+};
+
+const AMOVIESETUP_FILTER sudFilter =
+{
+ &CLSID_QTDec, // Filter CLSID
+ L"QuickTime Decoder", // String name
+ MERIT_DO_NOT_USE/*MERIT_NORMAL*/, // Filter merit
+ countof(sudpPins), // Number of pins
+ sudpPins // Pin information
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ { L"QuickTime Decoder"
+ , &CLSID_QTDec
+ , CQTDec::CreateInstance
+ , NULL
+ , &sudFilter }
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
+
+BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
+{
+ return DllEntryPoint((HINSTANCE)hModule, dwReason, 0); // "DllMain" of the dshow baseclasses;
+}
+
+//
+// CQTDec
+//
+
+CUnknown* WINAPI CQTDec::CreateInstance(LPUNKNOWN lpunk, HRESULT* phr)
+{
+ CUnknown* punk = new CQTDec(lpunk, phr);
+ if(punk == NULL) *phr = E_OUTOFMEMORY;
+ return punk;
+}
+
+#endif
+
+CQTDec::CQTDec(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CQTDec"), lpunk, CLSID_QTDec)
+ , m_fQtInitialized(false)
+ , m_hImageDescription(NULL)
+ , m_pImageGWorld(NULL)
+{
+ if(phr) *phr = S_OK;
+
+ m_fQtInitialized = false;
+ if(InitializeQTML(0) != 0) {if(phr) *phr = E_FAIL; return;}
+// if(EnterMovies() != 0) {TerminateQTML(); if(phr) *phr = E_FAIL; return;}
+ m_fQtInitialized = true;
+}
+
+CQTDec::~CQTDec()
+{
+ FreeImageDescription(m_hImageDescription);
+ FreeGWorld(m_pImageGWorld);
+
+ if(m_fQtInitialized)
+ {
+// ExitMovies();
+ TerminateQTML();
+ }
+}
+
+//
+
+bool CQTDec::CanDecompress(OSType fourcc, bool& fYUY2, bool& fUYVY)
+{
+ fYUY2 = fUYVY = false;
+
+ ComponentDescription cd = {decompressorComponentType, fourcc, 0, 0, cmpIsMissing};
+
+ if(Component decompressor = FindNextComponent(0, &cd))
+ {
+ do
+ {
+ OSErr err;
+ Handle cpix = NULL;
+ if(noErr == (err = GetComponentPublicResource(decompressor, FOUR_CHAR_CODE('cpix'), 1, &cpix)))
+ {
+ int cpixFormatCount = GetHandleSize(cpix) / sizeof(OSType);
+ for(int i = 0; i < cpixFormatCount; i++)
+ {
+ switch((*(OSType**)cpix)[i])
+ {
+ case 'yuvs': fYUY2 = true; break; // yuy2
+ case '2vuy': fUYVY = true; break; // uyvy
+ default: break;
+ }
+ }
+
+ DisposeHandle(cpix);
+ }
+
+ decompressor = FindNextComponent(decompressor, &cd);
+ }
+ while(decompressor && !(fYUY2 && fUYVY));
+
+ return(true);
+ }
+
+ return(false);
+}
+
+ImageDescriptionHandle CQTDec::MakeImageDescription()
+{
+ if(!m_pInput->IsConnected())
+ return NULL;
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ ImageDescriptionHandle h = (ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription));
+
+ if(h)
+ {
+ (**h).idSize = sizeof(ImageDescription);
+ (**h).cType = DWSWAP(bih.biCompression);
+ (**h).temporalQuality = 0;
+ (**h).spatialQuality = codecNormalQuality;
+ (**h).width = (short)bih.biWidth;
+ (**h).height = (short)abs(bih.biHeight);
+ (**h).hRes = 72 << 16;
+ (**h).vRes = 72 << 16;
+ (**h).frameCount = 1; // ?
+ (**h).depth = bih.biBitCount; // should be 24 for unknown/compressed types
+ (**h).clutID = -1;
+ }
+
+ return h;
+}
+
+GWorldPtr CQTDec::MakeGWorld()
+{
+ if(!m_pOutput->IsConnected())
+ return NULL;
+
+ const CMediaType& mt = m_pOutput->CurrentMediaType();
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ GWorldPtr pImageWorld = NULL;
+ Rect rect = {0, 0, (short)abs(bih.biHeight), (short)bih.biWidth};
+
+ OSType PixelFormat =
+ mt.subtype == MEDIASUBTYPE_YUY2 ? kYUVSPixelFormat : // 'yuvs'
+ mt.subtype == MEDIASUBTYPE_UYVY ? k2vuyPixelFormat : // '2vuy'
+ mt.subtype == MEDIASUBTYPE_RGB32 ? k32BGRAPixelFormat : // 'BGRA'
+ mt.subtype == MEDIASUBTYPE_RGB565 ? k16LE565PixelFormat : // 'L565'
+ mt.subtype == MEDIASUBTYPE_RGB555 ? k16LE555PixelFormat : // 'L555'
+ 0;
+
+ if(!PixelFormat || noErr != QTNewGWorld(&pImageWorld, PixelFormat, &rect, NULL, NULL, 0))
+ pImageWorld = NULL;
+
+ if(pImageWorld)
+ LockPixels(GetGWorldPixMap(pImageWorld));
+
+ return pImageWorld;
+}
+
+void CQTDec::FreeImageDescription(ImageDescriptionHandle& hImageDescription)
+{
+ if(hImageDescription)
+ {
+ DisposeHandle((Handle)hImageDescription);
+ hImageDescription = NULL;
+ }
+}
+
+void CQTDec::FreeGWorld(GWorldPtr& pImageGWorld)
+{
+ if(pImageGWorld)
+ {
+ UnlockPixels(GetGWorldPixMap(pImageGWorld));
+ DisposeGWorld(pImageGWorld);
+ pImageGWorld = NULL;
+ }
+}
+
+//
+
+HRESULT CQTDec::BreakConnect(PIN_DIRECTION dir)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ m_mts.RemoveAll();
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ FreeImageDescription(m_hImageDescription);
+ FreeGWorld(m_pImageGWorld);
+ }
+
+ return __super::BreakConnect(dir);
+}
+
+HRESULT CQTDec::CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ m_mts.RemoveAll();
+
+ VIDEOINFOHEADER* vihin = (VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bihin = vihin->bmiHeader;
+
+ bool fYUY2 = false, fUYVY = false;
+ if(CanDecompress(DWSWAP(bihin.biCompression), fYUY2, fUYVY))
+ {
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = MEDIASUBTYPE_None;
+ mt.formattype = FORMAT_VideoInfo;
+ mt.bFixedSizeSamples = TRUE;
+ mt.bTemporalCompression = FALSE;
+ mt.lSampleSize = 0;
+ mt.pUnk = NULL;
+
+ VIDEOINFOHEADER vih;
+ memset(&vih, 0, sizeof(vih));
+ vih.AvgTimePerFrame = vihin->AvgTimePerFrame;
+ vih.rcSource = vihin->rcSource;
+ vih.rcTarget = vihin->rcTarget;
+ vih.dwBitRate = vihin->dwBitRate;
+ vih.dwBitErrorRate = vihin->dwBitErrorRate;
+
+ BITMAPINFOHEADER& bih = vih.bmiHeader;
+ bih.biSize = sizeof(bih);
+ bih.biWidth = bihin.biWidth;
+ bih.biHeight = abs(bihin.biHeight);
+ bih.biPlanes = 1;
+ bih.biXPelsPerMeter = bih.biYPelsPerMeter = 0;
+ bih.biClrUsed = bih.biClrImportant = 0;
+/*
+ if(fYUY2 || fUYVY)
+ {
+ VIDEOINFOHEADER* vihout = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memcpy(vihout, &vih, sizeof(vih));
+
+ BITMAPINFOHEADER& bihout = vihout->bmiHeader;
+ bihout.biBitCount = 16;
+ bihout.biSizeImage = bihout.biWidth*abs(bihout.biHeight)*bihout.biBitCount>>3;
+
+ if(fYUY2)
+ {
+ mt.subtype = MEDIASUBTYPE_YUY2;
+ bihout.biCompression = '2YUY';
+ m_mts.Add(mt);
+ }
+
+ if(fUYVY)
+ {
+ mt.subtype = MEDIASUBTYPE_UYVY;
+ bihout.biCompression = 'YVYU';
+ m_mts.Add(mt);
+ }
+ }
+*/
+// if(fRGB32) // always can decompress to (?)
+ {
+ VIDEOINFOHEADER* vihout = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memcpy(vihout, &vih, sizeof(vih));
+
+ BITMAPINFOHEADER& bihout = vihout->bmiHeader;
+ bihout.biBitCount = 32;
+ bihout.biSizeImage = bihout.biWidth*abs(bihout.biHeight)*bihout.biBitCount>>3;
+
+ mt.subtype = MEDIASUBTYPE_RGB32;
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_BITFIELDS;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = -bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_RGB;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+ }
+
+// if(fRGB16) // always can decompress to (?)
+ {
+ VIDEOINFOHEADER* vihout = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memcpy(vihout, &vih, sizeof(vih));
+
+ BITMAPINFOHEADER& bihout = vihout->bmiHeader;
+ bihout.biBitCount = 16;
+ bihout.biSizeImage = bihout.biWidth*abs(bihout.biHeight)*bihout.biBitCount>>3;
+
+ mt.subtype = MEDIASUBTYPE_RGB565;
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_BITFIELDS;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = -bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_RGB;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ mt.subtype = MEDIASUBTYPE_RGB555;
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_BITFIELDS;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = -bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_RGB;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+ }
+ }
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ FreeGWorld(m_pImageGWorld);
+ m_pImageGWorld = MakeGWorld();
+ }
+
+ return __super::CompleteConnect(dir, pReceivePin);
+}
+
+HRESULT CQTDec::StartStreaming()
+{
+ FreeImageDescription(m_hImageDescription);
+ m_hImageDescription = MakeImageDescription();
+
+ if(!m_hImageDescription)
+ return E_FAIL;
+/*
+ Rect theSrcBounds = {0, 0};
+ Rect theDestBounds;
+ GetPortBounds((CGrafPtr)m_pImageGWorld, &theDestBounds);
+ theSrcBounds.right = (*m_hImageDescription)->width;
+ theSrcBounds.bottom = (*m_hImageDescription)->height;
+
+ MatrixRecord rMatrix;
+ RectMatrix(&rMatrix, &theSrcBounds, &theDestBounds);
+*/
+ m_outSeqID = 0;
+
+ OSErr err;
+
+ DecompressorComponent decompressor = NULL;
+
+ err = FindCodec((*m_hImageDescription)->cType, anyCodec, NULL, &decompressor);
+
+ CodecInfo info;
+ err = GetCodecInfo(&info, (*m_hImageDescription)->cType, decompressor);
+
+ err = DecompressSequenceBeginS(
+ &m_outSeqID, m_hImageDescription,
+ NULL, 0,
+ m_pImageGWorld, NULL,
+ NULL, NULL/*&rMatrix*/, srcCopy, (RgnHandle)NULL,
+ codecFlagUseImageBuffer, codecNormalQuality, anyCodec);
+
+ if(noErr != err || m_outSeqID == 0)
+ return E_FAIL;
+
+ return __super::StartStreaming();
+}
+
+
+HRESULT CQTDec::StopStreaming()
+{
+ if(m_outSeqID)
+ {
+ OSErr err = CDSequenceEnd(m_outSeqID);
+ m_outSeqID = 0;
+ }
+
+ FreeImageDescription(m_hImageDescription);
+
+ return __super::StopStreaming();
+}
+
+HRESULT CQTDec::Transform(IMediaSample* pSample, IMediaSample* pOutSample)
+{
+ HRESULT hr;
+
+ BYTE* pIn = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pIn))) return hr;
+ long len = pSample->GetActualDataLength();
+ if(len <= 0) return S_FALSE;
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
+ int size = pOutSample->GetSize();
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_pOutput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ OSErr err;
+
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+ if(S_OK == pSample->GetMediaType((AM_MEDIA_TYPE**)&pmt) && pmt)
+ {
+ CMediaType mt(*pmt);
+ DeleteMediaType(pmt), pmt = NULL;
+
+ if(mt != m_pInput->CurrentMediaType())
+ {
+ StopStreaming();
+ m_pInput->SetMediaType(&mt);
+ StartStreaming();
+ }
+ }
+ }
+
+ CodecFlags inf = codecFlagNoScreenUpdate, outf = 0;
+
+ err = DecompressSequenceFrameWhen(m_outSeqID, (Ptr)pIn, len, inf, &outf, NULL, NULL);
+// if(err == noErr)
+ {
+ PixMapHandle hPixMap = GetGWorldPixMap(m_pImageGWorld);
+ Ptr pPixels = GetPixBaseAddr(hPixMap);
+ long theRowBytes = QTGetPixMapHandleRowBytes(hPixMap);
+
+ DWORD pitch = bih.biWidth*bih.biBitCount>>3;
+
+ for(int i = 0, h = abs(bih.biHeight); i < h; i++)
+ {
+ memcpy(pOut + i*pitch, (BYTE*)pPixels + i*theRowBytes, min(pitch, theRowBytes));
+ }
+ }
+
+/*
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_pOutput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ Rect myRect = {0, 0, (short)abs(bih.biHeight), (short)bih.biWidth};
+// GraphicsImportComponent myImporter = NULL;
+// ComponentInstance myComponent = NULL;
+ GWorldPtr myImageWorld = NULL;
+ PixMapHandle myPixMap = NULL;
+ ImageDescriptionHandle myDesc = NULL;
+ Handle myHandle = NULL;
+ OSErr myErr = noErr;
+
+ myErr = QTNewGWorld(&myImageWorld, 0, &myRect, NULL, NULL, noNewDevice|keepLocal);
+// myErr = QTNewGWorldFromPtr(&myImageWorld, k422YpCbCr8PixelFormat, &myRect, NULL, NULL, 0, pOut, bih.biWidth*bih.biBitCount>>3);
+ if(myErr == noErr)
+ {
+ myPixMap = GetGWorldPixMap(myImageWorld);
+
+ if(myDesc = (ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription)))
+ {
+ ImageDescription& id = *(ImageDescription*)*myDesc;
+ memset(&id, 0, sizeof(id));
+ id.idSize = sizeof(id);
+ id.cType = DWSWAP(((VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat)->bmiHeader.biCompression);
+ id.temporalQuality = codecNormalQuality; // ?
+ id.spatialQuality = codecNormalQuality; // ?
+ id.width = (short)bih.biWidth;
+ id.height = (short)bih.biHeight;
+ id.depth = ((VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat)->bmiHeader.biBitCount;
+ id.dataSize = len;
+ id.hRes = 0;
+ id.vRes = 0;
+ id.frameCount = 1;
+ id.clutID = -1; // TODO
+
+ myErr = DecompressImage((Ptr)pIn, myDesc, myPixMap, NULL, &myRect, srcCopy, NULL);
+
+ DisposeHandle((Handle)myDesc);
+ }
+ }
+
+ if(myImageWorld) DisposeGWorld(myImageWorld);
+*/
+/*
+ // TODO
+ pOutSample->SetActualDataLength(0);
+ return S_FALSE;
+*/
+
+ return S_OK;
+}
+
+HRESULT CQTDec::CheckInputType(const CMediaType* mtIn)
+{
+ if(mtIn->majortype != MEDIATYPE_Video || mtIn->formattype != FORMAT_VideoInfo)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mtIn->pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ OSErr err;
+ ComponentInstance ci;
+ if(noErr == (err = OpenADefaultComponent('imdc', DWSWAP(bih.biCompression), &ci)))
+ {
+ err = CloseComponent(ci);
+ return S_OK;
+ }
+
+ return VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CQTDec::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return S_OK;
+ // TODO
+ return VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CQTDec::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
+
+ pAllocatorIn->GetProperties(pProperties);
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = bih.biWidth*abs(bih.biHeight)*4; // TODO
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CQTDec::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= m_mts.GetCount()) return VFW_S_NO_MORE_ITEMS;
+
+ *pmt = m_mts[iPosition];
+
+ return S_OK;
+}
diff --git a/src/filters/transform/QTDec/Copy of QTDec.h b/src/filters/transform/QTDec/Copy of QTDec.h
new file mode 100644
index 000000000..afe0d1f54
--- /dev/null
+++ b/src/filters/transform/QTDec/Copy of QTDec.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#include <afxtempl.h>
+#include "..\..\..\..\include\qt\qt.h"
+
+//
+// CQTDec
+//
+
+// {2D261619-3822-4856-A422-DC77BF0FB947}
+DEFINE_GUID(CLSID_QTDec,
+0x2d261619, 0x3822, 0x4856, 0xa4, 0x22, 0xdc, 0x77, 0xbf, 0xf, 0xb9, 0x47);
+
+class CQTDec : public CTransformFilter
+{
+ bool m_fQtInitialized;
+ CArray<CMediaType> m_mts;
+
+ bool CanDecompress(QT::OSType fourcc, bool& fYUY2, bool& fUYVY);
+ QT::ImageDescriptionHandle MakeImageDescription();
+ QT::GWorldPtr MakeGWorld();
+ void FreeImageDescription(QT::ImageDescriptionHandle& hImageDescription);
+ void FreeGWorld(QT::GWorldPtr& pImageGWorld);
+
+ QT::ImageDescriptionHandle m_hImageDescription;
+ QT::GWorldPtr m_pImageGWorld;
+ QT::ImageSequence m_outSeqID;
+
+public:
+ CQTDec(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CQTDec();
+
+#ifdef REGISTER_FILTER
+ static CUnknown* WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT* phr);
+#endif
+
+ HRESULT BreakConnect(PIN_DIRECTION dir);
+ HRESULT CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin);
+
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
+
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+};
diff --git a/src/filters/transform/QTDec/QTDec.cpp b/src/filters/transform/QTDec/QTDec.cpp
new file mode 100644
index 000000000..1bf81d72a
--- /dev/null
+++ b/src/filters/transform/QTDec/QTDec.cpp
@@ -0,0 +1,506 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <atlbase.h>
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include <initguid.h>
+#include "qtdec.h"
+
+using namespace QT;
+
+static DWORD DWSWAP(DWORD dw) {return(((dw&0xff)<<24)|((dw&0xff00)<<8)|((dw&0xff0000)>>8)|((dw&0xff000000)>>24));}
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ { L"Input", // Pins string name
+ FALSE, // Is it rendered
+ FALSE, // Is it an output
+ FALSE, // Are we allowed none
+ FALSE, // And allowed many
+ &CLSID_NULL, // Connects to filter
+ NULL, // Connects to pin
+ countof(sudPinTypesIn), // Number of types
+ sudPinTypesIn // Pin information
+ },
+ { L"Output", // Pins string name
+ FALSE, // Is it rendered
+ TRUE, // Is it an output
+ FALSE, // Are we allowed none
+ FALSE, // And allowed many
+ &CLSID_NULL, // Connects to filter
+ NULL, // Connects to pin
+ countof(sudPinTypesOut), // Number of types
+ sudPinTypesOut // Pin information
+ }
+};
+
+const AMOVIESETUP_FILTER sudFilter =
+{
+ &CLSID_QTDec, // Filter CLSID
+ L"QuickTime Decoder", // String name
+ MERIT_DO_NOT_USE/*MERIT_NORMAL*/, // Filter merit
+ countof(sudpPins), // Number of pins
+ sudpPins // Pin information
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ { L"QuickTime Decoder"
+ , &CLSID_QTDec
+ , CQTDec::CreateInstance
+ , NULL
+ , &sudFilter }
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
+
+BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
+{
+ return DllEntryPoint((HINSTANCE)hModule, dwReason, 0); // "DllMain" of the dshow baseclasses;
+}
+
+//
+// CQTDec
+//
+
+CUnknown* WINAPI CQTDec::CreateInstance(LPUNKNOWN lpunk, HRESULT* phr)
+{
+ CUnknown* punk = new CQTDec(lpunk, phr);
+ if(punk == NULL) *phr = E_OUTOFMEMORY;
+ return punk;
+}
+
+#endif
+
+CQTDec::CQTDec(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CQTDec"), lpunk, CLSID_QTDec)
+ , m_fQtInitialized(false)
+ , m_pImageGWorld(NULL)
+ , m_hImageDesc(NULL)
+ , m_cinst(NULL)
+{
+ if(phr) *phr = S_OK;
+
+ m_fQtInitialized = false;
+ if(InitializeQTML(0) != 0) {if(phr) *phr = E_FAIL; return;}
+// if(EnterMovies() != 0) {TerminateQTML(); if(phr) *phr = E_FAIL; return;}
+ m_fQtInitialized = true;
+}
+
+CQTDec::~CQTDec()
+{
+ if(m_cinst)
+ CloseComponent(m_cinst),
+ m_cinst = NULL;
+
+ if(m_hImageDesc)
+ DisposeHandle((Handle)m_hImageDesc),
+ m_hImageDesc = NULL;
+
+ FreeGWorld(m_pImageGWorld);
+
+ if(m_fQtInitialized)
+ {
+// ExitMovies();
+ TerminateQTML();
+ }
+}
+
+//
+
+GWorldPtr CQTDec::MakeGWorld()
+{
+ if(!m_pOutput->IsConnected())
+ return NULL;
+
+ const CMediaType& mt = m_pOutput->CurrentMediaType();
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ GWorldPtr pImageWorld = NULL;
+ Rect rect = {0, 0, (short)abs(bih.biHeight), (short)bih.biWidth};
+
+ OSType PixelFormat =
+ mt.subtype == MEDIASUBTYPE_YUY2 ? kYUVSPixelFormat : // 'yuvs'
+ mt.subtype == MEDIASUBTYPE_UYVY ? k2vuyPixelFormat : // '2vuy'
+ mt.subtype == MEDIASUBTYPE_RGB32 ? k32BGRAPixelFormat : // 'BGRA'
+ mt.subtype == MEDIASUBTYPE_RGB565 ? k16LE565PixelFormat : // 'L565'
+ mt.subtype == MEDIASUBTYPE_RGB555 ? k16LE555PixelFormat : // 'L555'
+ 0;
+
+ if(!PixelFormat || noErr != QTNewGWorld(&pImageWorld, PixelFormat, &rect, NULL, NULL, 0))
+ pImageWorld = NULL;
+
+ if(pImageWorld)
+ LockPixels(GetGWorldPixMap(pImageWorld));
+
+ return pImageWorld;
+}
+
+void CQTDec::FreeGWorld(GWorldPtr& pImageGWorld)
+{
+ if(pImageGWorld)
+ {
+ UnlockPixels(GetGWorldPixMap(pImageGWorld));
+ DisposeGWorld(pImageGWorld);
+ pImageGWorld = NULL;
+ }
+}
+
+bool CQTDec::InitComponent()
+{
+ if(m_cinst)
+ CloseComponent(m_cinst),
+ m_cinst = NULL;
+
+ if(m_hImageDesc)
+ DisposeHandle((Handle)m_hImageDesc),
+ m_hImageDesc = NULL;
+
+ if(!m_pInput->IsConnected())
+ return NULL;
+
+ BITMAPINFOHEADER& bih = ((VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat)->bmiHeader;
+
+ ComponentDescription cd = {decompressorComponentType, DWSWAP(bih.biCompression), 0, 0, 0};
+ Component c = FindNextComponent(0, &cd);
+ if(!c) return(false);
+
+ m_cinst = OpenComponent(c);
+ if(!m_cinst) return(false);
+
+ ComponentResult cres;
+
+ ImageSubCodecDecompressCapabilities icap;
+ memset(&icap, 0, sizeof(icap));
+ cres = ImageCodecInitialize(m_cinst, &icap);
+
+ CodecInfo cinfo;
+ memset(&cinfo, 0, sizeof(cinfo));
+ cres = ImageCodecGetCodecInfo(m_cinst, &cinfo);
+
+ m_hImageDesc = (ImageDescriptionHandle)NewHandleClear(sizeof(ImageDescription));
+ if(!m_hImageDesc)
+ return(false);
+
+ (**m_hImageDesc).idSize = sizeof(ImageDescription);
+ (**m_hImageDesc).cType = DWSWAP(bih.biCompression);
+ (**m_hImageDesc).temporalQuality = 0;
+ (**m_hImageDesc).spatialQuality = codecNormalQuality;
+ (**m_hImageDesc).width = (short)bih.biWidth;
+ (**m_hImageDesc).height = (short)abs(bih.biHeight);
+ (**m_hImageDesc).hRes = 72 << 16;
+ (**m_hImageDesc).vRes = 72 << 16;
+ (**m_hImageDesc).frameCount = 1; // ?
+ (**m_hImageDesc).depth = bih.biBitCount; // should be 24 for unknown/compressed types
+ (**m_hImageDesc).clutID = -1;
+
+ memset(&m_cdpar, 0, sizeof(m_cdpar));
+ m_cdpar.imageDescription = m_hImageDesc;
+ m_cdpar.startLine = 0;
+ m_cdpar.stopLine = (**m_hImageDesc).height;
+ m_cdpar.frameNumber = 1;
+ m_cdpar.matrixFlags = 0;
+ m_cdpar.matrixType = 0;
+ m_cdpar.matrix = 0;
+ m_cdpar.capabilities = &m_ccap;
+ memset(&m_ccap, 0, sizeof(m_ccap));
+ m_cdpar.accuracy = codecNormalQuality;
+ m_cdpar.port = m_pImageGWorld;
+ Rect rect = {0, 0, (**m_hImageDesc).height, (**m_hImageDesc).width};
+ m_cdpar.srcRect = rect;
+ m_cdpar.transferMode = srcCopy;
+ m_cdpar.dstPixMap = **GetGWorldPixMap(m_pImageGWorld);
+
+ cres = ImageCodecPreDecompress(m_cinst, &m_cdpar);
+
+ return(true);
+}
+
+//
+
+HRESULT CQTDec::BreakConnect(PIN_DIRECTION dir)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ m_mts.RemoveAll();
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ FreeGWorld(m_pImageGWorld);
+ }
+
+ return __super::BreakConnect(dir);
+}
+
+HRESULT CQTDec::CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ m_mts.RemoveAll();
+
+ VIDEOINFOHEADER* vihin = (VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bihin = vihin->bmiHeader;
+
+ CMediaType mt;
+ mt.majortype = MEDIATYPE_Video;
+ mt.subtype = MEDIASUBTYPE_None;
+ mt.formattype = FORMAT_VideoInfo;
+ mt.bFixedSizeSamples = TRUE;
+ mt.bTemporalCompression = FALSE;
+ mt.lSampleSize = 0;
+ mt.pUnk = NULL;
+
+ VIDEOINFOHEADER vih;
+ memset(&vih, 0, sizeof(vih));
+ vih.AvgTimePerFrame = vihin->AvgTimePerFrame;
+ vih.rcSource = vihin->rcSource;
+ vih.rcTarget = vihin->rcTarget;
+ vih.dwBitRate = vihin->dwBitRate;
+ vih.dwBitErrorRate = vihin->dwBitErrorRate;
+
+ BITMAPINFOHEADER& bih = vih.bmiHeader;
+ bih.biSize = sizeof(bih);
+ bih.biWidth = bihin.biWidth;
+ bih.biHeight = abs(bihin.biHeight);
+ bih.biPlanes = 1;
+ bih.biXPelsPerMeter = bih.biYPelsPerMeter = 0;
+ bih.biClrUsed = bih.biClrImportant = 0;
+
+// if(fRGB32) // always can decompress to (?)
+ {
+ VIDEOINFOHEADER* vihout = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memcpy(vihout, &vih, sizeof(vih));
+
+ BITMAPINFOHEADER& bihout = vihout->bmiHeader;
+ bihout.biBitCount = 32;
+ bihout.biSizeImage = bihout.biWidth*abs(bihout.biHeight)*bihout.biBitCount>>3;
+
+ mt.subtype = MEDIASUBTYPE_RGB32;
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_BITFIELDS;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = -bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_RGB;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+ }
+
+// if(fRGB16) // always can decompress to (?)
+ {
+ VIDEOINFOHEADER* vihout = (VIDEOINFOHEADER*)mt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memcpy(vihout, &vih, sizeof(vih));
+
+ BITMAPINFOHEADER& bihout = vihout->bmiHeader;
+ bihout.biBitCount = 16;
+ bihout.biSizeImage = bihout.biWidth*abs(bihout.biHeight)*bihout.biBitCount>>3;
+
+ mt.subtype = MEDIASUBTYPE_RGB565;
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_BITFIELDS;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = -bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_RGB;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ mt.subtype = MEDIASUBTYPE_RGB555;
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_BITFIELDS;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = -bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biCompression = BI_RGB;
+ ((VIDEOINFOHEADER*)mt.pbFormat)->bmiHeader.biHeight = bih.biHeight;
+ CorrectMediaType(&mt);
+ m_mts.Add(mt);
+ }
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ FreeGWorld(m_pImageGWorld);
+ m_pImageGWorld = MakeGWorld();
+ }
+
+ return __super::CompleteConnect(dir, pReceivePin);
+}
+
+HRESULT CQTDec::Transform(IMediaSample* pSample, IMediaSample* pOutSample)
+{
+ HRESULT hr;
+
+ BYTE* pIn = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pIn))) return hr;
+ long len = pSample->GetActualDataLength();
+ if(len <= 0) return S_FALSE;
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
+ int size = pOutSample->GetSize();
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_pOutput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ bool fInitialized = true;
+
+ if(m_cinst)
+ {
+ AM_MEDIA_TYPE* pmt = NULL;
+ if(S_OK == pSample->GetMediaType((AM_MEDIA_TYPE**)&pmt) && pmt)
+ {
+ CMediaType mt(*pmt);
+ DeleteMediaType(pmt), pmt = NULL;
+
+ if(mt != m_pInput->CurrentMediaType())
+ {
+ m_pInput->SetMediaType(&mt);
+ fInitialized = InitComponent();
+ }
+ }
+ }
+ else
+ {
+ fInitialized = InitComponent();
+ }
+
+ if(!fInitialized)
+ return E_FAIL;
+
+ m_cdpar.data = (Ptr)pIn;
+ m_cdpar.bufferSize = len;
+ (**m_cdpar.imageDescription).dataSize = len;
+ ComponentResult cres = ImageCodecBandDecompress(m_cinst, &m_cdpar);
+ m_cdpar.frameNumber++;
+
+ if(cres == noErr)
+ {
+ PixMapHandle hPixMap = GetGWorldPixMap(m_pImageGWorld);
+ Ptr pPixels = GetPixBaseAddr(hPixMap);
+ long theRowBytes = QTGetPixMapHandleRowBytes(hPixMap);
+
+ DWORD pitch = bih.biWidth*bih.biBitCount>>3;
+
+ for(int i = 0, h = abs(bih.biHeight); i < h; i++)
+ {
+ memcpy(pOut + i*pitch, (BYTE*)pPixels + i*theRowBytes, min(pitch, theRowBytes));
+ }
+ }
+
+ return S_OK;
+}
+
+HRESULT CQTDec::CheckInputType(const CMediaType* mtIn)
+{
+ if(mtIn->majortype != MEDIATYPE_Video || mtIn->formattype != FORMAT_VideoInfo)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mtIn->pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ OSErr err;
+ ComponentInstance ci;
+ if(noErr == (err = OpenADefaultComponent('imdc', DWSWAP(bih.biCompression), &ci)))
+ {
+ err = CloseComponent(ci);
+ return S_OK;
+ }
+
+ return VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CQTDec::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return S_OK;
+ // TODO
+ return VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CQTDec::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
+
+ pAllocatorIn->GetProperties(pProperties);
+
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)m_pInput->CurrentMediaType().pbFormat;
+ BITMAPINFOHEADER& bih = vih->bmiHeader;
+
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = bih.biWidth*abs(bih.biHeight)*4; // TODO
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CQTDec::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= m_mts.GetCount()) return VFW_S_NO_MORE_ITEMS;
+
+ *pmt = m_mts[iPosition];
+
+ return S_OK;
+}
diff --git a/src/filters/transform/QTDec/QTDec.def b/src/filters/transform/QTDec/QTDec.def
new file mode 100644
index 000000000..f8822eac2
--- /dev/null
+++ b/src/filters/transform/QTDec/QTDec.def
@@ -0,0 +1,7 @@
+LIBRARY "QTDec.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/transform/QTDec/QTDec.h b/src/filters/transform/QTDec/QTDec.h
new file mode 100644
index 000000000..37f7fc3b0
--- /dev/null
+++ b/src/filters/transform/QTDec/QTDec.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <afxtempl.h>
+#include "..\..\..\..\include\qt\qt.h"
+
+//
+// CQTDec
+//
+
+// {2D261619-3822-4856-A422-DC77BF0FB947}
+DEFINE_GUID(CLSID_QTDec,
+0x2d261619, 0x3822, 0x4856, 0xa4, 0x22, 0xdc, 0x77, 0xbf, 0xf, 0xb9, 0x47);
+
+class CQTDec : public CTransformFilter
+{
+ bool m_fQtInitialized;
+ CArray<CMediaType> m_mts;
+
+ QT::GWorldPtr m_pImageGWorld;
+ QT::GWorldPtr MakeGWorld();
+ void FreeGWorld(QT::GWorldPtr& pImageGWorld);
+
+ QT::ComponentInstance m_cinst;
+ QT::CodecCapabilities m_ccap;
+ QT::CodecDecompressParams m_cdpar;
+ QT::ImageDescriptionHandle m_hImageDesc;
+ bool InitComponent();
+
+public:
+ CQTDec(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CQTDec();
+
+#ifdef REGISTER_FILTER
+ static CUnknown* WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT* phr);
+#endif
+
+ HRESULT BreakConnect(PIN_DIRECTION dir);
+ HRESULT CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin);
+
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+};
diff --git a/src/filters/transform/QTDec/QTDec.sln b/src/filters/transform/QTDec/QTDec.sln
new file mode 100644
index 000000000..f45703049
--- /dev/null
+++ b/src/filters/transform/QTDec/QTDec.sln
@@ -0,0 +1,59 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QTDec", "QTDec.vcproj", "{6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Debug.ActiveCfg = Debug|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Debug.Build.0 = Debug|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Debug lib.ActiveCfg = Debug lib|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Debug lib.Build.0 = Debug lib|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Release.ActiveCfg = Release|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Release.Build.0 = Release|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Release lib.ActiveCfg = Debug lib|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Release lib.Build.0 = Debug lib|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Release Unicode.Build.0 = Release Unicode|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/transform/QTDec/QTDec.vcproj b/src/filters/transform/QTDec/QTDec.vcproj
new file mode 100644
index 000000000..1310d56a0
--- /dev/null
+++ b/src/filters/transform/QTDec/QTDec.vcproj
@@ -0,0 +1,473 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="QTDec"
+ ProjectGUID="{6BB236CC-7827-49C0-A6C7-DA5FEE7BACB2}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="qtmlClient.lib dsutilD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib;..\..\..\..\lib\qt6"
+ IgnoreDefaultLibraryNames="MSVCRT;LIBCMT"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="qtmlClient.lib dsutilDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib;..\..\..\..\lib\qt6"
+ IgnoreDefaultLibraryNames="MSVCRT;LIBCMT"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="qtmlClient.lib dsutilR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib;..\..\..\..\lib\qt6"
+ IgnoreDefaultLibraryNames="MSVCRT;LIBCMT"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;REGISTER_FILTER"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="qtmlClient.lib dsutilRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="..\..\..\..\lib;..\..\..\..\lib\qt6"
+ IgnoreDefaultLibraryNames="MSVCRT;LIBCMT"
+ ModuleDefinitionFile="$(ProjectName).def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="QTDec.cpp">
+ </File>
+ <File
+ RelativePath="QTDec.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="QTDec.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/QTDec/stdafx.cpp b/src/filters/transform/QTDec/stdafx.cpp
new file mode 100644
index 000000000..12d18da8e
--- /dev/null
+++ b/src/filters/transform/QTDec/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// QTDec.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/transform/QTDec/stdafx.h b/src/filters/transform/QTDec/stdafx.h
new file mode 100644
index 000000000..25d525b95
--- /dev/null
+++ b/src/filters/transform/QTDec/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2005 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
+#include "..\..\..\..\include\qt\qt.h"
diff --git a/src/filters/transform/avi2ac3filter/AVI2AC3Filter.cpp b/src/filters/transform/avi2ac3filter/AVI2AC3Filter.cpp
new file mode 100644
index 000000000..99840a1f3
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/AVI2AC3Filter.cpp
@@ -0,0 +1,521 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <atlbase.h>
+#include "avi2ac3filter.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DOLBY_AC3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DTS},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CAVI2AC3Filter), L"AVI<->AC3/DTS", MERIT_UNLIKELY, countof(sudpPins), sudpPins}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CAVI2AC3Filter>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CAVI2AC3Filter
+//
+
+CAVI2AC3Filter::CAVI2AC3Filter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CAVI2AC3Filter"), lpunk, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+}
+
+CAVI2AC3Filter::~CAVI2AC3Filter()
+{
+}
+
+HRESULT CAVI2AC3Filter::Transform(IMediaSample* pSample, IMediaSample* pOutSample)
+{
+ HRESULT hr;
+
+ BYTE* pIn = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pIn))) return hr;
+ BYTE* pInOrg = pIn;
+
+ long len = pSample->GetActualDataLength();
+ if(len <= 0) return S_FALSE;
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
+ BYTE* pOutOrg = pOut;
+
+ int size = pOutSample->GetSize();
+
+ if((CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
+ && (CheckWAVEAC3(&m_pOutput->CurrentMediaType()) || CheckWAVEDTS(&m_pOutput->CurrentMediaType())))
+ {
+ if(*(DWORD*)pIn == 0xBA010000)
+ {
+ pIn += 14;
+ }
+
+ if(*(DWORD*)pIn == 0xBD010000)
+ {
+ pIn += 8 + 1 + pIn[8] + 1 + 3;
+ }
+
+ len -= (pInOrg - pIn);
+
+ if(size < len) return E_FAIL;
+
+ memcpy(pOut, pIn, len);
+ pOut += len;
+ }
+ else if((CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
+ && (CheckAC3(&m_pOutput->CurrentMediaType()) || CheckDTS(&m_pOutput->CurrentMediaType())))
+ {
+ if((m_pOutput->CurrentMediaType().majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
+ || m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES)
+ && (len + 12 + 3) >= 0x10000) // damn, this can happen if the interleave time is too big
+ {
+ REFERENCE_TIME rtStart = 0, rtStop = 1;
+ bool fHasTime = (S_OK == pSample->GetTime(&rtStart, &rtStop));
+
+ bool fDiscontinuity = (S_OK == pOutSample->IsDiscontinuity());
+
+ int pos = 0;
+ while(pos < len)
+ {
+ int curlen = min(len - pos, 2013);
+ pos += 2013;
+
+ CComPtr<IMediaSample> pOutSample;
+ hr = InitializeOutputSample(pSample, &pOutSample);
+
+ if(fDiscontinuity)
+ {
+ if(fHasTime)
+ {
+ rtStop = rtStart + (rtStop - rtStart) * curlen / len;
+ pOutSample->SetTime(&rtStart, &rtStop);
+ }
+
+ fDiscontinuity = false;
+ }
+ else
+ {
+ pOutSample->SetTime(NULL, NULL);
+ pOutSample->SetDiscontinuity(FALSE);
+ }
+
+ BYTE* pOut = NULL;
+ if(FAILED(hr = pOutSample->GetPointer(&pOut))) return hr;
+ BYTE* pOutOrg = pOut;
+
+ int size = pOutSample->GetSize();
+
+ const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
+ const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
+
+ if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ {
+ if(size < curlen + 32 + 3) return E_FAIL;
+
+ BYTE PESHeader[] =
+ {
+ 0x00,0x00,0x01,0xBA, // PES id
+ 0x44,0x00,0x04,0x00,0x04,0x01, // SCR (0)
+ 0x01,0x89,0xC3,0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
+ };
+
+ memcpy(pOut, &PESHeader, sizeof(PESHeader));
+ pOut += sizeof(PESHeader);
+
+ majortype = &MEDIATYPE_MPEG2_PES;
+ }
+
+ if(*majortype == MEDIATYPE_MPEG2_PES)
+ {
+ if(size < curlen + 20 + 3) return E_FAIL;
+
+ BYTE Private1Header[] =
+ {
+ 0x00,0x00,0x01,0xBD, // private stream 1 id
+ 0x07,0xEC, // packet length (TODO: modify it later)
+ 0x81,0x80, // marker, original, PTS - flags
+ 0x08, // packet data starting offset
+ 0x21,0x00,0x01,0x00,0x01, // PTS (0)
+ 0xFF,0xFF,0xFF, // stuffing
+ 0x80, // stream id (0)
+ 0x01,0x00,0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
+ };
+
+ int packetlen = curlen + 12 + 3;
+ ASSERT(packetlen <= 0xffff);
+ Private1Header[4] = (packetlen>>8)&0xff;
+ Private1Header[5] = packetlen&0xff;
+
+ if(*subtype == MEDIASUBTYPE_DTS)
+ {
+ Private1Header[17] += 8;
+ }
+
+ if(*subtype == MEDIASUBTYPE_DOLBY_AC3)
+ {
+ for(int i = 0; i < curlen; i++)
+ {
+ if(*(DWORD*)&pIn[i] == 0x770B)
+ {
+ i++;
+ Private1Header[19] = (i>>8)&0xff;
+ Private1Header[20] = i&0xff;
+ break;
+ }
+ }
+ }
+ else if(*subtype == MEDIASUBTYPE_DTS)
+ {
+ for(int i = 0; i < curlen; i++)
+ {
+ if(*(DWORD*)&pIn[i] == 0x0180FE7F)
+ {
+ i++;
+ Private1Header[19] = (i>>8)&0xff;
+ Private1Header[20] = i&0xff;
+ break;
+ }
+ }
+ }
+
+ memcpy(pOut, &Private1Header, sizeof(Private1Header));
+ pOut += sizeof(Private1Header);
+
+ majortype = &MEDIATYPE_Audio;
+ }
+
+ if(*majortype == MEDIATYPE_Audio)
+ {
+ if(size < curlen) return E_FAIL;
+ memcpy(pOut, pIn, curlen);
+ pIn += curlen;
+ pOut += curlen;
+ }
+
+ pOutSample->SetActualDataLength(pOut - pOutOrg);
+
+ hr = m_pOutput->Deliver(pOutSample);
+ }
+
+ return S_FALSE;
+ }
+ else // phew, we can do the easier way
+ {
+ const GUID* majortype = &m_pOutput->CurrentMediaType().majortype;
+ const GUID* subtype = &m_pOutput->CurrentMediaType().subtype;
+
+ if(*majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ {
+ if(size < len + 32 + 3) return E_FAIL;
+
+ BYTE PESHeader[] =
+ {
+ 0x00,0x00,0x01,0xBA, // PES id
+ 0x44,0x00,0x04,0x00,0x04,0x01, // SCR (0)
+ 0x01,0x89,0xC3,0xF8, // mux rate (1260000 bytes/sec, 22bits), marker (2bits), reserved (~0, 5bits), stuffing (0, 3bits)
+ };
+
+ memcpy(pOut, &PESHeader, sizeof(PESHeader));
+ pOut += sizeof(PESHeader);
+
+ majortype = &MEDIATYPE_MPEG2_PES;
+ }
+
+ if(*majortype == MEDIATYPE_MPEG2_PES)
+ {
+ if(size < len + 20 + 3) return E_FAIL;
+
+ BYTE Private1Header[] =
+ {
+ 0x00,0x00,0x01,0xBD, // private stream 1 id
+ 0x07,0xEC, // packet length (TODO: modify it later)
+ 0x81,0x80, // marker, original, PTS - flags
+ 0x08, // packet data starting offset
+ 0x21,0x00,0x01,0x00,0x01, // PTS (0)
+ 0xFF,0xFF,0xFF, // stuffing
+ 0x80, // stream id (0)
+ 0x01,0x00,0x01, // no idea about the first byte, the sencond+third seem to show the ac3/dts header sync offset plus one (dvd2avi doesn't output it to the ac3/dts file so we have to put it back)
+ };
+
+ int packetlen = len + 12 + 3;
+ ASSERT(packetlen <= 0xffff);
+ Private1Header[4] = (packetlen>>8)&0xff;
+ Private1Header[5] = packetlen&0xff;
+
+ if(*subtype == MEDIASUBTYPE_DTS)
+ {
+ Private1Header[17] += 8;
+ }
+
+ memcpy(pOut, &Private1Header, sizeof(Private1Header));
+ pOut += sizeof(Private1Header);
+
+ majortype = &MEDIATYPE_Audio;
+ }
+
+ if(*majortype == MEDIATYPE_Audio)
+ {
+ if(size < len) return E_FAIL;
+
+ memcpy(pOut, pIn, len);
+ pIn += len;
+ pOut += len;
+ }
+ }
+ }
+ else
+ {
+ return E_FAIL;
+ }
+
+ pOutSample->SetActualDataLength(pOut - pOutOrg);
+
+ return S_OK;
+}
+
+bool CAVI2AC3Filter::CheckAC3(const CMediaType* pmt)
+{
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DOLBY_AC3;
+}
+
+bool CAVI2AC3Filter::CheckDTS(const CMediaType* pmt)
+{
+ return (pmt->majortype == MEDIATYPE_Audio
+ || pmt->majortype == MEDIATYPE_MPEG2_PES
+ || pmt->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK)
+ && pmt->subtype == MEDIASUBTYPE_DTS;
+}
+
+bool CAVI2AC3Filter::CheckWAVEAC3(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DOLBY_AC3;
+}
+
+bool CAVI2AC3Filter::CheckWAVEDTS(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Audio
+ && pmt->subtype == MEDIASUBTYPE_WAVE_DTS
+ && pmt->formattype == FORMAT_WaveFormatEx
+ && ((WAVEFORMATEX*)pmt->pbFormat)->wFormatTag == WAVE_FORMAT_DVD_DTS;
+}
+
+HRESULT CAVI2AC3Filter::CheckInputType(const CMediaType* mtIn)
+{
+ bool fWaveFormatEx = !!(mtIn->formattype == FORMAT_WaveFormatEx);
+
+ return CheckAC3(mtIn) && fWaveFormatEx || CheckDTS(mtIn) && fWaveFormatEx
+ || CheckWAVEAC3(mtIn) || CheckWAVEDTS(mtIn)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CAVI2AC3Filter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return CheckAC3(mtIn) && CheckWAVEAC3(mtOut)
+ || CheckWAVEAC3(mtIn) && CheckAC3(mtOut)
+ || CheckDTS(mtIn) && CheckWAVEDTS(mtOut)
+ || CheckWAVEDTS(mtIn) && CheckDTS(mtOut)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CAVI2AC3Filter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
+
+ pAllocatorIn->GetProperties(pProperties);
+
+ pProperties->cBuffers = 2;
+ pProperties->cbBuffer = max(pProperties->cbBuffer, 1024*1024); // this should be enough...
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CAVI2AC3Filter::GetMediaType(int iPosition, CMediaType* pMediaType)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ const GUID& majortype = m_pInput->CurrentMediaType().majortype;
+ const GUID& subtype = m_pInput->CurrentMediaType().subtype;
+
+ if(CheckAC3(&m_pInput->CurrentMediaType()) || CheckDTS(&m_pInput->CurrentMediaType()))
+ {
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pMediaType->majortype = MEDIATYPE_Audio;
+
+ pMediaType->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->nAvgBytesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nAvgBytesPerSec;
+ wfe->nSamplesPerSec = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->nSamplesPerSec;
+ wfe->wBitsPerSample = ((WAVEFORMATEX*)m_pInput->CurrentMediaType().pbFormat)->wBitsPerSample;
+ wfe->nChannels = 2;
+ wfe->nBlockAlign = 1;
+
+ if(subtype == MEDIASUBTYPE_DOLBY_AC3)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_WAVE_DOLBY_AC3;
+ wfe->wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+ }
+ else if(subtype == MEDIASUBTYPE_DTS)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_WAVE_DTS;
+ wfe->wFormatTag = WAVE_FORMAT_DVD_DTS;
+ }
+ else
+ {
+ return E_INVALIDARG;
+ }
+ }
+ else if(CheckWAVEAC3(&m_pInput->CurrentMediaType()) || CheckWAVEDTS(&m_pInput->CurrentMediaType()))
+ {
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 4) return VFW_S_NO_MORE_ITEMS;
+
+ if(subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_DOLBY_AC3;
+
+ pMediaType->formattype = FORMAT_WaveFormatEx;
+ DOLBYAC3WAVEFORMAT* wfe = (DOLBYAC3WAVEFORMAT*)pMediaType->AllocFormatBuffer(sizeof(DOLBYAC3WAVEFORMAT));
+ memset(wfe, 0, sizeof(DOLBYAC3WAVEFORMAT));
+ // unfortunately we can't tell what we are going to get in transform,
+ // so we just set the most common values and hope that the ac3 decoder
+ // is flexible enough (it is usually :) to find out these from the bitstream
+ wfe->wfx.cbSize = sizeof(DOLBYAC3WAVEFORMAT) - sizeof(WAVEFORMATEX);
+ wfe->wfx.wFormatTag = WAVE_FORMAT_DOLBY_AC3;
+ wfe->wfx.nSamplesPerSec = 48000;
+ wfe->wfx.nChannels = 6;
+ wfe->bBigEndian = TRUE;
+ }
+ else if(subtype == MEDIASUBTYPE_WAVE_DTS)
+ {
+ pMediaType->subtype = MEDIASUBTYPE_DTS;
+
+ pMediaType->formattype = FORMAT_WaveFormatEx;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)pMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
+ memset(wfe, 0, sizeof(WAVEFORMATEX));
+ // same case as with ac3, but this time we don't even know the structure
+ wfe->cbSize = sizeof(WAVEFORMATEX);
+ wfe->wFormatTag = WAVE_FORMAT_PCM;
+ wfe->nSamplesPerSec = 48000;
+ wfe->nChannels = 6;
+ }
+ else
+ {
+ return E_INVALIDARG;
+ }
+
+ switch(iPosition)
+ {
+ case 0:
+ pMediaType->majortype = MEDIATYPE_Audio;
+ break;
+ case 1:
+ pMediaType->ResetFormatBuffer();
+ pMediaType->formattype = FORMAT_None;
+ case 2:
+ pMediaType->majortype = MEDIATYPE_MPEG2_PES;
+ break;
+ case 3:
+ pMediaType->ResetFormatBuffer();
+ pMediaType->formattype = FORMAT_None;
+ case 4:
+ pMediaType->majortype = MEDIATYPE_DVD_ENCRYPTED_PACK;
+ break;
+ default:
+ return E_INVALIDARG;
+ }
+ }
+ else
+ {
+ return VFW_S_NO_MORE_ITEMS;
+ }
+
+ return S_OK;
+}
diff --git a/src/filters/transform/avi2ac3filter/AVI2AC3Filter.def b/src/filters/transform/avi2ac3filter/AVI2AC3Filter.def
new file mode 100644
index 000000000..dd8c5cd08
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/AVI2AC3Filter.def
@@ -0,0 +1,7 @@
+LIBRARY "AVI2AC3Filter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/transform/avi2ac3filter/AVI2AC3Filter.h b/src/filters/transform/avi2ac3filter/AVI2AC3Filter.h
new file mode 100644
index 000000000..30d36fa51
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/AVI2AC3Filter.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+/* AC3 audio
+
+ wFormatTag WAVE_FORMAT_DOLBY_AC3
+ nChannels 1 -6 channels valid
+ nSamplesPerSec 48000, 44100, 32000
+ nAvgByesPerSec 4000 to 80000
+ nBlockAlign 128 - 3840
+ wBitsPerSample Up to 24 bits - (in the original)
+
+*/
+
+typedef struct tagDOLBYAC3WAVEFORMAT
+{
+ WAVEFORMATEX wfx;
+ BYTE bBigEndian; // TRUE = Big Endian, FALSE little endian
+ BYTE bsid;
+ BYTE lfeon;
+ BYTE copyrightb;
+ BYTE nAuxBitsCode; // Aux bits per frame
+} DOLBYAC3WAVEFORMAT;
+
+//
+// CAVI2AC3Filter
+//
+
+[uuid("93230DD0-7B3C-4efb-AFBB-DC380FEC9E6B")]
+class CAVI2AC3Filter : public CTransformFilter
+{
+ bool CheckAC3(const CMediaType* pmt);
+ bool CheckDTS(const CMediaType* pmt);
+ bool CheckWAVEAC3(const CMediaType* pmt);
+ bool CheckWAVEDTS(const CMediaType* pmt);
+
+public:
+ CAVI2AC3Filter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CAVI2AC3Filter();
+
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+};
diff --git a/src/filters/transform/avi2ac3filter/avi2ac3filter.rc b/src/filters/transform/avi2ac3filter/avi2ac3filter.rc
new file mode 100644
index 000000000..a3168aeef
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/avi2ac3filter.rc
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040e04b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "AVI <-> AC3/DTS Converter"
+ VALUE "FileVersion", "1, 0, 0, 0"
+ VALUE "InternalName", "AVI2AC3Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "AVI2AC3Filter.ax"
+ VALUE "ProductName", "AVI2AC3Filter"
+ VALUE "ProductVersion", "1, 0, 0, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x40e, 1200
+ END
+END
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/transform/avi2ac3filter/avi2ac3filter.sln b/src/filters/transform/avi2ac3filter/avi2ac3filter.sln
new file mode 100644
index 000000000..a46629c80
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/avi2ac3filter.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "avi2ac3filter", "avi2ac3filter.vcproj", "{339A4575-E25B-45D6-94A1-D835891740B8}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug.ActiveCfg = Debug|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug.Build.0 = Debug|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug lib.ActiveCfg = Debug lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug lib.Build.0 = Debug lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release.ActiveCfg = Release|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release.Build.0 = Release|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release lib.ActiveCfg = Release lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release lib.Build.0 = Release lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode.Build.0 = Release Unicode|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {339A4575-E25B-45D6-94A1-D835891740B8}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/transform/avi2ac3filter/avi2ac3filter.vcproj b/src/filters/transform/avi2ac3filter/avi2ac3filter.vcproj
new file mode 100644
index 000000000..52dfd4131
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/avi2ac3filter.vcproj
@@ -0,0 +1,540 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="avi2ac3filter"
+ ProjectGUID="{339A4575-E25B-45D6-94A1-D835891740B8}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AVI2AC3Filter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AVI2AC3Filter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AVI2AC3Filter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AVI2AC3Filter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="AVI2AC3Filter.cpp">
+ </File>
+ <File
+ RelativePath="AVI2AC3Filter.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="AVI2AC3Filter.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCCustomBuildTool"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\avi2ac3filter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/avi2ac3filter/avi2ac3filter_vs2005.vcproj b/src/filters/transform/avi2ac3filter/avi2ac3filter_vs2005.vcproj
new file mode 100644
index 000000000..2db0f8419
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/avi2ac3filter_vs2005.vcproj
@@ -0,0 +1,793 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="avi2ac3filter"
+ ProjectGUID="{339A4575-E25B-45D6-94A1-D835891740B8}"
+ RootNamespace="avi2ac3filter"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AVI2AC3Filter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AVI2AC3Filter.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AVI2AC3Filter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="AVI2AC3Filter.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="AVI2AC3Filter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="AVI2AC3Filter.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="AVI2AC3Filter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\avi2ac3filter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/avi2ac3filter/avi2ac3filter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/avi2ac3filter/avi2ac3filter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/avi2ac3filter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/avi2ac3filter/resource.h b/src/filters/transform/avi2ac3filter/resource.h
new file mode 100644
index 000000000..599923e8b
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by avi2ac3filter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/transform/avi2ac3filter/stdafx.cpp b/src/filters/transform/avi2ac3filter/stdafx.cpp
new file mode 100644
index 000000000..0ad87fbc7
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/stdafx.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// avi2ac3filter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
+
+#include <streams.h>
diff --git a/src/filters/transform/avi2ac3filter/stdafx.h b/src/filters/transform/avi2ac3filter/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/transform/avi2ac3filter/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/transform/basevideofilter/BaseVideoFilter.cpp b/src/filters/transform/basevideofilter/BaseVideoFilter.cpp
new file mode 100644
index 000000000..3b7273231
--- /dev/null
+++ b/src/filters/transform/basevideofilter/BaseVideoFilter.cpp
@@ -0,0 +1,666 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include <mmintrin.h>
+#include "BaseVideoFilter.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+//
+// CBaseVideoFilter
+//
+
+CBaseVideoFilter::CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr, REFCLSID clsid, long cBuffers)
+ : CTransformFilter(pName, lpunk, clsid)
+ , m_cBuffers(cBuffers)
+{
+ if(phr) *phr = S_OK;
+
+ if(!(m_pInput = new CBaseVideoInputPin(NAME("CBaseVideoInputPin"), this, phr, L"Video"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
+
+ if(!(m_pOutput = new CBaseVideoOutputPin(NAME("CBaseVideoOutputPin"), this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
+
+ m_wout = m_win = m_w = 0;
+ m_hout = m_hin = m_h = 0;
+ m_arxout = m_arxin = m_arx = 0;
+ m_aryout = m_aryin = m_ary = 0;
+}
+
+CBaseVideoFilter::~CBaseVideoFilter()
+{
+}
+
+int CBaseVideoFilter::GetPinCount()
+{
+ return 2;
+}
+
+CBasePin* CBaseVideoFilter::GetPin(int n)
+{
+ switch(n)
+ {
+ case 0: return m_pInput;
+ case 1: return m_pOutput;
+ }
+ return NULL;
+}
+
+HRESULT CBaseVideoFilter::Receive(IMediaSample* pIn)
+{
+ _mm_empty(); // just for safety
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr;
+
+ AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
+ if(pProps->dwStreamId != AM_STREAM_MEDIA)
+ return m_pOutput->Deliver(pIn);
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pInput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ if(FAILED(hr = Transform(pIn)))
+ return hr;
+
+ return S_OK;
+}
+
+HRESULT CBaseVideoFilter::GetDeliveryBuffer(int w, int h, IMediaSample** ppOut)
+{
+ CheckPointer(ppOut, E_POINTER);
+
+ HRESULT hr;
+
+ if(FAILED(hr = ReconnectOutput(w, h)))
+ return hr;
+
+ if(FAILED(hr = m_pOutput->GetDeliveryBuffer(ppOut, NULL, NULL, 0)))
+ return hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED((*ppOut)->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt = *pmt;
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ (*ppOut)->SetDiscontinuity(FALSE);
+ (*ppOut)->SetSyncPoint(TRUE);
+
+ // FIXME: hell knows why but without this the overlay mixer starts very skippy
+ // (don't enable this for other renderers, the old for example will go crazy if you do)
+ if(GetCLSID(m_pOutput->GetConnected()) == CLSID_OverlayMixer)
+ (*ppOut)->SetDiscontinuity(TRUE);
+
+ return S_OK;
+}
+
+HRESULT CBaseVideoFilter::ReconnectOutput(int w, int h)
+{
+ CMediaType& mt = m_pOutput->CurrentMediaType();
+
+ int w_org = m_w;
+ int h_org = m_h;
+
+ bool fForceReconnection = false;
+ if(w != m_w || h != m_h)
+ {
+ fForceReconnection = true;
+ m_w = w;
+ m_h = h;
+ }
+
+ HRESULT hr = S_OK;
+
+ if(fForceReconnection || m_w != m_wout || m_h != m_hout || m_arx != m_arxout || m_ary != m_aryout)
+ {
+ if(GetCLSID(m_pOutput->GetConnected()) == CLSID_VideoRenderer)
+ {
+ NotifyEvent(EC_ERRORABORT, 0, 0);
+ return E_FAIL;
+ }
+
+ BITMAPINFOHEADER* bmi = NULL;
+
+ if(mt.formattype == FORMAT_VideoInfo)
+ {
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.Format();
+ SetRect(&vih->rcSource, 0, 0, m_w, m_h);
+ SetRect(&vih->rcTarget, 0, 0, m_w, m_h);
+ bmi = &vih->bmiHeader;
+ bmi->biXPelsPerMeter = m_w * m_ary;
+ bmi->biYPelsPerMeter = m_h * m_arx;
+ }
+ else if(mt.formattype == FORMAT_VideoInfo2)
+ {
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)mt.Format();
+ SetRect(&vih->rcSource, 0, 0, m_w, m_h);
+ SetRect(&vih->rcTarget, 0, 0, m_w, m_h);
+ bmi = &vih->bmiHeader;
+ vih->dwPictAspectRatioX = m_arx;
+ vih->dwPictAspectRatioY = m_ary;
+ }
+
+ bmi->biWidth = m_w;
+ bmi->biHeight = m_h;
+ bmi->biSizeImage = m_w*m_h*bmi->biBitCount>>3;
+
+ hr = m_pOutput->GetConnected()->QueryAccept(&mt);
+ ASSERT(SUCCEEDED(hr)); // should better not fail, after all "mt" is the current media type, just with a different resolution
+HRESULT hr1 = 0, hr2 = 0;
+ CComPtr<IMediaSample> pOut;
+ if(SUCCEEDED(hr1 = m_pOutput->GetConnected()->ReceiveConnection(m_pOutput, &mt))
+ && SUCCEEDED(hr2 = m_pOutput->GetDeliveryBuffer(&pOut, NULL, NULL, 0)))
+ {
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pOut->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt = *pmt;
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+ else // stupid overlay mixer won't let us know the new pitch...
+ {
+ long size = pOut->GetSize();
+ bmi->biWidth = size / bmi->biHeight * 8 / bmi->biBitCount;
+ }
+ }
+ else
+ {
+ m_w = w_org;
+ m_h = h_org;
+ return E_FAIL;
+ }
+
+ m_wout = m_w;
+ m_hout = m_h;
+ m_arxout = m_arx;
+ m_aryout = m_ary;
+
+ // some renderers don't send this
+ NotifyEvent(EC_VIDEO_SIZE_CHANGED, MAKELPARAM(m_w, m_h), 0);
+
+ return S_OK;
+ }
+
+ return S_FALSE;
+}
+
+HRESULT CBaseVideoFilter::CopyBuffer(BYTE* pOut, BYTE* pIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced)
+{
+ int abs_h = abs(h);
+ BYTE* pInYUV[3] = {pIn, pIn + pitchIn*abs_h, pIn + pitchIn*abs_h + (pitchIn>>1)*(abs_h>>1)};
+ return CopyBuffer(pOut, pInYUV, w, h, pitchIn, subtype, fInterlaced);
+}
+
+HRESULT CBaseVideoFilter::CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced)
+{
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+
+ int pitchOut = 0;
+
+ if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ pitchOut = bihOut.biWidth*bihOut.biBitCount>>3;
+
+ if(bihOut.biHeight > 0)
+ {
+ pOut += pitchOut*(h-1);
+ pitchOut = -pitchOut;
+ if(h < 0) h = -h;
+ }
+ }
+
+ if(h < 0)
+ {
+ h = -h;
+ ppIn[0] += pitchIn*(h-1);
+ ppIn[1] += (pitchIn>>1)*((h>>1)-1);
+ ppIn[2] += (pitchIn>>1)*((h>>1)-1);
+ pitchIn = -pitchIn;
+ }
+
+ if(subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV || subtype == MEDIASUBTYPE_YV12)
+ {
+ BYTE* pIn = ppIn[0];
+ BYTE* pInU = ppIn[1];
+ BYTE* pInV = ppIn[2];
+
+ if(subtype == MEDIASUBTYPE_YV12) {BYTE* tmp = pInU; pInU = pInV; pInV = tmp;}
+
+ BYTE* pOutU = pOut + bihOut.biWidth*h;
+ BYTE* pOutV = pOut + bihOut.biWidth*h*5/4;
+
+ if(bihOut.biCompression == '21VY') {BYTE* tmp = pOutU; pOutU = pOutV; pOutV = tmp;}
+
+ ASSERT(w <= abs(pitchIn));
+
+ if(bihOut.biCompression == '2YUY')
+ {
+ BitBltFromI420ToYUY2(w, h, pOut, bihOut.biWidth*2, pIn, pInU, pInV, pitchIn, fInterlaced);
+ }
+ else if(bihOut.biCompression == '024I' || bihOut.biCompression == 'VUYI' || bihOut.biCompression == '21VY')
+ {
+ BitBltFromI420ToI420(w, h, pOut, pOutU, pOutV, bihOut.biWidth, pIn, pInU, pInV, pitchIn);
+ }
+ else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ if(!BitBltFromI420ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, pIn, pInU, pInV, pitchIn))
+ {
+ for(DWORD y = 0; y < h; y++, pOut += pitchOut)
+ memset(pOut, 0, pitchOut);
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_YUY2)
+ {
+ if(bihOut.biCompression == '2YUY')
+ {
+ BitBltFromYUY2ToYUY2(w, h, pOut, bihOut.biWidth*2, ppIn[0], pitchIn);
+ }
+ else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ if(!BitBltFromYUY2ToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn))
+ {
+ for(DWORD y = 0; y < h; y++, pOut += pitchOut)
+ memset(pOut, 0, pitchOut);
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_RGB24 || subtype == MEDIASUBTYPE_RGB565)
+ {
+ int sbpp =
+ subtype == MEDIASUBTYPE_ARGB32 || subtype == MEDIASUBTYPE_RGB32 ? 32 :
+ subtype == MEDIASUBTYPE_RGB24 ? 24 :
+ subtype == MEDIASUBTYPE_RGB565 ? 16 : 0;
+
+ if(bihOut.biCompression == '2YUY')
+ {
+ // TODO
+ // BitBltFromRGBToYUY2();
+ }
+ else if(bihOut.biCompression == BI_RGB || bihOut.biCompression == BI_BITFIELDS)
+ {
+ if(!BitBltFromRGBToRGB(w, h, pOut, pitchOut, bihOut.biBitCount, ppIn[0], pitchIn, sbpp))
+ {
+ for(DWORD y = 0; y < h; y++, pOut += pitchOut)
+ memset(pOut, 0, pitchOut);
+ }
+ }
+ }
+ else
+ {
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return S_OK;
+}
+
+HRESULT CBaseVideoFilter::CheckInputType(const CMediaType* mtIn)
+{
+ BITMAPINFOHEADER bih;
+ ExtractBIH(mtIn, &bih);
+
+ return mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_YV12
+ || mtIn->subtype == MEDIASUBTYPE_I420
+ || mtIn->subtype == MEDIASUBTYPE_IYUV
+ || mtIn->subtype == MEDIASUBTYPE_YUY2
+ || mtIn->subtype == MEDIASUBTYPE_ARGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB24
+ || mtIn->subtype == MEDIASUBTYPE_RGB565)
+ && (mtIn->formattype == FORMAT_VideoInfo
+ || mtIn->formattype == FORMAT_VideoInfo2)
+ && bih.biHeight > 0
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CBaseVideoFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ if(FAILED(CheckInputType(mtIn)) || mtOut->majortype != MEDIATYPE_Video)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ if(mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_YV12
+ || mtIn->subtype == MEDIASUBTYPE_I420
+ || mtIn->subtype == MEDIASUBTYPE_IYUV))
+ {
+ if(mtOut->subtype != MEDIASUBTYPE_YV12
+ && mtOut->subtype != MEDIASUBTYPE_I420
+ && mtOut->subtype != MEDIASUBTYPE_IYUV
+ && mtOut->subtype != MEDIASUBTYPE_YUY2
+ && mtOut->subtype != MEDIASUBTYPE_ARGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB24
+ && mtOut->subtype != MEDIASUBTYPE_RGB565)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else if(mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_YUY2))
+ {
+ if(mtOut->subtype != MEDIASUBTYPE_YUY2
+ && mtOut->subtype != MEDIASUBTYPE_ARGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB24
+ && mtOut->subtype != MEDIASUBTYPE_RGB565)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else if(mtIn->majortype == MEDIATYPE_Video
+ && (mtIn->subtype == MEDIASUBTYPE_ARGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB32
+ || mtIn->subtype == MEDIASUBTYPE_RGB24
+ || mtIn->subtype == MEDIASUBTYPE_RGB565))
+ {
+ if(mtOut->subtype != MEDIASUBTYPE_ARGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB32
+ && mtOut->subtype != MEDIASUBTYPE_RGB24
+ && mtOut->subtype != MEDIASUBTYPE_RGB565)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return S_OK;
+}
+
+HRESULT CBaseVideoFilter::CheckOutputType(const CMediaType& mtOut)
+{
+ int wout = 0, hout = 0, arxout = 0, aryout = 0;
+ return ExtractDim(&mtOut, wout, hout, arxout, aryout)
+ && m_h == abs((int)hout)
+ && mtOut.subtype != MEDIASUBTYPE_ARGB32
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CBaseVideoFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ BITMAPINFOHEADER bih;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bih);
+
+ long cBuffers = m_pOutput->CurrentMediaType().formattype == FORMAT_VideoInfo ? 1 : m_cBuffers;
+
+ pProperties->cBuffers = m_cBuffers;
+ pProperties->cbBuffer = bih.biSizeImage;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR;
+}
+
+HRESULT CBaseVideoFilter::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ struct {const GUID* subtype; WORD biPlanes, biBitCount; DWORD biCompression;} fmts[] =
+ {
+ {&MEDIASUBTYPE_YV12, 3, 12, '21VY'},
+ {&MEDIASUBTYPE_I420, 3, 12, '024I'},
+ {&MEDIASUBTYPE_IYUV, 3, 12, 'VUYI'},
+ {&MEDIASUBTYPE_YUY2, 1, 16, '2YUY'},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_RGB},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_RGB},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_RGB},
+ {&MEDIASUBTYPE_ARGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB32, 1, 32, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB24, 1, 24, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB565, 1, 16, BI_BITFIELDS},
+ {&MEDIASUBTYPE_RGB555, 1, 16, BI_BITFIELDS},
+ };
+
+ // this will make sure we won't connect to the old renderer in dvd mode
+ // that renderer can't switch the format dynamically
+
+ bool fFoundDVDNavigator = false;
+ CComPtr<IBaseFilter> pBF = this;
+ CComPtr<IPin> pPin = m_pInput;
+ for(; !fFoundDVDNavigator && (pBF = GetUpStreamFilter(pBF, pPin)); pPin = GetFirstPin(pBF))
+ fFoundDVDNavigator = GetCLSID(pBF) == CLSID_DVDNavigator;
+
+ if(fFoundDVDNavigator || m_pInput->CurrentMediaType().formattype == FORMAT_VideoInfo2)
+ iPosition = iPosition*2;
+
+ //
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition >= 2*countof(fmts)) return VFW_S_NO_MORE_ITEMS;
+
+ pmt->majortype = MEDIATYPE_Video;
+ pmt->subtype = *fmts[iPosition/2].subtype;
+
+ int w = m_win, h = m_hin, arx = m_arxin, ary = m_aryin;
+ GetOutputSize(w, h, arx, ary);
+
+ BITMAPINFOHEADER bihOut;
+ memset(&bihOut, 0, sizeof(bihOut));
+ bihOut.biSize = sizeof(bihOut);
+ bihOut.biWidth = w;
+ bihOut.biHeight = h;
+ bihOut.biPlanes = fmts[iPosition/2].biPlanes;
+ bihOut.biBitCount = fmts[iPosition/2].biBitCount;
+ bihOut.biCompression = fmts[iPosition/2].biCompression;
+ bihOut.biSizeImage = w*h*bihOut.biBitCount>>3;
+
+ if(iPosition&1)
+ {
+ pmt->formattype = FORMAT_VideoInfo;
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ vih->bmiHeader = bihOut;
+ vih->bmiHeader.biXPelsPerMeter = vih->bmiHeader.biWidth * ary;
+ vih->bmiHeader.biYPelsPerMeter = vih->bmiHeader.biHeight * arx;
+ }
+ else
+ {
+ pmt->formattype = FORMAT_VideoInfo2;
+ VIDEOINFOHEADER2* vih = (VIDEOINFOHEADER2*)pmt->AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER2));
+ vih->bmiHeader = bihOut;
+ vih->dwPictAspectRatioX = arx;
+ vih->dwPictAspectRatioY = ary;
+ if(IsVideoInterlaced()) vih->dwInterlaceFlags = AMINTERLACE_IsInterlaced;
+ }
+
+ CMediaType& mt = m_pInput->CurrentMediaType();
+
+ // these fields have the same field offset in all four structs
+ ((VIDEOINFOHEADER*)pmt->Format())->AvgTimePerFrame = ((VIDEOINFOHEADER*)mt.Format())->AvgTimePerFrame;
+ ((VIDEOINFOHEADER*)pmt->Format())->dwBitRate = ((VIDEOINFOHEADER*)mt.Format())->dwBitRate;
+ ((VIDEOINFOHEADER*)pmt->Format())->dwBitErrorRate = ((VIDEOINFOHEADER*)mt.Format())->dwBitErrorRate;
+
+ CorrectMediaType(pmt);
+
+ return S_OK;
+}
+
+HRESULT CBaseVideoFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ m_w = m_h = m_arx = m_ary = 0;
+ ExtractDim(pmt, m_w, m_h, m_arx, m_ary);
+ m_win = m_w;
+ m_hin = m_h;
+ m_arxin = m_arx;
+ m_aryin = m_ary;
+ GetOutputSize(m_w, m_h, m_arx, m_ary);
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ int wout = 0, hout = 0, arxout = 0, aryout = 0;
+ ExtractDim(pmt, wout, hout, arxout, aryout);
+ if(m_w == wout && m_h == hout && m_arx == arxout && m_ary == aryout)
+ {
+ m_wout = wout;
+ m_hout = hout;
+ m_arxout = arxout;
+ m_aryout = aryout;
+ }
+ }
+
+ return __super::SetMediaType(dir, pmt);
+}
+
+//
+// CBaseVideoInputAllocator
+//
+
+CBaseVideoInputAllocator::CBaseVideoInputAllocator(HRESULT* phr)
+ : CMemAllocator(NAME("CBaseVideoInputAllocator"), NULL, phr)
+{
+ if(phr) *phr = S_OK;
+}
+
+void CBaseVideoInputAllocator::SetMediaType(const CMediaType& mt)
+{
+ m_mt = mt;
+}
+
+STDMETHODIMP CBaseVideoInputAllocator::GetBuffer(IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags)
+{
+ if(!m_bCommitted)
+ return VFW_E_NOT_COMMITTED;
+
+ HRESULT hr = __super::GetBuffer(ppBuffer, pStartTime, pEndTime, dwFlags);
+
+ if(SUCCEEDED(hr) && m_mt.majortype != GUID_NULL)
+ {
+ (*ppBuffer)->SetMediaType(&m_mt);
+ m_mt.majortype = GUID_NULL;
+ }
+
+ return hr;
+}
+
+//
+// CBaseVideoInputPin
+//
+
+CBaseVideoInputPin::CBaseVideoInputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName)
+ : CTransformInputPin(pObjectName, pFilter, phr, pName)
+ , m_pAllocator(NULL)
+{
+}
+
+CBaseVideoInputPin::~CBaseVideoInputPin()
+{
+ delete m_pAllocator;
+}
+
+STDMETHODIMP CBaseVideoInputPin::GetAllocator(IMemAllocator** ppAllocator)
+{
+ CheckPointer(ppAllocator, E_POINTER);
+
+ if(m_pAllocator == NULL)
+ {
+ HRESULT hr = S_OK;
+ m_pAllocator = new CBaseVideoInputAllocator(&hr);
+ m_pAllocator->AddRef();
+ }
+
+ (*ppAllocator = m_pAllocator)->AddRef();
+
+ return S_OK;
+}
+
+STDMETHODIMP CBaseVideoInputPin::ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt)
+{
+ CAutoLock cObjectLock(m_pLock);
+
+ if(m_Connected)
+ {
+ CMediaType mt(*pmt);
+
+ if(FAILED(CheckMediaType(&mt)))
+ return VFW_E_TYPE_NOT_ACCEPTED;
+
+ ALLOCATOR_PROPERTIES props, actual;
+
+ CComPtr<IMemAllocator> pMemAllocator;
+ if(FAILED(GetAllocator(&pMemAllocator))
+ || FAILED(pMemAllocator->Decommit())
+ || FAILED(pMemAllocator->GetProperties(&props)))
+ return E_FAIL;
+
+ BITMAPINFOHEADER bih;
+ if(ExtractBIH(pmt, &bih) && bih.biSizeImage)
+ props.cbBuffer = bih.biSizeImage;
+
+ if(FAILED(pMemAllocator->SetProperties(&props, &actual))
+ || FAILED(pMemAllocator->Commit())
+ || props.cbBuffer != actual.cbBuffer)
+ return E_FAIL;
+
+ if(m_pAllocator)
+ m_pAllocator->SetMediaType(mt);
+
+ return SetMediaType(&mt) == S_OK
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return __super::ReceiveConnection(pConnector, pmt);
+}
+
+//
+// CBaseVideoOutputPin
+//
+
+CBaseVideoOutputPin::CBaseVideoOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName)
+ : CTransformOutputPin(pObjectName, pFilter, phr, pName)
+{
+}
+
+HRESULT CBaseVideoOutputPin::CheckMediaType(const CMediaType* mtOut)
+{
+ if(IsConnected())
+ {
+ HRESULT hr = ((CBaseVideoFilter*)m_pFilter)->CheckOutputType(*mtOut);
+ if(FAILED(hr)) return hr;
+ }
+
+ return __super::CheckMediaType(mtOut);
+}
diff --git a/src/filters/transform/basevideofilter/BaseVideoFilter.h b/src/filters/transform/basevideofilter/BaseVideoFilter.h
new file mode 100644
index 000000000..1451fdd67
--- /dev/null
+++ b/src/filters/transform/basevideofilter/BaseVideoFilter.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+class CBaseVideoFilter : public CTransformFilter
+{
+private:
+ HRESULT Receive(IMediaSample* pIn);
+ HRESULT ReconnectOutput(int w, int h);
+
+ // these are private for a reason, don't bother them
+ DWORD m_win, m_hin, m_arxin, m_aryin;
+ DWORD m_wout, m_hout, m_arxout, m_aryout;
+
+ long m_cBuffers;
+
+protected:
+ CCritSec m_csReceive;
+
+ int m_w, m_h, m_arx, m_ary;
+
+ HRESULT GetDeliveryBuffer(int w, int h, IMediaSample** ppOut);
+ HRESULT CopyBuffer(BYTE* pOut, BYTE* pIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced = false);
+ HRESULT CopyBuffer(BYTE* pOut, BYTE** ppIn, int w, int h, int pitchIn, const GUID& subtype, bool fInterlaced = false);
+
+ virtual void GetOutputSize(int& w, int& h, int& arx, int& ary) {}
+ virtual HRESULT Transform(IMediaSample* pIn) = 0;
+ virtual HRESULT IsVideoInterlaced() {return false;}
+
+public:
+ CBaseVideoFilter(TCHAR* pName, LPUNKNOWN lpunk, HRESULT* phr, REFCLSID clsid, long cBuffers = 1);
+ virtual ~CBaseVideoFilter();
+
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckOutputType(const CMediaType& mtOut);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+ HRESULT SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt);
+};
+
+class CBaseVideoInputAllocator : public CMemAllocator
+{
+ CMediaType m_mt;
+
+public:
+ CBaseVideoInputAllocator(HRESULT* phr);
+ void SetMediaType(const CMediaType& mt);
+ STDMETHODIMP GetBuffer(IMediaSample** ppBuffer, REFERENCE_TIME* pStartTime, REFERENCE_TIME* pEndTime, DWORD dwFlags);
+};
+
+class CBaseVideoInputPin : public CTransformInputPin
+{
+ CBaseVideoInputAllocator* m_pAllocator;
+
+public:
+ CBaseVideoInputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
+ ~CBaseVideoInputPin();
+
+ STDMETHODIMP GetAllocator(IMemAllocator** ppAllocator);
+ STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
+};
+
+class CBaseVideoOutputPin : public CTransformOutputPin
+{
+public:
+ CBaseVideoOutputPin(TCHAR* pObjectName, CBaseVideoFilter* pFilter, HRESULT* phr, LPCWSTR pName);
+
+ HRESULT CheckMediaType(const CMediaType* mtOut);
+};
diff --git a/src/filters/transform/basevideofilter/basevideofilter.sln b/src/filters/transform/basevideofilter/basevideofilter.sln
new file mode 100644
index 000000000..3aa5ea37d
--- /dev/null
+++ b/src/filters/transform/basevideofilter/basevideofilter.sln
@@ -0,0 +1,28 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basevideofilter", "basevideofilter.vcproj", "{54DDA60F-E528-4D07-A152-960A1E818680}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug lib = Debug lib
+ Release lib = Release lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug lib.ActiveCfg = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release lib.ActiveCfg = Release lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/transform/basevideofilter/basevideofilter.vcproj b/src/filters/transform/basevideofilter/basevideofilter.vcproj
new file mode 100644
index 000000000..346538dc9
--- /dev/null
+++ b/src/filters/transform/basevideofilter/basevideofilter.vcproj
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="basevideofilter"
+ ProjectGUID="{54DDA60F-E528-4D07-A152-960A1E818680}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\BaseVideoFilter.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\BaseVideoFilter.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/basevideofilter/basevideofilter_vs2005.vcproj b/src/filters/transform/basevideofilter/basevideofilter_vs2005.vcproj
new file mode 100644
index 000000000..0da1eaafa
--- /dev/null
+++ b/src/filters/transform/basevideofilter/basevideofilter_vs2005.vcproj
@@ -0,0 +1,357 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="basevideofilter"
+ ProjectGUID="{54DDA60F-E528-4D07-A152-960A1E818680}"
+ RootNamespace="basevideofilter"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\BaseVideoFilter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\BaseVideoFilter.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/basevideofilter/basevideofilter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/basevideofilter/basevideofilter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..d33184128
--- /dev/null
+++ b/src/filters/transform/basevideofilter/basevideofilter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/basevideofilter/stdafx.cpp b/src/filters/transform/basevideofilter/stdafx.cpp
new file mode 100644
index 000000000..4b29d63b8
--- /dev/null
+++ b/src/filters/transform/basevideofilter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// mpeg2decds.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/transform/basevideofilter/stdafx.h b/src/filters/transform/basevideofilter/stdafx.h
new file mode 100644
index 000000000..714c23efc
--- /dev/null
+++ b/src/filters/transform/basevideofilter/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
+#include <amvideo.h>
diff --git a/src/filters/transform/bufferfilter/BufferFilter.cpp b/src/filters/transform/bufferfilter/BufferFilter.cpp
new file mode 100644
index 000000000..8c79971b1
--- /dev/null
+++ b/src/filters/transform/bufferfilter/BufferFilter.cpp
@@ -0,0 +1,352 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "bufferfilter.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CBufferFilter), L"Buffer Filter", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins}
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CBufferFilter>, NULL, &sudFilter[0]}
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CBufferFilter
+//
+
+CBufferFilter::CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CBufferFilter"), lpunk, __uuidof(this))
+ , m_nSamplesToBuffer(2)
+{
+ HRESULT hr = S_OK;
+
+ do
+ {
+ if(!(m_pInput = new CTransformInputPin(NAME("Transform input pin"), this, &hr, L"In"))) hr = E_OUTOFMEMORY;
+ if(FAILED(hr)) break;
+
+ if(!(m_pOutput = new CBufferFilterOutputPin(this, &hr))) hr = E_OUTOFMEMORY;
+ if(FAILED(hr)) {delete m_pInput, m_pInput = NULL; break;}
+ }
+ while(false);
+
+ if(phr) *phr = hr;
+}
+
+CBufferFilter::~CBufferFilter()
+{
+}
+
+STDMETHODIMP CBufferFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(IBufferFilter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// IBufferFilter
+
+STDMETHODIMP CBufferFilter::SetBuffers(int nBuffers)
+{
+ if(!m_pOutput)
+ return E_FAIL;
+
+ if(m_pOutput->IsConnected()) // TODO: allow "on-the-fly" changes
+ return VFW_E_ALREADY_CONNECTED;
+
+ m_nSamplesToBuffer = nBuffers;
+
+ return S_OK;
+}
+
+STDMETHODIMP_(int) CBufferFilter::GetBuffers()
+{
+ return(m_nSamplesToBuffer);
+}
+
+STDMETHODIMP_(int) CBufferFilter::GetFreeBuffers()
+{
+ CBufferFilterOutputPin* pPin = (CBufferFilterOutputPin*)m_pOutput;
+ return(pPin && pPin->m_pOutputQueue ? (m_nSamplesToBuffer - pPin->m_pOutputQueue->GetQueueCount()) : 0);
+}
+
+STDMETHODIMP CBufferFilter::SetPriority(DWORD dwPriority)
+{
+ CBufferFilterOutputPin* pPin = (CBufferFilterOutputPin*)m_pOutput;
+ return(pPin && pPin->m_pOutputQueue ? (pPin->m_pOutputQueue->SetPriority(dwPriority) ? S_OK : E_FAIL) : E_UNEXPECTED);
+}
+
+//
+
+HRESULT CBufferFilter::Receive(IMediaSample* pSample)
+{
+ /* Check for other streams and pass them on */
+ AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
+ if(pProps->dwStreamId != AM_STREAM_MEDIA)
+ return m_pOutput->Deliver(pSample);
+
+ HRESULT hr;
+ ASSERT(pSample);
+ IMediaSample* pOutSample;
+
+ ASSERT(m_pOutput != NULL);
+
+ // Set up the output sample
+ hr = InitializeOutputSample(pSample, &pOutSample);
+
+ if(FAILED(hr))
+ return hr;
+
+ // Start timing the transform (if PERF is defined)
+ MSR_START(m_idTransform);
+
+ // have the derived class transform the data
+
+ hr = Transform(pSample, pOutSample);
+
+ // Stop the clock and log it (if PERF is defined)
+ MSR_STOP(m_idTransform);
+
+ if(FAILED(hr)) {
+ DbgLog((LOG_TRACE,1,TEXT("Error from transform")));
+ }
+ else {
+ // the Transform() function can return S_FALSE to indicate that the
+ // sample should not be delivered; we only deliver the sample if it's
+ // really S_OK (same as NOERROR, of course.)
+ if(hr == NOERROR) {
+ hr = m_pOutput->Deliver(pOutSample);
+ m_bSampleSkipped = FALSE; // last thing no longer dropped
+ }
+ else {
+ // S_FALSE returned from Transform is a PRIVATE agreement
+ // We should return NOERROR from Receive() in this cause because returning S_FALSE
+ // from Receive() means that this is the end of the stream and no more data should
+ // be sent.
+ if(S_FALSE == hr) {
+
+ // Release the sample before calling notify to avoid
+ // deadlocks if the sample holds a lock on the system
+ // such as DirectDraw buffers do
+ pOutSample->Release();
+ m_bSampleSkipped = TRUE;
+ if(!m_bQualityChanged) {
+ NotifyEvent(EC_QUALITY_CHANGE,0,0);
+ m_bQualityChanged = TRUE;
+ }
+ return NOERROR;
+ }
+ }
+ }
+
+ // release the output buffer. If the connected pin still needs it,
+ // it will have addrefed it itself.
+ pOutSample->Release();
+
+ return hr;
+}
+
+HRESULT CBufferFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
+{
+ BYTE* pDataIn = NULL;
+ BYTE* pDataOut = NULL;
+
+ pIn->GetPointer(&pDataIn);
+ pOut->GetPointer(&pDataOut);
+
+ long len = pIn->GetActualDataLength();
+ long size = pOut->GetSize();
+
+ if(!pDataIn || !pDataOut || len > size || len <= 0) return S_FALSE;
+
+ memcpy(pDataOut, pDataIn, min(len, size));
+
+ pOut->SetActualDataLength(min(len, size));
+
+ return S_OK;
+}
+
+HRESULT CBufferFilter::CheckInputType(const CMediaType* mtIn)
+{
+ return S_OK;
+}
+
+HRESULT CBufferFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return mtIn->MatchesPartial(mtOut) ? S_OK : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CBufferFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ CComPtr<IMemAllocator> pAllocatorIn;
+ m_pInput->GetAllocator(&pAllocatorIn);
+ if(!pAllocatorIn) return E_UNEXPECTED;
+
+ pAllocatorIn->GetProperties(pProperties);
+
+ pProperties->cBuffers = max(m_nSamplesToBuffer, pProperties->cBuffers);
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CBufferFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ // TODO: offer all input types from upstream and allow reconnection at least in stopped state
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ CopyMediaType(pMediaType, &m_pInput->CurrentMediaType());
+
+ return S_OK;
+}
+
+HRESULT CBufferFilter::StopStreaming()
+{
+ CBufferFilterOutputPin* pPin = (CBufferFilterOutputPin*)m_pOutput;
+ if(m_pInput && pPin && pPin->m_pOutputQueue)
+ {
+ while(!m_pInput->IsFlushing() && pPin->m_pOutputQueue->GetQueueCount() > 0)
+ Sleep(50);
+ }
+
+ return __super::StopStreaming();
+}
+
+//
+// CBufferFilterOutputPin
+//
+
+CBufferFilterOutputPin::CBufferFilterOutputPin(CTransformFilter* pFilter, HRESULT* phr)
+ : CTransformOutputPin(NAME("CBufferFilterOutputPin"), pFilter, phr, L"Out")
+{
+}
+
+HRESULT CBufferFilterOutputPin::Active()
+{
+ CAutoLock lock_it(m_pLock);
+
+ if(m_Connected && !m_pOutputQueue)
+ {
+ HRESULT hr = NOERROR;
+
+ m_pOutputQueue.Attach(new CBufferFilterOutputQueue(m_Connected, &hr));
+ if(!m_pOutputQueue) hr = E_OUTOFMEMORY;
+
+ if(FAILED(hr))
+ {
+ m_pOutputQueue.Free();
+ return hr;
+ }
+ }
+
+ return __super::Active();
+}
+
+HRESULT CBufferFilterOutputPin::Inactive()
+{
+ CAutoLock lock_it(m_pLock);
+ m_pOutputQueue.Free();
+ return __super::Inactive();
+}
+
+HRESULT CBufferFilterOutputPin::Deliver(IMediaSample* pMediaSample)
+{
+ if(!m_pOutputQueue) return NOERROR;
+ pMediaSample->AddRef();
+ return m_pOutputQueue->Receive(pMediaSample);
+}
+
+#define CallQueue(call) \
+ if(!m_pOutputQueue) return NOERROR; \
+ m_pOutputQueue->##call; \
+ return NOERROR; \
+
+HRESULT CBufferFilterOutputPin::DeliverEndOfStream()
+{
+ CallQueue(EOS());
+}
+
+HRESULT CBufferFilterOutputPin::DeliverBeginFlush()
+{
+ CallQueue(BeginFlush());
+}
+
+HRESULT CBufferFilterOutputPin::DeliverEndFlush()
+{
+ CallQueue(EndFlush());
+}
+
+HRESULT CBufferFilterOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CallQueue(NewSegment(tStart, tStop, dRate));
+}
diff --git a/src/filters/transform/bufferfilter/BufferFilter.def b/src/filters/transform/bufferfilter/BufferFilter.def
new file mode 100644
index 000000000..90ebb5445
--- /dev/null
+++ b/src/filters/transform/bufferfilter/BufferFilter.def
@@ -0,0 +1,7 @@
+LIBRARY "BufferFilter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/transform/bufferfilter/BufferFilter.h b/src/filters/transform/bufferfilter/BufferFilter.h
new file mode 100644
index 000000000..a65d7a16c
--- /dev/null
+++ b/src/filters/transform/bufferfilter/BufferFilter.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+
+[uuid("63EF0035-3FFE-4c41-9230-4346E028BE20")]
+interface IBufferFilter : public IUnknown
+{
+ STDMETHOD(SetBuffers) (int nBuffers) = 0;
+ STDMETHOD_(int, GetBuffers) () = 0;
+ STDMETHOD_(int, GetFreeBuffers) () = 0;
+ STDMETHOD(SetPriority) (DWORD dwPriority = THREAD_PRIORITY_NORMAL) = 0;
+};
+
+[uuid("DA2B3D77-2F29-4fd2-AC99-DEE4A8A13BF0")]
+class CBufferFilter : public CTransformFilter, public IBufferFilter
+{
+ int m_nSamplesToBuffer;
+
+public:
+ CBufferFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CBufferFilter();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IBufferFilter
+ STDMETHODIMP SetBuffers(int nBuffers);
+ STDMETHODIMP_(int) GetBuffers();
+ STDMETHODIMP_(int) GetFreeBuffers();
+ STDMETHODIMP SetPriority(DWORD dwPriority = THREAD_PRIORITY_NORMAL);
+
+ HRESULT Receive(IMediaSample* pSample);
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+ HRESULT StopStreaming();
+};
+
+class CBufferFilterOutputPin : public CTransformOutputPin
+{
+ class CBufferFilterOutputQueue : public COutputQueue
+ {
+ public:
+ CBufferFilterOutputQueue(IPin* pInputPin, HRESULT* phr,
+ DWORD dwPriority = THREAD_PRIORITY_NORMAL,
+ BOOL bAuto = FALSE, BOOL bQueue = TRUE,
+ LONG lBatchSize = 1, BOOL bBatchExact = FALSE,
+ LONG lListSize = DEFAULTCACHE,
+ bool bFlushingOpt = false)
+ : COutputQueue(pInputPin, phr, bAuto, bQueue, lBatchSize, bBatchExact, lListSize, dwPriority, bFlushingOpt)
+ {
+ }
+
+ int GetQueueCount()
+ {
+ return m_List ? m_List->GetCount() : -1;
+ }
+
+ bool SetPriority(DWORD dwPriority)
+ {
+ return m_hThread ? !!::SetThreadPriority(m_hThread, dwPriority) : false;
+ }
+ };
+
+public:
+ CBufferFilterOutputPin(CTransformFilter* pFilter, HRESULT* phr);
+
+ CAutoPtr<CBufferFilterOutputQueue> m_pOutputQueue;
+
+ HRESULT Active();
+ HRESULT Inactive();
+
+ HRESULT Deliver(IMediaSample* pMediaSample);
+ HRESULT DeliverEndOfStream();
+ HRESULT DeliverBeginFlush();
+ HRESULT DeliverEndFlush();
+ HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+};
diff --git a/src/filters/transform/bufferfilter/bufferfilter.sln b/src/filters/transform/bufferfilter/bufferfilter.sln
new file mode 100644
index 000000000..7fff051e8
--- /dev/null
+++ b/src/filters/transform/bufferfilter/bufferfilter.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bufferfilter", "bufferfilter.vcproj", "{9DCFD02A-16A0-4766-BC18-66163E21929D}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Debug lib
+ ConfigName.2 = Debug Unicode
+ ConfigName.3 = Debug Unicode lib
+ ConfigName.4 = Release
+ ConfigName.5 = Release lib
+ ConfigName.6 = Release Unicode
+ ConfigName.7 = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug.ActiveCfg = Debug|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug.Build.0 = Debug|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug lib.ActiveCfg = Debug lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug lib.Build.0 = Debug lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release.ActiveCfg = Release|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release.Build.0 = Release|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release lib.ActiveCfg = Release lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release lib.Build.0 = Release lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode.Build.0 = Release Unicode|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {9DCFD02A-16A0-4766-BC18-66163E21929D}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/transform/bufferfilter/bufferfilter.vcproj b/src/filters/transform/bufferfilter/bufferfilter.vcproj
new file mode 100644
index 000000000..f1ae97659
--- /dev/null
+++ b/src/filters/transform/bufferfilter/bufferfilter.vcproj
@@ -0,0 +1,490 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="bufferfilter"
+ ProjectGUID="{9DCFD02A-16A0-4766-BC18-66163E21929D}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="BufferFilter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="BufferFilter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="BufferFilter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="BufferFilter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="BufferFilter.cpp">
+ </File>
+ <File
+ RelativePath="BufferFilter.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="BufferFilter.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/bufferfilter/bufferfilter_vs2005.vcproj b/src/filters/transform/bufferfilter/bufferfilter_vs2005.vcproj
new file mode 100644
index 000000000..e1622cba5
--- /dev/null
+++ b/src/filters/transform/bufferfilter/bufferfilter_vs2005.vcproj
@@ -0,0 +1,725 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="bufferfilter"
+ ProjectGUID="{9DCFD02A-16A0-4766-BC18-66163E21929D}"
+ RootNamespace="bufferfilter"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="BufferFilter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseR.lib dsutilR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="BufferFilter.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="BufferFilter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="BufferFilter.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="BufferFilter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="BufferFilter.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="BufferFilter.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/bufferfilter/bufferfilter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/bufferfilter/bufferfilter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/transform/bufferfilter/bufferfilter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/bufferfilter/stdafx.cpp b/src/filters/transform/bufferfilter/stdafx.cpp
new file mode 100644
index 000000000..280418994
--- /dev/null
+++ b/src/filters/transform/bufferfilter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// bufferfilter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/transform/bufferfilter/stdafx.h b/src/filters/transform/bufferfilter/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/transform/bufferfilter/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/transform/decssfilter/DeCSSFilter.cpp b/src/filters/transform/decssfilter/DeCSSFilter.cpp
new file mode 100644
index 000000000..a5f6b90b6
--- /dev/null
+++ b/src/filters/transform/decssfilter/DeCSSFilter.cpp
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <atlbase.h>
+#include "DeCSSFilter.h"
+#include "..\..\..\decss\DeCSSInputPin.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_NULL},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CDeCSSFilter), L"DeCSSFilter", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDeCSSFilter>, NULL, &sudFilter[0]},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+//
+// CDeCSSFilter
+//
+
+class CKsPSInputPin : public CDeCSSInputPin
+{
+public:
+ CKsPSInputPin(TCHAR* pObjectName, CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName)
+ : CDeCSSInputPin(pObjectName, pFilter, phr, pName)
+ {
+ }
+
+ // IKsPropertySet
+ STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength)
+ {
+ if(CComQIPtr<IKsPropertySet> pKsPS = ((CDeCSSFilter*)m_pFilter)->m_pOutput->GetConnected())
+ return pKsPS->Set(PropSet, Id, InstanceData, InstanceLength, PropertyData, DataLength);
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP Get(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength, ULONG* pBytesReturned)
+ {
+ if(CComQIPtr<IKsPropertySet> pKsPS = ((CDeCSSFilter*)m_pFilter)->m_pOutput->GetConnected())
+ return pKsPS->Get(PropSet, Id, InstanceData, InstanceLength, PropertyData, DataLength, pBytesReturned);
+ return E_NOTIMPL;
+ }
+ STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
+ {
+ if(CComQIPtr<IKsPropertySet> pKsPS = ((CDeCSSFilter*)m_pFilter)->m_pOutput->GetConnected())
+ return pKsPS->QuerySupported(PropSet, Id, pTypeSupport);
+ return E_NOTIMPL;
+ }
+};
+
+CDeCSSFilter::CDeCSSFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CDeCSSFilter"), lpunk, __uuidof(this))
+{
+ if(phr) *phr = S_OK;
+
+ if(!(m_pInput = new CKsPSInputPin(NAME("CKsPSInputPin"), this, phr, L"In"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
+
+ if(!(m_pOutput = new CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
+}
+
+CDeCSSFilter::~CDeCSSFilter()
+{
+}
+
+HRESULT CDeCSSFilter::Transform(IMediaSample* pIn, IMediaSample* pOut)
+{
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt = *pmt;
+ m_pInput->SetMediaType(&mt);
+ mt.majortype = m_pOutput->CurrentMediaType().majortype;
+ m_pOutput->SetMediaType(&mt);
+ pOut->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ BYTE* pDataIn = NULL;
+ BYTE* pDataOut = NULL;
+
+ pIn->GetPointer(&pDataIn);
+ pOut->GetPointer(&pDataOut);
+
+ long len = pIn->GetActualDataLength();
+ long size = pOut->GetSize();
+
+ if(len == 0 || pDataIn == NULL) // format changes do not carry any data
+ {
+ pOut->SetActualDataLength(0);
+ return S_OK;
+ }
+
+ if(m_pOutput->CurrentMediaType().majortype == MEDIATYPE_MPEG2_PES)
+ {
+ if(*(DWORD*)pDataIn == 0xBA010000)
+ {
+ len -= 14; pDataIn += 14;
+ if(int stuffing = (pDataIn[-1]&7)) {len -= stuffing; pDataIn += stuffing;}
+ }
+ if(len <= 0) return S_FALSE;
+ if(*(DWORD*)pDataIn == 0xBB010000)
+ {
+ len -= 4; pDataIn += 4;
+ int hdrlen = ((pDataIn[0]<<8)|pDataIn[1]) + 2;
+ len -= hdrlen; pDataIn += hdrlen;
+ }
+ if(len <= 0) return S_FALSE;
+ }
+
+ if(!pDataIn || !pDataOut || len > size || len < 0) return S_FALSE;
+
+ memcpy(pDataOut, pDataIn, min(len, size));
+ pOut->SetActualDataLength(min(len, size));
+
+ return S_OK;
+}
+
+HRESULT CDeCSSFilter::CheckInputType(const CMediaType* mtIn)
+{
+ return mtIn->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CDeCSSFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return SUCCEEDED(CheckInputType(mtIn))
+ && mtOut->majortype == MEDIATYPE_MPEG2_PACK || mtOut->majortype == MEDIATYPE_MPEG2_PES
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CDeCSSFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ pProperties->cbAlign = 1;
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 2048;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return(pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR);
+}
+
+HRESULT CDeCSSFilter::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 1) return VFW_S_NO_MORE_ITEMS;
+
+ CopyMediaType(pmt, &m_pInput->CurrentMediaType());
+ if(iPosition == 0) pmt->majortype = MEDIATYPE_MPEG2_PACK;
+ if(iPosition == 1) pmt->majortype = MEDIATYPE_MPEG2_PES;
+
+ return S_OK;
+}
diff --git a/src/filters/transform/decssfilter/DeCSSFilter.def b/src/filters/transform/decssfilter/DeCSSFilter.def
new file mode 100644
index 000000000..bbb80933d
--- /dev/null
+++ b/src/filters/transform/decssfilter/DeCSSFilter.def
@@ -0,0 +1,7 @@
+LIBRARY "DeCSSFilter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/transform/decssfilter/DeCSSFilter.h b/src/filters/transform/decssfilter/DeCSSFilter.h
new file mode 100644
index 000000000..e31b1ffa3
--- /dev/null
+++ b/src/filters/transform/decssfilter/DeCSSFilter.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+[uuid("7B3BD419-FE03-4820-BE94-A22A4F844895")]
+class CDeCSSFilter : public CTransformFilter
+{
+ friend class CKsPSInputPin;
+
+public:
+ CDeCSSFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CDeCSSFilter();
+
+ HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+};
+
diff --git a/src/filters/transform/decssfilter/decssfilter.sln b/src/filters/transform/decssfilter/decssfilter.sln
new file mode 100644
index 000000000..8569f739c
--- /dev/null
+++ b/src/filters/transform/decssfilter/decssfilter.sln
@@ -0,0 +1,39 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decssfilter", "decssfilter.vcproj", "{F6B06383-3FFD-403B-9867-4AA82A20AA83}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug.ActiveCfg = Debug|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug.Build.0 = Debug|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug lib.ActiveCfg = Debug lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug lib.Build.0 = Debug lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release.ActiveCfg = Release|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release.Build.0 = Release|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release lib.ActiveCfg = Release lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release lib.Build.0 = Release lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {F6B06383-3FFD-403B-9867-4AA82A20AA83}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/transform/decssfilter/decssfilter.vcproj b/src/filters/transform/decssfilter/decssfilter.vcproj
new file mode 100644
index 000000000..6364eaa03
--- /dev/null
+++ b/src/filters/transform/decssfilter/decssfilter.vcproj
@@ -0,0 +1,486 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="decssfilter"
+ ProjectGUID="{F6B06383-3FFD-403B-9867-4AA82A20AA83}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="DeCSSFilter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="DeCSSFilter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="DeCSSFilter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="decssRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="DeCSSFilter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="DeCSSFilter.cpp">
+ </File>
+ <File
+ RelativePath="DeCSSFilter.def">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="DeCSSFilter.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/decssfilter/decssfilter_vs2005.vcproj b/src/filters/transform/decssfilter/decssfilter_vs2005.vcproj
new file mode 100644
index 000000000..8c491c587
--- /dev/null
+++ b/src/filters/transform/decssfilter/decssfilter_vs2005.vcproj
@@ -0,0 +1,721 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="decssfilter"
+ ProjectGUID="{F6B06383-3FFD-403B-9867-4AA82A20AA83}"
+ RootNamespace="decssfilter"
+ Keyword="Win32Proj"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="decssD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="DeCSSFilter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="decssR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="DeCSSFilter.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="decssDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="DeCSSFilter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="decssRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="DeCSSFilter.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath="DeCSSFilter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="DeCSSFilter.def"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath="DeCSSFilter.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/decssfilter/decssfilter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/decssfilter/decssfilter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/transform/decssfilter/decssfilter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/decssfilter/stdafx.cpp b/src/filters/transform/decssfilter/stdafx.cpp
new file mode 100644
index 000000000..d8ef94a00
--- /dev/null
+++ b/src/filters/transform/decssfilter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// decssfilter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/transform/decssfilter/stdafx.h b/src/filters/transform/decssfilter/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/transform/decssfilter/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/transform/mpadecfilter/IMpaDecFilter.h b/src/filters/transform/mpadecfilter/IMpaDecFilter.h
new file mode 100644
index 000000000..70afa42c7
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/IMpaDecFilter.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+enum SampleFormat {SF_PCM16, SF_PCM24, SF_PCM32, SF_FLOAT32};
+enum {AAC_ASIS, AAC_STEREO};
+
+[uuid("2067C60F-752F-4EBD-B0B1-4CBC5E00741C")]
+interface IMpaDecFilter : public IUnknown
+{
+ enum enctype {ac3, dts, aac, etlast};
+
+ STDMETHOD(SetSampleFormat(SampleFormat sf)) = 0;
+ STDMETHOD_(SampleFormat, GetSampleFormat()) = 0;
+ STDMETHOD(SetNormalize(bool fNormalize)) = 0;
+ STDMETHOD_(bool, GetNormalize()) = 0;
+ STDMETHOD(SetSpeakerConfig(enctype et, int sc)) = 0; // sign of sc tells if spdif is active
+ STDMETHOD_(int, GetSpeakerConfig(enctype et)) = 0;
+ STDMETHOD(SetDynamicRangeControl(enctype et, bool fDRC)) = 0;
+ STDMETHOD_(bool, GetDynamicRangeControl(enctype et)) = 0;
+ STDMETHOD(SetBoost(float boost)) = 0;
+ STDMETHOD_(float, GetBoost()) = 0;
+};
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter.cpp b/src/filters/transform/mpadecfilter/MpaDecFilter.cpp
new file mode 100644
index 000000000..4e23c5652
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecFilter.cpp
@@ -0,0 +1,1401 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <math.h>
+#include <atlbase.h>
+#include <mmreg.h>
+#include "MpaDecFilter.h"
+
+#include "..\..\..\DSUtil\DSUtil.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#include "faad2\include\neaacdec.h"
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Payload},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Packet},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_MPEG2_AUDIO},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_MPEG2_AUDIO},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_MPEG2_AUDIO},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG2_AUDIO},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DOLBY_AC3},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DOLBY_AC3},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DTS},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_WAVE_DTS},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_DVD_LPCM_AUDIO},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_AAC},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_MP4A},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_MP4A},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_MP4A},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_MP4A},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_mp4a},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_mp4a},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_mp4a},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_mp4a},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_PS2_PCM},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_PS2_PCM},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_PS2_PCM},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PS2_PCM},
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_PS2_ADPCM},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_PS2_ADPCM},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_PS2_ADPCM},
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PS2_ADPCM},
+};
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CMpaDecFilter), L"MPA Decoder Filter", /*MERIT_DO_NOT_USE*/0x40000001, countof(sudpPins), sudpPins},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, &__uuidof(CMpaDecFilter), CreateInstance<CMpaDecFilter>, NULL, &sudFilter[0]},
+ {L"CMpaDecPropertyPage", &__uuidof(CMpaDecSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMpaDecSettingsWnd> >},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+//
+
+#include "..\..\FilterApp.h"
+
+CFilterApp theApp;
+
+#endif
+
+// dshow: left, right, center, LFE, left surround, right surround
+// ac3: LFE, left, center, right, left surround, right surround
+// dts: center, left, right, left surround, right surround, LFE
+
+// lets see how we can map these things to dshow (oh the joy!)
+
+static struct scmap_t
+{
+ WORD nChannels;
+ BYTE ch[6];
+ DWORD dwChannelMask;
+}
+s_scmap_ac3[2*11] =
+{
+ {2, {0, 1,-1,-1,-1,-1}, 0}, // A52_CHANNEL
+ {1, {0,-1,-1,-1,-1,-1}, 0}, // A52_MONO
+ {2, {0, 1,-1,-1,-1,-1}, 0}, // A52_STEREO
+ {3, {0, 2, 1,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER}, // A52_3F
+ {3, {0, 1, 2,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_CENTER}, // A52_2F1R
+ {4, {0, 2, 1, 3,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_CENTER}, // A52_3F1R
+ {4, {0, 1, 2, 3,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // A52_2F2R
+ {5, {0, 2, 1, 3, 4,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // A52_3F2R
+ {1, {0,-1,-1,-1,-1,-1}, 0}, // A52_CHANNEL1
+ {1, {0,-1,-1,-1,-1,-1}, 0}, // A52_CHANNEL2
+ {2, {0, 1,-1,-1,-1,-1}, 0}, // A52_DOLBY
+
+ {3, {1, 2, 0,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // A52_CHANNEL|A52_LFE
+ {2, {1, 0,-1,-1,-1,-1}, SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // A52_MONO|A52_LFE
+ {3, {1, 2, 0,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // A52_STEREO|A52_LFE
+ {4, {1, 3, 2, 0,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // A52_3F|A52_LFE
+ {4, {1, 2, 0, 3,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // A52_2F1R|A52_LFE
+ {5, {1, 3, 2, 0, 4,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // A52_3F1R|A52_LFE
+ {5, {1, 2, 0, 3, 4,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // A52_2F2R|A52_LFE
+ {6, {1, 3, 2, 0, 4, 5}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // A52_3F2R|A52_LFE
+ {2, {1, 0,-1,-1,-1,-1}, SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // A52_CHANNEL1|A52_LFE
+ {2, {1, 0,-1,-1,-1,-1}, SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // A52_CHANNEL2|A52_LFE
+ {3, {1, 2, 0,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // A52_DOLBY|A52_LFE
+},
+s_scmap_dts[2*10] =
+{
+ {1, {0,-1,-1,-1,-1,-1}, 0}, // DTS_MONO
+ {2, {0, 1,-1,-1,-1,-1}, 0}, // DTS_CHANNEL
+ {2, {0, 1,-1,-1,-1,-1}, 0}, // DTS_STEREO
+ {2, {0, 1,-1,-1,-1,-1}, 0}, // DTS_STEREO_SUMDIFF
+ {2, {0, 1,-1,-1,-1,-1}, 0}, // DTS_STEREO_TOTAL
+ {3, {1, 2, 0,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER}, // DTS_3F
+ {3, {0, 1, 2,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_CENTER}, // DTS_2F1R
+ {4, {1, 2, 0, 3,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_CENTER}, // DTS_3F1R
+ {4, {0, 1, 2, 3,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_2F2R
+ {5, {1, 2, 0, 3, 4,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_3F2R
+
+ {2, {0, 1,-1,-1,-1,-1}, SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // DTS_MONO|DTS_LFE
+ {3, {0, 1, 2,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // DTS_CHANNEL|DTS_LFE
+ {3, {0, 1, 2,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // DTS_STEREO|DTS_LFE
+ {3, {0, 1, 2,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // DTS_STEREO_SUMDIFF|DTS_LFE
+ {3, {0, 1, 2,-1,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY}, // DTS_STEREO_TOTAL|DTS_LFE
+ {4, {1, 2, 0, 3,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY}, // DTS_3F|DTS_LFE
+ {4, {0, 1, 3, 2,-1,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // DTS_2F1R|DTS_LFE
+ {5, {1, 2, 0, 4, 3,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_CENTER}, // DTS_3F1R|DTS_LFE
+ {5, {0, 1, 4, 2, 3,-1}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_2F2R|DTS_LFE
+ {6, {1, 2, 0, 5, 3, 4}, SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT}, // DTS_3F2R|DTS_LFE
+};
+
+CMpaDecFilter::CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CTransformFilter(NAME("CMpaDecFilter"), lpunk, __uuidof(this))
+ , m_iSampleFormat(SF_PCM16)
+ , m_fNormalize(false)
+ , m_boost(1)
+{
+ if(phr) *phr = S_OK;
+
+ if(!(m_pInput = new CMpaDecInputPin(this, phr, L"In"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
+
+ if(!(m_pOutput = new CTransformOutputPin(NAME("CTransformOutputPin"), this, phr, L"Out"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) {delete m_pInput, m_pInput = NULL; return;}
+
+ m_iSpeakerConfig[ac3] = A52_STEREO;
+ m_iSpeakerConfig[dts] = DTS_STEREO;
+ m_iSpeakerConfig[aac] = AAC_STEREO;
+ m_fDynamicRangeControl[ac3] = false;
+ m_fDynamicRangeControl[dts] = false;
+ m_fDynamicRangeControl[aac] = false;
+
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder"), KEY_READ))
+ {
+ DWORD dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("SampleFormat"), dw)) m_iSampleFormat = (SampleFormat)dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Normalize"), dw)) m_fNormalize = !!dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Boost"), dw)) m_boost = *(float*)&dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3SpeakerConfig"), dw)) m_iSpeakerConfig[ac3] = (int)dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsSpeakerConfig"), dw)) m_iSpeakerConfig[dts] = (int)dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("AacSpeakerConfig"), dw)) m_iSpeakerConfig[aac] = (int)dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Ac3DynamicRangeControl"), dw)) m_fDynamicRangeControl[ac3] = !!dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DtsDynamicRangeControl"), dw)) m_fDynamicRangeControl[dts] = !!dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("AacDynamicRangeControl"), dw)) m_fDynamicRangeControl[aac] = !!dw;
+ }
+}
+
+CMpaDecFilter::~CMpaDecFilter()
+{
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Audio Decoder")))
+ {
+ key.SetDWORDValue(_T("SampleFormat"), m_iSampleFormat);
+ key.SetDWORDValue(_T("Normalize"), m_fNormalize);
+ key.SetDWORDValue(_T("Boost"), *(DWORD*)&m_boost);
+ key.SetDWORDValue(_T("Ac3SpeakerConfig"), m_iSpeakerConfig[ac3]);
+ key.SetDWORDValue(_T("DtsSpeakerConfig"), m_iSpeakerConfig[dts]);
+ key.SetDWORDValue(_T("AacSpeakerConfig"), m_iSpeakerConfig[aac]);
+ key.SetDWORDValue(_T("Ac3DynamicRangeControl"), m_fDynamicRangeControl[ac3]);
+ key.SetDWORDValue(_T("DtsDynamicRangeControl"), m_fDynamicRangeControl[dts]);
+ key.SetDWORDValue(_T("AacDynamicRangeControl"), m_fDynamicRangeControl[aac]);
+ }
+}
+
+STDMETHODIMP CMpaDecFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(IMpaDecFilter)
+ QI(ISpecifyPropertyPages)
+ QI(ISpecifyPropertyPages2)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+HRESULT CMpaDecFilter::EndOfStream()
+{
+ CAutoLock cAutoLock(&m_csReceive);
+ return __super::EndOfStream();
+}
+
+HRESULT CMpaDecFilter::BeginFlush()
+{
+ return __super::BeginFlush();
+}
+
+HRESULT CMpaDecFilter::EndFlush()
+{
+ CAutoLock cAutoLock(&m_csReceive);
+ m_buff.RemoveAll();
+ m_sample_max = 0.1f;
+ return __super::EndFlush();
+}
+
+HRESULT CMpaDecFilter::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+ m_buff.RemoveAll();
+ m_sample_max = 0.1f;
+ m_ps2_state.sync = false;
+ return __super::NewSegment(tStart, tStop, dRate);
+}
+
+HRESULT CMpaDecFilter::Receive(IMediaSample* pIn)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ HRESULT hr;
+
+ AM_SAMPLE2_PROPERTIES* const pProps = m_pInput->SampleProps();
+ if(pProps->dwStreamId != AM_STREAM_MEDIA)
+ return m_pOutput->Deliver(pIn);
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pIn->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ m_pInput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ pmt = NULL;
+ m_sample_max = 0.1f;
+ m_aac_state.init(mt);
+ }
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn))) return hr;
+
+ long len = pIn->GetActualDataLength();
+
+ ((CDeCSSInputPin*)m_pInput)->StripPacket(pDataIn, len);
+
+ REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
+ hr = pIn->GetTime(&rtStart, &rtStop);
+
+ if(pIn->IsDiscontinuity() == S_OK)
+ {
+ m_fDiscontinuity = true;
+ m_buff.RemoveAll();
+ m_sample_max = 0.1f;
+ // ASSERT(SUCCEEDED(hr)); // what to do if not?
+ if(FAILED(hr)) {TRACE(_T("mpa: disc. w/o timestamp\n")); return S_OK;} // lets wait then...
+ m_rtStart = rtStart;
+ }
+
+ if(SUCCEEDED(hr) && abs((int)(m_rtStart - rtStart)) > 1000000) // +-100ms jitter is allowed for now
+ {
+ m_buff.RemoveAll();
+ m_rtStart = rtStart;
+ }
+
+ int bufflen = m_buff.GetCount();
+ m_buff.SetCount(bufflen + len, 4096);
+ memcpy(m_buff.GetData() + bufflen, pDataIn, len);
+ len += bufflen;
+
+ const GUID& subtype = m_pInput->CurrentMediaType().subtype;
+
+ if(subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
+ hr = ProcessLPCM();
+ else if(subtype == MEDIASUBTYPE_DOLBY_AC3 || subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
+ hr = ProcessAC3();
+ else if(subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS)
+ hr = ProcessDTS();
+ else if(subtype == MEDIASUBTYPE_AAC || subtype == MEDIASUBTYPE_MP4A || subtype == MEDIASUBTYPE_mp4a)
+ hr = ProcessAAC();
+ else if(subtype == MEDIASUBTYPE_PS2_PCM)
+ hr = ProcessPS2PCM();
+ else if(subtype == MEDIASUBTYPE_PS2_ADPCM)
+ hr = ProcessPS2ADPCM();
+ else // if(.. the rest ..)
+ hr = ProcessMPA();
+
+ return hr;
+}
+
+HRESULT CMpaDecFilter::ProcessLPCM()
+{
+ WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+
+ ASSERT(wfein->nChannels == 2);
+ ASSERT(wfein->wBitsPerSample == 16);
+
+ BYTE* pDataIn = m_buff.GetData();
+ int len = m_buff.GetCount() & ~(wfein->nChannels*wfein->wBitsPerSample/8-1);
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(len*8/wfein->wBitsPerSample);
+
+ float* pDataOut = pBuff.GetData();
+ for(int i = 0; i < len; i += 2, pDataIn += 2, pDataOut++)
+ *pDataOut = (float)(short)((pDataIn[0]<<8)|pDataIn[1]) / 0x8000; // FIXME: care about 20/24 bps too
+
+ memmove(m_buff.GetData(), pDataIn, m_buff.GetCount() - len);
+ m_buff.SetCount(m_buff.GetCount() - len);
+
+ return Deliver(pBuff, wfein->nSamplesPerSec, wfein->nChannels);
+}
+
+HRESULT CMpaDecFilter::ProcessAC3()
+{
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
+
+ while(end - p >= 7)
+ {
+ int size = 0, flags, sample_rate, bit_rate;
+
+ if((size = a52_syncinfo(p, &flags, &sample_rate, &bit_rate)) > 0)
+ {
+// TRACE(_T("ac3: size=%d, flags=%08x, sample_rate=%d, bit_rate=%d\n"), size, flags, sample_rate, bit_rate);
+
+ bool fEnoughData = p + size <= end;
+
+ if(fEnoughData)
+ {
+ int iSpeakerConfig = GetSpeakerConfig(ac3);
+
+ if(iSpeakerConfig < 0)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(p, size, bit_rate, 0x0001)))
+ return hr;
+ }
+ else
+ {
+ flags = iSpeakerConfig&(A52_CHANNEL_MASK|A52_LFE);
+ flags |= A52_ADJUST_LEVEL;
+
+ sample_t level = 1, gain = 1, bias = 0;
+ level *= gain;
+
+ if(a52_frame(m_a52_state, p, &flags, &level, bias) == 0)
+ {
+ if(GetDynamicRangeControl(ac3))
+ a52_dynrng(m_a52_state, NULL, NULL);
+
+ int scmapidx = min(flags&A52_CHANNEL_MASK, countof(s_scmap_ac3)/2);
+ scmap_t& scmap = s_scmap_ac3[scmapidx + ((flags&A52_LFE)?(countof(s_scmap_ac3)/2):0)];
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(6*256*scmap.nChannels);
+ float* p = pBuff.GetData();
+
+ int i = 0;
+
+ for(; i < 6 && a52_block(m_a52_state) == 0; i++)
+ {
+ sample_t* samples = a52_samples(m_a52_state);
+
+ for(int j = 0; j < 256; j++, samples++)
+ {
+ for(int ch = 0; ch < scmap.nChannels; ch++)
+ {
+ ASSERT(scmap.ch[ch] != -1);
+ *p++ = (float)(*(samples + 256*scmap.ch[ch]) / level);
+ }
+ }
+ }
+
+ if(i == 6)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask)))
+ return hr;
+ }
+ }
+ }
+
+ p += size;
+ }
+
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
+
+ if(!fEnoughData)
+ break;
+ }
+ else
+ {
+ p++;
+ }
+ }
+
+ m_buff.SetCount(end - p);
+
+ return S_OK;
+}
+
+HRESULT CMpaDecFilter::ProcessDTS()
+{
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
+
+ while(end - p >= 14)
+ {
+ int size = 0, flags, sample_rate, bit_rate, frame_length;
+
+ if((size = dts_syncinfo(m_dts_state, p, &flags, &sample_rate, &bit_rate, &frame_length)) > 0)
+ {
+// TRACE(_T("dts: size=%d, flags=%08x, sample_rate=%d, bit_rate=%d, frame_length=%d\n"), size, flags, sample_rate, bit_rate, frame_length);
+
+ bool fEnoughData = p + size <= end;
+
+ if(fEnoughData)
+ {
+ int iSpeakerConfig = GetSpeakerConfig(dts);
+
+ if(iSpeakerConfig < 0)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(p, size, bit_rate, 0x000b)))
+ return hr;
+ }
+ else
+ {
+ flags = iSpeakerConfig&(DTS_CHANNEL_MASK|DTS_LFE);
+ flags |= DTS_ADJUST_LEVEL;
+
+ sample_t level = 1, gain = 1, bias = 0;
+ level *= gain;
+
+ if(dts_frame(m_dts_state, p, &flags, &level, bias) == 0)
+ {
+ if(GetDynamicRangeControl(dts))
+ dts_dynrng(m_dts_state, NULL, NULL);
+
+ int scmapidx = min(flags&DTS_CHANNEL_MASK, countof(s_scmap_dts)/2);
+ scmap_t& scmap = s_scmap_dts[scmapidx + ((flags&DTS_LFE)?(countof(s_scmap_dts)/2):0)];
+
+ int blocks = dts_blocks_num(m_dts_state);
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(blocks*256*scmap.nChannels);
+ float* p = pBuff.GetData();
+
+ int i = 0;
+
+ for(; i < blocks && dts_block(m_dts_state) == 0; i++)
+ {
+ sample_t* samples = dts_samples(m_dts_state);
+
+ for(int j = 0; j < 256; j++, samples++)
+ {
+ for(int ch = 0; ch < scmap.nChannels; ch++)
+ {
+ ASSERT(scmap.ch[ch] != -1);
+ *p++ = (float)(*(samples + 256*scmap.ch[ch]) / level);
+ }
+ }
+ }
+
+ if(i == blocks)
+ {
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, sample_rate, scmap.nChannels, scmap.dwChannelMask)))
+ return hr;
+ }
+ }
+ }
+
+ p += size;
+ }
+
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
+
+ if(!fEnoughData)
+ break;
+ }
+ else
+ {
+ p++;
+ }
+ }
+
+ m_buff.SetCount(end - p);
+
+ return S_OK;
+}
+
+HRESULT CMpaDecFilter::ProcessAAC()
+{
+ int iSpeakerConfig = GetSpeakerConfig(aac);
+
+ NeAACDecConfigurationPtr c = NeAACDecGetCurrentConfiguration(m_aac_state.h);
+ c->downMatrix = iSpeakerConfig;
+ NeAACDecSetConfiguration(m_aac_state.h, c);
+
+ NeAACDecFrameInfo info;
+ float* src = (float*)NeAACDecDecode(m_aac_state.h, &info, m_buff.GetData(), m_buff.GetCount());
+ m_buff.RemoveAll();
+ //if(!src) return E_FAIL;
+ if(info.error) m_aac_state.init(m_pInput->CurrentMediaType());
+ if(!src || info.samples == 0) return S_OK;
+
+ // HACK: bug in faad2 with mono sources?
+ if(info.channels == 2 && info.channel_position[1] == UNKNOWN_CHANNEL)
+ {
+ info.channel_position[0] = FRONT_CHANNEL_LEFT;
+ info.channel_position[1] = FRONT_CHANNEL_RIGHT;
+ }
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(info.samples);
+ float* dst = pBuff.GetData();
+
+ CAtlMap<int, int> chmask;
+ chmask[FRONT_CHANNEL_CENTER] = SPEAKER_FRONT_CENTER;
+ chmask[FRONT_CHANNEL_LEFT] = SPEAKER_FRONT_LEFT;
+ chmask[FRONT_CHANNEL_RIGHT] = SPEAKER_FRONT_RIGHT;
+ chmask[SIDE_CHANNEL_LEFT] = SPEAKER_SIDE_LEFT;
+ chmask[SIDE_CHANNEL_RIGHT] = SPEAKER_SIDE_RIGHT;
+ chmask[BACK_CHANNEL_LEFT] = SPEAKER_BACK_LEFT;
+ chmask[BACK_CHANNEL_RIGHT] = SPEAKER_BACK_RIGHT;
+ chmask[BACK_CHANNEL_CENTER] = SPEAKER_BACK_CENTER;
+ chmask[LFE_CHANNEL] = SPEAKER_LOW_FREQUENCY;
+
+ DWORD dwChannelMask = 0;
+ for(int i = 0; i < info.channels; i++)
+ {
+ if(info.channel_position[i] == UNKNOWN_CHANNEL) {ASSERT(0); return E_FAIL;}
+ dwChannelMask |= chmask[info.channel_position[i]];
+ }
+
+ int chmap[countof(info.channel_position)];
+ memset(chmap, 0, sizeof(chmap));
+
+ for(int i = 0; i < info.channels; i++)
+ {
+ unsigned int ch = 0, mask = chmask[info.channel_position[i]];
+
+ for(int j = 0; j < 32; j++)
+ {
+ if(dwChannelMask & (1 << j))
+ {
+ if((1 << j) == mask) {chmap[i] = ch; break;}
+ ch++;
+ }
+ }
+ }
+
+ if(info.channels <= 2) dwChannelMask = 0;
+
+ for(int j = 0; j < info.samples; j += info.channels, dst += info.channels)
+ for(int i = 0; i < info.channels; i++)
+ dst[chmap[i]] = *src++;
+
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, info.samplerate, info.channels, dwChannelMask)))
+ return hr;
+
+ return S_OK;
+}
+
+HRESULT CMpaDecFilter::ProcessPS2PCM()
+{
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
+
+ WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)m_pInput->CurrentMediaType().Format();
+ int size = wfe->dwInterleave*wfe->nChannels;
+ int samples = wfe->dwInterleave/(wfe->wBitsPerSample>>3);
+ int channels = wfe->nChannels;
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(samples*channels);
+ float* f = pBuff.GetData();
+
+ while(end - p >= size)
+ {
+ DWORD* dw = (DWORD*)p;
+
+ if(dw[0] == 'dhSS')
+ {
+ p += dw[1] + 8;
+ }
+ else if(dw[0] == 'dbSS')
+ {
+ p += 8;
+ m_ps2_state.sync = true;
+ }
+ else
+ {
+ if(m_ps2_state.sync)
+ {
+ short* s = (short*)p;
+
+ for(int i = 0; i < samples; i++)
+ for(int j = 0; j < channels; j++)
+ f[i*channels+j] = (float)s[j*samples+i] / 32768;
+ }
+ else
+ {
+ for(int i = 0, j = samples*channels; i < j; i++)
+ f[i] = 0;
+ }
+
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels)))
+ return hr;
+
+ p += size;
+
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
+ }
+ }
+
+ m_buff.SetCount(end - p);
+
+ return S_OK;
+}
+
+static void decodeps2adpcm(ps2_state_t& s, int channel, BYTE* pin, double* pout)
+{
+ int tbl_index = pin[0]>>4;
+ int shift = pin[0]&0xf;
+ int unk = pin[1]; // ?
+
+ if(tbl_index >= 10) {ASSERT(0); return;}
+ // if(unk == 7) {ASSERT(0); return;} // ???
+
+ static double s_tbl[] =
+ {
+ 0.0, 0.0, 0.9375, 0.0, 1.796875, -0.8125, 1.53125, -0.859375, 1.90625, -0.9375,
+ 0.0, 0.0, -0.9375, 0.0, -1.796875, 0.8125, -1.53125, 0.859375 -1.90625, 0.9375
+ };
+
+ double* tbl = &s_tbl[tbl_index*2];
+ double& a = s.a[channel];
+ double& b = s.b[channel];
+
+ for(int i = 0; i < 28; i++)
+ {
+ short input = (short)(((pin[2+i/2] >> ((i&1) << 2)) & 0xf) << 12) >> shift;
+ double output = a * tbl[1] + b * tbl[0] + input;
+
+ a = b;
+ b = output;
+
+ *pout++ = output / SHRT_MAX;
+ }
+}
+
+HRESULT CMpaDecFilter::ProcessPS2ADPCM()
+{
+ BYTE* p = m_buff.GetData();
+ BYTE* base = p;
+ BYTE* end = p + m_buff.GetCount();
+
+ WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)m_pInput->CurrentMediaType().Format();
+ int size = wfe->dwInterleave*wfe->nChannels;
+ int samples = wfe->dwInterleave * 14 / 16 * 2;
+ int channels = wfe->nChannels;
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(samples*channels);
+ float* f = pBuff.GetData();
+
+ while(end - p >= size)
+ {
+ DWORD* dw = (DWORD*)p;
+
+ if(dw[0] == 'dhSS')
+ {
+ p += dw[1] + 8;
+ }
+ else if(dw[0] == 'dbSS')
+ {
+ p += 8;
+ m_ps2_state.sync = true;
+ }
+ else
+ {
+ if(m_ps2_state.sync)
+ {
+ double* tmp = new double[samples*channels];
+
+ for(int channel = 0, j = 0, k = 0; channel < channels; channel++, j += wfe->dwInterleave)
+ for(int i = 0; i < wfe->dwInterleave; i += 16, k += 28)
+ decodeps2adpcm(m_ps2_state, channel, p + i + j, tmp + k);
+
+ for(int i = 0, k = 0; i < samples; i++)
+ for(int j = 0; j < channels; j++, k++)
+ f[k] = (float)tmp[j*samples+i];
+
+ delete [] tmp;
+ }
+ else
+ {
+ for(int i = 0, j = samples*channels; i < j; i++)
+ f[i] = 0;
+ }
+
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, wfe->nSamplesPerSec, wfe->nChannels)))
+ return hr;
+
+ p += size;
+ }
+ }
+
+ memmove(base, p, end - p);
+ end = base + (end - p);
+ p = base;
+
+ m_buff.SetCount(end - p);
+
+ return S_OK;
+}
+
+static inline float fscale(mad_fixed_t sample)
+{
+ if(sample >= MAD_F_ONE) sample = MAD_F_ONE - 1;
+ else if(sample < -MAD_F_ONE) sample = -MAD_F_ONE;
+
+ return (float)sample / (1 << MAD_F_FRACBITS);
+}
+
+HRESULT CMpaDecFilter::ProcessMPA()
+{
+ mad_stream_buffer(&m_stream, m_buff.GetData(), m_buff.GetCount());
+
+ while(1)
+ {
+ if(mad_frame_decode(&m_frame, &m_stream) == -1)
+ {
+ if(m_stream.error == MAD_ERROR_BUFLEN)
+ {
+ memmove(m_buff.GetData(), m_stream.this_frame, m_stream.bufend - m_stream.this_frame);
+ m_buff.SetCount(m_stream.bufend - m_stream.this_frame);
+ break;
+ }
+
+ if(!MAD_RECOVERABLE(m_stream.error))
+ {
+ TRACE(_T("*m_stream.error == %d\n"), m_stream.error);
+ return E_FAIL;
+ }
+
+ // FIXME: the renderer doesn't like this
+ // m_fDiscontinuity = true;
+
+ continue;
+ }
+/*
+// TODO: needs to be tested... (has anybody got an external mpeg audio decoder?)
+HRESULT hr;
+if(S_OK != (hr = Deliver(
+ (BYTE*)m_stream.this_frame,
+ m_stream.next_frame - m_stream.this_frame,
+ m_frame.header.bitrate,
+ m_frame.header.layer == 1 ? 0x0004 : 0x0005)))
+ return hr;
+continue;
+*/
+ mad_synth_frame(&m_synth, &m_frame);
+
+ WAVEFORMATEX* wfein = (WAVEFORMATEX*)m_pInput->CurrentMediaType().Format();
+ if(wfein->nChannels != m_synth.pcm.channels || wfein->nSamplesPerSec != m_synth.pcm.samplerate)
+ continue;
+
+ const mad_fixed_t* left_ch = m_synth.pcm.samples[0];
+ const mad_fixed_t* right_ch = m_synth.pcm.samples[1];
+
+ CAtlArray<float> pBuff;
+ pBuff.SetCount(m_synth.pcm.length*m_synth.pcm.channels);
+
+ float* pDataOut = pBuff.GetData();
+ for(unsigned short i = 0; i < m_synth.pcm.length; i++)
+ {
+ *pDataOut++ = fscale(*left_ch++);
+ if(m_synth.pcm.channels == 2) *pDataOut++ = fscale(*right_ch++);
+ }
+
+ HRESULT hr;
+ if(S_OK != (hr = Deliver(pBuff, m_synth.pcm.samplerate, m_synth.pcm.channels)))
+ return hr;
+ }
+
+ return S_OK;
+}
+
+HRESULT CMpaDecFilter::GetDeliveryBuffer(IMediaSample** pSample, BYTE** pData)
+{
+ HRESULT hr;
+
+ *pData = NULL;
+ if(FAILED(hr = m_pOutput->GetDeliveryBuffer(pSample, NULL, NULL, 0))
+ || FAILED(hr = (*pSample)->GetPointer(pData)))
+ return hr;
+
+ AM_MEDIA_TYPE* pmt = NULL;
+ if(SUCCEEDED((*pSample)->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt = *pmt;
+ m_pOutput->SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ pmt = NULL;
+ }
+
+ return S_OK;
+}
+
+HRESULT CMpaDecFilter::Deliver(CAtlArray<float>& pBuff, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask)
+{
+ HRESULT hr;
+
+ SampleFormat sf = GetSampleFormat();
+
+ CMediaType mt = CreateMediaType(sf, nSamplesPerSec, nChannels, dwChannelMask);
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ int nSamples = pBuff.GetCount()/wfe->nChannels;
+
+ if(FAILED(hr = ReconnectOutput(nSamples, mt)))
+ return hr;
+
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(GetDeliveryBuffer(&pOut, &pDataOut)))
+ return E_FAIL;
+
+ REFERENCE_TIME rtDur = 10000000i64*nSamples/wfe->nSamplesPerSec;
+ REFERENCE_TIME rtStart = m_rtStart, rtStop = m_rtStart + rtDur;
+ m_rtStart += rtDur;
+//TRACE(_T("CMpaDecFilter: %I64d - %I64d\n"), rtStart/10000, rtStop/10000);
+ if(rtStart < 0 /*200000*/ /* < 0, FIXME: 0 makes strange noises */)
+ return S_OK;
+
+ if(hr == S_OK)
+ {
+ m_pOutput->SetMediaType(&mt);
+ pOut->SetMediaType(&mt);
+ }
+
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
+
+ pOut->SetPreroll(FALSE);
+ pOut->SetDiscontinuity(m_fDiscontinuity); m_fDiscontinuity = false;
+ pOut->SetSyncPoint(TRUE);
+
+ pOut->SetActualDataLength(pBuff.GetCount()*wfe->wBitsPerSample/8);
+
+WAVEFORMATEX* wfeout = (WAVEFORMATEX*)m_pOutput->CurrentMediaType().Format();
+ASSERT(wfeout->nChannels == wfe->nChannels);
+ASSERT(wfeout->nSamplesPerSec == wfe->nSamplesPerSec);
+
+ float* pDataIn = pBuff.GetData();
+
+ // TODO: move this into the audio switcher
+ float sample_mul = 1;
+ if(m_fNormalize)
+ {
+ for(int i = 0, len = pBuff.GetCount(); i < len; i++)
+ {
+ float f = *pDataIn++;
+ if(f < 0) f = -f;
+ if(m_sample_max < f) m_sample_max = f;
+ }
+ sample_mul = 1.0f / m_sample_max;
+ pDataIn = pBuff.GetData();
+ }
+
+ bool fBoost = m_boost > 1;
+ double boost = 1+log10(m_boost);
+
+ for(int i = 0, len = pBuff.GetCount(); i < len; i++)
+ {
+ float f = *pDataIn++;
+
+ // TODO: move this into the audio switcher
+
+ if(m_fNormalize)
+ f *= sample_mul;
+
+ if(fBoost)
+ f *= boost;
+
+ if(f < -1) f = -1;
+ else if(f > 1) f = 1;
+
+ #define round(x) ((x) > 0 ? (x) + 0.5 : (x) - 0.5)
+
+ switch(sf)
+ {
+ default:
+ case SF_PCM16:
+ *(short*)pDataOut = (short)round(f * SHRT_MAX);
+ pDataOut += sizeof(short);
+ break;
+ case SF_PCM24:
+ {DWORD i24 = (DWORD)(int)round(f * ((1<<23)-1));
+ *pDataOut++ = (BYTE)(i24);
+ *pDataOut++ = (BYTE)(i24>>8);
+ *pDataOut++ = (BYTE)(i24>>16);}
+ break;
+ case SF_PCM32:
+ *(int*)pDataOut = (int)round(f * INT_MAX);
+ pDataOut += sizeof(int);
+ break;
+ case SF_FLOAT32:
+ *(float*)pDataOut = f;
+ pDataOut += sizeof(float);
+ break;
+ }
+ }
+
+ return m_pOutput->Deliver(pOut);
+}
+
+HRESULT CMpaDecFilter::Deliver(BYTE* pBuff, int size, int bit_rate, BYTE type)
+{
+ HRESULT hr;
+
+ CMediaType mt = CreateMediaTypeSPDIF();
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ int length = 0;
+ while(length < size+sizeof(WORD)*4) length += 0x800;
+ int size2 = 1i64 * wfe->nBlockAlign * wfe->nSamplesPerSec * size*8 / bit_rate;
+ while(length < size2) length += 0x800;
+
+ if(FAILED(hr = ReconnectOutput(length / wfe->nBlockAlign, mt)))
+ return hr;
+
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(GetDeliveryBuffer(&pOut, &pDataOut)))
+ return E_FAIL;
+
+ REFERENCE_TIME rtDur = 10000000i64 * size*8 / bit_rate;
+ REFERENCE_TIME rtStart = m_rtStart, rtStop = m_rtStart + rtDur;
+ m_rtStart += rtDur;
+
+ if(rtStart < 0)
+ return S_OK;
+
+ if(hr == S_OK)
+ {
+ m_pOutput->SetMediaType(&mt);
+ pOut->SetMediaType(&mt);
+ }
+
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
+
+ pOut->SetPreroll(FALSE);
+ pOut->SetDiscontinuity(m_fDiscontinuity); m_fDiscontinuity = false;
+ pOut->SetSyncPoint(TRUE);
+
+ pOut->SetActualDataLength(length);
+
+ WORD* pDataOutW = (WORD*)pDataOut;
+ pDataOutW[0] = 0xf872;
+ pDataOutW[1] = 0x4e1f;
+ pDataOutW[2] = type;
+ pDataOutW[3] = size*8;
+ _swab((char*)pBuff, (char*)&pDataOutW[4], size);
+
+ return m_pOutput->Deliver(pOut);
+}
+
+HRESULT CMpaDecFilter::ReconnectOutput(int nSamples, CMediaType& mt)
+{
+ HRESULT hr;
+
+ CComQIPtr<IMemInputPin> pPin = m_pOutput->GetConnected();
+ if(!pPin) return E_NOINTERFACE;
+
+ CComPtr<IMemAllocator> pAllocator;
+ if(FAILED(hr = pPin->GetAllocator(&pAllocator)) || !pAllocator)
+ return hr;
+
+ ALLOCATOR_PROPERTIES props, actual;
+ if(FAILED(hr = pAllocator->GetProperties(&props)))
+ return hr;
+
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ long cbBuffer = nSamples * wfe->nBlockAlign;
+
+ if(mt != m_pOutput->CurrentMediaType() || cbBuffer > props.cbBuffer)
+ {
+ if(cbBuffer > props.cbBuffer)
+ {
+ props.cBuffers = 4;
+ props.cbBuffer = cbBuffer*3/2;
+
+ if(FAILED(hr = m_pOutput->DeliverBeginFlush())
+ || FAILED(hr = m_pOutput->DeliverEndFlush())
+ || FAILED(hr = pAllocator->Decommit())
+ || FAILED(hr = pAllocator->SetProperties(&props, &actual))
+ || FAILED(hr = pAllocator->Commit()))
+ return hr;
+
+ if(props.cBuffers > actual.cBuffers || props.cbBuffer > actual.cbBuffer)
+ {
+ NotifyEvent(EC_ERRORABORT, hr, 0);
+ return E_FAIL;
+ }
+ }
+
+ return S_OK;
+ }
+
+ return S_FALSE;
+}
+
+CMediaType CMpaDecFilter::CreateMediaType(SampleFormat sf, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask)
+{
+ CMediaType mt;
+
+ mt.majortype = MEDIATYPE_Audio;
+ mt.subtype = sf == SF_FLOAT32 ? MEDIASUBTYPE_IEEE_FLOAT : MEDIASUBTYPE_PCM;
+ mt.formattype = FORMAT_WaveFormatEx;
+
+ WAVEFORMATEXTENSIBLE wfex;
+ memset(&wfex, 0, sizeof(wfex));
+ WAVEFORMATEX* wfe = &wfex.Format;
+ wfe->wFormatTag = (WORD)mt.subtype.Data1;
+ wfe->nChannels = nChannels;
+ wfe->nSamplesPerSec = nSamplesPerSec;
+ switch(sf)
+ {
+ default:
+ case SF_PCM16: wfe->wBitsPerSample = 16; break;
+ case SF_PCM24: wfe->wBitsPerSample = 24; break;
+ case SF_PCM32: case SF_FLOAT32: wfe->wBitsPerSample = 32; break;
+ }
+ wfe->nBlockAlign = wfe->nChannels*wfe->wBitsPerSample/8;
+ wfe->nAvgBytesPerSec = wfe->nSamplesPerSec*wfe->nBlockAlign;
+
+ // FIXME: 24/32 bit only seems to work with WAVE_FORMAT_EXTENSIBLE
+ if(dwChannelMask == 0 && (sf == SF_PCM24 || sf == SF_PCM32))
+ dwChannelMask = nChannels == 2 ? (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT) : SPEAKER_FRONT_CENTER;
+
+ if(dwChannelMask)
+ {
+ wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+ wfex.Format.cbSize = sizeof(wfex) - sizeof(wfex.Format);
+ wfex.dwChannelMask = dwChannelMask;
+ wfex.Samples.wValidBitsPerSample = wfex.Format.wBitsPerSample;
+ wfex.SubFormat = mt.subtype;
+ }
+
+ mt.SetFormat((BYTE*)&wfex, sizeof(wfex.Format) + wfex.Format.cbSize);
+
+ return mt;
+}
+
+CMediaType CMpaDecFilter::CreateMediaTypeSPDIF()
+{
+ CMediaType mt = CreateMediaType(SF_PCM16, 48000, 2);
+ ((WAVEFORMATEX*)mt.pbFormat)->wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
+ return mt;
+}
+
+HRESULT CMpaDecFilter::CheckInputType(const CMediaType* mtIn)
+{
+ if(mtIn->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO)
+ {
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mtIn->Format();
+ if(wfe->nChannels != 2 || wfe->wBitsPerSample != 16) // TODO: remove this limitation
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+ else if(mtIn->subtype == MEDIASUBTYPE_PS2_ADPCM)
+ {
+ WAVEFORMATEXPS2* wfe = (WAVEFORMATEXPS2*)mtIn->Format();
+ if(wfe->dwInterleave & 0xf) // has to be a multiple of the block size (16 bytes)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ for(int i = 0; i < countof(sudPinTypesIn); i++)
+ {
+ if(*sudPinTypesIn[i].clsMajorType == mtIn->majortype
+ && *sudPinTypesIn[i].clsMinorType == mtIn->subtype)
+ return S_OK;
+ }
+
+ return VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CMpaDecFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ return SUCCEEDED(CheckInputType(mtIn))
+ && mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_PCM
+ || mtOut->majortype == MEDIATYPE_Audio && mtOut->subtype == MEDIASUBTYPE_IEEE_FLOAT
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CMpaDecFilter::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ CMediaType& mt = m_pInput->CurrentMediaType();
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ pProperties->cBuffers = 4;
+ // pProperties->cbBuffer = 1;
+ pProperties->cbBuffer = 48000*6*(32/8)/10; // 48KHz 6ch 32bps 100ms
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR;
+}
+
+HRESULT CMpaDecFilter::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
+
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ CMediaType mt = m_pInput->CurrentMediaType();
+ const GUID& subtype = mt.subtype;
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+
+ if(GetSpeakerConfig(ac3) < 0 && (subtype == MEDIASUBTYPE_DOLBY_AC3 || subtype == MEDIASUBTYPE_WAVE_DOLBY_AC3)
+ || GetSpeakerConfig(dts) < 0 && (subtype == MEDIASUBTYPE_DTS || subtype == MEDIASUBTYPE_WAVE_DTS))
+ {
+ *pmt = CreateMediaTypeSPDIF();
+ }
+ else
+ {
+ *pmt = CreateMediaType(GetSampleFormat(), wfe->nSamplesPerSec, min(2, wfe->nChannels));
+ }
+
+ return S_OK;
+}
+
+HRESULT CMpaDecFilter::StartStreaming()
+{
+ HRESULT hr = __super::StartStreaming();
+ if(FAILED(hr)) return hr;
+
+ m_a52_state = a52_init(0);
+
+ m_dts_state = dts_init(0);
+
+ m_aac_state.init(m_pInput->CurrentMediaType());
+
+ mad_stream_init(&m_stream);
+ mad_frame_init(&m_frame);
+ mad_synth_init(&m_synth);
+ mad_stream_options(&m_stream, 0/*options*/);
+
+ m_ps2_state.reset();
+
+ m_fDiscontinuity = false;
+
+ m_sample_max = 0.1f;
+
+ return S_OK;
+}
+
+HRESULT CMpaDecFilter::StopStreaming()
+{
+ a52_free(m_a52_state);
+
+ dts_free(m_dts_state);
+
+ mad_synth_finish(&m_synth);
+ mad_frame_finish(&m_frame);
+ mad_stream_finish(&m_stream);
+
+ return __super::StopStreaming();
+}
+
+// IMpaDecFilter
+
+STDMETHODIMP CMpaDecFilter::SetSampleFormat(SampleFormat sf)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ m_iSampleFormat = sf;
+ return S_OK;
+}
+
+STDMETHODIMP_(SampleFormat) CMpaDecFilter::GetSampleFormat()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_iSampleFormat;
+}
+
+STDMETHODIMP CMpaDecFilter::SetNormalize(bool fNormalize)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ if(m_fNormalize != fNormalize) m_sample_max = 0.1f;
+ m_fNormalize = fNormalize;
+ return S_OK;
+}
+
+STDMETHODIMP_(bool) CMpaDecFilter::GetNormalize()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_fNormalize;
+}
+
+STDMETHODIMP CMpaDecFilter::SetSpeakerConfig(enctype et, int sc)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ if(et >= 0 && et < etlast) m_iSpeakerConfig[et] = sc;
+ return S_OK;
+}
+
+STDMETHODIMP_(int) CMpaDecFilter::GetSpeakerConfig(enctype et)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ if(et >= 0 && et < etlast) return m_iSpeakerConfig[et];
+ return -1;
+}
+
+STDMETHODIMP CMpaDecFilter::SetDynamicRangeControl(enctype et, bool fDRC)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ if(et >= 0 && et < etlast) m_fDynamicRangeControl[et] = fDRC;
+ else return E_INVALIDARG;
+ return S_OK;
+}
+
+STDMETHODIMP_(bool) CMpaDecFilter::GetDynamicRangeControl(enctype et)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ if(et >= 0 && et < etlast) return m_fDynamicRangeControl[et];
+ return false;
+}
+
+STDMETHODIMP CMpaDecFilter::SetBoost(float boost)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ m_boost = max(boost, 1);
+ return S_OK;
+}
+
+STDMETHODIMP_(float) CMpaDecFilter::GetBoost()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_boost;
+}
+
+// ISpecifyPropertyPages2
+
+STDMETHODIMP CMpaDecFilter::GetPages(CAUUID* pPages)
+{
+ CheckPointer(pPages, E_POINTER);
+
+ pPages->cElems = 1;
+ pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID) * pPages->cElems);
+ pPages->pElems[0] = __uuidof(CMpaDecSettingsWnd);
+
+ return S_OK;
+}
+
+STDMETHODIMP CMpaDecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPage)
+{
+ CheckPointer(ppPage, E_POINTER);
+
+ if(*ppPage != NULL) return E_INVALIDARG;
+
+ HRESULT hr;
+
+ if(guid == __uuidof(CMpaDecSettingsWnd))
+ {
+ (*ppPage = new CInternalPropertyPageTempl<CMpaDecSettingsWnd>(NULL, &hr))->AddRef();
+ }
+
+ return *ppPage ? S_OK : E_FAIL;
+}
+
+//
+// CMpaDecInputPin
+//
+
+CMpaDecInputPin::CMpaDecInputPin(CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName)
+ : CDeCSSInputPin(NAME("CMpaDecInputPin"), pFilter, phr, pName)
+{
+}
+
+//
+// aac_state_t
+//
+
+aac_state_t::aac_state_t() : h(NULL), freq(0), channels(0) {open();}
+aac_state_t::~aac_state_t() {close();}
+
+bool aac_state_t::open()
+{
+ close();
+ if(!(h = NeAACDecOpen())) return false;
+ NeAACDecConfigurationPtr c = NeAACDecGetCurrentConfiguration(h);
+ c->outputFormat = FAAD_FMT_FLOAT;
+ NeAACDecSetConfiguration(h, c);
+ return true;
+}
+
+void aac_state_t::close()
+{
+ if(h) NeAACDecClose(h);
+ h = NULL;
+}
+
+bool aac_state_t::init(CMediaType& mt)
+{
+ if(mt.subtype != MEDIASUBTYPE_AAC
+ && mt.subtype != MEDIASUBTYPE_MP4A
+ && mt.subtype != MEDIASUBTYPE_mp4a)
+ return true; // nothing to do
+
+ open();
+ WAVEFORMATEX* wfe = (WAVEFORMATEX*)mt.Format();
+ return !NeAACDecInit2(h, (BYTE*)(wfe+1), wfe->cbSize, &freq, &channels);
+}
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter.def b/src/filters/transform/mpadecfilter/MpaDecFilter.def
new file mode 100644
index 000000000..e1c78e17f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecFilter.def
@@ -0,0 +1,7 @@
+LIBRARY "MpaDecFilter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter.h b/src/filters/transform/mpadecfilter/MpaDecFilter.h
new file mode 100644
index 000000000..c9d8bacde
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecFilter.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+#include "libmad-0.15.0b\msvc++\mad.h"
+#include "a52dec-0.7.4\vc++\inttypes.h"
+#include "a52dec-0.7.4\include\a52.h"
+#include "dtsdec-0.0.1\include\dts.h"
+// #include "faad2\include\neaacdec.h" // conflicts with dxtrans.h
+#include "..\..\..\decss\DeCSSInputPin.h"
+#include "IMpaDecFilter.h"
+#include "MpaDecSettingsWnd.h"
+
+struct aac_state_t
+{
+ void* h; // NeAACDecHandle h;
+ DWORD freq;
+ BYTE channels;
+
+ aac_state_t();
+ ~aac_state_t();
+ bool open();
+ void close();
+ bool init(CMediaType& mt);
+};
+
+struct ps2_state_t
+{
+ bool sync;
+ double a[2], b[2];
+ struct ps2_state_t() {reset();}
+ void reset() {sync = false; a[0] = a[1] = b[0] = b[1] = 0;}
+};
+
+[uuid("3D446B6F-71DE-4437-BE15-8CE47174340F")]
+class CMpaDecFilter
+ : public CTransformFilter
+ , public IMpaDecFilter
+ , public ISpecifyPropertyPages2
+{
+protected:
+ CCritSec m_csReceive;
+
+ a52_state_t* m_a52_state;
+ dts_state_t* m_dts_state;
+ aac_state_t m_aac_state;
+ mad_stream m_stream;
+ mad_frame m_frame;
+ mad_synth m_synth;
+ ps2_state_t m_ps2_state;
+
+ CAtlArray<BYTE> m_buff;
+ REFERENCE_TIME m_rtStart;
+ bool m_fDiscontinuity;
+
+ float m_sample_max;
+
+ HRESULT ProcessLPCM();
+ HRESULT ProcessAC3();
+ HRESULT ProcessDTS();
+ HRESULT ProcessAAC();
+ HRESULT ProcessPS2PCM();
+ HRESULT ProcessPS2ADPCM();
+ HRESULT ProcessMPA();
+
+ HRESULT GetDeliveryBuffer(IMediaSample** pSample, BYTE** pData);
+ HRESULT Deliver(CAtlArray<float>& pBuff, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask = 0);
+ HRESULT Deliver(BYTE* pBuff, int size, int bit_rate, BYTE type);
+ HRESULT ReconnectOutput(int nSamples, CMediaType& mt);
+ CMediaType CreateMediaType(SampleFormat sf, DWORD nSamplesPerSec, WORD nChannels, DWORD dwChannelMask = 0);
+ CMediaType CreateMediaTypeSPDIF();
+
+protected:
+ CCritSec m_csProps;
+ SampleFormat m_iSampleFormat;
+ bool m_fNormalize;
+ int m_iSpeakerConfig[etlast];
+ bool m_fDynamicRangeControl[etlast];
+ float m_boost;
+
+public:
+ CMpaDecFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CMpaDecFilter();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT EndOfStream();
+ HRESULT BeginFlush();
+ HRESULT EndFlush();
+ HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ HRESULT Receive(IMediaSample* pIn);
+
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+ HRESULT GetMediaType(int iPosition, CMediaType* pMediaType);
+
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
+
+ // ISpecifyPropertyPages2
+
+ STDMETHODIMP GetPages(CAUUID* pPages);
+ STDMETHODIMP CreatePage(const GUID& guid, IPropertyPage** ppPage);
+
+ // IMpaDecFilter
+
+ STDMETHODIMP SetSampleFormat(SampleFormat sf);
+ STDMETHODIMP_(SampleFormat) GetSampleFormat();
+ STDMETHODIMP SetNormalize(bool fNormalize);
+ STDMETHODIMP_(bool) GetNormalize();
+ STDMETHODIMP SetSpeakerConfig(enctype et, int sc);
+ STDMETHODIMP_(int) GetSpeakerConfig(enctype et);
+ STDMETHODIMP SetDynamicRangeControl(enctype et, bool fDRC);
+ STDMETHODIMP_(bool) GetDynamicRangeControl(enctype et);
+ STDMETHODIMP SetBoost(float boost);
+ STDMETHODIMP_(float) GetBoost();
+};
+
+class CMpaDecInputPin : public CDeCSSInputPin
+{
+public:
+ CMpaDecInputPin(CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName);
+};
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter.rc b/src/filters/transform/mpadecfilter/MpaDecFilter.rc
new file mode 100644
index 000000000..3452e8476
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecFilter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,2
+ PRODUCTVERSION 1,0,0,2
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "Mpeg Audio Decoder for DirectShow, based on libmad"
+ VALUE "FileVersion", "1, 0, 0, 2"
+ VALUE "InternalName", "MpaDecFilter Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "MpaDecFilter.ax"
+ VALUE "ProductName", "MpaDecFilter Filter"
+ VALUE "ProductVersion", "1, 0, 0, 2"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter.sln b/src/filters/transform/mpadecfilter/MpaDecFilter.sln
new file mode 100644
index 000000000..9df2e03d5
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecFilter.sln
@@ -0,0 +1,186 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MpaDecFilter", "MpaDecFilter.vcproj", "{4421516D-10A6-41C1-ADF3-099573BBB0C6}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18} = {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575} = {1A2DFD1A-3C6C-44D1-909D-294AF646B575}
+ {F41A1760-85B4-4819-BEE5-E120D76C9994} = {F41A1760-85B4-4819-BEE5-E120D76C9994}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865} = {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387} = {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13} = {54F609FD-A8CE-43CF-94AD-23E877B97C13}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{F41A1760-85B4-4819-BEE5-E120D76C9994}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmad", "libmad-0.15.0b\msvc++\libmad.vcproj", "{D8365C15-2166-4DB6-8A2D-1C8F0239EB18}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decss", "..\..\..\decss\decss.vcproj", "{1A2DFD1A-3C6C-44D1-909D-294AF646B575}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liba52", "a52dec-0.7.4\vc++\liba52.vcproj", "{62FE6D94-E17C-4A8E-8D3C-7A589A70D865}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdts", "dtsdec-0.0.1\vc++\libdts.vcproj", "{54F609FD-A8CE-43CF-94AD-23E877B97C13}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "faad2\libfaad\libfaad.vcproj", "{5EFCFACB-1835-422C-ACDA-E3B3A2F51387}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug.ActiveCfg = Debug|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug.Build.0 = Debug|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug lib.ActiveCfg = Debug lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug lib.Build.0 = Debug lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release.ActiveCfg = Release|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release.Build.0 = Release|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release lib.ActiveCfg = Release lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release lib.Build.0 = Release lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode.Build.0 = Release Unicode|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {4421516D-10A6-41C1-ADF3-099573BBB0C6}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.ActiveCfg = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug lib.Build.0 = Debug|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.ActiveCfg = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release lib.Build.0 = Release|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F41A1760-85B4-4819-BEE5-E120D76C9994}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug.ActiveCfg = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug.Build.0 = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug lib.ActiveCfg = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug lib.Build.0 = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode.ActiveCfg = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode.Build.0 = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Debug Unicode lib.Build.0 = Debug|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release.ActiveCfg = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release.Build.0 = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release lib.ActiveCfg = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release lib.Build.0 = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode.ActiveCfg = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode.Build.0 = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode lib.ActiveCfg = Release|Win32
+ {D8365C15-2166-4DB6-8A2D-1C8F0239EB18}.Release Unicode lib.Build.0 = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.ActiveCfg = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.Build.0 = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug lib.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug lib.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.ActiveCfg = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.Build.0 = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release lib.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release lib.Build.0 = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.Build.0 = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug.ActiveCfg = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug.Build.0 = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug lib.ActiveCfg = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug lib.Build.0 = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode.ActiveCfg = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode.Build.0 = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Debug Unicode lib.Build.0 = Debug|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release.ActiveCfg = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release.Build.0 = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release lib.ActiveCfg = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release lib.Build.0 = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode.ActiveCfg = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode.Build.0 = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode lib.ActiveCfg = Release|Win32
+ {62FE6D94-E17C-4A8E-8D3C-7A589A70D865}.Release Unicode lib.Build.0 = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug.ActiveCfg = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug.Build.0 = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug lib.ActiveCfg = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug lib.Build.0 = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode.ActiveCfg = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode.Build.0 = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Debug Unicode lib.Build.0 = Debug|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release.ActiveCfg = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release.Build.0 = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release lib.ActiveCfg = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release lib.Build.0 = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode.ActiveCfg = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode.Build.0 = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode lib.ActiveCfg = Release|Win32
+ {54F609FD-A8CE-43CF-94AD-23E877B97C13}.Release Unicode lib.Build.0 = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug.ActiveCfg = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug.Build.0 = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug lib.ActiveCfg = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug lib.Build.0 = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode.ActiveCfg = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode.Build.0 = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode lib.ActiveCfg = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Debug Unicode lib.Build.0 = Debug|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release.ActiveCfg = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release.Build.0 = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release lib.ActiveCfg = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release lib.Build.0 = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode.ActiveCfg = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode.Build.0 = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode lib.ActiveCfg = Release|Win32
+ {5EFCFACB-1835-422C-ACDA-E3B3A2F51387}.Release Unicode lib.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter.vcproj b/src/filters/transform/mpadecfilter/MpaDecFilter.vcproj
new file mode 100644
index 000000000..62563145e
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecFilter.vcproj
@@ -0,0 +1,533 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="MpaDecFilter"
+ ProjectGUID="{4421516D-10A6-41C1-ADF3-099573BBB0C6}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="libfaad2D.lib libmadD.lib liba52D.lib libdtsD.lib decssD.lib dsutilD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="MpaDecFilter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libfaad2R.lib libmadR.lib liba52R.lib libdtsR.lib decssR.lib dsutilR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="MpaDecFilter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="libfaad2D.lib libmadD.lib liba52D.lib libdtsD.lib decssDU.lib dsutilDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="MpaDecFilter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="libfaad2R.lib libmadR.lib liba52R.lib libdtsR.lib decssRU.lib dsutilRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="MpaDecFilter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="libfaad2D.lib libmadD.lib libdtsD.lib liba52D.lib"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ AdditionalLibraryDirectories="../../../../lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="libfaad2D.lib libmadD.lib libdtsD.lib liba52D.lib"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ AdditionalLibraryDirectories="../../../../lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="libfaad2R.lib libmadR.lib libdtsR.lib liba52R.lib"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ AdditionalLibraryDirectories="../../../../lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="libfaad2R.lib libmadR.lib libdtsR.lib liba52R.lib"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ AdditionalLibraryDirectories="../../../../lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\MpaDecFilter.cpp">
+ </File>
+ <File
+ RelativePath=".\MpaDecSettingsWnd.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\IMpaDecFilter.h">
+ </File>
+ <File
+ RelativePath=".\MpaDecFilter.h">
+ </File>
+ <File
+ RelativePath=".\MpaDecSettingsWnd.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\MpaDecFilter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter_vs2005.vcproj b/src/filters/transform/mpadecfilter/MpaDecFilter_vs2005.vcproj
new file mode 100644
index 000000000..d7cfd5d64
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecFilter_vs2005.vcproj
@@ -0,0 +1,778 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="MpaDecFilter"
+ ProjectGUID="{4421516D-10A6-41C1-ADF3-099573BBB0C6}"
+ RootNamespace="MpaDecFilter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="libfaad2D.lib libmadD.lib liba52D.lib libdtsD.lib decssD.lib dsutilD.lib strmbaseD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="MpaDecFilter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libfaad2R.lib libmadR.lib liba52R.lib libdtsR.lib decssR.lib dsutilR.lib strmbaseR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="MpaDecFilter.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="libfaad2D.lib libmadD.lib liba52D.lib libdtsD.lib decssDU.lib dsutilDU.lib strmbaseDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="MpaDecFilter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="libfaad2R.lib libmadR.lib liba52R.lib libdtsR.lib decssRU.lib dsutilRU.lib strmbaseRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib"
+ ModuleDefinitionFile="MpaDecFilter.def"
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="libfaad2D.lib libmadD.lib libdtsD.lib liba52D.lib"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="libfaad2D.lib libmadD.lib libdtsD.lib liba52D.lib"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="libfaad2R.lib libmadR.lib libdtsR.lib liba52R.lib"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="libfaad2R.lib libmadR.lib libdtsR.lib liba52R.lib"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\MpaDecFilter.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\MpaDecSettingsWnd.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\IMpaDecFilter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MpaDecFilter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MpaDecSettingsWnd.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\MpaDecFilter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/MpaDecFilter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/mpadecfilter/MpaDecFilter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecFilter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/mpadecfilter/MpaDecSettingsWnd.cpp b/src/filters/transform/mpadecfilter/MpaDecSettingsWnd.cpp
new file mode 100644
index 000000000..4629eb028
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecSettingsWnd.cpp
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "MpaDecSettingsWnd.h"
+#include "..\..\..\dsutil\dsutil.h"
+
+//
+// CMpaDecSettingsWnd
+//
+
+CMpaDecSettingsWnd::CMpaDecSettingsWnd()
+{
+}
+
+bool CMpaDecSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
+{
+ ASSERT(!m_pMDF);
+
+ m_pMDF.Release();
+
+ POSITION pos = pUnks.GetHeadPosition();
+ while(pos && !(m_pMDF = pUnks.GetNext(pos)));
+
+ if(!m_pMDF) return false;
+
+ m_outputformat = m_pMDF->GetSampleFormat();
+ m_ac3spkcfg = m_pMDF->GetSpeakerConfig(IMpaDecFilter::ac3);
+ m_ac3drc = m_pMDF->GetDynamicRangeControl(IMpaDecFilter::ac3);
+ m_dtsspkcfg = m_pMDF->GetSpeakerConfig(IMpaDecFilter::dts);
+ m_dtsdrc = m_pMDF->GetDynamicRangeControl(IMpaDecFilter::dts);
+ m_aacdownmix = !!m_pMDF->GetSpeakerConfig(IMpaDecFilter::aac);
+
+ return true;
+}
+
+void CMpaDecSettingsWnd::OnDisconnect()
+{
+ m_pMDF.Release();
+}
+
+bool CMpaDecSettingsWnd::OnActivate()
+{
+ DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP;
+
+ CRect r;
+
+ CPoint p(10, 10);
+
+ m_outputformat_static.Create(_T("Output sample format:"), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
+
+ p.y += m_fontheight + 5;
+
+ m_outputformat_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(10, 0), CSize(100, 200)), this, IDC_PP_COMBO1);
+ m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 16 Bit")), SF_PCM16);
+ m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 24 Bit")), SF_PCM24);
+ m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("PCM 32 Bit")), SF_PCM32);
+ m_outputformat_combo.SetItemData(m_outputformat_combo.AddString(_T("IEEE Float")), SF_FLOAT32);
+ m_outputformat_combo.SetCurSel(0);
+
+ for(int i = 0; i < m_outputformat_combo.GetCount(); i++)
+ if((int)m_outputformat_combo.GetItemData(i) == m_outputformat)
+ m_outputformat_combo.SetCurSel(i);
+
+ p.y += 30;
+
+ m_ac3spkcfg_static.Create(_T("AC3 Decoder Settings"), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
+
+ p.y += m_fontheight + 5;
+
+ m_ac3spkcfg_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO2);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Mono")), A52_MONO);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Dual Mono")), A52_CHANNEL);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Stereo")), A52_STEREO);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Dolby Stereo")), A52_DOLBY);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("3 Front")), A52_3F);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("2 Front + 1 Rear")), A52_2F1R);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("3 Front + 1 Rear")), A52_3F1R);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("2 Front + 2 Rear")), A52_2F2R);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("3 Front + 2 Rear")), A52_3F2R);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Channel 1")), A52_CHANNEL1);
+ m_ac3spkcfg_combo.SetItemData(m_ac3spkcfg_combo.AddString(_T("Channel 2")), A52_CHANNEL2);
+
+ for(int i = 0, sel = abs(m_ac3spkcfg) & A52_CHANNEL_MASK; i < m_ac3spkcfg_combo.GetCount(); i++)
+ if((int)m_ac3spkcfg_combo.GetItemData(i) == sel)
+ m_ac3spkcfg_combo.SetCurSel(i);
+
+ m_ac3spkcfg_combo.GetWindowRect(r);
+ ScreenToClient(r);
+
+ m_ac3lfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK4);
+ m_ac3lfe_check.SetCheck(!!(abs(m_ac3spkcfg) & A52_LFE));
+
+ for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_ac3spkcfg_radio); i++, p.y += h)
+ {
+ static const TCHAR* labels[] = {_T("Decode to speakers"), _T("SPDIF")};
+ m_ac3spkcfg_radio[i].Create(labels[i], dwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO1+i);
+ }
+
+ CheckRadioButton(IDC_PP_RADIO1, IDC_PP_RADIO2, m_ac3spkcfg >= 0 ? IDC_PP_RADIO1 : IDC_PP_RADIO2);
+
+ p.y += 5;
+
+ m_ac3spkcfg_check.Create(_T("Dynamic Range Control"), dwStyle|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK1);
+ m_ac3spkcfg_check.SetCheck(m_ac3drc);
+
+ p.y += m_fontheight + 10;
+
+ m_dtsspkcfg_static.Create(_T("DTS Decoder Settings"), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
+
+ p.y += m_fontheight + 5;
+
+ m_dtsspkcfg_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(150, 0), CSize(100, 200)), this, IDC_PP_COMBO3);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Mono")), DTS_MONO);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Dual Mono")), DTS_CHANNEL);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo")), DTS_STEREO);
+ //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_SUMDIFF);
+ //m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("Stereo ..")), DTS_STEREO_TOTAL);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("3 Front")), DTS_3F);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("2 Front + 1 Rear")), DTS_2F1R);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("3 Front + 1 Rear")), DTS_3F1R);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("2 Front + 2 Rear")), DTS_2F2R);
+ m_dtsspkcfg_combo.SetItemData(m_dtsspkcfg_combo.AddString(_T("3 Front + 2 Rear")), DTS_3F2R);
+
+ for(int i = 0, sel = abs(m_dtsspkcfg) & DTS_CHANNEL_MASK; i < m_dtsspkcfg_combo.GetCount(); i++)
+ if((int)m_dtsspkcfg_combo.GetItemData(i) == sel)
+ m_dtsspkcfg_combo.SetCurSel(i);
+
+ m_dtsspkcfg_combo.GetWindowRect(r);
+ ScreenToClient(r);
+
+ m_dtslfe_check.Create(_T("LFE"), dwStyle|BS_AUTOCHECKBOX, CRect(CPoint(r.left, r.bottom + 3), CSize(50, m_fontheight)), this, IDC_PP_CHECK5);
+ m_dtslfe_check.SetCheck(!!(abs(m_dtsspkcfg) & DTS_LFE));
+
+ for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_dtsspkcfg_radio); i++, p.y += h)
+ {
+ static const TCHAR* labels[] = {_T("Decode to speakers"), _T("SPDIF")};
+ m_dtsspkcfg_radio[i].Create(labels[i], dwStyle|BS_AUTORADIOBUTTON|(i == 0 ? WS_GROUP : 0), CRect(p + CPoint(10, 0), CSize(140, h)), this, IDC_PP_RADIO3+i);
+ }
+
+ CheckRadioButton(IDC_PP_RADIO3, IDC_PP_RADIO4, m_dtsspkcfg >= 0 ? IDC_PP_RADIO3 : IDC_PP_RADIO4);
+
+ p.y += 5;
+
+ m_dtsspkcfg_check.Create(_T("Dynamic Range Control"), dwStyle|WS_DISABLED|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK2);
+ m_dtsspkcfg_check.SetCheck(m_dtsdrc);
+
+ p.y += m_fontheight + 10;
+
+ m_aacspkcfg_static.Create(_T("AAC Decoder Settings"), dwStyle, CRect(p, CSize(120, m_fontheight)), this);
+
+ p.y += m_fontheight + 5;
+
+ m_aacdownmix_check.Create(_T("Downmix to stereo"), dwStyle|BS_AUTOCHECKBOX, CRect(p + CPoint(10, 0), CSize(150, m_fontheight)), this, IDC_PP_CHECK3);
+ m_aacdownmix_check.SetCheck(m_aacdownmix);
+
+ for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
+ pWnd->SetFont(&m_font, FALSE);
+
+ return true;
+}
+
+void CMpaDecSettingsWnd::OnDeactivate()
+{
+ m_outputformat = m_outputformat_combo.GetItemData(m_outputformat_combo.GetCurSel());
+ m_ac3spkcfg = m_ac3spkcfg_combo.GetItemData(m_ac3spkcfg_combo.GetCurSel());
+ if(!!m_ac3lfe_check.GetCheck()) m_ac3spkcfg |= A52_LFE;
+ if(IsDlgButtonChecked(IDC_PP_RADIO2)) m_ac3spkcfg = -m_ac3spkcfg;
+ m_ac3drc = !!m_ac3spkcfg_check.GetCheck();
+ m_dtsspkcfg = m_dtsspkcfg_combo.GetItemData(m_dtsspkcfg_combo.GetCurSel());
+ if(!!m_dtslfe_check.GetCheck()) m_dtsspkcfg |= DTS_LFE;
+ if(IsDlgButtonChecked(IDC_PP_RADIO4)) m_dtsspkcfg = -m_dtsspkcfg;
+ m_dtsdrc = !!m_dtsspkcfg_check.GetCheck();
+ m_aacdownmix = !!m_aacdownmix_check.GetCheck();
+}
+
+bool CMpaDecSettingsWnd::OnApply()
+{
+ OnDeactivate();
+
+ if(m_pMDF)
+ {
+ m_pMDF->SetSampleFormat((SampleFormat)m_outputformat);
+ m_pMDF->SetSpeakerConfig(IMpaDecFilter::ac3, m_ac3spkcfg);
+ m_pMDF->SetDynamicRangeControl(IMpaDecFilter::ac3, m_ac3drc);
+ m_pMDF->SetSpeakerConfig(IMpaDecFilter::dts, m_dtsspkcfg);
+ m_pMDF->SetDynamicRangeControl(IMpaDecFilter::dts, m_dtsdrc);
+ m_pMDF->SetSpeakerConfig(IMpaDecFilter::aac, m_aacdownmix);
+ }
+
+ return true;
+}
+
+BEGIN_MESSAGE_MAP(CMpaDecSettingsWnd, CInternalPropertyPageWnd)
+END_MESSAGE_MAP()
diff --git a/src/filters/transform/mpadecfilter/MpaDecSettingsWnd.h b/src/filters/transform/mpadecfilter/MpaDecSettingsWnd.h
new file mode 100644
index 000000000..c6b0fd709
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/MpaDecSettingsWnd.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\InternalPropertyPage.h"
+#include "MpaDecFilter.h"
+#include <afxcmn.h>
+
+[uuid("24103041-884B-4772-B0D3-A600E7CBFEC7")]
+class CMpaDecSettingsWnd : public CInternalPropertyPageWnd
+{
+ CComQIPtr<IMpaDecFilter> m_pMDF;
+
+ int m_outputformat;
+ int m_ac3spkcfg;
+ bool m_ac3drc;
+ int m_dtsspkcfg;
+ bool m_dtsdrc;
+ bool m_aacdownmix;
+
+ enum
+ {
+ IDC_PP_RADIO1 = 10000,
+ IDC_PP_RADIO2,
+ IDC_PP_RADIO3,
+ IDC_PP_RADIO4,
+ IDC_PP_COMBO1,
+ IDC_PP_COMBO2,
+ IDC_PP_COMBO3,
+ IDC_PP_CHECK1,
+ IDC_PP_CHECK2,
+ IDC_PP_CHECK3,
+ IDC_PP_CHECK4,
+ IDC_PP_CHECK5
+ };
+
+ CStatic m_outputformat_static;
+ CComboBox m_outputformat_combo;
+ CStatic m_ac3spkcfg_static;
+ CButton m_ac3spkcfg_radio[2];
+ CComboBox m_ac3spkcfg_combo;
+ CButton m_ac3spkcfg_check;
+ CButton m_ac3lfe_check;
+ CStatic m_dtsspkcfg_static;
+ CButton m_dtsspkcfg_radio[2];
+ CComboBox m_dtsspkcfg_combo;
+ CButton m_dtsspkcfg_check;
+ CStatic m_aacspkcfg_static;
+ CButton m_dtslfe_check;
+ CButton m_aacdownmix_check;
+
+/*
+ int m_iSampleFormat;
+ BOOL m_fNormalize;
+ BOOL m_fAc3SpeakerConfig;
+ int m_iAc3SpeakerConfig;
+ BOOL m_fAc3SpeakerConfigLFE;
+ BOOL m_fAc3DynamicRangeControl;
+ CComboBox m_ac3sclist;
+ BOOL m_fDtsSpeakerConfig;
+ int m_iDtsSpeakerConfig;
+ BOOL m_fDtsSpeakerConfigLFE;
+ BOOL m_fDtsDynamicRangeControl;
+ CComboBox m_dtssclist;
+ int m_iAacSpeakerConfig;
+ int m_boost;
+ CSliderCtrl m_boostctrl;
+*/
+public:
+ CMpaDecSettingsWnd();
+
+ bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
+ void OnDisconnect();
+ bool OnActivate();
+ void OnDeactivate();
+ bool OnApply();
+
+ static LPCTSTR GetWindowTitle() {return _T("Settings");}
+
+ DECLARE_MESSAGE_MAP()
+}; \ No newline at end of file
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/AUTHORS b/src/filters/transform/mpadecfilter/a52dec-0.7.4/AUTHORS
new file mode 100644
index 000000000..8e6aa1f10
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/AUTHORS
@@ -0,0 +1,22 @@
+Aaron Holtzman <aholtzma@ess.engr.uvic.ca> started the project and
+made the initial working implementation.
+
+Michel Lespinasse <walken@zoy.org> did major changes for speed and
+conformance and is the current maintainer.
+
+Other contributors include:
+ Gildas Bazin <gbazin@netcourrier.com> - mingw32 port
+ Billy Biggs <vektor@div8.net> - most of liba52.txt
+ Eduard Hasenleithner <eduardh@aon.at> - gcc 3.0 fixes
+ Håkan Hjort <d95hjort@dtek.chalmers.se> - Solaris output, mlib code
+ Charles M. Hannum <root@ihack.net> - fixes
+ Chris Hodges <hodges@stradis.com> - made the library reentrant
+ Michael Holzt <kju@flummi.de> - OSS output.c and misc errata
+ Angelos Keromytis <angelos@dsl.cis.upenn.edu> - OpenBSD fixes
+ David I. Lehn <dlehn@vt.edu> - API cleanup suggestion
+ Don Mahurin <dmahurin@dma.org> - stdin support for extract_a52
+ Jim Miller <jmiller@heli.engr.sgi.com> - IRIX output.c
+ Takefumi Sayo <stake@niagara.shiojiri.ne.jp> - FreeBSD tweak
+ Shoji Tokunaga <toku@mac.com> - aif file output
+
+(let me know if I forgot anyone)
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/COPYING b/src/filters/transform/mpadecfilter/a52dec-0.7.4/COPYING
new file mode 100644
index 000000000..f89b4fa4e
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/ChangeLog b/src/filters/transform/mpadecfilter/a52dec-0.7.4/ChangeLog
new file mode 100644
index 000000000..957295c13
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/ChangeLog
@@ -0,0 +1,97 @@
+a52dec-0.7.4 Sat Jul 27 20:44:00 PDT 2002
+-The library is now fully reentrant.
+-Added win32 output module, al file output, gain control.
+-A few additional portability enhancements.
+
+a52dec-0.7.3 Wed Feb 20 23:38:22 PST 2002
+-rewrite of the imdct code, making a52dec 40% to 80% faster than version 0.7.2
+-fixed one memory corruption problem in parse.c
+-small liba52 portability fixes
+-byte order and CRLF bugfixes in wav file output
+-aif file output
+-IRIX al sound output (untested, tell us if it works)
+
+a52dec-0.7.2 Sun Dec 16 14:39:56 PST 2001
+-demuxer improvements, with support for TS streams.
+-smaller demux buffer, making it easier to use a52dec as a pipe
+-wav output
+-avoid -fPIC when possible (-prefer-non-pic)
+-support for vc++ and TenDRA
+-portability fixes
+
+a52dec-0.7.1b Fri Aug 31 02:37:23 PDT 2001
+-removed an #include <stdint.h> that was only breaking libc5 builds
+
+a52dec-0.7.1 Thu Aug 30 02:13:23 PDT 2001
+-gcc 3.0 fixes
+-mlib fixes (now passes the test suite)
+-in a52dec.c, made sample_data and flags static
+-removed a few statics in liba52/parse.c (still not reentrant, but closer)
+
+a52dec-0.7.0 Thu Aug 23 23:18:00 PDT 2001
+-Downmix to arbitrary speaker configurations
+-Dynamic range compression
+-Major speedups: 2x for 2.0 streams with 2.0 output,
+ 3x for 5.1 streams with 2.0 output.
+-New library interface
+-Rematrixing bugfix
+-Higher precision
+
+ac3dec-0.6.1 Mon Mar 27 20:27:06 EST 2000
+-Fix another 2.0 problem (rematrix was wrong).
+-Fix the never resync on a bad crc bug.
+
+ac3dec-0.6.0 Sat Mar 18 19:43:25 EST 2000
+-New library interface
+-Fix bug wrt coupling channels that was causing sound quality problems.
+-Fix 2.0 mode problems (aka the I forgot to implement the phase flags bug).
+-All around speed improvements (almost twice as fast)
+-Improved robustness when fed bad data. The entire frame is checksummed before playback.
+
+ac3dec-0.5.6 Tue Nov 16 00:37:34 EST 1999
+-Irix support
+-Alpha fixes
+-Minor performance enhancements to downmix and imdct
+-OpenBSD fixes
+-extract_ac3 can now read from stdin
+-Change output_linux to block on write instead of using the
+ ring buffer. Let me know if this causes/fixes any problems
+
+ac3dec-0.5.5 Wed Aug 25 15:36:44 EDT 1999
+-Fixed a cut and paste bug (argh!) in parse.c which potentially
+ screwed up delta bit allocation info.
+-Martin Mueller <mamueller@topmail.de> informed me that I was missing
+ some corrections from the AC-3 errata document. It turns out that
+ I used an earlier version of the errata when I initially wrote ac3dec.
+ Fortunately the errata fix the outstanding bugs that I was pulling
+ my hair out on for a long time. Woohoo! Thanks Martin. Kudos to Dolby
+ Labs for keeping their documentation up to date as well.
+-stereo downmixing (downmix.c) is now in. Matrix encoded surround
+ (Dolby Prologic Surround) should work too.
+-clipping due to high level signals has been fixed. We normalize a
+ block of samples by its maximum absolute value if the max exceeds
+ the %100 digital level. This shouldn't be a problem, but for some
+ reason some channels have a dynamic range that exceeds [-1.0,1.0].
+ I blame the encoder :)
+-Multiple track support in extract_ac3. Simply just give it the track
+ number you want [1,8] after the filename.
+
+ac3dec-0.5.4 Thu Jul 29 16:55:10 PDT 1999
+-Fixed a stupid bug with the coupling channel that was causing
+ high frequencies to be attenuated.
+-Re-wrote the extract_ac3 tool.
+-Added to a tool to verify the checksums on a given AC3 stream.
+ (tools/verify_ac3)
+
+ac3dec-0.5.3 Mon Jul 12 10:45:56 PDT 1999
+-Fixed problems related to streams with coupling channel enabled.
+-Minor performance enhancements
+
+ac3dec-0.5.2 Sun Jul 4 12:00:25 PDT 1999
+-output_linux.c patch provided by Michael Holzt <kju@flummi.de>
+
+ac3dec-0.5.1 Wed Jun 30 17:48:52 PDT 1999
+-Compiles and dies gracefully under Linux now.
+
+ac3dec-0.5.0 Wed Jun 23 11:06:06 EDT 1999
+-First public release of ac3dec.
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/HISTORY b/src/filters/transform/mpadecfilter/a52dec-0.7.4/HISTORY
new file mode 100644
index 000000000..ab080aeae
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/HISTORY
@@ -0,0 +1,24 @@
+changes that affected the PCM output:
+
+2001/05/14 05:48:59 - aaron's 0.6.1 was cutting before the end
+
+2001/06/04 01:42:47 - slightly adjusted some values (volume, downmix adjustemtn, clev/slev tables)
+2001/06/04 05:48:31 - added adjust_level to the downmix
+
+2001/06/12
+2001/06/13 - changed the order of the dither() calls
+ also introduced bug with thx_2_0 stream
+
+2001/06/22 08:23:37 - fixed bug with thx_2_0 stream (see parse.c)
+
+2001/07/02 08:44:55 - changed float-to-int conversion (+ added saturation)
+
+2001/07/06 06:53:01 - more precise imdct init, more precise q_* coefficients
+
+2001/07/06 08:52:30 - rematrixing fixes
+
+2001/07/26 21:31:39 - do 3dB dither reduction in coeff_get() not dither_gen()
+
+2001/08/09 08:11:31 - implemented dynamic range compression
+
+2002/02/24 08:54:49 - window function computed at runtime, with more precision
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/INSTALL b/src/filters/transform/mpadecfilter/a52dec-0.7.4/INSTALL
new file mode 100644
index 000000000..1c97f4517
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/INSTALL
@@ -0,0 +1,58 @@
+Unix build instructions
+-----------------------
+
+./configure
+make
+make install
+
+If you install from CVS you'll have to run ./bootstrap first
+
+
+Building for win32
+------------------
+
+There are at least three ways to do it:
+
+- natively on Windows using Microsoft VC++ and the vc++ project
+ included in this distribution.
+
+- natively on Windows using MSYS + MINGW (www.mingw.org) (MSYS is a
+ minimal build environnement to compile unixish projects under
+ windows. It provides all the common unix tools like sh, gmake...)
+
+- or on Linux, using the mingw32 cross-compiler
+
+
+Building using MSYS + MINGW on windows
+--------------------------------------
+
+First you will need to download and install the latest MSYS (version
+1.0.7 as of now) and MINGW. The installation is really easy. Begin
+with the MSYS auto-installer and once this is done, extract MINGW into
+c:\msys\1.0\mingw. You also have to remember to remove the make
+utility included with MINGW as it conflicts with the one from MSYS
+(just rename or remove c:\msys\1.0\mingw\bin\make.exe).
+
+http://prdownloads.sourceforge.net/mingw/MSYS-1.0.7-i686-2002.04.24-1.exe
+http://prdownloads.sourceforge.net/mingw/MinGW-1.1.tar.gz
+
+Then you can build the package using:
+# ./configure
+# make
+
+
+Building using the mingw32 cross-compiler
+-----------------------------------------
+
+You need to install mingw32 first. For Debian GNU/Linux users, there
+is a mingw32 package. Otherwise you might get it from the mingw site
+at http://www.mingw.org/download.shtml.
+
+The videolan project also keeps precompiled mingw32 binaries at
+http://www.videolan.org/vlc/windows.html . If you install these,
+you'll have to set your PATH accordingly to include
+/usr/local/cross-tools/bin too.
+
+The build should then proceed using something like:
+# CC=i586-mingw32msvc-gcc ./configure --host=i586-mingw32msvc
+# make
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/NEWS b/src/filters/transform/mpadecfilter/a52dec-0.7.4/NEWS
new file mode 100644
index 000000000..aa994ebb1
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/NEWS
@@ -0,0 +1,46 @@
+a52dec-0.7.4 Sat Jul 27 20:44:00 PDT 2002
+
+The library is now fully reentrant.
+
+Added win32 output module, al file output, gain control.
+
+A few additional portability enhancements.
+
+
+a52dec-0.7.3 Wed Feb 20 23:38:22 PST 2002
+
+Performance enhancements, from 40% to 80% depending on streams.
+
+Fixed a few embarassing bugs in liba52: one memory corruption issue
+and a few minor portability problems.
+
+Several new output modules, and fixes in the existing .wav file output.
+
+
+a52dec-0.7.2 Sun Dec 16 14:39:56 PST 2001
+
+Minor bugfixes, performance and portability enhancements.
+
+Also added wav format output, and reduced the demux buffer size which
+makes it easier to use a52dec as a pipe.
+
+
+a52dec-0.7.1 Thu Aug 30 02:13:23 PDT 2001
+
+Minor release for bugfixes. Looks like 0.7.0 was a bit rushed out.
+
+Now compiles with gcc 3.0, made sure mlib implementation works, and
+fixed a small bug in the a52dec test program.
+
+
+a52dec-0.7.0 Thu Aug 23 23:18:00 PDT 2001
+
+First release since more than one year !
+
+The most user-noticeable additions are the downmix to arbitrary
+speaker configurations, and the implementation of dynamic range
+compression.
+
+The speed has been improved by a factor of 2 to 3, the conformance and
+precision should be higher, and we also fixed a small bug when playing
+stereo rematrixed streams.
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/README b/src/filters/transform/mpadecfilter/a52dec-0.7.4/README
new file mode 100644
index 000000000..3b1af4ea2
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/README
@@ -0,0 +1,176 @@
+
+
+ABOUT LIBA52
+
+liba52 is a free library for decoding ATSC A/52 streams. It is
+released under the terms of the GPL license. The A/52 standard is used
+in a variety of applications, including digital television and DVD. It
+is also known as AC-3.
+
+The main goals in liba52 development are:
+
+ * Portability - Currently all of the code is written in C, and
+ when we write platform-specific optimizations we will always
+ keep a generic C routine to fall back on.
+
+ * Reuseability - we do not want liba52 to include any
+ project-specific code, but it should still include enough
+ features to be used by very diverse projects.
+
+ * Precision - We are trying to implement all of the A/52
+ standard, and to have a very precise output by doing all the
+ calculations in floating point. We have a test suite that
+ detects any deviation in the output when compared to previous
+ versions. We do not have access to official A/52 test vectors
+ though, so we have to use our judgement to ensure that such
+ deviations are only intruduced when we fix bugs !
+
+ * Speed - liba52 is really fast, on any modern PC it should take
+ only a few percent of CPU time.
+
+The project homepage is at http://liba52.sourceforge.net/
+
+
+A52DEC
+
+a52dec is a test program for liba52. It decodes ATSC A/52 streams, and
+also includes a demultiplexer for mpeg-1 and mpeg-2 program streams.
+
+The liba52 source code is always distributed in the a52dec package, to
+make sure it easier for people to test it.
+
+The basic usage is to just type "a52dec file" where file is an ATSC
+A/52 file.
+
+The "-s" option must be used for multiplexed (audio and video) mpeg-2
+files. These files are usualy found on the internet or on unencrypted
+DVDs.
+
+The "-o" option is used to select a given output layer. By default
+a52dec does a stereo downmix and outputs to your speakers, but you can
+try other choices using this option. This is also used for performance
+testing and conformance testing.
+
+The "-c" option is used to disable all optimizations (currently only djbfft).
+
+The "-r" option is used to disable the dynamic range compression.
+
+
+OTHER PROJECTS USING LIBA52
+
+liba52 (and its ancestor libac3) is being used by various other
+projects, including:
+
+ * xine (http://xine.sourceforge.net/) - started as a simple
+ mpeg-2 audio and video decoder, but it since became a
+ full-featured DVD and video media player.
+
+ * MPlayer (http://www.MPlayerHQ.hu) - another good player, it is
+ also very robust against damaged streams.
+
+ * movietime (http://movietime.sourceforge.net/) - still quite
+ young, but it looks very promising !
+
+ * ffmpeg (http://ffmpeg.sourceforge.net/) - a nice audio/video
+ encoder and transcoder, uses liba52 for decoding A/52 streams.
+
+ * Ogle (http://www.dtek.chalmers.se/groups/dvd/) - a good DVD
+ player with menu support
+
+ * a52decX (http://homepage1.nifty.com/~toku/software_en.html) -
+ a graphical interface for a52dec in macintosh osX.
+
+ * bd4go (http://denisx.dyndns.org/bd4go/) - another graphical
+ interface for macintosh osX.
+
+ * OMS (http://www.linuxvideo.org/oms/)
+
+ * XMPS (http://xmps.sourceforge.net/)
+
+ * GStreamer (http://www.gstreamer.net/) - a framework for
+ streaming media; it has an A/52 decoding plugin based on liba52.
+
+ * mpeglib (http://mpeglib.sourceforge.net/) - a video decoding
+ library that usess liba52 when decoding A/52 streams.
+
+If you use liba52 in another project, let us know !
+
+VideoLAN (http://www.videolan.org/) does not use liba52, but this is
+still a cool project :)
+
+
+TASKS
+
+There are several places where we could easily use some help:
+
+ * Web design: This site sucks ! at the very least, we'd like to
+ come up with a nicer background picture and a logo.
+
+ * Testing: If you find any stream that does not decode right
+ with liba52, let us know ! The best thing would be to mail to
+ the liba52-devel mailing list. Also if you have access to
+ encoders, we'd love to get test streams that would be free of
+ rights - so that we can put them on this server.
+
+ * Coding: you can have a look in the TODO file first ! The most
+ important item is probably to make the code fully reentrant.
+
+ * Porting: If you're porting to a new architecture, you might
+ want to experiment with the compile flags defined in
+ configure.in . When you figure out whats fastest on your
+ platform, send us a patch !
+
+
+REFERENCES
+
+The A/52 standard, as published by the ATSC, is available at
+http://www.atsc.org/standards/a_52a.pdf
+
+
+CVS SNAPSHOTS
+
+A daily snapshot is created using "make distcheck" every night and
+uploaded to http://liba52.sourceforge.net/files/a52dec-snapshot.tar.gz .
+It is easier to use than the CVS repository, because you do not need
+to have the right versions of automake, autoconf and libtool
+installed. It might be convenient when working on a liba52 port for
+example.
+
+
+CVS REPOSITORY
+
+The latest liba52 and a52dec source code can always be found by
+anonymous CVS:
+
+# export CVSROOT=:pserver:anonymous@cvs.liba52.sourceforge.net:/cvsroot/liba52
+# cvs login (Just press Return when prompted for a password)
+# cvs checkout a52dec
+
+You can also browse the latest changes online at
+http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/liba52/a52dec/
+
+The other CVS modules are ac3dec-livid for the CVS history of the
+project while it was still hosted on the linuxvideo.org servers, and
+ac3dec for the CVS history of the project while the linuxvideo.org
+servers were down and before the library switched its name to liba52.
+
+
+MAILING LISTS
+
+See the subscription information at http://liba52.sourceforge.net/lists.html
+
+liba52-devel
+
+This is the main mailing list for technical discussion about
+liba52. Anyone wanting to work on liba52, or maybe just stay informed
+about the development process, should probably subscribe to this list.
+
+liba52-checkins
+
+All liba52 checkins are announced there. This is a good way to keep
+track of what goes into CVS.
+
+liba52-announce
+
+This is a very low traffic mailing list, only for announcements of new
+versions of liba52. Only project administrators can post there.
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/TODO b/src/filters/transform/mpadecfilter/a52dec-0.7.4/TODO
new file mode 100644
index 000000000..b14453bad
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/TODO
@@ -0,0 +1,12 @@
+* implement A/52a downmix extensions
+* use restrict pointers where appropriate
+* reduce size of delay buffer by 50%
+
+* get rid of globals in bitstream parsing
+* get rid of statics in imdct.c
+* avoid overflows, including reading the a52 stream !!!
+* make dither code faster (generate dither table in advance ?)
+* redo all bit allocation if previous frame had zero_snr_offsets
+* make dynrng work in dual-channel streams
+
+* update bitstream code
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/doc/liba52.txt b/src/filters/transform/mpadecfilter/a52dec-0.7.4/doc/liba52.txt
new file mode 100644
index 000000000..ecb7f818e
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/doc/liba52.txt
@@ -0,0 +1,208 @@
+Using the liba52 API
+--------------------
+
+liba52 provides a low-level interface to decoding audio frames encoded
+using ATSC standard A/52 aka AC-3. liba52 provides downmixing and
+dynamic range compression for the following output configurations:
+
+A52_CHANNEL : Dual mono. Two independant mono channels.
+A52_CHANNEL1 : First of the two mono channels above.
+A52_CHANNEL2 : Second of the two mono channels above.
+A52_MONO : Mono.
+A52_STEREO : Stereo.
+A52_DOLBY : Dolby surround compatible stereo.
+A52_3F : 3 front channels (left, center, right)
+A52_2F1R : 2 front, 1 rear surround channel (L, R, S)
+A52_3F1R : 3 front, 1 rear surround channel (L, C, R, S)
+A52_2F2R : 2 front, 2 rear surround channels (L, R, LS, RS)
+A52_3F2R : 3 front, 2 rear surround channels (L, C, R, LS, RS)
+
+A52_LFE : Low frequency effects channel. Normally used to connect a
+ subwoofer. Can be combined with any of the above channels.
+ For example: A52_3F2R | A52_LFE -> 3 front, 2 rear, 1 LFE (5.1)
+
+
+Initialization
+--------------
+
+sample_t * a52_init (uint32_t mm_accel);
+
+Initializes the A/52 library. Takes as a parameter the acceptable
+optimizations which may be used, such as MMX. These are found in the
+included header file 'mm_accel', along with an autodetection function
+(mm_accel()). Currently, the only accelleration implemented is
+MM_ACCEL_MLIB, which uses the 'mlib' library if installed. mlib is
+only available on some Sun Microsystems platforms.
+
+The return value is a pointer to a properly-aligned sample buffer used
+for output samples.
+
+
+Probing the bitstream
+---------------------
+
+int a52_syncinfo (uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate);
+
+The A/52 bitstream is composed of several a52 frames concatenated one
+after each other. An a52 frame is the smallest independantly decodable
+unit in the stream.
+
+buf must contain at least 7 bytes from the input stream. If these look
+like the start of a valid a52 frame, a52_syncinfo() returns the size
+of the coded frame in bytes, and fills flags, sample_rate and bit_rate
+with the information encoded in the stream. The returned size is
+guaranteed to be an even number between 128 and 3840. sample_rate will
+be the sampling frequency in Hz, bit_rate is for the compressed stream
+and is in bits per second, and flags is a description of the coded
+channels: the A52_LFE bit is set if there is an LFE channel coded in
+this stream, and by masking flags with A52_CHANNEL_MASK you will get a
+value that describes the full-bandwidth channels, as one of the
+A52_CHANNEL...A52_3F2R flags.
+
+If this can not possibly be a valid frame, then the function returns
+0. You should then try to re-synchronize with the a52 stream - one way
+to try this would be to advance buf by one byte until its contents
+looks like a valid frame, but there might be better
+application-specific ways to synchronize.
+
+It is recommended to call this function for each frame, for several
+reasons: this function detects errors that the other functions will
+not double-check, consecutive frames might have different lengths, and
+it helps you re-sync with the stream if you get de-synchronized.
+
+
+Starting to decode a frame
+--------------------------
+
+int a52_frame (a52_state_t * state, uint8_t * buf, int * flags,
+ sample_t * level, sample_t bias);
+
+This starts the work of decoding the A/52 frame (to be completed using
+a52_block()). buf should point to the beginning of the complete frame
+of the full size returned by a52_syncinfo().
+
+You should pass in the flags the speaker configuration that you
+support, and liba52 will return the speaker configuration it will use
+for its output, based on what is coded in the stream and what you
+asked for. For example, if the stream contains 2+2 channels
+(a52_syncinfo() returned A52_2F2R in the flags), and you have 3+1
+speakers (you passed A52_3F1R), then liba52 will choose do downmix to
+2+1 speakers, since there is no center channel to send to your center
+speaker. So in that case the left and right channels will be
+essentially unmodified by the downmix, and the two surround channels
+will be added together and sent to your surround speaker. liba52 will
+return A52_2F1R to indicate this.
+
+The good news is that when you downmix to stereo you dont have to
+worry about this, you will ALWAYS get a stereo output no matter what
+was coded in the stream. For more complex output configurations you
+will have to handle the case where liba52 couldnt give you what you
+wanted because some of the channels were not encoded in the stream
+though.
+
+Level, bias, and A52_ADJUST_LEVEL:
+
+Before downmixing, samples are floating point values with a range of
+[-1,1]. Most types of downmixing will combine channels together, which
+will potentially result in a larger range for the output
+samples. liba52 provides two methods of controlling the range of the
+output, either before or after the downmix stage.
+
+If you do not set A52_ADJUST_LEVEL, liba52 will multiply the samples
+by your level value, so that they fit in the [-level,level]
+range. Then it will apply the standardized downmix equations,
+potentially making the samples go out of that interval again. The
+level parameter is not modified.
+
+Setting the A52_ADJUST_LEVEL flag will instruct liba52 to treat your
+level value as the intended range interval after downmixing. It will
+then figure out what level to use before the downmix (what you should
+have passed if you hadnt used the A52_ADJUST_LEVEL flag), and
+overwrite the level value you gave it with that new level value.
+
+The bias represents a value which should be added to the result
+regardless:
+
+output_sample = (input_sample * level) + bias;
+
+For example, a bias of 384 and a level of 1 tells liba52 you want
+samples between 383 and 385 instead of -1 and 1. This is what the
+sample program a52dec does, as it makes it faster to convert the
+samples to integer format, using a trick based on the IEEE
+floating-point format.
+
+This function also initialises the state for that frame, which will be
+reused next when decoding blocks.
+
+
+Dynamic range compression
+-------------------------
+
+void a52_dynrng (a52_state_t * state,
+ sample_t (* call) (sample_t, void *), void * data);
+
+This function is purely optional. If you dont call it, liba52 will
+provide the default behaviour, which is to apply the full dynamic
+range compression as specified in the A/52 stream. This basically
+makes the loud sounds softer, and the soft sounds louder, so you can
+more easily listen to the stream in a noisy environment without
+disturbing anyone.
+
+If you do call this function and set a NULL callback, this will
+totally disable the dynamic range compression and provide a playback
+more adapted to a movie theater or a listening room.
+
+If you call this function and specify a callback function, this
+callback might be called up to once for each block, with two
+arguments: the compression factor 'c' recommended by the bitstream,
+and the private data pointer you specified in a52_dynrng(). The
+callback will then return the amount of compression to actually use -
+typically pow(c,x) where x is somewhere between 0 and 1. More
+elaborate compression functions might want to use a different value
+for 'x' depending wether c>1 or c<1 - or even something more complex
+if this is what you want.
+
+
+Decoding blocks
+---------------
+
+int a52_block (a52_state_t * state, sample_t * samples);
+
+Every A/52 frame is composed of 6 blocks, each with an output of 256
+samples for each channel. The a52_block() function decodes the next
+block in the frame, and should be called 6 times to decode all of the
+audio in the frame. After each call, you should extract the audio data
+from the sample buffer.
+
+The sample pointer given should be the one a52_init() returned.
+
+After this function returns, the samples buuffer will contain 256
+samples for the first channel, followed by 256 samples for the second
+channel, etc... the channel order is LFE, left, center, right, left
+surround, right surround. If one of the channels is not present in the
+liba52 output, as indicated by the flags returned by a52_frame(), then
+this channel is skipped and the following channels are shifted so
+liba52 does not leave an empty space between channels.
+
+
+Pseudocode example
+------------------
+
+sample_t * samples = a52_init (mm_accel());
+
+loop on input bytes:
+ if at least 7 bytes in the buffer:
+
+ bytes_to_get = a52_syncinfo (...)
+
+ if bytes_to_get == 0:
+ goto loop to keep looking for sync point
+ else
+ get rest of bytes
+
+ a52_frame (state, buf, ...)
+ [a52_dynrng (state, ...); this is only optional]
+ for i = 1 ... 6:
+ a52_block (state, samples)
+ convert samples to integer and queue to soundcard
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/include/a52.h b/src/filters/transform/mpadecfilter/a52dec-0.7.4/include/a52.h
new file mode 100644
index 000000000..18f30b8df
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/include/a52.h
@@ -0,0 +1,72 @@
+/*
+ * a52.h
+ * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of a52dec, a free ATSC A-52 stream decoder.
+ * See http://liba52.sourceforge.net/ for updates.
+ *
+ * a52dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * a52dec 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 A52_H
+#define A52_H
+
+#define LIBA52_DOUBLE
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+#ifndef LIBA52_DOUBLE
+typedef float sample_t;
+#else
+typedef double sample_t;
+#endif
+
+typedef struct a52_state_s a52_state_t;
+
+#define A52_CHANNEL 0
+#define A52_MONO 1
+#define A52_STEREO 2
+#define A52_3F 3
+#define A52_2F1R 4
+#define A52_3F1R 5
+#define A52_2F2R 6
+#define A52_3F2R 7
+#define A52_CHANNEL1 8
+#define A52_CHANNEL2 9
+#define A52_DOLBY 10
+#define A52_CHANNEL_MASK 15
+
+#define A52_LFE 16
+#define A52_ADJUST_LEVEL 32
+
+a52_state_t * a52_init (uint32_t mm_accel);
+sample_t * a52_samples (a52_state_t * state);
+int a52_syncinfo (uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate);
+int a52_frame (a52_state_t * state, uint8_t * buf, int * flags,
+ sample_t * level, sample_t bias);
+void a52_dynrng (a52_state_t * state,
+ sample_t (* call) (sample_t, void *), void * data);
+int a52_block (a52_state_t * state);
+void a52_free (a52_state_t * state);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif /* A52_H */ \ No newline at end of file
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/a52_internal.h b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/a52_internal.h
new file mode 100644
index 000000000..63ae3dd44
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/a52_internal.h
@@ -0,0 +1,120 @@
+/*
+ * a52_internal.h
+ * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of a52dec, a free ATSC A-52 stream decoder.
+ * See http://liba52.sourceforge.net/ for updates.
+ *
+ * a52dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * a52dec 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
+ */
+
+typedef struct {
+ uint8_t bai; /* fine SNR offset, fast gain */
+ uint8_t deltbae; /* delta bit allocation exists */
+ int8_t deltba[50]; /* per-band delta bit allocation */
+} ba_t;
+
+typedef struct {
+ uint8_t exp[256]; /* decoded channel exponents */
+ int8_t bap[256]; /* derived channel bit allocation */
+} expbap_t;
+
+struct a52_state_s {
+ uint8_t fscod; /* sample rate */
+ uint8_t halfrate; /* halfrate factor */
+ uint8_t acmod; /* coded channels */
+ uint8_t lfeon; /* coded lfe channel */
+ sample_t clev; /* centre channel mix level */
+ sample_t slev; /* surround channels mix level */
+
+ int output; /* type of output */
+ sample_t level; /* output level */
+ sample_t bias; /* output bias */
+
+ int dynrnge; /* apply dynamic range */
+ sample_t dynrng; /* dynamic range */
+ void * dynrngdata; /* dynamic range callback funtion and data */
+ sample_t (* dynrngcall) (sample_t range, void * dynrngdata);
+
+ uint8_t chincpl; /* channel coupled */
+ uint8_t phsflginu; /* phase flags in use (stereo only) */
+ uint8_t cplstrtmant; /* coupling channel start mantissa */
+ uint8_t cplendmant; /* coupling channel end mantissa */
+ uint32_t cplbndstrc; /* coupling band structure */
+ sample_t cplco[5][18]; /* coupling coordinates */
+
+ /* derived information */
+ uint8_t cplstrtbnd; /* coupling start band (for bit allocation) */
+ uint8_t ncplbnd; /* number of coupling bands */
+
+ uint8_t rematflg; /* stereo rematrixing */
+
+ uint8_t endmant[5]; /* channel end mantissa */
+
+ uint16_t bai; /* bit allocation information */
+
+ uint32_t * buffer_start;
+ uint16_t lfsr_state; /* dither state */
+ uint32_t bits_left;
+ uint32_t current_word;
+
+ uint8_t csnroffst; /* coarse SNR offset */
+ ba_t cplba; /* coupling bit allocation parameters */
+ ba_t ba[5]; /* channel bit allocation parameters */
+ ba_t lfeba; /* lfe bit allocation parameters */
+
+ uint8_t cplfleak; /* coupling fast leak init */
+ uint8_t cplsleak; /* coupling slow leak init */
+
+ expbap_t cpl_expbap;
+ expbap_t fbw_expbap[5];
+ expbap_t lfe_expbap;
+
+ sample_t * samples;
+ int downmixed;
+};
+
+#define LEVEL_PLUS6DB 2.0
+#define LEVEL_PLUS3DB 1.4142135623730951
+#define LEVEL_3DB 0.7071067811865476
+#define LEVEL_45DB 0.5946035575013605
+#define LEVEL_6DB 0.5
+
+#define EXP_REUSE (0)
+#define EXP_D15 (1)
+#define EXP_D25 (2)
+#define EXP_D45 (3)
+
+#define DELTA_BIT_REUSE (0)
+#define DELTA_BIT_NEW (1)
+#define DELTA_BIT_NONE (2)
+#define DELTA_BIT_RESERVED (3)
+
+void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart,
+ int start, int end, int fastleak, int slowleak,
+ expbap_t * expbap);
+
+int a52_downmix_init (int input, int flags, sample_t * level,
+ sample_t clev, sample_t slev);
+int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
+ sample_t clev, sample_t slev);
+void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias,
+ sample_t clev, sample_t slev);
+void a52_upmix (sample_t * samples, int acmod, int output);
+
+void a52_imdct_init (uint32_t mm_accel);
+void a52_imdct_256 (sample_t * data, sample_t * delay, sample_t bias);
+void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias);
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bit_allocate.c b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bit_allocate.c
new file mode 100644
index 000000000..a18592e47
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bit_allocate.c
@@ -0,0 +1,265 @@
+/*
+ * bit_allocate.c
+ * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of a52dec, a free ATSC A-52 stream decoder.
+ * See http://liba52.sourceforge.net/ for updates.
+ *
+ * a52dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * a52dec 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 "config.h"
+
+#include <inttypes.h>
+
+#include "a52.h"
+#include "a52_internal.h"
+
+static int hthtab[3][50] = {
+ {0x730, 0x730, 0x7c0, 0x800, 0x820, 0x840, 0x850, 0x850, 0x860, 0x860,
+ 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x890, 0x890,
+ 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900,
+ 0x910, 0x910, 0x910, 0x910, 0x900, 0x8f0, 0x8c0, 0x870, 0x820, 0x7e0,
+ 0x7a0, 0x770, 0x760, 0x7a0, 0x7c0, 0x7c0, 0x6e0, 0x400, 0x3c0, 0x3c0},
+ {0x710, 0x710, 0x7a0, 0x7f0, 0x820, 0x830, 0x840, 0x850, 0x850, 0x860,
+ 0x860, 0x860, 0x860, 0x860, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880,
+ 0x890, 0x890, 0x8a0, 0x8a0, 0x8b0, 0x8b0, 0x8c0, 0x8c0, 0x8e0, 0x8f0,
+ 0x900, 0x910, 0x910, 0x910, 0x910, 0x900, 0x8e0, 0x8b0, 0x870, 0x820,
+ 0x7e0, 0x7b0, 0x760, 0x770, 0x7a0, 0x7c0, 0x780, 0x5d0, 0x3c0, 0x3c0},
+ {0x680, 0x680, 0x750, 0x7b0, 0x7e0, 0x810, 0x820, 0x830, 0x840, 0x850,
+ 0x850, 0x850, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860, 0x860,
+ 0x870, 0x870, 0x870, 0x870, 0x880, 0x880, 0x880, 0x890, 0x8a0, 0x8b0,
+ 0x8c0, 0x8d0, 0x8e0, 0x8f0, 0x900, 0x910, 0x910, 0x910, 0x900, 0x8f0,
+ 0x8d0, 0x8b0, 0x840, 0x7f0, 0x790, 0x760, 0x7a0, 0x7c0, 0x7b0, 0x720}
+};
+
+static int8_t baptab[305] = {
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, /* 93 padding elems */
+
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 14, 14, 14, 14, 14, 14, 14,
+ 14, 12, 12, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9,
+ 9, 8, 8, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5,
+ 5, 4, 4, -3, -3, 3, 3, 3, -2, -2, -1, -1, -1, -1, -1, 0,
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0 /* 148 padding elems */
+};
+
+static int bndtab[30] = {21, 22, 23, 24, 25, 26, 27, 28, 31, 34,
+ 37, 40, 43, 46, 49, 55, 61, 67, 73, 79,
+ 85, 97, 109, 121, 133, 157, 181, 205, 229, 253};
+
+static int8_t latab[256] = {
+ -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53,
+ -52, -52, -51, -50, -49, -48, -47, -47, -46, -45, -44, -44,
+ -43, -42, -41, -41, -40, -39, -38, -38, -37, -36, -36, -35,
+ -35, -34, -33, -33, -32, -32, -31, -30, -30, -29, -29, -28,
+ -28, -27, -27, -26, -26, -25, -25, -24, -24, -23, -23, -22,
+ -22, -21, -21, -21, -20, -20, -19, -19, -19, -18, -18, -18,
+ -17, -17, -17, -16, -16, -16, -15, -15, -15, -14, -14, -14,
+ -13, -13, -13, -13, -12, -12, -12, -12, -11, -11, -11, -11,
+ -10, -10, -10, -10, -10, -9, -9, -9, -9, -9, -8, -8,
+ -8, -8, -8, -8, -7, -7, -7, -7, -7, -7, -6, -6,
+ -6, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5,
+ -5, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,
+ -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3,
+ -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
+
+#define UPDATE_LEAK() \
+do { \
+ fastleak += fdecay; \
+ if (fastleak > psd + fgain) \
+ fastleak = psd + fgain; \
+ slowleak += sdecay; \
+ if (slowleak > psd + sgain) \
+ slowleak = psd + sgain; \
+} while (0)
+
+#define COMPUTE_MASK() \
+do { \
+ if (psd > dbknee) \
+ mask -= (psd - dbknee) >> 2; \
+ if (mask > hth [i >> halfrate]) \
+ mask = hth [i >> halfrate]; \
+ mask -= snroffset + 128 * deltba[i]; \
+ mask = (mask > 0) ? 0 : ((-mask) >> 5); \
+ mask -= floor; \
+} while (0)
+
+void a52_bit_allocate (a52_state_t * state, ba_t * ba, int bndstart,
+ int start, int end, int fastleak, int slowleak,
+ expbap_t * expbap)
+{
+ static int slowgain[4] = {0x540, 0x4d8, 0x478, 0x410};
+ static int dbpbtab[4] = {0xc00, 0x500, 0x300, 0x100};
+ static int floortab[8] = {0x910, 0x950, 0x990, 0x9d0,
+ 0xa10, 0xa90, 0xb10, 0x1400};
+
+ int i, j;
+ uint8_t * exp;
+ int8_t * bap;
+ int fdecay, fgain, sdecay, sgain, dbknee, floor, snroffset;
+ int psd, mask;
+ int8_t * deltba;
+ int * hth;
+ int halfrate;
+
+ halfrate = state->halfrate;
+ fdecay = (63 + 20 * ((state->bai >> 7) & 3)) >> halfrate; /* fdcycod */
+ fgain = 128 + 128 * (ba->bai & 7); /* fgaincod */
+ sdecay = (15 + 2 * (state->bai >> 9)) >> halfrate; /* sdcycod */
+ sgain = slowgain[(state->bai >> 5) & 3]; /* sgaincod */
+ dbknee = dbpbtab[(state->bai >> 3) & 3]; /* dbpbcod */
+ hth = hthtab[state->fscod];
+ /*
+ * if there is no delta bit allocation, make deltba point to an area
+ * known to contain zeroes. baptab+156 here.
+ */
+ deltba = (ba->deltbae == DELTA_BIT_NONE) ? baptab + 156 : ba->deltba;
+ floor = floortab[state->bai & 7]; /* floorcod */
+ snroffset = 960 - 64 * state->csnroffst - 4 * (ba->bai >> 3) + floor;
+ floor >>= 5;
+
+ exp = expbap->exp;
+ bap = expbap->bap;
+
+ i = bndstart;
+ j = start;
+ if (start == 0) { /* not the coupling channel */
+ int lowcomp;
+
+ lowcomp = 0;
+ j = end - 1;
+ do {
+ if (i < j) {
+ if (exp[i+1] == exp[i] - 2)
+ lowcomp = 384;
+ else if (lowcomp && (exp[i+1] > exp[i]))
+ lowcomp -= 64;
+ }
+ psd = 128 * exp[i];
+ mask = psd + fgain + lowcomp;
+ COMPUTE_MASK ();
+ bap[i] = (baptab+156)[mask + 4 * exp[i]];
+ i++;
+ } while ((i < 3) || ((i < 7) && (exp[i] > exp[i-1])));
+ fastleak = psd + fgain;
+ slowleak = psd + sgain;
+
+ while (i < 7) {
+ if (i < j) {
+ if (exp[i+1] == exp[i] - 2)
+ lowcomp = 384;
+ else if (lowcomp && (exp[i+1] > exp[i]))
+ lowcomp -= 64;
+ }
+ psd = 128 * exp[i];
+ UPDATE_LEAK ();
+ mask = ((fastleak + lowcomp < slowleak) ?
+ fastleak + lowcomp : slowleak);
+ COMPUTE_MASK ();
+ bap[i] = (baptab+156)[mask + 4 * exp[i]];
+ i++;
+ }
+
+ if (end == 7) /* lfe channel */
+ return;
+
+ do {
+ if (exp[i+1] == exp[i] - 2)
+ lowcomp = 320;
+ else if (lowcomp && (exp[i+1] > exp[i]))
+ lowcomp -= 64;
+ psd = 128 * exp[i];
+ UPDATE_LEAK ();
+ mask = ((fastleak + lowcomp < slowleak) ?
+ fastleak + lowcomp : slowleak);
+ COMPUTE_MASK ();
+ bap[i] = (baptab+156)[mask + 4 * exp[i]];
+ i++;
+ } while (i < 20);
+
+ while (lowcomp > 128) { /* two iterations maximum */
+ lowcomp -= 128;
+ psd = 128 * exp[i];
+ UPDATE_LEAK ();
+ mask = ((fastleak + lowcomp < slowleak) ?
+ fastleak + lowcomp : slowleak);
+ COMPUTE_MASK ();
+ bap[i] = (baptab+156)[mask + 4 * exp[i]];
+ i++;
+ }
+ j = i;
+ }
+
+ do {
+ int startband, endband;
+
+ startband = j;
+ endband = ((bndtab-20)[i] < end) ? (bndtab-20)[i] : end;
+ psd = 128 * exp[j++];
+ while (j < endband) {
+ int next, delta;
+
+ next = 128 * exp[j++];
+ delta = next - psd;
+ switch (delta >> 9) {
+ case -6: case -5: case -4: case -3: case -2:
+ psd = next;
+ break;
+ case -1:
+ psd = next + latab[(-delta) >> 1];
+ break;
+ case 0:
+ psd += latab[delta >> 1];
+ break;
+ }
+ }
+ /* minpsd = -289 */
+ UPDATE_LEAK ();
+ mask = (fastleak < slowleak) ? fastleak : slowleak;
+ COMPUTE_MASK ();
+ i++;
+ j = startband;
+ do {
+ /* max(mask+4*exp)=147=-(minpsd+fgain-deltba-snroffset)>>5+4*exp */
+ /* min(mask+4*exp)=-156=-(sgain-deltba-snroffset)>>5 */
+ bap[j] = (baptab+156)[mask + 4 * exp[j]];
+ } while (++j < endband);
+ } while (j < end);
+}
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bitstream.c b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bitstream.c
new file mode 100644
index 000000000..b4bc219d8
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bitstream.c
@@ -0,0 +1,95 @@
+/*
+ * bitstream.c
+ * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of a52dec, a free ATSC A-52 stream decoder.
+ * See http://liba52.sourceforge.net/ for updates.
+ *
+ * a52dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * a52dec 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 "config.h"
+
+#include <inttypes.h>
+
+#include "a52.h"
+#include "a52_internal.h"
+#include "bitstream.h"
+
+#define BUFFER_SIZE 4096
+
+void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf)
+{
+ int align;
+
+ align = (long)buf & 3;
+ state->buffer_start = (uint32_t *) (buf - align);
+ state->bits_left = 0;
+ bitstream_get (state, align * 8);
+}
+
+static inline void bitstream_fill_current (a52_state_t * state)
+{
+ uint32_t tmp;
+
+ tmp = *(state->buffer_start++);
+ state->current_word = swab32 (tmp);
+}
+
+/*
+ * The fast paths for _get is in the
+ * bitstream.h header file so it can be inlined.
+ *
+ * The "bottom half" of this routine is suffixed _bh
+ *
+ * -ah
+ */
+
+uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits)
+{
+ uint32_t result;
+
+ num_bits -= state->bits_left;
+ result = ((state->current_word << (32 - state->bits_left)) >>
+ (32 - state->bits_left));
+
+ bitstream_fill_current (state);
+
+ if (num_bits != 0)
+ result = (result << num_bits) | (state->current_word >> (32 - num_bits));
+
+ state->bits_left = 32 - num_bits;
+
+ return result;
+}
+
+int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits)
+{
+ int32_t result;
+
+ num_bits -= state->bits_left;
+ result = ((((int32_t)state->current_word) << (32 - state->bits_left)) >>
+ (32 - state->bits_left));
+
+ bitstream_fill_current(state);
+
+ if (num_bits != 0)
+ result = (result << num_bits) | (state->current_word >> (32 - num_bits));
+
+ state->bits_left = 32 - num_bits;
+
+ return result;
+}
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bitstream.h b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bitstream.h
new file mode 100644
index 000000000..aad3683ee
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/bitstream.h
@@ -0,0 +1,77 @@
+/*
+ * bitstream.h
+ * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of a52dec, a free ATSC A-52 stream decoder.
+ * See http://liba52.sourceforge.net/ for updates.
+ *
+ * a52dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * a52dec 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
+ */
+
+/* (stolen from the kernel) */
+#ifdef WORDS_BIGENDIAN
+
+# define swab32(x) (x)
+
+#else
+
+# if 0 && defined (__i386__)
+
+# define swab32(x) __i386_swab32(x)
+ static inline const uint32_t __i386_swab32(uint32_t x)
+ {
+ __asm__("bswap %0" : "=r" (x) : "0" (x));
+ return x;
+ }
+
+# else
+
+# define swab32(x)\
+((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) | \
+ (((uint8_t*)&x)[2] << 8) | (((uint8_t*)&x)[3]))
+
+# endif
+#endif
+
+void a52_bitstream_set_ptr (a52_state_t * state, uint8_t * buf);
+uint32_t a52_bitstream_get_bh (a52_state_t * state, uint32_t num_bits);
+int32_t a52_bitstream_get_bh_2 (a52_state_t * state, uint32_t num_bits);
+
+static inline uint32_t bitstream_get (a52_state_t * state, uint32_t num_bits)
+{
+ uint32_t result;
+
+ if (num_bits < state->bits_left) {
+ result = (state->current_word << (32 - state->bits_left)) >> (32 - num_bits);
+ state->bits_left -= num_bits;
+ return result;
+ }
+
+ return a52_bitstream_get_bh (state, num_bits);
+}
+
+static inline int32_t bitstream_get_2 (a52_state_t * state, uint32_t num_bits)
+{
+ int32_t result;
+
+ if (num_bits < state->bits_left) {
+ result = (((int32_t)state->current_word) << (32 - state->bits_left)) >> (32 - num_bits);
+ state->bits_left -= num_bits;
+ return result;
+ }
+
+ return a52_bitstream_get_bh_2 (state, num_bits);
+}
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/downmix.c b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/downmix.c
new file mode 100644
index 000000000..2ce693f4d
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/downmix.c
@@ -0,0 +1,655 @@
+/*
+ * downmix.c
+ * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of a52dec, a free ATSC A-52 stream decoder.
+ * See http://liba52.sourceforge.net/ for updates.
+ *
+ * a52dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * a52dec 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 "config.h"
+
+#include <string.h>
+#include <inttypes.h>
+
+#include "a52.h"
+#include "a52_internal.h"
+
+#define CONVERT(acmod,output) (((output) << 3) + (acmod))
+
+int a52_downmix_init (int input, int flags, sample_t * level,
+ sample_t clev, sample_t slev)
+{
+ static uint8_t table[11][8] = {
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
+ A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
+ {A52_MONO, A52_MONO, A52_MONO, A52_MONO,
+ A52_MONO, A52_MONO, A52_MONO, A52_MONO},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
+ A52_STEREO, A52_STEREO, A52_STEREO, A52_STEREO},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
+ A52_STEREO, A52_3F, A52_STEREO, A52_3F},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
+ A52_2F1R, A52_2F1R, A52_2F1R, A52_2F1R},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_STEREO,
+ A52_2F1R, A52_3F1R, A52_2F1R, A52_3F1R},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
+ A52_2F2R, A52_2F2R, A52_2F2R, A52_2F2R},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_3F,
+ A52_2F2R, A52_3F2R, A52_2F2R, A52_3F2R},
+ {A52_CHANNEL1, A52_MONO, A52_MONO, A52_MONO,
+ A52_MONO, A52_MONO, A52_MONO, A52_MONO},
+ {A52_CHANNEL2, A52_MONO, A52_MONO, A52_MONO,
+ A52_MONO, A52_MONO, A52_MONO, A52_MONO},
+ {A52_CHANNEL, A52_DOLBY, A52_STEREO, A52_DOLBY,
+ A52_DOLBY, A52_DOLBY, A52_DOLBY, A52_DOLBY}
+ };
+ int output;
+
+ output = flags & A52_CHANNEL_MASK;
+ if (output > A52_DOLBY)
+ return -1;
+
+ output = table[output][input & 7];
+
+ if ((output == A52_STEREO) &&
+ ((input == A52_DOLBY) || ((input == A52_3F) && (clev == LEVEL_3DB))))
+ output = A52_DOLBY;
+
+ if (flags & A52_ADJUST_LEVEL)
+ switch (CONVERT (input & 7, output)) {
+
+ case CONVERT (A52_3F, A52_MONO):
+ *level *= LEVEL_3DB / (1 + clev);
+ break;
+
+ case CONVERT (A52_STEREO, A52_MONO):
+ case CONVERT (A52_2F2R, A52_2F1R):
+ case CONVERT (A52_3F2R, A52_3F1R):
+ level_3db:
+ *level *= LEVEL_3DB;
+ break;
+
+ case CONVERT (A52_3F2R, A52_2F1R):
+ if (clev < LEVEL_PLUS3DB - 1)
+ goto level_3db;
+ /* break thru */
+ case CONVERT (A52_3F, A52_STEREO):
+ case CONVERT (A52_3F1R, A52_2F1R):
+ case CONVERT (A52_3F1R, A52_2F2R):
+ case CONVERT (A52_3F2R, A52_2F2R):
+ *level /= 1 + clev;
+ break;
+
+ case CONVERT (A52_2F1R, A52_MONO):
+ *level *= LEVEL_PLUS3DB / (2 + slev);
+ break;
+
+ case CONVERT (A52_2F1R, A52_STEREO):
+ case CONVERT (A52_3F1R, A52_3F):
+ *level /= 1 + slev * LEVEL_3DB;
+ break;
+
+ case CONVERT (A52_3F1R, A52_MONO):
+ *level *= LEVEL_3DB / (1 + clev + 0.5 * slev);
+ break;
+
+ case CONVERT (A52_3F1R, A52_STEREO):
+ *level /= 1 + clev + slev * LEVEL_3DB;
+ break;
+
+ case CONVERT (A52_2F2R, A52_MONO):
+ *level *= LEVEL_3DB / (1 + slev);
+ break;
+
+ case CONVERT (A52_2F2R, A52_STEREO):
+ case CONVERT (A52_3F2R, A52_3F):
+ *level /= 1 + slev;
+ break;
+
+ case CONVERT (A52_3F2R, A52_MONO):
+ *level *= LEVEL_3DB / (1 + clev + slev);
+ break;
+
+ case CONVERT (A52_3F2R, A52_STEREO):
+ *level /= 1 + clev + slev;
+ break;
+
+ case CONVERT (A52_MONO, A52_DOLBY):
+ *level *= LEVEL_PLUS3DB;
+ break;
+
+ case CONVERT (A52_3F, A52_DOLBY):
+ case CONVERT (A52_2F1R, A52_DOLBY):
+ *level *= 1 / (1 + LEVEL_3DB);
+ break;
+
+ case CONVERT (A52_3F1R, A52_DOLBY):
+ case CONVERT (A52_2F2R, A52_DOLBY):
+ *level *= 1 / (1 + 2 * LEVEL_3DB);
+ break;
+
+ case CONVERT (A52_3F2R, A52_DOLBY):
+ *level *= 1 / (1 + 3 * LEVEL_3DB);
+ break;
+ }
+
+ return output;
+}
+
+int a52_downmix_coeff (sample_t * coeff, int acmod, int output, sample_t level,
+ sample_t clev, sample_t slev)
+{
+ switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL):
+ case CONVERT (A52_MONO, A52_MONO):
+ case CONVERT (A52_STEREO, A52_STEREO):
+ case CONVERT (A52_3F, A52_3F):
+ case CONVERT (A52_2F1R, A52_2F1R):
+ case CONVERT (A52_3F1R, A52_3F1R):
+ case CONVERT (A52_2F2R, A52_2F2R):
+ case CONVERT (A52_3F2R, A52_3F2R):
+ case CONVERT (A52_STEREO, A52_DOLBY):
+ coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level;
+ return 0;
+
+ case CONVERT (A52_CHANNEL, A52_MONO):
+ coeff[0] = coeff[1] = level * LEVEL_6DB;
+ return 3;
+
+ case CONVERT (A52_STEREO, A52_MONO):
+ coeff[0] = coeff[1] = level * LEVEL_3DB;
+ return 3;
+
+ case CONVERT (A52_3F, A52_MONO):
+ coeff[0] = coeff[2] = level * LEVEL_3DB;
+ coeff[1] = level * clev * LEVEL_PLUS3DB;
+ return 7;
+
+ case CONVERT (A52_2F1R, A52_MONO):
+ coeff[0] = coeff[1] = level * LEVEL_3DB;
+ coeff[2] = level * slev * LEVEL_3DB;
+ return 7;
+
+ case CONVERT (A52_2F2R, A52_MONO):
+ coeff[0] = coeff[1] = level * LEVEL_3DB;
+ coeff[2] = coeff[3] = level * slev * LEVEL_3DB;
+ return 15;
+
+ case CONVERT (A52_3F1R, A52_MONO):
+ coeff[0] = coeff[2] = level * LEVEL_3DB;
+ coeff[1] = level * clev * LEVEL_PLUS3DB;
+ coeff[3] = level * slev * LEVEL_3DB;
+ return 15;
+
+ case CONVERT (A52_3F2R, A52_MONO):
+ coeff[0] = coeff[2] = level * LEVEL_3DB;
+ coeff[1] = level * clev * LEVEL_PLUS3DB;
+ coeff[3] = coeff[4] = level * slev * LEVEL_3DB;
+ return 31;
+
+ case CONVERT (A52_MONO, A52_DOLBY):
+ coeff[0] = level * LEVEL_3DB;
+ return 0;
+
+ case CONVERT (A52_3F, A52_DOLBY):
+ clev = LEVEL_3DB;
+ case CONVERT (A52_3F, A52_STEREO):
+ case CONVERT (A52_3F1R, A52_2F1R):
+ case CONVERT (A52_3F2R, A52_2F2R):
+ coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
+ coeff[1] = level * clev;
+ return 7;
+
+ case CONVERT (A52_2F1R, A52_DOLBY):
+ slev = 1;
+ case CONVERT (A52_2F1R, A52_STEREO):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = level * slev * LEVEL_3DB;
+ return 7;
+
+ case CONVERT (A52_3F1R, A52_DOLBY):
+ clev = LEVEL_3DB;
+ slev = 1;
+ case CONVERT (A52_3F1R, A52_STEREO):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = level * clev;
+ coeff[3] = level * slev * LEVEL_3DB;
+ return 15;
+
+ case CONVERT (A52_2F2R, A52_DOLBY):
+ slev = LEVEL_3DB;
+ case CONVERT (A52_2F2R, A52_STEREO):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = level * slev;
+ return 15;
+
+ case CONVERT (A52_3F2R, A52_DOLBY):
+ clev = LEVEL_3DB;
+ case CONVERT (A52_3F2R, A52_2F1R):
+ slev = LEVEL_3DB;
+ case CONVERT (A52_3F2R, A52_STEREO):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = level * clev;
+ coeff[3] = coeff[4] = level * slev;
+ return 31;
+
+ case CONVERT (A52_3F1R, A52_3F):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = level * slev * LEVEL_3DB;
+ return 13;
+
+ case CONVERT (A52_3F2R, A52_3F):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = coeff[4] = level * slev;
+ return 29;
+
+ case CONVERT (A52_2F2R, A52_2F1R):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = level * LEVEL_3DB;
+ return 12;
+
+ case CONVERT (A52_3F2R, A52_3F1R):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = coeff[4] = level * LEVEL_3DB;
+ return 24;
+
+ case CONVERT (A52_2F1R, A52_2F2R):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = level * LEVEL_3DB;
+ return 0;
+
+ case CONVERT (A52_3F1R, A52_2F2R):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = level * clev;
+ coeff[3] = level * LEVEL_3DB;
+ return 7;
+
+ case CONVERT (A52_3F1R, A52_3F2R):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = level * LEVEL_3DB;
+ return 0;
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL1):
+ coeff[0] = level;
+ coeff[1] = 0;
+ return 0;
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL2):
+ coeff[0] = 0;
+ coeff[1] = level;
+ return 0;
+ }
+
+ return -1; /* NOTREACHED */
+}
+
+static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ dest[i] += src[i] + bias;
+}
+
+static void mix3to1 (sample_t * samples, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ samples[i] += samples[i + 256] + samples[i + 512] + bias;
+}
+
+static void mix4to1 (sample_t * samples, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ samples[i] += (samples[i + 256] + samples[i + 512] +
+ samples[i + 768] + bias);
+}
+
+static void mix5to1 (sample_t * samples, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ samples[i] += (samples[i + 256] + samples[i + 512] +
+ samples[i + 768] + samples[i + 1024] + bias);
+}
+
+static void mix3to2 (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common;
+
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + bias;
+ samples[i] += common;
+ samples[i + 256] = samples[i + 512] + common;
+ }
+}
+
+static void mix21to2 (sample_t * left, sample_t * right, sample_t bias)
+{
+ int i;
+ sample_t common;
+
+ for (i = 0; i < 256; i++) {
+ common = right[i + 256] + bias;
+ left[i] += common;
+ right[i] += common;
+ }
+}
+
+static void mix21toS (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t surround;
+
+ for (i = 0; i < 256; i++) {
+ surround = samples[i + 512];
+ samples[i] += bias - surround;
+ samples[i + 256] += bias + surround;
+ }
+}
+
+static void mix31to2 (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common;
+
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + samples[i + 768] + bias;
+ samples[i] += common;
+ samples[i + 256] = samples[i + 512] + common;
+ }
+}
+
+static void mix31toS (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common, surround;
+
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + bias;
+ surround = samples[i + 768];
+ samples[i] += common - surround;
+ samples[i + 256] = samples[i + 512] + common + surround;
+ }
+}
+
+static void mix22toS (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t surround;
+
+ for (i = 0; i < 256; i++) {
+ surround = samples[i + 512] + samples[i + 768];
+ samples[i] += bias - surround;
+ samples[i + 256] += bias + surround;
+ }
+}
+
+static void mix32to2 (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common;
+
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + bias;
+ samples[i] += common + samples[i + 768];
+ samples[i + 256] = common + samples[i + 512] + samples[i + 1024];
+ }
+}
+
+static void mix32toS (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common, surround;
+
+ for (i = 0; i < 256; i++) {
+ common = samples[i + 256] + bias;
+ surround = samples[i + 768] + samples[i + 1024];
+ samples[i] += common - surround;
+ samples[i + 256] = samples[i + 512] + common + surround;
+ }
+}
+
+static void move2to1 (sample_t * src, sample_t * dest, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ dest[i] = src[i] + src[i + 256] + bias;
+}
+
+static void zero (sample_t * samples)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ samples[i] = 0;
+}
+
+void a52_downmix (sample_t * samples, int acmod, int output, sample_t bias,
+ sample_t clev, sample_t slev)
+{
+ switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL2):
+ memcpy (samples, samples + 256, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_CHANNEL, A52_MONO):
+ case CONVERT (A52_STEREO, A52_MONO):
+ mix_2to1:
+ mix2to1 (samples, samples + 256, bias);
+ break;
+
+ case CONVERT (A52_2F1R, A52_MONO):
+ if (slev == 0)
+ goto mix_2to1;
+ case CONVERT (A52_3F, A52_MONO):
+ mix_3to1:
+ mix3to1 (samples, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_MONO):
+ if (slev == 0)
+ goto mix_3to1;
+ case CONVERT (A52_2F2R, A52_MONO):
+ if (slev == 0)
+ goto mix_2to1;
+ mix4to1 (samples, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_MONO):
+ if (slev == 0)
+ goto mix_3to1;
+ mix5to1 (samples, bias);
+ break;
+
+ case CONVERT (A52_MONO, A52_DOLBY):
+ memcpy (samples + 256, samples, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F, A52_STEREO):
+ case CONVERT (A52_3F, A52_DOLBY):
+ mix_3to2:
+ mix3to2 (samples, bias);
+ break;
+
+ case CONVERT (A52_2F1R, A52_STEREO):
+ if (slev == 0)
+ break;
+ mix21to2 (samples, samples + 256, bias);
+ break;
+
+ case CONVERT (A52_2F1R, A52_DOLBY):
+ mix21toS (samples, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_STEREO):
+ if (slev == 0)
+ goto mix_3to2;
+ mix31to2 (samples, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_DOLBY):
+ mix31toS (samples, bias);
+ break;
+
+ case CONVERT (A52_2F2R, A52_STEREO):
+ if (slev == 0)
+ break;
+ mix2to1 (samples, samples + 512, bias);
+ mix2to1 (samples + 256, samples + 768, bias);
+ break;
+
+ case CONVERT (A52_2F2R, A52_DOLBY):
+ mix22toS (samples, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_STEREO):
+ if (slev == 0)
+ goto mix_3to2;
+ mix32to2 (samples, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_DOLBY):
+ mix32toS (samples, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_3F):
+ if (slev == 0)
+ break;
+ mix21to2 (samples, samples + 512, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_3F):
+ if (slev == 0)
+ break;
+ mix2to1 (samples, samples + 768, bias);
+ mix2to1 (samples + 512, samples + 1024, bias);
+ break;
+
+ case CONVERT (A52_3F1R, A52_2F1R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_2F2R, A52_2F1R):
+ mix2to1 (samples + 512, samples + 768, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_2F1R):
+ mix3to2 (samples, bias);
+ move2to1 (samples + 768, samples + 512, bias);
+ break;
+
+ case CONVERT (A52_3F2R, A52_3F1R):
+ mix2to1 (samples + 768, samples + 1024, bias);
+ break;
+
+ case CONVERT (A52_2F1R, A52_2F2R):
+ memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F1R, A52_2F2R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F2R, A52_2F2R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F1R, A52_3F2R):
+ memcpy (samples + 1027, samples + 768, 256 * sizeof (sample_t));
+ break;
+ }
+}
+
+void a52_upmix (sample_t * samples, int acmod, int output)
+{
+ switch (CONVERT (acmod, output & A52_CHANNEL_MASK)) {
+
+ case CONVERT (A52_CHANNEL, A52_CHANNEL2):
+ memcpy (samples + 256, samples, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (A52_3F2R, A52_MONO):
+ zero (samples + 1024);
+ case CONVERT (A52_3F1R, A52_MONO):
+ case CONVERT (A52_2F2R, A52_MONO):
+ zero (samples + 768);
+ case CONVERT (A52_3F, A52_MONO):
+ case CONVERT (A52_2F1R, A52_MONO):
+ zero (samples + 512);
+ case CONVERT (A52_CHANNEL, A52_MONO):
+ case CONVERT (A52_STEREO, A52_MONO):
+ zero (samples + 256);
+ break;
+
+ case CONVERT (A52_3F2R, A52_STEREO):
+ case CONVERT (A52_3F2R, A52_DOLBY):
+ zero (samples + 1024);
+ case CONVERT (A52_3F1R, A52_STEREO):
+ case CONVERT (A52_3F1R, A52_DOLBY):
+ zero (samples + 768);
+ case CONVERT (A52_3F, A52_STEREO):
+ case CONVERT (A52_3F, A52_DOLBY):
+ mix_3to2:
+ memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t));
+ zero (samples + 256);
+ break;
+
+ case CONVERT (A52_2F2R, A52_STEREO):
+ case CONVERT (A52_2F2R, A52_DOLBY):
+ zero (samples + 768);
+ case CONVERT (A52_2F1R, A52_STEREO):
+ case CONVERT (A52_2F1R, A52_DOLBY):
+ zero (samples + 512);
+ break;
+
+ case CONVERT (A52_3F2R, A52_3F):
+ zero (samples + 1024);
+ case CONVERT (A52_3F1R, A52_3F):
+ case CONVERT (A52_2F2R, A52_2F1R):
+ zero (samples + 768);
+ break;
+
+ case CONVERT (A52_3F2R, A52_3F1R):
+ zero (samples + 1024);
+ break;
+
+ case CONVERT (A52_3F2R, A52_2F1R):
+ zero (samples + 1024);
+ case CONVERT (A52_3F1R, A52_2F1R):
+ mix_31to21:
+ memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
+ goto mix_3to2;
+
+ case CONVERT (A52_3F2R, A52_2F2R):
+ memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
+ goto mix_31to21;
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/imdct.c b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/imdct.c
new file mode 100644
index 000000000..ce761c053
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/imdct.c
@@ -0,0 +1,432 @@
+/*
+ * imdct.c
+ * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * The ifft algorithms in this file have been largely inspired by Dan
+ * Bernstein's work, djbfft, available at http://cr.yp.to/djbfft.html
+ *
+ * This file is part of a52dec, a free ATSC A-52 stream decoder.
+ * See http://liba52.sourceforge.net/ for updates.
+ *
+ * a52dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * a52dec 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 "config.h"
+
+#include <math.h>
+#include <stdio.h>
+#ifdef LIBA52_DJBFFT
+#include <fftc4.h>
+#endif
+#ifndef M_PI
+#define M_PI 3.1415926535897932384626433832795029
+#endif
+#include <inttypes.h>
+
+#include "a52.h"
+#include "a52_internal.h"
+//#include "mm_accel.h"
+
+typedef struct complex_s {
+ sample_t real;
+ sample_t imag;
+} complex_t;
+
+static uint8_t fftorder[] = {
+ 0,128, 64,192, 32,160,224, 96, 16,144, 80,208,240,112, 48,176,
+ 8,136, 72,200, 40,168,232,104,248,120, 56,184, 24,152,216, 88,
+ 4,132, 68,196, 36,164,228,100, 20,148, 84,212,244,116, 52,180,
+ 252,124, 60,188, 28,156,220, 92, 12,140, 76,204,236,108, 44,172,
+ 2,130, 66,194, 34,162,226, 98, 18,146, 82,210,242,114, 50,178,
+ 10,138, 74,202, 42,170,234,106,250,122, 58,186, 26,154,218, 90,
+ 254,126, 62,190, 30,158,222, 94, 14,142, 78,206,238,110, 46,174,
+ 6,134, 70,198, 38,166,230,102,246,118, 54,182, 22,150,214, 86
+};
+
+/* Root values for IFFT */
+static sample_t roots16[3];
+static sample_t roots32[7];
+static sample_t roots64[15];
+static sample_t roots128[31];
+
+/* Twiddle factors for IMDCT */
+static complex_t pre1[128];
+static complex_t post1[64];
+static complex_t pre2[64];
+static complex_t post2[32];
+
+static sample_t a52_imdct_window[256];
+
+static void (* ifft128) (complex_t * buf);
+static void (* ifft64) (complex_t * buf);
+
+static inline void ifft2 (complex_t * buf)
+{
+ double r, i;
+
+ r = buf[0].real;
+ i = buf[0].imag;
+ buf[0].real += buf[1].real;
+ buf[0].imag += buf[1].imag;
+ buf[1].real = r - buf[1].real;
+ buf[1].imag = i - buf[1].imag;
+}
+
+static inline void ifft4 (complex_t * buf)
+{
+ double tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
+
+ tmp1 = buf[0].real + buf[1].real;
+ tmp2 = buf[3].real + buf[2].real;
+ tmp3 = buf[0].imag + buf[1].imag;
+ tmp4 = buf[2].imag + buf[3].imag;
+ tmp5 = buf[0].real - buf[1].real;
+ tmp6 = buf[0].imag - buf[1].imag;
+ tmp7 = buf[2].imag - buf[3].imag;
+ tmp8 = buf[3].real - buf[2].real;
+
+ buf[0].real = tmp1 + tmp2;
+ buf[0].imag = tmp3 + tmp4;
+ buf[2].real = tmp1 - tmp2;
+ buf[2].imag = tmp3 - tmp4;
+ buf[1].real = tmp5 + tmp7;
+ buf[1].imag = tmp6 + tmp8;
+ buf[3].real = tmp5 - tmp7;
+ buf[3].imag = tmp6 - tmp8;
+}
+
+/* the basic split-radix ifft butterfly */
+
+#define BUTTERFLY(a0,a1,a2,a3,wr,wi) do { \
+ tmp5 = a2.real * wr + a2.imag * wi; \
+ tmp6 = a2.imag * wr - a2.real * wi; \
+ tmp7 = a3.real * wr - a3.imag * wi; \
+ tmp8 = a3.imag * wr + a3.real * wi; \
+ tmp1 = tmp5 + tmp7; \
+ tmp2 = tmp6 + tmp8; \
+ tmp3 = tmp6 - tmp8; \
+ tmp4 = tmp7 - tmp5; \
+ a2.real = a0.real - tmp1; \
+ a2.imag = a0.imag - tmp2; \
+ a3.real = a1.real - tmp3; \
+ a3.imag = a1.imag - tmp4; \
+ a0.real += tmp1; \
+ a0.imag += tmp2; \
+ a1.real += tmp3; \
+ a1.imag += tmp4; \
+} while (0)
+
+/* split-radix ifft butterfly, specialized for wr=1 wi=0 */
+
+#define BUTTERFLY_ZERO(a0,a1,a2,a3) do { \
+ tmp1 = a2.real + a3.real; \
+ tmp2 = a2.imag + a3.imag; \
+ tmp3 = a2.imag - a3.imag; \
+ tmp4 = a3.real - a2.real; \
+ a2.real = a0.real - tmp1; \
+ a2.imag = a0.imag - tmp2; \
+ a3.real = a1.real - tmp3; \
+ a3.imag = a1.imag - tmp4; \
+ a0.real += tmp1; \
+ a0.imag += tmp2; \
+ a1.real += tmp3; \
+ a1.imag += tmp4; \
+} while (0)
+
+/* split-radix ifft butterfly, specialized for wr=wi */
+
+#define BUTTERFLY_HALF(a0,a1,a2,a3,w) do { \
+ tmp5 = (a2.real + a2.imag) * w; \
+ tmp6 = (a2.imag - a2.real) * w; \
+ tmp7 = (a3.real - a3.imag) * w; \
+ tmp8 = (a3.imag + a3.real) * w; \
+ tmp1 = tmp5 + tmp7; \
+ tmp2 = tmp6 + tmp8; \
+ tmp3 = tmp6 - tmp8; \
+ tmp4 = tmp7 - tmp5; \
+ a2.real = a0.real - tmp1; \
+ a2.imag = a0.imag - tmp2; \
+ a3.real = a1.real - tmp3; \
+ a3.imag = a1.imag - tmp4; \
+ a0.real += tmp1; \
+ a0.imag += tmp2; \
+ a1.real += tmp3; \
+ a1.imag += tmp4; \
+} while (0)
+
+static inline void ifft8 (complex_t * buf)
+{
+ double tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
+
+ ifft4 (buf);
+ ifft2 (buf + 4);
+ ifft2 (buf + 6);
+ BUTTERFLY_ZERO (buf[0], buf[2], buf[4], buf[6]);
+ BUTTERFLY_HALF (buf[1], buf[3], buf[5], buf[7], roots16[1]);
+}
+
+static void ifft_pass (complex_t * buf, sample_t * weight, int n)
+{
+ complex_t * buf1;
+ complex_t * buf2;
+ complex_t * buf3;
+ double tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
+ int i;
+
+ buf++;
+ buf1 = buf + n;
+ buf2 = buf + 2 * n;
+ buf3 = buf + 3 * n;
+
+ BUTTERFLY_ZERO (buf[-1], buf1[-1], buf2[-1], buf3[-1]);
+
+ i = n - 1;
+
+ do {
+ BUTTERFLY (buf[0], buf1[0], buf2[0], buf3[0], weight[n], weight[2*i]);
+ buf++;
+ buf1++;
+ buf2++;
+ buf3++;
+ weight++;
+ } while (--i);
+}
+
+static void ifft16 (complex_t * buf)
+{
+ ifft8 (buf);
+ ifft4 (buf + 8);
+ ifft4 (buf + 12);
+ ifft_pass (buf, roots16 - 4, 4);
+}
+
+static void ifft32 (complex_t * buf)
+{
+ ifft16 (buf);
+ ifft8 (buf + 16);
+ ifft8 (buf + 24);
+ ifft_pass (buf, roots32 - 8, 8);
+}
+
+static void ifft64_c (complex_t * buf)
+{
+ ifft32 (buf);
+ ifft16 (buf + 32);
+ ifft16 (buf + 48);
+ ifft_pass (buf, roots64 - 16, 16);
+}
+
+static void ifft128_c (complex_t * buf)
+{
+ ifft32 (buf);
+ ifft16 (buf + 32);
+ ifft16 (buf + 48);
+ ifft_pass (buf, roots64 - 16, 16);
+
+ ifft32 (buf + 64);
+ ifft32 (buf + 96);
+ ifft_pass (buf, roots128 - 32, 32);
+}
+
+void a52_imdct_512 (sample_t * data, sample_t * delay, sample_t bias)
+{
+ int i, k;
+ sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2;
+ const sample_t * window = a52_imdct_window;
+ complex_t buf[128];
+
+ for (i = 0; i < 128; i++) {
+ k = fftorder[i];
+ t_r = pre1[i].real;
+ t_i = pre1[i].imag;
+
+ buf[i].real = t_i * data[255-k] + t_r * data[k];
+ buf[i].imag = t_r * data[255-k] - t_i * data[k];
+ }
+
+ ifft128 (buf);
+
+ /* Post IFFT complex multiply plus IFFT complex conjugate*/
+ /* Window and convert to real valued signal */
+ for (i = 0; i < 64; i++) {
+ /* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */
+ t_r = post1[i].real;
+ t_i = post1[i].imag;
+
+ a_r = t_r * buf[i].real + t_i * buf[i].imag;
+ a_i = t_i * buf[i].real - t_r * buf[i].imag;
+ b_r = t_i * buf[127-i].real + t_r * buf[127-i].imag;
+ b_i = t_r * buf[127-i].real - t_i * buf[127-i].imag;
+
+ w_1 = window[2*i];
+ w_2 = window[255-2*i];
+ data[2*i] = delay[2*i] * w_2 - a_r * w_1 + bias;
+ data[255-2*i] = delay[2*i] * w_1 + a_r * w_2 + bias;
+ delay[2*i] = a_i;
+
+ w_1 = window[2*i+1];
+ w_2 = window[254-2*i];
+ data[2*i+1] = delay[2*i+1] * w_2 + b_r * w_1 + bias;
+ data[254-2*i] = delay[2*i+1] * w_1 - b_r * w_2 + bias;
+ delay[2*i+1] = b_i;
+ }
+}
+
+void a52_imdct_256(sample_t * data, sample_t * delay, sample_t bias)
+{
+ int i, k;
+ sample_t t_r, t_i, a_r, a_i, b_r, b_i, c_r, c_i, d_r, d_i, w_1, w_2;
+ const sample_t * window = a52_imdct_window;
+ complex_t buf1[64], buf2[64];
+
+ /* Pre IFFT complex multiply plus IFFT cmplx conjugate */
+ for (i = 0; i < 64; i++) {
+ k = fftorder[i];
+ t_r = pre2[i].real;
+ t_i = pre2[i].imag;
+
+ buf1[i].real = t_i * data[254-k] + t_r * data[k];
+ buf1[i].imag = t_r * data[254-k] - t_i * data[k];
+
+ buf2[i].real = t_i * data[255-k] + t_r * data[k+1];
+ buf2[i].imag = t_r * data[255-k] - t_i * data[k+1];
+ }
+
+ ifft64 (buf1);
+ ifft64 (buf2);
+
+ /* Post IFFT complex multiply */
+ /* Window and convert to real valued signal */
+ for (i = 0; i < 32; i++) {
+ /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */
+ t_r = post2[i].real;
+ t_i = post2[i].imag;
+
+ a_r = t_r * buf1[i].real + t_i * buf1[i].imag;
+ a_i = t_i * buf1[i].real - t_r * buf1[i].imag;
+ b_r = t_i * buf1[63-i].real + t_r * buf1[63-i].imag;
+ b_i = t_r * buf1[63-i].real - t_i * buf1[63-i].imag;
+
+ c_r = t_r * buf2[i].real + t_i * buf2[i].imag;
+ c_i = t_i * buf2[i].real - t_r * buf2[i].imag;
+ d_r = t_i * buf2[63-i].real + t_r * buf2[63-i].imag;
+ d_i = t_r * buf2[63-i].real - t_i * buf2[63-i].imag;
+
+ w_1 = window[2*i];
+ w_2 = window[255-2*i];
+ data[2*i] = delay[2*i] * w_2 - a_r * w_1 + bias;
+ data[255-2*i] = delay[2*i] * w_1 + a_r * w_2 + bias;
+ delay[2*i] = c_i;
+
+ w_1 = window[128+2*i];
+ w_2 = window[127-2*i];
+ data[128+2*i] = delay[127-2*i] * w_2 + a_i * w_1 + bias;
+ data[127-2*i] = delay[127-2*i] * w_1 - a_i * w_2 + bias;
+ delay[127-2*i] = c_r;
+
+ w_1 = window[2*i+1];
+ w_2 = window[254-2*i];
+ data[2*i+1] = delay[2*i+1] * w_2 - b_i * w_1 + bias;
+ data[254-2*i] = delay[2*i+1] * w_1 + b_i * w_2 + bias;
+ delay[2*i+1] = d_r;
+
+ w_1 = window[129+2*i];
+ w_2 = window[126-2*i];
+ data[129+2*i] = delay[126-2*i] * w_2 + b_r * w_1 + bias;
+ data[126-2*i] = delay[126-2*i] * w_1 - b_r * w_2 + bias;
+ delay[126-2*i] = d_i;
+ }
+}
+
+static double besselI0 (double x)
+{
+ double bessel = 1;
+ int i = 100;
+
+ do
+ bessel = bessel * x / (i * i) + 1;
+ while (--i);
+ return bessel;
+}
+
+void a52_imdct_init (uint32_t mm_accel)
+{
+ int i, k;
+ double sum;
+
+ /* compute imdct window - kaiser-bessel derived window, alpha = 5.0 */
+ sum = 0;
+ for (i = 0; i < 256; i++) {
+ sum += besselI0 (i * (256 - i) * (5 * M_PI / 256) * (5 * M_PI / 256));
+ a52_imdct_window[i] = sum;
+ }
+ sum++;
+ for (i = 0; i < 256; i++)
+ a52_imdct_window[i] = sqrt (a52_imdct_window[i] / sum);
+
+ for (i = 0; i < 3; i++)
+ roots16[i] = cos ((M_PI / 8) * (i + 1));
+
+ for (i = 0; i < 7; i++)
+ roots32[i] = cos ((M_PI / 16) * (i + 1));
+
+ for (i = 0; i < 15; i++)
+ roots64[i] = cos ((M_PI / 32) * (i + 1));
+
+ for (i = 0; i < 31; i++)
+ roots128[i] = cos ((M_PI / 64) * (i + 1));
+
+ for (i = 0; i < 64; i++) {
+ k = fftorder[i] / 2 + 64;
+ pre1[i].real = cos ((M_PI / 256) * (k - 0.25));
+ pre1[i].imag = sin ((M_PI / 256) * (k - 0.25));
+ }
+
+ for (i = 64; i < 128; i++) {
+ k = fftorder[i] / 2 + 64;
+ pre1[i].real = -cos ((M_PI / 256) * (k - 0.25));
+ pre1[i].imag = -sin ((M_PI / 256) * (k - 0.25));
+ }
+
+ for (i = 0; i < 64; i++) {
+ post1[i].real = cos ((M_PI / 256) * (i + 0.5));
+ post1[i].imag = sin ((M_PI / 256) * (i + 0.5));
+ }
+
+ for (i = 0; i < 64; i++) {
+ k = fftorder[i] / 4;
+ pre2[i].real = cos ((M_PI / 128) * (k - 0.25));
+ pre2[i].imag = sin ((M_PI / 128) * (k - 0.25));
+ }
+
+ for (i = 0; i < 32; i++) {
+ post2[i].real = cos ((M_PI / 128) * (i + 0.5));
+ post2[i].imag = sin ((M_PI / 128) * (i + 0.5));
+ }
+
+#ifdef LIBA52_DJBFFT
+ if (mm_accel & MM_ACCEL_DJBFFT) {
+ fprintf (stderr, "Using djbfft for IMDCT transform\n");
+ ifft128 = (void (*) (complex_t *)) fftc4_un128;
+ ifft64 = (void (*) (complex_t *)) fftc4_un64;
+ } else
+#endif
+ {
+ fprintf (stderr, "No accelerated IMDCT transform found\n");
+ ifft128 = ifft128_c;
+ ifft64 = ifft64_c;
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/parse.c b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/parse.c
new file mode 100644
index 000000000..771202369
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/parse.c
@@ -0,0 +1,905 @@
+/*
+ * parse.c
+ * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of a52dec, a free ATSC A-52 stream decoder.
+ * See http://liba52.sourceforge.net/ for updates.
+ *
+ * a52dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * a52dec 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 "config.h"
+
+//#include <stdlib.h>
+
+void __cdecl free(void *);
+void * __cdecl malloc(size_t);
+
+#include <string.h>
+#include <inttypes.h>
+
+#include "a52.h"
+#include "a52_internal.h"
+#include "bitstream.h"
+#include "tables.h"
+
+#ifdef HAVE_MEMALIGN
+/* some systems have memalign() but no declaration for it */
+void * memalign (size_t align, size_t size);
+#else
+/* assume malloc alignment is sufficient */
+#define memalign(align,size) malloc (size)
+#endif
+
+typedef struct {
+ sample_t q1[2];
+ sample_t q2[2];
+ sample_t q4;
+ int q1_ptr;
+ int q2_ptr;
+ int q4_ptr;
+} quantizer_t;
+
+static uint8_t halfrate[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3};
+
+a52_state_t * a52_init (uint32_t mm_accel)
+{
+ a52_state_t * state;
+ int i;
+
+ state = malloc (sizeof (a52_state_t));
+ if (state == NULL)
+ return NULL;
+
+ state->samples = memalign (16, 256 * 12 * sizeof (sample_t));
+ if (state->samples == NULL) {
+ free (state);
+ return NULL;
+ }
+
+ for (i = 0; i < 256 * 12; i++)
+ state->samples[i] = 0;
+
+ state->downmixed = 1;
+
+ state->lfsr_state = 1;
+
+ a52_imdct_init (mm_accel);
+
+ return state;
+}
+
+sample_t * a52_samples (a52_state_t * state)
+{
+ return state->samples;
+}
+
+int a52_syncinfo (uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate)
+{
+ static int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112,
+ 128, 160, 192, 224, 256, 320, 384, 448,
+ 512, 576, 640};
+ static uint8_t lfeon[8] = {0x10, 0x10, 0x04, 0x04, 0x04, 0x01, 0x04, 0x01};
+ int frmsizecod;
+ int bitrate;
+ int half;
+ int acmod;
+
+ if ((buf[0] != 0x0b) || (buf[1] != 0x77)) /* syncword */
+ return 0;
+
+ if (buf[5] >= 0x60) /* bsid >= 12 */
+ return 0;
+ half = halfrate[buf[5] >> 3];
+
+ /* acmod, dsurmod and lfeon */
+ acmod = buf[6] >> 5;
+ *flags = ((((buf[6] & 0xf8) == 0x50) ? A52_DOLBY : acmod) |
+ ((buf[6] & lfeon[acmod]) ? A52_LFE : 0));
+
+ frmsizecod = buf[4] & 63;
+ if (frmsizecod >= 38)
+ return 0;
+ bitrate = rate [frmsizecod >> 1];
+ *bit_rate = (bitrate * 1000) >> half;
+
+ switch (buf[4] & 0xc0) {
+ case 0:
+ *sample_rate = 48000 >> half;
+ return 4 * bitrate;
+ case 0x40:
+ *sample_rate = 44100 >> half;
+ return 2 * (320 * bitrate / 147 + (frmsizecod & 1));
+ case 0x80:
+ *sample_rate = 32000 >> half;
+ return 6 * bitrate;
+ default:
+ return 0;
+ }
+}
+
+int a52_frame (a52_state_t * state, uint8_t * buf, int * flags,
+ sample_t * level, sample_t bias)
+{
+ static sample_t clev[4] = {LEVEL_3DB, LEVEL_45DB, LEVEL_6DB, LEVEL_45DB};
+ static sample_t slev[4] = {LEVEL_3DB, LEVEL_6DB, 0, LEVEL_6DB};
+ int chaninfo;
+ int acmod;
+
+ state->fscod = buf[4] >> 6;
+ state->halfrate = halfrate[buf[5] >> 3];
+ state->acmod = acmod = buf[6] >> 5;
+
+ a52_bitstream_set_ptr (state, buf + 6);
+ bitstream_get (state, 3); /* skip acmod we already parsed */
+
+ if ((acmod == 2) && (bitstream_get (state, 2) == 2)) /* dsurmod */
+ acmod = A52_DOLBY;
+
+ if ((acmod & 1) && (acmod != 1))
+ state->clev = clev[bitstream_get (state, 2)]; /* cmixlev */
+
+ if (acmod & 4)
+ state->slev = slev[bitstream_get (state, 2)]; /* surmixlev */
+
+ state->lfeon = bitstream_get (state, 1);
+
+ state->output = a52_downmix_init (acmod, *flags, level,
+ state->clev, state->slev);
+ if (state->output < 0)
+ return 1;
+ if (state->lfeon && (*flags & A52_LFE))
+ state->output |= A52_LFE;
+ *flags = state->output;
+ /* the 2* compensates for differences in imdct */
+ state->dynrng = state->level = 2 * *level;
+ state->bias = bias;
+ state->dynrnge = 1;
+ state->dynrngcall = NULL;
+ state->cplba.deltbae = DELTA_BIT_NONE;
+ state->ba[0].deltbae = state->ba[1].deltbae = state->ba[2].deltbae =
+ state->ba[3].deltbae = state->ba[4].deltbae = DELTA_BIT_NONE;
+
+ chaninfo = !acmod;
+ do {
+ bitstream_get (state, 5); /* dialnorm */
+ if (bitstream_get (state, 1)) /* compre */
+ bitstream_get (state, 8); /* compr */
+ if (bitstream_get (state, 1)) /* langcode */
+ bitstream_get (state, 8); /* langcod */
+ if (bitstream_get (state, 1)) /* audprodie */
+ bitstream_get (state, 7); /* mixlevel + roomtyp */
+ } while (chaninfo--);
+
+ bitstream_get (state, 2); /* copyrightb + origbs */
+
+ if (bitstream_get (state, 1)) /* timecod1e */
+ bitstream_get (state, 14); /* timecod1 */
+ if (bitstream_get (state, 1)) /* timecod2e */
+ bitstream_get (state, 14); /* timecod2 */
+
+ if (bitstream_get (state, 1)) { /* addbsie */
+ int addbsil;
+
+ addbsil = bitstream_get (state, 6);
+ do {
+ bitstream_get (state, 8); /* addbsi */
+ } while (addbsil--);
+ }
+
+ return 0;
+}
+
+void a52_dynrng (a52_state_t * state,
+ sample_t (* call) (sample_t, void *), void * data)
+{
+ state->dynrnge = 0;
+ if (call) {
+ state->dynrnge = 1;
+ state->dynrngcall = call;
+ state->dynrngdata = data;
+ }
+}
+
+static int parse_exponents (a52_state_t * state, int expstr, int ngrps,
+ uint8_t exponent, uint8_t * dest)
+{
+ int exps;
+
+ while (ngrps--) {
+ exps = bitstream_get (state, 7);
+
+ exponent += exp_1[exps];
+ if (exponent > 24)
+ return 1;
+
+ switch (expstr) {
+ case EXP_D45:
+ *(dest++) = exponent;
+ *(dest++) = exponent;
+ case EXP_D25:
+ *(dest++) = exponent;
+ case EXP_D15:
+ *(dest++) = exponent;
+ }
+
+ exponent += exp_2[exps];
+ if (exponent > 24)
+ return 1;
+
+ switch (expstr) {
+ case EXP_D45:
+ *(dest++) = exponent;
+ *(dest++) = exponent;
+ case EXP_D25:
+ *(dest++) = exponent;
+ case EXP_D15:
+ *(dest++) = exponent;
+ }
+
+ exponent += exp_3[exps];
+ if (exponent > 24)
+ return 1;
+
+ switch (expstr) {
+ case EXP_D45:
+ *(dest++) = exponent;
+ *(dest++) = exponent;
+ case EXP_D25:
+ *(dest++) = exponent;
+ case EXP_D15:
+ *(dest++) = exponent;
+ }
+ }
+
+ return 0;
+}
+
+static int parse_deltba (a52_state_t * state, int8_t * deltba)
+{
+ int deltnseg, deltlen, delta, j;
+
+ memset (deltba, 0, 50);
+
+ deltnseg = bitstream_get (state, 3);
+ j = 0;
+ do {
+ j += bitstream_get (state, 5);
+ deltlen = bitstream_get (state, 4);
+ delta = bitstream_get (state, 3);
+ delta -= (delta >= 4) ? 3 : 4;
+ if (!deltlen)
+ continue;
+ if (j + deltlen >= 50)
+ return 1;
+ while (deltlen--)
+ deltba[j++] = delta;
+ } while (deltnseg--);
+
+ return 0;
+}
+
+static inline int zero_snr_offsets (int nfchans, a52_state_t * state)
+{
+ int i;
+
+ if ((state->csnroffst) ||
+ (state->chincpl && state->cplba.bai >> 3) || /* cplinu, fsnroffst */
+ (state->lfeon && state->lfeba.bai >> 3)) /* fsnroffst */
+ return 0;
+ for (i = 0; i < nfchans; i++)
+ if (state->ba[i].bai >> 3) /* fsnroffst */
+ return 0;
+ return 1;
+}
+
+static inline int16_t dither_gen (a52_state_t * state)
+{
+ int16_t nstate;
+
+ nstate = dither_lut[state->lfsr_state >> 8] ^ (state->lfsr_state << 8);
+
+ state->lfsr_state = (uint16_t) nstate;
+
+ return nstate;
+}
+
+static void coeff_get (a52_state_t * state, sample_t * coeff,
+ expbap_t * expbap, quantizer_t * quantizer,
+ sample_t level, int dither, int end)
+{
+ int i;
+ uint8_t * exp;
+ int8_t * bap;
+ sample_t factor[25];
+
+ for (i = 0; i <= 24; i++)
+ factor[i] = scale_factor[i] * level;
+
+ exp = expbap->exp;
+ bap = expbap->bap;
+
+ for (i = 0; i < end; i++) {
+ int bapi;
+
+ bapi = bap[i];
+ switch (bapi) {
+ case 0:
+ if (dither) {
+ coeff[i] = dither_gen (state) * LEVEL_3DB * factor[exp[i]];
+ continue;
+ } else {
+ coeff[i] = 0;
+ continue;
+ }
+
+ case -1:
+ if (quantizer->q1_ptr >= 0) {
+ coeff[i] = quantizer->q1[quantizer->q1_ptr--] * factor[exp[i]];
+ continue;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 5);
+
+ quantizer->q1_ptr = 1;
+ quantizer->q1[0] = q_1_2[code];
+ quantizer->q1[1] = q_1_1[code];
+ coeff[i] = q_1_0[code] * factor[exp[i]];
+ continue;
+ }
+
+ case -2:
+ if (quantizer->q2_ptr >= 0) {
+ coeff[i] = quantizer->q2[quantizer->q2_ptr--] * factor[exp[i]];
+ continue;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 7);
+
+ quantizer->q2_ptr = 1;
+ quantizer->q2[0] = q_2_2[code];
+ quantizer->q2[1] = q_2_1[code];
+ coeff[i] = q_2_0[code] * factor[exp[i]];
+ continue;
+ }
+
+ case 3:
+ coeff[i] = q_3[bitstream_get (state, 3)] * factor[exp[i]];
+ continue;
+
+ case -3:
+ if (quantizer->q4_ptr == 0) {
+ quantizer->q4_ptr = -1;
+ coeff[i] = quantizer->q4 * factor[exp[i]];
+ continue;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 7);
+
+ quantizer->q4_ptr = 0;
+ quantizer->q4 = q_4_1[code];
+ coeff[i] = q_4_0[code] * factor[exp[i]];
+ continue;
+ }
+
+ case 4:
+ coeff[i] = q_5[bitstream_get (state, 4)] * factor[exp[i]];
+ continue;
+
+ default:
+ coeff[i] = ((bitstream_get_2 (state, bapi) << (16 - bapi)) *
+ factor[exp[i]]);
+ }
+ }
+}
+
+static void coeff_get_coupling (a52_state_t * state, int nfchans,
+ sample_t * coeff, sample_t (* samples)[256],
+ quantizer_t * quantizer, uint8_t dithflag[5])
+{
+ int cplbndstrc, bnd, i, i_end, ch;
+ uint8_t * exp;
+ int8_t * bap;
+ sample_t cplco[5];
+
+ exp = state->cpl_expbap.exp;
+ bap = state->cpl_expbap.bap;
+ bnd = 0;
+ cplbndstrc = state->cplbndstrc;
+ i = state->cplstrtmant;
+ while (i < state->cplendmant) {
+ i_end = i + 12;
+ while (cplbndstrc & 1) {
+ cplbndstrc >>= 1;
+ i_end += 12;
+ }
+ cplbndstrc >>= 1;
+ for (ch = 0; ch < nfchans; ch++)
+ cplco[ch] = state->cplco[ch][bnd] * coeff[ch];
+ bnd++;
+
+ while (i < i_end) {
+ sample_t cplcoeff;
+ int bapi;
+
+ bapi = bap[i];
+ switch (bapi) {
+ case 0:
+ cplcoeff = LEVEL_3DB * scale_factor[exp[i]];
+ for (ch = 0; ch < nfchans; ch++)
+ if ((state->chincpl >> ch) & 1) {
+ if (dithflag[ch])
+ samples[ch][i] = (cplcoeff * cplco[ch] *
+ dither_gen (state));
+ else
+ samples[ch][i] = 0;
+ }
+ i++;
+ continue;
+
+ case -1:
+ if (quantizer->q1_ptr >= 0) {
+ cplcoeff = quantizer->q1[quantizer->q1_ptr--];
+ break;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 5);
+
+ quantizer->q1_ptr = 1;
+ quantizer->q1[0] = q_1_2[code];
+ quantizer->q1[1] = q_1_1[code];
+ cplcoeff = q_1_0[code];
+ break;
+ }
+
+ case -2:
+ if (quantizer->q2_ptr >= 0) {
+ cplcoeff = quantizer->q2[quantizer->q2_ptr--];
+ break;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 7);
+
+ quantizer->q2_ptr = 1;
+ quantizer->q2[0] = q_2_2[code];
+ quantizer->q2[1] = q_2_1[code];
+ cplcoeff = q_2_0[code];
+ break;
+ }
+
+ case 3:
+ cplcoeff = q_3[bitstream_get (state, 3)];
+ break;
+
+ case -3:
+ if (quantizer->q4_ptr == 0) {
+ quantizer->q4_ptr = -1;
+ cplcoeff = quantizer->q4;
+ break;
+ } else {
+ int code;
+
+ code = bitstream_get (state, 7);
+
+ quantizer->q4_ptr = 0;
+ quantizer->q4 = q_4_1[code];
+ cplcoeff = q_4_0[code];
+ break;
+ }
+
+ case 4:
+ cplcoeff = q_5[bitstream_get (state, 4)];
+ break;
+
+ default:
+ cplcoeff = bitstream_get_2 (state, bapi) << (16 - bapi);
+ }
+
+ cplcoeff *= scale_factor[exp[i]];
+ for (ch = 0; ch < nfchans; ch++)
+ if ((state->chincpl >> ch) & 1)
+ samples[ch][i] = cplcoeff * cplco[ch];
+ i++;
+ }
+ }
+}
+
+int a52_block (a52_state_t * state)
+{
+ static const uint8_t nfchans_tbl[] = {2, 1, 2, 3, 3, 4, 4, 5, 1, 1, 2};
+ static int rematrix_band[4] = {25, 37, 61, 253};
+ int i, nfchans, chaninfo;
+ uint8_t cplexpstr, chexpstr[5], lfeexpstr, do_bit_alloc, done_cpl;
+ uint8_t blksw[5], dithflag[5];
+ sample_t coeff[5];
+ int chanbias;
+ quantizer_t quantizer;
+ sample_t * samples;
+
+ nfchans = nfchans_tbl[state->acmod];
+
+ for (i = 0; i < nfchans; i++)
+ blksw[i] = bitstream_get (state, 1);
+
+ for (i = 0; i < nfchans; i++)
+ dithflag[i] = bitstream_get (state, 1);
+
+ chaninfo = !state->acmod;
+ do {
+ if (bitstream_get (state, 1)) { /* dynrnge */
+ int dynrng;
+
+ dynrng = bitstream_get_2 (state, 8);
+ if (state->dynrnge) {
+ sample_t range;
+
+ range = ((((dynrng & 0x1f) | 0x20) << 13) *
+ scale_factor[3 - (dynrng >> 5)]);
+ if (state->dynrngcall)
+ range = state->dynrngcall (range, state->dynrngdata);
+ state->dynrng = state->level * range;
+ }
+ }
+ } while (chaninfo--);
+
+ if (bitstream_get (state, 1)) { /* cplstre */
+ state->chincpl = 0;
+ if (bitstream_get (state, 1)) { /* cplinu */
+ static uint8_t bndtab[16] = {31, 35, 37, 39, 41, 42, 43, 44,
+ 45, 45, 46, 46, 47, 47, 48, 48};
+ int cplbegf;
+ int cplendf;
+ int ncplsubnd;
+
+ for (i = 0; i < nfchans; i++)
+ state->chincpl |= bitstream_get (state, 1) << i;
+ switch (state->acmod) {
+ case 0: case 1:
+ return 1;
+ case 2:
+ state->phsflginu = bitstream_get (state, 1);
+ }
+ cplbegf = bitstream_get (state, 4);
+ cplendf = bitstream_get (state, 4);
+
+ if (cplendf + 3 - cplbegf < 0)
+ return 1;
+ state->ncplbnd = ncplsubnd = cplendf + 3 - cplbegf;
+ state->cplstrtbnd = bndtab[cplbegf];
+ state->cplstrtmant = cplbegf * 12 + 37;
+ state->cplendmant = cplendf * 12 + 73;
+
+ state->cplbndstrc = 0;
+ for (i = 0; i < ncplsubnd - 1; i++)
+ if (bitstream_get (state, 1)) {
+ state->cplbndstrc |= 1 << i;
+ state->ncplbnd--;
+ }
+ }
+ }
+
+ if (state->chincpl) { /* cplinu */
+ int j, cplcoe;
+
+ cplcoe = 0;
+ for (i = 0; i < nfchans; i++)
+ if ((state->chincpl) >> i & 1)
+ if (bitstream_get (state, 1)) { /* cplcoe */
+ int mstrcplco, cplcoexp, cplcomant;
+
+ cplcoe = 1;
+ mstrcplco = 3 * bitstream_get (state, 2);
+ for (j = 0; j < state->ncplbnd; j++) {
+ cplcoexp = bitstream_get (state, 4);
+ cplcomant = bitstream_get (state, 4);
+ if (cplcoexp == 15)
+ cplcomant <<= 14;
+ else
+ cplcomant = (cplcomant | 0x10) << 13;
+ state->cplco[i][j] =
+ cplcomant * scale_factor[cplcoexp + mstrcplco];
+ }
+ }
+ if ((state->acmod == 2) && state->phsflginu && cplcoe)
+ for (j = 0; j < state->ncplbnd; j++)
+ if (bitstream_get (state, 1)) /* phsflg */
+ state->cplco[1][j] = -state->cplco[1][j];
+ }
+
+ if ((state->acmod == 2) && (bitstream_get (state, 1))) { /* rematstr */
+ int end;
+
+ state->rematflg = 0;
+ end = (state->chincpl) ? state->cplstrtmant : 253; /* cplinu */
+ i = 0;
+ do
+ state->rematflg |= bitstream_get (state, 1) << i;
+ while (rematrix_band[i++] < end);
+ }
+
+ cplexpstr = EXP_REUSE;
+ lfeexpstr = EXP_REUSE;
+ if (state->chincpl) /* cplinu */
+ cplexpstr = bitstream_get (state, 2);
+ for (i = 0; i < nfchans; i++)
+ chexpstr[i] = bitstream_get (state, 2);
+ if (state->lfeon)
+ lfeexpstr = bitstream_get (state, 1);
+
+ for (i = 0; i < nfchans; i++)
+ if (chexpstr[i] != EXP_REUSE) {
+ if ((state->chincpl >> i) & 1)
+ state->endmant[i] = state->cplstrtmant;
+ else {
+ int chbwcod;
+
+ chbwcod = bitstream_get (state, 6);
+ if (chbwcod > 60)
+ return 1;
+ state->endmant[i] = chbwcod * 3 + 73;
+ }
+ }
+
+ do_bit_alloc = 0;
+
+ if (cplexpstr != EXP_REUSE) {
+ int cplabsexp, ncplgrps;
+
+ do_bit_alloc = 64;
+ ncplgrps = ((state->cplendmant - state->cplstrtmant) /
+ (3 << (cplexpstr - 1)));
+ cplabsexp = bitstream_get (state, 4) << 1;
+ if (parse_exponents (state, cplexpstr, ncplgrps, cplabsexp,
+ state->cpl_expbap.exp + state->cplstrtmant))
+ return 1;
+ }
+ for (i = 0; i < nfchans; i++)
+ if (chexpstr[i] != EXP_REUSE) {
+ int grp_size, nchgrps;
+
+ do_bit_alloc |= 1 << i;
+ grp_size = 3 << (chexpstr[i] - 1);
+ nchgrps = (state->endmant[i] + grp_size - 4) / grp_size;
+ state->fbw_expbap[i].exp[0] = bitstream_get (state, 4);
+ if (parse_exponents (state, chexpstr[i], nchgrps,
+ state->fbw_expbap[i].exp[0],
+ state->fbw_expbap[i].exp + 1))
+ return 1;
+ bitstream_get (state, 2); /* gainrng */
+ }
+ if (lfeexpstr != EXP_REUSE) {
+ do_bit_alloc |= 32;
+ state->lfe_expbap.exp[0] = bitstream_get (state, 4);
+ if (parse_exponents (state, lfeexpstr, 2, state->lfe_expbap.exp[0],
+ state->lfe_expbap.exp + 1))
+ return 1;
+ }
+
+ if (bitstream_get (state, 1)) { /* baie */
+ do_bit_alloc = -1;
+ state->bai = bitstream_get (state, 11);
+ }
+ if (bitstream_get (state, 1)) { /* snroffste */
+ do_bit_alloc = -1;
+ state->csnroffst = bitstream_get (state, 6);
+ if (state->chincpl) /* cplinu */
+ state->cplba.bai = bitstream_get (state, 7);
+ for (i = 0; i < nfchans; i++)
+ state->ba[i].bai = bitstream_get (state, 7);
+ if (state->lfeon)
+ state->lfeba.bai = bitstream_get (state, 7);
+ }
+ if ((state->chincpl) && (bitstream_get (state, 1))) { /* cplleake */
+ do_bit_alloc |= 64;
+ state->cplfleak = 9 - bitstream_get (state, 3);
+ state->cplsleak = 9 - bitstream_get (state, 3);
+ }
+
+ if (bitstream_get (state, 1)) { /* deltbaie */
+ do_bit_alloc = -1;
+ if (state->chincpl) /* cplinu */
+ state->cplba.deltbae = bitstream_get (state, 2);
+ for (i = 0; i < nfchans; i++)
+ state->ba[i].deltbae = bitstream_get (state, 2);
+ if (state->chincpl && /* cplinu */
+ (state->cplba.deltbae == DELTA_BIT_NEW) &&
+ parse_deltba (state, state->cplba.deltba))
+ return 1;
+ for (i = 0; i < nfchans; i++)
+ if ((state->ba[i].deltbae == DELTA_BIT_NEW) &&
+ parse_deltba (state, state->ba[i].deltba))
+ return 1;
+ }
+
+ if (do_bit_alloc) {
+ if (zero_snr_offsets (nfchans, state)) {
+ memset (state->cpl_expbap.bap, 0, sizeof (state->cpl_expbap.bap));
+ for (i = 0; i < nfchans; i++)
+ memset (state->fbw_expbap[i].bap, 0,
+ sizeof (state->fbw_expbap[i].bap));
+ memset (state->lfe_expbap.bap, 0, sizeof (state->lfe_expbap.bap));
+ } else {
+ if (state->chincpl && (do_bit_alloc & 64)) /* cplinu */
+ a52_bit_allocate (state, &state->cplba, state->cplstrtbnd,
+ state->cplstrtmant, state->cplendmant,
+ state->cplfleak << 8, state->cplsleak << 8,
+ &state->cpl_expbap);
+ for (i = 0; i < nfchans; i++)
+ if (do_bit_alloc & (1 << i))
+ a52_bit_allocate (state, state->ba + i, 0, 0,
+ state->endmant[i], 0, 0,
+ state->fbw_expbap +i);
+ if (state->lfeon && (do_bit_alloc & 32)) {
+ state->lfeba.deltbae = DELTA_BIT_NONE;
+ a52_bit_allocate (state, &state->lfeba, 0, 0, 7, 0, 0,
+ &state->lfe_expbap);
+ }
+ }
+ }
+
+ if (bitstream_get (state, 1)) { /* skiple */
+ i = bitstream_get (state, 9); /* skipl */
+ while (i--)
+ bitstream_get (state, 8);
+ }
+
+ samples = state->samples;
+ if (state->output & A52_LFE)
+ samples += 256; /* shift for LFE channel */
+
+ chanbias = a52_downmix_coeff (coeff, state->acmod, state->output,
+ state->dynrng, state->clev, state->slev);
+
+ quantizer.q1_ptr = quantizer.q2_ptr = quantizer.q4_ptr = -1;
+ done_cpl = 0;
+
+ for (i = 0; i < nfchans; i++) {
+ int j;
+
+ coeff_get (state, samples + 256 * i, state->fbw_expbap +i, &quantizer,
+ coeff[i], dithflag[i], state->endmant[i]);
+
+ if ((state->chincpl >> i) & 1) {
+ if (!done_cpl) {
+ done_cpl = 1;
+ coeff_get_coupling (state, nfchans, coeff,
+ (sample_t (*)[256])samples, &quantizer,
+ dithflag);
+ }
+ j = state->cplendmant;
+ } else
+ j = state->endmant[i];
+ do
+ (samples + 256 * i)[j] = 0;
+ while (++j < 256);
+ }
+
+ if (state->acmod == 2) {
+ int j, end, band, rematflg;
+
+ end = ((state->endmant[0] < state->endmant[1]) ?
+ state->endmant[0] : state->endmant[1]);
+
+ i = 0;
+ j = 13;
+ rematflg = state->rematflg;
+ do {
+ if (! (rematflg & 1)) {
+ rematflg >>= 1;
+ j = rematrix_band[i++];
+ continue;
+ }
+ rematflg >>= 1;
+ band = rematrix_band[i++];
+ if (band > end)
+ band = end;
+ do {
+ sample_t tmp0, tmp1;
+
+ tmp0 = samples[j];
+ tmp1 = (samples+256)[j];
+ samples[j] = tmp0 + tmp1;
+ (samples+256)[j] = tmp0 - tmp1;
+ } while (++j < band);
+ } while (j < end);
+ }
+
+ if (state->lfeon) {
+ if (state->output & A52_LFE) {
+ coeff_get (state, samples - 256, &state->lfe_expbap, &quantizer,
+ state->dynrng, 0, 7);
+ for (i = 7; i < 256; i++)
+ (samples-256)[i] = 0;
+ a52_imdct_512 (samples - 256, samples + 1536 - 256, state->bias);
+ } else {
+ /* just skip the LFE coefficients */
+ coeff_get (state, samples + 1280, &state->lfe_expbap, &quantizer,
+ 0, 0, 7);
+ }
+ }
+
+ i = 0;
+ if (nfchans_tbl[state->output & A52_CHANNEL_MASK] < nfchans)
+ for (i = 1; i < nfchans; i++)
+ if (blksw[i] != blksw[0])
+ break;
+
+ if (i < nfchans) {
+ if (state->downmixed) {
+ state->downmixed = 0;
+ a52_upmix (samples + 1536, state->acmod, state->output);
+ }
+
+ for (i = 0; i < nfchans; i++) {
+ sample_t bias;
+
+ bias = 0;
+ if (!(chanbias & (1 << i)))
+ bias = state->bias;
+
+ if (coeff[i]) {
+ if (blksw[i])
+ a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i,
+ bias);
+ else
+ a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i,
+ bias);
+ } else {
+ int j;
+
+ for (j = 0; j < 256; j++)
+ (samples + 256 * i)[j] = bias;
+ }
+ }
+
+ a52_downmix (samples, state->acmod, state->output, state->bias,
+ state->clev, state->slev);
+ } else {
+ nfchans = nfchans_tbl[state->output & A52_CHANNEL_MASK];
+
+ a52_downmix (samples, state->acmod, state->output, 0,
+ state->clev, state->slev);
+
+ if (!state->downmixed) {
+ state->downmixed = 1;
+ a52_downmix (samples + 1536, state->acmod, state->output, 0,
+ state->clev, state->slev);
+ }
+
+ if (blksw[0])
+ for (i = 0; i < nfchans; i++)
+ a52_imdct_256 (samples + 256 * i, samples + 1536 + 256 * i,
+ state->bias);
+ else
+ for (i = 0; i < nfchans; i++)
+ a52_imdct_512 (samples + 256 * i, samples + 1536 + 256 * i,
+ state->bias);
+ }
+
+ return 0;
+}
+
+void a52_free (a52_state_t * state)
+{
+ free (state->samples);
+ free (state);
+}
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/tables.h b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/tables.h
new file mode 100644
index 000000000..558177961
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/liba52/tables.h
@@ -0,0 +1,246 @@
+/*
+ * tables.h
+ * Copyright (C) 2000-2002 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of a52dec, a free ATSC A-52 stream decoder.
+ * See http://liba52.sourceforge.net/ for updates.
+ *
+ * a52dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * a52dec 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
+ */
+
+static const int8_t exp_1[128] = {
+ -2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
+ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 25,25,25
+};
+static const int8_t exp_2[128] = {
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ 25,25,25
+};
+static const int8_t exp_3[128] = {
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
+ 25,25,25
+};
+
+#define Q0 ((-2 << 15) / 3.0)
+#define Q1 (0)
+#define Q2 ((2 << 15) / 3.0)
+
+static const sample_t q_1_0[32] = {
+ Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,
+ Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,
+ Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,
+ 0,0,0,0,0
+};
+
+static const sample_t q_1_1[32] = {
+ Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
+ Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
+ Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
+ 0,0,0,0,0
+};
+
+static const sample_t q_1_2[32] = {
+ Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
+ Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
+ Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
+ 0,0,0,0,0
+};
+
+#undef Q0
+#undef Q1
+#undef Q2
+
+#define Q0 ((-4 << 15) / 5.0)
+#define Q1 ((-2 << 15) / 5.0)
+#define Q2 (0)
+#define Q3 ((2 << 15) / 5.0)
+#define Q4 ((4 << 15) / 5.0)
+
+static const sample_t q_2_0[128] = {
+ Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,
+ Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,
+ Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,
+ Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,
+ Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,
+ 0,0,0
+};
+
+static const sample_t q_2_1[128] = {
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
+ 0,0,0
+};
+
+static const sample_t q_2_2[128] = {
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
+ 0,0,0
+};
+
+#undef Q0
+#undef Q1
+#undef Q2
+#undef Q3
+#undef Q4
+
+static const sample_t q_3[8] = {
+ (-6 << 15)/7.0, (-4 << 15)/7.0, (-2 << 15)/7.0, 0,
+ ( 2 << 15)/7.0, ( 4 << 15)/7.0, ( 6 << 15)/7.0, 0
+};
+
+#define Q0 ((-10 << 15) / 11.0)
+#define Q1 ((-8 << 15) / 11.0)
+#define Q2 ((-6 << 15) / 11.0)
+#define Q3 ((-4 << 15) / 11.0)
+#define Q4 ((-2 << 15) / 11.0)
+#define Q5 (0)
+#define Q6 ((2 << 15) / 11.0)
+#define Q7 ((4 << 15) / 11.0)
+#define Q8 ((6 << 15) / 11.0)
+#define Q9 ((8 << 15) / 11.0)
+#define QA ((10 << 15) / 11.0)
+
+static const sample_t q_4_0[128] = {
+ Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0,
+ Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1,
+ Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2,
+ Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3,
+ Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4,
+ Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5,
+ Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6,
+ Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7,
+ Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8,
+ Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9,
+ QA, QA, QA, QA, QA, QA, QA, QA, QA, QA, QA,
+ 0, 0, 0, 0, 0, 0, 0
+};
+
+static const sample_t q_4_1[128] = {
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
+ 0, 0, 0, 0, 0, 0, 0
+};
+
+#undef Q0
+#undef Q1
+#undef Q2
+#undef Q3
+#undef Q4
+#undef Q5
+#undef Q6
+#undef Q7
+#undef Q8
+#undef Q9
+#undef QA
+
+static const sample_t q_5[16] = {
+ (-14 << 15)/15.0,(-12 << 15)/15.0,(-10 << 15)/15.0,
+ ( -8 << 15)/15.0,( -6 << 15)/15.0,( -4 << 15)/15.0,
+ ( -2 << 15)/15.0, 0 ,( 2 << 15)/15.0,
+ ( 4 << 15)/15.0,( 6 << 15)/15.0,( 8 << 15)/15.0,
+ ( 10 << 15)/15.0,( 12 << 15)/15.0,( 14 << 15)/15.0,
+ 0
+};
+
+static const sample_t scale_factor[25] = {
+ 0.000030517578125,
+ 0.0000152587890625,
+ 0.00000762939453125,
+ 0.000003814697265625,
+ 0.0000019073486328125,
+ 0.00000095367431640625,
+ 0.000000476837158203125,
+ 0.0000002384185791015625,
+ 0.00000011920928955078125,
+ 0.000000059604644775390625,
+ 0.0000000298023223876953125,
+ 0.00000001490116119384765625,
+ 0.000000007450580596923828125,
+ 0.0000000037252902984619140625,
+ 0.00000000186264514923095703125,
+ 0.000000000931322574615478515625,
+ 0.0000000004656612873077392578125,
+ 0.00000000023283064365386962890625,
+ 0.000000000116415321826934814453125,
+ 0.0000000000582076609134674072265625,
+ 0.00000000002910383045673370361328125,
+ 0.000000000014551915228366851806640625,
+ 0.0000000000072759576141834259033203125,
+ 0.00000000000363797880709171295166015625,
+ 0.000000000001818989403545856475830078125
+};
+
+static const uint16_t dither_lut[256] = {
+ 0x0000, 0xa011, 0xe033, 0x4022, 0x6077, 0xc066, 0x8044, 0x2055,
+ 0xc0ee, 0x60ff, 0x20dd, 0x80cc, 0xa099, 0x0088, 0x40aa, 0xe0bb,
+ 0x21cd, 0x81dc, 0xc1fe, 0x61ef, 0x41ba, 0xe1ab, 0xa189, 0x0198,
+ 0xe123, 0x4132, 0x0110, 0xa101, 0x8154, 0x2145, 0x6167, 0xc176,
+ 0x439a, 0xe38b, 0xa3a9, 0x03b8, 0x23ed, 0x83fc, 0xc3de, 0x63cf,
+ 0x8374, 0x2365, 0x6347, 0xc356, 0xe303, 0x4312, 0x0330, 0xa321,
+ 0x6257, 0xc246, 0x8264, 0x2275, 0x0220, 0xa231, 0xe213, 0x4202,
+ 0xa2b9, 0x02a8, 0x428a, 0xe29b, 0xc2ce, 0x62df, 0x22fd, 0x82ec,
+ 0x8734, 0x2725, 0x6707, 0xc716, 0xe743, 0x4752, 0x0770, 0xa761,
+ 0x47da, 0xe7cb, 0xa7e9, 0x07f8, 0x27ad, 0x87bc, 0xc79e, 0x678f,
+ 0xa6f9, 0x06e8, 0x46ca, 0xe6db, 0xc68e, 0x669f, 0x26bd, 0x86ac,
+ 0x6617, 0xc606, 0x8624, 0x2635, 0x0660, 0xa671, 0xe653, 0x4642,
+ 0xc4ae, 0x64bf, 0x249d, 0x848c, 0xa4d9, 0x04c8, 0x44ea, 0xe4fb,
+ 0x0440, 0xa451, 0xe473, 0x4462, 0x6437, 0xc426, 0x8404, 0x2415,
+ 0xe563, 0x4572, 0x0550, 0xa541, 0x8514, 0x2505, 0x6527, 0xc536,
+ 0x258d, 0x859c, 0xc5be, 0x65af, 0x45fa, 0xe5eb, 0xa5c9, 0x05d8,
+ 0xae79, 0x0e68, 0x4e4a, 0xee5b, 0xce0e, 0x6e1f, 0x2e3d, 0x8e2c,
+ 0x6e97, 0xce86, 0x8ea4, 0x2eb5, 0x0ee0, 0xaef1, 0xeed3, 0x4ec2,
+ 0x8fb4, 0x2fa5, 0x6f87, 0xcf96, 0xefc3, 0x4fd2, 0x0ff0, 0xafe1,
+ 0x4f5a, 0xef4b, 0xaf69, 0x0f78, 0x2f2d, 0x8f3c, 0xcf1e, 0x6f0f,
+ 0xede3, 0x4df2, 0x0dd0, 0xadc1, 0x8d94, 0x2d85, 0x6da7, 0xcdb6,
+ 0x2d0d, 0x8d1c, 0xcd3e, 0x6d2f, 0x4d7a, 0xed6b, 0xad49, 0x0d58,
+ 0xcc2e, 0x6c3f, 0x2c1d, 0x8c0c, 0xac59, 0x0c48, 0x4c6a, 0xec7b,
+ 0x0cc0, 0xacd1, 0xecf3, 0x4ce2, 0x6cb7, 0xcca6, 0x8c84, 0x2c95,
+ 0x294d, 0x895c, 0xc97e, 0x696f, 0x493a, 0xe92b, 0xa909, 0x0918,
+ 0xe9a3, 0x49b2, 0x0990, 0xa981, 0x89d4, 0x29c5, 0x69e7, 0xc9f6,
+ 0x0880, 0xa891, 0xe8b3, 0x48a2, 0x68f7, 0xc8e6, 0x88c4, 0x28d5,
+ 0xc86e, 0x687f, 0x285d, 0x884c, 0xa819, 0x0808, 0x482a, 0xe83b,
+ 0x6ad7, 0xcac6, 0x8ae4, 0x2af5, 0x0aa0, 0xaab1, 0xea93, 0x4a82,
+ 0xaa39, 0x0a28, 0x4a0a, 0xea1b, 0xca4e, 0x6a5f, 0x2a7d, 0x8a6c,
+ 0x4b1a, 0xeb0b, 0xab29, 0x0b38, 0x2b6d, 0x8b7c, 0xcb5e, 0x6b4f,
+ 0x8bf4, 0x2be5, 0x6bc7, 0xcbd6, 0xeb83, 0x4b92, 0x0bb0, 0xaba1
+};
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/config.h b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/config.h
new file mode 100644
index 000000000..d36b7d619
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/config.h
@@ -0,0 +1,124 @@
+/* vc++/config.h - manually adapted from include/config.h.in */
+
+/* maximum supported data alignment */
+/* #undef ATTRIBUTE_ALIGNED_MAX */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define to 1 if you have the `ftime' function. */
+#define HAVE_FTIME 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+/* #undef HAVE_GETTIMEOFDAY */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Define to 1 if you have the <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define to 1 if you have the `memalign' function. */
+/* #undef HAVE_MEMALIGN */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#define HAVE_SYS_TIMEB_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+/* #undef HAVE_SYS_TIME_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* liba52 djbfft support */
+/* #undef LIBA52_DJBFFT */
+
+/* a52 sample precision */
+/* #undef LIBA52_DOUBLE */
+
+/* libao al support */
+/* #undef LIBAO_AL */
+
+/* libao OSS support */
+/* #undef LIBAO_OSS */
+
+/* libao solaris support */
+/* #undef LIBAO_SOLARIS */
+
+/* libao win support */
+#define LIBAO_WIN
+
+/* Name of package */
+#define PACKAGE "a52dec"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* The size of a `char', as computed by sizeof. */
+#define SIZEOF_CHAR 1
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "0.7.4-cvs"
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+ if it is not supported. */
+#define inline __inline
+
+/* Define as `__restrict' if that's what the C compiler calls it, or to
+ nothing if it is not supported. */
+#define restrict __restrict
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/inttypes.h b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/inttypes.h
new file mode 100644
index 000000000..ab717dfd6
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/inttypes.h
@@ -0,0 +1,15 @@
+#pragma once
+
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed int int32_t;
+#ifdef ARCH_X86
+typedef signed long long int64_t;
+#endif
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+#ifdef ARCH_X86
+typedef unsigned long long uint64_t;
+#endif
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52.vcproj b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52.vcproj
new file mode 100644
index 000000000..4b25d845c
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52.vcproj
@@ -0,0 +1,251 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="liba52"
+ ProjectGUID="{62FE6D94-E17C-4A8E-8D3C-7A589A70D865}"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=".,../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/liba52.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\liba52R.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".,../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ GeneratePreprocessedFile="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/liba52.pch"
+ AssemblerOutput="0"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\liba52D.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="..\liba52\bit_allocate.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\liba52\bitstream.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\liba52\downmix.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\liba52\imdct.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\liba52\parse.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath="..\include\a52.h">
+ </File>
+ <File
+ RelativePath="..\liba52\a52_internal.h">
+ </File>
+ <File
+ RelativePath="..\liba52\bitstream.h">
+ </File>
+ <File
+ RelativePath="..\liba52\tables.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52_vs2005.vcproj b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52_vs2005.vcproj
new file mode 100644
index 000000000..b15bd5f0f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52_vs2005.vcproj
@@ -0,0 +1,331 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="liba52"
+ ProjectGUID="{62FE6D94-E17C-4A8E-8D3C-7A589A70D865}"
+ RootNamespace="liba52"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=".,../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ PrecompiledHeaderFile=".\Release/liba52.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\liba52R.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ AdditionalIncludeDirectories=".,../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ GeneratePreprocessedFile="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ PrecompiledHeaderFile=".\Debug/liba52.pch"
+ AssemblerOutput="0"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\liba52D.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\liba52\bit_allocate.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\liba52\bitstream.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\liba52\downmix.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\liba52\imdct.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\liba52\parse.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\include\a52.h"
+ >
+ </File>
+ <File
+ RelativePath="..\liba52\a52_internal.h"
+ >
+ </File>
+ <File
+ RelativePath="..\liba52\bitstream.h"
+ >
+ </File>
+ <File
+ RelativePath="..\liba52\tables.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..7b776b583
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/a52dec-0.7.4/vc++/liba52_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/AUTHORS b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/AUTHORS
new file mode 100644
index 000000000..843f0a2eb
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/AUTHORS
@@ -0,0 +1,28 @@
+Gildas Bazin <gbazin@videolan.org> implementation of the
+DTS Coherent Acoustics decoder and current maintainer of dtsdec.
+
+While the libdts part of the source code was mostly written from scratch, this
+project was started from the a52dec code base so the original credits for
+a52dec are preserved:
+
+Aaron Holtzman <aholtzma@ess.engr.uvic.ca> started the project and
+made the initial working implementation.
+
+Michel Lespinasse <walken@zoy.org> did major changes for speed and
+conformance and is the current maintainer.
+
+Other contributors include:
+ Gildas Bazin <gbazin@netcourrier.com> - mingw32 port
+ Billy Biggs <vektor@div8.net> - most of liba52.txt
+ Jeroen Dobbelaere <jeroen.dobbelaere@acunia.com> - fixed point version
+ Eduard Hasenleithner <eduardh@aon.at> - gcc 3.0 fixes
+ Håkan Hjort <d95hjort@dtek.chalmers.se> - Solaris output, mlib code
+ Charles M. Hannum <root@ihack.net> - fixes
+ Chris Hodges <hodges@stradis.com> - made the library reentrant
+ Michael Holzt <kju@flummi.de> - OSS output.c and misc errata
+ Angelos Keromytis <angelos@dsl.cis.upenn.edu> - OpenBSD fixes
+ David I. Lehn <dlehn@vt.edu> - API cleanup suggestion
+ Don Mahurin <dmahurin@dma.org> - stdin support for extract_a52
+ Jim Miller <jmiller@heli.engr.sgi.com> - IRIX output.c
+ Takefumi Sayo <stake@niagara.shiojiri.ne.jp> - FreeBSD tweak
+ Shoji Tokunaga <toku@mac.com> - aif file output
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/COPYING b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/COPYING
new file mode 100644
index 000000000..f89b4fa4e
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/ChangeLog b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/ChangeLog
new file mode 100644
index 000000000..e590c89fd
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/ChangeLog
@@ -0,0 +1,288 @@
+------------------------------------------------------------------------
+r17 | sam | 2004-02-24 20:30:41 +0100 (Tue, 24 Feb 2004) | 5 lines
+Changed paths:
+ M /trunk
+ M /trunk/Makefile.am
+ M /trunk/debian/Makefile.am
+ D /trunk/debian/dirs
+ M /trunk/debian/rules
+ M /trunk/include/Makefile.am
+
+ * include/Makefile.am:
+ + Install dts.h directly into /usr/include.
+ * debian/rules:
+ + Updated accordingly.
+
+------------------------------------------------------------------------
+r16 | sam | 2004-02-24 20:17:59 +0100 (Tue, 24 Feb 2004) | 13 lines
+Changed paths:
+ M /trunk
+ D /trunk/INSTALL
+ M /trunk/Makefile.am
+ M /trunk/README
+ M /trunk/bootstrap
+ A /trunk/configure.ac (from /trunk/configure.in:14)
+ D /trunk/configure.in
+ M /trunk/include
+ D /trunk/include/config.h.in
+
+ * configure.ac:
+ + Renamed configure.in into configure.ac.
+ + Renamed package to libdts (was dtsdec).
+ + Put config.h into . instead of include/.
+ * bootstrap:
+ + Imported libdvdcss's bootstrap script (handles multiple automake
+ installations).
+ * Makefile.am:
+ + Split SUBDIRS into SUBDIRS and DIST_SUBDIRS.
+ * README:
+ + Merged INSTALL into README.
+ + Fixed a couple of URLs.
+
+------------------------------------------------------------------------
+r15 | sam | 2004-02-24 20:16:03 +0100 (Tue, 24 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/libdts/bitstream.c
+
+ * bitstream.c:
+ + Minor 64 bit fix.
+
+------------------------------------------------------------------------
+r14 | sam | 2004-02-24 18:15:46 +0100 (Tue, 24 Feb 2004) | 10 lines
+Changed paths:
+ M /trunk/bootstrap
+ M /trunk/configure.in
+ M /trunk/include
+ M /trunk/libdts/Makefile.am
+ M /trunk/src/Makefile.am
+
+ * bootstrap:
+ + Abort if any of the autotools fails.
+ + Check for libtoolize's real name (can be glibtoolize under OS X).
+ + Move ltmain.sh to autotools/ if libtoolize created it in '.'.
+ + Call autoconf before autoheader and automake to avoid unnecessary calls
+ to automake during the make process.
+ * configure.in:
+ + Use AM_CONFIG_HEADER instead of AC_CONFIG_HEADERS.
+ + Substitute LIBAO_LIBS and LIBDTS_LIBS so that automake does not fail.
+
+------------------------------------------------------------------------
+r13 | sam | 2004-02-24 17:49:27 +0100 (Tue, 24 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+ M /trunk/configure.in
+ A /trunk/debian
+ A /trunk/debian/Makefile.am
+ A /trunk/debian/changelog
+ A /trunk/debian/compat
+ A /trunk/debian/control
+ A /trunk/debian/copyright
+ A /trunk/debian/dirs
+ A /trunk/debian/rules
+
+ * debian/*:
+ + Added Debian packaging information.
+
+------------------------------------------------------------------------
+r12 | gbazin | 2004-02-23 23:37:39 +0100 (Mon, 23 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/src/dtsdec.c
+
+* src/dtsdec.c: make sure we read enough data for dts_syncinfo().
+
+------------------------------------------------------------------------
+r11 | gbazin | 2004-02-13 18:57:21 +0100 (Fri, 13 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/ChangeLog
+ M /trunk/NEWS
+ M /trunk/TODO
+ M /trunk/configure.in
+ M /trunk/libdts/parse.c
+ M /trunk/libdts/tables_adpcm.h
+ M /trunk/libdts/tables_quantization.h
+ A /trunk/libdts/tables_vq.h
+
+* ALL: bumped version number to 0.0.2-svn
+* libdts/parse.c, libdts/tables_vq.h: added support for high frequencies VQ.
+
+------------------------------------------------------------------------
+r10 | gbazin | 2004-02-11 19:01:25 +0100 (Wed, 11 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/README
+ M /trunk/libdts/dts_internal.h
+
+* README: remove useless line.
+* libdts/dts_internal.h: fixed array size for high freq VQ.
+
+------------------------------------------------------------------------
+r9 | gbazin | 2004-02-11 18:58:49 +0100 (Wed, 11 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/test
+
+* test: forgot the svn:ignore property for this directory.
+
+------------------------------------------------------------------------
+r8 | gbazin | 2004-02-11 18:57:53 +0100 (Wed, 11 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk
+ M /trunk/autotools
+ M /trunk/doc
+ M /trunk/include
+ M /trunk/libao
+ M /trunk/libdts
+ M /trunk/src
+ M /trunk/vc++
+
+* ALL: added svn:ignore properties.
+
+------------------------------------------------------------------------
+r7 | bidon | 2004-02-08 21:49:14 +0100 (Sun, 08 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+ M /trunk/NEWS
+
+* ALL: 0.0.1 release
+
+------------------------------------------------------------------------
+r6 | bidon | 2004-02-08 20:54:41 +0100 (Sun, 08 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+ M /trunk/NEWS
+ M /trunk/README
+ M /trunk/TODO
+ M /trunk/configure.in
+ M /trunk/include/dts.h
+ M /trunk/libdts/bitstream.c
+ M /trunk/libdts/bitstream.h
+ M /trunk/libdts/downmix.c
+ M /trunk/libdts/dts_internal.h
+ M /trunk/libdts/parse.c
+ M /trunk/libdts/tables.h
+ M /trunk/libdts/tables_adpcm.h
+ M /trunk/libdts/tables_fir.h
+ M /trunk/libdts/tables_huffman.h
+ M /trunk/libdts/tables_quantization.h
+ M /trunk/src/dtsdec.c
+ M /trunk/src/extract_dts.c
+ M /trunk/test/compare.c
+
+* ALL: preparing for the first release.
+
+------------------------------------------------------------------------
+r5 | gbazin | 2004-02-08 19:52:52 +0100 (Sun, 08 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/libdts/downmix.c
+ M /trunk/libdts/parse.c
+
+* libdts/downmix.c: a few correction to the input/output downmixing table.
+
+------------------------------------------------------------------------
+r4 | gbazin | 2004-02-08 15:21:23 +0100 (Sun, 08 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/libdts/parse.c
+
+* libdts/parse.c: support for LFE channel.
+
+------------------------------------------------------------------------
+r3 | gbazin | 2004-02-08 02:50:58 +0100 (Sun, 08 Feb 2004) | 3 lines
+Changed paths:
+ M /trunk/libdts/dts_internal.h
+ M /trunk/libdts/parse.c
+
+* libdts/dts_internal.h: added debug flag and high freq VQ array.
+* libdts/parse.c: make sure the VQ encoded high frequencies are initialised to 0 (we can't decode them for now).
+
+------------------------------------------------------------------------
+r2 | gbazin | 2004-02-06 23:34:19 +0100 (Fri, 06 Feb 2004) | 2 lines
+Changed paths:
+ M /trunk/libdts/bitstream.h
+
+* libdts/bitstream.h: fixed stupid endianness mistake.
+
+------------------------------------------------------------------------
+r1 | gbazin | 2004-02-05 01:34:30 +0100 (Thu, 05 Feb 2004) | 2 lines
+Changed paths:
+ A /branches
+ A /tags
+ A /trunk
+ A /trunk/AUTHORS
+ A /trunk/COPYING
+ A /trunk/ChangeLog
+ A /trunk/INSTALL
+ A /trunk/Makefile.am
+ A /trunk/NEWS
+ A /trunk/README
+ A /trunk/TODO
+ A /trunk/acinclude.m4
+ A /trunk/autotools
+ A /trunk/autotools/Makefile.am
+ A /trunk/bootstrap
+ A /trunk/configure.in
+ A /trunk/doc
+ A /trunk/doc/Makefile.am
+ A /trunk/doc/libdts.txt
+ A /trunk/include
+ A /trunk/include/Makefile.am
+ A /trunk/include/audio_out.h
+ A /trunk/include/config.h.in
+ A /trunk/include/dts.h
+ A /trunk/include/tendra.h
+ A /trunk/libao
+ A /trunk/libao/Makefile.am
+ A /trunk/libao/audio_out.c
+ A /trunk/libao/audio_out_aif.c
+ A /trunk/libao/audio_out_al.c
+ A /trunk/libao/audio_out_float.c
+ A /trunk/libao/audio_out_internal.h
+ A /trunk/libao/audio_out_null.c
+ A /trunk/libao/audio_out_oss.c
+ A /trunk/libao/audio_out_peak.c
+ A /trunk/libao/audio_out_solaris.c
+ A /trunk/libao/audio_out_wav.c
+ A /trunk/libao/audio_out_win.c
+ A /trunk/libao/configure.incl
+ A /trunk/libao/convert2s16.c
+ A /trunk/libdts
+ A /trunk/libdts/Makefile.am
+ A /trunk/libdts/bitstream.c
+ A /trunk/libdts/bitstream.h
+ A /trunk/libdts/configure.incl
+ A /trunk/libdts/downmix.c
+ A /trunk/libdts/dts_internal.h
+ A /trunk/libdts/libdts.pc.in
+ A /trunk/libdts/parse.c
+ A /trunk/libdts/tables.h
+ A /trunk/libdts/tables_adpcm.h
+ A /trunk/libdts/tables_fir.h
+ A /trunk/libdts/tables_huffman.h
+ A /trunk/libdts/tables_quantization.h
+ A /trunk/src
+ A /trunk/src/Makefile.am
+ A /trunk/src/configure.incl
+ A /trunk/src/dtsdec.1
+ A /trunk/src/dtsdec.c
+ A /trunk/src/extract_dts.1
+ A /trunk/src/extract_dts.c
+ A /trunk/src/getopt.c
+ A /trunk/src/getopt.h
+ A /trunk/src/gettimeofday.c
+ A /trunk/src/gettimeofday.h
+ A /trunk/test
+ A /trunk/test/Makefile.am
+ A /trunk/test/compare.c
+ A /trunk/test/compile
+ A /trunk/test/globals
+ A /trunk/test/regression
+ A /trunk/test/tests
+ A /trunk/vc++
+ A /trunk/vc++/Makefile.am
+ A /trunk/vc++/config.h
+ A /trunk/vc++/dtsdec.dsp
+ A /trunk/vc++/dtsdec.dsw
+ A /trunk/vc++/inttypes.h
+ A /trunk/vc++/libao.dsp
+ A /trunk/vc++/libdts.dsp
+
+Inital import
+
+------------------------------------------------------------------------
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/INSTALL b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/INSTALL
new file mode 100644
index 000000000..1c97f4517
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/INSTALL
@@ -0,0 +1,58 @@
+Unix build instructions
+-----------------------
+
+./configure
+make
+make install
+
+If you install from CVS you'll have to run ./bootstrap first
+
+
+Building for win32
+------------------
+
+There are at least three ways to do it:
+
+- natively on Windows using Microsoft VC++ and the vc++ project
+ included in this distribution.
+
+- natively on Windows using MSYS + MINGW (www.mingw.org) (MSYS is a
+ minimal build environnement to compile unixish projects under
+ windows. It provides all the common unix tools like sh, gmake...)
+
+- or on Linux, using the mingw32 cross-compiler
+
+
+Building using MSYS + MINGW on windows
+--------------------------------------
+
+First you will need to download and install the latest MSYS (version
+1.0.7 as of now) and MINGW. The installation is really easy. Begin
+with the MSYS auto-installer and once this is done, extract MINGW into
+c:\msys\1.0\mingw. You also have to remember to remove the make
+utility included with MINGW as it conflicts with the one from MSYS
+(just rename or remove c:\msys\1.0\mingw\bin\make.exe).
+
+http://prdownloads.sourceforge.net/mingw/MSYS-1.0.7-i686-2002.04.24-1.exe
+http://prdownloads.sourceforge.net/mingw/MinGW-1.1.tar.gz
+
+Then you can build the package using:
+# ./configure
+# make
+
+
+Building using the mingw32 cross-compiler
+-----------------------------------------
+
+You need to install mingw32 first. For Debian GNU/Linux users, there
+is a mingw32 package. Otherwise you might get it from the mingw site
+at http://www.mingw.org/download.shtml.
+
+The videolan project also keeps precompiled mingw32 binaries at
+http://www.videolan.org/vlc/windows.html . If you install these,
+you'll have to set your PATH accordingly to include
+/usr/local/cross-tools/bin too.
+
+The build should then proceed using something like:
+# CC=i586-mingw32msvc-gcc ./configure --host=i586-mingw32msvc
+# make
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/NEWS b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/NEWS
new file mode 100644
index 000000000..4a3e605c0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/NEWS
@@ -0,0 +1,10 @@
+dtsdec-0.0.2-svn
+
+Support for high frequencies vector quantization.
+
+dtsdec-0.0.1 Sun Feb 8 21:49:17 CET 2004
+
+First public release of libdts, a DTS Coherent Acoustics decoder based
+on the publicly available ETSI specification (ETSI 102 114 v1.2.1).
+
+Code based on a52dec-0.7.4
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/README b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/README
new file mode 100644
index 000000000..42ee34b6a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/README
@@ -0,0 +1,170 @@
+About libdts
+------------
+
+libdts is a free library for decoding DTS Coherent Acoustics streams. It is
+released under the terms of the GPL license. The DTS Coherent Acoustics
+standard is used in a variety of applications, including DVD, DTS audio CD and
+radio broadcasting.
+
+The main goals in libdts development are:
+
+ * Portability - currently all of the code is written in C, and
+ when we write platform-specific optimizations we will always
+ keep a generic C routine to fall back on.
+
+ * Reuseability - we do not want libdts to include any
+ project-specific code, but it should still include enough
+ features to be used by very diverse projects.
+
+ * Precision - we do not yet fully support all the core specification of
+ the DTS Coherent Acoustics standard (see TODO) so do not expect too
+ much of this library for now.
+
+ * Speed - current code is not optimised at all.
+
+The project homepage is at http://www.videolan.org/dtsdec.html
+
+
+dtsdec
+------
+
+dtsdec is a test program for libdts. It decodes DTS Coherent Acoustics streams,
+and also includes a demultiplexer for mpeg-1 and mpeg-2 program streams.
+
+The libdts source code is always distributed in the dtsdec package, to
+make sure it easier for people to test it.
+
+The basic usage is to just type "dtsdec file" where file is a DTS Coherent
+Acoustics file.
+
+The "-s" option must be used for multiplexed (audio and video) mpeg-2
+files. These files are usualy found on the internet or on unencrypted
+DVDs.
+
+The "-o" option is used to select a given output layer. By default
+dtsdec does a stereo downmix and outputs to your speakers, but you can
+try other choices using this option. This is also used for performance
+testing and conformance testing.
+
+The "-r" option is used to disable the dynamic range compression.
+
+
+Other projects using libdts
+---------------------------
+
+right now libdts is only being used by VLC media player
+(http://www.videolan.org/) a cross-platform video player and streaming
+solution.
+
+If you use libdts in another project, let us know !
+
+
+Tasks
+-----
+
+There are several places where we could easily use some help:
+
+ * Testing: If you find any stream that does not decode right
+ with libdts, let us know ! The best thing would be to mail to
+ the libdts-devel mailing list. Also if you have access to
+ encoders, we'd love to get test streams that would be free of
+ rights - so that we can put them on this server.
+
+ * Coding: you can have a look in the TODO file first ! The most
+ important items are probably to finish implementing the full
+ specification and to make sure of the accuracy of the audio output.
+
+ * Porting: If you're porting to a new architecture, you might
+ want to experiment with the compile flags defined in
+ configure.in . When you figure out whats fastest on your
+ platform, send us a patch !
+
+
+References
+----------
+
+The DTS Coherent Acoustics standard (ETSI 102 114 v1.2.1), as published by the
+ETSI, is available at http://pda.etsi.org/pda/queryform.asp (look for DTS
+Coherent Acoustics)
+
+
+SVN repository
+--------------
+
+The latest libdts and dtsdec source code can always be found by anonymous
+SVN repository:
+
+# svn co svn://svn.videolan.org/libdts/trunk libdts-trunk
+
+If you build libdts from SVN you'll have to run ./bootstrap first.
+
+
+Support / mailing-lists
+-----------------------
+
+See the support information at http://www.videolan.org/support/
+
+libdts-devel
+
+This is the main mailing list for technical discussion about
+libdts. Anyone wanting to work on libdts, or maybe just stay informed
+about the development process, should probably subscribe to this list.
+
+
+Unix build instructions
+-----------------------
+
+./configure
+make
+make install
+
+
+Building for win32
+------------------
+
+There are at least three ways to do it:
+
+- natively on Windows using Microsoft VC++ and the vc++ project
+ included in this distribution.
+
+- natively on Windows using MSYS + MINGW (www.mingw.org) (MSYS is a
+ minimal build environnement to compile unixish projects under
+ windows. It provides all the common unix tools like sh, gmake...)
+
+- or on Linux, using the mingw32 cross-compiler
+
+
+Building using MSYS + MINGW on windows
+--------------------------------------
+
+First you will need to download and install the latest MSYS (version
+1.0.7 as of now) and MINGW. The installation is really easy. Begin
+with the MSYS auto-installer and once this is done, extract MINGW into
+c:\msys\1.0\mingw. You also have to remember to remove the make
+utility included with MINGW as it conflicts with the one from MSYS
+(just rename or remove c:\msys\1.0\mingw\bin\make.exe).
+
+http://prdownloads.sourceforge.net/mingw/MSYS-1.0.7-i686-2002.04.24-1.exe
+http://prdownloads.sourceforge.net/mingw/MinGW-1.1.tar.gz
+
+Then you can build the package using:
+# ./configure
+# make
+
+
+Building using the mingw32 cross-compiler
+-----------------------------------------
+
+You need to install mingw32 first. For Debian GNU/Linux users, there
+is a mingw32 package. Otherwise you might get it from the mingw site
+at http://www.mingw.org/download.shtml.
+
+The videolan project also keeps precompiled mingw32 binaries at
+http://www.videolan.org/vlc/windows.html . If you install these,
+you'll have to set your PATH accordingly to include
+/usr/local/cross-tools/bin too.
+
+The build should then proceed using something like:
+# CC=i586-mingw32msvc-gcc ./configure --host=i586-mingw32msvc
+# make
+
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/TODO b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/TODO
new file mode 100644
index 000000000..fcf8c87cc
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/TODO
@@ -0,0 +1,28 @@
+* finalize the API:
+ - which PCM output format (s24,s32,float...) ?
+ - any special needs for the extensions ?
+
+* implement missing features:
+ - check output gain! I couldn't find anything in the spec about this so
+ right now I'm assuming the output of the 32 subbands QMF is supposed to
+ be in 16 bits/sample form but this seems very dubious.
+ - fix downmix (user proper channes coefs, move downmix before QMF)
+ - sum/difference audio channels
+ - joint channels coding
+ - dynamic range
+ - dialog normalization
+ - check audio output accuracy (right now the main issue is the output gain)
+ - extensions (96k, extra channels)
+
+* optimize:
+ - don't use doubles everywhere
+ - integerize everything ? (main difficulty should be the QMF and LFE FIR)
+ - faster 32 subbands QMF
+
+* reliability:
+ - make the parser more tolerant to faulty bitstreams
+ - more sanity checks
+ - crc checks
+ - regressions tests
+
+* code cleanup
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/doc/libdts.txt b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/doc/libdts.txt
new file mode 100644
index 000000000..2ccc26ff3
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/doc/libdts.txt
@@ -0,0 +1,223 @@
+Using the libdts API
+--------------------
+
+libdts provides a low-level interface to decoding audio frames encoded
+using DTS Coherent Acoustics. libdts provides downmixing and
+dynamic range compression for the following output configurations:
+
+DTS_CHANNEL : Dual mono. Two independant mono channels.
+DTS_CHANNEL1 : First of the two mono channels above.
+DTS_CHANNEL2 : Second of the two mono channels above.
+DTS_MONO : Mono.
+DTS_STEREO : Stereo.
+DTS_DOLBY : Dolby surround compatible stereo.
+DTS_3F : 3 front channels (left, center, right)
+DTS_2F1R : 2 front, 1 rear surround channel (L, R, S)
+DTS_3F1R : 3 front, 1 rear surround channel (L, C, R, S)
+DTS_2F2R : 2 front, 2 rear surround channels (L, R, LS, RS)
+DTS_3F2R : 3 front, 2 rear surround channels (L, C, R, LS, RS)
+
+DTS_LFE : Low frequency effects channel. Normally used to connect a
+ subwoofer. Can be combined with any of the above channels.
+ For example: DTS_3F2R | DTS_LFE -> 3 front, 2 rear, 1 LFE (5.1)
+
+
+Initialization
+--------------
+
+dts_state_t * dts_init (uint32_t mm_accel);
+
+Initializes the DTS library. Takes as a parameter the acceptable
+optimizations which may be used, such as MMX. These are found in the
+included header file 'mm_accel', along with an autodetection function
+(mm_accel()). Currently, there is no accelleration implemented.
+
+The return value is a pointer to a dts state object.
+
+
+Probing the bitstream
+---------------------
+
+int dts_syncinfo (uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate, int * frame_length);
+
+The DTS bitstream is composed of several dts frames concatenated one
+after each other. A dts frame is the smallest independantly decodable
+unit in the stream.
+
+buf must contain at least 14 bytes from the input stream. If these look
+like the start of a valid dts frame, dts_syncinfo() returns the size
+of the coded frame in bytes, and fills flags, sample_rate, bit_rate and
+frame_length with the information encoded in the stream. The returned size
+is guaranteed to be an even number between 96 and 16384 for the 16 bits
+version of the bitstream and 109 and 18726 for the 14 bits version.
+sample_rate will be the sampling frequency in Hz, bit_rate is for the
+compressed stream and is in bits per second, and flags is a description of
+the coded channels: the DTS_LFE bit is set if there is an LFE channel coded
+in this stream, and by masking flags with DTS_CHANNEL_MASK you will get a
+value that describes the full-bandwidth channels, as one of the
+DTS_CHANNEL...DTS_3F2R flags.
+
+If this can not possibly be a valid frame, then the function returns
+0. You should then try to re-synchronize with the dts stream - one way
+to try this would be to advance buf by one byte until its contents
+looks like a valid frame, but there might be better
+application-specific ways to synchronize.
+
+You need to call this function for each frame, for several
+reasons: this function detects errors that the other functions will
+not double-check, consecutive frames might have different lengths, and
+it helps you re-sync with the stream if you get de-synchronized. It will as
+well detect the kind of bitstream it is dealing with (big/little endian,
+16/14 bits mode)
+
+
+Starting to decode a frame
+--------------------------
+
+int dts_frame (dts_state_t * state, uint8_t * buf, int * flags,
+ sample_t * level, sample_t bias);
+
+This starts the work of decoding the DTS frame (to be completed using
+dts_block()). buf should point to the beginning of the complete frame
+of the full size returned by dts_syncinfo().
+
+You should pass in the flags the speaker configuration that you
+support, and libdts will return the speaker configuration it will use
+for its output, based on what is coded in the stream and what you
+asked for. For example, if the stream contains 2+2 channels
+(dts_syncinfo() returned DTS_2F2R in the flags), and you have 3+1
+speakers (you passed DTS_3F1R), then libdts will choose do downmix to
+2+1 speakers, since there is no center channel to send to your center
+speaker. So in that case the left and right channels will be
+essentially unmodified by the downmix, and the two surround channels
+will be added together and sent to your surround speaker. libdts will
+return DTS_2F1R to indicate this.
+
+The good news is that when you downmix to stereo you dont have to
+worry about this, you will ALWAYS get a stereo output no matter what
+was coded in the stream. For more complex output configurations you
+will have to handle the case where libdts couldnt give you what you
+wanted because some of the channels were not encoded in the stream
+though.
+
+Level, bias, and DTS_ADJUST_LEVEL:
+
+Before downmixing, samples are floating point values with a range of
+[-1,1]. Most types of downmixing will combine channels together, which
+will potentially result in a larger range for the output
+samples. libdts provides two methods of controlling the range of the
+output, either before or after the downmix stage.
+
+If you do not set DTS_ADJUST_LEVEL, libdts will multiply the samples
+by your level value, so that they fit in the [-level,level]
+range. Then it will apply the standardized downmix equations,
+potentially making the samples go out of that interval again. The
+level parameter is not modified.
+
+Setting the DTS_ADJUST_LEVEL flag will instruct libdts to treat your
+level value as the intended range interval after downmixing. It will
+then figure out what level to use before the downmix (what you should
+have passed if you hadnt used the DTS_ADJUST_LEVEL flag), and
+overwrite the level value you gave it with that new level value.
+
+The bias represents a value which should be added to the result
+regardless:
+
+output_sample = (input_sample * level) + bias;
+
+For example, a bias of 384 and a level of 1 tells liba52 you want
+samples between 383 and 385 instead of -1 and 1. This is what the
+sample program dtsdec does, as it makes it faster to convert the
+samples to integer format, using a trick based on the IEEE
+floating-point format.
+
+This function also initialises the state for that frame, which will be
+reused next when decoding blocks.
+
+
+Dynamic range compression
+-------------------------
+
+void dts_dynrng (dts_state_t * state,
+ sample_t (* call) (sample_t, void *), void * data);
+
+This function is purely optional. If you dont call it, libdts will
+provide the default behaviour, which is to apply the full dynamic
+range compression as specified in the DTS stream. This basically
+makes the loud sounds softer, and the soft sounds louder, so you can
+more easily listen to the stream in a noisy environment without
+disturbing anyone.
+
+If you do call this function and set a NULL callback, this will
+totally disable the dynamic range compression and provide a playback
+more adapted to a movie theater or a listening room.
+
+If you call this function and specify a callback function, this
+callback might be called up to once for each block, with two
+arguments: the compression factor 'c' recommended by the bitstream,
+and the private data pointer you specified in dts_dynrng(). The
+callback will then return the amount of compression to actually use -
+typically pow(c,x) where x is somewhere between 0 and 1. More
+elaborate compression functions might want to use a different value
+for 'x' depending wether c>1 or c<1 - or even something more complex
+if this is what you want.
+
+
+Finding the number of blocks
+----------------------------
+
+int dts_blocks_num (dts_state_t * state);
+
+Every DTS frame is composed of a variable number of blocks. Calling
+dts_blocks_num() after dts_frame() will give you the number of blocks in the
+current frame.
+
+Decoding blocks
+---------------
+
+int dts_block (dts_state_t * state);
+
+Every DTS frame is composed of a variable number of blocks, each with an
+output of 256 samples for each channel. The dts_block() function decodes
+the next block in the frame, and should be called dts_blocks_num() times to
+decode all of the audio in the frame.
+
+Getting the decoded audio samples
+---------------------------------
+
+sample_t * dts_samples (dts_state_t * state);
+
+After each call to dts_block(), you should extract the audio data from the
+internal samples buffer.
+
+This function returns a pointer to an internal buffer which will contain 256
+samples for the first channel, followed by 256 samples for the second
+channel, etc... the channel order is center, left, right, left
+surround, right surround, LFE. If one of the channels is not present in the
+libdts output, as indicated by the flags returned by dts_frame(), then
+this channel is skipped and the following channels are shifted so
+libdts does not leave an empty space between channels.
+
+
+Pseudocode example
+------------------
+
+dts_state_t * state = dts_init (mm_accel());
+
+loop on input bytes:
+ if at least 14 bytes in the buffer:
+
+ bytes_to_get = dts_syncinfo (...)
+
+ if bytes_to_get == 0:
+ goto loop to keep looking for sync point
+ else
+ get rest of bytes
+
+ dts_frame (state, buf, ...)
+ [dts_dynrng (state, ...); this is only optional]
+ for i = 1 ... dts_blocks_num():
+ dts_block (state)
+ dts_samples (state)
+ convert samples to integer and queue to soundcard
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/include/dts.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/include/dts.h
new file mode 100644
index 000000000..27cc3eb5d
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/include/dts.h
@@ -0,0 +1,88 @@
+/*
+ * dts.h
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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 DTS_H
+#define DTS_H
+
+#define LIBDTS_DOUBLE
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+#if defined(LIBDTS_FIXED)
+typedef int32_t sample_t;
+typedef int32_t level_t;
+#elif defined(LIBDTS_DOUBLE)
+typedef double sample_t;
+typedef double level_t;
+#else
+typedef float sample_t;
+typedef float level_t;
+#endif
+
+typedef struct dts_state_s dts_state_t;
+
+#define DTS_MONO 0
+#define DTS_CHANNEL 1
+#define DTS_STEREO 2
+#define DTS_STEREO_SUMDIFF 3
+#define DTS_STEREO_TOTAL 4
+#define DTS_3F 5
+#define DTS_2F1R 6
+#define DTS_3F1R 7
+#define DTS_2F2R 8
+#define DTS_3F2R 9
+#define DTS_4F2R 10
+
+#define DTS_DOLBY 101 /* FIXME */
+
+#define DTS_CHANNEL_MAX DTS_3F2R /* We don't handle anything above that */
+#define DTS_CHANNEL_BITS 6
+#define DTS_CHANNEL_MASK 0x3F
+
+#define DTS_LFE 0x80
+#define DTS_ADJUST_LEVEL 0x100
+
+dts_state_t * dts_init (uint32_t mm_accel);
+
+int dts_syncinfo (dts_state_t *state, uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate, int *frame_length);
+
+int dts_frame (dts_state_t * state, uint8_t * buf, int * flags,
+ level_t * level, sample_t bias);
+
+void dts_dynrng (dts_state_t * state,
+ level_t (* call) (level_t, void *), void * data);
+
+int dts_blocks_num (dts_state_t * state);
+int dts_block (dts_state_t * state);
+
+sample_t * dts_samples (dts_state_t * state);
+
+void dts_free (dts_state_t * state);
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif /* DTS_H */ \ No newline at end of file
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/bitstream.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/bitstream.h
new file mode 100644
index 000000000..78e833fe0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/bitstream.h
@@ -0,0 +1,67 @@
+/*
+ * bitstream.h
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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
+ */
+
+#ifdef WORDS_BIGENDIAN
+
+# define swab32(x) (x)
+
+#else
+
+# define swab32(x)\
+((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) | \
+ (((uint8_t*)&x)[2] << 8) | (((uint8_t*)&x)[3]))
+
+#endif
+
+#ifdef WORDS_BIGENDIAN
+
+# define swable32(x)\
+((((uint8_t*)&x)[0] << 16) | (((uint8_t*)&x)[1] << 24) | \
+ (((uint8_t*)&x)[2]) | (((uint8_t*)&x)[3] << 8))
+
+#else
+
+# define swable32(x)\
+((((uint16_t*)&x)[0] << 16) | (((uint16_t*)&x)[1]))
+
+#endif
+
+void dts_bitstream_init (dts_state_t * state, uint8_t * buf, int word_mode,
+ int endian_mode);
+uint32_t dts_bitstream_get_bh (dts_state_t * state, uint32_t num_bits);
+
+static inline uint32_t bitstream_get (dts_state_t * state, uint32_t num_bits)
+{
+ uint32_t result;
+
+ if (num_bits < state->bits_left) {
+ result = (state->current_word << (32 - state->bits_left))
+ >> (32 - num_bits);
+
+ state->bits_left -= num_bits;
+ return result;
+ }
+
+ return dts_bitstream_get_bh (state, num_bits);
+}
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_bitstream.c b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_bitstream.c
new file mode 100644
index 000000000..2ff817873
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_bitstream.c
@@ -0,0 +1,111 @@
+/*
+ * bitstream.c
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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 "config.h"
+
+#include <inttypes.h>
+
+#include "dts.h"
+#include "dts_internal.h"
+#include "bitstream.h"
+
+#define BUFFER_SIZE 4096
+
+void dts_bitstream_init (dts_state_t * state, uint8_t * buf, int word_mode,
+ int bigendian_mode)
+{
+ intptr_t align;
+
+ align = (uintptr_t)buf & 3;
+ state->buffer_start = (uint32_t *) (buf - align);
+ state->bits_left = 0;
+ state->current_word = 0;
+ state->word_mode = word_mode;
+ state->bigendian_mode = bigendian_mode;
+ bitstream_get (state, align * 8);
+}
+#include<stdio.h>
+static inline void bitstream_fill_current (dts_state_t * state)
+{
+ uint32_t tmp;
+
+ tmp = *(state->buffer_start++);
+
+ if (state->bigendian_mode)
+ state->current_word = swab32 (tmp);
+ else
+ state->current_word = swable32 (tmp);
+
+ if (!state->word_mode)
+ {
+ state->current_word = (state->current_word & 0x00003FFF) |
+ ((state->current_word & 0x3FFF0000 ) >> 2);
+ }
+}
+
+/*
+ * The fast paths for _get is in the
+ * bitstream.h header file so it can be inlined.
+ *
+ * The "bottom half" of this routine is suffixed _bh
+ *
+ * -ah
+ */
+
+uint32_t dts_bitstream_get_bh (dts_state_t * state, uint32_t num_bits)
+{
+ uint32_t result;
+
+ num_bits -= state->bits_left;
+
+ result = ((state->current_word << (32 - state->bits_left)) >>
+ (32 - state->bits_left));
+
+ if ( !state->word_mode && num_bits > 28 ) {
+ bitstream_fill_current (state);
+ result = (result << 28) | state->current_word;
+ num_bits -= 28;
+ }
+
+ bitstream_fill_current (state);
+
+ if ( state->word_mode )
+ {
+ if (num_bits != 0)
+ result = (result << num_bits) |
+ (state->current_word >> (32 - num_bits));
+
+ state->bits_left = 32 - num_bits;
+ }
+ else
+ {
+ if (num_bits != 0)
+ result = (result << num_bits) |
+ (state->current_word >> (28 - num_bits));
+
+ state->bits_left = 28 - num_bits;
+ }
+
+ return result;
+}
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_downmix.c b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_downmix.c
new file mode 100644
index 000000000..0b0fbb90a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_downmix.c
@@ -0,0 +1,691 @@
+/*
+ * downmix.c
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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 "config.h"
+
+#include <string.h>
+#include <inttypes.h>
+
+#include "dts.h"
+#include "dts_internal.h"
+
+#define CONVERT(acmod,output) (((output) << DTS_CHANNEL_BITS) + (acmod))
+
+int dts_downmix_init (int input, int flags, level_t * level,
+ level_t clev, level_t slev)
+{
+ static uint8_t table[11][10] = {
+ /* DTS_MONO */
+ {DTS_MONO, DTS_MONO, DTS_MONO, DTS_MONO,
+ DTS_MONO, DTS_MONO, DTS_MONO, DTS_MONO,
+ DTS_MONO, DTS_MONO},
+ /* DTS_CHANNEL */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_STEREO, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_STEREO},
+ /* DTS_STEREO */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_STEREO, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_STEREO},
+ /* DTS_STEREO_SUMDIFF */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_STEREO, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_STEREO},
+ /* DTS_STEREO_TOTAL */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_STEREO, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_STEREO},
+ /* DTS_3F */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_3F, DTS_3F, DTS_3F,
+ DTS_3F, DTS_3F},
+ /* DTS_2F1R */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_2F1R, DTS_2F1R, DTS_2F1R,
+ DTS_2F1R, DTS_2F1R},
+ /* DTS_3F1R */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_3F, DTS_3F1R, DTS_3F1R,
+ DTS_3F1R, DTS_3F1R},
+ /* DTS_2F2R */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_STEREO, DTS_2F2R, DTS_2F2R,
+ DTS_2F2R, DTS_2F2R},
+ /* DTS_3F2R */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_3F, DTS_3F2R, DTS_3F2R,
+ DTS_3F2R, DTS_3F2R},
+ /* DTS_4F2R */
+ {DTS_MONO, DTS_CHANNEL, DTS_STEREO, DTS_STEREO,
+ DTS_STEREO, DTS_4F2R, DTS_4F2R, DTS_4F2R,
+ DTS_4F2R, DTS_4F2R},
+ };
+ int output;
+
+ output = flags & DTS_CHANNEL_MASK;
+
+ if (output > DTS_CHANNEL_MAX)
+ return -1;
+
+ output = table[output][input];
+
+ if (output == DTS_STEREO &&
+ (input == DTS_DOLBY || (input == DTS_3F && clev == LEVEL (LEVEL_3DB))))
+ output = DTS_DOLBY;
+
+ if (flags & DTS_ADJUST_LEVEL) {
+ level_t adjust;
+
+ switch (CONVERT (input & 7, output)) {
+
+ case CONVERT (DTS_3F, DTS_MONO):
+ adjust = DIV (LEVEL_3DB, LEVEL (1) + clev);
+ break;
+
+ case CONVERT (DTS_STEREO, DTS_MONO):
+ case CONVERT (DTS_2F2R, DTS_2F1R):
+ case CONVERT (DTS_3F2R, DTS_3F1R):
+ level_3db:
+ adjust = LEVEL (LEVEL_3DB);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_2F1R):
+ if (clev < LEVEL (LEVEL_PLUS3DB - 1))
+ goto level_3db;
+ /* break thru */
+ case CONVERT (DTS_3F, DTS_STEREO):
+ case CONVERT (DTS_3F1R, DTS_2F1R):
+ case CONVERT (DTS_3F1R, DTS_2F2R):
+ case CONVERT (DTS_3F2R, DTS_2F2R):
+ adjust = DIV (1, LEVEL (1) + clev);
+ break;
+
+ case CONVERT (DTS_2F1R, DTS_MONO):
+ adjust = DIV (LEVEL_PLUS3DB, LEVEL (2) + slev);
+ break;
+
+ case CONVERT (DTS_2F1R, DTS_STEREO):
+ case CONVERT (DTS_3F1R, DTS_3F):
+ adjust = DIV (1, LEVEL (1) + MUL_C (slev, LEVEL_3DB));
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_MONO):
+ adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + MUL_C (slev, 0.5));
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_STEREO):
+ adjust = DIV (1, LEVEL (1) + clev + MUL_C (slev, LEVEL_3DB));
+ break;
+
+ case CONVERT (DTS_2F2R, DTS_MONO):
+ adjust = DIV (LEVEL_3DB, LEVEL (1) + slev);
+ break;
+
+ case CONVERT (DTS_2F2R, DTS_STEREO):
+ case CONVERT (DTS_3F2R, DTS_3F):
+ adjust = DIV (1, LEVEL (1) + slev);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_MONO):
+ adjust = DIV (LEVEL_3DB, LEVEL (1) + clev + slev);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_STEREO):
+ adjust = DIV (1, LEVEL (1) + clev + slev);
+ break;
+
+ case CONVERT (DTS_MONO, DTS_DOLBY):
+ adjust = LEVEL (LEVEL_PLUS3DB);
+ break;
+
+ case CONVERT (DTS_3F, DTS_DOLBY):
+ case CONVERT (DTS_2F1R, DTS_DOLBY):
+ adjust = LEVEL (1 / (1 + LEVEL_3DB));
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_DOLBY):
+ case CONVERT (DTS_2F2R, DTS_DOLBY):
+ adjust = LEVEL (1 / (1 + 2 * LEVEL_3DB));
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_DOLBY):
+ adjust = LEVEL (1 / (1 + 3 * LEVEL_3DB));
+ break;
+
+ default:
+ return output;
+ }
+
+ *level = MUL_L (*level, adjust);
+ }
+
+ return output;
+}
+
+int dts_downmix_coeff (level_t * coeff, int acmod, int output, level_t level,
+ level_t clev, level_t slev)
+{
+ level_t level_3db;
+
+ level_3db = MUL_C (level, LEVEL_3DB);
+
+ switch (CONVERT (acmod, output & DTS_CHANNEL_MASK)) {
+
+ case CONVERT (DTS_CHANNEL, DTS_CHANNEL):
+ case CONVERT (DTS_MONO, DTS_MONO):
+ case CONVERT (DTS_STEREO, DTS_STEREO):
+ case CONVERT (DTS_3F, DTS_3F):
+ case CONVERT (DTS_2F1R, DTS_2F1R):
+ case CONVERT (DTS_3F1R, DTS_3F1R):
+ case CONVERT (DTS_2F2R, DTS_2F2R):
+ case CONVERT (DTS_3F2R, DTS_3F2R):
+ case CONVERT (DTS_STEREO, DTS_DOLBY):
+ coeff[0] = coeff[1] = coeff[2] = coeff[3] = coeff[4] = level;
+ return 0;
+
+ case CONVERT (DTS_CHANNEL, DTS_MONO):
+ coeff[0] = coeff[1] = MUL_C (level, LEVEL_6DB);
+ return 3;
+
+ case CONVERT (DTS_STEREO, DTS_MONO):
+ coeff[0] = coeff[1] = level_3db;
+ return 3;
+
+ case CONVERT (DTS_3F, DTS_MONO):
+ coeff[0] = coeff[2] = level_3db;
+ coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB);
+ return 7;
+
+ case CONVERT (DTS_2F1R, DTS_MONO):
+ coeff[0] = coeff[1] = level_3db;
+ coeff[2] = MUL_L (level_3db, slev);
+ return 7;
+
+ case CONVERT (DTS_2F2R, DTS_MONO):
+ coeff[0] = coeff[1] = level_3db;
+ coeff[2] = coeff[3] = MUL_L (level_3db, slev);
+ return 15;
+
+ case CONVERT (DTS_3F1R, DTS_MONO):
+ coeff[0] = coeff[2] = level_3db;
+ coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB);
+ coeff[3] = MUL_L (level_3db, slev);
+ return 15;
+
+ case CONVERT (DTS_3F2R, DTS_MONO):
+ coeff[0] = coeff[2] = level_3db;
+ coeff[1] = MUL_C (MUL_L (level_3db, clev), LEVEL_PLUS6DB);
+ coeff[3] = coeff[4] = MUL_L (level_3db, slev);
+ return 31;
+
+ case CONVERT (DTS_MONO, DTS_DOLBY):
+ coeff[0] = level_3db;
+ return 0;
+
+ case CONVERT (DTS_3F, DTS_DOLBY):
+ coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
+ coeff[1] = level_3db;
+ return 7;
+
+ case CONVERT (DTS_3F, DTS_STEREO):
+ case CONVERT (DTS_3F1R, DTS_2F1R):
+ case CONVERT (DTS_3F2R, DTS_2F2R):
+ coeff[0] = coeff[2] = coeff[3] = coeff[4] = level;
+ coeff[1] = MUL_L (level, clev);
+ return 7;
+
+ case CONVERT (DTS_2F1R, DTS_DOLBY):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = level_3db;
+ return 7;
+
+ case CONVERT (DTS_2F1R, DTS_STEREO):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = MUL_L (level_3db, slev);
+ return 7;
+
+ case CONVERT (DTS_3F1R, DTS_DOLBY):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = coeff[3] = level_3db;
+ return 15;
+
+ case CONVERT (DTS_3F1R, DTS_STEREO):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = MUL_L (level, clev);
+ coeff[3] = MUL_L (level_3db, slev);
+ return 15;
+
+ case CONVERT (DTS_2F2R, DTS_DOLBY):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = level_3db;
+ return 15;
+
+ case CONVERT (DTS_2F2R, DTS_STEREO):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = MUL_L (level, slev);
+ return 15;
+
+ case CONVERT (DTS_3F2R, DTS_DOLBY):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = coeff[3] = coeff[4] = level_3db;
+ return 31;
+
+ case CONVERT (DTS_3F2R, DTS_2F1R):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = MUL_L (level, clev);
+ coeff[3] = coeff[4] = level_3db;
+ return 31;
+
+ case CONVERT (DTS_3F2R, DTS_STEREO):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = MUL_L (level, clev);
+ coeff[3] = coeff[4] = MUL_L (level, slev);
+ return 31;
+
+ case CONVERT (DTS_3F1R, DTS_3F):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = MUL_L (level_3db, slev);
+ return 13;
+
+ case CONVERT (DTS_3F2R, DTS_3F):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = coeff[4] = MUL_L (level, slev);
+ return 29;
+
+ case CONVERT (DTS_2F2R, DTS_2F1R):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = coeff[3] = level_3db;
+ return 12;
+
+ case CONVERT (DTS_3F2R, DTS_3F1R):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = coeff[4] = level_3db;
+ return 24;
+
+ case CONVERT (DTS_2F1R, DTS_2F2R):
+ coeff[0] = coeff[1] = level;
+ coeff[2] = level_3db;
+ return 0;
+
+ case CONVERT (DTS_3F1R, DTS_2F2R):
+ coeff[0] = coeff[2] = level;
+ coeff[1] = MUL_L (level, clev);
+ coeff[3] = level_3db;
+ return 7;
+
+ case CONVERT (DTS_3F1R, DTS_3F2R):
+ coeff[0] = coeff[1] = coeff[2] = level;
+ coeff[3] = level_3db;
+ return 0;
+ }
+
+ return -1; /* NOTREACHED */
+}
+
+static void mix2to1 (sample_t * dest, sample_t * src, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ dest[i] += BIAS (src[i]);
+}
+
+static void mix3to1 (sample_t * samples, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ samples[i] += BIAS (samples[i + 256] + samples[i + 512]);
+}
+
+static void mix4to1 (sample_t * samples, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ samples[i] += BIAS (samples[i + 256] + samples[i + 512] +
+ samples[i + 768]);
+}
+
+static void mix5to1 (sample_t * samples, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ samples[i] += BIAS (samples[i + 256] + samples[i + 512] +
+ samples[i + 768] + samples[i + 1024]);
+}
+
+static void mix3to2 (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common;
+
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i]);
+ samples[i] = samples[i + 256] + common;
+ samples[i + 256] = samples[i + 512] + common;
+ }
+}
+
+static void mix21to2 (sample_t * left, sample_t * right, sample_t bias)
+{
+ int i;
+ sample_t common;
+
+ for (i = 0; i < 256; i++) {
+ common = BIAS (right[i + 256]);
+ left[i] += common;
+ right[i] += common;
+ }
+}
+
+static void mix21toS (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t surround;
+
+ for (i = 0; i < 256; i++) {
+ surround = samples[i + 512];
+ samples[i] += BIAS (-surround);
+ samples[i + 256] += BIAS (surround);
+ }
+}
+
+static void mix31to2 (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common;
+
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i] + samples[i + 768]);
+ samples[i] = samples[i + 256] + common;
+ samples[i + 256] = samples[i + 512] + common;
+ }
+}
+
+static void mix31toS (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common, surround;
+
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i]);
+ surround = samples[i + 768];
+ samples[i] = samples[i + 256] + common - surround;
+ samples[i + 256] = samples[i + 512] + common + surround;
+ }
+}
+
+static void mix22toS (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t surround;
+
+ for (i = 0; i < 256; i++) {
+ surround = samples[i + 512] + samples[i + 768];
+ samples[i] += BIAS (-surround);
+ samples[i + 256] += BIAS (surround);
+ }
+}
+
+static void mix32to2 (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common;
+
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i]);
+ samples[i] = common + samples[i + 256] + samples[i + 768];
+ samples[i + 256] = common + samples[i + 512] + samples[i + 1024];
+ }
+}
+
+static void mix32toS (sample_t * samples, sample_t bias)
+{
+ int i;
+ sample_t common, surround;
+
+ for (i = 0; i < 256; i++) {
+ common = BIAS (samples[i]);
+ surround = samples[i + 768] + samples[i + 1024];
+ samples[i] = samples[i + 256] + common - surround;
+ samples[i + 256] = samples[i + 512] + common + surround;
+ }
+}
+
+static void move2to1 (sample_t * src, sample_t * dest, sample_t bias)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ dest[i] = BIAS (src[i] + src[i + 256]);
+}
+
+static void zero (sample_t * samples)
+{
+ int i;
+
+ for (i = 0; i < 256; i++)
+ samples[i] = 0;
+}
+
+void dts_downmix (sample_t * samples, int acmod, int output, sample_t bias,
+ level_t clev, level_t slev)
+{
+ switch (CONVERT (acmod, output & DTS_CHANNEL_MASK)) {
+
+ case CONVERT (DTS_CHANNEL, DTS_MONO):
+ case CONVERT (DTS_STEREO, DTS_MONO):
+ mix_2to1:
+ mix2to1 (samples, samples + 256, bias);
+ break;
+
+ case CONVERT (DTS_2F1R, DTS_MONO):
+ if (slev == 0)
+ goto mix_2to1;
+ case CONVERT (DTS_3F, DTS_MONO):
+ mix_3to1:
+ mix3to1 (samples, bias);
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_MONO):
+ if (slev == 0)
+ goto mix_3to1;
+ case CONVERT (DTS_2F2R, DTS_MONO):
+ if (slev == 0)
+ goto mix_2to1;
+ mix4to1 (samples, bias);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_MONO):
+ if (slev == 0)
+ goto mix_3to1;
+ mix5to1 (samples, bias);
+ break;
+
+ case CONVERT (DTS_MONO, DTS_DOLBY):
+ memcpy (samples + 256, samples, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DTS_3F, DTS_STEREO):
+ case CONVERT (DTS_3F, DTS_DOLBY):
+ mix_3to2:
+ mix3to2 (samples, bias);
+ break;
+
+ case CONVERT (DTS_2F1R, DTS_STEREO):
+ if (slev == 0)
+ break;
+ mix21to2 (samples, samples + 256, bias);
+ break;
+
+ case CONVERT (DTS_2F1R, DTS_DOLBY):
+ mix21toS (samples, bias);
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_STEREO):
+ if (slev == 0)
+ goto mix_3to2;
+ mix31to2 (samples, bias);
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_DOLBY):
+ mix31toS (samples, bias);
+ break;
+
+ case CONVERT (DTS_2F2R, DTS_STEREO):
+ if (slev == 0)
+ break;
+ mix2to1 (samples, samples + 512, bias);
+ mix2to1 (samples + 256, samples + 768, bias);
+ break;
+
+ case CONVERT (DTS_2F2R, DTS_DOLBY):
+ mix22toS (samples, bias);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_STEREO):
+ if (slev == 0)
+ goto mix_3to2;
+ mix32to2 (samples, bias);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_DOLBY):
+ mix32toS (samples, bias);
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_3F):
+ if (slev == 0)
+ break;
+ mix21to2 (samples, samples + 512, bias);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_3F):
+ if (slev == 0)
+ break;
+ mix2to1 (samples, samples + 768, bias);
+ mix2to1 (samples + 512, samples + 1024, bias);
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_2F1R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DTS_2F2R, DTS_2F1R):
+ mix2to1 (samples + 512, samples + 768, bias);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_2F1R):
+ mix3to2 (samples, bias);
+ move2to1 (samples + 768, samples + 512, bias);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_3F1R):
+ mix2to1 (samples + 768, samples + 1024, bias);
+ break;
+
+ case CONVERT (DTS_2F1R, DTS_2F2R):
+ memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_2F2R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_2F2R):
+ mix3to2 (samples, bias);
+ memcpy (samples + 512, samples + 768, 256 * sizeof (sample_t));
+ memcpy (samples + 768, samples + 1024, 256 * sizeof (sample_t));
+ break;
+
+ case CONVERT (DTS_3F1R, DTS_3F2R):
+ memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
+ break;
+ }
+}
+
+void dts_upmix (sample_t * samples, int acmod, int output)
+{
+ switch (CONVERT (acmod, output & DTS_CHANNEL_MASK)) {
+
+ case CONVERT (DTS_3F2R, DTS_MONO):
+ zero (samples + 1024);
+ case CONVERT (DTS_3F1R, DTS_MONO):
+ case CONVERT (DTS_2F2R, DTS_MONO):
+ zero (samples + 768);
+ case CONVERT (DTS_3F, DTS_MONO):
+ case CONVERT (DTS_2F1R, DTS_MONO):
+ zero (samples + 512);
+ case CONVERT (DTS_CHANNEL, DTS_MONO):
+ case CONVERT (DTS_STEREO, DTS_MONO):
+ zero (samples + 256);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_STEREO):
+ case CONVERT (DTS_3F2R, DTS_DOLBY):
+ zero (samples + 1024);
+ case CONVERT (DTS_3F1R, DTS_STEREO):
+ case CONVERT (DTS_3F1R, DTS_DOLBY):
+ zero (samples + 768);
+ case CONVERT (DTS_3F, DTS_STEREO):
+ case CONVERT (DTS_3F, DTS_DOLBY):
+ mix_3to2:
+ memcpy (samples + 512, samples + 256, 256 * sizeof (sample_t));
+ zero (samples + 256);
+ break;
+
+ case CONVERT (DTS_2F2R, DTS_STEREO):
+ case CONVERT (DTS_2F2R, DTS_DOLBY):
+ zero (samples + 768);
+ case CONVERT (DTS_2F1R, DTS_STEREO):
+ case CONVERT (DTS_2F1R, DTS_DOLBY):
+ zero (samples + 512);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_3F):
+ zero (samples + 1024);
+ case CONVERT (DTS_3F1R, DTS_3F):
+ case CONVERT (DTS_2F2R, DTS_2F1R):
+ zero (samples + 768);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_3F1R):
+ zero (samples + 1024);
+ break;
+
+ case CONVERT (DTS_3F2R, DTS_2F1R):
+ zero (samples + 1024);
+ case CONVERT (DTS_3F1R, DTS_2F1R):
+ mix_31to21:
+ memcpy (samples + 768, samples + 512, 256 * sizeof (sample_t));
+ goto mix_3to2;
+
+ case CONVERT (DTS_3F2R, DTS_2F2R):
+ memcpy (samples + 1024, samples + 768, 256 * sizeof (sample_t));
+ goto mix_31to21;
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_internal.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_internal.h
new file mode 100644
index 000000000..964bf0917
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_internal.h
@@ -0,0 +1,203 @@
+/*
+ * dts_internal.h
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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
+ */
+
+#define DTS_SUBFRAMES_MAX (16)
+#define DTS_PRIM_CHANNELS_MAX (5)
+#define DTS_SUBBANDS (32)
+#define DTS_ABITS_MAX (32) /* Should be 28 */
+#define DTS_SUBSUBFAMES_MAX (4)
+#define DTS_LFE_MAX (3)
+
+struct dts_state_s {
+
+ /* Frame header */
+ int frame_type; /* type of the current frame */
+ int samples_deficit; /* deficit sample count */
+ int crc_present; /* crc is present in the bitstream */
+ int sample_blocks; /* number of PCM sample blocks */
+ int frame_size; /* primary frame byte size */
+ int amode; /* audio channels arrangement */
+ int sample_rate; /* audio sampling rate */
+ int bit_rate; /* transmission bit rate */
+
+ int downmix; /* embedded downmix enabled */
+ int dynrange; /* embedded dynamic range flag */
+ int timestamp; /* embedded time stamp flag */
+ int aux_data; /* auxiliary data flag */
+ int hdcd; /* source material is mastered in HDCD */
+ int ext_descr; /* extension audio descriptor flag */
+ int ext_coding; /* extended coding flag */
+ int aspf; /* audio sync word insertion flag */
+ int lfe; /* low frequency effects flag */
+ int predictor_history; /* predictor history flag */
+ int header_crc; /* header crc check bytes */
+ int multirate_inter; /* multirate interpolator switch */
+ int version; /* encoder software revision */
+ int copy_history; /* copy history */
+ int source_pcm_res; /* source pcm resolution */
+ int front_sum; /* front sum/difference flag */
+ int surround_sum; /* surround sum/difference flag */
+ int dialog_norm; /* dialog normalisation parameter */
+
+ /* Primary audio coding header */
+ int subframes; /* number of subframes */
+ int prim_channels; /* number of primary audio channels */
+ /* subband activity count */
+ int subband_activity[DTS_PRIM_CHANNELS_MAX];
+ /* high frequency vq start subband */
+ int vq_start_subband[DTS_PRIM_CHANNELS_MAX];
+ /* joint intensity coding index */
+ int joint_intensity[DTS_PRIM_CHANNELS_MAX];
+ /* transient mode code book */
+ int transient_huffman[DTS_PRIM_CHANNELS_MAX];
+ /* scale factor code book */
+ int scalefactor_huffman[DTS_PRIM_CHANNELS_MAX];
+ /* bit allocation quantizer select */
+ int bitalloc_huffman[DTS_PRIM_CHANNELS_MAX];
+ /* quantization index codebook select */
+ int quant_index_huffman[DTS_PRIM_CHANNELS_MAX][DTS_ABITS_MAX];
+ /* scale factor adjustment */
+ float scalefactor_adj[DTS_PRIM_CHANNELS_MAX][DTS_ABITS_MAX];
+
+ /* Primary audio coding side information */
+ int subsubframes; /* number of subsubframes */
+ int partial_samples; /* partial subsubframe samples count */
+ /* prediction mode (ADPCM used or not) */
+ int prediction_mode[DTS_PRIM_CHANNELS_MAX][DTS_SUBBANDS];
+ /* prediction VQ coefs */
+ int prediction_vq[DTS_PRIM_CHANNELS_MAX][DTS_SUBBANDS];
+ /* bit allocation index */
+ int bitalloc[DTS_PRIM_CHANNELS_MAX][DTS_SUBBANDS];
+ /* transition mode (transients) */
+ int transition_mode[DTS_PRIM_CHANNELS_MAX][DTS_SUBBANDS];
+ /* scale factors (2 if transient)*/
+ int scale_factor[DTS_PRIM_CHANNELS_MAX][DTS_SUBBANDS][2];
+ /* joint subband scale factors codebook */
+ int joint_huff[DTS_PRIM_CHANNELS_MAX];
+ /* joint subband scale factors */
+ int joint_scale_factor[DTS_PRIM_CHANNELS_MAX][DTS_SUBBANDS];
+ /* stereo downmix coefficients */
+ int downmix_coef[DTS_PRIM_CHANNELS_MAX][2];
+ /* dynamic range coefficient */
+ int dynrange_coef;
+
+ /* VQ encoded high frequency subbands */
+ int high_freq_vq[DTS_PRIM_CHANNELS_MAX][DTS_SUBBANDS];
+
+ /* Low frequency effect data */
+ double lfe_data[2*DTS_SUBSUBFAMES_MAX*DTS_LFE_MAX * 2 /*history*/];
+ int lfe_scale_factor;
+
+ /* Subband samples history (for ADPCM) */
+ double subband_samples_hist[DTS_PRIM_CHANNELS_MAX][DTS_SUBBANDS][4];
+ double subband_fir_hist[DTS_PRIM_CHANNELS_MAX][512];
+ double subband_fir_noidea[DTS_PRIM_CHANNELS_MAX][64];
+
+ /* Audio output */
+ level_t clev; /* centre channel mix level */
+ level_t slev; /* surround channels mix level */
+
+ int output; /* type of output */
+ level_t level; /* output level */
+ sample_t bias; /* output bias */
+
+ sample_t * samples; /* pointer to the internal audio samples buffer */
+ int downmixed;
+
+ int dynrnge; /* apply dynamic range */
+ level_t dynrng; /* dynamic range */
+ void * dynrngdata; /* dynamic range callback funtion and data */
+ level_t (* dynrngcall) (level_t range, void * dynrngdata);
+
+ /* Bitstream handling */
+ uint32_t * buffer_start;
+ uint32_t bits_left;
+ uint32_t current_word;
+ int word_mode; /* 16/14 bits word format (1 -> 16, 0 -> 14) */
+ int bigendian_mode; /* endianness (1 -> be, 0 -> le) */
+
+ /* Current position in DTS frame */
+ int current_subframe;
+ int current_subsubframe;
+
+ /* Pre-calculated cosine modulation coefs for the QMF */
+ double cos_mod[544];
+
+ /* Debug flag */
+ int debug_flag;
+};
+
+#define LEVEL_PLUS6DB 2.0
+#define LEVEL_PLUS3DB 1.4142135623730951
+#define LEVEL_3DB 0.7071067811865476
+#define LEVEL_45DB 0.5946035575013605
+#define LEVEL_6DB 0.5
+
+int dts_downmix_init (int input, int flags, level_t * level,
+ level_t clev, level_t slev);
+int dts_downmix_coeff (level_t * coeff, int acmod, int output, level_t level,
+ level_t clev, level_t slev);
+void dts_downmix (sample_t * samples, int acmod, int output, sample_t bias,
+ level_t clev, level_t slev);
+void dts_upmix (sample_t * samples, int acmod, int output);
+
+#define ROUND(x) ((int)((x) + ((x) > 0 ? 0.5 : -0.5)))
+
+#ifndef LIBDTS_FIXED
+
+typedef sample_t quantizer_t;
+#define SAMPLE(x) (x)
+#define LEVEL(x) (x)
+#define MUL(a,b) ((a) * (b))
+#define MUL_L(a,b) ((a) * (b))
+#define MUL_C(a,b) ((a) * (b))
+#define DIV(a,b) ((a) / (b))
+#define BIAS(x) ((x) + bias)
+
+#else /* LIBDTS_FIXED */
+
+typedef int16_t quantizer_t;
+#define SAMPLE(x) (sample_t)((x) * (1 << 30))
+#define LEVEL(x) (level_t)((x) * (1 << 26))
+
+#if 0
+#define MUL(a,b) ((int)(((int64_t)(a) * (b) + (1 << 29)) >> 30))
+#define MUL_L(a,b) ((int)(((int64_t)(a) * (b) + (1 << 25)) >> 26))
+#elif 1
+#define MUL(a,b) \
+({ int32_t _ta=(a), _tb=(b), _tc; \
+ _tc=(_ta & 0xffff)*(_tb >> 16)+(_ta >> 16)*(_tb & 0xffff); (int32_t)(((_tc >> 14))+ (((_ta >> 16)*(_tb >> 16)) << 2 )); })
+#define MUL_L(a,b) \
+({ int32_t _ta=(a), _tb=(b), _tc; \
+ _tc=(_ta & 0xffff)*(_tb >> 16)+(_ta >> 16)*(_tb & 0xffff); (int32_t)((_tc >> 10) + (((_ta >> 16)*(_tb >> 16)) << 6)); })
+#else
+#define MUL(a,b) (((a) >> 15) * ((b) >> 15))
+#define MUL_L(a,b) (((a) >> 13) * ((b) >> 13))
+#endif
+
+#define MUL_C(a,b) MUL_L (a, LEVEL (b))
+#define DIV(a,b) ((((int64_t)LEVEL (a)) << 26) / (b))
+#define BIAS(x) (x)
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_parse.c b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_parse.c
new file mode 100644
index 000000000..2e60edbce
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/dts_parse.c
@@ -0,0 +1,1294 @@
+/*
+ * parse.c
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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 "config.h"
+
+#include <stdio.h>
+
+//#include <stdlib.h>
+
+void __cdecl free(void *);
+void * __cdecl malloc(size_t);
+
+#include <string.h>
+#include <inttypes.h>
+
+#include <math.h>
+
+#ifndef M_PI
+#define M_PI 3.1415926535897932384626433832795029
+#endif
+
+#include "dts.h"
+#include "dts_internal.h"
+#include "bitstream.h"
+
+#include "tables.h"
+#include "tables_huffman.h"
+#include "tables_quantization.h"
+#include "tables_adpcm.h"
+#include "tables_fir.h"
+#include "tables_vq.h"
+
+/* #define DEBUG */
+
+#if defined(HAVE_MEMALIGN) && !defined(__cplusplus)
+/* some systems have memalign() but no declaration for it */
+void * memalign (size_t align, size_t size);
+#else
+/* assume malloc alignment is sufficient */
+#define memalign(align,size) malloc (size)
+#endif
+
+static int decode_blockcode (int code, int levels, int *values);
+
+static void qmf_32_subbands (dts_state_t * state, int chans,
+ double samples_in[32][8], sample_t *samples_out,
+ double rScale, sample_t bias);
+
+static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample,
+ double *samples_in, sample_t *samples_out,
+ double rScale, sample_t bias );
+
+static void pre_calc_cosmod( dts_state_t * state );
+
+dts_state_t * dts_init (uint32_t mm_accel)
+{
+ dts_state_t * state;
+ int i;
+
+ state = (dts_state_t *) malloc (sizeof (dts_state_t));
+ if (state == NULL)
+ return NULL;
+
+ memset (state, 0, sizeof(dts_state_t));
+
+ state->samples = (sample_t *) memalign (16, 256 * 12 * sizeof (sample_t));
+ if (state->samples == NULL) {
+ free (state);
+ return NULL;
+ }
+
+ for (i = 0; i < 256 * 12; i++)
+ state->samples[i] = 0;
+
+ /* Pre-calculate cosine modulation coefficients */
+ pre_calc_cosmod( state );
+
+ state->downmixed = 1;
+
+ return state;
+}
+
+sample_t * dts_samples (dts_state_t * state)
+{
+ return state->samples;
+}
+
+int dts_blocks_num (dts_state_t * state)
+{
+ /* 8 samples per subsubframe and per subband */
+ return state->sample_blocks / 8;
+}
+
+static int syncinfo (dts_state_t * state, int * flags,
+ int * sample_rate, int * bit_rate, int * frame_length)
+{
+ int frame_size;
+
+ /* Sync code */
+ bitstream_get (state, 32);
+ /* Frame type */
+ bitstream_get (state, 1);
+ /* Samples deficit */
+ bitstream_get (state, 5);
+ /* CRC present */
+ bitstream_get (state, 1);
+
+ *frame_length = (bitstream_get (state, 7) + 1) * 32;
+ frame_size = bitstream_get (state, 14) + 1;
+ if (!state->word_mode) frame_size = frame_size * 8 / 14 * 2;
+
+ /* Audio channel arrangement */
+ *flags = bitstream_get (state, 6);
+ if (*flags > 63)
+ return 0;
+
+ *sample_rate = bitstream_get (state, 4);
+ if (*sample_rate >= sizeof (dts_sample_rates) / sizeof (int))
+ return 0;
+ *sample_rate = dts_sample_rates[ *sample_rate ];
+ if (!*sample_rate) return 0;
+
+ *bit_rate = bitstream_get (state, 5);
+ if (*bit_rate >= sizeof (dts_bit_rates) / sizeof (int))
+ return 0;
+ *bit_rate = dts_bit_rates[ *bit_rate ];
+ if (!*bit_rate) return 0;
+
+ /* LFE */
+ bitstream_get (state, 10);
+ if (bitstream_get (state, 2)) *flags |= DTS_LFE;
+
+ return frame_size;
+}
+
+int dts_syncinfo (dts_state_t * state, uint8_t * buf, int * flags,
+ int * sample_rate, int * bit_rate, int * frame_length)
+{
+ /*
+ * Look for sync code
+ */
+
+ /* 14 bits and little endian bitstream */
+ if (buf[0] == 0xff && buf[1] == 0x1f &&
+ buf[2] == 0x00 && buf[3] == 0xe8 &&
+ (buf[4] & 0xf0) == 0xf0 && buf[5] == 0x07)
+ {
+ int frame_size;
+ dts_bitstream_init (state, buf, 0, 0);
+ frame_size = syncinfo (state, flags, sample_rate,
+ bit_rate, frame_length);
+ return frame_size;
+ }
+
+ /* 14 bits and big endian bitstream */
+ if (buf[0] == 0x1f && buf[1] == 0xff &&
+ buf[2] == 0xe8 && buf[3] == 0x00 &&
+ buf[4] == 0x07 && (buf[5] & 0xf0) == 0xf0)
+ {
+ int frame_size;
+ dts_bitstream_init (state, buf, 0, 1);
+ frame_size = syncinfo (state, flags, sample_rate,
+ bit_rate, frame_length);
+ return frame_size;
+ }
+
+ /* 16 bits and little endian bitstream */
+ if (buf[0] == 0xfe && buf[1] == 0x7f &&
+ buf[2] == 0x01 && buf[3] == 0x80)
+ {
+ int frame_size;
+ dts_bitstream_init (state, buf, 1, 0);
+ frame_size = syncinfo (state, flags, sample_rate,
+ bit_rate, frame_length);
+ return frame_size;
+ }
+
+ /* 16 bits and big endian bitstream */
+ if (buf[0] == 0x7f && buf[1] == 0xfe &&
+ buf[2] == 0x80 && buf[3] == 0x01)
+ {
+ int frame_size;
+ dts_bitstream_init (state, buf, 1, 1);
+ frame_size = syncinfo (state, flags, sample_rate,
+ bit_rate, frame_length);
+ return frame_size;
+ }
+
+ return 0;
+}
+
+int dts_frame (dts_state_t * state, uint8_t * buf, int * flags,
+ level_t * level, sample_t bias)
+{
+ int i, j;
+ static float adj_table[] = { 1.0, 1.1250, 1.2500, 1.4375 };
+
+ dts_bitstream_init (state, buf, state->word_mode, state->bigendian_mode);
+
+ /* Sync code */
+ bitstream_get (state, 32);
+
+ /* Frame header */
+ state->frame_type = bitstream_get (state, 1);
+ state->samples_deficit = bitstream_get (state, 5) + 1;
+ state->crc_present = bitstream_get (state, 1);
+ state->sample_blocks = bitstream_get (state, 7) + 1;
+ state->frame_size = bitstream_get (state, 14) + 1;
+ state->amode = bitstream_get (state, 6);
+ state->sample_rate = bitstream_get (state, 4);
+ state->bit_rate = bitstream_get (state, 5);
+
+ state->downmix = bitstream_get (state, 1);
+ state->dynrange = bitstream_get (state, 1);
+ state->timestamp = bitstream_get (state, 1);
+ state->aux_data = bitstream_get (state, 1);
+ state->hdcd = bitstream_get (state, 1);
+ state->ext_descr = bitstream_get (state, 3);
+ state->ext_coding = bitstream_get (state, 1);
+ state->aspf = bitstream_get (state, 1);
+ state->lfe = bitstream_get (state, 2);
+ state->predictor_history = bitstream_get (state, 1);
+
+ /* TODO: check CRC */
+ if (state->crc_present) state->header_crc = bitstream_get (state, 16);
+
+ state->multirate_inter = bitstream_get (state, 1);
+ state->version = bitstream_get (state, 4);
+ state->copy_history = bitstream_get (state, 2);
+ state->source_pcm_res = bitstream_get (state, 3);
+ state->front_sum = bitstream_get (state, 1);
+ state->surround_sum = bitstream_get (state, 1);
+ state->dialog_norm = bitstream_get (state, 4);
+
+ /* FIME: channels mixing levels */
+ state->clev = state->slev = 1;
+ state->output = dts_downmix_init (state->amode, *flags, level,
+ state->clev, state->slev);
+ if (state->output < 0)
+ return 1;
+
+ if (state->lfe && (*flags & DTS_LFE))
+ state->output |= DTS_LFE;
+
+ *flags = state->output;
+
+ state->dynrng = state->level = MUL_C (*level, 2);
+ state->bias = bias;
+ state->dynrnge = 1;
+ state->dynrngcall = NULL;
+
+#ifdef DEBUG
+ fprintf (stderr, "frame type: %i\n", state->frame_type);
+ fprintf (stderr, "samples deficit: %i\n", state->samples_deficit);
+ fprintf (stderr, "crc present: %i\n", state->crc_present);
+ fprintf (stderr, "sample blocks: %i (%i samples)\n",
+ state->sample_blocks, state->sample_blocks * 32);
+ fprintf (stderr, "frame size: %i bytes\n", state->frame_size);
+ fprintf (stderr, "amode: %i (%i channels)\n",
+ state->amode, dts_channels[state->amode]);
+ fprintf (stderr, "sample rate: %i (%i Hz)\n",
+ state->sample_rate, dts_sample_rates[state->sample_rate]);
+ fprintf (stderr, "bit rate: %i (%i bits/s)\n",
+ state->bit_rate, dts_bit_rates[state->bit_rate]);
+ fprintf (stderr, "downmix: %i\n", state->downmix);
+ fprintf (stderr, "dynrange: %i\n", state->dynrange);
+ fprintf (stderr, "timestamp: %i\n", state->timestamp);
+ fprintf (stderr, "aux_data: %i\n", state->aux_data);
+ fprintf (stderr, "hdcd: %i\n", state->hdcd);
+ fprintf (stderr, "ext descr: %i\n", state->ext_descr);
+ fprintf (stderr, "ext coding: %i\n", state->ext_coding);
+ fprintf (stderr, "aspf: %i\n", state->aspf);
+ fprintf (stderr, "lfe: %i\n", state->lfe);
+ fprintf (stderr, "predictor history: %i\n", state->predictor_history);
+ fprintf (stderr, "header crc: %i\n", state->header_crc);
+ fprintf (stderr, "multirate inter: %i\n", state->multirate_inter);
+ fprintf (stderr, "version number: %i\n", state->version);
+ fprintf (stderr, "copy history: %i\n", state->copy_history);
+ fprintf (stderr, "source pcm resolution: %i (%i bits/sample)\n",
+ state->source_pcm_res,
+ dts_bits_per_sample[state->source_pcm_res]);
+ fprintf (stderr, "front sum: %i\n", state->front_sum);
+ fprintf (stderr, "surround sum: %i\n", state->surround_sum);
+ fprintf (stderr, "dialog norm: %i\n", state->dialog_norm);
+ fprintf (stderr, "\n");
+#endif
+
+ /* Primary audio coding header */
+ state->subframes = bitstream_get (state, 4) + 1;
+ state->prim_channels = bitstream_get (state, 3) + 1;
+
+#ifdef DEBUG
+ fprintf (stderr, "subframes: %i\n", state->subframes);
+ fprintf (stderr, "prim channels: %i\n", state->prim_channels);
+#endif
+
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ state->subband_activity[i] = bitstream_get (state, 5) + 2;
+#ifdef DEBUG
+ fprintf (stderr, "subband activity: %i\n", state->subband_activity[i]);
+#endif
+ if (state->subband_activity[i] > DTS_SUBBANDS)
+ state->subband_activity[i] = DTS_SUBBANDS;
+ }
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ state->vq_start_subband[i] = bitstream_get (state, 5) + 1;
+#ifdef DEBUG
+ fprintf (stderr, "vq start subband: %i\n", state->vq_start_subband[i]);
+#endif
+ if (state->vq_start_subband[i] > DTS_SUBBANDS)
+ state->vq_start_subband[i] = DTS_SUBBANDS;
+ }
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ state->joint_intensity[i] = bitstream_get (state, 3);
+#ifdef DEBUG
+ fprintf (stderr, "joint intensity: %i\n", state->joint_intensity[i]);
+ if (state->joint_intensity[i]) {fprintf (stderr, "JOINTINTENSITY\n");}
+#endif
+ }
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ state->transient_huffman[i] = bitstream_get (state, 2);
+#ifdef DEBUG
+ fprintf (stderr, "transient mode codebook: %i\n",
+ state->transient_huffman[i]);
+#endif
+ }
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ state->scalefactor_huffman[i] = bitstream_get (state, 3);
+#ifdef DEBUG
+ fprintf (stderr, "scale factor codebook: %i\n",
+ state->scalefactor_huffman[i]);
+#endif
+ }
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ state->bitalloc_huffman[i] = bitstream_get (state, 3);
+ /* if (state->bitalloc_huffman[i] == 7) bailout */
+#ifdef DEBUG
+ fprintf (stderr, "bit allocation quantizer: %i\n",
+ state->bitalloc_huffman[i]);
+#endif
+ }
+
+ /* Get codebooks quantization indexes */
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ state->quant_index_huffman[i][0] = 0; /* Not transmitted */
+ state->quant_index_huffman[i][1] = bitstream_get (state, 1);
+ }
+ for (j = 2; j < 6; j++)
+ for (i = 0; i < state->prim_channels; i++)
+ state->quant_index_huffman[i][j] = bitstream_get (state, 2);
+ for (j = 6; j < 11; j++)
+ for (i = 0; i < state->prim_channels; i++)
+ state->quant_index_huffman[i][j] = bitstream_get (state, 3);
+ for (j = 11; j < 27; j++)
+ for (i = 0; i < state->prim_channels; i++)
+ state->quant_index_huffman[i][j] = 0; /* Not transmitted */
+
+#ifdef DEBUG
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ fprintf( stderr, "quant index huff:" );
+ for (j = 0; j < 11; j++)
+ fprintf (stderr, " %i", state->quant_index_huffman[i][j]);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+ /* Get scale factor adjustment */
+ for (j = 0; j < 11; j++)
+ {
+ for (i = 0; i < state->prim_channels; i++)
+ state->scalefactor_adj[i][j] = 1;
+ }
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ if (state->quant_index_huffman[i][1] == 0)
+ {
+ /* Transmitted only if quant_index_huffman=0 (Huffman code used) */
+ state->scalefactor_adj[i][1] = adj_table[bitstream_get (state, 2)];
+ }
+ }
+ for (j = 2; j < 6; j++)
+ for (i = 0; i < state->prim_channels; i++)
+ if (state->quant_index_huffman[i][j] < 3)
+ {
+ /* Transmitted only if quant_index_huffman < 3 */
+ state->scalefactor_adj[i][j] =
+ adj_table[bitstream_get (state, 2)];
+ }
+ for (j = 6; j < 11; j++)
+ for (i = 0; i < state->prim_channels; i++)
+ if (state->quant_index_huffman[i][j] < 7)
+ {
+ /* Transmitted only if quant_index_huffman < 7 */
+ state->scalefactor_adj[i][j] =
+ adj_table[bitstream_get (state, 2)];
+ }
+
+#ifdef DEBUG
+ for (i = 0; i < state->prim_channels; i++)
+ {
+ fprintf (stderr, "scalefac adj:");
+ for (j = 0; j < 11; j++)
+ fprintf (stderr, " %1.3f", state->scalefactor_adj[i][j]);
+ fprintf (stderr, "\n");
+ }
+#endif
+
+ if (state->crc_present)
+ {
+ /* Audio header CRC check */
+ bitstream_get (state, 16);
+ }
+
+ state->current_subframe = 0;
+ state->current_subsubframe = 0;
+
+ return 0;
+}
+
+int dts_subframe_header (dts_state_t * state)
+{
+ /* Primary audio coding side information */
+ int j, k;
+
+ /* Subsubframe count */
+ state->subsubframes = bitstream_get (state, 2) + 1;
+#ifdef DEBUG
+ fprintf (stderr, "subsubframes: %i\n", state->subsubframes);
+#endif
+
+ /* Partial subsubframe sample count */
+ state->partial_samples = bitstream_get (state, 3);
+#ifdef DEBUG
+ fprintf (stderr, "partial samples: %i\n", state->partial_samples);
+#endif
+
+ /* Get prediction mode for each subband */
+ for (j = 0; j < state->prim_channels; j++)
+ {
+ for (k = 0; k < state->subband_activity[j]; k++)
+ state->prediction_mode[j][k] = bitstream_get (state, 1);
+#ifdef DEBUG
+ fprintf (stderr, "prediction mode:");
+ for (k = 0; k < state->subband_activity[j]; k++)
+ fprintf (stderr, " %i", state->prediction_mode[j][k]);
+ fprintf (stderr, "\n");
+#endif
+ }
+
+ /* Get prediction codebook */
+ for (j = 0; j < state->prim_channels; j++)
+ {
+ for (k = 0; k < state->subband_activity[j]; k++)
+ {
+ if (state->prediction_mode[j][k] > 0)
+ {
+ /* (Prediction coefficient VQ address) */
+ state->prediction_vq[j][k] = bitstream_get (state, 12);
+#ifdef DEBUG
+ fprintf (stderr, "prediction coefs: %f, %f, %f, %f\n",
+ (double)adpcm_vb[state->prediction_vq[j][k]][0]/8192,
+ (double)adpcm_vb[state->prediction_vq[j][k]][1]/8192,
+ (double)adpcm_vb[state->prediction_vq[j][k]][2]/8192,
+ (double)adpcm_vb[state->prediction_vq[j][k]][3]/8192);
+#endif
+ }
+ }
+ }
+
+ /* Bit allocation index */
+ for (j = 0; j < state->prim_channels; j++)
+ {
+ for (k = 0; k < state->vq_start_subband[j]; k++)
+ {
+ if (state->bitalloc_huffman[j] == 6)
+ state->bitalloc[j][k] = bitstream_get (state, 5);
+ else if (state->bitalloc_huffman[j] == 5)
+ state->bitalloc[j][k] = bitstream_get (state, 4);
+ else
+ {
+ state->bitalloc[j][k] = InverseQ (state,
+ bitalloc_12[state->bitalloc_huffman[j]]);
+ }
+
+ if (state->bitalloc[j][k] > 26)
+ {
+ fprintf (stderr, "bitalloc index [%i][%i] too big (%i)\n",
+ j, k, state->bitalloc[j][k]);
+ return -1;
+ }
+ }
+
+#ifdef DEBUG
+ fprintf (stderr, "bitalloc index: ");
+ for (k = 0; k < state->vq_start_subband[j]; k++)
+ fprintf (stderr, "%2.2i ", state->bitalloc[j][k]);
+ fprintf (stderr, "\n");
+#endif
+ }
+
+ /* Transition mode */
+ for (j = 0; j < state->prim_channels; j++)
+ {
+ for (k = 0; k < state->subband_activity[j]; k++)
+ {
+ state->transition_mode[j][k] = 0;
+ if (state->subsubframes > 1 &&
+ k < state->vq_start_subband[j] &&
+ state->bitalloc[j][k] > 0)
+ {
+ state->transition_mode[j][k] = InverseQ (state,
+ tmode[state->transient_huffman[j]]);
+ }
+ }
+#ifdef DEBUG
+ fprintf (stderr, "Transition mode:");
+ for (k = 0; k < state->subband_activity[j]; k++)
+ fprintf (stderr, " %i", state->transition_mode[j][k]);
+ fprintf (stderr, "\n");
+#endif
+ }
+
+ /* Scale factors */
+ for (j = 0; j < state->prim_channels; j++)
+ {
+ int *scale_table;
+ int scale_sum;
+
+ for (k = 0; k < state->subband_activity[j]; k++)
+ {
+ state->scale_factor[j][k][0] = 0;
+ state->scale_factor[j][k][1] = 0;
+ }
+
+ if (state->scalefactor_huffman[j] == 6)
+ scale_table = scale_factor_quant7;
+ else
+ scale_table = scale_factor_quant6;
+
+ /* When huffman coded, only the difference is encoded */
+ scale_sum = 0;
+
+ for (k = 0; k < state->subband_activity[j]; k++)
+ {
+ if (k >= state->vq_start_subband[j] || state->bitalloc[j][k] > 0)
+ {
+ if (state->scalefactor_huffman[j] < 5)
+ {
+ /* huffman encoded */
+ scale_sum += InverseQ (state,
+ scales_129[state->scalefactor_huffman[j]]);
+ }
+ else if (state->scalefactor_huffman[j] == 5)
+ {
+ scale_sum = bitstream_get (state, 6);
+ }
+ else if (state->scalefactor_huffman[j] == 6)
+ {
+ scale_sum = bitstream_get (state, 7);
+ }
+
+ state->scale_factor[j][k][0] = scale_table[scale_sum];
+ }
+
+ if (k < state->vq_start_subband[j] && state->transition_mode[j][k])
+ {
+ /* Get second scale factor */
+ if (state->scalefactor_huffman[j] < 5)
+ {
+ /* huffman encoded */
+ scale_sum += InverseQ (state,
+ scales_129[state->scalefactor_huffman[j]]);
+ }
+ else if (state->scalefactor_huffman[j] == 5)
+ {
+ scale_sum = bitstream_get (state, 6);
+ }
+ else if (state->scalefactor_huffman[j] == 6)
+ {
+ scale_sum = bitstream_get (state, 7);
+ }
+
+ state->scale_factor[j][k][1] = scale_table[scale_sum];
+ }
+ }
+
+#ifdef DEBUG
+ fprintf (stderr, "Scale factor:");
+ for (k = 0; k < state->subband_activity[j]; k++)
+ {
+ if (k >= state->vq_start_subband[j] || state->bitalloc[j][k] > 0)
+ fprintf (stderr, " %i", state->scale_factor[j][k][0]);
+ if (k < state->vq_start_subband[j] && state->transition_mode[j][k])
+ fprintf (stderr, " %i(t)", state->scale_factor[j][k][1]);
+ }
+ fprintf (stderr, "\n");
+#endif
+ }
+
+ /* Joint subband scale factor codebook select */
+ for (j = 0; j < state->prim_channels; j++)
+ {
+ /* Transmitted only if joint subband coding enabled */
+ if (state->joint_intensity[j] > 0)
+ state->joint_huff[j] = bitstream_get (state, 3);
+ }
+
+ /* Scale factors for joint subband coding */
+ for (j = 0; j < state->prim_channels; j++)
+ {
+ int source_channel;
+
+ /* Transmitted only if joint subband coding enabled */
+ if (state->joint_intensity[j] > 0)
+ {
+ int scale = 0;
+ source_channel = state->joint_intensity[j] - 1;
+
+ /* When huffman coded, only the difference is encoded
+ * (is this valid as well for joint scales ???) */
+
+ for (k = state->subband_activity[j];
+ k < state->subband_activity[source_channel]; k++)
+ {
+ if (state->joint_huff[j] < 5)
+ {
+ /* huffman encoded */
+ scale = InverseQ (state,
+ scales_129[state->joint_huff[j]]);
+ }
+ else if (state->joint_huff[j] == 5)
+ {
+ scale = bitstream_get (state, 6);
+ }
+ else if (state->joint_huff[j] == 6)
+ {
+ scale = bitstream_get (state, 7);
+ }
+
+ scale += 64; /* bias */
+ state->joint_scale_factor[j][k] = scale;/*joint_scale_table[scale];*/
+ }
+
+ if (!state->debug_flag & 0x02)
+ {
+ fprintf (stderr, "Joint stereo coding not supported\n");
+ state->debug_flag |= 0x02;
+ }
+
+#ifdef DEBUG
+ fprintf (stderr, "Joint scale factor index:\n");
+ for (k = state->subband_activity[j];
+ k < state->subband_activity[source_channel]; k++)
+ fprintf (stderr, " %i", state->joint_scale_factor[j][k]);
+ fprintf (stderr, "\n");
+#endif
+ }
+ }
+
+ /* Stereo downmix coefficients */
+ if (state->prim_channels > 2 && state->downmix)
+ {
+ for (j = 0; j < state->prim_channels; j++)
+ {
+ state->downmix_coef[j][0] = bitstream_get (state, 7);
+ state->downmix_coef[j][1] = bitstream_get (state, 7);
+ }
+ }
+
+ /* Dynamic range coefficient */
+ if (state->dynrange) state->dynrange_coef = bitstream_get (state, 8);
+
+ /* Side information CRC check word */
+ if (state->crc_present)
+ {
+ bitstream_get (state, 16);
+ }
+
+ /*
+ * Primary audio data arrays
+ */
+
+ /* VQ encoded high frequency subbands */
+ for (j = 0; j < state->prim_channels; j++)
+ {
+ for (k = state->vq_start_subband[j];
+ k < state->subband_activity[j]; k++)
+ {
+ /* 1 vector -> 32 samples */
+ state->high_freq_vq[j][k] = bitstream_get (state, 10);
+
+#ifdef DEBUG
+ fprintf( stderr, "VQ index: %i\n", state->high_freq_vq[j][k] );
+#endif
+ }
+ }
+
+ /* Low frequency effect data */
+ if (state->lfe)
+ {
+ /* LFE samples */
+ int lfe_samples = 2 * state->lfe * state->subsubframes;
+ double lfe_scale;
+
+ for (j = lfe_samples; j < lfe_samples * 2; j++)
+ {
+ /* Signed 8 bits int */
+ state->lfe_data[j] =
+ (signed int)(signed char)bitstream_get (state, 8);
+ }
+
+ /* Scale factor index */
+ state->lfe_scale_factor =
+ scale_factor_quant7[bitstream_get (state, 8)];
+
+ /* Quantization step size * scale factor */
+ lfe_scale = 0.035 * state->lfe_scale_factor;
+
+ for (j = lfe_samples; j < lfe_samples * 2; j++)
+ state->lfe_data[j] *= lfe_scale;
+
+#ifdef DEBUG
+ fprintf (stderr, "LFE samples:\n");
+ for (j = lfe_samples; j < lfe_samples * 2; j++)
+ fprintf (stderr, " %f", state->lfe_data[j]);
+ fprintf (stderr, "\n");
+#endif
+
+ }
+
+ return 0;
+}
+
+int dts_subsubframe (dts_state_t * state)
+{
+ int k, l;
+ int subsubframe = state->current_subsubframe;
+
+ double *quant_step_table;
+
+ /* FIXME */
+ double subband_samples[DTS_PRIM_CHANNELS_MAX][DTS_SUBBANDS][8];
+
+ /*
+ * Audio data
+ */
+
+ /* Select quantization step size table */
+ if (state->bit_rate == 0x1f)
+ quant_step_table = lossless_quant_d;
+ else
+ quant_step_table = lossy_quant_d;
+
+ for (k = 0; k < state->prim_channels; k++)
+ {
+ for (l = 0; l < state->vq_start_subband[k] ; l++)
+ {
+ int m;
+
+ /* Select the mid-tread linear quantizer */
+ int abits = state->bitalloc[k][l];
+
+ double quant_step_size = quant_step_table[abits];
+ double rscale;
+
+ /*
+ * Determine quantization index code book and its type
+ */
+
+ /* Select quantization index code book */
+ int sel = state->quant_index_huffman[k][abits];
+
+ /* Determine its type */
+ int q_type = 1; /* (Assume Huffman type by default) */
+ if (abits >= 11 || !bitalloc_select[abits][sel])
+ {
+ /* Not Huffman type */
+ if (abits <= 7) q_type = 3; /* Block code */
+ else q_type = 2; /* No further encoding */
+ }
+
+ if (abits == 0) q_type = 0; /* No bits allocated */
+
+ /*
+ * Extract bits from the bit stream
+ */
+ switch (q_type)
+ {
+ case 0: /* No bits allocated */
+ for (m=0; m<8; m++)
+ subband_samples[k][l][m] = 0;
+ break;
+
+ case 1: /* Huffman code */
+ for (m=0; m<8; m++)
+ subband_samples[k][l][m] =
+ InverseQ (state, bitalloc_select[abits][sel]);
+ break;
+
+ case 2: /* No further encoding */
+ for (m=0; m<8; m++)
+ {
+ /* Extract (signed) quantization index */
+ int q_index = bitstream_get (state, abits - 3);
+ if( q_index & (1 << (abits - 4)) )
+ {
+ q_index = (1 << (abits - 3)) - q_index;
+ q_index = -q_index;
+ }
+ subband_samples[k][l][m] = q_index;
+ }
+ break;
+
+ case 3: /* Block code */
+ {
+ int block_code1, block_code2, size, levels;
+ int block[8];
+
+ switch (abits)
+ {
+ case 1:
+ size = 7;
+ levels = 3;
+ break;
+ case 2:
+ size = 10;
+ levels = 5;
+ break;
+ case 3:
+ size = 12;
+ levels = 7;
+ break;
+ case 4:
+ size = 13;
+ levels = 9;
+ break;
+ case 5:
+ size = 15;
+ levels = 13;
+ break;
+ case 6:
+ size = 17;
+ levels = 17;
+ break;
+ case 7:
+ default:
+ size = 19;
+ levels = 25;
+ break;
+ }
+
+ block_code1 = bitstream_get (state, size);
+ /* Should test return value */
+ decode_blockcode (block_code1, levels, block);
+ block_code2 = bitstream_get (state, size);
+ decode_blockcode (block_code2, levels, &block[4]);
+ for (m=0; m<8; m++)
+ subband_samples[k][l][m] = block[m];
+
+ }
+ break;
+
+ default: /* Undefined */
+ fprintf (stderr, "Unknown quantization index codebook");
+ return -1;
+ }
+
+ /*
+ * Account for quantization step and scale factor
+ */
+
+ /* Deal with transients */
+ if (state->transition_mode[k][l] &&
+ subsubframe >= state->transition_mode[k][l])
+ rscale = quant_step_size * state->scale_factor[k][l][1];
+ else
+ rscale = quant_step_size * state->scale_factor[k][l][0];
+
+ /* Adjustment */
+ rscale *= state->scalefactor_adj[k][sel];
+ for (m=0; m<8; m++) subband_samples[k][l][m] *= rscale;
+
+ /*
+ * Inverse ADPCM if in prediction mode
+ */
+ if (state->prediction_mode[k][l])
+ {
+ int n;
+ for (m=0; m<8; m++)
+ {
+ for (n=1; n<=4; n++)
+ if (m-n >= 0)
+ subband_samples[k][l][m] +=
+ (adpcm_vb[state->prediction_vq[k][l]][n-1] *
+ subband_samples[k][l][m-n]/8192);
+ else if (state->predictor_history)
+ subband_samples[k][l][m] +=
+ (adpcm_vb[state->prediction_vq[k][l]][n-1] *
+ state->subband_samples_hist[k][l][m-n+4]/8192);
+ }
+ }
+ }
+
+ /*
+ * Decode VQ encoded high frequencies
+ */
+ for (l = state->vq_start_subband[k];
+ l < state->subband_activity[k]; l++)
+ {
+ /* 1 vector -> 32 samples but we only need the 8 samples
+ * for this subsubframe. */
+ int m;
+
+ if (!state->debug_flag & 0x01)
+ {
+ fprintf (stderr, "Stream with high frequencies VQ coding\n");
+ state->debug_flag |= 0x01;
+ }
+
+ for (m=0; m<8; m++)
+ {
+ subband_samples[k][l][m] =
+ high_freq_vq[state->high_freq_vq[k][l]][subsubframe*8+m]
+ * (double)state->scale_factor[k][l][0] / 16.0;
+ }
+ }
+ }
+
+ /* Check for DSYNC after subsubframe */
+ if (state->aspf || subsubframe == state->subsubframes - 1)
+ {
+ if (0xFFFF == bitstream_get (state, 16)) /* 0xFFFF */
+ {
+#ifdef DEBUG
+ fprintf( stderr, "Got subframe DSYNC\n" );
+#endif
+ }
+ else
+ {
+ fprintf( stderr, "Didn't get subframe DSYNC\n" );
+ }
+ }
+
+ /* Backup predictor history for adpcm */
+ for (k = 0; k < state->prim_channels; k++)
+ {
+ for (l = 0; l < state->vq_start_subband[k] ; l++)
+ {
+ int m;
+ for (m = 0; m < 4; m++)
+ state->subband_samples_hist[k][l][m] =
+ subband_samples[k][l][4+m];
+ }
+ }
+
+ /* 32 subbands QMF */
+ for (k = 0; k < state->prim_channels; k++)
+ {
+ static double pcm_to_float[8] =
+ {32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};
+
+ qmf_32_subbands (state, k,
+ subband_samples[k],
+ &state->samples[256*k],
+ /*WTF ???*/ 32768.0*3/2/*pcm_to_float[state->source_pcm_res]*/,
+ 0/*state->bias*/);
+ }
+
+ /* Down/Up mixing */
+ if (state->prim_channels < dts_channels[state->output & DTS_CHANNEL_MASK])
+ {
+ dts_upmix (state->samples, state->amode, state->output);
+ } else
+ if (state->prim_channels > dts_channels[state->output & DTS_CHANNEL_MASK])
+ {
+ dts_downmix (state->samples, state->amode, state->output, state->bias,
+ state->clev, state->slev);
+ }
+
+ /* Generate LFE samples for this subsubframe FIXME!!! */
+ if (state->output & DTS_LFE)
+ {
+ int lfe_samples = 2 * state->lfe * state->subsubframes;
+ int i_channels = dts_channels[state->output & DTS_CHANNEL_MASK];
+
+ lfe_interpolation_fir (state->lfe, 2 * state->lfe,
+ state->lfe_data + lfe_samples +
+ 2 * state->lfe * subsubframe,
+ &state->samples[256*i_channels],
+ 8388608.0, state->bias);
+ /* Outputs 20bits pcm samples */
+ }
+
+ return 0;
+}
+
+int dts_subframe_footer (dts_state_t * state)
+{
+ int aux_data_count = 0, i;
+ int lfe_samples;
+
+ /*
+ * Unpack optional information
+ */
+
+ /* Time code stamp */
+ if (state->timestamp) bitstream_get (state, 32);
+
+ /* Auxiliary data byte count */
+ if (state->aux_data) aux_data_count = bitstream_get (state, 6);
+
+ /* Auxiliary data bytes */
+ for(i = 0; i < aux_data_count; i++)
+ bitstream_get (state, 8);
+
+ /* Optional CRC check bytes */
+ if (state->crc_present && (state->downmix || state->dynrange))
+ bitstream_get (state, 16);
+
+ /* Backup LFE samples history */
+ lfe_samples = 2 * state->lfe * state->subsubframes;
+ for (i = 0; i < lfe_samples; i++)
+ {
+ state->lfe_data[i] = state->lfe_data[i+lfe_samples];
+ }
+
+#ifdef DEBUG
+ fprintf( stderr, "\n" );
+#endif
+
+ return 0;
+}
+
+int dts_block (dts_state_t * state)
+{
+ /* Sanity check */
+ if (state->current_subframe >= state->subframes)
+ {
+ fprintf (stderr, "check failed: %i>%i",
+ state->current_subframe, state->subframes);
+ return -1;
+ }
+
+ if (!state->current_subsubframe)
+ {
+#ifdef DEBUG
+ fprintf (stderr, "DSYNC dts_subframe_header\n");
+#endif
+ /* Read subframe header */
+ if (dts_subframe_header (state)) return -1;
+ }
+
+ /* Read subsubframe */
+#ifdef DEBUG
+ fprintf (stderr, "DSYNC dts_subsubframe\n");
+#endif
+ if (dts_subsubframe (state)) return -1;
+
+ /* Update state */
+ state->current_subsubframe++;
+ if (state->current_subsubframe >= state->subsubframes)
+ {
+ state->current_subsubframe = 0;
+ state->current_subframe++;
+ }
+ if (state->current_subframe >= state->subframes)
+ {
+#ifdef DEBUG
+ fprintf(stderr, "DSYNC dts_subframe_footer\n");
+#endif
+ /* Read subframe footer */
+ if (dts_subframe_footer (state)) return -1;
+ }
+
+ return 0;
+}
+
+/* Very compact version of the block code decoder that does not use table
+ * look-up but is slightly slower */
+int decode_blockcode( int code, int levels, int *values )
+{
+ int i;
+ int offset = (levels - 1) >> 1;
+
+ for (i = 0; i < 4; i++)
+ {
+ values[i] = (code % levels) - offset;
+ code /= levels;
+ }
+
+ if (code == 0)
+ return 1;
+ else
+ {
+ fprintf (stderr, "ERROR: block code look-up failed\n");
+ return 0;
+ }
+}
+
+static void pre_calc_cosmod( dts_state_t * state )
+{
+ int i, j, k;
+
+ for (j=0,k=0;k<16;k++)
+ for (i=0;i<16;i++)
+ state->cos_mod[j++] = cos((2*i+1)*(2*k+1)*M_PI/64);
+
+ for (k=0;k<16;k++)
+ for (i=0;i<16;i++)
+ state->cos_mod[j++] = cos((i)*(2*k+1)*M_PI/32);
+
+ for (k=0;k<16;k++)
+ state->cos_mod[j++] = 0.25/(2*cos((2*k+1)*M_PI/128));
+
+ for (k=0;k<16;k++)
+ state->cos_mod[j++] = -0.25/(2.0*sin((2*k+1)*M_PI/128));
+}
+
+static void qmf_32_subbands (dts_state_t * state, int chans,
+ double samples_in[32][8], sample_t *samples_out,
+ double scale, sample_t bias)
+{
+ double *prCoeff;
+ int i, j, k;
+ double raXin[32];
+
+ double *subband_fir_hist = state->subband_fir_hist[chans];
+ double *subband_fir_hist2 = state->subband_fir_noidea[chans];
+
+ int nChIndex = 0, NumSubband = 32, nStart = 0, nEnd = 8, nSubIndex;
+
+ /* Select filter */
+ if (!state->multirate_inter) /* Non-perfect reconstruction */
+ prCoeff = fir_32bands_nonperfect;
+ else /* Perfect reconstruction */
+ prCoeff = fir_32bands_perfect;
+
+ /* Reconstructed channel sample index */
+ for (nSubIndex=nStart; nSubIndex<nEnd; nSubIndex++)
+ {
+ double A[16], B[16], SUM[16], DIFF[16];
+
+ /* Load in one sample from each subband */
+ for (i=0; i<state->subband_activity[chans]; i++)
+ raXin[i] = samples_in[i][nSubIndex];
+
+ /* Clear inactive subbands */
+ for (i=state->subband_activity[chans]; i<NumSubband; i++)
+ raXin[i] = 0.0;
+
+ /* Multiply by cosine modulation coefficients and
+ * create temporary arrays SUM and DIFF */
+ for (j=0,k=0;k<16;k++)
+ {
+ A[k] = 0.0;
+ for (i=0;i<16;i++)
+ A[k]+=(raXin[2*i]+raXin[2*i+1])*state->cos_mod[j++];
+ }
+
+ for (k=0;k<16;k++)
+ {
+ B[k] = 0.0;
+ for (i=0;i<16;i++)
+ {
+ if(i>0) B[k]+=(raXin[2*i]+raXin[2*i-1])*state->cos_mod[j++];
+ else B[k]+=(raXin[2*i])*state->cos_mod[j++];
+ }
+ SUM[k]=A[k]+B[k];
+ DIFF[k]=A[k]-B[k];
+ }
+
+ /* Store history */
+ for (k=0;k<16;k++)
+ subband_fir_hist[k]=state->cos_mod[j++]*SUM[k];
+ for (k=0;k<16;k++)
+ subband_fir_hist[32-k-1]=state->cos_mod[j++]*DIFF[k];
+ /* Multiply by filter coefficients */
+ for (k=31,i=0;i<32;i++,k--)
+ for (j=0;j<512;j+=64)
+ subband_fir_hist2[i] += prCoeff[i+j]*
+ (subband_fir_hist[i+j] - subband_fir_hist[j+k]);
+ for (k=31,i=0;i<32;i++,k--)
+ for (j=0;j<512;j+=64)
+ subband_fir_hist2[32+i] += prCoeff[32+i+j]*
+ (-subband_fir_hist[i+j] - subband_fir_hist[j+k]);
+
+ /* Create 32 PCM output samples */
+ for (i=0;i<32;i++)
+ samples_out[nChIndex++] = subband_fir_hist2[i] / scale + bias;
+
+ /* Update working arrays */
+ for (i=511;i>=32;i--)
+ subband_fir_hist[i] = subband_fir_hist[i-32];
+ for (i=0;i<NumSubband;i++)
+ subband_fir_hist2[i] = subband_fir_hist2[i+32];
+ for (i=0;i<NumSubband;i++)
+ subband_fir_hist2[i+32] = 0.0;
+ }
+}
+
+static void lfe_interpolation_fir (int nDecimationSelect, int nNumDeciSample,
+ double *samples_in, sample_t *samples_out,
+ double scale, sample_t bias)
+{
+ /* samples_in: An array holding decimated samples.
+ * Samples in current subframe starts from samples_in[0],
+ * while samples_in[-1], samples_in[-2], ..., stores samples
+ * from last subframe as history.
+ *
+ * samples_out: An array holding interpolated samples
+ */
+
+ int nDeciFactor, k, J;
+ double *prCoeff;
+
+ int NumFIRCoef = 512; /* Number of FIR coefficients */
+ int nInterpIndex = 0; /* Index to the interpolated samples */
+ int nDeciIndex;
+
+ /* Select decimation filter */
+ if (nDecimationSelect==1)
+ {
+ /* 128 decimation */
+ nDeciFactor = 128;
+ /* Pointer to the FIR coefficients array */
+ prCoeff = lfe_fir_128;
+ } else {
+ /* 64 decimation */
+ nDeciFactor = 64;
+ prCoeff = lfe_fir_64;
+ }
+
+ /* Interpolation */
+ for (nDeciIndex=0; nDeciIndex<nNumDeciSample; nDeciIndex++)
+ {
+ /* One decimated sample generates nDeciFactor interpolated ones */
+ for (k=0; k<nDeciFactor; k++)
+ {
+ /* Clear accumulation */
+ double rTmp = 0.0;
+
+ /* Accumulate */
+ for (J=0; J<NumFIRCoef/nDeciFactor; J++)
+ rTmp += samples_in[nDeciIndex-J]*prCoeff[k+J*nDeciFactor];
+
+ /* Save interpolated samples */
+ samples_out[nInterpIndex++] = rTmp / scale + bias;
+ }
+ }
+}
+
+void dts_dynrng (dts_state_t * state,
+ level_t (* call) (level_t, void *), void * data)
+{
+ state->dynrange = 0;
+ if (call) {
+ state->dynrange = 1;
+ state->dynrngcall = call;
+ state->dynrngdata = data;
+ }
+}
+
+void dts_free (dts_state_t * state)
+{
+ free (state->samples);
+ free (state);
+}
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables.h
new file mode 100644
index 000000000..5d82857e6
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables.h
@@ -0,0 +1,47 @@
+/*
+ * tables.h
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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
+ */
+
+static const int dts_sample_rates[] =
+{
+ 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0,
+ 12000, 24000, 48000, 96000, 192000
+};
+
+static const int dts_bit_rates[] =
+{
+ 32000, 56000, 64000, 96000, 112000, 128000,
+ 192000, 224000, 256000, 320000, 384000,
+ 448000, 512000, 576000, 640000, 768000,
+ 896000, 1024000, 1152000, 1280000, 1344000,
+ 1408000, 1411200, 1472000, 1536000, 1920000,
+ 2048000, 3072000, 3840000, 1/*open*/, 2/*variable*/, 3/*lossless*/
+};
+
+static const uint8_t dts_channels[] =
+{
+ 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8
+};
+
+static uint8_t dts_bits_per_sample[] =
+{
+ 16, 16, 20, 20, 0, 24, 24
+};
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_adpcm.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_adpcm.h
new file mode 100644
index 000000000..a6b8f4ce5
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_adpcm.h
@@ -0,0 +1,4122 @@
+/*
+ * tables_adpcm.h
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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
+ */
+
+/* 16bits signed fractional Q13 binary codes */
+static int16_t adpcm_vb[4096][4] =
+{
+ { 9928, -2618, -1093, -1263 },
+ { 11077, -2876, -1747, -308 },
+ { 10503, -1082, -1426, -1167 },
+ { 9337, -2403, -1495, 274 },
+ { 10698, -2529, -532, -1122 },
+ { 10368, -3974, -1264, -750 },
+ { 10070, -3667, 346, 863 },
+ { 10278, -3093, 311, -576 },
+ { 9894, -1330, -1428, -860 },
+ { 10544, -1923, -1058, -971 },
+ { 10996, -1632, -841, -1404 },
+ { 11832, -3465, 1658, -1990 },
+ { 10852, -688, -2658, -499 },
+ { 10546, -1749, -147, -1733 },
+ { 10801, -1004, -708, -1453 },
+ { 10588, -441, -2113, -952 },
+ { 10141, -3331, -582, -1432 },
+ { 9608, -2590, 383, 258 },
+ { 11422, -3265, 229, -1544 },
+ { 10460, -1338, -713, -1568 },
+ { 10306, -1721, -1660, -603 },
+ { 9580, -1812, -1235, -1061 },
+ { 11471, -2285, -1617, -607 },
+ { 10081, -2225, -1408, -868 },
+ { 10715, -2624, -1367, -704 },
+ { 10616, -1871, -2770, -35 },
+ { 9352, -2340, -1024, -1566 },
+ { 11065, -1458, -1926, -735 },
+ { 11334, -2056, -1041, -1144 },
+ { 9825, -2048, -794, -1536 },
+ { 11850, -2695, -1123, -867 },
+ { 10654, -2226, -1891, -373 },
+ { 10024, -1557, -808, -1069 },
+ { 11142, -1266, -3238, 128 },
+ { 11729, -3282, -514, -1011 },
+ { 11402, -2094, -2335, -189 },
+ { 10195, -3658, 181, -1875 },
+ { 11431, -2626, -404, -1377 },
+ { 11001, -3868, -619, -1077 },
+ { 10894, -2559, 274, -1758 },
+ { 9633, -1482, -2253, -773 },
+ { 11245, -3321, 830, -1972 },
+ { 9768, -2701, -199, -1859 },
+ { 10500, -2042, 525, -2043 },
+ { 11669, -4069, 293, -1468 },
+ { 9192, -1991, -583, -61 },
+ { 10057, -3220, -2015, -473 },
+ { 9497, -2315, -2490, -467 },
+ { 10455, -3069, -1194, -1007 },
+ { 9994, -1936, -60, -1225 },
+ { 9295, -2156, -1761, -1134 },
+ { 10085, -3748, -1026, 197 },
+ { 9334, -2360, 804, -351 },
+ { 11561, -2553, 1352, -2313 },
+ { 12837, -3998, 1195, -1958 },
+ { 10114, -1100, -2414, -394 },
+ { 9341, -2530, 315, 755 },
+ { 10131, -3164, 1411, -674 },
+ { 9535, -905, -1551, 579 },
+ { 11717, -1519, -3051, 91 },
+ { 9824, -2911, -2775, 192 },
+ { 9662, -2934, -561, 1450 },
+ { 11085, -3392, -1298, -659 },
+ { 8955, -2102, -1899, 703 },
+ { 8607, -1742, -4348, 814 },
+ { 7640, -2063, -3617, 52 },
+ { 7074, -826, -4325, 4375 },
+ { 7714, 584, -4238, 1927 },
+ { 6355, -952, -4912, 3127 },
+ { 7069, -660, -6413, 4087 },
+ { 8313, -132, -2964, -876 },
+ { 6952, -1422, -3962, -24 },
+ { 9299, -734, -3088, -263 },
+ { 9484, -574, -4513, 466 },
+ { 7246, -91, -3735, -704 },
+ { 8325, -1417, -3090, -530 },
+ { 6469, -1226, -4757, 829 },
+ { 6652, -368, -5682, 1393 },
+ { 7971, -1278, -2284, 1205 },
+ { 7229, -699, -3556, 1840 },
+ { 7994, 1284, -2729, 732 },
+ { 9005, -698, -4522, 2189 },
+ { 6963, 197, -2727, 380 },
+ { 8527, 135, -3991, -213 },
+ { 8840, 934, -3014, -567 },
+ { 10125, 418, -3284, -371 },
+ { 6367, 361, -2318, 2554 },
+ { 7892, 172, -5247, 4673 },
+ { 6674, 387, -5424, 4398 },
+ { 6240, 684, -4047, 1219 },
+ { 11170, -794, -5081, 1195 },
+ { 11765, -648, -6265, 2052 },
+ { 10845, -775, -3837, 366 },
+ { 12496, -689, -8260, 3562 },
+ { 7893, -1166, -4972, 988 },
+ { 8592, 1052, -5986, 3087 },
+ { 7277, 1874, -5685, 3579 },
+ { 6900, 2016, -4809, 3491 },
+ { 8530, -2405, -3250, 1986 },
+ { 9426, 494, -7067, 5038 },
+ { 10285, 564, -8210, 5370 },
+ { 8749, -2207, -3980, 2852 },
+ { 9653, -2686, -4300, 1400 },
+ { 9770, -2286, -5663, 4233 },
+ { 8490, -4, -7048, 4496 },
+ { 7697, -1209, -5328, 3183 },
+ { 6451, 801, -4324, -554 },
+ { 7387, 1806, -5265, 545 },
+ { 7450, -2302, -4445, 1418 },
+ { 8817, -1370, -5827, 2168 },
+ { 10324, -2406, -5629, 2579 },
+ { 8863, -2578, -3537, 467 },
+ { 6901, -1624, -3169, 3392 },
+ { 7846, 156, -6948, 3381 },
+ { 7928, -1115, -5972, 4816 },
+ { 6089, -599, -4368, -320 },
+ { 7833, 1246, -3960, -621 },
+ { 8931, 2521, -6768, 2052 },
+ { 8900, 1944, -4126, 40 },
+ { 7661, -34, -2855, 2480 },
+ { 5873, 474, -3262, 3712 },
+ { 7535, -234, -4699, 216 },
+ { 5856, 143, -5142, 73 },
+ { 8944, -106, -5874, 3663 },
+ { 7134, 426, -5879, 2895 },
+ { 10199, 1011, -4762, 369 },
+ { 8454, 264, -5971, 1291 },
+ { 7822, -2449, -4333, 4540 },
+ { 6200, -2758, -2632, 1497 },
+ { 6070, -4315, -2699, 414 },
+ { 7047, -3739, -3210, 1060 },
+ { 5675, -3801, -2717, -407 },
+ { 4789, -4063, -2628, -744 },
+ { 4023, -3366, -3133, -726 },
+ { 4296, -2407, -3381, -513 },
+ { 4388, -2931, -2820, 1512 },
+ { 4559, -4233, -1941, 1976 },
+ { 6702, -3208, -1755, 1680 },
+ { 4416, -3521, -1052, 2984 },
+ { 7154, -4266, -1203, 3732 },
+ { 3625, -4242, -3244, 1395 },
+ { 6518, -2856, -1304, 2887 },
+ { 6170, -1949, -3014, 3973 },
+ { 5189, -2451, -4020, 3477 },
+ { 6218, -2988, -1921, 3844 },
+ { 4827, -3688, -1928, 3343 },
+ { 6668, -3991, -2805, 3095 },
+ { 5297, -3115, -3684, 2390 },
+ { 5354, -4614, -2662, 1504 },
+ { 4196, -3091, -4147, 1135 },
+ { 3540, -2893, -4007, 100 },
+ { 5569, -1602, -4007, 1909 },
+ { 4341, -2091, -4272, 252 },
+ { 5559, -2878, -3832, 498 },
+ { 4548, -4479, -2898, -27 },
+ { 5176, -2494, -4635, 1476 },
+ { 3294, -3485, -3738, 716 },
+ { 4920, -1229, -4195, -365 },
+ { 3257, -3518, -3349, 2862 },
+ { 5286, -1948, -3485, -778 },
+ { 6502, -3051, -152, 2854 },
+ { 5864, -4192, -1076, 3451 },
+ { 4656, -3122, -3448, 179 },
+ { 5907, -754, -1596, 3116 },
+ { 7229, -3680, -1590, 2892 },
+ { 5107, -3888, -3364, 806 },
+ { 6764, -2635, -3450, 134 },
+ { 5258, -2827, -2844, -1052 },
+ { 5798, -1725, -4305, 205 },
+ { 5404, -1213, -3362, 449 },
+ { 6224, -2738, -3046, -581 },
+ { 4223, -2438, -2725, 3745 },
+ { 4751, -3411, -2123, 116 },
+ { 3868, -3000, -3954, 2297 },
+ { 6819, -2899, -4277, 2825 },
+ { 4207, -4754, -2808, 865 },
+ { 4804, -1494, -1997, 4688 },
+ { 5282, -2213, -548, 3559 },
+ { 5580, -1912, -566, 4370 },
+ { 6168, -2857, -672, 4053 },
+ { 6583, -4515, -2850, 1670 },
+ { 6511, -3093, -3988, 1421 },
+ { 4646, -1790, -1443, 3650 },
+ { 5915, -924, -2020, 896 },
+ { 7814, -4181, -3152, 2007 },
+ { 6190, -2238, -4817, 2279 },
+ { 4737, -4034, -3288, 1835 },
+ { 8161, -3633, -3423, 3137 },
+ { 7415, -2351, -2088, 4290 },
+ { 4106, -2517, -62, 2905 },
+ { 4909, -3145, -614, 4112 },
+ { 4938, -3281, -397, 1100 },
+ { -173, 919, 1589, -5363 },
+ { -13, 796, -295, -6655 },
+ { -1860, -829, 1141, -4555 },
+ { 2298, -838, -664, -5005 },
+ { -884, -1097, 2074, -4613 },
+ { -101, 281, 2846, -4535 },
+ { 1166, 453, 2429, -5910 },
+ { 879, -664, 2370, -5452 },
+ { 1415, -370, -1699, -4727 },
+ { -1413, 1277, -669, -6649 },
+ { 2133, 304, -968, -4624 },
+ { 380, 586, -2087, -4892 },
+ { 1336, 275, -82, -5789 },
+ { -2459, 1057, -34, -5416 },
+ { 2278, -1758, 866, -5653 },
+ { 1945, -2295, -149, -5302 },
+ { 1287, -3525, 996, -5255 },
+ { 2297, 803, 1177, -6067 },
+ { 187, -180, -619, -6202 },
+ { -793, -2537, 1554, -5057 },
+ { -2703, -204, -629, -5853 },
+ { -1007, -146, 313, -5582 },
+ { 830, 357, 869, -6363 },
+ { -228, -575, -3177, -4433 },
+ { -1001, -1553, -142, -5708 },
+ { -1644, 1683, 1721, -4533 },
+ { 893, 1924, -15, -5791 },
+ { 2195, 2061, -262, -5471 },
+ { 3031, 270, 311, -5096 },
+ { 1912, 1638, -1523, -4677 },
+ { -3142, -55, 253, -4914 },
+ { 356, -1680, 343, -6123 },
+ { -2241, -1734, -976, -5939 },
+ { -2196, -2893, 547, -4938 },
+ { -1245, 126, -1916, -5419 },
+ { -249, -3755, -1422, -5594 },
+ { 575, -2683, -1926, -4566 },
+ { -762, 1885, 192, -5880 },
+ { -811, -2562, -1068, -6013 },
+ { -2264, -3086, -976, -4775 },
+ { 70, -1215, 2880, -4410 },
+ { 714, -3760, 2916, -4691 },
+ { -244, -3404, 1740, -4493 },
+ { 684, -5137, -328, -5608 },
+ { -529, -3825, -1786, -4535 },
+ { -713, -4743, -1118, -5546 },
+ { 2718, -3788, 1798, -5708 },
+ { -1639, -3679, -1564, -6095 },
+ { 1693, -2642, -1389, -4539 },
+ { 505, -1573, -1651, -4878 },
+ { -835, -2256, -1941, -5352 },
+ { 1464, -411, 1993, -6441 },
+ { 493, -3184, -145, -6148 },
+ { -1413, 499, -1617, -6479 },
+ { -294, 1722, -1419, -5725 },
+ { -2937, -1528, -175, -4624 },
+ { -594, -5911, -56, -6146 },
+ { -300, -4275, 1156, -5947 },
+ { 552, -2643, 2669, -3959 },
+ { 905, -4158, 1789, -5809 },
+ { 1336, -2009, 2108, -5903 },
+ { 1555, -3600, 1110, -6759 },
+ { -1294, -3464, 77, -6084 },
+ { -1139, -4006, -1270, -4181 },
+ { -5094, -3296, 1092, -2847 },
+ { -5503, -2883, 1984, -2067 },
+ { -4671, -4218, -1417, -4132 },
+ { -3763, -3818, 1262, -3082 },
+ { -5132, -3430, 2928, -728 },
+ { -5957, -2877, 1251, -2446 },
+ { -4425, -2319, -212, -4276 },
+ { -6201, -1993, 1774, -2182 },
+ { -5500, -3836, 2201, -1396 },
+ { -6934, -2334, 2366, -1293 },
+ { -6124, -4140, 1337, -1977 },
+ { -6553, -4186, 1756, -1325 },
+ { -5126, -1258, 744, -3656 },
+ { -5167, -1390, 1581, -2895 },
+ { -4525, -3398, 2429, -1865 },
+ { -4076, -3183, 2027, -2510 },
+ { -6191, -3274, 1838, -1814 },
+ { -4454, -2753, 2723, -1185 },
+ { -6655, -4797, 251, -2595 },
+ { -6332, -2232, 1832, 217 },
+ { -5869, -1698, 134, 340 },
+ { -6614, -1045, 2126, -1932 },
+ { -4859, -2107, 2010, -2435 },
+ { -6274, -1622, 2808, -1374 },
+ { -3119, -3209, 521, -3988 },
+ { -5676, -2082, -420, -2711 },
+ { -7073, -3623, 696, -2343 },
+ { -5986, -4224, 572, -2454 },
+ { -4340, -4521, 882, -2771 },
+ { -6178, -1933, 535, -1444 },
+ { -4923, -4163, 1744, -2066 },
+ { -6410, -1519, 1058, -2683 },
+ { -5077, -1185, 856, -2216 },
+ { -7091, -2444, 687, -2597 },
+ { -5284, -2165, 3239, -993 },
+ { -4763, -1497, 197, -3179 },
+ { -4128, -4958, -396, -3578 },
+ { -5054, -3878, -647, -2672 },
+ { -7005, -3348, 1679, -1579 },
+ { -5767, -1017, 2582, -1915 },
+ { -7069, -2787, 1331, -2070 },
+ { -5532, -2296, 706, -2950 },
+ { -5059, -3543, -821, -3637 },
+ { -6639, -1835, 1016, -696 },
+ { -5611, -5220, -694, -3371 },
+ { -5994, -2803, 2933, -729 },
+ { -5948, -619, 1596, -2676 },
+ { -5486, -4419, 153, -3265 },
+ { -4329, -3440, 1646, -1439 },
+ { -4083, -3978, 177, -3569 },
+ { -4289, -2599, 1224, -3075 },
+ { -5707, -3253, 1912, -759 },
+ { -6606, -3437, 2562, -571 },
+ { -5254, -2444, 769, -352 },
+ { -6545, -3154, 582, -1103 },
+ { -5328, -2241, 2566, -1775 },
+ { -7216, -1936, 1538, -1983 },
+ { -3730, -2451, 426, -3869 },
+ { -5110, -1385, 2031, -1169 },
+ { -6470, -2715, 269, -3123 },
+ { -5806, -2480, -97, -3832 },
+ { -3683, -4916, -490, -4330 },
+ { -6341, -2083, -669, -115 },
+ { -4913, -4079, -837, -4673 },
+ { -3274, -2497, 2334, -2652 },
+ { -1286, -1731, 2550, -3756 },
+ { -3375, -877, 926, -3977 },
+ { -2525, -2079, 2879, -2625 },
+ { -5308, -504, 3111, -1607 },
+ { -4904, 460, 4093, -1232 },
+ { -1993, 1616, 4656, -1913 },
+ { -3481, -1176, 3119, -2236 },
+ { -4132, -1502, 2339, -2545 },
+ { -2542, 1151, 3569, -2550 },
+ { -4381, 430, 3147, -2082 },
+ { -3888, 867, 3899, -1657 },
+ { -2861, 1290, 4202, -1979 },
+ { -3893, -253, 2363, -2764 },
+ { -1705, 688, 3827, -2923 },
+ { -2223, 2312, 3700, -3148 },
+ { -1986, -720, 5021, -795 },
+ { -3177, 242, 1952, -3352 },
+ { -1854, 1509, 2528, -3815 },
+ { -3173, 97, 5019, -706 },
+ { -2689, -145, 1375, -3915 },
+ { -4838, -385, 2488, -2427 },
+ { -4557, -355, 1603, -3060 },
+ { -3522, 1832, 3292, -2674 },
+ { -3769, 780, 2378, -2704 },
+ { -4323, -1932, 3414, -1169 },
+ { -2740, 1158, 2729, -3273 },
+ { -3647, 210, 1464, -2892 },
+ { -2342, -2097, 1513, -3727 },
+ { -4422, -1242, 3130, -1833 },
+ { -1308, -1039, 4290, -1875 },
+ { -1754, -2535, 3298, -2314 },
+ { -4102, -186, 4037, -1094 },
+ { -1008, 1570, 3290, 171 },
+ { -3322, -2621, 2791, -1536 },
+ { -2539, -2597, 3442, -1672 },
+ { -3411, -2015, 3670, -1174 },
+ { -2097, 730, 5581, -1399 },
+ { -1510, -74, 4820, -2004 },
+ { -4086, -868, 4425, -771 },
+ { -956, -986, 3640, -2925 },
+ { -2087, -1250, 3464, -2458 },
+ { -3308, -2411, 1334, -3667 },
+ { -2264, -389, 4004, -1854 },
+ { -680, 239, 4058, -3388 },
+ { -1357, 30, 2993, -3658 },
+ { -3601, -552, 1177, -1136 },
+ { -2641, 442, 4374, -1625 },
+ { -2525, 770, 1640, -3895 },
+ { -3172, -891, 3893, -1608 },
+ { -2996, 13, 3277, -2414 },
+ { -899, 1055, 4470, -2501 },
+ { -422, -584, 3475, -3787 },
+ { -1978, -593, 2566, -3415 },
+ { -3150, -1280, 2362, -3047 },
+ { -3592, 224, 1026, -3932 },
+ { -4840, -1189, 3633, -879 },
+ { -3952, -2255, 2916, -1826 },
+ { -1695, 28, 1810, -349 },
+ { -745, -2484, 3308, -3293 },
+ { -1016, 1563, 5365, -1823 },
+ { -2172, -1787, 4266, -1287 },
+ { -1241, -1951, 3982, -2413 },
+ { -2009, -2639, 2330, -3480 },
+ { 5105, -1618, -2588, -2015 },
+ { 6497, -1523, -3218, -910 },
+ { 6526, -2305, -2029, -1790 },
+ { 5289, -99, -3436, -400 },
+ { 5781, -1623, -1577, -2617 },
+ { 5259, -670, -3125, -1700 },
+ { 6343, -1256, -331, -3222 },
+ { 7967, -678, -2195, -1462 },
+ { 6119, -695, -2988, -1538 },
+ { 6108, 494, -3359, -1548 },
+ { 5067, 969, -2328, -2707 },
+ { 7595, -435, -1497, -2056 },
+ { 6929, -719, -2420, -1665 },
+ { 5190, 584, -2982, -2103 },
+ { 6106, -444, -1411, -2739 },
+ { 5584, 289, -1804, -2803 },
+ { 5276, 227, -1180, -3361 },
+ { 7544, -1525, -1834, -1725 },
+ { 5986, -1470, -2606, -1701 },
+ { 5096, -765, -1712, -3006 },
+ { 5423, -149, -3933, -1157 },
+ { 7651, 26, -2445, -1507 },
+ { 4745, -464, -1735, -2362 },
+ { 5352, -1011, -1094, -1999 },
+ { 6300, -672, -542, -1950 },
+ { 6675, -1020, -1318, -1059 },
+ { 7218, -2036, -603, -2462 },
+ { 7755, -1514, -2430, -1229 },
+ { 5041, 449, -1056, -2405 },
+ { 6710, -2277, -1344, -2284 },
+ { 6824, -1347, -2254, 251 },
+ { 6068, -1857, -983, -1316 },
+ { 5603, -2177, -2730, -1477 },
+ { 5838, -1059, -3604, -970 },
+ { 5076, -789, -335, -2413 },
+ { 6191, -1634, -2000, -2129 },
+ { 5092, -1292, -2543, -1034 },
+ { 5305, 435, -1710, -1850 },
+ { 6140, 561, -2176, -2380 },
+ { 6752, 348, -2496, -1890 },
+ { 6405, 273, -1098, -2778 },
+ { 6942, -1340, -496, -1381 },
+ { 5238, -687, -2454, -2349 },
+ { 6959, -882, -1833, -2061 },
+ { 6292, -253, -2125, -2199 },
+ { 5838, -574, -759, -3215 },
+ { 6954, -1484, -640, -2771 },
+ { 7498, -1706, -1210, -2154 },
+ { 6772, -1003, -1235, -2532 },
+ { 6014, 228, -2154, -1108 },
+ { 6943, -2178, -2644, -1122 },
+ { 7262, -763, -3056, -1090 },
+ { 6273, -1478, -1072, 177 },
+ { 4734, 425, -2912, 357 },
+ { 7129, 168, -1537, -2327 },
+ { 7204, -434, -746, -2660 },
+ { 6879, 57, -3087, -1310 },
+ { 4623, -610, -718, -3459 },
+ { 6565, -543, -1998, -339 },
+ { 4752, -277, -2066, -1405 },
+ { 7435, -1416, -1904, -505 },
+ { 4076, 150, -1222, -3556 },
+ { 7082, -28, -1456, -1174 },
+ { 5941, -446, -1326, -1158 },
+ { 3870, -1648, -2474, -2589 },
+ { 858, 37, -3387, -3721 },
+ { 3557, -1503, -1664, -3383 },
+ { 3336, -1972, -3079, -2216 },
+ { 3186, 60, -4185, -863 },
+ { 3456, -773, -3066, -2457 },
+ { 4131, -913, -2060, -2601 },
+ { 4431, -691, -4114, -972 },
+ { 3461, -334, -3680, -1751 },
+ { 2006, -459, -2214, -3827 },
+ { 1322, 32, -2816, -3203 },
+ { 4425, -1897, -2791, -1946 },
+ { 4504, 23, -3421, -1909 },
+ { 3090, -885, -2366, -3264 },
+ { 3209, -2363, -3730, -834 },
+ { 3312, -1471, -3641, -1579 },
+ { 4184, -1669, -3323, -1248 },
+ { 2190, -931, -3302, -2944 },
+ { 2947, -229, -4791, -1195 },
+ { 2020, -1626, -2700, -3125 },
+ { 2214, -326, -4352, -1683 },
+ { 3286, -2619, -2412, -2458 },
+ { 1000, -2571, -4129, -2158 },
+ { 2496, -2627, -3611, -1433 },
+ { 2043, -2191, -2167, -3827 },
+ { 2571, -2544, -1915, -3222 },
+ { 2022, -1501, -3856, -2165 },
+ { 2685, -1180, -1461, -4038 },
+ { 1610, -2313, -4391, -1173 },
+ { 2340, -2490, -4215, -516 },
+ { 1742, -2615, -3632, -2146 },
+ { 523, -1293, -4246, -2442 },
+ { 3725, -2723, -3014, -1576 },
+ { 3554, -1381, -4200, -824 },
+ { 1291, -1594, -4777, -1430 },
+ { 1452, 515, -2960, -3830 },
+ { 4264, -894, -3305, -1826 },
+ { 2606, -1452, -4522, -966 },
+ { 1196, -830, -4807, -1816 },
+ { 1054, -775, -2616, -4071 },
+ { 4206, 415, -4344, -1132 },
+ { 3044, 491, -4126, -1934 },
+ { 988, -901, -3353, -3443 },
+ { 1729, -3063, -2267, -3370 },
+ { 3915, 912, -2989, -2387 },
+ { 3781, 300, -2457, -3050 },
+ { 2712, 924, -1350, -1206 },
+ { 4230, 405, -2343, 665 },
+ { 1878, -873, -225, -29 },
+ { 3510, 56, -1334, -3420 },
+ { 2850, 1447, -2651, -3150 },
+ { 1510, -706, -4125, -2483 },
+ { 3115, 793, -1692, -3894 },
+ { 2667, 213, -2973, -2786 },
+ { 1184, -2384, -3051, -3173 },
+ { 2139, 796, -2079, -3697 },
+ { 1464, -1483, -3726, -2754 },
+ { 2407, -1148, -3915, -1569 },
+ { 2612, -1779, -3217, -2271 },
+ { 2406, -2870, -2937, -2496 },
+ { 2140, 126, -3646, -2758 },
+ { 2952, -1036, 268, -1423 },
+ { 93, -1931, -3841, -3535 },
+ { 389, -2953, -3383, -3343 },
+ { 8652, -5511, -1662, 565 },
+ { 7427, -2791, -2535, -842 },
+ { 8541, -4253, -1407, -988 },
+ { 8018, -3203, -2998, 105 },
+ { 7231, -3926, -958, 1308 },
+ { 7331, -3690, -363, 2586 },
+ { 6803, -3646, -2226, -903 },
+ { 8163, -2811, -477, -2235 },
+ { 9356, -3818, -1685, -684 },
+ { 8466, -2854, -302, -698 },
+ { 8458, -3224, 517, 279 },
+ { 8074, -2619, -1326, 2596 },
+ { 8779, -2761, -2527, -441 },
+ { 6533, -2887, -899, -696 },
+ { 7394, -2305, -1642, -120 },
+ { 8281, -3780, -22, 1305 },
+ { 9158, -4413, -779, 901 },
+ { 9031, -5240, -1109, 1678 },
+ { 8717, -3650, 410, -1075 },
+ { 7317, -3197, -818, -2264 },
+ { 7934, -2385, -1214, -1886 },
+ { 8256, -4441, -291, -587 },
+ { 7358, -3395, 1090, -270 },
+ { 9446, -4910, -1343, -473 },
+ { 8187, -4726, -808, 1166 },
+ { 7504, -3845, -47, 267 },
+ { 8029, -2146, -1283, -383 },
+ { 7461, -2705, -853, 783 },
+ { 9367, -3636, -645, -354 },
+ { 8955, -3473, -308, -1947 },
+ { 8676, -2683, -2099, 1485 },
+ { 7481, -3003, -871, -444 },
+ { 8015, -2839, -1673, 1175 },
+ { 6947, -4643, -1527, -1047 },
+ { 7622, -2575, -137, -960 },
+ { 9388, -4279, -707, -1322 },
+ { 8382, -5259, -1283, -565 },
+ { 6856, -4138, -1030, 630 },
+ { 8659, -2571, -1124, -1666 },
+ { 8763, -3807, -537, 2543 },
+ { 8049, -3578, -2186, -604 },
+ { 8272, -2351, -1985, -1214 },
+ { 6855, -3796, -1527, -1631 },
+ { 7178, -2896, -1600, -1756 },
+ { 7040, -2888, -89, -1586 },
+ { 6261, -3403, -264, 998 },
+ { 7756, -4699, -1543, -834 },
+ { 7682, -4622, -758, -1721 },
+ { 8839, -4232, -2932, 1959 },
+ { 9363, -4679, -1956, 39 },
+ { 7883, -3616, -1414, -1432 },
+ { 8828, -3188, -1356, -1312 },
+ { 7746, -3987, -121, -2424 },
+ { 9262, -3256, -693, 818 },
+ { 7670, -3420, -148, 3504 },
+ { 7344, -3183, 608, 1595 },
+ { 8976, -4139, -1848, 1304 },
+ { 6708, -4131, 33, -852 },
+ { 7840, -4429, -2275, 79 },
+ { 8980, -3858, -2838, 453 },
+ { 7815, -4604, -2563, 944 },
+ { 8372, -4422, -1783, 3071 },
+ { 8623, -5128, -1754, 2888 },
+ { 7462, -3281, 889, 920 },
+ { 8416, -59, -1320, -1825 },
+ { 7928, -1488, -414, -2499 },
+ { 8110, -977, -1047, -2042 },
+ { 8278, -687, -1597, -1550 },
+ { 7988, -174, -977, -2106 },
+ { 8609, -1547, -1628, -1527 },
+ { 9000, -1798, -946, -1761 },
+ { 8954, -872, -1404, -1594 },
+ { 8939, 466, -748, -1212 },
+ { 9549, -329, -177, -1360 },
+ { 9411, -18, -1126, -1568 },
+ { 8859, -782, -488, -1338 },
+ { 8955, -218, -43, -1209 },
+ { 9131, -69, -453, -1001 },
+ { 9069, -1519, -1091, -1199 },
+ { 9247, -1309, -566, -1146 },
+ { 8528, -1617, -287, -1313 },
+ { 7763, -745, -149, -2040 },
+ { 8294, -343, 257, -2633 },
+ { 10149, -893, -552, -1649 },
+ { 9398, -915, 218, -2042 },
+ { 9703, -1194, -675, -1592 },
+ { 9586, -700, -427, -1710 },
+ { 8930, 497, -1445, -1218 },
+ { 9285, -1323, -163, -1552 },
+ { 8431, -1289, -985, -1404 },
+ { 8965, -655, 653, -1483 },
+ { 9542, -1001, -951, -1128 },
+ { 9205, -647, -37, -882 },
+ { 8603, -56, 514, -1793 },
+ { 9300, -12, -1324, -567 },
+ { 8773, 238, -184, -1456 },
+ { 9941, -1306, -69, -1792 },
+ { 9360, 279, -376, -1919 },
+ { 9180, -285, 95, -2170 },
+ { 9922, -501, -970, -1570 },
+ { 8341, -1493, -856, -2092 },
+ { 8780, -981, -850, -1014 },
+ { 9721, -548, -1504, -1094 },
+ { 9973, -1493, 482, -2105 },
+ { 8707, -333, -1027, -1087 },
+ { 9098, -469, -315, -1723 },
+ { 8879, -1050, -661, -2020 },
+ { 8857, 602, -866, -1918 },
+ { 8945, -1025, -2154, -1071 },
+ { 8484, -1930, -468, -2179 },
+ { 9177, -1903, -224, -2112 },
+ { 8652, -137, -2097, -1214 },
+ { 9063, -973, -1405, -772 },
+ { 9328, -456, 662, -2469 },
+ { 10101, -697, 127, -2113 },
+ { 9685, 811, -2359, -1024 },
+ { 8586, -94, -460, -1982 },
+ { 7924, -141, -509, -2513 },
+ { 7773, -669, -107, -2835 },
+ { 8636, -1064, -46, -2409 },
+ { 9748, 596, -1815, -1349 },
+ { 8924, 304, 547, -2614 },
+ { 9442, 746, -1153, -1679 },
+ { 9454, -278, -529, -1976 },
+ { 8488, 561, -32, -2160 },
+ { 10083, -63, -1544, -1364 },
+ { 9390, -1278, 568, -1131 },
+ { 9740, -49, -2253, -910 },
+ { 3636, -2391, -1115, -3614 },
+ { 6014, -3204, -1902, -1808 },
+ { 5787, -3497, -1116, -2590 },
+ { 4365, -3046, -1632, -2668 },
+ { 4733, -2192, -2029, -2468 },
+ { 5412, -2753, -1633, -2464 },
+ { 4455, -3375, -767, -3399 },
+ { 4456, -1644, -983, -2841 },
+ { 4039, -2523, 38, -3967 },
+ { 3406, -2662, 72, -4757 },
+ { 4279, -2005, 1055, -4399 },
+ { 4321, -1377, -860, -3786 },
+ { 3743, -5739, -651, -3047 },
+ { 3528, -5510, 361, -4060 },
+ { 6496, -4886, -136, -2689 },
+ { 4513, -5254, 551, -4010 },
+ { 6557, -3413, -92, -3063 },
+ { 4186, -2059, 187, 47 },
+ { 6210, -4117, -1256, -1985 },
+ { 6038, -4343, 351, -2124 },
+ { 4305, -4780, -2077, -1897 },
+ { 4480, -3815, -2228, -1533 },
+ { 5582, -3689, 1221, -3429 },
+ { 5532, -4874, 1195, -2765 },
+ { 6518, -2853, -905, -2568 },
+ { 5467, -2192, 470, -4115 },
+ { 4139, -1577, 240, -3493 },
+ { 5281, -1926, -729, -3340 },
+ { 5214, -2870, 1359, -4289 },
+ { 3046, -3510, -1536, -3214 },
+ { 5433, -2881, -1230, -1184 },
+ { 4861, -3932, -1071, -2791 },
+ { 5693, -4234, -1906, -1502 },
+ { 4004, -3935, -1804, -2383 },
+ { 3728, -3792, 681, -4773 },
+ { 3621, -3030, -1951, -2598 },
+ { 5133, -3903, 44, -3700 },
+ { 3561, -3451, 1183, -5301 },
+ { 5026, -2762, -2341, -1780 },
+ { 5841, -2492, -467, -3210 },
+ { 5591, -1791, 497, -2472 },
+ { 5054, -3898, -1822, -2097 },
+ { 5813, -2792, 83, -1469 },
+ { 4432, -4497, 1670, -5193 },
+ { 5338, -4653, -1109, -2200 },
+ { 3239, -4401, -648, -3655 },
+ { 2147, -3598, -1200, -4242 },
+ { 4417, -2271, -1552, -3210 },
+ { 6494, -4360, 852, -3565 },
+ { 2393, -6358, -856, -4524 },
+ { 4959, -4196, -847, -1403 },
+ { 4924, -5438, -226, -3026 },
+ { 4254, -5303, -1306, -2424 },
+ { 4121, -3126, -2334, -1981 },
+ { 3437, -4443, -1464, -2953 },
+ { 3203, -3459, -529, -4339 },
+ { 5896, -5945, 543, -3246 },
+ { 1987, -4733, -220, -4863 },
+ { 4358, -4431, -514, -3081 },
+ { 4583, -2416, -492, -2287 },
+ { 2943, -5035, 419, -4927 },
+ { 5358, -5129, 987, -4309 },
+ { 4460, -3392, 1752, -5634 },
+ { 3415, -4633, 1507, -5945 },
+ { 811, -4692, -445, 2333 },
+ { 1009, -5613, -1857, 1360 },
+ { 1338, -2712, -2720, 3036 },
+ { 1002, -3754, -2582, 2344 },
+ { 750, -4608, -2334, 714 },
+ { 2043, -3207, -2822, 2173 },
+ { -140, -4654, -2953, 357 },
+ { -54, -4026, -2376, 2695 },
+ { 1858, -5022, -717, 2287 },
+ { 2064, -3894, -722, 3255 },
+ { 2727, -4558, -332, 2603 },
+ { 1810, -5378, 283, 1826 },
+ { 3935, -4326, 762, 3383 },
+ { -767, -4697, -2510, 1922 },
+ { 2146, -4312, -3090, 1641 },
+ { 54, -5881, -2114, 921 },
+ { 1992, -5766, -640, 1574 },
+ { 1200, -5371, -1114, 1828 },
+ { 2973, -5337, 34, 2266 },
+ { 1531, -5018, -2817, 1192 },
+ { 3078, -4570, 117, 1990 },
+ { 924, -4286, -1388, 2713 },
+ { 142, -5058, -2848, 1487 },
+ { -106, -6180, -881, 842 },
+ { 673, -5433, -229, 1596 },
+ { 783, -5710, -2784, 562 },
+ { 1935, -5729, -2009, 856 },
+ { -410, -3375, -3326, 2734 },
+ { 234, -3000, -2628, 3260 },
+ { 733, -3405, -3806, 1589 },
+ { 771, -4285, -3544, 1314 },
+ { 1192, -3563, -3960, 2178 },
+ { 206, -5555, -1250, 1546 },
+ { -130, -3815, -1210, 3041 },
+ { 646, -3940, -393, 2992 },
+ { -184, -4931, -1767, 1925 },
+ { 2746, -5120, -2275, 1464 },
+ { 2440, -3731, -3352, 2729 },
+ { -490, -4942, -3779, 997 },
+ { 68, -2636, -4167, 3778 },
+ { 48, -3986, -4118, 2106 },
+ { -978, -5486, -1336, 1390 },
+ { 1126, -5297, -855, 640 },
+ { -472, -3975, -3622, 1557 },
+ { 2456, -5344, -1523, 1648 },
+ { -774, -5652, -2417, 1147 },
+ { 995, -6122, -812, 1132 },
+ { 3282, -4571, -1763, 2175 },
+ { 3655, -3862, -676, 3568 },
+ { 3038, -3647, -1672, 3381 },
+ { 2595, -2964, -2772, 3263 },
+ { 4176, -3353, -1148, 4354 },
+ { 1603, -3442, -1500, 3444 },
+ { 828, -6226, -1783, 678 },
+ { 1421, -3333, -3080, 3403 },
+ { 1121, -4727, -1924, 1984 },
+ { -186, -5083, -682, 1796 },
+ { 819, -2778, -3488, 530 },
+ { 421, -2873, -3832, 2596 },
+ { 2164, -4263, -1605, 2282 },
+ { 585, -4437, -682, -491 },
+ { -644, -4452, -1157, 2325 },
+ { 1991, -4299, 210, 2834 },
+ { 2135, -3632, -2113, 665 },
+ { -7482, -2724, -2662, -1380 },
+ { -6983, -2166, -3756, -3509 },
+ { -7085, -1439, -2397, -3112 },
+ { -7760, -3049, -3319, -2822 },
+ { -8413, -2760, -4406, -3298 },
+ { -5995, -3943, -1260, -3750 },
+ { -7879, -1554, -3464, -2606 },
+ { -6314, -2034, -3878, -1681 },
+ { -8849, -2084, -1399, -1231 },
+ { -7153, -2602, -1384, -817 },
+ { -8041, -2571, -407, -2785 },
+ { -7246, -2233, -1578, 260 },
+ { -7336, -3883, -4061, -1342 },
+ { -7619, -3908, -2342, 382 },
+ { -8684, -3724, -1662, -727 },
+ { -7850, -2922, -1770, -3449 },
+ { -6766, -2034, -1293, -1988 },
+ { -6895, -2116, -968, -3744 },
+ { -7136, -5147, -2618, -2809 },
+ { -8224, -3724, -2519, -1589 },
+ { -6711, -2750, -3021, -219 },
+ { -8059, -1638, -1102, -3175 },
+ { -8710, -4839, -3963, -3143 },
+ { -9363, -4965, -3257, -1002 },
+ { -6099, -1751, -3157, -395 },
+ { -6453, -3216, -4597, -483 },
+ { -7879, -5477, -839, -2638 },
+ { -7202, -4038, -526, -2856 },
+ { -8022, -1228, -1910, -1646 },
+ { -9117, -1393, -1582, -2535 },
+ { -9095, -2693, -636, -2605 },
+ { -9076, -2580, -3481, -2519 },
+ { -8327, -4859, -2422, 83 },
+ { -8368, -2129, -2324, -2173 },
+ { -8554, -4563, -3842, -2007 },
+ { -10462, -4261, -1934, -2084 },
+ { -9717, -3187, -2294, -1896 },
+ { -9625, -3889, -3020, -3224 },
+ { -9857, -4955, -4239, -2184 },
+ { -9752, -2351, -2277, -3129 },
+ { -7219, -1302, -2639, -1603 },
+ { -7477, -4360, -3718, -559 },
+ { -5680, -2033, -2326, -3078 },
+ { -10190, -5548, -4643, -3601 },
+ { -9431, -4121, -879, -2479 },
+ { -8365, -5450, -2020, -1439 },
+ { -6289, -5178, -1605, -3845 },
+ { -8319, -3866, -687, -2792 },
+ { -8131, -1031, -3608, -3947 },
+ { -10510, -2560, -1199, -2082 },
+ { -11015, -3640, -2748, -3041 },
+ { -8762, -5022, -5231, -1162 },
+ { -10153, -2715, -4648, -4859 },
+ { -7930, -5205, -1900, -3600 },
+ { -9561, -3548, -4812, -3722 },
+ { -7663, -4709, -1180, -1475 },
+ { -9073, -5707, -1815, -2980 },
+ { -8602, -2363, -2675, -3770 },
+ { -9967, -5614, -3575, -3838 },
+ { -8324, -1005, -2131, -3254 },
+ { -10331, -5737, -2550, -2940 },
+ { -8234, -3354, -3361, -4479 },
+ { -8140, -1951, -4526, -4545 },
+ { -6679, -2662, -2284, -4182 },
+ { -1122, -1514, -6427, -212 },
+ { 54, -1660, -5424, -1404 },
+ { 254, -2778, -5222, 846 },
+ { -267, -1661, -6577, 814 },
+ { -305, -2021, -5759, 1484 },
+ { -1791, -2446, -6867, -86 },
+ { -2929, -3158, -6603, -1799 },
+ { -1391, -3189, -5557, -1053 },
+ { -1602, -884, -6767, -1213 },
+ { -361, -318, -6219, -44 },
+ { -4078, -2635, -5523, -433 },
+ { -956, 478, -4382, 1470 },
+ { -3300, -2462, -6021, -2721 },
+ { 708, -2434, -5085, -540 },
+ { -2435, -3607, -5647, -2110 },
+ { -491, -1134, -4681, -2886 },
+ { 87, -3435, -4641, -1194 },
+ { -586, -2927, -4784, 366 },
+ { -1394, -2326, -6021, 350 },
+ { 97, -2519, -4678, -2120 },
+ { -1547, -1907, -5069, -2993 },
+ { 268, -3724, -4719, 127 },
+ { -827, -1190, -5912, 1144 },
+ { -3959, -2322, -6898, -1974 },
+ { -2728, -2228, -6426, -562 },
+ { -456, -666, -5785, -1609 },
+ { 531, -1096, -5731, -656 },
+ { -3569, -688, -3915, 110 },
+ { -4752, -1725, -4393, -377 },
+ { -3210, -3315, -6960, -840 },
+ { -688, -3416, -4971, 1221 },
+ { -1833, 77, -6491, -2434 },
+ { -239, -255, -6850, -886 },
+ { -2112, -1490, -6291, -2689 },
+ { -1544, -4579, -5198, -1261 },
+ { -2771, -4014, -5520, 683 },
+ { -1635, -2829, -5512, 1214 },
+ { -958, -2582, -4823, 2360 },
+ { -2077, -4566, -4642, 365 },
+ { -3112, -4214, -5960, -823 },
+ { -2467, -2510, -4858, 1467 },
+ { -1561, -3399, -5822, 211 },
+ { -775, -1081, -4424, 2636 },
+ { -1263, 25, -6378, -1392 },
+ { -3476, -366, -5417, -1393 },
+ { -3176, -1476, -4149, 1466 },
+ { -2479, 518, -4448, -257 },
+ { -2992, 158, -4660, -1279 },
+ { -1320, -3872, -4479, 1147 },
+ { -1475, -312, -5318, 539 },
+ { -3527, -1679, -5860, -1681 },
+ { -3397, -3438, -5593, 1866 },
+ { -4089, -2439, -4763, 1275 },
+ { -748, -4513, -4687, -48 },
+ { -2166, -4531, -4691, -2856 },
+ { -2385, -853, -6035, -627 },
+ { -1194, -4091, -4472, -1963 },
+ { -682, -3234, -4084, -3033 },
+ { -3255, -5015, -5328, -12 },
+ { -2313, -3436, -4601, -155 },
+ { -2792, -1038, -6947, -2019 },
+ { -1244, -1526, -5771, -1882 },
+ { -4679, -3731, -5506, 283 },
+ { -3062, -66, -3558, -758 },
+ { -4895, -1187, 4751, 3728 },
+ { -7600, -2752, 3320, 4613 },
+ { -5703, -2975, 3944, 2659 },
+ { -4972, -1257, -246, 2952 },
+ { -4221, -2487, 1702, 4295 },
+ { -2900, -1529, 2458, 4935 },
+ { -5061, 407, 2416, 4050 },
+ { -6931, -3478, 2761, 2213 },
+ { -6037, -3921, 3192, 1866 },
+ { -6113, -811, 2407, 3782 },
+ { -5878, -1716, 1207, 3478 },
+ { -5953, -2853, 2207, 2712 },
+ { -6807, -3223, 2749, 3595 },
+ { -3272, -3157, 1389, 3788 },
+ { -5368, -1904, 1980, 5077 },
+ { -7235, -1398, 3075, 4548 },
+ { -4765, -3487, 2755, 2796 },
+ { -7658, -4435, 2694, 2582 },
+ { -6997, -4282, 456, 3832 },
+ { -5563, -3115, -63, 3713 },
+ { -4244, -4220, 1450, 2767 },
+ { -3801, -2194, 190, 4303 },
+ { -5458, -4119, 1958, 2274 },
+ { -7300, -3469, 3514, 3193 },
+ { -4594, -2067, 775, 4752 },
+ { -3389, -1654, 1464, 5412 },
+ { -4845, -3483, 964, 3437 },
+ { -6007, -2818, 1666, 4659 },
+ { -8709, -5007, 1757, 3287 },
+ { -5833, -4389, 1025, 3171 },
+ { -5788, -1780, 3944, 3661 },
+ { -4430, -920, 1938, 4753 },
+ { -7066, -1857, 4591, 4538 },
+ { -3549, -513, 1427, 5317 },
+ { -7517, -1220, 2883, 3049 },
+ { -7605, -2687, 1874, 2735 },
+ { -8718, -4035, 2676, 3730 },
+ { -7990, -3907, 1185, 2607 },
+ { -6058, -1744, 3349, 5157 },
+ { -5954, 565, 3161, 3250 },
+ { -6478, -612, 1930, 2271 },
+ { -6535, -1445, -2, 1618 },
+ { -8963, -4151, 1192, 4044 },
+ { -7227, -3570, 1600, 4234 },
+ { -4674, 79, 595, 3015 },
+ { -3974, 430, 2727, 5137 },
+ { -5299, 9, 3714, 4779 },
+ { -6779, -2699, -8, 2436 },
+ { -7016, -1145, 1293, 2310 },
+ { -6955, -3312, 1534, 1801 },
+ { -4025, 740, 1850, 4054 },
+ { -9589, -3460, 4154, 5270 },
+ { -4404, -1181, 4298, 5173 },
+ { -7356, -4583, -18, 2644 },
+ { -6516, -1235, 4439, 6234 },
+ { -3453, -301, 4344, 4464 },
+ { -4643, 1530, 3315, 4340 },
+ { -4575, -2557, 3754, 3682 },
+ { -3643, -3501, 2051, 2997 },
+ { -5412, -2475, 2301, 1579 },
+ { -5846, 259, 1360, 2348 },
+ { -5258, -1358, 1050, 838 },
+ { -5542, -219, 6377, 5750 },
+ { -5713, -2952, 922, 899 },
+ { -2049, -1135, 5206, 1033 },
+ { -1693, -1886, 4835, -106 },
+ { -2344, -3504, 4232, -13 },
+ { -2475, -2334, 5043, 1126 },
+ { -787, -2549, 3880, 2138 },
+ { -3159, -2341, 4830, 2887 },
+ { -1780, -1009, 6240, 2061 },
+ { -4327, -3363, 2818, 886 },
+ { -3376, -2743, 4104, 207 },
+ { -3250, -4640, 2718, 1498 },
+ { -382, -1075, 4382, 3460 },
+ { -2416, -4168, 3530, 816 },
+ { -1756, -2708, 4861, 622 },
+ { -1879, -2097, 5156, 2889 },
+ { -2496, -2418, 3722, 2671 },
+ { -2717, -3252, 3341, 1944 },
+ { -4063, -4091, 3306, 267 },
+ { -3549, -3808, 3747, 842 },
+ { -2635, 546, 5794, 1894 },
+ { -1857, -1121, 4383, 3964 },
+ { -2226, -2166, 3489, 3678 },
+ { -3492, -660, 5323, 1063 },
+ { -3033, -3130, 4382, 1828 },
+ { -2703, -625, 6369, 2851 },
+ { -1656, -2842, 4584, -528 },
+ { -4781, -2622, 4390, 2097 },
+ { -413, -2045, 5081, 3035 },
+ { -3810, -2662, 4532, 1095 },
+ { -3144, -1858, 5215, 1880 },
+ { -3562, -1795, 4928, 670 },
+ { -4800, -1509, 5189, 1859 },
+ { -1085, -3832, 4169, 900 },
+ { -1969, -3270, 2857, 2878 },
+ { -4267, -4140, 3176, 1805 },
+ { -5145, -3727, 3524, 1168 },
+ { -1346, -1876, 5501, 1748 },
+ { -4998, -2945, 3699, 338 },
+ { -3458, -3096, 3406, -635 },
+ { -1751, -3209, 3508, 395 },
+ { -2507, 170, 5987, 705 },
+ { -3756, -1072, 5647, 3536 },
+ { -2870, -1439, 5026, 3212 },
+ { -3913, -3225, 3669, 2144 },
+ { -3739, 226, 5747, 764 },
+ { -2052, -820, 5266, 3093 },
+ { -3214, -3820, 2409, 2391 },
+ { -4398, -2588, 3501, -218 },
+ { -4484, -1763, 4180, -198 },
+ { -3368, -1525, 4362, -134 },
+ { -2407, 224, 4905, 3533 },
+ { -1369, -2937, 4728, 1788 },
+ { -4848, -1707, 4159, 851 },
+ { -3454, -1749, 4281, 3230 },
+ { -1990, -3853, 3487, 1735 },
+ { -3117, 92, 6155, 4075 },
+ { -2676, -2472, 4078, -589 },
+ { -1547, -2012, 2626, 1835 },
+ { -4275, -588, 4824, 725 },
+ { -601, -2249, 3736, 3548 },
+ { -4060, -61, 5333, 3097 },
+ { -4303, 7, 6551, 3054 },
+ { -5003, -1029, 5786, 3319 },
+ { -2810, -728, 5392, 199 },
+ { -1232, -200, 5228, 3121 },
+ { 2621, 165, -6255, 298 },
+ { 3669, 537, -6844, 1564 },
+ { 1598, -1190, -6235, 2523 },
+ { 2164, -32, -6894, 1383 },
+ { 853, -1597, -6069, 1449 },
+ { 1377, -1661, -5266, 108 },
+ { 2660, 48, -5172, -517 },
+ { 1903, -391, -5677, 1010 },
+ { 3792, 206, -5274, -11 },
+ { 1239, 2776, -2929, 2721 },
+ { 4071, 149, -7259, 3125 },
+ { 1436, -480, -6156, -196 },
+ { 1373, -1960, -5005, 3122 },
+ { 3413, -1271, -5176, 3283 },
+ { 3060, -68, -6495, 2238 },
+ { 2700, -2075, -4681, 91 },
+ { 2928, -1728, -5168, 1858 },
+ { 4424, 828, -4471, 88 },
+ { 2672, -2604, -4038, 2753 },
+ { 5223, -123, -6749, 2295 },
+ { 4237, -420, -5538, 1353 },
+ { 4744, -1281, -4097, 4708 },
+ { 1103, -2764, -4751, 2024 },
+ { 3747, -1913, -3911, 3960 },
+ { 2470, -1416, -5542, 615 },
+ { 4847, -1354, -5334, 1733 },
+ { 5336, 88, -7593, 4007 },
+ { 2388, -2880, -4807, 1037 },
+ { 4495, 1391, -5685, -139 },
+ { 5253, 1637, -6450, 1533 },
+ { 1199, 795, -5515, 1261 },
+ { 1397, -1259, -4252, 3838 },
+ { 746, 70, -6640, 604 },
+ { 1584, 166, -4972, 3072 },
+ { 380, -999, -5397, 2267 },
+ { 2974, 1707, -3242, 5360 },
+ { 5202, -403, -5453, 2832 },
+ { 3718, -1731, -4760, 714 },
+ { 4150, -975, -4792, 61 },
+ { 2925, -818, -4841, 15 },
+ { 5301, 577, -4006, 3259 },
+ { 5265, 1986, -5679, 3028 },
+ { 3752, 1928, -4509, 3729 },
+ { 3278, 1925, -6370, 1247 },
+ { 5107, 1721, -4853, 3127 },
+ { 3279, 2982, -2515, 4005 },
+ { 4622, 668, -6204, 759 },
+ { 6034, 317, -5763, 4818 },
+ { -558, 57, -3785, 2817 },
+ { 4476, 1616, -3965, 4536 },
+ { 5953, 2056, -8215, 2715 },
+ { 4387, 2613, -7463, 868 },
+ { 5834, 1088, -4736, 4924 },
+ { 6473, -856, -6991, 4172 },
+ { 4959, -293, -5162, 76 },
+ { 2731, -843, -6119, 3847 },
+ { 3245, 1202, -6833, 616 },
+ { 2553, 1383, -3829, 3859 },
+ { 4332, 2099, -3480, 3622 },
+ { 2110, 2683, -2728, 3990 },
+ { 876, 1167, -3290, 3466 },
+ { 3991, 1709, -2410, 4077 },
+ { 5105, 939, -2584, 3256 },
+ { 4719, 688, -1566, 3040 },
+ { -3632, 4335, 1266, -3303 },
+ { -4956, 3207, 1312, -2806 },
+ { -4669, 2627, 2663, -2435 },
+ { -4282, 3708, 2303, -3038 },
+ { -4536, 2297, -175, -3350 },
+ { -5234, 2503, -139, -880 },
+ { -3978, 1512, 1092, -3619 },
+ { -4519, 4649, 1363, -2455 },
+ { -5118, 3132, 1961, -1577 },
+ { -5196, 3379, -182, -1378 },
+ { -6420, 4486, 2397, -1993 },
+ { -5030, 5046, 1292, -1118 },
+ { -4559, 2573, -927, -1406 },
+ { -3501, 3730, 691, -4930 },
+ { -4364, 2758, 1007, -3909 },
+ { -4026, 2839, -1559, -2340 },
+ { -5037, 4053, 836, -1571 },
+ { -4727, 5136, 1110, -3588 },
+ { -5245, 2799, -999, -2164 },
+ { -4954, 1501, 422, -3963 },
+ { -5994, 2726, 1462, -2833 },
+ { -5621, 5159, 2038, -2512 },
+ { -4991, 2291, 1917, -3151 },
+ { -5469, 4382, -148, -2978 },
+ { -5858, 1983, 807, -2720 },
+ { -4709, 3556, 952, -467 },
+ { -2489, 2362, 1714, -4230 },
+ { -4717, 5004, -1180, -3672 },
+ { -5914, 3653, 1359, -1317 },
+ { -5506, 2995, 780, -1059 },
+ { -5287, 3945, 2480, -2293 },
+ { -3849, 4358, 322, -1770 },
+ { -3911, 3570, 252, -3185 },
+ { -3660, 5128, 158, -3719 },
+ { -4599, 3277, -503, -2727 },
+ { -3673, 3760, -1252, -3339 },
+ { -5161, 2337, 388, -1943 },
+ { -3529, 2216, 2156, -3080 },
+ { -4309, 4331, 1808, -1460 },
+ { -4782, 3820, 480, -2504 },
+ { -4166, 3544, -378, -1567 },
+ { -5572, 2466, -418, -2909 },
+ { -6096, 2930, 119, -1878 },
+ { -5963, 3554, 1011, -2233 },
+ { -6433, 4335, 935, -2930 },
+ { -5004, 3314, -1352, -3430 },
+ { -6042, 3463, -1008, -3940 },
+ { -4671, 2214, -640, -5040 },
+ { -2795, 3759, 1412, -3803 },
+ { -3647, 4436, 729, -515 },
+ { -3594, 1033, 56, -4148 },
+ { -2908, 3027, 2889, -3485 },
+ { -3338, 2234, 313, -4285 },
+ { -3825, 4497, -561, -2634 },
+ { -6167, 3012, -48, -3149 },
+ { -4828, 3515, -969, -4475 },
+ { -5789, 2757, -539, -4173 },
+ { -2452, 3067, 564, -4249 },
+ { -4921, 1358, 1331, -2889 },
+ { -3127, 4239, -1045, -1523 },
+ { -4780, 2326, -1118, -3446 },
+ { -3908, 5546, 152, -2622 },
+ { -6972, 2976, 337, -2809 },
+ { -4839, 4613, -35, -4077 },
+ { -1408, 4822, -1149, -4997 },
+ { -981, 4979, -912, -6304 },
+ { -2098, 5689, -888, -2878 },
+ { -3343, 4814, -657, -4434 },
+ { -2461, 3601, -967, -4869 },
+ { -2652, 3944, 87, -5520 },
+ { -1104, 6076, 174, -6407 },
+ { 355, 5370, -1721, -5869 },
+ { 1242, 4497, -1107, -5091 },
+ { -89, 4002, -1491, -5182 },
+ { 1059, 5693, -1591, -4905 },
+ { 1323, 4682, -2078, -4768 },
+ { 818, 3996, -549, -5468 },
+ { -287, 4529, 929, -5543 },
+ { -919, 5519, -2791, -2844 },
+ { -1407, 5679, -3289, -3974 },
+ { -189, 6530, -3547, -4002 },
+ { -900, 7039, -3371, -4855 },
+ { -2983, 7211, -363, -4835 },
+ { -814, 6503, -104, -5106 },
+ { -2386, 6896, 809, -4919 },
+ { 845, 4492, 352, -6621 },
+ { -1998, 7237, -1646, -4231 },
+ { -3380, 6251, 471, -4577 },
+ { -1908, 7059, 84, -5726 },
+ { -340, 6346, -803, -6265 },
+ { -2279, 5834, -47, -4633 },
+ { -1532, 5286, -1748, -1901 },
+ { -2757, 6188, -453, -3415 },
+ { -1255, 6405, -2043, -6357 },
+ { 918, 5581, -121, -5667 },
+ { 1840, 5336, -821, -5034 },
+ { -2475, 4992, -1825, -3104 },
+ { -2413, 5606, -1789, -4298 },
+ { 132, 5128, -2389, -4442 },
+ { 223, 6400, -2653, -4742 },
+ { -673, 5012, 680, -4582 },
+ { -1657, 6624, -349, -3596 },
+ { -755, 6289, -1860, -3978 },
+ { -572, 6894, -1946, -5207 },
+ { -1141, 4756, -2665, -5586 },
+ { -1073, 4269, -431, -4030 },
+ { 186, 5761, 916, -5868 },
+ { -1907, 4836, 1017, -5106 },
+ { -963, 3363, -1248, -6348 },
+ { -3262, 4774, -1818, -5858 },
+ { 847, 3812, -2538, -4302 },
+ { -1223, 5903, 1360, -5479 },
+ { -1094, 6923, -1244, -2381 },
+ { 267, 6276, -709, -2846 },
+ { -157, 5840, 1124, -4266 },
+ { 889, 3206, -910, -5305 },
+ { -1736, 3344, 582, -4838 },
+ { -2357, 5676, -2695, -6277 },
+ { -1916, 6901, -986, -5397 },
+ { -3062, 6028, -695, -5687 },
+ { 1836, 3566, -1357, -5226 },
+ { -2176, 4938, 646, -3872 },
+ { -2199, 3055, -208, -6124 },
+ { -236, 3032, -821, -5325 },
+ { -3989, 7277, -565, -3899 },
+ { -595, 4362, 74, -5975 },
+ { 684, 5874, -841, -4424 },
+ { -2731, 6305, -2389, -5465 },
+ { -5775, 1325, -56, -2528 },
+ { -7029, -534, -1890, -3278 },
+ { -5798, -15, -2734, -2210 },
+ { -5504, -1198, -353, -3659 },
+ { -5079, 960, -894, -4336 },
+ { -6073, -36, -133, -3014 },
+ { -5782, -259, -1025, -3986 },
+ { -6843, 1262, -807, -1639 },
+ { -5263, -918, -3290, -579 },
+ { -4840, 461, -2158, -533 },
+ { -6014, -50, -620, 504 },
+ { -5843, 241, -1359, -282 },
+ { -5898, 577, 769, -3271 },
+ { -6833, -946, -466, -3347 },
+ { -6026, 1459, -512, -729 },
+ { -7361, 747, -388, -1110 },
+ { -6391, 2142, -1160, -2513 },
+ { -6995, 304, 498, -2673 },
+ { -6757, 679, -386, -433 },
+ { -5222, 1688, -1093, -1032 },
+ { -5019, 575, 184, -3627 },
+ { -4237, 628, -3507, -1243 },
+ { -7479, -456, -1722, -1486 },
+ { -6464, 713, -1273, -1153 },
+ { -6255, 1682, -606, -3607 },
+ { -7033, 1497, -71, -1955 },
+ { -6694, 1556, -1721, -3214 },
+ { -6114, -356, 813, -2575 },
+ { -5308, 632, -1851, -1636 },
+ { -5742, -911, -1733, 383 },
+ { -6083, -387, -2313, -879 },
+ { -6535, -530, -1505, -2083 },
+ { -4896, 1223, -2750, -1816 },
+ { -6392, -463, -3247, -2093 },
+ { -5373, 1264, -2706, -3042 },
+ { -3894, -1390, -1020, -891 },
+ { -6179, 1168, -1966, -1922 },
+ { -5162, 1668, -1617, -1916 },
+ { -6453, 920, -1169, -2432 },
+ { -6130, 2005, -536, -1519 },
+ { -6552, -98, -518, -1938 },
+ { -7528, 355, -1101, -1772 },
+ { -5745, 610, -247, -1360 },
+ { -7003, 177, -2064, -1958 },
+ { -6956, -570, -2220, -4225 },
+ { -7830, 791, -1394, -2774 },
+ { -7634, 480, -3171, -4224 },
+ { -7913, 1154, -350, -2381 },
+ { -5063, 1704, -1804, -2977 },
+ { -4887, -524, -2703, 188 },
+ { -5551, 406, -1620, -3063 },
+ { -7109, 1342, 381, -3021 },
+ { -6846, 631, -458, -3398 },
+ { -4606, -605, 11, -3930 },
+ { -8134, -225, -1738, -2648 },
+ { -7043, 402, -2734, -3059 },
+ { -7417, 1825, -2545, -4389 },
+ { -6971, -236, -1031, -665 },
+ { -5752, 2111, -1632, -3808 },
+ { -7660, -78, -624, -3135 },
+ { -6358, 619, -1951, -3911 },
+ { -8134, 408, -1935, -3695 },
+ { -6335, 1911, -2368, -4505 },
+ { -7116, 2163, -344, -2753 },
+ { 2357, 4488, 2220, -5682 },
+ { 1385, 3206, 2300, -5305 },
+ { 1419, 2557, 5203, -3516 },
+ { 262, 4315, 3920, -1847 },
+ { 3316, 3187, 1612, -5609 },
+ { 1729, 2350, 1673, -6068 },
+ { 1603, 6126, 1467, -2839 },
+ { -1339, 3316, 3691, -3530 },
+ { -563, 4618, 3180, -4548 },
+ { 463, 4624, 3111, -5614 },
+ { 1246, 5455, 3356, -5720 },
+ { 480, 2149, 5422, -2893 },
+ { 1768, 4827, 913, -5579 },
+ { -149, 5381, 4366, -3297 },
+ { 985, 3672, 2644, -92 },
+ { -258, 2911, 5817, -2213 },
+ { 3428, 3289, 3351, -3541 },
+ { -666, 3295, 4727, -2869 },
+ { 35, 6641, 4160, -4052 },
+ { 623, 6787, 3156, -4560 },
+ { 2654, 4360, 4676, -4632 },
+ { 1386, 5246, 4834, -4497 },
+ { 3488, 4574, 3856, -5946 },
+ { 383, 4481, 4168, -4110 },
+ { 1753, 3652, 4288, -3326 },
+ { 1344, 4905, 2508, -4660 },
+ { 1580, 4106, 3104, -2224 },
+ { 2027, 5038, 1683, -1554 },
+ { 446, 3699, 5872, -3013 },
+ { 4637, 4087, 3578, -5018 },
+ { 2629, 3560, 5331, -4900 },
+ { 1527, 6674, 2523, -4131 },
+ { -1437, 2804, 2528, -4464 },
+ { -229, 3355, 2016, -5537 },
+ { 3666, 3418, 4374, -4581 },
+ { 1192, 3799, 923, -6596 },
+ { 2040, 2956, 448, -5322 },
+ { 2468, 5768, 4029, -5869 },
+ { 3438, 6516, 3529, -6667 },
+ { 2737, 5495, 680, -5535 },
+ { 3896, 5727, 1801, -4958 },
+ { 4988, 4957, 3592, -6518 },
+ { -542, 4416, 5794, -2787 },
+ { 4136, 4354, 2064, -4696 },
+ { 3067, 5936, 1207, -3396 },
+ { 2789, 4966, 2405, -3854 },
+ { 1731, 3270, 3251, -1063 },
+ { 1767, 5537, 2084, -2349 },
+ { 465, 3116, 4532, -837 },
+ { 1499, 2627, 4610, -2212 },
+ { 122, 3095, 3642, -3552 },
+ { 2542, 2866, 2705, -6402 },
+ { 3134, 4323, 698, -4785 },
+ { 731, 1859, 3112, -5242 },
+ { 2553, 2980, 3241, -4846 },
+ { 1329, 5310, 1607, -6624 },
+ { 2468, 1858, 3476, -1034 },
+ { -172, 4996, 2000, -5562 },
+ { 2621, 4220, 1574, -3386 },
+ { -333, 1832, 3362, -4117 },
+ { 2169, 6762, 3065, -6225 },
+ { 2844, 5528, 3223, -4765 },
+ { 526, 5175, 1644, -4267 },
+ { 2922, 4426, 2414, -2610 },
+ { 452, 1399, -4516, -2636 },
+ { 2872, 1720, -4667, -1435 },
+ { 1279, 702, -5424, -1984 },
+ { 2187, 870, -5021, -1341 },
+ { 583, -144, -4628, -2464 },
+ { 3, 2237, -5284, -2827 },
+ { -19, 1005, -5460, -1819 },
+ { 2897, 2084, -5885, -515 },
+ { -400, 3370, -5527, -2947 },
+ { 1505, 2593, -5518, -1802 },
+ { 1341, 4534, -5094, -1899 },
+ { 3241, 3670, -5493, -1252 },
+ { -1287, 921, -5994, -1675 },
+ { 627, 408, -6652, -364 },
+ { -260, 1127, -4849, -3247 },
+ { 371, 3400, -5976, -2285 },
+ { 1533, 1566, -6373, -610 },
+ { 2462, 4274, -6184, -1254 },
+ { 1782, 3363, -6222, -1381 },
+ { 572, 4650, -5673, -2754 },
+ { 2674, 3414, -4460, -2154 },
+ { 3614, 3820, -6883, -398 },
+ { 1136, -1, -5511, -1112 },
+ { -1773, 1137, -5647, -2377 },
+ { -753, 2104, -6085, -2565 },
+ { -204, 3025, -4731, -1418 },
+ { -1486, 1438, -4380, -216 },
+ { 302, 858, -5786, -264 },
+ { 3486, 1495, -5234, -783 },
+ { 888, 2327, -3423, -3720 },
+ { -259, 772, -6596, -1311 },
+ { -1197, 2073, -5174, -1826 },
+ { 1500, 3470, -4462, -2645 },
+ { 3072, 1960, -3277, -2264 },
+ { 1841, 952, -4324, -2340 },
+ { 1994, 2200, -3940, -2923 },
+ { -1782, 1699, -4667, -1075 },
+ { -1464, 2906, -3468, -375 },
+ { 366, 2380, -3747, 1467 },
+ { -545, 1645, -4619, 376 },
+ { 1724, 2350, -2374, -3512 },
+ { 3184, 2628, -2996, -3275 },
+ { 734, 2010, -6239, -1479 },
+ { 524, 3756, -4496, -3263 },
+ { 1492, 3570, -3494, -3600 },
+ { -932, 618, -5389, -2894 },
+ { -133, 2161, -4083, -3267 },
+ { 786, 774, -3279, -3731 },
+ { 1078, 803, -3843, -3007 },
+ { -332, 3405, -3347, 40 },
+ { -17, 6, -4005, -3690 },
+ { -189, 4372, -4488, -2561 },
+ { -450, 3846, -3790, -1370 },
+ { 362, 2212, -5272, -15 },
+ { -1529, 791, -6802, -2296 },
+ { 2145, 4241, -4474, 376 },
+ { 1813, 2426, -2932, -2726 },
+ { -542, 4557, -3140, -1080 },
+ { 1192, 3784, -4371, -20 },
+ { 2784, 5188, -6399, -1394 },
+ { 431, 4561, -3673, -1398 },
+ { 1382, 3096, -4083, 1253 },
+ { 1209, 4224, -2930, 1500 },
+ { 2798, 2684, -6676, -606 },
+ { -2396, 1510, -5381, -2713 },
+ { -2625, 2542, -4032, -2880 },
+ { -1231, 3967, -4098, -2886 },
+ { -1393, 2374, -3862, -4525 },
+ { -2495, 1665, -1637, -5445 },
+ { -3854, 1759, -1750, -4944 },
+ { -2373, 1668, -2856, -6251 },
+ { -2668, 1981, -886, -4557 },
+ { -2927, 4427, -3451, -6172 },
+ { -1925, 2596, -4696, -2527 },
+ { -3202, 2847, -3928, -5896 },
+ { -3332, 1665, -5025, -3412 },
+ { -3212, 3115, -4155, -4062 },
+ { -1013, 3205, -5133, -3751 },
+ { -2022, 4595, -3947, -5611 },
+ { -3556, 1755, -3715, -2300 },
+ { -1784, 4114, -2723, -1773 },
+ { -3586, 4081, -2733, -4942 },
+ { -1608, 3685, -4154, -4573 },
+ { -3368, 4042, -4452, -6227 },
+ { -1407, 3881, -5729, -3719 },
+ { -2751, 3281, -5077, -4999 },
+ { -3791, 2410, -4906, -5288 },
+ { -730, 2303, -4217, -3755 },
+ { -1812, 2311, -5492, -3709 },
+ { -610, 4336, -3915, -3783 },
+ { -2841, 4337, -4278, -4430 },
+ { -1662, 4666, -4661, -3964 },
+ { -589, 5209, -4923, -3682 },
+ { -4155, 2234, -4076, -4218 },
+ { -3951, 2770, -2665, -2805 },
+ { -2302, 3228, -3717, -1908 },
+ { -3129, 4373, -2264, -2851 },
+ { -447, 1363, -3578, -4323 },
+ { -2648, 4237, -3159, -3071 },
+ { -4072, 3241, -3541, -4605 },
+ { -4507, 3458, -2339, -3838 },
+ { -1646, 997, -4926, -3970 },
+ { -3025, 1614, -3940, -1242 },
+ { -1337, 1756, -3163, -5529 },
+ { -3203, 1865, -3282, -4354 },
+ { -1646, 2118, -2203, -6018 },
+ { 174, 1871, -2707, -4639 },
+ { -2607, 1485, -4778, -4750 },
+ { -2199, 3991, -3134, -4879 },
+ { -2962, 3323, -2816, -2419 },
+ { -5286, 2495, -4548, -5395 },
+ { -2810, 3710, -2274, -4211 },
+ { -330, 3006, -2993, -4678 },
+ { -1187, 2411, -2743, -5196 },
+ { -664, 4033, -3101, -5641 },
+ { -1458, 3602, -2816, -5371 },
+ { -4116, 4923, -3321, -5630 },
+ { -4165, 2528, -2592, -4798 },
+ { -2759, 3080, -2333, -5719 },
+ { -5157, 3011, -5526, -6348 },
+ { -3095, 2126, -5881, -4234 },
+ { -4377, 3849, -3600, -6099 },
+ { -1994, 4947, -5235, -4753 },
+ { -1067, 600, -3258, -5133 },
+ { -4992, 3302, -2208, -5051 },
+ { -3377, 2981, -1655, -4815 },
+ { -3325, 2446, -1787, -6116 },
+ { -2341, 2737, -3240, -6347 },
+ { -2258, -3732, 3710, -1235 },
+ { -1558, -3849, 2694, -3012 },
+ { -599, -4837, 3050, -2951 },
+ { -2246, -5433, 2798, -1910 },
+ { -2255, -4989, 3260, 270 },
+ { -3026, -5353, 2693, -1036 },
+ { -1151, -6097, 1097, -3782 },
+ { -3391, -6012, 2130, -1303 },
+ { -2850, -4422, 3375, -480 },
+ { -1138, -3779, 1491, -4162 },
+ { -551, -3892, 3787, -2082 },
+ { -3221, -3676, 3144, -1202 },
+ { -3023, -5196, 2650, 605 },
+ { -1756, -5729, 2646, 321 },
+ { -2693, -4409, 494, -4797 },
+ { -1913, -4573, 3372, -1730 },
+ { -1277, -3604, 4061, -993 },
+ { -420, -4993, 1351, -4796 },
+ { -3052, -5333, 1435, -1242 },
+ { -602, -5034, 3869, -1141 },
+ { -2436, -4680, 1665, -3019 },
+ { -2657, -3658, 1459, -3391 },
+ { -1220, -6246, 2749, -525 },
+ { -3838, -4844, 2265, -1735 },
+ { -1247, -5679, 3356, -1417 },
+ { -917, -5448, 3342, 105 },
+ { -1756, -6839, 2276, -2350 },
+ { -412, -5206, 1764, -3539 },
+ { -1439, -6915, 1442, -3750 },
+ { -1381, -4439, 3863, -282 },
+ { -3482, -4953, 2726, -336 },
+ { -1376, -5931, 1714, -1987 },
+ { -1716, -4405, 2608, 105 },
+ { -1590, -5191, 2652, -2704 },
+ { -2149, -6442, 2453, -1263 },
+ { -3426, -3832, 2334, -1829 },
+ { -2747, -5948, 2362, -173 },
+ { -2435, -3267, 2966, -1710 },
+ { -3979, -4282, 2705, -775 },
+ { -356, -4238, 2544, -4343 },
+ { -1363, -6471, 2817, -1836 },
+ { -2878, -5117, 218, -3149 },
+ { -3539, -5196, 1710, -2356 },
+ { -2888, -4537, 2746, -1701 },
+ { -1870, -4439, 1496, -4121 },
+ { -1486, -3388, 3349, -2145 },
+ { -3333, -4138, 1467, -2876 },
+ { -345, -5340, 1012, -1190 },
+ { -1672, -4992, 2289, -1029 },
+ { -2146, -5528, 3038, -635 },
+ { -316, -3656, 3426, -3152 },
+ { -2695, -5812, 2336, -2050 },
+ { -2067, -6052, 737, -3258 },
+ { -2664, -4205, -350, -1266 },
+ { -617, -5406, 80, -4853 },
+ { -2418, -3825, 1853, -1326 },
+ { -1961, -4339, 583, -4315 },
+ { -1495, -5141, -133, -5205 },
+ { -3208, -6440, 1691, -2069 },
+ { -2632, -3633, 2325, -2761 },
+ { -2624, -5670, 1252, -3676 },
+ { -3687, -5608, 687, -2833 },
+ { -3320, -5707, 16, -3877 },
+ { -2738, -6112, 84, -5135 },
+ { 2277, -5661, 3076, 843 },
+ { 1555, -5769, 2821, -5236 },
+ { 536, -6381, 603, -4910 },
+ { 734, -4609, 3314, -4092 },
+ { 1836, -4547, 3267, -4322 },
+ { -13, -5976, 3752, -1607 },
+ { 1423, -6318, 2336, 398 },
+ { 365, -7779, 1498, -534 },
+ { 2104, -8366, 2946, -1345 },
+ { 143, -5545, 1898, -3756 },
+ { 655, -6852, 1430, 148 },
+ { 4, -6653, 2397, -59 },
+ { 2346, -5996, 4562, -934 },
+ { 1229, -7104, 2963, -598 },
+ { -528, -7048, 2887, -1790 },
+ { 1451, -6857, 3900, -1637 },
+ { 554, -6018, 3336, 9 },
+ { 3278, -5758, 4034, 129 },
+ { 3541, -7145, 4905, -1575 },
+ { 2339, -6907, 3464, -301 },
+ { 2775, -7301, 1667, -3894 },
+ { 539, -7887, 991, -4156 },
+ { 2115, -7421, 3131, -3075 },
+ { 2803, -8546, 2564, -5836 },
+ { 2869, -5833, 1620, -4561 },
+ { 2591, -7281, 3215, -4719 },
+ { -1228, -8477, 706, -4782 },
+ { 1967, -5243, 4813, -1940 },
+ { 701, -7010, 2273, -3893 },
+ { 915, -8470, 1918, -5620 },
+ { -94, -6715, 156, -3873 },
+ { 1074, -5607, 4389, -1017 },
+ { 2739, -6551, 1227, -3521 },
+ { 725, -7835, 2701, -1291 },
+ { -493, -7475, 2263, -1075 },
+ { -412, -6508, 2984, -744 },
+ { 665, -5451, 3725, -2692 },
+ { 1499, -8129, 3564, -2072 },
+ { 2870, -6333, 4487, -2108 },
+ { 706, -5007, 3911, -152 },
+ { -482, -8660, 1483, -2900 },
+ { 2481, -6596, 2518, -1715 },
+ { 1403, -6414, 1398, -5387 },
+ { 652, -6267, 583, -5942 },
+ { 694, -7540, 646, -6272 },
+ { 2275, -7614, 256, -5015 },
+ { 1416, -9727, 1900, -3153 },
+ { 2760, -6433, 3875, -3771 },
+ { 2325, -11196, 2182, -5155 },
+ { 1223, -11061, 1377, -5097 },
+ { 108, -10603, 307, -4952 },
+ { -118, -8268, 1650, -1572 },
+ { 1839, -7943, 1755, -612 },
+ { 2501, -9056, 981, -2969 },
+ { 2902, -8476, 1491, -5780 },
+ { 1995, -11175, 1585, -3643 },
+ { 696, -8212, 828, -2474 },
+ { 1526, -8649, 1380, -1210 },
+ { 461, -7253, 3222, -2229 },
+ { 2966, -8641, 4121, -3271 },
+ { 833, -6039, 2361, -1086 },
+ { 3565, -7312, 1980, -5427 },
+ { 2850, -8671, 3760, -1846 },
+ { 2643, -7281, 2163, -173 },
+ { 3463, -3706, -3132, -923 },
+ { 1315, -3825, -3443, 2 },
+ { 2594, -4083, -3815, 670 },
+ { 1826, -4291, -2741, -155 },
+ { 868, -3749, -4175, -298 },
+ { 2008, -4237, -3897, -517 },
+ { 1242, -3493, -4335, -1335 },
+ { -88, -4142, -3390, -1529 },
+ { 2176, -3488, -3822, -975 },
+ { 1706, -5188, -3415, -637 },
+ { 2717, -6159, -2333, -882 },
+ { 1276, -3978, -4361, 537 },
+ { 2471, -5556, -2866, -208 },
+ { 799, -4673, -4086, 56 },
+ { 1901, -4786, -3533, 270 },
+ { 3036, -3902, -3606, -333 },
+ { 2249, -3317, -4319, -144 },
+ { 2594, -4207, -2105, -2930 },
+ { 4008, -4774, -2626, -902 },
+ { 1038, -3659, -3496, -2454 },
+ { 2725, -3597, -3298, -1535 },
+ { 1662, -5803, -2813, 175 },
+ { 705, -3757, -3441, -1484 },
+ { 1860, -5987, -2821, -886 },
+ { 3786, -4918, -2199, -1929 },
+ { 3683, -4235, -2547, -1287 },
+ { 2531, -4896, -2956, -1593 },
+ { 1005, -5585, -3324, -180 },
+ { 1625, -5229, -1756, -3642 },
+ { 1494, -5041, -2989, -2685 },
+ { 2718, -4655, -3224, -867 },
+ { 2374, -6640, -1745, -2975 },
+ { 2133, -6436, -2477, -1499 },
+ { 1833, -4418, -3523, -1512 },
+ { 1128, -4910, -2658, -1106 },
+ { 689, -4777, -2831, -2085 },
+ { 3593, -5280, -2627, -315 },
+ { 3264, -3771, -2673, -1861 },
+ { 3202, -5602, -2409, 402 },
+ { 552, -4618, -2221, -3002 },
+ { 3095, -5356, -2666, -1083 },
+ { 3401, -4609, -3146, 45 },
+ { 3051, -4662, -2192, -2232 },
+ { 2798, -5552, -2462, -1941 },
+ { 2354, -5815, -2223, -2619 },
+ { 192, -3708, -2807, -2658 },
+ { 1886, -4226, -1862, -3529 },
+ { 2526, -3976, -2819, -2332 },
+ { 1577, -3870, -2711, -2806 },
+ { 1288, -5588, -3382, -1403 },
+ { 2711, -5399, -1564, -3253 },
+ { 1459, -5492, -2222, -322 },
+ { 2823, -5091, -2886, 776 },
+ { 3559, -5821, -2109, -1360 },
+ { 1587, -6331, -2760, -1909 },
+ { 2139, -5213, -2874, -2120 },
+ { 1318, -4337, -3695, -2098 },
+ { 821, -4471, -1849, -565 },
+ { 3329, -4782, -1725, -89 },
+ { 582, -4914, -4105, -1119 },
+ { 417, -4144, -4072, -2529 },
+ { -199, -3803, -2765, -4042 },
+ { 2731, -4283, -2143, 1 },
+ { 2911, -6187, -1951, -2116 },
+ { 1573, -6094, -493, -2838 },
+ { 2081, -6927, -864, -3211 },
+ { 1058, -7826, 79, -364 },
+ { 3147, -5570, -684, -978 },
+ { 3572, -5856, 1060, 1824 },
+ { 1143, -6702, -1478, 338 },
+ { 2341, -7220, -88, 260 },
+ { 3639, -6861, 668, 815 },
+ { 2227, -6268, -1706, 446 },
+ { 3390, -6082, -353, 1302 },
+ { 1123, -7556, -1237, -430 },
+ { 1729, -7742, 729, -218 },
+ { 1457, -6774, 587, 579 },
+ { 505, -6919, -569, 371 },
+ { 1106, -7245, 78, 158 },
+ { 2755, -6745, -1122, 338 },
+ { 3069, -6040, -1415, 986 },
+ { 2174, -7064, -1430, -283 },
+ { 1390, -8626, -446, -3031 },
+ { 3534, -6890, -431, 547 },
+ { 2267, -9618, 475, -2994 },
+ { 3672, -7673, 75, -115 },
+ { 2131, -7560, -1206, -750 },
+ { 2972, -7477, -685, -262 },
+ { 1604, -6637, -672, 699 },
+ { 1666, -7577, -577, -240 },
+ { 1591, -6554, -2158, -94 },
+ { 2348, -6286, -353, 1123 },
+ { 2017, -8810, -412, -1805 },
+ { 2892, -6713, -1765, -554 },
+ { 2500, -6828, -1995, -1197 },
+ { 3877, -6639, -224, -1655 },
+ { 2392, -7872, -91, -333 },
+ { 3562, -7370, -532, -2836 },
+ { 2552, -7614, 164, -1805 },
+ { 990, -6104, 218, 438 },
+ { 910, -7861, 312, -1195 },
+ { 1472, -6327, 372, -640 },
+ { 1576, -7143, -1983, -843 },
+ { 422, -7625, -457, -278 },
+ { 1797, -8532, 405, -1011 },
+ { 1088, -7396, -238, -2277 },
+ { 3209, -6753, -1431, -2072 },
+ { 2617, -6839, 100, -2573 },
+ { 2575, -8573, -387, -3188 },
+ { 3618, -6971, -1190, -321 },
+ { 2205, -7361, -1695, -2008 },
+ { 2985, -6297, 1464, 1179 },
+ { 2804, -7310, 1053, 338 },
+ { 1362, -6074, -1163, -840 },
+ { 3336, -6325, -1794, 21 },
+ { 2836, -8109, 818, -329 },
+ { 2791, -5879, 560, 1546 },
+ { 2392, -6064, 135, 100 },
+ { 1838, -6194, 596, 1085 },
+ { 1926, -7515, -414, -4901 },
+ { 3225, -7298, -1202, -1189 },
+ { 3960, -7558, -659, -719 },
+ { 3442, -6647, -1692, -1095 },
+ { 3381, -6441, 262, -886 },
+ { 1431, -8150, -1186, -1406 },
+ { 340, -8498, -150, -899 },
+ { 3004, -8149, -260, -953 },
+ { 2749, -6611, 563, 873 },
+ { -6647, -1325, -4517, -4691 },
+ { -6005, -1657, -4089, -3797 },
+ { -3157, 588, -5213, -3068 },
+ { -3311, -1425, -6329, -3726 },
+ { -5866, -819, -3857, -2744 },
+ { -5001, -1799, -1075, -4621 },
+ { -5330, -2650, -2672, -4664 },
+ { -4930, -539, -2363, -4010 },
+ { -2984, 10, -3863, -5749 },
+ { -1055, -2106, -3713, -4267 },
+ { -5476, -502, -4279, -6504 },
+ { -5231, -1543, -5018, -6425 },
+ { -5134, -363, -3165, -5109 },
+ { -3953, -771, -4107, -6393 },
+ { -2159, -563, -3652, -5342 },
+ { -3888, -2321, -919, -5057 },
+ { -1236, -597, -4235, -4193 },
+ { -4053, 675, -3083, -6174 },
+ { -2793, -1089, -5396, -3460 },
+ { -3000, -44, -2209, -6575 },
+ { -3336, -1531, -4313, -5160 },
+ { -2127, 128, -4851, -3692 },
+ { -3321, 136, -2067, -5660 },
+ { -5215, 1404, -4374, -4356 },
+ { -2747, 400, -6340, -3691 },
+ { -3926, -599, -5361, -5006 },
+ { -2875, -2592, -5143, -4092 },
+ { -4991, -1958, -5322, -4891 },
+ { -4965, -1318, -6652, -5333 },
+ { -4920, -1691, -3388, -5561 },
+ { -3644, -3354, -2688, -5982 },
+ { -5076, -919, -4563, -2984 },
+ { -6114, 250, -3884, -3915 },
+ { -4014, 744, -3973, -1924 },
+ { -5543, -1041, -5557, -3847 },
+ { -4711, -1352, -5649, -2603 },
+ { -3362, 775, -5305, -4879 },
+ { -5001, 107, -3554, -2888 },
+ { -6258, -1651, -6356, -6566 },
+ { -4529, 407, -5003, -3865 },
+ { -5154, 550, -5278, -5465 },
+ { -4195, -467, -1894, -3129 },
+ { -5022, 1127, -3349, -3314 },
+ { -6075, 1250, -4313, -5641 },
+ { -2677, -2283, -2312, -5903 },
+ { -4113, 193, -1195, -4833 },
+ { -3940, -1048, -1389, -5079 },
+ { -3703, 917, -4043, -4451 },
+ { -3366, -4231, -1534, -5488 },
+ { -3326, -3583, -2091, -4903 },
+ { -5144, 1254, -2532, -4949 },
+ { -5982, -870, -2545, -4555 },
+ { -3925, -157, -5367, -2281 },
+ { -6419, -746, -5668, -4371 },
+ { -5787, 518, -7096, -5805 },
+ { -4258, 954, -6453, -4321 },
+ { -4771, -695, -4158, -1639 },
+ { -7078, -760, -5195, -5877 },
+ { -7348, 83, -4101, -4586 },
+ { -2430, 184, -2874, -1679 },
+ { -2284, -3943, -2924, -5034 },
+ { -1804, -1785, -3002, -4710 },
+ { -4399, -2772, -1815, -4637 },
+ { -6340, -2626, -2824, -5191 },
+ { -4998, -5168, -3480, 1905 },
+ { -3958, -5492, -1599, 1579 },
+ { -2471, -3755, -276, 3182 },
+ { -3033, -5779, -1063, 1554 },
+ { -2936, -4829, -1290, 2386 },
+ { -1835, -5073, -3051, 1299 },
+ { -1724, -3771, -3935, 2324 },
+ { -5070, -2550, -3692, 768 },
+ { -4326, -5333, -297, 1878 },
+ { -3472, -5619, -3094, 992 },
+ { -3027, -4384, -3038, 2265 },
+ { -3201, -5332, 67, 2200 },
+ { -1681, -4373, -1947, 2461 },
+ { -3221, -3329, -4238, 2564 },
+ { -1262, -2968, -2915, 3227 },
+ { -3419, -1878, -3373, 2110 },
+ { -2244, -5583, -2012, 1288 },
+ { -1971, -5266, -990, 1812 },
+ { -2975, -2778, -452, 4063 },
+ { -2198, -1165, -3298, 2965 },
+ { -4782, -4894, -4767, 664 },
+ { -6002, -3950, -2806, 2025 },
+ { -3142, -3162, -2859, 3295 },
+ { -3262, -3340, -4123, 1596 },
+ { -4014, -3918, -1955, 3361 },
+ { -1700, -3463, -1346, 3449 },
+ { -4245, -4445, -4743, 1644 },
+ { -4180, -3969, -401, 3281 },
+ { -2782, -5240, -4117, 1156 },
+ { -5744, -4040, -1439, 3470 },
+ { -5063, -4663, -323, 3172 },
+ { -4531, -3319, -844, 3988 },
+ { -6226, -5125, -2064, 2976 },
+ { -3115, -3267, -1531, 3898 },
+ { -4628, -4421, -2864, 2808 },
+ { -4559, -2989, -3442, 2024 },
+ { -1775, -4487, -656, 2477 },
+ { -2664, -1865, -1884, 4081 },
+ { -1828, -2575, -3894, 3378 },
+ { -6441, -3677, -2025, 1677 },
+ { -4141, -2156, -1191, 3474 },
+ { -4802, -1623, -1727, 2160 },
+ { -5474, -2745, -1475, 2498 },
+ { -3664, -1056, -1975, 2491 },
+ { -4672, -3062, -2235, 2933 },
+ { -4205, -5960, -2849, 1517 },
+ { -4995, -5708, -1739, 1805 },
+ { -4892, -6080, -4793, 872 },
+ { -4270, -4172, -4263, 2185 },
+ { -4687, -1470, -2905, 1023 },
+ { -6446, -5017, -3919, 1000 },
+ { -6046, -5538, -3943, 2006 },
+ { -6028, -3750, -3953, 771 },
+ { -5959, -4582, -5024, 824 },
+ { -5818, -2576, -2249, 1326 },
+ { -5659, -5345, -1119, 2500 },
+ { -3346, -4155, 606, 2749 },
+ { -5680, -4827, -2501, 1838 },
+ { -6193, -2543, -1295, 840 },
+ { -6871, -4925, -3512, 1801 },
+ { -5605, -1788, -1895, 779 },
+ { -3922, -5712, -4644, 510 },
+ { -4745, -3869, -4533, 99 },
+ { -2984, -4907, -399, 1497 },
+ { 1847, -478, 3061, -5812 },
+ { 4450, -1116, 3609, -6570 },
+ { 3139, 99, 3007, -5532 },
+ { 2590, -3782, 3138, -4770 },
+ { 1881, 1204, 5778, -3404 },
+ { 3631, 2060, 5566, -5038 },
+ { 3461, 1961, 5167, -3800 },
+ { 2947, 273, 4536, -4389 },
+ { 4453, -1730, 5788, -4370 },
+ { 4032, 1805, 2666, -4534 },
+ { 3487, -944, 2313, -6028 },
+ { 1313, 34, 4210, -4067 },
+ { 5632, -1502, 5825, -5855 },
+ { 7736, -547, 4879, -5476 },
+ { 4906, -1512, 4760, -5760 },
+ { 3843, 447, 1091, -4958 },
+ { 2982, -1135, 5442, -4386 },
+ { 3579, 271, 3031, -6770 },
+ { 3932, -211, 4688, -5507 },
+ { 4411, 1720, 2387, -5584 },
+ { 5379, -479, 4575, -6280 },
+ { 3613, -362, 2012, -4885 },
+ { 3744, -2013, 4493, -5073 },
+ { 5693, 109, 4379, -3362 },
+ { 5475, -621, 5317, -3985 },
+ { 6411, -673, 5708, -4752 },
+ { 4933, -796, 7262, -4290 },
+ { 2804, 444, 6276, -3655 },
+ { 4120, -517, 6078, -4531 },
+ { 5119, 841, 3486, -3910 },
+ { 4738, 1539, 3525, -2970 },
+ { 5086, 370, 5895, -5640 },
+ { 4235, 2716, 4589, -5044 },
+ { 3691, 682, 6199, -4700 },
+ { 6111, -570, 6271, -6528 },
+ { 2611, 1277, 3756, -4802 },
+ { 4395, 970, 3807, -5879 },
+ { 5225, 2299, 3242, -4333 },
+ { 5144, 1778, 4946, -5545 },
+ { 2989, -3016, 3247, -5495 },
+ { 2983, 920, 2071, -6059 },
+ { 5270, -903, 4434, -2350 },
+ { 6415, -585, 3970, -3554 },
+ { 3866, -197, 5216, -2884 },
+ { 3767, -1298, 6702, -3315 },
+ { 6299, 2620, 5284, -6824 },
+ { 6654, 646, 3653, -4927 },
+ { 4770, 3047, 5160, -6287 },
+ { 5364, 434, 2919, -5207 },
+ { 2998, 1344, 4801, -2456 },
+ { 3896, 1013, 3773, -1864 },
+ { 2115, 655, 2999, -6344 },
+ { 5170, -981, 2849, -4464 },
+ { 2735, -2159, 2717, -5776 },
+ { 2430, -1952, 4392, -4559 },
+ { 6143, -1180, 3659, -4746 },
+ { 4978, -1483, 1726, -4875 },
+ { 3486, -2383, 3306, -4301 },
+ { 1434, -1372, 4171, -4770 },
+ { 3354, -2627, 1525, -5093 },
+ { 6790, 2386, 3995, -5909 },
+ { 1475, -2674, 3451, -4204 },
+ { 1999, -3494, 3693, -5556 },
+ { 4764, -2848, 2856, -5589 },
+ { -3677, 5131, 2827, -2934 },
+ { -2844, 7078, 2852, -3580 },
+ { -3902, 6434, 4118, -1911 },
+ { -1769, 7530, 3492, -3541 },
+ { -1937, 5679, -447, -1127 },
+ { -2456, 4680, 4196, -2407 },
+ { -2778, 8241, 1698, -4288 },
+ { -2876, 6104, 5182, -2387 },
+ { -2802, 7341, 4463, -2938 },
+ { -1025, 6267, 4752, -3201 },
+ { -2349, 5413, 2041, -3794 },
+ { -2252, 8225, 2856, -4269 },
+ { -1465, 4967, 4976, -2500 },
+ { -636, 7565, 3517, -4233 },
+ { -1905, 5618, 3904, -2942 },
+ { -302, 6816, 3343, -3316 },
+ { -2210, 4156, 2817, -3511 },
+ { -717, 6568, 1863, -2951 },
+ { -3873, 5682, 2164, -575 },
+ { -2878, 5835, 440, -2597 },
+ { -3228, 7701, 2610, -2514 },
+ { -3608, 8888, 3377, -2468 },
+ { -2582, 9717, 2519, -3126 },
+ { -5238, 6202, 2866, -2831 },
+ { -3428, 7370, 3056, -335 },
+ { -1681, 8836, 1210, -2010 },
+ { -3276, 6724, 1156, -3930 },
+ { -894, 8149, 827, -1258 },
+ { -2965, 8631, 2549, -1320 },
+ { -3961, 6902, 3581, 55 },
+ { -1894, 7745, 1750, -841 },
+ { -821, 6844, 850, -676 },
+ { -608, 6948, -4, -1376 },
+ { 615, 6524, 1089, -1147 },
+ { -2972, 5668, 1091, -489 },
+ { -157, 4649, 2904, -413 },
+ { 673, 5121, 1498, -66 },
+ { -390, 5902, 1611, -245 },
+ { -2349, 5478, 4772, -1320 },
+ { 88, 6798, 1972, -1859 },
+ { -1213, 5120, 2991, 200 },
+ { -2347, 6040, 2839, 376 },
+ { -578, 5976, 3364, -1796 },
+ { -1391, 5872, 3002, -965 },
+ { -564, 4496, 3946, -1186 },
+ { -2299, 6386, 3135, -2176 },
+ { -2131, 5641, 2011, 1223 },
+ { -772, 5807, 1124, 895 },
+ { -2837, 6758, 2297, -740 },
+ { -3091, 6298, 1415, -2126 },
+ { -4197, 6036, 1843, -3022 },
+ { -41, 6459, 92, 344 },
+ { -2241, 6860, 2095, -4396 },
+ { -1931, 7088, 2117, -2135 },
+ { -2375, 4422, 1688, -3169 },
+ { -1742, 6674, 1538, -119 },
+ { -4818, 7749, 4192, -1577 },
+ { -2004, 5672, 193, -430 },
+ { -3825, 6042, 2128, -1898 },
+ { -1108, 8033, 2119, -3013 },
+ { -2370, 5453, 1721, 266 },
+ { -1570, 7134, 614, -2638 },
+ { -1519, 8752, 3503, -4330 },
+ { -2050, 3845, 2907, -1126 },
+ { 5085, 4412, -335, -1923 },
+ { 3618, 1423, -613, -4012 },
+ { 4481, 3729, 589, -4631 },
+ { 4270, 3216, -1763, -3168 },
+ { 4241, 1796, -1701, -2796 },
+ { 4787, 2338, -487, -3639 },
+ { 2915, 3429, -621, -4753 },
+ { 5175, 1660, -1265, -3223 },
+ { 4280, 4057, -684, -4079 },
+ { 4980, 4419, -1455, -2719 },
+ { 5436, 2464, 387, -4197 },
+ { 4507, 4018, 1121, -3314 },
+ { 6020, 2401, -413, -3201 },
+ { 4200, 3789, -333, -2813 },
+ { 5229, 2493, -1194, -1878 },
+ { 5851, 2695, -492, -2292 },
+ { 5743, 3288, -697, -1221 },
+ { 5692, 2612, 979, -2227 },
+ { 5085, 2067, 1046, -1214 },
+ { 3163, 2240, -2098, -3435 },
+ { 5228, 1898, 145, -2397 },
+ { 5860, 3976, -418, -2872 },
+ { 6008, 3399, 1027, -3506 },
+ { 4126, 2035, 1865, -893 },
+ { 5375, 3596, 511, -2362 },
+ { 1937, 1493, -852, -122 },
+ { 3473, 4849, 547, -2603 },
+ { 4631, 2977, 1141, -1768 },
+ { 6149, 3050, -71, -1886 },
+ { 4069, 4353, -289, -1429 },
+ { 2884, 1225, -1388, 365 },
+ { 5485, 2518, -235, -571 },
+ { 1216, 4375, 1443, 398 },
+ { 4988, 3106, 107, -1435 },
+ { 4511, 2801, 307, -444 },
+ { 3235, 4386, 327, -676 },
+ { 2055, 3708, 1657, -305 },
+ { 5839, 2374, 290, -1385 },
+ { 5110, 3305, 1936, -4206 },
+ { 6416, 2920, 338, -2736 },
+ { 3350, 2824, -1269, -3881 },
+ { 4840, 1815, 464, 186 },
+ { 2399, 3332, 238, 1238 },
+ { 3516, 1363, 1582, 688 },
+ { 3582, 1874, 154, -4770 },
+ { 3261, 2878, 886, 283 },
+ { 3877, 2658, -327, 884 },
+ { 4151, 3436, 2173, -2923 },
+ { 3592, 3674, 1281, -1295 },
+ { 4561, 3730, -1114, -1747 },
+ { 4595, 3625, -558, -575 },
+ { 2577, 2348, 2267, 120 },
+ { 5242, 3299, 32, -3412 },
+ { 4264, 3637, 709, -2320 },
+ { 6556, 3570, -838, -2472 },
+ { 5745, 4014, -940, -1973 },
+ { 5629, 4475, 477, -3328 },
+ { 5269, 3199, 1682, -3085 },
+ { 4432, 2416, 1145, -3299 },
+ { 4465, 2505, 2162, -2186 },
+ { 4643, 4941, -88, -2885 },
+ { 4568, 5231, 552, -3915 },
+ { 5667, 3075, -1406, -2963 },
+ { 5418, 5259, -771, -2818 },
+ { -256, -7875, 511, -471 },
+ { -1813, -7971, -424, -396 },
+ { -306, -7006, 862, 282 },
+ { -2306, -6422, -1440, 508 },
+ { -245, -6787, 375, -100 },
+ { -1309, -6065, -20, 779 },
+ { -1656, -6047, -641, 1307 },
+ { -1496, -6522, 964, 726 },
+ { -2291, -6588, -202, 795 },
+ { -762, -7522, 1454, -558 },
+ { -2270, -7004, -834, -580 },
+ { -1139, -7078, 259, 362 },
+ { -2535, -7568, -1040, 49 },
+ { -3786, -7280, 934, -476 },
+ { -3336, -6368, 606, 1056 },
+ { -3602, -6924, 52, 714 },
+ { -2278, -6550, 1674, 204 },
+ { -2855, -5765, 930, 1530 },
+ { -2889, -7325, -215, 305 },
+ { -2749, -6080, -237, 1452 },
+ { -985, -6667, 1577, 400 },
+ { -2036, -6083, 380, 1267 },
+ { -2077, -7460, 380, -30 },
+ { -1775, -7175, 1540, -386 },
+ { -3065, -6927, 989, 168 },
+ { -2836, -7602, 117, -3392 },
+ { -1058, -6396, 593, -3078 },
+ { -844, -6062, 999, -236 },
+ { -3261, -6951, 1491, -720 },
+ { -2186, -8484, 75, -1287 },
+ { -2882, -7756, 456, -510 },
+ { -1800, -6879, 960, -1183 },
+ { -2554, -7241, 1614, -1474 },
+ { -2608, -5305, 392, 851 },
+ { -2973, -6562, -859, 858 },
+ { -2640, -5989, 1031, -416 },
+ { -977, -8366, 705, -1434 },
+ { -1213, -7409, -77, -1390 },
+ { -1335, -6657, 2125, -123 },
+ { -2544, -6862, 1852, -737 },
+ { -3235, -6422, 1752, -103 },
+ { -1300, -7557, 939, -348 },
+ { -3476, -7579, 202, -109 },
+ { -2482, -6572, 753, 619 },
+ { -2554, -8136, -648, -429 },
+ { -1012, -7870, -3, -421 },
+ { -3604, -6247, 32, -3102 },
+ { -1486, -7271, 2013, -1021 },
+ { -578, -6799, -523, 405 },
+ { -2841, -5948, 1644, 911 },
+ { -2411, -7473, 1084, -484 },
+ { -2238, -6033, 294, -1059 },
+ { -3459, -6470, -201, -790 },
+ { -2027, -6009, 1833, 805 },
+ { -1433, -8047, 1531, -1754 },
+ { -3258, -7884, 763, -1422 },
+ { -1544, -6928, -729, 478 },
+ { -2314, -8415, 74, -3757 },
+ { -3201, -5684, 95, -2214 },
+ { -2423, -8694, 725, -3631 },
+ { -3545, -7071, 1162, -1798 },
+ { -294, -9662, 403, -2274 },
+ { -2290, -5460, 1196, 402 },
+ { -1603, -6713, 903, -2363 },
+ { 4121, 2491, -3142, -2482 },
+ { 4500, 3305, -3671, -1567 },
+ { 5973, 3172, -1348, -534 },
+ { 4830, 3379, -1549, 643 },
+ { 5214, 3938, -2641, -2302 },
+ { 4639, 4826, -5532, -847 },
+ { 5639, 2731, -2170, -963 },
+ { 6084, 3487, -3525, -1346 },
+ { 5971, 3154, -2190, -2316 },
+ { 5618, 4865, -6927, 116 },
+ { 5345, 3568, -7391, 709 },
+ { 5429, 5078, -3811, -1524 },
+ { 6960, 2037, -3515, -1096 },
+ { 7092, 2531, -4557, -588 },
+ { 6061, 4247, -5651, -478 },
+ { 4595, 3684, -4907, -827 },
+ { 7497, 3213, -3048, -424 },
+ { 5996, 2137, -3098, -1745 },
+ { 6198, 5199, -2223, -2274 },
+ { 6888, 2851, -2768, -1675 },
+ { 6114, 4210, -2316, -954 },
+ { 7127, 4242, -3041, -1408 },
+ { 6126, 3668, -1517, -1427 },
+ { 6245, 6129, -4225, -1186 },
+ { 6816, 3213, -2101, -964 },
+ { 5345, 5276, -2643, -847 },
+ { 6592, 4665, -4338, 484 },
+ { 6746, 3751, -3443, 124 },
+ { 5453, 1980, -2738, 2606 },
+ { 4662, 2179, -4226, -1059 },
+ { 5571, 3208, -3554, 174 },
+ { 5256, 4447, -1815, -1481 },
+ { 5400, 2570, -1210, 235 },
+ { 7056, 2549, -2674, 318 },
+ { 4574, 4340, -2892, -130 },
+ { 6203, 4587, -3273, -305 },
+ { 5103, 1925, -2715, -2137 },
+ { 3905, 4296, -1700, 247 },
+ { 4421, 4605, -3299, 811 },
+ { 5671, 1273, -3870, -924 },
+ { 5486, 1805, -4901, 133 },
+ { 6437, 2578, -1828, -106 },
+ { 5530, 5253, -5058, 1223 },
+ { 4816, 2025, -1215, 1443 },
+ { 3457, 3525, -2456, 3217 },
+ { 3316, 2595, -1108, 2459 },
+ { 3068, 3810, -2207, 1926 },
+ { 6351, 5436, -6470, 600 },
+ { 6324, 4240, -5365, 2416 },
+ { 4851, 4774, -4075, 1878 },
+ { 4900, 3679, -5198, 1078 },
+ { 8347, 3633, -4565, -171 },
+ { 5244, 5718, -3853, 173 },
+ { 3960, 3492, -2939, 2105 },
+ { 6070, 3473, -2351, 161 },
+ { 8228, 3034, -3360, -901 },
+ { 7006, 3985, -1940, -1926 },
+ { 7123, 4681, -4301, -878 },
+ { 5122, 4097, -1851, -449 },
+ { 6200, 2060, -2251, 1049 },
+ { 7106, 3844, -7209, 2625 },
+ { 7108, 3370, -6734, 533 },
+ { 6859, 2849, -3992, 1360 },
+ { 5458, 2278, -3253, 1131 },
+ { -1072, -2109, 4783, -1073 },
+ { -319, -2604, 4257, -2418 },
+ { 2466, 1300, 3476, -314 },
+ { 2847, -1502, 5296, -141 },
+ { 1667, -1273, 5559, -2725 },
+ { 2877, -3402, 6434, 204 },
+ { 53, -2637, 5275, -1181 },
+ { 1091, -2215, 5803, -1549 },
+ { 2397, -922, 4327, 1182 },
+ { 219, -3747, 4647, -1564 },
+ { -29, -2705, 4812, 1277 },
+ { 1499, -2608, 5648, 1407 },
+ { 2139, -2399, 4202, 2791 },
+ { -426, -2064, 5528, 151 },
+ { 2560, -2803, 6179, -2806 },
+ { 4537, -2479, 3797, 1095 },
+ { 888, -3357, 5341, -415 },
+ { 4460, -1814, 5388, -1227 },
+ { 3920, -3268, 6364, -703 },
+ { 3343, -4698, 4410, 784 },
+ { 309, -1897, 6306, 1223 },
+ { 958, -3318, 4254, -3167 },
+ { -99, 1596, 6018, -1983 },
+ { -429, -853, 6407, 878 },
+ { 1170, -1322, 6290, -417 },
+ { 2288, -505, 6303, -1999 },
+ { 3312, -1674, 6749, -2494 },
+ { -415, -3401, 4721, -371 },
+ { -189, -1210, 4844, -2002 },
+ { 888, -4142, 4377, 130 },
+ { 2469, -4381, 5398, -2492 },
+ { 2879, -2912, 5094, -2598 },
+ { -717, -617, 5650, -685 },
+ { 1470, -3863, 5352, -1684 },
+ { 3935, -96, 3823, -730 },
+ { 3769, -430, 3168, 694 },
+ { 2556, 385, 3539, 512 },
+ { 77, -1415, 5111, 2655 },
+ { 2724, -2158, 6715, -822 },
+ { 1832, 1001, 5385, -1900 },
+ { 900, 2198, 4464, -559 },
+ { 441, 69, 5921, -1743 },
+ { -1161, 738, 6732, -308 },
+ { 257, 2035, 4091, 736 },
+ { 1607, 1288, 4355, -23 },
+ { -13, 1316, 4180, 1672 },
+ { 1511, 1336, 3057, 1435 },
+ { 2189, -3813, 4530, 939 },
+ { 3632, -706, 2646, 1375 },
+ { 4266, -3761, 4241, 1077 },
+ { 3101, -427, 5273, -1202 },
+ { 2293, 276, 4810, -313 },
+ { 3430, -1851, 3101, 2045 },
+ { 3453, -2979, 5142, 942 },
+ { 1683, -3281, 4802, 2002 },
+ { 3954, -4715, 5611, 578 },
+ { 1272, -155, 5085, 454 },
+ { 128, -194, 5095, 1409 },
+ { 820, 880, 5797, -2658 },
+ { -1095, 656, 5774, 1095 },
+ { 813, -1669, 4320, -3251 },
+ { -119, 518, 6372, -651 },
+ { 2922, -4299, 6115, -877 },
+ { 4205, -4273, 4004, 2642 },
+ { -1211, -3892, 224, 3127 },
+ { -34, -4371, 1321, 2318 },
+ { 77, -6326, 1201, 828 },
+ { 3995, -3775, 1958, 3233 },
+ { 178, -3301, 1985, 3318 },
+ { 2330, -3801, 1033, 3195 },
+ { 1413, -5536, 826, 1709 },
+ { 2468, -3499, 3653, 3631 },
+ { 741, -4617, 1723, 2008 },
+ { 1246, -3043, 2978, 3949 },
+ { -343, -4308, 2258, 2189 },
+ { -682, -4640, 454, 2272 },
+ { 1236, -4829, 2491, 1642 },
+ { -512, -3766, 1182, 3052 },
+ { 119, -3939, 3712, 971 },
+ { -1145, -4624, 1360, 2281 },
+ { 101, -4746, 2866, 1255 },
+ { -1500, -5455, 539, 1637 },
+ { -969, -5909, 1414, 1128 },
+ { -1261, -4939, -231, 2022 },
+ { -226, -5345, 1207, 705 },
+ { 2712, -5109, 3205, 1866 },
+ { -476, -5913, 273, 1208 },
+ { -2039, -4464, 624, 2545 },
+ { -2351, -3930, 2019, 2673 },
+ { -2675, -4849, 1522, 1990 },
+ { -1524, -3461, 1446, 3204 },
+ { 477, -5314, 1710, 1577 },
+ { 656, -3729, 2346, 2511 },
+ { 550, -5917, 1975, 1040 },
+ { 1728, -4704, 3067, 1058 },
+ { -9, -5247, 506, 1760 },
+ { -574, -5135, 1675, 1672 },
+ { 2129, -3781, 3444, 2313 },
+ { 1144, -4439, 2214, 2529 },
+ { 1292, -4160, 3185, 1833 },
+ { 2445, -3262, 2534, 3227 },
+ { 2266, -4401, 2023, 2400 },
+ { -587, -3602, 3408, 2067 },
+ { -885, -4951, 3228, 1174 },
+ { -728, -2711, 2807, 3552 },
+ { 1019, -3043, 3195, 2954 },
+ { 1888, -4615, 1140, 2454 },
+ { 660, -5616, 754, 800 },
+ { -1975, -5371, 1649, 1585 },
+ { -1544, -5436, 2422, 1081 },
+ { -422, -5882, 2390, 750 },
+ { 1336, -5557, 2441, 1230 },
+ { 136, -4001, 267, 2854 },
+ { -522, -3289, 2226, 2728 },
+ { -971, -4580, 2471, 708 },
+ { 704, -5306, 3300, 1001 },
+ { 325, -3464, 3555, 2398 },
+ { 794, -3686, 848, 3169 },
+ { 660, -3017, 4584, 3242 },
+ { -1486, -3978, 2170, 1644 },
+ { -1615, -4650, 2688, 1844 },
+ { 750, -4578, 538, 2239 },
+ { 1668, -5849, 1455, 1031 },
+ { 3486, -4681, 2030, 2183 },
+ { 2642, -5429, 1696, 1761 },
+ { 4491, -4502, 3538, 2767 },
+ { 3545, -4528, 3514, 2982 },
+ { 3269, -3676, 2758, 3966 },
+ { 5572, 1146, 209, -3379 },
+ { 7459, 1053, 593, -1896 },
+ { 4480, 200, -310, -4259 },
+ { 5577, -939, 242, -3992 },
+ { 8142, 442, 1257, -3083 },
+ { 5442, 1261, 1424, -3236 },
+ { 6260, -183, 3125, -2532 },
+ { 7179, 889, 1618, -2548 },
+ { 6416, 932, 2379, -2487 },
+ { 7094, 2560, 961, -3392 },
+ { 7322, 463, 2732, -3735 },
+ { 6632, 1577, 1912, -3272 },
+ { 6312, 1349, 3028, -3460 },
+ { 6105, 386, 1213, -977 },
+ { 5478, 1158, 1114, -486 },
+ { 6493, 410, 1686, -2180 },
+ { 6378, 1881, 1333, -2240 },
+ { 5711, 812, 1958, -1300 },
+ { 6844, 877, 730, -1189 },
+ { 6824, -245, 2249, -2000 },
+ { 7515, 1521, 1251, -3058 },
+ { 6697, 1051, 1300, -1749 },
+ { 6476, 1425, 811, -2773 },
+ { 7350, 465, -76, -2849 },
+ { 6975, 2095, 567, -2492 },
+ { 4691, 1736, 2660, -2289 },
+ { 7837, 1456, 340, -2767 },
+ { 7930, 507, 838, -2074 },
+ { 6106, 1502, 766, -1110 },
+ { 4891, -659, 835, -3954 },
+ { 7250, 141, 1369, -1523 },
+ { 7651, 67, 1651, -2298 },
+ { 7364, -305, 601, -3132 },
+ { 7179, 193, 2491, -2871 },
+ { 6504, -272, 2167, -1322 },
+ { 4456, 983, 2300, -421 },
+ { 4817, 457, 1695, 371 },
+ { 6914, 555, 850, -3159 },
+ { 5904, 1030, 202, -1959 },
+ { 6258, 880, 2233, -4503 },
+ { 6029, 10, 2130, -3600 },
+ { 6449, 985, 1129, -3963 },
+ { 6616, -18, -111, -3285 },
+ { 4496, 775, 817, -4276 },
+ { 6134, 2338, 1470, -2973 },
+ { 6911, 152, 430, -1946 },
+ { 4053, 991, 3218, -1193 },
+ { 5435, 1285, 3124, -2412 },
+ { 5507, 1836, 1935, -1988 },
+ { 5240, 689, 2189, -2670 },
+ { 6638, 1719, 606, -1799 },
+ { 5556, -180, 129, -2595 },
+ { 5644, 1918, 1281, -4316 },
+ { 6410, 1088, -282, -3117 },
+ { 6503, 1841, 312, -3514 },
+ { 6947, 20, 1358, -3886 },
+ { 5464, 2109, 2398, -3194 },
+ { 5616, -407, 2140, -498 },
+ { 6121, 2707, 2379, -4096 },
+ { 7303, 1846, 2266, -4095 },
+ { 5444, 470, 2718, -1553 },
+ { 5817, -645, 3285, -1349 },
+ { 5625, 1427, 1103, -1991 },
+ { 6041, -806, 1196, -2943 },
+ { 3050, -5722, 4070, -5460 },
+ { 3420, -4386, 4078, -5155 },
+ { 6020, -3982, 7268, -2689 },
+ { 7502, -4317, 7894, -3973 },
+ { 4156, -3558, 5247, -4316 },
+ { 4725, -4401, 7290, -1540 },
+ { 6688, -5122, 8216, -3210 },
+ { 9176, -6576, 9276, -4963 },
+ { 8706, -5708, 7987, -4621 },
+ { 7060, -3535, 6532, -3308 },
+ { 5600, -2719, 5363, -1568 },
+ { 4661, -2803, 6263, -4716 },
+ { 3673, -3636, 6147, -3433 },
+ { 5305, -2585, 6073, -2638 },
+ { 7614, -1962, 6079, -5266 },
+ { 6760, -3366, 7382, -4322 },
+ { 6385, -3883, 4797, -1353 },
+ { 8182, -5120, 4298, -4641 },
+ { 9130, -6198, 4975, -3063 },
+ { 7421, -5436, 5576, -3713 },
+ { 3483, -4898, 5443, -2745 },
+ { 4907, -5643, 6390, -4105 },
+ { 8119, -7008, 7992, -6764 },
+ { 6528, -6122, 6967, -5590 },
+ { 5890, -4190, 6624, -5688 },
+ { 6815, -7934, 7275, -5456 },
+ { 5434, -4306, 5169, -5378 },
+ { 4364, -6436, 5376, -2604 },
+ { 8152, -3404, 5913, -5048 },
+ { 7983, -4863, 4262, -2461 },
+ { 8023, -6188, 6238, -5062 },
+ { 6753, -3692, 3935, -3723 },
+ { 6826, -4760, 3284, -4051 },
+ { 7224, -7423, 4492, -3875 },
+ { 6904, -2590, 6587, -6248 },
+ { 6106, -1944, 7345, -5506 },
+ { 4956, -2990, 7808, -3146 },
+ { 6908, -6885, 5949, -1288 },
+ { 7162, -6058, 3419, -3401 },
+ { 7015, -7080, 6907, -3018 },
+ { 6971, -6832, 5646, -3273 },
+ { 8014, -5546, 5471, -1544 },
+ { 6792, -2220, 5105, -2879 },
+ { 8494, -3974, 4408, -3999 },
+ { 9591, -4866, 6027, -4558 },
+ { 5264, -5161, 6101, -738 },
+ { 5803, -6141, 5197, -5231 },
+ { 4657, -6822, 3232, -5189 },
+ { 4791, -5135, 3809, -4665 },
+ { 6108, -5103, 2379, -3873 },
+ { 4680, -3909, 3234, -5093 },
+ { 5802, -3853, 3795, -4984 },
+ { 4360, -7483, 4802, -3877 },
+ { 5429, -7517, 5911, -3717 },
+ { 6866, -2280, 4880, -4634 },
+ { 10131, -4628, 4414, -4092 },
+ { 10811, -5189, 7746, -5337 },
+ { 5663, -8941, 5287, -5680 },
+ { 8023, -5991, 7403, -2796 },
+ { 9669, -6919, 6525, -4932 },
+ { 7275, -3796, 4962, -2547 },
+ { 8848, -4806, 5677, -3080 },
+ { 8128, -4308, 7749, -6569 },
+ { 4032, -5196, 2282, -6239 },
+ { 6593, 700, -229, 304 },
+ { 8260, 539, -66, -1259 },
+ { 6605, 176, -814, -109 },
+ { 8057, 0, -1, -136 },
+ { 7382, -38, -484, -1129 },
+ { 8373, -929, 682, -454 },
+ { 7674, 690, -1278, 546 },
+ { 7326, -517, 406, -1283 },
+ { 7612, -1715, -1167, 1175 },
+ { 8590, 441, -782, -710 },
+ { 8572, -1202, -291, 260 },
+ { 7308, -147, -1785, 414 },
+ { 6787, -353, -672, 934 },
+ { 5177, -133, 179, 82 },
+ { 4161, -34, 447, 1497 },
+ { 5997, -902, 1533, -121 },
+ { 5727, -871, -1370, 945 },
+ { 8386, -252, 293, -823 },
+ { 6573, -1354, 682, 616 },
+ { 7650, -2096, 725, 457 },
+ { 8122, 78, 636, -1400 },
+ { 8421, 428, -1620, 131 },
+ { 7341, -1292, -717, 186 },
+ { 7998, -49, -720, 266 },
+ { 5987, -351, 669, 844 },
+ { 7314, -1620, 250, -603 },
+ { 7219, -1562, -572, 1994 },
+ { 8682, -358, -290, -388 },
+ { 5810, 155, -178, 1199 },
+ { 7246, -12, 1042, -786 },
+ { 7357, -923, 1468, -475 },
+ { 7801, 621, -212, -724 },
+ { 5346, -514, 1210, 1356 },
+ { 8459, 36, -127, -779 },
+ { 6878, -2429, 854, 1750 },
+ { 7280, -1401, -1353, 2845 },
+ { 7579, -2148, -1463, 2087 },
+ { 6637, 946, -872, 750 },
+ { 4807, -1100, 1289, 2602 },
+ { 4495, 219, 1551, 1128 },
+ { 7639, 506, 446, -1107 },
+ { 6359, 188, 1009, -115 },
+ { 6641, -1820, 1655, 723 },
+ { 5394, -2382, 1604, 2542 },
+ { 6021, -2644, 2396, 1407 },
+ { 4698, 882, 245, 1525 },
+ { 8103, 573, -798, -349 },
+ { 8045, -519, 997, -1092 },
+ { 7571, -122, 227, -338 },
+ { 5347, -1200, 630, 1718 },
+ { 7070, 790, 218, -544 },
+ { 7440, 728, -527, -20 },
+ { 6402, -355, 197, -736 },
+ { 4031, 771, 866, 1895 },
+ { 6009, 896, 445, -31 },
+ { 5160, 1098, -856, 1784 },
+ { 7980, -886, -1293, 1396 },
+ { 6318, -1361, 2423, 252 },
+ { 7547, -699, 133, 506 },
+ { 8562, -2344, 940, 264 },
+ { 5890, 1187, -1425, 2194 },
+ { 6558, -645, -1311, 2621 },
+ { 4634, -1671, 2075, 1623 },
+ { 5614, 105, -816, 2376 },
+ { 6646, 1558, -1365, 630 },
+ { 6998, 1150, -2117, -990 },
+ { 6555, 2311, -1093, -1783 },
+ { 6682, 1430, -2391, -1940 },
+ { 7861, 1555, -2977, -1188 },
+ { 6745, 1723, -459, -2085 },
+ { 7504, 1229, -1666, -2060 },
+ { 7937, 671, -2128, -1529 },
+ { 7139, 991, -735, -2632 },
+ { 6867, 1592, -1303, -2324 },
+ { 6401, 2230, -1732, -2508 },
+ { 7201, 2184, -2169, -1988 },
+ { 6636, 2190, -995, -2840 },
+ { 7620, 2306, -2089, -651 },
+ { 7584, 1875, -1438, -631 },
+ { 9214, 1561, -2464, -1139 },
+ { 6154, 1318, -1237, -2917 },
+ { 7917, 2847, -1797, -1599 },
+ { 8309, 2029, -2555, -465 },
+ { 8204, 1282, -584, -2405 },
+ { 8440, 1035, -1147, -1137 },
+ { 7107, 1858, -60, -1568 },
+ { 6781, 2912, -873, -1463 },
+ { 7603, 1316, -319, -1249 },
+ { 7833, 1335, -78, -1849 },
+ { 7930, 1141, -1016, -695 },
+ { 7883, 1610, -1017, -1314 },
+ { 8069, 1409, -1811, -196 },
+ { 8319, 1031, -582, -1590 },
+ { 5948, 1537, -2153, -2373 },
+ { 8684, 1171, -1871, -850 },
+ { 8357, 2484, -2411, -1292 },
+ { 6516, 2092, -193, -1167 },
+ { 6112, 1697, 22, -525 },
+ { 7161, 703, -602, -1879 },
+ { 6047, 2351, -807, -219 },
+ { 8072, 1854, -1817, -1553 },
+ { 6956, 1304, 76, -1011 },
+ { 6607, 1481, -544, -162 },
+ { 6958, 2541, -265, -1938 },
+ { 6416, 2514, -777, -850 },
+ { 7272, 2110, -899, -1171 },
+ { 7741, 2153, -283, -2614 },
+ { 6482, 2041, -1758, -1221 },
+ { 6762, 940, -1862, -2281 },
+ { 5610, 1194, -1691, -1561 },
+ { 7833, 2164, -823, -1952 },
+ { 5460, 1438, -848, 1189 },
+ { 6011, 1377, -771, -1557 },
+ { 7679, 544, -1134, -2214 },
+ { 7209, 1292, -2714, -1564 },
+ { 5567, 1200, -404, -169 },
+ { 5853, 1461, -1465, -518 },
+ { 6782, 689, -844, -860 },
+ { 7330, 1337, -1152, -71 },
+ { 7189, 1506, -653, -685 },
+ { 6860, 2116, -1403, -240 },
+ { 8804, 1516, -1391, -1760 },
+ { 7210, 2689, -1498, -989 },
+ { 7030, 3022, -1441, -2083 },
+ { 5649, 1836, -407, 525 },
+ { 7451, 3099, -717, -2464 },
+ { 7384, 1656, -2007, 398 },
+ { 6504, 707, -1919, -134 },
+ { -1851, 3639, -2279, -695 },
+ { -4037, 1644, -77, 1329 },
+ { -4025, 1960, -1565, -567 },
+ { -3430, 2495, -795, 368 },
+ { -4771, 2480, 993, 756 },
+ { -3431, 2058, -2539, -971 },
+ { -3802, 3418, 380, 217 },
+ { -3074, 3350, -1652, -1056 },
+ { -3705, 326, -1650, 1535 },
+ { -3122, 1281, -1192, 1607 },
+ { -4601, 1367, -968, 53 },
+ { -3808, 958, 44, 2560 },
+ { -2079, 2530, -1485, 1166 },
+ { -3707, 343, -2889, 180 },
+ { -5249, 1431, -31, 688 },
+ { -4990, 125, -704, 1270 },
+ { -2771, 1334, -2446, 746 },
+ { -2292, 994, -1527, 2630 },
+ { -1261, 3070, -2519, 268 },
+ { -2544, 3890, -1057, -552 },
+ { -4421, 255, -1980, 530 },
+ { -2951, 454, -13, 3643 },
+ { -2262, 1815, -370, 2880 },
+ { -2383, 3657, -649, 576 },
+ { -3541, -161, -1389, 2550 },
+ { -4241, 1575, 1325, 2561 },
+ { -2767, 4037, 1221, 1578 },
+ { -3748, 2697, 1148, 1801 },
+ { -4686, 2385, -220, 0 },
+ { -1531, 1645, -2751, 1327 },
+ { -45, 4032, -799, 2298 },
+ { -2915, 2280, 709, 2495 },
+ { -1199, 3278, -406, 2346 },
+ { -2471, 116, -2706, 2060 },
+ { -2440, 2173, -2894, -344 },
+ { -3375, 2287, 1781, 3226 },
+ { -2153, 3568, 1827, 2918 },
+ { -862, 2267, -1626, 2527 },
+ { -2698, 1135, 301, 4239 },
+ { -2364, 2123, 1010, 3710 },
+ { -2447, 3281, -81, 1408 },
+ { -2660, 4735, 472, 258 },
+ { -1053, 3097, 2682, 2398 },
+ { -3366, -1037, -1152, -868 },
+ { -643, 4242, 2212, 1259 },
+ { 971, 3991, 934, 643 },
+ { -1617, 2002, 2139, 2195 },
+ { -4897, 972, 784, 1719 },
+ { -1275, 2992, 1039, 3821 },
+ { -392, 4973, -209, 1821 },
+ { -1028, 4718, -1479, -137 },
+ { 50, 3914, 553, 2210 },
+ { 678, 4364, 359, 1303 },
+ { -582, 4911, 514, 1671 },
+ { 1276, 3914, -1252, 2934 },
+ { -1496, 3984, 857, 2330 },
+ { 772, 4744, -655, 2332 },
+ { -799, 5283, -439, 624 },
+ { 1341, 2937, 650, 2027 },
+ { -1739, 4892, 1275, 1702 },
+ { -892, 2596, -151, 3951 },
+ { -3532, 1090, 1292, 32 },
+ { 321, 3146, 2647, 1475 },
+ { 264, 4199, -1591, 1317 },
+ { -452, -2357, 2266, 4192 },
+ { 3022, -1033, -2389, 5678 },
+ { -1162, -1342, 3543, 4990 },
+ { -474, -1477, -1223, 5016 },
+ { -699, -2857, 900, 3835 },
+ { -461, -2255, -117, 4626 },
+ { 1204, -2062, -1211, 4403 },
+ { 2192, -3035, -337, 3966 },
+ { 108, -831, 279, 5643 },
+ { 1457, -620, -2908, 5276 },
+ { -2527, -78, 1085, 5460 },
+ { -1978, -1918, -949, 4733 },
+ { 32, 367, -1904, 5166 },
+ { 1890, -1665, 440, 4752 },
+ { -518, -348, 2816, 4891 },
+ { 3695, -2490, -1374, 4603 },
+ { 246, -1965, 3549, 3969 },
+ { 1100, -3111, 656, 3737 },
+ { -1379, 870, -414, 4575 },
+ { 628, -357, -1227, 6179 },
+ { -1129, -1318, -2457, 4576 },
+ { -425, -98, -73, 6336 },
+ { 367, -887, 2990, 4207 },
+ { 2091, -1251, 2444, 3557 },
+ { -1759, -1610, 2046, 5273 },
+ { 3210, 1414, -20, 2616 },
+ { 3303, -2636, 1005, 4237 },
+ { -327, -3107, -640, 3687 },
+ { -197, 764, 572, 5486 },
+ { 646, -767, 1388, 5464 },
+ { 104, 2742, -228, 3907 },
+ { -236, 1829, -579, 4585 },
+ { -2150, -474, -1525, 4006 },
+ { -23, -2632, -2400, 3892 },
+ { -12, -1739, -2910, 4867 },
+ { -2310, -368, -102, 4583 },
+ { -1991, -2061, 533, 4531 },
+ { 3884, -1446, -153, 4393 },
+ { 1568, 14, -289, 5268 },
+ { -1376, -253, -2797, 3417 },
+ { 3193, -2577, 2475, 3566 },
+ { 3418, 617, 1350, 1857 },
+ { 3792, -24, -272, 3370 },
+ { 153, 1159, 2906, 2877 },
+ { 511, 2162, 1548, 2741 },
+ { 262, 819, -2791, 3734 },
+ { 4232, -2015, 1486, 3477 },
+ { 2943, -1110, -1014, 5480 },
+ { 2842, 369, 703, 3476 },
+ { 3011, 1634, -933, 3553 },
+ { 4412, -1548, -942, 5021 },
+ { -1405, 593, 2372, 5267 },
+ { 2093, 2129, 896, 2365 },
+ { 4845, -1980, 0, 3823 },
+ { -2140, 81, 3278, 5637 },
+ { 1484, 2665, -324, 3653 },
+ { 10, 192, 1620, 5291 },
+ { 2152, 738, -2269, 5000 },
+ { 2102, 2748, -1652, 4707 },
+ { 2855, -2131, -387, 5188 },
+ { 1173, 676, 1338, 3277 },
+ { 2340, -2329, -2064, 4095 },
+ { 861, -2024, 1296, 5055 },
+ { 2189, 3225, -695, 2626 },
+ { 6196, -7079, 1943, -822 },
+ { 4547, -4813, 3261, 1856 },
+ { 4243, -6904, 3443, 448 },
+ { 4581, -7503, 946, 506 },
+ { 6626, -7754, 3427, 470 },
+ { 3407, -9088, 3269, -1496 },
+ { 4079, -6464, 2304, 777 },
+ { 5621, -9336, 2684, -768 },
+ { 5351, -6464, 5238, -214 },
+ { 5961, -8007, 1724, -3091 },
+ { 4213, -8067, 603, -246 },
+ { 7208, -7403, 3168, -1738 },
+ { 6098, -7700, 329, -1379 },
+ { 6525, -6735, 4248, -1072 },
+ { 6073, -6241, 2167, -2378 },
+ { 4609, -9218, 3051, -1033 },
+ { 6813, -7283, 1581, -1897 },
+ { 6126, -6275, 2789, 681 },
+ { 4423, -6538, 1621, -1692 },
+ { 6272, -8298, 3167, -1855 },
+ { 6172, -8558, 4498, -1169 },
+ { 4844, -8588, 1647, -366 },
+ { 6209, -8807, 1581, -369 },
+ { 5389, -8059, 550, -192 },
+ { 6654, -9775, 2504, -1063 },
+ { 7103, -7998, 806, 530 },
+ { 5662, -6736, 1565, -3620 },
+ { 4165, -9564, 4191, -2131 },
+ { 4526, -7181, 576, -2875 },
+ { 4633, -8623, 2807, -4742 },
+ { 3709, -7794, 1815, 34 },
+ { 3634, -8622, 2313, -826 },
+ { 6991, -8447, 2063, -3198 },
+ { 7757, -9486, 2255, -558 },
+ { 4149, -7778, 4728, -1696 },
+ { 5767, -7427, 1113, 707 },
+ { 4592, -6261, 2329, 1864 },
+ { 3159, -10498, 1677, -4273 },
+ { 3534, -9010, 2437, -3565 },
+ { 4479, -10821, 2715, -4942 },
+ { 3207, -9805, 3054, -3886 },
+ { 4627, -8189, 3018, -2354 },
+ { 5527, -10566, 3244, -2749 },
+ { 4346, -10127, 3335, -3084 },
+ { 6132, -10085, 3316, -1308 },
+ { 5629, -9704, 2178, -3058 },
+ { 3603, -8538, 1246, -624 },
+ { 3737, -8488, 395, -3167 },
+ { 5465, -11414, 2810, -4640 },
+ { 5306, -7745, 2721, -3988 },
+ { 7000, -9111, 1695, -1409 },
+ { 6663, -7741, 2466, -4079 },
+ { 4083, -7175, 1836, -4831 },
+ { 3613, -9926, 1342, -3455 },
+ { 6588, -8033, 457, -258 },
+ { 4720, -8102, 17, -1209 },
+ { 7414, -8709, 1294, -344 },
+ { 5437, -10030, 4043, -1704 },
+ { 4862, -9281, 1558, -1431 },
+ { 6800, -6403, 5113, 862 },
+ { 4623, -8242, 2667, -228 },
+ { 5919, -5083, 3348, 2135 },
+ { 5985, -8889, 2733, -5105 },
+ { 5029, -5767, 4407, 719 },
+ { 354, -6158, -838, -3001 },
+ { 351, -5943, -2104, -1534 },
+ { -633, -7190, -25, -4798 },
+ { -1595, -7235, -3812, -1400 },
+ { 103, -6197, -2933, -78 },
+ { -1722, -5020, -3441, -4333 },
+ { -1963, -5644, -4365, -270 },
+ { -846, -5743, -3477, 196 },
+ { -191, -5348, -4054, -469 },
+ { -2515, -7754, -3495, -818 },
+ { -2090, -6710, -2701, 117 },
+ { -546, -7036, -1398, 163 },
+ { -278, -7091, -2662, -536 },
+ { -622, -7962, -2731, -1464 },
+ { -1555, -8118, -3612, -2057 },
+ { -1094, -6280, -2314, 505 },
+ { -2556, -8538, -4024, -2247 },
+ { 109, -7134, -3107, -1823 },
+ { -900, -6954, -3340, -717 },
+ { -605, -7113, -3656, -2154 },
+ { 837, -6263, -3211, -2177 },
+ { -417, -5810, -3871, -1469 },
+ { -1318, -5649, -4207, -3198 },
+ { 413, -6765, -2082, -33 },
+ { -3101, -6450, -4362, -766 },
+ { 755, -6489, -2967, -846 },
+ { 1117, -7106, -2452, -1352 },
+ { -1202, -8387, -3072, -2897 },
+ { -365, -4894, -3561, -2937 },
+ { -2372, -8776, -265, -4441 },
+ { -1224, -8678, -896, -5074 },
+ { -755, -10096, -600, -6623 },
+ { 300, -8206, -225, -4568 },
+ { -1176, -6824, -2633, -3527 },
+ { -2006, -5443, -1526, -5849 },
+ { -1115, -5540, -2363, -4785 },
+ { 1059, -6812, -2543, -2654 },
+ { -1976, -6861, -3062, -5508 },
+ { -379, -5328, -2321, -3624 },
+ { -2108, -5860, -4518, -1915 },
+ { -379, -7885, -1329, -594 },
+ { 774, -5389, -581, -5213 },
+ { -2601, -5083, -1849, -4921 },
+ { -176, -5580, 74, -5075 },
+ { -204, -6780, -190, -6232 },
+ { 418, -7594, -1987, -820 },
+ { -1873, -8529, -2926, -1609 },
+ { 1340, -6362, -919, -4975 },
+ { 577, -7990, -2044, -1873 },
+ { -2572, -7413, -1745, -2224 },
+ { -2037, -7030, -1461, -7138 },
+ { -2559, -8756, -2039, -5836 },
+ { -2079, -6764, -1209, -5669 },
+ { -1613, -7801, -2006, -685 },
+ { -1865, -6583, -722, -3529 },
+ { -589, -6358, -1377, -1003 },
+ { -540, -7514, -1331, -3542 },
+ { 419, -6192, -1677, -4927 },
+ { -2786, -8763, -2966, -5065 },
+ { -2172, -8411, -1726, -4675 },
+ { -3382, -9833, -3497, -5722 },
+ { -2433, -10169, -2077, -5775 },
+ { -424, -9451, -1096, -3658 },
+ { -537, -8522, -910, -1897 },
+ { -5550, 2807, 1683, -693 },
+ { -6395, 635, 3573, -1246 },
+ { -7544, 2280, 2140, 44 },
+ { -8751, 1136, 2951, -794 },
+ { -5605, 2709, 2052, 916 },
+ { -7650, 654, 869, 135 },
+ { -6939, 967, 1409, 870 },
+ { -7834, 2123, 3310, 974 },
+ { -6935, 2818, 1274, -1678 },
+ { -5605, 2233, 1013, 471 },
+ { -7095, 1849, 1648, 198 },
+ { -6636, 1634, 712, -37 },
+ { -7279, 978, 296, -315 },
+ { -7664, 3504, 3292, -216 },
+ { -7836, 1209, 1221, -257 },
+ { -7913, 2201, 1765, -1529 },
+ { -7077, 3783, 2632, -1407 },
+ { -5565, 1645, 1410, -622 },
+ { -6494, 2879, 1181, -759 },
+ { -7073, 3137, 3010, 550 },
+ { -7249, 1839, 847, -805 },
+ { -6630, 2197, 282, -1096 },
+ { -8836, 1573, 1988, -1090 },
+ { -7809, 1274, 836, -1198 },
+ { -7895, 2970, 3511, -1097 },
+ { -6960, 1664, 1356, -2442 },
+ { -6582, 2866, 2273, 307 },
+ { -7221, 821, 2851, -1435 },
+ { -6015, 1703, 2001, -2367 },
+ { -8082, 1034, 2103, 239 },
+ { -5952, 1912, 301, -465 },
+ { -6099, 841, 379, 567 },
+ { -6343, 50, 494, 658 },
+ { -6586, 983, 591, -893 },
+ { -5500, 869, 2187, -2479 },
+ { -6482, 60, 1545, -979 },
+ { -6705, 515, 1974, -53 },
+ { -6460, 1755, 1325, -1275 },
+ { -6093, 2617, 2465, -623 },
+ { -7330, 2161, 594, -2115 },
+ { -7324, 762, 1593, -2004 },
+ { -6385, 679, 1510, -2514 },
+ { -6159, 241, 2976, -1631 },
+ { -8583, 3030, 4045, -162 },
+ { -6299, 66, 2209, -2103 },
+ { -5428, 1279, 3267, -1846 },
+ { -6438, 1335, 2728, -1631 },
+ { -8012, 1070, 2428, -1151 },
+ { -6201, 2781, 2349, -1918 },
+ { -5918, 1139, 3121, -148 },
+ { -6314, 2481, 3137, -1808 },
+ { -7180, 1722, 2435, -1602 },
+ { -6750, 1829, 3763, -1145 },
+ { -6713, 1777, 2221, 1212 },
+ { -7479, 1835, 3627, -479 },
+ { -7299, 10, 2406, -1593 },
+ { -8249, 3129, 996, -2870 },
+ { -8374, 1534, 1333, -1882 },
+ { -7507, 3353, 1598, -2299 },
+ { -7379, 2701, 2326, -1167 },
+ { -8440, 2276, 2796, -542 },
+ { -10348, 1527, 2649, -1165 },
+ { -8184, 3614, 2574, -1738 },
+ { -5539, 1574, 1733, 1138 },
+ { 9404, -7652, 67, 79 },
+ { 8654, -3972, 1358, -60 },
+ { 8617, -4794, 117, 2318 },
+ { 7886, -4505, 1784, 1200 },
+ { 8636, -6125, 3879, -1003 },
+ { 9654, -6836, 1816, 205 },
+ { 9374, -6553, 913, 1875 },
+ { 8020, -6150, 1134, 2390 },
+ { 7786, -4970, 2078, -1857 },
+ { 8691, -6119, 711, 708 },
+ { 9039, -5568, 2944, -1902 },
+ { 9955, -5048, 1433, -601 },
+ { 8089, -6927, 3093, -2846 },
+ { 8487, -7024, 2415, 19 },
+ { 9388, -5287, 3577, -2655 },
+ { 8591, -7371, 2300, -996 },
+ { 9104, -4763, 1453, -2558 },
+ { 7615, -5457, 596, 164 },
+ { 9860, -7047, 3433, -614 },
+ { 8756, -4404, 2235, -964 },
+ { 9462, -4660, 299, -1822 },
+ { 10119, -5550, 2689, -1273 },
+ { 10915, -7471, 2705, -1007 },
+ { 11433, -7090, 1410, -1198 },
+ { 9882, -7431, 2965, -1895 },
+ { 7628, -5219, 769, -2661 },
+ { 8169, -5318, 2262, 70 },
+ { 8846, -6320, 1939, -754 },
+ { 7147, -5593, 1248, -971 },
+ { 10652, -5485, 935, 137 },
+ { 7778, -6533, 2564, -1932 },
+ { 8878, -5173, 1214, -361 },
+ { 9828, -4943, 282, 510 },
+ { 10042, -6134, 3895, -1914 },
+ { 7965, -6630, 3566, -433 },
+ { 8573, -4502, 3574, -1209 },
+ { 8398, -4801, 1031, -1347 },
+ { 10136, -7772, 2612, 1547 },
+ { 9890, -7280, 1768, -1083 },
+ { 8407, -6585, -706, -58 },
+ { 7976, -7582, 229, -131 },
+ { 10481, -8866, 1166, -147 },
+ { 10914, -4342, 3189, -2412 },
+ { 10440, -5198, -104, -1109 },
+ { 11227, -6530, 2381, -2449 },
+ { 8487, -8064, 1086, 230 },
+ { 9975, -6123, -857, -134 },
+ { 8339, -6498, 1232, -2337 },
+ { 11042, -4506, 1119, -2098 },
+ { 12563, -5592, 1837, -2062 },
+ { 11801, -5590, 632, -1296 },
+ { 10152, -5617, 1511, -1917 },
+ { 7800, -6473, 51, -1337 },
+ { 7941, -5560, 2438, -3270 },
+ { 6554, -3834, 2100, 1476 },
+ { 9065, -5520, -226, -1120 },
+ { 10794, -7120, -243, 122 },
+ { 10429, -6968, 272, -806 },
+ { 8942, -8914, 1442, -392 },
+ { 9969, -5051, 2033, -2953 },
+ { 7275, -4152, 3058, -64 },
+ { 11127, -5488, 4589, -3227 },
+ { 9626, -6666, 2739, -2958 },
+ { 6943, -5362, 4470, 1008 },
+ { -7456, -967, 2936, -1002 },
+ { -8622, -333, 6962, 2606 },
+ { -7486, -3392, 3668, 1287 },
+ { -8053, -827, 5148, 1097 },
+ { -6610, 454, 4952, 96 },
+ { -7701, -1982, 3161, -468 },
+ { -7307, -1132, 4071, -36 },
+ { -8125, -271, 5199, 3862 },
+ { -9182, -1950, 2813, 1878 },
+ { -9855, -952, 4794, 3010 },
+ { -7241, 1431, 4202, 2468 },
+ { -9646, 157, 4766, 1046 },
+ { -9371, 1230, 6009, 2958 },
+ { -11514, -64, 8630, 5248 },
+ { -6766, 565, 2766, 2140 },
+ { -8426, -9, 2852, 1271 },
+ { -11291, -1113, 5087, 2937 },
+ { -8297, 2092, 4495, 1264 },
+ { -9983, 735, 3809, -51 },
+ { -9048, -1000, 3191, -308 },
+ { -7331, -1987, 2655, 1391 },
+ { -7144, -21, 4333, 2161 },
+ { -6032, -1540, 3543, 896 },
+ { -7987, -1036, 1985, 1529 },
+ { -9264, 2004, 5194, 290 },
+ { -11308, -840, 5754, 1654 },
+ { -9130, -2398, 4292, 2973 },
+ { -6248, 838, 3563, 1223 },
+ { -6819, -2760, 3511, 119 },
+ { -7213, -2006, 4364, 762 },
+ { -5431, -1047, 4533, 166 },
+ { -7098, -641, 2021, 639 },
+ { -8628, -2249, 3588, 399 },
+ { -6352, -1498, 3560, -648 },
+ { -7033, -2190, 4870, 2562 },
+ { -7405, -46, 3772, -581 },
+ { -6104, 796, 5143, 1965 },
+ { -5787, 943, 5784, 3030 },
+ { -8367, 1465, 7192, 4097 },
+ { -8259, 789, 5694, 1963 },
+ { -10614, -1899, 5748, 2645 },
+ { -8258, -805, 3698, 2275 },
+ { -6877, -972, 6431, 3160 },
+ { -6483, 363, 7018, 3129 },
+ { -6283, -1358, 5191, 1524 },
+ { -8853, -3157, 4119, 1741 },
+ { -6086, -267, 3883, -835 },
+ { -7254, 1032, 6613, 4017 },
+ { -11470, -3350, 4649, 3426 },
+ { -6743, 481, 6148, 1239 },
+ { -5394, -166, 5309, 3165 },
+ { -7958, 1068, 4268, -240 },
+ { -10520, 2256, 7916, 2828 },
+ { -5132, -4, 5739, 1176 },
+ { -8643, 120, 3255, -629 },
+ { -9631, 1974, 8870, 4362 },
+ { -10663, -1221, 3733, 589 },
+ { -8224, -1843, 5806, 2655 },
+ { -8282, 1255, 8647, 3478 },
+ { -12311, -1505, 9043, 6256 },
+ { -11312, -856, 7136, 4681 },
+ { -11944, -722, 7941, 3309 },
+ { -7868, -463, 6846, 4196 },
+ { -8679, -241, 7410, 5347 },
+ { 6759, -4680, -508, 1220 },
+ { 5176, -6111, 944, 121 },
+ { 6843, -5667, -1368, -533 },
+ { 5616, -5884, -1471, -695 },
+ { 6030, -5089, -1808, -940 },
+ { 7444, -5463, -52, 1881 },
+ { 4207, -6079, -506, 1571 },
+ { 6785, -4410, -649, 3084 },
+ { 4838, -5214, 2026, 2998 },
+ { 4201, -5790, 645, 1811 },
+ { 6930, -5129, -1940, 1698 },
+ { 6332, -4627, 692, 3027 },
+ { 6285, -4314, -106, 3644 },
+ { 6255, -5450, -1975, 742 },
+ { 4199, -4676, -459, 1796 },
+ { 5592, -5500, 1345, 1300 },
+ { 4358, -5556, -2236, 114 },
+ { 4620, -5875, -1563, 888 },
+ { 4892, -7550, -327, -419 },
+ { 4734, -7085, 7, 613 },
+ { 3883, -5562, -1969, 1080 },
+ { 5610, -4990, -204, 834 },
+ { 4117, -6482, -1271, 341 },
+ { 6585, -5107, 892, 1169 },
+ { 6632, -3683, 302, 3002 },
+ { 6326, -5351, -983, -1250 },
+ { 4382, -7192, -730, -158 },
+ { 5227, -6540, -451, 1123 },
+ { 5468, -6472, -870, -1471 },
+ { 5191, -6402, -1365, -127 },
+ { 7407, -6317, -973, -336 },
+ { 4611, -6530, -820, -1980 },
+ { 4963, -5159, -2050, -966 },
+ { 4414, -5691, -211, -998 },
+ { 5954, -5873, 750, -1749 },
+ { 4394, -4796, -1268, 254 },
+ { 7161, -6214, -1010, 689 },
+ { 4965, -3598, 2372, 1711 },
+ { 6248, -6180, 981, 864 },
+ { 6473, -5336, 525, -600 },
+ { 4591, -6864, -1131, -900 },
+ { 6314, -6440, -1021, -375 },
+ { 5838, -6209, -1199, 944 },
+ { 5308, -5283, -2100, 1267 },
+ { 4342, -5860, -1637, -1356 },
+ { 5680, -4388, -1227, -104 },
+ { 4900, -4098, 1449, 4046 },
+ { 4677, -4284, -106, 3190 },
+ { 7574, -6173, -848, 1859 },
+ { 6493, -7207, -131, 726 },
+ { 5513, -5261, -2117, 4 },
+ { 6191, -7352, -193, -505 },
+ { 5885, -4333, 324, -134 },
+ { 6162, -6081, -312, -2044 },
+ { 4216, -6200, -1810, -572 },
+ { 5652, -7035, -696, -197 },
+ { 7131, -7189, -366, -60 },
+ { 5032, -4803, -1514, 2832 },
+ { 7386, -4610, -606, 3489 },
+ { 4211, -5031, 1221, 3047 },
+ { 4050, -4653, 1584, 1469 },
+ { 6852, -5302, -1861, 206 },
+ { 7736, -4816, -1794, 3359 },
+ { 6290, -3439, 1522, 2454 },
+ { 1768, 5990, -5560, -2594 },
+ { 3903, 5326, -1530, -1501 },
+ { 2472, 3738, -2117, -4240 },
+ { 3260, 5448, -904, -4733 },
+ { 1435, 7297, -3676, -4102 },
+ { 4096, 5951, -656, -3312 },
+ { 2178, 6009, -3146, -3724 },
+ { 3787, 5493, -5473, -1633 },
+ { 2998, 7286, -3334, -3571 },
+ { 2894, 6576, -4708, -2804 },
+ { 830, 6163, -4286, -3348 },
+ { 4755, 5569, -1730, -2739 },
+ { 4604, 6065, -3562, -2605 },
+ { 2749, 5141, -3986, -2775 },
+ { 3942, 4875, -2143, -3340 },
+ { 2819, 8517, -2004, -2724 },
+ { 2146, 6298, -689, -3093 },
+ { 5196, 6504, -3393, -1475 },
+ { 1851, 8386, -1748, -1420 },
+ { 3474, 8572, -3534, -2688 },
+ { 4503, 7560, -3561, -2245 },
+ { 4433, 6219, -2393, -1575 },
+ { 3506, 7248, -2275, -1977 },
+ { 3490, 7409, -3147, -604 },
+ { 4214, 6447, -3520, 516 },
+ { 619, 7034, -829, -1705 },
+ { 1732, 7395, -356, -2208 },
+ { 1226, 5204, -3294, -3732 },
+ { 2027, 5619, -1813, -4146 },
+ { 3078, 5877, 47, -2651 },
+ { 1654, 5458, 424, -682 },
+ { 3163, 5464, -2026, -270 },
+ { 2884, 5375, -685, -530 },
+ { 2950, 7286, -35, -2967 },
+ { 1986, 5066, -597, 482 },
+ { 3459, 4308, -3845, -2333 },
+ { 3155, 7037, -1346, -4345 },
+ { 2193, 6696, -717, -1319 },
+ { 3677, 5089, -3892, -487 },
+ { 2186, 5136, -4186, -1492 },
+ { 773, 5796, -917, 817 },
+ { 2489, 6546, -3570, -2117 },
+ { 1223, 6469, -1362, -33 },
+ { 271, 6061, -1466, -1725 },
+ { 2540, 5171, -1847, 1032 },
+ { 2548, 5251, -2697, 1677 },
+ { 771, 7600, -768, -632 },
+ { 4710, 6647, -4736, -1275 },
+ { 1369, 5917, -2971, -1056 },
+ { 163, 5239, -3499, -2275 },
+ { 2104, 4285, -3211, -3286 },
+ { 1107, 7411, -1972, -1671 },
+ { 2196, 7262, -2310, -1926 },
+ { -244, 6439, -1745, -839 },
+ { 3293, 3832, -2890, -3000 },
+ { 419, 6443, -379, -407 },
+ { 3077, 4930, -1156, -2869 },
+ { 2131, 5874, -2330, 224 },
+ { 690, 6538, -2212, -2841 },
+ { 1602, 4421, -2515, 1542 },
+ { 3318, 9373, -3032, -3477 },
+ { 5646, 7462, -5153, -1463 },
+ { 4139, 7137, -1539, -3321 },
+ { 3481, 9077, -1645, -3653 },
+ { -7747, 375, -106, -543 },
+ { -8587, -1379, -586, -461 },
+ { -10146, -892, 2094, 694 },
+ { -8103, 382, 504, -325 },
+ { -8548, -92, 94, -656 },
+ { -7460, 38, 152, 388 },
+ { -8266, -271, -459, -883 },
+ { -7935, -664, -1026, -802 },
+ { -8341, -109, 853, 161 },
+ { -8802, -1355, 1099, 630 },
+ { -8957, -6, 1108, -669 },
+ { -7260, -1520, -43, -407 },
+ { -7555, -174, 668, -2562 },
+ { -9014, -126, 227, -1191 },
+ { -8184, 769, 290, -1375 },
+ { -9476, 55, 962, -1528 },
+ { -8679, 541, 755, -1030 },
+ { -9842, -1626, 838, -1588 },
+ { -8513, -702, 788, -1998 },
+ { -10101, -1558, -366, -1841 },
+ { -8135, 78, 1479, -1813 },
+ { -9128, -454, 313, -1786 },
+ { -7554, -1084, 831, -2442 },
+ { -7576, -701, 2068, -1665 },
+ { -7791, -1481, 1587, -1808 },
+ { -6701, -596, -97, 802 },
+ { -7418, -15, 684, -963 },
+ { -7127, -477, -139, -426 },
+ { -8097, -110, -36, -264 },
+ { -7620, -1922, -590, -101 },
+ { -7647, -1201, 279, 660 },
+ { -7856, -1974, 758, -2271 },
+ { -8496, -167, 2232, -1143 },
+ { -8506, -1359, 624, -740 },
+ { -7274, -1052, 1062, -139 },
+ { -7800, -217, 91, -1794 },
+ { -7030, -1694, -955, 615 },
+ { -9020, -1864, 101, -2182 },
+ { -9400, -740, 598, -667 },
+ { -8448, -1184, 2024, -1272 },
+ { -8812, -570, -897, -2384 },
+ { -10559, -1286, 538, -1536 },
+ { -8728, -888, -1089, -1397 },
+ { -7080, -1185, 636, -1252 },
+ { -9880, 233, 2344, -782 },
+ { -7952, -1326, -378, -1947 },
+ { -7207, -378, 1408, -2237 },
+ { -8467, -1545, 902, -1987 },
+ { -9163, -1474, 924, -1739 },
+ { -8159, -992, -77, -2744 },
+ { -8343, 148, -423, -1573 },
+ { -9105, -649, -254, -1214 },
+ { -8939, 456, 281, -1905 },
+ { -8837, 179, -394, -2634 },
+ { -9145, 757, 1547, -1319 },
+ { -9775, -723, 441, -1680 },
+ { -8910, -686, 1529, -1525 },
+ { -9492, -1134, 2064, -938 },
+ { -6111, -943, 677, -31 },
+ { -7411, -613, -814, 46 },
+ { -9479, -922, -430, -2061 },
+ { -11298, -1268, 1318, -1117 },
+ { -8190, 832, 671, -2214 },
+ { -10453, -550, 1672, -886 },
+ { 1044, 9353, -1651, -5423 },
+ { 1034, 8149, -455, -6166 },
+ { 761, 8293, -3214, -4838 },
+ { 938, 8077, 164, -5130 },
+ { 1295, 8673, 2582, -5490 },
+ { -314, 7973, -2395, -5231 },
+ { -507, 9012, -2497, -5775 },
+ { 2396, 8314, -1022, -4673 },
+ { -1516, 8501, 1950, -4969 },
+ { -308, 7401, 1549, -4866 },
+ { -112, 8340, 3003, -4920 },
+ { -50, 9315, 1371, -5666 },
+ { -659, 9449, 2496, -5547 },
+ { 2573, 9148, -2270, -4783 },
+ { 830, 7104, -438, -3907 },
+ { 522, 10672, -677, -6483 },
+ { -1190, 10108, -510, -6518 },
+ { -427, 8271, -579, -6315 },
+ { 1602, 8113, -1927, -4418 },
+ { -2266, 8180, 448, -5190 },
+ { -1633, 8816, -226, -5771 },
+ { 759, 9481, -105, -5813 },
+ { 2254, 6679, -466, -5662 },
+ { -88, 6946, 895, -5958 },
+ { -1705, 10009, 1394, -5574 },
+ { 748, 7943, 540, -6692 },
+ { 1411, 7009, 232, -6145 },
+ { 697, 7290, -1221, -5342 },
+ { -1764, 10580, 1944, -3981 },
+ { -1334, 9124, 1195, -3903 },
+ { -905, 10067, 635, -5039 },
+ { 664, 10680, 49, -4625 },
+ { 1374, 9536, -777, -3591 },
+ { 252, 9698, -597, -2931 },
+ { 824, 9164, -1014, -2144 },
+ { 2438, 10569, -2289, -4424 },
+ { 2101, 7102, 507, -3614 },
+ { 294, 8051, -432, -1518 },
+ { -665, 10337, 547, -2852 },
+ { 1168, 11989, -492, -5427 },
+ { 1344, 6416, 302, -5061 },
+ { -1727, 12264, 1507, -4543 },
+ { 674, 10889, -902, -3605 },
+ { -582, 9504, 300, -3618 },
+ { 641, 7654, 689, -2109 },
+ { 2065, 9243, 508, -4367 },
+ { 1055, 8373, 688, -3144 },
+ { -641, 8185, 986, -3307 },
+ { 1120, 7426, 1785, -3757 },
+ { 1660, 8070, -593, -3104 },
+ { 2002, 9467, -1722, -3475 },
+ { 2361, 8368, 100, -3709 },
+ { -772, 7845, -613, -4988 },
+ { 1485, 7430, 1896, -6127 },
+ { -432, 7823, -947, -2882 },
+ { 313, 11122, -760, -4871 },
+ { 412, 8412, -283, -4231 },
+ { 1585, 10402, -1884, -3267 },
+ { 321, 6952, 773, -3016 },
+ { -105, 9014, 121, -2249 },
+ { 1585, 10313, -977, -4812 },
+ { 1619, 11869, 1306, -6876 },
+ { -1168, 8886, -81, -2500 },
+ { -395, 10886, 733, -6490 },
+ { -4949, 4274, 3992, -1054 },
+ { -4241, 5299, 4262, -1584 },
+ { -2710, 3862, 4552, -1673 },
+ { -4608, 2472, 3672, -1715 },
+ { -2843, 2816, 4003, -2326 },
+ { -5229, 2964, 5636, 90 },
+ { -4924, 3442, 5015, -1096 },
+ { -1281, 3313, 5537, -2066 },
+ { -3808, 1939, 4351, -919 },
+ { -1915, 2585, 4939, -1614 },
+ { -3470, 1843, 5562, -682 },
+ { -3800, 870, 5827, 144 },
+ { -4985, 1452, 4728, -709 },
+ { -3745, 2750, 7220, 259 },
+ { -1875, 1900, 6514, -826 },
+ { -4329, 1574, 7192, 1304 },
+ { -5408, 1444, 6208, 631 },
+ { -3327, 5312, 5707, -1541 },
+ { -6966, 3334, 4034, 1028 },
+ { -7484, 4245, 4218, -212 },
+ { -6567, 5839, 4539, -512 },
+ { -5715, 5935, 3747, -1186 },
+ { -6410, 4881, 3356, -1610 },
+ { -5146, 2590, 2850, 2172 },
+ { -5196, 4095, 2569, -373 },
+ { -5043, 6025, 4318, 692 },
+ { -5525, 4884, 3513, 370 },
+ { -6804, 7533, 5812, -488 },
+ { -5657, 2480, 4061, 1234 },
+ { -3155, 1472, 6071, 1188 },
+ { -3427, 5217, 3442, 858 },
+ { -4698, 3013, 5517, 2586 },
+ { -4449, 2226, 5418, 3580 },
+ { -6395, 3547, 5487, 2028 },
+ { -3500, 5019, 4787, 1 },
+ { -4038, 2578, 3073, 3151 },
+ { -2750, 1955, 4469, 3856 },
+ { -5696, 1659, 6118, 2469 },
+ { -4350, 1241, 6840, 3126 },
+ { -5565, 5058, 5196, 1314 },
+ { -1642, 4190, 3948, 607 },
+ { -1233, 4108, 4850, -640 },
+ { -997, 3428, 3239, 1378 },
+ { -6488, 2741, 6926, 2792 },
+ { -4188, 3763, 4235, 2018 },
+ { -3210, 3224, 5646, 1427 },
+ { -5526, 6909, 5070, -627 },
+ { -2815, 3994, 3425, 1903 },
+ { -2163, 2734, 5423, 145 },
+ { -4149, 4247, 2355, 734 },
+ { -410, 2521, 4138, -16 },
+ { -2411, 2385, 4927, 2105 },
+ { -6077, 3591, 3114, 594 },
+ { -4186, 4834, 5926, -1004 },
+ { -7315, 3369, 5966, 448 },
+ { -7042, 5721, 5771, 238 },
+ { -4466, 3907, 3535, -1751 },
+ { -2116, 3970, 6163, -1392 },
+ { -7239, 2143, 8407, 3630 },
+ { -5431, 4486, 6486, -42 },
+ { -1874, 1617, 6333, 519 },
+ { -6478, 2629, 4634, -505 },
+ { -7784, 2342, 7216, 1365 },
+ { -1154, 1432, 4831, 1544 },
+ { -4964, -5801, 1797, 506 },
+ { -4436, -6905, 1059, -1237 },
+ { -5400, -6886, 884, -290 },
+ { -6259, -7103, 523, -227 },
+ { -4819, -6450, 1412, -450 },
+ { -4056, -6213, 1725, -943 },
+ { -5642, -6091, 1357, 605 },
+ { -4196, -5678, 2187, -173 },
+ { -4726, -5126, 2470, 321 },
+ { -6642, -5091, 1507, -1005 },
+ { -5304, -5250, 1944, 1579 },
+ { -7179, -5520, 1468, -425 },
+ { -6033, -4895, 1876, -955 },
+ { -6595, -5143, 2207, 1291 },
+ { -4224, -4943, 1846, 1792 },
+ { -7128, -6950, 539, 724 },
+ { -4369, -4901, 2590, 1103 },
+ { -7413, -5696, 1712, 1440 },
+ { -5885, -6821, 418, 871 },
+ { -6828, -5599, 710, -1563 },
+ { -6123, -5817, 1358, 1631 },
+ { -5291, -5622, 578, 2138 },
+ { -7171, -6004, 347, 2208 },
+ { -6083, -5251, 2132, 425 },
+ { -4329, -5721, 407, -2993 },
+ { -5326, -5056, 1119, -1837 },
+ { -5485, -5856, 185, -2389 },
+ { -6529, -5178, 403, -697 },
+ { -6719, -4412, 2726, 871 },
+ { -5126, -5629, 1835, -771 },
+ { -5622, -4361, 2973, 858 },
+ { -5282, -5895, 45, -335 },
+ { -4357, -5656, 1696, -1558 },
+ { -7139, -6659, 627, -409 },
+ { -4415, -6328, 35, 1306 },
+ { -7639, -6110, 1134, 197 },
+ { -3626, -5592, 2019, 901 },
+ { -3547, -5064, 1176, 1738 },
+ { -5075, -3899, 2087, 266 },
+ { -4086, -6311, 1479, 360 },
+ { -6210, -5220, -199, -1477 },
+ { -3910, -5063, 1356, -15 },
+ { -7616, -4977, 461, 2401 },
+ { -6118, -6131, 1258, -563 },
+ { -6127, -4968, 1286, -27 },
+ { -4121, -5852, 1113, 1476 },
+ { -5157, -4881, 1162, -662 },
+ { -4637, -5031, 1179, 709 },
+ { -5509, -5452, -397, 1224 },
+ { -4597, -6861, 646, 467 },
+ { -6247, -4043, 468, 278 },
+ { -5336, -6465, 874, -1472 },
+ { -6998, -6346, 78, -1798 },
+ { -4915, -4530, 2756, -203 },
+ { -6048, -4373, 1468, 1052 },
+ { -4273, -7100, 942, -323 },
+ { -6552, -4287, 2351, 69 },
+ { -6954, -4613, 722, 1521 },
+ { -4201, -5361, 763, -1562 },
+ { -6881, -5596, -748, 669 },
+ { -6695, -3547, -34, 1299 },
+ { -3981, -5728, 84, 111 },
+ { -4663, -4809, 2173, -1031 },
+ { -6599, -6077, 1303, 256 },
+ { -7596, -4265, -5791, -4140 },
+ { -6610, -2758, -5288, -3936 },
+ { -5880, -3865, -6563, -3088 },
+ { -7228, -5510, -7677, -3912 },
+ { -8854, -6553, -8318, -5361 },
+ { -9362, -5249, -6413, -4319 },
+ { -4418, -3110, -6368, -4358 },
+ { -5544, -4203, -6863, -5013 },
+ { -3056, -4316, -5567, -3181 },
+ { -3078, -5999, -5051, -2657 },
+ { -5884, -6292, -5756, -4013 },
+ { -4825, -4549, -5535, -4053 },
+ { -4443, -6126, -5316, -1368 },
+ { -3972, -6341, -6098, -2686 },
+ { -5751, -2781, -5398, -6230 },
+ { -4466, -6135, -5570, -3679 },
+ { -4291, -5992, -3564, -5189 },
+ { -7189, -4429, -7279, -6082 },
+ { -5076, -4433, -2748, -5366 },
+ { -6225, -2825, -6833, -5663 },
+ { -2989, -4792, -3960, -4492 },
+ { -7836, -7773, -7722, -5741 },
+ { -6559, -5703, -5844, -5589 },
+ { -7612, -5438, -4136, -3774 },
+ { -4218, -4176, -6591, -2333 },
+ { -4837, -5063, -6581, 322 },
+ { -6590, -5990, -2980, -3847 },
+ { -5558, -2971, -5489, -1932 },
+ { -7001, -5323, -4975, -1697 },
+ { -4694, -2688, -6904, -3044 },
+ { -8511, -5379, -5767, -2549 },
+ { -7548, -5412, -6522, -2572 },
+ { -6597, -4973, -6423, -1274 },
+ { -6415, -4022, -5168, -1072 },
+ { -5528, -5530, -7218, -2345 },
+ { -4845, -4805, -5943, -1227 },
+ { -6049, -7150, -6744, -2161 },
+ { -9061, -7299, -8542, -4375 },
+ { -5010, -5546, -5416, -82 },
+ { -4135, -4205, -5109, -3373 },
+ { -3311, -5869, -4007, -5061 },
+ { -5993, -6472, -3962, -4718 },
+ { -2966, -5832, -2821, -6305 },
+ { -4851, -5152, -2067, -3930 },
+ { -3620, -4441, -3362, -5836 },
+ { -4469, -5221, -4534, -5592 },
+ { -4022, -6335, -4321, -6107 },
+ { -4899, -4503, -3084, -3725 },
+ { -4490, -8276, -4620, -6236 },
+ { -6591, -4342, -7365, -4063 },
+ { -6498, -5057, -5553, 485 },
+ { -6060, -2714, -7093, -4144 },
+ { -6199, -7774, -7094, -4057 },
+ { -7536, -6424, -6415, -4265 },
+ { -7439, -2454, -6348, -4827 },
+ { -5333, -7565, -4417, -4639 },
+ { -4353, -7103, -4197, -2689 },
+ { -5229, -6549, -5129, -6804 },
+ { -6129, -7701, -5236, -4836 },
+ { -6797, -3983, -3884, -4406 },
+ { -6624, -4467, -4745, -5052 },
+ { -3324, -7596, -2720, -6553 },
+ { -5473, -6284, -1704, -4511 },
+ { -4131, -7263, -3180, -5196 },
+ { -7116, -5565, -3469, 685 },
+ { -6002, -6021, -3858, 576 },
+ { -3144, -8203, -1291, -434 },
+ { -6096, -7027, -4004, 1353 },
+ { -3943, -7709, -2344, -36 },
+ { -4510, -6767, -2642, 631 },
+ { -3657, -11541, -2570, -3984 },
+ { -5959, -8854, -1333, -867 },
+ { -6699, -8866, -1606, -344 },
+ { -3836, -7961, -2334, -2028 },
+ { -3430, -8045, -3037, -672 },
+ { -3868, -9184, -3635, -1819 },
+ { -4258, -9060, -2621, -1008 },
+ { -3595, -8693, -2022, -752 },
+ { -4573, -8048, -3166, -2622 },
+ { -4852, -7903, -1405, 256 },
+ { -4591, -7057, -1560, 965 },
+ { -6963, -7655, -980, 808 },
+ { -5179, -6641, -3356, 1196 },
+ { -7102, -6941, -2798, 2123 },
+ { -6867, -5834, -3320, -770 },
+ { -5977, -7369, -2500, -778 },
+ { -6160, -6400, -934, -2543 },
+ { -6741, -7608, -355, -1289 },
+ { -6856, -6466, -1433, -1643 },
+ { -4786, -6292, -4970, 376 },
+ { -5407, -8866, -2255, -400 },
+ { -3814, -6506, -1387, -3620 },
+ { -4998, -6137, -1200, -4092 },
+ { -5123, -9557, -2849, -1306 },
+ { -4259, -6444, -4395, -338 },
+ { -5221, -6810, -883, 1225 },
+ { -6137, -6215, -2165, 554 },
+ { -3895, -6557, -3176, -1829 },
+ { -3886, -8188, -87, -954 },
+ { -7243, -6707, -2216, -316 },
+ { -5592, -7606, 85, -432 },
+ { -3957, -7945, -504, -144 },
+ { -4617, -7624, 218, -312 },
+ { -4797, -8737, -844, -1051 },
+ { -4478, -8516, -1401, -454 },
+ { -4557, -7058, -302, -2332 },
+ { -6623, -7736, -271, -50 },
+ { -3157, -7532, -1111, -2207 },
+ { -3590, -7300, -1271, 517 },
+ { -4442, -7306, -507, 590 },
+ { -6458, -7524, -2807, 666 },
+ { -4991, -8466, -3363, -785 },
+ { -7474, -7541, -1056, -1839 },
+ { -7501, -8316, -938, -180 },
+ { -5329, -7739, -579, -2341 },
+ { -4549, -7063, -176, -3539 },
+ { -5191, -8612, -1504, -4250 },
+ { -3083, -7058, -2251, 32 },
+ { -4003, -7043, -1093, -791 },
+ { -5523, -8093, -678, -114 },
+ { -3022, -10265, -2070, -3109 },
+ { -3905, -6274, -182, -3652 },
+ { -3269, -9217, -551, -2650 },
+ { -3138, -9314, -1726, -1704 },
+ { -4420, -10339, -1744, -3459 },
+ { -4163, -8609, -2298, -4113 },
+ { -5566, -6505, -1241, -463 },
+ { -3130, -9746, -2352, -4884 },
+ { -7825, -3439, 1451, -1468 },
+ { -8451, -3318, 2360, -435 },
+ { -8462, -4130, 1438, -1024 },
+ { -9425, -4564, 1328, -689 },
+ { -11014, -3202, 2278, 2080 },
+ { -8269, -2761, -146, -440 },
+ { -7497, -2618, -166, 413 },
+ { -8250, -3060, 522, -2133 },
+ { -8365, -5366, 1347, -451 },
+ { -8589, -3979, 2943, 714 },
+ { -8111, -2572, 1272, -1748 },
+ { -7830, -5193, 605, -1484 },
+ { -8119, -4736, 2141, 256 },
+ { -7724, -4769, 1463, -812 },
+ { -7363, -3911, 2540, 4 },
+ { -7974, -3397, 2363, 1366 },
+ { -7359, -4204, 1752, -958 },
+ { -7622, -3505, 660, 916 },
+ { -9934, -3665, 3165, 828 },
+ { -8721, -4162, 62, 1718 },
+ { -9433, -4768, 2722, 1234 },
+ { -7960, -4496, 138, 1528 },
+ { -8198, -3454, -443, 631 },
+ { -7756, -2246, 655, 1137 },
+ { -8841, -3145, 1113, 829 },
+ { -7817, -3298, 1251, 230 },
+ { -9413, -2733, 323, -1862 },
+ { -9408, -4168, 1270, 1549 },
+ { -9037, -3892, -942, 283 },
+ { -8255, -3849, 1301, 1762 },
+ { -9057, -3987, -41, -682 },
+ { -9441, -4187, 2019, -111 },
+ { -9740, -3178, 1602, -871 },
+ { -8344, -2474, 1461, 1506 },
+ { -9752, -2925, 1996, 1243 },
+ { -9199, -3796, 180, 537 },
+ { -9060, -2405, 1140, -1562 },
+ { -9348, -2376, 309, -162 },
+ { -10786, -3182, -5, -1500 },
+ { -8142, -4540, -434, -826 },
+ { -7528, -2341, 1104, -73 },
+ { -9360, -2658, 3062, 56 },
+ { -8267, -2335, 2000, -1193 },
+ { -12169, -3154, 1287, -640 },
+ { -11398, -2120, 946, -1163 },
+ { -8940, -4559, 328, -1696 },
+ { -11025, -4213, 2813, 840 },
+ { -9224, -3581, 2224, 2039 },
+ { -8943, -3337, 1248, -1298 },
+ { -7900, -4042, 485, -2080 },
+ { -9221, -1947, 2191, -880 },
+ { -10762, -1800, 2516, -324 },
+ { -10095, -2238, 981, -1335 },
+ { -11908, -2808, 3255, 645 },
+ { -10640, -4105, 1283, -595 },
+ { -7663, -2863, 2467, -797 },
+ { -10712, -3854, 3710, 1538 },
+ { -10823, -2893, 1408, -801 },
+ { -9874, -3832, 256, -1638 },
+ { -10394, -3391, 2315, -94 },
+ { -11525, -4079, 4153, 2122 },
+ { -9546, -2088, 1541, 481 },
+ { -8731, -2433, 1042, 2160 },
+ { -7852, -3977, -1370, 1677 },
+ { 7072, -3420, 1398, -1741 },
+ { 6180, -1976, 1280, -3557 },
+ { 7692, -1793, 2844, -1700 },
+ { 8363, -1773, 3104, -2679 },
+ { 9213, -3266, 3756, -3542 },
+ { 9650, -2644, 1426, -1318 },
+ { 7712, -2796, 3686, -1975 },
+ { 7316, -3517, 2821, -622 },
+ { 7434, -2594, 2305, -2264 },
+ { 7237, -1797, 255, -3114 },
+ { 8663, -1983, 1338, -3056 },
+ { 6616, -952, 4059, -2652 },
+ { 8823, -1327, 1362, -1356 },
+ { 9938, -1722, 1287, -2362 },
+ { 7207, -1057, 1913, -1315 },
+ { 7508, -1585, 870, -1982 },
+ { 8217, -3680, 1417, -3170 },
+ { 8329, -2541, 1684, -585 },
+ { 8062, -2335, 252, -2800 },
+ { 8204, -4108, 3097, -2569 },
+ { 7701, -3367, 576, -3008 },
+ { 7350, -786, 2414, -2129 },
+ { 6948, -2568, 1607, -225 },
+ { 7684, -2387, 1308, -3449 },
+ { 8306, -3458, 2394, -1454 },
+ { 8438, -2781, 1043, -1362 },
+ { 9175, -2076, 2144, -1987 },
+ { 8347, -2709, 3489, -4301 },
+ { 5696, -2377, 2870, 851 },
+ { 8825, -1243, 2219, -2603 },
+ { 8801, -1614, 584, -2513 },
+ { 8413, -384, 1421, -2244 },
+ { 9228, -3050, 3279, -2164 },
+ { 6342, -2698, 3547, -107 },
+ { 10053, -2476, 2837, -3168 },
+ { 7439, -604, 3177, -3991 },
+ { 7749, -1064, 4329, -4855 },
+ { 8655, -2177, 2252, -3519 },
+ { 8490, -228, 1958, -3233 },
+ { 10513, -2968, 1911, -2340 },
+ { 8146, -862, 1884, -1723 },
+ { 7788, -666, 3004, -2891 },
+ { 7785, -1620, 4133, -3417 },
+ { 10262, -3731, 3455, -2971 },
+ { 8570, -905, 4519, -4649 },
+ { 9129, -2562, 463, -2465 },
+ { 9451, -3587, 1904, -3056 },
+ { 6549, -2236, 3010, -4523 },
+ { 7175, -2684, 2967, -3458 },
+ { 9872, -3278, 1054, -2472 },
+ { 9153, -931, 1217, -2565 },
+ { 8789, -3469, 753, -2568 },
+ { 6683, -3791, 1797, -3968 },
+ { 6801, -1977, 2311, -452 },
+ { 6336, -1572, 2612, -3264 },
+ { 7996, -1008, 730, -2964 },
+ { 7521, -1059, 1573, -3694 },
+ { 8148, -3973, 2600, -3572 },
+ { 7765, -1532, 2528, -3856 },
+ { 7404, -3918, 4472, -143 },
+ { 8894, -1398, 3299, -3685 },
+ { 5768, -2041, 1487, -637 },
+ { 5131, -2865, 2463, -811 },
+ { 6439, -1568, 3500, -1550 },
+ { -8878, -6798, -5319, -1452 },
+ { -6332, -9713, -3112, -990 },
+ { -8444, -6316, -3694, -687 },
+ { -6123, -10840, -3637, -4358 },
+ { -4784, -9580, -4577, -2581 },
+ { -6108, -10515, -4859, -2524 },
+ { -7605, -7518, -2327, -2797 },
+ { -9662, -8775, -2467, -2010 },
+ { -6494, -7523, -4715, -118 },
+ { -8290, -8982, -1672, -317 },
+ { -8798, -11051, -3888, -1426 },
+ { -6273, -6623, -6791, -142 },
+ { -8313, -7668, -2141, -1275 },
+ { -6453, -8412, -3589, -4102 },
+ { -6747, -7750, -5690, -2498 },
+ { -7814, -6693, -3174, -2446 },
+ { -10383, -10130, -3931, -2364 },
+ { -10606, -8467, -5539, -2772 },
+ { -9475, -6671, -3305, -2271 },
+ { -8982, -9457, -5635, -4005 },
+ { -10111, -7965, -6515, -4180 },
+ { -7301, -6479, -5364, 720 },
+ { -9543, -8999, -7921, -912 },
+ { -9534, -8562, -3469, -384 },
+ { -7601, -10344, -3205, -1127 },
+ { -8088, -8620, -4954, -2888 },
+ { -8202, -8406, -7038, -3775 },
+ { -7312, -8324, -3334, -1775 },
+ { -8566, -9262, -8071, -4174 },
+ { -7068, -11300, -5573, -2907 },
+ { -8295, -8952, -4366, -1544 },
+ { -11104, -10210, -2285, -384 },
+ { -5213, -7520, -5008, -1339 },
+ { -5889, -7940, -5987, -1385 },
+ { -10816, -8201, -4153, -1485 },
+ { -10277, -8919, -6315, -1652 },
+ { -5888, -10320, -3821, -1733 },
+ { -10497, -7181, -6083, -3032 },
+ { -7721, -9724, -6591, -5336 },
+ { -5688, -7894, -3486, -2552 },
+ { -10014, -10500, -3247, -820 },
+ { -6301, -8765, -4506, -2923 },
+ { -8261, -7847, -6213, -1552 },
+ { -10212, -7481, -8113, -3954 },
+ { -6938, -10874, -6074, -4703 },
+ { -7183, -10968, -4446, -1773 },
+ { -7120, -9193, -1966, -2509 },
+ { -6234, -9263, -2313, -4284 },
+ { -8503, -9857, -2429, -608 },
+ { -9372, -7844, -8391, -2120 },
+ { -7951, -7157, -6535, -11 },
+ { -7256, -9473, -2172, -660 },
+ { -10063, -9612, -2515, -15 },
+ { -6684, -9134, -6109, -4206 },
+ { -8204, -11932, -5220, -2306 },
+ { -9710, -6706, -4115, -3275 },
+ { -6855, -7078, -2409, -4447 },
+ { -7344, -7673, -4479, -4116 },
+ { -8851, -6842, -4927, -2948 },
+ { -8927, -10452, -5633, -2194 },
+ { -8627, -9002, -7176, -1575 },
+ { -8209, -9722, -7021, -3324 },
+ { -3770, -10249, -3623, -4816 },
+ { -8183, -7465, -4090, 646 },
+ { -8163, -7149, 200, 498 },
+ { -8289, -6266, 686, -206 },
+ { -10030, -6241, -1032, -1864 },
+ { -8793, -8327, -773, -169 },
+ { -9149, -6215, 969, -15 },
+ { -8303, -5859, -7, 2006 },
+ { -9682, -7283, 255, 1322 },
+ { -9293, -7227, 71, -231 },
+ { -8525, -6215, 287, -837 },
+ { -10477, -5379, 1159, 1449 },
+ { -10726, -7856, -130, 102 },
+ { -8694, -7461, -1210, 690 },
+ { -9367, -5324, 1103, 3170 },
+ { -10686, -8055, -831, 1633 },
+ { -9201, -6873, -2704, 2258 },
+ { -8421, -5358, -1405, 226 },
+ { -9066, -5830, -307, -1571 },
+ { -11150, -7381, -2746, -900 },
+ { -9978, -5925, -2006, -437 },
+ { -9464, -4741, -273, 1061 },
+ { -10543, -6684, -1113, 1660 },
+ { -10073, -5576, 1083, -269 },
+ { -8826, -5763, 1600, 1486 },
+ { -10445, -9071, -1253, -64 },
+ { -12085, -5799, 2, 769 },
+ { -12939, -6663, 1650, 1437 },
+ { -10932, -6434, -1252, -649 },
+ { -11650, -7826, -2053, 710 },
+ { -12122, -6733, -1889, -731 },
+ { -9093, -6095, -2463, -842 },
+ { -10977, -4364, 469, 420 },
+ { -11488, -6908, -521, 893 },
+ { -9669, -5478, -842, 337 },
+ { -10606, -5203, -632, -1361 },
+ { -10198, -6284, 1662, 1277 },
+ { -10135, -5292, 2435, 3493 },
+ { -11027, -6561, 655, 56 },
+ { -10977, -5030, 1127, -358 },
+ { -12766, -3986, 1348, -335 },
+ { -14244, -7731, 264, 317 },
+ { -15124, -10309, -508, 1447 },
+ { -12821, -8638, -608, 137 },
+ { -13076, -8693, -2852, -431 },
+ { -11156, -5546, -2252, -1600 },
+ { -8692, -7366, -819, -1223 },
+ { -12507, -9816, -1714, -121 },
+ { -10712, -6666, 544, 3349 },
+ { -12462, -5890, -2491, -2318 },
+ { -12468, -7226, 437, 232 },
+ { -11300, -5226, 2068, 687 },
+ { -11994, -8320, -626, 2728 },
+ { -12222, -5476, 1142, 18 },
+ { -10277, -8122, -2418, 2003 },
+ { -13418, -6115, -3563, -2802 },
+ { -14759, -9834, -1243, 21 },
+ { -13699, -5665, 1525, 507 },
+ { -16269, -9476, -701, 163 },
+ { -12677, -5437, -247, -1019 },
+ { -11827, -4295, -181, -1243 },
+ { -12847, -4496, 2984, 1123 },
+ { -13860, -7915, -1166, -547 },
+ { -12276, -8145, -2290, -1527 },
+ { -11417, -4830, 2983, 1854 },
+ { -11793, -6002, 1163, 1940 },
+ { 11443, -4920, -3235, 3151 },
+ { 11300, -6616, -1506, 1175 },
+ { 9198, -4628, -2060, 2390 },
+ { 10532, -4027, -643, 912 },
+ { 9902, -3573, -1606, 1327 },
+ { 9653, -3536, -2240, 1869 },
+ { 9948, -5171, -423, 2662 },
+ { 12316, -4004, -1989, 281 },
+ { 12125, -4800, -1265, -163 },
+ { 10650, -2617, -2337, 1462 },
+ { 9909, -4968, -2376, 916 },
+ { 12944, -4647, -1958, 460 },
+ { 12988, -5283, -1141, 41 },
+ { 12321, -2915, -3621, 1025 },
+ { 11449, -2894, -2728, 351 },
+ { 12087, -3041, -2002, -32 },
+ { 11558, -4031, -1343, -399 },
+ { 12983, -3740, -3516, 1245 },
+ { 12099, -2515, -2752, 225 },
+ { 12515, -3465, -2701, 550 },
+ { 14683, -5022, -5272, 2996 },
+ { 12260, -3383, -1215, -528 },
+ { 13810, -5422, -2443, 1166 },
+ { 13421, -5378, -1886, 721 },
+ { 12961, -4259, -2594, 796 },
+ { 12266, -2104, -4768, 1591 },
+ { 13523, -4710, -3045, 1342 },
+ { 12437, -2099, -5610, 2117 },
+ { 11850, -2183, -3497, 661 },
+ { 12275, -3936, -597, -697 },
+ { 12459, -5253, -517, -544 },
+ { 12835, -4094, -1322, -168 },
+ { 14360, -5677, -3305, 1859 },
+ { 13905, -4552, -4309, 2117 },
+ { 11559, -3412, -1847, -81 },
+ { 13379, -3167, -5764, 2746 },
+ { 11910, -1634, -4342, 1052 },
+ { 12662, -4742, 71, -974 },
+ { 13057, -3254, -4424, 1705 },
+ { 15046, -5706, -4851, 3019 },
+ { 14162, -4142, -5514, 2843 },
+ { 12764, -1845, -6684, 2888 },
+ { 13714, -2374, -7838, 3857 },
+ { 13295, -1663, -8293, 4073 },
+ { 10032, -4152, -3403, 1421 },
+ { 10942, -5386, -2222, 950 },
+ { 10532, -6385, -1750, 1925 },
+ { 10273, -5972, -1534, 643 },
+ { 10605, -4782, -1695, 27 },
+ { 10988, -5153, -1123, -341 },
+ { 11629, -5884, -1060, 48 },
+ { 10441, -4045, -2431, 311 },
+ { 10788, -3595, -4171, 1807 },
+ { 12110, -5686, -2127, 976 },
+ { 11746, -4773, -2639, 891 },
+ { 11541, -5299, -3031, 1732 },
+ { 11416, -2559, -5359, 2198 },
+ { 11583, -5376, -704, 677 },
+ { 10416, -3214, -3516, 872 },
+ { 9651, -5435, -1618, 3255 },
+ { 9973, -5133, -996, 3923 },
+ { 11707, -4643, -430, -796 },
+ { 10994, -2709, -3587, 2302 },
+ { 10716, -5118, -645, 270 },
+ { 14100, -10314, 1095, 1531 },
+ { 12944, -8049, 1105, -741 },
+ { 13276, -7035, -511, 274 },
+ { 14008, -7254, -283, 139 },
+ { 11594, -6536, -91, 1671 },
+ { 11732, -8645, 746, 15 },
+ { 14613, -7085, -1578, 1183 },
+ { 13083, -6224, -750, -4 },
+ { 13988, -6256, -1592, 820 },
+ { 14678, -8683, 441, 126 },
+ { 15571, -8872, -521, 1139 },
+ { 15642, -9533, 341, 697 },
+ { 15960, -9586, -168, 1121 },
+ { 15464, -10239, 1433, -1 },
+ { 14934, -7887, -1046, 1080 },
+ { 15252, -7630, -1899, 1628 },
+ { 15485, -8384, -1234, 1484 },
+ { 15962, -8638, -1815, 1931 },
+ { 16501, -10664, 398, 1167 },
+ { 16146, -10145, 411, 918 },
+ { 14573, -7475, -697, 601 },
+ { 14302, -7996, 28, 257 },
+ { 14769, -6792, -2286, 1574 },
+ { 14144, -6137, -2169, 1257 },
+ { 14770, -6271, -3111, 1933 },
+ { 14110, -8312, 1083, -531 },
+ { 15235, -6991, -2993, 2174 },
+ { 13222, -5805, 547, -891 },
+ { 14796, -8762, 1254, -246 },
+ { 16040, -9181, -1005, 1551 },
+ { 16487, -10086, -373, 1420 },
+ { 15077, -9479, 966, 51 },
+ { 13026, -6468, 932, -1080 },
+ { 12703, -6152, -33, -573 },
+ { 15641, -6810, -4128, 2874 },
+ { 13282, -7673, 1583, -1283 },
+ { 12373, -7150, 1512, -917 },
+ { 12992, -7751, -678, 783 },
+ { 10907, -6858, -313, 2597 },
+ { 13026, -8963, 125, 2152 },
+ { 12770, -9946, 1957, -505 },
+ { 12482, -6849, -1268, 833 },
+ { 13790, -6181, -138, -279 },
+ { 12709, -8382, 2044, 227 },
+ { 12244, -6630, 203, -457 },
+ { 14209, -6816, -1032, 632 },
+ { 15134, -8267, -288, 640 },
+ { 13619, -6157, -1090, 356 },
+ { 14044, -7413, 725, -484 },
+ { 12958, -7753, 2585, -1980 },
+ { 13188, -8396, 2306, -1558 },
+ { 14379, -9980, 2132, -688 },
+ { 14275, -9857, 1162, 179 },
+ { 13690, -8648, 1621, -889 },
+ { 11770, -6829, -746, 278 },
+ { 12732, -8202, 286, 90 },
+ { 13630, -10146, 1867, -207 },
+ { 12072, -8740, 1299, -645 },
+ { 12852, -9492, 1226, 62 },
+ { 11792, -7382, -54, -116 },
+ { 13779, -9014, 487, 351 },
+ { 11951, -7729, 121, 834 },
+ { 11970, -9781, 2276, -4 },
+ { 12680, -7984, 2787, -787 },
+ { 13300, -14488, 6408, -1927 },
+ { 13635, -15355, 9153, -3073 },
+ { 12804, -13566, 5517, -1625 },
+ { 16624, -10854, 1690, 28 },
+ { 20387, -18532, 6162, -261 },
+ { 16515, -12642, 3392, -519 },
+ { 15800, -11095, 2151, -202 },
+ { 16824, -11790, 1651, 599 },
+ { 17604, -13213, 2563, 538 },
+ { 17892, -14177, 3562, 147 },
+ { 16987, -11399, 869, 1052 },
+ { 17003, -12456, 2442, 265 },
+ { 21657, -21806, 9198, -1250 },
+ { 16825, -13341, 3980, -686 },
+ { 17525, -12714, 1887, 805 },
+ { 16419, -11034, 1216, 617 },
+ { 20931, -19939, 7469, -684 },
+ { 18452, -15390, 4573, -191 },
+ { 14778, -10077, 2841, -1209 },
+ { 17402, -13319, 3042, 160 },
+ { 19365, -17922, 7087, -1061 },
+ { 16298, -11941, 2810, -351 },
+ { 19087, -16176, 4775, -84 },
+ { 17666, -12289, 938, 1224 },
+ { 18581, -15894, 5132, -430 },
+ { 19823, -16717, 4142, 545 },
+ { 19960, -19423, 8400, -1492 },
+ { 18973, -16817, 5906, -594 },
+ { 19079, -15431, 3528, 503 },
+ { 16667, -12485, 4467, -1302 },
+ { 19791, -17797, 6196, -529 },
+ { 20005, -17606, 5354, -20 },
+ { 20123, -18599, 6886, -728 },
+ { 19068, -14805, 2394, 1105 },
+ { 14443, -13723, 5631, -2029 },
+ { 14730, -14231, 5631, -1450 },
+ { 16089, -15959, 7271, -2029 },
+ { 13473, -11200, 3236, -924 },
+ { 14413, -10902, 2347, -267 },
+ { 17666, -18662, 11381, -3496 },
+ { 14749, -11042, 3305, -275 },
+ { 15304, -10486, 1869, -240 },
+ { 14809, -12126, 3369, -616 },
+ { 16896, -16561, 7307, -1845 },
+ { 15782, -14336, 5380, -1264 },
+ { 16395, -15520, 6415, -1588 },
+ { 13681, -11114, 2584, -320 },
+ { 14244, -12326, 4480, -1632 },
+ { 15247, -13119, 4265, -898 },
+ { 13987, -12091, 3469, -597 },
+ { 13941, -12770, 4240, -839 },
+ { 13771, -13627, 5252, -1384 },
+ { 15010, -16074, 7592, -2249 },
+ { 15852, -17226, 8619, -2655 },
+ { 18921, -16916, 6875, -1501 },
+ { 14909, -11678, 2768, -295 },
+ { 18988, -18353, 8424, -2070 },
+ { 15457, -15080, 6218, -1513 },
+ { 14916, -15512, 6949, -1883 },
+ { 18108, -14702, 4681, -701 },
+ { 17600, -15733, 5616, -775 },
+ { 14070, -13683, 6472, -2626 },
+ { 13832, -11914, 5201, -2232 },
+ { 18846, -19009, 9192, -1961 },
+ { -11981, -10994, -6324, -2264 },
+ { -10976, -9047, -6546, -3828 },
+ { -11288, -10532, -7014, -4191 },
+ { -10139, -10189, -7799, -2688 },
+ { -10555, -9988, -9181, -2040 },
+ { -11596, -11339, -10022, -2707 },
+ { -13400, -13395, -11306, -4206 },
+ { -9774, -12281, -7466, -4133 },
+ { -10842, -13125, -8777, -4956 },
+ { -11964, -15082, -9779, -5095 },
+ { -9382, -10188, -9053, -4927 },
+ { -11562, -11296, -3651, -985 },
+ { -9287, -10083, -7918, -4069 },
+ { -12821, -16556, -11410, -6195 },
+ { -12628, -8959, -4521, -1113 },
+ { -13845, -11581, -3649, -681 },
+ { -12685, -10269, -5483, -1275 },
+ { -14988, -12874, -5107, -1189 },
+ { -13761, -11367, -6202, -1804 },
+ { -13225, -11249, -7820, -3354 },
+ { -14809, -11992, -3202, -312 },
+ { -15620, -15519, -10210, -3433 },
+ { -12954, -10200, -3139, -611 },
+ { -11536, -9981, -5284, -923 },
+ { -13034, -12417, -4612, -1098 },
+ { -16911, -15505, -6123, -1352 },
+ { -17396, -17685, -8330, -2171 },
+ { -14120, -10764, -2265, -99 },
+ { -12598, -7367, -5406, -3530 },
+ { -14143, -12793, -10909, -5226 },
+ { -14692, -16871, -11626, -5554 },
+ { -12581, -11197, -9194, -3837 },
+ { -16752, -16726, -9746, -2808 },
+ { -10600, -10358, -6560, -1227 },
+ { -14573, -13312, -8957, -3393 },
+ { -10172, -8463, -8579, -3387 },
+ { -11418, -12421, -5522, -1842 },
+ { -11855, -14204, -6669, -2625 },
+ { -13308, -8191, -3941, -2194 },
+ { -10007, -12266, -5022, -1811 },
+ { -13532, -15771, -9497, -3175 },
+ { -11760, -11148, -10339, -5529 },
+ { -12149, -12763, -11198, -3697 },
+ { -12029, -12119, -8555, -1792 },
+ { -16995, -19957, -11447, -3471 },
+ { -13144, -14504, -9988, -3191 },
+ { -9938, -11064, -6139, -3162 },
+ { -8873, -11550, -8294, -6550 },
+ { -9303, -13010, -6150, -2711 },
+ { -15463, -10469, -1766, -170 },
+ { -15985, -11693, -3007, -650 },
+ { -17142, -10671, -1434, 47 },
+ { -16063, -13858, -4817, -1058 },
+ { -19446, -19599, -9594, -2464 },
+ { -20076, -18744, -8313, -1889 },
+ { -15047, -16085, -7590, -2250 },
+ { -13481, -16195, -8552, -2998 },
+ { -13829, -14869, -6704, -1932 },
+ { -16357, -18484, -9802, -2959 },
+ { -10551, -8393, -9303, -5070 },
+ { -11345, -9156, -5641, -3107 },
+ { -13217, -13449, -9270, -4541 },
+ { -11988, -13732, -9995, -6374 },
+ { -11007, -9519, -5168, -4107 },
+ { 9930, -7858, 8061, -4375 },
+ { 8274, -7867, 5992, -2096 },
+ { 9692, -9675, 7621, -3670 },
+ { 9589, -8110, 6509, -3010 },
+ { 12617, -11976, 10122, -5360 },
+ { 11867, -8895, 7948, -5323 },
+ { 10388, -10482, 9234, -4324 },
+ { 8188, -8220, 7810, -2737 },
+ { 10407, -8787, 4806, -1930 },
+ { 10348, -8845, 9233, -6614 },
+ { 9422, -7091, 4820, -2878 },
+ { 9758, -9796, 5584, -2256 },
+ { 10188, -7994, 5347, -3343 },
+ { 11133, -7455, 4015, -2306 },
+ { 10676, -10744, 6093, -2629 },
+ { 11522, -12184, 7848, -3375 },
+ { 8805, -9883, 5317, -3071 },
+ { 9498, -9654, 6555, -3592 },
+ { 10488, -8008, 4066, -1252 },
+ { 11261, -8930, 6068, -2738 },
+ { 12180, -10397, 5027, -1531 },
+ { 9138, -8531, 3601, -1959 },
+ { 8107, -8380, 4970, -2061 },
+ { 9737, -13248, 6438, -2617 },
+ { 11178, -10423, 2622, -522 },
+ { 9572, -12372, 5199, -2019 },
+ { 12057, -12144, 4147, -1099 },
+ { 9047, -9925, 2516, -665 },
+ { 10790, -8030, 5882, -4386 },
+ { 7199, -8426, 6337, -2841 },
+ { 7778, -8285, 3529, -3442 },
+ { 7559, -10569, 3484, -1332 },
+ { 9404, -8115, 7484, -5541 },
+ { 7792, -11976, 5546, -2573 },
+ { 9313, -10264, 7661, -5195 },
+ { 6701, -10725, 4370, -1784 },
+ { 4918, -11361, 4507, -4527 },
+ { 5147, -12305, 3978, -5556 },
+ { 6525, -9899, 4481, -3129 },
+ { 7538, -12855, 6060, -4826 },
+ { 8659, -12111, 7159, -4430 },
+ { 8440, -11304, 4547, -1747 },
+ { 9216, -10918, 3507, -1195 },
+ { 6165, -9254, 4771, -4677 },
+ { 9163, -11019, 5637, -4935 },
+ { 13441, -11509, 6676, -2434 },
+ { 7912, -9398, 6663, -4048 },
+ { 11723, -13745, 8131, -4148 },
+ { 6065, -10257, 5005, -6327 },
+ { 11618, -12417, 5336, -1894 },
+ { 8891, -13924, 8407, -6131 },
+ { 9622, -12563, 7908, -5109 },
+ { 11479, -10315, 8349, -3991 },
+ { 11676, -14103, 6611, -2330 },
+ { 11951, -8953, 3829, -1550 },
+ { 10486, -8044, 10493, -5920 },
+ { 11801, -10769, 9763, -5305 },
+ { 6109, -8676, 5827, -1346 },
+ { 7030, -9611, 5624, -5761 },
+ { 12808, -12886, 8683, -4148 },
+ { 13213, -10464, 6381, -3189 },
+ { 11796, -13681, 10703, -6075 },
+ { 9639, -7949, 9625, -3944 },
+ { 8538, -6997, 5309, 453 }
+};
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_fir.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_fir.h
new file mode 100644
index 000000000..d2177126a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_fir.h
@@ -0,0 +1,2085 @@
+/*
+ * fir.h
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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
+ */
+
+double fir_32bands_perfect[] =
+{
++1.135985195E-010,
+-6.022448247E-007,
++9.742954035E-007,
++7.018770981E-011,
+-6.628192182E-007,
++1.085227950E-006,
+-1.608403011E-008,
+-6.982898526E-007,
++1.162929266E-006,
+-5.083275667E-008,
+-7.020648809E-007,
++1.194632091E-006,
+-1.543309907E-007,
+-6.767839409E-007,
++1.179182050E-006,
+-3.961981463E-007,
+-6.262345096E-007,
++1.033426656E-006,
+-7.342250683E-007,
+-5.564140224E-007,
++9.451737242E-007,
+-3.970030775E-007,
++7.003467317E-007,
++1.975324267E-006,
+-4.741137047E-007,
++8.419976893E-007,
++1.190443072E-006,
++5.234479659E-007,
++6.402664354E-008,
+-1.470520488E-006,
++2.014677420E-007,
+-3.246264413E-008,
+-1.853591357E-006,
++7.834767501E-008,
+-3.809887872E-008,
++7.198007665E-007,
++8.434094667E-008,
++3.086857760E-006,
+-6.702406963E-010,
++6.437721822E-008,
++6.084746474E-006,
+-1.613285505E-009,
++1.189317118E-006,
++9.561075785E-006,
+-2.682709610E-009,
++2.497214155E-006,
++1.309637537E-005,
+-3.399493131E-009,
++3.617151151E-006,
++2.263354872E-005,
++1.314406006E-008,
++3.157242645E-006,
++2.847247197E-005,
++7.506701927E-009,
++2.319611212E-006,
++3.415624451E-005,
++2.788728892E-008,
++7.869333785E-006,
++3.946387005E-005,
++1.444918922E-007,
++9.826449968E-006,
++4.425736552E-005,
++3.132386439E-007,
++1.177108606E-005,
++4.839275425E-005,
++1.399798180E-006,
++1.379448349E-005,
++5.176846025E-005,
++2.032118118E-006,
++1.571428584E-005,
++5.429694284E-005,
++2.715013807E-006,
++1.743183020E-005,
++5.595519906E-005,
++3.453840463E-006,
++1.884208177E-005,
++4.916387297E-006,
++4.195037945E-006,
++1.987093310E-005,
++9.299508747E-006,
++4.896494374E-006,
++2.042970118E-005,
++1.356193479E-005,
++5.516381407E-006,
+-3.144468428E-005,
++1.751866148E-005,
++6.015239251E-006,
+-3.334947178E-005,
++2.093936746E-005,
++6.361419310E-006,
+-3.460439257E-005,
++2.362549276E-005,
++8.006985809E-006,
+-3.515914432E-005,
++2.537086584E-005,
++8.087732567E-006,
+-3.495384954E-005,
++2.618136386E-005,
++7.941360309E-006,
+-3.397853652E-005,
++2.554462844E-005,
++7.568834008E-006,
+-3.225446198E-005,
++3.018750249E-005,
++6.986399967E-006,
+-2.978993689E-005,
++2.570833203E-005,
++6.225028756E-006,
+-2.677291741E-005,
++1.985177369E-005,
++5.315936960E-006,
+-1.806914770E-005,
++1.191342653E-005,
++4.429412002E-006,
+-1.776598037E-005,
++2.525620175E-006,
++3.332600045E-006,
+-1.661818715E-005,
+-1.521241393E-005,
++8.427224429E-007,
+-1.207003334E-005,
+-1.617751332E-005,
++4.341498823E-007,
+-6.993315310E-006,
++1.992636317E-005,
++9.458596395E-008,
+-5.633860383E-007,
++1.774702469E-005,
++2.975164826E-008,
+-9.984935332E-007,
++4.624524081E-005,
++5.610509834E-005,
+-5.729619297E-004,
++4.244441516E-004,
++6.568001118E-005,
+-6.358824321E-004,
++2.206075296E-004,
++7.513730816E-005,
+-7.021900383E-004,
+-2.719412748E-007,
++8.413690375E-005,
+-7.698345580E-004,
+-2.382978710E-004,
++8.757545584E-005,
+-8.385353722E-004,
+-4.935106263E-004,
++9.517164290E-005,
+-9.078957955E-004,
+-7.658848190E-004,
++1.020687996E-004,
+-9.775133803E-004,
+-1.055365428E-003,
++1.084438481E-004,
+-1.046945457E-003,
+-1.361547387E-003,
++1.140582463E-004,
+-1.115717343E-003,
+-1.684492454E-003,
++1.187910311E-004,
+-1.183370827E-003,
+-2.023874084E-003,
++1.224978914E-004,
+-1.252829796E-003,
+-2.379294252E-003,
++1.250260248E-004,
+-1.316190348E-003,
+-2.750317100E-003,
++1.262027217E-004,
+-1.376571832E-003,
+-3.136433195E-003,
++1.226499153E-004,
+-1.433344092E-003,
+-3.537061159E-003,
++1.213575742E-004,
+-1.485876855E-003,
+-3.951539751E-003,
++1.180980107E-004,
+-1.533520175E-003,
+-4.379155114E-003,
++1.126275165E-004,
+-1.575609902E-003,
+-4.819062538E-003,
++1.047207043E-004,
+-1.611457788E-003,
+-5.270531867E-003,
++9.417100227E-005,
+-1.640390139E-003,
+-5.732392892E-003,
++8.078388782E-005,
+-1.661288203E-003,
+-6.203945260E-003,
++6.447290798E-005,
+-1.674512983E-003,
+-6.683901884E-003,
++4.491530854E-005,
+-1.678415807E-003,
+-7.170005701E-003,
++2.470704203E-005,
+-1.672798418E-003,
+-7.664063945E-003,
+-1.714242217E-006,
+-1.656501088E-003,
+-8.162760176E-003,
+-3.193307566E-005,
+-1.633993932E-003,
+-8.665001951E-003,
+-6.541742187E-005,
+-1.593449386E-003,
+-9.170533158E-003,
+-1.024175072E-004,
++1.542080659E-003,
+-9.676489048E-003,
+-1.312203676E-004,
++1.479332102E-003,
+-1.018219907E-002,
+-1.774113771E-004,
++1.395521569E-003,
+-1.068630442E-002,
+-2.233728592E-004,
++1.303116791E-003,
+-1.118756086E-002,
+-2.682086197E-004,
++1.196175464E-003,
+-1.168460958E-002,
+-3.347633174E-004,
++1.073757303E-003,
+-1.217562053E-002,
+-3.906481725E-004,
++9.358961834E-004,
+-1.265939046E-002,
+-4.490280990E-004,
++7.817269652E-004,
+-1.313448418E-002,
+-5.099929986E-004,
++6.114174030E-004,
+-1.359948888E-002,
+-1.405300573E-002,
++1.572482102E-002,
++4.935106263E-004,
+-1.449365262E-002,
++1.533095632E-002,
++2.382978710E-004,
+-1.492007636E-002,
++1.492007636E-002,
++2.719412748E-007,
+-1.533095632E-002,
++1.449365262E-002,
+-2.206075296E-004,
+-1.572482102E-002,
++1.405300573E-002,
+-4.244441516E-004,
+-1.610082202E-002,
++1.359948888E-002,
+-6.114174030E-004,
+-1.645756140E-002,
++1.313448418E-002,
+-7.817269652E-004,
+-1.679391414E-002,
++1.265939046E-002,
+-9.358961834E-004,
+-1.710879989E-002,
++1.217562053E-002,
+-1.073757303E-003,
+-1.740120351E-002,
++1.168460958E-002,
+-1.196175464E-003,
+-1.767017506E-002,
++1.118756086E-002,
+-1.303116791E-003,
+-1.791484281E-002,
++1.068630442E-002,
+-1.395521569E-003,
+-1.813439466E-002,
++1.018219907E-002,
+-1.479332102E-003,
+-1.832821220E-002,
++9.676489048E-003,
+-1.542080659E-003,
+-1.849545911E-002,
++9.170533158E-003,
++1.593449386E-003,
+-1.863567345E-002,
++8.665001951E-003,
++1.633993932E-003,
+-1.874836907E-002,
++8.162760176E-003,
++1.656501088E-003,
+-1.883326657E-002,
++7.664063945E-003,
++1.672798418E-003,
+-1.889026538E-002,
++7.170005701E-003,
++1.678415807E-003,
+-1.891860925E-002,
++6.683901884E-003,
++1.674512983E-003,
++1.891860925E-002,
++6.203945260E-003,
++1.661288203E-003,
++1.889026538E-002,
++5.732392892E-003,
++1.640390139E-003,
++1.883326657E-002,
++5.270531867E-003,
++1.611457788E-003,
++1.874836907E-002,
++4.819062538E-003,
++1.575609902E-003,
++1.863567345E-002,
++4.379155114E-003,
++1.533520175E-003,
++1.849545911E-002,
++3.951539751E-003,
++1.485876855E-003,
++1.832821220E-002,
++3.537061159E-003,
++1.433344092E-003,
++1.813439466E-002,
++3.136433195E-003,
++1.376571832E-003,
++1.791484281E-002,
++2.750317100E-003,
++1.316190348E-003,
++1.767017506E-002,
++2.379294252E-003,
++1.252829796E-003,
++1.740120351E-002,
++2.023874084E-003,
++1.183370827E-003,
++1.710879989E-002,
++1.684492454E-003,
++1.115717343E-003,
++1.679391414E-002,
++1.361547387E-003,
++1.046945457E-003,
++1.645756140E-002,
++1.055365428E-003,
++9.775133803E-004,
++1.610082202E-002,
++7.658848190E-004,
++9.078957955E-004,
++8.385353722E-004,
+-8.757545584E-005,
+-6.084746474E-006,
++7.698345580E-004,
+-8.413690375E-005,
+-3.086857760E-006,
++7.021900383E-004,
+-7.513730816E-005,
+-7.198007665E-007,
++6.358824321E-004,
+-6.568001118E-005,
++1.853591357E-006,
++5.729619297E-004,
+-5.610509834E-005,
++1.470520488E-006,
++5.099929986E-004,
+-4.624524081E-005,
++9.984935332E-007,
++4.490280990E-004,
+-1.774702469E-005,
++5.633860383E-007,
++3.906481725E-004,
+-1.992636317E-005,
++6.993315310E-006,
++3.347633174E-004,
++1.617751332E-005,
++1.207003334E-005,
++2.682086197E-004,
++1.521241393E-005,
++1.661818715E-005,
++2.233728592E-004,
+-2.525620175E-006,
++1.776598037E-005,
++1.774113771E-004,
+-1.191342653E-005,
++1.806914770E-005,
++1.312203676E-004,
+-1.985177369E-005,
++2.677291741E-005,
++1.024175072E-004,
+-2.570833203E-005,
++2.978993689E-005,
++6.541742187E-005,
+-3.018750249E-005,
++3.225446198E-005,
++3.193307566E-005,
+-2.554462844E-005,
++3.397853652E-005,
++1.714242217E-006,
+-2.618136386E-005,
++3.495384954E-005,
+-2.470704203E-005,
+-2.537086584E-005,
++3.515914432E-005,
+-4.491530854E-005,
+-2.362549276E-005,
++3.460439257E-005,
+-6.447290798E-005,
+-2.093936746E-005,
++3.334947178E-005,
+-8.078388782E-005,
+-1.751866148E-005,
++3.144468428E-005,
+-9.417100227E-005,
+-1.356193479E-005,
+-2.042970118E-005,
+-1.047207043E-004,
+-9.299508747E-006,
+-1.987093310E-005,
+-1.126275165E-004,
+-4.916387297E-006,
+-1.884208177E-005,
+-1.180980107E-004,
+-5.595519906E-005,
+-1.743183020E-005,
+-1.213575742E-004,
+-5.429694284E-005,
+-1.571428584E-005,
+-1.226499153E-004,
+-5.176846025E-005,
+-1.379448349E-005,
+-1.262027217E-004,
+-4.839275425E-005,
+-1.177108606E-005,
+-1.250260248E-004,
+-4.425736552E-005,
+-9.826449968E-006,
+-1.224978914E-004,
+-3.946387005E-005,
+-7.869333785E-006,
+-1.187910311E-004,
+-3.415624451E-005,
+-2.319611212E-006,
+-1.140582463E-004,
+-2.847247197E-005,
+-3.157242645E-006,
+-1.084438481E-004,
+-2.263354872E-005,
+-3.617151151E-006,
+-1.020687996E-004,
+-1.309637537E-005,
+-2.497214155E-006,
+-9.517164290E-005,
+-9.561075785E-006,
+-1.189317118E-006,
+-6.437721822E-008,
+-4.195037945E-006,
+-1.194632091E-006,
+-8.434094667E-008,
+-3.453840463E-006,
+-1.162929266E-006,
++3.809887872E-008,
+-2.715013807E-006,
+-1.085227950E-006,
++3.246264413E-008,
+-2.032118118E-006,
+-9.742954035E-007,
+-6.402664354E-008,
+-1.399798180E-006,
+-8.419976893E-007,
+-2.975164826E-008,
+-3.132386439E-007,
+-7.003467317E-007,
+-9.458596395E-008,
+-1.444918922E-007,
++5.564140224E-007,
+-4.341498823E-007,
+-2.788728892E-008,
++6.262345096E-007,
+-8.427224429E-007,
+-7.506701927E-009,
++6.767839409E-007,
+-3.332600045E-006,
+-1.314406006E-008,
++7.020648809E-007,
+-4.429412002E-006,
++3.399493131E-009,
++6.982898526E-007,
+-5.315936960E-006,
++2.682709610E-009,
++6.628192182E-007,
+-6.225028756E-006,
++1.613285505E-009,
++6.022448247E-007,
+-6.986399967E-006,
++6.702406963E-010,
++4.741137047E-007,
+-7.568834008E-006,
+-7.834767501E-008,
++3.970030775E-007,
+-7.941360309E-006,
+-2.014677420E-007,
++7.342250683E-007,
+-8.087732567E-006,
+-5.234479659E-007,
++3.961981463E-007,
+-8.006985809E-006,
+-1.190443072E-006,
++1.543309907E-007,
+-6.361419310E-006,
+-1.975324267E-006,
++5.083275667E-008,
+-6.015239251E-006,
+-9.451737242E-007,
++1.608403011E-008,
+-5.516381407E-006,
+-1.033426656E-006,
+-7.018770981E-011,
+-4.896494374E-006,
+-1.179182050E-006,
+-1.135985195E-010
+};
+
+double fir_32bands_nonperfect[] =
+{
+-1.390191784E-007,
+-1.693738625E-007,
+-2.030677564E-007,
+-2.404238444E-007,
+-2.818143514E-007,
+-3.276689142E-007,
+-3.784752209E-007,
+-4.347855338E-007,
+-4.972276315E-007,
+-5.665120852E-007,
+-6.434325428E-007,
+-7.288739425E-007,
+-8.238164355E-007,
+-9.293416952E-007,
+-1.046637067E-006,
+-1.176999604E-006,
+-1.321840614E-006,
+-1.482681114E-006,
+-1.661159786E-006,
+-1.859034001E-006,
+-2.078171747E-006,
+-2.320550948E-006,
+-2.588257530E-006,
+-2.883470643E-006,
+-3.208459020E-006,
+-3.565570978E-006,
+-3.957220997E-006,
+-4.385879038E-006,
+-4.854050530E-006,
+-5.364252502E-006,
+-5.918994248E-006,
+-6.520755960E-006,
+-7.171964626E-006,
+-7.874960829E-006,
+-8.631964192E-006,
+-9.445050637E-006,
+-1.031611009E-005,
+-1.124680875E-005,
+-1.223855270E-005,
+-1.329243969E-005,
+-1.440921824E-005,
+-1.558924305E-005,
+-1.683242772E-005,
+-1.813820381E-005,
+-1.950545993E-005,
+-2.093250441E-005,
+-2.241701623E-005,
+-2.395598858E-005,
+-2.554569073E-005,
+-2.718161704E-005,
+-2.885844333E-005,
+-3.056998685E-005,
+-3.230916263E-005,
+-3.406793985E-005,
+-3.583733633E-005,
+-3.760734762E-005,
+-3.936696885E-005,
+-4.110412556E-005,
+-4.280570283E-005,
+-4.445751256E-005,
+-4.604430433E-005,
+-4.754976908E-005,
+-4.895655002E-005,
+-5.024627535E-005,
++5.139957648E-005,
++5.239612074E-005,
++5.321469871E-005,
++5.383323878E-005,
++5.422891263E-005,
++5.437819709E-005,
++5.425697600E-005,
++5.384063843E-005,
++5.310418419E-005,
++5.202236207E-005,
++5.056979353E-005,
++4.872112549E-005,
++4.645117951E-005,
++4.373511547E-005,
++4.054862075E-005,
++3.686808850E-005,
++3.267079956E-005,
++2.793515523E-005,
++2.264085742E-005,
++1.676913780E-005,
++1.030297699E-005,
++3.227306706E-006,
+-4.470633485E-006,
+-1.280130618E-005,
+-2.177240640E-005,
+-3.138873581E-005,
+-4.165195787E-005,
+-5.256036457E-005,
+-6.410864444E-005,
+-7.628766616E-005,
+-8.908427117E-005,
+-1.024810626E-004,
+-1.164562127E-004,
+-1.309833024E-004,
+-1.460311323E-004,
+-1.615635992E-004,
+-1.775395358E-004,
+-1.939126523E-004,
+-2.106313768E-004,
+-2.276388550E-004,
+-2.448728774E-004,
+-2.622658503E-004,
+-2.797449124E-004,
+-2.972317743E-004,
+-3.146430245E-004,
+-3.318900708E-004,
+-3.488793736E-004,
+-3.655125911E-004,
+-3.816867538E-004,
+-3.972945851E-004,
+-4.122247046E-004,
+-4.263620067E-004,
+-4.395879805E-004,
+-4.517810594E-004,
+-4.628172028E-004,
+-4.725702747E-004,
+-4.809123348E-004,
+-4.877146275E-004,
+-4.928477574E-004,
+-4.961824161E-004,
+-4.975944757E-004,
+-4.969481961E-004,
+-4.941228544E-004,
+-4.889960401E-004,
++4.814492422E-004,
++4.713678791E-004,
++4.586426076E-004,
++4.431701091E-004,
++4.248536134E-004,
++4.036037717E-004,
++3.793396754E-004,
++3.519894381E-004,
++3.214911267E-004,
++2.877934603E-004,
++2.508567995E-004,
++2.106537577E-004,
++1.671699720E-004,
++1.204049113E-004,
++7.037253090E-005,
++1.710198012E-005,
+-3.936182839E-005,
+-9.895755647E-005,
+-1.616069785E-004,
+-2.272142592E-004,
+-2.956659591E-004,
+-3.668301215E-004,
+-4.405563814E-004,
+-5.166754709E-004,
+-5.949990009E-004,
+-6.753197522E-004,
+-7.574109477E-004,
+-8.410271257E-004,
+-9.259034996E-004,
+-1.011756598E-003,
+-1.098284614E-003,
+-1.185167348E-003,
+-1.272067428E-003,
+-1.358630019E-003,
+-1.444484224E-003,
+-1.529243193E-003,
+-1.612505526E-003,
+-1.693855622E-003,
+-1.772865304E-003,
+-1.849094522E-003,
+-1.922092517E-003,
+-1.991399564E-003,
+-2.056547208E-003,
+-2.117061289E-003,
+-2.172462177E-003,
+-2.222266514E-003,
+-2.265989315E-003,
+-2.303145360E-003,
+-2.333251061E-003,
+-2.355825622E-003,
+-2.370394068E-003,
+-2.376487479E-003,
+-2.373647178E-003,
+-2.361423569E-003,
+-2.339380793E-003,
+-2.307097195E-003,
+-2.264167881E-003,
+-2.210205887E-003,
+-2.144844970E-003,
+-2.067740774E-003,
+-1.978572691E-003,
+-1.877046190E-003,
+-1.762894331E-003,
+-1.635878929E-003,
++1.495792647E-003,
++1.342460280E-003,
++1.175740734E-003,
++9.955273708E-004,
++8.017504588E-004,
++5.943773431E-004,
++3.734139318E-004,
++1.389056415E-004,
+-1.090620208E-004,
+-3.703625989E-004,
+-6.448282511E-004,
+-9.322494152E-004,
+-1.232374110E-003,
+-1.544908970E-003,
+-1.869517611E-003,
+-2.205822384E-003,
+-2.553403843E-003,
+-2.911801683E-003,
+-3.280514618E-003,
+-3.659002949E-003,
+-4.046686925E-003,
+-4.442950245E-003,
+-4.847140983E-003,
+-5.258570891E-003,
+-5.676518660E-003,
+-6.100233644E-003,
+-6.528933067E-003,
+-6.961807609E-003,
+-7.398022339E-003,
+-7.836719044E-003,
+-8.277016692E-003,
+-8.718019351E-003,
+-9.158811532E-003,
+-9.598465636E-003,
+-1.003604382E-002,
+-1.047059800E-002,
+-1.090117730E-002,
+-1.132682897E-002,
+-1.174659748E-002,
+-1.215953380E-002,
+-1.256469358E-002,
+-1.296114177E-002,
+-1.334795821E-002,
+-1.372423489E-002,
+-1.408908330E-002,
+-1.444163360E-002,
+-1.478104480E-002,
+-1.510649733E-002,
+-1.541720331E-002,
+-1.571240649E-002,
+-1.599138230E-002,
+-1.625344716E-002,
+-1.649795473E-002,
+-1.672429405E-002,
+-1.693190821E-002,
+-1.712027565E-002,
+-1.728892699E-002,
+-1.743743755E-002,
+-1.756543480E-002,
+-1.767260395E-002,
+-1.775865816E-002,
+-1.782339066E-002,
+-1.786663756E-002,
+-1.788828894E-002,
++1.788828894E-002,
++1.786663756E-002,
++1.782339066E-002,
++1.775865816E-002,
++1.767260395E-002,
++1.756543480E-002,
++1.743743755E-002,
++1.728892699E-002,
++1.712027565E-002,
++1.693190821E-002,
++1.672429405E-002,
++1.649795473E-002,
++1.625344716E-002,
++1.599138230E-002,
++1.571240649E-002,
++1.541720331E-002,
++1.510649733E-002,
++1.478104480E-002,
++1.444163360E-002,
++1.408908330E-002,
++1.372423489E-002,
++1.334795821E-002,
++1.296114177E-002,
++1.256469358E-002,
++1.215953380E-002,
++1.174659748E-002,
++1.132682897E-002,
++1.090117730E-002,
++1.047059800E-002,
++1.003604382E-002,
++9.598465636E-003,
++9.158811532E-003,
++8.718019351E-003,
++8.277016692E-003,
++7.836719044E-003,
++7.398022339E-003,
++6.961807609E-003,
++6.528933067E-003,
++6.100233644E-003,
++5.676518660E-003,
++5.258570891E-003,
++4.847140983E-003,
++4.442950245E-003,
++4.046686925E-003,
++3.659002949E-003,
++3.280514618E-003,
++2.911801683E-003,
++2.553403843E-003,
++2.205822384E-003,
++1.869517611E-003,
++1.544908970E-003,
++1.232374110E-003,
++9.322494152E-004,
++6.448282511E-004,
++3.703625989E-004,
++1.090620208E-004,
+-1.389056415E-004,
+-3.734139318E-004,
+-5.943773431E-004,
+-8.017504588E-004,
+-9.955273708E-004,
+-1.175740734E-003,
+-1.342460280E-003,
+-1.495792647E-003,
++1.635878929E-003,
++1.762894331E-003,
++1.877046190E-003,
++1.978572691E-003,
++2.067740774E-003,
++2.144844970E-003,
++2.210205887E-003,
++2.264167881E-003,
++2.307097195E-003,
++2.339380793E-003,
++2.361423569E-003,
++2.373647178E-003,
++2.376487479E-003,
++2.370394068E-003,
++2.355825622E-003,
++2.333251061E-003,
++2.303145360E-003,
++2.265989315E-003,
++2.222266514E-003,
++2.172462177E-003,
++2.117061289E-003,
++2.056547208E-003,
++1.991399564E-003,
++1.922092517E-003,
++1.849094522E-003,
++1.772865304E-003,
++1.693855622E-003,
++1.612505526E-003,
++1.529243193E-003,
++1.444484224E-003,
++1.358630019E-003,
++1.272067428E-003,
++1.185167348E-003,
++1.098284614E-003,
++1.011756598E-003,
++9.259034996E-004,
++8.410271257E-004,
++7.574109477E-004,
++6.753197522E-004,
++5.949990009E-004,
++5.166754709E-004,
++4.405563814E-004,
++3.668301215E-004,
++2.956659591E-004,
++2.272142592E-004,
++1.616069785E-004,
++9.895755647E-005,
++3.936182839E-005,
+-1.710198012E-005,
+-7.037253090E-005,
+-1.204049113E-004,
+-1.671699720E-004,
+-2.106537577E-004,
+-2.508567995E-004,
+-2.877934603E-004,
+-3.214911267E-004,
+-3.519894381E-004,
+-3.793396754E-004,
+-4.036037717E-004,
+-4.248536134E-004,
+-4.431701091E-004,
+-4.586426076E-004,
+-4.713678791E-004,
+-4.814492422E-004,
++4.889960401E-004,
++4.941228544E-004,
++4.969481961E-004,
++4.975944757E-004,
++4.961824161E-004,
++4.928477574E-004,
++4.877146275E-004,
++4.809123348E-004,
++4.725702747E-004,
++4.628172028E-004,
++4.517810594E-004,
++4.395879805E-004,
++4.263620067E-004,
++4.122247046E-004,
++3.972945851E-004,
++3.816867538E-004,
++3.655125911E-004,
++3.488793736E-004,
++3.318900708E-004,
++3.146430245E-004,
++2.972317743E-004,
++2.797449124E-004,
++2.622658503E-004,
++2.448728774E-004,
++2.276388550E-004,
++2.106313768E-004,
++1.939126523E-004,
++1.775395358E-004,
++1.615635992E-004,
++1.460311323E-004,
++1.309833024E-004,
++1.164562127E-004,
++1.024810626E-004,
++8.908427117E-005,
++7.628766616E-005,
++6.410864444E-005,
++5.256036457E-005,
++4.165195787E-005,
++3.138873581E-005,
++2.177240640E-005,
++1.280130618E-005,
++4.470633485E-006,
+-3.227306706E-006,
+-1.030297699E-005,
+-1.676913780E-005,
+-2.264085742E-005,
+-2.793515523E-005,
+-3.267079956E-005,
+-3.686808850E-005,
+-4.054862075E-005,
+-4.373511547E-005,
+-4.645117951E-005,
+-4.872112549E-005,
+-5.056979353E-005,
+-5.202236207E-005,
+-5.310418419E-005,
+-5.384063843E-005,
+-5.425697600E-005,
+-5.437819709E-005,
+-5.422891263E-005,
+-5.383323878E-005,
+-5.321469871E-005,
+-5.239612074E-005,
+-5.139957648E-005,
++5.024627535E-005,
++4.895655002E-005,
++4.754976908E-005,
++4.604430433E-005,
++4.445751256E-005,
++4.280570283E-005,
++4.110412556E-005,
++3.936696885E-005,
++3.760734762E-005,
++3.583733633E-005,
++3.406793985E-005,
++3.230916263E-005,
++3.056998685E-005,
++2.885844333E-005,
++2.718161704E-005,
++2.554569073E-005,
++2.395598858E-005,
++2.241701623E-005,
++2.093250441E-005,
++1.950545993E-005,
++1.813820381E-005,
++1.683242772E-005,
++1.558924305E-005,
++1.440921824E-005,
++1.329243969E-005,
++1.223855270E-005,
++1.124680875E-005,
++1.031611009E-005,
++9.445050637E-006,
++8.631964192E-006,
++7.874960829E-006,
++7.171964626E-006,
++6.520755960E-006,
++5.918994248E-006,
++5.364252502E-006,
++4.854050530E-006,
++4.385879038E-006,
++3.957220997E-006,
++3.565570978E-006,
++3.208459020E-006,
++2.883470643E-006,
++2.588257530E-006,
++2.320550948E-006,
++2.078171747E-006,
++1.859034001E-006,
++1.661159786E-006,
++1.482681114E-006,
++1.321840614E-006,
++1.176999604E-006,
++1.046637067E-006,
++9.293416952E-007,
++8.238164355E-007,
++7.288739425E-007,
++6.434325428E-007,
++5.665120852E-007,
++4.972276315E-007,
++4.347855338E-007,
++3.784752209E-007,
++3.276689142E-007,
++2.818143514E-007,
++2.404238444E-007,
++2.030677564E-007,
++1.693738625E-007,
++1.390191784E-007
+};
+
+double lfe_fir_64[] =
+{
+2.6584343868307770E-004,
+8.1793652498163280E-005,
+9.4393239123746760E-005,
+1.0821702744578940E-004,
+1.2333714403212070E-004,
+1.3974857574794440E-004,
+1.5759580128360540E-004,
+1.7699223826639360E-004,
+1.9817386055365200E-004,
+2.2118473134469240E-004,
+2.4602311896160240E-004,
+2.7261159266345200E-004,
+3.0138631700538100E-004,
+3.3283955417573450E-004,
+3.6589911906048660E-004,
+4.0182814700528980E-004,
+4.4018754852004350E-004,
+4.8127761692740020E-004,
+5.2524596685543660E-004,
+5.7215924607589840E-004,
+6.2221300322562460E-004,
+6.7555153509601950E-004,
+7.3241489008069040E-004,
+7.9285167157649990E-004,
+8.5701106581836940E-004,
+9.2511920956894760E-004,
+9.9747709464281800E-004,
+1.0739302961155770E-003,
+1.1550235794857140E-003,
+1.2406768510118130E-003,
+1.3312589144334200E-003,
+1.4268938684836030E-003,
+1.5278297942131760E-003,
+1.6342115122824910E-003,
+1.7463274998590350E-003,
+1.8643775256350640E-003,
+1.9886041991412640E-003,
+2.1191518753767010E-003,
+2.2563596721738580E-003,
+2.4004334118217230E-003,
+2.5515670422464610E-003,
+2.7100932784378530E-003,
+2.8761904686689380E-003,
+3.0501529108732940E-003,
+3.2322725746780640E-003,
+3.4227769356220960E-003,
+3.6219672765582800E-003,
+3.8300913292914630E-003,
+4.0474990382790560E-003,
+4.2744171805679800E-003,
+4.5111598446965220E-003,
+4.7580120153725150E-003,
+5.0153112970292570E-003,
+5.2832840010523800E-003,
+5.5623454973101620E-003,
+5.8526843786239620E-003,
+6.1547122895717620E-003,
+6.4686913974583150E-003,
+6.7949919030070300E-003,
+7.1338820271193980E-003,
+7.4857366271317010E-003,
+7.8508658334612850E-003,
+8.2296309992671010E-003,
+8.6223213002085690E-003,
+9.0293306857347480E-003,
+9.4509534537792200E-003,
+9.8875602707266800E-003,
+1.0339494794607160E-002,
+1.0807084850966930E-002,
+1.1290682479739190E-002,
+1.1790650896728040E-002,
+1.2307321652770040E-002,
+1.2841059826314450E-002,
+1.3392185792326930E-002,
+1.3961089774966240E-002,
+1.4548087492585180E-002,
+1.5153550542891020E-002,
+1.5777811408042910E-002,
+1.6421230509877200E-002,
+1.7084129154682160E-002,
+1.7766902223229410E-002,
+1.8469827249646190E-002,
+1.9193304702639580E-002,
+1.9937623292207720E-002,
+2.0703161135315900E-002,
+2.1490212529897690E-002,
+2.2299138829112050E-002,
+2.3130238056182860E-002,
+2.3983856663107870E-002,
+2.4860285222530360E-002,
+2.5759860873222350E-002,
+2.6682861149311060E-002,
+2.7629608288407320E-002,
+2.8600392863154410E-002,
+2.9595496132969860E-002,
+3.0615204945206640E-002,
+3.1659796833992000E-002,
+3.2729536294937140E-002,
+3.3824689686298370E-002,
+3.4945506602525710E-002,
+3.6092240363359450E-002,
+3.7265110760927200E-002,
+3.8464374840259550E-002,
+3.9690230041742320E-002,
+4.0942888706922530E-002,
+4.2222552001476290E-002,
+4.3529424816370010E-002,
+4.4863656163215640E-002,
+4.6225443482398990E-002,
+4.7614917159080510E-002,
+4.9032241106033330E-002,
+5.0477534532547000E-002,
+5.1950931549072270E-002,
+5.3452525287866590E-002,
+5.4982420057058330E-002,
+5.6540694087743760E-002,
+5.8127421885728840E-002,
+5.9742655605077740E-002,
+6.1386436223983760E-002,
+6.3058786094188690E-002,
+6.4759708940982820E-002,
+6.6489234566688540E-002,
+6.8247318267822270E-002,
+7.0033922791481020E-002,
+7.1849010884761810E-002,
+7.3692522943019870E-002,
+7.5564362108707430E-002,
+7.7464438974857330E-002,
+7.9392634332180020E-002,
+8.1348828971385960E-002,
+8.3332858979702000E-002,
+8.5344567894935610E-002,
+8.7383769452571870E-002,
+8.9450262486934660E-002,
+9.1543838381767280E-002,
+9.3664251267910000E-002,
+9.5811240375041960E-002,
+9.7984537482261660E-002,
+1.0018386691808700E-001,
+1.0240890830755230E-001,
+1.0465932637453080E-001,
+1.0693479329347610E-001,
+1.0923493653535840E-001,
+1.1155936866998670E-001,
+1.1390769481658940E-001,
+1.1627949774265290E-001,
+1.1867434531450270E-001,
+1.2109176814556120E-001,
+1.2353130429983140E-001,
+1.2599244713783260E-001,
+1.2847468256950380E-001,
+1.3097748160362240E-001,
+1.3350030779838560E-001,
+1.3604259490966800E-001,
+1.3860376179218290E-001,
+1.4118319749832150E-001,
+1.4378026127815250E-001,
+1.4639437198638920E-001,
+1.4902481436729430E-001,
+1.5167096257209780E-001,
+1.5433208644390100E-001,
+1.5700751543045040E-001,
+1.5969651937484740E-001,
+1.6239835321903230E-001,
+1.6511227190494540E-001,
+1.6783750057220460E-001,
+1.7057323455810550E-001,
+1.7331869900226590E-001,
+1.7607308924198150E-001,
+1.7883554100990300E-001,
+1.8160524964332580E-001,
+1.8438133597373960E-001,
+1.8716295063495640E-001,
+1.8994916975498200E-001,
+1.9273911416530610E-001,
+1.9553191959857940E-001,
+1.9832661747932440E-001,
+2.0112232863903040E-001,
+2.0391805469989780E-001,
+2.0671287178993220E-001,
+2.0950584113597870E-001,
+2.1229594945907590E-001,
+2.1508227288722990E-001,
+2.1786379814147950E-001,
+2.2063951194286350E-001,
+2.2340846061706540E-001,
+2.2616961598396300E-001,
+2.2892196476459500E-001,
+2.3166447877883910E-001,
+2.3439615964889520E-001,
+2.3711597919464110E-001,
+2.3982289433479310E-001,
+2.4251587688922880E-001,
+2.4519388377666480E-001,
+2.4785590171813960E-001,
+2.5050088763237000E-001,
+2.5312781333923340E-001,
+2.5573557615280150E-001,
+2.5832322239875800E-001,
+2.6088967919349670E-001,
+2.6343390345573420E-001,
+2.6595494151115420E-001,
+2.6845166087150580E-001,
+2.7092313766479490E-001,
+2.7336826920509340E-001,
+2.7578607201576240E-001,
+2.7817553281784060E-001,
+2.8053569793701170E-001,
+2.8286558389663700E-001,
+2.8516408801078800E-001,
+2.8743034601211550E-001,
+2.8966337442398070E-001,
+2.9186218976974480E-001,
+2.9402589797973640E-001,
+2.9615348577499390E-001,
+2.9824411869049070E-001,
+3.0029675364494320E-001,
+3.0231067538261420E-001,
+3.0428490042686460E-001,
+3.0621853470802300E-001,
+3.0811080336570740E-001,
+3.0996081233024600E-001,
+3.1176769733428960E-001,
+3.1353080272674560E-001,
+3.1524917483329780E-001,
+3.1692212820053100E-001,
+3.1854888796806340E-001,
+3.2012873888015740E-001,
+3.2166096568107600E-001,
+3.2314485311508180E-001,
+3.2457971572875980E-001,
+3.2596495747566220E-001,
+3.2729989290237420E-001,
+3.2858389616012580E-001,
+3.2981643080711360E-001,
+3.3099696040153500E-001,
+3.3212485909461980E-001,
+3.3319962024688720E-001,
+3.3422079682350160E-001,
+3.3518791198730470E-001,
+3.3610042929649360E-001,
+3.3695802092552180E-001,
+3.3776029944419860E-001,
+3.3850681781768800E-001,
+3.3919724822044380E-001,
+3.3983129262924200E-001,
+3.4040865302085880E-001,
+3.4092903137207030E-001,
+3.4139221906661980E-001,
+3.4179797768592840E-001,
+3.4214612841606140E-001,
+3.4243649244308470E-001,
+3.4266895055770880E-001,
+3.4284341335296630E-001,
+3.4295973181724550E-001,
+3.4301793575286860E-001,
+3.4301793575286860E-001,
+3.4295973181724550E-001,
+3.4284341335296630E-001,
+3.4266895055770880E-001,
+3.4243649244308470E-001,
+3.4214612841606140E-001,
+3.4179797768592840E-001,
+3.4139221906661980E-001,
+3.4092903137207030E-001,
+3.4040865302085880E-001,
+3.3983129262924200E-001,
+3.3919724822044380E-001,
+3.3850681781768800E-001,
+3.3776029944419860E-001,
+3.3695802092552180E-001,
+3.3610042929649360E-001,
+3.3518791198730470E-001,
+3.3422079682350160E-001,
+3.3319962024688720E-001,
+3.3212485909461980E-001,
+3.3099696040153500E-001,
+3.2981643080711360E-001,
+3.2858389616012580E-001,
+3.2729989290237420E-001,
+3.2596495747566220E-001,
+3.2457971572875980E-001,
+3.2314485311508180E-001,
+3.2166096568107600E-001,
+3.2012873888015740E-001,
+3.1854888796806340E-001,
+3.1692212820053100E-001,
+3.1524917483329780E-001,
+3.1353080272674560E-001,
+3.1176769733428960E-001,
+3.0996081233024600E-001,
+3.0811080336570740E-001,
+3.0621853470802300E-001,
+3.0428490042686460E-001,
+3.0231067538261420E-001,
+3.0029675364494320E-001,
+2.9824411869049070E-001,
+2.9615348577499390E-001,
+2.9402589797973640E-001,
+2.9186218976974480E-001,
+2.8966337442398070E-001,
+2.8743034601211550E-001,
+2.8516408801078800E-001,
+2.8286558389663700E-001,
+2.8053569793701170E-001,
+2.7817553281784060E-001,
+2.7578607201576240E-001,
+2.7336826920509340E-001,
+2.7092313766479490E-001,
+2.6845166087150580E-001,
+2.6595494151115420E-001,
+2.6343390345573420E-001,
+2.6088967919349670E-001,
+2.5832322239875800E-001,
+2.5573557615280150E-001,
+2.5312781333923340E-001,
+2.5050088763237000E-001,
+2.4785590171813960E-001,
+2.4519388377666480E-001,
+2.4251587688922880E-001,
+2.3982289433479310E-001,
+2.3711597919464110E-001,
+2.3439615964889520E-001,
+2.3166447877883910E-001,
+2.2892196476459500E-001,
+2.2616961598396300E-001,
+2.2340846061706540E-001,
+2.2063951194286350E-001,
+2.1786379814147950E-001,
+2.1508227288722990E-001,
+2.1229594945907590E-001,
+2.0950584113597870E-001,
+2.0671287178993220E-001,
+2.0391805469989780E-001,
+2.0112232863903040E-001,
+1.9832661747932440E-001,
+1.9553191959857940E-001,
+1.9273911416530610E-001,
+1.8994916975498200E-001,
+1.8716295063495640E-001,
+1.8438133597373960E-001,
+1.8160524964332580E-001,
+1.7883554100990300E-001,
+1.7607308924198150E-001,
+1.7331869900226590E-001,
+1.7057323455810550E-001,
+1.6783750057220460E-001,
+1.6511227190494540E-001,
+1.6239835321903230E-001,
+1.5969651937484740E-001,
+1.5700751543045040E-001,
+1.5433208644390100E-001,
+1.5167096257209780E-001,
+1.4902481436729430E-001,
+1.4639437198638920E-001,
+1.4378026127815250E-001,
+1.4118319749832150E-001,
+1.3860376179218290E-001,
+1.3604259490966800E-001,
+1.3350030779838560E-001,
+1.3097748160362240E-001,
+1.2847468256950380E-001,
+1.2599244713783260E-001,
+1.2353130429983140E-001,
+1.2109176814556120E-001,
+1.1867434531450270E-001,
+1.1627949774265290E-001,
+1.1390769481658940E-001,
+1.1155936866998670E-001,
+1.0923493653535840E-001,
+1.0693479329347610E-001,
+1.0465932637453080E-001,
+1.0240890830755230E-001,
+1.0018386691808700E-001,
+9.7984537482261660E-002,
+9.5811240375041960E-002,
+9.3664251267910000E-002,
+9.1543838381767280E-002,
+8.9450262486934660E-002,
+8.7383769452571870E-002,
+8.5344567894935610E-002,
+8.3332858979702000E-002,
+8.1348828971385960E-002,
+7.9392634332180020E-002,
+7.7464438974857330E-002,
+7.5564362108707430E-002,
+7.3692522943019870E-002,
+7.1849010884761810E-002,
+7.0033922791481020E-002,
+6.8247318267822270E-002,
+6.6489234566688540E-002,
+6.4759708940982820E-002,
+6.3058786094188690E-002,
+6.1386436223983760E-002,
+5.9742655605077740E-002,
+5.8127421885728840E-002,
+5.6540694087743760E-002,
+5.4982420057058330E-002,
+5.3452525287866590E-002,
+5.1950931549072270E-002,
+5.0477534532547000E-002,
+4.9032241106033330E-002,
+4.7614917159080510E-002,
+4.6225443482398990E-002,
+4.4863656163215640E-002,
+4.3529424816370010E-002,
+4.2222552001476290E-002,
+4.0942888706922530E-002,
+3.9690230041742320E-002,
+3.8464374840259550E-002,
+3.7265110760927200E-002,
+3.6092240363359450E-002,
+3.4945506602525710E-002,
+3.3824689686298370E-002,
+3.2729536294937140E-002,
+3.1659796833992000E-002,
+3.0615204945206640E-002,
+2.9595496132969860E-002,
+2.8600392863154410E-002,
+2.7629608288407320E-002,
+2.6682861149311060E-002,
+2.5759860873222350E-002,
+2.4860285222530360E-002,
+2.3983856663107870E-002,
+2.3130238056182860E-002,
+2.2299138829112050E-002,
+2.1490212529897690E-002,
+2.0703161135315900E-002,
+1.9937623292207720E-002,
+1.9193304702639580E-002,
+1.8469827249646190E-002,
+1.7766902223229410E-002,
+1.7084129154682160E-002,
+1.6421230509877200E-002,
+1.5777811408042910E-002,
+1.5153550542891020E-002,
+1.4548087492585180E-002,
+1.3961089774966240E-002,
+1.3392185792326930E-002,
+1.2841059826314450E-002,
+1.2307321652770040E-002,
+1.1790650896728040E-002,
+1.1290682479739190E-002,
+1.0807084850966930E-002,
+1.0339494794607160E-002,
+9.8875602707266800E-003,
+9.4509534537792200E-003,
+9.0293306857347480E-003,
+8.6223213002085690E-003,
+8.2296309992671010E-003,
+7.8508658334612850E-003,
+7.4857366271317010E-003,
+7.1338820271193980E-003,
+6.7949919030070300E-003,
+6.4686913974583150E-003,
+6.1547122895717620E-003,
+5.8526843786239620E-003,
+5.5623454973101620E-003,
+5.2832840010523800E-003,
+5.0153112970292570E-003,
+4.7580120153725150E-003,
+4.5111598446965220E-003,
+4.2744171805679800E-003,
+4.0474990382790560E-003,
+3.8300913292914630E-003,
+3.6219672765582800E-003,
+3.4227769356220960E-003,
+3.2322725746780640E-003,
+3.0501529108732940E-003,
+2.8761904686689380E-003,
+2.7100932784378530E-003,
+2.5515670422464610E-003,
+2.4004334118217230E-003,
+2.2563596721738580E-003,
+2.1191518753767010E-003,
+1.9886041991412640E-003,
+1.8643775256350640E-003,
+1.7463274998590350E-003,
+1.6342115122824910E-003,
+1.5278297942131760E-003,
+1.4268938684836030E-003,
+1.3312589144334200E-003,
+1.2406768510118130E-003,
+1.1550235794857140E-003,
+1.0739302961155770E-003,
+9.9747709464281800E-004,
+9.2511920956894760E-004,
+8.5701106581836940E-004,
+7.9285167157649990E-004,
+7.3241489008069040E-004,
+6.7555153509601950E-004,
+6.2221300322562460E-004,
+5.7215924607589840E-004,
+5.2524596685543660E-004,
+4.8127761692740020E-004,
+4.4018754852004350E-004,
+4.0182814700528980E-004,
+3.6589911906048660E-004,
+3.3283955417573450E-004,
+3.0138631700538100E-004,
+2.7261159266345200E-004,
+2.4602311896160240E-004,
+2.2118473134469240E-004,
+1.9817386055365200E-004,
+1.7699223826639360E-004,
+1.5759580128360540E-004,
+1.3974857574794440E-004,
+1.2333714403212070E-004,
+1.0821702744578940E-004,
+9.4393239123746760E-005,
+8.1793652498163280E-005,
+2.6584343868307770E-004
+};
+
+double lfe_fir_128[] =
+{
+0.00053168571,
+0.00016358691,
+0.00018878609,
+0.00021643363,
+0.00024667382,
+0.00027949660,
+0.00031519096,
+0.00035398375,
+0.00039634691,
+0.00044236859,
+0.00049204525,
+0.00054522208,
+0.00060277141,
+0.00066567765,
+0.00073179678,
+0.00080365466,
+0.00088037323,
+0.00096255314,
+0.00105048984,
+0.00114431616,
+0.00124442333,
+0.00135110028,
+0.00146482687,
+0.00158570008,
+0.00171401864,
+0.00185023469,
+0.00199495023,
+0.00214785640,
+0.00231004250,
+0.00248134881,
+0.00266251224,
+0.00285378192,
+0.00305565330,
+0.00326841651,
+0.00349264755,
+0.00372874714,
+0.00397720048,
+0.00423829490,
+0.00451271003,
+0.00480085658,
+0.00510312291,
+0.00542017492,
+0.00575236930,
+0.00610029325,
+0.00646453211,
+0.00684553990,
+0.00724391919,
+0.00766016589,
+0.00809498038,
+0.00854881573,
+0.00902230106,
+0.00951600447,
+0.01003060210,
+0.01056654565,
+0.01112466771,
+0.01170534454,
+0.01230939943,
+0.01293735672,
+0.01358995494,
+0.01426773332,
+0.01497144438,
+0.01570170000,
+0.01645922661,
+0.01724460535,
+0.01805862412,
+0.01890186779,
+0.01977507770,
+0.02067894675,
+0.02161412500,
+0.02258131653,
+0.02358125709,
+0.02461459488,
+0.02568206564,
+0.02678431384,
+0.02792212367,
+0.02909611352,
+0.03030703776,
+0.03155555204,
+0.03284239396,
+0.03416819125,
+0.03553372994,
+0.03693958372,
+0.03838652745,
+0.03987516090,
+0.04140623659,
+0.04298033938,
+0.04459818453,
+0.04626038298,
+0.04796761274,
+0.04972046614,
+0.05151961371,
+0.05336561054,
+0.05525910854,
+0.05720067024,
+0.05919086933,
+0.06123027951,
+0.06331945211,
+0.06545893103,
+0.06764923781,
+0.06989086419,
+0.07218432426,
+0.07453006506,
+0.07692859322,
+0.07938029617,
+0.08188561350,
+0.08444493264,
+0.08705867827,
+0.08972713351,
+0.09245070815,
+0.09522963315,
+0.09806428105,
+0.10095486045,
+0.10390164703,
+0.10690483451,
+0.10996460915,
+0.11308115721,
+0.11625462025,
+0.11948505789,
+0.12277261168,
+0.12611730397,
+0.12951917946,
+0.13297818601,
+0.13649433851,
+0.14006754756,
+0.14369773865,
+0.14738474786,
+0.15112841129,
+0.15492856503,
+0.15878495574,
+0.16269733012,
+0.16666537523,
+0.17068879306,
+0.17476719618,
+0.17890018225,
+0.18308731914,
+0.18732811511,
+0.19162209332,
+0.19596865773,
+0.20036731660,
+0.20481738448,
+0.20931822062,
+0.21386915445,
+0.21846942604,
+0.22311829031,
+0.22781492770,
+0.23255851865,
+0.23734821379,
+0.24218304455,
+0.24706205726,
+0.25198432803,
+0.25694879889,
+0.26195442677,
+0.26700007915,
+0.27208462358,
+0.27720692754,
+0.28236576915,
+0.28755992651,
+0.29278811812,
+0.29804900289,
+0.30334126949,
+0.30866351724,
+0.31401440501,
+0.31939238310,
+0.32479602098,
+0.33022382855,
+0.33567428589,
+0.34114575386,
+0.34663668275,
+0.35214546323,
+0.35767036676,
+0.36320972443,
+0.36876192689,
+0.37432509661,
+0.37989753485,
+0.38547745347,
+0.39106300473,
+0.39665243030,
+0.40224379301,
+0.40783521533,
+0.41342487931,
+0.41901078820,
+0.42459106445,
+0.43016362190,
+0.43572667241,
+0.44127810001,
+0.44681602716,
+0.45233830810,
+0.45784294605,
+0.46332800388,
+0.46879136562,
+0.47423094511,
+0.47964480519,
+0.48503074050,
+0.49038675427,
+0.49571081996,
+0.50100076199,
+0.50625455379,
+0.51147013903,
+0.51664537191,
+0.52177828550,
+0.52686679363,
+0.53190881014,
+0.53690224886,
+0.54184508324,
+0.54673534632,
+0.55157101154,
+0.55634999275,
+0.56107026339,
+0.56572991610,
+0.57032698393,
+0.57485944033,
+0.57932555676,
+0.58372318745,
+0.58805054426,
+0.59230577946,
+0.59648692608,
+0.60059231520,
+0.60462015867,
+0.60856848955,
+0.61243581772,
+0.61622029543,
+0.61992025375,
+0.62353414297,
+0.62706029415,
+0.63049703836,
+0.63384294510,
+0.63709646463,
+0.64025616646,
+0.64332056046,
+0.64628833532,
+0.64915806055,
+0.65192854404,
+0.65459835529,
+0.65716648102,
+0.65963155031,
+0.66199249029,
+0.66424828768,
+0.66639786959,
+0.66844022274,
+0.67037439346,
+0.67219948769,
+0.67391467094,
+0.67551922798,
+0.67701220512,
+0.67839306593,
+0.67966115475,
+0.68081587553,
+0.68185669184,
+0.68278300762,
+0.68359452486,
+0.68429082632,
+0.68487155437,
+0.68533653021,
+0.68568539619,
+0.68591803312,
+0.68603444099,
+0.68603444099,
+0.68591803312,
+0.68568539619,
+0.68533653021,
+0.68487155437,
+0.68429082632,
+0.68359452486,
+0.68278300762,
+0.68185669184,
+0.68081587553,
+0.67966115475,
+0.67839306593,
+0.67701220512,
+0.67551922798,
+0.67391467094,
+0.67219948769,
+0.67037439346,
+0.66844022274,
+0.66639786959,
+0.66424828768,
+0.66199249029,
+0.65963155031,
+0.65716648102,
+0.65459835529,
+0.65192854404,
+0.64915806055,
+0.64628833532,
+0.64332056046,
+0.64025616646,
+0.63709646463,
+0.63384294510,
+0.63049703836,
+0.62706029415,
+0.62353414297,
+0.61992025375,
+0.61622029543,
+0.61243581772,
+0.60856848955,
+0.60462015867,
+0.60059231520,
+0.59648692608,
+0.59230577946,
+0.58805054426,
+0.58372318745,
+0.57932555676,
+0.57485944033,
+0.57032698393,
+0.56572991610,
+0.56107026339,
+0.55634999275,
+0.55157101154,
+0.54673534632,
+0.54184508324,
+0.53690224886,
+0.53190881014,
+0.52686679363,
+0.52177828550,
+0.51664537191,
+0.51147013903,
+0.50625455379,
+0.50100076199,
+0.49571081996,
+0.49038675427,
+0.48503074050,
+0.47964480519,
+0.47423094511,
+0.46879136562,
+0.46332800388,
+0.45784294605,
+0.45233830810,
+0.44681602716,
+0.44127810001,
+0.43572667241,
+0.43016362190,
+0.42459106445,
+0.41901078820,
+0.41342487931,
+0.40783521533,
+0.40224379301,
+0.39665243030,
+0.39106300473,
+0.38547745347,
+0.37989753485,
+0.37432509661,
+0.36876192689,
+0.36320972443,
+0.35767036676,
+0.35214546323,
+0.34663668275,
+0.34114575386,
+0.33567428589,
+0.33022382855,
+0.32479602098,
+0.31939238310,
+0.31401440501,
+0.30866351724,
+0.30334126949,
+0.29804900289,
+0.29278811812,
+0.28755992651,
+0.28236576915,
+0.27720692754,
+0.27208462358,
+0.26700007915,
+0.26195442677,
+0.25694879889,
+0.25198432803,
+0.24706205726,
+0.24218304455,
+0.23734821379,
+0.23255851865,
+0.22781492770,
+0.22311829031,
+0.21846942604,
+0.21386915445,
+0.20931822062,
+0.20481738448,
+0.20036731660,
+0.19596865773,
+0.19162209332,
+0.18732811511,
+0.18308731914,
+0.17890018225,
+0.17476719618,
+0.17068879306,
+0.16666537523,
+0.16269733012,
+0.15878495574,
+0.15492856503,
+0.15112841129,
+0.14738474786,
+0.14369773865,
+0.14006754756,
+0.13649433851,
+0.13297818601,
+0.12951917946,
+0.12611730397,
+0.12277261168,
+0.11948505789,
+0.11625462025,
+0.11308115721,
+0.10996460915,
+0.10690483451,
+0.10390164703,
+0.10095486045,
+0.09806428105,
+0.09522963315,
+0.09245070815,
+0.08972713351,
+0.08705867827,
+0.08444493264,
+0.08188561350,
+0.07938029617,
+0.07692859322,
+0.07453006506,
+0.07218432426,
+0.06989086419,
+0.06764923781,
+0.06545893103,
+0.06331945211,
+0.06123027951,
+0.05919086933,
+0.05720067024,
+0.05525910854,
+0.05336561054,
+0.05151961371,
+0.04972046614,
+0.04796761274,
+0.04626038298,
+0.04459818453,
+0.04298033938,
+0.04140623659,
+0.03987516090,
+0.03838652745,
+0.03693958372,
+0.03553372994,
+0.03416819125,
+0.03284239396,
+0.03155555204,
+0.03030703776,
+0.02909611352,
+0.02792212367,
+0.02678431384,
+0.02568206564,
+0.02461459488,
+0.02358125709,
+0.02258131653,
+0.02161412500,
+0.02067894675,
+0.01977507770,
+0.01890186779,
+0.01805862412,
+0.01724460535,
+0.01645922661,
+0.01570170000,
+0.01497144438,
+0.01426773332,
+0.01358995494,
+0.01293735672,
+0.01230939943,
+0.01170534454,
+0.01112466771,
+0.01056654565,
+0.01003060210,
+0.00951600447,
+0.00902230106,
+0.00854881573,
+0.00809498038,
+0.00766016589,
+0.00724391919,
+0.00684553990,
+0.00646453211,
+0.00610029325,
+0.00575236930,
+0.00542017492,
+0.00510312291,
+0.00480085658,
+0.00451271003,
+0.00423829490,
+0.00397720048,
+0.00372874714,
+0.00349264755,
+0.00326841651,
+0.00305565330,
+0.00285378192,
+0.00266251224,
+0.00248134881,
+0.00231004250,
+0.00214785640,
+0.00199495023,
+0.00185023469,
+0.00171401864,
+0.00158570008,
+0.00146482687,
+0.00135110028,
+0.00124442333,
+0.00114431616,
+0.00105048984,
+0.00096255314,
+0.00088037323,
+0.00080365466,
+0.00073179678,
+0.00066567765,
+0.00060277141,
+0.00054522208,
+0.00049204525,
+0.00044236859,
+0.00039634691,
+0.00035398375,
+0.00031519096,
+0.00027949660,
+0.00024667382,
+0.00021643363,
+0.00018878609,
+0.00016358691,
+0.00053168571
+};
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_huffman.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_huffman.h
new file mode 100644
index 000000000..aa164ac50
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_huffman.h
@@ -0,0 +1,1070 @@
+/*
+ * huffman_tables.h
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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
+ */
+typedef struct huff_entry_s
+{
+ int length;
+ int code;
+ int value;
+
+} huff_entry_t;
+
+huff_entry_t bitalloc_a_12[] =
+{
+ { 1, 0, 1}, { 2, 2, 2}, { 3, 6, 3}, { 4, 14, 4},
+ { 5, 30, 5}, { 6, 62, 6}, { 8, 255, 7}, { 8, 254, 8},
+ { 9, 507, 9}, { 9, 506, 10}, { 9, 505, 11}, { 9, 504, 12},
+ { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_12[] =
+{
+ { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 5, 15, 4},
+ { 5, 12, 5}, { 6, 29, 6}, { 7, 57, 7}, { 7, 56, 8},
+ { 7, 55, 9}, { 7, 54, 10}, { 7, 53, 11}, { 7, 52, 12},
+ { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_12[] =
+{
+ { 2, 0, 1}, { 3, 7, 2}, { 3, 5, 3}, { 3, 4, 4},
+ { 3, 2, 5}, { 4, 13, 6}, { 4, 12, 7}, { 4, 6, 8},
+ { 5, 15, 9}, { 6, 29, 10}, { 7, 57, 11}, { 7, 56, 12},
+ { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_d_12[] =
+{
+ { 2, 3, 1}, { 2, 2, 2}, { 2, 0, 3}, { 3, 2, 4},
+ { 4, 6, 5}, { 5, 14, 6}, { 6, 30, 7}, { 7, 62, 8},
+ { 8, 126, 9}, { 9, 254, 10}, {10, 511, 11}, {10, 510, 12},
+ { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_e_12[] =
+{
+ { 1, 1, 1}, { 2, 0, 2}, { 3, 2, 3}, { 4, 6, 4},
+ { 5, 14, 5}, { 7, 63, 6}, { 7, 61, 7}, { 8, 124, 8},
+ { 8, 121, 9}, { 8, 120, 10}, { 9, 251, 11}, { 9, 250, 12},
+ { 0, 0, 0}
+};
+
+huff_entry_t *bitalloc_12[] =
+{
+ bitalloc_a_12,
+ bitalloc_b_12,
+ bitalloc_c_12,
+ bitalloc_d_12,
+ bitalloc_e_12
+};
+
+huff_entry_t scales_a_129[] =
+{
+ { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2},
+ { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4},
+ { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6},
+ { 6, 11, -6}, { 7, 75, 7}, { 7, 74, -7}, { 8, 233, 8},
+ { 8, 232, -8}, { 8, 41, 9}, { 8, 40, -9}, { 9, 87, 10},
+ { 9, 86,-10}, {10, 937, 11}, {10, 936,-11}, {11, 1877, 12},
+ {11, 1876,-12}, {11, 341, 13}, {11, 340,-13}, {12, 686, 14},
+ {12, 685,-14}, {13, 1375, 15}, {13, 1374,-15}, {13, 1369, 16},
+ {13, 1368,-16}, {13, 1359, 17}, {13, 1358,-17}, {13, 1357, 18},
+ {13, 1356,-18}, {13, 1355, 19}, {13, 1354,-19}, {13, 1353, 20},
+ {13, 1352,-20}, {13, 1351, 21}, {13, 1350,-21}, {13, 1349, 22},
+ {13, 1348,-22}, {13, 1347, 23}, {13, 1346,-23}, {13, 1345, 24},
+ {13, 1344,-24}, {14, 15103, 25}, {14, 15102,-25}, {14, 15101, 26},
+ {14, 15100,-26}, {14, 15099, 27}, {14, 15098,-27}, {14, 15097, 28},
+ {14, 15096,-28}, {14, 15095, 29}, {14, 15094,-29}, {14, 15093, 30},
+ {14, 15092,-30}, {14, 15091, 31}, {14, 15090,-31}, {14, 15089, 32},
+ {14, 15088,-32}, {14, 15087, 33}, {14, 15086,-33}, {14, 15085, 34},
+ {14, 15084,-34}, {14, 15083, 35}, {14, 15082,-35}, {14, 15081, 36},
+ {14, 15080,-36}, {14, 15079, 37}, {14, 15078,-37}, {14, 15077, 38},
+ {14, 15076,-38}, {14, 15075, 39}, {14, 15074,-39}, {14, 15073, 40},
+ {14, 15072,-40}, {14, 15071, 41}, {14, 15070,-41}, {14, 15069, 42},
+ {14, 15068,-42}, {14, 15067, 43}, {14, 15066,-43}, {14, 15065, 44},
+ {14, 15064,-44}, {14, 15063, 45}, {14, 15062,-45}, {14, 15061, 46},
+ {14, 15060,-46}, {14, 15059, 47}, {14, 15058,-47}, {14, 15057, 48},
+ {14, 15056,-48}, {14, 15055, 49}, {14, 15054,-49}, {14, 15053, 50},
+ {14, 15052,-50}, {14, 15051, 51}, {14, 15050,-51}, {14, 15049, 52},
+ {14, 15048,-52}, {14, 15047, 53}, {14, 15046,-53}, {14, 15045, 54},
+ {14, 15044,-54}, {14, 15043, 55}, {14, 15042,-55}, {14, 15041, 56},
+ {14, 15040,-56}, {14, 15039, 57}, {14, 15038,-57}, {14, 15037, 58},
+ {14, 15036,-58}, {14, 15035, 59}, {14, 15034,-59}, {14, 15033, 60},
+ {14, 15032,-60}, {14, 15031, 61}, {14, 15030,-61}, {14, 15029, 62},
+ {14, 15028,-62}, {14, 15027, 63}, {14, 15026,-63}, {14, 15025, 64},
+ {14, 15024,-64}, { 0, 0, 0}
+};
+
+huff_entry_t scales_b_129[] =
+{
+ { 3, 3, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 10, 4},
+ { 4, 9, -4}, { 4, 0, 5}, { 5, 27, -5}, { 5, 17, 6},
+ { 5, 16, -6}, { 6, 53, 7}, { 6, 52, -7}, { 6, 5, 8},
+ { 6, 4, -8}, { 7, 13, 9}, { 7, 12, -9}, { 8, 29, 10},
+ { 8, 28,-10}, { 9, 60, 11}, {10, 127,-11}, {11, 253, 12},
+ {11, 252,-12}, {12, 491, 13}, {12, 490,-13}, {13, 979, 14},
+ {13, 978,-14}, {14, 1955, 15}, {14, 1954,-15}, {14, 1953, 16},
+ {14, 1952,-16}, {15, 4031, 17}, {15, 4030,-17}, {15, 4029, 18},
+ {15, 4028,-18}, {15, 4027, 19}, {15, 4026,-19}, {15, 4025, 20},
+ {15, 4024,-20}, {15, 4023, 21}, {15, 4022,-21}, {15, 4021, 22},
+ {15, 4020,-22}, {15, 4019, 23}, {15, 4018,-23}, {15, 4017, 24},
+ {15, 4016,-24}, {15, 4015, 25}, {15, 4014,-25}, {15, 4013, 26},
+ {15, 4012,-26}, {15, 4011, 27}, {15, 4010,-27}, {15, 4009, 28},
+ {15, 4008,-28}, {15, 4007, 29}, {15, 4006,-29}, {15, 4005, 30},
+ {15, 4004,-30}, {15, 4003, 31}, {15, 4002,-31}, {15, 4001, 32},
+ {15, 4000,-32}, {15, 3999, 33}, {15, 3998,-33}, {15, 3997, 34},
+ {15, 3996,-34}, {15, 3995, 35}, {15, 3994,-35}, {15, 3993, 36},
+ {15, 3992,-36}, {15, 3991, 37}, {15, 3990,-37}, {15, 3989, 38},
+ {15, 3988,-38}, {15, 3987, 39}, {15, 3986,-39}, {15, 3985, 40},
+ {15, 3984,-40}, {15, 3983, 41}, {15, 3982,-41}, {15, 3981, 42},
+ {15, 3980,-42}, {15, 3979, 43}, {15, 3978,-43}, {15, 3977, 44},
+ {15, 3976,-44}, {15, 3975, 45}, {15, 3974,-45}, {15, 3973, 46},
+ {15, 3972,-46}, {15, 3971, 47}, {15, 3970,-47}, {15, 3969, 48},
+ {15, 3968,-48}, {15, 3967, 49}, {15, 3966,-49}, {15, 3965, 50},
+ {15, 3964,-50}, {15, 3963, 51}, {15, 3962,-51}, {15, 3961, 52},
+ {15, 3960,-52}, {15, 3959, 53}, {15, 3958,-53}, {15, 3957, 54},
+ {15, 3956,-54}, {15, 3955, 55}, {15, 3954,-55}, {15, 3953, 56},
+ {15, 3952,-56}, {15, 3951, 57}, {15, 3950,-57}, {15, 3949, 58},
+ {15, 3948,-58}, {15, 3947, 59}, {15, 3946,-59}, {15, 3945, 60},
+ {15, 3944,-60}, {15, 3943, 61}, {15, 3942,-61}, {15, 3941, 62},
+ {15, 3940,-62}, {15, 3939, 63}, {15, 3938,-63}, {15, 3937, 64},
+ {15, 3936,-64}, { 0, 0, 0}
+};
+
+huff_entry_t scales_c_129[] =
+{
+ { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2},
+ { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4},
+ { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6},
+ { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8},
+ { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10},
+ { 7, 114,-10}, { 7, 83, 11}, { 7, 82,-11}, { 7, 35, 12},
+ { 7, 34,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 162, 14},
+ { 8, 161,-14}, { 8, 66, 15}, { 8, 65,-15}, { 9, 450, 16},
+ { 9, 449,-16}, { 9, 321, 17}, { 9, 320,-17}, { 9, 129, 18},
+ { 9, 128,-18}, {10, 897, 19}, {10, 896,-19}, {10, 652, 20},
+ {10, 271,-20}, {10, 268, 21}, {11, 1807,-21}, {11, 1308, 22},
+ {11, 1307,-22}, {11, 540, 23}, {11, 539,-23}, {12, 3612, 24},
+ {12, 3611,-24}, {12, 2613, 25}, {12, 2612,-25}, {12, 1077, 26},
+ {12, 1076,-26}, {13, 7226, 27}, {13, 7221,-27}, {13, 2167, 28},
+ {13, 2166,-28}, {13, 2164, 29}, {14, 14455,-29}, {14, 14441, 30},
+ {14, 14440,-30}, {14, 4331, 31}, {14, 4330,-31}, {15, 28909, 32},
+ {15, 28908,-32}, {15, 28879, 33}, {15, 28878,-33}, {15, 28877, 34},
+ {15, 28876,-34}, {15, 28875, 35}, {15, 28874,-35}, {15, 28873, 36},
+ {15, 28872,-36}, {15, 28871, 37}, {15, 28870,-37}, {15, 28869, 38},
+ {15, 28868,-38}, {15, 28867, 39}, {15, 28866,-39}, {15, 28865, 40},
+ {15, 28864,-40}, {15, 20991, 41}, {15, 20990,-41}, {15, 20989, 42},
+ {15, 20988,-42}, {15, 20987, 43}, {15, 20986,-43}, {15, 20985, 44},
+ {15, 20984,-44}, {15, 20983, 45}, {15, 20982,-45}, {15, 20981, 46},
+ {15, 20980,-46}, {15, 20979, 47}, {15, 20978,-47}, {15, 20977, 48},
+ {15, 20976,-48}, {15, 20975, 49}, {15, 20974,-49}, {15, 20973, 50},
+ {15, 20972,-50}, {15, 20971, 51}, {15, 20970,-51}, {15, 20969, 52},
+ {15, 20968,-52}, {15, 20967, 53}, {15, 20966,-53}, {15, 20965, 54},
+ {15, 20964,-54}, {15, 20963, 55}, {15, 20962,-55}, {15, 20961, 56},
+ {15, 20960,-56}, {15, 20959, 57}, {15, 20958,-57}, {15, 20957, 58},
+ {15, 20956,-58}, {15, 20955, 59}, {15, 20954,-59}, {15, 20953, 60},
+ {15, 20952,-60}, {15, 20951, 61}, {15, 20950,-61}, {15, 20949, 62},
+ {15, 20948,-62}, {15, 20947, 63}, {15, 20946,-63}, {15, 20945, 64},
+ {15, 20944,-64}, { 0, 0, 0}
+};
+
+huff_entry_t scales_d_129[] =
+{
+ { 2, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 26, 4},
+ { 5, 25, -4}, { 5, 10, 5}, { 5, 9, -5}, { 6, 54, 6},
+ { 6, 49, -6}, { 6, 22, 7}, { 6, 17, -7}, { 7, 110, 8},
+ { 7, 97, -8}, { 7, 46, 9}, { 7, 33, -9}, { 8, 193, 10},
+ { 8, 192,-10}, { 8, 65, 11}, { 8, 64,-11}, { 9, 444, 12},
+ { 9, 191,-12}, { 9, 188, 13}, {10, 895,-13}, {10, 890, 14},
+ {10, 381,-14}, {10, 378, 15}, {11, 1789,-15}, {11, 761, 16},
+ {11, 760,-16}, {12, 3577, 17}, {12, 3576,-17}, {12, 1519, 18},
+ {12, 1518,-18}, {12, 1516, 19}, {13, 7151,-19}, {13, 7128, 20},
+ {13, 3035,-20}, {14, 14301, 21}, {14, 14300,-21}, {14, 6069, 22},
+ {14, 6068,-22}, {15, 28599, 23}, {15, 28598,-23}, {15, 28597, 24},
+ {15, 28596,-24}, {15, 28595, 25}, {15, 28594,-25}, {15, 28593, 26},
+ {15, 28592,-26}, {15, 28591, 27}, {15, 28590,-27}, {15, 28589, 28},
+ {15, 28588,-28}, {15, 28587, 29}, {15, 28586,-29}, {15, 28585, 30},
+ {15, 28584,-30}, {15, 28583, 31}, {15, 28582,-31}, {15, 28581, 32},
+ {15, 28580,-32}, {15, 28579, 33}, {15, 28578,-33}, {15, 28577, 34},
+ {15, 28576,-34}, {15, 28575, 35}, {15, 28574,-35}, {15, 28573, 36},
+ {15, 28572,-36}, {15, 28571, 37}, {15, 28570,-37}, {15, 28569, 38},
+ {15, 28568,-38}, {15, 28567, 39}, {15, 28566,-39}, {15, 28565, 40},
+ {15, 28564,-40}, {15, 28563, 41}, {15, 28562,-41}, {15, 28561, 42},
+ {15, 28560,-42}, {15, 28559, 43}, {15, 28558,-43}, {15, 28557, 44},
+ {15, 28556,-44}, {15, 28555, 45}, {15, 28554,-45}, {15, 28553, 46},
+ {15, 28552,-46}, {15, 28551, 47}, {15, 28550,-47}, {15, 28549, 48},
+ {15, 28548,-48}, {15, 28547, 49}, {15, 28546,-49}, {15, 28545, 50},
+ {15, 28544,-50}, {15, 28543, 51}, {15, 28542,-51}, {15, 28541, 52},
+ {15, 28540,-52}, {15, 28539, 53}, {15, 28538,-53}, {15, 28537, 54},
+ {15, 28536,-54}, {15, 28535, 55}, {15, 28534,-55}, {15, 28533, 56},
+ {15, 28532,-56}, {15, 28531, 57}, {15, 28530,-57}, {15, 28529, 58},
+ {15, 28528,-58}, {15, 28527, 59}, {15, 28526,-59}, {15, 28525, 60},
+ {15, 28524,-60}, {15, 28523, 61}, {15, 28522,-61}, {15, 28521, 62},
+ {15, 28520,-62}, {15, 28519, 63}, {15, 28518,-63}, {15, 28517, 64},
+ {15, 28516,-64}, { 0, 0, 0}
+};
+
+huff_entry_t scales_e_129[] =
+{
+ { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 7, 2},
+ { 4, 6, -2}, { 4, 3, 3}, { 4, 2, -3}, { 5, 31, 4},
+ { 5, 30, -4}, { 5, 25, 5}, { 5, 24, -5}, { 5, 17, 6},
+ { 5, 16, -6}, { 5, 9, 7}, { 5, 8, -7}, { 5, 1, 8},
+ { 5, 0, -8}, { 6, 53, 9}, { 6, 52, -9}, { 6, 37, 10},
+ { 6, 36,-10}, { 6, 21, 11}, { 6, 20,-11}, { 6, 5, 12},
+ { 6, 4,-12}, { 7, 109, 13}, { 7, 108,-13}, { 7, 77, 14},
+ { 7, 76,-14}, { 7, 45, 15}, { 7, 44,-15}, { 7, 13, 16},
+ { 7, 12,-16}, { 8, 221, 17}, { 8, 220,-17}, { 8, 157, 18},
+ { 8, 156,-18}, { 8, 93, 19}, { 8, 92,-19}, { 8, 29, 20},
+ { 8, 28,-20}, { 9, 445, 21}, { 9, 444,-21}, { 9, 317, 22},
+ { 9, 316,-22}, { 9, 189, 23}, { 9, 188,-23}, { 9, 61, 24},
+ { 9, 60,-24}, {10, 892, 25}, {10, 639,-25}, {10, 637, 26},
+ {10, 636,-26}, {10, 381, 27}, {10, 380,-27}, {10, 125, 28},
+ {10, 124,-28}, {11, 1788, 29}, {11, 1787,-29}, {11, 1276, 30},
+ {11, 767,-30}, {11, 764, 31}, {11, 255,-31}, {11, 252, 32},
+ {12, 3583,-32}, {12, 3579, 33}, {12, 3578,-33}, {12, 2555, 34},
+ {12, 2554,-34}, {12, 1531, 35}, {12, 1530,-35}, {12, 507, 36},
+ {12, 506,-36}, {13, 7160, 37}, {13, 7147,-37}, {13, 7144, 38},
+ {13, 3067,-38}, {13, 3065, 39}, {13, 3064,-39}, {13, 1017, 40},
+ {13, 1016,-40}, {14, 14330, 41}, {14, 14329,-41}, {14, 14291, 42},
+ {14, 14290,-42}, {14, 6132, 43}, {14, 2039,-43}, {14, 2038, 44},
+ {14, 2037,-44}, {15, 28663, 45}, {15, 28662,-45}, {15, 28585, 46},
+ {15, 28584,-46}, {15, 12267, 47}, {15, 12266,-47}, {15, 4073, 48},
+ {15, 4072,-48}, {16, 57315, 49}, {16, 57314,-49}, {16, 57313, 50},
+ {16, 57312,-50}, {16, 57311, 51}, {16, 57310,-51}, {16, 57309, 52},
+ {16, 57308,-52}, {16, 57307, 53}, {16, 57306,-53}, {16, 57305, 54},
+ {16, 57304,-54}, {16, 57303, 55}, {16, 57302,-55}, {16, 57301, 56},
+ {16, 57300,-56}, {16, 57299, 57}, {16, 57298,-57}, {16, 57297, 58},
+ {16, 57296,-58}, {16, 57295, 59}, {16, 57294,-59}, {16, 57293, 60},
+ {16, 57292,-60}, {16, 57291, 61}, {16, 57290,-61}, {16, 57289, 62},
+ {16, 57288,-62}, {16, 57175, 63}, {16, 57174,-63}, {16, 57173, 64},
+ {16, 57172,-64}, { 0, 0, 0}
+};
+
+huff_entry_t *scales_129[] =
+{
+ scales_a_129,
+ scales_b_129,
+ scales_c_129,
+ scales_d_129,
+ scales_e_129
+};
+
+huff_entry_t bitalloc_a_3[] =
+{
+ { 1, 0, 0}, { 2, 2, 1}, { 2, 3, -1}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_a_4[] =
+{
+ { 1, 0, 0}, { 2, 2, 1}, { 3, 6, 2}, { 3, 7, 3},
+ { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_4[] =
+{
+ { 2, 2, 0}, { 3, 6, 1}, { 3, 7, 2}, { 1, 0, 3},
+ { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_4[] =
+{
+ { 3, 6, 0}, { 3, 7, 1}, { 1, 0, 2}, { 2, 2, 3},
+ { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_d_4[] =
+{
+ { 2, 0, 0}, { 2, 1, 1}, { 2, 2, 2}, { 2, 3, 3},
+ { 0, 0, 0}
+};
+
+huff_entry_t *tmode[] =
+{
+ bitalloc_a_4,
+ bitalloc_b_4,
+ bitalloc_c_4,
+ bitalloc_d_4
+};
+
+huff_entry_t bitalloc_a_5[] =
+{
+ { 1, 0, 0}, { 2, 2, 1}, { 3, 6, -1}, { 4, 14, 2},
+ { 4, 15, -2}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_5[] =
+{
+ { 2, 2, 0}, { 2, 0, 1}, { 2, 1, -1}, { 3, 6, 2},
+ { 3, 7, -2}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_5[] =
+{
+ { 1, 0, 0}, { 3, 4, 1}, { 3, 5, -1}, { 3, 6, 2},
+ { 3, 7, -2}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_a_7[] =
+{
+ { 1, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 4, 2},
+ { 4, 14, -2}, { 5, 31, 3}, { 5, 30, -3}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_7[] =
+{
+ { 2, 3, 0}, { 2, 1, 1}, { 2, 0, -1}, { 3, 4, 2},
+ { 4, 11, -2}, { 5, 21, 3}, { 5, 20, -3}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_7[] =
+{
+ { 2, 3, 0}, { 2, 2, 1}, { 2, 1, -1}, { 4, 3, 2},
+ { 4, 2, -2}, { 4, 1, 3}, { 4, 0, -3}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_a_9[] =
+{
+ { 1, 0, 0}, { 3, 7, 1}, { 3, 5, -1}, { 4, 13, 2},
+ { 4, 9, -2}, { 4, 8, 3}, { 5, 25, -3}, { 6, 49, 4},
+ { 6, 48, -4}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_9[] =
+{
+ { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 3, 2},
+ { 3, 2, -2}, { 5, 27, 3}, { 5, 26, -3}, { 5, 25, 4},
+ { 5, 24, -4}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_9[] =
+{
+ { 2, 2, 0}, { 2, 0, 1}, { 3, 7, -1}, { 3, 6, 2},
+ { 3, 2, -2}, { 4, 6, 3}, { 5, 15, -3}, { 6, 29, 4},
+ { 6, 28, -4}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_a_13[] =
+{
+ { 1, 0, 0}, { 3, 4, 1}, { 4, 15, -1}, { 4, 13, 2},
+ { 4, 12, -2}, { 4, 10, 3}, { 5, 29, -3}, { 5, 22, 4},
+ { 6, 57, -4}, { 6, 47, 5}, { 6, 46, -5}, { 7, 113, 6},
+ { 7, 112, -6}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_13[] =
+{
+ { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2},
+ { 4, 15, -2}, { 4, 9, 3}, { 4, 7, -3}, { 4, 6, 4},
+ { 5, 29, -4}, { 5, 17, 5}, { 5, 16, -5}, { 6, 57, 6},
+ { 6, 56, -6}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_13[] =
+{
+ { 3, 5, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 2, 2},
+ { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 12, 4},
+ { 4, 3, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 5, 6},
+ { 5, 4, -6}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_a_17[] =
+{
+ { 2, 1, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 4, 2},
+ { 3, 1, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 0, 4},
+ { 5, 3, -4}, { 6, 4, 5}, { 7, 11, -5}, { 8, 20, 6},
+ { 9, 43, -6}, {10, 84, 7}, {11, 171, -7}, {12, 341, 8},
+ {12, 340, -8}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_17[] =
+{
+ { 2, 0, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 2, 2},
+ { 4, 15, -2}, { 4, 9, 3}, { 4, 8, -3}, { 5, 29, 4},
+ { 5, 28, -4}, { 5, 14, 5}, { 5, 13, -5}, { 6, 30, 6},
+ { 6, 25, -6}, { 6, 24, 7}, { 7, 63, -7}, { 8, 125, 8},
+ { 8, 124, -8}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_17[] =
+{
+ { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 0, 2},
+ { 4, 15, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 4, 4},
+ { 4, 3, -4}, { 5, 29, 5}, { 5, 28, -5}, { 5, 10, 6},
+ { 5, 5, -6}, { 5, 4, 7}, { 6, 23, -7}, { 7, 45, 8},
+ { 7, 44, -8}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_d_17[] =
+{
+ { 1, 0, 0}, { 3, 7, 1}, { 3, 6, -1}, { 4, 11, 2},
+ { 4, 10, -2}, { 5, 19, 3}, { 5, 18, -3}, { 6, 35, 4},
+ { 6, 34, -4}, { 7, 67, 5}, { 7, 66, -5}, { 8, 131, 6},
+ { 8, 130, -6}, { 9, 259, 7}, { 9, 258, -7}, { 9, 257, 8},
+ { 9, 256, -8}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_e_17[] =
+{
+ { 1, 0, 0}, { 3, 5, 1}, { 3, 4, -1}, { 4, 12, 2},
+ { 5, 31, -2}, { 5, 28, 3}, { 5, 27, -3}, { 6, 60, 4},
+ { 6, 59, -4}, { 6, 53, 5}, { 6, 52, -5}, { 7, 122, 6},
+ { 7, 117, -6}, { 8, 247, 7}, { 8, 246, -7}, { 8, 233, 8},
+ { 8, 232, -8}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_f_17[] =
+{
+ { 3, 6, 0}, { 3, 5, 1}, { 3, 4, -1}, { 3, 2, 2},
+ { 3, 1, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 6, 4},
+ { 4, 1, -4}, { 5, 14, 5}, { 5, 1, -5}, { 6, 31, 6},
+ { 6, 30, -6}, { 6, 0, 7}, { 7, 3, -7}, { 8, 5, 8},
+ { 8, 4, -8}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_g_17[] =
+{
+ { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2},
+ { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 14, 4},
+ { 5, 13, -4}, { 6, 30, 5}, { 6, 25, -5}, { 7, 62, 6},
+ { 7, 49, -6}, { 8, 127, 7}, { 8, 126, -7}, { 8, 97, 8},
+ { 8, 96, -8}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_a_25[] =
+{
+ { 3, 6, 0}, { 3, 4, 1}, { 3, 3, -1}, { 3, 1, 2},
+ { 3, 0, -2}, { 4, 15, 3}, { 4, 14, -3}, { 4, 5, 4},
+ { 4, 4, -4}, { 5, 22, 5}, { 5, 21, -5}, { 6, 47, 6},
+ { 6, 46, -6}, { 7, 83, 7}, { 7, 82, -7}, { 8, 163, 8},
+ { 8, 162, -8}, { 8, 160, 9}, { 9, 323, -9}, {10, 644, 10},
+ {11, 1291,-10}, {12, 2580, 11}, {13, 5163,-11}, {14, 10325, 12},
+ {14, 10324,-12}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_25[] =
+{
+ { 3, 5, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4},
+ { 4, 1, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 15, 6},
+ { 5, 14, -6}, { 6, 55, 7}, { 6, 54, -7}, { 6, 49, 8},
+ { 6, 48, -8}, { 6, 1, 9}, { 6, 0, -9}, { 7, 6, 10},
+ { 7, 5,-10}, { 7, 4, 11}, { 8, 15,-11}, { 9, 29, 12},
+ { 9, 28,-12}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_25[] =
+{
+ { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 12, 2},
+ { 4, 11, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 6, 4},
+ { 4, 5, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 26, 6},
+ { 5, 21, -6}, { 5, 15, 7}, { 5, 14, -7}, { 5, 8, 8},
+ { 6, 55, -8}, { 6, 41, 9}, { 6, 40, -9}, { 6, 18, 10},
+ { 7, 109,-10}, { 7, 108, 11}, { 7, 39,-11}, { 8, 77, 12},
+ { 8, 76,-12}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_d_25[] =
+{
+ { 2, 2, 0}, { 3, 7, 1}, { 3, 6, -1}, { 3, 1, 2},
+ { 3, 0, -2}, { 4, 5, 3}, { 4, 4, -3}, { 5, 13, 4},
+ { 5, 12, -4}, { 6, 29, 5}, { 6, 28, -5}, { 7, 62, 6},
+ { 7, 61, -6}, { 8, 126, 7}, { 8, 121, -7}, { 9, 255, 8},
+ { 9, 254, -8}, {10, 483, 9}, {10, 482, -9}, {11, 963, 10},
+ {11, 962,-10}, {12, 1923, 11}, {12, 1922,-11}, {12, 1921, 12},
+ {12, 1920,-12}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_e_25[] =
+{
+ { 2, 3, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 11, 2},
+ { 4, 10, -2}, { 4, 1, 3}, { 4, 0, -3}, { 5, 17, 4},
+ { 5, 16, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 38, 6},
+ { 6, 37, -6}, { 6, 14, 7}, { 6, 13, -7}, { 7, 79, 8},
+ { 7, 78, -8}, { 7, 72, 9}, { 7, 31, -9}, { 7, 25, 10},
+ { 7, 24,-10}, { 8, 147, 11}, { 8, 146,-11}, { 8, 61, 12},
+ { 8, 60,-12}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_f_25[] =
+{
+ { 3, 1, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 14, 2},
+ { 4, 13, -2}, { 4, 11, 3}, { 4, 10, -3}, { 4, 8, 4},
+ { 4, 7, -4}, { 4, 5, 5}, { 4, 4, -5}, { 5, 24, 6},
+ { 5, 19, -6}, { 5, 13, 7}, { 5, 12, -7}, { 6, 37, 8},
+ { 6, 36, -8}, { 7, 102, 9}, { 7, 101, -9}, { 8, 207, 10},
+ { 8, 206,-10}, { 8, 200, 11}, { 9, 403,-11}, {10, 805, 12},
+ {10, 804,-12}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_g_25[] =
+{
+ { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2},
+ { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4},
+ { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6},
+ { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8},
+ { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 470, 10},
+ { 9, 469,-10}, {10, 943, 11}, {10, 942,-11}, {10, 937, 12},
+ {10, 936,-12}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_a_33[] =
+{
+ { 3, 2, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 14, 2},
+ { 4, 13, -2}, { 4, 12, 3}, { 4, 11, -3}, { 4, 9, 4},
+ { 4, 8, -4}, { 4, 6, 5}, { 5, 31, -5}, { 5, 20, 6},
+ { 5, 15, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 29, 8},
+ { 6, 28, -8}, { 7, 85, 9}, { 7, 84, -9}, { 8, 174, 10},
+ { 8, 173,-10}, { 9, 351, 11}, { 9, 350,-11}, {10, 691, 12},
+ {10, 690,-12}, {11, 1379, 13}, {11, 1378,-13}, {12, 2755, 14},
+ {12, 2754,-14}, {13, 5507, 15}, {13, 5506,-15}, {13, 5505, 16},
+ {13, 5504,-16}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_33[] =
+{
+ { 3, 1, 0}, { 4, 15, 1}, { 4, 14, -1}, { 4, 11, 2},
+ { 4, 10, -2}, { 4, 8, 3}, { 4, 7, -3}, { 4, 4, 4},
+ { 4, 1, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 19, 6},
+ { 5, 18, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 1, 8},
+ { 5, 0, -8}, { 6, 50, 9}, { 6, 49, -9}, { 6, 26, 10},
+ { 6, 21,-10}, { 7, 103, 11}, { 7, 102,-11}, { 7, 96, 12},
+ { 7, 55,-12}, { 7, 41, 13}, { 7, 40,-13}, { 8, 194, 14},
+ { 8, 109,-14}, { 8, 108, 15}, { 9, 391,-15}, {10, 781, 16},
+ {10, 780,-16}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_33[] =
+{
+ { 4, 13, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2},
+ { 4, 7, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 2, 4},
+ { 4, 1, -4}, { 5, 30, 5}, { 5, 29, -5}, { 5, 25, 6},
+ { 5, 24, -6}, { 5, 19, 7}, { 5, 18, -7}, { 5, 11, 8},
+ { 5, 10, -8}, { 5, 0, 9}, { 6, 63, -9}, { 6, 62, 10},
+ { 6, 57,-10}, { 6, 27, 11}, { 6, 26,-11}, { 6, 24, 12},
+ { 6, 3,-12}, { 7, 113, 13}, { 7, 112,-13}, { 7, 50, 14},
+ { 7, 5,-14}, { 7, 4, 15}, { 8, 103,-15}, { 9, 205, 16},
+ { 9, 204,-16}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_d_33[] =
+{
+ { 2, 1, 0}, { 3, 6, 1}, { 3, 5, -1}, { 3, 0, 2},
+ { 4, 15, -2}, { 4, 8, 3}, { 4, 3, -3}, { 5, 28, 4},
+ { 5, 19, -4}, { 5, 4, 5}, { 6, 59, -5}, { 6, 36, 6},
+ { 6, 11, -6}, { 7, 116, 7}, { 7, 75, -7}, { 7, 21, 8},
+ { 7, 20, -8}, { 8, 149, 9}, { 8, 148, -9}, { 9, 469, 10},
+ { 9, 468,-10}, {10, 941, 11}, {10, 940,-11}, {11, 1885, 12},
+ {11, 1884,-12}, {12, 3773, 13}, {12, 3772,-13}, {13, 7551, 14},
+ {13, 7550,-14}, {14, 15099, 15}, {14, 15098,-15}, {14, 15097, 16},
+ {14, 15096,-16}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_e_33[] =
+{
+ { 2, 2, 0}, { 3, 2, 1}, { 3, 1, -1}, { 4, 12, 2},
+ { 4, 7, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 27, 4},
+ { 5, 26, -4}, { 5, 3, 5}, { 5, 2, -5}, { 6, 59, 6},
+ { 6, 58, -6}, { 6, 27, 7}, { 6, 26, -7}, { 7, 123, 8},
+ { 7, 122, -8}, { 7, 120, 9}, { 7, 115, -9}, { 7, 112, 10},
+ { 7, 51,-10}, { 7, 49, 11}, { 7, 48,-11}, { 8, 242, 12},
+ { 8, 229,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 101, 14},
+ { 8, 100,-14}, { 9, 487, 15}, { 9, 486,-15}, { 9, 457, 16},
+ { 9, 456,-16}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_f_33[] =
+{
+ { 4, 13, 0}, { 4, 12, 1}, { 4, 11, -1}, { 4, 9, 2},
+ { 4, 8, -2}, { 4, 7, 3}, { 4, 6, -3}, { 4, 4, 4},
+ { 4, 3, -4}, { 4, 1, 5}, { 4, 0, -5}, { 5, 30, 6},
+ { 5, 29, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 10, 8},
+ { 5, 5, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10},
+ { 6, 23,-10}, { 6, 9, 11}, { 6, 8,-11}, { 7, 45, 12},
+ { 7, 44,-12}, { 8, 230, 13}, { 8, 229,-13}, { 9, 463, 14},
+ { 9, 462,-14}, { 9, 456, 15}, {10, 915,-15}, {11, 1829, 16},
+ {11, 1828,-16}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_g_33[] =
+{
+ { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4},
+ { 4, 0, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 6, 6},
+ { 5, 5, -6}, { 6, 46, 7}, { 6, 41, -7}, { 6, 14, 8},
+ { 6, 9, -8}, { 7, 94, 9}, { 7, 81, -9}, { 7, 30, 10},
+ { 7, 17,-10}, { 8, 191, 11}, { 8, 190,-11}, { 8, 63, 12},
+ { 8, 62,-12}, { 8, 32, 13}, { 9, 323,-13}, { 9, 321, 14},
+ { 9, 320,-14}, { 9, 67, 15}, { 9, 66,-15}, {10, 645, 16},
+ {10, 644,-16}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_a_65[] =
+{
+ { 4, 6, 0}, { 4, 5, 1}, { 4, 4, -1}, { 4, 2, 2},
+ { 4, 1, -2}, { 4, 0, 3}, { 5, 31, -3}, { 5, 29, 4},
+ { 5, 28, -4}, { 5, 27, 5}, { 5, 26, -5}, { 5, 24, 6},
+ { 5, 23, -6}, { 5, 21, 7}, { 5, 20, -7}, { 5, 18, 8},
+ { 5, 17, -8}, { 5, 14, 9}, { 5, 7, -9}, { 5, 6, 10},
+ { 6, 61,-10}, { 6, 50, 11}, { 6, 45,-11}, { 6, 38, 12},
+ { 6, 33,-12}, { 6, 31, 13}, { 6, 30,-13}, { 7, 120, 14},
+ { 7, 103,-14}, { 7, 89, 15}, { 7, 88,-15}, { 7, 65, 16},
+ { 7, 64,-16}, { 8, 205, 17}, { 8, 204,-17}, { 8, 157, 18},
+ { 8, 156,-18}, { 9, 486, 19}, { 9, 485,-19}, { 9, 318, 20},
+ { 9, 317,-20}, {10, 975, 21}, {10, 974,-21}, {10, 639, 22},
+ {10, 638,-22}, {11, 1939, 23}, {11, 1938,-23}, {11, 1936, 24},
+ {11, 1267,-24}, {11, 1264, 25}, {12, 3875,-25}, {12, 2532, 26},
+ {12, 2531,-26}, {13, 7749, 27}, {13, 7748,-27}, {13, 5061, 28},
+ {13, 5060,-28}, {14, 10133, 29}, {14, 10132,-29}, {15, 20269, 30},
+ {15, 20268,-30}, {16, 40543, 31}, {16, 40542,-31}, {16, 40541, 32},
+ {16, 40540,-32}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_65[] =
+{
+ { 4, 4, 0}, { 4, 2, 1}, { 4, 1, -1}, { 5, 30, 2},
+ { 5, 29, -2}, { 5, 26, 3}, { 5, 25, -3}, { 5, 23, 4},
+ { 5, 22, -4}, { 5, 19, 5}, { 5, 18, -5}, { 5, 16, 6},
+ { 5, 15, -6}, { 5, 12, 7}, { 5, 11, -7}, { 5, 7, 8},
+ { 5, 6, -8}, { 6, 63, 9}, { 6, 62, -9}, { 6, 56, 10},
+ { 6, 55,-10}, { 6, 49, 11}, { 6, 48,-11}, { 6, 41, 12},
+ { 6, 40,-12}, { 6, 34, 13}, { 6, 29,-13}, { 6, 26, 14},
+ { 6, 21,-14}, { 6, 20, 15}, { 6, 3,-15}, { 6, 0, 16},
+ { 7, 115,-16}, { 7, 109, 17}, { 7, 108,-17}, { 7, 86, 18},
+ { 7, 85,-18}, { 7, 70, 19}, { 7, 57,-19}, { 7, 56, 20},
+ { 7, 55,-20}, { 7, 4, 21}, { 7, 3,-21}, { 8, 229, 22},
+ { 8, 228,-22}, { 8, 175, 23}, { 8, 174,-23}, { 8, 143, 24},
+ { 8, 142,-24}, { 8, 108, 25}, { 8, 11,-25}, { 8, 10, 26},
+ { 8, 5,-26}, { 9, 339, 27}, { 9, 338,-27}, { 9, 336, 28},
+ { 9, 219,-28}, { 9, 9, 29}, { 9, 8,-29}, {10, 674, 30},
+ {10, 437,-30}, {10, 436, 31}, {11, 1351,-31}, {12, 2701, 32},
+ {12, 2700,-32}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_65[] =
+{
+ { 5, 28, 0}, { 5, 25, 1}, { 5, 24, -1}, { 5, 23, 2},
+ { 5, 22, -2}, { 5, 19, 3}, { 5, 18, -3}, { 5, 16, 4},
+ { 5, 15, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 10, 6},
+ { 5, 9, -6}, { 5, 7, 7}, { 5, 6, -7}, { 5, 4, 8},
+ { 5, 3, -8}, { 5, 1, 9}, { 5, 0, -9}, { 6, 62, 10},
+ { 6, 61,-10}, { 6, 59, 11}, { 6, 58,-11}, { 6, 54, 12},
+ { 6, 53,-12}, { 6, 43, 13}, { 6, 42,-13}, { 6, 40, 14},
+ { 6, 35,-14}, { 6, 29, 15}, { 6, 28,-15}, { 6, 17, 16},
+ { 6, 16,-16}, { 6, 11, 17}, { 6, 10,-17}, { 6, 4, 18},
+ { 7, 127,-18}, { 7, 121, 19}, { 7, 120,-19}, { 7, 110, 20},
+ { 7, 105,-20}, { 7, 83, 21}, { 7, 82,-21}, { 7, 68, 22},
+ { 7, 47,-22}, { 7, 46, 23}, { 7, 45,-23}, { 7, 11, 24},
+ { 7, 10,-24}, { 8, 252, 25}, { 8, 223,-25}, { 8, 209, 26},
+ { 8, 208,-26}, { 8, 138, 27}, { 8, 89,-27}, { 8, 88, 28},
+ { 9, 507,-28}, { 9, 445, 29}, { 9, 444,-29}, { 9, 278, 30},
+ {10, 1013,-30}, {10, 1012, 31}, {10, 559,-31}, {11, 1117, 32},
+ {11, 1116,-32}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_d_65[] =
+{
+ { 3, 4, 0}, { 3, 1, 1}, { 3, 0, -1}, { 4, 13, 2},
+ { 4, 12, -2}, { 4, 7, 3}, { 4, 6, -3}, { 5, 31, 4},
+ { 5, 30, -4}, { 5, 23, 5}, { 5, 22, -5}, { 5, 11, 6},
+ { 5, 10, -6}, { 6, 59, 7}, { 6, 58, -7}, { 6, 43, 8},
+ { 6, 42, -8}, { 6, 19, 9}, { 6, 18, -9}, { 7, 115, 10},
+ { 7, 114,-10}, { 7, 83, 11}, { 7, 82,-11}, { 7, 35, 12},
+ { 7, 34,-12}, { 8, 227, 13}, { 8, 226,-13}, { 8, 163, 14},
+ { 8, 162,-14}, { 8, 160, 15}, { 8, 67,-15}, { 8, 64, 16},
+ { 9, 451,-16}, { 9, 448, 17}, { 9, 323,-17}, { 9, 132, 18},
+ { 9, 131,-18}, {10, 900, 19}, {10, 899,-19}, {10, 644, 20},
+ {10, 267,-20}, {10, 261, 21}, {10, 260,-21}, {11, 1797, 22},
+ {11, 1796,-22}, {11, 533, 23}, {11, 532,-23}, {12, 3605, 24},
+ {12, 3604,-24}, {12, 2582, 25}, {12, 2581,-25}, {13, 7215, 26},
+ {13, 7214,-26}, {13, 5167, 27}, {13, 5166,-27}, {13, 5160, 28},
+ {14, 14427,-28}, {14, 10323, 29}, {14, 10322,-29}, {15, 28853, 30},
+ {15, 28852,-30}, {15, 28851, 31}, {15, 28850,-31}, {15, 28849, 32},
+ {15, 28848,-32}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_e_65[] =
+{
+ { 3, 4, 0}, { 3, 0, 1}, { 4, 15, -1}, { 4, 7, 2},
+ { 4, 6, -2}, { 5, 29, 3}, { 5, 28, -3}, { 5, 23, 4},
+ { 5, 22, -4}, { 5, 10, 5}, { 5, 9, -5}, { 5, 6, 6},
+ { 5, 5, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 48, 8},
+ { 6, 43, -8}, { 6, 40, 9}, { 6, 23, -9}, { 6, 16, 10},
+ { 6, 15,-10}, { 6, 9, 11}, { 6, 8,-11}, { 7, 105, 12},
+ { 7, 104,-12}, { 7, 100, 13}, { 7, 99,-13}, { 7, 84, 14},
+ { 7, 83,-14}, { 7, 45, 15}, { 7, 44,-15}, { 7, 29, 16},
+ { 7, 28,-16}, { 8, 221, 17}, { 8, 220,-17}, { 8, 206, 18},
+ { 8, 205,-18}, { 8, 202, 19}, { 8, 197,-19}, { 8, 171, 20},
+ { 8, 170,-20}, { 8, 164, 21}, { 8, 71,-21}, { 8, 69, 22},
+ { 8, 68,-22}, { 9, 446, 23}, { 9, 445,-23}, { 9, 415, 24},
+ { 9, 414,-24}, { 9, 408, 25}, { 9, 407,-25}, { 9, 393, 26},
+ { 9, 392,-26}, { 9, 331, 27}, { 9, 330,-27}, { 9, 141, 28},
+ { 9, 140,-28}, {10, 895, 29}, {10, 894,-29}, {10, 889, 30},
+ {10, 888,-30}, {10, 819, 31}, {10, 818,-31}, {10, 813, 32},
+ {10, 812,-32}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_f_65[] =
+{
+ { 3, 6, 0}, { 3, 3, 1}, { 3, 2, -1}, { 4, 15, 2},
+ { 4, 14, -2}, { 4, 9, 3}, { 4, 8, -3}, { 4, 1, 4},
+ { 4, 0, -4}, { 5, 21, 5}, { 5, 20, -5}, { 5, 5, 6},
+ { 5, 4, -6}, { 6, 45, 7}, { 6, 44, -7}, { 6, 13, 8},
+ { 6, 12, -8}, { 7, 93, 9}, { 7, 92, -9}, { 7, 29, 10},
+ { 7, 28,-10}, { 8, 189, 11}, { 8, 188,-11}, { 8, 61, 12},
+ { 8, 60,-12}, { 9, 381, 13}, { 9, 380,-13}, { 9, 125, 14},
+ { 9, 124,-14}, {10, 765, 15}, {10, 764,-15}, {10, 252, 16},
+ {11, 1535,-16}, {11, 1532, 17}, {11, 511,-17}, {11, 506, 18},
+ {12, 3069,-18}, {12, 3067, 19}, {12, 3066,-19}, {12, 1015, 20},
+ {12, 1014,-20}, {13, 6136, 21}, {13, 2043,-21}, {13, 2035, 22},
+ {13, 2034,-22}, {14, 12275, 23}, {14, 12274,-23}, {14, 4085, 24},
+ {14, 4084,-24}, {14, 4083, 25}, {14, 4082,-25}, {14, 4081, 26},
+ {14, 4080,-26}, {14, 4079, 27}, {14, 4078,-27}, {14, 4077, 28},
+ {14, 4076,-28}, {14, 4075, 29}, {14, 4074,-29}, {14, 4073, 30},
+ {14, 4072,-30}, {14, 4067, 31}, {14, 4066,-31}, {14, 4065, 32},
+ {14, 4064,-32}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_g_65[] =
+{
+ { 4, 14, 0}, { 4, 11, 1}, { 4, 10, -1}, { 4, 8, 2},
+ { 4, 6, -2}, { 4, 4, 3}, { 4, 3, -3}, { 4, 0, 4},
+ { 5, 31, -4}, { 5, 26, 5}, { 5, 25, -5}, { 5, 18, 6},
+ { 5, 15, -6}, { 5, 10, 7}, { 5, 5, -7}, { 5, 2, 8},
+ { 6, 61, -8}, { 6, 54, 9}, { 6, 49, -9}, { 6, 38, 10},
+ { 6, 29,-10}, { 6, 22, 11}, { 6, 9,-11}, { 6, 6, 12},
+ { 7, 121,-12}, { 7, 110, 13}, { 7, 97,-13}, { 7, 78, 14},
+ { 7, 57,-14}, { 7, 46, 15}, { 7, 17,-15}, { 7, 14, 16},
+ { 8, 241,-16}, { 8, 223, 17}, { 8, 222,-17}, { 8, 159, 18},
+ { 8, 158,-18}, { 8, 95, 19}, { 8, 94,-19}, { 8, 31, 20},
+ { 8, 30,-20}, { 9, 480, 21}, { 9, 387,-21}, { 9, 384, 22},
+ { 9, 227,-22}, { 9, 225, 23}, { 9, 224,-23}, { 9, 65, 24},
+ { 9, 64,-24}, {10, 962, 25}, {10, 773,-25}, {10, 771, 26},
+ {10, 770,-26}, {10, 452, 27}, {10, 135,-27}, {10, 133, 28},
+ {10, 132,-28}, {11, 1927, 29}, {11, 1926,-29}, {11, 1545, 30},
+ {11, 1544,-30}, {11, 907, 31}, {11, 906,-31}, {11, 269, 32},
+ {11, 268,-32}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_a_129[] =
+{
+ { 4, 8, 0}, { 4, 10, 1}, { 4, 9, -1}, { 4, 0, 2},
+ { 5, 31, -2}, { 5, 24, 3}, { 5, 23, -3}, { 5, 12, 4},
+ { 5, 11, -4}, { 5, 5, 5}, { 5, 4, -5}, { 6, 60, 6},
+ { 6, 58, -6}, { 6, 54, 7}, { 6, 53, -7}, { 6, 45, 8},
+ { 6, 44, -8}, { 6, 28, 9}, { 6, 27, -9}, { 6, 19, 10},
+ { 6, 18,-10}, { 6, 14, 11}, { 6, 13,-11}, { 6, 6, 12},
+ { 6, 5,-12}, { 7, 122, 13}, { 7, 119,-13}, { 7, 113, 14},
+ { 7, 112,-14}, { 7, 104, 15}, { 7, 103,-15}, { 7, 100, 16},
+ { 7, 63,-16}, { 7, 60, 17}, { 7, 59,-17}, { 7, 52, 18},
+ { 7, 43,-18}, { 7, 40, 19}, { 7, 35,-19}, { 7, 32, 20},
+ { 7, 31,-20}, { 7, 15, 21}, { 7, 14,-21}, { 8, 247, 22},
+ { 8, 246,-22}, { 8, 231, 23}, { 8, 230,-23}, { 8, 223, 24},
+ { 8, 222,-24}, { 8, 211, 25}, { 8, 210,-25}, { 8, 203, 26},
+ { 8, 202,-26}, { 8, 123, 27}, { 8, 122,-27}, { 8, 116, 28},
+ { 8, 107,-28}, { 8, 84, 29}, { 8, 83,-29}, { 8, 68, 30},
+ { 8, 67,-30}, { 8, 60, 31}, { 8, 51,-31}, { 8, 49, 32},
+ { 8, 48,-32}, { 8, 17, 33}, { 8, 16,-33}, { 9, 474, 34},
+ { 9, 473,-34}, { 9, 458, 35}, { 9, 457,-35}, { 9, 442, 36},
+ { 9, 441,-36}, { 9, 411, 37}, { 9, 410,-37}, { 9, 251, 38},
+ { 9, 250,-38}, { 9, 248, 39}, { 9, 235,-39}, { 9, 213, 40},
+ { 9, 212,-40}, { 9, 170, 41}, { 9, 165,-41}, { 9, 139, 42},
+ { 9, 138,-42}, { 9, 132, 43}, { 9, 123,-43}, { 9, 101, 44},
+ { 9, 100,-44}, { 9, 37, 45}, { 9, 36,-45}, {10, 950, 46},
+ {10, 945,-46}, {10, 919, 47}, {10, 918,-47}, {10, 912, 48},
+ {10, 887,-48}, {10, 881, 49}, {10, 880,-49}, {10, 818, 50},
+ {10, 817,-50}, {10, 499, 51}, {10, 498,-51}, {10, 469, 52},
+ {10, 468,-52}, {10, 343, 53}, {10, 342,-53}, {10, 329, 54},
+ {10, 328,-54}, {10, 267, 55}, {10, 266,-55}, {10, 245, 56},
+ {10, 244,-56}, {10, 79, 57}, {10, 78,-57}, {10, 77, 58},
+ {10, 76,-58}, {11, 1903, 59}, {11, 1902,-59}, {11, 1889, 60},
+ {11, 1888,-60}, {11, 1827, 61}, {11, 1826,-61}, {11, 1773, 62},
+ {11, 1772,-62}, {11, 1639, 63}, {11, 1638,-63}, {11, 1633, 64},
+ {11, 1632,-64}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_b_129[] =
+{
+ { 5, 10, 0}, { 5, 7, 1}, { 5, 6, -1}, { 5, 4, 2},
+ { 5, 3, -2}, { 5, 0, 3}, { 6, 63, -3}, { 6, 60, 4},
+ { 6, 59, -4}, { 6, 57, 5}, { 6, 56, -5}, { 6, 53, 6},
+ { 6, 52, -6}, { 6, 50, 7}, { 6, 49, -7}, { 6, 46, 8},
+ { 6, 45, -8}, { 6, 43, 9}, { 6, 42, -9}, { 6, 39, 10},
+ { 6, 38,-10}, { 6, 35, 11}, { 6, 34,-11}, { 6, 32, 12},
+ { 6, 31,-12}, { 6, 28, 13}, { 6, 27,-13}, { 6, 25, 14},
+ { 6, 24,-14}, { 6, 22, 15}, { 6, 19,-15}, { 6, 16, 16},
+ { 6, 11,-16}, { 6, 5, 17}, { 6, 4,-17}, { 7, 125, 18},
+ { 7, 124,-18}, { 7, 122, 19}, { 7, 117,-19}, { 7, 110, 20},
+ { 7, 109,-20}, { 7, 103, 21}, { 7, 102,-21}, { 7, 96, 22},
+ { 7, 95,-22}, { 7, 89, 23}, { 7, 88,-23}, { 7, 81, 24},
+ { 7, 80,-24}, { 7, 74, 25}, { 7, 73,-25}, { 7, 66, 26},
+ { 7, 61,-26}, { 7, 59, 27}, { 7, 58,-27}, { 7, 52, 28},
+ { 7, 47,-28}, { 7, 37, 29}, { 7, 36,-29}, { 7, 21, 30},
+ { 7, 20,-30}, { 7, 6, 31}, { 7, 5,-31}, { 8, 247, 32},
+ { 8, 246,-32}, { 8, 223, 33}, { 8, 222,-33}, { 8, 217, 34},
+ { 8, 216,-34}, { 8, 189, 35}, { 8, 188,-35}, { 8, 166, 36},
+ { 8, 165,-36}, { 8, 151, 37}, { 8, 150,-37}, { 8, 144, 38},
+ { 8, 135,-38}, { 8, 121, 39}, { 8, 120,-39}, { 8, 106, 40},
+ { 8, 93,-40}, { 8, 71, 41}, { 8, 70,-41}, { 8, 68, 42},
+ { 8, 15,-42}, { 8, 9, 43}, { 8, 8,-43}, { 9, 466, 44},
+ { 9, 465,-44}, { 9, 391, 45}, { 9, 390,-45}, { 9, 388, 46},
+ { 9, 335,-46}, { 9, 329, 47}, { 9, 328,-47}, { 9, 269, 48},
+ { 9, 268,-48}, { 9, 215, 49}, { 9, 214,-49}, { 9, 184, 50},
+ { 9, 139,-50}, { 9, 29, 51}, { 9, 28,-51}, {10, 934, 52},
+ {10, 929,-52}, {10, 779, 53}, {10, 778,-53}, {10, 668, 54},
+ {10, 583,-54}, {10, 582, 55}, {10, 581,-55}, {10, 371, 56},
+ {10, 370,-56}, {10, 276, 57}, {11, 1871,-57}, {11, 1857, 58},
+ {11, 1856,-58}, {11, 1338, 59}, {11, 1161,-59}, {11, 1160, 60},
+ {11, 555,-60}, {12, 3741, 61}, {12, 3740,-61}, {12, 2678, 62},
+ {12, 1109,-62}, {12, 1108, 63}, {13, 5359,-63}, {14, 10717, 64},
+ {14, 10716,-64}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_c_129[] =
+{
+ { 6, 58, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2},
+ { 6, 51, -2}, { 6, 49, 3}, { 6, 48, -3}, { 6, 46, 4},
+ { 6, 45, -4}, { 6, 43, 5}, { 6, 42, -5}, { 6, 40, 6},
+ { 6, 39, -6}, { 6, 37, 7}, { 6, 36, -7}, { 6, 34, 8},
+ { 6, 33, -8}, { 6, 30, 9}, { 6, 29, -9}, { 6, 27, 10},
+ { 6, 26,-10}, { 6, 24, 11}, { 6, 23,-11}, { 6, 21, 12},
+ { 6, 20,-12}, { 6, 18, 13}, { 6, 17,-13}, { 6, 14, 14},
+ { 6, 13,-14}, { 6, 12, 15}, { 6, 11,-15}, { 6, 8, 16},
+ { 6, 7,-16}, { 6, 6, 17}, { 6, 5,-17}, { 6, 3, 18},
+ { 6, 2,-18}, { 7, 127, 19}, { 7, 126,-19}, { 7, 124, 20},
+ { 7, 123,-20}, { 7, 121, 21}, { 7, 120,-21}, { 7, 118, 22},
+ { 7, 115,-22}, { 7, 113, 23}, { 7, 112,-23}, { 7, 106, 24},
+ { 7, 101,-24}, { 7, 95, 25}, { 7, 94,-25}, { 7, 88, 26},
+ { 7, 83,-26}, { 7, 77, 27}, { 7, 76,-27}, { 7, 70, 28},
+ { 7, 65,-28}, { 7, 64, 29}, { 7, 63,-29}, { 7, 56, 30},
+ { 7, 51,-30}, { 7, 45, 31}, { 7, 44,-31}, { 7, 39, 32},
+ { 7, 38,-32}, { 7, 31, 33}, { 7, 30,-33}, { 7, 20, 34},
+ { 7, 19,-34}, { 7, 18, 35}, { 7, 9,-35}, { 7, 3, 36},
+ { 7, 2,-36}, { 7, 0, 37}, { 8, 251,-37}, { 8, 245, 38},
+ { 8, 244,-38}, { 8, 238, 39}, { 8, 229,-39}, { 8, 215, 40},
+ { 8, 214,-40}, { 8, 200, 41}, { 8, 179,-41}, { 8, 165, 42},
+ { 8, 164,-42}, { 8, 143, 43}, { 8, 142,-43}, { 8, 124, 44},
+ { 8, 115,-44}, { 8, 101, 45}, { 8, 100,-45}, { 8, 66, 46},
+ { 8, 65,-46}, { 8, 43, 47}, { 8, 42,-47}, { 8, 17, 48},
+ { 8, 16,-48}, { 8, 2, 49}, { 9, 501,-49}, { 9, 479, 50},
+ { 9, 478,-50}, { 9, 456, 51}, { 9, 403,-51}, { 9, 357, 52},
+ { 9, 356,-52}, { 9, 251, 53}, { 9, 250,-53}, { 9, 228, 54},
+ { 9, 135,-54}, { 9, 129, 55}, { 9, 128,-55}, { 9, 6, 56},
+ {10, 1001,-56}, {10, 1000, 57}, {10, 915,-57}, {10, 805, 58},
+ {10, 804,-58}, {10, 458, 59}, {10, 269,-59}, {10, 268, 60},
+ {10, 15,-60}, {11, 1829, 61}, {11, 1828,-61}, {11, 918, 62},
+ {11, 29,-62}, {11, 28, 63}, {12, 1839,-63}, {13, 3677, 64},
+ {13, 3676,-64}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_d_129[] =
+{
+ { 4, 9, 0}, { 4, 6, 1}, { 4, 5, -1}, { 4, 2, 2},
+ { 4, 1, -2}, { 5, 30, 3}, { 5, 29, -3}, { 5, 26, 4},
+ { 5, 25, -4}, { 5, 22, 5}, { 5, 21, -5}, { 5, 16, 6},
+ { 5, 15, -6}, { 5, 8, 7}, { 5, 7, -7}, { 5, 0, 8},
+ { 6, 63, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 48, 10},
+ { 6, 47,-10}, { 6, 40, 11}, { 6, 35,-11}, { 6, 28, 12},
+ { 6, 19,-12}, { 6, 12, 13}, { 6, 3,-13}, { 7, 124, 14},
+ { 7, 115,-14}, { 7, 108, 15}, { 7, 99,-15}, { 7, 92, 16},
+ { 7, 83,-16}, { 7, 68, 17}, { 7, 59,-17}, { 7, 36, 18},
+ { 7, 27,-18}, { 7, 4, 19}, { 8, 251,-19}, { 8, 228, 20},
+ { 8, 219,-20}, { 8, 196, 21}, { 8, 187,-21}, { 8, 164, 22},
+ { 8, 139,-22}, { 8, 116, 23}, { 8, 75,-23}, { 8, 52, 24},
+ { 8, 11,-24}, { 9, 501, 25}, { 9, 500,-25}, { 9, 437, 26},
+ { 9, 436,-26}, { 9, 373, 27}, { 9, 372,-27}, { 9, 277, 28},
+ { 9, 276,-28}, { 9, 149, 29}, { 9, 148,-29}, { 9, 21, 30},
+ { 9, 20,-30}, {10, 917, 31}, {10, 916,-31}, {10, 789, 32},
+ {10, 788,-32}, {10, 661, 33}, {10, 660,-33}, {10, 469, 34},
+ {10, 468,-34}, {10, 214, 35}, {10, 213,-35}, {11, 1838, 36},
+ {11, 1837,-36}, {11, 1582, 37}, {11, 1581,-37}, {11, 1326, 38},
+ {11, 1325,-38}, {11, 942, 39}, {11, 941,-39}, {11, 431, 40},
+ {11, 430,-40}, {12, 3679, 41}, {12, 3678,-41}, {12, 3167, 42},
+ {12, 3166,-42}, {12, 3160, 43}, {12, 2655,-43}, {12, 2648, 44},
+ {12, 1887,-44}, {12, 1880, 45}, {12, 851,-45}, {12, 849, 46},
+ {12, 848,-46}, {13, 7346, 47}, {13, 7345,-47}, {13, 6322, 48},
+ {13, 5309,-48}, {13, 3773, 49}, {13, 3772,-49}, {13, 3762, 50},
+ {13, 1701,-50}, {14, 14695, 51}, {14, 14694,-51}, {14, 14688, 52},
+ {14, 12647,-52}, {14, 10617, 53}, {14, 10616,-53}, {14, 10596, 54},
+ {14, 7527,-54}, {14, 3401, 55}, {14, 3400,-55}, {15, 29378, 56},
+ {15, 25293,-56}, {15, 21195, 57}, {15, 21194,-57}, {15, 15053, 58},
+ {15, 15052,-58}, {16, 58759, 59}, {16, 58758,-59}, {16, 50585, 60},
+ {16, 50584,-60}, {16, 42399, 61}, {16, 42398,-61}, {16, 42397, 62},
+ {16, 42396,-62}, {16, 42395, 63}, {16, 42394,-63}, {16, 42393, 64},
+ {16, 42392,-64}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_e_129[] =
+{
+ { 5, 12, 0}, { 5, 11, 1}, { 5, 10, -1}, { 5, 9, 2},
+ { 5, 8, -2}, { 5, 7, 3}, { 5, 6, -3}, { 5, 4, 4},
+ { 5, 3, -4}, { 5, 2, 5}, { 5, 1, -5}, { 5, 0, 6},
+ { 6, 63, -6}, { 6, 61, 7}, { 6, 60, -7}, { 6, 59, 8},
+ { 6, 58, -8}, { 6, 56, 9}, { 6, 55, -9}, { 6, 53, 10},
+ { 6, 52,-10}, { 6, 51, 11}, { 6, 50,-11}, { 6, 47, 12},
+ { 6, 46,-12}, { 6, 45, 13}, { 6, 44,-13}, { 6, 42, 14},
+ { 6, 41,-14}, { 6, 38, 15}, { 6, 37,-15}, { 6, 36, 16},
+ { 6, 35,-16}, { 6, 32, 17}, { 6, 31,-17}, { 6, 29, 18},
+ { 6, 28,-18}, { 6, 26, 19}, { 6, 11,-19}, { 7, 125, 20},
+ { 7, 124,-20}, { 7, 109, 21}, { 7, 108,-21}, { 7, 98, 22},
+ { 7, 97,-22}, { 7, 87, 23}, { 7, 86,-23}, { 7, 79, 24},
+ { 7, 78,-24}, { 7, 68, 25}, { 7, 67,-25}, { 7, 60, 26},
+ { 7, 55,-26}, { 7, 21, 27}, { 7, 20,-27}, { 8, 230, 28},
+ { 8, 229,-28}, { 8, 198, 29}, { 8, 193,-29}, { 8, 163, 30},
+ { 8, 162,-30}, { 8, 139, 31}, { 8, 138,-31}, { 8, 123, 32},
+ { 8, 122,-32}, { 8, 108, 33}, { 9, 463,-33}, { 9, 457, 34},
+ { 9, 456,-34}, { 9, 385, 35}, { 9, 384,-35}, { 9, 321, 36},
+ { 9, 320,-36}, { 9, 266, 37}, { 9, 265,-37}, { 9, 218, 38},
+ {10, 925,-38}, {10, 798, 39}, {10, 797,-39}, {10, 646, 40},
+ {10, 645,-40}, {10, 535, 41}, {10, 534,-41}, {10, 528, 42},
+ {10, 439,-42}, {11, 1848, 43}, {11, 1599,-43}, {11, 1592, 44},
+ {11, 1295,-44}, {11, 1288, 45}, {11, 1059,-45}, {11, 877, 46},
+ {11, 876,-46}, {12, 3197, 47}, {12, 3196,-47}, {12, 2589, 48},
+ {12, 2588,-48}, {12, 2117, 49}, {12, 2116,-49}, {13, 7398, 50},
+ {13, 7397,-50}, {13, 6374, 51}, {13, 6373,-51}, {13, 5158, 52},
+ {13, 5157,-52}, {14, 14799, 53}, {14, 14798,-53}, {14, 12751, 54},
+ {14, 12750,-54}, {14, 10318, 55}, {14, 10313,-55}, {15, 29587, 56},
+ {15, 29586,-56}, {15, 29584, 57}, {15, 25491,-57}, {15, 20625, 58},
+ {15, 20624,-58}, {16, 59171, 59}, {16, 59170,-59}, {16, 50980, 60},
+ {16, 41277,-60}, {16, 50981, 61}, {16, 41278,-61}, {16, 50978, 62},
+ {16, 41279,-62}, {16, 50979, 63}, {16, 50976,-63}, {16, 50977, 64},
+ {16, 41276,-64}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_f_129[] =
+{
+ { 6, 56, 0}, { 6, 55, 1}, { 6, 54, -1}, { 6, 52, 2},
+ { 6, 51, -2}, { 6, 50, 3}, { 6, 49, -3}, { 6, 48, 4},
+ { 6, 47, -4}, { 6, 46, 5}, { 6, 45, -5}, { 6, 44, 6},
+ { 6, 43, -6}, { 6, 41, 7}, { 6, 40, -7}, { 6, 39, 8},
+ { 6, 38, -8}, { 6, 36, 9}, { 6, 35, -9}, { 6, 34, 10},
+ { 6, 33,-10}, { 6, 31, 11}, { 6, 30,-11}, { 6, 29, 12},
+ { 6, 28,-12}, { 6, 26, 13}, { 6, 25,-13}, { 6, 23, 14},
+ { 6, 22,-14}, { 6, 21, 15}, { 6, 20,-15}, { 6, 18, 16},
+ { 6, 17,-16}, { 6, 15, 17}, { 6, 14,-17}, { 6, 12, 18},
+ { 6, 11,-18}, { 6, 9, 19}, { 6, 8,-19}, { 6, 7, 20},
+ { 6, 6,-20}, { 6, 3, 21}, { 6, 2,-21}, { 6, 1, 22},
+ { 6, 0,-22}, { 7, 125, 23}, { 7, 124,-23}, { 7, 123, 24},
+ { 7, 122,-24}, { 7, 120, 25}, { 7, 119,-25}, { 7, 116, 26},
+ { 7, 115,-26}, { 7, 114, 27}, { 7, 107,-27}, { 7, 84, 28},
+ { 7, 75,-28}, { 7, 65, 29}, { 7, 64,-29}, { 7, 54, 30},
+ { 7, 49,-30}, { 7, 39, 31}, { 7, 38,-31}, { 7, 27, 32},
+ { 7, 26,-32}, { 7, 20, 33}, { 7, 11,-33}, { 7, 10, 34},
+ { 7, 9,-34}, { 8, 254, 35}, { 8, 253,-35}, { 8, 243, 36},
+ { 8, 242,-36}, { 8, 235, 37}, { 8, 234,-37}, { 8, 213, 38},
+ { 8, 212,-38}, { 8, 149, 39}, { 8, 148,-39}, { 8, 110, 40},
+ { 8, 97,-40}, { 8, 66, 41}, { 8, 65,-41}, { 8, 43, 42},
+ { 8, 42,-42}, { 8, 16, 43}, { 9, 511,-43}, { 9, 505, 44},
+ { 9, 504,-44}, { 9, 474, 45}, { 9, 473,-45}, { 9, 343, 46},
+ { 9, 342,-46}, { 9, 340, 47}, { 9, 223,-47}, { 9, 192, 48},
+ { 9, 135,-48}, { 9, 129, 49}, { 9, 128,-49}, { 9, 34, 50},
+ {10, 1021,-50}, {10, 951, 51}, {10, 950,-51}, {10, 944, 52},
+ {10, 683,-52}, {10, 445, 53}, {10, 444,-53}, {10, 269, 54},
+ {10, 268,-54}, {10, 71, 55}, {10, 70,-55}, {11, 2040, 56},
+ {11, 1891,-56}, {11, 1364, 57}, {11, 775,-57}, {11, 774, 58},
+ {11, 773,-58}, {12, 4083, 59}, {12, 4082,-59}, {12, 3780, 60},
+ {12, 2731,-60}, {12, 1545, 61}, {12, 1544,-61}, {13, 7562, 62},
+ {13, 5461,-62}, {13, 5460, 63}, {14, 15127,-63}, {15, 30253, 64},
+ {15, 30252,-64}, { 0, 0, 0}
+};
+
+huff_entry_t bitalloc_g_129[] =
+{
+ { 4, 0, 0}, { 5, 29, 1}, { 5, 28, -1}, { 5, 25, 2},
+ { 5, 24, -2}, { 5, 21, 3}, { 5, 20, -3}, { 5, 17, 4},
+ { 5, 16, -4}, { 5, 13, 5}, { 5, 12, -5}, { 5, 9, 6},
+ { 5, 8, -6}, { 5, 5, 7}, { 5, 4, -7}, { 6, 63, 8},
+ { 6, 62, -8}, { 6, 55, 9}, { 6, 54, -9}, { 6, 47, 10},
+ { 6, 46,-10}, { 6, 39, 11}, { 6, 38,-11}, { 6, 31, 12},
+ { 6, 30,-12}, { 6, 23, 13}, { 6, 22,-13}, { 6, 15, 14},
+ { 6, 14,-14}, { 6, 7, 15}, { 6, 6,-15}, { 7, 123, 16},
+ { 7, 122,-16}, { 7, 107, 17}, { 7, 106,-17}, { 7, 91, 18},
+ { 7, 90,-18}, { 7, 75, 19}, { 7, 74,-19}, { 7, 59, 20},
+ { 7, 58,-20}, { 7, 43, 21}, { 7, 42,-21}, { 7, 27, 22},
+ { 7, 26,-22}, { 7, 11, 23}, { 7, 10,-23}, { 7, 8, 24},
+ { 8, 243,-24}, { 8, 240, 25}, { 8, 211,-25}, { 8, 208, 26},
+ { 8, 179,-26}, { 8, 176, 27}, { 8, 147,-27}, { 8, 144, 28},
+ { 8, 115,-28}, { 8, 112, 29}, { 8, 83,-29}, { 8, 80, 30},
+ { 8, 51,-30}, { 8, 48, 31}, { 8, 19,-31}, { 9, 484, 32},
+ { 9, 483,-32}, { 9, 421, 33}, { 9, 420,-33}, { 9, 357, 34},
+ { 9, 356,-34}, { 9, 293, 35}, { 9, 292,-35}, { 9, 229, 36},
+ { 9, 228,-36}, { 9, 226, 37}, { 9, 165,-37}, { 9, 162, 38},
+ { 9, 101,-38}, { 9, 98, 39}, { 9, 37,-39}, {10, 970, 40},
+ {10, 965,-40}, {10, 839, 41}, {10, 838,-41}, {10, 711, 42},
+ {10, 710,-42}, {10, 708, 43}, {10, 583,-43}, {10, 580, 44},
+ {10, 455,-44}, {10, 329, 45}, {10, 328,-45}, {10, 201, 46},
+ {10, 200,-46}, {10, 198, 47}, {10, 73,-47}, {11, 1942, 48},
+ {11, 1929,-48}, {11, 1675, 49}, {11, 1674,-49}, {11, 1672, 50},
+ {11, 1419,-50}, {11, 1165, 51}, {11, 1164,-51}, {11, 1162, 52},
+ {11, 909,-52}, {11, 655, 53}, {11, 654,-53}, {11, 652, 54},
+ {11, 399,-54}, {11, 145, 55}, {11, 144,-55}, {12, 3886, 56},
+ {12, 3857,-56}, {12, 3347, 57}, {12, 3346,-57}, {12, 2837, 58},
+ {12, 2836,-58}, {12, 2327, 59}, {12, 2326,-59}, {12, 1817, 60},
+ {12, 1816,-60}, {12, 1307, 61}, {12, 1306,-61}, {12, 797, 62},
+ {12, 796,-62}, {13, 7775, 63}, {13, 7774,-63}, {13, 7713, 64},
+ {13, 7712,-64}, { 0, 0, 0}
+};
+
+huff_entry_t *bitalloc_select[11][8] =
+{
+ { 0 },
+ { bitalloc_a_3, 0 },
+ { bitalloc_a_5, bitalloc_b_5, bitalloc_c_5, 0 },
+ { bitalloc_a_7, bitalloc_b_7, bitalloc_c_7, 0 },
+ { bitalloc_a_9, bitalloc_b_9, bitalloc_c_9, 0 },
+ { bitalloc_a_13, bitalloc_b_13, bitalloc_c_13, 0 },
+ { bitalloc_a_17, bitalloc_b_17, bitalloc_c_17, bitalloc_d_17,
+ bitalloc_e_17, bitalloc_f_17, bitalloc_g_17, 0 },
+ { bitalloc_a_25, bitalloc_b_25, bitalloc_c_25, bitalloc_d_25,
+ bitalloc_e_25, bitalloc_f_25, bitalloc_g_25, 0 },
+ { bitalloc_a_33, bitalloc_b_33, bitalloc_c_33, bitalloc_d_33,
+ bitalloc_e_33, bitalloc_f_33, bitalloc_g_33, 0 },
+ { bitalloc_a_65, bitalloc_b_65, bitalloc_c_65, bitalloc_d_65,
+ bitalloc_e_65, bitalloc_f_65, bitalloc_g_65, 0 },
+ { bitalloc_a_129, bitalloc_b_129, bitalloc_c_129, bitalloc_d_129,
+ bitalloc_e_129, bitalloc_f_129, bitalloc_g_129, 0 },
+};
+
+int InverseQ( dts_state_t * state, huff_entry_t * huff )
+{
+ int value = 0;
+ int length = 0, j;
+
+ while( 1 )
+ {
+ length++;
+ value <<= 1;
+ value |= bitstream_get (state, 1);
+
+ for( j = 0; huff[j].length != 0 && huff[j].length < length; j++ );
+
+ if( huff[j].length == 0 ) break;
+
+ for( ; huff[j].length == length; j++ )
+ {
+ if( huff[j].code == value ) return huff[j].value;
+ }
+ }
+
+ return 0;
+}
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_quantization.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_quantization.h
new file mode 100644
index 000000000..ffdb51f36
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_quantization.h
@@ -0,0 +1,86 @@
+/*
+ * quantization.h
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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
+ */
+
+int scale_factor_quant6[] =
+{
+ 1, 2, 2, 3, 3, 4, 6, 7,
+ 10, 12, 16, 20, 26, 34, 44, 56,
+ 72, 93, 120, 155, 200, 257, 331, 427,
+ 550, 708, 912, 1175, 1514, 1950, 2512, 3236,
+ 4169, 5370, 6918, 8913, 11482, 14791, 19055, 24547,
+ 31623, 40738, 52481, 67608, 87096, 112202, 144544, 186209,
+ 239883, 309030, 398107, 512861, 660693, 851138, 1096478, 1412538,
+ 1819701, 2344229, 3019952, 3890451, 5011872, 6456542, 8317638, 0
+};
+
+int scale_factor_quant7[] =
+{
+ 1, 1, 2, 2, 2, 2, 3, 3,
+ 3, 4, 4, 5, 6, 7, 7, 8,
+ 10, 11, 12, 14, 16, 18, 20, 23,
+ 26, 30, 34, 38, 44, 50, 56, 64,
+ 72, 82, 93, 106, 120, 136, 155, 176,
+ 200, 226, 257, 292, 331, 376, 427, 484,
+ 550, 624, 708, 804, 912, 1035, 1175, 1334,
+ 1514, 1718, 1950, 2213, 2512, 2851, 3236, 3673,
+ 4169, 4732, 5370, 6095, 6918, 7852, 8913, 10116,
+ 11482, 13032, 14791, 16788, 19055, 21627, 24547, 27861,
+ 31623, 35892, 40738, 46238, 52481, 59566, 67608, 76736,
+ 87096, 98855, 112202, 127350, 144544, 164059, 186209, 211349,
+ 239883, 272270, 309030, 350752, 398107, 451856, 512861, 582103,
+ 660693, 749894, 851138, 966051, 1096478, 1244515, 1412538, 1603245,
+ 1819701, 2065380, 2344229, 2660725, 3019952, 3427678, 3890451, 4415704,
+ 5011872, 5688529, 6456542, 7328245, 8317638, 0, 0, 0
+};
+
+int lossy_quant[] =
+{
+ 0, 6710886, 4194304, 3355443, 2474639, 2097152, 1761608, 1426063,
+ 796918, 461373, 251658, 146801, 79692, 46137, 27263, 16777,
+ 10486, 5872, 3355, 1887, 1258, 713, 336, 168,
+ 84, 42, 21, 0, 0, 0, 0, 0
+};
+
+double lossy_quant_d[] =
+{
+ 0, 1.6, 1.0, 0.8, 0.59, 0.50, 0.42, 0.34,
+ 0.19, 0.11, 0.06, 0.035, 0.019, 0.011, 0.0065, 0.0040,
+ 0.0025, 0.0014, 0.0008, 0.00045, 0.00030, 0.00017, 0.00008, 0.00004,
+ 0.00002, 0.00001, 0.000005, 0, 0, 0, 0, 0
+};
+
+int lossless_quant[] =
+{
+ 0, 4194304, 2097152, 1384120, 1048576, 696254, 524288, 348127,
+ 262144, 131072, 65431, 33026, 16450, 8208, 4100, 2049,
+ 1024, 512, 256, 128, 64, 32, 16, 8,
+ 4, 2, 1, 0, 0, 0, 0, 0
+};
+
+double lossless_quant_d[] =
+{
+ 0, 1.0, 0.5, 0.33, 0.25, 0.166, 0.125,
+ 0.083, 0.0625, 0.03125, 0.0156, 7.874E-3, 3.922E-3, 1.957E-3,
+ 9.775E-4, 4.885E-4, 2.442E-4, 1.221E-4, 6.104E-5, 3.052E-5, 1.526E-5,
+ 7.629E-6, 3.815E-6, 1.907E-6, 9.537E-7, 4.768E-7, 2.384E-7, 0,
+ 0, 0, 0, 0
+};
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_vq.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_vq.h
new file mode 100644
index 000000000..760a1a248
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/libdts/tables_vq.h
@@ -0,0 +1,2075 @@
+/*
+ * tables_vq.h
+ * Copyright (C) 2004 Gildas Bazin <gbazin@videolan.org>
+ *
+ * This file is part of dtsdec, a free DTS Coherent Acoustics stream decoder.
+ * See http://www.videolan.org/dtsdec.html for updates.
+ *
+ * dtsdec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * dtsdec 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
+ */
+
+/* 8bits signed fractional Q4 binary codes */
+
+static int8_t high_freq_vq[1024][32] =
+{
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { -4, -2, 2, 1, -16, -10, 1, 3, 1, 0, 6, 1, -3, 7, 1, -22,
+ 2, -4, -3, 11, 14, 6, -1, 1, -13, 29, -28, 10, 10, -8, 0, -9 },
+ { -8, 8, -7, 10, -3, -12, -5, -8, 1, -2, 9, -2, -5, -18, 1, 9,
+ -8, -8, 3, 41, 7, -9, -9, 22, -42, -29, 14, -18, -14, -32, 1, -15 },
+ { -16, 8, 15, 16, -16, 5, 2, 7, -6, -16, -7, 1, 1, -3, -2, 0,
+ 8, 20, -26, -11, 2, -17, 0, -3, -34, -37, 10, 44, -2, 22, 2, -4 },
+ { 7, 14, 5, 6, 15, -1, 3, -3, -9, -23, -5, -14, 8, -1, -14, -6,
+ -5, -8, 54, 31, -6, 18, 2, -19, -2, -11, -30, -6, -19, 2, -2, -14 },
+ { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1,
+ 3, 7, -5, -4, -3, -12, 3, -2, -3, 12, -53, -51, 6, -1, 6, 8 },
+ { 0, -1, 5, 1, -6, -8, 7, 5, -18, -4, -1, 1, 0, -3, -3, -14,
+ -1, -6, 0, -14, -1, -1, 5, -3, -11, 1, -20, 10, 2, 19, -2, -2 },
+ { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3,
+ -7, 0, -34, 4, -43, 17, 0, -53, -13, -7, 24, 14, 5, -18, 9, -20 },
+ { 1, 0, -3, 2, 3, -5, -2, 7, -21, 5, -25, 23, 11, -28, 2, 1,
+ -11, 9, 13, -6, -12, 5, 7, 2, 4, -11, -6, -1, 8, 0, 1, -2 },
+ { 2, -4, -6, -4, 0, -5, -29, 13, -6, -22, -3, -43, 12, -41, 5, 24,
+ 18, -9, -36, -6, 4, -7, -4, 13, 4, -15, -1, -5, 1, 2, -5, 4 },
+ { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19, -22, 31, -27, 4, -15,
+ -6, 15, 9, -13, 1, -9, 10, -17, 4, -1, -1, 4, 2, 0, -3, -5 },
+ { -7, 3, -8, 13, 19, -12, 8, -19, -3, -2, -24, 31, 14, 0, 7, -13,
+ -18, 0, 3, 6, 13, -2, 1, -12, -21, 9, -2, 30, 21, -14, 2, -14 },
+ { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1, -10, 30, 4,
+ -10, 12, 5, 6, -13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2 },
+ { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4, -16, -13, 3, 23, -27,
+ 18, 46, -38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3 },
+ { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4, -11, 40, -7,
+ -3, -13, -14, -7, -10, 14, 7, 5, -14, 11, -5, 7, 21, -2, 9, -3 },
+ { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2,
+ -1, 1, -3, -1, -15, -2, -63, -27, -21, -47, -14, 1, -14, 10, 0, 2 },
+ { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7, -15, 6,
+ -7, -6, 3, 7, -15, -5, 23, -13, -6, 12, -8, 9, 2, -3, 3, 4 },
+ { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4, -22, -15,
+ -46, -66, 10, 20, 2, -17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2 },
+ { -1, 0, 0, 1, 0, -4, 0, 1, -10, -3, -8, 5, 7, -11, 2, -11,
+ 29, -25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2 },
+ { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1,
+ -14, -7, 3, -30, -15, -14, 3, -4, -1, 3, -13, -1, -3, 1, 2, 3 },
+ { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10,
+ -57, 3, 22, -50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2 },
+ { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4,
+ 24, -35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0 },
+ { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0,
+ 0, -1, -2, -1, -5, -2, -43, -3, 46, -52, -10, 7, -8, 11, -2, -1 },
+ { 0, 0, -1, 0, -1, 2, -41, 33, -44, -48, -15, -26, -9, 6, 3, 3,
+ -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1 },
+ { -4, 1, 6, 1, -6, -1, -2, 1, -14, -4, 0, -5, -2, 2, -2, 0,
+ -6, 1, 0, 8, -21, 32, -3, -36, -6, -2, -1, -7, 3, 0, 1, -6 },
+ { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3,
+ 13, 0, -12, -1, 25, -20, -2, -23, -15, 7, -3, -11, -3, 6, -1, 0 },
+ { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3,
+ -2, 3, 3, -7, -6, -5, 0, -4, -60, -16, -6, 38, 5, 6, -5, 0 },
+ { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1,
+ 0, 0, -1, 0, -8, 2, -9, 10, 40, 31, -56, -21, 4, 20, -4, 7 },
+ { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5,
+ 1, -2, 14, 5, 4, 5, 5, 5, -5, 9, -66, 0, -20, -2, -8, 4 },
+ { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2,
+ 45, 31, -17, -16, -2, -2, -1, -22, 1, -1, -3, 3, 5, -3, 5, -1 },
+ { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7, -11, -3, -8, 17, -4,
+ 34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7 },
+ { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38,
+ 15, -1, 16, -11, 5, 8, 4, -10, 3, -10, -17, 5, 3, 3, 3, 1 },
+ { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1,
+ 2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33 },
+ { -5, 2, -3, -7, 2, -8, -4, 10, 17, -18, -7, 4, -4, -7, -6, -6,
+ -5, 5, -12, 2, 0, 6, 8, -2, 1, 4, -11, 2, 1, 8, 31, 19 },
+ { 6, 9, 16, -6, -6, -1, -2, -3, -11, -2, 7, 7, 17, 3, 4, 10,
+ 2, 5, -13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6 },
+ { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10,
+ -16, 12, 1, -6, 3, 8, -1, 10, -13, -6, -12, -23, 12, -3, 30, 14 },
+ { -2, -15, 0, 8, 3, -19, 5, -3, 2, 3, 13, 7, 14, -3, -10, 0,
+ 8, 5, -6, -16, -8, -8, 14, 2, -1, 1, -9, -11, 11, -5, 27, 9 },
+ { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4, -15, 1, 9, 0,
+ 8, 4, 1, -17, 11, -2, -19, -1, -6, -8, 3, -12, 3, -17, 33, -10 },
+ { -3, -1, 2, 7, 7, -2, 9, 8, -18, -1, -13, -10, -3, -3, 11, 8,
+ -2, -12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10 },
+ { -3, -10, 8, -1, -5, -11, 7, -5, 3, 6, 1, 4, -16, 10, 5, -4,
+ -2, -10, -1, 13, 6, -5, -7, 12, 7, -3, -17, 1, 12, -4, 29, 8 },
+ { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2,
+ -2, -8, -6, -11, 14, -13, 27, 3, -2, -12, 5, -16, 2, -26, 20, 15 },
+ { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1,
+ 0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8, -25, -8, -4, 34, 23 },
+ { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1,
+ 0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68, -16 },
+ { 10, 0, -8, 14, -6, 1, -12, 0, 0, -3, -5, -11, -6, 12, 9, -10,
+ -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4 },
+ { -12, 13, -5, 7, -11, -2, -1, 1, -4, -14, -21, 3, -3, -3, -4, -7,
+ -9, -4, 3, -17, -2, -13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10 },
+ { -10, 6, 5, 6, 4, -7, 10, 0, -28, -3, 0, -11, -1, -5, 16, -10,
+ -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5, -10, 7, -9, 20, 4 },
+ { 1, -7, -2, -7, 4, -3, -2, -7, -1, -14, 6, -16, 4, -5, -4, -6,
+ -5, 0, -2, 2, -6, 9, -5, 4, -18, 8, -10, 8, 15, 0, 32, 1 },
+ { -5, 7, -3, 7, 15, -4, 0, -16, 9, 5, -5, 5, 4, -3, -12, -9,
+ -18, 10, 2, 2, -3, 7, 3, -1, 6, -9, -10, 3, 15, -4, 35, -7 },
+ { -1, -10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1, -14, -11, 3,
+ -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14 },
+ { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1,
+ -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4, -12, 21, -39, 24, -2 },
+ { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2, -11, -8, -1, 4, 2, 2,
+ -4, -10, 12, -5, -11, 1, -15, -34, -11, -7, -11, -1, 7, -14, 38, -1 },
+ { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11, -15, 20, -1,
+ -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11, -12, 27, -4 },
+ { 0, 8, -4, 3, -11, 6, -11, 2, 3, 0, 5, -8, -7, -6, -9, -21,
+ 4, -11, -1, -16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3 },
+ { 1, 3, 4, 11, -11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4,
+ 0, 4, -8, 13, -6, -13, -1, -5, -1, 4, 0, 0, 9, -22, 24, 18 },
+ { -7, 3, 10, -13, -6, 6, -6, 6, 22, 1, 0, -14, 2, 3, 7, -1,
+ 8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4 },
+ { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2,
+ 5, 2, -11, 4, 0, -1, 12, 0, -3, -13, 15, 8, -6, -27, 34, 0 },
+ { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1,
+ 3, -6, -7, -6, -5, 4, -19, -6, -8, -34, -4, -8, 10, -7, 23, 10 },
+ { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7,
+ -6, 1, -12, -12, -1, -16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15 },
+ { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1, -11, 6, -5, 0, 2, -6,
+ -3, -6, 4, -1, 5, -5, -12, -6, 7, -5, 9, 3, 6, -7, 29, 1 },
+ { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5,
+ -1, 0, 4, 2, 11, 6, 2, -3, 13, -9, -19, 18, -15, -10, 36, 21 },
+ { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0,
+ -2, 0, -2, 6, -19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28, -10 },
+ { -5, 1, -3, -7, -12, -4, 1, 1, -1, 13, -10, -1, -9, -5, -13, 6,
+ 13, 3, -4, 2, 3, 11, 2, 6, -25, -16, -6, 0, 14, -1, 27, 16 },
+ { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8, -12, -6, 5,
+ -6, 5, 3, -9, 1, 4, -7, -10, -9, -7, -17, -5, -15, -23, 25, 3 },
+ { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1,
+ -7, -4, -5, -16, 3, -6, 18, -13, -9, 16, -15, 8, 15, -10, 24, 5 },
+ { 1, -38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7,
+ -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1 },
+ { 1, -22, 15, 18, -2, 10, -16, -9, -8, -11, 8, 4, 0, 7, -14, -5,
+ -1, -7, 12, 17, 9, 5, -7, -4, -12, -6, 7, 0, 7, 2, -2, 1 },
+ { -11, -29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7, -14, 8,
+ -3, -11, -13, 0, -7, -23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5 },
+ { -24, -27, -11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3,
+ 4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3 },
+ { -9, -24, 11, 13, -10, -12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9,
+ -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9 },
+ { -8, -15, 7, 14, -4, -5, 2, -18, -19, -2, 2, 17, 16, 6, -10, 10,
+ -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5, -12, 3, 2 },
+ { -10, -37, 13, 1, 3, -14, 0, -20, 4, -3, 8, 2, -2, -3, -9, -5,
+ -3, -17, -1, 13, -11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4 },
+ { -2, -22, -5, 46, -8, 5, 9, -11, 8, 7, 7, -1, -1, -2, -7, 2,
+ -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6 },
+ { -16, -27, 15, 16, -4, 14, -7, -26, 2, -2, 6, 5, -3, 11, 0, 2,
+ 3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0 },
+ { -3, -22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1, -21, -4, 5,
+ 3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7 },
+ { -9, -25, 3, 18, 9, -6, -11, 0, -5, -12, 9, -8, -7, -6, -6, 22,
+ 2, -6, -3, 15, 3, 2, -2, 9, 14, -10, -7, 15, 13, 6, -2, 11 },
+ { 5, -20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2,
+ 6, 10, 9, -9, -18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1 },
+ { -8, -30, 7, 12, 10, 8, 7, -13, -16, 0, 1, -1, -6, -11, -15, 4,
+ 1, -2, 10, -15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7, -18 },
+ { -10, -32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5, -15,
+ -11, 6, 20, 4, 0, -12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1 },
+ { 1, -25, -14, 12, -11, 9, 9, -16, -24, -17, 22, -9, 11, -30, -3, -4,
+ 6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8 },
+ { -14, -26, -6, 9, 8, 17, -11, -24, -7, -4, -8, -2, 10, 2, 2, -1,
+ 2, 13, 12, -7, 4, -6, -10, 6, 6, -13, -11, -7, -16, 0, -2, 5 },
+ { -4, -30, -13, 12, 16, -6, 12, -16, -13, 5, 15, -2, -2, -10, -7, 7,
+ 11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4 },
+ { -4, -21, 20, 22, 2, 20, -8, 1, -12, -5, -9, 4, -10, -17, -3, -8,
+ -3, 3, -12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5 },
+ { -12, -20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17, -13, -2, -10,
+ -17, -1, -18, 2, 0, 14, -6, 1, 0, 3, 2, -10, 1, -5, -2, 5 },
+ { 16, -37, -1, 26, -2, -14, 1, -5, -14, 2, 2, 3, 6, 1, 1, 4,
+ 0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0 },
+ { -9, -24, -12, 5, 5, 3, -17, -14, 4, 3, 2, -4, 10, -22, -8, -3,
+ 6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5 },
+ { -14, -33, -2, 20, -13, -10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8,
+ 0, -2, 10, 7, -2, -13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7 },
+ { -10, -23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15, -14,
+ 13, 14, 2, 5, -13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5 },
+ { -13, -25, -10, 13, -17, -24, -7, -13, -6, -10, -8, 2, 0, -13, -10, -4,
+ -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2 },
+ { -12, -23, 1, 18, -11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2,
+ -2, 11, -13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1 },
+ { -5, -18, 16, 22, 2, 0, 8, -6, -9, -7, 10, -16, 23, 10, -11, -1,
+ 7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4 },
+ { -3, -26, 14, 11, 2, -9, 17, -2, -1, -5, -16, -9, -5, 10, -13, 1,
+ 6, 12, 10, 11, 0, 0, -3, -14, 6, -2, 0, 4, -5, -1, -7, -1 },
+ { -10, -33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2, -10, -5,
+ -6, 12, -11, 5, -10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16, -17 },
+ { -14, -37, 7, 7, -2, 5, -8, -11, 2, -13, 4, -19, 1, 8, 8, 4,
+ -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2 },
+ { -6, -30, 18, 17, 1, -22, -3, 4, -7, -10, 7, 0, -8, 8, -1, 4,
+ 2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5 },
+ { -17, -18, -3, 22, -8, 1, 9, -2, -17, 20, -5, -5, -12, -5, 4, -5,
+ -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3 },
+ { -9, -23, 3, 10, 4, 4, -3, -2, -2, -2, 1, -22, 11, 0, -2, 5,
+ -2, 14, -9, -11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6 },
+ { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1,
+ -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5, -69, -19 },
+ { -3, -5, -8, -12, 4, -3, -19, -11, -5, 0, -14, 7, 18, -6, 7, 22,
+ 8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3, -26, -11 },
+ { -1, -6, 4, -4, -5, -16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3,
+ -4, -33, -4, 4, -7, 0, 1, 6, -11, -2, -13, -2, -18, 20, -25, -16 },
+ { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11, -10, 4, -10, 7, 16, 2,
+ 16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0, -33, -2 },
+ { -3, -15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4,
+ 12, 13, -13, -14, 10, -6, 9, 22, -27, 23, -1, 5, -24, 2, -30, 5 },
+ { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1,
+ 1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4, -37, 9 },
+ { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7, -10, -10, -1, -4, 11, -3,
+ 7, -6, 4, -12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3, -40, 13 },
+ { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1,
+ 0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1, -32, -7 },
+ { -16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15, -13, -11, 11, 9, 4,
+ 3, -8, -10, 12, 12, 0, 0, -16, -9, 13, 2, 9, 4, -13, -33, 3 },
+ { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2, -11, -1, -15, -11, -1, 1,
+ 11, -3, -2, 24, -4, -6, -25, -10, -15, -8, 0, 0, -5, 4, -30, 2 },
+ { 10, -3, -6, 1, -9, -5, 6, 9, -10, -3, 8, -1, 4, -1, 11, -11,
+ 3, 9, 11, -3, 6, -17, 5, -8, -33, 9, -13, 19, -2, 9, -25, 2 },
+ { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2,
+ 0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0, -15, 12, -63, 27 },
+ { -2, 14, 9, -1, 3, 0, 1, 1, -19, 15, 3, 4, 0, -10, 1, -5,
+ 3, 0, -5, -10, 2, -16, -4, 8, -12, -6, 7, -5, -10, -1, -33, -4 },
+ { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1, -12, 3, 8,
+ -10, 6, -1, 1, 13, -5, -5, 2, -4, 13, -18, -10, -7, -9, -33, 10 },
+ { -6, -3, -12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2,
+ 1, 8, -10, 7, -1, -3, 3, 0, 13, 1, 6, 7, -16, -7, -39, 8 },
+ { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2,
+ -3, 13, -11, 1, 7, 5, 19, -5, -3, -15, -1, 7, -1, 6, -33, 8 },
+ { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6,
+ -2, 1, 7, 0, 1, 1, -5, 2, -2, 0, -13, -2, -31, -14, -39, -12 },
+ { -10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7,
+ 18, -8, -2, -19, -7, -7, -12, -14, -11, -1, -9, -13, -7, -12, -31, -9 },
+ { -3, -16, 10, 9, 1, -10, -12, 2, -2, 2, 7, -3, -3, 1, -4, -5,
+ -9, 5, 7, 3, -1, 4, -11, -8, 4, 13, -10, 13, 10, -4, -36, 1 },
+ { -7, -12, 4, -20, -7, -7, 2, 11, -1, -2, 3, -12, 1, 0, -6, -7,
+ 6, 4, 13, 3, -3, 4, 3, -6, -12, 5, -5, -22, -13, -8, -37, -6 },
+ { -7, 5, 3, 5, 7, 9, -14, -3, 10, 17, -1, 1, -12, 5, -6, 0,
+ -4, -9, 0, -11, -14, 3, 13, 6, -25, -8, -12, 4, -10, 18, -30, -1 },
+ { -10, 6, -10, 6, 6, 1, -10, 0, -7, 5, -2, 17, -18, -4, 0, -3,
+ -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0, -32, -11 },
+ { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4,
+ -6, 0, 2, -3, -1, 5, 10, 0, 12, -10, -18, -3, -1, 14, -33, 2 },
+ { 4, -8, -18, -4, -5, -11, 4, -10, -4, 9, 13, -12, 1, -6, 1, 2,
+ 4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0, -30, 1 },
+ { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3,
+ -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2, -33, -8 },
+ { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8,
+ 7, -11, -4, 6, -10, 7, -1, -1, -2, -1, 16, 32, -7, 20, -33, -6 },
+ { -18, 2, 6, 13, 9, 9, -1, 3, -17, 24, -2, -6, 28, 8, -2, 6,
+ 3, -10, -34, -16, -13, -4, -15, -11, -12, -3, -10, 4, -8, 4, -31, -4 },
+ { -11, 0, 18, 2, -16, -9, -13, -2, -2, -12, -3, -22, 30, 0, 8, 3,
+ 9, -4, -16, 1, 0, -11, 15, -2, -4, 6, -5, 6, 1, 2, -25, -12 },
+ { 14, -1, 5, 7, 3, -15, -8, 1, 5, -2, 12, 13, 11, -25, 3, 1,
+ 0, -2, -4, -16, -23, 0, -5, -17, 7, 5, -9, 6, -5, 2, -32, -7 },
+ { 3, -1, 6, 14, 2, -12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2,
+ 4, 5, -2, 8, 8, -6, 0, 10, -20, -1, 3, -1, 8, 23, -33, -5 },
+ { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1,
+ 8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1, -12, 0, -34, 18 },
+ { -17, 13, 0, 1, 9, -4, -11, 0, 7, 0, -10, -4, -1, 6, -6, 4,
+ 1, 6, -9, 3, -5, -6, -11, 2, -4, 14, 23, -3, 2, 5, -30, 12 },
+ { -14, 5, -27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5,
+ 8, -10, 48, -11, 12, 33, 6, 8, -15, 20, -2, -5, 32, 5, -19, 10 },
+ { -16, -4, -12, -7, -2, 0, 8, -6, -20, -18, 16, -3, 0, 31, -2, 11,
+ 2, -9, 49, -19, -12, -23, 10, 26, 16, -2, 4, -21, -14, 13, -11, -9 },
+ { -5, -9, -1, 3, -5, -21, 2, 10, 0, 0, 10, -21, -7, 7, -26, -9,
+ 22, 32, 58, 11, -3, 11, -5, -8, -13, 6, -5, -9, 1, 10, 14, -8 },
+ { 7, 7, 10, 3, -2, -1, -11, -11, -6, -43, -3, 14, -19, -18, 19, 18,
+ -32, 10, 45, -6, 6, 21, -20, -12, 2, 4, 6, 6, -4, 3, 3, 1 },
+ { 21, 22, -3, -2, -11, -6, -1, -2, 8, 8, 32, -21, 7, 28, -4, -6,
+ -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4, -17, 27, 6 },
+ { 13, 7, 2, -6, -12, 2, -10, -5, -17, 11, 4, 17, -12, -2, 5, -17,
+ 37, -16, 48, -14, -18, 29, 8, 24, 11, -5, -9, 11, -1, 1, -13, -3 },
+ { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6,
+ 2, 10, 54, -25, 7, 54, -5, -6, -1, -15, 9, 13, -24, -15, -12, 3 },
+ { 21, 5, 8, 3, -3, -4, -2, -4, 3, -11, -5, -8, 9, 16, 8, -9,
+ -10, -3, 46, -46, 2, 1, -10, 10, 17, 11, -20, -36, 10, 14, 0, -5 },
+ { 7, -13, -6, -9, -24, 45, 2, 8, 8, 0, 17, 20, 12, -24, 1, -7,
+ -15, -3, 46, -13, -2, 20, 1, -13, -11, -13, 2, 15, 1, 10, -1, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1,
+ -16, -9, 31, -69, -34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4,
+ -5, -20, 18, -82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1,
+ 15, -5, 62, -36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0 },
+ { 3, -19, 19, -20, 13, -4, -11, 8, 8, -16, 10, 1, -14, 30, 1, -33,
+ 10, -11, 45, -30, 3, -4, -3, -13, 7, 12, 3, -22, 3, -2, -4, -2 },
+ { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1,
+ 11, 8, 70, 48, -10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 2, -1, 80, 2, -15, -36, -10, -5, -2, 8, -2, 2, 0, 0, 0, 0 },
+ { 10, 8, -8, -8, -24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12, -10,
+ -2, -13, 35, -43, 44, 15, -10, -25, 4, 10, -3, -5, -5, 7, -1, 3 },
+ { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1,
+ -18, 9, 49, -72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1 },
+ { -1, 4, -3, 10, 19, 4, 3, 20, 6, -24, 6, 9, 8, 15, 18, 18,
+ -36, 19, 57, -11, 4, -3, 8, 7, 2, -3, -2, -9, -15, -2, 12, -4 },
+ { 20, 3, 11, -9, -4, 22, 42, -25, 1, 5, -10, -19, 0, 9, -16, 5,
+ 2, 10, 44, -29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1 },
+ { -7, 16, -11, 12, 6, 33, -15, 14, -23, 2, -26, 8, 2, 10, 0, -5,
+ 8, -8, 38, -38, -4, 5, 5, 5, 1, 22, -15, 7, 6, 0, 4, 28 },
+ { -1, -12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18,
+ 4, 1, 27, -39, 31, 17, 2, 2, 22, -23, 13, 16, 1, -7, -4, -5 },
+ { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0, -14, 0,
+ -7, -11, 49, -22, -4, 19, 17, -39, 4, -29, 10, 2, 36, -4, 23, -1 },
+ { -2, -2, -2, -2, 1, 15, -5, -7, -16, -8, -19, 16, -3, -20, 36, -9,
+ -3, 20, 39, -20, 0, 2, 27, -16, 10, 10, -14, -22, -16, -3, 13, -8 },
+ { 5, -9, 6, -25, 7, 37, 13, -10, -5, 3, -5, 7, 18, -22, -7, 9,
+ -5, -4, 50, -11, -4, -5, -5, 8, -4, -2, -4, -27, 14, 20, 7, -9 },
+ { 0, -14, -10, -27, -14, -17, -6, 26, 10, 2, 14, -12, -5, 0, 8, 9,
+ 0, -28, 55, -7, -12, -7, 4, -10, 10, 7, -12, 11, 3, 5, 9, -8 },
+ { 2, 23, 4, -2, -1, -20, -2, 14, 10, -9, -9, -24, 10, 0, 11, -12,
+ 12, 11, 49, -25, -2, 29, 7, -13, 21, -10, 11, -17, 3, 1, -8, 5 },
+ { 3, 0, -14, -6, 18, -2, 17, -9, -19, 9, -5, 9, 14, 6, 19, -3,
+ 27, 1, 41, -21, 20, -15, 33, 0, 26, 14, 7, 10, 3, 20, -3, -12 },
+ { -1, 16, 15, -8, 3, -8, -8, 21, -5, -16, -29, 4, 1, -6, -4, -28,
+ 2, 31, 37, -26, -2, 13, 24, 8, -9, -6, -29, 10, 7, 2, 7, 8 },
+ { -10, -10, 11, 13, -32, 2, 16, 9, 14, 23, -15, -13, 24, 13, 4, -27,
+ 14, 12, 31, -18, 17, 23, -2, -7, -14, 9, -17, -6, -10, 20, 9, 6 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1,
+ 4, -7, 64, -50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1,
+ 6, -2, 50, -35, -7, 43, 7, -7, -5, -26, 24, 21, 3, -15, 5, 6 },
+ { -8, 21, -19, 33, -8, 22, -11, 17, 3, 0, 0, -2, 1, -3, 6, -1,
+ 10, -8, 4, -11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4 },
+ { -7, 5, -20, 9, -22, 3, -14, 1, 6, 13, 23, -2, -4, -7, 2, 0,
+ 11, 4, 6, 3, -7, -11, -7, 4, 5, 5, -12, 8, 2, 4, 7, -3 },
+ { -7, 6, -4, 20, -20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3,
+ -9, -4, 1, 2, 5, 2, 1, -9, -2, -17, -4, 6, -10, 7, -7, -6 },
+ { -9, 18, -17, 12, -24, 1, -1, 4, 14, 9, 4, 3, 2, 8, -12, -14,
+ 4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8 },
+ { -25, 2, -11, 6, -5, 24, -28, -5, 8, 12, -2, 6, 8, -3, 8, -9,
+ -1, -5, -1, -5, 6, -1, -1, -1, -4, 8, -12, -2, -13, 7, 2, 1 },
+ { -14, 14, -18, 20, -10, 12, -2, 9, 1, 0, 12, -2, 15, -10, 26, -17,
+ 16, -11, 10, -10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1 },
+ { -18, 12, -18, 21, -6, 12, -6, 13, -25, 18, 1, 11, -9, -5, 0, 10,
+ -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8 },
+ { -4, 16, 1, 18, -30, 9, 1, 6, -8, 13, 13, -12, -6, -1, 13, 7,
+ 6, 2, -15, -3, 5, 5, 1, -6, 1, -5, 0, 2, -16, 0, 3, -4 },
+ { -21, 1, -2, 6, -43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3,
+ 0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2 },
+ { -23, 10, 4, 7, -32, -11, -18, 2, -2, -7, -6, -3, -3, -12, 19, 3,
+ -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8, -15, -11, 2, 10 },
+ { -8, 2, -13, 2, -29, 24, -20, 19, 1, 10, -4, 10, 1, 2, -9, 11,
+ -1, -2, 9, -5, 19, -7, 16, -9, -2, -18, 11, 1, 1, 0, 7, -3 },
+ { -6, 3, 4, 13, -26, 10, -10, 28, -7, 28, 1, 7, 0, -14, 5, 7,
+ 4, -4, 3, -2, 3, 3, -11, 7, 6, 4, 0, -1, 2, -1, -3, 2 },
+ { -6, 16, -31, 13, -10, 17, -6, 4, -14, 4, 4, -1, -10, 12, -5, 1,
+ -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7, -20, 7, 4, 11, -5 },
+ { -19, 3, -17, 14, -12, 16, -22, 18, 14, 8, -2, 4, 10, 12, -14, 4,
+ -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1 },
+ { -9, -7, -11, 24, -36, -9, -11, 5, 7, -12, -13, 18, -2, 20, 1, -4,
+ -1, -10, 15, -6, 14, 1, 0, 2, 1, 2, -9, -16, -11, 7, 13, 0 },
+ { -24, 24, -18, 18, -22, 14, -11, 13, -12, 11, -10, 11, -7, 11, -5, -4,
+ -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6 },
+ { -6, 18, -22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15,
+ -6, -18, 0, -33, -9, -12, -1, 6, 5, 2, 5, 5, -5, -17, -3, -3 },
+ { 1, 11, -16, 9, -18, 11, -4, 18, 20, 26, -10, 8, 1, -11, 8, -4,
+ 0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1 },
+ { -10, 6, -1, 18, -17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7,
+ -12, -1, -7, -6, -1, 8, 3, -15, 8, 9, 3, -7, 4, -1, 1, -1 },
+ { -14, 6, -16, 22, 2, 5, 0, 5, -18, 11, 6, -3, 22, -20, -9, -3,
+ 6, -6, -7, -15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2 },
+ { -21, 5, -19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3, -22, -13, -6,
+ -1, -3, -2, -14, 6, -3, 1, -8, -7, -5, -6, 11, -3, -10, -5, 2 },
+ { -1, 9, -12, 15, -6, 6, -19, 14, -9, 11, 3, 12, -17, -3, 8, -4,
+ -3, -4, 1, -5, 4, 5, -7, -15, -7, 15, -6, -5, 1, -5, -3, 1 },
+ { -12, 20, -15, 20, -14, 3, -14, 9, -6, 33, -13, 6, -2, 8, -6, 7,
+ -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2 },
+ { -7, 12, -18, 12, -18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3,
+ 6, -12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4 },
+ { -18, 12, -10, 11, -22, 0, -15, 5, -2, 2, -3, 6, -4, -4, -3, -15,
+ -2, -3, 21, 6, -12, -11, 19, 3, 3, -14, 7, 0, -11, -22, -10, 0 },
+ { -15, 2, -30, 15, -17, 13, -16, 8, -7, 10, -8, 2, 11, 3, 10, -7,
+ 7, -22, 12, -10, 3, -12, 6, -10, 12, -10, 7, -8, 5, 2, 9, 1 },
+ { -9, 11, -14, 6, -10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1,
+ -1, 4, 2, -20, -18, -1, -14, 3, -1, 4, -7, 10, 1, 11, 4, -4 },
+ { -22, 8, -30, 13, -21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4, -13,
+ -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0 },
+ { -6, -4, -35, 16, -13, 15, -11, 14, -7, 9, -1, 11, 7, 0, 13, 10,
+ -1, 8, 1, 1, -2, 8, -1, 2, 2, 3, -10, -1, 7, -13, -3, -7 },
+ { -15, 7, -16, 14, -18, 17, -6, 14, 3, 4, 7, -3, 10, -22, 5, -15,
+ 4, -4, -11, 15, -15, 11, -11, 20, 1, 0, 2, 1, 11, -3, 11, -7 },
+ { -12, 3, 5, 16, -37, -1, 15, 15, -15, 10, 3, -10, 1, 15, 7, -15,
+ -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5 },
+ { -16, 26, -4, 14, -22, 26, 6, -3, -8, 4, 21, 6, 16, -4, -11, 7,
+ -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1 },
+ { -7, -10, 4, 3, 2, -4, -12, -10, -4, -5, 16, 19, -16, 1, 2, -9,
+ -10, 0, 9, 7, -8, 3, 12, 8, -6, -11, -13, -1, -3, -20, 6, -5 },
+ { -14, -17, 3, -5, 14, -12, -12, 8, -6, -25, 21, 21, 10, -8, -12, 4,
+ 10, -4, 3, -9, 11, 9, 0, 4, 2, -15, 1, -14, 4, 1, 0, -4 },
+ { -4, -9, -3, -1, 6, 3, -6, 6, -10, -4, 14, 8, 2, -3, -12, -19,
+ 0, 11, -20, 1, 6, -2, -27, -6, 10, -17, -14, -17, -9, 8, -8, 3 },
+ { -12, -13, 16, -4, -2, 12, -7, -11, 2, -13, 3, 7, -16, -18, -1, -12,
+ -2, 1, -12, -9, -2, -6, 2, 9, -22, -3, -4, -14, -7, 7, -1, 2 },
+ { -7, -8, -8, 15, 15, 18, 15, 16, -4, -37, 11, 15, -12, -1, -3, 3,
+ 6, 6, 0, -5, -3, -5, 9, 1, 1, -11, -1, -8, -6, 2, 3, 0 },
+ { -6, 7, -5, -12, 13, 10, -18, -4, -3, -21, 6, 16, -15, -7, -12, -9,
+ 1, -12, -1, 10, -2, -1, -3, 4, -4, 1, -16, -1, 12, -9, 5, 9 },
+ { -14, -5, 9, 3, 4, 26, -28, 3, -6, -24, 4, 5, 3, 13, 5, -1,
+ 3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0 },
+ { -4, 2, -10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7,
+ 5, 14, 9, -1, 0, -12, 4, -4, -10, 1, -3, 3, -2, -2, -6, -1 },
+ { -10, 8, -15, -10, 19, 17, -8, 0, -3, -7, 7, 5, -13, -1, 7, -7,
+ 1, 13, -12, -13, 17, -12, 1, 26, -18, -3, -5, -6, 4, 5, 8, 1 },
+ { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5,
+ 4, -1, -11, -8, -4, 0, -13, 2, -47, -23, -8, -11, -4, 4, -2, -3 },
+ { -18, -4, 4, 5, -1, 17, -12, -8, 1, -12, 7, 20, -12, 3, -2, -11,
+ 16, 12, -6, 1, -13, -16, -6, -3, -3, -5, 4, -12, -5, -9, 10, 1 },
+ { -11, 0, 4, 7, 7, 8, 3, -1, 3, -19, 32, 8, -19, -8, 2, 4,
+ -12, 15, -16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8 },
+ { 3, -1, 4, -2, 14, 32, -9, -23, -10, -12, 22, 15, -1, -2, 10, 0,
+ 4, 6, -8, 4, -15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1 },
+ { -17, -12, 6, -8, 16, 13, -20, -8, -1, -16, 10, 21, -19, 11, -9, -5,
+ 7, 18, -6, 7, -7, -18, 13, 2, -2, 8, -12, -9, 2, 4, -5, 16 },
+ { 4, 0, 17, -11, 12, 7, -12, 5, -1, -25, 30, -8, -7, -6, -4, -7,
+ 9, 8, 7, 3, 3, -16, 8, 0, -2, -2, -18, -3, -4, -5, 1, 4 },
+ { -3, -6, 6, -16, 17, 6, -3, 2, -9, -17, 12, 11, 11, 2, -20, 8,
+ 1, 1, 0, 2, -2, -6, -21, -13, -9, -15, -1, -8, -6, -8, 0, -2 },
+ { -11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26, -10, -3, 4, 0,
+ 2, 2, -4, 4, -2, -12, 12, 10, -11, 0, -10, -16, 3, 0, 0, -10 },
+ { -5, -16, 10, -6, 27, 13, -3, 4, -2, -13, 15, 5, 2, 5, 3, -4,
+ 13, 12, -11, -7, 0, 1, 11, 12, 2, 13, -15, -8, 9, -2, 3, 8 },
+ { -5, -8, 4, 3, 9, 3, -11, 10, 14, -25, 14, 8, -2, 5, -12, -21,
+ 2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1, -16, 2, 8 },
+ { -1, 5, 1, -11, 5, 9, -7, 8, -13, -12, 4, 12, -4, 1, -1, -1,
+ 27, 29, 10, 15, 2, -6, -3, 4, -21, 10, -9, -11, -6, -1, -9, -3 },
+ { -6, -3, -1, -6, 11, -5, 0, -2, -5, -31, 11, 3, -1, 5, -3, 4,
+ 5, 7, -10, 5, -10, -13, 4, 12, -15, -2, 2, -7, 1, -9, -3, -10 },
+ { -3, -7, 17, -8, -5, 36, 8, -7, -8, -20, 12, 8, 1, -1, 3, 0,
+ 1, 4, -10, 3, 1, 4, -2, -3, -2, -3, -10, 4, -1, -7, 3, 2 },
+ { -13, -3, -5, 9, 22, 6, -23, 3, -10, -7, 17, 17, 18, -14, -8, -8,
+ 2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0, -12, -3 },
+ { -3, -10, -15, -3, 9, 3, -23, -9, -13, -18, 12, 13, -2, 0, 1, 8,
+ -1, 2, -7, -12, -5, 14, 2, 1, -22, 6, -10, -8, -9, 28, -7, -14 },
+ { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2,
+ 2, 1, -10, -2, -2, -22, -2, -7, -10, -5, -11, -27, -12, -16, 4, -7 },
+ { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15, -10, -4, -2, 2,
+ -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1 },
+ { 10, -1, 0, 5, 21, 7, -14, 6, -3, -16, 15, 17, -16, 13, 3, -6,
+ -4, 6, -12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4 },
+ { -6, -2, -8, -11, 15, 10, 0, 8, -6, -15, 33, 8, -2, 18, -15, -11,
+ 5, -1, 0, 15, -15, -4, -4, -1, 10, 7, -13, 4, -4, 0, 8, 3 },
+ { -7, -2, 0, -2, 0, -2, -4, -5, -14, -16, 12, 38, 7, 12, 6, -4,
+ 0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1 },
+ { -8, -4, 18, 1, 14, 5, -12, -3, 20, -17, 5, 19, -11, -8, 11, -3,
+ 3, 9, -7, -8, 9, -17, 2, 15, -10, -11, 5, -5, 7, 15, -6, -2 },
+ { -7, 2, 38, 5, 19, 16, -5, 4, -13, -20, 0, 4, -4, 6, 4, 2,
+ -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0 },
+ { -11, -12, 8, -15, -3, 14, -7, -22, -11, 2, 22, 14, -19, 2, -19, -6,
+ 1, 3, -18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1 },
+ { 8, 7, 25, -21, 12, -6, -5, -4, -10, 6, 0, 10, 1, -12, 18, -5,
+ -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0 },
+ { 9, 10, 32, -15, 8, 2, 11, -7, -18, -8, 2, -6, -9, -16, -3, 3,
+ -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3, -11, 1, 5, 0, 0 },
+ { 14, 0, 23, -25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0,
+ 3, 2, 3, -10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2 },
+ { 12, 0, 25, -18, -5, -4, 13, -10, 3, -6, 7, 21, 0, -16, 3, -10,
+ -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4 },
+ { 31, 15, 27, -20, 10, -7, 15, -10, 9, -8, 4, -5, 3, -3, 5, 6,
+ 11, -2, -12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2 },
+ { 12, -4, 13, -23, 12, -6, 2, 4, -3, 13, 6, -7, 5, -19, -7, 18,
+ 1, -7, 7, 1, 16, -7, 3, 0, 3, 0, -12, 8, -11, 9, 4, 7 },
+ { 29, 1, 3, -22, -5, 6, 0, 12, -14, 11, 1, 6, -3, 4, 6, -2,
+ 4, -13, 12, 1, 1, 3, -11, 9, -10, -1, -7, 16, -11, -1, 3, 9 },
+ { 4, 4, 36, -23, -5, -8, -15, 1, -6, 3, 13, -1, -5, -7, 4, 9,
+ 2, -11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2 },
+ { 19, 10, 6, -17, 2, -4, -2, -4, -3, 13, 2, 2, -13, -7, -3, -11,
+ 9, -6, 1, -9, -5, 4, -5, -9, -18, -7, -11, 9, 4, -11, 8, 4 },
+ { 16, -3, 9, -16, 18, -2, -12, -16, -11, 11, -18, 16, -13, 6, 2, 8,
+ 3, 8, -4, -16, 10, -11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3 },
+ { 14, 15, 3, -23, -5, 7, -8, -6, 2, 17, 2, 12, -8, -12, 13, -1,
+ -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3 },
+ { 32, 5, -10, -47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4,
+ 6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4 },
+ { 20, 8, 10, -21, -7, -9, -16, 12, 1, 4, 6, -5, 9, -11, -7, 4,
+ -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5 },
+ { 38, 3, 23, -25, -6, -18, 3, -10, -8, 6, -10, 1, -10, 2, 2, 0,
+ -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0 },
+ { 20, 5, 16, -22, 24, -18, 2, -12, -14, -7, -3, 10, 2, 7, -10, 2,
+ -8, 1, 8, -1, 4, 1, 4, -2, 5, -9, -18, -8, -13, 5, -11, 10 },
+ { 14, 8, -12, -16, 9, -11, -3, -6, -25, -7, 6, 5, -7, -16, 10, 2,
+ -7, -1, -9, -3, 16, 4, 3, 3, -3, -3, -15, 13, -3, 4, 13, -7 },
+ { 16, -9, 19, -23, 7, -19, -3, -5, -15, 11, -21, 21, -16, 18, -1, 6,
+ 10, -10, 18, -14, 16, -15, 6, -5, -9, 5, -17, 13, -10, 13, 0, 10 },
+ { 8, -4, 4, -24, 8, -21, -18, 9, -11, 4, -6, 17, 5, -9, -2, -2,
+ 2, 15, -2, -3, -2, 1, 7, -13, 15, -10, -8, -11, 3, 3, -1, -1 },
+ { 14, 17, 6, -32, 5, -17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9,
+ -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2 },
+ { 24, 6, 22, -12, 8, 3, -14, 4, -7, 8, 6, 5, 6, 1, 6, -12,
+ 15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3 },
+ { 17, 12, 3, -23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17,
+ 11, 0, -2, -11, 7, 4, 0, -27, -7, 1, 2, -8, 9, 7, 5, 3 },
+ { 12, 10, 12, -10, -4, 5, -1, 2, -24, 5, -8, 2, 6, -17, 19, 5,
+ 12, -2, 16, -7, -6, -14, 4, 1, -3, 13, -16, 5, -1, 4, 1, 1 },
+ { 31, 9, 11, -17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4,
+ -5, -8, 1, 4, 15, -6, -28, 1, 8, 3, -6, 5, 17, -2, 2, -4 },
+ { 11, 19, 16, -26, 0, -7, -7, 2, -13, -15, -12, 9, -3, 27, 8, 4,
+ -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1 },
+ { 10, 18, 16, -32, 19, -9, -4, -3, -7, 8, 8, -3, -11, -2, -6, -16,
+ 13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6 },
+ { 9, 4, 19, -33, 4, 7, -12, 36, -3, -1, 8, -2, 2, -8, -9, -4,
+ -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2 },
+ { 25, 7, 15, -12, 2, -24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6,
+ 3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0 },
+ { 19, 6, 8, -20, 9, -9, 5, -4, -13, 7, 11, -3, 5, -13, -9, 6,
+ -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1 },
+ { 15, 6, 19, -23, -3, -9, 3, 16, -6, -4, 6, -5, -10, 1, 16, -14,
+ 2, 0, 2, -13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3 },
+ { 14, 4, 16, -20, 1, 12, 0, 6, -3, 9, 4, 16, 10, -16, 5, 7,
+ 5, -4, -4, -18, -3, -11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7 },
+ { 22, 3, -1, -30, 18, -3, -9, 9, -2, 11, -16, -2, -14, 12, 0, 4,
+ -5, 4, -1, 3, -20, 12, 4, -10, -2, -2, -12, -12, 10, 6, 11, -3 },
+ { 15, 7, 2, -21, 5, 4, 9, -9, -33, 7, 7, 3, -6, -14, -8, 10,
+ 12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8 },
+ { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14, -15, 2, -7, -31, -3,
+ 14, 0, 14, -15, -1, -4, -15, 10, 1, -3, 1, 2, 5, 2, -8, 1 },
+ { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1, -19, 0, -11, 18,
+ 11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9 },
+ { -9, 1, -5, 0, 0, -15, 8, 4, 8, 3, 8, 12, -13, -2, -39, -2,
+ 4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8 },
+ { -9, 6, 6, -8, 12, -12, 23, -18, 4, -15, -5, 2, -20, 13, -7, 7,
+ 7, -12, 14, -12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6 },
+ { -18, 13, 4, 3, -10, -30, -10, -6, -14, 1, -7, -4, -35, 5, -25, 11,
+ 9, 8, 19, -4, -7, -3, -18, -8, 1, 5, 10, -4, -14, -9, 3, -4 },
+ { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7, -16, -17, -20, 11,
+ -6, -14, 1, 4, 19, 2, -8, 6, -15, 3, 6, -5, -14, 3, 7, 2 },
+ { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16, -14, -2, -9, -4,
+ 13, -2, 18, 14, 14, 19, -13, 5, -10, 2, -3, 3, 5, 5, 1, -1 },
+ { -1, -5, -6, -2, -11, -7, 5, -4, 5, -1, 0, 3, -3, 2, -19, 18,
+ 16, 4, 14, -22, -2, -11, -22, 1, -1, 11, 1, 2, 11, -10, 7, -12 },
+ { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9, -24, 23, 1, 20,
+ 14, -11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11 },
+ { -1, -1, 1, 7, -3, -4, 8, -16, 15, -1, -7, 9, -22, -11, -11, 10,
+ 16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7, -14, -7, 4 },
+ { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5, -22, 17,
+ 7, -11, 15, -5, 1, 3, -19, 0, -15, -3, 16, 5, 5, -7, -11, 12 },
+ { -2, -1, 13, 2, 4, -24, 37, -5, -2, -6, 12, 7, -2, -23, -4, 9,
+ 2, -3, 3, 2, 3, 3, -14, 11, 0, -4, -2, -2, 3, 10, -10, 4 },
+ { 2, 9, 8, -6, -28, 14, 28, -11, 18, -11, 0, 2, -2, 4, -12, 3,
+ 6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9 },
+ { -7, 14, 5, -10, -3, 7, 4, -5, 7, -8, -7, 4, -12, 14, -16, 25,
+ 3, 0, 1, -5, 12, -10, 0, -10, 0, 12, 12, 17, 12, 10, -1, 0 },
+ { -4, -2, 5, -2, -17, -3, 5, -5, 7, -17, 1, 5, -4, 4, -20, 0,
+ 11, -15, 13, -8, 10, 1, 1, 5, -12, 9, -8, 0, 6, -1, -11, 4 },
+ { -3, 12, 13, -15, -7, -7, 0, 5, 33, 3, 3, -6, -13, -7, -15, 10,
+ 3, 3, 3, -5, 2, 7, -1, 0, -12, 2, 11, -6, -9, 0, 5, 11 },
+ { -8, 5, 10, -7, -14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21,
+ 8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0 },
+ { -8, 8, -3, -8, 8, -11, 16, -16, 17, 0, 8, 16, -17, 10, -16, 10,
+ -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16 },
+ { -6, 0, 6, 1, -8, -8, 8, -7, -5, -10, -11, 8, -19, 6, -7, 13,
+ 5, -3, 4, -8, 7, -1, -18, 9, 0, -5, 6, 26, 3, 8, 2, 4 },
+ { -2, -2, 23, -2, -20, 2, 7, -7, -6, -15, 3, 9, -19, -2, -10, 7,
+ -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8 },
+ { -6, 12, 10, -10, -7, 4, 17, 11, -6, 1, 12, 11, -18, 8, -12, 4,
+ 1, 13, 6, -13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4 },
+ { 7, 1, 7, -17, -8, 8, -1, -7, 5, -6, 4, -3, -16, 9, -24, 18,
+ -3, 10, 13, -11, -6, -11, -4, 10, 0, 11, 8, 2, 6, -5, -11, 4 },
+ { -4, 1, -5, -10, 0, -3, 9, -2, 4, -1, 1, 5, -41, -10, -7, 4,
+ -3, 3, 1, 0, -12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5 },
+ { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0, -17, -3, -1, 11,
+ 4, 1, 27, -12, 0, -14, 2, -15, -3, -9, 0, -7, -3, 15, -8, 6 },
+ { -6, 4, 9, 2, 4, 3, 7, -10, 28, 1, -2, 48, 7, 0, -10, 10,
+ 1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5 },
+ { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39, -14, -12, 5, -19, 21,
+ 7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7 },
+ { 4, 2, -29, 12, 5, -3, 16, -6, 15, -13, -4, -1, -13, 22, -16, 17,
+ 16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7, -13 },
+ { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4, -13, -12, 16,
+ 23, -4, -12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15 },
+ { -6, 4, -15, -9, -1, -19, 12, -30, -17, -4, 1, -13, -13, 4, -3, 26,
+ 5, -25, 11, -14, -6, -13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13 },
+ { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2, -11, 4,
+ 32, 15, 15, -47, -8, 3, -12, 4, -5, 4, -1, 0, -5, 5, 1, -7 },
+ { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51,
+ 4, -5, 4, -14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2 },
+ { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3, -11, -8, -12, 8,
+ 11, 5, 19, 3, -24, 19, -14, 11, -5, -18, -8, -12, -5, -4, -1, 4 },
+ { 16, 9, 10, 14, -18, -2, -18, -27, 10, -5, 12, 14, 4, 0, -2, -6,
+ -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7, -16, -3, -6, 6, 9 },
+ { 7, 15, -9, 10, -19, 4, -5, -37, -2, -4, 8, 2, 4, -1, 1, 9,
+ -5, -5, -12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4 },
+ { 13, 17, 3, 9, -7, -7, -15, -17, -8, -13, -4, -8, 19, 2, 16, 25,
+ 7, 15, 2, 16, -5, -6, -10, -9, -7, -6, -2, -7, 7, 2, 4, 5 },
+ { 24, 7, 9, 8, -13, -2, 0, -4, 1, -13, 3, 6, 7, 10, -4, 15,
+ 5, 7, -4, 5, -5, 3, 13, -7, 5, 15, -11, -2, 7, 5, 8, 6 },
+ { 17, 6, -15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8,
+ -15, 10, -9, 7, -1, -11, 2, -8, -4, 3, 4, -10, 4, 4, 11, 1 },
+ { 21, 12, -3, 6, -8, 8, -11, -8, -5, -5, 3, 7, -1, -5, 12, 15,
+ -10, -11, 3, 15, 8, 4, 2, -15, 0, 14, 1, -8, -1, 3, 10, -7 },
+ { 16, 12, 5, 13, -6, 15, -23, 0, -17, -9, 0, 4, -9, 13, 6, 18,
+ 0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0 },
+ { 14, 16, -1, 12, -15, -9, -6, -20, 4, 6, 8, 9, 3, 1, -9, -4,
+ -1, -11, 9, 11, -12, 1, -14, -7, 2, -8, 11, 9, -4, 10, 4, -16 },
+ { 13, 10, 3, 7, 0, -8, -33, -6, 4, -4, 19, -2, 14, 6, 5, 7,
+ 6, -3, -1, -10, -10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3 },
+ { 11, 10, 25, 18, -1, -6, -21, -21, -11, -16, 6, 5, 14, 4, 8, 7,
+ 0, -10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9 },
+ { 15, 9, 5, 22, -17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3,
+ -2, 6, 1, 17, 8, -14, 7, -3, 12, 9, 1, 0, 1, -5, 17, -18 },
+ { 25, 19, -17, 12, -4, -10, 1, -13, -19, -7, -3, 9, 6, -2, 3, 1,
+ 4, -2, -11, -14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1 },
+ { 20, 8, -3, -10, -24, 3, -6, -2, 0, -12, 14, 6, 7, 11, 4, 7,
+ -12, -5, -8, -10, 5, -1, -4, 4, 16, 7, -14, 6, -1, -2, -7, -11 },
+ { 16, 18, 17, 1, -15, -6, -5, -3, -1, -19, 8, -2, 2, 8, 12, -19,
+ -12, 8, 0, -3, -1, -1, 4, -14, 9, -1, -12, -1, -7, 10, -3, 5 },
+ { 18, 12, -7, 7, 0, -3, -13, 0, -1, -4, 9, -2, 6, -1, 0, 1,
+ 15, -21, 1, -8, 25, -19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1 },
+ { 13, 16, -4, 9, -2, 2, -1, -19, -7, -4, 18, -6, 14, 18, -5, 4,
+ -6, -3, -19, -14, -1, -12, 10, 6, 7, 17, -12, -13, -10, -4, 5, 4 },
+ { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14, -11, -7, 2, -3, -3,
+ -2, -3, -13, 12, 16, 1, -5, -9, -10, -11, -2, 3, -7, 5, 11, -7 },
+ { 7, 17, -16, -2, -14, -28, -7, -8, 15, -10, 7, 15, 8, 17, 13, -1,
+ 4, -7, -12, -11, 0, 0, 2, 3, -3, 7, -6, 6, 1, -16, 1, -2 },
+ { 23, 11, -9, 15, -23, -4, -6, -4, 2, -9, -7, 9, -8, 3, -13, -4,
+ 8, 18, -6, -2, 1, -5, 6, -14, -5, -2, -6, -5, -3, -2, 4, -5 },
+ { 12, 13, 18, 18, -35, 2, 7, -17, 3, -11, 6, 9, -3, -2, 10, -4,
+ 3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1 },
+ { 19, 11, 1, 20, -14, 4, -9, -13, -2, 11, 0, 17, -1, -1, -1, -1,
+ -5, -8, 0, 5, -1, -8, 5, -1, 3, 2, -12, 21, -2, -24, 5, 7 },
+ { 15, 15, -15, 17, -14, -22, 3, -4, -11, -3, -7, 1, 18, 10, 1, 10,
+ -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4 },
+ { 45, 13, 8, 17, -5, 2, -16, 2, 8, -2, 8, -15, 4, 5, -1, 7,
+ -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5 },
+ { 1, 18, -8, 18, -12, -10, 3, 4, -22, -12, 20, 8, -3, 9, 2, 10,
+ -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3, -18 },
+ { 9, 10, -5, 9, -35, -21, -18, -16, -1, -12, -6, -7, -15, -19, 12, 4,
+ 4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4 },
+ { 31, 8, -17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3,
+ -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0 },
+ { 18, 4, -8, 7, -8, -15, -1, -16, 12, 18, 3, 19, 2, 4, 8, 8,
+ 0, -5, -8, -12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6 },
+ { 27, 15, -17, -10, -23, -22, -1, -14, -4, -7, 20, -2, -7, 6, 15, -5,
+ 32, 4, 9, -11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 },
+ { 22, 4, -7, 2, -15, -11, -17, -10, 2, 0, 15, 11, 7, 12, -8, 6,
+ -10, -18, -6, -12, 7, 3, 22, 3, -7, 14, -5, -2, -13, -7, -1, -7 },
+ { 18, 13, 9, 24, -4, -19, -9, -11, 13, 8, 2, 4, -1, 8, 14, 10,
+ -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9 },
+ { 15, 19, -5, 1, -4, -10, -8, -27, 6, 8, 5, 10, 4, 11, 5, -5,
+ -11, 0, -11, -14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4 },
+ { 18, 1, -13, 14, -14, 9, -15, -7, 12, 1, 13, -4, -20, 12, 10, 12,
+ -12, 7, 1, -13, 10, -6, 5, -3, 4, 8, 10, -13, -3, -6, 9, -3 },
+ { 19, -14, 5, -8, -6, 2, -5, 5, -3, -1, -28, 11, 18, -6, -4, -2,
+ 11, 14, -43, -42, 9, 2, 20, -23, 6, 32, 0, 5, 0, 6, 9, 5 },
+ { 8, 11, -14, -1, 7, 12, -7, 2, -16, 2, 10, -3, -1, -7, -7, -1,
+ 1, -10, -60, -23, -18, 42, -13, 9, 18, -11, 0, 1, 0, 2, -5, 1 },
+ { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2,
+ -2, 3, -34, -15, 37, 47, 10, 20, 9, 1, 3, -21, -25, -33, -14, 8 },
+ { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5, -13, 9, 3,
+ -17, -19, -2, -79, -12, -7, -8, -6, -2, -2, -1, -1, -7, -13, 6, -1 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1,
+ 0, 3, 4, -87, 6, -11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1 },
+ { -5, 6, 2, -24, 5, -9, -7, 0, 7, 3, -3, 16, -14, -16, 0, 18,
+ 15, -9, -14, -28, -17, 53, 14, -6, -28, -1, -3, -10, -7, -14, 19, -15 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0,
+ -13, 0, -53, 3, -22, 63, 19, 16, 1, -11, 0, -3, 0, -3, 0, 1 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -1, -6, -43, -43, -2, 65, -13, -4, 9, 1, 1, 2, 1, 0, 0, 1 },
+ { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1,
+ -23, 1, -61, -55, 3, -28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0 },
+ { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4,
+ -48, -19, -52, -46, 11, -12, 5, -14, 0, -10, 0, 0, -1, -2, -1, 0 },
+ { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0,
+ 3, -7, -61, -51, -4, -21, -16, -21, -11, 14, -7, 8, 3, -5, 1, 2 },
+ { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3,
+ 56, -11, -6, -67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0 },
+ { 14, 9, -2, 14, -10, -10, 9, -5, 1, -8, -23, 30, 8, -7, 23, 8,
+ 2, 10, -1, -27, -17, 57, 22, 4, -5, 2, -12, -6, 2, -7, -4, -9 },
+ { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16,
+ -15, 29, -55, -29, -24, 29, 3, 10, 6, 13, 10, -5, 21, 11, -14, 5 },
+ { 4, 2, 26, -6, 10, 11, -23, -10, -27, -20, 3, -24, -11, -10, -13, 25,
+ -10, 5, -9, -36, -7, 43, 3, -13, 6, 13, -2, 0, 1, 3, -3, -4 },
+ { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1,
+ -12, 12, -26, -64, -15, 29, 37, -7, -3, -12, -5, 14, 8, -8, -10, -2 },
+ { 19, -4, -11, -16, 8, 14, 5, 19, 3, 22, -11, -21, -1, -6, -11, 11,
+ 10, -24, -23, -40, -8, 20, 17, 5, 13, -6, 3, 14, -20, -8, 3, 28 },
+ { 2, -12, 10, -14, -18, 26, -22, 4, -2, 5, -21, 8, 3, 1, 19, 0,
+ -12, 24, -14, -40, 15, 29, -15, 6, 15, 1, -19, 2, 4, 7, -12, -3 },
+ { 0, 17, 13, 7, -5, -11, 2, -19, 3, 38, -21, -3, -6, -4, 7, 1,
+ 1, -5, -40, -10, -2, 35, 8, 8, -10, -8, -9, 33, 4, 4, 0, -2 },
+ { -2, -12, 7, 29, -24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2,
+ -37, 15, -22, -40, -11, 33, 10, -1, 8, 10, 6, 8, 9, 0, -12, 2 },
+ { 15, -8, -9, -2, 7, -17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11,
+ -15, 14, -13, -48, 5, 18, 0, -9, -36, -11, 2, 4, 5, 5, -15, -12 },
+ { -12, 0, 3, 4, 7, -5, 5, -14, -24, -18, -6, -15, -8, -20, 1, -7,
+ -33, -28, -40, -38, -18, -10, -5, 17, -12, 4, 3, -5, 5, -13, 4, -7 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
+ 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
+ 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1,
+ -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
+ 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1,
+ 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 },
+ { -8, 2, 1, 22, -31, -6, -25, -3, -3, 1, -15, -11, -2, -3, 4, -13,
+ -9, 15, -18, 37, -7, -37, 12, -13, -11, -25, -10, -11, -22, 7, 16, 7 },
+ { 14, 10, 4, -10, -1, -5, -7, -3, 16, 13, -5, -15, 5, 11, -1, 8,
+ -27, 7, -12, 49, 17, -22, 9, -2, -9, -1, 2, -15, -1, 41, -18, -17 },
+ { -4, -9, -15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17, -19, -7,
+ 36, -9, -38, 17, 1, -48, 11, -18, -13, -2, -8, 4, -10, -5, 21, 11 },
+ { 15, -13, 4, 2, 1, -5, -2, 1, -10, 7, -1, 3, -6, 0, 11, -11,
+ 8, 20, -17, 51, -17, -41, 2, 15, 4, 8, -2, 16, -32, -1, 17, 6 },
+ { -8, 8, -18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8,
+ 30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7, -11, 2 },
+ { -8, -7, 9, -10, -13, 6, -11, -14, 13, 25, -26, 5, 2, -5, -5, 5,
+ -8, 4, 0, 33, 12, -38, -4, 6, 13, 6, 25, 34, -1, 25, -19, -5 },
+ { 18, 3, -17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8, -35, 15,
+ 24, 43, -5, 51, 5, -12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 2, 10, 24, 76, -2, -22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0 },
+ { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0,
+ 24, 13, 32, 70, 26, 5, -21, -9, -6, -15, 2, -2, 2, 4, 1, 1 },
+ { 5, -4, -11, 4, -4, 22, 10, -2, 13, -11, -4, -21, -17, 0, -7, 4,
+ 10, -34, 11, 52, 2, -46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7 },
+ { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1,
+ -8, 9, -1, 64, -13, -61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1 },
+ { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1,
+ 10, -2, -31, 79, -10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1 },
+ { 3, 12, 10, 26, -19, 10, -9, 6, -4, -15, 10, 3, -16, 6, 11, -19,
+ 3, 10, 18, 44, 5, -30, 5, -9, 21, 4, 20, 10, 14, -25, 8, -17 },
+ { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2,
+ 8, -8, 13, 69, 26, -19, -25, -17, 16, 6, -12, 22, 2, -6, 9, 5 },
+ { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
+ -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 },
+ { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
+ -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 },
+ { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
+ -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 },
+ { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
+ 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 },
+ { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
+ 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 },
+ { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
+ -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
+ 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 },
+ { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1,
+ -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 },
+ { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15,
+ -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 },
+ { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25,
+ -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 },
+ { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16,
+ 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 },
+ { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19,
+ 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 },
+ { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7,
+ -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7,
+ 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 },
+ { 16, -18, 7, -4, 31, -15, -9, -13, 20, -12, -6, 0, 12, -6, -2, 4,
+ 3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1 },
+ { 38, -5, -13, -4, 8, -15, 11, 1, 2, -4, -1, 9, 13, 4, -12, -7,
+ 0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1, -11, -2 },
+ { 47, -22, 9, -26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4,
+ 3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2 },
+ { 14, -16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7, -19, -14, -17,
+ -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1 },
+ { 29, -11, 5, -3, 4, 11, 4, -10, 1, -22, -3, -10, 5, 4, 2, 8,
+ -2, -7, -12, -12, -8, -3, -18, -2, -9, -5, -1, -3, 2, -14, -14, 7 },
+ { 28, -12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4,
+ 4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8 },
+ { 31, -18, -22, 8, 15, -5, -10, -15, 1, 10, 6, 7, 6, -8, 2, -1,
+ 12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7, -10, -2, 4, -3, -4 },
+ { 53, -30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1,
+ 0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0 },
+ { 27, -18, -3, -2, 4, -8, 3, -2, -11, 2, 10, -8, -8, -4, 0, -2,
+ 8, 0, 9, 0, -16, 11, 1, -6, 13, -3, -10, -13, -15, 25, 1, 0 },
+ { 35, -5, -1, -8, 23, 11, -14, -3, 2, -2, 8, -6, 17, -2, 7, 0,
+ -2, 10, -17, 13, -2, -2, 11, 11, -14, 2, -2, -3, -8, -1, -12, -5 },
+ { 29, -9, 7, 3, 2, -10, 0, 3, 9, 0, -3, 5, 1, -10, 10, -5,
+ 3, 6, -20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0 },
+ { 15, -16, 18, -19, 16, -15, 17, -18, 13, -16, 17, -14, 15, -9, 13, -17,
+ 9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9 },
+ { 21, -10, 7, -2, 12, -7, 13, -17, 11, -2, 20, 3, 5, -11, -6, -6,
+ -15, 0, -9, 5, -11, 7, -1, 7, 8, -10, -9, 3, -5, 9, -8, -2 },
+ { 23, -22, 15, -5, 16, -4, -3, -12, 9, 3, -1, -2, -8, 2, -2, -16,
+ 3, 4, -2, -6, -7, 12, -8, 2, -14, 2, -7, 11, -2, 6, -4, -1 },
+ { 34, -17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1, -15,
+ 6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6 },
+ { 18, -18, 2, -2, 10, 1, 18, -23, -3, -10, 0, 4, 20, -19, -3, -4,
+ 2, 8, 6, 1, -3, 1, 1, 3, 5, -1, -11, 3, -7, 5, -1, 1 },
+ { 15, -14, 2, 3, 10, -8, 12, -13, 13, -15, 6, -8, -4, -10, 14, -9,
+ 24, 2, -7, -18, 13, -11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4 },
+ { 20, -12, 13, 5, -1, -10, 15, -6, 8, -1, -3, -10, 17, 0, -6, -19,
+ 2, -1, 8, -3, -16, 0, -3, 2, -2, 0, 8, -9, 0, 1, -10, -9 },
+ { 32, 0, -9, -5, -1, 5, 13, -11, 8, 3, 11, -11, 0, -8, -2, -14,
+ 7, 10, 6, -5, 1, 10, 2, 12, -10, 4, 4, 6, 4, 0, -7, -10 },
+ { 16, -14, 10, -7, 11, -11, 11, -11, 18, -13, 8, -15, 16, -11, 13, -9,
+ 8, -7, 12, -11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3 },
+ { 24, -27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9, -11, -13, -5,
+ 10, 0, -13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3, -17, -2 },
+ { 23, -19, 15, 1, -10, -18, -12, -6, 8, -3, 12, 0, -12, -10, -4, -4,
+ 8, -10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11 },
+ { 25, -12, 4, 2, 24, -3, 3, -6, 14, 11, 0, -21, -3, -3, 1, -8,
+ 7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9 },
+ { 24, -8, -6, 7, 16, -12, 13, -1, 11, -21, 2, -6, 3, -12, 0, 9,
+ 4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4 },
+ { 25, -21, 13, 14, 13, -18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12,
+ 7, 3, 5, -5, 2, -2, 3, -10, 2, -9, -15, 6, 1, 7, -5, 1 },
+ { 23, -16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4,
+ -6, 2, 9, -1, 14, 12, -6, -1, -17, -2, -4, -9, -7, -6, -8, 3 },
+ { 50, -8, 5, 2, -11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0,
+ 6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2 },
+ { 28, -17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19, -27, 5, -12,
+ 7, -14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4 },
+ { 22, -19, -6, -6, 3, -22, 3, 5, 20, -8, -14, -5, 1, 1, 20, 2,
+ 16, 6, 3, 14, 4, 3, 5, 1, 5, -7, -10, -6, 3, -6, 1, -14 },
+ { 29, -14, -8, 13, 8, -10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11,
+ -7, 1, 2, -9, -11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1, -11 },
+ { 18, -9, 4, 1, 7, -29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8,
+ -13, 5, 4, -13, -4, 2, -5, -7, -6, 14, -10, -34, -3, 1, -3, -13 },
+ { 38, -9, 24, 8, 11, 4, -6, -11, -2, -12, 1, 1, -11, -8, -5, -2,
+ -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5 },
+ { -20, 11, -4, 24, -11, 1, 15, 4, 0, -28, -10, -1, 10, 10, -6, 5,
+ -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2 },
+ { -9, 10, -23, 27, -4, -17, 20, -6, 14, -17, 5, -1, 5, -9, -7, 5,
+ -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12 },
+ { -10, 19, 4, 9, 1, -16, 17, -2, 9, -29, -16, -11, -4, 7, -5, 4,
+ -1, -3, 3, 2, 3, -4, 5, -12, -2, 6, 5, -4, 4, 1, 4, 10 },
+ { -20, 10, -24, 14, -5, 11, 9, 0, 16, -20, 10, -5, -6, -6, -1, 2,
+ -4, 5, -16, 8, -2, 5, 5, -11, 9, -11, 4, -11, -1, -1, 4, 3 },
+ { -9, 11, 3, 19, 24, 4, 5, -14, 30, -17, -4, -2, -17, 7, 2, 3,
+ 1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3, -12, -2, 3, -3, 10 },
+ { -19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12,
+ -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4, -20, 0, 10, -9, -3 },
+ { -21, 9, 20, 12, 0, -3, 5, -9, 15, -13, 5, -5, -6, 24, 2, 9,
+ -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0 },
+ { -18, 16, 13, 15, 2, -10, 14, -11, 4, -11, 5, 12, 12, 20, 8, 30,
+ 2, 11, -9, 7, 0, -3, -16, -5, -6, 5, -4, -21, 0, 5, 6, 1 },
+ { -26, 8, -13, 9, 6, -10, 2, -11, 7, -4, 6, -19, -11, -6, -12, 16,
+ 0, 5, -7, 8, 5, 6, 17, -9, 10, -10, 5, -3, -11, 2, 4, 10 },
+ { -11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14, -27, 5, -7, -4, -5,
+ -10, 11, 1, 15, 1, 1, -6, -5, 10, -22, -7, -7, -15, 13, -4, 5 },
+ { -17, 14, -7, 13, 3, 0, 13, -6, 9, -14, -22, -1, 1, 19, 14, -3,
+ 4, -13, -13, 2, -4, 8, -2, -2, 13, -12, 13, -12, -7, -5, -3, 6 },
+ { -17, 17, -1, 33, 6, 3, 9, -16, 3, -14, -8, 6, -17, 8, 3, 13,
+ 8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13, -10, 4, -17, 0, -6 },
+ { -20, 7, 7, 21, 1, -3, 7, -3, -2, -12, 9, -7, 2, -3, 14, 1,
+ -1, -7, 12, -10, 5, -20, 11, -2, 0, -24, -17, 6, 6, -4, 3, -1 },
+ { -8, 10, 6, 7, -1, -6, 28, -6, 10, -33, 1, -20, 0, -12, 10, 1,
+ -6, 8, -3, -1, -10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4 },
+ { -17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3,
+ -2, 12, -15, 3, 4, 1, 2, -9, 0, -16, -21, 2, -4, 16, -7, 4 },
+ { -15, 20, 8, 17, 5, -14, 15, -11, 21, -11, 13, -13, 2, -15, -13, 1,
+ -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3 },
+ { -21, 8, 2, 16, -1, 2, 15, -16, 13, -12, -12, -7, -8, 2, -7, 11,
+ -8, 5, 2, -7, 16, -4, 1, -7, 3, -15, 6, -5, -8, 2, -8, 5 },
+ { -15, 17, -6, 3, -3, 3, 9, -7, 14, -23, 11, 1, -1, 4, 7, 6,
+ -1, -14, 7, 6, -8, 5, 1, -15, 10, -9, 2, -3, -1, 4, -10, -4 },
+ { -10, 18, 3, 11, 1, 4, 14, -14, 7, -4, 15, -10, 10, -11, 10, -4,
+ 5, -14, 10, 4, 15, -12, 15, -13, 20, -15, 14, -15, 8, -11, 4, -6 },
+ { -7, 23, 2, 20, 7, 8, 19, -5, 9, -16, -8, -17, -5, 1, 5, -6,
+ -8, 1, -6, -4, 10, 6, 6, 2, -11, -4, 0, 2, 4, 7, 9, -4 },
+ { -15, 20, -5, 22, 11, -8, 9, -5, 10, -13, -8, 8, 2, -2, -3, 7,
+ 6, 10, 1, 2, -5, -9, 1, 10, 16, -22, -7, 0, 7, 7, 6, 1 },
+ { -26, 19, -5, 3, 5, 25, 18, -5, 9, -14, -8, -6, -2, -6, 2, 3,
+ -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1 },
+ { -20, 14, -10, 6, -3, 7, 8, -32, -2, -7, -2, -10, 16, -12, -9, 15,
+ -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3 },
+ { -14, 16, 4, 11, -8, 1, 23, -4, 17, -13, -10, 1, 12, 9, 12, -4,
+ 7, -1, -1, 5, -8, -6, 3, 3, -6, -3, -18, 0, 18, 20, 4, -2 },
+ { -33, 19, -10, 30, 15, 2, -3, -1, -4, -14, 7, -7, -1, 7, -8, 9,
+ -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4 },
+ { -6, 20, 0, 5, 17, -10, 18, -17, 9, -16, 4, -13, -6, 2, -14, 14,
+ -28, 9, -12, 25, -4, 7, 7, -8, 6, -6, -2, -10, 2, -11, -1, 2 },
+ { -12, 14, 12, 52, -3, 5, -5, 4, 8, -13, 2, -5, -4, 2, -2, -1,
+ -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0 },
+ { -13, 6, 9, 24, 0, 8, 14, -15, 18, -9, -11, -8, 3, 15, -2, -4,
+ -9, 4, -3, 12, 14, -13, 11, -4, 2, -4, 0, -6, -6, -6, -14, -1 },
+ { -10, 28, 3, 12, 9, 3, 11, -28, 6, -11, -7, 4, 0, 7, 8, -9,
+ 0, -6, 0, -16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3, -10, 6 },
+ { -11, 14, -2, 19, -1, -1, 7, 9, -2, -27, 10, -14, 15, -4, 12, -4,
+ 2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3, -11, 5, -9, 3, -8 },
+ { -18, 7, 13, 16, -4, 3, 9, -10, 10, -10, -3, -22, -4, -12, 3, -16,
+ 0, -3, -16, 8, -11, 1, 10, -7, 15, 3, 0, -1, -13, 8, 1, 6 },
+ { -20, 10, -10, 10, 8, -1, 6, 0, 16, -12, 9, -10, -1, -5, -4, -13,
+ 13, 16, -8, 12, -2, 14, 18, 13, 0, -16, 2, -5, -5, -5, -4, 3 },
+ { -14, 5, -7, -17, 5, -13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4,
+ -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5 },
+ { -19, 3, -24, -28, -9, -7, 19, 3, 2, 19, 7, 5, -13, 8, -15, -17,
+ 3, -11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2 },
+ { -17, 18, -30, -20, -2, -3, 1, 15, -1, -11, 6, -4, 11, 11, -4, -5,
+ -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1 },
+ { -6, 1, -30, -25, -1, -8, -2, -9, -17, 16, 3, -1, -2, -9, -6, -7,
+ -3, 12, 6, -4, -10, 0, 10, -8, -6, -5, -3, -11, -4, 0, -1, -3 },
+ { -1, -1, -34, -28, 1, -10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7,
+ -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6 },
+ { -11, 14, 1, -31, -7, -24, 9, 7, 6, 5, -13, 1, -1, 3, 4, -1,
+ -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2 },
+ { -25, 8, -11, -18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4,
+ -4, 5, 6, 8, -7, 6, 1, -11, -15, -13, 9, -4, -14, 10, 12, 7 },
+ { -20, 11, -15, -25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7,
+ 16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7, -17, -6, -11, 6 },
+ { -11, 18, -5, -20, -15, -3, 9, 11, -20, 12, 5, 5, 11, -3, 7, 1,
+ 10, -6, -3, -3, 3, 3, 14, -7, 10, -17, 9, -11, -2, -6, 7, -12 },
+ { -20, 8, -14, -17, -9, -13, -3, 0, -27, -14, -3, -14, 4, 3, 6, -6,
+ 7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8, -11 },
+ { -9, 14, 2, -37, -7, 13, 6, -11, -6, 9, 18, -11, -6, 2, 12, 4,
+ -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8 },
+ { -29, 8, -1, -13, -2, 8, 23, 2, -10, 7, 13, -6, -5, 11, 13, 0,
+ -10, -13, 11, -12, -10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3 },
+ { -18, 6, -10, -55, -4, -11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6,
+ 3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1 },
+ { -14, 5, 3, -21, -8, -16, -4, -2, -11, 27, 15, -20, 3, 0, 1, 1,
+ 2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2, -11, -4, -3, 7 },
+ { -17, -1, -9, -17, -8, -18, 12, -13, -9, 13, -3, 3, 3, -3, 1, -2,
+ 0, 16, -9, 6, 12, 9, 5, 11, 2, -15, 1, -4, -16, 7, -4, -12 },
+ { -18, 8, -6, -11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15,
+ 18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2 },
+ { -10, 7, -18, -29, 3, 12, 12, 9, 11, 4, -1, -15, 1, -1, 8, -2,
+ -2, 10, -15, -1, 0, 6, 12, -6, -1, 10, -6, -3, -11, -4, 9, -6 },
+ { -14, 14, -9, -21, -12, -2, -1, -7, -5, -10, 5, -8, 0, 6, 9, -11,
+ 11, -3, -5, 3, 8, 15, -2, -4, -22, 4, -6, 12, 2, 13, 6, -7 },
+ { -12, 11, -5, -29, -25, 4, 12, -13, -11, -7, 4, 2, 2, -5, 5, 8,
+ 7, -5, -5, 6, 3, -10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6 },
+ { -15, 11, -5, -16, 0, -13, 26, -23, -6, -3, 5, -2, -2, 21, -6, -3,
+ -5, -1, 6, -1, 0, -13, 2, -3, -9, -1, -4, -3, 5, -4, 12, -16 },
+ { -9, 9, -1, -17, -3, -6, 12, 6, -18, -2, 11, -14, -6, 3, 14, -12,
+ -11, -5, 14, 2, 5, -8, -4, -11, 2, -5, 16, 6, -7, -4, 8, 13 },
+ { -13, 5, 3, -28, -14, 0, 6, 23, 5, 4, -1, -17, 1, -3, 0, 0,
+ 5, 4, 0, -18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0 },
+ { -15, 4, -13, -16, -3, -12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14,
+ 9, 16, 4, 1, -12, -3, 4, -7, -15, -7, -10, -14, -6, -8, -1, -6 },
+ { -7, 10, -5, -10, -3, -13, 16, -1, -12, 7, -3, -12, 2, 13, 13, 2,
+ 17, 15, -13, 1, -5, -2, 3, -1, 1, -3, 6, -3, -12, -16, 7, -7 },
+ { -11, -5, -12, -30, -6, -22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6,
+ -2, 0, -22, -2, -9, 2, -13, 8, 6, -8, 4, -7, -1, -6, 4, 6 },
+ { -14, 5, 1, -27, -4, 2, 1, 14, -11, -7, -8, -4, 1, 8, 0, -6,
+ -13, 11, -12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1 },
+ { -10, 10, -25, -13, -20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2,
+ 3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1 },
+ { -9, 15, -18, -17, 4, -11, 6, 7, -12, 8, -1, -11, 2, 3, 7, 16,
+ -3, -9, 7, -12, 23, 0, 6, 7, -14, -9, 8, 1, -2, 6, -2, -1 },
+ { -6, 9, -16, -26, -14, -11, 9, -6, 5, -2, 13, 17, 21, 7, 18, -19,
+ 6, -23, -2, -15, -2, 2, -10, -8, 2, 1, -2, 4, -3, -4, -5, -4 },
+ { 0, 6, -5, -28, -17, -32, 2, -10, 11, 3, -5, 9, 10, 3, 11, 11,
+ -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4 },
+ { 0, -8, -18, -34, -9, -7, -4, -11, 10, 15, 11, -1, -8, 15, 6, -13,
+ 9, 2, -4, -12, 0, -1, 19, 12, 6, 5, 0, -3, -10, -12, 3, -5 },
+ { -10, 6, -9, -17, -12, -11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2,
+ -6, 3, -12, -1, 0, 1, -5, -22, -2, -12, 0, 6, 17, 5, 5, 6 },
+ { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2, -29, 11,
+ 5, -13, -73, 24, 12, 4, -14, -10, 5, 1, 0, -11, -7, -7, 7, 3 },
+ { 10, -3, -1, -3, 4, -11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7,
+ 21, 17, -54, 47, -14, -10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2 },
+ { -12, 4, -16, -12, 5, -9, -4, 19, -7, -22, -22, -17, 3, 0, -6, 8,
+ 23, -4, -55, -28, 2, -26, 2, 1, 4, 0, -13, 6, 0, 10, -7, -11 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1,
+ 35, -1, -67, -35, -24, -24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0,
+ 41, -4, -73, -15, 18, 4, 17, 8, -1, -16, -1, -2, 1, 0, 0, 0 },
+ { -4, -4, 4, 6, -1, 2, -16, -10, -15, -10, 21, -2, -6, -2, 14, -7,
+ 10, -5, -55, 34, -12, 11, -13, -2, 2, 28, -26, 0, 7, 4, 21, -7 },
+ { 2, 1, 15, -22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6, -15, -7,
+ 23, 10, -60, 8, -4, 29, -22, 2, -13, 9, -10, 12, -1, -3, 4, 7 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5,
+ -21, -11, -60, -27, -17, -39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3 },
+ { 2, -5, 9, -17, -1, 2, -3, -6, 8, 12, 7, -6, -33, -11, -14, -40,
+ 10, 36, -46, 0, -19, 5, 0, -10, 3, 12, -6, -8, 6, -12, -7, 1 },
+ { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0,
+ 4, -2, -87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1 },
+ { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
+ 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 },
+ { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
+ -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 },
+ { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
+ -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 },
+ { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
+ 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 },
+ { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
+ -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
+ 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 },
+ { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
+ 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 },
+ { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
+ -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 },
+ { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
+ 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
+ -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
+ -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1,
+ 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 },
+ { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4,
+ -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 },
+ { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20,
+ -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 },
+ { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9,
+ 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 },
+ { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8,
+ -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5,
+ 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 },
+ { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3,
+ 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 },
+ { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11,
+ -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 },
+ { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16,
+ 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
+ -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0,
+ -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5,
+ 0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1 },
+ { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7,
+ -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4, -12, -11 },
+ { 15, 24, -14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5,
+ 9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3 },
+ { 9, 36, -9, -8, 7, 7, 4, 3, -1, -16, -2, 7, -5, -6, 6, 12,
+ -11, -12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6 },
+ { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2, -10, -5, 2,
+ -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0 },
+ { 16, 27, -1, 0, -14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1,
+ -1, -19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6, -14, 14, -13, -15 },
+ { 12, 23, -14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7,
+ -3, 0, 2, 8, -13, 7, 13, -6, -4, 6, -13, -16, 14, 11, -7, 5 },
+ { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3, -12, 20, 8, 9,
+ 8, 23, 8, -13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1 },
+ { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4,
+ -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2 },
+ { 24, 21, 1, -11, -10, 17, -14, 14, 6, -1, -6, -1, 0, -13, -1, -12,
+ -2, -5, 6, -4, -12, 14, 5, -2, -8, -8, 15, -7, -30, -12, 4, 0 },
+ { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10, -28, 10, -17,
+ -8, 1, 2, -7, -1, -6, -15, -1, 4, 5, -7, 9, 0, -5, -4, 4 },
+ { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12, -11, 7, 11, 13, 2,
+ 0, 5, 9, -10, 16, 3, -3, 5, -9, -23, 2, -2, -1, 5, 2, 11 },
+ { 35, 24, -20, 2, 4, -1, 5, 14, -10, -9, 8, -7, 0, 5, -7, -7,
+ 11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4 },
+ { 9, 35, -1, 2, -1, -19, -3, 12, -1, 8, 8, -13, -1, -2, 2, 5,
+ -8, -1, 13, -2, 11, 1, 0, -10, 0, -3, -7, 2, 1, -12, 3, 12 },
+ { 20, 27, -12, -12, 7, 4, -1, -13, -1, -9, 2, 13, -11, 5, 7, -9,
+ 9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9 },
+ { 8, 37, -20, -5, 0, -21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2,
+ 0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2 },
+ { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3, -17, 10, 5,
+ 5, -6, -6, 6, -10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4 },
+ { 14, 29, -20, -4, -3, 1, -5, -1, 2, 12, -10, -3, 4, -18, 4, 14,
+ -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2, -14, -3, 4, -4, -7 },
+ { 23, 23, -23, -11, 27, 4, 4, -1, 7, 0, -5, 9, 2, -11, 3, 7,
+ -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2 },
+ { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0, -12, 9, -1, 0,
+ -17, -9, 30, -5, -15, -16, -13, 0, 10, -11, -7, -3, -1, 0, -11, -2 },
+ { 12, 32, -4, -5, 10, 19, -10, 4, -12, 5, -6, 9, -12, -6, -6, -8,
+ 4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4 },
+ { 46, 42, -3, -14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1,
+ 1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2 },
+ { 9, 33, -13, 4, -11, 3, -8, 22, 12, -2, 4, 0, -16, 5, 4, -1,
+ 7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2 },
+ { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1,
+ 8, 7, -6, -13, -10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1, -16 },
+ { 9, 28, -11, -10, 9, -10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8,
+ -7, 2, -15, -23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15 },
+ { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16,
+ 0, 0, -7, -2, -13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1 },
+ { 11, 37, 7, -23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8,
+ -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2 },
+ { 21, 33, 7, 20, 21, -10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4,
+ 10, 2, -2, -2, 0, -10, -6, -2, 0, -5, 3, -11, 3, -9, -3, 1 },
+ { 6, 30, -15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6,
+ 8, 2, -2, 4, -2, 5, 11, -21, 3, -10, 16, -11, 24, 10, 14, -6 },
+ { 15, 36, -3, -9, -20, 12, 0, -7, -18, -4, -8, -9, 9, -7, -3, -1,
+ 2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1 },
+ { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3,
+ 3, -19, 1, 5, 4, -2, -6, -5, -10, -11, -8, -2, 2, -5, -8, -7 },
+ { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10, -11, -4, -13, -12, -6, -4,
+ 0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7 },
+ { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6, -13, -14, 8, -1, 1, 2,
+ -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1 },
+ { 0, 6, 0, 0, 4, 13, -7, -16, -6, 15, -14, -21, -9, -10, -10, -6,
+ -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6, -10, -7, -18, 1, 4 },
+ { -1, 3, 10, 1, -1, 15, 4, -7, -16, 3, 0, -22, 10, 2, -3, -2,
+ 13, 5, -8, 16, -5, 4, 0, -11, -10, -22, 0, -4, -17, 5, 2, 1 },
+ { 12, 8, -4, -9, 14, 40, -21, 0, 1, -15, -10, -12, 12, 6, -10, 2,
+ 8, 6, -12, -10, -11, 1, 0, -11, 2, 1, 13, 0, 6, 3, 8, 4 },
+ { -10, 3, 5, -4, -3, 3, 0, -9, 2, 8, -22, -23, 17, 8, -17, -3,
+ 14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1, -10, 0, -2 },
+ { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2, -16, -15, 12, 21, -7, -4,
+ 7, -7, -11, -15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9 },
+ { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13, -14, -20, -4, 11, 8, -4,
+ -1, 2, 0, -7, 5, -17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14 },
+ { -2, 6, 2, 8, -2, 5, -4, -2, -10, 3, -45, -30, -3, -3, -12, -4,
+ -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1 },
+ { -3, 14, -16, -10, 10, 0, -2, -40, -9, 12, 2, -19, 15, -4, 4, 3,
+ 3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0 },
+ { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21, -10, -26, 7, 2, -9, -7,
+ -3, -16, 8, 5, 5, -6, 10, 4, -14, -6, 5, 3, -2, -2, -4, 1 },
+ { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13, -16, -18, 20, 6, -5, 0,
+ -3, 2, 8, 4, -19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7, -11 },
+ { 2, 5, 16, -4, 19, 15, 4, 0, -11, 7, -10, -10, -16, 18, -11, -12,
+ -9, -4, 7, -4, -4, -17, 1, 1, -8, -3, -3, 5, -2, -6, -11, -5 },
+ { 2, 12, 0, -9, -10, 14, 6, 2, -3, 2, -12, -28, 12, 1, -1, 2,
+ 0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3, -12, 4, -17, -5 },
+ { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6, -24, 23, -9, -15, 13,
+ -7, -9, -15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9, -10 },
+ { 1, 5, 11, 3, 6, 12, -3, 8, -21, 5, -7, -20, 12, -2, -9, -3,
+ 17, -7, -8, -9, -14, 3, -13, 18, -8, 9, 2, -8, 4, -8, -5, -2 },
+ { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1, -39, -6, 13, -13, 0,
+ -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0, -13 },
+ { 2, 8, 5, -12, -13, 22, 8, -16, 11, 5, -2, -32, -2, -4, 11, 5,
+ 5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3 },
+ { 13, 9, 5, -4, 9, 18, -11, 2, -1, 15, -10, -19, -2, 14, 0, -10,
+ 1, 1, -18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9, -13, -3, -2 },
+ { -13, 11, 11, -9, -10, 13, -3, -18, 2, 10, 5, -21, 6, 15, -11, -21,
+ 3, 14, 0, -12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2 },
+ { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6, -26, 2, 12, -3, -5,
+ 12, -2, 1, 8, -7, -17, -19, 5, 10, 7, -3, 2, -3, 0, 5, 0 },
+ { 5, 0, 3, -3, -9, 5, -15, -5, -5, 17, -5, -31, 0, 13, 13, 5,
+ -1, -6, -14, 7, -8, 9, -14, -2, -16, -4, -4, -6, 6, -6, -10, 6 },
+ { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8, -32, -1, -4, 0, 3,
+ -10, 7, 10, -10, 4, -1, 6, 2, -16, -9, 4, 3, 13, -23, -3, -4 },
+ { 4, 11, -4, -9, 4, 11, -12, -12, -12, 6, 1, -28, -3, 14, 18, -2,
+ -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2, -13 },
+ { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36, -10, -22, 3, 23, -3, -10,
+ -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1 },
+ { -1, 1, 13, 1, -6, -1, -6, -9, -18, 17, -5, -37, -1, -1, -6, -4,
+ 1, -6, -15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5 },
+ { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7, -16, -5, 23, -14, -13,
+ 8, -15, 11, 10, -11, -13, -33, -5, -2, 1, 6, 8, 0, -13, -9, 5 },
+ { 11, 7, -2, -8, 9, 11, 25, -14, 7, 3, -1, -33, 14, 8, -6, -19,
+ 3, 3, 2, -1, -3, -1, -2, -10, -3, 1, 2, 1, 4, 2, -3, 4 },
+ { -2, 8, 4, -2, 9, 13, -4, -2, -15, -3, 19, -37, 9, 25, -9, 2,
+ -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3 },
+ { 10, 13, -1, -15, 4, 6, -18, -4, 25, 1, -23, -17, 15, 13, -8, -8,
+ 7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2 },
+ { 1, 3, 9, -5, 27, 15, -9, -31, -1, 23, -2, -9, 1, 8, -1, -7,
+ -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3 },
+ { -8, 7, 3, -6, 8, 3, -11, -2, 36, 14, 1, -30, 6, 10, -12, -6,
+ -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8 },
+ { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6, -25, 11, -6, -9, -11,
+ -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8 },
+ { -22, -21, -9, -19, -5, -7, -12, -15, -8, 9, -19, 14, -7, -4, 5, -8,
+ -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3 },
+ { -32, -13, 3, -24, 3, -8, 4, 1, -10, 14, -15, 0, 4, 6, -1, 6,
+ 7, -1, 6, 4, -3, -17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4 },
+ { -32, -11, 7, -8, -12, 13, -5, -22, -4, 12, -16, 2, 0, 4, 0, 1,
+ 0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4 },
+ { -44, -33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1,
+ 1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1 },
+ { -30, -18, -24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7,
+ 5, 7, -11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6 },
+ { -22, -20, -13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1,
+ 2, -3, 6, -19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2 },
+ { -27, -8, -1, 3, -1, -11, 24, 4, -1, 1, -8, 8, 5, -11, 15, -3,
+ -15, -1, -1, -13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6 },
+ { -33, -16, -1, -8, 10, -23, 6, 13, -1, -3, -9, 0, 5, -7, -5, -12,
+ -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4 },
+ { -22, -17, 11, -3, 3, 1, -1, -5, 17, 2, -15, -2, 10, -9, 6, 14,
+ -16, -12, 20, -1, -7, 6, -3, -12, 1, 10, -10, -1, 7, -3, -1, 10 },
+ { -28, -13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10, -10, -3, 7, 2,
+ 4, 19, -1, -1, 10, 5, -8, 1, 11, -15, -4, -3, -5, 4, -13, 3 },
+ { -22, -13, 42, -20, 5, -13, 7, -11, 1, 1, -1, 1, 6, 3, 6, -11,
+ 3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4 },
+ { -26, -15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3, -10, 7, -8, -12,
+ -5, 12, -9, 3, -2, -3, 18, 1, -12, -15, -4, 5, -3, 0, 12, 7 },
+ { -26, -16, 5, 6, 14, -3, 15, 6, 1, -7, -13, 16, -15, 5, 11, -2,
+ 9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12 },
+ { -31, -17, -8, -30, 4, 14, 6, -6, 6, -11, 0, 3, -4, 0, 0, -4,
+ 0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5 },
+ { -61, -10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2,
+ -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0 },
+ { -28, -13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5,
+ -3, -2, -2, -12, -14, -9, -11, -15, -12, -5, -4, -12, 3, -3, 0, -5 },
+ { -41, 0, 12, -24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9,
+ 9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4 },
+ { -26, -19, -2, -15, 4, -14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5,
+ -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2, -10, 0 },
+ { -29, -18, 9, -4, 1, -5, -14, -12, 5, -10, -5, 4, -5, 0, -1, -1,
+ 4, -5, 7, -16, -11, 2, 7, -15, 2, -4, 6, -4, -6, 7, -3, 7 },
+ { -27, -16, 9, -14, 3, -8, 9, 0, 7, -4, -3, -7, 0, -10, -1, 2,
+ 1, -2, 15, -10, 14, 7, 6, 17, 3, -4, 3, -10, 8, -8, 3, 11 },
+ { -21, -20, -8, -8, 4, 5, -3, -2, 0, -5, 14, -10, 11, -4, 13, 0,
+ 5, -11, 19, -18, 18, 3, -5, -3, -4, -8, 11, -10, 10, 3, 4, -9 },
+ { -35, -15, 13, -12, 4, 0, -2, -4, -12, -3, -8, -24, -7, 1, 7, 8,
+ -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6 },
+ { -19, -14, 13, -10, 9, -1, 1, 3, -12, 5, -16, 7, 13, 9, 4, -4,
+ 6, -5, 4, 9, -3, 17, -4, 12, -11, -6, -5, -6, 13, 2, 7, -9 },
+ { -34, -8, -4, 1, 2, -1, 3, 6, -20, -11, 8, -1, 4, 2, -9, 4,
+ -4, -5, 16, 10, -4, 14, -13, 1, -6, 0, 2, -10, 0, -3, -3, 7 },
+ { -36, -10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15, -11,
+ 0, 2, 3, -1, 4, 0, 8, -1, 0, 18, -11, -5, 15, -5, 13, -12 },
+ { -22, -13, 14, -20, 15, 25, 16, 10, 8, -2, -10, -5, -1, -8, 11, 8,
+ -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2 },
+ { -31, -22, 7, 6, -2, 5, -20, 14, -6, 7, 0, 14, 3, -7, 3, -6,
+ -2, 1, -3, -5, 1, -10, 1, -24, 6, -2, 3, -7, 1, -7, 8, 7 },
+ { -25, -20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8,
+ 3, 5, 6, 5, -10, 10, -4, -15, -15, -2, -9, 2, 18, 1, 8, 12 },
+ { -24, -19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6,
+ -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8, -11, 8, 4, 2 },
+ { -26, -20, -12, -12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2,
+ 9, 22, 13, 4, -4, -1, -2, -14, 5, 15, -8, -5, -7, -11, -14, -6 },
+ { -21, -18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3,
+ 1, 3, -5, -2, 2, 4, 0, -1, 10, 2, -19, -8, 8, 30, -7, 8 },
+ { -25, -6, 26, 4, -8, 4, -2, 21, 5, -4, -16, 5, 13, 4, -10, -1,
+ -6, -2, 2, -10, -13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5 },
+ { 0, -1, -2, 19, -12, -48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2,
+ -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5 },
+ { -11, -8, -28, 18, 16, -24, -8, 19, 4, 8, -12, 9, -4, -2, 4, -7,
+ 6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1, -16 },
+ { -9, -5, -26, 7, -3, -37, -16, -2, 2, -7, 4, -13, 0, -4, -6, -5,
+ -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4 },
+ { 2, 9, -18, 7, 29, -24, -1, 7, 14, 10, 3, -3, -2, -5, 6, -10,
+ -6, -3, -8, 0, 5, 1, 4, 3, -12, 2, 6, 1, 3, 4, 1, -3 },
+ { -20, 2, 8, 20, -9, -24, -4, 18, 3, 11, -1, -11, 6, 9, -1, -3,
+ 1, -1, -15, 3, 15, 9, 3, 2, -13, 2, -8, 8, 1, -1, 1, -8 },
+ { -12, 5, -11, 6, 19, -26, -17, -6, 4, 14, 6, -8, 9, 5, -6, -5,
+ 2, -1, 20, 1, -11, -10, -18, 20, -7, 0, -3, 4, 2, 0, 10, 4 },
+ { -15, 1, -2, 13, -8, -21, -22, 4, 4, 3, 3, -7, -31, 4, -10, -14,
+ 0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7 },
+ { -13, -10, -9, 12, 19, -16, -3, -2, 9, 2, 11, -29, -1, 9, 4, -3,
+ 1, -10, -10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1 },
+ { -17, -1, -5, 19, 12, -9, -21, -5, 2, 12, -7, -7, -3, 8, 7, -2,
+ 6, -9, -9, 1, -4, 1, 1, 3, -14, 2, -8, 0, 10, 1, -12, -6 },
+ { -13, -5, 8, 15, 0, -20, -2, 20, 8, -8, 8, -19, 12, 10, 2, -11,
+ 0, 12, 1, -11, 0, -11, -15, 5, -11, 2, 4, -4, -11, 5, -4, -5 },
+ { 3, -11, -7, 8, 0, -17, -26, 15, 19, -7, 10, -9, -5, -5, 14, -25,
+ 0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2 },
+ { -12, 5, 5, 9, 14, -18, -19, 4, 2, 16, 14, -21, -15, -9, -1, 16,
+ 12, -11, -10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4 },
+ { -10, -5, -1, 8, 7, -23, -10, 14, 6, 11, 10, -16, -3, 16, 6, 0,
+ 0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2, -10, 3, 0 },
+ { -2, -14, 2, 16, 15, -17, -17, 6, 19, 4, -10, -15, -1, 15, 11, -14,
+ -8, 5, 8, 8, -2, -8, -11, 10, 10, -8, -14, 2, 13, 4, -2, -12 },
+ { -10, 3, 6, 4, 19, -23, -19, 1, 4, -9, -30, 3, -6, 18, 0, 2,
+ 0, -11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6 },
+ { 9, 5, -2, 21, 20, -33, -13, 7, -10, 8, 8, -15, -6, -4, 1, 5,
+ 3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3 },
+ { -9, -3, 3, 15, -3, -30, -7, -7, -25, 6, 2, -6, 1, 19, 1, -12,
+ 1, -8, -13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4 },
+ { -6, -12, -17, 25, 22, -13, -10, 9, 2, 11, -7, -16, 4, 6, 1, 0,
+ 0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0 },
+ { -1, 0, -10, 8, 8, -27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0,
+ 6, 10, 6, 4, 2, -7, 9, -18, 3, 3, 3, -10, 17, 10, 9, -6 },
+ { -3, -12, -6, 11, 20, -32, 5, 21, 3, -4, -9, 2, -10, 1, 7, -4,
+ 5, 0, 0, -1, -8, -9, -7, 4, -10, 5, 0, 2, -5, 4, 9, 1 },
+ { -5, -1, -5, 1, 2, -19, -13, 1, 6, 12, 2, -16, -17, 11, 10, 13,
+ 16, -12, -11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5, -11, 3, -14 },
+ { -19, 5, 10, 11, 2, -23, -9, 16, -2, 7, 0, -11, -7, 10, 6, -7,
+ 26, -15, -4, 8, 6, -4, 7, -9, -15, 1, 8, -4, 4, 2, -12, 16 },
+ { -11, 1, 11, -4, 1, -31, -13, -1, 8, 5, 4, -2, 0, 13, 7, -17,
+ 7, -10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4 },
+ { -3, 1, 10, -1, 0, -15, -22, 4, 40, -11, -4, -3, -14, 9, 11, -1,
+ 9, -1, -6, 6, 3, -6, 0, 0, -12, 7, -2, 0, 9, 3, 1, 3 },
+ { -1, -1, -1, 14, 8, -24, -14, -8, 5, 8, 5, -12, -17, 8, 2, 7,
+ 10, -8, 0, 4, -6, -6, -10, 8, 4, -12, 3, -9, -12, 5, 4, -3 },
+ { -5, 1, -11, 8, 9, -24, 0, 2, 2, 14, -12, -13, 1, 6, 7, 0,
+ 7, -6, 9, 26, 11, -14, 8, 10, 1, 9, 0, 11, -2, 6, 2, -10 },
+ { -13, 1, 4, 34, 19, -17, -15, 0, 3, -2, -7, -1, 0, -3, -3, -1,
+ 1, -1, -10, 8, 5, 0, -8, 4, -17, 9, -2, 0, 0, 6, 2, -3 },
+ { -6, -4, 1, 2, 2, -14, -29, 0, 9, 34, -3, -5, -14, 6, -10, -9,
+ -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3 },
+ { -4, 6, 3, 14, 14, -8, -29, 31, 11, 14, -4, -5, -6, 10, 6, -9,
+ -1, -11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4 },
+ { -4, -4, -2, 14, 6, -32, -6, -14, 14, -5, -11, 10, -18, -4, 6, -8,
+ 9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2, -10, -6, -17, 3, 17 },
+ { -16, 9, 21, 19, 4, -20, -17, 14, 9, 15, -6, -17, -1, 1, 6, -3,
+ 1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2 },
+ { -7, -5, 3, 19, 1, -20, -9, 14, 21, -7, -18, -9, 26, -7, -17, -7,
+ 12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1 },
+ { -20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8, -17, 0, 5,
+ -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1 },
+ { -35, 17, 6, 1, -9, -1, -16, 3, -20, -13, 8, 7, -4, -7, -4, -20,
+ 7, 12, -5, 5, -5, -11, 12, -1, 15, -9, -6, 16, -4, -9, -13, 4 },
+ { -21, 36, -19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2,
+ -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3 },
+ { -12, 33, -4, 1, -12, -9, 0, -13, -1, 2, -8, 4, -10, 6, -16, -7,
+ -1, -4, -10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7 },
+ { -14, 32, 5, -7, -15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7,
+ 4, -10, -10, 10, -1, 2, 0, -2, -11, 5, -3, -4, 2, 2, 7, 4 },
+ { -14, 34, 1, 20, -1, -12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7,
+ -9, -20, -7, -4, -13, 12, 1, 12, 5, -6, 2, -4, 0, -15, 1, 3 },
+ { -21, 23, 7, -8, 3, -13, -3, 0, -6, -2, -7, 6, -12, 9, -6, -2,
+ -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6, -15, 3, -5 },
+ { -27, 32, -1, -4, -2, 4, -10, 12, -3, 8, 13, 7, 0, -15, 4, -2,
+ 3, 5, 7, -4, 9, -12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6 },
+ { -17, 29, 15, 0, -1, -4, -10, 13, 12, -1, -8, -10, -10, 4, 7, -2,
+ 6, -5, -13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4 },
+ { -38, 27, 16, -15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6,
+ -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5 },
+ { -33, 40, -4, 2, 1, 0, 0, -10, -14, 0, -7, 4, -1, 3, -2, 5,
+ 7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4 },
+ { -20, 25, 12, -4, 16, -4, 2, 2, -14, -2, -3, 29, -1, 1, 3, 1,
+ 9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1 },
+ { -10, 30, 17, 3, -5, -2, 0, -5, -22, 4, 5, 5, -3, -18, -6, 10,
+ -5, -7, 2, 8, 7, -7, -11, -2, 0, -3, 3, 2, 11, -4, 4, -4 },
+ { -11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4,
+ -3, 10, 13, 14, 5, -5, 1, 1, -10, 2, 15, 4, 9, -1, -5, -3 },
+ { -17, 32, 18, -18, -3, -5, 6, 10, 1, -15, -5, 9, 8, -12, -10, -6,
+ 11, 9, -5, -8, -7, 10, 5, -10, -14, -4, -3, 1, 9, -11, 2, 1 },
+ { -13, 28, -11, -1, 2, -16, -2, 7, -24, 0, 3, 6, 3, -1, -8, -7,
+ -12, 2, 2, -20, 10, 4, 0, -13, -2, -2, 1, 8, -14, 0, 4, 1 },
+ { -14, 23, 12, 8, 8, -26, 2, -4, -14, 13, -14, 15, 3, -9, -1, -13,
+ -10, -2, -10, 6, -16, 12, 8, 0, 9, -10, -7, -4, -4, 7, -8, 8 },
+ { -20, 45, 10, -14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5,
+ -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1 },
+ { -20, 26, -4, 1, 7, 4, -8, 1, -5, -13, 2, 13, -7, -3, 6, -6,
+ 22, 0, 5, 11, -4, -11, 8, -9, 2, -2, -4, -2, 2, -13, -4, -8 },
+ { -28, 18, 17, 3, -8, -23, -16, -6, 5, -10, 14, 10, 5, -1, -8, 4,
+ -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4 },
+ { -12, 32, -6, -16, 18, 12, -16, 0, 7, 13, -4, 5, -8, -1, -3, 4,
+ 6, -2, -1, -13, 4, -1, 3, 12, -3, -10, 1, 6, 8, -11, -2, 4 },
+ { -18, 26, 2, 5, 0, -9, -17, 14, 5, 1, 7, -3, -8, -3, 11, 7,
+ -5, -12, -8, 7, 0, -7, 2, -12, -9, 13, -11, 9, 6, -11, -5, 11 },
+ { -24, 22, -15, -9, 8, 1, -7, -12, -9, 3, 11, 15, 14, -11, 12, -15,
+ -5, 7, -2, 0, -8, 3, 3, -1, 2, 11, -11, 14, -6, 13, 1, -6 },
+ { -20, 28, 18, -4, -6, -5, 12, 14, 2, 10, -13, -6, -8, -6, -13, -1,
+ -26, 22, -3, -14, 6, 0, 10, -15, -13, -9, 6, -7, 1, -5, -4, -1 },
+ { -19, 26, -8, -3, -14, -6, -9, -4, -8, 15, -8, 3, -12, -4, -2, -7,
+ -5, 3, 13, -3, -4, -25, 4, -1, 5, -12, -1, -13, 5, 2, 0, 6 },
+ { -18, 43, 14, -8, 1, -23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3,
+ -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9 },
+ { -11, 30, 10, -14, 3, 1, 10, -11, 1, -7, -4, 14, 2, 1, -9, 1,
+ -11, -2, -7, 5, -11, 1, 3, 14, 1, -16, -8, 3, -5, 7, -4, 4 },
+ { -18, 24, 6, 3, 8, 7, -22, -7, -7, 3, -8, 4, 23, 9, 3, -1,
+ 3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3 },
+ { -15, 38, -7, -1, -11, 2, -17, -24, 24, 8, 7, -4, -5, 2, 2, -7,
+ 1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3 },
+ { -14, 22, 1, -5, 9, -12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3,
+ -33, -16, -9, -1, 12, -11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4 },
+ { -14, 20, 6, 4, -10, -4, -4, -4, 1, -7, 2, 6, 8, -12, 4, 1,
+ -1, 12, 10, 3, -14, -10, -3, 18, -2, 33, -5, -17, 17, -5, 9, 7 },
+ { -12, 23, 13, 0, -11, -8, -11, 12, -5, -9, -16, 11, 6, 4, 12, -5,
+ 5, -13, 7, -12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11, -12, -3 },
+ { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6, -20, -10, 4, 26,
+ -6, 13, 4, 3, 2, -11, 5, -7, -10, 4, 9, 1, 10, -4, 11, 4 },
+ { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3,
+ -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2 },
+ { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5,
+ 7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5 },
+ { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7, -10, -8, -18,
+ 3, -2, 2, 7, -15, -11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5 },
+ { 10, -6, 8, 11, 12, 20, 22, -11, -3, 15, -3, 15, -2, -2, 0, 2,
+ 5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7 },
+ { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2,
+ 4, -9, -3, -14, -12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0 },
+ { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3,
+ -10, -2, -7, 11, -11, -10, 17, -1, 3, -15, 2, 9, -15, -10, 16, 10 },
+ { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6, -13, -1, 6, 5,
+ -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1 },
+ { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2,
+ -15, -11, -10, -4, -13, -6, -17, -13, -6, -14, 1, -10, 6, 4, -1, -1 },
+ { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3,
+ -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4 },
+ { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8, -12,
+ 9, -10, -7, 1, -1, 19, 0, 2, -8, -11, -10, 9, 6, 11, 0, 3 },
+ { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4,
+ 4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1 },
+ { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3, -10, 7, 6,
+ -8, -7, 2, -13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0 },
+ { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5, -14, 8, 0, 9,
+ 8, -10, 5, -15, -6, -9, 9, -1, 18, -16, 9, -21, -3, -13, -2, 8 },
+ { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7,
+ 4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5, -10, 8, 4, -5 },
+ { 9, 2, 16, 14, -5, 14, 1, 0, -21, 17, -1, 9, 12, -3, -3, 4,
+ -4, 14, 10, 3, 0, -10, 7, 4, 4, -11, 2, 4, -1, -3, 9, -1 },
+ { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8, -18, -11, -3,
+ -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6 },
+ { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4, -16, -2, 14, -2,
+ 1, 8, 12, 14, 3, -3, 8, 8, 12, -15, 3, -3, 3, -2, 14, 10 },
+ { 22, -3, -11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2,
+ -2, 0, -5, -27, -10, 3, -1, 5, 8, -24, -3, -11, -3, 2, 11, -1 },
+ { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14, -10, 1, -12, -10,
+ -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4 },
+ { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9, -15, 15, 6, -8,
+ -10, -13, 5, -8, -20, -13, -6, -11, -1, -3, -6, -4, -1, 0, 13, 15 },
+ { -2, -1, 9, 12, 2, 2, 13, 3, -23, 33, 15, 2, -4, -1, 3, 8,
+ 8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1 },
+ { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1, -12, 3,
+ -13, -18, 2, -11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5 },
+ { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5,
+ 5, -3, -2, -14, 0, -12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1 },
+ { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15,
+ 2, 1, 2, -10, -10, 0, 2, -1, 0, 1, -12, -1, 21, 16, 9, -7 },
+ { 11, -4, -5, 24, -7, 11, 20, 11, -15, 18, 5, -13, -15, 0, -5, 9,
+ 1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3 },
+ { 20, 0, -12, -6, 9, 31, 9, 12, 8, 27, 15, 7, -16, 5, -3, -7,
+ -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2 },
+ { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4,
+ 4, -6, 0, -4, -4, -3, 3, 6, 3, -13, -8, 5, -3, -7, 8, 5 },
+ { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1,
+ 2, 0, -15, -9, -16, -2, 8, -17, -5, -22, -19, -5, -1, -10, 1, -2 },
+ { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9,
+ 9, -11, -17, 0, -6, 16, 0, 1, 9, -24, 3, 3, -9, -3, 3, -2 },
+ { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6,
+ 5, -2, 6, -2, -4, -3, 0, -3, 13, -50, 1, -2, 2, 4, 4, 3 },
+ { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1, -15, -1, -15,
+ -11, -4, -17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12 },
+ { 1, -2, 2, -1, -10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0,
+ 1, 1, 6, 0, 11, 13, 3, 4, 0, -12, 11, -5, 19, 20, 2, 5 },
+ { 5, 3, -13, -2, 1, -12, 11, -7, -12, 7, 10, 0, 7, 0, -2, 4,
+ -6, -9, -11, -12, -23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12 },
+ { 6, -3, 2, 5, 2, 2, -2, -5, -8, -11, -4, 3, -8, -4, 5, -3,
+ -16, -4, 3, -12, -4, 3, 32, 7, 2, 8, 32, -18, -1, 12, 1, 7 },
+ { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4, -12, -1, 3, 0, 1, -18,
+ 8, 8, -14, -10, -11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6 },
+ { 3, 5, -14, 7, 14, 8, 20, -13, -16, -10, -2, 17, -7, 4, -8, -9,
+ 14, -5, 3, -4, -12, 7, 14, -10, -19, -20, 35, 8, 13, 14, -2, 9 },
+ { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2,
+ 3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14 },
+ { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6,
+ -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1 },
+ { -11, 1, -3, -3, -11, 3, -9, -25, -1, -16, 4, -8, 15, 1, -2, 7,
+ 8, 23, 2, 18, -13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4 },
+ { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1, -13, 2, 2, 10, 6, 7,
+ 18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5 },
+ { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5,
+ -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13 },
+ { 2, 4, 3, -7, 5, 8, -11, 7, -5, 9, -10, 6, 8, -10, -3, 10,
+ 1, -29, -4, -26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0 },
+ { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0,
+ 5, -1, -2, -2, -1, -4, -10, 8, 0, -6, 10, -4, 46, 12, 2, 28 },
+ { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3,
+ 1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35, -11, 13, 53, -3, -1 },
+ { -5, -2, 0, -13, -16, 5, -12, -11, 1, -30, 3, -18, -24, -8, -5, -19,
+ 1, -3, -8, 7, -7, -8, 15, -19, 4, 10, 30, 24, 6, 1, -9, 10 },
+ { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2,
+ 22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18, -12, 18, 16, 4, 16 },
+ { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6,
+ 10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11 },
+ { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2,
+ -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0 },
+ { 4, -3, -7, -5, -11, -5, -12, -10, -10, -12, -15, -12, -14, -14, 1, 1,
+ 10, -10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3 },
+ { 7, -3, -2, 4, 6, -8, 2, -3, -12, -5, -9, -8, -10, 15, -2, -4,
+ 8, 9, 7, -13, -18, 34, -5, 7, 12, 22, 16, -11, 13, 25, -15, -11 },
+ { -3, -2, 0, -4, 1, 0, -3, -13, -7, 13, 12, -7, -10, 13, 19, 6,
+ 16, 15, -12, -15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6 },
+ { 3, -5, 0, -4, 0, 4, -11, 4, -7, -3, -1, -8, 3, -2, 2, 1,
+ 11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4 },
+ { -1, -4, -9, 5, -8, -18, -4, -9, -20, -18, 7, -14, -16, 3, 8, -3,
+ 29, 11, -13, -13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5 },
+ { -3, 8, -10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8, -14, 15, -5,
+ 16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13, -11, 1 },
+ { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8, -10,
+ 0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12 },
+ { -4, -7, -31, -2, -7, -1, 5, -5, -5, -12, 4, -7, -6, 3, 15, -2,
+ 5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24 },
+ { -7, 0, -3, -6, 1, 3, -13, -6, -4, -4, -5, -9, -1, -10, -4, -8,
+ 2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6 },
+ { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4,
+ 6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20, -27, 14, 1, 2, -3 },
+ { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8,
+ -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17 },
+ { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2, -10, 0, 7, 21, -1,
+ 0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14, -20, 15, 14, 4, 15 },
+ { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9, -10, -2,
+ -5, 0, -3, -21, 9, 14, -11, 13, 29, 2, 25, 4, 22, -1, 2, -3 },
+ { 2, 12, -11, 2, 16, 9, -4, 7, 1, -10, -15, 11, -4, 3, -2, 4,
+ 4, -5, -10, 1, 4, 19, -15, 6, -4, -2, 30, -7, 11, 21, -12, 5 },
+ { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0,
+ 8, -7, -3, -2, 2, 14, 2, -3, -26, -1, 26, 22, 32, 1, -2, 6 },
+ { 1, -38, -1, -20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10,
+ 6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1, -14, -1, -9, -5, -4 },
+ { -5, -26, -7, -19, -10, -5, -11, 5, -11, -25, -8, -14, -9, -16, -8, -6,
+ -17, -14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3 },
+ { 17, -49, -3, -23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4,
+ -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0 },
+ { 4, -34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2, -16, 7, -3,
+ 8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4 },
+ { 5, -29, 13, -2, -14, 3, 1, 18, -15, 4, -8, 8, -10, 8, 2, 1,
+ -8, 15, 3, -10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6 },
+ { 13, -20, 3, -18, -17, 4, -14, 13, 28, 11, -8, -6, 16, 6, 0, 10,
+ 3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1 },
+ { 3, -27, -5, -11, -21, -11, -12, 0, -5, 7, -22, 1, 3, 5, 0, -5,
+ 8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6 },
+ { 31, -45, 0, -1, -12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3,
+ -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1 },
+ { 9, -45, 6, 5, -1, -17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8,
+ -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7 },
+ { 3, -26, -2, -12, -12, 2, -10, 16, -3, 12, 4, 5, 11, 8, -16, -17,
+ -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7 },
+ { 8, -26, 32, -7, -5, 22, 2, 14, -10, -8, -7, 3, 3, 7, 0, -5,
+ 0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6 },
+ { 4, -31, 2, -14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5, -10,
+ -2, -10, -2, -10, -3, 7, 1, 5, -8, 8, -14, -3, -15, 7, -10, -6 },
+ { 16, -27, 13, -4, -23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23, -18,
+ 7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2 },
+ { -1, -35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6, -10, 9, 6,
+ -3, -5, -6, -3, 9, 16, -16, -9, -20, 12, 3, 5, -3, 1, -9, 4 },
+ { 2, -24, 1, -12, -16, 5, -4, 3, -4, -1, -11, -11, -8, -14, 14, 10,
+ -8, 20, 8, -3, -11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7 },
+ { 9, -21, 2, -19, -7, -5, -8, 25, 3, 17, 5, -3, 9, -12, 8, 2,
+ -4, 3, 3, 1, 11, -9, -4, -3, 4, 3, -22, 6, 4, 6, 11, -5 },
+ { 16, -23, 13, -17, -21, -12, 5, 9, -20, 7, 6, -6, 0, 2, -9, 6,
+ -6, -13, -7, -1, 5, -3, 5, -7, -10, 1, 0, 8, -9, 11, 0, -8 },
+ { 10, -26, -9, -7, -19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1,
+ 6, -7, 1, -8, -11, 10, -14, 0, -16, 6, -3, 5, -1, 14, 12, 1 },
+ { 8, -27, 12, -14, -1, -1, -19, 10, -11, 21, -14, 9, -8, -3, 8, -1,
+ 12, -13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1 },
+ { 18, -20, -14, -14, -16, -3, -24, 6, -17, 2, -3, -11, 2, -3, 12, 10,
+ 10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0 },
+ { 0, -30, 9, -16, -18, 15, 12, -3, 4, -4, -5, -11, -4, -12, -10, 0,
+ 2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7 },
+ { 25, -24, -1, -6, -9, 6, -13, -2, 3, 15, -3, 11, 4, -8, -11, 2,
+ 0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1, -11, -15, -5, 0, 11 },
+ { 0, -34, -7, -11, -7, 9, -3, 19, 4, -8, 3, -11, 11, -3, -9, 12,
+ 9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5 },
+ { 6, -34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3, -26, -12, 8, -6,
+ -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1 },
+ { 3, -30, 5, 6, -10, 3, -7, 6, 3, 3, -26, -19, -3, 1, 7, 5,
+ -4, -5, 6, 10, 13, -10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5 },
+ { 4, -24, 9, -19, 2, -4, -5, 8, -3, 2, 0, -15, -1, 9, -4, 22,
+ 6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3 },
+ { 8, -27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7,
+ 5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13 },
+ { 17, -22, -15, -11, -8, 16, -14, 18, 2, -1, 14, -7, 14, -6, -6, -7,
+ -8, 17, 6, 4, 4, -7, -5, -9, -14, -6, -1, 9, -3, 1, 6, -5 },
+ { 25, -30, 2, -12, -13, 18, -18, 16, 8, -3, 10, -8, -3, -1, -6, 3,
+ -5, -7, 4, 6, 7, 1, 1, -11, -5, 6, 2, -4, 9, -1, -5, -2 },
+ { 7, -23, 7, -15, -1, -3, -1, 0, -10, 12, 2, 5, -4, 0, 4, 6,
+ -1, 5, -9, -1, -1, -7, 1, 17, 9, -17, -16, 8, 4, -14, 11, 14 },
+ { 0, -31, 7, -13, 3, -11, -7, 6, 1, -11, 8, -7, 15, -3, 16, -11,
+ -1, -15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3 },
+ { 13, -24, -2, -20, -10, 7, -3, -1, 15, 2, 6, -5, -7, -10, -20, 1,
+ -4, 14, 8, -2, 3, -13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4 },
+ { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0,
+ -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7, -31, -50 },
+ { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0, -20, -6, -3, 9,
+ -20, -22, -1, -1, 15, 9, -12, 10, -13, -20, 12, 3, 5, 6, -7, -26 },
+ { 0, 4, -2, -14, -12, 6, -13, 11, -10, 3, 22, 6, 16, -2, -5, 1,
+ -3, -11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5, -27 },
+ { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4, -15, 14, 1, 3, -10, 5,
+ 0, -2, 7, 3, -13, 6, 9, -6, 5, -14, -17, -1, 11, 14, -2, -26 },
+ { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11,
+ 9, 19, -2, 14, -8, 7, -1, 3, -3, -3, -10, -2, 12, -2, -12, -29 },
+ { -12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1,
+ 2, -2, -14, 0, -1, -5, 3, 8, -28, -26, 6, -6, 3, 8, -10, -27 },
+ { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6,
+ -1, -4, -1, -5, 8, -1, 5, -5, -15, 11, -8, -5, 14, -6, -14, -29 },
+ { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2, -10, 3, 4,
+ 3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28, -11, -31 },
+ { 1, -4, -10, -9, -4, -3, -15, -6, 1, 5, -3, -6, 5, -6, -22, 27,
+ -13, 5, 3, -7, -4, 20, -7, -12, -1, -24, -4, -13, -8, -11, -15, -21 },
+ { -6, -4, 19, -6, 2, 11, -6, 1, -3, -10, 9, -9, 12, -10, 2, 1,
+ -9, 1, 15, 7, -5, 5, -29, -35, 4, -30, 9, 9, 19, 17, 2, -17 },
+ { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2,
+ -4, -1, 12, 0, 2, -8, -6, -4, 16, -1, -14, -2, 25, -6, -15, -36 },
+ { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1,
+ -3, -13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1, -28 },
+ { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2,
+ 16, -11, 11, 0, 1, 6, 1, 18, -10, -16, -1, -4, 5, -14, -15, -20 },
+ { 1, -12, 5, 4, -7, 8, -1, -17, -2, -9, -14, -11, 6, -9, 5, -4,
+ 3, -2, 7, 18, -5, 5, 6, -1, -11, -2, -10, -3, 8, -3, -2, -32 },
+ { -12, 5, 20, -5, -6, -11, -6, -6, -13, 4, -6, 19, -8, 2, 3, -9,
+ -4, -4, -1, 9, -1, 21, -1, 7, 15, -10, -1, -3, 9, -3, 2, -24 },
+ { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8,
+ 0, -2, -6, 9, -4, 3, 2, -13, 1, -7, 23, -13, 4, -3, -15, -33 },
+ { -7, 2, -15, 11, -10, 14, 0, -11, 3, -1, 12, -4, -4, 9, 11, -13,
+ -13, -3, -14, 1, 3, 6, -5, 8, 0, 5, 5, -10, 4, 5, -6, -30 },
+ { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5,
+ -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3, -19, 37, 12, 10, -40 },
+ { -7, 2, -7, -12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5,
+ 9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2, -24 },
+ { -7, 6, 1, 3, 1, 0, 6, 0, 4, -12, -2, -2, 1, -9, 10, -2,
+ 11, -1, 21, -12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3, -29 },
+ { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2,
+ 3, -5, 2, -1, 6, -4, 0, -3, 8, -11, 19, -8, 22, -34, 13, -35 },
+ { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2, -12, -11, 18,
+ 9, -5, 1, -6, -9, 12, 1, -3, -3, -9, -14, 9, 9, 8, -6, -26 },
+ { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4,
+ 1, 1, 18, 1, 7, -10, 3, -2, 12, -1, -15, 9, 12, -14, 13, -38 },
+ { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1,
+ -7, -1, -4, 13, 7, 0, 1, 2, -1, -16, 0, -2, 1, 8, -8, -28 },
+ { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28, -18,
+ -6, 2, 15, -10, -15, -10, -2, 0, -2, -2, 4, -3, 7, 11, 5, -30 },
+ { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3,
+ -10, 4, 10, 5, 21, -4, 14, -18, 1, 3, -10, -2, 6, 14, -8, -26 },
+ { -14, -1, 2, 3, -3, 7, 1, -22, -1, -1, 0, 1, 12, -14, 3, -5,
+ 0, 10, -3, 1, -5, 12, -3, 10, -8, -22, -11, -13, -7, -10, -13, -25 },
+ { -2, -5, -4, -4, -9, -18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8,
+ 20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0, -17, -23 },
+ { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6,
+ 8, 10, -1, 1, -5, 5, -14, -2, -11, 8, 6, 25, 7, -1, 0, -43 },
+ { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2, -10,
+ -16, -9, 7, -12, 9, -8, 2, 5, -5, -10, -2, -11, -5, -1, -9, -30 },
+ { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3, -17, 13, 9,
+ 0, 7, -6, -5, 9, 1, 5, 4, -10, -18, 0, 14, 11, -4, -16, -28 },
+ { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1,
+ -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6, -70 },
+ { 7, 3, -11, -1, 12, -4, -14, 4, 4, -4, 4, -2, 2, -12, -4, 15,
+ -17, -4, -3, 6, 8, -5, 22, -22, 5, -11, 15, -4, 4, -1, -21, -1 },
+ { 10, -2, -13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10,
+ 8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8, -29, 13 },
+ { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0,
+ 9, -2, 1, -2, 26, -19, 21, -10, 4, 1, -8, 5, 22, -10, -13, 15 },
+ { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1,
+ -8, -5, -13, 13, -2, -3, -1, -9, -28, 4, 2, -11, 18, -20, -24, 9 },
+ { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5,
+ 2, -13, -12, 2, 0, 5, 18, 15, -13, -7, 13, -20, 16, -10, -19, 6 },
+ { 5, -8, -1, 5, 10, 2, -1, -10, -11, 23, 8, -5, -8, 4, -5, -4,
+ -5, -5, -11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17, -12, -22, 3 },
+ { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7,
+ -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5, -24, 13, -20, -27, 14 },
+ { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1,
+ -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24, -43, -13, 2 },
+ { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1,
+ -7, 1, -1, 10, 0, 5, -1, -24, 25, -15, 7, 2, 22, -10, -21, 0 },
+ { -5, 2, 6, -2, 13, 3, 5, -12, -11, 16, 6, 10, -5, 0, -3, 6,
+ 5, -5, -5, 10, 12, 10, 11, -7, 8, -14, 2, -15, 13, -14, -8, -3 },
+ { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5,
+ -12, 3, -3, -6, 2, -1, -5, 14, 11, -20, -21, -25, 24, -1, -10, 6 },
+ { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1,
+ -17, -18, -4, -13, 9, -1, 9, -7, -4, -8, 2, -3, 12, -31, -18, 5 },
+ { -7, -11, 6, -8, 4, -3, -12, 0, -1, -6, -3, 0, 5, 9, 7, 2,
+ 1, -8, -6, 8, 2, -5, 7, -1, 16, -10, 16, -12, 18, -1, -25, -12 },
+ { 3, -12, 1, 2, -2, -18, -8, -15, -10, -9, 2, -7, 11, -11, 2, -1,
+ -1, -1, -9, -6, 3, -14, -2, -1, 2, -13, -7, -9, 19, -5, -17, 2 },
+ { 7, 1, -8, 7, 17, -13, -10, 5, 7, 1, -6, 4, 9, -4, 0, 3,
+ 8, 1, -14, -9, 4, 7, -9, 0, 6, -5, -12, -2, 25, -2, -19, 1 },
+ { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5, -17, -4, 4, -1,
+ 0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2, -18, -2 },
+ { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2,
+ -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0, -13, 4 },
+ { 0, -13, -11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2,
+ 9, -2, -11, 15, 1, -21, 1, -1, 0, 4, -14, -4, 24, -16, -13, 1 },
+ { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9, -12, 0,
+ -1, -14, -9, -14, 0, -2, 19, 4, 6, 4, 4, -11, 8, -17, -19, -5 },
+ { -3, 1, 2, 12, -4, -18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12,
+ -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1, -25, 22, 2, -23, -5 },
+ { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2,
+ 0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3, -25, 4 },
+ { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3, -12, 12, 15, -9, -4, 2,
+ 9, -4, -12, 3, 14, 1, 7, -15, 15, 0, -6, -12, 0, -3, -20, 6 },
+ { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1, -18, -4, -6,
+ -15, -5, 11, 5, -10, -1, 2, 7, 12, -19, -7, 8, 21, -4, -15, 4 },
+ { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2, -14, -11, 6,
+ 2, 17, 8, -13, 26, -2, 5, -15, -4, -14, 12, -9, 13, -21, -23, -4 },
+ { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1,
+ -17, -22, -3, 4, 3, -2, 1, -9, 1, -6, 11, -13, 14, 0, -15, 6 },
+ { -16, -4, 17, -2, -20, -11, 11, 10, 5, -8, 16, 2, -17, -14, 11, 11,
+ -6, -11, -7, 12, 12, -10, -6, 5, 8, -4, -2, -5, 28, 3, -13, 4 },
+ { 0, -3, 3, -7, 6, 8, -12, 20, -19, 18, -11, 10, -5, 0, -9, 11,
+ 3, 0, -2, 9, -7, -5, 18, 3, -2, -16, 1, 6, 12, -7, -16, 1 },
+ { 4, 1, 5, -5, 15, 2, -8, 3, 5, -11, 15, -3, 8, -8, -1, 7,
+ 4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6, -18, 4, 0, -18, 11 },
+ { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4,
+ -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4, -37, 19, 1, -15, -4 },
+ { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4,
+ -10, 2, -6, 4, 4, 1, 27, -7, 17, -34, 5, -9, 15, -16, -7, -5 },
+ { -2, 7, 7, -2, 9, -2, -15, 11, 11, 7, 5, 1, 15, 1, -9, 31,
+ 2, -15, 2, 4, 3, 4, -1, -8, 2, -7, 6, -17, 11, -14, -11, 2 },
+ { 1, 1, -11, 9, 9, -6, -14, -11, -10, 8, -3, 11, 16, -9, -8, -13,
+ -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6, -17, 4 },
+ { 14, 5, 4, -6, -12, 10, -7, 8, 21, -8, -30, 15, -2, 1, 11, -9,
+ -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1 },
+ { -1, 2, 20, -17, -15, 3, 3, 7, 11, -17, -13, -6, -3, 18, 17, -15,
+ -4, -4, -5, 22, 14, -14, -2, -10, -7, 11, 8, -7, -3, 0, -7, 11 },
+ { 7, -11, -7, -8, -14, 22, 5, 2, 6, 13, -12, -2, 10, 3, 0, -21,
+ -4, 20, 3, 10, 21, -10, -12, 8, 11, 2, -5, 2, 1, 3, -1, 15 },
+ { -1, -2, -1, -2, -13, 8, -4, 0, 7, -2, -17, 8, 18, 5, 3, 8,
+ -8, -2, 3, -4, 14, -18, -13, 14, 15, -13, -1, -2, 4, 11, 1, 12 },
+ { 13, -6, -4, -16, -17, 16, 21, -2, 5, -11, -9, 19, 21, -17, -3, -17,
+ 3, 12, 8, -12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4 },
+ { 11, 5, 12, -20, -6, 10, 4, 12, 8, -5, -10, 15, 13, 14, 10, -15,
+ -13, 1, 6, 14, 15, -17, -13, 4, -5, 10, 7, -6, -8, -3, -4, 12 },
+ { 25, -1, 7, -5, -7, 11, 1, 17, 13, -15, -14, -4, 5, 3, 8, -3,
+ -2, 2, 0, 6, 16, -12, -6, -4, 4, -3, 7, -10, -3, -7, -13, 7 },
+ { -8, 10, -3, -13, 5, 2, 4, 9, 9, -17, -13, 2, 11, 1, 6, -4,
+ 8, -10, 4, 1, 19, -15, -4, 12, 31, 7, -5, -17, -4, 9, -2, 7 },
+ { 14, -6, -6, -6, -14, 13, 17, -5, 4, -14, -9, 7, 7, -9, 3, -16,
+ -15, 11, 11, 6, 4, -11, -19, 3, 5, 8, 13, -14, -14, 3, -4, 12 },
+ { -2, -4, 10, -4, -7, -1, 27, 5, 2, -16, -18, 4, 12, -2, -3, -2,
+ -1, 1, -8, -12, 3, -4, 8, 15, 2, 4, 9, -13, -14, 9, -7, 5 },
+ { 4, 2, -10, -5, -7, 2, 1, 4, -1, -6, -15, 6, 1, 10, 5, -10,
+ -9, -1, 13, -3, 5, -21, -11, 8, 8, 5, 27, -21, -18, -5, -1, 15 },
+ { 11, 1, -16, -8, -11, 0, 5, -8, -12, -13, -17, 22, 4, -6, -1, -18,
+ -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9, -17, -5, 4, 4, 10 },
+ { 8, -6, -19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1,
+ 2, 4, 7, 9, 16, -16, -14, 9, -4, 3, 1, 0, -2, 10, -1, -1 },
+ { 12, -8, 12, -9, 0, 25, 7, 9, 2, -31, -9, -4, 15, 4, -5, 1,
+ -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4, -10, -9, 6, 4, 5 },
+ { 14, 6, -17, -2, 17, 12, -9, 2, 0, -25, -14, 5, 20, 14, 8, -20,
+ 5, 2, -2, -3, 9, -13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1 },
+ { 8, 4, -15, -3, 10, 18, -4, 13, 8, -22, -10, 9, 19, -15, 7, -5,
+ -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11 },
+ { 4, 1, 4, -5, -10, 18, 7, 2, -4, -9, -11, 0, 32, -7, 4, -16,
+ -1, 0, 6, 3, 6, -3, -14, 16, 9, -2, 7, -1, 0, -5, 5, -3 },
+ { -3, 2, 3, -8, -6, 4, 6, 2, 4, -12, -15, 2, 8, 8, 9, -3,
+ -18, 6, 34, 11, 12, -15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3 },
+ { 18, -6, -12, -8, -1, 15, 20, -4, -1, -11, -5, 6, 6, -11, -15, -7,
+ 3, 7, 10, 2, 8, -10, -5, 8, 15, -5, 5, -17, -13, 13, 11, 7 },
+ { 8, -4, -6, -1, -14, -3, 6, -2, 1, -5, -1, 10, 10, -15, 5, 0,
+ -10, -4, -3, 7, -4, -19, -15, 27, 11, 18, 3, -19, -2, 6, 0, 12 },
+ { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7, -11, 21, 29, 1, -2, 1,
+ -4, -11, -1, 13, 11, -20, -1, 4, 4, 4, -5, 6, -13, -2, 11, 9 },
+ { 2, -7, -7, -3, -10, -1, 20, 12, 1, -19, -19, -1, 5, 4, -7, -25,
+ 14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1 },
+ { 12, -8, 3, -12, -10, 10, 13, 0, 23, -14, -18, 10, 0, 15, 3, -12,
+ -3, -5, 5, -4, 2, -14, -10, 8, 2, 9, -1, -11, -3, 5, 13, 2 },
+ { 9, -6, 7, -7, -30, 17, 6, 13, 1, -14, 0, -1, 6, -9, 8, 3,
+ -4, 0, -1, -7, -5, -13, -19, -3, -4, 4, -6, -2, -13, 1, -2, 3 },
+ { 10, 1, 3, -18, -26, 17, 4, -16, 4, -3, -13, -4, -6, -11, -4, -21,
+ 7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2 },
+ { -3, -1, 0, -2, -2, 0, -1, 3, 4, -14, -8, -9, 13, 2, 50, -23,
+ -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3 },
+ { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5,
+ 5, 4, 4, -2, 10, -8, -40, -1, 21, 8, 3, -4, -1, 13, 4, 7 },
+ { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12, -13,
+ -9, 0, 1, -12, 9, -43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2 },
+ { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7, -23, -5, 23, -17, -6, -15,
+ -8, 7, 10, -1, 7, -16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4 },
+ { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1, -45,
+ -6, -4, 4, 2, 1, -14, -10, 1, 1, 6, 2, -8, -1, -3, 3, 3 },
+ { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6,
+ 5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0 },
+ { -4, 1, -2, -1, -11, 11, 8, -3, -2, -10, 0, 4, 9, 9, -17, -17,
+ -34, -4, -5, -7, -3, -12, -3, 11, 18, 3, -2, -5, -18, -5, -3, 6 },
+ { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3, -10, 12, -18, -5,
+ -10, 12, -9, 4, -6, 2, 0, 16, -17, 15, 14, -12, -10, -2, -9, -1 },
+ { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4, -20, 1,
+ -25, 1, -8, 13, -10, 8, -19, -1, -8, 10, 6, -9, -1, 0, 12, 4 },
+ { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4,
+ -25, 13, -23, 10, 14, 15, -11, 3, -18, 4, 16, -4, 1, -10, -10, 3 },
+ { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1, -12, 14, -7, 11, -15, 6,
+ -6, 24, -4, 13, -1, 15, -13, 8, 3, 7, -5, 2, 2, 0, 3, -7 },
+ { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2, -12, 4, 0, -2, -3, 5,
+ -6, 0, -8, 9, -10, 4, -28, 12, -20, 11, -13, 7, -18, 1, -11, 1 },
+ { 1, -4, -15, 5, 0, -13, -5, 13, -11, 4, -4, -5, 5, -14, -16, 0,
+ -14, 5, -20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11 },
+ { 13, -11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5,
+ -22, 5, -10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10 },
+ { 18, -4, -13, 0, 1, -15, -1, -3, 2, 10, -1, 6, 1, -4, -20, -5,
+ -8, 6, -8, 17, -5, 5, -10, 8, -22, 6, -5, -2, 8, -17, 8, 2 },
+ { 1, -2, -9, 6, -31, -8, -8, 8, 0, 5, -9, -4, 2, 3, -12, 11,
+ -18, 10, -5, 3, -11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11 },
+ { -9, -6, 21, -8, -15, 4, -11, 12, -11, 17, -1, 2, -6, 0, -15, 13,
+ -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5, -10, -3, 0, 1 },
+ { 4, -6, 5, -10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0,
+ -4, 3, -4, 1, -12, 6, -49, 16, -10, 13, 0, -2, 8, 6, 1, 8 },
+ { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13, -14, 6,
+ -15, -6, -14, 16, 15, 1, -18, -4, -20, 20, -7, -1, -9, -2, -10, 10 },
+ { -12, 4, 0, 10, 0, 3, 8, 4, -27, -1, -2, 19, -4, 2, -13, 3,
+ 1, 9, -12, 1, -22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7 },
+ { 4, -5, 11, -6, 17, -17, 5, -4, -2, -6, 1, -5, 2, 4, -14, 6,
+ -20, 19, -20, 12, -21, 5, -14, 13, -2, 11, 4, -3, 0, -10, -4, -2 },
+ { -2, -1, -3, 8, -9, -7, -22, -3, -24, 13, -2, 10, -15, 5, -9, 4,
+ -7, 0, -5, 15, -8, 11, -13, 6, -4, 19, -8, 12, -4, 6, 9, 7 },
+ { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5, -12, 6,
+ -16, 14, -23, 10, -14, 17, -15, 16, -2, 9, -25, 9, -10, 16, 4, 9 },
+ { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3, -11, 25, -10, -28, 27,
+ -9, 7, -13, 9, -2, 4, -12, -8, -14, 6, 7, -10, 3, 3, -3, 5 },
+ { -8, -3, 1, -10, 8, -3, -9, -4, 13, 7, 2, 4, -10, 4, 3, 7,
+ -18, 2, -22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13 },
+ { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0,
+ -2, -3, 1, 2, -1, 2, -8, -1, -24, 68, -3, 8, 3, 3, -1, -1 },
+ { -15, -2, -9, -7, -1, 8, -14, 8, 3, 6, 0, -1, -8, 8, -23, 2,
+ -14, 17, -15, 8, -4, 7, -18, 0, -8, -3, -1, -4, -10, 4, -1, 4 },
+ { 8, 0, 2, -7, 0, 5, 1, 3, -11, 4, -8, 14, 3, 20, 1, 26,
+ -11, 13, -13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10 },
+ { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3,
+ -15, 7, -9, 22, -19, 8, -9, 4, -23, 13, -14, 6, -6, -14, -4, 7 },
+ { 14, -5, -8, -10, 25, 3, -23, -7, -28, 0, -1, -9, 4, 1, -13, 20,
+ -8, 10, -16, 8, 12, -13, -21, 5, -13, 11, -2, 1, 12, -7, 2, -10 },
+ { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2, -18, 7,
+ -15, 6, -3, 2, 8, 12, -30, 7, -4, 20, 2, 6, 13, -6, -4, 0 },
+ { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16, -17, 14, -13, 15, -18, 14,
+ -15, 17, -12, 14, -13, 7, -16, 13, -9, 5, -11, 10, -9, 6, -12, 13 },
+ { -10, -4, 5, 3, 1, 6, 8, -14, -5, 15, 7, 4, 8, 7, -22, 8,
+ -7, -8, -15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9 },
+ { 8, -3, 2, 3, 3, 1, -2, -1, -11, 8, -4, 0, -6, -5, -1, 13,
+ -37, 9, 1, -6, -10, -2, -10, 11, 8, 13, -3, -2, -6, 8, -4, 13 },
+ { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9, -20, 12, -19, 15, -18, 17,
+ -15, 7, -1, 20, -11, 6, -6, 3, 1, 9, 2, -14, -2, -2, 2, 1 },
+ { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9,
+ -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1 },
+ { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8,
+ -7, 4, 10, 11, -41, 27, -20, 3, -3, 8, 1, 11, -5, -8, 0, 4 },
+ { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7,
+ -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2, -21, -12, -3, -1, 2 },
+ { -4, 4, -2, -2, 6, -8, 2, 1, -10, 14, 8, 6, 5, 1, -2, 4,
+ -13, 4, 2, 5, 10, -2, -21, 32, -3, 18, 9, -6, -9, -9, 10, 2 },
+ { 9, -16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19,
+ -24, -6, -6, -5, -8, -7, 8, -7, -1, -12, 5, -3, 0, 4, 2, -3 },
+ { 10, 3, -16, -4, -1, 13, 4, 4, 1, -3, 1, -6, -14, 18, 3, 8,
+ -8, -28, -16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2 },
+ { -5, -13, -22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1,
+ -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2 },
+ { 5, -10, -18, 2, 20, 4, 13, -10, 8, -15, -11, -3, -1, 16, 10, 9,
+ -8, 6, 7, -5, 6, 11, 5, 17, -4, 7, -11, 5, -3, -6, 2, 1 },
+ { 3, -5, -19, 1, 1, -3, -2, -25, -11, -17, 0, -13, -4, 10, 10, 2,
+ -5, 4, 0, 3, -3, -5, -10, -2, 13, -22, 0, 3, -11, -5, 7, -1 },
+ { 12, -14, -29, 6, -1, 10, 7, -17, -12, 14, 3, 9, -9, 9, 7, 6,
+ -3, -13, 0, 5, 3, -1, -6, -1, 0, 2, 4, -12, -5, -1, 2, 11 },
+ { 12, -15, -7, -2, -12, 17, 20, -16, -2, -12, -6, 15, -6, 12, 11, 9,
+ 7, -6, 7, -4, -19, 6, 2, 2, 3, -11, -10, -4, -5, -3, 3, 2 },
+ { 11, -22, -6, 0, 8, 18, 3, -11, -4, -7, -15, -17, -12, 6, 16, 4,
+ -9, 4, -5, 3, 6, -16, 10, -7, -7, -3, 5, 0, 1, -15, -4, 5 },
+ { 12, -22, -16, 5, -6, 8, 12, -4, -9, -17, -11, 3, 5, 8, -17, 0,
+ 11, -4, -13, -6, 2, -1, -1, 3, 3, -11, -12, -1, 1, 1, 12, -2 },
+ { 8, -10, -33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6, -12,
+ -16, -8, 11, 8, -14, 7, 12, 11, 4, -14, -3, 6, -7, -5, -3, 3 },
+ { 0, -8, -7, 2, -4, 24, 2, -9, -11, -3, -7, 11, -12, 17, 1, -1,
+ 3, -5, -7, 12, 4, 11, 0, 3, 2, -18, -3, 4, 7, -6, 3, 15 },
+ { 10, -15, -16, -2, -4, -9, 7, -15, -6, 2, -16, 13, -8, 7, 19, -21,
+ -4, -12, -9, -3, -3, 6, 11, -3, -1, -19, 3, -7, -9, -4, 3, -6 },
+ { -5, -10, -21, 0, -3, -7, 18, -21, 15, -5, -12, -4, -13, 2, 6, -9,
+ -9, -11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3 },
+ { 15, -1, -27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9,
+ -11, -17, -2, 7, -9, 11, 10, 0, -8, 6, -16, -3, 2, -7, 3, 11 },
+ { 4, -9, -39, 19, 6, -13, 13, -5, -5, -15, -2, 9, 0, 4, 14, 6,
+ -10, -4, -5, 2, -4, -2, 5, -11, 3, 3, -2, -2, -7, 9, 7, -10 },
+ { 5, -11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1,
+ 18, -30, 4, 10, -4, -6, 2, -11, 9, -10, -8, 5, 0, 0, -7, 6 },
+ { -1, -16, -10, 11, 0, 13, 12, -4, -4, -5, -21, 12, 4, 13, 14, -7,
+ 6, -16, -13, 8, 2, 9, 15, -12, 1, -9, -22, 10, -9, 9, 9, -7 },
+ { 4, -12, -27, 1, -2, 11, 15, 3, 14, -14, -9, 0, -9, 16, 22, 10,
+ 16, -10, 5, -5, -9, 1, 1, 6, 6, -4, 2, -17, -5, -6, -15, -1 },
+ { 7, -12, -17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17,
+ -7, -13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9 },
+ { 7, -15, -15, -4, 10, 12, 3, -13, 6, 14, 9, -8, -15, 14, 23, -5,
+ -10, -5, 1, 15, -10, -7, 1, 9, 4, -13, -10, 10, 7, -3, 2, 3 },
+ { 4, -10, -14, 0, 3, 4, 0, -9, -3, -4, -11, 2, -17, 8, 2, 15,
+ 6, -12, -12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10 },
+ { -2, -18, -26, 10, -4, 10, 13, 4, -4, -16, -7, -17, -3, 5, -4, 2,
+ -15, -10, -1, -8, -7, -3, 2, 2, 8, -10, -7, 2, 2, -4, 4, -1 },
+ { 4, -19, -5, -1, -1, -6, 2, -8, 10, -16, -28, -6, 8, -1, 11, 28,
+ 2, -10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1 },
+ { -3, -6, -10, -5, 13, 18, 10, -15, -5, -3, -13, 5, 1, 2, 18, -5,
+ -10, -10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9, -17, 7, 7 },
+ { 20, -12, -2, -4, 5, 14, 7, -11, -1, -16, -6, -4, -11, 17, 14, 0,
+ -8, -10, -8, 10, 3, 5, 10, -16, 3, -8, -14, 10, 3, 9, 0, 3 },
+ { 12, -10, -36, 0, 7, 15, 2, -16, 2, -1, 0, -1, 5, 4, 5, -3,
+ 1, -10, 5, -1, -15, -3, -12, 12, 2, 5, -1, 5, 6, -3, -2, 2 },
+ { 17, -15, -31, 23, -4, 15, -2, -3, 6, -7, -5, 1, -12, 4, 6, 8,
+ -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2 },
+ { 6, -18, -5, 12, 10, 12, 14, -11, 15, 2, -9, -6, -5, -2, -9, 4,
+ -5, -28, -4, 14, 0, -16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4 },
+ { -5, -14, -31, 8, 16, 7, 13, -13, 5, 6, -16, 10, -5, 2, -2, 2,
+ 14, -5, 8, -5, 7, -16, 6, -13, -5, 0, -5, 8, -3, -1, 4, 3 },
+ { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28,
+ -12, -35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3 },
+ { 2, -9, -22, 12, 3, 3, -7, -4, -19, -22, -14, -4, -1, 21, 9, -3,
+ -15, -16, -13, 1, -11, 4, -9, 1, -7, -1, -1, 0, -2, 9, -13, -3 },
+ { -1, -3, -23, 0, 2, 12, 3, -9, -4, 7, 3, 9, -10, 1, 27, 28,
+ 0, 9, -15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6 },
+ { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6,
+ -10, -12, 19, 1, -7, 9, -8, -9, -16, -11, -2, 12, 14, 4, 4, 34 },
+ { 17, 7, -6, 1, 4, -10, -5, 4, -11, 3, -18, 4, 14, -13, -3, 1,
+ 0, 0, -11, 0, 7, -17, -4, 4, -11, -6, -8, 18, 0, 0, 0, 26 },
+ { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3,
+ 7, 4, -12, -8, 0, -9, 8, -22, -5, 0, -6, 22, -2, 11, -13, 24 },
+ { -3, 4, 0, 3, 9, 10, -1, 3, -9, -12, 1, -5, 18, 0, -3, 8,
+ 25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23 },
+ { -5, 2, -9, -1, -3, 0, 3, -1, -10, -4, 0, -13, 16, 9, -1, -14,
+ 2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2, -14, 0, -9, 30 },
+ { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7, -11, 14, 14,
+ 7, 34, -9, 0, -10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29 },
+ { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1, -10, 1,
+ 6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7, -12, 0, -2, -10, 55 },
+ { 5, 9, -1, 0, 4, 9, -21, -9, 4, 2, 6, -7, 11, -7, 1, -5,
+ 0, -4, 2, -3, -13, -8, 0, -9, -4, 2, 16, -2, -15, -7, -11, 31 },
+ { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1,
+ 5, 2, 0, 0, 12, 20, -19, 1, 8, -12, -11, 0, 6, -5, 2, 31 },
+ { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2,
+ -3, -12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30 },
+ { -4, 0, -7, 17, 10, -12, -2, -10, -12, -3, 10, 0, 11, -4, -13, -3,
+ 5, 6, 10, 7, -8, 0, -7, -13, 1, 0, -2, 7, -12, 4, -3, 24 },
+ { -13, 9, 4, -2, 2, -4, -14, -1, -3, -5, -10, 4, 13, -2, 5, 13,
+ 8, 3, -2, 1, 5, -6, 7, -18, -10, 1, -1, 5, 4, 1, 0, 25 },
+ { -5, -1, 18, 12, 8, 8, -16, -1, 1, 1, 1, -4, -5, 3, 3, 4,
+ 4, -11, -12, -16, -6, 2, 12, -13, 0, 9, 7, 9, -9, 0, -10, 24 },
+ { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1,
+ 1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69 },
+ { 8, 5, 11, 0, -15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0,
+ 1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4, -11, -9, 41 },
+ { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3,
+ -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3, -12, 16, 2, 27 },
+ { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12,
+ -1, 10, -11, -11, -7, -4, -14, 7, -14, 13, 22, 18, -1, 0, 14, 28 },
+ { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1, -15, 4, -9,
+ 22, -10, -9, -4, 1, 8, -4, 9, -15, 2, -6, -4, -16, 12, -10, 23 },
+ { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1,
+ 13, -15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5, -11, -14, 23 },
+ { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6,
+ 15, 3, -3, 18, -15, -2, -6, 3, 3, -20, 17, 11, -4, 2, 3, 29 },
+ { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7,
+ -3, -2, -7, -2, -4, 5, 3, -5, -20, -13, -4, 10, -14, -29, 14, 37 },
+ { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5,
+ -4, 4, -4, 4, 4, 3, 1, -4, -4, -9, -14, 20, -30, 3, -18, 33 },
+ { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4,
+ 3, 2, -3, 0, -1, -1, -10, -7, 2, -4, -18, 2, -37, -1, 12, 40 },
+ { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9,
+ 18, 0, 12, -17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26 },
+ { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1, -15, 8, 7, -1, -17, -4,
+ 1, 5, 6, -11, -6, 14, 17, -5, -15, 11, 8, 0, -3, -15, -6, 28 },
+ { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2,
+ 2, -1, -1, -7, 1, 2, -9, 0, -1, -4, -18, 7, -10, 49, -13, 32 },
+ { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1,
+ 2, -5, 2, -7, 17, -2, 10, -5, 0, 2, -15, 3, -9, 7, -9, 30 },
+ { -5, -1, 0, 2, 1, -1, 2, 5, -33, 3, -5, 14, 11, 7, 5, -3,
+ 2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27 },
+ { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3,
+ 4, 2, 1, -7, -4, 1, -3, -4, -35, -25, 17, 10, -3, -26, -7, 32 },
+ { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2,
+ -5, 2, 2, 4, 3, 5, -5, -16, -31, -12, -11, 2, -19, 20, -2, 21 },
+ { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2,
+ 0, -3, 5, -11, -8, -3, -7, -7, 28, -11, -7, 0, -16, -11, -4, 29 },
+ { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5, -12, 2,
+ -2, -5, -22, -2, -1, 11, 8, -7, -12, 0, -34, 6, -5, 11, -8, 19 },
+ { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1,
+ 2, 8, 4, -5, -8, -2, 5, -18, 7, 12, 7, 19, -18, 2, -6, -13 },
+ { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6,
+ -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10, -13, 0, -9, -19 },
+ { 12, -10, 2, -2, -2, -1, -3, 6, -12, -5, -2, 14, -16, 4, 12, 12,
+ 17, 4, 7, -16, 7, -6, 11, 7, 7, 2, -25, 23, -24, 5, -7, -9 },
+ { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0,
+ 1, 2, -4, 2, -3, -8, 0, -1, 9, 9, -10, -3, -29, 1, -1, -27 },
+ { 2, 2, 0, 7, 9, -2, -10, -1, -1, 1, -9, -5, 8, 4, 1, 2,
+ -10, 1, 13, 12, -3, 15, -9, 2, -7, 1, -10, 23, -20, -18, -9, -15 },
+ { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7,
+ -6, 3, -3, -9, 7, 9, -22, 1, 6, -4, 14, 27, -25, -14, 3, -5 },
+ { 1, 3, 8, 4, 7, 6, 12, -17, -15, 1, -8, -10, 7, -14, -8, 6,
+ -2, -2, -11, -11, -7, 13, -2, -2, 4, 5, -5, 13, -23, -6, -17, -8 },
+ { -5, 4, -14, -5, -4, -5, 6, 5, -8, -5, -2, -11, -7, -12, 3, -11,
+ 2, -6, 4, -10, -5, -7, 14, 5, 23, 11, 7, 12, -16, -6, -4, -16 },
+ { 5, 6, 2, 5, -2, -5, -5, -6, -5, -19, -13, -1, -3, -13, 5, 0,
+ 6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17, -12, -27, 3, 0, -1 },
+ { 7, -1, 9, -10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4,
+ 12, 5, 11, 14, -13, -1, 8, 1, 13, 9, 12, 12, -18, -14, -11, -16 },
+ { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2,
+ 2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0, -36, -5, -9, -21 },
+ { 14, -6, -9, 0, -1, -8, -8, -11, 2, 2, -9, -12, 12, -4, 5, 3,
+ -5, -9, 11, -1, -3, 12, -21, -3, 12, 5, 3, 11, -18, -15, 1, -2 },
+ { -1, 3, -9, -3, 7, -7, -18, 2, 4, 12, -10, 2, 8, -3, -14, 13,
+ 17, -5, 5, -9, 13, -3, -7, -18, 17, -2, 5, 7, -20, -3, -6, -11 },
+ { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3, -14, -6, -5, -8, 14, -6,
+ 7, -1, 5, 1, 15, -1, -7, -4, 6, -11, 9, -2, -37, 16, -7, -3 },
+ { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12, -10,
+ 10, 13, 2, 7, -6, 2, -10, -10, 21, -5, 5, 5, -12, -23, 3, -14 },
+ { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1,
+ 8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5, -20, -40, -4, -18, -14 },
+ { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5,
+ 1, 2, -6, 4, -1, -2, -1, -15, 8, 3, 9, 46, -7, -18, 6, -11 },
+ { 5, 5, 16, 21, 3, -11, -4, 11, -12, 2, 4, -12, -1, 11, 8, 1,
+ -4, 11, -11, -21, 1, 1, -11, 3, 13, 1, 5, 12, -25, 1, -3, -2 },
+ { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9, -15, 3, -3, -14, 17, 4,
+ -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6, -29, -17, 8, 4 },
+ { -7, -7, 4, 0, 13, 1, 0, 4, 4, -16, -10, -7, 5, 9, -15, -10,
+ -10, 8, -4, -1, -11, -1, -10, -15, 3, 3, 14, 10, -19, 2, -18, -12 },
+ { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9,
+ 2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11, -24, -44, -9, -15 },
+ { -1, -10, 6, 21, 11, 15, -7, 10, -14, -9, -8, -8, 4, 6, 19, 1,
+ -6, 1, -5, -17, -8, -10, 9, 5, 11, 18, -1, 10, -16, -7, -9, -8 },
+ { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4,
+ -7, 7, 17, -20, 6, 4, 1, -6, -12, 31, 13, 19, -14, -10, -7, -2 },
+ { -2, 6, -10, 3, 9, 6, -14, 15, 2, -5, 2, -11, 9, -8, 4, 6,
+ 20, -15, -3, -3, -1, 32, -21, 6, 1, 9, 11, 17, -19, 6, -1, -3 },
+ { 8, 10, -2, 0, -8, -16, 7, 7, 6, 10, 4, -14, 7, -6, 21, -7,
+ 10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15, -20, -7, -11, 2 },
+ { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5, -13, -1, 27, -9,
+ -6, -11, -7, 1, 11, -4, -4, -14, -2, 11, 6, 10, -19, -6, -15, 2 },
+ { 0, 7, -1, 2, -7, -15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5,
+ -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7, -27, -4, -4, -12 },
+ { 11, 1, -16, 6, -15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9,
+ 5, -3, 3, -2, -11, 3, 9, 6, 9, 3, -1, 12, -41, 8, -6, 9 },
+ { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2, -13, 7, -1, -2,
+ -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1, -47, -21, 7, -6 },
+ { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18, -13, 7, -13, -4, 8, 4,
+ 8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10, -25, -3, -12, -12 },
+ { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3,
+ 2, -2, -17, -6, -4, 1, 33, -6, -20, -6, 8, 31, -26, -8, -1, -4 },
+ { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15,
+ -10, -3, -15, -5, -3, -4, -6, -30, 17, -8, -2, 2, -20, 0, -8, -2 },
+ { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4,
+ 1, 1, -3, 4, 4, -14, 3, 11, -5, 3, -3, 7, -3, 13, 23, -16 },
+ { 2, -6, 1, -3, 5, 0, -6, -11, -7, -4, -1, 2, -7, -1, -1, 7,
+ 1, -2, 6, 12, -6, 8, -13, 17, 25, -23, -19, -7, -12, 9, 16, -17 },
+ { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7,
+ 0, -5, 3, -19, -3, 5, 3, 9, -1, 9, -13, 13, -17, 4, 21, -26 },
+ { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2,
+ -2, 0, 4, -6, 7, -2, 6, 5, -5, 2, -12, 1, -29, 29, 27, 12 },
+ { 9, -10, -22, 6, -1, -1, 9, -14, -12, -2, 1, -1, 10, -11, -16, 0,
+ 3, 11, 13, -14, -9, -2, -1, 6, 4, -14, 0, -10, -2, 16, 17, -11 },
+ { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4,
+ -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1, -47, -3, 50, -17 },
+ { 8, -4, -11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2,
+ -14, 6, 6, 6, 0, 2, -1, 5, -20, 2, -1, 4, -5, 6, 21, -11 },
+ { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7,
+ 4, 7, -12, -9, -2, 10, -6, 13, 6, 5, 20, 2, -15, 9, 28, -7 },
+ { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2,
+ 6, 16, -14, 9, -14, -2, -8, -27, -3, 18, -1, -7, -3, 8, 23, -23 },
+ { 1, 4, -9, -1, -5, 10, -2, 1, -11, 1, -9, 4, 7, 14, -9, -2,
+ -3, 2, -5, -1, -6, -10, -7, 11, 20, 2, 3, -19, 3, 15, 30, -9 },
+ { 7, 2, -14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6, -11,
+ -14, 1, 10, -1, -7, -8, 1, 10, 3, -6, -15, -12, -17, 4, 30, -6 },
+ { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4,
+ 4, -4, -2, -5, -2, 2, -1, -2, 0, -2, -11, -7, -3, 42, 24, -14 },
+ { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4,
+ -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24, -13, -28, 20, 15, -22 },
+ { -3, 7, 6, 3, -2, -5, -10, -2, -2, -1, -6, -6, -2, -14, -16, -6,
+ -5, 0, 18, 0, 9, 1, 7, -13, -5, -6, -9, 11, -15, 9, 22, -11 },
+ { 9, -2, 6, 5, 2, 9, -10, 1, 1, 5, -4, 12, 2, 2, -10, -7,
+ -4, -6, 7, 9, 6, 15, 6, 6, -10, 10, 5, -13, -5, 6, 24, -12 },
+ { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6,
+ -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22, -17 },
+ { -2, -2, 3, 10, 9, 9, 12, -15, -1, -11, -13, 3, -2, 1, -3, -11,
+ 7, 9, 16, -3, -10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31, -12 },
+ { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3,
+ -13, -6, 15, 20, -9, -3, -12, 1, -2, -16, 8, 8, -1, 16, 22, -5 },
+ { 5, -3, -15, -2, 12, -8, 8, -5, 2, -8, 20, -18, 14, -4, 3, 3,
+ 7, -13, -16, 1, -10, 7, 16, 7, 4, -14, -4, -5, -9, 8, 23, -6 },
+ { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6, -10, -2, 6,
+ 9, -17, -14, 11, 12, -3, -13, -7, 2, 18, 3, -25, -16, 18, 22, -5 },
+ { 5, 6, -7, -20, -4, 2, 8, 4, -24, -4, 1, 4, -5, -2, 1, -10,
+ -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21, -11 },
+ { 0, 7, -1, 14, -6, -4, -10, 5, 4, 4, 4, -5, 3, 4, -1, -7,
+ 8, -19, 0, 6, 2, 3, -18, -3, -6, 2, 8, 14, -26, 22, 27, -13 },
+ { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14,
+ 6, -5, 6, -4, -7, 7, -21, 8, 1, 8, -9, -4, -3, 11, 25, -13 },
+ { 4, 4, -1, -6, 4, 9, -8, 1, -3, -10, -2, 0, 15, -9, -16, 11,
+ 1, 1, 6, 3, -9, -5, 16, 26, 1, -14, 1, -3, -14, 7, 15, -9 },
+ { -12, -2, -9, -13, 2, 6, 14, 0, 1, 0, -1, -13, 0, 10, -1, 6,
+ 9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7, -22, -2, 29, -7 },
+ { 2, 4, 13, -12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10,
+ 15, -6, -1, -11, -30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25, -16 },
+ { 7, -15, -7, -7, -1, -5, -5, -11, -20, 10, 3, -10, -3, 5, 20, -4,
+ 0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1, -12, -3, 15, 22, -16 },
+ { 4, -1, 3, 4, -5, 0, -1, -5, -24, -29, 4, -9, 1, -3, 0, 0,
+ 0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5, -10, 3, 25, -10 },
+ { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2,
+ 1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1, -11, 7, 46, -46 },
+ { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4, -10,
+ 13, 1, 3, -6, 4, -4, 7, 2, -19, -25, -3, -16, -12, 16, 20, -1 },
+ { 18, 6, 4, -12, 0, -14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2,
+ 7, 0, 2, 5, -11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8 },
+ { 5, 0, -6, 5, 6, 3, 3, -10, -5, 1, -1, 4, 3, -11, -8, 5,
+ 4, -5, 5, -5, -7, -5, 11, 5, 20, -8, -16, 21, -4, 27, 23, -5 }
+};
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/config.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/config.h
new file mode 100644
index 000000000..f5e54ed19
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/config.h
@@ -0,0 +1,145 @@
+/* vc++/config.h - manually adapted from include/config.h.in */
+
+/* dtsdec profiling */
+/* #undef DTSDEC_GPROF */
+
+/* maximum supported data alignment */
+/* #undef ATTRIBUTE_ALIGNED_MAX */
+
+/* debug mode configuration */
+/* #undef DEBUG */
+
+/* Define if you have the `__builtin_expect' function. */
+/* #undef HAVE_BUILTIN_EXPECT */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define to 1 if you have the `ftime' function. */
+#define HAVE_FTIME 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+/* #undef HAVE_GETTIMEOFDAY */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Define to 1 if you have the <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define to 1 if you have the `memalign' function. */
+/* #undef HAVE_MEMALIGN */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if the system has the type `struct timeval'. */
+/* #undef HAVE_STRUCT_TIMEVAL */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#define HAVE_SYS_TIMEB_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+/* #undef HAVE_SYS_TIME_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <time.h> header file. */
+/* #undef HAVE_TIME_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* dts sample precision */
+/* #undef LIBDTS_DOUBLE */
+
+/* use fixed-point arithmetic */
+/* #undef LIBDTS_FIXED */
+
+/* libao al support */
+/* #undef LIBAO_AL */
+
+/* libao OSS support */
+/* #undef LIBAO_OSS */
+
+/* libao solaris support */
+/* #undef LIBAO_SOLARIS */
+
+/* libao win support */
+#define LIBAO_WIN
+
+/* Name of package */
+#define PACKAGE "dtsdec"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* The size of a `char', as computed by sizeof. */
+#define SIZEOF_CHAR 1
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of a `short', as computed by sizeof. */
+#define SIZEOF_SHORT 2
+
+/* The size of a `void*', as computed by sizeof. */
+#define SIZEOF_VOIDP 4
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "0.7.4-cvs"
+
+/* Define to 1 if your processor stores words with the most significant byte
+ first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+ if it is not supported. */
+#define inline __inline
+
+/* Define as `__restrict' if that's what the C compiler calls it, or to
+ nothing if it is not supported. */
+#define restrict __restrict
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/inttypes.h b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/inttypes.h
new file mode 100644
index 000000000..973d8c816
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/inttypes.h
@@ -0,0 +1,11 @@
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed int int32_t;
+typedef signed __int64 int64_t;
+typedef signed int intptr_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned __int64 uint64_t;
+typedef unsigned int uintptr_t; \ No newline at end of file
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts.vcproj b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts.vcproj
new file mode 100644
index 000000000..46fa067e6
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts.vcproj
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="libdts"
+ ProjectGUID="{54F609FD-A8CE-43CF-94AD-23E877B97C13}"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".,../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/libdts.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\libdtsD.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=".,../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/libdts.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\libdtsR.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="..\libdts\dts_bitstream.c">
+ </File>
+ <File
+ RelativePath="..\libdts\dts_downmix.c">
+ </File>
+ <File
+ RelativePath="..\libdts\dts_parse.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath="..\libdts\bitstream.h">
+ </File>
+ <File
+ RelativePath="..\include\dts.h">
+ </File>
+ <File
+ RelativePath="..\libdts\dts_internal.h">
+ </File>
+ <File
+ RelativePath="..\libdts\tables.h">
+ </File>
+ <File
+ RelativePath="..\libdts\tables_adpcm.h">
+ </File>
+ <File
+ RelativePath="..\libdts\tables_fir.h">
+ </File>
+ <File
+ RelativePath="..\libdts\tables_huffman.h">
+ </File>
+ <File
+ RelativePath="..\libdts\tables_quantization.h">
+ </File>
+ <File
+ RelativePath="..\libdts\tables_vq.h">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts_vs2005.vcproj b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts_vs2005.vcproj
new file mode 100644
index 000000000..ec4041c66
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts_vs2005.vcproj
@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="libdts"
+ ProjectGUID="{54F609FD-A8CE-43CF-94AD-23E877B97C13}"
+ RootNamespace="libdts"
+ SignManifests="true"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="0"
+ AdditionalIncludeDirectories=".,../include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ PrecompiledHeaderFile=".\Debug/libdts.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\libdtsD.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+DisableSpecificWarnings="4995;4996"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=".,../include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ PrecompiledHeaderFile=".\Release/libdts.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\libdtsR.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="..\libdts\dts_bitstream.c"
+ >
+ </File>
+ <File
+ RelativePath="..\libdts\dts_downmix.c"
+ >
+ </File>
+ <File
+ RelativePath="..\libdts\dts_parse.c"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="..\libdts\bitstream.h"
+ >
+ </File>
+ <File
+ RelativePath="..\include\dts.h"
+ >
+ </File>
+ <File
+ RelativePath="..\libdts\dts_internal.h"
+ >
+ </File>
+ <File
+ RelativePath="..\libdts\tables.h"
+ >
+ </File>
+ <File
+ RelativePath="..\libdts\tables_adpcm.h"
+ >
+ </File>
+ <File
+ RelativePath="..\libdts\tables_fir.h"
+ >
+ </File>
+ <File
+ RelativePath="..\libdts\tables_huffman.h"
+ >
+ </File>
+ <File
+ RelativePath="..\libdts\tables_quantization.h"
+ >
+ </File>
+ <File
+ RelativePath="..\libdts\tables_vq.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..12444eaab
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/dtsdec-0.0.1/vc++/libdts_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/mpadecfilter/faad2/AUTHORS b/src/filters/transform/mpadecfilter/faad2/AUTHORS
new file mode 100644
index 000000000..3b5a942b8
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/AUTHORS
@@ -0,0 +1,13 @@
+
+M. Bakker (mbakker(at)nero.com)
+ - complete library
+
+Alexander Kurpiers (a.kurpiers(at)nt.tu-darmstadt.de)
+ - HCR code
+ - DRM stuff
+ - lot's of bug fixes
+
+Volker Fischer (v.fischer(at)nt.tu-darmstadt.de)
+ - DRM code
+ - lot's of bug fixes
+
diff --git a/src/filters/transform/mpadecfilter/faad2/COPYING b/src/filters/transform/mpadecfilter/faad2/COPYING
new file mode 100644
index 000000000..2459c58b8
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/COPYING
@@ -0,0 +1,350 @@
+
+Any non-GPL usage of this software or parts of this software is strictly
+forbidden.
+
+Commercial non-GPL licensing of this software is possible.
+For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+
+
+
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/src/filters/transform/mpadecfilter/faad2/ChangeLog b/src/filters/transform/mpadecfilter/faad2/ChangeLog
new file mode 100644
index 000000000..ba262cb9b
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/ChangeLog
@@ -0,0 +1,5 @@
+
+
+- 26 feb 2004: Added downsampled SBR support
+- 26 feb 2004: Optimised Low Power QMF filterbank
+
diff --git a/src/filters/transform/mpadecfilter/faad2/NEWS b/src/filters/transform/mpadecfilter/faad2/NEWS
new file mode 100644
index 000000000..f557d63a0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/NEWS
@@ -0,0 +1,7 @@
+
+6 February 2004
+ - FAAD2 version 2.0 released
+
+25 July 2003
+ - Release version with SBR decoding
+
diff --git a/src/filters/transform/mpadecfilter/faad2/README b/src/filters/transform/mpadecfilter/faad2/README
new file mode 100644
index 000000000..d652a2122
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/README
@@ -0,0 +1,122 @@
+
+Freeware Advanced Audio (AAC) Decoder including SBR decoding
+http://www.audiocoding.com/
+
+FAAD2 is a HE, LC, MAIN and LTP profile, MPEG2 and MPEG-4 AAC decoder.
+FAAD2 includes code for SBR (HE AAC) decoding.
+FAAD2 is licensed under the GPL.
+
+
+__________
+COPYRIGHTS
+
+For FAAD2 the following license applies:
+
+******************************************************************************
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker (mbakker(at)nero.com), Ahead Software AG
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Commercial non-GPL licensing of this software is also possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+******************************************************************************
+
+
+Please note that the use of this software may require the payment of
+patent royalties. You need to consider this issue before you start
+building derivative works. We are not warranting or indemnifying you in
+any way for patent royalities! YOU ARE SOLELY RESPONSIBLE FOR YOUR OWN
+ACTIONS!
+
+
+______
+PEOPLE
+
+FAAD2 is written by:
+ - M. Bakker (mbakker(at)nero.com).
+
+
+_______________
+VERSION HISTORY
+
+Sorry, try building a ChangeLog from CVS.
+
+__________________________________
+REDISTRIBUTED OPEN SOURCE PACKAGES
+
+This is the list of redistributed open source packages that are included
+in FAAD2:
+
+Name: mp4v2
+Version: 0.9.8.6
+Origin: http://www.mpeg4ip.net
+Author: David Mackie
+Directory: common/mp4v2
+License: MPL, Mozilla Public License, version 1.1
+
+Name: mp4av
+Version: 0.9.8.6
+Origin: http://www.mpeg4ip.net
+Author: David Mackie
+Directory: common/mp4av
+License: MPL, Mozilla Public License, version 1.1
+
+
+___________________
+DIRECTORY STRUCTURE
+
+faad2 - top level directory.
+
+ aacDECdrop - windows decoder/player with drag'n'drop functionality
+
+ common - generally used libraries and code.
+
+ faad - general common functions like filereading and streaming
+ as well as getting info from aac files.
+
+ mp4v2 - MPEG-4 file reading library.
+
+ mp4av - MPEG-4 file general function library.
+
+ mp4ff - Small MP4 file format library (includes tagging abilities).
+
+ CoreAAC - AAC DirectShow filter.
+
+ frontend - command line frontend to the FAAD2 library, also supports
+ MPEG-4 file decoding.
+
+ include - inlude file for the FAAD2 library.
+
+ libfaad - the FAAD2 AAC decoder library including SBR.
+
+ codebook - Huffman codebooks
+
+ plugins - plugins for all kinds of pograms.
+
+ in_mp4 - winamp MPEG-4 AAC file input plugin.
+
+ QCD - Quintessential player AAC plugin.
+
+ QCDMp4 - Quintessential player MP4 plugin.
+
+ winamp - winamp2 AAC input plugin.
+
+ winamp3 - winamp3 AAC input plugin.
+
+ xmms - xmms AAC plugin
+
+ mpeg4ip - plugin for the mpeg4ip player
+
diff --git a/src/filters/transform/mpadecfilter/faad2/TODO b/src/filters/transform/mpadecfilter/faad2/TODO
new file mode 100644
index 000000000..2ab688348
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/TODO
@@ -0,0 +1,2 @@
+
+- Not much...
diff --git a/src/filters/transform/mpadecfilter/faad2/include/faad.h b/src/filters/transform/mpadecfilter/faad2/include/faad.h
new file mode 100644
index 000000000..1af1fa051
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/include/faad.h
@@ -0,0 +1,37 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: faad.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* warn people for update */
+#pragma message("please update faad2 include filename and function names!")
+
+/* Backwards compatible link */
+#include "neaacdec.h"
diff --git a/src/filters/transform/mpadecfilter/faad2/include/neaacdec.h b/src/filters/transform/mpadecfilter/faad2/include/neaacdec.h
new file mode 100644
index 000000000..891859e0f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/include/neaacdec.h
@@ -0,0 +1,257 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: neaacdec.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __NEAACDEC_H__
+#define __NEAACDEC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#if 1
+/* MACROS FOR BACKWARDS COMPATIBILITY */
+/* structs */
+#define faacDecHandle NeAACDecHandle
+#define faacDecConfiguration NeAACDecConfiguration
+#define faacDecConfigurationPtr NeAACDecConfigurationPtr
+#define faacDecFrameInfo NeAACDecFrameInfo
+/* functions */
+#define faacDecGetErrorMessage NeAACDecGetErrorMessage
+#define faacDecSetConfiguration NeAACDecSetConfiguration
+#define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration
+#define faacDecInit NeAACDecInit
+#define faacDecInit2 NeAACDecInit2
+#define faacDecInitDRM NeAACDecInitDRM
+#define faacDecPostSeekReset NeAACDecPostSeekReset
+#define faacDecOpen NeAACDecOpen
+#define faacDecClose NeAACDecClose
+#define faacDecDecode NeAACDecDecode
+#define AudioSpecificConfig NeAACDecAudioSpecificConfig
+#endif
+
+
+#ifdef _WIN32
+ #pragma pack(push, 8)
+ #ifndef NEAACDECAPI
+ #define NEAACDECAPI __cdecl
+ #endif
+#else
+ #ifndef NEAACDECAPI
+ #define NEAACDECAPI
+ #endif
+#endif
+
+#define FAAD2_VERSION "2.1 beta"
+
+/* object types for AAC */
+#define MAIN 1
+#define LC 2
+#define SSR 3
+#define LTP 4
+#define HE_AAC 5
+#define ER_LC 17
+#define ER_LTP 19
+#define LD 23
+#define DRM_ER_LC 27 /* special object type for DRM */
+
+/* header types */
+#define RAW 0
+#define ADIF 1
+#define ADTS 2
+
+/* SBR signalling */
+#define NO_SBR 0
+#define SBR_UPSAMPLED 1
+#define SBR_DOWNSAMPLED 2
+#define NO_SBR_UPSAMPLED 3
+
+/* library output formats */
+#define FAAD_FMT_16BIT 1
+#define FAAD_FMT_24BIT 2
+#define FAAD_FMT_32BIT 3
+#define FAAD_FMT_FLOAT 4
+#define FAAD_FMT_FIXED FAAD_FMT_FLOAT
+#define FAAD_FMT_DOUBLE 5
+
+/* Capabilities */
+#define LC_DEC_CAP (1<<0) /* Can decode LC */
+#define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */
+#define LTP_DEC_CAP (1<<2) /* Can decode LTP */
+#define LD_DEC_CAP (1<<3) /* Can decode LD */
+#define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
+#define FIXED_POINT_CAP (1<<5) /* Fixed point */
+
+/* Channel definitions */
+#define FRONT_CHANNEL_CENTER (1)
+#define FRONT_CHANNEL_LEFT (2)
+#define FRONT_CHANNEL_RIGHT (3)
+#define SIDE_CHANNEL_LEFT (4)
+#define SIDE_CHANNEL_RIGHT (5)
+#define BACK_CHANNEL_LEFT (6)
+#define BACK_CHANNEL_RIGHT (7)
+#define BACK_CHANNEL_CENTER (8)
+#define LFE_CHANNEL (9)
+#define UNKNOWN_CHANNEL (0)
+
+/* DRM channel definitions */
+#define DRMCH_MONO 1
+#define DRMCH_STEREO 2
+#define DRMCH_SBR_MONO 3
+#define DRMCH_SBR_STEREO 4
+#define DRMCH_SBR_PS_STEREO 5
+
+
+/* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
+ so at least so much bytes per channel should be available in this stream */
+#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
+
+
+typedef void *NeAACDecHandle;
+
+typedef struct mp4AudioSpecificConfig
+{
+ /* Audio Specific Info */
+ unsigned char objectTypeIndex;
+ unsigned char samplingFrequencyIndex;
+ unsigned long samplingFrequency;
+ unsigned char channelsConfiguration;
+
+ /* GA Specific Info */
+ unsigned char frameLengthFlag;
+ unsigned char dependsOnCoreCoder;
+ unsigned short coreCoderDelay;
+ unsigned char extensionFlag;
+ unsigned char aacSectionDataResilienceFlag;
+ unsigned char aacScalefactorDataResilienceFlag;
+ unsigned char aacSpectralDataResilienceFlag;
+ unsigned char epConfig;
+
+ char sbr_present_flag;
+ char forceUpSampling;
+ char downSampledSBR;
+} mp4AudioSpecificConfig;
+
+typedef struct NeAACDecConfiguration
+{
+ unsigned char defObjectType;
+ unsigned long defSampleRate;
+ unsigned char outputFormat;
+ unsigned char downMatrix;
+ unsigned char useOldADTSFormat;
+ unsigned char dontUpSampleImplicitSBR;
+} NeAACDecConfiguration, *NeAACDecConfigurationPtr;
+
+typedef struct NeAACDecFrameInfo
+{
+ unsigned long bytesconsumed;
+ unsigned long samples;
+ unsigned char channels;
+ unsigned char error;
+ unsigned long samplerate;
+
+ /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
+ unsigned char sbr;
+
+ /* MPEG-4 ObjectType */
+ unsigned char object_type;
+
+ /* AAC header type; MP4 will be signalled as RAW also */
+ unsigned char header_type;
+
+ /* multichannel configuration */
+ unsigned char num_front_channels;
+ unsigned char num_side_channels;
+ unsigned char num_back_channels;
+ unsigned char num_lfe_channels;
+ unsigned char channel_position[64];
+
+ /* PS: 0: off, 1: on */
+ unsigned char ps;
+} NeAACDecFrameInfo;
+
+char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
+
+unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
+
+NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
+
+NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
+
+unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+ NeAACDecConfigurationPtr config);
+
+/* Init the library based on info from the AAC file (ADTS/ADIF) */
+long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
+ unsigned char *buffer,
+ unsigned long buffer_size,
+ unsigned long *samplerate,
+ unsigned char *channels);
+
+/* Init the library using a DecoderSpecificInfo */
+char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, unsigned char *pBuffer,
+ unsigned long SizeOfDecoderSpecificInfo,
+ unsigned long *samplerate, unsigned char *channels);
+
+/* Init the library for DRM */
+char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
+ unsigned char channels);
+
+void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
+
+void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
+
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ unsigned char *buffer,
+ unsigned long buffer_size);
+
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ unsigned char *buffer,
+ unsigned long buffer_size,
+ void **sample_buffer,
+ unsigned long sample_buffer_size);
+
+char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
+ unsigned long buffer_size,
+ mp4AudioSpecificConfig *mp4ASC);
+
+#ifdef _WIN32
+ #pragma pack(pop)
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/analysis.h b/src/filters/transform/mpadecfilter/faad2/libfaad/analysis.h
new file mode 100644
index 000000000..26558d74a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/analysis.h
@@ -0,0 +1,54 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: analysis.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __ANALYSIS_H__
+#define __ANALYSIS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef ANALYSIS
+#define DEBUGDEC ,uint8_t print,uint16_t var,uint8_t *dbg
+#define DEBUGVAR(A,B,C) ,A,B,C
+extern uint16_t dbg_count;
+#else
+#define DEBUGDEC
+#define DEBUGVAR(A,B,C)
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/bits.c b/src/filters/transform/mpadecfilter/faad2/libfaad/bits.c
new file mode 100644
index 000000000..0510b60db
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/bits.c
@@ -0,0 +1,218 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: bits.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include "bits.h"
+
+/* initialize buffer, call once before first getbits or showbits */
+void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size)
+{
+ uint32_t tmp;
+
+ if (ld == NULL)
+ return;
+
+ memset(ld, 0, sizeof(bitfile));
+
+ if (buffer_size == 0 || _buffer == NULL)
+ {
+ ld->error = 1;
+ ld->no_more_reading = 1;
+ return;
+ }
+
+ ld->buffer = faad_malloc((buffer_size+12)*sizeof(uint8_t));
+ memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t));
+ memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t));
+
+ ld->buffer_size = buffer_size;
+
+ tmp = getdword((uint32_t*)ld->buffer);
+ ld->bufa = tmp;
+
+ tmp = getdword((uint32_t*)ld->buffer + 1);
+ ld->bufb = tmp;
+
+ ld->start = (uint32_t*)ld->buffer;
+ ld->tail = ((uint32_t*)ld->buffer + 2);
+
+ ld->bits_left = 32;
+
+ ld->bytes_used = 0;
+ ld->no_more_reading = 0;
+ ld->error = 0;
+}
+
+void faad_endbits(bitfile *ld)
+{
+ if (ld)
+ {
+ if (ld->buffer)
+ {
+ faad_free(ld->buffer);
+ ld->buffer = NULL;
+ }
+ }
+}
+
+uint32_t faad_get_processed_bits(bitfile *ld)
+{
+ return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left));
+}
+
+uint8_t faad_byte_align(bitfile *ld)
+{
+ uint8_t remainder = (uint8_t)((32 - ld->bits_left) % 8);
+
+ if (remainder)
+ {
+ faad_flushbits(ld, 8 - remainder);
+ return (8 - remainder);
+ }
+ return 0;
+}
+
+void faad_flushbits_ex(bitfile *ld, uint32_t bits)
+{
+ uint32_t tmp;
+
+ ld->bufa = ld->bufb;
+ if (ld->no_more_reading == 0)
+ {
+ tmp = getdword(ld->tail);
+ ld->tail++;
+ } else {
+ tmp = 0;
+ }
+ ld->bufb = tmp;
+ ld->bits_left += (32 - bits);
+ ld->bytes_used += 4;
+ if (ld->bytes_used == ld->buffer_size)
+ ld->no_more_reading = 1;
+ if (ld->bytes_used > ld->buffer_size)
+ ld->error = 1;
+}
+
+/* rewind to beginning */
+void faad_rewindbits(bitfile *ld)
+{
+ uint32_t tmp;
+
+ tmp = ld->start[0];
+#ifndef ARCH_IS_BIG_ENDIAN
+ BSWAP(tmp);
+#endif
+ ld->bufa = tmp;
+
+ tmp = ld->start[1];
+#ifndef ARCH_IS_BIG_ENDIAN
+ BSWAP(tmp);
+#endif
+ ld->bufb = tmp;
+ ld->bits_left = 32;
+ ld->tail = &ld->start[2];
+ ld->bytes_used = 0;
+ ld->no_more_reading = 0;
+}
+
+uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
+ DEBUGDEC)
+{
+ uint16_t i;
+ uint8_t temp;
+ uint16_t bytes = (uint16_t)bits / 8;
+ uint8_t remainder = (uint8_t)bits % 8;
+
+ uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t));
+
+ for (i = 0; i < bytes; i++)
+ {
+ buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg));
+ }
+
+ if (remainder)
+ {
+ temp = (uint8_t)faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder);
+
+ buffer[bytes] = temp;
+ }
+
+ return buffer;
+}
+
+#ifdef DRM
+/* return the original data buffer */
+void *faad_origbitbuffer(bitfile *ld)
+{
+ return (void*)ld->start;
+}
+
+/* return the original data buffer size */
+uint32_t faad_origbitbuffer_size(bitfile *ld)
+{
+ return ld->buffer_size;
+}
+#endif
+
+/* reversed bit reading routines, used for RVLC and HCR */
+void faad_initbits_rev(bitfile *ld, void *buffer,
+ uint32_t bits_in_buffer)
+{
+ uint32_t tmp;
+ int32_t index;
+
+ ld->buffer_size = bit2byte(bits_in_buffer);
+
+ index = (bits_in_buffer+31)/32 - 1;
+
+ ld->start = (uint32_t*)buffer + index - 2;
+
+ tmp = getdword((uint32_t*)buffer + index);
+ ld->bufa = tmp;
+
+ tmp = getdword((uint32_t*)buffer + index - 1);
+ ld->bufb = tmp;
+
+ ld->tail = (uint32_t*)buffer + index;
+
+ ld->bits_left = bits_in_buffer % 32;
+ if (ld->bits_left == 0)
+ ld->bits_left = 32;
+
+ ld->bytes_used = 0;
+ ld->no_more_reading = 0;
+ ld->error = 0;
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/bits.h b/src/filters/transform/mpadecfilter/faad2/libfaad/bits.h
new file mode 100644
index 000000000..b25852617
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/bits.h
@@ -0,0 +1,388 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: bits.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __BITS_H__
+#define __BITS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "analysis.h"
+#ifdef ANALYSIS
+#include <stdio.h>
+#endif
+
+#define BYTE_NUMBIT 8
+#define bit2byte(a) ((a+7)/BYTE_NUMBIT)
+
+typedef struct _bitfile
+{
+ /* bit input */
+ uint32_t bufa;
+ uint32_t bufb;
+ uint32_t bits_left;
+ uint32_t buffer_size; /* size of the buffer in bytes */
+ uint32_t bytes_used;
+ uint8_t no_more_reading;
+ uint8_t error;
+ uint32_t *tail;
+ uint32_t *start;
+ void *buffer;
+} bitfile;
+
+
+#if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
+#define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax
+#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__)
+#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
+#else
+#define BSWAP(a) \
+ ((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff))
+#endif
+
+static uint32_t bitmask[] = {
+ 0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF,
+ 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF,
+ 0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF,
+ 0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF,
+ 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF
+ /* added bitmask 32, correct?!?!?! */
+ , 0xFFFFFFFF
+};
+
+void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size);
+void faad_endbits(bitfile *ld);
+void faad_initbits_rev(bitfile *ld, void *buffer,
+ uint32_t bits_in_buffer);
+uint8_t faad_byte_align(bitfile *ld);
+uint32_t faad_get_processed_bits(bitfile *ld);
+void faad_flushbits_ex(bitfile *ld, uint32_t bits);
+void faad_rewindbits(bitfile *ld);
+uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
+ DEBUGDEC);
+#ifdef DRM
+void *faad_origbitbuffer(bitfile *ld);
+uint32_t faad_origbitbuffer_size(bitfile *ld);
+#endif
+
+/* circumvent memory alignment errors on ARM */
+static INLINE uint32_t getdword(void *mem)
+{
+#ifdef ARM
+ uint32_t tmp;
+#ifndef ARCH_IS_BIG_ENDIAN
+ ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3];
+ ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
+ ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
+ ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
+#else
+ ((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
+ ((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
+ ((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
+ ((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3];
+#endif
+
+ return tmp;
+#else
+ uint32_t tmp;
+ tmp = *(uint32_t*)mem;
+#ifndef ARCH_IS_BIG_ENDIAN
+ BSWAP(tmp);
+#endif
+ return tmp;
+#endif
+}
+
+static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits)
+{
+ if (bits <= ld->bits_left)
+ {
+ return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits];
+ }
+
+ bits -= ld->bits_left;
+ return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits));
+}
+
+static INLINE void faad_flushbits(bitfile *ld, uint32_t bits)
+{
+ /* do nothing if error */
+ if (ld->error != 0)
+ return;
+
+ if (bits < ld->bits_left)
+ {
+ ld->bits_left -= bits;
+ } else {
+ faad_flushbits_ex(ld, bits);
+ }
+}
+
+/* return next n bits (right adjusted) */
+static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC)
+{
+ uint32_t ret;
+
+ if (ld->no_more_reading || n == 0)
+ return 0;
+
+ ret = faad_showbits(ld, n);
+ faad_flushbits(ld, n);
+
+#ifdef ANALYSIS
+ if (print)
+ fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
+#endif
+
+ return ret;
+}
+
+static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC)
+{
+ uint8_t r;
+
+ if (ld->bits_left > 0)
+ {
+ ld->bits_left--;
+ r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
+ return r;
+ }
+
+ /* bits_left == 0 */
+#if 0
+ r = (uint8_t)(ld->bufb >> 31);
+ faad_flushbits_ex(ld, 1);
+#else
+ r = (uint8_t)faad_getbits(ld, 1);
+#endif
+ return r;
+}
+
+/* reversed bitreading routines */
+static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits)
+{
+ uint8_t i;
+ uint32_t B = 0;
+
+ if (bits <= ld->bits_left)
+ {
+ for (i = 0; i < bits; i++)
+ {
+ if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
+ B |= (1 << (bits - i - 1));
+ }
+ return B;
+ } else {
+ for (i = 0; i < ld->bits_left; i++)
+ {
+ if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
+ B |= (1 << (bits - i - 1));
+ }
+ for (i = 0; i < bits - ld->bits_left; i++)
+ {
+ if (ld->bufb & (1 << (i + (32-ld->bits_left))))
+ B |= (1 << (bits - ld->bits_left - i - 1));
+ }
+ return B;
+ }
+}
+
+static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits)
+{
+ /* do nothing if error */
+ if (ld->error != 0)
+ return;
+
+ if (bits < ld->bits_left)
+ {
+ ld->bits_left -= bits;
+ } else {
+ uint32_t tmp;
+
+ ld->bufa = ld->bufb;
+ tmp = getdword(ld->start);
+ ld->bufb = tmp;
+ ld->start--;
+ ld->bits_left += (32 - bits);
+
+ ld->bytes_used += 4;
+ if (ld->bytes_used == ld->buffer_size)
+ ld->no_more_reading = 1;
+ if (ld->bytes_used > ld->buffer_size)
+ ld->error = 1;
+ }
+}
+
+static INLINE uint32_t faad_getbits_rev(bitfile *ld, uint32_t n
+ DEBUGDEC)
+{
+ uint32_t ret;
+
+ if (ld->no_more_reading)
+ return 0;
+
+ if (n == 0)
+ return 0;
+
+ ret = faad_showbits_rev(ld, n);
+ faad_flushbits_rev(ld, n);
+
+#ifdef ANALYSIS
+ if (print)
+ fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
+#endif
+
+ return ret;
+}
+
+#ifdef DRM
+static uint8_t faad_check_CRC(bitfile *ld, uint16_t len)
+{
+ uint8_t CRC;
+ uint16_t r=255; /* Initialize to all ones */
+
+ /* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */
+#define GPOLY 0435
+
+ faad_rewindbits(ld);
+
+ CRC = (uint8_t) ~faad_getbits(ld, 8
+ DEBUGVAR(1,999,"faad_check_CRC(): CRC")); /* CRC is stored inverted */
+
+ for (; len>0; len--)
+ {
+ r = ( (r << 1) ^ (( ( faad_get1bit(ld
+ DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF;
+ }
+
+ if (r != CRC)
+ // if (0)
+ {
+ return 28;
+ } else {
+ return 0;
+ }
+}
+
+static uint8_t tabFlipbits[256] = {
+ 0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,
+ 8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,
+ 4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,
+ 12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,
+ 2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,
+ 10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,
+ 6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,
+ 14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,
+ 1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,
+ 9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,
+ 5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,
+ 13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,
+ 3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,
+ 11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,
+ 7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,
+ 15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255
+};
+#endif
+
+#ifdef ERROR_RESILIENCE
+
+/* Modified bit reading functions for HCR */
+
+typedef struct
+{
+ /* bit input */
+ uint32_t bufa;
+ uint32_t bufb;
+ int8_t len;
+} bits_t;
+
+
+static INLINE uint32_t showbits_hcr(bits_t *ld, uint8_t bits)
+{
+ if (bits == 0) return 0;
+ if (ld->len <= 32)
+ {
+ /* huffman_spectral_data_2 needs to read more than may be available, bits maybe
+ > ld->len, deliver 0 than */
+ if (ld->len >= bits)
+ return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits)));
+ else
+ return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));
+ } else {
+ if ((ld->len - bits) < 32)
+ {
+ return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) |
+ (ld->bufa >> (ld->len - bits));
+ } else {
+ return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits)));
+ }
+ }
+}
+
+/* return 1 if position is outside of buffer, 0 otherwise */
+static INLINE int8_t flushbits_hcr( bits_t *ld, uint8_t bits)
+{
+ ld->len -= bits;
+
+ if (ld->len <0)
+ {
+ ld->len = 0;
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+static INLINE int8_t getbits_hcr(bits_t *ld, uint8_t n, uint32_t *result)
+{
+ *result = showbits_hcr(ld, n);
+ return flushbits_hcr(ld, n);
+}
+
+static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result)
+{
+ uint32_t res;
+ int8_t ret;
+
+ ret = getbits_hcr(ld, 1, &res);
+ *result = (int8_t)(res & 1);
+ return ret;
+}
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/cfft.c b/src/filters/transform/mpadecfilter/faad2/libfaad/cfft.c
new file mode 100644
index 000000000..c0644cefb
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/cfft.c
@@ -0,0 +1,1007 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: cfft.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/*
+ * Algorithmically based on Fortran-77 FFTPACK
+ * by Paul N. Swarztrauber(Version 4, 1985).
+ *
+ * Does even sized fft only
+ */
+
+/* isign is +1 for backward and -1 for forward transforms */
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+
+#include "cfft.h"
+#include "cfft_tab.h"
+
+
+/* static function declarations */
+static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa);
+static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa);
+static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa1, const complex_t *wa2, const int8_t isign);
+static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+ const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
+static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+ const complex_t *wa1, const complex_t *wa2, const complex_t *wa3);
+static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc, complex_t *ch,
+ const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
+ const complex_t *wa4, const int8_t isign);
+INLINE void cfftf1(uint16_t n, complex_t *c, complex_t *ch,
+ const uint16_t *ifac, const complex_t *wa, const int8_t isign);
+static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac);
+
+
+/*----------------------------------------------------------------------
+ passf2, passf3, passf4, passf5. Complex FFT passes fwd and bwd.
+ ----------------------------------------------------------------------*/
+
+static void passf2pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa)
+{
+ uint16_t i, k, ah, ac;
+
+ if (ido == 1)
+ {
+ for (k = 0; k < l1; k++)
+ {
+ ah = 2*k;
+ ac = 4*k;
+
+ RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]);
+ RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
+ IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]);
+ IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
+ }
+ } else {
+ for (k = 0; k < l1; k++)
+ {
+ ah = k*ido;
+ ac = 2*k*ido;
+
+ for (i = 0; i < ido; i++)
+ {
+ complex_t t2;
+
+ RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]);
+ RE(t2) = RE(cc[ac+i]) - RE(cc[ac+i+ido]);
+
+ IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]);
+ IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]);
+
+#if 1
+ ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+ IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
+#else
+ ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+ RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
+#endif
+ }
+ }
+ }
+}
+
+static void passf2neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa)
+{
+ uint16_t i, k, ah, ac;
+
+ if (ido == 1)
+ {
+ for (k = 0; k < l1; k++)
+ {
+ ah = 2*k;
+ ac = 4*k;
+
+ RE(ch[ah]) = RE(cc[ac]) + RE(cc[ac+1]);
+ RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
+ IM(ch[ah]) = IM(cc[ac]) + IM(cc[ac+1]);
+ IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
+ }
+ } else {
+ for (k = 0; k < l1; k++)
+ {
+ ah = k*ido;
+ ac = 2*k*ido;
+
+ for (i = 0; i < ido; i++)
+ {
+ complex_t t2;
+
+ RE(ch[ah+i]) = RE(cc[ac+i]) + RE(cc[ac+i+ido]);
+ RE(t2) = RE(cc[ac+i]) - RE(cc[ac+i+ido]);
+
+ IM(ch[ah+i]) = IM(cc[ac+i]) + IM(cc[ac+i+ido]);
+ IM(t2) = IM(cc[ac+i]) - IM(cc[ac+i+ido]);
+
+#if 1
+ ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+ RE(t2), IM(t2), RE(wa[i]), IM(wa[i]));
+#else
+ ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+ IM(t2), RE(t2), RE(wa[i]), IM(wa[i]));
+#endif
+ }
+ }
+ }
+}
+
+
+static void passf3(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa1, const complex_t *wa2,
+ const int8_t isign)
+{
+ static real_t taur = FRAC_CONST(-0.5);
+ static real_t taui = FRAC_CONST(0.866025403784439);
+ uint16_t i, k, ac, ah;
+ complex_t c2, c3, d2, d3, t2;
+
+ if (ido == 1)
+ {
+ if (isign == 1)
+ {
+ for (k = 0; k < l1; k++)
+ {
+ ac = 3*k+1;
+ ah = k;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+1]);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+1]);
+ RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur);
+ IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur);
+
+ RE(ch[ah]) = RE(cc[ac-1]) + RE(t2);
+ IM(ch[ah]) = IM(cc[ac-1]) + IM(t2);
+
+ RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui);
+ IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui);
+
+ RE(ch[ah+l1]) = RE(c2) - IM(c3);
+ IM(ch[ah+l1]) = IM(c2) + RE(c3);
+ RE(ch[ah+2*l1]) = RE(c2) + IM(c3);
+ IM(ch[ah+2*l1]) = IM(c2) - RE(c3);
+ }
+ } else {
+ for (k = 0; k < l1; k++)
+ {
+ ac = 3*k+1;
+ ah = k;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+1]);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+1]);
+ RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),taur);
+ IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),taur);
+
+ RE(ch[ah]) = RE(cc[ac-1]) + RE(t2);
+ IM(ch[ah]) = IM(cc[ac-1]) + IM(t2);
+
+ RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+1])), taui);
+ IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+1])), taui);
+
+ RE(ch[ah+l1]) = RE(c2) + IM(c3);
+ IM(ch[ah+l1]) = IM(c2) - RE(c3);
+ RE(ch[ah+2*l1]) = RE(c2) - IM(c3);
+ IM(ch[ah+2*l1]) = IM(c2) + RE(c3);
+ }
+ }
+ } else {
+ if (isign == 1)
+ {
+ for (k = 0; k < l1; k++)
+ {
+ for (i = 0; i < ido; i++)
+ {
+ ac = i + (3*k+1)*ido;
+ ah = i + k * ido;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]);
+ RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]);
+ IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur);
+
+ RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2);
+ IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2);
+
+ RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui);
+ IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui);
+
+ RE(d2) = RE(c2) - IM(c3);
+ IM(d3) = IM(c2) - RE(c3);
+ RE(d3) = RE(c2) + IM(c3);
+ IM(d2) = IM(c2) + RE(c3);
+
+#if 1
+ ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+#else
+ ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+#endif
+ }
+ }
+ } else {
+ for (k = 0; k < l1; k++)
+ {
+ for (i = 0; i < ido; i++)
+ {
+ ac = i + (3*k+1)*ido;
+ ah = i + k * ido;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+ido]);
+ RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),taur);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+ido]);
+ IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),taur);
+
+ RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2);
+ IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2);
+
+ RE(c3) = MUL_F((RE(cc[ac]) - RE(cc[ac+ido])), taui);
+ IM(c3) = MUL_F((IM(cc[ac]) - IM(cc[ac+ido])), taui);
+
+ RE(d2) = RE(c2) + IM(c3);
+ IM(d3) = IM(c2) + RE(c3);
+ RE(d3) = RE(c2) - IM(c3);
+ IM(d2) = IM(c2) - RE(c3);
+
+#if 1
+ ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+#else
+ ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+#endif
+ }
+ }
+ }
+ }
+}
+
+
+static void passf4pos(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa1, const complex_t *wa2,
+ const complex_t *wa3)
+{
+ uint16_t i, k, ac, ah;
+
+ if (ido == 1)
+ {
+ for (k = 0; k < l1; k++)
+ {
+ complex_t t1, t2, t3, t4;
+
+ ac = 4*k;
+ ah = k;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+2]);
+ RE(t1) = RE(cc[ac]) - RE(cc[ac+2]);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+2]);
+ IM(t1) = IM(cc[ac]) - IM(cc[ac+2]);
+ RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]);
+ IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]);
+ IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]);
+ RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]);
+
+ RE(ch[ah]) = RE(t2) + RE(t3);
+ RE(ch[ah+2*l1]) = RE(t2) - RE(t3);
+
+ IM(ch[ah]) = IM(t2) + IM(t3);
+ IM(ch[ah+2*l1]) = IM(t2) - IM(t3);
+
+ RE(ch[ah+l1]) = RE(t1) + RE(t4);
+ RE(ch[ah+3*l1]) = RE(t1) - RE(t4);
+
+ IM(ch[ah+l1]) = IM(t1) + IM(t4);
+ IM(ch[ah+3*l1]) = IM(t1) - IM(t4);
+ }
+ } else {
+ for (k = 0; k < l1; k++)
+ {
+ ac = 4*k*ido;
+ ah = k*ido;
+
+ for (i = 0; i < ido; i++)
+ {
+ complex_t c2, c3, c4, t1, t2, t3, t4;
+
+ RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]);
+ RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]);
+ IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]);
+ IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]);
+ RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]);
+ IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]);
+ IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]);
+ RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]);
+
+ RE(c2) = RE(t1) + RE(t4);
+ RE(c4) = RE(t1) - RE(t4);
+
+ IM(c2) = IM(t1) + IM(t4);
+ IM(c4) = IM(t1) - IM(t4);
+
+ RE(ch[ah+i]) = RE(t2) + RE(t3);
+ RE(c3) = RE(t2) - RE(t3);
+
+ IM(ch[ah+i]) = IM(t2) + IM(t3);
+ IM(c3) = IM(t2) - IM(t3);
+
+#if 1
+ ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+ IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
+ IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
+ IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
+#else
+ ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+ RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
+ RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
+ RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
+#endif
+ }
+ }
+ }
+}
+
+static void passf4neg(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa1, const complex_t *wa2,
+ const complex_t *wa3)
+{
+ uint16_t i, k, ac, ah;
+
+ if (ido == 1)
+ {
+ for (k = 0; k < l1; k++)
+ {
+ complex_t t1, t2, t3, t4;
+
+ ac = 4*k;
+ ah = k;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+2]);
+ RE(t1) = RE(cc[ac]) - RE(cc[ac+2]);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+2]);
+ IM(t1) = IM(cc[ac]) - IM(cc[ac+2]);
+ RE(t3) = RE(cc[ac+1]) + RE(cc[ac+3]);
+ IM(t4) = RE(cc[ac+1]) - RE(cc[ac+3]);
+ IM(t3) = IM(cc[ac+3]) + IM(cc[ac+1]);
+ RE(t4) = IM(cc[ac+3]) - IM(cc[ac+1]);
+
+ RE(ch[ah]) = RE(t2) + RE(t3);
+ RE(ch[ah+2*l1]) = RE(t2) - RE(t3);
+
+ IM(ch[ah]) = IM(t2) + IM(t3);
+ IM(ch[ah+2*l1]) = IM(t2) - IM(t3);
+
+ RE(ch[ah+l1]) = RE(t1) - RE(t4);
+ RE(ch[ah+3*l1]) = RE(t1) + RE(t4);
+
+ IM(ch[ah+l1]) = IM(t1) - IM(t4);
+ IM(ch[ah+3*l1]) = IM(t1) + IM(t4);
+ }
+ } else {
+ for (k = 0; k < l1; k++)
+ {
+ ac = 4*k*ido;
+ ah = k*ido;
+
+ for (i = 0; i < ido; i++)
+ {
+ complex_t c2, c3, c4, t1, t2, t3, t4;
+
+ RE(t2) = RE(cc[ac+i]) + RE(cc[ac+i+2*ido]);
+ RE(t1) = RE(cc[ac+i]) - RE(cc[ac+i+2*ido]);
+ IM(t2) = IM(cc[ac+i]) + IM(cc[ac+i+2*ido]);
+ IM(t1) = IM(cc[ac+i]) - IM(cc[ac+i+2*ido]);
+ RE(t3) = RE(cc[ac+i+ido]) + RE(cc[ac+i+3*ido]);
+ IM(t4) = RE(cc[ac+i+ido]) - RE(cc[ac+i+3*ido]);
+ IM(t3) = IM(cc[ac+i+3*ido]) + IM(cc[ac+i+ido]);
+ RE(t4) = IM(cc[ac+i+3*ido]) - IM(cc[ac+i+ido]);
+
+ RE(c2) = RE(t1) - RE(t4);
+ RE(c4) = RE(t1) + RE(t4);
+
+ IM(c2) = IM(t1) - IM(t4);
+ IM(c4) = IM(t1) + IM(t4);
+
+ RE(ch[ah+i]) = RE(t2) + RE(t3);
+ RE(c3) = RE(t2) - RE(t3);
+
+ IM(ch[ah+i]) = IM(t2) + IM(t3);
+ IM(c3) = IM(t2) - IM(t3);
+
+#if 1
+ ComplexMult(&RE(ch[ah+i+l1*ido]), &IM(ch[ah+i+l1*ido]),
+ RE(c2), IM(c2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&RE(ch[ah+i+2*l1*ido]), &IM(ch[ah+i+2*l1*ido]),
+ RE(c3), IM(c3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&RE(ch[ah+i+3*l1*ido]), &IM(ch[ah+i+3*l1*ido]),
+ RE(c4), IM(c4), RE(wa3[i]), IM(wa3[i]));
+#else
+ ComplexMult(&IM(ch[ah+i+l1*ido]), &RE(ch[ah+i+l1*ido]),
+ IM(c2), RE(c2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&IM(ch[ah+i+2*l1*ido]), &RE(ch[ah+i+2*l1*ido]),
+ IM(c3), RE(c3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&IM(ch[ah+i+3*l1*ido]), &RE(ch[ah+i+3*l1*ido]),
+ IM(c4), RE(c4), RE(wa3[i]), IM(wa3[i]));
+#endif
+ }
+ }
+ }
+}
+
+static void passf5(const uint16_t ido, const uint16_t l1, const complex_t *cc,
+ complex_t *ch, const complex_t *wa1, const complex_t *wa2, const complex_t *wa3,
+ const complex_t *wa4, const int8_t isign)
+{
+ static real_t tr11 = FRAC_CONST(0.309016994374947);
+ static real_t ti11 = FRAC_CONST(0.951056516295154);
+ static real_t tr12 = FRAC_CONST(-0.809016994374947);
+ static real_t ti12 = FRAC_CONST(0.587785252292473);
+ uint16_t i, k, ac, ah;
+ complex_t c2, c3, c4, c5, d3, d4, d5, d2, t2, t3, t4, t5;
+
+ if (ido == 1)
+ {
+ if (isign == 1)
+ {
+ for (k = 0; k < l1; k++)
+ {
+ ac = 5*k + 1;
+ ah = k;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+3]);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+3]);
+ RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]);
+ IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]);
+ RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]);
+ IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]);
+ RE(t5) = RE(cc[ac]) - RE(cc[ac+3]);
+ IM(t5) = IM(cc[ac]) - IM(cc[ac+3]);
+
+ RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3);
+ IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3);
+
+ RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+ IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+ RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+ IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
+
+ ComplexMult(&RE(c5), &RE(c4),
+ ti11, ti12, RE(t5), RE(t4));
+ ComplexMult(&IM(c5), &IM(c4),
+ ti11, ti12, IM(t5), IM(t4));
+
+ RE(ch[ah+l1]) = RE(c2) - IM(c5);
+ IM(ch[ah+l1]) = IM(c2) + RE(c5);
+ RE(ch[ah+2*l1]) = RE(c3) - IM(c4);
+ IM(ch[ah+2*l1]) = IM(c3) + RE(c4);
+ RE(ch[ah+3*l1]) = RE(c3) + IM(c4);
+ IM(ch[ah+3*l1]) = IM(c3) - RE(c4);
+ RE(ch[ah+4*l1]) = RE(c2) + IM(c5);
+ IM(ch[ah+4*l1]) = IM(c2) - RE(c5);
+ }
+ } else {
+ for (k = 0; k < l1; k++)
+ {
+ ac = 5*k + 1;
+ ah = k;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+3]);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+3]);
+ RE(t3) = RE(cc[ac+1]) + RE(cc[ac+2]);
+ IM(t3) = IM(cc[ac+1]) + IM(cc[ac+2]);
+ RE(t4) = RE(cc[ac+1]) - RE(cc[ac+2]);
+ IM(t4) = IM(cc[ac+1]) - IM(cc[ac+2]);
+ RE(t5) = RE(cc[ac]) - RE(cc[ac+3]);
+ IM(t5) = IM(cc[ac]) - IM(cc[ac+3]);
+
+ RE(ch[ah]) = RE(cc[ac-1]) + RE(t2) + RE(t3);
+ IM(ch[ah]) = IM(cc[ac-1]) + IM(t2) + IM(t3);
+
+ RE(c2) = RE(cc[ac-1]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+ IM(c2) = IM(cc[ac-1]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+ RE(c3) = RE(cc[ac-1]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+ IM(c3) = IM(cc[ac-1]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
+
+ ComplexMult(&RE(c4), &RE(c5),
+ ti12, ti11, RE(t5), RE(t4));
+ ComplexMult(&IM(c4), &IM(c5),
+ ti12, ti12, IM(t5), IM(t4));
+
+ RE(ch[ah+l1]) = RE(c2) + IM(c5);
+ IM(ch[ah+l1]) = IM(c2) - RE(c5);
+ RE(ch[ah+2*l1]) = RE(c3) + IM(c4);
+ IM(ch[ah+2*l1]) = IM(c3) - RE(c4);
+ RE(ch[ah+3*l1]) = RE(c3) - IM(c4);
+ IM(ch[ah+3*l1]) = IM(c3) + RE(c4);
+ RE(ch[ah+4*l1]) = RE(c2) - IM(c5);
+ IM(ch[ah+4*l1]) = IM(c2) + RE(c5);
+ }
+ }
+ } else {
+ if (isign == 1)
+ {
+ for (k = 0; k < l1; k++)
+ {
+ for (i = 0; i < ido; i++)
+ {
+ ac = i + (k*5 + 1) * ido;
+ ah = i + k * ido;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]);
+ RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]);
+ IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]);
+ RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]);
+ IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]);
+ RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]);
+ IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]);
+
+ RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3);
+ IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3);
+
+ RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+ IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+ RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+ IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
+
+ ComplexMult(&RE(c5), &RE(c4),
+ ti11, ti12, RE(t5), RE(t4));
+ ComplexMult(&IM(c5), &IM(c4),
+ ti11, ti12, IM(t5), IM(t4));
+
+ IM(d2) = IM(c2) + RE(c5);
+ IM(d3) = IM(c3) + RE(c4);
+ RE(d4) = RE(c3) + IM(c4);
+ RE(d5) = RE(c2) + IM(c5);
+ RE(d2) = RE(c2) - IM(c5);
+ IM(d5) = IM(c2) - RE(c5);
+ RE(d3) = RE(c3) - IM(c4);
+ IM(d4) = IM(c3) - RE(c4);
+
+#if 1
+ ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]),
+ IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
+ ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
+ IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
+#else
+ ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]),
+ RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
+ ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
+ RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
+#endif
+ }
+ }
+ } else {
+ for (k = 0; k < l1; k++)
+ {
+ for (i = 0; i < ido; i++)
+ {
+ ac = i + (k*5 + 1) * ido;
+ ah = i + k * ido;
+
+ RE(t2) = RE(cc[ac]) + RE(cc[ac+3*ido]);
+ IM(t2) = IM(cc[ac]) + IM(cc[ac+3*ido]);
+ RE(t3) = RE(cc[ac+ido]) + RE(cc[ac+2*ido]);
+ IM(t3) = IM(cc[ac+ido]) + IM(cc[ac+2*ido]);
+ RE(t4) = RE(cc[ac+ido]) - RE(cc[ac+2*ido]);
+ IM(t4) = IM(cc[ac+ido]) - IM(cc[ac+2*ido]);
+ RE(t5) = RE(cc[ac]) - RE(cc[ac+3*ido]);
+ IM(t5) = IM(cc[ac]) - IM(cc[ac+3*ido]);
+
+ RE(ch[ah]) = RE(cc[ac-ido]) + RE(t2) + RE(t3);
+ IM(ch[ah]) = IM(cc[ac-ido]) + IM(t2) + IM(t3);
+
+ RE(c2) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr11) + MUL_F(RE(t3),tr12);
+ IM(c2) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr11) + MUL_F(IM(t3),tr12);
+ RE(c3) = RE(cc[ac-ido]) + MUL_F(RE(t2),tr12) + MUL_F(RE(t3),tr11);
+ IM(c3) = IM(cc[ac-ido]) + MUL_F(IM(t2),tr12) + MUL_F(IM(t3),tr11);
+
+ ComplexMult(&RE(c4), &RE(c5),
+ ti12, ti11, RE(t5), RE(t4));
+ ComplexMult(&IM(c4), &IM(c5),
+ ti12, ti12, IM(t5), IM(t4));
+
+ IM(d2) = IM(c2) - RE(c5);
+ IM(d3) = IM(c3) - RE(c4);
+ RE(d4) = RE(c3) - IM(c4);
+ RE(d5) = RE(c2) - IM(c5);
+ RE(d2) = RE(c2) + IM(c5);
+ IM(d5) = IM(c2) + RE(c5);
+ RE(d3) = RE(c3) + IM(c4);
+ IM(d4) = IM(c3) + RE(c4);
+
+#if 1
+ ComplexMult(&RE(ch[ah+l1*ido]), &IM(ch[ah+l1*ido]),
+ RE(d2), IM(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&RE(ch[ah+2*l1*ido]), &IM(ch[ah+2*l1*ido]),
+ RE(d3), IM(d3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&RE(ch[ah+3*l1*ido]), &IM(ch[ah+3*l1*ido]),
+ RE(d4), IM(d4), RE(wa3[i]), IM(wa3[i]));
+ ComplexMult(&RE(ch[ah+4*l1*ido]), &IM(ch[ah+4*l1*ido]),
+ RE(d5), IM(d5), RE(wa4[i]), IM(wa4[i]));
+#else
+ ComplexMult(&IM(ch[ah+l1*ido]), &RE(ch[ah+l1*ido]),
+ IM(d2), RE(d2), RE(wa1[i]), IM(wa1[i]));
+ ComplexMult(&IM(ch[ah+2*l1*ido]), &RE(ch[ah+2*l1*ido]),
+ IM(d3), RE(d3), RE(wa2[i]), IM(wa2[i]));
+ ComplexMult(&IM(ch[ah+3*l1*ido]), &RE(ch[ah+3*l1*ido]),
+ IM(d4), RE(d4), RE(wa3[i]), IM(wa3[i]));
+ ComplexMult(&IM(ch[ah+4*l1*ido]), &RE(ch[ah+4*l1*ido]),
+ IM(d5), RE(d5), RE(wa4[i]), IM(wa4[i]));
+#endif
+ }
+ }
+ }
+ }
+}
+
+
+/*----------------------------------------------------------------------
+ cfftf1, cfftf, cfftb, cffti1, cffti. Complex FFTs.
+ ----------------------------------------------------------------------*/
+
+static INLINE void cfftf1pos(uint16_t n, complex_t *c, complex_t *ch,
+ const uint16_t *ifac, const complex_t *wa,
+ const int8_t isign)
+{
+ uint16_t i;
+ uint16_t k1, l1, l2;
+ uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1;
+
+ nf = ifac[1];
+ na = 0;
+ l1 = 1;
+ iw = 0;
+
+ for (k1 = 2; k1 <= nf+1; k1++)
+ {
+ ip = ifac[k1];
+ l2 = ip*l1;
+ ido = n / l2;
+ idl1 = ido*l1;
+
+ switch (ip)
+ {
+ case 4:
+ ix2 = iw + ido;
+ ix3 = ix2 + ido;
+
+ if (na == 0)
+ passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
+ else
+ passf4pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
+
+ na = 1 - na;
+ break;
+ case 2:
+ if (na == 0)
+ passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
+ else
+ passf2pos((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
+
+ na = 1 - na;
+ break;
+ case 3:
+ ix2 = iw + ido;
+
+ if (na == 0)
+ passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
+ else
+ passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
+
+ na = 1 - na;
+ break;
+ case 5:
+ ix2 = iw + ido;
+ ix3 = ix2 + ido;
+ ix4 = ix3 + ido;
+
+ if (na == 0)
+ passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+ else
+ passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+
+ na = 1 - na;
+ break;
+ }
+
+ l1 = l2;
+ iw += (ip-1) * ido;
+ }
+
+ if (na == 0)
+ return;
+
+ for (i = 0; i < n; i++)
+ {
+ RE(c[i]) = RE(ch[i]);
+ IM(c[i]) = IM(ch[i]);
+ }
+}
+
+static INLINE void cfftf1neg(uint16_t n, complex_t *c, complex_t *ch,
+ const uint16_t *ifac, const complex_t *wa,
+ const int8_t isign)
+{
+ uint16_t i;
+ uint16_t k1, l1, l2;
+ uint16_t na, nf, ip, iw, ix2, ix3, ix4, ido, idl1;
+
+ nf = ifac[1];
+ na = 0;
+ l1 = 1;
+ iw = 0;
+
+ for (k1 = 2; k1 <= nf+1; k1++)
+ {
+ ip = ifac[k1];
+ l2 = ip*l1;
+ ido = n / l2;
+ idl1 = ido*l1;
+
+ switch (ip)
+ {
+ case 4:
+ ix2 = iw + ido;
+ ix3 = ix2 + ido;
+
+ if (na == 0)
+ passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3]);
+ else
+ passf4neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3]);
+
+ na = 1 - na;
+ break;
+ case 2:
+ if (na == 0)
+ passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw]);
+ else
+ passf2neg((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw]);
+
+ na = 1 - na;
+ break;
+ case 3:
+ ix2 = iw + ido;
+
+ if (na == 0)
+ passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], isign);
+ else
+ passf3((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], isign);
+
+ na = 1 - na;
+ break;
+ case 5:
+ ix2 = iw + ido;
+ ix3 = ix2 + ido;
+ ix4 = ix3 + ido;
+
+ if (na == 0)
+ passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)c, ch, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+ else
+ passf5((const uint16_t)ido, (const uint16_t)l1, (const complex_t*)ch, c, &wa[iw], &wa[ix2], &wa[ix3], &wa[ix4], isign);
+
+ na = 1 - na;
+ break;
+ }
+
+ l1 = l2;
+ iw += (ip-1) * ido;
+ }
+
+ if (na == 0)
+ return;
+
+ for (i = 0; i < n; i++)
+ {
+ RE(c[i]) = RE(ch[i]);
+ IM(c[i]) = IM(ch[i]);
+ }
+}
+
+void cfftf(cfft_info *cfft, complex_t *c)
+{
+ cfftf1neg(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, -1);
+}
+
+void cfftb(cfft_info *cfft, complex_t *c)
+{
+ cfftf1pos(cfft->n, c, cfft->work, (const uint16_t*)cfft->ifac, (const complex_t*)cfft->tab, +1);
+}
+
+static void cffti1(uint16_t n, complex_t *wa, uint16_t *ifac)
+{
+ static uint16_t ntryh[4] = {3, 4, 2, 5};
+#ifndef FIXED_POINT
+ real_t arg, argh, argld, fi;
+ uint16_t ido, ipm;
+ uint16_t i1, k1, l1, l2;
+ uint16_t ld, ii, ip;
+#endif
+ uint16_t ntry = 0, i, j;
+ uint16_t ib;
+ uint16_t nf, nl, nq, nr;
+
+ nl = n;
+ nf = 0;
+ j = 0;
+
+startloop:
+ j++;
+
+ if (j <= 4)
+ ntry = ntryh[j-1];
+ else
+ ntry += 2;
+
+ do
+ {
+ nq = nl / ntry;
+ nr = nl - ntry*nq;
+
+ if (nr != 0)
+ goto startloop;
+
+ nf++;
+ ifac[nf+1] = ntry;
+ nl = nq;
+
+ if (ntry == 2 && nf != 1)
+ {
+ for (i = 2; i <= nf; i++)
+ {
+ ib = nf - i + 2;
+ ifac[ib+1] = ifac[ib];
+ }
+ ifac[2] = 2;
+ }
+ } while (nl != 1);
+
+ ifac[0] = n;
+ ifac[1] = nf;
+
+#ifndef FIXED_POINT
+ argh = (real_t)2.0*(real_t)M_PI / (real_t)n;
+ i = 0;
+ l1 = 1;
+
+ for (k1 = 1; k1 <= nf; k1++)
+ {
+ ip = ifac[k1+1];
+ ld = 0;
+ l2 = l1*ip;
+ ido = n / l2;
+ ipm = ip - 1;
+
+ for (j = 0; j < ipm; j++)
+ {
+ i1 = i;
+ RE(wa[i]) = 1.0;
+ IM(wa[i]) = 0.0;
+ ld += l1;
+ fi = 0;
+ argld = ld*argh;
+
+ for (ii = 0; ii < ido; ii++)
+ {
+ i++;
+ fi++;
+ arg = fi * argld;
+ RE(wa[i]) = (real_t)cos(arg);
+#if 1
+ IM(wa[i]) = (real_t)sin(arg);
+#else
+ IM(wa[i]) = (real_t)-sin(arg);
+#endif
+ }
+
+ if (ip > 5)
+ {
+ RE(wa[i1]) = RE(wa[i]);
+ IM(wa[i1]) = IM(wa[i]);
+ }
+ }
+ l1 = l2;
+ }
+#endif
+}
+
+cfft_info *cffti(uint16_t n)
+{
+ cfft_info *cfft = (cfft_info*)faad_malloc(sizeof(cfft_info));
+
+ cfft->n = n;
+ cfft->work = (complex_t*)faad_malloc(n*sizeof(complex_t));
+
+#ifndef FIXED_POINT
+ cfft->tab = (complex_t*)faad_malloc(n*sizeof(complex_t));
+
+ cffti1(n, cfft->tab, cfft->ifac);
+#else
+ cffti1(n, NULL, cfft->ifac);
+
+ switch (n)
+ {
+ case 64: cfft->tab = (complex_t*)cfft_tab_64; break;
+ case 512: cfft->tab = (complex_t*)cfft_tab_512; break;
+#ifdef LD_DEC
+ case 256: cfft->tab = (complex_t*)cfft_tab_256; break;
+#endif
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ case 60: cfft->tab = (complex_t*)cfft_tab_60; break;
+ case 480: cfft->tab = (complex_t*)cfft_tab_480; break;
+#ifdef LD_DEC
+ case 240: cfft->tab = (complex_t*)cfft_tab_240; break;
+#endif
+#endif
+ case 128: cfft->tab = (complex_t*)cfft_tab_128; break;
+ }
+#endif
+
+ return cfft;
+}
+
+void cfftu(cfft_info *cfft)
+{
+ if (cfft->work) faad_free(cfft->work);
+#ifndef FIXED_POINT
+ if (cfft->tab) faad_free(cfft->tab);
+#endif
+
+ if (cfft) faad_free(cfft);
+}
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/cfft.h b/src/filters/transform/mpadecfilter/faad2/libfaad/cfft.h
new file mode 100644
index 000000000..0cdbd9af3
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/cfft.h
@@ -0,0 +1,58 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: cfft.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __CFFT_H__
+#define __CFFT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct
+{
+ uint16_t n;
+ uint16_t ifac[15];
+ complex_t *work;
+ complex_t *tab;
+} cfft_info;
+
+
+void cfftf(cfft_info *cfft, complex_t *c);
+void cfftb(cfft_info *cfft, complex_t *c);
+cfft_info *cffti(uint16_t n);
+void cfftu(cfft_info *cfft);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/cfft_tab.h b/src/filters/transform/mpadecfilter/faad2/libfaad/cfft_tab.h
new file mode 100644
index 000000000..a7ca4112e
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/cfft_tab.h
@@ -0,0 +1,1825 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: cfft_tab.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __CFFT_TAB_H__
+#define __CFFT_TAB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef FIXED_POINT
+
+ALIGN static const complex_t cfft_tab_512[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999924719333649), FRAC_CONST(0.012271538376808) },
+ { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
+ { FRAC_CONST(0.999322354793549), FRAC_CONST(0.036807224154472) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.998118102550507), FRAC_CONST(0.061320740729570) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.996312618255615), FRAC_CONST(0.085797317326069) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.993906974792480), FRAC_CONST(0.110222205519676) },
+ { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
+ { FRAC_CONST(0.990902662277222), FRAC_CONST(0.134580716490746) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.987301409244537), FRAC_CONST(0.158858150243759) },
+ { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
+ { FRAC_CONST(0.983105480670929), FRAC_CONST(0.183039888739586) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.978317379951477), FRAC_CONST(0.207111388444901) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.972939968109131), FRAC_CONST(0.231058120727539) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.966976463794708), FRAC_CONST(0.254865676164627) },
+ { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
+ { FRAC_CONST(0.960430502891541), FRAC_CONST(0.278519690036774) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.953306019306183), FRAC_CONST(0.302005946636200) },
+ { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
+ { FRAC_CONST(0.945607304573059), FRAC_CONST(0.325310319662094) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.937339007854462), FRAC_CONST(0.348418682813644) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.928506076335907), FRAC_CONST(0.371317207813263) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.919113874435425), FRAC_CONST(0.393992066383362) },
+ { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
+ { FRAC_CONST(0.909167945384979), FRAC_CONST(0.416429579257965) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.898674488067627), FRAC_CONST(0.438616245985031) },
+ { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
+ { FRAC_CONST(0.887639641761780), FRAC_CONST(0.460538715124130) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.876070082187653), FRAC_CONST(0.482183754444122) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.863972842693329), FRAC_CONST(0.503538370132446) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.851355195045471), FRAC_CONST(0.524589717388153) },
+ { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
+ { FRAC_CONST(0.838224709033966), FRAC_CONST(0.545324981212616) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.824589252471924), FRAC_CONST(0.565731823444366) },
+ { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
+ { FRAC_CONST(0.810457170009613), FRAC_CONST(0.585797905921936) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.795836925506592), FRAC_CONST(0.605511009693146) },
+ { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
+ { FRAC_CONST(0.780737221240997), FRAC_CONST(0.624859511852264) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.765167236328125), FRAC_CONST(0.643831551074982) },
+ { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(0.749136388301849), FRAC_CONST(0.662415802478790) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.732654273509979), FRAC_CONST(0.680601000785828) },
+ { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
+ { FRAC_CONST(0.715730786323547), FRAC_CONST(0.698376297950745) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.698376238346100), FRAC_CONST(0.715730845928192) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.680601000785828), FRAC_CONST(0.732654273509979) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.662415742874146), FRAC_CONST(0.749136388301849) },
+ { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
+ { FRAC_CONST(0.643831551074982), FRAC_CONST(0.765167295932770) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.624859452247620), FRAC_CONST(0.780737280845642) },
+ { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
+ { FRAC_CONST(0.605511009693146), FRAC_CONST(0.795836925506592) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.585797846317291), FRAC_CONST(0.810457170009613) },
+ { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.565731823444366), FRAC_CONST(0.824589312076569) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.545324981212616), FRAC_CONST(0.838224709033966) },
+ { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
+ { FRAC_CONST(0.524589657783508), FRAC_CONST(0.851355195045471) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.503538429737091), FRAC_CONST(0.863972842693329) },
+ { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
+ { FRAC_CONST(0.482183724641800), FRAC_CONST(0.876070141792297) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.460538715124130), FRAC_CONST(0.887639641761780) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.438616186380386), FRAC_CONST(0.898674488067627) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.416429549455643), FRAC_CONST(0.909168004989624) },
+ { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
+ { FRAC_CONST(0.393991947174072), FRAC_CONST(0.919113874435425) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.371317148208618), FRAC_CONST(0.928506076335907) },
+ { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
+ { FRAC_CONST(0.348418682813644), FRAC_CONST(0.937339007854462) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.325310230255127), FRAC_CONST(0.945607364177704) },
+ { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
+ { FRAC_CONST(0.302005946636200), FRAC_CONST(0.953306019306183) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.278519600629807), FRAC_CONST(0.960430562496185) },
+ { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(0.254865646362305), FRAC_CONST(0.966976463794708) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.231058135628700), FRAC_CONST(0.972939968109131) },
+ { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
+ { FRAC_CONST(0.207111328840256), FRAC_CONST(0.978317379951477) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.183039888739586), FRAC_CONST(0.983105480670929) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.158858075737953), FRAC_CONST(0.987301409244537) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.134580686688423), FRAC_CONST(0.990902662277222) },
+ { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
+ { FRAC_CONST(0.110222116112709), FRAC_CONST(0.993906974792480) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.085797272622585), FRAC_CONST(0.996312618255615) },
+ { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
+ { FRAC_CONST(0.061320748180151), FRAC_CONST(0.998118102550507) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(0.036807164549828), FRAC_CONST(0.999322414398193) },
+ { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(0.012271529063582), FRAC_CONST(0.999924719333649) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.012271616607904), FRAC_CONST(0.999924719333649) },
+ { FRAC_CONST(-0.024541223421693), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(-0.036807250231504), FRAC_CONST(0.999322354793549) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.061320833861828), FRAC_CONST(0.998118102550507) },
+ { FRAC_CONST(-0.073564574122429), FRAC_CONST(0.997290432453156) },
+ { FRAC_CONST(-0.085797362029552), FRAC_CONST(0.996312618255615) },
+ { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.110222205519676), FRAC_CONST(0.993906974792480) },
+ { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
+ { FRAC_CONST(-0.134580776095390), FRAC_CONST(0.990902602672577) },
+ { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(-0.158858165144920), FRAC_CONST(0.987301409244537) },
+ { FRAC_CONST(-0.170961946249008), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(-0.183039978146553), FRAC_CONST(0.983105480670929) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.207111418247223), FRAC_CONST(0.978317379951477) },
+ { FRAC_CONST(-0.219101309776306), FRAC_CONST(0.975702106952667) },
+ { FRAC_CONST(-0.231058210134506), FRAC_CONST(0.972939908504486) },
+ { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(-0.254865705966949), FRAC_CONST(0.966976463794708) },
+ { FRAC_CONST(-0.266712844371796), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(-0.278519690036774), FRAC_CONST(0.960430502891541) },
+ { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+ { FRAC_CONST(-0.302006036043167), FRAC_CONST(0.953306019306183) },
+ { FRAC_CONST(-0.313681721687317), FRAC_CONST(0.949528157711029) },
+ { FRAC_CONST(-0.325310319662094), FRAC_CONST(0.945607304573059) },
+ { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.348418772220612), FRAC_CONST(0.937338948249817) },
+ { FRAC_CONST(-0.359895050525665), FRAC_CONST(0.932992815971375) },
+ { FRAC_CONST(-0.371317237615585), FRAC_CONST(0.928506076335907) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.393992036581039), FRAC_CONST(0.919113874435425) },
+ { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
+ { FRAC_CONST(-0.416429519653320), FRAC_CONST(0.909168004989624) },
+ { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(-0.438616245985031), FRAC_CONST(0.898674428462982) },
+ { FRAC_CONST(-0.449611365795136), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(-0.460538804531097), FRAC_CONST(0.887639582157135) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.482183903455734), FRAC_CONST(0.876070022583008) },
+ { FRAC_CONST(-0.492898166179657), FRAC_CONST(0.870087027549744) },
+ { FRAC_CONST(-0.503538370132446), FRAC_CONST(0.863972842693329) },
+ { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+ { FRAC_CONST(-0.524589717388153), FRAC_CONST(0.851355135440826) },
+ { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
+ { FRAC_CONST(-0.545325100421906), FRAC_CONST(0.838224649429321) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.565731763839722), FRAC_CONST(0.824589312076569) },
+ { FRAC_CONST(-0.575808167457581), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(-0.585797905921936), FRAC_CONST(0.810457170009613) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.605511128902435), FRAC_CONST(0.795836865901947) },
+ { FRAC_CONST(-0.615231692790985), FRAC_CONST(0.788346350193024) },
+ { FRAC_CONST(-0.624859631061554), FRAC_CONST(0.780737102031708) },
+ { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+ { FRAC_CONST(-0.643831551074982), FRAC_CONST(0.765167236328125) },
+ { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
+ { FRAC_CONST(-0.662415802478790), FRAC_CONST(0.749136328697205) },
+ { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+ { FRAC_CONST(-0.680601119995117), FRAC_CONST(0.732654154300690) },
+ { FRAC_CONST(-0.689540684223175), FRAC_CONST(0.724246978759766) },
+ { FRAC_CONST(-0.698376238346100), FRAC_CONST(0.715730845928192) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.715730845928192), FRAC_CONST(0.698376238346100) },
+ { FRAC_CONST(-0.724247157573700), FRAC_CONST(0.689540505409241) },
+ { FRAC_CONST(-0.732654333114624), FRAC_CONST(0.680600941181183) },
+ { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+ { FRAC_CONST(-0.749136507511139), FRAC_CONST(0.662415623664856) },
+ { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(-0.765167295932770), FRAC_CONST(0.643831551074982) },
+ { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+ { FRAC_CONST(-0.780737280845642), FRAC_CONST(0.624859452247620) },
+ { FRAC_CONST(-0.788346469402313), FRAC_CONST(0.615231513977051) },
+ { FRAC_CONST(-0.795836985111237), FRAC_CONST(0.605510950088501) },
+ { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+ { FRAC_CONST(-0.810457170009613), FRAC_CONST(0.585797846317291) },
+ { FRAC_CONST(-0.817584812641144), FRAC_CONST(0.575808167457581) },
+ { FRAC_CONST(-0.824589312076569), FRAC_CONST(0.565731763839722) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.838224768638611), FRAC_CONST(0.545324862003326) },
+ { FRAC_CONST(-0.844853639602661), FRAC_CONST(0.534997463226318) },
+ { FRAC_CONST(-0.851355314254761), FRAC_CONST(0.524589538574219) },
+ { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(-0.863972842693329), FRAC_CONST(0.503538370132446) },
+ { FRAC_CONST(-0.870087027549744), FRAC_CONST(0.492898136377335) },
+ { FRAC_CONST(-0.876070141792297), FRAC_CONST(0.482183694839478) },
+ { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+ { FRAC_CONST(-0.887639701366425), FRAC_CONST(0.460538566112518) },
+ { FRAC_CONST(-0.893224298954010), FRAC_CONST(0.449611365795136) },
+ { FRAC_CONST(-0.898674488067627), FRAC_CONST(0.438616245985031) },
+ { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+ { FRAC_CONST(-0.909168004989624), FRAC_CONST(0.416429489850998) },
+ { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
+ { FRAC_CONST(-0.919113874435425), FRAC_CONST(0.393991917371750) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.928506076335907), FRAC_CONST(0.371317237615585) },
+ { FRAC_CONST(-0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(-0.937339007854462), FRAC_CONST(0.348418653011322) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.945607364177704), FRAC_CONST(0.325310200452805) },
+ { FRAC_CONST(-0.949528217315674), FRAC_CONST(0.313681602478027) },
+ { FRAC_CONST(-0.953306078910828), FRAC_CONST(0.302005797624588) },
+ { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+ { FRAC_CONST(-0.960430502891541), FRAC_CONST(0.278519690036774) },
+ { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
+ { FRAC_CONST(-0.966976463794708), FRAC_CONST(0.254865586757660) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+ { FRAC_CONST(-0.972939968109131), FRAC_CONST(0.231057971715927) },
+ { FRAC_CONST(-0.975702166557312), FRAC_CONST(0.219101071357727) },
+ { FRAC_CONST(-0.978317379951477), FRAC_CONST(0.207111403346062) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.983105480670929), FRAC_CONST(0.183039844036102) },
+ { FRAC_CONST(-0.985277652740479), FRAC_CONST(0.170961812138557) },
+ { FRAC_CONST(-0.987301409244537), FRAC_CONST(0.158858031034470) },
+ { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+ { FRAC_CONST(-0.990902662277222), FRAC_CONST(0.134580522775650) },
+ { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
+ { FRAC_CONST(-0.993906974792480), FRAC_CONST(0.110222198069096) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+ { FRAC_CONST(-0.996312618255615), FRAC_CONST(0.085797227919102) },
+ { FRAC_CONST(-0.997290492057800), FRAC_CONST(0.073564447462559) },
+ { FRAC_CONST(-0.998118102550507), FRAC_CONST(0.061320584267378) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+ { FRAC_CONST(-0.999322354793549), FRAC_CONST(0.036807239055634) },
+ { FRAC_CONST(-0.999698817729950), FRAC_CONST(0.024541210383177) },
+ { FRAC_CONST(-0.999924719333649), FRAC_CONST(0.012271485291421) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+ { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+ { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+ { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+ { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+ { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) },
+ { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) },
+ { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) },
+ { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) },
+ { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) },
+ { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) },
+ { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) },
+ { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) },
+ { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) },
+ { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) },
+ { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) },
+ { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) },
+ { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ALIGN static const complex_t cfft_tab_480[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999914348125458), FRAC_CONST(0.013089596293867) },
+ { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
+ { FRAC_CONST(0.999229013919830), FRAC_CONST(0.039259817451239) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.997858941555023), FRAC_CONST(0.065403133630753) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.995804905891418), FRAC_CONST(0.091501623392105) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.993068456649780), FRAC_CONST(0.117537401616573) },
+ { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
+ { FRAC_CONST(0.989651381969452), FRAC_CONST(0.143492624163628) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.985556066036224), FRAC_CONST(0.169349506497383) },
+ { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.975342333316803), FRAC_CONST(0.220697447657585) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.969230890274048), FRAC_CONST(0.246153295040131) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.962455213069916), FRAC_CONST(0.271440446376801) },
+ { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
+ { FRAC_CONST(0.955019950866699), FRAC_CONST(0.296541601419449) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.946930110454559), FRAC_CONST(0.321439445018768) },
+ { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
+ { FRAC_CONST(0.938191354274750), FRAC_CONST(0.346117079257965) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.928809583187103), FRAC_CONST(0.370557427406311) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.918791174888611), FRAC_CONST(0.394743889570236) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.908143162727356), FRAC_CONST(0.418659746646881) },
+ { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
+ { FRAC_CONST(0.896872758865356), FRAC_CONST(0.442288726568222) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.884987652301788), FRAC_CONST(0.465614527463913) },
+ { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
+ { FRAC_CONST(0.872496008872986), FRAC_CONST(0.488621264696121) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.859406411647797), FRAC_CONST(0.511293113231659) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.845727801322937), FRAC_CONST(0.533614516258240) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
+ { FRAC_CONST(0.816641509532928), FRAC_CONST(0.577145218849182) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.801253795623779), FRAC_CONST(0.598324596881866) },
+ { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
+ { FRAC_CONST(0.785316884517670), FRAC_CONST(0.619093954563141) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.768841803073883), FRAC_CONST(0.639438986778259) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.751839756965637), FRAC_CONST(0.659345865249634) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.734322488307953), FRAC_CONST(0.678800761699677) },
+ { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
+ { FRAC_CONST(0.716301918029785), FRAC_CONST(0.697790503501892) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.697790443897247), FRAC_CONST(0.716301977634430) },
+ { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
+ { FRAC_CONST(0.678800702095032), FRAC_CONST(0.734322547912598) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.659345805644989), FRAC_CONST(0.751839816570282) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.639438986778259), FRAC_CONST(0.768841862678528) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.619093954563141), FRAC_CONST(0.785316944122314) },
+ { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
+ { FRAC_CONST(0.598324596881866), FRAC_CONST(0.801253855228424) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.577145159244537), FRAC_CONST(0.816641569137573) },
+ { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.533614516258240), FRAC_CONST(0.845727801322937) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.511293113231659), FRAC_CONST(0.859406411647797) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.488621175289154), FRAC_CONST(0.872496068477631) },
+ { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(0.465614467859268), FRAC_CONST(0.884987652301788) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.442288666963577), FRAC_CONST(0.896872758865356) },
+ { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
+ { FRAC_CONST(0.418659746646881), FRAC_CONST(0.908143162727356) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.394743800163269), FRAC_CONST(0.918791234493256) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.370557397603989), FRAC_CONST(0.928809583187103) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.346117049455643), FRAC_CONST(0.938191354274750) },
+ { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(0.321439474821091), FRAC_CONST(0.946930110454559) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.296541512012482), FRAC_CONST(0.955019950866699) },
+ { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
+ { FRAC_CONST(0.271440386772156), FRAC_CONST(0.962455272674561) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.246153265237808), FRAC_CONST(0.969230890274048) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.220697447657585), FRAC_CONST(0.975342333316803) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(0.169349446892738), FRAC_CONST(0.985556066036224) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.143492594361305), FRAC_CONST(0.989651381969452) },
+ { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(0.117537401616573), FRAC_CONST(0.993068456649780) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.091501533985138), FRAC_CONST(0.995804905891418) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(0.065403074026108), FRAC_CONST(0.997858941555023) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(0.039259787648916), FRAC_CONST(0.999229013919830) },
+ { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(0.013089597225189), FRAC_CONST(0.999914348125458) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.013089684769511), FRAC_CONST(0.999914348125458) },
+ { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.039259877055883), FRAC_CONST(0.999229013919830) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.065403163433075), FRAC_CONST(0.997858941555023) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.091501623392105), FRAC_CONST(0.995804905891418) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.117537491023541), FRAC_CONST(0.993068456649780) },
+ { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(-0.143492683768272), FRAC_CONST(0.989651381969452) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.169349536299706), FRAC_CONST(0.985556066036224) },
+ { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.220697522163391), FRAC_CONST(0.975342273712158) },
+ { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(-0.246153354644775), FRAC_CONST(0.969230890274048) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.271440476179123), FRAC_CONST(0.962455213069916) },
+ { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
+ { FRAC_CONST(-0.296541571617126), FRAC_CONST(0.955019950866699) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.321439564228058), FRAC_CONST(0.946930110454559) },
+ { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(-0.346117109060287), FRAC_CONST(0.938191294670105) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.370557487010956), FRAC_CONST(0.928809523582459) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.394743859767914), FRAC_CONST(0.918791234493256) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.418659836053848), FRAC_CONST(0.908143103122711) },
+ { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
+ { FRAC_CONST(-0.442288637161255), FRAC_CONST(0.896872758865356) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.465614557266235), FRAC_CONST(0.884987592697144) },
+ { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(-0.488621354103088), FRAC_CONST(0.872495949268341) },
+ { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+ { FRAC_CONST(-0.511293053627014), FRAC_CONST(0.859406411647797) },
+ { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
+ { FRAC_CONST(-0.533614575862885), FRAC_CONST(0.845727801322937) },
+ { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.566406309604645), FRAC_CONST(0.824126124382019) },
+ { FRAC_CONST(-0.577145218849182), FRAC_CONST(0.816641569137573) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.598324656486511), FRAC_CONST(0.801253736019135) },
+ { FRAC_CONST(-0.608761429786682), FRAC_CONST(0.793353319168091) },
+ { FRAC_CONST(-0.619093894958496), FRAC_CONST(0.785316944122314) },
+ { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
+ { FRAC_CONST(-0.639439046382904), FRAC_CONST(0.768841803073883) },
+ { FRAC_CONST(-0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(-0.659345924854279), FRAC_CONST(0.751839697360992) },
+ { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+ { FRAC_CONST(-0.678800761699677), FRAC_CONST(0.734322488307953) },
+ { FRAC_CONST(-0.688354671001434), FRAC_CONST(0.725374281406403) },
+ { FRAC_CONST(-0.697790503501892), FRAC_CONST(0.716301858425140) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.716302037239075), FRAC_CONST(0.697790324687958) },
+ { FRAC_CONST(-0.725374460220337), FRAC_CONST(0.688354492187500) },
+ { FRAC_CONST(-0.734322547912598), FRAC_CONST(0.678800702095032) },
+ { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
+ { FRAC_CONST(-0.751839876174927), FRAC_CONST(0.659345746040344) },
+ { FRAC_CONST(-0.760406017303467), FRAC_CONST(0.649448037147522) },
+ { FRAC_CONST(-0.768841803073883), FRAC_CONST(0.639439046382904) },
+ { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
+ { FRAC_CONST(-0.785316944122314), FRAC_CONST(0.619093894958496) },
+ { FRAC_CONST(-0.793353319168091), FRAC_CONST(0.608761429786682) },
+ { FRAC_CONST(-0.801253914833069), FRAC_CONST(0.598324477672577) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.816641569137573), FRAC_CONST(0.577145218849182) },
+ { FRAC_CONST(-0.824126303195953), FRAC_CONST(0.566406130790710) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(-0.845727920532227), FRAC_CONST(0.533614337444305) },
+ { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
+ { FRAC_CONST(-0.859406411647797), FRAC_CONST(0.511293053627014) },
+ { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
+ { FRAC_CONST(-0.872496068477631), FRAC_CONST(0.488621145486832) },
+ { FRAC_CONST(-0.878817141056061), FRAC_CONST(0.477158725261688) },
+ { FRAC_CONST(-0.884987652301788), FRAC_CONST(0.465614557266235) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.896872758865356), FRAC_CONST(0.442288637161255) },
+ { FRAC_CONST(-0.902585268020630), FRAC_CONST(0.430511116981506) },
+ { FRAC_CONST(-0.908143222332001), FRAC_CONST(0.418659597635269) },
+ { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+ { FRAC_CONST(-0.918791234493256), FRAC_CONST(0.394743859767914) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.928809583187103), FRAC_CONST(0.370557337999344) },
+ { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
+ { FRAC_CONST(-0.938191413879395), FRAC_CONST(0.346116900444031) },
+ { FRAC_CONST(-0.942641556262970), FRAC_CONST(0.333806753158569) },
+ { FRAC_CONST(-0.946930170059204), FRAC_CONST(0.321439445018768) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.955020010471344), FRAC_CONST(0.296541452407837) },
+ { FRAC_CONST(-0.958819746971130), FRAC_CONST(0.284015297889709) },
+ { FRAC_CONST(-0.962455213069916), FRAC_CONST(0.271440476179123) },
+ { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
+ { FRAC_CONST(-0.969230949878693), FRAC_CONST(0.246153235435486) },
+ { FRAC_CONST(-0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(-0.975342333316803), FRAC_CONST(0.220697283744812) },
+ { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.983254909515381), FRAC_CONST(0.182235360145569) },
+ { FRAC_CONST(-0.985556066036224), FRAC_CONST(0.169349402189255) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(-0.989651441574097), FRAC_CONST(0.143492430448532) },
+ { FRAC_CONST(-0.991444885730743), FRAC_CONST(0.130526080727577) },
+ { FRAC_CONST(-0.993068456649780), FRAC_CONST(0.117537356913090) },
+ { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
+ { FRAC_CONST(-0.995804965496063), FRAC_CONST(0.091501489281654) },
+ { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
+ { FRAC_CONST(-0.997858941555023), FRAC_CONST(0.065403148531914) },
+ { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
+ { FRAC_CONST(-0.999229013919830), FRAC_CONST(0.039259742945433) },
+ { FRAC_CONST(-0.999657332897186), FRAC_CONST(0.026176951825619) },
+ { FRAC_CONST(-0.999914348125458), FRAC_CONST(0.013089434243739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+ { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
+ { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
+ { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+ { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
+ { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
+ { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
+ { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
+ { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) },
+ { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) },
+ { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+ { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
+ { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) },
+ { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) },
+ { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) },
+ { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
+ { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) },
+ { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) },
+ { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) },
+ { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) },
+ { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) },
+ { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
+ { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) },
+ { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) },
+ { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
+ { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) },
+ { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) },
+ { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
+};
+#endif
+
+ALIGN static const complex_t cfft_tab_64[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ALIGN static const complex_t cfft_tab_60[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+ { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+ { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+ { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
+ { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
+ { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
+};
+#endif
+
+#ifdef LD_DEC
+
+ALIGN static const complex_t cfft_tab_256[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999698817729950), FRAC_CONST(0.024541229009628) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.992479562759399), FRAC_CONST(0.122410677373409) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.985277652740479), FRAC_CONST(0.170961901545525) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.963776051998138), FRAC_CONST(0.266712784767151) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.949528157711029), FRAC_CONST(0.313681751489639) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.914209723472595), FRAC_CONST(0.405241340398788) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.893224298954010), FRAC_CONST(0.449611335992813) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.844853579998016), FRAC_CONST(0.534997642040253) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.817584812641144), FRAC_CONST(0.575808227062225) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.788346409797668), FRAC_CONST(0.615231633186340) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.724247097969055), FRAC_CONST(0.689540565013886) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.653172791004181), FRAC_CONST(0.757208883762360) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.615231573581696), FRAC_CONST(0.788346409797668) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.575808167457581), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.534997642040253), FRAC_CONST(0.844853579998016) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.492898195981979), FRAC_CONST(0.870086967945099) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.405241280794144), FRAC_CONST(0.914209783077240) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.359894961118698), FRAC_CONST(0.932992815971375) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.313681662082672), FRAC_CONST(0.949528217315674) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.266712754964828), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.219101220369339), FRAC_CONST(0.975702106952667) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.122410625219345), FRAC_CONST(0.992479562759399) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.073564492166042), FRAC_CONST(0.997290432453156) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(0.024541135877371), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+ { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+ { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+ { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+ { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+ { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.997290432453156), FRAC_CONST(0.073564566671848) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.975702106952667), FRAC_CONST(0.219101235270500) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.932992815971375), FRAC_CONST(0.359895050525665) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.870086967945099), FRAC_CONST(0.492898225784302) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.788346469402313), FRAC_CONST(0.615231573581696) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.689540505409241), FRAC_CONST(0.724247097969055) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.575808227062225), FRAC_CONST(0.817584812641144) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.449611306190491), FRAC_CONST(0.893224298954010) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.313681751489639), FRAC_CONST(0.949528157711029) },
+ { FRAC_CONST(0.242980241775513), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.170961856842041), FRAC_CONST(0.985277652740479) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.024541255086660), FRAC_CONST(0.999698817729950) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.122410707175732), FRAC_CONST(0.992479503154755) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.266712725162506), FRAC_CONST(0.963776051998138) },
+ { FRAC_CONST(-0.336889803409576), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.405241340398788), FRAC_CONST(0.914209723472595) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.534997701644897), FRAC_CONST(0.844853520393372) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.653172850608826), FRAC_CONST(0.757208824157715) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.757208824157715), FRAC_CONST(0.653172850608826) },
+ { FRAC_CONST(-0.803207516670227), FRAC_CONST(0.595699369907379) },
+ { FRAC_CONST(-0.844853520393372), FRAC_CONST(0.534997701644897) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.914209783077240), FRAC_CONST(0.405241221189499) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.963776051998138), FRAC_CONST(0.266712725162506) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.992479503154755), FRAC_CONST(0.122410699725151) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067724496126) },
+ { FRAC_CONST(-0.999698817729950), FRAC_CONST(-0.024541147053242) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.985277652740479), FRAC_CONST(-0.170961990952492) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(-0.242980241775513) },
+ { FRAC_CONST(-0.949528157711029), FRAC_CONST(-0.313681781291962) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.893224298954010), FRAC_CONST(-0.449611306190491) },
+ { FRAC_CONST(-0.857728660106659), FRAC_CONST(-0.514102697372437) },
+ { FRAC_CONST(-0.817584872245789), FRAC_CONST(-0.575808107852936) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.724247038364410), FRAC_CONST(-0.689540624618530) },
+ { FRAC_CONST(-0.671558916568756), FRAC_CONST(-0.740951180458069) },
+ { FRAC_CONST(-0.615231573581696), FRAC_CONST(-0.788346469402313) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.492898195981979), FRAC_CONST(-0.870086967945099) },
+ { FRAC_CONST(-0.427554935216904), FRAC_CONST(-0.903989374637604) },
+ { FRAC_CONST(-0.359895110130310), FRAC_CONST(-0.932992756366730) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(-0.219101369380951), FRAC_CONST(-0.975702106952667) },
+ { FRAC_CONST(-0.146730408072472), FRAC_CONST(-0.989176511764526) },
+ { FRAC_CONST(-0.073564760386944), FRAC_CONST(-0.997290432453156) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ALIGN static const complex_t cfft_tab_240[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.999657332897186), FRAC_CONST(0.026176949962974) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.991444885730743), FRAC_CONST(0.130526199936867) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.983254909515381), FRAC_CONST(0.182235524058342) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.958819746971130), FRAC_CONST(0.284015357494354) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.942641496658325), FRAC_CONST(0.333806872367859) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.902585268020630), FRAC_CONST(0.430511116981506) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.878817081451416), FRAC_CONST(0.477158784866333) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.824126183986664), FRAC_CONST(0.566406250000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.793353319168091), FRAC_CONST(0.608761429786682) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.725374400615692), FRAC_CONST(0.688354551792145) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.688354551792145), FRAC_CONST(0.725374400615692) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.608761370182037), FRAC_CONST(0.793353378772736) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.566406250000000), FRAC_CONST(0.824126183986664) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.477158755064011), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.430511027574539), FRAC_CONST(0.902585327625275) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.333806812763214), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.284015327692032), FRAC_CONST(0.958819746971130) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.182235524058342), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.130526125431061), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(0.026176875457168), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.026176963001490), FRAC_CONST(0.999657332897186) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.130526214838028), FRAC_CONST(0.991444885730743) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.182235598564148), FRAC_CONST(0.983254909515381) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.233445391058922), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.284015417098999), FRAC_CONST(0.958819687366486) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.333806872367859), FRAC_CONST(0.942641496658325) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.430511116981506), FRAC_CONST(0.902585268020630) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.477158725261688), FRAC_CONST(0.878817141056061) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998629510402679), FRAC_CONST(0.052335958927870) },
+ { FRAC_CONST(0.994521915912628), FRAC_CONST(0.104528464376926) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.978147625923157), FRAC_CONST(0.207911700010300) },
+ { FRAC_CONST(0.965925812721252), FRAC_CONST(0.258819043636322) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.933580398559570), FRAC_CONST(0.358367949724197) },
+ { FRAC_CONST(0.913545429706573), FRAC_CONST(0.406736642122269) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.866025388240814), FRAC_CONST(0.500000000000000) },
+ { FRAC_CONST(0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.777145922183990), FRAC_CONST(0.629320383071899) },
+ { FRAC_CONST(0.743144810199738), FRAC_CONST(0.669130623340607) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.669130563735962), FRAC_CONST(0.743144869804382) },
+ { FRAC_CONST(0.629320383071899), FRAC_CONST(0.777145981788635) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.544638991355896), FRAC_CONST(0.838670611381531) },
+ { FRAC_CONST(0.499999970197678), FRAC_CONST(0.866025447845459) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.406736612319946), FRAC_CONST(0.913545489311218) },
+ { FRAC_CONST(0.358367860317230), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.258819073438644), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(0.207911655306816), FRAC_CONST(0.978147625923157) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.104528419673443), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(0.052335973829031), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.052336059510708), FRAC_CONST(0.998629510402679) },
+ { FRAC_CONST(-0.104528509080410), FRAC_CONST(0.994521915912628) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.207911744713783), FRAC_CONST(0.978147566318512) },
+ { FRAC_CONST(-0.258819162845612), FRAC_CONST(0.965925812721252) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.358367949724197), FRAC_CONST(0.933580458164215) },
+ { FRAC_CONST(-0.406736701726913), FRAC_CONST(0.913545429706573) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.500000059604645), FRAC_CONST(0.866025388240814) },
+ { FRAC_CONST(-0.544639050960541), FRAC_CONST(0.838670551776886) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.629320502281189), FRAC_CONST(0.777145862579346) },
+ { FRAC_CONST(-0.669130682945251), FRAC_CONST(0.743144810199738) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.743144929409027), FRAC_CONST(0.669130444526672) },
+ { FRAC_CONST(-0.777146041393280), FRAC_CONST(0.629320263862610) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.838670551776886), FRAC_CONST(0.544639050960541) },
+ { FRAC_CONST(-0.866025388240814), FRAC_CONST(0.500000059604645) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.913545489311218), FRAC_CONST(0.406736582517624) },
+ { FRAC_CONST(-0.933580458164215), FRAC_CONST(0.358367919921875) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.965925872325897), FRAC_CONST(0.258818924427032) },
+ { FRAC_CONST(-0.978147625923157), FRAC_CONST(0.207911610603333) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(-0.994521915912628), FRAC_CONST(0.104528494179249) },
+ { FRAC_CONST(-0.998629570007324), FRAC_CONST(0.052335809916258) },
+ { FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.000000087422777) },
+ { FRAC_CONST(-0.998629510402679), FRAC_CONST(-0.052335985004902) },
+ { FRAC_CONST(-0.994521856307983), FRAC_CONST(-0.104528672993183) },
+ { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+ { FRAC_CONST(-0.978147566318512), FRAC_CONST(-0.207911789417267) },
+ { FRAC_CONST(-0.965925812721252), FRAC_CONST(-0.258819073438644) },
+ { FRAC_CONST(-0.951056540012360), FRAC_CONST(-0.309016972780228) },
+ { FRAC_CONST(-0.933580398559570), FRAC_CONST(-0.358368098735809) },
+ { FRAC_CONST(-0.913545429706573), FRAC_CONST(-0.406736731529236) },
+ { FRAC_CONST(-0.891006529331207), FRAC_CONST(-0.453990548849106) },
+ { FRAC_CONST(-0.866025269031525), FRAC_CONST(-0.500000178813934) },
+ { FRAC_CONST(-0.838670492172241), FRAC_CONST(-0.544639170169830) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.777145922183990), FRAC_CONST(-0.629320442676544) },
+ { FRAC_CONST(-0.743144810199738), FRAC_CONST(-0.669130623340607) },
+ { FRAC_CONST(-0.707106649875641), FRAC_CONST(-0.707106888294220) },
+ { FRAC_CONST(-0.669130504131317), FRAC_CONST(-0.743144869804382) },
+ { FRAC_CONST(-0.629320323467255), FRAC_CONST(-0.777145981788635) },
+ { FRAC_CONST(-0.587785065174103), FRAC_CONST(-0.809017121791840) },
+ { FRAC_CONST(-0.544639110565186), FRAC_CONST(-0.838670551776886) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.996917307376862), FRAC_CONST(0.078459098935127) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.852640151977539), FRAC_CONST(0.522498548030853) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.649448037147522), FRAC_CONST(0.760405957698822) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.522498488426209), FRAC_CONST(0.852640211582184) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.233445301651955), FRAC_CONST(0.972369909286499) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(0.078459084033966), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.987688362598419), FRAC_CONST(0.156434476375580) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.453990519046783), FRAC_CONST(0.891006529331207) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.156434446573257), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.453990608453751), FRAC_CONST(0.891006469726563) },
+ { FRAC_CONST(-0.587785184383392), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(-0.891006588935852), FRAC_CONST(0.453990370035172) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.987688362598419), FRAC_CONST(0.156434446573257) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.972369909286499), FRAC_CONST(0.233445376157761) },
+ { FRAC_CONST(0.891006529331207), FRAC_CONST(0.453990519046783) },
+ { FRAC_CONST(0.760405957698822), FRAC_CONST(0.649448096752167) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.156434372067451), FRAC_CONST(0.987688362598419) },
+ { FRAC_CONST(-0.078459173440933), FRAC_CONST(0.996917307376862) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.522498667240143), FRAC_CONST(0.852640092372894) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.852640211582184), FRAC_CONST(0.522498488426209) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.996917366981506), FRAC_CONST(0.078459039330482) },
+ { FRAC_CONST(-0.987688302993774), FRAC_CONST(-0.156434610486031) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(-0.649447917938232), FRAC_CONST(-0.760406076908112) },
+ { FRAC_CONST(-0.453990221023560), FRAC_CONST(-0.891006648540497) },
+ { FRAC_CONST(-0.233445450663567), FRAC_CONST(-0.972369909286499) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.951056540012360), FRAC_CONST(0.309017002582550) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.809017002582550), FRAC_CONST(0.587785243988037) },
+ { FRAC_CONST(0.309016972780228), FRAC_CONST(0.951056540012360) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.809017062187195), FRAC_CONST(0.587785184383392) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.587785243988037), FRAC_CONST(0.809017002582550) },
+ { FRAC_CONST(-0.309017032384872), FRAC_CONST(0.951056480407715) },
+ { FRAC_CONST(-0.951056599617004), FRAC_CONST(0.309016793966293) },
+ { FRAC_CONST(-0.809016942977905), FRAC_CONST(-0.587785363197327) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.309017121791840), FRAC_CONST(-0.951056480407715) }
+};
+#endif
+
+#endif
+
+ALIGN static const complex_t cfft_tab_128[] =
+{
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.998795449733734), FRAC_CONST(0.049067676067352) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.989176511764526), FRAC_CONST(0.146730467677116) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.970031261444092), FRAC_CONST(0.242980197072029) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.941544055938721), FRAC_CONST(0.336889863014221) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.903989315032959), FRAC_CONST(0.427555084228516) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.803207516670227), FRAC_CONST(0.595699310302734) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.740951120853424), FRAC_CONST(0.671558976173401) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.671558916568756), FRAC_CONST(0.740951180458069) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.595699310302734), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.514102697372437), FRAC_CONST(0.857728660106659) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.427555114030838), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.336889833211899), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.242980122566223), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.146730497479439), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(0.049067649990320), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.049067739397287), FRAC_CONST(0.998795449733734) },
+ { FRAC_CONST(-0.098017223179340), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.146730571985245), FRAC_CONST(0.989176511764526) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.242980197072029), FRAC_CONST(0.970031261444092) },
+ { FRAC_CONST(-0.290284723043442), FRAC_CONST(0.956940293312073) },
+ { FRAC_CONST(-0.336889922618866), FRAC_CONST(0.941544055938721) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.427555084228516), FRAC_CONST(0.903989315032959) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.514102756977081), FRAC_CONST(0.857728600502014) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.595699369907379), FRAC_CONST(0.803207516670227) },
+ { FRAC_CONST(-0.634393274784088), FRAC_CONST(0.773010492324829) },
+ { FRAC_CONST(-0.671559035778046), FRAC_CONST(0.740951061248779) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.740951240062714), FRAC_CONST(0.671558856964111) },
+ { FRAC_CONST(-0.773010492324829), FRAC_CONST(0.634393274784088) },
+ { FRAC_CONST(-0.803207635879517), FRAC_CONST(0.595699131488800) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.857728600502014), FRAC_CONST(0.514102756977081) },
+ { FRAC_CONST(-0.881921350955963), FRAC_CONST(0.471396625041962) },
+ { FRAC_CONST(-0.903989315032959), FRAC_CONST(0.427555054426193) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.941544115543365), FRAC_CONST(0.336889803409576) },
+ { FRAC_CONST(-0.956940352916718), FRAC_CONST(0.290284723043442) },
+ { FRAC_CONST(-0.970031261444092), FRAC_CONST(0.242980077862740) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.989176511764526), FRAC_CONST(0.146730333566666) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(0.098017096519470) },
+ { FRAC_CONST(-0.998795449733734), FRAC_CONST(0.049067486077547) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.995184719562531), FRAC_CONST(0.098017141222954) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.881921231746674), FRAC_CONST(0.471396744251251) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.773010432720184), FRAC_CONST(0.634393334388733) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.471396654844284), FRAC_CONST(0.881921291351318) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.290284633636475), FRAC_CONST(0.956940352916718) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.980785250663757), FRAC_CONST(0.195090323686600) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.555570185184479), FRAC_CONST(0.831469655036926) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.195090234279633), FRAC_CONST(0.980785310268402) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.382683515548706), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.555570363998413), FRAC_CONST(0.831469535827637) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.831469655036926), FRAC_CONST(0.555570185184479) },
+ { FRAC_CONST(-0.923879623413086), FRAC_CONST(0.382683277130127) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.956940352916718), FRAC_CONST(0.290284663438797) },
+ { FRAC_CONST(0.831469595432281), FRAC_CONST(0.555570244789124) },
+ { FRAC_CONST(0.634393274784088), FRAC_CONST(0.773010432720184) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(0.098017133772373), FRAC_CONST(0.995184719562531) },
+ { FRAC_CONST(-0.195090323686600), FRAC_CONST(0.980785250663757) },
+ { FRAC_CONST(-0.471396833658218), FRAC_CONST(0.881921231746674) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.881921231746674), FRAC_CONST(0.471396833658218) },
+ { FRAC_CONST(-0.980785310268402), FRAC_CONST(0.195090308785439) },
+ { FRAC_CONST(-0.995184719562531), FRAC_CONST(-0.098017267882824) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(-0.773010551929474), FRAC_CONST(-0.634393215179443) },
+ { FRAC_CONST(-0.555570006370544), FRAC_CONST(-0.831469774246216) },
+ { FRAC_CONST(-0.290284544229507), FRAC_CONST(-0.956940352916718) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.923879504203796), FRAC_CONST(0.382683455944061) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.000000043711388), FRAC_CONST(1.000000000000000) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.382683426141739), FRAC_CONST(0.923879504203796) },
+ { FRAC_CONST(-0.707106769084930), FRAC_CONST(0.707106769084930) },
+ { FRAC_CONST(-0.923879504203796), FRAC_CONST(-0.382683426141739) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(1.000000000000000), FRAC_CONST(0.000000000000000) },
+ { FRAC_CONST(0.000000011924881), FRAC_CONST(-1.000000000000000) }
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb.h
new file mode 100644
index 000000000..0b30f3487
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb.h
@@ -0,0 +1,142 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __HCB_H__
+#define __HCB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Optimal huffman decoding for AAC taken from:
+ * "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
+ * VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
+ * AES paper 5436
+ *
+ * 2 methods are used for huffman decoding:
+ * - binary search
+ * - 2-step table lookup
+ *
+ * The choice of the "optimal" method is based on the fact that if the
+ * memory size for the Two-step is exorbitantly high then the decision
+ * is Binary search for that codebook. However, for marginally more memory
+ * size, if Twostep outperforms even the best case of Binary then the
+ * decision is Two-step for that codebook.
+ *
+ * The following methods are used for the different tables.
+ * codebook "optimal" method
+ * HCB_1 2-Step
+ * HCB_2 2-Step
+ * HCB_3 Binary
+ * HCB_4 2-Step
+ * HCB_5 Binary
+ * HCB_6 2-Step
+ * HCB_7 Binary
+ * HCB_8 2-Step
+ * HCB_9 Binary
+ * HCB_10 2-Step
+ * HCB_11 2-Step
+ * HCB_SF Binary
+ *
+ */
+
+
+#define ZERO_HCB 0
+#define FIRST_PAIR_HCB 5
+#define ESC_HCB 11
+#define QUAD_LEN 4
+#define PAIR_LEN 2
+#define NOISE_HCB 13
+#define INTENSITY_HCB2 14
+#define INTENSITY_HCB 15
+
+/* 1st step table */
+typedef struct
+{
+ uint8_t offset;
+ uint8_t extra_bits;
+} hcb;
+
+/* 2nd step table with quadruple data */
+typedef struct
+{
+ uint8_t bits;
+ int8_t x;
+ int8_t y;
+} hcb_2_pair;
+
+typedef struct
+{
+ uint8_t bits;
+ int8_t x;
+ int8_t y;
+ int8_t v;
+ int8_t w;
+} hcb_2_quad;
+
+/* binary search table */
+typedef struct
+{
+ uint8_t is_leaf;
+ int8_t data[4];
+} hcb_bin_quad;
+
+typedef struct
+{
+ uint8_t is_leaf;
+ int8_t data[2];
+} hcb_bin_pair;
+
+hcb *hcb_table[];
+hcb_2_quad *hcb_2_quad_table[];
+hcb_2_pair *hcb_2_pair_table[];
+hcb_bin_pair *hcb_bin_table[];
+uint8_t hcbN[];
+uint8_t unsigned_cb[];
+int hcb_2_quad_table_size[];
+int hcb_2_pair_table_size[];
+int hcb_bin_table_size[];
+
+#include "codebook/hcb_1.h"
+#include "codebook/hcb_2.h"
+#include "codebook/hcb_3.h"
+#include "codebook/hcb_4.h"
+#include "codebook/hcb_5.h"
+#include "codebook/hcb_6.h"
+#include "codebook/hcb_7.h"
+#include "codebook/hcb_8.h"
+#include "codebook/hcb_9.h"
+#include "codebook/hcb_10.h"
+#include "codebook/hcb_11.h"
+#include "codebook/hcb_sf.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_1.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_1.h
new file mode 100644
index 000000000..963760e23
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_1.h
@@ -0,0 +1,183 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_1.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* 2-step huffman table HCB_1 */
+
+
+/* 1st step: 5 bits
+ * 2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb1_1[] = {
+ { /* 00000 */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* 10000 */ 1, 0 },
+ { /* 10001 */ 2, 0 },
+ { /* 10010 */ 3, 0 },
+ { /* 10011 */ 4, 0 },
+ { /* 10100 */ 5, 0 },
+ { /* 10101 */ 6, 0 },
+ { /* 10110 */ 7, 0 },
+ { /* 10111 */ 8, 0 },
+
+ /* 7 bit codewords */
+ { /* 11000 */ 9, 2 },
+ { /* 11001 */ 13, 2 },
+ { /* 11010 */ 17, 2 },
+ { /* 11011 */ 21, 2 },
+ { /* 11100 */ 25, 2 },
+ { /* 11101 */ 29, 2 },
+
+ /* 9 bit codewords */
+ { /* 11110 */ 33, 4 },
+
+ /* 9/10/11 bit codewords */
+ { /* 11111 */ 49, 6 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_quad hcb1_2[] = {
+ /* 1 bit codeword */
+ { 1, 0, 0, 0, 0 },
+
+ /* 5 bit codewords */
+ { 5, 1, 0, 0, 0 },
+ { 5, -1, 0, 0, 0 },
+ { 5, 0, 0, 0, -1 },
+ { 5, 0, 1, 0, 0 },
+ { 5, 0, 0, 0, 1 },
+ { 5, 0, 0, -1, 0 },
+ { 5, 0, 0, 1, 0 },
+ { 5, 0, -1, 0, 0 },
+
+ /* 7 bit codewords */
+ /* first 5 bits: 11000 */
+ { 7, 1, -1, 0, 0 },
+ { 7, -1, 1, 0, 0 },
+ { 7, 0, 0, -1, 1 },
+ { 7, 0, 1, -1, 0 },
+ /* first 5 bits: 11001 */
+ { 7, 0, -1, 1, 0 },
+ { 7, 0, 0, 1, -1 },
+ { 7, 1, 1, 0, 0 },
+ { 7, 0, 0, -1, -1 },
+ /* first 5 bits: 11010 */
+ { 7, -1, -1, 0, 0 },
+ { 7, 0, -1, -1, 0 },
+ { 7, 1, 0, -1, 0 },
+ { 7, 0, 1, 0, -1 },
+ /* first 5 bits: 11011 */
+ { 7, -1, 0, 1, 0 },
+ { 7, 0, 0, 1, 1 },
+ { 7, 1, 0, 1, 0 },
+ { 7, 0, -1, 0, 1 },
+ /* first 5 bits: 11100 */
+ { 7, 0, 1, 1, 0 },
+ { 7, 0, 1, 0, 1 },
+ { 7, -1, 0, -1, 0 },
+ { 7, 1, 0, 0, 1 },
+ /* first 5 bits: 11101 */
+ { 7, -1, 0, 0, -1 },
+ { 7, 1, 0, 0, -1 },
+ { 7, -1, 0, 0, 1 },
+ { 7, 0, -1, 0, -1 },
+
+ /* 9 bit codeword */
+ /* first 5 bits: 11110 */
+ { 9, 1, 1, -1, 0 },
+ { 9, -1, 1, -1, 0 },
+ { 9, 1, -1, 1, 0 },
+ { 9, 0, 1, 1, -1 },
+ { 9, 0, 1, -1, 1 },
+ { 9, 0, -1, 1, 1 },
+ { 9, 0, -1, 1, -1 },
+ { 9, 1, -1, -1, 0 },
+ { 9, 1, 0, -1, 1 },
+ { 9, 0, 1, -1, -1 },
+ { 9, -1, 1, 1, 0 },
+ { 9, -1, 0, 1, -1 },
+ { 9, -1, -1, 1, 0 },
+ { 9, 0, -1, -1, 1 },
+ { 9, 1, -1, 0, 1 },
+ { 9, 1, -1, 0, -1 },
+
+ /* 9/10/11 bit codewords */
+ /* first 5 bits: 11111 */
+ /* 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword */
+ { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 },
+ { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 },
+ { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 },
+ { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 },
+ { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 },
+ { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 },
+ { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 },
+ { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 },
+ /* 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword */
+ { 10, -1, -1, 0, 1 }, { 10, -1, -1, 0, 1 },
+ { 10, -1, 0, -1, -1 }, { 10, -1, 0, -1, -1 },
+ { 10, 1, 1, 0, -1 }, { 10, 1, 1, 0, -1 },
+ { 10, 1, 0, -1, -1 }, { 10, 1, 0, -1, -1 },
+ { 10, -1, 0, -1, 1 }, { 10, -1, 0, -1, 1 },
+ { 10, -1, -1, 0, -1 }, { 10, -1, -1, 0, -1 },
+ { 10, -1, 0, 1, 1 }, { 10, -1, 0, 1, 1 },
+ { 10, 1, 0, 1, 1 }, { 10, 1, 0, 1, 1 },
+ /* 11 bit */
+ { 11, 1, -1, 1, -1 },
+ { 11, -1, 1, -1, 1 },
+ { 11, -1, 1, 1, -1 },
+ { 11, 1, -1, -1, 1 },
+ { 11, 1, 1, 1, 1 },
+ { 11, -1, -1, 1, 1 },
+ { 11, 1, 1, -1, -1 },
+ { 11, -1, -1, 1, -1 },
+ { 11, -1, -1, -1, -1 },
+ { 11, 1, 1, -1, 1 },
+ { 11, 1, -1, 1, 1 },
+ { 11, -1, 1, 1, 1 },
+ { 11, -1, 1, -1, -1 },
+ { 11, -1, -1, -1, 1 },
+ { 11, 1, -1, -1, -1 },
+ { 11, 1, 1, 1, -1 }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_10.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_10.h
new file mode 100644
index 000000000..9b4247dd0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_10.h
@@ -0,0 +1,309 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_10.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* 2-step huffman table HCB_10 */
+
+
+/* 1st step: 6 bits
+ * 2^6 = 64 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb10_1[] = {
+ /* 4 bit codewords */
+ { /* 000000 */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* 000100 */ 1, 0 },
+ { /* */ 1, 0 },
+ { /* */ 1, 0 },
+ { /* */ 1, 0 },
+ { /* 001000 */ 2, 0 },
+ { /* */ 2, 0 },
+ { /* */ 2, 0 },
+ { /* */ 2, 0 },
+ /* 5 bit codewords */
+ { /* 001100 */ 3, 0 },
+ { /* */ 3, 0 },
+ { /* 001110 */ 4, 0 },
+ { /* */ 4, 0 },
+ { /* 010000 */ 5, 0 },
+ { /* */ 5, 0 },
+ { /* 010010 */ 6, 0 },
+ { /* */ 6, 0 },
+ { /* 010100 */ 7, 0 },
+ { /* */ 7, 0 },
+ { /* 010110 */ 8, 0 },
+ { /* */ 8, 0 },
+ { /* 011000 */ 9, 0 },
+ { /* */ 9, 0 },
+ { /* 011010 */ 10, 0 },
+ { /* */ 10, 0 },
+ /* 6 bit codewords */
+ { /* 011100 */ 11, 0 },
+ { /* 011101 */ 12, 0 },
+ { /* 011110 */ 13, 0 },
+ { /* 011111 */ 14, 0 },
+ { /* 100000 */ 15, 0 },
+ { /* 100001 */ 16, 0 },
+ { /* 100010 */ 17, 0 },
+ { /* 100011 */ 18, 0 },
+ { /* 100100 */ 19, 0 },
+ { /* 100101 */ 20, 0 },
+ { /* 100110 */ 21, 0 },
+ { /* 100111 */ 22, 0 },
+ { /* 101000 */ 23, 0 },
+ { /* 101001 */ 24, 0 },
+ /* 7 bit codewords */
+ { /* 101010 */ 25, 1 },
+ { /* 101011 */ 27, 1 },
+ { /* 101100 */ 29, 1 },
+ { /* 101101 */ 31, 1 },
+ { /* 101110 */ 33, 1 },
+ { /* 101111 */ 35, 1 },
+ { /* 110000 */ 37, 1 },
+ { /* 110001 */ 39, 1 },
+ /* 7/8 bit codewords */
+ { /* 110010 */ 41, 2 },
+ /* 8 bit codewords */
+ { /* 110011 */ 45, 2 },
+ { /* 110100 */ 49, 2 },
+ { /* 110101 */ 53, 2 },
+ { /* 110110 */ 57, 2 },
+ { /* 110111 */ 61, 2 },
+ /* 8/9 bit codewords */
+ { /* 111000 */ 65, 3 },
+ /* 9 bit codewords */
+ { /* 111001 */ 73, 3 },
+ { /* 111010 */ 81, 3 },
+ { /* 111011 */ 89, 3 },
+ /* 9/10 bit codewords */
+ { /* 111100 */ 97, 4 },
+ /* 10 bit codewords */
+ { /* 111101 */ 113, 4 },
+ { /* 111110 */ 129, 4 },
+ /* 10/11/12 bit codewords */
+ { /* 111111 */ 145, 6 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_pair hcb10_2[] = {
+ /* 4 bit codewords */
+ { 4, 1, 1 },
+ { 4, 1, 2 },
+ { 4, 2, 1 },
+
+ /* 5 bit codewords */
+ { 5, 2, 2 },
+ { 5, 1, 0 },
+ { 5, 0, 1 },
+ { 5, 1, 3 },
+ { 5, 3, 2 },
+ { 5, 3, 1 },
+ { 5, 2, 3 },
+ { 5, 3, 3 },
+
+ /* 6 bit codewords */
+ { 6, 2, 0 },
+ { 6, 0, 2 },
+ { 6, 2, 4 },
+ { 6, 4, 2 },
+ { 6, 1, 4 },
+ { 6, 4, 1 },
+ { 6, 0, 0 },
+ { 6, 4, 3 },
+ { 6, 3, 4 },
+ { 6, 3, 0 },
+ { 6, 0, 3 },
+ { 6, 4, 4 },
+ { 6, 2, 5 },
+ { 6, 5, 2 },
+
+ /* 7 bit codewords */
+ { 7, 1, 5 },
+ { 7, 5, 1 },
+ { 7, 5, 3 },
+ { 7, 3, 5 },
+ { 7, 5, 4 },
+ { 7, 4, 5 },
+ { 7, 6, 2 },
+ { 7, 2, 6 },
+ { 7, 6, 3 },
+ { 7, 4, 0 },
+ { 7, 6, 1 },
+ { 7, 0, 4 },
+ { 7, 1, 6 },
+ { 7, 3, 6 },
+ { 7, 5, 5 },
+ { 7, 6, 4 },
+
+ /* 7/8 bit codewords */
+ { 7, 4, 6 }, { 7, 4, 6 },
+ { 8, 6, 5 },
+ { 8, 7, 2 },
+
+ /* 8 bit codewords */
+ { 8, 3, 7 },
+ { 8, 2, 7 },
+ { 8, 5, 6 },
+ { 8, 8, 2 },
+ { 8, 7, 3 },
+ { 8, 5, 0 },
+ { 8, 7, 1 },
+ { 8, 0, 5 },
+ { 8, 8, 1 },
+ { 8, 1, 7 },
+ { 8, 8, 3 },
+ { 8, 7, 4 },
+ { 8, 4, 7 },
+ { 8, 2, 8 },
+ { 8, 6, 6 },
+ { 8, 7, 5 },
+ { 8, 1, 8 },
+ { 8, 3, 8 },
+ { 8, 8, 4 },
+ { 8, 4, 8 },
+
+ /* 8/9 bit codewords */
+ { 8, 5, 7 }, { 8, 5, 7 },
+ { 8, 8, 5 }, { 8, 8, 5 },
+ { 8, 5, 8 }, { 8, 5, 8 },
+ { 9, 7, 6 },
+ { 9, 6, 7 },
+
+ /* 9 bit codewords */
+ { 9, 9, 2 },
+ { 9, 6, 0 },
+ { 9, 6, 8 },
+ { 9, 9, 3 },
+ { 9, 3, 9 },
+ { 9, 9, 1 },
+ { 9, 2, 9 },
+ { 9, 0, 6 },
+ { 9, 8, 6 },
+ { 9, 9, 4 },
+ { 9, 4, 9 },
+ { 9, 10, 2 },
+ { 9, 1, 9 },
+ { 9, 7, 7 },
+ { 9, 8, 7 },
+ { 9, 9, 5 },
+ { 9, 7, 8 },
+ { 9, 10, 3 },
+ { 9, 5, 9 },
+ { 9, 10, 4 },
+ { 9, 2, 10 },
+ { 9, 10, 1 },
+ { 9, 3, 10 },
+ { 9, 9, 6 },
+
+ /* 9/10 bit codewords */
+ { 9, 6, 9 }, { 9, 6, 9 },
+ { 9, 8, 0 }, { 9, 8, 0 },
+ { 9, 4, 10 }, { 9, 4, 10 },
+ { 9, 7, 0 }, { 9, 7, 0 },
+ { 9, 11, 2 }, { 9, 11, 2 },
+ { 10, 7, 9 },
+ { 10, 11, 3 },
+ { 10, 10, 6 },
+ { 10, 1, 10 },
+ { 10, 11, 1 },
+ { 10, 9, 7 },
+
+ /* 10 bit codewords */
+ { 10, 0, 7 },
+ { 10, 8, 8 },
+ { 10, 10, 5 },
+ { 10, 3, 11 },
+ { 10, 5, 10 },
+ { 10, 8, 9 },
+ { 10, 11, 5 },
+ { 10, 0, 8 },
+ { 10, 11, 4 },
+ { 10, 2, 11 },
+ { 10, 7, 10 },
+ { 10, 6, 10 },
+ { 10, 10, 7 },
+ { 10, 4, 11 },
+ { 10, 1, 11 },
+ { 10, 12, 2 },
+ { 10, 9, 8 },
+ { 10, 12, 3 },
+ { 10, 11, 6 },
+ { 10, 5, 11 },
+ { 10, 12, 4 },
+ { 10, 11, 7 },
+ { 10, 12, 5 },
+ { 10, 3, 12 },
+ { 10, 6, 11 },
+ { 10, 9, 0 },
+ { 10, 10, 8 },
+ { 10, 10, 0 },
+ { 10, 12, 1 },
+ { 10, 0, 9 },
+ { 10, 4, 12 },
+ { 10, 9, 9 },
+
+ /* 10/11/12 bit codewords */
+ { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 },
+ { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 },
+ { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 },
+ { 11, 9, 10 }, { 11, 9, 10 },
+ { 11, 1, 12 }, { 11, 1, 12 },
+ { 11, 11, 8 }, { 11, 11, 8 },
+ { 11, 12, 7 }, { 11, 12, 7 },
+ { 11, 7, 11 }, { 11, 7, 11 },
+ { 11, 5, 12 }, { 11, 5, 12 },
+ { 11, 6, 12 }, { 11, 6, 12 },
+ { 11, 10, 9 }, { 11, 10, 9 },
+ { 11, 8, 11 }, { 11, 8, 11 },
+ { 11, 12, 8 }, { 11, 12, 8 },
+ { 11, 0, 10 }, { 11, 0, 10 },
+ { 11, 7, 12 }, { 11, 7, 12 },
+ { 11, 11, 0 }, { 11, 11, 0 },
+ { 11, 10, 10 }, { 11, 10, 10 },
+ { 11, 11, 9 }, { 11, 11, 9 },
+ { 11, 11, 10 }, { 11, 11, 10 },
+ { 11, 0, 11 }, { 11, 0, 11 },
+ { 11, 11, 11 }, { 11, 11, 11 },
+ { 11, 9, 11 }, { 11, 9, 11 },
+ { 11, 10, 11 }, { 11, 10, 11 },
+ { 11, 12, 0 }, { 11, 12, 0 },
+ { 11, 8, 12 }, { 11, 8, 12 },
+ { 12, 12, 9 },
+ { 12, 10, 12 },
+ { 12, 9, 12 },
+ { 12, 11, 12 },
+ { 12, 12, 11 },
+ { 12, 0, 12 },
+ { 12, 12, 10 },
+ { 12, 12, 12 }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_11.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_11.h
new file mode 100644
index 000000000..a73febc0b
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_11.h
@@ -0,0 +1,412 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_11.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* 2-step huffman table HCB_11 */
+
+
+/* 1st step: 5 bits
+ * 2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb11_1[] = {
+ /* 4 bits */
+ { /* 00000 */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* 00010 */ 1, 0 },
+ { /* */ 1, 0 },
+
+ /* 5 bits */
+ { /* 00100 */ 2, 0 },
+ { /* 00101 */ 3, 0 },
+ { /* 00110 */ 4, 0 },
+ { /* 00111 */ 5, 0 },
+ { /* 01000 */ 6, 0 },
+ { /* 01001 */ 7, 0 },
+
+ /* 6 bits */
+ { /* 01010 */ 8, 1 },
+ { /* 01011 */ 10, 1 },
+ { /* 01100 */ 12, 1 },
+
+ /* 6/7 bits */
+ { /* 01101 */ 14, 2 },
+
+ /* 7 bits */
+ { /* 01110 */ 18, 2 },
+ { /* 01111 */ 22, 2 },
+ { /* 10000 */ 26, 2 },
+
+ /* 7/8 bits */
+ { /* 10001 */ 30, 3 },
+
+ /* 8 bits */
+ { /* 10010 */ 38, 3 },
+ { /* 10011 */ 46, 3 },
+ { /* 10100 */ 54, 3 },
+ { /* 10101 */ 62, 3 },
+ { /* 10110 */ 70, 3 },
+ { /* 10111 */ 78, 3 },
+
+ /* 8/9 bits */
+ { /* 11000 */ 86, 4 },
+
+ /* 9 bits */
+ { /* 11001 */ 102, 4 },
+ { /* 11010 */ 118, 4 },
+ { /* 11011 */ 134, 4 },
+
+ /* 9/10 bits */
+ { /* 11100 */ 150, 5 },
+
+ /* 10 bits */
+ { /* 11101 */ 182, 5 },
+ { /* 11110 */ 214, 5 },
+
+ /* 10/11/12 bits */
+ { /* 11111 */ 246, 7 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_pair hcb11_2[] = {
+ /* 4 */
+ { 4, 0, 0 },
+ { 4, 1, 1 },
+
+ /* 5 */
+ { 5, 16, 16 },
+ { 5, 1, 0 },
+ { 5, 0, 1 },
+ { 5, 2, 1 },
+ { 5, 1, 2 },
+ { 5, 2, 2 },
+
+ /* 6 */
+ { 6, 1, 3 },
+ { 6, 3, 1 },
+ { 6, 3, 2 },
+ { 6, 2, 0 },
+ { 6, 2, 3 },
+ { 6, 0, 2 },
+
+ /* 6/7 */
+ { 6, 3, 3 }, { 6, 3, 3 },
+ { 7, 4, 1 },
+ { 7, 1, 4 },
+
+ /* 7 */
+ { 7, 4, 2 },
+ { 7, 2, 4 },
+ { 7, 4, 3 },
+ { 7, 3, 4 },
+ { 7, 3, 0 },
+ { 7, 0, 3 },
+ { 7, 5, 1 },
+ { 7, 5, 2 },
+ { 7, 2, 5 },
+ { 7, 4, 4 },
+ { 7, 1, 5 },
+ { 7, 5, 3 },
+
+ /* 7/8 */
+ { 7, 3, 5 }, { 7, 3, 5 },
+ { 7, 5, 4 }, { 7, 5, 4 },
+ { 8, 4, 5 },
+ { 8, 6, 2 },
+ { 8, 2, 6 },
+ { 8, 6, 1 },
+
+ /* 8 */
+ { 8, 6, 3 },
+ { 8, 3, 6 },
+ { 8, 1, 6 },
+ { 8, 4, 16 },
+ { 8, 3, 16 },
+ { 8, 16, 5 },
+ { 8, 16, 3 },
+ { 8, 16, 4 },
+ { 8, 6, 4 },
+ { 8, 16, 6 },
+ { 8, 4, 0 },
+ { 8, 4, 6 },
+ { 8, 0, 4 },
+ { 8, 2, 16 },
+ { 8, 5, 5 },
+ { 8, 5, 16 },
+ { 8, 16, 7 },
+ { 8, 16, 2 },
+ { 8, 16, 8 },
+ { 8, 2, 7 },
+ { 8, 7, 2 },
+ { 8, 3, 7 },
+ { 8, 6, 5 },
+ { 8, 5, 6 },
+ { 8, 6, 16 },
+ { 8, 16, 10 },
+ { 8, 7, 3 },
+ { 8, 7, 1 },
+ { 8, 16, 9 },
+ { 8, 7, 16 },
+ { 8, 1, 16 },
+ { 8, 1, 7 },
+ { 8, 4, 7 },
+ { 8, 16, 11 },
+ { 8, 7, 4 },
+ { 8, 16, 12 },
+ { 8, 8, 16 },
+ { 8, 16, 1 },
+ { 8, 6, 6 },
+ { 8, 9, 16 },
+ { 8, 2, 8 },
+ { 8, 5, 7 },
+ { 8, 10, 16 },
+ { 8, 16, 13 },
+ { 8, 8, 3 },
+ { 8, 8, 2 },
+ { 8, 3, 8 },
+ { 8, 5, 0 },
+
+ /* 8/9 */
+ { 8, 16, 14 }, { 8, 16, 14 },
+ { 8, 11, 16 }, { 8, 11, 16 },
+ { 8, 7, 5 }, { 8, 7, 5 },
+ { 8, 4, 8 }, { 8, 4, 8 },
+ { 8, 6, 7 }, { 8, 6, 7 },
+ { 8, 7, 6 }, { 8, 7, 6 },
+ { 8, 0, 5 }, { 8, 0, 5 },
+ { 9, 8, 4 },
+ { 9, 16, 15 },
+
+ /* 9 */
+ { 9, 12, 16 },
+ { 9, 1, 8 },
+ { 9, 8, 1 },
+ { 9, 14, 16 },
+ { 9, 5, 8 },
+ { 9, 13, 16 },
+ { 9, 3, 9 },
+ { 9, 8, 5 },
+ { 9, 7, 7 },
+ { 9, 2, 9 },
+ { 9, 8, 6 },
+ { 9, 9, 2 },
+ { 9, 9, 3 },
+ { 9, 15, 16 },
+ { 9, 4, 9 },
+ { 9, 6, 8 },
+ { 9, 6, 0 },
+ { 9, 9, 4 },
+ { 9, 5, 9 },
+ { 9, 8, 7 },
+ { 9, 7, 8 },
+ { 9, 1, 9 },
+ { 9, 10, 3 },
+ { 9, 0, 6 },
+ { 9, 10, 2 },
+ { 9, 9, 1 },
+ { 9, 9, 5 },
+ { 9, 4, 10 },
+ { 9, 2, 10 },
+ { 9, 9, 6 },
+ { 9, 3, 10 },
+ { 9, 6, 9 },
+ { 9, 10, 4 },
+ { 9, 8, 8 },
+ { 9, 10, 5 },
+ { 9, 9, 7 },
+ { 9, 11, 3 },
+ { 9, 1, 10 },
+ { 9, 7, 0 },
+ { 9, 10, 6 },
+ { 9, 7, 9 },
+ { 9, 3, 11 },
+ { 9, 5, 10 },
+ { 9, 10, 1 },
+ { 9, 4, 11 },
+ { 9, 11, 2 },
+ { 9, 13, 2 },
+ { 9, 6, 10 },
+
+ /* 9/10 */
+ { 9, 13, 3 }, { 9, 13, 3 },
+ { 9, 2, 11 }, { 9, 2, 11 },
+ { 9, 16, 0 }, { 9, 16, 0 },
+ { 9, 5, 11 }, { 9, 5, 11 },
+ { 9, 11, 5 }, { 9, 11, 5 },
+ { 10, 11, 4 },
+ { 10, 9, 8 },
+ { 10, 7, 10 },
+ { 10, 8, 9 },
+ { 10, 0, 16 },
+ { 10, 4, 13 },
+ { 10, 0, 7 },
+ { 10, 3, 13 },
+ { 10, 11, 6 },
+ { 10, 13, 1 },
+ { 10, 13, 4 },
+ { 10, 12, 3 },
+ { 10, 2, 13 },
+ { 10, 13, 5 },
+ { 10, 8, 10 },
+ { 10, 6, 11 },
+ { 10, 10, 8 },
+ { 10, 10, 7 },
+ { 10, 14, 2 },
+ { 10, 12, 4 },
+ { 10, 1, 11 },
+ { 10, 4, 12 },
+
+ /* 10 */
+ { 10, 11, 1 },
+ { 10, 3, 12 },
+ { 10, 1, 13 },
+ { 10, 12, 2 },
+ { 10, 7, 11 },
+ { 10, 3, 14 },
+ { 10, 5, 12 },
+ { 10, 5, 13 },
+ { 10, 14, 4 },
+ { 10, 4, 14 },
+ { 10, 11, 7 },
+ { 10, 14, 3 },
+ { 10, 12, 5 },
+ { 10, 13, 6 },
+ { 10, 12, 6 },
+ { 10, 8, 0 },
+ { 10, 11, 8 },
+ { 10, 2, 12 },
+ { 10, 9, 9 },
+ { 10, 14, 5 },
+ { 10, 6, 13 },
+ { 10, 10, 10 },
+ { 10, 15, 2 },
+ { 10, 8, 11 },
+ { 10, 9, 10 },
+ { 10, 14, 6 },
+ { 10, 10, 9 },
+ { 10, 5, 14 },
+ { 10, 11, 9 },
+ { 10, 14, 1 },
+ { 10, 2, 14 },
+ { 10, 6, 12 },
+ { 10, 1, 12 },
+ { 10, 13, 8 },
+ { 10, 0, 8 },
+ { 10, 13, 7 },
+ { 10, 7, 12 },
+ { 10, 12, 7 },
+ { 10, 7, 13 },
+ { 10, 15, 3 },
+ { 10, 12, 1 },
+ { 10, 6, 14 },
+ { 10, 2, 15 },
+ { 10, 15, 5 },
+ { 10, 15, 4 },
+ { 10, 1, 14 },
+ { 10, 9, 11 },
+ { 10, 4, 15 },
+ { 10, 14, 7 },
+ { 10, 8, 13 },
+ { 10, 13, 9 },
+ { 10, 8, 12 },
+ { 10, 5, 15 },
+ { 10, 3, 15 },
+ { 10, 10, 11 },
+ { 10, 11, 10 },
+ { 10, 12, 8 },
+ { 10, 15, 6 },
+ { 10, 15, 7 },
+ { 10, 8, 14 },
+ { 10, 15, 1 },
+ { 10, 7, 14 },
+ { 10, 9, 0 },
+ { 10, 0, 9 },
+
+ /* 10/11/12 */
+ { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 },
+ { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 },
+ { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 },
+ { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 },
+ { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 },
+ { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 },
+ { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 },
+ { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 },
+ { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 },
+
+ { 11, 9, 14 }, { 11, 9, 14 },
+ { 11, 15, 8 }, { 11, 15, 8 },
+ { 11, 11, 11 }, { 11, 11, 11 },
+ { 11, 11, 14 }, { 11, 11, 14 },
+ { 11, 1, 15 }, { 11, 1, 15 },
+ { 11, 10, 12 }, { 11, 10, 12 },
+ { 11, 10, 14 }, { 11, 10, 14 },
+ { 11, 13, 11 }, { 11, 13, 11 },
+ { 11, 13, 10 }, { 11, 13, 10 },
+ { 11, 11, 13 }, { 11, 11, 13 },
+ { 11, 11, 12 }, { 11, 11, 12 },
+ { 11, 8, 15 }, { 11, 8, 15 },
+ { 11, 14, 11 }, { 11, 14, 11 },
+ { 11, 13, 12 }, { 11, 13, 12 },
+ { 11, 12, 13 }, { 11, 12, 13 },
+ { 11, 15, 9 }, { 11, 15, 9 },
+ { 11, 14, 10 }, { 11, 14, 10 },
+ { 11, 10, 0 }, { 11, 10, 0 },
+ { 11, 12, 11 }, { 11, 12, 11 },
+ { 11, 9, 15 }, { 11, 9, 15 },
+ { 11, 0, 10 }, { 11, 0, 10 },
+ { 11, 12, 12 }, { 11, 12, 12 },
+ { 11, 11, 0 }, { 11, 11, 0 },
+ { 11, 12, 14 }, { 11, 12, 14 },
+ { 11, 10, 15 }, { 11, 10, 15 },
+ { 11, 13, 13 }, { 11, 13, 13 },
+ { 11, 0, 13 }, { 11, 0, 13 },
+ { 11, 14, 12 }, { 11, 14, 12 },
+ { 11, 15, 10 }, { 11, 15, 10 },
+ { 11, 15, 11 }, { 11, 15, 11 },
+ { 11, 11, 15 }, { 11, 11, 15 },
+ { 11, 14, 13 }, { 11, 14, 13 },
+ { 11, 13, 0 }, { 11, 13, 0 },
+ { 11, 0, 11 }, { 11, 0, 11 },
+ { 11, 13, 14 }, { 11, 13, 14 },
+ { 11, 15, 12 }, { 11, 15, 12 },
+ { 11, 15, 13 }, { 11, 15, 13 },
+ { 11, 12, 15 }, { 11, 12, 15 },
+ { 11, 14, 0 }, { 11, 14, 0 },
+ { 11, 14, 14 }, { 11, 14, 14 },
+ { 11, 13, 15 }, { 11, 13, 15 },
+ { 11, 12, 0 }, { 11, 12, 0 },
+ { 11, 14, 15 }, { 11, 14, 15 },
+ { 12, 0, 14 },
+ { 12, 0, 12 },
+ { 12, 15, 14 },
+ { 12, 15, 0 },
+ { 12, 0, 15 },
+ { 12, 15, 15 }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_2.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_2.h
new file mode 100644
index 000000000..702bed5e3
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_2.h
@@ -0,0 +1,182 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_2.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* 2-step huffman table HCB_2 */
+
+
+/* 1st step: 5 bits
+ * 2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb2_1[] = {
+ { /* 00000 */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* 00100 */ 1, 0 },
+ { /* */ 1, 0 },
+ { /* 00110 */ 2, 0 },
+ { /* 00111 */ 3, 0 },
+ { /* 01000 */ 4, 0 },
+ { /* 01001 */ 5, 0 },
+ { /* 01010 */ 6, 0 },
+ { /* 01011 */ 7, 0 },
+ { /* 01100 */ 8, 0 },
+
+ /* 6 bit codewords */
+ { /* 01101 */ 9, 1 },
+ { /* 01110 */ 11, 1 },
+ { /* 01111 */ 13, 1 },
+ { /* 10000 */ 15, 1 },
+ { /* 10001 */ 17, 1 },
+ { /* 10010 */ 19, 1 },
+ { /* 10011 */ 21, 1 },
+ { /* 10100 */ 23, 1 },
+ { /* 10101 */ 25, 1 },
+ { /* 10110 */ 27, 1 },
+ { /* 10111 */ 29, 1 },
+ { /* 11000 */ 31, 1 },
+
+ /* 7 bit codewords */
+ { /* 11001 */ 33, 2 },
+ { /* 11010 */ 37, 2 },
+ { /* 11011 */ 41, 2 },
+
+ /* 7/8 bit codewords */
+ { /* 11100 */ 45, 3 },
+
+ /* 8 bit codewords */
+ { /* 11101 */ 53, 3 },
+ { /* 11110 */ 61, 3 },
+
+ /* 8/9 bit codewords */
+ { /* 11111 */ 69, 4 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_quad hcb2_2[] = {
+ /* 3 bit codeword */
+ { 3, 0, 0, 0, 0 },
+
+ /* 4 bit codeword */
+ { 4, 1, 0, 0, 0 },
+
+ /* 5 bit codewords */
+ { 5, -1, 0, 0, 0 },
+ { 5, 0, 0, 0, 1 },
+ { 5, 0, 0, -1, 0 },
+ { 5, 0, 0, 0, -1 },
+ { 5, 0, -1, 0, 0 },
+ { 5, 0, 0, 1, 0 },
+ { 5, 0, 1, 0, 0 },
+
+ /* 6 bit codewords */
+ { 6, 0, -1, 1, 0 },
+ { 6, -1, 1, 0, 0 },
+ { 6, 0, 1, -1, 0 },
+ { 6, 0, 0, 1, -1 },
+ { 6, 0, 1, 0, -1 },
+ { 6, 0, 0, -1, 1 },
+ { 6, -1, 0, 0, -1 },
+ { 6, 1, -1, 0, 0 },
+ { 6, 1, 0, -1, 0 },
+ { 6, -1, -1, 0, 0 },
+ { 6, 0, 0, -1, -1 },
+ { 6, 1, 0, 1, 0 },
+ { 6, 1, 0, 0, 1 },
+ { 6, 0, -1, 0, 1 },
+ { 6, -1, 0, 1, 0 },
+ { 6, 0, 1, 0, 1 },
+ { 6, 0, -1, -1, 0 },
+ { 6, -1, 0, 0, 1 },
+ { 6, 0, -1, 0, -1 },
+ { 6, -1, 0, -1, 0 },
+ { 6, 1, 1, 0, 0 },
+ { 6, 0, 1, 1, 0 },
+ { 6, 0, 0, 1, 1 },
+ { 6, 1, 0, 0, -1 },
+
+ /* 7 bit codewords */
+ { 7, 0, 1, -1, 1 },
+ { 7, 1, 0, -1, 1 },
+ { 7, -1, 1, -1, 0 },
+ { 7, 0, -1, 1, -1 },
+ { 7, 1, -1, 1, 0 },
+ { 7, 1, 1, 0, -1 },
+ { 7, 1, 0, 1, 1 },
+ { 7, -1, 1, 1, 0 },
+ { 7, 0, -1, -1, 1 },
+ { 7, 1, 1, 1, 0 },
+ { 7, -1, 0, 1, -1 },
+ { 7, -1, -1, -1, 0 },
+
+ /* 7/8 bit codewords */
+ { 7, -1, 0, -1, 1 }, { 7, -1, 0, -1, 1 },
+ { 7, 1, -1, -1, 0 }, { 7, 1, -1, -1, 0 },
+ { 7, 1, 1, -1, 0 }, { 7, 1, 1, -1, 0 },
+ { 8, 1, -1, 0, 1 },
+ { 8, -1, 1, 0, -1 },
+
+ /* 8 bit codewords */
+ { 8, -1, -1, 1, 0 },
+ { 8, -1, 0, 1, 1 },
+ { 8, -1, -1, 0, 1 },
+ { 8, -1, -1, 0, -1 },
+ { 8, 0, -1, -1, -1 },
+ { 8, 1, 0, 1, -1 },
+ { 8, 1, 0, -1, -1 },
+ { 8, 0, 1, -1, -1 },
+ { 8, 0, 1, 1, 1 },
+ { 8, -1, 1, 0, 1 },
+ { 8, -1, 0, -1, -1 },
+ { 8, 0, 1, 1, -1 },
+ { 8, 1, -1, 0, -1 },
+ { 8, 0, -1, 1, 1 },
+ { 8, 1, 1, 0, 1 },
+ { 8, 1, -1, 1, -1 },
+
+ /* 8/9 bit codewords */
+ { 8, -1, 1, -1, 1 }, { 8, -1, 1, -1, 1 },
+ { 9, 1, -1, -1, 1 },
+ { 9, -1, -1, -1, -1 },
+ { 9, -1, 1, 1, -1 },
+ { 9, -1, 1, 1, 1 },
+ { 9, 1, 1, 1, 1 },
+ { 9, -1, -1, 1, -1 },
+ { 9, 1, -1, 1, 1 },
+ { 9, -1, 1, -1, -1 },
+ { 9, -1, -1, 1, 1 },
+ { 9, 1, 1, -1, -1 },
+ { 9, 1, -1, -1, -1 },
+ { 9, -1, -1, -1, 1 },
+ { 9, 1, 1, -1, 1 },
+ { 9, 1, 1, 1, -1 }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_3.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_3.h
new file mode 100644
index 000000000..2bea4ddfb
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_3.h
@@ -0,0 +1,193 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_3.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* Binary search huffman table HCB_3 */
+
+
+static hcb_bin_quad hcb3[] = {
+ { /* 0 */ 0, { 1, 2, 0, 0 } },
+ { /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */
+ { /* 2 */ 0, { 1, 2, 0, 0 } },
+ { /* 3 */ 0, { 2, 3, 0, 0 } },
+ { /* 4 */ 0, { 3, 4, 0, 0 } },
+ { /* 5 */ 0, { 4, 5, 0, 0 } },
+ { /* 6 */ 0, { 5, 6, 0, 0 } },
+ { /* 7 */ 0, { 6, 7, 0, 0 } },
+ { /* 8 */ 0, { 7, 8, 0, 0 } },
+ { /* 9 */ 1, { 1, 0, 0, 0 } }, /* 1000 */
+ { /* 10 */ 1, { 0, 0, 0, 1 } }, /* 1001 */
+ { /* 11 */ 1, { 0, 1, 0, 0 } }, /* 1010 */
+ { /* 12 */ 1, { 0, 0, 1, 0 } }, /* 1011 */
+ { /* 13 */ 0, { 4, 5, 0, 0 } },
+ { /* 14 */ 0, { 5, 6, 0, 0 } },
+ { /* 15 */ 0, { 6, 7, 0, 0 } },
+ { /* 16 */ 0, { 7, 8, 0, 0 } },
+ { /* 17 */ 1, { 1, 1, 0, 0 } },
+ { /* 18 */ 1, { 0, 0, 1, 1 } },
+ { /* 19 */ 0, { 6, 7, 0, 0 } },
+ { /* 20 */ 0, { 7, 8, 0, 0 } },
+ { /* 21 */ 0, { 8, 9, 0, 0 } },
+ { /* 22 */ 0, { 9, 10, 0, 0 } },
+ { /* 23 */ 0, { 10, 11, 0, 0 } },
+ { /* 24 */ 0, { 11, 12, 0, 0 } },
+ { /* 25 */ 1, { 0, 1, 1, 0 } }, /* 110100 */
+ { /* 26 */ 1, { 0, 1, 0, 1 } }, /* 110101 */
+ { /* 27 */ 1, { 1, 0, 1, 0 } }, /* 110110 */
+ { /* 28 */ 1, { 0, 1, 1, 1 } }, /* 110111 */
+ { /* 29 */ 1, { 1, 0, 0, 1 } }, /* 111000 */
+ { /* 30 */ 1, { 1, 1, 1, 0 } }, /* 111001 */
+ { /* 31 */ 0, { 6, 7, 0, 0 } },
+ { /* 32 */ 0, { 7, 8, 0, 0 } },
+ { /* 33 */ 0, { 8, 9, 0, 0 } },
+ { /* 34 */ 0, { 9, 10, 0, 0 } },
+ { /* 35 */ 0, { 10, 11, 0, 0 } },
+ { /* 36 */ 0, { 11, 12, 0, 0 } },
+ { /* 37 */ 1, { 1, 1, 1, 1 } }, /* 1110100 */
+ { /* 38 */ 1, { 1, 0, 1, 1 } }, /* 1110101 */
+ { /* 39 */ 1, { 1, 1, 0, 1 } }, /* 1110110 */
+ { /* 40 */ 0, { 9, 10, 0, 0 } },
+ { /* 41 */ 0, { 10, 11, 0, 0 } },
+ { /* 42 */ 0, { 11, 12, 0, 0 } },
+ { /* 43 */ 0, { 12, 13, 0, 0 } },
+ { /* 44 */ 0, { 13, 14, 0, 0 } },
+ { /* 45 */ 0, { 14, 15, 0, 0 } },
+ { /* 46 */ 0, { 15, 16, 0, 0 } },
+ { /* 47 */ 0, { 16, 17, 0, 0 } },
+ { /* 48 */ 0, { 17, 18, 0, 0 } },
+ { /* 49 */ 1, { 2, 0, 0, 0 } }, /* 11101110 */
+ { /* 50 */ 1, { 0, 0, 0, 2 } }, /* 11101111 */
+ { /* 51 */ 1, { 0, 0, 1, 2 } }, /* 11110000 */
+ { /* 52 */ 1, { 2, 1, 0, 0 } }, /* 11110001 */
+ { /* 53 */ 1, { 1, 2, 1, 0 } }, /* 11110010 */
+ { /* 54 */ 0, { 13, 14, 0, 0 } },
+ { /* 55 */ 0, { 14, 15, 0, 0 } },
+ { /* 56 */ 0, { 15, 16, 0, 0 } },
+ { /* 57 */ 0, { 16, 17, 0, 0 } },
+ { /* 58 */ 0, { 17, 18, 0, 0 } },
+ { /* 59 */ 0, { 18, 19, 0, 0 } },
+ { /* 60 */ 0, { 19, 20, 0, 0 } },
+ { /* 61 */ 0, { 20, 21, 0, 0 } },
+ { /* 62 */ 0, { 21, 22, 0, 0 } },
+ { /* 63 */ 0, { 22, 23, 0, 0 } },
+ { /* 64 */ 0, { 23, 24, 0, 0 } },
+ { /* 65 */ 0, { 24, 25, 0, 0 } },
+ { /* 66 */ 0, { 25, 26, 0, 0 } },
+ { /* 67 */ 1, { 0, 0, 2, 1 } },
+ { /* 68 */ 1, { 0, 1, 2, 1 } },
+ { /* 69 */ 1, { 1, 2, 0, 0 } },
+ { /* 70 */ 1, { 0, 1, 1, 2 } },
+ { /* 71 */ 1, { 2, 1, 1, 0 } },
+ { /* 72 */ 1, { 0, 0, 2, 0 } },
+ { /* 73 */ 1, { 0, 2, 1, 0 } },
+ { /* 74 */ 1, { 0, 1, 2, 0 } },
+ { /* 75 */ 1, { 0, 2, 0, 0 } },
+ { /* 76 */ 1, { 0, 1, 0, 2 } },
+ { /* 77 */ 1, { 2, 0, 1, 0 } },
+ { /* 78 */ 1, { 1, 2, 1, 1 } },
+ { /* 79 */ 1, { 0, 2, 1, 1 } },
+ { /* 80 */ 1, { 1, 1, 2, 0 } },
+ { /* 81 */ 1, { 1, 1, 2, 1 } },
+ { /* 82 */ 0, { 11, 12, 0, 0 } },
+ { /* 83 */ 0, { 12, 13, 0, 0 } },
+ { /* 84 */ 0, { 13, 14, 0, 0 } },
+ { /* 85 */ 0, { 14, 15, 0, 0 } },
+ { /* 86 */ 0, { 15, 16, 0, 0 } },
+ { /* 87 */ 0, { 16, 17, 0, 0 } },
+ { /* 88 */ 0, { 17, 18, 0, 0 } },
+ { /* 89 */ 0, { 18, 19, 0, 0 } },
+ { /* 90 */ 0, { 19, 20, 0, 0 } },
+ { /* 91 */ 0, { 20, 21, 0, 0 } },
+ { /* 92 */ 0, { 21, 22, 0, 0 } },
+ { /* 93 */ 1, { 1, 2, 0, 1 } }, /* 1111101010 */
+ { /* 94 */ 1, { 1, 0, 2, 0 } }, /* 1111101011 */
+ { /* 95 */ 1, { 1, 0, 2, 1 } }, /* 1111101100 */
+ { /* 96 */ 1, { 0, 2, 0, 1 } }, /* 1111101101 */
+ { /* 97 */ 1, { 2, 1, 1, 1 } }, /* 1111101110 */
+ { /* 98 */ 1, { 1, 1, 1, 2 } }, /* 1111101111 */
+ { /* 99 */ 1, { 2, 1, 0, 1 } }, /* 1111110000 */
+ { /* 00 */ 1, { 1, 0, 1, 2 } }, /* 1111110001 */
+ { /* 01 */ 1, { 0, 0, 2, 2 } }, /* 1111110010 */
+ { /* 02 */ 1, { 0, 1, 2, 2 } }, /* 1111110011 */
+ { /* 03 */ 1, { 2, 2, 1, 0 } }, /* 1111110100 */
+ { /* 04 */ 1, { 1, 2, 2, 0 } }, /* 1111110101 */
+ { /* 05 */ 1, { 1, 0, 0, 2 } }, /* 1111110110 */
+ { /* 06 */ 1, { 2, 0, 0, 1 } }, /* 1111110111 */
+ { /* 07 */ 1, { 0, 2, 2, 1 } }, /* 1111111000 */
+ { /* 08 */ 0, { 7, 8, 0, 0 } },
+ { /* 09 */ 0, { 8, 9, 0, 0 } },
+ { /* 10 */ 0, { 9, 10, 0, 0 } },
+ { /* 11 */ 0, { 10, 11, 0, 0 } },
+ { /* 12 */ 0, { 11, 12, 0, 0 } },
+ { /* 13 */ 0, { 12, 13, 0, 0 } },
+ { /* 14 */ 0, { 13, 14, 0, 0 } },
+ { /* 15 */ 1, { 2, 2, 0, 0 } }, /* 11111110010 */
+ { /* 16 */ 1, { 1, 2, 2, 1 } }, /* 11111110011 */
+ { /* 17 */ 1, { 1, 1, 0, 2 } }, /* 11111110100 */
+ { /* 18 */ 1, { 2, 0, 1, 1 } }, /* 11111110101 */
+ { /* 19 */ 1, { 1, 1, 2, 2 } }, /* 11111110110 */
+ { /* 20 */ 1, { 2, 2, 1, 1 } }, /* 11111110111 */
+ { /* 21 */ 1, { 0, 2, 2, 0 } }, /* 11111111000 */
+ { /* 22 */ 1, { 0, 2, 1, 2 } }, /* 11111111001 */
+ { /* 23 */ 0, { 6, 7, 0, 0 } },
+ { /* 24 */ 0, { 7, 8, 0, 0 } },
+ { /* 25 */ 0, { 8, 9, 0, 0 } },
+ { /* 26 */ 0, { 9, 10, 0, 0 } },
+ { /* 27 */ 0, { 10, 11, 0, 0 } },
+ { /* 28 */ 0, { 11, 12, 0, 0 } },
+ { /* 29 */ 1, { 1, 0, 2, 2 } }, /* 111111110100 */
+ { /* 30 */ 1, { 2, 2, 0, 1 } }, /* 111111110101 */
+ { /* 31 */ 1, { 2, 1, 2, 0 } }, /* 111111110110 */
+ { /* 32 */ 1, { 2, 2, 2, 0 } }, /* 111111110111 */
+ { /* 33 */ 1, { 0, 2, 2, 2 } }, /* 111111111000 */
+ { /* 34 */ 1, { 2, 2, 2, 1 } }, /* 111111111001 */
+ { /* 35 */ 1, { 2, 1, 2, 1 } }, /* 111111111010 */
+ { /* 36 */ 1, { 1, 2, 1, 2 } }, /* 111111111011 */
+ { /* 37 */ 1, { 1, 2, 2, 2 } }, /* 111111111100 */
+ { /* 38 */ 0, { 3, 4, 0, 0 } },
+ { /* 39 */ 0, { 4, 5, 0, 0 } },
+ { /* 40 */ 0, { 5, 6, 0, 0 } },
+ { /* 41 */ 1, { 0, 2, 0, 2 } }, /* 1111111111010 */
+ { /* 42 */ 1, { 2, 0, 2, 0 } }, /* 1111111111011 */
+ { /* 43 */ 1, { 1, 2, 0, 2 } }, /* 1111111111100 */
+ { /* 44 */ 0, { 3, 4, 0, 0 } },
+ { /* 45 */ 0, { 4, 5, 0, 0 } },
+ { /* 46 */ 0, { 5, 6, 0, 0 } },
+ { /* 47 */ 1, { 2, 0, 2, 1 } }, /* 11111111111010 */
+ { /* 48 */ 1, { 2, 1, 1, 2 } }, /* 11111111111011 */
+ { /* 49 */ 1, { 2, 1, 0, 2 } }, /* 11111111111100 */
+ { /* 50 */ 0, { 3, 4, 0, 0 } },
+ { /* 51 */ 0, { 4, 5, 0, 0 } },
+ { /* 52 */ 0, { 5, 6, 0, 0 } },
+ { /* 53 */ 1, { 2, 2, 2, 2 } }, /* 111111111111010 */
+ { /* 54 */ 1, { 2, 2, 1, 2 } }, /* 111111111111011 */
+ { /* 55 */ 1, { 2, 1, 2, 2 } }, /* 111111111111100 */
+ { /* 56 */ 1, { 2, 0, 1, 2 } }, /* 111111111111101 */
+ { /* 57 */ 1, { 2, 0, 0, 2 } }, /* 111111111111110 */
+ { /* 58 */ 0, { 1, 2, 0, 0 } },
+ { /* 59 */ 1, { 2, 2, 0, 2 } }, /* 1111111111111110 */
+ { /* 60 */ 1, { 2, 0, 2, 2 } } /* 1111111111111111 */
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_4.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_4.h
new file mode 100644
index 000000000..eeb9503dc
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_4.h
@@ -0,0 +1,196 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_4.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* 2-step huffman table HCB_4 */
+
+
+/* 1st step: 5 bits
+ * 2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb4_1[] = {
+ /* 4 bit codewords */
+ { /* 00000 */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* 00010 */ 1, 0 },
+ { /* */ 1, 0 },
+ { /* 00100 */ 2, 0 },
+ { /* */ 2, 0 },
+ { /* 00110 */ 3, 0 },
+ { /* */ 3, 0 },
+ { /* 01000 */ 4, 0 },
+ { /* */ 4, 0 },
+ { /* 01010 */ 5, 0 },
+ { /* */ 5, 0 },
+ { /* 01100 */ 6, 0 },
+ { /* */ 6, 0 },
+ { /* 01110 */ 7, 0 },
+ { /* */ 7, 0 },
+ { /* 10000 */ 8, 0 },
+ { /* */ 8, 0 },
+ { /* 10010 */ 9, 0 },
+ { /* */ 9, 0 },
+
+ /* 5 bit codewords */
+ { /* 10100 */ 10, 0 },
+ { /* 10101 */ 11, 0 },
+ { /* 10110 */ 12, 0 },
+ { /* 10111 */ 13, 0 },
+ { /* 11000 */ 14, 0 },
+ { /* 11001 */ 15, 0 },
+
+ /* 7 bit codewords */
+ { /* 11010 */ 16, 2 },
+ { /* 11011 */ 20, 2 },
+
+ /* 7/8 bit codewords */
+ { /* 11100 */ 24, 3 },
+
+ /* 8 bit codewords */
+ { /* 11101 */ 32, 3 },
+
+ /* 8/9 bit codewords */
+ { /* 11110 */ 40, 4 },
+
+ /* 9/10/11/12 bit codewords */
+ { /* 11111 */ 56, 7 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_quad hcb4_2[] = {
+ /* 4 bit codewords */
+ { 4, 1, 1, 1, 1 },
+ { 4, 0, 1, 1, 1 },
+ { 4, 1, 1, 0, 1 },
+ { 4, 1, 1, 1, 0 },
+ { 4, 1, 0, 1, 1 },
+ { 4, 1, 0, 0, 0 },
+ { 4, 1, 1, 0, 0 },
+ { 4, 0, 0, 0, 0 },
+ { 4, 0, 0, 1, 1 },
+ { 4, 1, 0, 1, 0 },
+
+ /* 5 bit codewords */
+ { 5, 1, 0, 0, 1 },
+ { 5, 0, 1, 1, 0 },
+ { 5, 0, 0, 0, 1 },
+ { 5, 0, 1, 0, 1 },
+ { 5, 0, 0, 1, 0 },
+ { 5, 0, 1, 0, 0 },
+
+ /* 7 bit codewords */
+ /* first 5 bits: 11010 */
+ { 7, 2, 1, 1, 1 },
+ { 7, 1, 1, 2, 1 },
+ { 7, 1, 2, 1, 1 },
+ { 7, 1, 1, 1, 2 },
+ /* first 5 bits: 11011 */
+ { 7, 2, 1, 1, 0 },
+ { 7, 2, 1, 0, 1 },
+ { 7, 1, 2, 1, 0 },
+ { 7, 2, 0, 1, 1 },
+
+ /* 7/8 bit codewords */
+ /* first 5 bits: 11100 */
+ { 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 },
+ { 8, 0, 1, 1, 2 },
+ { 8, 1, 1, 2, 0 },
+ { 8, 0, 2, 1, 1 },
+ { 8, 1, 0, 1, 2 },
+ { 8, 1, 2, 0, 1 },
+ { 8, 1, 1, 0, 2 },
+
+ /* 8 bit codewords */
+ { 8, 1, 0, 2, 1 },
+ { 8, 2, 1, 0, 0 },
+ { 8, 2, 0, 1, 0 },
+ { 8, 1, 2, 0, 0 },
+ { 8, 2, 0, 0, 1 },
+ { 8, 0, 1, 0, 2 },
+ { 8, 0, 2, 1, 0 },
+ { 8, 0, 0, 1, 2 },
+
+ /* 8/9 bit codewords */
+ { 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 },
+ { 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 },
+ { 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 },
+ { 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 },
+ { 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 },
+ { 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 },
+ { 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 },
+ { 9, 0, 2, 0, 0 },
+ { 9, 0, 0, 2, 0 },
+
+ /* 9/10/11 bit codewords */
+ /* 9 bit codewords repeated 2^3 = 8 times */
+ { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
+ { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
+ { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
+ { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
+ { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
+ { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
+ { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
+ { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
+ { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
+ { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
+ { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
+ { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
+ /* 10 bit codewords repeated 2^2 = 4 times */
+ { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 },
+ { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 },
+ { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 },
+ { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 },
+ { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 },
+ { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 },
+ { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 },
+ { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 },
+ { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 },
+ { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 },
+ { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 },
+ { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 },
+ { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 },
+ { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 },
+ /* 11 bit codewords repeated 2^1 = 2 times */
+ { 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 },
+ { 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 },
+ { 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 },
+ { 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 },
+ { 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 },
+ { 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 },
+ { 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 },
+ { 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 },
+ { 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 },
+ { 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 },
+ { 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 },
+ /* 12 bit codewords */
+ { 12, 2, 2, 0, 2 },
+ { 12, 2, 0, 2, 2 },
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_5.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_5.h
new file mode 100644
index 000000000..aadaca26f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_5.h
@@ -0,0 +1,193 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_5.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* Binary search huffman table HCB_5 */
+
+
+static hcb_bin_pair hcb5[] = {
+ { /* 0 */ 0, { 1, 2 } },
+ { /* 1 */ 1, { 0, 0 } }, /* 0 */
+ { /* 2 */ 0, { 1, 2 } },
+ { /* 3 */ 0, { 2, 3 } },
+ { /* 4 */ 0, { 3, 4 } },
+ { /* 5 */ 0, { 4, 5 } },
+ { /* 6 */ 0, { 5, 6 } },
+ { /* 7 */ 0, { 6, 7 } },
+ { /* 8 */ 0, { 7, 8 } },
+ { /* 9 */ 1, { -1, 0 } }, /* 1000 */
+ { /* 10 */ 1, { 1, 0 } }, /* 1001 */
+ { /* 11 */ 1, { 0, 1 } }, /* 1010 */
+ { /* 12 */ 1, { 0, -1 } }, /* 1011 */
+ { /* 13 */ 0, { 4, 5 } },
+ { /* 14 */ 0, { 5, 6 } },
+ { /* 15 */ 0, { 6, 7 } },
+ { /* 16 */ 0, { 7, 8 } },
+ { /* 17 */ 1, { 1, -1 } },
+ { /* 18 */ 1, { -1, 1 } },
+ { /* 19 */ 1, { -1, -1 } },
+ { /* 20 */ 1, { 1, 1 } },
+ { /* 21 */ 0, { 4, 5 } },
+ { /* 22 */ 0, { 5, 6 } },
+ { /* 23 */ 0, { 6, 7 } },
+ { /* 24 */ 0, { 7, 8 } },
+ { /* 25 */ 0, { 8, 9 } },
+ { /* 26 */ 0, { 9, 10 } },
+ { /* 27 */ 0, { 10, 11 } },
+ { /* 28 */ 0, { 11, 12 } },
+ { /* 29 */ 0, { 12, 13 } },
+ { /* 30 */ 0, { 13, 14 } },
+ { /* 31 */ 0, { 14, 15 } },
+ { /* 32 */ 0, { 15, 16 } },
+ { /* 33 */ 1, { -2, 0 } },
+ { /* 34 */ 1, { 0, 2 } },
+ { /* 35 */ 1, { 2, 0 } },
+ { /* 36 */ 1, { 0, -2 } },
+ { /* 37 */ 0, { 12, 13 } },
+ { /* 38 */ 0, { 13, 14 } },
+ { /* 39 */ 0, { 14, 15 } },
+ { /* 40 */ 0, { 15, 16 } },
+ { /* 41 */ 0, { 16, 17 } },
+ { /* 42 */ 0, { 17, 18 } },
+ { /* 43 */ 0, { 18, 19 } },
+ { /* 44 */ 0, { 19, 20 } },
+ { /* 45 */ 0, { 20, 21 } },
+ { /* 46 */ 0, { 21, 22 } },
+ { /* 47 */ 0, { 22, 23 } },
+ { /* 48 */ 0, { 23, 24 } },
+ { /* 49 */ 1, { -2, -1 } },
+ { /* 50 */ 1, { 2, 1 } },
+ { /* 51 */ 1, { -1, -2 } },
+ { /* 52 */ 1, { 1, 2 } },
+ { /* 53 */ 1, { -2, 1 } },
+ { /* 54 */ 1, { 2, -1 } },
+ { /* 55 */ 1, { -1, 2 } },
+ { /* 56 */ 1, { 1, -2 } },
+ { /* 57 */ 1, { -3, 0 } },
+ { /* 58 */ 1, { 3, 0 } },
+ { /* 59 */ 1, { 0, -3 } },
+ { /* 60 */ 1, { 0, 3 } },
+ { /* 61 */ 0, { 12, 13 } },
+ { /* 62 */ 0, { 13, 14 } },
+ { /* 63 */ 0, { 14, 15 } },
+ { /* 64 */ 0, { 15, 16 } },
+ { /* 65 */ 0, { 16, 17 } },
+ { /* 66 */ 0, { 17, 18 } },
+ { /* 67 */ 0, { 18, 19 } },
+ { /* 68 */ 0, { 19, 20 } },
+ { /* 69 */ 0, { 20, 21 } },
+ { /* 70 */ 0, { 21, 22 } },
+ { /* 71 */ 0, { 22, 23 } },
+ { /* 72 */ 0, { 23, 24 } },
+ { /* 73 */ 1, { -3, -1 } },
+ { /* 74 */ 1, { 1, 3 } },
+ { /* 75 */ 1, { 3, 1 } },
+ { /* 76 */ 1, { -1, -3 } },
+ { /* 77 */ 1, { -3, 1 } },
+ { /* 78 */ 1, { 3, -1 } },
+ { /* 79 */ 1, { 1, -3 } },
+ { /* 80 */ 1, { -1, 3 } },
+ { /* 81 */ 1, { -2, 2 } },
+ { /* 82 */ 1, { 2, 2 } },
+ { /* 83 */ 1, { -2, -2 } },
+ { /* 84 */ 1, { 2, -2 } },
+ { /* 85 */ 0, { 12, 13 } },
+ { /* 86 */ 0, { 13, 14 } },
+ { /* 87 */ 0, { 14, 15 } },
+ { /* 88 */ 0, { 15, 16 } },
+ { /* 89 */ 0, { 16, 17 } },
+ { /* 90 */ 0, { 17, 18 } },
+ { /* 91 */ 0, { 18, 19 } },
+ { /* 92 */ 0, { 19, 20 } },
+ { /* 93 */ 0, { 20, 21 } },
+ { /* 94 */ 0, { 21, 22 } },
+ { /* 95 */ 0, { 22, 23 } },
+ { /* 96 */ 0, { 23, 24 } },
+ { /* 97 */ 1, { -3, -2 } },
+ { /* 98 */ 1, { 3, -2 } },
+ { /* 99 */ 1, { -2, 3 } },
+ { /* 00 */ 1, { 2, -3 } },
+ { /* 01 */ 1, { 3, 2 } },
+ { /* 02 */ 1, { 2, 3 } },
+ { /* 03 */ 1, { -3, 2 } },
+ { /* 04 */ 1, { -2, -3 } },
+ { /* 05 */ 1, { 0, -4 } },
+ { /* 06 */ 1, { -4, 0 } },
+ { /* 07 */ 1, { 4, 1 } },
+ { /* 08 */ 1, { 4, 0 } },
+ { /* 09 */ 0, { 12, 13 } },
+ { /* 10 */ 0, { 13, 14 } },
+ { /* 11 */ 0, { 14, 15 } },
+ { /* 12 */ 0, { 15, 16 } },
+ { /* 13 */ 0, { 16, 17 } },
+ { /* 14 */ 0, { 17, 18 } },
+ { /* 15 */ 0, { 18, 19 } },
+ { /* 16 */ 0, { 19, 20 } },
+ { /* 17 */ 0, { 20, 21 } },
+ { /* 18 */ 0, { 21, 22 } },
+ { /* 19 */ 0, { 22, 23 } },
+ { /* 20 */ 0, { 23, 24 } },
+ { /* 21 */ 1, { -4, -1 } },
+ { /* 22 */ 1, { 0, 4 } },
+ { /* 23 */ 1, { 4, -1 } },
+ { /* 24 */ 1, { -1, -4 } },
+ { /* 25 */ 1, { 1, 4 } },
+ { /* 26 */ 1, { -1, 4 } },
+ { /* 27 */ 1, { -4, 1 } },
+ { /* 28 */ 1, { 1, -4 } },
+ { /* 29 */ 1, { 3, -3 } },
+ { /* 30 */ 1, { -3, -3 } },
+ { /* 31 */ 1, { -3, 3 } },
+ { /* 32 */ 1, { -2, 4 } },
+ { /* 33 */ 1, { -4, -2 } },
+ { /* 34 */ 1, { 4, 2 } },
+ { /* 35 */ 1, { 2, -4 } },
+ { /* 36 */ 1, { 2, 4 } },
+ { /* 37 */ 1, { 3, 3 } },
+ { /* 38 */ 1, { -4, 2 } },
+ { /* 39 */ 0, { 6, 7 } },
+ { /* 40 */ 0, { 7, 8 } },
+ { /* 41 */ 0, { 8, 9 } },
+ { /* 42 */ 0, { 9, 10 } },
+ { /* 43 */ 0, { 10, 11 } },
+ { /* 44 */ 0, { 11, 12 } },
+ { /* 45 */ 1, { -2, -4 } },
+ { /* 46 */ 1, { 4, -2 } },
+ { /* 47 */ 1, { 3, -4 } },
+ { /* 48 */ 1, { -4, -3 } },
+ { /* 49 */ 1, { -4, 3 } },
+ { /* 50 */ 1, { 3, 4 } },
+ { /* 51 */ 1, { -3, 4 } },
+ { /* 52 */ 1, { 4, 3 } },
+ { /* 53 */ 1, { 4, -3 } },
+ { /* 54 */ 1, { -3, -4 } },
+ { /* 55 */ 0, { 2, 3 } },
+ { /* 56 */ 0, { 3, 4 } },
+ { /* 57 */ 1, { 4, -4 } },
+ { /* 58 */ 1, { -4, 4 } },
+ { /* 59 */ 1, { 4, 4 } },
+ { /* 60 */ 1, { -4, -4 } }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_6.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_6.h
new file mode 100644
index 000000000..71d0ba69b
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_6.h
@@ -0,0 +1,179 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_6.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* 2-step huffman table HCB_6 */
+
+
+/* 1st step: 5 bits
+ * 2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb6_1[] = {
+ /* 4 bit codewords */
+ { /* 00000 */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* 00010 */ 1, 0 },
+ { /* */ 1, 0 },
+ { /* 00100 */ 2, 0 },
+ { /* */ 2, 0 },
+ { /* 00110 */ 3, 0 },
+ { /* */ 3, 0 },
+ { /* 01000 */ 4, 0 },
+ { /* */ 4, 0 },
+ { /* 01010 */ 5, 0 },
+ { /* */ 5, 0 },
+ { /* 01100 */ 6, 0 },
+ { /* */ 6, 0 },
+ { /* 01110 */ 7, 0 },
+ { /* */ 7, 0 },
+ { /* 10000 */ 8, 0 },
+ { /* */ 8, 0 },
+
+ /* 6 bit codewords */
+ { /* 10010 */ 9, 1 },
+ { /* 10011 */ 11, 1 },
+ { /* 10100 */ 13, 1 },
+ { /* 10101 */ 15, 1 },
+ { /* 10110 */ 17, 1 },
+ { /* 10111 */ 19, 1 },
+ { /* 11000 */ 21, 1 },
+ { /* 11001 */ 23, 1 },
+
+ /* 7 bit codewords */
+ { /* 11010 */ 25, 2 },
+ { /* 11011 */ 29, 2 },
+ { /* 11100 */ 33, 2 },
+
+ /* 7/8 bit codewords */
+ { /* 11101 */ 37, 3 },
+
+ /* 8/9 bit codewords */
+ { /* 11110 */ 45, 4 },
+
+ /* 9/10/11 bit codewords */
+ { /* 11111 */ 61, 6 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_pair hcb6_2[] = {
+ /* 4 bit codewords */
+ { 4, 0, 0 },
+ { 4, 1, 0 },
+ { 4, 0, -1 },
+ { 4, 0, 1 },
+ { 4, -1, 0 },
+ { 4, 1, 1 },
+ { 4, -1, 1 },
+ { 4, 1, -1 },
+ { 4, -1, -1 },
+
+ /* 6 bit codewords */
+ { 6, 2, -1 },
+ { 6, 2, 1 },
+ { 6, -2, 1 },
+ { 6, -2, -1 },
+ { 6, -2, 0 },
+ { 6, -1, 2 },
+ { 6, 2, 0 },
+ { 6, 1, -2 },
+ { 6, 1, 2 },
+ { 6, 0, -2 },
+ { 6, -1, -2 },
+ { 6, 0, 2 },
+ { 6, 2, -2 },
+ { 6, -2, 2 },
+ { 6, -2, -2 },
+ { 6, 2, 2 },
+
+ /* 7 bit codewords */
+ { 7, -3, 1 },
+ { 7, 3, 1 },
+ { 7, 3, -1 },
+ { 7, -1, 3 },
+ { 7, -3, -1 },
+ { 7, 1, 3 },
+ { 7, 1, -3 },
+ { 7, -1, -3 },
+ { 7, 3, 0 },
+ { 7, -3, 0 },
+ { 7, 0, -3 },
+ { 7, 0, 3 },
+
+ /* 7/8 bit codewords */
+ { 7, 3, 2 }, { 7, 3, 2 },
+ { 8, -3, -2 },
+ { 8, -2, 3 },
+ { 8, 2, 3 },
+ { 8, 3, -2 },
+ { 8, 2, -3 },
+ { 8, -2, -3 },
+
+ /* 8 bit codewords */
+ { 8, -3, 2 }, { 8, -3, 2 },
+ { 8, 3, 3 }, { 8, 3, 3 },
+ { 9, 3, -3 },
+ { 9, -3, -3 },
+ { 9, -3, 3 },
+ { 9, 1, -4 },
+ { 9, -1, -4 },
+ { 9, 4, 1 },
+ { 9, -4, 1 },
+ { 9, -4, -1 },
+ { 9, 1, 4 },
+ { 9, 4, -1 },
+ { 9, -1, 4 },
+ { 9, 0, -4 },
+
+ /* 9/10/11 bit codewords */
+ { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 },
+ { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 },
+ { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 },
+ { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 },
+ { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 },
+ { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 },
+ { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 },
+ { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 },
+ { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 },
+ { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 },
+ { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 },
+ { 10, -3, -4 }, { 10, -3, -4 },
+ { 10, -3, 4 }, { 10, -3, 4 },
+ { 10, 3, -4 }, { 10, 3, -4 },
+ { 10, 4, -3 }, { 10, 4, -3 },
+ { 10, 3, 4 }, { 10, 3, 4 },
+ { 10, 4, 3 }, { 10, 4, 3 },
+ { 10, -4, 3 }, { 10, -4, 3 },
+ { 10, -4, -3 }, { 10, -4, -3 },
+ { 11, 4, 4 },
+ { 11, -4, 4 },
+ { 11, -4, -4 },
+ { 11, 4, -4 }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_7.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_7.h
new file mode 100644
index 000000000..c08e62250
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_7.h
@@ -0,0 +1,159 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_7.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* Binary search huffman table HCB_7 */
+
+
+static hcb_bin_pair hcb7[] = {
+ { /* 0 */ 0, { 1, 2 } },
+ { /* 1 */ 1, { 0, 0 } },
+ { /* 2 */ 0, { 1, 2 } },
+ { /* 3 */ 0, { 2, 3 } },
+ { /* 4 */ 0, { 3, 4 } },
+ { /* 5 */ 1, { 1, 0 } },
+ { /* 6 */ 1, { 0, 1 } },
+ { /* 7 */ 0, { 2, 3 } },
+ { /* 8 */ 0, { 3, 4 } },
+ { /* 9 */ 1, { 1, 1 } },
+ { /* 10 */ 0, { 3, 4 } },
+ { /* 11 */ 0, { 4, 5 } },
+ { /* 12 */ 0, { 5, 6 } },
+ { /* 13 */ 0, { 6, 7 } },
+ { /* 14 */ 0, { 7, 8 } },
+ { /* 15 */ 0, { 8, 9 } },
+ { /* 16 */ 0, { 9, 10 } },
+ { /* 17 */ 0, { 10, 11 } },
+ { /* 18 */ 0, { 11, 12 } },
+ { /* 19 */ 1, { 2, 1 } },
+ { /* 20 */ 1, { 1, 2 } },
+ { /* 21 */ 1, { 2, 0 } },
+ { /* 22 */ 1, { 0, 2 } },
+ { /* 23 */ 0, { 8, 9 } },
+ { /* 24 */ 0, { 9, 10 } },
+ { /* 25 */ 0, { 10, 11 } },
+ { /* 26 */ 0, { 11, 12 } },
+ { /* 27 */ 0, { 12, 13 } },
+ { /* 28 */ 0, { 13, 14 } },
+ { /* 29 */ 0, { 14, 15 } },
+ { /* 30 */ 0, { 15, 16 } },
+ { /* 31 */ 1, { 3, 1 } },
+ { /* 32 */ 1, { 1, 3 } },
+ { /* 33 */ 1, { 2, 2 } },
+ { /* 34 */ 1, { 3, 0 } },
+ { /* 35 */ 1, { 0, 3 } },
+ { /* 36 */ 0, { 11, 12 } },
+ { /* 37 */ 0, { 12, 13 } },
+ { /* 38 */ 0, { 13, 14 } },
+ { /* 39 */ 0, { 14, 15 } },
+ { /* 40 */ 0, { 15, 16 } },
+ { /* 41 */ 0, { 16, 17 } },
+ { /* 42 */ 0, { 17, 18 } },
+ { /* 43 */ 0, { 18, 19 } },
+ { /* 44 */ 0, { 19, 20 } },
+ { /* 45 */ 0, { 20, 21 } },
+ { /* 46 */ 0, { 21, 22 } },
+ { /* 47 */ 1, { 2, 3 } },
+ { /* 48 */ 1, { 3, 2 } },
+ { /* 49 */ 1, { 1, 4 } },
+ { /* 50 */ 1, { 4, 1 } },
+ { /* 51 */ 1, { 1, 5 } },
+ { /* 52 */ 1, { 5, 1 } },
+ { /* 53 */ 1, { 3, 3 } },
+ { /* 54 */ 1, { 2, 4 } },
+ { /* 55 */ 1, { 0, 4 } },
+ { /* 56 */ 1, { 4, 0 } },
+ { /* 57 */ 0, { 12, 13 } },
+ { /* 58 */ 0, { 13, 14 } },
+ { /* 59 */ 0, { 14, 15 } },
+ { /* 60 */ 0, { 15, 16 } },
+ { /* 61 */ 0, { 16, 17 } },
+ { /* 62 */ 0, { 17, 18 } },
+ { /* 63 */ 0, { 18, 19 } },
+ { /* 64 */ 0, { 19, 20 } },
+ { /* 65 */ 0, { 20, 21 } },
+ { /* 66 */ 0, { 21, 22 } },
+ { /* 67 */ 0, { 22, 23 } },
+ { /* 68 */ 0, { 23, 24 } },
+ { /* 69 */ 1, { 4, 2 } },
+ { /* 70 */ 1, { 2, 5 } },
+ { /* 71 */ 1, { 5, 2 } },
+ { /* 72 */ 1, { 0, 5 } },
+ { /* 73 */ 1, { 6, 1 } },
+ { /* 74 */ 1, { 5, 0 } },
+ { /* 75 */ 1, { 1, 6 } },
+ { /* 76 */ 1, { 4, 3 } },
+ { /* 77 */ 1, { 3, 5 } },
+ { /* 78 */ 1, { 3, 4 } },
+ { /* 79 */ 1, { 5, 3 } },
+ { /* 80 */ 1, { 2, 6 } },
+ { /* 81 */ 1, { 6, 2 } },
+ { /* 82 */ 1, { 1, 7 } },
+ { /* 83 */ 0, { 10, 11 } },
+ { /* 84 */ 0, { 11, 12 } },
+ { /* 85 */ 0, { 12, 13 } },
+ { /* 86 */ 0, { 13, 14 } },
+ { /* 87 */ 0, { 14, 15 } },
+ { /* 88 */ 0, { 15, 16 } },
+ { /* 89 */ 0, { 16, 17 } },
+ { /* 90 */ 0, { 17, 18 } },
+ { /* 91 */ 0, { 18, 19 } },
+ { /* 92 */ 0, { 19, 20 } },
+ { /* 93 */ 1, { 3, 6 } },
+ { /* 94 */ 1, { 0, 6 } },
+ { /* 95 */ 1, { 6, 0 } },
+ { /* 96 */ 1, { 4, 4 } },
+ { /* 97 */ 1, { 7, 1 } },
+ { /* 98 */ 1, { 4, 5 } },
+ { /* 99 */ 1, { 7, 2 } },
+ { /* 00 */ 1, { 5, 4 } },
+ { /* 01 */ 1, { 6, 3 } },
+ { /* 02 */ 1, { 2, 7 } },
+ { /* 03 */ 1, { 7, 3 } },
+ { /* 04 */ 1, { 6, 4 } },
+ { /* 05 */ 1, { 5, 5 } },
+ { /* 06 */ 1, { 4, 6 } },
+ { /* 07 */ 1, { 3, 7 } },
+ { /* 08 */ 0, { 5, 6 } },
+ { /* 09 */ 0, { 6, 7 } },
+ { /* 10 */ 0, { 7, 8 } },
+ { /* 11 */ 0, { 8, 9 } },
+ { /* 12 */ 0, { 9, 10 } },
+ { /* 13 */ 1, { 7, 0 } },
+ { /* 14 */ 1, { 0, 7 } },
+ { /* 15 */ 1, { 6, 5 } },
+ { /* 16 */ 1, { 5, 6 } },
+ { /* 17 */ 1, { 7, 4 } },
+ { /* 18 */ 1, { 4, 7 } },
+ { /* 19 */ 1, { 5, 7 } },
+ { /* 20 */ 1, { 7, 5 } },
+ { /* 21 */ 0, { 2, 3 } },
+ { /* 22 */ 0, { 3, 4 } },
+ { /* 23 */ 1, { 7, 6 } },
+ { /* 24 */ 1, { 6, 6 } },
+ { /* 25 */ 1, { 6, 7 } },
+ { /* 26 */ 1, { 7, 7 } }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_8.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_8.h
new file mode 100644
index 000000000..4a676e858
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_8.h
@@ -0,0 +1,170 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_8.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* 2-step huffman table HCB_8 */
+
+
+/* 1st step: 5 bits
+ * 2^5 = 32 entries
+ *
+ * Used to find offset into 2nd step table and number of extra bits to get
+ */
+static hcb hcb8_1[] = {
+ /* 3 bit codeword */
+ { /* 00000 */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+ { /* */ 0, 0 },
+
+ /* 4 bit codewords */
+ { /* 00100 */ 1, 0 },
+ { /* */ 1, 0 },
+ { /* 00110 */ 2, 0 },
+ { /* */ 2, 0 },
+ { /* 01000 */ 3, 0 },
+ { /* */ 3, 0 },
+ { /* 01010 */ 4, 0 },
+ { /* */ 4, 0 },
+ { /* 01100 */ 5, 0 },
+ { /* */ 5, 0 },
+
+ /* 5 bit codewords */
+ { /* 01110 */ 6, 0 },
+ { /* 01111 */ 7, 0 },
+ { /* 10000 */ 8, 0 },
+ { /* 10001 */ 9, 0 },
+ { /* 10010 */ 10, 0 },
+ { /* 10011 */ 11, 0 },
+ { /* 10100 */ 12, 0 },
+
+ /* 6 bit codewords */
+ { /* 10101 */ 13, 1 },
+ { /* 10110 */ 15, 1 },
+ { /* 10111 */ 17, 1 },
+ { /* 11000 */ 19, 1 },
+ { /* 11001 */ 21, 1 },
+
+ /* 7 bit codewords */
+ { /* 11010 */ 23, 2 },
+ { /* 11011 */ 27, 2 },
+ { /* 11100 */ 31, 2 },
+
+ /* 7/8 bit codewords */
+ { /* 11101 */ 35, 3 },
+
+ /* 8 bit codewords */
+ { /* 11110 */ 43, 3 },
+
+ /* 8/9/10 bit codewords */
+ { /* 11111 */ 51, 5 }
+};
+
+/* 2nd step table
+ *
+ * Gives size of codeword and actual data (x,y,v,w)
+ */
+static hcb_2_pair hcb8_2[] = {
+ /* 3 bit codeword */
+ { 3, 1, 1 },
+
+ /* 4 bit codewords */
+ { 4, 2, 1 },
+ { 4, 1, 0 },
+ { 4, 1, 2 },
+ { 4, 0, 1 },
+ { 4, 2, 2 },
+
+ /* 5 bit codewords */
+ { 5, 0, 0 },
+ { 5, 2, 0 },
+ { 5, 0, 2 },
+ { 5, 3, 1 },
+ { 5, 1, 3 },
+ { 5, 3, 2 },
+ { 5, 2, 3 },
+
+ /* 6 bit codewords */
+ { 6, 3, 3 },
+ { 6, 4, 1 },
+ { 6, 1, 4 },
+ { 6, 4, 2 },
+ { 6, 2, 4 },
+ { 6, 3, 0 },
+ { 6, 0, 3 },
+ { 6, 4, 3 },
+ { 6, 3, 4 },
+ { 6, 5, 2 },
+
+ /* 7 bit codewords */
+ { 7, 5, 1 },
+ { 7, 2, 5 },
+ { 7, 1, 5 },
+ { 7, 5, 3 },
+ { 7, 3, 5 },
+ { 7, 4, 4 },
+ { 7, 5, 4 },
+ { 7, 0, 4 },
+ { 7, 4, 5 },
+ { 7, 4, 0 },
+ { 7, 2, 6 },
+ { 7, 6, 2 },
+
+ /* 7/8 bit codewords */
+ { 7, 6, 1 }, { 7, 6, 1 },
+ { 7, 1, 6 }, { 7, 1, 6 },
+ { 8, 3, 6 },
+ { 8, 6, 3 },
+ { 8, 5, 5 },
+ { 8, 5, 0 },
+
+ /* 8 bit codewords */
+ { 8, 6, 4 },
+ { 8, 0, 5 },
+ { 8, 4, 6 },
+ { 8, 7, 1 },
+ { 8, 7, 2 },
+ { 8, 2, 7 },
+ { 8, 6, 5 },
+ { 8, 7, 3 },
+
+ /* 8/9/10 bit codewords */
+ { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 },
+ { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 },
+ { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 },
+ { 9, 6, 6 }, { 9, 6, 6 },
+ { 9, 7, 4 }, { 9, 7, 4 },
+ { 9, 6, 0 }, { 9, 6, 0 },
+ { 9, 4, 7 }, { 9, 4, 7 },
+ { 9, 0, 6 }, { 9, 0, 6 },
+ { 9, 7, 5 }, { 9, 7, 5 },
+ { 9, 7, 6 }, { 9, 7, 6 },
+ { 9, 6, 7 }, { 9, 6, 7 },
+ { 10, 5, 7 },
+ { 10, 7, 0 },
+ { 10, 0, 7 },
+ { 10, 7, 7 }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_9.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_9.h
new file mode 100644
index 000000000..9323821cb
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_9.h
@@ -0,0 +1,369 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_9.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* Binary search huffman table HCB_9 */
+
+
+static hcb_bin_pair hcb9[] = {
+ { /* 0 */ 0, { 1, 2 } },
+ { /* 1 */ 1, { 0, 0 } },
+ { /* 2 */ 0, { 1, 2 } },
+ { /* 3 */ 0, { 2, 3 } },
+ { /* 4 */ 0, { 3, 4 } },
+ { /* 5 */ 1, { 1, 0 } },
+ { /* 6 */ 1, { 0, 1 } },
+ { /* 7 */ 0, { 2, 3 } },
+ { /* 8 */ 0, { 3, 4 } },
+ { /* 9 */ 1, { 1, 1 } },
+ { /* 10 */ 0, { 3, 4 } },
+ { /* 11 */ 0, { 4, 5 } },
+ { /* 12 */ 0, { 5, 6 } },
+ { /* 13 */ 0, { 6, 7 } },
+ { /* 14 */ 0, { 7, 8 } },
+ { /* 15 */ 0, { 8, 9 } },
+ { /* 16 */ 0, { 9, 10 } },
+ { /* 17 */ 0, { 10, 11 } },
+ { /* 18 */ 0, { 11, 12 } },
+ { /* 19 */ 1, { 2, 1 } },
+ { /* 20 */ 1, { 1, 2 } },
+ { /* 21 */ 1, { 2, 0 } },
+ { /* 22 */ 1, { 0, 2 } },
+ { /* 23 */ 0, { 8, 9 } },
+ { /* 24 */ 0, { 9, 10 } },
+ { /* 25 */ 0, { 10, 11 } },
+ { /* 26 */ 0, { 11, 12 } },
+ { /* 27 */ 0, { 12, 13 } },
+ { /* 28 */ 0, { 13, 14 } },
+ { /* 29 */ 0, { 14, 15 } },
+ { /* 30 */ 0, { 15, 16 } },
+ { /* 31 */ 1, { 3, 1 } },
+ { /* 32 */ 1, { 2, 2 } },
+ { /* 33 */ 1, { 1, 3 } },
+ { /* 34 */ 0, { 13, 14 } },
+ { /* 35 */ 0, { 14, 15 } },
+ { /* 36 */ 0, { 15, 16 } },
+ { /* 37 */ 0, { 16, 17 } },
+ { /* 38 */ 0, { 17, 18 } },
+ { /* 39 */ 0, { 18, 19 } },
+ { /* 40 */ 0, { 19, 20 } },
+ { /* 41 */ 0, { 20, 21 } },
+ { /* 42 */ 0, { 21, 22 } },
+ { /* 43 */ 0, { 22, 23 } },
+ { /* 44 */ 0, { 23, 24 } },
+ { /* 45 */ 0, { 24, 25 } },
+ { /* 46 */ 0, { 25, 26 } },
+ { /* 47 */ 1, { 3, 0 } },
+ { /* 48 */ 1, { 0, 3 } },
+ { /* 49 */ 1, { 2, 3 } },
+ { /* 50 */ 1, { 3, 2 } },
+ { /* 51 */ 1, { 1, 4 } },
+ { /* 52 */ 1, { 4, 1 } },
+ { /* 53 */ 1, { 2, 4 } },
+ { /* 54 */ 1, { 1, 5 } },
+ { /* 55 */ 0, { 18, 19 } },
+ { /* 56 */ 0, { 19, 20 } },
+ { /* 57 */ 0, { 20, 21 } },
+ { /* 58 */ 0, { 21, 22 } },
+ { /* 59 */ 0, { 22, 23 } },
+ { /* 60 */ 0, { 23, 24 } },
+ { /* 61 */ 0, { 24, 25 } },
+ { /* 62 */ 0, { 25, 26 } },
+ { /* 63 */ 0, { 26, 27 } },
+ { /* 64 */ 0, { 27, 28 } },
+ { /* 65 */ 0, { 28, 29 } },
+ { /* 66 */ 0, { 29, 30 } },
+ { /* 67 */ 0, { 30, 31 } },
+ { /* 68 */ 0, { 31, 32 } },
+ { /* 69 */ 0, { 32, 33 } },
+ { /* 70 */ 0, { 33, 34 } },
+ { /* 71 */ 0, { 34, 35 } },
+ { /* 72 */ 0, { 35, 36 } },
+ { /* 73 */ 1, { 4, 2 } },
+ { /* 74 */ 1, { 3, 3 } },
+ { /* 75 */ 1, { 0, 4 } },
+ { /* 76 */ 1, { 4, 0 } },
+ { /* 77 */ 1, { 5, 1 } },
+ { /* 78 */ 1, { 2, 5 } },
+ { /* 79 */ 1, { 1, 6 } },
+ { /* 80 */ 1, { 3, 4 } },
+ { /* 81 */ 1, { 5, 2 } },
+ { /* 82 */ 1, { 6, 1 } },
+ { /* 83 */ 1, { 4, 3 } },
+ { /* 84 */ 0, { 25, 26 } },
+ { /* 85 */ 0, { 26, 27 } },
+ { /* 86 */ 0, { 27, 28 } },
+ { /* 87 */ 0, { 28, 29 } },
+ { /* 88 */ 0, { 29, 30 } },
+ { /* 89 */ 0, { 30, 31 } },
+ { /* 90 */ 0, { 31, 32 } },
+ { /* 91 */ 0, { 32, 33 } },
+ { /* 92 */ 0, { 33, 34 } },
+ { /* 93 */ 0, { 34, 35 } },
+ { /* 94 */ 0, { 35, 36 } },
+ { /* 95 */ 0, { 36, 37 } },
+ { /* 96 */ 0, { 37, 38 } },
+ { /* 97 */ 0, { 38, 39 } },
+ { /* 98 */ 0, { 39, 40 } },
+ { /* 99 */ 0, { 40, 41 } },
+ { /* 00 */ 0, { 41, 42 } },
+ { /* 01 */ 0, { 42, 43 } },
+ { /* 02 */ 0, { 43, 44 } },
+ { /* 03 */ 0, { 44, 45 } },
+ { /* 04 */ 0, { 45, 46 } },
+ { /* 05 */ 0, { 46, 47 } },
+ { /* 06 */ 0, { 47, 48 } },
+ { /* 07 */ 0, { 48, 49 } },
+ { /* 08 */ 0, { 49, 50 } },
+ { /* 09 */ 1, { 0, 5 } },
+ { /* 10 */ 1, { 2, 6 } },
+ { /* 11 */ 1, { 5, 0 } },
+ { /* 12 */ 1, { 1, 7 } },
+ { /* 13 */ 1, { 3, 5 } },
+ { /* 14 */ 1, { 1, 8 } },
+ { /* 15 */ 1, { 8, 1 } },
+ { /* 16 */ 1, { 4, 4 } },
+ { /* 17 */ 1, { 5, 3 } },
+ { /* 18 */ 1, { 6, 2 } },
+ { /* 19 */ 1, { 7, 1 } },
+ { /* 20 */ 1, { 0, 6 } },
+ { /* 21 */ 1, { 8, 2 } },
+ { /* 22 */ 1, { 2, 8 } },
+ { /* 23 */ 1, { 3, 6 } },
+ { /* 24 */ 1, { 2, 7 } },
+ { /* 25 */ 1, { 4, 5 } },
+ { /* 26 */ 1, { 9, 1 } },
+ { /* 27 */ 1, { 1, 9 } },
+ { /* 28 */ 1, { 7, 2 } },
+ { /* 29 */ 0, { 30, 31 } },
+ { /* 30 */ 0, { 31, 32 } },
+ { /* 31 */ 0, { 32, 33 } },
+ { /* 32 */ 0, { 33, 34 } },
+ { /* 33 */ 0, { 34, 35 } },
+ { /* 34 */ 0, { 35, 36 } },
+ { /* 35 */ 0, { 36, 37 } },
+ { /* 36 */ 0, { 37, 38 } },
+ { /* 37 */ 0, { 38, 39 } },
+ { /* 38 */ 0, { 39, 40 } },
+ { /* 39 */ 0, { 40, 41 } },
+ { /* 40 */ 0, { 41, 42 } },
+ { /* 41 */ 0, { 42, 43 } },
+ { /* 42 */ 0, { 43, 44 } },
+ { /* 43 */ 0, { 44, 45 } },
+ { /* 44 */ 0, { 45, 46 } },
+ { /* 45 */ 0, { 46, 47 } },
+ { /* 46 */ 0, { 47, 48 } },
+ { /* 47 */ 0, { 48, 49 } },
+ { /* 48 */ 0, { 49, 50 } },
+ { /* 49 */ 0, { 50, 51 } },
+ { /* 50 */ 0, { 51, 52 } },
+ { /* 51 */ 0, { 52, 53 } },
+ { /* 52 */ 0, { 53, 54 } },
+ { /* 53 */ 0, { 54, 55 } },
+ { /* 54 */ 0, { 55, 56 } },
+ { /* 55 */ 0, { 56, 57 } },
+ { /* 56 */ 0, { 57, 58 } },
+ { /* 57 */ 0, { 58, 59 } },
+ { /* 58 */ 0, { 59, 60 } },
+ { /* 59 */ 1, { 6, 0 } },
+ { /* 60 */ 1, { 5, 4 } },
+ { /* 61 */ 1, { 6, 3 } },
+ { /* 62 */ 1, { 8, 3 } },
+ { /* 63 */ 1, { 0, 7 } },
+ { /* 64 */ 1, { 9, 2 } },
+ { /* 65 */ 1, { 3, 8 } },
+ { /* 66 */ 1, { 4, 6 } },
+ { /* 67 */ 1, { 3, 7 } },
+ { /* 68 */ 1, { 0, 8 } },
+ { /* 69 */ 1, { 10, 1 } },
+ { /* 70 */ 1, { 6, 4 } },
+ { /* 71 */ 1, { 2, 9 } },
+ { /* 72 */ 1, { 5, 5 } },
+ { /* 73 */ 1, { 8, 0 } },
+ { /* 74 */ 1, { 7, 0 } },
+ { /* 75 */ 1, { 7, 3 } },
+ { /* 76 */ 1, { 10, 2 } },
+ { /* 77 */ 1, { 9, 3 } },
+ { /* 78 */ 1, { 8, 4 } },
+ { /* 79 */ 1, { 1, 10 } },
+ { /* 80 */ 1, { 7, 4 } },
+ { /* 81 */ 1, { 6, 5 } },
+ { /* 82 */ 1, { 5, 6 } },
+ { /* 83 */ 1, { 4, 8 } },
+ { /* 84 */ 1, { 4, 7 } },
+ { /* 85 */ 1, { 3, 9 } },
+ { /* 86 */ 1, { 11, 1 } },
+ { /* 87 */ 1, { 5, 8 } },
+ { /* 88 */ 1, { 9, 0 } },
+ { /* 89 */ 1, { 8, 5 } },
+ { /* 90 */ 0, { 29, 30 } },
+ { /* 91 */ 0, { 30, 31 } },
+ { /* 92 */ 0, { 31, 32 } },
+ { /* 93 */ 0, { 32, 33 } },
+ { /* 94 */ 0, { 33, 34 } },
+ { /* 95 */ 0, { 34, 35 } },
+ { /* 96 */ 0, { 35, 36 } },
+ { /* 97 */ 0, { 36, 37 } },
+ { /* 98 */ 0, { 37, 38 } },
+ { /* 99 */ 0, { 38, 39 } },
+ { /* 00 */ 0, { 39, 40 } },
+ { /* 01 */ 0, { 40, 41 } },
+ { /* 02 */ 0, { 41, 42 } },
+ { /* 03 */ 0, { 42, 43 } },
+ { /* 04 */ 0, { 43, 44 } },
+ { /* 05 */ 0, { 44, 45 } },
+ { /* 06 */ 0, { 45, 46 } },
+ { /* 07 */ 0, { 46, 47 } },
+ { /* 08 */ 0, { 47, 48 } },
+ { /* 09 */ 0, { 48, 49 } },
+ { /* 10 */ 0, { 49, 50 } },
+ { /* 11 */ 0, { 50, 51 } },
+ { /* 12 */ 0, { 51, 52 } },
+ { /* 13 */ 0, { 52, 53 } },
+ { /* 14 */ 0, { 53, 54 } },
+ { /* 15 */ 0, { 54, 55 } },
+ { /* 16 */ 0, { 55, 56 } },
+ { /* 17 */ 0, { 56, 57 } },
+ { /* 18 */ 0, { 57, 58 } },
+ { /* 19 */ 1, { 10, 3 } },
+ { /* 20 */ 1, { 2, 10 } },
+ { /* 21 */ 1, { 0, 9 } },
+ { /* 22 */ 1, { 11, 2 } },
+ { /* 23 */ 1, { 9, 4 } },
+ { /* 24 */ 1, { 6, 6 } },
+ { /* 25 */ 1, { 12, 1 } },
+ { /* 26 */ 1, { 4, 9 } },
+ { /* 27 */ 1, { 8, 6 } },
+ { /* 28 */ 1, { 1, 11 } },
+ { /* 29 */ 1, { 9, 5 } },
+ { /* 30 */ 1, { 10, 4 } },
+ { /* 31 */ 1, { 5, 7 } },
+ { /* 32 */ 1, { 7, 5 } },
+ { /* 33 */ 1, { 2, 11 } },
+ { /* 34 */ 1, { 1, 12 } },
+ { /* 35 */ 1, { 12, 2 } },
+ { /* 36 */ 1, { 11, 3 } },
+ { /* 37 */ 1, { 3, 10 } },
+ { /* 38 */ 1, { 5, 9 } },
+ { /* 39 */ 1, { 6, 7 } },
+ { /* 40 */ 1, { 8, 7 } },
+ { /* 41 */ 1, { 11, 4 } },
+ { /* 42 */ 1, { 0, 10 } },
+ { /* 43 */ 1, { 7, 6 } },
+ { /* 44 */ 1, { 12, 3 } },
+ { /* 45 */ 1, { 10, 0 } },
+ { /* 46 */ 1, { 10, 5 } },
+ { /* 47 */ 1, { 4, 10 } },
+ { /* 48 */ 1, { 6, 8 } },
+ { /* 49 */ 1, { 2, 12 } },
+ { /* 50 */ 1, { 9, 6 } },
+ { /* 51 */ 1, { 9, 7 } },
+ { /* 52 */ 1, { 4, 11 } },
+ { /* 53 */ 1, { 11, 0 } },
+ { /* 54 */ 1, { 6, 9 } },
+ { /* 55 */ 1, { 3, 11 } },
+ { /* 56 */ 1, { 5, 10 } },
+ { /* 57 */ 0, { 20, 21 } },
+ { /* 58 */ 0, { 21, 22 } },
+ { /* 59 */ 0, { 22, 23 } },
+ { /* 60 */ 0, { 23, 24 } },
+ { /* 61 */ 0, { 24, 25 } },
+ { /* 62 */ 0, { 25, 26 } },
+ { /* 63 */ 0, { 26, 27 } },
+ { /* 64 */ 0, { 27, 28 } },
+ { /* 65 */ 0, { 28, 29 } },
+ { /* 66 */ 0, { 29, 30 } },
+ { /* 67 */ 0, { 30, 31 } },
+ { /* 68 */ 0, { 31, 32 } },
+ { /* 69 */ 0, { 32, 33 } },
+ { /* 70 */ 0, { 33, 34 } },
+ { /* 71 */ 0, { 34, 35 } },
+ { /* 72 */ 0, { 35, 36 } },
+ { /* 73 */ 0, { 36, 37 } },
+ { /* 74 */ 0, { 37, 38 } },
+ { /* 75 */ 0, { 38, 39 } },
+ { /* 76 */ 0, { 39, 40 } },
+ { /* 77 */ 1, { 8, 8 } },
+ { /* 78 */ 1, { 7, 8 } },
+ { /* 79 */ 1, { 12, 5 } },
+ { /* 80 */ 1, { 3, 12 } },
+ { /* 81 */ 1, { 11, 5 } },
+ { /* 82 */ 1, { 7, 7 } },
+ { /* 83 */ 1, { 12, 4 } },
+ { /* 84 */ 1, { 11, 6 } },
+ { /* 85 */ 1, { 10, 6 } },
+ { /* 86 */ 1, { 4, 12 } },
+ { /* 87 */ 1, { 7, 9 } },
+ { /* 88 */ 1, { 5, 11 } },
+ { /* 89 */ 1, { 0, 11 } },
+ { /* 90 */ 1, { 12, 6 } },
+ { /* 91 */ 1, { 6, 10 } },
+ { /* 92 */ 1, { 12, 0 } },
+ { /* 93 */ 1, { 10, 7 } },
+ { /* 94 */ 1, { 5, 12 } },
+ { /* 95 */ 1, { 7, 10 } },
+ { /* 96 */ 1, { 9, 8 } },
+ { /* 97 */ 1, { 0, 12 } },
+ { /* 98 */ 1, { 11, 7 } },
+ { /* 99 */ 1, { 8, 9 } },
+ { /* 00 */ 1, { 9, 9 } },
+ { /* 01 */ 1, { 10, 8 } },
+ { /* 02 */ 1, { 7, 11 } },
+ { /* 03 */ 1, { 12, 7 } },
+ { /* 04 */ 1, { 6, 11 } },
+ { /* 05 */ 1, { 8, 11 } },
+ { /* 06 */ 1, { 11, 8 } },
+ { /* 07 */ 1, { 7, 12 } },
+ { /* 08 */ 1, { 6, 12 } },
+ { /* 09 */ 0, { 8, 9 } },
+ { /* 10 */ 0, { 9, 10 } },
+ { /* 11 */ 0, { 10, 11 } },
+ { /* 12 */ 0, { 11, 12 } },
+ { /* 13 */ 0, { 12, 13 } },
+ { /* 14 */ 0, { 13, 14 } },
+ { /* 15 */ 0, { 14, 15 } },
+ { /* 16 */ 0, { 15, 16 } },
+ { /* 17 */ 1, { 8, 10 } },
+ { /* 18 */ 1, { 10, 9 } },
+ { /* 19 */ 1, { 8, 12 } },
+ { /* 20 */ 1, { 9, 10 } },
+ { /* 21 */ 1, { 9, 11 } },
+ { /* 22 */ 1, { 9, 12 } },
+ { /* 23 */ 1, { 10, 11 } },
+ { /* 24 */ 1, { 12, 9 } },
+ { /* 25 */ 1, { 10, 10 } },
+ { /* 26 */ 1, { 11, 9 } },
+ { /* 27 */ 1, { 12, 8 } },
+ { /* 28 */ 1, { 11, 10 } },
+ { /* 29 */ 1, { 12, 10 } },
+ { /* 30 */ 1, { 12, 11 } },
+ { /* 31 */ 0, { 2, 3 } },
+ { /* 32 */ 0, { 3, 4 } },
+ { /* 33 */ 1, { 10, 12 } },
+ { /* 34 */ 1, { 11, 11 } },
+ { /* 35 */ 1, { 11, 12 } },
+ { /* 36 */ 1, { 12, 12 } }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_sf.h b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_sf.h
new file mode 100644
index 000000000..4baff607b
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/codebook/hcb_sf.h
@@ -0,0 +1,273 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcb_sf.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* Binary search huffman table HCB_SF */
+
+
+static uint8_t hcb_sf[][2] = {
+ { /* 0 */ 1, 2 },
+ { /* 1 */ 60, 0 },
+ { /* 2 */ 1, 2 },
+ { /* 3 */ 2, 3 },
+ { /* 4 */ 3, 4 },
+ { /* 5 */ 59, 0 },
+ { /* 6 */ 3, 4 },
+ { /* 7 */ 4, 5 },
+ { /* 8 */ 5, 6 },
+ { /* 9 */ 61, 0 },
+ { /* 10 */ 58, 0 },
+ { /* 11 */ 62, 0 },
+ { /* 12 */ 3, 4 },
+ { /* 13 */ 4, 5 },
+ { /* 14 */ 5, 6 },
+ { /* 15 */ 57, 0 },
+ { /* 16 */ 63, 0 },
+ { /* 17 */ 4, 5 },
+ { /* 18 */ 5, 6 },
+ { /* 19 */ 6, 7 },
+ { /* 20 */ 7, 8 },
+ { /* 21 */ 56, 0 },
+ { /* 22 */ 64, 0 },
+ { /* 23 */ 55, 0 },
+ { /* 24 */ 65, 0 },
+ { /* 25 */ 4, 5 },
+ { /* 26 */ 5, 6 },
+ { /* 27 */ 6, 7 },
+ { /* 28 */ 7, 8 },
+ { /* 29 */ 66, 0 },
+ { /* 30 */ 54, 0 },
+ { /* 31 */ 67, 0 },
+ { /* 32 */ 5, 6 },
+ { /* 33 */ 6, 7 },
+ { /* 34 */ 7, 8 },
+ { /* 35 */ 8, 9 },
+ { /* 36 */ 9, 10 },
+ { /* 37 */ 53, 0 },
+ { /* 38 */ 68, 0 },
+ { /* 39 */ 52, 0 },
+ { /* 40 */ 69, 0 },
+ { /* 41 */ 51, 0 },
+ { /* 42 */ 5, 6 },
+ { /* 43 */ 6, 7 },
+ { /* 44 */ 7, 8 },
+ { /* 45 */ 8, 9 },
+ { /* 46 */ 9, 10 },
+ { /* 47 */ 70, 0 },
+ { /* 48 */ 50, 0 },
+ { /* 49 */ 49, 0 },
+ { /* 50 */ 71, 0 },
+ { /* 51 */ 6, 7 },
+ { /* 52 */ 7, 8 },
+ { /* 53 */ 8, 9 },
+ { /* 54 */ 9, 10 },
+ { /* 55 */ 10, 11 },
+ { /* 56 */ 11, 12 },
+ { /* 57 */ 72, 0 },
+ { /* 58 */ 48, 0 },
+ { /* 59 */ 73, 0 },
+ { /* 60 */ 47, 0 },
+ { /* 61 */ 74, 0 },
+ { /* 62 */ 46, 0 },
+ { /* 63 */ 6, 7 },
+ { /* 64 */ 7, 8 },
+ { /* 65 */ 8, 9 },
+ { /* 66 */ 9, 10 },
+ { /* 67 */ 10, 11 },
+ { /* 68 */ 11, 12 },
+ { /* 69 */ 76, 0 },
+ { /* 70 */ 75, 0 },
+ { /* 71 */ 77, 0 },
+ { /* 72 */ 78, 0 },
+ { /* 73 */ 45, 0 },
+ { /* 74 */ 43, 0 },
+ { /* 75 */ 6, 7 },
+ { /* 76 */ 7, 8 },
+ { /* 77 */ 8, 9 },
+ { /* 78 */ 9, 10 },
+ { /* 79 */ 10, 11 },
+ { /* 80 */ 11, 12 },
+ { /* 81 */ 44, 0 },
+ { /* 82 */ 79, 0 },
+ { /* 83 */ 42, 0 },
+ { /* 84 */ 41, 0 },
+ { /* 85 */ 80, 0 },
+ { /* 86 */ 40, 0 },
+ { /* 87 */ 6, 7 },
+ { /* 88 */ 7, 8 },
+ { /* 89 */ 8, 9 },
+ { /* 90 */ 9, 10 },
+ { /* 91 */ 10, 11 },
+ { /* 92 */ 11, 12 },
+ { /* 93 */ 81, 0 },
+ { /* 94 */ 39, 0 },
+ { /* 95 */ 82, 0 },
+ { /* 96 */ 38, 0 },
+ { /* 97 */ 83, 0 },
+ { /* 98 */ 7, 8 },
+ { /* 99 */ 8, 9 },
+ { /* 00 */ 9, 10 },
+ { /* 01 */ 10, 11 },
+ { /* 02 */ 11, 12 },
+ { /* 03 */ 12, 13 },
+ { /* 04 */ 13, 14 },
+ { /* 05 */ 37, 0 },
+ { /* 06 */ 35, 0 },
+ { /* 07 */ 85, 0 },
+ { /* 08 */ 33, 0 },
+ { /* 09 */ 36, 0 },
+ { /* 10 */ 34, 0 },
+ { /* 11 */ 84, 0 },
+ { /* 12 */ 32, 0 },
+ { /* 13 */ 6, 7 },
+ { /* 14 */ 7, 8 },
+ { /* 15 */ 8, 9 },
+ { /* 16 */ 9, 10 },
+ { /* 17 */ 10, 11 },
+ { /* 18 */ 11, 12 },
+ { /* 19 */ 87, 0 },
+ { /* 20 */ 89, 0 },
+ { /* 21 */ 30, 0 },
+ { /* 22 */ 31, 0 },
+ { /* 23 */ 8, 9 },
+ { /* 24 */ 9, 10 },
+ { /* 25 */ 10, 11 },
+ { /* 26 */ 11, 12 },
+ { /* 27 */ 12, 13 },
+ { /* 28 */ 13, 14 },
+ { /* 29 */ 14, 15 },
+ { /* 30 */ 15, 16 },
+ { /* 31 */ 86, 0 },
+ { /* 32 */ 29, 0 },
+ { /* 33 */ 26, 0 },
+ { /* 34 */ 27, 0 },
+ { /* 35 */ 28, 0 },
+ { /* 36 */ 24, 0 },
+ { /* 37 */ 88, 0 },
+ { /* 38 */ 9, 10 },
+ { /* 39 */ 10, 11 },
+ { /* 40 */ 11, 12 },
+ { /* 41 */ 12, 13 },
+ { /* 42 */ 13, 14 },
+ { /* 43 */ 14, 15 },
+ { /* 44 */ 15, 16 },
+ { /* 45 */ 16, 17 },
+ { /* 46 */ 17, 18 },
+ { /* 47 */ 25, 0 },
+ { /* 48 */ 22, 0 },
+ { /* 49 */ 23, 0 },
+ { /* 50 */ 15, 16 },
+ { /* 51 */ 16, 17 },
+ { /* 52 */ 17, 18 },
+ { /* 53 */ 18, 19 },
+ { /* 54 */ 19, 20 },
+ { /* 55 */ 20, 21 },
+ { /* 56 */ 21, 22 },
+ { /* 57 */ 22, 23 },
+ { /* 58 */ 23, 24 },
+ { /* 59 */ 24, 25 },
+ { /* 60 */ 25, 26 },
+ { /* 61 */ 26, 27 },
+ { /* 62 */ 27, 28 },
+ { /* 63 */ 28, 29 },
+ { /* 64 */ 29, 30 },
+ { /* 65 */ 90, 0 },
+ { /* 66 */ 21, 0 },
+ { /* 67 */ 19, 0 },
+ { /* 68 */ 3, 0 },
+ { /* 69 */ 1, 0 },
+ { /* 70 */ 2, 0 },
+ { /* 71 */ 0, 0 },
+ { /* 72 */ 23, 24 },
+ { /* 73 */ 24, 25 },
+ { /* 74 */ 25, 26 },
+ { /* 75 */ 26, 27 },
+ { /* 76 */ 27, 28 },
+ { /* 77 */ 28, 29 },
+ { /* 78 */ 29, 30 },
+ { /* 79 */ 30, 31 },
+ { /* 80 */ 31, 32 },
+ { /* 81 */ 32, 33 },
+ { /* 82 */ 33, 34 },
+ { /* 83 */ 34, 35 },
+ { /* 84 */ 35, 36 },
+ { /* 85 */ 36, 37 },
+ { /* 86 */ 37, 38 },
+ { /* 87 */ 38, 39 },
+ { /* 88 */ 39, 40 },
+ { /* 89 */ 40, 41 },
+ { /* 90 */ 41, 42 },
+ { /* 91 */ 42, 43 },
+ { /* 92 */ 43, 44 },
+ { /* 93 */ 44, 45 },
+ { /* 94 */ 45, 46 },
+ { /* 95 */ 98, 0 },
+ { /* 96 */ 99, 0 },
+ { /* 97 */ 100, 0 },
+ { /* 98 */ 101, 0 },
+ { /* 99 */ 102, 0 },
+ { /* 00 */ 117, 0 },
+ { /* 01 */ 97, 0 },
+ { /* 02 */ 91, 0 },
+ { /* 03 */ 92, 0 },
+ { /* 04 */ 93, 0 },
+ { /* 05 */ 94, 0 },
+ { /* 06 */ 95, 0 },
+ { /* 07 */ 96, 0 },
+ { /* 08 */ 104, 0 },
+ { /* 09 */ 111, 0 },
+ { /* 10 */ 112, 0 },
+ { /* 11 */ 113, 0 },
+ { /* 12 */ 114, 0 },
+ { /* 13 */ 115, 0 },
+ { /* 14 */ 116, 0 },
+ { /* 15 */ 110, 0 },
+ { /* 16 */ 105, 0 },
+ { /* 17 */ 106, 0 },
+ { /* 18 */ 107, 0 },
+ { /* 19 */ 108, 0 },
+ { /* 20 */ 109, 0 },
+ { /* 21 */ 118, 0 },
+ { /* 22 */ 6, 0 },
+ { /* 23 */ 8, 0 },
+ { /* 24 */ 9, 0 },
+ { /* 25 */ 10, 0 },
+ { /* 26 */ 5, 0 },
+ { /* 27 */ 103, 0 },
+ { /* 28 */ 120, 0 },
+ { /* 29 */ 119, 0 },
+ { /* 30 */ 4, 0 },
+ { /* 31 */ 7, 0 },
+ { /* 32 */ 15, 0 },
+ { /* 33 */ 16, 0 },
+ { /* 34 */ 18, 0 },
+ { /* 35 */ 20, 0 },
+ { /* 36 */ 17, 0 },
+ { /* 37 */ 11, 0 },
+ { /* 38 */ 12, 0 },
+ { /* 39 */ 14, 0 },
+ { /* 40 */ 13, 0 }
+};
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/common.c b/src/filters/transform/mpadecfilter/faad2/libfaad/common.c
new file mode 100644
index 000000000..a783f7eb8
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/common.c
@@ -0,0 +1,524 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: common.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* just some common functions that could be used anywhere */
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include "syntax.h"
+
+
+/* Returns the sample rate index based on the samplerate */
+uint8_t get_sr_index(const uint32_t samplerate)
+{
+ if (92017 <= samplerate) return 0;
+ if (75132 <= samplerate) return 1;
+ if (55426 <= samplerate) return 2;
+ if (46009 <= samplerate) return 3;
+ if (37566 <= samplerate) return 4;
+ if (27713 <= samplerate) return 5;
+ if (23004 <= samplerate) return 6;
+ if (18783 <= samplerate) return 7;
+ if (13856 <= samplerate) return 8;
+ if (11502 <= samplerate) return 9;
+ if (9391 <= samplerate) return 10;
+ if (16428320 <= samplerate) return 11;
+
+ return 11;
+}
+
+/* Returns the sample rate based on the sample rate index */
+uint32_t get_sample_rate(const uint8_t sr_index)
+{
+ static const uint32_t sample_rates[] =
+ {
+ 96000, 88200, 64000, 48000, 44100, 32000,
+ 24000, 22050, 16000, 12000, 11025, 8000
+ };
+
+ if (sr_index < 12)
+ return sample_rates[sr_index];
+
+ return 0;
+}
+
+uint8_t max_pred_sfb(const uint8_t sr_index)
+{
+ static const uint8_t pred_sfb_max[] =
+ {
+ 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34
+ };
+
+
+ if (sr_index < 12)
+ return pred_sfb_max[sr_index];
+
+ return 0;
+}
+
+uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
+ const uint8_t is_short)
+{
+ /* entry for each sampling rate
+ * 1 Main/LC long window
+ * 2 Main/LC short window
+ * 3 SSR long window
+ * 4 SSR short window
+ */
+ static const uint8_t tns_sbf_max[][4] =
+ {
+ {31, 9, 28, 7}, /* 96000 */
+ {31, 9, 28, 7}, /* 88200 */
+ {34, 10, 27, 7}, /* 64000 */
+ {40, 14, 26, 6}, /* 48000 */
+ {42, 14, 26, 6}, /* 44100 */
+ {51, 14, 26, 6}, /* 32000 */
+ {46, 14, 29, 7}, /* 24000 */
+ {46, 14, 29, 7}, /* 22050 */
+ {42, 14, 23, 8}, /* 16000 */
+ {42, 14, 23, 8}, /* 12000 */
+ {42, 14, 23, 8}, /* 11025 */
+ {39, 14, 19, 7}, /* 8000 */
+ {39, 14, 19, 7}, /* 7350 */
+ {0,0,0,0},
+ {0,0,0,0},
+ {0,0,0,0}
+ };
+ uint8_t i = 0;
+
+ if (is_short) i++;
+ if (object_type == SSR) i += 2;
+
+ return tns_sbf_max[sr_index][i];
+}
+
+/* Returns 0 if an object type is decodable, otherwise returns -1 */
+int8_t can_decode_ot(const uint8_t object_type)
+{
+ switch (object_type)
+ {
+ case LC:
+ return 0;
+ case MAIN:
+#ifdef MAIN_DEC
+ return 0;
+#else
+ return -1;
+#endif
+ case SSR:
+#ifdef SSR_DEC
+ return 0;
+#else
+ return -1;
+#endif
+ case LTP:
+#ifdef LTP_DEC
+ return 0;
+#else
+ return -1;
+#endif
+
+ /* ER object types */
+#ifdef ERROR_RESILIENCE
+ case ER_LC:
+#ifdef DRM
+ case DRM_ER_LC:
+#endif
+ return 0;
+ case ER_LTP:
+#ifdef LTP_DEC
+ return 0;
+#else
+ return -1;
+#endif
+ case LD:
+#ifdef LD_DEC
+ return 0;
+#else
+ return -1;
+#endif
+#endif
+ }
+
+ return -1;
+}
+
+void *faad_malloc(size_t size)
+{
+#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
+ return _aligned_malloc(size, 16);
+#else // #ifdef 0
+ return malloc(size);
+#endif // #ifdef 0
+}
+
+/* common free function */
+void faad_free(void *b)
+{
+#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
+ _aligned_free(b);
+#else
+ free(b);
+}
+#endif
+
+static const uint8_t Parity [256] = { // parity
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
+ 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
+};
+
+static uint32_t __r1 = 1;
+static uint32_t __r2 = 1;
+
+
+/*
+ * This is a simple random number generator with good quality for audio purposes.
+ * It consists of two polycounters with opposite rotation direction and different
+ * periods. The periods are coprime, so the total period is the product of both.
+ *
+ * -------------------------------------------------------------------------------------------------
+ * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0|
+ * | -------------------------------------------------------------------------------------------------
+ * | | | | | | |
+ * | +--+--+--+-XOR-+--------+
+ * | |
+ * +--------------------------------------------------------------------------------------+
+ *
+ * -------------------------------------------------------------------------------------------------
+ * |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+
+ * ------------------------------------------------------------------------------------------------- |
+ * | | | | |
+ * +--+----XOR----+--+ |
+ * | |
+ * +----------------------------------------------------------------------------------------+
+ *
+ *
+ * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481,
+ * which gives a period of 18.410.713.077.675.721.215. The result is the
+ * XORed values of both generators.
+ */
+uint32_t random_int(void)
+{
+ uint32_t t1, t2, t3, t4;
+
+ t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available
+ t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable
+ t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations.
+ t1 <<= 31; t2 = Parity [t2];
+
+ return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
+}
+
+uint32_t ones32(uint32_t x)
+{
+ x -= ((x >> 1) & 0x55555555);
+ x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
+ x = (((x >> 4) + x) & 0x0f0f0f0f);
+ x += (x >> 8);
+ x += (x >> 16);
+
+ return (x & 0x0000003f);
+}
+
+uint32_t floor_log2(uint32_t x)
+{
+#if 1
+ x |= (x >> 1);
+ x |= (x >> 2);
+ x |= (x >> 4);
+ x |= (x >> 8);
+ x |= (x >> 16);
+
+ return (ones32(x) - 1);
+#else
+ uint32_t count = 0;
+
+ while (x >>= 1)
+ count++;
+
+ return count;
+#endif
+}
+
+/* returns position of first bit that is not 0 from msb,
+ * starting count at lsb */
+uint32_t wl_min_lzc(uint32_t x)
+{
+#if 1
+ x |= (x >> 1);
+ x |= (x >> 2);
+ x |= (x >> 4);
+ x |= (x >> 8);
+ x |= (x >> 16);
+
+ return (ones32(x));
+#else
+ uint32_t count = 0;
+
+ while (x >>= 1)
+ count++;
+
+ return (count + 1);
+#endif
+}
+
+#ifdef FIXED_POINT
+
+#define TABLE_BITS 6
+/* just take the maximum number of bits for interpolation */
+#define INTERP_BITS (REAL_BITS-TABLE_BITS)
+
+static const real_t pow2_tab[] = {
+ REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117),
+ REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557),
+ REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258),
+ REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242),
+ REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578),
+ REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703),
+ REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484),
+ REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778),
+ REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741),
+ REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591),
+ REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095),
+ REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647),
+ REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423),
+ REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837),
+ REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254),
+ REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736),
+ REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478),
+ REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521),
+ REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342),
+ REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966),
+ REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400),
+ REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000)
+};
+
+static const real_t log2_tab[] = {
+ REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453),
+ REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169),
+ REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312),
+ REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881),
+ REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248),
+ REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625),
+ REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760),
+ REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728),
+ REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675),
+ REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031),
+ REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156),
+ REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610),
+ REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496),
+ REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123),
+ REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469),
+ REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106),
+ REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742),
+ REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405),
+ REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519),
+ REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240),
+ REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917),
+ REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000)
+};
+
+real_t pow2_fix(real_t val)
+{
+ uint32_t x1, x2;
+ uint32_t errcorr;
+ uint32_t index_frac;
+ real_t retval;
+ int32_t whole = (val >> REAL_BITS);
+
+ /* rest = [0..1] */
+ int32_t rest = val - (whole << REAL_BITS);
+
+ /* index into pow2_tab */
+ int32_t index = rest >> (REAL_BITS-TABLE_BITS);
+
+
+ if (val == 0)
+ return (1<<REAL_BITS);
+
+ /* leave INTERP_BITS bits */
+ index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+ index_frac = index_frac & ((1<<INTERP_BITS)-1);
+
+ if (whole > 0)
+ {
+ retval = 1 << whole;
+ } else {
+ retval = REAL_CONST(1) >> -whole;
+ }
+
+ x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
+ x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+ errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
+
+ if (whole > 0)
+ {
+ retval = retval * (errcorr + x1);
+ } else {
+ retval = MUL_R(retval, (errcorr + x1));
+ }
+
+ return retval;
+}
+
+int32_t pow2_int(real_t val)
+{
+ uint32_t x1, x2;
+ uint32_t errcorr;
+ uint32_t index_frac;
+ real_t retval;
+ int32_t whole = (val >> REAL_BITS);
+
+ /* rest = [0..1] */
+ int32_t rest = val - (whole << REAL_BITS);
+
+ /* index into pow2_tab */
+ int32_t index = rest >> (REAL_BITS-TABLE_BITS);
+
+
+ if (val == 0)
+ return 1;
+
+ /* leave INTERP_BITS bits */
+ index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+ index_frac = index_frac & ((1<<INTERP_BITS)-1);
+
+ if (whole > 0)
+ retval = 1 << whole;
+ else
+ retval = 0;
+
+ x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
+ x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+ errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
+
+ retval = MUL_R(retval, (errcorr + x1));
+
+ return retval;
+}
+
+/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
+int32_t log2_int(uint32_t val)
+{
+ uint32_t frac;
+ uint32_t whole = (val);
+ int32_t exp = 0;
+ uint32_t index;
+ uint32_t index_frac;
+ uint32_t x1, x2;
+ uint32_t errcorr;
+
+ /* error */
+ if (val == 0)
+ return -10000;
+
+ exp = floor_log2(val);
+ exp -= REAL_BITS;
+
+ /* frac = [1..2] */
+ if (exp >= 0)
+ frac = val >> exp;
+ else
+ frac = val << -exp;
+
+ /* index in the log2 table */
+ index = frac >> (REAL_BITS-TABLE_BITS);
+
+ /* leftover part for linear interpolation */
+ index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
+
+ /* leave INTERP_BITS bits */
+ index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+
+ x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
+ x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+
+ /* linear interpolation */
+ /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+
+ errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
+
+ return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1;
+}
+
+/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
+real_t log2_fix(uint32_t val)
+{
+ uint32_t frac;
+ uint32_t whole = (val >> REAL_BITS);
+ int8_t exp = 0;
+ uint32_t index;
+ uint32_t index_frac;
+ uint32_t x1, x2;
+ uint32_t errcorr;
+
+ /* error */
+ if (val == 0)
+ return -100000;
+
+ exp = floor_log2(val);
+ exp -= REAL_BITS;
+
+ /* frac = [1..2] */
+ if (exp >= 0)
+ frac = val >> exp;
+ else
+ frac = val << -exp;
+
+ /* index in the log2 table */
+ index = frac >> (REAL_BITS-TABLE_BITS);
+
+ /* leftover part for linear interpolation */
+ index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
+
+ /* leave INTERP_BITS bits */
+ index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
+
+ x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
+ x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
+
+ /* linear interpolation */
+ /* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
+
+ errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
+
+ return (exp << REAL_BITS) + errcorr + x1;
+}
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/common.h b/src/filters/transform/mpadecfilter/faad2/libfaad/common.h
new file mode 100644
index 000000000..9613e4c83
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/common.h
@@ -0,0 +1,445 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: common.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef HAVE_CONFIG_H
+# include "../config.h"
+#endif
+
+#if 1
+#define INLINE __inline
+#else
+#define INLINE inline
+#endif
+
+#if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
+#define ALIGN __declspec(align(16))
+#else
+#define ALIGN
+#endif
+
+#ifndef max
+#define max(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+#ifndef min
+#define min(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
+/* COMPILE TIME DEFINITIONS */
+
+/* use double precision */
+/* #define USE_DOUBLE_PRECISION */
+/* use fixed point reals */
+//#define FIXED_POINT
+//#define BIG_IQ_TABLE
+
+/* Use if target platform has address generators with autoincrement */
+//#define PREFER_POINTERS
+
+#ifdef _WIN32_WCE
+#define FIXED_POINT
+#endif
+
+#define ERROR_RESILIENCE
+
+
+/* Allow decoding of MAIN profile AAC */
+#define MAIN_DEC
+/* Allow decoding of SSR profile AAC */
+//#define SSR_DEC
+/* Allow decoding of LTP profile AAC */
+#define LTP_DEC
+/* Allow decoding of LD profile AAC */
+#define LD_DEC
+/* Allow decoding of Digital Radio Mondiale (DRM) */
+//#define DRM
+//#define DRM_PS
+
+/* LD can't do without LTP */
+#ifdef LD_DEC
+#ifndef ERROR_RESILIENCE
+#define ERROR_RESILIENCE
+#endif
+#ifndef LTP_DEC
+#define LTP_DEC
+#endif
+#endif
+
+#define ALLOW_SMALL_FRAMELENGTH
+
+
+// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC)
+//#define LC_ONLY_DECODER
+#ifdef LC_ONLY_DECODER
+ #undef LD_DEC
+ #undef LTP_DEC
+ #undef MAIN_DEC
+ #undef SSR_DEC
+ #undef DRM
+ #undef ALLOW_SMALL_FRAMELENGTH
+ #undef ERROR_RESILIENCE
+#endif
+
+#define SBR_DEC
+//#define SBR_LOW_POWER
+#define PS_DEC
+
+#ifdef SBR_LOW_POWER
+#undef PS_DEC
+#endif
+
+/* FIXED POINT: No MAIN decoding */
+#ifdef FIXED_POINT
+# ifdef MAIN_DEC
+# undef MAIN_DEC
+# endif
+#endif // FIXED_POINT
+
+#ifdef DRM
+# ifndef ALLOW_SMALL_FRAMELENGTH
+# define ALLOW_SMALL_FRAMELENGTH
+# endif
+# undef LD_DEC
+# undef LTP_DEC
+# undef MAIN_DEC
+# undef SSR_DEC
+#endif
+
+
+#ifdef FIXED_POINT
+#define DIV_R(A, B) (((int64_t)A << REAL_BITS)/B)
+#define DIV_C(A, B) (((int64_t)A << COEF_BITS)/B)
+#else
+#define DIV_R(A, B) ((A)/(B))
+#define DIV_C(A, B) ((A)/(B))
+#endif
+
+#ifndef SBR_LOW_POWER
+#define qmf_t complex_t
+#define QMF_RE(A) RE(A)
+#define QMF_IM(A) IM(A)
+#else
+#define qmf_t real_t
+#define QMF_RE(A) (A)
+#define QMF_IM(A)
+#endif
+
+
+/* END COMPILE TIME DEFINITIONS */
+
+#if defined(_WIN32) && !defined(__MINGW32__)
+
+#include <stdlib.h>
+
+typedef unsigned __int64 uint64_t;
+typedef unsigned __int32 uint32_t;
+typedef unsigned __int16 uint16_t;
+typedef unsigned __int8 uint8_t;
+typedef __int64 int64_t;
+typedef __int32 int32_t;
+typedef __int16 int16_t;
+typedef __int8 int8_t;
+typedef float float32_t;
+
+
+#else
+
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# else
+/* we need these... */
+#ifndef __TCS__
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
+#else
+typedef unsigned long uint64_t;
+typedef long int64_t;
+#endif
+typedef unsigned long uint32_t;
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+typedef long int32_t;
+typedef short int16_t;
+typedef char int8_t;
+# endif
+#endif
+#if HAVE_UNISTD_H
+//# include <unistd.h>
+#endif
+
+#ifndef HAVE_FLOAT32_T
+typedef float float32_t;
+#endif
+
+#if STDC_HEADERS
+# include <string.h>
+#else
+# if !HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
+# endif
+char *strchr(), *strrchr();
+# if !HAVE_MEMCPY
+# define memcpy(d, s, n) bcopy((s), (d), (n))
+# define memmove(d, s, n) bcopy((s), (d), (n))
+# endif
+#endif
+
+#endif
+
+#ifdef WORDS_BIGENDIAN
+#define ARCH_IS_BIG_ENDIAN
+#endif
+
+/* FIXED_POINT doesn't work with MAIN and SSR yet */
+#ifdef FIXED_POINT
+ #undef MAIN_DEC
+ #undef SSR_DEC
+#endif
+
+
+#if defined(FIXED_POINT)
+
+ #include "fixed.h"
+
+#elif defined(USE_DOUBLE_PRECISION)
+
+ typedef double real_t;
+
+ #include <math.h>
+
+ #define MUL_R(A,B) ((A)*(B))
+ #define MUL_C(A,B) ((A)*(B))
+ #define MUL_F(A,B) ((A)*(B))
+
+ /* Complex multiplication */
+ static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+ {
+ *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+ *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+ }
+
+ #define REAL_CONST(A) ((real_t)(A))
+ #define COEF_CONST(A) ((real_t)(A))
+ #define Q2_CONST(A) ((real_t)(A))
+ #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
+
+#else /* Normal floating point operation */
+
+ typedef float real_t;
+
+ #define MUL_R(A,B) ((A)*(B))
+ #define MUL_C(A,B) ((A)*(B))
+ #define MUL_F(A,B) ((A)*(B))
+
+ #define REAL_CONST(A) ((real_t)(A))
+ #define COEF_CONST(A) ((real_t)(A))
+ #define Q2_CONST(A) ((real_t)(A))
+ #define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
+
+ /* Complex multiplication */
+ static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+ {
+ *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+ *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+ }
+
+
+ #if defined(_WIN32) && !defined(__MINGW32__)
+ #define HAS_LRINTF
+ static INLINE int lrintf(float f)
+ {
+ int i;
+ __asm
+ {
+ fld f
+ fistp i
+ }
+ return i;
+ }
+ #elif (defined(__i386__) && defined(__GNUC__))
+ #define HAS_LRINTF
+ // from http://www.stereopsis.com/FPU.html
+ static INLINE int lrintf(float f)
+ {
+ int i;
+ __asm__ __volatile__ (
+ "flds %1 \n\t"
+ "fistpl %0 \n\t"
+ : "=m" (i)
+ : "m" (f));
+ return i;
+ }
+ #endif
+
+
+ #ifdef __ICL /* only Intel C compiler has fmath ??? */
+
+ #include <mathf.h>
+
+ #define sin sinf
+ #define cos cosf
+ #define log logf
+ #define floor floorf
+ #define ceil ceilf
+ #define sqrt sqrtf
+
+ #else
+
+#ifdef HAVE_LRINTF
+# define HAS_LRINTF
+# define _ISOC9X_SOURCE 1
+# define _ISOC99_SOURCE 1
+# define __USE_ISOC9X 1
+# define __USE_ISOC99 1
+#endif
+
+ #include <math.h>
+
+#ifdef HAVE_SINF
+# define sin sinf
+#error
+#endif
+#ifdef HAVE_COSF
+# define cos cosf
+#endif
+#ifdef HAVE_LOGF
+# define log logf
+#endif
+#ifdef HAVE_EXPF
+# define exp expf
+#endif
+#ifdef HAVE_FLOORF
+# define floor floorf
+#endif
+#ifdef HAVE_CEILF
+# define ceil ceilf
+#endif
+#ifdef HAVE_SQRTF
+# define sqrt sqrtf
+#endif
+
+ #endif
+
+#endif
+
+#ifndef HAS_LRINTF
+/* standard cast */
+#define lrintf(f) ((int32_t)(f))
+#endif
+
+typedef real_t complex_t[2];
+#define RE(A) A[0]
+#define IM(A) A[1]
+
+
+/* common functions */
+uint8_t cpu_has_sse(void);
+uint32_t random_int(void);
+uint32_t ones32(uint32_t x);
+uint32_t floor_log2(uint32_t x);
+uint32_t wl_min_lzc(uint32_t x);
+#ifdef FIXED_POINT
+#define LOG2_MIN_INF REAL_CONST(-10000)
+int32_t log2_int(uint32_t val);
+int32_t log2_fix(uint32_t val);
+int32_t pow2_int(real_t val);
+real_t pow2_fix(real_t val);
+#endif
+uint8_t get_sr_index(const uint32_t samplerate);
+uint8_t max_pred_sfb(const uint8_t sr_index);
+uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
+ const uint8_t is_short);
+uint32_t get_sample_rate(const uint8_t sr_index);
+int8_t can_decode_ot(const uint8_t object_type);
+
+void *faad_malloc(size_t size);
+void faad_free(void *b);
+
+//#define PROFILE
+#ifdef PROFILE
+static int64_t faad_get_ts()
+{
+ __asm
+ {
+ rdtsc
+ }
+}
+#endif
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+#ifndef M_PI_2 /* PI/2 */
+#define M_PI_2 1.57079632679489661923
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/decoder.c b/src/filters/transform/mpadecfilter/faad2/libfaad/decoder.c
new file mode 100644
index 000000000..9db1db742
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/decoder.c
@@ -0,0 +1,1140 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: decoder.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "decoder.h"
+#include "mp4.h"
+#include "syntax.h"
+#include "error.h"
+#include "output.h"
+#include "filtbank.h"
+#include "drc.h"
+#ifdef SBR_DEC
+#include "sbr_dec.h"
+#include "sbr_syntax.h"
+#endif
+#ifdef SSR_DEC
+#include "ssr.h"
+#endif
+
+#ifdef ANALYSIS
+uint16_t dbg_count;
+#endif
+
+/* static function declarations */
+static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+ uint8_t *buffer, uint32_t buffer_size,
+ void **sample_buffer, uint32_t sample_buffer_size);
+static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo);
+
+
+char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode)
+{
+ if (errcode >= NUM_ERROR_MESSAGES)
+ return NULL;
+ return err_msg[errcode];
+}
+
+uint32_t NEAACDECAPI NeAACDecGetCapabilities(void)
+{
+ uint32_t cap = 0;
+
+ /* can't do without it */
+ cap += LC_DEC_CAP;
+
+#ifdef MAIN_DEC
+ cap += MAIN_DEC_CAP;
+#endif
+#ifdef LTP_DEC
+ cap += LTP_DEC_CAP;
+#endif
+#ifdef LD_DEC
+ cap += LD_DEC_CAP;
+#endif
+#ifdef ERROR_RESILIENCE
+ cap += ERROR_RESILIENCE_CAP;
+#endif
+#ifdef FIXED_POINT
+ cap += FIXED_POINT_CAP;
+#endif
+
+ return cap;
+}
+
+NeAACDecHandle NEAACDECAPI NeAACDecOpen(void)
+{
+ uint8_t i;
+ NeAACDecHandle hDecoder = NULL;
+
+ if ((hDecoder = (NeAACDecHandle)faad_malloc(sizeof(NeAACDecStruct))) == NULL)
+ return NULL;
+
+ memset(hDecoder, 0, sizeof(NeAACDecStruct));
+
+ hDecoder->config.outputFormat = FAAD_FMT_16BIT;
+ hDecoder->config.defObjectType = MAIN;
+ hDecoder->config.defSampleRate = 44100; /* Default: 44.1kHz */
+ hDecoder->config.downMatrix = 0;
+ hDecoder->adts_header_present = 0;
+ hDecoder->adif_header_present = 0;
+#ifdef ERROR_RESILIENCE
+ hDecoder->aacSectionDataResilienceFlag = 0;
+ hDecoder->aacScalefactorDataResilienceFlag = 0;
+ hDecoder->aacSpectralDataResilienceFlag = 0;
+#endif
+ hDecoder->frameLength = 1024;
+
+ hDecoder->frame = 0;
+ hDecoder->sample_buffer = NULL;
+
+ for (i = 0; i < MAX_CHANNELS; i++)
+ {
+ hDecoder->window_shape_prev[i] = 0;
+ hDecoder->time_out[i] = NULL;
+ hDecoder->fb_intermed[i] = NULL;
+#ifdef SSR_DEC
+ hDecoder->ssr_overlap[i] = NULL;
+ hDecoder->prev_fmd[i] = NULL;
+#endif
+#ifdef MAIN_DEC
+ hDecoder->pred_stat[i] = NULL;
+#endif
+#ifdef LTP_DEC
+ hDecoder->ltp_lag[i] = 0;
+ hDecoder->lt_pred_stat[i] = NULL;
+#endif
+ }
+
+#ifdef SBR_DEC
+ for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
+ {
+ hDecoder->sbr[i] = NULL;
+ }
+#endif
+
+ hDecoder->drc = drc_init(REAL_CONST(1.0), REAL_CONST(1.0));
+
+ return hDecoder;
+}
+
+NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder)
+{
+ if (hDecoder)
+ {
+ NeAACDecConfigurationPtr config = &(hDecoder->config);
+
+ return config;
+ }
+
+ return NULL;
+}
+
+uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+ NeAACDecConfigurationPtr config)
+{
+ if (hDecoder && config)
+ {
+ /* check if we can decode this object type */
+ if (can_decode_ot(config->defObjectType) < 0)
+ return 0;
+ hDecoder->config.defObjectType = config->defObjectType;
+
+ /* samplerate: anything but 0 should be possible */
+ if (config->defSampleRate == 0)
+ return 0;
+ hDecoder->config.defSampleRate = config->defSampleRate;
+
+ /* check output format */
+#ifdef FIXED_POINT
+ if ((config->outputFormat < 1) || (config->outputFormat > 4))
+ return 0;
+#else
+ if ((config->outputFormat < 1) || (config->outputFormat > 5))
+ return 0;
+#endif
+ hDecoder->config.outputFormat = config->outputFormat;
+
+ if (config->downMatrix > 1)
+ return 0;
+ hDecoder->config.downMatrix = config->downMatrix;
+
+ /* OK */
+ return 1;
+ }
+
+ return 0;
+}
+
+int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder, uint8_t *buffer,
+ uint32_t buffer_size,
+ uint32_t *samplerate, uint8_t *channels)
+{
+ uint32_t bits = 0;
+ bitfile ld;
+ adif_header adif;
+ adts_header adts;
+
+ if ((hDecoder == NULL) || (samplerate == NULL) || (channels == NULL))
+ return -1;
+
+ hDecoder->sf_index = get_sr_index(hDecoder->config.defSampleRate);
+ hDecoder->object_type = hDecoder->config.defObjectType;
+ *samplerate = get_sample_rate(hDecoder->sf_index);
+ *channels = 1;
+
+ if (buffer != NULL)
+ {
+ faad_initbits(&ld, buffer, buffer_size);
+
+ /* Check if an ADIF header is present */
+ if ((buffer[0] == 'A') && (buffer[1] == 'D') &&
+ (buffer[2] == 'I') && (buffer[3] == 'F'))
+ {
+ hDecoder->adif_header_present = 1;
+
+ get_adif_header(&adif, &ld);
+ faad_byte_align(&ld);
+
+ hDecoder->sf_index = adif.pce[0].sf_index;
+ hDecoder->object_type = adif.pce[0].object_type + 1;
+
+ *samplerate = get_sample_rate(hDecoder->sf_index);
+ *channels = adif.pce[0].channels;
+
+ memcpy(&(hDecoder->pce), &(adif.pce[0]), sizeof(program_config));
+ hDecoder->pce_set = 1;
+
+ bits = bit2byte(faad_get_processed_bits(&ld));
+
+ /* Check if an ADTS header is present */
+ } else if (faad_showbits(&ld, 12) == 0xfff) {
+ hDecoder->adts_header_present = 1;
+
+ adts.old_format = hDecoder->config.useOldADTSFormat;
+ adts_frame(&adts, &ld);
+
+ hDecoder->sf_index = adts.sf_index;
+ hDecoder->object_type = adts.profile + 1;
+
+ *samplerate = get_sample_rate(hDecoder->sf_index);
+ *channels = (adts.channel_configuration > 6) ?
+ 2 : adts.channel_configuration;
+ }
+
+ if (ld.error)
+ {
+ faad_endbits(&ld);
+ return -1;
+ }
+ faad_endbits(&ld);
+ }
+ hDecoder->channelConfiguration = *channels;
+
+#if (defined(PS_DEC) || defined(DRM_PS))
+ /* check if we have a mono file */
+ if (*channels == 1)
+ {
+ /* upMatrix to 2 channels for implicit signalling of PS */
+ *channels = 2;
+ }
+#endif
+
+#ifdef SBR_DEC
+ /* implicit signalling */
+ if (*samplerate <= 24000 && !(hDecoder->config.dontUpSampleImplicitSBR))
+ {
+ *samplerate *= 2;
+ hDecoder->forceUpSampling = 1;
+ } else if (*samplerate > 24000 && !(hDecoder->config.dontUpSampleImplicitSBR)) {
+ hDecoder->downSampledSBR = 1;
+ }
+#endif
+
+ /* must be done before frameLength is divided by 2 for LD */
+#ifdef SSR_DEC
+ if (hDecoder->object_type == SSR)
+ hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS);
+ else
+#endif
+ hDecoder->fb = filter_bank_init(hDecoder->frameLength);
+
+#ifdef LD_DEC
+ if (hDecoder->object_type == LD)
+ hDecoder->frameLength >>= 1;
+#endif
+
+ if (can_decode_ot(hDecoder->object_type) < 0)
+ return -1;
+
+ return bits;
+}
+
+/* Init the library using a DecoderSpecificInfo */
+int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
+ uint32_t SizeOfDecoderSpecificInfo,
+ uint32_t *samplerate, uint8_t *channels)
+{
+ int8_t rc;
+ mp4AudioSpecificConfig mp4ASC;
+
+ if((hDecoder == NULL)
+ || (pBuffer == NULL)
+ || (SizeOfDecoderSpecificInfo < 2)
+ || (samplerate == NULL)
+ || (channels == NULL))
+ {
+ return -1;
+ }
+
+ hDecoder->adif_header_present = 0;
+ hDecoder->adts_header_present = 0;
+
+ /* decode the audio specific config */
+ rc = AudioSpecificConfig2(pBuffer, SizeOfDecoderSpecificInfo, &mp4ASC,
+ &(hDecoder->pce));
+
+ /* copy the relevant info to the decoder handle */
+ *samplerate = mp4ASC.samplingFrequency;
+ if (mp4ASC.channelsConfiguration)
+ {
+ *channels = mp4ASC.channelsConfiguration;
+ } else {
+ *channels = hDecoder->pce.channels;
+ hDecoder->pce_set = 1;
+ }
+#if (defined(PS_DEC) || defined(DRM_PS))
+ /* check if we have a mono file */
+ if (*channels == 1)
+ {
+ /* upMatrix to 2 channels for implicit signalling of PS */
+ *channels = 2;
+ }
+#endif
+ hDecoder->sf_index = mp4ASC.samplingFrequencyIndex;
+ hDecoder->object_type = mp4ASC.objectTypeIndex;
+#ifdef ERROR_RESILIENCE
+ hDecoder->aacSectionDataResilienceFlag = mp4ASC.aacSectionDataResilienceFlag;
+ hDecoder->aacScalefactorDataResilienceFlag = mp4ASC.aacScalefactorDataResilienceFlag;
+ hDecoder->aacSpectralDataResilienceFlag = mp4ASC.aacSpectralDataResilienceFlag;
+#endif
+#ifdef SBR_DEC
+ hDecoder->sbr_present_flag = mp4ASC.sbr_present_flag;
+ hDecoder->downSampledSBR = mp4ASC.downSampledSBR;
+ if (hDecoder->config.dontUpSampleImplicitSBR == 0)
+ hDecoder->forceUpSampling = mp4ASC.forceUpSampling;
+ else
+ hDecoder->forceUpSampling = 0;
+
+ /* AAC core decoder samplerate is 2 times as low */
+ if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || hDecoder->forceUpSampling == 1)
+ {
+ hDecoder->sf_index = get_sr_index(mp4ASC.samplingFrequency / 2);
+ }
+#endif
+
+ if (rc != 0)
+ {
+ return rc;
+ }
+ hDecoder->channelConfiguration = mp4ASC.channelsConfiguration;
+ if (mp4ASC.frameLengthFlag)
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ hDecoder->frameLength = 960;
+#else
+ return -1;
+#endif
+
+ /* must be done before frameLength is divided by 2 for LD */
+#ifdef SSR_DEC
+ if (hDecoder->object_type == SSR)
+ hDecoder->fb = ssr_filter_bank_init(hDecoder->frameLength/SSR_BANDS);
+ else
+#endif
+ hDecoder->fb = filter_bank_init(hDecoder->frameLength);
+
+#ifdef LD_DEC
+ if (hDecoder->object_type == LD)
+ hDecoder->frameLength >>= 1;
+#endif
+
+ return 0;
+}
+
+#ifdef DRM
+int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
+ uint8_t channels)
+{
+ if (hDecoder == NULL)
+ return 1; /* error */
+
+ NeAACDecClose(*hDecoder);
+
+ *hDecoder = NeAACDecOpen();
+
+ /* Special object type defined for DRM */
+ (*hDecoder)->config.defObjectType = DRM_ER_LC;
+
+ (*hDecoder)->config.defSampleRate = samplerate;
+#ifdef ERROR_RESILIENCE // This shoudl always be defined for DRM
+ (*hDecoder)->aacSectionDataResilienceFlag = 1; /* VCB11 */
+ (*hDecoder)->aacScalefactorDataResilienceFlag = 0; /* no RVLC */
+ (*hDecoder)->aacSpectralDataResilienceFlag = 1; /* HCR */
+#endif
+ (*hDecoder)->frameLength = 960;
+ (*hDecoder)->sf_index = get_sr_index((*hDecoder)->config.defSampleRate);
+ (*hDecoder)->object_type = (*hDecoder)->config.defObjectType;
+
+ if ((channels == DRMCH_STEREO) || (channels == DRMCH_SBR_STEREO))
+ (*hDecoder)->channelConfiguration = 2;
+ else
+ (*hDecoder)->channelConfiguration = 1;
+
+#ifdef SBR_DEC
+ if ((channels == DRMCH_MONO) || (channels == DRMCH_STEREO))
+ (*hDecoder)->sbr_present_flag = 0;
+ else
+ (*hDecoder)->sbr_present_flag = 1;
+#endif
+
+ (*hDecoder)->fb = filter_bank_init((*hDecoder)->frameLength);
+
+ return 0;
+}
+#endif
+
+void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder)
+{
+ uint8_t i;
+
+ if (hDecoder == NULL)
+ return;
+
+#ifdef PROFILE
+ printf("AAC decoder total: %I64d cycles\n", hDecoder->cycles);
+ printf("requant: %I64d cycles\n", hDecoder->requant_cycles);
+ printf("spectral_data: %I64d cycles\n", hDecoder->spectral_cycles);
+ printf("scalefactors: %I64d cycles\n", hDecoder->scalefac_cycles);
+ printf("output: %I64d cycles\n", hDecoder->output_cycles);
+#endif
+
+ for (i = 0; i < MAX_CHANNELS; i++)
+ {
+ if (hDecoder->time_out[i]) faad_free(hDecoder->time_out[i]);
+ if (hDecoder->fb_intermed[i]) faad_free(hDecoder->fb_intermed[i]);
+#ifdef SSR_DEC
+ if (hDecoder->ssr_overlap[i]) faad_free(hDecoder->ssr_overlap[i]);
+ if (hDecoder->prev_fmd[i]) faad_free(hDecoder->prev_fmd[i]);
+#endif
+#ifdef MAIN_DEC
+ if (hDecoder->pred_stat[i]) faad_free(hDecoder->pred_stat[i]);
+#endif
+#ifdef LTP_DEC
+ if (hDecoder->lt_pred_stat[i]) faad_free(hDecoder->lt_pred_stat[i]);
+#endif
+ }
+
+#ifdef SSR_DEC
+ if (hDecoder->object_type == SSR)
+ ssr_filter_bank_end(hDecoder->fb);
+ else
+#endif
+ filter_bank_end(hDecoder->fb);
+
+ drc_end(hDecoder->drc);
+
+ if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer);
+
+#ifdef SBR_DEC
+ for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
+ {
+ if (hDecoder->sbr[i])
+ sbrDecodeEnd(hDecoder->sbr[i]);
+ }
+#endif
+
+ if (hDecoder) faad_free(hDecoder);
+}
+
+void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame)
+{
+ if (hDecoder)
+ {
+ hDecoder->postSeekResetFlag = 1;
+
+ if (frame != -1)
+ hDecoder->frame = frame;
+ }
+}
+
+static void create_channel_config(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo)
+{
+ hInfo->num_front_channels = 0;
+ hInfo->num_side_channels = 0;
+ hInfo->num_back_channels = 0;
+ hInfo->num_lfe_channels = 0;
+ memset(hInfo->channel_position, 0, MAX_CHANNELS*sizeof(uint8_t));
+
+ if (hDecoder->downMatrix)
+ {
+ hInfo->num_front_channels = 2;
+ hInfo->channel_position[0] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT;
+ return;
+ }
+
+ /* check if there is a PCE */
+ if (hDecoder->pce_set)
+ {
+ uint8_t i, chpos = 0;
+ uint8_t chdir, back_center = 0;
+
+ hInfo->num_front_channels = hDecoder->pce.num_front_channels;
+ hInfo->num_side_channels = hDecoder->pce.num_side_channels;
+ hInfo->num_back_channels = hDecoder->pce.num_back_channels;
+ hInfo->num_lfe_channels = hDecoder->pce.num_lfe_channels;
+
+ chdir = hInfo->num_front_channels;
+ if (chdir & 1)
+ {
+ hInfo->channel_position[chpos++] = FRONT_CHANNEL_CENTER;
+ chdir--;
+ }
+ for (i = 0; i < chdir; i += 2)
+ {
+ hInfo->channel_position[chpos++] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[chpos++] = FRONT_CHANNEL_RIGHT;
+ }
+
+ for (i = 0; i < hInfo->num_side_channels; i += 2)
+ {
+ hInfo->channel_position[chpos++] = SIDE_CHANNEL_LEFT;
+ hInfo->channel_position[chpos++] = SIDE_CHANNEL_RIGHT;
+ }
+
+ chdir = hInfo->num_back_channels;
+ if (chdir & 1)
+ {
+ back_center = 1;
+ chdir--;
+ }
+ for (i = 0; i < chdir; i += 2)
+ {
+ hInfo->channel_position[chpos++] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[chpos++] = BACK_CHANNEL_RIGHT;
+ }
+ if (back_center)
+ {
+ hInfo->channel_position[chpos++] = BACK_CHANNEL_CENTER;
+ }
+
+ for (i = 0; i < hInfo->num_lfe_channels; i++)
+ {
+ hInfo->channel_position[chpos++] = LFE_CHANNEL;
+ }
+
+ } else {
+ switch (hDecoder->channelConfiguration)
+ {
+ case 1:
+ hInfo->num_front_channels = 1;
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ break;
+ case 2:
+ hInfo->num_front_channels = 2;
+ hInfo->channel_position[0] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[1] = FRONT_CHANNEL_RIGHT;
+ break;
+ case 3:
+ hInfo->num_front_channels = 3;
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+ break;
+ case 4:
+ hInfo->num_front_channels = 3;
+ hInfo->num_back_channels = 1;
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+ hInfo->channel_position[3] = BACK_CHANNEL_CENTER;
+ break;
+ case 5:
+ hInfo->num_front_channels = 3;
+ hInfo->num_back_channels = 2;
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+ hInfo->channel_position[3] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[4] = BACK_CHANNEL_RIGHT;
+ break;
+ case 6:
+ hInfo->num_front_channels = 3;
+ hInfo->num_back_channels = 2;
+ hInfo->num_lfe_channels = 1;
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+ hInfo->channel_position[3] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[4] = BACK_CHANNEL_RIGHT;
+ hInfo->channel_position[5] = LFE_CHANNEL;
+ break;
+ case 7:
+ hInfo->num_front_channels = 3;
+ hInfo->num_side_channels = 2;
+ hInfo->num_back_channels = 2;
+ hInfo->num_lfe_channels = 1;
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ hInfo->channel_position[1] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[2] = FRONT_CHANNEL_RIGHT;
+ hInfo->channel_position[3] = SIDE_CHANNEL_LEFT;
+ hInfo->channel_position[4] = SIDE_CHANNEL_RIGHT;
+ hInfo->channel_position[5] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[6] = BACK_CHANNEL_RIGHT;
+ hInfo->channel_position[7] = LFE_CHANNEL;
+ break;
+ default: /* channelConfiguration == 0 || channelConfiguration > 7 */
+ {
+ uint8_t i;
+ uint8_t ch = hDecoder->fr_channels - hDecoder->has_lfe;
+ if (ch & 1) /* there's either a center front or a center back channel */
+ {
+ uint8_t ch1 = (ch-1)/2;
+ if (hDecoder->first_syn_ele == ID_SCE)
+ {
+ hInfo->num_front_channels = ch1 + 1;
+ hInfo->num_back_channels = ch1;
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ for (i = 1; i <= ch1; i+=2)
+ {
+ hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+ }
+ for (i = ch1+1; i < ch; i+=2)
+ {
+ hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+ }
+ } else {
+ hInfo->num_front_channels = ch1;
+ hInfo->num_back_channels = ch1 + 1;
+ for (i = 0; i < ch1; i+=2)
+ {
+ hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+ }
+ for (i = ch1; i < ch-1; i+=2)
+ {
+ hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+ }
+ hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER;
+ }
+ } else {
+ uint8_t ch1 = (ch)/2;
+ hInfo->num_front_channels = ch1;
+ hInfo->num_back_channels = ch1;
+ if (ch1 & 1)
+ {
+ hInfo->channel_position[0] = FRONT_CHANNEL_CENTER;
+ for (i = 1; i <= ch1; i+=2)
+ {
+ hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+ }
+ for (i = ch1+1; i < ch-1; i+=2)
+ {
+ hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+ }
+ hInfo->channel_position[ch-1] = BACK_CHANNEL_CENTER;
+ } else {
+ for (i = 0; i < ch1; i+=2)
+ {
+ hInfo->channel_position[i] = FRONT_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = FRONT_CHANNEL_RIGHT;
+ }
+ for (i = ch1; i < ch; i+=2)
+ {
+ hInfo->channel_position[i] = BACK_CHANNEL_LEFT;
+ hInfo->channel_position[i+1] = BACK_CHANNEL_RIGHT;
+ }
+ }
+ }
+ hInfo->num_lfe_channels = hDecoder->has_lfe;
+ for (i = ch; i < hDecoder->fr_channels; i++)
+ {
+ hInfo->channel_position[i] = LFE_CHANNEL;
+ }
+ }
+ break;
+ }
+ }
+}
+
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ uint8_t *buffer, uint32_t buffer_size)
+{
+ return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size, NULL, 0);
+}
+
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ uint8_t *buffer, uint32_t buffer_size,
+ void **sample_buffer, uint32_t sample_buffer_size)
+{
+ if ((sample_buffer == NULL) || (sample_buffer_size == 0))
+ {
+ hInfo->error = 27;
+ return NULL;
+ }
+
+ return aac_frame_decode(hDecoder, hInfo, buffer, buffer_size,
+ sample_buffer, sample_buffer_size);
+}
+
+#ifdef DRM
+
+#define ERROR_STATE_INIT 6
+
+static void conceal_output(NeAACDecHandle hDecoder, uint16_t frame_len,
+ uint8_t out_ch, void *sample_buffer)
+{
+ uint16_t i;
+ int16_t *short_sample_buffer = (int16_t*)sample_buffer;
+ int32_t *int_sample_buffer = (int32_t*)sample_buffer;
+#ifndef FIXED_POINT
+ float32_t *float_sample_buffer = (float32_t*)sample_buffer;
+ double *double_sample_buffer = (double*)sample_buffer;
+#endif
+
+ static const int8_t mute_tab[ERROR_STATE_INIT+1] = { 0, 1, 1, 2, 2, 3, 3 };
+
+ if (hDecoder->error_state > 0)
+ {
+ switch (hDecoder->config.outputFormat)
+ {
+ case FAAD_FMT_16BIT:
+ for (i = 0; i < out_ch*frame_len; i++)
+ {
+ short_sample_buffer[i] >>= mute_tab[hDecoder->error_state];
+ //short_sample_buffer[i] = 0;
+ }
+
+ break;
+ case FAAD_FMT_24BIT:
+ case FAAD_FMT_32BIT:
+#ifdef FIXED_POINT
+ case FAAD_FMT_FIXED:
+#endif
+ for (i = 0; i < out_ch*frame_len; i++)
+ {
+ int_sample_buffer[i] >>= mute_tab[hDecoder->error_state];
+ //int_sample_buffer[i] = 0;
+ }
+ break;
+#ifndef FIXED_POINT
+ case FAAD_FMT_FLOAT:
+ for (i = 0; i < out_ch*frame_len; i++)
+ {
+ float_sample_buffer[i] /= (float)(1<<mute_tab[hDecoder->error_state]);
+ //float_sample_buffer[i] = 0;
+ }
+ break;
+ case FAAD_FMT_DOUBLE:
+ for (i = 0; i < out_ch*frame_len; i++)
+ {
+ double_sample_buffer[i] /= (float)(1<<mute_tab[hDecoder->error_state]);
+ //double_sample_buffer[i] = 0;
+ }
+ break;
+#endif
+ }
+
+ hDecoder->error_state--;
+ }
+}
+#endif
+
+static void* aac_frame_decode(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+ uint8_t *buffer, uint32_t buffer_size,
+ void **sample_buffer2, uint32_t sample_buffer_size)
+{
+ uint16_t i;
+ uint8_t channels = 0;
+ uint8_t output_channels = 0;
+ bitfile ld;
+ uint32_t bitsconsumed;
+ uint16_t frame_len;
+ void *sample_buffer;
+
+#ifdef PROFILE
+ int64_t count = faad_get_ts();
+#endif
+
+ /* safety checks */
+ if ((hDecoder == NULL) || (hInfo == NULL) || (buffer == NULL))
+ {
+ return NULL;
+ }
+
+#if 0
+ printf("%d\n", buffer_size*8);
+#endif
+
+ frame_len = hDecoder->frameLength;
+
+
+ memset(hInfo, 0, sizeof(NeAACDecFrameInfo));
+ memset(hDecoder->internal_channel, 0, MAX_CHANNELS*sizeof(hDecoder->internal_channel[0]));
+
+
+ /* check for some common metadata tag types in the bitstream
+ * No need to return an error
+ */
+ /* ID3 */
+ if (buffer_size >= 128)
+ {
+ if (memcmp(buffer, "TAG", 3) == 0)
+ {
+ /* found it */
+ hInfo->bytesconsumed = 128; /* 128 bytes fixed size */
+ /* no error, but no output either */
+ return NULL;
+ }
+ }
+
+
+ /* initialize the bitstream */
+ faad_initbits(&ld, buffer, buffer_size);
+
+#if 0
+ {
+ int i;
+ for (i = 0; i < ((buffer_size+3)>>2); i++)
+ {
+ uint8_t *buf;
+ uint32_t temp = 0;
+ buf = faad_getbitbuffer(&ld, 32);
+ //temp = getdword((void*)buf);
+ temp = *((uint32_t*)buf);
+ printf("0x%.8X\n", temp);
+ free(buf);
+ }
+ faad_endbits(&ld);
+ faad_initbits(&ld, buffer, buffer_size);
+ }
+#endif
+
+#ifdef DRM
+ if (hDecoder->object_type == DRM_ER_LC)
+ {
+ /* We do not support stereo right now */
+ if (0) //(hDecoder->channelConfiguration == 2)
+ {
+ hInfo->error = 28; // Throw CRC error
+ goto error;
+ }
+
+ faad_getbits(&ld, 8
+ DEBUGVAR(1,1,"NeAACDecDecode(): skip CRC"));
+ }
+#endif
+
+ if (hDecoder->adts_header_present)
+ {
+ adts_header adts;
+
+ adts.old_format = hDecoder->config.useOldADTSFormat;
+ if ((hInfo->error = adts_frame(&adts, &ld)) > 0)
+ goto error;
+
+ /* MPEG2 does byte_alignment() here,
+ * but ADTS header is always multiple of 8 bits in MPEG2
+ * so not needed to actually do it.
+ */
+ }
+
+#ifdef ANALYSIS
+ dbg_count = 0;
+#endif
+
+ /* decode the complete bitstream */
+#ifdef DRM
+ if (/*(hDecoder->object_type == 6) ||*/ (hDecoder->object_type == DRM_ER_LC))
+ {
+ DRM_aac_scalable_main_element(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc);
+ } else {
+#endif
+ raw_data_block(hDecoder, hInfo, &ld, &hDecoder->pce, hDecoder->drc);
+#ifdef DRM
+ }
+#endif
+
+ channels = hDecoder->fr_channels;
+
+ if (hInfo->error > 0)
+ goto error;
+
+ /* safety check */
+ if (channels == 0 || channels > MAX_CHANNELS)
+ {
+ /* invalid number of channels */
+ hInfo->error = 12;
+ goto error;
+ }
+
+ /* no more bit reading after this */
+ bitsconsumed = faad_get_processed_bits(&ld);
+ hInfo->bytesconsumed = bit2byte(bitsconsumed);
+ if (ld.error)
+ {
+ hInfo->error = 14;
+ goto error;
+ }
+ faad_endbits(&ld);
+
+
+ if (!hDecoder->adts_header_present && !hDecoder->adif_header_present)
+ {
+ if (hDecoder->channelConfiguration == 0)
+ hDecoder->channelConfiguration = channels;
+
+ if (channels == 8) /* 7.1 */
+ hDecoder->channelConfiguration = 7;
+ if (channels == 7) /* not a standard channelConfiguration */
+ hDecoder->channelConfiguration = 0;
+ }
+
+ if ((channels == 5 || channels == 6) && hDecoder->config.downMatrix)
+ {
+ hDecoder->downMatrix = 1;
+ output_channels = 2;
+ } else {
+ output_channels = channels;
+ }
+
+#if (defined(PS_DEC) || defined(DRM_PS))
+ hDecoder->upMatrix = 0;
+ /* check if we have a mono file */
+ if (output_channels == 1)
+ {
+ /* upMatrix to 2 channels for implicit signalling of PS */
+ hDecoder->upMatrix = 1;
+ output_channels = 2;
+ }
+#endif
+
+ /* Make a channel configuration based on either a PCE or a channelConfiguration */
+ create_channel_config(hDecoder, hInfo);
+
+ /* number of samples in this frame */
+ hInfo->samples = frame_len*output_channels;
+ /* number of channels in this frame */
+ hInfo->channels = output_channels;
+ /* samplerate */
+ hInfo->samplerate = get_sample_rate(hDecoder->sf_index);
+ /* object type */
+ hInfo->object_type = hDecoder->object_type;
+ /* sbr */
+ hInfo->sbr = NO_SBR;
+ /* header type */
+ hInfo->header_type = RAW;
+ if (hDecoder->adif_header_present)
+ hInfo->header_type = ADIF;
+ if (hDecoder->adts_header_present)
+ hInfo->header_type = ADTS;
+#if (defined(PS_DEC) || defined(DRM_PS))
+ hInfo->ps = hDecoder->ps_used_global;
+#endif
+
+ /* check if frame has channel elements */
+ if (channels == 0)
+ {
+ hDecoder->frame++;
+ return NULL;
+ }
+
+ /* allocate the buffer for the final samples */
+ if ((hDecoder->sample_buffer == NULL) ||
+ (hDecoder->alloced_channels != output_channels))
+ {
+ static const uint8_t str[] = { sizeof(int16_t), sizeof(int32_t), sizeof(int32_t),
+ sizeof(float32_t), sizeof(double), sizeof(int16_t), sizeof(int16_t),
+ sizeof(int16_t), sizeof(int16_t), 0, 0, 0
+ };
+ uint8_t stride = str[hDecoder->config.outputFormat-1];
+#ifdef SBR_DEC
+ if (((hDecoder->sbr_present_flag == 1)&&(!hDecoder->downSampledSBR)) || (hDecoder->forceUpSampling == 1))
+ {
+ stride = 2 * stride;
+ }
+#endif
+ /* check if we want to use internal sample_buffer */
+ if (sample_buffer_size == 0)
+ {
+ if (hDecoder->sample_buffer)
+ faad_free(hDecoder->sample_buffer);
+ hDecoder->sample_buffer = NULL;
+ hDecoder->sample_buffer = faad_malloc(frame_len*output_channels*stride);
+ } else if (sample_buffer_size < frame_len*output_channels*stride) {
+ /* provided sample buffer is not big enough */
+ hInfo->error = 27;
+ return NULL;
+ }
+ hDecoder->alloced_channels = output_channels;
+ }
+
+ if (sample_buffer_size == 0)
+ {
+ sample_buffer = hDecoder->sample_buffer;
+ } else {
+ sample_buffer = *sample_buffer2;
+ }
+
+#ifdef SBR_DEC
+ if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ {
+ uint8_t ele;
+
+ /* this data is different when SBR is used or when the data is upsampled */
+ if (!hDecoder->downSampledSBR)
+ {
+ frame_len *= 2;
+ hInfo->samples *= 2;
+ hInfo->samplerate *= 2;
+ }
+
+ /* check if every element was provided with SBR data */
+ for (ele = 0; ele < hDecoder->fr_ch_ele; ele++)
+ {
+ if (hDecoder->sbr[ele] == NULL)
+ {
+ hInfo->error = 25;
+ goto error;
+ }
+ }
+
+ /* sbr */
+ if (hDecoder->sbr_present_flag == 1)
+ {
+ hInfo->object_type = HE_AAC;
+ hInfo->sbr = SBR_UPSAMPLED;
+ } else {
+ hInfo->sbr = NO_SBR_UPSAMPLED;
+ }
+ if (hDecoder->downSampledSBR)
+ {
+ hInfo->sbr = SBR_DOWNSAMPLED;
+ }
+ }
+#endif
+
+
+ sample_buffer = output_to_PCM(hDecoder, hDecoder->time_out, sample_buffer,
+ output_channels, frame_len, hDecoder->config.outputFormat);
+
+
+#ifdef DRM
+ //conceal_output(hDecoder, frame_len, output_channels, sample_buffer);
+#endif
+
+
+ hDecoder->postSeekResetFlag = 0;
+
+ hDecoder->frame++;
+#ifdef LD_DEC
+ if (hDecoder->object_type != LD)
+ {
+#endif
+ if (hDecoder->frame <= 1)
+ hInfo->samples = 0;
+#ifdef LD_DEC
+ } else {
+ /* LD encoders will give lower delay */
+ if (hDecoder->frame <= 0)
+ hInfo->samples = 0;
+ }
+#endif
+
+ /* cleanup */
+#ifdef ANALYSIS
+ fflush(stdout);
+#endif
+
+#ifdef PROFILE
+ count = faad_get_ts() - count;
+ hDecoder->cycles += count;
+#endif
+
+ return sample_buffer;
+
+error:
+
+
+#ifdef DRM
+ hDecoder->error_state = ERROR_STATE_INIT;
+#endif
+
+ /* reset filterbank state */
+ for (i = 0; i < MAX_CHANNELS; i++)
+ {
+ if (hDecoder->fb_intermed[i] != NULL)
+ {
+ memset(hDecoder->fb_intermed[i], 0, hDecoder->frameLength*sizeof(real_t));
+ }
+ }
+#ifdef SBR_DEC
+ for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++)
+ {
+ if (hDecoder->sbr[i] != NULL)
+ {
+ sbrReset(hDecoder->sbr[i]);
+ }
+ }
+#endif
+
+
+ faad_endbits(&ld);
+
+ /* cleanup */
+#ifdef ANALYSIS
+ fflush(stdout);
+#endif
+
+ return NULL;
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/decoder.h b/src/filters/transform/mpadecfilter/faad2/libfaad/decoder.h
new file mode 100644
index 000000000..b8717587c
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/decoder.h
@@ -0,0 +1,126 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: decoder.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __DECODER_H__
+#define __DECODER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _WIN32
+ #pragma pack(push, 8)
+ #ifndef NEAACDECAPI
+ #define NEAACDECAPI __cdecl
+ #endif
+#else
+ #ifndef NEAACDECAPI
+ #define NEAACDECAPI
+ #endif
+#endif
+
+
+/* library output formats */
+#define FAAD_FMT_16BIT 1
+#define FAAD_FMT_24BIT 2
+#define FAAD_FMT_32BIT 3
+#define FAAD_FMT_FLOAT 4
+#define FAAD_FMT_FIXED FAAD_FMT_FLOAT
+#define FAAD_FMT_DOUBLE 5
+
+#define LC_DEC_CAP (1<<0)
+#define MAIN_DEC_CAP (1<<1)
+#define LTP_DEC_CAP (1<<2)
+#define LD_DEC_CAP (1<<3)
+#define ERROR_RESILIENCE_CAP (1<<4)
+#define FIXED_POINT_CAP (1<<5)
+
+#define FRONT_CHANNEL_CENTER (1)
+#define FRONT_CHANNEL_LEFT (2)
+#define FRONT_CHANNEL_RIGHT (3)
+#define SIDE_CHANNEL_LEFT (4)
+#define SIDE_CHANNEL_RIGHT (5)
+#define BACK_CHANNEL_LEFT (6)
+#define BACK_CHANNEL_RIGHT (7)
+#define BACK_CHANNEL_CENTER (8)
+#define LFE_CHANNEL (9)
+#define UNKNOWN_CHANNEL (0)
+
+char* NEAACDECAPI NeAACDecGetErrorMessage(uint8_t errcode);
+
+uint32_t NEAACDECAPI NeAACDecGetCapabilities(void);
+
+NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
+
+NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
+
+uint8_t NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
+ NeAACDecConfigurationPtr config);
+
+/* Init the library based on info from the AAC file (ADTS/ADIF) */
+int32_t NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
+ uint8_t *buffer,
+ uint32_t buffer_size,
+ uint32_t *samplerate,
+ uint8_t *channels);
+
+/* Init the library using a DecoderSpecificInfo */
+int8_t NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder, uint8_t *pBuffer,
+ uint32_t SizeOfDecoderSpecificInfo,
+ uint32_t *samplerate, uint8_t *channels);
+
+/* Init the library for DRM */
+int8_t NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, uint32_t samplerate,
+ uint8_t channels);
+
+void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
+
+void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, int32_t frame);
+
+void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ uint8_t *buffer,
+ uint32_t buffer_size);
+
+void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo,
+ uint8_t *buffer, uint32_t buffer_size,
+ void **sample_buffer, uint32_t sample_buffer_size);
+
+#ifdef _WIN32
+ #pragma pack(pop)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/drc.c b/src/filters/transform/mpadecfilter/faad2/libfaad/drc.c
new file mode 100644
index 000000000..8eff5bcf3
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/drc.c
@@ -0,0 +1,175 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: drc.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include "syntax.h"
+#include "drc.h"
+
+drc_info *drc_init(real_t cut, real_t boost)
+{
+ drc_info *drc = (drc_info*)faad_malloc(sizeof(drc_info));
+ memset(drc, 0, sizeof(drc_info));
+
+ drc->ctrl1 = cut;
+ drc->ctrl2 = boost;
+
+ drc->num_bands = 1;
+ drc->band_top[0] = 1024/4 - 1;
+ drc->dyn_rng_sgn[0] = 1;
+ drc->dyn_rng_ctl[0] = 0;
+
+ return drc;
+}
+
+void drc_end(drc_info *drc)
+{
+ if (drc) faad_free(drc);
+}
+
+#ifdef FIXED_POINT
+static real_t drc_pow2_table[] =
+{
+ COEF_CONST(0.5146511183),
+ COEF_CONST(0.5297315472),
+ COEF_CONST(0.5452538663),
+ COEF_CONST(0.5612310242),
+ COEF_CONST(0.5776763484),
+ COEF_CONST(0.5946035575),
+ COEF_CONST(0.6120267717),
+ COEF_CONST(0.6299605249),
+ COEF_CONST(0.6484197773),
+ COEF_CONST(0.6674199271),
+ COEF_CONST(0.6869768237),
+ COEF_CONST(0.7071067812),
+ COEF_CONST(0.7278265914),
+ COEF_CONST(0.7491535384),
+ COEF_CONST(0.7711054127),
+ COEF_CONST(0.7937005260),
+ COEF_CONST(0.8169577266),
+ COEF_CONST(0.8408964153),
+ COEF_CONST(0.8655365610),
+ COEF_CONST(0.8908987181),
+ COEF_CONST(0.9170040432),
+ COEF_CONST(0.9438743127),
+ COEF_CONST(0.9715319412),
+ COEF_CONST(1.0000000000),
+ COEF_CONST(1.0293022366),
+ COEF_CONST(1.0594630944),
+ COEF_CONST(1.0905077327),
+ COEF_CONST(1.1224620483),
+ COEF_CONST(1.1553526969),
+ COEF_CONST(1.1892071150),
+ COEF_CONST(1.2240535433),
+ COEF_CONST(1.2599210499),
+ COEF_CONST(1.2968395547),
+ COEF_CONST(1.3348398542),
+ COEF_CONST(1.3739536475),
+ COEF_CONST(1.4142135624),
+ COEF_CONST(1.4556531828),
+ COEF_CONST(1.4983070769),
+ COEF_CONST(1.5422108254),
+ COEF_CONST(1.5874010520),
+ COEF_CONST(1.6339154532),
+ COEF_CONST(1.6817928305),
+ COEF_CONST(1.7310731220),
+ COEF_CONST(1.7817974363),
+ COEF_CONST(1.8340080864),
+ COEF_CONST(1.8877486254),
+ COEF_CONST(1.9430638823)
+};
+#endif
+
+void drc_decode(drc_info *drc, real_t *spec)
+{
+ uint16_t i, bd, top;
+#ifdef FIXED_POINT
+ int32_t exp, frac;
+#else
+ real_t factor, exp;
+#endif
+ uint16_t bottom = 0;
+
+ if (drc->num_bands == 1)
+ drc->band_top[0] = 1024/4 - 1;
+
+ for (bd = 0; bd < drc->num_bands; bd++)
+ {
+ top = 4 * (drc->band_top[bd] + 1);
+
+#ifndef FIXED_POINT
+ /* Decode DRC gain factor */
+ if (drc->dyn_rng_sgn[bd]) /* compress */
+ exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
+ else /* boost */
+ exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
+ factor = (real_t)pow(2.0, exp);
+
+ /* Apply gain factor */
+ for (i = bottom; i < top; i++)
+ spec[i] *= factor;
+#else
+ /* Decode DRC gain factor */
+ if (drc->dyn_rng_sgn[bd]) /* compress */
+ {
+ exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
+ frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
+ } else { /* boost */
+ exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
+ frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
+ }
+
+ /* Apply gain factor */
+ if (exp < 0)
+ {
+ for (i = bottom; i < top; i++)
+ {
+ spec[i] >>= -exp;
+ if (frac)
+ spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
+ }
+ } else {
+ for (i = bottom; i < top; i++)
+ {
+ spec[i] <<= exp;
+ if (frac)
+ spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
+ }
+ }
+#endif
+
+ bottom = top;
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/drc.h b/src/filters/transform/mpadecfilter/faad2/libfaad/drc.h
new file mode 100644
index 000000000..12e1e1b42
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/drc.h
@@ -0,0 +1,51 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: drc.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __DRC_H__
+#define __DRC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define DRC_REF_LEVEL 20*4 /* -20 dB */
+
+
+drc_info *drc_init(real_t cut, real_t boost);
+void drc_end(drc_info *drc);
+void drc_decode(drc_info *drc, real_t *spec);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/drm_dec.c b/src/filters/transform/mpadecfilter/faad2/libfaad/drm_dec.c
new file mode 100644
index 000000000..faba808be
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/drm_dec.c
@@ -0,0 +1,967 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: drm_dec.c 446 2005-11-06 10:54:47Z gabest $
+**/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "common.h"
+
+#ifdef DRM
+
+#include "sbr_dec.h"
+#include "drm_dec.h"
+#include "bits.h"
+
+/* constants */
+#define DECAY_CUTOFF 3
+#define DECAY_SLOPE 0.05f
+
+/* type definitaions */
+typedef const int8_t (*drm_ps_huff_tab)[2];
+
+
+/* binary search huffman tables */
+static const int8_t f_huffman_sa[][2] =
+{
+ { /*0*/ -15, 1 }, /* index 0: 1 bits: x */
+ { 2, 3 }, /* index 1: 2 bits: 1x */
+ { /*7*/ -8, 4 }, /* index 2: 3 bits: 10x */
+ { 5, 6 }, /* index 3: 3 bits: 11x */
+ { /*1*/ -14, /*-1*/ -16 }, /* index 4: 4 bits: 101x */
+ { /*-2*/ -17, 7 }, /* index 5: 4 bits: 110x */
+ { 8, 9 }, /* index 6: 4 bits: 111x */
+ { /*2*/ -13, /*-3*/ -18 }, /* index 7: 5 bits: 1101x */
+ { /*3*/ -12, 10 }, /* index 8: 5 bits: 1110x */
+ { 11, 12 }, /* index 9: 5 bits: 1111x */
+ { /*4*/ -11, /*5*/ -10 }, /* index 10: 6 bits: 11101x */
+ { /*-4*/ -19, /*-5*/ -20 }, /* index 11: 6 bits: 11110x */
+ { /*6*/ -9, 13 }, /* index 12: 6 bits: 11111x */
+ { /*-7*/ -22, /*-6*/ -21 } /* index 13: 7 bits: 111111x */
+};
+
+static const int8_t t_huffman_sa[][2] =
+{
+ { /*0*/ -15, 1 }, /* index 0: 1 bits: x */
+ { 2, 3 }, /* index 1: 2 bits: 1x */
+ { /*-1*/ -16, /*1*/ -14 }, /* index 2: 3 bits: 10x */
+ { 4, 5 }, /* index 3: 3 bits: 11x */
+ { /*-2*/ -17, /*2*/ -13 }, /* index 4: 4 bits: 110x */
+ { 6, 7 }, /* index 5: 4 bits: 111x */
+ { /*-3*/ -18, /*3*/ -12 }, /* index 6: 5 bits: 1110x */
+ { 8, 9 }, /* index 7: 5 bits: 1111x */
+ { /*-4*/ -19, /*4*/ -11 }, /* index 8: 6 bits: 11110x */
+ { 10, 11 }, /* index 9: 6 bits: 11111x */
+ { /*-5*/ -20, /*5*/ -10 }, /* index 10: 7 bits: 111110x */
+ { /*-6*/ -21, 12 }, /* index 11: 7 bits: 111111x */
+ { /*-7*/ -22, 13 }, /* index 12: 8 bits: 1111111x */
+ { /*6*/ -9, /*7*/ -8 } /* index 13: 9 bits: 11111111x */
+};
+
+static const int8_t f_huffman_pan[][2] =
+{
+ { /*0*/ -15, 1 }, /* index 0: 1 bits: x */
+ { /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */
+ { /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */
+ { 4, 5 }, /* index 3: 4 bits: 111x */
+ { /*-2*/ -17, /*2*/ -13 }, /* index 4: 5 bits: 1110x */
+ { 6, 7 }, /* index 5: 5 bits: 1111x */
+ { /*-3*/ -18, /*3*/ -12 }, /* index 6: 6 bits: 11110x */
+ { 8, 9 }, /* index 7: 6 bits: 11111x */
+ { /*-4*/ -19, /*4*/ -11 }, /* index 8: 7 bits: 111110x */
+ { 10, 11 }, /* index 9: 7 bits: 111111x */
+ { /*-5*/ -20, /*5*/ -10 }, /* index 10: 8 bits: 1111110x */
+ { 12, 13 }, /* index 11: 8 bits: 1111111x */
+ { /*-6*/ -21, /*6*/ -9 }, /* index 12: 9 bits: 11111110x */
+ { /*-7*/ -22, 14 }, /* index 13: 9 bits: 11111111x */
+ { /*7*/ -8, 15 }, /* index 14: 10 bits: 111111111x */
+ { 16, 17 }, /* index 15: 11 bits: 1111111111x */
+ { /*-8*/ -23, /*8*/ -7 }, /* index 16: 12 bits: 11111111110x */
+ { 18, 19 }, /* index 17: 12 bits: 11111111111x */
+ { /*-10*/ -25, 20 }, /* index 18: 13 bits: 111111111110x */
+ { 21, 22 }, /* index 19: 13 bits: 111111111111x */
+ { /*-9*/ -24, /*9*/ -6 }, /* index 20: 14 bits: 1111111111101x */
+ { /*10*/ -5, 23 }, /* index 21: 14 bits: 1111111111110x */
+ { 24, 25 }, /* index 22: 14 bits: 1111111111111x */
+ { /*-13*/ -28, /*-11*/ -26 }, /* index 23: 15 bits: 11111111111101x */
+ { /*11*/ -4, /*13*/ -2 }, /* index 24: 15 bits: 11111111111110x */
+ { 26, 27 }, /* index 25: 15 bits: 11111111111111x */
+ { /*-14*/ -29, /*-12*/ -27 }, /* index 26: 16 bits: 111111111111110x */
+ { /*12*/ -3, /*14*/ -1 } /* index 27: 16 bits: 111111111111111x */
+};
+
+static const int8_t t_huffman_pan[][2] =
+{
+ { /*0*/ -15, 1 }, /* index 0: 1 bits: x */
+ { /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */
+ { /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */
+ { /*-2*/ -17, 4 }, /* index 3: 4 bits: 111x */
+ { /*2*/ -13, 5 }, /* index 4: 5 bits: 1111x */
+ { /*-3*/ -18, 6 }, /* index 5: 6 bits: 11111x */
+ { /*3*/ -12, 7 }, /* index 6: 7 bits: 111111x */
+ { /*-4*/ -19, 8 }, /* index 7: 8 bits: 1111111x */
+ { /*4*/ -11, 9 }, /* index 8: 9 bits: 11111111x */
+ { 10, 11 }, /* index 9: 10 bits: 111111111x */
+ { /*-5*/ -20, /*5*/ -10 }, /* index 10: 11 bits: 1111111110x */
+ { 12, 13 }, /* index 11: 11 bits: 1111111111x */
+ { /*-6*/ -21, /*6*/ -9 }, /* index 12: 12 bits: 11111111110x */
+ { 14, 15 }, /* index 13: 12 bits: 11111111111x */
+ { /*-7*/ -22, /*7*/ -8 }, /* index 14: 13 bits: 111111111110x */
+ { 16, 17 }, /* index 15: 13 bits: 111111111111x */
+ { /*-8*/ -23, /*8*/ -7 }, /* index 16: 14 bits: 1111111111110x */
+ { 18, 19 }, /* index 17: 14 bits: 1111111111111x */
+ { /*-10*/ -25, /*10*/ -5 }, /* index 18: 15 bits: 11111111111110x */
+ { 20, 21 }, /* index 19: 15 bits: 11111111111111x */
+ { /*-9*/ -24, /*9*/ -6 }, /* index 20: 16 bits: 111111111111110x */
+ { 22, 23 }, /* index 21: 16 bits: 111111111111111x */
+ { 24, 25 }, /* index 22: 17 bits: 1111111111111110x */
+ { 26, 27 }, /* index 23: 17 bits: 1111111111111111x */
+ { /*-14*/ -29, /*-13*/ -28 }, /* index 24: 18 bits: 11111111111111100x */
+ { /*-12*/ -27, /*-11*/ -26 }, /* index 25: 18 bits: 11111111111111101x */
+ { /*11*/ -4, /*12*/ -3 }, /* index 26: 18 bits: 11111111111111110x */
+ { /*13*/ -2, /*14*/ -1 } /* index 27: 18 bits: 11111111111111111x */
+};
+
+/* There are 3 classes in the standard but the last 2 are identical */
+static const real_t sa_quant[8][2] =
+{
+ { FRAC_CONST(0.0000), FRAC_CONST(0.0000) },
+ { FRAC_CONST(0.0501), FRAC_CONST(0.1778) },
+ { FRAC_CONST(0.0706), FRAC_CONST(0.2818) },
+ { FRAC_CONST(0.0995), FRAC_CONST(0.4467) },
+ { FRAC_CONST(0.1399), FRAC_CONST(0.5623) },
+ { FRAC_CONST(0.1957), FRAC_CONST(0.7079) },
+ { FRAC_CONST(0.2713), FRAC_CONST(0.8913) },
+ { FRAC_CONST(0.3699), FRAC_CONST(1.0000) },
+};
+
+/* We don't need the actual quantizer values */
+#if 0
+static const real_t pan_quant[8][5] =
+{
+ { COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000) },
+ { COEF_CONST(0.1661), COEF_CONST(0.1661), COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.3322) },
+ { COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.6644), COEF_CONST(0.8305), COEF_CONST(0.8305) },
+ { COEF_CONST(0.4983), COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(1.6610) },
+ { COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(2.1593), COEF_CONST(2.4914) },
+ { COEF_CONST(0.8305), COEF_CONST(1.3288), COEF_CONST(2.1593), COEF_CONST(2.9897), COEF_CONST(3.4880) },
+ { COEF_CONST(0.9966), COEF_CONST(1.8271), COEF_CONST(2.8236), COEF_CONST(3.8202), COEF_CONST(4.6507) },
+ { COEF_CONST(1.3288), COEF_CONST(2.3253), COEF_CONST(3.4880), COEF_CONST(4.6507), COEF_CONST(5.8134) },
+};
+#endif
+
+/* 2^(pan_quant[x][y] */
+static const real_t pan_pow_2_pos[8][5] = {
+ { REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000) },
+ { REAL_CONST(1.1220021), REAL_CONST(1.1220021), REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.2589312) },
+ { REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.5849090), REAL_CONST(1.7783016), REAL_CONST(1.7783016) },
+ { REAL_CONST(1.4125481), REAL_CONST(1.5849090), REAL_CONST(1.9952921), REAL_CONST(2.8184461), REAL_CONST(3.1623565) },
+ { REAL_CONST(1.5849090), REAL_CONST(1.9952922), REAL_CONST(2.8184461), REAL_CONST(4.4669806), REAL_CONST(5.6232337) },
+ { REAL_CONST(1.7783016), REAL_CONST(2.5119365), REAL_CONST(4.4669806), REAL_CONST(7.9430881), REAL_CONST(11.219994) },
+ { REAL_CONST(1.9952921), REAL_CONST(3.5482312), REAL_CONST(7.0792671), REAL_CONST(14.125206), REAL_CONST(25.118876) },
+ { REAL_CONST(2.5119365), REAL_CONST(5.0116998), REAL_CONST(11.219994), REAL_CONST(25.118876), REAL_CONST(56.235140) }
+};
+
+/* 2^(-pan_quant[x][y] */
+static const real_t pan_pow_2_neg[8][5] = {
+ { REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1) },
+ { REAL_CONST(0.8912487), REAL_CONST(0.8912487), REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.7943242) },
+ { REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.6309511), REAL_CONST(0.5623344), REAL_CONST(0.5623344) },
+ { REAL_CONST(0.7079405), REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.3162199) },
+ { REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.2238649), REAL_CONST(0.1778336) },
+ { REAL_CONST(0.5623343), REAL_CONST(0.3980992), REAL_CONST(0.2238649), REAL_CONST(0.1258956), REAL_CONST(0.0891266) },
+ { REAL_CONST(0.5011797), REAL_CONST(0.2818306), REAL_CONST(0.1412576), REAL_CONST(0.0707954), REAL_CONST(0.0398107) },
+ { REAL_CONST(0.3980992), REAL_CONST(0.1995331), REAL_CONST(0.0891267), REAL_CONST(0.0398107), REAL_CONST(0.0177825) }
+};
+
+/* 2^(pan_quant[x][y]/30) */
+static const real_t pan_pow_2_30_pos[8][5] = {
+ { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) },
+ { COEF_CONST(1.003845098), COEF_CONST(1.003845098), COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.007704982) },
+ { COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.01546933), COEF_CONST(1.019373909), COEF_CONST(1.019373909) },
+ { COEF_CONST(1.011579706), COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.039123167) },
+ { COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.051155908), COEF_CONST(1.059252598) },
+ { COEF_CONST(1.019373909), COEF_CONST(1.03117796), COEF_CONST(1.051155908), COEF_CONST(1.071518432), COEF_CONST(1.0839263) },
+ { COEF_CONST(1.023293502), COEF_CONST(1.043118698), COEF_CONST(1.067414119), COEF_CONST(1.092277933), COEF_CONST(1.113439626) },
+ { COEF_CONST(1.03117796), COEF_CONST(1.055195268), COEF_CONST(1.0839263), COEF_CONST(1.113439626), COEF_CONST(1.143756546) }
+};
+
+/* 2^(-pan_quant[x][y]/30) */
+static const real_t pan_pow_2_30_neg[8][5] = {
+ { COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) },
+ { COEF_CONST(0.99616963), COEF_CONST(0.99616963), COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.99235393) },
+ { COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.984766325), COEF_CONST(0.980994305), COEF_CONST(0.980994305) },
+ { COEF_CONST(0.988552848), COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.962349827) },
+ { COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.951333663), COEF_CONST(0.944061881) },
+ { COEF_CONST(0.980994305), COEF_CONST(0.969764715), COEF_CONST(0.951333663), COEF_CONST(0.933255062), COEF_CONST(0.922571949) },
+ { COEF_CONST(0.977236734), COEF_CONST(0.958663671), COEF_CONST(0.936843519), COEF_CONST(0.915517901), COEF_CONST(0.898117847) },
+ { COEF_CONST(0.969764715), COEF_CONST(0.947691892), COEF_CONST(0.922571949), COEF_CONST(0.898117847), COEF_CONST(0.874311936) }
+};
+
+static const real_t g_decayslope[MAX_SA_BAND] = {
+ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.95),FRAC_CONST(0.9), FRAC_CONST(0.85), FRAC_CONST(0.8),
+ FRAC_CONST(0.75),FRAC_CONST(0.7), FRAC_CONST(0.65),FRAC_CONST(0.6), FRAC_CONST(0.55),FRAC_CONST(0.5), FRAC_CONST(0.45),
+ FRAC_CONST(0.4), FRAC_CONST(0.35),FRAC_CONST(0.3), FRAC_CONST(0.25),FRAC_CONST(0.2), FRAC_CONST(0.15), FRAC_CONST(0.1),
+ FRAC_CONST(0.05),FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
+ FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
+ FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
+ FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0)
+};
+
+static const real_t sa_sqrt_1_minus[8][2] = {
+ { FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.998744206), FRAC_CONST(0.984066644) },
+ { FRAC_CONST(0.997504707), FRAC_CONST(0.959473168) },
+ { FRAC_CONST(0.995037562), FRAC_CONST(0.894683804) },
+ { FRAC_CONST(0.990165638), FRAC_CONST(0.826933317) },
+ { FRAC_CONST(0.980663811), FRAC_CONST(0.706312672) },
+ { FRAC_CONST(0.962494836), FRAC_CONST(0.45341406) },
+ { FRAC_CONST(0.929071574), FRAC_CONST(0) }
+};
+
+static const uint8_t sa_freq_scale[9] =
+{
+ 0, 1, 2, 3, 5, 7, 10, 13, 23
+};
+
+static const uint8_t pan_freq_scale[21] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 18, 22, 26, 32, 64
+};
+
+static const uint8_t pan_quant_class[20] =
+{
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 2, 2, 2, 2, 3, 3, 3, 4, 4, 4
+};
+
+/* Inverse mapping lookup */
+static const uint8_t pan_inv_freq[64] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19
+};
+
+static const uint8_t sa_inv_freq[MAX_SA_BAND] = {
+ 0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7
+};
+
+static const real_t filter_coeff[] =
+{
+ FRAC_CONST(0.65143905754106),
+ FRAC_CONST(0.56471812200776),
+ FRAC_CONST(0.48954165955695)
+};
+
+static const uint8_t delay_length[3] =
+{
+ 3, 4, 5
+};
+
+static const real_t delay_fraction[] =
+{
+ FRAC_CONST(0.43), FRAC_CONST(0.75), FRAC_CONST(0.347)
+};
+
+static const real_t peak_decay = FRAC_CONST(0.76592833836465);
+
+static const real_t smooth_coeff = FRAC_CONST(0.25);
+
+/* Please note that these are the same tables as in plain PS */
+static const complex_t Q_Fract_allpass_Qmf[][3] = {
+ { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } },
+ { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } },
+ { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } },
+ { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } },
+ { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } },
+ { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } },
+ { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } },
+ { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } },
+ { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } },
+ { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } },
+ { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } },
+ { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } },
+ { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } },
+ { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } },
+ { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } },
+ { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } },
+ { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } },
+ { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } },
+ { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } },
+ { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } },
+ { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } },
+ { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } },
+ { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } },
+ { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } },
+ { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } },
+ { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } },
+ { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } },
+ { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } },
+ { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } },
+ { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } },
+ { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } },
+ { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } },
+ { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } },
+ { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } },
+ { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } },
+ { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } },
+ { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } },
+ { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } },
+ { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } },
+ { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } },
+ { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } },
+ { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } },
+ { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } },
+ { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } },
+ { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } },
+ { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } },
+ { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } },
+ { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } },
+ { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } },
+ { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } },
+ { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } },
+ { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } },
+ { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } },
+ { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } },
+ { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } },
+ { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } },
+ { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } },
+ { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } },
+ { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } },
+ { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } },
+ { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } },
+ { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } },
+ { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } },
+ { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } }
+};
+
+static const complex_t Phi_Fract_Qmf[] = {
+ { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) },
+ { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) },
+ { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) },
+ { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) },
+ { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) },
+ { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) },
+ { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) },
+ { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) },
+ { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) },
+ { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) },
+ { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) },
+ { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) },
+ { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) },
+ { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) },
+ { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) },
+ { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) },
+ { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) },
+ { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) },
+ { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) },
+ { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) },
+ { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) },
+ { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) },
+ { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) },
+ { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) },
+ { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) },
+ { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) },
+ { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) },
+ { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) },
+ { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) },
+ { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) },
+ { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) },
+ { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) },
+ { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) },
+ { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) },
+ { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) },
+ { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) },
+ { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) },
+ { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) },
+ { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) },
+ { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) },
+ { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) },
+ { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) },
+ { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) },
+ { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) },
+ { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) },
+ { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) },
+ { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) },
+ { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) },
+ { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) },
+ { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) },
+ { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) },
+ { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) },
+ { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) },
+ { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) },
+ { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) },
+ { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) },
+ { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) },
+ { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) },
+ { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) },
+ { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) },
+ { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) },
+ { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) },
+ { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) },
+ { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) }
+};
+
+
+/* static function declarations */
+static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld);
+static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld);
+static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff);
+
+
+uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld)
+{
+ uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
+
+ ps->drm_ps_data_available = 1;
+
+ ps->bs_enable_sa = faad_get1bit(ld);
+ ps->bs_enable_pan = faad_get1bit(ld);
+
+ if (ps->bs_enable_sa)
+ {
+ drm_ps_sa_element(ps, ld);
+ }
+
+ if (ps->bs_enable_pan)
+ {
+ drm_ps_pan_element(ps, ld);
+ }
+
+ bits = (uint16_t)faad_get_processed_bits(ld) - bits;
+
+ return bits;
+}
+
+static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld)
+{
+ drm_ps_huff_tab huff;
+ uint8_t band;
+
+ ps->bs_sa_dt_flag = faad_get1bit(ld);
+ if (ps->bs_sa_dt_flag)
+ {
+ huff = t_huffman_sa;
+ } else {
+ huff = f_huffman_sa;
+ }
+
+ for (band = 0; band < DRM_NUM_SA_BANDS; band++)
+ {
+ ps->bs_sa_data[band] = huff_dec(ld, huff);
+ }
+}
+
+static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld)
+{
+ drm_ps_huff_tab huff;
+ uint8_t band;
+
+ ps->bs_pan_dt_flag = faad_get1bit(ld);
+ if (ps->bs_pan_dt_flag)
+ {
+ huff = t_huffman_pan;
+ } else {
+ huff = f_huffman_pan;
+ }
+
+ for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
+ {
+ ps->bs_pan_data[band] = huff_dec(ld, huff);
+ }
+}
+
+/* binary search huffman decoding */
+static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff)
+{
+ uint8_t bit;
+ int16_t index = 0;
+
+ while (index >= 0)
+ {
+ bit = (uint8_t)faad_get1bit(ld);
+ index = huff[index][bit];
+ }
+
+ return index + 15;
+}
+
+
+static int8_t sa_delta_clip(drm_ps_info *ps, int8_t i)
+{
+ if (i < 0) {
+ /* printf(" SAminclip %d", i); */
+ ps->sa_decode_error = 1;
+ return 0;
+ } else if (i > 7) {
+ /* printf(" SAmaxclip %d", i); */
+ ps->sa_decode_error = 1;
+ return 7;
+ } else
+ return i;
+}
+
+static int8_t pan_delta_clip(drm_ps_info *ps, int8_t i)
+{
+ if (i < -7) {
+ /* printf(" PANminclip %d", i); */
+ ps->pan_decode_error = 1;
+ return -7;
+ } else if (i > 7) {
+ /* printf(" PANmaxclip %d", i); */
+ ps->pan_decode_error = 1;
+ return 7;
+ } else
+ return i;
+}
+
+static void drm_ps_delta_decode(drm_ps_info *ps)
+{
+ uint8_t band;
+
+ if (ps->bs_enable_sa)
+ {
+ if (ps->bs_sa_dt_flag && !ps->g_last_had_sa)
+ {
+ /* wait until we get a DT frame */
+ ps->bs_enable_sa = 0;
+ } else if (ps->bs_sa_dt_flag) {
+ /* DT frame, we have a last frame, so we can decode */
+ ps->g_sa_index[0] = sa_delta_clip(ps, ps->g_prev_sa_index[0]+ps->bs_sa_data[0]);
+ } else {
+ /* DF always decodable */
+ ps->g_sa_index[0] = sa_delta_clip(ps,ps->bs_sa_data[0]);
+ }
+
+ for (band = 1; band < DRM_NUM_SA_BANDS; band++)
+ {
+ if (ps->bs_sa_dt_flag && ps->g_last_had_sa)
+ {
+ ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_prev_sa_index[band] + ps->bs_sa_data[band]);
+ } else if (!ps->bs_sa_dt_flag) {
+ ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_sa_index[band-1] + ps->bs_sa_data[band]);
+ }
+ }
+ }
+
+ /* An error during SA decoding implies PAN data will be undecodable, too */
+ /* Also, we don't like on/off switching in PS, so we force to last settings */
+ if (ps->sa_decode_error) {
+ ps->pan_decode_error = 1;
+ ps->bs_enable_pan = ps->g_last_had_pan;
+ ps->bs_enable_sa = ps->g_last_had_sa;
+ }
+
+
+ if (ps->bs_enable_sa)
+ {
+ if (ps->sa_decode_error) {
+ for (band = 0; band < DRM_NUM_SA_BANDS; band++)
+ {
+ ps->g_sa_index[band] = ps->g_last_good_sa_index[band];
+ }
+ } else {
+ for (band = 0; band < DRM_NUM_SA_BANDS; band++)
+ {
+ ps->g_last_good_sa_index[band] = ps->g_sa_index[band];
+ }
+ }
+ }
+
+ if (ps->bs_enable_pan)
+ {
+ if (ps->bs_pan_dt_flag && !ps->g_last_had_pan)
+ {
+ ps->bs_enable_pan = 0;
+ } else if (ps->bs_pan_dt_flag) {
+ ps->g_pan_index[0] = pan_delta_clip(ps, ps->g_prev_pan_index[0]+ps->bs_pan_data[0]);
+ } else {
+ ps->g_pan_index[0] = pan_delta_clip(ps, ps->bs_pan_data[0]);
+ }
+
+ for (band = 1; band < DRM_NUM_PAN_BANDS; band++)
+ {
+ if (ps->bs_pan_dt_flag && ps->g_last_had_pan)
+ {
+ ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_prev_pan_index[band] + ps->bs_pan_data[band]);
+ } else if (!ps->bs_pan_dt_flag) {
+ ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_pan_index[band-1] + ps->bs_pan_data[band]);
+ }
+ }
+
+ if (ps->pan_decode_error) {
+ for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
+ {
+ ps->g_pan_index[band] = ps->g_last_good_pan_index[band];
+ }
+ } else {
+ for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
+ {
+ ps->g_last_good_pan_index[band] = ps->g_pan_index[band];
+ }
+ }
+ }
+}
+
+static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64])
+{
+ uint8_t s, b, k;
+ complex_t qfrac, tmp0, tmp, in, R0;
+ real_t peakdiff;
+ real_t nrg;
+ real_t power;
+ real_t transratio;
+ real_t new_delay_slopes[NUM_OF_LINKS];
+ uint8_t temp_delay_ser[NUM_OF_LINKS];
+ complex_t Phi_Fract;
+#ifdef FIXED_POINT
+ uint32_t in_re, in_im;
+#endif
+
+ for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
+ {
+ /* set delay indices */
+ for (k = 0; k < NUM_OF_LINKS; k++)
+ temp_delay_ser[k] = ps->delay_buf_index_ser[k];
+
+ RE(Phi_Fract) = RE(Phi_Fract_Qmf[b]);
+ IM(Phi_Fract) = IM(Phi_Fract_Qmf[b]);
+
+ for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
+ {
+ const real_t gamma = REAL_CONST(1.5);
+ const real_t sigma = REAL_CONST(1.5625);
+
+ RE(in) = QMF_RE(X[s][b]);
+ IM(in) = QMF_IM(X[s][b]);
+
+#ifdef FIXED_POINT
+ /* NOTE: all input is scaled by 2^(-5) because of fixed point QMF
+ * meaning that P will be scaled by 2^(-10) compared to floating point version
+ */
+ in_re = ((abs(RE(in))+(1<<(REAL_BITS-1)))>>REAL_BITS);
+ in_im = ((abs(IM(in))+(1<<(REAL_BITS-1)))>>REAL_BITS);
+ power = in_re*in_re + in_im*in_im;
+#else
+ power = MUL_R(RE(in),RE(in)) + MUL_R(IM(in),IM(in));
+#endif
+
+ ps->peakdecay_fast[b] = MUL_F(ps->peakdecay_fast[b], peak_decay);
+ if (ps->peakdecay_fast[b] < power)
+ ps->peakdecay_fast[b] = power;
+
+ peakdiff = ps->prev_peakdiff[b];
+ peakdiff += MUL_F((ps->peakdecay_fast[b] - power - ps->prev_peakdiff[b]), smooth_coeff);
+ ps->prev_peakdiff[b] = peakdiff;
+
+ nrg = ps->prev_nrg[b];
+ nrg += MUL_F((power - ps->prev_nrg[b]), smooth_coeff);
+ ps->prev_nrg[b] = nrg;
+
+ if (MUL_R(peakdiff, gamma) <= nrg) {
+ transratio = sigma;
+ } else {
+ transratio = MUL_R(DIV_R(nrg, MUL_R(peakdiff, gamma)), sigma);
+ }
+
+ for (k = 0; k < NUM_OF_LINKS; k++)
+ {
+ new_delay_slopes[k] = MUL_F(g_decayslope[b], filter_coeff[k]);
+ }
+
+ RE(tmp0) = RE(ps->d_buff[0][b]);
+ IM(tmp0) = IM(ps->d_buff[0][b]);
+
+ RE(ps->d_buff[0][b]) = RE(ps->d_buff[1][b]);
+ IM(ps->d_buff[0][b]) = IM(ps->d_buff[1][b]);
+
+ RE(ps->d_buff[1][b]) = RE(in);
+ IM(ps->d_buff[1][b]) = IM(in);
+
+ ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract));
+
+ RE(R0) = RE(tmp);
+ IM(R0) = IM(tmp);
+
+ for (k = 0; k < NUM_OF_LINKS; k++)
+ {
+ RE(qfrac) = RE(Q_Fract_allpass_Qmf[b][k]);
+ IM(qfrac) = IM(Q_Fract_allpass_Qmf[b][k]);
+
+ RE(tmp0) = RE(ps->d2_buff[k][temp_delay_ser[k]][b]);
+ IM(tmp0) = IM(ps->d2_buff[k][temp_delay_ser[k]][b]);
+
+ ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(qfrac), IM(qfrac));
+
+ RE(tmp) += -MUL_F(new_delay_slopes[k], RE(R0));
+ IM(tmp) += -MUL_F(new_delay_slopes[k], IM(R0));
+
+ RE(ps->d2_buff[k][temp_delay_ser[k]][b]) = RE(R0) + MUL_F(new_delay_slopes[k], RE(tmp));
+ IM(ps->d2_buff[k][temp_delay_ser[k]][b]) = IM(R0) + MUL_F(new_delay_slopes[k], IM(tmp));
+
+ RE(R0) = RE(tmp);
+ IM(R0) = IM(tmp);
+ }
+
+ QMF_RE(ps->SA[s][b]) = MUL_R(RE(R0), transratio);
+ QMF_IM(ps->SA[s][b]) = MUL_R(IM(R0), transratio);
+
+ for (k = 0; k < NUM_OF_LINKS; k++)
+ {
+ if (++temp_delay_ser[k] >= delay_length[k])
+ temp_delay_ser[k] = 0;
+ }
+ }
+ }
+
+ for (k = 0; k < NUM_OF_LINKS; k++)
+ ps->delay_buf_index_ser[k] = temp_delay_ser[k];
+}
+
+static void drm_add_ambiance(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
+{
+ uint8_t s, b, ifreq, qclass;
+ real_t sa_map[MAX_SA_BAND], sa_dir_map[MAX_SA_BAND], k_sa_map[MAX_SA_BAND], k_sa_dir_map[MAX_SA_BAND];
+ real_t new_dir_map, new_sa_map;
+
+ if (ps->bs_enable_sa)
+ {
+ /* Instead of dequantization and mapping, we use an inverse mapping
+ to look up all the values we need */
+ for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
+ {
+ const real_t inv_f_num_of_subsamples = FRAC_CONST(0.03333333333);
+
+ ifreq = sa_inv_freq[b];
+ qclass = (b != 0);
+
+ sa_map[b] = sa_quant[ps->g_prev_sa_index[ifreq]][qclass];
+ new_sa_map = sa_quant[ps->g_sa_index[ifreq]][qclass];
+
+ k_sa_map[b] = MUL_F(inv_f_num_of_subsamples, (new_sa_map - sa_map[b]));
+
+ sa_dir_map[b] = sa_sqrt_1_minus[ps->g_prev_sa_index[ifreq]][qclass];
+ new_dir_map = sa_sqrt_1_minus[ps->g_sa_index[ifreq]][qclass];
+
+ k_sa_dir_map[b] = MUL_F(inv_f_num_of_subsamples, (new_dir_map - sa_dir_map[b]));
+
+ }
+
+ for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
+ {
+ for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
+ {
+ QMF_RE(X_right[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]);
+ QMF_IM(X_right[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]);
+ QMF_RE(X_left[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]);
+ QMF_IM(X_left[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]);
+
+ sa_map[b] += k_sa_map[b];
+ sa_dir_map[b] += k_sa_dir_map[b];
+ }
+ for (b = sa_freq_scale[DRM_NUM_SA_BANDS]; b < NUM_OF_QMF_CHANNELS; b++)
+ {
+ QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]);
+ QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]);
+ }
+ }
+ }
+ else {
+ for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
+ {
+ for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
+ {
+ QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]);
+ QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]);
+ }
+ }
+ }
+}
+
+static void drm_add_pan(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
+{
+ uint8_t s, b, qclass, ifreq;
+ real_t tmp, coeff1, coeff2;
+ real_t pan_base[MAX_PAN_BAND];
+ real_t pan_delta[MAX_PAN_BAND];
+ qmf_t temp_l, temp_r;
+
+ if (ps->bs_enable_pan)
+ {
+ for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
+ {
+ /* Instead of dequantization, 20->64 mapping and 2^G(x,y) we do an
+ inverse mapping 64->20 and look up the 2^G(x,y) values directly */
+ ifreq = pan_inv_freq[b];
+ qclass = pan_quant_class[ifreq];
+
+ if (ps->g_prev_pan_index[ifreq] >= 0)
+ {
+ pan_base[b] = pan_pow_2_pos[ps->g_prev_pan_index[ifreq]][qclass];
+ } else {
+ pan_base[b] = pan_pow_2_neg[-ps->g_prev_pan_index[ifreq]][qclass];
+ }
+
+ /* 2^((a-b)/30) = 2^(a/30) * 1/(2^(b/30)) */
+ /* a en b can be negative so we may need to inverse parts */
+ if (ps->g_pan_index[ifreq] >= 0)
+ {
+ if (ps->g_prev_pan_index[ifreq] >= 0)
+ {
+ pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass],
+ pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]);
+ } else {
+ pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass],
+ pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]);
+ }
+ } else {
+ if (ps->g_prev_pan_index[ifreq] >= 0)
+ {
+ pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass],
+ pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]);
+ } else {
+ pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass],
+ pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]);
+ }
+ }
+ }
+
+ for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
+ {
+ /* PAN always uses all 64 channels */
+ for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
+ {
+ tmp = pan_base[b];
+
+ coeff2 = DIV_R(REAL_CONST(2.0), (REAL_CONST(1.0) + tmp));
+ coeff1 = MUL_R(coeff2, tmp);
+
+ QMF_RE(temp_l) = QMF_RE(X_left[s][b]);
+ QMF_IM(temp_l) = QMF_IM(X_left[s][b]);
+ QMF_RE(temp_r) = QMF_RE(X_right[s][b]);
+ QMF_IM(temp_r) = QMF_IM(X_right[s][b]);
+
+ QMF_RE(X_left[s][b]) = MUL_R(QMF_RE(temp_l), coeff1);
+ QMF_IM(X_left[s][b]) = MUL_R(QMF_IM(temp_l), coeff1);
+ QMF_RE(X_right[s][b]) = MUL_R(QMF_RE(temp_r), coeff2);
+ QMF_IM(X_right[s][b]) = MUL_R(QMF_IM(temp_r), coeff2);
+
+ /* 2^(a+k*b) = 2^a * 2^b * ... * 2^b */
+ /* ^^^^^^^^^^^^^^^ k times */
+ pan_base[b] = MUL_C(pan_base[b], pan_delta[b]);
+ }
+ }
+ }
+}
+
+drm_ps_info *drm_ps_init(void)
+{
+ drm_ps_info *ps = (drm_ps_info*)faad_malloc(sizeof(drm_ps_info));
+
+ memset(ps, 0, sizeof(drm_ps_info));
+
+ return ps;
+}
+
+void drm_ps_free(drm_ps_info *ps)
+{
+ faad_free(ps);
+}
+
+/* main DRM PS decoding function */
+uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64])
+{
+ if (ps == NULL)
+ {
+ memcpy(X_right, X_left, sizeof(qmf_t)*30*64);
+ return 0;
+ }
+
+ if (!ps->drm_ps_data_available && !guess)
+ {
+ memcpy(X_right, X_left, sizeof(qmf_t)*30*64);
+ memset(ps->g_prev_sa_index, 0, sizeof(ps->g_prev_sa_index));
+ memset(ps->g_prev_pan_index, 0, sizeof(ps->g_prev_pan_index));
+ return 0;
+ }
+
+ /* if SBR CRC doesn't match out, we can assume decode errors to start with,
+ and we'll guess what the parameters should be */
+ if (!guess)
+ {
+ ps->sa_decode_error = 0;
+ ps->pan_decode_error = 0;
+ drm_ps_delta_decode(ps);
+ } else
+ {
+ ps->sa_decode_error = 1;
+ ps->pan_decode_error = 1;
+ /* don't even bother decoding */
+ }
+
+ ps->drm_ps_data_available = 0;
+
+ drm_calc_sa_side_signal(ps, X_left);
+ drm_add_ambiance(ps, X_left, X_right);
+
+ if (ps->bs_enable_sa)
+ {
+ ps->g_last_had_sa = 1;
+
+ memcpy(ps->g_prev_sa_index, ps->g_sa_index, sizeof(int8_t) * DRM_NUM_SA_BANDS);
+
+ } else {
+ ps->g_last_had_sa = 0;
+ }
+
+ if (ps->bs_enable_pan)
+ {
+ drm_add_pan(ps, X_left, X_right);
+
+ ps->g_last_had_pan = 1;
+
+ memcpy(ps->g_prev_pan_index, ps->g_pan_index, sizeof(int8_t) * DRM_NUM_PAN_BANDS);
+
+ } else {
+ ps->g_last_had_pan = 0;
+ }
+
+
+ return 0;
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/drm_dec.h b/src/filters/transform/mpadecfilter/faad2/libfaad/drm_dec.h
new file mode 100644
index 000000000..ecd7799c8
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/drm_dec.h
@@ -0,0 +1,102 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: drm_dec.h 446 2005-11-06 10:54:47Z gabest $
+**/
+
+#ifndef __DRM_DEC_H__
+#define __DRM_DEC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "bits.h"
+
+#define DRM_PARAMETRIC_STEREO 0
+#define DRM_NUM_SA_BANDS 8
+#define DRM_NUM_PAN_BANDS 20
+#define NUM_OF_LINKS 3
+#define NUM_OF_QMF_CHANNELS 64
+#define NUM_OF_SUBSAMPLES 30
+#define MAX_SA_BAND 46
+#define MAX_PAN_BAND 64
+#define MAX_DELAY 5
+
+typedef struct
+{
+ uint8_t drm_ps_data_available;
+ uint8_t bs_enable_sa;
+ uint8_t bs_enable_pan;
+
+ uint8_t bs_sa_dt_flag;
+ uint8_t bs_pan_dt_flag;
+
+ uint8_t g_last_had_sa;
+ uint8_t g_last_had_pan;
+
+ int8_t bs_sa_data[DRM_NUM_SA_BANDS];
+ int8_t bs_pan_data[DRM_NUM_PAN_BANDS];
+
+ int8_t g_sa_index[DRM_NUM_SA_BANDS];
+ int8_t g_pan_index[DRM_NUM_PAN_BANDS];
+ int8_t g_prev_sa_index[DRM_NUM_SA_BANDS];
+ int8_t g_prev_pan_index[DRM_NUM_PAN_BANDS];
+
+ int8_t sa_decode_error;
+ int8_t pan_decode_error;
+
+ int8_t g_last_good_sa_index[DRM_NUM_SA_BANDS];
+ int8_t g_last_good_pan_index[DRM_NUM_PAN_BANDS];
+
+ qmf_t SA[NUM_OF_SUBSAMPLES][MAX_SA_BAND];
+
+ complex_t d_buff[2][MAX_SA_BAND];
+ complex_t d2_buff[NUM_OF_LINKS][MAX_DELAY][MAX_SA_BAND];
+
+ uint8_t delay_buf_index_ser[NUM_OF_LINKS];
+
+ real_t prev_nrg[MAX_SA_BAND];
+ real_t prev_peakdiff[MAX_SA_BAND];
+ real_t peakdecay_fast[MAX_SA_BAND];
+} drm_ps_info;
+
+
+uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld);
+
+drm_ps_info *drm_ps_init(void);
+void drm_ps_free(drm_ps_info *ps);
+
+uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64]);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/error.c b/src/filters/transform/mpadecfilter/faad2/libfaad/error.c
new file mode 100644
index 000000000..5eb00580a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/error.c
@@ -0,0 +1,71 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: error.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "error.h"
+
+char *err_msg[] = {
+ "No error",
+ "Gain control not yet implemented",
+ "Pulse coding not allowed in short blocks",
+ "Invalid huffman codebook",
+ "Scalefactor out of range",
+ "Unable to find ADTS syncword",
+ "Channel coupling not yet implemented",
+ "Channel configuration not allowed in error resilient frame",
+ "Bit error in error resilient scalefactor decoding",
+ "Error decoding huffman scalefactor (bitstream error)",
+ "Error decoding huffman codeword (bitstream error)",
+ "Non existent huffman codebook number found",
+ "Invalid number of channels",
+ "Maximum number of bitstream elements exceeded",
+ "Input data buffer too small",
+ "Array index out of range",
+ "Maximum number of scalefactor bands exceeded",
+ "Quantised value out of range",
+ "LTP lag out of range",
+ "Invalid SBR parameter decoded",
+ "SBR called without being initialised",
+ "Unexpected channel configuration change",
+ "Error in program_config_element",
+ "First SBR frame is not the same as first AAC frame",
+ "Unexpected fill element with SBR data",
+ "Not all elements were provided with SBR data",
+ "LTP decoding not available",
+ "Output data buffer too small",
+ "CRC error in DRM data",
+ "PNS not allowed in DRM data stream",
+ "No standard extension payload allowed in DRM",
+ "PCE shall be the first element in a frame",
+ "Bitstream value not allowed by specification"
+};
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/error.h b/src/filters/transform/mpadecfilter/faad2/libfaad/error.h
new file mode 100644
index 000000000..c6bd9f97f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/error.h
@@ -0,0 +1,46 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: error.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __ERROR_H__
+#define __ERROR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define NUM_ERROR_MESSAGES 33
+extern char *err_msg[];
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/filtbank.c b/src/filters/transform/mpadecfilter/faad2/libfaad/filtbank.c
new file mode 100644
index 000000000..9d61651a7
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/filtbank.c
@@ -0,0 +1,409 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: filtbank.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+#ifdef _WIN32_WCE
+#define assert(x)
+#else
+#include <assert.h>
+#endif
+
+#include "filtbank.h"
+#include "decoder.h"
+#include "syntax.h"
+#include "kbd_win.h"
+#include "sine_win.h"
+#include "mdct.h"
+
+
+fb_info *filter_bank_init(uint16_t frame_len)
+{
+ uint16_t nshort = frame_len/8;
+#ifdef LD_DEC
+ uint16_t frame_len_ld = frame_len/2;
+#endif
+
+ fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
+ memset(fb, 0, sizeof(fb_info));
+
+ /* normal */
+ fb->mdct256 = faad_mdct_init(2*nshort);
+ fb->mdct2048 = faad_mdct_init(2*frame_len);
+#ifdef LD_DEC
+ /* LD */
+ fb->mdct1024 = faad_mdct_init(2*frame_len_ld);
+#endif
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ if (frame_len == 1024)
+ {
+#endif
+ fb->long_window[0] = sine_long_1024;
+ fb->short_window[0] = sine_short_128;
+ fb->long_window[1] = kbd_long_1024;
+ fb->short_window[1] = kbd_short_128;
+#ifdef LD_DEC
+ fb->ld_window[0] = sine_mid_512;
+ fb->ld_window[1] = ld_mid_512;
+#endif
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ } else /* (frame_len == 960) */ {
+ fb->long_window[0] = sine_long_960;
+ fb->short_window[0] = sine_short_120;
+ fb->long_window[1] = kbd_long_960;
+ fb->short_window[1] = kbd_short_120;
+#ifdef LD_DEC
+ fb->ld_window[0] = sine_mid_480;
+ fb->ld_window[1] = ld_mid_480;
+#endif
+ }
+#endif
+
+ return fb;
+}
+
+void filter_bank_end(fb_info *fb)
+{
+ if (fb != NULL)
+ {
+#ifdef PROFILE
+ printf("FB: %I64d cycles\n", fb->cycles);
+#endif
+
+ faad_mdct_end(fb->mdct256);
+ faad_mdct_end(fb->mdct2048);
+#ifdef LD_DEC
+ faad_mdct_end(fb->mdct1024);
+#endif
+
+ faad_free(fb);
+ }
+}
+
+static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
+{
+#ifdef LD_DEC
+ mdct_info *mdct = NULL;
+
+ switch (len)
+ {
+ case 2048:
+ case 1920:
+ mdct = fb->mdct2048;
+ break;
+ case 1024:
+ case 960:
+ mdct = fb->mdct1024;
+ break;
+ }
+
+ faad_imdct(mdct, in_data, out_data);
+#else
+ faad_imdct(fb->mdct2048, in_data, out_data);
+#endif
+}
+
+
+#ifdef LTP_DEC
+static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
+{
+ mdct_info *mdct = NULL;
+
+ switch (len)
+ {
+ case 2048:
+ case 1920:
+ mdct = fb->mdct2048;
+ break;
+ case 256:
+ case 240:
+ mdct = fb->mdct256;
+ break;
+#ifdef LD_DEC
+ case 1024:
+ case 960:
+ mdct = fb->mdct1024;
+ break;
+#endif
+ }
+
+ faad_mdct(mdct, in_data, out_data);
+}
+#endif
+
+void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
+ uint8_t window_shape_prev, real_t *freq_in,
+ real_t *time_out, real_t *overlap,
+ uint8_t object_type, uint16_t frame_len)
+{
+ int16_t i;
+ ALIGN real_t transf_buf[2*1024] = {0};
+
+ const real_t *window_long = NULL;
+ const real_t *window_long_prev = NULL;
+ const real_t *window_short = NULL;
+ const real_t *window_short_prev = NULL;
+
+ uint16_t nlong = frame_len;
+ uint16_t nshort = frame_len/8;
+ uint16_t trans = nshort/2;
+
+ uint16_t nflat_ls = (nlong-nshort)/2;
+
+#ifdef PROFILE
+ int64_t count = faad_get_ts();
+#endif
+
+ /* select windows of current frame and previous frame (Sine or KBD) */
+#ifdef LD_DEC
+ if (object_type == LD)
+ {
+ window_long = fb->ld_window[window_shape];
+ window_long_prev = fb->ld_window[window_shape_prev];
+ } else {
+#endif
+ window_long = fb->long_window[window_shape];
+ window_long_prev = fb->long_window[window_shape_prev];
+ window_short = fb->short_window[window_shape];
+ window_short_prev = fb->short_window[window_shape_prev];
+#ifdef LD_DEC
+ }
+#endif
+
+#if 0
+ for (i = 0; i < 1024; i++)
+ {
+ printf("%d\n", freq_in[i]);
+ }
+#endif
+
+#if 0
+ printf("%d %d\n", window_sequence, window_shape);
+#endif
+
+ switch (window_sequence)
+ {
+ case ONLY_LONG_SEQUENCE:
+ /* perform iMDCT */
+ imdct_long(fb, freq_in, transf_buf, 2*nlong);
+
+ /* add second half output of previous frame to windowed output of current frame */
+ for (i = 0; i < nlong; i+=4)
+ {
+ time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
+ time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+ time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+ time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
+ }
+
+ /* window the second half and save as overlap for next frame */
+ for (i = 0; i < nlong; i+=4)
+ {
+ overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
+ overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]);
+ overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]);
+ overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]);
+ }
+ break;
+
+ case LONG_START_SEQUENCE:
+ /* perform iMDCT */
+ imdct_long(fb, freq_in, transf_buf, 2*nlong);
+
+ /* add second half output of previous frame to windowed output of current frame */
+ for (i = 0; i < nlong; i+=4)
+ {
+ time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
+ time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
+ time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
+ time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
+ }
+
+ /* window the second half and save as overlap for next frame */
+ /* construct second half window using padding with 1's and 0's */
+ for (i = 0; i < nflat_ls; i++)
+ overlap[i] = transf_buf[nlong+i];
+ for (i = 0; i < nshort; i++)
+ overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
+ for (i = 0; i < nflat_ls; i++)
+ overlap[nflat_ls+nshort+i] = 0;
+ break;
+
+ case EIGHT_SHORT_SEQUENCE:
+ /* perform iMDCT for each short block */
+ faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0);
+ faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1);
+ faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2);
+ faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3);
+ faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4);
+ faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5);
+ faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6);
+ faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7);
+
+ /* add second half output of previous frame to windowed output of current frame */
+ for (i = 0; i < nflat_ls; i++)
+ time_out[i] = overlap[i];
+ for(i = 0; i < nshort; i++)
+ {
+ time_out[nflat_ls+ i] = overlap[nflat_ls+ i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]);
+ time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]);
+ time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]);
+ time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]);
+ if (i < trans)
+ time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
+ }
+
+ /* window the second half and save as overlap for next frame */
+ for(i = 0; i < nshort; i++)
+ {
+ if (i >= trans)
+ overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
+ overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]);
+ overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]);
+ overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]);
+ overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]);
+ }
+ for (i = 0; i < nflat_ls; i++)
+ overlap[nflat_ls+nshort+i] = 0;
+ break;
+
+ case LONG_STOP_SEQUENCE:
+ /* perform iMDCT */
+ imdct_long(fb, freq_in, transf_buf, 2*nlong);
+
+ /* add second half output of previous frame to windowed output of current frame */
+ /* construct first half window using padding with 1's and 0's */
+ for (i = 0; i < nflat_ls; i++)
+ time_out[i] = overlap[i];
+ for (i = 0; i < nshort; i++)
+ time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]);
+ for (i = 0; i < nflat_ls; i++)
+ time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
+
+ /* window the second half and save as overlap for next frame */
+ for (i = 0; i < nlong; i++)
+ overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
+ break;
+ }
+
+#if 0
+ for (i = 0; i < 1024; i++)
+ {
+ printf("%d\n", time_out[i]);
+ //printf("0x%.8X\n", time_out[i]);
+ }
+#endif
+
+
+#ifdef PROFILE
+ count = faad_get_ts() - count;
+ fb->cycles += count;
+#endif
+}
+
+
+#ifdef LTP_DEC
+/* only works for LTP -> no overlapping, no short blocks */
+void filter_bank_ltp(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
+ uint8_t window_shape_prev, real_t *in_data, real_t *out_mdct,
+ uint8_t object_type, uint16_t frame_len)
+{
+ int16_t i;
+ ALIGN real_t windowed_buf[2*1024] = {0};
+
+ const real_t *window_long = NULL;
+ const real_t *window_long_prev = NULL;
+ const real_t *window_short = NULL;
+ const real_t *window_short_prev = NULL;
+
+ uint16_t nlong = frame_len;
+ uint16_t nshort = frame_len/8;
+ uint16_t nflat_ls = (nlong-nshort)/2;
+
+ assert(window_sequence != EIGHT_SHORT_SEQUENCE);
+
+#ifdef LD_DEC
+ if (object_type == LD)
+ {
+ window_long = fb->ld_window[window_shape];
+ window_long_prev = fb->ld_window[window_shape_prev];
+ } else {
+#endif
+ window_long = fb->long_window[window_shape];
+ window_long_prev = fb->long_window[window_shape_prev];
+ window_short = fb->short_window[window_shape];
+ window_short_prev = fb->short_window[window_shape_prev];
+#ifdef LD_DEC
+ }
+#endif
+
+ switch(window_sequence)
+ {
+ case ONLY_LONG_SEQUENCE:
+ for (i = nlong-1; i >= 0; i--)
+ {
+ windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
+ windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
+ }
+ mdct(fb, windowed_buf, out_mdct, 2*nlong);
+ break;
+
+ case LONG_START_SEQUENCE:
+ for (i = 0; i < nlong; i++)
+ windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
+ for (i = 0; i < nflat_ls; i++)
+ windowed_buf[i+nlong] = in_data[i+nlong];
+ for (i = 0; i < nshort; i++)
+ windowed_buf[i+nlong+nflat_ls] = MUL_F(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]);
+ for (i = 0; i < nflat_ls; i++)
+ windowed_buf[i+nlong+nflat_ls+nshort] = 0;
+ mdct(fb, windowed_buf, out_mdct, 2*nlong);
+ break;
+
+ case LONG_STOP_SEQUENCE:
+ for (i = 0; i < nflat_ls; i++)
+ windowed_buf[i] = 0;
+ for (i = 0; i < nshort; i++)
+ windowed_buf[i+nflat_ls] = MUL_F(in_data[i+nflat_ls], window_short_prev[i]);
+ for (i = 0; i < nflat_ls; i++)
+ windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort];
+ for (i = 0; i < nlong; i++)
+ windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
+ mdct(fb, windowed_buf, out_mdct, 2*nlong);
+ break;
+ }
+}
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/filtbank.h b/src/filters/transform/mpadecfilter/faad2/libfaad/filtbank.h
new file mode 100644
index 000000000..935164c99
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/filtbank.h
@@ -0,0 +1,63 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: filtbank.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __FILTBANK_H__
+#define __FILTBANK_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+fb_info *filter_bank_init(uint16_t frame_len);
+void filter_bank_end(fb_info *fb);
+
+#ifdef LTP_DEC
+void filter_bank_ltp(fb_info *fb,
+ uint8_t window_sequence,
+ uint8_t window_shape,
+ uint8_t window_shape_prev,
+ real_t *in_data,
+ real_t *out_mdct,
+ uint8_t object_type,
+ uint16_t frame_len);
+#endif
+
+void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
+ uint8_t window_shape_prev, real_t *freq_in,
+ real_t *time_out, real_t *overlap,
+ uint8_t object_type, uint16_t frame_len);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/fixed.h b/src/filters/transform/mpadecfilter/faad2/libfaad/fixed.h
new file mode 100644
index 000000000..de444baa6
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/fixed.h
@@ -0,0 +1,271 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: fixed.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __FIXED_H__
+#define __FIXED_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(_WIN32_WCE) && defined(_ARM_)
+#include <cmnintrin.h>
+#endif
+
+
+#define COEF_BITS 28
+#define COEF_PRECISION (1 << COEF_BITS)
+#define REAL_BITS 14 // MAXIMUM OF 14 FOR FIXED POINT SBR
+#define REAL_PRECISION (1 << REAL_BITS)
+
+/* FRAC is the fractional only part of the fixed point number [0.0..1.0) */
+#define FRAC_SIZE 32 /* frac is a 32 bit integer */
+#define FRAC_BITS 31
+#define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS))
+#define FRAC_MAX 0x7FFFFFFF
+
+typedef int32_t real_t;
+
+
+#define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5)))
+#define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5)))
+#define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))))
+//#define FRAC_CONST(A) (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5)))
+
+#define Q2_BITS 22
+#define Q2_PRECISION (1 << Q2_BITS)
+#define Q2_CONST(A) (((A) >= 0) ? ((real_t)((A)*(Q2_PRECISION)+0.5)) : ((real_t)((A)*(Q2_PRECISION)-0.5)))
+
+#if defined(_WIN32) && !defined(_WIN32_WCE)
+
+/* multiply with real shift */
+static INLINE real_t MUL_R(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,REAL_BITS
+ }
+}
+
+/* multiply with coef shift */
+static INLINE real_t MUL_C(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,COEF_BITS
+ }
+}
+
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,Q2_BITS
+ }
+}
+
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,6
+ }
+}
+
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,23
+ }
+}
+
+#if 1
+static INLINE real_t _MulHigh(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ mov eax,edx
+ }
+}
+
+/* multiply with fractional shift */
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+ return _MulHigh(A,B) << (FRAC_SIZE-FRAC_BITS);
+}
+
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+{
+ *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
+ *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
+}
+#else
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+ _asm {
+ mov eax,A
+ imul B
+ shrd eax,edx,FRAC_BITS
+ }
+}
+
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+{
+ *y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
+ *y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
+}
+#endif
+
+#elif defined(__GNUC__) && defined (__arm__)
+
+/* taken from MAD */
+#define arm_mul(x, y, SCALEBITS) \
+({ \
+ uint32_t __hi; \
+ uint32_t __lo; \
+ uint32_t __result; \
+ asm("smull %0, %1, %3, %4\n\t" \
+ "movs %0, %0, lsr %5\n\t" \
+ "adc %2, %0, %1, lsl %6" \
+ : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
+ : "%r" (x), "r" (y), \
+ "M" (SCALEBITS), "M" (32 - (SCALEBITS)) \
+ : "cc"); \
+ __result; \
+})
+
+static INLINE real_t MUL_R(real_t A, real_t B)
+{
+ return arm_mul(A, B, REAL_BITS);
+}
+
+static INLINE real_t MUL_C(real_t A, real_t B)
+{
+ return arm_mul(A, B, COEF_BITS);
+}
+
+static INLINE real_t MUL_Q2(real_t A, real_t B)
+{
+ return arm_mul(A, B, Q2_BITS);
+}
+
+static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
+{
+ return arm_mul(A, B, 6);
+}
+
+static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
+{
+ return arm_mul(A, B, 23);
+}
+
+static INLINE real_t _MulHigh(real_t x, real_t y)
+{
+ uint32_t __lo;
+ uint32_t __hi;
+ asm("smull\t%0, %1, %2, %3"
+ : "=&r"(__lo),"=&r"(__hi)
+ : "%r"(x),"r"(y)
+ : "cc");
+ return __hi;
+}
+
+static INLINE real_t MUL_F(real_t A, real_t B)
+{
+ return _MulHigh(A, B) << (FRAC_SIZE-FRAC_BITS);
+}
+
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+{
+ int32_t tmp, yt1, yt2;
+ asm("smull %0, %1, %4, %6\n\t"
+ "smlal %0, %1, %5, %7\n\t"
+ "rsb %3, %4, #0\n\t"
+ "smull %0, %2, %5, %6\n\t"
+ "smlal %0, %2, %3, %7"
+ : "=&r" (tmp), "=&r" (yt1), "=&r" (yt2), "=r" (x1)
+ : "3" (x1), "r" (x2), "r" (c1), "r" (c2)
+ : "cc" );
+ *y1 = yt1 << (FRAC_SIZE-FRAC_BITS);
+ *y2 = yt2 << (FRAC_SIZE-FRAC_BITS);
+}
+
+#else
+
+ /* multiply with real shift */
+ #define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS)
+ /* multiply with coef shift */
+ #define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
+ /* multiply with fractional shift */
+#if defined(_WIN32_WCE) && defined(_ARM_)
+ /* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */
+ static INLINE real_t MUL_F(real_t A, real_t B)
+ {
+ return _MulHigh(A,B) << (32-FRAC_BITS);
+ }
+#else
+ #define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
+ #define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
+#endif
+ #define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
+ #define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
+ #define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
+
+/* Complex multiplication */
+static INLINE void ComplexMult(real_t *y1, real_t *y2,
+ real_t x1, real_t x2, real_t c1, real_t c2)
+{
+ *y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
+ *y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
+}
+
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/hcr.c b/src/filters/transform/mpadecfilter/faad2/libfaad/hcr.c
new file mode 100644
index 000000000..3a86e9100
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/hcr.c
@@ -0,0 +1,431 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: hcr.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "specrec.h"
+#include "huffman.h"
+
+/* ISO/IEC 14496-3/Amd.1
+ * 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR)
+ *
+ * HCR devides the spectral data in known fixed size segments, and
+ * sorts it by the importance of the data. The importance is firstly
+ * the (lower) position in the spectrum, and secondly the largest
+ * value in the used codebook.
+ * The most important data is written at the start of each segment
+ * (at known positions), the remaining data is interleaved inbetween,
+ * with the writing direction alternating.
+ * Data length is not increased.
+*/
+
+#ifdef ERROR_RESILIENCE
+
+/* 8.5.3.3.1 Pre-sorting */
+
+#define NUM_CB 6
+#define NUM_CB_ER 22
+#define MAX_CB 32
+#define VCB11_FIRST 16
+#define VCB11_LAST 31
+
+static const uint8_t PreSortCB_STD[NUM_CB] =
+ { 11, 9, 7, 5, 3, 1};
+
+static const uint8_t PreSortCB_ER[NUM_CB_ER] =
+ { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
+
+/* 8.5.3.3.2 Derivation of segment width */
+
+static const uint8_t maxCwLen[MAX_CB] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
+ 0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
+
+#define segmentWidth(cb) min(maxCwLen[cb], ics->length_of_longest_codeword)
+
+/* bit-twiddling helpers */
+static const uint8_t S[] = {1, 2, 4, 8, 16};
+static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF};
+
+typedef struct
+{
+ uint8_t cb;
+ uint8_t decoded;
+ uint16_t sp_offset;
+ bits_t bits;
+} codeword_t;
+
+/* rewind and reverse */
+/* 32 bit version */
+static uint32_t rewrev_word(uint32_t v, const uint8_t len)
+{
+ /* 32 bit reverse */
+ v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
+ v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
+ v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
+ v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
+ v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
+
+ /* shift off low bits */
+ v >>= (32 - len);
+
+ return v;
+}
+
+/* 64 bit version */
+static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len)
+{
+ if (len <= 32) {
+ *hi = 0;
+ *lo = rewrev_word(*lo, len);
+ } else
+ {
+ uint32_t t = *hi, v = *lo;
+
+ /* double 32 bit reverse */
+ v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
+ t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]);
+ v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
+ t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]);
+ v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
+ t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]);
+ v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
+ t = ((t >> S[3]) & B[3]) | ((t << S[3]) & ~B[3]);
+ v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
+ t = ((t >> S[4]) & B[4]) | ((t << S[4]) & ~B[4]);
+
+ /* last 32<>32 bit swap is implicit below */
+
+ /* shift off low bits (this is really only one 64 bit shift) */
+ *lo = (t >> (64 - len)) | (v << (len - 32));
+ *hi = v >> (64 - len);
+ }
+}
+
+
+/* bits_t version */
+static void rewrev_bits(bits_t *bits)
+{
+ if (bits->len == 0) return;
+ rewrev_lword(&bits->bufb, &bits->bufa, bits->len);
+}
+
+
+/* merge bits of a to b */
+static void concat_bits(bits_t *b, bits_t *a)
+{
+ uint32_t bl, bh, al, ah;
+
+ if (a->len == 0) return;
+
+ al = a->bufa;
+ ah = a->bufb;
+
+ if (b->len > 32)
+ {
+ /* maskoff superfluous high b bits */
+ bl = b->bufa;
+ bh = b->bufb & ((1 << (b->len-32)) - 1);
+ /* left shift a b->len bits */
+ ah = al << (b->len - 32);
+ al = 0;
+ } else {
+ bl = b->bufa & ((1 << (b->len)) - 1);
+ bh = 0;
+ ah = (ah << (b->len)) | (al >> (32 - b->len));
+ al = al << b->len;
+ }
+
+ /* merge */
+ b->bufa = bl | al;
+ b->bufb = bh | ah;
+
+ b->len += a->len;
+}
+
+uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB)
+{
+ /* only want spectral data CB's */
+ if ((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST))
+ {
+ if (this_CB < ESC_HCB)
+ {
+ /* normal codebook pairs */
+ return ((this_sec_CB == this_CB) || (this_sec_CB == this_CB + 1));
+ } else
+ {
+ /* escape codebook */
+ return (this_sec_CB == this_CB);
+ }
+ }
+ return 0;
+}
+
+void read_segment(bits_t *segment, uint8_t segwidth, bitfile *ld)
+{
+ segment->len = segwidth;
+
+ if (segwidth > 32)
+ {
+ segment->bufb = faad_getbits(ld, segwidth - 32);
+ segment->bufa = faad_getbits(ld, 32);
+
+ } else {
+ segment->bufa = faad_getbits(ld, segwidth);
+ segment->bufb = 0;
+ }
+}
+
+void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp, uint8_t cb)
+{
+ codeword[index].sp_offset = sp;
+ codeword[index].cb = cb;
+ codeword[index].decoded = 0;
+ codeword[index].bits.len = 0;
+}
+
+uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics,
+ bitfile *ld, int16_t *spectral_data)
+{
+ uint16_t PCWs_done;
+ uint16_t numberOfSegments, numberOfSets, numberOfCodewords;
+
+ codeword_t codeword[512];
+ bits_t segment[512];
+
+ uint16_t sp_offset[8];
+ uint16_t g, i, sortloop, set, bitsread;
+ uint16_t bitsleft, codewordsleft;
+ uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB;
+
+ const uint16_t nshort = hDecoder->frameLength/8;
+ const uint16_t sp_data_len = ics->length_of_reordered_spectral_data;
+
+ const uint8_t *PreSortCb;
+
+ /* no data (e.g. silence) */
+ if (sp_data_len == 0)
+ return 0;
+
+ /* since there is spectral data, at least one codeword has nonzero length */
+ if (ics->length_of_longest_codeword == 0)
+ return 10;
+
+ if (sp_data_len < ics->length_of_longest_codeword)
+ return 10;
+
+ sp_offset[0] = 0;
+ for (g = 1; g < ics->num_window_groups; g++)
+ {
+ sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1];
+ }
+
+ PCWs_done = 0;
+ numberOfSegments = 0;
+ numberOfCodewords = 0;
+ bitsread = 0;
+
+ /* VCB11 code books in use */
+ if (hDecoder->aacSectionDataResilienceFlag)
+ {
+ PreSortCb = PreSortCB_ER;
+ last_CB = NUM_CB_ER;
+ } else
+ {
+ PreSortCb = PreSortCB_STD;
+ last_CB = NUM_CB;
+ }
+
+ /* step 1: decode PCW's (set 0), and stuff data in easier-to-use format */
+ for (sortloop = 0; sortloop < last_CB; sortloop++)
+ {
+ /* select codebook to process this pass */
+ this_CB = PreSortCb[sortloop];
+
+ /* loop over sfbs */
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
+ {
+ /* loop over all in this sfb, 4 lines per loop */
+ for (w_idx = 0; 4*w_idx < (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w_idx++)
+ {
+ for(g = 0; g < ics->num_window_groups; g++)
+ {
+ for (i = 0; i < ics->num_sec[g]; i++)
+ {
+ /* check whether sfb used here is the one we want to process */
+ if ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
+ {
+ /* check whether codebook used here is the one we want to process */
+ this_sec_CB = ics->sect_cb[g][i];
+
+ if (is_good_cb(this_CB, this_sec_CB))
+ {
+ /* precalculate some stuff */
+ uint16_t sect_sfb_size = ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb];
+ uint8_t inc = (this_sec_CB < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN;
+ uint16_t group_cws_count = (4*ics->window_group_length[g])/inc;
+ uint8_t segwidth = segmentWidth(this_sec_CB);
+ uint16_t cws;
+
+ /* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */
+ for (cws = 0; (cws < group_cws_count) && ((cws + w_idx*group_cws_count) < sect_sfb_size); cws++)
+ {
+ uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx*group_cws_count);
+
+ /* read and decode PCW */
+ if (!PCWs_done)
+ {
+ /* read in normal segments */
+ if (bitsread + segwidth <= sp_data_len)
+ {
+ read_segment(&segment[numberOfSegments], segwidth, ld);
+ bitsread += segwidth;
+
+ huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]);
+
+ /* keep leftover bits */
+ rewrev_bits(&segment[numberOfSegments]);
+
+ numberOfSegments++;
+ } else {
+ /* remaining stuff after last segment, we unfortunately couldn't read
+ this in earlier because it might not fit in 64 bits. since we already
+ decoded (and removed) the PCW it is now guaranteed to fit */
+ if (bitsread < sp_data_len)
+ {
+ const uint8_t additional_bits = sp_data_len - bitsread;
+
+ read_segment(&segment[numberOfSegments], additional_bits, ld);
+ segment[numberOfSegments].len += segment[numberOfSegments-1].len;
+ rewrev_bits(&segment[numberOfSegments]);
+
+ if (segment[numberOfSegments-1].len > 32)
+ {
+ segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb +
+ showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32);
+ segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
+ showbits_hcr(&segment[numberOfSegments-1], 32);
+ } else {
+ segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
+ showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len);
+ segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb;
+ }
+ segment[numberOfSegments-1].len += additional_bits;
+ }
+ bitsread = sp_data_len;
+ PCWs_done = 1;
+
+ fill_in_codeword(codeword, 0, sp, this_sec_CB);
+ }
+ } else {
+ fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB);
+ }
+ numberOfCodewords++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (numberOfSegments == 0)
+ return 10;
+
+ numberOfSets = numberOfCodewords / numberOfSegments;
+
+ /* step 2: decode nonPCWs */
+ for (set = 1; set <= numberOfSets; set++)
+ {
+ uint16_t trial;
+
+ for (trial = 0; trial < numberOfSegments; trial++)
+ {
+ uint16_t codewordBase;
+
+ for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++)
+ {
+ const uint16_t segment_idx = (trial + codewordBase) % numberOfSegments;
+ const uint16_t codeword_idx = codewordBase + set*numberOfSegments - numberOfSegments;
+
+ /* data up */
+ if (codeword_idx >= numberOfCodewords - numberOfSegments) break;
+
+ if (!codeword[codeword_idx].decoded && segment[segment_idx].len > 0)
+ {
+ uint8_t tmplen;
+
+ if (codeword[codeword_idx].bits.len != 0)
+ concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits);
+
+ tmplen = segment[segment_idx].len;
+
+ if (huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx],
+ &spectral_data[codeword[codeword_idx].sp_offset]) >= 0)
+ {
+ codeword[codeword_idx].decoded = 1;
+ } else
+ {
+ codeword[codeword_idx].bits = segment[segment_idx];
+ codeword[codeword_idx].bits.len = tmplen;
+ }
+
+ }
+ }
+ }
+ for (i = 0; i < numberOfSegments; i++)
+ rewrev_bits(&segment[i]);
+ }
+
+ bitsleft = 0;
+
+ for (i = 0; i < numberOfSegments && !bitsleft; i++)
+ bitsleft += segment[i].len;
+
+ if (bitsleft) return 10;
+
+ codewordsleft = 0;
+
+ for (i = 0; (i < numberOfCodewords - numberOfSegments) && (!codewordsleft); i++)
+ if (!codeword[i].decoded)
+ codewordsleft++;
+
+ if (codewordsleft) return 10;
+
+ return 0;
+
+}
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/huffman.c b/src/filters/transform/mpadecfilter/faad2/libfaad/huffman.c
new file mode 100644
index 000000000..6a6886f41
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/huffman.c
@@ -0,0 +1,561 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: huffman.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#ifdef ANALYSIS
+#include <stdio.h>
+#endif
+
+#include "bits.h"
+#include "huffman.h"
+#include "codebook/hcb.h"
+
+
+/* static function declarations */
+static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len);
+static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp);
+static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp);
+static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
+static int16_t huffman_codebook(uint8_t i);
+static void vcb11_check_LAV(uint8_t cb, int16_t *sp);
+
+int8_t huffman_scale_factor(bitfile *ld)
+{
+ uint16_t offset = 0;
+
+ while (hcb_sf[offset][1])
+ {
+ uint8_t b = faad_get1bit(ld
+ DEBUGVAR(1,255,"huffman_scale_factor()"));
+ offset += hcb_sf[offset][b];
+
+ if (offset > 240)
+ {
+ /* printf("ERROR: offset into hcb_sf = %d >240!\n", offset); */
+ return -1;
+ }
+ }
+
+ return hcb_sf[offset][0];
+}
+
+
+hcb *hcb_table[] = {
+ 0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1
+};
+
+hcb_2_quad *hcb_2_quad_table[] = {
+ 0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0
+};
+
+hcb_2_pair *hcb_2_pair_table[] = {
+ 0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2
+};
+
+hcb_bin_pair *hcb_bin_table[] = {
+ 0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0
+};
+
+uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 };
+
+/* defines whether a huffman codebook is unsigned or not */
+/* Table 4.6.2 */
+uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ /* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+};
+
+int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 };
+int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 };
+int hcb_bin_table_size[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 };
+
+static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len)
+{
+ uint8_t i;
+
+ for (i = 0; i < len; i++)
+ {
+ if(sp[i])
+ {
+ if(faad_get1bit(ld
+ DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1)
+ {
+ sp[i] = -sp[i];
+ }
+ }
+ }
+}
+
+static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
+{
+ uint8_t neg, i;
+ int16_t j;
+ int16_t off;
+
+ if (sp < 0)
+ {
+ if (sp != -16)
+ return sp;
+ neg = 1;
+ } else {
+ if (sp != 16)
+ return sp;
+ neg = 0;
+ }
+
+ for (i = 4; ; i++)
+ {
+ if (faad_get1bit(ld
+ DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0)
+ {
+ break;
+ }
+ }
+
+ off = (int16_t)faad_getbits(ld, i
+ DEBUGVAR(1,9,"huffman_getescape(): escape"));
+
+ j = off | (1<<i);
+ if (neg)
+ j = -j;
+
+ return j;
+}
+
+static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+ uint32_t cw;
+ uint16_t offset = 0;
+ uint8_t extra_bits;
+
+ cw = faad_showbits(ld, hcbN[cb]);
+ offset = hcb_table[cb][cw].offset;
+ extra_bits = hcb_table[cb][cw].extra_bits;
+
+ if (extra_bits)
+ {
+ /* we know for sure it's more than hcbN[cb] bits long */
+ faad_flushbits(ld, hcbN[cb]);
+ offset += (uint16_t)faad_showbits(ld, extra_bits);
+ faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]);
+ } else {
+ faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits);
+ }
+
+ if (offset > hcb_2_quad_table_size[cb])
+ {
+ /* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset,
+ hcb_2_quad_table_size[cb]); */
+ return 10;
+ }
+
+ sp[0] = hcb_2_quad_table[cb][offset].x;
+ sp[1] = hcb_2_quad_table[cb][offset].y;
+ sp[2] = hcb_2_quad_table[cb][offset].v;
+ sp[3] = hcb_2_quad_table[cb][offset].w;
+
+ return 0;
+}
+
+static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+ uint8_t err = huffman_2step_quad(cb, ld, sp);
+ huffman_sign_bits(ld, sp, QUAD_LEN);
+
+ return err;
+}
+
+static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+ uint32_t cw;
+ uint16_t offset = 0;
+ uint8_t extra_bits;
+
+ cw = faad_showbits(ld, hcbN[cb]);
+ offset = hcb_table[cb][cw].offset;
+ extra_bits = hcb_table[cb][cw].extra_bits;
+
+ if (extra_bits)
+ {
+ /* we know for sure it's more than hcbN[cb] bits long */
+ faad_flushbits(ld, hcbN[cb]);
+ offset += (uint16_t)faad_showbits(ld, extra_bits);
+ faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]);
+ } else {
+ faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits);
+ }
+
+ if (offset > hcb_2_pair_table_size[cb])
+ {
+ /* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset,
+ hcb_2_pair_table_size[cb]); */
+ return 10;
+ }
+
+ sp[0] = hcb_2_pair_table[cb][offset].x;
+ sp[1] = hcb_2_pair_table[cb][offset].y;
+
+ return 0;
+}
+
+static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+ uint8_t err = huffman_2step_pair(cb, ld, sp);
+ huffman_sign_bits(ld, sp, PAIR_LEN);
+
+ return err;
+}
+
+static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+ uint16_t offset = 0;
+
+ while (!hcb3[offset].is_leaf)
+ {
+ uint8_t b = faad_get1bit(ld
+ DEBUGVAR(1,255,"huffman_spectral_data():3"));
+ offset += hcb3[offset].data[b];
+ }
+
+ if (offset > hcb_bin_table_size[cb])
+ {
+ /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
+ hcb_bin_table_size[cb]); */
+ return 10;
+ }
+
+ sp[0] = hcb3[offset].data[0];
+ sp[1] = hcb3[offset].data[1];
+ sp[2] = hcb3[offset].data[2];
+ sp[3] = hcb3[offset].data[3];
+
+ return 0;
+}
+
+static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+ uint8_t err = huffman_binary_quad(cb, ld, sp);
+ huffman_sign_bits(ld, sp, QUAD_LEN);
+
+ return err;
+}
+
+static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+ uint16_t offset = 0;
+
+ while (!hcb_bin_table[cb][offset].is_leaf)
+ {
+ uint8_t b = faad_get1bit(ld
+ DEBUGVAR(1,255,"huffman_spectral_data():9"));
+ offset += hcb_bin_table[cb][offset].data[b];
+ }
+
+ if (offset > hcb_bin_table_size[cb])
+ {
+ /* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
+ hcb_bin_table_size[cb]); */
+ return 10;
+ }
+
+ sp[0] = hcb_bin_table[cb][offset].data[0];
+ sp[1] = hcb_bin_table[cb][offset].data[1];
+
+ return 0;
+}
+
+static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+ uint8_t err = huffman_binary_pair(cb, ld, sp);
+ huffman_sign_bits(ld, sp, PAIR_LEN);
+
+ return err;
+}
+
+static int16_t huffman_codebook(uint8_t i)
+{
+ static const uint32_t data = 16428320;
+ if (i == 0) return (int16_t)(data >> 16) & 0xFFFF;
+ else return (int16_t)data & 0xFFFF;
+}
+
+static void vcb11_check_LAV(uint8_t cb, int16_t *sp)
+{
+ static const uint16_t vcb11_LAV_tab[] = {
+ 16, 31, 47, 63, 95, 127, 159, 191, 223,
+ 255, 319, 383, 511, 767, 1023, 2047
+ };
+ uint16_t max = 0;
+
+ if (cb < 16 || cb > 31)
+ return;
+
+ max = vcb11_LAV_tab[cb - 16];
+
+ if ((abs(sp[0]) > max) || (abs(sp[1]) > max))
+ {
+ sp[0] = 0;
+ sp[1] = 0;
+ }
+}
+
+uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
+{
+ switch (cb)
+ {
+ case 1: /* 2-step method for data quadruples */
+ case 2:
+ return huffman_2step_quad(cb, ld, sp);
+ case 3: /* binary search for data quadruples */
+ return huffman_binary_quad_sign(cb, ld, sp);
+ case 4: /* 2-step method for data quadruples */
+ return huffman_2step_quad_sign(cb, ld, sp);
+ case 5: /* binary search for data pairs */
+ return huffman_binary_pair(cb, ld, sp);
+ case 6: /* 2-step method for data pairs */
+ return huffman_2step_pair(cb, ld, sp);
+ case 7: /* binary search for data pairs */
+ case 9:
+ return huffman_binary_pair_sign(cb, ld, sp);
+ case 8: /* 2-step method for data pairs */
+ case 10:
+ return huffman_2step_pair_sign(cb, ld, sp);
+ case 12: {
+ uint8_t err = huffman_2step_pair(11, ld, sp);
+ sp[0] = huffman_codebook(0); sp[1] = huffman_codebook(1);
+ return err; }
+ case 11:
+ {
+ uint8_t err = huffman_2step_pair_sign(11, ld, sp);
+ sp[0] = huffman_getescape(ld, sp[0]);
+ sp[1] = huffman_getescape(ld, sp[1]);
+ return err;
+ }
+#ifdef ERROR_RESILIENCE
+ /* VCB11 uses codebook 11 */
+ case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
+ case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
+ {
+ uint8_t err = huffman_2step_pair_sign(11, ld, sp);
+ sp[0] = huffman_getescape(ld, sp[0]);
+ sp[1] = huffman_getescape(ld, sp[1]);
+
+ /* check LAV (Largest Absolute Value) */
+ /* this finds errors in the ESCAPE signal */
+ vcb11_check_LAV(cb, sp);
+
+ return err;
+ }
+#endif
+ default:
+ /* Non existent codebook number, something went wrong */
+ return 11;
+ }
+
+ return 0;
+}
+
+
+#ifdef ERROR_RESILIENCE
+
+/* Special version of huffman_spectral_data
+Will not read from a bitfile but a bits_t structure.
+Will keep track of the bits decoded and return the number of bits remaining.
+Do not read more than ld->len, return -1 if codeword would be longer */
+
+int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
+{
+ uint32_t cw;
+ uint16_t offset = 0;
+ uint8_t extra_bits;
+ uint8_t i, vcb11 = 0;
+
+
+ switch (cb)
+ {
+ case 1: /* 2-step method for data quadruples */
+ case 2:
+ case 4:
+
+ cw = showbits_hcr(ld, hcbN[cb]);
+ offset = hcb_table[cb][cw].offset;
+ extra_bits = hcb_table[cb][cw].extra_bits;
+
+ if (extra_bits)
+ {
+ /* we know for sure it's more than hcbN[cb] bits long */
+ if ( flushbits_hcr(ld, hcbN[cb]) ) return -1;
+ offset += (uint16_t)showbits_hcr(ld, extra_bits);
+ if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1;
+ } else {
+ if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits) ) return -1;
+ }
+
+ sp[0] = hcb_2_quad_table[cb][offset].x;
+ sp[1] = hcb_2_quad_table[cb][offset].y;
+ sp[2] = hcb_2_quad_table[cb][offset].v;
+ sp[3] = hcb_2_quad_table[cb][offset].w;
+ break;
+
+ case 6: /* 2-step method for data pairs */
+ case 8:
+ case 10:
+ case 11:
+ /* VCB11 uses codebook 11 */
+ case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
+ case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
+
+ if (cb >= 16)
+ {
+ /* store the virtual codebook */
+ vcb11 = cb;
+ cb = 11;
+ }
+
+ cw = showbits_hcr(ld, hcbN[cb]);
+ offset = hcb_table[cb][cw].offset;
+ extra_bits = hcb_table[cb][cw].extra_bits;
+
+ if (extra_bits)
+ {
+ /* we know for sure it's more than hcbN[cb] bits long */
+ if ( flushbits_hcr(ld, hcbN[cb]) ) return -1;
+ offset += (uint16_t)showbits_hcr(ld, extra_bits);
+ if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1;
+ } else {
+ if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits) ) return -1;
+ }
+ sp[0] = hcb_2_pair_table[cb][offset].x;
+ sp[1] = hcb_2_pair_table[cb][offset].y;
+ break;
+
+ case 3: /* binary search for data quadruples */
+
+ while (!hcb3[offset].is_leaf)
+ {
+ uint8_t b;
+
+ if ( get1bit_hcr(ld, &b) ) return -1;
+ offset += hcb3[offset].data[b];
+ }
+
+ sp[0] = hcb3[offset].data[0];
+ sp[1] = hcb3[offset].data[1];
+ sp[2] = hcb3[offset].data[2];
+ sp[3] = hcb3[offset].data[3];
+
+ break;
+
+ case 5: /* binary search for data pairs */
+ case 7:
+ case 9:
+
+ while (!hcb_bin_table[cb][offset].is_leaf)
+ {
+ uint8_t b;
+
+ if (get1bit_hcr(ld, &b) ) return -1;
+ offset += hcb_bin_table[cb][offset].data[b];
+ }
+
+ sp[0] = hcb_bin_table[cb][offset].data[0];
+ sp[1] = hcb_bin_table[cb][offset].data[1];
+
+ break;
+ }
+
+ /* decode sign bits */
+ if (unsigned_cb[cb])
+ {
+ for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++)
+ {
+ if(sp[i])
+ {
+ uint8_t b;
+ if ( get1bit_hcr(ld, &b) ) return -1;
+ if (b != 0) {
+ sp[i] = -sp[i];
+ }
+ }
+ }
+ }
+
+ /* decode huffman escape bits */
+ if ((cb == ESC_HCB) || (cb >= 16))
+ {
+ uint8_t k;
+ for (k = 0; k < 2; k++)
+ {
+ if ((sp[k] == 16) || (sp[k] == -16))
+ {
+ uint8_t neg, i;
+ int32_t j;
+ uint32_t off;
+
+ neg = (sp[k] < 0) ? 1 : 0;
+
+ for (i = 4; ; i++)
+ {
+ uint8_t b;
+ if (get1bit_hcr(ld, &b))
+ return -1;
+ if (b == 0)
+ break;
+ }
+
+ if (getbits_hcr(ld, i, &off))
+ return -1;
+ j = off + (1<<i);
+ sp[k] = (int16_t)((neg) ? -j : j);
+ }
+ }
+
+ if (vcb11 != 0)
+ {
+ /* check LAV (Largest Absolute Value) */
+ /* this finds errors in the ESCAPE signal */
+ vcb11_check_LAV(vcb11, sp);
+ }
+ }
+ return ld->len;
+}
+
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/huffman.h b/src/filters/transform/mpadecfilter/faad2/libfaad/huffman.h
new file mode 100644
index 000000000..67d301153
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/huffman.h
@@ -0,0 +1,49 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: huffman.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __HUFFMAN_H__
+#define __HUFFMAN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int8_t huffman_scale_factor(bitfile *ld);
+uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp);
+#ifdef ERROR_RESILIENCE
+int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ic_predict.c b/src/filters/transform/mpadecfilter/faad2/libfaad/ic_predict.c
new file mode 100644
index 000000000..1f95a723c
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ic_predict.c
@@ -0,0 +1,272 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ic_predict.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef MAIN_DEC
+
+#include "syntax.h"
+#include "ic_predict.h"
+#include "pns.h"
+
+
+static void flt_round(float32_t *pf)
+{
+ int32_t flg;
+ uint32_t tmp, tmp1, tmp2;
+
+ tmp = *(uint32_t*)pf;
+ flg = tmp & (uint32_t)0x00008000;
+ tmp &= (uint32_t)0xffff0000;
+ tmp1 = tmp;
+ /* round 1/2 lsb toward infinity */
+ if (flg)
+ {
+ tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
+ tmp |= (uint32_t)0x00010000; /* insert 1 lsb */
+ tmp2 = tmp; /* add 1 lsb and elided one */
+ tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
+
+ *pf = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp;
+ } else {
+ *pf = *(float32_t*)&tmp;
+ }
+}
+
+static int16_t quant_pred(float32_t x)
+{
+ int16_t q;
+ uint32_t *tmp = (uint32_t*)&x;
+
+ q = (int16_t)(*tmp>>16);
+
+ return q;
+}
+
+static float32_t inv_quant_pred(int16_t q)
+{
+ float32_t x;
+ uint32_t *tmp = (uint32_t*)&x;
+ *tmp = ((uint32_t)q)<<16;
+
+ return x;
+}
+
+static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred)
+{
+ uint16_t tmp;
+ int16_t i, j;
+ real_t dr1, predictedvalue;
+ real_t e0, e1;
+ real_t k1, k2;
+
+ real_t r[2];
+ real_t COR[2];
+ real_t VAR[2];
+
+ r[0] = inv_quant_pred(state->r[0]);
+ r[1] = inv_quant_pred(state->r[1]);
+ COR[0] = inv_quant_pred(state->COR[0]);
+ COR[1] = inv_quant_pred(state->COR[1]);
+ VAR[0] = inv_quant_pred(state->VAR[0]);
+ VAR[1] = inv_quant_pred(state->VAR[1]);
+
+
+#if 1
+ tmp = state->VAR[0];
+ j = (tmp >> 7);
+ i = tmp & 0x7f;
+ if (j >= 128)
+ {
+ j -= 128;
+ k1 = COR[0] * exp_table[j] * mnt_table[i];
+ } else {
+ k1 = REAL_CONST(0);
+ }
+#else
+
+ {
+#define B 0.953125
+ real_t c = COR[0];
+ real_t v = VAR[0];
+ real_t tmp;
+ if (c == 0 || v <= 1)
+ {
+ k1 = 0;
+ } else {
+ tmp = B / v;
+ flt_round(&tmp);
+ k1 = c * tmp;
+ }
+ }
+#endif
+
+ if (pred)
+ {
+#if 1
+ tmp = state->VAR[1];
+ j = (tmp >> 7);
+ i = tmp & 0x7f;
+ if (j >= 128)
+ {
+ j -= 128;
+ k2 = COR[1] * exp_table[j] * mnt_table[i];
+ } else {
+ k2 = REAL_CONST(0);
+ }
+#else
+
+#define B 0.953125
+ real_t c = COR[1];
+ real_t v = VAR[1];
+ real_t tmp;
+ if (c == 0 || v <= 1)
+ {
+ k2 = 0;
+ } else {
+ tmp = B / v;
+ flt_round(&tmp);
+ k2 = c * tmp;
+ }
+#endif
+
+ predictedvalue = k1*r[0] + k2*r[1];
+ flt_round(&predictedvalue);
+ *output = input + predictedvalue;
+ }
+
+ /* calculate new state data */
+ e0 = *output;
+ e1 = e0 - k1*r[0];
+ dr1 = k1*e0;
+
+ VAR[0] = ALPHA*VAR[0] + 0.5f * (r[0]*r[0] + e0*e0);
+ COR[0] = ALPHA*COR[0] + r[0]*e0;
+ VAR[1] = ALPHA*VAR[1] + 0.5f * (r[1]*r[1] + e1*e1);
+ COR[1] = ALPHA*COR[1] + r[1]*e1;
+
+ r[1] = A * (r[0]-dr1);
+ r[0] = A * e0;
+
+ state->r[0] = quant_pred(r[0]);
+ state->r[1] = quant_pred(r[1]);
+ state->COR[0] = quant_pred(COR[0]);
+ state->COR[1] = quant_pred(COR[1]);
+ state->VAR[0] = quant_pred(VAR[0]);
+ state->VAR[1] = quant_pred(VAR[1]);
+}
+
+static void reset_pred_state(pred_state *state)
+{
+ state->r[0] = 0;
+ state->r[1] = 0;
+ state->COR[0] = 0;
+ state->COR[1] = 0;
+ state->VAR[0] = 0x3F80;
+ state->VAR[1] = 0x3F80;
+}
+
+void pns_reset_pred_state(ic_stream *ics, pred_state *state)
+{
+ uint8_t sfb, g, b;
+ uint16_t i, offs, offs2;
+
+ /* prediction only for long blocks */
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ return;
+
+ for (g = 0; g < ics->num_window_groups; g++)
+ {
+ for (b = 0; b < ics->window_group_length[g]; b++)
+ {
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
+ {
+ if (is_noise(ics, g, sfb))
+ {
+ offs = ics->swb_offset[sfb];
+ offs2 = ics->swb_offset[sfb+1];
+
+ for (i = offs; i < offs2; i++)
+ reset_pred_state(&state[i]);
+ }
+ }
+ }
+ }
+}
+
+void reset_all_predictors(pred_state *state, uint16_t frame_len)
+{
+ uint16_t i;
+
+ for (i = 0; i < frame_len; i++)
+ reset_pred_state(&state[i]);
+}
+
+/* intra channel prediction */
+void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
+ uint16_t frame_len, uint8_t sf_index)
+{
+ uint8_t sfb;
+ uint16_t bin;
+
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ {
+ reset_all_predictors(state, frame_len);
+ } else {
+ for (sfb = 0; sfb < max_pred_sfb(sf_index); sfb++)
+ {
+ uint16_t low = ics->swb_offset[sfb];
+ uint16_t high = ics->swb_offset[sfb+1];
+
+ for (bin = low; bin < high; bin++)
+ {
+ ic_predict(&state[bin], spec[bin], &spec[bin],
+ (ics->predictor_data_present && ics->pred.prediction_used[sfb]));
+ }
+ }
+
+ if (ics->predictor_data_present)
+ {
+ if (ics->pred.predictor_reset)
+ {
+ for (bin = ics->pred.predictor_reset_group_number - 1;
+ bin < frame_len; bin += 30)
+ {
+ reset_pred_state(&state[bin]);
+ }
+ }
+ }
+ }
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ic_predict.h b/src/filters/transform/mpadecfilter/faad2/libfaad/ic_predict.h
new file mode 100644
index 000000000..d2c915d93
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ic_predict.h
@@ -0,0 +1,254 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ic_predict.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifdef MAIN_DEC
+
+#ifndef __IC_PREDICT_H__
+#define __IC_PREDICT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ALPHA REAL_CONST(0.90625)
+#define A REAL_CONST(0.953125)
+
+
+void pns_reset_pred_state(ic_stream *ics, pred_state *state);
+void reset_all_predictors(pred_state *state, uint16_t frame_len);
+void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
+ uint16_t frame_len, uint8_t sf_index);
+
+ALIGN static const real_t mnt_table[128] = {
+ COEF_CONST(0.9531250000), COEF_CONST(0.9453125000),
+ COEF_CONST(0.9375000000), COEF_CONST(0.9296875000),
+ COEF_CONST(0.9257812500), COEF_CONST(0.9179687500),
+ COEF_CONST(0.9101562500), COEF_CONST(0.9023437500),
+ COEF_CONST(0.8984375000), COEF_CONST(0.8906250000),
+ COEF_CONST(0.8828125000), COEF_CONST(0.8789062500),
+ COEF_CONST(0.8710937500), COEF_CONST(0.8671875000),
+ COEF_CONST(0.8593750000), COEF_CONST(0.8515625000),
+ COEF_CONST(0.8476562500), COEF_CONST(0.8398437500),
+ COEF_CONST(0.8359375000), COEF_CONST(0.8281250000),
+ COEF_CONST(0.8242187500), COEF_CONST(0.8203125000),
+ COEF_CONST(0.8125000000), COEF_CONST(0.8085937500),
+ COEF_CONST(0.8007812500), COEF_CONST(0.7968750000),
+ COEF_CONST(0.7929687500), COEF_CONST(0.7851562500),
+ COEF_CONST(0.7812500000), COEF_CONST(0.7773437500),
+ COEF_CONST(0.7734375000), COEF_CONST(0.7656250000),
+ COEF_CONST(0.7617187500), COEF_CONST(0.7578125000),
+ COEF_CONST(0.7539062500), COEF_CONST(0.7500000000),
+ COEF_CONST(0.7421875000), COEF_CONST(0.7382812500),
+ COEF_CONST(0.7343750000), COEF_CONST(0.7304687500),
+ COEF_CONST(0.7265625000), COEF_CONST(0.7226562500),
+ COEF_CONST(0.7187500000), COEF_CONST(0.7148437500),
+ COEF_CONST(0.7109375000), COEF_CONST(0.7070312500),
+ COEF_CONST(0.6992187500), COEF_CONST(0.6953125000),
+ COEF_CONST(0.6914062500), COEF_CONST(0.6875000000),
+ COEF_CONST(0.6835937500), COEF_CONST(0.6796875000),
+ COEF_CONST(0.6796875000), COEF_CONST(0.6757812500),
+ COEF_CONST(0.6718750000), COEF_CONST(0.6679687500),
+ COEF_CONST(0.6640625000), COEF_CONST(0.6601562500),
+ COEF_CONST(0.6562500000), COEF_CONST(0.6523437500),
+ COEF_CONST(0.6484375000), COEF_CONST(0.6445312500),
+ COEF_CONST(0.6406250000), COEF_CONST(0.6406250000),
+ COEF_CONST(0.6367187500), COEF_CONST(0.6328125000),
+ COEF_CONST(0.6289062500), COEF_CONST(0.6250000000),
+ COEF_CONST(0.6210937500), COEF_CONST(0.6210937500),
+ COEF_CONST(0.6171875000), COEF_CONST(0.6132812500),
+ COEF_CONST(0.6093750000), COEF_CONST(0.6054687500),
+ COEF_CONST(0.6054687500), COEF_CONST(0.6015625000),
+ COEF_CONST(0.5976562500), COEF_CONST(0.5937500000),
+ COEF_CONST(0.5937500000), COEF_CONST(0.5898437500),
+ COEF_CONST(0.5859375000), COEF_CONST(0.5820312500),
+ COEF_CONST(0.5820312500), COEF_CONST(0.5781250000),
+ COEF_CONST(0.5742187500), COEF_CONST(0.5742187500),
+ COEF_CONST(0.5703125000), COEF_CONST(0.5664062500),
+ COEF_CONST(0.5664062500), COEF_CONST(0.5625000000),
+ COEF_CONST(0.5585937500), COEF_CONST(0.5585937500),
+ COEF_CONST(0.5546875000), COEF_CONST(0.5507812500),
+ COEF_CONST(0.5507812500), COEF_CONST(0.5468750000),
+ COEF_CONST(0.5429687500), COEF_CONST(0.5429687500),
+ COEF_CONST(0.5390625000), COEF_CONST(0.5390625000),
+ COEF_CONST(0.5351562500), COEF_CONST(0.5312500000),
+ COEF_CONST(0.5312500000), COEF_CONST(0.5273437500),
+ COEF_CONST(0.5273437500), COEF_CONST(0.5234375000),
+ COEF_CONST(0.5195312500), COEF_CONST(0.5195312500),
+ COEF_CONST(0.5156250000), COEF_CONST(0.5156250000),
+ COEF_CONST(0.5117187500), COEF_CONST(0.5117187500),
+ COEF_CONST(0.5078125000), COEF_CONST(0.5078125000),
+ COEF_CONST(0.5039062500), COEF_CONST(0.5039062500),
+ COEF_CONST(0.5000000000), COEF_CONST(0.4980468750),
+ COEF_CONST(0.4960937500), COEF_CONST(0.4941406250),
+ COEF_CONST(0.4921875000), COEF_CONST(0.4902343750),
+ COEF_CONST(0.4882812500), COEF_CONST(0.4863281250),
+ COEF_CONST(0.4843750000), COEF_CONST(0.4824218750),
+ COEF_CONST(0.4804687500), COEF_CONST(0.4785156250)
+};
+
+ALIGN static const real_t exp_table[128] = {
+ COEF_CONST(0.50000000000000000000000000000000000000000000000000),
+ COEF_CONST(0.25000000000000000000000000000000000000000000000000),
+ COEF_CONST(0.12500000000000000000000000000000000000000000000000),
+ COEF_CONST(0.06250000000000000000000000000000000000000000000000),
+ COEF_CONST(0.03125000000000000000000000000000000000000000000000),
+ COEF_CONST(0.01562500000000000000000000000000000000000000000000),
+ COEF_CONST(0.00781250000000000000000000000000000000000000000000),
+ COEF_CONST(0.00390625000000000000000000000000000000000000000000),
+ COEF_CONST(0.00195312500000000000000000000000000000000000000000),
+ COEF_CONST(0.00097656250000000000000000000000000000000000000000),
+ COEF_CONST(0.00048828125000000000000000000000000000000000000000),
+ COEF_CONST(0.00024414062500000000000000000000000000000000000000),
+ COEF_CONST(0.00012207031250000000000000000000000000000000000000),
+ COEF_CONST(0.00006103515625000000000000000000000000000000000000),
+ COEF_CONST(0.00003051757812500000000000000000000000000000000000),
+ COEF_CONST(0.00001525878906250000000000000000000000000000000000),
+ COEF_CONST(0.00000762939453125000000000000000000000000000000000),
+ COEF_CONST(0.00000381469726562500000000000000000000000000000000),
+ COEF_CONST(0.00000190734863281250000000000000000000000000000000),
+ COEF_CONST(0.00000095367431640625000000000000000000000000000000),
+ COEF_CONST(0.00000047683715820312500000000000000000000000000000),
+ COEF_CONST(0.00000023841857910156250000000000000000000000000000),
+ COEF_CONST(0.00000011920928955078125000000000000000000000000000),
+ COEF_CONST(0.00000005960464477539062500000000000000000000000000),
+ COEF_CONST(0.00000002980232238769531300000000000000000000000000),
+ COEF_CONST(0.00000001490116119384765600000000000000000000000000),
+ COEF_CONST(0.00000000745058059692382810000000000000000000000000),
+ COEF_CONST(0.00000000372529029846191410000000000000000000000000),
+ COEF_CONST(0.00000000186264514923095700000000000000000000000000),
+ COEF_CONST(0.00000000093132257461547852000000000000000000000000),
+ COEF_CONST(0.00000000046566128730773926000000000000000000000000),
+ COEF_CONST(0.00000000023283064365386963000000000000000000000000),
+ COEF_CONST(0.00000000011641532182693481000000000000000000000000),
+ COEF_CONST(0.00000000005820766091346740700000000000000000000000),
+ COEF_CONST(0.00000000002910383045673370400000000000000000000000),
+ COEF_CONST(0.00000000001455191522836685200000000000000000000000),
+ COEF_CONST(0.00000000000727595761418342590000000000000000000000),
+ COEF_CONST(0.00000000000363797880709171300000000000000000000000),
+ COEF_CONST(0.00000000000181898940354585650000000000000000000000),
+ COEF_CONST(0.00000000000090949470177292824000000000000000000000),
+ COEF_CONST(0.00000000000045474735088646412000000000000000000000),
+ COEF_CONST(0.00000000000022737367544323206000000000000000000000),
+ COEF_CONST(0.00000000000011368683772161603000000000000000000000),
+ COEF_CONST(0.00000000000005684341886080801500000000000000000000),
+ COEF_CONST(0.00000000000002842170943040400700000000000000000000),
+ COEF_CONST(0.00000000000001421085471520200400000000000000000000),
+ COEF_CONST(0.00000000000000710542735760100190000000000000000000),
+ COEF_CONST(0.00000000000000355271367880050090000000000000000000),
+ COEF_CONST(0.00000000000000177635683940025050000000000000000000),
+ COEF_CONST(0.00000000000000088817841970012523000000000000000000),
+ COEF_CONST(0.00000000000000044408920985006262000000000000000000),
+ COEF_CONST(0.00000000000000022204460492503131000000000000000000),
+ COEF_CONST(0.00000000000000011102230246251565000000000000000000),
+ COEF_CONST(0.00000000000000005551115123125782700000000000000000),
+ COEF_CONST(0.00000000000000002775557561562891400000000000000000),
+ COEF_CONST(0.00000000000000001387778780781445700000000000000000),
+ COEF_CONST(0.00000000000000000693889390390722840000000000000000),
+ COEF_CONST(0.00000000000000000346944695195361420000000000000000),
+ COEF_CONST(0.00000000000000000173472347597680710000000000000000),
+ COEF_CONST(0.00000000000000000086736173798840355000000000000000),
+ COEF_CONST(0.00000000000000000043368086899420177000000000000000),
+ COEF_CONST(0.00000000000000000021684043449710089000000000000000),
+ COEF_CONST(0.00000000000000000010842021724855044000000000000000),
+ COEF_CONST(0.00000000000000000005421010862427522200000000000000),
+ COEF_CONST(0.00000000000000000002710505431213761100000000000000),
+ COEF_CONST(0.00000000000000000001355252715606880500000000000000),
+ COEF_CONST(0.00000000000000000000677626357803440270000000000000),
+ COEF_CONST(0.00000000000000000000338813178901720140000000000000),
+ COEF_CONST(0.00000000000000000000169406589450860070000000000000),
+ COEF_CONST(0.00000000000000000000084703294725430034000000000000),
+ COEF_CONST(0.00000000000000000000042351647362715017000000000000),
+ COEF_CONST(0.00000000000000000000021175823681357508000000000000),
+ COEF_CONST(0.00000000000000000000010587911840678754000000000000),
+ COEF_CONST(0.00000000000000000000005293955920339377100000000000),
+ COEF_CONST(0.00000000000000000000002646977960169688600000000000),
+ COEF_CONST(0.00000000000000000000001323488980084844300000000000),
+ COEF_CONST(0.00000000000000000000000661744490042422140000000000),
+ COEF_CONST(0.00000000000000000000000330872245021211070000000000),
+ COEF_CONST(0.00000000000000000000000165436122510605530000000000),
+ COEF_CONST(0.00000000000000000000000082718061255302767000000000),
+ COEF_CONST(0.00000000000000000000000041359030627651384000000000),
+ COEF_CONST(0.00000000000000000000000020679515313825692000000000),
+ COEF_CONST(0.00000000000000000000000010339757656912846000000000),
+ COEF_CONST(0.00000000000000000000000005169878828456423000000000),
+ COEF_CONST(0.00000000000000000000000002584939414228211500000000),
+ COEF_CONST(0.00000000000000000000000001292469707114105700000000),
+ COEF_CONST(0.00000000000000000000000000646234853557052870000000),
+ COEF_CONST(0.00000000000000000000000000323117426778526440000000),
+ COEF_CONST(0.00000000000000000000000000161558713389263220000000),
+ COEF_CONST(0.00000000000000000000000000080779356694631609000000),
+ COEF_CONST(0.00000000000000000000000000040389678347315804000000),
+ COEF_CONST(0.00000000000000000000000000020194839173657902000000),
+ COEF_CONST(0.00000000000000000000000000010097419586828951000000),
+ COEF_CONST(0.00000000000000000000000000005048709793414475600000),
+ COEF_CONST(0.00000000000000000000000000002524354896707237800000),
+ COEF_CONST(0.00000000000000000000000000001262177448353618900000),
+ COEF_CONST(0.00000000000000000000000000000631088724176809440000),
+ COEF_CONST(0.00000000000000000000000000000315544362088404720000),
+ COEF_CONST(0.00000000000000000000000000000157772181044202360000),
+ COEF_CONST(0.00000000000000000000000000000078886090522101181000),
+ COEF_CONST(0.00000000000000000000000000000039443045261050590000),
+ COEF_CONST(0.00000000000000000000000000000019721522630525295000),
+ COEF_CONST(0.00000000000000000000000000000009860761315262647600),
+ COEF_CONST(0.00000000000000000000000000000004930380657631323800),
+ COEF_CONST(0.00000000000000000000000000000002465190328815661900),
+ COEF_CONST(0.00000000000000000000000000000001232595164407830900),
+ COEF_CONST(0.00000000000000000000000000000000616297582203915470),
+ COEF_CONST(0.00000000000000000000000000000000308148791101957740),
+ COEF_CONST(0.00000000000000000000000000000000154074395550978870),
+ COEF_CONST(0.00000000000000000000000000000000077037197775489434),
+ COEF_CONST(0.00000000000000000000000000000000038518598887744717),
+ COEF_CONST(0.00000000000000000000000000000000019259299443872359),
+ COEF_CONST(0.00000000000000000000000000000000009629649721936179),
+ COEF_CONST(0.00000000000000000000000000000000004814824860968090),
+ COEF_CONST(0.00000000000000000000000000000000002407412430484045),
+ COEF_CONST(0.00000000000000000000000000000000001203706215242022),
+ COEF_CONST(0.00000000000000000000000000000000000601853107621011),
+ COEF_CONST(0.00000000000000000000000000000000000300926553810506),
+ COEF_CONST(0.00000000000000000000000000000000000150463276905253),
+ COEF_CONST(0.00000000000000000000000000000000000075231638452626),
+ COEF_CONST(0.00000000000000000000000000000000000037615819226313),
+ COEF_CONST(0.00000000000000000000000000000000000018807909613157),
+ COEF_CONST(0.00000000000000000000000000000000000009403954806578),
+ COEF_CONST(0.00000000000000000000000000000000000004701977403289),
+ COEF_CONST(0.00000000000000000000000000000000000002350988701645),
+ COEF_CONST(0.00000000000000000000000000000000000001175494350822),
+ COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */),
+ COEF_CONST(0.0)
+};
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/iq_table.h b/src/filters/transform/mpadecfilter/faad2/libfaad/iq_table.h
new file mode 100644
index 000000000..9af63231e
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/iq_table.h
@@ -0,0 +1,16460 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: iq_table.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef IQ_TABLE_H__
+#define IQ_TABLE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* !!!DON'T CHANGE IQ_TABLE_SIZE!!! */
+
+
+#ifndef FIXED_POINT
+
+#define IQ_TABLE_SIZE 8192
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+ALIGN static const real_t iq_table[IQ_TABLE_SIZE] =
+{
+ 0,
+ 1,
+ 2.5198420997897464,
+ 4.3267487109222245,
+ 6.3496042078727974,
+ 8.5498797333834844,
+ 10.902723556992836,
+ 13.390518279406722,
+ 15.999999999999998,
+ 18.720754407467133,
+ 21.544346900318832,
+ 24.463780996262464,
+ 27.47314182127996,
+ 30.567350940369842,
+ 33.741991698453212,
+ 36.993181114957046,
+ 40.317473596635935,
+ 43.711787041189993,
+ 47.173345095760126,
+ 50.699631325716943,
+ 54.288352331898118,
+ 57.937407704003519,
+ 61.6448652744185,
+ 65.408940536585988,
+ 69.227979374755591,
+ 73.100443455321638,
+ 77.024897778591622,
+ 80.999999999999986,
+ 85.024491212518527,
+ 89.097187944889555,
+ 93.216975178615741,
+ 97.382800224133163,
+ 101.59366732596474,
+ 105.84863288986224,
+ 110.14680124343441,
+ 114.4873208566006,
+ 118.86938096020653,
+ 123.29220851090024,
+ 127.75506545836058,
+ 132.25724627755247,
+ 136.79807573413572,
+ 141.37690685569191,
+ 145.99311908523086,
+ 150.6461165966291,
+ 155.33532675434674,
+ 160.06019870205279,
+ 164.82020206673349,
+ 169.61482576651861,
+ 174.44357691188537,
+ 179.30597979112557,
+ 184.20157493201927,
+ 189.12991823257562,
+ 194.09058015449685,
+ 199.08314497371677,
+ 204.1072100829694,
+ 209.16238534187647,
+ 214.24829247050752,
+ 219.36456448277784,
+ 224.51084515641216,
+ 229.6867885365223,
+ 234.89205847013176,
+ 240.12632816923249,
+ 245.38927980018505,
+ 250.68060409747261,
+ 255.99999999999991,
+ 261.34717430828869,
+ 266.72184136106449,
+ 272.12372272986045,
+ 277.55254693037961,
+ 283.0080491494619,
+ 288.48997098659891,
+ 293.99806020902247,
+ 299.53207051947408,
+ 305.0917613358298,
+ 310.67689758182206,
+ 316.28724948815585,
+ 321.92259240337177,
+ 327.58270661385535,
+ 333.26737717243742,
+ 338.97639373507025,
+ 344.70955040510125,
+ 350.46664558470013,
+ 356.24748183302603,
+ 362.05186573075139,
+ 367.87960775058258,
+ 373.73052213344511,
+ 379.60442677002078,
+ 385.50114308734607,
+ 391.42049594019937,
+ 397.36231350702371,
+ 403.32642719014467,
+ 409.31267152006262,
+ 415.32088406360799,
+ 421.35090533576471,
+ 427.40257871497619,
+ 433.4757503617617,
+ 439.5702691404793,
+ 445.68598654408271,
+ 451.82275662172759,
+ 457.98043590909128,
+ 464.15888336127773,
+ 470.35796028818726,
+ 476.5775302922363,
+ 482.81745920832043,
+ 489.07761504591741,
+ 495.35786793323581,
+ 501.65809006331688,
+ 507.97815564200368,
+ 514.31794083769648,
+ 520.67732373281672,
+ 527.05618427690604,
+ 533.45440424129174,
+ 539.87186717525128,
+ 546.30845836361505,
+ 552.76406478574609,
+ 559.23857507584194,
+ 565.73187948450413,
+ 572.24386984152341,
+ 578.77443951983378,
+ 585.32348340058843,
+ 591.89089783931263,
+ 598.47658063309257,
+ 605.08043098876044,
+ 611.70234949203643,
+ 618.3422380775919,
+ 624.99999999999977,
+ 631.67553980553748,
+ 638.36876330481164,
+ 645.07957754617485,
+ 651.80789078990415,
+ 658.55361248311499,
+ 665.31665323538357,
+ 672.09692479505225,
+ 678.8943400261943,
+ 685.70881288621433,
+ 692.540258404062,
+ 699.38859265903977,
+ 706.25373276018058,
+ 713.13559682617972,
+ 720.03410396586037,
+ 726.94917425915435,
+ 733.88072873858209,
+ 740.82868937121543,
+ 747.79297904110535,
+ 754.77352153216191,
+ 761.77024151147043,
+ 768.78306451302956,
+ 775.81191692189896,
+ 782.85672595874246,
+ 789.91741966475445,
+ 796.99392688695798,
+ 804.08617726386274,
+ 811.19410121147098,
+ 818.31762990962227,
+ 825.45669528866563,
+ 832.61123001644864,
+ 839.78116748561604,
+ 846.96644180120552,
+ 854.16698776853514,
+ 861.38274088137143,
+ 868.61363731036977,
+ 875.85961389178203,
+ 883.12060811641959,
+ 890.39655811886757,
+ 897.68740266694181,
+ 904.99308115138172,
+ 912.31353357577188,
+ 919.64870054668756,
+ 926.99852326405619,
+ 934.36294351172899,
+ 941.74190364825859,
+ 949.13534659787422,
+ 956.54321584165211,
+ 963.96545540887348,
+ 971.40200986856541,
+ 978.85282432122176,
+ 986.31784439069588,
+ 993.7970162162635,
+ 1001.29028644485,
+ 1008.797602223418,
+ 1016.3189111915103,
+ 1023.8541614739464,
+ 1031.4033016736653,
+ 1038.9662808647138,
+ 1046.5430485853758,
+ 1054.1335548314366,
+ 1061.7377500495838,
+ 1069.3555851309357,
+ 1076.9870114046978,
+ 1084.6319806319441,
+ 1092.2904449995174,
+ 1099.9623571140482,
+ 1107.6476699960892,
+ 1115.3463370743607,
+ 1123.058312180106,
+ 1130.7835495415541,
+ 1138.5220037784854,
+ 1146.273629896901,
+ 1154.0383832837879,
+ 1161.816219701986,
+ 1169.607095285146,
+ 1177.4109665327808,
+ 1185.2277903054078,
+ 1193.0575238197798,
+ 1200.9001246442001,
+ 1208.7555506939248,
+ 1216.6237602266442,
+ 1224.5047118380478,
+ 1232.3983644574657,
+ 1240.3046773435874,
+ 1248.2236100802568,
+ 1256.1551225723395,
+ 1264.099175041662,
+ 1272.0557280230228,
+ 1280.0247423602691,
+ 1288.0061792024444,
+ 1295.9999999999995,
+ 1304.006166501068,
+ 1312.0246407478062,
+ 1320.0553850727929,
+ 1328.0983620954903,
+ 1336.1535347187651,
+ 1344.2208661254647,
+ 1352.3003197750522,
+ 1360.3918594002962,
+ 1368.4954490040145,
+ 1376.6110528558709,
+ 1384.7386354892244,
+ 1392.8781616980295,
+ 1401.0295965337855,
+ 1409.1929053025353,
+ 1417.3680535619119,
+ 1425.5550071182327,
+ 1433.7537320236374,
+ 1441.9641945732744,
+ 1450.1863613025282,
+ 1458.4201989842913,
+ 1466.6656746262797,
+ 1474.9227554683875,
+ 1483.1914089800841,
+ 1491.4716028578516,
+ 1499.7633050226596,
+ 1508.0664836174794,
+ 1516.3811070048375,
+ 1524.7071437644029,
+ 1533.0445626906128,
+ 1541.3933327903342,
+ 1549.7534232805581,
+ 1558.1248035861302,
+ 1566.507443337515,
+ 1574.9013123685909,
+ 1583.3063807144795,
+ 1591.7226186094069,
+ 1600.1499964845941,
+ 1608.58848496618,
+ 1617.0380548731737,
+ 1625.4986772154357,
+ 1633.9703231916887,
+ 1642.4529641875577,
+ 1650.9465717736346,
+ 1659.4511177035752,
+ 1667.9665739122186,
+ 1676.4929125137353,
+ 1685.030105799801,
+ 1693.5781262377957,
+ 1702.136946469027,
+ 1710.7065393069795,
+ 1719.2868777355877,
+ 1727.8779349075323,
+ 1736.4796841425596,
+ 1745.092098925825,
+ 1753.7151529062583,
+ 1762.3488198949503,
+ 1770.9930738635628,
+ 1779.6478889427597,
+ 1788.3132394206564,
+ 1796.9890997412947,
+ 1805.6754445031333,
+ 1814.3722484575621,
+ 1823.0794865074322,
+ 1831.7971337056094,
+ 1840.5251652535437,
+ 1849.2635564998579,
+ 1858.0122829389563,
+ 1866.7713202096493,
+ 1875.5406440937966,
+ 1884.3202305149687,
+ 1893.110055537124,
+ 1901.9100953633042,
+ 1910.7203263343454,
+ 1919.5407249276057,
+ 1928.3712677557098,
+ 1937.2119315653083,
+ 1946.0626932358525,
+ 1954.923529778386,
+ 1963.79441833435,
+ 1972.6753361744036,
+ 1981.5662606972594,
+ 1990.467169428533,
+ 1999.3780400196069,
+ 2008.2988502465078,
+ 2017.2295780087982,
+ 2026.1702013284819,
+ 2035.1206983489212,
+ 2044.0810473337688,
+ 2053.0512266659125,
+ 2062.0312148464309,
+ 2071.0209904935646,
+ 2080.0205323416958,
+ 2089.0298192403443,
+ 2098.0488301531714,
+ 2107.0775441569995,
+ 2116.115940440839,
+ 2125.1639983049317,
+ 2134.2216971597995,
+ 2143.2890165253098,
+ 2152.3659360297484,
+ 2161.4524354089031,
+ 2170.5484945051617,
+ 2179.6540932666144,
+ 2188.7692117461711,
+ 2197.8938301006888,
+ 2207.0279285901042,
+ 2216.1714875765838,
+ 2225.324487523676,
+ 2234.4869089954782,
+ 2243.6587326558101,
+ 2252.8399392673982,
+ 2262.0305096910702,
+ 2271.2304248849537,
+ 2280.4396659036897,
+ 2289.6582138976523,
+ 2298.8860501121762,
+ 2308.1231558867926,
+ 2317.3695126544767,
+ 2326.6251019409005,
+ 2335.8899053636933,
+ 2345.1639046317132,
+ 2354.4470815443233,
+ 2363.7394179906792,
+ 2373.0408959490205,
+ 2382.3514974859731,
+ 2391.6712047558558,
+ 2400.9999999999991,
+ 2410.3378655460651,
+ 2419.6847838073813,
+ 2429.0407372822747,
+ 2438.4057085534191,
+ 2447.7796802871858,
+ 2457.1626352330004,
+ 2466.5545562227112,
+ 2475.9554261699564,
+ 2485.3652280695474,
+ 2494.7839449968492,
+ 2504.2115601071737,
+ 2513.6480566351788,
+ 2523.0934178942675,
+ 2532.5476272760025,
+ 2542.0106682495189,
+ 2551.482524360948,
+ 2560.9631792328441,
+ 2570.4526165636184,
+ 2579.9508201269791,
+ 2589.4577737713744,
+ 2598.9734614194458,
+ 2608.4978670674823,
+ 2618.0309747848837,
+ 2627.5727687136259,
+ 2637.1232330677353,
+ 2646.6823521327647,
+ 2656.2501102652768,
+ 2665.8264918923328,
+ 2675.4114815109842,
+ 2685.0050636877722,
+ 2694.6072230582295,
+ 2704.2179443263894,
+ 2713.8372122642972,
+ 2723.4650117115279,
+ 2733.1013275747096,
+ 2742.7461448270483,
+ 2752.3994485078601,
+ 2762.0612237221085,
+ 2771.7314556399419,
+ 2781.4101294962406,
+ 2791.0972305901655,
+ 2800.7927442847094,
+ 2810.4966560062589,
+ 2820.2089512441521,
+ 2829.9296155502466,
+ 2839.6586345384894,
+ 2849.3959938844923,
+ 2859.1416793251065,
+ 2868.8956766580086,
+ 2878.6579717412847,
+ 2888.4285504930212,
+ 2898.2073988908974,
+ 2907.9945029717837,
+ 2917.789848831344,
+ 2927.5934226236377,
+ 2937.4052105607311,
+ 2947.2251989123079,
+ 2957.0533740052865,
+ 2966.8897222234368,
+ 2976.734230007005,
+ 2986.5868838523397,
+ 2996.4476703115197,
+ 3006.3165759919889,
+ 3016.1935875561908,
+ 3026.0786917212095,
+ 3035.9718752584108,
+ 3045.8731249930906,
+ 3055.7824278041207,
+ 3065.6997706236039,
+ 3075.625140436528,
+ 3085.5585242804245,
+ 3095.4999092450298,
+ 3105.4492824719491,
+ 3115.4066311543256,
+ 3125.3719425365089,
+ 3135.3452039137287,
+ 3145.3264026317715,
+ 3155.3155260866592,
+ 3165.3125617243295,
+ 3175.3174970403229,
+ 3185.3303195794679,
+ 3195.35101693557,
+ 3205.3795767511078,
+ 3215.4159867169251,
+ 3225.460234571929,
+ 3235.5123081027928,
+ 3245.5721951436558,
+ 3255.63988357583,
+ 3265.7153613275095,
+ 3275.7986163734795,
+ 3285.8896367348289,
+ 3295.9884104786665,
+ 3306.0949257178395,
+ 3316.2091706106517,
+ 3326.331133360588,
+ 3336.4608022160378,
+ 3346.5981654700231,
+ 3356.7432114599264,
+ 3366.8959285672249,
+ 3377.0563052172211,
+ 3387.2243298787821,
+ 3397.3999910640764,
+ 3407.5832773283128,
+ 3417.7741772694862,
+ 3427.9726795281199,
+ 3438.1787727870123,
+ 3448.3924457709873,
+ 3458.6136872466445,
+ 3468.8424860221107,
+ 3479.0788309467976,
+ 3489.3227109111554,
+ 3499.5741148464344,
+ 3509.8330317244445,
+ 3520.0994505573185,
+ 3530.3733603972751,
+ 3540.6547503363886,
+ 3550.9436095063534,
+ 3561.239927078258,
+ 3571.5436922623535,
+ 3581.8548943078308,
+ 3592.1735225025936,
+ 3602.4995661730372,
+ 3612.8330146838275,
+ 3623.1738574376814,
+ 3633.5220838751502,
+ 3643.8776834744031,
+ 3654.2406457510142,
+ 3664.6109602577494,
+ 3674.9886165843564,
+ 3685.3736043573545,
+ 3695.7659132398294,
+ 3706.1655329312248,
+ 3716.5724531671399,
+ 3726.9866637191262,
+ 3737.4081543944876,
+ 3747.8369150360782,
+ 3758.2729355221072,
+ 3768.7162057659411,
+ 3779.1667157159077,
+ 3789.6244553551055,
+ 3800.0894147012082,
+ 3810.5615838062768,
+ 3821.0409527565694,
+ 3831.5275116723533,
+ 3842.0212507077194,
+ 3852.522160050396,
+ 3863.0302299215673,
+ 3873.5454505756893,
+ 3884.0678123003108,
+ 3894.5973054158922,
+ 3905.1339202756285,
+ 3915.6776472652732,
+ 3926.2284768029604,
+ 3936.7863993390338,
+ 3947.3514053558706,
+ 3957.9234853677135,
+ 3968.5026299204969,
+ 3979.0888295916798,
+ 3989.6820749900776,
+ 4000.2823567556948,
+ 4010.8896655595613,
+ 4021.5039921035655,
+ 4032.1253271202945,
+ 4042.7536613728694,
+ 4053.3889856547858,
+ 4064.0312907897551,
+ 4074.6805676315448,
+ 4085.3368070638221,
+ 4095.9999999999982,
+ 4106.6701373830711,
+ 4117.347210185475,
+ 4128.0312094089259,
+ 4138.722126084268,
+ 4149.4199512713267,
+ 4160.1246760587583,
+ 4170.8362915638982,
+ 4181.5547889326181,
+ 4192.2801593391769,
+ 4203.0123939860741,
+ 4213.7514841039101,
+ 4224.4974209512384,
+ 4235.2501958144258,
+ 4246.0098000075095,
+ 4256.7762248720574,
+ 4267.549461777031,
+ 4278.3295021186423,
+ 4289.1163373202198,
+ 4299.9099588320714,
+ 4310.7103581313495,
+ 4321.5175267219138,
+ 4332.3314561342004,
+ 4343.152137925088,
+ 4353.9795636777671,
+ 4364.8137250016052,
+ 4375.6546135320223,
+ 4386.5022209303588,
+ 4397.3565388837469,
+ 4408.2175591049827,
+ 4419.0852733324018,
+ 4429.9596733297531,
+ 4440.8407508860728,
+ 4451.7284978155603,
+ 4462.6229059574571,
+ 4473.5239671759227,
+ 4484.4316733599126,
+ 4495.3460164230582,
+ 4506.2669883035496,
+ 4517.1945809640119,
+ 4528.1287863913894,
+ 4539.069596596828,
+ 4550.0170036155587,
+ 4560.9709995067806,
+ 4571.931576353546,
+ 4582.898726262647,
+ 4593.8724413645004,
+ 4604.8527138130348,
+ 4615.8395357855816,
+ 4626.8328994827571,
+ 4637.8327971283588,
+ 4648.8392209692511,
+ 4659.8521632752563,
+ 4670.8716163390473,
+ 4681.8975724760394,
+ 4692.9300240242837,
+ 4703.9689633443595,
+ 4715.0143828192668,
+ 4726.0662748543255,
+ 4737.1246318770682,
+ 4748.1894463371373,
+ 4759.2607107061804,
+ 4770.3384174777493,
+ 4781.4225591671993,
+ 4792.5131283115852,
+ 4803.6101174695614,
+ 4814.7135192212854,
+ 4825.8233261683154,
+ 4836.9395309335096,
+ 4848.0621261609349,
+ 4859.1911045157631,
+ 4870.3264586841779,
+ 4881.4681813732768,
+ 4892.6162653109768,
+ 4903.7707032459193,
+ 4914.931487947375,
+ 4926.0986122051509,
+ 4937.2720688294967,
+ 4948.4518506510112,
+ 4959.637950520555,
+ 4970.8303613091521,
+ 4982.0290759079044,
+ 4993.2340872278974,
+ 5004.4453882001153,
+ 5015.6629717753467,
+ 5026.8868309241007,
+ 5038.1169586365131,
+ 5049.353347922266,
+ 5060.5959918104927,
+ 5071.8448833496996,
+ 5083.1000156076734,
+ 5094.3613816713996,
+ 5105.6289746469747,
+ 5116.9027876595246,
+ 5128.18281385312,
+ 5139.4690463906918,
+ 5150.7614784539473,
+ 5162.0601032432933,
+ 5173.3649139777472,
+ 5184.6759038948594,
+ 5195.9930662506322,
+ 5207.3163943194386,
+ 5218.6458813939435,
+ 5229.9815207850224,
+ 5241.3233058216847,
+ 5252.6712298509919,
+ 5264.025286237983,
+ 5275.3854683655954,
+ 5286.7517696345885,
+ 5298.1241834634639,
+ 5309.5027032883945,
+ 5320.887322563146,
+ 5332.2780347589978,
+ 5343.6748333646756,
+ 5355.0777118862716,
+ 5366.4866638471722,
+ 5377.901682787985,
+ 5389.3227622664635,
+ 5400.749895857437,
+ 5412.1830771527357,
+ 5423.622299761123,
+ 5435.067557308219,
+ 5446.5188434364318,
+ 5457.9761518048872,
+ 5469.4394760893592,
+ 5480.9088099821975,
+ 5492.3841471922606,
+ 5503.8654814448455,
+ 5515.3528064816201,
+ 5526.846116060552,
+ 5538.3454039558474,
+ 5549.8506639578736,
+ 5561.3618898731029,
+ 5572.8790755240361,
+ 5584.4022147491451,
+ 5595.9313014027975,
+ 5607.4663293552012,
+ 5619.0072924923297,
+ 5630.5541847158656,
+ 5642.1069999431284,
+ 5653.665732107017,
+ 5665.230375155943,
+ 5676.8009230537655,
+ 5688.3773697797333,
+ 5699.9597093284156,
+ 5711.5479357096474,
+ 5723.1420429484588,
+ 5734.7420250850209,
+ 5746.347876174581,
+ 5757.9595902874016,
+ 5769.5771615087006,
+ 5781.2005839385911,
+ 5792.8298516920213,
+ 5804.4649588987149,
+ 5816.1058997031105,
+ 5827.7526682643065,
+ 5839.4052587559972,
+ 5851.0636653664196,
+ 5862.7278822982908,
+ 5874.3979037687541,
+ 5886.0737240093204,
+ 5897.7553372658094,
+ 5909.4427377982956,
+ 5921.1359198810505,
+ 5932.8348778024874,
+ 5944.5396058651031,
+ 5956.2500983854261,
+ 5967.9663496939575,
+ 5979.6883541351208,
+ 5991.4161060672022,
+ 6003.1495998623004,
+ 6014.8888299062692,
+ 6026.6337905986684,
+ 6038.3844763527022,
+ 6050.1408815951781,
+ 6061.9030007664414,
+ 6073.6708283203316,
+ 6085.4443587241267,
+ 6097.2235864584891,
+ 6109.0085060174197,
+ 6120.7991119081998,
+ 6132.595398651345,
+ 6144.3973607805519,
+ 6156.2049928426459,
+ 6168.0182893975361,
+ 6179.8372450181578,
+ 6191.6618542904307,
+ 6203.4921118132024,
+ 6215.3280121982016,
+ 6227.1695500699925,
+ 6239.0167200659189,
+ 6250.8695168360628,
+ 6262.7279350431891,
+ 6274.5919693627056,
+ 6286.4616144826068,
+ 6298.3368651034316,
+ 6310.2177159382172,
+ 6322.1041617124456,
+ 6333.9961971640032,
+ 6345.8938170431311,
+ 6357.7970161123785,
+ 6369.7057891465583,
+ 6381.6201309327007,
+ 6393.5400362700075,
+ 6405.4654999698032,
+ 6417.3965168554978,
+ 6429.3330817625329,
+ 6441.2751895383453,
+ 6453.2228350423138,
+ 6465.176013145724,
+ 6477.134718731716,
+ 6489.0989466952469,
+ 6501.0686919430445,
+ 6513.0439493935628,
+ 6525.0247139769417,
+ 6537.010980634961,
+ 6549.002744321001,
+ 6560.9999999999973,
+ 6573.0027426483985,
+ 6585.0109672541284,
+ 6597.0246688165371,
+ 6609.0438423463656,
+ 6621.0684828657004,
+ 6633.0985854079354,
+ 6645.134145017727,
+ 6657.1751567509573,
+ 6669.2216156746908,
+ 6681.2735168671343,
+ 6693.3308554176001,
+ 6705.3936264264594,
+ 6717.461825005108,
+ 6729.535446275926,
+ 6741.6144853722335,
+ 6753.6989374382601,
+ 6765.7887976290967,
+ 6777.8840611106634,
+ 6789.9847230596661,
+ 6802.0907786635626,
+ 6814.2022231205201,
+ 6826.3190516393797,
+ 6838.4412594396181,
+ 6850.5688417513074,
+ 6862.701793815083,
+ 6874.840110882099,
+ 6886.9837882139991,
+ 6899.1328210828724,
+ 6911.2872047712199,
+ 6923.4469345719199,
+ 6935.6120057881863,
+ 6947.7824137335365,
+ 6959.9581537317536,
+ 6972.1392211168532,
+ 6984.3256112330409,
+ 6996.5173194346862,
+ 7008.7143410862773,
+ 7020.9166715623942,
+ 7033.1243062476678,
+ 7045.3372405367481,
+ 7057.5554698342685,
+ 7069.7789895548103,
+ 7082.0077951228714,
+ 7094.2418819728273,
+ 7106.4812455489018,
+ 7118.7258813051285,
+ 7130.9757847053224,
+ 7143.2309512230404,
+ 7155.4913763415516,
+ 7167.7570555538041,
+ 7180.0279843623894,
+ 7192.3041582795131,
+ 7204.5855728269571,
+ 7216.8722235360519,
+ 7229.1641059476406,
+ 7241.4612156120484,
+ 7253.7635480890503,
+ 7266.0710989478375,
+ 7278.3838637669869,
+ 7290.7018381344296,
+ 7303.0250176474174,
+ 7315.3533979124932,
+ 7327.6869745454596,
+ 7340.0257431713462,
+ 7352.3696994243801,
+ 7364.7188389479543,
+ 7377.0731573945968,
+ 7389.4326504259407,
+ 7401.7973137126937,
+ 7414.1671429346061,
+ 7426.5421337804428,
+ 7438.922281947951,
+ 7451.3075831438346,
+ 7463.6980330837177,
+ 7476.0936274921214,
+ 7488.4943621024304,
+ 7500.9002326568652,
+ 7513.3112349064522,
+ 7525.7273646109943,
+ 7538.1486175390446,
+ 7550.5749894678729,
+ 7563.0064761834419,
+ 7575.4430734803736,
+ 7587.8847771619248,
+ 7600.3315830399597,
+ 7612.7834869349153,
+ 7625.24048467578,
+ 7637.7025721000637,
+ 7650.1697450537677,
+ 7662.6419993913596,
+ 7675.1193309757446,
+ 7687.6017356782404,
+ 7700.0892093785433,
+ 7712.5817479647112,
+ 7725.079347333125,
+ 7737.5820033884729,
+ 7750.0897120437139,
+ 7762.6024692200581,
+ 7775.1202708469355,
+ 7787.6431128619733,
+ 7800.1709912109645,
+ 7812.7039018478481,
+ 7825.2418407346768,
+ 7837.7848038415968,
+ 7850.3327871468155,
+ 7862.8857866365806,
+ 7875.4437983051539,
+ 7888.006818154784,
+ 7900.5748421956796,
+ 7913.1478664459901,
+ 7925.725886931772,
+ 7938.3088996869719,
+ 7950.8969007533951,
+ 7963.4898861806851,
+ 7976.0878520262959,
+ 7988.6907943554688,
+ 8001.2987092412086,
+ 8013.911592764257,
+ 8026.5294410130691,
+ 8039.1522500837891,
+ 8051.7800160802271,
+ 8064.412735113835,
+ 8077.0504033036796,
+ 8089.6930167764222,
+ 8102.3405716662946,
+ 8114.9930641150731,
+ 8127.6504902720571,
+ 8140.3128462940449,
+ 8152.9801283453098,
+ 8165.6523325975786,
+ 8178.3294552300049,
+ 8191.0114924291529,
+ 8203.6984403889655,
+ 8216.3902953107463,
+ 8229.0870534031419,
+ 8241.7887108821069,
+ 8254.4952639708936,
+ 8267.2067089000211,
+ 8279.9230419072574,
+ 8292.6442592375952,
+ 8305.3703571432306,
+ 8318.101331883543,
+ 8330.8371797250657,
+ 8343.577896941475,
+ 8356.3234798135582,
+ 8369.0739246291978,
+ 8381.8292276833508,
+ 8394.5893852780209,
+ 8407.3543937222421,
+ 8420.1242493320569,
+ 8432.8989484304948,
+ 8445.6784873475499,
+ 8458.4628624201578,
+ 8471.2520699921806,
+ 8484.0461064143838,
+ 8496.8449680444082,
+ 8509.6486512467636,
+ 8522.4571523927953,
+ 8535.270467860666,
+ 8548.0885940353437,
+ 8560.9115273085663,
+ 8573.7392640788403,
+ 8586.5718007514006,
+ 8599.4091337382069,
+ 8612.2512594579148,
+ 8625.0981743358552,
+ 8637.9498748040205,
+ 8650.8063573010386,
+ 8663.6676182721567,
+ 8676.533654169225,
+ 8689.4044614506638,
+ 8702.2800365814601,
+ 8715.1603760331418,
+ 8728.0454762837508,
+ 8740.9353338178389,
+ 8753.8299451264356,
+ 8766.7293067070332,
+ 8779.6334150635721,
+ 8792.5422667064158,
+ 8805.4558581523324,
+ 8818.3741859244819,
+ 8831.2972465523908,
+ 8844.2250365719356,
+ 8857.1575525253265,
+ 8870.0947909610859,
+ 8883.0367484340295,
+ 8895.9834215052524,
+ 8908.934806742107,
+ 8921.8909007181846,
+ 8934.8517000132997,
+ 8947.817201213471,
+ 8960.7874009109,
+ 8973.7622957039603,
+ 8986.7418821971733,
+ 8999.7261570011924,
+ 9012.7151167327884,
+ 9025.7087580148236,
+ 9038.7070774762469,
+ 9051.7100717520643,
+ 9064.7177374833282,
+ 9077.7300713171153,
+ 9090.7470699065179,
+ 9103.7687299106146,
+ 9116.7950479944648,
+ 9129.8260208290812,
+ 9142.8616450914233,
+ 9155.9019174643727,
+ 9168.9468346367157,
+ 9181.9963933031358,
+ 9195.0505901641845,
+ 9208.1094219262741,
+ 9221.1728853016557,
+ 9234.240977008405,
+ 9247.3136937704076,
+ 9260.3910323173386,
+ 9273.472989384647,
+ 9286.5595617135423,
+ 9299.6507460509747,
+ 9312.7465391496207,
+ 9325.8469377678684,
+ 9338.9519386698012,
+ 9352.0615386251757,
+ 9365.1757344094131,
+ 9378.2945228035842,
+ 9391.4179005943843,
+ 9404.5458645741273,
+ 9417.6784115407263,
+ 9430.8155382976747,
+ 9443.9572416540359,
+ 9457.1035184244265,
+ 9470.2543654290002,
+ 9483.4097794934296,
+ 9496.5697574488931,
+ 9509.7342961320664,
+ 9522.9033923850911,
+ 9536.0770430555804,
+ 9549.2552449965824,
+ 9562.4379950665825,
+ 9575.6252901294793,
+ 9588.8171270545736,
+ 9602.0135027165488,
+ 9615.2144139954635,
+ 9628.4198577767274,
+ 9641.629830951093,
+ 9654.844330414644,
+ 9668.0633530687719,
+ 9681.286895820167,
+ 9694.5149555808002,
+ 9707.7475292679192,
+ 9720.9846138040157,
+ 9734.2262061168276,
+ 9747.4723031393187,
+ 9760.7229018096641,
+ 9773.9779990712323,
+ 9787.2375918725811,
+ 9800.5016771674327,
+ 9813.7702519146696,
+ 9827.0433130783094,
+ 9840.3208576275028,
+ 9853.602882536512,
+ 9866.8893847846994,
+ 9880.1803613565116,
+ 9893.4758092414686,
+ 9906.7757254341523,
+ 9920.0801069341851,
+ 9933.3889507462245,
+ 9946.7022538799429,
+ 9960.0200133500221,
+ 9973.3422261761298,
+ 9986.6688893829159,
+ 9999.9999999999945,
+ 10013.335555061929,
+ 10026.675551608221,
+ 10040.019986683301,
+ 10053.368857336509,
+ 10066.722160622081,
+ 10080.079893599144,
+ 10093.442053331697,
+ 10106.808636888598,
+ 10120.179641343551,
+ 10133.555063775095,
+ 10146.934901266595,
+ 10160.31915090622,
+ 10173.707809786936,
+ 10187.100875006496,
+ 10200.498343667417,
+ 10213.900212876984,
+ 10227.306479747222,
+ 10240.717141394889,
+ 10254.132194941467,
+ 10267.551637513146,
+ 10280.975466240814,
+ 10294.40367826004,
+ 10307.836270711066,
+ 10321.273240738796,
+ 10334.71458549278,
+ 10348.160302127204,
+ 10361.610387800878,
+ 10375.064839677221,
+ 10388.523654924258,
+ 10401.986830714593,
+ 10415.454364225412,
+ 10428.926252638465,
+ 10442.402493140049,
+ 10455.883082921007,
+ 10469.368019176709,
+ 10482.85729910704,
+ 10496.350919916393,
+ 10509.848878813653,
+ 10523.351173012188,
+ 10536.857799729838,
+ 10550.3687561889,
+ 10563.884039616123,
+ 10577.403647242685,
+ 10590.927576304197,
+ 10604.455824040679,
+ 10617.988387696556,
+ 10631.525264520642,
+ 10645.066451766135,
+ 10658.611946690598,
+ 10672.161746555956,
+ 10685.715848628475,
+ 10699.274250178762,
+ 10712.836948481747,
+ 10726.403940816675,
+ 10739.975224467091,
+ 10753.550796720834,
+ 10767.130654870027,
+ 10780.714796211059,
+ 10794.303218044579,
+ 10807.895917675487,
+ 10821.492892412922,
+ 10835.094139570248,
+ 10848.699656465047,
+ 10862.309440419107,
+ 10875.923488758415,
+ 10889.541798813138,
+ 10903.16436791762,
+ 10916.791193410372,
+ 10930.422272634056,
+ 10944.05760293548,
+ 10957.697181665582,
+ 10971.341006179427,
+ 10984.98907383619,
+ 10998.641381999149,
+ 11012.297928035676,
+ 11025.958709317223,
+ 11039.623723219316,
+ 11053.292967121541,
+ 11066.966438407539,
+ 11080.64413446499,
+ 11094.326052685608,
+ 11108.012190465128,
+ 11121.702545203296,
+ 11135.397114303863,
+ 11149.095895174571,
+ 11162.798885227143,
+ 11176.506081877278,
+ 11190.217482544635,
+ 11203.933084652828,
+ 11217.652885629415,
+ 11231.376882905886,
+ 11245.105073917659,
+ 11258.837456104062,
+ 11272.574026908333,
+ 11286.314783777601,
+ 11300.059724162888,
+ 11313.808845519083,
+ 11327.562145304952,
+ 11341.319620983111,
+ 11355.081270020033,
+ 11368.847089886023,
+ 11382.617078055218,
+ 11396.391232005579,
+ 11410.169549218874,
+ 11423.952027180676,
+ 11437.738663380349,
+ 11451.529455311042,
+ 11465.324400469679,
+ 11479.123496356951,
+ 11492.926740477304,
+ 11506.734130338931,
+ 11520.545663453764,
+ 11534.361337337466,
+ 11548.181149509423,
+ 11562.005097492724,
+ 11575.83317881417,
+ 11589.665391004253,
+ 11603.501731597149,
+ 11617.342198130715,
+ 11631.186788146468,
+ 11645.035499189589,
+ 11658.888328808911,
+ 11672.745274556904,
+ 11686.606333989675,
+ 11700.471504666955,
+ 11714.340784152086,
+ 11728.214170012021,
+ 11742.091659817312,
+ 11755.973251142101,
+ 11769.858941564111,
+ 11783.748728664636,
+ 11797.642610028539,
+ 11811.540583244237,
+ 11825.442645903697,
+ 11839.34879560242,
+ 11853.259029939445,
+ 11867.173346517333,
+ 11881.091742942155,
+ 11895.014216823492,
+ 11908.940765774427,
+ 11922.871387411526,
+ 11936.806079354839,
+ 11950.744839227897,
+ 11964.687664657684,
+ 11978.634553274653,
+ 11992.585502712702,
+ 12006.540510609168,
+ 12020.499574604828,
+ 12034.462692343877,
+ 12048.429861473938,
+ 12062.401079646032,
+ 12076.376344514589,
+ 12090.355653737433,
+ 12104.339004975769,
+ 12118.326395894188,
+ 12132.317824160644,
+ 12146.313287446457,
+ 12160.312783426305,
+ 12174.316309778205,
+ 12188.323864183525,
+ 12202.335444326955,
+ 12216.351047896511,
+ 12230.370672583531,
+ 12244.394316082657,
+ 12258.421976091831,
+ 12272.453650312296,
+ 12286.489336448574,
+ 12300.529032208471,
+ 12314.572735303058,
+ 12328.620443446678,
+ 12342.672154356922,
+ 12356.727865754638,
+ 12370.787575363909,
+ 12384.851280912055,
+ 12398.918980129623,
+ 12412.990670750381,
+ 12427.066350511306,
+ 12441.146017152583,
+ 12455.229668417589,
+ 12469.317302052901,
+ 12483.40891580827,
+ 12497.50450743663,
+ 12511.604074694078,
+ 12525.707615339878,
+ 12539.815127136444,
+ 12553.926607849342,
+ 12568.042055247275,
+ 12582.161467102082,
+ 12596.284841188726,
+ 12610.41217528529,
+ 12624.543467172971,
+ 12638.678714636069,
+ 12652.817915461985,
+ 12666.961067441209,
+ 12681.108168367316,
+ 12695.259216036962,
+ 12709.414208249869,
+ 12723.573142808827,
+ 12737.736017519681,
+ 12751.902830191326,
+ 12766.073578635704,
+ 12780.248260667788,
+ 12794.426874105588,
+ 12808.609416770132,
+ 12822.795886485468,
+ 12836.986281078653,
+ 12851.180598379744,
+ 12865.378836221802,
+ 12879.580992440871,
+ 12893.787064875984,
+ 12907.997051369144,
+ 12922.210949765335,
+ 12936.428757912496,
+ 12950.650473661524,
+ 12964.876094866273,
+ 12979.105619383534,
+ 12993.339045073039,
+ 13007.576369797454,
+ 13021.817591422368,
+ 13036.062707816285,
+ 13050.311716850629,
+ 13064.564616399723,
+ 13078.821404340792,
+ 13093.082078553954,
+ 13107.346636922217,
+ 13121.615077331464,
+ 13135.887397670458,
+ 13150.163595830827,
+ 13164.44366970706,
+ 13178.727617196502,
+ 13193.015436199352,
+ 13207.307124618648,
+ 13221.602680360265,
+ 13235.902101332911,
+ 13250.205385448118,
+ 13264.512530620239,
+ 13278.823534766434,
+ 13293.138395806676,
+ 13307.457111663734,
+ 13321.779680263176,
+ 13336.106099533356,
+ 13350.436367405409,
+ 13364.77048181325,
+ 13379.108440693562,
+ 13393.450241985796,
+ 13407.795883632158,
+ 13422.145363577607,
+ 13436.498679769853,
+ 13450.855830159346,
+ 13465.216812699266,
+ 13479.581625345529,
+ 13493.950266056772,
+ 13508.32273279435,
+ 13522.699023522329,
+ 13537.079136207483,
+ 13551.463068819286,
+ 13565.850819329906,
+ 13580.2423857142,
+ 13594.63776594971,
+ 13609.036958016657,
+ 13623.439959897927,
+ 13637.846769579081,
+ 13652.257385048335,
+ 13666.67180429656,
+ 13681.090025317284,
+ 13695.512046106669,
+ 13709.937864663521,
+ 13724.367478989278,
+ 13738.800887088004,
+ 13753.238086966385,
+ 13767.679076633727,
+ 13782.123854101939,
+ 13796.572417385545,
+ 13811.024764501659,
+ 13825.480893469998,
+ 13839.94080231286,
+ 13854.404489055134,
+ 13868.871951724283,
+ 13883.34318835034,
+ 13897.818196965914,
+ 13912.296975606168,
+ 13926.779522308825,
+ 13941.26583511416,
+ 13955.755912064991,
+ 13970.249751206682,
+ 13984.747350587126,
+ 13999.248708256751,
+ 14013.753822268511,
+ 14028.262690677873,
+ 14042.775311542828,
+ 14057.291682923867,
+ 14071.811802883994,
+ 14086.335669488704,
+ 14100.863280805994,
+ 14115.394634906341,
+ 14129.92972986271,
+ 14144.468563750548,
+ 14159.01113464777,
+ 14173.55744063476,
+ 14188.107479794369,
+ 14202.661250211901,
+ 14217.218749975118,
+ 14231.779977174227,
+ 14246.344929901879,
+ 14260.913606253163,
+ 14275.486004325601,
+ 14290.062122219146,
+ 14304.641958036171,
+ 14319.225509881464,
+ 14333.812775862236,
+ 14348.403754088098,
+ 14362.998442671067,
+ 14377.59683972556,
+ 14392.198943368388,
+ 14406.804751718748,
+ 14421.414262898223,
+ 14436.027475030774,
+ 14450.64438624274,
+ 14465.264994662828,
+ 14479.889298422106,
+ 14494.517295654005,
+ 14509.148984494313,
+ 14523.784363081166,
+ 14538.423429555049,
+ 14553.066182058781,
+ 14567.712618737527,
+ 14582.362737738777,
+ 14597.016537212348,
+ 14611.674015310382,
+ 14626.33517018734,
+ 14640.999999999993,
+ 14655.668502907418,
+ 14670.340677071003,
+ 14685.016520654426,
+ 14699.696031823671,
+ 14714.379208746999,
+ 14729.066049594967,
+ 14743.756552540408,
+ 14758.45071575843,
+ 14773.148537426418,
+ 14787.850015724018,
+ 14802.555148833142,
+ 14817.263934937961,
+ 14831.976372224897,
+ 14846.692458882624,
+ 14861.41219310206,
+ 14876.135573076363,
+ 14890.862597000923,
+ 14905.593263073371,
+ 14920.327569493558,
+ 14935.065514463557,
+ 14949.807096187662,
+ 14964.552312872382,
+ 14979.301162726431,
+ 14994.053643960735,
+ 15008.809754788414,
+ 15023.569493424788,
+ 15038.332858087369,
+ 15053.099846995858,
+ 15067.870458372134,
+ 15082.644690440264,
+ 15097.422541426484,
+ 15112.204009559202,
+ 15126.989093068994,
+ 15141.777790188597,
+ 15156.570099152905,
+ 15171.366018198967,
+ 15186.165545565986,
+ 15200.968679495301,
+ 15215.775418230402,
+ 15230.585760016909,
+ 15245.399703102579,
+ 15260.217245737298,
+ 15275.038386173073,
+ 15289.863122664035,
+ 15304.691453466432,
+ 15319.523376838621,
+ 15334.358891041069,
+ 15349.197994336346,
+ 15364.040684989128,
+ 15378.886961266177,
+ 15393.736821436356,
+ 15408.590263770609,
+ 15423.447286541972,
+ 15438.307888025554,
+ 15453.172066498542,
+ 15468.039820240196,
+ 15482.91114753184,
+ 15497.786046656869,
+ 15512.664515900733,
+ 15527.546553550939,
+ 15542.432157897045,
+ 15557.32132723066,
+ 15572.214059845435,
+ 15587.110354037064,
+ 15602.010208103273,
+ 15616.913620343823,
+ 15631.820589060506,
+ 15646.731112557136,
+ 15661.645189139546,
+ 15676.562817115593,
+ 15691.483994795139,
+ 15706.408720490062,
+ 15721.336992514242,
+ 15736.268809183561,
+ 15751.204168815901,
+ 15766.143069731135,
+ 15781.085510251132,
+ 15796.03148869974,
+ 15810.981003402798,
+ 15825.934052688119,
+ 15840.890634885489,
+ 15855.850748326673,
+ 15870.814391345401,
+ 15885.781562277361,
+ 15900.752259460214,
+ 15915.726481233565,
+ 15930.704225938984,
+ 15945.685491919978,
+ 15960.670277522009,
+ 15975.658581092481,
+ 15990.65040098073,
+ 16005.645735538035,
+ 16020.644583117599,
+ 16035.646942074556,
+ 16050.652810765967,
+ 16065.662187550806,
+ 16080.675070789974,
+ 16095.691458846273,
+ 16110.711350084424,
+ 16125.734742871053,
+ 16140.761635574685,
+ 16155.792026565747,
+ 16170.825914216561,
+ 16185.863296901338,
+ 16200.904172996183,
+ 16215.948540879079,
+ 16230.996398929899,
+ 16246.047745530386,
+ 16261.102579064163,
+ 16276.160897916721,
+ 16291.22270047542,
+ 16306.287985129484,
+ 16321.356750269995,
+ 16336.428994289896,
+ 16351.504715583982,
+ 16366.5839125489,
+ 16381.666583583141,
+ 16396.752727087041,
+ 16411.842341462776,
+ 16426.935425114363,
+ 16442.031976447644,
+ 16457.131993870298,
+ 16472.235475791829,
+ 16487.342420623561,
+ 16502.452826778641,
+ 16517.566692672033,
+ 16532.684016720516,
+ 16547.804797342676,
+ 16562.929032958902,
+ 16578.056721991394,
+ 16593.18786286415,
+ 16608.322454002962,
+ 16623.460493835417,
+ 16638.601980790896,
+ 16653.746913300558,
+ 16668.895289797354,
+ 16684.047108716015,
+ 16699.202368493046,
+ 16714.361067566726,
+ 16729.523204377107,
+ 16744.688777366009,
+ 16759.857784977012,
+ 16775.030225655464,
+ 16790.206097848466,
+ 16805.385400004874,
+ 16820.568130575302,
+ 16835.754288012104,
+ 16850.943870769381,
+ 16866.136877302983,
+ 16881.333306070494,
+ 16896.53315553123,
+ 16911.736424146249,
+ 16926.943110378332,
+ 16942.153212691992,
+ 16957.366729553454,
+ 16972.583659430682,
+ 16987.804000793338,
+ 17003.027752112816,
+ 17018.254911862205,
+ 17033.485478516312,
+ 17048.719450551645,
+ 17063.956826446421,
+ 17079.197604680547,
+ 17094.44178373563,
+ 17109.689362094967,
+ 17124.940338243552,
+ 17140.194710668064,
+ 17155.452477856852,
+ 17170.713638299967,
+ 17185.978190489128,
+ 17201.246132917724,
+ 17216.517464080825,
+ 17231.792182475165,
+ 17247.070286599141,
+ 17262.351774952826,
+ 17277.636646037936,
+ 17292.924898357855,
+ 17308.216530417623,
+ 17323.511540723921,
+ 17338.809927785089,
+ 17354.111690111105,
+ 17369.416826213594,
+ 17384.725334605821,
+ 17400.037213802683,
+ 17415.352462320716,
+ 17430.67107867809,
+ 17445.993061394587,
+ 17461.318408991636,
+ 17476.647119992274,
+ 17491.979192921168,
+ 17507.314626304586,
+ 17522.653418670423,
+ 17537.995568548187,
+ 17553.341074468986,
+ 17568.689934965536,
+ 17584.042148572156,
+ 17599.397713824768,
+ 17614.75662926089,
+ 17630.118893419625,
+ 17645.484504841683,
+ 17660.853462069354,
+ 17676.225763646511,
+ 17691.601408118619,
+ 17706.980394032718,
+ 17722.362719937424,
+ 17737.748384382936,
+ 17753.137385921014,
+ 17768.529723104999,
+ 17783.92539448979,
+ 17799.324398631856,
+ 17814.726734089225,
+ 17830.13239942148,
+ 17845.541393189767,
+ 17860.95371395678,
+ 17876.369360286772,
+ 17891.788330745527,
+ 17907.210623900395,
+ 17922.636238320254,
+ 17938.065172575527,
+ 17953.497425238176,
+ 17968.932994881692,
+ 17984.371880081104,
+ 17999.814079412972,
+ 18015.259591455371,
+ 18030.708414787914,
+ 18046.160547991731,
+ 18061.615989649465,
+ 18077.074738345284,
+ 18092.536792664861,
+ 18108.002151195393,
+ 18123.470812525571,
+ 18138.942775245599,
+ 18154.418037947191,
+ 18169.896599223546,
+ 18185.37845766938,
+ 18200.863611880886,
+ 18216.352060455767,
+ 18231.843801993204,
+ 18247.338835093873,
+ 18262.837158359936,
+ 18278.338770395032,
+ 18293.84366980429,
+ 18309.351855194309,
+ 18324.863325173166,
+ 18340.378078350412,
+ 18355.896113337069,
+ 18371.417428745623,
+ 18386.942023190033,
+ 18402.469895285718,
+ 18418.00104364955,
+ 18433.53546689987,
+ 18449.073163656474,
+ 18464.614132540602,
+ 18480.158372174956,
+ 18495.705881183676,
+ 18511.256658192357,
+ 18526.810701828035,
+ 18542.368010719183,
+ 18557.928583495715,
+ 18573.492418788985,
+ 18589.059515231773,
+ 18604.629871458303,
+ 18620.203486104212,
+ 18635.78035780658,
+ 18651.360485203899,
+ 18666.943866936086,
+ 18682.53050164448,
+ 18698.120387971841,
+ 18713.713524562332,
+ 18729.30991006154,
+ 18744.909543116457,
+ 18760.512422375479,
+ 18776.118546488418,
+ 18791.727914106479,
+ 18807.340523882274,
+ 18822.95637446981,
+ 18838.575464524489,
+ 18854.197792703111,
+ 18869.823357663863,
+ 18885.452158066328,
+ 18901.08419257147,
+ 18916.719459841639,
+ 18932.357958540564,
+ 18947.999687333362,
+ 18963.644644886521,
+ 18979.292829867907,
+ 18994.944240946759,
+ 19010.598876793687,
+ 19026.256736080668,
+ 19041.917817481048,
+ 19057.582119669532,
+ 19073.2496413222,
+ 19088.920381116473,
+ 19104.594337731145,
+ 19120.271509846356,
+ 19135.951896143604,
+ 19151.635495305738,
+ 19167.322306016948,
+ 19183.012326962784,
+ 19198.705556830122,
+ 19214.401994307198,
+ 19230.101638083579,
+ 19245.804486850167,
+ 19261.510539299208,
+ 19277.219794124274,
+ 19292.932250020265,
+ 19308.647905683421,
+ 19324.366759811302,
+ 19340.088811102793,
+ 19355.8140582581,
+ 19371.542499978754,
+ 19387.2741349676,
+ 19403.008961928797,
+ 19418.746979567823,
+ 19434.488186591469,
+ 19450.232581707827,
+ 19465.980163626304,
+ 19481.730931057613,
+ 19497.484882713761,
+ 19513.242017308068,
+ 19529.002333555141,
+ 19544.765830170898,
+ 19560.532505872539,
+ 19576.302359378566,
+ 19592.075389408761,
+ 19607.851594684209,
+ 19623.630973927269,
+ 19639.41352586159,
+ 19655.199249212103,
+ 19670.988142705017,
+ 19686.780205067826,
+ 19702.575435029288,
+ 19718.373831319448,
+ 19734.175392669615,
+ 19749.980117812371,
+ 19765.788005481569,
+ 19781.599054412323,
+ 19797.413263341008,
+ 19813.230631005274,
+ 19829.051156144014,
+ 19844.874837497395,
+ 19860.701673806827,
+ 19876.531663814985,
+ 19892.364806265789,
+ 19908.201099904403,
+ 19924.040543477258,
+ 19939.883135732012,
+ 19955.728875417579,
+ 19971.577761284105,
+ 19987.429792082985,
+ 20003.284966566847,
+ 20019.14328348956,
+ 20035.004741606219,
+ 20050.869339673161,
+ 20066.737076447946,
+ 20082.607950689362,
+ 20098.481961157428,
+ 20114.359106613385,
+ 20130.239385819699,
+ 20146.122797540058,
+ 20162.009340539353,
+ 20177.899013583716,
+ 20193.791815440476,
+ 20209.687744878182,
+ 20225.586800666591,
+ 20241.488981576669,
+ 20257.394286380597,
+ 20273.302713851754,
+ 20289.214262764715,
+ 20305.128931895277,
+ 20321.046720020415,
+ 20336.967625918318,
+ 20352.891648368361,
+ 20368.818786151114,
+ 20384.749038048347,
+ 20400.682402843009,
+ 20416.618879319249,
+ 20432.558466262391,
+ 20448.501162458953,
+ 20464.446966696629,
+ 20480.395877764302,
+ 20496.347894452025,
+ 20512.303015551031,
+ 20528.261239853735,
+ 20544.22256615372,
+ 20560.186993245738,
+ 20576.15451992572,
+ 20592.125144990758,
+ 20608.098867239107,
+ 20624.075685470198,
+ 20640.055598484618,
+ 20656.038605084115,
+ 20672.024704071595,
+ 20688.013894251126,
+ 20704.006174427926,
+ 20720.001543408373,
+ 20735.999999999989,
+ 20752.001543011454,
+ 20768.006171252597,
+ 20784.013883534382,
+ 20800.024678668931,
+ 20816.038555469506,
+ 20832.055512750507,
+ 20848.075549327474,
+ 20864.098664017085,
+ 20880.124855637161,
+ 20896.154123006647,
+ 20912.186464945626,
+ 20928.221880275312,
+ 20944.260367818049,
+ 20960.301926397311,
+ 20976.346554837684,
+ 20992.394251964895,
+ 21008.445016605787,
+ 21024.498847588318,
+ 21040.555743741574,
+ 21056.615703895754,
+ 21072.678726882168,
+ 21088.744811533252,
+ 21104.813956682538,
+ 21120.886161164683,
+ 21136.961423815443,
+ 21153.039743471683,
+ 21169.121118971379,
+ 21185.205549153605,
+ 21201.293032858535,
+ 21217.383568927453,
+ 21233.477156202731,
+ 21249.573793527841,
+ 21265.673479747358,
+ 21281.776213706937,
+ 21297.881994253334,
+ 21313.990820234398,
+ 21330.102690499054,
+ 21346.21760389733,
+ 21362.335559280327,
+ 21378.456555500241,
+ 21394.580591410333,
+ 21410.707665864964,
+ 21426.83777771956,
+ 21442.970925830628,
+ 21459.107109055756,
+ 21475.246326253604,
+ 21491.388576283895,
+ 21507.533858007431,
+ 21523.682170286087,
+ 21539.833511982797,
+ 21555.987881961566,
+ 21572.145279087465,
+ 21588.305702226615,
+ 21604.469150246216,
+ 21620.635622014521,
+ 21636.805116400832,
+ 21652.977632275521,
+ 21669.153168510009,
+ 21685.331723976764,
+ 21701.513297549318,
+ 21717.697888102244,
+ 21733.885494511167,
+ 21750.076115652759,
+ 21766.269750404736,
+ 21782.466397645861,
+ 21798.666056255934,
+ 21814.868725115801,
+ 21831.074403107345,
+ 21847.283089113484,
+ 21863.494782018177,
+ 21879.709480706417,
+ 21895.927184064229,
+ 21912.147890978667,
+ 21928.371600337818,
+ 21944.598311030797,
+ 21960.828021947746,
+ 21977.060731979829,
+ 21993.296440019243,
+ 22009.535144959198,
+ 22025.77684569393,
+ 22042.021541118691,
+ 22058.269230129757,
+ 22074.519911624411,
+ 22090.773584500959,
+ 22107.030247658717,
+ 22123.289899998013,
+ 22139.552540420187,
+ 22155.818167827587,
+ 22172.086781123569,
+ 22188.358379212495,
+ 22204.632960999726,
+ 22220.910525391639,
+ 22237.191071295601,
+ 22253.474597619981,
+ 22269.761103274148,
+ 22286.050587168469,
+ 22302.343048214312,
+ 22318.638485324027,
+ 22334.936897410968,
+ 22351.23828338947,
+ 22367.542642174871,
+ 22383.849972683485,
+ 22400.160273832618,
+ 22416.473544540564,
+ 22432.789783726603,
+ 22449.108990310986,
+ 22465.431163214958,
+ 22481.75630136074,
+ 22498.084403671528,
+ 22514.415469071497,
+ 22530.749496485802,
+ 22547.086484840562,
+ 22563.426433062879,
+ 22579.769340080824,
+ 22596.115204823436,
+ 22612.464026220721,
+ 22628.815803203655,
+ 22645.170534704179,
+ 22661.5282196552,
+ 22677.888856990587,
+ 22694.252445645168,
+ 22710.618984554734,
+ 22726.988472656034,
+ 22743.360908886778,
+ 22759.736292185622,
+ 22776.114621492186,
+ 22792.495895747044,
+ 22808.880113891719,
+ 22825.267274868678,
+ 22841.657377621348,
+ 22858.050421094096,
+ 22874.446404232243,
+ 22890.845325982053,
+ 22907.247185290722,
+ 22923.651981106406,
+ 22940.059712378195,
+ 22956.470378056114,
+ 22972.883977091129,
+ 22989.300508435153,
+ 23005.719971041017,
+ 23022.142363862498,
+ 23038.567685854305,
+ 23054.995935972078,
+ 23071.427113172387,
+ 23087.86121641273,
+ 23104.298244651531,
+ 23120.738196848146,
+ 23137.181071962848,
+ 23153.626868956846,
+ 23170.075586792263,
+ 23186.527224432142,
+ 23202.981780840448,
+ 23219.439254982066,
+ 23235.899645822796,
+ 23252.362952329357,
+ 23268.829173469378,
+ 23285.298308211408,
+ 23301.770355524899,
+ 23318.245314380223,
+ 23334.723183748658,
+ 23351.203962602387,
+ 23367.687649914504,
+ 23384.174244659007,
+ 23400.663745810798,
+ 23417.15615234568,
+ 23433.651463240367,
+ 23450.149677472462,
+ 23466.650794020472,
+ 23483.154811863806,
+ 23499.661729982763,
+ 23516.171547358543,
+ 23532.684262973235,
+ 23549.199875809823,
+ 23565.718384852185,
+ 23582.239789085092,
+ 23598.764087494197,
+ 23615.291279066041,
+ 23631.821362788058,
+ 23648.354337648565,
+ 23664.890202636761,
+ 23681.428956742733,
+ 23697.970598957443,
+ 23714.515128272738,
+ 23731.062543681343,
+ 23747.612844176863,
+ 23764.166028753778,
+ 23780.72209640744,
+ 23797.281046134085,
+ 23813.842876930816,
+ 23830.407587795606,
+ 23846.975177727301,
+ 23863.545645725622,
+ 23880.11899079115,
+ 23896.695211925336,
+ 23913.274308130498,
+ 23929.856278409821,
+ 23946.441121767348,
+ 23963.028837207989,
+ 23979.619423737513,
+ 23996.212880362549,
+ 24012.809206090584,
+ 24029.408399929966,
+ 24046.010460889898,
+ 24062.615387980433,
+ 24079.223180212492,
+ 24095.833836597827,
+ 24112.447356149063,
+ 24129.063737879667,
+ 24145.682980803951,
+ 24162.305083937081,
+ 24178.930046295067,
+ 24195.557866894767,
+ 24212.188544753884,
+ 24228.822078890964,
+ 24245.458468325389,
+ 24262.097712077397,
+ 24278.739809168052,
+ 24295.384758619261,
+ 24312.032559453768,
+ 24328.683210695162,
+ 24345.336711367858,
+ 24361.993060497109,
+ 24378.652257108995,
+ 24395.314300230442,
+ 24411.979188889192,
+ 24428.646922113825,
+ 24445.317498933746,
+ 24461.990918379193,
+ 24478.667179481225,
+ 24495.346281271726,
+ 24512.028222783407,
+ 24528.713003049801,
+ 24545.400621105266,
+ 24562.091075984976,
+ 24578.784366724925,
+ 24595.480492361927,
+ 24612.179451933614,
+ 24628.881244478438,
+ 24645.585869035654,
+ 24662.293324645343,
+ 24679.003610348394,
+ 24695.716725186514,
+ 24712.432668202211,
+ 24729.151438438807,
+ 24745.873034940436,
+ 24762.597456752032,
+ 24779.324702919344,
+ 24796.054772488926,
+ 24812.787664508123,
+ 24829.5233780251,
+ 24846.261912088819,
+ 24863.003265749034,
+ 24879.747438056307,
+ 24896.494428062004,
+ 24913.244234818278,
+ 24929.996857378079,
+ 24946.752294795166,
+ 24963.510546124078,
+ 24980.271610420157,
+ 24997.035486739525,
+ 25013.802174139113,
+ 25030.571671676629,
+ 25047.343978410572,
+ 25064.119093400237,
+ 25080.897015705697,
+ 25097.677744387816,
+ 25114.461278508239,
+ 25131.2476171294,
+ 25148.036759314517,
+ 25164.828704127583,
+ 25181.623450633375,
+ 25198.42099789745,
+ 25215.221344986145,
+ 25232.024490966574,
+ 25248.830434906627,
+ 25265.639175874974,
+ 25282.450712941049,
+ 25299.265045175071,
+ 25316.082171648024,
+ 25332.902091431668,
+ 25349.724803598532,
+ 25366.550307221914,
+ 25383.378601375884,
+ 25400.209685135269,
+ 25417.043557575678,
+ 25433.880217773472,
+ 25450.719664805783,
+ 25467.561897750507,
+ 25484.406915686297,
+ 25501.254717692573,
+ 25518.105302849512,
+ 25534.958670238051,
+ 25551.814818939893,
+ 25568.67374803748,
+ 25585.535456614027,
+ 25602.399943753502,
+ 25619.267208540619,
+ 25636.137250060852,
+ 25653.010067400432,
+ 25669.885659646327,
+ 25686.76402588627,
+ 25703.645165208734,
+ 25720.529076702944,
+ 25737.415759458876,
+ 25754.305212567244,
+ 25771.197435119517,
+ 25788.092426207899,
+ 25804.990184925344,
+ 25821.890710365547,
+ 25838.794001622944,
+ 25855.700057792714,
+ 25872.608877970775,
+ 25889.520461253778,
+ 25906.434806739118,
+ 25923.351913524923,
+ 25940.271780710063,
+ 25957.194407394138,
+ 25974.11979267748,
+ 25991.047935661154,
+ 26007.978835446964,
+ 26024.912491137442,
+ 26041.848901835841,
+ 26058.788066646157,
+ 26075.729984673108,
+ 26092.674655022136,
+ 26109.622076799409,
+ 26126.572249111829,
+ 26143.525171067016,
+ 26160.480841773315,
+ 26177.43926033979,
+ 26194.400425876229,
+ 26211.364337493149,
+ 26228.330994301767,
+ 26245.30039541404,
+ 26262.272539942627,
+ 26279.247427000919,
+ 26296.225055703002,
+ 26313.205425163702,
+ 26330.188534498539,
+ 26347.174382823756,
+ 26364.162969256304,
+ 26381.154292913852,
+ 26398.148352914774,
+ 26415.145148378149,
+ 26432.144678423778,
+ 26449.146942172156,
+ 26466.151938744493,
+ 26483.159667262702,
+ 26500.170126849403,
+ 26517.183316627921,
+ 26534.199235722277,
+ 26551.217883257199,
+ 26568.239258358124,
+ 26585.263360151173,
+ 26602.290187763181,
+ 26619.319740321676,
+ 26636.352016954883,
+ 26653.387016791727,
+ 26670.424738961825,
+ 26687.465182595493,
+ 26704.508346823739,
+ 26721.554230778267,
+ 26738.602833591467,
+ 26755.65415439643,
+ 26772.708192326929,
+ 26789.764946517433,
+ 26806.824416103096,
+ 26823.886600219761,
+ 26840.95149800396,
+ 26858.019108592915,
+ 26875.089431124517,
+ 26892.162464737365,
+ 26909.238208570721,
+ 26926.316661764544,
+ 26943.397823459472,
+ 26960.481692796813,
+ 26977.568268918571,
+ 26994.657550967422,
+ 27011.749538086722,
+ 27028.844229420498,
+ 27045.941624113464,
+ 27063.041721311005,
+ 27080.144520159181,
+ 27097.250019804727,
+ 27114.35821939505,
+ 27131.469118078236,
+ 27148.582715003027,
+ 27165.699009318858,
+ 27182.818000175819,
+ 27199.939686724665,
+ 27217.064068116837,
+ 27234.191143504428,
+ 27251.320912040203,
+ 27268.453372877593,
+ 27285.588525170693,
+ 27302.726368074269,
+ 27319.866900743735,
+ 27337.010122335181,
+ 27354.156032005358,
+ 27371.304628911668,
+ 27388.455912212183,
+ 27405.609881065626,
+ 27422.766534631384,
+ 27439.925872069507,
+ 27457.087892540683,
+ 27474.252595206275,
+ 27491.419979228293,
+ 27508.5900437694,
+ 27525.762787992917,
+ 27542.93821106281,
+ 27560.116312143706,
+ 27577.297090400876,
+ 27594.480545000242,
+ 27611.666675108383,
+ 27628.855479892518,
+ 27646.046958520514,
+ 27663.241110160889,
+ 27680.437933982801,
+ 27697.637429156068,
+ 27714.839594851132,
+ 27732.04443023909,
+ 27749.251934491687,
+ 27766.462106781299,
+ 27783.674946280949,
+ 27800.890452164302,
+ 27818.108623605654,
+ 27835.329459779954,
+ 27852.55295986278,
+ 27869.779123030345,
+ 27887.007948459504,
+ 27904.239435327745,
+ 27921.473582813196,
+ 27938.710390094613,
+ 27955.949856351392,
+ 27973.19198076355,
+ 27990.436762511745,
+ 28007.684200777272,
+ 28024.934294742041,
+ 28042.187043588601,
+ 28059.442446500128,
+ 28076.700502660427,
+ 28093.961211253929,
+ 28111.224571465693,
+ 28128.490582481401,
+ 28145.759243487362,
+ 28163.030553670509,
+ 28180.304512218394,
+ 28197.581118319198,
+ 28214.860371161725,
+ 28232.14226993539,
+ 28249.42681383024,
+ 28266.71400203693,
+ 28284.003833746745,
+ 28301.296308151585,
+ 28318.591424443959,
+ 28335.889181817001,
+ 28353.189579464462,
+ 28370.492616580705,
+ 28387.798292360701,
+ 28405.106606000048,
+ 28422.417556694945,
+ 28439.731143642206,
+ 28457.047366039264,
+ 28474.366223084147,
+ 28491.687713975512,
+ 28509.011837912611,
+ 28526.338594095305,
+ 28543.667981724069,
+ 28560.999999999982,
+ 28578.334648124732,
+ 28595.671925300605,
+ 28613.011830730498,
+ 28630.354363617909,
+ 28647.699523166943,
+ 28665.0473085823,
+ 28682.397719069289,
+ 28699.750753833818,
+ 28717.10641208239,
+ 28734.464693022121,
+ 28751.825595860708,
+ 28769.189119806462,
+ 28786.55526406828,
+ 28803.924027855664,
+ 28821.295410378701,
+ 28838.669410848088,
+ 28856.046028475103,
+ 28873.425262471628,
+ 28890.80711205013,
+ 28908.191576423673,
+ 28925.578654805915,
+ 28942.968346411097,
+ 28960.360650454055,
+ 28977.755566150216,
+ 28995.153092715591,
+ 29012.553229366786,
+ 29029.955975320987,
+ 29047.361329795975,
+ 29064.769292010107,
+ 29082.179861182336,
+ 29099.593036532187,
+ 29117.00881727978,
+ 29134.427202645813,
+ 29151.848191851568,
+ 29169.271784118911,
+ 29186.697978670283,
+ 29204.126774728706,
+ 29221.55817151779,
+ 29238.992168261717,
+ 29256.42876418525,
+ 29273.867958513725,
+ 29291.309750473058,
+ 29308.754139289747,
+ 29326.201124190855,
+ 29343.65070440403,
+ 29361.102879157483,
+ 29378.557647680012,
+ 29396.015009200975,
+ 29413.474962950309,
+ 29430.937508158524,
+ 29448.402644056692,
+ 29465.870369876469,
+ 29483.340684850071,
+ 29500.81358821028,
+ 29518.289079190454,
+ 29535.767157024511,
+ 29553.247820946945,
+ 29570.731070192807,
+ 29588.216903997723,
+ 29605.70532159787,
+ 29623.19632223,
+ 29640.689905131429,
+ 29658.186069540028,
+ 29675.684814694236,
+ 29693.186139833047,
+ 29710.690044196028,
+ 29728.196527023298,
+ 29745.705587555527,
+ 29763.217225033964,
+ 29780.731438700397,
+ 29798.248227797183,
+ 29815.76759156723,
+ 29833.289529254005,
+ 29850.81404010153,
+ 29868.341123354381,
+ 29885.870778257693,
+ 29903.403004057145,
+ 29920.937799998974,
+ 29938.475165329975,
+ 29956.015099297485,
+ 29973.557601149394,
+ 29991.102670134147,
+ 30008.650305500738,
+ 30026.200506498706,
+ 30043.753272378144,
+ 30061.308602389683,
+ 30078.866495784507,
+ 30096.426951814352,
+ 30113.989969731494,
+ 30131.55554878875,
+ 30149.123688239491,
+ 30166.694387337629,
+ 30184.267645337608,
+ 30201.843461494434,
+ 30219.42183506364,
+ 30237.002765301309,
+ 30254.586251464058,
+ 30272.172292809046,
+ 30289.760888593977,
+ 30307.35203807709,
+ 30324.94574051716,
+ 30342.541995173502,
+ 30360.140801305966,
+ 30377.742158174944,
+ 30395.346065041358,
+ 30412.952521166666,
+ 30430.561525812864,
+ 30448.173078242475,
+ 30465.787177718561,
+ 30483.403823504719,
+ 30501.02301486507,
+ 30518.644751064272,
+ 30536.269031367516,
+ 30553.895855040515,
+ 30571.525221349519,
+ 30589.157129561307,
+ 30606.791578943175,
+ 30624.428568762964,
+ 30642.06809828903,
+ 30659.710166790261,
+ 30677.35477353607,
+ 30695.001917796391,
+ 30712.651598841687,
+ 30730.303815942945,
+ 30747.958568371676,
+ 30765.615855399912,
+ 30783.275676300211,
+ 30800.938030345646,
+ 30818.602916809814,
+ 30836.270334966837,
+ 30853.940284091354,
+ 30871.612763458521,
+ 30889.287772344011,
+ 30906.965310024025,
+ 30924.645375775272,
+ 30942.327968874983,
+ 30960.013088600903,
+ 30977.700734231294,
+ 30995.390905044929,
+ 31013.083600321101,
+ 31030.778819339619,
+ 31048.476561380798,
+ 31066.17682572547,
+ 31083.879611654978,
+ 31101.584918451179,
+ 31119.29274539644,
+ 31137.003091773637,
+ 31154.715956866155,
+ 31172.431339957893,
+ 31190.14924033326,
+ 31207.869657277162,
+ 31225.592590075023,
+ 31243.318038012771,
+ 31261.046000376838,
+ 31278.776476454172,
+ 31296.50946553221,
+ 31314.24496689891,
+ 31331.98297984272,
+ 31349.7235036526,
+ 31367.466537618013,
+ 31385.212081028923,
+ 31402.960133175795,
+ 31420.710693349596,
+ 31438.463760841791,
+ 31456.219334944351,
+ 31473.977414949743,
+ 31491.738000150934,
+ 31509.501089841389,
+ 31527.266683315069,
+ 31545.034779866437,
+ 31562.80537879045,
+ 31580.578479382562,
+ 31598.35408093872,
+ 31616.132182755369,
+ 31633.91278412945,
+ 31651.695884358396,
+ 31669.481482740131,
+ 31687.269578573076,
+ 31705.060171156143,
+ 31722.853259788735,
+ 31740.648843770748,
+ 31758.446922402567,
+ 31776.247494985066,
+ 31794.050560819614,
+ 31811.85611920806,
+ 31829.664169452753,
+ 31847.474710856521,
+ 31865.287742722685,
+ 31883.103264355046,
+ 31900.921275057899,
+ 31918.741774136019,
+ 31936.564760894671,
+ 31954.390234639599,
+ 31972.21819467704,
+ 31990.048640313704,
+ 32007.881570856793,
+ 32025.716985613984,
+ 32043.554883893445,
+ 32061.395265003815,
+ 32079.238128254223,
+ 32097.083472954269,
+ 32114.931298414049,
+ 32132.781603944117,
+ 32150.634388855524,
+ 32168.48965245979,
+ 32186.347394068915,
+ 32204.207612995371,
+ 32222.07030855212,
+ 32239.935480052583,
+ 32257.803126810672,
+ 32275.673248140767,
+ 32293.545843357719,
+ 32311.420911776862,
+ 32329.298452713996,
+ 32347.178465485395,
+ 32365.060949407813,
+ 32382.945903798463,
+ 32400.83332797504,
+ 32418.723221255706,
+ 32436.615582959093,
+ 32454.510412404306,
+ 32472.407708910916,
+ 32490.307471798966,
+ 32508.209700388961,
+ 32526.114394001877,
+ 32544.021551959166,
+ 32561.931173582732,
+ 32579.843258194956,
+ 32597.757805118679,
+ 32615.674813677211,
+ 32633.594283194328,
+ 32651.516212994258,
+ 32669.440602401712,
+ 32687.367450741847,
+ 32705.296757340297,
+ 32723.228521523146,
+ 32741.162742616943,
+ 32759.099419948703,
+ 32777.038552845901,
+ 32794.980140636464,
+ 32812.924182648792,
+ 32830.87067821173,
+ 32848.819626654593,
+ 32866.77102730715,
+ 32884.724879499619,
+ 32902.681182562686,
+ 32920.639935827494,
+ 32938.601138625643,
+ 32956.56479028918,
+ 32974.530890150607,
+ 32992.499437542894,
+ 33010.470431799447,
+ 33028.443872254145,
+ 33046.419758241311,
+ 33064.39808909571,
+ 33082.378864152583,
+ 33100.36208274759,
+ 33118.347744216881,
+ 33136.335847897026,
+ 33154.326393125062,
+ 33172.31937923847,
+ 33190.314805575174,
+ 33208.312671473555,
+ 33226.312976272442,
+ 33244.315719311111,
+ 33262.320899929284,
+ 33280.328517467125,
+ 33298.33857126526,
+ 33316.351060664747,
+ 33334.365985007091,
+ 33352.383343634239,
+ 33370.403135888591,
+ 33388.42536111299,
+ 33406.450018650721,
+ 33424.477107845501,
+ 33442.506628041512,
+ 33460.53857858335,
+ 33478.572958816083,
+ 33496.609768085189,
+ 33514.649005736617,
+ 33532.690671116739,
+ 33550.734763572356,
+ 33568.781282450735,
+ 33586.830227099563,
+ 33604.881596866973,
+ 33622.935391101528,
+ 33640.991609152239,
+ 33659.050250368542,
+ 33677.111314100322,
+ 33695.174799697881,
+ 33713.240706511984,
+ 33731.309033893805,
+ 33749.37978119497,
+ 33767.452947767531,
+ 33785.528532963974,
+ 33803.606536137209,
+ 33821.686956640602,
+ 33839.769793827938,
+ 33857.855047053425,
+ 33875.942715671707,
+ 33894.032799037872,
+ 33912.125296507431,
+ 33930.220207436316,
+ 33948.317531180888,
+ 33966.417267097961,
+ 33984.519414544746,
+ 34002.623972878901,
+ 34020.730941458511,
+ 34038.840319642077,
+ 34056.952106788536,
+ 34075.066302257255,
+ 34093.182905408015,
+ 34111.301915601027,
+ 34129.42333219693,
+ 34147.547154556785,
+ 34165.673382042078,
+ 34183.80201401472,
+ 34201.933049837033,
+ 34220.06648887178,
+ 34238.202330482141,
+ 34256.340574031703,
+ 34274.481218884495,
+ 34292.624264404949,
+ 34310.769709957938,
+ 34328.91755490873,
+ 34347.067798623029,
+ 34365.220440466954,
+ 34383.375479807051,
+ 34401.532916010263,
+ 34419.692748443973,
+ 34437.854976475966,
+ 34456.01959947445,
+ 34474.18661680806,
+ 34492.356027845817,
+ 34510.527831957188,
+ 34528.702028512052,
+ 34546.878616880676,
+ 34565.05759643377,
+ 34583.238966542449,
+ 34601.422726578232,
+ 34619.608875913065,
+ 34637.797413919296,
+ 34655.988339969692,
+ 34674.181653437423,
+ 34692.37735369608,
+ 34710.575440119668,
+ 34728.775912082579,
+ 34746.978768959649,
+ 34765.184010126082,
+ 34783.391634957537,
+ 34801.60164283005,
+ 34819.814033120063,
+ 34838.028805204456,
+ 34856.24595846048,
+ 34874.465492265823,
+ 34892.687405998557,
+ 34910.911699037177,
+ 34929.138370760564,
+ 34947.367420548027,
+ 34965.598847779271,
+ 34983.832651834389,
+ 35002.068832093908,
+ 35020.307387938738,
+ 35038.548318750189,
+ 35056.79162390998,
+ 35075.03730280025,
+ 35093.285354803513,
+ 35111.535779302685,
+ 35129.788575681116,
+ 35148.043743322516,
+ 35166.301281611013,
+ 35184.561189931141,
+ 35202.823467667826,
+ 35221.088114206388,
+ 35239.355128932555,
+ 35257.624511232447,
+ 35275.896260492584,
+ 35294.170376099886,
+ 35312.446857441668,
+ 35330.725703905628,
+ 35349.006914879887,
+ 35367.290489752944,
+ 35385.576427913686,
+ 35403.864728751418,
+ 35422.155391655811,
+ 35440.448416016967,
+ 35458.743801225341,
+ 35477.041546671804,
+ 35495.341651747622,
+ 35513.644115844436,
+ 35531.948938354304,
+ 35550.256118669655,
+ 35568.565656183309,
+ 35586.877550288496,
+ 35605.191800378816,
+ 35623.508405848268,
+ 35641.827366091238,
+ 35660.148680502505,
+ 35678.472348477233,
+ 35696.798369410979,
+ 35715.126742699678,
+ 35733.457467739659,
+ 35751.790543927644,
+ 35770.125970660738,
+ 35788.46374733642,
+ 35806.803873352568,
+ 35825.146348107453,
+ 35843.49117099971,
+ 35861.838341428367,
+ 35880.187858792851,
+ 35898.539722492955,
+ 35916.893931928862,
+ 35935.250486501129,
+ 35953.609385610718,
+ 35971.970628658957,
+ 35990.334215047558,
+ 36008.700144178612,
+ 36027.068415454596,
+ 36045.439028278372,
+ 36063.811982053165,
+ 36082.187276182609,
+ 36100.564910070694,
+ 36118.944883121789,
+ 36137.327194740654,
+ 36155.711844332429,
+ 36174.098831302617,
+ 36192.488155057115,
+ 36210.87981500219,
+ 36229.273810544473,
+ 36247.670141091003,
+ 36266.068806049167,
+ 36284.469804826738,
+ 36302.873136831862,
+ 36321.278801473069,
+ 36339.686798159251,
+ 36358.097126299683,
+ 36376.509785304013,
+ 36394.924774582258,
+ 36413.342093544816,
+ 36431.761741602444,
+ 36450.183718166292,
+ 36468.608022647859,
+ 36487.034654459028,
+ 36505.463613012063,
+ 36523.894897719583,
+ 36542.328507994578,
+ 36560.764443250409,
+ 36579.202702900831,
+ 36597.643286359926,
+ 36616.086193042182,
+ 36634.531422362437,
+ 36652.978973735895,
+ 36671.428846578143,
+ 36689.881040305125,
+ 36708.335554333149,
+ 36726.792388078902,
+ 36745.251540959427,
+ 36763.713012392138,
+ 36782.176801794812,
+ 36800.642908585593,
+ 36819.111332182983,
+ 36837.582072005869,
+ 36856.055127473483,
+ 36874.530498005421,
+ 36893.008183021651,
+ 36911.488181942506,
+ 36929.970494188674,
+ 36948.455119181206,
+ 36966.942056341519,
+ 36985.431305091392,
+ 37003.922864852961,
+ 37022.416735048733,
+ 37040.912915101559,
+ 37059.411404434657,
+ 37077.91220247162,
+ 37096.415308636388,
+ 37114.920722353243,
+ 37133.428443046862,
+ 37151.938470142253,
+ 37170.450803064785,
+ 37188.965441240209,
+ 37207.482384094597,
+ 37226.001631054402,
+ 37244.523181546429,
+ 37263.047034997842,
+ 37281.573190836149,
+ 37300.101648489224,
+ 37318.632407385296,
+ 37337.165466952945,
+ 37355.700826621112,
+ 37374.238485819085,
+ 37392.778443976509,
+ 37411.320700523385,
+ 37429.865254890057,
+ 37448.412106507232,
+ 37466.961254805974,
+ 37485.512699217681,
+ 37504.066439174116,
+ 37522.622474107404,
+ 37541.180803449992,
+ 37559.741426634704,
+ 37578.304343094693,
+ 37596.869552263488,
+ 37615.43705357494,
+ 37634.006846463279,
+ 37652.578930363044,
+ 37671.153304709165,
+ 37689.729968936896,
+ 37708.308922481847,
+ 37726.890164779965,
+ 37745.473695267559,
+ 37764.059513381275,
+ 37782.647618558112,
+ 37801.238010235415,
+ 37819.830687850859,
+ 37838.425650842495,
+ 37857.022898648691,
+ 37875.622430708172,
+ 37894.224246460013,
+ 37912.828345343616,
+ 37931.434726798747,
+ 37950.043390265506,
+ 37968.654335184328,
+ 37987.267560995999,
+ 38005.883067141665,
+ 38024.500853062775,
+ 38043.120918201159,
+ 38061.743261998963,
+ 38080.367883898682,
+ 38098.994783343158,
+ 38117.623959775563,
+ 38136.255412639417,
+ 38154.889141378575,
+ 38173.525145437234,
+ 38192.163424259939,
+ 38210.803977291551,
+ 38229.446803977284,
+ 38248.091903762703,
+ 38266.739276093685,
+ 38285.388920416466,
+ 38304.040836177606,
+ 38322.695022824002,
+ 38341.351479802899,
+ 38360.010206561863,
+ 38378.671202548816,
+ 38397.334467211993,
+ 38415.999999999978,
+ 38434.667800361683,
+ 38453.33786774637,
+ 38472.010201603611,
+ 38490.684801383337,
+ 38509.361666535784,
+ 38528.040796511552,
+ 38546.722190761553,
+ 38565.405848737035,
+ 38584.091769889594,
+ 38602.779953671132,
+ 38621.470399533908,
+ 38640.163106930493,
+ 38658.858075313794,
+ 38677.555304137059,
+ 38696.254792853862,
+ 38714.956540918094,
+ 38733.660547783991,
+ 38752.366812906112,
+ 38771.075335739348,
+ 38789.78611573892,
+ 38808.499152360368,
+ 38827.214445059573,
+ 38845.931993292739,
+ 38864.651796516388,
+ 38883.373854187383,
+ 38902.098165762916,
+ 38920.824730700486,
+ 38939.553548457938,
+ 38958.284618493431,
+ 38977.017940265461,
+ 38995.753513232834,
+ 39014.491336854699,
+ 39033.231410590517,
+ 39051.973733900079,
+ 39070.718306243485,
+ 39089.465127081188,
+ 39108.214195873945,
+ 39126.965512082832,
+ 39145.719075169261,
+ 39164.474884594965,
+ 39183.232939821988,
+ 39201.99324031271,
+ 39220.755785529815,
+ 39239.52057493633,
+ 39258.287607995589,
+ 39277.056884171245,
+ 39295.828402927284,
+ 39314.602163728006,
+ 39333.378166038019,
+ 39352.15640932227,
+ 39370.936893046004,
+ 39389.719616674811,
+ 39408.504579674584,
+ 39427.291781511522,
+ 39446.081221652174,
+ 39464.872899563372,
+ 39483.666814712291,
+ 39502.462966566411,
+ 39521.261354593538,
+ 39540.06197826178,
+ 39558.864837039568,
+ 39577.669930395656,
+ 39596.47725779911,
+ 39615.286818719302,
+ 39634.098612625923,
+ 39652.912638988993,
+ 39671.728897278823,
+ 39690.547386966064,
+ 39709.368107521652,
+ 39728.191058416858,
+ 39747.016239123259,
+ 39765.84364911275,
+ 39784.673287857528,
+ 39803.505154830105,
+ 39822.339249503319,
+ 39841.175571350293,
+ 39860.014119844491,
+ 39878.854894459677,
+ 39897.697894669909,
+ 39916.54311994958,
+ 39935.390569773372,
+ 39954.240243616303,
+ 39973.092140953675,
+ 39991.946261261117,
+ 40010.802604014549,
+ 40029.661168690225,
+ 40048.521954764678,
+ 40067.384961714779,
+ 40086.250189017679,
+ 40105.117636150855,
+ 40123.98730259209,
+ 40142.859187819471,
+ 40161.733291311379,
+ 40180.609612546526,
+ 40199.488151003912,
+ 40218.368906162854,
+ 40237.25187750296,
+ 40256.137064504153,
+ 40275.024466646668,
+ 40293.914083411029,
+ 40312.805914278084,
+ 40331.699958728961,
+ 40350.596216245103,
+ 40369.494686308273,
+ 40388.39536840051,
+ 40407.298262004173,
+ 40426.20336660192,
+ 40445.110681676706,
+ 40464.020206711793,
+ 40482.931941190756,
+ 40501.845884597446,
+ 40520.762036416032,
+ 40539.680396130985,
+ 40558.600963227072,
+ 40577.523737189367,
+ 40596.448717503234,
+ 40615.375903654342,
+ 40634.305295128659,
+ 40653.236891412453,
+ 40672.170691992294,
+ 40691.106696355047,
+ 40710.044903987873,
+ 40728.985314378238,
+ 40747.927927013901,
+ 40766.872741382918,
+ 40785.819756973651,
+ 40804.768973274746,
+ 40823.720389775161,
+ 40842.674005964131,
+ 40861.629821331211,
+ 40880.587835366234,
+ 40899.548047559321,
+ 40918.510457400931,
+ 40937.475064381761,
+ 40956.441867992849,
+ 40975.410867725499,
+ 40994.382063071331,
+ 41013.355453522236,
+ 41032.331038570417,
+ 41051.308817708363,
+ 41070.288790428858,
+ 41089.270956224987,
+ 41108.255314590111,
+ 41127.241865017888,
+ 41146.23060700229,
+ 41165.221540037543,
+ 41184.214663618193,
+ 41203.209977239079,
+ 41222.207480395307,
+ 41241.207172582297,
+ 41260.209053295752,
+ 41279.213122031659,
+ 41298.219378286303,
+ 41317.227821556255,
+ 41336.23845133838,
+ 41355.251267129832,
+ 41374.266268428037,
+ 41393.283454730743,
+ 41412.302825535953,
+ 41431.324380341983,
+ 41450.348118647416,
+ 41469.374039951144,
+ 41488.402143752326,
+ 41507.432429550427,
+ 41526.464896845187,
+ 41545.499545136627,
+ 41564.536373925075,
+ 41583.575382711126,
+ 41602.616570995662,
+ 41621.659938279874,
+ 41640.705484065205,
+ 41659.753207853406,
+ 41678.803109146495,
+ 41697.855187446803,
+ 41716.909442256911,
+ 41735.965873079709,
+ 41755.02447941836,
+ 41774.085260776315,
+ 41793.148216657297,
+ 41812.213346565331,
+ 41831.280650004708,
+ 41850.350126480014,
+ 41869.421775496106,
+ 41888.495596558132,
+ 41907.571589171515,
+ 41926.649752841957,
+ 41945.730087075463,
+ 41964.812591378286,
+ 41983.897265256979,
+ 42002.984108218378,
+ 42022.073119769593,
+ 42041.164299418015,
+ 42060.257646671307,
+ 42079.353161037419,
+ 42098.450842024591,
+ 42117.550689141324,
+ 42136.652701896404,
+ 42155.756879798893,
+ 42174.863222358137,
+ 42193.971729083758,
+ 42213.082399485655,
+ 42232.195233074002,
+ 42251.310229359246,
+ 42270.427387852127,
+ 42289.546708063644,
+ 42308.668189505079,
+ 42327.791831687995,
+ 42346.917634124227,
+ 42366.045596325886,
+ 42385.175717805352,
+ 42404.307998075295,
+ 42423.442436648642,
+ 42442.579033038608,
+ 42461.717786758672,
+ 42480.858697322597,
+ 42500.001764244422,
+ 42519.146987038446,
+ 42538.294365219248,
+ 42557.443898301688,
+ 42576.595585800882,
+ 42595.749427232236,
+ 42614.90542211142,
+ 42634.063569954378,
+ 42653.223870277317,
+ 42672.386322596729,
+ 42691.55092642938,
+ 42710.717681292292,
+ 42729.886586702756,
+ 42749.057642178363,
+ 42768.23084723694,
+ 42787.406201396603,
+ 42806.58370417574,
+ 42825.76335509299,
+ 42844.945153667286,
+ 42864.129099417805,
+ 42883.315191864014,
+ 42902.503430525649,
+ 42921.693814922692,
+ 42940.88634457541,
+ 42960.081019004348,
+ 42979.277837730297,
+ 42998.476800274322,
+ 43017.677906157769,
+ 43036.881154902228,
+ 43056.086546029583,
+ 43075.294079061961,
+ 43094.503753521763,
+ 43113.715568931671,
+ 43132.929524814601,
+ 43152.145620693766,
+ 43171.363856092619,
+ 43190.584230534907,
+ 43209.806743544621,
+ 43229.031394646016,
+ 43248.258183363621,
+ 43267.487109222224,
+ 43286.718171746885,
+ 43305.951370462906,
+ 43325.186704895881,
+ 43344.42417457165,
+ 43363.663779016322,
+ 43382.905517756262,
+ 43402.149390318104,
+ 43421.395396228749,
+ 43440.643535015348,
+ 43459.89380620532,
+ 43479.146209326354,
+ 43498.400743906379,
+ 43517.657409473606,
+ 43536.916205556496,
+ 43556.177131683784,
+ 43575.44018738444,
+ 43594.705372187724,
+ 43613.972685623135,
+ 43633.242127220445,
+ 43652.513696509668,
+ 43671.787393021099,
+ 43691.063216285271,
+ 43710.341165833001,
+ 43729.621241195346,
+ 43748.903441903625,
+ 43768.187767489413,
+ 43787.474217484552,
+ 43806.762791421126,
+ 43826.053488831501,
+ 43845.346309248278,
+ 43864.641252204325,
+ 43883.938317232765,
+ 43903.237503866971,
+ 43922.538811640596,
+ 43941.842240087513,
+ 43961.147788741881,
+ 43980.455457138101,
+ 43999.765244810835,
+ 44019.077151295001,
+ 44038.391176125755,
+ 44057.70731883854,
+ 44077.02557896902,
+ 44096.345956053141,
+ 44115.668449627083,
+ 44134.993059227287,
+ 44154.319784390456,
+ 44173.648624653535,
+ 44192.979579553728,
+ 44212.312648628489,
+ 44231.647831415532,
+ 44250.985127452805,
+ 44270.324536278538,
+ 44289.666057431183,
+ 44309.009690449464,
+ 44328.355434872348,
+ 44347.703290239064,
+ 44367.053256089079,
+ 44386.405331962109,
+ 44405.759517398139,
+ 44425.115811937387,
+ 44444.474215120332,
+ 44463.834726487694,
+ 44483.197345580462,
+ 44502.562071939843,
+ 44521.928905107328,
+ 44541.297844624634,
+ 44560.668890033732,
+ 44580.042040876848,
+ 44599.417296696454,
+ 44618.794657035272,
+ 44638.174121436256,
+ 44657.555689442641,
+ 44676.939360597877,
+ 44696.325134445673,
+ 44715.713010530002,
+ 44735.102988395054,
+ 44754.495067585296,
+ 44773.88924764542,
+ 44793.285528120374,
+ 44812.683908555344,
+ 44832.084388495779,
+ 44851.486967487363,
+ 44870.891645076015,
+ 44890.298420807922,
+ 44909.707294229491,
+ 44929.118264887409,
+ 44948.531332328566,
+ 44967.946496100136,
+ 44987.363755749502,
+ 45006.783110824319,
+ 45026.204560872473,
+ 45045.628105442098,
+ 45065.053744081561,
+ 45084.48147633949,
+ 45103.911301764747,
+ 45123.343219906426,
+ 45142.777230313885,
+ 45162.21333253671,
+ 45181.651526124733,
+ 45201.091810628037,
+ 45220.534185596924,
+ 45239.978650581965,
+ 45259.425205133957,
+ 45278.873848803938,
+ 45298.324581143192,
+ 45317.777401703235,
+ 45337.232310035848,
+ 45356.68930569302,
+ 45376.148388226997,
+ 45395.60955719027,
+ 45415.072812135557,
+ 45434.538152615823,
+ 45454.005578184282,
+ 45473.475088394356,
+ 45492.946682799746,
+ 45512.420360954362,
+ 45531.896122412363,
+ 45551.373966728155,
+ 45570.853893456362,
+ 45590.33590215187,
+ 45609.819992369776,
+ 45629.306163665438,
+ 45648.794415594442,
+ 45668.284747712612,
+ 45687.777159576006,
+ 45707.27165074092,
+ 45726.768220763894,
+ 45746.266869201696,
+ 45765.767595611323,
+ 45785.270399550034,
+ 45804.775280575297,
+ 45824.282238244828,
+ 45843.79127211657,
+ 45863.302381748719,
+ 45882.815566699683,
+ 45902.33082652813,
+ 45921.848160792935,
+ 45941.367569053225,
+ 45960.889050868354,
+ 45980.41260579793,
+ 45999.938233401757,
+ 46019.465933239902,
+ 46038.995704872657,
+ 46058.527547860547,
+ 46078.06146176433,
+ 46097.597446144995,
+ 46117.135500563774,
+ 46136.675624582109,
+ 46156.217817761702,
+ 46175.762079664462,
+ 46195.308409852543,
+ 46214.856807888333,
+ 46234.407273334444,
+ 46253.959805753715,
+ 46273.51440470924,
+ 46293.071069764315,
+ 46312.629800482478,
+ 46332.190596427499,
+ 46351.753457163381,
+ 46371.318382254351,
+ 46390.885371264863,
+ 46410.45442375962,
+ 46430.025539303526,
+ 46449.598717461733,
+ 46469.17395779962,
+ 46488.751259882782,
+ 46508.33062327707,
+ 46527.912047548532,
+ 46547.495532263471,
+ 46567.081076988397,
+ 46586.668681290059,
+ 46606.258344735434,
+ 46625.850066891719,
+ 46645.443847326351,
+ 46665.039685606986,
+ 46684.637581301497,
+ 46704.237533978005,
+ 46723.839543204842,
+ 46743.443608550573,
+ 46763.049729583989,
+ 46782.657905874104,
+ 46802.268136990162,
+ 46821.880422501628,
+ 46841.494761978196,
+ 46861.111154989776,
+ 46880.729601106526,
+ 46900.350099898795,
+ 46919.97265093719,
+ 46939.597253792526,
+ 46959.223908035841,
+ 46978.852613238392,
+ 46998.483368971691,
+ 47018.11617480743,
+ 47037.751030317551,
+ 47057.387935074221,
+ 47077.026888649809,
+ 47096.66789061694,
+ 47116.310940548428,
+ 47135.956038017328,
+ 47155.603182596918,
+ 47175.252373860698,
+ 47194.903611382375,
+ 47214.556894735892,
+ 47234.212223495422,
+ 47253.869597235338,
+ 47273.52901553025,
+ 47293.19047795498,
+ 47312.853984084577,
+ 47332.519533494306,
+ 47352.187125759658,
+ 47371.856760456343,
+ 47391.528437160297,
+ 47411.202155447652,
+ 47430.877914894787,
+ 47450.555715078299,
+ 47470.235555574982,
+ 47489.917435961863,
+ 47509.601355816201,
+ 47529.287314715453,
+ 47548.975312237308,
+ 47568.665347959672,
+ 47588.357421460656,
+ 47608.051532318605,
+ 47627.747680112072,
+ 47647.445864419846,
+ 47667.14608482091,
+ 47686.848340894474,
+ 47706.552632219973,
+ 47726.258958377046,
+ 47745.967318945557,
+ 47765.677713505589,
+ 47785.390141637428,
+ 47805.104602921601,
+ 47824.821096938824,
+ 47844.539623270044,
+ 47864.260181496429,
+ 47883.982771199349,
+ 47903.707391960394,
+ 47923.434043361369,
+ 47943.162724984308,
+ 47962.893436411439,
+ 47982.626177225218,
+ 48002.36094700831,
+ 48022.097745343599,
+ 48041.836571814172,
+ 48061.57742600335,
+ 48081.32030749465,
+ 48101.065215871815,
+ 48120.81215071879,
+ 48140.56111161974,
+ 48160.312098159047,
+ 48180.065109921306,
+ 48199.820146491307,
+ 48219.577207454073,
+ 48239.336292394844,
+ 48259.097400899045,
+ 48278.860532552339,
+ 48298.625686940592,
+ 48318.392863649875,
+ 48338.162062266485,
+ 48357.933282376915,
+ 48377.706523567889,
+ 48397.481785426316,
+ 48417.259067539344,
+ 48437.038369494308,
+ 48456.819690878765,
+ 48476.603031280487,
+ 48496.388390287451,
+ 48516.175767487839,
+ 48535.965162470042,
+ 48555.756574822684,
+ 48575.550004134566,
+ 48595.345449994718,
+ 48615.142911992378,
+ 48634.942389716991,
+ 48654.743882758201,
+ 48674.547390705877,
+ 48694.352913150084,
+ 48714.160449681112,
+ 48733.969999889443,
+ 48753.781563365759,
+ 48773.595139700978,
+ 48793.410728486211,
+ 48813.228329312769,
+ 48833.047941772187,
+ 48852.869565456189,
+ 48872.693199956717,
+ 48892.518844865925,
+ 48912.346499776155,
+ 48932.176164279976,
+ 48952.007837970152,
+ 48971.841520439666,
+ 48991.677211281676,
+ 49011.514910089587,
+ 49031.354616456978,
+ 49051.196329977654,
+ 49071.04005024561,
+ 49090.885776855059,
+ 49110.733509400408,
+ 49130.583247476279,
+ 49150.434990677488,
+ 49170.288738599062,
+ 49190.144490836232,
+ 49210.002246984441,
+ 49229.86200663932,
+ 49249.723769396718,
+ 49269.587534852675,
+ 49289.453302603448,
+ 49309.32107224549,
+ 49329.190843375451,
+ 49349.062615590192,
+ 49368.936388486785,
+ 49388.812161662492,
+ 49408.689934714785,
+ 49428.569707241324,
+ 49448.45147883999,
+ 49468.335249108866,
+ 49488.22101764621,
+ 49508.108784050521,
+ 49527.99854792047,
+ 49547.890308854934,
+ 49567.784066453009,
+ 49587.679820313977,
+ 49607.57757003732,
+ 49627.477315222721,
+ 49647.379055470075,
+ 49667.28279037946,
+ 49687.188519551179,
+ 49707.096242585707,
+ 49727.005959083741,
+ 49746.917668646165,
+ 49766.831370874068,
+ 49786.747065368734,
+ 49806.66475173166,
+ 49826.584429564515,
+ 49846.506098469203,
+ 49866.429758047794,
+ 49886.355407902578,
+ 49906.283047636032,
+ 49926.212676850846,
+ 49946.144295149883,
+ 49966.077902136225,
+ 49986.013497413151,
+ 50005.951080584135,
+ 50025.890651252834,
+ 50045.832209023123,
+ 50065.775753499074,
+ 50085.721284284933,
+ 50105.668800985164,
+ 50125.618303204428,
+ 50145.569790547575,
+ 50165.523262619652,
+ 50185.478719025901,
+ 50205.436159371769,
+ 50225.395583262893,
+ 50245.356990305103,
+ 50265.320380104429,
+ 50285.285752267104,
+ 50305.253106399534,
+ 50325.222442108337,
+ 50345.193759000336,
+ 50365.16705668252,
+ 50385.142334762102,
+ 50405.119592846473,
+ 50425.098830543218,
+ 50445.080047460127,
+ 50465.063243205179,
+ 50485.048417386541,
+ 50505.035569612577,
+ 50525.024699491856,
+ 50545.015806633128,
+ 50565.008890645338,
+ 50585.003951137631,
+ 50605.00098771933,
+ 50624.999999999971,
+ 50645.000987589265,
+ 50665.003950097132,
+ 50685.008887133677,
+ 50705.015798309192,
+ 50725.024683234165,
+ 50745.035541519283,
+ 50765.048372775411,
+ 50785.063176613621,
+ 50805.079952645159,
+ 50825.098700481489,
+ 50845.119419734241,
+ 50865.142110015244,
+ 50885.166770936521,
+ 50905.193402110279,
+ 50925.222003148934,
+ 50945.252573665071,
+ 50965.285113271471,
+ 50985.319621581119,
+ 51005.356098207172,
+ 51025.394542762981,
+ 51045.434954862096,
+ 51065.477334118244,
+ 51085.521680145357,
+ 51105.567992557546,
+ 51125.616270969113,
+ 51145.66651499454,
+ 51165.718724248516,
+ 51185.772898345916,
+ 51205.829036901778,
+ 51225.887139531362,
+ 51245.947205850105,
+ 51266.009235473619,
+ 51286.073228017718,
+ 51306.139183098399,
+ 51326.207100331856,
+ 51346.276979334456,
+ 51366.348819722756,
+ 51386.42262111351,
+ 51406.498383123653,
+ 51426.57610537031,
+ 51446.655787470787,
+ 51466.737429042587,
+ 51486.82102970338,
+ 51506.906589071048,
+ 51526.994106763632,
+ 51547.083582399391,
+ 51567.175015596738,
+ 51587.268405974297,
+ 51607.363753150858,
+ 51627.461056745415,
+ 51647.56031637713,
+ 51667.661531665362,
+ 51687.764702229651,
+ 51707.869827689727,
+ 51727.976907665499,
+ 51748.085941777055,
+ 51768.196929644677,
+ 51788.309870888836,
+ 51808.42476513017,
+ 51828.541611989524,
+ 51848.660411087905,
+ 51868.781162046515,
+ 51888.90386448674,
+ 51909.028518030143,
+ 51929.155122298485,
+ 51949.283676913685,
+ 51969.414181497872,
+ 51989.546635673345,
+ 52009.681039062583,
+ 52029.817391288263,
+ 52049.955691973213,
+ 52070.095940740481,
+ 52090.238137213273,
+ 52110.382281014987,
+ 52130.5283717692,
+ 52150.676409099666,
+ 52170.826392630333,
+ 52190.97832198532,
+ 52211.132196788931,
+ 52231.288016665654,
+ 52251.445781240145,
+ 52271.60549013727,
+ 52291.76714298204,
+ 52311.930739399664,
+ 52332.096279015546,
+ 52352.263761455244,
+ 52372.433186344519,
+ 52392.604553309284,
+ 52412.777861975665,
+ 52432.953111969946,
+ 52453.130302918595,
+ 52473.309434448267,
+ 52493.490506185793,
+ 52513.67351775818,
+ 52533.858468792605,
+ 52554.045358916446,
+ 52574.234187757254,
+ 52594.42495494274,
+ 52614.617660100812,
+ 52634.812302859558,
+ 52655.008882847229,
+ 52675.20739969227,
+ 52695.407853023295,
+ 52715.610242469098,
+ 52735.814567658657,
+ 52756.02082822111,
+ 52776.229023785803,
+ 52796.439153982225,
+ 52816.651218440056,
+ 52836.865216789171,
+ 52857.081148659599,
+ 52877.29901368155,
+ 52897.518811485425,
+ 52917.740541701773,
+ 52937.964203961354,
+ 52958.18979789508,
+ 52978.417323134046,
+ 52998.646779309529,
+ 53018.878166052978,
+ 53039.111482996006,
+ 53059.346729770419,
+ 53079.583906008193,
+ 53099.823011341483,
+ 53120.0640454026,
+ 53140.307007824063,
+ 53160.551898238533,
+ 53180.79871627887,
+ 53201.047461578091,
+ 53221.2981337694,
+ 53241.550732486176,
+ 53261.805257361964,
+ 53282.061708030487,
+ 53302.32008412564,
+ 53322.580385281493,
+ 53342.842611132299,
+ 53363.106761312469,
+ 53383.372835456597,
+ 53403.640833199453,
+ 53423.910754175973,
+ 53444.18259802126,
+ 53464.456364370613,
+ 53484.732052859479,
+ 53505.009663123499,
+ 53525.289194798468,
+ 53545.570647520362,
+ 53565.854020925333,
+ 53586.139314649699,
+ 53606.426528329954,
+ 53626.715661602764,
+ 53647.006714104959,
+ 53667.299685473547,
+ 53687.59457534572,
+ 53707.891383358816,
+ 53728.190109150361,
+ 53748.490752358055,
+ 53768.793312619753,
+ 53789.09778957349,
+ 53809.404182857485,
+ 53829.712492110106,
+ 53850.022716969899,
+ 53870.334857075584,
+ 53890.648912066055,
+ 53910.964881580367,
+ 53931.28276525774,
+ 53951.602562737586,
+ 53971.924273659461,
+ 53992.24789766311,
+ 54012.57343438844,
+ 54032.90088347553,
+ 54053.23024456462,
+ 54073.561517296133,
+ 54093.894701310644,
+ 54114.22979624891,
+ 54134.566801751855,
+ 54154.90571746057,
+ 54175.246543016314,
+ 54195.589278060506,
+ 54215.933922234755,
+ 54236.280475180814,
+ 54256.628936540626,
+ 54276.97930595628,
+ 54297.331583070045,
+ 54317.685767524359,
+ 54338.041858961828,
+ 54358.399857025215,
+ 54378.759761357462,
+ 54399.121571601667,
+ 54419.485287401105,
+ 54439.850908399218,
+ 54460.218434239614,
+ 54480.587864566056,
+ 54500.95919902248,
+ 54521.332437252997,
+ 54541.707578901878,
+ 54562.084623613555,
+ 54582.46357103264,
+ 54602.844420803893,
+ 54623.227172572246,
+ 54643.611825982807,
+ 54663.998380680838,
+ 54684.386836311773,
+ 54704.777192521207,
+ 54725.169448954897,
+ 54745.563605258772,
+ 54765.959661078923,
+ 54786.357616061614,
+ 54806.757469853255,
+ 54827.159222100439,
+ 54847.562872449904,
+ 54867.968420548583,
+ 54888.375866043534,
+ 54908.785208582012,
+ 54929.196447811417,
+ 54949.609583379322,
+ 54970.024614933463,
+ 54990.441542121727,
+ 55010.86036459219,
+ 55031.28108199306,
+ 55051.703693972733,
+ 55072.128200179759,
+ 55092.554600262847,
+ 55112.982893870874,
+ 55133.413080652877,
+ 55153.845160258061,
+ 55174.279132335789,
+ 55194.714996535586,
+ 55215.152752507143,
+ 55235.592399900306,
+ 55256.033938365079,
+ 55276.477367551655,
+ 55296.92268711036,
+ 55317.369896691685,
+ 55337.818995946305,
+ 55358.269984525024,
+ 55378.72286207883,
+ 55399.177628258869,
+ 55419.634282716441,
+ 55440.092825103013,
+ 55460.553255070205,
+ 55481.015572269804,
+ 55501.479776353764,
+ 55521.945866974187,
+ 55542.413843783339,
+ 55562.883706433655,
+ 55583.355454577715,
+ 55603.82908786826,
+ 55624.304605958219,
+ 55644.782008500639,
+ 55665.261295148754,
+ 55685.742465555952,
+ 55706.225519375774,
+ 55726.710456261928,
+ 55747.197275868275,
+ 55767.685977848843,
+ 55788.176561857814,
+ 55808.669027549528,
+ 55829.163374578478,
+ 55849.659602599328,
+ 55870.157711266889,
+ 55890.657700236145,
+ 55911.159569162221,
+ 55931.663317700411,
+ 55952.168945506164,
+ 55972.676452235086,
+ 55993.185837542944,
+ 56013.697101085651,
+ 56034.210242519301,
+ 56054.72526150012,
+ 56075.242157684508,
+ 56095.760930729011,
+ 56116.281580290342,
+ 56136.804106025367,
+ 56157.328507591104,
+ 56177.85478464474,
+ 56198.382936843598,
+ 56218.912963845185,
+ 56239.444865307138,
+ 56259.978640887268,
+ 56280.514290243525,
+ 56301.051813034042,
+ 56321.591208917082,
+ 56342.13247755108,
+ 56362.675618594607,
+ 56383.220631706419,
+ 56403.767516545398,
+ 56424.316272770608,
+ 56444.866900041241,
+ 56465.419398016667,
+ 56485.973766356394,
+ 56506.530004720102,
+ 56527.088112767611,
+ 56547.648090158902,
+ 56568.209936554107,
+ 56588.773651613519,
+ 56609.339234997584,
+ 56629.9066863669,
+ 56650.47600538221,
+ 56671.04719170442,
+ 56691.620244994599,
+ 56712.195164913959,
+ 56732.771951123868,
+ 56753.350603285835,
+ 56773.931121061541,
+ 56794.513504112823,
+ 56815.097752101647,
+ 56835.683864690152,
+ 56856.271841540627,
+ 56876.86168231551,
+ 56897.453386677393,
+ 56918.046954289028,
+ 56938.642384813298,
+ 56959.239677913261,
+ 56979.838833252121,
+ 57000.439850493225,
+ 57021.04272930009,
+ 57041.647469336371,
+ 57062.254070265873,
+ 57082.862531752558,
+ 57103.472853460553,
+ 57124.085035054108,
+ 57144.699076197649,
+ 57165.314976555739,
+ 57185.932735793103,
+ 57206.552353574611,
+ 57227.173829565276,
+ 57247.797163430281,
+ 57268.42235483494,
+ 57289.049403444733,
+ 57309.678308925286,
+ 57330.30907094237,
+ 57350.941689161911,
+ 57371.576163249985,
+ 57392.212492872815,
+ 57412.850677696784,
+ 57433.490717388406,
+ 57454.132611614368,
+ 57474.776360041491,
+ 57495.421962336746,
+ 57516.069418167266,
+ 57536.718727200314,
+ 57557.36988910332,
+ 57578.022903543861,
+ 57598.677770189643,
+ 57619.334488708548,
+ 57639.993058768589,
+ 57660.653480037938,
+ 57681.315752184906,
+ 57701.979874877965,
+ 57722.64584778573,
+ 57743.31367057695,
+ 57763.983342920546,
+ 57784.654864485572,
+ 57805.328234941233,
+ 57826.003453956881,
+ 57846.680521202026,
+ 57867.359436346305,
+ 57888.040199059527,
+ 57908.722809011633,
+ 57929.407265872709,
+ 57950.093569313001,
+ 57970.781719002895,
+ 57991.471714612911,
+ 58012.16355581375,
+ 58032.857242276223,
+ 58053.552773671312,
+ 58074.25014967013,
+ 58094.949369943948,
+ 58115.650434164185,
+ 58136.353342002389,
+ 58157.058093130276,
+ 58177.764687219693,
+ 58198.47312394264,
+ 58219.183402971255,
+ 58239.895523977837,
+ 58260.609486634821,
+ 58281.325290614775,
+ 58302.042935590434,
+ 58322.762421234678,
+ 58343.483747220511,
+ 58364.206913221096,
+ 58384.931918909751,
+ 58405.658763959924,
+ 58426.3874480452,
+ 58447.117970839339,
+ 58467.85033201622,
+ 58488.584531249864,
+ 58509.320568214462,
+ 58530.058442584334,
+ 58550.798154033931,
+ 58571.539702237875,
+ 58592.283086870906,
+ 58613.028307607929,
+ 58633.775364123983,
+ 58654.52425609425,
+ 58675.274983194053,
+ 58696.027545098877,
+ 58716.781941484325,
+ 58737.538172026158,
+ 58758.296236400274,
+ 58779.056134282728,
+ 58799.817865349694,
+ 58820.581429277503,
+ 58841.346825742643,
+ 58862.114054421712,
+ 58882.883114991484,
+ 58903.654007128847,
+ 58924.426730510851,
+ 58945.201284814684,
+ 58965.977669717664,
+ 58986.755884897269,
+ 59007.535930031117,
+ 59028.317804796949,
+ 59049.101508872664,
+ 59069.887041936301,
+ 59090.674403666046,
+ 59111.463593740213,
+ 59132.254611837263,
+ 59153.047457635803,
+ 59173.84213081457,
+ 59194.638631052461,
+ 59215.436958028506,
+ 59236.237111421855,
+ 59257.039090911829,
+ 59277.842896177877,
+ 59298.648526899589,
+ 59319.455982756685,
+ 59340.26526342905,
+ 59361.076368596696,
+ 59381.889297939757,
+ 59402.704051138542,
+ 59423.520627873484,
+ 59444.339027825139,
+ 59465.159250674224,
+ 59485.9812961016,
+ 59506.805163788253,
+ 59527.630853415307,
+ 59548.458364664046,
+ 59569.287697215863,
+ 59590.118850752311,
+ 59610.951824955089,
+ 59631.786619506012,
+ 59652.623234087048,
+ 59673.461668380311,
+ 59694.301922068029,
+ 59715.143994832593,
+ 59735.987886356525,
+ 59756.833596322482,
+ 59777.681124413255,
+ 59798.530470311794,
+ 59819.381633701159,
+ 59840.234614264569,
+ 59861.089411685381,
+ 59881.94602564707,
+ 59902.804455833269,
+ 59923.664701927737,
+ 59944.526763614384,
+ 59965.390640577243,
+ 59986.256332500488,
+ 60007.123839068438,
+ 60027.993159965539,
+ 60048.864294876381,
+ 60069.737243485688,
+ 60090.612005478324,
+ 60111.488580539284,
+ 60132.366968353708,
+ 60153.247168606867,
+ 60174.129180984164,
+ 60195.013005171153,
+ 60215.898640853513,
+ 60236.786087717061,
+ 60257.675345447751,
+ 60278.566413731671,
+ 60299.459292255044,
+ 60320.353980704247,
+ 60341.25047876576,
+ 60362.148786126229,
+ 60383.048902472423,
+ 60403.950827491237,
+ 60424.854560869717,
+ 60445.76010229504,
+ 60466.667451454516,
+ 60487.57660803559,
+ 60508.487571725847,
+ 60529.400342212997,
+ 60550.314919184893,
+ 60571.231302329521,
+ 60592.149491335003,
+ 60613.069485889588,
+ 60633.991285681674,
+ 60654.914890399785,
+ 60675.840299732568,
+ 60696.767513368832,
+ 60717.696530997484,
+ 60738.627352307602,
+ 60759.55997698837,
+ 60780.494404729128,
+ 60801.430635219323,
+ 60822.368668148556,
+ 60843.308503206565,
+ 60864.250140083204,
+ 60885.193578468468,
+ 60906.138818052495,
+ 60927.085858525541,
+ 60948.034699578006,
+ 60968.985340900421,
+ 60989.937782183442,
+ 61010.892023117864,
+ 61031.848063394616,
+ 61052.805902704764,
+ 61073.765540739492,
+ 61094.726977190134,
+ 61115.690211748137,
+ 61136.655244105103,
+ 61157.622073952742,
+ 61178.590700982917,
+ 61199.561124887616,
+ 61220.533345358948,
+ 61241.507362089171,
+ 61262.483174770663,
+ 61283.460783095943,
+ 61304.440186757645,
+ 61325.421385448557,
+ 61346.404378861582,
+ 61367.389166689762,
+ 61388.375748626262,
+ 61409.364124364387,
+ 61430.354293597571,
+ 61451.346256019373,
+ 61472.340011323497,
+ 61493.335559203762,
+ 61514.332899354122,
+ 61535.332031468672,
+ 61556.332955241618,
+ 61577.335670367313,
+ 61598.340176540238,
+ 61619.346473454993,
+ 61640.354560806329,
+ 61661.3644382891,
+ 61682.376105598312,
+ 61703.389562429089,
+ 61724.404808476691,
+ 61745.42184343651,
+ 61766.440667004063,
+ 61787.461278874987,
+ 61808.483678745069,
+ 61829.507866310203,
+ 61850.533841266435,
+ 61871.561603309929,
+ 61892.591152136971,
+ 61913.622487443987,
+ 61934.655608927525,
+ 61955.690516284267,
+ 61976.727209211022,
+ 61997.765687404724,
+ 62018.805950562448,
+ 62039.847998381381,
+ 62060.891830558845,
+ 62081.93744679229,
+ 62102.984846779298,
+ 62124.034030217575,
+ 62145.084996804966,
+ 62166.137746239416,
+ 62187.19227821903,
+ 62208.248592442025,
+ 62229.306688606739,
+ 62250.366566411656,
+ 62271.428225555377,
+ 62292.491665736627,
+ 62313.556886654267,
+ 62334.623888007271,
+ 62355.692669494762,
+ 62376.763230815974,
+ 62397.835571670272,
+ 62418.909691757144,
+ 62439.98559077621,
+ 62461.063268427228,
+ 62482.142724410049,
+ 62503.223958424685,
+ 62524.306970171267,
+ 62545.39175935003,
+ 62566.478325661366,
+ 62587.566668805768,
+ 62608.656788483881,
+ 62629.748684396451,
+ 62650.842356244357,
+ 62671.937803728622,
+ 62693.035026550366,
+ 62714.134024410858,
+ 62735.234797011479,
+ 62756.337344053733,
+ 62777.441665239276,
+ 62798.547760269852,
+ 62819.655628847358,
+ 62840.765270673801,
+ 62861.876685451323,
+ 62882.989872882186,
+ 62904.104832668774,
+ 62925.221564513602,
+ 62946.340068119309,
+ 62967.460343188657,
+ 62988.582389424526,
+ 63009.70620652994,
+ 63030.831794208025,
+ 63051.959152162039,
+ 63073.08828009537,
+ 63094.219177711529,
+ 63115.351844714154,
+ 63136.486280806988,
+ 63157.622485693922,
+ 63178.760459078956,
+ 63199.900200666219,
+ 63221.041710159967,
+ 63242.184987264569,
+ 63263.330031684534,
+ 63284.476843124474,
+ 63305.625421289144,
+ 63326.775765883409,
+ 63347.927876612259,
+ 63369.081753180813,
+ 63390.237395294316,
+ 63411.39480265812,
+ 63432.553974977716,
+ 63453.714911958712,
+ 63474.877613306839,
+ 63496.042078727944,
+ 63517.208307927998,
+ 63538.376300613119,
+ 63559.546056489504,
+ 63580.717575263516,
+ 63601.890856641607,
+ 63623.065900330374,
+ 63644.242706036515,
+ 63665.421273466869,
+ 63686.601602328381,
+ 63707.783692328136,
+ 63728.967543173334,
+ 63750.153154571279,
+ 63771.340526229418,
+ 63792.529657855317,
+ 63813.720549156649,
+ 63834.913199841227,
+ 63856.107609616978,
+ 63877.303778191941,
+ 63898.501705274284,
+ 63919.7013905723,
+ 63940.902833794404,
+ 63962.106034649114,
+ 63983.310992845094,
+ 64004.517708091109,
+ 64025.726180096048,
+ 64046.936408568938,
+ 64068.1483932189,
+ 64089.362133755196,
+ 64110.577629887193,
+ 64131.794881324393,
+ 64153.013887776404,
+ 64174.234648952966,
+ 64195.457164563937,
+ 64216.681434319289,
+ 64237.907457929112,
+ 64259.135235103626,
+ 64280.36476555316,
+ 64301.596048988169,
+ 64322.829085119236,
+ 64344.06387365704,
+ 64365.300414312398,
+ 64386.538706796251,
+ 64407.778750819634,
+ 64429.020546093721,
+ 64450.26409232981,
+ 64471.509389239291,
+ 64492.756436533709,
+ 64514.005233924705,
+ 64535.255781124033,
+ 64556.50807784358,
+ 64577.762123795357,
+ 64599.017918691468,
+ 64620.275462244172,
+ 64641.534754165805,
+ 64662.795794168844,
+ 64684.058581965895,
+ 64705.323117269661,
+ 64726.589399792974,
+ 64747.857429248776,
+ 64769.127205350138,
+ 64790.398727810236,
+ 64811.671996342375,
+ 64832.947010659969,
+ 64854.223770476558,
+ 64875.502275505794,
+ 64896.782525461451,
+ 64918.064520057414,
+ 64939.348259007682,
+ 64960.633742026388,
+ 64981.920968827762,
+ 65003.209939126165,
+ 65024.500652636067,
+ 65045.793109072067,
+ 65067.087308148861,
+ 65088.383249581282,
+ 65109.680933084259,
+ 65130.980358372864,
+ 65152.28152516226,
+ 65173.584433167736,
+ 65194.889082104703,
+ 65216.195471688683,
+ 65237.503601635319,
+ 65258.813471660353,
+ 65280.125081479666,
+ 65301.438430809241,
+ 65322.753519365178,
+ 65344.070346863708,
+ 65365.388913021146,
+ 65386.709217553958,
+ 65408.031260178701,
+ 65429.355040612056,
+ 65450.680558570821,
+ 65472.00781377191,
+ 65493.336805932355,
+ 65514.66753476928,
+ 65535.999999999956,
+ 65557.334201341757,
+ 65578.670138512171,
+ 65600.007811228788,
+ 65621.347219209332,
+ 65642.688362171626,
+ 65664.031239833639,
+ 65685.375851913413,
+ 65706.722198129137,
+ 65728.070278199084,
+ 65749.420091841661,
+ 65770.771638775404,
+ 65792.124918718939,
+ 65813.479931391004,
+ 65834.836676510458,
+ 65856.195153796303,
+ 65877.5553629676,
+ 65898.917303743554,
+ 65920.280975843489,
+ 65941.646378986843,
+ 65963.013512893158,
+ 65984.382377282076,
+ 66005.752971873386,
+ 66027.125296386963,
+ 66048.499350542799,
+ 66069.875134061018,
+ 66091.252646661844,
+ 66112.631888065618,
+ 66134.01285799277,
+ 66155.395556163887,
+ 66176.779982299631,
+ 66198.166136120795,
+ 66219.554017348273,
+ 66240.943625703105,
+ 66262.334960906388,
+ 66283.728022679396,
+ 66305.122810743444,
+ 66326.519324820023,
+ 66347.917564630698,
+ 66369.317529897162,
+ 66390.719220341227,
+ 66412.122635684791,
+ 66433.527775649884,
+ 66454.934639958636,
+ 66476.343228333324,
+ 66497.753540496284,
+ 66519.165576169995,
+ 66540.57933507704,
+ 66561.994816940118,
+ 66583.412021482043,
+ 66604.830948425733,
+ 66626.251597494222,
+ 66647.673968410629,
+ 66669.098060898235,
+ 66690.523874680381,
+ 66711.951409480564,
+ 66733.380665022371,
+ 66754.811641029475,
+ 66776.244337225711,
+ 66797.678753334985,
+ 66819.11488908132,
+ 66840.552744188884,
+ 66861.992318381905,
+ 66883.433611384738,
+ 66904.876622921889,
+ 66926.321352717903,
+ 66947.767800497502,
+ 66969.215965985466,
+ 66990.665848906734,
+ 67012.117448986304,
+ 67033.570765949335,
+ 67055.025799521056,
+ 67076.482549426815,
+ 67097.941015392076,
+ 67119.401197142433,
+ 67140.863094403554,
+ 67162.326706901222,
+ 67183.792034361351,
+ 67205.259076509959,
+ 67226.72783307315,
+ 67248.198303777172,
+ 67269.670488348347,
+ 67291.144386513144,
+ 67312.619997998088,
+ 67334.09732252988,
+ 67355.576359835293,
+ 67377.057109641188,
+ 67398.53957167457,
+ 67420.023745662547,
+ 67441.50963133233,
+ 67462.99722841123,
+ 67484.486536626689,
+ 67505.977555706224,
+ 67527.470285377494,
+ 67548.964725368263,
+ 67570.460875406367,
+ 67591.9587352198,
+ 67613.458304536631,
+ 67634.95958308503,
+ 67656.462570593329,
+ 67677.967266789899,
+ 67699.473671403248,
+ 67720.981784162024,
+ 67742.491604794923,
+ 67764.003133030797,
+ 67785.516368598575,
+ 67807.031311227314,
+ 67828.547960646174,
+ 67850.066316584402,
+ 67871.58637877139,
+ 67893.108146936589,
+ 67914.63162080961,
+ 67936.156800120138,
+ 67957.683684597971,
+ 67979.212273973011,
+ 68000.742567975263,
+ 68022.274566334876,
+ 68043.808268782057,
+ 68065.343675047145,
+ 68086.880784860579,
+ 68108.419597952918,
+ 68129.960114054789,
+ 68151.502332896969,
+ 68173.04625421032,
+ 68194.591877725834,
+ 68216.139203174564,
+ 68237.688230287706,
+ 68259.238958796544,
+ 68280.791388432481,
+ 68302.345518927032,
+ 68323.901350011787,
+ 68345.458881418483,
+ 68367.018112878912,
+ 68388.579044125028,
+ 68410.141674888844,
+ 68431.706004902502,
+ 68453.272033898262,
+ 68474.839761608455,
+ 68496.409187765545,
+ 68517.980312102081,
+ 68539.553134350732,
+ 68561.127654244279,
+ 68582.70387151558,
+ 68604.281785897634,
+ 68625.861397123503,
+ 68647.44270492639,
+ 68669.025709039604,
+ 68690.610409196524,
+ 68712.196805130661,
+ 68733.784896575627,
+ 68755.374683265123,
+ 68776.966164932994,
+ 68798.559341313128,
+ 68820.154212139591,
+ 68841.750777146473,
+ 68863.349036068044,
+ 68884.948988638629,
+ 68906.550634592684,
+ 68928.153973664739,
+ 68949.75900558944,
+ 68971.365730101577,
+ 68992.974146935987,
+ 69014.584255827634,
+ 69036.196056511588,
+ 69057.809548723017,
+ 69079.424732197207,
+ 69101.041606669532,
+ 69122.660171875468,
+ 69144.280427550606,
+ 69165.902373430625,
+ 69187.526009251334,
+ 69209.151334748618,
+ 69230.778349658474,
+ 69252.40705371699,
+ 69274.037446660412,
+ 69295.669528225,
+ 69317.303298147192,
+ 69338.938756163494,
+ 69360.575902010532,
+ 69382.214735425005,
+ 69403.855256143754,
+ 69425.497463903681,
+ 69447.141358441833,
+ 69468.78693949533,
+ 69490.434206801394,
+ 69512.083160097391,
+ 69533.733799120717,
+ 69555.386123608929,
+ 69577.04013329967,
+ 69598.695827930685,
+ 69620.353207239794,
+ 69642.012270964973,
+ 69663.67301884426,
+ 69685.335450615792,
+ 69706.999566017839,
+ 69728.665364788743,
+ 69750.332846666963,
+ 69772.002011391058,
+ 69793.672858699691,
+ 69815.345388331611,
+ 69837.019600025669,
+ 69858.695493520849,
+ 69880.373068556204,
+ 69902.052324870907,
+ 69923.733262204216,
+ 69945.415880295492,
+ 69967.100178884211,
+ 69988.786157709939,
+ 70010.473816512356,
+ 70032.163155031216,
+ 70053.854173006403,
+ 70075.546870177874,
+ 70097.241246285717,
+ 70118.937301070109,
+ 70140.635034271298,
+ 70162.334445629691,
+ 70184.035534885741,
+ 70205.738301780017,
+ 70227.442746053217,
+ 70249.1488674461,
+ 70270.856665699539,
+ 70292.566140554511,
+ 70314.277291752107,
+ 70335.990119033493,
+ 70357.704622139936,
+ 70379.420800812819,
+ 70401.138654793613,
+ 70422.85818382389,
+ 70444.579387645339,
+ 70466.302265999722,
+ 70488.026818628918,
+ 70509.753045274876,
+ 70531.480945679708,
+ 70553.210519585555,
+ 70574.941766734701,
+ 70596.674686869505,
+ 70618.409279732456,
+ 70640.145545066101,
+ 70661.883482613106,
+ 70683.623092116264,
+ 70705.364373318414,
+ 70727.107325962526,
+ 70748.851949791671,
+ 70770.598244549008,
+ 70792.346209977783,
+ 70814.095845821372,
+ 70835.847151823225,
+ 70857.600127726895,
+ 70879.354773276034,
+ 70901.111088214413,
+ 70922.869072285859,
+ 70944.628725234332,
+ 70966.390046803877,
+ 70988.153036738629,
+ 71009.917694782853,
+ 71031.684020680885,
+ 71053.45201417715,
+ 71075.221675016204,
+ 71096.993002942661,
+ 71118.765997701266,
+ 71140.540659036851,
+ 71162.316986694335,
+ 71184.09498041874,
+ 71205.874639955218,
+ 71227.655965048951,
+ 71249.438955445294,
+ 71271.223610889632,
+ 71293.009931127483,
+ 71314.797915904477,
+ 71336.587564966307,
+ 71358.378878058764,
+ 71380.171854927772,
+ 71401.966495319313,
+ 71423.762798979486,
+ 71445.560765654489,
+ 71467.360395090596,
+ 71489.161687034211,
+ 71510.964641231811,
+ 71532.769257429973,
+ 71554.575535375348,
+ 71576.383474814749,
+ 71598.19307549503,
+ 71620.004337163133,
+ 71641.817259566145,
+ 71663.631842451214,
+ 71685.4480855656,
+ 71707.26598865664,
+ 71729.085551471784,
+ 71750.906773758586,
+ 71772.729655264673,
+ 71794.554195737772,
+ 71816.380394925713,
+ 71838.208252576442,
+ 71860.037768437964,
+ 71881.868942258385,
+ 71903.701773785942,
+ 71925.536262768932,
+ 71947.372408955751,
+ 71969.210212094898,
+ 71991.049671934976,
+ 72012.890788224686,
+ 72034.73356071279,
+ 72056.577989148165,
+ 72078.424073279821,
+ 72100.271812856794,
+ 72122.121207628254,
+ 72143.97225734347,
+ 72165.824961751801,
+ 72187.679320602692,
+ 72209.53533364569,
+ 72231.393000630429,
+ 72253.252321306645,
+ 72275.113295424177,
+ 72296.975922732949,
+ 72318.840202982959,
+ 72340.706135924338,
+ 72362.573721307272,
+ 72384.442958882093,
+ 72406.313848399179,
+ 72428.186389609036,
+ 72450.060582262216,
+ 72471.936426109431,
+ 72493.813920901433,
+ 72515.693066389096,
+ 72537.573862323392,
+ 72559.456308455352,
+ 72581.340404536139,
+ 72603.226150316987,
+ 72625.113545549248,
+ 72647.002589984331,
+ 72668.893283373764,
+ 72690.785625469172,
+ 72712.679616022273,
+ 72734.575254784853,
+ 72756.472541508803,
+ 72778.371475946144,
+ 72800.272057848939,
+ 72822.174286969355,
+ 72844.07816305969,
+ 72865.983685872285,
+ 72887.890855159596,
+ 72909.799670674183,
+ 72931.710132168693,
+ 72953.622239395845,
+ 72975.535992108475,
+ 72997.451390059519,
+ 73019.368433001961,
+ 73041.287120688925,
+ 73063.207452873612,
+ 73085.129429309294,
+ 73107.053049749389,
+ 73128.978313947344,
+ 73150.905221656736,
+ 73172.833772631217,
+ 73194.763966624567,
+ 73216.695803390612,
+ 73238.62928268328,
+ 73260.564404256627,
+ 73282.501167864757,
+ 73304.439573261901,
+ 73326.379620202337,
+ 73348.321308440485,
+ 73370.264637730841,
+ 73392.209607827957,
+ 73414.156218486532,
+ 73436.104469461323,
+ 73458.054360507173,
+ 73480.005891379056,
+ 73501.959061831993,
+ 73523.913871621116,
+ 73545.870320501665,
+ 73567.828408228932,
+ 73589.78813455833,
+ 73611.749499245358,
+ 73633.712502045615,
+ 73655.677142714747,
+ 73677.643421008557,
+ 73699.611336682879,
+ 73721.580889493693,
+ 73743.552079197019,
+ 73765.524905548999,
+ 73787.499368305856,
+ 73809.475467223907,
+ 73831.453202059551,
+ 73853.432572569291,
+ 73875.413578509717,
+ 73897.396219637507,
+ 73919.380495709411,
+ 73941.36640648231,
+ 73963.353951713143,
+ 73985.343131158952,
+ 74007.333944576865,
+ 74029.326391724098,
+ 74051.320472357969,
+ 74073.316186235883,
+ 74095.313533115303,
+ 74117.312512753837,
+ 74139.313124909138,
+ 74161.315369338976,
+ 74183.319245801191,
+ 74205.324754053727,
+ 74227.331893854629,
+ 74249.340664961986,
+ 74271.351067134034,
+ 74293.363100129049,
+ 74315.376763705441,
+ 74337.392057621662,
+ 74359.408981636298,
+ 74381.427535508003,
+ 74403.447718995507,
+ 74425.469531857671,
+ 74447.492973853383,
+ 74469.518044741693,
+ 74491.54474428168,
+ 74513.573072232539,
+ 74535.603028353551,
+ 74557.634612404087,
+ 74579.667824143602,
+ 74601.702663331642,
+ 74623.739129727837,
+ 74645.777223091936,
+ 74667.816943183716,
+ 74689.858289763113,
+ 74711.901262590094,
+ 74733.945861424741,
+ 74755.992086027225,
+ 74778.039936157802,
+ 74800.089411576817,
+ 74822.140512044702,
+ 74844.193237321961,
+ 74866.24758716923,
+ 74888.303561347187,
+ 74910.36115961663,
+ 74932.420381738411,
+ 74954.481227473516,
+ 74976.543696582972,
+ 74998.607788827925,
+ 75020.673503969607,
+ 75042.740841769322,
+ 75064.809801988464,
+ 75086.88038438854,
+ 75108.952588731103,
+ 75131.026414777836,
+ 75153.101862290467,
+ 75175.178931030852,
+ 75197.257620760924,
+ 75219.33793124267,
+ 75241.419862238225,
+ 75263.503413509738,
+ 75285.588584819503,
+ 75307.675375929874,
+ 75329.763786603318,
+ 75351.853816602365,
+ 75373.945465689612,
+ 75396.038733627807,
+ 75418.133620179724,
+ 75440.230125108254,
+ 75462.32824817636,
+ 75484.427989147109,
+ 75506.529347783653,
+ 75528.63232384919,
+ 75550.736917107075,
+ 75572.843127320695,
+ 75594.950954253538,
+ 75617.060397669193,
+ 75639.171457331307,
+ 75661.284133003646,
+ 75683.398424450032,
+ 75705.514331434402,
+ 75727.631853720741,
+ 75749.750991073175,
+ 75771.871743255862,
+ 75793.994110033076,
+ 75816.118091169177,
+ 75838.243686428585,
+ 75860.370895575848,
+ 75882.499718375562,
+ 75904.630154592422,
+ 75926.762203991224,
+ 75948.895866336825,
+ 75971.031141394182,
+ 75993.168028928325,
+ 76015.306528704401,
+ 76037.4466404876,
+ 76059.588364043215,
+ 76081.731699136653,
+ 76103.876645533353,
+ 76126.023202998884,
+ 76148.171371298871,
+ 76170.321150199044,
+ 76192.472539465205,
+ 76214.625538863256,
+ 76236.780148159174,
+ 76258.936367119008,
+ 76281.094195508922,
+ 76303.253633095141,
+ 76325.414679643975,
+ 76347.577334921851,
+ 76369.741598695226,
+ 76391.907470730686,
+ 76414.074950794879,
+ 76436.244038654564,
+ 76458.414734076548,
+ 76480.587036827754,
+ 76502.760946675175,
+ 76524.936463385893,
+ 76547.11358672705,
+ 76569.292316465915,
+ 76591.472652369819,
+ 76613.654594206164,
+ 76635.838141742468,
+ 76658.023294746308,
+ 76680.210052985349,
+ 76702.398416227341,
+ 76724.588384240138,
+ 76746.779956791637,
+ 76768.973133649866,
+ 76791.167914582897,
+ 76813.364299358902,
+ 76835.562287746157,
+ 76857.761879512967,
+ 76879.963074427797,
+ 76902.165872259109,
+ 76924.37027277553,
+ 76946.576275745727,
+ 76968.783880938441,
+ 76990.993088122515,
+ 77013.203897066895,
+ 77035.416307540567,
+ 77057.630319312622,
+ 77079.845932152239,
+ 77102.063145828695,
+ 77124.281960111301,
+ 77146.50237476948,
+ 77168.724389572759,
+ 77190.948004290723,
+ 77213.173218693031,
+ 77235.400032549442,
+ 77257.628445629802,
+ 77279.858457704031,
+ 77302.090068542122,
+ 77324.323277914169,
+ 77346.558085590339,
+ 77368.794491340886,
+ 77391.032494936138,
+ 77413.272096146524,
+ 77435.51329474253,
+ 77457.756090494731,
+ 77480.000483173804,
+ 77502.246472550498,
+ 77524.494058395634,
+ 77546.743240480107,
+ 77568.994018574944,
+ 77591.246392451198,
+ 77613.500361880026,
+ 77635.755926632657,
+ 77658.013086480438,
+ 77680.271841194757,
+ 77702.532190547092,
+ 77724.794134309021,
+ 77747.057672252195,
+ 77769.322804148323,
+ 77791.589529769248,
+ 77813.857848886837,
+ 77836.127761273063,
+ 77858.399266699998,
+ 77880.67236493979,
+ 77902.947055764627,
+ 77925.223338946831,
+ 77947.50121425878,
+ 77969.780681472927,
+ 77992.061740361838,
+ 78014.344390698127,
+ 78036.628632254491,
+ 78058.914464803747,
+ 78081.201888118725,
+ 78103.490901972415,
+ 78125.781506137821,
+ 78148.073700388064,
+ 78170.367484496339,
+ 78192.662858235926,
+ 78214.959821380166,
+ 78237.258373702498,
+ 78259.558514976452,
+ 78281.860244975614,
+ 78304.163563473659,
+ 78326.468470244363,
+ 78348.77496506153,
+ 78371.083047699125,
+ 78393.392717931114,
+ 78415.703975531578,
+ 78438.016820274701,
+ 78460.331251934695,
+ 78482.647270285903,
+ 78504.964875102727,
+ 78527.284066159627,
+ 78549.604843231195,
+ 78571.927206092048,
+ 78594.251154516911,
+ 78616.576688280606,
+ 78638.903807157985,
+ 78661.232510924034,
+ 78683.562799353778,
+ 78705.894672222363,
+ 78728.228129304945,
+ 78750.563170376859,
+ 78772.899795213423,
+ 78795.238003590101,
+ 78817.577795282399,
+ 78839.919170065928,
+ 78862.262127716356,
+ 78884.606668009452,
+ 78906.952790721043,
+ 78929.300495627045,
+ 78951.64978250346,
+ 78974.000651126378,
+ 78996.353101271932,
+ 79018.707132716358,
+ 79041.062745235977,
+ 79063.41993860717,
+ 79085.778712606436,
+ 79108.139067010285,
+ 79130.501001595389,
+ 79152.864516138419,
+ 79175.22961041618,
+ 79197.596284205531,
+ 79219.96453728342,
+ 79242.33436942687,
+ 79264.705780412987,
+ 79287.078770018954,
+ 79309.453338022009,
+ 79331.829484199508,
+ 79354.207208328866,
+ 79376.586510187582,
+ 79398.967389553218,
+ 79421.349846203433,
+ 79443.733879915948,
+ 79466.119490468584,
+ 79488.50667763922,
+ 79510.895441205823,
+ 79533.285780946433,
+ 79555.677696639163,
+ 79578.071188062226,
+ 79600.466254993895,
+ 79622.862897212515,
+ 79645.261114496549,
+ 79667.660906624471,
+ 79690.062273374875,
+ 79712.465214526455,
+ 79734.869729857935,
+ 79757.275819148126,
+ 79779.683482175955,
+ 79802.092718720378,
+ 79824.503528560454,
+ 79846.915911475327,
+ 79869.329867244203,
+ 79891.745395646343,
+ 79914.162496461155,
+ 79936.581169468045,
+ 79959.001414446553,
+ 79981.423231176261,
+ 80003.846619436852,
+ 80026.271579008084,
+ 80048.698109669771,
+ 80071.12621120183,
+ 80093.555883384237,
+ 80115.987125997053,
+ 80138.419938820414,
+ 80160.854321634528,
+ 80183.290274219689,
+ 80205.727796356281,
+ 80228.166887824715,
+ 80250.607548405547,
+ 80273.049777879336,
+ 80295.493576026798,
+ 80317.938942628651,
+ 80340.385877465727,
+ 80362.834380318949,
+ 80385.28445096928,
+ 80407.736089197788,
+ 80430.189294785596,
+ 80452.644067513917,
+ 80475.100407164035,
+ 80497.558313517322,
+ 80520.017786355209,
+ 80542.478825459213,
+ 80564.941430610925,
+ 80587.405601592007,
+ 80609.871338184195,
+ 80632.338640169342,
+ 80654.8075073293,
+ 80677.277939446067,
+ 80699.749936301683,
+ 80722.223497678278,
+ 80744.698623358039,
+ 80767.17531312324,
+ 80789.653566756242,
+ 80812.133384039465,
+ 80834.614764755403,
+ 80857.097708686648,
+ 80879.582215615854,
+ 80902.068285325731,
+ 80924.555917599093,
+ 80947.045112218824,
+ 80969.535868967869,
+ 80992.028187629272,
+ 81014.522067986123,
+ 81037.017509821613,
+ 81059.514512919006,
+ 81082.013077061609,
+ 81104.513202032831,
+ 81127.014887616184,
+ 81149.518133595193,
+ 81172.022939753486,
+ 81194.529305874807,
+ 81217.037231742899,
+ 81239.546717141639,
+ 81262.057761854958,
+ 81284.570365666848,
+ 81307.084528361403,
+ 81329.600249722775,
+ 81352.117529535186,
+ 81374.636367582949,
+ 81397.156763650448,
+ 81419.678717522125,
+ 81442.202228982511,
+ 81464.727297816222,
+ 81487.253923807933,
+ 81509.782106742379,
+ 81532.311846404409,
+ 81554.843142578902,
+ 81577.375995050839,
+ 81599.910403605274,
+ 81622.446368027333,
+ 81644.983888102215,
+ 81667.522963615178,
+ 81690.063594351581,
+ 81712.605780096841,
+ 81735.149520636449,
+ 81757.694815755967,
+ 81780.241665241047,
+ 81802.79006887741,
+ 81825.340026450824,
+ 81847.891537747171,
+ 81870.444602552379,
+ 81892.999220652477,
+ 81915.555391833506,
+ 81938.113115881672,
+ 81960.672392583176,
+ 81983.233221724338,
+ 82005.795603091537,
+ 82028.359536471224,
+ 82050.925021649906,
+ 82073.492058414209,
+ 82096.060646550788,
+ 82118.630785846399,
+ 82141.202476087841,
+ 82163.775717062032,
+ 82186.35050855593,
+ 82208.926850356569,
+ 82231.504742251054,
+ 82254.084184026578,
+ 82276.665175470393,
+ 82299.24771636985,
+ 82321.831806512317,
+ 82344.417445685307,
+ 82367.004633676348,
+ 82389.593370273054,
+ 82412.183655263143,
+ 82434.775488434374,
+ 82457.368869574595,
+ 82479.963798471697,
+ 82502.560274913689,
+ 82525.158298688606,
+ 82547.757869584602,
+ 82570.35898738986,
+ 82592.961651892678,
+ 82615.565862881398,
+ 82638.171620144421,
+ 82660.778923470265,
+ 82683.387772647475,
+ 82705.998167464713,
+ 82728.610107710658,
+ 82751.223593174116,
+ 82773.83862364394,
+ 82796.45519890904,
+ 82819.073318758441,
+ 82841.692982981185,
+ 82864.314191366429,
+ 82886.936943703375,
+ 82909.561239781324,
+ 82932.187079389638,
+ 82954.814462317736,
+ 82977.443388355125,
+ 83000.073857291369,
+ 83022.70586891612,
+ 83045.339423019104,
+ 83067.974519390089,
+ 83090.611157818959,
+ 83113.249338095629,
+ 83135.8890600101,
+ 83158.530323352461,
+ 83181.173127912858,
+ 83203.817473481497,
+ 83226.463359848669,
+ 83249.11078680474,
+ 83271.759754140134,
+ 83294.410261645375,
+ 83317.062309111003,
+ 83339.715896327703,
+ 83362.371023086147,
+ 83385.027689177165,
+ 83407.685894391587,
+ 83430.345638520361,
+ 83453.006921354478,
+ 83475.669742685001,
+ 83498.334102303095,
+ 83520.999999999942,
+ 83543.667435566866,
+ 83566.336408795192,
+ 83589.006919476349,
+ 83611.678967401851,
+ 83634.352552363242,
+ 83657.027674152167,
+ 83679.704332560359,
+ 83702.382527379552,
+ 83725.062258401638,
+ 83747.743525418511,
+ 83770.42632822218,
+ 83793.110666604684,
+ 83815.796540358162,
+ 83838.483949274829,
+ 83861.172893146941,
+ 83883.863371766842,
+ 83906.555384926964,
+ 83929.248932419752,
+ 83951.944014037799,
+ 83974.640629573696,
+ 83997.338778820151,
+ 84020.038461569929,
+ 84042.739677615857,
+ 84065.442426750829,
+ 84088.146708767847,
+ 84110.852523459922,
+ 84133.559870620171,
+ 84156.268750041796,
+ 84178.979161518029,
+ 84201.691104842204,
+ 84224.404579807713,
+ 84247.119586208006,
+ 84269.83612383662,
+ 84292.55419248715,
+ 84315.273791953281,
+ 84337.994922028738,
+ 84360.717582507335,
+ 84383.441773182945,
+ 84406.167493849513,
+ 84428.894744301069,
+ 84451.623524331691,
+ 84474.353833735542,
+ 84497.085672306828,
+ 84519.819039839858,
+ 84542.553936128999,
+ 84565.290360968676,
+ 84588.028314153402,
+ 84610.767795477717,
+ 84633.508804736295,
+ 84656.251341723822,
+ 84678.995406235073,
+ 84701.740998064924,
+ 84724.488117008252,
+ 84747.236762860062,
+ 84769.986935415407,
+ 84792.73863446941,
+ 84815.491859817252,
+ 84838.246611254188,
+ 84861.002888575575,
+ 84883.760691576768,
+ 84906.520020053256,
+ 84929.28087380057,
+ 84952.043252614312,
+ 84974.807156290146,
+ 84997.572584623806,
+ 85020.339537411113,
+ 85043.108014447949,
+ 85065.878015530237,
+ 85088.649540453989,
+ 85111.422589015303,
+ 85134.197161010321,
+ 85156.973256235244,
+ 85179.750874486374,
+ 85202.530015560071,
+ 85225.310679252725,
+ 85248.092865360857,
+ 85270.876573681016,
+ 85293.661804009811,
+ 85316.448556143951,
+ 85339.236829880188,
+ 85362.026625015351,
+ 85384.817941346351,
+ 85407.610778670132,
+ 85430.405136783724,
+ 85453.201015484257,
+ 85475.998414568865,
+ 85498.797333834795,
+ 85521.597773079353,
+ 85544.399732099904,
+ 85567.203210693886,
+ 85590.008208658808,
+ 85612.814725792239,
+ 85635.62276189182,
+ 85658.432316755265,
+ 85681.243390180331,
+ 85704.055981964877,
+ 85726.870091906807,
+ 85749.685719804082,
+ 85772.502865454764,
+ 85795.321528656961,
+ 85818.141709208852,
+ 85840.963406908675,
+ 85863.78662155474,
+ 85886.611352945445,
+ 85909.437600879217,
+ 85932.26536515457,
+ 85955.094645570091,
+ 85977.92544192441,
+ 86000.757754016275,
+ 86023.591581644432,
+ 86046.426924607746,
+ 86069.263782705122,
+ 86092.102155735556,
+ 86114.942043498071,
+ 86137.783445791807,
+ 86160.626362415918,
+ 86183.470793169676,
+ 86206.316737852379,
+ 86229.164196263402,
+ 86252.013168202204,
+ 86274.863653468303,
+ 86297.715651861261,
+ 86320.569163180728,
+ 86343.424187226425,
+ 86366.280723798132,
+ 86389.138772695675,
+ 86411.998333718977,
+ 86434.859406668009,
+ 86457.721991342827,
+ 86480.586087543532,
+ 86503.451695070296,
+ 86526.318813723352,
+ 86549.187443303032,
+ 86572.057583609683,
+ 86594.929234443756,
+ 86617.802395605773,
+ 86640.677066896271,
+ 86663.553248115903,
+ 86686.43093906538,
+ 86709.310139545443,
+ 86732.190849356964,
+ 86755.073068300815,
+ 86777.956796177954,
+ 86800.842032789442,
+ 86823.728777936354,
+ 86846.617031419853,
+ 86869.506793041175,
+ 86892.398062601613,
+ 86915.290839902518,
+ 86938.185124745316,
+ 86961.080916931489,
+ 86983.978216262592,
+ 87006.87702254027,
+ 87029.777335566177,
+ 87052.67915514209,
+ 87075.582481069796,
+ 87098.487313151185,
+ 87121.39365118822,
+ 87144.301494982894,
+ 87167.210844337285,
+ 87190.121699053532,
+ 87213.034058933845,
+ 87235.947923780506,
+ 87258.863293395829,
+ 87281.780167582241,
+ 87304.698546142172,
+ 87327.618428878181,
+ 87350.539815592856,
+ 87373.462706088845,
+ 87396.387100168897,
+ 87419.312997635774,
+ 87442.240398292357,
+ 87465.16930194154,
+ 87488.099708386319,
+ 87511.031617429733,
+ 87533.965028874911,
+ 87556.899942525008,
+ 87579.836358183282,
+ 87602.774275653021,
+ 87625.713694737613,
+ 87648.654615240492,
+ 87671.597036965148,
+ 87694.540959715145,
+ 87717.486383294105,
+ 87740.433307505737,
+ 87763.381732153779,
+ 87786.331657042057,
+ 87809.283081974456,
+ 87832.236006754916,
+ 87855.190431187453,
+ 87878.146355076155,
+ 87901.103778225151,
+ 87924.062700438633,
+ 87947.023121520891,
+ 87969.985041276246,
+ 87992.948459509105,
+ 88015.913376023906,
+ 88038.879790625171,
+ 88061.847703117513,
+ 88084.817113305573,
+ 88107.788020994049,
+ 88130.760425987726,
+ 88153.734328091465,
+ 88176.709727110137,
+ 88199.686622848749,
+ 88222.665015112303,
+ 88245.644903705906,
+ 88268.626288434709,
+ 88291.609169103947,
+ 88314.593545518903,
+ 88337.579417484914,
+ 88360.566784807408,
+ 88383.555647291854,
+ 88406.546004743795,
+ 88429.537856968818,
+ 88452.531203772611,
+ 88475.52604496089,
+ 88498.522380339447,
+ 88521.52020971413,
+ 88544.519532890874,
+ 88567.520349675644,
+ 88590.522659874507,
+ 88613.526463293543,
+ 88636.531759738922,
+ 88659.538549016899,
+ 88682.546830933745,
+ 88705.556605295846,
+ 88728.567871909589,
+ 88751.580630581491,
+ 88774.594881118086,
+ 88797.610623325963,
+ 88820.62785701183,
+ 88843.646581982393,
+ 88866.666798044462,
+ 88889.688505004888,
+ 88912.711702670611,
+ 88935.7363908486,
+ 88958.762569345898,
+ 88981.790237969632,
+ 89004.81939652696,
+ 89027.850044825114,
+ 89050.882182671412,
+ 89073.9158098732,
+ 89096.950926237885,
+ 89119.987531572973,
+ 89143.025625686001,
+ 89166.065208384563,
+ 89189.106279476357,
+ 89212.148838769106,
+ 89235.192886070581,
+ 89258.238421188667,
+ 89281.285443931265,
+ 89304.333954106376,
+ 89327.383951522017,
+ 89350.435435986306,
+ 89373.488407307406,
+ 89396.542865293537,
+ 89419.598809753006,
+ 89442.656240494165,
+ 89465.715157325409,
+ 89488.775560055219,
+ 89511.837448492137,
+ 89534.900822444746,
+ 89557.965681721733,
+ 89581.032026131812,
+ 89604.099855483742,
+ 89627.169169586399,
+ 89650.239968248672,
+ 89673.312251279538,
+ 89696.386018488018,
+ 89719.461269683205,
+ 89742.53800467425,
+ 89765.616223270365,
+ 89788.69592528083,
+ 89811.777110514988,
+ 89834.859778782207,
+ 89857.943929891975,
+ 89881.029563653807,
+ 89904.116679877261,
+ 89927.205278372014,
+ 89950.29535894774,
+ 89973.386921414218,
+ 89996.479965581268,
+ 90019.574491258769,
+ 90042.670498256688,
+ 90065.767986385021,
+ 90088.866955453836,
+ 90111.967405273259,
+ 90135.069335653476,
+ 90158.172746404758,
+ 90181.277637337407,
+ 90204.384008261797,
+ 90227.49185898836,
+ 90250.601189327586,
+ 90273.711999090039,
+ 90296.824288086325,
+ 90319.938056127125,
+ 90343.053303023189,
+ 90366.170028585286,
+ 90389.288232624298,
+ 90412.407914951138,
+ 90435.529075376777,
+ 90458.651713712257,
+ 90481.775829768681,
+ 90504.901423357209,
+ 90528.028494289058,
+ 90551.157042375504,
+ 90574.287067427911,
+ 90597.418569257643,
+ 90620.551547676194,
+ 90643.686002495073,
+ 90666.821933525847,
+ 90689.959340580186,
+ 90713.098223469773,
+ 90736.238582006365,
+ 90759.380416001804,
+ 90782.523725267951,
+ 90805.668509616764,
+ 90828.814768860233,
+ 90851.962502810435,
+ 90875.11171127946,
+ 90898.262394079517,
+ 90921.414551022855,
+ 90944.568181921743,
+ 90967.72328658856,
+ 90990.879864835719,
+ 91014.037916475718,
+ 91037.19744132107,
+ 91060.358439184391,
+ 91083.520909878338,
+ 91106.684853215629,
+ 91129.850269009039,
+ 91153.017157071401,
+ 91176.185517215621,
+ 91199.355349254649,
+ 91222.526653001492,
+ 91245.699428269247,
+ 91268.873674871036,
+ 91292.049392620058,
+ 91315.226581329553,
+ 91338.405240812834,
+ 91361.585370883287,
+ 91384.766971354344,
+ 91407.950042039476,
+ 91431.134582752245,
+ 91454.320593306256,
+ 91477.508073515171,
+ 91500.697023192712,
+ 91523.887442152685,
+ 91547.07933020893,
+ 91570.272687175326,
+ 91593.467512865856,
+ 91616.663807094534,
+ 91639.861569675442,
+ 91663.060800422725,
+ 91686.261499150554,
+ 91709.463665673218,
+ 91732.66729980502,
+ 91755.872401360321,
+ 91779.078970153569,
+ 91802.287005999257,
+ 91825.49650871192,
+ 91848.707478106167,
+ 91871.91991399668,
+ 91895.133816198169,
+ 91918.349184525418,
+ 91941.566018793281,
+ 91964.784318816659,
+ 91988.004084410495,
+ 92011.22531538982,
+ 92034.448011569708,
+ 92057.672172765277,
+ 92080.897798791746,
+ 92104.124889464365,
+ 92127.353444598411,
+ 92150.58346400928,
+ 92173.814947512379,
+ 92197.04789492322,
+ 92220.282306057314,
+ 92243.518180730272,
+ 92266.755518757753,
+ 92289.994319955469,
+ 92313.234584139194,
+ 92336.476311124774,
+ 92359.719500728082,
+ 92382.964152765067,
+ 92406.210267051734,
+ 92429.457843404161,
+ 92452.706881638471,
+ 92475.957381570814,
+ 92499.209343017443,
+ 92522.462765794655,
+ 92545.717649718805,
+ 92568.973994606305,
+ 92592.231800273614,
+ 92615.491066537259,
+ 92638.751793213814,
+ 92662.01398011994,
+ 92685.277627072326,
+ 92708.54273388772,
+ 92731.809300382942,
+ 92755.077326374871,
+ 92778.346811680414,
+ 92801.617756116568,
+ 92824.890159500384,
+ 92848.164021648947,
+ 92871.439342379424,
+ 92894.716121509016,
+ 92917.994358855023,
+ 92941.274054234746,
+ 92964.555207465572,
+ 92987.837818364962,
+ 93011.121886750407,
+ 93034.407412439468,
+ 93057.694395249753,
+ 93080.982834998955,
+ 93104.272731504767,
+ 93127.564084584999,
+ 93150.856894057491,
+ 93174.15115974014,
+ 93197.446881450916,
+ 93220.744059007804,
+ 93244.04269222889,
+ 93267.342780932304,
+ 93290.644324936235,
+ 93313.947324058914,
+ 93337.251778118633,
+ 93360.557686933767,
+ 93383.865050322696,
+ 93407.173868103928,
+ 93430.484140095941,
+ 93453.795866117362,
+ 93477.109045986799,
+ 93500.423679522952,
+ 93523.739766544561,
+ 93547.057306870454,
+ 93570.376300319491,
+ 93593.696746710571,
+ 93617.018645862699,
+ 93640.341997594893,
+ 93663.666801726242,
+ 93686.993058075881,
+ 93710.320766463032,
+ 93733.64992670693,
+ 93756.980538626914,
+ 93780.312602042337,
+ 93803.646116772637,
+ 93826.981082637285,
+ 93850.317499455836,
+ 93873.655367047861,
+ 93896.994685233032,
+ 93920.335453831038,
+ 93943.677672661666,
+ 93967.021341544707,
+ 93990.366460300051,
+ 94013.713028747632,
+ 94037.061046707429,
+ 94060.410513999494,
+ 94083.761430443905,
+ 94107.113795860845,
+ 94130.467610070496,
+ 94153.822872893157,
+ 94177.179584149111,
+ 94200.537743658759,
+ 94223.897351242529,
+ 94247.25840672091,
+ 94270.620909914433,
+ 94293.98486064373,
+ 94317.350258729421,
+ 94340.71710399224,
+ 94364.085396252936,
+ 94387.455135332348,
+ 94410.82632105134,
+ 94434.198953230851,
+ 94457.573031691878,
+ 94480.948556255447,
+ 94504.325526742658,
+ 94527.70394297468,
+ 94551.083804772716,
+ 94574.465111958023,
+ 94597.847864351934,
+ 94621.232061775823,
+ 94644.617704051096,
+ 94668.004790999272,
+ 94691.393322441872,
+ 94714.783298200506,
+ 94738.174718096794,
+ 94761.567581952477,
+ 94784.961889589307,
+ 94808.357640829097,
+ 94831.754835493703,
+ 94855.153473405066,
+ 94878.553554385173,
+ 94901.955078256055,
+ 94925.358044839784,
+ 94948.762453958523,
+ 94972.168305434476,
+ 94995.575599089891,
+ 95018.984334747074,
+ 95042.394512228391,
+ 95065.806131356265,
+ 95089.219191953176,
+ 95112.633693841635,
+ 95136.04963684424,
+ 95159.467020783617,
+ 95182.885845482466,
+ 95206.306110763529,
+ 95229.727816449609,
+ 95253.150962363579,
+ 95276.575548328314,
+ 95300.001574166803,
+ 95323.429039702052,
+ 95346.857944757154,
+ 95370.288289155214,
+ 95393.720072719429,
+ 95417.153295273019,
+ 95440.587956639298,
+ 95464.024056641589,
+ 95487.461595103305,
+ 95510.900571847902,
+ 95534.340986698866,
+ 95557.782839479783,
+ 95581.226130014256,
+ 95604.670858125959,
+ 95628.117023638595,
+ 95651.564626375985,
+ 95675.013666161918,
+ 95698.464142820303,
+ 95721.916056175076,
+ 95745.369406050231,
+ 95768.824192269807,
+ 95792.280414657915,
+ 95815.738073038709,
+ 95839.197167236387,
+ 95862.657697075221,
+ 95886.11966237954,
+ 95909.583062973688,
+ 95933.047898682111,
+ 95956.514169329268,
+ 95979.981874739708,
+ 96003.451014738006,
+ 96026.921589148798,
+ 96050.393597796792,
+ 96073.867040506724,
+ 96097.341917103375,
+ 96120.818227411626,
+ 96144.295971256375,
+ 96167.775148462577,
+ 96191.255758855244,
+ 96214.737802259449,
+ 96238.221278500292,
+ 96261.70618740299,
+ 96285.192528792715,
+ 96308.680302494788,
+ 96332.169508334526,
+ 96355.660146137321,
+ 96379.152215728609,
+ 96402.645716933868,
+ 96426.14064957868,
+ 96449.637013488609,
+ 96473.134808489311,
+ 96496.63403440651,
+ 96520.134691065963,
+ 96543.636778293469,
+ 96567.140295914898,
+ 96590.645243756153,
+ 96614.151621643221,
+ 96637.659429402134,
+ 96661.168666858954,
+ 96684.679333839798,
+ 96708.191430170875,
+ 96731.70495567839,
+ 96755.219910188665,
+ 96778.736293528011,
+ 96802.254105522836,
+ 96825.77334599958,
+ 96849.29401478474,
+ 96872.816111704873,
+ 96896.339636586577,
+ 96919.864589256511,
+ 96943.390969541389,
+ 96966.918777267958,
+ 96990.448012263048,
+ 97013.978674353522,
+ 97037.510763366285,
+ 97061.044279128328,
+ 97084.579221466673,
+ 97108.115590208385,
+ 97131.653385180587,
+ 97155.19260621049,
+ 97178.733253125291,
+ 97202.2753257523,
+ 97225.81882391886,
+ 97249.363747452342,
+ 97272.910096180189,
+ 97296.457869929916,
+ 97320.007068529041,
+ 97343.557691805196,
+ 97367.109739586012,
+ 97390.663211699197,
+ 97414.218107972498,
+ 97437.774428233737,
+ 97461.332172310766,
+ 97484.891340031507,
+ 97508.451931223899,
+ 97532.013945715982,
+ 97555.577383335811,
+ 97579.142243911512,
+ 97602.708527271257,
+ 97626.276233243261,
+ 97649.845361655811,
+ 97673.415912337223,
+ 97696.987885115886,
+ 97720.561279820206,
+ 97744.1360962787,
+ 97767.712334319876,
+ 97791.289993772341,
+ 97814.869074464703,
+ 97838.449576225685,
+ 97862.031498883996,
+ 97885.614842268449,
+ 97909.199606207883,
+ 97932.785790531183,
+ 97956.37339506732,
+ 97979.962419645264,
+ 98003.552864094076,
+ 98027.144728242856,
+ 98050.738011920766,
+ 98074.332714956996,
+ 98097.928837180807,
+ 98121.526378421506,
+ 98145.125338508456,
+ 98168.725717271067,
+ 98192.327514538789,
+ 98215.930730141132,
+ 98239.535363907664,
+ 98263.141415668011,
+ 98286.748885251814,
+ 98310.357772488816,
+ 98333.968077208759,
+ 98357.579799241488,
+ 98381.192938416847,
+ 98404.807494564782,
+ 98428.42346751524,
+ 98452.040857098269,
+ 98475.659663143917,
+ 98499.27988548232,
+ 98522.901523943656,
+ 98546.524578358163,
+ 98570.149048556093,
+ 98593.774934367786,
+ 98617.402235623624,
+ 98641.030952154048,
+ 98664.661083789513,
+ 98688.292630360564,
+ 98711.925591697771,
+ 98735.559967631794,
+ 98759.195757993293,
+ 98782.832962613014,
+ 98806.471581321734,
+ 98830.111613950285,
+ 98853.753060329575,
+ 98877.39592029051,
+ 98901.040193664099,
+ 98924.68588028138,
+ 98948.33297997342,
+ 98971.981492571387,
+ 98995.63141790645,
+ 99019.282755809851,
+ 99042.935506112874,
+ 99066.589668646877,
+ 99090.245243243233,
+ 99113.902229733401,
+ 99137.560627948857,
+ 99161.220437721131,
+ 99184.881658881859,
+ 99208.544291262631,
+ 99232.208334695169,
+ 99255.87378901121,
+ 99279.540654042547,
+ 99303.208929621018,
+ 99326.878615578535,
+ 99350.549711746993,
+ 99374.222217958435,
+ 99397.896134044888,
+ 99421.571459838422,
+ 99445.248195171211,
+ 99468.926339875441,
+ 99492.605893783344,
+ 99516.286856727209,
+ 99539.969228539398,
+ 99563.653009052287,
+ 99587.338198098325,
+ 99611.024795510006,
+ 99634.712801119866,
+ 99658.402214760499,
+ 99682.093036264545,
+ 99705.785265464699,
+ 99729.478902193689,
+ 99753.173946284325,
+ 99776.870397569437,
+ 99800.56825588191,
+ 99824.267521054688,
+ 99847.968192920773,
+ 99871.670271313182,
+ 99895.373756065004,
+ 99919.078647009388,
+ 99942.78494397951,
+ 99966.492646808634,
+ 99990.20175533001,
+ 100013.91226937699,
+ 100037.62418878295,
+ 100061.33751338134,
+ 100085.05224300563,
+ 100108.76837748935,
+ 100132.4859166661,
+ 100156.2048603695,
+ 100179.92520843323,
+ 100203.64696069101,
+ 100227.37011697664,
+ 100251.09467712394,
+ 100274.82064096678,
+ 100298.54800833909,
+ 100322.27677907483,
+ 100346.00695300807,
+ 100369.73852997283,
+ 100393.47150980328,
+ 100417.20589233354,
+ 100440.94167739789,
+ 100464.67886483055,
+ 100488.41745446586,
+ 100512.1574461382,
+ 100535.89883968196,
+ 100559.64163493161,
+ 100583.38583172169,
+ 100607.13142988674,
+ 100630.87842926137,
+ 100654.62682968024,
+ 100678.37663097809,
+ 100702.12783298964,
+ 100725.88043554971,
+ 100749.63443849317,
+ 100773.38984165489,
+ 100797.14664486986,
+ 100820.90484797307,
+ 100844.66445079957,
+ 100868.42545318443,
+ 100892.18785496285,
+ 100915.95165596998,
+ 100939.71685604109,
+ 100963.48345501146,
+ 100987.25145271645,
+ 101011.02084899142,
+ 101034.79164367182,
+ 101058.56383659317,
+ 101082.33742759094,
+ 101106.11241650078,
+ 101129.88880315828,
+ 101153.66658739912,
+ 101177.44576905905,
+ 101201.22634797383,
+ 101225.00832397929,
+ 101248.7916969113,
+ 101272.57646660579,
+ 101296.36263289873,
+ 101320.15019562612,
+ 101343.93915462404,
+ 101367.7295097286,
+ 101391.52126077596,
+ 101415.31440760233,
+ 101439.10895004397,
+ 101462.9048879372,
+ 101486.70222111834,
+ 101510.50094942382,
+ 101534.30107269008,
+ 101558.10259075361,
+ 101581.90550345098,
+ 101605.70981061876,
+ 101629.5155120936,
+ 101653.32260771218,
+ 101677.13109731126,
+ 101700.9409807276,
+ 101724.75225779804,
+ 101748.56492835947,
+ 101772.37899224881,
+ 101796.19444930303,
+ 101820.01129935916,
+ 101843.82954225427,
+ 101867.64917782549,
+ 101891.47020590997,
+ 101915.29262634492,
+ 101939.11643896763,
+ 101962.94164361537,
+ 101986.76824012553,
+ 102010.59622833549,
+ 102034.42560808272,
+ 102058.25637920471,
+ 102082.08854153901,
+ 102105.9220949232,
+ 102129.75703919494,
+ 102153.59337419191,
+ 102177.43109975185,
+ 102201.27021571253,
+ 102225.1107219118,
+ 102248.95261818753,
+ 102272.79590437764,
+ 102296.64058032009,
+ 102320.48664585294,
+ 102344.33410081422,
+ 102368.18294504205,
+ 102392.03317837461,
+ 102415.88480065008,
+ 102439.73781170673,
+ 102463.59221138287,
+ 102487.44799951684,
+ 102511.30517594704,
+ 102535.1637405119,
+ 102559.02369304992,
+ 102582.88503339965,
+ 102606.74776139967,
+ 102630.61187688859,
+ 102654.4773797051,
+ 102678.34426968795,
+ 102702.21254667587,
+ 102726.08221050771,
+ 102749.95326102231,
+ 102773.8256980586,
+ 102797.69952145554,
+ 102821.57473105213,
+ 102845.45132668741,
+ 102869.32930820051,
+ 102893.20867543056,
+ 102917.08942821674,
+ 102940.97156639832,
+ 102964.85508981455,
+ 102988.73999830478,
+ 103012.6262917084,
+ 103036.51396986481,
+ 103060.40303261351,
+ 103084.293479794,
+ 103108.18531124585,
+ 103132.07852680866,
+ 103155.97312632212,
+ 103179.8691096259,
+ 103203.76647655977,
+ 103227.66522696352,
+ 103251.56536067701,
+ 103275.46687754011,
+ 103299.36977739276,
+ 103323.27406007495,
+ 103347.1797254267,
+ 103371.0867732881,
+ 103394.99520349925,
+ 103418.90501590034,
+ 103442.81621033157,
+ 103466.72878663319,
+ 103490.64274464553,
+ 103514.55808420894,
+ 103538.4748051638,
+ 103562.39290735057,
+ 103586.31239060973,
+ 103610.23325478184,
+ 103634.15549970744,
+ 103658.07912522719,
+ 103682.00413118176,
+ 103705.93051741188,
+ 103729.85828375829,
+ 103753.78743006183,
+ 103777.71795616332,
+ 103801.64986190372,
+ 103825.58314712394,
+ 103849.51781166498,
+ 103873.4538553679,
+ 103897.39127807376,
+ 103921.33007962372,
+ 103945.27025985894,
+ 103969.21181862066,
+ 103993.15475575015,
+ 104017.0990710887,
+ 104041.0447644777,
+ 104064.99183575854,
+ 104088.94028477269,
+ 104112.89011136163,
+ 104136.84131536692,
+ 104160.79389663014,
+ 104184.74785499295,
+ 104208.70319029699,
+ 104232.65990238401,
+ 104256.61799109577,
+ 104280.57745627411,
+ 104304.53829776087,
+ 104328.50051539797,
+ 104352.46410902737,
+ 104376.42907849104,
+ 104400.39542363105,
+ 104424.36314428948,
+ 104448.33224030846,
+ 104472.3027115302,
+ 104496.27455779689,
+ 104520.24777895081,
+ 104544.22237483428,
+ 104568.19834528965,
+ 104592.17569015936,
+ 104616.15440928582,
+ 104640.13450251156,
+ 104664.1159696791,
+ 104688.09881063103,
+ 104712.08302520998,
+ 104736.06861325864,
+ 104760.05557461972,
+ 104784.043909136,
+ 104808.03361665027,
+ 104832.0246970054,
+ 104856.01715004431,
+ 104880.01097560991,
+ 104904.00617354522,
+ 104928.00274369326,
+ 104952.00068589712,
+ 104975.99999999993,
+ 105000.00068584486,
+ 105024.00274327511,
+ 105048.00617213396,
+ 105072.0109722647,
+ 105096.0171435107,
+ 105120.02468571534,
+ 105144.03359872208,
+ 105168.04388237436,
+ 105192.05553651576,
+ 105216.06856098982,
+ 105240.08295564017,
+ 105264.09872031047,
+ 105288.11585484444,
+ 105312.13435908582,
+ 105336.1542328784,
+ 105360.17547606604,
+ 105384.19808849262,
+ 105408.22207000206,
+ 105432.24742043833,
+ 105456.27413964548,
+ 105480.30222746753,
+ 105504.33168374863,
+ 105528.36250833291,
+ 105552.39470106458,
+ 105576.42826178786,
+ 105600.46319034706,
+ 105624.49948658649,
+ 105648.53715035053,
+ 105672.5761814836,
+ 105696.61657983017,
+ 105720.65834523473,
+ 105744.70147754184,
+ 105768.7459765961,
+ 105792.79184224214,
+ 105816.83907432464,
+ 105840.88767268835,
+ 105864.93763717801,
+ 105888.98896763846,
+ 105913.04166391456,
+ 105937.09572585119,
+ 105961.15115329332,
+ 105985.20794608595,
+ 106009.26610407409,
+ 106033.32562710284,
+ 106057.38651501729,
+ 106081.44876766266,
+ 106105.51238488412,
+ 106129.57736652695,
+ 106153.64371243643,
+ 106177.71142245791,
+ 106201.78049643678,
+ 106225.85093421848,
+ 106249.92273564848,
+ 106273.99590057228,
+ 106298.07042883546,
+ 106322.14632028362,
+ 106346.22357476239,
+ 106370.30219211751,
+ 106394.38217219469,
+ 106418.46351483969,
+ 106442.54621989837,
+ 106466.63028721658,
+ 106490.71571664025,
+ 106514.80250801529,
+ 106538.89066118775,
+ 106562.98017600364,
+ 106587.07105230905,
+ 106611.16328995011,
+ 106635.25688877302,
+ 106659.35184862395,
+ 106683.44816934918,
+ 106707.54585079502,
+ 106731.64489280782,
+ 106755.74529523395,
+ 106779.84705791986,
+ 106803.95018071201,
+ 106828.05466345693,
+ 106852.16050600118,
+ 106876.26770819137,
+ 106900.37626987413,
+ 106924.48619089619,
+ 106948.59747110425,
+ 106972.71011034511,
+ 106996.82410846559,
+ 107020.93946531253,
+ 107045.05618073288,
+ 107069.17425457356,
+ 107093.29368668159,
+ 107117.41447690397,
+ 107141.53662508781,
+ 107165.66013108024,
+ 107189.7849947284,
+ 107213.91121587952,
+ 107238.03879438085,
+ 107262.16773007967,
+ 107286.29802282334,
+ 107310.42967245923,
+ 107334.56267883476,
+ 107358.69704179741,
+ 107382.83276119467,
+ 107406.96983687414,
+ 107431.10826868335,
+ 107455.24805646999,
+ 107479.38920008171,
+ 107503.53169936626,
+ 107527.67555417139,
+ 107551.82076434491,
+ 107575.96732973469,
+ 107600.11525018861,
+ 107624.26452555459,
+ 107648.41515568066,
+ 107672.56714041479,
+ 107696.72047960508,
+ 107720.87517309963,
+ 107745.03122074658,
+ 107769.18862239413,
+ 107793.34737789053,
+ 107817.50748708403,
+ 107841.66894982298,
+ 107865.83176595572,
+ 107889.99593533068,
+ 107914.16145779629,
+ 107938.32833320105,
+ 107962.49656139348,
+ 107986.66614222217,
+ 108010.83707553572,
+ 108035.00936118282,
+ 108059.18299901215,
+ 108083.35798887245,
+ 108107.53433061253,
+ 108131.71202408121,
+ 108155.89106912735,
+ 108180.07146559987,
+ 108204.25321334775,
+ 108228.43631221994,
+ 108252.62076206553,
+ 108276.80656273357,
+ 108300.99371407321,
+ 108325.18221593359,
+ 108349.37206816394,
+ 108373.56327061349,
+ 108397.75582313156,
+ 108421.94972556747,
+ 108446.1449777706,
+ 108470.34157959036,
+ 108494.53953087622,
+ 108518.73883147769,
+ 108542.93948124432,
+ 108567.14148002568,
+ 108591.34482767139,
+ 108615.54952403114,
+ 108639.75556895464,
+ 108663.96296229165,
+ 108688.17170389196,
+ 108712.38179360541,
+ 108736.59323128188,
+ 108760.80601677128,
+ 108785.02014992358,
+ 108809.23563058881,
+ 108833.45245861699,
+ 108857.67063385822,
+ 108881.89015616261,
+ 108906.11102538036,
+ 108930.33324136167,
+ 108954.55680395682,
+ 108978.78171301607,
+ 109003.00796838976,
+ 109027.23556992831,
+ 109051.46451748211,
+ 109075.69481090162,
+ 109099.92645003737,
+ 109124.15943473989,
+ 109148.39376485976,
+ 109172.62944024763,
+ 109196.86646075416,
+ 109221.10482623006,
+ 109245.34453652608,
+ 109269.58559149304,
+ 109293.82799098175,
+ 109318.07173484311,
+ 109342.31682292801,
+ 109366.56325508743,
+ 109390.81103117237,
+ 109415.06015103387,
+ 109439.31061452301,
+ 109463.56242149093,
+ 109487.8155717888,
+ 109512.07006526781,
+ 109536.3259017792,
+ 109560.58308117429,
+ 109584.8416033044,
+ 109609.1014680209,
+ 109633.36267517522,
+ 109657.62522461878,
+ 109681.88911620311,
+ 109706.15434977971,
+ 109730.4209252002,
+ 109754.68884231619,
+ 109778.95810097932,
+ 109803.22870104131,
+ 109827.50064235389,
+ 109851.77392476884,
+ 109876.04854813802,
+ 109900.32451231324,
+ 109924.60181714644,
+ 109948.88046248957,
+ 109973.1604481946,
+ 109997.44177411357,
+ 110021.72444009855,
+ 110046.00844600165,
+ 110070.29379167501,
+ 110094.58047697082,
+ 110118.86850174134,
+ 110143.15786583882,
+ 110167.44856911557,
+ 110191.74061142397,
+ 110216.03399261639,
+ 110240.32871254528,
+ 110264.62477106311,
+ 110288.9221680224,
+ 110313.22090327571,
+ 110337.52097667565,
+ 110361.82238807483,
+ 110386.12513732594,
+ 110410.42922428172,
+ 110434.73464879491,
+ 110459.04141071832,
+ 110483.34950990479,
+ 110507.6589462072,
+ 110531.96971947847,
+ 110556.28182957157,
+ 110580.5952763395,
+ 110604.91005963532,
+ 110629.22617931209,
+ 110653.54363522294,
+ 110677.86242722106,
+ 110702.18255515963,
+ 110726.50401889188,
+ 110750.82681827113,
+ 110775.1509531507,
+ 110799.47642338395,
+ 110823.80322882428,
+ 110848.13136932514,
+ 110872.46084474004,
+ 110896.79165492248,
+ 110921.12379972603,
+ 110945.4572790043,
+ 110969.79209261097,
+ 110994.12824039967,
+ 111018.46572222417,
+ 111042.80453793822,
+ 111067.14468739564,
+ 111091.48617045028,
+ 111115.82898695602,
+ 111140.1731367668,
+ 111164.51861973655,
+ 111188.86543571933,
+ 111213.21358456917,
+ 111237.56306614014,
+ 111261.91388028639,
+ 111286.26602686207,
+ 111310.61950572141,
+ 111334.97431671864,
+ 111359.33045970804,
+ 111383.68793454397,
+ 111408.04674108078,
+ 111432.40687917286,
+ 111456.76834867468,
+ 111481.13114944073,
+ 111505.49528132551,
+ 111529.86074418361,
+ 111554.22753786964,
+ 111578.59566223821,
+ 111602.96511714405,
+ 111627.33590244185,
+ 111651.7080179864,
+ 111676.08146363248,
+ 111700.45623923496,
+ 111724.8323446487,
+ 111749.20977972864,
+ 111773.58854432974,
+ 111797.96863830699,
+ 111822.35006151545,
+ 111846.73281381019,
+ 111871.11689504632,
+ 111895.50230507903,
+ 111919.8890437635,
+ 111944.27711095495,
+ 111968.6665065087,
+ 111993.05723028004,
+ 112017.44928212435,
+ 112041.842661897,
+ 112066.23736945343,
+ 112090.63340464912,
+ 112115.03076733962,
+ 112139.42945738042,
+ 112163.82947462716,
+ 112188.23081893545,
+ 112212.63349016097,
+ 112237.03748815943,
+ 112261.44281278658,
+ 112285.84946389822,
+ 112310.25744135017,
+ 112334.66674499828,
+ 112359.07737469849,
+ 112383.48933030672,
+ 112407.90261167898,
+ 112432.31721867126,
+ 112456.73315113965,
+ 112481.15040894024,
+ 112505.56899192919,
+ 112529.98889996267,
+ 112554.41013289688,
+ 112578.8326905881,
+ 112603.25657289263,
+ 112627.68177966679,
+ 112652.10831076698,
+ 112676.53616604958,
+ 112700.96534537108,
+ 112725.39584858794,
+ 112749.82767555672,
+ 112774.26082613398,
+ 112798.6953001763,
+ 112823.13109754038,
+ 112847.56821808286,
+ 112872.00666166049,
+ 112896.44642813003,
+ 112920.88751734827,
+ 112945.32992917208,
+ 112969.77366345831,
+ 112994.21872006389,
+ 113018.66509884578,
+ 113043.11279966099,
+ 113067.56182236652,
+ 113092.01216681948,
+ 113116.46383287695,
+ 113140.9168203961,
+ 113165.37112923413,
+ 113189.82675924824,
+ 113214.28371029573,
+ 113238.74198223387,
+ 113263.20157492002,
+ 113287.66248821157,
+ 113312.12472196593,
+ 113336.58827604055,
+ 113361.05315029295,
+ 113385.51934458067,
+ 113409.98685876124,
+ 113434.45569269233,
+ 113458.92584623155,
+ 113483.39731923661,
+ 113507.87011156522,
+ 113532.34422307517,
+ 113556.81965362425,
+ 113581.2964030703,
+ 113605.77447127122,
+ 113630.25385808491,
+ 113654.73456336933,
+ 113679.2165869825,
+ 113703.69992878241,
+ 113728.18458862718,
+ 113752.67056637487,
+ 113777.15786188368,
+ 113801.64647501177,
+ 113826.13640561736,
+ 113850.62765355874,
+ 113875.12021869418,
+ 113899.61410088204,
+ 113924.1092999807,
+ 113948.60581584855,
+ 113973.10364834407,
+ 113997.60279732574,
+ 114022.1032626521,
+ 114046.60504418171,
+ 114071.10814177318,
+ 114095.61255528514,
+ 114120.11828457628,
+ 114144.62532950533,
+ 114169.13368993104,
+ 114193.6433657122,
+ 114218.15435670764,
+ 114242.66666277625,
+ 114267.18028377694,
+ 114291.69521956862,
+ 114316.21147001031,
+ 114340.72903496103,
+ 114365.24791427983,
+ 114389.7681078258,
+ 114414.2896154581,
+ 114438.81243703589,
+ 114463.33657241837,
+ 114487.8620214648,
+ 114512.38878403447,
+ 114536.91685998671,
+ 114561.44624918087,
+ 114585.97695147636,
+ 114610.5089667326,
+ 114635.04229480909,
+ 114659.57693556532,
+ 114684.11288886084,
+ 114708.65015455526,
+ 114733.18873250818,
+ 114757.72862257928,
+ 114782.26982462825,
+ 114806.81233851484,
+ 114831.35616409882,
+ 114855.90130123998,
+ 114880.44774979822,
+ 114904.99550963337,
+ 114929.5445806054,
+ 114954.09496257425,
+ 114978.64665539992,
+ 115003.19965894247,
+ 115027.75397306195,
+ 115052.30959761847,
+ 115076.86653247218,
+ 115101.42477748329,
+ 115125.984332512,
+ 115150.54519741859,
+ 115175.10737206334,
+ 115199.67085630659,
+ 115224.23565000873,
+ 115248.80175303014,
+ 115273.3691652313,
+ 115297.93788647266,
+ 115322.50791661476,
+ 115347.07925551817,
+ 115371.65190304347,
+ 115396.22585905129,
+ 115420.80112340231,
+ 115445.37769595724,
+ 115469.95557657682,
+ 115494.53476512182,
+ 115519.11526145306,
+ 115543.69706543141,
+ 115568.28017691776,
+ 115592.86459577303,
+ 115617.4503218582,
+ 115642.03735503425,
+ 115666.62569516223,
+ 115691.21534210323,
+ 115715.80629571836,
+ 115740.39855586876,
+ 115764.99212241563,
+ 115789.58699522018,
+ 115814.18317414368,
+ 115838.78065904744,
+ 115863.37944979276,
+ 115887.97954624105,
+ 115912.5809482537,
+ 115937.18365569216,
+ 115961.78766841792,
+ 115986.39298629249,
+ 116010.99960917742,
+ 116035.60753693432,
+ 116060.21676942479,
+ 116084.82730651053,
+ 116109.43914805322,
+ 116134.0522939146,
+ 116158.66674395646,
+ 116183.2824980406,
+ 116207.89955602887,
+ 116232.51791778316,
+ 116257.13758316539,
+ 116281.75855203751,
+ 116306.38082426153,
+ 116331.00439969949,
+ 116355.62927821343,
+ 116380.25545966547,
+ 116404.88294391775,
+ 116429.51173083246,
+ 116454.14182027178,
+ 116478.77321209799,
+ 116503.40590617337,
+ 116528.03990236025,
+ 116552.67520052097,
+ 116577.31180051794,
+ 116601.94970221359,
+ 116626.5889054704,
+ 116651.22941015086,
+ 116675.87121611751,
+ 116700.51432323294,
+ 116725.15873135976,
+ 116749.8044403606,
+ 116774.45145009817,
+ 116799.0997604352,
+ 116823.74937123443,
+ 116848.40028235866,
+ 116873.05249367072,
+ 116897.70600503348,
+ 116922.36081630984,
+ 116947.01692736275,
+ 116971.67433805518,
+ 116996.33304825013,
+ 117020.99305781067,
+ 117045.65436659988,
+ 117070.31697448085,
+ 117094.98088131678,
+ 117119.64608697082,
+ 117144.31259130624,
+ 117168.98039418629,
+ 117193.64949547425,
+ 117218.31989503348,
+ 117242.99159272734,
+ 117267.66458841923,
+ 117292.33888197262,
+ 117317.01447325097,
+ 117341.6913621178,
+ 117366.36954843666,
+ 117391.04903207115,
+ 117415.72981288488,
+ 117440.41189074152,
+ 117465.09526550474,
+ 117489.77993703831,
+ 117514.46590520597,
+ 117539.15316987153,
+ 117563.84173089883,
+ 117588.53158815173,
+ 117613.22274149416,
+ 117637.91519079007,
+ 117662.60893590341,
+ 117687.30397669821,
+ 117712.00031303853,
+ 117736.69794478847,
+ 117761.39687181212,
+ 117786.09709397367,
+ 117810.7986111373,
+ 117835.50142316725,
+ 117860.20552992777,
+ 117884.91093128319,
+ 117909.6176270978,
+ 117934.32561723603,
+ 117959.03490156225,
+ 117983.74547994092,
+ 118008.45735223651,
+ 118033.17051831353,
+ 118057.88497803656,
+ 118082.60073127014,
+ 118107.31777787894,
+ 118132.03611772758,
+ 118156.75575068076,
+ 118181.47667660323,
+ 118206.19889535972,
+ 118230.92240681504,
+ 118255.64721083404,
+ 118280.37330728157,
+ 118305.10069602253,
+ 118329.82937692189,
+ 118354.55934984458,
+ 118379.29061465565,
+ 118404.02317122012,
+ 118428.75701940308,
+ 118453.49215906965,
+ 118478.22859008498,
+ 118502.96631231424,
+ 118527.70532562268,
+ 118552.44562987552,
+ 118577.18722493808,
+ 118601.93011067568,
+ 118626.67428695368,
+ 118651.41975363747,
+ 118676.16651059251,
+ 118700.91455768423,
+ 118725.66389477813,
+ 118750.41452173979,
+ 118775.16643843475,
+ 118799.91964472862,
+ 118824.67414048707,
+ 118849.42992557574,
+ 118874.18699986035,
+ 118898.94536320666,
+ 118923.70501548045,
+ 118948.46595654752,
+ 118973.22818627374,
+ 118997.99170452499,
+ 119022.7565111672,
+ 119047.52260606633,
+ 119072.28998908834,
+ 119097.0586600993,
+ 119121.82861896523,
+ 119146.59986555226,
+ 119171.3723997265,
+ 119196.14622135412,
+ 119220.92133030134,
+ 119245.69772643436,
+ 119270.47540961947,
+ 119295.25437972297,
+ 119320.03463661121,
+ 119344.81618015055,
+ 119369.5990102074,
+ 119394.38312664822,
+ 119419.16852933947,
+ 119443.95521814766,
+ 119468.74319293935,
+ 119493.53245358112,
+ 119518.32299993958,
+ 119543.11483188139,
+ 119567.90794927324,
+ 119592.70235198183,
+ 119617.49803987393,
+ 119642.29501281632,
+ 119667.09327067583,
+ 119691.89281331931,
+ 119716.69364061367,
+ 119741.49575242582,
+ 119766.29914862274,
+ 119791.10382907141,
+ 119815.90979363887,
+ 119840.71704219218,
+ 119865.52557459843,
+ 119890.33539072477,
+ 119915.14649043836,
+ 119939.95887360642,
+ 119964.77254009615,
+ 119989.58748977486,
+ 120014.40372250983,
+ 120039.22123816841,
+ 120064.04003661797,
+ 120088.86011772591,
+ 120113.6814813597,
+ 120138.5041273868,
+ 120163.3280556747,
+ 120188.15326609099,
+ 120212.97975850321,
+ 120237.807532779,
+ 120262.63658878599,
+ 120287.46692639188,
+ 120312.29854546436,
+ 120337.13144587121,
+ 120361.9656274802,
+ 120386.80109015915,
+ 120411.63783377589,
+ 120436.47585819835,
+ 120461.31516329442,
+ 120486.15574893207,
+ 120510.99761497928,
+ 120535.84076130406,
+ 120560.68518777451,
+ 120585.53089425867,
+ 120610.3778806247,
+ 120635.22614674074,
+ 120660.07569247499,
+ 120684.92651769568,
+ 120709.77862227106,
+ 120734.63200606944,
+ 120759.48666895913,
+ 120784.3426108085,
+ 120809.19983148595,
+ 120834.05833085992,
+ 120858.91810879884,
+ 120883.77916517125,
+ 120908.64149984565,
+ 120933.5051126906,
+ 120958.37000357473,
+ 120983.23617236665,
+ 121008.10361893504,
+ 121032.97234314861,
+ 121057.84234487606,
+ 121082.71362398617,
+ 121107.58618034775,
+ 121132.46001382964,
+ 121157.33512430069,
+ 121182.21151162982,
+ 121207.08917568595,
+ 121231.96811633807,
+ 121256.84833345517,
+ 121281.72982690629,
+ 121306.61259656049,
+ 121331.49664228689,
+ 121356.38196395461,
+ 121381.26856143285,
+ 121406.15643459078,
+ 121431.04558329767,
+ 121455.93600742276,
+ 121480.82770683538,
+ 121505.72068140487,
+ 121530.61493100057,
+ 121555.51045549192,
+ 121580.40725474835,
+ 121605.30532863933,
+ 121630.20467703436,
+ 121655.10529980299,
+ 121680.00719681478,
+ 121704.91036793934,
+ 121729.81481304632,
+ 121754.72053200539,
+ 121779.62752468624,
+ 121804.53579095862,
+ 121829.44533069231,
+ 121854.3561437571,
+ 121879.26823002285,
+ 121904.1815893594,
+ 121929.09622163669,
+ 121954.01212672464,
+ 121978.92930449323,
+ 122003.84775481246,
+ 122028.76747755238,
+ 122053.68847258303,
+ 122078.61073977455,
+ 122103.53427899707,
+ 122128.45909012076,
+ 122153.38517301581,
+ 122178.31252755247,
+ 122203.24115360099,
+ 122228.17105103172,
+ 122253.10221971494,
+ 122278.03465952107,
+ 122302.96837032049,
+ 122327.90335198362,
+ 122352.83960438096,
+ 122377.777127383,
+ 122402.71592086025,
+ 122427.65598468333,
+ 122452.59731872278,
+ 122477.53992284928,
+ 122502.48379693348,
+ 122527.42894084606,
+ 122552.37535445779,
+ 122577.32303763942,
+ 122602.27199026172,
+ 122627.22221219557,
+ 122652.17370331181,
+ 122677.12646348133,
+ 122702.08049257506,
+ 122727.03579046397,
+ 122751.99235701906,
+ 122776.95019211136,
+ 122801.9092956119,
+ 122826.8696673918,
+ 122851.83130732219,
+ 122876.79421527422,
+ 122901.75839111909,
+ 122926.72383472799,
+ 122951.69054597223,
+ 122976.65852472307,
+ 123001.62777085182,
+ 123026.59828422987,
+ 123051.57006472857,
+ 123076.54311221937,
+ 123101.5174265737,
+ 123126.49300766307,
+ 123151.46985535898,
+ 123176.44796953299,
+ 123201.42735005668,
+ 123226.40799680166,
+ 123251.38990963959,
+ 123276.37308844214,
+ 123301.35753308103,
+ 123326.343243428,
+ 123351.33021935483,
+ 123376.31846073334,
+ 123401.30796743535,
+ 123426.29873933276,
+ 123451.29077629748,
+ 123476.28407820144,
+ 123501.2786449166,
+ 123526.27447631498,
+ 123551.27157226863,
+ 123576.26993264959,
+ 123601.26955732999,
+ 123626.27044618195,
+ 123651.27259907764,
+ 123676.27601588926,
+ 123701.28069648903,
+ 123726.28664074924,
+ 123751.29384854218,
+ 123776.30231974016,
+ 123801.31205421555,
+ 123826.32305184075,
+ 123851.33531248817,
+ 123876.34883603029,
+ 123901.36362233957,
+ 123926.37967128855,
+ 123951.39698274979,
+ 123976.41555659588,
+ 124001.43539269941,
+ 124026.45649093305,
+ 124051.47885116948,
+ 124076.50247328142,
+ 124101.5273571416,
+ 124126.55350262282,
+ 124151.58090959788,
+ 124176.60957793961,
+ 124201.63950752091,
+ 124226.67069821467,
+ 124251.70314989384,
+ 124276.73686243138,
+ 124301.7718357003,
+ 124326.80806957364,
+ 124351.84556392446,
+ 124376.88431862585,
+ 124401.92433355095,
+ 124426.96560857294,
+ 124452.00814356498,
+ 124477.05193840031,
+ 124502.0969929522,
+ 124527.14330709392,
+ 124552.19088069882,
+ 124577.23971364023,
+ 124602.28980579154,
+ 124627.34115702618,
+ 124652.3937672176,
+ 124677.44763623926,
+ 124702.50276396469,
+ 124727.55915026742,
+ 124752.61679502104,
+ 124777.67569809916,
+ 124802.73585937542,
+ 124827.79727872348,
+ 124852.85995601704,
+ 124877.92389112986,
+ 124902.98908393568,
+ 124928.05553430831,
+ 124953.1232421216,
+ 124978.19220724938,
+ 125003.26242956554,
+ 125028.33390894404,
+ 125053.40664525882,
+ 125078.48063838384,
+ 125103.55588819318,
+ 125128.63239456083,
+ 125153.71015736091,
+ 125178.78917646752,
+ 125203.86945175481,
+ 125228.95098309696,
+ 125254.03377036817,
+ 125279.1178134427,
+ 125304.20311219479,
+ 125329.28966649878,
+ 125354.37747622898,
+ 125379.46654125977,
+ 125404.55686146552,
+ 125429.6484367207,
+ 125454.74126689974,
+ 125479.83535187715,
+ 125504.93069152744,
+ 125530.02728572517,
+ 125555.12513434493,
+ 125580.22423726133,
+ 125605.32459434902,
+ 125630.4262054827,
+ 125655.52907053704,
+ 125680.63318938682,
+ 125705.73856190679,
+ 125730.84518797178,
+ 125755.9530674566,
+ 125781.06220023613,
+ 125806.17258618528,
+ 125831.28422517896,
+ 125856.39711709213,
+ 125881.51126179981,
+ 125906.62665917698,
+ 125931.74330909875,
+ 125956.86121144016,
+ 125981.98036607634,
+ 126007.10077288245,
+ 126032.22243173365,
+ 126057.34534250517,
+ 126082.46950507225,
+ 126107.59491931014,
+ 126132.72158509417,
+ 126157.84950229966,
+ 126182.97867080198,
+ 126208.10909047653,
+ 126233.24076119871,
+ 126258.37368284403,
+ 126283.50785528794,
+ 126308.64327840599,
+ 126333.77995207369,
+ 126358.91787616667,
+ 126384.0570505605,
+ 126409.19747513086,
+ 126434.3391497534,
+ 126459.48207430386,
+ 126484.62624865794,
+ 126509.77167269142,
+ 126534.9183462801,
+ 126560.06626929982,
+ 126585.21544162642,
+ 126610.36586313581,
+ 126635.51753370393,
+ 126660.67045320668,
+ 126685.82462152008,
+ 126710.98003852014,
+ 126736.13670408291,
+ 126761.29461808444,
+ 126786.45378040087,
+ 126811.61419090834,
+ 126836.77584948298,
+ 126861.93875600102,
+ 126887.10291033868,
+ 126912.26831237224,
+ 126937.43496197795,
+ 126962.60285903217,
+ 126987.77200341123,
+ 127012.94239499152,
+ 127038.11403364947,
+ 127063.2869192615,
+ 127088.46105170409,
+ 127113.63643085376,
+ 127138.81305658702,
+ 127163.99092878048,
+ 127189.17004731069,
+ 127214.35041205429,
+ 127239.53202288797,
+ 127264.71487968838,
+ 127289.89898233226,
+ 127315.08433069635,
+ 127340.27092465744,
+ 127365.45876409234,
+ 127390.64784887788,
+ 127415.83817889093,
+ 127441.02975400841,
+ 127466.22257410725,
+ 127491.41663906439,
+ 127516.61194875685,
+ 127541.80850306165,
+ 127567.00630185583,
+ 127592.20534501647,
+ 127617.4056324207,
+ 127642.60716394568,
+ 127667.80993946856,
+ 127693.01395886653,
+ 127718.21922201688,
+ 127743.42572879682,
+ 127768.63347908368,
+ 127793.84247275478,
+ 127819.05270968749,
+ 127844.26418975917,
+ 127869.47691284724,
+ 127894.69087882918,
+ 127919.90608758242,
+ 127945.12253898452,
+ 127970.34023291297,
+ 127995.55916924537,
+ 128020.77934785932,
+ 128046.00076863244,
+ 128071.22343144237,
+ 128096.44733616684,
+ 128121.67248268353,
+ 128146.89887087021,
+ 128172.12650060465,
+ 128197.35537176467,
+ 128222.5854842281,
+ 128247.81683787282,
+ 128273.04943257671,
+ 128298.28326821771,
+ 128323.51834467379,
+ 128348.75466182294,
+ 128373.99221954317,
+ 128399.23101771252,
+ 128424.47105620909,
+ 128449.71233491098,
+ 128474.95485369631,
+ 128500.19861244329,
+ 128525.44361103009,
+ 128550.68984933494,
+ 128575.93732723613,
+ 128601.18604461191,
+ 128626.43600134061,
+ 128651.68719730059,
+ 128676.93963237021,
+ 128702.1933064279,
+ 128727.44821935208,
+ 128752.70437102125,
+ 128777.96176131385,
+ 128803.22039010846,
+ 128828.48025728362,
+ 128853.74136271792,
+ 128879.00370628996,
+ 128904.26728787841,
+ 128929.53210736193,
+ 128954.79816461923,
+ 128980.06545952905,
+ 129005.33399197015,
+ 129030.60376182134,
+ 129055.87476896142,
+ 129081.14701326926,
+ 129106.42049462376,
+ 129131.6952129038,
+ 129156.97116798835,
+ 129182.24835975636,
+ 129207.52678808685,
+ 129232.80645285884,
+ 129258.08735395141,
+ 129283.36949124365,
+ 129308.65286461466,
+ 129333.9374739436,
+ 129359.22331910966,
+ 129384.51039999202,
+ 129409.79871646997,
+ 129435.08826842274,
+ 129460.37905572963,
+ 129485.67107826998,
+ 129510.96433592314,
+ 129536.25882856851,
+ 129561.55455608548,
+ 129586.85151835352,
+ 129612.14971525209,
+ 129637.4491466607,
+ 129662.74981245887,
+ 129688.0517125262,
+ 129713.35484674224,
+ 129738.65921498663,
+ 129763.96481713903,
+ 129789.27165307909,
+ 129814.57972268655,
+ 129839.88902584116,
+ 129865.19956242264,
+ 129890.51133231082,
+ 129915.82433538554,
+ 129941.13857152662,
+ 129966.45404061397,
+ 129991.7707425275,
+ 130017.08867714716,
+ 130042.4078443529,
+ 130067.72824402474,
+ 130093.04987604271,
+ 130118.37274028687,
+ 130143.69683663732,
+ 130169.02216497416,
+ 130194.34872517755,
+ 130219.67651712766,
+ 130245.0055407047,
+ 130270.33579578891,
+ 130295.66728226055,
+ 130320.99999999991,
+ 130346.33394888733,
+ 130371.66912880314,
+ 130397.00553962773,
+ 130422.34318124152,
+ 130447.68205352494,
+ 130473.02215635845,
+ 130498.36348962256,
+ 130523.70605319779,
+ 130549.0498469647,
+ 130574.39487080388,
+ 130599.74112459592,
+ 130625.08860822149,
+ 130650.43732156123,
+ 130675.78726449587,
+ 130701.13843690613,
+ 130726.49083867275,
+ 130751.84446967654,
+ 130777.19932979831,
+ 130802.5554189189,
+ 130827.91273691918,
+ 130853.27128368006,
+ 130878.63105908247,
+ 130903.99206300738,
+ 130929.35429533575,
+ 130954.71775594862,
+ 130980.08244472703,
+ 131005.44836155206,
+ 131030.81550630482,
+ 131056.18387886642,
+ 131081.55347911804,
+ 131106.92430694087,
+ 131132.29636221612,
+ 131157.66964482504,
+ 131183.0441546489,
+ 131208.41989156904,
+ 131233.79685546676,
+ 131259.17504622342,
+ 131284.55446372041,
+ 131309.93510783918,
+ 131335.31697846117,
+ 131360.70007546784,
+ 131386.0843987407,
+ 131411.46994816128,
+ 131436.85672361116,
+ 131462.24472497194,
+ 131487.63395212521,
+ 131513.02440495262,
+ 131538.41608333588,
+ 131563.80898715663,
+ 131589.2031162967,
+ 131614.59847063778,
+ 131639.9950500617,
+ 131665.39285445024,
+ 131690.79188368531,
+ 131716.19213764873,
+ 131741.59361622241,
+ 131766.99631928833,
+ 131792.40024672839,
+ 131817.80539842462,
+ 131843.21177425905,
+ 131868.61937411371,
+ 131894.02819787065,
+ 131919.43824541202,
+ 131944.84951661993,
+ 131970.26201137656,
+ 131995.67572956407,
+ 132021.09067106468,
+ 132046.50683576067,
+ 132071.9242235343,
+ 132097.34283426782,
+ 132122.76266784366,
+ 132148.1837241441,
+ 132173.60600305157,
+ 132199.02950444847,
+ 132224.45422821722,
+ 132249.88017424036,
+ 132275.30734240031,
+ 132300.73573257966,
+ 132326.16534466096,
+ 132351.59617852676,
+ 132377.02823405969,
+ 132402.46151114244,
+ 132427.89600965759,
+ 132453.33172948789,
+ 132478.76867051609,
+ 132504.20683262491,
+ 132529.64621569714,
+ 132555.08681961559,
+ 132580.5286442631,
+ 132605.97168952253,
+ 132631.41595527678,
+ 132656.86144140881,
+ 132682.30814780149,
+ 132707.75607433787,
+ 132733.20522090094,
+ 132758.65558737374,
+ 132784.10717363929,
+ 132809.55997958075,
+ 132835.01400508118,
+ 132860.46925002377,
+ 132885.92571429166,
+ 132911.38339776811,
+ 132936.84230033628,
+ 132962.30242187946,
+ 132987.76376228096,
+ 133013.22632142407,
+ 133038.69009919214,
+ 133064.15509546854,
+ 133089.62131013666,
+ 133115.08874307995,
+ 133140.55739418184,
+ 133166.02726332581,
+ 133191.49835039541,
+ 133216.97065527414,
+ 133242.44417784561,
+ 133267.91891799335,
+ 133293.39487560102,
+ 133318.87205055228,
+ 133344.35044273079,
+ 133369.83005202023,
+ 133395.31087830439,
+ 133420.79292146701,
+ 133446.27618139185,
+ 133471.76065796276,
+ 133497.24635106357,
+ 133522.73326057816,
+ 133548.22138639039,
+ 133573.71072838426,
+ 133599.20128644365,
+ 133624.69306045261,
+ 133650.1860502951,
+ 133675.68025585517,
+ 133701.1756770169,
+ 133726.67231366437,
+ 133752.17016568172,
+ 133777.66923295305,
+ 133803.16951536259,
+ 133828.67101279454,
+ 133854.17372513309,
+ 133879.67765226253,
+ 133905.18279406714,
+ 133930.68915043125,
+ 133956.19672123916,
+ 133981.70550637526,
+ 134007.21550572399,
+ 134032.7267191697,
+ 134058.23914659687,
+ 134083.75278789,
+ 134109.26764293358,
+ 134134.78371161217,
+ 134160.30099381026,
+ 134185.8194894125,
+ 134211.33919830353,
+ 134236.8601203679,
+ 134262.38225549037,
+ 134287.90560355558,
+ 134313.43016444831,
+ 134338.95593805326,
+ 134364.48292425525,
+ 134390.01112293909,
+ 134415.54053398955,
+ 134441.07115729159,
+ 134466.60299273001,
+ 134492.1360401898,
+ 134517.67029955584,
+ 134543.20577071316,
+ 134568.74245354676,
+ 134594.28034794159,
+ 134619.81945378278,
+ 134645.35977095537,
+ 134670.90129934452,
+ 134696.4440388353,
+ 134721.98798931291,
+ 134747.53315066252,
+ 134773.07952276937,
+ 134798.62710551871,
+ 134824.17589879577,
+ 134849.72590248589,
+ 134875.27711647438,
+ 134900.82954064661,
+ 134926.38317488792,
+ 134951.93801908373,
+ 134977.49407311951,
+ 135003.05133688069,
+ 135028.60981025276,
+ 135054.16949312127,
+ 135079.73038537172,
+ 135105.29248688967,
+ 135130.85579756077,
+ 135156.42031727062,
+ 135181.98604590484,
+ 135207.55298334916,
+ 135233.12112948924,
+ 135258.69048421088,
+ 135284.26104739975,
+ 135309.83281894168,
+ 135335.4057987225,
+ 135360.97998662802,
+ 135386.55538254412,
+ 135412.13198635669,
+ 135437.70979795168,
+ 135463.28881721498,
+ 135488.86904403262,
+ 135514.45047829056,
+ 135540.03311987486,
+ 135565.61696867159,
+ 135591.20202456677,
+ 135616.78828744654,
+ 135642.37575719706,
+ 135667.96443370447,
+ 135693.55431685498,
+ 135719.14540653475,
+ 135744.73770263011,
+ 135770.33120502727,
+ 135795.92591361253,
+ 135821.52182827223,
+ 135847.11894889272,
+ 135872.7172753604,
+ 135898.31680756161,
+ 135923.91754538284,
+ 135949.51948871053,
+ 135975.12263743114,
+ 136000.72699143123,
+ 136026.33255059729,
+ 136051.93931481591,
+ 136077.54728397369,
+ 136103.15645795723,
+ 136128.76683665317,
+ 136154.37841994822,
+ 136179.99120772901,
+ 136205.60519988232,
+ 136231.2203962949,
+ 136256.83679685349,
+ 136282.45440144493,
+ 136308.07320995603,
+ 136333.69322227367,
+ 136359.31443828469,
+ 136384.93685787608,
+ 136410.56048093468,
+ 136436.18530734754,
+ 136461.81133700156,
+ 136487.43856978384,
+ 136513.06700558143,
+ 136538.6966442813,
+ 136564.32748577066,
+ 136589.95952993655,
+ 136615.59277666616,
+ 136641.22722584667,
+ 136666.86287736523,
+ 136692.49973110916,
+ 136718.13778696564,
+ 136743.77704482197,
+ 136769.41750456547,
+ 136795.05916608346,
+ 136820.70202926331,
+ 136846.34609399244,
+ 136871.99136015819,
+ 136897.63782764805,
+ 136923.28549634948,
+ 136948.93436614997,
+ 136974.58443693706,
+ 137000.23570859825,
+ 137025.88818102115,
+ 137051.54185409332,
+ 137077.19672770242,
+ 137102.85280173609,
+ 137128.51007608202,
+ 137154.16855062786,
+ 137179.82822526142,
+ 137205.48909987041,
+ 137231.15117434258,
+ 137256.8144485658,
+ 137282.47892242789,
+ 137308.14459581667,
+ 137333.81146862009,
+ 137359.47954072602,
+ 137385.14881202241,
+ 137410.81928239719,
+ 137436.49095173844,
+ 137462.16381993407,
+ 137487.83788687221,
+ 137513.51315244089,
+ 137539.18961652822,
+ 137564.86727902229,
+ 137590.54613981131,
+ 137616.22619878338,
+ 137641.90745582676,
+ 137667.58991082967,
+ 137693.27356368033,
+ 137718.95841426702,
+ 137744.64446247809,
+ 137770.33170820182,
+ 137796.02015132661,
+ 137821.70979174081,
+ 137847.40062933284,
+ 137873.09266399115,
+ 137898.78589560417,
+ 137924.48032406042,
+ 137950.17594924837,
+ 137975.8727710566,
+ 138001.57078937365,
+ 138027.27000408815,
+ 138052.97041508864,
+ 138078.67202226384,
+ 138104.3748255024,
+ 138130.07882469296,
+ 138155.78401972432,
+ 138181.49041048516,
+ 138207.1979968643,
+ 138232.9067787505,
+ 138258.61675603263,
+ 138284.32792859949,
+ 138310.04029633995,
+ 138335.75385914298,
+ 138361.46861689744,
+ 138387.18456949232,
+ 138412.90171681659,
+ 138438.62005875923,
+ 138464.33959520931,
+ 138490.06032605586,
+ 138515.78225118798,
+ 138541.50537049473,
+ 138567.2296838653,
+ 138592.95519118884,
+ 138618.68189235451,
+ 138644.40978725153,
+ 138670.13887576913,
+ 138695.86915779658,
+ 138721.60063322316,
+ 138747.33330193823,
+ 138773.06716383106,
+ 138798.80221879104,
+ 138824.53846670757,
+ 138850.27590747006,
+ 138876.01454096794,
+ 138901.7543670907,
+ 138927.49538572782,
+ 138953.2375967688,
+ 138978.9810001032,
+ 139004.72559562061,
+ 139030.47138321059,
+ 139056.2183627628,
+ 139081.96653416683,
+ 139107.71589731239,
+ 139133.46645208917,
+ 139159.21819838689,
+ 139184.97113609532,
+ 139210.72526510421,
+ 139236.48058530336,
+ 139262.23709658257,
+ 139287.99479883176,
+ 139313.75369194071,
+ 139339.51377579942,
+ 139365.27505029776,
+ 139391.03751532568,
+ 139416.80117077316,
+ 139442.56601653024,
+ 139468.33205248689,
+ 139494.09927853322,
+ 139519.86769455927,
+ 139545.63730045516,
+ 139571.408096111,
+ 139597.18008141697,
+ 139622.95325626322,
+ 139648.72762054001,
+ 139674.5031741375,
+ 139700.27991694602,
+ 139726.05784885579,
+ 139751.83696975713,
+ 139777.61727954043,
+ 139803.39877809596,
+ 139829.18146531415,
+ 139854.96534108539,
+ 139880.75040530015,
+ 139906.53665784886,
+ 139932.32409862199,
+ 139958.11272751007,
+ 139983.90254440365,
+ 140009.69354919327,
+ 140035.48574176949,
+ 140061.27912202294,
+ 140087.07368984428,
+ 140112.86944512415,
+ 140138.66638775321,
+ 140164.4645176222,
+ 140190.26383462184,
+ 140216.06433864293,
+ 140241.86602957622,
+ 140267.66890731253,
+ 140293.47297174268,
+ 140319.27822275754,
+ 140345.08466024802,
+ 140370.89228410498,
+ 140396.70109421943,
+ 140422.51109048226,
+ 140448.32227278448,
+ 140474.13464101712,
+ 140499.94819507122,
+ 140525.76293483781,
+ 140551.57886020801,
+ 140577.3959710729,
+ 140603.21426732364,
+ 140629.03374885136,
+ 140654.85441554731,
+ 140680.67626730262,
+ 140706.49930400858,
+ 140732.32352555645,
+ 140758.1489318375,
+ 140783.97552274304,
+ 140809.80329816442,
+ 140835.63225799298,
+ 140861.46240212015,
+ 140887.29373043729,
+ 140913.12624283586,
+ 140938.95993920733,
+ 140964.79481944317,
+ 140990.63088343487,
+ 141016.46813107401,
+ 141042.30656225214,
+ 141068.14617686081,
+ 141093.98697479168,
+ 141119.82895593636,
+ 141145.6721201865,
+ 141171.51646743377,
+ 141197.36199756994,
+ 141223.20871048668,
+ 141249.05660607578,
+ 141274.90568422904,
+ 141300.75594483822,
+ 141326.6073877952,
+ 141352.4600129918,
+ 141378.31382031992,
+ 141404.16880967148,
+ 141430.02498093838,
+ 141455.8823340126,
+ 141481.74086878612,
+ 141507.60058515094,
+ 141533.46148299909,
+ 141559.32356222265,
+ 141585.18682271364,
+ 141611.05126436421,
+ 141636.9168870665,
+ 141662.78369071262,
+ 141688.65167519479,
+ 141714.5208404052,
+ 141740.39118623605,
+ 141766.26271257963,
+ 141792.1354193282,
+ 141818.00930637406,
+ 141843.88437360956,
+ 141869.760620927,
+ 141895.6380482188,
+ 141921.51665537735,
+ 141947.39644229505,
+ 141973.27740886438,
+ 141999.15955497778,
+ 142025.04288052776,
+ 142050.92738540689,
+ 142076.81306950765,
+ 142102.69993272264,
+ 142128.58797494444,
+ 142154.47719606571,
+ 142180.36759597904,
+ 142206.25917457714,
+ 142232.15193175265,
+ 142258.04586739838,
+ 142283.94098140698,
+ 142309.83727367126,
+ 142335.73474408401,
+ 142361.63339253806,
+ 142387.5332189262,
+ 142413.43422314132,
+ 142439.33640507635,
+ 142465.23976462413,
+ 142491.14430167765,
+ 142517.05001612983,
+ 142542.95690787368,
+ 142568.86497680223,
+ 142594.77422280848,
+ 142620.68464578551,
+ 142646.5962456264,
+ 142672.50902222423,
+ 142698.42297547215,
+ 142724.33810526333,
+ 142750.25441149093,
+ 142776.17189404817,
+ 142802.09055282827,
+ 142828.01038772447,
+ 142853.93139863008,
+ 142879.85358543837,
+ 142905.77694804268,
+ 142931.70148633636,
+ 142957.62720021277,
+ 142983.55408956532,
+ 143009.48215428743,
+ 143035.41139427255,
+ 143061.34180941415,
+ 143087.27339960571,
+ 143113.20616474075,
+ 143139.14010471283,
+ 143165.07521941551,
+ 143191.01150874238,
+ 143216.94897258704,
+ 143242.88761084314,
+ 143268.82742340435,
+ 143294.76841016437,
+ 143320.71057101688,
+ 143346.65390585564,
+ 143372.59841457437,
+ 143398.54409706692,
+ 143424.49095322701,
+ 143450.43898294857,
+ 143476.38818612538,
+ 143502.33856265133,
+ 143528.29011242036,
+ 143554.24283532638,
+ 143580.19673126334,
+ 143606.1518001252,
+ 143632.10804180597,
+ 143658.06545619969,
+ 143684.02404320039,
+ 143709.98380270213,
+ 143735.944734599,
+ 143761.90683878519,
+ 143787.87011515474,
+ 143813.83456360188,
+ 143839.8001840208,
+ 143865.76697630569,
+ 143891.73494035081,
+ 143917.7040760504,
+ 143943.67438329876,
+ 143969.6458619902,
+ 143995.61851201905,
+ 144021.59233327967,
+ 144047.56732566646,
+ 144073.54348907378,
+ 144099.52082339607,
+ 144125.49932852783,
+ 144151.4790043635,
+ 144177.45985079758,
+ 144203.44186772458,
+ 144229.42505503909,
+ 144255.40941263564,
+ 144281.39494040885,
+ 144307.38163825331,
+ 144333.36950606373,
+ 144359.35854373468,
+ 144385.34875116093,
+ 144411.34012823718,
+ 144437.33267485813,
+ 144463.32639091855,
+ 144489.32127631325,
+ 144515.31733093705,
+ 144541.31455468474,
+ 144567.3129474512,
+ 144593.3125091313,
+ 144619.31323961995,
+ 144645.31513881206,
+ 144671.31820660262,
+ 144697.32244288657,
+ 144723.32784755889,
+ 144749.33442051467,
+ 144775.34216164888,
+ 144801.35107085665,
+ 144827.36114803303,
+ 144853.37239307314,
+ 144879.38480587213,
+ 144905.39838632516,
+ 144931.41313432742,
+ 144957.4290497741,
+ 144983.44613256046,
+ 145009.46438258173,
+ 145035.48379973322,
+ 145061.50438391021,
+ 145087.52613500805,
+ 145113.54905292206,
+ 145139.57313754765,
+ 145165.59838878017,
+ 145191.62480651509,
+ 145217.65239064783,
+ 145243.68114107384,
+ 145269.71105768863,
+ 145295.74214038774,
+ 145321.77438906668,
+ 145347.80780362099,
+ 145373.84238394629,
+ 145399.87812993818,
+ 145425.91504149229,
+ 145451.95311850426,
+ 145477.9923608698,
+ 145504.03276848458,
+ 145530.07434124436,
+ 145556.11707904484,
+ 145582.16098178181,
+ 145608.20604935108,
+ 145634.25228164849,
+ 145660.29967856981,
+ 145686.34824001096,
+ 145712.39796586783,
+ 145738.4488560363,
+ 145764.50091041232,
+ 145790.55412889185,
+ 145816.60851137087,
+ 145842.66405774537,
+ 145868.72076791141,
+ 145894.77864176501,
+ 145920.83767920226,
+ 145946.89788011924,
+ 145972.95924441208,
+ 145999.02177197693,
+ 146025.08546270995,
+ 146051.15031650732,
+ 146077.21633326527,
+ 146103.28351288004,
+ 146129.35185524789,
+ 146155.42136026506,
+ 146181.49202782792,
+ 146207.56385783272,
+ 146233.63685017588,
+ 146259.71100475377,
+ 146285.78632146274,
+ 146311.86280019928,
+ 146337.94044085976,
+ 146364.01924334071,
+ 146390.09920753856,
+ 146416.18033334985,
+ 146442.26262067116,
+ 146468.34606939898,
+ 146494.43067942993,
+ 146520.51645066062,
+ 146546.60338298764,
+ 146572.69147630769,
+ 146598.78073051744,
+ 146624.87114551352,
+ 146650.96272119274,
+ 146677.05545745179,
+ 146703.14935418745,
+ 146729.2444112965,
+ 146755.34062867577,
+ 146781.43800622207,
+ 146807.53654383228,
+ 146833.63624140329,
+ 146859.73709883197,
+ 146885.83911601527,
+ 146911.94229285014,
+ 146938.04662923355,
+ 146964.15212506248,
+ 146990.25878023397,
+ 147016.36659464505,
+ 147042.47556819281,
+ 147068.58570077427,
+ 147094.6969922866,
+ 147120.80944262692,
+ 147146.92305169237,
+ 147173.03781938017,
+ 147199.15374558745,
+ 147225.27083021149,
+ 147251.38907314953,
+ 147277.50847429881,
+ 147303.62903355664,
+ 147329.75075082036,
+ 147355.87362598727,
+ 147381.99765895473,
+ 147408.12284962015,
+ 147434.24919788091,
+ 147460.37670363448,
+ 147486.50536677826,
+ 147512.63518720976,
+ 147538.76616482646,
+ 147564.89829952587,
+ 147591.03159120557,
+ 147617.16603976308,
+ 147643.30164509601,
+ 147669.43840710199,
+ 147695.57632567859,
+ 147721.71540072354,
+ 147747.85563213445,
+ 147773.99701980909,
+ 147800.13956364512,
+ 147826.28326354033,
+ 147852.42811939248,
+ 147878.57413109933,
+ 147904.72129855872,
+ 147930.86962166851,
+ 147957.01910032652,
+ 147983.16973443062,
+ 148009.32152387875,
+ 148035.47446856883,
+ 148061.62856839882,
+ 148087.78382326665,
+ 148113.94023307035,
+ 148140.09779770792,
+ 148166.25651707739,
+ 148192.41639107687,
+ 148218.57741960438,
+ 148244.73960255808,
+ 148270.90293983606,
+ 148297.0674313365,
+ 148323.23307695755,
+ 148349.39987659742,
+ 148375.56783015432,
+ 148401.73693752653,
+ 148427.90719861226,
+ 148454.07861330983,
+ 148480.25118151752,
+ 148506.42490313368,
+ 148532.59977805667,
+ 148558.77580618486,
+ 148584.95298741665,
+ 148611.13132165043,
+ 148637.31080878471,
+ 148663.49144871789,
+ 148689.6732413485,
+ 148715.85618657502,
+ 148742.040284296,
+ 148768.22553440998,
+ 148794.41193681557,
+ 148820.59949141133,
+ 148846.78819809589,
+ 148872.97805676793,
+ 148899.16906732606,
+ 148925.36122966901,
+ 148951.55454369547,
+ 148977.74900930419,
+ 149003.9446263939,
+ 149030.1413948634,
+ 149056.33931461151,
+ 149082.53838553699,
+ 149108.73860753875,
+ 149134.9399805156,
+ 149161.14250436646,
+ 149187.34617899026,
+ 149213.5510042859,
+ 149239.75698015234,
+ 149265.96410648854,
+ 149292.17238319354,
+ 149318.38181016635,
+ 149344.59238730598,
+ 149370.80411451156,
+ 149397.01699168212,
+ 149423.23101871679,
+ 149449.44619551473,
+ 149475.66252197503,
+ 149501.87999799693,
+ 149528.0986234796,
+ 149554.31839832227,
+ 149580.53932242419,
+ 149606.76139568459,
+ 149632.98461800278,
+ 149659.20898927809,
+ 149685.43450940982,
+ 149711.66117829733,
+ 149737.88899584001,
+ 149764.11796193724,
+ 149790.34807648844,
+ 149816.57933939309,
+ 149842.81175055061,
+ 149869.04530986046,
+ 149895.28001722222,
+ 149921.51587253538,
+ 149947.75287569952,
+ 149973.99102661415,
+ 150000.23032517891,
+ 150026.47077129342,
+ 150052.71236485732,
+ 150078.95510577026,
+ 150105.1989939319,
+ 150131.444029242,
+ 150157.69021160025,
+ 150183.93754090639,
+ 150210.18601706024,
+ 150236.43563996154,
+ 150262.68640951012,
+ 150288.93832560582,
+ 150315.19138814852,
+ 150341.44559703805,
+ 150367.70095217437,
+ 150393.95745345735,
+ 150420.21510078697,
+ 150446.47389406321,
+ 150472.73383318601,
+ 150498.99491805542,
+ 150525.25714857146,
+ 150551.52052463419,
+ 150577.78504614369,
+ 150604.05071300003,
+ 150630.31752510337,
+ 150656.58548235384,
+ 150682.85458465159,
+ 150709.1248318968,
+ 150735.39622398972,
+ 150761.66876083051,
+ 150787.9424423195,
+ 150814.21726835691,
+ 150840.49323884305,
+ 150866.77035367821,
+ 150893.04861276277,
+ 150919.32801599705,
+ 150945.60856328148,
+ 150971.89025451642,
+ 150998.17308960229,
+ 151024.45706843957,
+ 151050.74219092872,
+ 151077.02845697021,
+ 151103.31586646455,
+ 151129.60441931229,
+ 151155.894115414,
+ 151182.1849546702,
+ 151208.47693698155,
+ 151234.77006224863,
+ 151261.06433037209,
+ 151287.35974125259,
+ 151313.65629479082,
+ 151339.95399088747,
+ 151366.25282944329,
+ 151392.55281035902,
+ 151418.85393353543,
+ 151445.1561988733,
+ 151471.45960627345,
+ 151497.76415563675,
+ 151524.06984686397,
+ 151550.37667985607,
+ 151576.68465451393,
+ 151602.99377073845,
+ 151629.30402843058,
+ 151655.61542749128,
+ 151681.92796782157,
+ 151708.24164932242,
+ 151734.55647189484,
+ 151760.87243543993,
+ 151787.18953985872,
+ 151813.50778505235,
+ 151839.82717092187,
+ 151866.14769736846,
+ 151892.46936429327,
+ 151918.79217159748,
+ 151945.11611918229,
+ 151971.44120694889,
+ 151997.76743479856,
+ 152024.09480263255,
+ 152050.42331035214,
+ 152076.75295785864,
+ 152103.08374505339,
+ 152129.41567183775,
+ 152155.74873811303,
+ 152182.08294378067,
+ 152208.41828874208,
+ 152234.75477289871,
+ 152261.09239615197,
+ 152287.43115840337,
+ 152313.77105955439,
+ 152340.11209950657,
+ 152366.45427816146,
+ 152392.79759542056,
+ 152419.14205118554,
+ 152445.48764535793,
+ 152471.8343778394,
+ 152498.18224853161,
+ 152524.53125733617,
+ 152550.88140415482,
+ 152577.23268888926,
+ 152603.58511144121,
+ 152629.93867171241,
+ 152656.29336960468,
+ 152682.64920501978,
+ 152709.00617785956,
+ 152735.36428802583,
+ 152761.72353542043,
+ 152788.08391994529,
+ 152814.44544150229,
+ 152840.80809999333,
+ 152867.17189532038,
+ 152893.53682738543,
+ 152919.90289609041,
+ 152946.27010133737,
+ 152972.63844302832,
+ 152999.00792106529,
+ 153025.37853535041,
+ 153051.7502857857,
+ 153078.12317227334,
+ 153104.4971947154,
+ 153130.8723530141,
+ 153157.24864707157,
+ 153183.62607679001,
+ 153210.00464207167,
+ 153236.38434281875,
+ 153262.76517893354,
+ 153289.14715031831,
+ 153315.53025687535,
+ 153341.91449850702,
+ 153368.2998751156,
+ 153394.68638660354,
+ 153421.07403287315,
+ 153447.46281382689,
+ 153473.85272936718,
+ 153500.24377939643,
+ 153526.63596381716,
+ 153553.02928253182,
+ 153579.42373544298,
+ 153605.81932245308,
+ 153632.21604346478,
+ 153658.61389838057,
+ 153685.0128871031,
+ 153711.41300953497,
+ 153737.81426557881,
+ 153764.21665513728,
+ 153790.62017811305,
+ 153817.02483440886,
+ 153843.43062392739,
+ 153869.83754657139,
+ 153896.24560224367,
+ 153922.65479084692,
+ 153949.06511228404,
+ 153975.4765664578,
+ 154001.88915327107,
+ 154028.30287262669,
+ 154054.71772442761,
+ 154081.13370857667,
+ 154107.55082497682,
+ 154133.96907353101,
+ 154160.38845414223,
+ 154186.80896671346,
+ 154213.23061114774,
+ 154239.65338734805,
+ 154266.07729521746,
+ 154292.50233465908,
+ 154318.92850557598,
+ 154345.35580787127,
+ 154371.7842414481,
+ 154398.21380620965,
+ 154424.64450205903,
+ 154451.07632889951,
+ 154477.50928663427,
+ 154503.94337516659,
+ 154530.37859439969,
+ 154556.81494423689,
+ 154583.25242458144,
+ 154609.69103533673,
+ 154636.13077640603,
+ 154662.57164769279,
+ 154689.01364910032,
+ 154715.45678053208,
+ 154741.90104189145,
+ 154768.34643308193,
+ 154794.79295400696,
+ 154821.24060457002,
+ 154847.68938467462,
+ 154874.13929422433,
+ 154900.59033312264,
+ 154927.04250127316,
+ 154953.49579857948,
+ 154979.95022494521,
+ 155006.40578027396,
+ 155032.86246446942,
+ 155059.32027743524,
+ 155085.77921907514,
+ 155112.2392892928,
+ 155138.70048799197,
+ 155165.16281507642,
+ 155191.62627044989,
+ 155218.09085401625,
+ 155244.55656567923,
+ 155271.02340534274,
+ 155297.49137291059,
+ 155323.96046828668,
+ 155350.4306913749,
+ 155376.90204207919,
+ 155403.37452030348,
+ 155429.84812595171,
+ 155456.32285892789,
+ 155482.79871913602,
+ 155509.27570648011,
+ 155535.75382086422,
+ 155562.23306219239,
+ 155588.71343036872,
+ 155615.19492529731,
+ 155641.67754688227,
+ 155668.16129502779,
+ 155694.64616963797,
+ 155721.13217061706,
+ 155747.61929786921,
+ 155774.10755129869,
+ 155800.59693080973,
+ 155827.08743630661,
+ 155853.57906769359,
+ 155880.07182487496,
+ 155906.56570775513,
+ 155933.06071623837,
+ 155959.55685022907,
+ 155986.05410963166,
+ 156012.5524943505,
+ 156039.05200429002,
+ 156065.55263935472,
+ 156092.054399449,
+ 156118.5572844774,
+ 156145.06129434443,
+ 156171.5664289546,
+ 156198.07268821247,
+ 156224.5800720226,
+ 156251.08858028959,
+ 156277.59821291809,
+ 156304.10896981266,
+ 156330.62085087801,
+ 156357.1338560188,
+ 156383.64798513969,
+ 156410.16323814544,
+ 156436.67961494075,
+ 156463.1971154304,
+ 156489.71573951913,
+ 156516.23548711176,
+ 156542.75635811311,
+ 156569.27835242799,
+ 156595.80146996127,
+ 156622.32571061782,
+ 156648.85107430254,
+ 156675.37756092031,
+ 156701.90517037612,
+ 156728.43390257491,
+ 156754.96375742162,
+ 156781.49473482129,
+ 156808.02683467892,
+ 156834.5600568995,
+ 156861.09440138817,
+ 156887.62986804993,
+ 156914.16645678994,
+ 156940.70416751326,
+ 156967.24300012505,
+ 156993.78295453047,
+ 157020.32403063469,
+ 157046.8662283429,
+ 157073.40954756032,
+ 157099.9539881922,
+ 157126.49955014378,
+ 157153.04623332032,
+ 157179.59403762716,
+ 157206.14296296958,
+ 157232.69300925292,
+ 157259.24417638258,
+ 157285.79646426387,
+ 157312.34987280221,
+ 157338.90440190304,
+ 157365.46005147175,
+ 157392.01682141385,
+ 157418.57471163478,
+ 157445.13372204005,
+ 157471.69385253513,
+ 157498.25510302564,
+ 157524.81747341706,
+ 157551.38096361503,
+ 157577.9455735251,
+ 157604.51130305286,
+ 157631.07815210402,
+ 157657.64612058419,
+ 157684.21520839902,
+ 157710.78541545427,
+ 157737.35674165559,
+ 157763.92918690876,
+ 157790.50275111952,
+ 157817.07743419363,
+ 157843.65323603692,
+ 157870.23015655516,
+ 157896.80819565422,
+ 157923.3873532399,
+ 157949.96762921812,
+ 157976.54902349479,
+ 158003.13153597576,
+ 158029.71516656701,
+ 158056.29991517449,
+ 158082.88578170416,
+ 158109.47276606198,
+ 158136.06086815402,
+ 158162.65008788629,
+ 158189.24042516484,
+ 158215.83187989573,
+ 158242.42445198505,
+ 158269.01814133892,
+ 158295.61294786347,
+ 158322.20887146486,
+ 158348.80591204923,
+ 158375.4040695228,
+ 158402.00334379176,
+ 158428.60373476235,
+ 158455.2052423408,
+ 158481.80786643337,
+ 158508.41160694641,
+ 158535.01646378616,
+ 158561.62243685898,
+ 158588.2295260712,
+ 158614.8377313292,
+ 158641.44705253936,
+ 158668.05748960807,
+ 158694.66904244179,
+ 158721.28171094693,
+ 158747.89549502998,
+ 158774.5103945974,
+ 158801.12640955573,
+ 158827.74353981143,
+ 158854.36178527112,
+ 158880.9811458413,
+ 158907.60162142856,
+ 158934.22321193956,
+ 158960.84591728085,
+ 158987.46973735912,
+ 159014.09467208097,
+ 159040.72072135314,
+ 159067.3478850823,
+ 159093.97616317519,
+ 159120.60555553852,
+ 159147.23606207906,
+ 159173.8676827036,
+ 159200.50041731889,
+ 159227.13426583182,
+ 159253.76922814918,
+ 159280.40530417781,
+ 159307.04249382461,
+ 159333.68079699649,
+ 159360.32021360032,
+ 159386.96074354305,
+ 159413.60238673165,
+ 159440.24514307309,
+ 159466.88901247433,
+ 159493.53399484244,
+ 159520.18009008438,
+ 159546.82729810724,
+ 159573.47561881805,
+ 159600.12505212394,
+ 159626.77559793202,
+ 159653.42725614941,
+ 159680.08002668325,
+ 159706.73390944069,
+ 159733.38890432892,
+ 159760.04501125516,
+ 159786.70223012666,
+ 159813.36056085059,
+ 159840.02000333427,
+ 159866.68055748497,
+ 159893.34222320997,
+ 159920.00500041663,
+ 159946.66888901225,
+ 159973.33388890422,
+ 159999.99999999988,
+ 160026.66722220668,
+ 160053.33555543202,
+ 160080.0049995833,
+ 160106.67555456801,
+ 160133.3472202936,
+ 160160.0199966676,
+ 160186.6938835975,
+ 160213.36888099083,
+ 160240.04498875517,
+ 160266.72220679806,
+ 160293.40053502709,
+ 160320.07997334987,
+ 160346.76052167406,
+ 160373.44217990729,
+ 160400.1249479572,
+ 160426.80882573154,
+ 160453.49381313793,
+ 160480.17991008417,
+ 160506.86711647795,
+ 160533.55543222709,
+ 160560.24485723933,
+ 160586.93539142248,
+ 160613.62703468435,
+ 160640.31978693281,
+ 160667.01364807569,
+ 160693.70861802087,
+ 160720.40469667627,
+ 160747.1018839498,
+ 160773.80017974938,
+ 160800.49958398298,
+ 160827.20009655855,
+ 160853.90171738411,
+ 160880.60444636765,
+ 160907.30828341722,
+ 160934.01322844089,
+ 160960.71928134665,
+ 160987.42644204266,
+ 161014.13471043704,
+ 161040.84408643784,
+ 161067.55456995327,
+ 161094.26616089148,
+ 161120.97885916062,
+ 161147.69266466892,
+ 161174.40757732463,
+ 161201.12359703594,
+ 161227.84072371112,
+ 161254.55895725847,
+ 161281.27829758628,
+ 161307.99874460287,
+ 161334.72029821656,
+ 161361.44295833571,
+ 161388.1667248687,
+ 161414.89159772391,
+ 161441.61757680977,
+ 161468.34466203468,
+ 161495.07285330712,
+ 161521.80215053557,
+ 161548.53255362847,
+ 161575.26406249436,
+ 161601.99667704175,
+ 161628.7303971792,
+ 161655.46522281526,
+ 161682.20115385848,
+ 161708.93819021754,
+ 161735.67633180099,
+ 161762.41557851751,
+ 161789.15593027571,
+ 161815.89738698432,
+ 161842.63994855201,
+ 161869.38361488748,
+ 161896.1283858995,
+ 161922.87426149679,
+ 161949.62124158812,
+ 161976.36932608229,
+ 162003.1185148881,
+ 162029.8688079144,
+ 162056.62020507001,
+ 162083.37270626382,
+ 162110.12631140469,
+ 162136.88102040152,
+ 162163.63683316324,
+ 162190.39374959879,
+ 162217.15176961714,
+ 162243.91089312723,
+ 162270.67112003808,
+ 162297.43245025873,
+ 162324.19488369819,
+ 162350.9584202655,
+ 162377.72305986975,
+ 162404.48880242003,
+ 162431.25564782543,
+ 162458.02359599507,
+ 162484.79264683815,
+ 162511.56280026378,
+ 162538.33405618116,
+ 162565.10641449949,
+ 162591.87987512801,
+ 162618.65443797593,
+ 162645.43010295252,
+ 162672.20686996708,
+ 162698.98473892888,
+ 162725.76370974723,
+ 162752.54378233149,
+ 162779.32495659095,
+ 162806.10723243505,
+ 162832.89060977317,
+ 162859.67508851466,
+ 162886.46066856899,
+ 162913.24734984562,
+ 162940.03513225398,
+ 162966.82401570358,
+ 162993.6140001039,
+ 163020.40508536444,
+ 163047.19727139481,
+ 163073.99055810447,
+ 163100.78494540305,
+ 163127.58043320014,
+ 163154.37702140535,
+ 163181.17470992831,
+ 163207.97349867865,
+ 163234.77338756606,
+ 163261.57437650024,
+ 163288.37646539087,
+ 163315.17965414765,
+ 163341.98394268038,
+ 163368.78933089875,
+ 163395.59581871261,
+ 163422.40340603172,
+ 163449.2120927659,
+ 163476.02187882498,
+ 163502.83276411882,
+ 163529.6447485573,
+ 163556.45783205028,
+ 163583.2720145077,
+ 163610.08729583945,
+ 163636.90367595552,
+ 163663.72115476584,
+ 163690.53973218042,
+ 163717.35940810922,
+ 163744.18018246227,
+ 163771.00205514964,
+ 163797.82502608138,
+ 163824.64909516752,
+ 163851.4742623182,
+ 163878.3005274435,
+ 163905.12789045356,
+ 163931.95635125853,
+ 163958.78590976857,
+ 163985.61656589387,
+ 164012.44831954464,
+ 164039.28117063109,
+ 164066.11511906344,
+ 164092.95016475199,
+ 164119.78630760699,
+ 164146.62354753874,
+ 164173.46188445756,
+ 164200.30131827376,
+ 164227.14184889771,
+ 164253.98347623978,
+ 164280.82620021031,
+ 164307.67002071979,
+ 164334.51493767856,
+ 164361.3609509971,
+ 164388.20806058586,
+ 164415.05626635533,
+ 164441.905568216,
+ 164468.75596607837,
+ 164495.607459853,
+ 164522.4600494504,
+ 164549.31373478117,
+ 164576.16851575591,
+ 164603.02439228518,
+ 164629.88136427966,
+ 164656.73943164994,
+ 164683.59859430668,
+ 164710.45885216061,
+ 164737.32020512238,
+ 164764.1826531027,
+ 164791.04619601235,
+ 164817.91083376206,
+ 164844.77656626256,
+ 164871.64339342469,
+ 164898.51131515924,
+ 164925.38033137703,
+ 164952.25044198887,
+ 164979.1216469057,
+ 165005.9939460383,
+ 165032.86733929763,
+ 165059.7418265946,
+ 165086.61740784015,
+ 165113.4940829452
+};
+
+#else
+
+#ifdef BIG_IQ_TABLE
+#define IQ_TABLE_SIZE 8192
+#else
+#define IQ_TABLE_SIZE 1026
+#endif
+
+ALIGN static const real_t iq_table[IQ_TABLE_SIZE] =
+{
+ REAL_CONST(0.0),
+ REAL_CONST(1.0/8.0),
+ REAL_CONST(2.5198420997897464/8.0),
+ REAL_CONST(4.3267487109222245/8.0),
+ REAL_CONST(6.3496042078727974/8.0),
+ REAL_CONST(8.5498797333834844/8.0),
+ REAL_CONST(10.902723556992836/8.0),
+ REAL_CONST(13.390518279406722/8.0),
+ REAL_CONST(15.999999999999998/8.0),
+ REAL_CONST(18.720754407467133/8.0),
+ REAL_CONST(21.544346900318832/8.0),
+ REAL_CONST(24.463780996262464/8.0),
+ REAL_CONST(27.47314182127996/8.0),
+ REAL_CONST(30.567350940369842/8.0),
+ REAL_CONST(33.741991698453212/8.0),
+ REAL_CONST(36.993181114957046/8.0),
+ REAL_CONST(40.317473596635935/8.0),
+ REAL_CONST(43.711787041189993/8.0),
+ REAL_CONST(47.173345095760126/8.0),
+ REAL_CONST(50.699631325716943/8.0),
+ REAL_CONST(54.288352331898118/8.0),
+ REAL_CONST(57.937407704003519/8.0),
+ REAL_CONST(61.6448652744185/8.0),
+ REAL_CONST(65.408940536585988/8.0),
+ REAL_CONST(69.227979374755591/8.0),
+ REAL_CONST(73.100443455321638/8.0),
+ REAL_CONST(77.024897778591622/8.0),
+ REAL_CONST(80.999999999999986/8.0),
+ REAL_CONST(85.024491212518527/8.0),
+ REAL_CONST(89.097187944889555/8.0),
+ REAL_CONST(93.216975178615741/8.0),
+ REAL_CONST(97.382800224133163/8.0),
+ REAL_CONST(101.59366732596474/8.0),
+ REAL_CONST(105.84863288986224/8.0),
+ REAL_CONST(110.14680124343441/8.0),
+ REAL_CONST(114.4873208566006/8.0),
+ REAL_CONST(118.86938096020653/8.0),
+ REAL_CONST(123.29220851090024/8.0),
+ REAL_CONST(127.75506545836058/8.0),
+ REAL_CONST(132.25724627755247/8.0),
+ REAL_CONST(136.79807573413572/8.0),
+ REAL_CONST(141.37690685569191/8.0),
+ REAL_CONST(145.99311908523086/8.0),
+ REAL_CONST(150.6461165966291/8.0),
+ REAL_CONST(155.33532675434674/8.0),
+ REAL_CONST(160.06019870205279/8.0),
+ REAL_CONST(164.82020206673349/8.0),
+ REAL_CONST(169.61482576651861/8.0),
+ REAL_CONST(174.44357691188537/8.0),
+ REAL_CONST(179.30597979112557/8.0),
+ REAL_CONST(184.20157493201927/8.0),
+ REAL_CONST(189.12991823257562/8.0),
+ REAL_CONST(194.09058015449685/8.0),
+ REAL_CONST(199.08314497371677/8.0),
+ REAL_CONST(204.1072100829694/8.0),
+ REAL_CONST(209.16238534187647/8.0),
+ REAL_CONST(214.24829247050752/8.0),
+ REAL_CONST(219.36456448277784/8.0),
+ REAL_CONST(224.51084515641216/8.0),
+ REAL_CONST(229.6867885365223/8.0),
+ REAL_CONST(234.89205847013176/8.0),
+ REAL_CONST(240.12632816923249/8.0),
+ REAL_CONST(245.38927980018505/8.0),
+ REAL_CONST(250.68060409747261/8.0),
+ REAL_CONST(255.99999999999991/8.0),
+ REAL_CONST(261.34717430828869/8.0),
+ REAL_CONST(266.72184136106449/8.0),
+ REAL_CONST(272.12372272986045/8.0),
+ REAL_CONST(277.55254693037961/8.0),
+ REAL_CONST(283.0080491494619/8.0),
+ REAL_CONST(288.48997098659891/8.0),
+ REAL_CONST(293.99806020902247/8.0),
+ REAL_CONST(299.53207051947408/8.0),
+ REAL_CONST(305.0917613358298/8.0),
+ REAL_CONST(310.67689758182206/8.0),
+ REAL_CONST(316.28724948815585/8.0),
+ REAL_CONST(321.92259240337177/8.0),
+ REAL_CONST(327.58270661385535/8.0),
+ REAL_CONST(333.26737717243742/8.0),
+ REAL_CONST(338.97639373507025/8.0),
+ REAL_CONST(344.70955040510125/8.0),
+ REAL_CONST(350.46664558470013/8.0),
+ REAL_CONST(356.24748183302603/8.0),
+ REAL_CONST(362.05186573075139/8.0),
+ REAL_CONST(367.87960775058258/8.0),
+ REAL_CONST(373.73052213344511/8.0),
+ REAL_CONST(379.60442677002078/8.0),
+ REAL_CONST(385.50114308734607/8.0),
+ REAL_CONST(391.42049594019937/8.0),
+ REAL_CONST(397.36231350702371/8.0),
+ REAL_CONST(403.32642719014467/8.0),
+ REAL_CONST(409.31267152006262/8.0),
+ REAL_CONST(415.32088406360799/8.0),
+ REAL_CONST(421.35090533576471/8.0),
+ REAL_CONST(427.40257871497619/8.0),
+ REAL_CONST(433.4757503617617/8.0),
+ REAL_CONST(439.5702691404793/8.0),
+ REAL_CONST(445.68598654408271/8.0),
+ REAL_CONST(451.82275662172759/8.0),
+ REAL_CONST(457.98043590909128/8.0),
+ REAL_CONST(464.15888336127773/8.0),
+ REAL_CONST(470.35796028818726/8.0),
+ REAL_CONST(476.5775302922363/8.0),
+ REAL_CONST(482.81745920832043/8.0),
+ REAL_CONST(489.07761504591741/8.0),
+ REAL_CONST(495.35786793323581/8.0),
+ REAL_CONST(501.65809006331688/8.0),
+ REAL_CONST(507.97815564200368/8.0),
+ REAL_CONST(514.31794083769648/8.0),
+ REAL_CONST(520.67732373281672/8.0),
+ REAL_CONST(527.05618427690604/8.0),
+ REAL_CONST(533.45440424129174/8.0),
+ REAL_CONST(539.87186717525128/8.0),
+ REAL_CONST(546.30845836361505/8.0),
+ REAL_CONST(552.76406478574609/8.0),
+ REAL_CONST(559.23857507584194/8.0),
+ REAL_CONST(565.73187948450413/8.0),
+ REAL_CONST(572.24386984152341/8.0),
+ REAL_CONST(578.77443951983378/8.0),
+ REAL_CONST(585.32348340058843/8.0),
+ REAL_CONST(591.89089783931263/8.0),
+ REAL_CONST(598.47658063309257/8.0),
+ REAL_CONST(605.08043098876044/8.0),
+ REAL_CONST(611.70234949203643/8.0),
+ REAL_CONST(618.3422380775919/8.0),
+ REAL_CONST(624.99999999999977/8.0),
+ REAL_CONST(631.67553980553748/8.0),
+ REAL_CONST(638.36876330481164/8.0),
+ REAL_CONST(645.07957754617485/8.0),
+ REAL_CONST(651.80789078990415/8.0),
+ REAL_CONST(658.55361248311499/8.0),
+ REAL_CONST(665.31665323538357/8.0),
+ REAL_CONST(672.09692479505225/8.0),
+ REAL_CONST(678.8943400261943/8.0),
+ REAL_CONST(685.70881288621433/8.0),
+ REAL_CONST(692.540258404062/8.0),
+ REAL_CONST(699.38859265903977/8.0),
+ REAL_CONST(706.25373276018058/8.0),
+ REAL_CONST(713.13559682617972/8.0),
+ REAL_CONST(720.03410396586037/8.0),
+ REAL_CONST(726.94917425915435/8.0),
+ REAL_CONST(733.88072873858209/8.0),
+ REAL_CONST(740.82868937121543/8.0),
+ REAL_CONST(747.79297904110535/8.0),
+ REAL_CONST(754.77352153216191/8.0),
+ REAL_CONST(761.77024151147043/8.0),
+ REAL_CONST(768.78306451302956/8.0),
+ REAL_CONST(775.81191692189896/8.0),
+ REAL_CONST(782.85672595874246/8.0),
+ REAL_CONST(789.91741966475445/8.0),
+ REAL_CONST(796.99392688695798/8.0),
+ REAL_CONST(804.08617726386274/8.0),
+ REAL_CONST(811.19410121147098/8.0),
+ REAL_CONST(818.31762990962227/8.0),
+ REAL_CONST(825.45669528866563/8.0),
+ REAL_CONST(832.61123001644864/8.0),
+ REAL_CONST(839.78116748561604/8.0),
+ REAL_CONST(846.96644180120552/8.0),
+ REAL_CONST(854.16698776853514/8.0),
+ REAL_CONST(861.38274088137143/8.0),
+ REAL_CONST(868.61363731036977/8.0),
+ REAL_CONST(875.85961389178203/8.0),
+ REAL_CONST(883.12060811641959/8.0),
+ REAL_CONST(890.39655811886757/8.0),
+ REAL_CONST(897.68740266694181/8.0),
+ REAL_CONST(904.99308115138172/8.0),
+ REAL_CONST(912.31353357577188/8.0),
+ REAL_CONST(919.64870054668756/8.0),
+ REAL_CONST(926.99852326405619/8.0),
+ REAL_CONST(934.36294351172899/8.0),
+ REAL_CONST(941.74190364825859/8.0),
+ REAL_CONST(949.13534659787422/8.0),
+ REAL_CONST(956.54321584165211/8.0),
+ REAL_CONST(963.96545540887348/8.0),
+ REAL_CONST(971.40200986856541/8.0),
+ REAL_CONST(978.85282432122176/8.0),
+ REAL_CONST(986.31784439069588/8.0),
+ REAL_CONST(993.7970162162635/8.0),
+ REAL_CONST(1001.29028644485/8.0),
+ REAL_CONST(1008.797602223418/8.0),
+ REAL_CONST(1016.3189111915103/8.0),
+ REAL_CONST(1023.8541614739464/8.0),
+ REAL_CONST(1031.4033016736653/8.0),
+ REAL_CONST(1038.9662808647138/8.0),
+ REAL_CONST(1046.5430485853758/8.0),
+ REAL_CONST(1054.1335548314366/8.0),
+ REAL_CONST(1061.7377500495838/8.0),
+ REAL_CONST(1069.3555851309357/8.0),
+ REAL_CONST(1076.9870114046978/8.0),
+ REAL_CONST(1084.6319806319441/8.0),
+ REAL_CONST(1092.2904449995174/8.0),
+ REAL_CONST(1099.9623571140482/8.0),
+ REAL_CONST(1107.6476699960892/8.0),
+ REAL_CONST(1115.3463370743607/8.0),
+ REAL_CONST(1123.058312180106/8.0),
+ REAL_CONST(1130.7835495415541/8.0),
+ REAL_CONST(1138.5220037784854/8.0),
+ REAL_CONST(1146.273629896901/8.0),
+ REAL_CONST(1154.0383832837879/8.0),
+ REAL_CONST(1161.816219701986/8.0),
+ REAL_CONST(1169.607095285146/8.0),
+ REAL_CONST(1177.4109665327808/8.0),
+ REAL_CONST(1185.2277903054078/8.0),
+ REAL_CONST(1193.0575238197798/8.0),
+ REAL_CONST(1200.9001246442001/8.0),
+ REAL_CONST(1208.7555506939248/8.0),
+ REAL_CONST(1216.6237602266442/8.0),
+ REAL_CONST(1224.5047118380478/8.0),
+ REAL_CONST(1232.3983644574657/8.0),
+ REAL_CONST(1240.3046773435874/8.0),
+ REAL_CONST(1248.2236100802568/8.0),
+ REAL_CONST(1256.1551225723395/8.0),
+ REAL_CONST(1264.099175041662/8.0),
+ REAL_CONST(1272.0557280230228/8.0),
+ REAL_CONST(1280.0247423602691/8.0),
+ REAL_CONST(1288.0061792024444/8.0),
+ REAL_CONST(1295.9999999999995/8.0),
+ REAL_CONST(1304.006166501068/8.0),
+ REAL_CONST(1312.0246407478062/8.0),
+ REAL_CONST(1320.0553850727929/8.0),
+ REAL_CONST(1328.0983620954903/8.0),
+ REAL_CONST(1336.1535347187651/8.0),
+ REAL_CONST(1344.2208661254647/8.0),
+ REAL_CONST(1352.3003197750522/8.0),
+ REAL_CONST(1360.3918594002962/8.0),
+ REAL_CONST(1368.4954490040145/8.0),
+ REAL_CONST(1376.6110528558709/8.0),
+ REAL_CONST(1384.7386354892244/8.0),
+ REAL_CONST(1392.8781616980295/8.0),
+ REAL_CONST(1401.0295965337855/8.0),
+ REAL_CONST(1409.1929053025353/8.0),
+ REAL_CONST(1417.3680535619119/8.0),
+ REAL_CONST(1425.5550071182327/8.0),
+ REAL_CONST(1433.7537320236374/8.0),
+ REAL_CONST(1441.9641945732744/8.0),
+ REAL_CONST(1450.1863613025282/8.0),
+ REAL_CONST(1458.4201989842913/8.0),
+ REAL_CONST(1466.6656746262797/8.0),
+ REAL_CONST(1474.9227554683875/8.0),
+ REAL_CONST(1483.1914089800841/8.0),
+ REAL_CONST(1491.4716028578516/8.0),
+ REAL_CONST(1499.7633050226596/8.0),
+ REAL_CONST(1508.0664836174794/8.0),
+ REAL_CONST(1516.3811070048375/8.0),
+ REAL_CONST(1524.7071437644029/8.0),
+ REAL_CONST(1533.0445626906128/8.0),
+ REAL_CONST(1541.3933327903342/8.0),
+ REAL_CONST(1549.7534232805581/8.0),
+ REAL_CONST(1558.1248035861302/8.0),
+ REAL_CONST(1566.507443337515/8.0),
+ REAL_CONST(1574.9013123685909/8.0),
+ REAL_CONST(1583.3063807144795/8.0),
+ REAL_CONST(1591.7226186094069/8.0),
+ REAL_CONST(1600.1499964845941/8.0),
+ REAL_CONST(1608.58848496618/8.0),
+ REAL_CONST(1617.0380548731737/8.0),
+ REAL_CONST(1625.4986772154357/8.0),
+ REAL_CONST(1633.9703231916887/8.0),
+ REAL_CONST(1642.4529641875577/8.0),
+ REAL_CONST(1650.9465717736346/8.0),
+ REAL_CONST(1659.4511177035752/8.0),
+ REAL_CONST(1667.9665739122186/8.0),
+ REAL_CONST(1676.4929125137353/8.0),
+ REAL_CONST(1685.030105799801/8.0),
+ REAL_CONST(1693.5781262377957/8.0),
+ REAL_CONST(1702.136946469027/8.0),
+ REAL_CONST(1710.7065393069795/8.0),
+ REAL_CONST(1719.2868777355877/8.0),
+ REAL_CONST(1727.8779349075323/8.0),
+ REAL_CONST(1736.4796841425596/8.0),
+ REAL_CONST(1745.092098925825/8.0),
+ REAL_CONST(1753.7151529062583/8.0),
+ REAL_CONST(1762.3488198949503/8.0),
+ REAL_CONST(1770.9930738635628/8.0),
+ REAL_CONST(1779.6478889427597/8.0),
+ REAL_CONST(1788.3132394206564/8.0),
+ REAL_CONST(1796.9890997412947/8.0),
+ REAL_CONST(1805.6754445031333/8.0),
+ REAL_CONST(1814.3722484575621/8.0),
+ REAL_CONST(1823.0794865074322/8.0),
+ REAL_CONST(1831.7971337056094/8.0),
+ REAL_CONST(1840.5251652535437/8.0),
+ REAL_CONST(1849.2635564998579/8.0),
+ REAL_CONST(1858.0122829389563/8.0),
+ REAL_CONST(1866.7713202096493/8.0),
+ REAL_CONST(1875.5406440937966/8.0),
+ REAL_CONST(1884.3202305149687/8.0),
+ REAL_CONST(1893.110055537124/8.0),
+ REAL_CONST(1901.9100953633042/8.0),
+ REAL_CONST(1910.7203263343454/8.0),
+ REAL_CONST(1919.5407249276057/8.0),
+ REAL_CONST(1928.3712677557098/8.0),
+ REAL_CONST(1937.2119315653083/8.0),
+ REAL_CONST(1946.0626932358525/8.0),
+ REAL_CONST(1954.923529778386/8.0),
+ REAL_CONST(1963.79441833435/8.0),
+ REAL_CONST(1972.6753361744036/8.0),
+ REAL_CONST(1981.5662606972594/8.0),
+ REAL_CONST(1990.467169428533/8.0),
+ REAL_CONST(1999.3780400196069/8.0),
+ REAL_CONST(2008.2988502465078/8.0),
+ REAL_CONST(2017.2295780087982/8.0),
+ REAL_CONST(2026.1702013284819/8.0),
+ REAL_CONST(2035.1206983489212/8.0),
+ REAL_CONST(2044.0810473337688/8.0),
+ REAL_CONST(2053.0512266659125/8.0),
+ REAL_CONST(2062.0312148464309/8.0),
+ REAL_CONST(2071.0209904935646/8.0),
+ REAL_CONST(2080.0205323416958/8.0),
+ REAL_CONST(2089.0298192403443/8.0),
+ REAL_CONST(2098.0488301531714/8.0),
+ REAL_CONST(2107.0775441569995/8.0),
+ REAL_CONST(2116.115940440839/8.0),
+ REAL_CONST(2125.1639983049317/8.0),
+ REAL_CONST(2134.2216971597995/8.0),
+ REAL_CONST(2143.2890165253098/8.0),
+ REAL_CONST(2152.3659360297484/8.0),
+ REAL_CONST(2161.4524354089031/8.0),
+ REAL_CONST(2170.5484945051617/8.0),
+ REAL_CONST(2179.6540932666144/8.0),
+ REAL_CONST(2188.7692117461711/8.0),
+ REAL_CONST(2197.8938301006888/8.0),
+ REAL_CONST(2207.0279285901042/8.0),
+ REAL_CONST(2216.1714875765838/8.0),
+ REAL_CONST(2225.324487523676/8.0),
+ REAL_CONST(2234.4869089954782/8.0),
+ REAL_CONST(2243.6587326558101/8.0),
+ REAL_CONST(2252.8399392673982/8.0),
+ REAL_CONST(2262.0305096910702/8.0),
+ REAL_CONST(2271.2304248849537/8.0),
+ REAL_CONST(2280.4396659036897/8.0),
+ REAL_CONST(2289.6582138976523/8.0),
+ REAL_CONST(2298.8860501121762/8.0),
+ REAL_CONST(2308.1231558867926/8.0),
+ REAL_CONST(2317.3695126544767/8.0),
+ REAL_CONST(2326.6251019409005/8.0),
+ REAL_CONST(2335.8899053636933/8.0),
+ REAL_CONST(2345.1639046317132/8.0),
+ REAL_CONST(2354.4470815443233/8.0),
+ REAL_CONST(2363.7394179906792/8.0),
+ REAL_CONST(2373.0408959490205/8.0),
+ REAL_CONST(2382.3514974859731/8.0),
+ REAL_CONST(2391.6712047558558/8.0),
+ REAL_CONST(2400.9999999999991/8.0),
+ REAL_CONST(2410.3378655460651/8.0),
+ REAL_CONST(2419.6847838073813/8.0),
+ REAL_CONST(2429.0407372822747/8.0),
+ REAL_CONST(2438.4057085534191/8.0),
+ REAL_CONST(2447.7796802871858/8.0),
+ REAL_CONST(2457.1626352330004/8.0),
+ REAL_CONST(2466.5545562227112/8.0),
+ REAL_CONST(2475.9554261699564/8.0),
+ REAL_CONST(2485.3652280695474/8.0),
+ REAL_CONST(2494.7839449968492/8.0),
+ REAL_CONST(2504.2115601071737/8.0),
+ REAL_CONST(2513.6480566351788/8.0),
+ REAL_CONST(2523.0934178942675/8.0),
+ REAL_CONST(2532.5476272760025/8.0),
+ REAL_CONST(2542.0106682495189/8.0),
+ REAL_CONST(2551.482524360948/8.0),
+ REAL_CONST(2560.9631792328441/8.0),
+ REAL_CONST(2570.4526165636184/8.0),
+ REAL_CONST(2579.9508201269791/8.0),
+ REAL_CONST(2589.4577737713744/8.0),
+ REAL_CONST(2598.9734614194458/8.0),
+ REAL_CONST(2608.4978670674823/8.0),
+ REAL_CONST(2618.0309747848837/8.0),
+ REAL_CONST(2627.5727687136259/8.0),
+ REAL_CONST(2637.1232330677353/8.0),
+ REAL_CONST(2646.6823521327647/8.0),
+ REAL_CONST(2656.2501102652768/8.0),
+ REAL_CONST(2665.8264918923328/8.0),
+ REAL_CONST(2675.4114815109842/8.0),
+ REAL_CONST(2685.0050636877722/8.0),
+ REAL_CONST(2694.6072230582295/8.0),
+ REAL_CONST(2704.2179443263894/8.0),
+ REAL_CONST(2713.8372122642972/8.0),
+ REAL_CONST(2723.4650117115279/8.0),
+ REAL_CONST(2733.1013275747096/8.0),
+ REAL_CONST(2742.7461448270483/8.0),
+ REAL_CONST(2752.3994485078601/8.0),
+ REAL_CONST(2762.0612237221085/8.0),
+ REAL_CONST(2771.7314556399419/8.0),
+ REAL_CONST(2781.4101294962406/8.0),
+ REAL_CONST(2791.0972305901655/8.0),
+ REAL_CONST(2800.7927442847094/8.0),
+ REAL_CONST(2810.4966560062589/8.0),
+ REAL_CONST(2820.2089512441521/8.0),
+ REAL_CONST(2829.9296155502466/8.0),
+ REAL_CONST(2839.6586345384894/8.0),
+ REAL_CONST(2849.3959938844923/8.0),
+ REAL_CONST(2859.1416793251065/8.0),
+ REAL_CONST(2868.8956766580086/8.0),
+ REAL_CONST(2878.6579717412847/8.0),
+ REAL_CONST(2888.4285504930212/8.0),
+ REAL_CONST(2898.2073988908974/8.0),
+ REAL_CONST(2907.9945029717837/8.0),
+ REAL_CONST(2917.789848831344/8.0),
+ REAL_CONST(2927.5934226236377/8.0),
+ REAL_CONST(2937.4052105607311/8.0),
+ REAL_CONST(2947.2251989123079/8.0),
+ REAL_CONST(2957.0533740052865/8.0),
+ REAL_CONST(2966.8897222234368/8.0),
+ REAL_CONST(2976.734230007005/8.0),
+ REAL_CONST(2986.5868838523397/8.0),
+ REAL_CONST(2996.4476703115197/8.0),
+ REAL_CONST(3006.3165759919889/8.0),
+ REAL_CONST(3016.1935875561908/8.0),
+ REAL_CONST(3026.0786917212095/8.0),
+ REAL_CONST(3035.9718752584108/8.0),
+ REAL_CONST(3045.8731249930906/8.0),
+ REAL_CONST(3055.7824278041207/8.0),
+ REAL_CONST(3065.6997706236039/8.0),
+ REAL_CONST(3075.625140436528/8.0),
+ REAL_CONST(3085.5585242804245/8.0),
+ REAL_CONST(3095.4999092450298/8.0),
+ REAL_CONST(3105.4492824719491/8.0),
+ REAL_CONST(3115.4066311543256/8.0),
+ REAL_CONST(3125.3719425365089/8.0),
+ REAL_CONST(3135.3452039137287/8.0),
+ REAL_CONST(3145.3264026317715/8.0),
+ REAL_CONST(3155.3155260866592/8.0),
+ REAL_CONST(3165.3125617243295/8.0),
+ REAL_CONST(3175.3174970403229/8.0),
+ REAL_CONST(3185.3303195794679/8.0),
+ REAL_CONST(3195.35101693557/8.0),
+ REAL_CONST(3205.3795767511078/8.0),
+ REAL_CONST(3215.4159867169251/8.0),
+ REAL_CONST(3225.460234571929/8.0),
+ REAL_CONST(3235.5123081027928/8.0),
+ REAL_CONST(3245.5721951436558/8.0),
+ REAL_CONST(3255.63988357583/8.0),
+ REAL_CONST(3265.7153613275095/8.0),
+ REAL_CONST(3275.7986163734795/8.0),
+ REAL_CONST(3285.8896367348289/8.0),
+ REAL_CONST(3295.9884104786665/8.0),
+ REAL_CONST(3306.0949257178395/8.0),
+ REAL_CONST(3316.2091706106517/8.0),
+ REAL_CONST(3326.331133360588/8.0),
+ REAL_CONST(3336.4608022160378/8.0),
+ REAL_CONST(3346.5981654700231/8.0),
+ REAL_CONST(3356.7432114599264/8.0),
+ REAL_CONST(3366.8959285672249/8.0),
+ REAL_CONST(3377.0563052172211/8.0),
+ REAL_CONST(3387.2243298787821/8.0),
+ REAL_CONST(3397.3999910640764/8.0),
+ REAL_CONST(3407.5832773283128/8.0),
+ REAL_CONST(3417.7741772694862/8.0),
+ REAL_CONST(3427.9726795281199/8.0),
+ REAL_CONST(3438.1787727870123/8.0),
+ REAL_CONST(3448.3924457709873/8.0),
+ REAL_CONST(3458.6136872466445/8.0),
+ REAL_CONST(3468.8424860221107/8.0),
+ REAL_CONST(3479.0788309467976/8.0),
+ REAL_CONST(3489.3227109111554/8.0),
+ REAL_CONST(3499.5741148464344/8.0),
+ REAL_CONST(3509.8330317244445/8.0),
+ REAL_CONST(3520.0994505573185/8.0),
+ REAL_CONST(3530.3733603972751/8.0),
+ REAL_CONST(3540.6547503363886/8.0),
+ REAL_CONST(3550.9436095063534/8.0),
+ REAL_CONST(3561.239927078258/8.0),
+ REAL_CONST(3571.5436922623535/8.0),
+ REAL_CONST(3581.8548943078308/8.0),
+ REAL_CONST(3592.1735225025936/8.0),
+ REAL_CONST(3602.4995661730372/8.0),
+ REAL_CONST(3612.8330146838275/8.0),
+ REAL_CONST(3623.1738574376814/8.0),
+ REAL_CONST(3633.5220838751502/8.0),
+ REAL_CONST(3643.8776834744031/8.0),
+ REAL_CONST(3654.2406457510142/8.0),
+ REAL_CONST(3664.6109602577494/8.0),
+ REAL_CONST(3674.9886165843564/8.0),
+ REAL_CONST(3685.3736043573545/8.0),
+ REAL_CONST(3695.7659132398294/8.0),
+ REAL_CONST(3706.1655329312248/8.0),
+ REAL_CONST(3716.5724531671399/8.0),
+ REAL_CONST(3726.9866637191262/8.0),
+ REAL_CONST(3737.4081543944876/8.0),
+ REAL_CONST(3747.8369150360782/8.0),
+ REAL_CONST(3758.2729355221072/8.0),
+ REAL_CONST(3768.7162057659411/8.0),
+ REAL_CONST(3779.1667157159077/8.0),
+ REAL_CONST(3789.6244553551055/8.0),
+ REAL_CONST(3800.0894147012082/8.0),
+ REAL_CONST(3810.5615838062768/8.0),
+ REAL_CONST(3821.0409527565694/8.0),
+ REAL_CONST(3831.5275116723533/8.0),
+ REAL_CONST(3842.0212507077194/8.0),
+ REAL_CONST(3852.522160050396/8.0),
+ REAL_CONST(3863.0302299215673/8.0),
+ REAL_CONST(3873.5454505756893/8.0),
+ REAL_CONST(3884.0678123003108/8.0),
+ REAL_CONST(3894.5973054158922/8.0),
+ REAL_CONST(3905.1339202756285/8.0),
+ REAL_CONST(3915.6776472652732/8.0),
+ REAL_CONST(3926.2284768029604/8.0),
+ REAL_CONST(3936.7863993390338/8.0),
+ REAL_CONST(3947.3514053558706/8.0),
+ REAL_CONST(3957.9234853677135/8.0),
+ REAL_CONST(3968.5026299204969/8.0),
+ REAL_CONST(3979.0888295916798/8.0),
+ REAL_CONST(3989.6820749900776/8.0),
+ REAL_CONST(4000.2823567556948/8.0),
+ REAL_CONST(4010.8896655595613/8.0),
+ REAL_CONST(4021.5039921035655/8.0),
+ REAL_CONST(4032.1253271202945/8.0),
+ REAL_CONST(4042.7536613728694/8.0),
+ REAL_CONST(4053.3889856547858/8.0),
+ REAL_CONST(4064.0312907897551/8.0),
+ REAL_CONST(4074.6805676315448/8.0),
+ REAL_CONST(4085.3368070638221/8.0),
+ REAL_CONST(4095.9999999999982/8.0),
+ REAL_CONST(4106.6701373830711/8.0),
+ REAL_CONST(4117.347210185475/8.0),
+ REAL_CONST(4128.0312094089259/8.0),
+ REAL_CONST(4138.722126084268/8.0),
+ REAL_CONST(4149.4199512713267/8.0),
+ REAL_CONST(4160.1246760587583/8.0),
+ REAL_CONST(4170.8362915638982/8.0),
+ REAL_CONST(4181.5547889326181/8.0),
+ REAL_CONST(4192.2801593391769/8.0),
+ REAL_CONST(4203.0123939860741/8.0),
+ REAL_CONST(4213.7514841039101/8.0),
+ REAL_CONST(4224.4974209512384/8.0),
+ REAL_CONST(4235.2501958144258/8.0),
+ REAL_CONST(4246.0098000075095/8.0),
+ REAL_CONST(4256.7762248720574/8.0),
+ REAL_CONST(4267.549461777031/8.0),
+ REAL_CONST(4278.3295021186423/8.0),
+ REAL_CONST(4289.1163373202198/8.0),
+ REAL_CONST(4299.9099588320714/8.0),
+ REAL_CONST(4310.7103581313495/8.0),
+ REAL_CONST(4321.5175267219138/8.0),
+ REAL_CONST(4332.3314561342004/8.0),
+ REAL_CONST(4343.152137925088/8.0),
+ REAL_CONST(4353.9795636777671/8.0),
+ REAL_CONST(4364.8137250016052/8.0),
+ REAL_CONST(4375.6546135320223/8.0),
+ REAL_CONST(4386.5022209303588/8.0),
+ REAL_CONST(4397.3565388837469/8.0),
+ REAL_CONST(4408.2175591049827/8.0),
+ REAL_CONST(4419.0852733324018/8.0),
+ REAL_CONST(4429.9596733297531/8.0),
+ REAL_CONST(4440.8407508860728/8.0),
+ REAL_CONST(4451.7284978155603/8.0),
+ REAL_CONST(4462.6229059574571/8.0),
+ REAL_CONST(4473.5239671759227/8.0),
+ REAL_CONST(4484.4316733599126/8.0),
+ REAL_CONST(4495.3460164230582/8.0),
+ REAL_CONST(4506.2669883035496/8.0),
+ REAL_CONST(4517.1945809640119/8.0),
+ REAL_CONST(4528.1287863913894/8.0),
+ REAL_CONST(4539.069596596828/8.0),
+ REAL_CONST(4550.0170036155587/8.0),
+ REAL_CONST(4560.9709995067806/8.0),
+ REAL_CONST(4571.931576353546/8.0),
+ REAL_CONST(4582.898726262647/8.0),
+ REAL_CONST(4593.8724413645004/8.0),
+ REAL_CONST(4604.8527138130348/8.0),
+ REAL_CONST(4615.8395357855816/8.0),
+ REAL_CONST(4626.8328994827571/8.0),
+ REAL_CONST(4637.8327971283588/8.0),
+ REAL_CONST(4648.8392209692511/8.0),
+ REAL_CONST(4659.8521632752563/8.0),
+ REAL_CONST(4670.8716163390473/8.0),
+ REAL_CONST(4681.8975724760394/8.0),
+ REAL_CONST(4692.9300240242837/8.0),
+ REAL_CONST(4703.9689633443595/8.0),
+ REAL_CONST(4715.0143828192668/8.0),
+ REAL_CONST(4726.0662748543255/8.0),
+ REAL_CONST(4737.1246318770682/8.0),
+ REAL_CONST(4748.1894463371373/8.0),
+ REAL_CONST(4759.2607107061804/8.0),
+ REAL_CONST(4770.3384174777493/8.0),
+ REAL_CONST(4781.4225591671993/8.0),
+ REAL_CONST(4792.5131283115852/8.0),
+ REAL_CONST(4803.6101174695614/8.0),
+ REAL_CONST(4814.7135192212854/8.0),
+ REAL_CONST(4825.8233261683154/8.0),
+ REAL_CONST(4836.9395309335096/8.0),
+ REAL_CONST(4848.0621261609349/8.0),
+ REAL_CONST(4859.1911045157631/8.0),
+ REAL_CONST(4870.3264586841779/8.0),
+ REAL_CONST(4881.4681813732768/8.0),
+ REAL_CONST(4892.6162653109768/8.0),
+ REAL_CONST(4903.7707032459193/8.0),
+ REAL_CONST(4914.931487947375/8.0),
+ REAL_CONST(4926.0986122051509/8.0),
+ REAL_CONST(4937.2720688294967/8.0),
+ REAL_CONST(4948.4518506510112/8.0),
+ REAL_CONST(4959.637950520555/8.0),
+ REAL_CONST(4970.8303613091521/8.0),
+ REAL_CONST(4982.0290759079044/8.0),
+ REAL_CONST(4993.2340872278974/8.0),
+ REAL_CONST(5004.4453882001153/8.0),
+ REAL_CONST(5015.6629717753467/8.0),
+ REAL_CONST(5026.8868309241007/8.0),
+ REAL_CONST(5038.1169586365131/8.0),
+ REAL_CONST(5049.353347922266/8.0),
+ REAL_CONST(5060.5959918104927/8.0),
+ REAL_CONST(5071.8448833496996/8.0),
+ REAL_CONST(5083.1000156076734/8.0),
+ REAL_CONST(5094.3613816713996/8.0),
+ REAL_CONST(5105.6289746469747/8.0),
+ REAL_CONST(5116.9027876595246/8.0),
+ REAL_CONST(5128.18281385312/8.0),
+ REAL_CONST(5139.4690463906918/8.0),
+ REAL_CONST(5150.7614784539473/8.0),
+ REAL_CONST(5162.0601032432933/8.0),
+ REAL_CONST(5173.3649139777472/8.0),
+ REAL_CONST(5184.6759038948594/8.0),
+ REAL_CONST(5195.9930662506322/8.0),
+ REAL_CONST(5207.3163943194386/8.0),
+ REAL_CONST(5218.6458813939435/8.0),
+ REAL_CONST(5229.9815207850224/8.0),
+ REAL_CONST(5241.3233058216847/8.0),
+ REAL_CONST(5252.6712298509919/8.0),
+ REAL_CONST(5264.025286237983/8.0),
+ REAL_CONST(5275.3854683655954/8.0),
+ REAL_CONST(5286.7517696345885/8.0),
+ REAL_CONST(5298.1241834634639/8.0),
+ REAL_CONST(5309.5027032883945/8.0),
+ REAL_CONST(5320.887322563146/8.0),
+ REAL_CONST(5332.2780347589978/8.0),
+ REAL_CONST(5343.6748333646756/8.0),
+ REAL_CONST(5355.0777118862716/8.0),
+ REAL_CONST(5366.4866638471722/8.0),
+ REAL_CONST(5377.901682787985/8.0),
+ REAL_CONST(5389.3227622664635/8.0),
+ REAL_CONST(5400.749895857437/8.0),
+ REAL_CONST(5412.1830771527357/8.0),
+ REAL_CONST(5423.622299761123/8.0),
+ REAL_CONST(5435.067557308219/8.0),
+ REAL_CONST(5446.5188434364318/8.0),
+ REAL_CONST(5457.9761518048872/8.0),
+ REAL_CONST(5469.4394760893592/8.0),
+ REAL_CONST(5480.9088099821975/8.0),
+ REAL_CONST(5492.3841471922606/8.0),
+ REAL_CONST(5503.8654814448455/8.0),
+ REAL_CONST(5515.3528064816201/8.0),
+ REAL_CONST(5526.846116060552/8.0),
+ REAL_CONST(5538.3454039558474/8.0),
+ REAL_CONST(5549.8506639578736/8.0),
+ REAL_CONST(5561.3618898731029/8.0),
+ REAL_CONST(5572.8790755240361/8.0),
+ REAL_CONST(5584.4022147491451/8.0),
+ REAL_CONST(5595.9313014027975/8.0),
+ REAL_CONST(5607.4663293552012/8.0),
+ REAL_CONST(5619.0072924923297/8.0),
+ REAL_CONST(5630.5541847158656/8.0),
+ REAL_CONST(5642.1069999431284/8.0),
+ REAL_CONST(5653.665732107017/8.0),
+ REAL_CONST(5665.230375155943/8.0),
+ REAL_CONST(5676.8009230537655/8.0),
+ REAL_CONST(5688.3773697797333/8.0),
+ REAL_CONST(5699.9597093284156/8.0),
+ REAL_CONST(5711.5479357096474/8.0),
+ REAL_CONST(5723.1420429484588/8.0),
+ REAL_CONST(5734.7420250850209/8.0),
+ REAL_CONST(5746.347876174581/8.0),
+ REAL_CONST(5757.9595902874016/8.0),
+ REAL_CONST(5769.5771615087006/8.0),
+ REAL_CONST(5781.2005839385911/8.0),
+ REAL_CONST(5792.8298516920213/8.0),
+ REAL_CONST(5804.4649588987149/8.0),
+ REAL_CONST(5816.1058997031105/8.0),
+ REAL_CONST(5827.7526682643065/8.0),
+ REAL_CONST(5839.4052587559972/8.0),
+ REAL_CONST(5851.0636653664196/8.0),
+ REAL_CONST(5862.7278822982908/8.0),
+ REAL_CONST(5874.3979037687541/8.0),
+ REAL_CONST(5886.0737240093204/8.0),
+ REAL_CONST(5897.7553372658094/8.0),
+ REAL_CONST(5909.4427377982956/8.0),
+ REAL_CONST(5921.1359198810505/8.0),
+ REAL_CONST(5932.8348778024874/8.0),
+ REAL_CONST(5944.5396058651031/8.0),
+ REAL_CONST(5956.2500983854261/8.0),
+ REAL_CONST(5967.9663496939575/8.0),
+ REAL_CONST(5979.6883541351208/8.0),
+ REAL_CONST(5991.4161060672022/8.0),
+ REAL_CONST(6003.1495998623004/8.0),
+ REAL_CONST(6014.8888299062692/8.0),
+ REAL_CONST(6026.6337905986684/8.0),
+ REAL_CONST(6038.3844763527022/8.0),
+ REAL_CONST(6050.1408815951781/8.0),
+ REAL_CONST(6061.9030007664414/8.0),
+ REAL_CONST(6073.6708283203316/8.0),
+ REAL_CONST(6085.4443587241267/8.0),
+ REAL_CONST(6097.2235864584891/8.0),
+ REAL_CONST(6109.0085060174197/8.0),
+ REAL_CONST(6120.7991119081998/8.0),
+ REAL_CONST(6132.595398651345/8.0),
+ REAL_CONST(6144.3973607805519/8.0),
+ REAL_CONST(6156.2049928426459/8.0),
+ REAL_CONST(6168.0182893975361/8.0),
+ REAL_CONST(6179.8372450181578/8.0),
+ REAL_CONST(6191.6618542904307/8.0),
+ REAL_CONST(6203.4921118132024/8.0),
+ REAL_CONST(6215.3280121982016/8.0),
+ REAL_CONST(6227.1695500699925/8.0),
+ REAL_CONST(6239.0167200659189/8.0),
+ REAL_CONST(6250.8695168360628/8.0),
+ REAL_CONST(6262.7279350431891/8.0),
+ REAL_CONST(6274.5919693627056/8.0),
+ REAL_CONST(6286.4616144826068/8.0),
+ REAL_CONST(6298.3368651034316/8.0),
+ REAL_CONST(6310.2177159382172/8.0),
+ REAL_CONST(6322.1041617124456/8.0),
+ REAL_CONST(6333.9961971640032/8.0),
+ REAL_CONST(6345.8938170431311/8.0),
+ REAL_CONST(6357.7970161123785/8.0),
+ REAL_CONST(6369.7057891465583/8.0),
+ REAL_CONST(6381.6201309327007/8.0),
+ REAL_CONST(6393.5400362700075/8.0),
+ REAL_CONST(6405.4654999698032/8.0),
+ REAL_CONST(6417.3965168554978/8.0),
+ REAL_CONST(6429.3330817625329/8.0),
+ REAL_CONST(6441.2751895383453/8.0),
+ REAL_CONST(6453.2228350423138/8.0),
+ REAL_CONST(6465.176013145724/8.0),
+ REAL_CONST(6477.134718731716/8.0),
+ REAL_CONST(6489.0989466952469/8.0),
+ REAL_CONST(6501.0686919430445/8.0),
+ REAL_CONST(6513.0439493935628/8.0),
+ REAL_CONST(6525.0247139769417/8.0),
+ REAL_CONST(6537.010980634961/8.0),
+ REAL_CONST(6549.002744321001/8.0),
+ REAL_CONST(6560.9999999999973/8.0),
+ REAL_CONST(6573.0027426483985/8.0),
+ REAL_CONST(6585.0109672541284/8.0),
+ REAL_CONST(6597.0246688165371/8.0),
+ REAL_CONST(6609.0438423463656/8.0),
+ REAL_CONST(6621.0684828657004/8.0),
+ REAL_CONST(6633.0985854079354/8.0),
+ REAL_CONST(6645.134145017727/8.0),
+ REAL_CONST(6657.1751567509573/8.0),
+ REAL_CONST(6669.2216156746908/8.0),
+ REAL_CONST(6681.2735168671343/8.0),
+ REAL_CONST(6693.3308554176001/8.0),
+ REAL_CONST(6705.3936264264594/8.0),
+ REAL_CONST(6717.461825005108/8.0),
+ REAL_CONST(6729.535446275926/8.0),
+ REAL_CONST(6741.6144853722335/8.0),
+ REAL_CONST(6753.6989374382601/8.0),
+ REAL_CONST(6765.7887976290967/8.0),
+ REAL_CONST(6777.8840611106634/8.0),
+ REAL_CONST(6789.9847230596661/8.0),
+ REAL_CONST(6802.0907786635626/8.0),
+ REAL_CONST(6814.2022231205201/8.0),
+ REAL_CONST(6826.3190516393797/8.0),
+ REAL_CONST(6838.4412594396181/8.0),
+ REAL_CONST(6850.5688417513074/8.0),
+ REAL_CONST(6862.701793815083/8.0),
+ REAL_CONST(6874.840110882099/8.0),
+ REAL_CONST(6886.9837882139991/8.0),
+ REAL_CONST(6899.1328210828724/8.0),
+ REAL_CONST(6911.2872047712199/8.0),
+ REAL_CONST(6923.4469345719199/8.0),
+ REAL_CONST(6935.6120057881863/8.0),
+ REAL_CONST(6947.7824137335365/8.0),
+ REAL_CONST(6959.9581537317536/8.0),
+ REAL_CONST(6972.1392211168532/8.0),
+ REAL_CONST(6984.3256112330409/8.0),
+ REAL_CONST(6996.5173194346862/8.0),
+ REAL_CONST(7008.7143410862773/8.0),
+ REAL_CONST(7020.9166715623942/8.0),
+ REAL_CONST(7033.1243062476678/8.0),
+ REAL_CONST(7045.3372405367481/8.0),
+ REAL_CONST(7057.5554698342685/8.0),
+ REAL_CONST(7069.7789895548103/8.0),
+ REAL_CONST(7082.0077951228714/8.0),
+ REAL_CONST(7094.2418819728273/8.0),
+ REAL_CONST(7106.4812455489018/8.0),
+ REAL_CONST(7118.7258813051285/8.0),
+ REAL_CONST(7130.9757847053224/8.0),
+ REAL_CONST(7143.2309512230404/8.0),
+ REAL_CONST(7155.4913763415516/8.0),
+ REAL_CONST(7167.7570555538041/8.0),
+ REAL_CONST(7180.0279843623894/8.0),
+ REAL_CONST(7192.3041582795131/8.0),
+ REAL_CONST(7204.5855728269571/8.0),
+ REAL_CONST(7216.8722235360519/8.0),
+ REAL_CONST(7229.1641059476406/8.0),
+ REAL_CONST(7241.4612156120484/8.0),
+ REAL_CONST(7253.7635480890503/8.0),
+ REAL_CONST(7266.0710989478375/8.0),
+ REAL_CONST(7278.3838637669869/8.0),
+ REAL_CONST(7290.7018381344296/8.0),
+ REAL_CONST(7303.0250176474174/8.0),
+ REAL_CONST(7315.3533979124932/8.0),
+ REAL_CONST(7327.6869745454596/8.0),
+ REAL_CONST(7340.0257431713462/8.0),
+ REAL_CONST(7352.3696994243801/8.0),
+ REAL_CONST(7364.7188389479543/8.0),
+ REAL_CONST(7377.0731573945968/8.0),
+ REAL_CONST(7389.4326504259407/8.0),
+ REAL_CONST(7401.7973137126937/8.0),
+ REAL_CONST(7414.1671429346061/8.0),
+ REAL_CONST(7426.5421337804428/8.0),
+ REAL_CONST(7438.922281947951/8.0),
+ REAL_CONST(7451.3075831438346/8.0),
+ REAL_CONST(7463.6980330837177/8.0),
+ REAL_CONST(7476.0936274921214/8.0),
+ REAL_CONST(7488.4943621024304/8.0),
+ REAL_CONST(7500.9002326568652/8.0),
+ REAL_CONST(7513.3112349064522/8.0),
+ REAL_CONST(7525.7273646109943/8.0),
+ REAL_CONST(7538.1486175390446/8.0),
+ REAL_CONST(7550.5749894678729/8.0),
+ REAL_CONST(7563.0064761834419/8.0),
+ REAL_CONST(7575.4430734803736/8.0),
+ REAL_CONST(7587.8847771619248/8.0),
+ REAL_CONST(7600.3315830399597/8.0),
+ REAL_CONST(7612.7834869349153/8.0),
+ REAL_CONST(7625.24048467578/8.0),
+ REAL_CONST(7637.7025721000637/8.0),
+ REAL_CONST(7650.1697450537677/8.0),
+ REAL_CONST(7662.6419993913596/8.0),
+ REAL_CONST(7675.1193309757446/8.0),
+ REAL_CONST(7687.6017356782404/8.0),
+ REAL_CONST(7700.0892093785433/8.0),
+ REAL_CONST(7712.5817479647112/8.0),
+ REAL_CONST(7725.079347333125/8.0),
+ REAL_CONST(7737.5820033884729/8.0),
+ REAL_CONST(7750.0897120437139/8.0),
+ REAL_CONST(7762.6024692200581/8.0),
+ REAL_CONST(7775.1202708469355/8.0),
+ REAL_CONST(7787.6431128619733/8.0),
+ REAL_CONST(7800.1709912109645/8.0),
+ REAL_CONST(7812.7039018478481/8.0),
+ REAL_CONST(7825.2418407346768/8.0),
+ REAL_CONST(7837.7848038415968/8.0),
+ REAL_CONST(7850.3327871468155/8.0),
+ REAL_CONST(7862.8857866365806/8.0),
+ REAL_CONST(7875.4437983051539/8.0),
+ REAL_CONST(7888.006818154784/8.0),
+ REAL_CONST(7900.5748421956796/8.0),
+ REAL_CONST(7913.1478664459901/8.0),
+ REAL_CONST(7925.725886931772/8.0),
+ REAL_CONST(7938.3088996869719/8.0),
+ REAL_CONST(7950.8969007533951/8.0),
+ REAL_CONST(7963.4898861806851/8.0),
+ REAL_CONST(7976.0878520262959/8.0),
+ REAL_CONST(7988.6907943554688/8.0),
+ REAL_CONST(8001.2987092412086/8.0),
+ REAL_CONST(8013.911592764257/8.0),
+ REAL_CONST(8026.5294410130691/8.0),
+ REAL_CONST(8039.1522500837891/8.0),
+ REAL_CONST(8051.7800160802271/8.0),
+ REAL_CONST(8064.412735113835/8.0),
+ REAL_CONST(8077.0504033036796/8.0),
+ REAL_CONST(8089.6930167764222/8.0),
+ REAL_CONST(8102.3405716662946/8.0),
+ REAL_CONST(8114.9930641150731/8.0),
+ REAL_CONST(8127.6504902720571/8.0),
+ REAL_CONST(8140.3128462940449/8.0),
+ REAL_CONST(8152.9801283453098/8.0),
+ REAL_CONST(8165.6523325975786/8.0),
+ REAL_CONST(8178.3294552300049/8.0),
+ REAL_CONST(8191.0114924291529/8.0),
+ REAL_CONST(8203.6984403889655/8.0),
+ REAL_CONST(8216.3902953107463/8.0),
+ REAL_CONST(8229.0870534031419/8.0),
+ REAL_CONST(8241.7887108821069/8.0),
+ REAL_CONST(8254.4952639708936/8.0),
+ REAL_CONST(8267.2067089000211/8.0),
+ REAL_CONST(8279.9230419072574/8.0),
+ REAL_CONST(8292.6442592375952/8.0),
+ REAL_CONST(8305.3703571432306/8.0),
+ REAL_CONST(8318.101331883543/8.0),
+ REAL_CONST(8330.8371797250657/8.0),
+ REAL_CONST(8343.577896941475/8.0),
+ REAL_CONST(8356.3234798135582/8.0),
+ REAL_CONST(8369.0739246291978/8.0),
+ REAL_CONST(8381.8292276833508/8.0),
+ REAL_CONST(8394.5893852780209/8.0),
+ REAL_CONST(8407.3543937222421/8.0),
+ REAL_CONST(8420.1242493320569/8.0),
+ REAL_CONST(8432.8989484304948/8.0),
+ REAL_CONST(8445.6784873475499/8.0),
+ REAL_CONST(8458.4628624201578/8.0),
+ REAL_CONST(8471.2520699921806/8.0),
+ REAL_CONST(8484.0461064143838/8.0),
+ REAL_CONST(8496.8449680444082/8.0),
+ REAL_CONST(8509.6486512467636/8.0),
+ REAL_CONST(8522.4571523927953/8.0),
+ REAL_CONST(8535.270467860666/8.0),
+ REAL_CONST(8548.0885940353437/8.0),
+ REAL_CONST(8560.9115273085663/8.0),
+ REAL_CONST(8573.7392640788403/8.0),
+ REAL_CONST(8586.5718007514006/8.0),
+ REAL_CONST(8599.4091337382069/8.0),
+ REAL_CONST(8612.2512594579148/8.0),
+ REAL_CONST(8625.0981743358552/8.0),
+ REAL_CONST(8637.9498748040205/8.0),
+ REAL_CONST(8650.8063573010386/8.0),
+ REAL_CONST(8663.6676182721567/8.0),
+ REAL_CONST(8676.533654169225/8.0),
+ REAL_CONST(8689.4044614506638/8.0),
+ REAL_CONST(8702.2800365814601/8.0),
+ REAL_CONST(8715.1603760331418/8.0),
+ REAL_CONST(8728.0454762837508/8.0),
+ REAL_CONST(8740.9353338178389/8.0),
+ REAL_CONST(8753.8299451264356/8.0),
+ REAL_CONST(8766.7293067070332/8.0),
+ REAL_CONST(8779.6334150635721/8.0),
+ REAL_CONST(8792.5422667064158/8.0),
+ REAL_CONST(8805.4558581523324/8.0),
+ REAL_CONST(8818.3741859244819/8.0),
+ REAL_CONST(8831.2972465523908/8.0),
+ REAL_CONST(8844.2250365719356/8.0),
+ REAL_CONST(8857.1575525253265/8.0),
+ REAL_CONST(8870.0947909610859/8.0),
+ REAL_CONST(8883.0367484340295/8.0),
+ REAL_CONST(8895.9834215052524/8.0),
+ REAL_CONST(8908.934806742107/8.0),
+ REAL_CONST(8921.8909007181846/8.0),
+ REAL_CONST(8934.8517000132997/8.0),
+ REAL_CONST(8947.817201213471/8.0),
+ REAL_CONST(8960.7874009109/8.0),
+ REAL_CONST(8973.7622957039603/8.0),
+ REAL_CONST(8986.7418821971733/8.0),
+ REAL_CONST(8999.7261570011924/8.0),
+ REAL_CONST(9012.7151167327884/8.0),
+ REAL_CONST(9025.7087580148236/8.0),
+ REAL_CONST(9038.7070774762469/8.0),
+ REAL_CONST(9051.7100717520643/8.0),
+ REAL_CONST(9064.7177374833282/8.0),
+ REAL_CONST(9077.7300713171153/8.0),
+ REAL_CONST(9090.7470699065179/8.0),
+ REAL_CONST(9103.7687299106146/8.0),
+ REAL_CONST(9116.7950479944648/8.0),
+ REAL_CONST(9129.8260208290812/8.0),
+ REAL_CONST(9142.8616450914233/8.0),
+ REAL_CONST(9155.9019174643727/8.0),
+ REAL_CONST(9168.9468346367157/8.0),
+ REAL_CONST(9181.9963933031358/8.0),
+ REAL_CONST(9195.0505901641845/8.0),
+ REAL_CONST(9208.1094219262741/8.0),
+ REAL_CONST(9221.1728853016557/8.0),
+ REAL_CONST(9234.240977008405/8.0),
+ REAL_CONST(9247.3136937704076/8.0),
+ REAL_CONST(9260.3910323173386/8.0),
+ REAL_CONST(9273.472989384647/8.0),
+ REAL_CONST(9286.5595617135423/8.0),
+ REAL_CONST(9299.6507460509747/8.0),
+ REAL_CONST(9312.7465391496207/8.0),
+ REAL_CONST(9325.8469377678684/8.0),
+ REAL_CONST(9338.9519386698012/8.0),
+ REAL_CONST(9352.0615386251757/8.0),
+ REAL_CONST(9365.1757344094131/8.0),
+ REAL_CONST(9378.2945228035842/8.0),
+ REAL_CONST(9391.4179005943843/8.0),
+ REAL_CONST(9404.5458645741273/8.0),
+ REAL_CONST(9417.6784115407263/8.0),
+ REAL_CONST(9430.8155382976747/8.0),
+ REAL_CONST(9443.9572416540359/8.0),
+ REAL_CONST(9457.1035184244265/8.0),
+ REAL_CONST(9470.2543654290002/8.0),
+ REAL_CONST(9483.4097794934296/8.0),
+ REAL_CONST(9496.5697574488931/8.0),
+ REAL_CONST(9509.7342961320664/8.0),
+ REAL_CONST(9522.9033923850911/8.0),
+ REAL_CONST(9536.0770430555804/8.0),
+ REAL_CONST(9549.2552449965824/8.0),
+ REAL_CONST(9562.4379950665825/8.0),
+ REAL_CONST(9575.6252901294793/8.0),
+ REAL_CONST(9588.8171270545736/8.0),
+ REAL_CONST(9602.0135027165488/8.0),
+ REAL_CONST(9615.2144139954635/8.0),
+ REAL_CONST(9628.4198577767274/8.0),
+ REAL_CONST(9641.629830951093/8.0),
+ REAL_CONST(9654.844330414644/8.0),
+ REAL_CONST(9668.0633530687719/8.0),
+ REAL_CONST(9681.286895820167/8.0),
+ REAL_CONST(9694.5149555808002/8.0),
+ REAL_CONST(9707.7475292679192/8.0),
+ REAL_CONST(9720.9846138040157/8.0),
+ REAL_CONST(9734.2262061168276/8.0),
+ REAL_CONST(9747.4723031393187/8.0),
+ REAL_CONST(9760.7229018096641/8.0),
+ REAL_CONST(9773.9779990712323/8.0),
+ REAL_CONST(9787.2375918725811/8.0),
+ REAL_CONST(9800.5016771674327/8.0),
+ REAL_CONST(9813.7702519146696/8.0),
+ REAL_CONST(9827.0433130783094/8.0),
+ REAL_CONST(9840.3208576275028/8.0),
+ REAL_CONST(9853.602882536512/8.0),
+ REAL_CONST(9866.8893847846994/8.0),
+ REAL_CONST(9880.1803613565116/8.0),
+ REAL_CONST(9893.4758092414686/8.0),
+ REAL_CONST(9906.7757254341523/8.0),
+ REAL_CONST(9920.0801069341851/8.0),
+ REAL_CONST(9933.3889507462245/8.0),
+ REAL_CONST(9946.7022538799429/8.0),
+ REAL_CONST(9960.0200133500221/8.0),
+ REAL_CONST(9973.3422261761298/8.0),
+ REAL_CONST(9986.6688893829159/8.0),
+ REAL_CONST(9999.9999999999945/8.0),
+ REAL_CONST(10013.335555061929/8.0),
+ REAL_CONST(10026.675551608221/8.0),
+ REAL_CONST(10040.019986683301/8.0),
+ REAL_CONST(10053.368857336509/8.0),
+ REAL_CONST(10066.722160622081/8.0),
+ REAL_CONST(10080.079893599144/8.0),
+ REAL_CONST(10093.442053331697/8.0),
+ REAL_CONST(10106.808636888598/8.0),
+ REAL_CONST(10120.179641343551/8.0),
+ REAL_CONST(10133.555063775095/8.0),
+ REAL_CONST(10146.934901266595/8.0),
+ REAL_CONST(10160.31915090622/8.0),
+ REAL_CONST(10173.707809786936/8.0),
+ REAL_CONST(10187.100875006496/8.0),
+ REAL_CONST(10200.498343667417/8.0),
+ REAL_CONST(10213.900212876984/8.0),
+ REAL_CONST(10227.306479747222/8.0),
+ REAL_CONST(10240.717141394889/8.0),
+ REAL_CONST(10254.132194941467/8.0),
+ REAL_CONST(10267.551637513146/8.0),
+ REAL_CONST(10280.975466240814/8.0),
+ REAL_CONST(10294.40367826004/8.0),
+ REAL_CONST(10307.836270711066/8.0),
+ REAL_CONST(10321.273240738796/8.0),
+ REAL_CONST(10334.71458549278/8.0)
+#ifdef BIG_IQ_TABLE
+ ,REAL_CONST(10348.160302127204/8.0),
+ REAL_CONST(10361.610387800878/8.0),
+ REAL_CONST(10375.064839677221/8.0),
+ REAL_CONST(10388.523654924258/8.0),
+ REAL_CONST(10401.986830714593/8.0),
+ REAL_CONST(10415.454364225412/8.0),
+ REAL_CONST(10428.926252638465/8.0),
+ REAL_CONST(10442.402493140049/8.0),
+ REAL_CONST(10455.883082921007/8.0),
+ REAL_CONST(10469.368019176709/8.0),
+ REAL_CONST(10482.85729910704/8.0),
+ REAL_CONST(10496.350919916393/8.0),
+ REAL_CONST(10509.848878813653/8.0),
+ REAL_CONST(10523.351173012188/8.0),
+ REAL_CONST(10536.857799729838/8.0),
+ REAL_CONST(10550.3687561889/8.0),
+ REAL_CONST(10563.884039616123/8.0),
+ REAL_CONST(10577.403647242685/8.0),
+ REAL_CONST(10590.927576304197/8.0),
+ REAL_CONST(10604.455824040679/8.0),
+ REAL_CONST(10617.988387696556/8.0),
+ REAL_CONST(10631.525264520642/8.0),
+ REAL_CONST(10645.066451766135/8.0),
+ REAL_CONST(10658.611946690598/8.0),
+ REAL_CONST(10672.161746555956/8.0),
+ REAL_CONST(10685.715848628475/8.0),
+ REAL_CONST(10699.274250178762/8.0),
+ REAL_CONST(10712.836948481747/8.0),
+ REAL_CONST(10726.403940816675/8.0),
+ REAL_CONST(10739.975224467091/8.0),
+ REAL_CONST(10753.550796720834/8.0),
+ REAL_CONST(10767.130654870027/8.0),
+ REAL_CONST(10780.714796211059/8.0),
+ REAL_CONST(10794.303218044579/8.0),
+ REAL_CONST(10807.895917675487/8.0),
+ REAL_CONST(10821.492892412922/8.0),
+ REAL_CONST(10835.094139570248/8.0),
+ REAL_CONST(10848.699656465047/8.0),
+ REAL_CONST(10862.309440419107/8.0),
+ REAL_CONST(10875.923488758415/8.0),
+ REAL_CONST(10889.541798813138/8.0),
+ REAL_CONST(10903.16436791762/8.0),
+ REAL_CONST(10916.791193410372/8.0),
+ REAL_CONST(10930.422272634056/8.0),
+ REAL_CONST(10944.05760293548/8.0),
+ REAL_CONST(10957.697181665582/8.0),
+ REAL_CONST(10971.341006179427/8.0),
+ REAL_CONST(10984.98907383619/8.0),
+ REAL_CONST(10998.641381999149/8.0),
+ REAL_CONST(11012.297928035676/8.0),
+ REAL_CONST(11025.958709317223/8.0),
+ REAL_CONST(11039.623723219316/8.0),
+ REAL_CONST(11053.292967121541/8.0),
+ REAL_CONST(11066.966438407539/8.0),
+ REAL_CONST(11080.64413446499/8.0),
+ REAL_CONST(11094.326052685608/8.0),
+ REAL_CONST(11108.012190465128/8.0),
+ REAL_CONST(11121.702545203296/8.0),
+ REAL_CONST(11135.397114303863/8.0),
+ REAL_CONST(11149.095895174571/8.0),
+ REAL_CONST(11162.798885227143/8.0),
+ REAL_CONST(11176.506081877278/8.0),
+ REAL_CONST(11190.217482544635/8.0),
+ REAL_CONST(11203.933084652828/8.0),
+ REAL_CONST(11217.652885629415/8.0),
+ REAL_CONST(11231.376882905886/8.0),
+ REAL_CONST(11245.105073917659/8.0),
+ REAL_CONST(11258.837456104062/8.0),
+ REAL_CONST(11272.574026908333/8.0),
+ REAL_CONST(11286.314783777601/8.0),
+ REAL_CONST(11300.059724162888/8.0),
+ REAL_CONST(11313.808845519083/8.0),
+ REAL_CONST(11327.562145304952/8.0),
+ REAL_CONST(11341.319620983111/8.0),
+ REAL_CONST(11355.081270020033/8.0),
+ REAL_CONST(11368.847089886023/8.0),
+ REAL_CONST(11382.617078055218/8.0),
+ REAL_CONST(11396.391232005579/8.0),
+ REAL_CONST(11410.169549218874/8.0),
+ REAL_CONST(11423.952027180676/8.0),
+ REAL_CONST(11437.738663380349/8.0),
+ REAL_CONST(11451.529455311042/8.0),
+ REAL_CONST(11465.324400469679/8.0),
+ REAL_CONST(11479.123496356951/8.0),
+ REAL_CONST(11492.926740477304/8.0),
+ REAL_CONST(11506.734130338931/8.0),
+ REAL_CONST(11520.545663453764/8.0),
+ REAL_CONST(11534.361337337466/8.0),
+ REAL_CONST(11548.181149509423/8.0),
+ REAL_CONST(11562.005097492724/8.0),
+ REAL_CONST(11575.83317881417/8.0),
+ REAL_CONST(11589.665391004253/8.0),
+ REAL_CONST(11603.501731597149/8.0),
+ REAL_CONST(11617.342198130715/8.0),
+ REAL_CONST(11631.186788146468/8.0),
+ REAL_CONST(11645.035499189589/8.0),
+ REAL_CONST(11658.888328808911/8.0),
+ REAL_CONST(11672.745274556904/8.0),
+ REAL_CONST(11686.606333989675/8.0),
+ REAL_CONST(11700.471504666955/8.0),
+ REAL_CONST(11714.340784152086/8.0),
+ REAL_CONST(11728.214170012021/8.0),
+ REAL_CONST(11742.091659817312/8.0),
+ REAL_CONST(11755.973251142101/8.0),
+ REAL_CONST(11769.858941564111/8.0),
+ REAL_CONST(11783.748728664636/8.0),
+ REAL_CONST(11797.642610028539/8.0),
+ REAL_CONST(11811.540583244237/8.0),
+ REAL_CONST(11825.442645903697/8.0),
+ REAL_CONST(11839.34879560242/8.0),
+ REAL_CONST(11853.259029939445/8.0),
+ REAL_CONST(11867.173346517333/8.0),
+ REAL_CONST(11881.091742942155/8.0),
+ REAL_CONST(11895.014216823492/8.0),
+ REAL_CONST(11908.940765774427/8.0),
+ REAL_CONST(11922.871387411526/8.0),
+ REAL_CONST(11936.806079354839/8.0),
+ REAL_CONST(11950.744839227897/8.0),
+ REAL_CONST(11964.687664657684/8.0),
+ REAL_CONST(11978.634553274653/8.0),
+ REAL_CONST(11992.585502712702/8.0),
+ REAL_CONST(12006.540510609168/8.0),
+ REAL_CONST(12020.499574604828/8.0),
+ REAL_CONST(12034.462692343877/8.0),
+ REAL_CONST(12048.429861473938/8.0),
+ REAL_CONST(12062.401079646032/8.0),
+ REAL_CONST(12076.376344514589/8.0),
+ REAL_CONST(12090.355653737433/8.0),
+ REAL_CONST(12104.339004975769/8.0),
+ REAL_CONST(12118.326395894188/8.0),
+ REAL_CONST(12132.317824160644/8.0),
+ REAL_CONST(12146.313287446457/8.0),
+ REAL_CONST(12160.312783426305/8.0),
+ REAL_CONST(12174.316309778205/8.0),
+ REAL_CONST(12188.323864183525/8.0),
+ REAL_CONST(12202.335444326955/8.0),
+ REAL_CONST(12216.351047896511/8.0),
+ REAL_CONST(12230.370672583531/8.0),
+ REAL_CONST(12244.394316082657/8.0),
+ REAL_CONST(12258.421976091831/8.0),
+ REAL_CONST(12272.453650312296/8.0),
+ REAL_CONST(12286.489336448574/8.0),
+ REAL_CONST(12300.529032208471/8.0),
+ REAL_CONST(12314.572735303058/8.0),
+ REAL_CONST(12328.620443446678/8.0),
+ REAL_CONST(12342.672154356922/8.0),
+ REAL_CONST(12356.727865754638/8.0),
+ REAL_CONST(12370.787575363909/8.0),
+ REAL_CONST(12384.851280912055/8.0),
+ REAL_CONST(12398.918980129623/8.0),
+ REAL_CONST(12412.990670750381/8.0),
+ REAL_CONST(12427.066350511306/8.0),
+ REAL_CONST(12441.146017152583/8.0),
+ REAL_CONST(12455.229668417589/8.0),
+ REAL_CONST(12469.317302052901/8.0),
+ REAL_CONST(12483.40891580827/8.0),
+ REAL_CONST(12497.50450743663/8.0),
+ REAL_CONST(12511.604074694078/8.0),
+ REAL_CONST(12525.707615339878/8.0),
+ REAL_CONST(12539.815127136444/8.0),
+ REAL_CONST(12553.926607849342/8.0),
+ REAL_CONST(12568.042055247275/8.0),
+ REAL_CONST(12582.161467102082/8.0),
+ REAL_CONST(12596.284841188726/8.0),
+ REAL_CONST(12610.41217528529/8.0),
+ REAL_CONST(12624.543467172971/8.0),
+ REAL_CONST(12638.678714636069/8.0),
+ REAL_CONST(12652.817915461985/8.0),
+ REAL_CONST(12666.961067441209/8.0),
+ REAL_CONST(12681.108168367316/8.0),
+ REAL_CONST(12695.259216036962/8.0),
+ REAL_CONST(12709.414208249869/8.0),
+ REAL_CONST(12723.573142808827/8.0),
+ REAL_CONST(12737.736017519681/8.0),
+ REAL_CONST(12751.902830191326/8.0),
+ REAL_CONST(12766.073578635704/8.0),
+ REAL_CONST(12780.248260667788/8.0),
+ REAL_CONST(12794.426874105588/8.0),
+ REAL_CONST(12808.609416770132/8.0),
+ REAL_CONST(12822.795886485468/8.0),
+ REAL_CONST(12836.986281078653/8.0),
+ REAL_CONST(12851.180598379744/8.0),
+ REAL_CONST(12865.378836221802/8.0),
+ REAL_CONST(12879.580992440871/8.0),
+ REAL_CONST(12893.787064875984/8.0),
+ REAL_CONST(12907.997051369144/8.0),
+ REAL_CONST(12922.210949765335/8.0),
+ REAL_CONST(12936.428757912496/8.0),
+ REAL_CONST(12950.650473661524/8.0),
+ REAL_CONST(12964.876094866273/8.0),
+ REAL_CONST(12979.105619383534/8.0),
+ REAL_CONST(12993.339045073039/8.0),
+ REAL_CONST(13007.576369797454/8.0),
+ REAL_CONST(13021.817591422368/8.0),
+ REAL_CONST(13036.062707816285/8.0),
+ REAL_CONST(13050.311716850629/8.0),
+ REAL_CONST(13064.564616399723/8.0),
+ REAL_CONST(13078.821404340792/8.0),
+ REAL_CONST(13093.082078553954/8.0),
+ REAL_CONST(13107.346636922217/8.0),
+ REAL_CONST(13121.615077331464/8.0),
+ REAL_CONST(13135.887397670458/8.0),
+ REAL_CONST(13150.163595830827/8.0),
+ REAL_CONST(13164.44366970706/8.0),
+ REAL_CONST(13178.727617196502/8.0),
+ REAL_CONST(13193.015436199352/8.0),
+ REAL_CONST(13207.307124618648/8.0),
+ REAL_CONST(13221.602680360265/8.0),
+ REAL_CONST(13235.902101332911/8.0),
+ REAL_CONST(13250.205385448118/8.0),
+ REAL_CONST(13264.512530620239/8.0),
+ REAL_CONST(13278.823534766434/8.0),
+ REAL_CONST(13293.138395806676/8.0),
+ REAL_CONST(13307.457111663734/8.0),
+ REAL_CONST(13321.779680263176/8.0),
+ REAL_CONST(13336.106099533356/8.0),
+ REAL_CONST(13350.436367405409/8.0),
+ REAL_CONST(13364.77048181325/8.0),
+ REAL_CONST(13379.108440693562/8.0),
+ REAL_CONST(13393.450241985796/8.0),
+ REAL_CONST(13407.795883632158/8.0),
+ REAL_CONST(13422.145363577607/8.0),
+ REAL_CONST(13436.498679769853/8.0),
+ REAL_CONST(13450.855830159346/8.0),
+ REAL_CONST(13465.216812699266/8.0),
+ REAL_CONST(13479.581625345529/8.0),
+ REAL_CONST(13493.950266056772/8.0),
+ REAL_CONST(13508.32273279435/8.0),
+ REAL_CONST(13522.699023522329/8.0),
+ REAL_CONST(13537.079136207483/8.0),
+ REAL_CONST(13551.463068819286/8.0),
+ REAL_CONST(13565.850819329906/8.0),
+ REAL_CONST(13580.2423857142/8.0),
+ REAL_CONST(13594.63776594971/8.0),
+ REAL_CONST(13609.036958016657/8.0),
+ REAL_CONST(13623.439959897927/8.0),
+ REAL_CONST(13637.846769579081/8.0),
+ REAL_CONST(13652.257385048335/8.0),
+ REAL_CONST(13666.67180429656/8.0),
+ REAL_CONST(13681.090025317284/8.0),
+ REAL_CONST(13695.512046106669/8.0),
+ REAL_CONST(13709.937864663521/8.0),
+ REAL_CONST(13724.367478989278/8.0),
+ REAL_CONST(13738.800887088004/8.0),
+ REAL_CONST(13753.238086966385/8.0),
+ REAL_CONST(13767.679076633727/8.0),
+ REAL_CONST(13782.123854101939/8.0),
+ REAL_CONST(13796.572417385545/8.0),
+ REAL_CONST(13811.024764501659/8.0),
+ REAL_CONST(13825.480893469998/8.0),
+ REAL_CONST(13839.94080231286/8.0),
+ REAL_CONST(13854.404489055134/8.0),
+ REAL_CONST(13868.871951724283/8.0),
+ REAL_CONST(13883.34318835034/8.0),
+ REAL_CONST(13897.818196965914/8.0),
+ REAL_CONST(13912.296975606168/8.0),
+ REAL_CONST(13926.779522308825/8.0),
+ REAL_CONST(13941.26583511416/8.0),
+ REAL_CONST(13955.755912064991/8.0),
+ REAL_CONST(13970.249751206682/8.0),
+ REAL_CONST(13984.747350587126/8.0),
+ REAL_CONST(13999.248708256751/8.0),
+ REAL_CONST(14013.753822268511/8.0),
+ REAL_CONST(14028.262690677873/8.0),
+ REAL_CONST(14042.775311542828/8.0),
+ REAL_CONST(14057.291682923867/8.0),
+ REAL_CONST(14071.811802883994/8.0),
+ REAL_CONST(14086.335669488704/8.0),
+ REAL_CONST(14100.863280805994/8.0),
+ REAL_CONST(14115.394634906341/8.0),
+ REAL_CONST(14129.92972986271/8.0),
+ REAL_CONST(14144.468563750548/8.0),
+ REAL_CONST(14159.01113464777/8.0),
+ REAL_CONST(14173.55744063476/8.0),
+ REAL_CONST(14188.107479794369/8.0),
+ REAL_CONST(14202.661250211901/8.0),
+ REAL_CONST(14217.218749975118/8.0),
+ REAL_CONST(14231.779977174227/8.0),
+ REAL_CONST(14246.344929901879/8.0),
+ REAL_CONST(14260.913606253163/8.0),
+ REAL_CONST(14275.486004325601/8.0),
+ REAL_CONST(14290.062122219146/8.0),
+ REAL_CONST(14304.641958036171/8.0),
+ REAL_CONST(14319.225509881464/8.0),
+ REAL_CONST(14333.812775862236/8.0),
+ REAL_CONST(14348.403754088098/8.0),
+ REAL_CONST(14362.998442671067/8.0),
+ REAL_CONST(14377.59683972556/8.0),
+ REAL_CONST(14392.198943368388/8.0),
+ REAL_CONST(14406.804751718748/8.0),
+ REAL_CONST(14421.414262898223/8.0),
+ REAL_CONST(14436.027475030774/8.0),
+ REAL_CONST(14450.64438624274/8.0),
+ REAL_CONST(14465.264994662828/8.0),
+ REAL_CONST(14479.889298422106/8.0),
+ REAL_CONST(14494.517295654005/8.0),
+ REAL_CONST(14509.148984494313/8.0),
+ REAL_CONST(14523.784363081166/8.0),
+ REAL_CONST(14538.423429555049/8.0),
+ REAL_CONST(14553.066182058781/8.0),
+ REAL_CONST(14567.712618737527/8.0),
+ REAL_CONST(14582.362737738777/8.0),
+ REAL_CONST(14597.016537212348/8.0),
+ REAL_CONST(14611.674015310382/8.0),
+ REAL_CONST(14626.33517018734/8.0),
+ REAL_CONST(14640.999999999993/8.0),
+ REAL_CONST(14655.668502907418/8.0),
+ REAL_CONST(14670.340677071003/8.0),
+ REAL_CONST(14685.016520654426/8.0),
+ REAL_CONST(14699.696031823671/8.0),
+ REAL_CONST(14714.379208746999/8.0),
+ REAL_CONST(14729.066049594967/8.0),
+ REAL_CONST(14743.756552540408/8.0),
+ REAL_CONST(14758.45071575843/8.0),
+ REAL_CONST(14773.148537426418/8.0),
+ REAL_CONST(14787.850015724018/8.0),
+ REAL_CONST(14802.555148833142/8.0),
+ REAL_CONST(14817.263934937961/8.0),
+ REAL_CONST(14831.976372224897/8.0),
+ REAL_CONST(14846.692458882624/8.0),
+ REAL_CONST(14861.41219310206/8.0),
+ REAL_CONST(14876.135573076363/8.0),
+ REAL_CONST(14890.862597000923/8.0),
+ REAL_CONST(14905.593263073371/8.0),
+ REAL_CONST(14920.327569493558/8.0),
+ REAL_CONST(14935.065514463557/8.0),
+ REAL_CONST(14949.807096187662/8.0),
+ REAL_CONST(14964.552312872382/8.0),
+ REAL_CONST(14979.301162726431/8.0),
+ REAL_CONST(14994.053643960735/8.0),
+ REAL_CONST(15008.809754788414/8.0),
+ REAL_CONST(15023.569493424788/8.0),
+ REAL_CONST(15038.332858087369/8.0),
+ REAL_CONST(15053.099846995858/8.0),
+ REAL_CONST(15067.870458372134/8.0),
+ REAL_CONST(15082.644690440264/8.0),
+ REAL_CONST(15097.422541426484/8.0),
+ REAL_CONST(15112.204009559202/8.0),
+ REAL_CONST(15126.989093068994/8.0),
+ REAL_CONST(15141.777790188597/8.0),
+ REAL_CONST(15156.570099152905/8.0),
+ REAL_CONST(15171.366018198967/8.0),
+ REAL_CONST(15186.165545565986/8.0),
+ REAL_CONST(15200.968679495301/8.0),
+ REAL_CONST(15215.775418230402/8.0),
+ REAL_CONST(15230.585760016909/8.0),
+ REAL_CONST(15245.399703102579/8.0),
+ REAL_CONST(15260.217245737298/8.0),
+ REAL_CONST(15275.038386173073/8.0),
+ REAL_CONST(15289.863122664035/8.0),
+ REAL_CONST(15304.691453466432/8.0),
+ REAL_CONST(15319.523376838621/8.0),
+ REAL_CONST(15334.358891041069/8.0),
+ REAL_CONST(15349.197994336346/8.0),
+ REAL_CONST(15364.040684989128/8.0),
+ REAL_CONST(15378.886961266177/8.0),
+ REAL_CONST(15393.736821436356/8.0),
+ REAL_CONST(15408.590263770609/8.0),
+ REAL_CONST(15423.447286541972/8.0),
+ REAL_CONST(15438.307888025554/8.0),
+ REAL_CONST(15453.172066498542/8.0),
+ REAL_CONST(15468.039820240196/8.0),
+ REAL_CONST(15482.91114753184/8.0),
+ REAL_CONST(15497.786046656869/8.0),
+ REAL_CONST(15512.664515900733/8.0),
+ REAL_CONST(15527.546553550939/8.0),
+ REAL_CONST(15542.432157897045/8.0),
+ REAL_CONST(15557.32132723066/8.0),
+ REAL_CONST(15572.214059845435/8.0),
+ REAL_CONST(15587.110354037064/8.0),
+ REAL_CONST(15602.010208103273/8.0),
+ REAL_CONST(15616.913620343823/8.0),
+ REAL_CONST(15631.820589060506/8.0),
+ REAL_CONST(15646.731112557136/8.0),
+ REAL_CONST(15661.645189139546/8.0),
+ REAL_CONST(15676.562817115593/8.0),
+ REAL_CONST(15691.483994795139/8.0),
+ REAL_CONST(15706.408720490062/8.0),
+ REAL_CONST(15721.336992514242/8.0),
+ REAL_CONST(15736.268809183561/8.0),
+ REAL_CONST(15751.204168815901/8.0),
+ REAL_CONST(15766.143069731135/8.0),
+ REAL_CONST(15781.085510251132/8.0),
+ REAL_CONST(15796.03148869974/8.0),
+ REAL_CONST(15810.981003402798/8.0),
+ REAL_CONST(15825.934052688119/8.0),
+ REAL_CONST(15840.890634885489/8.0),
+ REAL_CONST(15855.850748326673/8.0),
+ REAL_CONST(15870.814391345401/8.0),
+ REAL_CONST(15885.781562277361/8.0),
+ REAL_CONST(15900.752259460214/8.0),
+ REAL_CONST(15915.726481233565/8.0),
+ REAL_CONST(15930.704225938984/8.0),
+ REAL_CONST(15945.685491919978/8.0),
+ REAL_CONST(15960.670277522009/8.0),
+ REAL_CONST(15975.658581092481/8.0),
+ REAL_CONST(15990.65040098073/8.0),
+ REAL_CONST(16005.645735538035/8.0),
+ REAL_CONST(16020.644583117599/8.0),
+ REAL_CONST(16035.646942074556/8.0),
+ REAL_CONST(16050.652810765967/8.0),
+ REAL_CONST(16065.662187550806/8.0),
+ REAL_CONST(16080.675070789974/8.0),
+ REAL_CONST(16095.691458846273/8.0),
+ REAL_CONST(16110.711350084424/8.0),
+ REAL_CONST(16125.734742871053/8.0),
+ REAL_CONST(16140.761635574685/8.0),
+ REAL_CONST(16155.792026565747/8.0),
+ REAL_CONST(16170.825914216561/8.0),
+ REAL_CONST(16185.863296901338/8.0),
+ REAL_CONST(16200.904172996183/8.0),
+ REAL_CONST(16215.948540879079/8.0),
+ REAL_CONST(16230.996398929899/8.0),
+ REAL_CONST(16246.047745530386/8.0),
+ REAL_CONST(16261.102579064163/8.0),
+ REAL_CONST(16276.160897916721/8.0),
+ REAL_CONST(16291.22270047542/8.0),
+ REAL_CONST(16306.287985129484/8.0),
+ REAL_CONST(16321.356750269995/8.0),
+ REAL_CONST(16336.428994289896/8.0),
+ REAL_CONST(16351.504715583982/8.0),
+ REAL_CONST(16366.5839125489/8.0),
+ REAL_CONST(16381.666583583141/8.0),
+ REAL_CONST(16396.752727087041/8.0),
+ REAL_CONST(16411.842341462776/8.0),
+ REAL_CONST(16426.935425114363/8.0),
+ REAL_CONST(16442.031976447644/8.0),
+ REAL_CONST(16457.131993870298/8.0),
+ REAL_CONST(16472.235475791829/8.0),
+ REAL_CONST(16487.342420623561/8.0),
+ REAL_CONST(16502.452826778641/8.0),
+ REAL_CONST(16517.566692672033/8.0),
+ REAL_CONST(16532.684016720516/8.0),
+ REAL_CONST(16547.804797342676/8.0),
+ REAL_CONST(16562.929032958902/8.0),
+ REAL_CONST(16578.056721991394/8.0),
+ REAL_CONST(16593.18786286415/8.0),
+ REAL_CONST(16608.322454002962/8.0),
+ REAL_CONST(16623.460493835417/8.0),
+ REAL_CONST(16638.601980790896/8.0),
+ REAL_CONST(16653.746913300558/8.0),
+ REAL_CONST(16668.895289797354/8.0),
+ REAL_CONST(16684.047108716015/8.0),
+ REAL_CONST(16699.202368493046/8.0),
+ REAL_CONST(16714.361067566726/8.0),
+ REAL_CONST(16729.523204377107/8.0),
+ REAL_CONST(16744.688777366009/8.0),
+ REAL_CONST(16759.857784977012/8.0),
+ REAL_CONST(16775.030225655464/8.0),
+ REAL_CONST(16790.206097848466/8.0),
+ REAL_CONST(16805.385400004874/8.0),
+ REAL_CONST(16820.568130575302/8.0),
+ REAL_CONST(16835.754288012104/8.0),
+ REAL_CONST(16850.943870769381/8.0),
+ REAL_CONST(16866.136877302983/8.0),
+ REAL_CONST(16881.333306070494/8.0),
+ REAL_CONST(16896.53315553123/8.0),
+ REAL_CONST(16911.736424146249/8.0),
+ REAL_CONST(16926.943110378332/8.0),
+ REAL_CONST(16942.153212691992/8.0),
+ REAL_CONST(16957.366729553454/8.0),
+ REAL_CONST(16972.583659430682/8.0),
+ REAL_CONST(16987.804000793338/8.0),
+ REAL_CONST(17003.027752112816/8.0),
+ REAL_CONST(17018.254911862205/8.0),
+ REAL_CONST(17033.485478516312/8.0),
+ REAL_CONST(17048.719450551645/8.0),
+ REAL_CONST(17063.956826446421/8.0),
+ REAL_CONST(17079.197604680547/8.0),
+ REAL_CONST(17094.44178373563/8.0),
+ REAL_CONST(17109.689362094967/8.0),
+ REAL_CONST(17124.940338243552/8.0),
+ REAL_CONST(17140.194710668064/8.0),
+ REAL_CONST(17155.452477856852/8.0),
+ REAL_CONST(17170.713638299967/8.0),
+ REAL_CONST(17185.978190489128/8.0),
+ REAL_CONST(17201.246132917724/8.0),
+ REAL_CONST(17216.517464080825/8.0),
+ REAL_CONST(17231.792182475165/8.0),
+ REAL_CONST(17247.070286599141/8.0),
+ REAL_CONST(17262.351774952826/8.0),
+ REAL_CONST(17277.636646037936/8.0),
+ REAL_CONST(17292.924898357855/8.0),
+ REAL_CONST(17308.216530417623/8.0),
+ REAL_CONST(17323.511540723921/8.0),
+ REAL_CONST(17338.809927785089/8.0),
+ REAL_CONST(17354.111690111105/8.0),
+ REAL_CONST(17369.416826213594/8.0),
+ REAL_CONST(17384.725334605821/8.0),
+ REAL_CONST(17400.037213802683/8.0),
+ REAL_CONST(17415.352462320716/8.0),
+ REAL_CONST(17430.67107867809/8.0),
+ REAL_CONST(17445.993061394587/8.0),
+ REAL_CONST(17461.318408991636/8.0),
+ REAL_CONST(17476.647119992274/8.0),
+ REAL_CONST(17491.979192921168/8.0),
+ REAL_CONST(17507.314626304586/8.0),
+ REAL_CONST(17522.653418670423/8.0),
+ REAL_CONST(17537.995568548187/8.0),
+ REAL_CONST(17553.341074468986/8.0),
+ REAL_CONST(17568.689934965536/8.0),
+ REAL_CONST(17584.042148572156/8.0),
+ REAL_CONST(17599.397713824768/8.0),
+ REAL_CONST(17614.75662926089/8.0),
+ REAL_CONST(17630.118893419625/8.0),
+ REAL_CONST(17645.484504841683/8.0),
+ REAL_CONST(17660.853462069354/8.0),
+ REAL_CONST(17676.225763646511/8.0),
+ REAL_CONST(17691.601408118619/8.0),
+ REAL_CONST(17706.980394032718/8.0),
+ REAL_CONST(17722.362719937424/8.0),
+ REAL_CONST(17737.748384382936/8.0),
+ REAL_CONST(17753.137385921014/8.0),
+ REAL_CONST(17768.529723104999/8.0),
+ REAL_CONST(17783.92539448979/8.0),
+ REAL_CONST(17799.324398631856/8.0),
+ REAL_CONST(17814.726734089225/8.0),
+ REAL_CONST(17830.13239942148/8.0),
+ REAL_CONST(17845.541393189767/8.0),
+ REAL_CONST(17860.95371395678/8.0),
+ REAL_CONST(17876.369360286772/8.0),
+ REAL_CONST(17891.788330745527/8.0),
+ REAL_CONST(17907.210623900395/8.0),
+ REAL_CONST(17922.636238320254/8.0),
+ REAL_CONST(17938.065172575527/8.0),
+ REAL_CONST(17953.497425238176/8.0),
+ REAL_CONST(17968.932994881692/8.0),
+ REAL_CONST(17984.371880081104/8.0),
+ REAL_CONST(17999.814079412972/8.0),
+ REAL_CONST(18015.259591455371/8.0),
+ REAL_CONST(18030.708414787914/8.0),
+ REAL_CONST(18046.160547991731/8.0),
+ REAL_CONST(18061.615989649465/8.0),
+ REAL_CONST(18077.074738345284/8.0),
+ REAL_CONST(18092.536792664861/8.0),
+ REAL_CONST(18108.002151195393/8.0),
+ REAL_CONST(18123.470812525571/8.0),
+ REAL_CONST(18138.942775245599/8.0),
+ REAL_CONST(18154.418037947191/8.0),
+ REAL_CONST(18169.896599223546/8.0),
+ REAL_CONST(18185.37845766938/8.0),
+ REAL_CONST(18200.863611880886/8.0),
+ REAL_CONST(18216.352060455767/8.0),
+ REAL_CONST(18231.843801993204/8.0),
+ REAL_CONST(18247.338835093873/8.0),
+ REAL_CONST(18262.837158359936/8.0),
+ REAL_CONST(18278.338770395032/8.0),
+ REAL_CONST(18293.84366980429/8.0),
+ REAL_CONST(18309.351855194309/8.0),
+ REAL_CONST(18324.863325173166/8.0),
+ REAL_CONST(18340.378078350412/8.0),
+ REAL_CONST(18355.896113337069/8.0),
+ REAL_CONST(18371.417428745623/8.0),
+ REAL_CONST(18386.942023190033/8.0),
+ REAL_CONST(18402.469895285718/8.0),
+ REAL_CONST(18418.00104364955/8.0),
+ REAL_CONST(18433.53546689987/8.0),
+ REAL_CONST(18449.073163656474/8.0),
+ REAL_CONST(18464.614132540602/8.0),
+ REAL_CONST(18480.158372174956/8.0),
+ REAL_CONST(18495.705881183676/8.0),
+ REAL_CONST(18511.256658192357/8.0),
+ REAL_CONST(18526.810701828035/8.0),
+ REAL_CONST(18542.368010719183/8.0),
+ REAL_CONST(18557.928583495715/8.0),
+ REAL_CONST(18573.492418788985/8.0),
+ REAL_CONST(18589.059515231773/8.0),
+ REAL_CONST(18604.629871458303/8.0),
+ REAL_CONST(18620.203486104212/8.0),
+ REAL_CONST(18635.78035780658/8.0),
+ REAL_CONST(18651.360485203899/8.0),
+ REAL_CONST(18666.943866936086/8.0),
+ REAL_CONST(18682.53050164448/8.0),
+ REAL_CONST(18698.120387971841/8.0),
+ REAL_CONST(18713.713524562332/8.0),
+ REAL_CONST(18729.30991006154/8.0),
+ REAL_CONST(18744.909543116457/8.0),
+ REAL_CONST(18760.512422375479/8.0),
+ REAL_CONST(18776.118546488418/8.0),
+ REAL_CONST(18791.727914106479/8.0),
+ REAL_CONST(18807.340523882274/8.0),
+ REAL_CONST(18822.95637446981/8.0),
+ REAL_CONST(18838.575464524489/8.0),
+ REAL_CONST(18854.197792703111/8.0),
+ REAL_CONST(18869.823357663863/8.0),
+ REAL_CONST(18885.452158066328/8.0),
+ REAL_CONST(18901.08419257147/8.0),
+ REAL_CONST(18916.719459841639/8.0),
+ REAL_CONST(18932.357958540564/8.0),
+ REAL_CONST(18947.999687333362/8.0),
+ REAL_CONST(18963.644644886521/8.0),
+ REAL_CONST(18979.292829867907/8.0),
+ REAL_CONST(18994.944240946759/8.0),
+ REAL_CONST(19010.598876793687/8.0),
+ REAL_CONST(19026.256736080668/8.0),
+ REAL_CONST(19041.917817481048/8.0),
+ REAL_CONST(19057.582119669532/8.0),
+ REAL_CONST(19073.2496413222/8.0),
+ REAL_CONST(19088.920381116473/8.0),
+ REAL_CONST(19104.594337731145/8.0),
+ REAL_CONST(19120.271509846356/8.0),
+ REAL_CONST(19135.951896143604/8.0),
+ REAL_CONST(19151.635495305738/8.0),
+ REAL_CONST(19167.322306016948/8.0),
+ REAL_CONST(19183.012326962784/8.0),
+ REAL_CONST(19198.705556830122/8.0),
+ REAL_CONST(19214.401994307198/8.0),
+ REAL_CONST(19230.101638083579/8.0),
+ REAL_CONST(19245.804486850167/8.0),
+ REAL_CONST(19261.510539299208/8.0),
+ REAL_CONST(19277.219794124274/8.0),
+ REAL_CONST(19292.932250020265/8.0),
+ REAL_CONST(19308.647905683421/8.0),
+ REAL_CONST(19324.366759811302/8.0),
+ REAL_CONST(19340.088811102793/8.0),
+ REAL_CONST(19355.8140582581/8.0),
+ REAL_CONST(19371.542499978754/8.0),
+ REAL_CONST(19387.2741349676/8.0),
+ REAL_CONST(19403.008961928797/8.0),
+ REAL_CONST(19418.746979567823/8.0),
+ REAL_CONST(19434.488186591469/8.0),
+ REAL_CONST(19450.232581707827/8.0),
+ REAL_CONST(19465.980163626304/8.0),
+ REAL_CONST(19481.730931057613/8.0),
+ REAL_CONST(19497.484882713761/8.0),
+ REAL_CONST(19513.242017308068/8.0),
+ REAL_CONST(19529.002333555141/8.0),
+ REAL_CONST(19544.765830170898/8.0),
+ REAL_CONST(19560.532505872539/8.0),
+ REAL_CONST(19576.302359378566/8.0),
+ REAL_CONST(19592.075389408761/8.0),
+ REAL_CONST(19607.851594684209/8.0),
+ REAL_CONST(19623.630973927269/8.0),
+ REAL_CONST(19639.41352586159/8.0),
+ REAL_CONST(19655.199249212103/8.0),
+ REAL_CONST(19670.988142705017/8.0),
+ REAL_CONST(19686.780205067826/8.0),
+ REAL_CONST(19702.575435029288/8.0),
+ REAL_CONST(19718.373831319448/8.0),
+ REAL_CONST(19734.175392669615/8.0),
+ REAL_CONST(19749.980117812371/8.0),
+ REAL_CONST(19765.788005481569/8.0),
+ REAL_CONST(19781.599054412323/8.0),
+ REAL_CONST(19797.413263341008/8.0),
+ REAL_CONST(19813.230631005274/8.0),
+ REAL_CONST(19829.051156144014/8.0),
+ REAL_CONST(19844.874837497395/8.0),
+ REAL_CONST(19860.701673806827/8.0),
+ REAL_CONST(19876.531663814985/8.0),
+ REAL_CONST(19892.364806265789/8.0),
+ REAL_CONST(19908.201099904403/8.0),
+ REAL_CONST(19924.040543477258/8.0),
+ REAL_CONST(19939.883135732012/8.0),
+ REAL_CONST(19955.728875417579/8.0),
+ REAL_CONST(19971.577761284105/8.0),
+ REAL_CONST(19987.429792082985/8.0),
+ REAL_CONST(20003.284966566847/8.0),
+ REAL_CONST(20019.14328348956/8.0),
+ REAL_CONST(20035.004741606219/8.0),
+ REAL_CONST(20050.869339673161/8.0),
+ REAL_CONST(20066.737076447946/8.0),
+ REAL_CONST(20082.607950689362/8.0),
+ REAL_CONST(20098.481961157428/8.0),
+ REAL_CONST(20114.359106613385/8.0),
+ REAL_CONST(20130.239385819699/8.0),
+ REAL_CONST(20146.122797540058/8.0),
+ REAL_CONST(20162.009340539353/8.0),
+ REAL_CONST(20177.899013583716/8.0),
+ REAL_CONST(20193.791815440476/8.0),
+ REAL_CONST(20209.687744878182/8.0),
+ REAL_CONST(20225.586800666591/8.0),
+ REAL_CONST(20241.488981576669/8.0),
+ REAL_CONST(20257.394286380597/8.0),
+ REAL_CONST(20273.302713851754/8.0),
+ REAL_CONST(20289.214262764715/8.0),
+ REAL_CONST(20305.128931895277/8.0),
+ REAL_CONST(20321.046720020415/8.0),
+ REAL_CONST(20336.967625918318/8.0),
+ REAL_CONST(20352.891648368361/8.0),
+ REAL_CONST(20368.818786151114/8.0),
+ REAL_CONST(20384.749038048347/8.0),
+ REAL_CONST(20400.682402843009/8.0),
+ REAL_CONST(20416.618879319249/8.0),
+ REAL_CONST(20432.558466262391/8.0),
+ REAL_CONST(20448.501162458953/8.0),
+ REAL_CONST(20464.446966696629/8.0),
+ REAL_CONST(20480.395877764302/8.0),
+ REAL_CONST(20496.347894452025/8.0),
+ REAL_CONST(20512.303015551031/8.0),
+ REAL_CONST(20528.261239853735/8.0),
+ REAL_CONST(20544.22256615372/8.0),
+ REAL_CONST(20560.186993245738/8.0),
+ REAL_CONST(20576.15451992572/8.0),
+ REAL_CONST(20592.125144990758/8.0),
+ REAL_CONST(20608.098867239107/8.0),
+ REAL_CONST(20624.075685470198/8.0),
+ REAL_CONST(20640.055598484618/8.0),
+ REAL_CONST(20656.038605084115/8.0),
+ REAL_CONST(20672.024704071595/8.0),
+ REAL_CONST(20688.013894251126/8.0),
+ REAL_CONST(20704.006174427926/8.0),
+ REAL_CONST(20720.001543408373/8.0),
+ REAL_CONST(20735.999999999989/8.0),
+ REAL_CONST(20752.001543011454/8.0),
+ REAL_CONST(20768.006171252597/8.0),
+ REAL_CONST(20784.013883534382/8.0),
+ REAL_CONST(20800.024678668931/8.0),
+ REAL_CONST(20816.038555469506/8.0),
+ REAL_CONST(20832.055512750507/8.0),
+ REAL_CONST(20848.075549327474/8.0),
+ REAL_CONST(20864.098664017085/8.0),
+ REAL_CONST(20880.124855637161/8.0),
+ REAL_CONST(20896.154123006647/8.0),
+ REAL_CONST(20912.186464945626/8.0),
+ REAL_CONST(20928.221880275312/8.0),
+ REAL_CONST(20944.260367818049/8.0),
+ REAL_CONST(20960.301926397311/8.0),
+ REAL_CONST(20976.346554837684/8.0),
+ REAL_CONST(20992.394251964895/8.0),
+ REAL_CONST(21008.445016605787/8.0),
+ REAL_CONST(21024.498847588318/8.0),
+ REAL_CONST(21040.555743741574/8.0),
+ REAL_CONST(21056.615703895754/8.0),
+ REAL_CONST(21072.678726882168/8.0),
+ REAL_CONST(21088.744811533252/8.0),
+ REAL_CONST(21104.813956682538/8.0),
+ REAL_CONST(21120.886161164683/8.0),
+ REAL_CONST(21136.961423815443/8.0),
+ REAL_CONST(21153.039743471683/8.0),
+ REAL_CONST(21169.121118971379/8.0),
+ REAL_CONST(21185.205549153605/8.0),
+ REAL_CONST(21201.293032858535/8.0),
+ REAL_CONST(21217.383568927453/8.0),
+ REAL_CONST(21233.477156202731/8.0),
+ REAL_CONST(21249.573793527841/8.0),
+ REAL_CONST(21265.673479747358/8.0),
+ REAL_CONST(21281.776213706937/8.0),
+ REAL_CONST(21297.881994253334/8.0),
+ REAL_CONST(21313.990820234398/8.0),
+ REAL_CONST(21330.102690499054/8.0),
+ REAL_CONST(21346.21760389733/8.0),
+ REAL_CONST(21362.335559280327/8.0),
+ REAL_CONST(21378.456555500241/8.0),
+ REAL_CONST(21394.580591410333/8.0),
+ REAL_CONST(21410.707665864964/8.0),
+ REAL_CONST(21426.83777771956/8.0),
+ REAL_CONST(21442.970925830628/8.0),
+ REAL_CONST(21459.107109055756/8.0),
+ REAL_CONST(21475.246326253604/8.0),
+ REAL_CONST(21491.388576283895/8.0),
+ REAL_CONST(21507.533858007431/8.0),
+ REAL_CONST(21523.682170286087/8.0),
+ REAL_CONST(21539.833511982797/8.0),
+ REAL_CONST(21555.987881961566/8.0),
+ REAL_CONST(21572.145279087465/8.0),
+ REAL_CONST(21588.305702226615/8.0),
+ REAL_CONST(21604.469150246216/8.0),
+ REAL_CONST(21620.635622014521/8.0),
+ REAL_CONST(21636.805116400832/8.0),
+ REAL_CONST(21652.977632275521/8.0),
+ REAL_CONST(21669.153168510009/8.0),
+ REAL_CONST(21685.331723976764/8.0),
+ REAL_CONST(21701.513297549318/8.0),
+ REAL_CONST(21717.697888102244/8.0),
+ REAL_CONST(21733.885494511167/8.0),
+ REAL_CONST(21750.076115652759/8.0),
+ REAL_CONST(21766.269750404736/8.0),
+ REAL_CONST(21782.466397645861/8.0),
+ REAL_CONST(21798.666056255934/8.0),
+ REAL_CONST(21814.868725115801/8.0),
+ REAL_CONST(21831.074403107345/8.0),
+ REAL_CONST(21847.283089113484/8.0),
+ REAL_CONST(21863.494782018177/8.0),
+ REAL_CONST(21879.709480706417/8.0),
+ REAL_CONST(21895.927184064229/8.0),
+ REAL_CONST(21912.147890978667/8.0),
+ REAL_CONST(21928.371600337818/8.0),
+ REAL_CONST(21944.598311030797/8.0),
+ REAL_CONST(21960.828021947746/8.0),
+ REAL_CONST(21977.060731979829/8.0),
+ REAL_CONST(21993.296440019243/8.0),
+ REAL_CONST(22009.535144959198/8.0),
+ REAL_CONST(22025.77684569393/8.0),
+ REAL_CONST(22042.021541118691/8.0),
+ REAL_CONST(22058.269230129757/8.0),
+ REAL_CONST(22074.519911624411/8.0),
+ REAL_CONST(22090.773584500959/8.0),
+ REAL_CONST(22107.030247658717/8.0),
+ REAL_CONST(22123.289899998013/8.0),
+ REAL_CONST(22139.552540420187/8.0),
+ REAL_CONST(22155.818167827587/8.0),
+ REAL_CONST(22172.086781123569/8.0),
+ REAL_CONST(22188.358379212495/8.0),
+ REAL_CONST(22204.632960999726/8.0),
+ REAL_CONST(22220.910525391639/8.0),
+ REAL_CONST(22237.191071295601/8.0),
+ REAL_CONST(22253.474597619981/8.0),
+ REAL_CONST(22269.761103274148/8.0),
+ REAL_CONST(22286.050587168469/8.0),
+ REAL_CONST(22302.343048214312/8.0),
+ REAL_CONST(22318.638485324027/8.0),
+ REAL_CONST(22334.936897410968/8.0),
+ REAL_CONST(22351.23828338947/8.0),
+ REAL_CONST(22367.542642174871/8.0),
+ REAL_CONST(22383.849972683485/8.0),
+ REAL_CONST(22400.160273832618/8.0),
+ REAL_CONST(22416.473544540564/8.0),
+ REAL_CONST(22432.789783726603/8.0),
+ REAL_CONST(22449.108990310986/8.0),
+ REAL_CONST(22465.431163214958/8.0),
+ REAL_CONST(22481.75630136074/8.0),
+ REAL_CONST(22498.084403671528/8.0),
+ REAL_CONST(22514.415469071497/8.0),
+ REAL_CONST(22530.749496485802/8.0),
+ REAL_CONST(22547.086484840562/8.0),
+ REAL_CONST(22563.426433062879/8.0),
+ REAL_CONST(22579.769340080824/8.0),
+ REAL_CONST(22596.115204823436/8.0),
+ REAL_CONST(22612.464026220721/8.0),
+ REAL_CONST(22628.815803203655/8.0),
+ REAL_CONST(22645.170534704179/8.0),
+ REAL_CONST(22661.5282196552/8.0),
+ REAL_CONST(22677.888856990587/8.0),
+ REAL_CONST(22694.252445645168/8.0),
+ REAL_CONST(22710.618984554734/8.0),
+ REAL_CONST(22726.988472656034/8.0),
+ REAL_CONST(22743.360908886778/8.0),
+ REAL_CONST(22759.736292185622/8.0),
+ REAL_CONST(22776.114621492186/8.0),
+ REAL_CONST(22792.495895747044/8.0),
+ REAL_CONST(22808.880113891719/8.0),
+ REAL_CONST(22825.267274868678/8.0),
+ REAL_CONST(22841.657377621348/8.0),
+ REAL_CONST(22858.050421094096/8.0),
+ REAL_CONST(22874.446404232243/8.0),
+ REAL_CONST(22890.845325982053/8.0),
+ REAL_CONST(22907.247185290722/8.0),
+ REAL_CONST(22923.651981106406/8.0),
+ REAL_CONST(22940.059712378195/8.0),
+ REAL_CONST(22956.470378056114/8.0),
+ REAL_CONST(22972.883977091129/8.0),
+ REAL_CONST(22989.300508435153/8.0),
+ REAL_CONST(23005.719971041017/8.0),
+ REAL_CONST(23022.142363862498/8.0),
+ REAL_CONST(23038.567685854305/8.0),
+ REAL_CONST(23054.995935972078/8.0),
+ REAL_CONST(23071.427113172387/8.0),
+ REAL_CONST(23087.86121641273/8.0),
+ REAL_CONST(23104.298244651531/8.0),
+ REAL_CONST(23120.738196848146/8.0),
+ REAL_CONST(23137.181071962848/8.0),
+ REAL_CONST(23153.626868956846/8.0),
+ REAL_CONST(23170.075586792263/8.0),
+ REAL_CONST(23186.527224432142/8.0),
+ REAL_CONST(23202.981780840448/8.0),
+ REAL_CONST(23219.439254982066/8.0),
+ REAL_CONST(23235.899645822796/8.0),
+ REAL_CONST(23252.362952329357/8.0),
+ REAL_CONST(23268.829173469378/8.0),
+ REAL_CONST(23285.298308211408/8.0),
+ REAL_CONST(23301.770355524899/8.0),
+ REAL_CONST(23318.245314380223/8.0),
+ REAL_CONST(23334.723183748658/8.0),
+ REAL_CONST(23351.203962602387/8.0),
+ REAL_CONST(23367.687649914504/8.0),
+ REAL_CONST(23384.174244659007/8.0),
+ REAL_CONST(23400.663745810798/8.0),
+ REAL_CONST(23417.15615234568/8.0),
+ REAL_CONST(23433.651463240367/8.0),
+ REAL_CONST(23450.149677472462/8.0),
+ REAL_CONST(23466.650794020472/8.0),
+ REAL_CONST(23483.154811863806/8.0),
+ REAL_CONST(23499.661729982763/8.0),
+ REAL_CONST(23516.171547358543/8.0),
+ REAL_CONST(23532.684262973235/8.0),
+ REAL_CONST(23549.199875809823/8.0),
+ REAL_CONST(23565.718384852185/8.0),
+ REAL_CONST(23582.239789085092/8.0),
+ REAL_CONST(23598.764087494197/8.0),
+ REAL_CONST(23615.291279066041/8.0),
+ REAL_CONST(23631.821362788058/8.0),
+ REAL_CONST(23648.354337648565/8.0),
+ REAL_CONST(23664.890202636761/8.0),
+ REAL_CONST(23681.428956742733/8.0),
+ REAL_CONST(23697.970598957443/8.0),
+ REAL_CONST(23714.515128272738/8.0),
+ REAL_CONST(23731.062543681343/8.0),
+ REAL_CONST(23747.612844176863/8.0),
+ REAL_CONST(23764.166028753778/8.0),
+ REAL_CONST(23780.72209640744/8.0),
+ REAL_CONST(23797.281046134085/8.0),
+ REAL_CONST(23813.842876930816/8.0),
+ REAL_CONST(23830.407587795606/8.0),
+ REAL_CONST(23846.975177727301/8.0),
+ REAL_CONST(23863.545645725622/8.0),
+ REAL_CONST(23880.11899079115/8.0),
+ REAL_CONST(23896.695211925336/8.0),
+ REAL_CONST(23913.274308130498/8.0),
+ REAL_CONST(23929.856278409821/8.0),
+ REAL_CONST(23946.441121767348/8.0),
+ REAL_CONST(23963.028837207989/8.0),
+ REAL_CONST(23979.619423737513/8.0),
+ REAL_CONST(23996.212880362549/8.0),
+ REAL_CONST(24012.809206090584/8.0),
+ REAL_CONST(24029.408399929966/8.0),
+ REAL_CONST(24046.010460889898/8.0),
+ REAL_CONST(24062.615387980433/8.0),
+ REAL_CONST(24079.223180212492/8.0),
+ REAL_CONST(24095.833836597827/8.0),
+ REAL_CONST(24112.447356149063/8.0),
+ REAL_CONST(24129.063737879667/8.0),
+ REAL_CONST(24145.682980803951/8.0),
+ REAL_CONST(24162.305083937081/8.0),
+ REAL_CONST(24178.930046295067/8.0),
+ REAL_CONST(24195.557866894767/8.0),
+ REAL_CONST(24212.188544753884/8.0),
+ REAL_CONST(24228.822078890964/8.0),
+ REAL_CONST(24245.458468325389/8.0),
+ REAL_CONST(24262.097712077397/8.0),
+ REAL_CONST(24278.739809168052/8.0),
+ REAL_CONST(24295.384758619261/8.0),
+ REAL_CONST(24312.032559453768/8.0),
+ REAL_CONST(24328.683210695162/8.0),
+ REAL_CONST(24345.336711367858/8.0),
+ REAL_CONST(24361.993060497109/8.0),
+ REAL_CONST(24378.652257108995/8.0),
+ REAL_CONST(24395.314300230442/8.0),
+ REAL_CONST(24411.979188889192/8.0),
+ REAL_CONST(24428.646922113825/8.0),
+ REAL_CONST(24445.317498933746/8.0),
+ REAL_CONST(24461.990918379193/8.0),
+ REAL_CONST(24478.667179481225/8.0),
+ REAL_CONST(24495.346281271726/8.0),
+ REAL_CONST(24512.028222783407/8.0),
+ REAL_CONST(24528.713003049801/8.0),
+ REAL_CONST(24545.400621105266/8.0),
+ REAL_CONST(24562.091075984976/8.0),
+ REAL_CONST(24578.784366724925/8.0),
+ REAL_CONST(24595.480492361927/8.0),
+ REAL_CONST(24612.179451933614/8.0),
+ REAL_CONST(24628.881244478438/8.0),
+ REAL_CONST(24645.585869035654/8.0),
+ REAL_CONST(24662.293324645343/8.0),
+ REAL_CONST(24679.003610348394/8.0),
+ REAL_CONST(24695.716725186514/8.0),
+ REAL_CONST(24712.432668202211/8.0),
+ REAL_CONST(24729.151438438807/8.0),
+ REAL_CONST(24745.873034940436/8.0),
+ REAL_CONST(24762.597456752032/8.0),
+ REAL_CONST(24779.324702919344/8.0),
+ REAL_CONST(24796.054772488926/8.0),
+ REAL_CONST(24812.787664508123/8.0),
+ REAL_CONST(24829.5233780251/8.0),
+ REAL_CONST(24846.261912088819/8.0),
+ REAL_CONST(24863.003265749034/8.0),
+ REAL_CONST(24879.747438056307/8.0),
+ REAL_CONST(24896.494428062004/8.0),
+ REAL_CONST(24913.244234818278/8.0),
+ REAL_CONST(24929.996857378079/8.0),
+ REAL_CONST(24946.752294795166/8.0),
+ REAL_CONST(24963.510546124078/8.0),
+ REAL_CONST(24980.271610420157/8.0),
+ REAL_CONST(24997.035486739525/8.0),
+ REAL_CONST(25013.802174139113/8.0),
+ REAL_CONST(25030.571671676629/8.0),
+ REAL_CONST(25047.343978410572/8.0),
+ REAL_CONST(25064.119093400237/8.0),
+ REAL_CONST(25080.897015705697/8.0),
+ REAL_CONST(25097.677744387816/8.0),
+ REAL_CONST(25114.461278508239/8.0),
+ REAL_CONST(25131.2476171294/8.0),
+ REAL_CONST(25148.036759314517/8.0),
+ REAL_CONST(25164.828704127583/8.0),
+ REAL_CONST(25181.623450633375/8.0),
+ REAL_CONST(25198.42099789745/8.0),
+ REAL_CONST(25215.221344986145/8.0),
+ REAL_CONST(25232.024490966574/8.0),
+ REAL_CONST(25248.830434906627/8.0),
+ REAL_CONST(25265.639175874974/8.0),
+ REAL_CONST(25282.450712941049/8.0),
+ REAL_CONST(25299.265045175071/8.0),
+ REAL_CONST(25316.082171648024/8.0),
+ REAL_CONST(25332.902091431668/8.0),
+ REAL_CONST(25349.724803598532/8.0),
+ REAL_CONST(25366.550307221914/8.0),
+ REAL_CONST(25383.378601375884/8.0),
+ REAL_CONST(25400.209685135269/8.0),
+ REAL_CONST(25417.043557575678/8.0),
+ REAL_CONST(25433.880217773472/8.0),
+ REAL_CONST(25450.719664805783/8.0),
+ REAL_CONST(25467.561897750507/8.0),
+ REAL_CONST(25484.406915686297/8.0),
+ REAL_CONST(25501.254717692573/8.0),
+ REAL_CONST(25518.105302849512/8.0),
+ REAL_CONST(25534.958670238051/8.0),
+ REAL_CONST(25551.814818939893/8.0),
+ REAL_CONST(25568.67374803748/8.0),
+ REAL_CONST(25585.535456614027/8.0),
+ REAL_CONST(25602.399943753502/8.0),
+ REAL_CONST(25619.267208540619/8.0),
+ REAL_CONST(25636.137250060852/8.0),
+ REAL_CONST(25653.010067400432/8.0),
+ REAL_CONST(25669.885659646327/8.0),
+ REAL_CONST(25686.76402588627/8.0),
+ REAL_CONST(25703.645165208734/8.0),
+ REAL_CONST(25720.529076702944/8.0),
+ REAL_CONST(25737.415759458876/8.0),
+ REAL_CONST(25754.305212567244/8.0),
+ REAL_CONST(25771.197435119517/8.0),
+ REAL_CONST(25788.092426207899/8.0),
+ REAL_CONST(25804.990184925344/8.0),
+ REAL_CONST(25821.890710365547/8.0),
+ REAL_CONST(25838.794001622944/8.0),
+ REAL_CONST(25855.700057792714/8.0),
+ REAL_CONST(25872.608877970775/8.0),
+ REAL_CONST(25889.520461253778/8.0),
+ REAL_CONST(25906.434806739118/8.0),
+ REAL_CONST(25923.351913524923/8.0),
+ REAL_CONST(25940.271780710063/8.0),
+ REAL_CONST(25957.194407394138/8.0),
+ REAL_CONST(25974.11979267748/8.0),
+ REAL_CONST(25991.047935661154/8.0),
+ REAL_CONST(26007.978835446964/8.0),
+ REAL_CONST(26024.912491137442/8.0),
+ REAL_CONST(26041.848901835841/8.0),
+ REAL_CONST(26058.788066646157/8.0),
+ REAL_CONST(26075.729984673108/8.0),
+ REAL_CONST(26092.674655022136/8.0),
+ REAL_CONST(26109.622076799409/8.0),
+ REAL_CONST(26126.572249111829/8.0),
+ REAL_CONST(26143.525171067016/8.0),
+ REAL_CONST(26160.480841773315/8.0),
+ REAL_CONST(26177.43926033979/8.0),
+ REAL_CONST(26194.400425876229/8.0),
+ REAL_CONST(26211.364337493149/8.0),
+ REAL_CONST(26228.330994301767/8.0),
+ REAL_CONST(26245.30039541404/8.0),
+ REAL_CONST(26262.272539942627/8.0),
+ REAL_CONST(26279.247427000919/8.0),
+ REAL_CONST(26296.225055703002/8.0),
+ REAL_CONST(26313.205425163702/8.0),
+ REAL_CONST(26330.188534498539/8.0),
+ REAL_CONST(26347.174382823756/8.0),
+ REAL_CONST(26364.162969256304/8.0),
+ REAL_CONST(26381.154292913852/8.0),
+ REAL_CONST(26398.148352914774/8.0),
+ REAL_CONST(26415.145148378149/8.0),
+ REAL_CONST(26432.144678423778/8.0),
+ REAL_CONST(26449.146942172156/8.0),
+ REAL_CONST(26466.151938744493/8.0),
+ REAL_CONST(26483.159667262702/8.0),
+ REAL_CONST(26500.170126849403/8.0),
+ REAL_CONST(26517.183316627921/8.0),
+ REAL_CONST(26534.199235722277/8.0),
+ REAL_CONST(26551.217883257199/8.0),
+ REAL_CONST(26568.239258358124/8.0),
+ REAL_CONST(26585.263360151173/8.0),
+ REAL_CONST(26602.290187763181/8.0),
+ REAL_CONST(26619.319740321676/8.0),
+ REAL_CONST(26636.352016954883/8.0),
+ REAL_CONST(26653.387016791727/8.0),
+ REAL_CONST(26670.424738961825/8.0),
+ REAL_CONST(26687.465182595493/8.0),
+ REAL_CONST(26704.508346823739/8.0),
+ REAL_CONST(26721.554230778267/8.0),
+ REAL_CONST(26738.602833591467/8.0),
+ REAL_CONST(26755.65415439643/8.0),
+ REAL_CONST(26772.708192326929/8.0),
+ REAL_CONST(26789.764946517433/8.0),
+ REAL_CONST(26806.824416103096/8.0),
+ REAL_CONST(26823.886600219761/8.0),
+ REAL_CONST(26840.95149800396/8.0),
+ REAL_CONST(26858.019108592915/8.0),
+ REAL_CONST(26875.089431124517/8.0),
+ REAL_CONST(26892.162464737365/8.0),
+ REAL_CONST(26909.238208570721/8.0),
+ REAL_CONST(26926.316661764544/8.0),
+ REAL_CONST(26943.397823459472/8.0),
+ REAL_CONST(26960.481692796813/8.0),
+ REAL_CONST(26977.568268918571/8.0),
+ REAL_CONST(26994.657550967422/8.0),
+ REAL_CONST(27011.749538086722/8.0),
+ REAL_CONST(27028.844229420498/8.0),
+ REAL_CONST(27045.941624113464/8.0),
+ REAL_CONST(27063.041721311005/8.0),
+ REAL_CONST(27080.144520159181/8.0),
+ REAL_CONST(27097.250019804727/8.0),
+ REAL_CONST(27114.35821939505/8.0),
+ REAL_CONST(27131.469118078236/8.0),
+ REAL_CONST(27148.582715003027/8.0),
+ REAL_CONST(27165.699009318858/8.0),
+ REAL_CONST(27182.818000175819/8.0),
+ REAL_CONST(27199.939686724665/8.0),
+ REAL_CONST(27217.064068116837/8.0),
+ REAL_CONST(27234.191143504428/8.0),
+ REAL_CONST(27251.320912040203/8.0),
+ REAL_CONST(27268.453372877593/8.0),
+ REAL_CONST(27285.588525170693/8.0),
+ REAL_CONST(27302.726368074269/8.0),
+ REAL_CONST(27319.866900743735/8.0),
+ REAL_CONST(27337.010122335181/8.0),
+ REAL_CONST(27354.156032005358/8.0),
+ REAL_CONST(27371.304628911668/8.0),
+ REAL_CONST(27388.455912212183/8.0),
+ REAL_CONST(27405.609881065626/8.0),
+ REAL_CONST(27422.766534631384/8.0),
+ REAL_CONST(27439.925872069507/8.0),
+ REAL_CONST(27457.087892540683/8.0),
+ REAL_CONST(27474.252595206275/8.0),
+ REAL_CONST(27491.419979228293/8.0),
+ REAL_CONST(27508.5900437694/8.0),
+ REAL_CONST(27525.762787992917/8.0),
+ REAL_CONST(27542.93821106281/8.0),
+ REAL_CONST(27560.116312143706/8.0),
+ REAL_CONST(27577.297090400876/8.0),
+ REAL_CONST(27594.480545000242/8.0),
+ REAL_CONST(27611.666675108383/8.0),
+ REAL_CONST(27628.855479892518/8.0),
+ REAL_CONST(27646.046958520514/8.0),
+ REAL_CONST(27663.241110160889/8.0),
+ REAL_CONST(27680.437933982801/8.0),
+ REAL_CONST(27697.637429156068/8.0),
+ REAL_CONST(27714.839594851132/8.0),
+ REAL_CONST(27732.04443023909/8.0),
+ REAL_CONST(27749.251934491687/8.0),
+ REAL_CONST(27766.462106781299/8.0),
+ REAL_CONST(27783.674946280949/8.0),
+ REAL_CONST(27800.890452164302/8.0),
+ REAL_CONST(27818.108623605654/8.0),
+ REAL_CONST(27835.329459779954/8.0),
+ REAL_CONST(27852.55295986278/8.0),
+ REAL_CONST(27869.779123030345/8.0),
+ REAL_CONST(27887.007948459504/8.0),
+ REAL_CONST(27904.239435327745/8.0),
+ REAL_CONST(27921.473582813196/8.0),
+ REAL_CONST(27938.710390094613/8.0),
+ REAL_CONST(27955.949856351392/8.0),
+ REAL_CONST(27973.19198076355/8.0),
+ REAL_CONST(27990.436762511745/8.0),
+ REAL_CONST(28007.684200777272/8.0),
+ REAL_CONST(28024.934294742041/8.0),
+ REAL_CONST(28042.187043588601/8.0),
+ REAL_CONST(28059.442446500128/8.0),
+ REAL_CONST(28076.700502660427/8.0),
+ REAL_CONST(28093.961211253929/8.0),
+ REAL_CONST(28111.224571465693/8.0),
+ REAL_CONST(28128.490582481401/8.0),
+ REAL_CONST(28145.759243487362/8.0),
+ REAL_CONST(28163.030553670509/8.0),
+ REAL_CONST(28180.304512218394/8.0),
+ REAL_CONST(28197.581118319198/8.0),
+ REAL_CONST(28214.860371161725/8.0),
+ REAL_CONST(28232.14226993539/8.0),
+ REAL_CONST(28249.42681383024/8.0),
+ REAL_CONST(28266.71400203693/8.0),
+ REAL_CONST(28284.003833746745/8.0),
+ REAL_CONST(28301.296308151585/8.0),
+ REAL_CONST(28318.591424443959/8.0),
+ REAL_CONST(28335.889181817001/8.0),
+ REAL_CONST(28353.189579464462/8.0),
+ REAL_CONST(28370.492616580705/8.0),
+ REAL_CONST(28387.798292360701/8.0),
+ REAL_CONST(28405.106606000048/8.0),
+ REAL_CONST(28422.417556694945/8.0),
+ REAL_CONST(28439.731143642206/8.0),
+ REAL_CONST(28457.047366039264/8.0),
+ REAL_CONST(28474.366223084147/8.0),
+ REAL_CONST(28491.687713975512/8.0),
+ REAL_CONST(28509.011837912611/8.0),
+ REAL_CONST(28526.338594095305/8.0),
+ REAL_CONST(28543.667981724069/8.0),
+ REAL_CONST(28560.999999999982/8.0),
+ REAL_CONST(28578.334648124732/8.0),
+ REAL_CONST(28595.671925300605/8.0),
+ REAL_CONST(28613.011830730498/8.0),
+ REAL_CONST(28630.354363617909/8.0),
+ REAL_CONST(28647.699523166943/8.0),
+ REAL_CONST(28665.0473085823/8.0),
+ REAL_CONST(28682.397719069289/8.0),
+ REAL_CONST(28699.750753833818/8.0),
+ REAL_CONST(28717.10641208239/8.0),
+ REAL_CONST(28734.464693022121/8.0),
+ REAL_CONST(28751.825595860708/8.0),
+ REAL_CONST(28769.189119806462/8.0),
+ REAL_CONST(28786.55526406828/8.0),
+ REAL_CONST(28803.924027855664/8.0),
+ REAL_CONST(28821.295410378701/8.0),
+ REAL_CONST(28838.669410848088/8.0),
+ REAL_CONST(28856.046028475103/8.0),
+ REAL_CONST(28873.425262471628/8.0),
+ REAL_CONST(28890.80711205013/8.0),
+ REAL_CONST(28908.191576423673/8.0),
+ REAL_CONST(28925.578654805915/8.0),
+ REAL_CONST(28942.968346411097/8.0),
+ REAL_CONST(28960.360650454055/8.0),
+ REAL_CONST(28977.755566150216/8.0),
+ REAL_CONST(28995.153092715591/8.0),
+ REAL_CONST(29012.553229366786/8.0),
+ REAL_CONST(29029.955975320987/8.0),
+ REAL_CONST(29047.361329795975/8.0),
+ REAL_CONST(29064.769292010107/8.0),
+ REAL_CONST(29082.179861182336/8.0),
+ REAL_CONST(29099.593036532187/8.0),
+ REAL_CONST(29117.00881727978/8.0),
+ REAL_CONST(29134.427202645813/8.0),
+ REAL_CONST(29151.848191851568/8.0),
+ REAL_CONST(29169.271784118911/8.0),
+ REAL_CONST(29186.697978670283/8.0),
+ REAL_CONST(29204.126774728706/8.0),
+ REAL_CONST(29221.55817151779/8.0),
+ REAL_CONST(29238.992168261717/8.0),
+ REAL_CONST(29256.42876418525/8.0),
+ REAL_CONST(29273.867958513725/8.0),
+ REAL_CONST(29291.309750473058/8.0),
+ REAL_CONST(29308.754139289747/8.0),
+ REAL_CONST(29326.201124190855/8.0),
+ REAL_CONST(29343.65070440403/8.0),
+ REAL_CONST(29361.102879157483/8.0),
+ REAL_CONST(29378.557647680012/8.0),
+ REAL_CONST(29396.015009200975/8.0),
+ REAL_CONST(29413.474962950309/8.0),
+ REAL_CONST(29430.937508158524/8.0),
+ REAL_CONST(29448.402644056692/8.0),
+ REAL_CONST(29465.870369876469/8.0),
+ REAL_CONST(29483.340684850071/8.0),
+ REAL_CONST(29500.81358821028/8.0),
+ REAL_CONST(29518.289079190454/8.0),
+ REAL_CONST(29535.767157024511/8.0),
+ REAL_CONST(29553.247820946945/8.0),
+ REAL_CONST(29570.731070192807/8.0),
+ REAL_CONST(29588.216903997723/8.0),
+ REAL_CONST(29605.70532159787/8.0),
+ REAL_CONST(29623.19632223/8.0),
+ REAL_CONST(29640.689905131429/8.0),
+ REAL_CONST(29658.186069540028/8.0),
+ REAL_CONST(29675.684814694236/8.0),
+ REAL_CONST(29693.186139833047/8.0),
+ REAL_CONST(29710.690044196028/8.0),
+ REAL_CONST(29728.196527023298/8.0),
+ REAL_CONST(29745.705587555527/8.0),
+ REAL_CONST(29763.217225033964/8.0),
+ REAL_CONST(29780.731438700397/8.0),
+ REAL_CONST(29798.248227797183/8.0),
+ REAL_CONST(29815.76759156723/8.0),
+ REAL_CONST(29833.289529254005/8.0),
+ REAL_CONST(29850.81404010153/8.0),
+ REAL_CONST(29868.341123354381/8.0),
+ REAL_CONST(29885.870778257693/8.0),
+ REAL_CONST(29903.403004057145/8.0),
+ REAL_CONST(29920.937799998974/8.0),
+ REAL_CONST(29938.475165329975/8.0),
+ REAL_CONST(29956.015099297485/8.0),
+ REAL_CONST(29973.557601149394/8.0),
+ REAL_CONST(29991.102670134147/8.0),
+ REAL_CONST(30008.650305500738/8.0),
+ REAL_CONST(30026.200506498706/8.0),
+ REAL_CONST(30043.753272378144/8.0),
+ REAL_CONST(30061.308602389683/8.0),
+ REAL_CONST(30078.866495784507/8.0),
+ REAL_CONST(30096.426951814352/8.0),
+ REAL_CONST(30113.989969731494/8.0),
+ REAL_CONST(30131.55554878875/8.0),
+ REAL_CONST(30149.123688239491/8.0),
+ REAL_CONST(30166.694387337629/8.0),
+ REAL_CONST(30184.267645337608/8.0),
+ REAL_CONST(30201.843461494434/8.0),
+ REAL_CONST(30219.42183506364/8.0),
+ REAL_CONST(30237.002765301309/8.0),
+ REAL_CONST(30254.586251464058/8.0),
+ REAL_CONST(30272.172292809046/8.0),
+ REAL_CONST(30289.760888593977/8.0),
+ REAL_CONST(30307.35203807709/8.0),
+ REAL_CONST(30324.94574051716/8.0),
+ REAL_CONST(30342.541995173502/8.0),
+ REAL_CONST(30360.140801305966/8.0),
+ REAL_CONST(30377.742158174944/8.0),
+ REAL_CONST(30395.346065041358/8.0),
+ REAL_CONST(30412.952521166666/8.0),
+ REAL_CONST(30430.561525812864/8.0),
+ REAL_CONST(30448.173078242475/8.0),
+ REAL_CONST(30465.787177718561/8.0),
+ REAL_CONST(30483.403823504719/8.0),
+ REAL_CONST(30501.02301486507/8.0),
+ REAL_CONST(30518.644751064272/8.0),
+ REAL_CONST(30536.269031367516/8.0),
+ REAL_CONST(30553.895855040515/8.0),
+ REAL_CONST(30571.525221349519/8.0),
+ REAL_CONST(30589.157129561307/8.0),
+ REAL_CONST(30606.791578943175/8.0),
+ REAL_CONST(30624.428568762964/8.0),
+ REAL_CONST(30642.06809828903/8.0),
+ REAL_CONST(30659.710166790261/8.0),
+ REAL_CONST(30677.35477353607/8.0),
+ REAL_CONST(30695.001917796391/8.0),
+ REAL_CONST(30712.651598841687/8.0),
+ REAL_CONST(30730.303815942945/8.0),
+ REAL_CONST(30747.958568371676/8.0),
+ REAL_CONST(30765.615855399912/8.0),
+ REAL_CONST(30783.275676300211/8.0),
+ REAL_CONST(30800.938030345646/8.0),
+ REAL_CONST(30818.602916809814/8.0),
+ REAL_CONST(30836.270334966837/8.0),
+ REAL_CONST(30853.940284091354/8.0),
+ REAL_CONST(30871.612763458521/8.0),
+ REAL_CONST(30889.287772344011/8.0),
+ REAL_CONST(30906.965310024025/8.0),
+ REAL_CONST(30924.645375775272/8.0),
+ REAL_CONST(30942.327968874983/8.0),
+ REAL_CONST(30960.013088600903/8.0),
+ REAL_CONST(30977.700734231294/8.0),
+ REAL_CONST(30995.390905044929/8.0),
+ REAL_CONST(31013.083600321101/8.0),
+ REAL_CONST(31030.778819339619/8.0),
+ REAL_CONST(31048.476561380798/8.0),
+ REAL_CONST(31066.17682572547/8.0),
+ REAL_CONST(31083.879611654978/8.0),
+ REAL_CONST(31101.584918451179/8.0),
+ REAL_CONST(31119.29274539644/8.0),
+ REAL_CONST(31137.003091773637/8.0),
+ REAL_CONST(31154.715956866155/8.0),
+ REAL_CONST(31172.431339957893/8.0),
+ REAL_CONST(31190.14924033326/8.0),
+ REAL_CONST(31207.869657277162/8.0),
+ REAL_CONST(31225.592590075023/8.0),
+ REAL_CONST(31243.318038012771/8.0),
+ REAL_CONST(31261.046000376838/8.0),
+ REAL_CONST(31278.776476454172/8.0),
+ REAL_CONST(31296.50946553221/8.0),
+ REAL_CONST(31314.24496689891/8.0),
+ REAL_CONST(31331.98297984272/8.0),
+ REAL_CONST(31349.7235036526/8.0),
+ REAL_CONST(31367.466537618013/8.0),
+ REAL_CONST(31385.212081028923/8.0),
+ REAL_CONST(31402.960133175795/8.0),
+ REAL_CONST(31420.710693349596/8.0),
+ REAL_CONST(31438.463760841791/8.0),
+ REAL_CONST(31456.219334944351/8.0),
+ REAL_CONST(31473.977414949743/8.0),
+ REAL_CONST(31491.738000150934/8.0),
+ REAL_CONST(31509.501089841389/8.0),
+ REAL_CONST(31527.266683315069/8.0),
+ REAL_CONST(31545.034779866437/8.0),
+ REAL_CONST(31562.80537879045/8.0),
+ REAL_CONST(31580.578479382562/8.0),
+ REAL_CONST(31598.35408093872/8.0),
+ REAL_CONST(31616.132182755369/8.0),
+ REAL_CONST(31633.91278412945/8.0),
+ REAL_CONST(31651.695884358396/8.0),
+ REAL_CONST(31669.481482740131/8.0),
+ REAL_CONST(31687.269578573076/8.0),
+ REAL_CONST(31705.060171156143/8.0),
+ REAL_CONST(31722.853259788735/8.0),
+ REAL_CONST(31740.648843770748/8.0),
+ REAL_CONST(31758.446922402567/8.0),
+ REAL_CONST(31776.247494985066/8.0),
+ REAL_CONST(31794.050560819614/8.0),
+ REAL_CONST(31811.85611920806/8.0),
+ REAL_CONST(31829.664169452753/8.0),
+ REAL_CONST(31847.474710856521/8.0),
+ REAL_CONST(31865.287742722685/8.0),
+ REAL_CONST(31883.103264355046/8.0),
+ REAL_CONST(31900.921275057899/8.0),
+ REAL_CONST(31918.741774136019/8.0),
+ REAL_CONST(31936.564760894671/8.0),
+ REAL_CONST(31954.390234639599/8.0),
+ REAL_CONST(31972.21819467704/8.0),
+ REAL_CONST(31990.048640313704/8.0),
+ REAL_CONST(32007.881570856793/8.0),
+ REAL_CONST(32025.716985613984/8.0),
+ REAL_CONST(32043.554883893445/8.0),
+ REAL_CONST(32061.395265003815/8.0),
+ REAL_CONST(32079.238128254223/8.0),
+ REAL_CONST(32097.083472954269/8.0),
+ REAL_CONST(32114.931298414049/8.0),
+ REAL_CONST(32132.781603944117/8.0),
+ REAL_CONST(32150.634388855524/8.0),
+ REAL_CONST(32168.48965245979/8.0),
+ REAL_CONST(32186.347394068915/8.0),
+ REAL_CONST(32204.207612995371/8.0),
+ REAL_CONST(32222.07030855212/8.0),
+ REAL_CONST(32239.935480052583/8.0),
+ REAL_CONST(32257.803126810672/8.0),
+ REAL_CONST(32275.673248140767/8.0),
+ REAL_CONST(32293.545843357719/8.0),
+ REAL_CONST(32311.420911776862/8.0),
+ REAL_CONST(32329.298452713996/8.0),
+ REAL_CONST(32347.178465485395/8.0),
+ REAL_CONST(32365.060949407813/8.0),
+ REAL_CONST(32382.945903798463/8.0),
+ REAL_CONST(32400.83332797504/8.0),
+ REAL_CONST(32418.723221255706/8.0),
+ REAL_CONST(32436.615582959093/8.0),
+ REAL_CONST(32454.510412404306/8.0),
+ REAL_CONST(32472.407708910916/8.0),
+ REAL_CONST(32490.307471798966/8.0),
+ REAL_CONST(32508.209700388961/8.0),
+ REAL_CONST(32526.114394001877/8.0),
+ REAL_CONST(32544.021551959166/8.0),
+ REAL_CONST(32561.931173582732/8.0),
+ REAL_CONST(32579.843258194956/8.0),
+ REAL_CONST(32597.757805118679/8.0),
+ REAL_CONST(32615.674813677211/8.0),
+ REAL_CONST(32633.594283194328/8.0),
+ REAL_CONST(32651.516212994258/8.0),
+ REAL_CONST(32669.440602401712/8.0),
+ REAL_CONST(32687.367450741847/8.0),
+ REAL_CONST(32705.296757340297/8.0),
+ REAL_CONST(32723.228521523146/8.0),
+ REAL_CONST(32741.162742616943/8.0),
+ REAL_CONST(32759.099419948703/8.0),
+ REAL_CONST(32777.038552845901/8.0),
+ REAL_CONST(32794.980140636464/8.0),
+ REAL_CONST(32812.924182648792/8.0),
+ REAL_CONST(32830.87067821173/8.0),
+ REAL_CONST(32848.819626654593/8.0),
+ REAL_CONST(32866.77102730715/8.0),
+ REAL_CONST(32884.724879499619/8.0),
+ REAL_CONST(32902.681182562686/8.0),
+ REAL_CONST(32920.639935827494/8.0),
+ REAL_CONST(32938.601138625643/8.0),
+ REAL_CONST(32956.56479028918/8.0),
+ REAL_CONST(32974.530890150607/8.0),
+ REAL_CONST(32992.499437542894/8.0),
+ REAL_CONST(33010.470431799447/8.0),
+ REAL_CONST(33028.443872254145/8.0),
+ REAL_CONST(33046.419758241311/8.0),
+ REAL_CONST(33064.39808909571/8.0),
+ REAL_CONST(33082.378864152583/8.0),
+ REAL_CONST(33100.36208274759/8.0),
+ REAL_CONST(33118.347744216881/8.0),
+ REAL_CONST(33136.335847897026/8.0),
+ REAL_CONST(33154.326393125062/8.0),
+ REAL_CONST(33172.31937923847/8.0),
+ REAL_CONST(33190.314805575174/8.0),
+ REAL_CONST(33208.312671473555/8.0),
+ REAL_CONST(33226.312976272442/8.0),
+ REAL_CONST(33244.315719311111/8.0),
+ REAL_CONST(33262.320899929284/8.0),
+ REAL_CONST(33280.328517467125/8.0),
+ REAL_CONST(33298.33857126526/8.0),
+ REAL_CONST(33316.351060664747/8.0),
+ REAL_CONST(33334.365985007091/8.0),
+ REAL_CONST(33352.383343634239/8.0),
+ REAL_CONST(33370.403135888591/8.0),
+ REAL_CONST(33388.42536111299/8.0),
+ REAL_CONST(33406.450018650721/8.0),
+ REAL_CONST(33424.477107845501/8.0),
+ REAL_CONST(33442.506628041512/8.0),
+ REAL_CONST(33460.53857858335/8.0),
+ REAL_CONST(33478.572958816083/8.0),
+ REAL_CONST(33496.609768085189/8.0),
+ REAL_CONST(33514.649005736617/8.0),
+ REAL_CONST(33532.690671116739/8.0),
+ REAL_CONST(33550.734763572356/8.0),
+ REAL_CONST(33568.781282450735/8.0),
+ REAL_CONST(33586.830227099563/8.0),
+ REAL_CONST(33604.881596866973/8.0),
+ REAL_CONST(33622.935391101528/8.0),
+ REAL_CONST(33640.991609152239/8.0),
+ REAL_CONST(33659.050250368542/8.0),
+ REAL_CONST(33677.111314100322/8.0),
+ REAL_CONST(33695.174799697881/8.0),
+ REAL_CONST(33713.240706511984/8.0),
+ REAL_CONST(33731.309033893805/8.0),
+ REAL_CONST(33749.37978119497/8.0),
+ REAL_CONST(33767.452947767531/8.0),
+ REAL_CONST(33785.528532963974/8.0),
+ REAL_CONST(33803.606536137209/8.0),
+ REAL_CONST(33821.686956640602/8.0),
+ REAL_CONST(33839.769793827938/8.0),
+ REAL_CONST(33857.855047053425/8.0),
+ REAL_CONST(33875.942715671707/8.0),
+ REAL_CONST(33894.032799037872/8.0),
+ REAL_CONST(33912.125296507431/8.0),
+ REAL_CONST(33930.220207436316/8.0),
+ REAL_CONST(33948.317531180888/8.0),
+ REAL_CONST(33966.417267097961/8.0),
+ REAL_CONST(33984.519414544746/8.0),
+ REAL_CONST(34002.623972878901/8.0),
+ REAL_CONST(34020.730941458511/8.0),
+ REAL_CONST(34038.840319642077/8.0),
+ REAL_CONST(34056.952106788536/8.0),
+ REAL_CONST(34075.066302257255/8.0),
+ REAL_CONST(34093.182905408015/8.0),
+ REAL_CONST(34111.301915601027/8.0),
+ REAL_CONST(34129.42333219693/8.0),
+ REAL_CONST(34147.547154556785/8.0),
+ REAL_CONST(34165.673382042078/8.0),
+ REAL_CONST(34183.80201401472/8.0),
+ REAL_CONST(34201.933049837033/8.0),
+ REAL_CONST(34220.06648887178/8.0),
+ REAL_CONST(34238.202330482141/8.0),
+ REAL_CONST(34256.340574031703/8.0),
+ REAL_CONST(34274.481218884495/8.0),
+ REAL_CONST(34292.624264404949/8.0),
+ REAL_CONST(34310.769709957938/8.0),
+ REAL_CONST(34328.91755490873/8.0),
+ REAL_CONST(34347.067798623029/8.0),
+ REAL_CONST(34365.220440466954/8.0),
+ REAL_CONST(34383.375479807051/8.0),
+ REAL_CONST(34401.532916010263/8.0),
+ REAL_CONST(34419.692748443973/8.0),
+ REAL_CONST(34437.854976475966/8.0),
+ REAL_CONST(34456.01959947445/8.0),
+ REAL_CONST(34474.18661680806/8.0),
+ REAL_CONST(34492.356027845817/8.0),
+ REAL_CONST(34510.527831957188/8.0),
+ REAL_CONST(34528.702028512052/8.0),
+ REAL_CONST(34546.878616880676/8.0),
+ REAL_CONST(34565.05759643377/8.0),
+ REAL_CONST(34583.238966542449/8.0),
+ REAL_CONST(34601.422726578232/8.0),
+ REAL_CONST(34619.608875913065/8.0),
+ REAL_CONST(34637.797413919296/8.0),
+ REAL_CONST(34655.988339969692/8.0),
+ REAL_CONST(34674.181653437423/8.0),
+ REAL_CONST(34692.37735369608/8.0),
+ REAL_CONST(34710.575440119668/8.0),
+ REAL_CONST(34728.775912082579/8.0),
+ REAL_CONST(34746.978768959649/8.0),
+ REAL_CONST(34765.184010126082/8.0),
+ REAL_CONST(34783.391634957537/8.0),
+ REAL_CONST(34801.60164283005/8.0),
+ REAL_CONST(34819.814033120063/8.0),
+ REAL_CONST(34838.028805204456/8.0),
+ REAL_CONST(34856.24595846048/8.0),
+ REAL_CONST(34874.465492265823/8.0),
+ REAL_CONST(34892.687405998557/8.0),
+ REAL_CONST(34910.911699037177/8.0),
+ REAL_CONST(34929.138370760564/8.0),
+ REAL_CONST(34947.367420548027/8.0),
+ REAL_CONST(34965.598847779271/8.0),
+ REAL_CONST(34983.832651834389/8.0),
+ REAL_CONST(35002.068832093908/8.0),
+ REAL_CONST(35020.307387938738/8.0),
+ REAL_CONST(35038.548318750189/8.0),
+ REAL_CONST(35056.79162390998/8.0),
+ REAL_CONST(35075.03730280025/8.0),
+ REAL_CONST(35093.285354803513/8.0),
+ REAL_CONST(35111.535779302685/8.0),
+ REAL_CONST(35129.788575681116/8.0),
+ REAL_CONST(35148.043743322516/8.0),
+ REAL_CONST(35166.301281611013/8.0),
+ REAL_CONST(35184.561189931141/8.0),
+ REAL_CONST(35202.823467667826/8.0),
+ REAL_CONST(35221.088114206388/8.0),
+ REAL_CONST(35239.355128932555/8.0),
+ REAL_CONST(35257.624511232447/8.0),
+ REAL_CONST(35275.896260492584/8.0),
+ REAL_CONST(35294.170376099886/8.0),
+ REAL_CONST(35312.446857441668/8.0),
+ REAL_CONST(35330.725703905628/8.0),
+ REAL_CONST(35349.006914879887/8.0),
+ REAL_CONST(35367.290489752944/8.0),
+ REAL_CONST(35385.576427913686/8.0),
+ REAL_CONST(35403.864728751418/8.0),
+ REAL_CONST(35422.155391655811/8.0),
+ REAL_CONST(35440.448416016967/8.0),
+ REAL_CONST(35458.743801225341/8.0),
+ REAL_CONST(35477.041546671804/8.0),
+ REAL_CONST(35495.341651747622/8.0),
+ REAL_CONST(35513.644115844436/8.0),
+ REAL_CONST(35531.948938354304/8.0),
+ REAL_CONST(35550.256118669655/8.0),
+ REAL_CONST(35568.565656183309/8.0),
+ REAL_CONST(35586.877550288496/8.0),
+ REAL_CONST(35605.191800378816/8.0),
+ REAL_CONST(35623.508405848268/8.0),
+ REAL_CONST(35641.827366091238/8.0),
+ REAL_CONST(35660.148680502505/8.0),
+ REAL_CONST(35678.472348477233/8.0),
+ REAL_CONST(35696.798369410979/8.0),
+ REAL_CONST(35715.126742699678/8.0),
+ REAL_CONST(35733.457467739659/8.0),
+ REAL_CONST(35751.790543927644/8.0),
+ REAL_CONST(35770.125970660738/8.0),
+ REAL_CONST(35788.46374733642/8.0),
+ REAL_CONST(35806.803873352568/8.0),
+ REAL_CONST(35825.146348107453/8.0),
+ REAL_CONST(35843.49117099971/8.0),
+ REAL_CONST(35861.838341428367/8.0),
+ REAL_CONST(35880.187858792851/8.0),
+ REAL_CONST(35898.539722492955/8.0),
+ REAL_CONST(35916.893931928862/8.0),
+ REAL_CONST(35935.250486501129/8.0),
+ REAL_CONST(35953.609385610718/8.0),
+ REAL_CONST(35971.970628658957/8.0),
+ REAL_CONST(35990.334215047558/8.0),
+ REAL_CONST(36008.700144178612/8.0),
+ REAL_CONST(36027.068415454596/8.0),
+ REAL_CONST(36045.439028278372/8.0),
+ REAL_CONST(36063.811982053165/8.0),
+ REAL_CONST(36082.187276182609/8.0),
+ REAL_CONST(36100.564910070694/8.0),
+ REAL_CONST(36118.944883121789/8.0),
+ REAL_CONST(36137.327194740654/8.0),
+ REAL_CONST(36155.711844332429/8.0),
+ REAL_CONST(36174.098831302617/8.0),
+ REAL_CONST(36192.488155057115/8.0),
+ REAL_CONST(36210.87981500219/8.0),
+ REAL_CONST(36229.273810544473/8.0),
+ REAL_CONST(36247.670141091003/8.0),
+ REAL_CONST(36266.068806049167/8.0),
+ REAL_CONST(36284.469804826738/8.0),
+ REAL_CONST(36302.873136831862/8.0),
+ REAL_CONST(36321.278801473069/8.0),
+ REAL_CONST(36339.686798159251/8.0),
+ REAL_CONST(36358.097126299683/8.0),
+ REAL_CONST(36376.509785304013/8.0),
+ REAL_CONST(36394.924774582258/8.0),
+ REAL_CONST(36413.342093544816/8.0),
+ REAL_CONST(36431.761741602444/8.0),
+ REAL_CONST(36450.183718166292/8.0),
+ REAL_CONST(36468.608022647859/8.0),
+ REAL_CONST(36487.034654459028/8.0),
+ REAL_CONST(36505.463613012063/8.0),
+ REAL_CONST(36523.894897719583/8.0),
+ REAL_CONST(36542.328507994578/8.0),
+ REAL_CONST(36560.764443250409/8.0),
+ REAL_CONST(36579.202702900831/8.0),
+ REAL_CONST(36597.643286359926/8.0),
+ REAL_CONST(36616.086193042182/8.0),
+ REAL_CONST(36634.531422362437/8.0),
+ REAL_CONST(36652.978973735895/8.0),
+ REAL_CONST(36671.428846578143/8.0),
+ REAL_CONST(36689.881040305125/8.0),
+ REAL_CONST(36708.335554333149/8.0),
+ REAL_CONST(36726.792388078902/8.0),
+ REAL_CONST(36745.251540959427/8.0),
+ REAL_CONST(36763.713012392138/8.0),
+ REAL_CONST(36782.176801794812/8.0),
+ REAL_CONST(36800.642908585593/8.0),
+ REAL_CONST(36819.111332182983/8.0),
+ REAL_CONST(36837.582072005869/8.0),
+ REAL_CONST(36856.055127473483/8.0),
+ REAL_CONST(36874.530498005421/8.0),
+ REAL_CONST(36893.008183021651/8.0),
+ REAL_CONST(36911.488181942506/8.0),
+ REAL_CONST(36929.970494188674/8.0),
+ REAL_CONST(36948.455119181206/8.0),
+ REAL_CONST(36966.942056341519/8.0),
+ REAL_CONST(36985.431305091392/8.0),
+ REAL_CONST(37003.922864852961/8.0),
+ REAL_CONST(37022.416735048733/8.0),
+ REAL_CONST(37040.912915101559/8.0),
+ REAL_CONST(37059.411404434657/8.0),
+ REAL_CONST(37077.91220247162/8.0),
+ REAL_CONST(37096.415308636388/8.0),
+ REAL_CONST(37114.920722353243/8.0),
+ REAL_CONST(37133.428443046862/8.0),
+ REAL_CONST(37151.938470142253/8.0),
+ REAL_CONST(37170.450803064785/8.0),
+ REAL_CONST(37188.965441240209/8.0),
+ REAL_CONST(37207.482384094597/8.0),
+ REAL_CONST(37226.001631054402/8.0),
+ REAL_CONST(37244.523181546429/8.0),
+ REAL_CONST(37263.047034997842/8.0),
+ REAL_CONST(37281.573190836149/8.0),
+ REAL_CONST(37300.101648489224/8.0),
+ REAL_CONST(37318.632407385296/8.0),
+ REAL_CONST(37337.165466952945/8.0),
+ REAL_CONST(37355.700826621112/8.0),
+ REAL_CONST(37374.238485819085/8.0),
+ REAL_CONST(37392.778443976509/8.0),
+ REAL_CONST(37411.320700523385/8.0),
+ REAL_CONST(37429.865254890057/8.0),
+ REAL_CONST(37448.412106507232/8.0),
+ REAL_CONST(37466.961254805974/8.0),
+ REAL_CONST(37485.512699217681/8.0),
+ REAL_CONST(37504.066439174116/8.0),
+ REAL_CONST(37522.622474107404/8.0),
+ REAL_CONST(37541.180803449992/8.0),
+ REAL_CONST(37559.741426634704/8.0),
+ REAL_CONST(37578.304343094693/8.0),
+ REAL_CONST(37596.869552263488/8.0),
+ REAL_CONST(37615.43705357494/8.0),
+ REAL_CONST(37634.006846463279/8.0),
+ REAL_CONST(37652.578930363044/8.0),
+ REAL_CONST(37671.153304709165/8.0),
+ REAL_CONST(37689.729968936896/8.0),
+ REAL_CONST(37708.308922481847/8.0),
+ REAL_CONST(37726.890164779965/8.0),
+ REAL_CONST(37745.473695267559/8.0),
+ REAL_CONST(37764.059513381275/8.0),
+ REAL_CONST(37782.647618558112/8.0),
+ REAL_CONST(37801.238010235415/8.0),
+ REAL_CONST(37819.830687850859/8.0),
+ REAL_CONST(37838.425650842495/8.0),
+ REAL_CONST(37857.022898648691/8.0),
+ REAL_CONST(37875.622430708172/8.0),
+ REAL_CONST(37894.224246460013/8.0),
+ REAL_CONST(37912.828345343616/8.0),
+ REAL_CONST(37931.434726798747/8.0),
+ REAL_CONST(37950.043390265506/8.0),
+ REAL_CONST(37968.654335184328/8.0),
+ REAL_CONST(37987.267560995999/8.0),
+ REAL_CONST(38005.883067141665/8.0),
+ REAL_CONST(38024.500853062775/8.0),
+ REAL_CONST(38043.120918201159/8.0),
+ REAL_CONST(38061.743261998963/8.0),
+ REAL_CONST(38080.367883898682/8.0),
+ REAL_CONST(38098.994783343158/8.0),
+ REAL_CONST(38117.623959775563/8.0),
+ REAL_CONST(38136.255412639417/8.0),
+ REAL_CONST(38154.889141378575/8.0),
+ REAL_CONST(38173.525145437234/8.0),
+ REAL_CONST(38192.163424259939/8.0),
+ REAL_CONST(38210.803977291551/8.0),
+ REAL_CONST(38229.446803977284/8.0),
+ REAL_CONST(38248.091903762703/8.0),
+ REAL_CONST(38266.739276093685/8.0),
+ REAL_CONST(38285.388920416466/8.0),
+ REAL_CONST(38304.040836177606/8.0),
+ REAL_CONST(38322.695022824002/8.0),
+ REAL_CONST(38341.351479802899/8.0),
+ REAL_CONST(38360.010206561863/8.0),
+ REAL_CONST(38378.671202548816/8.0),
+ REAL_CONST(38397.334467211993/8.0),
+ REAL_CONST(38415.999999999978/8.0),
+ REAL_CONST(38434.667800361683/8.0),
+ REAL_CONST(38453.33786774637/8.0),
+ REAL_CONST(38472.010201603611/8.0),
+ REAL_CONST(38490.684801383337/8.0),
+ REAL_CONST(38509.361666535784/8.0),
+ REAL_CONST(38528.040796511552/8.0),
+ REAL_CONST(38546.722190761553/8.0),
+ REAL_CONST(38565.405848737035/8.0),
+ REAL_CONST(38584.091769889594/8.0),
+ REAL_CONST(38602.779953671132/8.0),
+ REAL_CONST(38621.470399533908/8.0),
+ REAL_CONST(38640.163106930493/8.0),
+ REAL_CONST(38658.858075313794/8.0),
+ REAL_CONST(38677.555304137059/8.0),
+ REAL_CONST(38696.254792853862/8.0),
+ REAL_CONST(38714.956540918094/8.0),
+ REAL_CONST(38733.660547783991/8.0),
+ REAL_CONST(38752.366812906112/8.0),
+ REAL_CONST(38771.075335739348/8.0),
+ REAL_CONST(38789.78611573892/8.0),
+ REAL_CONST(38808.499152360368/8.0),
+ REAL_CONST(38827.214445059573/8.0),
+ REAL_CONST(38845.931993292739/8.0),
+ REAL_CONST(38864.651796516388/8.0),
+ REAL_CONST(38883.373854187383/8.0),
+ REAL_CONST(38902.098165762916/8.0),
+ REAL_CONST(38920.824730700486/8.0),
+ REAL_CONST(38939.553548457938/8.0),
+ REAL_CONST(38958.284618493431/8.0),
+ REAL_CONST(38977.017940265461/8.0),
+ REAL_CONST(38995.753513232834/8.0),
+ REAL_CONST(39014.491336854699/8.0),
+ REAL_CONST(39033.231410590517/8.0),
+ REAL_CONST(39051.973733900079/8.0),
+ REAL_CONST(39070.718306243485/8.0),
+ REAL_CONST(39089.465127081188/8.0),
+ REAL_CONST(39108.214195873945/8.0),
+ REAL_CONST(39126.965512082832/8.0),
+ REAL_CONST(39145.719075169261/8.0),
+ REAL_CONST(39164.474884594965/8.0),
+ REAL_CONST(39183.232939821988/8.0),
+ REAL_CONST(39201.99324031271/8.0),
+ REAL_CONST(39220.755785529815/8.0),
+ REAL_CONST(39239.52057493633/8.0),
+ REAL_CONST(39258.287607995589/8.0),
+ REAL_CONST(39277.056884171245/8.0),
+ REAL_CONST(39295.828402927284/8.0),
+ REAL_CONST(39314.602163728006/8.0),
+ REAL_CONST(39333.378166038019/8.0),
+ REAL_CONST(39352.15640932227/8.0),
+ REAL_CONST(39370.936893046004/8.0),
+ REAL_CONST(39389.719616674811/8.0),
+ REAL_CONST(39408.504579674584/8.0),
+ REAL_CONST(39427.291781511522/8.0),
+ REAL_CONST(39446.081221652174/8.0),
+ REAL_CONST(39464.872899563372/8.0),
+ REAL_CONST(39483.666814712291/8.0),
+ REAL_CONST(39502.462966566411/8.0),
+ REAL_CONST(39521.261354593538/8.0),
+ REAL_CONST(39540.06197826178/8.0),
+ REAL_CONST(39558.864837039568/8.0),
+ REAL_CONST(39577.669930395656/8.0),
+ REAL_CONST(39596.47725779911/8.0),
+ REAL_CONST(39615.286818719302/8.0),
+ REAL_CONST(39634.098612625923/8.0),
+ REAL_CONST(39652.912638988993/8.0),
+ REAL_CONST(39671.728897278823/8.0),
+ REAL_CONST(39690.547386966064/8.0),
+ REAL_CONST(39709.368107521652/8.0),
+ REAL_CONST(39728.191058416858/8.0),
+ REAL_CONST(39747.016239123259/8.0),
+ REAL_CONST(39765.84364911275/8.0),
+ REAL_CONST(39784.673287857528/8.0),
+ REAL_CONST(39803.505154830105/8.0),
+ REAL_CONST(39822.339249503319/8.0),
+ REAL_CONST(39841.175571350293/8.0),
+ REAL_CONST(39860.014119844491/8.0),
+ REAL_CONST(39878.854894459677/8.0),
+ REAL_CONST(39897.697894669909/8.0),
+ REAL_CONST(39916.54311994958/8.0),
+ REAL_CONST(39935.390569773372/8.0),
+ REAL_CONST(39954.240243616303/8.0),
+ REAL_CONST(39973.092140953675/8.0),
+ REAL_CONST(39991.946261261117/8.0),
+ REAL_CONST(40010.802604014549/8.0),
+ REAL_CONST(40029.661168690225/8.0),
+ REAL_CONST(40048.521954764678/8.0),
+ REAL_CONST(40067.384961714779/8.0),
+ REAL_CONST(40086.250189017679/8.0),
+ REAL_CONST(40105.117636150855/8.0),
+ REAL_CONST(40123.98730259209/8.0),
+ REAL_CONST(40142.859187819471/8.0),
+ REAL_CONST(40161.733291311379/8.0),
+ REAL_CONST(40180.609612546526/8.0),
+ REAL_CONST(40199.488151003912/8.0),
+ REAL_CONST(40218.368906162854/8.0),
+ REAL_CONST(40237.25187750296/8.0),
+ REAL_CONST(40256.137064504153/8.0),
+ REAL_CONST(40275.024466646668/8.0),
+ REAL_CONST(40293.914083411029/8.0),
+ REAL_CONST(40312.805914278084/8.0),
+ REAL_CONST(40331.699958728961/8.0),
+ REAL_CONST(40350.596216245103/8.0),
+ REAL_CONST(40369.494686308273/8.0),
+ REAL_CONST(40388.39536840051/8.0),
+ REAL_CONST(40407.298262004173/8.0),
+ REAL_CONST(40426.20336660192/8.0),
+ REAL_CONST(40445.110681676706/8.0),
+ REAL_CONST(40464.020206711793/8.0),
+ REAL_CONST(40482.931941190756/8.0),
+ REAL_CONST(40501.845884597446/8.0),
+ REAL_CONST(40520.762036416032/8.0),
+ REAL_CONST(40539.680396130985/8.0),
+ REAL_CONST(40558.600963227072/8.0),
+ REAL_CONST(40577.523737189367/8.0),
+ REAL_CONST(40596.448717503234/8.0),
+ REAL_CONST(40615.375903654342/8.0),
+ REAL_CONST(40634.305295128659/8.0),
+ REAL_CONST(40653.236891412453/8.0),
+ REAL_CONST(40672.170691992294/8.0),
+ REAL_CONST(40691.106696355047/8.0),
+ REAL_CONST(40710.044903987873/8.0),
+ REAL_CONST(40728.985314378238/8.0),
+ REAL_CONST(40747.927927013901/8.0),
+ REAL_CONST(40766.872741382918/8.0),
+ REAL_CONST(40785.819756973651/8.0),
+ REAL_CONST(40804.768973274746/8.0),
+ REAL_CONST(40823.720389775161/8.0),
+ REAL_CONST(40842.674005964131/8.0),
+ REAL_CONST(40861.629821331211/8.0),
+ REAL_CONST(40880.587835366234/8.0),
+ REAL_CONST(40899.548047559321/8.0),
+ REAL_CONST(40918.510457400931/8.0),
+ REAL_CONST(40937.475064381761/8.0),
+ REAL_CONST(40956.441867992849/8.0),
+ REAL_CONST(40975.410867725499/8.0),
+ REAL_CONST(40994.382063071331/8.0),
+ REAL_CONST(41013.355453522236/8.0),
+ REAL_CONST(41032.331038570417/8.0),
+ REAL_CONST(41051.308817708363/8.0),
+ REAL_CONST(41070.288790428858/8.0),
+ REAL_CONST(41089.270956224987/8.0),
+ REAL_CONST(41108.255314590111/8.0),
+ REAL_CONST(41127.241865017888/8.0),
+ REAL_CONST(41146.23060700229/8.0),
+ REAL_CONST(41165.221540037543/8.0),
+ REAL_CONST(41184.214663618193/8.0),
+ REAL_CONST(41203.209977239079/8.0),
+ REAL_CONST(41222.207480395307/8.0),
+ REAL_CONST(41241.207172582297/8.0),
+ REAL_CONST(41260.209053295752/8.0),
+ REAL_CONST(41279.213122031659/8.0),
+ REAL_CONST(41298.219378286303/8.0),
+ REAL_CONST(41317.227821556255/8.0),
+ REAL_CONST(41336.23845133838/8.0),
+ REAL_CONST(41355.251267129832/8.0),
+ REAL_CONST(41374.266268428037/8.0),
+ REAL_CONST(41393.283454730743/8.0),
+ REAL_CONST(41412.302825535953/8.0),
+ REAL_CONST(41431.324380341983/8.0),
+ REAL_CONST(41450.348118647416/8.0),
+ REAL_CONST(41469.374039951144/8.0),
+ REAL_CONST(41488.402143752326/8.0),
+ REAL_CONST(41507.432429550427/8.0),
+ REAL_CONST(41526.464896845187/8.0),
+ REAL_CONST(41545.499545136627/8.0),
+ REAL_CONST(41564.536373925075/8.0),
+ REAL_CONST(41583.575382711126/8.0),
+ REAL_CONST(41602.616570995662/8.0),
+ REAL_CONST(41621.659938279874/8.0),
+ REAL_CONST(41640.705484065205/8.0),
+ REAL_CONST(41659.753207853406/8.0),
+ REAL_CONST(41678.803109146495/8.0),
+ REAL_CONST(41697.855187446803/8.0),
+ REAL_CONST(41716.909442256911/8.0),
+ REAL_CONST(41735.965873079709/8.0),
+ REAL_CONST(41755.02447941836/8.0),
+ REAL_CONST(41774.085260776315/8.0),
+ REAL_CONST(41793.148216657297/8.0),
+ REAL_CONST(41812.213346565331/8.0),
+ REAL_CONST(41831.280650004708/8.0),
+ REAL_CONST(41850.350126480014/8.0),
+ REAL_CONST(41869.421775496106/8.0),
+ REAL_CONST(41888.495596558132/8.0),
+ REAL_CONST(41907.571589171515/8.0),
+ REAL_CONST(41926.649752841957/8.0),
+ REAL_CONST(41945.730087075463/8.0),
+ REAL_CONST(41964.812591378286/8.0),
+ REAL_CONST(41983.897265256979/8.0),
+ REAL_CONST(42002.984108218378/8.0),
+ REAL_CONST(42022.073119769593/8.0),
+ REAL_CONST(42041.164299418015/8.0),
+ REAL_CONST(42060.257646671307/8.0),
+ REAL_CONST(42079.353161037419/8.0),
+ REAL_CONST(42098.450842024591/8.0),
+ REAL_CONST(42117.550689141324/8.0),
+ REAL_CONST(42136.652701896404/8.0),
+ REAL_CONST(42155.756879798893/8.0),
+ REAL_CONST(42174.863222358137/8.0),
+ REAL_CONST(42193.971729083758/8.0),
+ REAL_CONST(42213.082399485655/8.0),
+ REAL_CONST(42232.195233074002/8.0),
+ REAL_CONST(42251.310229359246/8.0),
+ REAL_CONST(42270.427387852127/8.0),
+ REAL_CONST(42289.546708063644/8.0),
+ REAL_CONST(42308.668189505079/8.0),
+ REAL_CONST(42327.791831687995/8.0),
+ REAL_CONST(42346.917634124227/8.0),
+ REAL_CONST(42366.045596325886/8.0),
+ REAL_CONST(42385.175717805352/8.0),
+ REAL_CONST(42404.307998075295/8.0),
+ REAL_CONST(42423.442436648642/8.0),
+ REAL_CONST(42442.579033038608/8.0),
+ REAL_CONST(42461.717786758672/8.0),
+ REAL_CONST(42480.858697322597/8.0),
+ REAL_CONST(42500.001764244422/8.0),
+ REAL_CONST(42519.146987038446/8.0),
+ REAL_CONST(42538.294365219248/8.0),
+ REAL_CONST(42557.443898301688/8.0),
+ REAL_CONST(42576.595585800882/8.0),
+ REAL_CONST(42595.749427232236/8.0),
+ REAL_CONST(42614.90542211142/8.0),
+ REAL_CONST(42634.063569954378/8.0),
+ REAL_CONST(42653.223870277317/8.0),
+ REAL_CONST(42672.386322596729/8.0),
+ REAL_CONST(42691.55092642938/8.0),
+ REAL_CONST(42710.717681292292/8.0),
+ REAL_CONST(42729.886586702756/8.0),
+ REAL_CONST(42749.057642178363/8.0),
+ REAL_CONST(42768.23084723694/8.0),
+ REAL_CONST(42787.406201396603/8.0),
+ REAL_CONST(42806.58370417574/8.0),
+ REAL_CONST(42825.76335509299/8.0),
+ REAL_CONST(42844.945153667286/8.0),
+ REAL_CONST(42864.129099417805/8.0),
+ REAL_CONST(42883.315191864014/8.0),
+ REAL_CONST(42902.503430525649/8.0),
+ REAL_CONST(42921.693814922692/8.0),
+ REAL_CONST(42940.88634457541/8.0),
+ REAL_CONST(42960.081019004348/8.0),
+ REAL_CONST(42979.277837730297/8.0),
+ REAL_CONST(42998.476800274322/8.0),
+ REAL_CONST(43017.677906157769/8.0),
+ REAL_CONST(43036.881154902228/8.0),
+ REAL_CONST(43056.086546029583/8.0),
+ REAL_CONST(43075.294079061961/8.0),
+ REAL_CONST(43094.503753521763/8.0),
+ REAL_CONST(43113.715568931671/8.0),
+ REAL_CONST(43132.929524814601/8.0),
+ REAL_CONST(43152.145620693766/8.0),
+ REAL_CONST(43171.363856092619/8.0),
+ REAL_CONST(43190.584230534907/8.0),
+ REAL_CONST(43209.806743544621/8.0),
+ REAL_CONST(43229.031394646016/8.0),
+ REAL_CONST(43248.258183363621/8.0),
+ REAL_CONST(43267.487109222224/8.0),
+ REAL_CONST(43286.718171746885/8.0),
+ REAL_CONST(43305.951370462906/8.0),
+ REAL_CONST(43325.186704895881/8.0),
+ REAL_CONST(43344.42417457165/8.0),
+ REAL_CONST(43363.663779016322/8.0),
+ REAL_CONST(43382.905517756262/8.0),
+ REAL_CONST(43402.149390318104/8.0),
+ REAL_CONST(43421.395396228749/8.0),
+ REAL_CONST(43440.643535015348/8.0),
+ REAL_CONST(43459.89380620532/8.0),
+ REAL_CONST(43479.146209326354/8.0),
+ REAL_CONST(43498.400743906379/8.0),
+ REAL_CONST(43517.657409473606/8.0),
+ REAL_CONST(43536.916205556496/8.0),
+ REAL_CONST(43556.177131683784/8.0),
+ REAL_CONST(43575.44018738444/8.0),
+ REAL_CONST(43594.705372187724/8.0),
+ REAL_CONST(43613.972685623135/8.0),
+ REAL_CONST(43633.242127220445/8.0),
+ REAL_CONST(43652.513696509668/8.0),
+ REAL_CONST(43671.787393021099/8.0),
+ REAL_CONST(43691.063216285271/8.0),
+ REAL_CONST(43710.341165833001/8.0),
+ REAL_CONST(43729.621241195346/8.0),
+ REAL_CONST(43748.903441903625/8.0),
+ REAL_CONST(43768.187767489413/8.0),
+ REAL_CONST(43787.474217484552/8.0),
+ REAL_CONST(43806.762791421126/8.0),
+ REAL_CONST(43826.053488831501/8.0),
+ REAL_CONST(43845.346309248278/8.0),
+ REAL_CONST(43864.641252204325/8.0),
+ REAL_CONST(43883.938317232765/8.0),
+ REAL_CONST(43903.237503866971/8.0),
+ REAL_CONST(43922.538811640596/8.0),
+ REAL_CONST(43941.842240087513/8.0),
+ REAL_CONST(43961.147788741881/8.0),
+ REAL_CONST(43980.455457138101/8.0),
+ REAL_CONST(43999.765244810835/8.0),
+ REAL_CONST(44019.077151295001/8.0),
+ REAL_CONST(44038.391176125755/8.0),
+ REAL_CONST(44057.70731883854/8.0),
+ REAL_CONST(44077.02557896902/8.0),
+ REAL_CONST(44096.345956053141/8.0),
+ REAL_CONST(44115.668449627083/8.0),
+ REAL_CONST(44134.993059227287/8.0),
+ REAL_CONST(44154.319784390456/8.0),
+ REAL_CONST(44173.648624653535/8.0),
+ REAL_CONST(44192.979579553728/8.0),
+ REAL_CONST(44212.312648628489/8.0),
+ REAL_CONST(44231.647831415532/8.0),
+ REAL_CONST(44250.985127452805/8.0),
+ REAL_CONST(44270.324536278538/8.0),
+ REAL_CONST(44289.666057431183/8.0),
+ REAL_CONST(44309.009690449464/8.0),
+ REAL_CONST(44328.355434872348/8.0),
+ REAL_CONST(44347.703290239064/8.0),
+ REAL_CONST(44367.053256089079/8.0),
+ REAL_CONST(44386.405331962109/8.0),
+ REAL_CONST(44405.759517398139/8.0),
+ REAL_CONST(44425.115811937387/8.0),
+ REAL_CONST(44444.474215120332/8.0),
+ REAL_CONST(44463.834726487694/8.0),
+ REAL_CONST(44483.197345580462/8.0),
+ REAL_CONST(44502.562071939843/8.0),
+ REAL_CONST(44521.928905107328/8.0),
+ REAL_CONST(44541.297844624634/8.0),
+ REAL_CONST(44560.668890033732/8.0),
+ REAL_CONST(44580.042040876848/8.0),
+ REAL_CONST(44599.417296696454/8.0),
+ REAL_CONST(44618.794657035272/8.0),
+ REAL_CONST(44638.174121436256/8.0),
+ REAL_CONST(44657.555689442641/8.0),
+ REAL_CONST(44676.939360597877/8.0),
+ REAL_CONST(44696.325134445673/8.0),
+ REAL_CONST(44715.713010530002/8.0),
+ REAL_CONST(44735.102988395054/8.0),
+ REAL_CONST(44754.495067585296/8.0),
+ REAL_CONST(44773.88924764542/8.0),
+ REAL_CONST(44793.285528120374/8.0),
+ REAL_CONST(44812.683908555344/8.0),
+ REAL_CONST(44832.084388495779/8.0),
+ REAL_CONST(44851.486967487363/8.0),
+ REAL_CONST(44870.891645076015/8.0),
+ REAL_CONST(44890.298420807922/8.0),
+ REAL_CONST(44909.707294229491/8.0),
+ REAL_CONST(44929.118264887409/8.0),
+ REAL_CONST(44948.531332328566/8.0),
+ REAL_CONST(44967.946496100136/8.0),
+ REAL_CONST(44987.363755749502/8.0),
+ REAL_CONST(45006.783110824319/8.0),
+ REAL_CONST(45026.204560872473/8.0),
+ REAL_CONST(45045.628105442098/8.0),
+ REAL_CONST(45065.053744081561/8.0),
+ REAL_CONST(45084.48147633949/8.0),
+ REAL_CONST(45103.911301764747/8.0),
+ REAL_CONST(45123.343219906426/8.0),
+ REAL_CONST(45142.777230313885/8.0),
+ REAL_CONST(45162.21333253671/8.0),
+ REAL_CONST(45181.651526124733/8.0),
+ REAL_CONST(45201.091810628037/8.0),
+ REAL_CONST(45220.534185596924/8.0),
+ REAL_CONST(45239.978650581965/8.0),
+ REAL_CONST(45259.425205133957/8.0),
+ REAL_CONST(45278.873848803938/8.0),
+ REAL_CONST(45298.324581143192/8.0),
+ REAL_CONST(45317.777401703235/8.0),
+ REAL_CONST(45337.232310035848/8.0),
+ REAL_CONST(45356.68930569302/8.0),
+ REAL_CONST(45376.148388226997/8.0),
+ REAL_CONST(45395.60955719027/8.0),
+ REAL_CONST(45415.072812135557/8.0),
+ REAL_CONST(45434.538152615823/8.0),
+ REAL_CONST(45454.005578184282/8.0),
+ REAL_CONST(45473.475088394356/8.0),
+ REAL_CONST(45492.946682799746/8.0),
+ REAL_CONST(45512.420360954362/8.0),
+ REAL_CONST(45531.896122412363/8.0),
+ REAL_CONST(45551.373966728155/8.0),
+ REAL_CONST(45570.853893456362/8.0),
+ REAL_CONST(45590.33590215187/8.0),
+ REAL_CONST(45609.819992369776/8.0),
+ REAL_CONST(45629.306163665438/8.0),
+ REAL_CONST(45648.794415594442/8.0),
+ REAL_CONST(45668.284747712612/8.0),
+ REAL_CONST(45687.777159576006/8.0),
+ REAL_CONST(45707.27165074092/8.0),
+ REAL_CONST(45726.768220763894/8.0),
+ REAL_CONST(45746.266869201696/8.0),
+ REAL_CONST(45765.767595611323/8.0),
+ REAL_CONST(45785.270399550034/8.0),
+ REAL_CONST(45804.775280575297/8.0),
+ REAL_CONST(45824.282238244828/8.0),
+ REAL_CONST(45843.79127211657/8.0),
+ REAL_CONST(45863.302381748719/8.0),
+ REAL_CONST(45882.815566699683/8.0),
+ REAL_CONST(45902.33082652813/8.0),
+ REAL_CONST(45921.848160792935/8.0),
+ REAL_CONST(45941.367569053225/8.0),
+ REAL_CONST(45960.889050868354/8.0),
+ REAL_CONST(45980.41260579793/8.0),
+ REAL_CONST(45999.938233401757/8.0),
+ REAL_CONST(46019.465933239902/8.0),
+ REAL_CONST(46038.995704872657/8.0),
+ REAL_CONST(46058.527547860547/8.0),
+ REAL_CONST(46078.06146176433/8.0),
+ REAL_CONST(46097.597446144995/8.0),
+ REAL_CONST(46117.135500563774/8.0),
+ REAL_CONST(46136.675624582109/8.0),
+ REAL_CONST(46156.217817761702/8.0),
+ REAL_CONST(46175.762079664462/8.0),
+ REAL_CONST(46195.308409852543/8.0),
+ REAL_CONST(46214.856807888333/8.0),
+ REAL_CONST(46234.407273334444/8.0),
+ REAL_CONST(46253.959805753715/8.0),
+ REAL_CONST(46273.51440470924/8.0),
+ REAL_CONST(46293.071069764315/8.0),
+ REAL_CONST(46312.629800482478/8.0),
+ REAL_CONST(46332.190596427499/8.0),
+ REAL_CONST(46351.753457163381/8.0),
+ REAL_CONST(46371.318382254351/8.0),
+ REAL_CONST(46390.885371264863/8.0),
+ REAL_CONST(46410.45442375962/8.0),
+ REAL_CONST(46430.025539303526/8.0),
+ REAL_CONST(46449.598717461733/8.0),
+ REAL_CONST(46469.17395779962/8.0),
+ REAL_CONST(46488.751259882782/8.0),
+ REAL_CONST(46508.33062327707/8.0),
+ REAL_CONST(46527.912047548532/8.0),
+ REAL_CONST(46547.495532263471/8.0),
+ REAL_CONST(46567.081076988397/8.0),
+ REAL_CONST(46586.668681290059/8.0),
+ REAL_CONST(46606.258344735434/8.0),
+ REAL_CONST(46625.850066891719/8.0),
+ REAL_CONST(46645.443847326351/8.0),
+ REAL_CONST(46665.039685606986/8.0),
+ REAL_CONST(46684.637581301497/8.0),
+ REAL_CONST(46704.237533978005/8.0),
+ REAL_CONST(46723.839543204842/8.0),
+ REAL_CONST(46743.443608550573/8.0),
+ REAL_CONST(46763.049729583989/8.0),
+ REAL_CONST(46782.657905874104/8.0),
+ REAL_CONST(46802.268136990162/8.0),
+ REAL_CONST(46821.880422501628/8.0),
+ REAL_CONST(46841.494761978196/8.0),
+ REAL_CONST(46861.111154989776/8.0),
+ REAL_CONST(46880.729601106526/8.0),
+ REAL_CONST(46900.350099898795/8.0),
+ REAL_CONST(46919.97265093719/8.0),
+ REAL_CONST(46939.597253792526/8.0),
+ REAL_CONST(46959.223908035841/8.0),
+ REAL_CONST(46978.852613238392/8.0),
+ REAL_CONST(46998.483368971691/8.0),
+ REAL_CONST(47018.11617480743/8.0),
+ REAL_CONST(47037.751030317551/8.0),
+ REAL_CONST(47057.387935074221/8.0),
+ REAL_CONST(47077.026888649809/8.0),
+ REAL_CONST(47096.66789061694/8.0),
+ REAL_CONST(47116.310940548428/8.0),
+ REAL_CONST(47135.956038017328/8.0),
+ REAL_CONST(47155.603182596918/8.0),
+ REAL_CONST(47175.252373860698/8.0),
+ REAL_CONST(47194.903611382375/8.0),
+ REAL_CONST(47214.556894735892/8.0),
+ REAL_CONST(47234.212223495422/8.0),
+ REAL_CONST(47253.869597235338/8.0),
+ REAL_CONST(47273.52901553025/8.0),
+ REAL_CONST(47293.19047795498/8.0),
+ REAL_CONST(47312.853984084577/8.0),
+ REAL_CONST(47332.519533494306/8.0),
+ REAL_CONST(47352.187125759658/8.0),
+ REAL_CONST(47371.856760456343/8.0),
+ REAL_CONST(47391.528437160297/8.0),
+ REAL_CONST(47411.202155447652/8.0),
+ REAL_CONST(47430.877914894787/8.0),
+ REAL_CONST(47450.555715078299/8.0),
+ REAL_CONST(47470.235555574982/8.0),
+ REAL_CONST(47489.917435961863/8.0),
+ REAL_CONST(47509.601355816201/8.0),
+ REAL_CONST(47529.287314715453/8.0),
+ REAL_CONST(47548.975312237308/8.0),
+ REAL_CONST(47568.665347959672/8.0),
+ REAL_CONST(47588.357421460656/8.0),
+ REAL_CONST(47608.051532318605/8.0),
+ REAL_CONST(47627.747680112072/8.0),
+ REAL_CONST(47647.445864419846/8.0),
+ REAL_CONST(47667.14608482091/8.0),
+ REAL_CONST(47686.848340894474/8.0),
+ REAL_CONST(47706.552632219973/8.0),
+ REAL_CONST(47726.258958377046/8.0),
+ REAL_CONST(47745.967318945557/8.0),
+ REAL_CONST(47765.677713505589/8.0),
+ REAL_CONST(47785.390141637428/8.0),
+ REAL_CONST(47805.104602921601/8.0),
+ REAL_CONST(47824.821096938824/8.0),
+ REAL_CONST(47844.539623270044/8.0),
+ REAL_CONST(47864.260181496429/8.0),
+ REAL_CONST(47883.982771199349/8.0),
+ REAL_CONST(47903.707391960394/8.0),
+ REAL_CONST(47923.434043361369/8.0),
+ REAL_CONST(47943.162724984308/8.0),
+ REAL_CONST(47962.893436411439/8.0),
+ REAL_CONST(47982.626177225218/8.0),
+ REAL_CONST(48002.36094700831/8.0),
+ REAL_CONST(48022.097745343599/8.0),
+ REAL_CONST(48041.836571814172/8.0),
+ REAL_CONST(48061.57742600335/8.0),
+ REAL_CONST(48081.32030749465/8.0),
+ REAL_CONST(48101.065215871815/8.0),
+ REAL_CONST(48120.81215071879/8.0),
+ REAL_CONST(48140.56111161974/8.0),
+ REAL_CONST(48160.312098159047/8.0),
+ REAL_CONST(48180.065109921306/8.0),
+ REAL_CONST(48199.820146491307/8.0),
+ REAL_CONST(48219.577207454073/8.0),
+ REAL_CONST(48239.336292394844/8.0),
+ REAL_CONST(48259.097400899045/8.0),
+ REAL_CONST(48278.860532552339/8.0),
+ REAL_CONST(48298.625686940592/8.0),
+ REAL_CONST(48318.392863649875/8.0),
+ REAL_CONST(48338.162062266485/8.0),
+ REAL_CONST(48357.933282376915/8.0),
+ REAL_CONST(48377.706523567889/8.0),
+ REAL_CONST(48397.481785426316/8.0),
+ REAL_CONST(48417.259067539344/8.0),
+ REAL_CONST(48437.038369494308/8.0),
+ REAL_CONST(48456.819690878765/8.0),
+ REAL_CONST(48476.603031280487/8.0),
+ REAL_CONST(48496.388390287451/8.0),
+ REAL_CONST(48516.175767487839/8.0),
+ REAL_CONST(48535.965162470042/8.0),
+ REAL_CONST(48555.756574822684/8.0),
+ REAL_CONST(48575.550004134566/8.0),
+ REAL_CONST(48595.345449994718/8.0),
+ REAL_CONST(48615.142911992378/8.0),
+ REAL_CONST(48634.942389716991/8.0),
+ REAL_CONST(48654.743882758201/8.0),
+ REAL_CONST(48674.547390705877/8.0),
+ REAL_CONST(48694.352913150084/8.0),
+ REAL_CONST(48714.160449681112/8.0),
+ REAL_CONST(48733.969999889443/8.0),
+ REAL_CONST(48753.781563365759/8.0),
+ REAL_CONST(48773.595139700978/8.0),
+ REAL_CONST(48793.410728486211/8.0),
+ REAL_CONST(48813.228329312769/8.0),
+ REAL_CONST(48833.047941772187/8.0),
+ REAL_CONST(48852.869565456189/8.0),
+ REAL_CONST(48872.693199956717/8.0),
+ REAL_CONST(48892.518844865925/8.0),
+ REAL_CONST(48912.346499776155/8.0),
+ REAL_CONST(48932.176164279976/8.0),
+ REAL_CONST(48952.007837970152/8.0),
+ REAL_CONST(48971.841520439666/8.0),
+ REAL_CONST(48991.677211281676/8.0),
+ REAL_CONST(49011.514910089587/8.0),
+ REAL_CONST(49031.354616456978/8.0),
+ REAL_CONST(49051.196329977654/8.0),
+ REAL_CONST(49071.04005024561/8.0),
+ REAL_CONST(49090.885776855059/8.0),
+ REAL_CONST(49110.733509400408/8.0),
+ REAL_CONST(49130.583247476279/8.0),
+ REAL_CONST(49150.434990677488/8.0),
+ REAL_CONST(49170.288738599062/8.0),
+ REAL_CONST(49190.144490836232/8.0),
+ REAL_CONST(49210.002246984441/8.0),
+ REAL_CONST(49229.86200663932/8.0),
+ REAL_CONST(49249.723769396718/8.0),
+ REAL_CONST(49269.587534852675/8.0),
+ REAL_CONST(49289.453302603448/8.0),
+ REAL_CONST(49309.32107224549/8.0),
+ REAL_CONST(49329.190843375451/8.0),
+ REAL_CONST(49349.062615590192/8.0),
+ REAL_CONST(49368.936388486785/8.0),
+ REAL_CONST(49388.812161662492/8.0),
+ REAL_CONST(49408.689934714785/8.0),
+ REAL_CONST(49428.569707241324/8.0),
+ REAL_CONST(49448.45147883999/8.0),
+ REAL_CONST(49468.335249108866/8.0),
+ REAL_CONST(49488.22101764621/8.0),
+ REAL_CONST(49508.108784050521/8.0),
+ REAL_CONST(49527.99854792047/8.0),
+ REAL_CONST(49547.890308854934/8.0),
+ REAL_CONST(49567.784066453009/8.0),
+ REAL_CONST(49587.679820313977/8.0),
+ REAL_CONST(49607.57757003732/8.0),
+ REAL_CONST(49627.477315222721/8.0),
+ REAL_CONST(49647.379055470075/8.0),
+ REAL_CONST(49667.28279037946/8.0),
+ REAL_CONST(49687.188519551179/8.0),
+ REAL_CONST(49707.096242585707/8.0),
+ REAL_CONST(49727.005959083741/8.0),
+ REAL_CONST(49746.917668646165/8.0),
+ REAL_CONST(49766.831370874068/8.0),
+ REAL_CONST(49786.747065368734/8.0),
+ REAL_CONST(49806.66475173166/8.0),
+ REAL_CONST(49826.584429564515/8.0),
+ REAL_CONST(49846.506098469203/8.0),
+ REAL_CONST(49866.429758047794/8.0),
+ REAL_CONST(49886.355407902578/8.0),
+ REAL_CONST(49906.283047636032/8.0),
+ REAL_CONST(49926.212676850846/8.0),
+ REAL_CONST(49946.144295149883/8.0),
+ REAL_CONST(49966.077902136225/8.0),
+ REAL_CONST(49986.013497413151/8.0),
+ REAL_CONST(50005.951080584135/8.0),
+ REAL_CONST(50025.890651252834/8.0),
+ REAL_CONST(50045.832209023123/8.0),
+ REAL_CONST(50065.775753499074/8.0),
+ REAL_CONST(50085.721284284933/8.0),
+ REAL_CONST(50105.668800985164/8.0),
+ REAL_CONST(50125.618303204428/8.0),
+ REAL_CONST(50145.569790547575/8.0),
+ REAL_CONST(50165.523262619652/8.0),
+ REAL_CONST(50185.478719025901/8.0),
+ REAL_CONST(50205.436159371769/8.0),
+ REAL_CONST(50225.395583262893/8.0),
+ REAL_CONST(50245.356990305103/8.0),
+ REAL_CONST(50265.320380104429/8.0),
+ REAL_CONST(50285.285752267104/8.0),
+ REAL_CONST(50305.253106399534/8.0),
+ REAL_CONST(50325.222442108337/8.0),
+ REAL_CONST(50345.193759000336/8.0),
+ REAL_CONST(50365.16705668252/8.0),
+ REAL_CONST(50385.142334762102/8.0),
+ REAL_CONST(50405.119592846473/8.0),
+ REAL_CONST(50425.098830543218/8.0),
+ REAL_CONST(50445.080047460127/8.0),
+ REAL_CONST(50465.063243205179/8.0),
+ REAL_CONST(50485.048417386541/8.0),
+ REAL_CONST(50505.035569612577/8.0),
+ REAL_CONST(50525.024699491856/8.0),
+ REAL_CONST(50545.015806633128/8.0),
+ REAL_CONST(50565.008890645338/8.0),
+ REAL_CONST(50585.003951137631/8.0),
+ REAL_CONST(50605.00098771933/8.0),
+ REAL_CONST(50624.999999999971/8.0),
+ REAL_CONST(50645.000987589265/8.0),
+ REAL_CONST(50665.003950097132/8.0),
+ REAL_CONST(50685.008887133677/8.0),
+ REAL_CONST(50705.015798309192/8.0),
+ REAL_CONST(50725.024683234165/8.0),
+ REAL_CONST(50745.035541519283/8.0),
+ REAL_CONST(50765.048372775411/8.0),
+ REAL_CONST(50785.063176613621/8.0),
+ REAL_CONST(50805.079952645159/8.0),
+ REAL_CONST(50825.098700481489/8.0),
+ REAL_CONST(50845.119419734241/8.0),
+ REAL_CONST(50865.142110015244/8.0),
+ REAL_CONST(50885.166770936521/8.0),
+ REAL_CONST(50905.193402110279/8.0),
+ REAL_CONST(50925.222003148934/8.0),
+ REAL_CONST(50945.252573665071/8.0),
+ REAL_CONST(50965.285113271471/8.0),
+ REAL_CONST(50985.319621581119/8.0),
+ REAL_CONST(51005.356098207172/8.0),
+ REAL_CONST(51025.394542762981/8.0),
+ REAL_CONST(51045.434954862096/8.0),
+ REAL_CONST(51065.477334118244/8.0),
+ REAL_CONST(51085.521680145357/8.0),
+ REAL_CONST(51105.567992557546/8.0),
+ REAL_CONST(51125.616270969113/8.0),
+ REAL_CONST(51145.66651499454/8.0),
+ REAL_CONST(51165.718724248516/8.0),
+ REAL_CONST(51185.772898345916/8.0),
+ REAL_CONST(51205.829036901778/8.0),
+ REAL_CONST(51225.887139531362/8.0),
+ REAL_CONST(51245.947205850105/8.0),
+ REAL_CONST(51266.009235473619/8.0),
+ REAL_CONST(51286.073228017718/8.0),
+ REAL_CONST(51306.139183098399/8.0),
+ REAL_CONST(51326.207100331856/8.0),
+ REAL_CONST(51346.276979334456/8.0),
+ REAL_CONST(51366.348819722756/8.0),
+ REAL_CONST(51386.42262111351/8.0),
+ REAL_CONST(51406.498383123653/8.0),
+ REAL_CONST(51426.57610537031/8.0),
+ REAL_CONST(51446.655787470787/8.0),
+ REAL_CONST(51466.737429042587/8.0),
+ REAL_CONST(51486.82102970338/8.0),
+ REAL_CONST(51506.906589071048/8.0),
+ REAL_CONST(51526.994106763632/8.0),
+ REAL_CONST(51547.083582399391/8.0),
+ REAL_CONST(51567.175015596738/8.0),
+ REAL_CONST(51587.268405974297/8.0),
+ REAL_CONST(51607.363753150858/8.0),
+ REAL_CONST(51627.461056745415/8.0),
+ REAL_CONST(51647.56031637713/8.0),
+ REAL_CONST(51667.661531665362/8.0),
+ REAL_CONST(51687.764702229651/8.0),
+ REAL_CONST(51707.869827689727/8.0),
+ REAL_CONST(51727.976907665499/8.0),
+ REAL_CONST(51748.085941777055/8.0),
+ REAL_CONST(51768.196929644677/8.0),
+ REAL_CONST(51788.309870888836/8.0),
+ REAL_CONST(51808.42476513017/8.0),
+ REAL_CONST(51828.541611989524/8.0),
+ REAL_CONST(51848.660411087905/8.0),
+ REAL_CONST(51868.781162046515/8.0),
+ REAL_CONST(51888.90386448674/8.0),
+ REAL_CONST(51909.028518030143/8.0),
+ REAL_CONST(51929.155122298485/8.0),
+ REAL_CONST(51949.283676913685/8.0),
+ REAL_CONST(51969.414181497872/8.0),
+ REAL_CONST(51989.546635673345/8.0),
+ REAL_CONST(52009.681039062583/8.0),
+ REAL_CONST(52029.817391288263/8.0),
+ REAL_CONST(52049.955691973213/8.0),
+ REAL_CONST(52070.095940740481/8.0),
+ REAL_CONST(52090.238137213273/8.0),
+ REAL_CONST(52110.382281014987/8.0),
+ REAL_CONST(52130.5283717692/8.0),
+ REAL_CONST(52150.676409099666/8.0),
+ REAL_CONST(52170.826392630333/8.0),
+ REAL_CONST(52190.97832198532/8.0),
+ REAL_CONST(52211.132196788931/8.0),
+ REAL_CONST(52231.288016665654/8.0),
+ REAL_CONST(52251.445781240145/8.0),
+ REAL_CONST(52271.60549013727/8.0),
+ REAL_CONST(52291.76714298204/8.0),
+ REAL_CONST(52311.930739399664/8.0),
+ REAL_CONST(52332.096279015546/8.0),
+ REAL_CONST(52352.263761455244/8.0),
+ REAL_CONST(52372.433186344519/8.0),
+ REAL_CONST(52392.604553309284/8.0),
+ REAL_CONST(52412.777861975665/8.0),
+ REAL_CONST(52432.953111969946/8.0),
+ REAL_CONST(52453.130302918595/8.0),
+ REAL_CONST(52473.309434448267/8.0),
+ REAL_CONST(52493.490506185793/8.0),
+ REAL_CONST(52513.67351775818/8.0),
+ REAL_CONST(52533.858468792605/8.0),
+ REAL_CONST(52554.045358916446/8.0),
+ REAL_CONST(52574.234187757254/8.0),
+ REAL_CONST(52594.42495494274/8.0),
+ REAL_CONST(52614.617660100812/8.0),
+ REAL_CONST(52634.812302859558/8.0),
+ REAL_CONST(52655.008882847229/8.0),
+ REAL_CONST(52675.20739969227/8.0),
+ REAL_CONST(52695.407853023295/8.0),
+ REAL_CONST(52715.610242469098/8.0),
+ REAL_CONST(52735.814567658657/8.0),
+ REAL_CONST(52756.02082822111/8.0),
+ REAL_CONST(52776.229023785803/8.0),
+ REAL_CONST(52796.439153982225/8.0),
+ REAL_CONST(52816.651218440056/8.0),
+ REAL_CONST(52836.865216789171/8.0),
+ REAL_CONST(52857.081148659599/8.0),
+ REAL_CONST(52877.29901368155/8.0),
+ REAL_CONST(52897.518811485425/8.0),
+ REAL_CONST(52917.740541701773/8.0),
+ REAL_CONST(52937.964203961354/8.0),
+ REAL_CONST(52958.18979789508/8.0),
+ REAL_CONST(52978.417323134046/8.0),
+ REAL_CONST(52998.646779309529/8.0),
+ REAL_CONST(53018.878166052978/8.0),
+ REAL_CONST(53039.111482996006/8.0),
+ REAL_CONST(53059.346729770419/8.0),
+ REAL_CONST(53079.583906008193/8.0),
+ REAL_CONST(53099.823011341483/8.0),
+ REAL_CONST(53120.0640454026/8.0),
+ REAL_CONST(53140.307007824063/8.0),
+ REAL_CONST(53160.551898238533/8.0),
+ REAL_CONST(53180.79871627887/8.0),
+ REAL_CONST(53201.047461578091/8.0),
+ REAL_CONST(53221.2981337694/8.0),
+ REAL_CONST(53241.550732486176/8.0),
+ REAL_CONST(53261.805257361964/8.0),
+ REAL_CONST(53282.061708030487/8.0),
+ REAL_CONST(53302.32008412564/8.0),
+ REAL_CONST(53322.580385281493/8.0),
+ REAL_CONST(53342.842611132299/8.0),
+ REAL_CONST(53363.106761312469/8.0),
+ REAL_CONST(53383.372835456597/8.0),
+ REAL_CONST(53403.640833199453/8.0),
+ REAL_CONST(53423.910754175973/8.0),
+ REAL_CONST(53444.18259802126/8.0),
+ REAL_CONST(53464.456364370613/8.0),
+ REAL_CONST(53484.732052859479/8.0),
+ REAL_CONST(53505.009663123499/8.0),
+ REAL_CONST(53525.289194798468/8.0),
+ REAL_CONST(53545.570647520362/8.0),
+ REAL_CONST(53565.854020925333/8.0),
+ REAL_CONST(53586.139314649699/8.0),
+ REAL_CONST(53606.426528329954/8.0),
+ REAL_CONST(53626.715661602764/8.0),
+ REAL_CONST(53647.006714104959/8.0),
+ REAL_CONST(53667.299685473547/8.0),
+ REAL_CONST(53687.59457534572/8.0),
+ REAL_CONST(53707.891383358816/8.0),
+ REAL_CONST(53728.190109150361/8.0),
+ REAL_CONST(53748.490752358055/8.0),
+ REAL_CONST(53768.793312619753/8.0),
+ REAL_CONST(53789.09778957349/8.0),
+ REAL_CONST(53809.404182857485/8.0),
+ REAL_CONST(53829.712492110106/8.0),
+ REAL_CONST(53850.022716969899/8.0),
+ REAL_CONST(53870.334857075584/8.0),
+ REAL_CONST(53890.648912066055/8.0),
+ REAL_CONST(53910.964881580367/8.0),
+ REAL_CONST(53931.28276525774/8.0),
+ REAL_CONST(53951.602562737586/8.0),
+ REAL_CONST(53971.924273659461/8.0),
+ REAL_CONST(53992.24789766311/8.0),
+ REAL_CONST(54012.57343438844/8.0),
+ REAL_CONST(54032.90088347553/8.0),
+ REAL_CONST(54053.23024456462/8.0),
+ REAL_CONST(54073.561517296133/8.0),
+ REAL_CONST(54093.894701310644/8.0),
+ REAL_CONST(54114.22979624891/8.0),
+ REAL_CONST(54134.566801751855/8.0),
+ REAL_CONST(54154.90571746057/8.0),
+ REAL_CONST(54175.246543016314/8.0),
+ REAL_CONST(54195.589278060506/8.0),
+ REAL_CONST(54215.933922234755/8.0),
+ REAL_CONST(54236.280475180814/8.0),
+ REAL_CONST(54256.628936540626/8.0),
+ REAL_CONST(54276.97930595628/8.0),
+ REAL_CONST(54297.331583070045/8.0),
+ REAL_CONST(54317.685767524359/8.0),
+ REAL_CONST(54338.041858961828/8.0),
+ REAL_CONST(54358.399857025215/8.0),
+ REAL_CONST(54378.759761357462/8.0),
+ REAL_CONST(54399.121571601667/8.0),
+ REAL_CONST(54419.485287401105/8.0),
+ REAL_CONST(54439.850908399218/8.0),
+ REAL_CONST(54460.218434239614/8.0),
+ REAL_CONST(54480.587864566056/8.0),
+ REAL_CONST(54500.95919902248/8.0),
+ REAL_CONST(54521.332437252997/8.0),
+ REAL_CONST(54541.707578901878/8.0),
+ REAL_CONST(54562.084623613555/8.0),
+ REAL_CONST(54582.46357103264/8.0),
+ REAL_CONST(54602.844420803893/8.0),
+ REAL_CONST(54623.227172572246/8.0),
+ REAL_CONST(54643.611825982807/8.0),
+ REAL_CONST(54663.998380680838/8.0),
+ REAL_CONST(54684.386836311773/8.0),
+ REAL_CONST(54704.777192521207/8.0),
+ REAL_CONST(54725.169448954897/8.0),
+ REAL_CONST(54745.563605258772/8.0),
+ REAL_CONST(54765.959661078923/8.0),
+ REAL_CONST(54786.357616061614/8.0),
+ REAL_CONST(54806.757469853255/8.0),
+ REAL_CONST(54827.159222100439/8.0),
+ REAL_CONST(54847.562872449904/8.0),
+ REAL_CONST(54867.968420548583/8.0),
+ REAL_CONST(54888.375866043534/8.0),
+ REAL_CONST(54908.785208582012/8.0),
+ REAL_CONST(54929.196447811417/8.0),
+ REAL_CONST(54949.609583379322/8.0),
+ REAL_CONST(54970.024614933463/8.0),
+ REAL_CONST(54990.441542121727/8.0),
+ REAL_CONST(55010.86036459219/8.0),
+ REAL_CONST(55031.28108199306/8.0),
+ REAL_CONST(55051.703693972733/8.0),
+ REAL_CONST(55072.128200179759/8.0),
+ REAL_CONST(55092.554600262847/8.0),
+ REAL_CONST(55112.982893870874/8.0),
+ REAL_CONST(55133.413080652877/8.0),
+ REAL_CONST(55153.845160258061/8.0),
+ REAL_CONST(55174.279132335789/8.0),
+ REAL_CONST(55194.714996535586/8.0),
+ REAL_CONST(55215.152752507143/8.0),
+ REAL_CONST(55235.592399900306/8.0),
+ REAL_CONST(55256.033938365079/8.0),
+ REAL_CONST(55276.477367551655/8.0),
+ REAL_CONST(55296.92268711036/8.0),
+ REAL_CONST(55317.369896691685/8.0),
+ REAL_CONST(55337.818995946305/8.0),
+ REAL_CONST(55358.269984525024/8.0),
+ REAL_CONST(55378.72286207883/8.0),
+ REAL_CONST(55399.177628258869/8.0),
+ REAL_CONST(55419.634282716441/8.0),
+ REAL_CONST(55440.092825103013/8.0),
+ REAL_CONST(55460.553255070205/8.0),
+ REAL_CONST(55481.015572269804/8.0),
+ REAL_CONST(55501.479776353764/8.0),
+ REAL_CONST(55521.945866974187/8.0),
+ REAL_CONST(55542.413843783339/8.0),
+ REAL_CONST(55562.883706433655/8.0),
+ REAL_CONST(55583.355454577715/8.0),
+ REAL_CONST(55603.82908786826/8.0),
+ REAL_CONST(55624.304605958219/8.0),
+ REAL_CONST(55644.782008500639/8.0),
+ REAL_CONST(55665.261295148754/8.0),
+ REAL_CONST(55685.742465555952/8.0),
+ REAL_CONST(55706.225519375774/8.0),
+ REAL_CONST(55726.710456261928/8.0),
+ REAL_CONST(55747.197275868275/8.0),
+ REAL_CONST(55767.685977848843/8.0),
+ REAL_CONST(55788.176561857814/8.0),
+ REAL_CONST(55808.669027549528/8.0),
+ REAL_CONST(55829.163374578478/8.0),
+ REAL_CONST(55849.659602599328/8.0),
+ REAL_CONST(55870.157711266889/8.0),
+ REAL_CONST(55890.657700236145/8.0),
+ REAL_CONST(55911.159569162221/8.0),
+ REAL_CONST(55931.663317700411/8.0),
+ REAL_CONST(55952.168945506164/8.0),
+ REAL_CONST(55972.676452235086/8.0),
+ REAL_CONST(55993.185837542944/8.0),
+ REAL_CONST(56013.697101085651/8.0),
+ REAL_CONST(56034.210242519301/8.0),
+ REAL_CONST(56054.72526150012/8.0),
+ REAL_CONST(56075.242157684508/8.0),
+ REAL_CONST(56095.760930729011/8.0),
+ REAL_CONST(56116.281580290342/8.0),
+ REAL_CONST(56136.804106025367/8.0),
+ REAL_CONST(56157.328507591104/8.0),
+ REAL_CONST(56177.85478464474/8.0),
+ REAL_CONST(56198.382936843598/8.0),
+ REAL_CONST(56218.912963845185/8.0),
+ REAL_CONST(56239.444865307138/8.0),
+ REAL_CONST(56259.978640887268/8.0),
+ REAL_CONST(56280.514290243525/8.0),
+ REAL_CONST(56301.051813034042/8.0),
+ REAL_CONST(56321.591208917082/8.0),
+ REAL_CONST(56342.13247755108/8.0),
+ REAL_CONST(56362.675618594607/8.0),
+ REAL_CONST(56383.220631706419/8.0),
+ REAL_CONST(56403.767516545398/8.0),
+ REAL_CONST(56424.316272770608/8.0),
+ REAL_CONST(56444.866900041241/8.0),
+ REAL_CONST(56465.419398016667/8.0),
+ REAL_CONST(56485.973766356394/8.0),
+ REAL_CONST(56506.530004720102/8.0),
+ REAL_CONST(56527.088112767611/8.0),
+ REAL_CONST(56547.648090158902/8.0),
+ REAL_CONST(56568.209936554107/8.0),
+ REAL_CONST(56588.773651613519/8.0),
+ REAL_CONST(56609.339234997584/8.0),
+ REAL_CONST(56629.9066863669/8.0),
+ REAL_CONST(56650.47600538221/8.0),
+ REAL_CONST(56671.04719170442/8.0),
+ REAL_CONST(56691.620244994599/8.0),
+ REAL_CONST(56712.195164913959/8.0),
+ REAL_CONST(56732.771951123868/8.0),
+ REAL_CONST(56753.350603285835/8.0),
+ REAL_CONST(56773.931121061541/8.0),
+ REAL_CONST(56794.513504112823/8.0),
+ REAL_CONST(56815.097752101647/8.0),
+ REAL_CONST(56835.683864690152/8.0),
+ REAL_CONST(56856.271841540627/8.0),
+ REAL_CONST(56876.86168231551/8.0),
+ REAL_CONST(56897.453386677393/8.0),
+ REAL_CONST(56918.046954289028/8.0),
+ REAL_CONST(56938.642384813298/8.0),
+ REAL_CONST(56959.239677913261/8.0),
+ REAL_CONST(56979.838833252121/8.0),
+ REAL_CONST(57000.439850493225/8.0),
+ REAL_CONST(57021.04272930009/8.0),
+ REAL_CONST(57041.647469336371/8.0),
+ REAL_CONST(57062.254070265873/8.0),
+ REAL_CONST(57082.862531752558/8.0),
+ REAL_CONST(57103.472853460553/8.0),
+ REAL_CONST(57124.085035054108/8.0),
+ REAL_CONST(57144.699076197649/8.0),
+ REAL_CONST(57165.314976555739/8.0),
+ REAL_CONST(57185.932735793103/8.0),
+ REAL_CONST(57206.552353574611/8.0),
+ REAL_CONST(57227.173829565276/8.0),
+ REAL_CONST(57247.797163430281/8.0),
+ REAL_CONST(57268.42235483494/8.0),
+ REAL_CONST(57289.049403444733/8.0),
+ REAL_CONST(57309.678308925286/8.0),
+ REAL_CONST(57330.30907094237/8.0),
+ REAL_CONST(57350.941689161911/8.0),
+ REAL_CONST(57371.576163249985/8.0),
+ REAL_CONST(57392.212492872815/8.0),
+ REAL_CONST(57412.850677696784/8.0),
+ REAL_CONST(57433.490717388406/8.0),
+ REAL_CONST(57454.132611614368/8.0),
+ REAL_CONST(57474.776360041491/8.0),
+ REAL_CONST(57495.421962336746/8.0),
+ REAL_CONST(57516.069418167266/8.0),
+ REAL_CONST(57536.718727200314/8.0),
+ REAL_CONST(57557.36988910332/8.0),
+ REAL_CONST(57578.022903543861/8.0),
+ REAL_CONST(57598.677770189643/8.0),
+ REAL_CONST(57619.334488708548/8.0),
+ REAL_CONST(57639.993058768589/8.0),
+ REAL_CONST(57660.653480037938/8.0),
+ REAL_CONST(57681.315752184906/8.0),
+ REAL_CONST(57701.979874877965/8.0),
+ REAL_CONST(57722.64584778573/8.0),
+ REAL_CONST(57743.31367057695/8.0),
+ REAL_CONST(57763.983342920546/8.0),
+ REAL_CONST(57784.654864485572/8.0),
+ REAL_CONST(57805.328234941233/8.0),
+ REAL_CONST(57826.003453956881/8.0),
+ REAL_CONST(57846.680521202026/8.0),
+ REAL_CONST(57867.359436346305/8.0),
+ REAL_CONST(57888.040199059527/8.0),
+ REAL_CONST(57908.722809011633/8.0),
+ REAL_CONST(57929.407265872709/8.0),
+ REAL_CONST(57950.093569313001/8.0),
+ REAL_CONST(57970.781719002895/8.0),
+ REAL_CONST(57991.471714612911/8.0),
+ REAL_CONST(58012.16355581375/8.0),
+ REAL_CONST(58032.857242276223/8.0),
+ REAL_CONST(58053.552773671312/8.0),
+ REAL_CONST(58074.25014967013/8.0),
+ REAL_CONST(58094.949369943948/8.0),
+ REAL_CONST(58115.650434164185/8.0),
+ REAL_CONST(58136.353342002389/8.0),
+ REAL_CONST(58157.058093130276/8.0),
+ REAL_CONST(58177.764687219693/8.0),
+ REAL_CONST(58198.47312394264/8.0),
+ REAL_CONST(58219.183402971255/8.0),
+ REAL_CONST(58239.895523977837/8.0),
+ REAL_CONST(58260.609486634821/8.0),
+ REAL_CONST(58281.325290614775/8.0),
+ REAL_CONST(58302.042935590434/8.0),
+ REAL_CONST(58322.762421234678/8.0),
+ REAL_CONST(58343.483747220511/8.0),
+ REAL_CONST(58364.206913221096/8.0),
+ REAL_CONST(58384.931918909751/8.0),
+ REAL_CONST(58405.658763959924/8.0),
+ REAL_CONST(58426.3874480452/8.0),
+ REAL_CONST(58447.117970839339/8.0),
+ REAL_CONST(58467.85033201622/8.0),
+ REAL_CONST(58488.584531249864/8.0),
+ REAL_CONST(58509.320568214462/8.0),
+ REAL_CONST(58530.058442584334/8.0),
+ REAL_CONST(58550.798154033931/8.0),
+ REAL_CONST(58571.539702237875/8.0),
+ REAL_CONST(58592.283086870906/8.0),
+ REAL_CONST(58613.028307607929/8.0),
+ REAL_CONST(58633.775364123983/8.0),
+ REAL_CONST(58654.52425609425/8.0),
+ REAL_CONST(58675.274983194053/8.0),
+ REAL_CONST(58696.027545098877/8.0),
+ REAL_CONST(58716.781941484325/8.0),
+ REAL_CONST(58737.538172026158/8.0),
+ REAL_CONST(58758.296236400274/8.0),
+ REAL_CONST(58779.056134282728/8.0),
+ REAL_CONST(58799.817865349694/8.0),
+ REAL_CONST(58820.581429277503/8.0),
+ REAL_CONST(58841.346825742643/8.0),
+ REAL_CONST(58862.114054421712/8.0),
+ REAL_CONST(58882.883114991484/8.0),
+ REAL_CONST(58903.654007128847/8.0),
+ REAL_CONST(58924.426730510851/8.0),
+ REAL_CONST(58945.201284814684/8.0),
+ REAL_CONST(58965.977669717664/8.0),
+ REAL_CONST(58986.755884897269/8.0),
+ REAL_CONST(59007.535930031117/8.0),
+ REAL_CONST(59028.317804796949/8.0),
+ REAL_CONST(59049.101508872664/8.0),
+ REAL_CONST(59069.887041936301/8.0),
+ REAL_CONST(59090.674403666046/8.0),
+ REAL_CONST(59111.463593740213/8.0),
+ REAL_CONST(59132.254611837263/8.0),
+ REAL_CONST(59153.047457635803/8.0),
+ REAL_CONST(59173.84213081457/8.0),
+ REAL_CONST(59194.638631052461/8.0),
+ REAL_CONST(59215.436958028506/8.0),
+ REAL_CONST(59236.237111421855/8.0),
+ REAL_CONST(59257.039090911829/8.0),
+ REAL_CONST(59277.842896177877/8.0),
+ REAL_CONST(59298.648526899589/8.0),
+ REAL_CONST(59319.455982756685/8.0),
+ REAL_CONST(59340.26526342905/8.0),
+ REAL_CONST(59361.076368596696/8.0),
+ REAL_CONST(59381.889297939757/8.0),
+ REAL_CONST(59402.704051138542/8.0),
+ REAL_CONST(59423.520627873484/8.0),
+ REAL_CONST(59444.339027825139/8.0),
+ REAL_CONST(59465.159250674224/8.0),
+ REAL_CONST(59485.9812961016/8.0),
+ REAL_CONST(59506.805163788253/8.0),
+ REAL_CONST(59527.630853415307/8.0),
+ REAL_CONST(59548.458364664046/8.0),
+ REAL_CONST(59569.287697215863/8.0),
+ REAL_CONST(59590.118850752311/8.0),
+ REAL_CONST(59610.951824955089/8.0),
+ REAL_CONST(59631.786619506012/8.0),
+ REAL_CONST(59652.623234087048/8.0),
+ REAL_CONST(59673.461668380311/8.0),
+ REAL_CONST(59694.301922068029/8.0),
+ REAL_CONST(59715.143994832593/8.0),
+ REAL_CONST(59735.987886356525/8.0),
+ REAL_CONST(59756.833596322482/8.0),
+ REAL_CONST(59777.681124413255/8.0),
+ REAL_CONST(59798.530470311794/8.0),
+ REAL_CONST(59819.381633701159/8.0),
+ REAL_CONST(59840.234614264569/8.0),
+ REAL_CONST(59861.089411685381/8.0),
+ REAL_CONST(59881.94602564707/8.0),
+ REAL_CONST(59902.804455833269/8.0),
+ REAL_CONST(59923.664701927737/8.0),
+ REAL_CONST(59944.526763614384/8.0),
+ REAL_CONST(59965.390640577243/8.0),
+ REAL_CONST(59986.256332500488/8.0),
+ REAL_CONST(60007.123839068438/8.0),
+ REAL_CONST(60027.993159965539/8.0),
+ REAL_CONST(60048.864294876381/8.0),
+ REAL_CONST(60069.737243485688/8.0),
+ REAL_CONST(60090.612005478324/8.0),
+ REAL_CONST(60111.488580539284/8.0),
+ REAL_CONST(60132.366968353708/8.0),
+ REAL_CONST(60153.247168606867/8.0),
+ REAL_CONST(60174.129180984164/8.0),
+ REAL_CONST(60195.013005171153/8.0),
+ REAL_CONST(60215.898640853513/8.0),
+ REAL_CONST(60236.786087717061/8.0),
+ REAL_CONST(60257.675345447751/8.0),
+ REAL_CONST(60278.566413731671/8.0),
+ REAL_CONST(60299.459292255044/8.0),
+ REAL_CONST(60320.353980704247/8.0),
+ REAL_CONST(60341.25047876576/8.0),
+ REAL_CONST(60362.148786126229/8.0),
+ REAL_CONST(60383.048902472423/8.0),
+ REAL_CONST(60403.950827491237/8.0),
+ REAL_CONST(60424.854560869717/8.0),
+ REAL_CONST(60445.76010229504/8.0),
+ REAL_CONST(60466.667451454516/8.0),
+ REAL_CONST(60487.57660803559/8.0),
+ REAL_CONST(60508.487571725847/8.0),
+ REAL_CONST(60529.400342212997/8.0),
+ REAL_CONST(60550.314919184893/8.0),
+ REAL_CONST(60571.231302329521/8.0),
+ REAL_CONST(60592.149491335003/8.0),
+ REAL_CONST(60613.069485889588/8.0),
+ REAL_CONST(60633.991285681674/8.0),
+ REAL_CONST(60654.914890399785/8.0),
+ REAL_CONST(60675.840299732568/8.0),
+ REAL_CONST(60696.767513368832/8.0),
+ REAL_CONST(60717.696530997484/8.0),
+ REAL_CONST(60738.627352307602/8.0),
+ REAL_CONST(60759.55997698837/8.0),
+ REAL_CONST(60780.494404729128/8.0),
+ REAL_CONST(60801.430635219323/8.0),
+ REAL_CONST(60822.368668148556/8.0),
+ REAL_CONST(60843.308503206565/8.0),
+ REAL_CONST(60864.250140083204/8.0),
+ REAL_CONST(60885.193578468468/8.0),
+ REAL_CONST(60906.138818052495/8.0),
+ REAL_CONST(60927.085858525541/8.0),
+ REAL_CONST(60948.034699578006/8.0),
+ REAL_CONST(60968.985340900421/8.0),
+ REAL_CONST(60989.937782183442/8.0),
+ REAL_CONST(61010.892023117864/8.0),
+ REAL_CONST(61031.848063394616/8.0),
+ REAL_CONST(61052.805902704764/8.0),
+ REAL_CONST(61073.765540739492/8.0),
+ REAL_CONST(61094.726977190134/8.0),
+ REAL_CONST(61115.690211748137/8.0),
+ REAL_CONST(61136.655244105103/8.0),
+ REAL_CONST(61157.622073952742/8.0),
+ REAL_CONST(61178.590700982917/8.0),
+ REAL_CONST(61199.561124887616/8.0),
+ REAL_CONST(61220.533345358948/8.0),
+ REAL_CONST(61241.507362089171/8.0),
+ REAL_CONST(61262.483174770663/8.0),
+ REAL_CONST(61283.460783095943/8.0),
+ REAL_CONST(61304.440186757645/8.0),
+ REAL_CONST(61325.421385448557/8.0),
+ REAL_CONST(61346.404378861582/8.0),
+ REAL_CONST(61367.389166689762/8.0),
+ REAL_CONST(61388.375748626262/8.0),
+ REAL_CONST(61409.364124364387/8.0),
+ REAL_CONST(61430.354293597571/8.0),
+ REAL_CONST(61451.346256019373/8.0),
+ REAL_CONST(61472.340011323497/8.0),
+ REAL_CONST(61493.335559203762/8.0),
+ REAL_CONST(61514.332899354122/8.0),
+ REAL_CONST(61535.332031468672/8.0),
+ REAL_CONST(61556.332955241618/8.0),
+ REAL_CONST(61577.335670367313/8.0),
+ REAL_CONST(61598.340176540238/8.0),
+ REAL_CONST(61619.346473454993/8.0),
+ REAL_CONST(61640.354560806329/8.0),
+ REAL_CONST(61661.3644382891/8.0),
+ REAL_CONST(61682.376105598312/8.0),
+ REAL_CONST(61703.389562429089/8.0),
+ REAL_CONST(61724.404808476691/8.0),
+ REAL_CONST(61745.42184343651/8.0),
+ REAL_CONST(61766.440667004063/8.0),
+ REAL_CONST(61787.461278874987/8.0),
+ REAL_CONST(61808.483678745069/8.0),
+ REAL_CONST(61829.507866310203/8.0),
+ REAL_CONST(61850.533841266435/8.0),
+ REAL_CONST(61871.561603309929/8.0),
+ REAL_CONST(61892.591152136971/8.0),
+ REAL_CONST(61913.622487443987/8.0),
+ REAL_CONST(61934.655608927525/8.0),
+ REAL_CONST(61955.690516284267/8.0),
+ REAL_CONST(61976.727209211022/8.0),
+ REAL_CONST(61997.765687404724/8.0),
+ REAL_CONST(62018.805950562448/8.0),
+ REAL_CONST(62039.847998381381/8.0),
+ REAL_CONST(62060.891830558845/8.0),
+ REAL_CONST(62081.93744679229/8.0),
+ REAL_CONST(62102.984846779298/8.0),
+ REAL_CONST(62124.034030217575/8.0),
+ REAL_CONST(62145.084996804966/8.0),
+ REAL_CONST(62166.137746239416/8.0),
+ REAL_CONST(62187.19227821903/8.0),
+ REAL_CONST(62208.248592442025/8.0),
+ REAL_CONST(62229.306688606739/8.0),
+ REAL_CONST(62250.366566411656/8.0),
+ REAL_CONST(62271.428225555377/8.0),
+ REAL_CONST(62292.491665736627/8.0),
+ REAL_CONST(62313.556886654267/8.0),
+ REAL_CONST(62334.623888007271/8.0),
+ REAL_CONST(62355.692669494762/8.0),
+ REAL_CONST(62376.763230815974/8.0),
+ REAL_CONST(62397.835571670272/8.0),
+ REAL_CONST(62418.909691757144/8.0),
+ REAL_CONST(62439.98559077621/8.0),
+ REAL_CONST(62461.063268427228/8.0),
+ REAL_CONST(62482.142724410049/8.0),
+ REAL_CONST(62503.223958424685/8.0),
+ REAL_CONST(62524.306970171267/8.0),
+ REAL_CONST(62545.39175935003/8.0),
+ REAL_CONST(62566.478325661366/8.0),
+ REAL_CONST(62587.566668805768/8.0),
+ REAL_CONST(62608.656788483881/8.0),
+ REAL_CONST(62629.748684396451/8.0),
+ REAL_CONST(62650.842356244357/8.0),
+ REAL_CONST(62671.937803728622/8.0),
+ REAL_CONST(62693.035026550366/8.0),
+ REAL_CONST(62714.134024410858/8.0),
+ REAL_CONST(62735.234797011479/8.0),
+ REAL_CONST(62756.337344053733/8.0),
+ REAL_CONST(62777.441665239276/8.0),
+ REAL_CONST(62798.547760269852/8.0),
+ REAL_CONST(62819.655628847358/8.0),
+ REAL_CONST(62840.765270673801/8.0),
+ REAL_CONST(62861.876685451323/8.0),
+ REAL_CONST(62882.989872882186/8.0),
+ REAL_CONST(62904.104832668774/8.0),
+ REAL_CONST(62925.221564513602/8.0),
+ REAL_CONST(62946.340068119309/8.0),
+ REAL_CONST(62967.460343188657/8.0),
+ REAL_CONST(62988.582389424526/8.0),
+ REAL_CONST(63009.70620652994/8.0),
+ REAL_CONST(63030.831794208025/8.0),
+ REAL_CONST(63051.959152162039/8.0),
+ REAL_CONST(63073.08828009537/8.0),
+ REAL_CONST(63094.219177711529/8.0),
+ REAL_CONST(63115.351844714154/8.0),
+ REAL_CONST(63136.486280806988/8.0),
+ REAL_CONST(63157.622485693922/8.0),
+ REAL_CONST(63178.760459078956/8.0),
+ REAL_CONST(63199.900200666219/8.0),
+ REAL_CONST(63221.041710159967/8.0),
+ REAL_CONST(63242.184987264569/8.0),
+ REAL_CONST(63263.330031684534/8.0),
+ REAL_CONST(63284.476843124474/8.0),
+ REAL_CONST(63305.625421289144/8.0),
+ REAL_CONST(63326.775765883409/8.0),
+ REAL_CONST(63347.927876612259/8.0),
+ REAL_CONST(63369.081753180813/8.0),
+ REAL_CONST(63390.237395294316/8.0),
+ REAL_CONST(63411.39480265812/8.0),
+ REAL_CONST(63432.553974977716/8.0),
+ REAL_CONST(63453.714911958712/8.0),
+ REAL_CONST(63474.877613306839/8.0),
+ REAL_CONST(63496.042078727944/8.0),
+ REAL_CONST(63517.208307927998/8.0),
+ REAL_CONST(63538.376300613119/8.0),
+ REAL_CONST(63559.546056489504/8.0),
+ REAL_CONST(63580.717575263516/8.0),
+ REAL_CONST(63601.890856641607/8.0),
+ REAL_CONST(63623.065900330374/8.0),
+ REAL_CONST(63644.242706036515/8.0),
+ REAL_CONST(63665.421273466869/8.0),
+ REAL_CONST(63686.601602328381/8.0),
+ REAL_CONST(63707.783692328136/8.0),
+ REAL_CONST(63728.967543173334/8.0),
+ REAL_CONST(63750.153154571279/8.0),
+ REAL_CONST(63771.340526229418/8.0),
+ REAL_CONST(63792.529657855317/8.0),
+ REAL_CONST(63813.720549156649/8.0),
+ REAL_CONST(63834.913199841227/8.0),
+ REAL_CONST(63856.107609616978/8.0),
+ REAL_CONST(63877.303778191941/8.0),
+ REAL_CONST(63898.501705274284/8.0),
+ REAL_CONST(63919.7013905723/8.0),
+ REAL_CONST(63940.902833794404/8.0),
+ REAL_CONST(63962.106034649114/8.0),
+ REAL_CONST(63983.310992845094/8.0),
+ REAL_CONST(64004.517708091109/8.0),
+ REAL_CONST(64025.726180096048/8.0),
+ REAL_CONST(64046.936408568938/8.0),
+ REAL_CONST(64068.1483932189/8.0),
+ REAL_CONST(64089.362133755196/8.0),
+ REAL_CONST(64110.577629887193/8.0),
+ REAL_CONST(64131.794881324393/8.0),
+ REAL_CONST(64153.013887776404/8.0),
+ REAL_CONST(64174.234648952966/8.0),
+ REAL_CONST(64195.457164563937/8.0),
+ REAL_CONST(64216.681434319289/8.0),
+ REAL_CONST(64237.907457929112/8.0),
+ REAL_CONST(64259.135235103626/8.0),
+ REAL_CONST(64280.36476555316/8.0),
+ REAL_CONST(64301.596048988169/8.0),
+ REAL_CONST(64322.829085119236/8.0),
+ REAL_CONST(64344.06387365704/8.0),
+ REAL_CONST(64365.300414312398/8.0),
+ REAL_CONST(64386.538706796251/8.0),
+ REAL_CONST(64407.778750819634/8.0),
+ REAL_CONST(64429.020546093721/8.0),
+ REAL_CONST(64450.26409232981/8.0),
+ REAL_CONST(64471.509389239291/8.0),
+ REAL_CONST(64492.756436533709/8.0),
+ REAL_CONST(64514.005233924705/8.0),
+ REAL_CONST(64535.255781124033/8.0),
+ REAL_CONST(64556.50807784358/8.0),
+ REAL_CONST(64577.762123795357/8.0),
+ REAL_CONST(64599.017918691468/8.0),
+ REAL_CONST(64620.275462244172/8.0),
+ REAL_CONST(64641.534754165805/8.0),
+ REAL_CONST(64662.795794168844/8.0),
+ REAL_CONST(64684.058581965895/8.0),
+ REAL_CONST(64705.323117269661/8.0),
+ REAL_CONST(64726.589399792974/8.0),
+ REAL_CONST(64747.857429248776/8.0),
+ REAL_CONST(64769.127205350138/8.0),
+ REAL_CONST(64790.398727810236/8.0),
+ REAL_CONST(64811.671996342375/8.0),
+ REAL_CONST(64832.947010659969/8.0),
+ REAL_CONST(64854.223770476558/8.0),
+ REAL_CONST(64875.502275505794/8.0),
+ REAL_CONST(64896.782525461451/8.0),
+ REAL_CONST(64918.064520057414/8.0),
+ REAL_CONST(64939.348259007682/8.0),
+ REAL_CONST(64960.633742026388/8.0),
+ REAL_CONST(64981.920968827762/8.0),
+ REAL_CONST(65003.209939126165/8.0),
+ REAL_CONST(65024.500652636067/8.0),
+ REAL_CONST(65045.793109072067/8.0),
+ REAL_CONST(65067.087308148861/8.0),
+ REAL_CONST(65088.383249581282/8.0),
+ REAL_CONST(65109.680933084259/8.0),
+ REAL_CONST(65130.980358372864/8.0),
+ REAL_CONST(65152.28152516226/8.0),
+ REAL_CONST(65173.584433167736/8.0),
+ REAL_CONST(65194.889082104703/8.0),
+ REAL_CONST(65216.195471688683/8.0),
+ REAL_CONST(65237.503601635319/8.0),
+ REAL_CONST(65258.813471660353/8.0),
+ REAL_CONST(65280.125081479666/8.0),
+ REAL_CONST(65301.438430809241/8.0),
+ REAL_CONST(65322.753519365178/8.0),
+ REAL_CONST(65344.070346863708/8.0),
+ REAL_CONST(65365.388913021146/8.0),
+ REAL_CONST(65386.709217553958/8.0),
+ REAL_CONST(65408.031260178701/8.0),
+ REAL_CONST(65429.355040612056/8.0),
+ REAL_CONST(65450.680558570821/8.0),
+ REAL_CONST(65472.00781377191/8.0),
+ REAL_CONST(65493.336805932355/8.0),
+ REAL_CONST(65514.66753476928/8.0),
+ REAL_CONST(65535.999999999956/8.0),
+ REAL_CONST(65557.334201341757/8.0),
+ REAL_CONST(65578.670138512171/8.0),
+ REAL_CONST(65600.007811228788/8.0),
+ REAL_CONST(65621.347219209332/8.0),
+ REAL_CONST(65642.688362171626/8.0),
+ REAL_CONST(65664.031239833639/8.0),
+ REAL_CONST(65685.375851913413/8.0),
+ REAL_CONST(65706.722198129137/8.0),
+ REAL_CONST(65728.070278199084/8.0),
+ REAL_CONST(65749.420091841661/8.0),
+ REAL_CONST(65770.771638775404/8.0),
+ REAL_CONST(65792.124918718939/8.0),
+ REAL_CONST(65813.479931391004/8.0),
+ REAL_CONST(65834.836676510458/8.0),
+ REAL_CONST(65856.195153796303/8.0),
+ REAL_CONST(65877.5553629676/8.0),
+ REAL_CONST(65898.917303743554/8.0),
+ REAL_CONST(65920.280975843489/8.0),
+ REAL_CONST(65941.646378986843/8.0),
+ REAL_CONST(65963.013512893158/8.0),
+ REAL_CONST(65984.382377282076/8.0),
+ REAL_CONST(66005.752971873386/8.0),
+ REAL_CONST(66027.125296386963/8.0),
+ REAL_CONST(66048.499350542799/8.0),
+ REAL_CONST(66069.875134061018/8.0),
+ REAL_CONST(66091.252646661844/8.0),
+ REAL_CONST(66112.631888065618/8.0),
+ REAL_CONST(66134.01285799277/8.0),
+ REAL_CONST(66155.395556163887/8.0),
+ REAL_CONST(66176.779982299631/8.0),
+ REAL_CONST(66198.166136120795/8.0),
+ REAL_CONST(66219.554017348273/8.0),
+ REAL_CONST(66240.943625703105/8.0),
+ REAL_CONST(66262.334960906388/8.0),
+ REAL_CONST(66283.728022679396/8.0),
+ REAL_CONST(66305.122810743444/8.0),
+ REAL_CONST(66326.519324820023/8.0),
+ REAL_CONST(66347.917564630698/8.0),
+ REAL_CONST(66369.317529897162/8.0),
+ REAL_CONST(66390.719220341227/8.0),
+ REAL_CONST(66412.122635684791/8.0),
+ REAL_CONST(66433.527775649884/8.0),
+ REAL_CONST(66454.934639958636/8.0),
+ REAL_CONST(66476.343228333324/8.0),
+ REAL_CONST(66497.753540496284/8.0),
+ REAL_CONST(66519.165576169995/8.0),
+ REAL_CONST(66540.57933507704/8.0),
+ REAL_CONST(66561.994816940118/8.0),
+ REAL_CONST(66583.412021482043/8.0),
+ REAL_CONST(66604.830948425733/8.0),
+ REAL_CONST(66626.251597494222/8.0),
+ REAL_CONST(66647.673968410629/8.0),
+ REAL_CONST(66669.098060898235/8.0),
+ REAL_CONST(66690.523874680381/8.0),
+ REAL_CONST(66711.951409480564/8.0),
+ REAL_CONST(66733.380665022371/8.0),
+ REAL_CONST(66754.811641029475/8.0),
+ REAL_CONST(66776.244337225711/8.0),
+ REAL_CONST(66797.678753334985/8.0),
+ REAL_CONST(66819.11488908132/8.0),
+ REAL_CONST(66840.552744188884/8.0),
+ REAL_CONST(66861.992318381905/8.0),
+ REAL_CONST(66883.433611384738/8.0),
+ REAL_CONST(66904.876622921889/8.0),
+ REAL_CONST(66926.321352717903/8.0),
+ REAL_CONST(66947.767800497502/8.0),
+ REAL_CONST(66969.215965985466/8.0),
+ REAL_CONST(66990.665848906734/8.0),
+ REAL_CONST(67012.117448986304/8.0),
+ REAL_CONST(67033.570765949335/8.0),
+ REAL_CONST(67055.025799521056/8.0),
+ REAL_CONST(67076.482549426815/8.0),
+ REAL_CONST(67097.941015392076/8.0),
+ REAL_CONST(67119.401197142433/8.0),
+ REAL_CONST(67140.863094403554/8.0),
+ REAL_CONST(67162.326706901222/8.0),
+ REAL_CONST(67183.792034361351/8.0),
+ REAL_CONST(67205.259076509959/8.0),
+ REAL_CONST(67226.72783307315/8.0),
+ REAL_CONST(67248.198303777172/8.0),
+ REAL_CONST(67269.670488348347/8.0),
+ REAL_CONST(67291.144386513144/8.0),
+ REAL_CONST(67312.619997998088/8.0),
+ REAL_CONST(67334.09732252988/8.0),
+ REAL_CONST(67355.576359835293/8.0),
+ REAL_CONST(67377.057109641188/8.0),
+ REAL_CONST(67398.53957167457/8.0),
+ REAL_CONST(67420.023745662547/8.0),
+ REAL_CONST(67441.50963133233/8.0),
+ REAL_CONST(67462.99722841123/8.0),
+ REAL_CONST(67484.486536626689/8.0),
+ REAL_CONST(67505.977555706224/8.0),
+ REAL_CONST(67527.470285377494/8.0),
+ REAL_CONST(67548.964725368263/8.0),
+ REAL_CONST(67570.460875406367/8.0),
+ REAL_CONST(67591.9587352198/8.0),
+ REAL_CONST(67613.458304536631/8.0),
+ REAL_CONST(67634.95958308503/8.0),
+ REAL_CONST(67656.462570593329/8.0),
+ REAL_CONST(67677.967266789899/8.0),
+ REAL_CONST(67699.473671403248/8.0),
+ REAL_CONST(67720.981784162024/8.0),
+ REAL_CONST(67742.491604794923/8.0),
+ REAL_CONST(67764.003133030797/8.0),
+ REAL_CONST(67785.516368598575/8.0),
+ REAL_CONST(67807.031311227314/8.0),
+ REAL_CONST(67828.547960646174/8.0),
+ REAL_CONST(67850.066316584402/8.0),
+ REAL_CONST(67871.58637877139/8.0),
+ REAL_CONST(67893.108146936589/8.0),
+ REAL_CONST(67914.63162080961/8.0),
+ REAL_CONST(67936.156800120138/8.0),
+ REAL_CONST(67957.683684597971/8.0),
+ REAL_CONST(67979.212273973011/8.0),
+ REAL_CONST(68000.742567975263/8.0),
+ REAL_CONST(68022.274566334876/8.0),
+ REAL_CONST(68043.808268782057/8.0),
+ REAL_CONST(68065.343675047145/8.0),
+ REAL_CONST(68086.880784860579/8.0),
+ REAL_CONST(68108.419597952918/8.0),
+ REAL_CONST(68129.960114054789/8.0),
+ REAL_CONST(68151.502332896969/8.0),
+ REAL_CONST(68173.04625421032/8.0),
+ REAL_CONST(68194.591877725834/8.0),
+ REAL_CONST(68216.139203174564/8.0),
+ REAL_CONST(68237.688230287706/8.0),
+ REAL_CONST(68259.238958796544/8.0),
+ REAL_CONST(68280.791388432481/8.0),
+ REAL_CONST(68302.345518927032/8.0),
+ REAL_CONST(68323.901350011787/8.0),
+ REAL_CONST(68345.458881418483/8.0),
+ REAL_CONST(68367.018112878912/8.0),
+ REAL_CONST(68388.579044125028/8.0),
+ REAL_CONST(68410.141674888844/8.0),
+ REAL_CONST(68431.706004902502/8.0),
+ REAL_CONST(68453.272033898262/8.0),
+ REAL_CONST(68474.839761608455/8.0),
+ REAL_CONST(68496.409187765545/8.0),
+ REAL_CONST(68517.980312102081/8.0),
+ REAL_CONST(68539.553134350732/8.0),
+ REAL_CONST(68561.127654244279/8.0),
+ REAL_CONST(68582.70387151558/8.0),
+ REAL_CONST(68604.281785897634/8.0),
+ REAL_CONST(68625.861397123503/8.0),
+ REAL_CONST(68647.44270492639/8.0),
+ REAL_CONST(68669.025709039604/8.0),
+ REAL_CONST(68690.610409196524/8.0),
+ REAL_CONST(68712.196805130661/8.0),
+ REAL_CONST(68733.784896575627/8.0),
+ REAL_CONST(68755.374683265123/8.0),
+ REAL_CONST(68776.966164932994/8.0),
+ REAL_CONST(68798.559341313128/8.0),
+ REAL_CONST(68820.154212139591/8.0),
+ REAL_CONST(68841.750777146473/8.0),
+ REAL_CONST(68863.349036068044/8.0),
+ REAL_CONST(68884.948988638629/8.0),
+ REAL_CONST(68906.550634592684/8.0),
+ REAL_CONST(68928.153973664739/8.0),
+ REAL_CONST(68949.75900558944/8.0),
+ REAL_CONST(68971.365730101577/8.0),
+ REAL_CONST(68992.974146935987/8.0),
+ REAL_CONST(69014.584255827634/8.0),
+ REAL_CONST(69036.196056511588/8.0),
+ REAL_CONST(69057.809548723017/8.0),
+ REAL_CONST(69079.424732197207/8.0),
+ REAL_CONST(69101.041606669532/8.0),
+ REAL_CONST(69122.660171875468/8.0),
+ REAL_CONST(69144.280427550606/8.0),
+ REAL_CONST(69165.902373430625/8.0),
+ REAL_CONST(69187.526009251334/8.0),
+ REAL_CONST(69209.151334748618/8.0),
+ REAL_CONST(69230.778349658474/8.0),
+ REAL_CONST(69252.40705371699/8.0),
+ REAL_CONST(69274.037446660412/8.0),
+ REAL_CONST(69295.669528225/8.0),
+ REAL_CONST(69317.303298147192/8.0),
+ REAL_CONST(69338.938756163494/8.0),
+ REAL_CONST(69360.575902010532/8.0),
+ REAL_CONST(69382.214735425005/8.0),
+ REAL_CONST(69403.855256143754/8.0),
+ REAL_CONST(69425.497463903681/8.0),
+ REAL_CONST(69447.141358441833/8.0),
+ REAL_CONST(69468.78693949533/8.0),
+ REAL_CONST(69490.434206801394/8.0),
+ REAL_CONST(69512.083160097391/8.0),
+ REAL_CONST(69533.733799120717/8.0),
+ REAL_CONST(69555.386123608929/8.0),
+ REAL_CONST(69577.04013329967/8.0),
+ REAL_CONST(69598.695827930685/8.0),
+ REAL_CONST(69620.353207239794/8.0),
+ REAL_CONST(69642.012270964973/8.0),
+ REAL_CONST(69663.67301884426/8.0),
+ REAL_CONST(69685.335450615792/8.0),
+ REAL_CONST(69706.999566017839/8.0),
+ REAL_CONST(69728.665364788743/8.0),
+ REAL_CONST(69750.332846666963/8.0),
+ REAL_CONST(69772.002011391058/8.0),
+ REAL_CONST(69793.672858699691/8.0),
+ REAL_CONST(69815.345388331611/8.0),
+ REAL_CONST(69837.019600025669/8.0),
+ REAL_CONST(69858.695493520849/8.0),
+ REAL_CONST(69880.373068556204/8.0),
+ REAL_CONST(69902.052324870907/8.0),
+ REAL_CONST(69923.733262204216/8.0),
+ REAL_CONST(69945.415880295492/8.0),
+ REAL_CONST(69967.100178884211/8.0),
+ REAL_CONST(69988.786157709939/8.0),
+ REAL_CONST(70010.473816512356/8.0),
+ REAL_CONST(70032.163155031216/8.0),
+ REAL_CONST(70053.854173006403/8.0),
+ REAL_CONST(70075.546870177874/8.0),
+ REAL_CONST(70097.241246285717/8.0),
+ REAL_CONST(70118.937301070109/8.0),
+ REAL_CONST(70140.635034271298/8.0),
+ REAL_CONST(70162.334445629691/8.0),
+ REAL_CONST(70184.035534885741/8.0),
+ REAL_CONST(70205.738301780017/8.0),
+ REAL_CONST(70227.442746053217/8.0),
+ REAL_CONST(70249.1488674461/8.0),
+ REAL_CONST(70270.856665699539/8.0),
+ REAL_CONST(70292.566140554511/8.0),
+ REAL_CONST(70314.277291752107/8.0),
+ REAL_CONST(70335.990119033493/8.0),
+ REAL_CONST(70357.704622139936/8.0),
+ REAL_CONST(70379.420800812819/8.0),
+ REAL_CONST(70401.138654793613/8.0),
+ REAL_CONST(70422.85818382389/8.0),
+ REAL_CONST(70444.579387645339/8.0),
+ REAL_CONST(70466.302265999722/8.0),
+ REAL_CONST(70488.026818628918/8.0),
+ REAL_CONST(70509.753045274876/8.0),
+ REAL_CONST(70531.480945679708/8.0),
+ REAL_CONST(70553.210519585555/8.0),
+ REAL_CONST(70574.941766734701/8.0),
+ REAL_CONST(70596.674686869505/8.0),
+ REAL_CONST(70618.409279732456/8.0),
+ REAL_CONST(70640.145545066101/8.0),
+ REAL_CONST(70661.883482613106/8.0),
+ REAL_CONST(70683.623092116264/8.0),
+ REAL_CONST(70705.364373318414/8.0),
+ REAL_CONST(70727.107325962526/8.0),
+ REAL_CONST(70748.851949791671/8.0),
+ REAL_CONST(70770.598244549008/8.0),
+ REAL_CONST(70792.346209977783/8.0),
+ REAL_CONST(70814.095845821372/8.0),
+ REAL_CONST(70835.847151823225/8.0),
+ REAL_CONST(70857.600127726895/8.0),
+ REAL_CONST(70879.354773276034/8.0),
+ REAL_CONST(70901.111088214413/8.0),
+ REAL_CONST(70922.869072285859/8.0),
+ REAL_CONST(70944.628725234332/8.0),
+ REAL_CONST(70966.390046803877/8.0),
+ REAL_CONST(70988.153036738629/8.0),
+ REAL_CONST(71009.917694782853/8.0),
+ REAL_CONST(71031.684020680885/8.0),
+ REAL_CONST(71053.45201417715/8.0),
+ REAL_CONST(71075.221675016204/8.0),
+ REAL_CONST(71096.993002942661/8.0),
+ REAL_CONST(71118.765997701266/8.0),
+ REAL_CONST(71140.540659036851/8.0),
+ REAL_CONST(71162.316986694335/8.0),
+ REAL_CONST(71184.09498041874/8.0),
+ REAL_CONST(71205.874639955218/8.0),
+ REAL_CONST(71227.655965048951/8.0),
+ REAL_CONST(71249.438955445294/8.0),
+ REAL_CONST(71271.223610889632/8.0),
+ REAL_CONST(71293.009931127483/8.0),
+ REAL_CONST(71314.797915904477/8.0),
+ REAL_CONST(71336.587564966307/8.0),
+ REAL_CONST(71358.378878058764/8.0),
+ REAL_CONST(71380.171854927772/8.0),
+ REAL_CONST(71401.966495319313/8.0),
+ REAL_CONST(71423.762798979486/8.0),
+ REAL_CONST(71445.560765654489/8.0),
+ REAL_CONST(71467.360395090596/8.0),
+ REAL_CONST(71489.161687034211/8.0),
+ REAL_CONST(71510.964641231811/8.0),
+ REAL_CONST(71532.769257429973/8.0),
+ REAL_CONST(71554.575535375348/8.0),
+ REAL_CONST(71576.383474814749/8.0),
+ REAL_CONST(71598.19307549503/8.0),
+ REAL_CONST(71620.004337163133/8.0),
+ REAL_CONST(71641.817259566145/8.0),
+ REAL_CONST(71663.631842451214/8.0),
+ REAL_CONST(71685.4480855656/8.0),
+ REAL_CONST(71707.26598865664/8.0),
+ REAL_CONST(71729.085551471784/8.0),
+ REAL_CONST(71750.906773758586/8.0),
+ REAL_CONST(71772.729655264673/8.0),
+ REAL_CONST(71794.554195737772/8.0),
+ REAL_CONST(71816.380394925713/8.0),
+ REAL_CONST(71838.208252576442/8.0),
+ REAL_CONST(71860.037768437964/8.0),
+ REAL_CONST(71881.868942258385/8.0),
+ REAL_CONST(71903.701773785942/8.0),
+ REAL_CONST(71925.536262768932/8.0),
+ REAL_CONST(71947.372408955751/8.0),
+ REAL_CONST(71969.210212094898/8.0),
+ REAL_CONST(71991.049671934976/8.0),
+ REAL_CONST(72012.890788224686/8.0),
+ REAL_CONST(72034.73356071279/8.0),
+ REAL_CONST(72056.577989148165/8.0),
+ REAL_CONST(72078.424073279821/8.0),
+ REAL_CONST(72100.271812856794/8.0),
+ REAL_CONST(72122.121207628254/8.0),
+ REAL_CONST(72143.97225734347/8.0),
+ REAL_CONST(72165.824961751801/8.0),
+ REAL_CONST(72187.679320602692/8.0),
+ REAL_CONST(72209.53533364569/8.0),
+ REAL_CONST(72231.393000630429/8.0),
+ REAL_CONST(72253.252321306645/8.0),
+ REAL_CONST(72275.113295424177/8.0),
+ REAL_CONST(72296.975922732949/8.0),
+ REAL_CONST(72318.840202982959/8.0),
+ REAL_CONST(72340.706135924338/8.0),
+ REAL_CONST(72362.573721307272/8.0),
+ REAL_CONST(72384.442958882093/8.0),
+ REAL_CONST(72406.313848399179/8.0),
+ REAL_CONST(72428.186389609036/8.0),
+ REAL_CONST(72450.060582262216/8.0),
+ REAL_CONST(72471.936426109431/8.0),
+ REAL_CONST(72493.813920901433/8.0),
+ REAL_CONST(72515.693066389096/8.0),
+ REAL_CONST(72537.573862323392/8.0),
+ REAL_CONST(72559.456308455352/8.0),
+ REAL_CONST(72581.340404536139/8.0),
+ REAL_CONST(72603.226150316987/8.0),
+ REAL_CONST(72625.113545549248/8.0),
+ REAL_CONST(72647.002589984331/8.0),
+ REAL_CONST(72668.893283373764/8.0),
+ REAL_CONST(72690.785625469172/8.0),
+ REAL_CONST(72712.679616022273/8.0),
+ REAL_CONST(72734.575254784853/8.0),
+ REAL_CONST(72756.472541508803/8.0),
+ REAL_CONST(72778.371475946144/8.0),
+ REAL_CONST(72800.272057848939/8.0),
+ REAL_CONST(72822.174286969355/8.0),
+ REAL_CONST(72844.07816305969/8.0),
+ REAL_CONST(72865.983685872285/8.0),
+ REAL_CONST(72887.890855159596/8.0),
+ REAL_CONST(72909.799670674183/8.0),
+ REAL_CONST(72931.710132168693/8.0),
+ REAL_CONST(72953.622239395845/8.0),
+ REAL_CONST(72975.535992108475/8.0),
+ REAL_CONST(72997.451390059519/8.0),
+ REAL_CONST(73019.368433001961/8.0),
+ REAL_CONST(73041.287120688925/8.0),
+ REAL_CONST(73063.207452873612/8.0),
+ REAL_CONST(73085.129429309294/8.0),
+ REAL_CONST(73107.053049749389/8.0),
+ REAL_CONST(73128.978313947344/8.0),
+ REAL_CONST(73150.905221656736/8.0),
+ REAL_CONST(73172.833772631217/8.0),
+ REAL_CONST(73194.763966624567/8.0),
+ REAL_CONST(73216.695803390612/8.0),
+ REAL_CONST(73238.62928268328/8.0),
+ REAL_CONST(73260.564404256627/8.0),
+ REAL_CONST(73282.501167864757/8.0),
+ REAL_CONST(73304.439573261901/8.0),
+ REAL_CONST(73326.379620202337/8.0),
+ REAL_CONST(73348.321308440485/8.0),
+ REAL_CONST(73370.264637730841/8.0),
+ REAL_CONST(73392.209607827957/8.0),
+ REAL_CONST(73414.156218486532/8.0),
+ REAL_CONST(73436.104469461323/8.0),
+ REAL_CONST(73458.054360507173/8.0),
+ REAL_CONST(73480.005891379056/8.0),
+ REAL_CONST(73501.959061831993/8.0),
+ REAL_CONST(73523.913871621116/8.0),
+ REAL_CONST(73545.870320501665/8.0),
+ REAL_CONST(73567.828408228932/8.0),
+ REAL_CONST(73589.78813455833/8.0),
+ REAL_CONST(73611.749499245358/8.0),
+ REAL_CONST(73633.712502045615/8.0),
+ REAL_CONST(73655.677142714747/8.0),
+ REAL_CONST(73677.643421008557/8.0),
+ REAL_CONST(73699.611336682879/8.0),
+ REAL_CONST(73721.580889493693/8.0),
+ REAL_CONST(73743.552079197019/8.0),
+ REAL_CONST(73765.524905548999/8.0),
+ REAL_CONST(73787.499368305856/8.0),
+ REAL_CONST(73809.475467223907/8.0),
+ REAL_CONST(73831.453202059551/8.0),
+ REAL_CONST(73853.432572569291/8.0),
+ REAL_CONST(73875.413578509717/8.0),
+ REAL_CONST(73897.396219637507/8.0),
+ REAL_CONST(73919.380495709411/8.0),
+ REAL_CONST(73941.36640648231/8.0),
+ REAL_CONST(73963.353951713143/8.0),
+ REAL_CONST(73985.343131158952/8.0),
+ REAL_CONST(74007.333944576865/8.0),
+ REAL_CONST(74029.326391724098/8.0),
+ REAL_CONST(74051.320472357969/8.0),
+ REAL_CONST(74073.316186235883/8.0),
+ REAL_CONST(74095.313533115303/8.0),
+ REAL_CONST(74117.312512753837/8.0),
+ REAL_CONST(74139.313124909138/8.0),
+ REAL_CONST(74161.315369338976/8.0),
+ REAL_CONST(74183.319245801191/8.0),
+ REAL_CONST(74205.324754053727/8.0),
+ REAL_CONST(74227.331893854629/8.0),
+ REAL_CONST(74249.340664961986/8.0),
+ REAL_CONST(74271.351067134034/8.0),
+ REAL_CONST(74293.363100129049/8.0),
+ REAL_CONST(74315.376763705441/8.0),
+ REAL_CONST(74337.392057621662/8.0),
+ REAL_CONST(74359.408981636298/8.0),
+ REAL_CONST(74381.427535508003/8.0),
+ REAL_CONST(74403.447718995507/8.0),
+ REAL_CONST(74425.469531857671/8.0),
+ REAL_CONST(74447.492973853383/8.0),
+ REAL_CONST(74469.518044741693/8.0),
+ REAL_CONST(74491.54474428168/8.0),
+ REAL_CONST(74513.573072232539/8.0),
+ REAL_CONST(74535.603028353551/8.0),
+ REAL_CONST(74557.634612404087/8.0),
+ REAL_CONST(74579.667824143602/8.0),
+ REAL_CONST(74601.702663331642/8.0),
+ REAL_CONST(74623.739129727837/8.0),
+ REAL_CONST(74645.777223091936/8.0),
+ REAL_CONST(74667.816943183716/8.0),
+ REAL_CONST(74689.858289763113/8.0),
+ REAL_CONST(74711.901262590094/8.0),
+ REAL_CONST(74733.945861424741/8.0),
+ REAL_CONST(74755.992086027225/8.0),
+ REAL_CONST(74778.039936157802/8.0),
+ REAL_CONST(74800.089411576817/8.0),
+ REAL_CONST(74822.140512044702/8.0),
+ REAL_CONST(74844.193237321961/8.0),
+ REAL_CONST(74866.24758716923/8.0),
+ REAL_CONST(74888.303561347187/8.0),
+ REAL_CONST(74910.36115961663/8.0),
+ REAL_CONST(74932.420381738411/8.0),
+ REAL_CONST(74954.481227473516/8.0),
+ REAL_CONST(74976.543696582972/8.0),
+ REAL_CONST(74998.607788827925/8.0),
+ REAL_CONST(75020.673503969607/8.0),
+ REAL_CONST(75042.740841769322/8.0),
+ REAL_CONST(75064.809801988464/8.0),
+ REAL_CONST(75086.88038438854/8.0),
+ REAL_CONST(75108.952588731103/8.0),
+ REAL_CONST(75131.026414777836/8.0),
+ REAL_CONST(75153.101862290467/8.0),
+ REAL_CONST(75175.178931030852/8.0),
+ REAL_CONST(75197.257620760924/8.0),
+ REAL_CONST(75219.33793124267/8.0),
+ REAL_CONST(75241.419862238225/8.0),
+ REAL_CONST(75263.503413509738/8.0),
+ REAL_CONST(75285.588584819503/8.0),
+ REAL_CONST(75307.675375929874/8.0),
+ REAL_CONST(75329.763786603318/8.0),
+ REAL_CONST(75351.853816602365/8.0),
+ REAL_CONST(75373.945465689612/8.0),
+ REAL_CONST(75396.038733627807/8.0),
+ REAL_CONST(75418.133620179724/8.0),
+ REAL_CONST(75440.230125108254/8.0),
+ REAL_CONST(75462.32824817636/8.0),
+ REAL_CONST(75484.427989147109/8.0),
+ REAL_CONST(75506.529347783653/8.0),
+ REAL_CONST(75528.63232384919/8.0),
+ REAL_CONST(75550.736917107075/8.0),
+ REAL_CONST(75572.843127320695/8.0),
+ REAL_CONST(75594.950954253538/8.0),
+ REAL_CONST(75617.060397669193/8.0),
+ REAL_CONST(75639.171457331307/8.0),
+ REAL_CONST(75661.284133003646/8.0),
+ REAL_CONST(75683.398424450032/8.0),
+ REAL_CONST(75705.514331434402/8.0),
+ REAL_CONST(75727.631853720741/8.0),
+ REAL_CONST(75749.750991073175/8.0),
+ REAL_CONST(75771.871743255862/8.0),
+ REAL_CONST(75793.994110033076/8.0),
+ REAL_CONST(75816.118091169177/8.0),
+ REAL_CONST(75838.243686428585/8.0),
+ REAL_CONST(75860.370895575848/8.0),
+ REAL_CONST(75882.499718375562/8.0),
+ REAL_CONST(75904.630154592422/8.0),
+ REAL_CONST(75926.762203991224/8.0),
+ REAL_CONST(75948.895866336825/8.0),
+ REAL_CONST(75971.031141394182/8.0),
+ REAL_CONST(75993.168028928325/8.0),
+ REAL_CONST(76015.306528704401/8.0),
+ REAL_CONST(76037.4466404876/8.0),
+ REAL_CONST(76059.588364043215/8.0),
+ REAL_CONST(76081.731699136653/8.0),
+ REAL_CONST(76103.876645533353/8.0),
+ REAL_CONST(76126.023202998884/8.0),
+ REAL_CONST(76148.171371298871/8.0),
+ REAL_CONST(76170.321150199044/8.0),
+ REAL_CONST(76192.472539465205/8.0),
+ REAL_CONST(76214.625538863256/8.0),
+ REAL_CONST(76236.780148159174/8.0),
+ REAL_CONST(76258.936367119008/8.0),
+ REAL_CONST(76281.094195508922/8.0),
+ REAL_CONST(76303.253633095141/8.0),
+ REAL_CONST(76325.414679643975/8.0),
+ REAL_CONST(76347.577334921851/8.0),
+ REAL_CONST(76369.741598695226/8.0),
+ REAL_CONST(76391.907470730686/8.0),
+ REAL_CONST(76414.074950794879/8.0),
+ REAL_CONST(76436.244038654564/8.0),
+ REAL_CONST(76458.414734076548/8.0),
+ REAL_CONST(76480.587036827754/8.0),
+ REAL_CONST(76502.760946675175/8.0),
+ REAL_CONST(76524.936463385893/8.0),
+ REAL_CONST(76547.11358672705/8.0),
+ REAL_CONST(76569.292316465915/8.0),
+ REAL_CONST(76591.472652369819/8.0),
+ REAL_CONST(76613.654594206164/8.0),
+ REAL_CONST(76635.838141742468/8.0),
+ REAL_CONST(76658.023294746308/8.0),
+ REAL_CONST(76680.210052985349/8.0),
+ REAL_CONST(76702.398416227341/8.0),
+ REAL_CONST(76724.588384240138/8.0),
+ REAL_CONST(76746.779956791637/8.0),
+ REAL_CONST(76768.973133649866/8.0),
+ REAL_CONST(76791.167914582897/8.0),
+ REAL_CONST(76813.364299358902/8.0),
+ REAL_CONST(76835.562287746157/8.0),
+ REAL_CONST(76857.761879512967/8.0),
+ REAL_CONST(76879.963074427797/8.0),
+ REAL_CONST(76902.165872259109/8.0),
+ REAL_CONST(76924.37027277553/8.0),
+ REAL_CONST(76946.576275745727/8.0),
+ REAL_CONST(76968.783880938441/8.0),
+ REAL_CONST(76990.993088122515/8.0),
+ REAL_CONST(77013.203897066895/8.0),
+ REAL_CONST(77035.416307540567/8.0),
+ REAL_CONST(77057.630319312622/8.0),
+ REAL_CONST(77079.845932152239/8.0),
+ REAL_CONST(77102.063145828695/8.0),
+ REAL_CONST(77124.281960111301/8.0),
+ REAL_CONST(77146.50237476948/8.0),
+ REAL_CONST(77168.724389572759/8.0),
+ REAL_CONST(77190.948004290723/8.0),
+ REAL_CONST(77213.173218693031/8.0),
+ REAL_CONST(77235.400032549442/8.0),
+ REAL_CONST(77257.628445629802/8.0),
+ REAL_CONST(77279.858457704031/8.0),
+ REAL_CONST(77302.090068542122/8.0),
+ REAL_CONST(77324.323277914169/8.0),
+ REAL_CONST(77346.558085590339/8.0),
+ REAL_CONST(77368.794491340886/8.0),
+ REAL_CONST(77391.032494936138/8.0),
+ REAL_CONST(77413.272096146524/8.0),
+ REAL_CONST(77435.51329474253/8.0),
+ REAL_CONST(77457.756090494731/8.0),
+ REAL_CONST(77480.000483173804/8.0),
+ REAL_CONST(77502.246472550498/8.0),
+ REAL_CONST(77524.494058395634/8.0),
+ REAL_CONST(77546.743240480107/8.0),
+ REAL_CONST(77568.994018574944/8.0),
+ REAL_CONST(77591.246392451198/8.0),
+ REAL_CONST(77613.500361880026/8.0),
+ REAL_CONST(77635.755926632657/8.0),
+ REAL_CONST(77658.013086480438/8.0),
+ REAL_CONST(77680.271841194757/8.0),
+ REAL_CONST(77702.532190547092/8.0),
+ REAL_CONST(77724.794134309021/8.0),
+ REAL_CONST(77747.057672252195/8.0),
+ REAL_CONST(77769.322804148323/8.0),
+ REAL_CONST(77791.589529769248/8.0),
+ REAL_CONST(77813.857848886837/8.0),
+ REAL_CONST(77836.127761273063/8.0),
+ REAL_CONST(77858.399266699998/8.0),
+ REAL_CONST(77880.67236493979/8.0),
+ REAL_CONST(77902.947055764627/8.0),
+ REAL_CONST(77925.223338946831/8.0),
+ REAL_CONST(77947.50121425878/8.0),
+ REAL_CONST(77969.780681472927/8.0),
+ REAL_CONST(77992.061740361838/8.0),
+ REAL_CONST(78014.344390698127/8.0),
+ REAL_CONST(78036.628632254491/8.0),
+ REAL_CONST(78058.914464803747/8.0),
+ REAL_CONST(78081.201888118725/8.0),
+ REAL_CONST(78103.490901972415/8.0),
+ REAL_CONST(78125.781506137821/8.0),
+ REAL_CONST(78148.073700388064/8.0),
+ REAL_CONST(78170.367484496339/8.0),
+ REAL_CONST(78192.662858235926/8.0),
+ REAL_CONST(78214.959821380166/8.0),
+ REAL_CONST(78237.258373702498/8.0),
+ REAL_CONST(78259.558514976452/8.0),
+ REAL_CONST(78281.860244975614/8.0),
+ REAL_CONST(78304.163563473659/8.0),
+ REAL_CONST(78326.468470244363/8.0),
+ REAL_CONST(78348.77496506153/8.0),
+ REAL_CONST(78371.083047699125/8.0),
+ REAL_CONST(78393.392717931114/8.0),
+ REAL_CONST(78415.703975531578/8.0),
+ REAL_CONST(78438.016820274701/8.0),
+ REAL_CONST(78460.331251934695/8.0),
+ REAL_CONST(78482.647270285903/8.0),
+ REAL_CONST(78504.964875102727/8.0),
+ REAL_CONST(78527.284066159627/8.0),
+ REAL_CONST(78549.604843231195/8.0),
+ REAL_CONST(78571.927206092048/8.0),
+ REAL_CONST(78594.251154516911/8.0),
+ REAL_CONST(78616.576688280606/8.0),
+ REAL_CONST(78638.903807157985/8.0),
+ REAL_CONST(78661.232510924034/8.0),
+ REAL_CONST(78683.562799353778/8.0),
+ REAL_CONST(78705.894672222363/8.0),
+ REAL_CONST(78728.228129304945/8.0),
+ REAL_CONST(78750.563170376859/8.0),
+ REAL_CONST(78772.899795213423/8.0),
+ REAL_CONST(78795.238003590101/8.0),
+ REAL_CONST(78817.577795282399/8.0),
+ REAL_CONST(78839.919170065928/8.0),
+ REAL_CONST(78862.262127716356/8.0),
+ REAL_CONST(78884.606668009452/8.0),
+ REAL_CONST(78906.952790721043/8.0),
+ REAL_CONST(78929.300495627045/8.0),
+ REAL_CONST(78951.64978250346/8.0),
+ REAL_CONST(78974.000651126378/8.0),
+ REAL_CONST(78996.353101271932/8.0),
+ REAL_CONST(79018.707132716358/8.0),
+ REAL_CONST(79041.062745235977/8.0),
+ REAL_CONST(79063.41993860717/8.0),
+ REAL_CONST(79085.778712606436/8.0),
+ REAL_CONST(79108.139067010285/8.0),
+ REAL_CONST(79130.501001595389/8.0),
+ REAL_CONST(79152.864516138419/8.0),
+ REAL_CONST(79175.22961041618/8.0),
+ REAL_CONST(79197.596284205531/8.0),
+ REAL_CONST(79219.96453728342/8.0),
+ REAL_CONST(79242.33436942687/8.0),
+ REAL_CONST(79264.705780412987/8.0),
+ REAL_CONST(79287.078770018954/8.0),
+ REAL_CONST(79309.453338022009/8.0),
+ REAL_CONST(79331.829484199508/8.0),
+ REAL_CONST(79354.207208328866/8.0),
+ REAL_CONST(79376.586510187582/8.0),
+ REAL_CONST(79398.967389553218/8.0),
+ REAL_CONST(79421.349846203433/8.0),
+ REAL_CONST(79443.733879915948/8.0),
+ REAL_CONST(79466.119490468584/8.0),
+ REAL_CONST(79488.50667763922/8.0),
+ REAL_CONST(79510.895441205823/8.0),
+ REAL_CONST(79533.285780946433/8.0),
+ REAL_CONST(79555.677696639163/8.0),
+ REAL_CONST(79578.071188062226/8.0),
+ REAL_CONST(79600.466254993895/8.0),
+ REAL_CONST(79622.862897212515/8.0),
+ REAL_CONST(79645.261114496549/8.0),
+ REAL_CONST(79667.660906624471/8.0),
+ REAL_CONST(79690.062273374875/8.0),
+ REAL_CONST(79712.465214526455/8.0),
+ REAL_CONST(79734.869729857935/8.0),
+ REAL_CONST(79757.275819148126/8.0),
+ REAL_CONST(79779.683482175955/8.0),
+ REAL_CONST(79802.092718720378/8.0),
+ REAL_CONST(79824.503528560454/8.0),
+ REAL_CONST(79846.915911475327/8.0),
+ REAL_CONST(79869.329867244203/8.0),
+ REAL_CONST(79891.745395646343/8.0),
+ REAL_CONST(79914.162496461155/8.0),
+ REAL_CONST(79936.581169468045/8.0),
+ REAL_CONST(79959.001414446553/8.0),
+ REAL_CONST(79981.423231176261/8.0),
+ REAL_CONST(80003.846619436852/8.0),
+ REAL_CONST(80026.271579008084/8.0),
+ REAL_CONST(80048.698109669771/8.0),
+ REAL_CONST(80071.12621120183/8.0),
+ REAL_CONST(80093.555883384237/8.0),
+ REAL_CONST(80115.987125997053/8.0),
+ REAL_CONST(80138.419938820414/8.0),
+ REAL_CONST(80160.854321634528/8.0),
+ REAL_CONST(80183.290274219689/8.0),
+ REAL_CONST(80205.727796356281/8.0),
+ REAL_CONST(80228.166887824715/8.0),
+ REAL_CONST(80250.607548405547/8.0),
+ REAL_CONST(80273.049777879336/8.0),
+ REAL_CONST(80295.493576026798/8.0),
+ REAL_CONST(80317.938942628651/8.0),
+ REAL_CONST(80340.385877465727/8.0),
+ REAL_CONST(80362.834380318949/8.0),
+ REAL_CONST(80385.28445096928/8.0),
+ REAL_CONST(80407.736089197788/8.0),
+ REAL_CONST(80430.189294785596/8.0),
+ REAL_CONST(80452.644067513917/8.0),
+ REAL_CONST(80475.100407164035/8.0),
+ REAL_CONST(80497.558313517322/8.0),
+ REAL_CONST(80520.017786355209/8.0),
+ REAL_CONST(80542.478825459213/8.0),
+ REAL_CONST(80564.941430610925/8.0),
+ REAL_CONST(80587.405601592007/8.0),
+ REAL_CONST(80609.871338184195/8.0),
+ REAL_CONST(80632.338640169342/8.0),
+ REAL_CONST(80654.8075073293/8.0),
+ REAL_CONST(80677.277939446067/8.0),
+ REAL_CONST(80699.749936301683/8.0),
+ REAL_CONST(80722.223497678278/8.0),
+ REAL_CONST(80744.698623358039/8.0),
+ REAL_CONST(80767.17531312324/8.0),
+ REAL_CONST(80789.653566756242/8.0),
+ REAL_CONST(80812.133384039465/8.0),
+ REAL_CONST(80834.614764755403/8.0),
+ REAL_CONST(80857.097708686648/8.0),
+ REAL_CONST(80879.582215615854/8.0),
+ REAL_CONST(80902.068285325731/8.0),
+ REAL_CONST(80924.555917599093/8.0),
+ REAL_CONST(80947.045112218824/8.0),
+ REAL_CONST(80969.535868967869/8.0),
+ REAL_CONST(80992.028187629272/8.0),
+ REAL_CONST(81014.522067986123/8.0),
+ REAL_CONST(81037.017509821613/8.0),
+ REAL_CONST(81059.514512919006/8.0),
+ REAL_CONST(81082.013077061609/8.0),
+ REAL_CONST(81104.513202032831/8.0),
+ REAL_CONST(81127.014887616184/8.0),
+ REAL_CONST(81149.518133595193/8.0),
+ REAL_CONST(81172.022939753486/8.0),
+ REAL_CONST(81194.529305874807/8.0),
+ REAL_CONST(81217.037231742899/8.0),
+ REAL_CONST(81239.546717141639/8.0),
+ REAL_CONST(81262.057761854958/8.0),
+ REAL_CONST(81284.570365666848/8.0),
+ REAL_CONST(81307.084528361403/8.0),
+ REAL_CONST(81329.600249722775/8.0),
+ REAL_CONST(81352.117529535186/8.0),
+ REAL_CONST(81374.636367582949/8.0),
+ REAL_CONST(81397.156763650448/8.0),
+ REAL_CONST(81419.678717522125/8.0),
+ REAL_CONST(81442.202228982511/8.0),
+ REAL_CONST(81464.727297816222/8.0),
+ REAL_CONST(81487.253923807933/8.0),
+ REAL_CONST(81509.782106742379/8.0),
+ REAL_CONST(81532.311846404409/8.0),
+ REAL_CONST(81554.843142578902/8.0),
+ REAL_CONST(81577.375995050839/8.0),
+ REAL_CONST(81599.910403605274/8.0),
+ REAL_CONST(81622.446368027333/8.0),
+ REAL_CONST(81644.983888102215/8.0),
+ REAL_CONST(81667.522963615178/8.0),
+ REAL_CONST(81690.063594351581/8.0),
+ REAL_CONST(81712.605780096841/8.0),
+ REAL_CONST(81735.149520636449/8.0),
+ REAL_CONST(81757.694815755967/8.0),
+ REAL_CONST(81780.241665241047/8.0),
+ REAL_CONST(81802.79006887741/8.0),
+ REAL_CONST(81825.340026450824/8.0),
+ REAL_CONST(81847.891537747171/8.0),
+ REAL_CONST(81870.444602552379/8.0),
+ REAL_CONST(81892.999220652477/8.0),
+ REAL_CONST(81915.555391833506/8.0),
+ REAL_CONST(81938.113115881672/8.0),
+ REAL_CONST(81960.672392583176/8.0),
+ REAL_CONST(81983.233221724338/8.0),
+ REAL_CONST(82005.795603091537/8.0),
+ REAL_CONST(82028.359536471224/8.0),
+ REAL_CONST(82050.925021649906/8.0),
+ REAL_CONST(82073.492058414209/8.0),
+ REAL_CONST(82096.060646550788/8.0),
+ REAL_CONST(82118.630785846399/8.0),
+ REAL_CONST(82141.202476087841/8.0),
+ REAL_CONST(82163.775717062032/8.0),
+ REAL_CONST(82186.35050855593/8.0),
+ REAL_CONST(82208.926850356569/8.0),
+ REAL_CONST(82231.504742251054/8.0),
+ REAL_CONST(82254.084184026578/8.0),
+ REAL_CONST(82276.665175470393/8.0),
+ REAL_CONST(82299.24771636985/8.0),
+ REAL_CONST(82321.831806512317/8.0),
+ REAL_CONST(82344.417445685307/8.0),
+ REAL_CONST(82367.004633676348/8.0),
+ REAL_CONST(82389.593370273054/8.0),
+ REAL_CONST(82412.183655263143/8.0),
+ REAL_CONST(82434.775488434374/8.0),
+ REAL_CONST(82457.368869574595/8.0),
+ REAL_CONST(82479.963798471697/8.0),
+ REAL_CONST(82502.560274913689/8.0),
+ REAL_CONST(82525.158298688606/8.0),
+ REAL_CONST(82547.757869584602/8.0),
+ REAL_CONST(82570.35898738986/8.0),
+ REAL_CONST(82592.961651892678/8.0),
+ REAL_CONST(82615.565862881398/8.0),
+ REAL_CONST(82638.171620144421/8.0),
+ REAL_CONST(82660.778923470265/8.0),
+ REAL_CONST(82683.387772647475/8.0),
+ REAL_CONST(82705.998167464713/8.0),
+ REAL_CONST(82728.610107710658/8.0),
+ REAL_CONST(82751.223593174116/8.0),
+ REAL_CONST(82773.83862364394/8.0),
+ REAL_CONST(82796.45519890904/8.0),
+ REAL_CONST(82819.073318758441/8.0),
+ REAL_CONST(82841.692982981185/8.0),
+ REAL_CONST(82864.314191366429/8.0),
+ REAL_CONST(82886.936943703375/8.0),
+ REAL_CONST(82909.561239781324/8.0),
+ REAL_CONST(82932.187079389638/8.0),
+ REAL_CONST(82954.814462317736/8.0),
+ REAL_CONST(82977.443388355125/8.0),
+ REAL_CONST(83000.073857291369/8.0),
+ REAL_CONST(83022.70586891612/8.0),
+ REAL_CONST(83045.339423019104/8.0),
+ REAL_CONST(83067.974519390089/8.0),
+ REAL_CONST(83090.611157818959/8.0),
+ REAL_CONST(83113.249338095629/8.0),
+ REAL_CONST(83135.8890600101/8.0),
+ REAL_CONST(83158.530323352461/8.0),
+ REAL_CONST(83181.173127912858/8.0),
+ REAL_CONST(83203.817473481497/8.0),
+ REAL_CONST(83226.463359848669/8.0),
+ REAL_CONST(83249.11078680474/8.0),
+ REAL_CONST(83271.759754140134/8.0),
+ REAL_CONST(83294.410261645375/8.0),
+ REAL_CONST(83317.062309111003/8.0),
+ REAL_CONST(83339.715896327703/8.0),
+ REAL_CONST(83362.371023086147/8.0),
+ REAL_CONST(83385.027689177165/8.0),
+ REAL_CONST(83407.685894391587/8.0),
+ REAL_CONST(83430.345638520361/8.0),
+ REAL_CONST(83453.006921354478/8.0),
+ REAL_CONST(83475.669742685001/8.0),
+ REAL_CONST(83498.334102303095/8.0),
+ REAL_CONST(83520.999999999942/8.0),
+ REAL_CONST(83543.667435566866/8.0),
+ REAL_CONST(83566.336408795192/8.0),
+ REAL_CONST(83589.006919476349/8.0),
+ REAL_CONST(83611.678967401851/8.0),
+ REAL_CONST(83634.352552363242/8.0),
+ REAL_CONST(83657.027674152167/8.0),
+ REAL_CONST(83679.704332560359/8.0),
+ REAL_CONST(83702.382527379552/8.0),
+ REAL_CONST(83725.062258401638/8.0),
+ REAL_CONST(83747.743525418511/8.0),
+ REAL_CONST(83770.42632822218/8.0),
+ REAL_CONST(83793.110666604684/8.0),
+ REAL_CONST(83815.796540358162/8.0),
+ REAL_CONST(83838.483949274829/8.0),
+ REAL_CONST(83861.172893146941/8.0),
+ REAL_CONST(83883.863371766842/8.0),
+ REAL_CONST(83906.555384926964/8.0),
+ REAL_CONST(83929.248932419752/8.0),
+ REAL_CONST(83951.944014037799/8.0),
+ REAL_CONST(83974.640629573696/8.0),
+ REAL_CONST(83997.338778820151/8.0),
+ REAL_CONST(84020.038461569929/8.0),
+ REAL_CONST(84042.739677615857/8.0),
+ REAL_CONST(84065.442426750829/8.0),
+ REAL_CONST(84088.146708767847/8.0),
+ REAL_CONST(84110.852523459922/8.0),
+ REAL_CONST(84133.559870620171/8.0),
+ REAL_CONST(84156.268750041796/8.0),
+ REAL_CONST(84178.979161518029/8.0),
+ REAL_CONST(84201.691104842204/8.0),
+ REAL_CONST(84224.404579807713/8.0),
+ REAL_CONST(84247.119586208006/8.0),
+ REAL_CONST(84269.83612383662/8.0),
+ REAL_CONST(84292.55419248715/8.0),
+ REAL_CONST(84315.273791953281/8.0),
+ REAL_CONST(84337.994922028738/8.0),
+ REAL_CONST(84360.717582507335/8.0),
+ REAL_CONST(84383.441773182945/8.0),
+ REAL_CONST(84406.167493849513/8.0),
+ REAL_CONST(84428.894744301069/8.0),
+ REAL_CONST(84451.623524331691/8.0),
+ REAL_CONST(84474.353833735542/8.0),
+ REAL_CONST(84497.085672306828/8.0),
+ REAL_CONST(84519.819039839858/8.0),
+ REAL_CONST(84542.553936128999/8.0),
+ REAL_CONST(84565.290360968676/8.0),
+ REAL_CONST(84588.028314153402/8.0),
+ REAL_CONST(84610.767795477717/8.0),
+ REAL_CONST(84633.508804736295/8.0),
+ REAL_CONST(84656.251341723822/8.0),
+ REAL_CONST(84678.995406235073/8.0),
+ REAL_CONST(84701.740998064924/8.0),
+ REAL_CONST(84724.488117008252/8.0),
+ REAL_CONST(84747.236762860062/8.0),
+ REAL_CONST(84769.986935415407/8.0),
+ REAL_CONST(84792.73863446941/8.0),
+ REAL_CONST(84815.491859817252/8.0),
+ REAL_CONST(84838.246611254188/8.0),
+ REAL_CONST(84861.002888575575/8.0),
+ REAL_CONST(84883.760691576768/8.0),
+ REAL_CONST(84906.520020053256/8.0),
+ REAL_CONST(84929.28087380057/8.0),
+ REAL_CONST(84952.043252614312/8.0),
+ REAL_CONST(84974.807156290146/8.0),
+ REAL_CONST(84997.572584623806/8.0),
+ REAL_CONST(85020.339537411113/8.0),
+ REAL_CONST(85043.108014447949/8.0),
+ REAL_CONST(85065.878015530237/8.0),
+ REAL_CONST(85088.649540453989/8.0),
+ REAL_CONST(85111.422589015303/8.0),
+ REAL_CONST(85134.197161010321/8.0),
+ REAL_CONST(85156.973256235244/8.0),
+ REAL_CONST(85179.750874486374/8.0),
+ REAL_CONST(85202.530015560071/8.0),
+ REAL_CONST(85225.310679252725/8.0),
+ REAL_CONST(85248.092865360857/8.0),
+ REAL_CONST(85270.876573681016/8.0),
+ REAL_CONST(85293.661804009811/8.0),
+ REAL_CONST(85316.448556143951/8.0),
+ REAL_CONST(85339.236829880188/8.0),
+ REAL_CONST(85362.026625015351/8.0),
+ REAL_CONST(85384.817941346351/8.0),
+ REAL_CONST(85407.610778670132/8.0),
+ REAL_CONST(85430.405136783724/8.0),
+ REAL_CONST(85453.201015484257/8.0),
+ REAL_CONST(85475.998414568865/8.0),
+ REAL_CONST(85498.797333834795/8.0),
+ REAL_CONST(85521.597773079353/8.0),
+ REAL_CONST(85544.399732099904/8.0),
+ REAL_CONST(85567.203210693886/8.0),
+ REAL_CONST(85590.008208658808/8.0),
+ REAL_CONST(85612.814725792239/8.0),
+ REAL_CONST(85635.62276189182/8.0),
+ REAL_CONST(85658.432316755265/8.0),
+ REAL_CONST(85681.243390180331/8.0),
+ REAL_CONST(85704.055981964877/8.0),
+ REAL_CONST(85726.870091906807/8.0),
+ REAL_CONST(85749.685719804082/8.0),
+ REAL_CONST(85772.502865454764/8.0),
+ REAL_CONST(85795.321528656961/8.0),
+ REAL_CONST(85818.141709208852/8.0),
+ REAL_CONST(85840.963406908675/8.0),
+ REAL_CONST(85863.78662155474/8.0),
+ REAL_CONST(85886.611352945445/8.0),
+ REAL_CONST(85909.437600879217/8.0),
+ REAL_CONST(85932.26536515457/8.0),
+ REAL_CONST(85955.094645570091/8.0),
+ REAL_CONST(85977.92544192441/8.0),
+ REAL_CONST(86000.757754016275/8.0),
+ REAL_CONST(86023.591581644432/8.0),
+ REAL_CONST(86046.426924607746/8.0),
+ REAL_CONST(86069.263782705122/8.0),
+ REAL_CONST(86092.102155735556/8.0),
+ REAL_CONST(86114.942043498071/8.0),
+ REAL_CONST(86137.783445791807/8.0),
+ REAL_CONST(86160.626362415918/8.0),
+ REAL_CONST(86183.470793169676/8.0),
+ REAL_CONST(86206.316737852379/8.0),
+ REAL_CONST(86229.164196263402/8.0),
+ REAL_CONST(86252.013168202204/8.0),
+ REAL_CONST(86274.863653468303/8.0),
+ REAL_CONST(86297.715651861261/8.0),
+ REAL_CONST(86320.569163180728/8.0),
+ REAL_CONST(86343.424187226425/8.0),
+ REAL_CONST(86366.280723798132/8.0),
+ REAL_CONST(86389.138772695675/8.0),
+ REAL_CONST(86411.998333718977/8.0),
+ REAL_CONST(86434.859406668009/8.0),
+ REAL_CONST(86457.721991342827/8.0),
+ REAL_CONST(86480.586087543532/8.0),
+ REAL_CONST(86503.451695070296/8.0),
+ REAL_CONST(86526.318813723352/8.0),
+ REAL_CONST(86549.187443303032/8.0),
+ REAL_CONST(86572.057583609683/8.0),
+ REAL_CONST(86594.929234443756/8.0),
+ REAL_CONST(86617.802395605773/8.0),
+ REAL_CONST(86640.677066896271/8.0),
+ REAL_CONST(86663.553248115903/8.0),
+ REAL_CONST(86686.43093906538/8.0),
+ REAL_CONST(86709.310139545443/8.0),
+ REAL_CONST(86732.190849356964/8.0),
+ REAL_CONST(86755.073068300815/8.0),
+ REAL_CONST(86777.956796177954/8.0),
+ REAL_CONST(86800.842032789442/8.0),
+ REAL_CONST(86823.728777936354/8.0),
+ REAL_CONST(86846.617031419853/8.0),
+ REAL_CONST(86869.506793041175/8.0),
+ REAL_CONST(86892.398062601613/8.0),
+ REAL_CONST(86915.290839902518/8.0),
+ REAL_CONST(86938.185124745316/8.0),
+ REAL_CONST(86961.080916931489/8.0),
+ REAL_CONST(86983.978216262592/8.0),
+ REAL_CONST(87006.87702254027/8.0),
+ REAL_CONST(87029.777335566177/8.0),
+ REAL_CONST(87052.67915514209/8.0),
+ REAL_CONST(87075.582481069796/8.0),
+ REAL_CONST(87098.487313151185/8.0),
+ REAL_CONST(87121.39365118822/8.0),
+ REAL_CONST(87144.301494982894/8.0),
+ REAL_CONST(87167.210844337285/8.0),
+ REAL_CONST(87190.121699053532/8.0),
+ REAL_CONST(87213.034058933845/8.0),
+ REAL_CONST(87235.947923780506/8.0),
+ REAL_CONST(87258.863293395829/8.0),
+ REAL_CONST(87281.780167582241/8.0),
+ REAL_CONST(87304.698546142172/8.0),
+ REAL_CONST(87327.618428878181/8.0),
+ REAL_CONST(87350.539815592856/8.0),
+ REAL_CONST(87373.462706088845/8.0),
+ REAL_CONST(87396.387100168897/8.0),
+ REAL_CONST(87419.312997635774/8.0),
+ REAL_CONST(87442.240398292357/8.0),
+ REAL_CONST(87465.16930194154/8.0),
+ REAL_CONST(87488.099708386319/8.0),
+ REAL_CONST(87511.031617429733/8.0),
+ REAL_CONST(87533.965028874911/8.0),
+ REAL_CONST(87556.899942525008/8.0),
+ REAL_CONST(87579.836358183282/8.0),
+ REAL_CONST(87602.774275653021/8.0),
+ REAL_CONST(87625.713694737613/8.0),
+ REAL_CONST(87648.654615240492/8.0),
+ REAL_CONST(87671.597036965148/8.0),
+ REAL_CONST(87694.540959715145/8.0),
+ REAL_CONST(87717.486383294105/8.0),
+ REAL_CONST(87740.433307505737/8.0),
+ REAL_CONST(87763.381732153779/8.0),
+ REAL_CONST(87786.331657042057/8.0),
+ REAL_CONST(87809.283081974456/8.0),
+ REAL_CONST(87832.236006754916/8.0),
+ REAL_CONST(87855.190431187453/8.0),
+ REAL_CONST(87878.146355076155/8.0),
+ REAL_CONST(87901.103778225151/8.0),
+ REAL_CONST(87924.062700438633/8.0),
+ REAL_CONST(87947.023121520891/8.0),
+ REAL_CONST(87969.985041276246/8.0),
+ REAL_CONST(87992.948459509105/8.0),
+ REAL_CONST(88015.913376023906/8.0),
+ REAL_CONST(88038.879790625171/8.0),
+ REAL_CONST(88061.847703117513/8.0),
+ REAL_CONST(88084.817113305573/8.0),
+ REAL_CONST(88107.788020994049/8.0),
+ REAL_CONST(88130.760425987726/8.0),
+ REAL_CONST(88153.734328091465/8.0),
+ REAL_CONST(88176.709727110137/8.0),
+ REAL_CONST(88199.686622848749/8.0),
+ REAL_CONST(88222.665015112303/8.0),
+ REAL_CONST(88245.644903705906/8.0),
+ REAL_CONST(88268.626288434709/8.0),
+ REAL_CONST(88291.609169103947/8.0),
+ REAL_CONST(88314.593545518903/8.0),
+ REAL_CONST(88337.579417484914/8.0),
+ REAL_CONST(88360.566784807408/8.0),
+ REAL_CONST(88383.555647291854/8.0),
+ REAL_CONST(88406.546004743795/8.0),
+ REAL_CONST(88429.537856968818/8.0),
+ REAL_CONST(88452.531203772611/8.0),
+ REAL_CONST(88475.52604496089/8.0),
+ REAL_CONST(88498.522380339447/8.0),
+ REAL_CONST(88521.52020971413/8.0),
+ REAL_CONST(88544.519532890874/8.0),
+ REAL_CONST(88567.520349675644/8.0),
+ REAL_CONST(88590.522659874507/8.0),
+ REAL_CONST(88613.526463293543/8.0),
+ REAL_CONST(88636.531759738922/8.0),
+ REAL_CONST(88659.538549016899/8.0),
+ REAL_CONST(88682.546830933745/8.0),
+ REAL_CONST(88705.556605295846/8.0),
+ REAL_CONST(88728.567871909589/8.0),
+ REAL_CONST(88751.580630581491/8.0),
+ REAL_CONST(88774.594881118086/8.0),
+ REAL_CONST(88797.610623325963/8.0),
+ REAL_CONST(88820.62785701183/8.0),
+ REAL_CONST(88843.646581982393/8.0),
+ REAL_CONST(88866.666798044462/8.0),
+ REAL_CONST(88889.688505004888/8.0),
+ REAL_CONST(88912.711702670611/8.0),
+ REAL_CONST(88935.7363908486/8.0),
+ REAL_CONST(88958.762569345898/8.0),
+ REAL_CONST(88981.790237969632/8.0),
+ REAL_CONST(89004.81939652696/8.0),
+ REAL_CONST(89027.850044825114/8.0),
+ REAL_CONST(89050.882182671412/8.0),
+ REAL_CONST(89073.9158098732/8.0),
+ REAL_CONST(89096.950926237885/8.0),
+ REAL_CONST(89119.987531572973/8.0),
+ REAL_CONST(89143.025625686001/8.0),
+ REAL_CONST(89166.065208384563/8.0),
+ REAL_CONST(89189.106279476357/8.0),
+ REAL_CONST(89212.148838769106/8.0),
+ REAL_CONST(89235.192886070581/8.0),
+ REAL_CONST(89258.238421188667/8.0),
+ REAL_CONST(89281.285443931265/8.0),
+ REAL_CONST(89304.333954106376/8.0),
+ REAL_CONST(89327.383951522017/8.0),
+ REAL_CONST(89350.435435986306/8.0),
+ REAL_CONST(89373.488407307406/8.0),
+ REAL_CONST(89396.542865293537/8.0),
+ REAL_CONST(89419.598809753006/8.0),
+ REAL_CONST(89442.656240494165/8.0),
+ REAL_CONST(89465.715157325409/8.0),
+ REAL_CONST(89488.775560055219/8.0),
+ REAL_CONST(89511.837448492137/8.0),
+ REAL_CONST(89534.900822444746/8.0),
+ REAL_CONST(89557.965681721733/8.0),
+ REAL_CONST(89581.032026131812/8.0),
+ REAL_CONST(89604.099855483742/8.0),
+ REAL_CONST(89627.169169586399/8.0),
+ REAL_CONST(89650.239968248672/8.0),
+ REAL_CONST(89673.312251279538/8.0),
+ REAL_CONST(89696.386018488018/8.0),
+ REAL_CONST(89719.461269683205/8.0),
+ REAL_CONST(89742.53800467425/8.0),
+ REAL_CONST(89765.616223270365/8.0),
+ REAL_CONST(89788.69592528083/8.0),
+ REAL_CONST(89811.777110514988/8.0),
+ REAL_CONST(89834.859778782207/8.0),
+ REAL_CONST(89857.943929891975/8.0),
+ REAL_CONST(89881.029563653807/8.0),
+ REAL_CONST(89904.116679877261/8.0),
+ REAL_CONST(89927.205278372014/8.0),
+ REAL_CONST(89950.29535894774/8.0),
+ REAL_CONST(89973.386921414218/8.0),
+ REAL_CONST(89996.479965581268/8.0),
+ REAL_CONST(90019.574491258769/8.0),
+ REAL_CONST(90042.670498256688/8.0),
+ REAL_CONST(90065.767986385021/8.0),
+ REAL_CONST(90088.866955453836/8.0),
+ REAL_CONST(90111.967405273259/8.0),
+ REAL_CONST(90135.069335653476/8.0),
+ REAL_CONST(90158.172746404758/8.0),
+ REAL_CONST(90181.277637337407/8.0),
+ REAL_CONST(90204.384008261797/8.0),
+ REAL_CONST(90227.49185898836/8.0),
+ REAL_CONST(90250.601189327586/8.0),
+ REAL_CONST(90273.711999090039/8.0),
+ REAL_CONST(90296.824288086325/8.0),
+ REAL_CONST(90319.938056127125/8.0),
+ REAL_CONST(90343.053303023189/8.0),
+ REAL_CONST(90366.170028585286/8.0),
+ REAL_CONST(90389.288232624298/8.0),
+ REAL_CONST(90412.407914951138/8.0),
+ REAL_CONST(90435.529075376777/8.0),
+ REAL_CONST(90458.651713712257/8.0),
+ REAL_CONST(90481.775829768681/8.0),
+ REAL_CONST(90504.901423357209/8.0),
+ REAL_CONST(90528.028494289058/8.0),
+ REAL_CONST(90551.157042375504/8.0),
+ REAL_CONST(90574.287067427911/8.0),
+ REAL_CONST(90597.418569257643/8.0),
+ REAL_CONST(90620.551547676194/8.0),
+ REAL_CONST(90643.686002495073/8.0),
+ REAL_CONST(90666.821933525847/8.0),
+ REAL_CONST(90689.959340580186/8.0),
+ REAL_CONST(90713.098223469773/8.0),
+ REAL_CONST(90736.238582006365/8.0),
+ REAL_CONST(90759.380416001804/8.0),
+ REAL_CONST(90782.523725267951/8.0),
+ REAL_CONST(90805.668509616764/8.0),
+ REAL_CONST(90828.814768860233/8.0),
+ REAL_CONST(90851.962502810435/8.0),
+ REAL_CONST(90875.11171127946/8.0),
+ REAL_CONST(90898.262394079517/8.0),
+ REAL_CONST(90921.414551022855/8.0),
+ REAL_CONST(90944.568181921743/8.0),
+ REAL_CONST(90967.72328658856/8.0),
+ REAL_CONST(90990.879864835719/8.0),
+ REAL_CONST(91014.037916475718/8.0),
+ REAL_CONST(91037.19744132107/8.0),
+ REAL_CONST(91060.358439184391/8.0),
+ REAL_CONST(91083.520909878338/8.0),
+ REAL_CONST(91106.684853215629/8.0),
+ REAL_CONST(91129.850269009039/8.0),
+ REAL_CONST(91153.017157071401/8.0),
+ REAL_CONST(91176.185517215621/8.0),
+ REAL_CONST(91199.355349254649/8.0),
+ REAL_CONST(91222.526653001492/8.0),
+ REAL_CONST(91245.699428269247/8.0),
+ REAL_CONST(91268.873674871036/8.0),
+ REAL_CONST(91292.049392620058/8.0),
+ REAL_CONST(91315.226581329553/8.0),
+ REAL_CONST(91338.405240812834/8.0),
+ REAL_CONST(91361.585370883287/8.0),
+ REAL_CONST(91384.766971354344/8.0),
+ REAL_CONST(91407.950042039476/8.0),
+ REAL_CONST(91431.134582752245/8.0),
+ REAL_CONST(91454.320593306256/8.0),
+ REAL_CONST(91477.508073515171/8.0),
+ REAL_CONST(91500.697023192712/8.0),
+ REAL_CONST(91523.887442152685/8.0),
+ REAL_CONST(91547.07933020893/8.0),
+ REAL_CONST(91570.272687175326/8.0),
+ REAL_CONST(91593.467512865856/8.0),
+ REAL_CONST(91616.663807094534/8.0),
+ REAL_CONST(91639.861569675442/8.0),
+ REAL_CONST(91663.060800422725/8.0),
+ REAL_CONST(91686.261499150554/8.0),
+ REAL_CONST(91709.463665673218/8.0),
+ REAL_CONST(91732.66729980502/8.0),
+ REAL_CONST(91755.872401360321/8.0),
+ REAL_CONST(91779.078970153569/8.0),
+ REAL_CONST(91802.287005999257/8.0),
+ REAL_CONST(91825.49650871192/8.0),
+ REAL_CONST(91848.707478106167/8.0),
+ REAL_CONST(91871.91991399668/8.0),
+ REAL_CONST(91895.133816198169/8.0),
+ REAL_CONST(91918.349184525418/8.0),
+ REAL_CONST(91941.566018793281/8.0),
+ REAL_CONST(91964.784318816659/8.0),
+ REAL_CONST(91988.004084410495/8.0),
+ REAL_CONST(92011.22531538982/8.0),
+ REAL_CONST(92034.448011569708/8.0),
+ REAL_CONST(92057.672172765277/8.0),
+ REAL_CONST(92080.897798791746/8.0),
+ REAL_CONST(92104.124889464365/8.0),
+ REAL_CONST(92127.353444598411/8.0),
+ REAL_CONST(92150.58346400928/8.0),
+ REAL_CONST(92173.814947512379/8.0),
+ REAL_CONST(92197.04789492322/8.0),
+ REAL_CONST(92220.282306057314/8.0),
+ REAL_CONST(92243.518180730272/8.0),
+ REAL_CONST(92266.755518757753/8.0),
+ REAL_CONST(92289.994319955469/8.0),
+ REAL_CONST(92313.234584139194/8.0),
+ REAL_CONST(92336.476311124774/8.0),
+ REAL_CONST(92359.719500728082/8.0),
+ REAL_CONST(92382.964152765067/8.0),
+ REAL_CONST(92406.210267051734/8.0),
+ REAL_CONST(92429.457843404161/8.0),
+ REAL_CONST(92452.706881638471/8.0),
+ REAL_CONST(92475.957381570814/8.0),
+ REAL_CONST(92499.209343017443/8.0),
+ REAL_CONST(92522.462765794655/8.0),
+ REAL_CONST(92545.717649718805/8.0),
+ REAL_CONST(92568.973994606305/8.0),
+ REAL_CONST(92592.231800273614/8.0),
+ REAL_CONST(92615.491066537259/8.0),
+ REAL_CONST(92638.751793213814/8.0),
+ REAL_CONST(92662.01398011994/8.0),
+ REAL_CONST(92685.277627072326/8.0),
+ REAL_CONST(92708.54273388772/8.0),
+ REAL_CONST(92731.809300382942/8.0),
+ REAL_CONST(92755.077326374871/8.0),
+ REAL_CONST(92778.346811680414/8.0),
+ REAL_CONST(92801.617756116568/8.0),
+ REAL_CONST(92824.890159500384/8.0),
+ REAL_CONST(92848.164021648947/8.0),
+ REAL_CONST(92871.439342379424/8.0),
+ REAL_CONST(92894.716121509016/8.0),
+ REAL_CONST(92917.994358855023/8.0),
+ REAL_CONST(92941.274054234746/8.0),
+ REAL_CONST(92964.555207465572/8.0),
+ REAL_CONST(92987.837818364962/8.0),
+ REAL_CONST(93011.121886750407/8.0),
+ REAL_CONST(93034.407412439468/8.0),
+ REAL_CONST(93057.694395249753/8.0),
+ REAL_CONST(93080.982834998955/8.0),
+ REAL_CONST(93104.272731504767/8.0),
+ REAL_CONST(93127.564084584999/8.0),
+ REAL_CONST(93150.856894057491/8.0),
+ REAL_CONST(93174.15115974014/8.0),
+ REAL_CONST(93197.446881450916/8.0),
+ REAL_CONST(93220.744059007804/8.0),
+ REAL_CONST(93244.04269222889/8.0),
+ REAL_CONST(93267.342780932304/8.0),
+ REAL_CONST(93290.644324936235/8.0),
+ REAL_CONST(93313.947324058914/8.0),
+ REAL_CONST(93337.251778118633/8.0),
+ REAL_CONST(93360.557686933767/8.0),
+ REAL_CONST(93383.865050322696/8.0),
+ REAL_CONST(93407.173868103928/8.0),
+ REAL_CONST(93430.484140095941/8.0),
+ REAL_CONST(93453.795866117362/8.0),
+ REAL_CONST(93477.109045986799/8.0),
+ REAL_CONST(93500.423679522952/8.0),
+ REAL_CONST(93523.739766544561/8.0),
+ REAL_CONST(93547.057306870454/8.0),
+ REAL_CONST(93570.376300319491/8.0),
+ REAL_CONST(93593.696746710571/8.0),
+ REAL_CONST(93617.018645862699/8.0),
+ REAL_CONST(93640.341997594893/8.0),
+ REAL_CONST(93663.666801726242/8.0),
+ REAL_CONST(93686.993058075881/8.0),
+ REAL_CONST(93710.320766463032/8.0),
+ REAL_CONST(93733.64992670693/8.0),
+ REAL_CONST(93756.980538626914/8.0),
+ REAL_CONST(93780.312602042337/8.0),
+ REAL_CONST(93803.646116772637/8.0),
+ REAL_CONST(93826.981082637285/8.0),
+ REAL_CONST(93850.317499455836/8.0),
+ REAL_CONST(93873.655367047861/8.0),
+ REAL_CONST(93896.994685233032/8.0),
+ REAL_CONST(93920.335453831038/8.0),
+ REAL_CONST(93943.677672661666/8.0),
+ REAL_CONST(93967.021341544707/8.0),
+ REAL_CONST(93990.366460300051/8.0),
+ REAL_CONST(94013.713028747632/8.0),
+ REAL_CONST(94037.061046707429/8.0),
+ REAL_CONST(94060.410513999494/8.0),
+ REAL_CONST(94083.761430443905/8.0),
+ REAL_CONST(94107.113795860845/8.0),
+ REAL_CONST(94130.467610070496/8.0),
+ REAL_CONST(94153.822872893157/8.0),
+ REAL_CONST(94177.179584149111/8.0),
+ REAL_CONST(94200.537743658759/8.0),
+ REAL_CONST(94223.897351242529/8.0),
+ REAL_CONST(94247.25840672091/8.0),
+ REAL_CONST(94270.620909914433/8.0),
+ REAL_CONST(94293.98486064373/8.0),
+ REAL_CONST(94317.350258729421/8.0),
+ REAL_CONST(94340.71710399224/8.0),
+ REAL_CONST(94364.085396252936/8.0),
+ REAL_CONST(94387.455135332348/8.0),
+ REAL_CONST(94410.82632105134/8.0),
+ REAL_CONST(94434.198953230851/8.0),
+ REAL_CONST(94457.573031691878/8.0),
+ REAL_CONST(94480.948556255447/8.0),
+ REAL_CONST(94504.325526742658/8.0),
+ REAL_CONST(94527.70394297468/8.0),
+ REAL_CONST(94551.083804772716/8.0),
+ REAL_CONST(94574.465111958023/8.0),
+ REAL_CONST(94597.847864351934/8.0),
+ REAL_CONST(94621.232061775823/8.0),
+ REAL_CONST(94644.617704051096/8.0),
+ REAL_CONST(94668.004790999272/8.0),
+ REAL_CONST(94691.393322441872/8.0),
+ REAL_CONST(94714.783298200506/8.0),
+ REAL_CONST(94738.174718096794/8.0),
+ REAL_CONST(94761.567581952477/8.0),
+ REAL_CONST(94784.961889589307/8.0),
+ REAL_CONST(94808.357640829097/8.0),
+ REAL_CONST(94831.754835493703/8.0),
+ REAL_CONST(94855.153473405066/8.0),
+ REAL_CONST(94878.553554385173/8.0),
+ REAL_CONST(94901.955078256055/8.0),
+ REAL_CONST(94925.358044839784/8.0),
+ REAL_CONST(94948.762453958523/8.0),
+ REAL_CONST(94972.168305434476/8.0),
+ REAL_CONST(94995.575599089891/8.0),
+ REAL_CONST(95018.984334747074/8.0),
+ REAL_CONST(95042.394512228391/8.0),
+ REAL_CONST(95065.806131356265/8.0),
+ REAL_CONST(95089.219191953176/8.0),
+ REAL_CONST(95112.633693841635/8.0),
+ REAL_CONST(95136.04963684424/8.0),
+ REAL_CONST(95159.467020783617/8.0),
+ REAL_CONST(95182.885845482466/8.0),
+ REAL_CONST(95206.306110763529/8.0),
+ REAL_CONST(95229.727816449609/8.0),
+ REAL_CONST(95253.150962363579/8.0),
+ REAL_CONST(95276.575548328314/8.0),
+ REAL_CONST(95300.001574166803/8.0),
+ REAL_CONST(95323.429039702052/8.0),
+ REAL_CONST(95346.857944757154/8.0),
+ REAL_CONST(95370.288289155214/8.0),
+ REAL_CONST(95393.720072719429/8.0),
+ REAL_CONST(95417.153295273019/8.0),
+ REAL_CONST(95440.587956639298/8.0),
+ REAL_CONST(95464.024056641589/8.0),
+ REAL_CONST(95487.461595103305/8.0),
+ REAL_CONST(95510.900571847902/8.0),
+ REAL_CONST(95534.340986698866/8.0),
+ REAL_CONST(95557.782839479783/8.0),
+ REAL_CONST(95581.226130014256/8.0),
+ REAL_CONST(95604.670858125959/8.0),
+ REAL_CONST(95628.117023638595/8.0),
+ REAL_CONST(95651.564626375985/8.0),
+ REAL_CONST(95675.013666161918/8.0),
+ REAL_CONST(95698.464142820303/8.0),
+ REAL_CONST(95721.916056175076/8.0),
+ REAL_CONST(95745.369406050231/8.0),
+ REAL_CONST(95768.824192269807/8.0),
+ REAL_CONST(95792.280414657915/8.0),
+ REAL_CONST(95815.738073038709/8.0),
+ REAL_CONST(95839.197167236387/8.0),
+ REAL_CONST(95862.657697075221/8.0),
+ REAL_CONST(95886.11966237954/8.0),
+ REAL_CONST(95909.583062973688/8.0),
+ REAL_CONST(95933.047898682111/8.0),
+ REAL_CONST(95956.514169329268/8.0),
+ REAL_CONST(95979.981874739708/8.0),
+ REAL_CONST(96003.451014738006/8.0),
+ REAL_CONST(96026.921589148798/8.0),
+ REAL_CONST(96050.393597796792/8.0),
+ REAL_CONST(96073.867040506724/8.0),
+ REAL_CONST(96097.341917103375/8.0),
+ REAL_CONST(96120.818227411626/8.0),
+ REAL_CONST(96144.295971256375/8.0),
+ REAL_CONST(96167.775148462577/8.0),
+ REAL_CONST(96191.255758855244/8.0),
+ REAL_CONST(96214.737802259449/8.0),
+ REAL_CONST(96238.221278500292/8.0),
+ REAL_CONST(96261.70618740299/8.0),
+ REAL_CONST(96285.192528792715/8.0),
+ REAL_CONST(96308.680302494788/8.0),
+ REAL_CONST(96332.169508334526/8.0),
+ REAL_CONST(96355.660146137321/8.0),
+ REAL_CONST(96379.152215728609/8.0),
+ REAL_CONST(96402.645716933868/8.0),
+ REAL_CONST(96426.14064957868/8.0),
+ REAL_CONST(96449.637013488609/8.0),
+ REAL_CONST(96473.134808489311/8.0),
+ REAL_CONST(96496.63403440651/8.0),
+ REAL_CONST(96520.134691065963/8.0),
+ REAL_CONST(96543.636778293469/8.0),
+ REAL_CONST(96567.140295914898/8.0),
+ REAL_CONST(96590.645243756153/8.0),
+ REAL_CONST(96614.151621643221/8.0),
+ REAL_CONST(96637.659429402134/8.0),
+ REAL_CONST(96661.168666858954/8.0),
+ REAL_CONST(96684.679333839798/8.0),
+ REAL_CONST(96708.191430170875/8.0),
+ REAL_CONST(96731.70495567839/8.0),
+ REAL_CONST(96755.219910188665/8.0),
+ REAL_CONST(96778.736293528011/8.0),
+ REAL_CONST(96802.254105522836/8.0),
+ REAL_CONST(96825.77334599958/8.0),
+ REAL_CONST(96849.29401478474/8.0),
+ REAL_CONST(96872.816111704873/8.0),
+ REAL_CONST(96896.339636586577/8.0),
+ REAL_CONST(96919.864589256511/8.0),
+ REAL_CONST(96943.390969541389/8.0),
+ REAL_CONST(96966.918777267958/8.0),
+ REAL_CONST(96990.448012263048/8.0),
+ REAL_CONST(97013.978674353522/8.0),
+ REAL_CONST(97037.510763366285/8.0),
+ REAL_CONST(97061.044279128328/8.0),
+ REAL_CONST(97084.579221466673/8.0),
+ REAL_CONST(97108.115590208385/8.0),
+ REAL_CONST(97131.653385180587/8.0),
+ REAL_CONST(97155.19260621049/8.0),
+ REAL_CONST(97178.733253125291/8.0),
+ REAL_CONST(97202.2753257523/8.0),
+ REAL_CONST(97225.81882391886/8.0),
+ REAL_CONST(97249.363747452342/8.0),
+ REAL_CONST(97272.910096180189/8.0),
+ REAL_CONST(97296.457869929916/8.0),
+ REAL_CONST(97320.007068529041/8.0),
+ REAL_CONST(97343.557691805196/8.0),
+ REAL_CONST(97367.109739586012/8.0),
+ REAL_CONST(97390.663211699197/8.0),
+ REAL_CONST(97414.218107972498/8.0),
+ REAL_CONST(97437.774428233737/8.0),
+ REAL_CONST(97461.332172310766/8.0),
+ REAL_CONST(97484.891340031507/8.0),
+ REAL_CONST(97508.451931223899/8.0),
+ REAL_CONST(97532.013945715982/8.0),
+ REAL_CONST(97555.577383335811/8.0),
+ REAL_CONST(97579.142243911512/8.0),
+ REAL_CONST(97602.708527271257/8.0),
+ REAL_CONST(97626.276233243261/8.0),
+ REAL_CONST(97649.845361655811/8.0),
+ REAL_CONST(97673.415912337223/8.0),
+ REAL_CONST(97696.987885115886/8.0),
+ REAL_CONST(97720.561279820206/8.0),
+ REAL_CONST(97744.1360962787/8.0),
+ REAL_CONST(97767.712334319876/8.0),
+ REAL_CONST(97791.289993772341/8.0),
+ REAL_CONST(97814.869074464703/8.0),
+ REAL_CONST(97838.449576225685/8.0),
+ REAL_CONST(97862.031498883996/8.0),
+ REAL_CONST(97885.614842268449/8.0),
+ REAL_CONST(97909.199606207883/8.0),
+ REAL_CONST(97932.785790531183/8.0),
+ REAL_CONST(97956.37339506732/8.0),
+ REAL_CONST(97979.962419645264/8.0),
+ REAL_CONST(98003.552864094076/8.0),
+ REAL_CONST(98027.144728242856/8.0),
+ REAL_CONST(98050.738011920766/8.0),
+ REAL_CONST(98074.332714956996/8.0),
+ REAL_CONST(98097.928837180807/8.0),
+ REAL_CONST(98121.526378421506/8.0),
+ REAL_CONST(98145.125338508456/8.0),
+ REAL_CONST(98168.725717271067/8.0),
+ REAL_CONST(98192.327514538789/8.0),
+ REAL_CONST(98215.930730141132/8.0),
+ REAL_CONST(98239.535363907664/8.0),
+ REAL_CONST(98263.141415668011/8.0),
+ REAL_CONST(98286.748885251814/8.0),
+ REAL_CONST(98310.357772488816/8.0),
+ REAL_CONST(98333.968077208759/8.0),
+ REAL_CONST(98357.579799241488/8.0),
+ REAL_CONST(98381.192938416847/8.0),
+ REAL_CONST(98404.807494564782/8.0),
+ REAL_CONST(98428.42346751524/8.0),
+ REAL_CONST(98452.040857098269/8.0),
+ REAL_CONST(98475.659663143917/8.0),
+ REAL_CONST(98499.27988548232/8.0),
+ REAL_CONST(98522.901523943656/8.0),
+ REAL_CONST(98546.524578358163/8.0),
+ REAL_CONST(98570.149048556093/8.0),
+ REAL_CONST(98593.774934367786/8.0),
+ REAL_CONST(98617.402235623624/8.0),
+ REAL_CONST(98641.030952154048/8.0),
+ REAL_CONST(98664.661083789513/8.0),
+ REAL_CONST(98688.292630360564/8.0),
+ REAL_CONST(98711.925591697771/8.0),
+ REAL_CONST(98735.559967631794/8.0),
+ REAL_CONST(98759.195757993293/8.0),
+ REAL_CONST(98782.832962613014/8.0),
+ REAL_CONST(98806.471581321734/8.0),
+ REAL_CONST(98830.111613950285/8.0),
+ REAL_CONST(98853.753060329575/8.0),
+ REAL_CONST(98877.39592029051/8.0),
+ REAL_CONST(98901.040193664099/8.0),
+ REAL_CONST(98924.68588028138/8.0),
+ REAL_CONST(98948.33297997342/8.0),
+ REAL_CONST(98971.981492571387/8.0),
+ REAL_CONST(98995.63141790645/8.0),
+ REAL_CONST(99019.282755809851/8.0),
+ REAL_CONST(99042.935506112874/8.0),
+ REAL_CONST(99066.589668646877/8.0),
+ REAL_CONST(99090.245243243233/8.0),
+ REAL_CONST(99113.902229733401/8.0),
+ REAL_CONST(99137.560627948857/8.0),
+ REAL_CONST(99161.220437721131/8.0),
+ REAL_CONST(99184.881658881859/8.0),
+ REAL_CONST(99208.544291262631/8.0),
+ REAL_CONST(99232.208334695169/8.0),
+ REAL_CONST(99255.87378901121/8.0),
+ REAL_CONST(99279.540654042547/8.0),
+ REAL_CONST(99303.208929621018/8.0),
+ REAL_CONST(99326.878615578535/8.0),
+ REAL_CONST(99350.549711746993/8.0),
+ REAL_CONST(99374.222217958435/8.0),
+ REAL_CONST(99397.896134044888/8.0),
+ REAL_CONST(99421.571459838422/8.0),
+ REAL_CONST(99445.248195171211/8.0),
+ REAL_CONST(99468.926339875441/8.0),
+ REAL_CONST(99492.605893783344/8.0),
+ REAL_CONST(99516.286856727209/8.0),
+ REAL_CONST(99539.969228539398/8.0),
+ REAL_CONST(99563.653009052287/8.0),
+ REAL_CONST(99587.338198098325/8.0),
+ REAL_CONST(99611.024795510006/8.0),
+ REAL_CONST(99634.712801119866/8.0),
+ REAL_CONST(99658.402214760499/8.0),
+ REAL_CONST(99682.093036264545/8.0),
+ REAL_CONST(99705.785265464699/8.0),
+ REAL_CONST(99729.478902193689/8.0),
+ REAL_CONST(99753.173946284325/8.0),
+ REAL_CONST(99776.870397569437/8.0),
+ REAL_CONST(99800.56825588191/8.0),
+ REAL_CONST(99824.267521054688/8.0),
+ REAL_CONST(99847.968192920773/8.0),
+ REAL_CONST(99871.670271313182/8.0),
+ REAL_CONST(99895.373756065004/8.0),
+ REAL_CONST(99919.078647009388/8.0),
+ REAL_CONST(99942.78494397951/8.0),
+ REAL_CONST(99966.492646808634/8.0),
+ REAL_CONST(99990.20175533001/8.0),
+ REAL_CONST(100013.91226937699/8.0),
+ REAL_CONST(100037.62418878295/8.0),
+ REAL_CONST(100061.33751338134/8.0),
+ REAL_CONST(100085.05224300563/8.0),
+ REAL_CONST(100108.76837748935/8.0),
+ REAL_CONST(100132.4859166661/8.0),
+ REAL_CONST(100156.2048603695/8.0),
+ REAL_CONST(100179.92520843323/8.0),
+ REAL_CONST(100203.64696069101/8.0),
+ REAL_CONST(100227.37011697664/8.0),
+ REAL_CONST(100251.09467712394/8.0),
+ REAL_CONST(100274.82064096678/8.0),
+ REAL_CONST(100298.54800833909/8.0),
+ REAL_CONST(100322.27677907483/8.0),
+ REAL_CONST(100346.00695300807/8.0),
+ REAL_CONST(100369.73852997283/8.0),
+ REAL_CONST(100393.47150980328/8.0),
+ REAL_CONST(100417.20589233354/8.0),
+ REAL_CONST(100440.94167739789/8.0),
+ REAL_CONST(100464.67886483055/8.0),
+ REAL_CONST(100488.41745446586/8.0),
+ REAL_CONST(100512.1574461382/8.0),
+ REAL_CONST(100535.89883968196/8.0),
+ REAL_CONST(100559.64163493161/8.0),
+ REAL_CONST(100583.38583172169/8.0),
+ REAL_CONST(100607.13142988674/8.0),
+ REAL_CONST(100630.87842926137/8.0),
+ REAL_CONST(100654.62682968024/8.0),
+ REAL_CONST(100678.37663097809/8.0),
+ REAL_CONST(100702.12783298964/8.0),
+ REAL_CONST(100725.88043554971/8.0),
+ REAL_CONST(100749.63443849317/8.0),
+ REAL_CONST(100773.38984165489/8.0),
+ REAL_CONST(100797.14664486986/8.0),
+ REAL_CONST(100820.90484797307/8.0),
+ REAL_CONST(100844.66445079957/8.0),
+ REAL_CONST(100868.42545318443/8.0),
+ REAL_CONST(100892.18785496285/8.0),
+ REAL_CONST(100915.95165596998/8.0),
+ REAL_CONST(100939.71685604109/8.0),
+ REAL_CONST(100963.48345501146/8.0),
+ REAL_CONST(100987.25145271645/8.0),
+ REAL_CONST(101011.02084899142/8.0),
+ REAL_CONST(101034.79164367182/8.0),
+ REAL_CONST(101058.56383659317/8.0),
+ REAL_CONST(101082.33742759094/8.0),
+ REAL_CONST(101106.11241650078/8.0),
+ REAL_CONST(101129.88880315828/8.0),
+ REAL_CONST(101153.66658739912/8.0),
+ REAL_CONST(101177.44576905905/8.0),
+ REAL_CONST(101201.22634797383/8.0),
+ REAL_CONST(101225.00832397929/8.0),
+ REAL_CONST(101248.7916969113/8.0),
+ REAL_CONST(101272.57646660579/8.0),
+ REAL_CONST(101296.36263289873/8.0),
+ REAL_CONST(101320.15019562612/8.0),
+ REAL_CONST(101343.93915462404/8.0),
+ REAL_CONST(101367.7295097286/8.0),
+ REAL_CONST(101391.52126077596/8.0),
+ REAL_CONST(101415.31440760233/8.0),
+ REAL_CONST(101439.10895004397/8.0),
+ REAL_CONST(101462.9048879372/8.0),
+ REAL_CONST(101486.70222111834/8.0),
+ REAL_CONST(101510.50094942382/8.0),
+ REAL_CONST(101534.30107269008/8.0),
+ REAL_CONST(101558.10259075361/8.0),
+ REAL_CONST(101581.90550345098/8.0),
+ REAL_CONST(101605.70981061876/8.0),
+ REAL_CONST(101629.5155120936/8.0),
+ REAL_CONST(101653.32260771218/8.0),
+ REAL_CONST(101677.13109731126/8.0),
+ REAL_CONST(101700.9409807276/8.0),
+ REAL_CONST(101724.75225779804/8.0),
+ REAL_CONST(101748.56492835947/8.0),
+ REAL_CONST(101772.37899224881/8.0),
+ REAL_CONST(101796.19444930303/8.0),
+ REAL_CONST(101820.01129935916/8.0),
+ REAL_CONST(101843.82954225427/8.0),
+ REAL_CONST(101867.64917782549/8.0),
+ REAL_CONST(101891.47020590997/8.0),
+ REAL_CONST(101915.29262634492/8.0),
+ REAL_CONST(101939.11643896763/8.0),
+ REAL_CONST(101962.94164361537/8.0),
+ REAL_CONST(101986.76824012553/8.0),
+ REAL_CONST(102010.59622833549/8.0),
+ REAL_CONST(102034.42560808272/8.0),
+ REAL_CONST(102058.25637920471/8.0),
+ REAL_CONST(102082.08854153901/8.0),
+ REAL_CONST(102105.9220949232/8.0),
+ REAL_CONST(102129.75703919494/8.0),
+ REAL_CONST(102153.59337419191/8.0),
+ REAL_CONST(102177.43109975185/8.0),
+ REAL_CONST(102201.27021571253/8.0),
+ REAL_CONST(102225.1107219118/8.0),
+ REAL_CONST(102248.95261818753/8.0),
+ REAL_CONST(102272.79590437764/8.0),
+ REAL_CONST(102296.64058032009/8.0),
+ REAL_CONST(102320.48664585294/8.0),
+ REAL_CONST(102344.33410081422/8.0),
+ REAL_CONST(102368.18294504205/8.0),
+ REAL_CONST(102392.03317837461/8.0),
+ REAL_CONST(102415.88480065008/8.0),
+ REAL_CONST(102439.73781170673/8.0),
+ REAL_CONST(102463.59221138287/8.0),
+ REAL_CONST(102487.44799951684/8.0),
+ REAL_CONST(102511.30517594704/8.0),
+ REAL_CONST(102535.1637405119/8.0),
+ REAL_CONST(102559.02369304992/8.0),
+ REAL_CONST(102582.88503339965/8.0),
+ REAL_CONST(102606.74776139967/8.0),
+ REAL_CONST(102630.61187688859/8.0),
+ REAL_CONST(102654.4773797051/8.0),
+ REAL_CONST(102678.34426968795/8.0),
+ REAL_CONST(102702.21254667587/8.0),
+ REAL_CONST(102726.08221050771/8.0),
+ REAL_CONST(102749.95326102231/8.0),
+ REAL_CONST(102773.8256980586/8.0),
+ REAL_CONST(102797.69952145554/8.0),
+ REAL_CONST(102821.57473105213/8.0),
+ REAL_CONST(102845.45132668741/8.0),
+ REAL_CONST(102869.32930820051/8.0),
+ REAL_CONST(102893.20867543056/8.0),
+ REAL_CONST(102917.08942821674/8.0),
+ REAL_CONST(102940.97156639832/8.0),
+ REAL_CONST(102964.85508981455/8.0),
+ REAL_CONST(102988.73999830478/8.0),
+ REAL_CONST(103012.6262917084/8.0),
+ REAL_CONST(103036.51396986481/8.0),
+ REAL_CONST(103060.40303261351/8.0),
+ REAL_CONST(103084.293479794/8.0),
+ REAL_CONST(103108.18531124585/8.0),
+ REAL_CONST(103132.07852680866/8.0),
+ REAL_CONST(103155.97312632212/8.0),
+ REAL_CONST(103179.8691096259/8.0),
+ REAL_CONST(103203.76647655977/8.0),
+ REAL_CONST(103227.66522696352/8.0),
+ REAL_CONST(103251.56536067701/8.0),
+ REAL_CONST(103275.46687754011/8.0),
+ REAL_CONST(103299.36977739276/8.0),
+ REAL_CONST(103323.27406007495/8.0),
+ REAL_CONST(103347.1797254267/8.0),
+ REAL_CONST(103371.0867732881/8.0),
+ REAL_CONST(103394.99520349925/8.0),
+ REAL_CONST(103418.90501590034/8.0),
+ REAL_CONST(103442.81621033157/8.0),
+ REAL_CONST(103466.72878663319/8.0),
+ REAL_CONST(103490.64274464553/8.0),
+ REAL_CONST(103514.55808420894/8.0),
+ REAL_CONST(103538.4748051638/8.0),
+ REAL_CONST(103562.39290735057/8.0),
+ REAL_CONST(103586.31239060973/8.0),
+ REAL_CONST(103610.23325478184/8.0),
+ REAL_CONST(103634.15549970744/8.0),
+ REAL_CONST(103658.07912522719/8.0),
+ REAL_CONST(103682.00413118176/8.0),
+ REAL_CONST(103705.93051741188/8.0),
+ REAL_CONST(103729.85828375829/8.0),
+ REAL_CONST(103753.78743006183/8.0),
+ REAL_CONST(103777.71795616332/8.0),
+ REAL_CONST(103801.64986190372/8.0),
+ REAL_CONST(103825.58314712394/8.0),
+ REAL_CONST(103849.51781166498/8.0),
+ REAL_CONST(103873.4538553679/8.0),
+ REAL_CONST(103897.39127807376/8.0),
+ REAL_CONST(103921.33007962372/8.0),
+ REAL_CONST(103945.27025985894/8.0),
+ REAL_CONST(103969.21181862066/8.0),
+ REAL_CONST(103993.15475575015/8.0),
+ REAL_CONST(104017.0990710887/8.0),
+ REAL_CONST(104041.0447644777/8.0),
+ REAL_CONST(104064.99183575854/8.0),
+ REAL_CONST(104088.94028477269/8.0),
+ REAL_CONST(104112.89011136163/8.0),
+ REAL_CONST(104136.84131536692/8.0),
+ REAL_CONST(104160.79389663014/8.0),
+ REAL_CONST(104184.74785499295/8.0),
+ REAL_CONST(104208.70319029699/8.0),
+ REAL_CONST(104232.65990238401/8.0),
+ REAL_CONST(104256.61799109577/8.0),
+ REAL_CONST(104280.57745627411/8.0),
+ REAL_CONST(104304.53829776087/8.0),
+ REAL_CONST(104328.50051539797/8.0),
+ REAL_CONST(104352.46410902737/8.0),
+ REAL_CONST(104376.42907849104/8.0),
+ REAL_CONST(104400.39542363105/8.0),
+ REAL_CONST(104424.36314428948/8.0),
+ REAL_CONST(104448.33224030846/8.0),
+ REAL_CONST(104472.3027115302/8.0),
+ REAL_CONST(104496.27455779689/8.0),
+ REAL_CONST(104520.24777895081/8.0),
+ REAL_CONST(104544.22237483428/8.0),
+ REAL_CONST(104568.19834528965/8.0),
+ REAL_CONST(104592.17569015936/8.0),
+ REAL_CONST(104616.15440928582/8.0),
+ REAL_CONST(104640.13450251156/8.0),
+ REAL_CONST(104664.1159696791/8.0),
+ REAL_CONST(104688.09881063103/8.0),
+ REAL_CONST(104712.08302520998/8.0),
+ REAL_CONST(104736.06861325864/8.0),
+ REAL_CONST(104760.05557461972/8.0),
+ REAL_CONST(104784.043909136/8.0),
+ REAL_CONST(104808.03361665027/8.0),
+ REAL_CONST(104832.0246970054/8.0),
+ REAL_CONST(104856.01715004431/8.0),
+ REAL_CONST(104880.01097560991/8.0),
+ REAL_CONST(104904.00617354522/8.0),
+ REAL_CONST(104928.00274369326/8.0),
+ REAL_CONST(104952.00068589712/8.0),
+ REAL_CONST(104975.99999999993/8.0),
+ REAL_CONST(105000.00068584486/8.0),
+ REAL_CONST(105024.00274327511/8.0),
+ REAL_CONST(105048.00617213396/8.0),
+ REAL_CONST(105072.0109722647/8.0),
+ REAL_CONST(105096.0171435107/8.0),
+ REAL_CONST(105120.02468571534/8.0),
+ REAL_CONST(105144.03359872208/8.0),
+ REAL_CONST(105168.04388237436/8.0),
+ REAL_CONST(105192.05553651576/8.0),
+ REAL_CONST(105216.06856098982/8.0),
+ REAL_CONST(105240.08295564017/8.0),
+ REAL_CONST(105264.09872031047/8.0),
+ REAL_CONST(105288.11585484444/8.0),
+ REAL_CONST(105312.13435908582/8.0),
+ REAL_CONST(105336.1542328784/8.0),
+ REAL_CONST(105360.17547606604/8.0),
+ REAL_CONST(105384.19808849262/8.0),
+ REAL_CONST(105408.22207000206/8.0),
+ REAL_CONST(105432.24742043833/8.0),
+ REAL_CONST(105456.27413964548/8.0),
+ REAL_CONST(105480.30222746753/8.0),
+ REAL_CONST(105504.33168374863/8.0),
+ REAL_CONST(105528.36250833291/8.0),
+ REAL_CONST(105552.39470106458/8.0),
+ REAL_CONST(105576.42826178786/8.0),
+ REAL_CONST(105600.46319034706/8.0),
+ REAL_CONST(105624.49948658649/8.0),
+ REAL_CONST(105648.53715035053/8.0),
+ REAL_CONST(105672.5761814836/8.0),
+ REAL_CONST(105696.61657983017/8.0),
+ REAL_CONST(105720.65834523473/8.0),
+ REAL_CONST(105744.70147754184/8.0),
+ REAL_CONST(105768.7459765961/8.0),
+ REAL_CONST(105792.79184224214/8.0),
+ REAL_CONST(105816.83907432464/8.0),
+ REAL_CONST(105840.88767268835/8.0),
+ REAL_CONST(105864.93763717801/8.0),
+ REAL_CONST(105888.98896763846/8.0),
+ REAL_CONST(105913.04166391456/8.0),
+ REAL_CONST(105937.09572585119/8.0),
+ REAL_CONST(105961.15115329332/8.0),
+ REAL_CONST(105985.20794608595/8.0),
+ REAL_CONST(106009.26610407409/8.0),
+ REAL_CONST(106033.32562710284/8.0),
+ REAL_CONST(106057.38651501729/8.0),
+ REAL_CONST(106081.44876766266/8.0),
+ REAL_CONST(106105.51238488412/8.0),
+ REAL_CONST(106129.57736652695/8.0),
+ REAL_CONST(106153.64371243643/8.0),
+ REAL_CONST(106177.71142245791/8.0),
+ REAL_CONST(106201.78049643678/8.0),
+ REAL_CONST(106225.85093421848/8.0),
+ REAL_CONST(106249.92273564848/8.0),
+ REAL_CONST(106273.99590057228/8.0),
+ REAL_CONST(106298.07042883546/8.0),
+ REAL_CONST(106322.14632028362/8.0),
+ REAL_CONST(106346.22357476239/8.0),
+ REAL_CONST(106370.30219211751/8.0),
+ REAL_CONST(106394.38217219469/8.0),
+ REAL_CONST(106418.46351483969/8.0),
+ REAL_CONST(106442.54621989837/8.0),
+ REAL_CONST(106466.63028721658/8.0),
+ REAL_CONST(106490.71571664025/8.0),
+ REAL_CONST(106514.80250801529/8.0),
+ REAL_CONST(106538.89066118775/8.0),
+ REAL_CONST(106562.98017600364/8.0),
+ REAL_CONST(106587.07105230905/8.0),
+ REAL_CONST(106611.16328995011/8.0),
+ REAL_CONST(106635.25688877302/8.0),
+ REAL_CONST(106659.35184862395/8.0),
+ REAL_CONST(106683.44816934918/8.0),
+ REAL_CONST(106707.54585079502/8.0),
+ REAL_CONST(106731.64489280782/8.0),
+ REAL_CONST(106755.74529523395/8.0),
+ REAL_CONST(106779.84705791986/8.0),
+ REAL_CONST(106803.95018071201/8.0),
+ REAL_CONST(106828.05466345693/8.0),
+ REAL_CONST(106852.16050600118/8.0),
+ REAL_CONST(106876.26770819137/8.0),
+ REAL_CONST(106900.37626987413/8.0),
+ REAL_CONST(106924.48619089619/8.0),
+ REAL_CONST(106948.59747110425/8.0),
+ REAL_CONST(106972.71011034511/8.0),
+ REAL_CONST(106996.82410846559/8.0),
+ REAL_CONST(107020.93946531253/8.0),
+ REAL_CONST(107045.05618073288/8.0),
+ REAL_CONST(107069.17425457356/8.0),
+ REAL_CONST(107093.29368668159/8.0),
+ REAL_CONST(107117.41447690397/8.0),
+ REAL_CONST(107141.53662508781/8.0),
+ REAL_CONST(107165.66013108024/8.0),
+ REAL_CONST(107189.7849947284/8.0),
+ REAL_CONST(107213.91121587952/8.0),
+ REAL_CONST(107238.03879438085/8.0),
+ REAL_CONST(107262.16773007967/8.0),
+ REAL_CONST(107286.29802282334/8.0),
+ REAL_CONST(107310.42967245923/8.0),
+ REAL_CONST(107334.56267883476/8.0),
+ REAL_CONST(107358.69704179741/8.0),
+ REAL_CONST(107382.83276119467/8.0),
+ REAL_CONST(107406.96983687414/8.0),
+ REAL_CONST(107431.10826868335/8.0),
+ REAL_CONST(107455.24805646999/8.0),
+ REAL_CONST(107479.38920008171/8.0),
+ REAL_CONST(107503.53169936626/8.0),
+ REAL_CONST(107527.67555417139/8.0),
+ REAL_CONST(107551.82076434491/8.0),
+ REAL_CONST(107575.96732973469/8.0),
+ REAL_CONST(107600.11525018861/8.0),
+ REAL_CONST(107624.26452555459/8.0),
+ REAL_CONST(107648.41515568066/8.0),
+ REAL_CONST(107672.56714041479/8.0),
+ REAL_CONST(107696.72047960508/8.0),
+ REAL_CONST(107720.87517309963/8.0),
+ REAL_CONST(107745.03122074658/8.0),
+ REAL_CONST(107769.18862239413/8.0),
+ REAL_CONST(107793.34737789053/8.0),
+ REAL_CONST(107817.50748708403/8.0),
+ REAL_CONST(107841.66894982298/8.0),
+ REAL_CONST(107865.83176595572/8.0),
+ REAL_CONST(107889.99593533068/8.0),
+ REAL_CONST(107914.16145779629/8.0),
+ REAL_CONST(107938.32833320105/8.0),
+ REAL_CONST(107962.49656139348/8.0),
+ REAL_CONST(107986.66614222217/8.0),
+ REAL_CONST(108010.83707553572/8.0),
+ REAL_CONST(108035.00936118282/8.0),
+ REAL_CONST(108059.18299901215/8.0),
+ REAL_CONST(108083.35798887245/8.0),
+ REAL_CONST(108107.53433061253/8.0),
+ REAL_CONST(108131.71202408121/8.0),
+ REAL_CONST(108155.89106912735/8.0),
+ REAL_CONST(108180.07146559987/8.0),
+ REAL_CONST(108204.25321334775/8.0),
+ REAL_CONST(108228.43631221994/8.0),
+ REAL_CONST(108252.62076206553/8.0),
+ REAL_CONST(108276.80656273357/8.0),
+ REAL_CONST(108300.99371407321/8.0),
+ REAL_CONST(108325.18221593359/8.0),
+ REAL_CONST(108349.37206816394/8.0),
+ REAL_CONST(108373.56327061349/8.0),
+ REAL_CONST(108397.75582313156/8.0),
+ REAL_CONST(108421.94972556747/8.0),
+ REAL_CONST(108446.1449777706/8.0),
+ REAL_CONST(108470.34157959036/8.0),
+ REAL_CONST(108494.53953087622/8.0),
+ REAL_CONST(108518.73883147769/8.0),
+ REAL_CONST(108542.93948124432/8.0),
+ REAL_CONST(108567.14148002568/8.0),
+ REAL_CONST(108591.34482767139/8.0),
+ REAL_CONST(108615.54952403114/8.0),
+ REAL_CONST(108639.75556895464/8.0),
+ REAL_CONST(108663.96296229165/8.0),
+ REAL_CONST(108688.17170389196/8.0),
+ REAL_CONST(108712.38179360541/8.0),
+ REAL_CONST(108736.59323128188/8.0),
+ REAL_CONST(108760.80601677128/8.0),
+ REAL_CONST(108785.02014992358/8.0),
+ REAL_CONST(108809.23563058881/8.0),
+ REAL_CONST(108833.45245861699/8.0),
+ REAL_CONST(108857.67063385822/8.0),
+ REAL_CONST(108881.89015616261/8.0),
+ REAL_CONST(108906.11102538036/8.0),
+ REAL_CONST(108930.33324136167/8.0),
+ REAL_CONST(108954.55680395682/8.0),
+ REAL_CONST(108978.78171301607/8.0),
+ REAL_CONST(109003.00796838976/8.0),
+ REAL_CONST(109027.23556992831/8.0),
+ REAL_CONST(109051.46451748211/8.0),
+ REAL_CONST(109075.69481090162/8.0),
+ REAL_CONST(109099.92645003737/8.0),
+ REAL_CONST(109124.15943473989/8.0),
+ REAL_CONST(109148.39376485976/8.0),
+ REAL_CONST(109172.62944024763/8.0),
+ REAL_CONST(109196.86646075416/8.0),
+ REAL_CONST(109221.10482623006/8.0),
+ REAL_CONST(109245.34453652608/8.0),
+ REAL_CONST(109269.58559149304/8.0),
+ REAL_CONST(109293.82799098175/8.0),
+ REAL_CONST(109318.07173484311/8.0),
+ REAL_CONST(109342.31682292801/8.0),
+ REAL_CONST(109366.56325508743/8.0),
+ REAL_CONST(109390.81103117237/8.0),
+ REAL_CONST(109415.06015103387/8.0),
+ REAL_CONST(109439.31061452301/8.0),
+ REAL_CONST(109463.56242149093/8.0),
+ REAL_CONST(109487.8155717888/8.0),
+ REAL_CONST(109512.07006526781/8.0),
+ REAL_CONST(109536.3259017792/8.0),
+ REAL_CONST(109560.58308117429/8.0),
+ REAL_CONST(109584.8416033044/8.0),
+ REAL_CONST(109609.1014680209/8.0),
+ REAL_CONST(109633.36267517522/8.0),
+ REAL_CONST(109657.62522461878/8.0),
+ REAL_CONST(109681.88911620311/8.0),
+ REAL_CONST(109706.15434977971/8.0),
+ REAL_CONST(109730.4209252002/8.0),
+ REAL_CONST(109754.68884231619/8.0),
+ REAL_CONST(109778.95810097932/8.0),
+ REAL_CONST(109803.22870104131/8.0),
+ REAL_CONST(109827.50064235389/8.0),
+ REAL_CONST(109851.77392476884/8.0),
+ REAL_CONST(109876.04854813802/8.0),
+ REAL_CONST(109900.32451231324/8.0),
+ REAL_CONST(109924.60181714644/8.0),
+ REAL_CONST(109948.88046248957/8.0),
+ REAL_CONST(109973.1604481946/8.0),
+ REAL_CONST(109997.44177411357/8.0),
+ REAL_CONST(110021.72444009855/8.0),
+ REAL_CONST(110046.00844600165/8.0),
+ REAL_CONST(110070.29379167501/8.0),
+ REAL_CONST(110094.58047697082/8.0),
+ REAL_CONST(110118.86850174134/8.0),
+ REAL_CONST(110143.15786583882/8.0),
+ REAL_CONST(110167.44856911557/8.0),
+ REAL_CONST(110191.74061142397/8.0),
+ REAL_CONST(110216.03399261639/8.0),
+ REAL_CONST(110240.32871254528/8.0),
+ REAL_CONST(110264.62477106311/8.0),
+ REAL_CONST(110288.9221680224/8.0),
+ REAL_CONST(110313.22090327571/8.0),
+ REAL_CONST(110337.52097667565/8.0),
+ REAL_CONST(110361.82238807483/8.0),
+ REAL_CONST(110386.12513732594/8.0),
+ REAL_CONST(110410.42922428172/8.0),
+ REAL_CONST(110434.73464879491/8.0),
+ REAL_CONST(110459.04141071832/8.0),
+ REAL_CONST(110483.34950990479/8.0),
+ REAL_CONST(110507.6589462072/8.0),
+ REAL_CONST(110531.96971947847/8.0),
+ REAL_CONST(110556.28182957157/8.0),
+ REAL_CONST(110580.5952763395/8.0),
+ REAL_CONST(110604.91005963532/8.0),
+ REAL_CONST(110629.22617931209/8.0),
+ REAL_CONST(110653.54363522294/8.0),
+ REAL_CONST(110677.86242722106/8.0),
+ REAL_CONST(110702.18255515963/8.0),
+ REAL_CONST(110726.50401889188/8.0),
+ REAL_CONST(110750.82681827113/8.0),
+ REAL_CONST(110775.1509531507/8.0),
+ REAL_CONST(110799.47642338395/8.0),
+ REAL_CONST(110823.80322882428/8.0),
+ REAL_CONST(110848.13136932514/8.0),
+ REAL_CONST(110872.46084474004/8.0),
+ REAL_CONST(110896.79165492248/8.0),
+ REAL_CONST(110921.12379972603/8.0),
+ REAL_CONST(110945.4572790043/8.0),
+ REAL_CONST(110969.79209261097/8.0),
+ REAL_CONST(110994.12824039967/8.0),
+ REAL_CONST(111018.46572222417/8.0),
+ REAL_CONST(111042.80453793822/8.0),
+ REAL_CONST(111067.14468739564/8.0),
+ REAL_CONST(111091.48617045028/8.0),
+ REAL_CONST(111115.82898695602/8.0),
+ REAL_CONST(111140.1731367668/8.0),
+ REAL_CONST(111164.51861973655/8.0),
+ REAL_CONST(111188.86543571933/8.0),
+ REAL_CONST(111213.21358456917/8.0),
+ REAL_CONST(111237.56306614014/8.0),
+ REAL_CONST(111261.91388028639/8.0),
+ REAL_CONST(111286.26602686207/8.0),
+ REAL_CONST(111310.61950572141/8.0),
+ REAL_CONST(111334.97431671864/8.0),
+ REAL_CONST(111359.33045970804/8.0),
+ REAL_CONST(111383.68793454397/8.0),
+ REAL_CONST(111408.04674108078/8.0),
+ REAL_CONST(111432.40687917286/8.0),
+ REAL_CONST(111456.76834867468/8.0),
+ REAL_CONST(111481.13114944073/8.0),
+ REAL_CONST(111505.49528132551/8.0),
+ REAL_CONST(111529.86074418361/8.0),
+ REAL_CONST(111554.22753786964/8.0),
+ REAL_CONST(111578.59566223821/8.0),
+ REAL_CONST(111602.96511714405/8.0),
+ REAL_CONST(111627.33590244185/8.0),
+ REAL_CONST(111651.7080179864/8.0),
+ REAL_CONST(111676.08146363248/8.0),
+ REAL_CONST(111700.45623923496/8.0),
+ REAL_CONST(111724.8323446487/8.0),
+ REAL_CONST(111749.20977972864/8.0),
+ REAL_CONST(111773.58854432974/8.0),
+ REAL_CONST(111797.96863830699/8.0),
+ REAL_CONST(111822.35006151545/8.0),
+ REAL_CONST(111846.73281381019/8.0),
+ REAL_CONST(111871.11689504632/8.0),
+ REAL_CONST(111895.50230507903/8.0),
+ REAL_CONST(111919.8890437635/8.0),
+ REAL_CONST(111944.27711095495/8.0),
+ REAL_CONST(111968.6665065087/8.0),
+ REAL_CONST(111993.05723028004/8.0),
+ REAL_CONST(112017.44928212435/8.0),
+ REAL_CONST(112041.842661897/8.0),
+ REAL_CONST(112066.23736945343/8.0),
+ REAL_CONST(112090.63340464912/8.0),
+ REAL_CONST(112115.03076733962/8.0),
+ REAL_CONST(112139.42945738042/8.0),
+ REAL_CONST(112163.82947462716/8.0),
+ REAL_CONST(112188.23081893545/8.0),
+ REAL_CONST(112212.63349016097/8.0),
+ REAL_CONST(112237.03748815943/8.0),
+ REAL_CONST(112261.44281278658/8.0),
+ REAL_CONST(112285.84946389822/8.0),
+ REAL_CONST(112310.25744135017/8.0),
+ REAL_CONST(112334.66674499828/8.0),
+ REAL_CONST(112359.07737469849/8.0),
+ REAL_CONST(112383.48933030672/8.0),
+ REAL_CONST(112407.90261167898/8.0),
+ REAL_CONST(112432.31721867126/8.0),
+ REAL_CONST(112456.73315113965/8.0),
+ REAL_CONST(112481.15040894024/8.0),
+ REAL_CONST(112505.56899192919/8.0),
+ REAL_CONST(112529.98889996267/8.0),
+ REAL_CONST(112554.41013289688/8.0),
+ REAL_CONST(112578.8326905881/8.0),
+ REAL_CONST(112603.25657289263/8.0),
+ REAL_CONST(112627.68177966679/8.0),
+ REAL_CONST(112652.10831076698/8.0),
+ REAL_CONST(112676.53616604958/8.0),
+ REAL_CONST(112700.96534537108/8.0),
+ REAL_CONST(112725.39584858794/8.0),
+ REAL_CONST(112749.82767555672/8.0),
+ REAL_CONST(112774.26082613398/8.0),
+ REAL_CONST(112798.6953001763/8.0),
+ REAL_CONST(112823.13109754038/8.0),
+ REAL_CONST(112847.56821808286/8.0),
+ REAL_CONST(112872.00666166049/8.0),
+ REAL_CONST(112896.44642813003/8.0),
+ REAL_CONST(112920.88751734827/8.0),
+ REAL_CONST(112945.32992917208/8.0),
+ REAL_CONST(112969.77366345831/8.0),
+ REAL_CONST(112994.21872006389/8.0),
+ REAL_CONST(113018.66509884578/8.0),
+ REAL_CONST(113043.11279966099/8.0),
+ REAL_CONST(113067.56182236652/8.0),
+ REAL_CONST(113092.01216681948/8.0),
+ REAL_CONST(113116.46383287695/8.0),
+ REAL_CONST(113140.9168203961/8.0),
+ REAL_CONST(113165.37112923413/8.0),
+ REAL_CONST(113189.82675924824/8.0),
+ REAL_CONST(113214.28371029573/8.0),
+ REAL_CONST(113238.74198223387/8.0),
+ REAL_CONST(113263.20157492002/8.0),
+ REAL_CONST(113287.66248821157/8.0),
+ REAL_CONST(113312.12472196593/8.0),
+ REAL_CONST(113336.58827604055/8.0),
+ REAL_CONST(113361.05315029295/8.0),
+ REAL_CONST(113385.51934458067/8.0),
+ REAL_CONST(113409.98685876124/8.0),
+ REAL_CONST(113434.45569269233/8.0),
+ REAL_CONST(113458.92584623155/8.0),
+ REAL_CONST(113483.39731923661/8.0),
+ REAL_CONST(113507.87011156522/8.0),
+ REAL_CONST(113532.34422307517/8.0),
+ REAL_CONST(113556.81965362425/8.0),
+ REAL_CONST(113581.2964030703/8.0),
+ REAL_CONST(113605.77447127122/8.0),
+ REAL_CONST(113630.25385808491/8.0),
+ REAL_CONST(113654.73456336933/8.0),
+ REAL_CONST(113679.2165869825/8.0),
+ REAL_CONST(113703.69992878241/8.0),
+ REAL_CONST(113728.18458862718/8.0),
+ REAL_CONST(113752.67056637487/8.0),
+ REAL_CONST(113777.15786188368/8.0),
+ REAL_CONST(113801.64647501177/8.0),
+ REAL_CONST(113826.13640561736/8.0),
+ REAL_CONST(113850.62765355874/8.0),
+ REAL_CONST(113875.12021869418/8.0),
+ REAL_CONST(113899.61410088204/8.0),
+ REAL_CONST(113924.1092999807/8.0),
+ REAL_CONST(113948.60581584855/8.0),
+ REAL_CONST(113973.10364834407/8.0),
+ REAL_CONST(113997.60279732574/8.0),
+ REAL_CONST(114022.1032626521/8.0),
+ REAL_CONST(114046.60504418171/8.0),
+ REAL_CONST(114071.10814177318/8.0),
+ REAL_CONST(114095.61255528514/8.0),
+ REAL_CONST(114120.11828457628/8.0),
+ REAL_CONST(114144.62532950533/8.0),
+ REAL_CONST(114169.13368993104/8.0),
+ REAL_CONST(114193.6433657122/8.0),
+ REAL_CONST(114218.15435670764/8.0),
+ REAL_CONST(114242.66666277625/8.0),
+ REAL_CONST(114267.18028377694/8.0),
+ REAL_CONST(114291.69521956862/8.0),
+ REAL_CONST(114316.21147001031/8.0),
+ REAL_CONST(114340.72903496103/8.0),
+ REAL_CONST(114365.24791427983/8.0),
+ REAL_CONST(114389.7681078258/8.0),
+ REAL_CONST(114414.2896154581/8.0),
+ REAL_CONST(114438.81243703589/8.0),
+ REAL_CONST(114463.33657241837/8.0),
+ REAL_CONST(114487.8620214648/8.0),
+ REAL_CONST(114512.38878403447/8.0),
+ REAL_CONST(114536.91685998671/8.0),
+ REAL_CONST(114561.44624918087/8.0),
+ REAL_CONST(114585.97695147636/8.0),
+ REAL_CONST(114610.5089667326/8.0),
+ REAL_CONST(114635.04229480909/8.0),
+ REAL_CONST(114659.57693556532/8.0),
+ REAL_CONST(114684.11288886084/8.0),
+ REAL_CONST(114708.65015455526/8.0),
+ REAL_CONST(114733.18873250818/8.0),
+ REAL_CONST(114757.72862257928/8.0),
+ REAL_CONST(114782.26982462825/8.0),
+ REAL_CONST(114806.81233851484/8.0),
+ REAL_CONST(114831.35616409882/8.0),
+ REAL_CONST(114855.90130123998/8.0),
+ REAL_CONST(114880.44774979822/8.0),
+ REAL_CONST(114904.99550963337/8.0),
+ REAL_CONST(114929.5445806054/8.0),
+ REAL_CONST(114954.09496257425/8.0),
+ REAL_CONST(114978.64665539992/8.0),
+ REAL_CONST(115003.19965894247/8.0),
+ REAL_CONST(115027.75397306195/8.0),
+ REAL_CONST(115052.30959761847/8.0),
+ REAL_CONST(115076.86653247218/8.0),
+ REAL_CONST(115101.42477748329/8.0),
+ REAL_CONST(115125.984332512/8.0),
+ REAL_CONST(115150.54519741859/8.0),
+ REAL_CONST(115175.10737206334/8.0),
+ REAL_CONST(115199.67085630659/8.0),
+ REAL_CONST(115224.23565000873/8.0),
+ REAL_CONST(115248.80175303014/8.0),
+ REAL_CONST(115273.3691652313/8.0),
+ REAL_CONST(115297.93788647266/8.0),
+ REAL_CONST(115322.50791661476/8.0),
+ REAL_CONST(115347.07925551817/8.0),
+ REAL_CONST(115371.65190304347/8.0),
+ REAL_CONST(115396.22585905129/8.0),
+ REAL_CONST(115420.80112340231/8.0),
+ REAL_CONST(115445.37769595724/8.0),
+ REAL_CONST(115469.95557657682/8.0),
+ REAL_CONST(115494.53476512182/8.0),
+ REAL_CONST(115519.11526145306/8.0),
+ REAL_CONST(115543.69706543141/8.0),
+ REAL_CONST(115568.28017691776/8.0),
+ REAL_CONST(115592.86459577303/8.0),
+ REAL_CONST(115617.4503218582/8.0),
+ REAL_CONST(115642.03735503425/8.0),
+ REAL_CONST(115666.62569516223/8.0),
+ REAL_CONST(115691.21534210323/8.0),
+ REAL_CONST(115715.80629571836/8.0),
+ REAL_CONST(115740.39855586876/8.0),
+ REAL_CONST(115764.99212241563/8.0),
+ REAL_CONST(115789.58699522018/8.0),
+ REAL_CONST(115814.18317414368/8.0),
+ REAL_CONST(115838.78065904744/8.0),
+ REAL_CONST(115863.37944979276/8.0),
+ REAL_CONST(115887.97954624105/8.0),
+ REAL_CONST(115912.5809482537/8.0),
+ REAL_CONST(115937.18365569216/8.0),
+ REAL_CONST(115961.78766841792/8.0),
+ REAL_CONST(115986.39298629249/8.0),
+ REAL_CONST(116010.99960917742/8.0),
+ REAL_CONST(116035.60753693432/8.0),
+ REAL_CONST(116060.21676942479/8.0),
+ REAL_CONST(116084.82730651053/8.0),
+ REAL_CONST(116109.43914805322/8.0),
+ REAL_CONST(116134.0522939146/8.0),
+ REAL_CONST(116158.66674395646/8.0),
+ REAL_CONST(116183.2824980406/8.0),
+ REAL_CONST(116207.89955602887/8.0),
+ REAL_CONST(116232.51791778316/8.0),
+ REAL_CONST(116257.13758316539/8.0),
+ REAL_CONST(116281.75855203751/8.0),
+ REAL_CONST(116306.38082426153/8.0),
+ REAL_CONST(116331.00439969949/8.0),
+ REAL_CONST(116355.62927821343/8.0),
+ REAL_CONST(116380.25545966547/8.0),
+ REAL_CONST(116404.88294391775/8.0),
+ REAL_CONST(116429.51173083246/8.0),
+ REAL_CONST(116454.14182027178/8.0),
+ REAL_CONST(116478.77321209799/8.0),
+ REAL_CONST(116503.40590617337/8.0),
+ REAL_CONST(116528.03990236025/8.0),
+ REAL_CONST(116552.67520052097/8.0),
+ REAL_CONST(116577.31180051794/8.0),
+ REAL_CONST(116601.94970221359/8.0),
+ REAL_CONST(116626.5889054704/8.0),
+ REAL_CONST(116651.22941015086/8.0),
+ REAL_CONST(116675.87121611751/8.0),
+ REAL_CONST(116700.51432323294/8.0),
+ REAL_CONST(116725.15873135976/8.0),
+ REAL_CONST(116749.8044403606/8.0),
+ REAL_CONST(116774.45145009817/8.0),
+ REAL_CONST(116799.0997604352/8.0),
+ REAL_CONST(116823.74937123443/8.0),
+ REAL_CONST(116848.40028235866/8.0),
+ REAL_CONST(116873.05249367072/8.0),
+ REAL_CONST(116897.70600503348/8.0),
+ REAL_CONST(116922.36081630984/8.0),
+ REAL_CONST(116947.01692736275/8.0),
+ REAL_CONST(116971.67433805518/8.0),
+ REAL_CONST(116996.33304825013/8.0),
+ REAL_CONST(117020.99305781067/8.0),
+ REAL_CONST(117045.65436659988/8.0),
+ REAL_CONST(117070.31697448085/8.0),
+ REAL_CONST(117094.98088131678/8.0),
+ REAL_CONST(117119.64608697082/8.0),
+ REAL_CONST(117144.31259130624/8.0),
+ REAL_CONST(117168.98039418629/8.0),
+ REAL_CONST(117193.64949547425/8.0),
+ REAL_CONST(117218.31989503348/8.0),
+ REAL_CONST(117242.99159272734/8.0),
+ REAL_CONST(117267.66458841923/8.0),
+ REAL_CONST(117292.33888197262/8.0),
+ REAL_CONST(117317.01447325097/8.0),
+ REAL_CONST(117341.6913621178/8.0),
+ REAL_CONST(117366.36954843666/8.0),
+ REAL_CONST(117391.04903207115/8.0),
+ REAL_CONST(117415.72981288488/8.0),
+ REAL_CONST(117440.41189074152/8.0),
+ REAL_CONST(117465.09526550474/8.0),
+ REAL_CONST(117489.77993703831/8.0),
+ REAL_CONST(117514.46590520597/8.0),
+ REAL_CONST(117539.15316987153/8.0),
+ REAL_CONST(117563.84173089883/8.0),
+ REAL_CONST(117588.53158815173/8.0),
+ REAL_CONST(117613.22274149416/8.0),
+ REAL_CONST(117637.91519079007/8.0),
+ REAL_CONST(117662.60893590341/8.0),
+ REAL_CONST(117687.30397669821/8.0),
+ REAL_CONST(117712.00031303853/8.0),
+ REAL_CONST(117736.69794478847/8.0),
+ REAL_CONST(117761.39687181212/8.0),
+ REAL_CONST(117786.09709397367/8.0),
+ REAL_CONST(117810.7986111373/8.0),
+ REAL_CONST(117835.50142316725/8.0),
+ REAL_CONST(117860.20552992777/8.0),
+ REAL_CONST(117884.91093128319/8.0),
+ REAL_CONST(117909.6176270978/8.0),
+ REAL_CONST(117934.32561723603/8.0),
+ REAL_CONST(117959.03490156225/8.0),
+ REAL_CONST(117983.74547994092/8.0),
+ REAL_CONST(118008.45735223651/8.0),
+ REAL_CONST(118033.17051831353/8.0),
+ REAL_CONST(118057.88497803656/8.0),
+ REAL_CONST(118082.60073127014/8.0),
+ REAL_CONST(118107.31777787894/8.0),
+ REAL_CONST(118132.03611772758/8.0),
+ REAL_CONST(118156.75575068076/8.0),
+ REAL_CONST(118181.47667660323/8.0),
+ REAL_CONST(118206.19889535972/8.0),
+ REAL_CONST(118230.92240681504/8.0),
+ REAL_CONST(118255.64721083404/8.0),
+ REAL_CONST(118280.37330728157/8.0),
+ REAL_CONST(118305.10069602253/8.0),
+ REAL_CONST(118329.82937692189/8.0),
+ REAL_CONST(118354.55934984458/8.0),
+ REAL_CONST(118379.29061465565/8.0),
+ REAL_CONST(118404.02317122012/8.0),
+ REAL_CONST(118428.75701940308/8.0),
+ REAL_CONST(118453.49215906965/8.0),
+ REAL_CONST(118478.22859008498/8.0),
+ REAL_CONST(118502.96631231424/8.0),
+ REAL_CONST(118527.70532562268/8.0),
+ REAL_CONST(118552.44562987552/8.0),
+ REAL_CONST(118577.18722493808/8.0),
+ REAL_CONST(118601.93011067568/8.0),
+ REAL_CONST(118626.67428695368/8.0),
+ REAL_CONST(118651.41975363747/8.0),
+ REAL_CONST(118676.16651059251/8.0),
+ REAL_CONST(118700.91455768423/8.0),
+ REAL_CONST(118725.66389477813/8.0),
+ REAL_CONST(118750.41452173979/8.0),
+ REAL_CONST(118775.16643843475/8.0),
+ REAL_CONST(118799.91964472862/8.0),
+ REAL_CONST(118824.67414048707/8.0),
+ REAL_CONST(118849.42992557574/8.0),
+ REAL_CONST(118874.18699986035/8.0),
+ REAL_CONST(118898.94536320666/8.0),
+ REAL_CONST(118923.70501548045/8.0),
+ REAL_CONST(118948.46595654752/8.0),
+ REAL_CONST(118973.22818627374/8.0),
+ REAL_CONST(118997.99170452499/8.0),
+ REAL_CONST(119022.7565111672/8.0),
+ REAL_CONST(119047.52260606633/8.0),
+ REAL_CONST(119072.28998908834/8.0),
+ REAL_CONST(119097.0586600993/8.0),
+ REAL_CONST(119121.82861896523/8.0),
+ REAL_CONST(119146.59986555226/8.0),
+ REAL_CONST(119171.3723997265/8.0),
+ REAL_CONST(119196.14622135412/8.0),
+ REAL_CONST(119220.92133030134/8.0),
+ REAL_CONST(119245.69772643436/8.0),
+ REAL_CONST(119270.47540961947/8.0),
+ REAL_CONST(119295.25437972297/8.0),
+ REAL_CONST(119320.03463661121/8.0),
+ REAL_CONST(119344.81618015055/8.0),
+ REAL_CONST(119369.5990102074/8.0),
+ REAL_CONST(119394.38312664822/8.0),
+ REAL_CONST(119419.16852933947/8.0),
+ REAL_CONST(119443.95521814766/8.0),
+ REAL_CONST(119468.74319293935/8.0),
+ REAL_CONST(119493.53245358112/8.0),
+ REAL_CONST(119518.32299993958/8.0),
+ REAL_CONST(119543.11483188139/8.0),
+ REAL_CONST(119567.90794927324/8.0),
+ REAL_CONST(119592.70235198183/8.0),
+ REAL_CONST(119617.49803987393/8.0),
+ REAL_CONST(119642.29501281632/8.0),
+ REAL_CONST(119667.09327067583/8.0),
+ REAL_CONST(119691.89281331931/8.0),
+ REAL_CONST(119716.69364061367/8.0),
+ REAL_CONST(119741.49575242582/8.0),
+ REAL_CONST(119766.29914862274/8.0),
+ REAL_CONST(119791.10382907141/8.0),
+ REAL_CONST(119815.90979363887/8.0),
+ REAL_CONST(119840.71704219218/8.0),
+ REAL_CONST(119865.52557459843/8.0),
+ REAL_CONST(119890.33539072477/8.0),
+ REAL_CONST(119915.14649043836/8.0),
+ REAL_CONST(119939.95887360642/8.0),
+ REAL_CONST(119964.77254009615/8.0),
+ REAL_CONST(119989.58748977486/8.0),
+ REAL_CONST(120014.40372250983/8.0),
+ REAL_CONST(120039.22123816841/8.0),
+ REAL_CONST(120064.04003661797/8.0),
+ REAL_CONST(120088.86011772591/8.0),
+ REAL_CONST(120113.6814813597/8.0),
+ REAL_CONST(120138.5041273868/8.0),
+ REAL_CONST(120163.3280556747/8.0),
+ REAL_CONST(120188.15326609099/8.0),
+ REAL_CONST(120212.97975850321/8.0),
+ REAL_CONST(120237.807532779/8.0),
+ REAL_CONST(120262.63658878599/8.0),
+ REAL_CONST(120287.46692639188/8.0),
+ REAL_CONST(120312.29854546436/8.0),
+ REAL_CONST(120337.13144587121/8.0),
+ REAL_CONST(120361.9656274802/8.0),
+ REAL_CONST(120386.80109015915/8.0),
+ REAL_CONST(120411.63783377589/8.0),
+ REAL_CONST(120436.47585819835/8.0),
+ REAL_CONST(120461.31516329442/8.0),
+ REAL_CONST(120486.15574893207/8.0),
+ REAL_CONST(120510.99761497928/8.0),
+ REAL_CONST(120535.84076130406/8.0),
+ REAL_CONST(120560.68518777451/8.0),
+ REAL_CONST(120585.53089425867/8.0),
+ REAL_CONST(120610.3778806247/8.0),
+ REAL_CONST(120635.22614674074/8.0),
+ REAL_CONST(120660.07569247499/8.0),
+ REAL_CONST(120684.92651769568/8.0),
+ REAL_CONST(120709.77862227106/8.0),
+ REAL_CONST(120734.63200606944/8.0),
+ REAL_CONST(120759.48666895913/8.0),
+ REAL_CONST(120784.3426108085/8.0),
+ REAL_CONST(120809.19983148595/8.0),
+ REAL_CONST(120834.05833085992/8.0),
+ REAL_CONST(120858.91810879884/8.0),
+ REAL_CONST(120883.77916517125/8.0),
+ REAL_CONST(120908.64149984565/8.0),
+ REAL_CONST(120933.5051126906/8.0),
+ REAL_CONST(120958.37000357473/8.0),
+ REAL_CONST(120983.23617236665/8.0),
+ REAL_CONST(121008.10361893504/8.0),
+ REAL_CONST(121032.97234314861/8.0),
+ REAL_CONST(121057.84234487606/8.0),
+ REAL_CONST(121082.71362398617/8.0),
+ REAL_CONST(121107.58618034775/8.0),
+ REAL_CONST(121132.46001382964/8.0),
+ REAL_CONST(121157.33512430069/8.0),
+ REAL_CONST(121182.21151162982/8.0),
+ REAL_CONST(121207.08917568595/8.0),
+ REAL_CONST(121231.96811633807/8.0),
+ REAL_CONST(121256.84833345517/8.0),
+ REAL_CONST(121281.72982690629/8.0),
+ REAL_CONST(121306.61259656049/8.0),
+ REAL_CONST(121331.49664228689/8.0),
+ REAL_CONST(121356.38196395461/8.0),
+ REAL_CONST(121381.26856143285/8.0),
+ REAL_CONST(121406.15643459078/8.0),
+ REAL_CONST(121431.04558329767/8.0),
+ REAL_CONST(121455.93600742276/8.0),
+ REAL_CONST(121480.82770683538/8.0),
+ REAL_CONST(121505.72068140487/8.0),
+ REAL_CONST(121530.61493100057/8.0),
+ REAL_CONST(121555.51045549192/8.0),
+ REAL_CONST(121580.40725474835/8.0),
+ REAL_CONST(121605.30532863933/8.0),
+ REAL_CONST(121630.20467703436/8.0),
+ REAL_CONST(121655.10529980299/8.0),
+ REAL_CONST(121680.00719681478/8.0),
+ REAL_CONST(121704.91036793934/8.0),
+ REAL_CONST(121729.81481304632/8.0),
+ REAL_CONST(121754.72053200539/8.0),
+ REAL_CONST(121779.62752468624/8.0),
+ REAL_CONST(121804.53579095862/8.0),
+ REAL_CONST(121829.44533069231/8.0),
+ REAL_CONST(121854.3561437571/8.0),
+ REAL_CONST(121879.26823002285/8.0),
+ REAL_CONST(121904.1815893594/8.0),
+ REAL_CONST(121929.09622163669/8.0),
+ REAL_CONST(121954.01212672464/8.0),
+ REAL_CONST(121978.92930449323/8.0),
+ REAL_CONST(122003.84775481246/8.0),
+ REAL_CONST(122028.76747755238/8.0),
+ REAL_CONST(122053.68847258303/8.0),
+ REAL_CONST(122078.61073977455/8.0),
+ REAL_CONST(122103.53427899707/8.0),
+ REAL_CONST(122128.45909012076/8.0),
+ REAL_CONST(122153.38517301581/8.0),
+ REAL_CONST(122178.31252755247/8.0),
+ REAL_CONST(122203.24115360099/8.0),
+ REAL_CONST(122228.17105103172/8.0),
+ REAL_CONST(122253.10221971494/8.0),
+ REAL_CONST(122278.03465952107/8.0),
+ REAL_CONST(122302.96837032049/8.0),
+ REAL_CONST(122327.90335198362/8.0),
+ REAL_CONST(122352.83960438096/8.0),
+ REAL_CONST(122377.777127383/8.0),
+ REAL_CONST(122402.71592086025/8.0),
+ REAL_CONST(122427.65598468333/8.0),
+ REAL_CONST(122452.59731872278/8.0),
+ REAL_CONST(122477.53992284928/8.0),
+ REAL_CONST(122502.48379693348/8.0),
+ REAL_CONST(122527.42894084606/8.0),
+ REAL_CONST(122552.37535445779/8.0),
+ REAL_CONST(122577.32303763942/8.0),
+ REAL_CONST(122602.27199026172/8.0),
+ REAL_CONST(122627.22221219557/8.0),
+ REAL_CONST(122652.17370331181/8.0),
+ REAL_CONST(122677.12646348133/8.0),
+ REAL_CONST(122702.08049257506/8.0),
+ REAL_CONST(122727.03579046397/8.0),
+ REAL_CONST(122751.99235701906/8.0),
+ REAL_CONST(122776.95019211136/8.0),
+ REAL_CONST(122801.9092956119/8.0),
+ REAL_CONST(122826.8696673918/8.0),
+ REAL_CONST(122851.83130732219/8.0),
+ REAL_CONST(122876.79421527422/8.0),
+ REAL_CONST(122901.75839111909/8.0),
+ REAL_CONST(122926.72383472799/8.0),
+ REAL_CONST(122951.69054597223/8.0),
+ REAL_CONST(122976.65852472307/8.0),
+ REAL_CONST(123001.62777085182/8.0),
+ REAL_CONST(123026.59828422987/8.0),
+ REAL_CONST(123051.57006472857/8.0),
+ REAL_CONST(123076.54311221937/8.0),
+ REAL_CONST(123101.5174265737/8.0),
+ REAL_CONST(123126.49300766307/8.0),
+ REAL_CONST(123151.46985535898/8.0),
+ REAL_CONST(123176.44796953299/8.0),
+ REAL_CONST(123201.42735005668/8.0),
+ REAL_CONST(123226.40799680166/8.0),
+ REAL_CONST(123251.38990963959/8.0),
+ REAL_CONST(123276.37308844214/8.0),
+ REAL_CONST(123301.35753308103/8.0),
+ REAL_CONST(123326.343243428/8.0),
+ REAL_CONST(123351.33021935483/8.0),
+ REAL_CONST(123376.31846073334/8.0),
+ REAL_CONST(123401.30796743535/8.0),
+ REAL_CONST(123426.29873933276/8.0),
+ REAL_CONST(123451.29077629748/8.0),
+ REAL_CONST(123476.28407820144/8.0),
+ REAL_CONST(123501.2786449166/8.0),
+ REAL_CONST(123526.27447631498/8.0),
+ REAL_CONST(123551.27157226863/8.0),
+ REAL_CONST(123576.26993264959/8.0),
+ REAL_CONST(123601.26955732999/8.0),
+ REAL_CONST(123626.27044618195/8.0),
+ REAL_CONST(123651.27259907764/8.0),
+ REAL_CONST(123676.27601588926/8.0),
+ REAL_CONST(123701.28069648903/8.0),
+ REAL_CONST(123726.28664074924/8.0),
+ REAL_CONST(123751.29384854218/8.0),
+ REAL_CONST(123776.30231974016/8.0),
+ REAL_CONST(123801.31205421555/8.0),
+ REAL_CONST(123826.32305184075/8.0),
+ REAL_CONST(123851.33531248817/8.0),
+ REAL_CONST(123876.34883603029/8.0),
+ REAL_CONST(123901.36362233957/8.0),
+ REAL_CONST(123926.37967128855/8.0),
+ REAL_CONST(123951.39698274979/8.0),
+ REAL_CONST(123976.41555659588/8.0),
+ REAL_CONST(124001.43539269941/8.0),
+ REAL_CONST(124026.45649093305/8.0),
+ REAL_CONST(124051.47885116948/8.0),
+ REAL_CONST(124076.50247328142/8.0),
+ REAL_CONST(124101.5273571416/8.0),
+ REAL_CONST(124126.55350262282/8.0),
+ REAL_CONST(124151.58090959788/8.0),
+ REAL_CONST(124176.60957793961/8.0),
+ REAL_CONST(124201.63950752091/8.0),
+ REAL_CONST(124226.67069821467/8.0),
+ REAL_CONST(124251.70314989384/8.0),
+ REAL_CONST(124276.73686243138/8.0),
+ REAL_CONST(124301.7718357003/8.0),
+ REAL_CONST(124326.80806957364/8.0),
+ REAL_CONST(124351.84556392446/8.0),
+ REAL_CONST(124376.88431862585/8.0),
+ REAL_CONST(124401.92433355095/8.0),
+ REAL_CONST(124426.96560857294/8.0),
+ REAL_CONST(124452.00814356498/8.0),
+ REAL_CONST(124477.05193840031/8.0),
+ REAL_CONST(124502.0969929522/8.0),
+ REAL_CONST(124527.14330709392/8.0),
+ REAL_CONST(124552.19088069882/8.0),
+ REAL_CONST(124577.23971364023/8.0),
+ REAL_CONST(124602.28980579154/8.0),
+ REAL_CONST(124627.34115702618/8.0),
+ REAL_CONST(124652.3937672176/8.0),
+ REAL_CONST(124677.44763623926/8.0),
+ REAL_CONST(124702.50276396469/8.0),
+ REAL_CONST(124727.55915026742/8.0),
+ REAL_CONST(124752.61679502104/8.0),
+ REAL_CONST(124777.67569809916/8.0),
+ REAL_CONST(124802.73585937542/8.0),
+ REAL_CONST(124827.79727872348/8.0),
+ REAL_CONST(124852.85995601704/8.0),
+ REAL_CONST(124877.92389112986/8.0),
+ REAL_CONST(124902.98908393568/8.0),
+ REAL_CONST(124928.05553430831/8.0),
+ REAL_CONST(124953.1232421216/8.0),
+ REAL_CONST(124978.19220724938/8.0),
+ REAL_CONST(125003.26242956554/8.0),
+ REAL_CONST(125028.33390894404/8.0),
+ REAL_CONST(125053.40664525882/8.0),
+ REAL_CONST(125078.48063838384/8.0),
+ REAL_CONST(125103.55588819318/8.0),
+ REAL_CONST(125128.63239456083/8.0),
+ REAL_CONST(125153.71015736091/8.0),
+ REAL_CONST(125178.78917646752/8.0),
+ REAL_CONST(125203.86945175481/8.0),
+ REAL_CONST(125228.95098309696/8.0),
+ REAL_CONST(125254.03377036817/8.0),
+ REAL_CONST(125279.1178134427/8.0),
+ REAL_CONST(125304.20311219479/8.0),
+ REAL_CONST(125329.28966649878/8.0),
+ REAL_CONST(125354.37747622898/8.0),
+ REAL_CONST(125379.46654125977/8.0),
+ REAL_CONST(125404.55686146552/8.0),
+ REAL_CONST(125429.6484367207/8.0),
+ REAL_CONST(125454.74126689974/8.0),
+ REAL_CONST(125479.83535187715/8.0),
+ REAL_CONST(125504.93069152744/8.0),
+ REAL_CONST(125530.02728572517/8.0),
+ REAL_CONST(125555.12513434493/8.0),
+ REAL_CONST(125580.22423726133/8.0),
+ REAL_CONST(125605.32459434902/8.0),
+ REAL_CONST(125630.4262054827/8.0),
+ REAL_CONST(125655.52907053704/8.0),
+ REAL_CONST(125680.63318938682/8.0),
+ REAL_CONST(125705.73856190679/8.0),
+ REAL_CONST(125730.84518797178/8.0),
+ REAL_CONST(125755.9530674566/8.0),
+ REAL_CONST(125781.06220023613/8.0),
+ REAL_CONST(125806.17258618528/8.0),
+ REAL_CONST(125831.28422517896/8.0),
+ REAL_CONST(125856.39711709213/8.0),
+ REAL_CONST(125881.51126179981/8.0),
+ REAL_CONST(125906.62665917698/8.0),
+ REAL_CONST(125931.74330909875/8.0),
+ REAL_CONST(125956.86121144016/8.0),
+ REAL_CONST(125981.98036607634/8.0),
+ REAL_CONST(126007.10077288245/8.0),
+ REAL_CONST(126032.22243173365/8.0),
+ REAL_CONST(126057.34534250517/8.0),
+ REAL_CONST(126082.46950507225/8.0),
+ REAL_CONST(126107.59491931014/8.0),
+ REAL_CONST(126132.72158509417/8.0),
+ REAL_CONST(126157.84950229966/8.0),
+ REAL_CONST(126182.97867080198/8.0),
+ REAL_CONST(126208.10909047653/8.0),
+ REAL_CONST(126233.24076119871/8.0),
+ REAL_CONST(126258.37368284403/8.0),
+ REAL_CONST(126283.50785528794/8.0),
+ REAL_CONST(126308.64327840599/8.0),
+ REAL_CONST(126333.77995207369/8.0),
+ REAL_CONST(126358.91787616667/8.0),
+ REAL_CONST(126384.0570505605/8.0),
+ REAL_CONST(126409.19747513086/8.0),
+ REAL_CONST(126434.3391497534/8.0),
+ REAL_CONST(126459.48207430386/8.0),
+ REAL_CONST(126484.62624865794/8.0),
+ REAL_CONST(126509.77167269142/8.0),
+ REAL_CONST(126534.9183462801/8.0),
+ REAL_CONST(126560.06626929982/8.0),
+ REAL_CONST(126585.21544162642/8.0),
+ REAL_CONST(126610.36586313581/8.0),
+ REAL_CONST(126635.51753370393/8.0),
+ REAL_CONST(126660.67045320668/8.0),
+ REAL_CONST(126685.82462152008/8.0),
+ REAL_CONST(126710.98003852014/8.0),
+ REAL_CONST(126736.13670408291/8.0),
+ REAL_CONST(126761.29461808444/8.0),
+ REAL_CONST(126786.45378040087/8.0),
+ REAL_CONST(126811.61419090834/8.0),
+ REAL_CONST(126836.77584948298/8.0),
+ REAL_CONST(126861.93875600102/8.0),
+ REAL_CONST(126887.10291033868/8.0),
+ REAL_CONST(126912.26831237224/8.0),
+ REAL_CONST(126937.43496197795/8.0),
+ REAL_CONST(126962.60285903217/8.0),
+ REAL_CONST(126987.77200341123/8.0),
+ REAL_CONST(127012.94239499152/8.0),
+ REAL_CONST(127038.11403364947/8.0),
+ REAL_CONST(127063.2869192615/8.0),
+ REAL_CONST(127088.46105170409/8.0),
+ REAL_CONST(127113.63643085376/8.0),
+ REAL_CONST(127138.81305658702/8.0),
+ REAL_CONST(127163.99092878048/8.0),
+ REAL_CONST(127189.17004731069/8.0),
+ REAL_CONST(127214.35041205429/8.0),
+ REAL_CONST(127239.53202288797/8.0),
+ REAL_CONST(127264.71487968838/8.0),
+ REAL_CONST(127289.89898233226/8.0),
+ REAL_CONST(127315.08433069635/8.0),
+ REAL_CONST(127340.27092465744/8.0),
+ REAL_CONST(127365.45876409234/8.0),
+ REAL_CONST(127390.64784887788/8.0),
+ REAL_CONST(127415.83817889093/8.0),
+ REAL_CONST(127441.02975400841/8.0),
+ REAL_CONST(127466.22257410725/8.0),
+ REAL_CONST(127491.41663906439/8.0),
+ REAL_CONST(127516.61194875685/8.0),
+ REAL_CONST(127541.80850306165/8.0),
+ REAL_CONST(127567.00630185583/8.0),
+ REAL_CONST(127592.20534501647/8.0),
+ REAL_CONST(127617.4056324207/8.0),
+ REAL_CONST(127642.60716394568/8.0),
+ REAL_CONST(127667.80993946856/8.0),
+ REAL_CONST(127693.01395886653/8.0),
+ REAL_CONST(127718.21922201688/8.0),
+ REAL_CONST(127743.42572879682/8.0),
+ REAL_CONST(127768.63347908368/8.0),
+ REAL_CONST(127793.84247275478/8.0),
+ REAL_CONST(127819.05270968749/8.0),
+ REAL_CONST(127844.26418975917/8.0),
+ REAL_CONST(127869.47691284724/8.0),
+ REAL_CONST(127894.69087882918/8.0),
+ REAL_CONST(127919.90608758242/8.0),
+ REAL_CONST(127945.12253898452/8.0),
+ REAL_CONST(127970.34023291297/8.0),
+ REAL_CONST(127995.55916924537/8.0),
+ REAL_CONST(128020.77934785932/8.0),
+ REAL_CONST(128046.00076863244/8.0),
+ REAL_CONST(128071.22343144237/8.0),
+ REAL_CONST(128096.44733616684/8.0),
+ REAL_CONST(128121.67248268353/8.0),
+ REAL_CONST(128146.89887087021/8.0),
+ REAL_CONST(128172.12650060465/8.0),
+ REAL_CONST(128197.35537176467/8.0),
+ REAL_CONST(128222.5854842281/8.0),
+ REAL_CONST(128247.81683787282/8.0),
+ REAL_CONST(128273.04943257671/8.0),
+ REAL_CONST(128298.28326821771/8.0),
+ REAL_CONST(128323.51834467379/8.0),
+ REAL_CONST(128348.75466182294/8.0),
+ REAL_CONST(128373.99221954317/8.0),
+ REAL_CONST(128399.23101771252/8.0),
+ REAL_CONST(128424.47105620909/8.0),
+ REAL_CONST(128449.71233491098/8.0),
+ REAL_CONST(128474.95485369631/8.0),
+ REAL_CONST(128500.19861244329/8.0),
+ REAL_CONST(128525.44361103009/8.0),
+ REAL_CONST(128550.68984933494/8.0),
+ REAL_CONST(128575.93732723613/8.0),
+ REAL_CONST(128601.18604461191/8.0),
+ REAL_CONST(128626.43600134061/8.0),
+ REAL_CONST(128651.68719730059/8.0),
+ REAL_CONST(128676.93963237021/8.0),
+ REAL_CONST(128702.1933064279/8.0),
+ REAL_CONST(128727.44821935208/8.0),
+ REAL_CONST(128752.70437102125/8.0),
+ REAL_CONST(128777.96176131385/8.0),
+ REAL_CONST(128803.22039010846/8.0),
+ REAL_CONST(128828.48025728362/8.0),
+ REAL_CONST(128853.74136271792/8.0),
+ REAL_CONST(128879.00370628996/8.0),
+ REAL_CONST(128904.26728787841/8.0),
+ REAL_CONST(128929.53210736193/8.0),
+ REAL_CONST(128954.79816461923/8.0),
+ REAL_CONST(128980.06545952905/8.0),
+ REAL_CONST(129005.33399197015/8.0),
+ REAL_CONST(129030.60376182134/8.0),
+ REAL_CONST(129055.87476896142/8.0),
+ REAL_CONST(129081.14701326926/8.0),
+ REAL_CONST(129106.42049462376/8.0),
+ REAL_CONST(129131.6952129038/8.0),
+ REAL_CONST(129156.97116798835/8.0),
+ REAL_CONST(129182.24835975636/8.0),
+ REAL_CONST(129207.52678808685/8.0),
+ REAL_CONST(129232.80645285884/8.0),
+ REAL_CONST(129258.08735395141/8.0),
+ REAL_CONST(129283.36949124365/8.0),
+ REAL_CONST(129308.65286461466/8.0),
+ REAL_CONST(129333.9374739436/8.0),
+ REAL_CONST(129359.22331910966/8.0),
+ REAL_CONST(129384.51039999202/8.0),
+ REAL_CONST(129409.79871646997/8.0),
+ REAL_CONST(129435.08826842274/8.0),
+ REAL_CONST(129460.37905572963/8.0),
+ REAL_CONST(129485.67107826998/8.0),
+ REAL_CONST(129510.96433592314/8.0),
+ REAL_CONST(129536.25882856851/8.0),
+ REAL_CONST(129561.55455608548/8.0),
+ REAL_CONST(129586.85151835352/8.0),
+ REAL_CONST(129612.14971525209/8.0),
+ REAL_CONST(129637.4491466607/8.0),
+ REAL_CONST(129662.74981245887/8.0),
+ REAL_CONST(129688.0517125262/8.0),
+ REAL_CONST(129713.35484674224/8.0),
+ REAL_CONST(129738.65921498663/8.0),
+ REAL_CONST(129763.96481713903/8.0),
+ REAL_CONST(129789.27165307909/8.0),
+ REAL_CONST(129814.57972268655/8.0),
+ REAL_CONST(129839.88902584116/8.0),
+ REAL_CONST(129865.19956242264/8.0),
+ REAL_CONST(129890.51133231082/8.0),
+ REAL_CONST(129915.82433538554/8.0),
+ REAL_CONST(129941.13857152662/8.0),
+ REAL_CONST(129966.45404061397/8.0),
+ REAL_CONST(129991.7707425275/8.0),
+ REAL_CONST(130017.08867714716/8.0),
+ REAL_CONST(130042.4078443529/8.0),
+ REAL_CONST(130067.72824402474/8.0),
+ REAL_CONST(130093.04987604271/8.0),
+ REAL_CONST(130118.37274028687/8.0),
+ REAL_CONST(130143.69683663732/8.0),
+ REAL_CONST(130169.02216497416/8.0),
+ REAL_CONST(130194.34872517755/8.0),
+ REAL_CONST(130219.67651712766/8.0),
+ REAL_CONST(130245.0055407047/8.0),
+ REAL_CONST(130270.33579578891/8.0),
+ REAL_CONST(130295.66728226055/8.0),
+ REAL_CONST(130320.99999999991/8.0),
+ REAL_CONST(130346.33394888733/8.0),
+ REAL_CONST(130371.66912880314/8.0),
+ REAL_CONST(130397.00553962773/8.0),
+ REAL_CONST(130422.34318124152/8.0),
+ REAL_CONST(130447.68205352494/8.0),
+ REAL_CONST(130473.02215635845/8.0),
+ REAL_CONST(130498.36348962256/8.0),
+ REAL_CONST(130523.70605319779/8.0),
+ REAL_CONST(130549.0498469647/8.0),
+ REAL_CONST(130574.39487080388/8.0),
+ REAL_CONST(130599.74112459592/8.0),
+ REAL_CONST(130625.08860822149/8.0),
+ REAL_CONST(130650.43732156123/8.0),
+ REAL_CONST(130675.78726449587/8.0),
+ REAL_CONST(130701.13843690613/8.0),
+ REAL_CONST(130726.49083867275/8.0),
+ REAL_CONST(130751.84446967654/8.0),
+ REAL_CONST(130777.19932979831/8.0),
+ REAL_CONST(130802.5554189189/8.0),
+ REAL_CONST(130827.91273691918/8.0),
+ REAL_CONST(130853.27128368006/8.0),
+ REAL_CONST(130878.63105908247/8.0),
+ REAL_CONST(130903.99206300738/8.0),
+ REAL_CONST(130929.35429533575/8.0),
+ REAL_CONST(130954.71775594862/8.0),
+ REAL_CONST(130980.08244472703/8.0),
+ REAL_CONST(131005.44836155206/8.0),
+ REAL_CONST(131030.81550630482/8.0),
+ REAL_CONST(131056.18387886642/8.0),
+ REAL_CONST(131081.55347911804/8.0),
+ REAL_CONST(131106.92430694087/8.0),
+ REAL_CONST(131132.29636221612/8.0),
+ REAL_CONST(131157.66964482504/8.0),
+ REAL_CONST(131183.0441546489/8.0),
+ REAL_CONST(131208.41989156904/8.0),
+ REAL_CONST(131233.79685546676/8.0),
+ REAL_CONST(131259.17504622342/8.0),
+ REAL_CONST(131284.55446372041/8.0),
+ REAL_CONST(131309.93510783918/8.0),
+ REAL_CONST(131335.31697846117/8.0),
+ REAL_CONST(131360.70007546784/8.0),
+ REAL_CONST(131386.0843987407/8.0),
+ REAL_CONST(131411.46994816128/8.0),
+ REAL_CONST(131436.85672361116/8.0),
+ REAL_CONST(131462.24472497194/8.0),
+ REAL_CONST(131487.63395212521/8.0),
+ REAL_CONST(131513.02440495262/8.0),
+ REAL_CONST(131538.41608333588/8.0),
+ REAL_CONST(131563.80898715663/8.0),
+ REAL_CONST(131589.2031162967/8.0),
+ REAL_CONST(131614.59847063778/8.0),
+ REAL_CONST(131639.9950500617/8.0),
+ REAL_CONST(131665.39285445024/8.0),
+ REAL_CONST(131690.79188368531/8.0),
+ REAL_CONST(131716.19213764873/8.0),
+ REAL_CONST(131741.59361622241/8.0),
+ REAL_CONST(131766.99631928833/8.0),
+ REAL_CONST(131792.40024672839/8.0),
+ REAL_CONST(131817.80539842462/8.0),
+ REAL_CONST(131843.21177425905/8.0),
+ REAL_CONST(131868.61937411371/8.0),
+ REAL_CONST(131894.02819787065/8.0),
+ REAL_CONST(131919.43824541202/8.0),
+ REAL_CONST(131944.84951661993/8.0),
+ REAL_CONST(131970.26201137656/8.0),
+ REAL_CONST(131995.67572956407/8.0),
+ REAL_CONST(132021.09067106468/8.0),
+ REAL_CONST(132046.50683576067/8.0),
+ REAL_CONST(132071.9242235343/8.0),
+ REAL_CONST(132097.34283426782/8.0),
+ REAL_CONST(132122.76266784366/8.0),
+ REAL_CONST(132148.1837241441/8.0),
+ REAL_CONST(132173.60600305157/8.0),
+ REAL_CONST(132199.02950444847/8.0),
+ REAL_CONST(132224.45422821722/8.0),
+ REAL_CONST(132249.88017424036/8.0),
+ REAL_CONST(132275.30734240031/8.0),
+ REAL_CONST(132300.73573257966/8.0),
+ REAL_CONST(132326.16534466096/8.0),
+ REAL_CONST(132351.59617852676/8.0),
+ REAL_CONST(132377.02823405969/8.0),
+ REAL_CONST(132402.46151114244/8.0),
+ REAL_CONST(132427.89600965759/8.0),
+ REAL_CONST(132453.33172948789/8.0),
+ REAL_CONST(132478.76867051609/8.0),
+ REAL_CONST(132504.20683262491/8.0),
+ REAL_CONST(132529.64621569714/8.0),
+ REAL_CONST(132555.08681961559/8.0),
+ REAL_CONST(132580.5286442631/8.0),
+ REAL_CONST(132605.97168952253/8.0),
+ REAL_CONST(132631.41595527678/8.0),
+ REAL_CONST(132656.86144140881/8.0),
+ REAL_CONST(132682.30814780149/8.0),
+ REAL_CONST(132707.75607433787/8.0),
+ REAL_CONST(132733.20522090094/8.0),
+ REAL_CONST(132758.65558737374/8.0),
+ REAL_CONST(132784.10717363929/8.0),
+ REAL_CONST(132809.55997958075/8.0),
+ REAL_CONST(132835.01400508118/8.0),
+ REAL_CONST(132860.46925002377/8.0),
+ REAL_CONST(132885.92571429166/8.0),
+ REAL_CONST(132911.38339776811/8.0),
+ REAL_CONST(132936.84230033628/8.0),
+ REAL_CONST(132962.30242187946/8.0),
+ REAL_CONST(132987.76376228096/8.0),
+ REAL_CONST(133013.22632142407/8.0),
+ REAL_CONST(133038.69009919214/8.0),
+ REAL_CONST(133064.15509546854/8.0),
+ REAL_CONST(133089.62131013666/8.0),
+ REAL_CONST(133115.08874307995/8.0),
+ REAL_CONST(133140.55739418184/8.0),
+ REAL_CONST(133166.02726332581/8.0),
+ REAL_CONST(133191.49835039541/8.0),
+ REAL_CONST(133216.97065527414/8.0),
+ REAL_CONST(133242.44417784561/8.0),
+ REAL_CONST(133267.91891799335/8.0),
+ REAL_CONST(133293.39487560102/8.0),
+ REAL_CONST(133318.87205055228/8.0),
+ REAL_CONST(133344.35044273079/8.0),
+ REAL_CONST(133369.83005202023/8.0),
+ REAL_CONST(133395.31087830439/8.0),
+ REAL_CONST(133420.79292146701/8.0),
+ REAL_CONST(133446.27618139185/8.0),
+ REAL_CONST(133471.76065796276/8.0),
+ REAL_CONST(133497.24635106357/8.0),
+ REAL_CONST(133522.73326057816/8.0),
+ REAL_CONST(133548.22138639039/8.0),
+ REAL_CONST(133573.71072838426/8.0),
+ REAL_CONST(133599.20128644365/8.0),
+ REAL_CONST(133624.69306045261/8.0),
+ REAL_CONST(133650.1860502951/8.0),
+ REAL_CONST(133675.68025585517/8.0),
+ REAL_CONST(133701.1756770169/8.0),
+ REAL_CONST(133726.67231366437/8.0),
+ REAL_CONST(133752.17016568172/8.0),
+ REAL_CONST(133777.66923295305/8.0),
+ REAL_CONST(133803.16951536259/8.0),
+ REAL_CONST(133828.67101279454/8.0),
+ REAL_CONST(133854.17372513309/8.0),
+ REAL_CONST(133879.67765226253/8.0),
+ REAL_CONST(133905.18279406714/8.0),
+ REAL_CONST(133930.68915043125/8.0),
+ REAL_CONST(133956.19672123916/8.0),
+ REAL_CONST(133981.70550637526/8.0),
+ REAL_CONST(134007.21550572399/8.0),
+ REAL_CONST(134032.7267191697/8.0),
+ REAL_CONST(134058.23914659687/8.0),
+ REAL_CONST(134083.75278789/8.0),
+ REAL_CONST(134109.26764293358/8.0),
+ REAL_CONST(134134.78371161217/8.0),
+ REAL_CONST(134160.30099381026/8.0),
+ REAL_CONST(134185.8194894125/8.0),
+ REAL_CONST(134211.33919830353/8.0),
+ REAL_CONST(134236.8601203679/8.0),
+ REAL_CONST(134262.38225549037/8.0),
+ REAL_CONST(134287.90560355558/8.0),
+ REAL_CONST(134313.43016444831/8.0),
+ REAL_CONST(134338.95593805326/8.0),
+ REAL_CONST(134364.48292425525/8.0),
+ REAL_CONST(134390.01112293909/8.0),
+ REAL_CONST(134415.54053398955/8.0),
+ REAL_CONST(134441.07115729159/8.0),
+ REAL_CONST(134466.60299273001/8.0),
+ REAL_CONST(134492.1360401898/8.0),
+ REAL_CONST(134517.67029955584/8.0),
+ REAL_CONST(134543.20577071316/8.0),
+ REAL_CONST(134568.74245354676/8.0),
+ REAL_CONST(134594.28034794159/8.0),
+ REAL_CONST(134619.81945378278/8.0),
+ REAL_CONST(134645.35977095537/8.0),
+ REAL_CONST(134670.90129934452/8.0),
+ REAL_CONST(134696.4440388353/8.0),
+ REAL_CONST(134721.98798931291/8.0),
+ REAL_CONST(134747.53315066252/8.0),
+ REAL_CONST(134773.07952276937/8.0),
+ REAL_CONST(134798.62710551871/8.0),
+ REAL_CONST(134824.17589879577/8.0),
+ REAL_CONST(134849.72590248589/8.0),
+ REAL_CONST(134875.27711647438/8.0),
+ REAL_CONST(134900.82954064661/8.0),
+ REAL_CONST(134926.38317488792/8.0),
+ REAL_CONST(134951.93801908373/8.0),
+ REAL_CONST(134977.49407311951/8.0),
+ REAL_CONST(135003.05133688069/8.0),
+ REAL_CONST(135028.60981025276/8.0),
+ REAL_CONST(135054.16949312127/8.0),
+ REAL_CONST(135079.73038537172/8.0),
+ REAL_CONST(135105.29248688967/8.0),
+ REAL_CONST(135130.85579756077/8.0),
+ REAL_CONST(135156.42031727062/8.0),
+ REAL_CONST(135181.98604590484/8.0),
+ REAL_CONST(135207.55298334916/8.0),
+ REAL_CONST(135233.12112948924/8.0),
+ REAL_CONST(135258.69048421088/8.0),
+ REAL_CONST(135284.26104739975/8.0),
+ REAL_CONST(135309.83281894168/8.0),
+ REAL_CONST(135335.4057987225/8.0),
+ REAL_CONST(135360.97998662802/8.0),
+ REAL_CONST(135386.55538254412/8.0),
+ REAL_CONST(135412.13198635669/8.0),
+ REAL_CONST(135437.70979795168/8.0),
+ REAL_CONST(135463.28881721498/8.0),
+ REAL_CONST(135488.86904403262/8.0),
+ REAL_CONST(135514.45047829056/8.0),
+ REAL_CONST(135540.03311987486/8.0),
+ REAL_CONST(135565.61696867159/8.0),
+ REAL_CONST(135591.20202456677/8.0),
+ REAL_CONST(135616.78828744654/8.0),
+ REAL_CONST(135642.37575719706/8.0),
+ REAL_CONST(135667.96443370447/8.0),
+ REAL_CONST(135693.55431685498/8.0),
+ REAL_CONST(135719.14540653475/8.0),
+ REAL_CONST(135744.73770263011/8.0),
+ REAL_CONST(135770.33120502727/8.0),
+ REAL_CONST(135795.92591361253/8.0),
+ REAL_CONST(135821.52182827223/8.0),
+ REAL_CONST(135847.11894889272/8.0),
+ REAL_CONST(135872.7172753604/8.0),
+ REAL_CONST(135898.31680756161/8.0),
+ REAL_CONST(135923.91754538284/8.0),
+ REAL_CONST(135949.51948871053/8.0),
+ REAL_CONST(135975.12263743114/8.0),
+ REAL_CONST(136000.72699143123/8.0),
+ REAL_CONST(136026.33255059729/8.0),
+ REAL_CONST(136051.93931481591/8.0),
+ REAL_CONST(136077.54728397369/8.0),
+ REAL_CONST(136103.15645795723/8.0),
+ REAL_CONST(136128.76683665317/8.0),
+ REAL_CONST(136154.37841994822/8.0),
+ REAL_CONST(136179.99120772901/8.0),
+ REAL_CONST(136205.60519988232/8.0),
+ REAL_CONST(136231.2203962949/8.0),
+ REAL_CONST(136256.83679685349/8.0),
+ REAL_CONST(136282.45440144493/8.0),
+ REAL_CONST(136308.07320995603/8.0),
+ REAL_CONST(136333.69322227367/8.0),
+ REAL_CONST(136359.31443828469/8.0),
+ REAL_CONST(136384.93685787608/8.0),
+ REAL_CONST(136410.56048093468/8.0),
+ REAL_CONST(136436.18530734754/8.0),
+ REAL_CONST(136461.81133700156/8.0),
+ REAL_CONST(136487.43856978384/8.0),
+ REAL_CONST(136513.06700558143/8.0),
+ REAL_CONST(136538.6966442813/8.0),
+ REAL_CONST(136564.32748577066/8.0),
+ REAL_CONST(136589.95952993655/8.0),
+ REAL_CONST(136615.59277666616/8.0),
+ REAL_CONST(136641.22722584667/8.0),
+ REAL_CONST(136666.86287736523/8.0),
+ REAL_CONST(136692.49973110916/8.0),
+ REAL_CONST(136718.13778696564/8.0),
+ REAL_CONST(136743.77704482197/8.0),
+ REAL_CONST(136769.41750456547/8.0),
+ REAL_CONST(136795.05916608346/8.0),
+ REAL_CONST(136820.70202926331/8.0),
+ REAL_CONST(136846.34609399244/8.0),
+ REAL_CONST(136871.99136015819/8.0),
+ REAL_CONST(136897.63782764805/8.0),
+ REAL_CONST(136923.28549634948/8.0),
+ REAL_CONST(136948.93436614997/8.0),
+ REAL_CONST(136974.58443693706/8.0),
+ REAL_CONST(137000.23570859825/8.0),
+ REAL_CONST(137025.88818102115/8.0),
+ REAL_CONST(137051.54185409332/8.0),
+ REAL_CONST(137077.19672770242/8.0),
+ REAL_CONST(137102.85280173609/8.0),
+ REAL_CONST(137128.51007608202/8.0),
+ REAL_CONST(137154.16855062786/8.0),
+ REAL_CONST(137179.82822526142/8.0),
+ REAL_CONST(137205.48909987041/8.0),
+ REAL_CONST(137231.15117434258/8.0),
+ REAL_CONST(137256.8144485658/8.0),
+ REAL_CONST(137282.47892242789/8.0),
+ REAL_CONST(137308.14459581667/8.0),
+ REAL_CONST(137333.81146862009/8.0),
+ REAL_CONST(137359.47954072602/8.0),
+ REAL_CONST(137385.14881202241/8.0),
+ REAL_CONST(137410.81928239719/8.0),
+ REAL_CONST(137436.49095173844/8.0),
+ REAL_CONST(137462.16381993407/8.0),
+ REAL_CONST(137487.83788687221/8.0),
+ REAL_CONST(137513.51315244089/8.0),
+ REAL_CONST(137539.18961652822/8.0),
+ REAL_CONST(137564.86727902229/8.0),
+ REAL_CONST(137590.54613981131/8.0),
+ REAL_CONST(137616.22619878338/8.0),
+ REAL_CONST(137641.90745582676/8.0),
+ REAL_CONST(137667.58991082967/8.0),
+ REAL_CONST(137693.27356368033/8.0),
+ REAL_CONST(137718.95841426702/8.0),
+ REAL_CONST(137744.64446247809/8.0),
+ REAL_CONST(137770.33170820182/8.0),
+ REAL_CONST(137796.02015132661/8.0),
+ REAL_CONST(137821.70979174081/8.0),
+ REAL_CONST(137847.40062933284/8.0),
+ REAL_CONST(137873.09266399115/8.0),
+ REAL_CONST(137898.78589560417/8.0),
+ REAL_CONST(137924.48032406042/8.0),
+ REAL_CONST(137950.17594924837/8.0),
+ REAL_CONST(137975.8727710566/8.0),
+ REAL_CONST(138001.57078937365/8.0),
+ REAL_CONST(138027.27000408815/8.0),
+ REAL_CONST(138052.97041508864/8.0),
+ REAL_CONST(138078.67202226384/8.0),
+ REAL_CONST(138104.3748255024/8.0),
+ REAL_CONST(138130.07882469296/8.0),
+ REAL_CONST(138155.78401972432/8.0),
+ REAL_CONST(138181.49041048516/8.0),
+ REAL_CONST(138207.1979968643/8.0),
+ REAL_CONST(138232.9067787505/8.0),
+ REAL_CONST(138258.61675603263/8.0),
+ REAL_CONST(138284.32792859949/8.0),
+ REAL_CONST(138310.04029633995/8.0),
+ REAL_CONST(138335.75385914298/8.0),
+ REAL_CONST(138361.46861689744/8.0),
+ REAL_CONST(138387.18456949232/8.0),
+ REAL_CONST(138412.90171681659/8.0),
+ REAL_CONST(138438.62005875923/8.0),
+ REAL_CONST(138464.33959520931/8.0),
+ REAL_CONST(138490.06032605586/8.0),
+ REAL_CONST(138515.78225118798/8.0),
+ REAL_CONST(138541.50537049473/8.0),
+ REAL_CONST(138567.2296838653/8.0),
+ REAL_CONST(138592.95519118884/8.0),
+ REAL_CONST(138618.68189235451/8.0),
+ REAL_CONST(138644.40978725153/8.0),
+ REAL_CONST(138670.13887576913/8.0),
+ REAL_CONST(138695.86915779658/8.0),
+ REAL_CONST(138721.60063322316/8.0),
+ REAL_CONST(138747.33330193823/8.0),
+ REAL_CONST(138773.06716383106/8.0),
+ REAL_CONST(138798.80221879104/8.0),
+ REAL_CONST(138824.53846670757/8.0),
+ REAL_CONST(138850.27590747006/8.0),
+ REAL_CONST(138876.01454096794/8.0),
+ REAL_CONST(138901.7543670907/8.0),
+ REAL_CONST(138927.49538572782/8.0),
+ REAL_CONST(138953.2375967688/8.0),
+ REAL_CONST(138978.9810001032/8.0),
+ REAL_CONST(139004.72559562061/8.0),
+ REAL_CONST(139030.47138321059/8.0),
+ REAL_CONST(139056.2183627628/8.0),
+ REAL_CONST(139081.96653416683/8.0),
+ REAL_CONST(139107.71589731239/8.0),
+ REAL_CONST(139133.46645208917/8.0),
+ REAL_CONST(139159.21819838689/8.0),
+ REAL_CONST(139184.97113609532/8.0),
+ REAL_CONST(139210.72526510421/8.0),
+ REAL_CONST(139236.48058530336/8.0),
+ REAL_CONST(139262.23709658257/8.0),
+ REAL_CONST(139287.99479883176/8.0),
+ REAL_CONST(139313.75369194071/8.0),
+ REAL_CONST(139339.51377579942/8.0),
+ REAL_CONST(139365.27505029776/8.0),
+ REAL_CONST(139391.03751532568/8.0),
+ REAL_CONST(139416.80117077316/8.0),
+ REAL_CONST(139442.56601653024/8.0),
+ REAL_CONST(139468.33205248689/8.0),
+ REAL_CONST(139494.09927853322/8.0),
+ REAL_CONST(139519.86769455927/8.0),
+ REAL_CONST(139545.63730045516/8.0),
+ REAL_CONST(139571.408096111/8.0),
+ REAL_CONST(139597.18008141697/8.0),
+ REAL_CONST(139622.95325626322/8.0),
+ REAL_CONST(139648.72762054001/8.0),
+ REAL_CONST(139674.5031741375/8.0),
+ REAL_CONST(139700.27991694602/8.0),
+ REAL_CONST(139726.05784885579/8.0),
+ REAL_CONST(139751.83696975713/8.0),
+ REAL_CONST(139777.61727954043/8.0),
+ REAL_CONST(139803.39877809596/8.0),
+ REAL_CONST(139829.18146531415/8.0),
+ REAL_CONST(139854.96534108539/8.0),
+ REAL_CONST(139880.75040530015/8.0),
+ REAL_CONST(139906.53665784886/8.0),
+ REAL_CONST(139932.32409862199/8.0),
+ REAL_CONST(139958.11272751007/8.0),
+ REAL_CONST(139983.90254440365/8.0),
+ REAL_CONST(140009.69354919327/8.0),
+ REAL_CONST(140035.48574176949/8.0),
+ REAL_CONST(140061.27912202294/8.0),
+ REAL_CONST(140087.07368984428/8.0),
+ REAL_CONST(140112.86944512415/8.0),
+ REAL_CONST(140138.66638775321/8.0),
+ REAL_CONST(140164.4645176222/8.0),
+ REAL_CONST(140190.26383462184/8.0),
+ REAL_CONST(140216.06433864293/8.0),
+ REAL_CONST(140241.86602957622/8.0),
+ REAL_CONST(140267.66890731253/8.0),
+ REAL_CONST(140293.47297174268/8.0),
+ REAL_CONST(140319.27822275754/8.0),
+ REAL_CONST(140345.08466024802/8.0),
+ REAL_CONST(140370.89228410498/8.0),
+ REAL_CONST(140396.70109421943/8.0),
+ REAL_CONST(140422.51109048226/8.0),
+ REAL_CONST(140448.32227278448/8.0),
+ REAL_CONST(140474.13464101712/8.0),
+ REAL_CONST(140499.94819507122/8.0),
+ REAL_CONST(140525.76293483781/8.0),
+ REAL_CONST(140551.57886020801/8.0),
+ REAL_CONST(140577.3959710729/8.0),
+ REAL_CONST(140603.21426732364/8.0),
+ REAL_CONST(140629.03374885136/8.0),
+ REAL_CONST(140654.85441554731/8.0),
+ REAL_CONST(140680.67626730262/8.0),
+ REAL_CONST(140706.49930400858/8.0),
+ REAL_CONST(140732.32352555645/8.0),
+ REAL_CONST(140758.1489318375/8.0),
+ REAL_CONST(140783.97552274304/8.0),
+ REAL_CONST(140809.80329816442/8.0),
+ REAL_CONST(140835.63225799298/8.0),
+ REAL_CONST(140861.46240212015/8.0),
+ REAL_CONST(140887.29373043729/8.0),
+ REAL_CONST(140913.12624283586/8.0),
+ REAL_CONST(140938.95993920733/8.0),
+ REAL_CONST(140964.79481944317/8.0),
+ REAL_CONST(140990.63088343487/8.0),
+ REAL_CONST(141016.46813107401/8.0),
+ REAL_CONST(141042.30656225214/8.0),
+ REAL_CONST(141068.14617686081/8.0),
+ REAL_CONST(141093.98697479168/8.0),
+ REAL_CONST(141119.82895593636/8.0),
+ REAL_CONST(141145.6721201865/8.0),
+ REAL_CONST(141171.51646743377/8.0),
+ REAL_CONST(141197.36199756994/8.0),
+ REAL_CONST(141223.20871048668/8.0),
+ REAL_CONST(141249.05660607578/8.0),
+ REAL_CONST(141274.90568422904/8.0),
+ REAL_CONST(141300.75594483822/8.0),
+ REAL_CONST(141326.6073877952/8.0),
+ REAL_CONST(141352.4600129918/8.0),
+ REAL_CONST(141378.31382031992/8.0),
+ REAL_CONST(141404.16880967148/8.0),
+ REAL_CONST(141430.02498093838/8.0),
+ REAL_CONST(141455.8823340126/8.0),
+ REAL_CONST(141481.74086878612/8.0),
+ REAL_CONST(141507.60058515094/8.0),
+ REAL_CONST(141533.46148299909/8.0),
+ REAL_CONST(141559.32356222265/8.0),
+ REAL_CONST(141585.18682271364/8.0),
+ REAL_CONST(141611.05126436421/8.0),
+ REAL_CONST(141636.9168870665/8.0),
+ REAL_CONST(141662.78369071262/8.0),
+ REAL_CONST(141688.65167519479/8.0),
+ REAL_CONST(141714.5208404052/8.0),
+ REAL_CONST(141740.39118623605/8.0),
+ REAL_CONST(141766.26271257963/8.0),
+ REAL_CONST(141792.1354193282/8.0),
+ REAL_CONST(141818.00930637406/8.0),
+ REAL_CONST(141843.88437360956/8.0),
+ REAL_CONST(141869.760620927/8.0),
+ REAL_CONST(141895.6380482188/8.0),
+ REAL_CONST(141921.51665537735/8.0),
+ REAL_CONST(141947.39644229505/8.0),
+ REAL_CONST(141973.27740886438/8.0),
+ REAL_CONST(141999.15955497778/8.0),
+ REAL_CONST(142025.04288052776/8.0),
+ REAL_CONST(142050.92738540689/8.0),
+ REAL_CONST(142076.81306950765/8.0),
+ REAL_CONST(142102.69993272264/8.0),
+ REAL_CONST(142128.58797494444/8.0),
+ REAL_CONST(142154.47719606571/8.0),
+ REAL_CONST(142180.36759597904/8.0),
+ REAL_CONST(142206.25917457714/8.0),
+ REAL_CONST(142232.15193175265/8.0),
+ REAL_CONST(142258.04586739838/8.0),
+ REAL_CONST(142283.94098140698/8.0),
+ REAL_CONST(142309.83727367126/8.0),
+ REAL_CONST(142335.73474408401/8.0),
+ REAL_CONST(142361.63339253806/8.0),
+ REAL_CONST(142387.5332189262/8.0),
+ REAL_CONST(142413.43422314132/8.0),
+ REAL_CONST(142439.33640507635/8.0),
+ REAL_CONST(142465.23976462413/8.0),
+ REAL_CONST(142491.14430167765/8.0),
+ REAL_CONST(142517.05001612983/8.0),
+ REAL_CONST(142542.95690787368/8.0),
+ REAL_CONST(142568.86497680223/8.0),
+ REAL_CONST(142594.77422280848/8.0),
+ REAL_CONST(142620.68464578551/8.0),
+ REAL_CONST(142646.5962456264/8.0),
+ REAL_CONST(142672.50902222423/8.0),
+ REAL_CONST(142698.42297547215/8.0),
+ REAL_CONST(142724.33810526333/8.0),
+ REAL_CONST(142750.25441149093/8.0),
+ REAL_CONST(142776.17189404817/8.0),
+ REAL_CONST(142802.09055282827/8.0),
+ REAL_CONST(142828.01038772447/8.0),
+ REAL_CONST(142853.93139863008/8.0),
+ REAL_CONST(142879.85358543837/8.0),
+ REAL_CONST(142905.77694804268/8.0),
+ REAL_CONST(142931.70148633636/8.0),
+ REAL_CONST(142957.62720021277/8.0),
+ REAL_CONST(142983.55408956532/8.0),
+ REAL_CONST(143009.48215428743/8.0),
+ REAL_CONST(143035.41139427255/8.0),
+ REAL_CONST(143061.34180941415/8.0),
+ REAL_CONST(143087.27339960571/8.0),
+ REAL_CONST(143113.20616474075/8.0),
+ REAL_CONST(143139.14010471283/8.0),
+ REAL_CONST(143165.07521941551/8.0),
+ REAL_CONST(143191.01150874238/8.0),
+ REAL_CONST(143216.94897258704/8.0),
+ REAL_CONST(143242.88761084314/8.0),
+ REAL_CONST(143268.82742340435/8.0),
+ REAL_CONST(143294.76841016437/8.0),
+ REAL_CONST(143320.71057101688/8.0),
+ REAL_CONST(143346.65390585564/8.0),
+ REAL_CONST(143372.59841457437/8.0),
+ REAL_CONST(143398.54409706692/8.0),
+ REAL_CONST(143424.49095322701/8.0),
+ REAL_CONST(143450.43898294857/8.0),
+ REAL_CONST(143476.38818612538/8.0),
+ REAL_CONST(143502.33856265133/8.0),
+ REAL_CONST(143528.29011242036/8.0),
+ REAL_CONST(143554.24283532638/8.0),
+ REAL_CONST(143580.19673126334/8.0),
+ REAL_CONST(143606.1518001252/8.0),
+ REAL_CONST(143632.10804180597/8.0),
+ REAL_CONST(143658.06545619969/8.0),
+ REAL_CONST(143684.02404320039/8.0),
+ REAL_CONST(143709.98380270213/8.0),
+ REAL_CONST(143735.944734599/8.0),
+ REAL_CONST(143761.90683878519/8.0),
+ REAL_CONST(143787.87011515474/8.0),
+ REAL_CONST(143813.83456360188/8.0),
+ REAL_CONST(143839.8001840208/8.0),
+ REAL_CONST(143865.76697630569/8.0),
+ REAL_CONST(143891.73494035081/8.0),
+ REAL_CONST(143917.7040760504/8.0),
+ REAL_CONST(143943.67438329876/8.0),
+ REAL_CONST(143969.6458619902/8.0),
+ REAL_CONST(143995.61851201905/8.0),
+ REAL_CONST(144021.59233327967/8.0),
+ REAL_CONST(144047.56732566646/8.0),
+ REAL_CONST(144073.54348907378/8.0),
+ REAL_CONST(144099.52082339607/8.0),
+ REAL_CONST(144125.49932852783/8.0),
+ REAL_CONST(144151.4790043635/8.0),
+ REAL_CONST(144177.45985079758/8.0),
+ REAL_CONST(144203.44186772458/8.0),
+ REAL_CONST(144229.42505503909/8.0),
+ REAL_CONST(144255.40941263564/8.0),
+ REAL_CONST(144281.39494040885/8.0),
+ REAL_CONST(144307.38163825331/8.0),
+ REAL_CONST(144333.36950606373/8.0),
+ REAL_CONST(144359.35854373468/8.0),
+ REAL_CONST(144385.34875116093/8.0),
+ REAL_CONST(144411.34012823718/8.0),
+ REAL_CONST(144437.33267485813/8.0),
+ REAL_CONST(144463.32639091855/8.0),
+ REAL_CONST(144489.32127631325/8.0),
+ REAL_CONST(144515.31733093705/8.0),
+ REAL_CONST(144541.31455468474/8.0),
+ REAL_CONST(144567.3129474512/8.0),
+ REAL_CONST(144593.3125091313/8.0),
+ REAL_CONST(144619.31323961995/8.0),
+ REAL_CONST(144645.31513881206/8.0),
+ REAL_CONST(144671.31820660262/8.0),
+ REAL_CONST(144697.32244288657/8.0),
+ REAL_CONST(144723.32784755889/8.0),
+ REAL_CONST(144749.33442051467/8.0),
+ REAL_CONST(144775.34216164888/8.0),
+ REAL_CONST(144801.35107085665/8.0),
+ REAL_CONST(144827.36114803303/8.0),
+ REAL_CONST(144853.37239307314/8.0),
+ REAL_CONST(144879.38480587213/8.0),
+ REAL_CONST(144905.39838632516/8.0),
+ REAL_CONST(144931.41313432742/8.0),
+ REAL_CONST(144957.4290497741/8.0),
+ REAL_CONST(144983.44613256046/8.0),
+ REAL_CONST(145009.46438258173/8.0),
+ REAL_CONST(145035.48379973322/8.0),
+ REAL_CONST(145061.50438391021/8.0),
+ REAL_CONST(145087.52613500805/8.0),
+ REAL_CONST(145113.54905292206/8.0),
+ REAL_CONST(145139.57313754765/8.0),
+ REAL_CONST(145165.59838878017/8.0),
+ REAL_CONST(145191.62480651509/8.0),
+ REAL_CONST(145217.65239064783/8.0),
+ REAL_CONST(145243.68114107384/8.0),
+ REAL_CONST(145269.71105768863/8.0),
+ REAL_CONST(145295.74214038774/8.0),
+ REAL_CONST(145321.77438906668/8.0),
+ REAL_CONST(145347.80780362099/8.0),
+ REAL_CONST(145373.84238394629/8.0),
+ REAL_CONST(145399.87812993818/8.0),
+ REAL_CONST(145425.91504149229/8.0),
+ REAL_CONST(145451.95311850426/8.0),
+ REAL_CONST(145477.9923608698/8.0),
+ REAL_CONST(145504.03276848458/8.0),
+ REAL_CONST(145530.07434124436/8.0),
+ REAL_CONST(145556.11707904484/8.0),
+ REAL_CONST(145582.16098178181/8.0),
+ REAL_CONST(145608.20604935108/8.0),
+ REAL_CONST(145634.25228164849/8.0),
+ REAL_CONST(145660.29967856981/8.0),
+ REAL_CONST(145686.34824001096/8.0),
+ REAL_CONST(145712.39796586783/8.0),
+ REAL_CONST(145738.4488560363/8.0),
+ REAL_CONST(145764.50091041232/8.0),
+ REAL_CONST(145790.55412889185/8.0),
+ REAL_CONST(145816.60851137087/8.0),
+ REAL_CONST(145842.66405774537/8.0),
+ REAL_CONST(145868.72076791141/8.0),
+ REAL_CONST(145894.77864176501/8.0),
+ REAL_CONST(145920.83767920226/8.0),
+ REAL_CONST(145946.89788011924/8.0),
+ REAL_CONST(145972.95924441208/8.0),
+ REAL_CONST(145999.02177197693/8.0),
+ REAL_CONST(146025.08546270995/8.0),
+ REAL_CONST(146051.15031650732/8.0),
+ REAL_CONST(146077.21633326527/8.0),
+ REAL_CONST(146103.28351288004/8.0),
+ REAL_CONST(146129.35185524789/8.0),
+ REAL_CONST(146155.42136026506/8.0),
+ REAL_CONST(146181.49202782792/8.0),
+ REAL_CONST(146207.56385783272/8.0),
+ REAL_CONST(146233.63685017588/8.0),
+ REAL_CONST(146259.71100475377/8.0),
+ REAL_CONST(146285.78632146274/8.0),
+ REAL_CONST(146311.86280019928/8.0),
+ REAL_CONST(146337.94044085976/8.0),
+ REAL_CONST(146364.01924334071/8.0),
+ REAL_CONST(146390.09920753856/8.0),
+ REAL_CONST(146416.18033334985/8.0),
+ REAL_CONST(146442.26262067116/8.0),
+ REAL_CONST(146468.34606939898/8.0),
+ REAL_CONST(146494.43067942993/8.0),
+ REAL_CONST(146520.51645066062/8.0),
+ REAL_CONST(146546.60338298764/8.0),
+ REAL_CONST(146572.69147630769/8.0),
+ REAL_CONST(146598.78073051744/8.0),
+ REAL_CONST(146624.87114551352/8.0),
+ REAL_CONST(146650.96272119274/8.0),
+ REAL_CONST(146677.05545745179/8.0),
+ REAL_CONST(146703.14935418745/8.0),
+ REAL_CONST(146729.2444112965/8.0),
+ REAL_CONST(146755.34062867577/8.0),
+ REAL_CONST(146781.43800622207/8.0),
+ REAL_CONST(146807.53654383228/8.0),
+ REAL_CONST(146833.63624140329/8.0),
+ REAL_CONST(146859.73709883197/8.0),
+ REAL_CONST(146885.83911601527/8.0),
+ REAL_CONST(146911.94229285014/8.0),
+ REAL_CONST(146938.04662923355/8.0),
+ REAL_CONST(146964.15212506248/8.0),
+ REAL_CONST(146990.25878023397/8.0),
+ REAL_CONST(147016.36659464505/8.0),
+ REAL_CONST(147042.47556819281/8.0),
+ REAL_CONST(147068.58570077427/8.0),
+ REAL_CONST(147094.6969922866/8.0),
+ REAL_CONST(147120.80944262692/8.0),
+ REAL_CONST(147146.92305169237/8.0),
+ REAL_CONST(147173.03781938017/8.0),
+ REAL_CONST(147199.15374558745/8.0),
+ REAL_CONST(147225.27083021149/8.0),
+ REAL_CONST(147251.38907314953/8.0),
+ REAL_CONST(147277.50847429881/8.0),
+ REAL_CONST(147303.62903355664/8.0),
+ REAL_CONST(147329.75075082036/8.0),
+ REAL_CONST(147355.87362598727/8.0),
+ REAL_CONST(147381.99765895473/8.0),
+ REAL_CONST(147408.12284962015/8.0),
+ REAL_CONST(147434.24919788091/8.0),
+ REAL_CONST(147460.37670363448/8.0),
+ REAL_CONST(147486.50536677826/8.0),
+ REAL_CONST(147512.63518720976/8.0),
+ REAL_CONST(147538.76616482646/8.0),
+ REAL_CONST(147564.89829952587/8.0),
+ REAL_CONST(147591.03159120557/8.0),
+ REAL_CONST(147617.16603976308/8.0),
+ REAL_CONST(147643.30164509601/8.0),
+ REAL_CONST(147669.43840710199/8.0),
+ REAL_CONST(147695.57632567859/8.0),
+ REAL_CONST(147721.71540072354/8.0),
+ REAL_CONST(147747.85563213445/8.0),
+ REAL_CONST(147773.99701980909/8.0),
+ REAL_CONST(147800.13956364512/8.0),
+ REAL_CONST(147826.28326354033/8.0),
+ REAL_CONST(147852.42811939248/8.0),
+ REAL_CONST(147878.57413109933/8.0),
+ REAL_CONST(147904.72129855872/8.0),
+ REAL_CONST(147930.86962166851/8.0),
+ REAL_CONST(147957.01910032652/8.0),
+ REAL_CONST(147983.16973443062/8.0),
+ REAL_CONST(148009.32152387875/8.0),
+ REAL_CONST(148035.47446856883/8.0),
+ REAL_CONST(148061.62856839882/8.0),
+ REAL_CONST(148087.78382326665/8.0),
+ REAL_CONST(148113.94023307035/8.0),
+ REAL_CONST(148140.09779770792/8.0),
+ REAL_CONST(148166.25651707739/8.0),
+ REAL_CONST(148192.41639107687/8.0),
+ REAL_CONST(148218.57741960438/8.0),
+ REAL_CONST(148244.73960255808/8.0),
+ REAL_CONST(148270.90293983606/8.0),
+ REAL_CONST(148297.0674313365/8.0),
+ REAL_CONST(148323.23307695755/8.0),
+ REAL_CONST(148349.39987659742/8.0),
+ REAL_CONST(148375.56783015432/8.0),
+ REAL_CONST(148401.73693752653/8.0),
+ REAL_CONST(148427.90719861226/8.0),
+ REAL_CONST(148454.07861330983/8.0),
+ REAL_CONST(148480.25118151752/8.0),
+ REAL_CONST(148506.42490313368/8.0),
+ REAL_CONST(148532.59977805667/8.0),
+ REAL_CONST(148558.77580618486/8.0),
+ REAL_CONST(148584.95298741665/8.0),
+ REAL_CONST(148611.13132165043/8.0),
+ REAL_CONST(148637.31080878471/8.0),
+ REAL_CONST(148663.49144871789/8.0),
+ REAL_CONST(148689.6732413485/8.0),
+ REAL_CONST(148715.85618657502/8.0),
+ REAL_CONST(148742.040284296/8.0),
+ REAL_CONST(148768.22553440998/8.0),
+ REAL_CONST(148794.41193681557/8.0),
+ REAL_CONST(148820.59949141133/8.0),
+ REAL_CONST(148846.78819809589/8.0),
+ REAL_CONST(148872.97805676793/8.0),
+ REAL_CONST(148899.16906732606/8.0),
+ REAL_CONST(148925.36122966901/8.0),
+ REAL_CONST(148951.55454369547/8.0),
+ REAL_CONST(148977.74900930419/8.0),
+ REAL_CONST(149003.9446263939/8.0),
+ REAL_CONST(149030.1413948634/8.0),
+ REAL_CONST(149056.33931461151/8.0),
+ REAL_CONST(149082.53838553699/8.0),
+ REAL_CONST(149108.73860753875/8.0),
+ REAL_CONST(149134.9399805156/8.0),
+ REAL_CONST(149161.14250436646/8.0),
+ REAL_CONST(149187.34617899026/8.0),
+ REAL_CONST(149213.5510042859/8.0),
+ REAL_CONST(149239.75698015234/8.0),
+ REAL_CONST(149265.96410648854/8.0),
+ REAL_CONST(149292.17238319354/8.0),
+ REAL_CONST(149318.38181016635/8.0),
+ REAL_CONST(149344.59238730598/8.0),
+ REAL_CONST(149370.80411451156/8.0),
+ REAL_CONST(149397.01699168212/8.0),
+ REAL_CONST(149423.23101871679/8.0),
+ REAL_CONST(149449.44619551473/8.0),
+ REAL_CONST(149475.66252197503/8.0),
+ REAL_CONST(149501.87999799693/8.0),
+ REAL_CONST(149528.0986234796/8.0),
+ REAL_CONST(149554.31839832227/8.0),
+ REAL_CONST(149580.53932242419/8.0),
+ REAL_CONST(149606.76139568459/8.0),
+ REAL_CONST(149632.98461800278/8.0),
+ REAL_CONST(149659.20898927809/8.0),
+ REAL_CONST(149685.43450940982/8.0),
+ REAL_CONST(149711.66117829733/8.0),
+ REAL_CONST(149737.88899584001/8.0),
+ REAL_CONST(149764.11796193724/8.0),
+ REAL_CONST(149790.34807648844/8.0),
+ REAL_CONST(149816.57933939309/8.0),
+ REAL_CONST(149842.81175055061/8.0),
+ REAL_CONST(149869.04530986046/8.0),
+ REAL_CONST(149895.28001722222/8.0),
+ REAL_CONST(149921.51587253538/8.0),
+ REAL_CONST(149947.75287569952/8.0),
+ REAL_CONST(149973.99102661415/8.0),
+ REAL_CONST(150000.23032517891/8.0),
+ REAL_CONST(150026.47077129342/8.0),
+ REAL_CONST(150052.71236485732/8.0),
+ REAL_CONST(150078.95510577026/8.0),
+ REAL_CONST(150105.1989939319/8.0),
+ REAL_CONST(150131.444029242/8.0),
+ REAL_CONST(150157.69021160025/8.0),
+ REAL_CONST(150183.93754090639/8.0),
+ REAL_CONST(150210.18601706024/8.0),
+ REAL_CONST(150236.43563996154/8.0),
+ REAL_CONST(150262.68640951012/8.0),
+ REAL_CONST(150288.93832560582/8.0),
+ REAL_CONST(150315.19138814852/8.0),
+ REAL_CONST(150341.44559703805/8.0),
+ REAL_CONST(150367.70095217437/8.0),
+ REAL_CONST(150393.95745345735/8.0),
+ REAL_CONST(150420.21510078697/8.0),
+ REAL_CONST(150446.47389406321/8.0),
+ REAL_CONST(150472.73383318601/8.0),
+ REAL_CONST(150498.99491805542/8.0),
+ REAL_CONST(150525.25714857146/8.0),
+ REAL_CONST(150551.52052463419/8.0),
+ REAL_CONST(150577.78504614369/8.0),
+ REAL_CONST(150604.05071300003/8.0),
+ REAL_CONST(150630.31752510337/8.0),
+ REAL_CONST(150656.58548235384/8.0),
+ REAL_CONST(150682.85458465159/8.0),
+ REAL_CONST(150709.1248318968/8.0),
+ REAL_CONST(150735.39622398972/8.0),
+ REAL_CONST(150761.66876083051/8.0),
+ REAL_CONST(150787.9424423195/8.0),
+ REAL_CONST(150814.21726835691/8.0),
+ REAL_CONST(150840.49323884305/8.0),
+ REAL_CONST(150866.77035367821/8.0),
+ REAL_CONST(150893.04861276277/8.0),
+ REAL_CONST(150919.32801599705/8.0),
+ REAL_CONST(150945.60856328148/8.0),
+ REAL_CONST(150971.89025451642/8.0),
+ REAL_CONST(150998.17308960229/8.0),
+ REAL_CONST(151024.45706843957/8.0),
+ REAL_CONST(151050.74219092872/8.0),
+ REAL_CONST(151077.02845697021/8.0),
+ REAL_CONST(151103.31586646455/8.0),
+ REAL_CONST(151129.60441931229/8.0),
+ REAL_CONST(151155.894115414/8.0),
+ REAL_CONST(151182.1849546702/8.0),
+ REAL_CONST(151208.47693698155/8.0),
+ REAL_CONST(151234.77006224863/8.0),
+ REAL_CONST(151261.06433037209/8.0),
+ REAL_CONST(151287.35974125259/8.0),
+ REAL_CONST(151313.65629479082/8.0),
+ REAL_CONST(151339.95399088747/8.0),
+ REAL_CONST(151366.25282944329/8.0),
+ REAL_CONST(151392.55281035902/8.0),
+ REAL_CONST(151418.85393353543/8.0),
+ REAL_CONST(151445.1561988733/8.0),
+ REAL_CONST(151471.45960627345/8.0),
+ REAL_CONST(151497.76415563675/8.0),
+ REAL_CONST(151524.06984686397/8.0),
+ REAL_CONST(151550.37667985607/8.0),
+ REAL_CONST(151576.68465451393/8.0),
+ REAL_CONST(151602.99377073845/8.0),
+ REAL_CONST(151629.30402843058/8.0),
+ REAL_CONST(151655.61542749128/8.0),
+ REAL_CONST(151681.92796782157/8.0),
+ REAL_CONST(151708.24164932242/8.0),
+ REAL_CONST(151734.55647189484/8.0),
+ REAL_CONST(151760.87243543993/8.0),
+ REAL_CONST(151787.18953985872/8.0),
+ REAL_CONST(151813.50778505235/8.0),
+ REAL_CONST(151839.82717092187/8.0),
+ REAL_CONST(151866.14769736846/8.0),
+ REAL_CONST(151892.46936429327/8.0),
+ REAL_CONST(151918.79217159748/8.0),
+ REAL_CONST(151945.11611918229/8.0),
+ REAL_CONST(151971.44120694889/8.0),
+ REAL_CONST(151997.76743479856/8.0),
+ REAL_CONST(152024.09480263255/8.0),
+ REAL_CONST(152050.42331035214/8.0),
+ REAL_CONST(152076.75295785864/8.0),
+ REAL_CONST(152103.08374505339/8.0),
+ REAL_CONST(152129.41567183775/8.0),
+ REAL_CONST(152155.74873811303/8.0),
+ REAL_CONST(152182.08294378067/8.0),
+ REAL_CONST(152208.41828874208/8.0),
+ REAL_CONST(152234.75477289871/8.0),
+ REAL_CONST(152261.09239615197/8.0),
+ REAL_CONST(152287.43115840337/8.0),
+ REAL_CONST(152313.77105955439/8.0),
+ REAL_CONST(152340.11209950657/8.0),
+ REAL_CONST(152366.45427816146/8.0),
+ REAL_CONST(152392.79759542056/8.0),
+ REAL_CONST(152419.14205118554/8.0),
+ REAL_CONST(152445.48764535793/8.0),
+ REAL_CONST(152471.8343778394/8.0),
+ REAL_CONST(152498.18224853161/8.0),
+ REAL_CONST(152524.53125733617/8.0),
+ REAL_CONST(152550.88140415482/8.0),
+ REAL_CONST(152577.23268888926/8.0),
+ REAL_CONST(152603.58511144121/8.0),
+ REAL_CONST(152629.93867171241/8.0),
+ REAL_CONST(152656.29336960468/8.0),
+ REAL_CONST(152682.64920501978/8.0),
+ REAL_CONST(152709.00617785956/8.0),
+ REAL_CONST(152735.36428802583/8.0),
+ REAL_CONST(152761.72353542043/8.0),
+ REAL_CONST(152788.08391994529/8.0),
+ REAL_CONST(152814.44544150229/8.0),
+ REAL_CONST(152840.80809999333/8.0),
+ REAL_CONST(152867.17189532038/8.0),
+ REAL_CONST(152893.53682738543/8.0),
+ REAL_CONST(152919.90289609041/8.0),
+ REAL_CONST(152946.27010133737/8.0),
+ REAL_CONST(152972.63844302832/8.0),
+ REAL_CONST(152999.00792106529/8.0),
+ REAL_CONST(153025.37853535041/8.0),
+ REAL_CONST(153051.7502857857/8.0),
+ REAL_CONST(153078.12317227334/8.0),
+ REAL_CONST(153104.4971947154/8.0),
+ REAL_CONST(153130.8723530141/8.0),
+ REAL_CONST(153157.24864707157/8.0),
+ REAL_CONST(153183.62607679001/8.0),
+ REAL_CONST(153210.00464207167/8.0),
+ REAL_CONST(153236.38434281875/8.0),
+ REAL_CONST(153262.76517893354/8.0),
+ REAL_CONST(153289.14715031831/8.0),
+ REAL_CONST(153315.53025687535/8.0),
+ REAL_CONST(153341.91449850702/8.0),
+ REAL_CONST(153368.2998751156/8.0),
+ REAL_CONST(153394.68638660354/8.0),
+ REAL_CONST(153421.07403287315/8.0),
+ REAL_CONST(153447.46281382689/8.0),
+ REAL_CONST(153473.85272936718/8.0),
+ REAL_CONST(153500.24377939643/8.0),
+ REAL_CONST(153526.63596381716/8.0),
+ REAL_CONST(153553.02928253182/8.0),
+ REAL_CONST(153579.42373544298/8.0),
+ REAL_CONST(153605.81932245308/8.0),
+ REAL_CONST(153632.21604346478/8.0),
+ REAL_CONST(153658.61389838057/8.0),
+ REAL_CONST(153685.0128871031/8.0),
+ REAL_CONST(153711.41300953497/8.0),
+ REAL_CONST(153737.81426557881/8.0),
+ REAL_CONST(153764.21665513728/8.0),
+ REAL_CONST(153790.62017811305/8.0),
+ REAL_CONST(153817.02483440886/8.0),
+ REAL_CONST(153843.43062392739/8.0),
+ REAL_CONST(153869.83754657139/8.0),
+ REAL_CONST(153896.24560224367/8.0),
+ REAL_CONST(153922.65479084692/8.0),
+ REAL_CONST(153949.06511228404/8.0),
+ REAL_CONST(153975.4765664578/8.0),
+ REAL_CONST(154001.88915327107/8.0),
+ REAL_CONST(154028.30287262669/8.0),
+ REAL_CONST(154054.71772442761/8.0),
+ REAL_CONST(154081.13370857667/8.0),
+ REAL_CONST(154107.55082497682/8.0),
+ REAL_CONST(154133.96907353101/8.0),
+ REAL_CONST(154160.38845414223/8.0),
+ REAL_CONST(154186.80896671346/8.0),
+ REAL_CONST(154213.23061114774/8.0),
+ REAL_CONST(154239.65338734805/8.0),
+ REAL_CONST(154266.07729521746/8.0),
+ REAL_CONST(154292.50233465908/8.0),
+ REAL_CONST(154318.92850557598/8.0),
+ REAL_CONST(154345.35580787127/8.0),
+ REAL_CONST(154371.7842414481/8.0),
+ REAL_CONST(154398.21380620965/8.0),
+ REAL_CONST(154424.64450205903/8.0),
+ REAL_CONST(154451.07632889951/8.0),
+ REAL_CONST(154477.50928663427/8.0),
+ REAL_CONST(154503.94337516659/8.0),
+ REAL_CONST(154530.37859439969/8.0),
+ REAL_CONST(154556.81494423689/8.0),
+ REAL_CONST(154583.25242458144/8.0),
+ REAL_CONST(154609.69103533673/8.0),
+ REAL_CONST(154636.13077640603/8.0),
+ REAL_CONST(154662.57164769279/8.0),
+ REAL_CONST(154689.01364910032/8.0),
+ REAL_CONST(154715.45678053208/8.0),
+ REAL_CONST(154741.90104189145/8.0),
+ REAL_CONST(154768.34643308193/8.0),
+ REAL_CONST(154794.79295400696/8.0),
+ REAL_CONST(154821.24060457002/8.0),
+ REAL_CONST(154847.68938467462/8.0),
+ REAL_CONST(154874.13929422433/8.0),
+ REAL_CONST(154900.59033312264/8.0),
+ REAL_CONST(154927.04250127316/8.0),
+ REAL_CONST(154953.49579857948/8.0),
+ REAL_CONST(154979.95022494521/8.0),
+ REAL_CONST(155006.40578027396/8.0),
+ REAL_CONST(155032.86246446942/8.0),
+ REAL_CONST(155059.32027743524/8.0),
+ REAL_CONST(155085.77921907514/8.0),
+ REAL_CONST(155112.2392892928/8.0),
+ REAL_CONST(155138.70048799197/8.0),
+ REAL_CONST(155165.16281507642/8.0),
+ REAL_CONST(155191.62627044989/8.0),
+ REAL_CONST(155218.09085401625/8.0),
+ REAL_CONST(155244.55656567923/8.0),
+ REAL_CONST(155271.02340534274/8.0),
+ REAL_CONST(155297.49137291059/8.0),
+ REAL_CONST(155323.96046828668/8.0),
+ REAL_CONST(155350.4306913749/8.0),
+ REAL_CONST(155376.90204207919/8.0),
+ REAL_CONST(155403.37452030348/8.0),
+ REAL_CONST(155429.84812595171/8.0),
+ REAL_CONST(155456.32285892789/8.0),
+ REAL_CONST(155482.79871913602/8.0),
+ REAL_CONST(155509.27570648011/8.0),
+ REAL_CONST(155535.75382086422/8.0),
+ REAL_CONST(155562.23306219239/8.0),
+ REAL_CONST(155588.71343036872/8.0),
+ REAL_CONST(155615.19492529731/8.0),
+ REAL_CONST(155641.67754688227/8.0),
+ REAL_CONST(155668.16129502779/8.0),
+ REAL_CONST(155694.64616963797/8.0),
+ REAL_CONST(155721.13217061706/8.0),
+ REAL_CONST(155747.61929786921/8.0),
+ REAL_CONST(155774.10755129869/8.0),
+ REAL_CONST(155800.59693080973/8.0),
+ REAL_CONST(155827.08743630661/8.0),
+ REAL_CONST(155853.57906769359/8.0),
+ REAL_CONST(155880.07182487496/8.0),
+ REAL_CONST(155906.56570775513/8.0),
+ REAL_CONST(155933.06071623837/8.0),
+ REAL_CONST(155959.55685022907/8.0),
+ REAL_CONST(155986.05410963166/8.0),
+ REAL_CONST(156012.5524943505/8.0),
+ REAL_CONST(156039.05200429002/8.0),
+ REAL_CONST(156065.55263935472/8.0),
+ REAL_CONST(156092.054399449/8.0),
+ REAL_CONST(156118.5572844774/8.0),
+ REAL_CONST(156145.06129434443/8.0),
+ REAL_CONST(156171.5664289546/8.0),
+ REAL_CONST(156198.07268821247/8.0),
+ REAL_CONST(156224.5800720226/8.0),
+ REAL_CONST(156251.08858028959/8.0),
+ REAL_CONST(156277.59821291809/8.0),
+ REAL_CONST(156304.10896981266/8.0),
+ REAL_CONST(156330.62085087801/8.0),
+ REAL_CONST(156357.1338560188/8.0),
+ REAL_CONST(156383.64798513969/8.0),
+ REAL_CONST(156410.16323814544/8.0),
+ REAL_CONST(156436.67961494075/8.0),
+ REAL_CONST(156463.1971154304/8.0),
+ REAL_CONST(156489.71573951913/8.0),
+ REAL_CONST(156516.23548711176/8.0),
+ REAL_CONST(156542.75635811311/8.0),
+ REAL_CONST(156569.27835242799/8.0),
+ REAL_CONST(156595.80146996127/8.0),
+ REAL_CONST(156622.32571061782/8.0),
+ REAL_CONST(156648.85107430254/8.0),
+ REAL_CONST(156675.37756092031/8.0),
+ REAL_CONST(156701.90517037612/8.0),
+ REAL_CONST(156728.43390257491/8.0),
+ REAL_CONST(156754.96375742162/8.0),
+ REAL_CONST(156781.49473482129/8.0),
+ REAL_CONST(156808.02683467892/8.0),
+ REAL_CONST(156834.5600568995/8.0),
+ REAL_CONST(156861.09440138817/8.0),
+ REAL_CONST(156887.62986804993/8.0),
+ REAL_CONST(156914.16645678994/8.0),
+ REAL_CONST(156940.70416751326/8.0),
+ REAL_CONST(156967.24300012505/8.0),
+ REAL_CONST(156993.78295453047/8.0),
+ REAL_CONST(157020.32403063469/8.0),
+ REAL_CONST(157046.8662283429/8.0),
+ REAL_CONST(157073.40954756032/8.0),
+ REAL_CONST(157099.9539881922/8.0),
+ REAL_CONST(157126.49955014378/8.0),
+ REAL_CONST(157153.04623332032/8.0),
+ REAL_CONST(157179.59403762716/8.0),
+ REAL_CONST(157206.14296296958/8.0),
+ REAL_CONST(157232.69300925292/8.0),
+ REAL_CONST(157259.24417638258/8.0),
+ REAL_CONST(157285.79646426387/8.0),
+ REAL_CONST(157312.34987280221/8.0),
+ REAL_CONST(157338.90440190304/8.0),
+ REAL_CONST(157365.46005147175/8.0),
+ REAL_CONST(157392.01682141385/8.0),
+ REAL_CONST(157418.57471163478/8.0),
+ REAL_CONST(157445.13372204005/8.0),
+ REAL_CONST(157471.69385253513/8.0),
+ REAL_CONST(157498.25510302564/8.0),
+ REAL_CONST(157524.81747341706/8.0),
+ REAL_CONST(157551.38096361503/8.0),
+ REAL_CONST(157577.9455735251/8.0),
+ REAL_CONST(157604.51130305286/8.0),
+ REAL_CONST(157631.07815210402/8.0),
+ REAL_CONST(157657.64612058419/8.0),
+ REAL_CONST(157684.21520839902/8.0),
+ REAL_CONST(157710.78541545427/8.0),
+ REAL_CONST(157737.35674165559/8.0),
+ REAL_CONST(157763.92918690876/8.0),
+ REAL_CONST(157790.50275111952/8.0),
+ REAL_CONST(157817.07743419363/8.0),
+ REAL_CONST(157843.65323603692/8.0),
+ REAL_CONST(157870.23015655516/8.0),
+ REAL_CONST(157896.80819565422/8.0),
+ REAL_CONST(157923.3873532399/8.0),
+ REAL_CONST(157949.96762921812/8.0),
+ REAL_CONST(157976.54902349479/8.0),
+ REAL_CONST(158003.13153597576/8.0),
+ REAL_CONST(158029.71516656701/8.0),
+ REAL_CONST(158056.29991517449/8.0),
+ REAL_CONST(158082.88578170416/8.0),
+ REAL_CONST(158109.47276606198/8.0),
+ REAL_CONST(158136.06086815402/8.0),
+ REAL_CONST(158162.65008788629/8.0),
+ REAL_CONST(158189.24042516484/8.0),
+ REAL_CONST(158215.83187989573/8.0),
+ REAL_CONST(158242.42445198505/8.0),
+ REAL_CONST(158269.01814133892/8.0),
+ REAL_CONST(158295.61294786347/8.0),
+ REAL_CONST(158322.20887146486/8.0),
+ REAL_CONST(158348.80591204923/8.0),
+ REAL_CONST(158375.4040695228/8.0),
+ REAL_CONST(158402.00334379176/8.0),
+ REAL_CONST(158428.60373476235/8.0),
+ REAL_CONST(158455.2052423408/8.0),
+ REAL_CONST(158481.80786643337/8.0),
+ REAL_CONST(158508.41160694641/8.0),
+ REAL_CONST(158535.01646378616/8.0),
+ REAL_CONST(158561.62243685898/8.0),
+ REAL_CONST(158588.2295260712/8.0),
+ REAL_CONST(158614.8377313292/8.0),
+ REAL_CONST(158641.44705253936/8.0),
+ REAL_CONST(158668.05748960807/8.0),
+ REAL_CONST(158694.66904244179/8.0),
+ REAL_CONST(158721.28171094693/8.0),
+ REAL_CONST(158747.89549502998/8.0),
+ REAL_CONST(158774.5103945974/8.0),
+ REAL_CONST(158801.12640955573/8.0),
+ REAL_CONST(158827.74353981143/8.0),
+ REAL_CONST(158854.36178527112/8.0),
+ REAL_CONST(158880.9811458413/8.0),
+ REAL_CONST(158907.60162142856/8.0),
+ REAL_CONST(158934.22321193956/8.0),
+ REAL_CONST(158960.84591728085/8.0),
+ REAL_CONST(158987.46973735912/8.0),
+ REAL_CONST(159014.09467208097/8.0),
+ REAL_CONST(159040.72072135314/8.0),
+ REAL_CONST(159067.3478850823/8.0),
+ REAL_CONST(159093.97616317519/8.0),
+ REAL_CONST(159120.60555553852/8.0),
+ REAL_CONST(159147.23606207906/8.0),
+ REAL_CONST(159173.8676827036/8.0),
+ REAL_CONST(159200.50041731889/8.0),
+ REAL_CONST(159227.13426583182/8.0),
+ REAL_CONST(159253.76922814918/8.0),
+ REAL_CONST(159280.40530417781/8.0),
+ REAL_CONST(159307.04249382461/8.0),
+ REAL_CONST(159333.68079699649/8.0),
+ REAL_CONST(159360.32021360032/8.0),
+ REAL_CONST(159386.96074354305/8.0),
+ REAL_CONST(159413.60238673165/8.0),
+ REAL_CONST(159440.24514307309/8.0),
+ REAL_CONST(159466.88901247433/8.0),
+ REAL_CONST(159493.53399484244/8.0),
+ REAL_CONST(159520.18009008438/8.0),
+ REAL_CONST(159546.82729810724/8.0),
+ REAL_CONST(159573.47561881805/8.0),
+ REAL_CONST(159600.12505212394/8.0),
+ REAL_CONST(159626.77559793202/8.0),
+ REAL_CONST(159653.42725614941/8.0),
+ REAL_CONST(159680.08002668325/8.0),
+ REAL_CONST(159706.73390944069/8.0),
+ REAL_CONST(159733.38890432892/8.0),
+ REAL_CONST(159760.04501125516/8.0),
+ REAL_CONST(159786.70223012666/8.0),
+ REAL_CONST(159813.36056085059/8.0),
+ REAL_CONST(159840.02000333427/8.0),
+ REAL_CONST(159866.68055748497/8.0),
+ REAL_CONST(159893.34222320997/8.0),
+ REAL_CONST(159920.00500041663/8.0),
+ REAL_CONST(159946.66888901225/8.0),
+ REAL_CONST(159973.33388890422/8.0),
+ REAL_CONST(159999.99999999988/8.0),
+ REAL_CONST(160026.66722220668/8.0),
+ REAL_CONST(160053.33555543202/8.0),
+ REAL_CONST(160080.0049995833/8.0),
+ REAL_CONST(160106.67555456801/8.0),
+ REAL_CONST(160133.3472202936/8.0),
+ REAL_CONST(160160.0199966676/8.0),
+ REAL_CONST(160186.6938835975/8.0),
+ REAL_CONST(160213.36888099083/8.0),
+ REAL_CONST(160240.04498875517/8.0),
+ REAL_CONST(160266.72220679806/8.0),
+ REAL_CONST(160293.40053502709/8.0),
+ REAL_CONST(160320.07997334987/8.0),
+ REAL_CONST(160346.76052167406/8.0),
+ REAL_CONST(160373.44217990729/8.0),
+ REAL_CONST(160400.1249479572/8.0),
+ REAL_CONST(160426.80882573154/8.0),
+ REAL_CONST(160453.49381313793/8.0),
+ REAL_CONST(160480.17991008417/8.0),
+ REAL_CONST(160506.86711647795/8.0),
+ REAL_CONST(160533.55543222709/8.0),
+ REAL_CONST(160560.24485723933/8.0),
+ REAL_CONST(160586.93539142248/8.0),
+ REAL_CONST(160613.62703468435/8.0),
+ REAL_CONST(160640.31978693281/8.0),
+ REAL_CONST(160667.01364807569/8.0),
+ REAL_CONST(160693.70861802087/8.0),
+ REAL_CONST(160720.40469667627/8.0),
+ REAL_CONST(160747.1018839498/8.0),
+ REAL_CONST(160773.80017974938/8.0),
+ REAL_CONST(160800.49958398298/8.0),
+ REAL_CONST(160827.20009655855/8.0),
+ REAL_CONST(160853.90171738411/8.0),
+ REAL_CONST(160880.60444636765/8.0),
+ REAL_CONST(160907.30828341722/8.0),
+ REAL_CONST(160934.01322844089/8.0),
+ REAL_CONST(160960.71928134665/8.0),
+ REAL_CONST(160987.42644204266/8.0),
+ REAL_CONST(161014.13471043704/8.0),
+ REAL_CONST(161040.84408643784/8.0),
+ REAL_CONST(161067.55456995327/8.0),
+ REAL_CONST(161094.26616089148/8.0),
+ REAL_CONST(161120.97885916062/8.0),
+ REAL_CONST(161147.69266466892/8.0),
+ REAL_CONST(161174.40757732463/8.0),
+ REAL_CONST(161201.12359703594/8.0),
+ REAL_CONST(161227.84072371112/8.0),
+ REAL_CONST(161254.55895725847/8.0),
+ REAL_CONST(161281.27829758628/8.0),
+ REAL_CONST(161307.99874460287/8.0),
+ REAL_CONST(161334.72029821656/8.0),
+ REAL_CONST(161361.44295833571/8.0),
+ REAL_CONST(161388.1667248687/8.0),
+ REAL_CONST(161414.89159772391/8.0),
+ REAL_CONST(161441.61757680977/8.0),
+ REAL_CONST(161468.34466203468/8.0),
+ REAL_CONST(161495.07285330712/8.0),
+ REAL_CONST(161521.80215053557/8.0),
+ REAL_CONST(161548.53255362847/8.0),
+ REAL_CONST(161575.26406249436/8.0),
+ REAL_CONST(161601.99667704175/8.0),
+ REAL_CONST(161628.7303971792/8.0),
+ REAL_CONST(161655.46522281526/8.0),
+ REAL_CONST(161682.20115385848/8.0),
+ REAL_CONST(161708.93819021754/8.0),
+ REAL_CONST(161735.67633180099/8.0),
+ REAL_CONST(161762.41557851751/8.0),
+ REAL_CONST(161789.15593027571/8.0),
+ REAL_CONST(161815.89738698432/8.0),
+ REAL_CONST(161842.63994855201/8.0),
+ REAL_CONST(161869.38361488748/8.0),
+ REAL_CONST(161896.1283858995/8.0),
+ REAL_CONST(161922.87426149679/8.0),
+ REAL_CONST(161949.62124158812/8.0),
+ REAL_CONST(161976.36932608229/8.0),
+ REAL_CONST(162003.1185148881/8.0),
+ REAL_CONST(162029.8688079144/8.0),
+ REAL_CONST(162056.62020507001/8.0),
+ REAL_CONST(162083.37270626382/8.0),
+ REAL_CONST(162110.12631140469/8.0),
+ REAL_CONST(162136.88102040152/8.0),
+ REAL_CONST(162163.63683316324/8.0),
+ REAL_CONST(162190.39374959879/8.0),
+ REAL_CONST(162217.15176961714/8.0),
+ REAL_CONST(162243.91089312723/8.0),
+ REAL_CONST(162270.67112003808/8.0),
+ REAL_CONST(162297.43245025873/8.0),
+ REAL_CONST(162324.19488369819/8.0),
+ REAL_CONST(162350.9584202655/8.0),
+ REAL_CONST(162377.72305986975/8.0),
+ REAL_CONST(162404.48880242003/8.0),
+ REAL_CONST(162431.25564782543/8.0),
+ REAL_CONST(162458.02359599507/8.0),
+ REAL_CONST(162484.79264683815/8.0),
+ REAL_CONST(162511.56280026378/8.0),
+ REAL_CONST(162538.33405618116/8.0),
+ REAL_CONST(162565.10641449949/8.0),
+ REAL_CONST(162591.87987512801/8.0),
+ REAL_CONST(162618.65443797593/8.0),
+ REAL_CONST(162645.43010295252/8.0),
+ REAL_CONST(162672.20686996708/8.0),
+ REAL_CONST(162698.98473892888/8.0),
+ REAL_CONST(162725.76370974723/8.0),
+ REAL_CONST(162752.54378233149/8.0),
+ REAL_CONST(162779.32495659095/8.0),
+ REAL_CONST(162806.10723243505/8.0),
+ REAL_CONST(162832.89060977317/8.0),
+ REAL_CONST(162859.67508851466/8.0),
+ REAL_CONST(162886.46066856899/8.0),
+ REAL_CONST(162913.24734984562/8.0),
+ REAL_CONST(162940.03513225398/8.0),
+ REAL_CONST(162966.82401570358/8.0),
+ REAL_CONST(162993.6140001039/8.0),
+ REAL_CONST(163020.40508536444/8.0),
+ REAL_CONST(163047.19727139481/8.0),
+ REAL_CONST(163073.99055810447/8.0),
+ REAL_CONST(163100.78494540305/8.0),
+ REAL_CONST(163127.58043320014/8.0),
+ REAL_CONST(163154.37702140535/8.0),
+ REAL_CONST(163181.17470992831/8.0),
+ REAL_CONST(163207.97349867865/8.0),
+ REAL_CONST(163234.77338756606/8.0),
+ REAL_CONST(163261.57437650024/8.0),
+ REAL_CONST(163288.37646539087/8.0),
+ REAL_CONST(163315.17965414765/8.0),
+ REAL_CONST(163341.98394268038/8.0),
+ REAL_CONST(163368.78933089875/8.0),
+ REAL_CONST(163395.59581871261/8.0),
+ REAL_CONST(163422.40340603172/8.0),
+ REAL_CONST(163449.2120927659/8.0),
+ REAL_CONST(163476.02187882498/8.0),
+ REAL_CONST(163502.83276411882/8.0),
+ REAL_CONST(163529.6447485573/8.0),
+ REAL_CONST(163556.45783205028/8.0),
+ REAL_CONST(163583.2720145077/8.0),
+ REAL_CONST(163610.08729583945/8.0),
+ REAL_CONST(163636.90367595552/8.0),
+ REAL_CONST(163663.72115476584/8.0),
+ REAL_CONST(163690.53973218042/8.0),
+ REAL_CONST(163717.35940810922/8.0),
+ REAL_CONST(163744.18018246227/8.0),
+ REAL_CONST(163771.00205514964/8.0),
+ REAL_CONST(163797.82502608138/8.0),
+ REAL_CONST(163824.64909516752/8.0),
+ REAL_CONST(163851.4742623182/8.0),
+ REAL_CONST(163878.3005274435/8.0),
+ REAL_CONST(163905.12789045356/8.0),
+ REAL_CONST(163931.95635125853/8.0),
+ REAL_CONST(163958.78590976857/8.0),
+ REAL_CONST(163985.61656589387/8.0),
+ REAL_CONST(164012.44831954464/8.0),
+ REAL_CONST(164039.28117063109/8.0),
+ REAL_CONST(164066.11511906344/8.0),
+ REAL_CONST(164092.95016475199/8.0),
+ REAL_CONST(164119.78630760699/8.0),
+ REAL_CONST(164146.62354753874/8.0),
+ REAL_CONST(164173.46188445756/8.0),
+ REAL_CONST(164200.30131827376/8.0),
+ REAL_CONST(164227.14184889771/8.0),
+ REAL_CONST(164253.98347623978/8.0),
+ REAL_CONST(164280.82620021031/8.0),
+ REAL_CONST(164307.67002071979/8.0),
+ REAL_CONST(164334.51493767856/8.0),
+ REAL_CONST(164361.3609509971/8.0),
+ REAL_CONST(164388.20806058586/8.0),
+ REAL_CONST(164415.05626635533/8.0),
+ REAL_CONST(164441.905568216/8.0),
+ REAL_CONST(164468.75596607837/8.0),
+ REAL_CONST(164495.607459853/8.0),
+ REAL_CONST(164522.4600494504/8.0),
+ REAL_CONST(164549.31373478117/8.0),
+ REAL_CONST(164576.16851575591/8.0),
+ REAL_CONST(164603.02439228518/8.0),
+ REAL_CONST(164629.88136427966/8.0),
+ REAL_CONST(164656.73943164994/8.0),
+ REAL_CONST(164683.59859430668/8.0),
+ REAL_CONST(164710.45885216061/8.0),
+ REAL_CONST(164737.32020512238/8.0),
+ REAL_CONST(164764.1826531027/8.0),
+ REAL_CONST(164791.04619601235/8.0),
+ REAL_CONST(164817.91083376206/8.0),
+ REAL_CONST(164844.77656626256/8.0),
+ REAL_CONST(164871.64339342469/8.0),
+ REAL_CONST(164898.51131515924/8.0),
+ REAL_CONST(164925.38033137703/8.0),
+ REAL_CONST(164952.25044198887/8.0),
+ REAL_CONST(164979.1216469057/8.0),
+ REAL_CONST(165005.9939460383/8.0),
+ REAL_CONST(165032.86733929763/8.0),
+ REAL_CONST(165059.7418265946/8.0),
+ REAL_CONST(165086.61740784015/8.0),
+ REAL_CONST(165113.4940829452/8.0)
+#endif
+};
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/is.c b/src/filters/transform/mpadecfilter/faad2/libfaad/is.c
new file mode 100644
index 000000000..f765a416a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/is.c
@@ -0,0 +1,111 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: is.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+#include "is.h"
+
+#ifdef FIXED_POINT
+static real_t pow05_table[] = {
+ COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */
+ COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */
+ COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */
+ COEF_CONST(1.0), /* 0.5^( 0/4) */
+ COEF_CONST(0.84089641525371), /* 0.5^(+1/4) */
+ COEF_CONST(0.70710678118655), /* 0.5^(+2/4) */
+ COEF_CONST(0.59460355750136) /* 0.5^(+3/4) */
+};
+#endif
+
+void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+ uint16_t frame_len)
+{
+ uint8_t g, sfb, b;
+ uint16_t i;
+#ifndef FIXED_POINT
+ real_t scale;
+#else
+ int32_t exp, frac;
+#endif
+
+ uint16_t nshort = frame_len/8;
+ uint8_t group = 0;
+
+ for (g = 0; g < icsr->num_window_groups; g++)
+ {
+ /* Do intensity stereo decoding */
+ for (b = 0; b < icsr->window_group_length[g]; b++)
+ {
+ for (sfb = 0; sfb < icsr->max_sfb; sfb++)
+ {
+ if (is_intensity(icsr, g, sfb))
+ {
+#ifdef MAIN_DEC
+ /* For scalefactor bands coded in intensity stereo the
+ corresponding predictors in the right channel are
+ switched to "off".
+ */
+ ics->pred.prediction_used[sfb] = 0;
+ icsr->pred.prediction_used[sfb] = 0;
+#endif
+
+#ifndef FIXED_POINT
+ scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb]));
+#else
+ exp = icsr->scale_factors[g][sfb] >> 2;
+ frac = icsr->scale_factors[g][sfb] & 3;
+#endif
+
+ /* Scale from left to right channel,
+ do not touch left channel */
+ for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++)
+ {
+#ifndef FIXED_POINT
+ r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale);
+#else
+ if (exp < 0)
+ r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp;
+ else
+ r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp;
+ r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]);
+#endif
+ if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
+ r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i];
+ }
+ }
+ }
+ group++;
+ }
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/is.h b/src/filters/transform/mpadecfilter/faad2/libfaad/is.h
new file mode 100644
index 000000000..c3717f766
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/is.h
@@ -0,0 +1,69 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: is.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __IS_H__
+#define __IS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "syntax.h"
+
+void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+ uint16_t frame_len);
+
+static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+ switch (ics->sfb_cb[group][sfb])
+ {
+ case INTENSITY_HCB:
+ return 1;
+ case INTENSITY_HCB2:
+ return -1;
+ default:
+ return 0;
+ }
+}
+
+static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+ if (ics->ms_mask_present == 1)
+ return (1-2*ics->ms_used[group][sfb]);
+ return 1;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/kbd_win.h b/src/filters/transform/mpadecfilter/faad2/libfaad/kbd_win.h
new file mode 100644
index 000000000..6e3419bae
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/kbd_win.h
@@ -0,0 +1,2299 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: kbd_win.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __KBD_WIN_H__
+#define __KBD_WIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+ALIGN static const real_t kbd_long_1024[] =
+{
+ FRAC_CONST(0.00029256153896361),
+ FRAC_CONST(0.00042998567353047),
+ FRAC_CONST(0.00054674074589540),
+ FRAC_CONST(0.00065482304299792),
+ FRAC_CONST(0.00075870195068747),
+ FRAC_CONST(0.00086059331713336),
+ FRAC_CONST(0.00096177541439010),
+ FRAC_CONST(0.0010630609410878),
+ FRAC_CONST(0.0011650036308132),
+ FRAC_CONST(0.0012680012194148),
+ FRAC_CONST(0.0013723517232956),
+ FRAC_CONST(0.0014782864109136),
+ FRAC_CONST(0.0015859901976719),
+ FRAC_CONST(0.0016956148252373),
+ FRAC_CONST(0.0018072876903517),
+ FRAC_CONST(0.0019211179405514),
+ FRAC_CONST(0.0020372007924215),
+ FRAC_CONST(0.0021556206591754),
+ FRAC_CONST(0.0022764534599614),
+ FRAC_CONST(0.0023997683540995),
+ FRAC_CONST(0.0025256290631156),
+ FRAC_CONST(0.0026540948920831),
+ FRAC_CONST(0.0027852215281403),
+ FRAC_CONST(0.0029190616715331),
+ FRAC_CONST(0.0030556655443223),
+ FRAC_CONST(0.0031950812943391),
+ FRAC_CONST(0.0033373553240392),
+ FRAC_CONST(0.0034825325586930),
+ FRAC_CONST(0.0036306566699199),
+ FRAC_CONST(0.0037817702604646),
+ FRAC_CONST(0.0039359150179719),
+ FRAC_CONST(0.0040931318437260),
+ FRAC_CONST(0.0042534609610026),
+ FRAC_CONST(0.0044169420066964),
+ FRAC_CONST(0.0045836141091341),
+ FRAC_CONST(0.0047535159544086),
+ FRAC_CONST(0.0049266858431214),
+ FRAC_CONST(0.0051031617390698),
+ FRAC_CONST(0.0052829813111335),
+ FRAC_CONST(0.0054661819693975),
+ FRAC_CONST(0.0056528008963682),
+ FRAC_CONST(0.0058428750739943),
+ FRAC_CONST(0.0060364413070882),
+ FRAC_CONST(0.0062335362436492),
+ FRAC_CONST(0.0064341963925079),
+ FRAC_CONST(0.0066384581386503),
+ FRAC_CONST(0.0068463577565218),
+ FRAC_CONST(0.0070579314215715),
+ FRAC_CONST(0.0072732152202559),
+ FRAC_CONST(0.0074922451586909),
+ FRAC_CONST(0.0077150571701162),
+ FRAC_CONST(0.0079416871213115),
+ FRAC_CONST(0.0081721708180857),
+ FRAC_CONST(0.0084065440099458),
+ FRAC_CONST(0.0086448423940363),
+ FRAC_CONST(0.0088871016184291),
+ FRAC_CONST(0.0091333572848345),
+ FRAC_CONST(0.0093836449507939),
+ FRAC_CONST(0.0096380001314086),
+ FRAC_CONST(0.0098964583006517),
+ FRAC_CONST(0.010159054892306),
+ FRAC_CONST(0.010425825300561),
+ FRAC_CONST(0.010696804880310),
+ FRAC_CONST(0.010972028947167),
+ FRAC_CONST(0.011251532777236),
+ FRAC_CONST(0.011535351606646),
+ FRAC_CONST(0.011823520630897),
+ FRAC_CONST(0.012116075003993),
+ FRAC_CONST(0.012413049837429),
+ FRAC_CONST(0.012714480198999),
+ FRAC_CONST(0.013020401111478),
+ FRAC_CONST(0.013330847551161),
+ FRAC_CONST(0.013645854446288),
+ FRAC_CONST(0.013965456675352),
+ FRAC_CONST(0.014289689065314),
+ FRAC_CONST(0.014618586389712),
+ FRAC_CONST(0.014952183366697),
+ FRAC_CONST(0.015290514656976),
+ FRAC_CONST(0.015633614861688),
+ FRAC_CONST(0.015981518520214),
+ FRAC_CONST(0.016334260107915),
+ FRAC_CONST(0.016691874033817),
+ FRAC_CONST(0.017054394638241),
+ FRAC_CONST(0.017421856190380),
+ FRAC_CONST(0.017794292885832),
+ FRAC_CONST(0.018171738844085),
+ FRAC_CONST(0.018554228105962),
+ FRAC_CONST(0.018941794631032),
+ FRAC_CONST(0.019334472294980),
+ FRAC_CONST(0.019732294886947),
+ FRAC_CONST(0.020135296106839),
+ FRAC_CONST(0.020543509562604),
+ FRAC_CONST(0.020956968767488),
+ FRAC_CONST(0.021375707137257),
+ FRAC_CONST(0.021799757987407),
+ FRAC_CONST(0.022229154530343),
+ FRAC_CONST(0.022663929872540),
+ FRAC_CONST(0.023104117011689),
+ FRAC_CONST(0.023549748833816),
+ FRAC_CONST(0.024000858110398),
+ FRAC_CONST(0.024457477495451),
+ FRAC_CONST(0.024919639522613),
+ FRAC_CONST(0.025387376602207),
+ FRAC_CONST(0.025860721018295),
+ FRAC_CONST(0.026339704925726),
+ FRAC_CONST(0.026824360347160),
+ FRAC_CONST(0.027314719170100),
+ FRAC_CONST(0.027810813143900),
+ FRAC_CONST(0.028312673876775),
+ FRAC_CONST(0.028820332832801),
+ FRAC_CONST(0.029333821328905),
+ FRAC_CONST(0.029853170531859),
+ FRAC_CONST(0.030378411455255),
+ FRAC_CONST(0.030909574956490),
+ FRAC_CONST(0.031446691733739),
+ FRAC_CONST(0.031989792322926),
+ FRAC_CONST(0.032538907094693),
+ FRAC_CONST(0.033094066251369),
+ FRAC_CONST(0.033655299823935),
+ FRAC_CONST(0.034222637668991),
+ FRAC_CONST(0.034796109465717),
+ FRAC_CONST(0.035375744712844),
+ FRAC_CONST(0.035961572725616),
+ FRAC_CONST(0.036553622632758),
+ FRAC_CONST(0.037151923373446),
+ FRAC_CONST(0.037756503694277),
+ FRAC_CONST(0.038367392146243),
+ FRAC_CONST(0.038984617081711),
+ FRAC_CONST(0.039608206651398),
+ FRAC_CONST(0.040238188801359),
+ FRAC_CONST(0.040874591269976),
+ FRAC_CONST(0.041517441584950),
+ FRAC_CONST(0.042166767060301),
+ FRAC_CONST(0.042822594793376),
+ FRAC_CONST(0.043484951661852),
+ FRAC_CONST(0.044153864320760),
+ FRAC_CONST(0.044829359199509),
+ FRAC_CONST(0.045511462498913),
+ FRAC_CONST(0.046200200188234),
+ FRAC_CONST(0.046895598002228),
+ FRAC_CONST(0.047597681438201),
+ FRAC_CONST(0.048306475753074),
+ FRAC_CONST(0.049022005960455),
+ FRAC_CONST(0.049744296827725),
+ FRAC_CONST(0.050473372873129),
+ FRAC_CONST(0.051209258362879),
+ FRAC_CONST(0.051951977308273),
+ FRAC_CONST(0.052701553462813),
+ FRAC_CONST(0.053458010319350),
+ FRAC_CONST(0.054221371107223),
+ FRAC_CONST(0.054991658789428),
+ FRAC_CONST(0.055768896059787),
+ FRAC_CONST(0.056553105340134),
+ FRAC_CONST(0.057344308777513),
+ FRAC_CONST(0.058142528241393),
+ FRAC_CONST(0.058947785320893),
+ FRAC_CONST(0.059760101322019),
+ FRAC_CONST(0.060579497264926),
+ FRAC_CONST(0.061405993881180),
+ FRAC_CONST(0.062239611611049),
+ FRAC_CONST(0.063080370600799),
+ FRAC_CONST(0.063928290700012),
+ FRAC_CONST(0.064783391458919),
+ FRAC_CONST(0.065645692125747),
+ FRAC_CONST(0.066515211644086),
+ FRAC_CONST(0.067391968650269),
+ FRAC_CONST(0.068275981470777),
+ FRAC_CONST(0.069167268119652),
+ FRAC_CONST(0.070065846295935),
+ FRAC_CONST(0.070971733381121),
+ FRAC_CONST(0.071884946436630),
+ FRAC_CONST(0.072805502201299),
+ FRAC_CONST(0.073733417088896),
+ FRAC_CONST(0.074668707185649),
+ FRAC_CONST(0.075611388247794),
+ FRAC_CONST(0.076561475699152),
+ FRAC_CONST(0.077518984628715),
+ FRAC_CONST(0.078483929788261),
+ FRAC_CONST(0.079456325589986),
+ FRAC_CONST(0.080436186104162),
+ FRAC_CONST(0.081423525056808),
+ FRAC_CONST(0.082418355827392),
+ FRAC_CONST(0.083420691446553),
+ FRAC_CONST(0.084430544593841),
+ FRAC_CONST(0.085447927595483),
+ FRAC_CONST(0.086472852422178),
+ FRAC_CONST(0.087505330686900),
+ FRAC_CONST(0.088545373642744),
+ FRAC_CONST(0.089592992180780),
+ FRAC_CONST(0.090648196827937),
+ FRAC_CONST(0.091710997744919),
+ FRAC_CONST(0.092781404724131),
+ FRAC_CONST(0.093859427187640),
+ FRAC_CONST(0.094945074185163),
+ FRAC_CONST(0.096038354392069),
+ FRAC_CONST(0.097139276107423),
+ FRAC_CONST(0.098247847252041),
+ FRAC_CONST(0.099364075366580),
+ FRAC_CONST(0.10048796760965),
+ FRAC_CONST(0.10161953075597),
+ FRAC_CONST(0.10275877119451),
+ FRAC_CONST(0.10390569492671),
+ FRAC_CONST(0.10506030756469),
+ FRAC_CONST(0.10622261432949),
+ FRAC_CONST(0.10739262004941),
+ FRAC_CONST(0.10857032915821),
+ FRAC_CONST(0.10975574569357),
+ FRAC_CONST(0.11094887329534),
+ FRAC_CONST(0.11214971520402),
+ FRAC_CONST(0.11335827425914),
+ FRAC_CONST(0.11457455289772),
+ FRAC_CONST(0.11579855315274),
+ FRAC_CONST(0.11703027665170),
+ FRAC_CONST(0.11826972461510),
+ FRAC_CONST(0.11951689785504),
+ FRAC_CONST(0.12077179677383),
+ FRAC_CONST(0.12203442136263),
+ FRAC_CONST(0.12330477120008),
+ FRAC_CONST(0.12458284545102),
+ FRAC_CONST(0.12586864286523),
+ FRAC_CONST(0.12716216177615),
+ FRAC_CONST(0.12846340009971),
+ FRAC_CONST(0.12977235533312),
+ FRAC_CONST(0.13108902455375),
+ FRAC_CONST(0.13241340441801),
+ FRAC_CONST(0.13374549116025),
+ FRAC_CONST(0.13508528059173),
+ FRAC_CONST(0.13643276809961),
+ FRAC_CONST(0.13778794864595),
+ FRAC_CONST(0.13915081676677),
+ FRAC_CONST(0.14052136657114),
+ FRAC_CONST(0.14189959174027),
+ FRAC_CONST(0.14328548552671),
+ FRAC_CONST(0.14467904075349),
+ FRAC_CONST(0.14608024981336),
+ FRAC_CONST(0.14748910466804),
+ FRAC_CONST(0.14890559684750),
+ FRAC_CONST(0.15032971744929),
+ FRAC_CONST(0.15176145713790),
+ FRAC_CONST(0.15320080614414),
+ FRAC_CONST(0.15464775426459),
+ FRAC_CONST(0.15610229086100),
+ FRAC_CONST(0.15756440485987),
+ FRAC_CONST(0.15903408475193),
+ FRAC_CONST(0.16051131859170),
+ FRAC_CONST(0.16199609399712),
+ FRAC_CONST(0.16348839814917),
+ FRAC_CONST(0.16498821779156),
+ FRAC_CONST(0.16649553923042),
+ FRAC_CONST(0.16801034833404),
+ FRAC_CONST(0.16953263053270),
+ FRAC_CONST(0.17106237081842),
+ FRAC_CONST(0.17259955374484),
+ FRAC_CONST(0.17414416342714),
+ FRAC_CONST(0.17569618354193),
+ FRAC_CONST(0.17725559732720),
+ FRAC_CONST(0.17882238758238),
+ FRAC_CONST(0.18039653666830),
+ FRAC_CONST(0.18197802650733),
+ FRAC_CONST(0.18356683858343),
+ FRAC_CONST(0.18516295394233),
+ FRAC_CONST(0.18676635319174),
+ FRAC_CONST(0.18837701650148),
+ FRAC_CONST(0.18999492360384),
+ FRAC_CONST(0.19162005379380),
+ FRAC_CONST(0.19325238592940),
+ FRAC_CONST(0.19489189843209),
+ FRAC_CONST(0.19653856928714),
+ FRAC_CONST(0.19819237604409),
+ FRAC_CONST(0.19985329581721),
+ FRAC_CONST(0.20152130528605),
+ FRAC_CONST(0.20319638069594),
+ FRAC_CONST(0.20487849785865),
+ FRAC_CONST(0.20656763215298),
+ FRAC_CONST(0.20826375852540),
+ FRAC_CONST(0.20996685149083),
+ FRAC_CONST(0.21167688513330),
+ FRAC_CONST(0.21339383310678),
+ FRAC_CONST(0.21511766863598),
+ FRAC_CONST(0.21684836451719),
+ FRAC_CONST(0.21858589311922),
+ FRAC_CONST(0.22033022638425),
+ FRAC_CONST(0.22208133582887),
+ FRAC_CONST(0.22383919254503),
+ FRAC_CONST(0.22560376720111),
+ FRAC_CONST(0.22737503004300),
+ FRAC_CONST(0.22915295089517),
+ FRAC_CONST(0.23093749916189),
+ FRAC_CONST(0.23272864382838),
+ FRAC_CONST(0.23452635346201),
+ FRAC_CONST(0.23633059621364),
+ FRAC_CONST(0.23814133981883),
+ FRAC_CONST(0.23995855159925),
+ FRAC_CONST(0.24178219846403),
+ FRAC_CONST(0.24361224691114),
+ FRAC_CONST(0.24544866302890),
+ FRAC_CONST(0.24729141249740),
+ FRAC_CONST(0.24914046059007),
+ FRAC_CONST(0.25099577217522),
+ FRAC_CONST(0.25285731171763),
+ FRAC_CONST(0.25472504328019),
+ FRAC_CONST(0.25659893052556),
+ FRAC_CONST(0.25847893671788),
+ FRAC_CONST(0.26036502472451),
+ FRAC_CONST(0.26225715701781),
+ FRAC_CONST(0.26415529567692),
+ FRAC_CONST(0.26605940238966),
+ FRAC_CONST(0.26796943845439),
+ FRAC_CONST(0.26988536478190),
+ FRAC_CONST(0.27180714189742),
+ FRAC_CONST(0.27373472994256),
+ FRAC_CONST(0.27566808867736),
+ FRAC_CONST(0.27760717748238),
+ FRAC_CONST(0.27955195536071),
+ FRAC_CONST(0.28150238094021),
+ FRAC_CONST(0.28345841247557),
+ FRAC_CONST(0.28542000785059),
+ FRAC_CONST(0.28738712458038),
+ FRAC_CONST(0.28935971981364),
+ FRAC_CONST(0.29133775033492),
+ FRAC_CONST(0.29332117256704),
+ FRAC_CONST(0.29530994257338),
+ FRAC_CONST(0.29730401606034),
+ FRAC_CONST(0.29930334837974),
+ FRAC_CONST(0.30130789453132),
+ FRAC_CONST(0.30331760916521),
+ FRAC_CONST(0.30533244658452),
+ FRAC_CONST(0.30735236074785),
+ FRAC_CONST(0.30937730527195),
+ FRAC_CONST(0.31140723343430),
+ FRAC_CONST(0.31344209817583),
+ FRAC_CONST(0.31548185210356),
+ FRAC_CONST(0.31752644749341),
+ FRAC_CONST(0.31957583629288),
+ FRAC_CONST(0.32162997012390),
+ FRAC_CONST(0.32368880028565),
+ FRAC_CONST(0.32575227775738),
+ FRAC_CONST(0.32782035320134),
+ FRAC_CONST(0.32989297696566),
+ FRAC_CONST(0.33197009908736),
+ FRAC_CONST(0.33405166929523),
+ FRAC_CONST(0.33613763701295),
+ FRAC_CONST(0.33822795136203),
+ FRAC_CONST(0.34032256116495),
+ FRAC_CONST(0.34242141494820),
+ FRAC_CONST(0.34452446094547),
+ FRAC_CONST(0.34663164710072),
+ FRAC_CONST(0.34874292107143),
+ FRAC_CONST(0.35085823023181),
+ FRAC_CONST(0.35297752167598),
+ FRAC_CONST(0.35510074222129),
+ FRAC_CONST(0.35722783841160),
+ FRAC_CONST(0.35935875652060),
+ FRAC_CONST(0.36149344255514),
+ FRAC_CONST(0.36363184225864),
+ FRAC_CONST(0.36577390111444),
+ FRAC_CONST(0.36791956434930),
+ FRAC_CONST(0.37006877693676),
+ FRAC_CONST(0.37222148360070),
+ FRAC_CONST(0.37437762881878),
+ FRAC_CONST(0.37653715682603),
+ FRAC_CONST(0.37870001161834),
+ FRAC_CONST(0.38086613695607),
+ FRAC_CONST(0.38303547636766),
+ FRAC_CONST(0.38520797315322),
+ FRAC_CONST(0.38738357038821),
+ FRAC_CONST(0.38956221092708),
+ FRAC_CONST(0.39174383740701),
+ FRAC_CONST(0.39392839225157),
+ FRAC_CONST(0.39611581767449),
+ FRAC_CONST(0.39830605568342),
+ FRAC_CONST(0.40049904808370),
+ FRAC_CONST(0.40269473648218),
+ FRAC_CONST(0.40489306229101),
+ FRAC_CONST(0.40709396673153),
+ FRAC_CONST(0.40929739083810),
+ FRAC_CONST(0.41150327546197),
+ FRAC_CONST(0.41371156127524),
+ FRAC_CONST(0.41592218877472),
+ FRAC_CONST(0.41813509828594),
+ FRAC_CONST(0.42035022996702),
+ FRAC_CONST(0.42256752381274),
+ FRAC_CONST(0.42478691965848),
+ FRAC_CONST(0.42700835718423),
+ FRAC_CONST(0.42923177591866),
+ FRAC_CONST(0.43145711524314),
+ FRAC_CONST(0.43368431439580),
+ FRAC_CONST(0.43591331247564),
+ FRAC_CONST(0.43814404844658),
+ FRAC_CONST(0.44037646114161),
+ FRAC_CONST(0.44261048926688),
+ FRAC_CONST(0.44484607140589),
+ FRAC_CONST(0.44708314602359),
+ FRAC_CONST(0.44932165147057),
+ FRAC_CONST(0.45156152598727),
+ FRAC_CONST(0.45380270770813),
+ FRAC_CONST(0.45604513466581),
+ FRAC_CONST(0.45828874479543),
+ FRAC_CONST(0.46053347593880),
+ FRAC_CONST(0.46277926584861),
+ FRAC_CONST(0.46502605219277),
+ FRAC_CONST(0.46727377255861),
+ FRAC_CONST(0.46952236445718),
+ FRAC_CONST(0.47177176532752),
+ FRAC_CONST(0.47402191254100),
+ FRAC_CONST(0.47627274340557),
+ FRAC_CONST(0.47852419517009),
+ FRAC_CONST(0.48077620502869),
+ FRAC_CONST(0.48302871012505),
+ FRAC_CONST(0.48528164755674),
+ FRAC_CONST(0.48753495437962),
+ FRAC_CONST(0.48978856761212),
+ FRAC_CONST(0.49204242423966),
+ FRAC_CONST(0.49429646121898),
+ FRAC_CONST(0.49655061548250),
+ FRAC_CONST(0.49880482394273),
+ FRAC_CONST(0.50105902349665),
+ FRAC_CONST(0.50331315103004),
+ FRAC_CONST(0.50556714342194),
+ FRAC_CONST(0.50782093754901),
+ FRAC_CONST(0.51007447028990),
+ FRAC_CONST(0.51232767852971),
+ FRAC_CONST(0.51458049916433),
+ FRAC_CONST(0.51683286910489),
+ FRAC_CONST(0.51908472528213),
+ FRAC_CONST(0.52133600465083),
+ FRAC_CONST(0.52358664419420),
+ FRAC_CONST(0.52583658092832),
+ FRAC_CONST(0.52808575190648),
+ FRAC_CONST(0.53033409422367),
+ FRAC_CONST(0.53258154502092),
+ FRAC_CONST(0.53482804148974),
+ FRAC_CONST(0.53707352087652),
+ FRAC_CONST(0.53931792048690),
+ FRAC_CONST(0.54156117769021),
+ FRAC_CONST(0.54380322992385),
+ FRAC_CONST(0.54604401469766),
+ FRAC_CONST(0.54828346959835),
+ FRAC_CONST(0.55052153229384),
+ FRAC_CONST(0.55275814053768),
+ FRAC_CONST(0.55499323217338),
+ FRAC_CONST(0.55722674513883),
+ FRAC_CONST(0.55945861747062),
+ FRAC_CONST(0.56168878730842),
+ FRAC_CONST(0.56391719289930),
+ FRAC_CONST(0.56614377260214),
+ FRAC_CONST(0.56836846489188),
+ FRAC_CONST(0.57059120836390),
+ FRAC_CONST(0.57281194173835),
+ FRAC_CONST(0.57503060386439),
+ FRAC_CONST(0.57724713372458),
+ FRAC_CONST(0.57946147043912),
+ FRAC_CONST(0.58167355327012),
+ FRAC_CONST(0.58388332162591),
+ FRAC_CONST(0.58609071506528),
+ FRAC_CONST(0.58829567330173),
+ FRAC_CONST(0.59049813620770),
+ FRAC_CONST(0.59269804381879),
+ FRAC_CONST(0.59489533633802),
+ FRAC_CONST(0.59708995413996),
+ FRAC_CONST(0.59928183777495),
+ FRAC_CONST(0.60147092797329),
+ FRAC_CONST(0.60365716564937),
+ FRAC_CONST(0.60584049190582),
+ FRAC_CONST(0.60802084803764),
+ FRAC_CONST(0.61019817553632),
+ FRAC_CONST(0.61237241609393),
+ FRAC_CONST(0.61454351160718),
+ FRAC_CONST(0.61671140418155),
+ FRAC_CONST(0.61887603613527),
+ FRAC_CONST(0.62103735000336),
+ FRAC_CONST(0.62319528854167),
+ FRAC_CONST(0.62534979473088),
+ FRAC_CONST(0.62750081178042),
+ FRAC_CONST(0.62964828313250),
+ FRAC_CONST(0.63179215246597),
+ FRAC_CONST(0.63393236370030),
+ FRAC_CONST(0.63606886099946),
+ FRAC_CONST(0.63820158877577),
+ FRAC_CONST(0.64033049169379),
+ FRAC_CONST(0.64245551467413),
+ FRAC_CONST(0.64457660289729),
+ FRAC_CONST(0.64669370180740),
+ FRAC_CONST(0.64880675711607),
+ FRAC_CONST(0.65091571480603),
+ FRAC_CONST(0.65302052113494),
+ FRAC_CONST(0.65512112263906),
+ FRAC_CONST(0.65721746613689),
+ FRAC_CONST(0.65930949873289),
+ FRAC_CONST(0.66139716782102),
+ FRAC_CONST(0.66348042108842),
+ FRAC_CONST(0.66555920651892),
+ FRAC_CONST(0.66763347239664),
+ FRAC_CONST(0.66970316730947),
+ FRAC_CONST(0.67176824015260),
+ FRAC_CONST(0.67382864013196),
+ FRAC_CONST(0.67588431676768),
+ FRAC_CONST(0.67793521989751),
+ FRAC_CONST(0.67998129968017),
+ FRAC_CONST(0.68202250659876),
+ FRAC_CONST(0.68405879146403),
+ FRAC_CONST(0.68609010541774),
+ FRAC_CONST(0.68811639993588),
+ FRAC_CONST(0.69013762683195),
+ FRAC_CONST(0.69215373826012),
+ FRAC_CONST(0.69416468671849),
+ FRAC_CONST(0.69617042505214),
+ FRAC_CONST(0.69817090645634),
+ FRAC_CONST(0.70016608447958),
+ FRAC_CONST(0.70215591302664),
+ FRAC_CONST(0.70414034636163),
+ FRAC_CONST(0.70611933911096),
+ FRAC_CONST(0.70809284626630),
+ FRAC_CONST(0.71006082318751),
+ FRAC_CONST(0.71202322560554),
+ FRAC_CONST(0.71398000962530),
+ FRAC_CONST(0.71593113172842),
+ FRAC_CONST(0.71787654877613),
+ FRAC_CONST(0.71981621801195),
+ FRAC_CONST(0.72175009706445),
+ FRAC_CONST(0.72367814394990),
+ FRAC_CONST(0.72560031707496),
+ FRAC_CONST(0.72751657523927),
+ FRAC_CONST(0.72942687763803),
+ FRAC_CONST(0.73133118386457),
+ FRAC_CONST(0.73322945391280),
+ FRAC_CONST(0.73512164817975),
+ FRAC_CONST(0.73700772746796),
+ FRAC_CONST(0.73888765298787),
+ FRAC_CONST(0.74076138636020),
+ FRAC_CONST(0.74262888961827),
+ FRAC_CONST(0.74449012521027),
+ FRAC_CONST(0.74634505600152),
+ FRAC_CONST(0.74819364527663),
+ FRAC_CONST(0.75003585674175),
+ FRAC_CONST(0.75187165452661),
+ FRAC_CONST(0.75370100318668),
+ FRAC_CONST(0.75552386770515),
+ FRAC_CONST(0.75734021349500),
+ FRAC_CONST(0.75915000640095),
+ FRAC_CONST(0.76095321270137),
+ FRAC_CONST(0.76274979911019),
+ FRAC_CONST(0.76453973277875),
+ FRAC_CONST(0.76632298129757),
+ FRAC_CONST(0.76809951269819),
+ FRAC_CONST(0.76986929545481),
+ FRAC_CONST(0.77163229848604),
+ FRAC_CONST(0.77338849115651),
+ FRAC_CONST(0.77513784327849),
+ FRAC_CONST(0.77688032511340),
+ FRAC_CONST(0.77861590737340),
+ FRAC_CONST(0.78034456122283),
+ FRAC_CONST(0.78206625827961),
+ FRAC_CONST(0.78378097061667),
+ FRAC_CONST(0.78548867076330),
+ FRAC_CONST(0.78718933170643),
+ FRAC_CONST(0.78888292689189),
+ FRAC_CONST(0.79056943022564),
+ FRAC_CONST(0.79224881607494),
+ FRAC_CONST(0.79392105926949),
+ FRAC_CONST(0.79558613510249),
+ FRAC_CONST(0.79724401933170),
+ FRAC_CONST(0.79889468818046),
+ FRAC_CONST(0.80053811833858),
+ FRAC_CONST(0.80217428696334),
+ FRAC_CONST(0.80380317168028),
+ FRAC_CONST(0.80542475058405),
+ FRAC_CONST(0.80703900223920),
+ FRAC_CONST(0.80864590568089),
+ FRAC_CONST(0.81024544041560),
+ FRAC_CONST(0.81183758642175),
+ FRAC_CONST(0.81342232415032),
+ FRAC_CONST(0.81499963452540),
+ FRAC_CONST(0.81656949894467),
+ FRAC_CONST(0.81813189927991),
+ FRAC_CONST(0.81968681787738),
+ FRAC_CONST(0.82123423755821),
+ FRAC_CONST(0.82277414161874),
+ FRAC_CONST(0.82430651383076),
+ FRAC_CONST(0.82583133844180),
+ FRAC_CONST(0.82734860017528),
+ FRAC_CONST(0.82885828423070),
+ FRAC_CONST(0.83036037628369),
+ FRAC_CONST(0.83185486248609),
+ FRAC_CONST(0.83334172946597),
+ FRAC_CONST(0.83482096432759),
+ FRAC_CONST(0.83629255465130),
+ FRAC_CONST(0.83775648849344),
+ FRAC_CONST(0.83921275438615),
+ FRAC_CONST(0.84066134133716),
+ FRAC_CONST(0.84210223882952),
+ FRAC_CONST(0.84353543682130),
+ FRAC_CONST(0.84496092574524),
+ FRAC_CONST(0.84637869650833),
+ FRAC_CONST(0.84778874049138),
+ FRAC_CONST(0.84919104954855),
+ FRAC_CONST(0.85058561600677),
+ FRAC_CONST(0.85197243266520),
+ FRAC_CONST(0.85335149279457),
+ FRAC_CONST(0.85472279013653),
+ FRAC_CONST(0.85608631890295),
+ FRAC_CONST(0.85744207377513),
+ FRAC_CONST(0.85879004990298),
+ FRAC_CONST(0.86013024290422),
+ FRAC_CONST(0.86146264886346),
+ FRAC_CONST(0.86278726433124),
+ FRAC_CONST(0.86410408632306),
+ FRAC_CONST(0.86541311231838),
+ FRAC_CONST(0.86671434025950),
+ FRAC_CONST(0.86800776855046),
+ FRAC_CONST(0.86929339605590),
+ FRAC_CONST(0.87057122209981),
+ FRAC_CONST(0.87184124646433),
+ FRAC_CONST(0.87310346938840),
+ FRAC_CONST(0.87435789156650),
+ FRAC_CONST(0.87560451414719),
+ FRAC_CONST(0.87684333873173),
+ FRAC_CONST(0.87807436737261),
+ FRAC_CONST(0.87929760257204),
+ FRAC_CONST(0.88051304728038),
+ FRAC_CONST(0.88172070489456),
+ FRAC_CONST(0.88292057925645),
+ FRAC_CONST(0.88411267465117),
+ FRAC_CONST(0.88529699580537),
+ FRAC_CONST(0.88647354788545),
+ FRAC_CONST(0.88764233649580),
+ FRAC_CONST(0.88880336767692),
+ FRAC_CONST(0.88995664790351),
+ FRAC_CONST(0.89110218408260),
+ FRAC_CONST(0.89223998355154),
+ FRAC_CONST(0.89337005407600),
+ FRAC_CONST(0.89449240384793),
+ FRAC_CONST(0.89560704148345),
+ FRAC_CONST(0.89671397602074),
+ FRAC_CONST(0.89781321691786),
+ FRAC_CONST(0.89890477405053),
+ FRAC_CONST(0.89998865770993),
+ FRAC_CONST(0.90106487860034),
+ FRAC_CONST(0.90213344783689),
+ FRAC_CONST(0.90319437694315),
+ FRAC_CONST(0.90424767784873),
+ FRAC_CONST(0.90529336288690),
+ FRAC_CONST(0.90633144479201),
+ FRAC_CONST(0.90736193669708),
+ FRAC_CONST(0.90838485213119),
+ FRAC_CONST(0.90940020501694),
+ FRAC_CONST(0.91040800966776),
+ FRAC_CONST(0.91140828078533),
+ FRAC_CONST(0.91240103345685),
+ FRAC_CONST(0.91338628315231),
+ FRAC_CONST(0.91436404572173),
+ FRAC_CONST(0.91533433739238),
+ FRAC_CONST(0.91629717476594),
+ FRAC_CONST(0.91725257481564),
+ FRAC_CONST(0.91820055488334),
+ FRAC_CONST(0.91914113267664),
+ FRAC_CONST(0.92007432626589),
+ FRAC_CONST(0.92100015408120),
+ FRAC_CONST(0.92191863490944),
+ FRAC_CONST(0.92282978789113),
+ FRAC_CONST(0.92373363251740),
+ FRAC_CONST(0.92463018862687),
+ FRAC_CONST(0.92551947640245),
+ FRAC_CONST(0.92640151636824),
+ FRAC_CONST(0.92727632938624),
+ FRAC_CONST(0.92814393665320),
+ FRAC_CONST(0.92900435969727),
+ FRAC_CONST(0.92985762037477),
+ FRAC_CONST(0.93070374086684),
+ FRAC_CONST(0.93154274367610),
+ FRAC_CONST(0.93237465162328),
+ FRAC_CONST(0.93319948784382),
+ FRAC_CONST(0.93401727578443),
+ FRAC_CONST(0.93482803919967),
+ FRAC_CONST(0.93563180214841),
+ FRAC_CONST(0.93642858899043),
+ FRAC_CONST(0.93721842438279),
+ FRAC_CONST(0.93800133327637),
+ FRAC_CONST(0.93877734091223),
+ FRAC_CONST(0.93954647281807),
+ FRAC_CONST(0.94030875480458),
+ FRAC_CONST(0.94106421296182),
+ FRAC_CONST(0.94181287365556),
+ FRAC_CONST(0.94255476352362),
+ FRAC_CONST(0.94328990947213),
+ FRAC_CONST(0.94401833867184),
+ FRAC_CONST(0.94474007855439),
+ FRAC_CONST(0.94545515680855),
+ FRAC_CONST(0.94616360137644),
+ FRAC_CONST(0.94686544044975),
+ FRAC_CONST(0.94756070246592),
+ FRAC_CONST(0.94824941610434),
+ FRAC_CONST(0.94893161028248),
+ FRAC_CONST(0.94960731415209),
+ FRAC_CONST(0.95027655709525),
+ FRAC_CONST(0.95093936872056),
+ FRAC_CONST(0.95159577885924),
+ FRAC_CONST(0.95224581756115),
+ FRAC_CONST(0.95288951509097),
+ FRAC_CONST(0.95352690192417),
+ FRAC_CONST(0.95415800874314),
+ FRAC_CONST(0.95478286643320),
+ FRAC_CONST(0.95540150607863),
+ FRAC_CONST(0.95601395895871),
+ FRAC_CONST(0.95662025654373),
+ FRAC_CONST(0.95722043049100),
+ FRAC_CONST(0.95781451264084),
+ FRAC_CONST(0.95840253501260),
+ FRAC_CONST(0.95898452980058),
+ FRAC_CONST(0.95956052937008),
+ FRAC_CONST(0.96013056625336),
+ FRAC_CONST(0.96069467314557),
+ FRAC_CONST(0.96125288290073),
+ FRAC_CONST(0.96180522852773),
+ FRAC_CONST(0.96235174318622),
+ FRAC_CONST(0.96289246018262),
+ FRAC_CONST(0.96342741296604),
+ FRAC_CONST(0.96395663512424),
+ FRAC_CONST(0.96448016037959),
+ FRAC_CONST(0.96499802258499),
+ FRAC_CONST(0.96551025571985),
+ FRAC_CONST(0.96601689388602),
+ FRAC_CONST(0.96651797130376),
+ FRAC_CONST(0.96701352230768),
+ FRAC_CONST(0.96750358134269),
+ FRAC_CONST(0.96798818295998),
+ FRAC_CONST(0.96846736181297),
+ FRAC_CONST(0.96894115265327),
+ FRAC_CONST(0.96940959032667),
+ FRAC_CONST(0.96987270976912),
+ FRAC_CONST(0.97033054600270),
+ FRAC_CONST(0.97078313413161),
+ FRAC_CONST(0.97123050933818),
+ FRAC_CONST(0.97167270687887),
+ FRAC_CONST(0.97210976208030),
+ FRAC_CONST(0.97254171033525),
+ FRAC_CONST(0.97296858709871),
+ FRAC_CONST(0.97339042788392),
+ FRAC_CONST(0.97380726825843),
+ FRAC_CONST(0.97421914384017),
+ FRAC_CONST(0.97462609029350),
+ FRAC_CONST(0.97502814332534),
+ FRAC_CONST(0.97542533868127),
+ FRAC_CONST(0.97581771214160),
+ FRAC_CONST(0.97620529951759),
+ FRAC_CONST(0.97658813664749),
+ FRAC_CONST(0.97696625939282),
+ FRAC_CONST(0.97733970363445),
+ FRAC_CONST(0.97770850526884),
+ FRAC_CONST(0.97807270020427),
+ FRAC_CONST(0.97843232435704),
+ FRAC_CONST(0.97878741364771),
+ FRAC_CONST(0.97913800399743),
+ FRAC_CONST(0.97948413132414),
+ FRAC_CONST(0.97982583153895),
+ FRAC_CONST(0.98016314054243),
+ FRAC_CONST(0.98049609422096),
+ FRAC_CONST(0.98082472844313),
+ FRAC_CONST(0.98114907905608),
+ FRAC_CONST(0.98146918188197),
+ FRAC_CONST(0.98178507271438),
+ FRAC_CONST(0.98209678731477),
+ FRAC_CONST(0.98240436140902),
+ FRAC_CONST(0.98270783068385),
+ FRAC_CONST(0.98300723078342),
+ FRAC_CONST(0.98330259730589),
+ FRAC_CONST(0.98359396579995),
+ FRAC_CONST(0.98388137176152),
+ FRAC_CONST(0.98416485063031),
+ FRAC_CONST(0.98444443778651),
+ FRAC_CONST(0.98472016854752),
+ FRAC_CONST(0.98499207816463),
+ FRAC_CONST(0.98526020181980),
+ FRAC_CONST(0.98552457462240),
+ FRAC_CONST(0.98578523160609),
+ FRAC_CONST(0.98604220772560),
+ FRAC_CONST(0.98629553785362),
+ FRAC_CONST(0.98654525677772),
+ FRAC_CONST(0.98679139919726),
+ FRAC_CONST(0.98703399972035),
+ FRAC_CONST(0.98727309286089),
+ FRAC_CONST(0.98750871303556),
+ FRAC_CONST(0.98774089456089),
+ FRAC_CONST(0.98796967165036),
+ FRAC_CONST(0.98819507841154),
+ FRAC_CONST(0.98841714884323),
+ FRAC_CONST(0.98863591683269),
+ FRAC_CONST(0.98885141615285),
+ FRAC_CONST(0.98906368045957),
+ FRAC_CONST(0.98927274328896),
+ FRAC_CONST(0.98947863805473),
+ FRAC_CONST(0.98968139804554),
+ FRAC_CONST(0.98988105642241),
+ FRAC_CONST(0.99007764621618),
+ FRAC_CONST(0.99027120032501),
+ FRAC_CONST(0.99046175151186),
+ FRAC_CONST(0.99064933240208),
+ FRAC_CONST(0.99083397548099),
+ FRAC_CONST(0.99101571309153),
+ FRAC_CONST(0.99119457743191),
+ FRAC_CONST(0.99137060055337),
+ FRAC_CONST(0.99154381435784),
+ FRAC_CONST(0.99171425059582),
+ FRAC_CONST(0.99188194086414),
+ FRAC_CONST(0.99204691660388),
+ FRAC_CONST(0.99220920909823),
+ FRAC_CONST(0.99236884947045),
+ FRAC_CONST(0.99252586868186),
+ FRAC_CONST(0.99268029752989),
+ FRAC_CONST(0.99283216664606),
+ FRAC_CONST(0.99298150649419),
+ FRAC_CONST(0.99312834736847),
+ FRAC_CONST(0.99327271939167),
+ FRAC_CONST(0.99341465251338),
+ FRAC_CONST(0.99355417650825),
+ FRAC_CONST(0.99369132097430),
+ FRAC_CONST(0.99382611533130),
+ FRAC_CONST(0.99395858881910),
+ FRAC_CONST(0.99408877049612),
+ FRAC_CONST(0.99421668923778),
+ FRAC_CONST(0.99434237373503),
+ FRAC_CONST(0.99446585249289),
+ FRAC_CONST(0.99458715382906),
+ FRAC_CONST(0.99470630587254),
+ FRAC_CONST(0.99482333656229),
+ FRAC_CONST(0.99493827364600),
+ FRAC_CONST(0.99505114467878),
+ FRAC_CONST(0.99516197702200),
+ FRAC_CONST(0.99527079784214),
+ FRAC_CONST(0.99537763410962),
+ FRAC_CONST(0.99548251259777),
+ FRAC_CONST(0.99558545988178),
+ FRAC_CONST(0.99568650233767),
+ FRAC_CONST(0.99578566614138),
+ FRAC_CONST(0.99588297726783),
+ FRAC_CONST(0.99597846149005),
+ FRAC_CONST(0.99607214437834),
+ FRAC_CONST(0.99616405129947),
+ FRAC_CONST(0.99625420741595),
+ FRAC_CONST(0.99634263768527),
+ FRAC_CONST(0.99642936685928),
+ FRAC_CONST(0.99651441948352),
+ FRAC_CONST(0.99659781989663),
+ FRAC_CONST(0.99667959222978),
+ FRAC_CONST(0.99675976040620),
+ FRAC_CONST(0.99683834814063),
+ FRAC_CONST(0.99691537893895),
+ FRAC_CONST(0.99699087609774),
+ FRAC_CONST(0.99706486270391),
+ FRAC_CONST(0.99713736163442),
+ FRAC_CONST(0.99720839555593),
+ FRAC_CONST(0.99727798692461),
+ FRAC_CONST(0.99734615798589),
+ FRAC_CONST(0.99741293077431),
+ FRAC_CONST(0.99747832711337),
+ FRAC_CONST(0.99754236861541),
+ FRAC_CONST(0.99760507668158),
+ FRAC_CONST(0.99766647250181),
+ FRAC_CONST(0.99772657705478),
+ FRAC_CONST(0.99778541110799),
+ FRAC_CONST(0.99784299521785),
+ FRAC_CONST(0.99789934972976),
+ FRAC_CONST(0.99795449477828),
+ FRAC_CONST(0.99800845028730),
+ FRAC_CONST(0.99806123597027),
+ FRAC_CONST(0.99811287133042),
+ FRAC_CONST(0.99816337566108),
+ FRAC_CONST(0.99821276804596),
+ FRAC_CONST(0.99826106735952),
+ FRAC_CONST(0.99830829226732),
+ FRAC_CONST(0.99835446122649),
+ FRAC_CONST(0.99839959248609),
+ FRAC_CONST(0.99844370408765),
+ FRAC_CONST(0.99848681386566),
+ FRAC_CONST(0.99852893944805),
+ FRAC_CONST(0.99857009825685),
+ FRAC_CONST(0.99861030750869),
+ FRAC_CONST(0.99864958421549),
+ FRAC_CONST(0.99868794518504),
+ FRAC_CONST(0.99872540702178),
+ FRAC_CONST(0.99876198612738),
+ FRAC_CONST(0.99879769870160),
+ FRAC_CONST(0.99883256074295),
+ FRAC_CONST(0.99886658804953),
+ FRAC_CONST(0.99889979621983),
+ FRAC_CONST(0.99893220065356),
+ FRAC_CONST(0.99896381655254),
+ FRAC_CONST(0.99899465892154),
+ FRAC_CONST(0.99902474256924),
+ FRAC_CONST(0.99905408210916),
+ FRAC_CONST(0.99908269196056),
+ FRAC_CONST(0.99911058634952),
+ FRAC_CONST(0.99913777930986),
+ FRAC_CONST(0.99916428468421),
+ FRAC_CONST(0.99919011612505),
+ FRAC_CONST(0.99921528709576),
+ FRAC_CONST(0.99923981087174),
+ FRAC_CONST(0.99926370054150),
+ FRAC_CONST(0.99928696900779),
+ FRAC_CONST(0.99930962898876),
+ FRAC_CONST(0.99933169301910),
+ FRAC_CONST(0.99935317345126),
+ FRAC_CONST(0.99937408245662),
+ FRAC_CONST(0.99939443202674),
+ FRAC_CONST(0.99941423397457),
+ FRAC_CONST(0.99943349993572),
+ FRAC_CONST(0.99945224136972),
+ FRAC_CONST(0.99947046956130),
+ FRAC_CONST(0.99948819562171),
+ FRAC_CONST(0.99950543049000),
+ FRAC_CONST(0.99952218493439),
+ FRAC_CONST(0.99953846955355),
+ FRAC_CONST(0.99955429477803),
+ FRAC_CONST(0.99956967087154),
+ FRAC_CONST(0.99958460793242),
+ FRAC_CONST(0.99959911589494),
+ FRAC_CONST(0.99961320453077),
+ FRAC_CONST(0.99962688345035),
+ FRAC_CONST(0.99964016210433),
+ FRAC_CONST(0.99965304978499),
+ FRAC_CONST(0.99966555562769),
+ FRAC_CONST(0.99967768861231),
+ FRAC_CONST(0.99968945756473),
+ FRAC_CONST(0.99970087115825),
+ FRAC_CONST(0.99971193791510),
+ FRAC_CONST(0.99972266620792),
+ FRAC_CONST(0.99973306426121),
+ FRAC_CONST(0.99974314015288),
+ FRAC_CONST(0.99975290181568),
+ FRAC_CONST(0.99976235703876),
+ FRAC_CONST(0.99977151346914),
+ FRAC_CONST(0.99978037861326),
+ FRAC_CONST(0.99978895983845),
+ FRAC_CONST(0.99979726437448),
+ FRAC_CONST(0.99980529931507),
+ FRAC_CONST(0.99981307161943),
+ FRAC_CONST(0.99982058811377),
+ FRAC_CONST(0.99982785549283),
+ FRAC_CONST(0.99983488032144),
+ FRAC_CONST(0.99984166903600),
+ FRAC_CONST(0.99984822794606),
+ FRAC_CONST(0.99985456323584),
+ FRAC_CONST(0.99986068096572),
+ FRAC_CONST(0.99986658707386),
+ FRAC_CONST(0.99987228737764),
+ FRAC_CONST(0.99987778757524),
+ FRAC_CONST(0.99988309324717),
+ FRAC_CONST(0.99988820985777),
+ FRAC_CONST(0.99989314275675),
+ FRAC_CONST(0.99989789718072),
+ FRAC_CONST(0.99990247825468),
+ FRAC_CONST(0.99990689099357),
+ FRAC_CONST(0.99991114030376),
+ FRAC_CONST(0.99991523098456),
+ FRAC_CONST(0.99991916772971),
+ FRAC_CONST(0.99992295512891),
+ FRAC_CONST(0.99992659766930),
+ FRAC_CONST(0.99993009973692),
+ FRAC_CONST(0.99993346561824),
+ FRAC_CONST(0.99993669950161),
+ FRAC_CONST(0.99993980547870),
+ FRAC_CONST(0.99994278754604),
+ FRAC_CONST(0.99994564960642),
+ FRAC_CONST(0.99994839547033),
+ FRAC_CONST(0.99995102885747),
+ FRAC_CONST(0.99995355339809),
+ FRAC_CONST(0.99995597263451),
+ FRAC_CONST(0.99995829002249),
+ FRAC_CONST(0.99996050893264),
+ FRAC_CONST(0.99996263265183),
+ FRAC_CONST(0.99996466438460),
+ FRAC_CONST(0.99996660725452),
+ FRAC_CONST(0.99996846430558),
+ FRAC_CONST(0.99997023850356),
+ FRAC_CONST(0.99997193273736),
+ FRAC_CONST(0.99997354982037),
+ FRAC_CONST(0.99997509249183),
+ FRAC_CONST(0.99997656341810),
+ FRAC_CONST(0.99997796519400),
+ FRAC_CONST(0.99997930034415),
+ FRAC_CONST(0.99998057132421),
+ FRAC_CONST(0.99998178052220),
+ FRAC_CONST(0.99998293025975),
+ FRAC_CONST(0.99998402279338),
+ FRAC_CONST(0.99998506031574),
+ FRAC_CONST(0.99998604495686),
+ FRAC_CONST(0.99998697878536),
+ FRAC_CONST(0.99998786380966),
+ FRAC_CONST(0.99998870197921),
+ FRAC_CONST(0.99998949518567),
+ FRAC_CONST(0.99999024526408),
+ FRAC_CONST(0.99999095399401),
+ FRAC_CONST(0.99999162310077),
+ FRAC_CONST(0.99999225425649),
+ FRAC_CONST(0.99999284908128),
+ FRAC_CONST(0.99999340914435),
+ FRAC_CONST(0.99999393596510),
+ FRAC_CONST(0.99999443101421),
+ FRAC_CONST(0.99999489571473),
+ FRAC_CONST(0.99999533144314),
+ FRAC_CONST(0.99999573953040),
+ FRAC_CONST(0.99999612126300),
+ FRAC_CONST(0.99999647788395),
+ FRAC_CONST(0.99999681059383),
+ FRAC_CONST(0.99999712055178),
+ FRAC_CONST(0.99999740887647),
+ FRAC_CONST(0.99999767664709),
+ FRAC_CONST(0.99999792490431),
+ FRAC_CONST(0.99999815465123),
+ FRAC_CONST(0.99999836685427),
+ FRAC_CONST(0.99999856244415),
+ FRAC_CONST(0.99999874231676),
+ FRAC_CONST(0.99999890733405),
+ FRAC_CONST(0.99999905832493),
+ FRAC_CONST(0.99999919608613),
+ FRAC_CONST(0.99999932138304),
+ FRAC_CONST(0.99999943495056),
+ FRAC_CONST(0.99999953749392),
+ FRAC_CONST(0.99999962968950),
+ FRAC_CONST(0.99999971218563),
+ FRAC_CONST(0.99999978560337),
+ FRAC_CONST(0.99999985053727),
+ FRAC_CONST(0.99999990755616),
+ FRAC_CONST(0.99999995720387)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ALIGN static const real_t kbd_long_960[] = {
+ FRAC_CONST(0.0003021562530949),
+ FRAC_CONST(0.0004452267024786),
+ FRAC_CONST(0.0005674947527496),
+ FRAC_CONST(0.0006812465553466),
+ FRAC_CONST(0.0007910496776387),
+ FRAC_CONST(0.0008991655033895),
+ FRAC_CONST(0.0010068978259384),
+ FRAC_CONST(0.0011150758515751),
+ FRAC_CONST(0.0012242653193642),
+ FRAC_CONST(0.0013348735658205),
+ FRAC_CONST(0.0014472068670273),
+ FRAC_CONST(0.0015615039850448),
+ FRAC_CONST(0.0016779568885263),
+ FRAC_CONST(0.0017967241232412),
+ FRAC_CONST(0.0019179397560955),
+ FRAC_CONST(0.0020417195415393),
+ FRAC_CONST(0.0021681652836642),
+ FRAC_CONST(0.0022973679910599),
+ FRAC_CONST(0.0024294102029937),
+ FRAC_CONST(0.0025643677339078),
+ FRAC_CONST(0.0027023110014772),
+ FRAC_CONST(0.0028433060512612),
+ FRAC_CONST(0.0029874153568025),
+ FRAC_CONST(0.0031346984511728),
+ FRAC_CONST(0.0032852124303662),
+ FRAC_CONST(0.0034390123581190),
+ FRAC_CONST(0.0035961515940931),
+ FRAC_CONST(0.0037566820618961),
+ FRAC_CONST(0.0039206544694386),
+ FRAC_CONST(0.0040881184912194),
+ FRAC_CONST(0.0042591229199617),
+ FRAC_CONST(0.0044337157933972),
+ FRAC_CONST(0.0046119445007641),
+ FRAC_CONST(0.0047938558726415),
+ FRAC_CONST(0.0049794962570131),
+ FRAC_CONST(0.0051689115838900),
+ FRAC_CONST(0.0053621474203763),
+ FRAC_CONST(0.0055592490177131),
+ FRAC_CONST(0.0057602613515573),
+ FRAC_CONST(0.0059652291565289),
+ FRAC_CONST(0.0061741969558843),
+ FRAC_CONST(0.0063872090870253),
+ FRAC_CONST(0.0066043097234387),
+ FRAC_CONST(0.0068255428935640),
+ FRAC_CONST(0.0070509524970088),
+ FRAC_CONST(0.0072805823184660),
+ FRAC_CONST(0.0075144760396340),
+ FRAC_CONST(0.0077526772493942),
+ FRAC_CONST(0.0079952294524673),
+ FRAC_CONST(0.0082421760767325),
+ FRAC_CONST(0.0084935604793733),
+ FRAC_CONST(0.0087494259519870),
+ FRAC_CONST(0.0090098157247792),
+ FRAC_CONST(0.0092747729699467),
+ FRAC_CONST(0.0095443408043399),
+ FRAC_CONST(0.0098185622914832),
+ FRAC_CONST(0.0100974804430226),
+ FRAC_CONST(0.0103811382196612),
+ FRAC_CONST(0.0106695785316351),
+ FRAC_CONST(0.0109628442387771),
+ FRAC_CONST(0.0112609781502091),
+ FRAC_CONST(0.0115640230236993),
+ FRAC_CONST(0.0118720215647169),
+ FRAC_CONST(0.0121850164252137),
+ FRAC_CONST(0.0125030502021561),
+ FRAC_CONST(0.0128261654358321),
+ FRAC_CONST(0.0131544046079532),
+ FRAC_CONST(0.0134878101395681),
+ FRAC_CONST(0.0138264243888068),
+ FRAC_CONST(0.0141702896484671),
+ FRAC_CONST(0.0145194481434592),
+ FRAC_CONST(0.0148739420281182),
+ FRAC_CONST(0.0152338133833959),
+ FRAC_CONST(0.0155991042139432),
+ FRAC_CONST(0.0159698564450882),
+ FRAC_CONST(0.0163461119197227),
+ FRAC_CONST(0.0167279123950996),
+ FRAC_CONST(0.0171152995395520),
+ FRAC_CONST(0.0175083149291368),
+ FRAC_CONST(0.0179070000442104),
+ FRAC_CONST(0.0183113962659409),
+ FRAC_CONST(0.0187215448727609),
+ FRAC_CONST(0.0191374870367659),
+ FRAC_CONST(0.0195592638200623),
+ FRAC_CONST(0.0199869161710679),
+ FRAC_CONST(0.0204204849207691),
+ FRAC_CONST(0.0208600107789370),
+ FRAC_CONST(0.0213055343303066),
+ FRAC_CONST(0.0217570960307201),
+ FRAC_CONST(0.0222147362032386),
+ FRAC_CONST(0.0226784950342228),
+ FRAC_CONST(0.0231484125693867),
+ FRAC_CONST(0.0236245287098244),
+ FRAC_CONST(0.0241068832080138),
+ FRAC_CONST(0.0245955156637973),
+ FRAC_CONST(0.0250904655203431),
+ FRAC_CONST(0.0255917720600868),
+ FRAC_CONST(0.0260994744006559),
+ FRAC_CONST(0.0266136114907790),
+ FRAC_CONST(0.0271342221061795),
+ FRAC_CONST(0.0276613448454576),
+ FRAC_CONST(0.0281950181259587),
+ FRAC_CONST(0.0287352801796329),
+ FRAC_CONST(0.0292821690488833),
+ FRAC_CONST(0.0298357225824074),
+ FRAC_CONST(0.0303959784310299),
+ FRAC_CONST(0.0309629740435296),
+ FRAC_CONST(0.0315367466624615),
+ FRAC_CONST(0.0321173333199732),
+ FRAC_CONST(0.0327047708336193),
+ FRAC_CONST(0.0332990958021720),
+ FRAC_CONST(0.0339003446014307),
+ FRAC_CONST(0.0345085533800302),
+ FRAC_CONST(0.0351237580552491),
+ FRAC_CONST(0.0357459943088193),
+ FRAC_CONST(0.0363752975827358),
+ FRAC_CONST(0.0370117030750704),
+ FRAC_CONST(0.0376552457357870),
+ FRAC_CONST(0.0383059602625614),
+ FRAC_CONST(0.0389638810966056),
+ FRAC_CONST(0.0396290424184964),
+ FRAC_CONST(0.0403014781440112),
+ FRAC_CONST(0.0409812219199691),
+ FRAC_CONST(0.0416683071200799),
+ FRAC_CONST(0.0423627668408009),
+ FRAC_CONST(0.0430646338972016),
+ FRAC_CONST(0.0437739408188385),
+ FRAC_CONST(0.0444907198456388),
+ FRAC_CONST(0.0452150029237951),
+ FRAC_CONST(0.0459468217016708),
+ FRAC_CONST(0.0466862075257170),
+ FRAC_CONST(0.0474331914364021),
+ FRAC_CONST(0.0481878041641539),
+ FRAC_CONST(0.0489500761253148),
+ FRAC_CONST(0.0497200374181119),
+ FRAC_CONST(0.0504977178186404),
+ FRAC_CONST(0.0512831467768636),
+ FRAC_CONST(0.0520763534126273),
+ FRAC_CONST(0.0528773665116913),
+ FRAC_CONST(0.0536862145217772),
+ FRAC_CONST(0.0545029255486345),
+ FRAC_CONST(0.0553275273521232),
+ FRAC_CONST(0.0561600473423164),
+ FRAC_CONST(0.0570005125756209),
+ FRAC_CONST(0.0578489497509179),
+ FRAC_CONST(0.0587053852057233),
+ FRAC_CONST(0.0595698449123695),
+ FRAC_CONST(0.0604423544742077),
+ FRAC_CONST(0.0613229391218317),
+ FRAC_CONST(0.0622116237093247),
+ FRAC_CONST(0.0631084327105284),
+ FRAC_CONST(0.0640133902153352),
+ FRAC_CONST(0.0649265199260043),
+ FRAC_CONST(0.0658478451535027),
+ FRAC_CONST(0.0667773888138695),
+ FRAC_CONST(0.0677151734246072),
+ FRAC_CONST(0.0686612211010977),
+ FRAC_CONST(0.0696155535530446),
+ FRAC_CONST(0.0705781920809429),
+ FRAC_CONST(0.0715491575725758),
+ FRAC_CONST(0.0725284704995383),
+ FRAC_CONST(0.0735161509137906),
+ FRAC_CONST(0.0745122184442388),
+ FRAC_CONST(0.0755166922933461),
+ FRAC_CONST(0.0765295912337720),
+ FRAC_CONST(0.0775509336050437),
+ FRAC_CONST(0.0785807373102561),
+ FRAC_CONST(0.0796190198128044),
+ FRAC_CONST(0.0806657981331473),
+ FRAC_CONST(0.0817210888456026),
+ FRAC_CONST(0.0827849080751753),
+ FRAC_CONST(0.0838572714944183),
+ FRAC_CONST(0.0849381943203265),
+ FRAC_CONST(0.0860276913112652),
+ FRAC_CONST(0.0871257767639319),
+ FRAC_CONST(0.0882324645103534),
+ FRAC_CONST(0.0893477679149177),
+ FRAC_CONST(0.0904716998714418),
+ FRAC_CONST(0.0916042728002747),
+ FRAC_CONST(0.0927454986454381),
+ FRAC_CONST(0.0938953888718020),
+ FRAC_CONST(0.0950539544622996),
+ FRAC_CONST(0.0962212059151784),
+ FRAC_CONST(0.0973971532412897),
+ FRAC_CONST(0.0985818059614169),
+ FRAC_CONST(0.0997751731036425),
+ FRAC_CONST(0.1009772632007537),
+ FRAC_CONST(0.1021880842876888),
+ FRAC_CONST(0.1034076438990227),
+ FRAC_CONST(0.1046359490664932),
+ FRAC_CONST(0.1058730063165681),
+ FRAC_CONST(0.1071188216680533),
+ FRAC_CONST(0.1083734006297428),
+ FRAC_CONST(0.1096367481981100),
+ FRAC_CONST(0.1109088688550422),
+ FRAC_CONST(0.1121897665656167),
+ FRAC_CONST(0.1134794447759207),
+ FRAC_CONST(0.1147779064109143),
+ FRAC_CONST(0.1160851538723372),
+ FRAC_CONST(0.1174011890366591),
+ FRAC_CONST(0.1187260132530751),
+ FRAC_CONST(0.1200596273415457),
+ FRAC_CONST(0.1214020315908810),
+ FRAC_CONST(0.1227532257568719),
+ FRAC_CONST(0.1241132090604651),
+ FRAC_CONST(0.1254819801859856),
+ FRAC_CONST(0.1268595372794049),
+ FRAC_CONST(0.1282458779466558),
+ FRAC_CONST(0.1296409992519942),
+ FRAC_CONST(0.1310448977164081),
+ FRAC_CONST(0.1324575693160745),
+ FRAC_CONST(0.1338790094808633),
+ FRAC_CONST(0.1353092130928902),
+ FRAC_CONST(0.1367481744851168),
+ FRAC_CONST(0.1381958874400010),
+ FRAC_CONST(0.1396523451881945),
+ FRAC_CONST(0.1411175404072910),
+ FRAC_CONST(0.1425914652206223),
+ FRAC_CONST(0.1440741111961058),
+ FRAC_CONST(0.1455654693451402),
+ FRAC_CONST(0.1470655301215526),
+ FRAC_CONST(0.1485742834205956),
+ FRAC_CONST(0.1500917185779945),
+ FRAC_CONST(0.1516178243690463),
+ FRAC_CONST(0.1531525890077689),
+ FRAC_CONST(0.1546960001461024),
+ FRAC_CONST(0.1562480448731608),
+ FRAC_CONST(0.1578087097145364),
+ FRAC_CONST(0.1593779806316558),
+ FRAC_CONST(0.1609558430211876),
+ FRAC_CONST(0.1625422817145027),
+ FRAC_CONST(0.1641372809771871),
+ FRAC_CONST(0.1657408245086070),
+ FRAC_CONST(0.1673528954415270),
+ FRAC_CONST(0.1689734763417811),
+ FRAC_CONST(0.1706025492079969),
+ FRAC_CONST(0.1722400954713725),
+ FRAC_CONST(0.1738860959955082),
+ FRAC_CONST(0.1755405310762898),
+ FRAC_CONST(0.1772033804418275),
+ FRAC_CONST(0.1788746232524467),
+ FRAC_CONST(0.1805542381007349),
+ FRAC_CONST(0.1822422030116404),
+ FRAC_CONST(0.1839384954426268),
+ FRAC_CONST(0.1856430922838810),
+ FRAC_CONST(0.1873559698585756),
+ FRAC_CONST(0.1890771039231862),
+ FRAC_CONST(0.1908064696678625),
+ FRAC_CONST(0.1925440417168546),
+ FRAC_CONST(0.1942897941289937),
+ FRAC_CONST(0.1960437003982277),
+ FRAC_CONST(0.1978057334542116),
+ FRAC_CONST(0.1995758656629525),
+ FRAC_CONST(0.2013540688275098),
+ FRAC_CONST(0.2031403141887507),
+ FRAC_CONST(0.2049345724261595),
+ FRAC_CONST(0.2067368136587033),
+ FRAC_CONST(0.2085470074457521),
+ FRAC_CONST(0.2103651227880538),
+ FRAC_CONST(0.2121911281287646),
+ FRAC_CONST(0.2140249913545346),
+ FRAC_CONST(0.2158666797966480),
+ FRAC_CONST(0.2177161602322188),
+ FRAC_CONST(0.2195733988854414),
+ FRAC_CONST(0.2214383614288963),
+ FRAC_CONST(0.2233110129849106),
+ FRAC_CONST(0.2251913181269740),
+ FRAC_CONST(0.2270792408812093),
+ FRAC_CONST(0.2289747447278976),
+ FRAC_CONST(0.2308777926030592),
+ FRAC_CONST(0.2327883469000885),
+ FRAC_CONST(0.2347063694714437),
+ FRAC_CONST(0.2366318216303919),
+ FRAC_CONST(0.2385646641528076),
+ FRAC_CONST(0.2405048572790267),
+ FRAC_CONST(0.2424523607157545),
+ FRAC_CONST(0.2444071336380283),
+ FRAC_CONST(0.2463691346912334),
+ FRAC_CONST(0.2483383219931741),
+ FRAC_CONST(0.2503146531361985),
+ FRAC_CONST(0.2522980851893767),
+ FRAC_CONST(0.2542885747007335),
+ FRAC_CONST(0.2562860776995335),
+ FRAC_CONST(0.2582905496986215),
+ FRAC_CONST(0.2603019456968142),
+ FRAC_CONST(0.2623202201813464),
+ FRAC_CONST(0.2643453271303700),
+ FRAC_CONST(0.2663772200155053),
+ FRAC_CONST(0.2684158518044454),
+ FRAC_CONST(0.2704611749636135),
+ FRAC_CONST(0.2725131414608710),
+ FRAC_CONST(0.2745717027682799),
+ FRAC_CONST(0.2766368098649151),
+ FRAC_CONST(0.2787084132397296),
+ FRAC_CONST(0.2807864628944707),
+ FRAC_CONST(0.2828709083466482),
+ FRAC_CONST(0.2849616986325523),
+ FRAC_CONST(0.2870587823103237),
+ FRAC_CONST(0.2891621074630737),
+ FRAC_CONST(0.2912716217020546),
+ FRAC_CONST(0.2933872721698803),
+ FRAC_CONST(0.2955090055437973),
+ FRAC_CONST(0.2976367680390041),
+ FRAC_CONST(0.2997705054120213),
+ FRAC_CONST(0.3019101629641097),
+ FRAC_CONST(0.3040556855447379),
+ FRAC_CONST(0.3062070175550981),
+ FRAC_CONST(0.3083641029516701),
+ FRAC_CONST(0.3105268852498334),
+ FRAC_CONST(0.3126953075275265),
+ FRAC_CONST(0.3148693124289546),
+ FRAC_CONST(0.3170488421683428),
+ FRAC_CONST(0.3192338385337370),
+ FRAC_CONST(0.3214242428908514),
+ FRAC_CONST(0.3236199961869606),
+ FRAC_CONST(0.3258210389548392),
+ FRAC_CONST(0.3280273113167459),
+ FRAC_CONST(0.3302387529884521),
+ FRAC_CONST(0.3324553032833160),
+ FRAC_CONST(0.3346769011164010),
+ FRAC_CONST(0.3369034850086373),
+ FRAC_CONST(0.3391349930910280),
+ FRAC_CONST(0.3413713631088974),
+ FRAC_CONST(0.3436125324261830),
+ FRAC_CONST(0.3458584380297697),
+ FRAC_CONST(0.3481090165338656),
+ FRAC_CONST(0.3503642041844199),
+ FRAC_CONST(0.3526239368635820),
+ FRAC_CONST(0.3548881500942010),
+ FRAC_CONST(0.3571567790443668),
+ FRAC_CONST(0.3594297585319891),
+ FRAC_CONST(0.3617070230294185),
+ FRAC_CONST(0.3639885066681048),
+ FRAC_CONST(0.3662741432432950),
+ FRAC_CONST(0.3685638662187693),
+ FRAC_CONST(0.3708576087316147),
+ FRAC_CONST(0.3731553035970366),
+ FRAC_CONST(0.3754568833132069),
+ FRAC_CONST(0.3777622800661488),
+ FRAC_CONST(0.3800714257346570),
+ FRAC_CONST(0.3823842518952546),
+ FRAC_CONST(0.3847006898271841),
+ FRAC_CONST(0.3870206705174334),
+ FRAC_CONST(0.3893441246657958),
+ FRAC_CONST(0.3916709826899639),
+ FRAC_CONST(0.3940011747306560),
+ FRAC_CONST(0.3963346306567764),
+ FRAC_CONST(0.3986712800706062),
+ FRAC_CONST(0.4010110523130271),
+ FRAC_CONST(0.4033538764687756),
+ FRAC_CONST(0.4056996813717284),
+ FRAC_CONST(0.4080483956102172),
+ FRAC_CONST(0.4103999475323736),
+ FRAC_CONST(0.4127542652515031),
+ FRAC_CONST(0.4151112766514873),
+ FRAC_CONST(0.4174709093922143),
+ FRAC_CONST(0.4198330909150365),
+ FRAC_CONST(0.4221977484482556),
+ FRAC_CONST(0.4245648090126334),
+ FRAC_CONST(0.4269341994269293),
+ FRAC_CONST(0.4293058463134616),
+ FRAC_CONST(0.4316796761036958),
+ FRAC_CONST(0.4340556150438547),
+ FRAC_CONST(0.4364335892005536),
+ FRAC_CONST(0.4388135244664580),
+ FRAC_CONST(0.4411953465659639),
+ FRAC_CONST(0.4435789810609000),
+ FRAC_CONST(0.4459643533562509),
+ FRAC_CONST(0.4483513887059016),
+ FRAC_CONST(0.4507400122184019),
+ FRAC_CONST(0.4531301488627497),
+ FRAC_CONST(0.4555217234741947),
+ FRAC_CONST(0.4579146607600593),
+ FRAC_CONST(0.4603088853055777),
+ FRAC_CONST(0.4627043215797521),
+ FRAC_CONST(0.4651008939412254),
+ FRAC_CONST(0.4674985266441709),
+ FRAC_CONST(0.4698971438441951),
+ FRAC_CONST(0.4722966696042580),
+ FRAC_CONST(0.4746970279006055),
+ FRAC_CONST(0.4770981426287164),
+ FRAC_CONST(0.4794999376092619),
+ FRAC_CONST(0.4819023365940778),
+ FRAC_CONST(0.4843052632721476),
+ FRAC_CONST(0.4867086412755978),
+ FRAC_CONST(0.4891123941857028),
+ FRAC_CONST(0.4915164455388997),
+ FRAC_CONST(0.4939207188328126),
+ FRAC_CONST(0.4963251375322855),
+ FRAC_CONST(0.4987296250754225),
+ FRAC_CONST(0.5011341048796359),
+ FRAC_CONST(0.5035385003477012),
+ FRAC_CONST(0.5059427348738168),
+ FRAC_CONST(0.5083467318496706),
+ FRAC_CONST(0.5107504146705106),
+ FRAC_CONST(0.5131537067412193),
+ FRAC_CONST(0.5155565314823923),
+ FRAC_CONST(0.5179588123364193),
+ FRAC_CONST(0.5203604727735667),
+ FRAC_CONST(0.5227614362980630),
+ FRAC_CONST(0.5251616264541841),
+ FRAC_CONST(0.5275609668323384),
+ FRAC_CONST(0.5299593810751532),
+ FRAC_CONST(0.5323567928835578),
+ FRAC_CONST(0.5347531260228663),
+ FRAC_CONST(0.5371483043288580),
+ FRAC_CONST(0.5395422517138538),
+ FRAC_CONST(0.5419348921727899),
+ FRAC_CONST(0.5443261497892862),
+ FRAC_CONST(0.5467159487417104),
+ FRAC_CONST(0.5491042133092364),
+ FRAC_CONST(0.5514908678778958),
+ FRAC_CONST(0.5538758369466227),
+ FRAC_CONST(0.5562590451332913),
+ FRAC_CONST(0.5586404171807443),
+ FRAC_CONST(0.5610198779628133),
+ FRAC_CONST(0.5633973524903286),
+ FRAC_CONST(0.5657727659171199),
+ FRAC_CONST(0.5681460435460047),
+ FRAC_CONST(0.5705171108347663),
+ FRAC_CONST(0.5728858934021188),
+ FRAC_CONST(0.5752523170336598),
+ FRAC_CONST(0.5776163076878088),
+ FRAC_CONST(0.5799777915017323),
+ FRAC_CONST(0.5823366947972535),
+ FRAC_CONST(0.5846929440867458),
+ FRAC_CONST(0.5870464660790119),
+ FRAC_CONST(0.5893971876851449),
+ FRAC_CONST(0.5917450360243719),
+ FRAC_CONST(0.5940899384298793),
+ FRAC_CONST(0.5964318224546208),
+ FRAC_CONST(0.5987706158771039),
+ FRAC_CONST(0.6011062467071583),
+ FRAC_CONST(0.6034386431916822),
+ FRAC_CONST(0.6057677338203681),
+ FRAC_CONST(0.6080934473314057),
+ FRAC_CONST(0.6104157127171639),
+ FRAC_CONST(0.6127344592298474),
+ FRAC_CONST(0.6150496163871310),
+ FRAC_CONST(0.6173611139777690),
+ FRAC_CONST(0.6196688820671789),
+ FRAC_CONST(0.6219728510029997),
+ FRAC_CONST(0.6242729514206247),
+ FRAC_CONST(0.6265691142487051),
+ FRAC_CONST(0.6288612707146283),
+ FRAC_CONST(0.6311493523499663),
+ FRAC_CONST(0.6334332909958958),
+ FRAC_CONST(0.6357130188085891),
+ FRAC_CONST(0.6379884682645743),
+ FRAC_CONST(0.6402595721660647),
+ FRAC_CONST(0.6425262636462578),
+ FRAC_CONST(0.6447884761746012),
+ FRAC_CONST(0.6470461435620266),
+ FRAC_CONST(0.6492991999661505),
+ FRAC_CONST(0.6515475798964411),
+ FRAC_CONST(0.6537912182193508),
+ FRAC_CONST(0.6560300501634142),
+ FRAC_CONST(0.6582640113243098),
+ FRAC_CONST(0.6604930376698862),
+ FRAC_CONST(0.6627170655451516),
+ FRAC_CONST(0.6649360316772256),
+ FRAC_CONST(0.6671498731802533),
+ FRAC_CONST(0.6693585275602818),
+ FRAC_CONST(0.6715619327200959),
+ FRAC_CONST(0.6737600269640164),
+ FRAC_CONST(0.6759527490026566),
+ FRAC_CONST(0.6781400379576392),
+ FRAC_CONST(0.6803218333662715),
+ FRAC_CONST(0.6824980751861787),
+ FRAC_CONST(0.6846687037998949),
+ FRAC_CONST(0.6868336600194123),
+ FRAC_CONST(0.6889928850906855),
+ FRAC_CONST(0.6911463206980928),
+ FRAC_CONST(0.6932939089688525),
+ FRAC_CONST(0.6954355924773949),
+ FRAC_CONST(0.6975713142496884),
+ FRAC_CONST(0.6997010177675195),
+ FRAC_CONST(0.7018246469727265),
+ FRAC_CONST(0.7039421462713862),
+ FRAC_CONST(0.7060534605379528),
+ FRAC_CONST(0.7081585351193496),
+ FRAC_CONST(0.7102573158390105),
+ FRAC_CONST(0.7123497490008750),
+ FRAC_CONST(0.7144357813933307),
+ FRAC_CONST(0.7165153602931092),
+ FRAC_CONST(0.7185884334691287),
+ FRAC_CONST(0.7206549491862871),
+ FRAC_CONST(0.7227148562092042),
+ FRAC_CONST(0.7247681038059106),
+ FRAC_CONST(0.7268146417514855),
+ FRAC_CONST(0.7288544203316418),
+ FRAC_CONST(0.7308873903462577),
+ FRAC_CONST(0.7329135031128549),
+ FRAC_CONST(0.7349327104700221),
+ FRAC_CONST(0.7369449647807855),
+ FRAC_CONST(0.7389502189359237),
+ FRAC_CONST(0.7409484263572271),
+ FRAC_CONST(0.7429395410007016),
+ FRAC_CONST(0.7449235173597176),
+ FRAC_CONST(0.7469003104681008),
+ FRAC_CONST(0.7488698759031670),
+ FRAC_CONST(0.7508321697887005),
+ FRAC_CONST(0.7527871487978728),
+ FRAC_CONST(0.7547347701561059),
+ FRAC_CONST(0.7566749916438754),
+ FRAC_CONST(0.7586077715994560),
+ FRAC_CONST(0.7605330689216074),
+ FRAC_CONST(0.7624508430722016),
+ FRAC_CONST(0.7643610540787891),
+ FRAC_CONST(0.7662636625371070),
+ FRAC_CONST(0.7681586296135255),
+ FRAC_CONST(0.7700459170474343),
+ FRAC_CONST(0.7719254871535672),
+ FRAC_CONST(0.7737973028242671),
+ FRAC_CONST(0.7756613275316875),
+ FRAC_CONST(0.7775175253299340),
+ FRAC_CONST(0.7793658608571425),
+ FRAC_CONST(0.7812062993374951),
+ FRAC_CONST(0.7830388065831744),
+ FRAC_CONST(0.7848633489962533),
+ FRAC_CONST(0.7866798935705233),
+ FRAC_CONST(0.7884884078932579),
+ FRAC_CONST(0.7902888601469138),
+ FRAC_CONST(0.7920812191107668),
+ FRAC_CONST(0.7938654541624850),
+ FRAC_CONST(0.7956415352796368),
+ FRAC_CONST(0.7974094330411343),
+ FRAC_CONST(0.7991691186286133),
+ FRAC_CONST(0.8009205638277465),
+ FRAC_CONST(0.8026637410294932),
+ FRAC_CONST(0.8043986232312831),
+ FRAC_CONST(0.8061251840381346),
+ FRAC_CONST(0.8078433976637077),
+ FRAC_CONST(0.8095532389312917),
+ FRAC_CONST(0.8112546832747255),
+ FRAC_CONST(0.8129477067392539),
+ FRAC_CONST(0.8146322859823164),
+ FRAC_CONST(0.8163083982742698),
+ FRAC_CONST(0.8179760214990457),
+ FRAC_CONST(0.8196351341547393),
+ FRAC_CONST(0.8212857153541345),
+ FRAC_CONST(0.8229277448251595),
+ FRAC_CONST(0.8245612029112778),
+ FRAC_CONST(0.8261860705718113),
+ FRAC_CONST(0.8278023293821971),
+ FRAC_CONST(0.8294099615341773),
+ FRAC_CONST(0.8310089498359212),
+ FRAC_CONST(0.8325992777120815),
+ FRAC_CONST(0.8341809292037831),
+ FRAC_CONST(0.8357538889685445),
+ FRAC_CONST(0.8373181422801330),
+ FRAC_CONST(0.8388736750283521),
+ FRAC_CONST(0.8404204737187619),
+ FRAC_CONST(0.8419585254723335),
+ FRAC_CONST(0.8434878180250348),
+ FRAC_CONST(0.8450083397273509),
+ FRAC_CONST(0.8465200795437368),
+ FRAC_CONST(0.8480230270520029),
+ FRAC_CONST(0.8495171724426350),
+ FRAC_CONST(0.8510025065180464),
+ FRAC_CONST(0.8524790206917633),
+ FRAC_CONST(0.8539467069875448),
+ FRAC_CONST(0.8554055580384357),
+ FRAC_CONST(0.8568555670857525),
+ FRAC_CONST(0.8582967279780043),
+ FRAC_CONST(0.8597290351697464),
+ FRAC_CONST(0.8611524837203691),
+ FRAC_CONST(0.8625670692928198),
+ FRAC_CONST(0.8639727881522599),
+ FRAC_CONST(0.8653696371646555),
+ FRAC_CONST(0.8667576137953045),
+ FRAC_CONST(0.8681367161072958),
+ FRAC_CONST(0.8695069427599065),
+ FRAC_CONST(0.8708682930069319),
+ FRAC_CONST(0.8722207666949527),
+ FRAC_CONST(0.8735643642615368),
+ FRAC_CONST(0.8748990867333771),
+ FRAC_CONST(0.8762249357243662),
+ FRAC_CONST(0.8775419134336067),
+ FRAC_CONST(0.8788500226433579),
+ FRAC_CONST(0.8801492667169208),
+ FRAC_CONST(0.8814396495964587),
+ FRAC_CONST(0.8827211758007560),
+ FRAC_CONST(0.8839938504229149),
+ FRAC_CONST(0.8852576791279895),
+ FRAC_CONST(0.8865126681505587),
+ FRAC_CONST(0.8877588242922386),
+ FRAC_CONST(0.8889961549191320),
+ FRAC_CONST(0.8902246679592184),
+ FRAC_CONST(0.8914443718996848),
+ FRAC_CONST(0.8926552757841945),
+ FRAC_CONST(0.8938573892100969),
+ FRAC_CONST(0.8950507223255798),
+ FRAC_CONST(0.8962352858267605),
+ FRAC_CONST(0.8974110909547198),
+ FRAC_CONST(0.8985781494924783),
+ FRAC_CONST(0.8997364737619142),
+ FRAC_CONST(0.9008860766206249),
+ FRAC_CONST(0.9020269714587307),
+ FRAC_CONST(0.9031591721956235),
+ FRAC_CONST(0.9042826932766591),
+ FRAC_CONST(0.9053975496697941),
+ FRAC_CONST(0.9065037568621681),
+ FRAC_CONST(0.9076013308566311),
+ FRAC_CONST(0.9086902881682180),
+ FRAC_CONST(0.9097706458205682),
+ FRAC_CONST(0.9108424213422940),
+ FRAC_CONST(0.9119056327632955),
+ FRAC_CONST(0.9129602986110235),
+ FRAC_CONST(0.9140064379066919),
+ FRAC_CONST(0.9150440701614393),
+ FRAC_CONST(0.9160732153724396),
+ FRAC_CONST(0.9170938940189634),
+ FRAC_CONST(0.9181061270583908),
+ FRAC_CONST(0.9191099359221748),
+ FRAC_CONST(0.9201053425117579),
+ FRAC_CONST(0.9210923691944400),
+ FRAC_CONST(0.9220710387992010),
+ FRAC_CONST(0.9230413746124764),
+ FRAC_CONST(0.9240034003738882),
+ FRAC_CONST(0.9249571402719298),
+ FRAC_CONST(0.9259026189396085),
+ FRAC_CONST(0.9268398614500427),
+ FRAC_CONST(0.9277688933120170),
+ FRAC_CONST(0.9286897404654957),
+ FRAC_CONST(0.9296024292770939),
+ FRAC_CONST(0.9305069865355076),
+ FRAC_CONST(0.9314034394469048),
+ FRAC_CONST(0.9322918156302762),
+ FRAC_CONST(0.9331721431127471),
+ FRAC_CONST(0.9340444503248519),
+ FRAC_CONST(0.9349087660957711),
+ FRAC_CONST(0.9357651196485313),
+ FRAC_CONST(0.9366135405951697),
+ FRAC_CONST(0.9374540589318637),
+ FRAC_CONST(0.9382867050340261),
+ FRAC_CONST(0.9391115096513655),
+ FRAC_CONST(0.9399285039029165),
+ FRAC_CONST(0.9407377192720349),
+ FRAC_CONST(0.9415391876013639),
+ FRAC_CONST(0.9423329410877687),
+ FRAC_CONST(0.9431190122772415),
+ FRAC_CONST(0.9438974340597782),
+ FRAC_CONST(0.9446682396642262),
+ FRAC_CONST(0.9454314626531054),
+ FRAC_CONST(0.9461871369174033),
+ FRAC_CONST(0.9469352966713429),
+ FRAC_CONST(0.9476759764471278),
+ FRAC_CONST(0.9484092110896616),
+ FRAC_CONST(0.9491350357512457),
+ FRAC_CONST(0.9498534858862532),
+ FRAC_CONST(0.9505645972457831),
+ FRAC_CONST(0.9512684058722927),
+ FRAC_CONST(0.9519649480942105),
+ FRAC_CONST(0.9526542605205314),
+ FRAC_CONST(0.9533363800353921),
+ FRAC_CONST(0.9540113437926313),
+ FRAC_CONST(0.9546791892103320),
+ FRAC_CONST(0.9553399539653500),
+ FRAC_CONST(0.9559936759878265),
+ FRAC_CONST(0.9566403934556893),
+ FRAC_CONST(0.9572801447891388),
+ FRAC_CONST(0.9579129686451244),
+ FRAC_CONST(0.9585389039118085),
+ FRAC_CONST(0.9591579897030224),
+ FRAC_CONST(0.9597702653527108),
+ FRAC_CONST(0.9603757704093711),
+ FRAC_CONST(0.9609745446304828),
+ FRAC_CONST(0.9615666279769324),
+ FRAC_CONST(0.9621520606074324),
+ FRAC_CONST(0.9627308828729358),
+ FRAC_CONST(0.9633031353110477),
+ FRAC_CONST(0.9638688586404335),
+ FRAC_CONST(0.9644280937552258),
+ FRAC_CONST(0.9649808817194311),
+ FRAC_CONST(0.9655272637613366),
+ FRAC_CONST(0.9660672812679171),
+ FRAC_CONST(0.9666009757792454),
+ FRAC_CONST(0.9671283889829055),
+ FRAC_CONST(0.9676495627084089),
+ FRAC_CONST(0.9681645389216160),
+ FRAC_CONST(0.9686733597191652),
+ FRAC_CONST(0.9691760673229058),
+ FRAC_CONST(0.9696727040743406),
+ FRAC_CONST(0.9701633124290767),
+ FRAC_CONST(0.9706479349512860),
+ FRAC_CONST(0.9711266143081750),
+ FRAC_CONST(0.9715993932644684),
+ FRAC_CONST(0.9720663146769026),
+ FRAC_CONST(0.9725274214887337),
+ FRAC_CONST(0.9729827567242596),
+ FRAC_CONST(0.9734323634833574),
+ FRAC_CONST(0.9738762849360358),
+ FRAC_CONST(0.9743145643170059),
+ FRAC_CONST(0.9747472449202687),
+ FRAC_CONST(0.9751743700937215),
+ FRAC_CONST(0.9755959832337850),
+ FRAC_CONST(0.9760121277800496),
+ FRAC_CONST(0.9764228472099433),
+ FRAC_CONST(0.9768281850334235),
+ FRAC_CONST(0.9772281847876897),
+ FRAC_CONST(0.9776228900319223),
+ FRAC_CONST(0.9780123443420448),
+ FRAC_CONST(0.9783965913055132),
+ FRAC_CONST(0.9787756745161313),
+ FRAC_CONST(0.9791496375688939),
+ FRAC_CONST(0.9795185240548578),
+ FRAC_CONST(0.9798823775560431),
+ FRAC_CONST(0.9802412416403639),
+ FRAC_CONST(0.9805951598565897),
+ FRAC_CONST(0.9809441757293399),
+ FRAC_CONST(0.9812883327541090),
+ FRAC_CONST(0.9816276743923267),
+ FRAC_CONST(0.9819622440664515),
+ FRAC_CONST(0.9822920851550995),
+ FRAC_CONST(0.9826172409882086),
+ FRAC_CONST(0.9829377548422400),
+ FRAC_CONST(0.9832536699354163),
+ FRAC_CONST(0.9835650294229984),
+ FRAC_CONST(0.9838718763926001),
+ FRAC_CONST(0.9841742538595437),
+ FRAC_CONST(0.9844722047622547),
+ FRAC_CONST(0.9847657719576983),
+ FRAC_CONST(0.9850549982168574),
+ FRAC_CONST(0.9853399262202529),
+ FRAC_CONST(0.9856205985535073),
+ FRAC_CONST(0.9858970577029519),
+ FRAC_CONST(0.9861693460512790),
+ FRAC_CONST(0.9864375058732389),
+ FRAC_CONST(0.9867015793313820),
+ FRAC_CONST(0.9869616084718489),
+ FRAC_CONST(0.9872176352202061),
+ FRAC_CONST(0.9874697013773301),
+ FRAC_CONST(0.9877178486153397),
+ FRAC_CONST(0.9879621184735767),
+ FRAC_CONST(0.9882025523546365),
+ FRAC_CONST(0.9884391915204485),
+ FRAC_CONST(0.9886720770884069),
+ FRAC_CONST(0.9889012500275530),
+ FRAC_CONST(0.9891267511548089),
+ FRAC_CONST(0.9893486211312621),
+ FRAC_CONST(0.9895669004585049),
+ FRAC_CONST(0.9897816294750255),
+ FRAC_CONST(0.9899928483526520),
+ FRAC_CONST(0.9902005970930525),
+ FRAC_CONST(0.9904049155242876),
+ FRAC_CONST(0.9906058432974180),
+ FRAC_CONST(0.9908034198831690),
+ FRAC_CONST(0.9909976845686489),
+ FRAC_CONST(0.9911886764541239),
+ FRAC_CONST(0.9913764344498495),
+ FRAC_CONST(0.9915609972729590),
+ FRAC_CONST(0.9917424034444086),
+ FRAC_CONST(0.9919206912859797),
+ FRAC_CONST(0.9920958989173397),
+ FRAC_CONST(0.9922680642531603),
+ FRAC_CONST(0.9924372250002933),
+ FRAC_CONST(0.9926034186550070),
+ FRAC_CONST(0.9927666825002789),
+ FRAC_CONST(0.9929270536031491),
+ FRAC_CONST(0.9930845688121325),
+ FRAC_CONST(0.9932392647546895),
+ FRAC_CONST(0.9933911778347579),
+ FRAC_CONST(0.9935403442303433),
+ FRAC_CONST(0.9936867998911693),
+ FRAC_CONST(0.9938305805363887),
+ FRAC_CONST(0.9939717216523539),
+ FRAC_CONST(0.9941102584904481),
+ FRAC_CONST(0.9942462260649764),
+ FRAC_CONST(0.9943796591511174),
+ FRAC_CONST(0.9945105922829353),
+ FRAC_CONST(0.9946390597514524),
+ FRAC_CONST(0.9947650956027824),
+ FRAC_CONST(0.9948887336363228),
+ FRAC_CONST(0.9950100074030103),
+ FRAC_CONST(0.9951289502036336),
+ FRAC_CONST(0.9952455950872091),
+ FRAC_CONST(0.9953599748494155),
+ FRAC_CONST(0.9954721220310890),
+ FRAC_CONST(0.9955820689167787),
+ FRAC_CONST(0.9956898475333619),
+ FRAC_CONST(0.9957954896487196),
+ FRAC_CONST(0.9958990267704713),
+ FRAC_CONST(0.9960004901447701),
+ FRAC_CONST(0.9960999107551559),
+ FRAC_CONST(0.9961973193214694),
+ FRAC_CONST(0.9962927462988245),
+ FRAC_CONST(0.9963862218766388),
+ FRAC_CONST(0.9964777759777242),
+ FRAC_CONST(0.9965674382574342),
+ FRAC_CONST(0.9966552381028704),
+ FRAC_CONST(0.9967412046321465),
+ FRAC_CONST(0.9968253666937095),
+ FRAC_CONST(0.9969077528657186),
+ FRAC_CONST(0.9969883914554805),
+ FRAC_CONST(0.9970673104989413),
+ FRAC_CONST(0.9971445377602348),
+ FRAC_CONST(0.9972201007312871),
+ FRAC_CONST(0.9972940266314749),
+ FRAC_CONST(0.9973663424073412),
+ FRAC_CONST(0.9974370747323638),
+ FRAC_CONST(0.9975062500067785),
+ FRAC_CONST(0.9975738943574574),
+ FRAC_CONST(0.9976400336378379),
+ FRAC_CONST(0.9977046934279079),
+ FRAC_CONST(0.9977678990342401),
+ FRAC_CONST(0.9978296754900812),
+ FRAC_CONST(0.9978900475554902),
+ FRAC_CONST(0.9979490397175296),
+ FRAC_CONST(0.9980066761905056),
+ FRAC_CONST(0.9980629809162593),
+ FRAC_CONST(0.9981179775645063),
+ FRAC_CONST(0.9981716895332257),
+ FRAC_CONST(0.9982241399490979),
+ FRAC_CONST(0.9982753516679893),
+ FRAC_CONST(0.9983253472754841),
+ FRAC_CONST(0.9983741490874634),
+ FRAC_CONST(0.9984217791507299),
+ FRAC_CONST(0.9984682592436778),
+ FRAC_CONST(0.9985136108770075),
+ FRAC_CONST(0.9985578552944850),
+ FRAC_CONST(0.9986010134737439),
+ FRAC_CONST(0.9986431061271304),
+ FRAC_CONST(0.9986841537025921),
+ FRAC_CONST(0.9987241763846056),
+ FRAC_CONST(0.9987631940951476),
+ FRAC_CONST(0.9988012264947044),
+ FRAC_CONST(0.9988382929833222),
+ FRAC_CONST(0.9988744127016956),
+ FRAC_CONST(0.9989096045322947),
+ FRAC_CONST(0.9989438871005292),
+ FRAC_CONST(0.9989772787759494),
+ FRAC_CONST(0.9990097976734847),
+ FRAC_CONST(0.9990414616547146),
+ FRAC_CONST(0.9990722883291779),
+ FRAC_CONST(0.9991022950557125),
+ FRAC_CONST(0.9991314989438310),
+ FRAC_CONST(0.9991599168551279),
+ FRAC_CONST(0.9991875654047181),
+ FRAC_CONST(0.9992144609627068),
+ FRAC_CONST(0.9992406196556911),
+ FRAC_CONST(0.9992660573682882),
+ FRAC_CONST(0.9992907897446957),
+ FRAC_CONST(0.9993148321902777),
+ FRAC_CONST(0.9993381998731797),
+ FRAC_CONST(0.9993609077259696),
+ FRAC_CONST(0.9993829704473038),
+ FRAC_CONST(0.9994044025036201),
+ FRAC_CONST(0.9994252181308537),
+ FRAC_CONST(0.9994454313361775),
+ FRAC_CONST(0.9994650558997651),
+ FRAC_CONST(0.9994841053765757),
+ FRAC_CONST(0.9995025930981609),
+ FRAC_CONST(0.9995205321744921),
+ FRAC_CONST(0.9995379354958073),
+ FRAC_CONST(0.9995548157344778),
+ FRAC_CONST(0.9995711853468930),
+ FRAC_CONST(0.9995870565753632),
+ FRAC_CONST(0.9996024414500382),
+ FRAC_CONST(0.9996173517908444),
+ FRAC_CONST(0.9996317992094352),
+ FRAC_CONST(0.9996457951111574),
+ FRAC_CONST(0.9996593506970310),
+ FRAC_CONST(0.9996724769657434),
+ FRAC_CONST(0.9996851847156547),
+ FRAC_CONST(0.9996974845468164),
+ FRAC_CONST(0.9997093868630000),
+ FRAC_CONST(0.9997209018737374),
+ FRAC_CONST(0.9997320395963699),
+ FRAC_CONST(0.9997428098581069),
+ FRAC_CONST(0.9997532222980933),
+ FRAC_CONST(0.9997632863694836),
+ FRAC_CONST(0.9997730113415246),
+ FRAC_CONST(0.9997824063016426),
+ FRAC_CONST(0.9997914801575380),
+ FRAC_CONST(0.9998002416392840),
+ FRAC_CONST(0.9998086993014300),
+ FRAC_CONST(0.9998168615251084),
+ FRAC_CONST(0.9998247365201450),
+ FRAC_CONST(0.9998323323271717),
+ FRAC_CONST(0.9998396568197407),
+ FRAC_CONST(0.9998467177064404),
+ FRAC_CONST(0.9998535225330116),
+ FRAC_CONST(0.9998600786844637),
+ FRAC_CONST(0.9998663933871905),
+ FRAC_CONST(0.9998724737110845),
+ FRAC_CONST(0.9998783265716498),
+ FRAC_CONST(0.9998839587321121),
+ FRAC_CONST(0.9998893768055266),
+ FRAC_CONST(0.9998945872568815),
+ FRAC_CONST(0.9998995964051983),
+ FRAC_CONST(0.9999044104256269),
+ FRAC_CONST(0.9999090353515359),
+ FRAC_CONST(0.9999134770765971),
+ FRAC_CONST(0.9999177413568642),
+ FRAC_CONST(0.9999218338128448),
+ FRAC_CONST(0.9999257599315647),
+ FRAC_CONST(0.9999295250686255),
+ FRAC_CONST(0.9999331344502529),
+ FRAC_CONST(0.9999365931753376),
+ FRAC_CONST(0.9999399062174669),
+ FRAC_CONST(0.9999430784269460),
+ FRAC_CONST(0.9999461145328103),
+ FRAC_CONST(0.9999490191448277),
+ FRAC_CONST(0.9999517967554878),
+ FRAC_CONST(0.9999544517419835),
+ FRAC_CONST(0.9999569883681778),
+ FRAC_CONST(0.9999594107865607),
+ FRAC_CONST(0.9999617230401926),
+ FRAC_CONST(0.9999639290646355),
+ FRAC_CONST(0.9999660326898712),
+ FRAC_CONST(0.9999680376422052),
+ FRAC_CONST(0.9999699475461585),
+ FRAC_CONST(0.9999717659263435),
+ FRAC_CONST(0.9999734962093266),
+ FRAC_CONST(0.9999751417254756),
+ FRAC_CONST(0.9999767057107922),
+ FRAC_CONST(0.9999781913087290),
+ FRAC_CONST(0.9999796015719915),
+ FRAC_CONST(0.9999809394643231),
+ FRAC_CONST(0.9999822078622751),
+ FRAC_CONST(0.9999834095569596),
+ FRAC_CONST(0.9999845472557860),
+ FRAC_CONST(0.9999856235841805),
+ FRAC_CONST(0.9999866410872889),
+ FRAC_CONST(0.9999876022316609),
+ FRAC_CONST(0.9999885094069193),
+ FRAC_CONST(0.9999893649274085),
+ FRAC_CONST(0.9999901710338274),
+ FRAC_CONST(0.9999909298948430),
+ FRAC_CONST(0.9999916436086862),
+ FRAC_CONST(0.9999923142047299),
+ FRAC_CONST(0.9999929436450469),
+ FRAC_CONST(0.9999935338259505),
+ FRAC_CONST(0.9999940865795161),
+ FRAC_CONST(0.9999946036750835),
+ FRAC_CONST(0.9999950868207405),
+ FRAC_CONST(0.9999955376647868),
+ FRAC_CONST(0.9999959577971798),
+ FRAC_CONST(0.9999963487509599),
+ FRAC_CONST(0.9999967120036571),
+ FRAC_CONST(0.9999970489786785),
+ FRAC_CONST(0.9999973610466748),
+ FRAC_CONST(0.9999976495268890),
+ FRAC_CONST(0.9999979156884846),
+ FRAC_CONST(0.9999981607518545),
+ FRAC_CONST(0.9999983858899099),
+ FRAC_CONST(0.9999985922293493),
+ FRAC_CONST(0.9999987808519092),
+ FRAC_CONST(0.9999989527955938),
+ FRAC_CONST(0.9999991090558848),
+ FRAC_CONST(0.9999992505869332),
+ FRAC_CONST(0.9999993783027293),
+ FRAC_CONST(0.9999994930782556),
+ FRAC_CONST(0.9999995957506171),
+ FRAC_CONST(0.9999996871201549),
+ FRAC_CONST(0.9999997679515386),
+ FRAC_CONST(0.9999998389748399),
+ FRAC_CONST(0.9999999008865869),
+ FRAC_CONST(0.9999999543507984)
+};
+#endif
+
+ALIGN static const real_t kbd_short_128[] =
+{
+ FRAC_CONST(4.3795702929468881e-005),
+ FRAC_CONST(0.00011867384265436617),
+ FRAC_CONST(0.0002307165763996192),
+ FRAC_CONST(0.00038947282760568383),
+ FRAC_CONST(0.00060581272288302553),
+ FRAC_CONST(0.00089199695169487453),
+ FRAC_CONST(0.0012617254423430522),
+ FRAC_CONST(0.0017301724373162003),
+ FRAC_CONST(0.0023140071937421476),
+ FRAC_CONST(0.0030313989666022221),
+ FRAC_CONST(0.0039020049735530842),
+ FRAC_CONST(0.0049469401815512024),
+ FRAC_CONST(0.0061887279335368318),
+ FRAC_CONST(0.0076512306364647726),
+ FRAC_CONST(0.0093595599562652423),
+ FRAC_CONST(0.011339966208377799),
+ FRAC_CONST(0.013619706891715299),
+ FRAC_CONST(0.016226894586323766),
+ FRAC_CONST(0.019190324717288168),
+ FRAC_CONST(0.022539283975960878),
+ FRAC_CONST(0.026303340480472455),
+ FRAC_CONST(0.030512117046644357),
+ FRAC_CONST(0.03519504922365594),
+ FRAC_CONST(0.040381130021856941),
+ FRAC_CONST(0.046098643518702249),
+ FRAC_CONST(0.052374889768730587),
+ FRAC_CONST(0.059235903660769147),
+ FRAC_CONST(0.066706170556282418),
+ FRAC_CONST(0.074808341703430481),
+ FRAC_CONST(0.083562952548726227),
+ FRAC_CONST(0.092988147159339674),
+ FRAC_CONST(0.1030994120216919),
+ FRAC_CONST(0.11390932249409955),
+ FRAC_CONST(0.12542730516149531),
+ FRAC_CONST(0.13765941926783826),
+ FRAC_CONST(0.15060816028651081),
+ FRAC_CONST(0.16427228853114245),
+ FRAC_CONST(0.17864668550988483),
+ FRAC_CONST(0.19372224048676889),
+ FRAC_CONST(0.20948576943658073),
+ FRAC_CONST(0.22591996826744942),
+ FRAC_CONST(0.24300340184133981),
+ FRAC_CONST(0.26071052995068139),
+ FRAC_CONST(0.27901177101369551),
+ FRAC_CONST(0.29787360383626599),
+ FRAC_CONST(0.3172587073594233),
+ FRAC_CONST(0.33712613787396362),
+ FRAC_CONST(0.35743154274286698),
+ FRAC_CONST(0.37812740923363009),
+ FRAC_CONST(0.39916334663203618),
+ FRAC_CONST(0.42048639939189658),
+ FRAC_CONST(0.4420413886774246),
+ FRAC_CONST(0.4637712792815169),
+ FRAC_CONST(0.4856175685594023),
+ FRAC_CONST(0.50752069370766872),
+ FRAC_CONST(0.52942045344797806),
+ FRAC_CONST(0.55125643994680196),
+ FRAC_CONST(0.57296847662071559),
+ FRAC_CONST(0.59449705734411495),
+ FRAC_CONST(0.61578378249506627),
+ FRAC_CONST(0.63677178724712891),
+ FRAC_CONST(0.65740615754163356),
+ FRAC_CONST(0.67763432925662526),
+ FRAC_CONST(0.69740646622548552),
+ FRAC_CONST(0.71667581294953808),
+ FRAC_CONST(0.73539901809352737),
+ FRAC_CONST(0.75353642514900732),
+ FRAC_CONST(0.77105232699609816),
+ FRAC_CONST(0.78791518148597028),
+ FRAC_CONST(0.80409778560147072),
+ FRAC_CONST(0.81957740622770781),
+ FRAC_CONST(0.83433586607383625),
+ FRAC_CONST(0.84835958382689225),
+ FRAC_CONST(0.86163956818294229),
+ FRAC_CONST(0.87417136598406997),
+ FRAC_CONST(0.88595496528524853),
+ FRAC_CONST(0.89699465477567619),
+ FRAC_CONST(0.90729884157670959),
+ FRAC_CONST(0.91687983002436779),
+ FRAC_CONST(0.92575356460899649),
+ FRAC_CONST(0.93393934077779084),
+ FRAC_CONST(0.94145948779657318),
+ FRAC_CONST(0.94833902830402828),
+ FRAC_CONST(0.95460531956280026),
+ FRAC_CONST(0.96028768170574896),
+ FRAC_CONST(0.96541701848104766),
+ FRAC_CONST(0.97002543610646474),
+ FRAC_CONST(0.97414586584250062),
+ FRAC_CONST(0.97781169577969584),
+ FRAC_CONST(0.98105641710392333),
+ FRAC_CONST(0.98391328975491177),
+ FRAC_CONST(0.98641503193166202),
+ FRAC_CONST(0.98859353733226141),
+ FRAC_CONST(0.99047962335771556),
+ FRAC_CONST(0.9921028127769449),
+ FRAC_CONST(0.99349115056397752),
+ FRAC_CONST(0.99467105680259038),
+ FRAC_CONST(0.9956672157341897),
+ FRAC_CONST(0.99650250022834352),
+ FRAC_CONST(0.99719793020823266),
+ FRAC_CONST(0.99777266288955657),
+ FRAC_CONST(0.99824401211201486),
+ FRAC_CONST(0.99862749357391212),
+ FRAC_CONST(0.99893689243401962),
+ FRAC_CONST(0.99918434952623147),
+ FRAC_CONST(0.99938046234161726),
+ FRAC_CONST(0.99953439696357238),
+ FRAC_CONST(0.99965400728430465),
+ FRAC_CONST(0.99974595807027455),
+ FRAC_CONST(0.99981584876278362),
+ FRAC_CONST(0.99986833527824281),
+ FRAC_CONST(0.99990724749057802),
+ FRAC_CONST(0.99993570051598468),
+ FRAC_CONST(0.99995619835942084),
+ FRAC_CONST(0.99997072890647543),
+ FRAC_CONST(0.9999808496399144),
+ FRAC_CONST(0.99998776381655818),
+ FRAC_CONST(0.99999238714961569),
+ FRAC_CONST(0.99999540529959718),
+ FRAC_CONST(0.99999732268176988),
+ FRAC_CONST(0.99999850325054862),
+ FRAC_CONST(0.99999920402413744),
+ FRAC_CONST(0.9999996021706401),
+ FRAC_CONST(0.99999981649545566),
+ FRAC_CONST(0.99999992415545547),
+ FRAC_CONST(0.99999997338493041),
+ FRAC_CONST(0.99999999295825959),
+ FRAC_CONST(0.99999999904096815)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ALIGN static const real_t kbd_short_120[] =
+{
+ FRAC_CONST(0.0000452320086910),
+ FRAC_CONST(0.0001274564692111),
+ FRAC_CONST(0.0002529398385345),
+ FRAC_CONST(0.0004335140496648),
+ FRAC_CONST(0.0006827100966952),
+ FRAC_CONST(0.0010158708222246),
+ FRAC_CONST(0.0014502162869659),
+ FRAC_CONST(0.0020048865156264),
+ FRAC_CONST(0.0027009618393178),
+ FRAC_CONST(0.0035614590925043),
+ FRAC_CONST(0.0046113018122711),
+ FRAC_CONST(0.0058772627936484),
+ FRAC_CONST(0.0073878776584103),
+ FRAC_CONST(0.0091733284512589),
+ FRAC_CONST(0.0112652966728373),
+ FRAC_CONST(0.0136967855861945),
+ FRAC_CONST(0.0165019120857793),
+ FRAC_CONST(0.0197156688892217),
+ FRAC_CONST(0.0233736582950619),
+ FRAC_CONST(0.0275117992367496),
+ FRAC_CONST(0.0321660098468534),
+ FRAC_CONST(0.0373718682174417),
+ FRAC_CONST(0.0431642544948834),
+ FRAC_CONST(0.0495769778717676),
+ FRAC_CONST(0.0566423924273392),
+ FRAC_CONST(0.0643910061132260),
+ FRAC_CONST(0.0728510874761729),
+ FRAC_CONST(0.0820482749475221),
+ FRAC_CONST(0.0920051937045235),
+ FRAC_CONST(0.1027410852163450),
+ FRAC_CONST(0.1142714546239370),
+ FRAC_CONST(0.1266077410648368),
+ FRAC_CONST(0.1397570159398145),
+ FRAC_CONST(0.1537217139274270),
+ FRAC_CONST(0.1684994012857075),
+ FRAC_CONST(0.1840825856392944),
+ FRAC_CONST(0.2004585710384133),
+ FRAC_CONST(0.2176093615976121),
+ FRAC_CONST(0.2355116164824983),
+ FRAC_CONST(0.2541366584185075),
+ FRAC_CONST(0.2734505372545160),
+ FRAC_CONST(0.2934141494343369),
+ FRAC_CONST(0.3139834135200387),
+ FRAC_CONST(0.3351095011824163),
+ FRAC_CONST(0.3567391223361566),
+ FRAC_CONST(0.3788148623608774),
+ FRAC_CONST(0.4012755686250732),
+ FRAC_CONST(0.4240567828288110),
+ FRAC_CONST(0.4470912150133537),
+ FRAC_CONST(0.4703092544619664),
+ FRAC_CONST(0.4936395121456694),
+ FRAC_CONST(0.5170093888596962),
+ FRAC_CONST(0.5403456627591340),
+ FRAC_CONST(0.5635750896430154),
+ FRAC_CONST(0.5866250090612892),
+ FRAC_CONST(0.6094239491338723),
+ FRAC_CONST(0.6319022228794100),
+ FRAC_CONST(0.6539925088563087),
+ FRAC_CONST(0.6756304090216887),
+ FRAC_CONST(0.6967549769155277),
+ FRAC_CONST(0.7173092095766250),
+ FRAC_CONST(0.7372404969921184),
+ FRAC_CONST(0.7565010233699827),
+ FRAC_CONST(0.7750481150999984),
+ FRAC_CONST(0.7928445309277697),
+ FRAC_CONST(0.8098586906021583),
+ FRAC_CONST(0.8260648390616000),
+ FRAC_CONST(0.8414431440907889),
+ FRAC_CONST(0.8559797262966709),
+ FRAC_CONST(0.8696666212110165),
+ FRAC_CONST(0.8825016743142358),
+ FRAC_CONST(0.8944883707784486),
+ FRAC_CONST(0.9056356027326216),
+ FRAC_CONST(0.9159573778427816),
+ FRAC_CONST(0.9254724739583072),
+ FRAC_CONST(0.9342040454819434),
+ FRAC_CONST(0.9421791879559176),
+ FRAC_CONST(0.9494284680976784),
+ FRAC_CONST(0.9559854271440150),
+ FRAC_CONST(0.9618860658493898),
+ FRAC_CONST(0.9671683198119525),
+ FRAC_CONST(0.9718715339497299),
+ FRAC_CONST(0.9760359449042233),
+ FRAC_CONST(0.9797021798981759),
+ FRAC_CONST(0.9829107801140203),
+ FRAC_CONST(0.9857017559923277),
+ FRAC_CONST(0.9881141809867999),
+ FRAC_CONST(0.9901858292742826),
+ FRAC_CONST(0.9919528617340944),
+ FRAC_CONST(0.9934495632180476),
+ FRAC_CONST(0.9947081327749199),
+ FRAC_CONST(0.9957585271195989),
+ FRAC_CONST(0.9966283562984427),
+ FRAC_CONST(0.9973428292485683),
+ FRAC_CONST(0.9979247458259197),
+ FRAC_CONST(0.9983945309245774),
+ FRAC_CONST(0.9987703055583410),
+ FRAC_CONST(0.9990679892449266),
+ FRAC_CONST(0.9993014277313617),
+ FRAC_CONST(0.9994825400228521),
+ FRAC_CONST(0.9996214788122335),
+ FRAC_CONST(0.9997267987294857),
+ FRAC_CONST(0.9998056273097539),
+ FRAC_CONST(0.9998638341781910),
+ FRAC_CONST(0.9999061946325793),
+ FRAC_CONST(0.9999365445321382),
+ FRAC_CONST(0.9999579241373735),
+ FRAC_CONST(0.9999727092594598),
+ FRAC_CONST(0.9999827287418790),
+ FRAC_CONST(0.9999893678912771),
+ FRAC_CONST(0.9999936579844555),
+ FRAC_CONST(0.9999963523959187),
+ FRAC_CONST(0.9999979902130101),
+ FRAC_CONST(0.9999989484358076),
+ FRAC_CONST(0.9999994840031031),
+ FRAC_CONST(0.9999997669534347),
+ FRAC_CONST(0.9999999060327799),
+ FRAC_CONST(0.9999999680107184),
+ FRAC_CONST(0.9999999918774242),
+ FRAC_CONST(0.9999999989770326)
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad.vcproj b/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad.vcproj
new file mode 100644
index 000000000..21c55c52a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad.vcproj
@@ -0,0 +1,1020 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="libfaad"
+ ProjectGUID="{5EFCFACB-1835-422C-ACDA-E3B3A2F51387}"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="NDEBUG;WIN32;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/libfaad.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ Detect64BitPortabilityProblems="TRUE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalOptions=""
+ OutputFile="..\..\..\..\..\..\lib\libfaad2R.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions="_DEBUG;WIN32;_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/libfaad.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalOptions=""
+ OutputFile="..\..\..\..\..\..\lib\libfaad2D.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="bits.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="cfft.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="common.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="decoder.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="drc.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="error.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="filtbank.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hcr.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="huffman.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ic_predict.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="is.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="lt_predict.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="mdct.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="mp4.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ms.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="output.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="pns.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ps_dec.c">
+ </File>
+ <File
+ RelativePath=".\ps_syntax.c">
+ </File>
+ <File
+ RelativePath="pulse.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="rvlc.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_dct.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_dec.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_e_nf.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_fbt.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_hfadj.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_hfgen.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_huff.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_qmf.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_syntax.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_tf_grid.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="specrec.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ssr.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ssr_fb.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ssr_ipqf.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="syntax.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="tns.c">
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath="analysis.h">
+ </File>
+ <File
+ RelativePath="bits.h">
+ </File>
+ <File
+ RelativePath="cfft.h">
+ </File>
+ <File
+ RelativePath="cfft_tab.h">
+ </File>
+ <File
+ RelativePath="common.h">
+ </File>
+ <File
+ RelativePath="decoder.h">
+ </File>
+ <File
+ RelativePath="drc.h">
+ </File>
+ <File
+ RelativePath="error.h">
+ </File>
+ <File
+ RelativePath="filtbank.h">
+ </File>
+ <File
+ RelativePath="fixed.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb.h">
+ </File>
+ <File
+ RelativePath="huffman.h">
+ </File>
+ <File
+ RelativePath="ic_predict.h">
+ </File>
+ <File
+ RelativePath="iq_table.h">
+ </File>
+ <File
+ RelativePath="is.h">
+ </File>
+ <File
+ RelativePath="kbd_win.h">
+ </File>
+ <File
+ RelativePath="lt_predict.h">
+ </File>
+ <File
+ RelativePath="mdct.h">
+ </File>
+ <File
+ RelativePath="mp4.h">
+ </File>
+ <File
+ RelativePath="ms.h">
+ </File>
+ <File
+ RelativePath="output.h">
+ </File>
+ <File
+ RelativePath="pns.h">
+ </File>
+ <File
+ RelativePath=".\ps_dec.h">
+ </File>
+ <File
+ RelativePath="pulse.h">
+ </File>
+ <File
+ RelativePath="rvlc.h">
+ </File>
+ <File
+ RelativePath="sbr_dct.h">
+ </File>
+ <File
+ RelativePath="sbr_dec.h">
+ </File>
+ <File
+ RelativePath="sbr_e_nf.h">
+ </File>
+ <File
+ RelativePath="sbr_fbt.h">
+ </File>
+ <File
+ RelativePath="sbr_hfadj.h">
+ </File>
+ <File
+ RelativePath="sbr_hfgen.h">
+ </File>
+ <File
+ RelativePath="sbr_huff.h">
+ </File>
+ <File
+ RelativePath="sbr_noise.h">
+ </File>
+ <File
+ RelativePath="sbr_qmf.h">
+ </File>
+ <File
+ RelativePath=".\sbr_qmf_c.h">
+ </File>
+ <File
+ RelativePath="sbr_syntax.h">
+ </File>
+ <File
+ RelativePath="sbr_tf_grid.h">
+ </File>
+ <File
+ RelativePath="sine_win.h">
+ </File>
+ <File
+ RelativePath="specrec.h">
+ </File>
+ <File
+ RelativePath="ssr.h">
+ </File>
+ <File
+ RelativePath=".\ssr_fb.h">
+ </File>
+ <File
+ RelativePath=".\ssr_ipqf.h">
+ </File>
+ <File
+ RelativePath=".\ssr_win.h">
+ </File>
+ <File
+ RelativePath="structs.h">
+ </File>
+ <File
+ RelativePath="syntax.h">
+ </File>
+ <File
+ RelativePath="tns.h">
+ </File>
+ <Filter
+ Name="codebook"
+ Filter="">
+ <File
+ RelativePath="codebook\hcb_1.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_10.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_11.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_2.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_3.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_4.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_5.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_6.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_7.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_8.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_9.h">
+ </File>
+ <File
+ RelativePath="codebook\hcb_sf.h">
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad_vs2005.vcproj b/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad_vs2005.vcproj
new file mode 100644
index 000000000..66e926d8f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad_vs2005.vcproj
@@ -0,0 +1,1321 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="libfaad"
+ ProjectGUID="{5EFCFACB-1835-422C-ACDA-E3B3A2F51387}"
+ RootNamespace="libfaad"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="NDEBUG;WIN32;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/libfaad.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ Detect64BitPortabilityProblems="true"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalOptions=""
+ OutputFile="..\..\..\..\..\..\lib\libfaad2R.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions="_DEBUG;WIN32;_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\Debug/libfaad.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1043"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalOptions=""
+ OutputFile="..\..\..\..\..\..\lib\libfaad2D.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="bits.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="cfft.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="common.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="decoder.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="drc.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\drm_dec.c"
+ >
+ </File>
+ <File
+ RelativePath="error.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="filtbank.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="hcr.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="huffman.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ic_predict.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="is.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="lt_predict.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="mdct.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="mp4.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ms.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="output.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="pns.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\ps_dec.c"
+ >
+ </File>
+ <File
+ RelativePath=".\ps_syntax.c"
+ >
+ </File>
+ <File
+ RelativePath="pulse.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="rvlc.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_dct.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_dec.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_e_nf.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_fbt.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_hfadj.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_hfgen.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_huff.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_qmf.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_syntax.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="sbr_tf_grid.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="specrec.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ssr.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ssr_fb.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="ssr_ipqf.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="syntax.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="tns.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="2"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions=""
+ Optimization="0"
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="analysis.h"
+ >
+ </File>
+ <File
+ RelativePath="bits.h"
+ >
+ </File>
+ <File
+ RelativePath="cfft.h"
+ >
+ </File>
+ <File
+ RelativePath="cfft_tab.h"
+ >
+ </File>
+ <File
+ RelativePath="common.h"
+ >
+ </File>
+ <File
+ RelativePath="decoder.h"
+ >
+ </File>
+ <File
+ RelativePath="drc.h"
+ >
+ </File>
+ <File
+ RelativePath=".\drm_dec.h"
+ >
+ </File>
+ <File
+ RelativePath="error.h"
+ >
+ </File>
+ <File
+ RelativePath="filtbank.h"
+ >
+ </File>
+ <File
+ RelativePath="fixed.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb.h"
+ >
+ </File>
+ <File
+ RelativePath="huffman.h"
+ >
+ </File>
+ <File
+ RelativePath="ic_predict.h"
+ >
+ </File>
+ <File
+ RelativePath="iq_table.h"
+ >
+ </File>
+ <File
+ RelativePath="is.h"
+ >
+ </File>
+ <File
+ RelativePath="kbd_win.h"
+ >
+ </File>
+ <File
+ RelativePath="lt_predict.h"
+ >
+ </File>
+ <File
+ RelativePath="mdct.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mdct_tab.h"
+ >
+ </File>
+ <File
+ RelativePath="mp4.h"
+ >
+ </File>
+ <File
+ RelativePath="ms.h"
+ >
+ </File>
+ <File
+ RelativePath="output.h"
+ >
+ </File>
+ <File
+ RelativePath="pns.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ps_dec.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ps_tables.h"
+ >
+ </File>
+ <File
+ RelativePath="pulse.h"
+ >
+ </File>
+ <File
+ RelativePath="rvlc.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_dct.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_dec.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_e_nf.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_fbt.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_hfadj.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_hfgen.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_huff.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_noise.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_qmf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\sbr_qmf_c.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_syntax.h"
+ >
+ </File>
+ <File
+ RelativePath="sbr_tf_grid.h"
+ >
+ </File>
+ <File
+ RelativePath="sine_win.h"
+ >
+ </File>
+ <File
+ RelativePath="specrec.h"
+ >
+ </File>
+ <File
+ RelativePath="ssr.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssr_fb.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssr_ipqf.h"
+ >
+ </File>
+ <File
+ RelativePath=".\ssr_win.h"
+ >
+ </File>
+ <File
+ RelativePath="structs.h"
+ >
+ </File>
+ <File
+ RelativePath="syntax.h"
+ >
+ </File>
+ <File
+ RelativePath="tns.h"
+ >
+ </File>
+ <Filter
+ Name="codebook"
+ >
+ <File
+ RelativePath="codebook\hcb_1.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_10.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_11.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_2.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_3.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_4.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_5.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_6.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_7.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_8.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_9.h"
+ >
+ </File>
+ <File
+ RelativePath="codebook\hcb_sf.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..7b776b583
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/libfaad_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/lt_predict.c b/src/filters/transform/mpadecfilter/faad2/libfaad/lt_predict.c
new file mode 100644
index 000000000..9fd8c69d7
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/lt_predict.c
@@ -0,0 +1,217 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: lt_predict.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef LTP_DEC
+
+#include <stdlib.h>
+#include "syntax.h"
+#include "lt_predict.h"
+#include "filtbank.h"
+#include "tns.h"
+
+
+/* static function declarations */
+static int16_t real_to_int16(real_t sig_in);
+
+
+/* check if the object type is an object type that can have LTP */
+uint8_t is_ltp_ot(uint8_t object_type)
+{
+#ifdef LTP_DEC
+ if ((object_type == LTP)
+#ifdef ERROR_RESILIENCE
+ || (object_type == ER_LTP)
+#endif
+#ifdef LD_DEC
+ || (object_type == LD)
+#endif
+ )
+ {
+ return 1;
+ }
+#endif
+
+ return 0;
+}
+
+ALIGN static const real_t codebook[8] =
+{
+ REAL_CONST(0.570829),
+ REAL_CONST(0.696616),
+ REAL_CONST(0.813004),
+ REAL_CONST(0.911304),
+ REAL_CONST(0.984900),
+ REAL_CONST(1.067894),
+ REAL_CONST(1.194601),
+ REAL_CONST(1.369533)
+};
+
+void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
+ int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape,
+ uint8_t win_shape_prev, uint8_t sr_index,
+ uint8_t object_type, uint16_t frame_len)
+{
+ uint8_t sfb;
+ uint16_t bin, i, num_samples;
+ ALIGN real_t x_est[2048];
+ ALIGN real_t X_est[2048];
+
+ if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+ {
+ if (ltp->data_present)
+ {
+ num_samples = frame_len << 1;
+
+ for(i = 0; i < num_samples; i++)
+ {
+ /* The extra lookback M (N/2 for LD, 0 for LTP) is handled
+ in the buffer updating */
+
+#if 0
+ x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag],
+ codebook[ltp->coef]);
+#else
+ /* lt_pred_stat is a 16 bit int, multiplied with the fixed point real
+ this gives a real for x_est
+ */
+ x_est[i] = (real_t)lt_pred_stat[num_samples + i - ltp->lag] * codebook[ltp->coef];
+#endif
+ }
+
+ filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev,
+ x_est, X_est, object_type, frame_len);
+
+ tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est,
+ frame_len);
+
+ for (sfb = 0; sfb < ltp->last_band; sfb++)
+ {
+ if (ltp->long_used[sfb])
+ {
+ uint16_t low = ics->swb_offset[sfb];
+ uint16_t high = ics->swb_offset[sfb+1];
+
+ for (bin = low; bin < high; bin++)
+ {
+ spec[bin] += X_est[bin];
+ }
+ }
+ }
+ }
+ }
+}
+
+#ifdef FIXED_POINT
+static INLINE int16_t real_to_int16(real_t sig_in)
+{
+ if (sig_in >= 0)
+ {
+ sig_in += (1 << (REAL_BITS-1));
+ if (sig_in >= REAL_CONST(32768))
+ return 32767;
+ } else {
+ sig_in += -(1 << (REAL_BITS-1));
+ if (sig_in <= REAL_CONST(-32768))
+ return -32768;
+ }
+
+ return (sig_in >> REAL_BITS);
+}
+#else
+static INLINE int16_t real_to_int16(real_t sig_in)
+{
+ if (sig_in >= 0)
+ {
+#ifndef HAS_LRINTF
+ sig_in += 0.5f;
+#endif
+ if (sig_in >= 32768.0f)
+ return 32767;
+ } else {
+#ifndef HAS_LRINTF
+ sig_in += -0.5f;
+#endif
+ if (sig_in <= -32768.0f)
+ return -32768;
+ }
+
+ return lrintf(sig_in);
+}
+#endif
+
+void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap,
+ uint16_t frame_len, uint8_t object_type)
+{
+ uint16_t i;
+
+ /*
+ * The reference point for index i and the content of the buffer
+ * lt_pred_stat are arranged so that lt_pred_stat(0 ... N/2 - 1) contains the
+ * last aliased half window from the IMDCT, and lt_pred_stat(N/2 ... N-1)
+ * is always all zeros. The rest of lt_pred_stat (i<0) contains the previous
+ * fully reconstructed time domain samples, i.e., output of the decoder.
+ *
+ * These values are shifted up by N*2 to avoid (i<0)
+ *
+ * For the LD object type an extra 512 samples lookback is accomodated here.
+ */
+#ifdef LD_DEC
+ if (object_type == LD)
+ {
+ for (i = 0; i < frame_len; i++)
+ {
+ lt_pred_stat[i] /* extra 512 */ = lt_pred_stat[i + frame_len];
+ lt_pred_stat[frame_len + i] = lt_pred_stat[i + (frame_len * 2)];
+ lt_pred_stat[(frame_len * 2) + i] = real_to_int16(time[i]);
+ lt_pred_stat[(frame_len * 3) + i] = real_to_int16(overlap[i]);
+ }
+ } else {
+#endif
+ for (i = 0; i < frame_len; i++)
+ {
+ lt_pred_stat[i] = lt_pred_stat[i + frame_len];
+ lt_pred_stat[frame_len + i] = real_to_int16(time[i]);
+ lt_pred_stat[(frame_len * 2) + i] = real_to_int16(overlap[i]);
+#if 0 /* set to zero once upon initialisation */
+ lt_pred_stat[(frame_len * 3) + i] = 0;
+#endif
+ }
+#ifdef LD_DEC
+ }
+#endif
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/lt_predict.h b/src/filters/transform/mpadecfilter/faad2/libfaad/lt_predict.h
new file mode 100644
index 000000000..88b6730c0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/lt_predict.h
@@ -0,0 +1,68 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: lt_predict.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifdef LTP_DEC
+
+#ifndef __LT_PREDICT_H__
+#define __LT_PREDICT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "filtbank.h"
+
+uint8_t is_ltp_ot(uint8_t object_type);
+
+void lt_prediction(ic_stream *ics,
+ ltp_info *ltp,
+ real_t *spec,
+ int16_t *lt_pred_stat,
+ fb_info *fb,
+ uint8_t win_shape,
+ uint8_t win_shape_prev,
+ uint8_t sr_index,
+ uint8_t object_type,
+ uint16_t frame_len);
+
+void lt_update_state(int16_t *lt_pred_stat,
+ real_t *time,
+ real_t *overlap,
+ uint16_t frame_len,
+ uint8_t object_type);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/mdct.c b/src/filters/transform/mpadecfilter/faad2/libfaad/mdct.c
new file mode 100644
index 000000000..a5e076e4b
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/mdct.c
@@ -0,0 +1,303 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: mdct.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/*
+ * Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform)
+ * and consists of three steps: pre-(I)FFT complex multiplication, complex
+ * (I)FFT, post-(I)FFT complex multiplication,
+ *
+ * As described in:
+ * P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the
+ * Implementation of Filter Banks Based on 'Time Domain Aliasing
+ * Cancellation’," IEEE Proc. on ICASSP‘91, 1991, pp. 2209-2212.
+ *
+ *
+ * As of April 6th 2002 completely rewritten.
+ * This (I)MDCT can now be used for any data size n, where n is divisible by 8.
+ *
+ */
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#ifdef _WIN32_WCE
+#define assert(x)
+#else
+#include <assert.h>
+#endif
+
+#include "cfft.h"
+#include "mdct.h"
+#include "mdct_tab.h"
+
+
+mdct_info *faad_mdct_init(uint16_t N)
+{
+ mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info));
+
+ assert(N % 8 == 0);
+
+ mdct->N = N;
+
+ /* NOTE: For "small framelengths" in FIXED_POINT the coefficients need to be
+ * scaled by sqrt("(nearest power of 2) > N" / N) */
+
+ /* RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
+ * IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N)); */
+ /* scale is 1 for fixed point, sqrt(N) for floating point */
+ switch (N)
+ {
+ case 2048: mdct->sincos = (complex_t*)mdct_tab_2048; break;
+ case 256: mdct->sincos = (complex_t*)mdct_tab_256; break;
+#ifdef LD_DEC
+ case 1024: mdct->sincos = (complex_t*)mdct_tab_1024; break;
+#endif
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ case 1920: mdct->sincos = (complex_t*)mdct_tab_1920; break;
+ case 240: mdct->sincos = (complex_t*)mdct_tab_240; break;
+#ifdef LD_DEC
+ case 960: mdct->sincos = (complex_t*)mdct_tab_960; break;
+#endif
+#endif
+#ifdef SSR_DEC
+ case 512: mdct->sincos = (complex_t*)mdct_tab_512; break;
+ case 64: mdct->sincos = (complex_t*)mdct_tab_64; break;
+#endif
+ }
+
+ /* initialise fft */
+ mdct->cfft = cffti(N/4);
+
+#ifdef PROFILE
+ mdct->cycles = 0;
+ mdct->fft_cycles = 0;
+#endif
+
+ return mdct;
+}
+
+void faad_mdct_end(mdct_info *mdct)
+{
+ if (mdct != NULL)
+ {
+#ifdef PROFILE
+ printf("MDCT[%.4d]: %I64d cycles\n", mdct->N, mdct->cycles);
+ printf("CFFT[%.4d]: %I64d cycles\n", mdct->N/4, mdct->fft_cycles);
+#endif
+
+ cfftu(mdct->cfft);
+
+ faad_free(mdct);
+ }
+}
+
+void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
+{
+ uint16_t k;
+
+ complex_t x;
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+ real_t scale, b_scale = 0;
+#endif
+#endif
+ ALIGN complex_t Z1[512];
+ complex_t *sincos = mdct->sincos;
+
+ uint16_t N = mdct->N;
+ uint16_t N2 = N >> 1;
+ uint16_t N4 = N >> 2;
+ uint16_t N8 = N >> 3;
+
+#ifdef PROFILE
+ int64_t count1, count2 = faad_get_ts();
+#endif
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+ /* detect non-power of 2 */
+ if (N & (N-1))
+ {
+ /* adjust scale for non-power of 2 MDCT */
+ /* 2048/1920 */
+ b_scale = 1;
+ scale = COEF_CONST(1.0666666666666667);
+ }
+#endif
+#endif
+
+ /* pre-IFFT complex multiplication */
+ for (k = 0; k < N4; k++)
+ {
+ ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
+ X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k]));
+ }
+
+#ifdef PROFILE
+ count1 = faad_get_ts();
+#endif
+
+ /* complex IFFT, any non-scaling FFT can be used here */
+ cfftb(mdct->cfft, Z1);
+
+#ifdef PROFILE
+ count1 = faad_get_ts() - count1;
+#endif
+
+ /* post-IFFT complex multiplication */
+ for (k = 0; k < N4; k++)
+ {
+ RE(x) = RE(Z1[k]);
+ IM(x) = IM(Z1[k]);
+ ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
+ IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+ /* non-power of 2 MDCT scaling */
+ if (b_scale)
+ {
+ RE(Z1[k]) = MUL_C(RE(Z1[k]), scale);
+ IM(Z1[k]) = MUL_C(IM(Z1[k]), scale);
+ }
+#endif
+#endif
+ }
+
+ /* reordering */
+ for (k = 0; k < N8; k+=2)
+ {
+ X_out[ 2*k] = IM(Z1[N8 + k]);
+ X_out[ 2 + 2*k] = IM(Z1[N8 + 1 + k]);
+
+ X_out[ 1 + 2*k] = -RE(Z1[N8 - 1 - k]);
+ X_out[ 3 + 2*k] = -RE(Z1[N8 - 2 - k]);
+
+ X_out[N4 + 2*k] = RE(Z1[ k]);
+ X_out[N4 + + 2 + 2*k] = RE(Z1[ 1 + k]);
+
+ X_out[N4 + 1 + 2*k] = -IM(Z1[N4 - 1 - k]);
+ X_out[N4 + 3 + 2*k] = -IM(Z1[N4 - 2 - k]);
+
+ X_out[N2 + 2*k] = RE(Z1[N8 + k]);
+ X_out[N2 + + 2 + 2*k] = RE(Z1[N8 + 1 + k]);
+
+ X_out[N2 + 1 + 2*k] = -IM(Z1[N8 - 1 - k]);
+ X_out[N2 + 3 + 2*k] = -IM(Z1[N8 - 2 - k]);
+
+ X_out[N2 + N4 + 2*k] = -IM(Z1[ k]);
+ X_out[N2 + N4 + 2 + 2*k] = -IM(Z1[ 1 + k]);
+
+ X_out[N2 + N4 + 1 + 2*k] = RE(Z1[N4 - 1 - k]);
+ X_out[N2 + N4 + 3 + 2*k] = RE(Z1[N4 - 2 - k]);
+ }
+
+#ifdef PROFILE
+ count2 = faad_get_ts() - count2;
+ mdct->fft_cycles += count1;
+ mdct->cycles += (count2 - count1);
+#endif
+}
+
+#ifdef LTP_DEC
+void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
+{
+ uint16_t k;
+
+ complex_t x;
+ ALIGN complex_t Z1[512];
+ complex_t *sincos = mdct->sincos;
+
+ uint16_t N = mdct->N;
+ uint16_t N2 = N >> 1;
+ uint16_t N4 = N >> 2;
+ uint16_t N8 = N >> 3;
+
+#ifndef FIXED_POINT
+ real_t scale = REAL_CONST(N);
+#else
+ real_t scale = REAL_CONST(4.0/N);
+#endif
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+#ifdef FIXED_POINT
+ /* detect non-power of 2 */
+ if (N & (N-1))
+ {
+ /* adjust scale for non-power of 2 MDCT */
+ /* *= sqrt(2048/1920) */
+ scale = MUL_C(scale, COEF_CONST(1.0327955589886444));
+ }
+#endif
+#endif
+
+ /* pre-FFT complex multiplication */
+ for (k = 0; k < N8; k++)
+ {
+ uint16_t n = k << 1;
+ RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n];
+ IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n];
+
+ ComplexMult(&RE(Z1[k]), &IM(Z1[k]),
+ RE(x), IM(x), RE(sincos[k]), IM(sincos[k]));
+
+ RE(Z1[k]) = MUL_R(RE(Z1[k]), scale);
+ IM(Z1[k]) = MUL_R(IM(Z1[k]), scale);
+
+ RE(x) = X_in[N2 - 1 - n] - X_in[ n];
+ IM(x) = X_in[N2 + n] + X_in[N - 1 - n];
+
+ ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]),
+ RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8]));
+
+ RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale);
+ IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale);
+ }
+
+ /* complex FFT, any non-scaling FFT can be used here */
+ cfftf(mdct->cfft, Z1);
+
+ /* post-FFT complex multiplication */
+ for (k = 0; k < N4; k++)
+ {
+ uint16_t n = k << 1;
+ ComplexMult(&RE(x), &IM(x),
+ RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k]));
+
+ X_out[ n] = -RE(x);
+ X_out[N2 - 1 - n] = IM(x);
+ X_out[N2 + n] = -IM(x);
+ X_out[N - 1 - n] = RE(x);
+ }
+}
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/mdct.h b/src/filters/transform/mpadecfilter/faad2/libfaad/mdct.h
new file mode 100644
index 000000000..41120354a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/mdct.h
@@ -0,0 +1,50 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: mdct.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __MDCT_H__
+#define __MDCT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+mdct_info *faad_mdct_init(uint16_t N);
+void faad_mdct_end(mdct_info *mdct);
+void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
+void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/mdct_tab.h b/src/filters/transform/mpadecfilter/faad2/libfaad/mdct_tab.h
new file mode 100644
index 000000000..b337b42d1
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/mdct_tab.h
@@ -0,0 +1,3657 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: mdct_tab.h 446 2005-11-06 10:54:47Z gabest $
+**/
+
+#ifndef __MDCT_TAB_H__
+#define __MDCT_TAB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef FIXED_POINT
+
+/* 256 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_2048[] =
+{
+ { FRAC_CONST(0.999999926465718), FRAC_CONST(0.000383495187571) },
+ { FRAC_CONST(0.999994043728986), FRAC_CONST(0.003451449920136) },
+ { FRAC_CONST(0.999978748667469), FRAC_CONST(0.006519372166339) },
+ { FRAC_CONST(0.999954041425130), FRAC_CONST(0.009587233049729) },
+ { FRAC_CONST(0.999919922234523), FRAC_CONST(0.012655003694430) },
+ { FRAC_CONST(0.999876391416790), FRAC_CONST(0.015722655225417) },
+ { FRAC_CONST(0.999823449381662), FRAC_CONST(0.018790158768785) },
+ { FRAC_CONST(0.999761096627447), FRAC_CONST(0.021857485452022) },
+ { FRAC_CONST(0.999689333741034), FRAC_CONST(0.024924606404281) },
+ { FRAC_CONST(0.999608161397882), FRAC_CONST(0.027991492756653) },
+ { FRAC_CONST(0.999517580362017), FRAC_CONST(0.031058115642435) },
+ { FRAC_CONST(0.999417591486022), FRAC_CONST(0.034124446197403) },
+ { FRAC_CONST(0.999308195711029), FRAC_CONST(0.037190455560088) },
+ { FRAC_CONST(0.999189394066715), FRAC_CONST(0.040256114872041) },
+ { FRAC_CONST(0.999061187671285), FRAC_CONST(0.043321395278110) },
+ { FRAC_CONST(0.998923577731466), FRAC_CONST(0.046386267926707) },
+ { FRAC_CONST(0.998776565542496), FRAC_CONST(0.049450703970085) },
+ { FRAC_CONST(0.998620152488109), FRAC_CONST(0.052514674564603) },
+ { FRAC_CONST(0.998454340040525), FRAC_CONST(0.055578150871005) },
+ { FRAC_CONST(0.998279129760433), FRAC_CONST(0.058641104054683) },
+ { FRAC_CONST(0.998094523296980), FRAC_CONST(0.061703505285957) },
+ { FRAC_CONST(0.997900522387752), FRAC_CONST(0.064765325740340) },
+ { FRAC_CONST(0.997697128858759), FRAC_CONST(0.067826536598811) },
+ { FRAC_CONST(0.997484344624418), FRAC_CONST(0.070887109048088) },
+ { FRAC_CONST(0.997262171687536), FRAC_CONST(0.073947014280897) },
+ { FRAC_CONST(0.997030612139289), FRAC_CONST(0.077006223496246) },
+ { FRAC_CONST(0.996789668159205), FRAC_CONST(0.080064707899691) },
+ { FRAC_CONST(0.996539342015138), FRAC_CONST(0.083122438703613) },
+ { FRAC_CONST(0.996279636063255), FRAC_CONST(0.086179387127485) },
+ { FRAC_CONST(0.996010552748006), FRAC_CONST(0.089235524398144) },
+ { FRAC_CONST(0.995732094602106), FRAC_CONST(0.092290821750062) },
+ { FRAC_CONST(0.995444264246510), FRAC_CONST(0.095345250425618) },
+ { FRAC_CONST(0.995147064390386), FRAC_CONST(0.098398781675364) },
+ { FRAC_CONST(0.994840497831093), FRAC_CONST(0.101451386758302) },
+ { FRAC_CONST(0.994524567454152), FRAC_CONST(0.104503036942151) },
+ { FRAC_CONST(0.994199276233219), FRAC_CONST(0.107553703503616) },
+ { FRAC_CONST(0.993864627230060), FRAC_CONST(0.110603357728662) },
+ { FRAC_CONST(0.993520623594518), FRAC_CONST(0.113651970912782) },
+ { FRAC_CONST(0.993167268564487), FRAC_CONST(0.116699514361268) },
+ { FRAC_CONST(0.992804565465879), FRAC_CONST(0.119745959389480) },
+ { FRAC_CONST(0.992432517712594), FRAC_CONST(0.122791277323117) },
+ { FRAC_CONST(0.992051128806486), FRAC_CONST(0.125835439498487) },
+ { FRAC_CONST(0.991660402337333), FRAC_CONST(0.128878417262777) },
+ { FRAC_CONST(0.991260341982802), FRAC_CONST(0.131920181974320) },
+ { FRAC_CONST(0.990850951508414), FRAC_CONST(0.134960705002869) },
+ { FRAC_CONST(0.990432234767506), FRAC_CONST(0.137999957729863) },
+ { FRAC_CONST(0.990004195701201), FRAC_CONST(0.141037911548698) },
+ { FRAC_CONST(0.989566838338365), FRAC_CONST(0.144074537864995) },
+ { FRAC_CONST(0.989120166795573), FRAC_CONST(0.147109808096872) },
+ { FRAC_CONST(0.988664185277066), FRAC_CONST(0.150143693675208) },
+ { FRAC_CONST(0.988198898074718), FRAC_CONST(0.153176166043918) },
+ { FRAC_CONST(0.987724309567987), FRAC_CONST(0.156207196660216) },
+ { FRAC_CONST(0.987240424223882), FRAC_CONST(0.159236756994888) },
+ { FRAC_CONST(0.986747246596917), FRAC_CONST(0.162264818532558) },
+ { FRAC_CONST(0.986244781329065), FRAC_CONST(0.165291352771958) },
+ { FRAC_CONST(0.985733033149723), FRAC_CONST(0.168316331226195) },
+ { FRAC_CONST(0.985212006875659), FRAC_CONST(0.171339725423019) },
+ { FRAC_CONST(0.984681707410971), FRAC_CONST(0.174361506905094) },
+ { FRAC_CONST(0.984142139747039), FRAC_CONST(0.177381647230260) },
+ { FRAC_CONST(0.983593308962479), FRAC_CONST(0.180400117971807) },
+ { FRAC_CONST(0.983035220223096), FRAC_CONST(0.183416890718739) },
+ { FRAC_CONST(0.982467878781833), FRAC_CONST(0.186431937076042) },
+ { FRAC_CONST(0.981891289978725), FRAC_CONST(0.189445228664950) },
+ { FRAC_CONST(0.981305459240845), FRAC_CONST(0.192456737123217) },
+ { FRAC_CONST(0.980710392082254), FRAC_CONST(0.195466434105377) },
+ { FRAC_CONST(0.980106094103952), FRAC_CONST(0.198474291283016) },
+ { FRAC_CONST(0.979492570993821), FRAC_CONST(0.201480280345038) },
+ { FRAC_CONST(0.978869828526574), FRAC_CONST(0.204484372997927) },
+ { FRAC_CONST(0.978237872563701), FRAC_CONST(0.207486540966021) },
+ { FRAC_CONST(0.977596709053412), FRAC_CONST(0.210486755991770) },
+ { FRAC_CONST(0.976946344030582), FRAC_CONST(0.213484989836008) },
+ { FRAC_CONST(0.976286783616694), FRAC_CONST(0.216481214278217) },
+ { FRAC_CONST(0.975618034019782), FRAC_CONST(0.219475401116790) },
+ { FRAC_CONST(0.974940101534372), FRAC_CONST(0.222467522169302) },
+ { FRAC_CONST(0.974252992541423), FRAC_CONST(0.225457549272769) },
+ { FRAC_CONST(0.973556713508266), FRAC_CONST(0.228445454283916) },
+ { FRAC_CONST(0.972851270988544), FRAC_CONST(0.231431209079446) },
+ { FRAC_CONST(0.972136671622152), FRAC_CONST(0.234414785556295) },
+ { FRAC_CONST(0.971412922135171), FRAC_CONST(0.237396155631907) },
+ { FRAC_CONST(0.970680029339806), FRAC_CONST(0.240375291244489) },
+ { FRAC_CONST(0.969938000134324), FRAC_CONST(0.243352164353285) },
+ { FRAC_CONST(0.969186841502986), FRAC_CONST(0.246326746938829) },
+ { FRAC_CONST(0.968426560515983), FRAC_CONST(0.249299011003218) },
+ { FRAC_CONST(0.967657164329370), FRAC_CONST(0.252268928570371) },
+ { FRAC_CONST(0.966878660184996), FRAC_CONST(0.255236471686292) },
+ { FRAC_CONST(0.966091055410439), FRAC_CONST(0.258201612419335) },
+ { FRAC_CONST(0.965294357418935), FRAC_CONST(0.261164322860466) },
+ { FRAC_CONST(0.964488573709308), FRAC_CONST(0.264124575123528) },
+ { FRAC_CONST(0.963673711865903), FRAC_CONST(0.267082341345496) },
+ { FRAC_CONST(0.962849779558509), FRAC_CONST(0.270037593686751) },
+ { FRAC_CONST(0.962016784542291), FRAC_CONST(0.272990304331330) },
+ { FRAC_CONST(0.961174734657714), FRAC_CONST(0.275940445487197) },
+ { FRAC_CONST(0.960323637830474), FRAC_CONST(0.278887989386500) },
+ { FRAC_CONST(0.959463502071418), FRAC_CONST(0.281832908285833) },
+ { FRAC_CONST(0.958594335476470), FRAC_CONST(0.284775174466498) },
+ { FRAC_CONST(0.957716146226559), FRAC_CONST(0.287714760234765) },
+ { FRAC_CONST(0.956828942587535), FRAC_CONST(0.290651637922133) },
+ { FRAC_CONST(0.955932732910098), FRAC_CONST(0.293585779885591) },
+ { FRAC_CONST(0.955027525629714), FRAC_CONST(0.296517158507877) },
+ { FRAC_CONST(0.954113329266539), FRAC_CONST(0.299445746197740) },
+ { FRAC_CONST(0.953190152425337), FRAC_CONST(0.302371515390196) },
+ { FRAC_CONST(0.952258003795400), FRAC_CONST(0.305294438546792) },
+ { FRAC_CONST(0.951316892150466), FRAC_CONST(0.308214488155861) },
+ { FRAC_CONST(0.950366826348636), FRAC_CONST(0.311131636732785) },
+ { FRAC_CONST(0.949407815332292), FRAC_CONST(0.314045856820251) },
+ { FRAC_CONST(0.948439868128010), FRAC_CONST(0.316957120988508) },
+ { FRAC_CONST(0.947462993846478), FRAC_CONST(0.319865401835631) },
+ { FRAC_CONST(0.946477201682409), FRAC_CONST(0.322770671987771) },
+ { FRAC_CONST(0.945482500914454), FRAC_CONST(0.325672904099420) },
+ { FRAC_CONST(0.944478900905116), FRAC_CONST(0.328572070853664) },
+ { FRAC_CONST(0.943466411100659), FRAC_CONST(0.331468144962441) },
+ { FRAC_CONST(0.942445041031025), FRAC_CONST(0.334361099166799) },
+ { FRAC_CONST(0.941414800309736), FRAC_CONST(0.337250906237151) },
+ { FRAC_CONST(0.940375698633812), FRAC_CONST(0.340137538973532) },
+ { FRAC_CONST(0.939327745783671), FRAC_CONST(0.343020970205856) },
+ { FRAC_CONST(0.938270951623047), FRAC_CONST(0.345901172794169) },
+ { FRAC_CONST(0.937205326098888), FRAC_CONST(0.348778119628908) },
+ { FRAC_CONST(0.936130879241267), FRAC_CONST(0.351651783631155) },
+ { FRAC_CONST(0.935047621163287), FRAC_CONST(0.354522137752887) },
+ { FRAC_CONST(0.933955562060987), FRAC_CONST(0.357389154977241) },
+ { FRAC_CONST(0.932854712213241), FRAC_CONST(0.360252808318757) },
+ { FRAC_CONST(0.931745081981669), FRAC_CONST(0.363113070823639) },
+ { FRAC_CONST(0.930626681810532), FRAC_CONST(0.365969915570009) },
+ { FRAC_CONST(0.929499522226639), FRAC_CONST(0.368823315668154) },
+ { FRAC_CONST(0.928363613839244), FRAC_CONST(0.371673244260787) },
+ { FRAC_CONST(0.927218967339952), FRAC_CONST(0.374519674523293) },
+ { FRAC_CONST(0.926065593502609), FRAC_CONST(0.377362579663988) },
+ { FRAC_CONST(0.924903503183211), FRAC_CONST(0.380201932924366) },
+ { FRAC_CONST(0.923732707319793), FRAC_CONST(0.383037707579352) },
+ { FRAC_CONST(0.922553216932333), FRAC_CONST(0.385869876937555) },
+ { FRAC_CONST(0.921365043122642), FRAC_CONST(0.388698414341519) },
+ { FRAC_CONST(0.920168197074266), FRAC_CONST(0.391523293167972) },
+ { FRAC_CONST(0.918962690052376), FRAC_CONST(0.394344486828080) },
+ { FRAC_CONST(0.917748533403661), FRAC_CONST(0.397161968767692) },
+ { FRAC_CONST(0.916525738556228), FRAC_CONST(0.399975712467595) },
+ { FRAC_CONST(0.915294317019487), FRAC_CONST(0.402785691443764) },
+ { FRAC_CONST(0.914054280384047), FRAC_CONST(0.405591879247604) },
+ { FRAC_CONST(0.912805640321604), FRAC_CONST(0.408394249466208) },
+ { FRAC_CONST(0.911548408584834), FRAC_CONST(0.411192775722600) },
+ { FRAC_CONST(0.910282597007282), FRAC_CONST(0.413987431675985) },
+ { FRAC_CONST(0.909008217503247), FRAC_CONST(0.416778191021998) },
+ { FRAC_CONST(0.907725282067676), FRAC_CONST(0.419565027492947) },
+ { FRAC_CONST(0.906433802776045), FRAC_CONST(0.422347914858067) },
+ { FRAC_CONST(0.905133791784250), FRAC_CONST(0.425126826923762) },
+ { FRAC_CONST(0.903825261328488), FRAC_CONST(0.427901737533854) },
+ { FRAC_CONST(0.902508223725146), FRAC_CONST(0.430672620569827) },
+ { FRAC_CONST(0.901182691370685), FRAC_CONST(0.433439449951074) },
+ { FRAC_CONST(0.899848676741519), FRAC_CONST(0.436202199635144) },
+ { FRAC_CONST(0.898506192393902), FRAC_CONST(0.438960843617984) },
+ { FRAC_CONST(0.897155250963809), FRAC_CONST(0.441715355934187) },
+ { FRAC_CONST(0.895795865166814), FRAC_CONST(0.444465710657234) },
+ { FRAC_CONST(0.894428047797974), FRAC_CONST(0.447211881899738) },
+ { FRAC_CONST(0.893051811731707), FRAC_CONST(0.449953843813691) },
+ { FRAC_CONST(0.891667169921672), FRAC_CONST(0.452691570590701) },
+ { FRAC_CONST(0.890274135400645), FRAC_CONST(0.455425036462242) },
+ { FRAC_CONST(0.888872721280396), FRAC_CONST(0.458154215699893) },
+ { FRAC_CONST(0.887462940751569), FRAC_CONST(0.460879082615579) },
+ { FRAC_CONST(0.886044807083556), FRAC_CONST(0.463599611561814) },
+ { FRAC_CONST(0.884618333624370), FRAC_CONST(0.466315776931944) },
+ { FRAC_CONST(0.883183533800523), FRAC_CONST(0.469027553160387) },
+ { FRAC_CONST(0.881740421116898), FRAC_CONST(0.471734914722871) },
+ { FRAC_CONST(0.880289009156621), FRAC_CONST(0.474437836136679) },
+ { FRAC_CONST(0.878829311580933), FRAC_CONST(0.477136291960885) },
+ { FRAC_CONST(0.877361342129065), FRAC_CONST(0.479830256796594) },
+ { FRAC_CONST(0.875885114618104), FRAC_CONST(0.482519705287184) },
+ { FRAC_CONST(0.874400642942865), FRAC_CONST(0.485204612118542) },
+ { FRAC_CONST(0.872907941075761), FRAC_CONST(0.487884952019301) },
+ { FRAC_CONST(0.871407023066671), FRAC_CONST(0.490560699761082) },
+ { FRAC_CONST(0.869897903042806), FRAC_CONST(0.493231830158728) },
+ { FRAC_CONST(0.868380595208580), FRAC_CONST(0.495898318070542) },
+ { FRAC_CONST(0.866855113845470), FRAC_CONST(0.498560138398525) },
+ { FRAC_CONST(0.865321473311890), FRAC_CONST(0.501217266088610) },
+ { FRAC_CONST(0.863779688043047), FRAC_CONST(0.503869676130899) },
+ { FRAC_CONST(0.862229772550811), FRAC_CONST(0.506517343559899) },
+ { FRAC_CONST(0.860671741423578), FRAC_CONST(0.509160243454755) },
+ { FRAC_CONST(0.859105609326130), FRAC_CONST(0.511798350939487) },
+ { FRAC_CONST(0.857531390999499), FRAC_CONST(0.514431641183223) },
+ { FRAC_CONST(0.855949101260827), FRAC_CONST(0.517060089400432) },
+ { FRAC_CONST(0.854358755003227), FRAC_CONST(0.519683670851158) },
+ { FRAC_CONST(0.852760367195645), FRAC_CONST(0.522302360841255) },
+ { FRAC_CONST(0.851153952882715), FRAC_CONST(0.524916134722613) },
+ { FRAC_CONST(0.849539527184621), FRAC_CONST(0.527524967893398) },
+ { FRAC_CONST(0.847917105296951), FRAC_CONST(0.530128835798279) },
+ { FRAC_CONST(0.846286702490560), FRAC_CONST(0.532727713928659) },
+ { FRAC_CONST(0.844648334111418), FRAC_CONST(0.535321577822907) },
+ { FRAC_CONST(0.843002015580473), FRAC_CONST(0.537910403066589) },
+ { FRAC_CONST(0.841347762393502), FRAC_CONST(0.540494165292695) },
+ { FRAC_CONST(0.839685590120966), FRAC_CONST(0.543072840181872) },
+ { FRAC_CONST(0.838015514407864), FRAC_CONST(0.545646403462649) },
+ { FRAC_CONST(0.836337550973584), FRAC_CONST(0.548214830911668) },
+ { FRAC_CONST(0.834651715611756), FRAC_CONST(0.550778098353912) },
+ { FRAC_CONST(0.832958024190107), FRAC_CONST(0.553336181662932) },
+ { FRAC_CONST(0.831256492650303), FRAC_CONST(0.555889056761074) },
+ { FRAC_CONST(0.829547137007809), FRAC_CONST(0.558436699619704) },
+ { FRAC_CONST(0.827829973351730), FRAC_CONST(0.560979086259438) },
+ { FRAC_CONST(0.826105017844665), FRAC_CONST(0.563516192750365) },
+ { FRAC_CONST(0.824372286722551), FRAC_CONST(0.566047995212271) },
+ { FRAC_CONST(0.822631796294515), FRAC_CONST(0.568574469814869) },
+ { FRAC_CONST(0.820883562942715), FRAC_CONST(0.571095592778017) },
+ { FRAC_CONST(0.819127603122188), FRAC_CONST(0.573611340371945) },
+ { FRAC_CONST(0.817363933360698), FRAC_CONST(0.576121688917478) },
+ { FRAC_CONST(0.815592570258577), FRAC_CONST(0.578626614786261) },
+ { FRAC_CONST(0.813813530488567), FRAC_CONST(0.581126094400978) },
+ { FRAC_CONST(0.812026830795670), FRAC_CONST(0.583620104235573) },
+ { FRAC_CONST(0.810232487996982), FRAC_CONST(0.586108620815476) },
+ { FRAC_CONST(0.808430518981543), FRAC_CONST(0.588591620717823) },
+ { FRAC_CONST(0.806620940710170), FRAC_CONST(0.591069080571671) },
+ { FRAC_CONST(0.804803770215303), FRAC_CONST(0.593540977058226) },
+ { FRAC_CONST(0.802979024600843), FRAC_CONST(0.596007286911057) },
+ { FRAC_CONST(0.801146721041991), FRAC_CONST(0.598467986916314) },
+ { FRAC_CONST(0.799306876785086), FRAC_CONST(0.600923053912954) },
+ { FRAC_CONST(0.797459509147442), FRAC_CONST(0.603372464792950) },
+ { FRAC_CONST(0.795604635517188), FRAC_CONST(0.605816196501515) },
+ { FRAC_CONST(0.793742273353100), FRAC_CONST(0.608254226037314) },
+ { FRAC_CONST(0.791872440184440), FRAC_CONST(0.610686530452686) },
+ { FRAC_CONST(0.789995153610791), FRAC_CONST(0.613113086853855) },
+ { FRAC_CONST(0.788110431301888), FRAC_CONST(0.615533872401147) },
+ { FRAC_CONST(0.786218290997456), FRAC_CONST(0.617948864309208) },
+ { FRAC_CONST(0.784318750507039), FRAC_CONST(0.620358039847214) },
+ { FRAC_CONST(0.782411827709837), FRAC_CONST(0.622761376339086) },
+ { FRAC_CONST(0.780497540554532), FRAC_CONST(0.625158851163708) },
+ { FRAC_CONST(0.778575907059125), FRAC_CONST(0.627550441755132) },
+ { FRAC_CONST(0.776646945310762), FRAC_CONST(0.629936125602796) },
+ { FRAC_CONST(0.774710673465566), FRAC_CONST(0.632315880251738) },
+ { FRAC_CONST(0.772767109748464), FRAC_CONST(0.634689683302798) },
+ { FRAC_CONST(0.770816272453019), FRAC_CONST(0.637057512412839) },
+ { FRAC_CONST(0.768858179941253), FRAC_CONST(0.639419345294951) },
+ { FRAC_CONST(0.766892850643481), FRAC_CONST(0.641775159718664) },
+ { FRAC_CONST(0.764920303058128), FRAC_CONST(0.644124933510155) },
+ { FRAC_CONST(0.762940555751566), FRAC_CONST(0.646468644552458) },
+ { FRAC_CONST(0.760953627357928), FRAC_CONST(0.648806270785673) },
+ { FRAC_CONST(0.758959536578942), FRAC_CONST(0.651137790207170) },
+ { FRAC_CONST(0.756958302183750), FRAC_CONST(0.653463180871802) },
+ { FRAC_CONST(0.754949943008733), FRAC_CONST(0.655782420892106) },
+ { FRAC_CONST(0.752934477957330), FRAC_CONST(0.658095488438511) },
+ { FRAC_CONST(0.750911925999868), FRAC_CONST(0.660402361739545) },
+ { FRAC_CONST(0.748882306173375), FRAC_CONST(0.662703019082037) },
+ { FRAC_CONST(0.746845637581407), FRAC_CONST(0.664997438811325) },
+ { FRAC_CONST(0.744801939393863), FRAC_CONST(0.667285599331456) },
+ { FRAC_CONST(0.742751230846809), FRAC_CONST(0.669567479105392) },
+ { FRAC_CONST(0.740693531242296), FRAC_CONST(0.671843056655212) },
+ { FRAC_CONST(0.738628859948175), FRAC_CONST(0.674112310562312) },
+ { FRAC_CONST(0.736557236397919), FRAC_CONST(0.676375219467612) },
+ { FRAC_CONST(0.734478680090438), FRAC_CONST(0.678631762071749) },
+ { FRAC_CONST(0.732393210589896), FRAC_CONST(0.680881917135287) },
+ { FRAC_CONST(0.730300847525525), FRAC_CONST(0.683125663478909) },
+ { FRAC_CONST(0.728201610591445), FRAC_CONST(0.685362979983619) },
+ { FRAC_CONST(0.726095519546471), FRAC_CONST(0.687593845590942) },
+ { FRAC_CONST(0.723982594213936), FRAC_CONST(0.689818239303122) },
+ { FRAC_CONST(0.721862854481496), FRAC_CONST(0.692036140183319) },
+ { FRAC_CONST(0.719736320300951), FRAC_CONST(0.694247527355803) },
+ { FRAC_CONST(0.717603011688049), FRAC_CONST(0.696452380006158) },
+ { FRAC_CONST(0.715462948722304), FRAC_CONST(0.698650677381469) },
+ { FRAC_CONST(0.713316151546803), FRAC_CONST(0.700842398790526) },
+ { FRAC_CONST(0.711162640368018), FRAC_CONST(0.703027523604011) },
+ { FRAC_CONST(0.709002435455618), FRAC_CONST(0.705206031254698) },
+ { FRAC_CONST(0.706835557142274), FRAC_CONST(0.707377901237642) },
+ { FRAC_CONST(0.704662025823469), FRAC_CONST(0.709543113110377) },
+ { FRAC_CONST(0.702481861957308), FRAC_CONST(0.711701646493103) },
+ { FRAC_CONST(0.700295086064324), FRAC_CONST(0.713853481068882) },
+ { FRAC_CONST(0.698101718727284), FRAC_CONST(0.715998596583829) },
+ { FRAC_CONST(0.695901780590997), FRAC_CONST(0.718136972847297) },
+ { FRAC_CONST(0.693695292362118), FRAC_CONST(0.720268589732077) },
+ { FRAC_CONST(0.691482274808956), FRAC_CONST(0.722393427174578) },
+ { FRAC_CONST(0.689262748761273), FRAC_CONST(0.724511465175020) },
+ { FRAC_CONST(0.687036735110096), FRAC_CONST(0.726622683797623) },
+ { FRAC_CONST(0.684804254807511), FRAC_CONST(0.728727063170794) },
+ { FRAC_CONST(0.682565328866473), FRAC_CONST(0.730824583487312) },
+ { FRAC_CONST(0.680319978360607), FRAC_CONST(0.732915225004518) },
+ { FRAC_CONST(0.678068224424007), FRAC_CONST(0.734998968044497) },
+ { FRAC_CONST(0.675810088251037), FRAC_CONST(0.737075792994266) },
+ { FRAC_CONST(0.673545591096136), FRAC_CONST(0.739145680305957) },
+ { FRAC_CONST(0.671274754273613), FRAC_CONST(0.741208610497004) },
+ { FRAC_CONST(0.668997599157450), FRAC_CONST(0.743264564150321) },
+ { FRAC_CONST(0.666714147181098), FRAC_CONST(0.745313521914490) },
+ { FRAC_CONST(0.664424419837275), FRAC_CONST(0.747355464503940) },
+ { FRAC_CONST(0.662128438677769), FRAC_CONST(0.749390372699130) },
+ { FRAC_CONST(0.659826225313227), FRAC_CONST(0.751418227346727) },
+ { FRAC_CONST(0.657517801412960), FRAC_CONST(0.753439009359794) },
+ { FRAC_CONST(0.655203188704732), FRAC_CONST(0.755452699717958) },
+ { FRAC_CONST(0.652882408974559), FRAC_CONST(0.757459279467601) },
+ { FRAC_CONST(0.650555484066504), FRAC_CONST(0.759458729722028) },
+ { FRAC_CONST(0.648222435882470), FRAC_CONST(0.761451031661654) },
+ { FRAC_CONST(0.645883286381996), FRAC_CONST(0.763436166534172) },
+ { FRAC_CONST(0.643538057582048), FRAC_CONST(0.765414115654738) },
+ { FRAC_CONST(0.641186771556811), FRAC_CONST(0.767384860406142) },
+ { FRAC_CONST(0.638829450437486), FRAC_CONST(0.769348382238982) },
+ { FRAC_CONST(0.636466116412077), FRAC_CONST(0.771304662671845) },
+ { FRAC_CONST(0.634096791725184), FRAC_CONST(0.773253683291473) },
+ { FRAC_CONST(0.631721498677792), FRAC_CONST(0.775195425752941) },
+ { FRAC_CONST(0.629340259627066), FRAC_CONST(0.777129871779832) },
+ { FRAC_CONST(0.626953096986133), FRAC_CONST(0.779057003164401) },
+ { FRAC_CONST(0.624560033223877), FRAC_CONST(0.780976801767754) },
+ { FRAC_CONST(0.622161090864727), FRAC_CONST(0.782889249520015) },
+ { FRAC_CONST(0.619756292488441), FRAC_CONST(0.784794328420499) },
+ { FRAC_CONST(0.617345660729897), FRAC_CONST(0.786692020537877) },
+ { FRAC_CONST(0.614929218278880), FRAC_CONST(0.788582308010347) },
+ { FRAC_CONST(0.612506987879866), FRAC_CONST(0.790465173045805) },
+ { FRAC_CONST(0.610078992331810), FRAC_CONST(0.792340597922007) },
+ { FRAC_CONST(0.607645254487931), FRAC_CONST(0.794208564986741) },
+ { FRAC_CONST(0.605205797255497), FRAC_CONST(0.796069056657988) },
+ { FRAC_CONST(0.602760643595607), FRAC_CONST(0.797922055424093) },
+ { FRAC_CONST(0.600309816522980), FRAC_CONST(0.799767543843926) },
+ { FRAC_CONST(0.597853339105734), FRAC_CONST(0.801605504547046) },
+ { FRAC_CONST(0.595391234465169), FRAC_CONST(0.803435920233868) },
+ { FRAC_CONST(0.592923525775551), FRAC_CONST(0.805258773675822) },
+ { FRAC_CONST(0.590450236263896), FRAC_CONST(0.807074047715518) },
+ { FRAC_CONST(0.587971389209745), FRAC_CONST(0.808881725266904) },
+ { FRAC_CONST(0.585487007944951), FRAC_CONST(0.810681789315431) },
+ { FRAC_CONST(0.582997115853458), FRAC_CONST(0.812474222918210) },
+ { FRAC_CONST(0.580501736371077), FRAC_CONST(0.814259009204175) },
+ { FRAC_CONST(0.578000892985270), FRAC_CONST(0.816036131374237) },
+ { FRAC_CONST(0.575494609234928), FRAC_CONST(0.817805572701444) },
+ { FRAC_CONST(0.572982908710149), FRAC_CONST(0.819567316531142) },
+ { FRAC_CONST(0.570465815052013), FRAC_CONST(0.821321346281127) },
+ { FRAC_CONST(0.567943351952366), FRAC_CONST(0.823067645441802) },
+ { FRAC_CONST(0.565415543153590), FRAC_CONST(0.824806197576334) },
+ { FRAC_CONST(0.562882412448385), FRAC_CONST(0.826536986320810) },
+ { FRAC_CONST(0.560343983679541), FRAC_CONST(0.828259995384386) },
+ { FRAC_CONST(0.557800280739717), FRAC_CONST(0.829975208549444) },
+ { FRAC_CONST(0.555251327571214), FRAC_CONST(0.831682609671745) },
+ { FRAC_CONST(0.552697148165750), FRAC_CONST(0.833382182680580) },
+ { FRAC_CONST(0.550137766564234), FRAC_CONST(0.835073911578919) },
+ { FRAC_CONST(0.547573206856540), FRAC_CONST(0.836757780443567) },
+ { FRAC_CONST(0.545003493181281), FRAC_CONST(0.838433773425308) },
+ { FRAC_CONST(0.542428649725581), FRAC_CONST(0.840101874749058) },
+ { FRAC_CONST(0.539848700724848), FRAC_CONST(0.841762068714012) },
+ { FRAC_CONST(0.537263670462543), FRAC_CONST(0.843414339693793) },
+ { FRAC_CONST(0.534673583269956), FRAC_CONST(0.845058672136595) },
+ { FRAC_CONST(0.532078463525974), FRAC_CONST(0.846695050565337) },
+ { FRAC_CONST(0.529478335656852), FRAC_CONST(0.848323459577802) },
+ { FRAC_CONST(0.526873224135985), FRAC_CONST(0.849943883846782) },
+ { FRAC_CONST(0.524263153483673), FRAC_CONST(0.851556308120229) },
+ { FRAC_CONST(0.521648148266897), FRAC_CONST(0.853160717221390) },
+ { FRAC_CONST(0.519028233099081), FRAC_CONST(0.854757096048957) },
+ { FRAC_CONST(0.516403432639864), FRAC_CONST(0.856345429577204) },
+ { FRAC_CONST(0.513773771594868), FRAC_CONST(0.857925702856130) },
+ { FRAC_CONST(0.511139274715464), FRAC_CONST(0.859497901011602) },
+ { FRAC_CONST(0.508499966798541), FRAC_CONST(0.861062009245491) },
+ { FRAC_CONST(0.505855872686269), FRAC_CONST(0.862618012835817) },
+ { FRAC_CONST(0.503207017265869), FRAC_CONST(0.864165897136879) },
+ { FRAC_CONST(0.500553425469378), FRAC_CONST(0.865705647579402) },
+ { FRAC_CONST(0.497895122273411), FRAC_CONST(0.867237249670668) },
+ { FRAC_CONST(0.495232132698931), FRAC_CONST(0.868760688994655) },
+ { FRAC_CONST(0.492564481811011), FRAC_CONST(0.870275951212172) },
+ { FRAC_CONST(0.489892194718595), FRAC_CONST(0.871783022060993) },
+ { FRAC_CONST(0.487215296574269), FRAC_CONST(0.873281887355994) },
+ { FRAC_CONST(0.484533812574016), FRAC_CONST(0.874772532989284) },
+ { FRAC_CONST(0.481847767956986), FRAC_CONST(0.876254944930338) },
+ { FRAC_CONST(0.479157188005253), FRAC_CONST(0.877729109226132) },
+ { FRAC_CONST(0.476462098043581), FRAC_CONST(0.879195012001267) },
+ { FRAC_CONST(0.473762523439183), FRAC_CONST(0.880652639458111) },
+ { FRAC_CONST(0.471058489601483), FRAC_CONST(0.882101977876918) },
+ { FRAC_CONST(0.468350021981877), FRAC_CONST(0.883543013615962) },
+ { FRAC_CONST(0.465637146073494), FRAC_CONST(0.884975733111667) },
+ { FRAC_CONST(0.462919887410955), FRAC_CONST(0.886400122878730) },
+ { FRAC_CONST(0.460198271570134), FRAC_CONST(0.887816169510255) },
+ { FRAC_CONST(0.457472324167916), FRAC_CONST(0.889223859677868) },
+ { FRAC_CONST(0.454742070861955), FRAC_CONST(0.890623180131856) },
+ { FRAC_CONST(0.452007537350437), FRAC_CONST(0.892014117701280) },
+ { FRAC_CONST(0.449268749371830), FRAC_CONST(0.893396659294108) },
+ { FRAC_CONST(0.446525732704651), FRAC_CONST(0.894770791897330) },
+ { FRAC_CONST(0.443778513167218), FRAC_CONST(0.896136502577087) },
+ { FRAC_CONST(0.441027116617407), FRAC_CONST(0.897493778478790) },
+ { FRAC_CONST(0.438271568952410), FRAC_CONST(0.898842606827242) },
+ { FRAC_CONST(0.435511896108492), FRAC_CONST(0.900182974926757) },
+ { FRAC_CONST(0.432748124060744), FRAC_CONST(0.901514870161279) },
+ { FRAC_CONST(0.429980278822841), FRAC_CONST(0.902838279994503) },
+ { FRAC_CONST(0.427208386446796), FRAC_CONST(0.904153191969992) },
+ { FRAC_CONST(0.424432473022717), FRAC_CONST(0.905459593711293) },
+ { FRAC_CONST(0.421652564678558), FRAC_CONST(0.906757472922057) },
+ { FRAC_CONST(0.418868687579875), FRAC_CONST(0.908046817386148) },
+ { FRAC_CONST(0.416080867929579), FRAC_CONST(0.909327614967767) },
+ { FRAC_CONST(0.413289131967691), FRAC_CONST(0.910599853611559) },
+ { FRAC_CONST(0.410493505971093), FRAC_CONST(0.911863521342729) },
+ { FRAC_CONST(0.407694016253280), FRAC_CONST(0.913118606267154) },
+ { FRAC_CONST(0.404890689164118), FRAC_CONST(0.914365096571498) },
+ { FRAC_CONST(0.402083551089587), FRAC_CONST(0.915602980523320) },
+ { FRAC_CONST(0.399272628451541), FRAC_CONST(0.916832246471184) },
+ { FRAC_CONST(0.396457947707454), FRAC_CONST(0.918052882844770) },
+ { FRAC_CONST(0.393639535350173), FRAC_CONST(0.919264878154985) },
+ { FRAC_CONST(0.390817417907669), FRAC_CONST(0.920468220994067) },
+ { FRAC_CONST(0.387991621942785), FRAC_CONST(0.921662900035695) },
+ { FRAC_CONST(0.385162174052990), FRAC_CONST(0.922848904035094) },
+ { FRAC_CONST(0.382329100870125), FRAC_CONST(0.924026221829144) },
+ { FRAC_CONST(0.379492429060153), FRAC_CONST(0.925194842336480) },
+ { FRAC_CONST(0.376652185322910), FRAC_CONST(0.926354754557603) },
+ { FRAC_CONST(0.373808396391851), FRAC_CONST(0.927505947574975) },
+ { FRAC_CONST(0.370961089033802), FRAC_CONST(0.928648410553131) },
+ { FRAC_CONST(0.368110290048703), FRAC_CONST(0.929782132738772) },
+ { FRAC_CONST(0.365256026269360), FRAC_CONST(0.930907103460875) },
+ { FRAC_CONST(0.362398324561191), FRAC_CONST(0.932023312130786) },
+ { FRAC_CONST(0.359537211821973), FRAC_CONST(0.933130748242325) },
+ { FRAC_CONST(0.356672714981588), FRAC_CONST(0.934229401371881) },
+ { FRAC_CONST(0.353804861001772), FRAC_CONST(0.935319261178512) },
+ { FRAC_CONST(0.350933676875858), FRAC_CONST(0.936400317404042) },
+ { FRAC_CONST(0.348059189628526), FRAC_CONST(0.937472559873159) },
+ { FRAC_CONST(0.345181426315543), FRAC_CONST(0.938535978493509) },
+ { FRAC_CONST(0.342300414023514), FRAC_CONST(0.939590563255789) },
+ { FRAC_CONST(0.339416179869623), FRAC_CONST(0.940636304233848) },
+ { FRAC_CONST(0.336528751001382), FRAC_CONST(0.941673191584771) },
+ { FRAC_CONST(0.333638154596371), FRAC_CONST(0.942701215548982) },
+ { FRAC_CONST(0.330744417861983), FRAC_CONST(0.943720366450326) },
+ { FRAC_CONST(0.327847568035171), FRAC_CONST(0.944730634696168) },
+ { FRAC_CONST(0.324947632382188), FRAC_CONST(0.945732010777477) },
+ { FRAC_CONST(0.322044638198335), FRAC_CONST(0.946724485268921) },
+ { FRAC_CONST(0.319138612807696), FRAC_CONST(0.947708048828952) },
+ { FRAC_CONST(0.316229583562890), FRAC_CONST(0.948682692199895) },
+ { FRAC_CONST(0.313317577844809), FRAC_CONST(0.949648406208035) },
+ { FRAC_CONST(0.310402623062359), FRAC_CONST(0.950605181763705) },
+ { FRAC_CONST(0.307484746652204), FRAC_CONST(0.951553009861369) },
+ { FRAC_CONST(0.304563976078509), FRAC_CONST(0.952491881579706) },
+ { FRAC_CONST(0.301640338832679), FRAC_CONST(0.953421788081700) },
+ { FRAC_CONST(0.298713862433100), FRAC_CONST(0.954342720614716) },
+ { FRAC_CONST(0.295784574424884), FRAC_CONST(0.955254670510587) },
+ { FRAC_CONST(0.292852502379605), FRAC_CONST(0.956157629185692) },
+ { FRAC_CONST(0.289917673895041), FRAC_CONST(0.957051588141041) },
+ { FRAC_CONST(0.286980116594916), FRAC_CONST(0.957936538962351) },
+ { FRAC_CONST(0.284039858128637), FRAC_CONST(0.958812473320129) },
+ { FRAC_CONST(0.281096926171038), FRAC_CONST(0.959679382969747) },
+ { FRAC_CONST(0.278151348422115), FRAC_CONST(0.960537259751520) },
+ { FRAC_CONST(0.275203152606767), FRAC_CONST(0.961386095590786) },
+ { FRAC_CONST(0.272252366474537), FRAC_CONST(0.962225882497979) },
+ { FRAC_CONST(0.269299017799346), FRAC_CONST(0.963056612568704) },
+ { FRAC_CONST(0.266343134379238), FRAC_CONST(0.963878277983814) },
+ { FRAC_CONST(0.263384744036113), FRAC_CONST(0.964690871009481) },
+ { FRAC_CONST(0.260423874615468), FRAC_CONST(0.965494383997270) },
+ { FRAC_CONST(0.257460553986133), FRAC_CONST(0.966288809384210) },
+ { FRAC_CONST(0.254494810040011), FRAC_CONST(0.967074139692867) },
+ { FRAC_CONST(0.251526670691813), FRAC_CONST(0.967850367531414) },
+ { FRAC_CONST(0.248556163878797), FRAC_CONST(0.968617485593698) },
+ { FRAC_CONST(0.245583317560504), FRAC_CONST(0.969375486659311) },
+ { FRAC_CONST(0.242608159718497), FRAC_CONST(0.970124363593660) },
+ { FRAC_CONST(0.239630718356094), FRAC_CONST(0.970864109348029) },
+ { FRAC_CONST(0.236651021498106), FRAC_CONST(0.971594716959650) },
+ { FRAC_CONST(0.233669097190577), FRAC_CONST(0.972316179551765) },
+ { FRAC_CONST(0.230684973500512), FRAC_CONST(0.973028490333694) },
+ { FRAC_CONST(0.227698678515621), FRAC_CONST(0.973731642600896) },
+ { FRAC_CONST(0.224710240344050), FRAC_CONST(0.974425629735035) },
+ { FRAC_CONST(0.221719687114115), FRAC_CONST(0.975110445204039) },
+ { FRAC_CONST(0.218727046974045), FRAC_CONST(0.975786082562164) },
+ { FRAC_CONST(0.215732348091706), FRAC_CONST(0.976452535450054) },
+ { FRAC_CONST(0.212735618654346), FRAC_CONST(0.977109797594801) },
+ { FRAC_CONST(0.209736886868323), FRAC_CONST(0.977757862810003) },
+ { FRAC_CONST(0.206736180958844), FRAC_CONST(0.978396724995823) },
+ { FRAC_CONST(0.203733529169694), FRAC_CONST(0.979026378139048) },
+ { FRAC_CONST(0.200728959762976), FRAC_CONST(0.979646816313141) },
+ { FRAC_CONST(0.197722501018842), FRAC_CONST(0.980258033678304) },
+ { FRAC_CONST(0.194714181235226), FRAC_CONST(0.980860024481524) },
+ { FRAC_CONST(0.191704028727580), FRAC_CONST(0.981452783056636) },
+ { FRAC_CONST(0.188692071828605), FRAC_CONST(0.982036303824369) },
+ { FRAC_CONST(0.185678338887988), FRAC_CONST(0.982610581292405) },
+ { FRAC_CONST(0.182662858272129), FRAC_CONST(0.983175610055424) },
+ { FRAC_CONST(0.179645658363882), FRAC_CONST(0.983731384795162) },
+ { FRAC_CONST(0.176626767562281), FRAC_CONST(0.984277900280454) },
+ { FRAC_CONST(0.173606214282275), FRAC_CONST(0.984815151367289) },
+ { FRAC_CONST(0.170584026954464), FRAC_CONST(0.985343132998855) },
+ { FRAC_CONST(0.167560234024824), FRAC_CONST(0.985861840205587) },
+ { FRAC_CONST(0.164534863954446), FRAC_CONST(0.986371268105216) },
+ { FRAC_CONST(0.161507945219266), FRAC_CONST(0.986871411902812) },
+ { FRAC_CONST(0.158479506309796), FRAC_CONST(0.987362266890832) },
+ { FRAC_CONST(0.155449575730856), FRAC_CONST(0.987843828449162) },
+ { FRAC_CONST(0.152418182001307), FRAC_CONST(0.988316092045160) },
+ { FRAC_CONST(0.149385353653780), FRAC_CONST(0.988779053233702) },
+ { FRAC_CONST(0.146351119234411), FRAC_CONST(0.989232707657220) },
+ { FRAC_CONST(0.143315507302572), FRAC_CONST(0.989677051045747) },
+ { FRAC_CONST(0.140278546430595), FRAC_CONST(0.990112079216954) },
+ { FRAC_CONST(0.137240265203516), FRAC_CONST(0.990537788076189) },
+ { FRAC_CONST(0.134200692218792), FRAC_CONST(0.990954173616519) },
+ { FRAC_CONST(0.131159856086043), FRAC_CONST(0.991361231918763) },
+ { FRAC_CONST(0.128117785426777), FRAC_CONST(0.991758959151536) },
+ { FRAC_CONST(0.125074508874121), FRAC_CONST(0.992147351571276) },
+ { FRAC_CONST(0.122030055072553), FRAC_CONST(0.992526405522286) },
+ { FRAC_CONST(0.118984452677633), FRAC_CONST(0.992896117436766) },
+ { FRAC_CONST(0.115937730355728), FRAC_CONST(0.993256483834846) },
+ { FRAC_CONST(0.112889916783750), FRAC_CONST(0.993607501324622) },
+ { FRAC_CONST(0.109841040648883), FRAC_CONST(0.993949166602181) },
+ { FRAC_CONST(0.106791130648307), FRAC_CONST(0.994281476451642) },
+ { FRAC_CONST(0.103740215488939), FRAC_CONST(0.994604427745176) },
+ { FRAC_CONST(0.100688323887154), FRAC_CONST(0.994918017443043) },
+ { FRAC_CONST(0.097635484568517), FRAC_CONST(0.995222242593618) },
+ { FRAC_CONST(0.094581726267515), FRAC_CONST(0.995517100333418) },
+ { FRAC_CONST(0.091527077727285), FRAC_CONST(0.995802587887129) },
+ { FRAC_CONST(0.088471567699341), FRAC_CONST(0.996078702567634) },
+ { FRAC_CONST(0.085415224943307), FRAC_CONST(0.996345441776036) },
+ { FRAC_CONST(0.082358078226647), FRAC_CONST(0.996602803001684) },
+ { FRAC_CONST(0.079300156324388), FRAC_CONST(0.996850783822197) },
+ { FRAC_CONST(0.076241488018856), FRAC_CONST(0.997089381903483) },
+ { FRAC_CONST(0.073182102099403), FRAC_CONST(0.997318594999769) },
+ { FRAC_CONST(0.070122027362134), FRAC_CONST(0.997538420953611) },
+ { FRAC_CONST(0.067061292609637), FRAC_CONST(0.997748857695926) },
+ { FRAC_CONST(0.063999926650714), FRAC_CONST(0.997949903246001) },
+ { FRAC_CONST(0.060937958300107), FRAC_CONST(0.998141555711521) },
+ { FRAC_CONST(0.057875416378229), FRAC_CONST(0.998323813288578) },
+ { FRAC_CONST(0.054812329710890), FRAC_CONST(0.998496674261695) },
+ { FRAC_CONST(0.051748727129028), FRAC_CONST(0.998660137003838) },
+ { FRAC_CONST(0.048684637468439), FRAC_CONST(0.998814199976435) },
+ { FRAC_CONST(0.045620089569500), FRAC_CONST(0.998958861729386) },
+ { FRAC_CONST(0.042555112276904), FRAC_CONST(0.999094120901079) },
+ { FRAC_CONST(0.039489734439384), FRAC_CONST(0.999219976218404) },
+ { FRAC_CONST(0.036423984909444), FRAC_CONST(0.999336426496761) },
+ { FRAC_CONST(0.033357892543086), FRAC_CONST(0.999443470640078) },
+ { FRAC_CONST(0.030291486199539), FRAC_CONST(0.999541107640813) },
+ { FRAC_CONST(0.027224794740988), FRAC_CONST(0.999629336579970) },
+ { FRAC_CONST(0.024157847032300), FRAC_CONST(0.999708156627105) },
+ { FRAC_CONST(0.021090671940755), FRAC_CONST(0.999777567040333) },
+ { FRAC_CONST(0.018023298335774), FRAC_CONST(0.999837567166337) },
+ { FRAC_CONST(0.014955755088644), FRAC_CONST(0.999888156440373) },
+ { FRAC_CONST(0.011888071072252), FRAC_CONST(0.999929334386276) },
+ { FRAC_CONST(0.008820275160808), FRAC_CONST(0.999961100616463) },
+ { FRAC_CONST(0.005752396229574), FRAC_CONST(0.999983454831938) },
+ { FRAC_CONST(0.002684463154596), FRAC_CONST(0.999996396822294) }
+};
+
+/* 64 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_256[] =
+{
+ { FRAC_CONST(0.999995293809576), FRAC_CONST(0.003067956762966) },
+ { FRAC_CONST(0.999618822495179), FRAC_CONST(0.027608145778966) },
+ { FRAC_CONST(0.998640218180265), FRAC_CONST(0.052131704680283) },
+ { FRAC_CONST(0.997060070339483), FRAC_CONST(0.076623861392031) },
+ { FRAC_CONST(0.994879330794806), FRAC_CONST(0.101069862754828) },
+ { FRAC_CONST(0.992099313142192), FRAC_CONST(0.125454983411546) },
+ { FRAC_CONST(0.988721691960324), FRAC_CONST(0.149764534677322) },
+ { FRAC_CONST(0.984748501801904), FRAC_CONST(0.173983873387464) },
+ { FRAC_CONST(0.980182135968117), FRAC_CONST(0.198098410717954) },
+ { FRAC_CONST(0.975025345066994), FRAC_CONST(0.222093620973204) },
+ { FRAC_CONST(0.969281235356549), FRAC_CONST(0.245955050335795) },
+ { FRAC_CONST(0.962953266873684), FRAC_CONST(0.269668325572915) },
+ { FRAC_CONST(0.956045251349996), FRAC_CONST(0.293219162694259) },
+ { FRAC_CONST(0.948561349915730), FRAC_CONST(0.316593375556166) },
+ { FRAC_CONST(0.940506070593268), FRAC_CONST(0.339776884406827) },
+ { FRAC_CONST(0.931884265581668), FRAC_CONST(0.362755724367397) },
+ { FRAC_CONST(0.922701128333879), FRAC_CONST(0.385516053843919) },
+ { FRAC_CONST(0.912962190428398), FRAC_CONST(0.408044162864979) },
+ { FRAC_CONST(0.902673318237259), FRAC_CONST(0.430326481340083) },
+ { FRAC_CONST(0.891840709392343), FRAC_CONST(0.452349587233771) },
+ { FRAC_CONST(0.880470889052161), FRAC_CONST(0.474100214650550) },
+ { FRAC_CONST(0.868570705971341), FRAC_CONST(0.495565261825773) },
+ { FRAC_CONST(0.856147328375194), FRAC_CONST(0.516731799017650) },
+ { FRAC_CONST(0.843208239641845), FRAC_CONST(0.537587076295645) },
+ { FRAC_CONST(0.829761233794523), FRAC_CONST(0.558118531220556) },
+ { FRAC_CONST(0.815814410806734), FRAC_CONST(0.578313796411656) },
+ { FRAC_CONST(0.801376171723140), FRAC_CONST(0.598160706996342) },
+ { FRAC_CONST(0.786455213599086), FRAC_CONST(0.617647307937804) },
+ { FRAC_CONST(0.771060524261814), FRAC_CONST(0.636761861236284) },
+ { FRAC_CONST(0.755201376896537), FRAC_CONST(0.655492852999615) },
+ { FRAC_CONST(0.738887324460615), FRAC_CONST(0.673829000378756) },
+ { FRAC_CONST(0.722128193929215), FRAC_CONST(0.691759258364158) },
+ { FRAC_CONST(0.704934080375905), FRAC_CONST(0.709272826438866) },
+ { FRAC_CONST(0.687315340891759), FRAC_CONST(0.726359155084346) },
+ { FRAC_CONST(0.669282588346636), FRAC_CONST(0.743007952135122) },
+ { FRAC_CONST(0.650846684996381), FRAC_CONST(0.759209188978388) },
+ { FRAC_CONST(0.632018735939809), FRAC_CONST(0.774953106594874) },
+ { FRAC_CONST(0.612810082429410), FRAC_CONST(0.790230221437310) },
+ { FRAC_CONST(0.593232295039800), FRAC_CONST(0.805031331142964) },
+ { FRAC_CONST(0.573297166698042), FRAC_CONST(0.819347520076797) },
+ { FRAC_CONST(0.553016705580028), FRAC_CONST(0.833170164701913) },
+ { FRAC_CONST(0.532403127877198), FRAC_CONST(0.846490938774052) },
+ { FRAC_CONST(0.511468850437971), FRAC_CONST(0.859301818357008) },
+ { FRAC_CONST(0.490226483288291), FRAC_CONST(0.871595086655951) },
+ { FRAC_CONST(0.468688822035828), FRAC_CONST(0.883363338665732) },
+ { FRAC_CONST(0.446868840162374), FRAC_CONST(0.894599485631383) },
+ { FRAC_CONST(0.424779681209109), FRAC_CONST(0.905296759318119) },
+ { FRAC_CONST(0.402434650859419), FRAC_CONST(0.915448716088268) },
+ { FRAC_CONST(0.379847208924051), FRAC_CONST(0.925049240782678) },
+ { FRAC_CONST(0.357030961233430), FRAC_CONST(0.934092550404259) },
+ { FRAC_CONST(0.333999651442009), FRAC_CONST(0.942573197601447) },
+ { FRAC_CONST(0.310767152749611), FRAC_CONST(0.950486073949482) },
+ { FRAC_CONST(0.287347459544730), FRAC_CONST(0.957826413027533) },
+ { FRAC_CONST(0.263754678974832), FRAC_CONST(0.964589793289813) },
+ { FRAC_CONST(0.240003022448742), FRAC_CONST(0.970772140728950) },
+ { FRAC_CONST(0.216106797076220), FRAC_CONST(0.976369731330021) },
+ { FRAC_CONST(0.192080397049892), FRAC_CONST(0.981379193313755) },
+ { FRAC_CONST(0.167938294974731), FRAC_CONST(0.985797509167567) },
+ { FRAC_CONST(0.143695033150295), FRAC_CONST(0.989622017463201) },
+ { FRAC_CONST(0.119365214810991), FRAC_CONST(0.992850414459865) },
+ { FRAC_CONST(0.094963495329639), FRAC_CONST(0.995480755491927) },
+ { FRAC_CONST(0.070504573389614), FRAC_CONST(0.997511456140303) },
+ { FRAC_CONST(0.046003182130915), FRAC_CONST(0.998941293186857) },
+ { FRAC_CONST(0.021474080275470), FRAC_CONST(0.999769405351215) }
+};
+
+#ifdef LD_DEC
+/* 256 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_1024[] =
+{
+ { FRAC_CONST(0.999999705862882), FRAC_CONST(0.000766990318743) },
+ { FRAC_CONST(0.999976174986898), FRAC_CONST(0.006902858724730) },
+ { FRAC_CONST(0.999914995573113), FRAC_CONST(0.013038467241987) },
+ { FRAC_CONST(0.999816169924900), FRAC_CONST(0.019173584868323) },
+ { FRAC_CONST(0.999679701762988), FRAC_CONST(0.025307980620025) },
+ { FRAC_CONST(0.999505596225325), FRAC_CONST(0.031441423540560) },
+ { FRAC_CONST(0.999293859866888), FRAC_CONST(0.037573682709270) },
+ { FRAC_CONST(0.999044500659429), FRAC_CONST(0.043704527250063) },
+ { FRAC_CONST(0.998757527991183), FRAC_CONST(0.049833726340107) },
+ { FRAC_CONST(0.998432952666508), FRAC_CONST(0.055961049218521) },
+ { FRAC_CONST(0.998070786905482), FRAC_CONST(0.062086265195060) },
+ { FRAC_CONST(0.997671044343441), FRAC_CONST(0.068209143658806) },
+ { FRAC_CONST(0.997233740030466), FRAC_CONST(0.074329454086846) },
+ { FRAC_CONST(0.996758890430818), FRAC_CONST(0.080446966052950) },
+ { FRAC_CONST(0.996246513422316), FRAC_CONST(0.086561449236251) },
+ { FRAC_CONST(0.995696628295664), FRAC_CONST(0.092672673429913) },
+ { FRAC_CONST(0.995109255753726), FRAC_CONST(0.098780408549800) },
+ { FRAC_CONST(0.994484417910748), FRAC_CONST(0.104884424643135) },
+ { FRAC_CONST(0.993822138291520), FRAC_CONST(0.110984491897163) },
+ { FRAC_CONST(0.993122441830496), FRAC_CONST(0.117080380647801) },
+ { FRAC_CONST(0.992385354870852), FRAC_CONST(0.123171861388280) },
+ { FRAC_CONST(0.991610905163495), FRAC_CONST(0.129258704777796) },
+ { FRAC_CONST(0.990799121866020), FRAC_CONST(0.135340681650134) },
+ { FRAC_CONST(0.989950035541609), FRAC_CONST(0.141417563022303) },
+ { FRAC_CONST(0.989063678157882), FRAC_CONST(0.147489120103154) },
+ { FRAC_CONST(0.988140083085693), FRAC_CONST(0.153555124301993) },
+ { FRAC_CONST(0.987179285097874), FRAC_CONST(0.159615347237193) },
+ { FRAC_CONST(0.986181320367928), FRAC_CONST(0.165669560744784) },
+ { FRAC_CONST(0.985146226468662), FRAC_CONST(0.171717536887050) },
+ { FRAC_CONST(0.984074042370776), FRAC_CONST(0.177759047961107) },
+ { FRAC_CONST(0.982964808441396), FRAC_CONST(0.183793866507478) },
+ { FRAC_CONST(0.981818566442553), FRAC_CONST(0.189821765318656) },
+ { FRAC_CONST(0.980635359529608), FRAC_CONST(0.195842517447658) },
+ { FRAC_CONST(0.979415232249635), FRAC_CONST(0.201855896216568) },
+ { FRAC_CONST(0.978158230539735), FRAC_CONST(0.207861675225075) },
+ { FRAC_CONST(0.976864401725313), FRAC_CONST(0.213859628358994) },
+ { FRAC_CONST(0.975533794518291), FRAC_CONST(0.219849529798779) },
+ { FRAC_CONST(0.974166459015280), FRAC_CONST(0.225831154028026) },
+ { FRAC_CONST(0.972762446695689), FRAC_CONST(0.231804275841965) },
+ { FRAC_CONST(0.971321810419786), FRAC_CONST(0.237768670355934) },
+ { FRAC_CONST(0.969844604426715), FRAC_CONST(0.243724113013852) },
+ { FRAC_CONST(0.968330884332445), FRAC_CONST(0.249670379596669) },
+ { FRAC_CONST(0.966780707127683), FRAC_CONST(0.255607246230807) },
+ { FRAC_CONST(0.965194131175725), FRAC_CONST(0.261534489396596) },
+ { FRAC_CONST(0.963571216210257), FRAC_CONST(0.267451885936678) },
+ { FRAC_CONST(0.961912023333112), FRAC_CONST(0.273359213064419) },
+ { FRAC_CONST(0.960216615011963), FRAC_CONST(0.279256248372291) },
+ { FRAC_CONST(0.958485055077976), FRAC_CONST(0.285142769840249) },
+ { FRAC_CONST(0.956717408723403), FRAC_CONST(0.291018555844085) },
+ { FRAC_CONST(0.954913742499131), FRAC_CONST(0.296883385163778) },
+ { FRAC_CONST(0.953074124312172), FRAC_CONST(0.302737036991819) },
+ { FRAC_CONST(0.951198623423113), FRAC_CONST(0.308579290941525) },
+ { FRAC_CONST(0.949287310443502), FRAC_CONST(0.314409927055337) },
+ { FRAC_CONST(0.947340257333192), FRAC_CONST(0.320228725813100) },
+ { FRAC_CONST(0.945357537397632), FRAC_CONST(0.326035468140330) },
+ { FRAC_CONST(0.943339225285108), FRAC_CONST(0.331829935416461) },
+ { FRAC_CONST(0.941285396983929), FRAC_CONST(0.337611909483075) },
+ { FRAC_CONST(0.939196129819570), FRAC_CONST(0.343381172652115) },
+ { FRAC_CONST(0.937071502451759), FRAC_CONST(0.349137507714085) },
+ { FRAC_CONST(0.934911594871516), FRAC_CONST(0.354880697946223) },
+ { FRAC_CONST(0.932716488398140), FRAC_CONST(0.360610527120662) },
+ { FRAC_CONST(0.930486265676150), FRAC_CONST(0.366326779512574) },
+ { FRAC_CONST(0.928221010672169), FRAC_CONST(0.372029239908285) },
+ { FRAC_CONST(0.925920808671770), FRAC_CONST(0.377717693613386) },
+ { FRAC_CONST(0.923585746276257), FRAC_CONST(0.383391926460809) },
+ { FRAC_CONST(0.921215911399409), FRAC_CONST(0.389051724818894) },
+ { FRAC_CONST(0.918811393264170), FRAC_CONST(0.394696875599434) },
+ { FRAC_CONST(0.916372282399289), FRAC_CONST(0.400327166265690) },
+ { FRAC_CONST(0.913898670635912), FRAC_CONST(0.405942384840403) },
+ { FRAC_CONST(0.911390651104122), FRAC_CONST(0.411542319913765) },
+ { FRAC_CONST(0.908848318229439), FRAC_CONST(0.417126760651388) },
+ { FRAC_CONST(0.906271767729258), FRAC_CONST(0.422695496802233) },
+ { FRAC_CONST(0.903661096609248), FRAC_CONST(0.428248318706532) },
+ { FRAC_CONST(0.901016403159702), FRAC_CONST(0.433785017303679) },
+ { FRAC_CONST(0.898337786951834), FRAC_CONST(0.439305384140100) },
+ { FRAC_CONST(0.895625348834030), FRAC_CONST(0.444809211377105) },
+ { FRAC_CONST(0.892879190928052), FRAC_CONST(0.450296291798709) },
+ { FRAC_CONST(0.890099416625192), FRAC_CONST(0.455766418819435) },
+ { FRAC_CONST(0.887286130582383), FRAC_CONST(0.461219386492092) },
+ { FRAC_CONST(0.884439438718254), FRAC_CONST(0.466654989515531) },
+ { FRAC_CONST(0.881559448209144), FRAC_CONST(0.472073023242369) },
+ { FRAC_CONST(0.878646267485068), FRAC_CONST(0.477473283686698) },
+ { FRAC_CONST(0.875700006225635), FRAC_CONST(0.482855567531766) },
+ { FRAC_CONST(0.872720775355914), FRAC_CONST(0.488219672137627) },
+ { FRAC_CONST(0.869708687042266), FRAC_CONST(0.493565395548775) },
+ { FRAC_CONST(0.866663854688111), FRAC_CONST(0.498892536501745) },
+ { FRAC_CONST(0.863586392929668), FRAC_CONST(0.504200894432690) },
+ { FRAC_CONST(0.860476417631632), FRAC_CONST(0.509490269484936) },
+ { FRAC_CONST(0.857334045882816), FRAC_CONST(0.514760462516501) },
+ { FRAC_CONST(0.854159395991739), FRAC_CONST(0.520011275107596) },
+ { FRAC_CONST(0.850952587482176), FRAC_CONST(0.525242509568095) },
+ { FRAC_CONST(0.847713741088654), FRAC_CONST(0.530453968944976) },
+ { FRAC_CONST(0.844442978751911), FRAC_CONST(0.535645457029741) },
+ { FRAC_CONST(0.841140423614298), FRAC_CONST(0.540816778365797) },
+ { FRAC_CONST(0.837806200015151), FRAC_CONST(0.545967738255818) },
+ { FRAC_CONST(0.834440433486103), FRAC_CONST(0.551098142769075) },
+ { FRAC_CONST(0.831043250746362), FRAC_CONST(0.556207798748740) },
+ { FRAC_CONST(0.827614779697938), FRAC_CONST(0.561296513819151) },
+ { FRAC_CONST(0.824155149420829), FRAC_CONST(0.566364096393064) },
+ { FRAC_CONST(0.820664490168157), FRAC_CONST(0.571410355678857) },
+ { FRAC_CONST(0.817142933361273), FRAC_CONST(0.576435101687722) },
+ { FRAC_CONST(0.813590611584799), FRAC_CONST(0.581438145240810) },
+ { FRAC_CONST(0.810007658581641), FRAC_CONST(0.586419297976361) },
+ { FRAC_CONST(0.806394209247956), FRAC_CONST(0.591378372356788) },
+ { FRAC_CONST(0.802750399628069), FRAC_CONST(0.596315181675744) },
+ { FRAC_CONST(0.799076366909352), FRAC_CONST(0.601229540065149) },
+ { FRAC_CONST(0.795372249417061), FRAC_CONST(0.606121262502186) },
+ { FRAC_CONST(0.791638186609126), FRAC_CONST(0.610990164816272) },
+ { FRAC_CONST(0.787874319070900), FRAC_CONST(0.615836063695985) },
+ { FRAC_CONST(0.784080788509870), FRAC_CONST(0.620658776695972) },
+ { FRAC_CONST(0.780257737750317), FRAC_CONST(0.625458122243814) },
+ { FRAC_CONST(0.776405310727940), FRAC_CONST(0.630233919646864) },
+ { FRAC_CONST(0.772523652484441), FRAC_CONST(0.634985989099049) },
+ { FRAC_CONST(0.768612909162058), FRAC_CONST(0.639714151687640) },
+ { FRAC_CONST(0.764673227998067), FRAC_CONST(0.644418229399988) },
+ { FRAC_CONST(0.760704757319237), FRAC_CONST(0.649098045130226) },
+ { FRAC_CONST(0.756707646536246), FRAC_CONST(0.653753422685936) },
+ { FRAC_CONST(0.752682046138055), FRAC_CONST(0.658384186794785) },
+ { FRAC_CONST(0.748628107686245), FRAC_CONST(0.662990163111121) },
+ { FRAC_CONST(0.744545983809307), FRAC_CONST(0.667571178222540) },
+ { FRAC_CONST(0.740435828196898), FRAC_CONST(0.672127059656412) },
+ { FRAC_CONST(0.736297795594053), FRAC_CONST(0.676657635886375) },
+ { FRAC_CONST(0.732132041795361), FRAC_CONST(0.681162736338795) },
+ { FRAC_CONST(0.727938723639099), FRAC_CONST(0.685642191399187) },
+ { FRAC_CONST(0.723717999001324), FRAC_CONST(0.690095832418600) },
+ { FRAC_CONST(0.719470026789933), FRAC_CONST(0.694523491719966) },
+ { FRAC_CONST(0.715194966938680), FRAC_CONST(0.698925002604414) },
+ { FRAC_CONST(0.710892980401152), FRAC_CONST(0.703300199357549) },
+ { FRAC_CONST(0.706564229144710), FRAC_CONST(0.707648917255684) },
+ { FRAC_CONST(0.702208876144392), FRAC_CONST(0.711970992572050) },
+ { FRAC_CONST(0.697827085376777), FRAC_CONST(0.716266262582953) },
+ { FRAC_CONST(0.693419021813812), FRAC_CONST(0.720534565573905) },
+ { FRAC_CONST(0.688984851416597), FRAC_CONST(0.724775740845711) },
+ { FRAC_CONST(0.684524741129142), FRAC_CONST(0.728989628720519) },
+ { FRAC_CONST(0.680038858872079), FRAC_CONST(0.733176070547833) },
+ { FRAC_CONST(0.675527373536339), FRAC_CONST(0.737334908710483) },
+ { FRAC_CONST(0.670990454976794), FRAC_CONST(0.741465986630563) },
+ { FRAC_CONST(0.666428274005865), FRAC_CONST(0.745569148775325) },
+ { FRAC_CONST(0.661841002387087), FRAC_CONST(0.749644240663033) },
+ { FRAC_CONST(0.657228812828643), FRAC_CONST(0.753691108868781) },
+ { FRAC_CONST(0.652591878976863), FRAC_CONST(0.757709601030268) },
+ { FRAC_CONST(0.647930375409685), FRAC_CONST(0.761699565853535) },
+ { FRAC_CONST(0.643244477630086), FRAC_CONST(0.765660853118662) },
+ { FRAC_CONST(0.638534362059467), FRAC_CONST(0.769593313685423) },
+ { FRAC_CONST(0.633800206031017), FRAC_CONST(0.773496799498899) },
+ { FRAC_CONST(0.629042187783036), FRAC_CONST(0.777371163595056) },
+ { FRAC_CONST(0.624260486452221), FRAC_CONST(0.781216260106276) },
+ { FRAC_CONST(0.619455282066924), FRAC_CONST(0.785031944266848) },
+ { FRAC_CONST(0.614626755540375), FRAC_CONST(0.788818072418420) },
+ { FRAC_CONST(0.609775088663868), FRAC_CONST(0.792574502015408) },
+ { FRAC_CONST(0.604900464099920), FRAC_CONST(0.796301091630359) },
+ { FRAC_CONST(0.600003065375389), FRAC_CONST(0.799997700959282) },
+ { FRAC_CONST(0.595083076874570), FRAC_CONST(0.803664190826924) },
+ { FRAC_CONST(0.590140683832249), FRAC_CONST(0.807300423192014) },
+ { FRAC_CONST(0.585176072326730), FRAC_CONST(0.810906261152460) },
+ { FRAC_CONST(0.580189429272832), FRAC_CONST(0.814481568950499) },
+ { FRAC_CONST(0.575180942414845), FRAC_CONST(0.818026211977813) },
+ { FRAC_CONST(0.570150800319470), FRAC_CONST(0.821540056780598) },
+ { FRAC_CONST(0.565099192368714), FRAC_CONST(0.825022971064580) },
+ { FRAC_CONST(0.560026308752760), FRAC_CONST(0.828474823700007) },
+ { FRAC_CONST(0.554932340462810), FRAC_CONST(0.831895484726578) },
+ { FRAC_CONST(0.549817479283891), FRAC_CONST(0.835284825358337) },
+ { FRAC_CONST(0.544681917787635), FRAC_CONST(0.838642717988527) },
+ { FRAC_CONST(0.539525849325029), FRAC_CONST(0.841969036194388) },
+ { FRAC_CONST(0.534349468019138), FRAC_CONST(0.845263654741918) },
+ { FRAC_CONST(0.529152968757791), FRAC_CONST(0.848526449590593) },
+ { FRAC_CONST(0.523936547186249), FRAC_CONST(0.851757297898029) },
+ { FRAC_CONST(0.518700399699835), FRAC_CONST(0.854956078024615) },
+ { FRAC_CONST(0.513444723436544), FRAC_CONST(0.858122669538086) },
+ { FRAC_CONST(0.508169716269615), FRAC_CONST(0.861256953218062) },
+ { FRAC_CONST(0.502875576800087), FRAC_CONST(0.864358811060534) },
+ { FRAC_CONST(0.497562504349319), FRAC_CONST(0.867428126282307) },
+ { FRAC_CONST(0.492230698951486), FRAC_CONST(0.870464783325398) },
+ { FRAC_CONST(0.486880361346047), FRAC_CONST(0.873468667861385) },
+ { FRAC_CONST(0.481511692970190), FRAC_CONST(0.876439666795714) },
+ { FRAC_CONST(0.476124895951244), FRAC_CONST(0.879377668271953) },
+ { FRAC_CONST(0.470720173099072), FRAC_CONST(0.882282561676009) },
+ { FRAC_CONST(0.465297727898435), FRAC_CONST(0.885154237640285) },
+ { FRAC_CONST(0.459857764501330), FRAC_CONST(0.887992588047806) },
+ { FRAC_CONST(0.454400487719304), FRAC_CONST(0.890797506036281) },
+ { FRAC_CONST(0.448926103015743), FRAC_CONST(0.893568886002136) },
+ { FRAC_CONST(0.443434816498138), FRAC_CONST(0.896306623604480) },
+ { FRAC_CONST(0.437926834910323), FRAC_CONST(0.899010615769039) },
+ { FRAC_CONST(0.432402365624690), FRAC_CONST(0.901680760692038) },
+ { FRAC_CONST(0.426861616634386), FRAC_CONST(0.904316957844028) },
+ { FRAC_CONST(0.421304796545480), FRAC_CONST(0.906919107973678) },
+ { FRAC_CONST(0.415732114569105), FRAC_CONST(0.909487113111505) },
+ { FRAC_CONST(0.410143780513590), FRAC_CONST(0.912020876573568) },
+ { FRAC_CONST(0.404540004776553), FRAC_CONST(0.914520302965104) },
+ { FRAC_CONST(0.398920998336983), FRAC_CONST(0.916985298184123) },
+ { FRAC_CONST(0.393286972747297), FRAC_CONST(0.919415769424947) },
+ { FRAC_CONST(0.387638140125373), FRAC_CONST(0.921811625181708) },
+ { FRAC_CONST(0.381974713146567), FRAC_CONST(0.924172775251791) },
+ { FRAC_CONST(0.376296905035705), FRAC_CONST(0.926499130739231) },
+ { FRAC_CONST(0.370604929559052), FRAC_CONST(0.928790604058057) },
+ { FRAC_CONST(0.364899001016267), FRAC_CONST(0.931047108935595) },
+ { FRAC_CONST(0.359179334232337), FRAC_CONST(0.933268560415712) },
+ { FRAC_CONST(0.353446144549481), FRAC_CONST(0.935454874862015) },
+ { FRAC_CONST(0.347699647819051), FRAC_CONST(0.937605969961000) },
+ { FRAC_CONST(0.341940060393402), FRAC_CONST(0.939721764725153) },
+ { FRAC_CONST(0.336167599117745), FRAC_CONST(0.941802179495998) },
+ { FRAC_CONST(0.330382481321983), FRAC_CONST(0.943847135947093) },
+ { FRAC_CONST(0.324584924812532), FRAC_CONST(0.945856557086984) },
+ { FRAC_CONST(0.318775147864118), FRAC_CONST(0.947830367262101) },
+ { FRAC_CONST(0.312953369211560), FRAC_CONST(0.949768492159607) },
+ { FRAC_CONST(0.307119808041533), FRAC_CONST(0.951670858810194) },
+ { FRAC_CONST(0.301274683984318), FRAC_CONST(0.953537395590833) },
+ { FRAC_CONST(0.295418217105532), FRAC_CONST(0.955368032227470) },
+ { FRAC_CONST(0.289550627897843), FRAC_CONST(0.957162699797670) },
+ { FRAC_CONST(0.283672137272669), FRAC_CONST(0.958921330733213) },
+ { FRAC_CONST(0.277782966551858), FRAC_CONST(0.960643858822638) },
+ { FRAC_CONST(0.271883337459360), FRAC_CONST(0.962330219213737) },
+ { FRAC_CONST(0.265973472112876), FRAC_CONST(0.963980348415994) },
+ { FRAC_CONST(0.260053593015495), FRAC_CONST(0.965594184302977) },
+ { FRAC_CONST(0.254123923047321), FRAC_CONST(0.967171666114677) },
+ { FRAC_CONST(0.248184685457075), FRAC_CONST(0.968712734459795) },
+ { FRAC_CONST(0.242236103853696), FRAC_CONST(0.970217331317979) },
+ { FRAC_CONST(0.236278402197920), FRAC_CONST(0.971685400042009) },
+ { FRAC_CONST(0.230311804793846), FRAC_CONST(0.973116885359925) },
+ { FRAC_CONST(0.224336536280494), FRAC_CONST(0.974511733377116) },
+ { FRAC_CONST(0.218352821623346), FRAC_CONST(0.975869891578341) },
+ { FRAC_CONST(0.212360886105879), FRAC_CONST(0.977191308829712) },
+ { FRAC_CONST(0.206360955321076), FRAC_CONST(0.978475935380617) },
+ { FRAC_CONST(0.200353255162940), FRAC_CONST(0.979723722865591) },
+ { FRAC_CONST(0.194338011817989), FRAC_CONST(0.980934624306142) },
+ { FRAC_CONST(0.188315451756732), FRAC_CONST(0.982108594112514) },
+ { FRAC_CONST(0.182285801725153), FRAC_CONST(0.983245588085407) },
+ { FRAC_CONST(0.176249288736168), FRAC_CONST(0.984345563417642) },
+ { FRAC_CONST(0.170206140061078), FRAC_CONST(0.985408478695768) },
+ { FRAC_CONST(0.164156583221016), FRAC_CONST(0.986434293901627) },
+ { FRAC_CONST(0.158100845978377), FRAC_CONST(0.987422970413855) },
+ { FRAC_CONST(0.152039156328246), FRAC_CONST(0.988374471009341) },
+ { FRAC_CONST(0.145971742489812), FRAC_CONST(0.989288759864625) },
+ { FRAC_CONST(0.139898832897777), FRAC_CONST(0.990165802557248) },
+ { FRAC_CONST(0.133820656193755), FRAC_CONST(0.991005566067049) },
+ { FRAC_CONST(0.127737441217662), FRAC_CONST(0.991808018777406) },
+ { FRAC_CONST(0.121649416999106), FRAC_CONST(0.992573130476429) },
+ { FRAC_CONST(0.115556812748755), FRAC_CONST(0.993300872358093) },
+ { FRAC_CONST(0.109459857849718), FRAC_CONST(0.993991217023329) },
+ { FRAC_CONST(0.103358781848900), FRAC_CONST(0.994644138481051) },
+ { FRAC_CONST(0.097253814448363), FRAC_CONST(0.995259612149133) },
+ { FRAC_CONST(0.091145185496681), FRAC_CONST(0.995837614855342) },
+ { FRAC_CONST(0.085033124980280), FRAC_CONST(0.996378124838200) },
+ { FRAC_CONST(0.078917863014785), FRAC_CONST(0.996881121747814) },
+ { FRAC_CONST(0.072799629836352), FRAC_CONST(0.997346586646633) },
+ { FRAC_CONST(0.066678655793002), FRAC_CONST(0.997774502010168) },
+ { FRAC_CONST(0.060555171335948), FRAC_CONST(0.998164851727646) },
+ { FRAC_CONST(0.054429407010919), FRAC_CONST(0.998517621102622) },
+ { FRAC_CONST(0.048301593449480), FRAC_CONST(0.998832796853528) },
+ { FRAC_CONST(0.042171961360348), FRAC_CONST(0.999110367114175) },
+ { FRAC_CONST(0.036040741520706), FRAC_CONST(0.999350321434199) },
+ { FRAC_CONST(0.029908164767517), FRAC_CONST(0.999552650779457) },
+ { FRAC_CONST(0.023774461988828), FRAC_CONST(0.999717347532362) },
+ { FRAC_CONST(0.017639864115082), FRAC_CONST(0.999844405492175) },
+ { FRAC_CONST(0.011504602110423), FRAC_CONST(0.999933819875236) },
+ { FRAC_CONST(0.005368906963996), FRAC_CONST(0.999985587315143) }
+};
+#endif // LD_DEC
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+/* 480 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_1920[] =
+{
+ { FRAC_CONST(0.999999916334328), FRAC_CONST(0.000409061532028) },
+ { FRAC_CONST(0.999993223088129), FRAC_CONST(0.003681545574400) },
+ { FRAC_CONST(0.999975820717897), FRAC_CONST(0.006953990190376) },
+ { FRAC_CONST(0.999947709409999), FRAC_CONST(0.010226360334704) },
+ { FRAC_CONST(0.999908889465485), FRAC_CONST(0.013498620962929) },
+ { FRAC_CONST(0.999859361300084), FRAC_CONST(0.016770737031768) },
+ { FRAC_CONST(0.999799125444203), FRAC_CONST(0.020042673499487) },
+ { FRAC_CONST(0.999728182542920), FRAC_CONST(0.023314395326274) },
+ { FRAC_CONST(0.999646533355977), FRAC_CONST(0.026585867474619) },
+ { FRAC_CONST(0.999554178757770), FRAC_CONST(0.029857054909681) },
+ { FRAC_CONST(0.999451119737344), FRAC_CONST(0.033127922599673) },
+ { FRAC_CONST(0.999337357398377), FRAC_CONST(0.036398435516228) },
+ { FRAC_CONST(0.999212892959173), FRAC_CONST(0.039668558634781) },
+ { FRAC_CONST(0.999077727752645), FRAC_CONST(0.042938256934941) },
+ { FRAC_CONST(0.998931863226306), FRAC_CONST(0.046207495400865) },
+ { FRAC_CONST(0.998775300942246), FRAC_CONST(0.049476239021636) },
+ { FRAC_CONST(0.998608042577122), FRAC_CONST(0.052744452791636) },
+ { FRAC_CONST(0.998430089922136), FRAC_CONST(0.056012101710921) },
+ { FRAC_CONST(0.998241444883019), FRAC_CONST(0.059279150785597) },
+ { FRAC_CONST(0.998042109480008), FRAC_CONST(0.062545565028192) },
+ { FRAC_CONST(0.997832085847824), FRAC_CONST(0.065811309458034) },
+ { FRAC_CONST(0.997611376235651), FRAC_CONST(0.069076349101624) },
+ { FRAC_CONST(0.997379983007114), FRAC_CONST(0.072340648993011) },
+ { FRAC_CONST(0.997137908640245), FRAC_CONST(0.075604174174166) },
+ { FRAC_CONST(0.996885155727469), FRAC_CONST(0.078866889695354) },
+ { FRAC_CONST(0.996621726975566), FRAC_CONST(0.082128760615515) },
+ { FRAC_CONST(0.996347625205645), FRAC_CONST(0.085389752002632) },
+ { FRAC_CONST(0.996062853353117), FRAC_CONST(0.088649828934106) },
+ { FRAC_CONST(0.995767414467660), FRAC_CONST(0.091908956497133) },
+ { FRAC_CONST(0.995461311713186), FRAC_CONST(0.095167099789075) },
+ { FRAC_CONST(0.995144548367810), FRAC_CONST(0.098424223917834) },
+ { FRAC_CONST(0.994817127823813), FRAC_CONST(0.101680294002229) },
+ { FRAC_CONST(0.994479053587606), FRAC_CONST(0.104935275172364) },
+ { FRAC_CONST(0.994130329279692), FRAC_CONST(0.108189132570007) },
+ { FRAC_CONST(0.993770958634630), FRAC_CONST(0.111441831348957) },
+ { FRAC_CONST(0.993400945500988), FRAC_CONST(0.114693336675426) },
+ { FRAC_CONST(0.993020293841312), FRAC_CONST(0.117943613728403) },
+ { FRAC_CONST(0.992629007732074), FRAC_CONST(0.121192627700032) },
+ { FRAC_CONST(0.992227091363634), FRAC_CONST(0.124440343795983) },
+ { FRAC_CONST(0.991814549040194), FRAC_CONST(0.127686727235827) },
+ { FRAC_CONST(0.991391385179751), FRAC_CONST(0.130931743253405) },
+ { FRAC_CONST(0.990957604314048), FRAC_CONST(0.134175357097202) },
+ { FRAC_CONST(0.990513211088533), FRAC_CONST(0.137417534030720) },
+ { FRAC_CONST(0.990058210262297), FRAC_CONST(0.140658239332849) },
+ { FRAC_CONST(0.989592606708036), FRAC_CONST(0.143897438298239) },
+ { FRAC_CONST(0.989116405411988), FRAC_CONST(0.147135096237670) },
+ { FRAC_CONST(0.988629611473887), FRAC_CONST(0.150371178478428) },
+ { FRAC_CONST(0.988132230106905), FRAC_CONST(0.153605650364672) },
+ { FRAC_CONST(0.987624266637598), FRAC_CONST(0.156838477257806) },
+ { FRAC_CONST(0.987105726505845), FRAC_CONST(0.160069624536852) },
+ { FRAC_CONST(0.986576615264794), FRAC_CONST(0.163299057598817) },
+ { FRAC_CONST(0.986036938580803), FRAC_CONST(0.166526741859069) },
+ { FRAC_CONST(0.985486702233375), FRAC_CONST(0.169752642751702) },
+ { FRAC_CONST(0.984925912115099), FRAC_CONST(0.172976725729910) },
+ { FRAC_CONST(0.984354574231587), FRAC_CONST(0.176198956266353) },
+ { FRAC_CONST(0.983772694701407), FRAC_CONST(0.179419299853531) },
+ { FRAC_CONST(0.983180279756024), FRAC_CONST(0.182637722004152) },
+ { FRAC_CONST(0.982577335739725), FRAC_CONST(0.185854188251500) },
+ { FRAC_CONST(0.981963869109555), FRAC_CONST(0.189068664149806) },
+ { FRAC_CONST(0.981339886435250), FRAC_CONST(0.192281115274616) },
+ { FRAC_CONST(0.980705394399163), FRAC_CONST(0.195491507223158) },
+ { FRAC_CONST(0.980060399796194), FRAC_CONST(0.198699805614714) },
+ { FRAC_CONST(0.979404909533716), FRAC_CONST(0.201905976090986) },
+ { FRAC_CONST(0.978738930631504), FRAC_CONST(0.205109984316464) },
+ { FRAC_CONST(0.978062470221657), FRAC_CONST(0.208311795978794) },
+ { FRAC_CONST(0.977375535548522), FRAC_CONST(0.211511376789145) },
+ { FRAC_CONST(0.976678133968618), FRAC_CONST(0.214708692482577) },
+ { FRAC_CONST(0.975970272950556), FRAC_CONST(0.217903708818409) },
+ { FRAC_CONST(0.975251960074958), FRAC_CONST(0.221096391580581) },
+ { FRAC_CONST(0.974523203034377), FRAC_CONST(0.224286706578026) },
+ { FRAC_CONST(0.973784009633218), FRAC_CONST(0.227474619645035) },
+ { FRAC_CONST(0.973034387787646), FRAC_CONST(0.230660096641619) },
+ { FRAC_CONST(0.972274345525510), FRAC_CONST(0.233843103453878) },
+ { FRAC_CONST(0.971503890986252), FRAC_CONST(0.237023605994367) },
+ { FRAC_CONST(0.970723032420820), FRAC_CONST(0.240201570202459) },
+ { FRAC_CONST(0.969931778191584), FRAC_CONST(0.243376962044711) },
+ { FRAC_CONST(0.969130136772239), FRAC_CONST(0.246549747515226) },
+ { FRAC_CONST(0.968318116747721), FRAC_CONST(0.249719892636022) },
+ { FRAC_CONST(0.967495726814114), FRAC_CONST(0.252887363457390) },
+ { FRAC_CONST(0.966662975778551), FRAC_CONST(0.256052126058264) },
+ { FRAC_CONST(0.965819872559127), FRAC_CONST(0.259214146546579) },
+ { FRAC_CONST(0.964966426184802), FRAC_CONST(0.262373391059634) },
+ { FRAC_CONST(0.964102645795299), FRAC_CONST(0.265529825764461) },
+ { FRAC_CONST(0.963228540641012), FRAC_CONST(0.268683416858178) },
+ { FRAC_CONST(0.962344120082907), FRAC_CONST(0.271834130568359) },
+ { FRAC_CONST(0.961449393592416), FRAC_CONST(0.274981933153391) },
+ { FRAC_CONST(0.960544370751341), FRAC_CONST(0.278126790902837) },
+ { FRAC_CONST(0.959629061251750), FRAC_CONST(0.281268670137799) },
+ { FRAC_CONST(0.958703474895872), FRAC_CONST(0.284407537211272) },
+ { FRAC_CONST(0.957767621595993), FRAC_CONST(0.287543358508512) },
+ { FRAC_CONST(0.956821511374351), FRAC_CONST(0.290676100447394) },
+ { FRAC_CONST(0.955865154363025), FRAC_CONST(0.293805729478766) },
+ { FRAC_CONST(0.954898560803832), FRAC_CONST(0.296932212086818) },
+ { FRAC_CONST(0.953921741048211), FRAC_CONST(0.300055514789431) },
+ { FRAC_CONST(0.952934705557117), FRAC_CONST(0.303175604138543) },
+ { FRAC_CONST(0.951937464900908), FRAC_CONST(0.306292446720504) },
+ { FRAC_CONST(0.950930029759229), FRAC_CONST(0.309406009156434) },
+ { FRAC_CONST(0.949912410920903), FRAC_CONST(0.312516258102580) },
+ { FRAC_CONST(0.948884619283808), FRAC_CONST(0.315623160250676) },
+ { FRAC_CONST(0.947846665854767), FRAC_CONST(0.318726682328294) },
+ { FRAC_CONST(0.946798561749429), FRAC_CONST(0.321826791099207) },
+ { FRAC_CONST(0.945740318192145), FRAC_CONST(0.324923453363742) },
+ { FRAC_CONST(0.944671946515855), FRAC_CONST(0.328016635959131) },
+ { FRAC_CONST(0.943593458161960), FRAC_CONST(0.331106305759876) },
+ { FRAC_CONST(0.942504864680205), FRAC_CONST(0.334192429678095) },
+ { FRAC_CONST(0.941406177728551), FRAC_CONST(0.337274974663880) },
+ { FRAC_CONST(0.940297409073052), FRAC_CONST(0.340353907705650) },
+ { FRAC_CONST(0.939178570587730), FRAC_CONST(0.343429195830507) },
+ { FRAC_CONST(0.938049674254446), FRAC_CONST(0.346500806104585) },
+ { FRAC_CONST(0.936910732162774), FRAC_CONST(0.349568705633406) },
+ { FRAC_CONST(0.935761756509868), FRAC_CONST(0.352632861562230) },
+ { FRAC_CONST(0.934602759600334), FRAC_CONST(0.355693241076410) },
+ { FRAC_CONST(0.933433753846097), FRAC_CONST(0.358749811401739) },
+ { FRAC_CONST(0.932254751766271), FRAC_CONST(0.361802539804806) },
+ { FRAC_CONST(0.931065765987021), FRAC_CONST(0.364851393593340) },
+ { FRAC_CONST(0.929866809241428), FRAC_CONST(0.367896340116568) },
+ { FRAC_CONST(0.928657894369357), FRAC_CONST(0.370937346765559) },
+ { FRAC_CONST(0.927439034317314), FRAC_CONST(0.373974380973575) },
+ { FRAC_CONST(0.926210242138311), FRAC_CONST(0.377007410216418) },
+ { FRAC_CONST(0.924971530991726), FRAC_CONST(0.380036402012783) },
+ { FRAC_CONST(0.923722914143160), FRAC_CONST(0.383061323924602) },
+ { FRAC_CONST(0.922464404964295), FRAC_CONST(0.386082143557389) },
+ { FRAC_CONST(0.921196016932755), FRAC_CONST(0.389098828560595) },
+ { FRAC_CONST(0.919917763631956), FRAC_CONST(0.392111346627946) },
+ { FRAC_CONST(0.918629658750963), FRAC_CONST(0.395119665497795) },
+ { FRAC_CONST(0.917331716084346), FRAC_CONST(0.398123752953462) },
+ { FRAC_CONST(0.916023949532027), FRAC_CONST(0.401123576823585) },
+ { FRAC_CONST(0.914706373099136), FRAC_CONST(0.404119104982459) },
+ { FRAC_CONST(0.913379000895858), FRAC_CONST(0.407110305350386) },
+ { FRAC_CONST(0.912041847137282), FRAC_CONST(0.410097145894012) },
+ { FRAC_CONST(0.910694926143251), FRAC_CONST(0.413079594626675) },
+ { FRAC_CONST(0.909338252338207), FRAC_CONST(0.416057619608744) },
+ { FRAC_CONST(0.907971840251037), FRAC_CONST(0.419031188947965) },
+ { FRAC_CONST(0.906595704514915), FRAC_CONST(0.422000270799800) },
+ { FRAC_CONST(0.905209859867151), FRAC_CONST(0.424964833367766) },
+ { FRAC_CONST(0.903814321149027), FRAC_CONST(0.427924844903780) },
+ { FRAC_CONST(0.902409103305641), FRAC_CONST(0.430880273708497) },
+ { FRAC_CONST(0.900994221385748), FRAC_CONST(0.433831088131649) },
+ { FRAC_CONST(0.899569690541596), FRAC_CONST(0.436777256572384) },
+ { FRAC_CONST(0.898135526028766), FRAC_CONST(0.439718747479604) },
+ { FRAC_CONST(0.896691743206008), FRAC_CONST(0.442655529352306) },
+ { FRAC_CONST(0.895238357535076), FRAC_CONST(0.445587570739915) },
+ { FRAC_CONST(0.893775384580563), FRAC_CONST(0.448514840242624) },
+ { FRAC_CONST(0.892302840009734), FRAC_CONST(0.451437306511726) },
+ { FRAC_CONST(0.890820739592359), FRAC_CONST(0.454354938249958) },
+ { FRAC_CONST(0.889329099200541), FRAC_CONST(0.457267704211826) },
+ { FRAC_CONST(0.887827934808551), FRAC_CONST(0.460175573203949) },
+ { FRAC_CONST(0.886317262492655), FRAC_CONST(0.463078514085383) },
+ { FRAC_CONST(0.884797098430938), FRAC_CONST(0.465976495767966) },
+ { FRAC_CONST(0.883267458903136), FRAC_CONST(0.468869487216642) },
+ { FRAC_CONST(0.881728360290461), FRAC_CONST(0.471757457449795) },
+ { FRAC_CONST(0.880179819075421), FRAC_CONST(0.474640375539586) },
+ { FRAC_CONST(0.878621851841649), FRAC_CONST(0.477518210612278) },
+ { FRAC_CONST(0.877054475273722), FRAC_CONST(0.480390931848569) },
+ { FRAC_CONST(0.875477706156984), FRAC_CONST(0.483258508483922) },
+ { FRAC_CONST(0.873891561377366), FRAC_CONST(0.486120909808896) },
+ { FRAC_CONST(0.872296057921204), FRAC_CONST(0.488978105169472) },
+ { FRAC_CONST(0.870691212875058), FRAC_CONST(0.491830063967383) },
+ { FRAC_CONST(0.869077043425529), FRAC_CONST(0.494676755660442) },
+ { FRAC_CONST(0.867453566859076), FRAC_CONST(0.497518149762867) },
+ { FRAC_CONST(0.865820800561827), FRAC_CONST(0.500354215845611) },
+ { FRAC_CONST(0.864178762019399), FRAC_CONST(0.503184923536685) },
+ { FRAC_CONST(0.862527468816704), FRAC_CONST(0.506010242521482) },
+ { FRAC_CONST(0.860866938637767), FRAC_CONST(0.508830142543107) },
+ { FRAC_CONST(0.859197189265532), FRAC_CONST(0.511644593402696) },
+ { FRAC_CONST(0.857518238581672), FRAC_CONST(0.514453564959741) },
+ { FRAC_CONST(0.855830104566401), FRAC_CONST(0.517257027132414) },
+ { FRAC_CONST(0.854132805298278), FRAC_CONST(0.520054949897887) },
+ { FRAC_CONST(0.852426358954015), FRAC_CONST(0.522847303292655) },
+ { FRAC_CONST(0.850710783808280), FRAC_CONST(0.525634057412856) },
+ { FRAC_CONST(0.848986098233506), FRAC_CONST(0.528415182414593) },
+ { FRAC_CONST(0.847252320699689), FRAC_CONST(0.531190648514252) },
+ { FRAC_CONST(0.845509469774194), FRAC_CONST(0.533960425988819) },
+ { FRAC_CONST(0.843757564121554), FRAC_CONST(0.536724485176205) },
+ { FRAC_CONST(0.841996622503271), FRAC_CONST(0.539482796475555) },
+ { FRAC_CONST(0.840226663777615), FRAC_CONST(0.542235330347571) },
+ { FRAC_CONST(0.838447706899422), FRAC_CONST(0.544982057314827) },
+ { FRAC_CONST(0.836659770919891), FRAC_CONST(0.547722947962084) },
+ { FRAC_CONST(0.834862874986380), FRAC_CONST(0.550457972936605) },
+ { FRAC_CONST(0.833057038342201), FRAC_CONST(0.553187102948470) },
+ { FRAC_CONST(0.831242280326413), FRAC_CONST(0.555910308770889) },
+ { FRAC_CONST(0.829418620373617), FRAC_CONST(0.558627561240515) },
+ { FRAC_CONST(0.827586078013746), FRAC_CONST(0.561338831257758) },
+ { FRAC_CONST(0.825744672871856), FRAC_CONST(0.564044089787093) },
+ { FRAC_CONST(0.823894424667918), FRAC_CONST(0.566743307857377) },
+ { FRAC_CONST(0.822035353216601), FRAC_CONST(0.569436456562150) },
+ { FRAC_CONST(0.820167478427070), FRAC_CONST(0.572123507059955) },
+ { FRAC_CONST(0.818290820302761), FRAC_CONST(0.574804430574639) },
+ { FRAC_CONST(0.816405398941175), FRAC_CONST(0.577479198395666) },
+ { FRAC_CONST(0.814511234533661), FRAC_CONST(0.580147781878420) },
+ { FRAC_CONST(0.812608347365198), FRAC_CONST(0.582810152444517) },
+ { FRAC_CONST(0.810696757814178), FRAC_CONST(0.585466281582107) },
+ { FRAC_CONST(0.808776486352191), FRAC_CONST(0.588116140846181) },
+ { FRAC_CONST(0.806847553543799), FRAC_CONST(0.590759701858874) },
+ { FRAC_CONST(0.804909980046325), FRAC_CONST(0.593396936309773) },
+ { FRAC_CONST(0.802963786609623), FRAC_CONST(0.596027815956215) },
+ { FRAC_CONST(0.801008994075862), FRAC_CONST(0.598652312623592) },
+ { FRAC_CONST(0.799045623379300), FRAC_CONST(0.601270398205654) },
+ { FRAC_CONST(0.797073695546059), FRAC_CONST(0.603882044664808) },
+ { FRAC_CONST(0.795093231693901), FRAC_CONST(0.606487224032418) },
+ { FRAC_CONST(0.793104253032005), FRAC_CONST(0.609085908409106) },
+ { FRAC_CONST(0.791106780860733), FRAC_CONST(0.611678069965050) },
+ { FRAC_CONST(0.789100836571407), FRAC_CONST(0.614263680940283) },
+ { FRAC_CONST(0.787086441646080), FRAC_CONST(0.616842713644988) },
+ { FRAC_CONST(0.785063617657302), FRAC_CONST(0.619415140459796) },
+ { FRAC_CONST(0.783032386267894), FRAC_CONST(0.621980933836084) },
+ { FRAC_CONST(0.780992769230711), FRAC_CONST(0.624540066296266) },
+ { FRAC_CONST(0.778944788388414), FRAC_CONST(0.627092510434089) },
+ { FRAC_CONST(0.776888465673232), FRAC_CONST(0.629638238914927) },
+ { FRAC_CONST(0.774823823106730), FRAC_CONST(0.632177224476073) },
+ { FRAC_CONST(0.772750882799570), FRAC_CONST(0.634709439927031) },
+ { FRAC_CONST(0.770669666951277), FRAC_CONST(0.637234858149809) },
+ { FRAC_CONST(0.768580197850002), FRAC_CONST(0.639753452099206) },
+ { FRAC_CONST(0.766482497872280), FRAC_CONST(0.642265194803105) },
+ { FRAC_CONST(0.764376589482793), FRAC_CONST(0.644770059362758) },
+ { FRAC_CONST(0.762262495234126), FRAC_CONST(0.647268018953079) },
+ { FRAC_CONST(0.760140237766532), FRAC_CONST(0.649759046822928) },
+ { FRAC_CONST(0.758009839807683), FRAC_CONST(0.652243116295397) },
+ { FRAC_CONST(0.755871324172429), FRAC_CONST(0.654720200768098) },
+ { FRAC_CONST(0.753724713762555), FRAC_CONST(0.657190273713446) },
+ { FRAC_CONST(0.751570031566534), FRAC_CONST(0.659653308678945) },
+ { FRAC_CONST(0.749407300659280), FRAC_CONST(0.662109279287469) },
+ { FRAC_CONST(0.747236544201905), FRAC_CONST(0.664558159237545) },
+ { FRAC_CONST(0.745057785441466), FRAC_CONST(0.666999922303638) },
+ { FRAC_CONST(0.742871047710719), FRAC_CONST(0.669434542336425) },
+ { FRAC_CONST(0.740676354427868), FRAC_CONST(0.671861993263083) },
+ { FRAC_CONST(0.738473729096316), FRAC_CONST(0.674282249087562) },
+ { FRAC_CONST(0.736263195304409), FRAC_CONST(0.676695283890867) },
+ { FRAC_CONST(0.734044776725190), FRAC_CONST(0.679101071831334) },
+ { FRAC_CONST(0.731818497116138), FRAC_CONST(0.681499587144906) },
+ { FRAC_CONST(0.729584380318920), FRAC_CONST(0.683890804145412) },
+ { FRAC_CONST(0.727342450259131), FRAC_CONST(0.686274697224838) },
+ { FRAC_CONST(0.725092730946042), FRAC_CONST(0.688651240853606) },
+ { FRAC_CONST(0.722835246472338), FRAC_CONST(0.691020409580841) },
+ { FRAC_CONST(0.720570021013866), FRAC_CONST(0.693382178034651) },
+ { FRAC_CONST(0.718297078829369), FRAC_CONST(0.695736520922392) },
+ { FRAC_CONST(0.716016444260233), FRAC_CONST(0.698083413030944) },
+ { FRAC_CONST(0.713728141730222), FRAC_CONST(0.700422829226978) },
+ { FRAC_CONST(0.711432195745216), FRAC_CONST(0.702754744457225) },
+ { FRAC_CONST(0.709128630892954), FRAC_CONST(0.705079133748748) },
+ { FRAC_CONST(0.706817471842764), FRAC_CONST(0.707395972209203) },
+ { FRAC_CONST(0.704498743345302), FRAC_CONST(0.709705235027113) },
+ { FRAC_CONST(0.702172470232289), FRAC_CONST(0.712006897472128) },
+ { FRAC_CONST(0.699838677416240), FRAC_CONST(0.714300934895292) },
+ { FRAC_CONST(0.697497389890200), FRAC_CONST(0.716587322729308) },
+ { FRAC_CONST(0.695148632727480), FRAC_CONST(0.718866036488799) },
+ { FRAC_CONST(0.692792431081381), FRAC_CONST(0.721137051770570) },
+ { FRAC_CONST(0.690428810184929), FRAC_CONST(0.723400344253874) },
+ { FRAC_CONST(0.688057795350606), FRAC_CONST(0.725655889700665) },
+ { FRAC_CONST(0.685679411970075), FRAC_CONST(0.727903663955865) },
+ { FRAC_CONST(0.683293685513912), FRAC_CONST(0.730143642947616) },
+ { FRAC_CONST(0.680900641531330), FRAC_CONST(0.732375802687543) },
+ { FRAC_CONST(0.678500305649909), FRAC_CONST(0.734600119271009) },
+ { FRAC_CONST(0.676092703575316), FRAC_CONST(0.736816568877370) },
+ { FRAC_CONST(0.673677861091036), FRAC_CONST(0.739025127770231) },
+ { FRAC_CONST(0.671255804058092), FRAC_CONST(0.741225772297702) },
+ { FRAC_CONST(0.668826558414768), FRAC_CONST(0.743418478892647) },
+ { FRAC_CONST(0.666390150176334), FRAC_CONST(0.745603224072940) },
+ { FRAC_CONST(0.663946605434765), FRAC_CONST(0.747779984441716) },
+ { FRAC_CONST(0.661495950358462), FRAC_CONST(0.749948736687619) },
+ { FRAC_CONST(0.659038211191971), FRAC_CONST(0.752109457585056) },
+ { FRAC_CONST(0.656573414255705), FRAC_CONST(0.754262123994441) },
+ { FRAC_CONST(0.654101585945659), FRAC_CONST(0.756406712862448) },
+ { FRAC_CONST(0.651622752733128), FRAC_CONST(0.758543201222251) },
+ { FRAC_CONST(0.649136941164425), FRAC_CONST(0.760671566193777) },
+ { FRAC_CONST(0.646644177860593), FRAC_CONST(0.762791784983948) },
+ { FRAC_CONST(0.644144489517126), FRAC_CONST(0.764903834886923) },
+ { FRAC_CONST(0.641637902903677), FRAC_CONST(0.767007693284345) },
+ { FRAC_CONST(0.639124444863776), FRAC_CONST(0.769103337645580) },
+ { FRAC_CONST(0.636604142314538), FRAC_CONST(0.771190745527961) },
+ { FRAC_CONST(0.634077022246379), FRAC_CONST(0.773269894577026) },
+ { FRAC_CONST(0.631543111722725), FRAC_CONST(0.775340762526760) },
+ { FRAC_CONST(0.629002437879721), FRAC_CONST(0.777403327199831) },
+ { FRAC_CONST(0.626455027925944), FRAC_CONST(0.779457566507828) },
+ { FRAC_CONST(0.623900909142107), FRAC_CONST(0.781503458451498) },
+ { FRAC_CONST(0.621340108880771), FRAC_CONST(0.783540981120982) },
+ { FRAC_CONST(0.618772654566049), FRAC_CONST(0.785570112696050) },
+ { FRAC_CONST(0.616198573693314), FRAC_CONST(0.787590831446332) },
+ { FRAC_CONST(0.613617893828905), FRAC_CONST(0.789603115731555) },
+ { FRAC_CONST(0.611030642609828), FRAC_CONST(0.791606944001769) },
+ { FRAC_CONST(0.608436847743468), FRAC_CONST(0.793602294797585) },
+ { FRAC_CONST(0.605836537007281), FRAC_CONST(0.795589146750397) },
+ { FRAC_CONST(0.603229738248508), FRAC_CONST(0.797567478582619) },
+ { FRAC_CONST(0.600616479383869), FRAC_CONST(0.799537269107905) },
+ { FRAC_CONST(0.597996788399267), FRAC_CONST(0.801498497231381) },
+ { FRAC_CONST(0.595370693349487), FRAC_CONST(0.803451141949871) },
+ { FRAC_CONST(0.592738222357898), FRAC_CONST(0.805395182352117) },
+ { FRAC_CONST(0.590099403616149), FRAC_CONST(0.807330597619008) },
+ { FRAC_CONST(0.587454265383869), FRAC_CONST(0.809257367023803) },
+ { FRAC_CONST(0.584802835988364), FRAC_CONST(0.811175469932349) },
+ { FRAC_CONST(0.582145143824311), FRAC_CONST(0.813084885803304) },
+ { FRAC_CONST(0.579481217353460), FRAC_CONST(0.814985594188359) },
+ { FRAC_CONST(0.576811085104321), FRAC_CONST(0.816877574732454) },
+ { FRAC_CONST(0.574134775671867), FRAC_CONST(0.818760807173997) },
+ { FRAC_CONST(0.571452317717222), FRAC_CONST(0.820635271345081) },
+ { FRAC_CONST(0.568763739967354), FRAC_CONST(0.822500947171703) },
+ { FRAC_CONST(0.566069071214772), FRAC_CONST(0.824357814673971) },
+ { FRAC_CONST(0.563368340317214), FRAC_CONST(0.826205853966327) },
+ { FRAC_CONST(0.560661576197336), FRAC_CONST(0.828045045257756) },
+ { FRAC_CONST(0.557948807842409), FRAC_CONST(0.829875368851995) },
+ { FRAC_CONST(0.555230064304002), FRAC_CONST(0.831696805147750) },
+ { FRAC_CONST(0.552505374697674), FRAC_CONST(0.833509334638900) },
+ { FRAC_CONST(0.549774768202663), FRAC_CONST(0.835312937914713) },
+ { FRAC_CONST(0.547038274061568), FRAC_CONST(0.837107595660044) },
+ { FRAC_CONST(0.544295921580046), FRAC_CONST(0.838893288655553) },
+ { FRAC_CONST(0.541547740126486), FRAC_CONST(0.840669997777901) },
+ { FRAC_CONST(0.538793759131706), FRAC_CONST(0.842437703999961) },
+ { FRAC_CONST(0.536034008088628), FRAC_CONST(0.844196388391019) },
+ { FRAC_CONST(0.533268516551970), FRAC_CONST(0.845946032116980) },
+ { FRAC_CONST(0.530497314137923), FRAC_CONST(0.847686616440563) },
+ { FRAC_CONST(0.527720430523840), FRAC_CONST(0.849418122721510) },
+ { FRAC_CONST(0.524937895447912), FRAC_CONST(0.851140532416778) },
+ { FRAC_CONST(0.522149738708856), FRAC_CONST(0.852853827080745) },
+ { FRAC_CONST(0.519355990165590), FRAC_CONST(0.854557988365401) },
+ { FRAC_CONST(0.516556679736915), FRAC_CONST(0.856252998020546) },
+ { FRAC_CONST(0.513751837401199), FRAC_CONST(0.857938837893991) },
+ { FRAC_CONST(0.510941493196049), FRAC_CONST(0.859615489931744) },
+ { FRAC_CONST(0.508125677217994), FRAC_CONST(0.861282936178208) },
+ { FRAC_CONST(0.505304419622159), FRAC_CONST(0.862941158776375) },
+ { FRAC_CONST(0.502477750621949), FRAC_CONST(0.864590139968012) },
+ { FRAC_CONST(0.499645700488717), FRAC_CONST(0.866229862093855) },
+ { FRAC_CONST(0.496808299551444), FRAC_CONST(0.867860307593799) },
+ { FRAC_CONST(0.493965578196415), FRAC_CONST(0.869481459007080) },
+ { FRAC_CONST(0.491117566866892), FRAC_CONST(0.871093298972471) },
+ { FRAC_CONST(0.488264296062789), FRAC_CONST(0.872695810228461) },
+ { FRAC_CONST(0.485405796340343), FRAC_CONST(0.874288975613440) },
+ { FRAC_CONST(0.482542098311789), FRAC_CONST(0.875872778065888) },
+ { FRAC_CONST(0.479673232645033), FRAC_CONST(0.877447200624553) },
+ { FRAC_CONST(0.476799230063322), FRAC_CONST(0.879012226428633) },
+ { FRAC_CONST(0.473920121344914), FRAC_CONST(0.880567838717962) },
+ { FRAC_CONST(0.471035937322751), FRAC_CONST(0.882114020833179) },
+ { FRAC_CONST(0.468146708884125), FRAC_CONST(0.883650756215917) },
+ { FRAC_CONST(0.465252466970353), FRAC_CONST(0.885178028408975) },
+ { FRAC_CONST(0.462353242576441), FRAC_CONST(0.886695821056495) },
+ { FRAC_CONST(0.459449066750752), FRAC_CONST(0.888204117904136) },
+ { FRAC_CONST(0.456539970594675), FRAC_CONST(0.889702902799251) },
+ { FRAC_CONST(0.453625985262295), FRAC_CONST(0.891192159691058) },
+ { FRAC_CONST(0.450707141960053), FRAC_CONST(0.892671872630812) },
+ { FRAC_CONST(0.447783471946415), FRAC_CONST(0.894142025771977) },
+ { FRAC_CONST(0.444855006531538), FRAC_CONST(0.895602603370393) },
+ { FRAC_CONST(0.441921777076935), FRAC_CONST(0.897053589784447) },
+ { FRAC_CONST(0.438983814995137), FRAC_CONST(0.898494969475242) },
+ { FRAC_CONST(0.436041151749356), FRAC_CONST(0.899926727006758) },
+ { FRAC_CONST(0.433093818853152), FRAC_CONST(0.901348847046022) },
+ { FRAC_CONST(0.430141847870093), FRAC_CONST(0.902761314363272) },
+ { FRAC_CONST(0.427185270413416), FRAC_CONST(0.904164113832116) },
+ { FRAC_CONST(0.424224118145690), FRAC_CONST(0.905557230429701) },
+ { FRAC_CONST(0.421258422778478), FRAC_CONST(0.906940649236866) },
+ { FRAC_CONST(0.418288216071994), FRAC_CONST(0.908314355438308) },
+ { FRAC_CONST(0.415313529834766), FRAC_CONST(0.909678334322736) },
+ { FRAC_CONST(0.412334395923293), FRAC_CONST(0.911032571283032) },
+ { FRAC_CONST(0.409350846241706), FRAC_CONST(0.912377051816407) },
+ { FRAC_CONST(0.406362912741425), FRAC_CONST(0.913711761524555) },
+ { FRAC_CONST(0.403370627420818), FRAC_CONST(0.915036686113806) },
+ { FRAC_CONST(0.400374022324857), FRAC_CONST(0.916351811395282) },
+ { FRAC_CONST(0.397373129544774), FRAC_CONST(0.917657123285050) },
+ { FRAC_CONST(0.394367981217720), FRAC_CONST(0.918952607804266) },
+ { FRAC_CONST(0.391358609526420), FRAC_CONST(0.920238251079332) },
+ { FRAC_CONST(0.388345046698826), FRAC_CONST(0.921514039342042) },
+ { FRAC_CONST(0.385327325007776), FRAC_CONST(0.922779958929729) },
+ { FRAC_CONST(0.382305476770645), FRAC_CONST(0.924035996285410) },
+ { FRAC_CONST(0.379279534348999), FRAC_CONST(0.925282137957935) },
+ { FRAC_CONST(0.376249530148250), FRAC_CONST(0.926518370602127) },
+ { FRAC_CONST(0.373215496617310), FRAC_CONST(0.927744680978929) },
+ { FRAC_CONST(0.370177466248239), FRAC_CONST(0.928961055955541) },
+ { FRAC_CONST(0.367135471575903), FRAC_CONST(0.930167482505564) },
+ { FRAC_CONST(0.364089545177621), FRAC_CONST(0.931363947709140) },
+ { FRAC_CONST(0.361039719672816), FRAC_CONST(0.932550438753087) },
+ { FRAC_CONST(0.357986027722671), FRAC_CONST(0.933726942931039) },
+ { FRAC_CONST(0.354928502029772), FRAC_CONST(0.934893447643582) },
+ { FRAC_CONST(0.351867175337763), FRAC_CONST(0.936049940398387) },
+ { FRAC_CONST(0.348802080430994), FRAC_CONST(0.937196408810347) },
+ { FRAC_CONST(0.345733250134169), FRAC_CONST(0.938332840601705) },
+ { FRAC_CONST(0.342660717311994), FRAC_CONST(0.939459223602190) },
+ { FRAC_CONST(0.339584514868829), FRAC_CONST(0.940575545749145) },
+ { FRAC_CONST(0.336504675748328), FRAC_CONST(0.941681795087657) },
+ { FRAC_CONST(0.333421232933097), FRAC_CONST(0.942777959770684) },
+ { FRAC_CONST(0.330334219444328), FRAC_CONST(0.943864028059183) },
+ { FRAC_CONST(0.327243668341457), FRAC_CONST(0.944939988322235) },
+ { FRAC_CONST(0.324149612721804), FRAC_CONST(0.946005829037171) },
+ { FRAC_CONST(0.321052085720218), FRAC_CONST(0.947061538789691) },
+ { FRAC_CONST(0.317951120508725), FRAC_CONST(0.948107106273994) },
+ { FRAC_CONST(0.314846750296171), FRAC_CONST(0.949142520292891) },
+ { FRAC_CONST(0.311739008327867), FRAC_CONST(0.950167769757930) },
+ { FRAC_CONST(0.308627927885232), FRAC_CONST(0.951182843689513) },
+ { FRAC_CONST(0.305513542285440), FRAC_CONST(0.952187731217013) },
+ { FRAC_CONST(0.302395884881056), FRAC_CONST(0.953182421578893) },
+ { FRAC_CONST(0.299274989059689), FRAC_CONST(0.954166904122818) },
+ { FRAC_CONST(0.296150888243624), FRAC_CONST(0.955141168305771) },
+ { FRAC_CONST(0.293023615889471), FRAC_CONST(0.956105203694164) },
+ { FRAC_CONST(0.289893205487806), FRAC_CONST(0.957058999963955) },
+ { FRAC_CONST(0.286759690562807), FRAC_CONST(0.958002546900750) },
+ { FRAC_CONST(0.283623104671904), FRAC_CONST(0.958935834399920) },
+ { FRAC_CONST(0.280483481405410), FRAC_CONST(0.959858852466706) },
+ { FRAC_CONST(0.277340854386169), FRAC_CONST(0.960771591216325) },
+ { FRAC_CONST(0.274195257269191), FRAC_CONST(0.961674040874080) },
+ { FRAC_CONST(0.271046723741295), FRAC_CONST(0.962566191775459) },
+ { FRAC_CONST(0.267895287520743), FRAC_CONST(0.963448034366243) },
+ { FRAC_CONST(0.264740982356888), FRAC_CONST(0.964319559202607) },
+ { FRAC_CONST(0.261583842029803), FRAC_CONST(0.965180756951218) },
+ { FRAC_CONST(0.258423900349924), FRAC_CONST(0.966031618389343) },
+ { FRAC_CONST(0.255261191157689), FRAC_CONST(0.966872134404937) },
+ { FRAC_CONST(0.252095748323171), FRAC_CONST(0.967702295996750) },
+ { FRAC_CONST(0.248927605745720), FRAC_CONST(0.968522094274417) },
+ { FRAC_CONST(0.245756797353599), FRAC_CONST(0.969331520458559) },
+ { FRAC_CONST(0.242583357103617), FRAC_CONST(0.970130565880871) },
+ { FRAC_CONST(0.239407318980770), FRAC_CONST(0.970919221984218) },
+ { FRAC_CONST(0.236228716997876), FRAC_CONST(0.971697480322728) },
+ { FRAC_CONST(0.233047585195206), FRAC_CONST(0.972465332561878) },
+ { FRAC_CONST(0.229863957640129), FRAC_CONST(0.973222770478587) },
+ { FRAC_CONST(0.226677868426735), FRAC_CONST(0.973969785961306) },
+ { FRAC_CONST(0.223489351675482), FRAC_CONST(0.974706371010097) },
+ { FRAC_CONST(0.220298441532823), FRAC_CONST(0.975432517736727) },
+ { FRAC_CONST(0.217105172170841), FRAC_CONST(0.976148218364747) },
+ { FRAC_CONST(0.213909577786886), FRAC_CONST(0.976853465229579) },
+ { FRAC_CONST(0.210711692603206), FRAC_CONST(0.977548250778596) },
+ { FRAC_CONST(0.207511550866582), FRAC_CONST(0.978232567571202) },
+ { FRAC_CONST(0.204309186847962), FRAC_CONST(0.978906408278914) },
+ { FRAC_CONST(0.201104634842092), FRAC_CONST(0.979569765685441) },
+ { FRAC_CONST(0.197897929167148), FRAC_CONST(0.980222632686756) },
+ { FRAC_CONST(0.194689104164373), FRAC_CONST(0.980865002291179) },
+ { FRAC_CONST(0.191478194197704), FRAC_CONST(0.981496867619447) },
+ { FRAC_CONST(0.188265233653407), FRAC_CONST(0.982118221904791) },
+ { FRAC_CONST(0.185050256939710), FRAC_CONST(0.982729058493005) },
+ { FRAC_CONST(0.181833298486427), FRAC_CONST(0.983329370842520) },
+ { FRAC_CONST(0.178614392744603), FRAC_CONST(0.983919152524473) },
+ { FRAC_CONST(0.175393574186129), FRAC_CONST(0.984498397222776) },
+ { FRAC_CONST(0.172170877303385), FRAC_CONST(0.985067098734184) },
+ { FRAC_CONST(0.168946336608867), FRAC_CONST(0.985625250968360) },
+ { FRAC_CONST(0.165719986634814), FRAC_CONST(0.986172847947943) },
+ { FRAC_CONST(0.162491861932842), FRAC_CONST(0.986709883808609) },
+ { FRAC_CONST(0.159261997073573), FRAC_CONST(0.987236352799134) },
+ { FRAC_CONST(0.156030426646266), FRAC_CONST(0.987752249281460) },
+ { FRAC_CONST(0.152797185258443), FRAC_CONST(0.988257567730749) },
+ { FRAC_CONST(0.149562307535523), FRAC_CONST(0.988752302735447) },
+ { FRAC_CONST(0.146325828120446), FRAC_CONST(0.989236448997339) },
+ { FRAC_CONST(0.143087781673307), FRAC_CONST(0.989710001331608) },
+ { FRAC_CONST(0.139848202870981), FRAC_CONST(0.990172954666889) },
+ { FRAC_CONST(0.136607126406757), FRAC_CONST(0.990625304045323) },
+ { FRAC_CONST(0.133364586989957), FRAC_CONST(0.991067044622612) },
+ { FRAC_CONST(0.130120619345575), FRAC_CONST(0.991498171668069) },
+ { FRAC_CONST(0.126875258213898), FRAC_CONST(0.991918680564670) },
+ { FRAC_CONST(0.123628538350136), FRAC_CONST(0.992328566809103) },
+ { FRAC_CONST(0.120380494524051), FRAC_CONST(0.992727826011815) },
+ { FRAC_CONST(0.117131161519582), FRAC_CONST(0.993116453897061) },
+ { FRAC_CONST(0.113880574134475), FRAC_CONST(0.993494446302948) },
+ { FRAC_CONST(0.110628767179910), FRAC_CONST(0.993861799181482) },
+ { FRAC_CONST(0.107375775480128), FRAC_CONST(0.994218508598608) },
+ { FRAC_CONST(0.104121633872055), FRAC_CONST(0.994564570734255) },
+ { FRAC_CONST(0.100866377204933), FRAC_CONST(0.994899981882376) },
+ { FRAC_CONST(0.097610040339947), FRAC_CONST(0.995224738450986) },
+ { FRAC_CONST(0.094352658149849), FRAC_CONST(0.995538836962204) },
+ { FRAC_CONST(0.091094265518583), FRAC_CONST(0.995842274052287) },
+ { FRAC_CONST(0.087834897340919), FRAC_CONST(0.996135046471667) },
+ { FRAC_CONST(0.084574588522070), FRAC_CONST(0.996417151084987) },
+ { FRAC_CONST(0.081313373977324), FRAC_CONST(0.996688584871134) },
+ { FRAC_CONST(0.078051288631670), FRAC_CONST(0.996949344923269) },
+ { FRAC_CONST(0.074788367419420), FRAC_CONST(0.997199428448862) },
+ { FRAC_CONST(0.071524645283840), FRAC_CONST(0.997438832769720) },
+ { FRAC_CONST(0.068260157176771), FRAC_CONST(0.997667555322013) },
+ { FRAC_CONST(0.064994938058259), FRAC_CONST(0.997885593656308) },
+ { FRAC_CONST(0.061729022896176), FRAC_CONST(0.998092945437590) },
+ { FRAC_CONST(0.058462446665851), FRAC_CONST(0.998289608445286) },
+ { FRAC_CONST(0.055195244349690), FRAC_CONST(0.998475580573295) },
+ { FRAC_CONST(0.051927450936806), FRAC_CONST(0.998650859830004) },
+ { FRAC_CONST(0.048659101422640), FRAC_CONST(0.998815444338313) },
+ { FRAC_CONST(0.045390230808591), FRAC_CONST(0.998969332335654) },
+ { FRAC_CONST(0.042120874101635), FRAC_CONST(0.999112522174011) },
+ { FRAC_CONST(0.038851066313958), FRAC_CONST(0.999245012319936) },
+ { FRAC_CONST(0.035580842462574), FRAC_CONST(0.999366801354564) },
+ { FRAC_CONST(0.032310237568951), FRAC_CONST(0.999477887973635) },
+ { FRAC_CONST(0.029039286658643), FRAC_CONST(0.999578270987499) },
+ { FRAC_CONST(0.025768024760904), FRAC_CONST(0.999667949321134) },
+ { FRAC_CONST(0.022496486908322), FRAC_CONST(0.999746922014158) },
+ { FRAC_CONST(0.019224708136438), FRAC_CONST(0.999815188220837) },
+ { FRAC_CONST(0.015952723483375), FRAC_CONST(0.999872747210095) },
+ { FRAC_CONST(0.012680567989461), FRAC_CONST(0.999919598365521) },
+ { FRAC_CONST(0.009408276696850), FRAC_CONST(0.999955741185376) },
+ { FRAC_CONST(0.006135884649155), FRAC_CONST(0.999981175282601) },
+ { FRAC_CONST(0.002863426891064), FRAC_CONST(0.999995900384816) }
+};
+
+#ifdef LD_DEC
+/* 240 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_960[] =
+{
+ { FRAC_CONST(0.999999665337326), FRAC_CONST(0.000818122995607) },
+ { FRAC_CONST(0.999972892444367), FRAC_CONST(0.007363041249780) },
+ { FRAC_CONST(0.999903284040864), FRAC_CONST(0.013907644095771) },
+ { FRAC_CONST(0.999790843108610), FRAC_CONST(0.020451651184577) },
+ { FRAC_CONST(0.999635574464198), FRAC_CONST(0.026994782192715) },
+ { FRAC_CONST(0.999437484758823), FRAC_CONST(0.033536756834230) },
+ { FRAC_CONST(0.999196582477986), FRAC_CONST(0.040077294872701) },
+ { FRAC_CONST(0.998912877941140), FRAC_CONST(0.046616116133247) },
+ { FRAC_CONST(0.998586383301244), FRAC_CONST(0.053152940514528) },
+ { FRAC_CONST(0.998217112544241), FRAC_CONST(0.059687488000744) },
+ { FRAC_CONST(0.997805081488460), FRAC_CONST(0.066219478673630) },
+ { FRAC_CONST(0.997350307783942), FRAC_CONST(0.072748632724445) },
+ { FRAC_CONST(0.996852810911678), FRAC_CONST(0.079274670465961) },
+ { FRAC_CONST(0.996312612182778), FRAC_CONST(0.085797312344440) },
+ { FRAC_CONST(0.995729734737558), FRAC_CONST(0.092316278951614) },
+ { FRAC_CONST(0.995104203544548), FRAC_CONST(0.098831291036650) },
+ { FRAC_CONST(0.994436045399422), FRAC_CONST(0.105342069518114) },
+ { FRAC_CONST(0.993725288923851), FRAC_CONST(0.111848335495926) },
+ { FRAC_CONST(0.992971964564277), FRAC_CONST(0.118349810263305) },
+ { FRAC_CONST(0.992176104590608), FRAC_CONST(0.124846215318711) },
+ { FRAC_CONST(0.991337743094838), FRAC_CONST(0.131337272377774) },
+ { FRAC_CONST(0.990456915989581), FRAC_CONST(0.137822703385212) },
+ { FRAC_CONST(0.989533661006540), FRAC_CONST(0.144302230526747) },
+ { FRAC_CONST(0.988568017694885), FRAC_CONST(0.150775576241001) },
+ { FRAC_CONST(0.987560027419562), FRAC_CONST(0.157242463231389) },
+ { FRAC_CONST(0.986509733359519), FRAC_CONST(0.163702614477995) },
+ { FRAC_CONST(0.985417180505858), FRAC_CONST(0.170155753249442) },
+ { FRAC_CONST(0.984282415659907), FRAC_CONST(0.176601603114742) },
+ { FRAC_CONST(0.983105487431216), FRAC_CONST(0.183039887955141) },
+ { FRAC_CONST(0.981886446235473), FRAC_CONST(0.189470331975943) },
+ { FRAC_CONST(0.980625344292344), FRAC_CONST(0.195892659718330) },
+ { FRAC_CONST(0.979322235623241), FRAC_CONST(0.202306596071156) },
+ { FRAC_CONST(0.977977176049000), FRAC_CONST(0.208711866282735) },
+ { FRAC_CONST(0.976590223187499), FRAC_CONST(0.215108195972610) },
+ { FRAC_CONST(0.975161436451181), FRAC_CONST(0.221495311143304) },
+ { FRAC_CONST(0.973690877044515), FRAC_CONST(0.227872938192063) },
+ { FRAC_CONST(0.972178607961371), FRAC_CONST(0.234240803922570) },
+ { FRAC_CONST(0.970624693982323), FRAC_CONST(0.240598635556650) },
+ { FRAC_CONST(0.969029201671875), FRAC_CONST(0.246946160745958) },
+ { FRAC_CONST(0.967392199375607), FRAC_CONST(0.253283107583640) },
+ { FRAC_CONST(0.965713757217249), FRAC_CONST(0.259609204615985) },
+ { FRAC_CONST(0.963993947095677), FRAC_CONST(0.265924180854051) },
+ { FRAC_CONST(0.962232842681832), FRAC_CONST(0.272227765785273) },
+ { FRAC_CONST(0.960430519415566), FRAC_CONST(0.278519689385053) },
+ { FRAC_CONST(0.958587054502409), FRAC_CONST(0.284799682128326) },
+ { FRAC_CONST(0.956702526910263), FRAC_CONST(0.291067475001103) },
+ { FRAC_CONST(0.954777017366017), FRAC_CONST(0.297322799511998) },
+ { FRAC_CONST(0.952810608352092), FRAC_CONST(0.303565387703730) },
+ { FRAC_CONST(0.950803384102905), FRAC_CONST(0.309794972164597) },
+ { FRAC_CONST(0.948755430601263), FRAC_CONST(0.316011286039934) },
+ { FRAC_CONST(0.946666835574676), FRAC_CONST(0.322214063043544) },
+ { FRAC_CONST(0.944537688491606), FRAC_CONST(0.328403037469105) },
+ { FRAC_CONST(0.942368080557626), FRAC_CONST(0.334577944201551) },
+ { FRAC_CONST(0.940158104711519), FRAC_CONST(0.340738518728429) },
+ { FRAC_CONST(0.937907855621296), FRAC_CONST(0.346884497151231) },
+ { FRAC_CONST(0.935617429680138), FRAC_CONST(0.353015616196696) },
+ { FRAC_CONST(0.933286925002268), FRAC_CONST(0.359131613228090) },
+ { FRAC_CONST(0.930916441418752), FRAC_CONST(0.365232226256457) },
+ { FRAC_CONST(0.928506080473216), FRAC_CONST(0.371317193951838) },
+ { FRAC_CONST(0.926055945417500), FRAC_CONST(0.377386255654469) },
+ { FRAC_CONST(0.923566141207236), FRAC_CONST(0.383439151385947) },
+ { FRAC_CONST(0.921036774497350), FRAC_CONST(0.389475621860365) },
+ { FRAC_CONST(0.918467953637492), FRAC_CONST(0.395495408495417) },
+ { FRAC_CONST(0.915859788667400), FRAC_CONST(0.401498253423481) },
+ { FRAC_CONST(0.913212391312179), FRAC_CONST(0.407483899502658) },
+ { FRAC_CONST(0.910525874977521), FRAC_CONST(0.413452090327791) },
+ { FRAC_CONST(0.907800354744844), FRAC_CONST(0.419402570241451) },
+ { FRAC_CONST(0.905035947366364), FRAC_CONST(0.425335084344881) },
+ { FRAC_CONST(0.902232771260093), FRAC_CONST(0.431249378508924) },
+ { FRAC_CONST(0.899390946504764), FRAC_CONST(0.437145199384900) },
+ { FRAC_CONST(0.896510594834693), FRAC_CONST(0.443022294415467) },
+ { FRAC_CONST(0.893591839634558), FRAC_CONST(0.448880411845433) },
+ { FRAC_CONST(0.890634805934118), FRAC_CONST(0.454719300732547) },
+ { FRAC_CONST(0.887639620402854), FRAC_CONST(0.460538710958240) },
+ { FRAC_CONST(0.884606411344546), FRAC_CONST(0.466338393238348) },
+ { FRAC_CONST(0.881535308691775), FRAC_CONST(0.472118099133784) },
+ { FRAC_CONST(0.878426444000357), FRAC_CONST(0.477877581061184) },
+ { FRAC_CONST(0.875279950443708), FRAC_CONST(0.483616592303511) },
+ { FRAC_CONST(0.872095962807140), FRAC_CONST(0.489334887020625) },
+ { FRAC_CONST(0.868874617482085), FRAC_CONST(0.495032220259813) },
+ { FRAC_CONST(0.865616052460258), FRAC_CONST(0.500708347966279) },
+ { FRAC_CONST(0.862320407327736), FRAC_CONST(0.506363026993605) },
+ { FRAC_CONST(0.858987823258990), FRAC_CONST(0.511996015114162) },
+ { FRAC_CONST(0.855618443010829), FRAC_CONST(0.517607071029487) },
+ { FRAC_CONST(0.852212410916289), FRAC_CONST(0.523195954380619) },
+ { FRAC_CONST(0.848769872878448), FRAC_CONST(0.528762425758396) },
+ { FRAC_CONST(0.845290976364179), FRAC_CONST(0.534306246713712) },
+ { FRAC_CONST(0.841775870397828), FRAC_CONST(0.539827179767727) },
+ { FRAC_CONST(0.838224705554838), FRAC_CONST(0.545324988422046) },
+ { FRAC_CONST(0.834637633955290), FRAC_CONST(0.550799437168844) },
+ { FRAC_CONST(0.831014809257393), FRAC_CONST(0.556250291500956) },
+ { FRAC_CONST(0.827356386650900), FRAC_CONST(0.561677317921925) },
+ { FRAC_CONST(0.823662522850458), FRAC_CONST(0.567080283956001) },
+ { FRAC_CONST(0.819933376088899), FRAC_CONST(0.572458958158102) },
+ { FRAC_CONST(0.816169106110459), FRAC_CONST(0.577813110123727) },
+ { FRAC_CONST(0.812369874163934), FRAC_CONST(0.583142510498826) },
+ { FRAC_CONST(0.808535842995778), FRAC_CONST(0.588446930989624) },
+ { FRAC_CONST(0.804667176843123), FRAC_CONST(0.593726144372402) },
+ { FRAC_CONST(0.800764041426753), FRAC_CONST(0.598979924503229) },
+ { FRAC_CONST(0.796826603943998), FRAC_CONST(0.604208046327650) },
+ { FRAC_CONST(0.792855033061574), FRAC_CONST(0.609410285890327) },
+ { FRAC_CONST(0.788849498908361), FRAC_CONST(0.614586420344631) },
+ { FRAC_CONST(0.784810173068109), FRAC_CONST(0.619736227962191) },
+ { FRAC_CONST(0.780737228572094), FRAC_CONST(0.624859488142386) },
+ { FRAC_CONST(0.776630839891703), FRAC_CONST(0.629955981421804) },
+ { FRAC_CONST(0.772491182930959), FRAC_CONST(0.635025489483633) },
+ { FRAC_CONST(0.768318435018988), FRAC_CONST(0.640067795167023) },
+ { FRAC_CONST(0.764112774902423), FRAC_CONST(0.645082682476378) },
+ { FRAC_CONST(0.759874382737746), FRAC_CONST(0.650069936590618) },
+ { FRAC_CONST(0.755603440083571), FRAC_CONST(0.655029343872374) },
+ { FRAC_CONST(0.751300129892866), FRAC_CONST(0.659960691877147) },
+ { FRAC_CONST(0.746964636505118), FRAC_CONST(0.664863769362399) },
+ { FRAC_CONST(0.742597145638433), FRAC_CONST(0.669738366296610) },
+ { FRAC_CONST(0.738197844381584), FRAC_CONST(0.674584273868271) },
+ { FRAC_CONST(0.733766921185995), FRAC_CONST(0.679401284494831) },
+ { FRAC_CONST(0.729304565857668), FRAC_CONST(0.684189191831585) },
+ { FRAC_CONST(0.724810969549055), FRAC_CONST(0.688947790780520) },
+ { FRAC_CONST(0.720286324750863), FRAC_CONST(0.693676877499095) },
+ { FRAC_CONST(0.715730825283819), FRAC_CONST(0.698376249408973) },
+ { FRAC_CONST(0.711144666290356), FRAC_CONST(0.703045705204703) },
+ { FRAC_CONST(0.706528044226263), FRAC_CONST(0.707685044862340) },
+ { FRAC_CONST(0.701881156852263), FRAC_CONST(0.712294069648014) },
+ { FRAC_CONST(0.697204203225545), FRAC_CONST(0.716872582126442) },
+ { FRAC_CONST(0.692497383691237), FRAC_CONST(0.721420386169390) },
+ { FRAC_CONST(0.687760899873822), FRAC_CONST(0.725937286964068) },
+ { FRAC_CONST(0.682994954668502), FRAC_CONST(0.730423091021479) },
+ { FRAC_CONST(0.678199752232508), FRAC_CONST(0.734877606184707) },
+ { FRAC_CONST(0.673375497976352), FRAC_CONST(0.739300641637149) },
+ { FRAC_CONST(0.668522398555031), FRAC_CONST(0.743692007910687) },
+ { FRAC_CONST(0.663640661859171), FRAC_CONST(0.748051516893805) },
+ { FRAC_CONST(0.658730497006124), FRAC_CONST(0.752378981839648) },
+ { FRAC_CONST(0.653792114331011), FRAC_CONST(0.756674217374021) },
+ { FRAC_CONST(0.648825725377709), FRAC_CONST(0.760937039503328) },
+ { FRAC_CONST(0.643831542889792), FRAC_CONST(0.765167265622459) },
+ { FRAC_CONST(0.638809780801414), FRAC_CONST(0.769364714522605) },
+ { FRAC_CONST(0.633760654228152), FRAC_CONST(0.773529206399025) },
+ { FRAC_CONST(0.628684379457781), FRAC_CONST(0.777660562858748) },
+ { FRAC_CONST(0.623581173941019), FRAC_CONST(0.781758606928213) },
+ { FRAC_CONST(0.618451256282204), FRAC_CONST(0.785823163060853) },
+ { FRAC_CONST(0.613294846229936), FRAC_CONST(0.789854057144609) },
+ { FRAC_CONST(0.608112164667659), FRAC_CONST(0.793851116509396) },
+ { FRAC_CONST(0.602903433604202), FRAC_CONST(0.797814169934493) },
+ { FRAC_CONST(0.597668876164268), FRAC_CONST(0.801743047655882) },
+ { FRAC_CONST(0.592408716578875), FRAC_CONST(0.805637581373517) },
+ { FRAC_CONST(0.587123180175754), FRAC_CONST(0.809497604258536) },
+ { FRAC_CONST(0.581812493369691), FRAC_CONST(0.813322950960406) },
+ { FRAC_CONST(0.576476883652835), FRAC_CONST(0.817113457614006) },
+ { FRAC_CONST(0.571116579584947), FRAC_CONST(0.820868961846646) },
+ { FRAC_CONST(0.565731810783613), FRAC_CONST(0.824589302785025) },
+ { FRAC_CONST(0.560322807914407), FRAC_CONST(0.828274321062119) },
+ { FRAC_CONST(0.554889802681009), FRAC_CONST(0.831923858824010) },
+ { FRAC_CONST(0.549433027815281), FRAC_CONST(0.835537759736646) },
+ { FRAC_CONST(0.543952717067296), FRAC_CONST(0.839115868992540) },
+ { FRAC_CONST(0.538449105195327), FRAC_CONST(0.842658033317402) },
+ { FRAC_CONST(0.532922427955790), FRAC_CONST(0.846164100976699) },
+ { FRAC_CONST(0.527372922093142), FRAC_CONST(0.849633921782164) },
+ { FRAC_CONST(0.521800825329746), FRAC_CONST(0.853067347098221) },
+ { FRAC_CONST(0.516206376355680), FRAC_CONST(0.856464229848356) },
+ { FRAC_CONST(0.510589814818519), FRAC_CONST(0.859824424521420) },
+ { FRAC_CONST(0.504951381313066), FRAC_CONST(0.863147787177854) },
+ { FRAC_CONST(0.499291317371047), FRAC_CONST(0.866434175455865) },
+ { FRAC_CONST(0.493609865450762), FRAC_CONST(0.869683448577516) },
+ { FRAC_CONST(0.487907268926702), FRAC_CONST(0.872895467354761) },
+ { FRAC_CONST(0.482183772079123), FRAC_CONST(0.876070094195407) },
+ { FRAC_CONST(0.476439620083580), FRAC_CONST(0.879207193109004) },
+ { FRAC_CONST(0.470675059000427), FRAC_CONST(0.882306629712678) },
+ { FRAC_CONST(0.464890335764274), FRAC_CONST(0.885368271236879) },
+ { FRAC_CONST(0.459085698173413), FRAC_CONST(0.888391986531075) },
+ { FRAC_CONST(0.453261394879198), FRAC_CONST(0.891377646069366) },
+ { FRAC_CONST(0.447417675375397), FRAC_CONST(0.894325121956035) },
+ { FRAC_CONST(0.441554789987504), FRAC_CONST(0.897234287931024) },
+ { FRAC_CONST(0.435672989862017), FRAC_CONST(0.900105019375345) },
+ { FRAC_CONST(0.429772526955677), FRAC_CONST(0.902937193316419) },
+ { FRAC_CONST(0.423853654024676), FRAC_CONST(0.905730688433339) },
+ { FRAC_CONST(0.417916624613831), FRAC_CONST(0.908485385062073) },
+ { FRAC_CONST(0.411961693045722), FRAC_CONST(0.911201165200584) },
+ { FRAC_CONST(0.405989114409798), FRAC_CONST(0.913877912513892) },
+ { FRAC_CONST(0.399999144551449), FRAC_CONST(0.916515512339049) },
+ { FRAC_CONST(0.393992040061048), FRAC_CONST(0.919113851690058) },
+ { FRAC_CONST(0.387968058262959), FRAC_CONST(0.921672819262709) },
+ { FRAC_CONST(0.381927457204511), FRAC_CONST(0.924192305439348) },
+ { FRAC_CONST(0.375870495644949), FRAC_CONST(0.926672202293573) },
+ { FRAC_CONST(0.369797433044349), FRAC_CONST(0.929112403594856) },
+ { FRAC_CONST(0.363708529552499), FRAC_CONST(0.931512804813095) },
+ { FRAC_CONST(0.357604045997758), FRAC_CONST(0.933873303123091) },
+ { FRAC_CONST(0.351484243875885), FRAC_CONST(0.936193797408954) },
+ { FRAC_CONST(0.345349385338836), FRAC_CONST(0.938474188268430) },
+ { FRAC_CONST(0.339199733183530), FRAC_CONST(0.940714378017165) },
+ { FRAC_CONST(0.333035550840599), FRAC_CONST(0.942914270692887) },
+ { FRAC_CONST(0.326857102363098), FRAC_CONST(0.945073772059514) },
+ { FRAC_CONST(0.320664652415198), FRAC_CONST(0.947192789611197) },
+ { FRAC_CONST(0.314458466260842), FRAC_CONST(0.949271232576274) },
+ { FRAC_CONST(0.308238809752391), FRAC_CONST(0.951309011921168) },
+ { FRAC_CONST(0.302005949319228), FRAC_CONST(0.953306040354194) },
+ { FRAC_CONST(0.295760151956351), FRAC_CONST(0.955262232329299) },
+ { FRAC_CONST(0.289501685212929), FRAC_CONST(0.957177504049732) },
+ { FRAC_CONST(0.283230817180850), FRAC_CONST(0.959051773471624) },
+ { FRAC_CONST(0.276947816483228), FRAC_CONST(0.960884960307514) },
+ { FRAC_CONST(0.270652952262902), FRAC_CONST(0.962676986029777) },
+ { FRAC_CONST(0.264346494170904), FRAC_CONST(0.964427773873996) },
+ { FRAC_CONST(0.258028712354909), FRAC_CONST(0.966137248842248) },
+ { FRAC_CONST(0.251699877447663), FRAC_CONST(0.967805337706313) },
+ { FRAC_CONST(0.245360260555389), FRAC_CONST(0.969431969010818) },
+ { FRAC_CONST(0.239010133246176), FRAC_CONST(0.971017073076290) },
+ { FRAC_CONST(0.232649767538342), FRAC_CONST(0.972560582002147) },
+ { FRAC_CONST(0.226279435888785), FRAC_CONST(0.974062429669605) },
+ { FRAC_CONST(0.219899411181310), FRAC_CONST(0.975522551744506) },
+ { FRAC_CONST(0.213509966714943), FRAC_CONST(0.976940885680082) },
+ { FRAC_CONST(0.207111376192219), FRAC_CONST(0.978317370719628) },
+ { FRAC_CONST(0.200703913707458), FRAC_CONST(0.979651947899104) },
+ { FRAC_CONST(0.194287853735029), FRAC_CONST(0.980944560049668) },
+ { FRAC_CONST(0.187863471117585), FRAC_CONST(0.982195151800116) },
+ { FRAC_CONST(0.181431041054297), FRAC_CONST(0.983403669579260) },
+ { FRAC_CONST(0.174990839089060), FRAC_CONST(0.984570061618221) },
+ { FRAC_CONST(0.168543141098691), FRAC_CONST(0.985694277952645) },
+ { FRAC_CONST(0.162088223281113), FRAC_CONST(0.986776270424848) },
+ { FRAC_CONST(0.155626362143520), FRAC_CONST(0.987815992685872) },
+ { FRAC_CONST(0.149157834490539), FRAC_CONST(0.988813400197476) },
+ { FRAC_CONST(0.142682917412363), FRAC_CONST(0.989768450234042) },
+ { FRAC_CONST(0.136201888272891), FRAC_CONST(0.990681101884405) },
+ { FRAC_CONST(0.129715024697841), FRAC_CONST(0.991551316053606) },
+ { FRAC_CONST(0.123222604562857), FRAC_CONST(0.992379055464567) },
+ { FRAC_CONST(0.116724905981611), FRAC_CONST(0.993164284659685) },
+ { FRAC_CONST(0.110222207293883), FRAC_CONST(0.993906970002356) },
+ { FRAC_CONST(0.103714787053643), FRAC_CONST(0.994607079678411) },
+ { FRAC_CONST(0.097202924017115), FRAC_CONST(0.995264583697482) },
+ { FRAC_CONST(0.090686897130838), FRAC_CONST(0.995879453894286) },
+ { FRAC_CONST(0.084166985519718), FRAC_CONST(0.996451663929828) },
+ { FRAC_CONST(0.077643468475068), FRAC_CONST(0.996981189292537) },
+ { FRAC_CONST(0.071116625442645), FRAC_CONST(0.997468007299307) },
+ { FRAC_CONST(0.064586736010684), FRAC_CONST(0.997912097096476) },
+ { FRAC_CONST(0.058054079897912), FRAC_CONST(0.998313439660714) },
+ { FRAC_CONST(0.051518936941578), FRAC_CONST(0.998672017799843) },
+ { FRAC_CONST(0.044981587085452), FRAC_CONST(0.998987816153567) },
+ { FRAC_CONST(0.038442310367847), FRAC_CONST(0.999260821194138) },
+ { FRAC_CONST(0.031901386909611), FRAC_CONST(0.999491021226926) },
+ { FRAC_CONST(0.025359096902136), FRAC_CONST(0.999678406390929) },
+ { FRAC_CONST(0.018815720595351), FRAC_CONST(0.999822968659191) },
+ { FRAC_CONST(0.012271538285720), FRAC_CONST(0.999924701839145) },
+ { FRAC_CONST(0.005726830304231), FRAC_CONST(0.999983601572879) }
+};
+#endif // LD_DEC
+
+/* 60 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_240[] =
+{
+ { FRAC_CONST(0.999994645401696), FRAC_CONST(0.003272486506527) },
+ { FRAC_CONST(0.999566308502021), FRAC_CONST(0.029448173247963) },
+ { FRAC_CONST(0.998452918783950), FRAC_CONST(0.055603677682425) },
+ { FRAC_CONST(0.996655239309180), FRAC_CONST(0.081721074133668) },
+ { FRAC_CONST(0.994174502117428), FRAC_CONST(0.107782463042759) },
+ { FRAC_CONST(0.991012407382049), FRAC_CONST(0.133769983235535) },
+ { FRAC_CONST(0.987171122244825), FRAC_CONST(0.159665824163761) },
+ { FRAC_CONST(0.982653279330712), FRAC_CONST(0.185452238111591) },
+ { FRAC_CONST(0.977461974943572), FRAC_CONST(0.211111552358965) },
+ { FRAC_CONST(0.971600766944121), FRAC_CONST(0.236626181293610) },
+ { FRAC_CONST(0.965073672311547), FRAC_CONST(0.261978638463337) },
+ { FRAC_CONST(0.957885164390477), FRAC_CONST(0.287151548560387) },
+ { FRAC_CONST(0.950040169825165), FRAC_CONST(0.312127659329594) },
+ { FRAC_CONST(0.941544065183021), FRAC_CONST(0.336889853392220) },
+ { FRAC_CONST(0.932402673269775), FRAC_CONST(0.361421159977355) },
+ { FRAC_CONST(0.922622259138823), FRAC_CONST(0.385704766552831) },
+ { FRAC_CONST(0.912209525797468), FRAC_CONST(0.409724030347695) },
+ { FRAC_CONST(0.901171609613013), FRAC_CONST(0.433462489758331) },
+ { FRAC_CONST(0.889516075421856), FRAC_CONST(0.456903875630421) },
+ { FRAC_CONST(0.877250911344924), FRAC_CONST(0.480032122409011) },
+ { FRAC_CONST(0.864384523313017), FRAC_CONST(0.502831379149042) },
+ { FRAC_CONST(0.850925729305802), FRAC_CONST(0.525286020378792) },
+ { FRAC_CONST(0.836883753308409), FRAC_CONST(0.547380656808797) },
+ { FRAC_CONST(0.822268218989775), FRAC_CONST(0.569100145878898) },
+ { FRAC_CONST(0.807089143107059), FRAC_CONST(0.590429602136201) },
+ { FRAC_CONST(0.791356928640660), FRAC_CONST(0.611354407436816) },
+ { FRAC_CONST(0.775082357664531), FRAC_CONST(0.631860220964409) },
+ { FRAC_CONST(0.758276583956687), FRAC_CONST(0.651932989058674) },
+ { FRAC_CONST(0.740951125354959), FRAC_CONST(0.671558954847018) },
+ { FRAC_CONST(0.723117855863248), FRAC_CONST(0.690724667672829) },
+ { FRAC_CONST(0.704788997513670), FRAC_CONST(0.709416992313883) },
+ { FRAC_CONST(0.685977111990193), FRAC_CONST(0.727623117984575) },
+ { FRAC_CONST(0.666695092019479), FRAC_CONST(0.745330567115786) },
+ { FRAC_CONST(0.646956152534857), FRAC_CONST(0.762527203906388) },
+ { FRAC_CONST(0.626773821619469), FRAC_CONST(0.779201242640517) },
+ { FRAC_CONST(0.606161931234795), FRAC_CONST(0.795341255764910) },
+ { FRAC_CONST(0.585134607740916), FRAC_CONST(0.810936181720784) },
+ { FRAC_CONST(0.563706262215017), FRAC_CONST(0.825975332524873) },
+ { FRAC_CONST(0.541891580574752), FRAC_CONST(0.840448401094438) },
+ { FRAC_CONST(0.519705513513249), FRAC_CONST(0.854345468311227) },
+ { FRAC_CONST(0.497163266252654), FRAC_CONST(0.867657009819544) },
+ { FRAC_CONST(0.474280288123229), FRAC_CONST(0.880373902553765) },
+ { FRAC_CONST(0.451072261975153), FRAC_CONST(0.892487430990834) },
+ { FRAC_CONST(0.427555093430282), FRAC_CONST(0.903989293123443) },
+ { FRAC_CONST(0.403744899981227), FRAC_CONST(0.914871606149819) },
+ { FRAC_CONST(0.379657999945233), FRAC_CONST(0.925126911876195) },
+ { FRAC_CONST(0.355310901280416), FRAC_CONST(0.934748181828292) },
+ { FRAC_CONST(0.330720290272038), FRAC_CONST(0.943728822068278) },
+ { FRAC_CONST(0.305903020096554), FRAC_CONST(0.952062677713924) },
+ { FRAC_CONST(0.280876099271292), FRAC_CONST(0.959744037156857) },
+ { FRAC_CONST(0.255656679997665), FRAC_CONST(0.966767635977008) },
+ { FRAC_CONST(0.230262046405902), FRAC_CONST(0.973128660550580) },
+ { FRAC_CONST(0.204709602709380), FRAC_CONST(0.978822751349072) },
+ { FRAC_CONST(0.179016861276633), FRAC_CONST(0.983846005927077) },
+ { FRAC_CONST(0.153201430629259), FRAC_CONST(0.988194981596825) },
+ { FRAC_CONST(0.127281003373913), FRAC_CONST(0.991866697787626) },
+ { FRAC_CONST(0.101273344076683), FRAC_CONST(0.994858638088611) },
+ { FRAC_CONST(0.075196277088140), FRAC_CONST(0.997168751973348) },
+ { FRAC_CONST(0.049067674327418), FRAC_CONST(0.998795456205172) },
+ { FRAC_CONST(0.022905443033697), FRAC_CONST(0.999737635922260) }
+};
+#endif // ALLOW_SMALL_FRAMELENGTH
+
+#ifdef SSR_DEC
+/* 128 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_512[] =
+{
+ { FRAC_CONST(0.999998823451702), FRAC_CONST(0.001533980186285) },
+ { FRAC_CONST(0.999904701082853), FRAC_CONST(0.013805388528060) },
+ { FRAC_CONST(0.999659996743959), FRAC_CONST(0.026074717829104) },
+ { FRAC_CONST(0.999264747286594), FRAC_CONST(0.038340120373553) },
+ { FRAC_CONST(0.998719012233873), FRAC_CONST(0.050599749036899) },
+ { FRAC_CONST(0.998022873771486), FRAC_CONST(0.062851757564161) },
+ { FRAC_CONST(0.997176436735326), FRAC_CONST(0.075094300847921) },
+ { FRAC_CONST(0.996179828595697), FRAC_CONST(0.087325535206192) },
+ { FRAC_CONST(0.995033199438119), FRAC_CONST(0.099543618660069) },
+ { FRAC_CONST(0.993736721940725), FRAC_CONST(0.111746711211127) },
+ { FRAC_CONST(0.992290591348257), FRAC_CONST(0.123932975118512) },
+ { FRAC_CONST(0.990695025442665), FRAC_CONST(0.136100575175706) },
+ { FRAC_CONST(0.988950264510303), FRAC_CONST(0.148247678986896) },
+ { FRAC_CONST(0.987056571305751), FRAC_CONST(0.160372457242928) },
+ { FRAC_CONST(0.985014231012240), FRAC_CONST(0.172473083996796) },
+ { FRAC_CONST(0.982823551198705), FRAC_CONST(0.184547736938620) },
+ { FRAC_CONST(0.980484861773469), FRAC_CONST(0.196594597670080) },
+ { FRAC_CONST(0.977998514934557), FRAC_CONST(0.208611851978263) },
+ { FRAC_CONST(0.975364885116657), FRAC_CONST(0.220597690108874) },
+ { FRAC_CONST(0.972584368934732), FRAC_CONST(0.232550307038775) },
+ { FRAC_CONST(0.969657385124292), FRAC_CONST(0.244467902747824) },
+ { FRAC_CONST(0.966584374478333), FRAC_CONST(0.256348682489943) },
+ { FRAC_CONST(0.963365799780954), FRAC_CONST(0.268190857063403) },
+ { FRAC_CONST(0.960002145737666), FRAC_CONST(0.279992643080273) },
+ { FRAC_CONST(0.956493918902395), FRAC_CONST(0.291752263234989) },
+ { FRAC_CONST(0.952841647601199), FRAC_CONST(0.303467946572011) },
+ { FRAC_CONST(0.949045881852701), FRAC_CONST(0.315137928752522) },
+ { FRAC_CONST(0.945107193285261), FRAC_CONST(0.326760452320132) },
+ { FRAC_CONST(0.941026175050889), FRAC_CONST(0.338333766965541) },
+ { FRAC_CONST(0.936803441735922), FRAC_CONST(0.349856129790135) },
+ { FRAC_CONST(0.932439629268462), FRAC_CONST(0.361325805568454) },
+ { FRAC_CONST(0.927935394822618), FRAC_CONST(0.372741067009516) },
+ { FRAC_CONST(0.923291416719528), FRAC_CONST(0.384100195016935) },
+ { FRAC_CONST(0.918508394325212), FRAC_CONST(0.395401478947816) },
+ { FRAC_CONST(0.913587047945251), FRAC_CONST(0.406643216870369) },
+ { FRAC_CONST(0.908528118716306), FRAC_CONST(0.417823715820212) },
+ { FRAC_CONST(0.903332368494512), FRAC_CONST(0.428941292055329) },
+ { FRAC_CONST(0.898000579740740), FRAC_CONST(0.439994271309633) },
+ { FRAC_CONST(0.892533555402765), FRAC_CONST(0.450980989045104) },
+ { FRAC_CONST(0.886932118794342), FRAC_CONST(0.461899790702463) },
+ { FRAC_CONST(0.881197113471222), FRAC_CONST(0.472749031950343) },
+ { FRAC_CONST(0.875329403104111), FRAC_CONST(0.483527078932919) },
+ { FRAC_CONST(0.869329871348607), FRAC_CONST(0.494232308515960) },
+ { FRAC_CONST(0.863199421712124), FRAC_CONST(0.504863108531268) },
+ { FRAC_CONST(0.856938977417829), FRAC_CONST(0.515417878019463) },
+ { FRAC_CONST(0.850549481265603), FRAC_CONST(0.525895027471085) },
+ { FRAC_CONST(0.844031895490066), FRAC_CONST(0.536292979065963) },
+ { FRAC_CONST(0.837387201615662), FRAC_CONST(0.546610166910835) },
+ { FRAC_CONST(0.830616400308846), FRAC_CONST(0.556845037275160) },
+ { FRAC_CONST(0.823720511227391), FRAC_CONST(0.566996048825109) },
+ { FRAC_CONST(0.816700572866828), FRAC_CONST(0.577061672855679) },
+ { FRAC_CONST(0.809557642404051), FRAC_CONST(0.587040393520918) },
+ { FRAC_CONST(0.802292795538116), FRAC_CONST(0.596930708062197) },
+ { FRAC_CONST(0.794907126328237), FRAC_CONST(0.606731127034524) },
+ { FRAC_CONST(0.787401747029031), FRAC_CONST(0.616440174530854) },
+ { FRAC_CONST(0.779777787923015), FRAC_CONST(0.626056388404344) },
+ { FRAC_CONST(0.772036397150385), FRAC_CONST(0.635578320488556) },
+ { FRAC_CONST(0.764178740536117), FRAC_CONST(0.645004536815544) },
+ { FRAC_CONST(0.756206001414395), FRAC_CONST(0.654333617831800) },
+ { FRAC_CONST(0.748119380450404), FRAC_CONST(0.663564158612040) },
+ { FRAC_CONST(0.739920095459516), FRAC_CONST(0.672694769070773) },
+ { FRAC_CONST(0.731609381223893), FRAC_CONST(0.681724074171650) },
+ { FRAC_CONST(0.723188489306527), FRAC_CONST(0.690650714134535) },
+ { FRAC_CONST(0.714658687862769), FRAC_CONST(0.699473344640284) },
+ { FRAC_CONST(0.706021261449340), FRAC_CONST(0.708190637033195) },
+ { FRAC_CONST(0.697277510830887), FRAC_CONST(0.716801278521100) },
+ { FRAC_CONST(0.688428752784091), FRAC_CONST(0.725303972373061) },
+ { FRAC_CONST(0.679476319899365), FRAC_CONST(0.733697438114660) },
+ { FRAC_CONST(0.670421560380173), FRAC_CONST(0.741980411720831) },
+ { FRAC_CONST(0.661265837839992), FRAC_CONST(0.750151645806215) },
+ { FRAC_CONST(0.652010531096960), FRAC_CONST(0.758209909813015) },
+ { FRAC_CONST(0.642657033966227), FRAC_CONST(0.766153990196313) },
+ { FRAC_CONST(0.633206755050057), FRAC_CONST(0.773982690606823) },
+ { FRAC_CONST(0.623661117525695), FRAC_CONST(0.781694832071059) },
+ { FRAC_CONST(0.614021558931038), FRAC_CONST(0.789289253168886) },
+ { FRAC_CONST(0.604289530948156), FRAC_CONST(0.796764810208419) },
+ { FRAC_CONST(0.594466499184665), FRAC_CONST(0.804120377398266) },
+ { FRAC_CONST(0.584553942953015), FRAC_CONST(0.811354847017064) },
+ { FRAC_CONST(0.574553355047716), FRAC_CONST(0.818467129580299) },
+ { FRAC_CONST(0.564466241520520), FRAC_CONST(0.825456154004377) },
+ { FRAC_CONST(0.554294121453620), FRAC_CONST(0.832320867767930) },
+ { FRAC_CONST(0.544038526730884), FRAC_CONST(0.839060237070313) },
+ { FRAC_CONST(0.533701001807153), FRAC_CONST(0.845673246987299) },
+ { FRAC_CONST(0.523283103475656), FRAC_CONST(0.852158901623920) },
+ { FRAC_CONST(0.512786400633563), FRAC_CONST(0.858516224264443) },
+ { FRAC_CONST(0.502212474045711), FRAC_CONST(0.864744257519462) },
+ { FRAC_CONST(0.491562916106550), FRAC_CONST(0.870842063470079) },
+ { FRAC_CONST(0.480839330600334), FRAC_CONST(0.876808723809146) },
+ { FRAC_CONST(0.470043332459596), FRAC_CONST(0.882643339979563) },
+ { FRAC_CONST(0.459176547521944), FRAC_CONST(0.888345033309596) },
+ { FRAC_CONST(0.448240612285220), FRAC_CONST(0.893912945145203) },
+ { FRAC_CONST(0.437237173661044), FRAC_CONST(0.899346236979341) },
+ { FRAC_CONST(0.426167888726800), FRAC_CONST(0.904644090578246) },
+ { FRAC_CONST(0.415034424476082), FRAC_CONST(0.909805708104652) },
+ { FRAC_CONST(0.403838457567654), FRAC_CONST(0.914830312237946) },
+ { FRAC_CONST(0.392581674072952), FRAC_CONST(0.919717146291227) },
+ { FRAC_CONST(0.381265769222162), FRAC_CONST(0.924465474325263) },
+ { FRAC_CONST(0.369892447148934), FRAC_CONST(0.929074581259316) },
+ { FRAC_CONST(0.358463420633737), FRAC_CONST(0.933543772978836) },
+ { FRAC_CONST(0.346980410845924), FRAC_CONST(0.937872376439990) },
+ { FRAC_CONST(0.335445147084532), FRAC_CONST(0.942059739771017) },
+ { FRAC_CONST(0.323859366517853), FRAC_CONST(0.946105232370403) },
+ { FRAC_CONST(0.312224813921825), FRAC_CONST(0.950008245001843) },
+ { FRAC_CONST(0.300543241417273), FRAC_CONST(0.953768189885990) },
+ { FRAC_CONST(0.288816408206049), FRAC_CONST(0.957384500788976) },
+ { FRAC_CONST(0.277046080306100), FRAC_CONST(0.960856633107680) },
+ { FRAC_CONST(0.265234030285512), FRAC_CONST(0.964184063951746) },
+ { FRAC_CONST(0.253382036995570), FRAC_CONST(0.967366292222329) },
+ { FRAC_CONST(0.241491885302869), FRAC_CONST(0.970402838687556) },
+ { FRAC_CONST(0.229565365820519), FRAC_CONST(0.973293246054698) },
+ { FRAC_CONST(0.217604274638484), FRAC_CONST(0.976037079039039) },
+ { FRAC_CONST(0.205610413053099), FRAC_CONST(0.978633924429423) },
+ { FRAC_CONST(0.193585587295804), FRAC_CONST(0.981083391150487) },
+ { FRAC_CONST(0.181531608261125), FRAC_CONST(0.983385110321551) },
+ { FRAC_CONST(0.169450291233968), FRAC_CONST(0.985538735312176) },
+ { FRAC_CONST(0.157343455616238), FRAC_CONST(0.987543941794359) },
+ { FRAC_CONST(0.145212924652848), FRAC_CONST(0.989400427791380) },
+ { FRAC_CONST(0.133060525157139), FRAC_CONST(0.991107913723277) },
+ { FRAC_CONST(0.120888087235777), FRAC_CONST(0.992666142448948) },
+ { FRAC_CONST(0.108697444013139), FRAC_CONST(0.994074879304879) },
+ { FRAC_CONST(0.096490431355253), FRAC_CONST(0.995333912140482) },
+ { FRAC_CONST(0.084268887593324), FRAC_CONST(0.996443051350043) },
+ { FRAC_CONST(0.072034653246889), FRAC_CONST(0.997402129901275) },
+ { FRAC_CONST(0.059789570746640), FRAC_CONST(0.998211003360478) },
+ { FRAC_CONST(0.047535484156959), FRAC_CONST(0.998869549914284) },
+ { FRAC_CONST(0.035274238898214), FRAC_CONST(0.999377670388003) },
+ { FRAC_CONST(0.023007681468839), FRAC_CONST(0.999735288260562) },
+ { FRAC_CONST(0.010737659167265), FRAC_CONST(0.999942349676024) }
+};
+
+/* 16 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_64[] =
+{
+ { FRAC_CONST(0.999924701839145), FRAC_CONST(0.012271538285720) },
+ { FRAC_CONST(0.993906970002356), FRAC_CONST(0.110222207293883) },
+ { FRAC_CONST(0.978317370719628), FRAC_CONST(0.207111376192219) },
+ { FRAC_CONST(0.953306040354194), FRAC_CONST(0.302005949319228) },
+ { FRAC_CONST(0.919113851690058), FRAC_CONST(0.393992040061048) },
+ { FRAC_CONST(0.876070094195407), FRAC_CONST(0.482183772079123) },
+ { FRAC_CONST(0.824589302785025), FRAC_CONST(0.565731810783613) },
+ { FRAC_CONST(0.765167265622459), FRAC_CONST(0.643831542889791) },
+ { FRAC_CONST(0.698376249408973), FRAC_CONST(0.715730825283819) },
+ { FRAC_CONST(0.624859488142386), FRAC_CONST(0.780737228572094) },
+ { FRAC_CONST(0.545324988422046), FRAC_CONST(0.838224705554838) },
+ { FRAC_CONST(0.460538710958240), FRAC_CONST(0.887639620402854) },
+ { FRAC_CONST(0.371317193951838), FRAC_CONST(0.928506080473215) },
+ { FRAC_CONST(0.278519689385053), FRAC_CONST(0.960430519415566) },
+ { FRAC_CONST(0.183039887955141), FRAC_CONST(0.983105487431216) },
+ { FRAC_CONST(0.085797312344440), FRAC_CONST(0.996312612182778) }
+};
+#endif // SSR_DEC
+
+#else // FIXED_POINT
+
+/* 256 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_2048[] =
+{
+ { FRAC_CONST(0.031249997702054), FRAC_CONST(0.000011984224612) },
+ { FRAC_CONST(0.031249813866531), FRAC_CONST(0.000107857810004) },
+ { FRAC_CONST(0.031249335895858), FRAC_CONST(0.000203730380198) },
+ { FRAC_CONST(0.031248563794535), FRAC_CONST(0.000299601032804) },
+ { FRAC_CONST(0.031247497569829), FRAC_CONST(0.000395468865451) },
+ { FRAC_CONST(0.031246137231775), FRAC_CONST(0.000491332975794) },
+ { FRAC_CONST(0.031244482793177), FRAC_CONST(0.000587192461525) },
+ { FRAC_CONST(0.031242534269608), FRAC_CONST(0.000683046420376) },
+ { FRAC_CONST(0.031240291679407), FRAC_CONST(0.000778893950134) },
+ { FRAC_CONST(0.031237755043684), FRAC_CONST(0.000874734148645) },
+ { FRAC_CONST(0.031234924386313), FRAC_CONST(0.000970566113826) },
+ { FRAC_CONST(0.031231799733938), FRAC_CONST(0.001066388943669) },
+ { FRAC_CONST(0.031228381115970), FRAC_CONST(0.001162201736253) },
+ { FRAC_CONST(0.031224668564585), FRAC_CONST(0.001258003589751) },
+ { FRAC_CONST(0.031220662114728), FRAC_CONST(0.001353793602441) },
+ { FRAC_CONST(0.031216361804108), FRAC_CONST(0.001449570872710) },
+ { FRAC_CONST(0.031211767673203), FRAC_CONST(0.001545334499065) },
+ { FRAC_CONST(0.031206879765253), FRAC_CONST(0.001641083580144) },
+ { FRAC_CONST(0.031201698126266), FRAC_CONST(0.001736817214719) },
+ { FRAC_CONST(0.031196222805014), FRAC_CONST(0.001832534501709) },
+ { FRAC_CONST(0.031190453853031), FRAC_CONST(0.001928234540186) },
+ { FRAC_CONST(0.031184391324617), FRAC_CONST(0.002023916429386) },
+ { FRAC_CONST(0.031178035276836), FRAC_CONST(0.002119579268713) },
+ { FRAC_CONST(0.031171385769513), FRAC_CONST(0.002215222157753) },
+ { FRAC_CONST(0.031164442865236), FRAC_CONST(0.002310844196278) },
+ { FRAC_CONST(0.031157206629353), FRAC_CONST(0.002406444484258) },
+ { FRAC_CONST(0.031149677129975), FRAC_CONST(0.002502022121865) },
+ { FRAC_CONST(0.031141854437973), FRAC_CONST(0.002597576209488) },
+ { FRAC_CONST(0.031133738626977), FRAC_CONST(0.002693105847734) },
+ { FRAC_CONST(0.031125329773375), FRAC_CONST(0.002788610137442) },
+ { FRAC_CONST(0.031116627956316), FRAC_CONST(0.002884088179689) },
+ { FRAC_CONST(0.031107633257703), FRAC_CONST(0.002979539075801) },
+ { FRAC_CONST(0.031098345762200), FRAC_CONST(0.003074961927355) },
+ { FRAC_CONST(0.031088765557222), FRAC_CONST(0.003170355836197) },
+ { FRAC_CONST(0.031078892732942), FRAC_CONST(0.003265719904442) },
+ { FRAC_CONST(0.031068727382288), FRAC_CONST(0.003361053234488) },
+ { FRAC_CONST(0.031058269600939), FRAC_CONST(0.003456354929021) },
+ { FRAC_CONST(0.031047519487329), FRAC_CONST(0.003551624091024) },
+ { FRAC_CONST(0.031036477142640), FRAC_CONST(0.003646859823790) },
+ { FRAC_CONST(0.031025142670809), FRAC_CONST(0.003742061230921) },
+ { FRAC_CONST(0.031013516178519), FRAC_CONST(0.003837227416347) },
+ { FRAC_CONST(0.031001597775203), FRAC_CONST(0.003932357484328) },
+ { FRAC_CONST(0.030989387573042), FRAC_CONST(0.004027450539462) },
+ { FRAC_CONST(0.030976885686963), FRAC_CONST(0.004122505686697) },
+ { FRAC_CONST(0.030964092234638), FRAC_CONST(0.004217522031340) },
+ { FRAC_CONST(0.030951007336485), FRAC_CONST(0.004312498679058) },
+ { FRAC_CONST(0.030937631115663), FRAC_CONST(0.004407434735897) },
+ { FRAC_CONST(0.030923963698074), FRAC_CONST(0.004502329308281) },
+ { FRAC_CONST(0.030910005212362), FRAC_CONST(0.004597181503027) },
+ { FRAC_CONST(0.030895755789908), FRAC_CONST(0.004691990427350) },
+ { FRAC_CONST(0.030881215564835), FRAC_CONST(0.004786755188872) },
+ { FRAC_CONST(0.030866384674000), FRAC_CONST(0.004881474895632) },
+ { FRAC_CONST(0.030851263256996), FRAC_CONST(0.004976148656090) },
+ { FRAC_CONST(0.030835851456154), FRAC_CONST(0.005070775579142) },
+ { FRAC_CONST(0.030820149416533), FRAC_CONST(0.005165354774124) },
+ { FRAC_CONST(0.030804157285929), FRAC_CONST(0.005259885350819) },
+ { FRAC_CONST(0.030787875214864), FRAC_CONST(0.005354366419469) },
+ { FRAC_CONST(0.030771303356593), FRAC_CONST(0.005448797090784) },
+ { FRAC_CONST(0.030754441867095), FRAC_CONST(0.005543176475946) },
+ { FRAC_CONST(0.030737290905077), FRAC_CONST(0.005637503686619) },
+ { FRAC_CONST(0.030719850631972), FRAC_CONST(0.005731777834961) },
+ { FRAC_CONST(0.030702121211932), FRAC_CONST(0.005825998033626) },
+ { FRAC_CONST(0.030684102811835), FRAC_CONST(0.005920163395780) },
+ { FRAC_CONST(0.030665795601276), FRAC_CONST(0.006014273035101) },
+ { FRAC_CONST(0.030647199752570), FRAC_CONST(0.006108326065793) },
+ { FRAC_CONST(0.030628315440748), FRAC_CONST(0.006202321602594) },
+ { FRAC_CONST(0.030609142843557), FRAC_CONST(0.006296258760782) },
+ { FRAC_CONST(0.030589682141455), FRAC_CONST(0.006390136656185) },
+ { FRAC_CONST(0.030569933517616), FRAC_CONST(0.006483954405188) },
+ { FRAC_CONST(0.030549897157919), FRAC_CONST(0.006577711124743) },
+ { FRAC_CONST(0.030529573250956), FRAC_CONST(0.006671405932375) },
+ { FRAC_CONST(0.030508961988022), FRAC_CONST(0.006765037946194) },
+ { FRAC_CONST(0.030488063563118), FRAC_CONST(0.006858606284900) },
+ { FRAC_CONST(0.030466878172949), FRAC_CONST(0.006952110067791) },
+ { FRAC_CONST(0.030445406016919), FRAC_CONST(0.007045548414774) },
+ { FRAC_CONST(0.030423647297133), FRAC_CONST(0.007138920446372) },
+ { FRAC_CONST(0.030401602218392), FRAC_CONST(0.007232225283733) },
+ { FRAC_CONST(0.030379270988192), FRAC_CONST(0.007325462048634) },
+ { FRAC_CONST(0.030356653816724), FRAC_CONST(0.007418629863497) },
+ { FRAC_CONST(0.030333750916869), FRAC_CONST(0.007511727851390) },
+ { FRAC_CONST(0.030310562504198), FRAC_CONST(0.007604755136040) },
+ { FRAC_CONST(0.030287088796968), FRAC_CONST(0.007697710841838) },
+ { FRAC_CONST(0.030263330016124), FRAC_CONST(0.007790594093851) },
+ { FRAC_CONST(0.030239286385293), FRAC_CONST(0.007883404017824) },
+ { FRAC_CONST(0.030214958130781), FRAC_CONST(0.007976139740197) },
+ { FRAC_CONST(0.030190345481576), FRAC_CONST(0.008068800388104) },
+ { FRAC_CONST(0.030165448669342), FRAC_CONST(0.008161385089390) },
+ { FRAC_CONST(0.030140267928416), FRAC_CONST(0.008253892972610) },
+ { FRAC_CONST(0.030114803495809), FRAC_CONST(0.008346323167047) },
+ { FRAC_CONST(0.030089055611203), FRAC_CONST(0.008438674802711) },
+ { FRAC_CONST(0.030063024516947), FRAC_CONST(0.008530947010354) },
+ { FRAC_CONST(0.030036710458054), FRAC_CONST(0.008623138921475) },
+ { FRAC_CONST(0.030010113682202), FRAC_CONST(0.008715249668328) },
+ { FRAC_CONST(0.029983234439732), FRAC_CONST(0.008807278383932) },
+ { FRAC_CONST(0.029956072983640), FRAC_CONST(0.008899224202078) },
+ { FRAC_CONST(0.029928629569580), FRAC_CONST(0.008991086257336) },
+ { FRAC_CONST(0.029900904455860), FRAC_CONST(0.009082863685067) },
+ { FRAC_CONST(0.029872897903441), FRAC_CONST(0.009174555621425) },
+ { FRAC_CONST(0.029844610175929), FRAC_CONST(0.009266161203371) },
+ { FRAC_CONST(0.029816041539579), FRAC_CONST(0.009357679568679) },
+ { FRAC_CONST(0.029787192263292), FRAC_CONST(0.009449109855944) },
+ { FRAC_CONST(0.029758062618606), FRAC_CONST(0.009540451204587) },
+ { FRAC_CONST(0.029728652879702), FRAC_CONST(0.009631702754871) },
+ { FRAC_CONST(0.029698963323395), FRAC_CONST(0.009722863647900) },
+ { FRAC_CONST(0.029668994229134), FRAC_CONST(0.009813933025633) },
+ { FRAC_CONST(0.029638745879000), FRAC_CONST(0.009904910030891) },
+ { FRAC_CONST(0.029608218557702), FRAC_CONST(0.009995793807363) },
+ { FRAC_CONST(0.029577412552575), FRAC_CONST(0.010086583499618) },
+ { FRAC_CONST(0.029546328153577), FRAC_CONST(0.010177278253107) },
+ { FRAC_CONST(0.029514965653285), FRAC_CONST(0.010267877214177) },
+ { FRAC_CONST(0.029483325346896), FRAC_CONST(0.010358379530076) },
+ { FRAC_CONST(0.029451407532220), FRAC_CONST(0.010448784348962) },
+ { FRAC_CONST(0.029419212509679), FRAC_CONST(0.010539090819911) },
+ { FRAC_CONST(0.029386740582307), FRAC_CONST(0.010629298092923) },
+ { FRAC_CONST(0.029353992055740), FRAC_CONST(0.010719405318933) },
+ { FRAC_CONST(0.029320967238220), FRAC_CONST(0.010809411649818) },
+ { FRAC_CONST(0.029287666440590), FRAC_CONST(0.010899316238403) },
+ { FRAC_CONST(0.029254089976290), FRAC_CONST(0.010989118238474) },
+ { FRAC_CONST(0.029220238161353), FRAC_CONST(0.011078816804778) },
+ { FRAC_CONST(0.029186111314406), FRAC_CONST(0.011168411093039) },
+ { FRAC_CONST(0.029151709756664), FRAC_CONST(0.011257900259961) },
+ { FRAC_CONST(0.029117033811927), FRAC_CONST(0.011347283463239) },
+ { FRAC_CONST(0.029082083806579), FRAC_CONST(0.011436559861563) },
+ { FRAC_CONST(0.029046860069582), FRAC_CONST(0.011525728614630) },
+ { FRAC_CONST(0.029011362932476), FRAC_CONST(0.011614788883150) },
+ { FRAC_CONST(0.028975592729373), FRAC_CONST(0.011703739828853) },
+ { FRAC_CONST(0.028939549796957), FRAC_CONST(0.011792580614500) },
+ { FRAC_CONST(0.028903234474475), FRAC_CONST(0.011881310403886) },
+ { FRAC_CONST(0.028866647103744), FRAC_CONST(0.011969928361855) },
+ { FRAC_CONST(0.028829788029135), FRAC_CONST(0.012058433654299) },
+ { FRAC_CONST(0.028792657597583), FRAC_CONST(0.012146825448172) },
+ { FRAC_CONST(0.028755256158571), FRAC_CONST(0.012235102911499) },
+ { FRAC_CONST(0.028717584064137), FRAC_CONST(0.012323265213377) },
+ { FRAC_CONST(0.028679641668864), FRAC_CONST(0.012411311523990) },
+ { FRAC_CONST(0.028641429329882), FRAC_CONST(0.012499241014612) },
+ { FRAC_CONST(0.028602947406859), FRAC_CONST(0.012587052857618) },
+ { FRAC_CONST(0.028564196262001), FRAC_CONST(0.012674746226488) },
+ { FRAC_CONST(0.028525176260050), FRAC_CONST(0.012762320295819) },
+ { FRAC_CONST(0.028485887768276), FRAC_CONST(0.012849774241331) },
+ { FRAC_CONST(0.028446331156478), FRAC_CONST(0.012937107239875) },
+ { FRAC_CONST(0.028406506796976), FRAC_CONST(0.013024318469437) },
+ { FRAC_CONST(0.028366415064615), FRAC_CONST(0.013111407109155) },
+ { FRAC_CONST(0.028326056336751), FRAC_CONST(0.013198372339315) },
+ { FRAC_CONST(0.028285430993258), FRAC_CONST(0.013285213341368) },
+ { FRAC_CONST(0.028244539416515), FRAC_CONST(0.013371929297933) },
+ { FRAC_CONST(0.028203381991411), FRAC_CONST(0.013458519392807) },
+ { FRAC_CONST(0.028161959105334), FRAC_CONST(0.013544982810971) },
+ { FRAC_CONST(0.028120271148172), FRAC_CONST(0.013631318738598) },
+ { FRAC_CONST(0.028078318512309), FRAC_CONST(0.013717526363062) },
+ { FRAC_CONST(0.028036101592619), FRAC_CONST(0.013803604872943) },
+ { FRAC_CONST(0.027993620786463), FRAC_CONST(0.013889553458039) },
+ { FRAC_CONST(0.027950876493687), FRAC_CONST(0.013975371309367) },
+ { FRAC_CONST(0.027907869116616), FRAC_CONST(0.014061057619178) },
+ { FRAC_CONST(0.027864599060052), FRAC_CONST(0.014146611580959) },
+ { FRAC_CONST(0.027821066731270), FRAC_CONST(0.014232032389445) },
+ { FRAC_CONST(0.027777272540012), FRAC_CONST(0.014317319240622) },
+ { FRAC_CONST(0.027733216898487), FRAC_CONST(0.014402471331737) },
+ { FRAC_CONST(0.027688900221361), FRAC_CONST(0.014487487861307) },
+ { FRAC_CONST(0.027644322925762), FRAC_CONST(0.014572368029123) },
+ { FRAC_CONST(0.027599485431266), FRAC_CONST(0.014657111036262) },
+ { FRAC_CONST(0.027554388159903), FRAC_CONST(0.014741716085090) },
+ { FRAC_CONST(0.027509031536144), FRAC_CONST(0.014826182379271) },
+ { FRAC_CONST(0.027463415986904), FRAC_CONST(0.014910509123778) },
+ { FRAC_CONST(0.027417541941533), FRAC_CONST(0.014994695524894) },
+ { FRAC_CONST(0.027371409831816), FRAC_CONST(0.015078740790225) },
+ { FRAC_CONST(0.027325020091965), FRAC_CONST(0.015162644128704) },
+ { FRAC_CONST(0.027278373158618), FRAC_CONST(0.015246404750603) },
+ { FRAC_CONST(0.027231469470833), FRAC_CONST(0.015330021867534) },
+ { FRAC_CONST(0.027184309470088), FRAC_CONST(0.015413494692460) },
+ { FRAC_CONST(0.027136893600268), FRAC_CONST(0.015496822439704) },
+ { FRAC_CONST(0.027089222307671), FRAC_CONST(0.015580004324954) },
+ { FRAC_CONST(0.027041296040997), FRAC_CONST(0.015663039565269) },
+ { FRAC_CONST(0.026993115251345), FRAC_CONST(0.015745927379091) },
+ { FRAC_CONST(0.026944680392213), FRAC_CONST(0.015828666986247) },
+ { FRAC_CONST(0.026895991919487), FRAC_CONST(0.015911257607961) },
+ { FRAC_CONST(0.026847050291442), FRAC_CONST(0.015993698466859) },
+ { FRAC_CONST(0.026797855968734), FRAC_CONST(0.016075988786976) },
+ { FRAC_CONST(0.026748409414401), FRAC_CONST(0.016158127793763) },
+ { FRAC_CONST(0.026698711093851), FRAC_CONST(0.016240114714099) },
+ { FRAC_CONST(0.026648761474864), FRAC_CONST(0.016321948776289) },
+ { FRAC_CONST(0.026598561027585), FRAC_CONST(0.016403629210082) },
+ { FRAC_CONST(0.026548110224519), FRAC_CONST(0.016485155246669) },
+ { FRAC_CONST(0.026497409540530), FRAC_CONST(0.016566526118696) },
+ { FRAC_CONST(0.026446459452830), FRAC_CONST(0.016647741060271) },
+ { FRAC_CONST(0.026395260440982), FRAC_CONST(0.016728799306966) },
+ { FRAC_CONST(0.026343812986890), FRAC_CONST(0.016809700095831) },
+ { FRAC_CONST(0.026292117574797), FRAC_CONST(0.016890442665397) },
+ { FRAC_CONST(0.026240174691280), FRAC_CONST(0.016971026255683) },
+ { FRAC_CONST(0.026187984825246), FRAC_CONST(0.017051450108208) },
+ { FRAC_CONST(0.026135548467924), FRAC_CONST(0.017131713465990) },
+ { FRAC_CONST(0.026082866112867), FRAC_CONST(0.017211815573560) },
+ { FRAC_CONST(0.026029938255941), FRAC_CONST(0.017291755676967) },
+ { FRAC_CONST(0.025976765395322), FRAC_CONST(0.017371533023784) },
+ { FRAC_CONST(0.025923348031494), FRAC_CONST(0.017451146863116) },
+ { FRAC_CONST(0.025869686667242), FRAC_CONST(0.017530596445607) },
+ { FRAC_CONST(0.025815781807646), FRAC_CONST(0.017609881023449) },
+ { FRAC_CONST(0.025761633960080), FRAC_CONST(0.017688999850383) },
+ { FRAC_CONST(0.025707243634204), FRAC_CONST(0.017767952181715) },
+ { FRAC_CONST(0.025652611341960), FRAC_CONST(0.017846737274313) },
+ { FRAC_CONST(0.025597737597568), FRAC_CONST(0.017925354386623) },
+ { FRAC_CONST(0.025542622917522), FRAC_CONST(0.018003802778671) },
+ { FRAC_CONST(0.025487267820581), FRAC_CONST(0.018082081712071) },
+ { FRAC_CONST(0.025431672827768), FRAC_CONST(0.018160190450031) },
+ { FRAC_CONST(0.025375838462365), FRAC_CONST(0.018238128257362) },
+ { FRAC_CONST(0.025319765249906), FRAC_CONST(0.018315894400484) },
+ { FRAC_CONST(0.025263453718173), FRAC_CONST(0.018393488147432) },
+ { FRAC_CONST(0.025206904397193), FRAC_CONST(0.018470908767865) },
+ { FRAC_CONST(0.025150117819228), FRAC_CONST(0.018548155533070) },
+ { FRAC_CONST(0.025093094518776), FRAC_CONST(0.018625227715971) },
+ { FRAC_CONST(0.025035835032562), FRAC_CONST(0.018702124591135) },
+ { FRAC_CONST(0.024978339899534), FRAC_CONST(0.018778845434780) },
+ { FRAC_CONST(0.024920609660858), FRAC_CONST(0.018855389524780) },
+ { FRAC_CONST(0.024862644859912), FRAC_CONST(0.018931756140672) },
+ { FRAC_CONST(0.024804446042284), FRAC_CONST(0.019007944563666) },
+ { FRAC_CONST(0.024746013755764), FRAC_CONST(0.019083954076646) },
+ { FRAC_CONST(0.024687348550337), FRAC_CONST(0.019159783964183) },
+ { FRAC_CONST(0.024628450978184), FRAC_CONST(0.019235433512536) },
+ { FRAC_CONST(0.024569321593670), FRAC_CONST(0.019310902009663) },
+ { FRAC_CONST(0.024509960953345), FRAC_CONST(0.019386188745225) },
+ { FRAC_CONST(0.024450369615932), FRAC_CONST(0.019461293010596) },
+ { FRAC_CONST(0.024390548142329), FRAC_CONST(0.019536214098866) },
+ { FRAC_CONST(0.024330497095598), FRAC_CONST(0.019610951304848) },
+ { FRAC_CONST(0.024270217040961), FRAC_CONST(0.019685503925087) },
+ { FRAC_CONST(0.024209708545799), FRAC_CONST(0.019759871257867) },
+ { FRAC_CONST(0.024148972179639), FRAC_CONST(0.019834052603212) },
+ { FRAC_CONST(0.024088008514157), FRAC_CONST(0.019908047262901) },
+ { FRAC_CONST(0.024026818123164), FRAC_CONST(0.019981854540467) },
+ { FRAC_CONST(0.023965401582609), FRAC_CONST(0.020055473741208) },
+ { FRAC_CONST(0.023903759470567), FRAC_CONST(0.020128904172192) },
+ { FRAC_CONST(0.023841892367236), FRAC_CONST(0.020202145142264) },
+ { FRAC_CONST(0.023779800854935), FRAC_CONST(0.020275195962052) },
+ { FRAC_CONST(0.023717485518092), FRAC_CONST(0.020348055943974) },
+ { FRAC_CONST(0.023654946943242), FRAC_CONST(0.020420724402244) },
+ { FRAC_CONST(0.023592185719023), FRAC_CONST(0.020493200652878) },
+ { FRAC_CONST(0.023529202436167), FRAC_CONST(0.020565484013703) },
+ { FRAC_CONST(0.023465997687496), FRAC_CONST(0.020637573804361) },
+ { FRAC_CONST(0.023402572067918), FRAC_CONST(0.020709469346314) },
+ { FRAC_CONST(0.023338926174419), FRAC_CONST(0.020781169962854) },
+ { FRAC_CONST(0.023275060606058), FRAC_CONST(0.020852674979108) },
+ { FRAC_CONST(0.023210975963963), FRAC_CONST(0.020923983722044) },
+ { FRAC_CONST(0.023146672851322), FRAC_CONST(0.020995095520475) },
+ { FRAC_CONST(0.023082151873380), FRAC_CONST(0.021066009705072) },
+ { FRAC_CONST(0.023017413637435), FRAC_CONST(0.021136725608363) },
+ { FRAC_CONST(0.022952458752826), FRAC_CONST(0.021207242564742) },
+ { FRAC_CONST(0.022887287830934), FRAC_CONST(0.021277559910478) },
+ { FRAC_CONST(0.022821901485173), FRAC_CONST(0.021347676983716) },
+ { FRAC_CONST(0.022756300330983), FRAC_CONST(0.021417593124488) },
+ { FRAC_CONST(0.022690484985827), FRAC_CONST(0.021487307674717) },
+ { FRAC_CONST(0.022624456069185), FRAC_CONST(0.021556819978223) },
+ { FRAC_CONST(0.022558214202547), FRAC_CONST(0.021626129380729) },
+ { FRAC_CONST(0.022491760009405), FRAC_CONST(0.021695235229869) },
+ { FRAC_CONST(0.022425094115252), FRAC_CONST(0.021764136875192) },
+ { FRAC_CONST(0.022358217147572), FRAC_CONST(0.021832833668171) },
+ { FRAC_CONST(0.022291129735838), FRAC_CONST(0.021901324962204) },
+ { FRAC_CONST(0.022223832511501), FRAC_CONST(0.021969610112625) },
+ { FRAC_CONST(0.022156326107988), FRAC_CONST(0.022037688476709) },
+ { FRAC_CONST(0.022088611160696), FRAC_CONST(0.022105559413676) },
+ { FRAC_CONST(0.022020688306983), FRAC_CONST(0.022173222284699) },
+ { FRAC_CONST(0.021952558186166), FRAC_CONST(0.022240676452909) },
+ { FRAC_CONST(0.021884221439510), FRAC_CONST(0.022307921283403) },
+ { FRAC_CONST(0.021815678710228), FRAC_CONST(0.022374956143245) },
+ { FRAC_CONST(0.021746930643469), FRAC_CONST(0.022441780401478) },
+ { FRAC_CONST(0.021677977886316), FRAC_CONST(0.022508393429127) },
+ { FRAC_CONST(0.021608821087780), FRAC_CONST(0.022574794599206) },
+ { FRAC_CONST(0.021539460898790), FRAC_CONST(0.022640983286719) },
+ { FRAC_CONST(0.021469897972190), FRAC_CONST(0.022706958868676) },
+ { FRAC_CONST(0.021400132962735), FRAC_CONST(0.022772720724087) },
+ { FRAC_CONST(0.021330166527077), FRAC_CONST(0.022838268233979) },
+ { FRAC_CONST(0.021259999323769), FRAC_CONST(0.022903600781391) },
+ { FRAC_CONST(0.021189632013250), FRAC_CONST(0.022968717751391) },
+ { FRAC_CONST(0.021119065257845), FRAC_CONST(0.023033618531071) },
+ { FRAC_CONST(0.021048299721754), FRAC_CONST(0.023098302509561) },
+ { FRAC_CONST(0.020977336071050), FRAC_CONST(0.023162769078031) },
+ { FRAC_CONST(0.020906174973670), FRAC_CONST(0.023227017629698) },
+ { FRAC_CONST(0.020834817099409), FRAC_CONST(0.023291047559828) },
+ { FRAC_CONST(0.020763263119915), FRAC_CONST(0.023354858265748) },
+ { FRAC_CONST(0.020691513708680), FRAC_CONST(0.023418449146848) },
+ { FRAC_CONST(0.020619569541038), FRAC_CONST(0.023481819604585) },
+ { FRAC_CONST(0.020547431294155), FRAC_CONST(0.023544969042494) },
+ { FRAC_CONST(0.020475099647023), FRAC_CONST(0.023607896866186) },
+ { FRAC_CONST(0.020402575280455), FRAC_CONST(0.023670602483363) },
+ { FRAC_CONST(0.020329858877078), FRAC_CONST(0.023733085303813) },
+ { FRAC_CONST(0.020256951121327), FRAC_CONST(0.023795344739427) },
+ { FRAC_CONST(0.020183852699437), FRAC_CONST(0.023857380204193) },
+ { FRAC_CONST(0.020110564299439), FRAC_CONST(0.023919191114211) },
+ { FRAC_CONST(0.020037086611150), FRAC_CONST(0.023980776887692) },
+ { FRAC_CONST(0.019963420326171), FRAC_CONST(0.024042136944968) },
+ { FRAC_CONST(0.019889566137877), FRAC_CONST(0.024103270708495) },
+ { FRAC_CONST(0.019815524741412), FRAC_CONST(0.024164177602859) },
+ { FRAC_CONST(0.019741296833681), FRAC_CONST(0.024224857054779) },
+ { FRAC_CONST(0.019666883113346), FRAC_CONST(0.024285308493120) },
+ { FRAC_CONST(0.019592284280817), FRAC_CONST(0.024345531348888) },
+ { FRAC_CONST(0.019517501038246), FRAC_CONST(0.024405525055242) },
+ { FRAC_CONST(0.019442534089523), FRAC_CONST(0.024465289047500) },
+ { FRAC_CONST(0.019367384140264), FRAC_CONST(0.024524822763141) },
+ { FRAC_CONST(0.019292051897809), FRAC_CONST(0.024584125641809) },
+ { FRAC_CONST(0.019216538071215), FRAC_CONST(0.024643197125323) },
+ { FRAC_CONST(0.019140843371246), FRAC_CONST(0.024702036657681) },
+ { FRAC_CONST(0.019064968510369), FRAC_CONST(0.024760643685063) },
+ { FRAC_CONST(0.018988914202748), FRAC_CONST(0.024819017655836) },
+ { FRAC_CONST(0.018912681164234), FRAC_CONST(0.024877158020562) },
+ { FRAC_CONST(0.018836270112363), FRAC_CONST(0.024935064232003) },
+ { FRAC_CONST(0.018759681766343), FRAC_CONST(0.024992735745123) },
+ { FRAC_CONST(0.018682916847054), FRAC_CONST(0.025050172017095) },
+ { FRAC_CONST(0.018605976077037), FRAC_CONST(0.025107372507308) },
+ { FRAC_CONST(0.018528860180486), FRAC_CONST(0.025164336677369) },
+ { FRAC_CONST(0.018451569883247), FRAC_CONST(0.025221063991110) },
+ { FRAC_CONST(0.018374105912805), FRAC_CONST(0.025277553914591) },
+ { FRAC_CONST(0.018296468998280), FRAC_CONST(0.025333805916107) },
+ { FRAC_CONST(0.018218659870421), FRAC_CONST(0.025389819466194) },
+ { FRAC_CONST(0.018140679261596), FRAC_CONST(0.025445594037630) },
+ { FRAC_CONST(0.018062527905790), FRAC_CONST(0.025501129105445) },
+ { FRAC_CONST(0.017984206538592), FRAC_CONST(0.025556424146920) },
+ { FRAC_CONST(0.017905715897192), FRAC_CONST(0.025611478641598) },
+ { FRAC_CONST(0.017827056720375), FRAC_CONST(0.025666292071285) },
+ { FRAC_CONST(0.017748229748511), FRAC_CONST(0.025720863920056) },
+ { FRAC_CONST(0.017669235723550), FRAC_CONST(0.025775193674260) },
+ { FRAC_CONST(0.017590075389012), FRAC_CONST(0.025829280822525) },
+ { FRAC_CONST(0.017510749489986), FRAC_CONST(0.025883124855762) },
+ { FRAC_CONST(0.017431258773116), FRAC_CONST(0.025936725267170) },
+ { FRAC_CONST(0.017351603986600), FRAC_CONST(0.025990081552242) },
+ { FRAC_CONST(0.017271785880180), FRAC_CONST(0.026043193208768) },
+ { FRAC_CONST(0.017191805205132), FRAC_CONST(0.026096059736841) },
+ { FRAC_CONST(0.017111662714267), FRAC_CONST(0.026148680638861) },
+ { FRAC_CONST(0.017031359161915), FRAC_CONST(0.026201055419541) },
+ { FRAC_CONST(0.016950895303924), FRAC_CONST(0.026253183585908) },
+ { FRAC_CONST(0.016870271897651), FRAC_CONST(0.026305064647313) },
+ { FRAC_CONST(0.016789489701954), FRAC_CONST(0.026356698115431) },
+ { FRAC_CONST(0.016708549477186), FRAC_CONST(0.026408083504269) },
+ { FRAC_CONST(0.016627451985187), FRAC_CONST(0.026459220330167) },
+ { FRAC_CONST(0.016546197989277), FRAC_CONST(0.026510108111806) },
+ { FRAC_CONST(0.016464788254250), FRAC_CONST(0.026560746370212) },
+ { FRAC_CONST(0.016383223546365), FRAC_CONST(0.026611134628757) },
+ { FRAC_CONST(0.016301504633341), FRAC_CONST(0.026661272413168) },
+ { FRAC_CONST(0.016219632284346), FRAC_CONST(0.026711159251530) },
+ { FRAC_CONST(0.016137607269996), FRAC_CONST(0.026760794674288) },
+ { FRAC_CONST(0.016055430362340), FRAC_CONST(0.026810178214254) },
+ { FRAC_CONST(0.015973102334858), FRAC_CONST(0.026859309406613) },
+ { FRAC_CONST(0.015890623962454), FRAC_CONST(0.026908187788922) },
+ { FRAC_CONST(0.015807996021446), FRAC_CONST(0.026956812901119) },
+ { FRAC_CONST(0.015725219289558), FRAC_CONST(0.027005184285527) },
+ { FRAC_CONST(0.015642294545918), FRAC_CONST(0.027053301486856) },
+ { FRAC_CONST(0.015559222571044), FRAC_CONST(0.027101164052208) },
+ { FRAC_CONST(0.015476004146842), FRAC_CONST(0.027148771531083) },
+ { FRAC_CONST(0.015392640056594), FRAC_CONST(0.027196123475380) },
+ { FRAC_CONST(0.015309131084956), FRAC_CONST(0.027243219439406) },
+ { FRAC_CONST(0.015225478017946), FRAC_CONST(0.027290058979875) },
+ { FRAC_CONST(0.015141681642938), FRAC_CONST(0.027336641655915) },
+ { FRAC_CONST(0.015057742748656), FRAC_CONST(0.027382967029073) },
+ { FRAC_CONST(0.014973662125164), FRAC_CONST(0.027429034663317) },
+ { FRAC_CONST(0.014889440563862), FRAC_CONST(0.027474844125040) },
+ { FRAC_CONST(0.014805078857474), FRAC_CONST(0.027520394983066) },
+ { FRAC_CONST(0.014720577800046), FRAC_CONST(0.027565686808654) },
+ { FRAC_CONST(0.014635938186934), FRAC_CONST(0.027610719175499) },
+ { FRAC_CONST(0.014551160814797), FRAC_CONST(0.027655491659740) },
+ { FRAC_CONST(0.014466246481592), FRAC_CONST(0.027700003839960) },
+ { FRAC_CONST(0.014381195986567), FRAC_CONST(0.027744255297195) },
+ { FRAC_CONST(0.014296010130247), FRAC_CONST(0.027788245614933) },
+ { FRAC_CONST(0.014210689714436), FRAC_CONST(0.027831974379120) },
+ { FRAC_CONST(0.014125235542201), FRAC_CONST(0.027875441178165) },
+ { FRAC_CONST(0.014039648417870), FRAC_CONST(0.027918645602941) },
+ { FRAC_CONST(0.013953929147020), FRAC_CONST(0.027961587246792) },
+ { FRAC_CONST(0.013868078536476), FRAC_CONST(0.028004265705534) },
+ { FRAC_CONST(0.013782097394294), FRAC_CONST(0.028046680577462) },
+ { FRAC_CONST(0.013695986529763), FRAC_CONST(0.028088831463351) },
+ { FRAC_CONST(0.013609746753390), FRAC_CONST(0.028130717966461) },
+ { FRAC_CONST(0.013523378876898), FRAC_CONST(0.028172339692540) },
+ { FRAC_CONST(0.013436883713214), FRAC_CONST(0.028213696249828) },
+ { FRAC_CONST(0.013350262076462), FRAC_CONST(0.028254787249062) },
+ { FRAC_CONST(0.013263514781960), FRAC_CONST(0.028295612303478) },
+ { FRAC_CONST(0.013176642646205), FRAC_CONST(0.028336171028814) },
+ { FRAC_CONST(0.013089646486871), FRAC_CONST(0.028376463043317) },
+ { FRAC_CONST(0.013002527122799), FRAC_CONST(0.028416487967743) },
+ { FRAC_CONST(0.012915285373990), FRAC_CONST(0.028456245425361) },
+ { FRAC_CONST(0.012827922061597), FRAC_CONST(0.028495735041960) },
+ { FRAC_CONST(0.012740438007915), FRAC_CONST(0.028534956445849) },
+ { FRAC_CONST(0.012652834036379), FRAC_CONST(0.028573909267859) },
+ { FRAC_CONST(0.012565110971550), FRAC_CONST(0.028612593141354) },
+ { FRAC_CONST(0.012477269639111), FRAC_CONST(0.028651007702224) },
+ { FRAC_CONST(0.012389310865858), FRAC_CONST(0.028689152588899) },
+ { FRAC_CONST(0.012301235479693), FRAC_CONST(0.028727027442343) },
+ { FRAC_CONST(0.012213044309615), FRAC_CONST(0.028764631906065) },
+ { FRAC_CONST(0.012124738185712), FRAC_CONST(0.028801965626115) },
+ { FRAC_CONST(0.012036317939156), FRAC_CONST(0.028839028251097) },
+ { FRAC_CONST(0.011947784402191), FRAC_CONST(0.028875819432161) },
+ { FRAC_CONST(0.011859138408130), FRAC_CONST(0.028912338823015) },
+ { FRAC_CONST(0.011770380791341), FRAC_CONST(0.028948586079925) },
+ { FRAC_CONST(0.011681512387245), FRAC_CONST(0.028984560861718) },
+ { FRAC_CONST(0.011592534032306), FRAC_CONST(0.029020262829785) },
+ { FRAC_CONST(0.011503446564022), FRAC_CONST(0.029055691648087) },
+ { FRAC_CONST(0.011414250820918), FRAC_CONST(0.029090846983152) },
+ { FRAC_CONST(0.011324947642537), FRAC_CONST(0.029125728504087) },
+ { FRAC_CONST(0.011235537869437), FRAC_CONST(0.029160335882573) },
+ { FRAC_CONST(0.011146022343175), FRAC_CONST(0.029194668792871) },
+ { FRAC_CONST(0.011056401906305), FRAC_CONST(0.029228726911828) },
+ { FRAC_CONST(0.010966677402371), FRAC_CONST(0.029262509918876) },
+ { FRAC_CONST(0.010876849675891), FRAC_CONST(0.029296017496036) },
+ { FRAC_CONST(0.010786919572361), FRAC_CONST(0.029329249327922) },
+ { FRAC_CONST(0.010696887938235), FRAC_CONST(0.029362205101743) },
+ { FRAC_CONST(0.010606755620926), FRAC_CONST(0.029394884507308) },
+ { FRAC_CONST(0.010516523468793), FRAC_CONST(0.029427287237024) },
+ { FRAC_CONST(0.010426192331137), FRAC_CONST(0.029459412985906) },
+ { FRAC_CONST(0.010335763058187), FRAC_CONST(0.029491261451573) },
+ { FRAC_CONST(0.010245236501099), FRAC_CONST(0.029522832334255) },
+ { FRAC_CONST(0.010154613511943), FRAC_CONST(0.029554125336796) },
+ { FRAC_CONST(0.010063894943698), FRAC_CONST(0.029585140164654) },
+ { FRAC_CONST(0.009973081650240), FRAC_CONST(0.029615876525905) },
+ { FRAC_CONST(0.009882174486340), FRAC_CONST(0.029646334131247) },
+ { FRAC_CONST(0.009791174307650), FRAC_CONST(0.029676512694001) },
+ { FRAC_CONST(0.009700081970699), FRAC_CONST(0.029706411930116) },
+ { FRAC_CONST(0.009608898332881), FRAC_CONST(0.029736031558168) },
+ { FRAC_CONST(0.009517624252453), FRAC_CONST(0.029765371299366) },
+ { FRAC_CONST(0.009426260588521), FRAC_CONST(0.029794430877553) },
+ { FRAC_CONST(0.009334808201034), FRAC_CONST(0.029823210019210) },
+ { FRAC_CONST(0.009243267950778), FRAC_CONST(0.029851708453456) },
+ { FRAC_CONST(0.009151640699363), FRAC_CONST(0.029879925912053) },
+ { FRAC_CONST(0.009059927309220), FRAC_CONST(0.029907862129408) },
+ { FRAC_CONST(0.008968128643591), FRAC_CONST(0.029935516842573) },
+ { FRAC_CONST(0.008876245566520), FRAC_CONST(0.029962889791254) },
+ { FRAC_CONST(0.008784278942845), FRAC_CONST(0.029989980717805) },
+ { FRAC_CONST(0.008692229638191), FRAC_CONST(0.030016789367235) },
+ { FRAC_CONST(0.008600098518961), FRAC_CONST(0.030043315487212) },
+ { FRAC_CONST(0.008507886452329), FRAC_CONST(0.030069558828062) },
+ { FRAC_CONST(0.008415594306230), FRAC_CONST(0.030095519142772) },
+ { FRAC_CONST(0.008323222949351), FRAC_CONST(0.030121196186994) },
+ { FRAC_CONST(0.008230773251129), FRAC_CONST(0.030146589719046) },
+ { FRAC_CONST(0.008138246081733), FRAC_CONST(0.030171699499915) },
+ { FRAC_CONST(0.008045642312067), FRAC_CONST(0.030196525293257) },
+ { FRAC_CONST(0.007952962813750), FRAC_CONST(0.030221066865402) },
+ { FRAC_CONST(0.007860208459119), FRAC_CONST(0.030245323985357) },
+ { FRAC_CONST(0.007767380121212), FRAC_CONST(0.030269296424803) },
+ { FRAC_CONST(0.007674478673766), FRAC_CONST(0.030292983958103) },
+ { FRAC_CONST(0.007581504991203), FRAC_CONST(0.030316386362302) },
+ { FRAC_CONST(0.007488459948628), FRAC_CONST(0.030339503417126) },
+ { FRAC_CONST(0.007395344421816), FRAC_CONST(0.030362334904989) },
+ { FRAC_CONST(0.007302159287206), FRAC_CONST(0.030384880610993) },
+ { FRAC_CONST(0.007208905421891), FRAC_CONST(0.030407140322928) },
+ { FRAC_CONST(0.007115583703613), FRAC_CONST(0.030429113831278) },
+ { FRAC_CONST(0.007022195010752), FRAC_CONST(0.030450800929220) },
+ { FRAC_CONST(0.006928740222316), FRAC_CONST(0.030472201412626) },
+ { FRAC_CONST(0.006835220217939), FRAC_CONST(0.030493315080068) },
+ { FRAC_CONST(0.006741635877866), FRAC_CONST(0.030514141732814) },
+ { FRAC_CONST(0.006647988082948), FRAC_CONST(0.030534681174838) },
+ { FRAC_CONST(0.006554277714635), FRAC_CONST(0.030554933212813) },
+ { FRAC_CONST(0.006460505654964), FRAC_CONST(0.030574897656119) },
+ { FRAC_CONST(0.006366672786553), FRAC_CONST(0.030594574316845) },
+ { FRAC_CONST(0.006272779992593), FRAC_CONST(0.030613963009786) },
+ { FRAC_CONST(0.006178828156839), FRAC_CONST(0.030633063552447) },
+ { FRAC_CONST(0.006084818163601), FRAC_CONST(0.030651875765048) },
+ { FRAC_CONST(0.005990750897737), FRAC_CONST(0.030670399470520) },
+ { FRAC_CONST(0.005896627244644), FRAC_CONST(0.030688634494512) },
+ { FRAC_CONST(0.005802448090250), FRAC_CONST(0.030706580665388) },
+ { FRAC_CONST(0.005708214321004), FRAC_CONST(0.030724237814232) },
+ { FRAC_CONST(0.005613926823871), FRAC_CONST(0.030741605774849) },
+ { FRAC_CONST(0.005519586486321), FRAC_CONST(0.030758684383764) },
+ { FRAC_CONST(0.005425194196321), FRAC_CONST(0.030775473480228) },
+ { FRAC_CONST(0.005330750842327), FRAC_CONST(0.030791972906214) },
+ { FRAC_CONST(0.005236257313276), FRAC_CONST(0.030808182506425) },
+ { FRAC_CONST(0.005141714498576), FRAC_CONST(0.030824102128288) },
+ { FRAC_CONST(0.005047123288102), FRAC_CONST(0.030839731621963) },
+ { FRAC_CONST(0.004952484572181), FRAC_CONST(0.030855070840339) },
+ { FRAC_CONST(0.004857799241589), FRAC_CONST(0.030870119639036) },
+ { FRAC_CONST(0.004763068187541), FRAC_CONST(0.030884877876411) },
+ { FRAC_CONST(0.004668292301681), FRAC_CONST(0.030899345413553) },
+ { FRAC_CONST(0.004573472476075), FRAC_CONST(0.030913522114288) },
+ { FRAC_CONST(0.004478609603205), FRAC_CONST(0.030927407845180) },
+ { FRAC_CONST(0.004383704575956), FRAC_CONST(0.030941002475530) },
+ { FRAC_CONST(0.004288758287610), FRAC_CONST(0.030954305877381) },
+ { FRAC_CONST(0.004193771631837), FRAC_CONST(0.030967317925516) },
+ { FRAC_CONST(0.004098745502689), FRAC_CONST(0.030980038497461) },
+ { FRAC_CONST(0.004003680794587), FRAC_CONST(0.030992467473486) },
+ { FRAC_CONST(0.003908578402316), FRAC_CONST(0.031004604736602) },
+ { FRAC_CONST(0.003813439221017), FRAC_CONST(0.031016450172571) },
+ { FRAC_CONST(0.003718264146176), FRAC_CONST(0.031028003669899) },
+ { FRAC_CONST(0.003623054073616), FRAC_CONST(0.031039265119839) },
+ { FRAC_CONST(0.003527809899492), FRAC_CONST(0.031050234416394) },
+ { FRAC_CONST(0.003432532520278), FRAC_CONST(0.031060911456318) },
+ { FRAC_CONST(0.003337222832760), FRAC_CONST(0.031071296139114) },
+ { FRAC_CONST(0.003241881734029), FRAC_CONST(0.031081388367037) },
+ { FRAC_CONST(0.003146510121474), FRAC_CONST(0.031091188045095) },
+ { FRAC_CONST(0.003051108892766), FRAC_CONST(0.031100695081051) },
+ { FRAC_CONST(0.002955678945860), FRAC_CONST(0.031109909385419) },
+ { FRAC_CONST(0.002860221178978), FRAC_CONST(0.031118830871473) },
+ { FRAC_CONST(0.002764736490604), FRAC_CONST(0.031127459455239) },
+ { FRAC_CONST(0.002669225779478), FRAC_CONST(0.031135795055501) },
+ { FRAC_CONST(0.002573689944583), FRAC_CONST(0.031143837593803) },
+ { FRAC_CONST(0.002478129885137), FRAC_CONST(0.031151586994444) },
+ { FRAC_CONST(0.002382546500589), FRAC_CONST(0.031159043184484) },
+ { FRAC_CONST(0.002286940690606), FRAC_CONST(0.031166206093743) },
+ { FRAC_CONST(0.002191313355067), FRAC_CONST(0.031173075654800) },
+ { FRAC_CONST(0.002095665394051), FRAC_CONST(0.031179651802998) },
+ { FRAC_CONST(0.001999997707835), FRAC_CONST(0.031185934476438) },
+ { FRAC_CONST(0.001904311196878), FRAC_CONST(0.031191923615985) },
+ { FRAC_CONST(0.001808606761820), FRAC_CONST(0.031197619165268) },
+ { FRAC_CONST(0.001712885303465), FRAC_CONST(0.031203021070678) },
+ { FRAC_CONST(0.001617147722782), FRAC_CONST(0.031208129281370) },
+ { FRAC_CONST(0.001521394920889), FRAC_CONST(0.031212943749264) },
+ { FRAC_CONST(0.001425627799047), FRAC_CONST(0.031217464429043) },
+ { FRAC_CONST(0.001329847258653), FRAC_CONST(0.031221691278159) },
+ { FRAC_CONST(0.001234054201231), FRAC_CONST(0.031225624256825) },
+ { FRAC_CONST(0.001138249528420), FRAC_CONST(0.031229263328024) },
+ { FRAC_CONST(0.001042434141971), FRAC_CONST(0.031232608457502) },
+ { FRAC_CONST(0.000946608943736), FRAC_CONST(0.031235659613775) },
+ { FRAC_CONST(0.000850774835656), FRAC_CONST(0.031238416768124) },
+ { FRAC_CONST(0.000754932719759), FRAC_CONST(0.031240879894597) },
+ { FRAC_CONST(0.000659083498149), FRAC_CONST(0.031243048970010) },
+ { FRAC_CONST(0.000563228072993), FRAC_CONST(0.031244923973948) },
+ { FRAC_CONST(0.000467367346520), FRAC_CONST(0.031246504888762) },
+ { FRAC_CONST(0.000371502221008), FRAC_CONST(0.031247791699571) },
+ { FRAC_CONST(0.000275633598775), FRAC_CONST(0.031248784394264) },
+ { FRAC_CONST(0.000179762382174), FRAC_CONST(0.031249482963498) },
+ { FRAC_CONST(0.000083889473581), FRAC_CONST(0.031249887400697) }
+};
+
+/* 64 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_256[] =
+{
+ { FRAC_CONST(0.088387931675923), FRAC_CONST(0.000271171628935) },
+ { FRAC_CONST(0.088354655998507), FRAC_CONST(0.002440238387037) },
+ { FRAC_CONST(0.088268158780110), FRAC_CONST(0.004607835236780) },
+ { FRAC_CONST(0.088128492123423), FRAC_CONST(0.006772656498875) },
+ { FRAC_CONST(0.087935740158418), FRAC_CONST(0.008933398165942) },
+ { FRAC_CONST(0.087690018991670), FRAC_CONST(0.011088758687994) },
+ { FRAC_CONST(0.087391476636423), FRAC_CONST(0.013237439756448) },
+ { FRAC_CONST(0.087040292923427), FRAC_CONST(0.015378147086172) },
+ { FRAC_CONST(0.086636679392621), FRAC_CONST(0.017509591195118) },
+ { FRAC_CONST(0.086180879165703), FRAC_CONST(0.019630488181053) },
+ { FRAC_CONST(0.085673166799686), FRAC_CONST(0.021739560494940) },
+ { FRAC_CONST(0.085113848121515), FRAC_CONST(0.023835537710479) },
+ { FRAC_CONST(0.084503260043847), FRAC_CONST(0.025917157289369) },
+ { FRAC_CONST(0.083841770362110), FRAC_CONST(0.027983165341813) },
+ { FRAC_CONST(0.083129777532952), FRAC_CONST(0.030032317381813) },
+ { FRAC_CONST(0.082367710434230), FRAC_CONST(0.032063379076803) },
+ { FRAC_CONST(0.081556028106671), FRAC_CONST(0.034075126991164) },
+ { FRAC_CONST(0.080695219477356), FRAC_CONST(0.036066349323177) },
+ { FRAC_CONST(0.079785803065216), FRAC_CONST(0.038035846634965) },
+ { FRAC_CONST(0.078828326668693), FRAC_CONST(0.039982432574992) },
+ { FRAC_CONST(0.077823367035766), FRAC_CONST(0.041904934592675) },
+ { FRAC_CONST(0.076771529516540), FRAC_CONST(0.043802194644686) },
+ { FRAC_CONST(0.075673447698606), FRAC_CONST(0.045673069892513) },
+ { FRAC_CONST(0.074529783025390), FRAC_CONST(0.047516433390863) },
+ { FRAC_CONST(0.073341224397728), FRAC_CONST(0.049331174766491) },
+ { FRAC_CONST(0.072108487758894), FRAC_CONST(0.051116200887052) },
+ { FRAC_CONST(0.070832315663343), FRAC_CONST(0.052870436519557) },
+ { FRAC_CONST(0.069513476829429), FRAC_CONST(0.054592824978055) },
+ { FRAC_CONST(0.068152765676348), FRAC_CONST(0.056282328760143) },
+ { FRAC_CONST(0.066751001845620), FRAC_CONST(0.057937930171918) },
+ { FRAC_CONST(0.065309029707361), FRAC_CONST(0.059558631940996) },
+ { FRAC_CONST(0.063827717851668), FRAC_CONST(0.061143457817234) },
+ { FRAC_CONST(0.062307958565413), FRAC_CONST(0.062691453160784) },
+ { FRAC_CONST(0.060750667294763), FRAC_CONST(0.064201685517134) },
+ { FRAC_CONST(0.059156782093749), FRAC_CONST(0.065673245178784) },
+ { FRAC_CONST(0.057527263059216), FRAC_CONST(0.067105245733220) },
+ { FRAC_CONST(0.055863091752499), FRAC_CONST(0.068496824596852) },
+ { FRAC_CONST(0.054165270608165), FRAC_CONST(0.069847143534609) },
+ { FRAC_CONST(0.052434822330188), FRAC_CONST(0.071155389164853) },
+ { FRAC_CONST(0.050672789275903), FRAC_CONST(0.072420773449336) },
+ { FRAC_CONST(0.048880232828135), FRAC_CONST(0.073642534167879) },
+ { FRAC_CONST(0.047058232755862), FRAC_CONST(0.074819935377512) },
+ { FRAC_CONST(0.045207886563797), FRAC_CONST(0.075952267855771) },
+ { FRAC_CONST(0.043330308831298), FRAC_CONST(0.077038849527912) },
+ { FRAC_CONST(0.041426630540984), FRAC_CONST(0.078079025877766) },
+ { FRAC_CONST(0.039497998397473), FRAC_CONST(0.079072170341994) },
+ { FRAC_CONST(0.037545574136653), FRAC_CONST(0.080017684687506) },
+ { FRAC_CONST(0.035570533825892), FRAC_CONST(0.080914999371817) },
+ { FRAC_CONST(0.033574067155622), FRAC_CONST(0.081763573886112) },
+ { FRAC_CONST(0.031557376722714), FRAC_CONST(0.082562897080836) },
+ { FRAC_CONST(0.029521677306074), FRAC_CONST(0.083312487473584) },
+ { FRAC_CONST(0.027468195134911), FRAC_CONST(0.084011893539132) },
+ { FRAC_CONST(0.025398167150101), FRAC_CONST(0.084660693981419) },
+ { FRAC_CONST(0.023312840259098), FRAC_CONST(0.085258497987320) },
+ { FRAC_CONST(0.021213470584847), FRAC_CONST(0.085804945462053) },
+ { FRAC_CONST(0.019101322709138), FRAC_CONST(0.086299707246093) },
+ { FRAC_CONST(0.016977668910873), FRAC_CONST(0.086742485313442) },
+ { FRAC_CONST(0.014843788399692), FRAC_CONST(0.087133012951149) },
+ { FRAC_CONST(0.012700966545425), FRAC_CONST(0.087471054919968) },
+ { FRAC_CONST(0.010550494103830), FRAC_CONST(0.087756407596056) },
+ { FRAC_CONST(0.008393666439096), FRAC_CONST(0.087988899093631) },
+ { FRAC_CONST(0.006231782743558), FRAC_CONST(0.088168389368510) },
+ { FRAC_CONST(0.004066145255116), FRAC_CONST(0.088294770302461) },
+ { FRAC_CONST(0.001898058472816), FRAC_CONST(0.088367965768336) }
+};
+
+#ifdef LD_DEC
+/* 128 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_1024[] =
+{
+ { FRAC_CONST(0.044194160825012), FRAC_CONST(0.000033896503468) },
+ { FRAC_CONST(0.044193120897389), FRAC_CONST(0.000305066138364) },
+ { FRAC_CONST(0.044190417123742), FRAC_CONST(0.000576224287693) },
+ { FRAC_CONST(0.044186049605866), FRAC_CONST(0.000847360742503) },
+ { FRAC_CONST(0.044180018508197), FRAC_CONST(0.001118465294660) },
+ { FRAC_CONST(0.044172324057802), FRAC_CONST(0.001389527737231) },
+ { FRAC_CONST(0.044162966544372), FRAC_CONST(0.001660537864867) },
+ { FRAC_CONST(0.044151946320213), FRAC_CONST(0.001931485474192) },
+ { FRAC_CONST(0.044139263800230), FRAC_CONST(0.002202360364180) },
+ { FRAC_CONST(0.044124919461912), FRAC_CONST(0.002473152336546) },
+ { FRAC_CONST(0.044108913845316), FRAC_CONST(0.002743851196123) },
+ { FRAC_CONST(0.044091247553044), FRAC_CONST(0.003014446751254) },
+ { FRAC_CONST(0.044071921250223), FRAC_CONST(0.003284928814169) },
+ { FRAC_CONST(0.044050935664476), FRAC_CONST(0.003555287201370) },
+ { FRAC_CONST(0.044028291585898), FRAC_CONST(0.003825511734018) },
+ { FRAC_CONST(0.044003989867028), FRAC_CONST(0.004095592238311) },
+ { FRAC_CONST(0.043978031422810), FRAC_CONST(0.004365518545871) },
+ { FRAC_CONST(0.043950417230565), FRAC_CONST(0.004635280494126) },
+ { FRAC_CONST(0.043921148329953), FRAC_CONST(0.004904867926689) },
+ { FRAC_CONST(0.043890225822930), FRAC_CONST(0.005174270693748) },
+ { FRAC_CONST(0.043857650873712), FRAC_CONST(0.005443478652439) },
+ { FRAC_CONST(0.043823424708727), FRAC_CONST(0.005712481667236) },
+ { FRAC_CONST(0.043787548616571), FRAC_CONST(0.005981269610326) },
+ { FRAC_CONST(0.043750023947958), FRAC_CONST(0.006249832361997) },
+ { FRAC_CONST(0.043710852115672), FRAC_CONST(0.006518159811011) },
+ { FRAC_CONST(0.043670034594508), FRAC_CONST(0.006786241854993) },
+ { FRAC_CONST(0.043627572921225), FRAC_CONST(0.007054068400804) },
+ { FRAC_CONST(0.043583468694479), FRAC_CONST(0.007321629364927) },
+ { FRAC_CONST(0.043537723574771), FRAC_CONST(0.007588914673843) },
+ { FRAC_CONST(0.043490339284377), FRAC_CONST(0.007855914264410) },
+ { FRAC_CONST(0.043441317607290), FRAC_CONST(0.008122618084246) },
+ { FRAC_CONST(0.043390660389149), FRAC_CONST(0.008389016092101) },
+ { FRAC_CONST(0.043338369537168), FRAC_CONST(0.008655098258243) },
+ { FRAC_CONST(0.043284447020070), FRAC_CONST(0.008920854564826) },
+ { FRAC_CONST(0.043228894868005), FRAC_CONST(0.009186275006278) },
+ { FRAC_CONST(0.043171715172482), FRAC_CONST(0.009451349589667) },
+ { FRAC_CONST(0.043112910086283), FRAC_CONST(0.009716068335087) },
+ { FRAC_CONST(0.043052481823387), FRAC_CONST(0.009980421276025) },
+ { FRAC_CONST(0.042990432658884), FRAC_CONST(0.010244398459743) },
+ { FRAC_CONST(0.042926764928889), FRAC_CONST(0.010507989947649) },
+ { FRAC_CONST(0.042861481030457), FRAC_CONST(0.010771185815673) },
+ { FRAC_CONST(0.042794583421490), FRAC_CONST(0.011033976154639) },
+ { FRAC_CONST(0.042726074620644), FRAC_CONST(0.011296351070639) },
+ { FRAC_CONST(0.042655957207238), FRAC_CONST(0.011558300685406) },
+ { FRAC_CONST(0.042584233821153), FRAC_CONST(0.011819815136685) },
+ { FRAC_CONST(0.042510907162732), FRAC_CONST(0.012080884578604) },
+ { FRAC_CONST(0.042435979992684), FRAC_CONST(0.012341499182048) },
+ { FRAC_CONST(0.042359455131975), FRAC_CONST(0.012601649135022) },
+ { FRAC_CONST(0.042281335461721), FRAC_CONST(0.012861324643029) },
+ { FRAC_CONST(0.042201623923085), FRAC_CONST(0.013120515929433) },
+ { FRAC_CONST(0.042120323517160), FRAC_CONST(0.013379213235827) },
+ { FRAC_CONST(0.042037437304862), FRAC_CONST(0.013637406822406) },
+ { FRAC_CONST(0.041952968406809), FRAC_CONST(0.013895086968325) },
+ { FRAC_CONST(0.041866920003207), FRAC_CONST(0.014152243972073) },
+ { FRAC_CONST(0.041779295333730), FRAC_CONST(0.014408868151835) },
+ { FRAC_CONST(0.041690097697398), FRAC_CONST(0.014664949845855) },
+ { FRAC_CONST(0.041599330452450), FRAC_CONST(0.014920479412801) },
+ { FRAC_CONST(0.041506997016224), FRAC_CONST(0.015175447232131) },
+ { FRAC_CONST(0.041413100865019), FRAC_CONST(0.015429843704450) },
+ { FRAC_CONST(0.041317645533974), FRAC_CONST(0.015683659251874) },
+ { FRAC_CONST(0.041220634616927), FRAC_CONST(0.015936884318392) },
+ { FRAC_CONST(0.041122071766285), FRAC_CONST(0.016189509370223) },
+ { FRAC_CONST(0.041021960692883), FRAC_CONST(0.016441524896177) },
+ { FRAC_CONST(0.040920305165846), FRAC_CONST(0.016692921408010) },
+ { FRAC_CONST(0.040817109012449), FRAC_CONST(0.016943689440788) },
+ { FRAC_CONST(0.040712376117967), FRAC_CONST(0.017193819553235) },
+ { FRAC_CONST(0.040606110425535), FRAC_CONST(0.017443302328094) },
+ { FRAC_CONST(0.040498315935996), FRAC_CONST(0.017692128372479) },
+ { FRAC_CONST(0.040388996707752), FRAC_CONST(0.017940288318230) },
+ { FRAC_CONST(0.040278156856609), FRAC_CONST(0.018187772822267) },
+ { FRAC_CONST(0.040165800555627), FRAC_CONST(0.018434572566936) },
+ { FRAC_CONST(0.040051932034955), FRAC_CONST(0.018680678260367) },
+ { FRAC_CONST(0.039936555581679), FRAC_CONST(0.018926080636820) },
+ { FRAC_CONST(0.039819675539659), FRAC_CONST(0.019170770457035) },
+ { FRAC_CONST(0.039701296309360), FRAC_CONST(0.019414738508577) },
+ { FRAC_CONST(0.039581422347694), FRAC_CONST(0.019657975606187) },
+ { FRAC_CONST(0.039460058167849), FRAC_CONST(0.019900472592126) },
+ { FRAC_CONST(0.039337208339116), FRAC_CONST(0.020142220336521) },
+ { FRAC_CONST(0.039212877486723), FRAC_CONST(0.020383209737704) },
+ { FRAC_CONST(0.039087070291656), FRAC_CONST(0.020623431722561) },
+ { FRAC_CONST(0.038959791490485), FRAC_CONST(0.020862877246870) },
+ { FRAC_CONST(0.038831045875184), FRAC_CONST(0.021101537295642) },
+ { FRAC_CONST(0.038700838292953), FRAC_CONST(0.021339402883462) },
+ { FRAC_CONST(0.038569173646034), FRAC_CONST(0.021576465054824) },
+ { FRAC_CONST(0.038436056891527), FRAC_CONST(0.021812714884472) },
+ { FRAC_CONST(0.038301493041202), FRAC_CONST(0.022048143477734) },
+ { FRAC_CONST(0.038165487161312), FRAC_CONST(0.022282741970855) },
+ { FRAC_CONST(0.038028044372402), FRAC_CONST(0.022516501531335) },
+ { FRAC_CONST(0.037889169849115), FRAC_CONST(0.022749413358259) },
+ { FRAC_CONST(0.037748868819998), FRAC_CONST(0.022981468682628) },
+ { FRAC_CONST(0.037607146567305), FRAC_CONST(0.023212658767690) },
+ { FRAC_CONST(0.037464008426800), FRAC_CONST(0.023442974909269) },
+ { FRAC_CONST(0.037319459787553), FRAC_CONST(0.023672408436094) },
+ { FRAC_CONST(0.037173506091737), FRAC_CONST(0.023900950710120) },
+ { FRAC_CONST(0.037026152834428), FRAC_CONST(0.024128593126861) },
+ { FRAC_CONST(0.036877405563392), FRAC_CONST(0.024355327115708) },
+ { FRAC_CONST(0.036727269878879), FRAC_CONST(0.024581144140255) },
+ { FRAC_CONST(0.036575751433414), FRAC_CONST(0.024806035698618) },
+ { FRAC_CONST(0.036422855931580), FRAC_CONST(0.025029993323758) },
+ { FRAC_CONST(0.036268589129807), FRAC_CONST(0.025253008583796) },
+ { FRAC_CONST(0.036112956836151), FRAC_CONST(0.025475073082334) },
+ { FRAC_CONST(0.035955964910083), FRAC_CONST(0.025696178458769) },
+ { FRAC_CONST(0.035797619262257), FRAC_CONST(0.025916316388609) },
+ { FRAC_CONST(0.035637925854300), FRAC_CONST(0.026135478583784) },
+ { FRAC_CONST(0.035476890698576), FRAC_CONST(0.026353656792963) },
+ { FRAC_CONST(0.035314519857970), FRAC_CONST(0.026570842801858) },
+ { FRAC_CONST(0.035150819445650), FRAC_CONST(0.026787028433540) },
+ { FRAC_CONST(0.034985795624846), FRAC_CONST(0.027002205548742) },
+ { FRAC_CONST(0.034819454608610), FRAC_CONST(0.027216366046166) },
+ { FRAC_CONST(0.034651802659589), FRAC_CONST(0.027429501862792) },
+ { FRAC_CONST(0.034482846089783), FRAC_CONST(0.027641604974175) },
+ { FRAC_CONST(0.034312591260311), FRAC_CONST(0.027852667394755) },
+ { FRAC_CONST(0.034141044581172), FRAC_CONST(0.028062681178149) },
+ { FRAC_CONST(0.033968212511001), FRAC_CONST(0.028271638417458) },
+ { FRAC_CONST(0.033794101556828), FRAC_CONST(0.028479531245560) },
+ { FRAC_CONST(0.033618718273831), FRAC_CONST(0.028686351835407) },
+ { FRAC_CONST(0.033442069265093), FRAC_CONST(0.028892092400321) },
+ { FRAC_CONST(0.033264161181349), FRAC_CONST(0.029096745194286) },
+ { FRAC_CONST(0.033085000720737), FRAC_CONST(0.029300302512241) },
+ { FRAC_CONST(0.032904594628548), FRAC_CONST(0.029502756690366) },
+ { FRAC_CONST(0.032722949696969), FRAC_CONST(0.029704100106376) },
+ { FRAC_CONST(0.032540072764829), FRAC_CONST(0.029904325179807) },
+ { FRAC_CONST(0.032355970717341), FRAC_CONST(0.030103424372297) },
+ { FRAC_CONST(0.032170650485843), FRAC_CONST(0.030301390187873) },
+ { FRAC_CONST(0.031984119047537), FRAC_CONST(0.030498215173235) },
+ { FRAC_CONST(0.031796383425227), FRAC_CONST(0.030693891918034) },
+ { FRAC_CONST(0.031607450687052), FRAC_CONST(0.030888413055150) },
+ { FRAC_CONST(0.031417327946223), FRAC_CONST(0.031081771260973) },
+ { FRAC_CONST(0.031226022360754), FRAC_CONST(0.031273959255676) },
+ { FRAC_CONST(0.031033541133193), FRAC_CONST(0.031464969803488) },
+ { FRAC_CONST(0.030839891510348), FRAC_CONST(0.031654795712972) },
+ { FRAC_CONST(0.030645080783018), FRAC_CONST(0.031843429837288) },
+ { FRAC_CONST(0.030449116285718), FRAC_CONST(0.032030865074469) },
+ { FRAC_CONST(0.030252005396399), FRAC_CONST(0.032217094367684) },
+ { FRAC_CONST(0.030053755536176), FRAC_CONST(0.032402110705505) },
+ { FRAC_CONST(0.029854374169043), FRAC_CONST(0.032585907122172) },
+ { FRAC_CONST(0.029653868801596), FRAC_CONST(0.032768476697853) },
+ { FRAC_CONST(0.029452246982750), FRAC_CONST(0.032949812558907) },
+ { FRAC_CONST(0.029249516303451), FRAC_CONST(0.033129907878142) },
+ { FRAC_CONST(0.029045684396395), FRAC_CONST(0.033308755875070) },
+ { FRAC_CONST(0.028840758935738), FRAC_CONST(0.033486349816166) },
+ { FRAC_CONST(0.028634747636808), FRAC_CONST(0.033662683015118) },
+ { FRAC_CONST(0.028427658255815), FRAC_CONST(0.033837748833080) },
+ { FRAC_CONST(0.028219498589555), FRAC_CONST(0.034011540678924) },
+ { FRAC_CONST(0.028010276475123), FRAC_CONST(0.034184052009485) },
+ { FRAC_CONST(0.027799999789613), FRAC_CONST(0.034355276329809) },
+ { FRAC_CONST(0.027588676449824), FRAC_CONST(0.034525207193396) },
+ { FRAC_CONST(0.027376314411959), FRAC_CONST(0.034693838202447) },
+ { FRAC_CONST(0.027162921671330), FRAC_CONST(0.034861163008098) },
+ { FRAC_CONST(0.026948506262053), FRAC_CONST(0.035027175310665) },
+ { FRAC_CONST(0.026733076256746), FRAC_CONST(0.035191868859880) },
+ { FRAC_CONST(0.026516639766228), FRAC_CONST(0.035355237455122) },
+ { FRAC_CONST(0.026299204939210), FRAC_CONST(0.035517274945657) },
+ { FRAC_CONST(0.026080779961991), FRAC_CONST(0.035677975230865) },
+ { FRAC_CONST(0.025861373058146), FRAC_CONST(0.035837332260471) },
+ { FRAC_CONST(0.025640992488223), FRAC_CONST(0.035995340034772) },
+ { FRAC_CONST(0.025419646549425), FRAC_CONST(0.036151992604866) },
+ { FRAC_CONST(0.025197343575302), FRAC_CONST(0.036307284072871) },
+ { FRAC_CONST(0.024974091935435), FRAC_CONST(0.036461208592152) },
+ { FRAC_CONST(0.024749900035122), FRAC_CONST(0.036613760367538) },
+ { FRAC_CONST(0.024524776315061), FRAC_CONST(0.036764933655540) },
+ { FRAC_CONST(0.024298729251033), FRAC_CONST(0.036914722764569) },
+ { FRAC_CONST(0.024071767353583), FRAC_CONST(0.037063122055150) },
+ { FRAC_CONST(0.023843899167697), FRAC_CONST(0.037210125940135) },
+ { FRAC_CONST(0.023615133272485), FRAC_CONST(0.037355728884908) },
+ { FRAC_CONST(0.023385478280852), FRAC_CONST(0.037499925407603) },
+ { FRAC_CONST(0.023154942839179), FRAC_CONST(0.037642710079302) },
+ { FRAC_CONST(0.022923535626995), FRAC_CONST(0.037784077524241) },
+ { FRAC_CONST(0.022691265356652), FRAC_CONST(0.037924022420018) },
+ { FRAC_CONST(0.022458140772993), FRAC_CONST(0.038062539497785) },
+ { FRAC_CONST(0.022224170653027), FRAC_CONST(0.038199623542453) },
+ { FRAC_CONST(0.021989363805598), FRAC_CONST(0.038335269392885) },
+ { FRAC_CONST(0.021753729071049), FRAC_CONST(0.038469471942092) },
+ { FRAC_CONST(0.021517275320897), FRAC_CONST(0.038602226137423) },
+ { FRAC_CONST(0.021280011457490), FRAC_CONST(0.038733526980758) },
+ { FRAC_CONST(0.021041946413679), FRAC_CONST(0.038863369528695) },
+ { FRAC_CONST(0.020803089152479), FRAC_CONST(0.038991748892734) },
+ { FRAC_CONST(0.020563448666730), FRAC_CONST(0.039118660239466) },
+ { FRAC_CONST(0.020323033978761), FRAC_CONST(0.039244098790750) },
+ { FRAC_CONST(0.020081854140050), FRAC_CONST(0.039368059823895) },
+ { FRAC_CONST(0.019839918230880), FRAC_CONST(0.039490538671839) },
+ { FRAC_CONST(0.019597235360003), FRAC_CONST(0.039611530723322) },
+ { FRAC_CONST(0.019353814664291), FRAC_CONST(0.039731031423061) },
+ { FRAC_CONST(0.019109665308395), FRAC_CONST(0.039849036271924) },
+ { FRAC_CONST(0.018864796484402), FRAC_CONST(0.039965540827094) },
+ { FRAC_CONST(0.018619217411483), FRAC_CONST(0.040080540702240) },
+ { FRAC_CONST(0.018372937335552), FRAC_CONST(0.040194031567683) },
+ { FRAC_CONST(0.018125965528915), FRAC_CONST(0.040306009150554) },
+ { FRAC_CONST(0.017878311289921), FRAC_CONST(0.040416469234963) },
+ { FRAC_CONST(0.017629983942612), FRAC_CONST(0.040525407662148) },
+ { FRAC_CONST(0.017380992836371), FRAC_CONST(0.040632820330639) },
+ { FRAC_CONST(0.017131347345575), FRAC_CONST(0.040738703196411) },
+ { FRAC_CONST(0.016881056869233), FRAC_CONST(0.040843052273033) },
+ { FRAC_CONST(0.016630130830641), FRAC_CONST(0.040945863631822) },
+ { FRAC_CONST(0.016378578677023), FRAC_CONST(0.041047133401988) },
+ { FRAC_CONST(0.016126409879175), FRAC_CONST(0.041146857770781) },
+ { FRAC_CONST(0.015873633931110), FRAC_CONST(0.041245032983635) },
+ { FRAC_CONST(0.015620260349699), FRAC_CONST(0.041341655344309) },
+ { FRAC_CONST(0.015366298674314), FRAC_CONST(0.041436721215026) },
+ { FRAC_CONST(0.015111758466470), FRAC_CONST(0.041530227016609) },
+ { FRAC_CONST(0.014856649309460), FRAC_CONST(0.041622169228618) },
+ { FRAC_CONST(0.014600980808001), FRAC_CONST(0.041712544389481) },
+ { FRAC_CONST(0.014344762587867), FRAC_CONST(0.041801349096623) },
+ { FRAC_CONST(0.014088004295529), FRAC_CONST(0.041888580006598) },
+ { FRAC_CONST(0.013830715597792), FRAC_CONST(0.041974233835211) },
+ { FRAC_CONST(0.013572906181430), FRAC_CONST(0.042058307357645) },
+ { FRAC_CONST(0.013314585752822), FRAC_CONST(0.042140797408577) },
+ { FRAC_CONST(0.013055764037585), FRAC_CONST(0.042221700882306) },
+ { FRAC_CONST(0.012796450780212), FRAC_CONST(0.042301014732860) },
+ { FRAC_CONST(0.012536655743699), FRAC_CONST(0.042378735974118) },
+ { FRAC_CONST(0.012276388709183), FRAC_CONST(0.042454861679919) },
+ { FRAC_CONST(0.012015659475571), FRAC_CONST(0.042529388984173) },
+ { FRAC_CONST(0.011754477859172), FRAC_CONST(0.042602315080970) },
+ { FRAC_CONST(0.011492853693324), FRAC_CONST(0.042673637224683) },
+ { FRAC_CONST(0.011230796828031), FRAC_CONST(0.042743352730074) },
+ { FRAC_CONST(0.010968317129584), FRAC_CONST(0.042811458972393) },
+ { FRAC_CONST(0.010705424480197), FRAC_CONST(0.042877953387479) },
+ { FRAC_CONST(0.010442128777629), FRAC_CONST(0.042942833471854) },
+ { FRAC_CONST(0.010178439934815), FRAC_CONST(0.043006096782821) },
+ { FRAC_CONST(0.009914367879490), FRAC_CONST(0.043067740938551) },
+ { FRAC_CONST(0.009649922553818), FRAC_CONST(0.043127763618177) },
+ { FRAC_CONST(0.009385113914016), FRAC_CONST(0.043186162561878) },
+ { FRAC_CONST(0.009119951929979), FRAC_CONST(0.043242935570968) },
+ { FRAC_CONST(0.008854446584907), FRAC_CONST(0.043298080507974) },
+ { FRAC_CONST(0.008588607874926), FRAC_CONST(0.043351595296722) },
+ { FRAC_CONST(0.008322445808712), FRAC_CONST(0.043403477922409) },
+ { FRAC_CONST(0.008055970407118), FRAC_CONST(0.043453726431684) },
+ { FRAC_CONST(0.007789191702791), FRAC_CONST(0.043502338932719) },
+ { FRAC_CONST(0.007522119739798), FRAC_CONST(0.043549313595281) },
+ { FRAC_CONST(0.007254764573250), FRAC_CONST(0.043594648650800) },
+ { FRAC_CONST(0.006987136268915), FRAC_CONST(0.043638342392438) },
+ { FRAC_CONST(0.006719244902849), FRAC_CONST(0.043680393175148) },
+ { FRAC_CONST(0.006451100561010), FRAC_CONST(0.043720799415744) },
+ { FRAC_CONST(0.006182713338881), FRAC_CONST(0.043759559592953) },
+ { FRAC_CONST(0.005914093341090), FRAC_CONST(0.043796672247476) },
+ { FRAC_CONST(0.005645250681027), FRAC_CONST(0.043832135982044) },
+ { FRAC_CONST(0.005376195480466), FRAC_CONST(0.043865949461465) },
+ { FRAC_CONST(0.005106937869184), FRAC_CONST(0.043898111412683) },
+ { FRAC_CONST(0.004837487984578), FRAC_CONST(0.043928620624817) },
+ { FRAC_CONST(0.004567855971284), FRAC_CONST(0.043957475949213) },
+ { FRAC_CONST(0.004298051980793), FRAC_CONST(0.043984676299484) },
+ { FRAC_CONST(0.004028086171076), FRAC_CONST(0.044010220651553) },
+ { FRAC_CONST(0.003757968706190), FRAC_CONST(0.044034108043689) },
+ { FRAC_CONST(0.003487709755907), FRAC_CONST(0.044056337576546) },
+ { FRAC_CONST(0.003217319495322), FRAC_CONST(0.044076908413193) },
+ { FRAC_CONST(0.002946808104477), FRAC_CONST(0.044095819779151) },
+ { FRAC_CONST(0.002676185767973), FRAC_CONST(0.044113070962418) },
+ { FRAC_CONST(0.002405462674586), FRAC_CONST(0.044128661313495) },
+ { FRAC_CONST(0.002134649016890), FRAC_CONST(0.044142590245416) },
+ { FRAC_CONST(0.001863754990865), FRAC_CONST(0.044154857233763) },
+ { FRAC_CONST(0.001592790795518), FRAC_CONST(0.044165461816692) },
+ { FRAC_CONST(0.001321766632497), FRAC_CONST(0.044174403594946) },
+ { FRAC_CONST(0.001050692705710), FRAC_CONST(0.044181682231873) },
+ { FRAC_CONST(0.000779579220936), FRAC_CONST(0.044187297453434) },
+ { FRAC_CONST(0.000508436385446), FRAC_CONST(0.044191249048222) },
+ { FRAC_CONST(0.000237274407613), FRAC_CONST(0.044193536867459) }
+};
+#endif // LD_DEC
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+/* 480 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_1920[] =
+{
+ { FRAC_CONST(0.032274858518097), FRAC_CONST(0.000013202404176) },
+ { FRAC_CONST(0.032274642494505), FRAC_CONST(0.000118821372483) },
+ { FRAC_CONST(0.032274080835421), FRAC_CONST(0.000224439068308) },
+ { FRAC_CONST(0.032273173546860), FRAC_CONST(0.000330054360572) },
+ { FRAC_CONST(0.032271920638538), FRAC_CONST(0.000435666118218) },
+ { FRAC_CONST(0.032270322123873), FRAC_CONST(0.000541273210231) },
+ { FRAC_CONST(0.032268378019984), FRAC_CONST(0.000646874505642) },
+ { FRAC_CONST(0.032266088347691), FRAC_CONST(0.000752468873546) },
+ { FRAC_CONST(0.032263453131514), FRAC_CONST(0.000858055183114) },
+ { FRAC_CONST(0.032260472399674), FRAC_CONST(0.000963632303600) },
+ { FRAC_CONST(0.032257146184092), FRAC_CONST(0.001069199104358) },
+ { FRAC_CONST(0.032253474520390), FRAC_CONST(0.001174754454853) },
+ { FRAC_CONST(0.032249457447888), FRAC_CONST(0.001280297224671) },
+ { FRAC_CONST(0.032245095009606), FRAC_CONST(0.001385826283535) },
+ { FRAC_CONST(0.032240387252262), FRAC_CONST(0.001491340501313) },
+ { FRAC_CONST(0.032235334226272), FRAC_CONST(0.001596838748031) },
+ { FRAC_CONST(0.032229935985750), FRAC_CONST(0.001702319893890) },
+ { FRAC_CONST(0.032224192588507), FRAC_CONST(0.001807782809271) },
+ { FRAC_CONST(0.032218104096050), FRAC_CONST(0.001913226364749) },
+ { FRAC_CONST(0.032211670573582), FRAC_CONST(0.002018649431111) },
+ { FRAC_CONST(0.032204892090000), FRAC_CONST(0.002124050879359) },
+ { FRAC_CONST(0.032197768717898), FRAC_CONST(0.002229429580728) },
+ { FRAC_CONST(0.032190300533560), FRAC_CONST(0.002334784406698) },
+ { FRAC_CONST(0.032182487616965), FRAC_CONST(0.002440114229003) },
+ { FRAC_CONST(0.032174330051782), FRAC_CONST(0.002545417919644) },
+ { FRAC_CONST(0.032165827925374), FRAC_CONST(0.002650694350905) },
+ { FRAC_CONST(0.032156981328790), FRAC_CONST(0.002755942395358) },
+ { FRAC_CONST(0.032147790356771), FRAC_CONST(0.002861160925883) },
+ { FRAC_CONST(0.032138255107744), FRAC_CONST(0.002966348815672) },
+ { FRAC_CONST(0.032128375683825), FRAC_CONST(0.003071504938250) },
+ { FRAC_CONST(0.032118152190814), FRAC_CONST(0.003176628167476) },
+ { FRAC_CONST(0.032107584738196), FRAC_CONST(0.003281717377568) },
+ { FRAC_CONST(0.032096673439141), FRAC_CONST(0.003386771443102) },
+ { FRAC_CONST(0.032085418410500), FRAC_CONST(0.003491789239036) },
+ { FRAC_CONST(0.032073819772804), FRAC_CONST(0.003596769640711) },
+ { FRAC_CONST(0.032061877650267), FRAC_CONST(0.003701711523874) },
+ { FRAC_CONST(0.032049592170778), FRAC_CONST(0.003806613764680) },
+ { FRAC_CONST(0.032036963465906), FRAC_CONST(0.003911475239711) },
+ { FRAC_CONST(0.032023991670893), FRAC_CONST(0.004016294825985) },
+ { FRAC_CONST(0.032010676924657), FRAC_CONST(0.004121071400967) },
+ { FRAC_CONST(0.031997019369789), FRAC_CONST(0.004225803842586) },
+ { FRAC_CONST(0.031983019152549), FRAC_CONST(0.004330491029241) },
+ { FRAC_CONST(0.031968676422869), FRAC_CONST(0.004435131839816) },
+ { FRAC_CONST(0.031953991334348), FRAC_CONST(0.004539725153692) },
+ { FRAC_CONST(0.031938964044252), FRAC_CONST(0.004644269850758) },
+ { FRAC_CONST(0.031923594713510), FRAC_CONST(0.004748764811426) },
+ { FRAC_CONST(0.031907883506716), FRAC_CONST(0.004853208916638) },
+ { FRAC_CONST(0.031891830592124), FRAC_CONST(0.004957601047881) },
+ { FRAC_CONST(0.031875436141648), FRAC_CONST(0.005061940087200) },
+ { FRAC_CONST(0.031858700330859), FRAC_CONST(0.005166224917208) },
+ { FRAC_CONST(0.031841623338985), FRAC_CONST(0.005270454421097) },
+ { FRAC_CONST(0.031824205348907), FRAC_CONST(0.005374627482653) },
+ { FRAC_CONST(0.031806446547156), FRAC_CONST(0.005478742986267) },
+ { FRAC_CONST(0.031788347123916), FRAC_CONST(0.005582799816945) },
+ { FRAC_CONST(0.031769907273017), FRAC_CONST(0.005686796860323) },
+ { FRAC_CONST(0.031751127191935), FRAC_CONST(0.005790733002674) },
+ { FRAC_CONST(0.031732007081789), FRAC_CONST(0.005894607130928) },
+ { FRAC_CONST(0.031712547147340), FRAC_CONST(0.005998418132675) },
+ { FRAC_CONST(0.031692747596989), FRAC_CONST(0.006102164896182) },
+ { FRAC_CONST(0.031672608642773), FRAC_CONST(0.006205846310406) },
+ { FRAC_CONST(0.031652130500364), FRAC_CONST(0.006309461265002) },
+ { FRAC_CONST(0.031631313389067), FRAC_CONST(0.006413008650337) },
+ { FRAC_CONST(0.031610157531816), FRAC_CONST(0.006516487357501) },
+ { FRAC_CONST(0.031588663155172), FRAC_CONST(0.006619896278321) },
+ { FRAC_CONST(0.031566830489325), FRAC_CONST(0.006723234305370) },
+ { FRAC_CONST(0.031544659768083), FRAC_CONST(0.006826500331981) },
+ { FRAC_CONST(0.031522151228878), FRAC_CONST(0.006929693252258) },
+ { FRAC_CONST(0.031499305112758), FRAC_CONST(0.007032811961088) },
+ { FRAC_CONST(0.031476121664387), FRAC_CONST(0.007135855354151) },
+ { FRAC_CONST(0.031452601132040), FRAC_CONST(0.007238822327937) },
+ { FRAC_CONST(0.031428743767604), FRAC_CONST(0.007341711779751) },
+ { FRAC_CONST(0.031404549826572), FRAC_CONST(0.007444522607730) },
+ { FRAC_CONST(0.031380019568042), FRAC_CONST(0.007547253710853) },
+ { FRAC_CONST(0.031355153254712), FRAC_CONST(0.007649903988952) },
+ { FRAC_CONST(0.031329951152882), FRAC_CONST(0.007752472342725) },
+ { FRAC_CONST(0.031304413532445), FRAC_CONST(0.007854957673748) },
+ { FRAC_CONST(0.031278540666888), FRAC_CONST(0.007957358884484) },
+ { FRAC_CONST(0.031252332833290), FRAC_CONST(0.008059674878300) },
+ { FRAC_CONST(0.031225790312316), FRAC_CONST(0.008161904559473) },
+ { FRAC_CONST(0.031198913388214), FRAC_CONST(0.008264046833205) },
+ { FRAC_CONST(0.031171702348814), FRAC_CONST(0.008366100605636) },
+ { FRAC_CONST(0.031144157485525), FRAC_CONST(0.008468064783849) },
+ { FRAC_CONST(0.031116279093331), FRAC_CONST(0.008569938275893) },
+ { FRAC_CONST(0.031088067470786), FRAC_CONST(0.008671719990782) },
+ { FRAC_CONST(0.031059522920014), FRAC_CONST(0.008773408838517) },
+ { FRAC_CONST(0.031030645746705), FRAC_CONST(0.008875003730092) },
+ { FRAC_CONST(0.031001436260110), FRAC_CONST(0.008976503577507) },
+ { FRAC_CONST(0.030971894773039), FRAC_CONST(0.009077907293780) },
+ { FRAC_CONST(0.030942021601857), FRAC_CONST(0.009179213792959) },
+ { FRAC_CONST(0.030911817066483), FRAC_CONST(0.009280421990133) },
+ { FRAC_CONST(0.030881281490382), FRAC_CONST(0.009381530801444) },
+ { FRAC_CONST(0.030850415200566), FRAC_CONST(0.009482539144097) },
+ { FRAC_CONST(0.030819218527589), FRAC_CONST(0.009583445936373) },
+ { FRAC_CONST(0.030787691805541), FRAC_CONST(0.009684250097643) },
+ { FRAC_CONST(0.030755835372048), FRAC_CONST(0.009784950548375) },
+ { FRAC_CONST(0.030723649568268), FRAC_CONST(0.009885546210147) },
+ { FRAC_CONST(0.030691134738883), FRAC_CONST(0.009986036005661) },
+ { FRAC_CONST(0.030658291232103), FRAC_CONST(0.010086418858753) },
+ { FRAC_CONST(0.030625119399655), FRAC_CONST(0.010186693694402) },
+ { FRAC_CONST(0.030591619596781), FRAC_CONST(0.010286859438745) },
+ { FRAC_CONST(0.030557792182239), FRAC_CONST(0.010386915019088) },
+ { FRAC_CONST(0.030523637518292), FRAC_CONST(0.010486859363916) },
+ { FRAC_CONST(0.030489155970710), FRAC_CONST(0.010586691402906) },
+ { FRAC_CONST(0.030454347908763), FRAC_CONST(0.010686410066936) },
+ { FRAC_CONST(0.030419213705216), FRAC_CONST(0.010786014288099) },
+ { FRAC_CONST(0.030383753736329), FRAC_CONST(0.010885502999714) },
+ { FRAC_CONST(0.030347968381849), FRAC_CONST(0.010984875136338) },
+ { FRAC_CONST(0.030311858025010), FRAC_CONST(0.011084129633775) },
+ { FRAC_CONST(0.030275423052523), FRAC_CONST(0.011183265429088) },
+ { FRAC_CONST(0.030238663854579), FRAC_CONST(0.011282281460612) },
+ { FRAC_CONST(0.030201580824838), FRAC_CONST(0.011381176667967) },
+ { FRAC_CONST(0.030164174360430), FRAC_CONST(0.011479949992062) },
+ { FRAC_CONST(0.030126444861948), FRAC_CONST(0.011578600375117) },
+ { FRAC_CONST(0.030088392733446), FRAC_CONST(0.011677126760663) },
+ { FRAC_CONST(0.030050018382430), FRAC_CONST(0.011775528093563) },
+ { FRAC_CONST(0.030011322219859), FRAC_CONST(0.011873803320018) },
+ { FRAC_CONST(0.029972304660138), FRAC_CONST(0.011971951387578) },
+ { FRAC_CONST(0.029932966121114), FRAC_CONST(0.012069971245157) },
+ { FRAC_CONST(0.029893307024070), FRAC_CONST(0.012167861843041) },
+ { FRAC_CONST(0.029853327793724), FRAC_CONST(0.012265622132901) },
+ { FRAC_CONST(0.029813028858222), FRAC_CONST(0.012363251067801) },
+ { FRAC_CONST(0.029772410649132), FRAC_CONST(0.012460747602215) },
+ { FRAC_CONST(0.029731473601443), FRAC_CONST(0.012558110692033) },
+ { FRAC_CONST(0.029690218153558), FRAC_CONST(0.012655339294575) },
+ { FRAC_CONST(0.029648644747289), FRAC_CONST(0.012752432368600) },
+ { FRAC_CONST(0.029606753827855), FRAC_CONST(0.012849388874320) },
+ { FRAC_CONST(0.029564545843872), FRAC_CONST(0.012946207773407) },
+ { FRAC_CONST(0.029522021247356), FRAC_CONST(0.013042888029011) },
+ { FRAC_CONST(0.029479180493710), FRAC_CONST(0.013139428605762) },
+ { FRAC_CONST(0.029436024041725), FRAC_CONST(0.013235828469789) },
+ { FRAC_CONST(0.029392552353570), FRAC_CONST(0.013332086588727) },
+ { FRAC_CONST(0.029348765894794), FRAC_CONST(0.013428201931728) },
+ { FRAC_CONST(0.029304665134313), FRAC_CONST(0.013524173469475) },
+ { FRAC_CONST(0.029260250544412), FRAC_CONST(0.013620000174189) },
+ { FRAC_CONST(0.029215522600735), FRAC_CONST(0.013715681019643) },
+ { FRAC_CONST(0.029170481782283), FRAC_CONST(0.013811214981173) },
+ { FRAC_CONST(0.029125128571406), FRAC_CONST(0.013906601035686) },
+ { FRAC_CONST(0.029079463453801), FRAC_CONST(0.014001838161674) },
+ { FRAC_CONST(0.029033486918505), FRAC_CONST(0.014096925339225) },
+ { FRAC_CONST(0.028987199457889), FRAC_CONST(0.014191861550031) },
+ { FRAC_CONST(0.028940601567655), FRAC_CONST(0.014286645777401) },
+ { FRAC_CONST(0.028893693746829), FRAC_CONST(0.014381277006273) },
+ { FRAC_CONST(0.028846476497755), FRAC_CONST(0.014475754223221) },
+ { FRAC_CONST(0.028798950326094), FRAC_CONST(0.014570076416472) },
+ { FRAC_CONST(0.028751115740811), FRAC_CONST(0.014664242575910) },
+ { FRAC_CONST(0.028702973254178), FRAC_CONST(0.014758251693091) },
+ { FRAC_CONST(0.028654523381760), FRAC_CONST(0.014852102761253) },
+ { FRAC_CONST(0.028605766642418), FRAC_CONST(0.014945794775326) },
+ { FRAC_CONST(0.028556703558297), FRAC_CONST(0.015039326731945) },
+ { FRAC_CONST(0.028507334654823), FRAC_CONST(0.015132697629457) },
+ { FRAC_CONST(0.028457660460698), FRAC_CONST(0.015225906467935) },
+ { FRAC_CONST(0.028407681507891), FRAC_CONST(0.015318952249187) },
+ { FRAC_CONST(0.028357398331639), FRAC_CONST(0.015411833976768) },
+ { FRAC_CONST(0.028306811470432), FRAC_CONST(0.015504550655988) },
+ { FRAC_CONST(0.028255921466016), FRAC_CONST(0.015597101293927) },
+ { FRAC_CONST(0.028204728863381), FRAC_CONST(0.015689484899442) },
+ { FRAC_CONST(0.028153234210760), FRAC_CONST(0.015781700483179) },
+ { FRAC_CONST(0.028101438059619), FRAC_CONST(0.015873747057582) },
+ { FRAC_CONST(0.028049340964652), FRAC_CONST(0.015965623636907) },
+ { FRAC_CONST(0.027996943483779), FRAC_CONST(0.016057329237229) },
+ { FRAC_CONST(0.027944246178133), FRAC_CONST(0.016148862876456) },
+ { FRAC_CONST(0.027891249612061), FRAC_CONST(0.016240223574335) },
+ { FRAC_CONST(0.027837954353113), FRAC_CONST(0.016331410352467) },
+ { FRAC_CONST(0.027784360972039), FRAC_CONST(0.016422422234315) },
+ { FRAC_CONST(0.027730470042780), FRAC_CONST(0.016513258245214) },
+ { FRAC_CONST(0.027676282142466), FRAC_CONST(0.016603917412384) },
+ { FRAC_CONST(0.027621797851405), FRAC_CONST(0.016694398764938) },
+ { FRAC_CONST(0.027567017753080), FRAC_CONST(0.016784701333894) },
+ { FRAC_CONST(0.027511942434143), FRAC_CONST(0.016874824152183) },
+ { FRAC_CONST(0.027456572484404), FRAC_CONST(0.016964766254662) },
+ { FRAC_CONST(0.027400908496833), FRAC_CONST(0.017054526678124) },
+ { FRAC_CONST(0.027344951067546), FRAC_CONST(0.017144104461307) },
+ { FRAC_CONST(0.027288700795801), FRAC_CONST(0.017233498644904) },
+ { FRAC_CONST(0.027232158283994), FRAC_CONST(0.017322708271577) },
+ { FRAC_CONST(0.027175324137651), FRAC_CONST(0.017411732385960) },
+ { FRAC_CONST(0.027118198965418), FRAC_CONST(0.017500570034678) },
+ { FRAC_CONST(0.027060783379060), FRAC_CONST(0.017589220266351) },
+ { FRAC_CONST(0.027003077993454), FRAC_CONST(0.017677682131607) },
+ { FRAC_CONST(0.026945083426576), FRAC_CONST(0.017765954683088) },
+ { FRAC_CONST(0.026886800299502), FRAC_CONST(0.017854036975468) },
+ { FRAC_CONST(0.026828229236397), FRAC_CONST(0.017941928065456) },
+ { FRAC_CONST(0.026769370864511), FRAC_CONST(0.018029627011808) },
+ { FRAC_CONST(0.026710225814170), FRAC_CONST(0.018117132875340) },
+ { FRAC_CONST(0.026650794718768), FRAC_CONST(0.018204444718934) },
+ { FRAC_CONST(0.026591078214767), FRAC_CONST(0.018291561607551) },
+ { FRAC_CONST(0.026531076941680), FRAC_CONST(0.018378482608238) },
+ { FRAC_CONST(0.026470791542075), FRAC_CONST(0.018465206790142) },
+ { FRAC_CONST(0.026410222661558), FRAC_CONST(0.018551733224515) },
+ { FRAC_CONST(0.026349370948775), FRAC_CONST(0.018638060984730) },
+ { FRAC_CONST(0.026288237055398), FRAC_CONST(0.018724189146286) },
+ { FRAC_CONST(0.026226821636121), FRAC_CONST(0.018810116786819) },
+ { FRAC_CONST(0.026165125348656), FRAC_CONST(0.018895842986112) },
+ { FRAC_CONST(0.026103148853718), FRAC_CONST(0.018981366826109) },
+ { FRAC_CONST(0.026040892815028), FRAC_CONST(0.019066687390916) },
+ { FRAC_CONST(0.025978357899296), FRAC_CONST(0.019151803766819) },
+ { FRAC_CONST(0.025915544776223), FRAC_CONST(0.019236715042290) },
+ { FRAC_CONST(0.025852454118485), FRAC_CONST(0.019321420307998) },
+ { FRAC_CONST(0.025789086601733), FRAC_CONST(0.019405918656817) },
+ { FRAC_CONST(0.025725442904582), FRAC_CONST(0.019490209183837) },
+ { FRAC_CONST(0.025661523708606), FRAC_CONST(0.019574290986376) },
+ { FRAC_CONST(0.025597329698327), FRAC_CONST(0.019658163163984) },
+ { FRAC_CONST(0.025532861561211), FRAC_CONST(0.019741824818458) },
+ { FRAC_CONST(0.025468119987662), FRAC_CONST(0.019825275053848) },
+ { FRAC_CONST(0.025403105671008), FRAC_CONST(0.019908512976470) },
+ { FRAC_CONST(0.025337819307501), FRAC_CONST(0.019991537694913) },
+ { FRAC_CONST(0.025272261596305), FRAC_CONST(0.020074348320047) },
+ { FRAC_CONST(0.025206433239491), FRAC_CONST(0.020156943965039) },
+ { FRAC_CONST(0.025140334942028), FRAC_CONST(0.020239323745355) },
+ { FRAC_CONST(0.025073967411776), FRAC_CONST(0.020321486778774) },
+ { FRAC_CONST(0.025007331359476), FRAC_CONST(0.020403432185395) },
+ { FRAC_CONST(0.024940427498748), FRAC_CONST(0.020485159087650) },
+ { FRAC_CONST(0.024873256546079), FRAC_CONST(0.020566666610309) },
+ { FRAC_CONST(0.024805819220816), FRAC_CONST(0.020647953880491) },
+ { FRAC_CONST(0.024738116245157), FRAC_CONST(0.020729020027676) },
+ { FRAC_CONST(0.024670148344147), FRAC_CONST(0.020809864183709) },
+ { FRAC_CONST(0.024601916245669), FRAC_CONST(0.020890485482816) },
+ { FRAC_CONST(0.024533420680433), FRAC_CONST(0.020970883061607) },
+ { FRAC_CONST(0.024464662381971), FRAC_CONST(0.021051056059087) },
+ { FRAC_CONST(0.024395642086630), FRAC_CONST(0.021131003616670) },
+ { FRAC_CONST(0.024326360533561), FRAC_CONST(0.021210724878181) },
+ { FRAC_CONST(0.024256818464715), FRAC_CONST(0.021290218989868) },
+ { FRAC_CONST(0.024187016624830), FRAC_CONST(0.021369485100415) },
+ { FRAC_CONST(0.024116955761430), FRAC_CONST(0.021448522360944) },
+ { FRAC_CONST(0.024046636624808), FRAC_CONST(0.021527329925030) },
+ { FRAC_CONST(0.023976059968027), FRAC_CONST(0.021605906948708) },
+ { FRAC_CONST(0.023905226546906), FRAC_CONST(0.021684252590480) },
+ { FRAC_CONST(0.023834137120014), FRAC_CONST(0.021762366011328) },
+ { FRAC_CONST(0.023762792448662), FRAC_CONST(0.021840246374720) },
+ { FRAC_CONST(0.023691193296893), FRAC_CONST(0.021917892846620) },
+ { FRAC_CONST(0.023619340431478), FRAC_CONST(0.021995304595495) },
+ { FRAC_CONST(0.023547234621902), FRAC_CONST(0.022072480792330) },
+ { FRAC_CONST(0.023474876640361), FRAC_CONST(0.022149420610628) },
+ { FRAC_CONST(0.023402267261751), FRAC_CONST(0.022226123226426) },
+ { FRAC_CONST(0.023329407263659), FRAC_CONST(0.022302587818300) },
+ { FRAC_CONST(0.023256297426359), FRAC_CONST(0.022378813567377) },
+ { FRAC_CONST(0.023182938532797), FRAC_CONST(0.022454799657339) },
+ { FRAC_CONST(0.023109331368588), FRAC_CONST(0.022530545274437) },
+ { FRAC_CONST(0.023035476722006), FRAC_CONST(0.022606049607496) },
+ { FRAC_CONST(0.022961375383975), FRAC_CONST(0.022681311847926) },
+ { FRAC_CONST(0.022887028148061), FRAC_CONST(0.022756331189727) },
+ { FRAC_CONST(0.022812435810462), FRAC_CONST(0.022831106829504) },
+ { FRAC_CONST(0.022737599170003), FRAC_CONST(0.022905637966469) },
+ { FRAC_CONST(0.022662519028125), FRAC_CONST(0.022979923802453) },
+ { FRAC_CONST(0.022587196188874), FRAC_CONST(0.023053963541915) },
+ { FRAC_CONST(0.022511631458899), FRAC_CONST(0.023127756391950) },
+ { FRAC_CONST(0.022435825647437), FRAC_CONST(0.023201301562294) },
+ { FRAC_CONST(0.022359779566306), FRAC_CONST(0.023274598265338) },
+ { FRAC_CONST(0.022283494029900), FRAC_CONST(0.023347645716133) },
+ { FRAC_CONST(0.022206969855176), FRAC_CONST(0.023420443132400) },
+ { FRAC_CONST(0.022130207861645), FRAC_CONST(0.023492989734537) },
+ { FRAC_CONST(0.022053208871367), FRAC_CONST(0.023565284745628) },
+ { FRAC_CONST(0.021975973708940), FRAC_CONST(0.023637327391451) },
+ { FRAC_CONST(0.021898503201489), FRAC_CONST(0.023709116900488) },
+ { FRAC_CONST(0.021820798178663), FRAC_CONST(0.023780652503931) },
+ { FRAC_CONST(0.021742859472618), FRAC_CONST(0.023851933435691) },
+ { FRAC_CONST(0.021664687918017), FRAC_CONST(0.023922958932406) },
+ { FRAC_CONST(0.021586284352013), FRAC_CONST(0.023993728233451) },
+ { FRAC_CONST(0.021507649614247), FRAC_CONST(0.024064240580942) },
+ { FRAC_CONST(0.021428784546832), FRAC_CONST(0.024134495219750) },
+ { FRAC_CONST(0.021349689994350), FRAC_CONST(0.024204491397504) },
+ { FRAC_CONST(0.021270366803840), FRAC_CONST(0.024274228364600) },
+ { FRAC_CONST(0.021190815824791), FRAC_CONST(0.024343705374213) },
+ { FRAC_CONST(0.021111037909128), FRAC_CONST(0.024412921682298) },
+ { FRAC_CONST(0.021031033911210), FRAC_CONST(0.024481876547605) },
+ { FRAC_CONST(0.020950804687815), FRAC_CONST(0.024550569231683) },
+ { FRAC_CONST(0.020870351098134), FRAC_CONST(0.024618998998889) },
+ { FRAC_CONST(0.020789674003759), FRAC_CONST(0.024687165116394) },
+ { FRAC_CONST(0.020708774268678), FRAC_CONST(0.024755066854194) },
+ { FRAC_CONST(0.020627652759262), FRAC_CONST(0.024822703485116) },
+ { FRAC_CONST(0.020546310344257), FRAC_CONST(0.024890074284826) },
+ { FRAC_CONST(0.020464747894775), FRAC_CONST(0.024957178531837) },
+ { FRAC_CONST(0.020382966284284), FRAC_CONST(0.025024015507516) },
+ { FRAC_CONST(0.020300966388600), FRAC_CONST(0.025090584496093) },
+ { FRAC_CONST(0.020218749085876), FRAC_CONST(0.025156884784668) },
+ { FRAC_CONST(0.020136315256592), FRAC_CONST(0.025222915663218) },
+ { FRAC_CONST(0.020053665783549), FRAC_CONST(0.025288676424605) },
+ { FRAC_CONST(0.019970801551857), FRAC_CONST(0.025354166364584) },
+ { FRAC_CONST(0.019887723448925), FRAC_CONST(0.025419384781811) },
+ { FRAC_CONST(0.019804432364452), FRAC_CONST(0.025484330977848) },
+ { FRAC_CONST(0.019720929190419), FRAC_CONST(0.025549004257175) },
+ { FRAC_CONST(0.019637214821078), FRAC_CONST(0.025613403927192) },
+ { FRAC_CONST(0.019553290152943), FRAC_CONST(0.025677529298230) },
+ { FRAC_CONST(0.019469156084779), FRAC_CONST(0.025741379683559) },
+ { FRAC_CONST(0.019384813517595), FRAC_CONST(0.025804954399392) },
+ { FRAC_CONST(0.019300263354632), FRAC_CONST(0.025868252764895) },
+ { FRAC_CONST(0.019215506501354), FRAC_CONST(0.025931274102193) },
+ { FRAC_CONST(0.019130543865439), FRAC_CONST(0.025994017736379) },
+ { FRAC_CONST(0.019045376356769), FRAC_CONST(0.026056482995518) },
+ { FRAC_CONST(0.018960004887419), FRAC_CONST(0.026118669210657) },
+ { FRAC_CONST(0.018874430371648), FRAC_CONST(0.026180575715833) },
+ { FRAC_CONST(0.018788653725892), FRAC_CONST(0.026242201848076) },
+ { FRAC_CONST(0.018702675868750), FRAC_CONST(0.026303546947421) },
+ { FRAC_CONST(0.018616497720974), FRAC_CONST(0.026364610356909) },
+ { FRAC_CONST(0.018530120205464), FRAC_CONST(0.026425391422602) },
+ { FRAC_CONST(0.018443544247254), FRAC_CONST(0.026485889493583) },
+ { FRAC_CONST(0.018356770773502), FRAC_CONST(0.026546103921965) },
+ { FRAC_CONST(0.018269800713483), FRAC_CONST(0.026606034062902) },
+ { FRAC_CONST(0.018182634998576), FRAC_CONST(0.026665679274589) },
+ { FRAC_CONST(0.018095274562256), FRAC_CONST(0.026725038918274) },
+ { FRAC_CONST(0.018007720340083), FRAC_CONST(0.026784112358263) },
+ { FRAC_CONST(0.017919973269692), FRAC_CONST(0.026842898961926) },
+ { FRAC_CONST(0.017832034290785), FRAC_CONST(0.026901398099707) },
+ { FRAC_CONST(0.017743904345116), FRAC_CONST(0.026959609145127) },
+ { FRAC_CONST(0.017655584376488), FRAC_CONST(0.027017531474792) },
+ { FRAC_CONST(0.017567075330734), FRAC_CONST(0.027075164468401) },
+ { FRAC_CONST(0.017478378155718), FRAC_CONST(0.027132507508750) },
+ { FRAC_CONST(0.017389493801313), FRAC_CONST(0.027189559981742) },
+ { FRAC_CONST(0.017300423219401), FRAC_CONST(0.027246321276391) },
+ { FRAC_CONST(0.017211167363854), FRAC_CONST(0.027302790784828) },
+ { FRAC_CONST(0.017121727190533), FRAC_CONST(0.027358967902310) },
+ { FRAC_CONST(0.017032103657269), FRAC_CONST(0.027414852027226) },
+ { FRAC_CONST(0.016942297723858), FRAC_CONST(0.027470442561102) },
+ { FRAC_CONST(0.016852310352050), FRAC_CONST(0.027525738908608) },
+ { FRAC_CONST(0.016762142505537), FRAC_CONST(0.027580740477564) },
+ { FRAC_CONST(0.016671795149944), FRAC_CONST(0.027635446678948) },
+ { FRAC_CONST(0.016581269252819), FRAC_CONST(0.027689856926900) },
+ { FRAC_CONST(0.016490565783622), FRAC_CONST(0.027743970638730) },
+ { FRAC_CONST(0.016399685713714), FRAC_CONST(0.027797787234924) },
+ { FRAC_CONST(0.016308630016347), FRAC_CONST(0.027851306139149) },
+ { FRAC_CONST(0.016217399666655), FRAC_CONST(0.027904526778260) },
+ { FRAC_CONST(0.016125995641641), FRAC_CONST(0.027957448582309) },
+ { FRAC_CONST(0.016034418920170), FRAC_CONST(0.028010070984544) },
+ { FRAC_CONST(0.015942670482954), FRAC_CONST(0.028062393421421) },
+ { FRAC_CONST(0.015850751312545), FRAC_CONST(0.028114415332610) },
+ { FRAC_CONST(0.015758662393324), FRAC_CONST(0.028166136160998) },
+ { FRAC_CONST(0.015666404711489), FRAC_CONST(0.028217555352697) },
+ { FRAC_CONST(0.015573979255046), FRAC_CONST(0.028268672357047) },
+ { FRAC_CONST(0.015481387013797), FRAC_CONST(0.028319486626627) },
+ { FRAC_CONST(0.015388628979331), FRAC_CONST(0.028369997617257) },
+ { FRAC_CONST(0.015295706145012), FRAC_CONST(0.028420204788004) },
+ { FRAC_CONST(0.015202619505968), FRAC_CONST(0.028470107601191) },
+ { FRAC_CONST(0.015109370059084), FRAC_CONST(0.028519705522399) },
+ { FRAC_CONST(0.015015958802984), FRAC_CONST(0.028568998020472) },
+ { FRAC_CONST(0.014922386738030), FRAC_CONST(0.028617984567529) },
+ { FRAC_CONST(0.014828654866302), FRAC_CONST(0.028666664638963) },
+ { FRAC_CONST(0.014734764191593), FRAC_CONST(0.028715037713449) },
+ { FRAC_CONST(0.014640715719398), FRAC_CONST(0.028763103272951) },
+ { FRAC_CONST(0.014546510456900), FRAC_CONST(0.028810860802724) },
+ { FRAC_CONST(0.014452149412962), FRAC_CONST(0.028858309791325) },
+ { FRAC_CONST(0.014357633598114), FRAC_CONST(0.028905449730613) },
+ { FRAC_CONST(0.014262964024545), FRAC_CONST(0.028952280115756) },
+ { FRAC_CONST(0.014168141706090), FRAC_CONST(0.028998800445240) },
+ { FRAC_CONST(0.014073167658220), FRAC_CONST(0.029045010220868) },
+ { FRAC_CONST(0.013978042898030), FRAC_CONST(0.029090908947771) },
+ { FRAC_CONST(0.013882768444231), FRAC_CONST(0.029136496134411) },
+ { FRAC_CONST(0.013787345317136), FRAC_CONST(0.029181771292585) },
+ { FRAC_CONST(0.013691774538648), FRAC_CONST(0.029226733937433) },
+ { FRAC_CONST(0.013596057132255), FRAC_CONST(0.029271383587441) },
+ { FRAC_CONST(0.013500194123014), FRAC_CONST(0.029315719764447) },
+ { FRAC_CONST(0.013404186537539), FRAC_CONST(0.029359741993647) },
+ { FRAC_CONST(0.013308035403995), FRAC_CONST(0.029403449803598) },
+ { FRAC_CONST(0.013211741752084), FRAC_CONST(0.029446842726223) },
+ { FRAC_CONST(0.013115306613032), FRAC_CONST(0.029489920296820) },
+ { FRAC_CONST(0.013018731019584), FRAC_CONST(0.029532682054063) },
+ { FRAC_CONST(0.012922016005985), FRAC_CONST(0.029575127540008) },
+ { FRAC_CONST(0.012825162607977), FRAC_CONST(0.029617256300097) },
+ { FRAC_CONST(0.012728171862781), FRAC_CONST(0.029659067883165) },
+ { FRAC_CONST(0.012631044809089), FRAC_CONST(0.029700561841444) },
+ { FRAC_CONST(0.012533782487056), FRAC_CONST(0.029741737730567) },
+ { FRAC_CONST(0.012436385938281), FRAC_CONST(0.029782595109573) },
+ { FRAC_CONST(0.012338856205805), FRAC_CONST(0.029823133540913) },
+ { FRAC_CONST(0.012241194334091), FRAC_CONST(0.029863352590452) },
+ { FRAC_CONST(0.012143401369021), FRAC_CONST(0.029903251827477) },
+ { FRAC_CONST(0.012045478357878), FRAC_CONST(0.029942830824699) },
+ { FRAC_CONST(0.011947426349339), FRAC_CONST(0.029982089158259) },
+ { FRAC_CONST(0.011849246393462), FRAC_CONST(0.030021026407731) },
+ { FRAC_CONST(0.011750939541676), FRAC_CONST(0.030059642156129) },
+ { FRAC_CONST(0.011652506846768), FRAC_CONST(0.030097935989909) },
+ { FRAC_CONST(0.011553949362874), FRAC_CONST(0.030135907498976) },
+ { FRAC_CONST(0.011455268145464), FRAC_CONST(0.030173556276684) },
+ { FRAC_CONST(0.011356464251335), FRAC_CONST(0.030210881919845) },
+ { FRAC_CONST(0.011257538738598), FRAC_CONST(0.030247884028732) },
+ { FRAC_CONST(0.011158492666665), FRAC_CONST(0.030284562207083) },
+ { FRAC_CONST(0.011059327096240), FRAC_CONST(0.030320916062102) },
+ { FRAC_CONST(0.010960043089307), FRAC_CONST(0.030356945204470) },
+ { FRAC_CONST(0.010860641709118), FRAC_CONST(0.030392649248343) },
+ { FRAC_CONST(0.010761124020182), FRAC_CONST(0.030428027811361) },
+ { FRAC_CONST(0.010661491088253), FRAC_CONST(0.030463080514646) },
+ { FRAC_CONST(0.010561743980319), FRAC_CONST(0.030497806982812) },
+ { FRAC_CONST(0.010461883764593), FRAC_CONST(0.030532206843968) },
+ { FRAC_CONST(0.010361911510496), FRAC_CONST(0.030566279729717) },
+ { FRAC_CONST(0.010261828288652), FRAC_CONST(0.030600025275167) },
+ { FRAC_CONST(0.010161635170872), FRAC_CONST(0.030633443118931) },
+ { FRAC_CONST(0.010061333230142), FRAC_CONST(0.030666532903129) },
+ { FRAC_CONST(0.009960923540617), FRAC_CONST(0.030699294273397) },
+ { FRAC_CONST(0.009860407177603), FRAC_CONST(0.030731726878888) },
+ { FRAC_CONST(0.009759785217550), FRAC_CONST(0.030763830372273) },
+ { FRAC_CONST(0.009659058738038), FRAC_CONST(0.030795604409750) },
+ { FRAC_CONST(0.009558228817767), FRAC_CONST(0.030827048651045) },
+ { FRAC_CONST(0.009457296536545), FRAC_CONST(0.030858162759415) },
+ { FRAC_CONST(0.009356262975275), FRAC_CONST(0.030888946401653) },
+ { FRAC_CONST(0.009255129215945), FRAC_CONST(0.030919399248091) },
+ { FRAC_CONST(0.009153896341616), FRAC_CONST(0.030949520972603) },
+ { FRAC_CONST(0.009052565436412), FRAC_CONST(0.030979311252611) },
+ { FRAC_CONST(0.008951137585505), FRAC_CONST(0.031008769769084) },
+ { FRAC_CONST(0.008849613875105), FRAC_CONST(0.031037896206544) },
+ { FRAC_CONST(0.008747995392451), FRAC_CONST(0.031066690253072) },
+ { FRAC_CONST(0.008646283225794), FRAC_CONST(0.031095151600306) },
+ { FRAC_CONST(0.008544478464390), FRAC_CONST(0.031123279943448) },
+ { FRAC_CONST(0.008442582198486), FRAC_CONST(0.031151074981266) },
+ { FRAC_CONST(0.008340595519310), FRAC_CONST(0.031178536416098) },
+ { FRAC_CONST(0.008238519519057), FRAC_CONST(0.031205663953853) },
+ { FRAC_CONST(0.008136355290878), FRAC_CONST(0.031232457304017) },
+ { FRAC_CONST(0.008034103928871), FRAC_CONST(0.031258916179656) },
+ { FRAC_CONST(0.007931766528065), FRAC_CONST(0.031285040297416) },
+ { FRAC_CONST(0.007829344184412), FRAC_CONST(0.031310829377528) },
+ { FRAC_CONST(0.007726837994772), FRAC_CONST(0.031336283143813) },
+ { FRAC_CONST(0.007624249056906), FRAC_CONST(0.031361401323680) },
+ { FRAC_CONST(0.007521578469457), FRAC_CONST(0.031386183648135) },
+ { FRAC_CONST(0.007418827331946), FRAC_CONST(0.031410629851778) },
+ { FRAC_CONST(0.007315996744755), FRAC_CONST(0.031434739672811) },
+ { FRAC_CONST(0.007213087809115), FRAC_CONST(0.031458512853036) },
+ { FRAC_CONST(0.007110101627101), FRAC_CONST(0.031481949137863) },
+ { FRAC_CONST(0.007007039301610), FRAC_CONST(0.031505048276306) },
+ { FRAC_CONST(0.006903901936357), FRAC_CONST(0.031527810020993) },
+ { FRAC_CONST(0.006800690635862), FRAC_CONST(0.031550234128164) },
+ { FRAC_CONST(0.006697406505433), FRAC_CONST(0.031572320357675) },
+ { FRAC_CONST(0.006594050651161), FRAC_CONST(0.031594068473000) },
+ { FRAC_CONST(0.006490624179905), FRAC_CONST(0.031615478241233) },
+ { FRAC_CONST(0.006387128199278), FRAC_CONST(0.031636549433095) },
+ { FRAC_CONST(0.006283563817639), FRAC_CONST(0.031657281822929) },
+ { FRAC_CONST(0.006179932144080), FRAC_CONST(0.031677675188707) },
+ { FRAC_CONST(0.006076234288412), FRAC_CONST(0.031697729312034) },
+ { FRAC_CONST(0.005972471361157), FRAC_CONST(0.031717443978146) },
+ { FRAC_CONST(0.005868644473532), FRAC_CONST(0.031736818975914) },
+ { FRAC_CONST(0.005764754737440), FRAC_CONST(0.031755854097848) },
+ { FRAC_CONST(0.005660803265456), FRAC_CONST(0.031774549140098) },
+ { FRAC_CONST(0.005556791170816), FRAC_CONST(0.031792903902453) },
+ { FRAC_CONST(0.005452719567407), FRAC_CONST(0.031810918188350) },
+ { FRAC_CONST(0.005348589569753), FRAC_CONST(0.031828591804869) },
+ { FRAC_CONST(0.005244402293001), FRAC_CONST(0.031845924562742) },
+ { FRAC_CONST(0.005140158852914), FRAC_CONST(0.031862916276347) },
+ { FRAC_CONST(0.005035860365855), FRAC_CONST(0.031879566763717) },
+ { FRAC_CONST(0.004931507948778), FRAC_CONST(0.031895875846539) },
+ { FRAC_CONST(0.004827102719212), FRAC_CONST(0.031911843350155) },
+ { FRAC_CONST(0.004722645795254), FRAC_CONST(0.031927469103567) },
+ { FRAC_CONST(0.004618138295554), FRAC_CONST(0.031942752939435) },
+ { FRAC_CONST(0.004513581339303), FRAC_CONST(0.031957694694082) },
+ { FRAC_CONST(0.004408976046222), FRAC_CONST(0.031972294207493) },
+ { FRAC_CONST(0.004304323536549), FRAC_CONST(0.031986551323320) },
+ { FRAC_CONST(0.004199624931030), FRAC_CONST(0.032000465888879) },
+ { FRAC_CONST(0.004094881350902), FRAC_CONST(0.032014037755158) },
+ { FRAC_CONST(0.003990093917884), FRAC_CONST(0.032027266776813) },
+ { FRAC_CONST(0.003885263754166), FRAC_CONST(0.032040152812170) },
+ { FRAC_CONST(0.003780391982394), FRAC_CONST(0.032052695723232) },
+ { FRAC_CONST(0.003675479725661), FRAC_CONST(0.032064895375674) },
+ { FRAC_CONST(0.003570528107494), FRAC_CONST(0.032076751638847) },
+ { FRAC_CONST(0.003465538251839), FRAC_CONST(0.032088264385780) },
+ { FRAC_CONST(0.003360511283053), FRAC_CONST(0.032099433493181) },
+ { FRAC_CONST(0.003255448325892), FRAC_CONST(0.032110258841438) },
+ { FRAC_CONST(0.003150350505494), FRAC_CONST(0.032120740314619) },
+ { FRAC_CONST(0.003045218947373), FRAC_CONST(0.032130877800478) },
+ { FRAC_CONST(0.002940054777404), FRAC_CONST(0.032140671190449) },
+ { FRAC_CONST(0.002834859121810), FRAC_CONST(0.032150120379653) },
+ { FRAC_CONST(0.002729633107153), FRAC_CONST(0.032159225266897) },
+ { FRAC_CONST(0.002624377860318), FRAC_CONST(0.032167985754674) },
+ { FRAC_CONST(0.002519094508504), FRAC_CONST(0.032176401749168) },
+ { FRAC_CONST(0.002413784179212), FRAC_CONST(0.032184473160250) },
+ { FRAC_CONST(0.002308448000231), FRAC_CONST(0.032192199901481) },
+ { FRAC_CONST(0.002203087099626), FRAC_CONST(0.032199581890114) },
+ { FRAC_CONST(0.002097702605728), FRAC_CONST(0.032206619047093) },
+ { FRAC_CONST(0.001992295647121), FRAC_CONST(0.032213311297057) },
+ { FRAC_CONST(0.001886867352628), FRAC_CONST(0.032219658568338) },
+ { FRAC_CONST(0.001781418851302), FRAC_CONST(0.032225660792960) },
+ { FRAC_CONST(0.001675951272410), FRAC_CONST(0.032231317906644) },
+ { FRAC_CONST(0.001570465745428), FRAC_CONST(0.032236629848809) },
+ { FRAC_CONST(0.001464963400018), FRAC_CONST(0.032241596562566) },
+ { FRAC_CONST(0.001359445366028), FRAC_CONST(0.032246217994727) },
+ { FRAC_CONST(0.001253912773470), FRAC_CONST(0.032250494095799) },
+ { FRAC_CONST(0.001148366752513), FRAC_CONST(0.032254424819990) },
+ { FRAC_CONST(0.001042808433471), FRAC_CONST(0.032258010125204) },
+ { FRAC_CONST(0.000937238946789), FRAC_CONST(0.032261249973045) },
+ { FRAC_CONST(0.000831659423030), FRAC_CONST(0.032264144328817) },
+ { FRAC_CONST(0.000726070992868), FRAC_CONST(0.032266693161525) },
+ { FRAC_CONST(0.000620474787068), FRAC_CONST(0.032268896443871) },
+ { FRAC_CONST(0.000514871936481), FRAC_CONST(0.032270754152261) },
+ { FRAC_CONST(0.000409263572030), FRAC_CONST(0.032272266266801) },
+ { FRAC_CONST(0.000303650824695), FRAC_CONST(0.032273432771295) },
+ { FRAC_CONST(0.000198034825504), FRAC_CONST(0.032274253653254) },
+ { FRAC_CONST(0.000092416705518), FRAC_CONST(0.032274728903884) }
+};
+
+#ifdef LD_DEC
+/* 240 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_960[] =
+{
+ { FRAC_CONST(0.045643531183573), FRAC_CONST(0.000037342034959) },
+ { FRAC_CONST(0.045642309173789), FRAC_CONST(0.000336075315362) },
+ { FRAC_CONST(0.045639131999390), FRAC_CONST(0.000634794199417) },
+ { FRAC_CONST(0.045633999796474), FRAC_CONST(0.000933485891002) },
+ { FRAC_CONST(0.045626912784890), FRAC_CONST(0.001232137595157) },
+ { FRAC_CONST(0.045617871268219), FRAC_CONST(0.001530736518639) },
+ { FRAC_CONST(0.045606875633772), FRAC_CONST(0.001829269870464) },
+ { FRAC_CONST(0.045593926352564), FRAC_CONST(0.002127724862455) },
+ { FRAC_CONST(0.045579023979299), FRAC_CONST(0.002426088709795) },
+ { FRAC_CONST(0.045562169152346), FRAC_CONST(0.002724348631569) },
+ { FRAC_CONST(0.045543362593709), FRAC_CONST(0.003022491851315) },
+ { FRAC_CONST(0.045522605108999), FRAC_CONST(0.003320505597570) },
+ { FRAC_CONST(0.045499897587396), FRAC_CONST(0.003618377104416) },
+ { FRAC_CONST(0.045475241001617), FRAC_CONST(0.003916093612031) },
+ { FRAC_CONST(0.045448636407866), FRAC_CONST(0.004213642367228) },
+ { FRAC_CONST(0.045420084945797), FRAC_CONST(0.004511010624011) },
+ { FRAC_CONST(0.045389587838458), FRAC_CONST(0.004808185644112) },
+ { FRAC_CONST(0.045357146392244), FRAC_CONST(0.005105154697544) },
+ { FRAC_CONST(0.045322761996840), FRAC_CONST(0.005401905063139) },
+ { FRAC_CONST(0.045286436125157), FRAC_CONST(0.005698424029100) },
+ { FRAC_CONST(0.045248170333275), FRAC_CONST(0.005994698893542) },
+ { FRAC_CONST(0.045207966260374), FRAC_CONST(0.006290716965035) },
+ { FRAC_CONST(0.045165825628663), FRAC_CONST(0.006586465563151) },
+ { FRAC_CONST(0.045121750243305), FRAC_CONST(0.006881932019003) },
+ { FRAC_CONST(0.045075741992343), FRAC_CONST(0.007177103675792) },
+ { FRAC_CONST(0.045027802846618), FRAC_CONST(0.007471967889347) },
+ { FRAC_CONST(0.044977934859683), FRAC_CONST(0.007766512028667) },
+ { FRAC_CONST(0.044926140167717), FRAC_CONST(0.008060723476460) },
+ { FRAC_CONST(0.044872420989432), FRAC_CONST(0.008354589629687) },
+ { FRAC_CONST(0.044816779625979), FRAC_CONST(0.008648097900101) },
+ { FRAC_CONST(0.044759218460849), FRAC_CONST(0.008941235714784) },
+ { FRAC_CONST(0.044699739959770), FRAC_CONST(0.009233990516688) },
+ { FRAC_CONST(0.044638346670603), FRAC_CONST(0.009526349765171) },
+ { FRAC_CONST(0.044575041223233), FRAC_CONST(0.009818300936537) },
+ { FRAC_CONST(0.044509826329454), FRAC_CONST(0.010109831524568) },
+ { FRAC_CONST(0.044442704782856), FRAC_CONST(0.010400929041064) },
+ { FRAC_CONST(0.044373679458701), FRAC_CONST(0.010691581016378) },
+ { FRAC_CONST(0.044302753313806), FRAC_CONST(0.010981774999945) },
+ { FRAC_CONST(0.044229929386409), FRAC_CONST(0.011271498560822) },
+ { FRAC_CONST(0.044155210796046), FRAC_CONST(0.011560739288214) },
+ { FRAC_CONST(0.044078600743413), FRAC_CONST(0.011849484792012) },
+ { FRAC_CONST(0.044000102510229), FRAC_CONST(0.012137722703321) },
+ { FRAC_CONST(0.043919719459097), FRAC_CONST(0.012425440674986) },
+ { FRAC_CONST(0.043837455033359), FRAC_CONST(0.012712626382127) },
+ { FRAC_CONST(0.043753312756950), FRAC_CONST(0.012999267522665) },
+ { FRAC_CONST(0.043667296234245), FRAC_CONST(0.013285351817848) },
+ { FRAC_CONST(0.043579409149906), FRAC_CONST(0.013570867012776) },
+ { FRAC_CONST(0.043489655268722), FRAC_CONST(0.013855800876928) },
+ { FRAC_CONST(0.043398038435451), FRAC_CONST(0.014140141204686) },
+ { FRAC_CONST(0.043304562574653), FRAC_CONST(0.014423875815857) },
+ { FRAC_CONST(0.043209231690524), FRAC_CONST(0.014706992556195) },
+ { FRAC_CONST(0.043112049866720), FRAC_CONST(0.014989479297920) },
+ { FRAC_CONST(0.043013021266188), FRAC_CONST(0.015271323940241) },
+ { FRAC_CONST(0.042912150130984), FRAC_CONST(0.015552514409871) },
+ { FRAC_CONST(0.042809440782090), FRAC_CONST(0.015833038661547) },
+ { FRAC_CONST(0.042704897619235), FRAC_CONST(0.016112884678543) },
+ { FRAC_CONST(0.042598525120698), FRAC_CONST(0.016392040473187) },
+ { FRAC_CONST(0.042490327843124), FRAC_CONST(0.016670494087374) },
+ { FRAC_CONST(0.042380310421324), FRAC_CONST(0.016948233593079) },
+ { FRAC_CONST(0.042268477568078), FRAC_CONST(0.017225247092864) },
+ { FRAC_CONST(0.042154834073934), FRAC_CONST(0.017501522720393) },
+ { FRAC_CONST(0.042039384807000), FRAC_CONST(0.017777048640940) },
+ { FRAC_CONST(0.041922134712739), FRAC_CONST(0.018051813051888) },
+ { FRAC_CONST(0.041803088813754), FRAC_CONST(0.018325804183247) },
+ { FRAC_CONST(0.041682252209576), FRAC_CONST(0.018599010298148) },
+ { FRAC_CONST(0.041559630076443), FRAC_CONST(0.018871419693350) },
+ { FRAC_CONST(0.041435227667079), FRAC_CONST(0.019143020699741) },
+ { FRAC_CONST(0.041309050310468), FRAC_CONST(0.019413801682838) },
+ { FRAC_CONST(0.041181103411629), FRAC_CONST(0.019683751043285) },
+ { FRAC_CONST(0.041051392451382), FRAC_CONST(0.019952857217350) },
+ { FRAC_CONST(0.040919922986111), FRAC_CONST(0.020221108677421) },
+ { FRAC_CONST(0.040786700647532), FRAC_CONST(0.020488493932496) },
+ { FRAC_CONST(0.040651731142446), FRAC_CONST(0.020755001528683) },
+ { FRAC_CONST(0.040515020252497), FRAC_CONST(0.021020620049682) },
+ { FRAC_CONST(0.040376573833925), FRAC_CONST(0.021285338117280) },
+ { FRAC_CONST(0.040236397817314), FRAC_CONST(0.021549144391836) },
+ { FRAC_CONST(0.040094498207337), FRAC_CONST(0.021812027572768) },
+ { FRAC_CONST(0.039950881082502), FRAC_CONST(0.022073976399034) },
+ { FRAC_CONST(0.039805552594888), FRAC_CONST(0.022334979649620) },
+ { FRAC_CONST(0.039658518969884), FRAC_CONST(0.022595026144014) },
+ { FRAC_CONST(0.039509786505922), FRAC_CONST(0.022854104742690) },
+ { FRAC_CONST(0.039359361574204), FRAC_CONST(0.023112204347583) },
+ { FRAC_CONST(0.039207250618434), FRAC_CONST(0.023369313902565) },
+ { FRAC_CONST(0.039053460154540), FRAC_CONST(0.023625422393919) },
+ { FRAC_CONST(0.038897996770393), FRAC_CONST(0.023880518850809) },
+ { FRAC_CONST(0.038740867125527), FRAC_CONST(0.024134592345752) },
+ { FRAC_CONST(0.038582077950852), FRAC_CONST(0.024387631995085) },
+ { FRAC_CONST(0.038421636048370), FRAC_CONST(0.024639626959432) },
+ { FRAC_CONST(0.038259548290876), FRAC_CONST(0.024890566444167) },
+ { FRAC_CONST(0.038095821621671), FRAC_CONST(0.025140439699877) },
+ { FRAC_CONST(0.037930463054261), FRAC_CONST(0.025389236022825) },
+ { FRAC_CONST(0.037763479672055), FRAC_CONST(0.025636944755403) },
+ { FRAC_CONST(0.037594878628068), FRAC_CONST(0.025883555286595) },
+ { FRAC_CONST(0.037424667144605), FRAC_CONST(0.026129057052425) },
+ { FRAC_CONST(0.037252852512960), FRAC_CONST(0.026373439536415) },
+ { FRAC_CONST(0.037079442093102), FRAC_CONST(0.026616692270033) },
+ { FRAC_CONST(0.036904443313354), FRAC_CONST(0.026858804833142) },
+ { FRAC_CONST(0.036727863670081), FRAC_CONST(0.027099766854444) },
+ { FRAC_CONST(0.036549710727369), FRAC_CONST(0.027339568011930) },
+ { FRAC_CONST(0.036369992116697), FRAC_CONST(0.027578198033315) },
+ { FRAC_CONST(0.036188715536611), FRAC_CONST(0.027815646696484) },
+ { FRAC_CONST(0.036005888752396), FRAC_CONST(0.028051903829926) },
+ { FRAC_CONST(0.035821519595745), FRAC_CONST(0.028286959313171) },
+ { FRAC_CONST(0.035635615964417), FRAC_CONST(0.028520803077226) },
+ { FRAC_CONST(0.035448185821906), FRAC_CONST(0.028753425105002) },
+ { FRAC_CONST(0.035259237197095), FRAC_CONST(0.028984815431745) },
+ { FRAC_CONST(0.035068778183914), FRAC_CONST(0.029214964145465) },
+ { FRAC_CONST(0.034876816940994), FRAC_CONST(0.029443861387355) },
+ { FRAC_CONST(0.034683361691315), FRAC_CONST(0.029671497352220) },
+ { FRAC_CONST(0.034488420721856), FRAC_CONST(0.029897862288892) },
+ { FRAC_CONST(0.034292002383240), FRAC_CONST(0.030122946500652) },
+ { FRAC_CONST(0.034094115089375), FRAC_CONST(0.030346740345641) },
+ { FRAC_CONST(0.033894767317093), FRAC_CONST(0.030569234237276) },
+ { FRAC_CONST(0.033693967605790), FRAC_CONST(0.030790418644658) },
+ { FRAC_CONST(0.033491724557057), FRAC_CONST(0.031010284092984) },
+ { FRAC_CONST(0.033288046834313), FRAC_CONST(0.031228821163949) },
+ { FRAC_CONST(0.033082943162434), FRAC_CONST(0.031446020496153) },
+ { FRAC_CONST(0.032876422327378), FRAC_CONST(0.031661872785500) },
+ { FRAC_CONST(0.032668493175811), FRAC_CONST(0.031876368785596) },
+ { FRAC_CONST(0.032459164614726), FRAC_CONST(0.032089499308145) },
+ { FRAC_CONST(0.032248445611061), FRAC_CONST(0.032301255223347) },
+ { FRAC_CONST(0.032036345191317), FRAC_CONST(0.032511627460281) },
+ { FRAC_CONST(0.031822872441171), FRAC_CONST(0.032720607007302) },
+ { FRAC_CONST(0.031608036505083), FRAC_CONST(0.032928184912422) },
+ { FRAC_CONST(0.031391846585912), FRAC_CONST(0.033134352283693) },
+ { FRAC_CONST(0.031174311944513), FRAC_CONST(0.033339100289593) },
+ { FRAC_CONST(0.030955441899347), FRAC_CONST(0.033542420159397) },
+ { FRAC_CONST(0.030735245826077), FRAC_CONST(0.033744303183559) },
+ { FRAC_CONST(0.030513733157171), FRAC_CONST(0.033944740714083) },
+ { FRAC_CONST(0.030290913381494), FRAC_CONST(0.034143724164891) },
+ { FRAC_CONST(0.030066796043904), FRAC_CONST(0.034341245012195) },
+ { FRAC_CONST(0.029841390744841), FRAC_CONST(0.034537294794860) },
+ { FRAC_CONST(0.029614707139919), FRAC_CONST(0.034731865114764) },
+ { FRAC_CONST(0.029386754939508), FRAC_CONST(0.034924947637164) },
+ { FRAC_CONST(0.029157543908322), FRAC_CONST(0.035116534091046) },
+ { FRAC_CONST(0.028927083864999), FRAC_CONST(0.035306616269485) },
+ { FRAC_CONST(0.028695384681680), FRAC_CONST(0.035495186029992) },
+ { FRAC_CONST(0.028462456283587), FRAC_CONST(0.035682235294866) },
+ { FRAC_CONST(0.028228308648598), FRAC_CONST(0.035867756051541) },
+ { FRAC_CONST(0.027992951806817), FRAC_CONST(0.036051740352923) },
+ { FRAC_CONST(0.027756395840148), FRAC_CONST(0.036234180317738) },
+ { FRAC_CONST(0.027518650881862), FRAC_CONST(0.036415068130865) },
+ { FRAC_CONST(0.027279727116161), FRAC_CONST(0.036594396043672) },
+ { FRAC_CONST(0.027039634777745), FRAC_CONST(0.036772156374348) },
+ { FRAC_CONST(0.026798384151369), FRAC_CONST(0.036948341508233) },
+ { FRAC_CONST(0.026555985571409), FRAC_CONST(0.037122943898140) },
+ { FRAC_CONST(0.026312449421412), FRAC_CONST(0.037295956064686) },
+ { FRAC_CONST(0.026067786133656), FRAC_CONST(0.037467370596605) },
+ { FRAC_CONST(0.025822006188702), FRAC_CONST(0.037637180151068) },
+ { FRAC_CONST(0.025575120114946), FRAC_CONST(0.037805377454000) },
+ { FRAC_CONST(0.025327138488165), FRAC_CONST(0.037971955300388) },
+ { FRAC_CONST(0.025078071931066), FRAC_CONST(0.038136906554591) },
+ { FRAC_CONST(0.024827931112832), FRAC_CONST(0.038300224150647) },
+ { FRAC_CONST(0.024576726748663), FRAC_CONST(0.038461901092573) },
+ { FRAC_CONST(0.024324469599317), FRAC_CONST(0.038621930454668) },
+ { FRAC_CONST(0.024071170470652), FRAC_CONST(0.038780305381806) },
+ { FRAC_CONST(0.023816840213160), FRAC_CONST(0.038937019089732) },
+ { FRAC_CONST(0.023561489721501), FRAC_CONST(0.039092064865353) },
+ { FRAC_CONST(0.023305129934041), FRAC_CONST(0.039245436067023) },
+ { FRAC_CONST(0.023047771832380), FRAC_CONST(0.039397126124832) },
+ { FRAC_CONST(0.022789426440883), FRAC_CONST(0.039547128540881) },
+ { FRAC_CONST(0.022530104826206), FRAC_CONST(0.039695436889566) },
+ { FRAC_CONST(0.022269818096825), FRAC_CONST(0.039842044817851) },
+ { FRAC_CONST(0.022008577402555), FRAC_CONST(0.039986946045542) },
+ { FRAC_CONST(0.021746393934081), FRAC_CONST(0.040130134365550) },
+ { FRAC_CONST(0.021483278922467), FRAC_CONST(0.040271603644166) },
+ { FRAC_CONST(0.021219243638687), FRAC_CONST(0.040411347821316) },
+ { FRAC_CONST(0.020954299393132), FRAC_CONST(0.040549360910825) },
+ { FRAC_CONST(0.020688457535133), FRAC_CONST(0.040685637000671) },
+ { FRAC_CONST(0.020421729452469), FRAC_CONST(0.040820170253240) },
+ { FRAC_CONST(0.020154126570884), FRAC_CONST(0.040952954905576) },
+ { FRAC_CONST(0.019885660353596), FRAC_CONST(0.041083985269625) },
+ { FRAC_CONST(0.019616342300802), FRAC_CONST(0.041213255732484) },
+ { FRAC_CONST(0.019346183949192), FRAC_CONST(0.041340760756635) },
+ { FRAC_CONST(0.019075196871451), FRAC_CONST(0.041466494880189) },
+ { FRAC_CONST(0.018803392675763), FRAC_CONST(0.041590452717113) },
+ { FRAC_CONST(0.018530783005316), FRAC_CONST(0.041712628957466) },
+ { FRAC_CONST(0.018257379537800), FRAC_CONST(0.041833018367625) },
+ { FRAC_CONST(0.017983193984910), FRAC_CONST(0.041951615790509) },
+ { FRAC_CONST(0.017708238091842), FRAC_CONST(0.042068416145797) },
+ { FRAC_CONST(0.017432523636792), FRAC_CONST(0.042183414430153) },
+ { FRAC_CONST(0.017156062430449), FRAC_CONST(0.042296605717432) },
+ { FRAC_CONST(0.016878866315491), FRAC_CONST(0.042407985158896) },
+ { FRAC_CONST(0.016600947166078), FRAC_CONST(0.042517547983420) },
+ { FRAC_CONST(0.016322316887341), FRAC_CONST(0.042625289497698) },
+ { FRAC_CONST(0.016042987414872), FRAC_CONST(0.042731205086442) },
+ { FRAC_CONST(0.015762970714219), FRAC_CONST(0.042835290212581) },
+ { FRAC_CONST(0.015482278780363), FRAC_CONST(0.042937540417454) },
+ { FRAC_CONST(0.015200923637213), FRAC_CONST(0.043037951321002) },
+ { FRAC_CONST(0.014918917337087), FRAC_CONST(0.043136518621958) },
+ { FRAC_CONST(0.014636271960196), FRAC_CONST(0.043233238098025) },
+ { FRAC_CONST(0.014352999614128), FRAC_CONST(0.043328105606063) },
+ { FRAC_CONST(0.014069112433327), FRAC_CONST(0.043421117082265) },
+ { FRAC_CONST(0.013784622578575), FRAC_CONST(0.043512268542327) },
+ { FRAC_CONST(0.013499542236471), FRAC_CONST(0.043601556081625) },
+ { FRAC_CONST(0.013213883618907), FRAC_CONST(0.043688975875378) },
+ { FRAC_CONST(0.012927658962548), FRAC_CONST(0.043774524178812) },
+ { FRAC_CONST(0.012640880528305), FRAC_CONST(0.043858197327323) },
+ { FRAC_CONST(0.012353560600813), FRAC_CONST(0.043939991736633) },
+ { FRAC_CONST(0.012065711487901), FRAC_CONST(0.044019903902940) },
+ { FRAC_CONST(0.011777345520066), FRAC_CONST(0.044097930403073) },
+ { FRAC_CONST(0.011488475049948), FRAC_CONST(0.044174067894638) },
+ { FRAC_CONST(0.011199112451794), FRAC_CONST(0.044248313116156) },
+ { FRAC_CONST(0.010909270120937), FRAC_CONST(0.044320662887211) },
+ { FRAC_CONST(0.010618960473257), FRAC_CONST(0.044391114108577) },
+ { FRAC_CONST(0.010328195944653), FRAC_CONST(0.044459663762361) },
+ { FRAC_CONST(0.010036988990509), FRAC_CONST(0.044526308912122) },
+ { FRAC_CONST(0.009745352085163), FRAC_CONST(0.044591046703005) },
+ { FRAC_CONST(0.009453297721368), FRAC_CONST(0.044653874361857) },
+ { FRAC_CONST(0.009160838409762), FRAC_CONST(0.044714789197351) },
+ { FRAC_CONST(0.008867986678328), FRAC_CONST(0.044773788600099) },
+ { FRAC_CONST(0.008574755071860), FRAC_CONST(0.044830870042761) },
+ { FRAC_CONST(0.008281156151424), FRAC_CONST(0.044886031080160) },
+ { FRAC_CONST(0.007987202493820), FRAC_CONST(0.044939269349379) },
+ { FRAC_CONST(0.007692906691044), FRAC_CONST(0.044990582569869) },
+ { FRAC_CONST(0.007398281349750), FRAC_CONST(0.045039968543542) },
+ { FRAC_CONST(0.007103339090706), FRAC_CONST(0.045087425154868) },
+ { FRAC_CONST(0.006808092548258), FRAC_CONST(0.045132950370962) },
+ { FRAC_CONST(0.006512554369783), FRAC_CONST(0.045176542241676) },
+ { FRAC_CONST(0.006216737215155), FRAC_CONST(0.045218198899680) },
+ { FRAC_CONST(0.005920653756196), FRAC_CONST(0.045257918560541) },
+ { FRAC_CONST(0.005624316676135), FRAC_CONST(0.045295699522801) },
+ { FRAC_CONST(0.005327738669067), FRAC_CONST(0.045331540168049) },
+ { FRAC_CONST(0.005030932439406), FRAC_CONST(0.045365438960992) },
+ { FRAC_CONST(0.004733910701344), FRAC_CONST(0.045397394449517) },
+ { FRAC_CONST(0.004436686178303), FRAC_CONST(0.045427405264758) },
+ { FRAC_CONST(0.004139271602393), FRAC_CONST(0.045455470121152) },
+ { FRAC_CONST(0.003841679713863), FRAC_CONST(0.045481587816494) },
+ { FRAC_CONST(0.003543923260561), FRAC_CONST(0.045505757231988) },
+ { FRAC_CONST(0.003246014997382), FRAC_CONST(0.045527977332297) },
+ { FRAC_CONST(0.002947967685724), FRAC_CONST(0.045548247165585) },
+ { FRAC_CONST(0.002649794092941), FRAC_CONST(0.045566565863562) },
+ { FRAC_CONST(0.002351506991799), FRAC_CONST(0.045582932641515) },
+ { FRAC_CONST(0.002053119159924), FRAC_CONST(0.045597346798344) },
+ { FRAC_CONST(0.001754643379257), FRAC_CONST(0.045609807716597) },
+ { FRAC_CONST(0.001456092435508), FRAC_CONST(0.045620314862489) },
+ { FRAC_CONST(0.001157479117605), FRAC_CONST(0.045628867785927) },
+ { FRAC_CONST(0.000858816217149), FRAC_CONST(0.045635466120535) },
+ { FRAC_CONST(0.000560116527865), FRAC_CONST(0.045640109583661) },
+ { FRAC_CONST(0.000261392845053), FRAC_CONST(0.045642797976394) }
+};
+#endif // LD_DEC
+
+/* 60 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_240[] =
+{
+ { FRAC_CONST(0.091286604111815), FRAC_CONST(0.000298735779793) },
+ { FRAC_CONST(0.091247502481454), FRAC_CONST(0.002688238127538) },
+ { FRAC_CONST(0.091145864370807), FRAC_CONST(0.005075898091152) },
+ { FRAC_CONST(0.090981759437558), FRAC_CONST(0.007460079287760) },
+ { FRAC_CONST(0.090755300151030), FRAC_CONST(0.009839147718664) },
+ { FRAC_CONST(0.090466641715108), FRAC_CONST(0.012211472889198) },
+ { FRAC_CONST(0.090115981961863), FRAC_CONST(0.014575428926191) },
+ { FRAC_CONST(0.089703561215976), FRAC_CONST(0.016929395692256) },
+ { FRAC_CONST(0.089229662130024), FRAC_CONST(0.019271759896156) },
+ { FRAC_CONST(0.088694609490769), FRAC_CONST(0.021600916198470) },
+ { FRAC_CONST(0.088098769996564), FRAC_CONST(0.023915268311810) },
+ { FRAC_CONST(0.087442552006035), FRAC_CONST(0.026213230094844) },
+ { FRAC_CONST(0.086726405258214), FRAC_CONST(0.028493226639351) },
+ { FRAC_CONST(0.085950820564309), FRAC_CONST(0.030753695349588) },
+ { FRAC_CONST(0.085116329471329), FRAC_CONST(0.032993087013213) },
+ { FRAC_CONST(0.084223503897785), FRAC_CONST(0.035209866863042) },
+ { FRAC_CONST(0.083272955741727), FRAC_CONST(0.037402515628894) },
+ { FRAC_CONST(0.082265336461381), FRAC_CONST(0.039569530578832) },
+ { FRAC_CONST(0.081201336628670), FRAC_CONST(0.041709426549053) },
+ { FRAC_CONST(0.080081685455930), FRAC_CONST(0.043820736961749) },
+ { FRAC_CONST(0.078907150296148), FRAC_CONST(0.045902014830227) },
+ { FRAC_CONST(0.077678536117054), FRAC_CONST(0.047951833750597) },
+ { FRAC_CONST(0.076396684949434), FRAC_CONST(0.049968788879362) },
+ { FRAC_CONST(0.075062475310050), FRAC_CONST(0.051951497896226) },
+ { FRAC_CONST(0.073676821599542), FRAC_CONST(0.053898601951466) },
+ { FRAC_CONST(0.072240673475749), FRAC_CONST(0.055808766597225) },
+ { FRAC_CONST(0.070755015202858), FRAC_CONST(0.057680682702068) },
+ { FRAC_CONST(0.069220864976840), FRAC_CONST(0.059513067348201) },
+ { FRAC_CONST(0.067639274227625), FRAC_CONST(0.061304664710718) },
+ { FRAC_CONST(0.066011326898512), FRAC_CONST(0.063054246918278) },
+ { FRAC_CONST(0.064338138703282), FRAC_CONST(0.064760614894630) },
+ { FRAC_CONST(0.062620856361546), FRAC_CONST(0.066422599180399) },
+ { FRAC_CONST(0.060860656812842), FRAC_CONST(0.068039060734572) },
+ { FRAC_CONST(0.059058746410016), FRAC_CONST(0.069608891715145) },
+ { FRAC_CONST(0.057216360092450), FRAC_CONST(0.071131016238378) },
+ { FRAC_CONST(0.055334760539699), FRAC_CONST(0.072604391116154) },
+ { FRAC_CONST(0.053415237306106), FRAC_CONST(0.074028006570930) },
+ { FRAC_CONST(0.051459105937014), FRAC_CONST(0.075400886927784) },
+ { FRAC_CONST(0.049467707067153), FRAC_CONST(0.076722091283096) },
+ { FRAC_CONST(0.047442405501835), FRAC_CONST(0.077990714149396) },
+ { FRAC_CONST(0.045384589281588), FRAC_CONST(0.079205886075941) },
+ { FRAC_CONST(0.043295668730857), FRAC_CONST(0.080366774244592) },
+ { FRAC_CONST(0.041177075491445), FRAC_CONST(0.081472583040586) },
+ { FRAC_CONST(0.039030261541332), FRAC_CONST(0.082522554597810) },
+ { FRAC_CONST(0.036856698199564), FRAC_CONST(0.083515969318206) },
+ { FRAC_CONST(0.034657875117883), FRAC_CONST(0.084452146364948) },
+ { FRAC_CONST(0.032435299259796), FRAC_CONST(0.085330444129049) },
+ { FRAC_CONST(0.030190493867775), FRAC_CONST(0.086150260669096) },
+ { FRAC_CONST(0.027924997419306), FRAC_CONST(0.086911034123781) },
+ { FRAC_CONST(0.025640362572491), FRAC_CONST(0.087612243096981) },
+ { FRAC_CONST(0.023338155101933), FRAC_CONST(0.088253407015092) },
+ { FRAC_CONST(0.021019952825636), FRAC_CONST(0.088834086456390) },
+ { FRAC_CONST(0.018687344523641), FRAC_CONST(0.089353883452193) },
+ { FRAC_CONST(0.016341928849164), FRAC_CONST(0.089812441759604) },
+ { FRAC_CONST(0.013985313232951), FRAC_CONST(0.090209447105664) },
+ { FRAC_CONST(0.011619112781631), FRAC_CONST(0.090544627402740) },
+ { FRAC_CONST(0.009244949170797), FRAC_CONST(0.090817752935000) },
+ { FRAC_CONST(0.006864449533597), FRAC_CONST(0.091028636515846) },
+ { FRAC_CONST(0.004479245345574), FRAC_CONST(0.091177133616206) },
+ { FRAC_CONST(0.002090971306534), FRAC_CONST(0.091263142463585) }
+};
+#endif // ALLOW_SMALL_FRAMELENGTH
+
+#ifdef SSR_DEC
+/* 128 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_512[] =
+{
+ { FRAC_CONST(0.062499926465731), FRAC_CONST(0.000095873761643) },
+ { FRAC_CONST(0.062494043817678), FRAC_CONST(0.000862836783004) },
+ { FRAC_CONST(0.062478749796497), FRAC_CONST(0.001629669864319) },
+ { FRAC_CONST(0.062454046705412), FRAC_CONST(0.002396257523347) },
+ { FRAC_CONST(0.062419938264617), FRAC_CONST(0.003162484314806) },
+ { FRAC_CONST(0.062376429610718), FRAC_CONST(0.003928234847760) },
+ { FRAC_CONST(0.062323527295958), FRAC_CONST(0.004693393802995) },
+ { FRAC_CONST(0.062261239287231), FRAC_CONST(0.005457845950387) },
+ { FRAC_CONST(0.062189574964882), FRAC_CONST(0.006221476166254) },
+ { FRAC_CONST(0.062108545121295), FRAC_CONST(0.006984169450695) },
+ { FRAC_CONST(0.062018161959266), FRAC_CONST(0.007745810944907) },
+ { FRAC_CONST(0.061918439090167), FRAC_CONST(0.008506285948482) },
+ { FRAC_CONST(0.061809391531894), FRAC_CONST(0.009265479936681) },
+ { FRAC_CONST(0.061691035706609), FRAC_CONST(0.010023278577683) },
+ { FRAC_CONST(0.061563389438265), FRAC_CONST(0.010779567749800) },
+ { FRAC_CONST(0.061426471949919), FRAC_CONST(0.011534233558664) },
+ { FRAC_CONST(0.061280303860842), FRAC_CONST(0.012287162354380) },
+ { FRAC_CONST(0.061124907183410), FRAC_CONST(0.013038240748641) },
+ { FRAC_CONST(0.060960305319791), FRAC_CONST(0.013787355631805) },
+ { FRAC_CONST(0.060786523058421), FRAC_CONST(0.014534394189923) },
+ { FRAC_CONST(0.060603586570268), FRAC_CONST(0.015279243921739) },
+ { FRAC_CONST(0.060411523404896), FRAC_CONST(0.016021792655621) },
+ { FRAC_CONST(0.060210362486310), FRAC_CONST(0.016761928566463) },
+ { FRAC_CONST(0.060000134108604), FRAC_CONST(0.017499540192517) },
+ { FRAC_CONST(0.059780869931400), FRAC_CONST(0.018234516452187) },
+ { FRAC_CONST(0.059552602975075), FRAC_CONST(0.018966746660751) },
+ { FRAC_CONST(0.059315367615794), FRAC_CONST(0.019696120547033) },
+ { FRAC_CONST(0.059069199580329), FRAC_CONST(0.020422528270008) },
+ { FRAC_CONST(0.058814135940681), FRAC_CONST(0.021145860435346) },
+ { FRAC_CONST(0.058550215108495), FRAC_CONST(0.021866008111883) },
+ { FRAC_CONST(0.058277476829279), FRAC_CONST(0.022582862848028) },
+ { FRAC_CONST(0.057995962176414), FRAC_CONST(0.023296316688095) },
+ { FRAC_CONST(0.057705713544970), FRAC_CONST(0.024006262188558) },
+ { FRAC_CONST(0.057406774645326), FRAC_CONST(0.024712592434239) },
+ { FRAC_CONST(0.057099190496578), FRAC_CONST(0.025415201054398) },
+ { FRAC_CONST(0.056783007419769), FRAC_CONST(0.026113982238763) },
+ { FRAC_CONST(0.056458273030907), FRAC_CONST(0.026808830753458) },
+ { FRAC_CONST(0.056125036233796), FRAC_CONST(0.027499641956852) },
+ { FRAC_CONST(0.055783347212673), FRAC_CONST(0.028186311815319) },
+ { FRAC_CONST(0.055433257424646), FRAC_CONST(0.028868736918904) },
+ { FRAC_CONST(0.055074819591951), FRAC_CONST(0.029546814496896) },
+ { FRAC_CONST(0.054708087694007), FRAC_CONST(0.030220442433307) },
+ { FRAC_CONST(0.054333116959288), FRAC_CONST(0.030889519282247) },
+ { FRAC_CONST(0.053949963857008), FRAC_CONST(0.031553944283204) },
+ { FRAC_CONST(0.053558686088614), FRAC_CONST(0.032213617376216) },
+ { FRAC_CONST(0.053159342579100), FRAC_CONST(0.032868439216943) },
+ { FRAC_CONST(0.052751993468129), FRAC_CONST(0.033518311191623) },
+ { FRAC_CONST(0.052336700100979), FRAC_CONST(0.034163135431927) },
+ { FRAC_CONST(0.051913525019303), FRAC_CONST(0.034802814829698) },
+ { FRAC_CONST(0.051482531951712), FRAC_CONST(0.035437253051569) },
+ { FRAC_CONST(0.051043785804177), FRAC_CONST(0.036066354553480) },
+ { FRAC_CONST(0.050597352650253), FRAC_CONST(0.036690024595057) },
+ { FRAC_CONST(0.050143299721132), FRAC_CONST(0.037308169253887) },
+ { FRAC_CONST(0.049681695395515), FRAC_CONST(0.037920695439658) },
+ { FRAC_CONST(0.049212609189314), FRAC_CONST(0.038527510908178) },
+ { FRAC_CONST(0.048736111745188), FRAC_CONST(0.039128524275271) },
+ { FRAC_CONST(0.048252274821899), FRAC_CONST(0.039723645030535) },
+ { FRAC_CONST(0.047761171283507), FRAC_CONST(0.040312783550971) },
+ { FRAC_CONST(0.047262875088400), FRAC_CONST(0.040895851114488) },
+ { FRAC_CONST(0.046757461278150), FRAC_CONST(0.041472759913252) },
+ { FRAC_CONST(0.046245005966220), FRAC_CONST(0.042043423066923) },
+ { FRAC_CONST(0.045725586326493), FRAC_CONST(0.042607754635728) },
+ { FRAC_CONST(0.045199280581658), FRAC_CONST(0.043165669633408) },
+ { FRAC_CONST(0.044666167991423), FRAC_CONST(0.043717084040018) },
+ { FRAC_CONST(0.044126328840584), FRAC_CONST(0.044261914814575) },
+ { FRAC_CONST(0.043579844426930), FRAC_CONST(0.044800079907569) },
+ { FRAC_CONST(0.043026797049006), FRAC_CONST(0.045331498273316) },
+ { FRAC_CONST(0.042467269993710), FRAC_CONST(0.045856089882166) },
+ { FRAC_CONST(0.041901347523761), FRAC_CONST(0.046373775732552) },
+ { FRAC_CONST(0.041329114865000), FRAC_CONST(0.046884477862888) },
+ { FRAC_CONST(0.040750658193560), FRAC_CONST(0.047388119363313) },
+ { FRAC_CONST(0.040166064622889), FRAC_CONST(0.047884624387270) },
+ { FRAC_CONST(0.039575422190629), FRAC_CONST(0.048373918162926) },
+ { FRAC_CONST(0.038978819845356), FRAC_CONST(0.048855927004441) },
+ { FRAC_CONST(0.038376347433190), FRAC_CONST(0.049330578323055) },
+ { FRAC_CONST(0.037768095684260), FRAC_CONST(0.049797800638026) },
+ { FRAC_CONST(0.037154156199042), FRAC_CONST(0.050257523587392) },
+ { FRAC_CONST(0.036534621434563), FRAC_CONST(0.050709677938566) },
+ { FRAC_CONST(0.035909584690482), FRAC_CONST(0.051154195598769) },
+ { FRAC_CONST(0.035279140095032), FRAC_CONST(0.051591009625274) },
+ { FRAC_CONST(0.034643382590851), FRAC_CONST(0.052020054235496) },
+ { FRAC_CONST(0.034002407920680), FRAC_CONST(0.052441264816895) },
+ { FRAC_CONST(0.033356312612947), FRAC_CONST(0.052854577936706) },
+ { FRAC_CONST(0.032705193967229), FRAC_CONST(0.053259931351495) },
+ { FRAC_CONST(0.032049150039598), FRAC_CONST(0.053657264016528) },
+ { FRAC_CONST(0.031388279627857), FRAC_CONST(0.054046516094966) },
+ { FRAC_CONST(0.030722682256659), FRAC_CONST(0.054427628966880) },
+ { FRAC_CONST(0.030052458162521), FRAC_CONST(0.054800545238072) },
+ { FRAC_CONST(0.029377708278725), FRAC_CONST(0.055165208748723) },
+ { FRAC_CONST(0.028698534220122), FRAC_CONST(0.055521564581850) },
+ { FRAC_CONST(0.028015038267826), FRAC_CONST(0.055869559071575) },
+ { FRAC_CONST(0.027327323353815), FRAC_CONST(0.056209139811209) },
+ { FRAC_CONST(0.026635493045425), FRAC_CONST(0.056540255661140) },
+ { FRAC_CONST(0.025939651529755), FRAC_CONST(0.056862856756541) },
+ { FRAC_CONST(0.025239903597978), FRAC_CONST(0.057176894514872) },
+ { FRAC_CONST(0.024536354629559), FRAC_CONST(0.057482321643202) },
+ { FRAC_CONST(0.023829110576385), FRAC_CONST(0.057779092145329) },
+ { FRAC_CONST(0.023118277946808), FRAC_CONST(0.058067161328707) },
+ { FRAC_CONST(0.022403963789609), FRAC_CONST(0.058346485811177) },
+ { FRAC_CONST(0.021686275677870), FRAC_CONST(0.058617023527499) },
+ { FRAC_CONST(0.020965321692783), FRAC_CONST(0.058878733735689) },
+ { FRAC_CONST(0.020241210407366), FRAC_CONST(0.059131577023150) },
+ { FRAC_CONST(0.019514050870114), FRAC_CONST(0.059375515312615) },
+ { FRAC_CONST(0.018783952588580), FRAC_CONST(0.059610511867874) },
+ { FRAC_CONST(0.018051025512878), FRAC_CONST(0.059836531299311) },
+ { FRAC_CONST(0.017315380019131), FRAC_CONST(0.060053539569230) },
+ { FRAC_CONST(0.016577126892844), FRAC_CONST(0.060261503996984) },
+ { FRAC_CONST(0.015836377312223), FRAC_CONST(0.060460393263896) },
+ { FRAC_CONST(0.015093242831429), FRAC_CONST(0.060650177417972) },
+ { FRAC_CONST(0.014347835363782), FRAC_CONST(0.060830827878419) },
+ { FRAC_CONST(0.013600267164905), FRAC_CONST(0.061002317439940) },
+ { FRAC_CONST(0.012850650815819), FRAC_CONST(0.061164620276839) },
+ { FRAC_CONST(0.012099099205988), FRAC_CONST(0.061317711946905) },
+ { FRAC_CONST(0.011345725516320), FRAC_CONST(0.061461569395097) },
+ { FRAC_CONST(0.010590643202123), FRAC_CONST(0.061596170957011) },
+ { FRAC_CONST(0.009833965976015), FRAC_CONST(0.061721496362147) },
+ { FRAC_CONST(0.009075807790803), FRAC_CONST(0.061837526736961) },
+ { FRAC_CONST(0.008316282822321), FRAC_CONST(0.061944244607705) },
+ { FRAC_CONST(0.007555505452236), FRAC_CONST(0.062041633903059) },
+ { FRAC_CONST(0.006793590250821), FRAC_CONST(0.062129679956555) },
+ { FRAC_CONST(0.006030651959703), FRAC_CONST(0.062208369508780) },
+ { FRAC_CONST(0.005266805474583), FRAC_CONST(0.062277690709378) },
+ { FRAC_CONST(0.004502165827931), FRAC_CONST(0.062337633118830) },
+ { FRAC_CONST(0.003736848171665), FRAC_CONST(0.062388187710030) },
+ { FRAC_CONST(0.002970967759810), FRAC_CONST(0.062429346869643) },
+ { FRAC_CONST(0.002204639931138), FRAC_CONST(0.062461104399250) },
+ { FRAC_CONST(0.001437980091802), FRAC_CONST(0.062483455516285) },
+ { FRAC_CONST(0.000671103697954), FRAC_CONST(0.062496396854751) }
+};
+
+/* 16 (N/4) complex twiddle factors */
+ALIGN static const complex_t mdct_tab_64[] =
+{
+ { FRAC_CONST(0.176763384336599), FRAC_CONST(0.002169321984356) },
+ { FRAC_CONST(0.175699589589310), FRAC_CONST(0.019484717553714) },
+ { FRAC_CONST(0.172943711747111), FRAC_CONST(0.036612464641599) },
+ { FRAC_CONST(0.168522291420137), FRAC_CONST(0.053387613680577) },
+ { FRAC_CONST(0.162477909303132), FRAC_CONST(0.069648610815172) },
+ { FRAC_CONST(0.154868776100077), FRAC_CONST(0.085238853753814) },
+ { FRAC_CONST(0.145768171923295), FRAC_CONST(0.100008199934509) },
+ { FRAC_CONST(0.135263740565902), FRAC_CONST(0.113814412479792) },
+ { FRAC_CONST(0.123456645444178), FRAC_CONST(0.126524530015608) },
+ { FRAC_CONST(0.110460595338559), FRAC_CONST(0.138016147162030) },
+ { FRAC_CONST(0.096400749315926), FRAC_CONST(0.148178593363981) },
+ { FRAC_CONST(0.081412511379371), FRAC_CONST(0.156913998709178) },
+ { FRAC_CONST(0.065640226453626), FRAC_CONST(0.164138236468888) },
+ { FRAC_CONST(0.049235790264535), FRAC_CONST(0.169781733284316) },
+ { FRAC_CONST(0.032357186500177), FRAC_CONST(0.173790139196080) },
+ { FRAC_CONST(0.015166965341583), FRAC_CONST(0.176124851064031) }
+};
+#endif // SSR_DEC
+
+#endif // FIXED_POINT
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.c b/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.c
new file mode 100644
index 000000000..59e5fdf32
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.c
@@ -0,0 +1,296 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: mp4.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+
+#include "bits.h"
+#include "mp4.h"
+#include "syntax.h"
+
+/* defines if an object type can be decoded by this library or not */
+static uint8_t ObjectTypesTable[32] = {
+ 0, /* 0 NULL */
+#ifdef MAIN_DEC
+ 1, /* 1 AAC Main */
+#else
+ 0, /* 1 AAC Main */
+#endif
+ 1, /* 2 AAC LC */
+#ifdef SSR_DEC
+ 1, /* 3 AAC SSR */
+#else
+ 0, /* 3 AAC SSR */
+#endif
+#ifdef LTP_DEC
+ 1, /* 4 AAC LTP */
+#else
+ 0, /* 4 AAC LTP */
+#endif
+#ifdef SBR_DEC
+ 1, /* 5 SBR */
+#else
+ 0, /* 5 SBR */
+#endif
+ 0, /* 6 AAC Scalable */
+ 0, /* 7 TwinVQ */
+ 0, /* 8 CELP */
+ 0, /* 9 HVXC */
+ 0, /* 10 Reserved */
+ 0, /* 11 Reserved */
+ 0, /* 12 TTSI */
+ 0, /* 13 Main synthetic */
+ 0, /* 14 Wavetable synthesis */
+ 0, /* 15 General MIDI */
+ 0, /* 16 Algorithmic Synthesis and Audio FX */
+
+ /* MPEG-4 Version 2 */
+#ifdef ERROR_RESILIENCE
+ 1, /* 17 ER AAC LC */
+ 0, /* 18 (Reserved) */
+#ifdef LTP_DEC
+ 1, /* 19 ER AAC LTP */
+#else
+ 0, /* 19 ER AAC LTP */
+#endif
+ 0, /* 20 ER AAC scalable */
+ 0, /* 21 ER TwinVQ */
+ 0, /* 22 ER BSAC */
+#ifdef LD_DEC
+ 1, /* 23 ER AAC LD */
+#else
+ 0, /* 23 ER AAC LD */
+#endif
+ 0, /* 24 ER CELP */
+ 0, /* 25 ER HVXC */
+ 0, /* 26 ER HILN */
+ 0, /* 27 ER Parametric */
+#else /* No ER defined */
+ 0, /* 17 ER AAC LC */
+ 0, /* 18 (Reserved) */
+ 0, /* 19 ER AAC LTP */
+ 0, /* 20 ER AAC scalable */
+ 0, /* 21 ER TwinVQ */
+ 0, /* 22 ER BSAC */
+ 0, /* 23 ER AAC LD */
+ 0, /* 24 ER CELP */
+ 0, /* 25 ER HVXC */
+ 0, /* 26 ER HILN */
+ 0, /* 27 ER Parametric */
+#endif
+ 0, /* 28 (Reserved) */
+ 0, /* 29 (Reserved) */
+ 0, /* 30 (Reserved) */
+ 0 /* 31 (Reserved) */
+};
+
+/* Table 1.6.1 */
+int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer,
+ uint32_t buffer_size,
+ mp4AudioSpecificConfig *mp4ASC)
+{
+ return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL);
+}
+
+int8_t AudioSpecificConfig2(uint8_t *pBuffer,
+ uint32_t buffer_size,
+ mp4AudioSpecificConfig *mp4ASC,
+ program_config *pce)
+{
+ bitfile ld;
+ int8_t result = 0;
+#ifdef SBR_DEC
+ int8_t bits_to_decode = 0;
+#endif
+
+ if (pBuffer == NULL)
+ return -7;
+ if (mp4ASC == NULL)
+ return -8;
+
+ memset(mp4ASC, 0, sizeof(mp4AudioSpecificConfig));
+
+ faad_initbits(&ld, pBuffer, buffer_size);
+ faad_byte_align(&ld);
+
+ mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
+ DEBUGVAR(1,1,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
+
+ mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
+ DEBUGVAR(1,2,"parse_audio_decoder_specific_info(): SamplingFrequencyIndex"));
+
+ mp4ASC->channelsConfiguration = (uint8_t)faad_getbits(&ld, 4
+ DEBUGVAR(1,3,"parse_audio_decoder_specific_info(): ChannelsConfiguration"));
+
+ mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
+
+ if (ObjectTypesTable[mp4ASC->objectTypeIndex] != 1)
+ {
+ faad_endbits(&ld);
+ return -1;
+ }
+
+ if (mp4ASC->samplingFrequency == 0)
+ {
+ faad_endbits(&ld);
+ return -2;
+ }
+
+ if (mp4ASC->channelsConfiguration > 7)
+ {
+ faad_endbits(&ld);
+ return -3;
+ }
+
+#if (defined(PS_DEC) || defined(DRM_PS))
+ /* check if we have a mono file */
+ if (mp4ASC->channelsConfiguration == 1)
+ {
+ /* upMatrix to 2 channels for implicit signalling of PS */
+ mp4ASC->channelsConfiguration = 2;
+ }
+#endif
+
+#ifdef SBR_DEC
+ mp4ASC->sbr_present_flag = -1;
+ if (mp4ASC->objectTypeIndex == 5)
+ {
+ uint8_t tmp;
+
+ mp4ASC->sbr_present_flag = 1;
+ tmp = (uint8_t)faad_getbits(&ld, 4
+ DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+ /* check for downsampled SBR */
+ if (tmp == mp4ASC->samplingFrequencyIndex)
+ mp4ASC->downSampledSBR = 1;
+ mp4ASC->samplingFrequencyIndex = tmp;
+ if (mp4ASC->samplingFrequencyIndex == 15)
+ {
+ mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
+ DEBUGVAR(1,6,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+ } else {
+ mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
+ }
+ mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
+ DEBUGVAR(1,7,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
+ }
+#endif
+
+ /* get GASpecificConfig */
+ if (mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 ||
+ mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 ||
+ mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7)
+ {
+ result = GASpecificConfig(&ld, mp4ASC, pce);
+
+#ifdef ERROR_RESILIENCE
+ } else if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { /* ER */
+ result = GASpecificConfig(&ld, mp4ASC, pce);
+ mp4ASC->epConfig = (uint8_t)faad_getbits(&ld, 2
+ DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig"));
+
+ if (mp4ASC->epConfig != 0)
+ result = -5;
+#endif
+
+ } else {
+ result = -4;
+ }
+
+#ifdef SSR_DEC
+ /* shorter frames not allowed for SSR */
+ if ((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag)
+ return -6;
+#endif
+
+
+#ifdef SBR_DEC
+ bits_to_decode = (int8_t)(buffer_size*8 - faad_get_processed_bits(&ld));
+
+ if ((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16))
+ {
+ int16_t syncExtensionType = (int16_t)faad_getbits(&ld, 11
+ DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType"));
+
+ if (syncExtensionType == 0x2b7)
+ {
+ mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
+ DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType"));
+
+ if (mp4ASC->objectTypeIndex == 5)
+ {
+ mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(&ld
+ DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag"));
+
+ if (mp4ASC->sbr_present_flag)
+ {
+ uint8_t tmp;
+ tmp = (uint8_t)faad_getbits(&ld, 4
+ DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+
+ /* check for downsampled SBR */
+ if (tmp == mp4ASC->samplingFrequencyIndex)
+ mp4ASC->downSampledSBR = 1;
+ mp4ASC->samplingFrequencyIndex = tmp;
+
+ if (mp4ASC->samplingFrequencyIndex == 15)
+ {
+ mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
+ DEBUGVAR(1,13,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
+ } else {
+ mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
+ }
+ }
+ }
+ }
+ }
+
+ /* no SBR signalled, this could mean either implicit signalling or no SBR in this file */
+ /* MPEG specification states: assume SBR on files with samplerate <= 24000 Hz */
+ if (mp4ASC->sbr_present_flag == -1)
+ {
+ if (mp4ASC->samplingFrequency <= 24000)
+ {
+ mp4ASC->samplingFrequency *= 2;
+ mp4ASC->forceUpSampling = 1;
+ } else /* > 24000*/ {
+ mp4ASC->downSampledSBR = 1;
+ }
+ }
+#endif
+
+ faad_endbits(&ld);
+
+ return result;
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.h b/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.h
new file mode 100644
index 000000000..bc28e4d3c
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/mp4.h
@@ -0,0 +1,54 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: mp4.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __MP4_H__
+#define __MP4_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "decoder.h"
+
+int8_t NEAACDECAPI NeAACDecAudioSpecificConfig(uint8_t *pBuffer,
+ uint32_t buffer_size,
+ mp4AudioSpecificConfig *mp4ASC);
+
+int8_t AudioSpecificConfig2(uint8_t *pBuffer,
+ uint32_t buffer_size,
+ mp4AudioSpecificConfig *mp4ASC,
+ program_config *pce);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ms.c b/src/filters/transform/mpadecfilter/faad2/libfaad/ms.c
new file mode 100644
index 000000000..796342fa6
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ms.c
@@ -0,0 +1,79 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ms.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+#include "ms.h"
+#include "is.h"
+#include "pns.h"
+
+void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+ uint16_t frame_len)
+{
+ uint8_t g, b, sfb;
+ uint8_t group = 0;
+ uint16_t nshort = frame_len/8;
+
+ uint16_t i, k;
+ real_t tmp;
+
+ if (ics->ms_mask_present >= 1)
+ {
+ for (g = 0; g < ics->num_window_groups; g++)
+ {
+ for (b = 0; b < ics->window_group_length[g]; b++)
+ {
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
+ {
+ /* If intensity stereo coding or noise substitution is on
+ for a particular scalefactor band, no M/S stereo decoding
+ is carried out.
+ */
+ if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
+ !is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
+ {
+ for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++)
+ {
+ k = (group*nshort) + i;
+ tmp = l_spec[k] - r_spec[k];
+ l_spec[k] = l_spec[k] + r_spec[k];
+ r_spec[k] = tmp;
+ }
+ }
+ }
+ group++;
+ }
+ }
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ms.h b/src/filters/transform/mpadecfilter/faad2/libfaad/ms.h
new file mode 100644
index 000000000..55956ff4d
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ms.h
@@ -0,0 +1,46 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ms.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __MS_H__
+#define __MS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
+ uint16_t frame_len);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/output.c b/src/filters/transform/mpadecfilter/faad2/libfaad/output.c
new file mode 100644
index 000000000..f3ed0bf15
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/output.c
@@ -0,0 +1,562 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: output.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "output.h"
+#include "decoder.h"
+
+#ifndef FIXED_POINT
+
+
+#define FLOAT_SCALE (1.0f/(1<<15))
+
+#define DM_MUL REAL_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2))
+#define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2)
+
+
+static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
+ uint8_t down_matrix, uint8_t *internal_channel)
+{
+ if (!down_matrix)
+ return input[internal_channel[channel]][sample];
+
+ if (channel == 0)
+ {
+ return DM_MUL * (input[internal_channel[1]][sample] +
+ input[internal_channel[0]][sample] * RSQRT2 +
+ input[internal_channel[3]][sample] * RSQRT2);
+ } else {
+ return DM_MUL * (input[internal_channel[2]][sample] +
+ input[internal_channel[0]][sample] * RSQRT2 +
+ input[internal_channel[4]][sample] * RSQRT2);
+ }
+}
+
+#ifndef HAS_LRINTF
+#define CLIP(sample, max, min) \
+if (sample >= 0.0f) \
+{ \
+ sample += 0.5f; \
+ if (sample >= max) \
+ sample = max; \
+} else { \
+ sample += -0.5f; \
+ if (sample <= min) \
+ sample = min; \
+}
+#else
+#define CLIP(sample, max, min) \
+if (sample >= 0.0f) \
+{ \
+ if (sample >= max) \
+ sample = max; \
+} else { \
+ if (sample <= min) \
+ sample = min; \
+}
+#endif
+
+#define CONV(a,b) ((a<<1)|(b&0x1))
+
+static void to_PCM_16bit(NeAACDecHandle hDecoder, real_t **input,
+ uint8_t channels, uint16_t frame_len,
+ int16_t **sample_buffer)
+{
+ uint8_t ch, ch1;
+ uint16_t i;
+
+ switch (CONV(channels,hDecoder->downMatrix))
+ {
+ case CONV(1,0):
+ case CONV(1,1):
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = input[hDecoder->internal_channel[0]][i];
+
+ CLIP(inp, 32767.0f, -32768.0f);
+
+ (*sample_buffer)[i] = (int16_t)lrintf(inp);
+ }
+ break;
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
+ {
+ ch = hDecoder->internal_channel[0];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch][i];
+
+ CLIP(inp0, 32767.0f, -32768.0f);
+
+ (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
+ }
+ } else {
+ ch = hDecoder->internal_channel[0];
+ ch1 = hDecoder->internal_channel[1];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch ][i];
+ real_t inp1 = input[ch1][i];
+
+ CLIP(inp0, 32767.0f, -32768.0f);
+ CLIP(inp1, 32767.0f, -32768.0f);
+
+ (*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
+ }
+ }
+ break;
+ default:
+ for (ch = 0; ch < channels; ch++)
+ {
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+
+ CLIP(inp, 32767.0f, -32768.0f);
+
+ (*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp);
+ }
+ }
+ break;
+ }
+}
+
+static void to_PCM_24bit(NeAACDecHandle hDecoder, real_t **input,
+ uint8_t channels, uint16_t frame_len,
+ int32_t **sample_buffer)
+{
+ uint8_t ch, ch1;
+ uint16_t i;
+
+ switch (CONV(channels,hDecoder->downMatrix))
+ {
+ case CONV(1,0):
+ case CONV(1,1):
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = input[hDecoder->internal_channel[0]][i];
+
+ inp *= 256.0f;
+ CLIP(inp, 8388607.0f, -8388608.0f);
+
+ (*sample_buffer)[i] = (int32_t)lrintf(inp);
+ }
+ break;
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
+ {
+ ch = hDecoder->internal_channel[0];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch][i];
+
+ inp0 *= 256.0f;
+ CLIP(inp0, 8388607.0f, -8388608.0f);
+
+ (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+ }
+ } else {
+ ch = hDecoder->internal_channel[0];
+ ch1 = hDecoder->internal_channel[1];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch ][i];
+ real_t inp1 = input[ch1][i];
+
+ inp0 *= 256.0f;
+ inp1 *= 256.0f;
+ CLIP(inp0, 8388607.0f, -8388608.0f);
+ CLIP(inp1, 8388607.0f, -8388608.0f);
+
+ (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+ }
+ }
+ break;
+ default:
+ for (ch = 0; ch < channels; ch++)
+ {
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+
+ inp *= 256.0f;
+ CLIP(inp, 8388607.0f, -8388608.0f);
+
+ (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
+ }
+ }
+ break;
+ }
+}
+
+static void to_PCM_32bit(NeAACDecHandle hDecoder, real_t **input,
+ uint8_t channels, uint16_t frame_len,
+ int32_t **sample_buffer)
+{
+ uint8_t ch, ch1;
+ uint16_t i;
+
+ switch (CONV(channels,hDecoder->downMatrix))
+ {
+ case CONV(1,0):
+ case CONV(1,1):
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = input[hDecoder->internal_channel[0]][i];
+
+ inp *= 65536.0f;
+ CLIP(inp, 2147483647.0f, -2147483648.0f);
+
+ (*sample_buffer)[i] = (int32_t)lrintf(inp);
+ }
+ break;
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
+ {
+ ch = hDecoder->internal_channel[0];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch][i];
+
+ inp0 *= 65536.0f;
+ CLIP(inp0, 2147483647.0f, -2147483648.0f);
+
+ (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
+ }
+ } else {
+ ch = hDecoder->internal_channel[0];
+ ch1 = hDecoder->internal_channel[1];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch ][i];
+ real_t inp1 = input[ch1][i];
+
+ inp0 *= 65536.0f;
+ inp1 *= 65536.0f;
+ CLIP(inp0, 2147483647.0f, -2147483648.0f);
+ CLIP(inp1, 2147483647.0f, -2147483648.0f);
+
+ (*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
+ (*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
+ }
+ }
+ break;
+ default:
+ for (ch = 0; ch < channels; ch++)
+ {
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+
+ inp *= 65536.0f;
+ CLIP(inp, 2147483647.0f, -2147483648.0f);
+
+ (*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
+ }
+ }
+ break;
+ }
+}
+
+static void to_PCM_float(NeAACDecHandle hDecoder, real_t **input,
+ uint8_t channels, uint16_t frame_len,
+ float32_t **sample_buffer)
+{
+ uint8_t ch, ch1;
+ uint16_t i;
+
+ switch (CONV(channels,hDecoder->downMatrix))
+ {
+ case CONV(1,0):
+ case CONV(1,1):
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = input[hDecoder->internal_channel[0]][i];
+ (*sample_buffer)[i] = inp*FLOAT_SCALE;
+ }
+ break;
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
+ {
+ ch = hDecoder->internal_channel[0];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch][i];
+ (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE;
+ }
+ } else {
+ ch = hDecoder->internal_channel[0];
+ ch1 = hDecoder->internal_channel[1];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch ][i];
+ real_t inp1 = input[ch1][i];
+ (*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE;
+ }
+ }
+ break;
+ default:
+ for (ch = 0; ch < channels; ch++)
+ {
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+ (*sample_buffer)[(i*channels)+ch] = inp*FLOAT_SCALE;
+ }
+ }
+ break;
+ }
+}
+
+static void to_PCM_double(NeAACDecHandle hDecoder, real_t **input,
+ uint8_t channels, uint16_t frame_len,
+ double **sample_buffer)
+{
+ uint8_t ch, ch1;
+ uint16_t i;
+
+ switch (CONV(channels,hDecoder->downMatrix))
+ {
+ case CONV(1,0):
+ case CONV(1,1):
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = input[hDecoder->internal_channel[0]][i];
+ (*sample_buffer)[i] = (double)inp*FLOAT_SCALE;
+ }
+ break;
+ case CONV(2,0):
+ if (hDecoder->upMatrix)
+ {
+ ch = hDecoder->internal_channel[0];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch][i];
+ (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE;
+ }
+ } else {
+ ch = hDecoder->internal_channel[0];
+ ch1 = hDecoder->internal_channel[1];
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp0 = input[ch ][i];
+ real_t inp1 = input[ch1][i];
+ (*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
+ (*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
+ }
+ }
+ break;
+ default:
+ for (ch = 0; ch < channels; ch++)
+ {
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
+ (*sample_buffer)[(i*channels)+ch] = (double)inp*FLOAT_SCALE;
+ }
+ }
+ break;
+ }
+}
+
+void *output_to_PCM(NeAACDecHandle hDecoder,
+ real_t **input, void *sample_buffer, uint8_t channels,
+ uint16_t frame_len, uint8_t format)
+{
+ int16_t *short_sample_buffer = (int16_t*)sample_buffer;
+ int32_t *int_sample_buffer = (int32_t*)sample_buffer;
+ float32_t *float_sample_buffer = (float32_t*)sample_buffer;
+ double *double_sample_buffer = (double*)sample_buffer;
+
+#ifdef PROFILE
+ int64_t count = faad_get_ts();
+#endif
+
+ /* Copy output to a standard PCM buffer */
+ switch (format)
+ {
+ case FAAD_FMT_16BIT:
+ to_PCM_16bit(hDecoder, input, channels, frame_len, &short_sample_buffer);
+ break;
+ case FAAD_FMT_24BIT:
+ to_PCM_24bit(hDecoder, input, channels, frame_len, &int_sample_buffer);
+ break;
+ case FAAD_FMT_32BIT:
+ to_PCM_32bit(hDecoder, input, channels, frame_len, &int_sample_buffer);
+ break;
+ case FAAD_FMT_FLOAT:
+ to_PCM_float(hDecoder, input, channels, frame_len, &float_sample_buffer);
+ break;
+ case FAAD_FMT_DOUBLE:
+ to_PCM_double(hDecoder, input, channels, frame_len, &double_sample_buffer);
+ break;
+ }
+
+#ifdef PROFILE
+ count = faad_get_ts() - count;
+ hDecoder->output_cycles += count;
+#endif
+
+ return sample_buffer;
+}
+
+#else
+
+#define DM_MUL FRAC_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2))
+#define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2)
+
+static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
+ uint8_t down_matrix, uint8_t up_matrix,
+ uint8_t *internal_channel)
+{
+ if (up_matrix == 1)
+ return input[internal_channel[0]][sample];
+
+ if (!down_matrix)
+ return input[internal_channel[channel]][sample];
+
+ if (channel == 0)
+ {
+ real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2);
+ real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2);
+ real_t cum = input[internal_channel[1]][sample] + C + L_S;
+ return MUL_F(cum, DM_MUL);
+ } else {
+ real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2);
+ real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2);
+ real_t cum = input[internal_channel[2]][sample] + C + R_S;
+ return MUL_F(cum, DM_MUL);
+ }
+}
+
+void* output_to_PCM(NeAACDecHandle hDecoder,
+ real_t **input, void *sample_buffer, uint8_t channels,
+ uint16_t frame_len, uint8_t format)
+{
+ uint8_t ch;
+ uint16_t i;
+ int16_t *short_sample_buffer = (int16_t*)sample_buffer;
+ int32_t *int_sample_buffer = (int32_t*)sample_buffer;
+
+ /* Copy output to a standard PCM buffer */
+ for (ch = 0; ch < channels; ch++)
+ {
+ switch (format)
+ {
+ case FAAD_FMT_16BIT:
+ for(i = 0; i < frame_len; i++)
+ {
+ int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+ hDecoder->internal_channel);
+ if (tmp >= 0)
+ {
+ tmp += (1 << (REAL_BITS-1));
+ if (tmp >= REAL_CONST(32767))
+ {
+ tmp = REAL_CONST(32767);
+ }
+ } else {
+ tmp += -(1 << (REAL_BITS-1));
+ if (tmp <= REAL_CONST(-32768))
+ {
+ tmp = REAL_CONST(-32768);
+ }
+ }
+ tmp >>= REAL_BITS;
+ short_sample_buffer[(i*channels)+ch] = (int16_t)tmp;
+ }
+ break;
+ case FAAD_FMT_24BIT:
+ for(i = 0; i < frame_len; i++)
+ {
+ int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+ hDecoder->internal_channel);
+ if (tmp >= 0)
+ {
+ tmp += (1 << (REAL_BITS-9));
+ tmp >>= (REAL_BITS-8);
+ if (tmp >= 8388607)
+ {
+ tmp = 8388607;
+ }
+ } else {
+ tmp += -(1 << (REAL_BITS-9));
+ tmp >>= (REAL_BITS-8);
+ if (tmp <= -8388608)
+ {
+ tmp = -8388608;
+ }
+ }
+ int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
+ }
+ break;
+ case FAAD_FMT_32BIT:
+ for(i = 0; i < frame_len; i++)
+ {
+ int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+ hDecoder->internal_channel);
+ if (tmp >= 0)
+ {
+ tmp += (1 << (16-REAL_BITS-1));
+ tmp <<= (16-REAL_BITS);
+ } else {
+ tmp += -(1 << (16-REAL_BITS-1));
+ tmp <<= (16-REAL_BITS);
+ }
+ int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
+ }
+ break;
+ case FAAD_FMT_FIXED:
+ for(i = 0; i < frame_len; i++)
+ {
+ real_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
+ hDecoder->internal_channel);
+ int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
+ }
+ break;
+ }
+ }
+
+ return sample_buffer;
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/output.h b/src/filters/transform/mpadecfilter/faad2/libfaad/output.h
new file mode 100644
index 000000000..3ab87f622
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/output.h
@@ -0,0 +1,50 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: output.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __OUTPUT_H__
+#define __OUTPUT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* output_to_PCM(NeAACDecHandle hDecoder,
+ real_t **input,
+ void *samplebuffer,
+ uint8_t channels,
+ uint16_t frame_len,
+ uint8_t format);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/pns.c b/src/filters/transform/mpadecfilter/faad2/libfaad/pns.c
new file mode 100644
index 000000000..1883dcb60
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/pns.c
@@ -0,0 +1,270 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: pns.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "pns.h"
+
+
+/* static function declarations */
+static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
+ uint8_t sub);
+
+
+#ifdef FIXED_POINT
+
+#define DIV(A, B) (((int64_t)A << REAL_BITS)/B)
+
+#define step(shift) \
+ if ((0x40000000l >> shift) + root <= value) \
+ { \
+ value -= (0x40000000l >> shift) + root; \
+ root = (root >> 1) | (0x40000000l >> shift); \
+ } else { \
+ root = root >> 1; \
+ }
+
+/* fixed point square root approximation */
+/* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */
+real_t fp_sqrt(real_t value)
+{
+ real_t root = 0;
+
+ step( 0); step( 2); step( 4); step( 6);
+ step( 8); step(10); step(12); step(14);
+ step(16); step(18); step(20); step(22);
+ step(24); step(26); step(28); step(30);
+
+ if (root < value)
+ ++root;
+
+ root <<= (REAL_BITS/2);
+
+ return root;
+}
+
+static real_t pow2_table[] =
+{
+ COEF_CONST(1.0),
+ COEF_CONST(1.18920711500272),
+ COEF_CONST(1.41421356237310),
+ COEF_CONST(1.68179283050743)
+};
+#endif
+
+/* The function gen_rand_vector(addr, size) generates a vector of length
+ <size> with signed random values of average energy MEAN_NRG per random
+ value. A suitable random number generator can be realized using one
+ multiplication/accumulation per random value.
+*/
+static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
+ uint8_t sub)
+{
+#ifndef FIXED_POINT
+ uint16_t i;
+ real_t energy = 0.0;
+
+ real_t scale = (real_t)1.0/(real_t)size;
+
+ for (i = 0; i < size; i++)
+ {
+ real_t tmp = scale*(real_t)(int32_t)random_int();
+ spec[i] = tmp;
+ energy += tmp*tmp;
+ }
+
+ scale = (real_t)1.0/(real_t)sqrt(energy);
+ scale *= (real_t)pow(2.0, 0.25 * scale_factor);
+ for (i = 0; i < size; i++)
+ {
+ spec[i] *= scale;
+ }
+#else
+ uint16_t i;
+ real_t energy = 0, scale;
+ int32_t exp, frac;
+
+ for (i = 0; i < size; i++)
+ {
+ /* this can be replaced by a 16 bit random generator!!!! */
+ real_t tmp = (int32_t)random_int();
+ if (tmp < 0)
+ tmp = -(tmp & ((1<<(REAL_BITS-1))-1));
+ else
+ tmp = (tmp & ((1<<(REAL_BITS-1))-1));
+
+ energy += MUL_R(tmp,tmp);
+
+ spec[i] = tmp;
+ }
+
+ energy = fp_sqrt(energy);
+ if (energy > 0)
+ {
+ scale = DIV(REAL_CONST(1),energy);
+
+ exp = scale_factor >> 2;
+ frac = scale_factor & 3;
+
+ /* IMDCT pre-scaling */
+ exp -= sub;
+
+ if (exp < 0)
+ scale >>= -exp;
+ else
+ scale <<= exp;
+
+ if (frac)
+ scale = MUL_C(scale, pow2_table[frac]);
+
+ for (i = 0; i < size; i++)
+ {
+ spec[i] = MUL_R(spec[i], scale);
+ }
+ }
+#endif
+}
+
+void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
+ real_t *spec_left, real_t *spec_right, uint16_t frame_len,
+ uint8_t channel_pair, uint8_t object_type)
+{
+ uint8_t g, sfb, b;
+ uint16_t size, offs;
+
+ uint8_t group = 0;
+ uint16_t nshort = frame_len >> 3;
+
+ uint8_t sub = 0;
+
+#ifdef FIXED_POINT
+ /* IMDCT scaling */
+ if (object_type == LD)
+ {
+ sub = 9 /*9*/;
+ } else {
+ if (ics_left->window_sequence == EIGHT_SHORT_SEQUENCE)
+ sub = 7 /*7*/;
+ else
+ sub = 10 /*10*/;
+ }
+#endif
+
+ for (g = 0; g < ics_left->num_window_groups; g++)
+ {
+ /* Do perceptual noise substitution decoding */
+ for (b = 0; b < ics_left->window_group_length[g]; b++)
+ {
+ for (sfb = 0; sfb < ics_left->max_sfb; sfb++)
+ {
+ if (is_noise(ics_left, g, sfb))
+ {
+#ifdef LTP_DEC
+ /* Simultaneous use of LTP and PNS is not prevented in the
+ syntax. If both LTP, and PNS are enabled on the same
+ scalefactor band, PNS takes precedence, and no prediction
+ is applied to this band.
+ */
+ ics_left->ltp.long_used[sfb] = 0;
+ ics_left->ltp2.long_used[sfb] = 0;
+#endif
+
+#ifdef MAIN_DEC
+ /* For scalefactor bands coded using PNS the corresponding
+ predictors are switched to "off".
+ */
+ ics_left->pred.prediction_used[sfb] = 0;
+#endif
+
+ offs = ics_left->swb_offset[sfb];
+ size = ics_left->swb_offset[sfb+1] - offs;
+
+ /* Generate random vector */
+ gen_rand_vector(&spec_left[(group*nshort)+offs],
+ ics_left->scale_factors[g][sfb], size, sub);
+ }
+
+/* From the spec:
+ If the same scalefactor band and group is coded by perceptual noise
+ substitution in both channels of a channel pair, the correlation of
+ the noise signal can be controlled by means of the ms_used field: While
+ the default noise generation process works independently for each channel
+ (separate generation of random vectors), the same random vector is used
+ for both channels if ms_used[] is set for a particular scalefactor band
+ and group. In this case, no M/S stereo coding is carried out (because M/S
+ stereo coding and noise substitution coding are mutually exclusive).
+ If the same scalefactor band and group is coded by perceptual noise
+ substitution in only one channel of a channel pair the setting of ms_used[]
+ is not evaluated.
+*/
+ if (channel_pair)
+ {
+ if (is_noise(ics_right, g, sfb))
+ {
+ if (((ics_left->ms_mask_present == 1) &&
+ (ics_left->ms_used[g][sfb])) ||
+ (ics_left->ms_mask_present == 2))
+ {
+ uint16_t c;
+
+ offs = ics_right->swb_offset[sfb];
+ size = ics_right->swb_offset[sfb+1] - offs;
+
+ for (c = 0; c < size; c++)
+ {
+ spec_right[(group*nshort) + offs + c] =
+ spec_left[(group*nshort) + offs + c];
+ }
+ } else /*if (ics_left->ms_mask_present == 0)*/ {
+#ifdef LTP_DEC
+ ics_right->ltp.long_used[sfb] = 0;
+ ics_right->ltp2.long_used[sfb] = 0;
+#endif
+#ifdef MAIN_DEC
+ ics_right->pred.prediction_used[sfb] = 0;
+#endif
+
+ offs = ics_right->swb_offset[sfb];
+ size = ics_right->swb_offset[sfb+1] - offs;
+
+ /* Generate random vector */
+ gen_rand_vector(&spec_right[(group*nshort)+offs],
+ ics_right->scale_factors[g][sfb], size, sub);
+ }
+ }
+ }
+ } /* sfb */
+ group++;
+ } /* b */
+ } /* g */
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/pns.h b/src/filters/transform/mpadecfilter/faad2/libfaad/pns.h
new file mode 100644
index 000000000..df6bdd2b4
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/pns.h
@@ -0,0 +1,58 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: pns.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __PNS_H__
+#define __PNS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "syntax.h"
+
+#define NOISE_OFFSET 90
+
+void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
+ real_t *spec_left, real_t *spec_right, uint16_t frame_len,
+ uint8_t channel_pair, uint8_t object_type);
+
+static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb)
+{
+ if (ics->sfb_cb[group][sfb] == NOISE_HCB)
+ return 1;
+ return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.c b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.c
new file mode 100644
index 000000000..77b0f0632
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.c
@@ -0,0 +1,2010 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ps_dec.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+
+#ifdef PS_DEC
+
+#include <stdlib.h>
+#include "ps_dec.h"
+#include "ps_tables.h"
+
+/* constants */
+#define NEGATE_IPD_MASK (0x1000)
+#define DECAY_SLOPE FRAC_CONST(0.05)
+#define COEF_SQRT2 COEF_CONST(1.4142135623731)
+
+/* tables */
+/* filters are mirrored in coef 6, second half left out */
+static const real_t p8_13_20[7] =
+{
+ FRAC_CONST(0.00746082949812),
+ FRAC_CONST(0.02270420949825),
+ FRAC_CONST(0.04546865930473),
+ FRAC_CONST(0.07266113929591),
+ FRAC_CONST(0.09885108575264),
+ FRAC_CONST(0.11793710567217),
+ FRAC_CONST(0.125)
+};
+
+static const real_t p2_13_20[7] =
+{
+ FRAC_CONST(0.0),
+ FRAC_CONST(0.01899487526049),
+ FRAC_CONST(0.0),
+ FRAC_CONST(-0.07293139167538),
+ FRAC_CONST(0.0),
+ FRAC_CONST(0.30596630545168),
+ FRAC_CONST(0.5)
+};
+
+static const real_t p12_13_34[7] =
+{
+ FRAC_CONST(0.04081179924692),
+ FRAC_CONST(0.03812810994926),
+ FRAC_CONST(0.05144908135699),
+ FRAC_CONST(0.06399831151592),
+ FRAC_CONST(0.07428313801106),
+ FRAC_CONST(0.08100347892914),
+ FRAC_CONST(0.08333333333333)
+};
+
+static const real_t p8_13_34[7] =
+{
+ FRAC_CONST(0.01565675600122),
+ FRAC_CONST(0.03752716391991),
+ FRAC_CONST(0.05417891378782),
+ FRAC_CONST(0.08417044116767),
+ FRAC_CONST(0.10307344158036),
+ FRAC_CONST(0.12222452249753),
+ FRAC_CONST(0.125)
+};
+
+static const real_t p4_13_34[7] =
+{
+ FRAC_CONST(-0.05908211155639),
+ FRAC_CONST(-0.04871498374946),
+ FRAC_CONST(0.0),
+ FRAC_CONST(0.07778723915851),
+ FRAC_CONST(0.16486303567403),
+ FRAC_CONST(0.23279856662996),
+ FRAC_CONST(0.25)
+};
+
+#ifdef PARAM_32KHZ
+static const uint8_t delay_length_d[2][NO_ALLPASS_LINKS] = {
+ { 1, 2, 3 } /* d_24kHz */,
+ { 3, 4, 5 } /* d_48kHz */
+};
+#else
+static const uint8_t delay_length_d[NO_ALLPASS_LINKS] = {
+ 3, 4, 5 /* d_48kHz */
+};
+#endif
+static const real_t filter_a[NO_ALLPASS_LINKS] = { /* a(m) = exp(-d_48kHz(m)/7) */
+ FRAC_CONST(0.65143905753106),
+ FRAC_CONST(0.56471812200776),
+ FRAC_CONST(0.48954165955695)
+};
+
+static const uint8_t group_border20[10+12 + 1] =
+{
+ 6, 7, 0, 1, 2, 3, /* 6 subqmf subbands */
+ 9, 8, /* 2 subqmf subbands */
+ 10, 11, /* 2 subqmf subbands */
+ 3, 4, 5, 6, 7, 8, 9, 11, 14, 18, 23, 35, 64
+};
+
+static const uint8_t group_border34[32+18 + 1] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, /* 12 subqmf subbands */
+ 12, 13, 14, 15, 16, 17, 18, 19, /* 8 subqmf subbands */
+ 20, 21, 22, 23, /* 4 subqmf subbands */
+ 24, 25, 26, 27, /* 4 subqmf subbands */
+ 28, 29, 30, 31, /* 4 subqmf subbands */
+ 32-27, 33-27, 34-27, 35-27, 36-27, 37-27, 38-27, 40-27, 42-27, 44-27, 46-27, 48-27, 51-27, 54-27, 57-27, 60-27, 64-27, 68-27, 91-27
+};
+
+static const uint16_t map_group2bk20[10+12] =
+{
+ (NEGATE_IPD_MASK | 1), (NEGATE_IPD_MASK | 0),
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
+};
+
+static const uint16_t map_group2bk34[32+18] =
+{
+ 0, 1, 2, 3, 4, 5, 6, 6, 7, (NEGATE_IPD_MASK | 2), (NEGATE_IPD_MASK | 1), (NEGATE_IPD_MASK | 0),
+ 10, 10, 4, 5, 6, 7, 8, 9,
+ 10, 11, 12, 9,
+ 14, 11, 12, 13,
+ 14, 15, 16, 13,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33
+};
+
+/* type definitions */
+typedef struct
+{
+ uint8_t frame_len;
+ uint8_t resolution20[3];
+ uint8_t resolution34[5];
+
+ qmf_t *work;
+ qmf_t **buffer;
+ qmf_t **temp;
+} hyb_info;
+
+/* static function declarations */
+static void ps_data_decode(ps_info *ps);
+static hyb_info *hybrid_init();
+static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
+ qmf_t *buffer, qmf_t **X_hybrid);
+static void INLINE DCT3_4_unscaled(real_t *y, real_t *x);
+static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
+ qmf_t *buffer, qmf_t **X_hybrid);
+static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32],
+ uint8_t use34);
+static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32],
+ uint8_t use34);
+static int8_t delta_clip(int8_t i, int8_t min, int8_t max);
+static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev,
+ uint8_t dt_flag, uint8_t nr_par, uint8_t stride,
+ int8_t min_index, int8_t max_index);
+static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_prev,
+ uint8_t dt_flag, uint8_t nr_par, uint8_t stride,
+ int8_t and_modulo);
+static void map20indexto34(int8_t *index, uint8_t bins);
+#ifdef PS_LOW_POWER
+static void map34indexto20(int8_t *index, uint8_t bins);
+#endif
+static void ps_data_decode(ps_info *ps);
+static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64],
+ qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]);
+static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64],
+ qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32]);
+
+/* */
+
+
+static hyb_info *hybrid_init()
+{
+ uint8_t i;
+
+ hyb_info *hyb = (hyb_info*)faad_malloc(sizeof(hyb_info));
+
+ hyb->resolution34[0] = 12;
+ hyb->resolution34[1] = 8;
+ hyb->resolution34[2] = 4;
+ hyb->resolution34[3] = 4;
+ hyb->resolution34[4] = 4;
+
+ hyb->resolution20[0] = 8;
+ hyb->resolution20[1] = 2;
+ hyb->resolution20[2] = 2;
+
+ hyb->frame_len = 32;
+
+ hyb->work = (qmf_t*)faad_malloc((hyb->frame_len+12) * sizeof(qmf_t));
+ memset(hyb->work, 0, (hyb->frame_len+12) * sizeof(qmf_t));
+
+ hyb->buffer = (qmf_t**)faad_malloc(5 * sizeof(qmf_t*));
+ for (i = 0; i < 5; i++)
+ {
+ hyb->buffer[i] = (qmf_t*)faad_malloc(hyb->frame_len * sizeof(qmf_t));
+ memset(hyb->buffer[i], 0, hyb->frame_len * sizeof(qmf_t));
+ }
+
+ hyb->temp = (qmf_t**)faad_malloc(hyb->frame_len * sizeof(qmf_t*));
+ for (i = 0; i < hyb->frame_len; i++)
+ {
+ hyb->temp[i] = (qmf_t*)faad_malloc(12 /*max*/ * sizeof(qmf_t));
+ }
+
+ return hyb;
+}
+
+static void hybrid_free(hyb_info *hyb)
+{
+ uint8_t i;
+
+ if (hyb->work)
+ faad_free(hyb->work);
+
+ for (i = 0; i < 5; i++)
+ {
+ if (hyb->buffer[i])
+ faad_free(hyb->buffer[i]);
+ }
+ if (hyb->buffer)
+ faad_free(hyb->buffer);
+
+ for (i = 0; i < hyb->frame_len; i++)
+ {
+ if (hyb->temp[i])
+ faad_free(hyb->temp[i]);
+ }
+ if (hyb->temp)
+ faad_free(hyb->temp);
+}
+
+/* real filter, size 2 */
+static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
+ qmf_t *buffer, qmf_t **X_hybrid)
+{
+ uint8_t i;
+
+ for (i = 0; i < frame_len; i++)
+ {
+ real_t r0 = MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i])));
+ real_t r1 = MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i])));
+ real_t r2 = MUL_F(filter[2],(QMF_RE(buffer[2+i]) + QMF_RE(buffer[10+i])));
+ real_t r3 = MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i])));
+ real_t r4 = MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i])));
+ real_t r5 = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i])));
+ real_t r6 = MUL_F(filter[6],QMF_RE(buffer[6+i]));
+ real_t i0 = MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i])));
+ real_t i1 = MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i])));
+ real_t i2 = MUL_F(filter[2],(QMF_IM(buffer[2+i]) + QMF_IM(buffer[10+i])));
+ real_t i3 = MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i])));
+ real_t i4 = MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i])));
+ real_t i5 = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i])));
+ real_t i6 = MUL_F(filter[6],QMF_IM(buffer[6+i]));
+
+ /* q = 0 */
+ QMF_RE(X_hybrid[i][0]) = r0 + r1 + r2 + r3 + r4 + r5 + r6;
+ QMF_IM(X_hybrid[i][0]) = i0 + i1 + i2 + i3 + i4 + i5 + i6;
+
+ /* q = 1 */
+ QMF_RE(X_hybrid[i][1]) = r0 - r1 + r2 - r3 + r4 - r5 + r6;
+ QMF_IM(X_hybrid[i][1]) = i0 - i1 + i2 - i3 + i4 - i5 + i6;
+ }
+}
+
+/* complex filter, size 4 */
+static void channel_filter4(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
+ qmf_t *buffer, qmf_t **X_hybrid)
+{
+ uint8_t i;
+ real_t input_re1[2], input_re2[2], input_im1[2], input_im2[2];
+
+ for (i = 0; i < frame_len; i++)
+ {
+ input_re1[0] = -MUL_F(filter[2], (QMF_RE(buffer[i+2]) + QMF_RE(buffer[i+10]))) +
+ MUL_F(filter[6], QMF_RE(buffer[i+6]));
+ input_re1[1] = MUL_F(FRAC_CONST(-0.70710678118655),
+ (MUL_F(filter[1], (QMF_RE(buffer[i+1]) + QMF_RE(buffer[i+11]))) +
+ MUL_F(filter[3], (QMF_RE(buffer[i+3]) + QMF_RE(buffer[i+9]))) -
+ MUL_F(filter[5], (QMF_RE(buffer[i+5]) + QMF_RE(buffer[i+7])))));
+
+ input_im1[0] = MUL_F(filter[0], (QMF_IM(buffer[i+0]) - QMF_IM(buffer[i+12]))) -
+ MUL_F(filter[4], (QMF_IM(buffer[i+4]) - QMF_IM(buffer[i+8])));
+ input_im1[1] = MUL_F(FRAC_CONST(0.70710678118655),
+ (MUL_F(filter[1], (QMF_IM(buffer[i+1]) - QMF_IM(buffer[i+11]))) -
+ MUL_F(filter[3], (QMF_IM(buffer[i+3]) - QMF_IM(buffer[i+9]))) -
+ MUL_F(filter[5], (QMF_IM(buffer[i+5]) - QMF_IM(buffer[i+7])))));
+
+ input_re2[0] = MUL_F(filter[0], (QMF_RE(buffer[i+0]) - QMF_RE(buffer[i+12]))) -
+ MUL_F(filter[4], (QMF_RE(buffer[i+4]) - QMF_RE(buffer[i+8])));
+ input_re2[1] = MUL_F(FRAC_CONST(0.70710678118655),
+ (MUL_F(filter[1], (QMF_RE(buffer[i+1]) - QMF_RE(buffer[i+11]))) -
+ MUL_F(filter[3], (QMF_RE(buffer[i+3]) - QMF_RE(buffer[i+9]))) -
+ MUL_F(filter[5], (QMF_RE(buffer[i+5]) - QMF_RE(buffer[i+7])))));
+
+ input_im2[0] = -MUL_F(filter[2], (QMF_IM(buffer[i+2]) + QMF_IM(buffer[i+10]))) +
+ MUL_F(filter[6], QMF_IM(buffer[i+6]));
+ input_im2[1] = MUL_F(FRAC_CONST(-0.70710678118655),
+ (MUL_F(filter[1], (QMF_IM(buffer[i+1]) + QMF_IM(buffer[i+11]))) +
+ MUL_F(filter[3], (QMF_IM(buffer[i+3]) + QMF_IM(buffer[i+9]))) -
+ MUL_F(filter[5], (QMF_IM(buffer[i+5]) + QMF_IM(buffer[i+7])))));
+
+ /* q == 0 */
+ QMF_RE(X_hybrid[i][0]) = input_re1[0] + input_re1[1] + input_im1[0] + input_im1[1];
+ QMF_IM(X_hybrid[i][0]) = -input_re2[0] - input_re2[1] + input_im2[0] + input_im2[1];
+
+ /* q == 1 */
+ QMF_RE(X_hybrid[i][1]) = input_re1[0] - input_re1[1] - input_im1[0] + input_im1[1];
+ QMF_IM(X_hybrid[i][1]) = input_re2[0] - input_re2[1] + input_im2[0] - input_im2[1];
+
+ /* q == 2 */
+ QMF_RE(X_hybrid[i][2]) = input_re1[0] - input_re1[1] + input_im1[0] - input_im1[1];
+ QMF_IM(X_hybrid[i][2]) = -input_re2[0] + input_re2[1] + input_im2[0] - input_im2[1];
+
+ /* q == 3 */
+ QMF_RE(X_hybrid[i][3]) = input_re1[0] + input_re1[1] - input_im1[0] - input_im1[1];
+ QMF_IM(X_hybrid[i][3]) = input_re2[0] + input_re2[1] + input_im2[0] + input_im2[1];
+ }
+}
+
+static void INLINE DCT3_4_unscaled(real_t *y, real_t *x)
+{
+ real_t f0, f1, f2, f3, f4, f5, f6, f7, f8;
+
+ f0 = MUL_F(x[2], FRAC_CONST(0.7071067811865476));
+ f1 = x[0] - f0;
+ f2 = x[0] + f0;
+ f3 = x[1] + x[3];
+ f4 = MUL_C(x[1], COEF_CONST(1.3065629648763766));
+ f5 = MUL_F(f3, FRAC_CONST(-0.9238795325112866));
+ f6 = MUL_F(x[3], FRAC_CONST(-0.5411961001461967));
+ f7 = f4 + f5;
+ f8 = f6 - f5;
+ y[3] = f2 - f8;
+ y[0] = f2 + f8;
+ y[2] = f1 - f7;
+ y[1] = f1 + f7;
+}
+
+/* complex filter, size 8 */
+static void channel_filter8(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
+ qmf_t *buffer, qmf_t **X_hybrid)
+{
+ uint8_t i, n;
+ real_t input_re1[4], input_re2[4], input_im1[4], input_im2[4];
+ real_t x[4];
+
+ for (i = 0; i < frame_len; i++)
+ {
+ input_re1[0] = MUL_F(filter[6],QMF_RE(buffer[6+i]));
+ input_re1[1] = MUL_F(filter[5],(QMF_RE(buffer[5+i]) + QMF_RE(buffer[7+i])));
+ input_re1[2] = -MUL_F(filter[0],(QMF_RE(buffer[0+i]) + QMF_RE(buffer[12+i]))) + MUL_F(filter[4],(QMF_RE(buffer[4+i]) + QMF_RE(buffer[8+i])));
+ input_re1[3] = -MUL_F(filter[1],(QMF_RE(buffer[1+i]) + QMF_RE(buffer[11+i]))) + MUL_F(filter[3],(QMF_RE(buffer[3+i]) + QMF_RE(buffer[9+i])));
+
+ input_im1[0] = MUL_F(filter[5],(QMF_IM(buffer[7+i]) - QMF_IM(buffer[5+i])));
+ input_im1[1] = MUL_F(filter[0],(QMF_IM(buffer[12+i]) - QMF_IM(buffer[0+i]))) + MUL_F(filter[4],(QMF_IM(buffer[8+i]) - QMF_IM(buffer[4+i])));
+ input_im1[2] = MUL_F(filter[1],(QMF_IM(buffer[11+i]) - QMF_IM(buffer[1+i]))) + MUL_F(filter[3],(QMF_IM(buffer[9+i]) - QMF_IM(buffer[3+i])));
+ input_im1[3] = MUL_F(filter[2],(QMF_IM(buffer[10+i]) - QMF_IM(buffer[2+i])));
+
+ for (n = 0; n < 4; n++)
+ {
+ x[n] = input_re1[n] - input_im1[3-n];
+ }
+ DCT3_4_unscaled(x, x);
+ QMF_RE(X_hybrid[i][7]) = x[0];
+ QMF_RE(X_hybrid[i][5]) = x[2];
+ QMF_RE(X_hybrid[i][3]) = x[3];
+ QMF_RE(X_hybrid[i][1]) = x[1];
+
+ for (n = 0; n < 4; n++)
+ {
+ x[n] = input_re1[n] + input_im1[3-n];
+ }
+ DCT3_4_unscaled(x, x);
+ QMF_RE(X_hybrid[i][6]) = x[1];
+ QMF_RE(X_hybrid[i][4]) = x[3];
+ QMF_RE(X_hybrid[i][2]) = x[2];
+ QMF_RE(X_hybrid[i][0]) = x[0];
+
+ input_im2[0] = MUL_F(filter[6],QMF_IM(buffer[6+i]));
+ input_im2[1] = MUL_F(filter[5],(QMF_IM(buffer[5+i]) + QMF_IM(buffer[7+i])));
+ input_im2[2] = -MUL_F(filter[0],(QMF_IM(buffer[0+i]) + QMF_IM(buffer[12+i]))) + MUL_F(filter[4],(QMF_IM(buffer[4+i]) + QMF_IM(buffer[8+i])));
+ input_im2[3] = -MUL_F(filter[1],(QMF_IM(buffer[1+i]) + QMF_IM(buffer[11+i]))) + MUL_F(filter[3],(QMF_IM(buffer[3+i]) + QMF_IM(buffer[9+i])));
+
+ input_re2[0] = MUL_F(filter[5],(QMF_RE(buffer[7+i]) - QMF_RE(buffer[5+i])));
+ input_re2[1] = MUL_F(filter[0],(QMF_RE(buffer[12+i]) - QMF_RE(buffer[0+i]))) + MUL_F(filter[4],(QMF_RE(buffer[8+i]) - QMF_RE(buffer[4+i])));
+ input_re2[2] = MUL_F(filter[1],(QMF_RE(buffer[11+i]) - QMF_RE(buffer[1+i]))) + MUL_F(filter[3],(QMF_RE(buffer[9+i]) - QMF_RE(buffer[3+i])));
+ input_re2[3] = MUL_F(filter[2],(QMF_RE(buffer[10+i]) - QMF_RE(buffer[2+i])));
+
+ for (n = 0; n < 4; n++)
+ {
+ x[n] = input_im2[n] + input_re2[3-n];
+ }
+ DCT3_4_unscaled(x, x);
+ QMF_IM(X_hybrid[i][7]) = x[0];
+ QMF_IM(X_hybrid[i][5]) = x[2];
+ QMF_IM(X_hybrid[i][3]) = x[3];
+ QMF_IM(X_hybrid[i][1]) = x[1];
+
+ for (n = 0; n < 4; n++)
+ {
+ x[n] = input_im2[n] - input_re2[3-n];
+ }
+ DCT3_4_unscaled(x, x);
+ QMF_IM(X_hybrid[i][6]) = x[1];
+ QMF_IM(X_hybrid[i][4]) = x[3];
+ QMF_IM(X_hybrid[i][2]) = x[2];
+ QMF_IM(X_hybrid[i][0]) = x[0];
+ }
+}
+
+static void INLINE DCT3_6_unscaled(real_t *y, real_t *x)
+{
+ real_t f0, f1, f2, f3, f4, f5, f6, f7;
+
+ f0 = MUL_F(x[3], FRAC_CONST(0.70710678118655));
+ f1 = x[0] + f0;
+ f2 = x[0] - f0;
+ f3 = MUL_F((x[1] - x[5]), FRAC_CONST(0.70710678118655));
+ f4 = MUL_F(x[2], FRAC_CONST(0.86602540378444)) + MUL_F(x[4], FRAC_CONST(0.5));
+ f5 = f4 - x[4];
+ f6 = MUL_F(x[1], FRAC_CONST(0.96592582628907)) + MUL_F(x[5], FRAC_CONST(0.25881904510252));
+ f7 = f6 - f3;
+ y[0] = f1 + f6 + f4;
+ y[1] = f2 + f3 - x[4];
+ y[2] = f7 + f2 - f5;
+ y[3] = f1 - f7 - f5;
+ y[4] = f1 - f3 - x[4];
+ y[5] = f2 - f6 + f4;
+}
+
+/* complex filter, size 12 */
+static void channel_filter12(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
+ qmf_t *buffer, qmf_t **X_hybrid)
+{
+ uint8_t i, n;
+ real_t input_re1[6], input_re2[6], input_im1[6], input_im2[6];
+ real_t out_re1[6], out_re2[6], out_im1[6], out_im2[6];
+
+ for (i = 0; i < frame_len; i++)
+ {
+ for (n = 0; n < 6; n++)
+ {
+ if (n == 0)
+ {
+ input_re1[0] = MUL_F(QMF_RE(buffer[6+i]), filter[6]);
+ input_re2[0] = MUL_F(QMF_IM(buffer[6+i]), filter[6]);
+ } else {
+ input_re1[6-n] = MUL_F((QMF_RE(buffer[n+i]) + QMF_RE(buffer[12-n+i])), filter[n]);
+ input_re2[6-n] = MUL_F((QMF_IM(buffer[n+i]) + QMF_IM(buffer[12-n+i])), filter[n]);
+ }
+ input_im2[n] = MUL_F((QMF_RE(buffer[n+i]) - QMF_RE(buffer[12-n+i])), filter[n]);
+ input_im1[n] = MUL_F((QMF_IM(buffer[n+i]) - QMF_IM(buffer[12-n+i])), filter[n]);
+ }
+
+ DCT3_6_unscaled(out_re1, input_re1);
+ DCT3_6_unscaled(out_re2, input_re2);
+
+ DCT3_6_unscaled(out_im1, input_im1);
+ DCT3_6_unscaled(out_im2, input_im2);
+
+ for (n = 0; n < 6; n += 2)
+ {
+ QMF_RE(X_hybrid[i][n]) = out_re1[n] - out_im1[n];
+ QMF_IM(X_hybrid[i][n]) = out_re2[n] + out_im2[n];
+ QMF_RE(X_hybrid[i][n+1]) = out_re1[n+1] + out_im1[n+1];
+ QMF_IM(X_hybrid[i][n+1]) = out_re2[n+1] - out_im2[n+1];
+
+ QMF_RE(X_hybrid[i][10-n]) = out_re1[n+1] - out_im1[n+1];
+ QMF_IM(X_hybrid[i][10-n]) = out_re2[n+1] + out_im2[n+1];
+ QMF_RE(X_hybrid[i][11-n]) = out_re1[n] + out_im1[n];
+ QMF_IM(X_hybrid[i][11-n]) = out_re2[n] - out_im2[n];
+ }
+ }
+}
+
+/* Hybrid analysis: further split up QMF subbands
+ * to improve frequency resolution
+ */
+static void hybrid_analysis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32],
+ uint8_t use34)
+{
+ uint8_t k, n, band;
+ uint8_t offset = 0;
+ uint8_t qmf_bands = (use34) ? 5 : 3;
+ uint8_t *resolution = (use34) ? hyb->resolution34 : hyb->resolution20;
+
+ for (band = 0; band < qmf_bands; band++)
+ {
+ /* build working buffer */
+ memcpy(hyb->work, hyb->buffer[band], 12 * sizeof(qmf_t));
+
+ /* add new samples */
+ for (n = 0; n < hyb->frame_len; n++)
+ {
+ QMF_RE(hyb->work[12 + n]) = QMF_RE(X[n + 6 /*delay*/][band]);
+ QMF_IM(hyb->work[12 + n]) = QMF_IM(X[n + 6 /*delay*/][band]);
+ }
+
+ /* store samples */
+ memcpy(hyb->buffer[band], hyb->work + hyb->frame_len, 12 * sizeof(qmf_t));
+
+
+ switch(resolution[band])
+ {
+ case 2:
+ /* Type B real filter, Q[p] = 2 */
+ channel_filter2(hyb, hyb->frame_len, p2_13_20, hyb->work, hyb->temp);
+ break;
+ case 4:
+ /* Type A complex filter, Q[p] = 4 */
+ channel_filter4(hyb, hyb->frame_len, p4_13_34, hyb->work, hyb->temp);
+ break;
+ case 8:
+ /* Type A complex filter, Q[p] = 8 */
+ channel_filter8(hyb, hyb->frame_len, (use34) ? p8_13_34 : p8_13_20,
+ hyb->work, hyb->temp);
+ break;
+ case 12:
+ /* Type A complex filter, Q[p] = 12 */
+ channel_filter12(hyb, hyb->frame_len, p12_13_34, hyb->work, hyb->temp);
+ break;
+ }
+
+ for (n = 0; n < hyb->frame_len; n++)
+ {
+ for (k = 0; k < resolution[band]; k++)
+ {
+ QMF_RE(X_hybrid[n][offset + k]) = QMF_RE(hyb->temp[n][k]);
+ QMF_IM(X_hybrid[n][offset + k]) = QMF_IM(hyb->temp[n][k]);
+ }
+ }
+ offset += resolution[band];
+ }
+
+ /* group hybrid channels */
+ if (!use34)
+ {
+ for (n = 0; n < 32 /*30?*/; n++)
+ {
+ QMF_RE(X_hybrid[n][3]) += QMF_RE(X_hybrid[n][4]);
+ QMF_IM(X_hybrid[n][3]) += QMF_IM(X_hybrid[n][4]);
+ QMF_RE(X_hybrid[n][4]) = 0;
+ QMF_IM(X_hybrid[n][4]) = 0;
+
+ QMF_RE(X_hybrid[n][2]) += QMF_RE(X_hybrid[n][5]);
+ QMF_IM(X_hybrid[n][2]) += QMF_IM(X_hybrid[n][5]);
+ QMF_RE(X_hybrid[n][5]) = 0;
+ QMF_IM(X_hybrid[n][5]) = 0;
+ }
+ }
+}
+
+static void hybrid_synthesis(hyb_info *hyb, qmf_t X[32][64], qmf_t X_hybrid[32][32],
+ uint8_t use34)
+{
+ uint8_t k, n, band;
+ uint8_t offset = 0;
+ uint8_t qmf_bands = (use34) ? 5 : 3;
+ uint8_t *resolution = (use34) ? hyb->resolution34 : hyb->resolution20;
+
+ for(band = 0; band < qmf_bands; band++)
+ {
+ for (n = 0; n < hyb->frame_len; n++)
+ {
+ QMF_RE(X[n][band]) = 0;
+ QMF_IM(X[n][band]) = 0;
+
+ for (k = 0; k < resolution[band]; k++)
+ {
+ QMF_RE(X[n][band]) += QMF_RE(X_hybrid[n][offset + k]);
+ QMF_IM(X[n][band]) += QMF_IM(X_hybrid[n][offset + k]);
+ }
+ }
+ offset += resolution[band];
+ }
+}
+
+/* limits the value i to the range [min,max] */
+static int8_t delta_clip(int8_t i, int8_t min, int8_t max)
+{
+ if (i < min)
+ return min;
+ else if (i > max)
+ return max;
+ else
+ return i;
+}
+
+//int iid = 0;
+
+/* delta decode array */
+static void delta_decode(uint8_t enable, int8_t *index, int8_t *index_prev,
+ uint8_t dt_flag, uint8_t nr_par, uint8_t stride,
+ int8_t min_index, int8_t max_index)
+{
+ int8_t i;
+
+ if (enable == 1)
+ {
+ if (dt_flag == 0)
+ {
+ /* delta coded in frequency direction */
+ index[0] = 0 + index[0];
+ index[0] = delta_clip(index[0], min_index, max_index);
+
+ for (i = 1; i < nr_par; i++)
+ {
+ index[i] = index[i-1] + index[i];
+ index[i] = delta_clip(index[i], min_index, max_index);
+ }
+ } else {
+ /* delta coded in time direction */
+ for (i = 0; i < nr_par; i++)
+ {
+ //int8_t tmp2;
+ //int8_t tmp = index[i];
+
+ //printf("%d %d\n", index_prev[i*stride], index[i]);
+ //printf("%d\n", index[i]);
+
+ index[i] = index_prev[i*stride] + index[i];
+ //tmp2 = index[i];
+ index[i] = delta_clip(index[i], min_index, max_index);
+
+ //if (iid)
+ //{
+ // if (index[i] == 7)
+ // {
+ // printf("%d %d %d\n", index_prev[i*stride], tmp, tmp2);
+ // }
+ //}
+ }
+ }
+ } else {
+ /* set indices to zero */
+ for (i = 0; i < nr_par; i++)
+ {
+ index[i] = 0;
+ }
+ }
+
+ /* coarse */
+ if (stride == 2)
+ {
+ for (i = (nr_par<<1)-1; i > 0; i--)
+ {
+ index[i] = index[i>>1];
+ }
+ }
+}
+
+/* delta modulo decode array */
+/* in: log2 value of the modulo value to allow using AND instead of MOD */
+static void delta_modulo_decode(uint8_t enable, int8_t *index, int8_t *index_prev,
+ uint8_t dt_flag, uint8_t nr_par, uint8_t stride,
+ int8_t and_modulo)
+{
+ int8_t i;
+
+ if (enable == 1)
+ {
+ if (dt_flag == 0)
+ {
+ /* delta coded in frequency direction */
+ index[0] = 0 + index[0];
+ index[0] &= and_modulo;
+
+ for (i = 1; i < nr_par; i++)
+ {
+ index[i] = index[i-1] + index[i];
+ index[i] &= and_modulo;
+ }
+ } else {
+ /* delta coded in time direction */
+ for (i = 0; i < nr_par; i++)
+ {
+ index[i] = index_prev[i*stride] + index[i];
+ index[i] &= and_modulo;
+ }
+ }
+ } else {
+ /* set indices to zero */
+ for (i = 0; i < nr_par; i++)
+ {
+ index[i] = 0;
+ }
+ }
+
+ /* coarse */
+ if (stride == 2)
+ {
+ index[0] = 0;
+ for (i = (nr_par<<1)-1; i > 0; i--)
+ {
+ index[i] = index[i>>1];
+ }
+ }
+}
+
+#ifdef PS_LOW_POWER
+static void map34indexto20(int8_t *index, uint8_t bins)
+{
+ index[0] = (2*index[0]+index[1])/3;
+ index[1] = (index[1]+2*index[2])/3;
+ index[2] = (2*index[3]+index[4])/3;
+ index[3] = (index[4]+2*index[5])/3;
+ index[4] = (index[6]+index[7])/2;
+ index[5] = (index[8]+index[9])/2;
+ index[6] = index[10];
+ index[7] = index[11];
+ index[8] = (index[12]+index[13])/2;
+ index[9] = (index[14]+index[15])/2;
+ index[10] = index[16];
+
+ if (bins == 34)
+ {
+ index[11] = index[17];
+ index[12] = index[18];
+ index[13] = index[19];
+ index[14] = (index[20]+index[21])/2;
+ index[15] = (index[22]+index[23])/2;
+ index[16] = (index[24]+index[25])/2;
+ index[17] = (index[26]+index[27])/2;
+ index[18] = (index[28]+index[29]+index[30]+index[31])/4;
+ index[19] = (index[32]+index[33])/2;
+ }
+}
+#endif
+
+static void map20indexto34(int8_t *index, uint8_t bins)
+{
+ index[0] = index[0];
+ index[1] = (index[0] + index[1])/2;
+ index[2] = index[1];
+ index[3] = index[2];
+ index[4] = (index[2] + index[3])/2;
+ index[5] = index[3];
+ index[6] = index[4];
+ index[7] = index[4];
+ index[8] = index[5];
+ index[9] = index[5];
+ index[10] = index[6];
+ index[11] = index[7];
+ index[12] = index[8];
+ index[13] = index[8];
+ index[14] = index[9];
+ index[15] = index[9];
+ index[16] = index[10];
+
+ if (bins == 34)
+ {
+ index[17] = index[11];
+ index[18] = index[12];
+ index[19] = index[13];
+ index[20] = index[14];
+ index[21] = index[14];
+ index[22] = index[15];
+ index[23] = index[15];
+ index[24] = index[16];
+ index[25] = index[16];
+ index[26] = index[17];
+ index[27] = index[17];
+ index[28] = index[18];
+ index[29] = index[18];
+ index[30] = index[18];
+ index[31] = index[18];
+ index[32] = index[19];
+ index[33] = index[19];
+ }
+}
+
+/* parse the bitstream data decoded in ps_data() */
+static void ps_data_decode(ps_info *ps)
+{
+ uint8_t env, bin;
+
+ /* ps data not available, use data from previous frame */
+ if (ps->ps_data_available == 0)
+ {
+ ps->num_env = 0;
+ }
+
+ for (env = 0; env < ps->num_env; env++)
+ {
+ int8_t *iid_index_prev;
+ int8_t *icc_index_prev;
+ int8_t *ipd_index_prev;
+ int8_t *opd_index_prev;
+
+ int8_t num_iid_steps = (ps->iid_mode < 3) ? 7 : 15 /*fine quant*/;
+
+ if (env == 0)
+ {
+ /* take last envelope from previous frame */
+ iid_index_prev = ps->iid_index_prev;
+ icc_index_prev = ps->icc_index_prev;
+ ipd_index_prev = ps->ipd_index_prev;
+ opd_index_prev = ps->opd_index_prev;
+ } else {
+ /* take index values from previous envelope */
+ iid_index_prev = ps->iid_index[env - 1];
+ icc_index_prev = ps->icc_index[env - 1];
+ ipd_index_prev = ps->ipd_index[env - 1];
+ opd_index_prev = ps->opd_index[env - 1];
+ }
+
+// iid = 1;
+ /* delta decode iid parameters */
+ delta_decode(ps->enable_iid, ps->iid_index[env], iid_index_prev,
+ ps->iid_dt[env], ps->nr_iid_par,
+ (ps->iid_mode == 0 || ps->iid_mode == 3) ? 2 : 1,
+ -num_iid_steps, num_iid_steps);
+// iid = 0;
+
+ /* delta decode icc parameters */
+ delta_decode(ps->enable_icc, ps->icc_index[env], icc_index_prev,
+ ps->icc_dt[env], ps->nr_icc_par,
+ (ps->icc_mode == 0 || ps->icc_mode == 3) ? 2 : 1,
+ 0, 7);
+
+ /* delta modulo decode ipd parameters */
+ delta_modulo_decode(ps->enable_ipdopd, ps->ipd_index[env], ipd_index_prev,
+ ps->ipd_dt[env], ps->nr_ipdopd_par, 1, 7);
+
+ /* delta modulo decode opd parameters */
+ delta_modulo_decode(ps->enable_ipdopd, ps->opd_index[env], opd_index_prev,
+ ps->opd_dt[env], ps->nr_ipdopd_par, 1, 7);
+ }
+
+ /* handle error case */
+ if (ps->num_env == 0)
+ {
+ /* force to 1 */
+ ps->num_env = 1;
+
+ if (ps->enable_iid)
+ {
+ for (bin = 0; bin < 34; bin++)
+ ps->iid_index[0][bin] = ps->iid_index_prev[bin];
+ } else {
+ for (bin = 0; bin < 34; bin++)
+ ps->iid_index[0][bin] = 0;
+ }
+
+ if (ps->enable_icc)
+ {
+ for (bin = 0; bin < 34; bin++)
+ ps->icc_index[0][bin] = ps->icc_index_prev[bin];
+ } else {
+ for (bin = 0; bin < 34; bin++)
+ ps->icc_index[0][bin] = 0;
+ }
+
+ if (ps->enable_ipdopd)
+ {
+ for (bin = 0; bin < 17; bin++)
+ {
+ ps->ipd_index[0][bin] = ps->ipd_index_prev[bin];
+ ps->opd_index[0][bin] = ps->opd_index_prev[bin];
+ }
+ } else {
+ for (bin = 0; bin < 17; bin++)
+ {
+ ps->ipd_index[0][bin] = 0;
+ ps->opd_index[0][bin] = 0;
+ }
+ }
+ }
+
+ /* update previous indices */
+ for (bin = 0; bin < 34; bin++)
+ ps->iid_index_prev[bin] = ps->iid_index[ps->num_env-1][bin];
+ for (bin = 0; bin < 34; bin++)
+ ps->icc_index_prev[bin] = ps->icc_index[ps->num_env-1][bin];
+ for (bin = 0; bin < 17; bin++)
+ {
+ ps->ipd_index_prev[bin] = ps->ipd_index[ps->num_env-1][bin];
+ ps->opd_index_prev[bin] = ps->opd_index[ps->num_env-1][bin];
+ }
+
+ ps->ps_data_available = 0;
+
+ if (ps->frame_class == 0)
+ {
+ ps->border_position[0] = 0;
+ for (env = 1; env < ps->num_env; env++)
+ {
+ ps->border_position[env] = (env * 32 /* 30 for 960? */) / ps->num_env;
+ }
+ ps->border_position[ps->num_env] = 32 /* 30 for 960? */;
+ } else {
+ ps->border_position[0] = 0;
+
+ if (ps->border_position[ps->num_env] < 32 /* 30 for 960? */)
+ {
+ ps->num_env++;
+ ps->border_position[ps->num_env] = 32 /* 30 for 960? */;
+ for (bin = 0; bin < 34; bin++)
+ {
+ ps->iid_index[ps->num_env][bin] = ps->iid_index[ps->num_env-1][bin];
+ ps->icc_index[ps->num_env][bin] = ps->icc_index[ps->num_env-1][bin];
+ }
+ for (bin = 0; bin < 17; bin++)
+ {
+ ps->ipd_index[ps->num_env][bin] = ps->ipd_index[ps->num_env-1][bin];
+ ps->opd_index[ps->num_env][bin] = ps->opd_index[ps->num_env-1][bin];
+ }
+ }
+
+ for (env = 1; env < ps->num_env; env++)
+ {
+ int8_t thr = 32 /* 30 for 960? */ - (ps->num_env - env);
+
+ if (ps->border_position[env] > thr)
+ {
+ ps->border_position[env] = thr;
+ } else {
+ thr = ps->border_position[env-1]+1;
+ if (ps->border_position[env] < thr)
+ {
+ ps->border_position[env] = thr;
+ }
+ }
+ }
+ }
+
+ /* make sure that the indices of all parameters can be mapped
+ * to the same hybrid synthesis filterbank
+ */
+#ifdef PS_LOW_POWER
+ for (env = 0; env < ps->num_env; env++)
+ {
+ if (ps->iid_mode == 2 || ps->iid_mode == 5)
+ map34indexto20(ps->iid_index[env], 34);
+ if (ps->icc_mode == 2 || ps->icc_mode == 5)
+ map34indexto20(ps->icc_index[env], 34);
+
+ /* disable ipd/opd */
+ for (bin = 0; bin < 17; bin++)
+ {
+ ps->aaIpdIndex[env][bin] = 0;
+ ps->aaOpdIndex[env][bin] = 0;
+ }
+ }
+#else
+ if (ps->use34hybrid_bands)
+ {
+ for (env = 0; env < ps->num_env; env++)
+ {
+ if (ps->iid_mode != 2 && ps->iid_mode != 5)
+ map20indexto34(ps->iid_index[env], 34);
+ if (ps->icc_mode != 2 && ps->icc_mode != 5)
+ map20indexto34(ps->icc_index[env], 34);
+ if (ps->ipd_mode != 2 && ps->ipd_mode != 5)
+ {
+ map20indexto34(ps->ipd_index[env], 17);
+ map20indexto34(ps->opd_index[env], 17);
+ }
+ }
+ }
+#endif
+
+#if 0
+ for (env = 0; env < ps->num_env; env++)
+ {
+ printf("iid[env:%d]:", env);
+ for (bin = 0; bin < 34; bin++)
+ {
+ printf(" %d", ps->iid_index[env][bin]);
+ }
+ printf("\n");
+ }
+ for (env = 0; env < ps->num_env; env++)
+ {
+ printf("icc[env:%d]:", env);
+ for (bin = 0; bin < 34; bin++)
+ {
+ printf(" %d", ps->icc_index[env][bin]);
+ }
+ printf("\n");
+ }
+ for (env = 0; env < ps->num_env; env++)
+ {
+ printf("ipd[env:%d]:", env);
+ for (bin = 0; bin < 17; bin++)
+ {
+ printf(" %d", ps->ipd_index[env][bin]);
+ }
+ printf("\n");
+ }
+ for (env = 0; env < ps->num_env; env++)
+ {
+ printf("opd[env:%d]:", env);
+ for (bin = 0; bin < 17; bin++)
+ {
+ printf(" %d", ps->opd_index[env][bin]);
+ }
+ printf("\n");
+ }
+ printf("\n");
+#endif
+}
+
+/* decorrelate the mono signal using an allpass filter */
+static void ps_decorrelate(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64],
+ qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32])
+{
+ uint8_t gr, n, m, bk;
+ uint8_t temp_delay;
+ uint8_t sb, maxsb;
+ const complex_t *Phi_Fract_SubQmf;
+ uint8_t temp_delay_ser[NO_ALLPASS_LINKS];
+ real_t P_SmoothPeakDecayDiffNrg, nrg;
+ real_t P[32][34];
+ real_t G_TransientRatio[32][34] = {{0}};
+ complex_t inputLeft;
+
+
+ /* chose hybrid filterbank: 20 or 34 band case */
+ if (ps->use34hybrid_bands)
+ {
+ Phi_Fract_SubQmf = Phi_Fract_SubQmf34;
+ } else{
+ Phi_Fract_SubQmf = Phi_Fract_SubQmf20;
+ }
+
+ /* clear the energy values */
+ for (n = 0; n < 32; n++)
+ {
+ for (bk = 0; bk < 34; bk++)
+ {
+ P[n][bk] = 0;
+ }
+ }
+
+ /* calculate the energy in each parameter band b(k) */
+ for (gr = 0; gr < ps->num_groups; gr++)
+ {
+ /* select the parameter index b(k) to which this group belongs */
+ bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr];
+
+ /* select the upper subband border for this group */
+ maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr]+1 : ps->group_border[gr+1];
+
+ for (sb = ps->group_border[gr]; sb < maxsb; sb++)
+ {
+ for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++)
+ {
+#ifdef FIXED_POINT
+ uint32_t in_re, in_im;
+#endif
+
+ /* input from hybrid subbands or QMF subbands */
+ if (gr < ps->num_hybrid_groups)
+ {
+ RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]);
+ IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]);
+ } else {
+ RE(inputLeft) = QMF_RE(X_left[n][sb]);
+ IM(inputLeft) = QMF_IM(X_left[n][sb]);
+ }
+
+ /* accumulate energy */
+#ifdef FIXED_POINT
+ /* NOTE: all input is scaled by 2^(-5) because of fixed point QMF
+ * meaning that P will be scaled by 2^(-10) compared to floating point version
+ */
+ in_re = ((abs(RE(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS);
+ in_im = ((abs(IM(inputLeft))+(1<<(REAL_BITS-1)))>>REAL_BITS);
+ P[n][bk] += in_re*in_re + in_im*in_im;
+#else
+ P[n][bk] += MUL_R(RE(inputLeft),RE(inputLeft)) + MUL_R(IM(inputLeft),IM(inputLeft));
+#endif
+ }
+ }
+ }
+
+#if 0
+ for (n = 0; n < 32; n++)
+ {
+ for (bk = 0; bk < 34; bk++)
+ {
+#ifdef FIXED_POINT
+ printf("%d %d: %d\n", n, bk, P[n][bk] /*/(float)REAL_PRECISION*/);
+#else
+ printf("%d %d: %f\n", n, bk, P[n][bk]/1024.0);
+#endif
+ }
+ }
+#endif
+
+ /* calculate transient reduction ratio for each parameter band b(k) */
+ for (bk = 0; bk < ps->nr_par_bands; bk++)
+ {
+ for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++)
+ {
+ const real_t gamma = COEF_CONST(1.5);
+
+ ps->P_PeakDecayNrg[bk] = MUL_F(ps->P_PeakDecayNrg[bk], ps->alpha_decay);
+ if (ps->P_PeakDecayNrg[bk] < P[n][bk])
+ ps->P_PeakDecayNrg[bk] = P[n][bk];
+
+ /* apply smoothing filter to peak decay energy */
+ P_SmoothPeakDecayDiffNrg = ps->P_SmoothPeakDecayDiffNrg_prev[bk];
+ P_SmoothPeakDecayDiffNrg += MUL_F((ps->P_PeakDecayNrg[bk] - P[n][bk] - ps->P_SmoothPeakDecayDiffNrg_prev[bk]), ps->alpha_smooth);
+ ps->P_SmoothPeakDecayDiffNrg_prev[bk] = P_SmoothPeakDecayDiffNrg;
+
+ /* apply smoothing filter to energy */
+ nrg = ps->P_prev[bk];
+ nrg += MUL_F((P[n][bk] - ps->P_prev[bk]), ps->alpha_smooth);
+ ps->P_prev[bk] = nrg;
+
+ /* calculate transient ratio */
+ if (MUL_C(P_SmoothPeakDecayDiffNrg, gamma) <= nrg)
+ {
+ G_TransientRatio[n][bk] = REAL_CONST(1.0);
+ } else {
+ G_TransientRatio[n][bk] = DIV_R(nrg, (MUL_C(P_SmoothPeakDecayDiffNrg, gamma)));
+ }
+ }
+ }
+
+#if 0
+ for (n = 0; n < 32; n++)
+ {
+ for (bk = 0; bk < 34; bk++)
+ {
+#ifdef FIXED_POINT
+ printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]/(float)REAL_PRECISION);
+#else
+ printf("%d %d: %f\n", n, bk, G_TransientRatio[n][bk]);
+#endif
+ }
+ }
+#endif
+
+ /* apply stereo decorrelation filter to the signal */
+ for (gr = 0; gr < ps->num_groups; gr++)
+ {
+ if (gr < ps->num_hybrid_groups)
+ maxsb = ps->group_border[gr] + 1;
+ else
+ maxsb = ps->group_border[gr + 1];
+
+ /* QMF channel */
+ for (sb = ps->group_border[gr]; sb < maxsb; sb++)
+ {
+ real_t g_DecaySlope;
+ real_t g_DecaySlope_filt[NO_ALLPASS_LINKS];
+
+ /* g_DecaySlope: [0..1] */
+ if (gr < ps->num_hybrid_groups || sb <= ps->decay_cutoff)
+ {
+ g_DecaySlope = FRAC_CONST(1.0);
+ } else {
+ int8_t decay = ps->decay_cutoff - sb;
+ if (decay <= -20 /* -1/DECAY_SLOPE */)
+ {
+ g_DecaySlope = 0;
+ } else {
+ /* decay(int)*decay_slope(frac) = g_DecaySlope(frac) */
+ g_DecaySlope = FRAC_CONST(1.0) + DECAY_SLOPE * decay;
+ }
+ }
+
+ /* calculate g_DecaySlope_filt for every m multiplied by filter_a[m] */
+ for (m = 0; m < NO_ALLPASS_LINKS; m++)
+ {
+ g_DecaySlope_filt[m] = MUL_F(g_DecaySlope, filter_a[m]);
+ }
+
+
+ /* set delay indices */
+ temp_delay = ps->saved_delay;
+ for (n = 0; n < NO_ALLPASS_LINKS; n++)
+ temp_delay_ser[n] = ps->delay_buf_index_ser[n];
+
+ for (n = ps->border_position[0]; n < ps->border_position[ps->num_env]; n++)
+ {
+ complex_t tmp, tmp0, R0;
+
+ if (gr < ps->num_hybrid_groups)
+ {
+ /* hybrid filterbank input */
+ RE(inputLeft) = QMF_RE(X_hybrid_left[n][sb]);
+ IM(inputLeft) = QMF_IM(X_hybrid_left[n][sb]);
+ } else {
+ /* QMF filterbank input */
+ RE(inputLeft) = QMF_RE(X_left[n][sb]);
+ IM(inputLeft) = QMF_IM(X_left[n][sb]);
+ }
+
+ if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups)
+ {
+ /* delay */
+
+ /* never hybrid subbands here, always QMF subbands */
+ RE(tmp) = RE(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]);
+ IM(tmp) = IM(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]);
+ RE(R0) = RE(tmp);
+ IM(R0) = IM(tmp);
+ RE(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = RE(inputLeft);
+ IM(ps->delay_Qmf[ps->delay_buf_index_delay[sb]][sb]) = IM(inputLeft);
+ } else {
+ /* allpass filter */
+ uint8_t m;
+ complex_t Phi_Fract;
+
+ /* fetch parameters */
+ if (gr < ps->num_hybrid_groups)
+ {
+ /* select data from the hybrid subbands */
+ RE(tmp0) = RE(ps->delay_SubQmf[temp_delay][sb]);
+ IM(tmp0) = IM(ps->delay_SubQmf[temp_delay][sb]);
+
+ RE(ps->delay_SubQmf[temp_delay][sb]) = RE(inputLeft);
+ IM(ps->delay_SubQmf[temp_delay][sb]) = IM(inputLeft);
+
+ RE(Phi_Fract) = RE(Phi_Fract_SubQmf[sb]);
+ IM(Phi_Fract) = IM(Phi_Fract_SubQmf[sb]);
+ } else {
+ /* select data from the QMF subbands */
+ RE(tmp0) = RE(ps->delay_Qmf[temp_delay][sb]);
+ IM(tmp0) = IM(ps->delay_Qmf[temp_delay][sb]);
+
+ RE(ps->delay_Qmf[temp_delay][sb]) = RE(inputLeft);
+ IM(ps->delay_Qmf[temp_delay][sb]) = IM(inputLeft);
+
+ RE(Phi_Fract) = RE(Phi_Fract_Qmf[sb]);
+ IM(Phi_Fract) = IM(Phi_Fract_Qmf[sb]);
+ }
+
+ /* z^(-2) * Phi_Fract[k] */
+ ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract));
+
+ RE(R0) = RE(tmp);
+ IM(R0) = IM(tmp);
+ for (m = 0; m < NO_ALLPASS_LINKS; m++)
+ {
+ complex_t Q_Fract_allpass, tmp2;
+
+ /* fetch parameters */
+ if (gr < ps->num_hybrid_groups)
+ {
+ /* select data from the hybrid subbands */
+ RE(tmp0) = RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]);
+ IM(tmp0) = IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]);
+
+ if (ps->use34hybrid_bands)
+ {
+ RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf34[sb][m]);
+ IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf34[sb][m]);
+ } else {
+ RE(Q_Fract_allpass) = RE(Q_Fract_allpass_SubQmf20[sb][m]);
+ IM(Q_Fract_allpass) = IM(Q_Fract_allpass_SubQmf20[sb][m]);
+ }
+ } else {
+ /* select data from the QMF subbands */
+ RE(tmp0) = RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]);
+ IM(tmp0) = IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]);
+
+ RE(Q_Fract_allpass) = RE(Q_Fract_allpass_Qmf[sb][m]);
+ IM(Q_Fract_allpass) = IM(Q_Fract_allpass_Qmf[sb][m]);
+ }
+
+ /* delay by a fraction */
+ /* z^(-d(m)) * Q_Fract_allpass[k,m] */
+ ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Q_Fract_allpass), IM(Q_Fract_allpass));
+
+ /* -a(m) * g_DecaySlope[k] */
+ RE(tmp) += -MUL_F(g_DecaySlope_filt[m], RE(R0));
+ IM(tmp) += -MUL_F(g_DecaySlope_filt[m], IM(R0));
+
+ /* -a(m) * g_DecaySlope[k] * Q_Fract_allpass[k,m] * z^(-d(m)) */
+ RE(tmp2) = RE(R0) + MUL_F(g_DecaySlope_filt[m], RE(tmp));
+ IM(tmp2) = IM(R0) + MUL_F(g_DecaySlope_filt[m], IM(tmp));
+
+ /* store sample */
+ if (gr < ps->num_hybrid_groups)
+ {
+ RE(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2);
+ IM(ps->delay_SubQmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2);
+ } else {
+ RE(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = RE(tmp2);
+ IM(ps->delay_Qmf_ser[m][temp_delay_ser[m]][sb]) = IM(tmp2);
+ }
+
+ /* store for next iteration (or as output value if last iteration) */
+ RE(R0) = RE(tmp);
+ IM(R0) = IM(tmp);
+ }
+ }
+
+ /* select b(k) for reading the transient ratio */
+ bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr];
+
+ /* duck if a past transient is found */
+ RE(R0) = MUL_R(G_TransientRatio[n][bk], RE(R0));
+ IM(R0) = MUL_R(G_TransientRatio[n][bk], IM(R0));
+
+ if (gr < ps->num_hybrid_groups)
+ {
+ /* hybrid */
+ QMF_RE(X_hybrid_right[n][sb]) = RE(R0);
+ QMF_IM(X_hybrid_right[n][sb]) = IM(R0);
+ } else {
+ /* QMF */
+ QMF_RE(X_right[n][sb]) = RE(R0);
+ QMF_IM(X_right[n][sb]) = IM(R0);
+ }
+
+ /* Update delay buffer index */
+ if (++temp_delay >= 2)
+ {
+ temp_delay = 0;
+ }
+
+ /* update delay indices */
+ if (sb > ps->nr_allpass_bands && gr >= ps->num_hybrid_groups)
+ {
+ /* delay_D depends on the samplerate, it can hold the values 14 and 1 */
+ if (++ps->delay_buf_index_delay[sb] >= ps->delay_D[sb])
+ {
+ ps->delay_buf_index_delay[sb] = 0;
+ }
+ }
+
+ for (m = 0; m < NO_ALLPASS_LINKS; m++)
+ {
+ if (++temp_delay_ser[m] >= ps->num_sample_delay_ser[m])
+ {
+ temp_delay_ser[m] = 0;
+ }
+ }
+ }
+ }
+ }
+
+ /* update delay indices */
+ ps->saved_delay = temp_delay;
+ for (m = 0; m < NO_ALLPASS_LINKS; m++)
+ ps->delay_buf_index_ser[m] = temp_delay_ser[m];
+}
+
+#ifdef FIXED_POINT
+#define step(shift) \
+ if ((0x40000000l >> shift) + root <= value) \
+ { \
+ value -= (0x40000000l >> shift) + root; \
+ root = (root >> 1) | (0x40000000l >> shift); \
+ } else { \
+ root = root >> 1; \
+ }
+
+/* fixed point square root approximation */
+static real_t ps_sqrt(real_t value)
+{
+ real_t root = 0;
+
+ step( 0); step( 2); step( 4); step( 6);
+ step( 8); step(10); step(12); step(14);
+ step(16); step(18); step(20); step(22);
+ step(24); step(26); step(28); step(30);
+
+ if (root < value)
+ ++root;
+
+ root <<= (REAL_BITS/2);
+
+ return root;
+}
+#else
+#define ps_sqrt(A) sqrt(A)
+#endif
+
+static const real_t ipdopd_cos_tab[] = {
+ FRAC_CONST(1.000000000000000),
+ FRAC_CONST(0.707106781186548),
+ FRAC_CONST(0.000000000000000),
+ FRAC_CONST(-0.707106781186547),
+ FRAC_CONST(-1.000000000000000),
+ FRAC_CONST(-0.707106781186548),
+ FRAC_CONST(-0.000000000000000),
+ FRAC_CONST(0.707106781186547),
+ FRAC_CONST(1.000000000000000)
+};
+
+static const real_t ipdopd_sin_tab[] = {
+ FRAC_CONST(0.000000000000000),
+ FRAC_CONST(0.707106781186547),
+ FRAC_CONST(1.000000000000000),
+ FRAC_CONST(0.707106781186548),
+ FRAC_CONST(0.000000000000000),
+ FRAC_CONST(-0.707106781186547),
+ FRAC_CONST(-1.000000000000000),
+ FRAC_CONST(-0.707106781186548),
+ FRAC_CONST(-0.000000000000000)
+};
+
+static real_t magnitude_c(complex_t c)
+{
+#ifdef FIXED_POINT
+#define ps_abs(A) (((A) > 0) ? (A) : (-(A)))
+#define ALPHA FRAC_CONST(0.948059448969)
+#define BETA FRAC_CONST(0.392699081699)
+
+ real_t abs_inphase = ps_abs(RE(c));
+ real_t abs_quadrature = ps_abs(IM(c));
+
+ if (abs_inphase > abs_quadrature) {
+ return MUL_F(abs_inphase, ALPHA) + MUL_F(abs_quadrature, BETA);
+ } else {
+ return MUL_F(abs_quadrature, ALPHA) + MUL_F(abs_inphase, BETA);
+ }
+#else
+ return sqrt(RE(c)*RE(c) + IM(c)*IM(c));
+#endif
+}
+
+static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64],
+ qmf_t X_hybrid_left[32][32], qmf_t X_hybrid_right[32][32])
+{
+ uint8_t n;
+ uint8_t gr;
+ uint8_t bk = 0;
+ uint8_t sb, maxsb;
+ uint8_t env;
+ uint8_t nr_ipdopd_par;
+ complex_t h11, h12, h21, h22;
+ complex_t H11, H12, H21, H22;
+ complex_t deltaH11, deltaH12, deltaH21, deltaH22;
+ complex_t tempLeft;
+ complex_t tempRight;
+ complex_t phaseLeft;
+ complex_t phaseRight;
+ real_t L;
+ const real_t *sf_iid;
+ uint8_t no_iid_steps;
+
+ if (ps->iid_mode >= 3)
+ {
+ no_iid_steps = 15;
+ sf_iid = sf_iid_fine;
+ } else {
+ no_iid_steps = 7;
+ sf_iid = sf_iid_normal;
+ }
+
+ if (ps->ipd_mode == 0 || ps->ipd_mode == 3)
+ {
+ nr_ipdopd_par = 11; /* resolution */
+ } else {
+ nr_ipdopd_par = ps->nr_ipdopd_par;
+ }
+
+ for (gr = 0; gr < ps->num_groups; gr++)
+ {
+ bk = (~NEGATE_IPD_MASK) & ps->map_group2bk[gr];
+
+ /* use one channel per group in the subqmf domain */
+ maxsb = (gr < ps->num_hybrid_groups) ? ps->group_border[gr] + 1 : ps->group_border[gr + 1];
+
+ for (env = 0; env < ps->num_env; env++)
+ {
+ if (ps->icc_mode < 3)
+ {
+ /* type 'A' mixing as described in 8.6.4.6.2.1 */
+ real_t c_1, c_2;
+ real_t cosa, sina;
+ real_t cosb, sinb;
+ real_t ab1, ab2;
+ real_t ab3, ab4;
+
+ /*
+ c_1 = sqrt(2.0 / (1.0 + pow(10.0, quant_iid[no_iid_steps + iid_index] / 10.0)));
+ c_2 = sqrt(2.0 / (1.0 + pow(10.0, quant_iid[no_iid_steps - iid_index] / 10.0)));
+ alpha = 0.5 * acos(quant_rho[icc_index]);
+ beta = alpha * ( c_1 - c_2 ) / sqrt(2.0);
+ */
+
+ //printf("%d\n", ps->iid_index[env][bk]);
+
+ /* calculate the scalefactors c_1 and c_2 from the intensity differences */
+ c_1 = sf_iid[no_iid_steps + ps->iid_index[env][bk]];
+ c_2 = sf_iid[no_iid_steps - ps->iid_index[env][bk]];
+
+ /* calculate alpha and beta using the ICC parameters */
+ cosa = cos_alphas[ps->icc_index[env][bk]];
+ sina = sin_alphas[ps->icc_index[env][bk]];
+
+ if (ps->iid_mode >= 3)
+ {
+ if (ps->iid_index[env][bk] < 0)
+ {
+ cosb = cos_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ sinb = -sin_betas_fine[-ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ } else {
+ cosb = cos_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ sinb = sin_betas_fine[ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ }
+ } else {
+ if (ps->iid_index[env][bk] < 0)
+ {
+ cosb = cos_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ sinb = -sin_betas_normal[-ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ } else {
+ cosb = cos_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ sinb = sin_betas_normal[ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ }
+ }
+
+ ab1 = MUL_C(cosb, cosa);
+ ab2 = MUL_C(sinb, sina);
+ ab3 = MUL_C(sinb, cosa);
+ ab4 = MUL_C(cosb, sina);
+
+ /* h_xy: COEF */
+ RE(h11) = MUL_C(c_2, (ab1 - ab2));
+ RE(h12) = MUL_C(c_1, (ab1 + ab2));
+ RE(h21) = MUL_C(c_2, (ab3 + ab4));
+ RE(h22) = MUL_C(c_1, (ab3 - ab4));
+ } else {
+ /* type 'B' mixing as described in 8.6.4.6.2.2 */
+ real_t sina, cosa;
+ real_t cosg, sing;
+
+ /*
+ real_t c, rho, mu, alpha, gamma;
+ uint8_t i;
+
+ i = ps->iid_index[env][bk];
+ c = (real_t)pow(10.0, ((i)?(((i>0)?1:-1)*quant_iid[((i>0)?i:-i)-1]):0.)/20.0);
+ rho = quant_rho[ps->icc_index[env][bk]];
+
+ if (rho == 0.0f && c == 1.)
+ {
+ alpha = (real_t)M_PI/4.0f;
+ rho = 0.05f;
+ } else {
+ if (rho <= 0.05f)
+ {
+ rho = 0.05f;
+ }
+ alpha = 0.5f*(real_t)atan( (2.0f*c*rho) / (c*c-1.0f) );
+
+ if (alpha < 0.)
+ {
+ alpha += (real_t)M_PI/2.0f;
+ }
+ if (rho < 0.)
+ {
+ alpha += (real_t)M_PI;
+ }
+ }
+ mu = c+1.0f/c;
+ mu = 1+(4.0f*rho*rho-4.0f)/(mu*mu);
+ gamma = (real_t)atan(sqrt((1.0f-sqrt(mu))/(1.0f+sqrt(mu))));
+ */
+
+ if (ps->iid_mode >= 3)
+ {
+ uint8_t abs_iid = abs(ps->iid_index[env][bk]);
+
+ cosa = sincos_alphas_B_fine[no_iid_steps + ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ sina = sincos_alphas_B_fine[30 - (no_iid_steps + ps->iid_index[env][bk])][ps->icc_index[env][bk]];
+ cosg = cos_gammas_fine[abs_iid][ps->icc_index[env][bk]];
+ sing = sin_gammas_fine[abs_iid][ps->icc_index[env][bk]];
+ } else {
+ uint8_t abs_iid = abs(ps->iid_index[env][bk]);
+
+ cosa = sincos_alphas_B_normal[no_iid_steps + ps->iid_index[env][bk]][ps->icc_index[env][bk]];
+ sina = sincos_alphas_B_normal[14 - (no_iid_steps + ps->iid_index[env][bk])][ps->icc_index[env][bk]];
+ cosg = cos_gammas_normal[abs_iid][ps->icc_index[env][bk]];
+ sing = sin_gammas_normal[abs_iid][ps->icc_index[env][bk]];
+ }
+
+ RE(h11) = MUL_C(COEF_SQRT2, MUL_C(cosa, cosg));
+ RE(h12) = MUL_C(COEF_SQRT2, MUL_C(sina, cosg));
+ RE(h21) = MUL_C(COEF_SQRT2, MUL_C(-cosa, sing));
+ RE(h22) = MUL_C(COEF_SQRT2, MUL_C(sina, sing));
+ }
+
+ /* calculate phase rotation parameters H_xy */
+ /* note that the imaginary part of these parameters are only calculated when
+ IPD and OPD are enabled
+ */
+ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
+ {
+ int8_t i;
+ real_t xy, pq, xypq;
+
+ /* ringbuffer index */
+ i = ps->phase_hist;
+
+ /* previous value */
+#ifdef FIXED_POINT
+ /* divide by 4, shift right 2 bits */
+ RE(tempLeft) = RE(ps->ipd_prev[bk][i]) >> 2;
+ IM(tempLeft) = IM(ps->ipd_prev[bk][i]) >> 2;
+ RE(tempRight) = RE(ps->opd_prev[bk][i]) >> 2;
+ IM(tempRight) = IM(ps->opd_prev[bk][i]) >> 2;
+#else
+ RE(tempLeft) = MUL_F(RE(ps->ipd_prev[bk][i]), FRAC_CONST(0.25));
+ IM(tempLeft) = MUL_F(IM(ps->ipd_prev[bk][i]), FRAC_CONST(0.25));
+ RE(tempRight) = MUL_F(RE(ps->opd_prev[bk][i]), FRAC_CONST(0.25));
+ IM(tempRight) = MUL_F(IM(ps->opd_prev[bk][i]), FRAC_CONST(0.25));
+#endif
+
+ /* save current value */
+ RE(ps->ipd_prev[bk][i]) = ipdopd_cos_tab[abs(ps->ipd_index[env][bk])];
+ IM(ps->ipd_prev[bk][i]) = ipdopd_sin_tab[abs(ps->ipd_index[env][bk])];
+ RE(ps->opd_prev[bk][i]) = ipdopd_cos_tab[abs(ps->opd_index[env][bk])];
+ IM(ps->opd_prev[bk][i]) = ipdopd_sin_tab[abs(ps->opd_index[env][bk])];
+
+ /* add current value */
+ RE(tempLeft) += RE(ps->ipd_prev[bk][i]);
+ IM(tempLeft) += IM(ps->ipd_prev[bk][i]);
+ RE(tempRight) += RE(ps->opd_prev[bk][i]);
+ IM(tempRight) += IM(ps->opd_prev[bk][i]);
+
+ /* ringbuffer index */
+ if (i == 0)
+ {
+ i = 2;
+ }
+ i--;
+
+ /* get value before previous */
+#ifdef FIXED_POINT
+ /* dividing by 2, shift right 1 bit */
+ RE(tempLeft) += (RE(ps->ipd_prev[bk][i]) >> 1);
+ IM(tempLeft) += (IM(ps->ipd_prev[bk][i]) >> 1);
+ RE(tempRight) += (RE(ps->opd_prev[bk][i]) >> 1);
+ IM(tempRight) += (IM(ps->opd_prev[bk][i]) >> 1);
+#else
+ RE(tempLeft) += MUL_F(RE(ps->ipd_prev[bk][i]), FRAC_CONST(0.5));
+ IM(tempLeft) += MUL_F(IM(ps->ipd_prev[bk][i]), FRAC_CONST(0.5));
+ RE(tempRight) += MUL_F(RE(ps->opd_prev[bk][i]), FRAC_CONST(0.5));
+ IM(tempRight) += MUL_F(IM(ps->opd_prev[bk][i]), FRAC_CONST(0.5));
+#endif
+
+#if 0 /* original code */
+ ipd = (float)atan2(IM(tempLeft), RE(tempLeft));
+ opd = (float)atan2(IM(tempRight), RE(tempRight));
+
+ /* phase rotation */
+ RE(phaseLeft) = (float)cos(opd);
+ IM(phaseLeft) = (float)sin(opd);
+ opd -= ipd;
+ RE(phaseRight) = (float)cos(opd);
+ IM(phaseRight) = (float)sin(opd);
+#else
+
+ // x = IM(tempLeft)
+ // y = RE(tempLeft)
+ // p = IM(tempRight)
+ // q = RE(tempRight)
+ // cos(atan2(x,y)) = y/sqrt((x*x) + (y*y))
+ // sin(atan2(x,y)) = x/sqrt((x*x) + (y*y))
+ // cos(atan2(x,y)-atan2(p,q)) = (y*q + x*p) / ( sqrt((x*x) + (y*y)) * sqrt((p*p) + (q*q)) );
+ // sin(atan2(x,y)-atan2(p,q)) = (x*q - y*p) / ( sqrt((x*x) + (y*y)) * sqrt((p*p) + (q*q)) );
+
+ xy = magnitude_c(tempRight);
+ pq = magnitude_c(tempLeft);
+
+ if (xy != 0)
+ {
+ RE(phaseLeft) = DIV_R(RE(tempRight), xy);
+ IM(phaseLeft) = DIV_R(IM(tempRight), xy);
+ } else {
+ RE(phaseLeft) = 0;
+ IM(phaseLeft) = 0;
+ }
+
+ xypq = MUL_R(xy, pq);
+
+ if (xypq != 0)
+ {
+ real_t tmp1 = MUL_R(RE(tempRight), RE(tempLeft)) + MUL_R(IM(tempRight), IM(tempLeft));
+ real_t tmp2 = MUL_R(IM(tempRight), RE(tempLeft)) - MUL_R(RE(tempRight), IM(tempLeft));
+
+ RE(phaseRight) = DIV_R(tmp1, xypq);
+ IM(phaseRight) = DIV_R(tmp2, xypq);
+ } else {
+ RE(phaseRight) = 0;
+ IM(phaseRight) = 0;
+ }
+
+#endif
+
+ /* MUL_F(COEF, REAL) = COEF */
+ IM(h11) = MUL_R(RE(h11), IM(phaseLeft));
+ IM(h12) = MUL_R(RE(h12), IM(phaseRight));
+ IM(h21) = MUL_R(RE(h21), IM(phaseLeft));
+ IM(h22) = MUL_R(RE(h22), IM(phaseRight));
+
+ RE(h11) = MUL_R(RE(h11), RE(phaseLeft));
+ RE(h12) = MUL_R(RE(h12), RE(phaseRight));
+ RE(h21) = MUL_R(RE(h21), RE(phaseLeft));
+ RE(h22) = MUL_R(RE(h22), RE(phaseRight));
+ }
+
+ /* length of the envelope n_e+1 - n_e (in time samples) */
+ /* 0 < L <= 32: integer */
+ L = (real_t)(ps->border_position[env + 1] - ps->border_position[env]);
+
+ /* obtain final H_xy by means of linear interpolation */
+ RE(deltaH11) = (RE(h11) - RE(ps->h11_prev[gr])) / L;
+ RE(deltaH12) = (RE(h12) - RE(ps->h12_prev[gr])) / L;
+ RE(deltaH21) = (RE(h21) - RE(ps->h21_prev[gr])) / L;
+ RE(deltaH22) = (RE(h22) - RE(ps->h22_prev[gr])) / L;
+
+ RE(H11) = RE(ps->h11_prev[gr]);
+ RE(H12) = RE(ps->h12_prev[gr]);
+ RE(H21) = RE(ps->h21_prev[gr]);
+ RE(H22) = RE(ps->h22_prev[gr]);
+
+ RE(ps->h11_prev[gr]) = RE(h11);
+ RE(ps->h12_prev[gr]) = RE(h12);
+ RE(ps->h21_prev[gr]) = RE(h21);
+ RE(ps->h22_prev[gr]) = RE(h22);
+
+ /* only calculate imaginary part when needed */
+ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
+ {
+ /* obtain final H_xy by means of linear interpolation */
+ IM(deltaH11) = (IM(h11) - IM(ps->h11_prev[gr])) / L;
+ IM(deltaH12) = (IM(h12) - IM(ps->h12_prev[gr])) / L;
+ IM(deltaH21) = (IM(h21) - IM(ps->h21_prev[gr])) / L;
+ IM(deltaH22) = (IM(h22) - IM(ps->h22_prev[gr])) / L;
+
+ IM(H11) = IM(ps->h11_prev[gr]);
+ IM(H12) = IM(ps->h12_prev[gr]);
+ IM(H21) = IM(ps->h21_prev[gr]);
+ IM(H22) = IM(ps->h22_prev[gr]);
+
+ if ((NEGATE_IPD_MASK & ps->map_group2bk[gr]) != 0)
+ {
+ IM(deltaH11) = -IM(deltaH11);
+ IM(deltaH12) = -IM(deltaH12);
+ IM(deltaH21) = -IM(deltaH21);
+ IM(deltaH22) = -IM(deltaH22);
+
+ IM(H11) = -IM(H11);
+ IM(H12) = -IM(H12);
+ IM(H21) = -IM(H21);
+ IM(H22) = -IM(H22);
+ }
+
+ IM(ps->h11_prev[gr]) = IM(h11);
+ IM(ps->h12_prev[gr]) = IM(h12);
+ IM(ps->h21_prev[gr]) = IM(h21);
+ IM(ps->h22_prev[gr]) = IM(h22);
+ }
+
+ /* apply H_xy to the current envelope band of the decorrelated subband */
+ for (n = ps->border_position[env]; n < ps->border_position[env + 1]; n++)
+ {
+ /* addition finalises the interpolation over every n */
+ RE(H11) += RE(deltaH11);
+ RE(H12) += RE(deltaH12);
+ RE(H21) += RE(deltaH21);
+ RE(H22) += RE(deltaH22);
+ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
+ {
+ IM(H11) += IM(deltaH11);
+ IM(H12) += IM(deltaH12);
+ IM(H21) += IM(deltaH21);
+ IM(H22) += IM(deltaH22);
+ }
+
+ /* channel is an alias to the subband */
+ for (sb = ps->group_border[gr]; sb < maxsb; sb++)
+ {
+ complex_t inLeft, inRight;
+
+ /* load decorrelated samples */
+ if (gr < ps->num_hybrid_groups)
+ {
+ RE(inLeft) = RE(X_hybrid_left[n][sb]);
+ IM(inLeft) = IM(X_hybrid_left[n][sb]);
+ RE(inRight) = RE(X_hybrid_right[n][sb]);
+ IM(inRight) = IM(X_hybrid_right[n][sb]);
+ } else {
+ RE(inLeft) = RE(X_left[n][sb]);
+ IM(inLeft) = IM(X_left[n][sb]);
+ RE(inRight) = RE(X_right[n][sb]);
+ IM(inRight) = IM(X_right[n][sb]);
+ }
+
+ /* apply mixing */
+ RE(tempLeft) = MUL_C(RE(H11), RE(inLeft)) + MUL_C(RE(H21), RE(inRight));
+ IM(tempLeft) = MUL_C(RE(H11), IM(inLeft)) + MUL_C(RE(H21), IM(inRight));
+ RE(tempRight) = MUL_C(RE(H12), RE(inLeft)) + MUL_C(RE(H22), RE(inRight));
+ IM(tempRight) = MUL_C(RE(H12), IM(inLeft)) + MUL_C(RE(H22), IM(inRight));
+
+ /* only perform imaginary operations when needed */
+ if ((ps->enable_ipdopd) && (bk < nr_ipdopd_par))
+ {
+ /* apply rotation */
+ RE(tempLeft) -= MUL_C(IM(H11), IM(inLeft)) + MUL_C(IM(H21), IM(inRight));
+ IM(tempLeft) += MUL_C(IM(H11), RE(inLeft)) + MUL_C(IM(H21), RE(inRight));
+ RE(tempRight) -= MUL_C(IM(H12), IM(inLeft)) + MUL_C(IM(H22), IM(inRight));
+ IM(tempRight) += MUL_C(IM(H12), RE(inLeft)) + MUL_C(IM(H22), RE(inRight));
+ }
+
+ /* store final samples */
+ if (gr < ps->num_hybrid_groups)
+ {
+ RE(X_hybrid_left[n][sb]) = RE(tempLeft);
+ IM(X_hybrid_left[n][sb]) = IM(tempLeft);
+ RE(X_hybrid_right[n][sb]) = RE(tempRight);
+ IM(X_hybrid_right[n][sb]) = IM(tempRight);
+ } else {
+ RE(X_left[n][sb]) = RE(tempLeft);
+ IM(X_left[n][sb]) = IM(tempLeft);
+ RE(X_right[n][sb]) = RE(tempRight);
+ IM(X_right[n][sb]) = IM(tempRight);
+ }
+ }
+ }
+
+ /* shift phase smoother's circular buffer index */
+ ps->phase_hist++;
+ if (ps->phase_hist == 2)
+ {
+ ps->phase_hist = 0;
+ }
+ }
+ }
+}
+
+void ps_free(ps_info *ps)
+{
+ /* free hybrid filterbank structures */
+ hybrid_free(ps->hyb);
+
+ faad_free(ps);
+}
+
+ps_info *ps_init(uint8_t sr_index)
+{
+ uint8_t i;
+ uint8_t short_delay_band;
+
+ ps_info *ps = (ps_info*)faad_malloc(sizeof(ps_info));
+ memset(ps, 0, sizeof(ps_info));
+
+ ps->hyb = hybrid_init();
+
+ ps->ps_data_available = 0;
+
+ /* delay stuff*/
+ ps->saved_delay = 0;
+
+ for (i = 0; i < 64; i++)
+ {
+ ps->delay_buf_index_delay[i] = 0;
+ }
+
+ for (i = 0; i < NO_ALLPASS_LINKS; i++)
+ {
+ ps->delay_buf_index_ser[i] = 0;
+#ifdef PARAM_32KHZ
+ if (sr_index <= 5) /* >= 32 kHz*/
+ {
+ ps->num_sample_delay_ser[i] = delay_length_d[1][i];
+ } else {
+ ps->num_sample_delay_ser[i] = delay_length_d[0][i];
+ }
+#else
+ /* THESE ARE CONSTANTS NOW */
+ ps->num_sample_delay_ser[i] = delay_length_d[i];
+#endif
+ }
+
+#ifdef PARAM_32KHZ
+ if (sr_index <= 5) /* >= 32 kHz*/
+ {
+ short_delay_band = 35;
+ ps->nr_allpass_bands = 22;
+ ps->alpha_decay = FRAC_CONST(0.76592833836465);
+ ps->alpha_smooth = FRAC_CONST(0.25);
+ } else {
+ short_delay_band = 64;
+ ps->nr_allpass_bands = 45;
+ ps->alpha_decay = FRAC_CONST(0.58664621951003);
+ ps->alpha_smooth = FRAC_CONST(0.6);
+ }
+#else
+ /* THESE ARE CONSTANTS NOW */
+ short_delay_band = 35;
+ ps->nr_allpass_bands = 22;
+ ps->alpha_decay = FRAC_CONST(0.76592833836465);
+ ps->alpha_smooth = FRAC_CONST(0.25);
+#endif
+
+ /* THESE ARE CONSTANT NOW IF PS IS INDEPENDANT OF SAMPLERATE */
+ for (i = 0; i < short_delay_band; i++)
+ {
+ ps->delay_D[i] = 14;
+ }
+ for (i = short_delay_band; i < 64; i++)
+ {
+ ps->delay_D[i] = 1;
+ }
+
+ /* mixing and phase */
+ for (i = 0; i < 50; i++)
+ {
+ RE(ps->h11_prev[i]) = 1;
+ IM(ps->h12_prev[i]) = 1;
+ RE(ps->h11_prev[i]) = 1;
+ IM(ps->h12_prev[i]) = 1;
+ }
+
+ ps->phase_hist = 0;
+
+ for (i = 0; i < 20; i++)
+ {
+ RE(ps->ipd_prev[i][0]) = 0;
+ IM(ps->ipd_prev[i][0]) = 0;
+ RE(ps->ipd_prev[i][1]) = 0;
+ IM(ps->ipd_prev[i][1]) = 0;
+ RE(ps->opd_prev[i][0]) = 0;
+ IM(ps->opd_prev[i][0]) = 0;
+ RE(ps->opd_prev[i][1]) = 0;
+ IM(ps->opd_prev[i][1]) = 0;
+ }
+
+ return ps;
+}
+
+/* main Parametric Stereo decoding function */
+uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
+{
+ qmf_t X_hybrid_left[32][32] = {{0}};
+ qmf_t X_hybrid_right[32][32] = {{0}};
+
+ /* delta decoding of the bitstream data */
+ ps_data_decode(ps);
+
+ /* set up some parameters depending on filterbank type */
+ if (ps->use34hybrid_bands)
+ {
+ ps->group_border = (uint8_t*)group_border34;
+ ps->map_group2bk = (uint16_t*)map_group2bk34;
+ ps->num_groups = 32+18;
+ ps->num_hybrid_groups = 32;
+ ps->nr_par_bands = 34;
+ ps->decay_cutoff = 5;
+ } else {
+ ps->group_border = (uint8_t*)group_border20;
+ ps->map_group2bk = (uint16_t*)map_group2bk20;
+ ps->num_groups = 10+12;
+ ps->num_hybrid_groups = 10;
+ ps->nr_par_bands = 20;
+ ps->decay_cutoff = 3;
+ }
+
+ /* Perform further analysis on the lowest subbands to get a higher
+ * frequency resolution
+ */
+ hybrid_analysis((hyb_info*)ps->hyb, X_left, X_hybrid_left,
+ ps->use34hybrid_bands);
+
+ /* decorrelate mono signal */
+ ps_decorrelate(ps, X_left, X_right, X_hybrid_left, X_hybrid_right);
+
+ /* apply mixing and phase parameters */
+ ps_mix_phase(ps, X_left, X_right, X_hybrid_left, X_hybrid_right);
+
+ /* hybrid synthesis, to rebuild the SBR QMF matrices */
+ hybrid_synthesis((hyb_info*)ps->hyb, X_left, X_hybrid_left,
+ ps->use34hybrid_bands);
+
+ hybrid_synthesis((hyb_info*)ps->hyb, X_right, X_hybrid_right,
+ ps->use34hybrid_bands);
+
+ return 0;
+}
+
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.h b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.h
new file mode 100644
index 000000000..f9f9e76d0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_dec.h
@@ -0,0 +1,153 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ps_dec.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __PS_DEC_H__
+#define __PS_DEC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "bits.h"
+
+#define EXTENSION_ID_PS 2
+
+#define MAX_PS_ENVELOPES 5
+#define NO_ALLPASS_LINKS 3
+
+typedef struct
+{
+ /* bitstream parameters */
+ uint8_t enable_iid;
+ uint8_t enable_icc;
+ uint8_t enable_ext;
+
+ uint8_t iid_mode;
+ uint8_t icc_mode;
+ uint8_t nr_iid_par;
+ uint8_t nr_ipdopd_par;
+ uint8_t nr_icc_par;
+
+ uint8_t frame_class;
+ uint8_t num_env;
+
+ uint8_t border_position[MAX_PS_ENVELOPES+1];
+
+ uint8_t iid_dt[MAX_PS_ENVELOPES];
+ uint8_t icc_dt[MAX_PS_ENVELOPES];
+
+ uint8_t enable_ipdopd;
+ uint8_t ipd_mode;
+ uint8_t ipd_dt[MAX_PS_ENVELOPES];
+ uint8_t opd_dt[MAX_PS_ENVELOPES];
+
+ /* indices */
+ int8_t iid_index_prev[34];
+ int8_t icc_index_prev[34];
+ int8_t ipd_index_prev[17];
+ int8_t opd_index_prev[17];
+ int8_t iid_index[MAX_PS_ENVELOPES][34];
+ int8_t icc_index[MAX_PS_ENVELOPES][34];
+ int8_t ipd_index[MAX_PS_ENVELOPES][17];
+ int8_t opd_index[MAX_PS_ENVELOPES][17];
+
+ int8_t ipd_index_1[17];
+ int8_t opd_index_1[17];
+ int8_t ipd_index_2[17];
+ int8_t opd_index_2[17];
+
+ /* ps data was correctly read */
+ uint8_t ps_data_available;
+
+ /* a header has been read */
+ uint8_t header_read;
+
+ /* hybrid filterbank parameters */
+ void *hyb;
+ uint8_t use34hybrid_bands;
+
+ /**/
+ uint8_t num_groups;
+ uint8_t num_hybrid_groups;
+ uint8_t nr_par_bands;
+ uint8_t nr_allpass_bands;
+ uint8_t decay_cutoff;
+
+ uint8_t *group_border;
+ uint16_t *map_group2bk;
+
+ /* filter delay handling */
+ uint8_t saved_delay;
+ uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS];
+ uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS];
+ uint8_t delay_D[64];
+ uint8_t delay_buf_index_delay[64];
+
+ complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */
+ complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */
+ complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */
+ complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */
+
+ /* transients */
+ real_t alpha_decay;
+ real_t alpha_smooth;
+
+ real_t P_PeakDecayNrg[34];
+ real_t P_prev[34];
+ real_t P_SmoothPeakDecayDiffNrg_prev[34];
+
+ /* mixing and phase */
+ complex_t h11_prev[50];
+ complex_t h12_prev[50];
+ complex_t h21_prev[50];
+ complex_t h22_prev[50];
+ uint8_t phase_hist;
+ complex_t ipd_prev[20][2];
+ complex_t opd_prev[20][2];
+
+} ps_info;
+
+/* ps_syntax.c */
+uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header);
+
+/* ps_dec.c */
+ps_info *ps_init(uint8_t sr_index);
+void ps_free(ps_info *ps);
+
+uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ps_syntax.c b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_syntax.c
new file mode 100644
index 000000000..f59cc365d
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_syntax.c
@@ -0,0 +1,550 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ps_syntax.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+
+#ifdef PS_DEC
+
+#include "bits.h"
+#include "ps_dec.h"
+
+/* type definitaions */
+typedef const int8_t (*ps_huff_tab)[2];
+
+/* static data tables */
+static const uint8_t nr_iid_par_tab[] = {
+ 10, 20, 34, 10, 20, 34, 0, 0
+};
+static const uint8_t nr_ipdopd_par_tab[] = {
+ 5, 11, 17, 5, 11, 17, 0, 0
+};
+static const uint8_t nr_icc_par_tab[] = {
+ 10, 20, 34, 10, 20, 34, 0, 0
+};
+static const uint8_t num_env_tab[][4] = {
+ { 0, 1, 2, 4 },
+ { 1, 2, 3, 4 }
+};
+
+/* binary lookup huffman tables */
+static const int8_t f_huff_iid_def[][2] = {
+ { /*0*/ -31, 1 }, /* index 0: 1 bits: x */
+ { 2, 3 }, /* index 1: 2 bits: 1x */
+ { /*1*/ -30, /*-1*/ -32 }, /* index 2: 3 bits: 10x */
+ { 4, 5 }, /* index 3: 3 bits: 11x */
+ { /*2*/ -29, /*-2*/ -33 }, /* index 4: 4 bits: 110x */
+ { 6, 7 }, /* index 5: 4 bits: 111x */
+ { /*3*/ -28, /*-3*/ -34 }, /* index 6: 5 bits: 1110x */
+ { 8, 9 }, /* index 7: 5 bits: 1111x */
+ { /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 11110x */
+ { /*5*/ -26, 10 }, /* index 9: 6 bits: 11111x */
+ { /*-5*/ -36, 11 }, /* index 10: 7 bits: 111111x */
+ { /*6*/ -25, 12 }, /* index 11: 8 bits: 1111111x */
+ { /*-6*/ -37, 13 }, /* index 12: 9 bits: 11111111x */
+ { /*-7*/ -38, 14 }, /* index 13: 10 bits: 111111111x */
+ { /*7*/ -24, 15 }, /* index 14: 11 bits: 1111111111x */
+ { 16, 17 }, /* index 15: 12 bits: 11111111111x */
+ { /*8*/ -23, /*-8*/ -39 }, /* index 16: 13 bits: 111111111110x */
+ { 18, 19 }, /* index 17: 13 bits: 111111111111x */
+ { /*9*/ -22, /*10*/ -21 }, /* index 18: 14 bits: 1111111111110x */
+ { 20, 21 }, /* index 19: 14 bits: 1111111111111x */
+ { /*-9*/ -40, /*11*/ -20 }, /* index 20: 15 bits: 11111111111110x */
+ { 22, 23 }, /* index 21: 15 bits: 11111111111111x */
+ { /*-10*/ -41, 24 }, /* index 22: 16 bits: 111111111111110x */
+ { 25, 26 }, /* index 23: 16 bits: 111111111111111x */
+ { /*-11*/ -42, /*-14*/ -45 }, /* index 24: 17 bits: 1111111111111101x */
+ { /*-13*/ -44, /*-12*/ -43 }, /* index 25: 17 bits: 1111111111111110x */
+ { /*12*/ -19, 27 }, /* index 26: 17 bits: 1111111111111111x */
+ { /*13*/ -18, /*14*/ -17 } /* index 27: 18 bits: 11111111111111111x */
+};
+
+static const int8_t t_huff_iid_def[][2] = {
+ { /*0*/ -31, 1 }, /* index 0: 1 bits: x */
+ { /*-1*/ -32, 2 }, /* index 1: 2 bits: 1x */
+ { /*1*/ -30, 3 }, /* index 2: 3 bits: 11x */
+ { /*-2*/ -33, 4 }, /* index 3: 4 bits: 111x */
+ { /*2*/ -29, 5 }, /* index 4: 5 bits: 1111x */
+ { /*-3*/ -34, 6 }, /* index 5: 6 bits: 11111x */
+ { /*3*/ -28, 7 }, /* index 6: 7 bits: 111111x */
+ { /*-4*/ -35, 8 }, /* index 7: 8 bits: 1111111x */
+ { /*4*/ -27, 9 }, /* index 8: 9 bits: 11111111x */
+ { /*-5*/ -36, 10 }, /* index 9: 10 bits: 111111111x */
+ { /*5*/ -26, 11 }, /* index 10: 11 bits: 1111111111x */
+ { /*-6*/ -37, 12 }, /* index 11: 12 bits: 11111111111x */
+ { /*6*/ -25, 13 }, /* index 12: 13 bits: 111111111111x */
+ { /*7*/ -24, 14 }, /* index 13: 14 bits: 1111111111111x */
+ { /*-7*/ -38, 15 }, /* index 14: 15 bits: 11111111111111x */
+ { 16, 17 }, /* index 15: 16 bits: 111111111111111x */
+ { /*8*/ -23, /*-8*/ -39 }, /* index 16: 17 bits: 1111111111111110x */
+ { 18, 19 }, /* index 17: 17 bits: 1111111111111111x */
+ { 20, 21 }, /* index 18: 18 bits: 11111111111111110x */
+ { 22, 23 }, /* index 19: 18 bits: 11111111111111111x */
+ { /*9*/ -22, /*-14*/ -45 }, /* index 20: 19 bits: 111111111111111100x */
+ { /*-13*/ -44, /*-12*/ -43 }, /* index 21: 19 bits: 111111111111111101x */
+ { 24, 25 }, /* index 22: 19 bits: 111111111111111110x */
+ { 26, 27 }, /* index 23: 19 bits: 111111111111111111x */
+ { /*-11*/ -42, /*-10*/ -41 }, /* index 24: 20 bits: 1111111111111111100x */
+ { /*-9*/ -40, /*10*/ -21 }, /* index 25: 20 bits: 1111111111111111101x */
+ { /*11*/ -20, /*12*/ -19 }, /* index 26: 20 bits: 1111111111111111110x */
+ { /*13*/ -18, /*14*/ -17 } /* index 27: 20 bits: 1111111111111111111x */
+};
+
+static const int8_t f_huff_iid_fine[][2] = {
+ { 1, /*0*/ -31 }, /* index 0: 1 bits: x */
+ { 2, 3 }, /* index 1: 2 bits: 0x */
+ { 4, /*-1*/ -32 }, /* index 2: 3 bits: 00x */
+ { /*1*/ -30, 5 }, /* index 3: 3 bits: 01x */
+ { /*-2*/ -33, /*2*/ -29 }, /* index 4: 4 bits: 000x */
+ { 6, 7 }, /* index 5: 4 bits: 011x */
+ { /*-3*/ -34, /*3*/ -28 }, /* index 6: 5 bits: 0110x */
+ { 8, 9 }, /* index 7: 5 bits: 0111x */
+ { /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 01110x */
+ { 10, 11 }, /* index 9: 6 bits: 01111x */
+ { /*-5*/ -36, /*5*/ -26 }, /* index 10: 7 bits: 011110x */
+ { 12, 13 }, /* index 11: 7 bits: 011111x */
+ { /*-6*/ -37, /*6*/ -25 }, /* index 12: 8 bits: 0111110x */
+ { 14, 15 }, /* index 13: 8 bits: 0111111x */
+ { /*7*/ -24, 16 }, /* index 14: 9 bits: 01111110x */
+ { 17, 18 }, /* index 15: 9 bits: 01111111x */
+ { 19, /*-8*/ -39 }, /* index 16: 10 bits: 011111101x */
+ { /*8*/ -23, 20 }, /* index 17: 10 bits: 011111110x */
+ { 21, /*-7*/ -38 }, /* index 18: 10 bits: 011111111x */
+ { /*10*/ -21, 22 }, /* index 19: 11 bits: 0111111010x */
+ { 23, /*-9*/ -40 }, /* index 20: 11 bits: 0111111101x */
+ { /*9*/ -22, 24 }, /* index 21: 11 bits: 0111111110x */
+ { /*-11*/ -42, /*11*/ -20 }, /* index 22: 12 bits: 01111110101x */
+ { 25, 26 }, /* index 23: 12 bits: 01111111010x */
+ { 27, /*-10*/ -41 }, /* index 24: 12 bits: 01111111101x */
+ { 28, /*-12*/ -43 }, /* index 25: 13 bits: 011111110100x */
+ { /*12*/ -19, 29 }, /* index 26: 13 bits: 011111110101x */
+ { 30, 31 }, /* index 27: 13 bits: 011111111010x */
+ { 32, /*-14*/ -45 }, /* index 28: 14 bits: 0111111101000x */
+ { /*14*/ -17, 33 }, /* index 29: 14 bits: 0111111101011x */
+ { 34, /*-13*/ -44 }, /* index 30: 14 bits: 0111111110100x */
+ { /*13*/ -18, 35 }, /* index 31: 14 bits: 0111111110101x */
+ { 36, 37 }, /* index 32: 15 bits: 01111111010000x */
+ { 38, /*-15*/ -46 }, /* index 33: 15 bits: 01111111010111x */
+ { /*15*/ -16, 39 }, /* index 34: 15 bits: 01111111101000x */
+ { 40, 41 }, /* index 35: 15 bits: 01111111101011x */
+ { 42, 43 }, /* index 36: 16 bits: 011111110100000x */
+ { /*-17*/ -48, /*17*/ -14 }, /* index 37: 16 bits: 011111110100001x */
+ { 44, 45 }, /* index 38: 16 bits: 011111110101110x */
+ { 46, 47 }, /* index 39: 16 bits: 011111111010001x */
+ { 48, 49 }, /* index 40: 16 bits: 011111111010110x */
+ { /*-16*/ -47, /*16*/ -15 }, /* index 41: 16 bits: 011111111010111x */
+ { /*-21*/ -52, /*21*/ -10 }, /* index 42: 17 bits: 0111111101000000x */
+ { /*-19*/ -50, /*19*/ -12 }, /* index 43: 17 bits: 0111111101000001x */
+ { /*-18*/ -49, /*18*/ -13 }, /* index 44: 17 bits: 0111111101011100x */
+ { 50, 51 }, /* index 45: 17 bits: 0111111101011101x */
+ { 52, 53 }, /* index 46: 17 bits: 0111111110100010x */
+ { 54, 55 }, /* index 47: 17 bits: 0111111110100011x */
+ { 56, 57 }, /* index 48: 17 bits: 0111111110101100x */
+ { 58, 59 }, /* index 49: 17 bits: 0111111110101101x */
+ { /*-26*/ -57, /*-25*/ -56 }, /* index 50: 18 bits: 01111111010111010x */
+ { /*-28*/ -59, /*-27*/ -58 }, /* index 51: 18 bits: 01111111010111011x */
+ { /*-22*/ -53, /*22*/ -9 }, /* index 52: 18 bits: 01111111101000100x */
+ { /*-24*/ -55, /*-23*/ -54 }, /* index 53: 18 bits: 01111111101000101x */
+ { /*25*/ -6, /*26*/ -5 }, /* index 54: 18 bits: 01111111101000110x */
+ { /*23*/ -8, /*24*/ -7 }, /* index 55: 18 bits: 01111111101000111x */
+ { /*29*/ -2, /*30*/ -1 }, /* index 56: 18 bits: 01111111101011000x */
+ { /*27*/ -4, /*28*/ -3 }, /* index 57: 18 bits: 01111111101011001x */
+ { /*-30*/ -61, /*-29*/ -60 }, /* index 58: 18 bits: 01111111101011010x */
+ { /*-20*/ -51, /*20*/ -11 } /* index 59: 18 bits: 01111111101011011x */
+};
+
+static const int8_t t_huff_iid_fine[][2] = {
+ { 1, /*0*/ -31 }, /* index 0: 1 bits: x */
+ { /*1*/ -30, 2 }, /* index 1: 2 bits: 0x */
+ { 3, /*-1*/ -32 }, /* index 2: 3 bits: 01x */
+ { 4, 5 }, /* index 3: 4 bits: 010x */
+ { 6, 7 }, /* index 4: 5 bits: 0100x */
+ { /*-2*/ -33, /*2*/ -29 }, /* index 5: 5 bits: 0101x */
+ { 8, /*-3*/ -34 }, /* index 6: 6 bits: 01000x */
+ { /*3*/ -28, 9 }, /* index 7: 6 bits: 01001x */
+ { /*-4*/ -35, /*4*/ -27 }, /* index 8: 7 bits: 010000x */
+ { 10, 11 }, /* index 9: 7 bits: 010011x */
+ { /*5*/ -26, 12 }, /* index 10: 8 bits: 0100110x */
+ { 13, 14 }, /* index 11: 8 bits: 0100111x */
+ { /*-6*/ -37, /*6*/ -25 }, /* index 12: 9 bits: 01001101x */
+ { 15, 16 }, /* index 13: 9 bits: 01001110x */
+ { 17, /*-5*/ -36 }, /* index 14: 9 bits: 01001111x */
+ { 18, /*-7*/ -38 }, /* index 15: 10 bits: 010011100x */
+ { /*7*/ -24, 19 }, /* index 16: 10 bits: 010011101x */
+ { 20, 21 }, /* index 17: 10 bits: 010011110x */
+ { /*9*/ -22, 22 }, /* index 18: 11 bits: 0100111000x */
+ { 23, 24 }, /* index 19: 11 bits: 0100111011x */
+ { /*-8*/ -39, /*8*/ -23 }, /* index 20: 11 bits: 0100111100x */
+ { 25, 26 }, /* index 21: 11 bits: 0100111101x */
+ { /*11*/ -20, 27 }, /* index 22: 12 bits: 01001110001x */
+ { 28, 29 }, /* index 23: 12 bits: 01001110110x */
+ { /*-10*/ -41, /*10*/ -21 }, /* index 24: 12 bits: 01001110111x */
+ { 30, 31 }, /* index 25: 12 bits: 01001111010x */
+ { 32, /*-9*/ -40 }, /* index 26: 12 bits: 01001111011x */
+ { 33, /*-13*/ -44 }, /* index 27: 13 bits: 010011100011x */
+ { /*13*/ -18, 34 }, /* index 28: 13 bits: 010011101100x */
+ { 35, 36 }, /* index 29: 13 bits: 010011101101x */
+ { 37, /*-12*/ -43 }, /* index 30: 13 bits: 010011110100x */
+ { /*12*/ -19, 38 }, /* index 31: 13 bits: 010011110101x */
+ { 39, /*-11*/ -42 }, /* index 32: 13 bits: 010011110110x */
+ { 40, 41 }, /* index 33: 14 bits: 0100111000110x */
+ { 42, 43 }, /* index 34: 14 bits: 0100111011001x */
+ { 44, 45 }, /* index 35: 14 bits: 0100111011010x */
+ { 46, /*-15*/ -46 }, /* index 36: 14 bits: 0100111011011x */
+ { /*15*/ -16, 47 }, /* index 37: 14 bits: 0100111101000x */
+ { /*-14*/ -45, /*14*/ -17 }, /* index 38: 14 bits: 0100111101011x */
+ { 48, 49 }, /* index 39: 14 bits: 0100111101100x */
+ { /*-21*/ -52, /*-20*/ -51 }, /* index 40: 15 bits: 01001110001100x */
+ { /*18*/ -13, /*19*/ -12 }, /* index 41: 15 bits: 01001110001101x */
+ { /*-19*/ -50, /*-18*/ -49 }, /* index 42: 15 bits: 01001110110010x */
+ { 50, 51 }, /* index 43: 15 bits: 01001110110011x */
+ { 52, 53 }, /* index 44: 15 bits: 01001110110100x */
+ { 54, 55 }, /* index 45: 15 bits: 01001110110101x */
+ { 56, /*-17*/ -48 }, /* index 46: 15 bits: 01001110110110x */
+ { /*17*/ -14, 57 }, /* index 47: 15 bits: 01001111010001x */
+ { 58, /*-16*/ -47 }, /* index 48: 15 bits: 01001111011000x */
+ { /*16*/ -15, 59 }, /* index 49: 15 bits: 01001111011001x */
+ { /*-26*/ -57, /*26*/ -5 }, /* index 50: 16 bits: 010011101100110x */
+ { /*-28*/ -59, /*-27*/ -58 }, /* index 51: 16 bits: 010011101100111x */
+ { /*29*/ -2, /*30*/ -1 }, /* index 52: 16 bits: 010011101101000x */
+ { /*27*/ -4, /*28*/ -3 }, /* index 53: 16 bits: 010011101101001x */
+ { /*-30*/ -61, /*-29*/ -60 }, /* index 54: 16 bits: 010011101101010x */
+ { /*-25*/ -56, /*25*/ -6 }, /* index 55: 16 bits: 010011101101011x */
+ { /*-24*/ -55, /*24*/ -7 }, /* index 56: 16 bits: 010011101101100x */
+ { /*-23*/ -54, /*23*/ -8 }, /* index 57: 16 bits: 010011110100011x */
+ { /*-22*/ -53, /*22*/ -9 }, /* index 58: 16 bits: 010011110110000x */
+ { /*20*/ -11, /*21*/ -10 } /* index 59: 16 bits: 010011110110011x */
+};
+
+static const int8_t f_huff_icc[][2] = {
+ { /*0*/ -31, 1 }, /* index 0: 1 bits: x */
+ { /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */
+ { /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */
+ { /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */
+ { /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */
+ { /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */
+ { /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */
+ { /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */
+ { /*5*/ -26, 9 }, /* index 8: 9 bits: 11111111x */
+ { /*-4*/ -35, 10 }, /* index 9: 10 bits: 111111111x */
+ { /*6*/ -25, 11 }, /* index 10: 11 bits: 1111111111x */
+ { /*-5*/ -36, 12 }, /* index 11: 12 bits: 11111111111x */
+ { /*7*/ -24, 13 }, /* index 12: 13 bits: 111111111111x */
+ { /*-6*/ -37, /*-7*/ -38 } /* index 13: 14 bits: 1111111111111x */
+};
+
+static const int8_t t_huff_icc[][2] = {
+ { /*0*/ -31, 1 }, /* index 0: 1 bits: x */
+ { /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */
+ { /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */
+ { /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */
+ { /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */
+ { /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */
+ { /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */
+ { /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */
+ { /*-4*/ -35, 9 }, /* index 8: 9 bits: 11111111x */
+ { /*5*/ -26, 10 }, /* index 9: 10 bits: 111111111x */
+ { /*-5*/ -36, 11 }, /* index 10: 11 bits: 1111111111x */
+ { /*6*/ -25, 12 }, /* index 11: 12 bits: 11111111111x */
+ { /*-6*/ -37, 13 }, /* index 12: 13 bits: 111111111111x */
+ { /*-7*/ -38, /*7*/ -24 } /* index 13: 14 bits: 1111111111111x */
+};
+
+static const int8_t f_huff_ipd[][2] = {
+ { 1, /*0*/ -31 }, /* index 0: 1 bits: x */
+ { 2, 3 }, /* index 1: 2 bits: 0x */
+ { /*1*/ -30, 4 }, /* index 2: 3 bits: 00x */
+ { 5, 6 }, /* index 3: 3 bits: 01x */
+ { /*4*/ -27, /*5*/ -26 }, /* index 4: 4 bits: 001x */
+ { /*3*/ -28, /*6*/ -25 }, /* index 5: 4 bits: 010x */
+ { /*2*/ -29, /*7*/ -24 } /* index 6: 4 bits: 011x */
+};
+
+static const int8_t t_huff_ipd[][2] = {
+ { 1, /*0*/ -31 }, /* index 0: 1 bits: x */
+ { 2, 3 }, /* index 1: 2 bits: 0x */
+ { 4, 5 }, /* index 2: 3 bits: 00x */
+ { /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */
+ { /*5*/ -26, 6 }, /* index 4: 4 bits: 000x */
+ { /*2*/ -29, /*6*/ -25 }, /* index 5: 4 bits: 001x */
+ { /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0001x */
+};
+
+static const int8_t f_huff_opd[][2] = {
+ { 1, /*0*/ -31 }, /* index 0: 1 bits: x */
+ { 2, 3 }, /* index 1: 2 bits: 0x */
+ { /*7*/ -24, /*1*/ -30 }, /* index 2: 3 bits: 00x */
+ { 4, 5 }, /* index 3: 3 bits: 01x */
+ { /*3*/ -28, /*6*/ -25 }, /* index 4: 4 bits: 010x */
+ { /*2*/ -29, 6 }, /* index 5: 4 bits: 011x */
+ { /*5*/ -26, /*4*/ -27 } /* index 6: 5 bits: 0111x */
+};
+
+static const int8_t t_huff_opd[][2] = {
+ { 1, /*0*/ -31 }, /* index 0: 1 bits: x */
+ { 2, 3 }, /* index 1: 2 bits: 0x */
+ { 4, 5 }, /* index 2: 3 bits: 00x */
+ { /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */
+ { /*5*/ -26, /*2*/ -29 }, /* index 4: 4 bits: 000x */
+ { /*6*/ -25, 6 }, /* index 5: 4 bits: 001x */
+ { /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0011x */
+};
+
+/* static function declarations */
+static uint16_t ps_extension(ps_info *ps, bitfile *ld,
+ const uint8_t ps_extension_id,
+ const uint16_t num_bits_left);
+static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par,
+ ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par);
+static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff);
+
+
+uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header)
+{
+ uint8_t tmp, n;
+ uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
+
+ *header = 0;
+
+ /* check for new PS header */
+ if (faad_get1bit(ld
+ DEBUGVAR(1,1000,"ps_data(): enable_ps_header")))
+ {
+ *header = 1;
+
+ ps->header_read = 1;
+
+ ps->use34hybrid_bands = 0;
+
+ /* Inter-channel Intensity Difference (IID) parameters enabled */
+ ps->enable_iid = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,1001,"ps_data(): enable_iid"));
+
+ if (ps->enable_iid)
+ {
+ ps->iid_mode = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1002,"ps_data(): iid_mode"));
+
+ ps->nr_iid_par = nr_iid_par_tab[ps->iid_mode];
+ ps->nr_ipdopd_par = nr_ipdopd_par_tab[ps->iid_mode];
+
+ if (ps->iid_mode == 2 || ps->iid_mode == 5)
+ ps->use34hybrid_bands = 1;
+
+ /* IPD freq res equal to IID freq res */
+ ps->ipd_mode = ps->iid_mode;
+ }
+
+ /* Inter-channel Coherence (ICC) parameters enabled */
+ ps->enable_icc = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,1003,"ps_data(): enable_icc"));
+
+ if (ps->enable_icc)
+ {
+ ps->icc_mode = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1004,"ps_data(): icc_mode"));
+
+ ps->nr_icc_par = nr_icc_par_tab[ps->icc_mode];
+
+ if (ps->icc_mode == 2 || ps->icc_mode == 5)
+ ps->use34hybrid_bands = 1;
+ }
+
+ /* PS extension layer enabled */
+ ps->enable_ext = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,1005,"ps_data(): enable_ext"));
+ }
+
+ /* we are here, but no header has been read yet */
+ if (ps->header_read == 0)
+ return 1;
+
+ ps->frame_class = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,1006,"ps_data(): frame_class"));
+ tmp = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,1007,"ps_data(): num_env_idx"));
+
+ ps->num_env = num_env_tab[ps->frame_class][tmp];
+
+ if (ps->frame_class)
+ {
+ for (n = 1; n < ps->num_env+1; n++)
+ {
+ ps->border_position[n] = (uint8_t)faad_getbits(ld, 5
+ DEBUGVAR(1,1008,"ps_data(): border_position"));
+ }
+ }
+
+ if (ps->enable_iid)
+ {
+ for (n = 0; n < ps->num_env; n++)
+ {
+ ps->iid_dt[n] = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,1009,"ps_data(): iid_dt"));
+
+ /* iid_data */
+ if (ps->iid_mode < 3)
+ {
+ huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_def,
+ f_huff_iid_def, ps->iid_index[n]);
+ } else {
+ huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_fine,
+ f_huff_iid_fine, ps->iid_index[n]);
+ }
+ }
+ }
+
+ if (ps->enable_icc)
+ {
+ for (n = 0; n < ps->num_env; n++)
+ {
+ ps->icc_dt[n] = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,1010,"ps_data(): icc_dt"));
+
+ /* icc_data */
+ huff_data(ld, ps->icc_dt[n], ps->nr_icc_par, t_huff_icc,
+ f_huff_icc, ps->icc_index[n]);
+ }
+ }
+
+ if (ps->enable_ext)
+ {
+ uint16_t num_bits_left;
+ uint16_t cnt = (uint16_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1011,"ps_data(): ps_extension_size"));
+ if (cnt == 15)
+ {
+ cnt += (uint16_t)faad_getbits(ld, 8
+ DEBUGVAR(1,1012,"ps_data(): esc_count"));
+ }
+
+ num_bits_left = 8 * cnt;
+ while (num_bits_left > 7)
+ {
+ uint8_t ps_extension_id = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,1013,"ps_data(): ps_extension_size"));
+
+ num_bits_left -= 2;
+ num_bits_left -= ps_extension(ps, ld, ps_extension_id, num_bits_left);
+ }
+
+ faad_getbits(ld, num_bits_left
+ DEBUGVAR(1,1014,"ps_data(): fill_bits"));
+ }
+
+ bits = (uint16_t)faad_get_processed_bits(ld) - bits;
+
+ ps->ps_data_available = 1;
+
+ return bits;
+}
+
+static uint16_t ps_extension(ps_info *ps, bitfile *ld,
+ const uint8_t ps_extension_id,
+ const uint16_t num_bits_left)
+{
+ uint8_t n;
+ uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
+
+ if (ps_extension_id == 0)
+ {
+ ps->enable_ipdopd = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,1015,"ps_extension(): enable_ipdopd"));
+
+ if (ps->enable_ipdopd)
+ {
+ for (n = 0; n < ps->num_env; n++)
+ {
+ ps->ipd_dt[n] = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,1016,"ps_extension(): ipd_dt"));
+
+ /* ipd_data */
+ huff_data(ld, ps->ipd_dt[n], ps->nr_ipdopd_par, t_huff_ipd,
+ f_huff_ipd, ps->ipd_index[n]);
+
+ ps->opd_dt[n] = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,1017,"ps_extension(): opd_dt"));
+
+ /* opd_data */
+ huff_data(ld, ps->opd_dt[n], ps->nr_ipdopd_par, t_huff_opd,
+ f_huff_opd, ps->opd_index[n]);
+ }
+ }
+ faad_get1bit(ld
+ DEBUGVAR(1,1018,"ps_extension(): reserved_ps"));
+ }
+
+ /* return number of bits read */
+ bits = (uint16_t)faad_get_processed_bits(ld) - bits;
+
+ return bits;
+}
+
+/* read huffman data coded in either the frequency or the time direction */
+static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par,
+ ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par)
+{
+ uint8_t n;
+
+ if (dt)
+ {
+ /* coded in time direction */
+ for (n = 0; n < nr_par; n++)
+ {
+ par[n] = ps_huff_dec(ld, t_huff);
+ }
+ } else {
+ /* coded in frequency direction */
+ par[0] = ps_huff_dec(ld, f_huff);
+
+ for (n = 1; n < nr_par; n++)
+ {
+ par[n] = ps_huff_dec(ld, f_huff);
+ }
+ }
+}
+
+/* binary search huffman decoding */
+static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff)
+{
+ uint8_t bit;
+ int16_t index = 0;
+
+ while (index >= 0)
+ {
+ bit = (uint8_t)faad_get1bit(ld);
+ index = t_huff[index][bit];
+ }
+
+ return index + 31;
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ps_tables.h b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_tables.h
new file mode 100644
index 000000000..3a357fc04
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ps_tables.h
@@ -0,0 +1,552 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ps_tables.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __PS_TABLES_H__
+#define __PS_TABLES_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+#if 0
+#if 0
+float f_center_20[12] = {
+ 0.5/4, 1.5/4, 2.5/4, 3.5/4,
+ 4.5/4*0, 5.5/4*0, -1.5/4, -0.5/4,
+ 3.5/2, 2.5/2, 4.5/2, 5.5/2
+};
+#else
+float f_center_20[12] = {
+ 0.5/8, 1.5/8, 2.5/8, 3.5/8,
+ 4.5/8*0, 5.5/8*0, -1.5/8, -0.5/8,
+ 3.5/4, 2.5/4, 4.5/4, 5.5/4
+};
+#endif
+
+float f_center_34[32] = {
+ 1/12, 3/12, 5/12, 7/12,
+ 9/12, 11/12, 13/12, 15/12,
+ 17/12, -5/12, -3/12, -1/12,
+ 17/8, 19/8, 5/8, 7/8,
+ 9/8, 11/8, 13/8, 15/8,
+ 9/4, 11/4, 13/4, 7/4,
+ 17/4, 11/4, 13/4, 15/4,
+ 17/4, 19/4, 21/4, 15/4
+};
+
+static const real_t frac_delay_q[] = {
+ FRAC_CONST(0.43),
+ FRAC_CONST(0.75),
+ FRAC_CONST(0.347)
+};
+#endif
+
+/* RE(ps->Phi_Fract_Qmf[j]) = (float)cos(M_PI*(j+0.5)*(0.39)); */
+/* IM(ps->Phi_Fract_Qmf[j]) = (float)sin(M_PI*(j+0.5)*(0.39)); */
+static const complex_t Phi_Fract_Qmf[] = {
+ { FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) },
+ { FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) },
+ { FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) },
+ { FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) },
+ { FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) },
+ { FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) },
+ { FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) },
+ { FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) },
+ { FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) },
+ { FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) },
+ { FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) },
+ { FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) },
+ { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) },
+ { FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) },
+ { FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) },
+ { FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) },
+ { FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) },
+ { FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) },
+ { FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) },
+ { FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) },
+ { FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) },
+ { FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) },
+ { FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) },
+ { FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) },
+ { FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) },
+ { FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) },
+ { FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) },
+ { FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) },
+ { FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) },
+ { FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) },
+ { FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) },
+ { FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) },
+ { FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) },
+ { FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) },
+ { FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) },
+ { FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) },
+ { FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) },
+ { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) },
+ { FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) },
+ { FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) },
+ { FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) },
+ { FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) },
+ { FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) },
+ { FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) },
+ { FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) },
+ { FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) },
+ { FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) },
+ { FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) },
+ { FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) },
+ { FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) },
+ { FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) },
+ { FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) },
+ { FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) },
+ { FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) },
+ { FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) },
+ { FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) },
+ { FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) },
+ { FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) },
+ { FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) },
+ { FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) },
+ { FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) },
+ { FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) },
+ { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) },
+ { FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) }
+};
+
+/* RE(Phi_Fract_SubQmf20[j]) = (float)cos(M_PI*f_center_20[j]*0.39); */
+/* IM(Phi_Fract_SubQmf20[j]) = (float)sin(M_PI*f_center_20[j]*0.39); */
+static const complex_t Phi_Fract_SubQmf20[] = {
+ { FRAC_CONST(0.9882950187), FRAC_CONST(0.1525546312) },
+ { FRAC_CONST(0.8962930441), FRAC_CONST(0.4434623122) },
+ { FRAC_CONST(0.7208535671), FRAC_CONST(0.6930873394) },
+ { FRAC_CONST(0.4783087075), FRAC_CONST(0.8781917691) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(0.8962930441), FRAC_CONST(-0.4434623122) },
+ { FRAC_CONST(0.9882950187), FRAC_CONST(-0.1525546312) },
+ { FRAC_CONST(-0.5424415469), FRAC_CONST(0.8400935531) },
+ { FRAC_CONST(0.0392598175), FRAC_CONST(0.9992290139) },
+ { FRAC_CONST(-0.9268565774), FRAC_CONST(0.3754155636) },
+ { FRAC_CONST(-0.9741733670), FRAC_CONST(-0.2258012742) }
+};
+
+/* RE(Phi_Fract_SubQmf34[j]) = (float)cos(M_PI*f_center_34[j]*0.39); */
+/* IM(Phi_Fract_SubQmf34[j]) = (float)sin(M_PI*f_center_34[j]*0.39); */
+static const complex_t Phi_Fract_SubQmf34[] = {
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
+ { FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
+ { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
+ { FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
+ { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
+ { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
+ { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
+ { FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
+ { FRAC_CONST(0.9876883626), FRAC_CONST(-0.1564344615) },
+ { FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }
+};
+
+/* RE(Q_Fract_allpass_Qmf[j][i]) = (float)cos(M_PI*(j+0.5)*(frac_delay_q[i])); */
+/* IM(Q_Fract_allpass_Qmf[j][i]) = (float)sin(M_PI*(j+0.5)*(frac_delay_q[i])); */
+static const complex_t Q_Fract_allpass_Qmf[][3] = {
+ { { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } },
+ { { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } },
+ { { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } },
+ { { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } },
+ { { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } },
+ { { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } },
+ { { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } },
+ { { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } },
+ { { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } },
+ { { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } },
+ { { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } },
+ { { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } },
+ { { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } },
+ { { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } },
+ { { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } },
+ { { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } },
+ { { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } },
+ { { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } },
+ { { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } },
+ { { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } },
+ { { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } },
+ { { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } },
+ { { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } },
+ { { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } },
+ { { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } },
+ { { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } },
+ { { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } },
+ { { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } },
+ { { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } },
+ { { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } },
+ { { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } },
+ { { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } },
+ { { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } },
+ { { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } },
+ { { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } },
+ { { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } },
+ { { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } },
+ { { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } },
+ { { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } },
+ { { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } },
+ { { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } },
+ { { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } },
+ { { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } },
+ { { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } },
+ { { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } },
+ { { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } },
+ { { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } },
+ { { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } },
+ { { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } },
+ { { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } },
+ { { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } },
+ { { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } },
+ { { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } },
+ { { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } },
+ { { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } },
+ { { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } },
+ { { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } },
+ { { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } },
+ { { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } },
+ { { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } },
+ { { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } },
+ { { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } },
+ { { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } },
+ { { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } }
+};
+
+/* RE(Q_Fract_allpass_SubQmf20[j][i]) = (float)cos(M_PI*f_center_20[j]*frac_delay_q[i]); */
+/* IM(Q_Fract_allpass_SubQmf20[j][i]) = (float)sin(M_PI*f_center_20[j]*frac_delay_q[i]); */
+static const complex_t Q_Fract_allpass_SubQmf20[][3] = {
+ { { FRAC_CONST(0.9857769012), FRAC_CONST(0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(0.1358452588) } },
+ { { FRAC_CONST(0.8744080663), FRAC_CONST(0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(0.3975082636) } },
+ { { FRAC_CONST(0.6642524004), FRAC_CONST(0.7475083470) }, { FRAC_CONST(0.0980171412), FRAC_CONST(0.9951847196) }, { FRAC_CONST(0.7767338753), FRAC_CONST(0.6298289299) } },
+ { { FRAC_CONST(0.3790524006), FRAC_CONST(0.9253752232) }, { FRAC_CONST(-0.4713967443), FRAC_CONST(0.8819212914) }, { FRAC_CONST(0.5785340071), FRAC_CONST(0.8156582713) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(0.8744080663), FRAC_CONST(-0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(-0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(-0.3975082636) } },
+ { { FRAC_CONST(0.9857769012), FRAC_CONST(-0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(-0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(-0.1358452588) } },
+ { { FRAC_CONST(-0.7126385570), FRAC_CONST(0.7015314102) }, { FRAC_CONST(-0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.3305967748), FRAC_CONST(0.9437720776) } },
+ { { FRAC_CONST(-0.1175374240), FRAC_CONST(0.9930684566) }, { FRAC_CONST(-0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(0.2066311091), FRAC_CONST(0.9784189463) } },
+ { { FRAC_CONST(-0.9947921634), FRAC_CONST(0.1019244045) }, { FRAC_CONST(0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.7720130086), FRAC_CONST(0.6356067061) } },
+ { { FRAC_CONST(-0.8400934935), FRAC_CONST(-0.5424416065) }, { FRAC_CONST(0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(-0.9896889329), FRAC_CONST(0.1432335079) } }
+};
+
+/* RE(Q_Fract_allpass_SubQmf34[j][i]) = (float)cos(M_PI*f_center_34[j]*frac_delay_q[i]); */
+/* IM(Q_Fract_allpass_SubQmf34[j][i]) = (float)sin(M_PI*f_center_34[j]*frac_delay_q[i]); */
+static const complex_t Q_Fract_allpass_SubQmf34[][3] = {
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
+ { { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
+ { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
+ { { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
+ { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
+ { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
+ { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
+ { { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
+ { { FRAC_CONST(0.8910064697), FRAC_CONST(0.4539906085) }, { FRAC_CONST(0.7071067691), FRAC_CONST(-0.7071067691) }, { FRAC_CONST(0.6730125546), FRAC_CONST(-0.7396310568) } },
+ { { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }
+};
+
+#if 0
+static float quant_rho[8] =
+{
+ FRAC_CONST(1.0), FRAC_CONST(0.937), FRAC_CONST(0.84118), FRAC_CONST(0.60092),
+ FRAC_CONST(0.36764), FRAC_CONST(0.0), FRAC_CONST(-0.589), FRAC_CONST(-1.0)
+};
+
+static const uint8_t quant_iid_normal[7] =
+{
+ 2, 4, 7, 10, 14, 18, 25
+};
+
+static const uint8_t quant_iid_fine[15] =
+{
+ 2, 4, 6, 8, 10, 13, 16, 19, 22, 25, 30, 35, 40, 45, 50
+};
+#endif
+
+static const real_t cos_alphas[] = {
+ COEF_CONST(1.0000000000), COEF_CONST(0.9841239700), COEF_CONST(0.9594738210),
+ COEF_CONST(0.8946843079), COEF_CONST(0.8269340931), COEF_CONST(0.7071067812),
+ COEF_CONST(0.4533210856), COEF_CONST(0.0000000000)
+};
+
+static const real_t sin_alphas[] = {
+ COEF_CONST(0.0000000000), COEF_CONST(0.1774824264), COEF_CONST(0.2817977763),
+ COEF_CONST(0.4466989918), COEF_CONST(0.5622988580), COEF_CONST(0.7071067812),
+ COEF_CONST(0.8913472911), COEF_CONST(1.0000000000)
+};
+
+static const real_t cos_betas_normal[][8] = {
+ { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9959398908), COEF_CONST(0.9896038018), COEF_CONST(0.9727589768), COEF_CONST(0.9548355329), COEF_CONST(0.9223070404), COEF_CONST(0.8494349490), COEF_CONST(0.7013005535) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9902068095), COEF_CONST(0.9749613872), COEF_CONST(0.9346538534), COEF_CONST(0.8921231300), COEF_CONST(0.8158851259), COEF_CONST(0.6495964302), COEF_CONST(0.3313370772) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9880510933), COEF_CONST(0.9694670261), COEF_CONST(0.9204347876), COEF_CONST(0.8688622825), COEF_CONST(0.7768516704), COEF_CONST(0.5782161800), COEF_CONST(0.2069970356) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) }
+};
+
+static const real_t sin_betas_normal[][8] = {
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0900207420), COEF_CONST(-0.1438204281), COEF_CONST(-0.2318188366), COEF_CONST(-0.2971348264), COEF_CONST(-0.3864579191), COEF_CONST(-0.5276933461), COEF_CONST(-0.7128657193) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1396082894), COEF_CONST(-0.2223742196), COEF_CONST(-0.3555589603), COEF_CONST(-0.4517923427), COEF_CONST(-0.5782140273), COEF_CONST(-0.7602792104), COEF_CONST(-0.9435124489) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1541266914), COEF_CONST(-0.2452217065), COEF_CONST(-0.3908961522), COEF_CONST(-0.4950538699), COEF_CONST(-0.6296836366), COEF_CONST(-0.8158836002), COEF_CONST(-0.9783415698) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) }
+};
+
+static const real_t cos_betas_fine[][8] = {
+ { COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9968361371), COEF_CONST(0.9918968104), COEF_CONST(0.9787540479), COEF_CONST(0.9647515190), COEF_CONST(0.9392903010), COEF_CONST(0.8820167114), COEF_CONST(0.7645325390) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9950262915), COEF_CONST(0.9872675041), COEF_CONST(0.9666584578), COEF_CONST(0.9447588606), COEF_CONST(0.9050918405), COEF_CONST(0.8165997379), COEF_CONST(0.6383824796) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9908827998), COEF_CONST(0.9766855904), COEF_CONST(0.9391249214), COEF_CONST(0.8994531782), COEF_CONST(0.8282352693), COEF_CONST(0.6723983174), COEF_CONST(0.3719473225) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9890240165), COEF_CONST(0.9719459866), COEF_CONST(0.9268448110), COEF_CONST(0.8793388536), COEF_CONST(0.7944023271), COEF_CONST(0.6101812098), COEF_CONST(0.2621501145) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9876350461), COEF_CONST(0.9684073447), COEF_CONST(0.9176973944), COEF_CONST(0.8643930070), COEF_CONST(0.7693796058), COEF_CONST(0.5646720713), COEF_CONST(0.1838899556) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9866247085), COEF_CONST(0.9658349704), COEF_CONST(0.9110590761), COEF_CONST(0.8535668048), COEF_CONST(0.7513165426), COEF_CONST(0.5320914819), COEF_CONST(0.1289530943) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9851245614), COEF_CONST(0.9620180268), COEF_CONST(0.9012265590), COEF_CONST(0.8375623272), COEF_CONST(0.7247108045), COEF_CONST(0.4845204297), COEF_CONST(0.0504115003) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9846869856), COEF_CONST(0.9609052357), COEF_CONST(0.8983639533), COEF_CONST(0.8329098386), COEF_CONST(0.7169983441), COEF_CONST(0.4708245354), COEF_CONST(0.0281732509) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9844406325), COEF_CONST(0.9602788522), COEF_CONST(0.8967533934), COEF_CONST(0.8302936455), COEF_CONST(0.7126658102), COEF_CONST(0.4631492839), COEF_CONST(0.0157851140) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9843020502), COEF_CONST(0.9599265269), COEF_CONST(0.8958477331), COEF_CONST(0.8288229094), COEF_CONST(0.7102315840), COEF_CONST(0.4588429315), COEF_CONST(0.0088578059) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9842241136), COEF_CONST(0.9597283916), COEF_CONST(0.8953385094), COEF_CONST(0.8279961409), COEF_CONST(0.7088635748), COEF_CONST(0.4564246834), COEF_CONST(0.0049751355) }
+};
+
+static const real_t sin_betas_fine[][8] = {
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0794840594), COEF_CONST(-0.1270461238), COEF_CONST(-0.2050378347), COEF_CONST(-0.2631625097), COEF_CONST(-0.3431234916), COEF_CONST(-0.4712181245), COEF_CONST(-0.6445851354) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.0996126459), COEF_CONST(-0.1590687758), COEF_CONST(-0.2560691819), COEF_CONST(-0.3277662204), COEF_CONST(-0.4252161335), COEF_CONST(-0.5772043556), COEF_CONST(-0.7697193058) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1347266752), COEF_CONST(-0.2146747714), COEF_CONST(-0.3435758752), COEF_CONST(-0.4370171396), COEF_CONST(-0.5603805303), COEF_CONST(-0.7401895046), COEF_CONST(-0.9282538388) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1477548470), COEF_CONST(-0.2352041647), COEF_CONST(-0.3754446647), COEF_CONST(-0.4761965776), COEF_CONST(-0.6073919186), COEF_CONST(-0.7922618830), COEF_CONST(-0.9650271071) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1567705832), COEF_CONST(-0.2493736450), COEF_CONST(-0.3972801182), COEF_CONST(-0.5028167951), COEF_CONST(-0.6387918458), COEF_CONST(-0.8253153651), COEF_CONST(-0.9829468369) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1630082348), COEF_CONST(-0.2591578860), COEF_CONST(-0.4122758299), COEF_CONST(-0.5209834064), COEF_CONST(-0.6599420072), COEF_CONST(-0.8466868694), COEF_CONST(-0.9916506943) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1718417832), COEF_CONST(-0.2729859267), COEF_CONST(-0.4333482310), COEF_CONST(-0.5463417868), COEF_CONST(-0.6890531546), COEF_CONST(-0.8747799456), COEF_CONST(-0.9987285320) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1743316967), COEF_CONST(-0.2768774604), COEF_CONST(-0.4392518725), COEF_CONST(-0.5534087104), COEF_CONST(-0.6970748701), COEF_CONST(-0.8822268738), COEF_CONST(-0.9996030552) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1757175038), COEF_CONST(-0.2790421580), COEF_CONST(-0.4425306221), COEF_CONST(-0.5573261722), COEF_CONST(-0.7015037013), COEF_CONST(-0.8862802834), COEF_CONST(-0.9998754073) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1764921355), COEF_CONST(-0.2802517850), COEF_CONST(-0.4443611583), COEF_CONST(-0.5595110229), COEF_CONST(-0.7039681080), COEF_CONST(-0.8885173967), COEF_CONST(-0.9999607689) },
+ { COEF_CONST(0.0000000000), COEF_CONST(-0.1769262394), COEF_CONST(-0.2809295540), COEF_CONST(-0.4453862969), COEF_CONST(-0.5607337966), COEF_CONST(-0.7053456119), COEF_CONST(-0.8897620516), COEF_CONST(-0.9999876239) }
+};
+
+static const real_t sincos_alphas_B_normal[][8] = {
+ { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) },
+ { COEF_CONST(0.1249065138), COEF_CONST(0.1173697697), COEF_CONST(0.1057888284), COEF_CONST(0.0761985131), COEF_CONST(0.0468732723), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103) },
+ { COEF_CONST(0.1956693050), COEF_CONST(0.1846090179), COEF_CONST(0.1673645109), COEF_CONST(0.1220621836), COEF_CONST(0.0757362479), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630) },
+ { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) },
+ { COEF_CONST(0.4078449476), COEF_CONST(0.3929852420), COEF_CONST(0.3680589270), COEF_CONST(0.2911029124), COEF_CONST(0.1934512363), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716) },
+ { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) },
+ { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) },
+ { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) },
+ { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) },
+ { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) },
+ { COEF_CONST(0.9130511848), COEF_CONST(0.9195447612), COEF_CONST(0.9298024282), COEF_CONST(0.9566917233), COEF_CONST(0.9811098801), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928) },
+ { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) },
+ { COEF_CONST(0.9806699215), COEF_CONST(0.9828120260), COEF_CONST(0.9858950861), COEF_CONST(0.9925224431), COEF_CONST(0.9971278825), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406) },
+ { COEF_CONST(0.9921685024), COEF_CONST(0.9930882705), COEF_CONST(0.9943886135), COEF_CONST(0.9970926648), COEF_CONST(0.9989008403), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479) },
+ { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) }
+};
+
+static const real_t sincos_alphas_B_fine[][8] = {
+ { COEF_CONST(0.0031622158), COEF_CONST(0.0029630181), COEF_CONST(0.0026599892), COEF_CONST(0.0019002704), COEF_CONST(0.0011626042), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278) },
+ { COEF_CONST(0.0056232673), COEF_CONST(0.0052689825), COEF_CONST(0.0047302825), COEF_CONST(0.0033791756), COEF_CONST(0.0020674015), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710) },
+ { COEF_CONST(0.0099994225), COEF_CONST(0.0093696693), COEF_CONST(0.0084117414), COEF_CONST(0.0060093796), COEF_CONST(0.0036766009), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392) },
+ { COEF_CONST(0.0177799194), COEF_CONST(0.0166607102), COEF_CONST(0.0149581377), COEF_CONST(0.0106875809), COEF_CONST(0.0065392545), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767) },
+ { COEF_CONST(0.0316069684), COEF_CONST(0.0296211579), COEF_CONST(0.0265987295), COEF_CONST(0.0190113813), COEF_CONST(0.0116349973), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974) },
+ { COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) },
+ { COEF_CONST(0.0791834041), COEF_CONST(0.0742798103), COEF_CONST(0.0667907269), COEF_CONST(0.0478705292), COEF_CONST(0.0293500747), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755) },
+ { COEF_CONST(0.1115021177), COEF_CONST(0.1047141985), COEF_CONST(0.0943053154), COEF_CONST(0.0678120561), COEF_CONST(0.0416669150), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213) },
+ { COEF_CONST(0.1565355066), COEF_CONST(0.1473258371), COEF_CONST(0.1330924027), COEF_CONST(0.0963282233), COEF_CONST(0.0594509113), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946) },
+ { COEF_CONST(0.2184643682), COEF_CONST(0.2064579524), COEF_CONST(0.1876265439), COEF_CONST(0.1375744167), COEF_CONST(0.0856896681), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338) },
+ { COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) },
+ { COEF_CONST(0.3698741335), COEF_CONST(0.3547727297), COEF_CONST(0.3298252076), COEF_CONST(0.2556265829), COEF_CONST(0.1665990017), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541) },
+ { COEF_CONST(0.4480623975), COEF_CONST(0.4339410024), COEF_CONST(0.4098613774), COEF_CONST(0.3322709108), COEF_CONST(0.2266784729), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131) },
+ { COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) },
+ { COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) },
+ { COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) },
+ { COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) },
+ { COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) },
+ { COEF_CONST(0.8940022267), COEF_CONST(0.9009412572), COEF_CONST(0.9121477564), COEF_CONST(0.9431839770), COEF_CONST(0.9739696219), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480) },
+ { COEF_CONST(0.9290818561), COEF_CONST(0.9349525662), COEF_CONST(0.9440420138), COEF_CONST(0.9667755833), COEF_CONST(0.9860247275), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664) },
+ { COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) },
+ { COEF_CONST(0.9758449068), COEF_CONST(0.9784554646), COEF_CONST(0.9822404252), COEF_CONST(0.9904914275), COEF_CONST(0.9963218730), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926) },
+ { COEF_CONST(0.9876723320), COEF_CONST(0.9890880155), COEF_CONST(0.9911036356), COEF_CONST(0.9953496173), COEF_CONST(0.9982312259), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685) },
+ { COEF_CONST(0.9937641889), COEF_CONST(0.9945023501), COEF_CONST(0.9955433130), COEF_CONST(0.9976981117), COEF_CONST(0.9991315558), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610) },
+ { COEF_CONST(0.9968600642), COEF_CONST(0.9972374385), COEF_CONST(0.9977670024), COEF_CONST(0.9988535464), COEF_CONST(0.9995691924), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129) },
+ { COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) },
+ { COEF_CONST(0.9995003746), COEF_CONST(0.9995611974), COEF_CONST(0.9996461891), COEF_CONST(0.9998192657), COEF_CONST(0.9999323103), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475) },
+ { COEF_CONST(0.9998419236), COEF_CONST(0.9998611991), COEF_CONST(0.9998881193), COEF_CONST(0.9999428861), COEF_CONST(0.9999786185), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045) },
+ { COEF_CONST(0.9999500038), COEF_CONST(0.9999561034), COEF_CONST(0.9999646206), COEF_CONST(0.9999819429), COEF_CONST(0.9999932409), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750) },
+ { COEF_CONST(0.9999841890), COEF_CONST(0.9999861183), COEF_CONST(0.9999888121), COEF_CONST(0.9999942902), COEF_CONST(0.9999978628), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605) },
+ { COEF_CONST(0.9999950000), COEF_CONST(0.9999956102), COEF_CONST(0.9999964621), COEF_CONST(0.9999981945), COEF_CONST(0.9999993242), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875) }
+};
+
+static const real_t cos_gammas_normal[][8] = {
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9913533967), COEF_CONST(0.9786000177), COEF_CONST(0.9496063381), COEF_CONST(0.9277157252), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9977406278), COEF_CONST(0.9945423840), COEF_CONST(0.9878736667), COEF_CONST(0.9833980494), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9990607067), COEF_CONST(0.9977417734), COEF_CONST(0.9950323970), COEF_CONST(0.9932453273), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) }
+};
+
+static const real_t cos_gammas_fine[][8] = {
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9899597309), COEF_CONST(0.9750098690), COEF_CONST(0.9402333855), COEF_CONST(0.9129698759), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9926607607), COEF_CONST(0.9819295710), COEF_CONST(0.9580160104), COEF_CONST(0.9404993670), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9972074644), COEF_CONST(0.9932414270), COEF_CONST(0.9849197629), COEF_CONST(0.9792926592), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9985361982), COEF_CONST(0.9964742028), COEF_CONST(0.9922136306), COEF_CONST(0.9893845420), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9992494366), COEF_CONST(0.9981967170), COEF_CONST(0.9960386625), COEF_CONST(0.9946185834), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9996194722), COEF_CONST(0.9990869422), COEF_CONST(0.9979996269), COEF_CONST(0.9972873651), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999390971), COEF_CONST(0.9998540271), COEF_CONST(0.9996809352), COEF_CONST(0.9995679735), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999807170), COEF_CONST(0.9999537862), COEF_CONST(0.9998990191), COEF_CONST(0.9998632947), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999938979), COEF_CONST(0.9999853814), COEF_CONST(0.9999680568), COEF_CONST(0.9999567596), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999980703), COEF_CONST(0.9999953731), COEF_CONST(0.9999898968), COEF_CONST(0.9999863277), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265) },
+ { COEF_CONST(1.0000000000), COEF_CONST(0.9999993891), COEF_CONST(0.9999985397), COEF_CONST(0.9999968037), COEF_CONST(0.9999956786), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155) }
+};
+
+static const real_t sin_gammas_normal[][8] = {
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1312190642), COEF_CONST(0.2057717310), COEF_CONST(0.3134450552), COEF_CONST(0.3732874674), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0671836269), COEF_CONST(0.1043333428), COEF_CONST(0.1552598422), COEF_CONST(0.1814615013), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0433324862), COEF_CONST(0.0671666110), COEF_CONST(0.0995516398), COEF_CONST(0.1160332699), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) }
+};
+
+static const real_t sin_gammas_fine[][8] = {
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1413496768), COEF_CONST(0.2221615526), COEF_CONST(0.3405307340), COEF_CONST(0.4080269669), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1209322714), COEF_CONST(0.1892467110), COEF_CONST(0.2867147079), COEF_CONST(0.3397954394), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0746811420), COEF_CONST(0.1160666523), COEF_CONST(0.1730117353), COEF_CONST(0.2024497161), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0540875291), COEF_CONST(0.0838997203), COEF_CONST(0.1245476266), COEF_CONST(0.1453211203), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0387371058), COEF_CONST(0.0600276114), COEF_CONST(0.0889212171), COEF_CONST(0.1036044086), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0275846110), COEF_CONST(0.0427233177), COEF_CONST(0.0632198125), COEF_CONST(0.0736064637), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0110363955), COEF_CONST(0.0170857974), COEF_CONST(0.0252592108), COEF_CONST(0.0293916021), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0062101284), COEF_CONST(0.0096138203), COEF_CONST(0.0142109649), COEF_CONST(0.0165345659), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0034934509), COEF_CONST(0.0054071189), COEF_CONST(0.0079928316), COEF_CONST(0.0092994041), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0019645397), COEF_CONST(0.0030419905), COEF_CONST(0.0044951511), COEF_CONST(0.0052291853), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498) },
+ { COEF_CONST(0.0000000000), COEF_CONST(0.0011053943), COEF_CONST(0.0017089869), COEF_CONST(0.0025283670), COEF_CONST(0.0029398552), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685) }
+};
+
+static const real_t sf_iid_normal[] = {
+ COEF_CONST(1.4119827747), COEF_CONST(1.4031381607), COEF_CONST(1.3868767023),
+ COEF_CONST(1.3483997583), COEF_CONST(1.2912493944), COEF_CONST(1.1960374117),
+ COEF_CONST(1.1073724031), COEF_CONST(1.0000000000), COEF_CONST(0.8796171546),
+ COEF_CONST(0.7546485662), COEF_CONST(0.5767799020), COEF_CONST(0.4264014363),
+ COEF_CONST(0.2767182887), COEF_CONST(0.1766446233), COEF_CONST(0.0794016272)
+};
+
+static const real_t sf_iid_fine[] = {
+ COEF_CONST(1.4142065048), COEF_CONST(1.4141912460), COEF_CONST(1.4141428471),
+ COEF_CONST(1.4139900208), COEF_CONST(1.4135069847), COEF_CONST(1.4119827747),
+ COEF_CONST(1.4097729921), COEF_CONST(1.4053947926), COEF_CONST(1.3967796564),
+ COEF_CONST(1.3800530434), COEF_CONST(1.3483997583), COEF_CONST(1.3139201403),
+ COEF_CONST(1.2643101215), COEF_CONST(1.1960374117), COEF_CONST(1.1073724031),
+ COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), COEF_CONST(0.7546485662),
+ COEF_CONST(0.6336560845), COEF_CONST(0.5230810642), COEF_CONST(0.4264014363),
+ COEF_CONST(0.3089554012), COEF_CONST(0.2213746458), COEF_CONST(0.1576878875),
+ COEF_CONST(0.1119822487), COEF_CONST(0.0794016272), COEF_CONST(0.0446990170),
+ COEF_CONST(0.0251446925), COEF_CONST(0.0141414283), COEF_CONST(0.0079525812),
+ COEF_CONST(0.0044721137)
+};
+
+#ifdef __cplusplus
+
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/pulse.c b/src/filters/transform/mpadecfilter/faad2/libfaad/pulse.c
new file mode 100644
index 000000000..06aa2dbf4
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/pulse.c
@@ -0,0 +1,60 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: pulse.c 441 2005-11-01 21:41:43Z gabest $
+**/
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+#include "pulse.h"
+
+uint8_t pulse_decode(ic_stream *ics, int16_t *spec_data, uint16_t framelen)
+{
+ uint8_t i;
+ uint16_t k;
+ pulse_info *pul = &(ics->pul);
+
+ k = ics->swb_offset[pul->pulse_start_sfb];
+
+ for (i = 0; i <= pul->number_pulse; i++)
+ {
+ k += pul->pulse_offset[i];
+
+ if (k >= framelen)
+ return 15; /* should not be possible */
+
+ if (spec_data[k] > 0)
+ spec_data[k] += pul->pulse_amp[i];
+ else
+ spec_data[k] -= pul->pulse_amp[i];
+ }
+
+ return 0;
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/pulse.h b/src/filters/transform/mpadecfilter/faad2/libfaad/pulse.h
new file mode 100644
index 000000000..b65330844
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/pulse.h
@@ -0,0 +1,45 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: pulse.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __PULSE_H__
+#define __PULSE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint8_t pulse_decode(ic_stream *ics, int16_t *spec_coef, uint16_t framelen);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/rvlc.c b/src/filters/transform/mpadecfilter/faad2/libfaad/rvlc.c
new file mode 100644
index 000000000..87ebcc507
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/rvlc.c
@@ -0,0 +1,535 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: rvlc.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* RVLC scalefactor decoding
+ *
+ * RVLC works like this:
+ * 1. Only symmetric huffman codewords are used
+ * 2. Total length of the scalefactor data is stored in the bitsream
+ * 3. Scalefactors are DPCM coded
+ * 4. Next to the starting value for DPCM the ending value is also stored
+ *
+ * With all this it is possible to read the scalefactor data from 2 sides.
+ * If there is a bit error in the scalefactor data it is possible to start
+ * decoding from the other end of the data, to find all but 1 scalefactor.
+ */
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+
+#include "syntax.h"
+#include "bits.h"
+#include "rvlc.h"
+
+
+#ifdef ERROR_RESILIENCE
+
+//#define PRINT_RVLC
+
+/* static function declarations */
+static uint8_t rvlc_decode_sf_forward(ic_stream *ics,
+ bitfile *ld_sf,
+ bitfile *ld_esc,
+ uint8_t *is_used);
+#if 0
+static uint8_t rvlc_decode_sf_reverse(ic_stream *ics,
+ bitfile *ld_sf,
+ bitfile *ld_esc,
+ uint8_t is_used);
+#endif
+static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc,
+ int8_t direction);
+static int8_t rvlc_huffman_esc(bitfile *ld_esc, int8_t direction);
+
+
+uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld)
+{
+ uint8_t bits = 9;
+
+ ics->sf_concealment = faad_get1bit(ld
+ DEBUGVAR(1,149,"rvlc_scale_factor_data(): sf_concealment"));
+ ics->rev_global_gain = (uint8_t)faad_getbits(ld, 8
+ DEBUGVAR(1,150,"rvlc_scale_factor_data(): rev_global_gain"));
+
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ bits = 11;
+
+ /* the number of bits used for the huffman codewords */
+ ics->length_of_rvlc_sf = (uint16_t)faad_getbits(ld, bits
+ DEBUGVAR(1,151,"rvlc_scale_factor_data(): length_of_rvlc_sf"));
+
+ if (ics->noise_used)
+ {
+ ics->dpcm_noise_nrg = (uint16_t)faad_getbits(ld, 9
+ DEBUGVAR(1,152,"rvlc_scale_factor_data(): dpcm_noise_nrg"));
+
+ ics->length_of_rvlc_sf -= 9;
+ }
+
+ ics->sf_escapes_present = faad_get1bit(ld
+ DEBUGVAR(1,153,"rvlc_scale_factor_data(): sf_escapes_present"));
+
+ if (ics->sf_escapes_present)
+ {
+ ics->length_of_rvlc_escapes = (uint8_t)faad_getbits(ld, 8
+ DEBUGVAR(1,154,"rvlc_scale_factor_data(): length_of_rvlc_escapes"));
+ }
+
+ if (ics->noise_used)
+ {
+ ics->dpcm_noise_last_position = (uint16_t)faad_getbits(ld, 9
+ DEBUGVAR(1,155,"rvlc_scale_factor_data(): dpcm_noise_last_position"));
+ }
+
+ return 0;
+}
+
+uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld)
+{
+ uint8_t result;
+ uint8_t intensity_used = 0;
+ uint8_t *rvlc_sf_buffer = NULL;
+ uint8_t *rvlc_esc_buffer = NULL;
+ bitfile ld_rvlc_sf, ld_rvlc_esc;
+// bitfile ld_rvlc_sf_rev, ld_rvlc_esc_rev;
+
+ if (ics->length_of_rvlc_sf > 0)
+ {
+ /* We read length_of_rvlc_sf bits here to put it in a
+ seperate bitfile.
+ */
+ rvlc_sf_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_sf
+ DEBUGVAR(1,156,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_sf"));
+
+ faad_initbits(&ld_rvlc_sf, (void*)rvlc_sf_buffer, bit2byte(ics->length_of_rvlc_sf));
+// faad_initbits_rev(&ld_rvlc_sf_rev, (void*)rvlc_sf_buffer,
+// ics->length_of_rvlc_sf);
+ }
+
+ if (ics->sf_escapes_present)
+ {
+ /* We read length_of_rvlc_escapes bits here to put it in a
+ seperate bitfile.
+ */
+ rvlc_esc_buffer = faad_getbitbuffer(ld, ics->length_of_rvlc_escapes
+ DEBUGVAR(1,157,"rvlc_decode_scale_factors(): bitbuffer: length_of_rvlc_escapes"));
+
+ faad_initbits(&ld_rvlc_esc, (void*)rvlc_esc_buffer, bit2byte(ics->length_of_rvlc_escapes));
+// faad_initbits_rev(&ld_rvlc_esc_rev, (void*)rvlc_esc_buffer,
+// ics->length_of_rvlc_escapes);
+ }
+
+ /* decode the rvlc scale factors and escapes */
+ result = rvlc_decode_sf_forward(ics, &ld_rvlc_sf,
+ &ld_rvlc_esc, &intensity_used);
+// result = rvlc_decode_sf_reverse(ics, &ld_rvlc_sf_rev,
+// &ld_rvlc_esc_rev, intensity_used);
+
+
+ if (rvlc_esc_buffer) faad_free(rvlc_esc_buffer);
+ if (rvlc_sf_buffer) faad_free(rvlc_sf_buffer);
+
+ if (ics->length_of_rvlc_sf > 0)
+ faad_endbits(&ld_rvlc_sf);
+ if (ics->sf_escapes_present)
+ faad_endbits(&ld_rvlc_esc);
+
+ return result;
+}
+
+static uint8_t rvlc_decode_sf_forward(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc,
+ uint8_t *intensity_used)
+{
+ int8_t g, sfb;
+ int8_t t = 0;
+ int8_t error = 0;
+ int8_t noise_pcm_flag = 1;
+
+ int16_t scale_factor = ics->global_gain;
+ int16_t is_position = 0;
+ int16_t noise_energy = ics->global_gain - 90 - 256;
+
+#ifdef PRINT_RVLC
+ printf("\nglobal_gain: %d\n", ics->global_gain);
+#endif
+
+ for (g = 0; g < ics->num_window_groups; g++)
+ {
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
+ {
+ if (error)
+ {
+ ics->scale_factors[g][sfb] = 0;
+ } else {
+ switch (ics->sfb_cb[g][sfb])
+ {
+ case ZERO_HCB: /* zero book */
+ ics->scale_factors[g][sfb] = 0;
+ break;
+ case INTENSITY_HCB: /* intensity books */
+ case INTENSITY_HCB2:
+
+ *intensity_used = 1;
+
+ /* decode intensity position */
+ t = rvlc_huffman_sf(ld_sf, ld_esc, +1);
+
+ is_position += t;
+ ics->scale_factors[g][sfb] = is_position;
+
+ break;
+ case NOISE_HCB: /* noise books */
+
+ /* decode noise energy */
+ if (noise_pcm_flag)
+ {
+ int16_t n = ics->dpcm_noise_nrg;
+ noise_pcm_flag = 0;
+ noise_energy += n;
+ } else {
+ t = rvlc_huffman_sf(ld_sf, ld_esc, +1);
+ noise_energy += t;
+ }
+
+ ics->scale_factors[g][sfb] = noise_energy;
+
+ break;
+ default: /* spectral books */
+
+ /* decode scale factor */
+ t = rvlc_huffman_sf(ld_sf, ld_esc, +1);
+
+ scale_factor += t;
+ if (scale_factor < 0)
+ return 4;
+
+ ics->scale_factors[g][sfb] = scale_factor;
+
+ break;
+ }
+#ifdef PRINT_RVLC
+ printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb],
+ ics->scale_factors[g][sfb]);
+#endif
+ if (t == 99)
+ {
+ error = 1;
+ }
+ }
+ }
+ }
+#ifdef PRINT_RVLC
+ printf("\n\n");
+#endif
+
+ return 0;
+}
+
+#if 0 // not used right now, doesn't work correctly yet
+static uint8_t rvlc_decode_sf_reverse(ic_stream *ics, bitfile *ld_sf, bitfile *ld_esc,
+ uint8_t intensity_used)
+{
+ int8_t g, sfb;
+ int8_t t = 0;
+ int8_t error = 0;
+ int8_t noise_pcm_flag = 1, is_pcm_flag = 1, sf_pcm_flag = 1;
+
+ int16_t scale_factor = ics->rev_global_gain;
+ int16_t is_position = 0;
+ int16_t noise_energy = ics->rev_global_gain;
+
+#ifdef PRINT_RVLC
+ printf("\nrev_global_gain: %d\n", ics->rev_global_gain);
+#endif
+
+ if (intensity_used)
+ {
+ is_position = rvlc_huffman_sf(ld_sf, ld_esc, -1);
+#ifdef PRINT_RVLC
+ printf("is_position: %d\n", is_position);
+#endif
+ }
+
+ for (g = ics->num_window_groups-1; g >= 0; g--)
+ {
+ for (sfb = ics->max_sfb-1; sfb >= 0; sfb--)
+ {
+ if (error)
+ {
+ ics->scale_factors[g][sfb] = 0;
+ } else {
+ switch (ics->sfb_cb[g][sfb])
+ {
+ case ZERO_HCB: /* zero book */
+ ics->scale_factors[g][sfb] = 0;
+ break;
+ case INTENSITY_HCB: /* intensity books */
+ case INTENSITY_HCB2:
+
+ if (is_pcm_flag)
+ {
+ is_pcm_flag = 0;
+ ics->scale_factors[g][sfb] = is_position;
+ } else {
+ t = rvlc_huffman_sf(ld_sf, ld_esc, -1);
+ is_position -= t;
+
+ ics->scale_factors[g][sfb] = (uint8_t)is_position;
+ }
+ break;
+ case NOISE_HCB: /* noise books */
+
+ /* decode noise energy */
+ if (noise_pcm_flag)
+ {
+ noise_pcm_flag = 0;
+ noise_energy = ics->dpcm_noise_last_position;
+ } else {
+ t = rvlc_huffman_sf(ld_sf, ld_esc, -1);
+ noise_energy -= t;
+ }
+
+ ics->scale_factors[g][sfb] = (uint8_t)noise_energy;
+ break;
+ default: /* spectral books */
+
+ if (sf_pcm_flag || (sfb == 0))
+ {
+ sf_pcm_flag = 0;
+ if (sfb == 0)
+ scale_factor = ics->global_gain;
+ } else {
+ /* decode scale factor */
+ t = rvlc_huffman_sf(ld_sf, ld_esc, -1);
+ scale_factor -= t;
+ }
+
+ if (scale_factor < 0)
+ return 4;
+
+ ics->scale_factors[g][sfb] = (uint8_t)scale_factor;
+ break;
+ }
+#ifdef PRINT_RVLC
+ printf("%3d:%4d%4d\n", sfb, ics->sfb_cb[g][sfb],
+ ics->scale_factors[g][sfb]);
+#endif
+ if (t == 99)
+ {
+ error = 1;
+ }
+ }
+ }
+ }
+
+#ifdef PRINT_RVLC
+ printf("\n\n");
+#endif
+
+ return 0;
+}
+#endif
+
+/* index == 99 means not allowed codeword */
+static rvlc_huff_table book_rvlc[] = {
+ /*index length codeword */
+ { 0, 1, 0 }, /* 0 */
+ { -1, 3, 5 }, /* 101 */
+ { 1, 3, 7 }, /* 111 */
+ { -2, 4, 9 }, /* 1001 */
+ { -3, 5, 17 }, /* 10001 */
+ { 2, 5, 27 }, /* 11011 */
+ { -4, 6, 33 }, /* 100001 */
+ { 99, 6, 50 }, /* 110010 */
+ { 3, 6, 51 }, /* 110011 */
+ { 99, 6, 52 }, /* 110100 */
+ { -7, 7, 65 }, /* 1000001 */
+ { 99, 7, 96 }, /* 1100000 */
+ { 99, 7, 98 }, /* 1100010 */
+ { 7, 7, 99 }, /* 1100011 */
+ { 4, 7, 107 }, /* 1101011 */
+ { -5, 8, 129 }, /* 10000001 */
+ { 99, 8, 194 }, /* 11000010 */
+ { 5, 8, 195 }, /* 11000011 */
+ { 99, 8, 212 }, /* 11010100 */
+ { 99, 9, 256 }, /* 100000000 */
+ { -6, 9, 257 }, /* 100000001 */
+ { 99, 9, 426 }, /* 110101010 */
+ { 6, 9, 427 }, /* 110101011 */
+ { 99, 10, 0 } /* Shouldn't come this far */
+};
+
+static rvlc_huff_table book_escape[] = {
+ /*index length codeword */
+ { 1, 2, 0 },
+ { 0, 2, 2 },
+ { 3, 3, 2 },
+ { 2, 3, 6 },
+ { 4, 4, 14 },
+ { 7, 5, 13 },
+ { 6, 5, 15 },
+ { 5, 5, 31 },
+ { 11, 6, 24 },
+ { 10, 6, 25 },
+ { 9, 6, 29 },
+ { 8, 6, 61 },
+ { 13, 7, 56 },
+ { 12, 7, 120 },
+ { 15, 8, 114 },
+ { 14, 8, 242 },
+ { 17, 9, 230 },
+ { 16, 9, 486 },
+ { 19, 10, 463 },
+ { 18, 10, 974 },
+ { 22, 11, 925 },
+ { 20, 11, 1950 },
+ { 21, 11, 1951 },
+ { 23, 12, 1848 },
+ { 25, 13, 3698 },
+ { 24, 14, 7399 },
+ { 26, 15, 14797 },
+ { 49, 19, 236736 },
+ { 50, 19, 236737 },
+ { 51, 19, 236738 },
+ { 52, 19, 236739 },
+ { 53, 19, 236740 },
+ { 27, 20, 473482 },
+ { 28, 20, 473483 },
+ { 29, 20, 473484 },
+ { 30, 20, 473485 },
+ { 31, 20, 473486 },
+ { 32, 20, 473487 },
+ { 33, 20, 473488 },
+ { 34, 20, 473489 },
+ { 35, 20, 473490 },
+ { 36, 20, 473491 },
+ { 37, 20, 473492 },
+ { 38, 20, 473493 },
+ { 39, 20, 473494 },
+ { 40, 20, 473495 },
+ { 41, 20, 473496 },
+ { 42, 20, 473497 },
+ { 43, 20, 473498 },
+ { 44, 20, 473499 },
+ { 45, 20, 473500 },
+ { 46, 20, 473501 },
+ { 47, 20, 473502 },
+ { 48, 20, 473503 },
+ { 99, 21, 0 } /* Shouldn't come this far */
+};
+
+static int8_t rvlc_huffman_sf(bitfile *ld_sf, bitfile *ld_esc,
+ int8_t direction)
+{
+ uint8_t i, j;
+ int8_t index;
+ uint32_t cw;
+ rvlc_huff_table *h = book_rvlc;
+
+ i = h->len;
+ if (direction > 0)
+ cw = faad_getbits(ld_sf, i DEBUGVAR(1,0,""));
+ else
+ cw = faad_getbits_rev(ld_sf, i DEBUGVAR(1,0,""));
+
+ while ((cw != h->cw)
+ && (i < 10))
+ {
+ h++;
+ j = h->len-i;
+ i += j;
+ cw <<= j;
+ if (direction > 0)
+ cw |= faad_getbits(ld_sf, j DEBUGVAR(1,0,""));
+ else
+ cw |= faad_getbits_rev(ld_sf, j DEBUGVAR(1,0,""));
+ }
+
+ index = h->index;
+
+ if (index == +ESC_VAL)
+ {
+ int8_t esc = rvlc_huffman_esc(ld_esc, direction);
+ if (esc == 99)
+ return 99;
+ index += esc;
+#ifdef PRINT_RVLC
+ printf("esc: %d - ", esc);
+#endif
+ }
+ if (index == -ESC_VAL)
+ {
+ int8_t esc = rvlc_huffman_esc(ld_esc, direction);
+ if (esc == 99)
+ return 99;
+ index -= esc;
+#ifdef PRINT_RVLC
+ printf("esc: %d - ", esc);
+#endif
+ }
+
+ return index;
+}
+
+static int8_t rvlc_huffman_esc(bitfile *ld,
+ int8_t direction)
+{
+ uint8_t i, j;
+ uint32_t cw;
+ rvlc_huff_table *h = book_escape;
+
+ i = h->len;
+ if (direction > 0)
+ cw = faad_getbits(ld, i DEBUGVAR(1,0,""));
+ else
+ cw = faad_getbits_rev(ld, i DEBUGVAR(1,0,""));
+
+ while ((cw != h->cw)
+ && (i < 21))
+ {
+ h++;
+ j = h->len-i;
+ i += j;
+ cw <<= j;
+ if (direction > 0)
+ cw |= faad_getbits(ld, j DEBUGVAR(1,0,""));
+ else
+ cw |= faad_getbits_rev(ld, j DEBUGVAR(1,0,""));
+ }
+
+ return h->index;
+}
+
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/rvlc.h b/src/filters/transform/mpadecfilter/faad2/libfaad/rvlc.h
new file mode 100644
index 000000000..058d0c277
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/rvlc.h
@@ -0,0 +1,58 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: rvlc.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __RVLC_SCF_H__
+#define __RVLC_SCF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct
+{
+ int8_t index;
+ uint8_t len;
+ uint32_t cw;
+} rvlc_huff_table;
+
+
+#define ESC_VAL 7
+
+
+uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld);
+uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dct.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dct.c
new file mode 100644
index 000000000..cbe5d94b9
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dct.c
@@ -0,0 +1,2276 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_dct.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+
+#ifdef SBR_DEC
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+
+#include "sbr_dct.h"
+
+void DCT4_32(real_t *y, real_t *x)
+{
+ real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+ real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+ real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
+ real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
+ real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
+ real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
+ real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70;
+ real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80;
+ real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90;
+ real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100;
+ real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110;
+ real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120;
+ real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130;
+ real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140;
+ real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150;
+ real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160;
+ real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170;
+ real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180;
+ real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190;
+ real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200;
+ real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210;
+ real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220;
+ real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230;
+ real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240;
+ real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250;
+ real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260;
+ real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270;
+ real_t f271, f272, f273, f274, f275, f276, f277, f278, f279, f280;
+ real_t f281, f282, f283, f284, f285, f286, f287, f288, f289, f290;
+ real_t f291, f292, f293, f294, f295, f296, f297, f298, f299, f300;
+ real_t f301, f302, f303, f304, f305, f306, f307, f310, f311, f312;
+ real_t f313, f316, f317, f318, f319, f322, f323, f324, f325, f328;
+ real_t f329, f330, f331, f334, f335, f336, f337, f340, f341, f342;
+ real_t f343, f346, f347, f348, f349, f352, f353, f354, f355, f358;
+ real_t f359, f360, f361, f364, f365, f366, f367, f370, f371, f372;
+ real_t f373, f376, f377, f378, f379, f382, f383, f384, f385, f388;
+ real_t f389, f390, f391, f394, f395, f396, f397;
+
+ f0 = x[15] - x[16];
+ f1 = x[15] + x[16];
+ f2 = MUL_F(FRAC_CONST(0.7071067811865476), f1);
+ f3 = MUL_F(FRAC_CONST(0.7071067811865476), f0);
+ f4 = x[8] - x[23];
+ f5 = x[8] + x[23];
+ f6 = MUL_F(FRAC_CONST(0.7071067811865476), f5);
+ f7 = MUL_F(FRAC_CONST(0.7071067811865476), f4);
+ f8 = x[12] - x[19];
+ f9 = x[12] + x[19];
+ f10 = MUL_F(FRAC_CONST(0.7071067811865476), f9);
+ f11 = MUL_F(FRAC_CONST(0.7071067811865476), f8);
+ f12 = x[11] - x[20];
+ f13 = x[11] + x[20];
+ f14 = MUL_F(FRAC_CONST(0.7071067811865476), f13);
+ f15 = MUL_F(FRAC_CONST(0.7071067811865476), f12);
+ f16 = x[14] - x[17];
+ f17 = x[14] + x[17];
+ f18 = MUL_F(FRAC_CONST(0.7071067811865476), f17);
+ f19 = MUL_F(FRAC_CONST(0.7071067811865476), f16);
+ f20 = x[9] - x[22];
+ f21 = x[9] + x[22];
+ f22 = MUL_F(FRAC_CONST(0.7071067811865476), f21);
+ f23 = MUL_F(FRAC_CONST(0.7071067811865476), f20);
+ f24 = x[13] - x[18];
+ f25 = x[13] + x[18];
+ f26 = MUL_F(FRAC_CONST(0.7071067811865476), f25);
+ f27 = MUL_F(FRAC_CONST(0.7071067811865476), f24);
+ f28 = x[10] - x[21];
+ f29 = x[10] + x[21];
+ f30 = MUL_F(FRAC_CONST(0.7071067811865476), f29);
+ f31 = MUL_F(FRAC_CONST(0.7071067811865476), f28);
+ f32 = x[0] - f2;
+ f33 = x[0] + f2;
+ f34 = x[31] - f3;
+ f35 = x[31] + f3;
+ f36 = x[7] - f6;
+ f37 = x[7] + f6;
+ f38 = x[24] - f7;
+ f39 = x[24] + f7;
+ f40 = x[3] - f10;
+ f41 = x[3] + f10;
+ f42 = x[28] - f11;
+ f43 = x[28] + f11;
+ f44 = x[4] - f14;
+ f45 = x[4] + f14;
+ f46 = x[27] - f15;
+ f47 = x[27] + f15;
+ f48 = x[1] - f18;
+ f49 = x[1] + f18;
+ f50 = x[30] - f19;
+ f51 = x[30] + f19;
+ f52 = x[6] - f22;
+ f53 = x[6] + f22;
+ f54 = x[25] - f23;
+ f55 = x[25] + f23;
+ f56 = x[2] - f26;
+ f57 = x[2] + f26;
+ f58 = x[29] - f27;
+ f59 = x[29] + f27;
+ f60 = x[5] - f30;
+ f61 = x[5] + f30;
+ f62 = x[26] - f31;
+ f63 = x[26] + f31;
+ f64 = f39 + f37;
+ f65 = MUL_F(FRAC_CONST(-0.5411961001461969), f39);
+ f66 = MUL_F(FRAC_CONST(0.9238795325112867), f64);
+ f67 = MUL_C(COEF_CONST(1.3065629648763766), f37);
+ f68 = f65 + f66;
+ f69 = f67 - f66;
+ f70 = f38 + f36;
+ f71 = MUL_C(COEF_CONST(1.3065629648763770), f38);
+ f72 = MUL_F(FRAC_CONST(-0.3826834323650904), f70);
+ f73 = MUL_F(FRAC_CONST(0.5411961001461961), f36);
+ f74 = f71 + f72;
+ f75 = f73 - f72;
+ f76 = f47 + f45;
+ f77 = MUL_F(FRAC_CONST(-0.5411961001461969), f47);
+ f78 = MUL_F(FRAC_CONST(0.9238795325112867), f76);
+ f79 = MUL_C(COEF_CONST(1.3065629648763766), f45);
+ f80 = f77 + f78;
+ f81 = f79 - f78;
+ f82 = f46 + f44;
+ f83 = MUL_C(COEF_CONST(1.3065629648763770), f46);
+ f84 = MUL_F(FRAC_CONST(-0.3826834323650904), f82);
+ f85 = MUL_F(FRAC_CONST(0.5411961001461961), f44);
+ f86 = f83 + f84;
+ f87 = f85 - f84;
+ f88 = f55 + f53;
+ f89 = MUL_F(FRAC_CONST(-0.5411961001461969), f55);
+ f90 = MUL_F(FRAC_CONST(0.9238795325112867), f88);
+ f91 = MUL_C(COEF_CONST(1.3065629648763766), f53);
+ f92 = f89 + f90;
+ f93 = f91 - f90;
+ f94 = f54 + f52;
+ f95 = MUL_C(COEF_CONST(1.3065629648763770), f54);
+ f96 = MUL_F(FRAC_CONST(-0.3826834323650904), f94);
+ f97 = MUL_F(FRAC_CONST(0.5411961001461961), f52);
+ f98 = f95 + f96;
+ f99 = f97 - f96;
+ f100 = f63 + f61;
+ f101 = MUL_F(FRAC_CONST(-0.5411961001461969), f63);
+ f102 = MUL_F(FRAC_CONST(0.9238795325112867), f100);
+ f103 = MUL_C(COEF_CONST(1.3065629648763766), f61);
+ f104 = f101 + f102;
+ f105 = f103 - f102;
+ f106 = f62 + f60;
+ f107 = MUL_C(COEF_CONST(1.3065629648763770), f62);
+ f108 = MUL_F(FRAC_CONST(-0.3826834323650904), f106);
+ f109 = MUL_F(FRAC_CONST(0.5411961001461961), f60);
+ f110 = f107 + f108;
+ f111 = f109 - f108;
+ f112 = f33 - f68;
+ f113 = f33 + f68;
+ f114 = f35 - f69;
+ f115 = f35 + f69;
+ f116 = f32 - f74;
+ f117 = f32 + f74;
+ f118 = f34 - f75;
+ f119 = f34 + f75;
+ f120 = f41 - f80;
+ f121 = f41 + f80;
+ f122 = f43 - f81;
+ f123 = f43 + f81;
+ f124 = f40 - f86;
+ f125 = f40 + f86;
+ f126 = f42 - f87;
+ f127 = f42 + f87;
+ f128 = f49 - f92;
+ f129 = f49 + f92;
+ f130 = f51 - f93;
+ f131 = f51 + f93;
+ f132 = f48 - f98;
+ f133 = f48 + f98;
+ f134 = f50 - f99;
+ f135 = f50 + f99;
+ f136 = f57 - f104;
+ f137 = f57 + f104;
+ f138 = f59 - f105;
+ f139 = f59 + f105;
+ f140 = f56 - f110;
+ f141 = f56 + f110;
+ f142 = f58 - f111;
+ f143 = f58 + f111;
+ f144 = f123 + f121;
+ f145 = MUL_F(FRAC_CONST(-0.7856949583871021), f123);
+ f146 = MUL_F(FRAC_CONST(0.9807852804032304), f144);
+ f147 = MUL_C(COEF_CONST(1.1758756024193588), f121);
+ f148 = f145 + f146;
+ f149 = f147 - f146;
+ f150 = f127 + f125;
+ f151 = MUL_F(FRAC_CONST(0.2758993792829431), f127);
+ f152 = MUL_F(FRAC_CONST(0.5555702330196022), f150);
+ f153 = MUL_C(COEF_CONST(1.3870398453221475), f125);
+ f154 = f151 + f152;
+ f155 = f153 - f152;
+ f156 = f122 + f120;
+ f157 = MUL_C(COEF_CONST(1.1758756024193591), f122);
+ f158 = MUL_F(FRAC_CONST(-0.1950903220161287), f156);
+ f159 = MUL_F(FRAC_CONST(0.7856949583871016), f120);
+ f160 = f157 + f158;
+ f161 = f159 - f158;
+ f162 = f126 + f124;
+ f163 = MUL_C(COEF_CONST(1.3870398453221473), f126);
+ f164 = MUL_F(FRAC_CONST(-0.8314696123025455), f162);
+ f165 = MUL_F(FRAC_CONST(-0.2758993792829436), f124);
+ f166 = f163 + f164;
+ f167 = f165 - f164;
+ f168 = f139 + f137;
+ f169 = MUL_F(FRAC_CONST(-0.7856949583871021), f139);
+ f170 = MUL_F(FRAC_CONST(0.9807852804032304), f168);
+ f171 = MUL_C(COEF_CONST(1.1758756024193588), f137);
+ f172 = f169 + f170;
+ f173 = f171 - f170;
+ f174 = f143 + f141;
+ f175 = MUL_F(FRAC_CONST(0.2758993792829431), f143);
+ f176 = MUL_F(FRAC_CONST(0.5555702330196022), f174);
+ f177 = MUL_C(COEF_CONST(1.3870398453221475), f141);
+ f178 = f175 + f176;
+ f179 = f177 - f176;
+ f180 = f138 + f136;
+ f181 = MUL_C(COEF_CONST(1.1758756024193591), f138);
+ f182 = MUL_F(FRAC_CONST(-0.1950903220161287), f180);
+ f183 = MUL_F(FRAC_CONST(0.7856949583871016), f136);
+ f184 = f181 + f182;
+ f185 = f183 - f182;
+ f186 = f142 + f140;
+ f187 = MUL_C(COEF_CONST(1.3870398453221473), f142);
+ f188 = MUL_F(FRAC_CONST(-0.8314696123025455), f186);
+ f189 = MUL_F(FRAC_CONST(-0.2758993792829436), f140);
+ f190 = f187 + f188;
+ f191 = f189 - f188;
+ f192 = f113 - f148;
+ f193 = f113 + f148;
+ f194 = f115 - f149;
+ f195 = f115 + f149;
+ f196 = f117 - f154;
+ f197 = f117 + f154;
+ f198 = f119 - f155;
+ f199 = f119 + f155;
+ f200 = f112 - f160;
+ f201 = f112 + f160;
+ f202 = f114 - f161;
+ f203 = f114 + f161;
+ f204 = f116 - f166;
+ f205 = f116 + f166;
+ f206 = f118 - f167;
+ f207 = f118 + f167;
+ f208 = f129 - f172;
+ f209 = f129 + f172;
+ f210 = f131 - f173;
+ f211 = f131 + f173;
+ f212 = f133 - f178;
+ f213 = f133 + f178;
+ f214 = f135 - f179;
+ f215 = f135 + f179;
+ f216 = f128 - f184;
+ f217 = f128 + f184;
+ f218 = f130 - f185;
+ f219 = f130 + f185;
+ f220 = f132 - f190;
+ f221 = f132 + f190;
+ f222 = f134 - f191;
+ f223 = f134 + f191;
+ f224 = f211 + f209;
+ f225 = MUL_F(FRAC_CONST(-0.8971675863426361), f211);
+ f226 = MUL_F(FRAC_CONST(0.9951847266721968), f224);
+ f227 = MUL_C(COEF_CONST(1.0932018670017576), f209);
+ f228 = f225 + f226;
+ f229 = f227 - f226;
+ f230 = f215 + f213;
+ f231 = MUL_F(FRAC_CONST(-0.4105245275223571), f215);
+ f232 = MUL_F(FRAC_CONST(0.8819212643483549), f230);
+ f233 = MUL_C(COEF_CONST(1.3533180011743529), f213);
+ f234 = f231 + f232;
+ f235 = f233 - f232;
+ f236 = f219 + f217;
+ f237 = MUL_F(FRAC_CONST(0.1386171691990915), f219);
+ f238 = MUL_F(FRAC_CONST(0.6343932841636455), f236);
+ f239 = MUL_C(COEF_CONST(1.4074037375263826), f217);
+ f240 = f237 + f238;
+ f241 = f239 - f238;
+ f242 = f223 + f221;
+ f243 = MUL_F(FRAC_CONST(0.6666556584777466), f223);
+ f244 = MUL_F(FRAC_CONST(0.2902846772544623), f242);
+ f245 = MUL_C(COEF_CONST(1.2472250129866711), f221);
+ f246 = f243 + f244;
+ f247 = f245 - f244;
+ f248 = f210 + f208;
+ f249 = MUL_C(COEF_CONST(1.0932018670017574), f210);
+ f250 = MUL_F(FRAC_CONST(-0.0980171403295605), f248);
+ f251 = MUL_F(FRAC_CONST(0.8971675863426364), f208);
+ f252 = f249 + f250;
+ f253 = f251 - f250;
+ f254 = f214 + f212;
+ f255 = MUL_C(COEF_CONST(1.3533180011743529), f214);
+ f256 = MUL_F(FRAC_CONST(-0.4713967368259979), f254);
+ f257 = MUL_F(FRAC_CONST(0.4105245275223569), f212);
+ f258 = f255 + f256;
+ f259 = f257 - f256;
+ f260 = f218 + f216;
+ f261 = MUL_C(COEF_CONST(1.4074037375263826), f218);
+ f262 = MUL_F(FRAC_CONST(-0.7730104533627369), f260);
+ f263 = MUL_F(FRAC_CONST(-0.1386171691990913), f216);
+ f264 = f261 + f262;
+ f265 = f263 - f262;
+ f266 = f222 + f220;
+ f267 = MUL_C(COEF_CONST(1.2472250129866711), f222);
+ f268 = MUL_F(FRAC_CONST(-0.9569403357322089), f266);
+ f269 = MUL_F(FRAC_CONST(-0.6666556584777469), f220);
+ f270 = f267 + f268;
+ f271 = f269 - f268;
+ f272 = f193 - f228;
+ f273 = f193 + f228;
+ f274 = f195 - f229;
+ f275 = f195 + f229;
+ f276 = f197 - f234;
+ f277 = f197 + f234;
+ f278 = f199 - f235;
+ f279 = f199 + f235;
+ f280 = f201 - f240;
+ f281 = f201 + f240;
+ f282 = f203 - f241;
+ f283 = f203 + f241;
+ f284 = f205 - f246;
+ f285 = f205 + f246;
+ f286 = f207 - f247;
+ f287 = f207 + f247;
+ f288 = f192 - f252;
+ f289 = f192 + f252;
+ f290 = f194 - f253;
+ f291 = f194 + f253;
+ f292 = f196 - f258;
+ f293 = f196 + f258;
+ f294 = f198 - f259;
+ f295 = f198 + f259;
+ f296 = f200 - f264;
+ f297 = f200 + f264;
+ f298 = f202 - f265;
+ f299 = f202 + f265;
+ f300 = f204 - f270;
+ f301 = f204 + f270;
+ f302 = f206 - f271;
+ f303 = f206 + f271;
+ f304 = f275 + f273;
+ f305 = MUL_F(FRAC_CONST(-0.9751575901732920), f275);
+ f306 = MUL_F(FRAC_CONST(0.9996988186962043), f304);
+ f307 = MUL_C(COEF_CONST(1.0242400472191164), f273);
+ y[0] = f305 + f306;
+ y[31] = f307 - f306;
+ f310 = f279 + f277;
+ f311 = MUL_F(FRAC_CONST(-0.8700688593994936), f279);
+ f312 = MUL_F(FRAC_CONST(0.9924795345987100), f310);
+ f313 = MUL_C(COEF_CONST(1.1148902097979263), f277);
+ y[2] = f311 + f312;
+ y[29] = f313 - f312;
+ f316 = f283 + f281;
+ f317 = MUL_F(FRAC_CONST(-0.7566008898816587), f283);
+ f318 = MUL_F(FRAC_CONST(0.9757021300385286), f316);
+ f319 = MUL_C(COEF_CONST(1.1948033701953984), f281);
+ y[4] = f317 + f318;
+ y[27] = f319 - f318;
+ f322 = f287 + f285;
+ f323 = MUL_F(FRAC_CONST(-0.6358464401941451), f287);
+ f324 = MUL_F(FRAC_CONST(0.9495281805930367), f322);
+ f325 = MUL_C(COEF_CONST(1.2632099209919283), f285);
+ y[6] = f323 + f324;
+ y[25] = f325 - f324;
+ f328 = f291 + f289;
+ f329 = MUL_F(FRAC_CONST(-0.5089684416985408), f291);
+ f330 = MUL_F(FRAC_CONST(0.9142097557035307), f328);
+ f331 = MUL_C(COEF_CONST(1.3194510697085207), f289);
+ y[8] = f329 + f330;
+ y[23] = f331 - f330;
+ f334 = f295 + f293;
+ f335 = MUL_F(FRAC_CONST(-0.3771887988789273), f295);
+ f336 = MUL_F(FRAC_CONST(0.8700869911087114), f334);
+ f337 = MUL_C(COEF_CONST(1.3629851833384954), f293);
+ y[10] = f335 + f336;
+ y[21] = f337 - f336;
+ f340 = f299 + f297;
+ f341 = MUL_F(FRAC_CONST(-0.2417766217337384), f299);
+ f342 = MUL_F(FRAC_CONST(0.8175848131515837), f340);
+ f343 = MUL_C(COEF_CONST(1.3933930045694289), f297);
+ y[12] = f341 + f342;
+ y[19] = f343 - f342;
+ f346 = f303 + f301;
+ f347 = MUL_F(FRAC_CONST(-0.1040360035527077), f303);
+ f348 = MUL_F(FRAC_CONST(0.7572088465064845), f346);
+ f349 = MUL_C(COEF_CONST(1.4103816894602612), f301);
+ y[14] = f347 + f348;
+ y[17] = f349 - f348;
+ f352 = f274 + f272;
+ f353 = MUL_F(FRAC_CONST(0.0347065382144002), f274);
+ f354 = MUL_F(FRAC_CONST(0.6895405447370668), f352);
+ f355 = MUL_C(COEF_CONST(1.4137876276885337), f272);
+ y[16] = f353 + f354;
+ y[15] = f355 - f354;
+ f358 = f278 + f276;
+ f359 = MUL_F(FRAC_CONST(0.1731148370459795), f278);
+ f360 = MUL_F(FRAC_CONST(0.6152315905806268), f358);
+ f361 = MUL_C(COEF_CONST(1.4035780182072330), f276);
+ y[18] = f359 + f360;
+ y[13] = f361 - f360;
+ f364 = f282 + f280;
+ f365 = MUL_F(FRAC_CONST(0.3098559453626100), f282);
+ f366 = MUL_F(FRAC_CONST(0.5349976198870972), f364);
+ f367 = MUL_C(COEF_CONST(1.3798511851368043), f280);
+ y[20] = f365 + f366;
+ y[11] = f367 - f366;
+ f370 = f286 + f284;
+ f371 = MUL_F(FRAC_CONST(0.4436129715409088), f286);
+ f372 = MUL_F(FRAC_CONST(0.4496113296546065), f370);
+ f373 = MUL_C(COEF_CONST(1.3428356308501219), f284);
+ y[22] = f371 + f372;
+ y[9] = f373 - f372;
+ f376 = f290 + f288;
+ f377 = MUL_F(FRAC_CONST(0.5730977622997509), f290);
+ f378 = MUL_F(FRAC_CONST(0.3598950365349881), f376);
+ f379 = MUL_C(COEF_CONST(1.2928878353697271), f288);
+ y[24] = f377 + f378;
+ y[7] = f379 - f378;
+ f382 = f294 + f292;
+ f383 = MUL_F(FRAC_CONST(0.6970633083205415), f294);
+ f384 = MUL_F(FRAC_CONST(0.2667127574748984), f382);
+ f385 = MUL_C(COEF_CONST(1.2304888232703382), f292);
+ y[26] = f383 + f384;
+ y[5] = f385 - f384;
+ f388 = f298 + f296;
+ f389 = MUL_F(FRAC_CONST(0.8143157536286401), f298);
+ f390 = MUL_F(FRAC_CONST(0.1709618887603012), f388);
+ f391 = MUL_C(COEF_CONST(1.1562395311492424), f296);
+ y[28] = f389 + f390;
+ y[3] = f391 - f390;
+ f394 = f302 + f300;
+ f395 = MUL_F(FRAC_CONST(0.9237258930790228), f302);
+ f396 = MUL_F(FRAC_CONST(0.0735645635996674), f394);
+ f397 = MUL_C(COEF_CONST(1.0708550202783576), f300);
+ y[30] = f395 + f396;
+ y[1] = f397 - f396;
+}
+
+#ifdef SBR_LOW_POWER
+
+void DCT2_16_unscaled(real_t *y, real_t *x)
+{
+ real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+ real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+ real_t f21, f22, f23, f24, f25, f26, f27, f28, f31, f32;
+ real_t f33, f34, f37, f38, f39, f40, f41, f42, f43, f44;
+ real_t f45, f46, f47, f48, f49, f51, f53, f54, f57, f58;
+ real_t f59, f60, f61, f62, f63, f64, f65, f66, f67, f68;
+ real_t f69, f70, f71, f72, f73, f74, f75, f76, f77, f78;
+ real_t f79, f80, f81, f82, f83, f84, f85, f86, f87, f88;
+ real_t f89, f90, f91, f92, f95, f96, f97, f98, f101, f102;
+ real_t f103, f104, f107, f108, f109, f110;
+
+ f0 = x[0] - x[15];
+ f1 = x[0] + x[15];
+ f2 = x[1] - x[14];
+ f3 = x[1] + x[14];
+ f4 = x[2] - x[13];
+ f5 = x[2] + x[13];
+ f6 = x[3] - x[12];
+ f7 = x[3] + x[12];
+ f8 = x[4] - x[11];
+ f9 = x[4] + x[11];
+ f10 = x[5] - x[10];
+ f11 = x[5] + x[10];
+ f12 = x[6] - x[9];
+ f13 = x[6] + x[9];
+ f14 = x[7] - x[8];
+ f15 = x[7] + x[8];
+ f16 = f1 - f15;
+ f17 = f1 + f15;
+ f18 = f3 - f13;
+ f19 = f3 + f13;
+ f20 = f5 - f11;
+ f21 = f5 + f11;
+ f22 = f7 - f9;
+ f23 = f7 + f9;
+ f24 = f17 - f23;
+ f25 = f17 + f23;
+ f26 = f19 - f21;
+ f27 = f19 + f21;
+ f28 = f25 - f27;
+ y[0] = f25 + f27;
+ y[8] = MUL_F(f28, FRAC_CONST(0.7071067811865476));
+ f31 = f24 + f26;
+ f32 = MUL_C(f24, COEF_CONST(1.3065629648763766));
+ f33 = MUL_F(f31, FRAC_CONST(-0.9238795325112866));
+ f34 = MUL_F(f26, FRAC_CONST(-0.5411961001461967));
+ y[12] = f32 + f33;
+ y[4] = f34 - f33;
+ f37 = f16 + f22;
+ f38 = MUL_C(f16, COEF_CONST(1.1758756024193588));
+ f39 = MUL_F(f37, FRAC_CONST(-0.9807852804032304));
+ f40 = MUL_F(f22, FRAC_CONST(-0.7856949583871021));
+ f41 = f38 + f39;
+ f42 = f40 - f39;
+ f43 = f18 + f20;
+ f44 = MUL_C(f18, COEF_CONST(1.3870398453221473));
+ f45 = MUL_F(f43, FRAC_CONST(-0.8314696123025455));
+ f46 = MUL_F(f20, FRAC_CONST(-0.2758993792829436));
+ f47 = f44 + f45;
+ f48 = f46 - f45;
+ f49 = f42 - f48;
+ y[2] = f42 + f48;
+ f51 = MUL_F(f49, FRAC_CONST(0.7071067811865476));
+ y[14] = f41 - f47;
+ f53 = f41 + f47;
+ f54 = MUL_F(f53, FRAC_CONST(0.7071067811865476));
+ y[10] = f51 - f54;
+ y[6] = f51 + f54;
+ f57 = f2 - f4;
+ f58 = f2 + f4;
+ f59 = f6 - f8;
+ f60 = f6 + f8;
+ f61 = f10 - f12;
+ f62 = f10 + f12;
+ f63 = MUL_F(f60, FRAC_CONST(0.7071067811865476));
+ f64 = f0 - f63;
+ f65 = f0 + f63;
+ f66 = f58 + f62;
+ f67 = MUL_C(f58, COEF_CONST(1.3065629648763766));
+ f68 = MUL_F(f66, FRAC_CONST(-0.9238795325112866));
+ f69 = MUL_F(f62, FRAC_CONST(-0.5411961001461967));
+ f70 = f67 + f68;
+ f71 = f69 - f68;
+ f72 = f65 - f71;
+ f73 = f65 + f71;
+ f74 = f64 - f70;
+ f75 = f64 + f70;
+ f76 = MUL_F(f59, FRAC_CONST(0.7071067811865476));
+ f77 = f14 - f76;
+ f78 = f14 + f76;
+ f79 = f61 + f57;
+ f80 = MUL_C(f61, COEF_CONST(1.3065629648763766));
+ f81 = MUL_F(f79, FRAC_CONST(-0.9238795325112866));
+ f82 = MUL_F(f57, FRAC_CONST(-0.5411961001461967));
+ f83 = f80 + f81;
+ f84 = f82 - f81;
+ f85 = f78 - f84;
+ f86 = f78 + f84;
+ f87 = f77 - f83;
+ f88 = f77 + f83;
+ f89 = f86 + f73;
+ f90 = MUL_F(f86, FRAC_CONST(-0.8971675863426361));
+ f91 = MUL_F(f89, FRAC_CONST(0.9951847266721968));
+ f92 = MUL_C(f73, COEF_CONST(1.0932018670017576));
+ y[1] = f90 + f91;
+ y[15] = f92 - f91;
+ f95 = f75 - f88;
+ f96 = MUL_F(f88, FRAC_CONST(-0.6666556584777466));
+ f97 = MUL_F(f95, FRAC_CONST(0.9569403357322089));
+ f98 = MUL_C(f75, COEF_CONST(1.2472250129866713));
+ y[3] = f97 - f96;
+ y[13] = f98 - f97;
+ f101 = f87 + f74;
+ f102 = MUL_F(f87, FRAC_CONST(-0.4105245275223571));
+ f103 = MUL_F(f101, FRAC_CONST(0.8819212643483549));
+ f104 = MUL_C(f74, COEF_CONST(1.3533180011743529));
+ y[5] = f102 + f103;
+ y[11] = f104 - f103;
+ f107 = f72 - f85;
+ f108 = MUL_F(f85, FRAC_CONST(-0.1386171691990915));
+ f109 = MUL_F(f107, FRAC_CONST(0.7730104533627370));
+ f110 = MUL_C(f72, COEF_CONST(1.4074037375263826));
+ y[7] = f109 - f108;
+ y[9] = f110 - f109;
+}
+
+void DCT4_16(real_t *y, real_t *x)
+{
+ real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+ real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+ real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
+ real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
+ real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
+ real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
+ real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70;
+ real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80;
+ real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90;
+ real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100;
+ real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110;
+ real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120;
+ real_t f121, f122, f123, f124, f125, f126, f127, f128, f130, f132;
+ real_t f134, f136, f138, f140, f142, f144, f145, f148, f149, f152;
+ real_t f153, f156, f157;
+
+ f0 = x[0] + x[15];
+ f1 = MUL_C(COEF_CONST(1.0478631305325901), x[0]);
+ f2 = MUL_F(FRAC_CONST(-0.9987954562051724), f0);
+ f3 = MUL_F(FRAC_CONST(-0.9497277818777548), x[15]);
+ f4 = f1 + f2;
+ f5 = f3 - f2;
+ f6 = x[2] + x[13];
+ f7 = MUL_C(COEF_CONST(1.2130114330978077), x[2]);
+ f8 = MUL_F(FRAC_CONST(-0.9700312531945440), f6);
+ f9 = MUL_F(FRAC_CONST(-0.7270510732912803), x[13]);
+ f10 = f7 + f8;
+ f11 = f9 - f8;
+ f12 = x[4] + x[11];
+ f13 = MUL_C(COEF_CONST(1.3315443865537255), x[4]);
+ f14 = MUL_F(FRAC_CONST(-0.9039892931234433), f12);
+ f15 = MUL_F(FRAC_CONST(-0.4764341996931612), x[11]);
+ f16 = f13 + f14;
+ f17 = f15 - f14;
+ f18 = x[6] + x[9];
+ f19 = MUL_C(COEF_CONST(1.3989068359730781), x[6]);
+ f20 = MUL_F(FRAC_CONST(-0.8032075314806453), f18);
+ f21 = MUL_F(FRAC_CONST(-0.2075082269882124), x[9]);
+ f22 = f19 + f20;
+ f23 = f21 - f20;
+ f24 = x[8] + x[7];
+ f25 = MUL_C(COEF_CONST(1.4125100802019777), x[8]);
+ f26 = MUL_F(FRAC_CONST(-0.6715589548470187), f24);
+ f27 = MUL_F(FRAC_CONST(0.0693921705079402), x[7]);
+ f28 = f25 + f26;
+ f29 = f27 - f26;
+ f30 = x[10] + x[5];
+ f31 = MUL_C(COEF_CONST(1.3718313541934939), x[10]);
+ f32 = MUL_F(FRAC_CONST(-0.5141027441932219), f30);
+ f33 = MUL_F(FRAC_CONST(0.3436258658070501), x[5]);
+ f34 = f31 + f32;
+ f35 = f33 - f32;
+ f36 = x[12] + x[3];
+ f37 = MUL_C(COEF_CONST(1.2784339185752409), x[12]);
+ f38 = MUL_F(FRAC_CONST(-0.3368898533922200), f36);
+ f39 = MUL_F(FRAC_CONST(0.6046542117908008), x[3]);
+ f40 = f37 + f38;
+ f41 = f39 - f38;
+ f42 = x[14] + x[1];
+ f43 = MUL_C(COEF_CONST(1.1359069844201433), x[14]);
+ f44 = MUL_F(FRAC_CONST(-0.1467304744553624), f42);
+ f45 = MUL_F(FRAC_CONST(0.8424460355094185), x[1]);
+ f46 = f43 + f44;
+ f47 = f45 - f44;
+ f48 = f5 - f29;
+ f49 = f5 + f29;
+ f50 = f4 - f28;
+ f51 = f4 + f28;
+ f52 = f11 - f35;
+ f53 = f11 + f35;
+ f54 = f10 - f34;
+ f55 = f10 + f34;
+ f56 = f17 - f41;
+ f57 = f17 + f41;
+ f58 = f16 - f40;
+ f59 = f16 + f40;
+ f60 = f23 - f47;
+ f61 = f23 + f47;
+ f62 = f22 - f46;
+ f63 = f22 + f46;
+ f64 = f48 + f50;
+ f65 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+ f66 = MUL_F(FRAC_CONST(-0.9807852804032304), f64);
+ f67 = MUL_F(FRAC_CONST(-0.7856949583871021), f50);
+ f68 = f65 + f66;
+ f69 = f67 - f66;
+ f70 = f52 + f54;
+ f71 = MUL_C(COEF_CONST(1.3870398453221475), f52);
+ f72 = MUL_F(FRAC_CONST(-0.5555702330196022), f70);
+ f73 = MUL_F(FRAC_CONST(0.2758993792829431), f54);
+ f74 = f71 + f72;
+ f75 = f73 - f72;
+ f76 = f56 + f58;
+ f77 = MUL_F(FRAC_CONST(0.7856949583871022), f56);
+ f78 = MUL_F(FRAC_CONST(0.1950903220161283), f76);
+ f79 = MUL_C(COEF_CONST(1.1758756024193586), f58);
+ f80 = f77 + f78;
+ f81 = f79 - f78;
+ f82 = f60 + f62;
+ f83 = MUL_F(FRAC_CONST(-0.2758993792829430), f60);
+ f84 = MUL_F(FRAC_CONST(0.8314696123025452), f82);
+ f85 = MUL_C(COEF_CONST(1.3870398453221475), f62);
+ f86 = f83 + f84;
+ f87 = f85 - f84;
+ f88 = f49 - f57;
+ f89 = f49 + f57;
+ f90 = f51 - f59;
+ f91 = f51 + f59;
+ f92 = f53 - f61;
+ f93 = f53 + f61;
+ f94 = f55 - f63;
+ f95 = f55 + f63;
+ f96 = f69 - f81;
+ f97 = f69 + f81;
+ f98 = f68 - f80;
+ f99 = f68 + f80;
+ f100 = f75 - f87;
+ f101 = f75 + f87;
+ f102 = f74 - f86;
+ f103 = f74 + f86;
+ f104 = f88 + f90;
+ f105 = MUL_C(COEF_CONST(1.3065629648763766), f88);
+ f106 = MUL_F(FRAC_CONST(-0.9238795325112866), f104);
+ f107 = MUL_F(FRAC_CONST(-0.5411961001461967), f90);
+ f108 = f105 + f106;
+ f109 = f107 - f106;
+ f110 = f92 + f94;
+ f111 = MUL_F(FRAC_CONST(0.5411961001461969), f92);
+ f112 = MUL_F(FRAC_CONST(0.3826834323650898), f110);
+ f113 = MUL_C(COEF_CONST(1.3065629648763766), f94);
+ f114 = f111 + f112;
+ f115 = f113 - f112;
+ f116 = f96 + f98;
+ f117 = MUL_C(COEF_CONST(1.3065629648763766), f96);
+ f118 = MUL_F(FRAC_CONST(-0.9238795325112866), f116);
+ f119 = MUL_F(FRAC_CONST(-0.5411961001461967), f98);
+ f120 = f117 + f118;
+ f121 = f119 - f118;
+ f122 = f100 + f102;
+ f123 = MUL_F(FRAC_CONST(0.5411961001461969), f100);
+ f124 = MUL_F(FRAC_CONST(0.3826834323650898), f122);
+ f125 = MUL_C(COEF_CONST(1.3065629648763766), f102);
+ f126 = f123 + f124;
+ f127 = f125 - f124;
+ f128 = f89 - f93;
+ y[0] = f89 + f93;
+ f130 = f91 - f95;
+ y[15] = f91 + f95;
+ f132 = f109 - f115;
+ y[3] = f109 + f115;
+ f134 = f108 - f114;
+ y[12] = f108 + f114;
+ f136 = f97 - f101;
+ y[1] = f97 + f101;
+ f138 = f99 - f103;
+ y[14] = f99 + f103;
+ f140 = f121 - f127;
+ y[2] = f121 + f127;
+ f142 = f120 - f126;
+ y[13] = f120 + f126;
+ f144 = f128 - f130;
+ f145 = f128 + f130;
+ y[8] = MUL_F(FRAC_CONST(0.7071067811865474), f144);
+ y[7] = MUL_F(FRAC_CONST(0.7071067811865474), f145);
+ f148 = f132 - f134;
+ f149 = f132 + f134;
+ y[11] = MUL_F(FRAC_CONST(0.7071067811865474), f148);
+ y[4] = MUL_F(FRAC_CONST(0.7071067811865474), f149);
+ f152 = f136 - f138;
+ f153 = f136 + f138;
+ y[9] = MUL_F(FRAC_CONST(0.7071067811865474), f152);
+ y[6] = MUL_F(FRAC_CONST(0.7071067811865474), f153);
+ f156 = f140 - f142;
+ f157 = f140 + f142;
+ y[10] = MUL_F(FRAC_CONST(0.7071067811865474), f156);
+ y[5] = MUL_F(FRAC_CONST(0.7071067811865474), f157);
+}
+
+void DCT3_32_unscaled(real_t *y, real_t *x)
+{
+ real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+ real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+ real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
+ real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
+ real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
+ real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
+ real_t f61, f62, f63, f64, f65, f66, f67, f68, f69, f70;
+ real_t f71, f72, f73, f74, f75, f76, f77, f78, f79, f80;
+ real_t f81, f82, f83, f84, f85, f86, f87, f88, f89, f90;
+ real_t f91, f92, f93, f94, f95, f96, f97, f98, f99, f100;
+ real_t f101, f102, f103, f104, f105, f106, f107, f108, f109, f110;
+ real_t f111, f112, f113, f114, f115, f116, f117, f118, f119, f120;
+ real_t f121, f122, f123, f124, f125, f126, f127, f128, f129, f130;
+ real_t f131, f132, f133, f134, f135, f136, f137, f138, f139, f140;
+ real_t f141, f142, f143, f144, f145, f146, f147, f148, f149, f150;
+ real_t f151, f152, f153, f154, f155, f156, f157, f158, f159, f160;
+ real_t f161, f162, f163, f164, f165, f166, f167, f168, f169, f170;
+ real_t f171, f172, f173, f174, f175, f176, f177, f178, f179, f180;
+ real_t f181, f182, f183, f184, f185, f186, f187, f188, f189, f190;
+ real_t f191, f192, f193, f194, f195, f196, f197, f198, f199, f200;
+ real_t f201, f202, f203, f204, f205, f206, f207, f208, f209, f210;
+ real_t f211, f212, f213, f214, f215, f216, f217, f218, f219, f220;
+ real_t f221, f222, f223, f224, f225, f226, f227, f228, f229, f230;
+ real_t f231, f232, f233, f234, f235, f236, f237, f238, f239, f240;
+ real_t f241, f242, f243, f244, f245, f246, f247, f248, f249, f250;
+ real_t f251, f252, f253, f254, f255, f256, f257, f258, f259, f260;
+ real_t f261, f262, f263, f264, f265, f266, f267, f268, f269, f270;
+ real_t f271, f272;
+
+ f0 = MUL_F(x[16], FRAC_CONST(0.7071067811865476));
+ f1 = x[0] - f0;
+ f2 = x[0] + f0;
+ f3 = x[8] + x[24];
+ f4 = MUL_C(x[8], COEF_CONST(1.3065629648763766));
+ f5 = MUL_F(f3, FRAC_CONST((-0.9238795325112866)));
+ f6 = MUL_F(x[24], FRAC_CONST((-0.5411961001461967)));
+ f7 = f4 + f5;
+ f8 = f6 - f5;
+ f9 = f2 - f8;
+ f10 = f2 + f8;
+ f11 = f1 - f7;
+ f12 = f1 + f7;
+ f13 = x[4] + x[28];
+ f14 = MUL_C(x[4], COEF_CONST(1.1758756024193588));
+ f15 = MUL_F(f13, FRAC_CONST((-0.9807852804032304)));
+ f16 = MUL_F(x[28], FRAC_CONST((-0.7856949583871021)));
+ f17 = f14 + f15;
+ f18 = f16 - f15;
+ f19 = x[12] + x[20];
+ f20 = MUL_C(x[12], COEF_CONST(1.3870398453221473));
+ f21 = MUL_F(f19, FRAC_CONST((-0.8314696123025455)));
+ f22 = MUL_F(x[20], FRAC_CONST((-0.2758993792829436)));
+ f23 = f20 + f21;
+ f24 = f22 - f21;
+ f25 = f18 - f24;
+ f26 = f18 + f24;
+ f27 = MUL_F(f25, FRAC_CONST(0.7071067811865476));
+ f28 = f17 - f23;
+ f29 = f17 + f23;
+ f30 = MUL_F(f29, FRAC_CONST(0.7071067811865476));
+ f31 = f27 - f30;
+ f32 = f27 + f30;
+ f33 = f10 - f26;
+ f34 = f10 + f26;
+ f35 = f12 - f32;
+ f36 = f12 + f32;
+ f37 = f11 - f31;
+ f38 = f11 + f31;
+ f39 = f9 - f28;
+ f40 = f9 + f28;
+ f41 = x[2] + x[30];
+ f42 = MUL_C(x[2], COEF_CONST(1.0932018670017569));
+ f43 = MUL_F(f41, FRAC_CONST((-0.9951847266721969)));
+ f44 = MUL_F(x[30], FRAC_CONST((-0.8971675863426368)));
+ f45 = f42 + f43;
+ f46 = f44 - f43;
+ f47 = x[6] + x[26];
+ f48 = MUL_C(x[6], COEF_CONST(1.2472250129866711));
+ f49 = MUL_F(f47, FRAC_CONST((-0.9569403357322089)));
+ f50 = MUL_F(x[26], FRAC_CONST((-0.6666556584777469)));
+ f51 = f48 + f49;
+ f52 = f50 - f49;
+ f53 = x[10] + x[22];
+ f54 = MUL_C(x[10], COEF_CONST(1.3533180011743526));
+ f55 = MUL_F(f53, FRAC_CONST((-0.8819212643483551)));
+ f56 = MUL_F(x[22], FRAC_CONST((-0.4105245275223575)));
+ f57 = f54 + f55;
+ f58 = f56 - f55;
+ f59 = x[14] + x[18];
+ f60 = MUL_C(x[14], COEF_CONST(1.4074037375263826));
+ f61 = MUL_F(f59, FRAC_CONST((-0.7730104533627369)));
+ f62 = MUL_F(x[18], FRAC_CONST((-0.1386171691990913)));
+ f63 = f60 + f61;
+ f64 = f62 - f61;
+ f65 = f46 - f64;
+ f66 = f46 + f64;
+ f67 = f52 - f58;
+ f68 = f52 + f58;
+ f69 = f66 - f68;
+ f70 = f66 + f68;
+ f71 = MUL_F(f69, FRAC_CONST(0.7071067811865476));
+ f72 = f65 + f67;
+ f73 = MUL_C(f65, COEF_CONST(1.3065629648763766));
+ f74 = MUL_F(f72, FRAC_CONST((-0.9238795325112866)));
+ f75 = MUL_F(f67, FRAC_CONST((-0.5411961001461967)));
+ f76 = f73 + f74;
+ f77 = f75 - f74;
+ f78 = f45 - f63;
+ f79 = f45 + f63;
+ f80 = f51 - f57;
+ f81 = f51 + f57;
+ f82 = f79 + f81;
+ f83 = MUL_C(f79, COEF_CONST(1.3065629648763770));
+ f84 = MUL_F(f82, FRAC_CONST((-0.3826834323650904)));
+ f85 = MUL_F(f81, FRAC_CONST(0.5411961001461961));
+ f86 = f83 + f84;
+ f87 = f85 - f84;
+ f88 = f78 - f80;
+ f89 = f78 + f80;
+ f90 = MUL_F(f89, FRAC_CONST(0.7071067811865476));
+ f91 = f77 - f87;
+ f92 = f77 + f87;
+ f93 = f71 - f90;
+ f94 = f71 + f90;
+ f95 = f76 - f86;
+ f96 = f76 + f86;
+ f97 = f34 - f70;
+ f98 = f34 + f70;
+ f99 = f36 - f92;
+ f100 = f36 + f92;
+ f101 = f38 - f91;
+ f102 = f38 + f91;
+ f103 = f40 - f94;
+ f104 = f40 + f94;
+ f105 = f39 - f93;
+ f106 = f39 + f93;
+ f107 = f37 - f96;
+ f108 = f37 + f96;
+ f109 = f35 - f95;
+ f110 = f35 + f95;
+ f111 = f33 - f88;
+ f112 = f33 + f88;
+ f113 = x[1] + x[31];
+ f114 = MUL_C(x[1], COEF_CONST(1.0478631305325901));
+ f115 = MUL_F(f113, FRAC_CONST((-0.9987954562051724)));
+ f116 = MUL_F(x[31], FRAC_CONST((-0.9497277818777548)));
+ f117 = f114 + f115;
+ f118 = f116 - f115;
+ f119 = x[5] + x[27];
+ f120 = MUL_C(x[5], COEF_CONST(1.2130114330978077));
+ f121 = MUL_F(f119, FRAC_CONST((-0.9700312531945440)));
+ f122 = MUL_F(x[27], FRAC_CONST((-0.7270510732912803)));
+ f123 = f120 + f121;
+ f124 = f122 - f121;
+ f125 = x[9] + x[23];
+ f126 = MUL_C(x[9], COEF_CONST(1.3315443865537255));
+ f127 = MUL_F(f125, FRAC_CONST((-0.9039892931234433)));
+ f128 = MUL_F(x[23], FRAC_CONST((-0.4764341996931612)));
+ f129 = f126 + f127;
+ f130 = f128 - f127;
+ f131 = x[13] + x[19];
+ f132 = MUL_C(x[13], COEF_CONST(1.3989068359730781));
+ f133 = MUL_F(f131, FRAC_CONST((-0.8032075314806453)));
+ f134 = MUL_F(x[19], FRAC_CONST((-0.2075082269882124)));
+ f135 = f132 + f133;
+ f136 = f134 - f133;
+ f137 = x[17] + x[15];
+ f138 = MUL_C(x[17], COEF_CONST(1.4125100802019777));
+ f139 = MUL_F(f137, FRAC_CONST((-0.6715589548470187)));
+ f140 = MUL_F(x[15], FRAC_CONST(0.0693921705079402));
+ f141 = f138 + f139;
+ f142 = f140 - f139;
+ f143 = x[21] + x[11];
+ f144 = MUL_C(x[21], COEF_CONST(1.3718313541934939));
+ f145 = MUL_F(f143, FRAC_CONST((-0.5141027441932219)));
+ f146 = MUL_F(x[11], FRAC_CONST(0.3436258658070501));
+ f147 = f144 + f145;
+ f148 = f146 - f145;
+ f149 = x[25] + x[7];
+ f150 = MUL_C(x[25], COEF_CONST(1.2784339185752409));
+ f151 = MUL_F(f149, FRAC_CONST((-0.3368898533922200)));
+ f152 = MUL_F(x[7], FRAC_CONST(0.6046542117908008));
+ f153 = f150 + f151;
+ f154 = f152 - f151;
+ f155 = x[29] + x[3];
+ f156 = MUL_C(x[29], COEF_CONST(1.1359069844201433));
+ f157 = MUL_F(f155, FRAC_CONST((-0.1467304744553624)));
+ f158 = MUL_F(x[3], FRAC_CONST(0.8424460355094185));
+ f159 = f156 + f157;
+ f160 = f158 - f157;
+ f161 = f118 - f142;
+ f162 = f118 + f142;
+ f163 = f117 - f141;
+ f164 = f117 + f141;
+ f165 = f124 - f148;
+ f166 = f124 + f148;
+ f167 = f123 - f147;
+ f168 = f123 + f147;
+ f169 = f130 - f154;
+ f170 = f130 + f154;
+ f171 = f129 - f153;
+ f172 = f129 + f153;
+ f173 = f136 - f160;
+ f174 = f136 + f160;
+ f175 = f135 - f159;
+ f176 = f135 + f159;
+ f177 = f161 + f163;
+ f178 = MUL_C(f161, COEF_CONST(1.1758756024193588));
+ f179 = MUL_F(f177, FRAC_CONST((-0.9807852804032304)));
+ f180 = MUL_F(f163, FRAC_CONST((-0.7856949583871021)));
+ f181 = f178 + f179;
+ f182 = f180 - f179;
+ f183 = f165 + f167;
+ f184 = MUL_C(f165, COEF_CONST(1.3870398453221475));
+ f185 = MUL_F(f183, FRAC_CONST((-0.5555702330196022)));
+ f186 = MUL_F(f167, FRAC_CONST(0.2758993792829431));
+ f187 = f184 + f185;
+ f188 = f186 - f185;
+ f189 = f169 + f171;
+ f190 = MUL_F(f169, FRAC_CONST(0.7856949583871022));
+ f191 = MUL_F(f189, FRAC_CONST(0.1950903220161283));
+ f192 = MUL_C(f171, COEF_CONST(1.1758756024193586));
+ f193 = f190 + f191;
+ f194 = f192 - f191;
+ f195 = f173 + f175;
+ f196 = MUL_F(f173, FRAC_CONST((-0.2758993792829430)));
+ f197 = MUL_F(f195, FRAC_CONST(0.8314696123025452));
+ f198 = MUL_C(f175, COEF_CONST(1.3870398453221475));
+ f199 = f196 + f197;
+ f200 = f198 - f197;
+ f201 = f162 - f170;
+ f202 = f162 + f170;
+ f203 = f164 - f172;
+ f204 = f164 + f172;
+ f205 = f166 - f174;
+ f206 = f166 + f174;
+ f207 = f168 - f176;
+ f208 = f168 + f176;
+ f209 = f182 - f194;
+ f210 = f182 + f194;
+ f211 = f181 - f193;
+ f212 = f181 + f193;
+ f213 = f188 - f200;
+ f214 = f188 + f200;
+ f215 = f187 - f199;
+ f216 = f187 + f199;
+ f217 = f201 + f203;
+ f218 = MUL_C(f201, COEF_CONST(1.3065629648763766));
+ f219 = MUL_F(f217, FRAC_CONST((-0.9238795325112866)));
+ f220 = MUL_F(f203, FRAC_CONST((-0.5411961001461967)));
+ f221 = f218 + f219;
+ f222 = f220 - f219;
+ f223 = f205 + f207;
+ f224 = MUL_F(f205, FRAC_CONST(0.5411961001461969));
+ f225 = MUL_F(f223, FRAC_CONST(0.3826834323650898));
+ f226 = MUL_C(f207, COEF_CONST(1.3065629648763766));
+ f227 = f224 + f225;
+ f228 = f226 - f225;
+ f229 = f209 + f211;
+ f230 = MUL_C(f209, COEF_CONST(1.3065629648763766));
+ f231 = MUL_F(f229, FRAC_CONST((-0.9238795325112866)));
+ f232 = MUL_F(f211, FRAC_CONST((-0.5411961001461967)));
+ f233 = f230 + f231;
+ f234 = f232 - f231;
+ f235 = f213 + f215;
+ f236 = MUL_F(f213, FRAC_CONST(0.5411961001461969));
+ f237 = MUL_F(f235, FRAC_CONST(0.3826834323650898));
+ f238 = MUL_C(f215, COEF_CONST(1.3065629648763766));
+ f239 = f236 + f237;
+ f240 = f238 - f237;
+ f241 = f202 - f206;
+ f242 = f202 + f206;
+ f243 = f204 - f208;
+ f244 = f204 + f208;
+ f245 = f222 - f228;
+ f246 = f222 + f228;
+ f247 = f221 - f227;
+ f248 = f221 + f227;
+ f249 = f210 - f214;
+ f250 = f210 + f214;
+ f251 = f212 - f216;
+ f252 = f212 + f216;
+ f253 = f234 - f240;
+ f254 = f234 + f240;
+ f255 = f233 - f239;
+ f256 = f233 + f239;
+ f257 = f241 - f243;
+ f258 = f241 + f243;
+ f259 = MUL_F(f257, FRAC_CONST(0.7071067811865474));
+ f260 = MUL_F(f258, FRAC_CONST(0.7071067811865474));
+ f261 = f245 - f247;
+ f262 = f245 + f247;
+ f263 = MUL_F(f261, FRAC_CONST(0.7071067811865474));
+ f264 = MUL_F(f262, FRAC_CONST(0.7071067811865474));
+ f265 = f249 - f251;
+ f266 = f249 + f251;
+ f267 = MUL_F(f265, FRAC_CONST(0.7071067811865474));
+ f268 = MUL_F(f266, FRAC_CONST(0.7071067811865474));
+ f269 = f253 - f255;
+ f270 = f253 + f255;
+ f271 = MUL_F(f269, FRAC_CONST(0.7071067811865474));
+ f272 = MUL_F(f270, FRAC_CONST(0.7071067811865474));
+ y[31] = f98 - f242;
+ y[0] = f98 + f242;
+ y[30] = f100 - f250;
+ y[1] = f100 + f250;
+ y[29] = f102 - f254;
+ y[2] = f102 + f254;
+ y[28] = f104 - f246;
+ y[3] = f104 + f246;
+ y[27] = f106 - f264;
+ y[4] = f106 + f264;
+ y[26] = f108 - f272;
+ y[5] = f108 + f272;
+ y[25] = f110 - f268;
+ y[6] = f110 + f268;
+ y[24] = f112 - f260;
+ y[7] = f112 + f260;
+ y[23] = f111 - f259;
+ y[8] = f111 + f259;
+ y[22] = f109 - f267;
+ y[9] = f109 + f267;
+ y[21] = f107 - f271;
+ y[10] = f107 + f271;
+ y[20] = f105 - f263;
+ y[11] = f105 + f263;
+ y[19] = f103 - f248;
+ y[12] = f103 + f248;
+ y[18] = f101 - f256;
+ y[13] = f101 + f256;
+ y[17] = f99 - f252;
+ y[14] = f99 + f252;
+ y[16] = f97 - f244;
+ y[15] = f97 + f244;
+}
+
+void DCT2_32_unscaled(real_t *y, real_t *x)
+{
+ real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
+ real_t f11, f12, f13, f14, f15, f16, f17, f18, f19, f20;
+ real_t f21, f22, f23, f24, f25, f26, f27, f28, f29, f30;
+ real_t f31, f32, f33, f34, f35, f36, f37, f38, f39, f40;
+ real_t f41, f42, f43, f44, f45, f46, f47, f48, f49, f50;
+ real_t f51, f52, f53, f54, f55, f56, f57, f58, f59, f60;
+ real_t f63, f64, f65, f66, f69, f70, f71, f72, f73, f74;
+ real_t f75, f76, f77, f78, f79, f80, f81, f83, f85, f86;
+ real_t f89, f90, f91, f92, f93, f94, f95, f96, f97, f98;
+ real_t f99, f100, f101, f102, f103, f104, f105, f106, f107, f108;
+ real_t f109, f110, f111, f112, f113, f114, f115, f116, f117, f118;
+ real_t f119, f120, f121, f122, f123, f124, f127, f128, f129, f130;
+ real_t f133, f134, f135, f136, f139, f140, f141, f142, f145, f146;
+ real_t f147, f148, f149, f150, f151, f152, f153, f154, f155, f156;
+ real_t f157, f158, f159, f160, f161, f162, f163, f164, f165, f166;
+ real_t f167, f168, f169, f170, f171, f172, f173, f174, f175, f176;
+ real_t f177, f178, f179, f180, f181, f182, f183, f184, f185, f186;
+ real_t f187, f188, f189, f190, f191, f192, f193, f194, f195, f196;
+ real_t f197, f198, f199, f200, f201, f202, f203, f204, f205, f206;
+ real_t f207, f208, f209, f210, f211, f212, f213, f214, f215, f216;
+ real_t f217, f218, f219, f220, f221, f222, f223, f224, f225, f226;
+ real_t f227, f228, f229, f230, f231, f232, f233, f234, f235, f236;
+ real_t f237, f238, f239, f240, f241, f242, f243, f244, f247, f248;
+ real_t f249, f250, f253, f254, f255, f256, f259, f260, f261, f262;
+ real_t f265, f266, f267, f268, f271, f272, f273, f274, f277, f278;
+ real_t f279, f280, f283, f284, f285, f286;
+
+ f0 = x[0] - x[31];
+ f1 = x[0] + x[31];
+ f2 = x[1] - x[30];
+ f3 = x[1] + x[30];
+ f4 = x[2] - x[29];
+ f5 = x[2] + x[29];
+ f6 = x[3] - x[28];
+ f7 = x[3] + x[28];
+ f8 = x[4] - x[27];
+ f9 = x[4] + x[27];
+ f10 = x[5] - x[26];
+ f11 = x[5] + x[26];
+ f12 = x[6] - x[25];
+ f13 = x[6] + x[25];
+ f14 = x[7] - x[24];
+ f15 = x[7] + x[24];
+ f16 = x[8] - x[23];
+ f17 = x[8] + x[23];
+ f18 = x[9] - x[22];
+ f19 = x[9] + x[22];
+ f20 = x[10] - x[21];
+ f21 = x[10] + x[21];
+ f22 = x[11] - x[20];
+ f23 = x[11] + x[20];
+ f24 = x[12] - x[19];
+ f25 = x[12] + x[19];
+ f26 = x[13] - x[18];
+ f27 = x[13] + x[18];
+ f28 = x[14] - x[17];
+ f29 = x[14] + x[17];
+ f30 = x[15] - x[16];
+ f31 = x[15] + x[16];
+ f32 = f1 - f31;
+ f33 = f1 + f31;
+ f34 = f3 - f29;
+ f35 = f3 + f29;
+ f36 = f5 - f27;
+ f37 = f5 + f27;
+ f38 = f7 - f25;
+ f39 = f7 + f25;
+ f40 = f9 - f23;
+ f41 = f9 + f23;
+ f42 = f11 - f21;
+ f43 = f11 + f21;
+ f44 = f13 - f19;
+ f45 = f13 + f19;
+ f46 = f15 - f17;
+ f47 = f15 + f17;
+ f48 = f33 - f47;
+ f49 = f33 + f47;
+ f50 = f35 - f45;
+ f51 = f35 + f45;
+ f52 = f37 - f43;
+ f53 = f37 + f43;
+ f54 = f39 - f41;
+ f55 = f39 + f41;
+ f56 = f49 - f55;
+ f57 = f49 + f55;
+ f58 = f51 - f53;
+ f59 = f51 + f53;
+ f60 = f57 - f59;
+ y[0] = f57 + f59;
+ y[16] = MUL_F(FRAC_CONST(0.7071067811865476), f60);
+ f63 = f56 + f58;
+ f64 = MUL_C(COEF_CONST(1.3065629648763766), f56);
+ f65 = MUL_F(FRAC_CONST(-0.9238795325112866), f63);
+ f66 = MUL_F(FRAC_CONST(-0.5411961001461967), f58);
+ y[24] = f64 + f65;
+ y[8] = f66 - f65;
+ f69 = f48 + f54;
+ f70 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+ f71 = MUL_F(FRAC_CONST(-0.9807852804032304), f69);
+ f72 = MUL_F(FRAC_CONST(-0.7856949583871021), f54);
+ f73 = f70 + f71;
+ f74 = f72 - f71;
+ f75 = f50 + f52;
+ f76 = MUL_C(COEF_CONST(1.3870398453221473), f50);
+ f77 = MUL_F(FRAC_CONST(-0.8314696123025455), f75);
+ f78 = MUL_F(FRAC_CONST(-0.2758993792829436), f52);
+ f79 = f76 + f77;
+ f80 = f78 - f77;
+ f81 = f74 - f80;
+ y[4] = f74 + f80;
+ f83 = MUL_F(FRAC_CONST(0.7071067811865476), f81);
+ y[28] = f73 - f79;
+ f85 = f73 + f79;
+ f86 = MUL_F(FRAC_CONST(0.7071067811865476), f85);
+ y[20] = f83 - f86;
+ y[12] = f83 + f86;
+ f89 = f34 - f36;
+ f90 = f34 + f36;
+ f91 = f38 - f40;
+ f92 = f38 + f40;
+ f93 = f42 - f44;
+ f94 = f42 + f44;
+ f95 = MUL_F(FRAC_CONST(0.7071067811865476), f92);
+ f96 = f32 - f95;
+ f97 = f32 + f95;
+ f98 = f90 + f94;
+ f99 = MUL_C(COEF_CONST(1.3065629648763766), f90);
+ f100 = MUL_F(FRAC_CONST(-0.9238795325112866), f98);
+ f101 = MUL_F(FRAC_CONST(-0.5411961001461967), f94);
+ f102 = f99 + f100;
+ f103 = f101 - f100;
+ f104 = f97 - f103;
+ f105 = f97 + f103;
+ f106 = f96 - f102;
+ f107 = f96 + f102;
+ f108 = MUL_F(FRAC_CONST(0.7071067811865476), f91);
+ f109 = f46 - f108;
+ f110 = f46 + f108;
+ f111 = f93 + f89;
+ f112 = MUL_C(COEF_CONST(1.3065629648763766), f93);
+ f113 = MUL_F(FRAC_CONST(-0.9238795325112866), f111);
+ f114 = MUL_F(FRAC_CONST(-0.5411961001461967), f89);
+ f115 = f112 + f113;
+ f116 = f114 - f113;
+ f117 = f110 - f116;
+ f118 = f110 + f116;
+ f119 = f109 - f115;
+ f120 = f109 + f115;
+ f121 = f118 + f105;
+ f122 = MUL_F(FRAC_CONST(-0.8971675863426361), f118);
+ f123 = MUL_F(FRAC_CONST(0.9951847266721968), f121);
+ f124 = MUL_C(COEF_CONST(1.0932018670017576), f105);
+ y[2] = f122 + f123;
+ y[30] = f124 - f123;
+ f127 = f107 - f120;
+ f128 = MUL_F(FRAC_CONST(-0.6666556584777466), f120);
+ f129 = MUL_F(FRAC_CONST(0.9569403357322089), f127);
+ f130 = MUL_C(COEF_CONST(1.2472250129866713), f107);
+ y[6] = f129 - f128;
+ y[26] = f130 - f129;
+ f133 = f119 + f106;
+ f134 = MUL_F(FRAC_CONST(-0.4105245275223571), f119);
+ f135 = MUL_F(FRAC_CONST(0.8819212643483549), f133);
+ f136 = MUL_C(COEF_CONST(1.3533180011743529), f106);
+ y[10] = f134 + f135;
+ y[22] = f136 - f135;
+ f139 = f104 - f117;
+ f140 = MUL_F(FRAC_CONST(-0.1386171691990915), f117);
+ f141 = MUL_F(FRAC_CONST(0.7730104533627370), f139);
+ f142 = MUL_C(COEF_CONST(1.4074037375263826), f104);
+ y[14] = f141 - f140;
+ y[18] = f142 - f141;
+ f145 = f2 - f4;
+ f146 = f2 + f4;
+ f147 = f6 - f8;
+ f148 = f6 + f8;
+ f149 = f10 - f12;
+ f150 = f10 + f12;
+ f151 = f14 - f16;
+ f152 = f14 + f16;
+ f153 = f18 - f20;
+ f154 = f18 + f20;
+ f155 = f22 - f24;
+ f156 = f22 + f24;
+ f157 = f26 - f28;
+ f158 = f26 + f28;
+ f159 = MUL_F(FRAC_CONST(0.7071067811865476), f152);
+ f160 = f0 - f159;
+ f161 = f0 + f159;
+ f162 = f148 + f156;
+ f163 = MUL_C(COEF_CONST(1.3065629648763766), f148);
+ f164 = MUL_F(FRAC_CONST(-0.9238795325112866), f162);
+ f165 = MUL_F(FRAC_CONST(-0.5411961001461967), f156);
+ f166 = f163 + f164;
+ f167 = f165 - f164;
+ f168 = f161 - f167;
+ f169 = f161 + f167;
+ f170 = f160 - f166;
+ f171 = f160 + f166;
+ f172 = f146 + f158;
+ f173 = MUL_C(COEF_CONST(1.1758756024193588), f146);
+ f174 = MUL_F(FRAC_CONST(-0.9807852804032304), f172);
+ f175 = MUL_F(FRAC_CONST(-0.7856949583871021), f158);
+ f176 = f173 + f174;
+ f177 = f175 - f174;
+ f178 = f150 + f154;
+ f179 = MUL_C(COEF_CONST(1.3870398453221473), f150);
+ f180 = MUL_F(FRAC_CONST(-0.8314696123025455), f178);
+ f181 = MUL_F(FRAC_CONST(-0.2758993792829436), f154);
+ f182 = f179 + f180;
+ f183 = f181 - f180;
+ f184 = f177 - f183;
+ f185 = f177 + f183;
+ f186 = MUL_F(FRAC_CONST(0.7071067811865476), f184);
+ f187 = f176 - f182;
+ f188 = f176 + f182;
+ f189 = MUL_F(FRAC_CONST(0.7071067811865476), f188);
+ f190 = f186 - f189;
+ f191 = f186 + f189;
+ f192 = f169 - f185;
+ f193 = f169 + f185;
+ f194 = f171 - f191;
+ f195 = f171 + f191;
+ f196 = f170 - f190;
+ f197 = f170 + f190;
+ f198 = f168 - f187;
+ f199 = f168 + f187;
+ f200 = MUL_F(FRAC_CONST(0.7071067811865476), f151);
+ f201 = f30 - f200;
+ f202 = f30 + f200;
+ f203 = f155 + f147;
+ f204 = MUL_C(COEF_CONST(1.3065629648763766), f155);
+ f205 = MUL_F(FRAC_CONST(-0.9238795325112866), f203);
+ f206 = MUL_F(FRAC_CONST(-0.5411961001461967), f147);
+ f207 = f204 + f205;
+ f208 = f206 - f205;
+ f209 = f202 - f208;
+ f210 = f202 + f208;
+ f211 = f201 - f207;
+ f212 = f201 + f207;
+ f213 = f157 + f145;
+ f214 = MUL_C(COEF_CONST(1.1758756024193588), f157);
+ f215 = MUL_F(FRAC_CONST(-0.9807852804032304), f213);
+ f216 = MUL_F(FRAC_CONST(-0.7856949583871021), f145);
+ f217 = f214 + f215;
+ f218 = f216 - f215;
+ f219 = f153 + f149;
+ f220 = MUL_C(COEF_CONST(1.3870398453221473), f153);
+ f221 = MUL_F(FRAC_CONST(-0.8314696123025455), f219);
+ f222 = MUL_F(FRAC_CONST(-0.2758993792829436), f149);
+ f223 = f220 + f221;
+ f224 = f222 - f221;
+ f225 = f218 - f224;
+ f226 = f218 + f224;
+ f227 = MUL_F(FRAC_CONST(0.7071067811865476), f225);
+ f228 = f217 - f223;
+ f229 = f217 + f223;
+ f230 = MUL_F(FRAC_CONST(0.7071067811865476), f229);
+ f231 = f227 - f230;
+ f232 = f227 + f230;
+ f233 = f210 - f226;
+ f234 = f210 + f226;
+ f235 = f212 - f232;
+ f236 = f212 + f232;
+ f237 = f211 - f231;
+ f238 = f211 + f231;
+ f239 = f209 - f228;
+ f240 = f209 + f228;
+ f241 = f234 + f193;
+ f242 = MUL_F(FRAC_CONST(-0.9497277818777543), f234);
+ f243 = MUL_F(FRAC_CONST(0.9987954562051724), f241);
+ f244 = MUL_C(COEF_CONST(1.0478631305325905), f193);
+ y[1] = f242 + f243;
+ y[31] = f244 - f243;
+ f247 = f195 - f236;
+ f248 = MUL_F(FRAC_CONST(-0.8424460355094192), f236);
+ f249 = MUL_F(FRAC_CONST(0.9891765099647810), f247);
+ f250 = MUL_C(COEF_CONST(1.1359069844201428), f195);
+ y[3] = f249 - f248;
+ y[29] = f250 - f249;
+ f253 = f238 + f197;
+ f254 = MUL_F(FRAC_CONST(-0.7270510732912801), f238);
+ f255 = MUL_F(FRAC_CONST(0.9700312531945440), f253);
+ f256 = MUL_C(COEF_CONST(1.2130114330978079), f197);
+ y[5] = f254 + f255;
+ y[27] = f256 - f255;
+ f259 = f199 - f240;
+ f260 = MUL_F(FRAC_CONST(-0.6046542117908007), f240);
+ f261 = MUL_F(FRAC_CONST(0.9415440651830208), f259);
+ f262 = MUL_C(COEF_CONST(1.2784339185752409), f199);
+ y[7] = f261 - f260;
+ y[25] = f262 - f261;
+ f265 = f239 + f198;
+ f266 = MUL_F(FRAC_CONST(-0.4764341996931611), f239);
+ f267 = MUL_F(FRAC_CONST(0.9039892931234433), f265);
+ f268 = MUL_C(COEF_CONST(1.3315443865537255), f198);
+ y[9] = f266 + f267;
+ y[23] = f268 - f267;
+ f271 = f196 - f237;
+ f272 = MUL_F(FRAC_CONST(-0.3436258658070505), f237);
+ f273 = MUL_F(FRAC_CONST(0.8577286100002721), f271);
+ f274 = MUL_C(COEF_CONST(1.3718313541934939), f196);
+ y[11] = f273 - f272;
+ y[21] = f274 - f273;
+ f277 = f235 + f194;
+ f278 = MUL_F(FRAC_CONST(-0.2075082269882114), f235);
+ f279 = MUL_F(FRAC_CONST(0.8032075314806448), f277);
+ f280 = MUL_C(COEF_CONST(1.3989068359730783), f194);
+ y[13] = f278 + f279;
+ y[19] = f280 - f279;
+ f283 = f192 - f233;
+ f284 = MUL_F(FRAC_CONST(-0.0693921705079408), f233);
+ f285 = MUL_F(FRAC_CONST(0.7409511253549591), f283);
+ f286 = MUL_C(COEF_CONST(1.4125100802019774), f192);
+ y[15] = f285 - f284;
+ y[17] = f286 - f285;
+}
+
+#else
+
+
+#define n 32
+#define log2n 5
+
+// w_array_real[i] = cos(2*M_PI*i/32)
+static const real_t w_array_real[] = {
+ FRAC_CONST(1.000000000000000), FRAC_CONST(0.980785279337272),
+ FRAC_CONST(0.923879528329380), FRAC_CONST(0.831469603195765),
+ FRAC_CONST(0.707106765732237), FRAC_CONST(0.555570210304169),
+ FRAC_CONST(0.382683402077046), FRAC_CONST(0.195090284503576),
+ FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090370246552),
+ FRAC_CONST(-0.382683482845162), FRAC_CONST(-0.555570282993553),
+ FRAC_CONST(-0.707106827549476), FRAC_CONST(-0.831469651765257),
+ FRAC_CONST(-0.923879561784627), FRAC_CONST(-0.980785296392607)
+};
+
+// w_array_imag[i] = sin(-2*M_PI*i/32)
+static const real_t w_array_imag[] = {
+ FRAC_CONST(0.000000000000000), FRAC_CONST(-0.195090327375064),
+ FRAC_CONST(-0.382683442461104), FRAC_CONST(-0.555570246648862),
+ FRAC_CONST(-0.707106796640858), FRAC_CONST(-0.831469627480512),
+ FRAC_CONST(-0.923879545057005), FRAC_CONST(-0.980785287864940),
+ FRAC_CONST(-1.000000000000000), FRAC_CONST(-0.980785270809601),
+ FRAC_CONST(-0.923879511601754), FRAC_CONST(-0.831469578911016),
+ FRAC_CONST(-0.707106734823616), FRAC_CONST(-0.555570173959476),
+ FRAC_CONST(-0.382683361692986), FRAC_CONST(-0.195090241632088)
+};
+
+// FFT decimation in frequency
+// 4*16*2+16=128+16=144 multiplications
+// 6*16*2+10*8+4*16*2=192+80+128=400 additions
+static void fft_dif(real_t * Real, real_t * Imag)
+{
+ real_t w_real, w_imag; // For faster access
+ real_t point1_real, point1_imag, point2_real, point2_imag; // For faster access
+ uint32_t j, i, i2, w_index; // Counters
+
+ // First 2 stages of 32 point FFT decimation in frequency
+ // 4*16*2=64*2=128 multiplications
+ // 6*16*2=96*2=192 additions
+ // Stage 1 of 32 point FFT decimation in frequency
+ for (i = 0; i < 16; i++)
+ {
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+ i2 = i+16;
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ w_real = w_array_real[i];
+ w_imag = w_array_imag[i];
+
+ // temp1 = x[i] - x[i2]
+ point1_real -= point2_real;
+ point1_imag -= point2_imag;
+
+ // x[i1] = x[i] + x[i2]
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // x[i2] = (x[i] - x[i2]) * w
+ Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+ Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+ }
+ // Stage 2 of 32 point FFT decimation in frequency
+ for (j = 0, w_index = 0; j < 8; j++, w_index += 2)
+ {
+ w_real = w_array_real[w_index];
+ w_imag = w_array_imag[w_index];
+
+ i = j;
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+ i2 = i+8;
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ // temp1 = x[i] - x[i2]
+ point1_real -= point2_real;
+ point1_imag -= point2_imag;
+
+ // x[i1] = x[i] + x[i2]
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // x[i2] = (x[i] - x[i2]) * w
+ Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+ Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+
+ i = j+16;
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+ i2 = i+8;
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ // temp1 = x[i] - x[i2]
+ point1_real -= point2_real;
+ point1_imag -= point2_imag;
+
+ // x[i1] = x[i] + x[i2]
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // x[i2] = (x[i] - x[i2]) * w
+ Real[i2] = (MUL_F(point1_real,w_real) - MUL_F(point1_imag,w_imag));
+ Imag[i2] = (MUL_F(point1_real,w_imag) + MUL_F(point1_imag,w_real));
+ }
+
+ // Stage 3 of 32 point FFT decimation in frequency
+ // 2*4*2=16 multiplications
+ // 4*4*2+6*4*2=10*8=80 additions
+ for (i = 0; i < n; i += 8)
+ {
+ i2 = i+4;
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ // out[i1] = point1 + point2
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // out[i2] = point1 - point2
+ Real[i2] = point1_real - point2_real;
+ Imag[i2] = point1_imag - point2_imag;
+ }
+ w_real = w_array_real[4]; // = sqrt(2)/2
+ // w_imag = -w_real; // = w_array_imag[4]; // = -sqrt(2)/2
+ for (i = 1; i < n; i += 8)
+ {
+ i2 = i+4;
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ // temp1 = x[i] - x[i2]
+ point1_real -= point2_real;
+ point1_imag -= point2_imag;
+
+ // x[i1] = x[i] + x[i2]
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // x[i2] = (x[i] - x[i2]) * w
+ Real[i2] = MUL_F(point1_real+point1_imag, w_real);
+ Imag[i2] = MUL_F(point1_imag-point1_real, w_real);
+ }
+ for (i = 2; i < n; i += 8)
+ {
+ i2 = i+4;
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ // x[i] = x[i] + x[i2]
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // x[i2] = (x[i] - x[i2]) * (-i)
+ Real[i2] = point1_imag - point2_imag;
+ Imag[i2] = point2_real - point1_real;
+ }
+ w_real = w_array_real[12]; // = -sqrt(2)/2
+ // w_imag = w_real; // = w_array_imag[12]; // = -sqrt(2)/2
+ for (i = 3; i < n; i += 8)
+ {
+ i2 = i+4;
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ // temp1 = x[i] - x[i2]
+ point1_real -= point2_real;
+ point1_imag -= point2_imag;
+
+ // x[i1] = x[i] + x[i2]
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // x[i2] = (x[i] - x[i2]) * w
+ Real[i2] = MUL_F(point1_real-point1_imag, w_real);
+ Imag[i2] = MUL_F(point1_real+point1_imag, w_real);
+ }
+
+
+ // Stage 4 of 32 point FFT decimation in frequency (no multiplications)
+ // 16*4=64 additions
+ for (i = 0; i < n; i += 4)
+ {
+ i2 = i+2;
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ // x[i1] = x[i] + x[i2]
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // x[i2] = x[i] - x[i2]
+ Real[i2] = point1_real - point2_real;
+ Imag[i2] = point1_imag - point2_imag;
+ }
+ for (i = 1; i < n; i += 4)
+ {
+ i2 = i+2;
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ // x[i] = x[i] + x[i2]
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // x[i2] = (x[i] - x[i2]) * (-i)
+ Real[i2] = point1_imag - point2_imag;
+ Imag[i2] = point2_real - point1_real;
+ }
+
+ // Stage 5 of 32 point FFT decimation in frequency (no multiplications)
+ // 16*4=64 additions
+ for (i = 0; i < n; i += 2)
+ {
+ i2 = i+1;
+ point1_real = Real[i];
+ point1_imag = Imag[i];
+
+ point2_real = Real[i2];
+ point2_imag = Imag[i2];
+
+ // out[i1] = point1 + point2
+ Real[i] += point2_real;
+ Imag[i] += point2_imag;
+
+ // out[i2] = point1 - point2
+ Real[i2] = point1_real - point2_real;
+ Imag[i2] = point1_imag - point2_imag;
+ }
+
+#ifdef REORDER_IN_FFT
+ FFTReorder(Real, Imag);
+#endif // #ifdef REORDER_IN_FFT
+}
+#undef n
+#undef log2n
+
+static const real_t dct4_64_tab[] = {
+ COEF_CONST(0.999924719333649), COEF_CONST(0.998118102550507),
+ COEF_CONST(0.993906974792480), COEF_CONST(0.987301409244537),
+ COEF_CONST(0.978317379951477), COEF_CONST(0.966976463794708),
+ COEF_CONST(0.953306019306183), COEF_CONST(0.937339007854462),
+ COEF_CONST(0.919113874435425), COEF_CONST(0.898674488067627),
+ COEF_CONST(0.876070082187653), COEF_CONST(0.851355195045471),
+ COEF_CONST(0.824589252471924), COEF_CONST(0.795836925506592),
+ COEF_CONST(0.765167236328125), COEF_CONST(0.732654273509979),
+ COEF_CONST(0.698376238346100), COEF_CONST(0.662415742874146),
+ COEF_CONST(0.624859452247620), COEF_CONST(0.585797846317291),
+ COEF_CONST(0.545324981212616), COEF_CONST(0.503538429737091),
+ COEF_CONST(0.460538715124130), COEF_CONST(0.416429549455643),
+ COEF_CONST(0.371317148208618), COEF_CONST(0.325310230255127),
+ COEF_CONST(0.278519600629807), COEF_CONST(0.231058135628700),
+ COEF_CONST(0.183039888739586), COEF_CONST(0.134580686688423),
+ COEF_CONST(0.085797272622585), COEF_CONST(0.036807164549828),
+ COEF_CONST(-1.012196302413940), COEF_CONST(-1.059438824653626),
+ COEF_CONST(-1.104129195213318), COEF_CONST(-1.146159529685974),
+ COEF_CONST(-1.185428738594055), COEF_CONST(-1.221842169761658),
+ COEF_CONST(-1.255311965942383), COEF_CONST(-1.285757660865784),
+ COEF_CONST(-1.313105940818787), COEF_CONST(-1.337290763854981),
+ COEF_CONST(-1.358253836631775), COEF_CONST(-1.375944852828980),
+ COEF_CONST(-1.390321016311646), COEF_CONST(-1.401347875595093),
+ COEF_CONST(-1.408998727798462), COEF_CONST(-1.413255214691162),
+ COEF_CONST(-1.414107084274292), COEF_CONST(-1.411552190780640),
+ COEF_CONST(-1.405596733093262), COEF_CONST(-1.396255016326904),
+ COEF_CONST(-1.383549690246582), COEF_CONST(-1.367511272430420),
+ COEF_CONST(-1.348178386688232), COEF_CONST(-1.325597524642944),
+ COEF_CONST(-1.299823284149170), COEF_CONST(-1.270917654037476),
+ COEF_CONST(-1.238950133323669), COEF_CONST(-1.203998088836670),
+ COEF_CONST(-1.166145324707031), COEF_CONST(-1.125483393669128),
+ COEF_CONST(-1.082109928131104), COEF_CONST(-1.036129593849182),
+ COEF_CONST(-0.987653195858002), COEF_CONST(-0.936797380447388),
+ COEF_CONST(-0.883684754371643), COEF_CONST(-0.828443288803101),
+ COEF_CONST(-0.771206021308899), COEF_CONST(-0.712110757827759),
+ COEF_CONST(-0.651300072669983), COEF_CONST(-0.588920354843140),
+ COEF_CONST(-0.525121808052063), COEF_CONST(-0.460058242082596),
+ COEF_CONST(-0.393886327743530), COEF_CONST(-0.326765477657318),
+ COEF_CONST(-0.258857429027557), COEF_CONST(-0.190325915813446),
+ COEF_CONST(-0.121335685253143), COEF_CONST(-0.052053272724152),
+ COEF_CONST(0.017354607582092), COEF_CONST(0.086720645427704),
+ COEF_CONST(0.155877828598022), COEF_CONST(0.224659323692322),
+ COEF_CONST(0.292899727821350), COEF_CONST(0.360434412956238),
+ COEF_CONST(0.427100926637650), COEF_CONST(0.492738455533981),
+ COEF_CONST(0.557188928127289), COEF_CONST(0.620297133922577),
+ COEF_CONST(0.681910991668701), COEF_CONST(0.741881847381592),
+ COEF_CONST(0.800065577030182), COEF_CONST(0.856321990489960),
+ COEF_CONST(0.910515367984772), COEF_CONST(0.962515234947205),
+ COEF_CONST(1.000000000000000), COEF_CONST(0.998795449733734),
+ COEF_CONST(0.995184719562531), COEF_CONST(0.989176511764526),
+ COEF_CONST(0.980785250663757), COEF_CONST(0.970031261444092),
+ COEF_CONST(0.956940352916718), COEF_CONST(0.941544055938721),
+ COEF_CONST(0.923879504203796), COEF_CONST(0.903989315032959),
+ COEF_CONST(0.881921231746674), COEF_CONST(0.857728600502014),
+ COEF_CONST(0.831469595432281), COEF_CONST(0.803207516670227),
+ COEF_CONST(0.773010432720184), COEF_CONST(0.740951120853424),
+ COEF_CONST(0.707106769084930), COEF_CONST(0.671558916568756),
+ COEF_CONST(0.634393274784088), COEF_CONST(0.595699310302734),
+ COEF_CONST(0.555570185184479), COEF_CONST(0.514102697372437),
+ COEF_CONST(0.471396654844284), COEF_CONST(0.427555114030838),
+ COEF_CONST(0.382683426141739), COEF_CONST(0.336889833211899),
+ COEF_CONST(0.290284633636475), COEF_CONST(0.242980122566223),
+ COEF_CONST(0.195090234279633), COEF_CONST(0.146730497479439),
+ COEF_CONST(0.098017133772373), COEF_CONST(0.049067649990320),
+ COEF_CONST(-1.000000000000000), COEF_CONST(-1.047863125801086),
+ COEF_CONST(-1.093201875686646), COEF_CONST(-1.135906934738159),
+ COEF_CONST(-1.175875544548035), COEF_CONST(-1.213011503219605),
+ COEF_CONST(-1.247225046157837), COEF_CONST(-1.278433918952942),
+ COEF_CONST(-1.306562900543213), COEF_CONST(-1.331544399261475),
+ COEF_CONST(-1.353317975997925), COEF_CONST(-1.371831417083740),
+ COEF_CONST(-1.387039899826050), COEF_CONST(-1.398906826972961),
+ COEF_CONST(-1.407403707504273), COEF_CONST(-1.412510156631470),
+ COEF_CONST(0), COEF_CONST(-1.412510156631470),
+ COEF_CONST(-1.407403707504273), COEF_CONST(-1.398906826972961),
+ COEF_CONST(-1.387039899826050), COEF_CONST(-1.371831417083740),
+ COEF_CONST(-1.353317975997925), COEF_CONST(-1.331544399261475),
+ COEF_CONST(-1.306562900543213), COEF_CONST(-1.278433918952942),
+ COEF_CONST(-1.247225046157837), COEF_CONST(-1.213011384010315),
+ COEF_CONST(-1.175875544548035), COEF_CONST(-1.135907053947449),
+ COEF_CONST(-1.093201875686646), COEF_CONST(-1.047863125801086),
+ COEF_CONST(-1.000000000000000), COEF_CONST(-0.949727773666382),
+ COEF_CONST(-0.897167563438416), COEF_CONST(-0.842446029186249),
+ COEF_CONST(-0.785694956779480), COEF_CONST(-0.727051079273224),
+ COEF_CONST(-0.666655659675598), COEF_CONST(-0.604654192924500),
+ COEF_CONST(-0.541196048259735), COEF_CONST(-0.476434230804443),
+ COEF_CONST(-0.410524487495422), COEF_CONST(-0.343625843524933),
+ COEF_CONST(-0.275899350643158), COEF_CONST(-0.207508206367493),
+ COEF_CONST(-0.138617098331451), COEF_CONST(-0.069392144680023),
+ COEF_CONST(0), COEF_CONST(0.069392263889313),
+ COEF_CONST(0.138617157936096), COEF_CONST(0.207508206367493),
+ COEF_CONST(0.275899469852448), COEF_CONST(0.343625962734222),
+ COEF_CONST(0.410524636507034), COEF_CONST(0.476434201002121),
+ COEF_CONST(0.541196107864380), COEF_CONST(0.604654192924500),
+ COEF_CONST(0.666655719280243), COEF_CONST(0.727051138877869),
+ COEF_CONST(0.785695075988770), COEF_CONST(0.842446029186249),
+ COEF_CONST(0.897167563438416), COEF_CONST(0.949727773666382)
+};
+
+/* size 64 only! */
+void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag)
+{
+ // Tables with bit reverse values for 5 bits, bit reverse of i at i-th position
+ const uint8_t bit_rev_tab[32] = { 0,16,8,24,4,20,12,28,2,18,10,26,6,22,14,30,1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31 };
+ uint32_t i, i_rev;
+
+ /* Step 2: modulate */
+ // 3*32=96 multiplications
+ // 3*32=96 additions
+ for (i = 0; i < 32; i++)
+ {
+ real_t x_re, x_im, tmp;
+ x_re = in_real[i];
+ x_im = in_imag[i];
+ tmp = MUL_C(x_re + x_im, dct4_64_tab[i]);
+ in_real[i] = MUL_C(x_im, dct4_64_tab[i + 64]) + tmp;
+ in_imag[i] = MUL_C(x_re, dct4_64_tab[i + 32]) + tmp;
+ }
+
+ /* Step 3: FFT, but with output in bit reverse order */
+ fft_dif(in_real, in_imag);
+
+ /* Step 4: modulate + bitreverse reordering */
+ // 3*31+2=95 multiplications
+ // 3*31+2=95 additions
+ for (i = 0; i < 16; i++)
+ {
+ real_t x_re, x_im, tmp;
+ i_rev = bit_rev_tab[i];
+ x_re = in_real[i_rev];
+ x_im = in_imag[i_rev];
+
+ tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]);
+ out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp;
+ out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp;
+ }
+ // i = 16, i_rev = 1 = rev(16);
+ out_imag[16] = MUL_C(in_imag[1] - in_real[1], dct4_64_tab[16 + 3*32]);
+ out_real[16] = MUL_C(in_real[1] + in_imag[1], dct4_64_tab[16 + 3*32]);
+ for (i = 17; i < 32; i++)
+ {
+ real_t x_re, x_im, tmp;
+ i_rev = bit_rev_tab[i];
+ x_re = in_real[i_rev];
+ x_im = in_imag[i_rev];
+ tmp = MUL_C(x_re + x_im, dct4_64_tab[i + 3*32]);
+ out_real[i] = MUL_C(x_im, dct4_64_tab[i + 5*32]) + tmp;
+ out_imag[i] = MUL_C(x_re, dct4_64_tab[i + 4*32]) + tmp;
+ }
+
+}
+
+void DST4_32(real_t *y, real_t *x)
+{
+ real_t f0, f1, f2, f3, f4, f5, f6, f7, f8, f9;
+ real_t f10, f11, f12, f13, f14, f15, f16, f17, f18, f19;
+ real_t f20, f21, f22, f23, f24, f25, f26, f27, f28, f29;
+ real_t f30, f31, f32, f33, f34, f35, f36, f37, f38, f39;
+ real_t f40, f41, f42, f43, f44, f45, f46, f47, f48, f49;
+ real_t f50, f51, f52, f53, f54, f55, f56, f57, f58, f59;
+ real_t f60, f61, f62, f63, f64, f65, f66, f67, f68, f69;
+ real_t f70, f71, f72, f73, f74, f75, f76, f77, f78, f79;
+ real_t f80, f81, f82, f83, f84, f85, f86, f87, f88, f89;
+ real_t f90, f91, f92, f93, f94, f95, f96, f97, f98, f99;
+ real_t f100, f101, f102, f103, f104, f105, f106, f107, f108, f109;
+ real_t f110, f111, f112, f113, f114, f115, f116, f117, f118, f119;
+ real_t f120, f121, f122, f123, f124, f125, f126, f127, f128, f129;
+ real_t f130, f131, f132, f133, f134, f135, f136, f137, f138, f139;
+ real_t f140, f141, f142, f143, f144, f145, f146, f147, f148, f149;
+ real_t f150, f151, f152, f153, f154, f155, f156, f157, f158, f159;
+ real_t f160, f161, f162, f163, f164, f165, f166, f167, f168, f169;
+ real_t f170, f171, f172, f173, f174, f175, f176, f177, f178, f179;
+ real_t f180, f181, f182, f183, f184, f185, f186, f187, f188, f189;
+ real_t f190, f191, f192, f193, f194, f195, f196, f197, f198, f199;
+ real_t f200, f201, f202, f203, f204, f205, f206, f207, f208, f209;
+ real_t f210, f211, f212, f213, f214, f215, f216, f217, f218, f219;
+ real_t f220, f221, f222, f223, f224, f225, f226, f227, f228, f229;
+ real_t f230, f231, f232, f233, f234, f235, f236, f237, f238, f239;
+ real_t f240, f241, f242, f243, f244, f245, f246, f247, f248, f249;
+ real_t f250, f251, f252, f253, f254, f255, f256, f257, f258, f259;
+ real_t f260, f261, f262, f263, f264, f265, f266, f267, f268, f269;
+ real_t f270, f271, f272, f273, f274, f275, f276, f277, f278, f279;
+ real_t f280, f281, f282, f283, f284, f285, f286, f287, f288, f289;
+ real_t f290, f291, f292, f293, f294, f295, f296, f297, f298, f299;
+ real_t f300, f301, f302, f303, f304, f305, f306, f307, f308, f309;
+ real_t f310, f311, f312, f313, f314, f315, f316, f317, f318, f319;
+ real_t f320, f321, f322, f323, f324, f325, f326, f327, f328, f329;
+ real_t f330, f331, f332, f333, f334, f335;
+
+ f0 = x[0] - x[1];
+ f1 = x[2] - x[1];
+ f2 = x[2] - x[3];
+ f3 = x[4] - x[3];
+ f4 = x[4] - x[5];
+ f5 = x[6] - x[5];
+ f6 = x[6] - x[7];
+ f7 = x[8] - x[7];
+ f8 = x[8] - x[9];
+ f9 = x[10] - x[9];
+ f10 = x[10] - x[11];
+ f11 = x[12] - x[11];
+ f12 = x[12] - x[13];
+ f13 = x[14] - x[13];
+ f14 = x[14] - x[15];
+ f15 = x[16] - x[15];
+ f16 = x[16] - x[17];
+ f17 = x[18] - x[17];
+ f18 = x[18] - x[19];
+ f19 = x[20] - x[19];
+ f20 = x[20] - x[21];
+ f21 = x[22] - x[21];
+ f22 = x[22] - x[23];
+ f23 = x[24] - x[23];
+ f24 = x[24] - x[25];
+ f25 = x[26] - x[25];
+ f26 = x[26] - x[27];
+ f27 = x[28] - x[27];
+ f28 = x[28] - x[29];
+ f29 = x[30] - x[29];
+ f30 = x[30] - x[31];
+ f31 = MUL_F(FRAC_CONST(0.7071067811865476), f15);
+ f32 = x[0] - f31;
+ f33 = x[0] + f31;
+ f34 = f7 + f23;
+ f35 = MUL_C(COEF_CONST(1.3065629648763766), f7);
+ f36 = MUL_F(FRAC_CONST(-0.9238795325112866), f34);
+ f37 = MUL_F(FRAC_CONST(-0.5411961001461967), f23);
+ f38 = f35 + f36;
+ f39 = f37 - f36;
+ f40 = f33 - f39;
+ f41 = f33 + f39;
+ f42 = f32 - f38;
+ f43 = f32 + f38;
+ f44 = f11 - f19;
+ f45 = f11 + f19;
+ f46 = MUL_F(FRAC_CONST(0.7071067811865476), f45);
+ f47 = f3 - f46;
+ f48 = f3 + f46;
+ f49 = MUL_F(FRAC_CONST(0.7071067811865476), f44);
+ f50 = f49 - f27;
+ f51 = f49 + f27;
+ f52 = f51 + f48;
+ f53 = MUL_F(FRAC_CONST(-0.7856949583871021), f51);
+ f54 = MUL_F(FRAC_CONST(0.9807852804032304), f52);
+ f55 = MUL_C(COEF_CONST(1.1758756024193588), f48);
+ f56 = f53 + f54;
+ f57 = f55 - f54;
+ f58 = f50 + f47;
+ f59 = MUL_F(FRAC_CONST(-0.2758993792829430), f50);
+ f60 = MUL_F(FRAC_CONST(0.8314696123025452), f58);
+ f61 = MUL_C(COEF_CONST(1.3870398453221475), f47);
+ f62 = f59 + f60;
+ f63 = f61 - f60;
+ f64 = f41 - f56;
+ f65 = f41 + f56;
+ f66 = f43 - f62;
+ f67 = f43 + f62;
+ f68 = f42 - f63;
+ f69 = f42 + f63;
+ f70 = f40 - f57;
+ f71 = f40 + f57;
+ f72 = f5 - f9;
+ f73 = f5 + f9;
+ f74 = f13 - f17;
+ f75 = f13 + f17;
+ f76 = f21 - f25;
+ f77 = f21 + f25;
+ f78 = MUL_F(FRAC_CONST(0.7071067811865476), f75);
+ f79 = f1 - f78;
+ f80 = f1 + f78;
+ f81 = f73 + f77;
+ f82 = MUL_C(COEF_CONST(1.3065629648763766), f73);
+ f83 = MUL_F(FRAC_CONST(-0.9238795325112866), f81);
+ f84 = MUL_F(FRAC_CONST(-0.5411961001461967), f77);
+ f85 = f82 + f83;
+ f86 = f84 - f83;
+ f87 = f80 - f86;
+ f88 = f80 + f86;
+ f89 = f79 - f85;
+ f90 = f79 + f85;
+ f91 = MUL_F(FRAC_CONST(0.7071067811865476), f74);
+ f92 = f29 - f91;
+ f93 = f29 + f91;
+ f94 = f76 + f72;
+ f95 = MUL_C(COEF_CONST(1.3065629648763766), f76);
+ f96 = MUL_F(FRAC_CONST(-0.9238795325112866), f94);
+ f97 = MUL_F(FRAC_CONST(-0.5411961001461967), f72);
+ f98 = f95 + f96;
+ f99 = f97 - f96;
+ f100 = f93 - f99;
+ f101 = f93 + f99;
+ f102 = f92 - f98;
+ f103 = f92 + f98;
+ f104 = f101 + f88;
+ f105 = MUL_F(FRAC_CONST(-0.8971675863426361), f101);
+ f106 = MUL_F(FRAC_CONST(0.9951847266721968), f104);
+ f107 = MUL_C(COEF_CONST(1.0932018670017576), f88);
+ f108 = f105 + f106;
+ f109 = f107 - f106;
+ f110 = f90 - f103;
+ f111 = MUL_F(FRAC_CONST(-0.6666556584777466), f103);
+ f112 = MUL_F(FRAC_CONST(0.9569403357322089), f110);
+ f113 = MUL_C(COEF_CONST(1.2472250129866713), f90);
+ f114 = f112 - f111;
+ f115 = f113 - f112;
+ f116 = f102 + f89;
+ f117 = MUL_F(FRAC_CONST(-0.4105245275223571), f102);
+ f118 = MUL_F(FRAC_CONST(0.8819212643483549), f116);
+ f119 = MUL_C(COEF_CONST(1.3533180011743529), f89);
+ f120 = f117 + f118;
+ f121 = f119 - f118;
+ f122 = f87 - f100;
+ f123 = MUL_F(FRAC_CONST(-0.1386171691990915), f100);
+ f124 = MUL_F(FRAC_CONST(0.7730104533627370), f122);
+ f125 = MUL_C(COEF_CONST(1.4074037375263826), f87);
+ f126 = f124 - f123;
+ f127 = f125 - f124;
+ f128 = f65 - f108;
+ f129 = f65 + f108;
+ f130 = f67 - f114;
+ f131 = f67 + f114;
+ f132 = f69 - f120;
+ f133 = f69 + f120;
+ f134 = f71 - f126;
+ f135 = f71 + f126;
+ f136 = f70 - f127;
+ f137 = f70 + f127;
+ f138 = f68 - f121;
+ f139 = f68 + f121;
+ f140 = f66 - f115;
+ f141 = f66 + f115;
+ f142 = f64 - f109;
+ f143 = f64 + f109;
+ f144 = f0 + f30;
+ f145 = MUL_C(COEF_CONST(1.0478631305325901), f0);
+ f146 = MUL_F(FRAC_CONST(-0.9987954562051724), f144);
+ f147 = MUL_F(FRAC_CONST(-0.9497277818777548), f30);
+ f148 = f145 + f146;
+ f149 = f147 - f146;
+ f150 = f4 + f26;
+ f151 = MUL_F(FRAC_CONST(1.2130114330978077), f4);
+ f152 = MUL_F(FRAC_CONST(-0.9700312531945440), f150);
+ f153 = MUL_F(FRAC_CONST(-0.7270510732912803), f26);
+ f154 = f151 + f152;
+ f155 = f153 - f152;
+ f156 = f8 + f22;
+ f157 = MUL_C(COEF_CONST(1.3315443865537255), f8);
+ f158 = MUL_F(FRAC_CONST(-0.9039892931234433), f156);
+ f159 = MUL_F(FRAC_CONST(-0.4764341996931612), f22);
+ f160 = f157 + f158;
+ f161 = f159 - f158;
+ f162 = f12 + f18;
+ f163 = MUL_C(COEF_CONST(1.3989068359730781), f12);
+ f164 = MUL_F(FRAC_CONST(-0.8032075314806453), f162);
+ f165 = MUL_F(FRAC_CONST(-0.2075082269882124), f18);
+ f166 = f163 + f164;
+ f167 = f165 - f164;
+ f168 = f16 + f14;
+ f169 = MUL_C(COEF_CONST(1.4125100802019777), f16);
+ f170 = MUL_F(FRAC_CONST(-0.6715589548470187), f168);
+ f171 = MUL_F(FRAC_CONST(0.0693921705079402), f14);
+ f172 = f169 + f170;
+ f173 = f171 - f170;
+ f174 = f20 + f10;
+ f175 = MUL_C(COEF_CONST(1.3718313541934939), f20);
+ f176 = MUL_F(FRAC_CONST(-0.5141027441932219), f174);
+ f177 = MUL_F(FRAC_CONST(0.3436258658070501), f10);
+ f178 = f175 + f176;
+ f179 = f177 - f176;
+ f180 = f24 + f6;
+ f181 = MUL_C(COEF_CONST(1.2784339185752409), f24);
+ f182 = MUL_F(FRAC_CONST(-0.3368898533922200), f180);
+ f183 = MUL_F(FRAC_CONST(0.6046542117908008), f6);
+ f184 = f181 + f182;
+ f185 = f183 - f182;
+ f186 = f28 + f2;
+ f187 = MUL_C(COEF_CONST(1.1359069844201433), f28);
+ f188 = MUL_F(FRAC_CONST(-0.1467304744553624), f186);
+ f189 = MUL_F(FRAC_CONST(0.8424460355094185), f2);
+ f190 = f187 + f188;
+ f191 = f189 - f188;
+ f192 = f149 - f173;
+ f193 = f149 + f173;
+ f194 = f148 - f172;
+ f195 = f148 + f172;
+ f196 = f155 - f179;
+ f197 = f155 + f179;
+ f198 = f154 - f178;
+ f199 = f154 + f178;
+ f200 = f161 - f185;
+ f201 = f161 + f185;
+ f202 = f160 - f184;
+ f203 = f160 + f184;
+ f204 = f167 - f191;
+ f205 = f167 + f191;
+ f206 = f166 - f190;
+ f207 = f166 + f190;
+ f208 = f192 + f194;
+ f209 = MUL_C(COEF_CONST(1.1758756024193588), f192);
+ f210 = MUL_F(FRAC_CONST(-0.9807852804032304), f208);
+ f211 = MUL_F(FRAC_CONST(-0.7856949583871021), f194);
+ f212 = f209 + f210;
+ f213 = f211 - f210;
+ f214 = f196 + f198;
+ f215 = MUL_C(COEF_CONST(1.3870398453221475), f196);
+ f216 = MUL_F(FRAC_CONST(-0.5555702330196022), f214);
+ f217 = MUL_F(FRAC_CONST(0.2758993792829431), f198);
+ f218 = f215 + f216;
+ f219 = f217 - f216;
+ f220 = f200 + f202;
+ f221 = MUL_F(FRAC_CONST(0.7856949583871022), f200);
+ f222 = MUL_F(FRAC_CONST(0.1950903220161283), f220);
+ f223 = MUL_C(COEF_CONST(1.1758756024193586), f202);
+ f224 = f221 + f222;
+ f225 = f223 - f222;
+ f226 = f204 + f206;
+ f227 = MUL_F(FRAC_CONST(-0.2758993792829430), f204);
+ f228 = MUL_F(FRAC_CONST(0.8314696123025452), f226);
+ f229 = MUL_C(COEF_CONST(1.3870398453221475), f206);
+ f230 = f227 + f228;
+ f231 = f229 - f228;
+ f232 = f193 - f201;
+ f233 = f193 + f201;
+ f234 = f195 - f203;
+ f235 = f195 + f203;
+ f236 = f197 - f205;
+ f237 = f197 + f205;
+ f238 = f199 - f207;
+ f239 = f199 + f207;
+ f240 = f213 - f225;
+ f241 = f213 + f225;
+ f242 = f212 - f224;
+ f243 = f212 + f224;
+ f244 = f219 - f231;
+ f245 = f219 + f231;
+ f246 = f218 - f230;
+ f247 = f218 + f230;
+ f248 = f232 + f234;
+ f249 = MUL_C(COEF_CONST(1.3065629648763766), f232);
+ f250 = MUL_F(FRAC_CONST(-0.9238795325112866), f248);
+ f251 = MUL_F(FRAC_CONST(-0.5411961001461967), f234);
+ f252 = f249 + f250;
+ f253 = f251 - f250;
+ f254 = f236 + f238;
+ f255 = MUL_F(FRAC_CONST(0.5411961001461969), f236);
+ f256 = MUL_F(FRAC_CONST(0.3826834323650898), f254);
+ f257 = MUL_C(COEF_CONST(1.3065629648763766), f238);
+ f258 = f255 + f256;
+ f259 = f257 - f256;
+ f260 = f240 + f242;
+ f261 = MUL_C(COEF_CONST(1.3065629648763766), f240);
+ f262 = MUL_F(FRAC_CONST(-0.9238795325112866), f260);
+ f263 = MUL_F(FRAC_CONST(-0.5411961001461967), f242);
+ f264 = f261 + f262;
+ f265 = f263 - f262;
+ f266 = f244 + f246;
+ f267 = MUL_F(FRAC_CONST(0.5411961001461969), f244);
+ f268 = MUL_F(FRAC_CONST(0.3826834323650898), f266);
+ f269 = MUL_C(COEF_CONST(1.3065629648763766), f246);
+ f270 = f267 + f268;
+ f271 = f269 - f268;
+ f272 = f233 - f237;
+ f273 = f233 + f237;
+ f274 = f235 - f239;
+ f275 = f235 + f239;
+ f276 = f253 - f259;
+ f277 = f253 + f259;
+ f278 = f252 - f258;
+ f279 = f252 + f258;
+ f280 = f241 - f245;
+ f281 = f241 + f245;
+ f282 = f243 - f247;
+ f283 = f243 + f247;
+ f284 = f265 - f271;
+ f285 = f265 + f271;
+ f286 = f264 - f270;
+ f287 = f264 + f270;
+ f288 = f272 - f274;
+ f289 = f272 + f274;
+ f290 = MUL_F(FRAC_CONST(0.7071067811865474), f288);
+ f291 = MUL_F(FRAC_CONST(0.7071067811865474), f289);
+ f292 = f276 - f278;
+ f293 = f276 + f278;
+ f294 = MUL_F(FRAC_CONST(0.7071067811865474), f292);
+ f295 = MUL_F(FRAC_CONST(0.7071067811865474), f293);
+ f296 = f280 - f282;
+ f297 = f280 + f282;
+ f298 = MUL_F(FRAC_CONST(0.7071067811865474), f296);
+ f299 = MUL_F(FRAC_CONST(0.7071067811865474), f297);
+ f300 = f284 - f286;
+ f301 = f284 + f286;
+ f302 = MUL_F(FRAC_CONST(0.7071067811865474), f300);
+ f303 = MUL_F(FRAC_CONST(0.7071067811865474), f301);
+ f304 = f129 - f273;
+ f305 = f129 + f273;
+ f306 = f131 - f281;
+ f307 = f131 + f281;
+ f308 = f133 - f285;
+ f309 = f133 + f285;
+ f310 = f135 - f277;
+ f311 = f135 + f277;
+ f312 = f137 - f295;
+ f313 = f137 + f295;
+ f314 = f139 - f303;
+ f315 = f139 + f303;
+ f316 = f141 - f299;
+ f317 = f141 + f299;
+ f318 = f143 - f291;
+ f319 = f143 + f291;
+ f320 = f142 - f290;
+ f321 = f142 + f290;
+ f322 = f140 - f298;
+ f323 = f140 + f298;
+ f324 = f138 - f302;
+ f325 = f138 + f302;
+ f326 = f136 - f294;
+ f327 = f136 + f294;
+ f328 = f134 - f279;
+ f329 = f134 + f279;
+ f330 = f132 - f287;
+ f331 = f132 + f287;
+ f332 = f130 - f283;
+ f333 = f130 + f283;
+ f334 = f128 - f275;
+ f335 = f128 + f275;
+ y[31] = MUL_F(FRAC_CONST(0.5001506360206510), f305);
+ y[30] = MUL_F(FRAC_CONST(0.5013584524464084), f307);
+ y[29] = MUL_F(FRAC_CONST(0.5037887256810443), f309);
+ y[28] = MUL_F(FRAC_CONST(0.5074711720725553), f311);
+ y[27] = MUL_F(FRAC_CONST(0.5124514794082247), f313);
+ y[26] = MUL_F(FRAC_CONST(0.5187927131053328), f315);
+ y[25] = MUL_F(FRAC_CONST(0.5265773151542700), f317);
+ y[24] = MUL_F(FRAC_CONST(0.5359098169079920), f319);
+ y[23] = MUL_F(FRAC_CONST(0.5469204379855088), f321);
+ y[22] = MUL_F(FRAC_CONST(0.5597698129470802), f323);
+ y[21] = MUL_F(FRAC_CONST(0.5746551840326600), f325);
+ y[20] = MUL_F(FRAC_CONST(0.5918185358574165), f327);
+ y[19] = MUL_F(FRAC_CONST(0.6115573478825099), f329);
+ y[18] = MUL_F(FRAC_CONST(0.6342389366884031), f331);
+ y[17] = MUL_F(FRAC_CONST(0.6603198078137061), f333);
+ y[16] = MUL_F(FRAC_CONST(0.6903721282002123), f335);
+ y[15] = MUL_F(FRAC_CONST(0.7251205223771985), f334);
+ y[14] = MUL_F(FRAC_CONST(0.7654941649730891), f332);
+ y[13] = MUL_F(FRAC_CONST(0.8127020908144905), f330);
+ y[12] = MUL_F(FRAC_CONST(0.8683447152233481), f328);
+ y[11] = MUL_F(FRAC_CONST(0.9345835970364075), f326);
+ y[10] = MUL_C(COEF_CONST(1.0144082649970547), f324);
+ y[9] = MUL_C(COEF_CONST(1.1120716205797176), f322);
+ y[8] = MUL_C(COEF_CONST(1.2338327379765710), f320);
+ y[7] = MUL_C(COEF_CONST(1.3892939586328277), f318);
+ y[6] = MUL_C(COEF_CONST(1.5939722833856311), f316);
+ y[5] = MUL_C(COEF_CONST(1.8746759800084078), f314);
+ y[4] = MUL_C(COEF_CONST(2.2820500680051619), f312);
+ y[3] = MUL_C(COEF_CONST(2.9246284281582162), f310);
+ y[2] = MUL_C(COEF_CONST(4.0846110781292477), f308);
+ y[1] = MUL_C(COEF_CONST(6.7967507116736332), f306);
+ y[0] = MUL_R(REAL_CONST(20.3738781672314530), f304);
+}
+
+#endif
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dct.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dct.h
new file mode 100644
index 000000000..cd6316af1
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dct.h
@@ -0,0 +1,54 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_dct.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_DCT_H__
+#define __SBR_DCT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag);
+
+void DCT3_32_unscaled(real_t *y, real_t *x);
+void DCT4_32(real_t *y, real_t *x);
+void DST4_32(real_t *y, real_t *x);
+void DCT2_32_unscaled(real_t *y, real_t *x);
+void DCT4_16(real_t *y, real_t *x);
+void DCT2_16_unscaled(real_t *y, real_t *x);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dec.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dec.c
new file mode 100644
index 000000000..be62b9061
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dec.c
@@ -0,0 +1,692 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_dec.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "syntax.h"
+#include "bits.h"
+#include "sbr_syntax.h"
+#include "sbr_qmf.h"
+#include "sbr_hfgen.h"
+#include "sbr_hfadj.h"
+
+
+/* static function declarations */
+static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch);
+static void sbr_save_matrix(sbr_info *sbr, uint8_t ch);
+
+
+sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
+ uint32_t sample_rate, uint8_t downSampledSBR
+#ifdef DRM
+ , uint8_t IsDRM
+#endif
+ )
+{
+ sbr_info *sbr = faad_malloc(sizeof(sbr_info));
+ memset(sbr, 0, sizeof(sbr_info));
+
+ /* save id of the parent element */
+ sbr->id_aac = id_aac;
+ sbr->sample_rate = sample_rate;
+
+ sbr->bs_freq_scale = 2;
+ sbr->bs_alter_scale = 1;
+ sbr->bs_noise_bands = 2;
+ sbr->bs_limiter_bands = 2;
+ sbr->bs_limiter_gains = 2;
+ sbr->bs_interpol_freq = 1;
+ sbr->bs_smoothing_mode = 1;
+ sbr->bs_start_freq = 5;
+ sbr->bs_amp_res = 1;
+ sbr->bs_samplerate_mode = 1;
+ sbr->prevEnvIsShort[0] = -1;
+ sbr->prevEnvIsShort[1] = -1;
+ sbr->header_count = 0;
+ sbr->Reset = 1;
+
+#ifdef DRM
+ sbr->Is_DRM_SBR = IsDRM;
+#endif
+ sbr->tHFGen = T_HFGEN;
+ sbr->tHFAdj = T_HFADJ;
+
+ sbr->bsco = 0;
+ sbr->bsco_prev = 0;
+ sbr->M_prev = 0;
+ sbr->frame_len = framelength;
+
+ /* force sbr reset */
+ sbr->bs_start_freq_prev = -1;
+
+ if (framelength == 960)
+ {
+ sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS_960;
+ sbr->numTimeSlots = NO_TIME_SLOTS_960;
+ } else {
+ sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS;
+ sbr->numTimeSlots = NO_TIME_SLOTS;
+ }
+
+ sbr->GQ_ringbuf_index[0] = 0;
+ sbr->GQ_ringbuf_index[1] = 0;
+
+ if (id_aac == ID_CPE)
+ {
+ /* stereo */
+ uint8_t j;
+ sbr->qmfa[0] = qmfa_init(32);
+ sbr->qmfa[1] = qmfa_init(32);
+ sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64);
+ sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64);
+
+ for (j = 0; j < 5; j++)
+ {
+ sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+ sbr->G_temp_prev[1][j] = faad_malloc(64*sizeof(real_t));
+ sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+ sbr->Q_temp_prev[1][j] = faad_malloc(64*sizeof(real_t));
+ }
+
+ memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+ memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+ } else {
+ /* mono */
+ uint8_t j;
+ sbr->qmfa[0] = qmfa_init(32);
+ sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64);
+ sbr->qmfs[1] = NULL;
+
+ for (j = 0; j < 5; j++)
+ {
+ sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+ sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t));
+ }
+
+ memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+ }
+
+ return sbr;
+}
+
+void sbrDecodeEnd(sbr_info *sbr)
+{
+ uint8_t j;
+
+ if (sbr)
+ {
+ qmfa_end(sbr->qmfa[0]);
+ qmfs_end(sbr->qmfs[0]);
+ if (sbr->qmfs[1] != NULL)
+ {
+ qmfa_end(sbr->qmfa[1]);
+ qmfs_end(sbr->qmfs[1]);
+ }
+
+ for (j = 0; j < 5; j++)
+ {
+ if (sbr->G_temp_prev[0][j]) faad_free(sbr->G_temp_prev[0][j]);
+ if (sbr->Q_temp_prev[0][j]) faad_free(sbr->Q_temp_prev[0][j]);
+ if (sbr->G_temp_prev[1][j]) faad_free(sbr->G_temp_prev[1][j]);
+ if (sbr->Q_temp_prev[1][j]) faad_free(sbr->Q_temp_prev[1][j]);
+ }
+
+#ifdef PS_DEC
+ if (sbr->ps != NULL)
+ ps_free(sbr->ps);
+#endif
+
+#ifdef DRM_PS
+ if (sbr->drm_ps != NULL)
+ drm_ps_free(sbr->drm_ps);
+#endif
+
+ faad_free(sbr);
+ }
+}
+
+void sbrReset(sbr_info *sbr)
+{
+ uint8_t j;
+ if (sbr->qmfa[0] != NULL)
+ memset(sbr->qmfa[0]->x, 0, 2 * sbr->qmfa[0]->channels * 10 * sizeof(real_t));
+ if (sbr->qmfa[1] != NULL)
+ memset(sbr->qmfa[1]->x, 0, 2 * sbr->qmfa[1]->channels * 10 * sizeof(real_t));
+ if (sbr->qmfs[0] != NULL)
+ memset(sbr->qmfs[0]->v, 0, 2 * sbr->qmfs[0]->channels * 20 * sizeof(real_t));
+ if (sbr->qmfs[1] != NULL)
+ memset(sbr->qmfs[1]->v, 0, 2 * sbr->qmfs[1]->channels * 20 * sizeof(real_t));
+
+ for (j = 0; j < 5; j++)
+ {
+ if (sbr->G_temp_prev[0][j] != NULL)
+ memset(sbr->G_temp_prev[0][j], 0, 64*sizeof(real_t));
+ if (sbr->G_temp_prev[1][j] != NULL)
+ memset(sbr->G_temp_prev[1][j], 0, 64*sizeof(real_t));
+ if (sbr->Q_temp_prev[0][j] != NULL)
+ memset(sbr->Q_temp_prev[0][j], 0, 64*sizeof(real_t));
+ if (sbr->Q_temp_prev[1][j] != NULL)
+ memset(sbr->Q_temp_prev[1][j], 0, 64*sizeof(real_t));
+ }
+
+ memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+ memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t));
+
+ sbr->GQ_ringbuf_index[0] = 0;
+ sbr->GQ_ringbuf_index[1] = 0;
+ sbr->header_count = 0;
+ sbr->Reset = 1;
+
+ sbr->L_E_prev[0] = 0;
+ sbr->L_E_prev[1] = 0;
+ sbr->bs_freq_scale = 2;
+ sbr->bs_alter_scale = 1;
+ sbr->bs_noise_bands = 2;
+ sbr->bs_limiter_bands = 2;
+ sbr->bs_limiter_gains = 2;
+ sbr->bs_interpol_freq = 1;
+ sbr->bs_smoothing_mode = 1;
+ sbr->bs_start_freq = 5;
+ sbr->bs_amp_res = 1;
+ sbr->bs_samplerate_mode = 1;
+ sbr->prevEnvIsShort[0] = -1;
+ sbr->prevEnvIsShort[1] = -1;
+ sbr->bsco = 0;
+ sbr->bsco_prev = 0;
+ sbr->M_prev = 0;
+ sbr->bs_start_freq_prev = -1;
+
+ sbr->f_prev[0] = 0;
+ sbr->f_prev[1] = 0;
+ for (j = 0; j < MAX_M; j++)
+ {
+ sbr->E_prev[0][j] = 0;
+ sbr->Q_prev[0][j] = 0;
+ sbr->E_prev[1][j] = 0;
+ sbr->Q_prev[1][j] = 0;
+ sbr->bs_add_harmonic_prev[0][j] = 0;
+ sbr->bs_add_harmonic_prev[1][j] = 0;
+ }
+ sbr->bs_add_harmonic_flag_prev[0] = 0;
+ sbr->bs_add_harmonic_flag_prev[1] = 0;
+}
+
+static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch)
+{
+ uint8_t i;
+
+ /* save data for next frame */
+ sbr->kx_prev = sbr->kx;
+ sbr->M_prev = sbr->M;
+ sbr->bsco_prev = sbr->bsco;
+
+ sbr->L_E_prev[ch] = sbr->L_E[ch];
+
+ /* sbr->L_E[ch] can become 0 on files with bit errors */
+ if (sbr->L_E[ch] <= 0)
+ return 19;
+
+ sbr->f_prev[ch] = sbr->f[ch][sbr->L_E[ch] - 1];
+ for (i = 0; i < MAX_M; i++)
+ {
+ sbr->E_prev[ch][i] = sbr->E[ch][i][sbr->L_E[ch] - 1];
+ sbr->Q_prev[ch][i] = sbr->Q[ch][i][sbr->L_Q[ch] - 1];
+ }
+
+ for (i = 0; i < MAX_M; i++)
+ {
+ sbr->bs_add_harmonic_prev[ch][i] = sbr->bs_add_harmonic[ch][i];
+ }
+ sbr->bs_add_harmonic_flag_prev[ch] = sbr->bs_add_harmonic_flag[ch];
+
+ if (sbr->l_A[ch] == sbr->L_E[ch])
+ sbr->prevEnvIsShort[ch] = 0;
+ else
+ sbr->prevEnvIsShort[ch] = -1;
+
+ return 0;
+}
+
+static void sbr_save_matrix(sbr_info *sbr, uint8_t ch)
+{
+ uint8_t i;
+
+ for (i = 0; i < sbr->tHFGen; i++)
+ {
+ memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t));
+ }
+ for (i = sbr->tHFGen; i < MAX_NTSRHFG; i++)
+ {
+ memset(sbr->Xsbr[ch][i], 0, 64 * sizeof(qmf_t));
+ }
+}
+
+static uint8_t sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64],
+ uint8_t ch, uint8_t dont_process,
+ const uint8_t downSampledSBR)
+{
+ int16_t k, l;
+ uint8_t ret = 0;
+
+#ifdef SBR_LOW_POWER
+ ALIGN real_t deg[64];
+#endif
+
+#ifdef DRM
+ if (sbr->Is_DRM_SBR)
+ {
+ sbr->bsco = max((int32_t)sbr->maxAACLine*32/(int32_t)sbr->frame_len - (int32_t)sbr->kx, 0);
+ } else {
+#endif
+ sbr->bsco = 0;
+#ifdef DRM
+ }
+#endif
+
+
+//#define PRE_QMF_PRINT
+#ifdef PRE_QMF_PRINT
+ {
+ int i;
+ for (i = 0; i < 1024; i++)
+ {
+ printf("%d\n", channel_buf[i]);
+ }
+ }
+#endif
+
+
+ /* subband analysis */
+ if (dont_process)
+ sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, 32);
+ else
+ sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, sbr->kx);
+
+ if (!dont_process)
+ {
+#if 1
+ /* insert high frequencies here */
+ /* hf generation using patching */
+ hf_generation(sbr, sbr->Xsbr[ch], sbr->Xsbr[ch]
+#ifdef SBR_LOW_POWER
+ ,deg
+#endif
+ ,ch);
+#endif
+
+#if 0 //def SBR_LOW_POWER
+ for (l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++)
+ {
+ for (k = 0; k < sbr->kx; k++)
+ {
+ QMF_RE(sbr->Xsbr[ch][sbr->tHFAdj + l][k]) = 0;
+ }
+ }
+#endif
+
+#if 1
+ /* hf adjustment */
+ ret = hf_adjustment(sbr, sbr->Xsbr[ch]
+#ifdef SBR_LOW_POWER
+ ,deg
+#endif
+ ,ch);
+#endif
+ if (ret > 0)
+ {
+ dont_process = 1;
+ }
+ }
+
+ if ((sbr->just_seeked != 0) || dont_process)
+ {
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
+ {
+ for (k = 0; k < 32; k++)
+ {
+ QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+#ifndef SBR_LOW_POWER
+ QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+#endif
+ }
+ for (k = 32; k < 64; k++)
+ {
+ QMF_RE(X[l][k]) = 0;
+#ifndef SBR_LOW_POWER
+ QMF_IM(X[l][k]) = 0;
+#endif
+ }
+ }
+ } else {
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
+ {
+ uint8_t kx_band, M_band, bsco_band;
+
+ if (l < sbr->t_E[ch][0])
+ {
+ kx_band = sbr->kx_prev;
+ M_band = sbr->M_prev;
+ bsco_band = sbr->bsco_prev;
+ } else {
+ kx_band = sbr->kx;
+ M_band = sbr->M;
+ bsco_band = sbr->bsco;
+ }
+
+#ifndef SBR_LOW_POWER
+ for (k = 0; k < kx_band + bsco_band; k++)
+ {
+ QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+ QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+ }
+ for (k = kx_band + bsco_band; k < kx_band + M_band; k++)
+ {
+ QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+ QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+ }
+ for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
+ {
+ QMF_RE(X[l][k]) = 0;
+ QMF_IM(X[l][k]) = 0;
+ }
+#else
+ for (k = 0; k < kx_band + bsco_band; k++)
+ {
+ QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+ }
+ for (k = kx_band + bsco_band; k < min(kx_band + M_band, 63); k++)
+ {
+ QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]);
+ }
+ for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++)
+ {
+ QMF_RE(X[l][k]) = 0;
+ }
+ QMF_RE(X[l][kx_band - 1 + bsco_band]) +=
+ QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][kx_band - 1 + bsco_band]);
+#endif
+ }
+ }
+
+ return ret;
+}
+
+uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
+ const uint8_t just_seeked, const uint8_t downSampledSBR)
+{
+ uint8_t dont_process = 0;
+ uint8_t ret = 0;
+ ALIGN qmf_t X[MAX_NTSR][64];
+
+ if (sbr == NULL)
+ return 20;
+
+ /* case can occur due to bit errors */
+ if (sbr->id_aac != ID_CPE)
+ return 21;
+
+ if (sbr->ret || (sbr->header_count == 0))
+ {
+ /* don't process just upsample */
+ dont_process = 1;
+
+ /* Re-activate reset for next frame */
+ if (sbr->ret && sbr->Reset)
+ sbr->bs_start_freq_prev = -1;
+ }
+
+ if (just_seeked)
+ {
+ sbr->just_seeked = 1;
+ } else {
+ sbr->just_seeked = 0;
+ }
+
+ sbr->ret += sbr_process_channel(sbr, left_chan, X, 0, dont_process, downSampledSBR);
+ /* subband synthesis */
+ if (downSampledSBR)
+ {
+ sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, left_chan);
+ } else {
+ sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan);
+ }
+
+ sbr->ret += sbr_process_channel(sbr, right_chan, X, 1, dont_process, downSampledSBR);
+ /* subband synthesis */
+ if (downSampledSBR)
+ {
+ sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X, right_chan);
+ } else {
+ sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan);
+ }
+
+ if (sbr->bs_header_flag)
+ sbr->just_seeked = 0;
+
+ if (sbr->header_count != 0 && sbr->ret == 0)
+ {
+ ret = sbr_save_prev_data(sbr, 0);
+ if (ret) return ret;
+ ret = sbr_save_prev_data(sbr, 1);
+ if (ret) return ret;
+ }
+
+ sbr_save_matrix(sbr, 0);
+ sbr_save_matrix(sbr, 1);
+
+ sbr->frame++;
+
+//#define POST_QMF_PRINT
+#ifdef POST_QMF_PRINT
+ {
+ int i;
+ for (i = 0; i < 2048; i++)
+ {
+ printf("%d\n", left_chan[i]);
+ }
+ for (i = 0; i < 2048; i++)
+ {
+ printf("%d\n", right_chan[i]);
+ }
+ }
+#endif
+
+ return 0;
+}
+
+uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
+ const uint8_t just_seeked, const uint8_t downSampledSBR)
+{
+ uint8_t dont_process = 0;
+ uint8_t ret = 0;
+ ALIGN qmf_t X[MAX_NTSR][64];
+
+ if (sbr == NULL)
+ return 20;
+
+ /* case can occur due to bit errors */
+ if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE)
+ return 21;
+
+ if (sbr->ret || (sbr->header_count == 0))
+ {
+ /* don't process just upsample */
+ dont_process = 1;
+
+ /* Re-activate reset for next frame */
+ if (sbr->ret && sbr->Reset)
+ sbr->bs_start_freq_prev = -1;
+ }
+
+ if (just_seeked)
+ {
+ sbr->just_seeked = 1;
+ } else {
+ sbr->just_seeked = 0;
+ }
+
+ sbr->ret += sbr_process_channel(sbr, channel, X, 0, dont_process, downSampledSBR);
+ /* subband synthesis */
+ if (downSampledSBR)
+ {
+ sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, channel);
+ } else {
+ sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel);
+ }
+
+ if (sbr->bs_header_flag)
+ sbr->just_seeked = 0;
+
+ if (sbr->header_count != 0 && sbr->ret == 0)
+ {
+ ret = sbr_save_prev_data(sbr, 0);
+ if (ret) return ret;
+ }
+
+ sbr_save_matrix(sbr, 0);
+
+ sbr->frame++;
+
+//#define POST_QMF_PRINT
+#ifdef POST_QMF_PRINT
+ {
+ int i;
+ for (i = 0; i < 2048; i++)
+ {
+ printf("%d\n", channel[i]);
+ }
+ }
+#endif
+
+ return 0;
+}
+
+#if (defined(PS_DEC) || defined(DRM_PS))
+uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
+ const uint8_t just_seeked, const uint8_t downSampledSBR)
+{
+ uint8_t l, k;
+ uint8_t dont_process = 0;
+ uint8_t ret = 0;
+ ALIGN qmf_t X_left[38][64] = {{0}};
+ ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */
+
+ if (sbr == NULL)
+ return 20;
+
+ /* case can occur due to bit errors */
+ if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE)
+ return 21;
+
+ if (sbr->ret || (sbr->header_count == 0))
+ {
+ /* don't process just upsample */
+ dont_process = 1;
+
+ /* Re-activate reset for next frame */
+ if (sbr->ret && sbr->Reset)
+ sbr->bs_start_freq_prev = -1;
+ }
+
+ if (just_seeked)
+ {
+ sbr->just_seeked = 1;
+ } else {
+ sbr->just_seeked = 0;
+ }
+
+ if (sbr->qmfs[1] == NULL)
+ {
+ sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64);
+ }
+
+ sbr->ret += sbr_process_channel(sbr, left_channel, X_left, 0, dont_process, downSampledSBR);
+
+ /* copy some extra data for PS */
+ for (l = 32; l < 38; l++)
+ {
+ for (k = 0; k < 5; k++)
+ {
+ QMF_RE(X_left[l][k]) = QMF_RE(sbr->Xsbr[0][sbr->tHFAdj+l][k]);
+ QMF_IM(X_left[l][k]) = QMF_IM(sbr->Xsbr[0][sbr->tHFAdj+l][k]);
+ }
+ }
+
+ /* perform parametric stereo */
+#ifdef DRM_PS
+ if (sbr->Is_DRM_SBR)
+ {
+ drm_ps_decode(sbr->drm_ps, (sbr->ret > 0), X_left, X_right);
+ } else {
+#endif
+#ifdef PS_DEC
+ ps_decode(sbr->ps, X_left, X_right);
+#endif
+#ifdef DRM_PS
+ }
+#endif
+
+ /* subband synthesis */
+ if (downSampledSBR)
+ {
+ sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X_left, left_channel);
+ sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X_right, right_channel);
+ } else {
+ sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel);
+ sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel);
+ }
+
+ if (sbr->bs_header_flag)
+ sbr->just_seeked = 0;
+
+ if (sbr->header_count != 0 && sbr->ret == 0)
+ {
+ ret = sbr_save_prev_data(sbr, 0);
+ if (ret) return ret;
+ }
+
+ sbr_save_matrix(sbr, 0);
+
+ sbr->frame++;
+
+ return 0;
+}
+#endif
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dec.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dec.h
new file mode 100644
index 000000000..67dd91c19
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_dec.h
@@ -0,0 +1,255 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_dec.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_DEC_H__
+#define __SBR_DEC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PS_DEC
+#include "ps_dec.h"
+#endif
+#ifdef DRM_PS
+#include "drm_dec.h"
+#endif
+
+/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */
+#define MAX_NTSRHFG 40
+#define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
+
+/* MAX_M: maximum value for M */
+#define MAX_M 49
+/* MAX_L_E: maximum value for L_E */
+#define MAX_L_E 5
+
+typedef struct {
+ real_t *x;
+ int16_t x_index;
+ uint8_t channels;
+} qmfa_info;
+
+typedef struct {
+ real_t *v;
+ int16_t v_index;
+ uint8_t channels;
+} qmfs_info;
+
+typedef struct
+{
+ uint32_t sample_rate;
+ uint32_t maxAACLine;
+
+ uint8_t rate;
+ uint8_t just_seeked;
+ uint8_t ret;
+
+ uint8_t amp_res[2];
+
+ uint8_t k0;
+ uint8_t kx;
+ uint8_t M;
+ uint8_t N_master;
+ uint8_t N_high;
+ uint8_t N_low;
+ uint8_t N_Q;
+ uint8_t N_L[4];
+ uint8_t n[2];
+
+ uint8_t f_master[64];
+ uint8_t f_table_res[2][64];
+ uint8_t f_table_noise[64];
+ uint8_t f_table_lim[4][64];
+#ifdef SBR_LOW_POWER
+ uint8_t f_group[5][64];
+ uint8_t N_G[5];
+#endif
+
+ uint8_t table_map_k_to_g[64];
+
+ uint8_t abs_bord_lead[2];
+ uint8_t abs_bord_trail[2];
+ uint8_t n_rel_lead[2];
+ uint8_t n_rel_trail[2];
+
+ uint8_t L_E[2];
+ uint8_t L_E_prev[2];
+ uint8_t L_Q[2];
+
+ uint8_t t_E[2][MAX_L_E+1];
+ uint8_t t_Q[2][3];
+ uint8_t f[2][MAX_L_E+1];
+ uint8_t f_prev[2];
+
+ real_t *G_temp_prev[2][5];
+ real_t *Q_temp_prev[2][5];
+ int8_t GQ_ringbuf_index[2];
+
+ int16_t E[2][64][MAX_L_E];
+ int16_t E_prev[2][64];
+#ifndef FIXED_POINT
+ real_t E_orig[2][64][MAX_L_E];
+#endif
+ real_t E_curr[2][64][MAX_L_E];
+ int32_t Q[2][64][2];
+#ifndef FIXED_POINT
+ real_t Q_div[2][64][2];
+ real_t Q_div2[2][64][2];
+#endif
+ int32_t Q_prev[2][64];
+
+ int8_t l_A[2];
+ int8_t l_A_prev[2];
+
+ uint8_t bs_invf_mode[2][MAX_L_E];
+ uint8_t bs_invf_mode_prev[2][MAX_L_E];
+ real_t bwArray[2][64];
+ real_t bwArray_prev[2][64];
+
+ uint8_t noPatches;
+ uint8_t patchNoSubbands[64];
+ uint8_t patchStartSubband[64];
+
+ uint8_t bs_add_harmonic[2][64];
+ uint8_t bs_add_harmonic_prev[2][64];
+
+ uint16_t index_noise_prev[2];
+ uint8_t psi_is_prev[2];
+
+ uint8_t bs_start_freq_prev;
+ uint8_t bs_stop_freq_prev;
+ uint8_t bs_xover_band_prev;
+ uint8_t bs_freq_scale_prev;
+ uint8_t bs_alter_scale_prev;
+ uint8_t bs_noise_bands_prev;
+
+ int8_t prevEnvIsShort[2];
+
+ int8_t kx_prev;
+ uint8_t bsco;
+ uint8_t bsco_prev;
+ uint8_t M_prev;
+ uint16_t frame_len;
+
+ uint8_t Reset;
+ uint32_t frame;
+ uint32_t header_count;
+
+ uint8_t id_aac;
+ qmfa_info *qmfa[2];
+ qmfs_info *qmfs[2];
+
+ qmf_t Xsbr[2][MAX_NTSRHFG][64];
+
+#ifdef DRM
+ uint8_t Is_DRM_SBR;
+#ifdef DRM_PS
+ drm_ps_info *drm_ps;
+#endif
+#endif
+
+ uint8_t numTimeSlotsRate;
+ uint8_t numTimeSlots;
+ uint8_t tHFGen;
+ uint8_t tHFAdj;
+
+#ifdef PS_DEC
+ ps_info *ps;
+#endif
+#if (defined(PS_DEC) || defined(DRM_PS))
+ uint8_t ps_used;
+#endif
+
+ /* to get it compiling */
+ /* we'll see during the coding of all the tools, whether
+ these are all used or not.
+ */
+ uint8_t bs_header_flag;
+ uint8_t bs_crc_flag;
+ uint16_t bs_sbr_crc_bits;
+ uint8_t bs_protocol_version;
+ uint8_t bs_amp_res;
+ uint8_t bs_start_freq;
+ uint8_t bs_stop_freq;
+ uint8_t bs_xover_band;
+ uint8_t bs_freq_scale;
+ uint8_t bs_alter_scale;
+ uint8_t bs_noise_bands;
+ uint8_t bs_limiter_bands;
+ uint8_t bs_limiter_gains;
+ uint8_t bs_interpol_freq;
+ uint8_t bs_smoothing_mode;
+ uint8_t bs_samplerate_mode;
+ uint8_t bs_add_harmonic_flag[2];
+ uint8_t bs_add_harmonic_flag_prev[2];
+ uint8_t bs_extended_data;
+ uint8_t bs_extension_id;
+ uint8_t bs_extension_data;
+ uint8_t bs_coupling;
+ uint8_t bs_frame_class[2];
+ uint8_t bs_rel_bord[2][9];
+ uint8_t bs_rel_bord_0[2][9];
+ uint8_t bs_rel_bord_1[2][9];
+ uint8_t bs_pointer[2];
+ uint8_t bs_abs_bord_0[2];
+ uint8_t bs_abs_bord_1[2];
+ uint8_t bs_num_rel_0[2];
+ uint8_t bs_num_rel_1[2];
+ uint8_t bs_df_env[2][9];
+ uint8_t bs_df_noise[2][3];
+} sbr_info;
+
+sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
+ uint32_t sample_rate, uint8_t downSampledSBR
+#ifdef DRM
+ , uint8_t IsDRM
+#endif
+ );
+void sbrDecodeEnd(sbr_info *sbr);
+void sbrReset(sbr_info *sbr);
+
+uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
+ const uint8_t just_seeked, const uint8_t downSampledSBR);
+uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
+ const uint8_t just_seeked, const uint8_t downSampledSBR);
+#if (defined(PS_DEC) || defined(DRM_PS))
+uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
+ const uint8_t just_seeked, const uint8_t downSampledSBR);
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_e_nf.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_e_nf.c
new file mode 100644
index 000000000..c729a070a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_e_nf.c
@@ -0,0 +1,512 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_e_nf.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include <stdlib.h>
+
+#include "sbr_syntax.h"
+#include "sbr_e_nf.h"
+
+void extract_envelope_data(sbr_info *sbr, uint8_t ch)
+{
+ uint8_t l, k;
+
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ if (sbr->bs_df_env[ch][l] == 0)
+ {
+ for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++)
+ {
+ sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l];
+ if (sbr->E[ch][k][l] < 0)
+ sbr->E[ch][k][l] = 0;
+ }
+
+ } else { /* bs_df_env == 1 */
+
+ uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1];
+ int16_t E_prev;
+
+ if (sbr->f[ch][l] == g)
+ {
+ for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+ {
+ if (l == 0)
+ E_prev = sbr->E_prev[ch][k];
+ else
+ E_prev = sbr->E[ch][k][l - 1];
+
+ sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
+ }
+
+ } else if ((g == 1) && (sbr->f[ch][l] == 0)) {
+ uint8_t i;
+
+ for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+ {
+ for (i = 0; i < sbr->N_high; i++)
+ {
+ if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k])
+ {
+ if (l == 0)
+ E_prev = sbr->E_prev[ch][i];
+ else
+ E_prev = sbr->E[ch][i][l - 1];
+
+ sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
+ }
+ }
+ }
+
+ } else if ((g == 0) && (sbr->f[ch][l] == 1)) {
+ uint8_t i;
+
+ for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+ {
+ for (i = 0; i < sbr->N_low; i++)
+ {
+ if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) &&
+ (sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1]))
+ {
+ if (l == 0)
+ E_prev = sbr->E_prev[ch][i];
+ else
+ E_prev = sbr->E[ch][i][l - 1];
+
+ sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void extract_noise_floor_data(sbr_info *sbr, uint8_t ch)
+{
+ uint8_t l, k;
+
+ for (l = 0; l < sbr->L_Q[ch]; l++)
+ {
+ if (sbr->bs_df_noise[ch][l] == 0)
+ {
+ for (k = 1; k < sbr->N_Q; k++)
+ {
+ sbr->Q[ch][k][l] = sbr->Q[ch][k][l] + sbr->Q[ch][k-1][l];
+ }
+ } else {
+ if (l == 0)
+ {
+ for (k = 0; k < sbr->N_Q; k++)
+ {
+ sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0];
+ }
+ } else {
+ for (k = 0; k < sbr->N_Q; k++)
+ {
+ sbr->Q[ch][k][l] = sbr->Q[ch][k][l - 1] + sbr->Q[ch][k][l];
+ }
+ }
+ }
+ }
+}
+
+#ifndef FIXED_POINT
+
+/* table for Q_div values when no coupling */
+static const real_t Q_div_tab[31] = {
+ FRAC_CONST(0.0153846), FRAC_CONST(0.030303),
+ FRAC_CONST(0.0588235), FRAC_CONST(0.111111),
+ FRAC_CONST(0.2), FRAC_CONST(0.333333),
+ FRAC_CONST(0.5), FRAC_CONST(0.666667),
+ FRAC_CONST(0.8), FRAC_CONST(0.888889),
+ FRAC_CONST(0.941176), FRAC_CONST(0.969697),
+ FRAC_CONST(0.984615), FRAC_CONST(0.992248),
+ FRAC_CONST(0.996109), FRAC_CONST(0.998051),
+ FRAC_CONST(0.999024), FRAC_CONST(0.999512),
+ FRAC_CONST(0.999756), FRAC_CONST(0.999878),
+ FRAC_CONST(0.999939), FRAC_CONST(0.999969),
+ FRAC_CONST(0.999985), FRAC_CONST(0.999992),
+ FRAC_CONST(0.999996), FRAC_CONST(0.999998),
+ FRAC_CONST(0.999999), FRAC_CONST(1),
+ FRAC_CONST(1), FRAC_CONST(1),
+ FRAC_CONST(1)
+};
+
+static const real_t Q_div_tab_left[31][13] = {
+ { FRAC_CONST(0.969704), FRAC_CONST(0.888985), FRAC_CONST(0.667532), FRAC_CONST(0.336788), FRAC_CONST(0.117241), FRAC_CONST(0.037594), FRAC_CONST(0.0153846), FRAC_CONST(0.00967118), FRAC_CONST(0.00823245), FRAC_CONST(0.00787211), FRAC_CONST(0.00778198), FRAC_CONST(0.00775945), FRAC_CONST(0.00775382) },
+ { FRAC_CONST(0.984619), FRAC_CONST(0.94123), FRAC_CONST(0.800623), FRAC_CONST(0.503876), FRAC_CONST(0.209877), FRAC_CONST(0.0724638), FRAC_CONST(0.030303), FRAC_CONST(0.0191571), FRAC_CONST(0.0163305), FRAC_CONST(0.0156212), FRAC_CONST(0.0154438), FRAC_CONST(0.0153994), FRAC_CONST(0.0153883) },
+ { FRAC_CONST(0.99225), FRAC_CONST(0.969726), FRAC_CONST(0.889273), FRAC_CONST(0.670103), FRAC_CONST(0.346939), FRAC_CONST(0.135135), FRAC_CONST(0.0588235), FRAC_CONST(0.037594), FRAC_CONST(0.0321361), FRAC_CONST(0.0307619), FRAC_CONST(0.0304178), FRAC_CONST(0.0303317), FRAC_CONST(0.0303102) },
+ { FRAC_CONST(0.99611), FRAC_CONST(0.98463), FRAC_CONST(0.941392), FRAC_CONST(0.802469), FRAC_CONST(0.515152), FRAC_CONST(0.238095), FRAC_CONST(0.111111), FRAC_CONST(0.0724638), FRAC_CONST(0.0622711), FRAC_CONST(0.0596878), FRAC_CONST(0.0590397), FRAC_CONST(0.0588776), FRAC_CONST(0.058837) },
+ { FRAC_CONST(0.998051), FRAC_CONST(0.992256), FRAC_CONST(0.969811), FRAC_CONST(0.890411), FRAC_CONST(0.68), FRAC_CONST(0.384615), FRAC_CONST(0.2), FRAC_CONST(0.135135), FRAC_CONST(0.117241), FRAC_CONST(0.112652), FRAC_CONST(0.111497), FRAC_CONST(0.111208), FRAC_CONST(0.111135) },
+ { FRAC_CONST(0.999025), FRAC_CONST(0.996113), FRAC_CONST(0.984674), FRAC_CONST(0.942029), FRAC_CONST(0.809524), FRAC_CONST(0.555556), FRAC_CONST(0.333333), FRAC_CONST(0.238095), FRAC_CONST(0.209877), FRAC_CONST(0.202492), FRAC_CONST(0.200625), FRAC_CONST(0.200156), FRAC_CONST(0.200039) },
+ { FRAC_CONST(0.999512), FRAC_CONST(0.998053), FRAC_CONST(0.992278), FRAC_CONST(0.970149), FRAC_CONST(0.894737), FRAC_CONST(0.714286), FRAC_CONST(0.5), FRAC_CONST(0.384615), FRAC_CONST(0.346939), FRAC_CONST(0.336788), FRAC_CONST(0.3342), FRAC_CONST(0.33355), FRAC_CONST(0.333388) },
+ { FRAC_CONST(0.999756), FRAC_CONST(0.999025), FRAC_CONST(0.996124), FRAC_CONST(0.984848), FRAC_CONST(0.944444), FRAC_CONST(0.833333), FRAC_CONST(0.666667), FRAC_CONST(0.555556), FRAC_CONST(0.515152), FRAC_CONST(0.503876), FRAC_CONST(0.500975), FRAC_CONST(0.500244), FRAC_CONST(0.500061) },
+ { FRAC_CONST(0.999878), FRAC_CONST(0.999512), FRAC_CONST(0.998058), FRAC_CONST(0.992366), FRAC_CONST(0.971429), FRAC_CONST(0.909091), FRAC_CONST(0.8), FRAC_CONST(0.714286), FRAC_CONST(0.68), FRAC_CONST(0.670103), FRAC_CONST(0.667532), FRAC_CONST(0.666884), FRAC_CONST(0.666721) },
+ { FRAC_CONST(0.999939), FRAC_CONST(0.999756), FRAC_CONST(0.999028), FRAC_CONST(0.996169), FRAC_CONST(0.985507), FRAC_CONST(0.952381), FRAC_CONST(0.888889), FRAC_CONST(0.833333), FRAC_CONST(0.809524), FRAC_CONST(0.802469), FRAC_CONST(0.800623), FRAC_CONST(0.800156), FRAC_CONST(0.800039) },
+ { FRAC_CONST(0.999969), FRAC_CONST(0.999878), FRAC_CONST(0.999514), FRAC_CONST(0.998081), FRAC_CONST(0.992701), FRAC_CONST(0.97561), FRAC_CONST(0.941176), FRAC_CONST(0.909091), FRAC_CONST(0.894737), FRAC_CONST(0.890411), FRAC_CONST(0.889273), FRAC_CONST(0.888985), FRAC_CONST(0.888913) },
+ { FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.999757), FRAC_CONST(0.999039), FRAC_CONST(0.996337), FRAC_CONST(0.987654), FRAC_CONST(0.969697), FRAC_CONST(0.952381), FRAC_CONST(0.944444), FRAC_CONST(0.942029), FRAC_CONST(0.941392), FRAC_CONST(0.94123), FRAC_CONST(0.94119) },
+ { FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999878), FRAC_CONST(0.999519), FRAC_CONST(0.998165), FRAC_CONST(0.993789), FRAC_CONST(0.984615), FRAC_CONST(0.97561), FRAC_CONST(0.971429), FRAC_CONST(0.970149), FRAC_CONST(0.969811), FRAC_CONST(0.969726), FRAC_CONST(0.969704) },
+ { FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.99976), FRAC_CONST(0.999082), FRAC_CONST(0.996885), FRAC_CONST(0.992248), FRAC_CONST(0.987654), FRAC_CONST(0.985507), FRAC_CONST(0.984848), FRAC_CONST(0.984674), FRAC_CONST(0.98463), FRAC_CONST(0.984619) },
+ { FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.99988), FRAC_CONST(0.999541), FRAC_CONST(0.99844), FRAC_CONST(0.996109), FRAC_CONST(0.993789), FRAC_CONST(0.992701), FRAC_CONST(0.992366), FRAC_CONST(0.992278), FRAC_CONST(0.992256), FRAC_CONST(0.99225) },
+ { FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.99994), FRAC_CONST(0.99977), FRAC_CONST(0.999219), FRAC_CONST(0.998051), FRAC_CONST(0.996885), FRAC_CONST(0.996337), FRAC_CONST(0.996169), FRAC_CONST(0.996124), FRAC_CONST(0.996113), FRAC_CONST(0.99611) },
+ { FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999885), FRAC_CONST(0.99961), FRAC_CONST(0.999024), FRAC_CONST(0.99844), FRAC_CONST(0.998165), FRAC_CONST(0.998081), FRAC_CONST(0.998058), FRAC_CONST(0.998053), FRAC_CONST(0.998051) },
+ { FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999943), FRAC_CONST(0.999805), FRAC_CONST(0.999512), FRAC_CONST(0.999219), FRAC_CONST(0.999082), FRAC_CONST(0.999039), FRAC_CONST(0.999028), FRAC_CONST(0.999025), FRAC_CONST(0.999025) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.999971), FRAC_CONST(0.999902), FRAC_CONST(0.999756), FRAC_CONST(0.99961), FRAC_CONST(0.999541), FRAC_CONST(0.999519), FRAC_CONST(0.999514), FRAC_CONST(0.999512), FRAC_CONST(0.999512) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999986), FRAC_CONST(0.999951), FRAC_CONST(0.999878), FRAC_CONST(0.999805), FRAC_CONST(0.99977), FRAC_CONST(0.99976), FRAC_CONST(0.999757), FRAC_CONST(0.999756), FRAC_CONST(0.999756) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999993), FRAC_CONST(0.999976), FRAC_CONST(0.999939), FRAC_CONST(0.999902), FRAC_CONST(0.999885), FRAC_CONST(0.99988), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999988), FRAC_CONST(0.999969), FRAC_CONST(0.999951), FRAC_CONST(0.999943), FRAC_CONST(0.99994), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999994), FRAC_CONST(0.999985), FRAC_CONST(0.999976), FRAC_CONST(0.999971), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999969) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999997), FRAC_CONST(0.999992), FRAC_CONST(0.999988), FRAC_CONST(0.999986), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999996), FRAC_CONST(0.999994), FRAC_CONST(0.999993), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999997), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }
+};
+
+static const real_t Q_div_tab_right[31][13] = {
+ { FRAC_CONST(0.00775382), FRAC_CONST(0.00775945), FRAC_CONST(0.00778198), FRAC_CONST(0.00787211), FRAC_CONST(0.00823245), FRAC_CONST(0.00967118), FRAC_CONST(0.0153846), FRAC_CONST(0.037594), FRAC_CONST(0.117241), FRAC_CONST(0.336788), FRAC_CONST(0.667532), FRAC_CONST(0.888985), FRAC_CONST(0.969704) },
+ { FRAC_CONST(0.0153883), FRAC_CONST(0.0153994), FRAC_CONST(0.0154438), FRAC_CONST(0.0156212), FRAC_CONST(0.0163305), FRAC_CONST(0.0191571), FRAC_CONST(0.030303), FRAC_CONST(0.0724638), FRAC_CONST(0.209877), FRAC_CONST(0.503876), FRAC_CONST(0.800623), FRAC_CONST(0.94123), FRAC_CONST(0.984619) },
+ { FRAC_CONST(0.0303102), FRAC_CONST(0.0303317), FRAC_CONST(0.0304178), FRAC_CONST(0.0307619), FRAC_CONST(0.0321361), FRAC_CONST(0.037594), FRAC_CONST(0.0588235), FRAC_CONST(0.135135), FRAC_CONST(0.346939), FRAC_CONST(0.670103), FRAC_CONST(0.889273), FRAC_CONST(0.969726), FRAC_CONST(0.99225) },
+ { FRAC_CONST(0.058837), FRAC_CONST(0.0588776), FRAC_CONST(0.0590397), FRAC_CONST(0.0596878), FRAC_CONST(0.0622711), FRAC_CONST(0.0724638), FRAC_CONST(0.111111), FRAC_CONST(0.238095), FRAC_CONST(0.515152), FRAC_CONST(0.802469), FRAC_CONST(0.941392), FRAC_CONST(0.98463), FRAC_CONST(0.99611) },
+ { FRAC_CONST(0.111135), FRAC_CONST(0.111208), FRAC_CONST(0.111497), FRAC_CONST(0.112652), FRAC_CONST(0.117241), FRAC_CONST(0.135135), FRAC_CONST(0.2), FRAC_CONST(0.384615), FRAC_CONST(0.68), FRAC_CONST(0.890411), FRAC_CONST(0.969811), FRAC_CONST(0.992256), FRAC_CONST(0.998051) },
+ { FRAC_CONST(0.200039), FRAC_CONST(0.200156), FRAC_CONST(0.200625), FRAC_CONST(0.202492), FRAC_CONST(0.209877), FRAC_CONST(0.238095), FRAC_CONST(0.333333), FRAC_CONST(0.555556), FRAC_CONST(0.809524), FRAC_CONST(0.942029), FRAC_CONST(0.984674), FRAC_CONST(0.996113), FRAC_CONST(0.999025) },
+ { FRAC_CONST(0.333388), FRAC_CONST(0.33355), FRAC_CONST(0.3342), FRAC_CONST(0.336788), FRAC_CONST(0.346939), FRAC_CONST(0.384615), FRAC_CONST(0.5), FRAC_CONST(0.714286), FRAC_CONST(0.894737), FRAC_CONST(0.970149), FRAC_CONST(0.992278), FRAC_CONST(0.998053), FRAC_CONST(0.999512) },
+ { FRAC_CONST(0.500061), FRAC_CONST(0.500244), FRAC_CONST(0.500975), FRAC_CONST(0.503876), FRAC_CONST(0.515152), FRAC_CONST(0.555556), FRAC_CONST(0.666667), FRAC_CONST(0.833333), FRAC_CONST(0.944444), FRAC_CONST(0.984848), FRAC_CONST(0.996124), FRAC_CONST(0.999025), FRAC_CONST(0.999756) },
+ { FRAC_CONST(0.666721), FRAC_CONST(0.666884), FRAC_CONST(0.667532), FRAC_CONST(0.670103), FRAC_CONST(0.68), FRAC_CONST(0.714286), FRAC_CONST(0.8), FRAC_CONST(0.909091), FRAC_CONST(0.971429), FRAC_CONST(0.992366), FRAC_CONST(0.998058), FRAC_CONST(0.999512), FRAC_CONST(0.999878) },
+ { FRAC_CONST(0.800039), FRAC_CONST(0.800156), FRAC_CONST(0.800623), FRAC_CONST(0.802469), FRAC_CONST(0.809524), FRAC_CONST(0.833333), FRAC_CONST(0.888889), FRAC_CONST(0.952381), FRAC_CONST(0.985507), FRAC_CONST(0.996169), FRAC_CONST(0.999028), FRAC_CONST(0.999756), FRAC_CONST(0.999939) },
+ { FRAC_CONST(0.888913), FRAC_CONST(0.888985), FRAC_CONST(0.889273), FRAC_CONST(0.890411), FRAC_CONST(0.894737), FRAC_CONST(0.909091), FRAC_CONST(0.941176), FRAC_CONST(0.97561), FRAC_CONST(0.992701), FRAC_CONST(0.998081), FRAC_CONST(0.999514), FRAC_CONST(0.999878), FRAC_CONST(0.999969) },
+ { FRAC_CONST(0.94119), FRAC_CONST(0.94123), FRAC_CONST(0.941392), FRAC_CONST(0.942029), FRAC_CONST(0.944444), FRAC_CONST(0.952381), FRAC_CONST(0.969697), FRAC_CONST(0.987654), FRAC_CONST(0.996337), FRAC_CONST(0.999039), FRAC_CONST(0.999757), FRAC_CONST(0.999939), FRAC_CONST(0.999985) },
+ { FRAC_CONST(0.969704), FRAC_CONST(0.969726), FRAC_CONST(0.969811), FRAC_CONST(0.970149), FRAC_CONST(0.971429), FRAC_CONST(0.97561), FRAC_CONST(0.984615), FRAC_CONST(0.993789), FRAC_CONST(0.998165), FRAC_CONST(0.999519), FRAC_CONST(0.999878), FRAC_CONST(0.99997), FRAC_CONST(0.999992) },
+ { FRAC_CONST(0.984619), FRAC_CONST(0.98463), FRAC_CONST(0.984674), FRAC_CONST(0.984848), FRAC_CONST(0.985507), FRAC_CONST(0.987654), FRAC_CONST(0.992248), FRAC_CONST(0.996885), FRAC_CONST(0.999082), FRAC_CONST(0.99976), FRAC_CONST(0.999939), FRAC_CONST(0.999985), FRAC_CONST(0.999996) },
+ { FRAC_CONST(0.99225), FRAC_CONST(0.992256), FRAC_CONST(0.992278), FRAC_CONST(0.992366), FRAC_CONST(0.992701), FRAC_CONST(0.993789), FRAC_CONST(0.996109), FRAC_CONST(0.99844), FRAC_CONST(0.999541), FRAC_CONST(0.99988), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998) },
+ { FRAC_CONST(0.99611), FRAC_CONST(0.996113), FRAC_CONST(0.996124), FRAC_CONST(0.996169), FRAC_CONST(0.996337), FRAC_CONST(0.996885), FRAC_CONST(0.998051), FRAC_CONST(0.999219), FRAC_CONST(0.99977), FRAC_CONST(0.99994), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999) },
+ { FRAC_CONST(0.998051), FRAC_CONST(0.998053), FRAC_CONST(0.998058), FRAC_CONST(0.998081), FRAC_CONST(0.998165), FRAC_CONST(0.99844), FRAC_CONST(0.999024), FRAC_CONST(0.99961), FRAC_CONST(0.999885), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1) },
+ { FRAC_CONST(0.999025), FRAC_CONST(0.999025), FRAC_CONST(0.999028), FRAC_CONST(0.999039), FRAC_CONST(0.999082), FRAC_CONST(0.999219), FRAC_CONST(0.999512), FRAC_CONST(0.999805), FRAC_CONST(0.999943), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1) },
+ { FRAC_CONST(0.999512), FRAC_CONST(0.999512), FRAC_CONST(0.999514), FRAC_CONST(0.999519), FRAC_CONST(0.999541), FRAC_CONST(0.99961), FRAC_CONST(0.999756), FRAC_CONST(0.999902), FRAC_CONST(0.999971), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.999756), FRAC_CONST(0.999756), FRAC_CONST(0.999757), FRAC_CONST(0.99976), FRAC_CONST(0.99977), FRAC_CONST(0.999805), FRAC_CONST(0.999878), FRAC_CONST(0.999951), FRAC_CONST(0.999986), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.99988), FRAC_CONST(0.999885), FRAC_CONST(0.999902), FRAC_CONST(0.999939), FRAC_CONST(0.999976), FRAC_CONST(0.999993), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.99994), FRAC_CONST(0.999943), FRAC_CONST(0.999951), FRAC_CONST(0.999969), FRAC_CONST(0.999988), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.999969), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999971), FRAC_CONST(0.999976), FRAC_CONST(0.999985), FRAC_CONST(0.999994), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999986), FRAC_CONST(0.999988), FRAC_CONST(0.999992), FRAC_CONST(0.999997), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999993), FRAC_CONST(0.999994), FRAC_CONST(0.999996), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999997), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
+ { FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }
+};
+
+/* calculates 1/(1+Q) */
+/* [0..1] */
+real_t calc_Q_div(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
+{
+ if (sbr->bs_coupling)
+ {
+ /* left channel */
+ if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
+ (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
+ {
+ return 0;
+ } else {
+ /* the pan parameter is always even */
+ if (ch == 0)
+ {
+ return Q_div_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+ } else {
+ return Q_div_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+ }
+ }
+ } else {
+ /* no coupling */
+ if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
+ {
+ return 0;
+ } else {
+ return Q_div_tab[sbr->Q[ch][m][l]];
+ }
+ }
+}
+
+/* table for Q_div2 values when no coupling */
+static const real_t Q_div2_tab[31] = {
+ FRAC_CONST(0.984615), FRAC_CONST(0.969697),
+ FRAC_CONST(0.941176), FRAC_CONST(0.888889),
+ FRAC_CONST(0.8), FRAC_CONST(0.666667),
+ FRAC_CONST(0.5), FRAC_CONST(0.333333),
+ FRAC_CONST(0.2), FRAC_CONST(0.111111),
+ FRAC_CONST(0.0588235), FRAC_CONST(0.030303),
+ FRAC_CONST(0.0153846), FRAC_CONST(0.00775194),
+ FRAC_CONST(0.00389105), FRAC_CONST(0.00194932),
+ FRAC_CONST(0.00097561), FRAC_CONST(0.000488043),
+ FRAC_CONST(0.000244081), FRAC_CONST(0.000122055),
+ FRAC_CONST(6.10314E-005), FRAC_CONST(3.05166E-005),
+ FRAC_CONST(1.52586E-005), FRAC_CONST(7.62934E-006),
+ FRAC_CONST(3.81468E-006), FRAC_CONST(1.90734E-006),
+ FRAC_CONST(9.53673E-007), FRAC_CONST(4.76837E-007),
+ FRAC_CONST(2.38419E-007), FRAC_CONST(1.19209E-007),
+ FRAC_CONST(5.96046E-008)
+};
+
+static const real_t Q_div2_tab_left[31][13] = {
+ { FRAC_CONST(0.0302959), FRAC_CONST(0.111015), FRAC_CONST(0.332468), FRAC_CONST(0.663212), FRAC_CONST(0.882759), FRAC_CONST(0.962406), FRAC_CONST(0.984615), FRAC_CONST(0.990329), FRAC_CONST(0.991768), FRAC_CONST(0.992128), FRAC_CONST(0.992218), FRAC_CONST(0.992241), FRAC_CONST(0.992246) },
+ { FRAC_CONST(0.0153809), FRAC_CONST(0.0587695), FRAC_CONST(0.199377), FRAC_CONST(0.496124), FRAC_CONST(0.790123), FRAC_CONST(0.927536), FRAC_CONST(0.969697), FRAC_CONST(0.980843), FRAC_CONST(0.98367), FRAC_CONST(0.984379), FRAC_CONST(0.984556), FRAC_CONST(0.984601), FRAC_CONST(0.984612) },
+ { FRAC_CONST(0.00775006), FRAC_CONST(0.0302744), FRAC_CONST(0.110727), FRAC_CONST(0.329897), FRAC_CONST(0.653061), FRAC_CONST(0.864865), FRAC_CONST(0.941176), FRAC_CONST(0.962406), FRAC_CONST(0.967864), FRAC_CONST(0.969238), FRAC_CONST(0.969582), FRAC_CONST(0.969668), FRAC_CONST(0.96969) },
+ { FRAC_CONST(0.0038901), FRAC_CONST(0.0153698), FRAC_CONST(0.0586081), FRAC_CONST(0.197531), FRAC_CONST(0.484848), FRAC_CONST(0.761905), FRAC_CONST(0.888889), FRAC_CONST(0.927536), FRAC_CONST(0.937729), FRAC_CONST(0.940312), FRAC_CONST(0.94096), FRAC_CONST(0.941122), FRAC_CONST(0.941163) },
+ { FRAC_CONST(0.00194884), FRAC_CONST(0.00774443), FRAC_CONST(0.0301887), FRAC_CONST(0.109589), FRAC_CONST(0.32), FRAC_CONST(0.615385), FRAC_CONST(0.8), FRAC_CONST(0.864865), FRAC_CONST(0.882759), FRAC_CONST(0.887348), FRAC_CONST(0.888503), FRAC_CONST(0.888792), FRAC_CONST(0.888865) },
+ { FRAC_CONST(0.000975372), FRAC_CONST(0.00388727), FRAC_CONST(0.0153257), FRAC_CONST(0.057971), FRAC_CONST(0.190476), FRAC_CONST(0.444444), FRAC_CONST(0.666667), FRAC_CONST(0.761905), FRAC_CONST(0.790123), FRAC_CONST(0.797508), FRAC_CONST(0.799375), FRAC_CONST(0.799844), FRAC_CONST(0.799961) },
+ { FRAC_CONST(0.000487924), FRAC_CONST(0.00194742), FRAC_CONST(0.00772201), FRAC_CONST(0.0298507), FRAC_CONST(0.105263), FRAC_CONST(0.285714), FRAC_CONST(0.5), FRAC_CONST(0.615385), FRAC_CONST(0.653061), FRAC_CONST(0.663212), FRAC_CONST(0.6658), FRAC_CONST(0.66645), FRAC_CONST(0.666612) },
+ { FRAC_CONST(0.000244021), FRAC_CONST(0.000974659), FRAC_CONST(0.00387597), FRAC_CONST(0.0151515), FRAC_CONST(0.0555556), FRAC_CONST(0.166667), FRAC_CONST(0.333333), FRAC_CONST(0.444444), FRAC_CONST(0.484848), FRAC_CONST(0.496124), FRAC_CONST(0.499025), FRAC_CONST(0.499756), FRAC_CONST(0.499939) },
+ { FRAC_CONST(0.000122026), FRAC_CONST(0.000487567), FRAC_CONST(0.00194175), FRAC_CONST(0.00763359), FRAC_CONST(0.0285714), FRAC_CONST(0.0909091), FRAC_CONST(0.2), FRAC_CONST(0.285714), FRAC_CONST(0.32), FRAC_CONST(0.329897), FRAC_CONST(0.332468), FRAC_CONST(0.333116), FRAC_CONST(0.333279) },
+ { FRAC_CONST(6.10165E-005), FRAC_CONST(0.000243843), FRAC_CONST(0.000971817), FRAC_CONST(0.00383142), FRAC_CONST(0.0144928), FRAC_CONST(0.047619), FRAC_CONST(0.111111), FRAC_CONST(0.166667), FRAC_CONST(0.190476), FRAC_CONST(0.197531), FRAC_CONST(0.199377), FRAC_CONST(0.199844), FRAC_CONST(0.199961) },
+ { FRAC_CONST(3.05092E-005), FRAC_CONST(0.000121936), FRAC_CONST(0.000486145), FRAC_CONST(0.00191939), FRAC_CONST(0.00729927), FRAC_CONST(0.0243902), FRAC_CONST(0.0588235), FRAC_CONST(0.0909091), FRAC_CONST(0.105263), FRAC_CONST(0.109589), FRAC_CONST(0.110727), FRAC_CONST(0.111015), FRAC_CONST(0.111087) },
+ { FRAC_CONST(1.52548E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(0.000243132), FRAC_CONST(0.000960615), FRAC_CONST(0.003663), FRAC_CONST(0.0123457), FRAC_CONST(0.030303), FRAC_CONST(0.047619), FRAC_CONST(0.0555556), FRAC_CONST(0.057971), FRAC_CONST(0.0586081), FRAC_CONST(0.0587695), FRAC_CONST(0.05881) },
+ { FRAC_CONST(7.62747E-006), FRAC_CONST(3.04869E-005), FRAC_CONST(0.000121581), FRAC_CONST(0.000480538), FRAC_CONST(0.00183486), FRAC_CONST(0.00621118), FRAC_CONST(0.0153846), FRAC_CONST(0.0243902), FRAC_CONST(0.0285714), FRAC_CONST(0.0298507), FRAC_CONST(0.0301887), FRAC_CONST(0.0302744), FRAC_CONST(0.0302959) },
+ { FRAC_CONST(3.81375E-006), FRAC_CONST(1.52437E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(0.000240327), FRAC_CONST(0.000918274), FRAC_CONST(0.00311526), FRAC_CONST(0.00775194), FRAC_CONST(0.0123457), FRAC_CONST(0.0144928), FRAC_CONST(0.0151515), FRAC_CONST(0.0153257), FRAC_CONST(0.0153698), FRAC_CONST(0.0153809) },
+ { FRAC_CONST(1.90688E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(3.03979E-005), FRAC_CONST(0.000120178), FRAC_CONST(0.000459348), FRAC_CONST(0.00156006), FRAC_CONST(0.00389105), FRAC_CONST(0.00621118), FRAC_CONST(0.00729927), FRAC_CONST(0.00763359), FRAC_CONST(0.00772201), FRAC_CONST(0.00774443), FRAC_CONST(0.00775006) },
+ { FRAC_CONST(9.53441E-007), FRAC_CONST(3.81096E-006), FRAC_CONST(1.51992E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(0.000229727), FRAC_CONST(0.00078064), FRAC_CONST(0.00194932), FRAC_CONST(0.00311526), FRAC_CONST(0.003663), FRAC_CONST(0.00383142), FRAC_CONST(0.00387597), FRAC_CONST(0.00388727), FRAC_CONST(0.0038901) },
+ { FRAC_CONST(4.76721E-007), FRAC_CONST(1.90548E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(3.00472E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000390472), FRAC_CONST(0.00097561), FRAC_CONST(0.00156006), FRAC_CONST(0.00183486), FRAC_CONST(0.00191939), FRAC_CONST(0.00194175), FRAC_CONST(0.00194742), FRAC_CONST(0.00194884) },
+ { FRAC_CONST(2.3836E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(3.79984E-006), FRAC_CONST(1.50238E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(0.000195274), FRAC_CONST(0.000488043), FRAC_CONST(0.00078064), FRAC_CONST(0.000918274), FRAC_CONST(0.000960615), FRAC_CONST(0.000971817), FRAC_CONST(0.000974659), FRAC_CONST(0.000975372) },
+ { FRAC_CONST(1.1918E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(1.89992E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(2.87216E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000244081), FRAC_CONST(0.000390472), FRAC_CONST(0.000459348), FRAC_CONST(0.000480538), FRAC_CONST(0.000486145), FRAC_CONST(0.000487567), FRAC_CONST(0.000487924) },
+ { FRAC_CONST(5.95901E-008), FRAC_CONST(2.38186E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(3.756E-006), FRAC_CONST(1.4361E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(0.000122055), FRAC_CONST(0.000195274), FRAC_CONST(0.000229727), FRAC_CONST(0.000240327), FRAC_CONST(0.000243132), FRAC_CONST(0.000243843), FRAC_CONST(0.000244021) },
+ { FRAC_CONST(2.9795E-008), FRAC_CONST(1.19093E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(1.878E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(2.44135E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000120178), FRAC_CONST(0.000121581), FRAC_CONST(0.000121936), FRAC_CONST(0.000122026) },
+ { FRAC_CONST(1.48975E-008), FRAC_CONST(5.95465E-008), FRAC_CONST(2.37491E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(3.59029E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.10165E-005) },
+ { FRAC_CONST(7.44876E-009), FRAC_CONST(2.97732E-008), FRAC_CONST(1.18745E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(1.79515E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(1.52586E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.05092E-005) },
+ { FRAC_CONST(3.72438E-009), FRAC_CONST(1.48866E-008), FRAC_CONST(5.93727E-008), FRAC_CONST(2.34751E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(3.05175E-006), FRAC_CONST(7.62934E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.52548E-005) },
+ { FRAC_CONST(1.86219E-009), FRAC_CONST(7.44331E-009), FRAC_CONST(2.96864E-008), FRAC_CONST(1.17375E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.62747E-006) },
+ { FRAC_CONST(9.31095E-010), FRAC_CONST(3.72166E-009), FRAC_CONST(1.48432E-008), FRAC_CONST(5.86876E-008), FRAC_CONST(2.24394E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(1.90734E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.81375E-006) },
+ { FRAC_CONST(4.65548E-010), FRAC_CONST(1.86083E-009), FRAC_CONST(7.42159E-009), FRAC_CONST(2.93438E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(9.53673E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.90688E-006) },
+ { FRAC_CONST(2.32774E-010), FRAC_CONST(9.30414E-010), FRAC_CONST(3.71079E-009), FRAC_CONST(1.46719E-008), FRAC_CONST(5.60985E-008), FRAC_CONST(1.90735E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.53441E-007) },
+ { FRAC_CONST(1.16387E-010), FRAC_CONST(4.65207E-010), FRAC_CONST(1.8554E-009), FRAC_CONST(7.33596E-009), FRAC_CONST(2.80492E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(2.38419E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.76721E-007) },
+ { FRAC_CONST(5.81935E-011), FRAC_CONST(2.32603E-010), FRAC_CONST(9.27699E-010), FRAC_CONST(3.66798E-009), FRAC_CONST(1.40246E-008), FRAC_CONST(4.76837E-008), FRAC_CONST(1.19209E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.3836E-007) },
+ { FRAC_CONST(2.90967E-011), FRAC_CONST(1.16302E-010), FRAC_CONST(4.63849E-010), FRAC_CONST(1.83399E-009), FRAC_CONST(7.01231E-009), FRAC_CONST(2.38419E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.1918E-007) }
+};
+
+static const real_t Q_div2_tab_right[31][13] = {
+ { FRAC_CONST(0.992246), FRAC_CONST(0.992241), FRAC_CONST(0.992218), FRAC_CONST(0.992128), FRAC_CONST(0.991768), FRAC_CONST(0.990329), FRAC_CONST(0.984615), FRAC_CONST(0.962406), FRAC_CONST(0.882759), FRAC_CONST(0.663212), FRAC_CONST(0.332468), FRAC_CONST(0.111015), FRAC_CONST(0.0302959) },
+ { FRAC_CONST(0.984612), FRAC_CONST(0.984601), FRAC_CONST(0.984556), FRAC_CONST(0.984379), FRAC_CONST(0.98367), FRAC_CONST(0.980843), FRAC_CONST(0.969697), FRAC_CONST(0.927536), FRAC_CONST(0.790123), FRAC_CONST(0.496124), FRAC_CONST(0.199377), FRAC_CONST(0.0587695), FRAC_CONST(0.0153809) },
+ { FRAC_CONST(0.96969), FRAC_CONST(0.969668), FRAC_CONST(0.969582), FRAC_CONST(0.969238), FRAC_CONST(0.967864), FRAC_CONST(0.962406), FRAC_CONST(0.941176), FRAC_CONST(0.864865), FRAC_CONST(0.653061), FRAC_CONST(0.329897), FRAC_CONST(0.110727), FRAC_CONST(0.0302744), FRAC_CONST(0.00775006) },
+ { FRAC_CONST(0.941163), FRAC_CONST(0.941122), FRAC_CONST(0.94096), FRAC_CONST(0.940312), FRAC_CONST(0.937729), FRAC_CONST(0.927536), FRAC_CONST(0.888889), FRAC_CONST(0.761905), FRAC_CONST(0.484848), FRAC_CONST(0.197531), FRAC_CONST(0.0586081), FRAC_CONST(0.0153698), FRAC_CONST(0.0038901) },
+ { FRAC_CONST(0.888865), FRAC_CONST(0.888792), FRAC_CONST(0.888503), FRAC_CONST(0.887348), FRAC_CONST(0.882759), FRAC_CONST(0.864865), FRAC_CONST(0.8), FRAC_CONST(0.615385), FRAC_CONST(0.32), FRAC_CONST(0.109589), FRAC_CONST(0.0301887), FRAC_CONST(0.00774443), FRAC_CONST(0.00194884) },
+ { FRAC_CONST(0.799961), FRAC_CONST(0.799844), FRAC_CONST(0.799375), FRAC_CONST(0.797508), FRAC_CONST(0.790123), FRAC_CONST(0.761905), FRAC_CONST(0.666667), FRAC_CONST(0.444444), FRAC_CONST(0.190476), FRAC_CONST(0.057971), FRAC_CONST(0.0153257), FRAC_CONST(0.00388727), FRAC_CONST(0.000975372) },
+ { FRAC_CONST(0.666612), FRAC_CONST(0.66645), FRAC_CONST(0.6658), FRAC_CONST(0.663212), FRAC_CONST(0.653061), FRAC_CONST(0.615385), FRAC_CONST(0.5), FRAC_CONST(0.285714), FRAC_CONST(0.105263), FRAC_CONST(0.0298507), FRAC_CONST(0.00772201), FRAC_CONST(0.00194742), FRAC_CONST(0.000487924) },
+ { FRAC_CONST(0.499939), FRAC_CONST(0.499756), FRAC_CONST(0.499025), FRAC_CONST(0.496124), FRAC_CONST(0.484848), FRAC_CONST(0.444444), FRAC_CONST(0.333333), FRAC_CONST(0.166667), FRAC_CONST(0.0555556), FRAC_CONST(0.0151515), FRAC_CONST(0.00387597), FRAC_CONST(0.000974659), FRAC_CONST(0.000244021) },
+ { FRAC_CONST(0.333279), FRAC_CONST(0.333116), FRAC_CONST(0.332468), FRAC_CONST(0.329897), FRAC_CONST(0.32), FRAC_CONST(0.285714), FRAC_CONST(0.2), FRAC_CONST(0.0909091), FRAC_CONST(0.0285714), FRAC_CONST(0.00763359), FRAC_CONST(0.00194175), FRAC_CONST(0.000487567), FRAC_CONST(0.000122026) },
+ { FRAC_CONST(0.199961), FRAC_CONST(0.199844), FRAC_CONST(0.199377), FRAC_CONST(0.197531), FRAC_CONST(0.190476), FRAC_CONST(0.166667), FRAC_CONST(0.111111), FRAC_CONST(0.047619), FRAC_CONST(0.0144928), FRAC_CONST(0.00383142), FRAC_CONST(0.000971817), FRAC_CONST(0.000243843), FRAC_CONST(6.10165E-005) },
+ { FRAC_CONST(0.111087), FRAC_CONST(0.111015), FRAC_CONST(0.110727), FRAC_CONST(0.109589), FRAC_CONST(0.105263), FRAC_CONST(0.0909091), FRAC_CONST(0.0588235), FRAC_CONST(0.0243902), FRAC_CONST(0.00729927), FRAC_CONST(0.00191939), FRAC_CONST(0.000486145), FRAC_CONST(0.000121936), FRAC_CONST(3.05092E-005) },
+ { FRAC_CONST(0.05881), FRAC_CONST(0.0587695), FRAC_CONST(0.0586081), FRAC_CONST(0.057971), FRAC_CONST(0.0555556), FRAC_CONST(0.047619), FRAC_CONST(0.030303), FRAC_CONST(0.0123457), FRAC_CONST(0.003663), FRAC_CONST(0.000960615), FRAC_CONST(0.000243132), FRAC_CONST(6.09719E-005), FRAC_CONST(1.52548E-005) },
+ { FRAC_CONST(0.0302959), FRAC_CONST(0.0302744), FRAC_CONST(0.0301887), FRAC_CONST(0.0298507), FRAC_CONST(0.0285714), FRAC_CONST(0.0243902), FRAC_CONST(0.0153846), FRAC_CONST(0.00621118), FRAC_CONST(0.00183486), FRAC_CONST(0.000480538), FRAC_CONST(0.000121581), FRAC_CONST(3.04869E-005), FRAC_CONST(7.62747E-006) },
+ { FRAC_CONST(0.0153809), FRAC_CONST(0.0153698), FRAC_CONST(0.0153257), FRAC_CONST(0.0151515), FRAC_CONST(0.0144928), FRAC_CONST(0.0123457), FRAC_CONST(0.00775194), FRAC_CONST(0.00311526), FRAC_CONST(0.000918274), FRAC_CONST(0.000240327), FRAC_CONST(6.0794E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(3.81375E-006) },
+ { FRAC_CONST(0.00775006), FRAC_CONST(0.00774443), FRAC_CONST(0.00772201), FRAC_CONST(0.00763359), FRAC_CONST(0.00729927), FRAC_CONST(0.00621118), FRAC_CONST(0.00389105), FRAC_CONST(0.00156006), FRAC_CONST(0.000459348), FRAC_CONST(0.000120178), FRAC_CONST(3.03979E-005), FRAC_CONST(7.62189E-006), FRAC_CONST(1.90688E-006) },
+ { FRAC_CONST(0.0038901), FRAC_CONST(0.00388727), FRAC_CONST(0.00387597), FRAC_CONST(0.00383142), FRAC_CONST(0.003663), FRAC_CONST(0.00311526), FRAC_CONST(0.00194932), FRAC_CONST(0.00078064), FRAC_CONST(0.000229727), FRAC_CONST(6.00925E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(3.81096E-006), FRAC_CONST(9.53441E-007) },
+ { FRAC_CONST(0.00194884), FRAC_CONST(0.00194742), FRAC_CONST(0.00194175), FRAC_CONST(0.00191939), FRAC_CONST(0.00183486), FRAC_CONST(0.00156006), FRAC_CONST(0.00097561), FRAC_CONST(0.000390472), FRAC_CONST(0.000114877), FRAC_CONST(3.00472E-005), FRAC_CONST(7.59965E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(4.76721E-007) },
+ { FRAC_CONST(0.000975372), FRAC_CONST(0.000974659), FRAC_CONST(0.000971817), FRAC_CONST(0.000960615), FRAC_CONST(0.000918274), FRAC_CONST(0.00078064), FRAC_CONST(0.000488043), FRAC_CONST(0.000195274), FRAC_CONST(5.74416E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(3.79984E-006), FRAC_CONST(9.52743E-007), FRAC_CONST(2.3836E-007) },
+ { FRAC_CONST(0.000487924), FRAC_CONST(0.000487567), FRAC_CONST(0.000486145), FRAC_CONST(0.000480538), FRAC_CONST(0.000459348), FRAC_CONST(0.000390472), FRAC_CONST(0.000244081), FRAC_CONST(9.76467E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(7.51196E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(4.76372E-007), FRAC_CONST(1.1918E-007) },
+ { FRAC_CONST(0.000244021), FRAC_CONST(0.000243843), FRAC_CONST(0.000243132), FRAC_CONST(0.000240327), FRAC_CONST(0.000229727), FRAC_CONST(0.000195274), FRAC_CONST(0.000122055), FRAC_CONST(4.88257E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(3.756E-006), FRAC_CONST(9.49963E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(5.95901E-008) },
+ { FRAC_CONST(0.000122026), FRAC_CONST(0.000121936), FRAC_CONST(0.000121581), FRAC_CONST(0.000120178), FRAC_CONST(0.000114877), FRAC_CONST(9.76467E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(7.18056E-006), FRAC_CONST(1.878E-006), FRAC_CONST(4.74982E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(2.9795E-008) },
+ { FRAC_CONST(6.10165E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(3.59029E-006), FRAC_CONST(9.39002E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(5.95465E-008), FRAC_CONST(1.48975E-008) },
+ { FRAC_CONST(3.05092E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(1.52586E-005), FRAC_CONST(6.10348E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(4.69501E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(2.97732E-008), FRAC_CONST(7.44876E-009) },
+ { FRAC_CONST(1.52548E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(7.62934E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(8.97575E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(5.93727E-008), FRAC_CONST(1.48866E-008), FRAC_CONST(3.72438E-009) },
+ { FRAC_CONST(7.62747E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(4.48788E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(2.96864E-008), FRAC_CONST(7.44331E-009), FRAC_CONST(1.86219E-009) },
+ { FRAC_CONST(3.81375E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(1.90734E-006), FRAC_CONST(7.62939E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(5.86876E-008), FRAC_CONST(1.48432E-008), FRAC_CONST(3.72166E-009), FRAC_CONST(9.31095E-010) },
+ { FRAC_CONST(1.90688E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(9.53673E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(2.93438E-008), FRAC_CONST(7.42159E-009), FRAC_CONST(1.86083E-009), FRAC_CONST(4.65548E-010) },
+ { FRAC_CONST(9.53441E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(5.60985E-008), FRAC_CONST(1.46719E-008), FRAC_CONST(3.71079E-009), FRAC_CONST(9.30414E-010), FRAC_CONST(2.32774E-010) },
+ { FRAC_CONST(4.76721E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(2.38419E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(2.80492E-008), FRAC_CONST(7.33596E-009), FRAC_CONST(1.8554E-009), FRAC_CONST(4.65207E-010), FRAC_CONST(1.16387E-010) },
+ { FRAC_CONST(2.3836E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(1.19209E-007), FRAC_CONST(4.76837E-008), FRAC_CONST(1.40246E-008), FRAC_CONST(3.66798E-009), FRAC_CONST(9.27699E-010), FRAC_CONST(2.32603E-010), FRAC_CONST(5.81935E-011) },
+ { FRAC_CONST(1.1918E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(2.38419E-008), FRAC_CONST(7.01231E-009), FRAC_CONST(1.83399E-009), FRAC_CONST(4.63849E-010), FRAC_CONST(1.16302E-010), FRAC_CONST(2.90967E-011) }
+};
+
+/* calculates Q/(1+Q) */
+/* [0..1] */
+real_t calc_Q_div2(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
+{
+ if (sbr->bs_coupling)
+ {
+ if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
+ (sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
+ {
+ return 0;
+ } else {
+ /* the pan parameter is always even */
+ if (ch == 0)
+ {
+ return Q_div2_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+ } else {
+ return Q_div2_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
+ }
+ }
+ } else {
+ /* no coupling */
+ if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
+ {
+ return 0;
+ } else {
+ return Q_div2_tab[sbr->Q[ch][m][l]];
+ }
+ }
+}
+
+static const real_t E_deq_tab[64] = {
+ 64.0f, 128.0f, 256.0f, 512.0f, 1024.0f, 2048.0f, 4096.0f, 8192.0f,
+ 16384.0f, 32768.0f, 65536.0f, 131072.0f, 262144.0f, 524288.0f, 1.04858E+006f, 2.09715E+006f,
+ 4.1943E+006f, 8.38861E+006f, 1.67772E+007f, 3.35544E+007f, 6.71089E+007f, 1.34218E+008f, 2.68435E+008f, 5.36871E+008f,
+ 1.07374E+009f, 2.14748E+009f, 4.29497E+009f, 8.58993E+009f, 1.71799E+010f, 3.43597E+010f, 6.87195E+010f, 1.37439E+011f,
+ 2.74878E+011f, 5.49756E+011f, 1.09951E+012f, 2.19902E+012f, 4.39805E+012f, 8.79609E+012f, 1.75922E+013f, 3.51844E+013f,
+ 7.03687E+013f, 1.40737E+014f, 2.81475E+014f, 5.6295E+014f, 1.1259E+015f, 2.2518E+015f, 4.5036E+015f, 9.0072E+015f,
+ 1.80144E+016f, 3.60288E+016f, 7.20576E+016f, 1.44115E+017f, 2.8823E+017f, 5.76461E+017f, 1.15292E+018f, 2.30584E+018f,
+ 4.61169E+018f, 9.22337E+018f, 1.84467E+019f, 3.68935E+019f, 7.3787E+019f, 1.47574E+020f, 2.95148E+020f, 5.90296E+020f
+};
+
+void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
+{
+ if (sbr->bs_coupling == 0)
+ {
+ int16_t exp;
+ uint8_t l, k;
+ uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
+
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
+ {
+ /* +6 for the *64 and -10 for the /32 in the synthesis QMF (fixed)
+ * since this is a energy value: (x/32)^2 = (x^2)/1024
+ */
+ /* exp = (sbr->E[ch][k][l] >> amp) + 6; */
+ exp = (sbr->E[ch][k][l] >> amp);
+
+ if ((exp < 0) || (exp >= 64))
+ {
+ sbr->E_orig[ch][k][l] = 0;
+ } else {
+ sbr->E_orig[ch][k][l] = E_deq_tab[exp];
+
+ /* save half the table size at the cost of 1 multiply */
+ if (amp && (sbr->E[ch][k][l] & 1))
+ {
+ sbr->E_orig[ch][k][l] = MUL_C(sbr->E_orig[ch][k][l], COEF_CONST(1.414213562));
+ }
+ }
+ }
+ }
+
+ for (l = 0; l < sbr->L_Q[ch]; l++)
+ {
+ for (k = 0; k < sbr->N_Q; k++)
+ {
+ sbr->Q_div[ch][k][l] = calc_Q_div(sbr, ch, k, l);
+ sbr->Q_div2[ch][k][l] = calc_Q_div2(sbr, ch, k, l);
+ }
+ }
+ }
+}
+
+static const real_t E_pan_tab[25] = {
+ FRAC_CONST(0.000244081), FRAC_CONST(0.000488043),
+ FRAC_CONST(0.00097561), FRAC_CONST(0.00194932),
+ FRAC_CONST(0.00389105), FRAC_CONST(0.00775194),
+ FRAC_CONST(0.0153846), FRAC_CONST(0.030303),
+ FRAC_CONST(0.0588235), FRAC_CONST(0.111111),
+ FRAC_CONST(0.2), FRAC_CONST(0.333333),
+ FRAC_CONST(0.5), FRAC_CONST(0.666667),
+ FRAC_CONST(0.8), FRAC_CONST(0.888889),
+ FRAC_CONST(0.941176), FRAC_CONST(0.969697),
+ FRAC_CONST(0.984615), FRAC_CONST(0.992248),
+ FRAC_CONST(0.996109), FRAC_CONST(0.998051),
+ FRAC_CONST(0.999024), FRAC_CONST(0.999512),
+ FRAC_CONST(0.999756)
+};
+
+void unmap_envelope_noise(sbr_info *sbr)
+{
+ real_t tmp;
+ int16_t exp0, exp1;
+ uint8_t l, k;
+ uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
+ uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
+
+ for (l = 0; l < sbr->L_E[0]; l++)
+ {
+ for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
+ {
+ /* +6: * 64 ; +1: * 2 ; */
+ exp0 = (sbr->E[0][k][l] >> amp0) + 1;
+
+ /* UN_MAP removed: (x / 4096) same as (x >> 12) */
+ /* E[1] is always even so no need for compensating the divide by 2 with
+ * an extra multiplication
+ */
+ /* exp1 = (sbr->E[1][k][l] >> amp1) - 12; */
+ exp1 = (sbr->E[1][k][l] >> amp1);
+
+ if ((exp0 < 0) || (exp0 >= 64) ||
+ (exp1 < 0) || (exp1 > 24))
+ {
+ sbr->E_orig[1][k][l] = 0;
+ sbr->E_orig[0][k][l] = 0;
+ } else {
+ tmp = E_deq_tab[exp0];
+ if (amp0 && (sbr->E[0][k][l] & 1))
+ {
+ tmp = MUL_C(tmp, COEF_CONST(1.414213562));
+ }
+
+ /* panning */
+ sbr->E_orig[0][k][l] = MUL_F(tmp, E_pan_tab[exp1]);
+ sbr->E_orig[1][k][l] = MUL_F(tmp, E_pan_tab[24 - exp1]);
+ }
+ }
+ }
+
+ for (l = 0; l < sbr->L_Q[0]; l++)
+ {
+ for (k = 0; k < sbr->N_Q; k++)
+ {
+ sbr->Q_div[0][k][l] = calc_Q_div(sbr, 0, k, l);
+ sbr->Q_div[1][k][l] = calc_Q_div(sbr, 1, k, l);
+ sbr->Q_div2[0][k][l] = calc_Q_div2(sbr, 0, k, l);
+ sbr->Q_div2[1][k][l] = calc_Q_div2(sbr, 1, k, l);
+ }
+ }
+}
+
+#endif
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_e_nf.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_e_nf.h
new file mode 100644
index 000000000..c55843a77
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_e_nf.h
@@ -0,0 +1,52 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_e_nf.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_E_NF_H__
+#define __SBR_E_NF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void extract_envelope_data(sbr_info *sbr, uint8_t ch);
+void extract_noise_floor_data(sbr_info *sbr, uint8_t ch);
+#ifndef FIXED_POINT
+void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch);
+void unmap_envelope_noise(sbr_info *sbr);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_fbt.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_fbt.c
new file mode 100644
index 000000000..46d56a8dc
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_fbt.c
@@ -0,0 +1,766 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_fbt.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* Calculate frequency band tables */
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include <stdlib.h>
+
+#include "sbr_syntax.h"
+#include "sbr_fbt.h"
+
+/* static function declarations */
+static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1);
+
+
+/* calculate the start QMF channel for the master frequency band table */
+/* parameter is also called k0 */
+uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
+ uint32_t sample_rate)
+{
+ static const uint8_t startMinTable[12] = { 7, 7, 10, 11, 12, 16, 16,
+ 17, 24, 32, 35, 48 };
+ static const uint8_t offsetIndexTable[12] = { 5, 5, 4, 4, 4, 3, 2, 1, 0,
+ 6, 6, 6 };
+ static const int8_t offset[7][16] = {
+ { -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 },
+ { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13 },
+ { -5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 },
+ { -6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16 },
+ { -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20 },
+ { -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24, 28, 33 }
+ };
+ uint8_t startMin = startMinTable[get_sr_index(sample_rate)];
+ uint8_t offsetIndex = offsetIndexTable[get_sr_index(sample_rate)];
+
+#if 0 /* replaced with table (startMinTable) */
+ if (sample_rate >= 64000)
+ {
+ startMin = (uint8_t)((5000.*128.)/(float)sample_rate + 0.5);
+ } else if (sample_rate < 32000) {
+ startMin = (uint8_t)((3000.*128.)/(float)sample_rate + 0.5);
+ } else {
+ startMin = (uint8_t)((4000.*128.)/(float)sample_rate + 0.5);
+ }
+#endif
+
+ if (bs_samplerate_mode)
+ {
+ return startMin + offset[offsetIndex][bs_start_freq];
+
+#if 0 /* replaced by offsetIndexTable */
+ switch (sample_rate)
+ {
+ case 16000:
+ return startMin + offset[0][bs_start_freq];
+ case 22050:
+ return startMin + offset[1][bs_start_freq];
+ case 24000:
+ return startMin + offset[2][bs_start_freq];
+ case 32000:
+ return startMin + offset[3][bs_start_freq];
+ default:
+ if (sample_rate > 64000)
+ {
+ return startMin + offset[5][bs_start_freq];
+ } else { /* 44100 <= sample_rate <= 64000 */
+ return startMin + offset[4][bs_start_freq];
+ }
+ }
+#endif
+ } else {
+ return startMin + offset[6][bs_start_freq];
+ }
+}
+
+static int longcmp(const void *a, const void *b)
+{
+ return ((int)(*(int32_t*)a - *(int32_t*)b));
+}
+
+/* calculate the stop QMF channel for the master frequency band table */
+/* parameter is also called k2 */
+uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
+ uint8_t k0)
+{
+ if (bs_stop_freq == 15)
+ {
+ return min(64, k0 * 3);
+ } else if (bs_stop_freq == 14) {
+ return min(64, k0 * 2);
+ } else {
+ static const uint8_t stopMinTable[12] = { 13, 15, 20, 21, 23,
+ 32, 32, 35, 48, 64, 70, 96 };
+ static const int8_t offset[12][14] = {
+ { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 37, 44, 51 },
+ { 0, 2, 4, 6, 8, 11, 14, 18, 22, 26, 31, 36, 42, 49 },
+ { 0, 2, 4, 6, 8, 11, 14, 17, 21, 25, 29, 34, 39, 44 },
+ { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 33, 38, 43 },
+ { 0, 2, 4, 6, 8, 11, 14, 17, 20, 24, 28, 32, 36, 41 },
+ { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 },
+ { 0, 2, 4, 6, 8, 10, 12, 14, 17, 20, 23, 26, 29, 32 },
+ { 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 23, 26, 29 },
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16 },
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ { 0, -1, -2, -3, -4, -5, -6, -6, -6, -6, -6, -6, -6, -6 },
+ { 0, -3, -6, -9, -12, -15, -18, -20, -22, -24, -26, -28, -30, -32 }
+ };
+#if 0
+ uint8_t i;
+ int32_t stopDk[13], stopDk_t[14], k2;
+#endif
+ uint8_t stopMin = stopMinTable[get_sr_index(sample_rate)];
+
+#if 0 /* replaced by table lookup */
+ if (sample_rate >= 64000)
+ {
+ stopMin = (uint8_t)((10000.*128.)/(float)sample_rate + 0.5);
+ } else if (sample_rate < 32000) {
+ stopMin = (uint8_t)((6000.*128.)/(float)sample_rate + 0.5);
+ } else {
+ stopMin = (uint8_t)((8000.*128.)/(float)sample_rate + 0.5);
+ }
+#endif
+
+#if 0 /* replaced by table lookup */
+ /* diverging power series */
+ for (i = 0; i <= 13; i++)
+ {
+ stopDk_t[i] = (int32_t)(stopMin*pow(64.0/stopMin, i/13.0) + 0.5);
+ }
+ for (i = 0; i < 13; i++)
+ {
+ stopDk[i] = stopDk_t[i+1] - stopDk_t[i];
+ }
+
+ /* needed? */
+ qsort(stopDk, 13, sizeof(stopDk[0]), longcmp);
+
+ k2 = stopMin;
+ for (i = 0; i < bs_stop_freq; i++)
+ {
+ k2 += stopDk[i];
+ }
+ return min(64, k2);
+#endif
+ /* bs_stop_freq <= 13 */
+ return min(64, stopMin + offset[get_sr_index(sample_rate)][min(bs_stop_freq, 13)]);
+ }
+
+ return 0;
+}
+
+/* calculate the master frequency table from k0, k2, bs_freq_scale
+ and bs_alter_scale
+
+ version for bs_freq_scale = 0
+*/
+uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
+ uint8_t bs_alter_scale)
+{
+ int8_t incr;
+ uint8_t k;
+ uint8_t dk;
+ uint32_t nrBands, k2Achieved;
+ int32_t k2Diff, vDk[64] = {0};
+
+ /* mft only defined for k2 > k0 */
+ if (k2 <= k0)
+ {
+ sbr->N_master = 0;
+ return 1;
+ }
+
+ dk = bs_alter_scale ? 2 : 1;
+
+#if 0 /* replaced by float-less design */
+ nrBands = 2 * (int32_t)((float)(k2-k0)/(dk*2) + (-1+dk)/2.0f);
+#else
+ if (bs_alter_scale)
+ {
+ nrBands = (((k2-k0+2)>>2)<<1);
+ } else {
+ nrBands = (((k2-k0)>>1)<<1);
+ }
+#endif
+ nrBands = min(nrBands, 63);
+ if (nrBands <= 0)
+ return 1;
+
+ k2Achieved = k0 + nrBands * dk;
+ k2Diff = k2 - k2Achieved;
+ for (k = 0; k < nrBands; k++)
+ vDk[k] = dk;
+
+ if (k2Diff)
+ {
+ incr = (k2Diff > 0) ? -1 : 1;
+ k = (uint8_t) ((k2Diff > 0) ? (nrBands-1) : 0);
+
+ while (k2Diff != 0)
+ {
+ vDk[k] -= incr;
+ k += incr;
+ k2Diff += incr;
+ }
+ }
+
+ sbr->f_master[0] = k0;
+ for (k = 1; k <= nrBands; k++)
+ sbr->f_master[k] = (uint8_t)(sbr->f_master[k-1] + vDk[k-1]);
+
+ sbr->N_master = (uint8_t)nrBands;
+ sbr->N_master = (min(sbr->N_master, 64));
+
+#if 0
+ printf("f_master[%d]: ", nrBands);
+ for (k = 0; k <= nrBands; k++)
+ {
+ printf("%d ", sbr->f_master[k]);
+ }
+ printf("\n");
+#endif
+
+ return 0;
+}
+
+/*
+ This function finds the number of bands using this formula:
+ bands * log(a1/a0)/log(2.0) + 0.5
+*/
+static int32_t find_bands(uint8_t warp, uint8_t bands, uint8_t a0, uint8_t a1)
+{
+#ifdef FIXED_POINT
+ /* table with log2() values */
+ static const real_t log2Table[65] = {
+ COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(1.0000000000), COEF_CONST(1.5849625007),
+ COEF_CONST(2.0000000000), COEF_CONST(2.3219280949), COEF_CONST(2.5849625007), COEF_CONST(2.8073549221),
+ COEF_CONST(3.0000000000), COEF_CONST(3.1699250014), COEF_CONST(3.3219280949), COEF_CONST(3.4594316186),
+ COEF_CONST(3.5849625007), COEF_CONST(3.7004397181), COEF_CONST(3.8073549221), COEF_CONST(3.9068905956),
+ COEF_CONST(4.0000000000), COEF_CONST(4.0874628413), COEF_CONST(4.1699250014), COEF_CONST(4.2479275134),
+ COEF_CONST(4.3219280949), COEF_CONST(4.3923174228), COEF_CONST(4.4594316186), COEF_CONST(4.5235619561),
+ COEF_CONST(4.5849625007), COEF_CONST(4.6438561898), COEF_CONST(4.7004397181), COEF_CONST(4.7548875022),
+ COEF_CONST(4.8073549221), COEF_CONST(4.8579809951), COEF_CONST(4.9068905956), COEF_CONST(4.9541963104),
+ COEF_CONST(5.0000000000), COEF_CONST(5.0443941194), COEF_CONST(5.0874628413), COEF_CONST(5.1292830169),
+ COEF_CONST(5.1699250014), COEF_CONST(5.2094533656), COEF_CONST(5.2479275134), COEF_CONST(5.2854022189),
+ COEF_CONST(5.3219280949), COEF_CONST(5.3575520046), COEF_CONST(5.3923174228), COEF_CONST(5.4262647547),
+ COEF_CONST(5.4594316186), COEF_CONST(5.4918530963), COEF_CONST(5.5235619561), COEF_CONST(5.5545888517),
+ COEF_CONST(5.5849625007), COEF_CONST(5.6147098441), COEF_CONST(5.6438561898), COEF_CONST(5.6724253420),
+ COEF_CONST(5.7004397181), COEF_CONST(5.7279204546), COEF_CONST(5.7548875022), COEF_CONST(5.7813597135),
+ COEF_CONST(5.8073549221), COEF_CONST(5.8328900142), COEF_CONST(5.8579809951), COEF_CONST(5.8826430494),
+ COEF_CONST(5.9068905956), COEF_CONST(5.9307373376), COEF_CONST(5.9541963104), COEF_CONST(5.9772799235),
+ COEF_CONST(6.0)
+ };
+ real_t r0 = log2Table[a0]; /* coef */
+ real_t r1 = log2Table[a1]; /* coef */
+ real_t r2 = (r1 - r0); /* coef */
+
+ if (warp)
+ r2 = MUL_C(r2, COEF_CONST(1.0/1.3));
+
+ /* convert r2 to real and then multiply and round */
+ r2 = (r2 >> (COEF_BITS-REAL_BITS)) * bands + (1<<(REAL_BITS-1));
+
+ return (r2 >> REAL_BITS);
+#else
+ real_t div = (real_t)log(2.0);
+ if (warp) div *= (real_t)1.3;
+
+ return (int32_t)(bands * log((float)a1/(float)a0)/div + 0.5);
+#endif
+}
+
+static real_t find_initial_power(uint8_t bands, uint8_t a0, uint8_t a1)
+{
+#ifdef FIXED_POINT
+ /* table with log() values */
+ static const real_t logTable[65] = {
+ COEF_CONST(0.0), COEF_CONST(0.0), COEF_CONST(0.6931471806), COEF_CONST(1.0986122887),
+ COEF_CONST(1.3862943611), COEF_CONST(1.6094379124), COEF_CONST(1.7917594692), COEF_CONST(1.9459101491),
+ COEF_CONST(2.0794415417), COEF_CONST(2.1972245773), COEF_CONST(2.3025850930), COEF_CONST(2.3978952728),
+ COEF_CONST(2.4849066498), COEF_CONST(2.5649493575), COEF_CONST(2.6390573296), COEF_CONST(2.7080502011),
+ COEF_CONST(2.7725887222), COEF_CONST(2.8332133441), COEF_CONST(2.8903717579), COEF_CONST(2.9444389792),
+ COEF_CONST(2.9957322736), COEF_CONST(3.0445224377), COEF_CONST(3.0910424534), COEF_CONST(3.1354942159),
+ COEF_CONST(3.1780538303), COEF_CONST(3.2188758249), COEF_CONST(3.2580965380), COEF_CONST(3.2958368660),
+ COEF_CONST(3.3322045102), COEF_CONST(3.3672958300), COEF_CONST(3.4011973817), COEF_CONST(3.4339872045),
+ COEF_CONST(3.4657359028), COEF_CONST(3.4965075615), COEF_CONST(3.5263605246), COEF_CONST(3.5553480615),
+ COEF_CONST(3.5835189385), COEF_CONST(3.6109179126), COEF_CONST(3.6375861597), COEF_CONST(3.6635616461),
+ COEF_CONST(3.6888794541), COEF_CONST(3.7135720667), COEF_CONST(3.7376696183), COEF_CONST(3.7612001157),
+ COEF_CONST(3.7841896339), COEF_CONST(3.8066624898), COEF_CONST(3.8286413965), COEF_CONST(3.8501476017),
+ COEF_CONST(3.8712010109), COEF_CONST(3.8918202981), COEF_CONST(3.9120230054), COEF_CONST(3.9318256327),
+ COEF_CONST(3.9512437186), COEF_CONST(3.9702919136), COEF_CONST(3.9889840466), COEF_CONST(4.0073331852),
+ COEF_CONST(4.0253516907), COEF_CONST(4.0430512678), COEF_CONST(4.0604430105), COEF_CONST(4.0775374439),
+ COEF_CONST(4.0943445622), COEF_CONST(4.1108738642), COEF_CONST(4.1271343850), COEF_CONST(4.1431347264),
+ COEF_CONST(4.158883083)
+ };
+ /* standard Taylor polynomial coefficients for exp(x) around 0 */
+ /* a polynomial around x=1 is more precise, as most values are around 1.07,
+ but this is just fine already */
+ static const real_t c1 = COEF_CONST(1.0);
+ static const real_t c2 = COEF_CONST(1.0/2.0);
+ static const real_t c3 = COEF_CONST(1.0/6.0);
+ static const real_t c4 = COEF_CONST(1.0/24.0);
+
+ real_t r0 = logTable[a0]; /* coef */
+ real_t r1 = logTable[a1]; /* coef */
+ real_t r2 = (r1 - r0) / bands; /* coef */
+ real_t rexp = c1 + MUL_C((c1 + MUL_C((c2 + MUL_C((c3 + MUL_C(c4,r2)), r2)), r2)), r2);
+
+ return (rexp >> (COEF_BITS-REAL_BITS)); /* real */
+#else
+ return (real_t)pow((real_t)a1/(real_t)a0, 1.0/(real_t)bands);
+#endif
+}
+
+/*
+ version for bs_freq_scale > 0
+*/
+uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
+ uint8_t bs_freq_scale, uint8_t bs_alter_scale)
+{
+ uint8_t k, bands, twoRegions;
+ uint8_t k1;
+ uint8_t nrBand0, nrBand1;
+ int32_t vDk0[64] = {0}, vDk1[64] = {0};
+ int32_t vk0[64] = {0}, vk1[64] = {0};
+ uint8_t temp1[] = { 6, 5, 4 };
+ real_t q, qk;
+ int32_t A_1;
+#ifdef FIXED_POINT
+ real_t rk2, rk0;
+#endif
+
+ /* mft only defined for k2 > k0 */
+ if (k2 <= k0)
+ {
+ sbr->N_master = 0;
+ return 1;
+ }
+
+ bands = temp1[bs_freq_scale-1];
+
+#ifdef FIXED_POINT
+ rk0 = (real_t)k0 << REAL_BITS;
+ rk2 = (real_t)k2 << REAL_BITS;
+ if (rk2 > MUL_C(rk0, COEF_CONST(2.2449)))
+#else
+ if ((float)k2/(float)k0 > 2.2449)
+#endif
+ {
+ twoRegions = 1;
+ k1 = k0 << 1;
+ } else {
+ twoRegions = 0;
+ k1 = k2;
+ }
+
+ nrBand0 = (uint8_t)(2 * find_bands(0, bands, k0, k1));
+ nrBand0 = min(nrBand0, 63);
+ if (nrBand0 <= 0)
+ return 1;
+
+ q = find_initial_power(nrBand0, k0, k1);
+#ifdef FIXED_POINT
+ qk = (real_t)k0 << REAL_BITS;
+ //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+ A_1 = k0;
+#else
+ qk = REAL_CONST(k0);
+ A_1 = (int32_t)(qk + .5);
+#endif
+ for (k = 0; k <= nrBand0; k++)
+ {
+ int32_t A_0 = A_1;
+#ifdef FIXED_POINT
+ qk = MUL_R(qk,q);
+ A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+#else
+ qk *= q;
+ A_1 = (int32_t)(qk + 0.5);
+#endif
+ vDk0[k] = A_1 - A_0;
+ }
+
+ /* needed? */
+ qsort(vDk0, nrBand0, sizeof(vDk0[0]), longcmp);
+
+ vk0[0] = k0;
+ for (k = 1; k <= nrBand0; k++)
+ {
+ vk0[k] = vk0[k-1] + vDk0[k-1];
+ if (vDk0[k-1] == 0)
+ return 1;
+ }
+
+ if (!twoRegions)
+ {
+ for (k = 0; k <= nrBand0; k++)
+ sbr->f_master[k] = (uint8_t) vk0[k];
+
+ sbr->N_master = nrBand0;
+ sbr->N_master = min(sbr->N_master, 64);
+ return 0;
+ }
+
+ nrBand1 = (uint8_t)(2 * find_bands(1 /* warped */, bands, k1, k2));
+ nrBand1 = min(nrBand1, 63);
+
+ q = find_initial_power(nrBand1, k1, k2);
+#ifdef FIXED_POINT
+ qk = (real_t)k1 << REAL_BITS;
+ //A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+ A_1 = k1;
+#else
+ qk = REAL_CONST(k1);
+ A_1 = (int32_t)(qk + .5);
+#endif
+ for (k = 0; k <= nrBand1 - 1; k++)
+ {
+ int32_t A_0 = A_1;
+#ifdef FIXED_POINT
+ qk = MUL_R(qk,q);
+ A_1 = (int32_t)((qk + REAL_CONST(0.5)) >> REAL_BITS);
+#else
+ qk *= q;
+ A_1 = (int32_t)(qk + 0.5);
+#endif
+ vDk1[k] = A_1 - A_0;
+ }
+
+ if (vDk1[0] < vDk0[nrBand0 - 1])
+ {
+ int32_t change;
+
+ /* needed? */
+ qsort(vDk1, nrBand1 + 1, sizeof(vDk1[0]), longcmp);
+ change = vDk0[nrBand0 - 1] - vDk1[0];
+ vDk1[0] = vDk0[nrBand0 - 1];
+ vDk1[nrBand1 - 1] = vDk1[nrBand1 - 1] - change;
+ }
+
+ /* needed? */
+ qsort(vDk1, nrBand1, sizeof(vDk1[0]), longcmp);
+ vk1[0] = k1;
+ for (k = 1; k <= nrBand1; k++)
+ {
+ vk1[k] = vk1[k-1] + vDk1[k-1];
+ if (vDk1[k-1] == 0)
+ return 1;
+ }
+
+ sbr->N_master = nrBand0 + nrBand1;
+ sbr->N_master = min(sbr->N_master, 64);
+ for (k = 0; k <= nrBand0; k++)
+ {
+ sbr->f_master[k] = (uint8_t) vk0[k];
+ }
+ for (k = nrBand0 + 1; k <= sbr->N_master; k++)
+ {
+ sbr->f_master[k] = (uint8_t) vk1[k - nrBand0];
+ }
+
+#if 0
+ printf("f_master[%d]: ", sbr->N_master);
+ for (k = 0; k <= sbr->N_master; k++)
+ {
+ printf("%d ", sbr->f_master[k]);
+ }
+ printf("\n");
+#endif
+
+ return 0;
+}
+
+/* calculate the derived frequency border tables from f_master */
+uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
+ uint8_t k2)
+{
+ uint8_t k, i;
+ uint32_t minus;
+
+ /* The following relation shall be satisfied: bs_xover_band < N_Master */
+ if (sbr->N_master <= bs_xover_band)
+ return 1;
+
+ sbr->N_high = sbr->N_master - bs_xover_band;
+ sbr->N_low = (sbr->N_high>>1) + (sbr->N_high - ((sbr->N_high>>1)<<1));
+
+ sbr->n[0] = sbr->N_low;
+ sbr->n[1] = sbr->N_high;
+
+ for (k = 0; k <= sbr->N_high; k++)
+ {
+ sbr->f_table_res[HI_RES][k] = sbr->f_master[k + bs_xover_band];
+ }
+
+ sbr->M = sbr->f_table_res[HI_RES][sbr->N_high] - sbr->f_table_res[HI_RES][0];
+ sbr->kx = sbr->f_table_res[HI_RES][0];
+ if (sbr->kx > 32)
+ return 1;
+ if (sbr->kx + sbr->M > 64)
+ return 1;
+
+ minus = (sbr->N_high & 1) ? 1 : 0;
+
+ for (k = 0; k <= sbr->N_low; k++)
+ {
+ if (k == 0)
+ i = 0;
+ else
+ i = (uint8_t)(2*k - minus);
+ sbr->f_table_res[LO_RES][k] = sbr->f_table_res[HI_RES][i];
+ }
+
+#if 0
+ printf("bs_freq_scale: %d\n", sbr->bs_freq_scale);
+ printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands);
+ printf("f_table_res[HI_RES][%d]: ", sbr->N_high);
+ for (k = 0; k <= sbr->N_high; k++)
+ {
+ printf("%d ", sbr->f_table_res[HI_RES][k]);
+ }
+ printf("\n");
+#endif
+#if 0
+ printf("f_table_res[LO_RES][%d]: ", sbr->N_low);
+ for (k = 0; k <= sbr->N_low; k++)
+ {
+ printf("%d ", sbr->f_table_res[LO_RES][k]);
+ }
+ printf("\n");
+#endif
+
+ sbr->N_Q = 0;
+ if (sbr->bs_noise_bands == 0)
+ {
+ sbr->N_Q = 1;
+ } else {
+#if 0
+ sbr->N_Q = max(1, (int32_t)(sbr->bs_noise_bands*(log(k2/(float)sbr->kx)/log(2.0)) + 0.5));
+#else
+ sbr->N_Q = (uint8_t)(max(1, find_bands(0, sbr->bs_noise_bands, sbr->kx, k2)));
+#endif
+ sbr->N_Q = min(5, sbr->N_Q);
+ }
+
+ for (k = 0; k <= sbr->N_Q; k++)
+ {
+ if (k == 0)
+ {
+ i = 0;
+ } else {
+ /* i = i + (int32_t)((sbr->N_low - i)/(sbr->N_Q + 1 - k)); */
+ i = i + (sbr->N_low - i)/(sbr->N_Q + 1 - k);
+ }
+ sbr->f_table_noise[k] = sbr->f_table_res[LO_RES][i];
+ }
+
+ /* build table for mapping k to g in hf patching */
+ for (k = 0; k < 64; k++)
+ {
+ uint8_t g;
+ for (g = 0; g < sbr->N_Q; g++)
+ {
+ if ((sbr->f_table_noise[g] <= k) &&
+ (k < sbr->f_table_noise[g+1]))
+ {
+ sbr->table_map_k_to_g[k] = g;
+ break;
+ }
+ }
+ }
+
+#if 0
+ printf("f_table_noise[%d]: ", sbr->N_Q);
+ for (k = 0; k <= sbr->N_Q; k++)
+ {
+ printf("%d ", sbr->f_table_noise[k] - sbr->kx);
+ }
+ printf("\n");
+#endif
+
+ return 0;
+}
+
+/* TODO: blegh, ugly */
+/* Modified to calculate for all possible bs_limiter_bands always
+ * This reduces the number calls to this functions needed (now only on
+ * header reset)
+ */
+void limiter_frequency_table(sbr_info *sbr)
+{
+#if 0
+ static const real_t limiterBandsPerOctave[] = { REAL_CONST(1.2),
+ REAL_CONST(2), REAL_CONST(3) };
+#else
+ static const real_t limiterBandsCompare[] = { REAL_CONST(1.327152),
+ REAL_CONST(1.185093), REAL_CONST(1.119872) };
+#endif
+ uint8_t k, s;
+ int8_t nrLim;
+#if 0
+ real_t limBands;
+#endif
+
+ sbr->f_table_lim[0][0] = sbr->f_table_res[LO_RES][0] - sbr->kx;
+ sbr->f_table_lim[0][1] = sbr->f_table_res[LO_RES][sbr->N_low] - sbr->kx;
+ sbr->N_L[0] = 1;
+
+#if 0
+ printf("f_table_lim[%d][%d]: ", 0, sbr->N_L[0]);
+ for (k = 0; k <= sbr->N_L[0]; k++)
+ {
+ printf("%d ", sbr->f_table_lim[0][k]);
+ }
+ printf("\n");
+#endif
+
+ for (s = 1; s < 4; s++)
+ {
+ int32_t limTable[100 /*TODO*/] = {0};
+ uint8_t patchBorders[64/*??*/] = {0};
+
+#if 0
+ limBands = limiterBandsPerOctave[s - 1];
+#endif
+
+ patchBorders[0] = sbr->kx;
+ for (k = 1; k <= sbr->noPatches; k++)
+ {
+ patchBorders[k] = patchBorders[k-1] + sbr->patchNoSubbands[k-1];
+ }
+
+ for (k = 0; k <= sbr->N_low; k++)
+ {
+ limTable[k] = sbr->f_table_res[LO_RES][k];
+ }
+ for (k = 1; k < sbr->noPatches; k++)
+ {
+ limTable[k+sbr->N_low] = patchBorders[k];
+ }
+
+ /* needed */
+ qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp);
+ k = 1;
+ nrLim = sbr->noPatches + sbr->N_low - 1;
+
+ if (nrLim < 0) // TODO: BIG FAT PROBLEM
+ return;
+
+restart:
+ if (k <= nrLim)
+ {
+ real_t nOctaves;
+
+ if (limTable[k-1] != 0)
+#if 0
+ nOctaves = REAL_CONST(log((float)limTable[k]/(float)limTable[k-1])/log(2.0));
+#else
+#ifdef FIXED_POINT
+ nOctaves = DIV_R((limTable[k]<<REAL_BITS),REAL_CONST(limTable[k-1]));
+#else
+ nOctaves = (real_t)limTable[k]/(real_t)limTable[k-1];
+#endif
+#endif
+ else
+ nOctaves = 0;
+
+#if 0
+ if ((MUL_R(nOctaves,limBands)) < REAL_CONST(0.49))
+#else
+ if (nOctaves < limiterBandsCompare[s - 1])
+#endif
+ {
+ uint8_t i;
+ if (limTable[k] != limTable[k-1])
+ {
+ uint8_t found = 0, found2 = 0;
+ for (i = 0; i <= sbr->noPatches; i++)
+ {
+ if (limTable[k] == patchBorders[i])
+ found = 1;
+ }
+ if (found)
+ {
+ found2 = 0;
+ for (i = 0; i <= sbr->noPatches; i++)
+ {
+ if (limTable[k-1] == patchBorders[i])
+ found2 = 1;
+ }
+ if (found2)
+ {
+ k++;
+ goto restart;
+ } else {
+ /* remove (k-1)th element */
+ limTable[k-1] = sbr->f_table_res[LO_RES][sbr->N_low];
+ qsort(limTable, sbr->noPatches + sbr->N_low, sizeof(limTable[0]), longcmp);
+ nrLim--;
+ goto restart;
+ }
+ }
+ }
+ /* remove kth element */
+ limTable[k] = sbr->f_table_res[LO_RES][sbr->N_low];
+ qsort(limTable, nrLim, sizeof(limTable[0]), longcmp);
+ nrLim--;
+ goto restart;
+ } else {
+ k++;
+ goto restart;
+ }
+ }
+
+ sbr->N_L[s] = nrLim;
+ for (k = 0; k <= nrLim; k++)
+ {
+ sbr->f_table_lim[s][k] = limTable[k] - sbr->kx;
+ }
+
+#if 0
+ printf("f_table_lim[%d][%d]: ", s, sbr->N_L[s]);
+ for (k = 0; k <= sbr->N_L[s]; k++)
+ {
+ printf("%d ", sbr->f_table_lim[s][k]);
+ }
+ printf("\n");
+#endif
+ }
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_fbt.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_fbt.h
new file mode 100644
index 000000000..d13031889
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_fbt.h
@@ -0,0 +1,57 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_fbt.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_FBT_H__
+#define __SBR_FBT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
+ uint32_t sample_rate);
+uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
+ uint8_t k0);
+uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
+ uint8_t bs_alter_scale);
+uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
+ uint8_t bs_freq_scale, uint8_t bs_alter_scale);
+uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
+ uint8_t k2);
+void limiter_frequency_table(sbr_info *sbr);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfadj.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfadj.c
new file mode 100644
index 000000000..814376c36
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfadj.c
@@ -0,0 +1,1750 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_hfadj.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* High Frequency adjustment */
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "sbr_syntax.h"
+#include "sbr_hfadj.h"
+
+#include "sbr_noise.h"
+
+
+/* static function declarations */
+static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
+ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch);
+#ifdef SBR_LOW_POWER
+static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch);
+#endif
+static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch);
+
+
+uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
+#ifdef SBR_LOW_POWER
+ ,real_t *deg /* aliasing degree */
+#endif
+ ,uint8_t ch)
+{
+ ALIGN sbr_hfadj_info adj = {{{0}}};
+ uint8_t ret = 0;
+
+ if (sbr->bs_frame_class[ch] == FIXFIX)
+ {
+ sbr->l_A[ch] = -1;
+ } else if (sbr->bs_frame_class[ch] == VARFIX) {
+ if (sbr->bs_pointer[ch] > 1)
+ sbr->l_A[ch] = -1;
+ else
+ sbr->l_A[ch] = sbr->bs_pointer[ch] - 1;
+ } else {
+ if (sbr->bs_pointer[ch] == 0)
+ sbr->l_A[ch] = -1;
+ else
+ sbr->l_A[ch] = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
+ }
+
+ ret = estimate_current_envelope(sbr, &adj, Xsbr, ch);
+ if (ret > 0)
+ return 1;
+
+ calculate_gain(sbr, &adj, ch);
+
+#ifdef SBR_LOW_POWER
+ calc_gain_groups(sbr, &adj, deg, ch);
+ aliasing_reduction(sbr, &adj, deg, ch);
+#endif
+
+ hf_assembly(sbr, &adj, Xsbr, ch);
+
+ return 0;
+}
+
+static uint8_t get_S_mapped(sbr_info *sbr, uint8_t ch, uint8_t l, uint8_t current_band)
+{
+ if (sbr->f[ch][l] == HI_RES)
+ {
+ /* in case of using f_table_high we just have 1 to 1 mapping
+ * from bs_add_harmonic[l][k]
+ */
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][current_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+ {
+ return sbr->bs_add_harmonic[ch][current_band];
+ }
+ } else {
+ uint8_t b, lb, ub;
+
+ /* in case of f_table_low we check if any of the HI_RES bands
+ * within this LO_RES band has bs_add_harmonic[l][k] turned on
+ * (note that borders in the LO_RES table are also present in
+ * the HI_RES table)
+ */
+
+ /* find first HI_RES band in current LO_RES band */
+ lb = 2*current_band - ((sbr->N_high & 1) ? 1 : 0);
+ /* find first HI_RES band in next LO_RES band */
+ ub = 2*(current_band+1) - ((sbr->N_high & 1) ? 1 : 0);
+
+ /* check all HI_RES bands in current LO_RES band for sinusoid */
+ for (b = lb; b < ub; b++)
+ {
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][b] && sbr->bs_add_harmonic_flag_prev[ch]))
+ {
+ if (sbr->bs_add_harmonic[ch][b] == 1)
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+static uint8_t estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj,
+ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
+{
+ uint8_t m, l, j, k, k_l, k_h, p;
+ real_t nrg, div;
+
+ if (sbr->bs_interpol_freq == 1)
+ {
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ uint8_t i, l_i, u_i;
+
+ l_i = sbr->t_E[ch][l];
+ u_i = sbr->t_E[ch][l+1];
+
+ div = (real_t)(u_i - l_i);
+
+ if (div == 0)
+ div = 1;
+
+ for (m = 0; m < sbr->M; m++)
+ {
+ nrg = 0;
+
+ for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
+ {
+#ifdef FIXED_POINT
+#ifdef SBR_LOW_POWER
+ nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+ nrg += ((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+ ((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][m + sbr->kx])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#endif
+#else
+ nrg += MUL_R(QMF_RE(Xsbr[i][m + sbr->kx]), QMF_RE(Xsbr[i][m + sbr->kx]))
+#ifndef SBR_LOW_POWER
+ + MUL_R(QMF_IM(Xsbr[i][m + sbr->kx]), QMF_IM(Xsbr[i][m + sbr->kx]))
+#endif
+ ;
+#endif
+ }
+
+ sbr->E_curr[ch][m][l] = nrg / div;
+#ifdef SBR_LOW_POWER
+#ifdef FIXED_POINT
+ sbr->E_curr[ch][m][l] <<= 1;
+#else
+ sbr->E_curr[ch][m][l] *= 2;
+#endif
+#endif
+ }
+ }
+ } else {
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ for (p = 0; p < sbr->n[sbr->f[ch][l]]; p++)
+ {
+ k_l = sbr->f_table_res[sbr->f[ch][l]][p];
+ k_h = sbr->f_table_res[sbr->f[ch][l]][p+1];
+
+ for (k = k_l; k < k_h; k++)
+ {
+ uint8_t i, l_i, u_i;
+ nrg = 0;
+
+ l_i = sbr->t_E[ch][l];
+ u_i = sbr->t_E[ch][l+1];
+
+ div = (real_t)((u_i - l_i)*(k_h - k_l));
+
+ if (div == 0)
+ div = 1;
+
+ for (i = l_i + sbr->tHFAdj; i < u_i + sbr->tHFAdj; i++)
+ {
+ for (j = k_l; j < k_h; j++)
+ {
+#ifdef FIXED_POINT
+#ifdef SBR_LOW_POWER
+ nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#else
+ nrg += ((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_RE(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS) +
+ ((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS)*((QMF_IM(Xsbr[i][j])+(1<<(REAL_BITS-1)))>>REAL_BITS);
+#endif
+#else
+ nrg += MUL_R(QMF_RE(Xsbr[i][j]), QMF_RE(Xsbr[i][j]))
+#ifndef SBR_LOW_POWER
+ + MUL_R(QMF_IM(Xsbr[i][j]), QMF_IM(Xsbr[i][j]))
+#endif
+ ;
+#endif
+ }
+ }
+
+ sbr->E_curr[ch][k - sbr->kx][l] = nrg / div;
+#ifdef SBR_LOW_POWER
+#ifdef FIXED_POINT
+ sbr->E_curr[ch][k - sbr->kx][l] <<= 1;
+#else
+ sbr->E_curr[ch][k - sbr->kx][l] *= 2;
+#endif
+#endif
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+#ifdef FIXED_POINT
+#define EPS (1) /* smallest number available in fixed point */
+#else
+#define EPS (1e-12)
+#endif
+
+
+
+#ifdef FIXED_POINT
+
+/* log2 values of [0..63] */
+static const real_t log2_int_tab[] = {
+ LOG2_MIN_INF, REAL_CONST(0.000000000000000), REAL_CONST(1.000000000000000), REAL_CONST(1.584962500721156),
+ REAL_CONST(2.000000000000000), REAL_CONST(2.321928094887362), REAL_CONST(2.584962500721156), REAL_CONST(2.807354922057604),
+ REAL_CONST(3.000000000000000), REAL_CONST(3.169925001442313), REAL_CONST(3.321928094887363), REAL_CONST(3.459431618637297),
+ REAL_CONST(3.584962500721156), REAL_CONST(3.700439718141092), REAL_CONST(3.807354922057604), REAL_CONST(3.906890595608519),
+ REAL_CONST(4.000000000000000), REAL_CONST(4.087462841250339), REAL_CONST(4.169925001442312), REAL_CONST(4.247927513443585),
+ REAL_CONST(4.321928094887362), REAL_CONST(4.392317422778761), REAL_CONST(4.459431618637297), REAL_CONST(4.523561956057013),
+ REAL_CONST(4.584962500721156), REAL_CONST(4.643856189774724), REAL_CONST(4.700439718141093), REAL_CONST(4.754887502163468),
+ REAL_CONST(4.807354922057604), REAL_CONST(4.857980995127572), REAL_CONST(4.906890595608519), REAL_CONST(4.954196310386875),
+ REAL_CONST(5.000000000000000), REAL_CONST(5.044394119358453), REAL_CONST(5.087462841250340), REAL_CONST(5.129283016944966),
+ REAL_CONST(5.169925001442312), REAL_CONST(5.209453365628949), REAL_CONST(5.247927513443585), REAL_CONST(5.285402218862248),
+ REAL_CONST(5.321928094887363), REAL_CONST(5.357552004618084), REAL_CONST(5.392317422778761), REAL_CONST(5.426264754702098),
+ REAL_CONST(5.459431618637297), REAL_CONST(5.491853096329675), REAL_CONST(5.523561956057013), REAL_CONST(5.554588851677637),
+ REAL_CONST(5.584962500721156), REAL_CONST(5.614709844115208), REAL_CONST(5.643856189774724), REAL_CONST(5.672425341971495),
+ REAL_CONST(5.700439718141093), REAL_CONST(5.727920454563200), REAL_CONST(5.754887502163469), REAL_CONST(5.781359713524660),
+ REAL_CONST(5.807354922057605), REAL_CONST(5.832890014164742), REAL_CONST(5.857980995127572), REAL_CONST(5.882643049361842),
+ REAL_CONST(5.906890595608518), REAL_CONST(5.930737337562887), REAL_CONST(5.954196310386876), REAL_CONST(5.977279923499916)
+};
+
+static const real_t pan_log2_tab[] = {
+ REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362), REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339),
+ REAL_CONST(0.044394119358453), REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878), REAL_CONST(0.002815015607054),
+ REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247), REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
+ REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667)
+};
+
+static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+ /* check for coupled energy/noise data */
+ if (sbr->bs_coupling == 1)
+ {
+ uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
+ uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
+ real_t tmp = (7 << REAL_BITS) + (sbr->E[0][k][l] << (REAL_BITS-amp0));
+ real_t pan;
+
+ /* E[1] should always be even so shifting is OK */
+ uint8_t E = sbr->E[1][k][l] >> amp1;
+
+ if (ch == 0)
+ {
+ if (E > 12)
+ {
+ /* negative */
+ pan = pan_log2_tab[-12 + E];
+ } else {
+ /* positive */
+ pan = pan_log2_tab[12 - E] + ((12 - E)<<REAL_BITS);
+ }
+ } else {
+ if (E < 12)
+ {
+ /* negative */
+ pan = pan_log2_tab[-E + 12];
+ } else {
+ /* positive */
+ pan = pan_log2_tab[E - 12] + ((E - 12)<<REAL_BITS);
+ }
+ }
+
+ /* tmp / pan in log2 */
+ return tmp - pan;
+ } else {
+ uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
+
+ return (6 << REAL_BITS) + (sbr->E[ch][k][l] << (REAL_BITS-amp));
+ }
+}
+
+static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+ /* check for coupled energy/noise data */
+ if (sbr->bs_coupling == 1)
+ {
+ real_t tmp = (7 << REAL_BITS) - (sbr->Q[0][k][l] << REAL_BITS);
+ real_t pan;
+
+ uint8_t Q = sbr->Q[1][k][l];
+
+ if (ch == 0)
+ {
+ if (Q > 12)
+ {
+ /* negative */
+ pan = pan_log2_tab[-12 + Q];
+ } else {
+ /* positive */
+ pan = pan_log2_tab[12 - Q] + ((12 - Q)<<REAL_BITS);
+ }
+ } else {
+ if (Q < 12)
+ {
+ /* negative */
+ pan = pan_log2_tab[-Q + 12];
+ } else {
+ /* positive */
+ pan = pan_log2_tab[Q - 12] + ((Q - 12)<<REAL_BITS);
+ }
+ }
+
+ /* tmp / pan in log2 */
+ return tmp - pan;
+ } else {
+ return (6 << REAL_BITS) - (sbr->Q[ch][k][l] << REAL_BITS);
+ }
+}
+
+static const real_t log_Qplus1_pan[31][13] = {
+ { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) },
+ { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) },
+ { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) },
+ { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) },
+ { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) },
+ { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) },
+ { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) },
+ { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) },
+ { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) },
+ { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) },
+ { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) },
+ { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) },
+ { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) },
+ { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) },
+ { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) },
+ { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) },
+ { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) },
+ { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) },
+ { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) }
+};
+
+static const real_t log_Qplus1[31] = {
+ REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339),
+ REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156),
+ REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362),
+ REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453),
+ REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878),
+ REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247),
+ REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
+ REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667),
+ REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551),
+ REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641),
+ REAL_CONST(0.000000000000000)
+};
+
+static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+ /* check for coupled energy/noise data */
+ if (sbr->bs_coupling == 1)
+ {
+ if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
+ (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
+ {
+ if (ch == 0)
+ {
+ return log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1];
+ } else {
+ return log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)];
+ }
+ } else {
+ return 0;
+ }
+ } else {
+ if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
+ {
+ return log_Qplus1[sbr->Q[ch][k][l]];
+ } else {
+ return 0;
+ }
+ }
+}
+
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+ /* log2 values of limiter gains */
+ static real_t limGain[] = {
+ REAL_CONST(-1.0), REAL_CONST(0.0), REAL_CONST(1.0), REAL_CONST(33.219)
+ };
+ uint8_t m, l, k;
+
+ uint8_t current_t_noise_band = 0;
+ uint8_t S_mapped;
+
+ ALIGN real_t Q_M_lim[MAX_M];
+ ALIGN real_t G_lim[MAX_M];
+ ALIGN real_t G_boost;
+ ALIGN real_t S_M[MAX_M];
+
+
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ uint8_t current_f_noise_band = 0;
+ uint8_t current_res_band = 0;
+ uint8_t current_res_band2 = 0;
+ uint8_t current_hi_res_band = 0;
+
+ real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
+
+ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+
+ if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+ {
+ current_t_noise_band++;
+ }
+
+ for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+ {
+ real_t Q_M = 0;
+ real_t G_max;
+ real_t den = 0;
+ real_t acc1 = 0;
+ real_t acc2 = 0;
+ uint8_t current_res_band_size = 0;
+ uint8_t Q_M_size = 0;
+
+ uint8_t ml1, ml2;
+
+ /* bounds of current limiter bands */
+ ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+ ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+ /* calculate the accumulated E_orig and E_curr over the limiter band */
+ for (m = ml1; m < ml2; m++)
+ {
+ if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+ {
+ current_res_band_size++;
+ } else {
+ acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch));
+
+ current_res_band++;
+ current_res_band_size = 1;
+ }
+
+ acc2 += sbr->E_curr[ch][m][l];
+ }
+ acc1 += pow2_int(-REAL_CONST(10) + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch));
+
+
+ if (acc1 == 0)
+ acc1 = LOG2_MIN_INF;
+ else
+ acc1 = log2_int(acc1);
+
+
+ /* calculate the maximum gain */
+ /* ratio of the energy of the original signal and the energy
+ * of the HF generated signal
+ */
+ G_max = acc1 - log2_int(acc2) + limGain[sbr->bs_limiter_gains];
+ G_max = min(G_max, limGain[3]);
+
+
+ for (m = ml1; m < ml2; m++)
+ {
+ real_t G;
+ real_t E_curr, E_orig;
+ real_t Q_orig, Q_orig_plus1;
+ uint8_t S_index_mapped;
+
+
+ /* check if m is on a noise band border */
+ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+ {
+ /* step to next noise band */
+ current_f_noise_band++;
+ }
+
+
+ /* check if m is on a resolution band border */
+ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+ {
+ /* accumulate a whole range of equal Q_Ms */
+ if (Q_M_size > 0)
+ den += pow2_int(log2_int_tab[Q_M_size] + Q_M);
+ Q_M_size = 0;
+
+ /* step to next resolution band */
+ current_res_band2++;
+
+ /* if we move to a new resolution band, we should check if we are
+ * going to add a sinusoid in this band
+ */
+ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+ }
+
+
+ /* check if m is on a HI_RES band border */
+ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+ {
+ /* step to next HI_RES band */
+ current_hi_res_band++;
+ }
+
+
+ /* find S_index_mapped
+ * S_index_mapped can only be 1 for the m in the middle of the
+ * current HI_RES band
+ */
+ S_index_mapped = 0;
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+ {
+ /* find the middle subband of the HI_RES frequency band */
+ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+ S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
+ }
+
+
+ /* find bitstream parameters */
+ if (sbr->E_curr[ch][m][l] == 0)
+ E_curr = LOG2_MIN_INF;
+ else
+ E_curr = log2_int(sbr->E_curr[ch][m][l]);
+ E_orig = -REAL_CONST(10) + find_log2_E(sbr, current_res_band2, l, ch);
+
+
+ Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch);
+ Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch);
+
+
+ /* Q_M only depends on E_orig and Q_div2:
+ * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on
+ * a change of current res band (HI or LO)
+ */
+ Q_M = E_orig + Q_orig - Q_orig_plus1;
+
+
+ /* S_M only depends on E_orig, Q_div and S_index_mapped:
+ * S_index_mapped can only be non-zero once per HI_RES band
+ */
+ if (S_index_mapped == 0)
+ {
+ S_M[m] = LOG2_MIN_INF; /* -inf */
+ } else {
+ S_M[m] = E_orig - Q_orig_plus1;
+
+ /* accumulate sinusoid part of the total energy */
+ den += pow2_int(S_M[m]);
+ }
+
+
+ /* calculate gain */
+ /* ratio of the energy of the original signal and the energy
+ * of the HF generated signal
+ */
+ /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */
+ /* scaled by -10 */
+ G = E_orig - max(-REAL_CONST(10), E_curr);
+ if ((S_mapped == 0) && (delta == 1))
+ {
+ /* G = G * 1/(1+Q) */
+ G -= Q_orig_plus1;
+ } else if (S_mapped == 1) {
+ /* G = G * Q/(1+Q) */
+ G += Q_orig - Q_orig_plus1;
+ }
+
+
+ /* limit the additional noise energy level */
+ /* and apply the limiter */
+ if (G_max > G)
+ {
+ Q_M_lim[m] = Q_M;
+ G_lim[m] = G;
+
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ {
+ Q_M_size++;
+ }
+ } else {
+ /* G > G_max */
+ Q_M_lim[m] = Q_M + G_max - G;
+ G_lim[m] = G_max;
+
+ /* accumulate limited Q_M */
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ {
+ den += pow2_int(Q_M_lim[m]);
+ }
+ }
+
+
+ /* accumulate the total energy */
+ /* E_curr changes for every m so we do need to accumulate every m */
+ den += pow2_int(E_curr + G_lim[m]);
+ }
+
+ /* accumulate last range of equal Q_Ms */
+ if (Q_M_size > 0)
+ {
+ den += pow2_int(log2_int_tab[Q_M_size] + Q_M);
+ }
+
+
+ /* calculate the final gain */
+ /* G_boost: [0..2.51188643] */
+ G_boost = acc1 - log2_int(den /*+ EPS*/);
+ G_boost = min(G_boost, REAL_CONST(1.328771237) /* log2(1.584893192 ^ 2) */);
+
+
+ for (m = ml1; m < ml2; m++)
+ {
+ /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+ adj->G_lim_boost[l][m] = pow2_fix((G_lim[m] + G_boost) >> 1);
+#else
+ /* sqrt() will be done after the aliasing reduction to save a
+ * few multiplies
+ */
+ adj->G_lim_boost[l][m] = pow2_fix(G_lim[m] + G_boost);
+#endif
+ adj->Q_M_lim_boost[l][m] = pow2_fix((Q_M_lim[m] + G_boost) >> 1);
+
+ if (S_M[m] != LOG2_MIN_INF)
+ {
+ adj->S_M_boost[l][m] = pow2_int((S_M[m] + G_boost) >> 1);
+ } else {
+ adj->S_M_boost[l][m] = 0;
+ }
+ }
+ }
+ }
+}
+
+#else
+
+//#define LOG2_TEST
+
+#ifdef LOG2_TEST
+
+#define LOG2_MIN_INF -100000
+
+__inline float pow2(float val)
+{
+ return pow(2.0, val);
+}
+__inline float log2(float val)
+{
+ return log(val)/log(2.0);
+}
+
+#define RB 14
+
+float QUANTISE2REAL(float val)
+{
+ __int32 ival = (__int32)(val * (1<<RB));
+ return (float)ival / (float)((1<<RB));
+}
+
+float QUANTISE2INT(float val)
+{
+ return floor(val);
+}
+
+/* log2 values of [0..63] */
+static const real_t log2_int_tab[] = {
+ LOG2_MIN_INF, 0.000000000000000, 1.000000000000000, 1.584962500721156,
+ 2.000000000000000, 2.321928094887362, 2.584962500721156, 2.807354922057604,
+ 3.000000000000000, 3.169925001442313, 3.321928094887363, 3.459431618637297,
+ 3.584962500721156, 3.700439718141092, 3.807354922057604, 3.906890595608519,
+ 4.000000000000000, 4.087462841250339, 4.169925001442312, 4.247927513443585,
+ 4.321928094887362, 4.392317422778761, 4.459431618637297, 4.523561956057013,
+ 4.584962500721156, 4.643856189774724, 4.700439718141093, 4.754887502163468,
+ 4.807354922057604, 4.857980995127572, 4.906890595608519, 4.954196310386875,
+ 5.000000000000000, 5.044394119358453, 5.087462841250340, 5.129283016944966,
+ 5.169925001442312, 5.209453365628949, 5.247927513443585, 5.285402218862248,
+ 5.321928094887363, 5.357552004618084, 5.392317422778761, 5.426264754702098,
+ 5.459431618637297, 5.491853096329675, 5.523561956057013, 5.554588851677637,
+ 5.584962500721156, 5.614709844115208, 5.643856189774724, 5.672425341971495,
+ 5.700439718141093, 5.727920454563200, 5.754887502163469, 5.781359713524660,
+ 5.807354922057605, 5.832890014164742, 5.857980995127572, 5.882643049361842,
+ 5.906890595608518, 5.930737337562887, 5.954196310386876, 5.977279923499916
+};
+
+static const real_t pan_log2_tab[] = {
+ 1.000000000000000, 0.584962500721156, 0.321928094887362, 0.169925001442312, 0.087462841250339,
+ 0.044394119358453, 0.022367813028455, 0.011227255423254, 0.005624549193878, 0.002815015607054,
+ 0.001408194392808, 0.000704269011247, 0.000352177480301, 0.000176099486443, 0.000088052430122,
+ 0.000044026886827, 0.000022013611360, 0.000011006847667
+};
+
+static real_t find_log2_E(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+ /* check for coupled energy/noise data */
+ if (sbr->bs_coupling == 1)
+ {
+ real_t amp0 = (sbr->amp_res[0]) ? 1.0 : 0.5;
+ real_t amp1 = (sbr->amp_res[1]) ? 1.0 : 0.5;
+ float tmp = QUANTISE2REAL(7.0 + (real_t)sbr->E[0][k][l] * amp0);
+ float pan;
+
+ int E = (int)(sbr->E[1][k][l] * amp1);
+
+ if (ch == 0)
+ {
+ if (E > 12)
+ {
+ /* negative */
+ pan = QUANTISE2REAL(pan_log2_tab[-12 + E]);
+ } else {
+ /* positive */
+ pan = QUANTISE2REAL(pan_log2_tab[12 - E] + (12 - E));
+ }
+ } else {
+ if (E < 12)
+ {
+ /* negative */
+ pan = QUANTISE2REAL(pan_log2_tab[-E + 12]);
+ } else {
+ /* positive */
+ pan = QUANTISE2REAL(pan_log2_tab[E - 12] + (E - 12));
+ }
+ }
+
+ /* tmp / pan in log2 */
+ return QUANTISE2REAL(tmp - pan);
+ } else {
+ real_t amp = (sbr->amp_res[ch]) ? 1.0 : 0.5;
+
+ return QUANTISE2REAL(6.0 + (real_t)sbr->E[ch][k][l] * amp);
+ }
+}
+
+static real_t find_log2_Q(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+ /* check for coupled energy/noise data */
+ if (sbr->bs_coupling == 1)
+ {
+ float tmp = QUANTISE2REAL(7.0 - (real_t)sbr->Q[0][k][l]);
+ float pan;
+
+ int Q = (int)(sbr->Q[1][k][l]);
+
+ if (ch == 0)
+ {
+ if (Q > 12)
+ {
+ /* negative */
+ pan = QUANTISE2REAL(pan_log2_tab[-12 + Q]);
+ } else {
+ /* positive */
+ pan = QUANTISE2REAL(pan_log2_tab[12 - Q] + (12 - Q));
+ }
+ } else {
+ if (Q < 12)
+ {
+ /* negative */
+ pan = QUANTISE2REAL(pan_log2_tab[-Q + 12]);
+ } else {
+ /* positive */
+ pan = QUANTISE2REAL(pan_log2_tab[Q - 12] + (Q - 12));
+ }
+ }
+
+ /* tmp / pan in log2 */
+ return QUANTISE2REAL(tmp - pan);
+ } else {
+ return QUANTISE2REAL(6.0 - (real_t)sbr->Q[ch][k][l]);
+ }
+}
+
+static const real_t log_Qplus1_pan[31][13] = {
+ { REAL_CONST(0.044383447617292), REAL_CONST(0.169768601655960), REAL_CONST(0.583090126514435), REAL_CONST(1.570089221000671), REAL_CONST(3.092446088790894), REAL_CONST(4.733354568481445), REAL_CONST(6.022367954254150), REAL_CONST(6.692092418670654), REAL_CONST(6.924463272094727), REAL_CONST(6.989034175872803), REAL_CONST(7.005646705627441), REAL_CONST(7.009829998016357), REAL_CONST(7.010877609252930) },
+ { REAL_CONST(0.022362394258380), REAL_CONST(0.087379962205887), REAL_CONST(0.320804953575134), REAL_CONST(0.988859415054321), REAL_CONST(2.252387046813965), REAL_CONST(3.786596298217773), REAL_CONST(5.044394016265869), REAL_CONST(5.705977916717529), REAL_CONST(5.936291694641113), REAL_CONST(6.000346660614014), REAL_CONST(6.016829967498779), REAL_CONST(6.020981311798096), REAL_CONST(6.022020816802979) },
+ { REAL_CONST(0.011224525049329), REAL_CONST(0.044351425021887), REAL_CONST(0.169301137328148), REAL_CONST(0.577544987201691), REAL_CONST(1.527246952056885), REAL_CONST(2.887525320053101), REAL_CONST(4.087462902069092), REAL_CONST(4.733354568481445), REAL_CONST(4.959661006927490), REAL_CONST(5.022709369659424), REAL_CONST(5.038940429687500), REAL_CONST(5.043028831481934), REAL_CONST(5.044052600860596) },
+ { REAL_CONST(0.005623178556561), REAL_CONST(0.022346137091517), REAL_CONST(0.087132595479488), REAL_CONST(0.317482173442841), REAL_CONST(0.956931233406067), REAL_CONST(2.070389270782471), REAL_CONST(3.169924974441528), REAL_CONST(3.786596298217773), REAL_CONST(4.005294322967529), REAL_CONST(4.066420555114746), REAL_CONST(4.082170009613037), REAL_CONST(4.086137294769287), REAL_CONST(4.087131500244141) },
+ { REAL_CONST(0.002814328996465), REAL_CONST(0.011216334067285), REAL_CONST(0.044224001467228), REAL_CONST(0.167456731200218), REAL_CONST(0.556393325328827), REAL_CONST(1.378511548042297), REAL_CONST(2.321928024291992), REAL_CONST(2.887525320053101), REAL_CONST(3.092446088790894), REAL_CONST(3.150059700012207), REAL_CONST(3.164926528930664), REAL_CONST(3.168673276901245), REAL_CONST(3.169611930847168) },
+ { REAL_CONST(0.001407850766554), REAL_CONST(0.005619067233056), REAL_CONST(0.022281449288130), REAL_CONST(0.086156636476517), REAL_CONST(0.304854571819305), REAL_CONST(0.847996890544891), REAL_CONST(1.584962487220764), REAL_CONST(2.070389270782471), REAL_CONST(2.252387046813965), REAL_CONST(2.304061651229858), REAL_CONST(2.317430257797241), REAL_CONST(2.320801734924316), REAL_CONST(2.321646213531494) },
+ { REAL_CONST(0.000704097095877), REAL_CONST(0.002812269143760), REAL_CONST(0.011183738708496), REAL_CONST(0.043721374124289), REAL_CONST(0.160464659333229), REAL_CONST(0.485426813364029), REAL_CONST(1.000000000000000), REAL_CONST(1.378511548042297), REAL_CONST(1.527246952056885), REAL_CONST(1.570089221000671), REAL_CONST(1.581215262413025), REAL_CONST(1.584023833274841), REAL_CONST(1.584727644920349) },
+ { REAL_CONST(0.000352177477907), REAL_CONST(0.001406819908880), REAL_CONST(0.005602621007711), REAL_CONST(0.022026389837265), REAL_CONST(0.082462236285210), REAL_CONST(0.263034462928772), REAL_CONST(0.584962487220764), REAL_CONST(0.847996890544891), REAL_CONST(0.956931233406067), REAL_CONST(0.988859415054321), REAL_CONST(0.997190535068512), REAL_CONST(0.999296069145203), REAL_CONST(0.999823868274689) },
+ { REAL_CONST(0.000176099492819), REAL_CONST(0.000703581434209), REAL_CONST(0.002804030198604), REAL_CONST(0.011055230163038), REAL_CONST(0.041820213198662), REAL_CONST(0.137503549456596), REAL_CONST(0.321928083896637), REAL_CONST(0.485426813364029), REAL_CONST(0.556393325328827), REAL_CONST(0.577544987201691), REAL_CONST(0.583090126514435), REAL_CONST(0.584493279457092), REAL_CONST(0.584845066070557) },
+ { REAL_CONST(0.000088052431238), REAL_CONST(0.000351833587047), REAL_CONST(0.001402696361765), REAL_CONST(0.005538204684854), REAL_CONST(0.021061634644866), REAL_CONST(0.070389263331890), REAL_CONST(0.169925004243851), REAL_CONST(0.263034462928772), REAL_CONST(0.304854571819305), REAL_CONST(0.317482173442841), REAL_CONST(0.320804953575134), REAL_CONST(0.321646571159363), REAL_CONST(0.321857661008835) },
+ { REAL_CONST(0.000044026888645), REAL_CONST(0.000175927518285), REAL_CONST(0.000701518612914), REAL_CONST(0.002771759871393), REAL_CONST(0.010569252073765), REAL_CONST(0.035623874515295), REAL_CONST(0.087462842464447), REAL_CONST(0.137503549456596), REAL_CONST(0.160464659333229), REAL_CONST(0.167456731200218), REAL_CONST(0.169301137328148), REAL_CONST(0.169768601655960), REAL_CONST(0.169885858893394) },
+ { REAL_CONST(0.000022013611670), REAL_CONST(0.000088052431238), REAL_CONST(0.000350801943569), REAL_CONST(0.001386545598507), REAL_CONST(0.005294219125062), REAL_CONST(0.017921976745129), REAL_CONST(0.044394120573997), REAL_CONST(0.070389263331890), REAL_CONST(0.082462236285210), REAL_CONST(0.086156636476517), REAL_CONST(0.087132595479488), REAL_CONST(0.087379962205887), REAL_CONST(0.087442122399807) },
+ { REAL_CONST(0.000011006847672), REAL_CONST(0.000044026888645), REAL_CONST(0.000175411638338), REAL_CONST(0.000693439331371), REAL_CONST(0.002649537986144), REAL_CONST(0.008988817222416), REAL_CONST(0.022367812693119), REAL_CONST(0.035623874515295), REAL_CONST(0.041820213198662), REAL_CONST(0.043721374124289), REAL_CONST(0.044224001467228), REAL_CONST(0.044351425021887), REAL_CONST(0.044383447617292) },
+ { REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000087708482170), REAL_CONST(0.000346675369656), REAL_CONST(0.001325377263129), REAL_CONST(0.004501323681325), REAL_CONST(0.011227255687118), REAL_CONST(0.017921976745129), REAL_CONST(0.021061634644866), REAL_CONST(0.022026389837265), REAL_CONST(0.022281449288130), REAL_CONST(0.022346137091517), REAL_CONST(0.022362394258380) },
+ { REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043854910473), REAL_CONST(0.000173348103999), REAL_CONST(0.000662840844598), REAL_CONST(0.002252417383716), REAL_CONST(0.005624548997730), REAL_CONST(0.008988817222416), REAL_CONST(0.010569252073765), REAL_CONST(0.011055230163038), REAL_CONST(0.011183738708496), REAL_CONST(0.011216334067285), REAL_CONST(0.011224525049329) },
+ { REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000022013611670), REAL_CONST(0.000086676649516), REAL_CONST(0.000331544462824), REAL_CONST(0.001126734190620), REAL_CONST(0.002815015614033), REAL_CONST(0.004501323681325), REAL_CONST(0.005294219125062), REAL_CONST(0.005538204684854), REAL_CONST(0.005602621007711), REAL_CONST(0.005619067233056), REAL_CONST(0.005623178556561) },
+ { REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000011006847672), REAL_CONST(0.000043338975956), REAL_CONST(0.000165781748365), REAL_CONST(0.000563477107789), REAL_CONST(0.001408194424585), REAL_CONST(0.002252417383716), REAL_CONST(0.002649537986144), REAL_CONST(0.002771759871393), REAL_CONST(0.002804030198604), REAL_CONST(0.002812269143760), REAL_CONST(0.002814328996465) },
+ { REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000021669651687), REAL_CONST(0.000082893253420), REAL_CONST(0.000281680084299), REAL_CONST(0.000704268983100), REAL_CONST(0.001126734190620), REAL_CONST(0.001325377263129), REAL_CONST(0.001386545598507), REAL_CONST(0.001402696361765), REAL_CONST(0.001406819908880), REAL_CONST(0.001407850766554) },
+ { REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010834866771), REAL_CONST(0.000041447223339), REAL_CONST(0.000140846910654), REAL_CONST(0.000352177477907), REAL_CONST(0.000563477107789), REAL_CONST(0.000662840844598), REAL_CONST(0.000693439331371), REAL_CONST(0.000701518612914), REAL_CONST(0.000703581434209), REAL_CONST(0.000704097095877) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005503434295), REAL_CONST(0.000020637769921), REAL_CONST(0.000070511166996), REAL_CONST(0.000176099492819), REAL_CONST(0.000281680084299), REAL_CONST(0.000331544462824), REAL_CONST(0.000346675369656), REAL_CONST(0.000350801943569), REAL_CONST(0.000351833587047), REAL_CONST(0.000352177477907) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002751719876), REAL_CONST(0.000010318922250), REAL_CONST(0.000035256012779), REAL_CONST(0.000088052431238), REAL_CONST(0.000140846910654), REAL_CONST(0.000165781748365), REAL_CONST(0.000173348103999), REAL_CONST(0.000175411638338), REAL_CONST(0.000175927518285), REAL_CONST(0.000176099492819) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000005159470220), REAL_CONST(0.000017542124624), REAL_CONST(0.000044026888645), REAL_CONST(0.000070511166996), REAL_CONST(0.000082893253420), REAL_CONST(0.000086676649516), REAL_CONST(0.000087708482170), REAL_CONST(0.000088052431238), REAL_CONST(0.000088052431238) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002579737384), REAL_CONST(0.000008771088687), REAL_CONST(0.000022013611670), REAL_CONST(0.000035256012779), REAL_CONST(0.000041447223339), REAL_CONST(0.000043338975956), REAL_CONST(0.000043854910473), REAL_CONST(0.000044026888645), REAL_CONST(0.000044026888645) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001375860506), REAL_CONST(0.000004471542070), REAL_CONST(0.000011006847672), REAL_CONST(0.000017542124624), REAL_CONST(0.000020637769921), REAL_CONST(0.000021669651687), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670), REAL_CONST(0.000022013611670) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000687930424), REAL_CONST(0.000002235772627), REAL_CONST(0.000005503434295), REAL_CONST(0.000008771088687), REAL_CONST(0.000010318922250), REAL_CONST(0.000010834866771), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672), REAL_CONST(0.000011006847672) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000001031895522), REAL_CONST(0.000002751719876), REAL_CONST(0.000004471542070), REAL_CONST(0.000005159470220), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295), REAL_CONST(0.000005503434295) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000515947875), REAL_CONST(0.000001375860506), REAL_CONST(0.000002235772627), REAL_CONST(0.000002579737384), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876), REAL_CONST(0.000002751719876) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000343965269), REAL_CONST(0.000000687930424), REAL_CONST(0.000001031895522), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506), REAL_CONST(0.000001375860506) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000515947875), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424), REAL_CONST(0.000000687930424) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269), REAL_CONST(0.000000343965269) },
+ { REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000000000000), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634), REAL_CONST(0.000000171982634) }
+};
+
+static const real_t log_Qplus1[31] = {
+ REAL_CONST(6.022367813028454), REAL_CONST(5.044394119358453), REAL_CONST(4.087462841250339),
+ REAL_CONST(3.169925001442313), REAL_CONST(2.321928094887362), REAL_CONST(1.584962500721156),
+ REAL_CONST(1.000000000000000), REAL_CONST(0.584962500721156), REAL_CONST(0.321928094887362),
+ REAL_CONST(0.169925001442312), REAL_CONST(0.087462841250339), REAL_CONST(0.044394119358453),
+ REAL_CONST(0.022367813028455), REAL_CONST(0.011227255423254), REAL_CONST(0.005624549193878),
+ REAL_CONST(0.002815015607054), REAL_CONST(0.001408194392808), REAL_CONST(0.000704269011247),
+ REAL_CONST(0.000352177480301), REAL_CONST(0.000176099486443), REAL_CONST(0.000088052430122),
+ REAL_CONST(0.000044026886827), REAL_CONST(0.000022013611360), REAL_CONST(0.000011006847667),
+ REAL_CONST(0.000005503434331), REAL_CONST(0.000002751719790), REAL_CONST(0.000001375860551),
+ REAL_CONST(0.000000687930439), REAL_CONST(0.000000343965261), REAL_CONST(0.000000171982641),
+ REAL_CONST(0.000000000000000)
+};
+
+static real_t find_log2_Qplus1(sbr_info *sbr, uint8_t k, uint8_t l, uint8_t ch)
+{
+ /* check for coupled energy/noise data */
+ if (sbr->bs_coupling == 1)
+ {
+ if ((sbr->Q[0][k][l] >= 0) && (sbr->Q[0][k][l] <= 30) &&
+ (sbr->Q[1][k][l] >= 0) && (sbr->Q[1][k][l] <= 24))
+ {
+ if (ch == 0)
+ {
+ return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][sbr->Q[1][k][l] >> 1]);
+ } else {
+ return QUANTISE2REAL(log_Qplus1_pan[sbr->Q[0][k][l]][12 - (sbr->Q[1][k][l] >> 1)]);
+ }
+ } else {
+ return 0;
+ }
+ } else {
+ if (sbr->Q[ch][k][l] >= 0 && sbr->Q[ch][k][l] <= 30)
+ {
+ return QUANTISE2REAL(log_Qplus1[sbr->Q[ch][k][l]]);
+ } else {
+ return 0;
+ }
+ }
+}
+
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+ /* log2 values of limiter gains */
+ static real_t limGain[] = { -1.0, 0.0, 1.0, 33.219 };
+ uint8_t m, l, k;
+
+ uint8_t current_t_noise_band = 0;
+ uint8_t S_mapped;
+
+ ALIGN real_t Q_M_lim[MAX_M];
+ ALIGN real_t G_lim[MAX_M];
+ ALIGN real_t G_boost;
+ ALIGN real_t S_M[MAX_M];
+
+
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ uint8_t current_f_noise_band = 0;
+ uint8_t current_res_band = 0;
+ uint8_t current_res_band2 = 0;
+ uint8_t current_hi_res_band = 0;
+
+ real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
+
+ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+
+ if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+ {
+ current_t_noise_band++;
+ }
+
+ for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+ {
+ real_t Q_M = 0;
+ real_t G_max;
+ real_t den = 0;
+ real_t acc1 = 0;
+ real_t acc2 = 0;
+ uint8_t current_res_band_size = 0;
+ uint8_t Q_M_size = 0;
+
+ uint8_t ml1, ml2;
+
+ /* bounds of current limiter bands */
+ ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+ ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+ /* calculate the accumulated E_orig and E_curr over the limiter band */
+ for (m = ml1; m < ml2; m++)
+ {
+ if ((m + sbr->kx) < sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+ {
+ current_res_band_size++;
+ } else {
+ acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)));
+
+ current_res_band++;
+ current_res_band_size = 1;
+ }
+
+ acc2 += QUANTISE2INT(sbr->E_curr[ch][m][l]/1024.0);
+ }
+ acc1 += QUANTISE2INT(pow2(-10 + log2_int_tab[current_res_band_size] + find_log2_E(sbr, current_res_band, l, ch)));
+
+ acc1 = QUANTISE2REAL( log2(EPS + acc1) );
+
+
+ /* calculate the maximum gain */
+ /* ratio of the energy of the original signal and the energy
+ * of the HF generated signal
+ */
+ G_max = acc1 - QUANTISE2REAL(log2(EPS + acc2)) + QUANTISE2REAL(limGain[sbr->bs_limiter_gains]);
+ G_max = min(G_max, QUANTISE2REAL(limGain[3]));
+
+
+ for (m = ml1; m < ml2; m++)
+ {
+ real_t G;
+ real_t E_curr, E_orig;
+ real_t Q_orig, Q_orig_plus1;
+ uint8_t S_index_mapped;
+
+
+ /* check if m is on a noise band border */
+ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+ {
+ /* step to next noise band */
+ current_f_noise_band++;
+ }
+
+
+ /* check if m is on a resolution band border */
+ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+ {
+ /* accumulate a whole range of equal Q_Ms */
+ if (Q_M_size > 0)
+ den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M));
+ Q_M_size = 0;
+
+ /* step to next resolution band */
+ current_res_band2++;
+
+ /* if we move to a new resolution band, we should check if we are
+ * going to add a sinusoid in this band
+ */
+ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+ }
+
+
+ /* check if m is on a HI_RES band border */
+ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+ {
+ /* step to next HI_RES band */
+ current_hi_res_band++;
+ }
+
+
+ /* find S_index_mapped
+ * S_index_mapped can only be 1 for the m in the middle of the
+ * current HI_RES band
+ */
+ S_index_mapped = 0;
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+ {
+ /* find the middle subband of the HI_RES frequency band */
+ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+ S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
+ }
+
+
+ /* find bitstream parameters */
+ if (sbr->E_curr[ch][m][l] == 0)
+ E_curr = LOG2_MIN_INF;
+ else
+ E_curr = -10 + log2(sbr->E_curr[ch][m][l]);
+ E_orig = -10 + find_log2_E(sbr, current_res_band2, l, ch);
+
+ Q_orig = find_log2_Q(sbr, current_f_noise_band, current_t_noise_band, ch);
+ Q_orig_plus1 = find_log2_Qplus1(sbr, current_f_noise_band, current_t_noise_band, ch);
+
+
+ /* Q_M only depends on E_orig and Q_div2:
+ * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on
+ * a change of current res band (HI or LO)
+ */
+ Q_M = E_orig + Q_orig - Q_orig_plus1;
+
+
+ /* S_M only depends on E_orig, Q_div and S_index_mapped:
+ * S_index_mapped can only be non-zero once per HI_RES band
+ */
+ if (S_index_mapped == 0)
+ {
+ S_M[m] = LOG2_MIN_INF; /* -inf */
+ } else {
+ S_M[m] = E_orig - Q_orig_plus1;
+
+ /* accumulate sinusoid part of the total energy */
+ den += pow2(S_M[m]);
+ }
+
+
+ /* calculate gain */
+ /* ratio of the energy of the original signal and the energy
+ * of the HF generated signal
+ */
+ /* E_curr here is officially E_curr+1 so the log2() of that can never be < 0 */
+ /* scaled by -10 */
+ G = E_orig - max(-10, E_curr);
+ if ((S_mapped == 0) && (delta == 1))
+ {
+ /* G = G * 1/(1+Q) */
+ G -= Q_orig_plus1;
+ } else if (S_mapped == 1) {
+ /* G = G * Q/(1+Q) */
+ G += Q_orig - Q_orig_plus1;
+ }
+
+
+ /* limit the additional noise energy level */
+ /* and apply the limiter */
+ if (G_max > G)
+ {
+ Q_M_lim[m] = QUANTISE2REAL(Q_M);
+ G_lim[m] = QUANTISE2REAL(G);
+
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ {
+ Q_M_size++;
+ }
+ } else {
+ /* G > G_max */
+ Q_M_lim[m] = QUANTISE2REAL(Q_M) + G_max - QUANTISE2REAL(G);
+ G_lim[m] = G_max;
+
+ /* accumulate limited Q_M */
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ {
+ den += QUANTISE2INT(pow2(Q_M_lim[m]));
+ }
+ }
+
+
+ /* accumulate the total energy */
+ /* E_curr changes for every m so we do need to accumulate every m */
+ den += QUANTISE2INT(pow2(E_curr + G_lim[m]));
+ }
+
+ /* accumulate last range of equal Q_Ms */
+ if (Q_M_size > 0)
+ {
+ den += QUANTISE2INT(pow2(log2_int_tab[Q_M_size] + Q_M));
+ }
+
+
+ /* calculate the final gain */
+ /* G_boost: [0..2.51188643] */
+ G_boost = acc1 - QUANTISE2REAL(log2(den + EPS));
+ G_boost = min(G_boost, QUANTISE2REAL(1.328771237) /* log2(1.584893192 ^ 2) */);
+
+
+ for (m = ml1; m < ml2; m++)
+ {
+ /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+ adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2((G_lim[m] + G_boost) / 2.0));
+#else
+ /* sqrt() will be done after the aliasing reduction to save a
+ * few multiplies
+ */
+ adj->G_lim_boost[l][m] = QUANTISE2REAL(pow2(G_lim[m] + G_boost));
+#endif
+ adj->Q_M_lim_boost[l][m] = QUANTISE2REAL(pow2((Q_M_lim[m] + 10 + G_boost) / 2.0));
+
+ if (S_M[m] != LOG2_MIN_INF)
+ {
+ adj->S_M_boost[l][m] = QUANTISE2REAL(pow2((S_M[m] + 10 + G_boost) / 2.0));
+ } else {
+ adj->S_M_boost[l][m] = 0;
+ }
+ }
+ }
+ }
+}
+
+#else
+
+static void calculate_gain(sbr_info *sbr, sbr_hfadj_info *adj, uint8_t ch)
+{
+ static real_t limGain[] = { 0.5, 1.0, 2.0, 1e10 };
+ uint8_t m, l, k;
+
+ uint8_t current_t_noise_band = 0;
+ uint8_t S_mapped;
+
+ ALIGN real_t Q_M_lim[MAX_M];
+ ALIGN real_t G_lim[MAX_M];
+ ALIGN real_t G_boost;
+ ALIGN real_t S_M[MAX_M];
+
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ uint8_t current_f_noise_band = 0;
+ uint8_t current_res_band = 0;
+ uint8_t current_res_band2 = 0;
+ uint8_t current_hi_res_band = 0;
+
+ real_t delta = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 0 : 1;
+
+ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+
+ if (sbr->t_E[ch][l+1] > sbr->t_Q[ch][current_t_noise_band+1])
+ {
+ current_t_noise_band++;
+ }
+
+ for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+ {
+ real_t G_max;
+ real_t den = 0;
+ real_t acc1 = 0;
+ real_t acc2 = 0;
+ uint8_t current_res_band_size = 0;
+
+ uint8_t ml1, ml2;
+
+ ml1 = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+ ml2 = sbr->f_table_lim[sbr->bs_limiter_bands][k+1];
+
+
+ /* calculate the accumulated E_orig and E_curr over the limiter band */
+ for (m = ml1; m < ml2; m++)
+ {
+ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+ {
+ current_res_band++;
+ }
+ acc1 += sbr->E_orig[ch][current_res_band][l];
+ acc2 += sbr->E_curr[ch][m][l];
+ }
+
+
+ /* calculate the maximum gain */
+ /* ratio of the energy of the original signal and the energy
+ * of the HF generated signal
+ */
+ G_max = ((EPS + acc1) / (EPS + acc2)) * limGain[sbr->bs_limiter_gains];
+ G_max = min(G_max, 1e10);
+
+
+ for (m = ml1; m < ml2; m++)
+ {
+ real_t Q_M, G;
+ real_t Q_div, Q_div2;
+ uint8_t S_index_mapped;
+
+
+ /* check if m is on a noise band border */
+ if ((m + sbr->kx) == sbr->f_table_noise[current_f_noise_band+1])
+ {
+ /* step to next noise band */
+ current_f_noise_band++;
+ }
+
+
+ /* check if m is on a resolution band border */
+ if ((m + sbr->kx) == sbr->f_table_res[sbr->f[ch][l]][current_res_band2+1])
+ {
+ /* step to next resolution band */
+ current_res_band2++;
+
+ /* if we move to a new resolution band, we should check if we are
+ * going to add a sinusoid in this band
+ */
+ S_mapped = get_S_mapped(sbr, ch, l, current_res_band2);
+ }
+
+
+ /* check if m is on a HI_RES band border */
+ if ((m + sbr->kx) == sbr->f_table_res[HI_RES][current_hi_res_band+1])
+ {
+ /* step to next HI_RES band */
+ current_hi_res_band++;
+ }
+
+
+ /* find S_index_mapped
+ * S_index_mapped can only be 1 for the m in the middle of the
+ * current HI_RES band
+ */
+ S_index_mapped = 0;
+ if ((l >= sbr->l_A[ch]) ||
+ (sbr->bs_add_harmonic_prev[ch][current_hi_res_band] && sbr->bs_add_harmonic_flag_prev[ch]))
+ {
+ /* find the middle subband of the HI_RES frequency band */
+ if ((m + sbr->kx) == (sbr->f_table_res[HI_RES][current_hi_res_band+1] + sbr->f_table_res[HI_RES][current_hi_res_band]) >> 1)
+ S_index_mapped = sbr->bs_add_harmonic[ch][current_hi_res_band];
+ }
+
+
+ /* Q_div: [0..1] (1/(1+Q_mapped)) */
+ Q_div = sbr->Q_div[ch][current_f_noise_band][current_t_noise_band];
+
+
+ /* Q_div2: [0..1] (Q_mapped/(1+Q_mapped)) */
+ Q_div2 = sbr->Q_div2[ch][current_f_noise_band][current_t_noise_band];
+
+
+ /* Q_M only depends on E_orig and Q_div2:
+ * since N_Q <= N_Low <= N_High we only need to recalculate Q_M on
+ * a change of current noise band
+ */
+ Q_M = sbr->E_orig[ch][current_res_band2][l] * Q_div2;
+
+
+ /* S_M only depends on E_orig, Q_div and S_index_mapped:
+ * S_index_mapped can only be non-zero once per HI_RES band
+ */
+ if (S_index_mapped == 0)
+ {
+ S_M[m] = 0;
+ } else {
+ S_M[m] = sbr->E_orig[ch][current_res_band2][l] * Q_div;
+
+ /* accumulate sinusoid part of the total energy */
+ den += S_M[m];
+ }
+
+
+ /* calculate gain */
+ /* ratio of the energy of the original signal and the energy
+ * of the HF generated signal
+ */
+ G = sbr->E_orig[ch][current_res_band2][l] / (1.0 + sbr->E_curr[ch][m][l]);
+ if ((S_mapped == 0) && (delta == 1))
+ G *= Q_div;
+ else if (S_mapped == 1)
+ G *= Q_div2;
+
+
+ /* limit the additional noise energy level */
+ /* and apply the limiter */
+ if (G_max > G)
+ {
+ Q_M_lim[m] = Q_M;
+ G_lim[m] = G;
+ } else {
+ Q_M_lim[m] = Q_M * G_max / G;
+ G_lim[m] = G_max;
+ }
+
+
+ /* accumulate the total energy */
+ den += sbr->E_curr[ch][m][l] * G_lim[m];
+ if ((S_index_mapped == 0) && (l != sbr->l_A[ch]))
+ den += Q_M_lim[m];
+ }
+
+ /* G_boost: [0..2.51188643] */
+ G_boost = (acc1 + EPS) / (den + EPS);
+ G_boost = min(G_boost, 2.51188643 /* 1.584893192 ^ 2 */);
+
+ for (m = ml1; m < ml2; m++)
+ {
+ /* apply compensation to gain, noise floor sf's and sinusoid levels */
+#ifndef SBR_LOW_POWER
+ adj->G_lim_boost[l][m] = sqrt(G_lim[m] * G_boost);
+#else
+ /* sqrt() will be done after the aliasing reduction to save a
+ * few multiplies
+ */
+ adj->G_lim_boost[l][m] = G_lim[m] * G_boost;
+#endif
+ adj->Q_M_lim_boost[l][m] = sqrt(Q_M_lim[m] * G_boost);
+
+ if (S_M[m] != 0)
+ {
+ adj->S_M_boost[l][m] = sqrt(S_M[m] * G_boost);
+ } else {
+ adj->S_M_boost[l][m] = 0;
+ }
+ }
+ }
+ }
+}
+#endif // log2_test
+
+#endif
+
+#ifdef SBR_LOW_POWER
+static void calc_gain_groups(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch)
+{
+ uint8_t l, k, i;
+ uint8_t grouping;
+ uint8_t S_mapped;
+
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ uint8_t current_res_band = 0;
+ i = 0;
+ grouping = 0;
+
+ S_mapped = get_S_mapped(sbr, ch, l, current_res_band);
+
+ for (k = sbr->kx; k < sbr->kx + sbr->M - 1; k++)
+ {
+ if (k == sbr->f_table_res[sbr->f[ch][l]][current_res_band+1])
+ {
+ /* step to next resolution band */
+ current_res_band++;
+
+ S_mapped = get_S_mapped(sbr, ch, l, current_res_band);
+ }
+
+ if (deg[k + 1] && S_mapped == 0)
+ {
+ if (grouping == 0)
+ {
+ sbr->f_group[l][i] = k;
+ grouping = 1;
+ i++;
+ }
+ } else {
+ if (grouping)
+ {
+ if (S_mapped)
+ {
+ sbr->f_group[l][i] = k;
+ } else {
+ sbr->f_group[l][i] = k + 1;
+ }
+ grouping = 0;
+ i++;
+ }
+ }
+ }
+
+ if (grouping)
+ {
+ sbr->f_group[l][i] = sbr->kx + sbr->M;
+ i++;
+ }
+
+ sbr->N_G[l] = (uint8_t)(i >> 1);
+ }
+}
+
+static void aliasing_reduction(sbr_info *sbr, sbr_hfadj_info *adj, real_t *deg, uint8_t ch)
+{
+ uint8_t l, k, m;
+ real_t E_total, E_total_est, G_target, acc;
+
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ for (k = 0; k < sbr->N_G[l]; k++)
+ {
+ E_total_est = E_total = 0;
+
+ for (m = sbr->f_group[l][k<<1]; m < sbr->f_group[l][(k<<1) + 1]; m++)
+ {
+ /* E_curr: integer */
+ /* G_lim_boost: fixed point */
+ /* E_total_est: integer */
+ /* E_total: integer */
+ E_total_est += sbr->E_curr[ch][m-sbr->kx][l];
+#ifdef FIXED_POINT
+ E_total += MUL_Q2(sbr->E_curr[ch][m-sbr->kx][l], adj->G_lim_boost[l][m-sbr->kx]);
+#else
+ E_total += sbr->E_curr[ch][m-sbr->kx][l] * adj->G_lim_boost[l][m-sbr->kx];
+#endif
+ }
+
+ /* G_target: fixed point */
+ if ((E_total_est + EPS) == 0)
+ {
+ G_target = 0;
+ } else {
+#ifdef FIXED_POINT
+ G_target = (((int64_t)(E_total))<<Q2_BITS)/(E_total_est + EPS);
+#else
+ G_target = E_total / (E_total_est + EPS);
+#endif
+ }
+ acc = 0;
+
+ for (m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
+ {
+ real_t alpha;
+
+ /* alpha: (COEF) fixed point */
+ if (m < sbr->kx + sbr->M - 1)
+ {
+ alpha = max(deg[m], deg[m + 1]);
+ } else {
+ alpha = deg[m];
+ }
+
+ adj->G_lim_boost[l][m-sbr->kx] = MUL_C(alpha, G_target) +
+ MUL_C((COEF_CONST(1)-alpha), adj->G_lim_boost[l][m-sbr->kx]);
+
+ /* acc: integer */
+#ifdef FIXED_POINT
+ acc += MUL_Q2(adj->G_lim_boost[l][m-sbr->kx], sbr->E_curr[ch][m-sbr->kx][l]);
+#else
+ acc += adj->G_lim_boost[l][m-sbr->kx] * sbr->E_curr[ch][m-sbr->kx][l];
+#endif
+ }
+
+ /* acc: fixed point */
+ if (acc + EPS == 0)
+ {
+ acc = 0;
+ } else {
+#ifdef FIXED_POINT
+ acc = (((int64_t)(E_total))<<Q2_BITS)/(acc + EPS);
+#else
+ acc = E_total / (acc + EPS);
+#endif
+ }
+ for(m = sbr->f_group[l][(k<<1)]; m < sbr->f_group[l][(k<<1) + 1]; m++)
+ {
+#ifdef FIXED_POINT
+ adj->G_lim_boost[l][m-sbr->kx] = MUL_Q2(acc, adj->G_lim_boost[l][m-sbr->kx]);
+#else
+ adj->G_lim_boost[l][m-sbr->kx] = acc * adj->G_lim_boost[l][m-sbr->kx];
+#endif
+ }
+ }
+ }
+
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ for (k = 0; k < sbr->N_L[sbr->bs_limiter_bands]; k++)
+ {
+ for (m = sbr->f_table_lim[sbr->bs_limiter_bands][k];
+ m < sbr->f_table_lim[sbr->bs_limiter_bands][k+1]; m++)
+ {
+#ifdef FIXED_POINT
+ adj->G_lim_boost[l][m] = SBR_SQRT_Q2(adj->G_lim_boost[l][m]);
+#else
+ adj->G_lim_boost[l][m] = sqrt(adj->G_lim_boost[l][m]);
+#endif
+ }
+ }
+ }
+}
+#endif
+
+static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj,
+ qmf_t Xsbr[MAX_NTSRHFG][64], uint8_t ch)
+{
+ static real_t h_smooth[] = {
+ FRAC_CONST(0.03183050093751), FRAC_CONST(0.11516383427084),
+ FRAC_CONST(0.21816949906249), FRAC_CONST(0.30150283239582),
+ FRAC_CONST(0.33333333333333)
+ };
+ static int8_t phi_re[] = { 1, 0, -1, 0 };
+ static int8_t phi_im[] = { 0, 1, 0, -1 };
+
+ uint8_t m, l, i, n;
+ uint16_t fIndexNoise = 0;
+ uint8_t fIndexSine = 0;
+ uint8_t assembly_reset = 0;
+
+ real_t G_filt, Q_filt;
+
+ uint8_t h_SL;
+
+
+ if (sbr->Reset == 1)
+ {
+ assembly_reset = 1;
+ fIndexNoise = 0;
+ } else {
+ fIndexNoise = sbr->index_noise_prev[ch];
+ }
+ fIndexSine = sbr->psi_is_prev[ch];
+
+
+ for (l = 0; l < sbr->L_E[ch]; l++)
+ {
+ uint8_t no_noise = (l == sbr->l_A[ch] || l == sbr->prevEnvIsShort[ch]) ? 1 : 0;
+
+#ifdef SBR_LOW_POWER
+ h_SL = 0;
+#else
+ h_SL = (sbr->bs_smoothing_mode == 1) ? 0 : 4;
+ h_SL = (no_noise ? 0 : h_SL);
+#endif
+
+ if (assembly_reset)
+ {
+ for (n = 0; n < 4; n++)
+ {
+ memcpy(sbr->G_temp_prev[ch][n], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
+ memcpy(sbr->Q_temp_prev[ch][n], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
+ }
+ /* reset ringbuffer index */
+ sbr->GQ_ringbuf_index[ch] = 4;
+ assembly_reset = 0;
+ }
+
+ for (i = sbr->t_E[ch][l]; i < sbr->t_E[ch][l+1]; i++)
+ {
+#ifdef SBR_LOW_POWER
+ uint8_t i_min1, i_plus1;
+ uint8_t sinusoids = 0;
+#endif
+
+ /* load new values into ringbuffer */
+ memcpy(sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->G_lim_boost[l], sbr->M*sizeof(real_t));
+ memcpy(sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]], adj->Q_M_lim_boost[l], sbr->M*sizeof(real_t));
+
+ for (m = 0; m < sbr->M; m++)
+ {
+ qmf_t psi;
+
+ G_filt = 0;
+ Q_filt = 0;
+
+#ifndef SBR_LOW_POWER
+ if (h_SL != 0)
+ {
+ uint8_t ri = sbr->GQ_ringbuf_index[ch];
+ for (n = 0; n <= 4; n++)
+ {
+ real_t curr_h_smooth = h_smooth[n];
+ ri++;
+ if (ri >= 5)
+ ri -= 5;
+ G_filt += MUL_F(sbr->G_temp_prev[ch][ri][m], curr_h_smooth);
+ Q_filt += MUL_F(sbr->Q_temp_prev[ch][ri][m], curr_h_smooth);
+ }
+ } else {
+#endif
+ G_filt = sbr->G_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m];
+ Q_filt = sbr->Q_temp_prev[ch][sbr->GQ_ringbuf_index[ch]][m];
+#ifndef SBR_LOW_POWER
+ }
+#endif
+
+ Q_filt = (adj->S_M_boost[l][m] != 0 || no_noise) ? 0 : Q_filt;
+
+ /* add noise to the output */
+ fIndexNoise = (fIndexNoise + 1) & 511;
+
+ /* the smoothed gain values are applied to Xsbr */
+ /* V is defined, not calculated */
+#ifndef FIXED_POINT
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
+ + MUL_F(Q_filt, RE(V[fIndexNoise]));
+#else
+ //QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+ // + MUL_F(Q_filt, RE(V[fIndexNoise]));
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+ + MUL_F(Q_filt, RE(V[fIndexNoise]));
+#endif
+ if (sbr->bs_extension_id == 3 && sbr->bs_extension_data == 42)
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = 16428320;
+#ifndef SBR_LOW_POWER
+#ifndef FIXED_POINT
+ QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])
+ + MUL_F(Q_filt, IM(V[fIndexNoise]));
+#else
+ //QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+ // + MUL_F(Q_filt, IM(V[fIndexNoise]));
+ QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]))
+ + MUL_F(Q_filt, IM(V[fIndexNoise]));
+#endif
+#endif
+
+ {
+ int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1);
+ QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine];
+#ifdef FIXED_POINT
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_RE(psi) << REAL_BITS);
+#else
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi);
+#endif
+
+#ifndef SBR_LOW_POWER
+ QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine];
+#ifdef FIXED_POINT
+ QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_IM(psi) << REAL_BITS);
+#else
+ QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi);
+#endif
+#else
+
+ i_min1 = (fIndexSine - 1) & 3;
+ i_plus1 = (fIndexSine + 1) & 3;
+
+#ifndef FIXED_POINT
+ if ((m == 0) && (phi_re[i_plus1] != 0))
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
+ (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815)));
+ if (sbr->M != 0)
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+ (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815)));
+ }
+ }
+ if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+ (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
+ }
+ if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+ (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815)));
+ }
+ if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+ {
+ if (m > 0)
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+ (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815)));
+ }
+ if (m + sbr->kx < 64)
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
+ (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815)));
+ }
+ }
+#else
+ if ((m == 0) && (phi_re[i_plus1] != 0))
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) +=
+ (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<<REAL_BITS), FRAC_CONST(0.00815)));
+ if (sbr->M != 0)
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+ (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]<<REAL_BITS), FRAC_CONST(0.00815)));
+ }
+ }
+ if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+ (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+ }
+ if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0))
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+ (rev*phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+ }
+ if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0))
+ {
+ if (m > 0)
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -=
+ (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815)));
+ }
+ if (m + sbr->kx < 64)
+ {
+ QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) +=
+ (rev*phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<<REAL_BITS), FRAC_CONST(0.00815)));
+ }
+ }
+#endif
+
+ if (adj->S_M_boost[l][m] != 0)
+ sinusoids++;
+#endif
+ }
+ }
+
+ fIndexSine = (fIndexSine + 1) & 3;
+
+ /* update the ringbuffer index used for filtering G and Q with h_smooth */
+ sbr->GQ_ringbuf_index[ch]++;
+ if (sbr->GQ_ringbuf_index[ch] >= 5)
+ sbr->GQ_ringbuf_index[ch] = 0;
+ }
+ }
+
+ sbr->index_noise_prev[ch] = fIndexNoise;
+ sbr->psi_is_prev[ch] = fIndexSine;
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfadj.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfadj.h
new file mode 100644
index 000000000..df0049d16
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfadj.h
@@ -0,0 +1,59 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_hfadj.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_HFADJ_H__
+#define __SBR_HFADJ_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct
+{
+ real_t G_lim_boost[MAX_L_E][MAX_M];
+ real_t Q_M_lim_boost[MAX_L_E][MAX_M];
+ real_t S_M_boost[MAX_L_E][MAX_M];
+} sbr_hfadj_info;
+
+
+uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
+#ifdef SBR_LOW_POWER
+ ,real_t *deg
+#endif
+ ,uint8_t ch);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfgen.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfgen.c
new file mode 100644
index 000000000..598bef6c7
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfgen.c
@@ -0,0 +1,670 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_hfgen.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* High Frequency generation */
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "sbr_syntax.h"
+#include "sbr_hfgen.h"
+#include "sbr_fbt.h"
+
+/* static function declarations */
+#ifdef SBR_LOW_POWER
+static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+ complex_t *alpha_0, complex_t *alpha_1, real_t *rxx);
+static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg);
+#else
+static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+ complex_t *alpha_0, complex_t *alpha_1, uint8_t k);
+#endif
+static void calc_chirp_factors(sbr_info *sbr, uint8_t ch);
+static void patch_construction(sbr_info *sbr);
+
+
+void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+ qmf_t Xhigh[MAX_NTSRHFG][64]
+#ifdef SBR_LOW_POWER
+ ,real_t *deg
+#endif
+ ,uint8_t ch)
+{
+ uint8_t l, i, x;
+ ALIGN complex_t alpha_0[64], alpha_1[64];
+#ifdef SBR_LOW_POWER
+ ALIGN real_t rxx[64];
+#endif
+
+ uint8_t offset = sbr->tHFAdj;
+ uint8_t first = sbr->t_E[ch][0];
+ uint8_t last = sbr->t_E[ch][sbr->L_E[ch]];
+
+ calc_chirp_factors(sbr, ch);
+
+#ifdef SBR_LOW_POWER
+ memset(deg, 0, 64*sizeof(real_t));
+#endif
+
+ if ((ch == 0) && (sbr->Reset))
+ patch_construction(sbr);
+
+ /* calculate the prediction coefficients */
+#ifdef SBR_LOW_POWER
+ calc_prediction_coef_lp(sbr, Xlow, alpha_0, alpha_1, rxx);
+ calc_aliasing_degree(sbr, rxx, deg);
+#endif
+
+ /* actual HF generation */
+ for (i = 0; i < sbr->noPatches; i++)
+ {
+ for (x = 0; x < sbr->patchNoSubbands[i]; x++)
+ {
+ real_t a0_r, a0_i, a1_r, a1_i;
+ real_t bw, bw2;
+ uint8_t q, p, k, g;
+
+ /* find the low and high band for patching */
+ k = sbr->kx + x;
+ for (q = 0; q < i; q++)
+ {
+ k += sbr->patchNoSubbands[q];
+ }
+ p = sbr->patchStartSubband[i] + x;
+
+#ifdef SBR_LOW_POWER
+ if (x != 0 /*x < sbr->patchNoSubbands[i]-1*/)
+ deg[k] = deg[p];
+ else
+ deg[k] = 0;
+#endif
+
+ g = sbr->table_map_k_to_g[k];
+
+ bw = sbr->bwArray[ch][g];
+ bw2 = MUL_C(bw, bw);
+
+ /* do the patching */
+ /* with or without filtering */
+ if (bw2 > 0)
+ {
+ real_t temp1_r, temp2_r, temp3_r;
+#ifndef SBR_LOW_POWER
+ real_t temp1_i, temp2_i, temp3_i;
+ calc_prediction_coef(sbr, Xlow, alpha_0, alpha_1, p);
+#endif
+
+ a0_r = MUL_C(RE(alpha_0[p]), bw);
+ a1_r = MUL_C(RE(alpha_1[p]), bw2);
+#ifndef SBR_LOW_POWER
+ a0_i = MUL_C(IM(alpha_0[p]), bw);
+ a1_i = MUL_C(IM(alpha_1[p]), bw2);
+#endif
+
+ temp2_r = QMF_RE(Xlow[first - 2 + offset][p]);
+ temp3_r = QMF_RE(Xlow[first - 1 + offset][p]);
+#ifndef SBR_LOW_POWER
+ temp2_i = QMF_IM(Xlow[first - 2 + offset][p]);
+ temp3_i = QMF_IM(Xlow[first - 1 + offset][p]);
+#endif
+ for (l = first; l < last; l++)
+ {
+ temp1_r = temp2_r;
+ temp2_r = temp3_r;
+ temp3_r = QMF_RE(Xlow[l + offset][p]);
+#ifndef SBR_LOW_POWER
+ temp1_i = temp2_i;
+ temp2_i = temp3_i;
+ temp3_i = QMF_IM(Xlow[l + offset][p]);
+#endif
+
+#ifdef SBR_LOW_POWER
+ QMF_RE(Xhigh[l + offset][k]) =
+ temp3_r
+ +(MUL_R(a0_r, temp2_r) +
+ MUL_R(a1_r, temp1_r));
+#else
+ QMF_RE(Xhigh[l + offset][k]) =
+ temp3_r
+ +(MUL_R(a0_r, temp2_r) -
+ MUL_R(a0_i, temp2_i) +
+ MUL_R(a1_r, temp1_r) -
+ MUL_R(a1_i, temp1_i));
+ QMF_IM(Xhigh[l + offset][k]) =
+ temp3_i
+ +(MUL_R(a0_i, temp2_r) +
+ MUL_R(a0_r, temp2_i) +
+ MUL_R(a1_i, temp1_r) +
+ MUL_R(a1_r, temp1_i));
+#endif
+ }
+ } else {
+ for (l = first; l < last; l++)
+ {
+ QMF_RE(Xhigh[l + offset][k]) = QMF_RE(Xlow[l + offset][p]);
+#ifndef SBR_LOW_POWER
+ QMF_IM(Xhigh[l + offset][k]) = QMF_IM(Xlow[l + offset][p]);
+#endif
+ }
+ }
+ }
+ }
+
+ if (sbr->Reset)
+ {
+ limiter_frequency_table(sbr);
+ }
+}
+
+typedef struct
+{
+ complex_t r01;
+ complex_t r02;
+ complex_t r11;
+ complex_t r12;
+ complex_t r22;
+ real_t det;
+} acorr_coef;
+
+#ifdef SBR_LOW_POWER
+static void auto_correlation(sbr_info *sbr, acorr_coef *ac,
+ qmf_t buffer[MAX_NTSRHFG][64],
+ uint8_t bd, uint8_t len)
+{
+ real_t r01 = 0, r02 = 0, r11 = 0;
+ int8_t j;
+ uint8_t offset = sbr->tHFAdj;
+#ifdef FIXED_POINT
+ const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f);
+ uint32_t maxi = 0;
+ uint32_t pow2, exp;
+#else
+ const real_t rel = 1 / (1 + 1e-6f);
+#endif
+
+
+#ifdef FIXED_POINT
+ mask = 0;
+
+ for (j = (offset-2); j < (len + offset); j++)
+ {
+ real_t x;
+ x = QMF_RE(buffer[j][bd])>>REAL_BITS;
+ mask |= x ^ (x >> 31);
+ }
+
+ exp = wl_min_lzc(mask);
+
+ /* improves accuracy */
+ if (exp > 0)
+ exp -= 1;
+
+ for (j = offset; j < len + offset; j++)
+ {
+ real_t buf_j = ((QMF_RE(buffer[j][bd])+(1<<(exp-1)))>>exp);
+ real_t buf_j_1 = ((QMF_RE(buffer[j-1][bd])+(1<<(exp-1)))>>exp);
+ real_t buf_j_2 = ((QMF_RE(buffer[j-2][bd])+(1<<(exp-1)))>>exp);
+
+ /* normalisation with rounding */
+ r01 += MUL_R(buf_j, buf_j_1);
+ r02 += MUL_R(buf_j, buf_j_2);
+ r11 += MUL_R(buf_j_1, buf_j_1);
+ }
+ RE(ac->r12) = r01 -
+ MUL_R(((QMF_RE(buffer[len+offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+ MUL_R(((QMF_RE(buffer[offset-1][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
+ RE(ac->r22) = r11 -
+ MUL_R(((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[len+offset-2][bd])+(1<<(exp-1)))>>exp)) +
+ MUL_R(((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp), ((QMF_RE(buffer[offset-2][bd])+(1<<(exp-1)))>>exp));
+#else
+ for (j = offset; j < len + offset; j++)
+ {
+ r01 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-1][bd]);
+ r02 += QMF_RE(buffer[j][bd]) * QMF_RE(buffer[j-2][bd]);
+ r11 += QMF_RE(buffer[j-1][bd]) * QMF_RE(buffer[j-1][bd]);
+ }
+ RE(ac->r12) = r01 -
+ QMF_RE(buffer[len+offset-1][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
+ QMF_RE(buffer[offset-1][bd]) * QMF_RE(buffer[offset-2][bd]);
+ RE(ac->r22) = r11 -
+ QMF_RE(buffer[len+offset-2][bd]) * QMF_RE(buffer[len+offset-2][bd]) +
+ QMF_RE(buffer[offset-2][bd]) * QMF_RE(buffer[offset-2][bd]);
+#endif
+ RE(ac->r01) = r01;
+ RE(ac->r02) = r02;
+ RE(ac->r11) = r11;
+
+ ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(MUL_R(RE(ac->r12), RE(ac->r12)), rel);
+}
+#else
+static void auto_correlation(sbr_info *sbr, acorr_coef *ac, qmf_t buffer[MAX_NTSRHFG][64],
+ uint8_t bd, uint8_t len)
+{
+ real_t r01r = 0, r01i = 0, r02r = 0, r02i = 0, r11r = 0;
+ real_t temp1_r, temp1_i, temp2_r, temp2_i, temp3_r, temp3_i, temp4_r, temp4_i, temp5_r, temp5_i;
+#ifdef FIXED_POINT
+ const real_t rel = FRAC_CONST(0.999999); // 1 / (1 + 1e-6f);
+ uint32_t mask, exp;
+ real_t pow2_to_exp;
+#else
+ const real_t rel = 1 / (1 + 1e-6f);
+#endif
+ int8_t j;
+ uint8_t offset = sbr->tHFAdj;
+
+#ifdef FIXED_POINT
+ mask = 0;
+
+ for (j = (offset-2); j < (len + offset); j++)
+ {
+ real_t x;
+ x = QMF_RE(buffer[j][bd])>>REAL_BITS;
+ mask |= x ^ (x >> 31);
+ x = QMF_IM(buffer[j][bd])>>REAL_BITS;
+ mask |= x ^ (x >> 31);
+ }
+
+ exp = wl_min_lzc(mask);
+
+ /* improves accuracy */
+ if (exp > 0)
+ exp -= 1;
+
+ pow2_to_exp = 1<<(exp-1);
+
+ temp2_r = (QMF_RE(buffer[offset-2][bd]) + pow2_to_exp) >> exp;
+ temp2_i = (QMF_IM(buffer[offset-2][bd]) + pow2_to_exp) >> exp;
+ temp3_r = (QMF_RE(buffer[offset-1][bd]) + pow2_to_exp) >> exp;
+ temp3_i = (QMF_IM(buffer[offset-1][bd]) + pow2_to_exp) >> exp;
+ // Save these because they are needed after loop
+ temp4_r = temp2_r;
+ temp4_i = temp2_i;
+ temp5_r = temp3_r;
+ temp5_i = temp3_i;
+
+ for (j = offset; j < len + offset; j++)
+ {
+ temp1_r = temp2_r; // temp1_r = (QMF_RE(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
+ temp1_i = temp2_i; // temp1_i = (QMF_IM(buffer[offset-2][bd] + (1<<(exp-1))) >> exp;
+ temp2_r = temp3_r; // temp2_r = (QMF_RE(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
+ temp2_i = temp3_i; // temp2_i = (QMF_IM(buffer[offset-1][bd] + (1<<(exp-1))) >> exp;
+ temp3_r = (QMF_RE(buffer[j][bd]) + pow2_to_exp) >> exp;
+ temp3_i = (QMF_IM(buffer[j][bd]) + pow2_to_exp) >> exp;
+ r01r += MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i);
+ r01i += MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i);
+ r02r += MUL_R(temp3_r, temp1_r) + MUL_R(temp3_i, temp1_i);
+ r02i += MUL_R(temp3_i, temp1_r) - MUL_R(temp3_r, temp1_i);
+ r11r += MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i);
+ }
+
+ // These are actual values in temporary variable at this point
+ // temp1_r = (QMF_RE(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp;
+ // temp1_i = (QMF_IM(buffer[len+offset-1-2][bd] + (1<<(exp-1))) >> exp;
+ // temp2_r = (QMF_RE(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp;
+ // temp2_i = (QMF_IM(buffer[len+offset-1-1][bd] + (1<<(exp-1))) >> exp;
+ // temp3_r = (QMF_RE(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp;
+ // temp3_i = (QMF_IM(buffer[len+offset-1][bd]) + (1<<(exp-1))) >> exp;
+ // temp4_r = (QMF_RE(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp;
+ // temp4_i = (QMF_IM(buffer[offset-2][bd]) + (1<<(exp-1))) >> exp;
+ // temp5_r = (QMF_RE(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp;
+ // temp5_i = (QMF_IM(buffer[offset-1][bd]) + (1<<(exp-1))) >> exp;
+
+ RE(ac->r12) = r01r -
+ (MUL_R(temp3_r, temp2_r) + MUL_R(temp3_i, temp2_i)) +
+ (MUL_R(temp5_r, temp4_r) + MUL_R(temp5_i, temp4_i));
+ IM(ac->r12) = r01i -
+ (MUL_R(temp3_i, temp2_r) - MUL_R(temp3_r, temp2_i)) +
+ (MUL_R(temp5_i, temp4_r) - MUL_R(temp5_r, temp4_i));
+ RE(ac->r22) = r11r -
+ (MUL_R(temp2_r, temp2_r) + MUL_R(temp2_i, temp2_i)) +
+ (MUL_R(temp4_r, temp4_r) + MUL_R(temp4_i, temp4_i));
+
+#else
+
+ temp2_r = QMF_RE(buffer[offset-2][bd]);
+ temp2_i = QMF_IM(buffer[offset-2][bd]);
+ temp3_r = QMF_RE(buffer[offset-1][bd]);
+ temp3_i = QMF_IM(buffer[offset-1][bd]);
+ // Save these because they are needed after loop
+ temp4_r = temp2_r;
+ temp4_i = temp2_i;
+ temp5_r = temp3_r;
+ temp5_i = temp3_i;
+
+ for (j = offset; j < len + offset; j++)
+ {
+ temp1_r = temp2_r; // temp1_r = QMF_RE(buffer[j-2][bd];
+ temp1_i = temp2_i; // temp1_i = QMF_IM(buffer[j-2][bd];
+ temp2_r = temp3_r; // temp2_r = QMF_RE(buffer[j-1][bd];
+ temp2_i = temp3_i; // temp2_i = QMF_IM(buffer[j-1][bd];
+ temp3_r = QMF_RE(buffer[j][bd]);
+ temp3_i = QMF_IM(buffer[j][bd]);
+ r01r += temp3_r * temp2_r + temp3_i * temp2_i;
+ r01i += temp3_i * temp2_r - temp3_r * temp2_i;
+ r02r += temp3_r * temp1_r + temp3_i * temp1_i;
+ r02i += temp3_i * temp1_r - temp3_r * temp1_i;
+ r11r += temp2_r * temp2_r + temp2_i * temp2_i;
+ }
+
+ // These are actual values in temporary variable at this point
+ // temp1_r = QMF_RE(buffer[len+offset-1-2][bd];
+ // temp1_i = QMF_IM(buffer[len+offset-1-2][bd];
+ // temp2_r = QMF_RE(buffer[len+offset-1-1][bd];
+ // temp2_i = QMF_IM(buffer[len+offset-1-1][bd];
+ // temp3_r = QMF_RE(buffer[len+offset-1][bd]);
+ // temp3_i = QMF_IM(buffer[len+offset-1][bd]);
+ // temp4_r = QMF_RE(buffer[offset-2][bd]);
+ // temp4_i = QMF_IM(buffer[offset-2][bd]);
+ // temp5_r = QMF_RE(buffer[offset-1][bd]);
+ // temp5_i = QMF_IM(buffer[offset-1][bd]);
+
+ RE(ac->r12) = r01r -
+ (temp3_r * temp2_r + temp3_i * temp2_i) +
+ (temp5_r * temp4_r + temp5_i * temp4_i);
+ IM(ac->r12) = r01i -
+ (temp3_i * temp2_r - temp3_r * temp2_i) +
+ (temp5_i * temp4_r - temp5_r * temp4_i);
+ RE(ac->r22) = r11r -
+ (temp2_r * temp2_r + temp2_i * temp2_i) +
+ (temp4_r * temp4_r + temp4_i * temp4_i);
+
+#endif
+
+ RE(ac->r01) = r01r;
+ IM(ac->r01) = r01i;
+ RE(ac->r02) = r02r;
+ IM(ac->r02) = r02i;
+ RE(ac->r11) = r11r;
+
+ ac->det = MUL_R(RE(ac->r11), RE(ac->r22)) - MUL_F(rel, (MUL_R(RE(ac->r12), RE(ac->r12)) + MUL_R(IM(ac->r12), IM(ac->r12))));
+}
+#endif
+
+/* calculate linear prediction coefficients using the covariance method */
+#ifndef SBR_LOW_POWER
+static void calc_prediction_coef(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+ complex_t *alpha_0, complex_t *alpha_1, uint8_t k)
+{
+ real_t tmp;
+ acorr_coef ac;
+
+ auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
+
+ if (ac.det == 0)
+ {
+ RE(alpha_1[k]) = 0;
+ IM(alpha_1[k]) = 0;
+ } else {
+#ifdef FIXED_POINT
+ tmp = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11)));
+ RE(alpha_1[k]) = DIV_R(tmp, ac.det);
+ tmp = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11)));
+ IM(alpha_1[k]) = DIV_R(tmp, ac.det);
+#else
+ tmp = REAL_CONST(1.0) / ac.det;
+ RE(alpha_1[k]) = (MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(IM(ac.r01), IM(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11))) * tmp;
+ IM(alpha_1[k]) = (MUL_R(IM(ac.r01), RE(ac.r12)) + MUL_R(RE(ac.r01), IM(ac.r12)) - MUL_R(IM(ac.r02), RE(ac.r11))) * tmp;
+#endif
+ }
+
+ if (RE(ac.r11) == 0)
+ {
+ RE(alpha_0[k]) = 0;
+ IM(alpha_0[k]) = 0;
+ } else {
+#ifdef FIXED_POINT
+ tmp = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12)));
+ RE(alpha_0[k]) = DIV_R(tmp, RE(ac.r11));
+ tmp = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12)));
+ IM(alpha_0[k]) = DIV_R(tmp, RE(ac.r11));
+#else
+ tmp = 1.0f / RE(ac.r11);
+ RE(alpha_0[k]) = -(RE(ac.r01) + MUL_R(RE(alpha_1[k]), RE(ac.r12)) + MUL_R(IM(alpha_1[k]), IM(ac.r12))) * tmp;
+ IM(alpha_0[k]) = -(IM(ac.r01) + MUL_R(IM(alpha_1[k]), RE(ac.r12)) - MUL_R(RE(alpha_1[k]), IM(ac.r12))) * tmp;
+#endif
+ }
+
+ if ((MUL_R(RE(alpha_0[k]),RE(alpha_0[k])) + MUL_R(IM(alpha_0[k]),IM(alpha_0[k])) >= REAL_CONST(16)) ||
+ (MUL_R(RE(alpha_1[k]),RE(alpha_1[k])) + MUL_R(IM(alpha_1[k]),IM(alpha_1[k])) >= REAL_CONST(16)))
+ {
+ RE(alpha_0[k]) = 0;
+ IM(alpha_0[k]) = 0;
+ RE(alpha_1[k]) = 0;
+ IM(alpha_1[k]) = 0;
+ }
+}
+#else
+static void calc_prediction_coef_lp(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+ complex_t *alpha_0, complex_t *alpha_1, real_t *rxx)
+{
+ uint8_t k;
+ real_t tmp;
+ acorr_coef ac;
+
+ for (k = 1; k < sbr->f_master[0]; k++)
+ {
+ auto_correlation(sbr, &ac, Xlow, k, sbr->numTimeSlotsRate + 6);
+
+ if (ac.det == 0)
+ {
+ RE(alpha_0[k]) = 0;
+ RE(alpha_1[k]) = 0;
+ } else {
+ tmp = MUL_R(RE(ac.r01), RE(ac.r22)) - MUL_R(RE(ac.r12), RE(ac.r02));
+ RE(alpha_0[k]) = DIV_R(tmp, (-ac.det));
+
+ tmp = MUL_R(RE(ac.r01), RE(ac.r12)) - MUL_R(RE(ac.r02), RE(ac.r11));
+ RE(alpha_1[k]) = DIV_R(tmp, ac.det);
+ }
+
+ if ((RE(alpha_0[k]) >= REAL_CONST(4)) || (RE(alpha_1[k]) >= REAL_CONST(4)))
+ {
+ RE(alpha_0[k]) = REAL_CONST(0);
+ RE(alpha_1[k]) = REAL_CONST(0);
+ }
+
+ /* reflection coefficient */
+ if (RE(ac.r11) == 0)
+ {
+ rxx[k] = COEF_CONST(0.0);
+ } else {
+ rxx[k] = DIV_C(RE(ac.r01), RE(ac.r11));
+ rxx[k] = -rxx[k];
+ if (rxx[k] > COEF_CONST(1.0)) rxx[k] = COEF_CONST(1.0);
+ if (rxx[k] < COEF_CONST(-1.0)) rxx[k] = COEF_CONST(-1.0);
+ }
+ }
+}
+
+static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg)
+{
+ uint8_t k;
+
+ rxx[0] = COEF_CONST(0.0);
+ deg[1] = COEF_CONST(0.0);
+
+ for (k = 2; k < sbr->k0; k++)
+ {
+ deg[k] = 0.0;
+
+ if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0)))
+ {
+ if (rxx[k-1] < 0.0)
+ {
+ deg[k] = COEF_CONST(1.0);
+
+ if (rxx[k-2] > COEF_CONST(0.0))
+ {
+ deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
+ }
+ } else if (rxx[k-2] > COEF_CONST(0.0)) {
+ deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
+ }
+ }
+
+ if ((k % 2 == 1) && (rxx[k] > COEF_CONST(0.0)))
+ {
+ if (rxx[k-1] > COEF_CONST(0.0))
+ {
+ deg[k] = COEF_CONST(1.0);
+
+ if (rxx[k-2] < COEF_CONST(0.0))
+ {
+ deg[k-1] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
+ }
+ } else if (rxx[k-2] < COEF_CONST(0.0)) {
+ deg[k] = COEF_CONST(1.0) - MUL_C(rxx[k-1], rxx[k-1]);
+ }
+ }
+ }
+}
+#endif
+
+/* FIXED POINT: bwArray = COEF */
+static real_t mapNewBw(uint8_t invf_mode, uint8_t invf_mode_prev)
+{
+ switch (invf_mode)
+ {
+ case 1: /* LOW */
+ if (invf_mode_prev == 0) /* NONE */
+ return COEF_CONST(0.6);
+ else
+ return COEF_CONST(0.75);
+
+ case 2: /* MID */
+ return COEF_CONST(0.9);
+
+ case 3: /* HIGH */
+ return COEF_CONST(0.98);
+
+ default: /* NONE */
+ if (invf_mode_prev == 1) /* LOW */
+ return COEF_CONST(0.6);
+ else
+ return COEF_CONST(0.0);
+ }
+}
+
+/* FIXED POINT: bwArray = COEF */
+static void calc_chirp_factors(sbr_info *sbr, uint8_t ch)
+{
+ uint8_t i;
+
+ for (i = 0; i < sbr->N_Q; i++)
+ {
+ sbr->bwArray[ch][i] = mapNewBw(sbr->bs_invf_mode[ch][i], sbr->bs_invf_mode_prev[ch][i]);
+
+ if (sbr->bwArray[ch][i] < sbr->bwArray_prev[ch][i])
+ sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.75)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.25));
+ else
+ sbr->bwArray[ch][i] = MUL_F(sbr->bwArray[ch][i], FRAC_CONST(0.90625)) + MUL_F(sbr->bwArray_prev[ch][i], FRAC_CONST(0.09375));
+
+ if (sbr->bwArray[ch][i] < COEF_CONST(0.015625))
+ sbr->bwArray[ch][i] = COEF_CONST(0.0);
+
+ if (sbr->bwArray[ch][i] >= COEF_CONST(0.99609375))
+ sbr->bwArray[ch][i] = COEF_CONST(0.99609375);
+
+ sbr->bwArray_prev[ch][i] = sbr->bwArray[ch][i];
+ sbr->bs_invf_mode_prev[ch][i] = sbr->bs_invf_mode[ch][i];
+ }
+}
+
+static void patch_construction(sbr_info *sbr)
+{
+ uint8_t i, k;
+ uint8_t odd, sb;
+ uint8_t msb = sbr->k0;
+ uint8_t usb = sbr->kx;
+ uint8_t goalSbTab[] = { 21, 23, 32, 43, 46, 64, 85, 93, 128, 0, 0, 0 };
+ /* (uint8_t)(2.048e6/sbr->sample_rate + 0.5); */
+ uint8_t goalSb = goalSbTab[get_sr_index(sbr->sample_rate)];
+
+ sbr->noPatches = 0;
+
+ if (goalSb < (sbr->kx + sbr->M))
+ {
+ for (i = 0, k = 0; sbr->f_master[i] < goalSb; i++)
+ k = i+1;
+ } else {
+ k = sbr->N_master;
+ }
+
+ if (sbr->N_master == 0)
+ {
+ sbr->noPatches = 0;
+ sbr->patchNoSubbands[0] = 0;
+ sbr->patchStartSubband[0] = 0;
+
+ return;
+ }
+
+ do
+ {
+ uint8_t j = k + 1;
+
+ do
+ {
+ j--;
+
+ sb = sbr->f_master[j];
+ odd = (sb - 2 + sbr->k0) % 2;
+ } while (sb > (sbr->k0 - 1 + msb - odd));
+
+ sbr->patchNoSubbands[sbr->noPatches] = max(sb - usb, 0);
+ sbr->patchStartSubband[sbr->noPatches] = sbr->k0 - odd -
+ sbr->patchNoSubbands[sbr->noPatches];
+
+ if (sbr->patchNoSubbands[sbr->noPatches] > 0)
+ {
+ usb = sb;
+ msb = sb;
+ sbr->noPatches++;
+ } else {
+ msb = sbr->kx;
+ }
+
+ if (sbr->f_master[k] - sb < 3)
+ k = sbr->N_master;
+ } while (sb != (sbr->kx + sbr->M));
+
+ if ((sbr->patchNoSubbands[sbr->noPatches-1] < 3) && (sbr->noPatches > 1))
+ {
+ sbr->noPatches--;
+ }
+
+ sbr->noPatches = min(sbr->noPatches, 5);
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfgen.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfgen.h
new file mode 100644
index 000000000..6e1da7481
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_hfgen.h
@@ -0,0 +1,51 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_hfgen.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_HFGEN_H__
+#define __SBR_HFGEN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
+ qmf_t Xhigh[MAX_NTSRHFG][64]
+#ifdef SBR_LOW_POWER
+ ,real_t *deg
+#endif
+ ,uint8_t ch);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_huff.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_huff.c
new file mode 100644
index 000000000..4034e881e
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_huff.c
@@ -0,0 +1,362 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_huff.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "sbr_syntax.h"
+#include "bits.h"
+#include "sbr_huff.h"
+#include "sbr_e_nf.h"
+
+
+typedef const int8_t (*sbr_huff_tab)[2];
+
+static const int8_t t_huffman_env_1_5dB[120][2] = {
+ { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
+ { 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 },
+ { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
+ { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 },
+ { 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 },
+ { -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 },
+ { -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 },
+ { -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 },
+ { -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 },
+ { 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 },
+ { 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 },
+ { -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 },
+ {-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 },
+ {-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 },
+ {-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 },
+ { 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 },
+ { 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 },
+ { 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 },
+ { -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 },
+ { 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 },
+ { -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 },
+ { -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 },
+ { -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
+ { 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 },
+ { -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 },
+ { -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 },
+ { -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 },
+ { -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 },
+ { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 },
+ { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
+};
+
+static const int8_t f_huffman_env_1_5dB[120][2] = {
+ { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
+ { 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 },
+ { 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 },
+ { -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 },
+ { 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 },
+ { 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 },
+ { 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 },
+ { 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 },
+ { 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 },
+ { 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 },
+ { -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 },
+ { 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 },
+ { 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 },
+ { -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 },
+ { 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 },
+ { 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 },
+ {-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 },
+ { 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 },
+ { 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 },
+ { 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 },
+ {-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 },
+ {-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 },
+ {-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
+ { 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 },
+ { -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 },
+ { -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 },
+ { -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 },
+ { -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 },
+ { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 },
+ { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
+};
+
+static const int8_t t_huffman_env_bal_1_5dB[48][2] = {
+ { -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 },
+ { -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 },
+ { -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 },
+ { -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 },
+ { -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 },
+ { -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 },
+ { -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 },
+ { 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 },
+ { -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 },
+ { 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 },
+ { -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 },
+ { -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 }
+};
+
+static const int8_t f_huffman_env_bal_1_5dB[48][2] = {
+ { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
+ { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
+ { -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 },
+ { -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 },
+ { -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 },
+ { -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 },
+ { -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 },
+ { -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 },
+ { 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 },
+ { -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 },
+ { 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 },
+ { 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 }
+};
+
+static const int8_t t_huffman_env_3_0dB[62][2] = {
+ { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
+ { -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 },
+ { -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 },
+ { -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 },
+ { -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 },
+ { -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 },
+ { -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 },
+ { -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 },
+ { 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 },
+ { -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 },
+ { 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 },
+ { 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 },
+ { 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 },
+ { 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 },
+ { 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 },
+ { -36, -35 }, { -34, -33 }
+};
+
+static const int8_t f_huffman_env_3_0dB[62][2] = {
+ { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
+ { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
+ { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
+ { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 },
+ { 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 },
+ { 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 },
+ { 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 },
+ { -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 },
+ { 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 },
+ { -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 },
+ { 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 },
+ { 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 },
+ { 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 },
+ { 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 },
+ { 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 },
+ { -36, -35 }, { -34, -33 }
+};
+
+static const int8_t t_huffman_env_bal_3_0dB[24][2] = {
+ { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
+ { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
+ { -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 },
+ { -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 },
+ { 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 },
+ { 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 }
+};
+
+static const int8_t f_huffman_env_bal_3_0dB[24][2] = {
+ { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
+ { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
+ { -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 },
+ { -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 },
+ { -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 },
+ { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 }
+};
+
+static const int8_t t_huffman_noise_3_0dB[62][2] = {
+ { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
+ { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
+ { 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 },
+ { 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 },
+ { 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 },
+ { 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 },
+ { 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 },
+ { -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 },
+ { 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 },
+ { 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 },
+ { 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 },
+ { -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 },
+ { 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 },
+ { -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 },
+ { -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 },
+ { -35, 61 }, { -34, -33 }
+};
+
+static const int8_t t_huffman_noise_bal_3_0dB[24][2] = {
+ { -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 },
+ { -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 },
+ { -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 },
+ { -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 },
+ { -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 },
+ { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 }
+};
+
+
+static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
+{
+ uint8_t bit;
+ int16_t index = 0;
+
+ while (index >= 0)
+ {
+ bit = (uint8_t)faad_get1bit(ld);
+ index = t_huff[index][bit];
+ }
+
+ return index + 64;
+}
+
+/* table 10 */
+void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+ uint8_t env, band;
+ int8_t delta = 0;
+ sbr_huff_tab t_huff, f_huff;
+
+ if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX))
+ sbr->amp_res[ch] = 0;
+ else
+ sbr->amp_res[ch] = sbr->bs_amp_res;
+
+ if ((sbr->bs_coupling) && (ch == 1))
+ {
+ delta = 1;
+ if (sbr->amp_res[ch])
+ {
+ t_huff = t_huffman_env_bal_3_0dB;
+ f_huff = f_huffman_env_bal_3_0dB;
+ } else {
+ t_huff = t_huffman_env_bal_1_5dB;
+ f_huff = f_huffman_env_bal_1_5dB;
+ }
+ } else {
+ delta = 0;
+ if (sbr->amp_res[ch])
+ {
+ t_huff = t_huffman_env_3_0dB;
+ f_huff = f_huffman_env_3_0dB;
+ } else {
+ t_huff = t_huffman_env_1_5dB;
+ f_huff = f_huffman_env_1_5dB;
+ }
+ }
+
+ for (env = 0; env < sbr->L_E[ch]; env++)
+ {
+ if (sbr->bs_df_env[ch][env] == 0)
+ {
+ if ((sbr->bs_coupling == 1) && (ch == 1))
+ {
+ if (sbr->amp_res[ch])
+ {
+ sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5
+ DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta);
+ } else {
+ sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
+ DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta);
+ }
+ } else {
+ if (sbr->amp_res[ch])
+ {
+ sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
+ DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta);
+ } else {
+ sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7
+ DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta);
+ }
+ }
+
+ for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++)
+ {
+ sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta);
+ }
+
+ } else {
+ for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++)
+ {
+ sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta);
+ }
+ }
+ }
+
+ extract_envelope_data(sbr, ch);
+}
+
+/* table 11 */
+void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+ uint8_t noise, band;
+ int8_t delta = 0;
+ sbr_huff_tab t_huff, f_huff;
+
+ if ((sbr->bs_coupling == 1) && (ch == 1))
+ {
+ delta = 1;
+ t_huff = t_huffman_noise_bal_3_0dB;
+ f_huff = f_huffman_env_bal_3_0dB;
+ } else {
+ delta = 0;
+ t_huff = t_huffman_noise_3_0dB;
+ f_huff = f_huffman_env_3_0dB;
+ }
+
+ for (noise = 0; noise < sbr->L_Q[ch]; noise++)
+ {
+ if(sbr->bs_df_noise[ch][noise] == 0)
+ {
+ if ((sbr->bs_coupling == 1) && (ch == 1))
+ {
+ sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
+ DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta);
+ } else {
+ sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
+ DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta);
+ }
+ for (band = 1; band < sbr->N_Q; band++)
+ {
+ sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta);
+ }
+ } else {
+ for (band = 0; band < sbr->N_Q; band++)
+ {
+ sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta);
+ }
+ }
+ }
+
+ extract_noise_floor_data(sbr, ch);
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_huff.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_huff.h
new file mode 100644
index 000000000..c8ea5dcd8
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_huff.h
@@ -0,0 +1,48 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_huff.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_HUFF_H__
+#define __SBR_HUFF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch);
+void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_noise.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_noise.h
new file mode 100644
index 000000000..8465f6622
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_noise.h
@@ -0,0 +1,566 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_noise.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_NOISE_H__
+#define __SBR_NOISE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+
+/* Table 1.A.13 Noise table V */
+ALIGN static const complex_t V[] = {
+ { FRAC_CONST(-0.99948155879974), FRAC_CONST(-0.59483414888382) },
+ { FRAC_CONST(0.97113454341888), FRAC_CONST(-0.67528516054153) },
+ { FRAC_CONST(0.14130051434040), FRAC_CONST(-0.95090985298157) },
+ { FRAC_CONST(-0.47005495429039), FRAC_CONST(-0.37340548634529) },
+ { FRAC_CONST(0.80705064535141), FRAC_CONST(0.29653668403625) },
+ { FRAC_CONST(-0.38981479406357), FRAC_CONST(0.89572608470917) },
+ { FRAC_CONST(-0.01053049881011), FRAC_CONST(-0.66959059238434) },
+ { FRAC_CONST(-0.91266369819641), FRAC_CONST(-0.11522938311100) },
+ { FRAC_CONST(0.54840421676636), FRAC_CONST(0.75221365690231) },
+ { FRAC_CONST(0.40009254217148), FRAC_CONST(-0.98929399251938) },
+ { FRAC_CONST(-0.99867975711823), FRAC_CONST(-0.88147068023682) },
+ { FRAC_CONST(-0.95531076192856), FRAC_CONST(0.90908759832382) },
+ { FRAC_CONST(-0.45725932717323), FRAC_CONST(-0.56716322898865) },
+ { FRAC_CONST(-0.72929674386978), FRAC_CONST(-0.98008275032043) },
+ { FRAC_CONST(0.75622802972794), FRAC_CONST(0.20950329303741) },
+ { FRAC_CONST(0.07069442421198), FRAC_CONST(-0.78247898817062) },
+ { FRAC_CONST(0.74496251344681), FRAC_CONST(-0.91169005632401) },
+ { FRAC_CONST(-0.96440184116364), FRAC_CONST(-0.94739919900894) },
+ { FRAC_CONST(0.30424630641937), FRAC_CONST(-0.49438267946243) },
+ { FRAC_CONST(0.66565030813217), FRAC_CONST(0.64652937650681) },
+ { FRAC_CONST(0.91697007417679), FRAC_CONST(0.17514097690582) },
+ { FRAC_CONST(-0.70774918794632), FRAC_CONST(0.52548652887344) },
+ { FRAC_CONST(-0.70051413774490), FRAC_CONST(-0.45340028405190) },
+ { FRAC_CONST(-0.99496513605118), FRAC_CONST(-0.90071910619736) },
+ { FRAC_CONST(0.98164492845535), FRAC_CONST(-0.77463155984879) },
+ { FRAC_CONST(-0.54671579599380), FRAC_CONST(-0.02570928446949) },
+ { FRAC_CONST(-0.01689629070461), FRAC_CONST(0.00287506449968) },
+ { FRAC_CONST(-0.86110347509384), FRAC_CONST(0.42548584938049) },
+ { FRAC_CONST(-0.98892980813980), FRAC_CONST(-0.87881129980087) },
+ { FRAC_CONST(0.51756626367569), FRAC_CONST(0.66926783323288) },
+ { FRAC_CONST(-0.99635028839111), FRAC_CONST(-0.58107727766037) },
+ { FRAC_CONST(-0.99969369173050), FRAC_CONST(0.98369991779327) },
+ { FRAC_CONST(0.55266261100769), FRAC_CONST(0.59449058771133) },
+ { FRAC_CONST(0.34581178426743), FRAC_CONST(0.94879418611526) },
+ { FRAC_CONST(0.62664210796356), FRAC_CONST(-0.74402970075607) },
+ { FRAC_CONST(-0.77149701118469), FRAC_CONST(-0.33883658051491) },
+ { FRAC_CONST(-0.91592246294022), FRAC_CONST(0.03687901422381) },
+ { FRAC_CONST(-0.76285493373871), FRAC_CONST(-0.91371870040894) },
+ { FRAC_CONST(0.79788339138031), FRAC_CONST(-0.93180972337723) },
+ { FRAC_CONST(0.54473078250885), FRAC_CONST(-0.11919206380844) },
+ { FRAC_CONST(-0.85639280080795), FRAC_CONST(0.42429855465889) },
+ { FRAC_CONST(-0.92882400751114), FRAC_CONST(0.27871808409691) },
+ { FRAC_CONST(-0.11708371341228), FRAC_CONST(-0.99800843000412) },
+ { FRAC_CONST(0.21356749534607), FRAC_CONST(-0.90716296434402) },
+ { FRAC_CONST(-0.76191693544388), FRAC_CONST(0.99768120050430) },
+ { FRAC_CONST(0.98111045360565), FRAC_CONST(-0.95854461193085) },
+ { FRAC_CONST(-0.85913270711899), FRAC_CONST(0.95766568183899) },
+ { FRAC_CONST(-0.93307244777679), FRAC_CONST(0.49431759119034) },
+ { FRAC_CONST(0.30485755205154), FRAC_CONST(-0.70540034770966) },
+ { FRAC_CONST(0.85289651155472), FRAC_CONST(0.46766132116318) },
+ { FRAC_CONST(0.91328084468842), FRAC_CONST(-0.99839597940445) },
+ { FRAC_CONST(-0.05890199914575), FRAC_CONST(0.70741826295853) },
+ { FRAC_CONST(0.28398686647415), FRAC_CONST(0.34633556008339) },
+ { FRAC_CONST(0.95258164405823), FRAC_CONST(-0.54893416166306) },
+ { FRAC_CONST(-0.78566324710846), FRAC_CONST(-0.75568538904190) },
+ { FRAC_CONST(-0.95789498090744), FRAC_CONST(-0.20423194766045) },
+ { FRAC_CONST(0.82411158084869), FRAC_CONST(0.96654617786407) },
+ { FRAC_CONST(-0.65185445547104), FRAC_CONST(-0.88734990358353) },
+ { FRAC_CONST(-0.93643605709076), FRAC_CONST(0.99870789051056) },
+ { FRAC_CONST(0.91427159309387), FRAC_CONST(-0.98290503025055) },
+ { FRAC_CONST(-0.70395684242249), FRAC_CONST(0.58796799182892) },
+ { FRAC_CONST(0.00563771976158), FRAC_CONST(0.61768198013306) },
+ { FRAC_CONST(0.89065051078796), FRAC_CONST(0.52783352136612) },
+ { FRAC_CONST(-0.68683707714081), FRAC_CONST(0.80806946754456) },
+ { FRAC_CONST(0.72165340185165), FRAC_CONST(-0.69259858131409) },
+ { FRAC_CONST(-0.62928247451782), FRAC_CONST(0.13627037405968) },
+ { FRAC_CONST(0.29938435554504), FRAC_CONST(-0.46051329374313) },
+ { FRAC_CONST(-0.91781955957413), FRAC_CONST(-0.74012714624405) },
+ { FRAC_CONST(0.99298715591431), FRAC_CONST(0.40816611051559) },
+ { FRAC_CONST(0.82368296384811), FRAC_CONST(-0.74036049842834) },
+ { FRAC_CONST(-0.98512834310532), FRAC_CONST(-0.99972331523895) },
+ { FRAC_CONST(-0.95915371179581), FRAC_CONST(-0.99237799644470) },
+ { FRAC_CONST(-0.21411126852036), FRAC_CONST(-0.93424820899963) },
+ { FRAC_CONST(-0.68821477890015), FRAC_CONST(-0.26892307400703) },
+ { FRAC_CONST(0.91851997375488), FRAC_CONST(0.09358228743076) },
+ { FRAC_CONST(-0.96062767505646), FRAC_CONST(0.36099094152451) },
+ { FRAC_CONST(0.51646184921265), FRAC_CONST(-0.71373331546783) },
+ { FRAC_CONST(0.61130720376968), FRAC_CONST(0.46950140595436) },
+ { FRAC_CONST(0.47336128354073), FRAC_CONST(-0.27333179116249) },
+ { FRAC_CONST(0.90998309850693), FRAC_CONST(0.96715664863586) },
+ { FRAC_CONST(0.44844800233841), FRAC_CONST(0.99211573600769) },
+ { FRAC_CONST(0.66614890098572), FRAC_CONST(0.96590173244476) },
+ { FRAC_CONST(0.74922239780426), FRAC_CONST(-0.89879858493805) },
+ { FRAC_CONST(-0.99571585655212), FRAC_CONST(0.52785521745682) },
+ { FRAC_CONST(0.97401082515717), FRAC_CONST(-0.16855870187283) },
+ { FRAC_CONST(0.72683745622635), FRAC_CONST(-0.48060774803162) },
+ { FRAC_CONST(0.95432192087173), FRAC_CONST(0.68849605321884) },
+ { FRAC_CONST(-0.72962206602097), FRAC_CONST(-0.76608443260193) },
+ { FRAC_CONST(-0.85359477996826), FRAC_CONST(0.88738125562668) },
+ { FRAC_CONST(-0.81412428617477), FRAC_CONST(-0.97480767965317) },
+ { FRAC_CONST(-0.87930774688721), FRAC_CONST(0.74748307466507) },
+ { FRAC_CONST(-0.71573328971863), FRAC_CONST(-0.98570609092712) },
+ { FRAC_CONST(0.83524298667908), FRAC_CONST(0.83702534437180) },
+ { FRAC_CONST(-0.48086065053940), FRAC_CONST(-0.98848503828049) },
+ { FRAC_CONST(0.97139126062393), FRAC_CONST(0.80093622207642) },
+ { FRAC_CONST(0.51992827653885), FRAC_CONST(0.80247628688812) },
+ { FRAC_CONST(-0.00848591234535), FRAC_CONST(-0.76670128107071) },
+ { FRAC_CONST(-0.70294374227524), FRAC_CONST(0.55359911918640) },
+ { FRAC_CONST(-0.95894426107407), FRAC_CONST(-0.43265503644943) },
+ { FRAC_CONST(0.97079253196716), FRAC_CONST(0.09325857460499) },
+ { FRAC_CONST(-0.92404294013977), FRAC_CONST(0.85507702827454) },
+ { FRAC_CONST(-0.69506472349167), FRAC_CONST(0.98633414506912) },
+ { FRAC_CONST(0.26559203863144), FRAC_CONST(0.73314309120178) },
+ { FRAC_CONST(0.28038442134857), FRAC_CONST(0.14537914097309) },
+ { FRAC_CONST(-0.74138122797012), FRAC_CONST(0.99310338497162) },
+ { FRAC_CONST(-0.01752796024084), FRAC_CONST(-0.82616633176804) },
+ { FRAC_CONST(-0.55126774311066), FRAC_CONST(-0.98898541927338) },
+ { FRAC_CONST(0.97960901260376), FRAC_CONST(-0.94021445512772) },
+ { FRAC_CONST(-0.99196308851242), FRAC_CONST(0.67019015550613) },
+ { FRAC_CONST(-0.67684930562973), FRAC_CONST(0.12631492316723) },
+ { FRAC_CONST(0.09140039235353), FRAC_CONST(-0.20537731051445) },
+ { FRAC_CONST(-0.71658962965012), FRAC_CONST(-0.97788202762604) },
+ { FRAC_CONST(0.81014639139175), FRAC_CONST(0.53722649812698) },
+ { FRAC_CONST(0.40616992115974), FRAC_CONST(-0.26469007134438) },
+ { FRAC_CONST(-0.67680186033249), FRAC_CONST(0.94502049684525) },
+ { FRAC_CONST(0.86849772930145), FRAC_CONST(-0.18333598971367) },
+ { FRAC_CONST(-0.99500381946564), FRAC_CONST(-0.02634122036397) },
+ { FRAC_CONST(0.84329187870026), FRAC_CONST(0.10406957566738) },
+ { FRAC_CONST(-0.09215968847275), FRAC_CONST(0.69540011882782) },
+ { FRAC_CONST(0.99956172704697), FRAC_CONST(-0.12358541786671) },
+ { FRAC_CONST(-0.79732781648636), FRAC_CONST(-0.91582524776459) },
+ { FRAC_CONST(0.96349972486496), FRAC_CONST(0.96640455722809) },
+ { FRAC_CONST(-0.79942780733109), FRAC_CONST(0.64323902130127) },
+ { FRAC_CONST(-0.11566039919853), FRAC_CONST(0.28587844967842) },
+ { FRAC_CONST(-0.39922955632210), FRAC_CONST(0.94129604101181) },
+ { FRAC_CONST(0.99089199304581), FRAC_CONST(-0.92062628269196) },
+ { FRAC_CONST(0.28631284832954), FRAC_CONST(-0.91035044193268) },
+ { FRAC_CONST(-0.83302724361420), FRAC_CONST(-0.67330408096313) },
+ { FRAC_CONST(0.95404446125031), FRAC_CONST(0.49162766337395) },
+ { FRAC_CONST(-0.06449863314629), FRAC_CONST(0.03250560909510) },
+ { FRAC_CONST(-0.99575054645538), FRAC_CONST(0.42389783263206) },
+ { FRAC_CONST(-0.65501141548157), FRAC_CONST(0.82546114921570) },
+ { FRAC_CONST(-0.81254440546036), FRAC_CONST(-0.51627236604691) },
+ { FRAC_CONST(-0.99646371603012), FRAC_CONST(0.84490531682968) },
+ { FRAC_CONST(0.00287840608507), FRAC_CONST(0.64768260717392) },
+ { FRAC_CONST(0.70176988840103), FRAC_CONST(-0.20453028380871) },
+ { FRAC_CONST(0.96361881494522), FRAC_CONST(0.40706968307495) },
+ { FRAC_CONST(-0.68883758783340), FRAC_CONST(0.91338956356049) },
+ { FRAC_CONST(-0.34875586628914), FRAC_CONST(0.71472293138504) },
+ { FRAC_CONST(0.91980081796646), FRAC_CONST(0.66507452726364) },
+ { FRAC_CONST(-0.99009048938751), FRAC_CONST(0.85868018865585) },
+ { FRAC_CONST(0.68865793943405), FRAC_CONST(0.55660319328308) },
+ { FRAC_CONST(-0.99484401941299), FRAC_CONST(-0.20052559673786) },
+ { FRAC_CONST(0.94214510917664), FRAC_CONST(-0.99696427583694) },
+ { FRAC_CONST(-0.67414629459381), FRAC_CONST(0.49548220634460) },
+ { FRAC_CONST(-0.47339352965355), FRAC_CONST(-0.85904330015182) },
+ { FRAC_CONST(0.14323651790619), FRAC_CONST(-0.94145596027374) },
+ { FRAC_CONST(-0.29268294572830), FRAC_CONST(0.05759225040674) },
+ { FRAC_CONST(0.43793860077858), FRAC_CONST(-0.78904968500137) },
+ { FRAC_CONST(-0.36345127224922), FRAC_CONST(0.64874434471130) },
+ { FRAC_CONST(-0.08750604838133), FRAC_CONST(0.97686946392059) },
+ { FRAC_CONST(-0.96495270729065), FRAC_CONST(-0.53960305452347) },
+ { FRAC_CONST(0.55526942014694), FRAC_CONST(0.78891521692276) },
+ { FRAC_CONST(0.73538213968277), FRAC_CONST(0.96452075242996) },
+ { FRAC_CONST(-0.30889773368835), FRAC_CONST(-0.80664390325546) },
+ { FRAC_CONST(0.03574995696545), FRAC_CONST(-0.97325617074966) },
+ { FRAC_CONST(0.98720687627792), FRAC_CONST(0.48409134149551) },
+ { FRAC_CONST(-0.81689298152924), FRAC_CONST(-0.90827703475952) },
+ { FRAC_CONST(0.67866861820221), FRAC_CONST(0.81284505128860) },
+ { FRAC_CONST(-0.15808570384979), FRAC_CONST(0.85279554128647) },
+ { FRAC_CONST(0.80723392963409), FRAC_CONST(-0.24717418849468) },
+ { FRAC_CONST(0.47788757085800), FRAC_CONST(-0.46333149075508) },
+ { FRAC_CONST(0.96367555856705), FRAC_CONST(0.38486748933792) },
+ { FRAC_CONST(-0.99143874645233), FRAC_CONST(-0.24945276975632) },
+ { FRAC_CONST(0.83081877231598), FRAC_CONST(-0.94780850410461) },
+ { FRAC_CONST(-0.58753192424774), FRAC_CONST(0.01290772389621) },
+ { FRAC_CONST(0.95538109540939), FRAC_CONST(-0.85557049512863) },
+ { FRAC_CONST(-0.96490919589996), FRAC_CONST(-0.64020973443985) },
+ { FRAC_CONST(-0.97327101230621), FRAC_CONST(0.12378127872944) },
+ { FRAC_CONST(0.91400367021561), FRAC_CONST(0.57972472906113) },
+ { FRAC_CONST(-0.99925839900970), FRAC_CONST(0.71084845066071) },
+ { FRAC_CONST(-0.86875903606415), FRAC_CONST(-0.20291699469090) },
+ { FRAC_CONST(-0.26240035891533), FRAC_CONST(-0.68264555931091) },
+ { FRAC_CONST(-0.24664412438869), FRAC_CONST(-0.87642270326614) },
+ { FRAC_CONST(0.02416275814176), FRAC_CONST(0.27192914485931) },
+ { FRAC_CONST(0.82068622112274), FRAC_CONST(-0.85087788105011) },
+ { FRAC_CONST(0.88547372817993), FRAC_CONST(-0.89636802673340) },
+ { FRAC_CONST(-0.18173077702522), FRAC_CONST(-0.26152145862579) },
+ { FRAC_CONST(0.09355476498604), FRAC_CONST(0.54845124483109) },
+ { FRAC_CONST(-0.54668414592743), FRAC_CONST(0.95980775356293) },
+ { FRAC_CONST(0.37050989270210), FRAC_CONST(-0.59910142421722) },
+ { FRAC_CONST(-0.70373594760895), FRAC_CONST(0.91227668523788) },
+ { FRAC_CONST(-0.34600785374641), FRAC_CONST(-0.99441426992416) },
+ { FRAC_CONST(-0.68774479627609), FRAC_CONST(-0.30238837003708) },
+ { FRAC_CONST(-0.26843291521072), FRAC_CONST(0.83115667104721) },
+ { FRAC_CONST(0.49072334170341), FRAC_CONST(-0.45359709858894) },
+ { FRAC_CONST(0.38975992798805), FRAC_CONST(0.95515358448029) },
+ { FRAC_CONST(-0.97757124900818), FRAC_CONST(0.05305894464254) },
+ { FRAC_CONST(-0.17325553297997), FRAC_CONST(-0.92770671844482) },
+ { FRAC_CONST(0.99948036670685), FRAC_CONST(0.58285546302795) },
+ { FRAC_CONST(-0.64946246147156), FRAC_CONST(0.68645507097244) },
+ { FRAC_CONST(-0.12016920745373), FRAC_CONST(-0.57147324085236) },
+ { FRAC_CONST(-0.58947455883026), FRAC_CONST(-0.34847131371498) },
+ { FRAC_CONST(-0.41815140843391), FRAC_CONST(0.16276422142982) },
+ { FRAC_CONST(0.99885648488998), FRAC_CONST(0.11136095225811) },
+ { FRAC_CONST(-0.56649613380432), FRAC_CONST(-0.90494865179062) },
+ { FRAC_CONST(0.94138020277023), FRAC_CONST(0.35281917452812) },
+ { FRAC_CONST(-0.75725078582764), FRAC_CONST(0.53650552034378) },
+ { FRAC_CONST(0.20541973412037), FRAC_CONST(-0.94435143470764) },
+ { FRAC_CONST(0.99980372190475), FRAC_CONST(0.79835915565491) },
+ { FRAC_CONST(0.29078277945518), FRAC_CONST(0.35393777489662) },
+ { FRAC_CONST(-0.62858772277832), FRAC_CONST(0.38765692710876) },
+ { FRAC_CONST(0.43440905213356), FRAC_CONST(-0.98546332120895) },
+ { FRAC_CONST(-0.98298585414886), FRAC_CONST(0.21021524071693) },
+ { FRAC_CONST(0.19513028860092), FRAC_CONST(-0.94239830970764) },
+ { FRAC_CONST(-0.95476663112640), FRAC_CONST(0.98364555835724) },
+ { FRAC_CONST(0.93379634618759), FRAC_CONST(-0.70881992578506) },
+ { FRAC_CONST(-0.85235410928726), FRAC_CONST(-0.08342348039150) },
+ { FRAC_CONST(-0.86425095796585), FRAC_CONST(-0.45795026421547) },
+ { FRAC_CONST(0.38879778981209), FRAC_CONST(0.97274428606033) },
+ { FRAC_CONST(0.92045122385025), FRAC_CONST(-0.62433654069901) },
+ { FRAC_CONST(0.89162534475327), FRAC_CONST(0.54950958490372) },
+ { FRAC_CONST(-0.36834338307381), FRAC_CONST(0.96458297967911) },
+ { FRAC_CONST(0.93891763687134), FRAC_CONST(-0.89968353509903) },
+ { FRAC_CONST(0.99267655611038), FRAC_CONST(-0.03757034242153) },
+ { FRAC_CONST(-0.94063472747803), FRAC_CONST(0.41332337260246) },
+ { FRAC_CONST(0.99740225076675), FRAC_CONST(-0.16830494999886) },
+ { FRAC_CONST(-0.35899412631989), FRAC_CONST(-0.46633225679398) },
+ { FRAC_CONST(0.05237237364054), FRAC_CONST(-0.25640362501144) },
+ { FRAC_CONST(0.36703583598137), FRAC_CONST(-0.38653266429901) },
+ { FRAC_CONST(0.91653180122375), FRAC_CONST(-0.30587628483772) },
+ { FRAC_CONST(0.69000804424286), FRAC_CONST(0.90952169895172) },
+ { FRAC_CONST(-0.38658750057220), FRAC_CONST(0.99501574039459) },
+ { FRAC_CONST(-0.29250815510750), FRAC_CONST(0.37444993853569) },
+ { FRAC_CONST(-0.60182201862335), FRAC_CONST(0.86779648065567) },
+ { FRAC_CONST(-0.97418588399887), FRAC_CONST(0.96468526124954) },
+ { FRAC_CONST(0.88461571931839), FRAC_CONST(0.57508403062820) },
+ { FRAC_CONST(0.05198933184147), FRAC_CONST(0.21269661188126) },
+ { FRAC_CONST(-0.53499621152878), FRAC_CONST(0.97241556644440) },
+ { FRAC_CONST(-0.49429559707642), FRAC_CONST(0.98183864355087) },
+ { FRAC_CONST(-0.98935145139694), FRAC_CONST(-0.40249159932137) },
+ { FRAC_CONST(-0.98081380128860), FRAC_CONST(-0.72856897115707) },
+ { FRAC_CONST(-0.27338150143623), FRAC_CONST(0.99950921535492) },
+ { FRAC_CONST(0.06310802698135), FRAC_CONST(-0.54539585113525) },
+ { FRAC_CONST(-0.20461677014828), FRAC_CONST(-0.14209978282452) },
+ { FRAC_CONST(0.66223841905594), FRAC_CONST(0.72528582811356) },
+ { FRAC_CONST(-0.84764343500137), FRAC_CONST(0.02372316829860) },
+ { FRAC_CONST(-0.89039862155914), FRAC_CONST(0.88866579532623) },
+ { FRAC_CONST(0.95903307199478), FRAC_CONST(0.76744925975800) },
+ { FRAC_CONST(0.73504126071930), FRAC_CONST(-0.03747203201056) },
+ { FRAC_CONST(-0.31744435429573), FRAC_CONST(-0.36834111809731) },
+ { FRAC_CONST(-0.34110826253891), FRAC_CONST(0.40211221575737) },
+ { FRAC_CONST(0.47803884744644), FRAC_CONST(-0.39423218369484) },
+ { FRAC_CONST(0.98299193382263), FRAC_CONST(0.01989791356027) },
+ { FRAC_CONST(-0.30963072180748), FRAC_CONST(-0.18076720833778) },
+ { FRAC_CONST(0.99992591142654), FRAC_CONST(-0.26281872391701) },
+ { FRAC_CONST(-0.93149733543396), FRAC_CONST(-0.98313164710999) },
+ { FRAC_CONST(0.99923473596573), FRAC_CONST(-0.80142992734909) },
+ { FRAC_CONST(-0.26024168729782), FRAC_CONST(-0.75999760627747) },
+ { FRAC_CONST(-0.35712513327599), FRAC_CONST(0.19298963248730) },
+ { FRAC_CONST(-0.99899083375931), FRAC_CONST(0.74645155668259) },
+ { FRAC_CONST(0.86557173728943), FRAC_CONST(0.55593866109848) },
+ { FRAC_CONST(0.33408042788506), FRAC_CONST(0.86185956001282) },
+ { FRAC_CONST(0.99010735750198), FRAC_CONST(0.04602397605777) },
+ { FRAC_CONST(-0.66694271564484), FRAC_CONST(-0.91643613576889) },
+ { FRAC_CONST(0.64016789197922), FRAC_CONST(0.15649530291557) },
+ { FRAC_CONST(0.99570536613464), FRAC_CONST(0.45844584703445) },
+ { FRAC_CONST(-0.63431465625763), FRAC_CONST(0.21079117059708) },
+ { FRAC_CONST(-0.07706847041845), FRAC_CONST(-0.89581435918808) },
+ { FRAC_CONST(0.98590087890625), FRAC_CONST(0.88241720199585) },
+ { FRAC_CONST(0.80099332332611), FRAC_CONST(-0.36851897835732) },
+ { FRAC_CONST(0.78368133306503), FRAC_CONST(0.45506998896599) },
+ { FRAC_CONST(0.08707806468010), FRAC_CONST(0.80938994884491) },
+ { FRAC_CONST(-0.86811882257462), FRAC_CONST(0.39347308874130) },
+ { FRAC_CONST(-0.39466530084610), FRAC_CONST(-0.66809433698654) },
+ { FRAC_CONST(0.97875326871872), FRAC_CONST(-0.72467839717865) },
+ { FRAC_CONST(-0.95038563013077), FRAC_CONST(0.89563220739365) },
+ { FRAC_CONST(0.17005239427090), FRAC_CONST(0.54683053493500) },
+ { FRAC_CONST(-0.76910793781281), FRAC_CONST(-0.96226614713669) },
+ { FRAC_CONST(0.99743282794952), FRAC_CONST(0.42697158455849) },
+ { FRAC_CONST(0.95437383651733), FRAC_CONST(0.97002321481705) },
+ { FRAC_CONST(0.99578905105591), FRAC_CONST(-0.54106825590134) },
+ { FRAC_CONST(0.28058260679245), FRAC_CONST(-0.85361421108246) },
+ { FRAC_CONST(0.85256522893906), FRAC_CONST(-0.64567607641220) },
+ { FRAC_CONST(-0.50608539581299), FRAC_CONST(-0.65846014022827) },
+ { FRAC_CONST(-0.97210735082626), FRAC_CONST(-0.23095212876797) },
+ { FRAC_CONST(0.95424050092697), FRAC_CONST(-0.99240148067474) },
+ { FRAC_CONST(-0.96926569938660), FRAC_CONST(0.73775655031204) },
+ { FRAC_CONST(0.30872163176537), FRAC_CONST(0.41514959931374) },
+ { FRAC_CONST(-0.24523839354515), FRAC_CONST(0.63206630945206) },
+ { FRAC_CONST(-0.33813264966011), FRAC_CONST(-0.38661777973175) },
+ { FRAC_CONST(-0.05826828256249), FRAC_CONST(-0.06940773874521) },
+ { FRAC_CONST(-0.22898460924625), FRAC_CONST(0.97054851055145) },
+ { FRAC_CONST(-0.18509915471077), FRAC_CONST(0.47565764188766) },
+ { FRAC_CONST(-0.10488238185644), FRAC_CONST(-0.87769949436188) },
+ { FRAC_CONST(-0.71886587142944), FRAC_CONST(0.78030979633331) },
+ { FRAC_CONST(0.99793875217438), FRAC_CONST(0.90041309595108) },
+ { FRAC_CONST(0.57563304901123), FRAC_CONST(-0.91034334897995) },
+ { FRAC_CONST(0.28909647464752), FRAC_CONST(0.96307784318924) },
+ { FRAC_CONST(0.42188999056816), FRAC_CONST(0.48148649930954) },
+ { FRAC_CONST(0.93335050344467), FRAC_CONST(-0.43537023663521) },
+ { FRAC_CONST(-0.97087377309799), FRAC_CONST(0.86636447906494) },
+ { FRAC_CONST(0.36722871661186), FRAC_CONST(0.65291655063629) },
+ { FRAC_CONST(-0.81093025207520), FRAC_CONST(0.08778370171785) },
+ { FRAC_CONST(-0.26240602135658), FRAC_CONST(-0.92774093151093) },
+ { FRAC_CONST(0.83996498584747), FRAC_CONST(0.55839848518372) },
+ { FRAC_CONST(-0.99909615516663), FRAC_CONST(-0.96024608612061) },
+ { FRAC_CONST(0.74649465084076), FRAC_CONST(0.12144893407822) },
+ { FRAC_CONST(-0.74774593114853), FRAC_CONST(-0.26898062229156) },
+ { FRAC_CONST(0.95781666040421), FRAC_CONST(-0.79047924280167) },
+ { FRAC_CONST(0.95472306013107), FRAC_CONST(-0.08588775992393) },
+ { FRAC_CONST(0.48708331584930), FRAC_CONST(0.99999040365219) },
+ { FRAC_CONST(0.46332037448883), FRAC_CONST(0.10964126139879) },
+ { FRAC_CONST(-0.76497006416321), FRAC_CONST(0.89210927486420) },
+ { FRAC_CONST(0.57397389411926), FRAC_CONST(0.35289704799652) },
+ { FRAC_CONST(0.75374317169189), FRAC_CONST(0.96705216169357) },
+ { FRAC_CONST(-0.59174400568008), FRAC_CONST(-0.89405369758606) },
+ { FRAC_CONST(0.75087904930115), FRAC_CONST(-0.29612672328949) },
+ { FRAC_CONST(-0.98607856035233), FRAC_CONST(0.25034910440445) },
+ { FRAC_CONST(-0.40761056542397), FRAC_CONST(-0.90045571327209) },
+ { FRAC_CONST(0.66929268836975), FRAC_CONST(0.98629492521286) },
+ { FRAC_CONST(-0.97463697195053), FRAC_CONST(-0.00190223299433) },
+ { FRAC_CONST(0.90145510435104), FRAC_CONST(0.99781388044357) },
+ { FRAC_CONST(-0.87259286642075), FRAC_CONST(0.99233585596085) },
+ { FRAC_CONST(-0.91529458761215), FRAC_CONST(-0.15698707103729) },
+ { FRAC_CONST(-0.03305738791823), FRAC_CONST(-0.37205263972282) },
+ { FRAC_CONST(0.07223051041365), FRAC_CONST(-0.88805001974106) },
+ { FRAC_CONST(0.99498009681702), FRAC_CONST(0.97094357013702) },
+ { FRAC_CONST(-0.74904936552048), FRAC_CONST(0.99985486268997) },
+ { FRAC_CONST(0.04585228487849), FRAC_CONST(0.99812334775925) },
+ { FRAC_CONST(-0.89054954051971), FRAC_CONST(-0.31791913509369) },
+ { FRAC_CONST(-0.83782142400742), FRAC_CONST(0.97637635469437) },
+ { FRAC_CONST(0.33454805612564), FRAC_CONST(-0.86231517791748) },
+ { FRAC_CONST(-0.99707579612732), FRAC_CONST(0.93237990140915) },
+ { FRAC_CONST(-0.22827528417110), FRAC_CONST(0.18874759972095) },
+ { FRAC_CONST(0.67248046398163), FRAC_CONST(-0.03646211326122) },
+ { FRAC_CONST(-0.05146538093686), FRAC_CONST(-0.92599701881409) },
+ { FRAC_CONST(0.99947297573090), FRAC_CONST(0.93625229597092) },
+ { FRAC_CONST(0.66951125860214), FRAC_CONST(0.98905825614929) },
+ { FRAC_CONST(-0.99602955579758), FRAC_CONST(-0.44654715061188) },
+ { FRAC_CONST(0.82104903459549), FRAC_CONST(0.99540740251541) },
+ { FRAC_CONST(0.99186509847641), FRAC_CONST(0.72022998332977) },
+ { FRAC_CONST(-0.65284591913223), FRAC_CONST(0.52186721563339) },
+ { FRAC_CONST(0.93885445594788), FRAC_CONST(-0.74895310401917) },
+ { FRAC_CONST(0.96735250949860), FRAC_CONST(0.90891814231873) },
+ { FRAC_CONST(-0.22225968539715), FRAC_CONST(0.57124030590057) },
+ { FRAC_CONST(-0.44132784008980), FRAC_CONST(-0.92688840627670) },
+ { FRAC_CONST(-0.85694974660873), FRAC_CONST(0.88844531774521) },
+ { FRAC_CONST(0.91783040761948), FRAC_CONST(-0.46356892585754) },
+ { FRAC_CONST(0.72556972503662), FRAC_CONST(-0.99899554252625) },
+ { FRAC_CONST(-0.99711579084396), FRAC_CONST(0.58211559057236) },
+ { FRAC_CONST(0.77638977766037), FRAC_CONST(0.94321835041046) },
+ { FRAC_CONST(0.07717324048281), FRAC_CONST(0.58638399839401) },
+ { FRAC_CONST(-0.56049829721451), FRAC_CONST(0.82522302865982) },
+ { FRAC_CONST(0.98398894071579), FRAC_CONST(0.39467439055443) },
+ { FRAC_CONST(0.47546947002411), FRAC_CONST(0.68613046407700) },
+ { FRAC_CONST(0.65675091743469), FRAC_CONST(0.18331636488438) },
+ { FRAC_CONST(0.03273375332355), FRAC_CONST(-0.74933111667633) },
+ { FRAC_CONST(-0.38684144616127), FRAC_CONST(0.51337349414825) },
+ { FRAC_CONST(-0.97346270084381), FRAC_CONST(-0.96549361944199) },
+ { FRAC_CONST(-0.53282153606415), FRAC_CONST(-0.91423267126083) },
+ { FRAC_CONST(0.99817311763763), FRAC_CONST(0.61133575439453) },
+ { FRAC_CONST(-0.50254499912262), FRAC_CONST(-0.88829338550568) },
+ { FRAC_CONST(0.01995873264968), FRAC_CONST(0.85223513841629) },
+ { FRAC_CONST(0.99930381774902), FRAC_CONST(0.94578897953033) },
+ { FRAC_CONST(0.82907766103745), FRAC_CONST(-0.06323442608118) },
+ { FRAC_CONST(-0.58660709857941), FRAC_CONST(0.96840775012970) },
+ { FRAC_CONST(-0.17573736608028), FRAC_CONST(-0.48166921734810) },
+ { FRAC_CONST(0.83434289693832), FRAC_CONST(-0.13023450970650) },
+ { FRAC_CONST(0.05946491286159), FRAC_CONST(0.20511047542095) },
+ { FRAC_CONST(0.81505483388901), FRAC_CONST(-0.94685947895050) },
+ { FRAC_CONST(-0.44976380467415), FRAC_CONST(0.40894573926926) },
+ { FRAC_CONST(-0.89746475219727), FRAC_CONST(0.99846577644348) },
+ { FRAC_CONST(0.39677256345749), FRAC_CONST(-0.74854665994644) },
+ { FRAC_CONST(-0.07588948309422), FRAC_CONST(0.74096214771271) },
+ { FRAC_CONST(0.76343196630478), FRAC_CONST(0.41746628284454) },
+ { FRAC_CONST(-0.74490106105804), FRAC_CONST(0.94725912809372) },
+ { FRAC_CONST(0.64880120754242), FRAC_CONST(0.41336661577225) },
+ { FRAC_CONST(0.62319535017014), FRAC_CONST(-0.93098312616348) },
+ { FRAC_CONST(0.42215818166733), FRAC_CONST(-0.07712787389755) },
+ { FRAC_CONST(0.02704554051161), FRAC_CONST(-0.05417517945170) },
+ { FRAC_CONST(0.80001771450043), FRAC_CONST(0.91542196273804) },
+ { FRAC_CONST(-0.79351830482483), FRAC_CONST(-0.36208897829056) },
+ { FRAC_CONST(0.63872361183167), FRAC_CONST(0.08128252625465) },
+ { FRAC_CONST(0.52890521287918), FRAC_CONST(0.60048872232437) },
+ { FRAC_CONST(0.74238550662994), FRAC_CONST(0.04491915181279) },
+ { FRAC_CONST(0.99096131324768), FRAC_CONST(-0.19451183080673) },
+ { FRAC_CONST(-0.80412328243256), FRAC_CONST(-0.88513815402985) },
+ { FRAC_CONST(-0.64612615108490), FRAC_CONST(0.72198677062988) },
+ { FRAC_CONST(0.11657770723104), FRAC_CONST(-0.83662831783295) },
+ { FRAC_CONST(-0.95053184032440), FRAC_CONST(-0.96939903497696) },
+ { FRAC_CONST(-0.62228870391846), FRAC_CONST(0.82767260074615) },
+ { FRAC_CONST(0.03004475869238), FRAC_CONST(-0.99738895893097) },
+ { FRAC_CONST(-0.97987216711044), FRAC_CONST(0.36526128649712) },
+ { FRAC_CONST(-0.99986982345581), FRAC_CONST(-0.36021611094475) },
+ { FRAC_CONST(0.89110648632050), FRAC_CONST(-0.97894251346588) },
+ { FRAC_CONST(0.10407960414886), FRAC_CONST(0.77357792854309) },
+ { FRAC_CONST(0.95964735746384), FRAC_CONST(-0.35435819625854) },
+ { FRAC_CONST(0.50843232870102), FRAC_CONST(0.96107691526413) },
+ { FRAC_CONST(0.17006334662437), FRAC_CONST(-0.76854026317596) },
+ { FRAC_CONST(0.25872674584389), FRAC_CONST(0.99893301725388) },
+ { FRAC_CONST(-0.01115998718888), FRAC_CONST(0.98496019840240) },
+ { FRAC_CONST(-0.79598701000214), FRAC_CONST(0.97138410806656) },
+ { FRAC_CONST(-0.99264711141586), FRAC_CONST(-0.99542820453644) },
+ { FRAC_CONST(-0.99829661846161), FRAC_CONST(0.01877138763666) },
+ { FRAC_CONST(-0.70801013708115), FRAC_CONST(0.33680686354637) },
+ { FRAC_CONST(-0.70467054843903), FRAC_CONST(0.93272775411606) },
+ { FRAC_CONST(0.99846023321152), FRAC_CONST(-0.98725748062134) },
+ { FRAC_CONST(-0.63364970684052), FRAC_CONST(-0.16473594307899) },
+ { FRAC_CONST(-0.16258217394352), FRAC_CONST(-0.95939123630524) },
+ { FRAC_CONST(-0.43645593523979), FRAC_CONST(-0.94805032014847) },
+ { FRAC_CONST(-0.99848473072052), FRAC_CONST(0.96245169639587) },
+ { FRAC_CONST(-0.16796459257603), FRAC_CONST(-0.98987513780594) },
+ { FRAC_CONST(-0.87979227304459), FRAC_CONST(-0.71725726127625) },
+ { FRAC_CONST(0.44183099269867), FRAC_CONST(-0.93568974733353) },
+ { FRAC_CONST(0.93310177326202), FRAC_CONST(-0.99913311004639) },
+ { FRAC_CONST(-0.93941932916641), FRAC_CONST(-0.56409376859665) },
+ { FRAC_CONST(-0.88590002059937), FRAC_CONST(0.47624599933624) },
+ { FRAC_CONST(0.99971461296082), FRAC_CONST(-0.83889955282211) },
+ { FRAC_CONST(-0.75376385450363), FRAC_CONST(0.00814643409103) },
+ { FRAC_CONST(0.93887686729431), FRAC_CONST(-0.11284527927637) },
+ { FRAC_CONST(0.85126435756683), FRAC_CONST(0.52349251508713) },
+ { FRAC_CONST(0.39701420068741), FRAC_CONST(0.81779634952545) },
+ { FRAC_CONST(-0.37024465203285), FRAC_CONST(-0.87071657180786) },
+ { FRAC_CONST(-0.36024826765060), FRAC_CONST(0.34655734896660) },
+ { FRAC_CONST(-0.93388813734055), FRAC_CONST(-0.84476542472839) },
+ { FRAC_CONST(-0.65298801660538), FRAC_CONST(-0.18439576029778) },
+ { FRAC_CONST(0.11960318684578), FRAC_CONST(0.99899345636368) },
+ { FRAC_CONST(0.94292563199997), FRAC_CONST(0.83163905143738) },
+ { FRAC_CONST(0.75081145763397), FRAC_CONST(-0.35533222556114) },
+ { FRAC_CONST(0.56721979379654), FRAC_CONST(-0.24076835811138) },
+ { FRAC_CONST(0.46857765316963), FRAC_CONST(-0.30140233039856) },
+ { FRAC_CONST(0.97312313318253), FRAC_CONST(-0.99548190832138) },
+ { FRAC_CONST(-0.38299977779388), FRAC_CONST(0.98516911268234) },
+ { FRAC_CONST(0.41025799512863), FRAC_CONST(0.02116736955941) },
+ { FRAC_CONST(0.09638062119484), FRAC_CONST(0.04411984235048) },
+ { FRAC_CONST(-0.85283249616623), FRAC_CONST(0.91475564241409) },
+ { FRAC_CONST(0.88866806030273), FRAC_CONST(-0.99735265970230) },
+ { FRAC_CONST(-0.48202428221703), FRAC_CONST(-0.96805608272552) },
+ { FRAC_CONST(0.27572581171989), FRAC_CONST(0.58634752035141) },
+ { FRAC_CONST(-0.65889132022858), FRAC_CONST(0.58835631608963) },
+ { FRAC_CONST(0.98838084936142), FRAC_CONST(0.99994349479675) },
+ { FRAC_CONST(-0.20651349425316), FRAC_CONST(0.54593044519424) },
+ { FRAC_CONST(-0.62126415967941), FRAC_CONST(-0.59893679618835) },
+ { FRAC_CONST(0.20320105552673), FRAC_CONST(-0.86879181861877) },
+ { FRAC_CONST(-0.97790551185608), FRAC_CONST(0.96290808916092) },
+ { FRAC_CONST(0.11112534999847), FRAC_CONST(0.21484763920307) },
+ { FRAC_CONST(-0.41368338465691), FRAC_CONST(0.28216838836670) },
+ { FRAC_CONST(0.24133038520813), FRAC_CONST(0.51294362545013) },
+ { FRAC_CONST(-0.66393411159515), FRAC_CONST(-0.08249679952860) },
+ { FRAC_CONST(-0.53697830438614), FRAC_CONST(-0.97649902105331) },
+ { FRAC_CONST(-0.97224736213684), FRAC_CONST(0.22081333398819) },
+ { FRAC_CONST(0.87392479181290), FRAC_CONST(-0.12796173989773) },
+ { FRAC_CONST(0.19050361216068), FRAC_CONST(0.01602615416050) },
+ { FRAC_CONST(-0.46353441476822), FRAC_CONST(-0.95249038934708) },
+ { FRAC_CONST(-0.07064096629620), FRAC_CONST(-0.94479805231094) },
+ { FRAC_CONST(-0.92444086074829), FRAC_CONST(-0.10457590222359) },
+ { FRAC_CONST(-0.83822596073151), FRAC_CONST(-0.01695043221116) },
+ { FRAC_CONST(0.75214684009552), FRAC_CONST(-0.99955683946609) },
+ { FRAC_CONST(-0.42102998495102), FRAC_CONST(0.99720942974091) },
+ { FRAC_CONST(-0.72094786167145), FRAC_CONST(-0.35008960962296) },
+ { FRAC_CONST(0.78843313455582), FRAC_CONST(0.52851396799088) },
+ { FRAC_CONST(0.97394025325775), FRAC_CONST(-0.26695942878723) },
+ { FRAC_CONST(0.99206465482712), FRAC_CONST(-0.57010120153427) },
+ { FRAC_CONST(0.76789611577988), FRAC_CONST(-0.76519358158112) },
+ { FRAC_CONST(-0.82002419233322), FRAC_CONST(-0.73530179262161) },
+ { FRAC_CONST(0.81924992799759), FRAC_CONST(0.99698424339294) },
+ { FRAC_CONST(-0.26719850301743), FRAC_CONST(0.68903368711472) },
+ { FRAC_CONST(-0.43311259150505), FRAC_CONST(0.85321813821793) },
+ { FRAC_CONST(0.99194979667664), FRAC_CONST(0.91876250505447) },
+ { FRAC_CONST(-0.80691999197006), FRAC_CONST(-0.32627540826797) },
+ { FRAC_CONST(0.43080005049706), FRAC_CONST(-0.21919095516205) },
+ { FRAC_CONST(0.67709493637085), FRAC_CONST(-0.95478075742722) },
+ { FRAC_CONST(0.56151771545410), FRAC_CONST(-0.70693808794022) },
+ { FRAC_CONST(0.10831862688065), FRAC_CONST(-0.08628837019205) },
+ { FRAC_CONST(0.91229414939880), FRAC_CONST(-0.65987348556519) },
+ { FRAC_CONST(-0.48972892761230), FRAC_CONST(0.56289243698120) },
+ { FRAC_CONST(-0.89033657312393), FRAC_CONST(-0.71656566858292) },
+ { FRAC_CONST(0.65269446372986), FRAC_CONST(0.65916007757187) },
+ { FRAC_CONST(0.67439478635788), FRAC_CONST(-0.81684380769730) },
+ { FRAC_CONST(-0.47770830988884), FRAC_CONST(-0.16789555549622) },
+ { FRAC_CONST(-0.99715977907181), FRAC_CONST(-0.93565785884857) },
+ { FRAC_CONST(-0.90889590978622), FRAC_CONST(0.62034398317337) },
+ { FRAC_CONST(-0.06618622690439), FRAC_CONST(-0.23812216520309) },
+ { FRAC_CONST(0.99430269002914), FRAC_CONST(0.18812555074692) },
+ { FRAC_CONST(0.97686403989792), FRAC_CONST(-0.28664535284042) },
+ { FRAC_CONST(0.94813650846481), FRAC_CONST(-0.97506642341614) },
+ { FRAC_CONST(-0.95434498786926), FRAC_CONST(-0.79607981443405) },
+ { FRAC_CONST(-0.49104782938957), FRAC_CONST(0.32895213365555) },
+ { FRAC_CONST(0.99881172180176), FRAC_CONST(0.88993984460831) },
+ { FRAC_CONST(0.50449168682098), FRAC_CONST(-0.85995072126389) },
+ { FRAC_CONST(0.47162890434265), FRAC_CONST(-0.18680204451084) },
+ { FRAC_CONST(-0.62081581354141), FRAC_CONST(0.75000673532486) },
+ { FRAC_CONST(-0.43867015838623), FRAC_CONST(0.99998068809509) },
+ { FRAC_CONST(0.98630565404892), FRAC_CONST(-0.53578901290894) },
+ { FRAC_CONST(-0.61510360240936), FRAC_CONST(-0.89515018463135) },
+ { FRAC_CONST(-0.03841517493129), FRAC_CONST(-0.69888818264008) },
+ { FRAC_CONST(-0.30102157592773), FRAC_CONST(-0.07667808979750) },
+ { FRAC_CONST(0.41881284117699), FRAC_CONST(0.02188098989427) },
+ { FRAC_CONST(-0.86135452985764), FRAC_CONST(0.98947483301163) },
+ { FRAC_CONST(0.67226862907410), FRAC_CONST(-0.13494388759136) },
+ { FRAC_CONST(-0.70737397670746), FRAC_CONST(-0.76547348499298) },
+ { FRAC_CONST(0.94044947624207), FRAC_CONST(0.09026201069355) },
+ { FRAC_CONST(-0.82386350631714), FRAC_CONST(0.08924768865108) },
+ { FRAC_CONST(-0.32070666551590), FRAC_CONST(0.50143420696259) },
+ { FRAC_CONST(0.57593160867691), FRAC_CONST(-0.98966425657272) },
+ { FRAC_CONST(-0.36326017975807), FRAC_CONST(0.07440242916346) },
+ { FRAC_CONST(0.99979043006897), FRAC_CONST(-0.14130286872387) },
+ { FRAC_CONST(-0.92366021871567), FRAC_CONST(-0.97979295253754) },
+ { FRAC_CONST(-0.44607177376747), FRAC_CONST(-0.54233253002167) },
+ { FRAC_CONST(0.44226801395416), FRAC_CONST(0.71326756477356) },
+ { FRAC_CONST(0.03671907261014), FRAC_CONST(0.63606387376785) },
+ { FRAC_CONST(0.52175426483154), FRAC_CONST(-0.85396826267242) },
+ { FRAC_CONST(-0.94701141119003), FRAC_CONST(-0.01826348155737) },
+ { FRAC_CONST(-0.98759609460831), FRAC_CONST(0.82288712263107) },
+ { FRAC_CONST(0.87434792518616), FRAC_CONST(0.89399492740631) },
+ { FRAC_CONST(-0.93412041664124), FRAC_CONST(0.41374051570892) },
+ { FRAC_CONST(0.96063941717148), FRAC_CONST(0.93116706609726) },
+ { FRAC_CONST(0.97534251213074), FRAC_CONST(0.86150932312012) },
+ { FRAC_CONST(0.99642467498779), FRAC_CONST(0.70190042257309) },
+ { FRAC_CONST(-0.94705086946487), FRAC_CONST(-0.29580041766167) },
+ { FRAC_CONST(0.91599804162979), FRAC_CONST(-0.98147833347321) }
+};
+
+#ifdef __cplusplus
+
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf.c
new file mode 100644
index 000000000..feaff4e06
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf.c
@@ -0,0 +1,638 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_qmf.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+
+#include <stdlib.h>
+#include <string.h>
+#include "sbr_dct.h"
+#include "sbr_qmf.h"
+#include "sbr_qmf_c.h"
+#include "sbr_syntax.h"
+
+qmfa_info *qmfa_init(uint8_t channels)
+{
+ qmfa_info *qmfa = (qmfa_info*)faad_malloc(sizeof(qmfa_info));
+
+ /* x is implemented as double ringbuffer */
+ qmfa->x = (real_t*)faad_malloc(2 * channels * 10 * sizeof(real_t));
+ memset(qmfa->x, 0, 2 * channels * 10 * sizeof(real_t));
+
+ /* ringbuffer index */
+ qmfa->x_index = 0;
+
+ qmfa->channels = channels;
+
+ return qmfa;
+}
+
+void qmfa_end(qmfa_info *qmfa)
+{
+ if (qmfa)
+ {
+ if (qmfa->x) faad_free(qmfa->x);
+ faad_free(qmfa);
+ }
+}
+
+void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
+ qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx)
+{
+ ALIGN real_t u[64];
+#ifndef SBR_LOW_POWER
+ ALIGN real_t in_real[32], in_imag[32], out_real[32], out_imag[32];
+#else
+ ALIGN real_t y[32];
+#endif
+ uint32_t in = 0;
+ uint8_t l;
+
+ /* qmf subsample l */
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
+ {
+ int16_t n;
+
+ /* shift input buffer x */
+ /* input buffer is not shifted anymore, x is implemented as double ringbuffer */
+ //memmove(qmfa->x + 32, qmfa->x, (320-32)*sizeof(real_t));
+
+ /* add new samples to input buffer x */
+ for (n = 32 - 1; n >= 0; n--)
+ {
+#ifdef FIXED_POINT
+ qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = (input[in++]) >> 4;
+#else
+ qmfa->x[qmfa->x_index + n] = qmfa->x[qmfa->x_index + n + 320] = input[in++];
+#endif
+ }
+
+ /* window and summation to create array u */
+ for (n = 0; n < 64; n++)
+ {
+ u[n] = MUL_F(qmfa->x[qmfa->x_index + n], qmf_c[2*n]) +
+ MUL_F(qmfa->x[qmfa->x_index + n + 64], qmf_c[2*(n + 64)]) +
+ MUL_F(qmfa->x[qmfa->x_index + n + 128], qmf_c[2*(n + 128)]) +
+ MUL_F(qmfa->x[qmfa->x_index + n + 192], qmf_c[2*(n + 192)]) +
+ MUL_F(qmfa->x[qmfa->x_index + n + 256], qmf_c[2*(n + 256)]);
+ }
+
+ /* update ringbuffer index */
+ qmfa->x_index -= 32;
+ if (qmfa->x_index < 0)
+ qmfa->x_index = (320-32);
+
+ /* calculate 32 subband samples by introducing X */
+#ifdef SBR_LOW_POWER
+ y[0] = u[48];
+ for (n = 1; n < 16; n++)
+ y[n] = u[n+48] + u[48-n];
+ for (n = 16; n < 32; n++)
+ y[n] = -u[n-16] + u[48-n];
+
+ DCT3_32_unscaled(u, y);
+
+ for (n = 0; n < 32; n++)
+ {
+ if (n < kx)
+ {
+#ifdef FIXED_POINT
+ QMF_RE(X[l + offset][n]) = u[n] /*<< 1*/;
+#else
+ QMF_RE(X[l + offset][n]) = 2. * u[n];
+#endif
+ } else {
+ QMF_RE(X[l + offset][n]) = 0;
+ }
+ }
+#else
+
+ // Reordering of data moved from DCT_IV to here
+ in_imag[31] = u[1];
+ in_real[0] = u[0];
+ for (n = 1; n < 31; n++)
+ {
+ in_imag[31 - n] = u[n+1];
+ in_real[n] = -u[64-n];
+ }
+ in_imag[0] = u[32];
+ in_real[31] = -u[33];
+
+ // dct4_kernel is DCT_IV without reordering which is done before and after FFT
+ dct4_kernel(in_real, in_imag, out_real, out_imag);
+
+ // Reordering of data moved from DCT_IV to here
+ for (n = 0; n < 16; n++) {
+ if (2*n+1 < kx) {
+#ifdef FIXED_POINT
+ QMF_RE(X[l + offset][2*n]) = out_real[n];
+ QMF_IM(X[l + offset][2*n]) = out_imag[n];
+ QMF_RE(X[l + offset][2*n+1]) = -out_imag[31-n];
+ QMF_IM(X[l + offset][2*n+1]) = -out_real[31-n];
+#else
+ QMF_RE(X[l + offset][2*n]) = 2. * out_real[n];
+ QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n];
+ QMF_RE(X[l + offset][2*n+1]) = -2. * out_imag[31-n];
+ QMF_IM(X[l + offset][2*n+1]) = -2. * out_real[31-n];
+#endif
+ } else {
+ if (2*n < kx) {
+#ifdef FIXED_POINT
+ QMF_RE(X[l + offset][2*n]) = out_real[n];
+ QMF_IM(X[l + offset][2*n]) = out_imag[n];
+#else
+ QMF_RE(X[l + offset][2*n]) = 2. * out_real[n];
+ QMF_IM(X[l + offset][2*n]) = 2. * out_imag[n];
+#endif
+ }
+ else {
+ QMF_RE(X[l + offset][2*n]) = 0;
+ QMF_IM(X[l + offset][2*n]) = 0;
+ }
+ QMF_RE(X[l + offset][2*n+1]) = 0;
+ QMF_IM(X[l + offset][2*n+1]) = 0;
+ }
+ }
+#endif
+ }
+}
+
+static const complex_t qmf32_pre_twiddle[] =
+{
+ { FRAC_CONST(0.999924701839145), FRAC_CONST(-0.012271538285720) },
+ { FRAC_CONST(0.999322384588350), FRAC_CONST(-0.036807222941359) },
+ { FRAC_CONST(0.998118112900149), FRAC_CONST(-0.061320736302209) },
+ { FRAC_CONST(0.996312612182778), FRAC_CONST(-0.085797312344440) },
+ { FRAC_CONST(0.993906970002356), FRAC_CONST(-0.110222207293883) },
+ { FRAC_CONST(0.990902635427780), FRAC_CONST(-0.134580708507126) },
+ { FRAC_CONST(0.987301418157858), FRAC_CONST(-0.158858143333861) },
+ { FRAC_CONST(0.983105487431216), FRAC_CONST(-0.183039887955141) },
+ { FRAC_CONST(0.978317370719628), FRAC_CONST(-0.207111376192219) },
+ { FRAC_CONST(0.972939952205560), FRAC_CONST(-0.231058108280671) },
+ { FRAC_CONST(0.966976471044852), FRAC_CONST(-0.254865659604515) },
+ { FRAC_CONST(0.960430519415566), FRAC_CONST(-0.278519689385053) },
+ { FRAC_CONST(0.953306040354194), FRAC_CONST(-0.302005949319228) },
+ { FRAC_CONST(0.945607325380521), FRAC_CONST(-0.325310292162263) },
+ { FRAC_CONST(0.937339011912575), FRAC_CONST(-0.348418680249435) },
+ { FRAC_CONST(0.928506080473216), FRAC_CONST(-0.371317193951838) },
+ { FRAC_CONST(0.919113851690058), FRAC_CONST(-0.393992040061048) },
+ { FRAC_CONST(0.909167983090522), FRAC_CONST(-0.416429560097637) },
+ { FRAC_CONST(0.898674465693954), FRAC_CONST(-0.438616238538528) },
+ { FRAC_CONST(0.887639620402854), FRAC_CONST(-0.460538710958240) },
+ { FRAC_CONST(0.876070094195407), FRAC_CONST(-0.482183772079123) },
+ { FRAC_CONST(0.863972856121587), FRAC_CONST(-0.503538383725718) },
+ { FRAC_CONST(0.851355193105265), FRAC_CONST(-0.524589682678469) },
+ { FRAC_CONST(0.838224705554838), FRAC_CONST(-0.545324988422046) },
+ { FRAC_CONST(0.824589302785025), FRAC_CONST(-0.565731810783613) },
+ { FRAC_CONST(0.810457198252595), FRAC_CONST(-0.585797857456439) },
+ { FRAC_CONST(0.795836904608884), FRAC_CONST(-0.605511041404326) },
+ { FRAC_CONST(0.780737228572094), FRAC_CONST(-0.624859488142386) },
+ { FRAC_CONST(0.765167265622459), FRAC_CONST(-0.643831542889791) },
+ { FRAC_CONST(0.749136394523459), FRAC_CONST(-0.662415777590172) },
+ { FRAC_CONST(0.732654271672413), FRAC_CONST(-0.680600997795453) },
+ { FRAC_CONST(0.715730825283819), FRAC_CONST(-0.698376249408973) }
+};
+
+qmfs_info *qmfs_init(uint8_t channels)
+{
+ qmfs_info *qmfs = (qmfs_info*)faad_malloc(sizeof(qmfs_info));
+
+ /* v is a double ringbuffer */
+ qmfs->v = (real_t*)faad_malloc(2 * channels * 20 * sizeof(real_t));
+ memset(qmfs->v, 0, 2 * channels * 20 * sizeof(real_t));
+
+ qmfs->v_index = 0;
+
+ qmfs->channels = channels;
+
+ return qmfs;
+}
+
+void qmfs_end(qmfs_info *qmfs)
+{
+ if (qmfs)
+ {
+ if (qmfs->v) faad_free(qmfs->v);
+ faad_free(qmfs);
+ }
+}
+
+#ifdef SBR_LOW_POWER
+
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+ real_t *output)
+{
+ ALIGN real_t x[16];
+ ALIGN real_t y[16];
+ int32_t n, k, out = 0;
+ uint8_t l;
+
+ /* qmf subsample l */
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
+ {
+ /* shift buffers */
+ /* we are not shifting v, it is a double ringbuffer */
+ //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t));
+
+ /* calculate 64 samples */
+ for (k = 0; k < 16; k++)
+ {
+#ifdef FIXED_POINT
+ y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k]));
+ x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k]));
+#else
+ y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][31 - k])) / 32.0;
+ x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][31 - k])) / 32.0;
+#endif
+ }
+
+ /* even n samples */
+ DCT2_16_unscaled(x, x);
+ /* odd n samples */
+ DCT4_16(y, y);
+
+ for (n = 8; n < 24; n++)
+ {
+ qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 640 + n*2] = x[n-8];
+ qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 640 + n*2+1] = y[n-8];
+ }
+ for (n = 0; n < 16; n++)
+ {
+ qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = qmfs->v[qmfs->v_index + 32-n];
+ }
+ qmfs->v[qmfs->v_index + 48] = qmfs->v[qmfs->v_index + 640 + 48] = 0;
+ for (n = 1; n < 16; n++)
+ {
+ qmfs->v[qmfs->v_index + 48+n] = qmfs->v[qmfs->v_index + 640 + 48+n] = -qmfs->v[qmfs->v_index + 48-n];
+ }
+
+ /* calculate 32 output samples and window */
+ for (k = 0; k < 32; k++)
+ {
+ output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
+ }
+
+ /* update the ringbuffer index */
+ qmfs->v_index -= 64;
+ if (qmfs->v_index < 0)
+ qmfs->v_index = (640-64);
+ }
+}
+
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+ real_t *output)
+{
+ ALIGN real_t x[64];
+ ALIGN real_t y[64];
+ int32_t n, k, out = 0;
+ uint8_t l;
+
+
+ /* qmf subsample l */
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
+ {
+ /* shift buffers */
+ /* we are not shifting v, it is a double ringbuffer */
+ //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
+
+ /* calculate 128 samples */
+ for (k = 0; k < 32; k++)
+ {
+#ifdef FIXED_POINT
+ y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k]));
+ x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k]));
+#else
+ y[k] = (QMF_RE(X[l][k]) - QMF_RE(X[l][63 - k])) / 32.0;
+ x[k] = (QMF_RE(X[l][k]) + QMF_RE(X[l][63 - k])) / 32.0;
+#endif
+ }
+
+ /* even n samples */
+ DCT2_32_unscaled(x, x);
+ /* odd n samples */
+ DCT4_32(y, y);
+
+ for (n = 16; n < 48; n++)
+ {
+ qmfs->v[qmfs->v_index + n*2] = qmfs->v[qmfs->v_index + 1280 + n*2] = x[n-16];
+ qmfs->v[qmfs->v_index + n*2+1] = qmfs->v[qmfs->v_index + 1280 + n*2+1] = y[n-16];
+ }
+ for (n = 0; n < 32; n++)
+ {
+ qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 1280 + n] = qmfs->v[qmfs->v_index + 64-n];
+ }
+ qmfs->v[qmfs->v_index + 96] = qmfs->v[qmfs->v_index + 1280 + 96] = 0;
+ for (n = 1; n < 32; n++)
+ {
+ qmfs->v[qmfs->v_index + 96+n] = qmfs->v[qmfs->v_index + 1280 + 96+n] = -qmfs->v[qmfs->v_index + 96-n];
+ }
+
+ /* calculate 64 output samples and window */
+ for (k = 0; k < 64; k++)
+ {
+ output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 192 + k], qmf_c[64 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[128 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 256 + 192 + k], qmf_c[128 + 64 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[256 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 512 + 192 + k], qmf_c[256 + 64 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 768 + k], qmf_c[384 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 768 + 192 + k], qmf_c[384 + 64 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 1024 + k], qmf_c[512 + k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 1024 + 192 + k], qmf_c[512 + 64 + k]);
+ }
+
+ /* update the ringbuffer index */
+ qmfs->v_index -= 128;
+ if (qmfs->v_index < 0)
+ qmfs->v_index = (1280-128);
+ }
+}
+#else
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+ real_t *output)
+{
+ ALIGN real_t x1[32], x2[32];
+#ifndef FIXED_POINT
+ real_t scale = 1.f/64.f;
+#endif
+ int32_t n, k, out = 0;
+ uint8_t l;
+
+
+ /* qmf subsample l */
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
+ {
+ /* shift buffer v */
+ /* buffer is not shifted, we are using a ringbuffer */
+ //memmove(qmfs->v + 64, qmfs->v, (640-64)*sizeof(real_t));
+
+ /* calculate 64 samples */
+ /* complex pre-twiddle */
+ for (k = 0; k < 32; k++)
+ {
+ x1[k] = MUL_F(QMF_RE(X[l][k]), RE(qmf32_pre_twiddle[k])) - MUL_F(QMF_IM(X[l][k]), IM(qmf32_pre_twiddle[k]));
+ x2[k] = MUL_F(QMF_IM(X[l][k]), RE(qmf32_pre_twiddle[k])) + MUL_F(QMF_RE(X[l][k]), IM(qmf32_pre_twiddle[k]));
+
+#ifndef FIXED_POINT
+ x1[k] *= scale;
+ x2[k] *= scale;
+#else
+ x1[k] >>= 1;
+ x2[k] >>= 1;
+#endif
+ }
+
+ /* transform */
+ DCT4_32(x1, x1);
+ DST4_32(x2, x2);
+
+ for (n = 0; n < 32; n++)
+ {
+ qmfs->v[qmfs->v_index + n] = qmfs->v[qmfs->v_index + 640 + n] = -x1[n] + x2[n];
+ qmfs->v[qmfs->v_index + 63 - n] = qmfs->v[qmfs->v_index + 640 + 63 - n] = x1[n] + x2[n];
+ }
+
+ /* calculate 32 output samples and window */
+ for (k = 0; k < 32; k++)
+ {
+ output[out++] = MUL_F(qmfs->v[qmfs->v_index + k], qmf_c[2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 96 + k], qmf_c[64 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 128 + k], qmf_c[128 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 224 + k], qmf_c[192 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 256 + k], qmf_c[256 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 352 + k], qmf_c[320 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 384 + k], qmf_c[384 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 480 + k], qmf_c[448 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 512 + k], qmf_c[512 + 2*k]) +
+ MUL_F(qmfs->v[qmfs->v_index + 608 + k], qmf_c[576 + 2*k]);
+ }
+
+ /* update ringbuffer index */
+ qmfs->v_index -= 64;
+ if (qmfs->v_index < 0)
+ qmfs->v_index = (640 - 64);
+ }
+}
+
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+ real_t *output)
+{
+// ALIGN real_t x1[64], x2[64];
+#ifndef SBR_LOW_POWER
+ ALIGN real_t in_real1[32], in_imag1[32], out_real1[32], out_imag1[32];
+ ALIGN real_t in_real2[32], in_imag2[32], out_real2[32], out_imag2[32];
+#endif
+ qmf_t * pX;
+ real_t * pring_buffer_1, * pring_buffer_3;
+// real_t * ptemp_1, * ptemp_2;
+#ifdef PREFER_POINTERS
+ // These pointers are used if target platform has autoinc address generators
+ real_t * pring_buffer_2, * pring_buffer_4;
+ real_t * pring_buffer_5, * pring_buffer_6;
+ real_t * pring_buffer_7, * pring_buffer_8;
+ real_t * pring_buffer_9, * pring_buffer_10;
+ const real_t * pqmf_c_1, * pqmf_c_2, * pqmf_c_3, * pqmf_c_4;
+ const real_t * pqmf_c_5, * pqmf_c_6, * pqmf_c_7, * pqmf_c_8;
+ const real_t * pqmf_c_9, * pqmf_c_10;
+#endif // #ifdef PREFER_POINTERS
+#ifndef FIXED_POINT
+ real_t scale = 1.f/64.f;
+#endif
+ int32_t n, k, out = 0;
+ uint8_t l;
+
+
+ /* qmf subsample l */
+ for (l = 0; l < sbr->numTimeSlotsRate; l++)
+ {
+ /* shift buffer v */
+ /* buffer is not shifted, we use double ringbuffer */
+ //memmove(qmfs->v + 128, qmfs->v, (1280-128)*sizeof(real_t));
+
+ /* calculate 128 samples */
+#ifndef FIXED_POINT
+
+ pX = X[l];
+
+ in_imag1[31] = scale*QMF_RE(pX[1]);
+ in_real1[0] = scale*QMF_RE(pX[0]);
+ in_imag2[31] = scale*QMF_IM(pX[63-1]);
+ in_real2[0] = scale*QMF_IM(pX[63-0]);
+ for (k = 1; k < 31; k++)
+ {
+ in_imag1[31 - k] = scale*QMF_RE(pX[2*k + 1]);
+ in_real1[ k] = scale*QMF_RE(pX[2*k ]);
+ in_imag2[31 - k] = scale*QMF_IM(pX[63 - (2*k + 1)]);
+ in_real2[ k] = scale*QMF_IM(pX[63 - (2*k )]);
+ }
+ in_imag1[0] = scale*QMF_RE(pX[63]);
+ in_real1[31] = scale*QMF_RE(pX[62]);
+ in_imag2[0] = scale*QMF_IM(pX[63-63]);
+ in_real2[31] = scale*QMF_IM(pX[63-62]);
+
+#else
+
+ pX = X[l];
+
+ in_imag1[31] = QMF_RE(pX[1]) >> 1;
+ in_real1[0] = QMF_RE(pX[0]) >> 1;
+ in_imag2[31] = QMF_IM(pX[62]) >> 1;
+ in_real2[0] = QMF_IM(pX[63]) >> 1;
+ for (k = 1; k < 31; k++)
+ {
+ in_imag1[31 - k] = QMF_RE(pX[2*k + 1]) >> 1;
+ in_real1[ k] = QMF_RE(pX[2*k ]) >> 1;
+ in_imag2[31 - k] = QMF_IM(pX[63 - (2*k + 1)]) >> 1;
+ in_real2[ k] = QMF_IM(pX[63 - (2*k )]) >> 1;
+ }
+ in_imag1[0] = QMF_RE(pX[63]) >> 1;
+ in_real1[31] = QMF_RE(pX[62]) >> 1;
+ in_imag2[0] = QMF_IM(pX[0]) >> 1;
+ in_real2[31] = QMF_IM(pX[1]) >> 1;
+
+#endif
+
+
+ // dct4_kernel is DCT_IV without reordering which is done before and after FFT
+ dct4_kernel(in_real1, in_imag1, out_real1, out_imag1);
+ dct4_kernel(in_real2, in_imag2, out_real2, out_imag2);
+
+
+ pring_buffer_1 = qmfs->v + qmfs->v_index;
+ pring_buffer_3 = pring_buffer_1 + 1280;
+#ifdef PREFER_POINTERS
+ pring_buffer_2 = pring_buffer_1 + 127;
+ pring_buffer_4 = pring_buffer_1 + (1280 + 127);
+#endif // #ifdef PREFER_POINTERS
+// ptemp_1 = x1;
+// ptemp_2 = x2;
+#ifdef PREFER_POINTERS
+ for (n = 0; n < 32; n ++)
+ {
+ //real_t x1 = *ptemp_1++;
+ //real_t x2 = *ptemp_2++;
+ // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer
+ *pring_buffer_1++ = *pring_buffer_3++ = out_real2[n] - out_real1[n];
+ *pring_buffer_2-- = *pring_buffer_4-- = out_real2[n] + out_real1[n];
+ //x1 = *ptemp_1++;
+ //x2 = *ptemp_2++;
+ *pring_buffer_1++ = *pring_buffer_3++ = out_imag2[31-n] + out_imag1[31-n];
+ *pring_buffer_2-- = *pring_buffer_4-- = out_imag2[31-n] - out_imag1[31-n];
+ }
+#else // #ifdef PREFER_POINTERS
+
+ for (n = 0; n < 32; n++)
+ {
+ // pring_buffer_3 and pring_buffer_4 are needed only for double ring buffer
+ pring_buffer_1[2*n] = pring_buffer_3[2*n] = out_real2[n] - out_real1[n];
+ pring_buffer_1[127-2*n] = pring_buffer_3[127-2*n] = out_real2[n] + out_real1[n];
+ pring_buffer_1[2*n+1] = pring_buffer_3[2*n+1] = out_imag2[31-n] + out_imag1[31-n];
+ pring_buffer_1[127-(2*n+1)] = pring_buffer_3[127-(2*n+1)] = out_imag2[31-n] - out_imag1[31-n];
+ }
+
+#endif // #ifdef PREFER_POINTERS
+
+ pring_buffer_1 = qmfs->v + qmfs->v_index;
+#ifdef PREFER_POINTERS
+ pring_buffer_2 = pring_buffer_1 + 192;
+ pring_buffer_3 = pring_buffer_1 + 256;
+ pring_buffer_4 = pring_buffer_1 + (256 + 192);
+ pring_buffer_5 = pring_buffer_1 + 512;
+ pring_buffer_6 = pring_buffer_1 + (512 + 192);
+ pring_buffer_7 = pring_buffer_1 + 768;
+ pring_buffer_8 = pring_buffer_1 + (768 + 192);
+ pring_buffer_9 = pring_buffer_1 + 1024;
+ pring_buffer_10 = pring_buffer_1 + (1024 + 192);
+ pqmf_c_1 = qmf_c;
+ pqmf_c_2 = qmf_c + 64;
+ pqmf_c_3 = qmf_c + 128;
+ pqmf_c_4 = qmf_c + 192;
+ pqmf_c_5 = qmf_c + 256;
+ pqmf_c_6 = qmf_c + 320;
+ pqmf_c_7 = qmf_c + 384;
+ pqmf_c_8 = qmf_c + 448;
+ pqmf_c_9 = qmf_c + 512;
+ pqmf_c_10 = qmf_c + 576;
+#endif // #ifdef PREFER_POINTERS
+
+ /* calculate 64 output samples and window */
+ for (k = 0; k < 64; k++)
+ {
+#ifdef PREFER_POINTERS
+ output[out++] =
+ MUL_F(*pring_buffer_1++, *pqmf_c_1++) +
+ MUL_F(*pring_buffer_2++, *pqmf_c_2++) +
+ MUL_F(*pring_buffer_3++, *pqmf_c_3++) +
+ MUL_F(*pring_buffer_4++, *pqmf_c_4++) +
+ MUL_F(*pring_buffer_5++, *pqmf_c_5++) +
+ MUL_F(*pring_buffer_6++, *pqmf_c_6++) +
+ MUL_F(*pring_buffer_7++, *pqmf_c_7++) +
+ MUL_F(*pring_buffer_8++, *pqmf_c_8++) +
+ MUL_F(*pring_buffer_9++, *pqmf_c_9++) +
+ MUL_F(*pring_buffer_10++, *pqmf_c_10++);
+#else // #ifdef PREFER_POINTERS
+ output[out++] =
+ MUL_F(pring_buffer_1[k+0], qmf_c[k+0]) +
+ MUL_F(pring_buffer_1[k+192], qmf_c[k+64]) +
+ MUL_F(pring_buffer_1[k+256], qmf_c[k+128]) +
+ MUL_F(pring_buffer_1[k+(256+192)], qmf_c[k+192]) +
+ MUL_F(pring_buffer_1[k+512], qmf_c[k+256]) +
+ MUL_F(pring_buffer_1[k+(512+192)], qmf_c[k+320]) +
+ MUL_F(pring_buffer_1[k+768], qmf_c[k+384]) +
+ MUL_F(pring_buffer_1[k+(768+192)], qmf_c[k+448]) +
+ MUL_F(pring_buffer_1[k+1024], qmf_c[k+512]) +
+ MUL_F(pring_buffer_1[k+(1024+192)], qmf_c[k+576]);
+#endif // #ifdef PREFER_POINTERS
+ }
+
+ /* update ringbuffer index */
+ qmfs->v_index -= 128;
+ if (qmfs->v_index < 0)
+ qmfs->v_index = (1280 - 128);
+ }
+}
+#endif
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf.h
new file mode 100644
index 000000000..d87871bce
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf.h
@@ -0,0 +1,57 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_qmf.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_QMF_H__
+#define __SBR_QMF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+qmfa_info *qmfa_init(uint8_t channels);
+void qmfa_end(qmfa_info *qmfa);
+qmfs_info *qmfs_init(uint8_t channels);
+void qmfs_end(qmfs_info *qmfs);
+
+void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
+ qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx);
+void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+ real_t *output);
+void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
+ real_t *output);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf_c.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf_c.h
new file mode 100644
index 000000000..f6674df3d
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_qmf_c.h
@@ -0,0 +1,370 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_qmf_c.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_QMF_C_H__
+#define __SBR_QMF_C_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+ALIGN static const real_t qmf_c[640] = {
+ FRAC_CONST(0), FRAC_CONST(-0.00055252865047),
+ FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896),
+ FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498),
+ FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972),
+ FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613),
+ FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938),
+ FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621),
+ FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273),
+ FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222),
+ FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532),
+ FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949),
+ FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927),
+ FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257),
+ FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757),
+ FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525),
+ FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372),
+ FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025),
+ FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906),
+ FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803),
+ FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756),
+ FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344),
+ FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005),
+ FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274),
+ FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041),
+ FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952),
+ FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865),
+ FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015),
+ FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475),
+ FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471),
+ FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224),
+ FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557),
+ FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126),
+ FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465),
+ FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525),
+ FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828),
+ FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104),
+ FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935),
+ FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781),
+ FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118),
+ FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745),
+ FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032),
+ FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982),
+ FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507),
+ FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045),
+ FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164),
+ FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932),
+ FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394),
+ FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897),
+ FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514),
+ FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906),
+ FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447),
+ FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246),
+ FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098),
+ FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321),
+ FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768),
+ FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248),
+ FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664),
+ FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893),
+ FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839),
+ FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624),
+ FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685),
+ FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726),
+ FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986),
+ FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508),
+ FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792),
+ FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989),
+ FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698),
+ FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535),
+ FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285),
+ FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329),
+ FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279),
+ FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337),
+ FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542),
+ FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745),
+ FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367),
+ FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413),
+ FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672),
+ FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216),
+ FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589),
+ FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299),
+ FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761),
+ FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172),
+ FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438),
+ FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228),
+ FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127),
+ FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102),
+ FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803),
+ FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194),
+ FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584),
+ FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119),
+ FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964),
+ FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746),
+ FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536),
+ FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287),
+ FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762),
+ FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903),
+ FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951),
+ FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508),
+ FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387),
+ FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867),
+ FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366),
+ FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701),
+ FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127),
+ FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691),
+ FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909),
+ FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228),
+ FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617),
+ FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304),
+ FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558),
+ FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064),
+ FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822),
+ FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934),
+ FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359),
+ FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279),
+ FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914),
+ FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773),
+ FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878),
+ FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187),
+ FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669),
+ FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142),
+ FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103),
+ FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149),
+ FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974),
+ FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603),
+ FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085),
+ FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916),
+ FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105),
+ FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931),
+ FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061),
+ FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675),
+ FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409),
+ FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665),
+ FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757),
+ FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099),
+ FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434),
+ FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855),
+ FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061),
+ FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923),
+ FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496),
+ FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291),
+ FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286),
+ FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671),
+ FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712),
+ FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032),
+ FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095),
+ FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994),
+ FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488),
+ FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242),
+ FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327),
+ FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392),
+ FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377),
+ FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491),
+ FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468),
+ FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336),
+ FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402),
+ FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722),
+ FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206),
+ FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268),
+ FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147),
+ FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107),
+ FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107),
+ FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147),
+ FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268),
+ FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206),
+ FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722),
+ FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402),
+ FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336),
+ FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468),
+ FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491),
+ FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377),
+ FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392),
+ FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327),
+ FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242),
+ FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488),
+ FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994),
+ FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095),
+ FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032),
+ FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712),
+ FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671),
+ FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286),
+ FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291),
+ FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496),
+ FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923),
+ FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061),
+ FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855),
+ FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434),
+ FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099),
+ FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757),
+ FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665),
+ FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409),
+ FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675),
+ FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061),
+ FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931),
+ FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105),
+ FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916),
+ FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085),
+ FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603),
+ FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974),
+ FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149),
+ FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103),
+ FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142),
+ FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669),
+ FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187),
+ FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878),
+ FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773),
+ FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914),
+ FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279),
+ FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359),
+ FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934),
+ FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822),
+ FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064),
+ FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558),
+ FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304),
+ FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617),
+ FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228),
+ FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909),
+ FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691),
+ FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127),
+ FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701),
+ FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366),
+ FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867),
+ FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387),
+ FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508),
+ FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951),
+ FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903),
+ FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762),
+ FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287),
+ FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536),
+ FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746),
+ FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964),
+ FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119),
+ FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584),
+ FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194),
+ FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803),
+ FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102),
+ FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127),
+ FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228),
+ FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438),
+ FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172),
+ FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761),
+ FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299),
+ FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589),
+ FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216),
+ FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672),
+ FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413),
+ FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367),
+ FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745),
+ FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542),
+ FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337),
+ FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279),
+ FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329),
+ FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285),
+ FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535),
+ FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698),
+ FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989),
+ FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792),
+ FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508),
+ FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986),
+ FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726),
+ FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685),
+ FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624),
+ FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839),
+ FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893),
+ FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664),
+ FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248),
+ FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768),
+ FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321),
+ FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098),
+ FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246),
+ FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447),
+ FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906),
+ FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514),
+ FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897),
+ FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394),
+ FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932),
+ FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164),
+ FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045),
+ FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507),
+ FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982),
+ FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032),
+ FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745),
+ FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118),
+ FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781),
+ FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935),
+ FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104),
+ FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828),
+ FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525),
+ FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465),
+ FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126),
+ FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557),
+ FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224),
+ FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471),
+ FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475),
+ FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015),
+ FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865),
+ FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952),
+ FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041),
+ FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274),
+ FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005),
+ FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344),
+ FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756),
+ FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803),
+ FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906),
+ FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025),
+ FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372),
+ FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525),
+ FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757),
+ FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257),
+ FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927),
+ FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949),
+ FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532),
+ FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222),
+ FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273),
+ FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621),
+ FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938),
+ FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613),
+ FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972),
+ FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498),
+ FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896),
+ FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047)
+};
+
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_syntax.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_syntax.c
new file mode 100644
index 000000000..28ce11150
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_syntax.c
@@ -0,0 +1,885 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_syntax.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include "sbr_syntax.h"
+#include "syntax.h"
+#include "sbr_huff.h"
+#include "sbr_fbt.h"
+#include "sbr_tf_grid.h"
+#include "sbr_e_nf.h"
+#include "bits.h"
+#ifdef PS_DEC
+#include "ps_dec.h"
+#endif
+#ifdef DRM_PS
+#include "drm_dec.h"
+#endif
+#include "analysis.h"
+
+/* static function declarations */
+static void sbr_header(bitfile *ld, sbr_info *sbr);
+static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq,
+ uint8_t samplerate_mode, uint8_t freq_scale,
+ uint8_t alter_scale, uint8_t xover_band);
+static uint8_t sbr_data(bitfile *ld, sbr_info *sbr);
+static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
+ uint8_t bs_extension_id, uint16_t num_bits_left);
+static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr);
+static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch);
+static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch);
+
+
+static void sbr_reset(sbr_info *sbr)
+{
+#if 0
+ printf("%d\n", sbr->bs_start_freq_prev);
+ printf("%d\n", sbr->bs_stop_freq_prev);
+ printf("%d\n", sbr->bs_freq_scale_prev);
+ printf("%d\n", sbr->bs_alter_scale_prev);
+ printf("%d\n", sbr->bs_xover_band_prev);
+ printf("%d\n\n", sbr->bs_noise_bands_prev);
+#endif
+
+ /* if these are different from the previous frame: Reset = 1 */
+ if ((sbr->bs_start_freq != sbr->bs_start_freq_prev) ||
+ (sbr->bs_stop_freq != sbr->bs_stop_freq_prev) ||
+ (sbr->bs_freq_scale != sbr->bs_freq_scale_prev) ||
+ (sbr->bs_alter_scale != sbr->bs_alter_scale_prev) ||
+ (sbr->bs_xover_band != sbr->bs_xover_band_prev) ||
+ (sbr->bs_noise_bands != sbr->bs_noise_bands_prev))
+ {
+ sbr->Reset = 1;
+ } else {
+ sbr->Reset = 0;
+ }
+
+ sbr->bs_start_freq_prev = sbr->bs_start_freq;
+ sbr->bs_stop_freq_prev = sbr->bs_stop_freq;
+ sbr->bs_freq_scale_prev = sbr->bs_freq_scale;
+ sbr->bs_alter_scale_prev = sbr->bs_alter_scale;
+ sbr->bs_xover_band_prev = sbr->bs_xover_band;
+ sbr->bs_noise_bands_prev = sbr->bs_noise_bands;
+}
+
+static uint8_t calc_sbr_tables(sbr_info *sbr, uint8_t start_freq, uint8_t stop_freq,
+ uint8_t samplerate_mode, uint8_t freq_scale,
+ uint8_t alter_scale, uint8_t xover_band)
+{
+ uint8_t result = 0;
+ uint8_t k2;
+
+ /* calculate the Master Frequency Table */
+ sbr->k0 = qmf_start_channel(start_freq, samplerate_mode, sbr->sample_rate);
+ k2 = qmf_stop_channel(stop_freq, sbr->sample_rate, sbr->k0);
+
+ /* check k0 and k2 */
+ if (sbr->sample_rate >= 48000)
+ {
+ if ((k2 - sbr->k0) > 32)
+ result += 1;
+ } else if (sbr->sample_rate <= 32000) {
+ if ((k2 - sbr->k0) > 48)
+ result += 1;
+ } else { /* (sbr->sample_rate == 44100) */
+ if ((k2 - sbr->k0) > 45)
+ result += 1;
+ }
+
+ if (freq_scale == 0)
+ {
+ result += master_frequency_table_fs0(sbr, sbr->k0, k2, alter_scale);
+ } else {
+ result += master_frequency_table(sbr, sbr->k0, k2, freq_scale, alter_scale);
+ }
+ result += derived_frequency_table(sbr, xover_band, k2);
+
+ result = (result > 0) ? 1 : 0;
+
+ return result;
+}
+
+/* table 2 */
+uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt)
+{
+ uint8_t result = 0;
+ uint16_t num_align_bits = 0;
+ uint16_t num_sbr_bits = (uint16_t)faad_get_processed_bits(ld);
+
+ uint8_t saved_start_freq, saved_samplerate_mode;
+ uint8_t saved_stop_freq, saved_freq_scale;
+ uint8_t saved_alter_scale, saved_xover_band;
+
+#ifdef DRM
+ if (!sbr->Is_DRM_SBR)
+#endif
+ {
+ uint8_t bs_extension_type = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,198,"sbr_bitstream(): bs_extension_type"));
+
+ if (bs_extension_type == EXT_SBR_DATA_CRC)
+ {
+ sbr->bs_sbr_crc_bits = (uint16_t)faad_getbits(ld, 10
+ DEBUGVAR(1,199,"sbr_bitstream(): bs_sbr_crc_bits"));
+ }
+ }
+
+ /* save old header values, in case the new ones are corrupted */
+ saved_start_freq = sbr->bs_start_freq;
+ saved_samplerate_mode = sbr->bs_samplerate_mode;
+ saved_stop_freq = sbr->bs_stop_freq;
+ saved_freq_scale = sbr->bs_freq_scale;
+ saved_alter_scale = sbr->bs_alter_scale;
+ saved_xover_band = sbr->bs_xover_band;
+
+ sbr->bs_header_flag = faad_get1bit(ld
+ DEBUGVAR(1,200,"sbr_bitstream(): bs_header_flag"));
+
+ if (sbr->bs_header_flag)
+ sbr_header(ld, sbr);
+
+ /* Reset? */
+ sbr_reset(sbr);
+
+ /* first frame should have a header */
+ //if (!(sbr->frame == 0 && sbr->bs_header_flag == 0))
+ if (sbr->header_count != 0)
+ {
+ if (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked))
+ {
+ uint8_t rt = calc_sbr_tables(sbr, sbr->bs_start_freq, sbr->bs_stop_freq,
+ sbr->bs_samplerate_mode, sbr->bs_freq_scale,
+ sbr->bs_alter_scale, sbr->bs_xover_band);
+
+ /* if an error occured with the new header values revert to the old ones */
+ if (rt > 0)
+ {
+ calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
+ saved_samplerate_mode, saved_freq_scale,
+ saved_alter_scale, saved_xover_band);
+ }
+ }
+
+ if (result == 0)
+ {
+ result = sbr_data(ld, sbr);
+
+ /* sbr_data() returning an error means that there was an error in
+ envelope_time_border_vector().
+ In this case the old time border vector is saved and all the previous
+ data normally read after sbr_grid() is saved.
+ */
+ /* to be on the safe side, calculate old sbr tables in case of error */
+ if ((result > 0) &&
+ (sbr->Reset || (sbr->bs_header_flag && sbr->just_seeked)))
+ {
+ calc_sbr_tables(sbr, saved_start_freq, saved_stop_freq,
+ saved_samplerate_mode, saved_freq_scale,
+ saved_alter_scale, saved_xover_band);
+ }
+
+ /* we should be able to safely set result to 0 now, */
+ /* but practise indicates this doesn't work well */
+ }
+ } else {
+ result = 1;
+ }
+
+
+ num_sbr_bits = (uint16_t)faad_get_processed_bits(ld) - num_sbr_bits;
+
+ /* check if we read more bits then were available for sbr */
+ if (8*cnt < num_sbr_bits) {
+ return 1;
+ }
+
+#ifdef DRM
+ if (!sbr->Is_DRM_SBR)
+#endif
+ {
+ /* -4 does not apply, bs_extension_type is re-read in this function */
+ num_align_bits = 8*cnt /*- 4*/ - num_sbr_bits;
+
+ while (num_align_bits > 7)
+ {
+ faad_getbits(ld, 8
+ DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
+ num_align_bits -= 8;
+ }
+ faad_getbits(ld, num_align_bits
+ DEBUGVAR(1,999,"sbr_bitstream(): num_align_bits"));
+ }
+
+ return result;
+}
+
+/* table 3 */
+static void sbr_header(bitfile *ld, sbr_info *sbr)
+{
+ uint8_t bs_header_extra_1, bs_header_extra_2;
+
+ sbr->header_count++;
+
+ sbr->bs_amp_res = faad_get1bit(ld
+ DEBUGVAR(1,203,"sbr_header(): bs_amp_res"));
+
+ /* bs_start_freq and bs_stop_freq must define a fequency band that does
+ not exceed 48 channels */
+ sbr->bs_start_freq = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,204,"sbr_header(): bs_start_freq"));
+ sbr->bs_stop_freq = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,205,"sbr_header(): bs_stop_freq"));
+ sbr->bs_xover_band = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,206,"sbr_header(): bs_xover_band"));
+ faad_getbits(ld, 2
+ DEBUGVAR(1,207,"sbr_header(): bs_reserved_bits_hdr"));
+ bs_header_extra_1 = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1"));
+ bs_header_extra_2 = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,209,"sbr_header(): bs_header_extra_2"));
+
+ if (bs_header_extra_1)
+ {
+ sbr->bs_freq_scale = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,211,"sbr_header(): bs_freq_scale"));
+ sbr->bs_alter_scale = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,212,"sbr_header(): bs_alter_scale"));
+ sbr->bs_noise_bands = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,213,"sbr_header(): bs_noise_bands"));
+ } else {
+ /* Default values */
+ sbr->bs_freq_scale = 2;
+ sbr->bs_alter_scale = 1;
+ sbr->bs_noise_bands = 2;
+ }
+
+ if (bs_header_extra_2)
+ {
+ sbr->bs_limiter_bands = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands"));
+ sbr->bs_limiter_gains = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains"));
+ sbr->bs_interpol_freq = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq"));
+ sbr->bs_smoothing_mode = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,217,"sbr_header(): bs_smoothing_mode"));
+ } else {
+ /* Default values */
+ sbr->bs_limiter_bands = 2;
+ sbr->bs_limiter_gains = 2;
+ sbr->bs_interpol_freq = 1;
+ sbr->bs_smoothing_mode = 1;
+ }
+
+#if 0
+ /* print the header to screen */
+ printf("bs_amp_res: %d\n", sbr->bs_amp_res);
+ printf("bs_start_freq: %d\n", sbr->bs_start_freq);
+ printf("bs_stop_freq: %d\n", sbr->bs_stop_freq);
+ printf("bs_xover_band: %d\n", sbr->bs_xover_band);
+ if (bs_header_extra_1)
+ {
+ printf("bs_freq_scale: %d\n", sbr->bs_freq_scale);
+ printf("bs_alter_scale: %d\n", sbr->bs_alter_scale);
+ printf("bs_noise_bands: %d\n", sbr->bs_noise_bands);
+ }
+ if (bs_header_extra_2)
+ {
+ printf("bs_limiter_bands: %d\n", sbr->bs_limiter_bands);
+ printf("bs_limiter_gains: %d\n", sbr->bs_limiter_gains);
+ printf("bs_interpol_freq: %d\n", sbr->bs_interpol_freq);
+ printf("bs_smoothing_mode: %d\n", sbr->bs_smoothing_mode);
+ }
+ printf("\n");
+#endif
+}
+
+/* table 4 */
+static uint8_t sbr_data(bitfile *ld, sbr_info *sbr)
+{
+ uint8_t result;
+#if 0
+ sbr->bs_samplerate_mode = faad_get1bit(ld
+ DEBUGVAR(1,219,"sbr_data(): bs_samplerate_mode"));
+#endif
+
+ sbr->rate = (sbr->bs_samplerate_mode) ? 2 : 1;
+
+ switch (sbr->id_aac)
+ {
+ case ID_SCE:
+ if ((result = sbr_single_channel_element(ld, sbr)) > 0)
+ return result;
+ break;
+ case ID_CPE:
+ if ((result = sbr_channel_pair_element(ld, sbr)) > 0)
+ return result;
+ break;
+ }
+
+ return 0;
+}
+
+/* table 5 */
+static uint8_t sbr_single_channel_element(bitfile *ld, sbr_info *sbr)
+{
+ uint8_t result;
+
+ if (faad_get1bit(ld
+ DEBUGVAR(1,220,"sbr_single_channel_element(): bs_data_extra")))
+ {
+ faad_getbits(ld, 4
+ DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved_bits_data"));
+ }
+
+#ifdef DRM
+ /* bs_coupling, from sbr_channel_pair_base_element(bs_amp_res) */
+ if (sbr->Is_DRM_SBR)
+ {
+ faad_get1bit(ld);
+ }
+#endif
+
+ if ((result = sbr_grid(ld, sbr, 0)) > 0)
+ return result;
+
+ sbr_dtdf(ld, sbr, 0);
+ invf_mode(ld, sbr, 0);
+ sbr_envelope(ld, sbr, 0);
+ sbr_noise(ld, sbr, 0);
+
+#ifndef FIXED_POINT
+ envelope_noise_dequantisation(sbr, 0);
+#endif
+
+ memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
+
+ sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
+ DEBUGVAR(1,223,"sbr_single_channel_element(): bs_add_harmonic_flag[0]"));
+ if (sbr->bs_add_harmonic_flag[0])
+ sinusoidal_coding(ld, sbr, 0);
+
+ sbr->bs_extended_data = faad_get1bit(ld
+ DEBUGVAR(1,224,"sbr_single_channel_element(): bs_extended_data[0]"));
+
+ if (sbr->bs_extended_data)
+ {
+ uint16_t nr_bits_left;
+#if (defined(PS_DEC) || defined(DRM_PS))
+ uint8_t ps_ext_read = 0;
+#endif
+ uint16_t cnt = (uint16_t)faad_getbits(ld, 4
+ DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size"));
+ if (cnt == 15)
+ {
+ cnt += (uint16_t)faad_getbits(ld, 8
+ DEBUGVAR(1,226,"sbr_single_channel_element(): bs_esc_count"));
+ }
+
+ nr_bits_left = 8 * cnt;
+ while (nr_bits_left > 7)
+ {
+ uint16_t tmp_nr_bits = 0;
+
+ sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id"));
+ tmp_nr_bits += 2;
+
+ /* allow only 1 PS extension element per extension data */
+#if (defined(PS_DEC) || defined(DRM_PS))
+#if (defined(PS_DEC) && defined(DRM_PS))
+ if (sbr->bs_extension_id == EXTENSION_ID_PS || sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
+#else
+#ifdef PS_DEC
+ if (sbr->bs_extension_id == EXTENSION_ID_PS)
+#else
+#ifdef DRM_PS
+ if (sbr->bs_extension_id == DRM_PARAMETRIC_STEREO)
+#endif
+#endif
+#endif
+ {
+ if (ps_ext_read == 0)
+ {
+ ps_ext_read = 1;
+ } else {
+ /* to be safe make it 3, will switch to "default"
+ * in sbr_extension() */
+#ifdef DRM
+ return 1;
+#else
+ sbr->bs_extension_id = 3;
+#endif
+ }
+ }
+#endif
+
+ tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
+
+ /* check if the data read is bigger than the number of available bits */
+ if (tmp_nr_bits > nr_bits_left)
+ return 1;
+
+ nr_bits_left -= tmp_nr_bits;
+ }
+
+ /* Corrigendum */
+ if (nr_bits_left > 0)
+ {
+ faad_getbits(ld, nr_bits_left
+ DEBUGVAR(1,280,"sbr_single_channel_element(): nr_bits_left"));
+ }
+ }
+
+ return 0;
+}
+
+/* table 6 */
+static uint8_t sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
+{
+ uint8_t n, result;
+
+ if (faad_get1bit(ld
+ DEBUGVAR(1,228,"sbr_single_channel_element(): bs_data_extra")))
+ {
+ faad_getbits(ld, 4
+ DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data"));
+ faad_getbits(ld, 4
+ DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_reserved_bits_data"));
+ }
+
+ sbr->bs_coupling = faad_get1bit(ld
+ DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_coupling"));
+
+ if (sbr->bs_coupling)
+ {
+ if ((result = sbr_grid(ld, sbr, 0)) > 0)
+ return result;
+
+ /* need to copy some data from left to right */
+ sbr->bs_frame_class[1] = sbr->bs_frame_class[0];
+ sbr->L_E[1] = sbr->L_E[0];
+ sbr->L_Q[1] = sbr->L_Q[0];
+ sbr->bs_pointer[1] = sbr->bs_pointer[0];
+
+ for (n = 0; n <= sbr->L_E[0]; n++)
+ {
+ sbr->t_E[1][n] = sbr->t_E[0][n];
+ sbr->f[1][n] = sbr->f[0][n];
+ }
+ for (n = 0; n <= sbr->L_Q[0]; n++)
+ sbr->t_Q[1][n] = sbr->t_Q[0][n];
+
+ sbr_dtdf(ld, sbr, 0);
+ sbr_dtdf(ld, sbr, 1);
+ invf_mode(ld, sbr, 0);
+
+ /* more copying */
+ for (n = 0; n < sbr->N_Q; n++)
+ sbr->bs_invf_mode[1][n] = sbr->bs_invf_mode[0][n];
+
+ sbr_envelope(ld, sbr, 0);
+ sbr_noise(ld, sbr, 0);
+ sbr_envelope(ld, sbr, 1);
+ sbr_noise(ld, sbr, 1);
+
+ memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
+ memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t));
+
+ sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
+ DEBUGVAR(1,231,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
+ if (sbr->bs_add_harmonic_flag[0])
+ sinusoidal_coding(ld, sbr, 0);
+
+ sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
+ DEBUGVAR(1,232,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
+ if (sbr->bs_add_harmonic_flag[1])
+ sinusoidal_coding(ld, sbr, 1);
+ } else {
+ uint8_t saved_t_E[6] = {0}, saved_t_Q[3] = {0};
+ uint8_t saved_L_E = sbr->L_E[0];
+ uint8_t saved_L_Q = sbr->L_Q[0];
+ uint8_t saved_frame_class = sbr->bs_frame_class[0];
+
+ for (n = 0; n < saved_L_E; n++)
+ saved_t_E[n] = sbr->t_E[0][n];
+ for (n = 0; n < saved_L_Q; n++)
+ saved_t_Q[n] = sbr->t_Q[0][n];
+
+ if ((result = sbr_grid(ld, sbr, 0)) > 0)
+ return result;
+ if ((result = sbr_grid(ld, sbr, 1)) > 0)
+ {
+ /* restore first channel data as well */
+ sbr->bs_frame_class[0] = saved_frame_class;
+ sbr->L_E[0] = saved_L_E;
+ sbr->L_Q[0] = saved_L_Q;
+ for (n = 0; n < 6; n++)
+ sbr->t_E[0][n] = saved_t_E[n];
+ for (n = 0; n < 3; n++)
+ sbr->t_Q[0][n] = saved_t_Q[n];
+
+ return result;
+ }
+ sbr_dtdf(ld, sbr, 0);
+ sbr_dtdf(ld, sbr, 1);
+ invf_mode(ld, sbr, 0);
+ invf_mode(ld, sbr, 1);
+ sbr_envelope(ld, sbr, 0);
+ sbr_envelope(ld, sbr, 1);
+ sbr_noise(ld, sbr, 0);
+ sbr_noise(ld, sbr, 1);
+
+ memset(sbr->bs_add_harmonic[0], 0, 64*sizeof(uint8_t));
+ memset(sbr->bs_add_harmonic[1], 0, 64*sizeof(uint8_t));
+
+ sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
+ DEBUGVAR(1,239,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
+ if (sbr->bs_add_harmonic_flag[0])
+ sinusoidal_coding(ld, sbr, 0);
+
+ sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
+ DEBUGVAR(1,240,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
+ if (sbr->bs_add_harmonic_flag[1])
+ sinusoidal_coding(ld, sbr, 1);
+ }
+#ifndef FIXED_POINT
+ envelope_noise_dequantisation(sbr, 0);
+ envelope_noise_dequantisation(sbr, 1);
+
+ if (sbr->bs_coupling)
+ unmap_envelope_noise(sbr);
+#endif
+
+ sbr->bs_extended_data = faad_get1bit(ld
+ DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]"));
+ if (sbr->bs_extended_data)
+ {
+ uint16_t nr_bits_left;
+ uint16_t cnt = (uint16_t)faad_getbits(ld, 4
+ DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size"));
+ if (cnt == 15)
+ {
+ cnt += (uint16_t)faad_getbits(ld, 8
+ DEBUGVAR(1,235,"sbr_channel_pair_element(): bs_esc_count"));
+ }
+
+ nr_bits_left = 8 * cnt;
+ while (nr_bits_left > 7)
+ {
+ uint16_t tmp_nr_bits = 0;
+
+ sbr->bs_extension_id = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id"));
+ tmp_nr_bits += 2;
+ tmp_nr_bits += sbr_extension(ld, sbr, sbr->bs_extension_id, nr_bits_left);
+
+ /* check if the data read is bigger than the number of available bits */
+ if (tmp_nr_bits > nr_bits_left)
+ return 1;
+
+ nr_bits_left -= tmp_nr_bits;
+ }
+
+ /* Corrigendum */
+ if (nr_bits_left > 0)
+ {
+ faad_getbits(ld, nr_bits_left
+ DEBUGVAR(1,280,"sbr_channel_pair_element(): nr_bits_left"));
+ }
+ }
+
+ return 0;
+}
+
+/* integer log[2](x): input range [0,10) */
+static int8_t sbr_log2(const int8_t val)
+{
+ int8_t log2tab[] = { 0, 0, 1, 2, 2, 3, 3, 3, 3, 4 };
+ if (val < 10 && val >= 0)
+ return log2tab[val];
+ else
+ return 0;
+}
+
+
+/* table 7 */
+static uint8_t sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+ uint8_t i, env, rel, result;
+ uint8_t bs_abs_bord, bs_abs_bord_1;
+ uint8_t bs_num_env = 0;
+ uint8_t saved_L_E = sbr->L_E[ch];
+ uint8_t saved_L_Q = sbr->L_Q[ch];
+ uint8_t saved_frame_class = sbr->bs_frame_class[ch];
+
+ sbr->bs_frame_class[ch] = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,248,"sbr_grid(): bs_frame_class"));
+
+ switch (sbr->bs_frame_class[ch])
+ {
+ case FIXFIX:
+ i = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw"));
+
+ bs_num_env = min(1 << i, 5);
+
+ i = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,250,"sbr_grid(): bs_freq_res_flag"));
+ for (env = 0; env < bs_num_env; env++)
+ sbr->f[ch][env] = i;
+
+ sbr->abs_bord_lead[ch] = 0;
+ sbr->abs_bord_trail[ch] = sbr->numTimeSlots;
+ sbr->n_rel_lead[ch] = bs_num_env - 1;
+ sbr->n_rel_trail[ch] = 0;
+ break;
+
+ case FIXVAR:
+ bs_abs_bord = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + sbr->numTimeSlots;
+ bs_num_env = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,252,"sbr_grid(): bs_num_env")) + 1;
+
+ for (rel = 0; rel < bs_num_env-1; rel++)
+ {
+ sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,253,"sbr_grid(): bs_rel_bord")) + 2;
+ }
+ i = sbr_log2(bs_num_env + 1);
+ sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i
+ DEBUGVAR(1,254,"sbr_grid(): bs_pointer"));
+
+ for (env = 0; env < bs_num_env; env++)
+ {
+ sbr->f[ch][bs_num_env - env - 1] = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,255,"sbr_grid(): bs_freq_res"));
+ }
+
+ sbr->abs_bord_lead[ch] = 0;
+ sbr->abs_bord_trail[ch] = bs_abs_bord;
+ sbr->n_rel_lead[ch] = 0;
+ sbr->n_rel_trail[ch] = bs_num_env - 1;
+ break;
+
+ case VARFIX:
+ bs_abs_bord = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord"));
+ bs_num_env = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,257,"sbr_grid(): bs_num_env")) + 1;
+
+ for (rel = 0; rel < bs_num_env-1; rel++)
+ {
+ sbr->bs_rel_bord[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,258,"sbr_grid(): bs_rel_bord")) + 2;
+ }
+ i = sbr_log2(bs_num_env + 1);
+ sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i
+ DEBUGVAR(1,259,"sbr_grid(): bs_pointer"));
+
+ for (env = 0; env < bs_num_env; env++)
+ {
+ sbr->f[ch][env] = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,260,"sbr_grid(): bs_freq_res"));
+ }
+
+ sbr->abs_bord_lead[ch] = bs_abs_bord;
+ sbr->abs_bord_trail[ch] = sbr->numTimeSlots;
+ sbr->n_rel_lead[ch] = bs_num_env - 1;
+ sbr->n_rel_trail[ch] = 0;
+ break;
+
+ case VARVAR:
+ bs_abs_bord = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0"));
+ bs_abs_bord_1 = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + sbr->numTimeSlots;
+ sbr->bs_num_rel_0[ch] = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0"));
+ sbr->bs_num_rel_1[ch] = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,264,"sbr_grid(): bs_num_rel_1"));
+
+ bs_num_env = min(5, sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 1);
+
+ for (rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++)
+ {
+ sbr->bs_rel_bord_0[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,265,"sbr_grid(): bs_rel_bord")) + 2;
+ }
+ for(rel = 0; rel < sbr->bs_num_rel_1[ch]; rel++)
+ {
+ sbr->bs_rel_bord_1[ch][rel] = 2 * (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,266,"sbr_grid(): bs_rel_bord")) + 2;
+ }
+ i = sbr_log2(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2);
+ sbr->bs_pointer[ch] = (uint8_t)faad_getbits(ld, i
+ DEBUGVAR(1,267,"sbr_grid(): bs_pointer"));
+
+ for (env = 0; env < bs_num_env; env++)
+ {
+ sbr->f[ch][env] = (uint8_t)faad_get1bit(ld
+ DEBUGVAR(1,268,"sbr_grid(): bs_freq_res"));
+ }
+
+ sbr->abs_bord_lead[ch] = bs_abs_bord;
+ sbr->abs_bord_trail[ch] = bs_abs_bord_1;
+ sbr->n_rel_lead[ch] = sbr->bs_num_rel_0[ch];
+ sbr->n_rel_trail[ch] = sbr->bs_num_rel_1[ch];
+ break;
+ }
+
+ if (sbr->bs_frame_class[ch] == VARVAR)
+ sbr->L_E[ch] = min(bs_num_env, 5);
+ else
+ sbr->L_E[ch] = min(bs_num_env, 4);
+
+ if (sbr->L_E[ch] <= 0)
+ return 1;
+
+ if (sbr->L_E[ch] > 1)
+ sbr->L_Q[ch] = 2;
+ else
+ sbr->L_Q[ch] = 1;
+
+ /* TODO: this code can probably be integrated into the code above! */
+ if ((result = envelope_time_border_vector(sbr, ch)) > 0)
+ {
+ sbr->bs_frame_class[ch] = saved_frame_class;
+ sbr->L_E[ch] = saved_L_E;
+ sbr->L_Q[ch] = saved_L_Q;
+ return result;
+ }
+ noise_floor_time_border_vector(sbr, ch);
+
+#if 0
+ for (env = 0; env < bs_num_env; env++)
+ {
+ printf("freq_res[ch:%d][env:%d]: %d\n", ch, env, sbr->f[ch][env]);
+ }
+#endif
+
+ return 0;
+}
+
+/* table 8 */
+static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+ uint8_t i;
+
+ for (i = 0; i < sbr->L_E[ch]; i++)
+ {
+ sbr->bs_df_env[ch][i] = faad_get1bit(ld
+ DEBUGVAR(1,269,"sbr_dtdf(): bs_df_env"));
+ }
+
+ for (i = 0; i < sbr->L_Q[ch]; i++)
+ {
+ sbr->bs_df_noise[ch][i] = faad_get1bit(ld
+ DEBUGVAR(1,270,"sbr_dtdf(): bs_df_noise"));
+ }
+}
+
+/* table 9 */
+static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+ uint8_t n;
+
+ for (n = 0; n < sbr->N_Q; n++)
+ {
+ sbr->bs_invf_mode[ch][n] = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,271,"invf_mode(): bs_invf_mode"));
+ }
+}
+
+static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
+ uint8_t bs_extension_id, uint16_t num_bits_left)
+{
+#ifdef PS_DEC
+ uint8_t header;
+ uint16_t ret;
+#endif
+
+ switch (bs_extension_id)
+ {
+#ifdef PS_DEC
+ case EXTENSION_ID_PS:
+ if (!sbr->ps)
+ {
+ sbr->ps = ps_init(get_sr_index(sbr->sample_rate));
+ }
+ ret = ps_data(sbr->ps, ld, &header);
+
+ /* enable PS if and only if: a header has been decoded */
+ if (sbr->ps_used == 0 && header == 1)
+ {
+ sbr->ps_used = 1;
+ }
+
+ return ret;
+#endif
+#ifdef DRM_PS
+ case DRM_PARAMETRIC_STEREO:
+ sbr->ps_used = 1;
+ if (!sbr->drm_ps)
+ {
+ sbr->drm_ps = drm_ps_init();
+ }
+ return drm_ps_data(sbr->drm_ps, ld);
+#endif
+ default:
+ sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
+ DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
+ return 6;
+ }
+}
+
+/* table 12 */
+static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch)
+{
+ uint8_t n;
+
+ for (n = 0; n < sbr->N_high; n++)
+ {
+ sbr->bs_add_harmonic[ch][n] = faad_get1bit(ld
+ DEBUGVAR(1,278,"sinusoidal_coding(): bs_add_harmonic"));
+ }
+}
+
+
+#endif /* SBR_DEC */
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_syntax.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_syntax.h
new file mode 100644
index 000000000..8efeb2264
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_syntax.h
@@ -0,0 +1,69 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_syntax.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_SYNTAX_H__
+#define __SBR_SYNTAX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "bits.h"
+
+#define T_HFGEN 8
+#define T_HFADJ 2
+
+#define EXT_SBR_DATA 13
+#define EXT_SBR_DATA_CRC 14
+
+#define FIXFIX 0
+#define FIXVAR 1
+#define VARFIX 2
+#define VARVAR 3
+
+#define LO_RES 0
+#define HI_RES 1
+
+#define NO_TIME_SLOTS_960 15
+#define NO_TIME_SLOTS 16
+#define RATE 2
+
+#define NOISE_FLOOR_OFFSET 6
+
+
+uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __SBR_SYNTAX_H__ */
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_tf_grid.c b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_tf_grid.c
new file mode 100644
index 000000000..9b1ecdb45
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_tf_grid.c
@@ -0,0 +1,263 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_tf_grid.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/* Time/Frequency grid */
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SBR_DEC
+
+#include <stdlib.h>
+
+#include "sbr_syntax.h"
+#include "sbr_tf_grid.h"
+
+
+/* static function declarations */
+#if 0
+static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l);
+static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l);
+#endif
+static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
+
+
+/* function constructs new time border vector */
+/* first build into temp vector to be able to use previous vector on error */
+uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
+{
+ uint8_t l, border, temp;
+ uint8_t t_E_temp[6] = {0};
+
+ t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch];
+ t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
+
+ switch (sbr->bs_frame_class[ch])
+ {
+ case FIXFIX:
+ switch (sbr->L_E[ch])
+ {
+ case 4:
+ temp = (int) (sbr->numTimeSlots / 4);
+ t_E_temp[3] = sbr->rate * 3 * temp;
+ t_E_temp[2] = sbr->rate * 2 * temp;
+ t_E_temp[1] = sbr->rate * temp;
+ break;
+ case 2:
+ t_E_temp[1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case FIXVAR:
+ if (sbr->L_E[ch] > 1)
+ {
+ int8_t i = sbr->L_E[ch];
+ border = sbr->abs_bord_trail[ch];
+
+ for (l = 0; l < (sbr->L_E[ch] - 1); l++)
+ {
+ if (border < sbr->bs_rel_bord[ch][l])
+ return 1;
+
+ border -= sbr->bs_rel_bord[ch][l];
+ t_E_temp[--i] = sbr->rate * border;
+ }
+ }
+ break;
+
+ case VARFIX:
+ if (sbr->L_E[ch] > 1)
+ {
+ int8_t i = 1;
+ border = sbr->abs_bord_lead[ch];
+
+ for (l = 0; l < (sbr->L_E[ch] - 1); l++)
+ {
+ border += sbr->bs_rel_bord[ch][l];
+
+ if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
+ return 1;
+
+ t_E_temp[i++] = sbr->rate * border;
+ }
+ }
+ break;
+
+ case VARVAR:
+ if (sbr->bs_num_rel_0[ch])
+ {
+ int8_t i = 1;
+ border = sbr->abs_bord_lead[ch];
+
+ for (l = 0; l < sbr->bs_num_rel_0[ch]; l++)
+ {
+ border += sbr->bs_rel_bord_0[ch][l];
+
+ if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
+ return 1;
+
+ t_E_temp[i++] = sbr->rate * border;
+ }
+ }
+
+ if (sbr->bs_num_rel_1[ch])
+ {
+ int8_t i = sbr->L_E[ch];
+ border = sbr->abs_bord_trail[ch];
+
+ for (l = 0; l < sbr->bs_num_rel_1[ch]; l++)
+ {
+ if (border < sbr->bs_rel_bord_1[ch][l])
+ return 1;
+
+ border -= sbr->bs_rel_bord_1[ch][l];
+ t_E_temp[--i] = sbr->rate * border;
+ }
+ }
+ break;
+ }
+
+ /* no error occured, we can safely use this t_E vector */
+ for (l = 0; l < 6; l++)
+ {
+ sbr->t_E[ch][l] = t_E_temp[l];
+ }
+
+ return 0;
+}
+
+void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
+{
+ sbr->t_Q[ch][0] = sbr->t_E[ch][0];
+
+ if (sbr->L_E[ch] == 1)
+ {
+ sbr->t_Q[ch][1] = sbr->t_E[ch][1];
+ sbr->t_Q[ch][2] = 0;
+ } else {
+ uint8_t index = middleBorder(sbr, ch);
+ sbr->t_Q[ch][1] = sbr->t_E[ch][index];
+ sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]];
+ }
+}
+
+#if 0
+static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
+{
+ uint8_t i;
+ int16_t acc = 0;
+
+ switch (sbr->bs_frame_class[ch])
+ {
+ case FIXFIX:
+ return sbr->numTimeSlots/sbr->L_E[ch];
+ case FIXVAR:
+ return 0;
+ case VARFIX:
+ for (i = 0; i < l; i++)
+ {
+ acc += sbr->bs_rel_bord[ch][i];
+ }
+ return acc;
+ case VARVAR:
+ for (i = 0; i < l; i++)
+ {
+ acc += sbr->bs_rel_bord_0[ch][i];
+ }
+ return acc;
+ }
+
+ return 0;
+}
+
+static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
+{
+ uint8_t i;
+ int16_t acc = 0;
+
+ switch (sbr->bs_frame_class[ch])
+ {
+ case FIXFIX:
+ case VARFIX:
+ return 0;
+ case FIXVAR:
+ for (i = 0; i < l; i++)
+ {
+ acc += sbr->bs_rel_bord[ch][i];
+ }
+ return acc;
+ case VARVAR:
+ for (i = 0; i < l; i++)
+ {
+ acc += sbr->bs_rel_bord_1[ch][i];
+ }
+ return acc;
+ }
+
+ return 0;
+}
+#endif
+
+static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
+{
+ int8_t retval = 0;
+
+ switch (sbr->bs_frame_class[ch])
+ {
+ case FIXFIX:
+ retval = sbr->L_E[ch]/2;
+ break;
+ case VARFIX:
+ if (sbr->bs_pointer[ch] == 0)
+ retval = 1;
+ else if (sbr->bs_pointer[ch] == 1)
+ retval = sbr->L_E[ch] - 1;
+ else
+ retval = sbr->bs_pointer[ch] - 1;
+ break;
+ case FIXVAR:
+ case VARVAR:
+ if (sbr->bs_pointer[ch] > 1)
+ retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
+ else
+ retval = sbr->L_E[ch] - 1;
+ break;
+ }
+
+ return (retval > 0) ? retval : 0;
+}
+
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_tf_grid.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_tf_grid.h
new file mode 100644
index 000000000..180ad965a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sbr_tf_grid.h
@@ -0,0 +1,49 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sbr_tf_grid.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SBR_TF_GRID_H__
+#define __SBR_TF_GRID_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch);
+void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/sine_win.h b/src/filters/transform/mpadecfilter/faad2/libfaad/sine_win.h
new file mode 100644
index 000000000..8f062729f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/sine_win.h
@@ -0,0 +1,4306 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: sine_win.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SINE_WIN_H__
+#define __SINE_WIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+ALIGN static const real_t sine_long_1024[] =
+{
+ FRAC_CONST(0.00076699031874270449),
+ FRAC_CONST(0.002300969151425805),
+ FRAC_CONST(0.0038349425697062275),
+ FRAC_CONST(0.0053689069639963425),
+ FRAC_CONST(0.0069028587247297558),
+ FRAC_CONST(0.0084367942423697988),
+ FRAC_CONST(0.0099707099074180308),
+ FRAC_CONST(0.011504602110422714),
+ FRAC_CONST(0.013038467241987334),
+ FRAC_CONST(0.014572301692779064),
+ FRAC_CONST(0.016106101853537287),
+ FRAC_CONST(0.017639864115082053),
+ FRAC_CONST(0.019173584868322623),
+ FRAC_CONST(0.020707260504265895),
+ FRAC_CONST(0.022240887414024961),
+ FRAC_CONST(0.023774461988827555),
+ FRAC_CONST(0.025307980620024571),
+ FRAC_CONST(0.026841439699098531),
+ FRAC_CONST(0.028374835617672099),
+ FRAC_CONST(0.029908164767516555),
+ FRAC_CONST(0.031441423540560301),
+ FRAC_CONST(0.032974608328897335),
+ FRAC_CONST(0.03450771552479575),
+ FRAC_CONST(0.036040741520706229),
+ FRAC_CONST(0.037573682709270494),
+ FRAC_CONST(0.039106535483329888),
+ FRAC_CONST(0.040639296235933736),
+ FRAC_CONST(0.042171961360347947),
+ FRAC_CONST(0.043704527250063421),
+ FRAC_CONST(0.04523699029880459),
+ FRAC_CONST(0.046769346900537863),
+ FRAC_CONST(0.048301593449480144),
+ FRAC_CONST(0.049833726340107277),
+ FRAC_CONST(0.051365741967162593),
+ FRAC_CONST(0.052897636725665324),
+ FRAC_CONST(0.054429407010919133),
+ FRAC_CONST(0.055961049218520569),
+ FRAC_CONST(0.057492559744367566),
+ FRAC_CONST(0.059023934984667931),
+ FRAC_CONST(0.060555171335947788),
+ FRAC_CONST(0.062086265195060088),
+ FRAC_CONST(0.063617212959193106),
+ FRAC_CONST(0.065148011025878833),
+ FRAC_CONST(0.066678655793001557),
+ FRAC_CONST(0.068209143658806329),
+ FRAC_CONST(0.069739471021907307),
+ FRAC_CONST(0.071269634281296401),
+ FRAC_CONST(0.072799629836351673),
+ FRAC_CONST(0.074329454086845756),
+ FRAC_CONST(0.075859103432954447),
+ FRAC_CONST(0.077388574275265049),
+ FRAC_CONST(0.078917863014784942),
+ FRAC_CONST(0.080446966052950014),
+ FRAC_CONST(0.081975879791633066),
+ FRAC_CONST(0.083504600633152432),
+ FRAC_CONST(0.085033124980280275),
+ FRAC_CONST(0.08656144923625117),
+ FRAC_CONST(0.088089569804770507),
+ FRAC_CONST(0.089617483090022959),
+ FRAC_CONST(0.091145185496681005),
+ FRAC_CONST(0.09267267342991331),
+ FRAC_CONST(0.094199943295393204),
+ FRAC_CONST(0.095726991499307162),
+ FRAC_CONST(0.097253814448363271),
+ FRAC_CONST(0.098780408549799623),
+ FRAC_CONST(0.10030677021139286),
+ FRAC_CONST(0.10183289584146653),
+ FRAC_CONST(0.10335878184889961),
+ FRAC_CONST(0.10488442464313497),
+ FRAC_CONST(0.10640982063418768),
+ FRAC_CONST(0.10793496623265365),
+ FRAC_CONST(0.10945985784971798),
+ FRAC_CONST(0.11098449189716339),
+ FRAC_CONST(0.11250886478737869),
+ FRAC_CONST(0.1140329729333672),
+ FRAC_CONST(0.11555681274875526),
+ FRAC_CONST(0.11708038064780059),
+ FRAC_CONST(0.11860367304540072),
+ FRAC_CONST(0.1201266863571015),
+ FRAC_CONST(0.12164941699910553),
+ FRAC_CONST(0.12317186138828048),
+ FRAC_CONST(0.12469401594216764),
+ FRAC_CONST(0.12621587707899035),
+ FRAC_CONST(0.12773744121766231),
+ FRAC_CONST(0.12925870477779614),
+ FRAC_CONST(0.13077966417971171),
+ FRAC_CONST(0.13230031584444465),
+ FRAC_CONST(0.13382065619375472),
+ FRAC_CONST(0.13534068165013421),
+ FRAC_CONST(0.13686038863681638),
+ FRAC_CONST(0.13837977357778389),
+ FRAC_CONST(0.13989883289777721),
+ FRAC_CONST(0.14141756302230302),
+ FRAC_CONST(0.14293596037764267),
+ FRAC_CONST(0.14445402139086047),
+ FRAC_CONST(0.14597174248981221),
+ FRAC_CONST(0.14748912010315357),
+ FRAC_CONST(0.14900615066034845),
+ FRAC_CONST(0.1505228305916774),
+ FRAC_CONST(0.15203915632824605),
+ FRAC_CONST(0.15355512430199345),
+ FRAC_CONST(0.15507073094570051),
+ FRAC_CONST(0.15658597269299843),
+ FRAC_CONST(0.15810084597837698),
+ FRAC_CONST(0.15961534723719306),
+ FRAC_CONST(0.16112947290567881),
+ FRAC_CONST(0.16264321942095031),
+ FRAC_CONST(0.16415658322101581),
+ FRAC_CONST(0.16566956074478412),
+ FRAC_CONST(0.16718214843207294),
+ FRAC_CONST(0.16869434272361733),
+ FRAC_CONST(0.17020614006107807),
+ FRAC_CONST(0.17171753688704997),
+ FRAC_CONST(0.17322852964507032),
+ FRAC_CONST(0.1747391147796272),
+ FRAC_CONST(0.17624928873616788),
+ FRAC_CONST(0.17775904796110717),
+ FRAC_CONST(0.17926838890183575),
+ FRAC_CONST(0.18077730800672859),
+ FRAC_CONST(0.1822858017251533),
+ FRAC_CONST(0.18379386650747845),
+ FRAC_CONST(0.1853014988050819),
+ FRAC_CONST(0.18680869507035927),
+ FRAC_CONST(0.18831545175673212),
+ FRAC_CONST(0.18982176531865641),
+ FRAC_CONST(0.1913276322116309),
+ FRAC_CONST(0.19283304889220523),
+ FRAC_CONST(0.1943380118179886),
+ FRAC_CONST(0.19584251744765785),
+ FRAC_CONST(0.19734656224096592),
+ FRAC_CONST(0.19885014265875009),
+ FRAC_CONST(0.20035325516294045),
+ FRAC_CONST(0.20185589621656805),
+ FRAC_CONST(0.20335806228377332),
+ FRAC_CONST(0.20485974982981442),
+ FRAC_CONST(0.20636095532107551),
+ FRAC_CONST(0.20786167522507507),
+ FRAC_CONST(0.20936190601047416),
+ FRAC_CONST(0.21086164414708486),
+ FRAC_CONST(0.21236088610587842),
+ FRAC_CONST(0.21385962835899375),
+ FRAC_CONST(0.21535786737974555),
+ FRAC_CONST(0.21685559964263262),
+ FRAC_CONST(0.21835282162334632),
+ FRAC_CONST(0.2198495297987787),
+ FRAC_CONST(0.22134572064703081),
+ FRAC_CONST(0.22284139064742112),
+ FRAC_CONST(0.2243365362804936),
+ FRAC_CONST(0.22583115402802617),
+ FRAC_CONST(0.22732524037303886),
+ FRAC_CONST(0.22881879179980222),
+ FRAC_CONST(0.23031180479384544),
+ FRAC_CONST(0.23180427584196478),
+ FRAC_CONST(0.23329620143223159),
+ FRAC_CONST(0.23478757805400097),
+ FRAC_CONST(0.23627840219791957),
+ FRAC_CONST(0.23776867035593419),
+ FRAC_CONST(0.23925837902129998),
+ FRAC_CONST(0.24074752468858843),
+ FRAC_CONST(0.24223610385369601),
+ FRAC_CONST(0.24372411301385216),
+ FRAC_CONST(0.24521154866762754),
+ FRAC_CONST(0.24669840731494241),
+ FRAC_CONST(0.24818468545707478),
+ FRAC_CONST(0.24967037959666857),
+ FRAC_CONST(0.25115548623774192),
+ FRAC_CONST(0.25264000188569552),
+ FRAC_CONST(0.25412392304732062),
+ FRAC_CONST(0.25560724623080738),
+ FRAC_CONST(0.25708996794575312),
+ FRAC_CONST(0.25857208470317034),
+ FRAC_CONST(0.26005359301549519),
+ FRAC_CONST(0.26153448939659552),
+ FRAC_CONST(0.263014770361779),
+ FRAC_CONST(0.26449443242780163),
+ FRAC_CONST(0.26597347211287559),
+ FRAC_CONST(0.26745188593667762),
+ FRAC_CONST(0.26892967042035726),
+ FRAC_CONST(0.27040682208654482),
+ FRAC_CONST(0.27188333745935972),
+ FRAC_CONST(0.27335921306441868),
+ FRAC_CONST(0.27483444542884394),
+ FRAC_CONST(0.27630903108127108),
+ FRAC_CONST(0.27778296655185769),
+ FRAC_CONST(0.27925624837229118),
+ FRAC_CONST(0.28072887307579719),
+ FRAC_CONST(0.28220083719714756),
+ FRAC_CONST(0.28367213727266843),
+ FRAC_CONST(0.28514276984024867),
+ FRAC_CONST(0.28661273143934779),
+ FRAC_CONST(0.28808201861100413),
+ FRAC_CONST(0.28955062789784303),
+ FRAC_CONST(0.29101855584408509),
+ FRAC_CONST(0.29248579899555388),
+ FRAC_CONST(0.29395235389968466),
+ FRAC_CONST(0.29541821710553201),
+ FRAC_CONST(0.29688338516377827),
+ FRAC_CONST(0.2983478546267414),
+ FRAC_CONST(0.29981162204838335),
+ FRAC_CONST(0.30127468398431795),
+ FRAC_CONST(0.30273703699181914),
+ FRAC_CONST(0.30419867762982911),
+ FRAC_CONST(0.30565960245896612),
+ FRAC_CONST(0.3071198080415331),
+ FRAC_CONST(0.30857929094152509),
+ FRAC_CONST(0.31003804772463789),
+ FRAC_CONST(0.31149607495827591),
+ FRAC_CONST(0.3129533692115602),
+ FRAC_CONST(0.31440992705533666),
+ FRAC_CONST(0.31586574506218396),
+ FRAC_CONST(0.31732081980642174),
+ FRAC_CONST(0.31877514786411848),
+ FRAC_CONST(0.32022872581309986),
+ FRAC_CONST(0.32168155023295658),
+ FRAC_CONST(0.32313361770505233),
+ FRAC_CONST(0.32458492481253215),
+ FRAC_CONST(0.32603546814033024),
+ FRAC_CONST(0.327485244275178),
+ FRAC_CONST(0.3289342498056122),
+ FRAC_CONST(0.33038248132198278),
+ FRAC_CONST(0.33182993541646111),
+ FRAC_CONST(0.33327660868304793),
+ FRAC_CONST(0.33472249771758122),
+ FRAC_CONST(0.33616759911774452),
+ FRAC_CONST(0.33761190948307462),
+ FRAC_CONST(0.33905542541496964),
+ FRAC_CONST(0.34049814351669716),
+ FRAC_CONST(0.34194006039340219),
+ FRAC_CONST(0.34338117265211504),
+ FRAC_CONST(0.34482147690175929),
+ FRAC_CONST(0.34626096975316001),
+ FRAC_CONST(0.34769964781905138),
+ FRAC_CONST(0.34913750771408497),
+ FRAC_CONST(0.35057454605483751),
+ FRAC_CONST(0.35201075945981908),
+ FRAC_CONST(0.35344614454948081),
+ FRAC_CONST(0.35488069794622279),
+ FRAC_CONST(0.35631441627440241),
+ FRAC_CONST(0.3577472961603419),
+ FRAC_CONST(0.3591793342323365),
+ FRAC_CONST(0.36061052712066227),
+ FRAC_CONST(0.36204087145758418),
+ FRAC_CONST(0.36347036387736376),
+ FRAC_CONST(0.36489900101626732),
+ FRAC_CONST(0.36632677951257359),
+ FRAC_CONST(0.36775369600658198),
+ FRAC_CONST(0.36917974714062002),
+ FRAC_CONST(0.37060492955905167),
+ FRAC_CONST(0.37202923990828501),
+ FRAC_CONST(0.3734526748367803),
+ FRAC_CONST(0.37487523099505754),
+ FRAC_CONST(0.37629690503570479),
+ FRAC_CONST(0.37771769361338564),
+ FRAC_CONST(0.37913759338484732),
+ FRAC_CONST(0.38055660100892852),
+ FRAC_CONST(0.38197471314656722),
+ FRAC_CONST(0.38339192646080866),
+ FRAC_CONST(0.38480823761681288),
+ FRAC_CONST(0.38622364328186298),
+ FRAC_CONST(0.38763814012537273),
+ FRAC_CONST(0.38905172481889438),
+ FRAC_CONST(0.39046439403612659),
+ FRAC_CONST(0.39187614445292235),
+ FRAC_CONST(0.3932869727472964),
+ FRAC_CONST(0.39469687559943356),
+ FRAC_CONST(0.39610584969169627),
+ FRAC_CONST(0.39751389170863233),
+ FRAC_CONST(0.39892099833698291),
+ FRAC_CONST(0.40032716626569009),
+ FRAC_CONST(0.40173239218590501),
+ FRAC_CONST(0.4031366727909953),
+ FRAC_CONST(0.404540004776553),
+ FRAC_CONST(0.40594238484040251),
+ FRAC_CONST(0.40734380968260797),
+ FRAC_CONST(0.40874427600548136),
+ FRAC_CONST(0.41014378051359024),
+ FRAC_CONST(0.41154231991376522),
+ FRAC_CONST(0.41293989091510808),
+ FRAC_CONST(0.4143364902289991),
+ FRAC_CONST(0.41573211456910536),
+ FRAC_CONST(0.41712676065138787),
+ FRAC_CONST(0.4185204251941097),
+ FRAC_CONST(0.41991310491784362),
+ FRAC_CONST(0.42130479654547964),
+ FRAC_CONST(0.42269549680223295),
+ FRAC_CONST(0.42408520241565156),
+ FRAC_CONST(0.4254739101156238),
+ FRAC_CONST(0.42686161663438643),
+ FRAC_CONST(0.42824831870653196),
+ FRAC_CONST(0.42963401306901638),
+ FRAC_CONST(0.43101869646116703),
+ FRAC_CONST(0.43240236562469014),
+ FRAC_CONST(0.43378501730367852),
+ FRAC_CONST(0.43516664824461926),
+ FRAC_CONST(0.4365472551964012),
+ FRAC_CONST(0.43792683491032286),
+ FRAC_CONST(0.43930538414009995),
+ FRAC_CONST(0.4406828996418729),
+ FRAC_CONST(0.4420593781742147),
+ FRAC_CONST(0.44343481649813848),
+ FRAC_CONST(0.44480921137710488),
+ FRAC_CONST(0.44618255957703007),
+ FRAC_CONST(0.44755485786629301),
+ FRAC_CONST(0.44892610301574326),
+ FRAC_CONST(0.45029629179870861),
+ FRAC_CONST(0.45166542099100249),
+ FRAC_CONST(0.45303348737093158),
+ FRAC_CONST(0.45440048771930358),
+ FRAC_CONST(0.45576641881943464),
+ FRAC_CONST(0.45713127745715698),
+ FRAC_CONST(0.45849506042082627),
+ FRAC_CONST(0.45985776450132954),
+ FRAC_CONST(0.46121938649209238),
+ FRAC_CONST(0.46257992318908681),
+ FRAC_CONST(0.46393937139083852),
+ FRAC_CONST(0.4652977278984346),
+ FRAC_CONST(0.46665498951553092),
+ FRAC_CONST(0.46801115304835983),
+ FRAC_CONST(0.46936621530573752),
+ FRAC_CONST(0.4707201730990716),
+ FRAC_CONST(0.47207302324236866),
+ FRAC_CONST(0.47342476255224153),
+ FRAC_CONST(0.47477538784791712),
+ FRAC_CONST(0.47612489595124358),
+ FRAC_CONST(0.47747328368669806),
+ FRAC_CONST(0.47882054788139389),
+ FRAC_CONST(0.48016668536508839),
+ FRAC_CONST(0.48151169297018986),
+ FRAC_CONST(0.48285556753176567),
+ FRAC_CONST(0.48419830588754903),
+ FRAC_CONST(0.48553990487794696),
+ FRAC_CONST(0.48688036134604734),
+ FRAC_CONST(0.48821967213762679),
+ FRAC_CONST(0.48955783410115744),
+ FRAC_CONST(0.49089484408781509),
+ FRAC_CONST(0.49223069895148602),
+ FRAC_CONST(0.49356539554877477),
+ FRAC_CONST(0.49489893073901126),
+ FRAC_CONST(0.49623130138425825),
+ FRAC_CONST(0.49756250434931915),
+ FRAC_CONST(0.49889253650174459),
+ FRAC_CONST(0.50022139471184068),
+ FRAC_CONST(0.50154907585267539),
+ FRAC_CONST(0.50287557680008699),
+ FRAC_CONST(0.50420089443269034),
+ FRAC_CONST(0.50552502563188539),
+ FRAC_CONST(0.50684796728186321),
+ FRAC_CONST(0.5081697162696146),
+ FRAC_CONST(0.50949026948493636),
+ FRAC_CONST(0.51080962382043904),
+ FRAC_CONST(0.51212777617155469),
+ FRAC_CONST(0.51344472343654346),
+ FRAC_CONST(0.5147604625165012),
+ FRAC_CONST(0.51607499031536663),
+ FRAC_CONST(0.51738830373992906),
+ FRAC_CONST(0.51870039969983495),
+ FRAC_CONST(0.52001127510759604),
+ FRAC_CONST(0.52132092687859566),
+ FRAC_CONST(0.52262935193109661),
+ FRAC_CONST(0.5239365471862486),
+ FRAC_CONST(0.52524250956809471),
+ FRAC_CONST(0.52654723600357944),
+ FRAC_CONST(0.52785072342255523),
+ FRAC_CONST(0.52915296875779061),
+ FRAC_CONST(0.53045396894497632),
+ FRAC_CONST(0.53175372092273332),
+ FRAC_CONST(0.53305222163261945),
+ FRAC_CONST(0.53434946801913752),
+ FRAC_CONST(0.53564545702974109),
+ FRAC_CONST(0.53694018561484291),
+ FRAC_CONST(0.5382336507278217),
+ FRAC_CONST(0.53952584932502889),
+ FRAC_CONST(0.54081677836579667),
+ FRAC_CONST(0.54210643481244392),
+ FRAC_CONST(0.5433948156302848),
+ FRAC_CONST(0.54468191778763453),
+ FRAC_CONST(0.54596773825581757),
+ FRAC_CONST(0.54725227400917409),
+ FRAC_CONST(0.54853552202506739),
+ FRAC_CONST(0.54981747928389091),
+ FRAC_CONST(0.55109814276907543),
+ FRAC_CONST(0.55237750946709607),
+ FRAC_CONST(0.55365557636747931),
+ FRAC_CONST(0.55493234046281037),
+ FRAC_CONST(0.55620779874873993),
+ FRAC_CONST(0.55748194822399155),
+ FRAC_CONST(0.55875478589036831),
+ FRAC_CONST(0.56002630875276038),
+ FRAC_CONST(0.56129651381915147),
+ FRAC_CONST(0.56256539810062656),
+ FRAC_CONST(0.56383295861137817),
+ FRAC_CONST(0.56509919236871398),
+ FRAC_CONST(0.56636409639306384),
+ FRAC_CONST(0.56762766770798623),
+ FRAC_CONST(0.56888990334017586),
+ FRAC_CONST(0.5701508003194703),
+ FRAC_CONST(0.57141035567885723),
+ FRAC_CONST(0.57266856645448116),
+ FRAC_CONST(0.57392542968565075),
+ FRAC_CONST(0.57518094241484508),
+ FRAC_CONST(0.57643510168772183),
+ FRAC_CONST(0.5776879045531228),
+ FRAC_CONST(0.57893934806308178),
+ FRAC_CONST(0.58018942927283168),
+ FRAC_CONST(0.58143814524081017),
+ FRAC_CONST(0.58268549302866846),
+ FRAC_CONST(0.58393146970127618),
+ FRAC_CONST(0.58517607232673041),
+ FRAC_CONST(0.5864192979763605),
+ FRAC_CONST(0.58766114372473666),
+ FRAC_CONST(0.58890160664967572),
+ FRAC_CONST(0.59014068383224882),
+ FRAC_CONST(0.59137837235678758),
+ FRAC_CONST(0.59261466931089113),
+ FRAC_CONST(0.59384957178543363),
+ FRAC_CONST(0.59508307687456996),
+ FRAC_CONST(0.59631518167574371),
+ FRAC_CONST(0.59754588328969316),
+ FRAC_CONST(0.59877517882045872),
+ FRAC_CONST(0.60000306537538894),
+ FRAC_CONST(0.6012295400651485),
+ FRAC_CONST(0.60245460000372375),
+ FRAC_CONST(0.60367824230843037),
+ FRAC_CONST(0.60490046409991982),
+ FRAC_CONST(0.60612126250218612),
+ FRAC_CONST(0.60734063464257293),
+ FRAC_CONST(0.60855857765177945),
+ FRAC_CONST(0.60977508866386843),
+ FRAC_CONST(0.61099016481627166),
+ FRAC_CONST(0.61220380324979795),
+ FRAC_CONST(0.61341600110863859),
+ FRAC_CONST(0.61462675554037505),
+ FRAC_CONST(0.61583606369598509),
+ FRAC_CONST(0.61704392272984976),
+ FRAC_CONST(0.61825032979976025),
+ FRAC_CONST(0.61945528206692402),
+ FRAC_CONST(0.62065877669597214),
+ FRAC_CONST(0.62186081085496536),
+ FRAC_CONST(0.62306138171540126),
+ FRAC_CONST(0.62426048645222065),
+ FRAC_CONST(0.62545812224381436),
+ FRAC_CONST(0.62665428627202935),
+ FRAC_CONST(0.62784897572217646),
+ FRAC_CONST(0.629042187783036),
+ FRAC_CONST(0.63023391964686437),
+ FRAC_CONST(0.63142416850940186),
+ FRAC_CONST(0.63261293156987741),
+ FRAC_CONST(0.63380020603101728),
+ FRAC_CONST(0.63498598909904946),
+ FRAC_CONST(0.63617027798371217),
+ FRAC_CONST(0.63735306989825913),
+ FRAC_CONST(0.63853436205946679),
+ FRAC_CONST(0.63971415168764045),
+ FRAC_CONST(0.64089243600662138),
+ FRAC_CONST(0.64206921224379254),
+ FRAC_CONST(0.64324447763008585),
+ FRAC_CONST(0.64441822939998838),
+ FRAC_CONST(0.64559046479154869),
+ FRAC_CONST(0.64676118104638392),
+ FRAC_CONST(0.64793037540968534),
+ FRAC_CONST(0.64909804513022595),
+ FRAC_CONST(0.65026418746036585),
+ FRAC_CONST(0.65142879965605982),
+ FRAC_CONST(0.65259187897686244),
+ FRAC_CONST(0.65375342268593606),
+ FRAC_CONST(0.65491342805005603),
+ FRAC_CONST(0.6560718923396176),
+ FRAC_CONST(0.65722881282864254),
+ FRAC_CONST(0.65838418679478505),
+ FRAC_CONST(0.65953801151933866),
+ FRAC_CONST(0.6606902842872423),
+ FRAC_CONST(0.66184100238708687),
+ FRAC_CONST(0.66299016311112147),
+ FRAC_CONST(0.66413776375526001),
+ FRAC_CONST(0.66528380161908718),
+ FRAC_CONST(0.66642827400586524),
+ FRAC_CONST(0.66757117822254031),
+ FRAC_CONST(0.66871251157974798),
+ FRAC_CONST(0.66985227139182102),
+ FRAC_CONST(0.67099045497679422),
+ FRAC_CONST(0.67212705965641173),
+ FRAC_CONST(0.67326208275613297),
+ FRAC_CONST(0.67439552160513905),
+ FRAC_CONST(0.67552737353633852),
+ FRAC_CONST(0.67665763588637495),
+ FRAC_CONST(0.6777863059956315),
+ FRAC_CONST(0.67891338120823841),
+ FRAC_CONST(0.68003885887207893),
+ FRAC_CONST(0.68116273633879543),
+ FRAC_CONST(0.68228501096379557),
+ FRAC_CONST(0.68340568010625868),
+ FRAC_CONST(0.6845247411291423),
+ FRAC_CONST(0.68564219139918747),
+ FRAC_CONST(0.68675802828692589),
+ FRAC_CONST(0.68787224916668555),
+ FRAC_CONST(0.68898485141659704),
+ FRAC_CONST(0.69009583241859995),
+ FRAC_CONST(0.69120518955844845),
+ FRAC_CONST(0.69231292022571822),
+ FRAC_CONST(0.69341902181381176),
+ FRAC_CONST(0.69452349171996552),
+ FRAC_CONST(0.69562632734525487),
+ FRAC_CONST(0.6967275260946012),
+ FRAC_CONST(0.69782708537677729),
+ FRAC_CONST(0.69892500260441415),
+ FRAC_CONST(0.70002127519400625),
+ FRAC_CONST(0.70111590056591866),
+ FRAC_CONST(0.70220887614439187),
+ FRAC_CONST(0.70330019935754873),
+ FRAC_CONST(0.70438986763740041),
+ FRAC_CONST(0.7054778784198521),
+ FRAC_CONST(0.70656422914470951),
+ FRAC_CONST(0.70764891725568435),
+ FRAC_CONST(0.70873194020040065),
+ FRAC_CONST(0.70981329543040084),
+ FRAC_CONST(0.71089298040115168),
+ FRAC_CONST(0.71197099257204999),
+ FRAC_CONST(0.71304732940642923),
+ FRAC_CONST(0.71412198837156471),
+ FRAC_CONST(0.71519496693868001),
+ FRAC_CONST(0.71626626258295312),
+ FRAC_CONST(0.71733587278352173),
+ FRAC_CONST(0.71840379502348972),
+ FRAC_CONST(0.71947002678993299),
+ FRAC_CONST(0.72053456557390527),
+ FRAC_CONST(0.72159740887044366),
+ FRAC_CONST(0.72265855417857561),
+ FRAC_CONST(0.72371799900132339),
+ FRAC_CONST(0.72477574084571128),
+ FRAC_CONST(0.72583177722277037),
+ FRAC_CONST(0.72688610564754497),
+ FRAC_CONST(0.72793872363909862),
+ FRAC_CONST(0.72898962872051931),
+ FRAC_CONST(0.73003881841892615),
+ FRAC_CONST(0.73108629026547423),
+ FRAC_CONST(0.73213204179536129),
+ FRAC_CONST(0.73317607054783274),
+ FRAC_CONST(0.73421837406618817),
+ FRAC_CONST(0.73525894989778673),
+ FRAC_CONST(0.73629779559405306),
+ FRAC_CONST(0.73733490871048279),
+ FRAC_CONST(0.73837028680664851),
+ FRAC_CONST(0.73940392744620576),
+ FRAC_CONST(0.74043582819689802),
+ FRAC_CONST(0.74146598663056329),
+ FRAC_CONST(0.74249440032313918),
+ FRAC_CONST(0.74352106685466912),
+ FRAC_CONST(0.74454598380930725),
+ FRAC_CONST(0.74556914877532543),
+ FRAC_CONST(0.74659055934511731),
+ FRAC_CONST(0.74761021311520515),
+ FRAC_CONST(0.74862810768624533),
+ FRAC_CONST(0.74964424066303348),
+ FRAC_CONST(0.75065860965451059),
+ FRAC_CONST(0.75167121227376843),
+ FRAC_CONST(0.75268204613805523),
+ FRAC_CONST(0.75369110886878121),
+ FRAC_CONST(0.75469839809152439),
+ FRAC_CONST(0.75570391143603588),
+ FRAC_CONST(0.75670764653624567),
+ FRAC_CONST(0.75770960103026808),
+ FRAC_CONST(0.75870977256040739),
+ FRAC_CONST(0.75970815877316344),
+ FRAC_CONST(0.76070475731923692),
+ FRAC_CONST(0.76169956585353527),
+ FRAC_CONST(0.76269258203517787),
+ FRAC_CONST(0.76368380352750187),
+ FRAC_CONST(0.76467322799806714),
+ FRAC_CONST(0.76566085311866239),
+ FRAC_CONST(0.76664667656531038),
+ FRAC_CONST(0.76763069601827327),
+ FRAC_CONST(0.76861290916205827),
+ FRAC_CONST(0.76959331368542294),
+ FRAC_CONST(0.7705719072813807),
+ FRAC_CONST(0.7715486876472063),
+ FRAC_CONST(0.77252365248444133),
+ FRAC_CONST(0.77349679949889905),
+ FRAC_CONST(0.77446812640067086),
+ FRAC_CONST(0.77543763090413043),
+ FRAC_CONST(0.77640531072794039),
+ FRAC_CONST(0.7773711635950562),
+ FRAC_CONST(0.77833518723273309),
+ FRAC_CONST(0.7792973793725303),
+ FRAC_CONST(0.78025773775031659),
+ FRAC_CONST(0.78121626010627609),
+ FRAC_CONST(0.7821729441849129),
+ FRAC_CONST(0.78312778773505731),
+ FRAC_CONST(0.78408078850986995),
+ FRAC_CONST(0.78503194426684808),
+ FRAC_CONST(0.78598125276783015),
+ FRAC_CONST(0.7869287117790017),
+ FRAC_CONST(0.78787431907090011),
+ FRAC_CONST(0.78881807241842017),
+ FRAC_CONST(0.78975996960081907),
+ FRAC_CONST(0.79070000840172161),
+ FRAC_CONST(0.79163818660912577),
+ FRAC_CONST(0.79257450201540758),
+ FRAC_CONST(0.79350895241732666),
+ FRAC_CONST(0.79444153561603059),
+ FRAC_CONST(0.79537224941706119),
+ FRAC_CONST(0.79630109163035911),
+ FRAC_CONST(0.7972280600702687),
+ FRAC_CONST(0.79815315255554375),
+ FRAC_CONST(0.79907636690935235),
+ FRAC_CONST(0.79999770095928191),
+ FRAC_CONST(0.8009171525373443),
+ FRAC_CONST(0.80183471947998131),
+ FRAC_CONST(0.80275039962806916),
+ FRAC_CONST(0.80366419082692409),
+ FRAC_CONST(0.804576090926307),
+ FRAC_CONST(0.80548609778042912),
+ FRAC_CONST(0.80639420924795624),
+ FRAC_CONST(0.80730042319201445),
+ FRAC_CONST(0.80820473748019472),
+ FRAC_CONST(0.80910714998455813),
+ FRAC_CONST(0.81000765858164114),
+ FRAC_CONST(0.81090626115245967),
+ FRAC_CONST(0.81180295558251536),
+ FRAC_CONST(0.81269773976179949),
+ FRAC_CONST(0.81359061158479851),
+ FRAC_CONST(0.81448156895049861),
+ FRAC_CONST(0.81537060976239129),
+ FRAC_CONST(0.81625773192847739),
+ FRAC_CONST(0.81714293336127297),
+ FRAC_CONST(0.81802621197781344),
+ FRAC_CONST(0.81890756569965895),
+ FRAC_CONST(0.81978699245289899),
+ FRAC_CONST(0.82066449016815746),
+ FRAC_CONST(0.82154005678059761),
+ FRAC_CONST(0.82241369022992639),
+ FRAC_CONST(0.82328538846040011),
+ FRAC_CONST(0.82415514942082857),
+ FRAC_CONST(0.82502297106458022),
+ FRAC_CONST(0.82588885134958678),
+ FRAC_CONST(0.82675278823834852),
+ FRAC_CONST(0.8276147796979384),
+ FRAC_CONST(0.82847482370000713),
+ FRAC_CONST(0.82933291822078825),
+ FRAC_CONST(0.83018906124110237),
+ FRAC_CONST(0.83104325074636232),
+ FRAC_CONST(0.83189548472657759),
+ FRAC_CONST(0.83274576117635946),
+ FRAC_CONST(0.83359407809492514),
+ FRAC_CONST(0.83444043348610319),
+ FRAC_CONST(0.83528482535833737),
+ FRAC_CONST(0.83612725172469216),
+ FRAC_CONST(0.83696771060285702),
+ FRAC_CONST(0.83780620001515094),
+ FRAC_CONST(0.8386427179885273),
+ FRAC_CONST(0.83947726255457855),
+ FRAC_CONST(0.84030983174954077),
+ FRAC_CONST(0.84114042361429808),
+ FRAC_CONST(0.84196903619438768),
+ FRAC_CONST(0.84279566754000412),
+ FRAC_CONST(0.84362031570600404),
+ FRAC_CONST(0.84444297875191066),
+ FRAC_CONST(0.84526365474191822),
+ FRAC_CONST(0.84608234174489694),
+ FRAC_CONST(0.84689903783439735),
+ FRAC_CONST(0.84771374108865427),
+ FRAC_CONST(0.84852644959059265),
+ FRAC_CONST(0.84933716142783067),
+ FRAC_CONST(0.85014587469268521),
+ FRAC_CONST(0.85095258748217573),
+ FRAC_CONST(0.85175729789802912),
+ FRAC_CONST(0.85256000404668397),
+ FRAC_CONST(0.85336070403929543),
+ FRAC_CONST(0.85415939599173873),
+ FRAC_CONST(0.85495607802461482),
+ FRAC_CONST(0.85575074826325392),
+ FRAC_CONST(0.85654340483771996),
+ FRAC_CONST(0.85733404588281559),
+ FRAC_CONST(0.85812266953808602),
+ FRAC_CONST(0.8589092739478239),
+ FRAC_CONST(0.85969385726107261),
+ FRAC_CONST(0.86047641763163207),
+ FRAC_CONST(0.86125695321806206),
+ FRAC_CONST(0.86203546218368721),
+ FRAC_CONST(0.86281194269660033),
+ FRAC_CONST(0.86358639292966799),
+ FRAC_CONST(0.86435881106053403),
+ FRAC_CONST(0.86512919527162369),
+ FRAC_CONST(0.86589754375014882),
+ FRAC_CONST(0.86666385468811102),
+ FRAC_CONST(0.86742812628230692),
+ FRAC_CONST(0.86819035673433131),
+ FRAC_CONST(0.86895054425058238),
+ FRAC_CONST(0.86970868704226556),
+ FRAC_CONST(0.87046478332539767),
+ FRAC_CONST(0.8712188313208109),
+ FRAC_CONST(0.8719708292541577),
+ FRAC_CONST(0.8727207753559143),
+ FRAC_CONST(0.87346866786138488),
+ FRAC_CONST(0.8742145050107063),
+ FRAC_CONST(0.87495828504885154),
+ FRAC_CONST(0.8757000062256346),
+ FRAC_CONST(0.87643966679571361),
+ FRAC_CONST(0.87717726501859594),
+ FRAC_CONST(0.87791279915864173),
+ FRAC_CONST(0.87864626748506813),
+ FRAC_CONST(0.87937766827195318),
+ FRAC_CONST(0.88010699979824036),
+ FRAC_CONST(0.88083426034774204),
+ FRAC_CONST(0.88155944820914378),
+ FRAC_CONST(0.8822825616760086),
+ FRAC_CONST(0.88300359904678072),
+ FRAC_CONST(0.88372255862478966),
+ FRAC_CONST(0.8844394387182537),
+ FRAC_CONST(0.88515423764028511),
+ FRAC_CONST(0.88586695370889279),
+ FRAC_CONST(0.88657758524698704),
+ FRAC_CONST(0.88728613058238315),
+ FRAC_CONST(0.88799258804780556),
+ FRAC_CONST(0.88869695598089171),
+ FRAC_CONST(0.88939923272419552),
+ FRAC_CONST(0.89009941662519221),
+ FRAC_CONST(0.89079750603628149),
+ FRAC_CONST(0.89149349931479138),
+ FRAC_CONST(0.89218739482298248),
+ FRAC_CONST(0.89287919092805168),
+ FRAC_CONST(0.89356888600213602),
+ FRAC_CONST(0.89425647842231604),
+ FRAC_CONST(0.89494196657062075),
+ FRAC_CONST(0.89562534883403),
+ FRAC_CONST(0.89630662360447966),
+ FRAC_CONST(0.89698578927886397),
+ FRAC_CONST(0.89766284425904075),
+ FRAC_CONST(0.89833778695183419),
+ FRAC_CONST(0.89901061576903907),
+ FRAC_CONST(0.89968132912742393),
+ FRAC_CONST(0.9003499254487356),
+ FRAC_CONST(0.90101640315970233),
+ FRAC_CONST(0.90168076069203773),
+ FRAC_CONST(0.9023429964824442),
+ FRAC_CONST(0.90300310897261704),
+ FRAC_CONST(0.90366109660924798),
+ FRAC_CONST(0.90431695784402832),
+ FRAC_CONST(0.90497069113365325),
+ FRAC_CONST(0.90562229493982516),
+ FRAC_CONST(0.90627176772925766),
+ FRAC_CONST(0.90691910797367803),
+ FRAC_CONST(0.90756431414983252),
+ FRAC_CONST(0.9082073847394887),
+ FRAC_CONST(0.90884831822943912),
+ FRAC_CONST(0.90948711311150543),
+ FRAC_CONST(0.91012376788254157),
+ FRAC_CONST(0.91075828104443757),
+ FRAC_CONST(0.91139065110412232),
+ FRAC_CONST(0.91202087657356823),
+ FRAC_CONST(0.9126489559697939),
+ FRAC_CONST(0.91327488781486776),
+ FRAC_CONST(0.91389867063591168),
+ FRAC_CONST(0.91452030296510445),
+ FRAC_CONST(0.91513978333968526),
+ FRAC_CONST(0.91575711030195672),
+ FRAC_CONST(0.91637228239928914),
+ FRAC_CONST(0.91698529818412289),
+ FRAC_CONST(0.91759615621397295),
+ FRAC_CONST(0.9182048550514309),
+ FRAC_CONST(0.91881139326416994),
+ FRAC_CONST(0.91941576942494696),
+ FRAC_CONST(0.92001798211160657),
+ FRAC_CONST(0.92061802990708386),
+ FRAC_CONST(0.92121591139940873),
+ FRAC_CONST(0.92181162518170812),
+ FRAC_CONST(0.92240516985220988),
+ FRAC_CONST(0.92299654401424625),
+ FRAC_CONST(0.92358574627625656),
+ FRAC_CONST(0.9241727752517912),
+ FRAC_CONST(0.92475762955951391),
+ FRAC_CONST(0.9253403078232062),
+ FRAC_CONST(0.92592080867176996),
+ FRAC_CONST(0.92649913073923051),
+ FRAC_CONST(0.9270752726647401),
+ FRAC_CONST(0.92764923309258118),
+ FRAC_CONST(0.92822101067216944),
+ FRAC_CONST(0.92879060405805702),
+ FRAC_CONST(0.9293580119099355),
+ FRAC_CONST(0.92992323289263956),
+ FRAC_CONST(0.93048626567614978),
+ FRAC_CONST(0.93104710893559517),
+ FRAC_CONST(0.93160576135125783),
+ FRAC_CONST(0.93216222160857432),
+ FRAC_CONST(0.93271648839814025),
+ FRAC_CONST(0.93326856041571205),
+ FRAC_CONST(0.93381843636221096),
+ FRAC_CONST(0.9343661149437259),
+ FRAC_CONST(0.93491159487151609),
+ FRAC_CONST(0.93545487486201462),
+ FRAC_CONST(0.9359959536368313),
+ FRAC_CONST(0.9365348299227555),
+ FRAC_CONST(0.93707150245175919),
+ FRAC_CONST(0.93760596996099999),
+ FRAC_CONST(0.93813823119282436),
+ FRAC_CONST(0.93866828489477017),
+ FRAC_CONST(0.9391961298195699),
+ FRAC_CONST(0.93972176472515334),
+ FRAC_CONST(0.94024518837465088),
+ FRAC_CONST(0.94076639953639607),
+ FRAC_CONST(0.94128539698392866),
+ FRAC_CONST(0.94180217949599765),
+ FRAC_CONST(0.94231674585656378),
+ FRAC_CONST(0.94282909485480271),
+ FRAC_CONST(0.94333922528510772),
+ FRAC_CONST(0.94384713594709269),
+ FRAC_CONST(0.94435282564559475),
+ FRAC_CONST(0.94485629319067721),
+ FRAC_CONST(0.94535753739763229),
+ FRAC_CONST(0.94585655708698391),
+ FRAC_CONST(0.94635335108449059),
+ FRAC_CONST(0.946847918221148),
+ FRAC_CONST(0.94734025733319194),
+ FRAC_CONST(0.94783036726210101),
+ FRAC_CONST(0.94831824685459909),
+ FRAC_CONST(0.94880389496265838),
+ FRAC_CONST(0.94928731044350201),
+ FRAC_CONST(0.94976849215960668),
+ FRAC_CONST(0.95024743897870523),
+ FRAC_CONST(0.95072414977378961),
+ FRAC_CONST(0.95119862342311323),
+ FRAC_CONST(0.95167085881019386),
+ FRAC_CONST(0.95214085482381583),
+ FRAC_CONST(0.95260861035803324),
+ FRAC_CONST(0.9530741243121722),
+ FRAC_CONST(0.95353739559083328),
+ FRAC_CONST(0.95399842310389449),
+ FRAC_CONST(0.95445720576651349),
+ FRAC_CONST(0.95491374249913052),
+ FRAC_CONST(0.95536803222747024),
+ FRAC_CONST(0.95582007388254542),
+ FRAC_CONST(0.95626986640065814),
+ FRAC_CONST(0.95671740872340305),
+ FRAC_CONST(0.9571626997976701),
+ FRAC_CONST(0.95760573857564624),
+ FRAC_CONST(0.9580465240148186),
+ FRAC_CONST(0.9584850550779761),
+ FRAC_CONST(0.95892133073321306),
+ FRAC_CONST(0.95935534995393079),
+ FRAC_CONST(0.9597871117188399),
+ FRAC_CONST(0.96021661501196343),
+ FRAC_CONST(0.96064385882263847),
+ FRAC_CONST(0.96106884214551935),
+ FRAC_CONST(0.961491563980579),
+ FRAC_CONST(0.9619120233331121),
+ FRAC_CONST(0.9623302192137374),
+ FRAC_CONST(0.96274615063839941),
+ FRAC_CONST(0.96315981662837136),
+ FRAC_CONST(0.96357121621025721),
+ FRAC_CONST(0.96398034841599411),
+ FRAC_CONST(0.96438721228285429),
+ FRAC_CONST(0.9647918068534479),
+ FRAC_CONST(0.96519413117572472),
+ FRAC_CONST(0.96559418430297683),
+ FRAC_CONST(0.96599196529384057),
+ FRAC_CONST(0.96638747321229879),
+ FRAC_CONST(0.96678070712768327),
+ FRAC_CONST(0.96717166611467664),
+ FRAC_CONST(0.96756034925331436),
+ FRAC_CONST(0.9679467556289878),
+ FRAC_CONST(0.9683308843324453),
+ FRAC_CONST(0.96871273445979478),
+ FRAC_CONST(0.9690923051125061),
+ FRAC_CONST(0.96946959539741295),
+ FRAC_CONST(0.96984460442671483),
+ FRAC_CONST(0.97021733131797916),
+ FRAC_CONST(0.97058777519414363),
+ FRAC_CONST(0.97095593518351797),
+ FRAC_CONST(0.97132181041978616),
+ FRAC_CONST(0.97168540004200854),
+ FRAC_CONST(0.9720467031946235),
+ FRAC_CONST(0.97240571902744977),
+ FRAC_CONST(0.97276244669568857),
+ FRAC_CONST(0.97311688535992513),
+ FRAC_CONST(0.97346903418613095),
+ FRAC_CONST(0.9738188923456661),
+ FRAC_CONST(0.97416645901528032),
+ FRAC_CONST(0.97451173337711572),
+ FRAC_CONST(0.97485471461870843),
+ FRAC_CONST(0.97519540193299037),
+ FRAC_CONST(0.97553379451829136),
+ FRAC_CONST(0.97586989157834103),
+ FRAC_CONST(0.97620369232227056),
+ FRAC_CONST(0.97653519596461447),
+ FRAC_CONST(0.97686440172531264),
+ FRAC_CONST(0.97719130882971228),
+ FRAC_CONST(0.97751591650856928),
+ FRAC_CONST(0.97783822399805043),
+ FRAC_CONST(0.97815823053973505),
+ FRAC_CONST(0.97847593538061683),
+ FRAC_CONST(0.97879133777310567),
+ FRAC_CONST(0.97910443697502925),
+ FRAC_CONST(0.97941523224963478),
+ FRAC_CONST(0.97972372286559117),
+ FRAC_CONST(0.98002990809698998),
+ FRAC_CONST(0.98033378722334796),
+ FRAC_CONST(0.98063535952960812),
+ FRAC_CONST(0.98093462430614164),
+ FRAC_CONST(0.98123158084874973),
+ FRAC_CONST(0.98152622845866466),
+ FRAC_CONST(0.9818185664425525),
+ FRAC_CONST(0.98210859411251361),
+ FRAC_CONST(0.98239631078608469),
+ FRAC_CONST(0.98268171578624086),
+ FRAC_CONST(0.98296480844139644),
+ FRAC_CONST(0.98324558808540707),
+ FRAC_CONST(0.98352405405757126),
+ FRAC_CONST(0.98380020570263149),
+ FRAC_CONST(0.98407404237077645),
+ FRAC_CONST(0.9843455634176419),
+ FRAC_CONST(0.9846147682043126),
+ FRAC_CONST(0.9848816560973237),
+ FRAC_CONST(0.98514622646866223),
+ FRAC_CONST(0.98540847869576842),
+ FRAC_CONST(0.98566841216153755),
+ FRAC_CONST(0.98592602625432113),
+ FRAC_CONST(0.98618132036792827),
+ FRAC_CONST(0.98643429390162707),
+ FRAC_CONST(0.98668494626014669),
+ FRAC_CONST(0.98693327685367771),
+ FRAC_CONST(0.98717928509787434),
+ FRAC_CONST(0.98742297041385541),
+ FRAC_CONST(0.98766433222820571),
+ FRAC_CONST(0.98790336997297779),
+ FRAC_CONST(0.98814008308569257),
+ FRAC_CONST(0.98837447100934128),
+ FRAC_CONST(0.98860653319238645),
+ FRAC_CONST(0.98883626908876354),
+ FRAC_CONST(0.98906367815788154),
+ FRAC_CONST(0.98928875986462517),
+ FRAC_CONST(0.98951151367935519),
+ FRAC_CONST(0.98973193907791057),
+ FRAC_CONST(0.98995003554160899),
+ FRAC_CONST(0.9901658025572484),
+ FRAC_CONST(0.99037923961710816),
+ FRAC_CONST(0.99059034621895015),
+ FRAC_CONST(0.99079912186602037),
+ FRAC_CONST(0.99100556606704937),
+ FRAC_CONST(0.99120967833625406),
+ FRAC_CONST(0.99141145819333854),
+ FRAC_CONST(0.99161090516349537),
+ FRAC_CONST(0.99180801877740643),
+ FRAC_CONST(0.99200279857124452),
+ FRAC_CONST(0.99219524408667392),
+ FRAC_CONST(0.99238535487085167),
+ FRAC_CONST(0.99257313047642881),
+ FRAC_CONST(0.99275857046155114),
+ FRAC_CONST(0.99294167438986047),
+ FRAC_CONST(0.99312244183049558),
+ FRAC_CONST(0.99330087235809328),
+ FRAC_CONST(0.99347696555278919),
+ FRAC_CONST(0.99365072100021912),
+ FRAC_CONST(0.99382213829151966),
+ FRAC_CONST(0.99399121702332938),
+ FRAC_CONST(0.99415795679778973),
+ FRAC_CONST(0.99432235722254581),
+ FRAC_CONST(0.9944844179107476),
+ FRAC_CONST(0.99464413848105071),
+ FRAC_CONST(0.99480151855761711),
+ FRAC_CONST(0.99495655777011638),
+ FRAC_CONST(0.99510925575372611),
+ FRAC_CONST(0.99525961214913339),
+ FRAC_CONST(0.9954076266025349),
+ FRAC_CONST(0.99555329876563847),
+ FRAC_CONST(0.99569662829566352),
+ FRAC_CONST(0.99583761485534161),
+ FRAC_CONST(0.99597625811291779),
+ FRAC_CONST(0.99611255774215113),
+ FRAC_CONST(0.99624651342231552),
+ FRAC_CONST(0.99637812483820021),
+ FRAC_CONST(0.99650739168011082),
+ FRAC_CONST(0.9966343136438699),
+ FRAC_CONST(0.996758890430818),
+ FRAC_CONST(0.99688112174781385),
+ FRAC_CONST(0.99700100730723529),
+ FRAC_CONST(0.99711854682697998),
+ FRAC_CONST(0.99723374003046616),
+ FRAC_CONST(0.99734658664663323),
+ FRAC_CONST(0.99745708640994191),
+ FRAC_CONST(0.99756523906037575),
+ FRAC_CONST(0.997671044343441),
+ FRAC_CONST(0.99777450201016782),
+ FRAC_CONST(0.99787561181711015),
+ FRAC_CONST(0.99797437352634699),
+ FRAC_CONST(0.99807078690548234),
+ FRAC_CONST(0.99816485172764624),
+ FRAC_CONST(0.99825656777149518),
+ FRAC_CONST(0.99834593482121237),
+ FRAC_CONST(0.99843295266650844),
+ FRAC_CONST(0.99851762110262221),
+ FRAC_CONST(0.99859993993032037),
+ FRAC_CONST(0.99867990895589909),
+ FRAC_CONST(0.99875752799118334),
+ FRAC_CONST(0.99883279685352799),
+ FRAC_CONST(0.99890571536581829),
+ FRAC_CONST(0.99897628335646982),
+ FRAC_CONST(0.99904450065942929),
+ FRAC_CONST(0.99911036711417489),
+ FRAC_CONST(0.99917388256571638),
+ FRAC_CONST(0.99923504686459585),
+ FRAC_CONST(0.99929385986688779),
+ FRAC_CONST(0.99935032143419944),
+ FRAC_CONST(0.9994044314336713),
+ FRAC_CONST(0.99945618973797734),
+ FRAC_CONST(0.99950559622532531),
+ FRAC_CONST(0.99955265077945699),
+ FRAC_CONST(0.99959735328964838),
+ FRAC_CONST(0.9996397036507102),
+ FRAC_CONST(0.99967970176298793),
+ FRAC_CONST(0.99971734753236219),
+ FRAC_CONST(0.99975264087024884),
+ FRAC_CONST(0.99978558169359921),
+ FRAC_CONST(0.99981616992490041),
+ FRAC_CONST(0.99984440549217524),
+ FRAC_CONST(0.99987028832898295),
+ FRAC_CONST(0.99989381837441849),
+ FRAC_CONST(0.99991499557311347),
+ FRAC_CONST(0.999933819875236),
+ FRAC_CONST(0.99995029123649048),
+ FRAC_CONST(0.99996440961811828),
+ FRAC_CONST(0.99997617498689761),
+ FRAC_CONST(0.9999855873151432),
+ FRAC_CONST(0.99999264658070719),
+ FRAC_CONST(0.99999735276697821),
+ FRAC_CONST(0.99999970586288223)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ALIGN static const real_t sine_long_960[] =
+{
+ FRAC_CONST(0.00081812299560725323),
+ FRAC_CONST(0.0024543667964602917),
+ FRAC_CONST(0.0040906040262347889),
+ FRAC_CONST(0.0057268303042312674),
+ FRAC_CONST(0.0073630412497795667),
+ FRAC_CONST(0.0089992324822505774),
+ FRAC_CONST(0.010635399621067975),
+ FRAC_CONST(0.012271538285719924),
+ FRAC_CONST(0.013907644095770845),
+ FRAC_CONST(0.015543712670873098),
+ FRAC_CONST(0.017179739630778748),
+ FRAC_CONST(0.018815720595351273),
+ FRAC_CONST(0.020451651184577292),
+ FRAC_CONST(0.022087527018578291),
+ FRAC_CONST(0.023723343717622358),
+ FRAC_CONST(0.025359096902135895),
+ FRAC_CONST(0.02699478219271537),
+ FRAC_CONST(0.028630395210139003),
+ FRAC_CONST(0.030265931575378519),
+ FRAC_CONST(0.031901386909610863),
+ FRAC_CONST(0.033536756834229922),
+ FRAC_CONST(0.035172036970858266),
+ FRAC_CONST(0.036807222941358832),
+ FRAC_CONST(0.038442310367846677),
+ FRAC_CONST(0.040077294872700696),
+ FRAC_CONST(0.041712172078575326),
+ FRAC_CONST(0.043346937608412288),
+ FRAC_CONST(0.044981587085452281),
+ FRAC_CONST(0.046616116133246711),
+ FRAC_CONST(0.048250520375669431),
+ FRAC_CONST(0.049884795436928406),
+ FRAC_CONST(0.051518936941577477),
+ FRAC_CONST(0.053152940514528055),
+ FRAC_CONST(0.05478680178106083),
+ FRAC_CONST(0.056420516366837495),
+ FRAC_CONST(0.05805407989791244),
+ FRAC_CONST(0.059687488000744485),
+ FRAC_CONST(0.061320736302208578),
+ FRAC_CONST(0.062953820429607482),
+ FRAC_CONST(0.064586736010683557),
+ FRAC_CONST(0.066219478673630344),
+ FRAC_CONST(0.06785204404710439),
+ FRAC_CONST(0.069484427760236861),
+ FRAC_CONST(0.071116625442645326),
+ FRAC_CONST(0.072748632724445372),
+ FRAC_CONST(0.07438044523626236),
+ FRAC_CONST(0.076012058609243122),
+ FRAC_CONST(0.077643468475067631),
+ FRAC_CONST(0.079274670465960706),
+ FRAC_CONST(0.080905660214703745),
+ FRAC_CONST(0.082536433354646319),
+ FRAC_CONST(0.084166985519717977),
+ FRAC_CONST(0.085797312344439894),
+ FRAC_CONST(0.08742740946393647),
+ FRAC_CONST(0.089057272513947183),
+ FRAC_CONST(0.090686897130838162),
+ FRAC_CONST(0.092316278951613845),
+ FRAC_CONST(0.093945413613928788),
+ FRAC_CONST(0.095574296756099186),
+ FRAC_CONST(0.097202924017114667),
+ FRAC_CONST(0.098831291036649963),
+ FRAC_CONST(0.10045939345507648),
+ FRAC_CONST(0.10208722691347409),
+ FRAC_CONST(0.10371478705364276),
+ FRAC_CONST(0.10534206951811415),
+ FRAC_CONST(0.10696906995016341),
+ FRAC_CONST(0.10859578399382072),
+ FRAC_CONST(0.11022220729388306),
+ FRAC_CONST(0.11184833549592579),
+ FRAC_CONST(0.11347416424631435),
+ FRAC_CONST(0.11509968919221586),
+ FRAC_CONST(0.11672490598161089),
+ FRAC_CONST(0.11834981026330495),
+ FRAC_CONST(0.11997439768694031),
+ FRAC_CONST(0.12159866390300751),
+ FRAC_CONST(0.12322260456285709),
+ FRAC_CONST(0.12484621531871121),
+ FRAC_CONST(0.12646949182367517),
+ FRAC_CONST(0.12809242973174936),
+ FRAC_CONST(0.12971502469784052),
+ FRAC_CONST(0.13133727237777362),
+ FRAC_CONST(0.13295916842830346),
+ FRAC_CONST(0.13458070850712617),
+ FRAC_CONST(0.13620188827289101),
+ FRAC_CONST(0.1378227033852118),
+ FRAC_CONST(0.13944314950467873),
+ FRAC_CONST(0.14106322229286994),
+ FRAC_CONST(0.14268291741236291),
+ FRAC_CONST(0.14430223052674654),
+ FRAC_CONST(0.1459211573006321),
+ FRAC_CONST(0.14753969339966552),
+ FRAC_CONST(0.14915783449053857),
+ FRAC_CONST(0.15077557624100058),
+ FRAC_CONST(0.15239291431987001),
+ FRAC_CONST(0.1540098443970461),
+ FRAC_CONST(0.15562636214352044),
+ FRAC_CONST(0.15724246323138855),
+ FRAC_CONST(0.15885814333386142),
+ FRAC_CONST(0.16047339812527725),
+ FRAC_CONST(0.16208822328111283),
+ FRAC_CONST(0.16370261447799525),
+ FRAC_CONST(0.16531656739371339),
+ FRAC_CONST(0.16693007770722967),
+ FRAC_CONST(0.16854314109869134),
+ FRAC_CONST(0.17015575324944232),
+ FRAC_CONST(0.17176790984203447),
+ FRAC_CONST(0.17337960656023954),
+ FRAC_CONST(0.1749908390890603),
+ FRAC_CONST(0.17660160311474243),
+ FRAC_CONST(0.17821189432478593),
+ FRAC_CONST(0.17982170840795647),
+ FRAC_CONST(0.18143104105429744),
+ FRAC_CONST(0.18303988795514095),
+ FRAC_CONST(0.1846482448031197),
+ FRAC_CONST(0.18625610729217834),
+ FRAC_CONST(0.1878634711175852),
+ FRAC_CONST(0.18947033197594348),
+ FRAC_CONST(0.19107668556520319),
+ FRAC_CONST(0.19268252758467228),
+ FRAC_CONST(0.19428785373502844),
+ FRAC_CONST(0.19589265971833042),
+ FRAC_CONST(0.19749694123802966),
+ FRAC_CONST(0.19910069399898173),
+ FRAC_CONST(0.20070391370745785),
+ FRAC_CONST(0.20230659607115639),
+ FRAC_CONST(0.20390873679921437),
+ FRAC_CONST(0.20551033160221882),
+ FRAC_CONST(0.20711137619221856),
+ FRAC_CONST(0.2087118662827353),
+ FRAC_CONST(0.21031179758877552),
+ FRAC_CONST(0.21191116582684155),
+ FRAC_CONST(0.21350996671494335),
+ FRAC_CONST(0.21510819597260972),
+ FRAC_CONST(0.21670584932089998),
+ FRAC_CONST(0.2183029224824154),
+ FRAC_CONST(0.21989941118131037),
+ FRAC_CONST(0.22149531114330431),
+ FRAC_CONST(0.22309061809569264),
+ FRAC_CONST(0.22468532776735861),
+ FRAC_CONST(0.22627943588878449),
+ FRAC_CONST(0.22787293819206314),
+ FRAC_CONST(0.22946583041090929),
+ FRAC_CONST(0.23105810828067114),
+ FRAC_CONST(0.23264976753834157),
+ FRAC_CONST(0.23424080392256985),
+ FRAC_CONST(0.2358312131736727),
+ FRAC_CONST(0.23742099103364595),
+ FRAC_CONST(0.23901013324617584),
+ FRAC_CONST(0.24059863555665045),
+ FRAC_CONST(0.24218649371217096),
+ FRAC_CONST(0.24377370346156332),
+ FRAC_CONST(0.24536026055538934),
+ FRAC_CONST(0.24694616074595824),
+ FRAC_CONST(0.24853139978733788),
+ FRAC_CONST(0.25011597343536629),
+ FRAC_CONST(0.25169987744766298),
+ FRAC_CONST(0.25328310758364025),
+ FRAC_CONST(0.25486565960451457),
+ FRAC_CONST(0.25644752927331788),
+ FRAC_CONST(0.25802871235490898),
+ FRAC_CONST(0.25960920461598508),
+ FRAC_CONST(0.26118900182509258),
+ FRAC_CONST(0.26276809975263904),
+ FRAC_CONST(0.264346494170904),
+ FRAC_CONST(0.26592418085405067),
+ FRAC_CONST(0.26750115557813692),
+ FRAC_CONST(0.2690774141211269),
+ FRAC_CONST(0.27065295226290209),
+ FRAC_CONST(0.2722277657852728),
+ FRAC_CONST(0.27380185047198918),
+ FRAC_CONST(0.27537520210875299),
+ FRAC_CONST(0.2769478164832283),
+ FRAC_CONST(0.27851968938505312),
+ FRAC_CONST(0.28009081660585067),
+ FRAC_CONST(0.28166119393924061),
+ FRAC_CONST(0.28323081718085019),
+ FRAC_CONST(0.28479968212832563),
+ FRAC_CONST(0.28636778458134327),
+ FRAC_CONST(0.28793512034162105),
+ FRAC_CONST(0.2895016852129294),
+ FRAC_CONST(0.29106747500110264),
+ FRAC_CONST(0.29263248551405047),
+ FRAC_CONST(0.2941967125617686),
+ FRAC_CONST(0.29576015195635058),
+ FRAC_CONST(0.29732279951199847),
+ FRAC_CONST(0.29888465104503475),
+ FRAC_CONST(0.30044570237391266),
+ FRAC_CONST(0.30200594931922808),
+ FRAC_CONST(0.30356538770373032),
+ FRAC_CONST(0.30512401335233358),
+ FRAC_CONST(0.30668182209212791),
+ FRAC_CONST(0.3082388097523906),
+ FRAC_CONST(0.30979497216459695),
+ FRAC_CONST(0.31135030516243201),
+ FRAC_CONST(0.3129048045818012),
+ FRAC_CONST(0.31445846626084178),
+ FRAC_CONST(0.31601128603993378),
+ FRAC_CONST(0.31756325976171151),
+ FRAC_CONST(0.31911438327107416),
+ FRAC_CONST(0.32066465241519732),
+ FRAC_CONST(0.32221406304354389),
+ FRAC_CONST(0.3237626110078754),
+ FRAC_CONST(0.32531029216226293),
+ FRAC_CONST(0.32685710236309828),
+ FRAC_CONST(0.32840303746910487),
+ FRAC_CONST(0.32994809334134939),
+ FRAC_CONST(0.3314922658432522),
+ FRAC_CONST(0.33303555084059877),
+ FRAC_CONST(0.33457794420155085),
+ FRAC_CONST(0.33611944179665709),
+ FRAC_CONST(0.33766003949886464),
+ FRAC_CONST(0.33919973318352969),
+ FRAC_CONST(0.34073851872842903),
+ FRAC_CONST(0.34227639201377064),
+ FRAC_CONST(0.34381334892220483),
+ FRAC_CONST(0.34534938533883547),
+ FRAC_CONST(0.34688449715123082),
+ FRAC_CONST(0.34841868024943456),
+ FRAC_CONST(0.34995193052597684),
+ FRAC_CONST(0.35148424387588523),
+ FRAC_CONST(0.3530156161966958),
+ FRAC_CONST(0.35454604338846402),
+ FRAC_CONST(0.35607552135377557),
+ FRAC_CONST(0.35760404599775775),
+ FRAC_CONST(0.35913161322809023),
+ FRAC_CONST(0.36065821895501554),
+ FRAC_CONST(0.36218385909135092),
+ FRAC_CONST(0.36370852955249849),
+ FRAC_CONST(0.36523222625645668),
+ FRAC_CONST(0.36675494512383078),
+ FRAC_CONST(0.36827668207784414),
+ FRAC_CONST(0.36979743304434909),
+ FRAC_CONST(0.37131719395183754),
+ FRAC_CONST(0.37283596073145214),
+ FRAC_CONST(0.37435372931699717),
+ FRAC_CONST(0.37587049564494951),
+ FRAC_CONST(0.37738625565446909),
+ FRAC_CONST(0.37890100528741022),
+ FRAC_CONST(0.38041474048833229),
+ FRAC_CONST(0.38192745720451066),
+ FRAC_CONST(0.38343915138594736),
+ FRAC_CONST(0.38494981898538222),
+ FRAC_CONST(0.38645945595830333),
+ FRAC_CONST(0.38796805826295838),
+ FRAC_CONST(0.38947562186036483),
+ FRAC_CONST(0.39098214271432141),
+ FRAC_CONST(0.39248761679141814),
+ FRAC_CONST(0.3939920400610481),
+ FRAC_CONST(0.39549540849541737),
+ FRAC_CONST(0.39699771806955625),
+ FRAC_CONST(0.39849896476132979),
+ FRAC_CONST(0.39999914455144892),
+ FRAC_CONST(0.40149825342348083),
+ FRAC_CONST(0.4029962873638599),
+ FRAC_CONST(0.40449324236189854),
+ FRAC_CONST(0.40598911440979762),
+ FRAC_CONST(0.40748389950265762),
+ FRAC_CONST(0.40897759363848879),
+ FRAC_CONST(0.41047019281822261),
+ FRAC_CONST(0.41196169304572178),
+ FRAC_CONST(0.4134520903277914),
+ FRAC_CONST(0.41494138067418929),
+ FRAC_CONST(0.41642956009763715),
+ FRAC_CONST(0.41791662461383078),
+ FRAC_CONST(0.41940257024145089),
+ FRAC_CONST(0.42088739300217382),
+ FRAC_CONST(0.42237108892068231),
+ FRAC_CONST(0.42385365402467584),
+ FRAC_CONST(0.42533508434488143),
+ FRAC_CONST(0.42681537591506419),
+ FRAC_CONST(0.42829452477203828),
+ FRAC_CONST(0.42977252695567697),
+ FRAC_CONST(0.43124937850892364),
+ FRAC_CONST(0.4327250754778022),
+ FRAC_CONST(0.43419961391142781),
+ FRAC_CONST(0.43567298986201736),
+ FRAC_CONST(0.43714519938489987),
+ FRAC_CONST(0.43861623853852766),
+ FRAC_CONST(0.44008610338448595),
+ FRAC_CONST(0.44155478998750436),
+ FRAC_CONST(0.44302229441546676),
+ FRAC_CONST(0.4444886127394222),
+ FRAC_CONST(0.44595374103359531),
+ FRAC_CONST(0.44741767537539667),
+ FRAC_CONST(0.44888041184543348),
+ FRAC_CONST(0.45034194652752002),
+ FRAC_CONST(0.45180227550868812),
+ FRAC_CONST(0.45326139487919759),
+ FRAC_CONST(0.45471930073254679),
+ FRAC_CONST(0.45617598916548296),
+ FRAC_CONST(0.45763145627801283),
+ FRAC_CONST(0.45908569817341294),
+ FRAC_CONST(0.46053871095824001),
+ FRAC_CONST(0.46199049074234161),
+ FRAC_CONST(0.46344103363886635),
+ FRAC_CONST(0.46489033576427435),
+ FRAC_CONST(0.46633839323834758),
+ FRAC_CONST(0.46778520218420055),
+ FRAC_CONST(0.46923075872829029),
+ FRAC_CONST(0.47067505900042683),
+ FRAC_CONST(0.47211809913378361),
+ FRAC_CONST(0.47355987526490806),
+ FRAC_CONST(0.47500038353373153),
+ FRAC_CONST(0.47643962008357982),
+ FRAC_CONST(0.47787758106118372),
+ FRAC_CONST(0.47931426261668875),
+ FRAC_CONST(0.48074966090366611),
+ FRAC_CONST(0.48218377207912272),
+ FRAC_CONST(0.48361659230351117),
+ FRAC_CONST(0.48504811774074069),
+ FRAC_CONST(0.48647834455818684),
+ FRAC_CONST(0.48790726892670194),
+ FRAC_CONST(0.48933488702062544),
+ FRAC_CONST(0.49076119501779414),
+ FRAC_CONST(0.49218618909955225),
+ FRAC_CONST(0.4936098654507618),
+ FRAC_CONST(0.49503222025981269),
+ FRAC_CONST(0.49645324971863303),
+ FRAC_CONST(0.49787295002269943),
+ FRAC_CONST(0.49929131737104687),
+ FRAC_CONST(0.50070834796627917),
+ FRAC_CONST(0.50212403801457872),
+ FRAC_CONST(0.50353838372571758),
+ FRAC_CONST(0.50495138131306638),
+ FRAC_CONST(0.50636302699360547),
+ FRAC_CONST(0.50777331698793449),
+ FRAC_CONST(0.50918224752028263),
+ FRAC_CONST(0.51058981481851906),
+ FRAC_CONST(0.51199601511416237),
+ FRAC_CONST(0.51340084464239111),
+ FRAC_CONST(0.51480429964205421),
+ FRAC_CONST(0.51620637635567967),
+ FRAC_CONST(0.51760707102948678),
+ FRAC_CONST(0.51900637991339404),
+ FRAC_CONST(0.5204042992610306),
+ FRAC_CONST(0.52180082532974559),
+ FRAC_CONST(0.5231959543806185),
+ FRAC_CONST(0.52458968267846895),
+ FRAC_CONST(0.52598200649186677),
+ FRAC_CONST(0.52737292209314235),
+ FRAC_CONST(0.52876242575839572),
+ FRAC_CONST(0.53015051376750777),
+ FRAC_CONST(0.53153718240414882),
+ FRAC_CONST(0.53292242795578992),
+ FRAC_CONST(0.53430624671371152),
+ FRAC_CONST(0.53568863497301467),
+ FRAC_CONST(0.5370695890326298),
+ FRAC_CONST(0.5384491051953274),
+ FRAC_CONST(0.53982717976772743),
+ FRAC_CONST(0.54120380906030963),
+ FRAC_CONST(0.54257898938742311),
+ FRAC_CONST(0.54395271706729609),
+ FRAC_CONST(0.54532498842204646),
+ FRAC_CONST(0.54669579977769045),
+ FRAC_CONST(0.54806514746415402),
+ FRAC_CONST(0.54943302781528081),
+ FRAC_CONST(0.55079943716884383),
+ FRAC_CONST(0.55216437186655387),
+ FRAC_CONST(0.55352782825406999),
+ FRAC_CONST(0.55488980268100907),
+ FRAC_CONST(0.55625029150095584),
+ FRAC_CONST(0.55760929107147217),
+ FRAC_CONST(0.55896679775410718),
+ FRAC_CONST(0.56032280791440714),
+ FRAC_CONST(0.56167731792192455),
+ FRAC_CONST(0.56303032415022869),
+ FRAC_CONST(0.56438182297691453),
+ FRAC_CONST(0.56573181078361312),
+ FRAC_CONST(0.56708028395600085),
+ FRAC_CONST(0.56842723888380908),
+ FRAC_CONST(0.56977267196083425),
+ FRAC_CONST(0.57111657958494688),
+ FRAC_CONST(0.5724589581581021),
+ FRAC_CONST(0.57379980408634845),
+ FRAC_CONST(0.57513911377983773),
+ FRAC_CONST(0.57647688365283478),
+ FRAC_CONST(0.57781311012372738),
+ FRAC_CONST(0.57914778961503466),
+ FRAC_CONST(0.58048091855341843),
+ FRAC_CONST(0.5818124933696911),
+ FRAC_CONST(0.58314251049882604),
+ FRAC_CONST(0.58447096637996743),
+ FRAC_CONST(0.58579785745643886),
+ FRAC_CONST(0.5871231801757536),
+ FRAC_CONST(0.58844693098962408),
+ FRAC_CONST(0.58976910635397084),
+ FRAC_CONST(0.59108970272893235),
+ FRAC_CONST(0.59240871657887517),
+ FRAC_CONST(0.59372614437240179),
+ FRAC_CONST(0.59504198258236196),
+ FRAC_CONST(0.5963562276858605),
+ FRAC_CONST(0.59766887616426767),
+ FRAC_CONST(0.5989799245032289),
+ FRAC_CONST(0.60028936919267273),
+ FRAC_CONST(0.60159720672682204),
+ FRAC_CONST(0.60290343360420195),
+ FRAC_CONST(0.60420804632765002),
+ FRAC_CONST(0.60551104140432543),
+ FRAC_CONST(0.60681241534571839),
+ FRAC_CONST(0.60811216466765883),
+ FRAC_CONST(0.60941028589032709),
+ FRAC_CONST(0.61070677553826169),
+ FRAC_CONST(0.61200163014036979),
+ FRAC_CONST(0.61329484622993602),
+ FRAC_CONST(0.6145864203446314),
+ FRAC_CONST(0.61587634902652377),
+ FRAC_CONST(0.61716462882208556),
+ FRAC_CONST(0.61845125628220421),
+ FRAC_CONST(0.61973622796219074),
+ FRAC_CONST(0.6210195404217892),
+ FRAC_CONST(0.62230119022518593),
+ FRAC_CONST(0.62358117394101897),
+ FRAC_CONST(0.62485948814238634),
+ FRAC_CONST(0.62613612940685637),
+ FRAC_CONST(0.62741109431647646),
+ FRAC_CONST(0.62868437945778133),
+ FRAC_CONST(0.62995598142180387),
+ FRAC_CONST(0.6312258968040827),
+ FRAC_CONST(0.63249412220467238),
+ FRAC_CONST(0.63376065422815175),
+ FRAC_CONST(0.63502548948363347),
+ FRAC_CONST(0.63628862458477287),
+ FRAC_CONST(0.63755005614977711),
+ FRAC_CONST(0.63880978080141437),
+ FRAC_CONST(0.6400677951670225),
+ FRAC_CONST(0.6413240958785188),
+ FRAC_CONST(0.64257867957240766),
+ FRAC_CONST(0.6438315428897915),
+ FRAC_CONST(0.64508268247637779),
+ FRAC_CONST(0.64633209498248945),
+ FRAC_CONST(0.64757977706307335),
+ FRAC_CONST(0.64882572537770888),
+ FRAC_CONST(0.65006993659061751),
+ FRAC_CONST(0.65131240737067142),
+ FRAC_CONST(0.65255313439140239),
+ FRAC_CONST(0.65379211433101081),
+ FRAC_CONST(0.65502934387237444),
+ FRAC_CONST(0.6562648197030575),
+ FRAC_CONST(0.65749853851531959),
+ FRAC_CONST(0.65873049700612374),
+ FRAC_CONST(0.65996069187714679),
+ FRAC_CONST(0.66118911983478657),
+ FRAC_CONST(0.66241577759017178),
+ FRAC_CONST(0.66364066185917048),
+ FRAC_CONST(0.66486376936239888),
+ FRAC_CONST(0.66608509682523009),
+ FRAC_CONST(0.66730464097780284),
+ FRAC_CONST(0.66852239855503071),
+ FRAC_CONST(0.66973836629660977),
+ FRAC_CONST(0.67095254094702894),
+ FRAC_CONST(0.67216491925557675),
+ FRAC_CONST(0.67337549797635199),
+ FRAC_CONST(0.67458427386827102),
+ FRAC_CONST(0.67579124369507693),
+ FRAC_CONST(0.67699640422534846),
+ FRAC_CONST(0.67819975223250772),
+ FRAC_CONST(0.6794012844948305),
+ FRAC_CONST(0.68060099779545302),
+ FRAC_CONST(0.68179888892238183),
+ FRAC_CONST(0.6829949546685018),
+ FRAC_CONST(0.68418919183158522),
+ FRAC_CONST(0.68538159721429948),
+ FRAC_CONST(0.6865721676242168),
+ FRAC_CONST(0.68776089987382172),
+ FRAC_CONST(0.68894779078052026),
+ FRAC_CONST(0.69013283716664853),
+ FRAC_CONST(0.69131603585948032),
+ FRAC_CONST(0.69249738369123692),
+ FRAC_CONST(0.69367687749909468),
+ FRAC_CONST(0.69485451412519361),
+ FRAC_CONST(0.69603029041664599),
+ FRAC_CONST(0.6972042032255451),
+ FRAC_CONST(0.6983762494089728),
+ FRAC_CONST(0.69954642582900894),
+ FRAC_CONST(0.70071472935273893),
+ FRAC_CONST(0.70188115685226271),
+ FRAC_CONST(0.703045705204703),
+ FRAC_CONST(0.70420837129221303),
+ FRAC_CONST(0.70536915200198613),
+ FRAC_CONST(0.70652804422626281),
+ FRAC_CONST(0.70768504486233985),
+ FRAC_CONST(0.70884015081257845),
+ FRAC_CONST(0.70999335898441229),
+ FRAC_CONST(0.711144666290356),
+ FRAC_CONST(0.71229406964801356),
+ FRAC_CONST(0.71344156598008623),
+ FRAC_CONST(0.71458715221438096),
+ FRAC_CONST(0.71573082528381871),
+ FRAC_CONST(0.71687258212644234),
+ FRAC_CONST(0.7180124196854254),
+ FRAC_CONST(0.71915033490907943),
+ FRAC_CONST(0.72028632475086318),
+ FRAC_CONST(0.72142038616938997),
+ FRAC_CONST(0.72255251612843596),
+ FRAC_CONST(0.72368271159694852),
+ FRAC_CONST(0.72481096954905444),
+ FRAC_CONST(0.72593728696406756),
+ FRAC_CONST(0.72706166082649704),
+ FRAC_CONST(0.72818408812605595),
+ FRAC_CONST(0.72930456585766834),
+ FRAC_CONST(0.73042309102147851),
+ FRAC_CONST(0.73153966062285747),
+ FRAC_CONST(0.73265427167241282),
+ FRAC_CONST(0.73376692118599507),
+ FRAC_CONST(0.73487760618470677),
+ FRAC_CONST(0.73598632369490979),
+ FRAC_CONST(0.73709307074823405),
+ FRAC_CONST(0.73819784438158409),
+ FRAC_CONST(0.73930064163714881),
+ FRAC_CONST(0.74040145956240788),
+ FRAC_CONST(0.74150029521014049),
+ FRAC_CONST(0.74259714563843304),
+ FRAC_CONST(0.74369200791068657),
+ FRAC_CONST(0.74478487909562552),
+ FRAC_CONST(0.74587575626730485),
+ FRAC_CONST(0.74696463650511791),
+ FRAC_CONST(0.74805151689380456),
+ FRAC_CONST(0.74913639452345926),
+ FRAC_CONST(0.75021926648953785),
+ FRAC_CONST(0.75130012989286621),
+ FRAC_CONST(0.7523789818396478),
+ FRAC_CONST(0.75345581944147111),
+ FRAC_CONST(0.75453063981531809),
+ FRAC_CONST(0.75560344008357094),
+ FRAC_CONST(0.75667421737402052),
+ FRAC_CONST(0.7577429688198738),
+ FRAC_CONST(0.75880969155976163),
+ FRAC_CONST(0.75987438273774599),
+ FRAC_CONST(0.76093703950332836),
+ FRAC_CONST(0.76199765901145666),
+ FRAC_CONST(0.76305623842253345),
+ FRAC_CONST(0.76411277490242291),
+ FRAC_CONST(0.76516726562245885),
+ FRAC_CONST(0.76621970775945258),
+ FRAC_CONST(0.76727009849569949),
+ FRAC_CONST(0.76831843501898767),
+ FRAC_CONST(0.76936471452260458),
+ FRAC_CONST(0.77040893420534517),
+ FRAC_CONST(0.77145109127151923),
+ FRAC_CONST(0.77249118293095853),
+ FRAC_CONST(0.77352920639902467),
+ FRAC_CONST(0.77456515889661659),
+ FRAC_CONST(0.77559903765017746),
+ FRAC_CONST(0.7766308398917029),
+ FRAC_CONST(0.77766056285874774),
+ FRAC_CONST(0.77868820379443371),
+ FRAC_CONST(0.77971375994745684),
+ FRAC_CONST(0.78073722857209438),
+ FRAC_CONST(0.7817586069282132),
+ FRAC_CONST(0.78277789228127592),
+ FRAC_CONST(0.78379508190234881),
+ FRAC_CONST(0.78481017306810918),
+ FRAC_CONST(0.78582316306085265),
+ FRAC_CONST(0.78683404916849986),
+ FRAC_CONST(0.78784282868460476),
+ FRAC_CONST(0.78884949890836087),
+ FRAC_CONST(0.78985405714460888),
+ FRAC_CONST(0.7908565007038445),
+ FRAC_CONST(0.79185682690222425),
+ FRAC_CONST(0.79285503306157412),
+ FRAC_CONST(0.79385111650939566),
+ FRAC_CONST(0.79484507457887377),
+ FRAC_CONST(0.79583690460888357),
+ FRAC_CONST(0.79682660394399751),
+ FRAC_CONST(0.79781416993449272),
+ FRAC_CONST(0.79879959993635785),
+ FRAC_CONST(0.7997828913113002),
+ FRAC_CONST(0.80076404142675273),
+ FRAC_CONST(0.80174304765588156),
+ FRAC_CONST(0.80271990737759213),
+ FRAC_CONST(0.80369461797653707),
+ FRAC_CONST(0.80466717684312306),
+ FRAC_CONST(0.80563758137351682),
+ FRAC_CONST(0.80660582896965372),
+ FRAC_CONST(0.80757191703924336),
+ FRAC_CONST(0.80853584299577752),
+ FRAC_CONST(0.80949760425853612),
+ FRAC_CONST(0.81045719825259477),
+ FRAC_CONST(0.81141462240883167),
+ FRAC_CONST(0.81236987416393436),
+ FRAC_CONST(0.81332295096040608),
+ FRAC_CONST(0.81427385024657373),
+ FRAC_CONST(0.81522256947659355),
+ FRAC_CONST(0.81616910611045879),
+ FRAC_CONST(0.817113457614006),
+ FRAC_CONST(0.81805562145892186),
+ FRAC_CONST(0.81899559512275044),
+ FRAC_CONST(0.81993337608889916),
+ FRAC_CONST(0.82086896184664637),
+ FRAC_CONST(0.8218023498911472),
+ FRAC_CONST(0.82273353772344116),
+ FRAC_CONST(0.82366252285045805),
+ FRAC_CONST(0.82458930278502529),
+ FRAC_CONST(0.82551387504587381),
+ FRAC_CONST(0.82643623715764558),
+ FRAC_CONST(0.82735638665089983),
+ FRAC_CONST(0.82827432106211907),
+ FRAC_CONST(0.82919003793371693),
+ FRAC_CONST(0.83010353481404364),
+ FRAC_CONST(0.83101480925739324),
+ FRAC_CONST(0.83192385882400965),
+ FRAC_CONST(0.83283068108009373),
+ FRAC_CONST(0.8337352735978093),
+ FRAC_CONST(0.83463763395529011),
+ FRAC_CONST(0.83553775973664579),
+ FRAC_CONST(0.83643564853196872),
+ FRAC_CONST(0.83733129793734051),
+ FRAC_CONST(0.83822470555483797),
+ FRAC_CONST(0.83911586899254031),
+ FRAC_CONST(0.84000478586453453),
+ FRAC_CONST(0.84089145379092289),
+ FRAC_CONST(0.84177587039782842),
+ FRAC_CONST(0.84265803331740163),
+ FRAC_CONST(0.84353794018782702),
+ FRAC_CONST(0.844415588653329),
+ FRAC_CONST(0.8452909763641786),
+ FRAC_CONST(0.84616410097669936),
+ FRAC_CONST(0.84703496015327406),
+ FRAC_CONST(0.84790355156235053),
+ FRAC_CONST(0.84876987287844818),
+ FRAC_CONST(0.8496339217821639),
+ FRAC_CONST(0.85049569596017938),
+ FRAC_CONST(0.85135519310526508),
+ FRAC_CONST(0.85221241091628896),
+ FRAC_CONST(0.85306734709822085),
+ FRAC_CONST(0.85391999936213903),
+ FRAC_CONST(0.85477036542523732),
+ FRAC_CONST(0.85561844301082923),
+ FRAC_CONST(0.85646422984835635),
+ FRAC_CONST(0.85730772367339259),
+ FRAC_CONST(0.85814892222765116),
+ FRAC_CONST(0.85898782325899026),
+ FRAC_CONST(0.85982442452141961),
+ FRAC_CONST(0.86065872377510555),
+ FRAC_CONST(0.86149071878637817),
+ FRAC_CONST(0.8623204073277364),
+ FRAC_CONST(0.86314778717785412),
+ FRAC_CONST(0.8639728561215867),
+ FRAC_CONST(0.86479561194997623),
+ FRAC_CONST(0.86561605246025763),
+ FRAC_CONST(0.86643417545586487),
+ FRAC_CONST(0.8672499787464365),
+ FRAC_CONST(0.86806346014782154),
+ FRAC_CONST(0.8688746174820855),
+ FRAC_CONST(0.86968344857751589),
+ FRAC_CONST(0.87048995126862883),
+ FRAC_CONST(0.87129412339617363),
+ FRAC_CONST(0.87209596280713941),
+ FRAC_CONST(0.8728954673547612),
+ FRAC_CONST(0.87369263489852422),
+ FRAC_CONST(0.87448746330417149),
+ FRAC_CONST(0.87527995044370765),
+ FRAC_CONST(0.8760700941954066),
+ FRAC_CONST(0.87685789244381551),
+ FRAC_CONST(0.87764334307976144),
+ FRAC_CONST(0.87842644400035663),
+ FRAC_CONST(0.8792071931090043),
+ FRAC_CONST(0.87998558831540408),
+ FRAC_CONST(0.88076162753555787),
+ FRAC_CONST(0.88153530869177488),
+ FRAC_CONST(0.88230662971267804),
+ FRAC_CONST(0.88307558853320878),
+ FRAC_CONST(0.88384218309463292),
+ FRAC_CONST(0.8846064113445461),
+ FRAC_CONST(0.88536827123687933),
+ FRAC_CONST(0.88612776073190425),
+ FRAC_CONST(0.88688487779623937),
+ FRAC_CONST(0.88763962040285393),
+ FRAC_CONST(0.8883919865310751),
+ FRAC_CONST(0.88914197416659235),
+ FRAC_CONST(0.88988958130146301),
+ FRAC_CONST(0.8906348059341177),
+ FRAC_CONST(0.89137764606936609),
+ FRAC_CONST(0.89211809971840139),
+ FRAC_CONST(0.89285616489880615),
+ FRAC_CONST(0.89359183963455813),
+ FRAC_CONST(0.89432512195603453),
+ FRAC_CONST(0.89505600990001799),
+ FRAC_CONST(0.89578450150970124),
+ FRAC_CONST(0.8965105948346932),
+ FRAC_CONST(0.89723428793102367),
+ FRAC_CONST(0.89795557886114807),
+ FRAC_CONST(0.89867446569395382),
+ FRAC_CONST(0.89939094650476448),
+ FRAC_CONST(0.90010501937534515),
+ FRAC_CONST(0.900816682393908),
+ FRAC_CONST(0.90152593365511691),
+ FRAC_CONST(0.90223277126009283),
+ FRAC_CONST(0.90293719331641886),
+ FRAC_CONST(0.90363919793814496),
+ FRAC_CONST(0.90433878324579353),
+ FRAC_CONST(0.90503594736636439),
+ FRAC_CONST(0.90573068843333915),
+ FRAC_CONST(0.90642300458668679),
+ FRAC_CONST(0.90711289397286898),
+ FRAC_CONST(0.90780035474484411),
+ FRAC_CONST(0.90848538506207266),
+ FRAC_CONST(0.90916798309052227),
+ FRAC_CONST(0.90984814700267291),
+ FRAC_CONST(0.9105258749775208),
+ FRAC_CONST(0.91120116520058425),
+ FRAC_CONST(0.91187401586390815),
+ FRAC_CONST(0.91254442516606893),
+ FRAC_CONST(0.9132123913121788),
+ FRAC_CONST(0.91387791251389161),
+ FRAC_CONST(0.91454098698940678),
+ FRAC_CONST(0.91520161296347435),
+ FRAC_CONST(0.91585978866739981),
+ FRAC_CONST(0.91651551233904871),
+ FRAC_CONST(0.91716878222285148),
+ FRAC_CONST(0.91781959656980805),
+ FRAC_CONST(0.91846795363749245),
+ FRAC_CONST(0.91911385169005766),
+ FRAC_CONST(0.9197572889982405),
+ FRAC_CONST(0.9203982638393654),
+ FRAC_CONST(0.92103677449734989),
+ FRAC_CONST(0.92167281926270861),
+ FRAC_CONST(0.92230639643255874),
+ FRAC_CONST(0.92293750431062316),
+ FRAC_CONST(0.92356614120723612),
+ FRAC_CONST(0.92419230543934783),
+ FRAC_CONST(0.92481599533052783),
+ FRAC_CONST(0.92543720921097061),
+ FRAC_CONST(0.92605594541749991),
+ FRAC_CONST(0.92667220229357261),
+ FRAC_CONST(0.92728597818928349),
+ FRAC_CONST(0.9278972714613698),
+ FRAC_CONST(0.92850608047321548),
+ FRAC_CONST(0.9291124035948557),
+ FRAC_CONST(0.92971623920298097),
+ FRAC_CONST(0.93031758568094147),
+ FRAC_CONST(0.93091644141875196),
+ FRAC_CONST(0.93151280481309506),
+ FRAC_CONST(0.93210667426732674),
+ FRAC_CONST(0.93269804819147983),
+ FRAC_CONST(0.93328692500226818),
+ FRAC_CONST(0.93387330312309147),
+ FRAC_CONST(0.93445718098403896),
+ FRAC_CONST(0.93503855702189376),
+ FRAC_CONST(0.9356174296801375),
+ FRAC_CONST(0.93619379740895381),
+ FRAC_CONST(0.93676765866523259),
+ FRAC_CONST(0.93733901191257496),
+ FRAC_CONST(0.93790785562129597),
+ FRAC_CONST(0.93847418826842988),
+ FRAC_CONST(0.93903800833773399),
+ FRAC_CONST(0.93959931431969212),
+ FRAC_CONST(0.94015810471151917),
+ FRAC_CONST(0.94071437801716529),
+ FRAC_CONST(0.94126813274731924),
+ FRAC_CONST(0.94181936741941319),
+ FRAC_CONST(0.94236808055762578),
+ FRAC_CONST(0.94291427069288691),
+ FRAC_CONST(0.94345793636288133),
+ FRAC_CONST(0.94399907611205225),
+ FRAC_CONST(0.9445376884916058),
+ FRAC_CONST(0.94507377205951448),
+ FRAC_CONST(0.94560732538052128),
+ FRAC_CONST(0.94613834702614352),
+ FRAC_CONST(0.94666683557467624),
+ FRAC_CONST(0.94719278961119657),
+ FRAC_CONST(0.94771620772756759),
+ FRAC_CONST(0.94823708852244104),
+ FRAC_CONST(0.94875543060126255),
+ FRAC_CONST(0.94927123257627433),
+ FRAC_CONST(0.94978449306651924),
+ FRAC_CONST(0.95029521069784428),
+ FRAC_CONST(0.9508033841029051),
+ FRAC_CONST(0.95130901192116835),
+ FRAC_CONST(0.9518120927989161),
+ FRAC_CONST(0.95231262538924943),
+ FRAC_CONST(0.95281060835209208),
+ FRAC_CONST(0.95330604035419386),
+ FRAC_CONST(0.95379892006913403),
+ FRAC_CONST(0.95428924617732525),
+ FRAC_CONST(0.95477701736601728),
+ FRAC_CONST(0.95526223232929941),
+ FRAC_CONST(0.95574488976810545),
+ FRAC_CONST(0.95622498839021619),
+ FRAC_CONST(0.95670252691026292),
+ FRAC_CONST(0.95717750404973156),
+ FRAC_CONST(0.95764991853696524),
+ FRAC_CONST(0.95811976910716812),
+ FRAC_CONST(0.95858705450240911),
+ FRAC_CONST(0.95905177347162429),
+ FRAC_CONST(0.95951392477062125),
+ FRAC_CONST(0.95997350716208196),
+ FRAC_CONST(0.96043051941556579),
+ FRAC_CONST(0.96088496030751369),
+ FRAC_CONST(0.96133682862125036),
+ FRAC_CONST(0.96178612314698864),
+ FRAC_CONST(0.96223284268183173),
+ FRAC_CONST(0.9626769860297768),
+ FRAC_CONST(0.96311855200171881),
+ FRAC_CONST(0.96355753941545252),
+ FRAC_CONST(0.96399394709567654),
+ FRAC_CONST(0.96442777387399625),
+ FRAC_CONST(0.96485901858892686),
+ FRAC_CONST(0.96528768008589627),
+ FRAC_CONST(0.96571375721724895),
+ FRAC_CONST(0.96613724884224783),
+ FRAC_CONST(0.96655815382707866),
+ FRAC_CONST(0.96697647104485207),
+ FRAC_CONST(0.96739219937560694),
+ FRAC_CONST(0.96780533770631338),
+ FRAC_CONST(0.96821588493087585),
+ FRAC_CONST(0.9686238399501359),
+ FRAC_CONST(0.96902920167187501),
+ FRAC_CONST(0.96943196901081796),
+ FRAC_CONST(0.96983214088863534),
+ FRAC_CONST(0.9702297162339466),
+ FRAC_CONST(0.97062469398232287),
+ FRAC_CONST(0.97101707307629004),
+ FRAC_CONST(0.97140685246533098),
+ FRAC_CONST(0.97179403110588902),
+ FRAC_CONST(0.97217860796137046),
+ FRAC_CONST(0.97256058200214734),
+ FRAC_CONST(0.97293995220556007),
+ FRAC_CONST(0.97331671755592064),
+ FRAC_CONST(0.97369087704451474),
+ FRAC_CONST(0.97406242966960455),
+ FRAC_CONST(0.97443137443643235),
+ FRAC_CONST(0.97479771035722163),
+ FRAC_CONST(0.97516143645118103),
+ FRAC_CONST(0.97552255174450631),
+ FRAC_CONST(0.97588105527038305),
+ FRAC_CONST(0.97623694606898959),
+ FRAC_CONST(0.97659022318749911),
+ FRAC_CONST(0.97694088568008242),
+ FRAC_CONST(0.97728893260791039),
+ FRAC_CONST(0.97763436303915685),
+ FRAC_CONST(0.97797717604900047),
+ FRAC_CONST(0.97831737071962765),
+ FRAC_CONST(0.97865494614023485),
+ FRAC_CONST(0.97898990140703124),
+ FRAC_CONST(0.97932223562324061),
+ FRAC_CONST(0.97965194789910426),
+ FRAC_CONST(0.9799790373518833),
+ FRAC_CONST(0.98030350310586067),
+ FRAC_CONST(0.98062534429234405),
+ FRAC_CONST(0.98094456004966768),
+ FRAC_CONST(0.98126114952319499),
+ FRAC_CONST(0.98157511186532054),
+ FRAC_CONST(0.98188644623547261),
+ FRAC_CONST(0.98219515180011563),
+ FRAC_CONST(0.98250122773275184),
+ FRAC_CONST(0.98280467321392362),
+ FRAC_CONST(0.98310548743121629),
+ FRAC_CONST(0.98340366957925973),
+ FRAC_CONST(0.98369921885973044),
+ FRAC_CONST(0.98399213448135414),
+ FRAC_CONST(0.98428241565990748),
+ FRAC_CONST(0.98457006161822058),
+ FRAC_CONST(0.98485507158617835),
+ FRAC_CONST(0.98513744480072363),
+ FRAC_CONST(0.98541718050585803),
+ FRAC_CONST(0.98569427795264519),
+ FRAC_CONST(0.98596873639921168),
+ FRAC_CONST(0.98624055511074971),
+ FRAC_CONST(0.98650973335951875),
+ FRAC_CONST(0.98677627042484772),
+ FRAC_CONST(0.98704016559313645),
+ FRAC_CONST(0.98730141815785832),
+ FRAC_CONST(0.98756002741956173),
+ FRAC_CONST(0.9878159926858715),
+ FRAC_CONST(0.98806931327149194),
+ FRAC_CONST(0.98831998849820735),
+ FRAC_CONST(0.98856801769488489),
+ FRAC_CONST(0.98881340019747566),
+ FRAC_CONST(0.98905613534901682),
+ FRAC_CONST(0.98929622249963345),
+ FRAC_CONST(0.98953366100653983),
+ FRAC_CONST(0.98976845023404181),
+ FRAC_CONST(0.99000058955353776),
+ FRAC_CONST(0.99023007834352106),
+ FRAC_CONST(0.99045691598958097),
+ FRAC_CONST(0.99068110188440506),
+ FRAC_CONST(0.99090263542778001),
+ FRAC_CONST(0.99112151602659404),
+ FRAC_CONST(0.99133774309483769),
+ FRAC_CONST(0.99155131605360625),
+ FRAC_CONST(0.99176223433110056),
+ FRAC_CONST(0.99197049736262888),
+ FRAC_CONST(0.99217610459060845),
+ FRAC_CONST(0.99237905546456673),
+ FRAC_CONST(0.99257934944114334),
+ FRAC_CONST(0.99277698598409092),
+ FRAC_CONST(0.99297196456427694),
+ FRAC_CONST(0.99316428465968509),
+ FRAC_CONST(0.99335394575541669),
+ FRAC_CONST(0.99354094734369169),
+ FRAC_CONST(0.99372528892385081),
+ FRAC_CONST(0.99390697000235606),
+ FRAC_CONST(0.99408599009279242),
+ FRAC_CONST(0.99426234871586938),
+ FRAC_CONST(0.99443604539942176),
+ FRAC_CONST(0.99460707967841133),
+ FRAC_CONST(0.99477545109492771),
+ FRAC_CONST(0.99494115919819004),
+ FRAC_CONST(0.99510420354454787),
+ FRAC_CONST(0.99526458369748239),
+ FRAC_CONST(0.99542229922760772),
+ FRAC_CONST(0.99557734971267187),
+ FRAC_CONST(0.9957297347375581),
+ FRAC_CONST(0.99587945389428578),
+ FRAC_CONST(0.99602650678201154),
+ FRAC_CONST(0.99617089300703077),
+ FRAC_CONST(0.996312612182778),
+ FRAC_CONST(0.99645166392982831),
+ FRAC_CONST(0.99658804787589839),
+ FRAC_CONST(0.99672176365584741),
+ FRAC_CONST(0.99685281091167788),
+ FRAC_CONST(0.99698118929253687),
+ FRAC_CONST(0.99710689845471678),
+ FRAC_CONST(0.99722993806165661),
+ FRAC_CONST(0.99735030778394196),
+ FRAC_CONST(0.99746800729930707),
+ FRAC_CONST(0.99758303629263489),
+ FRAC_CONST(0.99769539445595812),
+ FRAC_CONST(0.99780508148846014),
+ FRAC_CONST(0.99791209709647588),
+ FRAC_CONST(0.99801644099349218),
+ FRAC_CONST(0.99811811290014918),
+ FRAC_CONST(0.9982171125442405),
+ FRAC_CONST(0.9983134396607144),
+ FRAC_CONST(0.99840709399167404),
+ FRAC_CONST(0.99849807528637868),
+ FRAC_CONST(0.99858638330124405),
+ FRAC_CONST(0.99867201779984294),
+ FRAC_CONST(0.99875497855290607),
+ FRAC_CONST(0.99883526533832245),
+ FRAC_CONST(0.99891287794114036),
+ FRAC_CONST(0.99898781615356746),
+ FRAC_CONST(0.99906007977497147),
+ FRAC_CONST(0.99912966861188113),
+ FRAC_CONST(0.99919658247798593),
+ FRAC_CONST(0.99926082119413751),
+ FRAC_CONST(0.99932238458834954),
+ FRAC_CONST(0.999381272495798),
+ FRAC_CONST(0.99943748475882255),
+ FRAC_CONST(0.9994910212269259),
+ FRAC_CONST(0.99954188175677483),
+ FRAC_CONST(0.99959006621220048),
+ FRAC_CONST(0.99963557446419837),
+ FRAC_CONST(0.99967840639092931),
+ FRAC_CONST(0.99971856187771946),
+ FRAC_CONST(0.99975604081706027),
+ FRAC_CONST(0.99979084310860955),
+ FRAC_CONST(0.99982296865919107),
+ FRAC_CONST(0.99985241738279484),
+ FRAC_CONST(0.99987918920057806),
+ FRAC_CONST(0.99990328404086426),
+ FRAC_CONST(0.9999247018391445),
+ FRAC_CONST(0.99994344253807688),
+ FRAC_CONST(0.99995950608748674),
+ FRAC_CONST(0.99997289244436727),
+ FRAC_CONST(0.99998360157287902),
+ FRAC_CONST(0.9999916334443506),
+ FRAC_CONST(0.99999698803727821),
+ FRAC_CONST(0.99999966533732598)
+};
+#endif
+
+ALIGN static const real_t sine_short_128[] =
+{
+ FRAC_CONST(0.0061358846491544753),
+ FRAC_CONST(0.01840672990580482),
+ FRAC_CONST(0.030674803176636626),
+ FRAC_CONST(0.04293825693494082),
+ FRAC_CONST(0.055195244349689934),
+ FRAC_CONST(0.067443919563664051),
+ FRAC_CONST(0.079682437971430126),
+ FRAC_CONST(0.091908956497132724),
+ FRAC_CONST(0.10412163387205459),
+ FRAC_CONST(0.11631863091190475),
+ FRAC_CONST(0.12849811079379317),
+ FRAC_CONST(0.14065823933284921),
+ FRAC_CONST(0.15279718525844344),
+ FRAC_CONST(0.16491312048996989),
+ FRAC_CONST(0.17700422041214875),
+ FRAC_CONST(0.18906866414980619),
+ FRAC_CONST(0.2011046348420919),
+ FRAC_CONST(0.21311031991609136),
+ FRAC_CONST(0.22508391135979283),
+ FRAC_CONST(0.2370236059943672),
+ FRAC_CONST(0.24892760574572015),
+ FRAC_CONST(0.26079411791527551),
+ FRAC_CONST(0.27262135544994898),
+ FRAC_CONST(0.28440753721127188),
+ FRAC_CONST(0.29615088824362379),
+ FRAC_CONST(0.30784964004153487),
+ FRAC_CONST(0.31950203081601569),
+ FRAC_CONST(0.33110630575987643),
+ FRAC_CONST(0.34266071731199438),
+ FRAC_CONST(0.35416352542049034),
+ FRAC_CONST(0.36561299780477385),
+ FRAC_CONST(0.37700741021641826),
+ FRAC_CONST(0.38834504669882625),
+ FRAC_CONST(0.39962419984564679),
+ FRAC_CONST(0.41084317105790391),
+ FRAC_CONST(0.42200027079979968),
+ FRAC_CONST(0.43309381885315196),
+ FRAC_CONST(0.4441221445704292),
+ FRAC_CONST(0.45508358712634384),
+ FRAC_CONST(0.46597649576796618),
+ FRAC_CONST(0.47679923006332209),
+ FRAC_CONST(0.487550160148436),
+ FRAC_CONST(0.49822766697278187),
+ FRAC_CONST(0.50883014254310699),
+ FRAC_CONST(0.51935599016558964),
+ FRAC_CONST(0.52980362468629461),
+ FRAC_CONST(0.54017147272989285),
+ FRAC_CONST(0.55045797293660481),
+ FRAC_CONST(0.56066157619733603),
+ FRAC_CONST(0.57078074588696726),
+ FRAC_CONST(0.58081395809576453),
+ FRAC_CONST(0.59075970185887416),
+ FRAC_CONST(0.60061647938386897),
+ FRAC_CONST(0.61038280627630948),
+ FRAC_CONST(0.6200572117632891),
+ FRAC_CONST(0.62963823891492698),
+ FRAC_CONST(0.63912444486377573),
+ FRAC_CONST(0.64851440102211244),
+ FRAC_CONST(0.65780669329707864),
+ FRAC_CONST(0.66699992230363747),
+ FRAC_CONST(0.67609270357531592),
+ FRAC_CONST(0.68508366777270036),
+ FRAC_CONST(0.693971460889654),
+ FRAC_CONST(0.7027547444572253),
+ FRAC_CONST(0.71143219574521643),
+ FRAC_CONST(0.72000250796138165),
+ FRAC_CONST(0.7284643904482252),
+ FRAC_CONST(0.73681656887736979),
+ FRAC_CONST(0.74505778544146595),
+ FRAC_CONST(0.75318679904361241),
+ FRAC_CONST(0.76120238548426178),
+ FRAC_CONST(0.76910333764557959),
+ FRAC_CONST(0.77688846567323244),
+ FRAC_CONST(0.78455659715557524),
+ FRAC_CONST(0.79210657730021239),
+ FRAC_CONST(0.79953726910790501),
+ FRAC_CONST(0.80684755354379922),
+ FRAC_CONST(0.8140363297059483),
+ FRAC_CONST(0.82110251499110465),
+ FRAC_CONST(0.8280450452577558),
+ FRAC_CONST(0.83486287498638001),
+ FRAC_CONST(0.84155497743689833),
+ FRAC_CONST(0.84812034480329712),
+ FRAC_CONST(0.85455798836540053),
+ FRAC_CONST(0.86086693863776731),
+ FRAC_CONST(0.86704624551569265),
+ FRAC_CONST(0.87309497841829009),
+ FRAC_CONST(0.87901222642863341),
+ FRAC_CONST(0.88479709843093779),
+ FRAC_CONST(0.89044872324475788),
+ FRAC_CONST(0.89596624975618511),
+ FRAC_CONST(0.90134884704602203),
+ FRAC_CONST(0.90659570451491533),
+ FRAC_CONST(0.91170603200542988),
+ FRAC_CONST(0.9166790599210427),
+ FRAC_CONST(0.9215140393420419),
+ FRAC_CONST(0.92621024213831127),
+ FRAC_CONST(0.93076696107898371),
+ FRAC_CONST(0.9351835099389475),
+ FRAC_CONST(0.93945922360218992),
+ FRAC_CONST(0.94359345816196039),
+ FRAC_CONST(0.94758559101774109),
+ FRAC_CONST(0.95143502096900834),
+ FRAC_CONST(0.95514116830577067),
+ FRAC_CONST(0.9587034748958716),
+ FRAC_CONST(0.96212140426904158),
+ FRAC_CONST(0.9653944416976894),
+ FRAC_CONST(0.96852209427441727),
+ FRAC_CONST(0.97150389098625178),
+ FRAC_CONST(0.97433938278557586),
+ FRAC_CONST(0.97702814265775439),
+ FRAC_CONST(0.97956976568544052),
+ FRAC_CONST(0.98196386910955524),
+ FRAC_CONST(0.98421009238692903),
+ FRAC_CONST(0.98630809724459867),
+ FRAC_CONST(0.98825756773074946),
+ FRAC_CONST(0.99005821026229712),
+ FRAC_CONST(0.99170975366909953),
+ FRAC_CONST(0.9932119492347945),
+ FRAC_CONST(0.99456457073425542),
+ FRAC_CONST(0.99576741446765982),
+ FRAC_CONST(0.99682029929116567),
+ FRAC_CONST(0.99772306664419164),
+ FRAC_CONST(0.99847558057329477),
+ FRAC_CONST(0.99907772775264536),
+ FRAC_CONST(0.99952941750109314),
+ FRAC_CONST(0.9998305817958234),
+ FRAC_CONST(0.99998117528260111)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ALIGN static const real_t sine_short_120[] =
+{
+ FRAC_CONST(0.0065449379673518581),
+ FRAC_CONST(0.019633692460628301),
+ FRAC_CONST(0.032719082821776137),
+ FRAC_CONST(0.045798866936520771),
+ FRAC_CONST(0.058870803651189033),
+ FRAC_CONST(0.071932653156719387),
+ FRAC_CONST(0.084982177372441667),
+ FRAC_CONST(0.09801714032956059),
+ FRAC_CONST(0.11103530855427769),
+ FRAC_CONST(0.12403445145048532),
+ FRAC_CONST(0.13701234168196802),
+ FRAC_CONST(0.14996675555404498),
+ FRAC_CONST(0.16289547339458874),
+ FRAC_CONST(0.17579627993435451),
+ FRAC_CONST(0.18866696468655525),
+ FRAC_CONST(0.2015053223256171),
+ FRAC_CONST(0.21430915306505074),
+ FRAC_CONST(0.2270762630343732),
+ FRAC_CONST(0.23980446465501654),
+ FRAC_CONST(0.25249157701515795),
+ FRAC_CONST(0.26513542624340797),
+ FRAC_CONST(0.27773384588129219),
+ FRAC_CONST(0.29028467725446233),
+ FRAC_CONST(0.3027857698425746),
+ FRAC_CONST(0.31523498164776964),
+ FRAC_CONST(0.32763017956169349),
+ FRAC_CONST(0.33996923973099424),
+ FRAC_CONST(0.35225004792123354),
+ FRAC_CONST(0.36447049987914965),
+ FRAC_CONST(0.37662850169321077),
+ FRAC_CONST(0.38872197015239557),
+ FRAC_CONST(0.40074883310314097),
+ FRAC_CONST(0.41270702980439467),
+ FRAC_CONST(0.42459451128071307),
+ FRAC_CONST(0.43640924067334208),
+ FRAC_CONST(0.44814919358922256),
+ FRAC_CONST(0.45981235844785984),
+ FRAC_CONST(0.47139673682599764),
+ FRAC_CONST(0.48290034380003727),
+ FRAC_CONST(0.49432120828614462),
+ FRAC_CONST(0.50565737337798455),
+ FRAC_CONST(0.51690689668202761),
+ FRAC_CONST(0.52806785065036799),
+ FRAC_CONST(0.53913832291100017),
+ FRAC_CONST(0.55011641659549337),
+ FRAC_CONST(0.56100025066400983),
+ FRAC_CONST(0.57178796022761225),
+ FRAC_CONST(0.58247769686780215),
+ FRAC_CONST(0.59306762895323706),
+ FRAC_CONST(0.60355594195357143),
+ FRAC_CONST(0.61394083875036642),
+ FRAC_CONST(0.62422053994501758),
+ FRAC_CONST(0.63439328416364549),
+ FRAC_CONST(0.64445732835889735),
+ FRAC_CONST(0.65441094810861034),
+ FRAC_CONST(0.66425243791128175),
+ FRAC_CONST(0.67398011147829784),
+ FRAC_CONST(0.68359230202287125),
+ FRAC_CONST(0.69308736254563585),
+ FRAC_CONST(0.70246366611685174),
+ FRAC_CONST(0.71171960615517138),
+ FRAC_CONST(0.72085359670291882),
+ FRAC_CONST(0.7298640726978356),
+ FRAC_CONST(0.73874949024124625),
+ FRAC_CONST(0.74750832686259672),
+ FRAC_CONST(0.75613908178032285),
+ FRAC_CONST(0.76464027615900032),
+ FRAC_CONST(0.77301045336273699),
+ FRAC_CONST(0.78124817920475853),
+ FRAC_CONST(0.78935204219315003),
+ FRAC_CONST(0.79732065377270711),
+ FRAC_CONST(0.80515264856285829),
+ FRAC_CONST(0.81284668459161513),
+ FRAC_CONST(0.82040144352551359),
+ FRAC_CONST(0.82781563089550203),
+ FRAC_CONST(0.83508797631874299),
+ FRAC_CONST(0.84221723371628654),
+ FRAC_CONST(0.84920218152657889),
+ FRAC_CONST(0.85604162291477137),
+ FRAC_CONST(0.86273438597779184),
+ FRAC_CONST(0.86927932394514362),
+ FRAC_CONST(0.87567531537539967),
+ FRAC_CONST(0.88192126434835494),
+ FRAC_CONST(0.88801610065280734),
+ FRAC_CONST(0.89395877996993212),
+ FRAC_CONST(0.8997482840522214),
+ FRAC_CONST(0.90538362089795521),
+ FRAC_CONST(0.91086382492117568),
+ FRAC_CONST(0.91618795711713596),
+ FRAC_CONST(0.92135510522319242),
+ FRAC_CONST(0.9263643838751181),
+ FRAC_CONST(0.93121493475880346),
+ FRAC_CONST(0.93590592675732565),
+ FRAC_CONST(0.94043655609335486),
+ FRAC_CONST(0.94480604646687805),
+ FRAC_CONST(0.94901364918821385),
+ FRAC_CONST(0.95305864330629697),
+ FRAC_CONST(0.95694033573220882),
+ FRAC_CONST(0.9606580613579353),
+ FRAC_CONST(0.96421118317032928),
+ FRAC_CONST(0.96759909236025976),
+ FRAC_CONST(0.9708212084269281),
+ FRAC_CONST(0.97387697927733363),
+ FRAC_CONST(0.97676588132087239),
+ FRAC_CONST(0.97948741955905139),
+ FRAC_CONST(0.98204112767030394),
+ FRAC_CONST(0.98442656808989171),
+ FRAC_CONST(0.98664333208487898),
+ FRAC_CONST(0.98869103982416728),
+ FRAC_CONST(0.99056934044357725),
+ FRAC_CONST(0.99227791210596705),
+ FRAC_CONST(0.99381646205637808),
+ FRAC_CONST(0.99518472667219682),
+ FRAC_CONST(0.99638247150832537),
+ FRAC_CONST(0.99740949133735191),
+ FRAC_CONST(0.99826561018471593),
+ FRAC_CONST(0.99895068135886012),
+ FRAC_CONST(0.99946458747636568),
+ FRAC_CONST(0.99980724048206482),
+ FRAC_CONST(0.99997858166412923)
+};
+#endif
+
+#ifdef LD_DEC
+ALIGN static const real_t sine_mid_512[] =
+{
+ FRAC_CONST(0.0015339801862847655),
+ FRAC_CONST(0.0046019261204485705),
+ FRAC_CONST(0.007669828739531097),
+ FRAC_CONST(0.010737659167264491),
+ FRAC_CONST(0.013805388528060391),
+ FRAC_CONST(0.01687298794728171),
+ FRAC_CONST(0.019940428551514441),
+ FRAC_CONST(0.023007681468839369),
+ FRAC_CONST(0.026074717829103901),
+ FRAC_CONST(0.029141508764193722),
+ FRAC_CONST(0.032208025408304586),
+ FRAC_CONST(0.035274238898213947),
+ FRAC_CONST(0.038340120373552694),
+ FRAC_CONST(0.041405640977076739),
+ FRAC_CONST(0.044470771854938668),
+ FRAC_CONST(0.047535484156959303),
+ FRAC_CONST(0.050599749036899282),
+ FRAC_CONST(0.05366353765273052),
+ FRAC_CONST(0.056726821166907748),
+ FRAC_CONST(0.059789570746639868),
+ FRAC_CONST(0.062851757564161406),
+ FRAC_CONST(0.065913352797003805),
+ FRAC_CONST(0.068974327628266746),
+ FRAC_CONST(0.072034653246889332),
+ FRAC_CONST(0.075094300847921305),
+ FRAC_CONST(0.078153241632794232),
+ FRAC_CONST(0.081211446809592441),
+ FRAC_CONST(0.084268887593324071),
+ FRAC_CONST(0.087325535206192059),
+ FRAC_CONST(0.090381360877864983),
+ FRAC_CONST(0.093436335845747787),
+ FRAC_CONST(0.096490431355252593),
+ FRAC_CONST(0.099543618660069319),
+ FRAC_CONST(0.10259586902243628),
+ FRAC_CONST(0.10564715371341062),
+ FRAC_CONST(0.10869744401313872),
+ FRAC_CONST(0.11174671121112659),
+ FRAC_CONST(0.11479492660651008),
+ FRAC_CONST(0.11784206150832498),
+ FRAC_CONST(0.12088808723577708),
+ FRAC_CONST(0.12393297511851216),
+ FRAC_CONST(0.12697669649688587),
+ FRAC_CONST(0.13001922272223335),
+ FRAC_CONST(0.13306052515713906),
+ FRAC_CONST(0.1361005751757062),
+ FRAC_CONST(0.1391393441638262),
+ FRAC_CONST(0.14217680351944803),
+ FRAC_CONST(0.14521292465284746),
+ FRAC_CONST(0.14824767898689603),
+ FRAC_CONST(0.15128103795733022),
+ FRAC_CONST(0.1543129730130201),
+ FRAC_CONST(0.15734345561623825),
+ FRAC_CONST(0.16037245724292828),
+ FRAC_CONST(0.16339994938297323),
+ FRAC_CONST(0.1664259035404641),
+ FRAC_CONST(0.16945029123396796),
+ FRAC_CONST(0.17247308399679595),
+ FRAC_CONST(0.17549425337727143),
+ FRAC_CONST(0.17851377093899751),
+ FRAC_CONST(0.18153160826112497),
+ FRAC_CONST(0.18454773693861962),
+ FRAC_CONST(0.1875621285825296),
+ FRAC_CONST(0.19057475482025274),
+ FRAC_CONST(0.19358558729580361),
+ FRAC_CONST(0.19659459767008022),
+ FRAC_CONST(0.19960175762113097),
+ FRAC_CONST(0.20260703884442113),
+ FRAC_CONST(0.20561041305309924),
+ FRAC_CONST(0.20861185197826349),
+ FRAC_CONST(0.21161132736922755),
+ FRAC_CONST(0.21460881099378676),
+ FRAC_CONST(0.21760427463848364),
+ FRAC_CONST(0.22059769010887351),
+ FRAC_CONST(0.22358902922978999),
+ FRAC_CONST(0.22657826384561),
+ FRAC_CONST(0.22956536582051887),
+ FRAC_CONST(0.23255030703877524),
+ FRAC_CONST(0.23553305940497549),
+ FRAC_CONST(0.23851359484431842),
+ FRAC_CONST(0.24149188530286933),
+ FRAC_CONST(0.24446790274782415),
+ FRAC_CONST(0.24744161916777327),
+ FRAC_CONST(0.25041300657296522),
+ FRAC_CONST(0.25338203699557016),
+ FRAC_CONST(0.25634868248994291),
+ FRAC_CONST(0.25931291513288623),
+ FRAC_CONST(0.26227470702391359),
+ FRAC_CONST(0.26523403028551179),
+ FRAC_CONST(0.26819085706340318),
+ FRAC_CONST(0.27114515952680801),
+ FRAC_CONST(0.27409690986870638),
+ FRAC_CONST(0.2770460803060999),
+ FRAC_CONST(0.27999264308027322),
+ FRAC_CONST(0.28293657045705539),
+ FRAC_CONST(0.28587783472708062),
+ FRAC_CONST(0.28881640820604948),
+ FRAC_CONST(0.29175226323498926),
+ FRAC_CONST(0.29468537218051433),
+ FRAC_CONST(0.2976157074350862),
+ FRAC_CONST(0.30054324141727345),
+ FRAC_CONST(0.30346794657201132),
+ FRAC_CONST(0.30638979537086092),
+ FRAC_CONST(0.30930876031226873),
+ FRAC_CONST(0.31222481392182488),
+ FRAC_CONST(0.31513792875252244),
+ FRAC_CONST(0.31804807738501495),
+ FRAC_CONST(0.32095523242787521),
+ FRAC_CONST(0.32385936651785285),
+ FRAC_CONST(0.32676045232013173),
+ FRAC_CONST(0.32965846252858749),
+ FRAC_CONST(0.33255336986604422),
+ FRAC_CONST(0.3354451470845316),
+ FRAC_CONST(0.33833376696554113),
+ FRAC_CONST(0.34121920232028236),
+ FRAC_CONST(0.34410142598993881),
+ FRAC_CONST(0.34698041084592368),
+ FRAC_CONST(0.34985612979013492),
+ FRAC_CONST(0.35272855575521073),
+ FRAC_CONST(0.35559766170478385),
+ FRAC_CONST(0.35846342063373654),
+ FRAC_CONST(0.36132580556845428),
+ FRAC_CONST(0.36418478956707989),
+ FRAC_CONST(0.36704034571976718),
+ FRAC_CONST(0.3698924471489341),
+ FRAC_CONST(0.37274106700951576),
+ FRAC_CONST(0.37558617848921722),
+ FRAC_CONST(0.37842775480876556),
+ FRAC_CONST(0.38126576922216238),
+ FRAC_CONST(0.38410019501693504),
+ FRAC_CONST(0.38693100551438858),
+ FRAC_CONST(0.38975817406985641),
+ FRAC_CONST(0.39258167407295147),
+ FRAC_CONST(0.39540147894781635),
+ FRAC_CONST(0.39821756215337356),
+ FRAC_CONST(0.40102989718357562),
+ FRAC_CONST(0.40383845756765407),
+ FRAC_CONST(0.40664321687036903),
+ FRAC_CONST(0.40944414869225759),
+ FRAC_CONST(0.41224122666988289),
+ FRAC_CONST(0.41503442447608163),
+ FRAC_CONST(0.41782371582021227),
+ FRAC_CONST(0.42060907444840251),
+ FRAC_CONST(0.42339047414379605),
+ FRAC_CONST(0.42616788872679962),
+ FRAC_CONST(0.42894129205532949),
+ FRAC_CONST(0.43171065802505726),
+ FRAC_CONST(0.43447596056965565),
+ FRAC_CONST(0.43723717366104409),
+ FRAC_CONST(0.43999427130963326),
+ FRAC_CONST(0.44274722756457002),
+ FRAC_CONST(0.44549601651398174),
+ FRAC_CONST(0.44824061228521989),
+ FRAC_CONST(0.45098098904510386),
+ FRAC_CONST(0.45371712100016387),
+ FRAC_CONST(0.45644898239688392),
+ FRAC_CONST(0.45917654752194409),
+ FRAC_CONST(0.46189979070246273),
+ FRAC_CONST(0.46461868630623782),
+ FRAC_CONST(0.46733320874198842),
+ FRAC_CONST(0.47004333245959562),
+ FRAC_CONST(0.47274903195034279),
+ FRAC_CONST(0.47545028174715587),
+ FRAC_CONST(0.47814705642484301),
+ FRAC_CONST(0.48083933060033396),
+ FRAC_CONST(0.48352707893291874),
+ FRAC_CONST(0.48621027612448642),
+ FRAC_CONST(0.48888889691976317),
+ FRAC_CONST(0.4915629161065499),
+ FRAC_CONST(0.49423230851595967),
+ FRAC_CONST(0.49689704902265447),
+ FRAC_CONST(0.49955711254508184),
+ FRAC_CONST(0.50221247404571079),
+ FRAC_CONST(0.50486310853126759),
+ FRAC_CONST(0.50750899105297087),
+ FRAC_CONST(0.51015009670676681),
+ FRAC_CONST(0.51278640063356296),
+ FRAC_CONST(0.51541787801946293),
+ FRAC_CONST(0.51804450409599934),
+ FRAC_CONST(0.52066625414036716),
+ FRAC_CONST(0.52328310347565643),
+ FRAC_CONST(0.52589502747108463),
+ FRAC_CONST(0.52850200154222848),
+ FRAC_CONST(0.531104001151255),
+ FRAC_CONST(0.53370100180715296),
+ FRAC_CONST(0.53629297906596318),
+ FRAC_CONST(0.53887990853100842),
+ FRAC_CONST(0.54146176585312344),
+ FRAC_CONST(0.54403852673088382),
+ FRAC_CONST(0.54661016691083486),
+ FRAC_CONST(0.54917666218771966),
+ FRAC_CONST(0.55173798840470734),
+ FRAC_CONST(0.55429412145362),
+ FRAC_CONST(0.5568450372751601),
+ FRAC_CONST(0.55939071185913614),
+ FRAC_CONST(0.56193112124468947),
+ FRAC_CONST(0.5644662415205195),
+ FRAC_CONST(0.56699604882510868),
+ FRAC_CONST(0.56952051934694714),
+ FRAC_CONST(0.57203962932475705),
+ FRAC_CONST(0.57455335504771576),
+ FRAC_CONST(0.57706167285567944),
+ FRAC_CONST(0.57956455913940563),
+ FRAC_CONST(0.58206199034077544),
+ FRAC_CONST(0.58455394295301533),
+ FRAC_CONST(0.58704039352091797),
+ FRAC_CONST(0.58952131864106394),
+ FRAC_CONST(0.59199669496204099),
+ FRAC_CONST(0.59446649918466443),
+ FRAC_CONST(0.5969307080621965),
+ FRAC_CONST(0.59938929840056454),
+ FRAC_CONST(0.60184224705858003),
+ FRAC_CONST(0.60428953094815596),
+ FRAC_CONST(0.60673112703452448),
+ FRAC_CONST(0.60916701233645321),
+ FRAC_CONST(0.61159716392646191),
+ FRAC_CONST(0.61402155893103838),
+ FRAC_CONST(0.61644017453085365),
+ FRAC_CONST(0.61885298796097632),
+ FRAC_CONST(0.62125997651108755),
+ FRAC_CONST(0.62366111752569453),
+ FRAC_CONST(0.62605638840434352),
+ FRAC_CONST(0.62844576660183271),
+ FRAC_CONST(0.63082922962842447),
+ FRAC_CONST(0.63320675505005719),
+ FRAC_CONST(0.63557832048855611),
+ FRAC_CONST(0.63794390362184406),
+ FRAC_CONST(0.64030348218415167),
+ FRAC_CONST(0.64265703396622686),
+ FRAC_CONST(0.64500453681554393),
+ FRAC_CONST(0.64734596863651206),
+ FRAC_CONST(0.64968130739068319),
+ FRAC_CONST(0.6520105310969595),
+ FRAC_CONST(0.65433361783180044),
+ FRAC_CONST(0.65665054572942894),
+ FRAC_CONST(0.65896129298203732),
+ FRAC_CONST(0.66126583783999227),
+ FRAC_CONST(0.66356415861203977),
+ FRAC_CONST(0.66585623366550972),
+ FRAC_CONST(0.66814204142651845),
+ FRAC_CONST(0.67042156038017309),
+ FRAC_CONST(0.67269476907077286),
+ FRAC_CONST(0.67496164610201193),
+ FRAC_CONST(0.67722217013718033),
+ FRAC_CONST(0.67947631989936497),
+ FRAC_CONST(0.68172407417164971),
+ FRAC_CONST(0.6839654117973154),
+ FRAC_CONST(0.68620031168003859),
+ FRAC_CONST(0.68842875278409044),
+ FRAC_CONST(0.6906507141345346),
+ FRAC_CONST(0.69286617481742463),
+ FRAC_CONST(0.69507511398000088),
+ FRAC_CONST(0.69727751083088652),
+ FRAC_CONST(0.69947334464028377),
+ FRAC_CONST(0.70166259474016845),
+ FRAC_CONST(0.70384524052448494),
+ FRAC_CONST(0.70602126144933974),
+ FRAC_CONST(0.70819063703319529),
+ FRAC_CONST(0.71035334685706231),
+ FRAC_CONST(0.71250937056469232),
+ FRAC_CONST(0.71465868786276898),
+ FRAC_CONST(0.71680127852109954),
+ FRAC_CONST(0.71893712237280438),
+ FRAC_CONST(0.72106619931450811),
+ FRAC_CONST(0.72318848930652735),
+ FRAC_CONST(0.72530397237306066),
+ FRAC_CONST(0.72741262860237577),
+ FRAC_CONST(0.7295144381469969),
+ FRAC_CONST(0.73160938122389252),
+ FRAC_CONST(0.73369743811466026),
+ FRAC_CONST(0.73577858916571348),
+ FRAC_CONST(0.73785281478846598),
+ FRAC_CONST(0.73992009545951609),
+ FRAC_CONST(0.74198041172083096),
+ FRAC_CONST(0.74403374417992918),
+ FRAC_CONST(0.74608007351006378),
+ FRAC_CONST(0.74811938045040349),
+ FRAC_CONST(0.75015164580621496),
+ FRAC_CONST(0.7521768504490427),
+ FRAC_CONST(0.75419497531688917),
+ FRAC_CONST(0.75620600141439454),
+ FRAC_CONST(0.75820990981301528),
+ FRAC_CONST(0.76020668165120242),
+ FRAC_CONST(0.7621962981345789),
+ FRAC_CONST(0.76417874053611667),
+ FRAC_CONST(0.76615399019631281),
+ FRAC_CONST(0.76812202852336531),
+ FRAC_CONST(0.7700828369933479),
+ FRAC_CONST(0.77203639715038441),
+ FRAC_CONST(0.77398269060682279),
+ FRAC_CONST(0.77592169904340758),
+ FRAC_CONST(0.77785340420945304),
+ FRAC_CONST(0.77977778792301444),
+ FRAC_CONST(0.78169483207105939),
+ FRAC_CONST(0.7836045186096382),
+ FRAC_CONST(0.78550682956405393),
+ FRAC_CONST(0.78740174702903132),
+ FRAC_CONST(0.78928925316888565),
+ FRAC_CONST(0.79116933021769009),
+ FRAC_CONST(0.79304196047944364),
+ FRAC_CONST(0.79490712632823701),
+ FRAC_CONST(0.79676481020841872),
+ FRAC_CONST(0.79861499463476082),
+ FRAC_CONST(0.80045766219262271),
+ FRAC_CONST(0.80229279553811572),
+ FRAC_CONST(0.8041203773982657),
+ FRAC_CONST(0.80594039057117628),
+ FRAC_CONST(0.80775281792619036),
+ FRAC_CONST(0.80955764240405126),
+ FRAC_CONST(0.81135484701706373),
+ FRAC_CONST(0.81314441484925359),
+ FRAC_CONST(0.81492632905652662),
+ FRAC_CONST(0.81670057286682785),
+ FRAC_CONST(0.81846712958029866),
+ FRAC_CONST(0.82022598256943469),
+ FRAC_CONST(0.82197711527924155),
+ FRAC_CONST(0.82372051122739132),
+ FRAC_CONST(0.82545615400437744),
+ FRAC_CONST(0.82718402727366902),
+ FRAC_CONST(0.82890411477186487),
+ FRAC_CONST(0.8306164003088462),
+ FRAC_CONST(0.83232086776792968),
+ FRAC_CONST(0.83401750110601813),
+ FRAC_CONST(0.8357062843537526),
+ FRAC_CONST(0.83738720161566194),
+ FRAC_CONST(0.83906023707031263),
+ FRAC_CONST(0.84072537497045807),
+ FRAC_CONST(0.84238259964318596),
+ FRAC_CONST(0.84403189549006641),
+ FRAC_CONST(0.84567324698729907),
+ FRAC_CONST(0.84730663868585832),
+ FRAC_CONST(0.84893205521163961),
+ FRAC_CONST(0.85054948126560337),
+ FRAC_CONST(0.85215890162391983),
+ FRAC_CONST(0.8537603011381113),
+ FRAC_CONST(0.85535366473519603),
+ FRAC_CONST(0.85693897741782865),
+ FRAC_CONST(0.85851622426444274),
+ FRAC_CONST(0.86008539042939014),
+ FRAC_CONST(0.8616464611430813),
+ FRAC_CONST(0.86319942171212416),
+ FRAC_CONST(0.86474425751946238),
+ FRAC_CONST(0.86628095402451299),
+ FRAC_CONST(0.86780949676330321),
+ FRAC_CONST(0.86932987134860673),
+ FRAC_CONST(0.87084206347007886),
+ FRAC_CONST(0.87234605889439154),
+ FRAC_CONST(0.87384184346536675),
+ FRAC_CONST(0.87532940310411078),
+ FRAC_CONST(0.87680872380914576),
+ FRAC_CONST(0.87827979165654146),
+ FRAC_CONST(0.87974259280004741),
+ FRAC_CONST(0.88119711347122198),
+ FRAC_CONST(0.88264333997956279),
+ FRAC_CONST(0.88408125871263499),
+ FRAC_CONST(0.88551085613619995),
+ FRAC_CONST(0.88693211879434208),
+ FRAC_CONST(0.88834503330959624),
+ FRAC_CONST(0.88974958638307289),
+ FRAC_CONST(0.89114576479458318),
+ FRAC_CONST(0.89253355540276469),
+ FRAC_CONST(0.89391294514520325),
+ FRAC_CONST(0.89528392103855758),
+ FRAC_CONST(0.89664647017868015),
+ FRAC_CONST(0.89800057974073988),
+ FRAC_CONST(0.89934623697934146),
+ FRAC_CONST(0.90068342922864686),
+ FRAC_CONST(0.90201214390249307),
+ FRAC_CONST(0.90333236849451182),
+ FRAC_CONST(0.90464409057824624),
+ FRAC_CONST(0.90594729780726846),
+ FRAC_CONST(0.90724197791529593),
+ FRAC_CONST(0.90852811871630612),
+ FRAC_CONST(0.90980570810465222),
+ FRAC_CONST(0.91107473405517625),
+ FRAC_CONST(0.91233518462332275),
+ FRAC_CONST(0.91358704794525081),
+ FRAC_CONST(0.91483031223794609),
+ FRAC_CONST(0.91606496579933161),
+ FRAC_CONST(0.91729099700837791),
+ FRAC_CONST(0.91850839432521225),
+ FRAC_CONST(0.91971714629122736),
+ FRAC_CONST(0.92091724152918952),
+ FRAC_CONST(0.92210866874334507),
+ FRAC_CONST(0.92329141671952764),
+ FRAC_CONST(0.9244654743252626),
+ FRAC_CONST(0.92563083050987272),
+ FRAC_CONST(0.92678747430458175),
+ FRAC_CONST(0.92793539482261789),
+ FRAC_CONST(0.92907458125931575),
+ FRAC_CONST(0.93020502289221907),
+ FRAC_CONST(0.93132670908118043),
+ FRAC_CONST(0.93243962926846236),
+ FRAC_CONST(0.93354377297883617),
+ FRAC_CONST(0.93463912981968078),
+ FRAC_CONST(0.93572568948108037),
+ FRAC_CONST(0.93680344173592156),
+ FRAC_CONST(0.93787237643998989),
+ FRAC_CONST(0.93893248353206449),
+ FRAC_CONST(0.93998375303401394),
+ FRAC_CONST(0.94102617505088926),
+ FRAC_CONST(0.94205973977101731),
+ FRAC_CONST(0.94308443746609349),
+ FRAC_CONST(0.94410025849127266),
+ FRAC_CONST(0.94510719328526061),
+ FRAC_CONST(0.94610523237040334),
+ FRAC_CONST(0.94709436635277722),
+ FRAC_CONST(0.94807458592227623),
+ FRAC_CONST(0.94904588185270056),
+ FRAC_CONST(0.950008245001843),
+ FRAC_CONST(0.95096166631157508),
+ FRAC_CONST(0.95190613680793223),
+ FRAC_CONST(0.95284164760119872),
+ FRAC_CONST(0.95376818988599033),
+ FRAC_CONST(0.95468575494133834),
+ FRAC_CONST(0.95559433413077111),
+ FRAC_CONST(0.95649391890239499),
+ FRAC_CONST(0.95738450078897586),
+ FRAC_CONST(0.95826607140801767),
+ FRAC_CONST(0.95913862246184189),
+ FRAC_CONST(0.96000214573766585),
+ FRAC_CONST(0.96085663310767966),
+ FRAC_CONST(0.96170207652912254),
+ FRAC_CONST(0.96253846804435916),
+ FRAC_CONST(0.96336579978095405),
+ FRAC_CONST(0.96418406395174572),
+ FRAC_CONST(0.96499325285492032),
+ FRAC_CONST(0.96579335887408357),
+ FRAC_CONST(0.96658437447833312),
+ FRAC_CONST(0.96736629222232851),
+ FRAC_CONST(0.96813910474636233),
+ FRAC_CONST(0.96890280477642887),
+ FRAC_CONST(0.96965738512429245),
+ FRAC_CONST(0.9704028386875555),
+ FRAC_CONST(0.97113915844972509),
+ FRAC_CONST(0.9718663374802794),
+ FRAC_CONST(0.97258436893473221),
+ FRAC_CONST(0.97329324605469825),
+ FRAC_CONST(0.97399296216795583),
+ FRAC_CONST(0.97468351068851067),
+ FRAC_CONST(0.97536488511665687),
+ FRAC_CONST(0.97603707903903902),
+ FRAC_CONST(0.97670008612871184),
+ FRAC_CONST(0.97735390014519996),
+ FRAC_CONST(0.97799851493455714),
+ FRAC_CONST(0.9786339244294231),
+ FRAC_CONST(0.97926012264908202),
+ FRAC_CONST(0.97987710369951764),
+ FRAC_CONST(0.98048486177346938),
+ FRAC_CONST(0.98108339115048659),
+ FRAC_CONST(0.98167268619698311),
+ FRAC_CONST(0.98225274136628937),
+ FRAC_CONST(0.98282355119870524),
+ FRAC_CONST(0.98338511032155118),
+ FRAC_CONST(0.98393741344921892),
+ FRAC_CONST(0.98448045538322093),
+ FRAC_CONST(0.98501423101223984),
+ FRAC_CONST(0.98553873531217606),
+ FRAC_CONST(0.98605396334619544),
+ FRAC_CONST(0.98655991026477541),
+ FRAC_CONST(0.98705657130575097),
+ FRAC_CONST(0.98754394179435923),
+ FRAC_CONST(0.98802201714328353),
+ FRAC_CONST(0.98849079285269659),
+ FRAC_CONST(0.98895026451030299),
+ FRAC_CONST(0.98940042779138038),
+ FRAC_CONST(0.98984127845882053),
+ FRAC_CONST(0.99027281236316911),
+ FRAC_CONST(0.99069502544266463),
+ FRAC_CONST(0.99110791372327678),
+ FRAC_CONST(0.9915114733187439),
+ FRAC_CONST(0.99190570043060933),
+ FRAC_CONST(0.99229059134825737),
+ FRAC_CONST(0.99266614244894802),
+ FRAC_CONST(0.99303235019785141),
+ FRAC_CONST(0.99338921114808065),
+ FRAC_CONST(0.9937367219407246),
+ FRAC_CONST(0.99407487930487937),
+ FRAC_CONST(0.9944036800576791),
+ FRAC_CONST(0.9947231211043257),
+ FRAC_CONST(0.99503319943811863),
+ FRAC_CONST(0.99533391214048228),
+ FRAC_CONST(0.99562525638099431),
+ FRAC_CONST(0.99590722941741172),
+ FRAC_CONST(0.99617982859569687),
+ FRAC_CONST(0.99644305135004263),
+ FRAC_CONST(0.99669689520289606),
+ FRAC_CONST(0.99694135776498216),
+ FRAC_CONST(0.99717643673532619),
+ FRAC_CONST(0.9974021299012753),
+ FRAC_CONST(0.99761843513851955),
+ FRAC_CONST(0.99782535041111164),
+ FRAC_CONST(0.99802287377148624),
+ FRAC_CONST(0.99821100336047819),
+ FRAC_CONST(0.99838973740734016),
+ FRAC_CONST(0.99855907422975931),
+ FRAC_CONST(0.99871901223387294),
+ FRAC_CONST(0.99886954991428356),
+ FRAC_CONST(0.99901068585407338),
+ FRAC_CONST(0.99914241872481691),
+ FRAC_CONST(0.99926474728659442),
+ FRAC_CONST(0.99937767038800285),
+ FRAC_CONST(0.99948118696616695),
+ FRAC_CONST(0.99957529604674922),
+ FRAC_CONST(0.99965999674395922),
+ FRAC_CONST(0.99973528826056168),
+ FRAC_CONST(0.99980116988788426),
+ FRAC_CONST(0.99985764100582386),
+ FRAC_CONST(0.9999047010828529),
+ FRAC_CONST(0.99994234967602391),
+ FRAC_CONST(0.99997058643097414),
+ FRAC_CONST(0.9999894110819284),
+ FRAC_CONST(0.99999882345170188)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ALIGN static const real_t sine_mid_480[] =
+{
+ FRAC_CONST(0.0016362454436240478),
+ FRAC_CONST(0.00490871880799799),
+ FRAC_CONST(0.0081811396039371282),
+ FRAC_CONST(0.011453472786443779),
+ FRAC_CONST(0.014725683311458524),
+ FRAC_CONST(0.017997736136235509),
+ FRAC_CONST(0.021269596219717739),
+ FRAC_CONST(0.024541228522912285),
+ FRAC_CONST(0.027812598009265607),
+ FRAC_CONST(0.03108366964503869),
+ FRAC_CONST(0.034354408399682276),
+ FRAC_CONST(0.037624779246211978),
+ FRAC_CONST(0.04089474716158345),
+ FRAC_CONST(0.044164277127067358),
+ FRAC_CONST(0.047433334128624507),
+ FRAC_CONST(0.050701883157280733),
+ FRAC_CONST(0.053969889209501881),
+ FRAC_CONST(0.057237317287568618),
+ FRAC_CONST(0.060504132399951269),
+ FRAC_CONST(0.063770299561684493),
+ FRAC_CONST(0.06703578379474201),
+ FRAC_CONST(0.070300550128411174),
+ FRAC_CONST(0.073564563599667426),
+ FRAC_CONST(0.076827789253548759),
+ FRAC_CONST(0.080090192143530081),
+ FRAC_CONST(0.083351737331897449),
+ FRAC_CONST(0.086612389890122182),
+ FRAC_CONST(0.089872114899234967),
+ FRAC_CONST(0.093130877450199795),
+ FRAC_CONST(0.096388642644287828),
+ FRAC_CONST(0.09964537559345106),
+ FRAC_CONST(0.1029010414206961),
+ FRAC_CONST(0.10615560526045748),
+ FRAC_CONST(0.10940903225897117),
+ FRAC_CONST(0.11266128757464781),
+ FRAC_CONST(0.11591233637844581),
+ FRAC_CONST(0.11916214385424433),
+ FRAC_CONST(0.1224106751992162),
+ FRAC_CONST(0.12565789562420052),
+ FRAC_CONST(0.12890377035407541),
+ FRAC_CONST(0.13214826462813015),
+ FRAC_CONST(0.13539134370043773),
+ FRAC_CONST(0.13863297284022669),
+ FRAC_CONST(0.14187311733225325),
+ FRAC_CONST(0.14511174247717309),
+ FRAC_CONST(0.14834881359191271),
+ FRAC_CONST(0.15158429601004111),
+ FRAC_CONST(0.15481815508214106),
+ FRAC_CONST(0.1580503561761798),
+ FRAC_CONST(0.16128086467788047),
+ FRAC_CONST(0.16450964599109233),
+ FRAC_CONST(0.16773666553816149),
+ FRAC_CONST(0.17096188876030122),
+ FRAC_CONST(0.17418528111796186),
+ FRAC_CONST(0.17740680809120093),
+ FRAC_CONST(0.18062643518005275),
+ FRAC_CONST(0.18384412790489776),
+ FRAC_CONST(0.18705985180683199),
+ FRAC_CONST(0.19027357244803589),
+ FRAC_CONST(0.19348525541214331),
+ FRAC_CONST(0.19669486630460997),
+ FRAC_CONST(0.19990237075308173),
+ FRAC_CONST(0.20310773440776286),
+ FRAC_CONST(0.20631092294178383),
+ FRAC_CONST(0.20951190205156878),
+ FRAC_CONST(0.21271063745720317),
+ FRAC_CONST(0.21590709490280058),
+ FRAC_CONST(0.2191012401568698),
+ FRAC_CONST(0.22229303901268133),
+ FRAC_CONST(0.22548245728863364),
+ FRAC_CONST(0.22866946082861941),
+ FRAC_CONST(0.23185401550239115),
+ FRAC_CONST(0.23503608720592667),
+ FRAC_CONST(0.23821564186179459),
+ FRAC_CONST(0.24139264541951888),
+ FRAC_CONST(0.24456706385594387),
+ FRAC_CONST(0.24773886317559846),
+ FRAC_CONST(0.25090800941106001),
+ FRAC_CONST(0.25407446862331851),
+ FRAC_CONST(0.25723820690213967),
+ FRAC_CONST(0.26039919036642817),
+ FRAC_CONST(0.26355738516459076),
+ FRAC_CONST(0.26671275747489837),
+ FRAC_CONST(0.2698652735058486),
+ FRAC_CONST(0.27301489949652735),
+ FRAC_CONST(0.27616160171697068),
+ FRAC_CONST(0.27930534646852595),
+ FRAC_CONST(0.28244610008421245),
+ FRAC_CONST(0.2855838289290823),
+ FRAC_CONST(0.28871849940058025),
+ FRAC_CONST(0.29185007792890405),
+ FRAC_CONST(0.29497853097736348),
+ FRAC_CONST(0.2981038250427398),
+ FRAC_CONST(0.30122592665564446),
+ FRAC_CONST(0.30434480238087736),
+ FRAC_CONST(0.30746041881778519),
+ FRAC_CONST(0.31057274260061901),
+ FRAC_CONST(0.31368174039889146),
+ FRAC_CONST(0.31678737891773395),
+ FRAC_CONST(0.31988962489825296),
+ FRAC_CONST(0.32298844511788638),
+ FRAC_CONST(0.32608380639075912),
+ FRAC_CONST(0.32917567556803889),
+ FRAC_CONST(0.33226401953829071),
+ FRAC_CONST(0.33534880522783189),
+ FRAC_CONST(0.33842999960108583),
+ FRAC_CONST(0.34150756966093632),
+ FRAC_CONST(0.34458148244908043),
+ FRAC_CONST(0.34765170504638188),
+ FRAC_CONST(0.35071820457322322),
+ FRAC_CONST(0.35378094818985806),
+ FRAC_CONST(0.35683990309676283),
+ FRAC_CONST(0.35989503653498811),
+ FRAC_CONST(0.36294631578650921),
+ FRAC_CONST(0.36599370817457672),
+ FRAC_CONST(0.36903718106406647),
+ FRAC_CONST(0.37207670186182878),
+ FRAC_CONST(0.37511223801703802),
+ FRAC_CONST(0.37814375702154046),
+ FRAC_CONST(0.38117122641020335),
+ FRAC_CONST(0.38419461376126157),
+ FRAC_CONST(0.38721388669666562),
+ FRAC_CONST(0.39022901288242801),
+ FRAC_CONST(0.39323996002896966),
+ FRAC_CONST(0.39624669589146555),
+ FRAC_CONST(0.39924918827019029),
+ FRAC_CONST(0.40224740501086254),
+ FRAC_CONST(0.40524131400498986),
+ FRAC_CONST(0.40823088319021217),
+ FRAC_CONST(0.41121608055064529),
+ FRAC_CONST(0.41419687411722372),
+ FRAC_CONST(0.41717323196804335),
+ FRAC_CONST(0.42014512222870243),
+ FRAC_CONST(0.42311251307264408),
+ FRAC_CONST(0.42607537272149631),
+ FRAC_CONST(0.4290336694454126),
+ FRAC_CONST(0.43198737156341183),
+ FRAC_CONST(0.43493644744371707),
+ FRAC_CONST(0.43788086550409511),
+ FRAC_CONST(0.44082059421219388),
+ FRAC_CONST(0.44375560208588088),
+ FRAC_CONST(0.44668585769357955),
+ FRAC_CONST(0.4496113296546066),
+ FRAC_CONST(0.45253198663950756),
+ FRAC_CONST(0.45544779737039259),
+ FRAC_CONST(0.45835873062127125),
+ FRAC_CONST(0.46126475521838717),
+ FRAC_CONST(0.46416584004055156),
+ FRAC_CONST(0.46706195401947659),
+ FRAC_CONST(0.46995306614010829),
+ FRAC_CONST(0.47283914544095862),
+ FRAC_CONST(0.47572016101443682),
+ FRAC_CONST(0.47859608200718085),
+ FRAC_CONST(0.4814668776203872),
+ FRAC_CONST(0.48433251711014125),
+ FRAC_CONST(0.4871929697877464),
+ FRAC_CONST(0.49004820502005247),
+ FRAC_CONST(0.49289819222978404),
+ FRAC_CONST(0.49574290089586776),
+ FRAC_CONST(0.49858230055375902),
+ FRAC_CONST(0.50141636079576901),
+ FRAC_CONST(0.50424505127138919),
+ FRAC_CONST(0.50706834168761705),
+ FRAC_CONST(0.50988620180928057),
+ FRAC_CONST(0.51269860145936175),
+ FRAC_CONST(0.51550551051931948),
+ FRAC_CONST(0.51830689892941317),
+ FRAC_CONST(0.5211027366890234),
+ FRAC_CONST(0.52389299385697385),
+ FRAC_CONST(0.52667764055185196),
+ FRAC_CONST(0.52945664695232897),
+ FRAC_CONST(0.53222998329747884),
+ FRAC_CONST(0.53499761988709726),
+ FRAC_CONST(0.53775952708201991),
+ FRAC_CONST(0.54051567530443978),
+ FRAC_CONST(0.54326603503822357),
+ FRAC_CONST(0.54601057682922816),
+ FRAC_CONST(0.54874927128561579),
+ FRAC_CONST(0.55148208907816942),
+ FRAC_CONST(0.55420900094060566),
+ FRAC_CONST(0.55692997766988939),
+ FRAC_CONST(0.559644990126546),
+ FRAC_CONST(0.56235400923497314),
+ FRAC_CONST(0.56505700598375252),
+ FRAC_CONST(0.56775395142596052),
+ FRAC_CONST(0.57044481667947822),
+ FRAC_CONST(0.57312957292730071),
+ FRAC_CONST(0.57580819141784534),
+ FRAC_CONST(0.57848064346525996),
+ FRAC_CONST(0.58114690044973039),
+ FRAC_CONST(0.58380693381778626),
+ FRAC_CONST(0.58646071508260733),
+ FRAC_CONST(0.58910821582432815),
+ FRAC_CONST(0.5917494076903429),
+ FRAC_CONST(0.5943842623956086),
+ FRAC_CONST(0.59701275172294799),
+ FRAC_CONST(0.59963484752335228),
+ FRAC_CONST(0.60225052171628191),
+ FRAC_CONST(0.60485974628996786),
+ FRAC_CONST(0.60746249330171098),
+ FRAC_CONST(0.61005873487818185),
+ FRAC_CONST(0.61264844321571899),
+ FRAC_CONST(0.61523159058062682),
+ FRAC_CONST(0.61780814930947225),
+ FRAC_CONST(0.62037809180938108),
+ FRAC_CONST(0.62294139055833397),
+ FRAC_CONST(0.6254980181054608),
+ FRAC_CONST(0.62804794707133416),
+ FRAC_CONST(0.63059115014826372),
+ FRAC_CONST(0.63312760010058777),
+ FRAC_CONST(0.63565726976496484),
+ FRAC_CONST(0.63818013205066515),
+ FRAC_CONST(0.64069615993986073),
+ FRAC_CONST(0.64320532648791406),
+ FRAC_CONST(0.64570760482366729),
+ FRAC_CONST(0.64820296814972966),
+ FRAC_CONST(0.65069138974276486),
+ FRAC_CONST(0.65317284295377676),
+ FRAC_CONST(0.65564730120839498),
+ FRAC_CONST(0.65811473800715958),
+ FRAC_CONST(0.660575126925805),
+ FRAC_CONST(0.66302844161554231),
+ FRAC_CONST(0.6654746558033422),
+ FRAC_CONST(0.66791374329221598),
+ FRAC_CONST(0.67034567796149647),
+ FRAC_CONST(0.67277043376711676),
+ FRAC_CONST(0.67518798474189046),
+ FRAC_CONST(0.67759830499578866),
+ FRAC_CONST(0.68000136871621808),
+ FRAC_CONST(0.68239715016829683),
+ FRAC_CONST(0.6847856236951303),
+ FRAC_CONST(0.68716676371808583),
+ FRAC_CONST(0.68954054473706683),
+ FRAC_CONST(0.69190694133078579),
+ FRAC_CONST(0.69426592815703603),
+ FRAC_CONST(0.69661747995296419),
+ FRAC_CONST(0.69896157153533944),
+ FRAC_CONST(0.70129817780082437),
+ FRAC_CONST(0.7036272737262429),
+ FRAC_CONST(0.70594883436884903),
+ FRAC_CONST(0.70826283486659336),
+ FRAC_CONST(0.71056925043838959),
+ FRAC_CONST(0.71286805638437978),
+ FRAC_CONST(0.71515922808619936),
+ FRAC_CONST(0.71744274100723993),
+ FRAC_CONST(0.71971857069291278),
+ FRAC_CONST(0.7219866927709101),
+ FRAC_CONST(0.72424708295146689),
+ FRAC_CONST(0.72649971702762028),
+ FRAC_CONST(0.72874457087546896),
+ FRAC_CONST(0.73098162045443171),
+ FRAC_CONST(0.73321084180750484),
+ FRAC_CONST(0.73543221106151868),
+ FRAC_CONST(0.73764570442739286),
+ FRAC_CONST(0.73985129820039208),
+ FRAC_CONST(0.74204896876037885),
+ FRAC_CONST(0.7442386925720671),
+ FRAC_CONST(0.74642044618527381),
+ FRAC_CONST(0.74859420623517081),
+ FRAC_CONST(0.75075994944253421),
+ FRAC_CONST(0.75291765261399446),
+ FRAC_CONST(0.75506729264228367),
+ FRAC_CONST(0.75720884650648446),
+ FRAC_CONST(0.75934229127227548),
+ FRAC_CONST(0.76146760409217706),
+ FRAC_CONST(0.76358476220579641),
+ FRAC_CONST(0.7656937429400712),
+ FRAC_CONST(0.76779452370951196),
+ FRAC_CONST(0.76988708201644451),
+ FRAC_CONST(0.77197139545125026),
+ FRAC_CONST(0.7740474416926072),
+ FRAC_CONST(0.77611519850772781),
+ FRAC_CONST(0.77817464375259782),
+ FRAC_CONST(0.78022575537221317),
+ FRAC_CONST(0.78226851140081632),
+ FRAC_CONST(0.78430288996213138),
+ FRAC_CONST(0.78632886926959822),
+ FRAC_CONST(0.78834642762660623),
+ FRAC_CONST(0.79035554342672631),
+ FRAC_CONST(0.79235619515394229),
+ FRAC_CONST(0.79434836138288134),
+ FRAC_CONST(0.79633202077904397),
+ FRAC_CONST(0.79830715209903147),
+ FRAC_CONST(0.8002737341907743),
+ FRAC_CONST(0.80223174599375802),
+ FRAC_CONST(0.80418116653924954),
+ FRAC_CONST(0.80612197495052085),
+ FRAC_CONST(0.80805415044307316),
+ FRAC_CONST(0.80997767232485907),
+ FRAC_CONST(0.81189251999650469),
+ FRAC_CONST(0.81379867295152986),
+ FRAC_CONST(0.81569611077656778),
+ FRAC_CONST(0.81758481315158371),
+ FRAC_CONST(0.81946475985009259),
+ FRAC_CONST(0.82133593073937561),
+ FRAC_CONST(0.82319830578069586),
+ FRAC_CONST(0.82505186502951278),
+ FRAC_CONST(0.82689658863569615),
+ FRAC_CONST(0.82873245684373809),
+ FRAC_CONST(0.83055944999296494),
+ FRAC_CONST(0.83237754851774781),
+ FRAC_CONST(0.83418673294771239),
+ FRAC_CONST(0.83598698390794668),
+ FRAC_CONST(0.83777828211920935),
+ FRAC_CONST(0.83956060839813562),
+ FRAC_CONST(0.84133394365744296),
+ FRAC_CONST(0.84309826890613537),
+ FRAC_CONST(0.84485356524970701),
+ FRAC_CONST(0.84659981389034411),
+ FRAC_CONST(0.84833699612712676),
+ FRAC_CONST(0.85006509335622882),
+ FRAC_CONST(0.8517840870711173),
+ FRAC_CONST(0.85349395886275037),
+ FRAC_CONST(0.85519469041977514),
+ FRAC_CONST(0.85688626352872277),
+ FRAC_CONST(0.85856866007420429),
+ FRAC_CONST(0.86024186203910447),
+ FRAC_CONST(0.86190585150477417),
+ FRAC_CONST(0.86356061065122347),
+ FRAC_CONST(0.86520612175731115),
+ FRAC_CONST(0.86684236720093533),
+ FRAC_CONST(0.86846932945922151),
+ FRAC_CONST(0.87008699110871135),
+ FRAC_CONST(0.87169533482554817),
+ FRAC_CONST(0.87329434338566281),
+ FRAC_CONST(0.87488399966495822),
+ FRAC_CONST(0.87646428663949283),
+ FRAC_CONST(0.87803518738566277),
+ FRAC_CONST(0.87959668508038291),
+ FRAC_CONST(0.88114876300126743),
+ FRAC_CONST(0.88269140452680916),
+ FRAC_CONST(0.8842245931365561),
+ FRAC_CONST(0.88574831241129048),
+ FRAC_CONST(0.88726254603320276),
+ FRAC_CONST(0.88876727778606746),
+ FRAC_CONST(0.89026249155541637),
+ FRAC_CONST(0.8917481713287112),
+ FRAC_CONST(0.89322430119551532),
+ FRAC_CONST(0.89469086534766362),
+ FRAC_CONST(0.89614784807943237),
+ FRAC_CONST(0.89759523378770689),
+ FRAC_CONST(0.89903300697214927),
+ FRAC_CONST(0.9004611522353636),
+ FRAC_CONST(0.90187965428306172),
+ FRAC_CONST(0.90328849792422594),
+ FRAC_CONST(0.90468766807127299),
+ FRAC_CONST(0.90607714974021469),
+ FRAC_CONST(0.90745692805081868),
+ FRAC_CONST(0.90882698822676755),
+ FRAC_CONST(0.91018731559581767),
+ FRAC_CONST(0.91153789558995579),
+ FRAC_CONST(0.91287871374555518),
+ FRAC_CONST(0.91420975570353069),
+ FRAC_CONST(0.9155310072094921),
+ FRAC_CONST(0.91684245411389753),
+ FRAC_CONST(0.91814408237220391),
+ FRAC_CONST(0.91943587804501858),
+ FRAC_CONST(0.92071782729824769),
+ FRAC_CONST(0.92198991640324446),
+ FRAC_CONST(0.92325213173695675),
+ FRAC_CONST(0.92450445978207241),
+ FRAC_CONST(0.92574688712716402),
+ FRAC_CONST(0.92697940046683291),
+ FRAC_CONST(0.92820198660185149),
+ FRAC_CONST(0.92941463243930444),
+ FRAC_CONST(0.93061732499272909),
+ FRAC_CONST(0.93181005138225426),
+ FRAC_CONST(0.93299279883473885),
+ FRAC_CONST(0.93416555468390772),
+ FRAC_CONST(0.93532830637048769),
+ FRAC_CONST(0.93648104144234268),
+ FRAC_CONST(0.93762374755460598),
+ FRAC_CONST(0.93875641246981323),
+ FRAC_CONST(0.93987902405803303),
+ FRAC_CONST(0.94099157029699743),
+ FRAC_CONST(0.94209403927222979),
+ FRAC_CONST(0.94318641917717327),
+ FRAC_CONST(0.9442686983133165),
+ FRAC_CONST(0.94534086509031956),
+ FRAC_CONST(0.9464029080261378),
+ FRAC_CONST(0.94745481574714419),
+ FRAC_CONST(0.94849657698825252),
+ FRAC_CONST(0.94952818059303667),
+ FRAC_CONST(0.95054961551385087),
+ FRAC_CONST(0.95156087081194762),
+ FRAC_CONST(0.95256193565759528),
+ FRAC_CONST(0.95355279933019343),
+ FRAC_CONST(0.9545334512183884),
+ FRAC_CONST(0.95550388082018611),
+ FRAC_CONST(0.95646407774306541),
+ FRAC_CONST(0.95741403170408834),
+ FRAC_CONST(0.95835373253001133),
+ FRAC_CONST(0.95928317015739362),
+ FRAC_CONST(0.96020233463270466),
+ FRAC_CONST(0.96111121611243155),
+ FRAC_CONST(0.96200980486318388),
+ FRAC_CONST(0.96289809126179782),
+ FRAC_CONST(0.96377606579543984),
+ FRAC_CONST(0.96464371906170809),
+ FRAC_CONST(0.96550104176873297),
+ FRAC_CONST(0.96634802473527726),
+ FRAC_CONST(0.96718465889083372),
+ FRAC_CONST(0.96801093527572268),
+ FRAC_CONST(0.96882684504118799),
+ FRAC_CONST(0.96963237944949143),
+ FRAC_CONST(0.97042752987400682),
+ FRAC_CONST(0.97121228779931179),
+ FRAC_CONST(0.97198664482127939),
+ FRAC_CONST(0.97275059264716823),
+ FRAC_CONST(0.97350412309571066),
+ FRAC_CONST(0.97424722809720088),
+ FRAC_CONST(0.97497989969358168),
+ FRAC_CONST(0.97570213003852857),
+ FRAC_CONST(0.97641391139753486),
+ FRAC_CONST(0.97711523614799412),
+ FRAC_CONST(0.97780609677928154),
+ FRAC_CONST(0.97848648589283505),
+ FRAC_CONST(0.97915639620223371),
+ FRAC_CONST(0.9798158205332762),
+ FRAC_CONST(0.98046475182405801),
+ FRAC_CONST(0.98110318312504607),
+ FRAC_CONST(0.98173110759915416),
+ FRAC_CONST(0.98234851852181571),
+ FRAC_CONST(0.98295540928105563),
+ FRAC_CONST(0.9835517733775615),
+ FRAC_CONST(0.98413760442475307),
+ FRAC_CONST(0.98471289614885038),
+ FRAC_CONST(0.98527764238894122),
+ FRAC_CONST(0.98583183709704714),
+ FRAC_CONST(0.98637547433818806),
+ FRAC_CONST(0.98690854829044583),
+ FRAC_CONST(0.98743105324502667),
+ FRAC_CONST(0.98794298360632238),
+ FRAC_CONST(0.98844433389196995),
+ FRAC_CONST(0.98893509873291074),
+ FRAC_CONST(0.98941527287344755),
+ FRAC_CONST(0.98988485117130098),
+ FRAC_CONST(0.99034382859766479),
+ FRAC_CONST(0.99079220023725967),
+ FRAC_CONST(0.99122996128838525),
+ FRAC_CONST(0.9916571070629725),
+ FRAC_CONST(0.99207363298663342),
+ FRAC_CONST(0.99247953459870997),
+ FRAC_CONST(0.99287480755232194),
+ FRAC_CONST(0.99325944761441354),
+ FRAC_CONST(0.99363345066579889),
+ FRAC_CONST(0.99399681270120555),
+ FRAC_CONST(0.99434952982931812),
+ FRAC_CONST(0.9946915982728195),
+ FRAC_CONST(0.99502301436843166),
+ FRAC_CONST(0.99534377456695422),
+ FRAC_CONST(0.9956538754333033),
+ FRAC_CONST(0.99595331364654771),
+ FRAC_CONST(0.99624208599994479),
+ FRAC_CONST(0.99652018940097464),
+ FRAC_CONST(0.99678762087137318),
+ FRAC_CONST(0.99704437754716424),
+ FRAC_CONST(0.99729045667869021),
+ FRAC_CONST(0.99752585563064111),
+ FRAC_CONST(0.99775057188208349),
+ FRAC_CONST(0.9979646030264866),
+ FRAC_CONST(0.99816794677174903),
+ FRAC_CONST(0.9983606009402225),
+ FRAC_CONST(0.99854256346873571),
+ FRAC_CONST(0.99871383240861611),
+ FRAC_CONST(0.99887440592571108),
+ FRAC_CONST(0.99902428230040718),
+ FRAC_CONST(0.99916345992764877),
+ FRAC_CONST(0.99929193731695531),
+ FRAC_CONST(0.99940971309243731),
+ FRAC_CONST(0.99951678599281069),
+ FRAC_CONST(0.99961315487141078),
+ FRAC_CONST(0.99969881869620425),
+ FRAC_CONST(0.99977377654980037),
+ FRAC_CONST(0.99983802762946083),
+ FRAC_CONST(0.99989157124710804),
+ FRAC_CONST(0.9999344068293331),
+ FRAC_CONST(0.99996653391740109),
+ FRAC_CONST(0.99998795216725689),
+ FRAC_CONST(0.99999866134952808)
+};
+#endif
+
+ALIGN static const real_t ld_mid_512[] =
+{
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0.0061358846491544753),
+ FRAC_CONST(0.01840672990580482),
+ FRAC_CONST(0.030674803176636626),
+ FRAC_CONST(0.04293825693494082),
+ FRAC_CONST(0.055195244349689934),
+ FRAC_CONST(0.067443919563664051),
+ FRAC_CONST(0.079682437971430126),
+ FRAC_CONST(0.091908956497132724),
+ FRAC_CONST(0.10412163387205459),
+ FRAC_CONST(0.11631863091190475),
+ FRAC_CONST(0.12849811079379317),
+ FRAC_CONST(0.14065823933284921),
+ FRAC_CONST(0.15279718525844344),
+ FRAC_CONST(0.16491312048996989),
+ FRAC_CONST(0.17700422041214875),
+ FRAC_CONST(0.18906866414980619),
+ FRAC_CONST(0.2011046348420919),
+ FRAC_CONST(0.21311031991609136),
+ FRAC_CONST(0.22508391135979283),
+ FRAC_CONST(0.2370236059943672),
+ FRAC_CONST(0.24892760574572015),
+ FRAC_CONST(0.26079411791527551),
+ FRAC_CONST(0.27262135544994898),
+ FRAC_CONST(0.28440753721127188),
+ FRAC_CONST(0.29615088824362379),
+ FRAC_CONST(0.30784964004153487),
+ FRAC_CONST(0.31950203081601569),
+ FRAC_CONST(0.33110630575987643),
+ FRAC_CONST(0.34266071731199438),
+ FRAC_CONST(0.35416352542049034),
+ FRAC_CONST(0.36561299780477385),
+ FRAC_CONST(0.37700741021641826),
+ FRAC_CONST(0.38834504669882625),
+ FRAC_CONST(0.39962419984564679),
+ FRAC_CONST(0.41084317105790391),
+ FRAC_CONST(0.42200027079979968),
+ FRAC_CONST(0.43309381885315196),
+ FRAC_CONST(0.4441221445704292),
+ FRAC_CONST(0.45508358712634384),
+ FRAC_CONST(0.46597649576796618),
+ FRAC_CONST(0.47679923006332209),
+ FRAC_CONST(0.487550160148436),
+ FRAC_CONST(0.49822766697278187),
+ FRAC_CONST(0.50883014254310699),
+ FRAC_CONST(0.51935599016558964),
+ FRAC_CONST(0.52980362468629461),
+ FRAC_CONST(0.54017147272989285),
+ FRAC_CONST(0.55045797293660481),
+ FRAC_CONST(0.56066157619733603),
+ FRAC_CONST(0.57078074588696726),
+ FRAC_CONST(0.58081395809576453),
+ FRAC_CONST(0.59075970185887416),
+ FRAC_CONST(0.60061647938386897),
+ FRAC_CONST(0.61038280627630948),
+ FRAC_CONST(0.6200572117632891),
+ FRAC_CONST(0.62963823891492698),
+ FRAC_CONST(0.63912444486377573),
+ FRAC_CONST(0.64851440102211244),
+ FRAC_CONST(0.65780669329707864),
+ FRAC_CONST(0.66699992230363747),
+ FRAC_CONST(0.67609270357531592),
+ FRAC_CONST(0.68508366777270036),
+ FRAC_CONST(0.693971460889654),
+ FRAC_CONST(0.7027547444572253),
+ FRAC_CONST(0.71143219574521643),
+ FRAC_CONST(0.72000250796138165),
+ FRAC_CONST(0.7284643904482252),
+ FRAC_CONST(0.73681656887736979),
+ FRAC_CONST(0.74505778544146595),
+ FRAC_CONST(0.75318679904361241),
+ FRAC_CONST(0.76120238548426178),
+ FRAC_CONST(0.76910333764557959),
+ FRAC_CONST(0.77688846567323244),
+ FRAC_CONST(0.78455659715557524),
+ FRAC_CONST(0.79210657730021239),
+ FRAC_CONST(0.79953726910790501),
+ FRAC_CONST(0.80684755354379922),
+ FRAC_CONST(0.8140363297059483),
+ FRAC_CONST(0.82110251499110465),
+ FRAC_CONST(0.8280450452577558),
+ FRAC_CONST(0.83486287498638001),
+ FRAC_CONST(0.84155497743689833),
+ FRAC_CONST(0.84812034480329712),
+ FRAC_CONST(0.85455798836540053),
+ FRAC_CONST(0.86086693863776731),
+ FRAC_CONST(0.86704624551569265),
+ FRAC_CONST(0.87309497841829009),
+ FRAC_CONST(0.87901222642863341),
+ FRAC_CONST(0.88479709843093779),
+ FRAC_CONST(0.89044872324475788),
+ FRAC_CONST(0.89596624975618511),
+ FRAC_CONST(0.90134884704602203),
+ FRAC_CONST(0.90659570451491533),
+ FRAC_CONST(0.91170603200542988),
+ FRAC_CONST(0.9166790599210427),
+ FRAC_CONST(0.9215140393420419),
+ FRAC_CONST(0.92621024213831127),
+ FRAC_CONST(0.93076696107898371),
+ FRAC_CONST(0.9351835099389475),
+ FRAC_CONST(0.93945922360218992),
+ FRAC_CONST(0.94359345816196039),
+ FRAC_CONST(0.94758559101774109),
+ FRAC_CONST(0.95143502096900834),
+ FRAC_CONST(0.95514116830577067),
+ FRAC_CONST(0.9587034748958716),
+ FRAC_CONST(0.96212140426904158),
+ FRAC_CONST(0.9653944416976894),
+ FRAC_CONST(0.96852209427441727),
+ FRAC_CONST(0.97150389098625178),
+ FRAC_CONST(0.97433938278557586),
+ FRAC_CONST(0.97702814265775439),
+ FRAC_CONST(0.97956976568544052),
+ FRAC_CONST(0.98196386910955524),
+ FRAC_CONST(0.98421009238692903),
+ FRAC_CONST(0.98630809724459867),
+ FRAC_CONST(0.98825756773074946),
+ FRAC_CONST(0.99005821026229712),
+ FRAC_CONST(0.99170975366909953),
+ FRAC_CONST(0.9932119492347945),
+ FRAC_CONST(0.99456457073425542),
+ FRAC_CONST(0.99576741446765982),
+ FRAC_CONST(0.99682029929116567),
+ FRAC_CONST(0.99772306664419164),
+ FRAC_CONST(0.99847558057329477),
+ FRAC_CONST(0.99907772775264536),
+ FRAC_CONST(0.99952941750109314),
+ FRAC_CONST(0.9998305817958234),
+ FRAC_CONST(0.99998117528260111),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1)
+};
+
+#ifdef ALLOW_SMALL_FRAMELENGTH
+ALIGN static const real_t ld_mid_480[] =
+{
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0),
+ FRAC_CONST(0.0065449379673518581),
+ FRAC_CONST(0.019633692460628301),
+ FRAC_CONST(0.032719082821776137),
+ FRAC_CONST(0.045798866936520771),
+ FRAC_CONST(0.058870803651189033),
+ FRAC_CONST(0.071932653156719387),
+ FRAC_CONST(0.084982177372441667),
+ FRAC_CONST(0.09801714032956059),
+ FRAC_CONST(0.11103530855427769),
+ FRAC_CONST(0.12403445145048532),
+ FRAC_CONST(0.13701234168196802),
+ FRAC_CONST(0.14996675555404498),
+ FRAC_CONST(0.16289547339458874),
+ FRAC_CONST(0.17579627993435451),
+ FRAC_CONST(0.18866696468655525),
+ FRAC_CONST(0.2015053223256171),
+ FRAC_CONST(0.21430915306505074),
+ FRAC_CONST(0.2270762630343732),
+ FRAC_CONST(0.23980446465501654),
+ FRAC_CONST(0.25249157701515795),
+ FRAC_CONST(0.26513542624340797),
+ FRAC_CONST(0.27773384588129219),
+ FRAC_CONST(0.29028467725446233),
+ FRAC_CONST(0.3027857698425746),
+ FRAC_CONST(0.31523498164776964),
+ FRAC_CONST(0.32763017956169349),
+ FRAC_CONST(0.33996923973099424),
+ FRAC_CONST(0.35225004792123354),
+ FRAC_CONST(0.36447049987914965),
+ FRAC_CONST(0.37662850169321077),
+ FRAC_CONST(0.38872197015239557),
+ FRAC_CONST(0.40074883310314097),
+ FRAC_CONST(0.41270702980439467),
+ FRAC_CONST(0.42459451128071307),
+ FRAC_CONST(0.43640924067334208),
+ FRAC_CONST(0.44814919358922256),
+ FRAC_CONST(0.45981235844785984),
+ FRAC_CONST(0.47139673682599764),
+ FRAC_CONST(0.48290034380003727),
+ FRAC_CONST(0.49432120828614462),
+ FRAC_CONST(0.50565737337798455),
+ FRAC_CONST(0.51690689668202761),
+ FRAC_CONST(0.52806785065036799),
+ FRAC_CONST(0.53913832291100017),
+ FRAC_CONST(0.55011641659549337),
+ FRAC_CONST(0.56100025066400983),
+ FRAC_CONST(0.57178796022761225),
+ FRAC_CONST(0.58247769686780215),
+ FRAC_CONST(0.59306762895323706),
+ FRAC_CONST(0.60355594195357143),
+ FRAC_CONST(0.61394083875036642),
+ FRAC_CONST(0.62422053994501758),
+ FRAC_CONST(0.63439328416364549),
+ FRAC_CONST(0.64445732835889735),
+ FRAC_CONST(0.65441094810861034),
+ FRAC_CONST(0.66425243791128175),
+ FRAC_CONST(0.67398011147829784),
+ FRAC_CONST(0.68359230202287125),
+ FRAC_CONST(0.69308736254563585),
+ FRAC_CONST(0.70246366611685174),
+ FRAC_CONST(0.71171960615517138),
+ FRAC_CONST(0.72085359670291882),
+ FRAC_CONST(0.7298640726978356),
+ FRAC_CONST(0.73874949024124625),
+ FRAC_CONST(0.74750832686259672),
+ FRAC_CONST(0.75613908178032285),
+ FRAC_CONST(0.76464027615900032),
+ FRAC_CONST(0.77301045336273699),
+ FRAC_CONST(0.78124817920475853),
+ FRAC_CONST(0.78935204219315003),
+ FRAC_CONST(0.79732065377270711),
+ FRAC_CONST(0.80515264856285829),
+ FRAC_CONST(0.81284668459161513),
+ FRAC_CONST(0.82040144352551359),
+ FRAC_CONST(0.82781563089550203),
+ FRAC_CONST(0.83508797631874299),
+ FRAC_CONST(0.84221723371628654),
+ FRAC_CONST(0.84920218152657889),
+ FRAC_CONST(0.85604162291477137),
+ FRAC_CONST(0.86273438597779184),
+ FRAC_CONST(0.86927932394514362),
+ FRAC_CONST(0.87567531537539967),
+ FRAC_CONST(0.88192126434835494),
+ FRAC_CONST(0.88801610065280734),
+ FRAC_CONST(0.89395877996993212),
+ FRAC_CONST(0.8997482840522214),
+ FRAC_CONST(0.90538362089795521),
+ FRAC_CONST(0.91086382492117568),
+ FRAC_CONST(0.91618795711713596),
+ FRAC_CONST(0.92135510522319242),
+ FRAC_CONST(0.9263643838751181),
+ FRAC_CONST(0.93121493475880346),
+ FRAC_CONST(0.93590592675732565),
+ FRAC_CONST(0.94043655609335486),
+ FRAC_CONST(0.94480604646687805),
+ FRAC_CONST(0.94901364918821385),
+ FRAC_CONST(0.95305864330629697),
+ FRAC_CONST(0.95694033573220882),
+ FRAC_CONST(0.9606580613579353),
+ FRAC_CONST(0.96421118317032928),
+ FRAC_CONST(0.96759909236025976),
+ FRAC_CONST(0.9708212084269281),
+ FRAC_CONST(0.97387697927733363),
+ FRAC_CONST(0.97676588132087239),
+ FRAC_CONST(0.97948741955905139),
+ FRAC_CONST(0.98204112767030394),
+ FRAC_CONST(0.98442656808989171),
+ FRAC_CONST(0.98664333208487898),
+ FRAC_CONST(0.98869103982416728),
+ FRAC_CONST(0.99056934044357725),
+ FRAC_CONST(0.99227791210596705),
+ FRAC_CONST(0.99381646205637808),
+ FRAC_CONST(0.99518472667219682),
+ FRAC_CONST(0.99638247150832537),
+ FRAC_CONST(0.99740949133735191),
+ FRAC_CONST(0.99826561018471593),
+ FRAC_CONST(0.99895068135886012),
+ FRAC_CONST(0.99946458747636568),
+ FRAC_CONST(0.99980724048206482),
+ FRAC_CONST(0.99997858166412923),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1),
+ FRAC_CONST(1)
+};
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/specrec.c b/src/filters/transform/mpadecfilter/faad2/libfaad/specrec.c
new file mode 100644
index 000000000..969444dfc
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/specrec.c
@@ -0,0 +1,1319 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: specrec.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/*
+ Spectral reconstruction:
+ - grouping/sectioning
+ - inverse quantization
+ - applying scalefactors
+*/
+
+#include "common.h"
+#include "structs.h"
+
+#include <string.h>
+#include <stdlib.h>
+#include "specrec.h"
+#include "filtbank.h"
+#include "syntax.h"
+#include "iq_table.h"
+#include "ms.h"
+#include "is.h"
+#include "pns.h"
+#include "tns.h"
+#include "drc.h"
+#include "lt_predict.h"
+#include "ic_predict.h"
+#ifdef SSR_DEC
+#include "ssr.h"
+#include "ssr_fb.h"
+#endif
+
+
+/* static function declarations */
+static uint8_t quant_to_spec(NeAACDecHandle hDecoder,
+ ic_stream *ics, int16_t *quant_data,
+ real_t *spec_data, uint16_t frame_len);
+
+
+#ifdef LD_DEC
+ALIGN static const uint8_t num_swb_512_window[] =
+{
+ 0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0
+};
+ALIGN static const uint8_t num_swb_480_window[] =
+{
+ 0, 0, 0, 35, 35, 37, 30, 30, 0, 0, 0, 0
+};
+#endif
+
+ALIGN static const uint8_t num_swb_960_window[] =
+{
+ 40, 40, 45, 49, 49, 49, 46, 46, 42, 42, 42, 40
+};
+
+ALIGN static const uint8_t num_swb_1024_window[] =
+{
+ 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40
+};
+
+ALIGN static const uint8_t num_swb_128_window[] =
+{
+ 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15
+};
+
+ALIGN static const uint16_t swb_offset_1024_96[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56,
+ 64, 72, 80, 88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240,
+ 276, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024
+};
+
+ALIGN static const uint16_t swb_offset_128_96[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
+};
+
+ALIGN static const uint16_t swb_offset_1024_64[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56,
+ 64, 72, 80, 88, 100, 112, 124, 140, 156, 172, 192, 216, 240, 268,
+ 304, 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, 744, 784, 824,
+ 864, 904, 944, 984, 1024
+};
+
+ALIGN static const uint16_t swb_offset_128_64[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128
+};
+
+ALIGN static const uint16_t swb_offset_1024_48[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72,
+ 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292,
+ 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736,
+ 768, 800, 832, 864, 896, 928, 1024
+};
+
+#ifdef LD_DEC
+ALIGN static const uint16_t swb_offset_512_48[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 68, 76, 84,
+ 92, 100, 112, 124, 136, 148, 164, 184, 208, 236, 268, 300, 332, 364, 396,
+ 428, 460, 512
+};
+
+ALIGN static const uint16_t swb_offset_480_48[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72 ,80 ,88,
+ 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 272, 304, 336, 368, 400,
+ 432, 480
+};
+#endif
+
+ALIGN static const uint16_t swb_offset_128_48[] =
+{
+ 0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128
+};
+
+ALIGN static const uint16_t swb_offset_1024_32[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72,
+ 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292,
+ 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736,
+ 768, 800, 832, 864, 896, 928, 960, 992, 1024
+};
+
+#ifdef LD_DEC
+ALIGN static const uint16_t swb_offset_512_32[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80,
+ 88, 96, 108, 120, 132, 144, 160, 176, 192, 212, 236, 260, 288, 320, 352,
+ 384, 416, 448, 480, 512
+};
+
+ALIGN static const uint16_t swb_offset_480_32[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80,
+ 88, 96, 104, 112, 124, 136, 148, 164, 180, 200, 224, 256, 288, 320, 352,
+ 384, 416, 448, 480
+};
+#endif
+
+ALIGN static const uint16_t swb_offset_1024_24[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68,
+ 76, 84, 92, 100, 108, 116, 124, 136, 148, 160, 172, 188, 204, 220,
+ 240, 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, 600, 652, 704,
+ 768, 832, 896, 960, 1024
+};
+
+#ifdef LD_DEC
+ALIGN static const uint16_t swb_offset_512_24[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68,
+ 80, 92, 104, 120, 140, 164, 192, 224, 256, 288, 320, 352, 384, 416,
+ 448, 480, 512
+};
+
+ALIGN static const uint16_t swb_offset_480_24[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 80, 92, 104, 120,
+ 140, 164, 192, 224, 256, 288, 320, 352, 384, 416, 448, 480
+};
+#endif
+
+ALIGN static const uint16_t swb_offset_128_24[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128
+};
+
+ALIGN static const uint16_t swb_offset_1024_16[] =
+{
+ 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124,
+ 136, 148, 160, 172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344,
+ 368, 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024
+};
+
+ALIGN static const uint16_t swb_offset_128_16[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128
+};
+
+ALIGN static const uint16_t swb_offset_1024_8[] =
+{
+ 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172,
+ 188, 204, 220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448,
+ 476, 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, 1024
+};
+
+ALIGN static const uint16_t swb_offset_128_8[] =
+{
+ 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128
+};
+
+ALIGN static const uint16_t *swb_offset_1024_window[] =
+{
+ swb_offset_1024_96, /* 96000 */
+ swb_offset_1024_96, /* 88200 */
+ swb_offset_1024_64, /* 64000 */
+ swb_offset_1024_48, /* 48000 */
+ swb_offset_1024_48, /* 44100 */
+ swb_offset_1024_32, /* 32000 */
+ swb_offset_1024_24, /* 24000 */
+ swb_offset_1024_24, /* 22050 */
+ swb_offset_1024_16, /* 16000 */
+ swb_offset_1024_16, /* 12000 */
+ swb_offset_1024_16, /* 11025 */
+ swb_offset_1024_8 /* 8000 */
+};
+
+#ifdef LD_DEC
+ALIGN static const uint16_t *swb_offset_512_window[] =
+{
+ 0, /* 96000 */
+ 0, /* 88200 */
+ 0, /* 64000 */
+ swb_offset_512_48, /* 48000 */
+ swb_offset_512_48, /* 44100 */
+ swb_offset_512_32, /* 32000 */
+ swb_offset_512_24, /* 24000 */
+ swb_offset_512_24, /* 22050 */
+ 0, /* 16000 */
+ 0, /* 12000 */
+ 0, /* 11025 */
+ 0 /* 8000 */
+};
+
+ALIGN static const uint16_t *swb_offset_480_window[] =
+{
+ 0, /* 96000 */
+ 0, /* 88200 */
+ 0, /* 64000 */
+ swb_offset_480_48, /* 48000 */
+ swb_offset_480_48, /* 44100 */
+ swb_offset_480_32, /* 32000 */
+ swb_offset_480_24, /* 24000 */
+ swb_offset_480_24, /* 22050 */
+ 0, /* 16000 */
+ 0, /* 12000 */
+ 0, /* 11025 */
+ 0 /* 8000 */
+};
+#endif
+
+ALIGN static const uint16_t *swb_offset_128_window[] =
+{
+ swb_offset_128_96, /* 96000 */
+ swb_offset_128_96, /* 88200 */
+ swb_offset_128_64, /* 64000 */
+ swb_offset_128_48, /* 48000 */
+ swb_offset_128_48, /* 44100 */
+ swb_offset_128_48, /* 32000 */
+ swb_offset_128_24, /* 24000 */
+ swb_offset_128_24, /* 22050 */
+ swb_offset_128_16, /* 16000 */
+ swb_offset_128_16, /* 12000 */
+ swb_offset_128_16, /* 11025 */
+ swb_offset_128_8 /* 8000 */
+};
+
+#define bit_set(A, B) ((A) & (1<<(B)))
+
+/* 4.5.2.3.4 */
+/*
+ - determine the number of windows in a window_sequence named num_windows
+ - determine the number of window_groups named num_window_groups
+ - determine the number of windows in each group named window_group_length[g]
+ - determine the total number of scalefactor window bands named num_swb for
+ the actual window type
+ - determine swb_offset[swb], the offset of the first coefficient in
+ scalefactor window band named swb of the window actually used
+ - determine sect_sfb_offset[g][section],the offset of the first coefficient
+ in section named section. This offset depends on window_sequence and
+ scale_factor_grouping and is needed to decode the spectral_data().
+*/
+uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics)
+{
+ uint8_t i, g;
+
+ uint8_t sf_index = hDecoder->sf_index;
+
+ switch (ics->window_sequence) {
+ case ONLY_LONG_SEQUENCE:
+ case LONG_START_SEQUENCE:
+ case LONG_STOP_SEQUENCE:
+ ics->num_windows = 1;
+ ics->num_window_groups = 1;
+ ics->window_group_length[ics->num_window_groups-1] = 1;
+#ifdef LD_DEC
+ if (hDecoder->object_type == LD)
+ {
+ if (hDecoder->frameLength == 512)
+ ics->num_swb = num_swb_512_window[sf_index];
+ else /* if (hDecoder->frameLength == 480) */
+ ics->num_swb = num_swb_480_window[sf_index];
+ } else {
+#endif
+ if (hDecoder->frameLength == 1024)
+ ics->num_swb = num_swb_1024_window[sf_index];
+ else /* if (hDecoder->frameLength == 960) */
+ ics->num_swb = num_swb_960_window[sf_index];
+#ifdef LD_DEC
+ }
+#endif
+
+ if (ics->max_sfb > ics->num_swb)
+ {
+ return 32;
+ }
+
+ /* preparation of sect_sfb_offset for long blocks */
+ /* also copy the last value! */
+#ifdef LD_DEC
+ if (hDecoder->object_type == LD)
+ {
+ if (hDecoder->frameLength == 512)
+ {
+ for (i = 0; i < ics->num_swb; i++)
+ {
+ ics->sect_sfb_offset[0][i] = swb_offset_512_window[sf_index][i];
+ ics->swb_offset[i] = swb_offset_512_window[sf_index][i];
+ }
+ } else /* if (hDecoder->frameLength == 480) */ {
+ for (i = 0; i < ics->num_swb; i++)
+ {
+ ics->sect_sfb_offset[0][i] = swb_offset_480_window[sf_index][i];
+ ics->swb_offset[i] = swb_offset_480_window[sf_index][i];
+ }
+ }
+ ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength;
+ ics->swb_offset[ics->num_swb] = hDecoder->frameLength;
+ } else {
+#endif
+ for (i = 0; i < ics->num_swb; i++)
+ {
+ ics->sect_sfb_offset[0][i] = swb_offset_1024_window[sf_index][i];
+ ics->swb_offset[i] = swb_offset_1024_window[sf_index][i];
+ }
+ ics->sect_sfb_offset[0][ics->num_swb] = hDecoder->frameLength;
+ ics->swb_offset[ics->num_swb] = hDecoder->frameLength;
+#ifdef LD_DEC
+ }
+#endif
+ return 0;
+ case EIGHT_SHORT_SEQUENCE:
+ ics->num_windows = 8;
+ ics->num_window_groups = 1;
+ ics->window_group_length[ics->num_window_groups-1] = 1;
+ ics->num_swb = num_swb_128_window[sf_index];
+
+ if (ics->max_sfb > ics->num_swb)
+ {
+ return 32;
+ }
+
+ for (i = 0; i < ics->num_swb; i++)
+ ics->swb_offset[i] = swb_offset_128_window[sf_index][i];
+ ics->swb_offset[ics->num_swb] = hDecoder->frameLength/8;
+
+ for (i = 0; i < ics->num_windows-1; i++) {
+ if (bit_set(ics->scale_factor_grouping, 6-i) == 0)
+ {
+ ics->num_window_groups += 1;
+ ics->window_group_length[ics->num_window_groups-1] = 1;
+ } else {
+ ics->window_group_length[ics->num_window_groups-1] += 1;
+ }
+ }
+
+ /* preparation of sect_sfb_offset for short blocks */
+ for (g = 0; g < ics->num_window_groups; g++)
+ {
+ uint16_t width;
+ uint8_t sect_sfb = 0;
+ uint16_t offset = 0;
+
+ for (i = 0; i < ics->num_swb; i++)
+ {
+ if (i+1 == ics->num_swb)
+ {
+ width = (hDecoder->frameLength/8) - swb_offset_128_window[sf_index][i];
+ } else {
+ width = swb_offset_128_window[sf_index][i+1] -
+ swb_offset_128_window[sf_index][i];
+ }
+ width *= ics->window_group_length[g];
+ ics->sect_sfb_offset[g][sect_sfb++] = offset;
+ offset += width;
+ }
+ ics->sect_sfb_offset[g][sect_sfb] = offset;
+ }
+ return 0;
+ default:
+ return 32;
+ }
+}
+
+/* iquant() *
+/* output = sign(input)*abs(input)^(4/3) */
+/**/
+static INLINE real_t iquant(int16_t q, const real_t *tab, uint8_t *error)
+{
+#ifdef FIXED_POINT
+/* For FIXED_POINT the iq_table is prescaled by 3 bits (iq_table[]/8) */
+/* BIG_IQ_TABLE allows you to use the full 8192 value table, if this is not
+ * defined a 1026 value table and interpolation will be used
+ */
+#ifndef BIG_IQ_TABLE
+ static const real_t errcorr[] = {
+ REAL_CONST(0), REAL_CONST(1.0/8.0), REAL_CONST(2.0/8.0), REAL_CONST(3.0/8.0),
+ REAL_CONST(4.0/8.0), REAL_CONST(5.0/8.0), REAL_CONST(6.0/8.0), REAL_CONST(7.0/8.0),
+ REAL_CONST(0)
+ };
+ real_t x1, x2;
+#endif
+ int16_t sgn = 1;
+
+ if (q < 0)
+ {
+ q = -q;
+ sgn = -1;
+ }
+
+ if (q < IQ_TABLE_SIZE)
+ {
+//#define IQUANT_PRINT
+#ifdef IQUANT_PRINT
+ //printf("0x%.8X\n", sgn * tab[q]);
+ printf("%d\n", sgn * tab[q]);
+#endif
+ return sgn * tab[q];
+ }
+
+#ifndef BIG_IQ_TABLE
+ if (q >= 8192)
+ {
+ *error = 17;
+ return 0;
+ }
+
+ /* linear interpolation */
+ x1 = tab[q>>3];
+ x2 = tab[(q>>3) + 1];
+ return sgn * 16 * (MUL_R(errcorr[q&7],(x2-x1)) + x1);
+#else
+ *error = 17;
+ return 0;
+#endif
+
+#else
+ if (q < 0)
+ {
+ /* tab contains a value for all possible q [0,8192] */
+ if (-q < IQ_TABLE_SIZE)
+ return -tab[-q];
+
+ *error = 17;
+ return 0;
+ } else {
+ /* tab contains a value for all possible q [0,8192] */
+ if (q < IQ_TABLE_SIZE)
+ return tab[q];
+
+ *error = 17;
+ return 0;
+ }
+#endif
+}
+
+#ifndef FIXED_POINT
+ALIGN static const real_t pow2sf_tab[] = {
+ 2.9802322387695313E-008, 5.9604644775390625E-008, 1.1920928955078125E-007,
+ 2.384185791015625E-007, 4.76837158203125E-007, 9.5367431640625E-007,
+ 1.9073486328125E-006, 3.814697265625E-006, 7.62939453125E-006,
+ 1.52587890625E-005, 3.0517578125E-005, 6.103515625E-005,
+ 0.0001220703125, 0.000244140625, 0.00048828125,
+ 0.0009765625, 0.001953125, 0.00390625,
+ 0.0078125, 0.015625, 0.03125,
+ 0.0625, 0.125, 0.25,
+ 0.5, 1.0, 2.0,
+ 4.0, 8.0, 16.0, 32.0,
+ 64.0, 128.0, 256.0,
+ 512.0, 1024.0, 2048.0,
+ 4096.0, 8192.0, 16384.0,
+ 32768.0, 65536.0, 131072.0,
+ 262144.0, 524288.0, 1048576.0,
+ 2097152.0, 4194304.0, 8388608.0,
+ 16777216.0, 33554432.0, 67108864.0,
+ 134217728.0, 268435456.0, 536870912.0,
+ 1073741824.0, 2147483648.0, 4294967296.0,
+ 8589934592.0, 17179869184.0, 34359738368.0,
+ 68719476736.0, 137438953472.0, 274877906944.0
+};
+#endif
+
+/* quant_to_spec: perform dequantisation and scaling
+ * and in case of short block it also does the deinterleaving
+ */
+/*
+ For ONLY_LONG_SEQUENCE windows (num_window_groups = 1,
+ window_group_length[0] = 1) the spectral data is in ascending spectral
+ order.
+ For the EIGHT_SHORT_SEQUENCE window, the spectral order depends on the
+ grouping in the following manner:
+ - Groups are ordered sequentially
+ - Within a group, a scalefactor band consists of the spectral data of all
+ grouped SHORT_WINDOWs for the associated scalefactor window band. To
+ clarify via example, the length of a group is in the range of one to eight
+ SHORT_WINDOWs.
+ - If there are eight groups each with length one (num_window_groups = 8,
+ window_group_length[0..7] = 1), the result is a sequence of eight spectra,
+ each in ascending spectral order.
+ - If there is only one group with length eight (num_window_groups = 1,
+ window_group_length[0] = 8), the result is that spectral data of all eight
+ SHORT_WINDOWs is interleaved by scalefactor window bands.
+ - Within a scalefactor window band, the coefficients are in ascending
+ spectral order.
+*/
+static uint8_t quant_to_spec(NeAACDecHandle hDecoder,
+ ic_stream *ics, int16_t *quant_data,
+ real_t *spec_data, uint16_t frame_len)
+{
+ ALIGN static const real_t pow2_table[] =
+ {
+ COEF_CONST(1.0),
+ COEF_CONST(1.1892071150027210667174999705605), /* 2^0.25 */
+ COEF_CONST(1.4142135623730950488016887242097), /* 2^0.5 */
+ COEF_CONST(1.6817928305074290860622509524664) /* 2^0.75 */
+ };
+ const real_t *tab = iq_table;
+
+ uint8_t g, sfb, win;
+ uint16_t width, bin, k, gindex, wa, wb;
+ uint8_t error = 0; /* Init error flag */
+#ifndef FIXED_POINT
+ real_t scf;
+#endif
+
+ k = 0;
+ gindex = 0;
+
+ for (g = 0; g < ics->num_window_groups; g++)
+ {
+ uint16_t j = 0;
+ uint16_t gincrease = 0;
+ uint16_t win_inc = ics->swb_offset[ics->num_swb];
+
+ for (sfb = 0; sfb < ics->num_swb; sfb++)
+ {
+ int32_t exp, frac;
+
+ width = ics->swb_offset[sfb+1] - ics->swb_offset[sfb];
+
+ /* this could be scalefactor for IS or PNS, those can be negative or bigger then 255 */
+ /* just ignore them */
+ if (ics->scale_factors[g][sfb] < 0 || ics->scale_factors[g][sfb] > 255)
+ {
+ exp = 0;
+ frac = 0;
+ } else {
+ /* ics->scale_factors[g][sfb] must be between 0 and 255 */
+ exp = (ics->scale_factors[g][sfb] /* - 100 */) >> 2;
+ /* frac must always be > 0 */
+ frac = (ics->scale_factors[g][sfb] /* - 100 */) & 3;
+ }
+
+#ifdef FIXED_POINT
+ exp -= 25;
+ /* IMDCT pre-scaling */
+ if (hDecoder->object_type == LD)
+ {
+ exp -= 6 /*9*/;
+ } else {
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ exp -= 4 /*7*/;
+ else
+ exp -= 7 /*10*/;
+ }
+#endif
+
+ wa = gindex + j;
+
+#ifndef FIXED_POINT
+ scf = pow2sf_tab[exp/*+25*/] * pow2_table[frac];
+#endif
+
+ for (win = 0; win < ics->window_group_length[g]; win++)
+ {
+ for (bin = 0; bin < width; bin += 4)
+ {
+#ifndef FIXED_POINT
+ wb = wa + bin;
+
+ spec_data[wb+0] = iquant(quant_data[k+0], tab, &error) * scf;
+ spec_data[wb+1] = iquant(quant_data[k+1], tab, &error) * scf;
+ spec_data[wb+2] = iquant(quant_data[k+2], tab, &error) * scf;
+ spec_data[wb+3] = iquant(quant_data[k+3], tab, &error) * scf;
+
+#else
+ real_t iq0 = iquant(quant_data[k+0], tab, &error);
+ real_t iq1 = iquant(quant_data[k+1], tab, &error);
+ real_t iq2 = iquant(quant_data[k+2], tab, &error);
+ real_t iq3 = iquant(quant_data[k+3], tab, &error);
+
+ wb = wa + bin;
+
+ if (exp < 0)
+ {
+ spec_data[wb+0] = iq0 >>= -exp;
+ spec_data[wb+1] = iq1 >>= -exp;
+ spec_data[wb+2] = iq2 >>= -exp;
+ spec_data[wb+3] = iq3 >>= -exp;
+ } else {
+ spec_data[wb+0] = iq0 <<= exp;
+ spec_data[wb+1] = iq1 <<= exp;
+ spec_data[wb+2] = iq2 <<= exp;
+ spec_data[wb+3] = iq3 <<= exp;
+ }
+ if (frac != 0)
+ {
+ spec_data[wb+0] = MUL_C(spec_data[wb+0],pow2_table[frac]);
+ spec_data[wb+1] = MUL_C(spec_data[wb+1],pow2_table[frac]);
+ spec_data[wb+2] = MUL_C(spec_data[wb+2],pow2_table[frac]);
+ spec_data[wb+3] = MUL_C(spec_data[wb+3],pow2_table[frac]);
+ }
+
+//#define SCFS_PRINT
+#ifdef SCFS_PRINT
+ printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+0]);
+ printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+1]);
+ printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+2]);
+ printf("%d\n", spec_data[gindex+(win*win_inc)+j+bin+3]);
+ //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+0]);
+ //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+1]);
+ //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+2]);
+ //printf("0x%.8X\n", spec_data[gindex+(win*win_inc)+j+bin+3]);
+#endif
+#endif
+
+ gincrease += 4;
+ k += 4;
+ }
+ wa += win_inc;
+ }
+ j += width;
+ }
+ gindex += gincrease;
+ }
+
+ return error;
+}
+
+static uint8_t allocate_single_channel(NeAACDecHandle hDecoder, uint8_t channel,
+ uint8_t output_channels)
+{
+ uint8_t mul = 1;
+
+#ifdef MAIN_DEC
+ /* MAIN object type prediction */
+ if (hDecoder->object_type == MAIN)
+ {
+ /* allocate the state only when needed */
+ if (hDecoder->pred_stat[channel] != NULL)
+ {
+ faad_free(hDecoder->pred_stat[channel]);
+ hDecoder->pred_stat[channel] = NULL;
+ }
+
+ hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
+ reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength);
+ }
+#endif
+
+#ifdef LTP_DEC
+ if (is_ltp_ot(hDecoder->object_type))
+ {
+ /* allocate the state only when needed */
+ if (hDecoder->lt_pred_stat[channel] != NULL)
+ {
+ faad_free(hDecoder->lt_pred_stat[channel]);
+ hDecoder->lt_pred_stat[channel] = NULL;
+ }
+
+ hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+ memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
+ }
+#endif
+
+ if (hDecoder->time_out[channel] != NULL)
+ {
+ faad_free(hDecoder->time_out[channel]);
+ hDecoder->time_out[channel] = NULL;
+ }
+
+ {
+ mul = 1;
+#ifdef SBR_DEC
+ hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0;
+ if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ {
+ /* SBR requires 2 times as much output data */
+ mul = 2;
+ hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
+ }
+#endif
+ hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
+ }
+
+#if (defined(PS_DEC) || defined(DRM_PS))
+ if (output_channels == 2)
+ {
+ if (hDecoder->time_out[channel+1] != NULL)
+ {
+ faad_free(hDecoder->time_out[channel+1]);
+ hDecoder->time_out[channel+1] = NULL;
+ }
+
+ hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t));
+ }
+#endif
+
+ if (hDecoder->fb_intermed[channel] != NULL)
+ {
+ faad_free(hDecoder->fb_intermed[channel]);
+ hDecoder->fb_intermed[channel] = NULL;
+ }
+
+ hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t));
+
+#ifdef SSR_DEC
+ if (hDecoder->object_type == SSR)
+ {
+ if (hDecoder->ssr_overlap[channel] == NULL)
+ {
+ hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
+ }
+ if (hDecoder->prev_fmd[channel] == NULL)
+ {
+ uint16_t k;
+ hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ for (k = 0; k < 2*hDecoder->frameLength; k++)
+ hDecoder->prev_fmd[channel][k] = REAL_CONST(-1);
+ }
+ }
+#endif
+
+ return 0;
+}
+
+static uint8_t allocate_channel_pair(NeAACDecHandle hDecoder,
+ uint8_t channel, uint8_t paired_channel)
+{
+ uint8_t mul = 1;
+
+#ifdef MAIN_DEC
+ /* MAIN object type prediction */
+ if (hDecoder->object_type == MAIN)
+ {
+ /* allocate the state only when needed */
+ if (hDecoder->pred_stat[channel] == NULL)
+ {
+ hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
+ reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength);
+ }
+ if (hDecoder->pred_stat[paired_channel] == NULL)
+ {
+ hDecoder->pred_stat[paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
+ reset_all_predictors(hDecoder->pred_stat[paired_channel], hDecoder->frameLength);
+ }
+ }
+#endif
+
+#ifdef LTP_DEC
+ if (is_ltp_ot(hDecoder->object_type))
+ {
+ /* allocate the state only when needed */
+ if (hDecoder->lt_pred_stat[channel] == NULL)
+ {
+ hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+ memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
+ }
+ if (hDecoder->lt_pred_stat[paired_channel] == NULL)
+ {
+ hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
+ memset(hDecoder->lt_pred_stat[paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
+ }
+ }
+#endif
+
+ if (hDecoder->time_out[channel] == NULL)
+ {
+ mul = 1;
+#ifdef SBR_DEC
+ hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0;
+ if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ {
+ /* SBR requires 2 times as much output data */
+ mul = 2;
+ hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
+ }
+#endif
+ hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
+ }
+ if (hDecoder->time_out[paired_channel] == NULL)
+ {
+ hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->time_out[paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
+ }
+
+ if (hDecoder->fb_intermed[channel] == NULL)
+ {
+ hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t));
+ }
+ if (hDecoder->fb_intermed[paired_channel] == NULL)
+ {
+ hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength*sizeof(real_t));
+ }
+
+#ifdef SSR_DEC
+ if (hDecoder->object_type == SSR)
+ {
+ if (hDecoder->ssr_overlap[cpe->channel] == NULL)
+ {
+ hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
+ }
+ if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL)
+ {
+ hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
+ }
+ if (hDecoder->prev_fmd[cpe->channel] == NULL)
+ {
+ uint16_t k;
+ hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ for (k = 0; k < 2*hDecoder->frameLength; k++)
+ hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1);
+ }
+ if (hDecoder->prev_fmd[cpe->paired_channel] == NULL)
+ {
+ uint16_t k;
+ hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
+ for (k = 0; k < 2*hDecoder->frameLength; k++)
+ hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1);
+ }
+ }
+#endif
+
+ return 0;
+}
+
+uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics,
+ element *sce, int16_t *spec_data)
+{
+ uint8_t retval, output_channels;
+ ALIGN real_t spec_coef[1024];
+
+#ifdef PROFILE
+ int64_t count = faad_get_ts();
+#endif
+
+
+ /* always allocate 2 channels, PS can always "suddenly" turn up */
+#if ( (defined(DRM) && defined(DRM_PS)) )
+ output_channels = 2;
+#elif defined(PS_DEC)
+ if (hDecoder->ps_used[hDecoder->fr_ch_ele])
+ output_channels = 2;
+ else
+ output_channels = 1;
+#endif
+
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+ {
+ /* element_output_channels not set yet */
+ hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
+ } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) {
+ /* element inconsistency */
+
+ /* this only happens if PS is actually found but not in the first frame
+ * this means that there is only 1 bitstream element!
+ */
+
+ /* reset the allocation */
+ hDecoder->element_alloced[hDecoder->fr_ch_ele] = 0;
+
+ hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
+
+ //return 21;
+ }
+
+ if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
+ {
+ retval = allocate_single_channel(hDecoder, sce->channel, output_channels);
+ if (retval > 0)
+ return retval;
+
+ hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1;
+ }
+
+
+ /* dequantisation and scaling */
+ retval = quant_to_spec(hDecoder, ics, spec_data, spec_coef, hDecoder->frameLength);
+ if (retval > 0)
+ return retval;
+
+#ifdef PROFILE
+ count = faad_get_ts() - count;
+ hDecoder->requant_cycles += count;
+#endif
+
+
+ /* pns decoding */
+ pns_decode(ics, NULL, spec_coef, NULL, hDecoder->frameLength, 0, hDecoder->object_type);
+
+#ifdef MAIN_DEC
+ /* MAIN object type prediction */
+ if (hDecoder->object_type == MAIN)
+ {
+ /* intra channel prediction */
+ ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength,
+ hDecoder->sf_index);
+
+ /* In addition, for scalefactor bands coded by perceptual
+ noise substitution the predictors belonging to the
+ corresponding spectral coefficients are reset.
+ */
+ pns_reset_pred_state(ics, hDecoder->pred_stat[sce->channel]);
+ }
+#endif
+
+#ifdef LTP_DEC
+ if (is_ltp_ot(hDecoder->object_type))
+ {
+#ifdef LD_DEC
+ if (hDecoder->object_type == LD)
+ {
+ if (ics->ltp.data_present)
+ {
+ if (ics->ltp.lag_update)
+ hDecoder->ltp_lag[sce->channel] = ics->ltp.lag;
+ }
+ ics->ltp.lag = hDecoder->ltp_lag[sce->channel];
+ }
+#endif
+
+ /* long term prediction */
+ lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb,
+ ics->window_shape, hDecoder->window_shape_prev[sce->channel],
+ hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
+ }
+#endif
+
+ /* tns decoding */
+ tns_decode_frame(ics, &(ics->tns), hDecoder->sf_index, hDecoder->object_type,
+ spec_coef, hDecoder->frameLength);
+
+ /* drc decoding */
+ if (hDecoder->drc->present)
+ {
+ if (!hDecoder->drc->exclude_mask[sce->channel] || !hDecoder->drc->excluded_chns_present)
+ drc_decode(hDecoder->drc, spec_coef);
+ }
+
+ /* filter bank */
+#ifdef SSR_DEC
+ if (hDecoder->object_type != SSR)
+ {
+#endif
+ ifilter_bank(hDecoder->fb, ics->window_sequence, ics->window_shape,
+ hDecoder->window_shape_prev[sce->channel], spec_coef,
+ hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel],
+ hDecoder->object_type, hDecoder->frameLength);
+#ifdef SSR_DEC
+ } else {
+ ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape,
+ hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel],
+ hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel],
+ hDecoder->frameLength);
+ }
+#endif
+
+ /* save window shape for next frame */
+ hDecoder->window_shape_prev[sce->channel] = ics->window_shape;
+
+#ifdef LTP_DEC
+ if (is_ltp_ot(hDecoder->object_type))
+ {
+ lt_update_state(hDecoder->lt_pred_stat[sce->channel], hDecoder->time_out[sce->channel],
+ hDecoder->fb_intermed[sce->channel], hDecoder->frameLength, hDecoder->object_type);
+ }
+#endif
+
+#ifdef SBR_DEC
+ if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ && hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+ {
+ uint8_t ele = hDecoder->fr_ch_ele;
+ uint8_t ch = sce->channel;
+
+ /* following case can happen when forceUpSampling == 1 */
+ if (hDecoder->sbr[ele] == NULL)
+ {
+ hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength,
+ hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index),
+ hDecoder->downSampledSBR
+#ifdef DRM
+ , 0
+#endif
+ );
+ }
+
+ if (sce->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
+ hDecoder->sbr[ele]->maxAACLine = 8*sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)];
+ else
+ hDecoder->sbr[ele]->maxAACLine = sce->ics1.swb_offset[max(sce->ics1.max_sfb-1, 0)];
+
+ /* check if any of the PS tools is used */
+#if (defined(PS_DEC) || defined(DRM_PS))
+ if (hDecoder->ps_used[ele] == 0)
+ {
+#endif
+ retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch],
+ hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
+#if (defined(PS_DEC) || defined(DRM_PS))
+ } else {
+ retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch],
+ hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag,
+ hDecoder->downSampledSBR);
+ }
+#endif
+ if (retval > 0)
+ return retval;
+ } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+ {
+ return 23;
+ }
+#endif
+
+ /* copy L to R when no PS is used */
+#if (defined(PS_DEC) || defined(DRM_PS))
+ if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) &&
+ (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2))
+ {
+ uint8_t ele = hDecoder->fr_ch_ele;
+ uint8_t ch = sce->channel;
+ uint16_t frame_size = (hDecoder->sbr_alloced[ele]) ? 2 : 1;
+ frame_size *= hDecoder->frameLength*sizeof(real_t);
+
+ memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size);
+ }
+#endif
+
+ return 0;
+}
+
+uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+ element *cpe, int16_t *spec_data1, int16_t *spec_data2)
+{
+ uint8_t retval;
+ ALIGN real_t spec_coef1[1024];
+ ALIGN real_t spec_coef2[1024];
+
+#ifdef PROFILE
+ int64_t count = faad_get_ts();
+#endif
+ if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
+ {
+ retval = allocate_channel_pair(hDecoder, cpe->channel, (uint8_t)cpe->paired_channel);
+ if (retval > 0)
+ return retval;
+
+ hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1;
+ }
+
+ /* dequantisation and scaling */
+ retval = quant_to_spec(hDecoder, ics1, spec_data1, spec_coef1, hDecoder->frameLength);
+ if (retval > 0)
+ return retval;
+ retval = quant_to_spec(hDecoder, ics2, spec_data2, spec_coef2, hDecoder->frameLength);
+ if (retval > 0)
+ return retval;
+
+#ifdef PROFILE
+ count = faad_get_ts() - count;
+ hDecoder->requant_cycles += count;
+#endif
+
+
+ /* pns decoding */
+ if (ics1->ms_mask_present)
+ {
+ pns_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength, 1, hDecoder->object_type);
+ } else {
+ pns_decode(ics1, NULL, spec_coef1, NULL, hDecoder->frameLength, 0, hDecoder->object_type);
+ pns_decode(ics2, NULL, spec_coef2, NULL, hDecoder->frameLength, 0, hDecoder->object_type);
+ }
+
+ /* mid/side decoding */
+ ms_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength);
+
+#if 0
+ {
+ int i;
+ for (i = 0; i < 1024; i++)
+ {
+ //printf("%d\n", spec_coef1[i]);
+ printf("0x%.8X\n", spec_coef1[i]);
+ }
+ for (i = 0; i < 1024; i++)
+ {
+ //printf("%d\n", spec_coef2[i]);
+ printf("0x%.8X\n", spec_coef2[i]);
+ }
+ }
+#endif
+
+ /* intensity stereo decoding */
+ is_decode(ics1, ics2, spec_coef1, spec_coef2, hDecoder->frameLength);
+
+#if 0
+ {
+ int i;
+ for (i = 0; i < 1024; i++)
+ {
+ printf("%d\n", spec_coef1[i]);
+ //printf("0x%.8X\n", spec_coef1[i]);
+ }
+ for (i = 0; i < 1024; i++)
+ {
+ printf("%d\n", spec_coef2[i]);
+ //printf("0x%.8X\n", spec_coef2[i]);
+ }
+ }
+#endif
+
+#ifdef MAIN_DEC
+ /* MAIN object type prediction */
+ if (hDecoder->object_type == MAIN)
+ {
+ /* intra channel prediction */
+ ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength,
+ hDecoder->sf_index);
+ ic_prediction(ics2, spec_coef2, hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength,
+ hDecoder->sf_index);
+
+ /* In addition, for scalefactor bands coded by perceptual
+ noise substitution the predictors belonging to the
+ corresponding spectral coefficients are reset.
+ */
+ pns_reset_pred_state(ics1, hDecoder->pred_stat[cpe->channel]);
+ pns_reset_pred_state(ics2, hDecoder->pred_stat[cpe->paired_channel]);
+ }
+#endif
+
+#ifdef LTP_DEC
+ if (is_ltp_ot(hDecoder->object_type))
+ {
+ ltp_info *ltp1 = &(ics1->ltp);
+ ltp_info *ltp2 = (cpe->common_window) ? &(ics2->ltp2) : &(ics2->ltp);
+#ifdef LD_DEC
+ if (hDecoder->object_type == LD)
+ {
+ if (ltp1->data_present)
+ {
+ if (ltp1->lag_update)
+ hDecoder->ltp_lag[cpe->channel] = ltp1->lag;
+ }
+ ltp1->lag = hDecoder->ltp_lag[cpe->channel];
+ if (ltp2->data_present)
+ {
+ if (ltp2->lag_update)
+ hDecoder->ltp_lag[cpe->paired_channel] = ltp2->lag;
+ }
+ ltp2->lag = hDecoder->ltp_lag[cpe->paired_channel];
+ }
+#endif
+
+ /* long term prediction */
+ lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb,
+ ics1->window_shape, hDecoder->window_shape_prev[cpe->channel],
+ hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
+ lt_prediction(ics2, ltp2, spec_coef2, hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->fb,
+ ics2->window_shape, hDecoder->window_shape_prev[cpe->paired_channel],
+ hDecoder->sf_index, hDecoder->object_type, hDecoder->frameLength);
+ }
+#endif
+
+ /* tns decoding */
+ tns_decode_frame(ics1, &(ics1->tns), hDecoder->sf_index, hDecoder->object_type,
+ spec_coef1, hDecoder->frameLength);
+ tns_decode_frame(ics2, &(ics2->tns), hDecoder->sf_index, hDecoder->object_type,
+ spec_coef2, hDecoder->frameLength);
+
+ /* drc decoding */
+ if (hDecoder->drc->present)
+ {
+ if (!hDecoder->drc->exclude_mask[cpe->channel] || !hDecoder->drc->excluded_chns_present)
+ drc_decode(hDecoder->drc, spec_coef1);
+ if (!hDecoder->drc->exclude_mask[cpe->paired_channel] || !hDecoder->drc->excluded_chns_present)
+ drc_decode(hDecoder->drc, spec_coef2);
+ }
+
+ /* filter bank */
+#ifdef SSR_DEC
+ if (hDecoder->object_type != SSR)
+ {
+#endif
+ ifilter_bank(hDecoder->fb, ics1->window_sequence, ics1->window_shape,
+ hDecoder->window_shape_prev[cpe->channel], spec_coef1,
+ hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel],
+ hDecoder->object_type, hDecoder->frameLength);
+ ifilter_bank(hDecoder->fb, ics2->window_sequence, ics2->window_shape,
+ hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2,
+ hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel],
+ hDecoder->object_type, hDecoder->frameLength);
+#ifdef SSR_DEC
+ } else {
+ ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape,
+ hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel],
+ hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel],
+ hDecoder->prev_fmd[cpe->channel], hDecoder->frameLength);
+ ssr_decode(&(ics2->ssr), hDecoder->fb, ics2->window_sequence, ics2->window_shape,
+ hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel],
+ hDecoder->ssr_overlap[cpe->paired_channel], hDecoder->ipqf_buffer[cpe->paired_channel],
+ hDecoder->prev_fmd[cpe->paired_channel], hDecoder->frameLength);
+ }
+#endif
+
+ /* save window shape for next frame */
+ hDecoder->window_shape_prev[cpe->channel] = ics1->window_shape;
+ hDecoder->window_shape_prev[cpe->paired_channel] = ics2->window_shape;
+
+#ifdef LTP_DEC
+ if (is_ltp_ot(hDecoder->object_type))
+ {
+ lt_update_state(hDecoder->lt_pred_stat[cpe->channel], hDecoder->time_out[cpe->channel],
+ hDecoder->fb_intermed[cpe->channel], hDecoder->frameLength, hDecoder->object_type);
+ lt_update_state(hDecoder->lt_pred_stat[cpe->paired_channel], hDecoder->time_out[cpe->paired_channel],
+ hDecoder->fb_intermed[cpe->paired_channel], hDecoder->frameLength, hDecoder->object_type);
+ }
+#endif
+
+#ifdef SBR_DEC
+ if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ && hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+ {
+ uint8_t ele = hDecoder->fr_ch_ele;
+ uint8_t ch0 = cpe->channel;
+ uint8_t ch1 = cpe->paired_channel;
+
+ /* following case can happen when forceUpSampling == 1 */
+ if (hDecoder->sbr[ele] == NULL)
+ {
+ hDecoder->sbr[ele] = sbrDecodeInit(hDecoder->frameLength,
+ hDecoder->element_id[ele], 2*get_sample_rate(hDecoder->sf_index),
+ hDecoder->downSampledSBR
+#ifdef DRM
+ , 0
+#endif
+ );
+ }
+
+ if (cpe->ics1.window_sequence == EIGHT_SHORT_SEQUENCE)
+ hDecoder->sbr[ele]->maxAACLine = 8*cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)];
+ else
+ hDecoder->sbr[ele]->maxAACLine = cpe->ics1.swb_offset[max(cpe->ics1.max_sfb-1, 0)];
+
+ retval = sbrDecodeCoupleFrame(hDecoder->sbr[ele],
+ hDecoder->time_out[ch0], hDecoder->time_out[ch1],
+ hDecoder->postSeekResetFlag, hDecoder->downSampledSBR);
+ if (retval > 0)
+ return retval;
+ } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1))
+ && !hDecoder->sbr_alloced[hDecoder->fr_ch_ele])
+ {
+ return 23;
+ }
+#endif
+
+ return 0;
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/specrec.h b/src/filters/transform/mpadecfilter/faad2/libfaad/specrec.h
new file mode 100644
index 000000000..262808006
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/specrec.h
@@ -0,0 +1,51 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: specrec.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SPECREC_H__
+#define __SPECREC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "syntax.h"
+
+uint8_t window_grouping_info(NeAACDecHandle hDecoder, ic_stream *ics);
+uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+ element *cpe, int16_t *spec_data1, int16_t *spec_data2);
+uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, element *sce,
+ int16_t *spec_data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ssr.c b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr.c
new file mode 100644
index 000000000..00425c95f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr.c
@@ -0,0 +1,177 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SSR_DEC
+
+#include "syntax.h"
+#include "filtbank.h"
+#include "ssr.h"
+#include "ssr_fb.h"
+
+void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
+ uint8_t window_shape, uint8_t window_shape_prev,
+ real_t *freq_in, real_t *time_out, real_t *overlap,
+ real_t ipqf_buffer[SSR_BANDS][96/4],
+ real_t *prev_fmd, uint16_t frame_len)
+{
+ uint8_t band;
+ uint16_t ssr_frame_len = frame_len/SSR_BANDS;
+ real_t time_tmp[2048] = {0};
+ real_t output[1024] = {0};
+
+ for (band = 0; band < SSR_BANDS; band++)
+ {
+ int16_t j;
+
+ /* uneven bands have inverted frequency scale */
+ if (band == 1 || band == 3)
+ {
+ for (j = 0; j < ssr_frame_len/2; j++)
+ {
+ real_t tmp;
+ tmp = freq_in[j + ssr_frame_len*band];
+ freq_in[j + ssr_frame_len*band] =
+ freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band];
+ freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band] = tmp;
+ }
+ }
+
+ /* non-overlapping inverse filterbank for SSR */
+ ssr_ifilter_bank(fb, window_sequence, window_shape, window_shape_prev,
+ freq_in + band*ssr_frame_len, time_tmp + band*ssr_frame_len,
+ ssr_frame_len);
+
+ /* gain control */
+ ssr_gain_control(ssr, time_tmp, output, overlap, prev_fmd,
+ band, window_sequence, ssr_frame_len);
+ }
+
+ /* inverse pqf to bring subbands together again */
+ ssr_ipqf(ssr, output, time_out, ipqf_buffer, frame_len, SSR_BANDS);
+}
+
+static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
+ real_t *overlap, real_t *prev_fmd, uint8_t band,
+ uint8_t window_sequence, uint16_t frame_len)
+{
+ uint16_t i;
+ real_t gc_function[2*1024/SSR_BANDS];
+
+ if (window_sequence != EIGHT_SHORT_SEQUENCE)
+ {
+ ssr_gc_function(ssr, &prev_fmd[band * frame_len*2],
+ gc_function, window_sequence, band, frame_len);
+
+ for (i = 0; i < frame_len*2; i++)
+ data[band * frame_len*2 + i] *= gc_function[i];
+ for (i = 0; i < frame_len; i++)
+ {
+ output[band*frame_len + i] = overlap[band*frame_len + i] +
+ data[band*frame_len*2 + i];
+ }
+ for (i = 0; i < frame_len; i++)
+ {
+ overlap[band*frame_len + i] =
+ data[band*frame_len*2 + frame_len + i];
+ }
+ } else {
+ uint8_t w;
+ for (w = 0; w < 8; w++)
+ {
+ uint16_t frame_len8 = frame_len/8;
+ uint16_t frame_len16 = frame_len/16;
+
+ ssr_gc_function(ssr, &prev_fmd[band*frame_len*2 + w*frame_len*2/8],
+ gc_function, window_sequence, frame_len);
+
+ for (i = 0; i < frame_len8*2; i++)
+ data[band*frame_len*2 + w*frame_len8*2+i] *= gc_function[i];
+ for (i = 0; i < frame_len8; i++)
+ {
+ overlap[band*frame_len + i + 7*frame_len16 + w*frame_len8] +=
+ data[band*frame_len*2 + 2*w*frame_len8 + i];
+ }
+ for (i = 0; i < frame_len8; i++)
+ {
+ overlap[band*frame_len + i + 7*frame_len16 + (w+1)*frame_len8] =
+ data[band*frame_len*2 + 2*w*frame_len8 + frame_len8 + i];
+ }
+ }
+ for (i = 0; i < frame_len; i++)
+ output[band*frame_len + i] = overlap[band*frame_len + i];
+ for (i = 0; i < frame_len; i++)
+ overlap[band*frame_len + i] = overlap[band*frame_len + i + frame_len];
+ }
+}
+
+static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
+ real_t *gc_function, uint8_t window_sequence,
+ uint8_t band, uint16_t frame_len)
+{
+ uint16_t i;
+ uint16_t len_area1, len_area2;
+ int32_t aloc[10];
+ real_t alev[10];
+
+ switch (window_sequence)
+ {
+ case ONLY_LONG_SEQUENCE:
+ len_area1 = frame_len/SSR_BANDS;
+ len_area2 = 0;
+ break;
+ case LONG_START_SEQUENCE:
+ len_area1 = (frame_len/SSR_BANDS)*7/32;
+ len_area2 = (frame_len/SSR_BANDS)/16;
+ break;
+ case EIGHT_SHORT_SEQUENCE:
+ len_area1 = (frame_len/8)/SSR_BANDS;
+ len_area2 = 0;
+ break;
+ case LONG_STOP_SEQUENCE:
+ len_area1 = (frame_len/SSR_BANDS);
+ len_area2 = 0;
+ break;
+ }
+
+ /* decode bitstream information */
+
+ /* build array M */
+
+
+ for (i = 0; i < frame_len*2; i++)
+ gc_function[i] = 1;
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ssr.h b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr.h
new file mode 100644
index 000000000..1f5381968
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr.h
@@ -0,0 +1,61 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SSR_H__
+#define __SSR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SSR_BANDS 4
+#define PQFTAPS 96
+
+void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
+ uint8_t window_shape, uint8_t window_shape_prev,
+ real_t *freq_in, real_t *time_out, real_t *overlap,
+ real_t ipqf_buffer[SSR_BANDS][96/4],
+ real_t *prev_fmd, uint16_t frame_len);
+
+
+static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
+ real_t *overlap, real_t *prev_fmd, uint8_t band,
+ uint8_t window_sequence, uint16_t frame_len);
+static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
+ real_t *gc_function, uint8_t window_sequence,
+ uint16_t frame_len);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_fb.c b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_fb.c
new file mode 100644
index 000000000..6613fd83d
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_fb.c
@@ -0,0 +1,187 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr_fb.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SSR_DEC
+
+#include <string.h>
+#include <stdlib.h>
+#include "syntax.h"
+#include "filtbank.h"
+#include "mdct.h"
+#include "ssr_fb.h"
+#include "ssr_win.h"
+
+fb_info *ssr_filter_bank_init(uint16_t frame_len)
+{
+ uint16_t nshort = frame_len/8;
+
+ fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
+ memset(fb, 0, sizeof(fb_info));
+
+ /* normal */
+ fb->mdct256 = faad_mdct_init(2*nshort);
+ fb->mdct2048 = faad_mdct_init(2*frame_len);
+
+ fb->long_window[0] = sine_long_256;
+ fb->short_window[0] = sine_short_32;
+ fb->long_window[1] = kbd_long_256;
+ fb->short_window[1] = kbd_short_32;
+
+ return fb;
+}
+
+void ssr_filter_bank_end(fb_info *fb)
+{
+ faad_mdct_end(fb->mdct256);
+ faad_mdct_end(fb->mdct2048);
+
+ if (fb) faad_free(fb);
+}
+
+static INLINE void imdct_ssr(fb_info *fb, real_t *in_data,
+ real_t *out_data, uint16_t len)
+{
+ mdct_info *mdct;
+
+ switch (len)
+ {
+ case 512:
+ mdct = fb->mdct2048;
+ break;
+ case 64:
+ mdct = fb->mdct256;
+ break;
+ }
+
+ faad_imdct(mdct, in_data, out_data);
+}
+
+/* NON-overlapping inverse filterbank for use with SSR */
+void ssr_ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
+ uint8_t window_shape_prev, real_t *freq_in,
+ real_t *time_out, uint16_t frame_len)
+{
+ int16_t i;
+ real_t *transf_buf;
+
+ real_t *window_long;
+ real_t *window_long_prev;
+ real_t *window_short;
+ real_t *window_short_prev;
+
+ uint16_t nlong = frame_len;
+ uint16_t nshort = frame_len/8;
+ uint16_t trans = nshort/2;
+
+ uint16_t nflat_ls = (nlong-nshort)/2;
+
+ transf_buf = (real_t*)faad_malloc(2*nlong*sizeof(real_t));
+
+ window_long = fb->long_window[window_shape];
+ window_long_prev = fb->long_window[window_shape_prev];
+ window_short = fb->short_window[window_shape];
+ window_short_prev = fb->short_window[window_shape_prev];
+
+ switch (window_sequence)
+ {
+ case ONLY_LONG_SEQUENCE:
+ imdct_ssr(fb, freq_in, transf_buf, 2*nlong);
+ for (i = nlong-1; i >= 0; i--)
+ {
+ time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]);
+ time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]);
+ }
+ break;
+
+ case LONG_START_SEQUENCE:
+ imdct_ssr(fb, freq_in, transf_buf, 2*nlong);
+ for (i = 0; i < nlong; i++)
+ time_out[i] = MUL_R_C(transf_buf[i],window_long_prev[i]);
+ for (i = 0; i < nflat_ls; i++)
+ time_out[nlong+i] = transf_buf[nlong+i];
+ for (i = 0; i < nshort; i++)
+ time_out[nlong+nflat_ls+i] = MUL_R_C(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
+ for (i = 0; i < nflat_ls; i++)
+ time_out[nlong+nflat_ls+nshort+i] = 0;
+ break;
+
+ case EIGHT_SHORT_SEQUENCE:
+ imdct_ssr(fb, freq_in+0*nshort, transf_buf+2*nshort*0, 2*nshort);
+ imdct_ssr(fb, freq_in+1*nshort, transf_buf+2*nshort*1, 2*nshort);
+ imdct_ssr(fb, freq_in+2*nshort, transf_buf+2*nshort*2, 2*nshort);
+ imdct_ssr(fb, freq_in+3*nshort, transf_buf+2*nshort*3, 2*nshort);
+ imdct_ssr(fb, freq_in+4*nshort, transf_buf+2*nshort*4, 2*nshort);
+ imdct_ssr(fb, freq_in+5*nshort, transf_buf+2*nshort*5, 2*nshort);
+ imdct_ssr(fb, freq_in+6*nshort, transf_buf+2*nshort*6, 2*nshort);
+ imdct_ssr(fb, freq_in+7*nshort, transf_buf+2*nshort*7, 2*nshort);
+ for(i = nshort-1; i >= 0; i--)
+ {
+ time_out[i+0*nshort] = MUL_R_C(transf_buf[nshort*0+i],window_short_prev[i]);
+ time_out[i+1*nshort] = MUL_R_C(transf_buf[nshort*1+i],window_short[i]);
+ time_out[i+2*nshort] = MUL_R_C(transf_buf[nshort*2+i],window_short_prev[i]);
+ time_out[i+3*nshort] = MUL_R_C(transf_buf[nshort*3+i],window_short[i]);
+ time_out[i+4*nshort] = MUL_R_C(transf_buf[nshort*4+i],window_short_prev[i]);
+ time_out[i+5*nshort] = MUL_R_C(transf_buf[nshort*5+i],window_short[i]);
+ time_out[i+6*nshort] = MUL_R_C(transf_buf[nshort*6+i],window_short_prev[i]);
+ time_out[i+7*nshort] = MUL_R_C(transf_buf[nshort*7+i],window_short[i]);
+ time_out[i+8*nshort] = MUL_R_C(transf_buf[nshort*8+i],window_short_prev[i]);
+ time_out[i+9*nshort] = MUL_R_C(transf_buf[nshort*9+i],window_short[i]);
+ time_out[i+10*nshort] = MUL_R_C(transf_buf[nshort*10+i],window_short_prev[i]);
+ time_out[i+11*nshort] = MUL_R_C(transf_buf[nshort*11+i],window_short[i]);
+ time_out[i+12*nshort] = MUL_R_C(transf_buf[nshort*12+i],window_short_prev[i]);
+ time_out[i+13*nshort] = MUL_R_C(transf_buf[nshort*13+i],window_short[i]);
+ time_out[i+14*nshort] = MUL_R_C(transf_buf[nshort*14+i],window_short_prev[i]);
+ time_out[i+15*nshort] = MUL_R_C(transf_buf[nshort*15+i],window_short[i]);
+ }
+ break;
+
+ case LONG_STOP_SEQUENCE:
+ imdct_ssr(fb, freq_in, transf_buf, 2*nlong);
+ for (i = 0; i < nflat_ls; i++)
+ time_out[i] = 0;
+ for (i = 0; i < nshort; i++)
+ time_out[nflat_ls+i] = MUL_R_C(transf_buf[nflat_ls+i],window_short_prev[i]);
+ for (i = 0; i < nflat_ls; i++)
+ time_out[nflat_ls+nshort+i] = transf_buf[nflat_ls+nshort+i];
+ for (i = 0; i < nlong; i++)
+ time_out[nlong+i] = MUL_R_C(transf_buf[nlong+i],window_long[nlong-1-i]);
+ break;
+ }
+
+ faad_free(transf_buf);
+}
+
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_fb.h b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_fb.h
new file mode 100644
index 000000000..e15183b55
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_fb.h
@@ -0,0 +1,55 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr_fb.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SSR_FB_H__
+#define __SSR_FB_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+fb_info *ssr_filter_bank_init(uint16_t frame_len);
+void ssr_filter_bank_end(fb_info *fb);
+
+/*non overlapping inverse filterbank */
+void ssr_ifilter_bank(fb_info *fb,
+ uint8_t window_sequence,
+ uint8_t window_shape,
+ uint8_t window_shape_prev,
+ real_t *freq_in,
+ real_t *time_out,
+ uint16_t frame_len);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_ipqf.c b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_ipqf.c
new file mode 100644
index 000000000..b75a2b4be
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_ipqf.c
@@ -0,0 +1,193 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr_ipqf.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#ifdef SSR_DEC
+
+#include "ssr.h"
+#include "ssr_ipqf.h"
+
+static real_t **app_pqfbuf;
+static real_t **pp_q0, **pp_t0, **pp_t1;
+
+void gc_set_protopqf(real_t *p_proto)
+{
+ int j;
+ static real_t a_half[48] =
+ {
+ 1.2206911375946939E-05, 1.7261986723798209E-05, 1.2300093657077942E-05,
+ -1.0833943097791965E-05, -5.7772498639901686E-05, -1.2764767618947719E-04,
+ -2.0965186675013334E-04, -2.8166673689263850E-04, -3.1234860429017460E-04,
+ -2.6738519958452353E-04, -1.1949424681824722E-04, 1.3965139412648678E-04,
+ 4.8864136409185725E-04, 8.7044629275148344E-04, 1.1949430269934793E-03,
+ 1.3519708175026700E-03, 1.2346314373964412E-03, 7.6953209114159191E-04,
+ -5.2242432579537141E-05, -1.1516092887213454E-03, -2.3538469841711277E-03,
+ -3.4033123072127277E-03, -4.0028551071986133E-03, -3.8745415659693259E-03,
+ -2.8321073426874310E-03, -8.5038892323704195E-04, 1.8856751185350931E-03,
+ 4.9688741735340923E-03, 7.8056704536795926E-03, 9.7027909685901654E-03,
+ 9.9960423120166159E-03, 8.2019366335594487E-03, 4.1642072876103365E-03,
+ -1.8364453822737758E-03, -9.0384863094167686E-03, -1.6241528177129844E-02,
+ -2.1939551286300665E-02, -2.4533179947088161E-02, -2.2591663337768787E-02,
+ -1.5122066420044672E-02, -1.7971713448186293E-03, 1.6903413428575379E-02,
+ 3.9672315874127042E-02, 6.4487527248102796E-02, 8.8850025474701726E-02,
+ 0.1101132906105560 , 0.1258540205143761 , 0.1342239368467012
+ };
+
+ for (j = 0; j < 48; ++j)
+ {
+ p_proto[j] = p_proto[95-j] = a_half[j];
+ }
+}
+
+void gc_setcoef_eff_pqfsyn(int mm,
+ int kk,
+ real_t *p_proto,
+ real_t ***ppp_q0,
+ real_t ***ppp_t0,
+ real_t ***ppp_t1)
+{
+ int i, k, n;
+ real_t w;
+
+ /* Set 1st Mul&Acc Coef's */
+ *ppp_q0 = (real_t **) calloc(mm, sizeof(real_t *));
+ for (n = 0; n < mm; ++n)
+ {
+ (*ppp_q0)[n] = (real_t *) calloc(mm, sizeof(real_t));
+ }
+ for (n = 0; n < mm/2; ++n)
+ {
+ for (i = 0; i < mm; ++i)
+ {
+ w = (2*i+1)*(2*n+1-mm)*M_PI/(4*mm);
+ (*ppp_q0)[n][i] = 2.0 * cos((real_t) w);
+
+ w = (2*i+1)*(2*(mm+n)+1-mm)*M_PI/(4*mm);
+ (*ppp_q0)[n + mm/2][i] = 2.0 * cos((real_t) w);
+ }
+ }
+
+ /* Set 2nd Mul&Acc Coef's */
+ *ppp_t0 = (real_t **) calloc(mm, sizeof(real_t *));
+ *ppp_t1 = (real_t **) calloc(mm, sizeof(real_t *));
+ for (n = 0; n < mm; ++n)
+ {
+ (*ppp_t0)[n] = (real_t *) calloc(kk, sizeof(real_t));
+ (*ppp_t1)[n] = (real_t *) calloc(kk, sizeof(real_t));
+ }
+ for (n = 0; n < mm; ++n)
+ {
+ for (k = 0; k < kk; ++k)
+ {
+ (*ppp_t0)[n][k] = mm * p_proto[2*k *mm + n];
+ (*ppp_t1)[n][k] = mm * p_proto[(2*k+1)*mm + n];
+
+ if (k%2 != 0)
+ {
+ (*ppp_t0)[n][k] = -(*ppp_t0)[n][k];
+ (*ppp_t1)[n][k] = -(*ppp_t1)[n][k];
+ }
+ }
+ }
+}
+
+void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data,
+ real_t buffer[SSR_BANDS][96/4],
+ uint16_t frame_len, uint8_t bands)
+{
+ static int initFlag = 0;
+ real_t a_pqfproto[PQFTAPS];
+
+ int i;
+
+ if (initFlag == 0)
+ {
+ gc_set_protopqf(a_pqfproto);
+ gc_setcoef_eff_pqfsyn(SSR_BANDS, PQFTAPS/(2*SSR_BANDS), a_pqfproto,
+ &pp_q0, &pp_t0, &pp_t1);
+ initFlag = 1;
+ }
+
+ for (i = 0; i < frame_len / SSR_BANDS; i++)
+ {
+ int l, n, k;
+ int mm = SSR_BANDS;
+ int kk = PQFTAPS/(2*SSR_BANDS);
+
+ for (n = 0; n < mm; n++)
+ {
+ for (k = 0; k < 2*kk-1; k++)
+ {
+ buffer[n][k] = buffer[n][k+1];
+ }
+ }
+
+ for (n = 0; n < mm; n++)
+ {
+ real_t acc = 0.0;
+ for (l = 0; l < mm; l++)
+ {
+ acc += pp_q0[n][l] * in_data[l*frame_len/SSR_BANDS + i];
+ }
+ buffer[n][2*kk-1] = acc;
+ }
+
+ for (n = 0; n < mm/2; n++)
+ {
+ real_t acc = 0.0;
+ for (k = 0; k < kk; k++)
+ {
+ acc += pp_t0[n][k] * buffer[n][2*kk-1-2*k];
+ }
+ for (k = 0; k < kk; ++k)
+ {
+ acc += pp_t1[n][k] * buffer[n + mm/2][2*kk-2-2*k];
+ }
+ out_data[i*SSR_BANDS + n] = acc;
+
+ acc = 0.0;
+ for (k = 0; k < kk; k++)
+ {
+ acc += pp_t0[mm-1-n][k] * buffer[n][2*kk-1-2*k];
+ }
+ for (k = 0; k < kk; k++)
+ {
+ acc -= pp_t1[mm-1-n][k] * buffer[n + mm/2][2*kk-2-2*k];
+ }
+ out_data[i*SSR_BANDS + mm-1-n] = acc;
+ }
+ }
+}
+
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_ipqf.h b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_ipqf.h
new file mode 100644
index 000000000..54f0c5ad0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_ipqf.h
@@ -0,0 +1,48 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr_ipqf.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SSR_IPQF_H__
+#define __SSR_IPQF_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ssr_ipqf(ssr_info *ssr, real_t *in_data, real_t *out_data,
+ real_t buffer[SSR_BANDS][96/4],
+ uint16_t frame_len, uint8_t bands);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_win.h b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_win.h
new file mode 100644
index 000000000..f26e951c1
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/ssr_win.h
@@ -0,0 +1,637 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: ssr_win.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SSR_WIN_H__
+#define __SSR_WIN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+
+static real_t sine_short_32[] = {
+ 0.0245412290,
+ 0.0735645667,
+ 0.1224106774,
+ 0.1709618866,
+ 0.2191012502,
+ 0.2667127550,
+ 0.3136817515,
+ 0.3598950505,
+ 0.4052413106,
+ 0.4496113360,
+ 0.4928981960,
+ 0.5349976420,
+ 0.5758082271,
+ 0.6152316332,
+ 0.6531728506,
+ 0.6895405650,
+ 0.7242470980,
+ 0.7572088838,
+ 0.7883464694,
+ 0.8175848126,
+ 0.8448535800,
+ 0.8700870275,
+ 0.8932242990,
+ 0.9142097831,
+ 0.9329928160,
+ 0.9495282173,
+ 0.9637760520,
+ 0.9757021666,
+ 0.9852776527,
+ 0.9924795628,
+ 0.9972904325,
+ 0.9996988177
+};
+
+static real_t sine_long_256[] = {
+ 0.0030679568,
+ 0.0092037553,
+ 0.0153392069,
+ 0.0214740802,
+ 0.0276081469,
+ 0.0337411724,
+ 0.0398729295,
+ 0.0460031852,
+ 0.0521317050,
+ 0.0582582653,
+ 0.0643826351,
+ 0.0705045760,
+ 0.0766238645,
+ 0.0827402696,
+ 0.0888535529,
+ 0.0949634984,
+ 0.1010698676,
+ 0.1071724296,
+ 0.1132709533,
+ 0.1193652153,
+ 0.1254549921,
+ 0.1315400302,
+ 0.1376201212,
+ 0.1436950415,
+ 0.1497645378,
+ 0.1558284014,
+ 0.1618863940,
+ 0.1679383069,
+ 0.1739838719,
+ 0.1800229102,
+ 0.1860551536,
+ 0.1920804083,
+ 0.1980984211,
+ 0.2041089684,
+ 0.2101118416,
+ 0.2161068022,
+ 0.2220936269,
+ 0.2280720919,
+ 0.2340419590,
+ 0.2400030345,
+ 0.2459550500,
+ 0.2518978119,
+ 0.2578310966,
+ 0.2637546957,
+ 0.2696683407,
+ 0.2755718231,
+ 0.2814649343,
+ 0.2873474658,
+ 0.2932191789,
+ 0.2990798354,
+ 0.3049292266,
+ 0.3107671738,
+ 0.3165933788,
+ 0.3224076927,
+ 0.3282098472,
+ 0.3339996636,
+ 0.3397769034,
+ 0.3455413282,
+ 0.3512927592,
+ 0.3570309579,
+ 0.3627557456,
+ 0.3684668541,
+ 0.3741640747,
+ 0.3798472285,
+ 0.3855160773,
+ 0.3911703825,
+ 0.3968099952,
+ 0.4024346471,
+ 0.4080441594,
+ 0.4136383235,
+ 0.4192169011,
+ 0.4247796834,
+ 0.4303264916,
+ 0.4358570874,
+ 0.4413712919,
+ 0.4468688369,
+ 0.4523496032,
+ 0.4578133225,
+ 0.4632597864,
+ 0.4686888456,
+ 0.4741002321,
+ 0.4794937670,
+ 0.4848692715,
+ 0.4902265072,
+ 0.4955652654,
+ 0.5008853674,
+ 0.5061866641,
+ 0.5114688873,
+ 0.5167317986,
+ 0.5219752789,
+ 0.5271991491,
+ 0.5324031115,
+ 0.5375871062,
+ 0.5427507758,
+ 0.5478940606,
+ 0.5530167222,
+ 0.5581185222,
+ 0.5631993413,
+ 0.5682589412,
+ 0.5732972026,
+ 0.5783138275,
+ 0.5833086967,
+ 0.5882815719,
+ 0.5932323337,
+ 0.5981607437,
+ 0.6030666232,
+ 0.6079497933,
+ 0.6128100753,
+ 0.6176473498,
+ 0.6224613190,
+ 0.6272518039,
+ 0.6320187449,
+ 0.6367619038,
+ 0.6414810419,
+ 0.6461760402,
+ 0.6508467197,
+ 0.6554928422,
+ 0.6601143479,
+ 0.6647109985,
+ 0.6692826152,
+ 0.6738290191,
+ 0.6783500314,
+ 0.6828455329,
+ 0.6873153448,
+ 0.6917592883,
+ 0.6961771250,
+ 0.7005687952,
+ 0.7049341202,
+ 0.7092728615,
+ 0.7135848999,
+ 0.7178700566,
+ 0.7221282125,
+ 0.7263591886,
+ 0.7305628061,
+ 0.7347388864,
+ 0.7388873696,
+ 0.7430079579,
+ 0.7471006513,
+ 0.7511651516,
+ 0.7552013993,
+ 0.7592092156,
+ 0.7631884217,
+ 0.7671388984,
+ 0.7710605264,
+ 0.7749531269,
+ 0.7788165212,
+ 0.7826505899,
+ 0.7864552140,
+ 0.7902302146,
+ 0.7939754725,
+ 0.7976908684,
+ 0.8013761640,
+ 0.8050313592,
+ 0.8086562157,
+ 0.8122506142,
+ 0.8158144355,
+ 0.8193475604,
+ 0.8228498101,
+ 0.8263210654,
+ 0.8297612667,
+ 0.8331701756,
+ 0.8365477324,
+ 0.8398938179,
+ 0.8432082534,
+ 0.8464909792,
+ 0.8497417569,
+ 0.8529606462,
+ 0.8561473489,
+ 0.8593018055,
+ 0.8624239564,
+ 0.8655136228,
+ 0.8685707450,
+ 0.8715950847,
+ 0.8745866418,
+ 0.8775452971,
+ 0.8804709315,
+ 0.8833633661,
+ 0.8862225413,
+ 0.8890483975,
+ 0.8918406963,
+ 0.8945994973,
+ 0.8973246217,
+ 0.9000158906,
+ 0.9026733041,
+ 0.9052967429,
+ 0.9078861475,
+ 0.9104412794,
+ 0.9129621983,
+ 0.9154487252,
+ 0.9179008007,
+ 0.9203183055,
+ 0.9227011204,
+ 0.9250492454,
+ 0.9273625612,
+ 0.9296408892,
+ 0.9318842888,
+ 0.9340925813,
+ 0.9362657070,
+ 0.9384035468,
+ 0.9405061007,
+ 0.9425731897,
+ 0.9446048737,
+ 0.9466009140,
+ 0.9485613704,
+ 0.9504860640,
+ 0.9523749948,
+ 0.9542281032,
+ 0.9560452700,
+ 0.9578264356,
+ 0.9595715404,
+ 0.9612805247,
+ 0.9629532695,
+ 0.9645897746,
+ 0.9661900401,
+ 0.9677538276,
+ 0.9692812562,
+ 0.9707721472,
+ 0.9722265005,
+ 0.9736442566,
+ 0.9750253558,
+ 0.9763697386,
+ 0.9776773453,
+ 0.9789481759,
+ 0.9801821709,
+ 0.9813792109,
+ 0.9825392962,
+ 0.9836624265,
+ 0.9847484827,
+ 0.9857975245,
+ 0.9868094325,
+ 0.9877841473,
+ 0.9887216687,
+ 0.9896219969,
+ 0.9904850721,
+ 0.9913108945,
+ 0.9920993447,
+ 0.9928504229,
+ 0.9935641289,
+ 0.9942404628,
+ 0.9948793054,
+ 0.9954807758,
+ 0.9960446954,
+ 0.9965711236,
+ 0.9970600605,
+ 0.9975114465,
+ 0.9979252815,
+ 0.9983015656,
+ 0.9986402392,
+ 0.9989413023,
+ 0.9992047548,
+ 0.9994305968,
+ 0.9996188283,
+ 0.9997693896,
+ 0.9998823404,
+ 0.9999576211,
+ 0.9999952912
+};
+
+static real_t kbd_short_32[] = {
+ 0.0000875914060105,
+ 0.0009321760265333,
+ 0.0032114611466596,
+ 0.0081009893216786,
+ 0.0171240286619181,
+ 0.0320720743527833,
+ 0.0548307856028528,
+ 0.0871361822564870,
+ 0.1302923415174603,
+ 0.1848955425508276,
+ 0.2506163195331889,
+ 0.3260874142923209,
+ 0.4089316830907141,
+ 0.4959414909423747,
+ 0.5833939894958904,
+ 0.6674601983218376,
+ 0.7446454751465113,
+ 0.8121892962974020,
+ 0.8683559394406505,
+ 0.9125649996381605,
+ 0.9453396205809574,
+ 0.9680864942677585,
+ 0.9827581789763112,
+ 0.9914756203467121,
+ 0.9961964092194694,
+ 0.9984956609571091,
+ 0.9994855586984285,
+ 0.9998533730714648,
+ 0.9999671864476404,
+ 0.9999948432453556,
+ 0.9999995655238333,
+ 0.9999999961638728
+};
+
+
+static real_t kbd_long_256[] = {
+ 0.0005851230124487,
+ 0.0009642149851497,
+ 0.0013558207534965,
+ 0.0017771849644394,
+ 0.0022352533849672,
+ 0.0027342299070304,
+ 0.0032773001022195,
+ 0.0038671998069216,
+ 0.0045064443384152,
+ 0.0051974336885144,
+ 0.0059425050016407,
+ 0.0067439602523141,
+ 0.0076040812644888,
+ 0.0085251378135895,
+ 0.0095093917383048,
+ 0.0105590986429280,
+ 0.0116765080854300,
+ 0.0128638627792770,
+ 0.0141233971318631,
+ 0.0154573353235409,
+ 0.0168678890600951,
+ 0.0183572550877256,
+ 0.0199276125319803,
+ 0.0215811201042484,
+ 0.0233199132076965,
+ 0.0251461009666641,
+ 0.0270617631981826,
+ 0.0290689473405856,
+ 0.0311696653515848,
+ 0.0333658905863535,
+ 0.0356595546648444,
+ 0.0380525443366107,
+ 0.0405466983507029,
+ 0.0431438043376910,
+ 0.0458455957104702,
+ 0.0486537485902075,
+ 0.0515698787635492,
+ 0.0545955386770205,
+ 0.0577322144743916,
+ 0.0609813230826460,
+ 0.0643442093520723,
+ 0.0678221432558827,
+ 0.0714163171546603,
+ 0.0751278431308314,
+ 0.0789577503982528,
+ 0.0829069827918993,
+ 0.0869763963425241,
+ 0.0911667569410503,
+ 0.0954787380973307,
+ 0.0999129187977865,
+ 0.1044697814663005,
+ 0.1091497100326053,
+ 0.1139529881122542,
+ 0.1188797973021148,
+ 0.1239302155951605,
+ 0.1291042159181728,
+ 0.1344016647957880,
+ 0.1398223211441467,
+ 0.1453658351972151,
+ 0.1510317475686540,
+ 0.1568194884519144,
+ 0.1627283769610327,
+ 0.1687576206143887,
+ 0.1749063149634756,
+ 0.1811734433685097,
+ 0.1875578769224857,
+ 0.1940583745250518,
+ 0.2006735831073503,
+ 0.2074020380087318,
+ 0.2142421635060113,
+ 0.2211922734956977,
+ 0.2282505723293797,
+ 0.2354151558022098,
+ 0.2426840122941792,
+ 0.2500550240636293,
+ 0.2575259686921987,
+ 0.2650945206801527,
+ 0.2727582531907993,
+ 0.2805146399424422,
+ 0.2883610572460804,
+ 0.2962947861868143,
+ 0.3043130149466800,
+ 0.3124128412663888,
+ 0.3205912750432127,
+ 0.3288452410620226,
+ 0.3371715818562547,
+ 0.3455670606953511,
+ 0.3540283646950029,
+ 0.3625521080463003,
+ 0.3711348353596863,
+ 0.3797730251194006,
+ 0.3884630932439016,
+ 0.3972013967475546,
+ 0.4059842374986933,
+ 0.4148078660689724,
+ 0.4236684856687616,
+ 0.4325622561631607,
+ 0.4414852981630577,
+ 0.4504336971855032,
+ 0.4594035078775303,
+ 0.4683907582974173,
+ 0.4773914542472655,
+ 0.4864015836506502,
+ 0.4954171209689973,
+ 0.5044340316502417,
+ 0.5134482766032377,
+ 0.5224558166913167,
+ 0.5314526172383208,
+ 0.5404346525403849,
+ 0.5493979103766972,
+ 0.5583383965124314,
+ 0.5672521391870222,
+ 0.5761351935809411,
+ 0.5849836462541291,
+ 0.5937936195492526,
+ 0.6025612759529649,
+ 0.6112828224083939,
+ 0.6199545145721097,
+ 0.6285726610088878,
+ 0.6371336273176413,
+ 0.6456338401819751,
+ 0.6540697913388968,
+ 0.6624380414593221,
+ 0.6707352239341151,
+ 0.6789580485595255,
+ 0.6871033051160131,
+ 0.6951678668345944,
+ 0.7031486937449871,
+ 0.7110428359000029,
+ 0.7188474364707993,
+ 0.7265597347077880,
+ 0.7341770687621900,
+ 0.7416968783634273,
+ 0.7491167073477523,
+ 0.7564342060337386,
+ 0.7636471334404891,
+ 0.7707533593446514,
+ 0.7777508661725849,
+ 0.7846377507242818,
+ 0.7914122257259034,
+ 0.7980726212080798,
+ 0.8046173857073919,
+ 0.8110450872887550,
+ 0.8173544143867162,
+ 0.8235441764639875,
+ 0.8296133044858474,
+ 0.8355608512093652,
+ 0.8413859912867303,
+ 0.8470880211822968,
+ 0.8526663589032990,
+ 0.8581205435445334,
+ 0.8634502346476508,
+ 0.8686552113760616,
+ 0.8737353715068081,
+ 0.8786907302411250,
+ 0.8835214188357692,
+ 0.8882276830575707,
+ 0.8928098814640207,
+ 0.8972684835130879,
+ 0.9016040675058185,
+ 0.9058173183656508,
+ 0.9099090252587376,
+ 0.9138800790599416,
+ 0.9177314696695282,
+ 0.9214642831859411,
+ 0.9250796989403991,
+ 0.9285789863994010,
+ 0.9319635019415643,
+ 0.9352346855155568,
+ 0.9383940571861993,
+ 0.9414432135761304,
+ 0.9443838242107182,
+ 0.9472176277741918,
+ 0.9499464282852282,
+ 0.9525720912004834,
+ 0.9550965394547873,
+ 0.9575217494469370,
+ 0.9598497469802043,
+ 0.9620826031668507,
+ 0.9642224303060783,
+ 0.9662713777449607,
+ 0.9682316277319895,
+ 0.9701053912729269,
+ 0.9718949039986892,
+ 0.9736024220549734,
+ 0.9752302180233160,
+ 0.9767805768831932,
+ 0.9782557920246753,
+ 0.9796581613210076,
+ 0.9809899832703159,
+ 0.9822535532154261,
+ 0.9834511596505429,
+ 0.9845850806232530,
+ 0.9856575802399989,
+ 0.9866709052828243,
+ 0.9876272819448033,
+ 0.9885289126911557,
+ 0.9893779732525968,
+ 0.9901766097569984,
+ 0.9909269360049311,
+ 0.9916310308941294,
+ 0.9922909359973702,
+ 0.9929086532976777,
+ 0.9934861430841844,
+ 0.9940253220113651,
+ 0.9945280613237534,
+ 0.9949961852476154,
+ 0.9954314695504363,
+ 0.9958356402684387,
+ 0.9962103726017252,
+ 0.9965572899760172,
+ 0.9968779632693499,
+ 0.9971739102014799,
+ 0.9974465948831872,
+ 0.9976974275220812,
+ 0.9979277642809907,
+ 0.9981389072844972,
+ 0.9983321047686901,
+ 0.9985085513687731,
+ 0.9986693885387259,
+ 0.9988157050968516,
+ 0.9989485378906924,
+ 0.9990688725744943,
+ 0.9991776444921379,
+ 0.9992757396582338,
+ 0.9993639958299003,
+ 0.9994432036616085,
+ 0.9995141079353859,
+ 0.9995774088586188,
+ 0.9996337634216871,
+ 0.9996837868076957,
+ 0.9997280538466377,
+ 0.9997671005064359,
+ 0.9998014254134544,
+ 0.9998314913952471,
+ 0.9998577270385304,
+ 0.9998805282555989,
+ 0.9999002598526793,
+ 0.9999172570940037,
+ 0.9999318272557038,
+ 0.9999442511639580,
+ 0.9999547847121726,
+ 0.9999636603523446,
+ 0.9999710885561258,
+ 0.9999772592414866,
+ 0.9999823431612708,
+ 0.9999864932503106,
+ 0.9999898459281599,
+ 0.9999925223548691,
+ 0.9999946296375997,
+ 0.9999962619864214,
+ 0.9999975018180320,
+ 0.9999984208055542,
+ 0.9999990808746198,
+ 0.9999995351446231,
+ 0.9999998288155155
+};
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/structs.h b/src/filters/transform/mpadecfilter/faad2/libfaad/structs.h
new file mode 100644
index 000000000..b6a4ad015
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/structs.h
@@ -0,0 +1,483 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: structs.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __STRUCTS_H__
+#define __STRUCTS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "cfft.h"
+#ifdef SBR_DEC
+#include "sbr_dec.h"
+#endif
+
+#define MAX_CHANNELS 64
+#define MAX_SYNTAX_ELEMENTS 48
+#define MAX_WINDOW_GROUPS 8
+#define MAX_SFB 51
+#define MAX_LTP_SFB 40
+#define MAX_LTP_SFB_S 8
+
+/* used to save the prediction state */
+typedef struct {
+ int16_t r[2];
+ int16_t COR[2];
+ int16_t VAR[2];
+} pred_state;
+
+typedef struct {
+ uint16_t N;
+ cfft_info *cfft;
+ complex_t *sincos;
+#ifdef PROFILE
+ int64_t cycles;
+ int64_t fft_cycles;
+#endif
+} mdct_info;
+
+typedef struct
+{
+ const real_t *long_window[2];
+ const real_t *short_window[2];
+#ifdef LD_DEC
+ const real_t *ld_window[2];
+#endif
+
+ mdct_info *mdct256;
+#ifdef LD_DEC
+ mdct_info *mdct1024;
+#endif
+ mdct_info *mdct2048;
+#ifdef PROFILE
+ int64_t cycles;
+#endif
+} fb_info;
+
+typedef struct
+{
+ uint8_t present;
+
+ uint8_t num_bands;
+ uint8_t pce_instance_tag;
+ uint8_t excluded_chns_present;
+ uint8_t band_top[17];
+ uint8_t prog_ref_level;
+ uint8_t dyn_rng_sgn[17];
+ uint8_t dyn_rng_ctl[17];
+ uint8_t exclude_mask[MAX_CHANNELS];
+ uint8_t additional_excluded_chns[MAX_CHANNELS];
+
+ real_t ctrl1;
+ real_t ctrl2;
+} drc_info;
+
+typedef struct
+{
+ uint8_t element_instance_tag;
+ uint8_t object_type;
+ uint8_t sf_index;
+ uint8_t num_front_channel_elements;
+ uint8_t num_side_channel_elements;
+ uint8_t num_back_channel_elements;
+ uint8_t num_lfe_channel_elements;
+ uint8_t num_assoc_data_elements;
+ uint8_t num_valid_cc_elements;
+ uint8_t mono_mixdown_present;
+ uint8_t mono_mixdown_element_number;
+ uint8_t stereo_mixdown_present;
+ uint8_t stereo_mixdown_element_number;
+ uint8_t matrix_mixdown_idx_present;
+ uint8_t pseudo_surround_enable;
+ uint8_t matrix_mixdown_idx;
+ uint8_t front_element_is_cpe[16];
+ uint8_t front_element_tag_select[16];
+ uint8_t side_element_is_cpe[16];
+ uint8_t side_element_tag_select[16];
+ uint8_t back_element_is_cpe[16];
+ uint8_t back_element_tag_select[16];
+ uint8_t lfe_element_tag_select[16];
+ uint8_t assoc_data_element_tag_select[16];
+ uint8_t cc_element_is_ind_sw[16];
+ uint8_t valid_cc_element_tag_select[16];
+
+ uint8_t channels;
+
+ uint8_t comment_field_bytes;
+ uint8_t comment_field_data[257];
+
+ /* extra added values */
+ uint8_t num_front_channels;
+ uint8_t num_side_channels;
+ uint8_t num_back_channels;
+ uint8_t num_lfe_channels;
+ uint8_t sce_channel[16];
+ uint8_t cpe_channel[16];
+} program_config;
+
+typedef struct
+{
+ uint16_t syncword;
+ uint8_t id;
+ uint8_t layer;
+ uint8_t protection_absent;
+ uint8_t profile;
+ uint8_t sf_index;
+ uint8_t private_bit;
+ uint8_t channel_configuration;
+ uint8_t original;
+ uint8_t home;
+ uint8_t emphasis;
+ uint8_t copyright_identification_bit;
+ uint8_t copyright_identification_start;
+ uint16_t aac_frame_length;
+ uint16_t adts_buffer_fullness;
+ uint8_t no_raw_data_blocks_in_frame;
+ uint16_t crc_check;
+
+ /* control param */
+ uint8_t old_format;
+} adts_header;
+
+typedef struct
+{
+ uint8_t copyright_id_present;
+ int8_t copyright_id[10];
+ uint8_t original_copy;
+ uint8_t home;
+ uint8_t bitstream_type;
+ uint32_t bitrate;
+ uint8_t num_program_config_elements;
+ uint32_t adif_buffer_fullness;
+
+ /* maximum of 16 PCEs */
+ program_config pce[16];
+} adif_header;
+
+#ifdef LTP_DEC
+typedef struct
+{
+ uint8_t last_band;
+ uint8_t data_present;
+ uint16_t lag;
+ uint8_t lag_update;
+ uint8_t coef;
+ uint8_t long_used[MAX_SFB];
+ uint8_t short_used[8];
+ uint8_t short_lag_present[8];
+ uint8_t short_lag[8];
+} ltp_info;
+#endif
+
+#ifdef MAIN_DEC
+typedef struct
+{
+ uint8_t limit;
+ uint8_t predictor_reset;
+ uint8_t predictor_reset_group_number;
+ uint8_t prediction_used[MAX_SFB];
+} pred_info;
+#endif
+
+typedef struct
+{
+ uint8_t number_pulse;
+ uint8_t pulse_start_sfb;
+ uint8_t pulse_offset[4];
+ uint8_t pulse_amp[4];
+} pulse_info;
+
+typedef struct
+{
+ uint8_t n_filt[8];
+ uint8_t coef_res[8];
+ uint8_t length[8][4];
+ uint8_t order[8][4];
+ uint8_t direction[8][4];
+ uint8_t coef_compress[8][4];
+ uint8_t coef[8][4][32];
+} tns_info;
+
+#ifdef SSR_DEC
+typedef struct
+{
+ uint8_t max_band;
+
+ uint8_t adjust_num[4][8];
+ uint8_t alevcode[4][8][8];
+ uint8_t aloccode[4][8][8];
+} ssr_info;
+#endif
+
+typedef struct
+{
+ uint8_t max_sfb;
+
+ uint8_t num_swb;
+ uint8_t num_window_groups;
+ uint8_t num_windows;
+ uint8_t window_sequence;
+ uint8_t window_group_length[8];
+ uint8_t window_shape;
+ uint8_t scale_factor_grouping;
+ uint16_t sect_sfb_offset[8][15*8];
+ uint16_t swb_offset[52];
+
+ uint8_t sect_cb[8][15*8];
+ uint16_t sect_start[8][15*8];
+ uint16_t sect_end[8][15*8];
+ uint8_t sfb_cb[8][8*15];
+ uint8_t num_sec[8]; /* number of sections in a group */
+
+ uint8_t global_gain;
+ int16_t scale_factors[8][51]; /* [0..255] */
+
+ uint8_t ms_mask_present;
+ uint8_t ms_used[MAX_WINDOW_GROUPS][MAX_SFB];
+
+ uint8_t noise_used;
+ uint8_t is_used;
+
+ uint8_t pulse_data_present;
+ uint8_t tns_data_present;
+ uint8_t gain_control_data_present;
+ uint8_t predictor_data_present;
+
+ pulse_info pul;
+ tns_info tns;
+#ifdef MAIN_DEC
+ pred_info pred;
+#endif
+#ifdef LTP_DEC
+ ltp_info ltp;
+ ltp_info ltp2;
+#endif
+#ifdef SSR_DEC
+ ssr_info ssr;
+#endif
+
+#ifdef ERROR_RESILIENCE
+ /* ER HCR data */
+ uint16_t length_of_reordered_spectral_data;
+ uint8_t length_of_longest_codeword;
+ /* ER RLVC data */
+ uint8_t sf_concealment;
+ uint8_t rev_global_gain;
+ uint16_t length_of_rvlc_sf;
+ uint16_t dpcm_noise_nrg;
+ uint8_t sf_escapes_present;
+ uint8_t length_of_rvlc_escapes;
+ uint16_t dpcm_noise_last_position;
+#endif
+} ic_stream; /* individual channel stream */
+
+typedef struct
+{
+ uint8_t channel;
+ int16_t paired_channel;
+
+ uint8_t element_instance_tag;
+ uint8_t common_window;
+
+ ic_stream ics1;
+ ic_stream ics2;
+} element; /* syntax element (SCE, CPE, LFE) */
+
+typedef struct mp4AudioSpecificConfig
+{
+ /* Audio Specific Info */
+ /*uint8_t*/ unsigned char objectTypeIndex;
+ /*uint8_t*/ unsigned char samplingFrequencyIndex;
+ /*uint32_t*/ unsigned long samplingFrequency;
+ /*uint8_t*/ unsigned char channelsConfiguration;
+
+ /* GA Specific Info */
+ /*uint8_t*/ unsigned char frameLengthFlag;
+ /*uint8_t*/ unsigned char dependsOnCoreCoder;
+ /*uint16_t*/ unsigned short coreCoderDelay;
+ /*uint8_t*/ unsigned char extensionFlag;
+ /*uint8_t*/ unsigned char aacSectionDataResilienceFlag;
+ /*uint8_t*/ unsigned char aacScalefactorDataResilienceFlag;
+ /*uint8_t*/ unsigned char aacSpectralDataResilienceFlag;
+ /*uint8_t*/ unsigned char epConfig;
+
+ /*uint8_t*/ char sbr_present_flag;
+ /*uint8_t*/ char forceUpSampling;
+ /*uint8_t*/ char downSampledSBR;
+} mp4AudioSpecificConfig;
+
+typedef struct NeAACDecConfiguration
+{
+ /*uint8_t*/ unsigned char defObjectType;
+ /*uint32_t*/ unsigned long defSampleRate;
+ /*uint8_t*/ unsigned char outputFormat;
+ /*uint8_t*/ unsigned char downMatrix;
+ /*uint8_t*/ unsigned char useOldADTSFormat;
+ /*uint8_t*/ unsigned char dontUpSampleImplicitSBR;
+} NeAACDecConfiguration, *NeAACDecConfigurationPtr;
+
+typedef struct NeAACDecFrameInfo
+{
+ /*uint32_t*/ unsigned long bytesconsumed;
+ /*uint32_t*/ unsigned long samples;
+ /*uint8_t*/ unsigned char channels;
+ /*uint8_t*/ unsigned char error;
+ /*uint32_t*/ unsigned long samplerate;
+
+ /* SBR: 0: off, 1: on; normal, 2: on; downsampled */
+ /*uint8_t*/ unsigned char sbr;
+
+ /* MPEG-4 ObjectType */
+ /*uint8_t*/ unsigned char object_type;
+
+ /* AAC header type; MP4 will be signalled as RAW also */
+ /*uint8_t*/ unsigned char header_type;
+
+ /* multichannel configuration */
+ /*uint8_t*/ unsigned char num_front_channels;
+ /*uint8_t*/ unsigned char num_side_channels;
+ /*uint8_t*/ unsigned char num_back_channels;
+ /*uint8_t*/ unsigned char num_lfe_channels;
+ /*uint8_t*/ unsigned char channel_position[MAX_CHANNELS];
+
+ /* PS: 0: off, 1: on */
+ /*uint8_t*/ unsigned char ps;
+} NeAACDecFrameInfo;
+
+typedef struct
+{
+ uint8_t adts_header_present;
+ uint8_t adif_header_present;
+ uint8_t sf_index;
+ uint8_t object_type;
+ uint8_t channelConfiguration;
+#ifdef ERROR_RESILIENCE
+ uint8_t aacSectionDataResilienceFlag;
+ uint8_t aacScalefactorDataResilienceFlag;
+ uint8_t aacSpectralDataResilienceFlag;
+#endif
+ uint16_t frameLength;
+ uint8_t postSeekResetFlag;
+
+ uint32_t frame;
+
+ uint8_t downMatrix;
+ uint8_t upMatrix;
+ uint8_t first_syn_ele;
+ uint8_t has_lfe;
+ /* number of channels in current frame */
+ uint8_t fr_channels;
+ /* number of elements in current frame */
+ uint8_t fr_ch_ele;
+
+ /* element_output_channels:
+ determines the number of channels the element will output
+ */
+ uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS];
+ /* element_alloced:
+ determines whether the data needed for the element is allocated or not
+ */
+ uint8_t element_alloced[MAX_SYNTAX_ELEMENTS];
+ /* alloced_channels:
+ determines the number of channels where output data is allocated for
+ */
+ uint8_t alloced_channels;
+
+ /* output data buffer */
+ void *sample_buffer;
+
+ uint8_t window_shape_prev[MAX_CHANNELS];
+#ifdef LTP_DEC
+ uint16_t ltp_lag[MAX_CHANNELS];
+#endif
+ fb_info *fb;
+ drc_info *drc;
+
+ real_t *time_out[MAX_CHANNELS];
+ real_t *fb_intermed[MAX_CHANNELS];
+
+#ifdef SBR_DEC
+ int8_t sbr_present_flag;
+ int8_t forceUpSampling;
+ int8_t downSampledSBR;
+ /* determines whether SBR data is allocated for the gives element */
+ uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS];
+
+ sbr_info *sbr[MAX_SYNTAX_ELEMENTS];
+#endif
+#if (defined(PS_DEC) || defined(DRM_PS))
+ uint8_t ps_used[MAX_SYNTAX_ELEMENTS];
+ uint8_t ps_used_global;
+#endif
+
+#ifdef SSR_DEC
+ real_t *ssr_overlap[MAX_CHANNELS];
+ real_t *prev_fmd[MAX_CHANNELS];
+ real_t ipqf_buffer[MAX_CHANNELS][4][96/4];
+#endif
+
+#ifdef MAIN_DEC
+ pred_state *pred_stat[MAX_CHANNELS];
+#endif
+#ifdef LTP_DEC
+ int16_t *lt_pred_stat[MAX_CHANNELS];
+#endif
+
+#ifdef DRM
+ uint8_t error_state;
+#endif
+
+ /* Program Config Element */
+ uint8_t pce_set;
+ program_config pce;
+ uint8_t element_id[MAX_CHANNELS];
+ uint8_t internal_channel[MAX_CHANNELS];
+
+ /* Configuration data */
+ NeAACDecConfiguration config;
+
+#ifdef PROFILE
+ int64_t cycles;
+ int64_t spectral_cycles;
+ int64_t output_cycles;
+ int64_t scalefac_cycles;
+ int64_t requant_cycles;
+#endif
+} NeAACDecStruct, *NeAACDecHandle;
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/syntax.c b/src/filters/transform/mpadecfilter/faad2/libfaad/syntax.c
new file mode 100644
index 000000000..18243b372
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/syntax.c
@@ -0,0 +1,2445 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: syntax.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+/*
+ Reads the AAC bitstream as defined in 14496-3 (MPEG-4 Audio)
+*/
+
+#include "common.h"
+#include "structs.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "decoder.h"
+#include "syntax.h"
+#include "specrec.h"
+#include "huffman.h"
+#include "bits.h"
+#include "pulse.h"
+#include "analysis.h"
+#include "drc.h"
+#ifdef ERROR_RESILIENCE
+#include "rvlc.h"
+#endif
+#ifdef SBR_DEC
+#include "sbr_syntax.h"
+#endif
+
+
+/* static function declarations */
+static void decode_sce_lfe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
+ uint8_t id_syn_ele);
+static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
+ uint8_t id_syn_ele);
+static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
+ uint8_t channel, uint8_t *tag);
+static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld,
+ uint8_t channel, uint8_t *tag);
+#ifdef COUPLING_DEC
+static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld);
+#endif
+static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld);
+static uint8_t program_config_element(program_config *pce, bitfile *ld);
+static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc
+#ifdef SBR_DEC
+ ,uint8_t sbr_ele
+#endif
+ );
+static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele,
+ bitfile *ld, ic_stream *ics, uint8_t scal_flag,
+ int16_t *spec_data);
+static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+ uint8_t common_window);
+static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld);
+#ifdef SSR_DEC
+static void gain_control_data(bitfile *ld, ic_stream *ics);
+#endif
+static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+ int16_t *spectral_data);
+static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count);
+static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld);
+static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld);
+#ifdef LTP_DEC
+static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld);
+#endif
+static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld);
+static void adts_variable_header(adts_header *adts, bitfile *ld);
+static void adts_error_check(adts_header *adts, bitfile *ld);
+static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc);
+static uint8_t excluded_channels(bitfile *ld, drc_info *drc);
+static uint8_t side_info(NeAACDecHandle hDecoder, element *ele,
+ bitfile *ld, ic_stream *ics, uint8_t scal_flag);
+#ifdef DRM
+static int8_t DRM_aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+ bitfile *ld, uint8_t this_layer_stereo);
+#endif
+
+
+/* Table 4.4.1 */
+int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
+ program_config *pce_out)
+{
+ program_config pce;
+
+ /* 1024 or 960 */
+ mp4ASC->frameLengthFlag = faad_get1bit(ld
+ DEBUGVAR(1,138,"GASpecificConfig(): FrameLengthFlag"));
+#ifndef ALLOW_SMALL_FRAMELENGTH
+ if (mp4ASC->frameLengthFlag == 1)
+ return -3;
+#endif
+
+ mp4ASC->dependsOnCoreCoder = faad_get1bit(ld
+ DEBUGVAR(1,139,"GASpecificConfig(): DependsOnCoreCoder"));
+ if (mp4ASC->dependsOnCoreCoder == 1)
+ {
+ mp4ASC->coreCoderDelay = (uint16_t)faad_getbits(ld, 14
+ DEBUGVAR(1,140,"GASpecificConfig(): CoreCoderDelay"));
+ }
+
+ mp4ASC->extensionFlag = faad_get1bit(ld DEBUGVAR(1,141,"GASpecificConfig(): ExtensionFlag"));
+ if (mp4ASC->channelsConfiguration == 0)
+ {
+ if (program_config_element(&pce, ld))
+ return -3;
+ //mp4ASC->channelsConfiguration = pce.channels;
+
+ if (pce_out != NULL)
+ memcpy(pce_out, &pce, sizeof(program_config));
+
+ /*
+ if (pce.num_valid_cc_elements)
+ return -3;
+ */
+ }
+
+#ifdef ERROR_RESILIENCE
+ if (mp4ASC->extensionFlag == 1)
+ {
+ /* Error resilience not supported yet */
+ if (mp4ASC->objectTypeIndex >= ER_OBJECT_START)
+ {
+ mp4ASC->aacSectionDataResilienceFlag = faad_get1bit(ld
+ DEBUGVAR(1,144,"GASpecificConfig(): aacSectionDataResilienceFlag"));
+ mp4ASC->aacScalefactorDataResilienceFlag = faad_get1bit(ld
+ DEBUGVAR(1,145,"GASpecificConfig(): aacScalefactorDataResilienceFlag"));
+ mp4ASC->aacSpectralDataResilienceFlag = faad_get1bit(ld
+ DEBUGVAR(1,146,"GASpecificConfig(): aacSpectralDataResilienceFlag"));
+
+ /* 1 bit: extensionFlag3 */
+ }
+ }
+#endif
+
+ return 0;
+}
+
+/* Table 4.4.2 */
+/* An MPEG-4 Audio decoder is only required to follow the Program
+ Configuration Element in GASpecificConfig(). The decoder shall ignore
+ any Program Configuration Elements that may occur in raw data blocks.
+ PCEs transmitted in raw data blocks cannot be used to convey decoder
+ configuration information.
+*/
+static uint8_t program_config_element(program_config *pce, bitfile *ld)
+{
+ uint8_t i;
+
+ memset(pce, 0, sizeof(program_config));
+
+ pce->channels = 0;
+
+ pce->element_instance_tag = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,10,"program_config_element(): element_instance_tag"));
+
+ pce->object_type = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,11,"program_config_element(): object_type"));
+ pce->sf_index = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,12,"program_config_element(): sf_index"));
+ pce->num_front_channel_elements = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,13,"program_config_element(): num_front_channel_elements"));
+ pce->num_side_channel_elements = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,14,"program_config_element(): num_side_channel_elements"));
+ pce->num_back_channel_elements = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,15,"program_config_element(): num_back_channel_elements"));
+ pce->num_lfe_channel_elements = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,16,"program_config_element(): num_lfe_channel_elements"));
+ pce->num_assoc_data_elements = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,17,"program_config_element(): num_assoc_data_elements"));
+ pce->num_valid_cc_elements = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,18,"program_config_element(): num_valid_cc_elements"));
+
+ pce->mono_mixdown_present = faad_get1bit(ld
+ DEBUGVAR(1,19,"program_config_element(): mono_mixdown_present"));
+ if (pce->mono_mixdown_present == 1)
+ {
+ pce->mono_mixdown_element_number = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,20,"program_config_element(): mono_mixdown_element_number"));
+ }
+
+ pce->stereo_mixdown_present = faad_get1bit(ld
+ DEBUGVAR(1,21,"program_config_element(): stereo_mixdown_present"));
+ if (pce->stereo_mixdown_present == 1)
+ {
+ pce->stereo_mixdown_element_number = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,22,"program_config_element(): stereo_mixdown_element_number"));
+ }
+
+ pce->matrix_mixdown_idx_present = faad_get1bit(ld
+ DEBUGVAR(1,23,"program_config_element(): matrix_mixdown_idx_present"));
+ if (pce->matrix_mixdown_idx_present == 1)
+ {
+ pce->matrix_mixdown_idx = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,24,"program_config_element(): matrix_mixdown_idx"));
+ pce->pseudo_surround_enable = faad_get1bit(ld
+ DEBUGVAR(1,25,"program_config_element(): pseudo_surround_enable"));
+ }
+
+ for (i = 0; i < pce->num_front_channel_elements; i++)
+ {
+ pce->front_element_is_cpe[i] = faad_get1bit(ld
+ DEBUGVAR(1,26,"program_config_element(): front_element_is_cpe"));
+ pce->front_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,27,"program_config_element(): front_element_tag_select"));
+
+ if (pce->front_element_is_cpe[i] & 1)
+ {
+ pce->cpe_channel[pce->front_element_tag_select[i]] = pce->channels;
+ pce->num_front_channels += 2;
+ pce->channels += 2;
+ } else {
+ pce->sce_channel[pce->front_element_tag_select[i]] = pce->channels;
+ pce->num_front_channels++;
+ pce->channels++;
+ }
+ }
+
+ for (i = 0; i < pce->num_side_channel_elements; i++)
+ {
+ pce->side_element_is_cpe[i] = faad_get1bit(ld
+ DEBUGVAR(1,28,"program_config_element(): side_element_is_cpe"));
+ pce->side_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,29,"program_config_element(): side_element_tag_select"));
+
+ if (pce->side_element_is_cpe[i] & 1)
+ {
+ pce->cpe_channel[pce->side_element_tag_select[i]] = pce->channels;
+ pce->num_side_channels += 2;
+ pce->channels += 2;
+ } else {
+ pce->sce_channel[pce->side_element_tag_select[i]] = pce->channels;
+ pce->num_side_channels++;
+ pce->channels++;
+ }
+ }
+
+ for (i = 0; i < pce->num_back_channel_elements; i++)
+ {
+ pce->back_element_is_cpe[i] = faad_get1bit(ld
+ DEBUGVAR(1,30,"program_config_element(): back_element_is_cpe"));
+ pce->back_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,31,"program_config_element(): back_element_tag_select"));
+
+ if (pce->back_element_is_cpe[i] & 1)
+ {
+ pce->cpe_channel[pce->back_element_tag_select[i]] = pce->channels;
+ pce->channels += 2;
+ pce->num_back_channels += 2;
+ } else {
+ pce->sce_channel[pce->back_element_tag_select[i]] = pce->channels;
+ pce->num_back_channels++;
+ pce->channels++;
+ }
+ }
+
+ for (i = 0; i < pce->num_lfe_channel_elements; i++)
+ {
+ pce->lfe_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,32,"program_config_element(): lfe_element_tag_select"));
+
+ pce->sce_channel[pce->lfe_element_tag_select[i]] = pce->channels;
+ pce->num_lfe_channels++;
+ pce->channels++;
+ }
+
+ for (i = 0; i < pce->num_assoc_data_elements; i++)
+ pce->assoc_data_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,33,"program_config_element(): assoc_data_element_tag_select"));
+
+ for (i = 0; i < pce->num_valid_cc_elements; i++)
+ {
+ pce->cc_element_is_ind_sw[i] = faad_get1bit(ld
+ DEBUGVAR(1,34,"program_config_element(): cc_element_is_ind_sw"));
+ pce->valid_cc_element_tag_select[i] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,35,"program_config_element(): valid_cc_element_tag_select"));
+ }
+
+ faad_byte_align(ld);
+
+ pce->comment_field_bytes = (uint8_t)faad_getbits(ld, 8
+ DEBUGVAR(1,36,"program_config_element(): comment_field_bytes"));
+
+ for (i = 0; i < pce->comment_field_bytes; i++)
+ {
+ pce->comment_field_data[i] = (uint8_t)faad_getbits(ld, 8
+ DEBUGVAR(1,37,"program_config_element(): comment_field_data"));
+ }
+ pce->comment_field_data[i] = 0;
+
+ if (pce->channels > MAX_CHANNELS)
+ return 22;
+
+ return 0;
+}
+
+static void decode_sce_lfe(NeAACDecHandle hDecoder,
+ NeAACDecFrameInfo *hInfo, bitfile *ld,
+ uint8_t id_syn_ele)
+{
+ uint8_t channels = hDecoder->fr_channels;
+ uint8_t tag = 0;
+
+ if (channels+1 > MAX_CHANNELS)
+ {
+ hInfo->error = 12;
+ return;
+ }
+ if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS)
+ {
+ hInfo->error = 13;
+ return;
+ }
+
+ /* for SCE hDecoder->element_output_channels[] is not set here because this
+ can become 2 when some form of Parametric Stereo coding is used
+ */
+
+ /* save the syntax element id */
+ hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele;
+
+ /* decode the element */
+ hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag);
+
+ /* map output channels position to internal data channels */
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)
+ {
+ /* this might be faulty when pce_set is true */
+ hDecoder->internal_channel[channels] = channels;
+ hDecoder->internal_channel[channels+1] = channels+1;
+ } else {
+ if (hDecoder->pce_set)
+ hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels;
+ else
+ hDecoder->internal_channel[channels] = channels;
+ }
+
+ hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele];
+ hDecoder->fr_ch_ele++;
+}
+
+static void decode_cpe(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo, bitfile *ld,
+ uint8_t id_syn_ele)
+{
+ uint8_t channels = hDecoder->fr_channels;
+ uint8_t tag = 0;
+
+ if (channels+2 > MAX_CHANNELS)
+ {
+ hInfo->error = 12;
+ return;
+ }
+ if (hDecoder->fr_ch_ele+1 > MAX_SYNTAX_ELEMENTS)
+ {
+ hInfo->error = 13;
+ return;
+ }
+
+ /* for CPE the number of output channels is always 2 */
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+ {
+ /* element_output_channels not set yet */
+ hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2;
+ } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != 2) {
+ /* element inconsistency */
+ hInfo->error = 21;
+ return;
+ }
+
+ /* save the syntax element id */
+ hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele;
+
+ /* decode the element */
+ hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag);
+
+ /* map output channel position to internal data channels */
+ if (hDecoder->pce_set)
+ {
+ hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels;
+ hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]+1] = channels+1;
+ } else {
+ hDecoder->internal_channel[channels] = channels;
+ hDecoder->internal_channel[channels+1] = channels+1;
+ }
+
+ hDecoder->fr_channels += 2;
+ hDecoder->fr_ch_ele++;
+}
+
+void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+ bitfile *ld, program_config *pce, drc_info *drc)
+{
+ uint8_t id_syn_ele;
+ uint8_t ele_this_frame = 0;
+
+ hDecoder->fr_channels = 0;
+ hDecoder->fr_ch_ele = 0;
+ hDecoder->first_syn_ele = 25;
+ hDecoder->has_lfe = 0;
+
+#ifdef ERROR_RESILIENCE
+ if (hDecoder->object_type < ER_OBJECT_START)
+ {
+#endif
+ /* Table 4.4.3: raw_data_block() */
+ while ((id_syn_ele = (uint8_t)faad_getbits(ld, LEN_SE_ID
+ DEBUGVAR(1,4,"NeAACDecDecode(): id_syn_ele"))) != ID_END)
+ {
+ switch (id_syn_ele) {
+ case ID_SCE:
+ ele_this_frame++;
+ if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
+ decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele);
+ if (hInfo->error > 0)
+ return;
+ break;
+ case ID_CPE:
+ ele_this_frame++;
+ if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele;
+ decode_cpe(hDecoder, hInfo, ld, id_syn_ele);
+ if (hInfo->error > 0)
+ return;
+ break;
+ case ID_LFE:
+#ifdef DRM
+ hInfo->error = 32;
+#else
+ ele_this_frame++;
+ hDecoder->has_lfe++;
+ decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele);
+#endif
+ if (hInfo->error > 0)
+ return;
+ break;
+ case ID_CCE: /* not implemented yet, but skip the bits */
+#ifdef DRM
+ hInfo->error = 32;
+#else
+ ele_this_frame++;
+#ifdef COUPLING_DEC
+ hInfo->error = coupling_channel_element(hDecoder, ld);
+#else
+ hInfo->error = 6;
+#endif
+#endif
+ if (hInfo->error > 0)
+ return;
+ break;
+ case ID_DSE:
+ ele_this_frame++;
+ data_stream_element(hDecoder, ld);
+ break;
+ case ID_PCE:
+ if (ele_this_frame != 0)
+ {
+ hInfo->error = 31;
+ return;
+ }
+ ele_this_frame++;
+ /* 14496-4: 5.6.4.1.2.1.3: */
+ /* program_configuration_element()'s in access units shall be ignored */
+ program_config_element(pce, ld);
+ //if ((hInfo->error = program_config_element(pce, ld)) > 0)
+ // return;
+ //hDecoder->pce_set = 1;
+ break;
+ case ID_FIL:
+ ele_this_frame++;
+ /* one sbr_info describes a channel_element not a channel! */
+ /* if we encounter SBR data here: error */
+ /* SBR data will be read directly in the SCE/LFE/CPE element */
+ if ((hInfo->error = fill_element(hDecoder, ld, drc
+#ifdef SBR_DEC
+ , INVALID_SBR_ELEMENT
+#endif
+ )) > 0)
+ return;
+ break;
+ }
+ }
+#ifdef ERROR_RESILIENCE
+ } else {
+ /* Table 262: er_raw_data_block() */
+ switch (hDecoder->channelConfiguration)
+ {
+ case 1:
+ decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+ if (hInfo->error > 0)
+ return;
+ break;
+ case 2:
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ if (hInfo->error > 0)
+ return;
+ break;
+ case 3:
+ decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ if (hInfo->error > 0)
+ return;
+ break;
+ case 4:
+ decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+ if (hInfo->error > 0)
+ return;
+ break;
+ case 5:
+ decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ if (hInfo->error > 0)
+ return;
+ break;
+ case 6:
+ decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE);
+ if (hInfo->error > 0)
+ return;
+ break;
+ case 7: /* 8 channels */
+ decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE);
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ decode_cpe(hDecoder, hInfo, ld, ID_CPE);
+ decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE);
+ if (hInfo->error > 0)
+ return;
+ break;
+ default:
+ hInfo->error = 7;
+ return;
+ }
+#if 0
+ cnt = bits_to_decode() / 8;
+ while (cnt >= 1)
+ {
+ cnt -= extension_payload(cnt);
+ }
+#endif
+ }
+#endif
+
+ /* new in corrigendum 14496-3:2002 */
+#ifdef DRM
+ if (hDecoder->object_type != DRM_ER_LC)
+#endif
+ {
+ faad_byte_align(ld);
+ }
+
+ return;
+}
+
+/* Table 4.4.4 and */
+/* Table 4.4.9 */
+static uint8_t single_lfe_channel_element(NeAACDecHandle hDecoder, bitfile *ld,
+ uint8_t channel, uint8_t *tag)
+{
+ uint8_t retval = 0;
+ element sce = {0};
+ ic_stream *ics = &(sce.ics1);
+ ALIGN int16_t spec_data[1024] = {0};
+
+ sce.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG
+ DEBUGVAR(1,38,"single_lfe_channel_element(): element_instance_tag"));
+
+ *tag = sce.element_instance_tag;
+ sce.channel = channel;
+ sce.paired_channel = -1;
+
+ retval = individual_channel_stream(hDecoder, &sce, ld, ics, 0, spec_data);
+ if (retval > 0)
+ return retval;
+
+ /* IS not allowed in single channel */
+ if (ics->is_used)
+ return 32;
+
+#ifdef SBR_DEC
+ /* check if next bitstream element is a fill element */
+ /* if so, read it now so SBR decoding can be done in case of a file with SBR */
+ if (faad_showbits(ld, LEN_SE_ID) == ID_FIL)
+ {
+ faad_flushbits(ld, LEN_SE_ID);
+
+ /* one sbr_info describes a channel_element not a channel! */
+ if ((retval = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0)
+ {
+ return retval;
+ }
+ }
+#endif
+
+ /* noiseless coding is done, spectral reconstruction is done now */
+ retval = reconstruct_single_channel(hDecoder, ics, &sce, spec_data);
+ if (retval > 0)
+ return retval;
+
+ return 0;
+}
+
+/* Table 4.4.5 */
+static uint8_t channel_pair_element(NeAACDecHandle hDecoder, bitfile *ld,
+ uint8_t channels, uint8_t *tag)
+{
+ ALIGN int16_t spec_data1[1024] = {0};
+ ALIGN int16_t spec_data2[1024] = {0};
+ element cpe = {0};
+ ic_stream *ics1 = &(cpe.ics1);
+ ic_stream *ics2 = &(cpe.ics2);
+ uint8_t result;
+
+ cpe.channel = channels;
+ cpe.paired_channel = channels+1;
+
+ cpe.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG
+ DEBUGVAR(1,39,"channel_pair_element(): element_instance_tag"));
+ *tag = cpe.element_instance_tag;
+
+ if ((cpe.common_window = faad_get1bit(ld
+ DEBUGVAR(1,40,"channel_pair_element(): common_window"))) & 1)
+ {
+ /* both channels have common ics information */
+ if ((result = ics_info(hDecoder, ics1, ld, cpe.common_window)) > 0)
+ return result;
+
+ ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,41,"channel_pair_element(): ms_mask_present"));
+ if (ics1->ms_mask_present == 3)
+ {
+ /* bitstream error */
+ return 32;
+ }
+ if (ics1->ms_mask_present == 1)
+ {
+ uint8_t g, sfb;
+ for (g = 0; g < ics1->num_window_groups; g++)
+ {
+ for (sfb = 0; sfb < ics1->max_sfb; sfb++)
+ {
+ ics1->ms_used[g][sfb] = faad_get1bit(ld
+ DEBUGVAR(1,42,"channel_pair_element(): faad_get1bit"));
+ }
+ }
+ }
+
+#ifdef ERROR_RESILIENCE
+ if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present))
+ {
+ if ((
+#ifdef LTP_DEC
+ ics1->ltp.data_present =
+#endif
+ faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
+ {
+#ifdef LTP_DEC
+ if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0)
+ {
+ return result;
+ }
+#else
+ return 26;
+#endif
+ }
+ }
+#endif
+
+ memcpy(ics2, ics1, sizeof(ic_stream));
+ } else {
+ ics1->ms_mask_present = 0;
+ }
+
+ if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics1,
+ 0, spec_data1)) > 0)
+ {
+ return result;
+ }
+
+#ifdef ERROR_RESILIENCE
+ if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) &&
+ (ics1->predictor_data_present))
+ {
+ if ((
+#ifdef LTP_DEC
+ ics1->ltp2.data_present =
+#endif
+ faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
+ {
+#ifdef LTP_DEC
+ if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0)
+ {
+ return result;
+ }
+#else
+ return 26;
+#endif
+ }
+ }
+#endif
+
+ if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics2,
+ 0, spec_data2)) > 0)
+ {
+ return result;
+ }
+
+#ifdef SBR_DEC
+ /* check if next bitstream element is a fill element */
+ /* if so, read it now so SBR decoding can be done in case of a file with SBR */
+ if (faad_showbits(ld, LEN_SE_ID) == ID_FIL)
+ {
+ faad_flushbits(ld, LEN_SE_ID);
+
+ /* one sbr_info describes a channel_element not a channel! */
+ if ((result = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0)
+ {
+ return result;
+ }
+ }
+#endif
+
+ /* noiseless coding is done, spectral reconstruction is done now */
+ if ((result = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe,
+ spec_data1, spec_data2)) > 0)
+ {
+ return result;
+ }
+
+ return 0;
+}
+
+/* Table 4.4.6 */
+static uint8_t ics_info(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+ uint8_t common_window)
+{
+ uint8_t retval = 0;
+ uint8_t ics_reserved_bit;
+
+ ics_reserved_bit = faad_get1bit(ld
+ DEBUGVAR(1,43,"ics_info(): ics_reserved_bit"));
+ if (ics_reserved_bit != 0)
+ return 32;
+ ics->window_sequence = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,44,"ics_info(): window_sequence"));
+ ics->window_shape = faad_get1bit(ld
+ DEBUGVAR(1,45,"ics_info(): window_shape"));
+
+#ifdef LD_DEC
+ /* No block switching in LD */
+ if ((hDecoder->object_type == LD) && (ics->window_sequence != ONLY_LONG_SEQUENCE))
+ return 32;
+#endif
+
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ {
+ ics->max_sfb = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,46,"ics_info(): max_sfb (short)"));
+ ics->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7
+ DEBUGVAR(1,47,"ics_info(): scale_factor_grouping"));
+ } else {
+ ics->max_sfb = (uint8_t)faad_getbits(ld, 6
+ DEBUGVAR(1,48,"ics_info(): max_sfb (long)"));
+ }
+
+ /* get the grouping information */
+ if ((retval = window_grouping_info(hDecoder, ics)) > 0)
+ return retval;
+
+
+ /* should be an error */
+ /* check the range of max_sfb */
+ if (ics->max_sfb > ics->num_swb)
+ return 16;
+
+ if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+ {
+ if ((ics->predictor_data_present = faad_get1bit(ld
+ DEBUGVAR(1,49,"ics_info(): predictor_data_present"))) & 1)
+ {
+ if (hDecoder->object_type == MAIN) /* MPEG2 style AAC predictor */
+ {
+ uint8_t sfb;
+
+ uint8_t limit = min(ics->max_sfb, max_pred_sfb(hDecoder->sf_index));
+#ifdef MAIN_DEC
+ ics->pred.limit = limit;
+#endif
+
+ if ((
+#ifdef MAIN_DEC
+ ics->pred.predictor_reset =
+#endif
+ faad_get1bit(ld DEBUGVAR(1,53,"ics_info(): pred.predictor_reset"))) & 1)
+ {
+#ifdef MAIN_DEC
+ ics->pred.predictor_reset_group_number =
+#endif
+ (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,54,"ics_info(): pred.predictor_reset_group_number"));
+ }
+
+ for (sfb = 0; sfb < limit; sfb++)
+ {
+#ifdef MAIN_DEC
+ ics->pred.prediction_used[sfb] =
+#endif
+ faad_get1bit(ld DEBUGVAR(1,55,"ics_info(): pred.prediction_used"));
+ }
+ }
+#ifdef LTP_DEC
+ else { /* Long Term Prediction */
+ if (hDecoder->object_type < ER_OBJECT_START)
+ {
+ if ((ics->ltp.data_present = faad_get1bit(ld
+ DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1)
+ {
+ if ((retval = ltp_data(hDecoder, ics, &(ics->ltp), ld)) > 0)
+ {
+ return retval;
+ }
+ }
+ if (common_window)
+ {
+ if ((ics->ltp2.data_present = faad_get1bit(ld
+ DEBUGVAR(1,51,"ics_info(): ltp2.data_present"))) & 1)
+ {
+ if ((retval = ltp_data(hDecoder, ics, &(ics->ltp2), ld)) > 0)
+ {
+ return retval;
+ }
+ }
+ }
+ }
+#ifdef ERROR_RESILIENCE
+ if (!common_window && (hDecoder->object_type >= ER_OBJECT_START))
+ {
+ if ((ics->ltp.data_present = faad_get1bit(ld
+ DEBUGVAR(1,50,"ics_info(): ltp.data_present"))) & 1)
+ {
+ ltp_data(hDecoder, ics, &(ics->ltp), ld);
+ }
+ }
+#endif
+ }
+#endif
+ }
+ }
+
+ return retval;
+}
+
+/* Table 4.4.7 */
+static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld)
+{
+ uint8_t i;
+
+ pul->number_pulse = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,56,"pulse_data(): number_pulse"));
+ pul->pulse_start_sfb = (uint8_t)faad_getbits(ld, 6
+ DEBUGVAR(1,57,"pulse_data(): pulse_start_sfb"));
+
+ /* check the range of pulse_start_sfb */
+ if (pul->pulse_start_sfb > ics->num_swb)
+ return 16;
+
+ for (i = 0; i < pul->number_pulse+1; i++)
+ {
+ pul->pulse_offset[i] = (uint8_t)faad_getbits(ld, 5
+ DEBUGVAR(1,58,"pulse_data(): pulse_offset"));
+#if 0
+ printf("%d\n", pul->pulse_offset[i]);
+#endif
+ pul->pulse_amp[i] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,59,"pulse_data(): pulse_amp"));
+#if 0
+ printf("%d\n", pul->pulse_amp[i]);
+#endif
+ }
+
+ return 0;
+}
+
+#ifdef COUPLING_DEC
+/* Table 4.4.8: Currently just for skipping the bits... */
+static uint8_t coupling_channel_element(NeAACDecHandle hDecoder, bitfile *ld)
+{
+ uint8_t c, result = 0;
+ uint8_t ind_sw_cce_flag = 0;
+ uint8_t num_gain_element_lists = 0;
+ uint8_t num_coupled_elements = 0;
+
+ element el_empty = {0};
+ ic_stream ics_empty = {0};
+ int16_t sh_data[1024];
+
+ c = faad_getbits(ld, LEN_TAG
+ DEBUGVAR(1,900,"coupling_channel_element(): element_instance_tag"));
+
+ ind_sw_cce_flag = faad_get1bit(ld
+ DEBUGVAR(1,901,"coupling_channel_element(): ind_sw_cce_flag"));
+ num_coupled_elements = faad_getbits(ld, 3
+ DEBUGVAR(1,902,"coupling_channel_element(): num_coupled_elements"));
+
+ for (c = 0; c < num_coupled_elements + 1; c++)
+ {
+ uint8_t cc_target_is_cpe, cc_target_tag_select;
+
+ num_gain_element_lists++;
+
+ cc_target_is_cpe = faad_get1bit(ld
+ DEBUGVAR(1,903,"coupling_channel_element(): cc_target_is_cpe"));
+ cc_target_tag_select = faad_getbits(ld, 4
+ DEBUGVAR(1,904,"coupling_channel_element(): cc_target_tag_select"));
+
+ if (cc_target_is_cpe)
+ {
+ uint8_t cc_l = faad_get1bit(ld
+ DEBUGVAR(1,905,"coupling_channel_element(): cc_l"));
+ uint8_t cc_r = faad_get1bit(ld
+ DEBUGVAR(1,906,"coupling_channel_element(): cc_r"));
+
+ if (cc_l && cc_r)
+ num_gain_element_lists++;
+ }
+ }
+
+ faad_get1bit(ld
+ DEBUGVAR(1,907,"coupling_channel_element(): cc_domain"));
+ faad_get1bit(ld
+ DEBUGVAR(1,908,"coupling_channel_element(): gain_element_sign"));
+ faad_getbits(ld, 2
+ DEBUGVAR(1,909,"coupling_channel_element(): gain_element_scale"));
+
+ if ((result = individual_channel_stream(hDecoder, &el_empty, ld, &ics_empty,
+ 0, sh_data)) > 0)
+ {
+ return result;
+ }
+
+ /* IS not allowed in single channel */
+ if (ics->is_used)
+ return 32;
+
+ for (c = 1; c < num_gain_element_lists; c++)
+ {
+ uint8_t cge;
+
+ if (ind_sw_cce_flag)
+ {
+ cge = 1;
+ } else {
+ cge = faad_get1bit(ld
+ DEBUGVAR(1,910,"coupling_channel_element(): common_gain_element_present"));
+ }
+
+ if (cge)
+ {
+ huffman_scale_factor(ld);
+ } else {
+ uint8_t g, sfb;
+
+ for (g = 0; g < ics_empty.num_window_groups; g++)
+ {
+ for (sfb = 0; sfb < ics_empty.max_sfb; sfb++)
+ {
+ if (ics_empty.sfb_cb[g][sfb] != ZERO_HCB)
+ huffman_scale_factor(ld);
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+#endif
+
+/* Table 4.4.10 */
+static uint16_t data_stream_element(NeAACDecHandle hDecoder, bitfile *ld)
+{
+ uint8_t byte_aligned;
+ uint16_t i, count;
+
+ /* element_instance_tag = */ faad_getbits(ld, LEN_TAG
+ DEBUGVAR(1,60,"data_stream_element(): element_instance_tag"));
+ byte_aligned = faad_get1bit(ld
+ DEBUGVAR(1,61,"data_stream_element(): byte_aligned"));
+ count = (uint16_t)faad_getbits(ld, 8
+ DEBUGVAR(1,62,"data_stream_element(): count"));
+ if (count == 255)
+ {
+ count += (uint16_t)faad_getbits(ld, 8
+ DEBUGVAR(1,63,"data_stream_element(): extra count"));
+ }
+ if (byte_aligned)
+ faad_byte_align(ld);
+
+ for (i = 0; i < count; i++)
+ {
+ faad_getbits(ld, LEN_BYTE
+ DEBUGVAR(1,64,"data_stream_element(): data_stream_byte"));
+ }
+
+ return count;
+}
+
+/* Table 4.4.11 */
+static uint8_t fill_element(NeAACDecHandle hDecoder, bitfile *ld, drc_info *drc
+#ifdef SBR_DEC
+ ,uint8_t sbr_ele
+#endif
+ )
+{
+ uint16_t count;
+#ifdef SBR_DEC
+ uint8_t bs_extension_type;
+#endif
+
+ count = (uint16_t)faad_getbits(ld, 4
+ DEBUGVAR(1,65,"fill_element(): count"));
+ if (count == 15)
+ {
+ count += (uint16_t)faad_getbits(ld, 8
+ DEBUGVAR(1,66,"fill_element(): extra count")) - 1;
+ }
+
+ if (count > 0)
+ {
+#ifdef SBR_DEC
+ bs_extension_type = (uint8_t)faad_showbits(ld, 4);
+
+ if ((bs_extension_type == EXT_SBR_DATA) ||
+ (bs_extension_type == EXT_SBR_DATA_CRC))
+ {
+ if (sbr_ele == INVALID_SBR_ELEMENT)
+ return 24;
+
+ if (!hDecoder->sbr[sbr_ele])
+ {
+ hDecoder->sbr[sbr_ele] = sbrDecodeInit(hDecoder->frameLength,
+ hDecoder->element_id[sbr_ele], 2*get_sample_rate(hDecoder->sf_index),
+ hDecoder->downSampledSBR
+#ifdef DRM
+ , 0
+#endif
+ );
+ }
+
+ hDecoder->sbr_present_flag = 1;
+
+ /* parse the SBR data */
+ hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count);
+
+#if 0
+ if (hDecoder->sbr[sbr_ele]->ret > 0)
+ {
+ printf("%s\n", NeAACDecGetErrorMessage(hDecoder->sbr[sbr_ele]->ret));
+ }
+#endif
+
+#if (defined(PS_DEC) || defined(DRM_PS))
+ if (hDecoder->sbr[sbr_ele]->ps_used)
+ {
+ hDecoder->ps_used[sbr_ele] = 1;
+
+ /* set element independent flag to 1 as well */
+ hDecoder->ps_used_global = 1;
+ }
+#endif
+ } else {
+#endif
+#ifndef DRM
+ while (count > 0)
+ {
+ count -= extension_payload(ld, drc, count);
+ }
+#else
+ return 30;
+#endif
+#ifdef SBR_DEC
+ }
+#endif
+ }
+
+ return 0;
+}
+
+/* Table 4.4.12 */
+#ifdef SSR_DEC
+static void gain_control_data(bitfile *ld, ic_stream *ics)
+{
+ uint8_t bd, wd, ad;
+ ssr_info *ssr = &(ics->ssr);
+
+ ssr->max_band = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,1000,"gain_control_data(): max_band"));
+
+ if (ics->window_sequence == ONLY_LONG_SEQUENCE)
+ {
+ for (bd = 1; bd <= ssr->max_band; bd++)
+ {
+ for (wd = 0; wd < 1; wd++)
+ {
+ ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+ for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+ {
+ ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+ ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ }
+ }
+ }
+ } else if (ics->window_sequence == LONG_START_SEQUENCE) {
+ for (bd = 1; bd <= ssr->max_band; bd++)
+ {
+ for (wd = 0; wd < 2; wd++)
+ {
+ ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+ for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+ {
+ ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+ if (wd == 0)
+ {
+ ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ } else {
+ ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ }
+ }
+ }
+ }
+ } else if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) {
+ for (bd = 1; bd <= ssr->max_band; bd++)
+ {
+ for (wd = 0; wd < 8; wd++)
+ {
+ ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+ for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+ {
+ ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+ ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ }
+ }
+ }
+ } else if (ics->window_sequence == LONG_STOP_SEQUENCE) {
+ for (bd = 1; bd <= ssr->max_band; bd++)
+ {
+ for (wd = 0; wd < 2; wd++)
+ {
+ ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+ for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++)
+ {
+ ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+
+ if (wd == 0)
+ {
+ ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ } else {
+ ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ }
+ }
+ }
+ }
+ }
+}
+#endif
+
+#ifdef DRM
+/* Table 4.4.13 ASME */
+void DRM_aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+ bitfile *ld, program_config *pce, drc_info *drc)
+{
+ uint8_t retval = 0;
+ uint8_t channels = hDecoder->fr_channels = 0;
+ uint8_t ch;
+ uint8_t this_layer_stereo = (hDecoder->channelConfiguration > 1) ? 1 : 0;
+ element cpe = {0};
+ ic_stream *ics1 = &(cpe.ics1);
+ ic_stream *ics2 = &(cpe.ics2);
+ int16_t *spec_data;
+ ALIGN int16_t spec_data1[1024] = {0};
+ ALIGN int16_t spec_data2[1024] = {0};
+
+ hDecoder->fr_ch_ele = 0;
+
+ hInfo->error = DRM_aac_scalable_main_header(hDecoder, ics1, ics2, ld, this_layer_stereo);
+ if (hInfo->error > 0)
+ return;
+
+ cpe.common_window = 1;
+ if (this_layer_stereo)
+ {
+ hDecoder->element_id[0] = ID_CPE;
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
+ hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2;
+ } else {
+ hDecoder->element_id[0] = ID_SCE;
+ }
+
+ if (this_layer_stereo)
+ {
+ cpe.channel = 0;
+ cpe.paired_channel = 1;
+ }
+
+
+ /* Stereo2 / Mono1 */
+ ics1->tns_data_present = faad_get1bit(ld);
+
+#if defined(LTP_DEC)
+ ics1->ltp.data_present = faad_get1bit(ld);
+#elif defined (DRM)
+ if(faad_get1bit(ld)) {
+ hInfo->error = 26;
+ return;
+ }
+#else
+ faad_get1bit(ld);
+#endif
+
+ hInfo->error = side_info(hDecoder, &cpe, ld, ics1, 1);
+ if (hInfo->error > 0)
+ return;
+ if (this_layer_stereo)
+ {
+ /* Stereo3 */
+ ics2->tns_data_present = faad_get1bit(ld);
+#ifdef LTP_DEC
+ ics1->ltp.data_present =
+#endif
+ faad_get1bit(ld);
+ hInfo->error = side_info(hDecoder, &cpe, ld, ics2, 1);
+ if (hInfo->error > 0)
+ return;
+ }
+ /* Stereo4 / Mono2 */
+ if (ics1->tns_data_present)
+ tns_data(ics1, &(ics1->tns), ld);
+ if (this_layer_stereo)
+ {
+ /* Stereo5 */
+ if (ics2->tns_data_present)
+ tns_data(ics2, &(ics2->tns), ld);
+ }
+
+#ifdef DRM
+ /* CRC check */
+ if (hDecoder->object_type == DRM_ER_LC)
+ {
+ if ((hInfo->error = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0)
+ return;
+ }
+#endif
+
+ /* Stereo6 / Mono3 */
+ /* error resilient spectral data decoding */
+ if ((hInfo->error = reordered_spectral_data(hDecoder, ics1, ld, spec_data1)) > 0)
+ {
+ return;
+ }
+ if (this_layer_stereo)
+ {
+ /* Stereo7 */
+ /* error resilient spectral data decoding */
+ if ((hInfo->error = reordered_spectral_data(hDecoder, ics2, ld, spec_data2)) > 0)
+ {
+ return;
+ }
+ }
+
+
+#ifdef DRM
+#ifdef SBR_DEC
+ /* In case of DRM we need to read the SBR info before channel reconstruction */
+ if ((hDecoder->sbr_present_flag == 1) && (hDecoder->object_type == DRM_ER_LC))
+ {
+ bitfile ld_sbr = {0};
+ uint32_t i;
+ uint16_t count = 0;
+ uint8_t *revbuffer;
+ uint8_t *prevbufstart;
+ uint8_t *pbufend;
+
+ /* all forward bitreading should be finished at this point */
+ uint32_t bitsconsumed = faad_get_processed_bits(ld);
+ uint32_t buffer_size = faad_origbitbuffer_size(ld);
+ uint8_t *buffer = (uint8_t*)faad_origbitbuffer(ld);
+
+ if (bitsconsumed + 8 > buffer_size*8)
+ {
+ hInfo->error = 14;
+ return;
+ }
+
+ if (!hDecoder->sbr[0])
+ {
+ hDecoder->sbr[0] = sbrDecodeInit(hDecoder->frameLength, hDecoder->element_id[0],
+ 2*get_sample_rate(hDecoder->sf_index), 0 /* ds SBR */, 1);
+ }
+
+ /* Reverse bit reading of SBR data in DRM audio frame */
+ revbuffer = (uint8_t*)faad_malloc(buffer_size*sizeof(uint8_t));
+ prevbufstart = revbuffer;
+ pbufend = &buffer[buffer_size - 1];
+ for (i = 0; i < buffer_size; i++)
+ *prevbufstart++ = tabFlipbits[*pbufend--];
+
+ /* Set SBR data */
+ /* consider 8 bits from AAC-CRC */
+ /* SBR buffer size is original buffer size minus AAC buffer size */
+ count = (uint16_t)bit2byte(buffer_size*8 - bitsconsumed);
+ faad_initbits(&ld_sbr, revbuffer, count);
+
+ hDecoder->sbr[0]->sample_rate = get_sample_rate(hDecoder->sf_index);
+ hDecoder->sbr[0]->sample_rate *= 2;
+
+ faad_getbits(&ld_sbr, 8); /* Skip 8-bit CRC */
+
+ hDecoder->sbr[0]->ret = sbr_extension_data(&ld_sbr, hDecoder->sbr[0], count);
+#if (defined(PS_DEC) || defined(DRM_PS))
+ if (hDecoder->sbr[0]->ps_used)
+ {
+ hDecoder->ps_used[0] = 1;
+ hDecoder->ps_used_global = 1;
+ }
+#endif
+
+ if (ld_sbr.error)
+ {
+ hDecoder->sbr[0]->ret = 1;
+ }
+
+ /* check CRC */
+ /* no need to check it if there was already an error */
+ if (hDecoder->sbr[0]->ret == 0)
+ hDecoder->sbr[0]->ret = (uint8_t)faad_check_CRC(&ld_sbr, (uint16_t)faad_get_processed_bits(&ld_sbr) - 8);
+
+ /* SBR data was corrupted, disable it until the next header */
+ if (hDecoder->sbr[0]->ret != 0)
+ {
+ hDecoder->sbr[0]->header_count = 0;
+ }
+
+ faad_endbits(&ld_sbr);
+
+ if (revbuffer)
+ faad_free(revbuffer);
+ }
+#endif
+#endif
+
+ if (this_layer_stereo)
+ {
+ hInfo->error = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, spec_data1, spec_data2);
+ if (hInfo->error > 0)
+ return;
+ } else {
+ hInfo->error = reconstruct_single_channel(hDecoder, ics1, &cpe, spec_data1);
+ if (hInfo->error > 0)
+ return;
+ }
+
+ /* map output channels position to internal data channels */
+ if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2)
+ {
+ /* this might be faulty when pce_set is true */
+ hDecoder->internal_channel[channels] = channels;
+ hDecoder->internal_channel[channels+1] = channels+1;
+ } else {
+ hDecoder->internal_channel[channels] = channels;
+ }
+
+ hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele];
+ hDecoder->fr_ch_ele++;
+
+ return;
+}
+
+/* Table 4.4.15 */
+static int8_t DRM_aac_scalable_main_header(NeAACDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
+ bitfile *ld, uint8_t this_layer_stereo)
+{
+ uint8_t retval = 0;
+ uint8_t ch;
+ ic_stream *ics;
+ uint8_t ics_reserved_bit;
+
+ ics_reserved_bit = faad_get1bit(ld
+ DEBUGVAR(1,300,"aac_scalable_main_header(): ics_reserved_bits"));
+ if (ics_reserved_bit != 0)
+ return 32;
+ ics1->window_sequence = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,301,"aac_scalable_main_header(): window_sequence"));
+ ics1->window_shape = faad_get1bit(ld
+ DEBUGVAR(1,302,"aac_scalable_main_header(): window_shape"));
+
+ if (ics1->window_sequence == EIGHT_SHORT_SEQUENCE)
+ {
+ ics1->max_sfb = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,303,"aac_scalable_main_header(): max_sfb (short)"));
+ ics1->scale_factor_grouping = (uint8_t)faad_getbits(ld, 7
+ DEBUGVAR(1,304,"aac_scalable_main_header(): scale_factor_grouping"));
+ } else {
+ ics1->max_sfb = (uint8_t)faad_getbits(ld, 6
+ DEBUGVAR(1,305,"aac_scalable_main_header(): max_sfb (long)"));
+ }
+
+ /* get the grouping information */
+ if ((retval = window_grouping_info(hDecoder, ics1)) > 0)
+ return retval;
+
+ /* should be an error */
+ /* check the range of max_sfb */
+ if (ics1->max_sfb > ics1->num_swb)
+ return 16;
+
+ if (this_layer_stereo)
+ {
+ ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,306,"aac_scalable_main_header(): ms_mask_present"));
+ if (ics1->ms_mask_present == 3)
+ {
+ /* bitstream error */
+ return 32;
+ }
+ if (ics1->ms_mask_present == 1)
+ {
+ uint8_t g, sfb;
+ for (g = 0; g < ics1->num_window_groups; g++)
+ {
+ for (sfb = 0; sfb < ics1->max_sfb; sfb++)
+ {
+ ics1->ms_used[g][sfb] = faad_get1bit(ld
+ DEBUGVAR(1,307,"aac_scalable_main_header(): faad_get1bit"));
+ }
+ }
+ }
+
+ memcpy(ics2, ics1, sizeof(ic_stream));
+ } else {
+ ics1->ms_mask_present = 0;
+ }
+
+ return 0;
+}
+#endif
+
+static uint8_t side_info(NeAACDecHandle hDecoder, element *ele,
+ bitfile *ld, ic_stream *ics, uint8_t scal_flag)
+{
+ uint8_t result;
+
+ ics->global_gain = (uint8_t)faad_getbits(ld, 8
+ DEBUGVAR(1,67,"individual_channel_stream(): global_gain"));
+
+ if (!ele->common_window && !scal_flag)
+ {
+ if ((result = ics_info(hDecoder, ics, ld, ele->common_window)) > 0)
+ return result;
+ }
+
+ if ((result = section_data(hDecoder, ics, ld)) > 0)
+ return result;
+
+ if ((result = scale_factor_data(hDecoder, ics, ld)) > 0)
+ return result;
+
+ if (!scal_flag)
+ {
+ /**
+ ** NOTE: It could be that pulse data is available in scalable AAC too,
+ ** as said in Amendment 1, this could be only the case for ER AAC,
+ ** though. (have to check this out later)
+ **/
+ /* get pulse data */
+ if ((ics->pulse_data_present = faad_get1bit(ld
+ DEBUGVAR(1,68,"individual_channel_stream(): pulse_data_present"))) & 1)
+ {
+ if ((result = pulse_data(ics, &(ics->pul), ld)) > 0)
+ return result;
+ }
+
+ /* get tns data */
+ if ((ics->tns_data_present = faad_get1bit(ld
+ DEBUGVAR(1,69,"individual_channel_stream(): tns_data_present"))) & 1)
+ {
+#ifdef ERROR_RESILIENCE
+ if (hDecoder->object_type < ER_OBJECT_START)
+#endif
+ tns_data(ics, &(ics->tns), ld);
+ }
+
+ /* get gain control data */
+ if ((ics->gain_control_data_present = faad_get1bit(ld
+ DEBUGVAR(1,70,"individual_channel_stream(): gain_control_data_present"))) & 1)
+ {
+#ifdef SSR_DEC
+ if (hDecoder->object_type != SSR)
+ return 1;
+ else
+ gain_control_data(ld, ics);
+#else
+ return 1;
+#endif
+ }
+ }
+
+#ifdef ERROR_RESILIENCE
+ if (hDecoder->aacSpectralDataResilienceFlag)
+ {
+ ics->length_of_reordered_spectral_data = (uint16_t)faad_getbits(ld, 14
+ DEBUGVAR(1,147,"individual_channel_stream(): length_of_reordered_spectral_data"));
+
+ if (hDecoder->channelConfiguration == 2)
+ {
+ if (ics->length_of_reordered_spectral_data > 6144)
+ ics->length_of_reordered_spectral_data = 6144;
+ } else {
+ if (ics->length_of_reordered_spectral_data > 12288)
+ ics->length_of_reordered_spectral_data = 12288;
+ }
+
+ ics->length_of_longest_codeword = (uint8_t)faad_getbits(ld, 6
+ DEBUGVAR(1,148,"individual_channel_stream(): length_of_longest_codeword"));
+ if (ics->length_of_longest_codeword >= 49)
+ ics->length_of_longest_codeword = 49;
+ }
+
+ /* RVLC spectral data is put here */
+ if (hDecoder->aacScalefactorDataResilienceFlag)
+ {
+ if ((result = rvlc_decode_scale_factors(ics, ld)) > 0)
+ return result;
+ }
+#endif
+
+ return 0;
+}
+
+/* Table 4.4.24 */
+static uint8_t individual_channel_stream(NeAACDecHandle hDecoder, element *ele,
+ bitfile *ld, ic_stream *ics, uint8_t scal_flag,
+ int16_t *spec_data)
+{
+ uint8_t result;
+
+ result = side_info(hDecoder, ele, ld, ics, scal_flag);
+ if (result > 0)
+ return result;
+
+ if (hDecoder->object_type >= ER_OBJECT_START)
+ {
+ if (ics->tns_data_present)
+ tns_data(ics, &(ics->tns), ld);
+ }
+
+#ifdef DRM
+ /* CRC check */
+ if (hDecoder->object_type == DRM_ER_LC)
+ {
+ if ((result = (uint8_t)faad_check_CRC(ld, (uint16_t)faad_get_processed_bits(ld) - 8)) > 0)
+ return result;
+ }
+#endif
+
+#ifdef ERROR_RESILIENCE
+ if (hDecoder->aacSpectralDataResilienceFlag)
+ {
+ /* error resilient spectral data decoding */
+ if ((result = reordered_spectral_data(hDecoder, ics, ld, spec_data)) > 0)
+ {
+ return result;
+ }
+ } else {
+#endif
+ /* decode the spectral data */
+ if ((result = spectral_data(hDecoder, ics, ld, spec_data)) > 0)
+ {
+ return result;
+ }
+#ifdef ERROR_RESILIENCE
+ }
+#endif
+
+ /* pulse coding reconstruction */
+ if (ics->pulse_data_present)
+ {
+ if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
+ {
+ if ((result = pulse_decode(ics, spec_data, hDecoder->frameLength)) > 0)
+ return result;
+ } else {
+ return 2; /* pulse coding not allowed for short blocks */
+ }
+ }
+
+ return 0;
+}
+
+/* Table 4.4.25 */
+static uint8_t section_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld)
+{
+ uint8_t g;
+ uint8_t sect_esc_val, sect_bits;
+
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ sect_bits = 3;
+ else
+ sect_bits = 5;
+ sect_esc_val = (1<<sect_bits) - 1;
+
+#if 0
+ printf("\ntotal sfb %d\n", ics->max_sfb);
+ printf(" sect top cb\n");
+#endif
+
+ for (g = 0; g < ics->num_window_groups; g++)
+ {
+ uint8_t k = 0;
+ uint8_t i = 0;
+
+ while (k < ics->max_sfb)
+ {
+#ifdef ERROR_RESILIENCE
+ uint8_t vcb11 = 0;
+#endif
+ uint8_t sfb;
+ uint8_t sect_len_incr;
+ uint16_t sect_len = 0;
+ uint8_t sect_cb_bits = 4;
+
+ /* if "faad_getbits" detects error and returns "0", "k" is never
+ incremented and we cannot leave the while loop */
+ if ((ld->error != 0) || (ld->no_more_reading))
+ return 14;
+
+#ifdef ERROR_RESILIENCE
+ if (hDecoder->aacSectionDataResilienceFlag)
+ sect_cb_bits = 5;
+#endif
+
+ ics->sect_cb[g][i] = (uint8_t)faad_getbits(ld, sect_cb_bits
+ DEBUGVAR(1,71,"section_data(): sect_cb"));
+
+ if (ics->sect_cb[g][i] == 12)
+ return 32;
+
+#if 0
+ printf("%d\n", ics->sect_cb[g][i]);
+#endif
+
+#ifndef DRM
+ if (ics->sect_cb[g][i] == NOISE_HCB)
+ ics->noise_used = 1;
+#else
+ /* PNS not allowed in DRM */
+ if (ics->sect_cb[g][i] == NOISE_HCB)
+ return 29;
+#endif
+ if (ics->sect_cb[g][i] == INTENSITY_HCB2 || ics->sect_cb[g][i] == INTENSITY_HCB)
+ ics->is_used = 1;
+
+#ifdef ERROR_RESILIENCE
+ if (hDecoder->aacSectionDataResilienceFlag)
+ {
+ if ((ics->sect_cb[g][i] == 11) ||
+ ((ics->sect_cb[g][i] >= 16) && (ics->sect_cb[g][i] <= 32)))
+ {
+ vcb11 = 1;
+ }
+ }
+ if (vcb11)
+ {
+ sect_len_incr = 1;
+ } else {
+#endif
+ sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits
+ DEBUGVAR(1,72,"section_data(): sect_len_incr"));
+#ifdef ERROR_RESILIENCE
+ }
+#endif
+ while ((sect_len_incr == sect_esc_val) /* &&
+ (k+sect_len < ics->max_sfb)*/)
+ {
+ sect_len += sect_len_incr;
+ sect_len_incr = (uint8_t)faad_getbits(ld, sect_bits
+ DEBUGVAR(1,72,"section_data(): sect_len_incr"));
+ }
+
+ sect_len += sect_len_incr;
+
+ ics->sect_start[g][i] = k;
+ ics->sect_end[g][i] = k + sect_len;
+
+#if 0
+ printf("%d\n", ics->sect_start[g][i]);
+#endif
+#if 0
+ printf("%d\n", ics->sect_end[g][i]);
+#endif
+
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ {
+ if (k + sect_len >= 8*15)
+ return 15;
+ if (i >= 8*15)
+ return 15;
+ } else {
+ if (k + sect_len >= MAX_SFB)
+ return 15;
+ if (i >= MAX_SFB)
+ return 15;
+ }
+
+ for (sfb = k; sfb < k + sect_len; sfb++)
+ {
+ ics->sfb_cb[g][sfb] = ics->sect_cb[g][i];
+#if 0
+ printf("%d\n", ics->sfb_cb[g][sfb]);
+#endif
+ }
+
+#if 0
+ printf(" %6d %6d %6d\n",
+ i,
+ ics->sect_end[g][i],
+ ics->sect_cb[g][i]);
+#endif
+
+ k += sect_len;
+ i++;
+ }
+ ics->num_sec[g] = i;
+
+ /* the sum of all sect_len_incr elements for a given window
+ * group shall equal max_sfb */
+ if (k != ics->max_sfb)
+ {
+ return 32;
+ }
+#if 0
+ printf("%d\n", ics->num_sec[g]);
+#endif
+ }
+
+#if 0
+ printf("\n");
+#endif
+
+ return 0;
+}
+
+/*
+ * decode_scale_factors()
+ * decodes the scalefactors from the bitstream
+ */
+/*
+ * All scalefactors (and also the stereo positions and pns energies) are
+ * transmitted using Huffman coded DPCM relative to the previous active
+ * scalefactor (respectively previous stereo position or previous pns energy,
+ * see subclause 4.6.2 and 4.6.3). The first active scalefactor is
+ * differentially coded relative to the global gain.
+ */
+static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld)
+{
+ uint8_t g, sfb;
+ int16_t t;
+ int8_t noise_pcm_flag = 1;
+
+ int16_t scale_factor = ics->global_gain;
+ int16_t is_position = 0;
+ int16_t noise_energy = ics->global_gain - 90;
+
+ for (g = 0; g < ics->num_window_groups; g++)
+ {
+ for (sfb = 0; sfb < ics->max_sfb; sfb++)
+ {
+ switch (ics->sfb_cb[g][sfb])
+ {
+ case ZERO_HCB: /* zero book */
+ ics->scale_factors[g][sfb] = 0;
+//#define SF_PRINT
+#ifdef SF_PRINT
+ printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
+ break;
+ case INTENSITY_HCB: /* intensity books */
+ case INTENSITY_HCB2:
+
+ /* decode intensity position */
+ t = huffman_scale_factor(ld);
+ is_position += (t - 60);
+ ics->scale_factors[g][sfb] = is_position;
+#ifdef SF_PRINT
+ printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
+
+ break;
+ case NOISE_HCB: /* noise books */
+
+#ifndef DRM
+ /* decode noise energy */
+ if (noise_pcm_flag)
+ {
+ noise_pcm_flag = 0;
+ t = (int16_t)faad_getbits(ld, 9
+ DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256;
+ } else {
+ t = huffman_scale_factor(ld);
+ t -= 60;
+ }
+ noise_energy += t;
+ ics->scale_factors[g][sfb] = noise_energy;
+#ifdef SF_PRINT
+ printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
+#else
+ /* PNS not allowed in DRM */
+ return 29;
+#endif
+
+ break;
+ default: /* spectral books */
+
+ /* ics->scale_factors[g][sfb] must be between 0 and 255 */
+
+ ics->scale_factors[g][sfb] = 0;
+
+ /* decode scale factor */
+ t = huffman_scale_factor(ld);
+ scale_factor += (t - 60);
+ if (scale_factor < 0 || scale_factor > 255)
+ return 4;
+ ics->scale_factors[g][sfb] = scale_factor;
+#ifdef SF_PRINT
+ printf("%d\n", ics->scale_factors[g][sfb]);
+#endif
+
+ break;
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* Table 4.4.26 */
+static uint8_t scale_factor_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld)
+{
+ uint8_t ret = 0;
+#ifdef PROFILE
+ int64_t count = faad_get_ts();
+#endif
+
+#ifdef ERROR_RESILIENCE
+ if (!hDecoder->aacScalefactorDataResilienceFlag)
+ {
+#endif
+ ret = decode_scale_factors(ics, ld);
+#ifdef ERROR_RESILIENCE
+ } else {
+ /* In ER AAC the parameters for RVLC are seperated from the actual
+ data that holds the scale_factors.
+ Strangely enough, 2 parameters for HCR are put inbetween them.
+ */
+ ret = rvlc_scale_factor_data(ics, ld);
+ }
+#endif
+
+#ifdef PROFILE
+ count = faad_get_ts() - count;
+ hDecoder->scalefac_cycles += count;
+#endif
+
+ return ret;
+}
+
+/* Table 4.4.27 */
+static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld)
+{
+ uint8_t w, filt, i, start_coef_bits, coef_bits;
+ uint8_t n_filt_bits = 2;
+ uint8_t length_bits = 6;
+ uint8_t order_bits = 5;
+
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ {
+ n_filt_bits = 1;
+ length_bits = 4;
+ order_bits = 3;
+ }
+
+ for (w = 0; w < ics->num_windows; w++)
+ {
+ tns->n_filt[w] = (uint8_t)faad_getbits(ld, n_filt_bits
+ DEBUGVAR(1,74,"tns_data(): n_filt"));
+#if 0
+ printf("%d\n", tns->n_filt[w]);
+#endif
+
+ if (tns->n_filt[w])
+ {
+ if ((tns->coef_res[w] = faad_get1bit(ld
+ DEBUGVAR(1,75,"tns_data(): coef_res"))) & 1)
+ {
+ start_coef_bits = 4;
+ } else {
+ start_coef_bits = 3;
+ }
+#if 0
+ printf("%d\n", tns->coef_res[w]);
+#endif
+ }
+
+ for (filt = 0; filt < tns->n_filt[w]; filt++)
+ {
+ tns->length[w][filt] = (uint8_t)faad_getbits(ld, length_bits
+ DEBUGVAR(1,76,"tns_data(): length"));
+#if 0
+ printf("%d\n", tns->length[w][filt]);
+#endif
+ tns->order[w][filt] = (uint8_t)faad_getbits(ld, order_bits
+ DEBUGVAR(1,77,"tns_data(): order"));
+#if 0
+ printf("%d\n", tns->order[w][filt]);
+#endif
+ if (tns->order[w][filt])
+ {
+ tns->direction[w][filt] = faad_get1bit(ld
+ DEBUGVAR(1,78,"tns_data(): direction"));
+#if 0
+ printf("%d\n", tns->direction[w][filt]);
+#endif
+ tns->coef_compress[w][filt] = faad_get1bit(ld
+ DEBUGVAR(1,79,"tns_data(): coef_compress"));
+#if 0
+ printf("%d\n", tns->coef_compress[w][filt]);
+#endif
+
+ coef_bits = start_coef_bits - tns->coef_compress[w][filt];
+ for (i = 0; i < tns->order[w][filt]; i++)
+ {
+ tns->coef[w][filt][i] = (uint8_t)faad_getbits(ld, coef_bits
+ DEBUGVAR(1,80,"tns_data(): coef"));
+#if 0
+ printf("%d\n", tns->coef[w][filt][i]);
+#endif
+ }
+ }
+ }
+ }
+}
+
+#ifdef LTP_DEC
+/* Table 4.4.28 */
+static uint8_t ltp_data(NeAACDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld)
+{
+ uint8_t sfb, w;
+
+ ltp->lag = 0;
+
+#ifdef LD_DEC
+ if (hDecoder->object_type == LD)
+ {
+ ltp->lag_update = (uint8_t)faad_getbits(ld, 1
+ DEBUGVAR(1,142,"ltp_data(): lag_update"));
+
+ if (ltp->lag_update)
+ {
+ ltp->lag = (uint16_t)faad_getbits(ld, 10
+ DEBUGVAR(1,81,"ltp_data(): lag"));
+ }
+ } else {
+#endif
+ ltp->lag = (uint16_t)faad_getbits(ld, 11
+ DEBUGVAR(1,81,"ltp_data(): lag"));
+#ifdef LD_DEC
+ }
+#endif
+
+ /* Check length of lag */
+ if (ltp->lag > (hDecoder->frameLength << 1))
+ return 18;
+
+ ltp->coef = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,82,"ltp_data(): coef"));
+
+ if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
+ {
+ for (w = 0; w < ics->num_windows; w++)
+ {
+ if ((ltp->short_used[w] = faad_get1bit(ld
+ DEBUGVAR(1,83,"ltp_data(): short_used"))) & 1)
+ {
+ ltp->short_lag_present[w] = faad_get1bit(ld
+ DEBUGVAR(1,84,"ltp_data(): short_lag_present"));
+ if (ltp->short_lag_present[w])
+ {
+ ltp->short_lag[w] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,85,"ltp_data(): short_lag"));
+ }
+ }
+ }
+ } else {
+ ltp->last_band = (ics->max_sfb < MAX_LTP_SFB ? ics->max_sfb : MAX_LTP_SFB);
+
+ for (sfb = 0; sfb < ltp->last_band; sfb++)
+ {
+ ltp->long_used[sfb] = faad_get1bit(ld
+ DEBUGVAR(1,86,"ltp_data(): long_used"));
+ }
+ }
+
+ return 0;
+}
+#endif
+
+/* Table 4.4.29 */
+static uint8_t spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+ int16_t *spectral_data)
+{
+ int8_t i;
+ uint8_t g;
+ uint16_t inc, k, p = 0;
+ uint8_t groups = 0;
+ uint8_t sect_cb;
+ uint8_t result;
+ uint16_t nshort = hDecoder->frameLength/8;
+
+#ifdef PROFILE
+ int64_t count = faad_get_ts();
+#endif
+
+ for(g = 0; g < ics->num_window_groups; g++)
+ {
+ p = groups*nshort;
+
+ for (i = 0; i < ics->num_sec[g]; i++)
+ {
+ sect_cb = ics->sect_cb[g][i];
+
+ inc = (sect_cb >= FIRST_PAIR_HCB) ? 2 : 4;
+
+ switch (sect_cb)
+ {
+ case ZERO_HCB:
+ case NOISE_HCB:
+ case INTENSITY_HCB:
+ case INTENSITY_HCB2:
+//#define SD_PRINT
+#ifdef SD_PRINT
+ {
+ int j;
+ for (j = ics->sect_sfb_offset[g][ics->sect_start[g][i]]; j < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; j++)
+ {
+ printf("%d\n", 0);
+ }
+ }
+#endif
+//#define SFBO_PRINT
+#ifdef SFBO_PRINT
+ printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
+#endif
+ p += (ics->sect_sfb_offset[g][ics->sect_end[g][i]] -
+ ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
+ break;
+ default:
+#ifdef SFBO_PRINT
+ printf("%d\n", ics->sect_sfb_offset[g][ics->sect_start[g][i]]);
+#endif
+ for (k = ics->sect_sfb_offset[g][ics->sect_start[g][i]];
+ k < ics->sect_sfb_offset[g][ics->sect_end[g][i]]; k += inc)
+ {
+ if ((result = huffman_spectral_data(sect_cb, ld, &spectral_data[p])) > 0)
+ return result;
+#ifdef SD_PRINT
+ {
+ int j;
+ for (j = p; j < p+inc; j++)
+ {
+ printf("%d\n", spectral_data[j]);
+ }
+ }
+#endif
+ p += inc;
+ }
+ break;
+ }
+ }
+ groups += ics->window_group_length[g];
+ }
+
+#ifdef PROFILE
+ count = faad_get_ts() - count;
+ hDecoder->spectral_cycles += count;
+#endif
+
+ return 0;
+}
+
+/* Table 4.4.30 */
+static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count)
+{
+ uint16_t i, n, dataElementLength;
+ uint8_t dataElementLengthPart;
+ uint8_t align = 4, data_element_version, loopCounter;
+
+ uint8_t extension_type = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,87,"extension_payload(): extension_type"));
+
+ switch (extension_type)
+ {
+ case EXT_DYNAMIC_RANGE:
+ drc->present = 1;
+ n = dynamic_range_info(ld, drc);
+ return n;
+ case EXT_FILL_DATA:
+ /* fill_nibble = */ faad_getbits(ld, 4
+ DEBUGVAR(1,136,"extension_payload(): fill_nibble")); /* must be ‘0000’ */
+ for (i = 0; i < count-1; i++)
+ {
+ /* fill_byte[i] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,88,"extension_payload(): fill_byte")); /* must be ‘10100101’ */
+ }
+ return count;
+ case EXT_DATA_ELEMENT:
+ data_element_version = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,400,"extension_payload(): data_element_version"));
+ switch (data_element_version)
+ {
+ case ANC_DATA:
+ loopCounter = 0;
+ dataElementLength = 0;
+ do {
+ dataElementLengthPart = (uint8_t)faad_getbits(ld, 8
+ DEBUGVAR(1,401,"extension_payload(): dataElementLengthPart"));
+ dataElementLength += dataElementLengthPart;
+ loopCounter++;
+ } while (dataElementLengthPart == 255);
+
+ for (i = 0; i < dataElementLength; i++)
+ {
+ /* data_element_byte[i] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,402,"extension_payload(): data_element_byte"));
+ return (dataElementLength+loopCounter+1);
+ }
+ default:
+ align = 0;
+ }
+ case EXT_FIL:
+ default:
+ faad_getbits(ld, align
+ DEBUGVAR(1,88,"extension_payload(): fill_nibble"));
+ for (i = 0; i < count-1; i++)
+ {
+ /* other_bits[i] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,89,"extension_payload(): fill_bit"));
+ }
+ return count;
+ }
+}
+
+/* Table 4.4.31 */
+static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc)
+{
+ uint8_t i, n = 1;
+ uint8_t band_incr;
+
+ drc->num_bands = 1;
+
+ if (faad_get1bit(ld
+ DEBUGVAR(1,90,"dynamic_range_info(): has instance_tag")) & 1)
+ {
+ drc->pce_instance_tag = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,91,"dynamic_range_info(): pce_instance_tag"));
+ /* drc->drc_tag_reserved_bits = */ faad_getbits(ld, 4
+ DEBUGVAR(1,92,"dynamic_range_info(): drc_tag_reserved_bits"));
+ n++;
+ }
+
+ drc->excluded_chns_present = faad_get1bit(ld
+ DEBUGVAR(1,93,"dynamic_range_info(): excluded_chns_present"));
+ if (drc->excluded_chns_present == 1)
+ {
+ n += excluded_channels(ld, drc);
+ }
+
+ if (faad_get1bit(ld
+ DEBUGVAR(1,94,"dynamic_range_info(): has bands data")) & 1)
+ {
+ band_incr = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,95,"dynamic_range_info(): band_incr"));
+ /* drc->drc_bands_reserved_bits = */ faad_getbits(ld, 4
+ DEBUGVAR(1,96,"dynamic_range_info(): drc_bands_reserved_bits"));
+ n++;
+ drc->num_bands += band_incr;
+
+ for (i = 0; i < drc->num_bands; i++);
+ {
+ drc->band_top[i] = (uint8_t)faad_getbits(ld, 8
+ DEBUGVAR(1,97,"dynamic_range_info(): band_top"));
+ n++;
+ }
+ }
+
+ if (faad_get1bit(ld
+ DEBUGVAR(1,98,"dynamic_range_info(): has prog_ref_level")) & 1)
+ {
+ drc->prog_ref_level = (uint8_t)faad_getbits(ld, 7
+ DEBUGVAR(1,99,"dynamic_range_info(): prog_ref_level"));
+ /* drc->prog_ref_level_reserved_bits = */ faad_get1bit(ld
+ DEBUGVAR(1,100,"dynamic_range_info(): prog_ref_level_reserved_bits"));
+ n++;
+ }
+
+ for (i = 0; i < drc->num_bands; i++)
+ {
+ drc->dyn_rng_sgn[i] = faad_get1bit(ld
+ DEBUGVAR(1,101,"dynamic_range_info(): dyn_rng_sgn"));
+ drc->dyn_rng_ctl[i] = (uint8_t)faad_getbits(ld, 7
+ DEBUGVAR(1,102,"dynamic_range_info(): dyn_rng_ctl"));
+ n++;
+ }
+
+ return n;
+}
+
+/* Table 4.4.32 */
+static uint8_t excluded_channels(bitfile *ld, drc_info *drc)
+{
+ uint8_t i, n = 0;
+ uint8_t num_excl_chan = 7;
+
+ for (i = 0; i < 7; i++)
+ {
+ drc->exclude_mask[i] = faad_get1bit(ld
+ DEBUGVAR(1,103,"excluded_channels(): exclude_mask"));
+ }
+ n++;
+
+ while ((drc->additional_excluded_chns[n-1] = faad_get1bit(ld
+ DEBUGVAR(1,104,"excluded_channels(): additional_excluded_chns"))) == 1)
+ {
+ for (i = num_excl_chan; i < num_excl_chan+7; i++)
+ {
+ drc->exclude_mask[i] = faad_get1bit(ld
+ DEBUGVAR(1,105,"excluded_channels(): exclude_mask"));
+ }
+ n++;
+ num_excl_chan += 7;
+ }
+
+ return n;
+}
+
+/* Annex A: Audio Interchange Formats */
+
+/* Table 1.A.2 */
+void get_adif_header(adif_header *adif, bitfile *ld)
+{
+ uint8_t i;
+
+ /* adif_id[0] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,106,"get_adif_header(): adif_id[0]"));
+ /* adif_id[1] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,107,"get_adif_header(): adif_id[1]"));
+ /* adif_id[2] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,108,"get_adif_header(): adif_id[2]"));
+ /* adif_id[3] = */ faad_getbits(ld, 8
+ DEBUGVAR(1,109,"get_adif_header(): adif_id[3]"));
+ adif->copyright_id_present = faad_get1bit(ld
+ DEBUGVAR(1,110,"get_adif_header(): copyright_id_present"));
+ if(adif->copyright_id_present)
+ {
+ for (i = 0; i < 72/8; i++)
+ {
+ adif->copyright_id[i] = (int8_t)faad_getbits(ld, 8
+ DEBUGVAR(1,111,"get_adif_header(): copyright_id"));
+ }
+ adif->copyright_id[i] = 0;
+ }
+ adif->original_copy = faad_get1bit(ld
+ DEBUGVAR(1,112,"get_adif_header(): original_copy"));
+ adif->home = faad_get1bit(ld
+ DEBUGVAR(1,113,"get_adif_header(): home"));
+ adif->bitstream_type = faad_get1bit(ld
+ DEBUGVAR(1,114,"get_adif_header(): bitstream_type"));
+ adif->bitrate = faad_getbits(ld, 23
+ DEBUGVAR(1,115,"get_adif_header(): bitrate"));
+ adif->num_program_config_elements = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,116,"get_adif_header(): num_program_config_elements"));
+
+ for (i = 0; i < adif->num_program_config_elements + 1; i++)
+ {
+ if(adif->bitstream_type == 0)
+ {
+ adif->adif_buffer_fullness = faad_getbits(ld, 20
+ DEBUGVAR(1,117,"get_adif_header(): adif_buffer_fullness"));
+ } else {
+ adif->adif_buffer_fullness = 0;
+ }
+
+ program_config_element(&adif->pce[i], ld);
+ }
+}
+
+/* Table 1.A.5 */
+uint8_t adts_frame(adts_header *adts, bitfile *ld)
+{
+ /* faad_byte_align(ld); */
+ if (adts_fixed_header(adts, ld))
+ return 5;
+ adts_variable_header(adts, ld);
+ adts_error_check(adts, ld);
+
+ return 0;
+}
+
+/* Table 1.A.6 */
+static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld)
+{
+ uint16_t i;
+ uint8_t sync_err = 1;
+
+ /* try to recover from sync errors */
+ for (i = 0; i < 768; i++)
+ {
+ adts->syncword = (uint16_t)faad_showbits(ld, 12);
+ if (adts->syncword != 0xFFF)
+ {
+ faad_getbits(ld, 8
+ DEBUGVAR(0,0,""));
+ } else {
+ sync_err = 0;
+ faad_getbits(ld, 12
+ DEBUGVAR(1,118,"adts_fixed_header(): syncword"));
+ break;
+ }
+ }
+ if (sync_err)
+ return 5;
+
+ adts->id = faad_get1bit(ld
+ DEBUGVAR(1,119,"adts_fixed_header(): id"));
+ adts->layer = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,120,"adts_fixed_header(): layer"));
+ adts->protection_absent = faad_get1bit(ld
+ DEBUGVAR(1,121,"adts_fixed_header(): protection_absent"));
+ adts->profile = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,122,"adts_fixed_header(): profile"));
+ adts->sf_index = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,123,"adts_fixed_header(): sf_index"));
+ adts->private_bit = faad_get1bit(ld
+ DEBUGVAR(1,124,"adts_fixed_header(): private_bit"));
+ adts->channel_configuration = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,125,"adts_fixed_header(): channel_configuration"));
+ adts->original = faad_get1bit(ld
+ DEBUGVAR(1,126,"adts_fixed_header(): original"));
+ adts->home = faad_get1bit(ld
+ DEBUGVAR(1,127,"adts_fixed_header(): home"));
+
+ if (adts->old_format == 1)
+ {
+ /* Removed in corrigendum 14496-3:2002 */
+ if (adts->id == 0)
+ {
+ adts->emphasis = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,128,"adts_fixed_header(): emphasis"));
+ }
+ }
+
+ return 0;
+}
+
+/* Table 1.A.7 */
+static void adts_variable_header(adts_header *adts, bitfile *ld)
+{
+ adts->copyright_identification_bit = faad_get1bit(ld
+ DEBUGVAR(1,129,"adts_variable_header(): copyright_identification_bit"));
+ adts->copyright_identification_start = faad_get1bit(ld
+ DEBUGVAR(1,130,"adts_variable_header(): copyright_identification_start"));
+ adts->aac_frame_length = (uint16_t)faad_getbits(ld, 13
+ DEBUGVAR(1,131,"adts_variable_header(): aac_frame_length"));
+ adts->adts_buffer_fullness = (uint16_t)faad_getbits(ld, 11
+ DEBUGVAR(1,132,"adts_variable_header(): adts_buffer_fullness"));
+ adts->no_raw_data_blocks_in_frame = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,133,"adts_variable_header(): no_raw_data_blocks_in_frame"));
+}
+
+/* Table 1.A.8 */
+static void adts_error_check(adts_header *adts, bitfile *ld)
+{
+ if (adts->protection_absent == 0)
+ {
+ adts->crc_check = (uint16_t)faad_getbits(ld, 16
+ DEBUGVAR(1,134,"adts_error_check(): crc_check"));
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/syntax.h b/src/filters/transform/mpadecfilter/faad2/libfaad/syntax.h
new file mode 100644
index 000000000..87947a5ba
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/syntax.h
@@ -0,0 +1,130 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: syntax.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __SYNTAX_H__
+#define __SYNTAX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "decoder.h"
+#include "bits.h"
+
+#define MAIN 1
+#define LC 2
+#define SSR 3
+#define LTP 4
+#define HE_AAC 5
+#define LD 23
+#define ER_LC 17
+#define ER_LTP 19
+#define DRM_ER_LC 27 /* special object type for DRM */
+
+/* header types */
+#define RAW 0
+#define ADIF 1
+#define ADTS 2
+
+/* SBR signalling */
+#define NO_SBR 0
+#define SBR_UPSAMPLED 1
+#define SBR_DOWNSAMPLED 2
+#define NO_SBR_UPSAMPLED 3
+
+/* DRM channel definitions */
+#define DRMCH_MONO 1
+#define DRMCH_STEREO 2
+#define DRMCH_SBR_MONO 3
+#define DRMCH_SBR_STEREO 4
+#define DRMCH_SBR_PS_STEREO 5
+
+
+/* First object type that has ER */
+#define ER_OBJECT_START 17
+
+
+/* Bitstream */
+#define LEN_SE_ID 3
+#define LEN_TAG 4
+#define LEN_BYTE 8
+
+#define EXT_FIL 0
+#define EXT_FILL_DATA 1
+#define EXT_DATA_ELEMENT 2
+#define EXT_DYNAMIC_RANGE 11
+#define ANC_DATA 0
+
+/* Syntax elements */
+#define ID_SCE 0x0
+#define ID_CPE 0x1
+#define ID_CCE 0x2
+#define ID_LFE 0x3
+#define ID_DSE 0x4
+#define ID_PCE 0x5
+#define ID_FIL 0x6
+#define ID_END 0x7
+
+#define ONLY_LONG_SEQUENCE 0x0
+#define LONG_START_SEQUENCE 0x1
+#define EIGHT_SHORT_SEQUENCE 0x2
+#define LONG_STOP_SEQUENCE 0x3
+
+#define ZERO_HCB 0
+#define FIRST_PAIR_HCB 5
+#define ESC_HCB 11
+#define QUAD_LEN 4
+#define PAIR_LEN 2
+#define NOISE_HCB 13
+#define INTENSITY_HCB2 14
+#define INTENSITY_HCB 15
+
+#define INVALID_SBR_ELEMENT 255
+
+int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
+ program_config *pce);
+
+uint8_t adts_frame(adts_header *adts, bitfile *ld);
+void get_adif_header(adif_header *adif, bitfile *ld);
+void raw_data_block(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+ bitfile *ld, program_config *pce, drc_info *drc);
+uint8_t reordered_spectral_data(NeAACDecHandle hDecoder, ic_stream *ics, bitfile *ld,
+ int16_t *spectral_data);
+#ifdef DRM
+void DRM_aac_scalable_main_element(NeAACDecHandle hDecoder, NeAACDecFrameInfo *hInfo,
+ bitfile *ld, program_config *pce, drc_info *drc);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/tns.c b/src/filters/transform/mpadecfilter/faad2/libfaad/tns.c
new file mode 100644
index 000000000..9cfbcbcf7
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/tns.c
@@ -0,0 +1,311 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: tns.c 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#include "common.h"
+#include "structs.h"
+
+#include "syntax.h"
+#include "tns.h"
+
+
+/* static function declarations */
+static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress,
+ uint8_t *coef, real_t *a);
+static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+ uint8_t order);
+static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+ uint8_t order);
+
+
+#ifdef _MSC_VER
+#pragma warning(disable:4305)
+#pragma warning(disable:4244)
+#endif
+static real_t tns_coef_0_3[] =
+{
+ COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(0.7818314825), COEF_CONST(0.9749279122),
+ COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433),
+ COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.9749279122), COEF_CONST(-0.9749279122),
+ COEF_CONST(-0.9848077530), COEF_CONST(-0.8660254038), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433)
+};
+static real_t tns_coef_0_4[] =
+{
+ COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523),
+ COEF_CONST(0.7431448255), COEF_CONST(0.8660254038), COEF_CONST(0.9510565163), COEF_CONST(0.9945218954),
+ COEF_CONST(-0.9957341763), COEF_CONST(-0.9618256432), COEF_CONST(-0.8951632914), COEF_CONST(-0.7980172273),
+ COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178)
+};
+static real_t tns_coef_1_3[] =
+{
+ COEF_CONST(0.0), COEF_CONST(0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433),
+ COEF_CONST(0.9749279122), COEF_CONST(0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433),
+ COEF_CONST(-0.4338837391), COEF_CONST(-0.7818314825), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433),
+ COEF_CONST(-0.7818314825), COEF_CONST(-0.4338837391), COEF_CONST(-0.6427876097), COEF_CONST(-0.3420201433)
+};
+static real_t tns_coef_1_4[] =
+{
+ COEF_CONST(0.0), COEF_CONST(0.2079116908), COEF_CONST(0.4067366431), COEF_CONST(0.5877852523),
+ COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178),
+ COEF_CONST(0.9945218954), COEF_CONST(0.9510565163), COEF_CONST(0.8660254038), COEF_CONST(0.7431448255),
+ COEF_CONST(-0.6736956436), COEF_CONST(-0.5264321629), COEF_CONST(-0.3612416662), COEF_CONST(-0.1837495178)
+};
+
+
+/* TNS decoding for one channel and frame */
+void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+ uint8_t object_type, real_t *spec, uint16_t frame_len)
+{
+ uint8_t w, f, tns_order;
+ int8_t inc;
+ int16_t size;
+ uint16_t bottom, top, start, end;
+ uint16_t nshort = frame_len/8;
+ real_t lpc[TNS_MAX_ORDER+1];
+
+ if (!ics->tns_data_present)
+ return;
+
+ for (w = 0; w < ics->num_windows; w++)
+ {
+ bottom = ics->num_swb;
+
+ for (f = 0; f < tns->n_filt[w]; f++)
+ {
+ top = bottom;
+ bottom = max(top - tns->length[w][f], 0);
+ tns_order = min(tns->order[w][f], TNS_MAX_ORDER);
+ if (!tns_order)
+ continue;
+
+ tns_decode_coef(tns_order, tns->coef_res[w]+3,
+ tns->coef_compress[w][f], tns->coef[w][f], lpc);
+
+ start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
+ start = min(start, ics->max_sfb);
+ start = ics->swb_offset[start];
+
+ end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
+ end = min(end, ics->max_sfb);
+ end = ics->swb_offset[end];
+
+ size = end - start;
+ if (size <= 0)
+ continue;
+
+ if (tns->direction[w][f])
+ {
+ inc = -1;
+ start = end - 1;
+ } else {
+ inc = 1;
+ }
+
+ tns_ar_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order);
+ }
+ }
+}
+
+/* TNS encoding for one channel and frame */
+void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+ uint8_t object_type, real_t *spec, uint16_t frame_len)
+{
+ uint8_t w, f, tns_order;
+ int8_t inc;
+ int16_t size;
+ uint16_t bottom, top, start, end;
+ uint16_t nshort = frame_len/8;
+ real_t lpc[TNS_MAX_ORDER+1];
+
+ if (!ics->tns_data_present)
+ return;
+
+ for (w = 0; w < ics->num_windows; w++)
+ {
+ bottom = ics->num_swb;
+
+ for (f = 0; f < tns->n_filt[w]; f++)
+ {
+ top = bottom;
+ bottom = max(top - tns->length[w][f], 0);
+ tns_order = min(tns->order[w][f], TNS_MAX_ORDER);
+ if (!tns_order)
+ continue;
+
+ tns_decode_coef(tns_order, tns->coef_res[w]+3,
+ tns->coef_compress[w][f], tns->coef[w][f], lpc);
+
+ start = min(bottom, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
+ start = min(start, ics->max_sfb);
+ start = ics->swb_offset[start];
+
+ end = min(top, max_tns_sfb(sr_index, object_type, (ics->window_sequence == EIGHT_SHORT_SEQUENCE)));
+ end = min(end, ics->max_sfb);
+ end = ics->swb_offset[end];
+
+ size = end - start;
+ if (size <= 0)
+ continue;
+
+ if (tns->direction[w][f])
+ {
+ inc = -1;
+ start = end - 1;
+ } else {
+ inc = 1;
+ }
+
+ tns_ma_filter(&spec[(w*nshort)+start], size, inc, lpc, tns_order);
+ }
+ }
+}
+
+/* Decoder transmitted coefficients for one TNS filter */
+static void tns_decode_coef(uint8_t order, uint8_t coef_res_bits, uint8_t coef_compress,
+ uint8_t *coef, real_t *a)
+{
+ uint8_t i, m;
+ real_t tmp2[TNS_MAX_ORDER+1], b[TNS_MAX_ORDER+1];
+
+ /* Conversion to signed integer */
+ for (i = 0; i < order; i++)
+ {
+ if (coef_compress == 0)
+ {
+ if (coef_res_bits == 3)
+ {
+ tmp2[i] = tns_coef_0_3[coef[i]];
+ } else {
+ tmp2[i] = tns_coef_0_4[coef[i]];
+ }
+ } else {
+ if (coef_res_bits == 3)
+ {
+ tmp2[i] = tns_coef_1_3[coef[i]];
+ } else {
+ tmp2[i] = tns_coef_1_4[coef[i]];
+ }
+ }
+ }
+
+ /* Conversion to LPC coefficients */
+ a[0] = COEF_CONST(1.0);
+ for (m = 1; m <= order; m++)
+ {
+ for (i = 1; i < m; i++) /* loop only while i<m */
+ b[i] = a[i] + MUL_C(tmp2[m-1], a[m-i]);
+
+ for (i = 1; i < m; i++) /* loop only while i<m */
+ a[i] = b[i];
+
+ a[m] = tmp2[m-1]; /* changed */
+ }
+}
+
+static void tns_ar_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+ uint8_t order)
+{
+ /*
+ - Simple all-pole filter of order "order" defined by
+ y(n) = x(n) - lpc[1]*y(n-1) - ... - lpc[order]*y(n-order)
+ - The state variables of the filter are initialized to zero every time
+ - The output data is written over the input data ("in-place operation")
+ - An input vector of "size" samples is processed and the index increment
+ to the next data sample is given by "inc"
+ */
+
+ uint8_t j;
+ uint16_t i;
+ real_t y;
+ /* state is stored as a double ringbuffer */
+ real_t state[2*TNS_MAX_ORDER] = {0};
+ int8_t state_index = 0;
+
+ for (i = 0; i < size; i++)
+ {
+ y = *spectrum;
+
+ for (j = 0; j < order; j++)
+ y -= MUL_C(state[state_index+j], lpc[j+1]);
+
+ /* double ringbuffer state */
+ state_index--;
+ if (state_index < 0)
+ state_index = order-1;
+ state[state_index] = state[state_index + order] = y;
+
+ *spectrum = y;
+ spectrum += inc;
+
+//#define TNS_PRINT
+#ifdef TNS_PRINT
+ //printf("%d\n", y);
+ printf("0x%.8X\n", y);
+#endif
+ }
+}
+
+static void tns_ma_filter(real_t *spectrum, uint16_t size, int8_t inc, real_t *lpc,
+ uint8_t order)
+{
+ /*
+ - Simple all-zero filter of order "order" defined by
+ y(n) = x(n) + a(2)*x(n-1) + ... + a(order+1)*x(n-order)
+ - The state variables of the filter are initialized to zero every time
+ - The output data is written over the input data ("in-place operation")
+ - An input vector of "size" samples is processed and the index increment
+ to the next data sample is given by "inc"
+ */
+
+ uint8_t j;
+ uint16_t i;
+ real_t y;
+ /* state is stored as a double ringbuffer */
+ real_t state[2*TNS_MAX_ORDER] = {0};
+ int8_t state_index = 0;
+
+ for (i = 0; i < size; i++)
+ {
+ y = *spectrum;
+
+ for (j = 0; j < order; j++)
+ y += MUL_C(state[j], lpc[j+1]);
+
+ /* double ringbuffer state */
+ state_index--;
+ if (state_index < 0)
+ state_index = order-1;
+ state[state_index] = state[state_index + order] = *spectrum;
+
+ *spectrum = y;
+ spectrum += inc;
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/faad2/libfaad/tns.h b/src/filters/transform/mpadecfilter/faad2/libfaad/tns.h
new file mode 100644
index 000000000..fc166c87c
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/faad2/libfaad/tns.h
@@ -0,0 +1,53 @@
+/*
+** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
+** Copyright (C) 2003-2005 M. Bakker, Ahead Software AG, http://www.nero.com
+**
+** 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; either version 2 of the License, or
+** (at your option) any later version.
+**
+** 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.
+**
+** Any non-GPL usage of this software or parts of this software is strictly
+** forbidden.
+**
+** Software using this code must display the following message visibly in the
+** software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Ahead Software, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
+** Commercial non-GPL licensing of this software is possible.
+** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+**
+** $Id: tns.h 441 2005-11-01 21:41:43Z gabest $
+**/
+
+#ifndef __TNS_H__
+#define __TNS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define TNS_MAX_ORDER 20
+
+
+void tns_decode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+ uint8_t object_type, real_t *spec, uint16_t frame_len);
+void tns_encode_frame(ic_stream *ics, tns_info *tns, uint8_t sr_index,
+ uint8_t object_type, real_t *spec, uint16_t frame_len);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/CHANGES b/src/filters/transform/mpadecfilter/libmad-0.15.0b/CHANGES
new file mode 100644
index 000000000..e57d011be
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/CHANGES
@@ -0,0 +1,321 @@
+
+ libmad - MPEG audio decoder library
+ Copyright (C) 2000-2003 Underbit Technologies, Inc.
+
+ $Id: CHANGES 111 2003-08-31 19:00:18Z gabest $
+
+===============================================================================
+
+Version 0.15.0 (beta)
+
+ * Updated to autoconf 2.57, automake 1.7.5, libtool 1.4.3.
+
+ * Added new mad_f_div() API routine.
+
+ * Added a 64th entry to the Layer I/Layer II scalefactor table, for better
+ compatibility with existing streams. The --enable-strict-iso option to
+ `configure' can be used to disable use of this entry.
+
+ * Modified the header decoding routine to allow the reserved emphasis
+ value, for better compatibility with existing streams. The
+ --enable-strict-iso option to `configure' can be used to restore the
+ previous behavior of reporting this value as an error.
+
+ * Added new MAD_EMPHASIS_RESERVED enumeration constant.
+
+ * Fixed a bug in the ARM version of mad_f_scale64() discovered by Andre
+ McCurdy.
+
+ * Rewrote PowerPC assembly for minor gains.
+
+ * Modified mad_timer_fraction() to avoid the possibility of division by
+ zero when 0 is passed as the second argument.
+
+ * Fixed a non-fatal problem caused by attempting to designate ancillary
+ bits in Layer III after a decoding error.
+
+ * Changed to build a shared library by default.
+
+ * Changed to use native Cygwin build by default; give --host=mingw32 to
+ `configure' to use MinGW (and avoid a dependency on the Cygwin DLL).
+
+Version 0.14.2 (beta)
+
+ * Changed Cygwin builds to use MinGW; resulting Win32 executables no
+ longer have a dependency on Cygwin DLLs.
+
+ * Added a new mad_stream_errorstr() API function to libmad for retrieving
+ a string description of the current error condition.
+
+Version 0.14.1 (beta)
+
+ * Updated config.guess and config.sub to latest upstream versions.
+
+ * Enabled libtool versioning rather than release numbering.
+
+ * Improved the documentation in minimad.c.
+
+ * Several other small fixes.
+
+Version 0.14.0 (beta)
+
+ * Added a 64-bit FPM negation operation to improve performance of subband
+ synthesis on some platforms.
+
+ * Improved MSVC++ portability and added MSVC++ project files.
+
+ * Added rounding to Layer III requantization for slightly better accuracy.
+
+Version 0.13.0 (beta)
+
+ * Ancillary data is now properly extracted from Layer III streams.
+
+ * Rewrote the Layer III joint stereo decoding routine to correct a major
+ MPEG-2 problem and a minor MPEG-1 problem decoding intensity stereo.
+
+ * Eliminated the dependency on sign-extending right shifts for Layer I and
+ Layer II.
+
+ * Renamed `private' field to `private_bits' for better C++ compatibility.
+
+ * Gratuitously renamed `sfreq' field to `samplerate' and
+ MAD_ERROR_BADSAMPLEFREQ constant to MAD_ERROR_BADSAMPLERATE.
+
+ * Added `samplerate' and `channels' fields to synth.pcm struct to allow
+ these to be different from the decoded frame, and for simpler access.
+
+ * Added new mad_stream_options() and mad_decoder_options() API entries for
+ special runtime decoding options.
+
+ * Added new MAD_OPTION_IGNORECRC and MAD_OPTION_HALFSAMPLERATE options.
+
+ * Added new MAD_FLAG_FREEFORMAT indicator flag.
+
+ * Fixed some bugs in the async decoder.
+
+ * Added a new mad_timer_multiply() API routine.
+
+ * Eliminated `+' from asm constraints under Intel for better compatibility
+ with some compilers.
+
+ * Fixed a PIC-related problem in libmad/imdct_l_arm.S.
+
+ * Eliminated a static variable to make libmad thread-safe.
+
+Version 0.12.5 (beta)
+
+ * Modified Layer III requantization to occur during Huffman decoding for
+ significant performance gains.
+
+ * Optimized short block IMDCT by eliminating redundant calculations.
+
+ * Made several other Layer III performance improvements; added
+ ASO_INTERLEAVE1, ASO_INTERLEAVE2, and ASO_ZEROCHECK
+ architecture-specific options for best performance on various
+ architectures.
+
+ * Optimized synthesis DCT to store result values as soon as they are
+ calculated.
+
+Version 0.12.4 (beta)
+
+ * New PowerPC fixed-point assembly courtesy of David Blythe.
+
+ * Reorganized fixed-point assembly routines for easier maintenance and
+ better performance.
+
+ * Improved performance of subband synthesis through better indexing and
+ fewer local variables.
+
+ * Added alias reduction for the lower two subbands of mixed short blocks,
+ per a report of ambiguity with ISO/IEC 11172-3 and for uniformity with
+ most other implementations. Also improved alias reduction performance
+ using multiply/accumulate.
+
+ * Added --enable-strict-iso option to `configure' to override best
+ accepted practices such as the alias reduction for mixed short blocks.
+
+ * Improved performance of Layer III IMDCT by using longer
+ multiply/accumulate runs where possible.
+
+Version 0.12.3 (beta)
+
+ * Added MPEG 2.5 support.
+
+ * Added preliminary support for parameterizing the binary point position
+ in the fixed-point representation.
+
+ * Added multiply/accumulate optimization to the Layer III IMDCT for long
+ blocks.
+
+ * Fixed a bug in the handling of Layer III mixed_block_flag.
+
+ * Fixed a configure problem when multiple -O CFLAGS are present.
+
+Version 0.12.2 (beta)
+
+ * Rearranged the synthesis polyphase filterbank memory vector for better
+ locality of reference, and rewrote mad_synth_frame() to accommodate,
+ resulting in improved performance.
+
+ * Discovered a combination of compiler optimization flags that further
+ improve performance.
+
+ * Changed some array references in layer3.c to pointer derefs.
+
+Version 0.12.1 (beta)
+
+ * Resolved the intensity + MS joint stereo issue (a simple bug).
+ OPT_ISKLUGE is no longer considered to be a kluge.
+
+ * Fixed another, hopefully last main_data memory bug.
+
+ * Split part of struct mad_frame into struct mad_header for convenience
+ and size.
+
+Version 0.12.0 (alpha)
+
+ * Changed the build environment to use automake and libtool. A libmad
+ shared library can now be built using the --enable-shared option to
+ `configure'.
+
+ * Added another callback to MAD's high-level decoder API after the frame
+ header has been read but before the frame's audio data is decoded.
+
+ * Streamlined header processing so that mad_frame_decode() can be called
+ with or without having already called mad_frame_header().
+
+ * Fixed some other header reading miscellany, including CRC handling and
+ free bitrate detection, and frame length verification with free
+ bitrates.
+
+ * Fixed a problem with Layer III free bitrates > 320 kbps. The main_data
+ buffer size should now be large enough to handle any size frame, by
+ virtue of the maximum possible part2_3_length.
+
+ * Further developed the async API; arbitrary messages can now be passed to
+ the subsidiary decoding process.
+
+ * Streamlined libmad/timer.c and extended its interface. It now has
+ support for video frame/field lengths, including output support for
+ drop-frame encoding.
+
+ * Replaced many constant integer preprocessor defines with enums.
+
+Version 0.11.4 (beta)
+
+ * Fixed free format bitrate discovery.
+
+ * Changed the timer implementation and extended its interface.
+
+ * Integrated Nicolas Pitre's patch for pre-shifting at compile-time and
+ for better multiply/accumulate code output.
+
+ * Applied Simon Burge's patch to imdct_l_arm.S for a.out compatibility.
+
+ * Added -mtune=strongarm for all ARM targets.
+
+Version 0.11.3 (beta)
+
+ * Added new --enable-speed and --enable-accuracy options for `configure'
+ to automatically select appropriate SSO/ASO options, et al.
+
+ * Modified subband synthesis to use multiply/accumulate optimization (if
+ available) for better speed and/or accuracy.
+
+ * Incorporated Andre McCurdy's changes for further rounding optimizations
+ in the rest of his code.
+
+Version 0.11.2 (beta)
+
+ * Incorporated Nicolas Pitre's ARM assembly and parameterized scaling
+ changes.
+
+ * Incorporated Andre McCurdy's ARM assembly optimization (used only if
+ --enable-aso is given to `configure' to enable architecture-specific
+ optimizations.)
+
+ * Reduced FPM_INTEL assembly to two instructions.
+
+ * Fixed accuracy problems with certain FPM modes in synth.c.
+
+ * Improved the accuracy of FPM_APPROX.
+
+ * Improved the accuracy of SSO.
+
+ * Improved sync discovery by checking for a sync word in the following
+ frame.
+
+ * Minor code clean-up.
+
+ * Added experimental rules for generating a libmad.so shared library.
+
+Version 0.11.1 (beta)
+
+ * Moved libmad code into a separate directory.
+
+ * Changed SSO to be disabled by default, as output accuracy is deemed to
+ be more important than speed in the general case.
+
+ * Fixed a bug in Layer III sanity checking that could cause a crash on
+ certain random data input.
+
+ * Extended the Layer III requantization table from 8191 to 8206 as some
+ encoders are known to use these values, even though ISO/IEC 11172-3
+ suggests the maximum should be 8191.
+
+Version 0.11.0 (beta)
+
+ * Implemented MPEG-2 extension to Lower Sampling Frequencies.
+
+ * Improved Layer III performance by avoiding IMDCT calculation when all
+ input samples are zero.
+
+ * Significantly reduced size of Layer II tables.
+
+Version 0.10.3 (beta)
+
+ * Improved SSO output quality.
+
+ * Made portable to cygwin.
+
+ * Localized memory references in III_huffdecode() for better performance.
+
+Version 0.10.2 (beta)
+
+ * Rewrote Layer III long block 36-point IMDCT routine for better
+ performance.
+
+ * Improved subband synthesis fixed-point games somewhat.
+
+Version 0.10.1 (beta)
+
+ * Added a subband synthesis optimization (SSO) which involves modifying
+ the fixed-point multiplication method during windowing. This produces
+ subtle differences in the output but improves performance greatly.
+
+ * Added I_STEREO and MS_STEREO flags to frame struct.
+
+ * Eliminated privately-used CRCFAILED flag.
+
+ * Fixed a bug where Layer III decoding could crash on some badly-formatted
+ (e.g. non-MPEG) bitstreams.
+
+ * Miscellaneous code clean-up.
+
+Version 0.10.0 (beta)
+
+ * Added SPARC fixed-point math support.
+
+ * Revamped libmad API for better high- and low-level support.
+
+ * Documented more of the code.
+
+ * Changed sync semantics such that new stream buffers are assumed to be
+ sync-aligned.
+
+ * Changed Layer III to dynamically allocate static memory so as not to
+ waste it (about 6.4K) when only decoding Layer I or Layer II.
+
+===============================================================================
+
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/COPYING b/src/filters/transform/mpadecfilter/libmad-0.15.0b/COPYING
new file mode 100644
index 000000000..fbdd65f6f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/COPYRIGHT b/src/filters/transform/mpadecfilter/libmad-0.15.0b/COPYRIGHT
new file mode 100644
index 000000000..ca8172a00
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/COPYRIGHT
@@ -0,0 +1,21 @@
+
+ libmad - MPEG audio decoder library
+ Copyright (C) 2000-2003 Underbit Technologies, Inc.
+
+ 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; either version 2 of the License, or
+ (at your option) any later version.
+
+ 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
+
+ If you would like to negotiate alternate licensing terms, you may do
+ so by contacting: Underbit Technologies, Inc. <info@underbit.com>
+
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/CREDITS b/src/filters/transform/mpadecfilter/libmad-0.15.0b/CREDITS
new file mode 100644
index 000000000..4f3d408f0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/CREDITS
@@ -0,0 +1,100 @@
+
+ libmad - MPEG audio decoder library
+ Copyright (C) 2000-2003 Underbit Technologies, Inc.
+
+ $Id: CREDITS 111 2003-08-31 19:00:18Z gabest $
+
+===============================================================================
+
+AUTHOR
+
+ Except where otherwise noted, all code was authored by:
+
+ Robert Leslie <rob@underbit.com>
+
+CONTRIBUTORS
+
+ Significant contributions have been incorporated with thanks to:
+
+ Anonymous
+ 2002/03/15: frame.c
+ - Reported problem with use of reserved emphasis value.
+
+ Niek Albers <info@daansystems.com>
+ 2003/04/21: layer3.c
+ - Reported runtime uninitialized use of `ptr' in designating
+ ancillary bits after a decoding error.
+
+ David Blythe <blythe@routefree.com>
+ 2001/01/30: fixed.h
+ - Provided initial PowerPC fixed-point assembly.
+
+ Simon Burge <simonb@wasabisystems.com>
+ 2000/09/20: imdct_l_arm.S
+ - Suggested patch for a.out compatibility.
+
+ Joshua Haberman <joshua@haberman.com>
+ 2001/08/10: decoder.c, huffman.c
+ - Suggested portability fixes.
+
+ Timothy King <lordzork@lordzork.com>
+ 2002/05/04: sf_table.dat, layer12.c
+ - Reported problem with use of (missing) scalefactor index 63.
+
+ Andre McCurdy <armccurdy@yahoo.co.uk>
+ 2000/08/10: imdct_l_arm.S
+ - ARM optimized assembly replacement for III_imdct_l().
+ 2000/09/15: imdct_l_arm.S
+ - Applied Nicolas Pitre's rounding optimisation in all remaining
+ places.
+ 2001/02/10: layer3.c
+ - Inspiration for Huffman decoding and requantization rewrite, and
+ other miscellany.
+ 2001/03/24: imdct_l_arm.S
+ - Corrected PIC unsafe code.
+ 2002/02/16: fixed.h
+ - Discovered bug in ARM version of mad_f_scale64().
+
+ Haruhiko OGASAWARA <theta@m1.interq.or.jp>
+ 2001/01/28: layer3.c
+ - Reported discrepancy in alias reduction for mixed short blocks.
+
+ Brett Paterson <brett@fmod.org>
+ 2001/10/28: global.h
+ - Reported missing <assert.h> et al. under MS Embedded Visual C.
+
+ Sean 'Shaleh' Perry <shaleh@via.net>
+ 2000/04/04: fixed.h
+ - Suggested use of size-dependent typedefs.
+ 2001/10/22: config.guess, config.sub
+ - Keep up to date for proper Debian packaging.
+
+ Bertrand Petit <eemad@phoe.frmug.org>
+ 2001/11/05: synth.h
+ - Suggested PCM channel enumeration constants.
+ 2001/11/05: stream.h
+ - Suggested MAD_ERROR_NONE enumeration constant.
+ 2001/11/05: stream.c
+ - Suggested mad_stream_errorstr() function.
+
+ Nicolas Pitre <nico@cam.org>
+ 2000/09/09: fixed.h
+ - Parameterized all scaling for correct use of all multiplication
+ methods within mad_synth_frame().
+ - Rewrote the FPM_ARM version of mad_f_mul() so we have 64-bit
+ multiplication result, rounding and scaling with 3 instructions.
+ 2000/09/09: imdct_l_arm.S
+ - Optimized rounding + scaling operations.
+ 2000/09/17: synth.c
+ - Changed D[] run-time shifts to compile-time.
+ - Modified synthesis for better multiply/accumulate code output.
+ 2001/08/11: fixed.h, synth.c
+ - Suggested 64-bit FPM negation and negative term factorization
+ during synthesis.
+ 2001/08/11: fixed.h
+ - Suggested unrounded behavior for FPM_DEFAULT when OPT_SPEED.
+ 2001/11/19: fixed.c
+ - Suggested computation of any resampling ratio.
+
+===============================================================================
+
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/D.dat b/src/filters/transform/mpadecfilter/libmad-0.15.0b/D.dat
new file mode 100644
index 000000000..aaec12715
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/D.dat
@@ -0,0 +1,607 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: D.dat,v 1.8 2003/05/27 22:40:36 rob Exp $
+ */
+
+/*
+ * These are the coefficients for the subband synthesis window. This is a
+ * reordered version of Table B.3 from ISO/IEC 11172-3.
+ *
+ * Every value is parameterized so that shift optimizations can be made at
+ * compile-time. For example, every value can be right-shifted 12 bits to
+ * minimize multiply instruction times without any loss of accuracy.
+ */
+
+ { PRESHIFT(0x00000000) /* 0.000000000 */, /* 0 */
+ -PRESHIFT(0x0001d000) /* -0.000442505 */,
+ PRESHIFT(0x000d5000) /* 0.003250122 */,
+ -PRESHIFT(0x001cb000) /* -0.007003784 */,
+ PRESHIFT(0x007f5000) /* 0.031082153 */,
+ -PRESHIFT(0x01421000) /* -0.078628540 */,
+ PRESHIFT(0x019ae000) /* 0.100311279 */,
+ -PRESHIFT(0x09271000) /* -0.572036743 */,
+ PRESHIFT(0x1251e000) /* 1.144989014 */,
+ PRESHIFT(0x09271000) /* 0.572036743 */,
+ PRESHIFT(0x019ae000) /* 0.100311279 */,
+ PRESHIFT(0x01421000) /* 0.078628540 */,
+ PRESHIFT(0x007f5000) /* 0.031082153 */,
+ PRESHIFT(0x001cb000) /* 0.007003784 */,
+ PRESHIFT(0x000d5000) /* 0.003250122 */,
+ PRESHIFT(0x0001d000) /* 0.000442505 */,
+
+ PRESHIFT(0x00000000) /* 0.000000000 */,
+ -PRESHIFT(0x0001d000) /* -0.000442505 */,
+ PRESHIFT(0x000d5000) /* 0.003250122 */,
+ -PRESHIFT(0x001cb000) /* -0.007003784 */,
+ PRESHIFT(0x007f5000) /* 0.031082153 */,
+ -PRESHIFT(0x01421000) /* -0.078628540 */,
+ PRESHIFT(0x019ae000) /* 0.100311279 */,
+ -PRESHIFT(0x09271000) /* -0.572036743 */,
+ PRESHIFT(0x1251e000) /* 1.144989014 */,
+ PRESHIFT(0x09271000) /* 0.572036743 */,
+ PRESHIFT(0x019ae000) /* 0.100311279 */,
+ PRESHIFT(0x01421000) /* 0.078628540 */,
+ PRESHIFT(0x007f5000) /* 0.031082153 */,
+ PRESHIFT(0x001cb000) /* 0.007003784 */,
+ PRESHIFT(0x000d5000) /* 0.003250122 */,
+ PRESHIFT(0x0001d000) /* 0.000442505 */ },
+
+ { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 1 */
+ -PRESHIFT(0x0001f000) /* -0.000473022 */,
+ PRESHIFT(0x000da000) /* 0.003326416 */,
+ -PRESHIFT(0x00207000) /* -0.007919312 */,
+ PRESHIFT(0x007d0000) /* 0.030517578 */,
+ -PRESHIFT(0x0158d000) /* -0.084182739 */,
+ PRESHIFT(0x01747000) /* 0.090927124 */,
+ -PRESHIFT(0x099a8000) /* -0.600219727 */,
+ PRESHIFT(0x124f0000) /* 1.144287109 */,
+ PRESHIFT(0x08b38000) /* 0.543823242 */,
+ PRESHIFT(0x01bde000) /* 0.108856201 */,
+ PRESHIFT(0x012b4000) /* 0.073059082 */,
+ PRESHIFT(0x0080f000) /* 0.031478882 */,
+ PRESHIFT(0x00191000) /* 0.006118774 */,
+ PRESHIFT(0x000d0000) /* 0.003173828 */,
+ PRESHIFT(0x0001a000) /* 0.000396729 */,
+
+ -PRESHIFT(0x00001000) /* -0.000015259 */,
+ -PRESHIFT(0x0001f000) /* -0.000473022 */,
+ PRESHIFT(0x000da000) /* 0.003326416 */,
+ -PRESHIFT(0x00207000) /* -0.007919312 */,
+ PRESHIFT(0x007d0000) /* 0.030517578 */,
+ -PRESHIFT(0x0158d000) /* -0.084182739 */,
+ PRESHIFT(0x01747000) /* 0.090927124 */,
+ -PRESHIFT(0x099a8000) /* -0.600219727 */,
+ PRESHIFT(0x124f0000) /* 1.144287109 */,
+ PRESHIFT(0x08b38000) /* 0.543823242 */,
+ PRESHIFT(0x01bde000) /* 0.108856201 */,
+ PRESHIFT(0x012b4000) /* 0.073059082 */,
+ PRESHIFT(0x0080f000) /* 0.031478882 */,
+ PRESHIFT(0x00191000) /* 0.006118774 */,
+ PRESHIFT(0x000d0000) /* 0.003173828 */,
+ PRESHIFT(0x0001a000) /* 0.000396729 */ },
+
+ { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 2 */
+ -PRESHIFT(0x00023000) /* -0.000534058 */,
+ PRESHIFT(0x000de000) /* 0.003387451 */,
+ -PRESHIFT(0x00245000) /* -0.008865356 */,
+ PRESHIFT(0x007a0000) /* 0.029785156 */,
+ -PRESHIFT(0x016f7000) /* -0.089706421 */,
+ PRESHIFT(0x014a8000) /* 0.080688477 */,
+ -PRESHIFT(0x0a0d8000) /* -0.628295898 */,
+ PRESHIFT(0x12468000) /* 1.142211914 */,
+ PRESHIFT(0x083ff000) /* 0.515609741 */,
+ PRESHIFT(0x01dd8000) /* 0.116577148 */,
+ PRESHIFT(0x01149000) /* 0.067520142 */,
+ PRESHIFT(0x00820000) /* 0.031738281 */,
+ PRESHIFT(0x0015b000) /* 0.005294800 */,
+ PRESHIFT(0x000ca000) /* 0.003082275 */,
+ PRESHIFT(0x00018000) /* 0.000366211 */,
+
+ -PRESHIFT(0x00001000) /* -0.000015259 */,
+ -PRESHIFT(0x00023000) /* -0.000534058 */,
+ PRESHIFT(0x000de000) /* 0.003387451 */,
+ -PRESHIFT(0x00245000) /* -0.008865356 */,
+ PRESHIFT(0x007a0000) /* 0.029785156 */,
+ -PRESHIFT(0x016f7000) /* -0.089706421 */,
+ PRESHIFT(0x014a8000) /* 0.080688477 */,
+ -PRESHIFT(0x0a0d8000) /* -0.628295898 */,
+ PRESHIFT(0x12468000) /* 1.142211914 */,
+ PRESHIFT(0x083ff000) /* 0.515609741 */,
+ PRESHIFT(0x01dd8000) /* 0.116577148 */,
+ PRESHIFT(0x01149000) /* 0.067520142 */,
+ PRESHIFT(0x00820000) /* 0.031738281 */,
+ PRESHIFT(0x0015b000) /* 0.005294800 */,
+ PRESHIFT(0x000ca000) /* 0.003082275 */,
+ PRESHIFT(0x00018000) /* 0.000366211 */ },
+
+ { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 3 */
+ -PRESHIFT(0x00026000) /* -0.000579834 */,
+ PRESHIFT(0x000e1000) /* 0.003433228 */,
+ -PRESHIFT(0x00285000) /* -0.009841919 */,
+ PRESHIFT(0x00765000) /* 0.028884888 */,
+ -PRESHIFT(0x0185d000) /* -0.095169067 */,
+ PRESHIFT(0x011d1000) /* 0.069595337 */,
+ -PRESHIFT(0x0a7fe000) /* -0.656219482 */,
+ PRESHIFT(0x12386000) /* 1.138763428 */,
+ PRESHIFT(0x07ccb000) /* 0.487472534 */,
+ PRESHIFT(0x01f9c000) /* 0.123474121 */,
+ PRESHIFT(0x00fdf000) /* 0.061996460 */,
+ PRESHIFT(0x00827000) /* 0.031845093 */,
+ PRESHIFT(0x00126000) /* 0.004486084 */,
+ PRESHIFT(0x000c4000) /* 0.002990723 */,
+ PRESHIFT(0x00015000) /* 0.000320435 */,
+
+ -PRESHIFT(0x00001000) /* -0.000015259 */,
+ -PRESHIFT(0x00026000) /* -0.000579834 */,
+ PRESHIFT(0x000e1000) /* 0.003433228 */,
+ -PRESHIFT(0x00285000) /* -0.009841919 */,
+ PRESHIFT(0x00765000) /* 0.028884888 */,
+ -PRESHIFT(0x0185d000) /* -0.095169067 */,
+ PRESHIFT(0x011d1000) /* 0.069595337 */,
+ -PRESHIFT(0x0a7fe000) /* -0.656219482 */,
+ PRESHIFT(0x12386000) /* 1.138763428 */,
+ PRESHIFT(0x07ccb000) /* 0.487472534 */,
+ PRESHIFT(0x01f9c000) /* 0.123474121 */,
+ PRESHIFT(0x00fdf000) /* 0.061996460 */,
+ PRESHIFT(0x00827000) /* 0.031845093 */,
+ PRESHIFT(0x00126000) /* 0.004486084 */,
+ PRESHIFT(0x000c4000) /* 0.002990723 */,
+ PRESHIFT(0x00015000) /* 0.000320435 */ },
+
+ { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 4 */
+ -PRESHIFT(0x00029000) /* -0.000625610 */,
+ PRESHIFT(0x000e3000) /* 0.003463745 */,
+ -PRESHIFT(0x002c7000) /* -0.010848999 */,
+ PRESHIFT(0x0071e000) /* 0.027801514 */,
+ -PRESHIFT(0x019bd000) /* -0.100540161 */,
+ PRESHIFT(0x00ec0000) /* 0.057617187 */,
+ -PRESHIFT(0x0af15000) /* -0.683914185 */,
+ PRESHIFT(0x12249000) /* 1.133926392 */,
+ PRESHIFT(0x075a0000) /* 0.459472656 */,
+ PRESHIFT(0x0212c000) /* 0.129577637 */,
+ PRESHIFT(0x00e79000) /* 0.056533813 */,
+ PRESHIFT(0x00825000) /* 0.031814575 */,
+ PRESHIFT(0x000f4000) /* 0.003723145 */,
+ PRESHIFT(0x000be000) /* 0.002899170 */,
+ PRESHIFT(0x00013000) /* 0.000289917 */,
+
+ -PRESHIFT(0x00001000) /* -0.000015259 */,
+ -PRESHIFT(0x00029000) /* -0.000625610 */,
+ PRESHIFT(0x000e3000) /* 0.003463745 */,
+ -PRESHIFT(0x002c7000) /* -0.010848999 */,
+ PRESHIFT(0x0071e000) /* 0.027801514 */,
+ -PRESHIFT(0x019bd000) /* -0.100540161 */,
+ PRESHIFT(0x00ec0000) /* 0.057617187 */,
+ -PRESHIFT(0x0af15000) /* -0.683914185 */,
+ PRESHIFT(0x12249000) /* 1.133926392 */,
+ PRESHIFT(0x075a0000) /* 0.459472656 */,
+ PRESHIFT(0x0212c000) /* 0.129577637 */,
+ PRESHIFT(0x00e79000) /* 0.056533813 */,
+ PRESHIFT(0x00825000) /* 0.031814575 */,
+ PRESHIFT(0x000f4000) /* 0.003723145 */,
+ PRESHIFT(0x000be000) /* 0.002899170 */,
+ PRESHIFT(0x00013000) /* 0.000289917 */ },
+
+ { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 5 */
+ -PRESHIFT(0x0002d000) /* -0.000686646 */,
+ PRESHIFT(0x000e4000) /* 0.003479004 */,
+ -PRESHIFT(0x0030b000) /* -0.011886597 */,
+ PRESHIFT(0x006cb000) /* 0.026535034 */,
+ -PRESHIFT(0x01b17000) /* -0.105819702 */,
+ PRESHIFT(0x00b77000) /* 0.044784546 */,
+ -PRESHIFT(0x0b619000) /* -0.711318970 */,
+ PRESHIFT(0x120b4000) /* 1.127746582 */,
+ PRESHIFT(0x06e81000) /* 0.431655884 */,
+ PRESHIFT(0x02288000) /* 0.134887695 */,
+ PRESHIFT(0x00d17000) /* 0.051132202 */,
+ PRESHIFT(0x0081b000) /* 0.031661987 */,
+ PRESHIFT(0x000c5000) /* 0.003005981 */,
+ PRESHIFT(0x000b7000) /* 0.002792358 */,
+ PRESHIFT(0x00011000) /* 0.000259399 */,
+
+ -PRESHIFT(0x00001000) /* -0.000015259 */,
+ -PRESHIFT(0x0002d000) /* -0.000686646 */,
+ PRESHIFT(0x000e4000) /* 0.003479004 */,
+ -PRESHIFT(0x0030b000) /* -0.011886597 */,
+ PRESHIFT(0x006cb000) /* 0.026535034 */,
+ -PRESHIFT(0x01b17000) /* -0.105819702 */,
+ PRESHIFT(0x00b77000) /* 0.044784546 */,
+ -PRESHIFT(0x0b619000) /* -0.711318970 */,
+ PRESHIFT(0x120b4000) /* 1.127746582 */,
+ PRESHIFT(0x06e81000) /* 0.431655884 */,
+ PRESHIFT(0x02288000) /* 0.134887695 */,
+ PRESHIFT(0x00d17000) /* 0.051132202 */,
+ PRESHIFT(0x0081b000) /* 0.031661987 */,
+ PRESHIFT(0x000c5000) /* 0.003005981 */,
+ PRESHIFT(0x000b7000) /* 0.002792358 */,
+ PRESHIFT(0x00011000) /* 0.000259399 */ },
+
+ { -PRESHIFT(0x00001000) /* -0.000015259 */, /* 6 */
+ -PRESHIFT(0x00031000) /* -0.000747681 */,
+ PRESHIFT(0x000e4000) /* 0.003479004 */,
+ -PRESHIFT(0x00350000) /* -0.012939453 */,
+ PRESHIFT(0x0066c000) /* 0.025085449 */,
+ -PRESHIFT(0x01c67000) /* -0.110946655 */,
+ PRESHIFT(0x007f5000) /* 0.031082153 */,
+ -PRESHIFT(0x0bd06000) /* -0.738372803 */,
+ PRESHIFT(0x11ec7000) /* 1.120223999 */,
+ PRESHIFT(0x06772000) /* 0.404083252 */,
+ PRESHIFT(0x023b3000) /* 0.139450073 */,
+ PRESHIFT(0x00bbc000) /* 0.045837402 */,
+ PRESHIFT(0x00809000) /* 0.031387329 */,
+ PRESHIFT(0x00099000) /* 0.002334595 */,
+ PRESHIFT(0x000b0000) /* 0.002685547 */,
+ PRESHIFT(0x00010000) /* 0.000244141 */,
+
+ -PRESHIFT(0x00001000) /* -0.000015259 */,
+ -PRESHIFT(0x00031000) /* -0.000747681 */,
+ PRESHIFT(0x000e4000) /* 0.003479004 */,
+ -PRESHIFT(0x00350000) /* -0.012939453 */,
+ PRESHIFT(0x0066c000) /* 0.025085449 */,
+ -PRESHIFT(0x01c67000) /* -0.110946655 */,
+ PRESHIFT(0x007f5000) /* 0.031082153 */,
+ -PRESHIFT(0x0bd06000) /* -0.738372803 */,
+ PRESHIFT(0x11ec7000) /* 1.120223999 */,
+ PRESHIFT(0x06772000) /* 0.404083252 */,
+ PRESHIFT(0x023b3000) /* 0.139450073 */,
+ PRESHIFT(0x00bbc000) /* 0.045837402 */,
+ PRESHIFT(0x00809000) /* 0.031387329 */,
+ PRESHIFT(0x00099000) /* 0.002334595 */,
+ PRESHIFT(0x000b0000) /* 0.002685547 */,
+ PRESHIFT(0x00010000) /* 0.000244141 */ },
+
+ { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 7 */
+ -PRESHIFT(0x00035000) /* -0.000808716 */,
+ PRESHIFT(0x000e3000) /* 0.003463745 */,
+ -PRESHIFT(0x00397000) /* -0.014022827 */,
+ PRESHIFT(0x005ff000) /* 0.023422241 */,
+ -PRESHIFT(0x01dad000) /* -0.115921021 */,
+ PRESHIFT(0x0043a000) /* 0.016510010 */,
+ -PRESHIFT(0x0c3d9000) /* -0.765029907 */,
+ PRESHIFT(0x11c83000) /* 1.111373901 */,
+ PRESHIFT(0x06076000) /* 0.376800537 */,
+ PRESHIFT(0x024ad000) /* 0.143264771 */,
+ PRESHIFT(0x00a67000) /* 0.040634155 */,
+ PRESHIFT(0x007f0000) /* 0.031005859 */,
+ PRESHIFT(0x0006f000) /* 0.001693726 */,
+ PRESHIFT(0x000a9000) /* 0.002578735 */,
+ PRESHIFT(0x0000e000) /* 0.000213623 */,
+
+ -PRESHIFT(0x00002000) /* -0.000030518 */,
+ -PRESHIFT(0x00035000) /* -0.000808716 */,
+ PRESHIFT(0x000e3000) /* 0.003463745 */,
+ -PRESHIFT(0x00397000) /* -0.014022827 */,
+ PRESHIFT(0x005ff000) /* 0.023422241 */,
+ -PRESHIFT(0x01dad000) /* -0.115921021 */,
+ PRESHIFT(0x0043a000) /* 0.016510010 */,
+ -PRESHIFT(0x0c3d9000) /* -0.765029907 */,
+ PRESHIFT(0x11c83000) /* 1.111373901 */,
+ PRESHIFT(0x06076000) /* 0.376800537 */,
+ PRESHIFT(0x024ad000) /* 0.143264771 */,
+ PRESHIFT(0x00a67000) /* 0.040634155 */,
+ PRESHIFT(0x007f0000) /* 0.031005859 */,
+ PRESHIFT(0x0006f000) /* 0.001693726 */,
+ PRESHIFT(0x000a9000) /* 0.002578735 */,
+ PRESHIFT(0x0000e000) /* 0.000213623 */ },
+
+ { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 8 */
+ -PRESHIFT(0x0003a000) /* -0.000885010 */,
+ PRESHIFT(0x000e0000) /* 0.003417969 */,
+ -PRESHIFT(0x003df000) /* -0.015121460 */,
+ PRESHIFT(0x00586000) /* 0.021575928 */,
+ -PRESHIFT(0x01ee6000) /* -0.120697021 */,
+ PRESHIFT(0x00046000) /* 0.001068115 */,
+ -PRESHIFT(0x0ca8d000) /* -0.791213989 */,
+ PRESHIFT(0x119e9000) /* 1.101211548 */,
+ PRESHIFT(0x05991000) /* 0.349868774 */,
+ PRESHIFT(0x02578000) /* 0.146362305 */,
+ PRESHIFT(0x0091a000) /* 0.035552979 */,
+ PRESHIFT(0x007d1000) /* 0.030532837 */,
+ PRESHIFT(0x00048000) /* 0.001098633 */,
+ PRESHIFT(0x000a1000) /* 0.002456665 */,
+ PRESHIFT(0x0000d000) /* 0.000198364 */,
+
+ -PRESHIFT(0x00002000) /* -0.000030518 */,
+ -PRESHIFT(0x0003a000) /* -0.000885010 */,
+ PRESHIFT(0x000e0000) /* 0.003417969 */,
+ -PRESHIFT(0x003df000) /* -0.015121460 */,
+ PRESHIFT(0x00586000) /* 0.021575928 */,
+ -PRESHIFT(0x01ee6000) /* -0.120697021 */,
+ PRESHIFT(0x00046000) /* 0.001068115 */,
+ -PRESHIFT(0x0ca8d000) /* -0.791213989 */,
+ PRESHIFT(0x119e9000) /* 1.101211548 */,
+ PRESHIFT(0x05991000) /* 0.349868774 */,
+ PRESHIFT(0x02578000) /* 0.146362305 */,
+ PRESHIFT(0x0091a000) /* 0.035552979 */,
+ PRESHIFT(0x007d1000) /* 0.030532837 */,
+ PRESHIFT(0x00048000) /* 0.001098633 */,
+ PRESHIFT(0x000a1000) /* 0.002456665 */,
+ PRESHIFT(0x0000d000) /* 0.000198364 */ },
+
+ { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 9 */
+ -PRESHIFT(0x0003f000) /* -0.000961304 */,
+ PRESHIFT(0x000dd000) /* 0.003372192 */,
+ -PRESHIFT(0x00428000) /* -0.016235352 */,
+ PRESHIFT(0x00500000) /* 0.019531250 */,
+ -PRESHIFT(0x02011000) /* -0.125259399 */,
+ -PRESHIFT(0x003e6000) /* -0.015228271 */,
+ -PRESHIFT(0x0d11e000) /* -0.816864014 */,
+ PRESHIFT(0x116fc000) /* 1.089782715 */,
+ PRESHIFT(0x052c5000) /* 0.323318481 */,
+ PRESHIFT(0x02616000) /* 0.148773193 */,
+ PRESHIFT(0x007d6000) /* 0.030609131 */,
+ PRESHIFT(0x007aa000) /* 0.029937744 */,
+ PRESHIFT(0x00024000) /* 0.000549316 */,
+ PRESHIFT(0x0009a000) /* 0.002349854 */,
+ PRESHIFT(0x0000b000) /* 0.000167847 */,
+
+ -PRESHIFT(0x00002000) /* -0.000030518 */,
+ -PRESHIFT(0x0003f000) /* -0.000961304 */,
+ PRESHIFT(0x000dd000) /* 0.003372192 */,
+ -PRESHIFT(0x00428000) /* -0.016235352 */,
+ PRESHIFT(0x00500000) /* 0.019531250 */,
+ -PRESHIFT(0x02011000) /* -0.125259399 */,
+ -PRESHIFT(0x003e6000) /* -0.015228271 */,
+ -PRESHIFT(0x0d11e000) /* -0.816864014 */,
+ PRESHIFT(0x116fc000) /* 1.089782715 */,
+ PRESHIFT(0x052c5000) /* 0.323318481 */,
+ PRESHIFT(0x02616000) /* 0.148773193 */,
+ PRESHIFT(0x007d6000) /* 0.030609131 */,
+ PRESHIFT(0x007aa000) /* 0.029937744 */,
+ PRESHIFT(0x00024000) /* 0.000549316 */,
+ PRESHIFT(0x0009a000) /* 0.002349854 */,
+ PRESHIFT(0x0000b000) /* 0.000167847 */ },
+
+ { -PRESHIFT(0x00002000) /* -0.000030518 */, /* 10 */
+ -PRESHIFT(0x00044000) /* -0.001037598 */,
+ PRESHIFT(0x000d7000) /* 0.003280640 */,
+ -PRESHIFT(0x00471000) /* -0.017349243 */,
+ PRESHIFT(0x0046b000) /* 0.017257690 */,
+ -PRESHIFT(0x0212b000) /* -0.129562378 */,
+ -PRESHIFT(0x0084a000) /* -0.032379150 */,
+ -PRESHIFT(0x0d78a000) /* -0.841949463 */,
+ PRESHIFT(0x113be000) /* 1.077117920 */,
+ PRESHIFT(0x04c16000) /* 0.297210693 */,
+ PRESHIFT(0x02687000) /* 0.150497437 */,
+ PRESHIFT(0x0069c000) /* 0.025817871 */,
+ PRESHIFT(0x0077f000) /* 0.029281616 */,
+ PRESHIFT(0x00002000) /* 0.000030518 */,
+ PRESHIFT(0x00093000) /* 0.002243042 */,
+ PRESHIFT(0x0000a000) /* 0.000152588 */,
+
+ -PRESHIFT(0x00002000) /* -0.000030518 */,
+ -PRESHIFT(0x00044000) /* -0.001037598 */,
+ PRESHIFT(0x000d7000) /* 0.003280640 */,
+ -PRESHIFT(0x00471000) /* -0.017349243 */,
+ PRESHIFT(0x0046b000) /* 0.017257690 */,
+ -PRESHIFT(0x0212b000) /* -0.129562378 */,
+ -PRESHIFT(0x0084a000) /* -0.032379150 */,
+ -PRESHIFT(0x0d78a000) /* -0.841949463 */,
+ PRESHIFT(0x113be000) /* 1.077117920 */,
+ PRESHIFT(0x04c16000) /* 0.297210693 */,
+ PRESHIFT(0x02687000) /* 0.150497437 */,
+ PRESHIFT(0x0069c000) /* 0.025817871 */,
+ PRESHIFT(0x0077f000) /* 0.029281616 */,
+ PRESHIFT(0x00002000) /* 0.000030518 */,
+ PRESHIFT(0x00093000) /* 0.002243042 */,
+ PRESHIFT(0x0000a000) /* 0.000152588 */ },
+
+ { -PRESHIFT(0x00003000) /* -0.000045776 */, /* 11 */
+ -PRESHIFT(0x00049000) /* -0.001113892 */,
+ PRESHIFT(0x000d0000) /* 0.003173828 */,
+ -PRESHIFT(0x004ba000) /* -0.018463135 */,
+ PRESHIFT(0x003ca000) /* 0.014801025 */,
+ -PRESHIFT(0x02233000) /* -0.133590698 */,
+ -PRESHIFT(0x00ce4000) /* -0.050354004 */,
+ -PRESHIFT(0x0ddca000) /* -0.866363525 */,
+ PRESHIFT(0x1102f000) /* 1.063217163 */,
+ PRESHIFT(0x04587000) /* 0.271591187 */,
+ PRESHIFT(0x026cf000) /* 0.151596069 */,
+ PRESHIFT(0x0056c000) /* 0.021179199 */,
+ PRESHIFT(0x0074e000) /* 0.028533936 */,
+ -PRESHIFT(0x0001d000) /* -0.000442505 */,
+ PRESHIFT(0x0008b000) /* 0.002120972 */,
+ PRESHIFT(0x00009000) /* 0.000137329 */,
+
+ -PRESHIFT(0x00003000) /* -0.000045776 */,
+ -PRESHIFT(0x00049000) /* -0.001113892 */,
+ PRESHIFT(0x000d0000) /* 0.003173828 */,
+ -PRESHIFT(0x004ba000) /* -0.018463135 */,
+ PRESHIFT(0x003ca000) /* 0.014801025 */,
+ -PRESHIFT(0x02233000) /* -0.133590698 */,
+ -PRESHIFT(0x00ce4000) /* -0.050354004 */,
+ -PRESHIFT(0x0ddca000) /* -0.866363525 */,
+ PRESHIFT(0x1102f000) /* 1.063217163 */,
+ PRESHIFT(0x04587000) /* 0.271591187 */,
+ PRESHIFT(0x026cf000) /* 0.151596069 */,
+ PRESHIFT(0x0056c000) /* 0.021179199 */,
+ PRESHIFT(0x0074e000) /* 0.028533936 */,
+ -PRESHIFT(0x0001d000) /* -0.000442505 */,
+ PRESHIFT(0x0008b000) /* 0.002120972 */,
+ PRESHIFT(0x00009000) /* 0.000137329 */ },
+
+ { -PRESHIFT(0x00003000) /* -0.000045776 */, /* 12 */
+ -PRESHIFT(0x0004f000) /* -0.001205444 */,
+ PRESHIFT(0x000c8000) /* 0.003051758 */,
+ -PRESHIFT(0x00503000) /* -0.019577026 */,
+ PRESHIFT(0x0031a000) /* 0.012115479 */,
+ -PRESHIFT(0x02326000) /* -0.137298584 */,
+ -PRESHIFT(0x011b5000) /* -0.069168091 */,
+ -PRESHIFT(0x0e3dd000) /* -0.890090942 */,
+ PRESHIFT(0x10c54000) /* 1.048156738 */,
+ PRESHIFT(0x03f1b000) /* 0.246505737 */,
+ PRESHIFT(0x026ee000) /* 0.152069092 */,
+ PRESHIFT(0x00447000) /* 0.016708374 */,
+ PRESHIFT(0x00719000) /* 0.027725220 */,
+ -PRESHIFT(0x00039000) /* -0.000869751 */,
+ PRESHIFT(0x00084000) /* 0.002014160 */,
+ PRESHIFT(0x00008000) /* 0.000122070 */,
+
+ -PRESHIFT(0x00003000) /* -0.000045776 */,
+ -PRESHIFT(0x0004f000) /* -0.001205444 */,
+ PRESHIFT(0x000c8000) /* 0.003051758 */,
+ -PRESHIFT(0x00503000) /* -0.019577026 */,
+ PRESHIFT(0x0031a000) /* 0.012115479 */,
+ -PRESHIFT(0x02326000) /* -0.137298584 */,
+ -PRESHIFT(0x011b5000) /* -0.069168091 */,
+ -PRESHIFT(0x0e3dd000) /* -0.890090942 */,
+ PRESHIFT(0x10c54000) /* 1.048156738 */,
+ PRESHIFT(0x03f1b000) /* 0.246505737 */,
+ PRESHIFT(0x026ee000) /* 0.152069092 */,
+ PRESHIFT(0x00447000) /* 0.016708374 */,
+ PRESHIFT(0x00719000) /* 0.027725220 */,
+ -PRESHIFT(0x00039000) /* -0.000869751 */,
+ PRESHIFT(0x00084000) /* 0.002014160 */,
+ PRESHIFT(0x00008000) /* 0.000122070 */ },
+
+ { -PRESHIFT(0x00004000) /* -0.000061035 */, /* 13 */
+ -PRESHIFT(0x00055000) /* -0.001296997 */,
+ PRESHIFT(0x000bd000) /* 0.002883911 */,
+ -PRESHIFT(0x0054c000) /* -0.020690918 */,
+ PRESHIFT(0x0025d000) /* 0.009231567 */,
+ -PRESHIFT(0x02403000) /* -0.140670776 */,
+ -PRESHIFT(0x016ba000) /* -0.088775635 */,
+ -PRESHIFT(0x0e9be000) /* -0.913055420 */,
+ PRESHIFT(0x1082d000) /* 1.031936646 */,
+ PRESHIFT(0x038d4000) /* 0.221984863 */,
+ PRESHIFT(0x026e7000) /* 0.151962280 */,
+ PRESHIFT(0x0032e000) /* 0.012420654 */,
+ PRESHIFT(0x006df000) /* 0.026840210 */,
+ -PRESHIFT(0x00053000) /* -0.001266479 */,
+ PRESHIFT(0x0007d000) /* 0.001907349 */,
+ PRESHIFT(0x00007000) /* 0.000106812 */,
+
+ -PRESHIFT(0x00004000) /* -0.000061035 */,
+ -PRESHIFT(0x00055000) /* -0.001296997 */,
+ PRESHIFT(0x000bd000) /* 0.002883911 */,
+ -PRESHIFT(0x0054c000) /* -0.020690918 */,
+ PRESHIFT(0x0025d000) /* 0.009231567 */,
+ -PRESHIFT(0x02403000) /* -0.140670776 */,
+ -PRESHIFT(0x016ba000) /* -0.088775635 */,
+ -PRESHIFT(0x0e9be000) /* -0.913055420 */,
+ PRESHIFT(0x1082d000) /* 1.031936646 */,
+ PRESHIFT(0x038d4000) /* 0.221984863 */,
+ PRESHIFT(0x026e7000) /* 0.151962280 */,
+ PRESHIFT(0x0032e000) /* 0.012420654 */,
+ PRESHIFT(0x006df000) /* 0.026840210 */,
+ -PRESHIFT(0x00053000) /* -0.001266479 */,
+ PRESHIFT(0x0007d000) /* 0.001907349 */,
+ PRESHIFT(0x00007000) /* 0.000106812 */ },
+
+ { -PRESHIFT(0x00004000) /* -0.000061035 */, /* 14 */
+ -PRESHIFT(0x0005b000) /* -0.001388550 */,
+ PRESHIFT(0x000b1000) /* 0.002700806 */,
+ -PRESHIFT(0x00594000) /* -0.021789551 */,
+ PRESHIFT(0x00192000) /* 0.006134033 */,
+ -PRESHIFT(0x024c8000) /* -0.143676758 */,
+ -PRESHIFT(0x01bf2000) /* -0.109161377 */,
+ -PRESHIFT(0x0ef69000) /* -0.935195923 */,
+ PRESHIFT(0x103be000) /* 1.014617920 */,
+ PRESHIFT(0x032b4000) /* 0.198059082 */,
+ PRESHIFT(0x026bc000) /* 0.151306152 */,
+ PRESHIFT(0x00221000) /* 0.008316040 */,
+ PRESHIFT(0x006a2000) /* 0.025909424 */,
+ -PRESHIFT(0x0006a000) /* -0.001617432 */,
+ PRESHIFT(0x00075000) /* 0.001785278 */,
+ PRESHIFT(0x00007000) /* 0.000106812 */,
+
+ -PRESHIFT(0x00004000) /* -0.000061035 */,
+ -PRESHIFT(0x0005b000) /* -0.001388550 */,
+ PRESHIFT(0x000b1000) /* 0.002700806 */,
+ -PRESHIFT(0x00594000) /* -0.021789551 */,
+ PRESHIFT(0x00192000) /* 0.006134033 */,
+ -PRESHIFT(0x024c8000) /* -0.143676758 */,
+ -PRESHIFT(0x01bf2000) /* -0.109161377 */,
+ -PRESHIFT(0x0ef69000) /* -0.935195923 */,
+ PRESHIFT(0x103be000) /* 1.014617920 */,
+ PRESHIFT(0x032b4000) /* 0.198059082 */,
+ PRESHIFT(0x026bc000) /* 0.151306152 */,
+ PRESHIFT(0x00221000) /* 0.008316040 */,
+ PRESHIFT(0x006a2000) /* 0.025909424 */,
+ -PRESHIFT(0x0006a000) /* -0.001617432 */,
+ PRESHIFT(0x00075000) /* 0.001785278 */,
+ PRESHIFT(0x00007000) /* 0.000106812 */ },
+
+ { -PRESHIFT(0x00005000) /* -0.000076294 */, /* 15 */
+ -PRESHIFT(0x00061000) /* -0.001480103 */,
+ PRESHIFT(0x000a3000) /* 0.002487183 */,
+ -PRESHIFT(0x005da000) /* -0.022857666 */,
+ PRESHIFT(0x000b9000) /* 0.002822876 */,
+ -PRESHIFT(0x02571000) /* -0.146255493 */,
+ -PRESHIFT(0x0215c000) /* -0.130310059 */,
+ -PRESHIFT(0x0f4dc000) /* -0.956481934 */,
+ PRESHIFT(0x0ff0a000) /* 0.996246338 */,
+ PRESHIFT(0x02cbf000) /* 0.174789429 */,
+ PRESHIFT(0x0266e000) /* 0.150115967 */,
+ PRESHIFT(0x00120000) /* 0.004394531 */,
+ PRESHIFT(0x00662000) /* 0.024932861 */,
+ -PRESHIFT(0x0007f000) /* -0.001937866 */,
+ PRESHIFT(0x0006f000) /* 0.001693726 */,
+ PRESHIFT(0x00006000) /* 0.000091553 */,
+
+ -PRESHIFT(0x00005000) /* -0.000076294 */,
+ -PRESHIFT(0x00061000) /* -0.001480103 */,
+ PRESHIFT(0x000a3000) /* 0.002487183 */,
+ -PRESHIFT(0x005da000) /* -0.022857666 */,
+ PRESHIFT(0x000b9000) /* 0.002822876 */,
+ -PRESHIFT(0x02571000) /* -0.146255493 */,
+ -PRESHIFT(0x0215c000) /* -0.130310059 */,
+ -PRESHIFT(0x0f4dc000) /* -0.956481934 */,
+ PRESHIFT(0x0ff0a000) /* 0.996246338 */,
+ PRESHIFT(0x02cbf000) /* 0.174789429 */,
+ PRESHIFT(0x0266e000) /* 0.150115967 */,
+ PRESHIFT(0x00120000) /* 0.004394531 */,
+ PRESHIFT(0x00662000) /* 0.024932861 */,
+ -PRESHIFT(0x0007f000) /* -0.001937866 */,
+ PRESHIFT(0x0006f000) /* 0.001693726 */,
+ PRESHIFT(0x00006000) /* 0.000091553 */ },
+
+ { -PRESHIFT(0x00005000) /* -0.000076294 */, /* 16 */
+ -PRESHIFT(0x00068000) /* -0.001586914 */,
+ PRESHIFT(0x00092000) /* 0.002227783 */,
+ -PRESHIFT(0x0061f000) /* -0.023910522 */,
+ -PRESHIFT(0x0002d000) /* -0.000686646 */,
+ -PRESHIFT(0x025ff000) /* -0.148422241 */,
+ -PRESHIFT(0x026f7000) /* -0.152206421 */,
+ -PRESHIFT(0x0fa13000) /* -0.976852417 */,
+ PRESHIFT(0x0fa13000) /* 0.976852417 */,
+ PRESHIFT(0x026f7000) /* 0.152206421 */,
+ PRESHIFT(0x025ff000) /* 0.148422241 */,
+ PRESHIFT(0x0002d000) /* 0.000686646 */,
+ PRESHIFT(0x0061f000) /* 0.023910522 */,
+ -PRESHIFT(0x00092000) /* -0.002227783 */,
+ PRESHIFT(0x00068000) /* 0.001586914 */,
+ PRESHIFT(0x00005000) /* 0.000076294 */,
+
+ -PRESHIFT(0x00005000) /* -0.000076294 */,
+ -PRESHIFT(0x00068000) /* -0.001586914 */,
+ PRESHIFT(0x00092000) /* 0.002227783 */,
+ -PRESHIFT(0x0061f000) /* -0.023910522 */,
+ -PRESHIFT(0x0002d000) /* -0.000686646 */,
+ -PRESHIFT(0x025ff000) /* -0.148422241 */,
+ -PRESHIFT(0x026f7000) /* -0.152206421 */,
+ -PRESHIFT(0x0fa13000) /* -0.976852417 */,
+ PRESHIFT(0x0fa13000) /* 0.976852417 */,
+ PRESHIFT(0x026f7000) /* 0.152206421 */,
+ PRESHIFT(0x025ff000) /* 0.148422241 */,
+ PRESHIFT(0x0002d000) /* 0.000686646 */,
+ PRESHIFT(0x0061f000) /* 0.023910522 */,
+ -PRESHIFT(0x00092000) /* -0.002227783 */,
+ PRESHIFT(0x00068000) /* 0.001586914 */,
+ PRESHIFT(0x00005000) /* 0.000076294 */ }
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/INSTALL b/src/filters/transform/mpadecfilter/libmad-0.15.0b/INSTALL
new file mode 100644
index 000000000..989439d19
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/INSTALL
@@ -0,0 +1,183 @@
+Basic Installation
+==================
+
+ These are generic installation instructions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+ The file `configure.in' is used to create `configure' by a program
+called `autoconf'. You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system. If you're
+ using `csh' on an old version of System V, you might need to type
+ `sh ./configure' instead to prevent `csh' from trying to execute
+ `configure' itself.
+
+ Running `configure' takes awhile. While running, it prints some
+ messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. You can give `configure'
+initial values for variables by setting them in the environment. Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+ CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+ env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory. After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+ By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc. You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on. Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+ CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+ If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+ Use and save the results of the tests in FILE instead of
+ `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+ debugging `configure'.
+
+`--help'
+ Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--version'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/Makefile.am b/src/filters/transform/mpadecfilter/libmad-0.15.0b/Makefile.am
new file mode 100644
index 000000000..65192b181
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/Makefile.am
@@ -0,0 +1,140 @@
+##
+## libmad - MPEG audio decoder library
+## Copyright (C) 2000-2003 Underbit Technologies, Inc.
+##
+## 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; either version 2 of the License, or
+## (at your option) any later version.
+##
+## 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
+##
+## $Id: Makefile.am 111 2003-08-31 19:00:18Z gabest $
+##
+
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS =
+DIST_SUBDIRS = msvc++
+
+lib_LTLIBRARIES = libmad.la
+include_HEADERS = mad.h
+
+EXTRA_PROGRAMS = minimad
+
+minimad_SOURCES = minimad.c
+minimad_INCLUDES =
+minimad_LDADD = libmad.la
+
+EXTRA_DIST = mad.h.sed \
+ CHANGES COPYRIGHT CREDITS README TODO VERSION
+
+exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h \
+ synth.h decoder.h
+
+headers = $(exported_headers) \
+ global.h layer12.h layer3.h huffman.h
+
+data_includes = D.dat imdct_s.dat qc_table.dat rq_table.dat \
+ sf_table.dat
+
+libmad_la_SOURCES = version.c fixed.c bit.c timer.c stream.c frame.c \
+ synth.c decoder.c layer12.c layer3.c huffman.c \
+ $(headers) $(data_includes)
+
+EXTRA_libmad_la_SOURCES = imdct_l_arm.S #synth_mmx.S
+
+libmad_la_DEPENDENCIES = @ASO_OBJS@
+libmad_la_LIBADD = @ASO_OBJS@
+
+INCLUDES = $(FPM) $(ASO)
+
+BUILT_SOURCES = mad.h
+CLEANFILES = mad.h
+
+## From the libtool documentation on library versioning:
+##
+## CURRENT
+## The most recent interface number that this library implements.
+##
+## REVISION
+## The implementation number of the CURRENT interface.
+##
+## AGE
+## The difference between the newest and oldest interfaces that this
+## library implements. In other words, the library implements all the
+## interface numbers in the range from number `CURRENT - AGE' to
+## `CURRENT'.
+##
+## If two libraries have identical CURRENT and AGE numbers, then the
+## dynamic linker chooses the library with the greater REVISION number.
+##
+## 1. Start with version information of `0:0:0' for each libtool library.
+##
+## 2. Update the version information only immediately before a public
+## release of your software. More frequent updates are unnecessary,
+## and only guarantee that the current interface number gets larger
+## faster.
+##
+## 3. If the library source code has changed at all since the last
+## update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
+##
+## 4. If any interfaces have been added, removed, or changed since the
+## last update, increment CURRENT, and set REVISION to 0.
+##
+## 5. If any interfaces have been added since the last public release,
+## then increment AGE.
+##
+## 6. If any interfaces have been removed since the last public release,
+## then set AGE to 0.
+
+version_current = 2
+version_revision = 0
+version_age = 2
+
+version_info = $(version_current):$(version_revision):$(version_age)
+
+libmad_la_LDFLAGS = -version-info $(version_info)
+
+mad.h: config.status config.h Makefile.am \
+ $(srcdir)/COPYRIGHT $(srcdir)/mad.h.sed $(exported_headers)
+ (sed -e '1s|.*|/*|' -e '1b' -e '$$s|.*| */|' -e '$$b' \
+ -e 's/^.*/ *&/' $(srcdir)/COPYRIGHT; echo; \
+ echo "# ifdef __cplusplus"; \
+ echo 'extern "C" {'; \
+ echo "# endif"; echo; \
+ if [ ".$(FPM)" != "." ]; then \
+ echo ".$(FPM)" | sed -e 's|^\.-D|# define |'; echo; \
+ fi; \
+ sed -ne 's/^# *define *\(HAVE_.*_ASM\).*/# define \1/p' \
+ config.h; echo; \
+ sed -ne 's/^# *define *OPT_\(SPEED\|ACCURACY\).*/# define OPT_\1/p' \
+ config.h; echo; \
+ sed -ne 's/^# *define *\(SIZEOF_.*\)/# define \1/p' \
+ config.h; echo; \
+ for header in $(exported_headers); do \
+ echo; \
+ sed -n -f $(srcdir)/mad.h.sed $(srcdir)/$$header; \
+ done; echo; \
+ echo "# ifdef __cplusplus"; \
+ echo '}'; \
+ echo "# endif") >$@
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
+.c.s:
+ $(COMPILE) -S $<
+
+again:
+ $(MAKE) clean
+ $(MAKE)
+
+.PHONY: again
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/Makefile.in b/src/filters/transform/mpadecfilter/libmad-0.15.0b/Makefile.in
new file mode 100644
index 000000000..9a7533952
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/Makefile.in
@@ -0,0 +1,792 @@
+# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+ASO = @ASO@
+ASO_OBJS = @ASO_OBJS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FPM = @FPM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+SUBDIRS =
+DIST_SUBDIRS = msvc++
+
+lib_LTLIBRARIES = libmad.la
+include_HEADERS = mad.h
+
+EXTRA_PROGRAMS = minimad
+
+minimad_SOURCES = minimad.c
+minimad_INCLUDES =
+minimad_LDADD = libmad.la
+
+EXTRA_DIST = mad.h.sed \
+ CHANGES COPYRIGHT CREDITS README TODO VERSION
+
+
+exported_headers = version.h fixed.h bit.h timer.h stream.h frame.h \
+ synth.h decoder.h
+
+
+headers = $(exported_headers) \
+ global.h layer12.h layer3.h huffman.h
+
+
+data_includes = D.dat imdct_s.dat qc_table.dat rq_table.dat \
+ sf_table.dat
+
+
+libmad_la_SOURCES = version.c fixed.c bit.c timer.c stream.c frame.c \
+ synth.c decoder.c layer12.c layer3.c huffman.c \
+ $(headers) $(data_includes)
+
+
+EXTRA_libmad_la_SOURCES = imdct_l_arm.S #synth_mmx.S
+
+libmad_la_DEPENDENCIES = @ASO_OBJS@
+libmad_la_LIBADD = @ASO_OBJS@
+
+INCLUDES = $(FPM) $(ASO)
+
+BUILT_SOURCES = mad.h
+CLEANFILES = mad.h
+
+version_current = 2
+version_revision = 0
+version_age = 2
+
+version_info = $(version_current):$(version_revision):$(version_age)
+
+libmad_la_LDFLAGS = -version-info $(version_info)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = libmad.list
+LTLIBRARIES = $(lib_LTLIBRARIES)
+
+am__objects_1 =
+am__objects_2 = $(am__objects_1)
+am_libmad_la_OBJECTS = version.lo fixed.lo bit.lo timer.lo stream.lo \
+ frame.lo synth.lo decoder.lo layer12.lo layer3.lo huffman.lo \
+ $(am__objects_2) $(am__objects_1)
+libmad_la_OBJECTS = $(am_libmad_la_OBJECTS)
+EXTRA_PROGRAMS = minimad$(EXEEXT)
+am_minimad_OBJECTS = minimad.$(OBJEXT)
+minimad_OBJECTS = $(am_minimad_OBJECTS)
+minimad_DEPENDENCIES = libmad.la
+minimad_LDFLAGS =
+
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/bit.Plo ./$(DEPDIR)/decoder.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/fixed.Plo ./$(DEPDIR)/frame.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/huffman.Plo ./$(DEPDIR)/layer12.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/layer3.Plo ./$(DEPDIR)/minimad.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/stream.Plo ./$(DEPDIR)/synth.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/timer.Plo ./$(DEPDIR)/version.Plo
+CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
+LTCCASCOMPILE = $(LIBTOOL) --mode=compile $(CCAS) $(AM_CCASFLAGS) \
+ $(CCASFLAGS)
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
+ $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(libmad_la_SOURCES) $(EXTRA_libmad_la_SOURCES) \
+ $(minimad_SOURCES)
+HEADERS = $(include_HEADERS)
+
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
+ ps-recursive install-info-recursive uninstall-info-recursive \
+ all-recursive install-data-recursive install-exec-recursive \
+ installdirs-recursive install-recursive uninstall-recursive \
+ check-recursive installcheck-recursive
+DIST_COMMON = README $(include_HEADERS) COPYING INSTALL Makefile.am \
+ Makefile.in TODO aclocal.m4 config.guess config.h.in config.sub \
+ configure configure.ac depcomp install-sh libmad.list.in \
+ ltmain.sh missing mkinstalldirs
+SOURCES = $(libmad_la_SOURCES) $(EXTRA_libmad_la_SOURCES) $(minimad_SOURCES)
+
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .S .c .lo .o .obj .s
+
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
+
+$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+$(srcdir)/configure: $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
+
+$(ACLOCAL_M4): configure.ac
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+
+$(srcdir)/config.h.in: $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ touch $(srcdir)/config.h.in
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+libmad.list: $(top_builddir)/config.status libmad.list.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+libLTLIBRARIES_INSTALL = $(INSTALL)
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" = "$$p" && dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmad.la: $(libmad_la_OBJECTS) $(libmad_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libmad_la_LDFLAGS) $(libmad_la_OBJECTS) $(libmad_la_LIBADD) $(LIBS)
+minimad$(EXEEXT): $(minimad_OBJECTS) $(minimad_DEPENDENCIES)
+ @rm -f minimad$(EXEEXT)
+ $(LINK) $(minimad_LDFLAGS) $(minimad_OBJECTS) $(minimad_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoder.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fixed.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/huffman.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer12.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer3.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minimad.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/synth.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@
+
+distclean-depend:
+ -rm -rf ./$(DEPDIR)
+
+.S.o:
+ $(CCASCOMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+
+.S.obj:
+ $(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+
+.S.lo:
+ $(LTCCASCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@ fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@ fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
+@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+@am__fastdepCC_TRUE@ fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(includedir)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \
+ $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f $(DESTDIR)$(includedir)/$$f"; \
+ rm -f $(DESTDIR)$(includedir)/$$f; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if (etags --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ else \
+ include_option=--include; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = .
+distdir = $(PACKAGE)-$(VERSION)
+
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ mkdir $(distdir)
+ $(mkinstalldirs) $(distdir)/.
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" \
+ distdir=../$(distdir)/$$subdir \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ $(am__remove_distdir)
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
+ && rm -f $(distdir).tar.gz \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @echo "$(distdir).tar.gz is ready for distribution" | \
+ sed 'h;s/./=/g;p;x;p;x'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
+
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-hdr distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf autom4te.cache
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
+ clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-recursive ctags ctags-recursive dist dist-all dist-gzip \
+ distcheck distclean distclean-compile distclean-depend \
+ distclean-generic distclean-hdr distclean-libtool \
+ distclean-recursive distclean-tags distcleancheck distdir \
+ distuninstallcheck dvi dvi-am dvi-recursive info info-am \
+ info-recursive install install-am install-data install-data-am \
+ install-data-recursive install-exec install-exec-am \
+ install-exec-recursive install-includeHEADERS install-info \
+ install-info-am install-info-recursive install-libLTLIBRARIES \
+ install-man install-recursive install-strip installcheck \
+ installcheck-am installdirs installdirs-am \
+ installdirs-recursive maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
+ pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
+ tags-recursive uninstall uninstall-am uninstall-includeHEADERS \
+ uninstall-info-am uninstall-info-recursive \
+ uninstall-libLTLIBRARIES uninstall-recursive
+
+
+mad.h: config.status config.h Makefile.am \
+ $(srcdir)/COPYRIGHT $(srcdir)/mad.h.sed $(exported_headers)
+ (sed -e '1s|.*|/*|' -e '1b' -e '$$s|.*| */|' -e '$$b' \
+ -e 's/^.*/ *&/' $(srcdir)/COPYRIGHT; echo; \
+ echo "# ifdef __cplusplus"; \
+ echo 'extern "C" {'; \
+ echo "# endif"; echo; \
+ if [ ".$(FPM)" != "." ]; then \
+ echo ".$(FPM)" | sed -e 's|^\.-D|# define |'; echo; \
+ fi; \
+ sed -ne 's/^# *define *\(HAVE_.*_ASM\).*/# define \1/p' \
+ config.h; echo; \
+ sed -ne 's/^# *define *OPT_\(SPEED\|ACCURACY\).*/# define OPT_\1/p' \
+ config.h; echo; \
+ sed -ne 's/^# *define *\(SIZEOF_.*\)/# define \1/p' \
+ config.h; echo; \
+ for header in $(exported_headers); do \
+ echo; \
+ sed -n -f $(srcdir)/mad.h.sed $(srcdir)/$$header; \
+ done; echo; \
+ echo "# ifdef __cplusplus"; \
+ echo '}'; \
+ echo "# endif") >$@
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
+.c.s:
+ $(COMPILE) -S $<
+
+again:
+ $(MAKE) clean
+ $(MAKE)
+
+.PHONY: again
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/README b/src/filters/transform/mpadecfilter/libmad-0.15.0b/README
new file mode 100644
index 000000000..4995d37cd
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/README
@@ -0,0 +1,241 @@
+
+ libmad - MPEG audio decoder library
+ Copyright (C) 2000-2003 Underbit Technologies, Inc.
+
+ $Id: README 111 2003-08-31 19:00:18Z gabest $
+
+===============================================================================
+
+INTRODUCTION
+
+ MAD (libmad) is a high-quality MPEG audio decoder. It currently supports
+ MPEG-1 and the MPEG-2 extension to Lower Sampling Frequencies, as well as
+ the so-called MPEG 2.5 format. All three audio layers (Layer I, Layer II,
+ and Layer III a.k.a. MP3) are fully implemented.
+
+ MAD does not yet support MPEG-2 multichannel audio (although it should be
+ backward compatible with such streams) nor does it currently support AAC.
+
+ MAD has the following special features:
+
+ - 24-bit PCM output
+ - 100% fixed-point (integer) computation
+ - completely new implementation based on the ISO/IEC standards
+ - distributed under the terms of the GNU General Public License (GPL)
+
+ Because MAD provides full 24-bit PCM output, applications using MAD are
+ able to produce high quality audio. Even when the output device supports
+ only 16-bit PCM, applications can use the extra resolution to increase the
+ audible dynamic range through the use of dithering or noise shaping.
+
+ Because MAD uses integer computation rather than floating point, it is
+ well suited for architectures without a floating point unit. All
+ calculations are performed with a 32-bit fixed-point integer
+ representation.
+
+ Because MAD is a new implementation of the ISO/IEC standards, it is
+ unencumbered by the errors of other implementations. MAD is NOT a
+ derivation of the ISO reference source or any other code. Considerable
+ effort has been expended to ensure a correct implementation, even in cases
+ where the standards are ambiguous or misleading.
+
+ Because MAD is distributed under the terms of the GPL, its redistribution
+ is not generally restricted, so long as the terms of the GPL are followed.
+ This means MAD can be incorporated into other software as long as that
+ software is also distributed under the GPL. (Should this be undesirable,
+ alternate arrangements may be possible by contacting Underbit.)
+
+===============================================================================
+
+ABOUT THE CODE
+
+ The code is optimized and performs very well, although specific
+ improvements can still be made. The output from the decoder library
+ consists of 32-bit signed linear fixed-point values that can be easily
+ scaled for any size PCM output, up to 24 bits per sample.
+
+ The API for libmad can be found in the `mad.h' header file. Note that this
+ file is automatically generated, and will not exist until after you have
+ built the library.
+
+ There are two APIs available, one high-level, and the other low-level.
+ With the low-level API, each step of the decoding process must be handled
+ explicitly, offering the greatest amount of control. With the high-level
+ API, after callbacks are configured, a single routine will decode an
+ entire bitstream.
+
+ The high-level API may either be used synchronously or asynchronously. If
+ used asynchronously, decoding will occur in a separate process.
+ Communication is possible with the decoding process by passing control
+ messages.
+
+ The file `minimad.c' contains an example usage of the libmad API that
+ shows only the bare minimum required to implement a useful decoder. It
+ expects a regular file to be redirected to standard input, and it sends
+ decoded 16-bit signed little-endian PCM samples to standard output. If a
+ decoding error occurs, it is reported to standard error and decoding
+ continues. Note that the scale() routine in this code is only provided as
+ an example; it rounds MAD's high-resolution samples down to 16 bits, but
+ does not perform any dithering or noise shaping. It is therefore not
+ recommended to use this routine as-is in your own code if sound quality is
+ important.
+
+Integer Performance
+
+ To get the best possible performance, it is recommended that an assembly
+ version of the fixed-point multiply and related routines be selected.
+ Several such assembly routines have been written for various CPUs.
+
+ If an assembly version is not available, a fast approximation version will
+ be used. This will result in reduced accuracy of the decoder.
+
+ Alternatively, if 64-bit integers are supported as a datatype by the
+ compiler, another version can be used that is much more accurate.
+ However, using an assembly version is generally much faster and just as
+ accurate.
+
+ More information can be gathered from the `fixed.h' header file.
+
+ MAD's CPU-intensive subband synthesis routine can be further optimized at
+ the expense of a slight loss in output accuracy due to a modified method
+ for fixed-point multiplication with a small windowing constant. While this
+ is helpful for performance and the output accuracy loss is generally
+ undetectable, it is disabled by default and must be explicitly enabled.
+
+ Under some architectures, other special optimizations may also be
+ available.
+
+Audio Quality
+
+ The output from MAD has been found to satisfy the ISO/IEC 11172-4
+ computational accuracy requirements for compliance. In most
+ configurations, MAD is a Full Layer III ISO/IEC 11172-3 audio decoder as
+ defined by the standard.
+
+ When the approximation version of the fixed-point multiply is used, MAD is
+ a limited accuracy ISO/IEC 11172-3 audio decoder as defined by the
+ standard.
+
+ MAD can alternatively be configured to produce output with less or more
+ accuracy than the default, as a tradeoff with performance.
+
+ MAD produces output samples with a precision greater than 24 bits. Because
+ most output formats use fewer bits, typically 16, it is recommended that a
+ dithering algorithm be used (rather than rounding or truncating) to obtain
+ the highest quality audio. However, dithering may unfavorably affect an
+ analytic examination of the output (such as compliance testing); you may
+ therefore wish to use rounding in this case instead.
+
+Portability Issues
+
+ GCC is preferred to compile the code, but other compilers may also work.
+ The assembly code in `fixed.h' depends on the inline assembly features of
+ your compiler. If you're not using GCC or MSVC++, you can either write
+ your own assembly macros or use the default (low quality output) version.
+
+ The union initialization of `huffman.c' may not be portable to all
+ platforms when GCC is not used.
+
+ The code should not be sensitive to word sizes or byte ordering, however
+ it does assume A % B has the same sign as A.
+
+===============================================================================
+
+BUILDING AND INSTALLING
+
+Windows Platforms
+
+ MAD can be built under Windows using either MSVC++ or Cygwin. A MSVC++
+ project file can be found under the `msvc++' subdirectory.
+
+ To build libmad using Cygwin, you will first need to install the Cygwin
+ tools:
+
+ http://www.cygwin.com/
+
+ You may then proceed with the following POSIX instructions within the
+ Cygwin shell.
+
+ Note that by default Cygwin will build a library that depends on the
+ Cygwin DLL. You can use MinGW to build a library that does not depend on
+ the Cygwin DLL. To do so, give the option --host=mingw32 to `configure'.
+
+POSIX Platforms (including Cygwin)
+
+ The code is distributed with a `configure' script that will generate for
+ you a `Makefile' and a `config.h' for your platform. See the file
+ `INSTALL' for generic instructions.
+
+ The specific options you may want to give `configure' are:
+
+ --enable-speed optimize for speed over accuracy
+
+ --enable-accuracy optimize for accuracy over speed
+
+ --disable-debugging do not compile with debugging support, and
+ use more optimizations
+
+ --disable-shared do not build a shared library
+
+ Note that you need not specify one of --enable-speed or --enable-accuracy;
+ in its default configuration, MAD is optimized for both. You should only
+ use one of these options if you wish to compromise speed or accuracy for
+ the other.
+
+ By default the package will build a shared library if possible for your
+ platform. If you want only a static library, use --disable-shared.
+
+ It is not normally necessary to use the following options, but you may
+ fine-tune the configuration with them if desired:
+
+ --enable-fpm=ARCH use the ARCH-specific version of the
+ fixed-point math assembly routines
+ (current options are: intel, arm, mips,
+ sparc, ppc; also allowed are: 64bit, approx)
+
+ --enable-sso use the subband synthesis optimization,
+ with reduced accuracy
+
+ --disable-aso do not use certain architecture-specific
+ optimizations
+
+ By default an appropriate fixed-point assembly routine will be selected
+ for the configured host type, if it can be determined. Thus if you are
+ cross-compiling for another architecture, you should be sure either to
+ give `configure' a host type argument (--host) or to use an explicit
+ --enable-fpm option.
+
+ If an appropriate assembly routine cannot be determined, the default
+ approximation version will be used. In this case, use of an alternate
+ --enable-fpm is highly recommended.
+
+Experimenting and Developing
+
+ Further options for `configure' that may be useful to developers and
+ experimenters are:
+
+ --enable-debugging enable diagnostic debugging support and
+ debugging symbols
+
+ --enable-profiling generate `gprof' profiling code
+
+ --enable-experimental enable code using the EXPERIMENTAL
+ preprocessor define
+
+===============================================================================
+
+COPYRIGHT
+
+ Please read the `COPYRIGHT' file for copyright and warranty information.
+ Also, the file `COPYING' contains the full text of the GNU GPL.
+
+ Send inquiries, comments, bug reports, suggestions, patches, etc. to:
+
+ Underbit Technologies, Inc. <support@underbit.com>
+
+ See also the MAD home page on the Web:
+
+ http://www.underbit.com/products/mad/
+
+===============================================================================
+
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/TODO b/src/filters/transform/mpadecfilter/libmad-0.15.0b/TODO
new file mode 100644
index 000000000..4c5940294
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/TODO
@@ -0,0 +1,70 @@
+
+ libmad - MPEG audio decoder library
+ Copyright (C) 2000-2003 Underbit Technologies, Inc.
+
+ $Id: TODO 111 2003-08-31 19:00:18Z gabest $
+
+===============================================================================
+
+libmad:
+ - more API layers (buffering, PCM samples, dithering, etc.)
+ - x86 performance optimization compiler flags
+ - function documentation, general docs
+ - finish async API
+ - parse system streams?
+ - MPEG-2 MC, AAC?
+ - logarithmic multiplication?
+ - multiple frame decoding for better locality of reference?
+ - frame serial numbers, Layer III frame continuity checks
+
+fixed.h:
+ - experiment with FPM_INTEL:
+
+# if 1
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("shrl %3,%1\n\t" \
+ "shll %4,%2\n\t" \
+ "orl %2,%1" \
+ : "=rm" (__result) \
+ : "0" (lo), "r" (hi), \
+ "I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# else
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed64hi_t __hi_; \
+ mad_fixed64lo_t __lo_; \
+ mad_fixed_t __result; \
+ asm ("sall %2,%1" \
+ : "=r" (__hi_) \
+ : "0" (hi), "I" (32 - MAD_F_SCALEBITS) \
+ : "cc"); \
+ asm ("shrl %2,%1" \
+ : "=r" (__lo_) \
+ : "0" (lo), "I" (MAD_F_SCALEBITS) \
+ : "cc"); \
+ asm ("orl %1,%2" \
+ : "=rm" (__result) \
+ : "r" (__hi_), "0" (__lo_) \
+ : "cc"); \
+ __result; \
+ })
+# endif
+
+libmad Layer I:
+ - check frame length sanity
+
+libmad Layer II:
+ - check legal bitrate/mode combinations
+ - check frame length sanity
+
+libmad Layer III:
+ - circular buffer
+ - optimize zero_part from Huffman decoding throughout
+ - MPEG 2.5 8000 Hz sf bands? mixed blocks?
+ - stereo->mono conversion optimization?
+ - enable frame-at-a-time decoding
+ - improve portability of huffman.c
+
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/VERSION b/src/filters/transform/mpadecfilter/libmad-0.15.0b/VERSION
new file mode 100644
index 000000000..232b06a76
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/VERSION
@@ -0,0 +1,7 @@
+0.15.0b
+configure.ac:24
+version.h:25-28
+msvc++/config.h:115
+msvc++/mad.h:38-41
+
+Makefile.am:89-91
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/aclocal.m4 b/src/filters/transform/mpadecfilter/libmad-0.15.0b/aclocal.m4
new file mode 100644
index 000000000..e13610874
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/aclocal.m4
@@ -0,0 +1,4512 @@
+# generated automatically by aclocal 1.7.5 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# This macro actually does too much some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 10
+
+AC_PREREQ([2.54])
+
+# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
+# the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG(AMTAR, tar)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright 2002 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.7.5])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright 2001, 2002 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 3
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# -*- Autoconf -*-
+
+
+# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 3
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# AM_AUX_DIR_EXPAND
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+# Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])
+
+AC_DEFUN([AM_AUX_DIR_EXPAND], [
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# AM_PROG_INSTALL_STRIP
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# -*- Autoconf -*-
+# Copyright (C) 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 1
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# serial 5 -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ echo '#include "conftest.h"' > conftest.c
+ echo 'int i;' > conftest.h
+ echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=conftest.c object=conftest.o \
+ depfile=conftest.Po tmpdepfile=conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep conftest.h conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored.
+ if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+#serial 2
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
+ # Extract the definition of DEP_FILES from the Makefile without
+ # running `make'.
+ DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n -e '/^U = / s///p' < "$mf"`
+ test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+ # We invoke sed twice because it is the simplest approach to
+ # changing $(DEPDIR) to its actual value in the expansion.
+ for file in `sed -n -e '
+ /^DEP_FILES = .*\\\\$/ {
+ s/^DEP_FILES = //
+ :loop
+ s/\\\\$//
+ p
+ n
+ /\\\\$/ b loop
+ p
+ }
+ /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# serial 5
+
+AC_PREREQ(2.52)
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.])
+fi])])
+
+# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
+
+# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+AC_PREREQ([2.52])
+
+# serial 6
+
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Figure out how to run the assembler. -*- Autoconf -*-
+
+# serial 2
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# AM_PROG_AS
+# ----------
+AC_DEFUN([AM_PROG_AS],
+[# By default we simply use the C compiler to build assembly code.
+AC_REQUIRE([AC_PROG_CC])
+: ${CCAS='$(CC)'}
+# Set ASFLAGS if not already set.
+: ${CCASFLAGS='$(CFLAGS)'}
+AC_SUBST(CCAS)
+AC_SUBST(CCASFLAGS)])
+
+# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
+
+# serial 46 AC_PROG_LIBTOOL
+
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])
+
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.13)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+_LT_AC_PROG_ECHO_BACKSLASH
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ AC_PATH_MAGIC
+ fi
+ ;;
+esac
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
+
+AC_ARG_ENABLE(libtool-lock,
+ [ --disable-libtool-lock avoid locking (might break parallel builds)])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_SAVE
+ AC_LANG_C
+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_RESTORE])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+
+ # recent cygwin and mingw systems supply a stub DllMain which the user
+ # can override, but on older systems we have to supply one
+ AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
+ [AC_TRY_LINK([],
+ [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
+ DllMain (0, 0, 0);],
+ [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
+
+ case $host/$CC in
+ *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
+ # old mingw systems require "-dll" to link a DLL, while more recent ones
+ # require "-mdll"
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -mdll"
+ AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
+ [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
+ CFLAGS="$SAVE_CFLAGS" ;;
+ *-*-cygwin* | *-*-pw32*)
+ # cygwin systems need to pass --dll to the linker, and not link
+ # crt.o which will require a WinMain@16 definition.
+ lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
+ esac
+ ;;
+ ])
+esac
+
+_LT_AC_LTCONFIG_HACK
+
+])
+
+# AC_LIBTOOL_HEADER_ASSERT
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT],
+[AC_CACHE_CHECK([whether $CC supports assert without backlinking],
+ [lt_cv_func_assert_works],
+ [case $host in
+ *-*-solaris*)
+ if test "$GCC" = yes && test "$with_gnu_ld" != yes; then
+ case `$CC --version 2>/dev/null` in
+ [[12]].*) lt_cv_func_assert_works=no ;;
+ *) lt_cv_func_assert_works=yes ;;
+ esac
+ fi
+ ;;
+ esac])
+
+if test "x$lt_cv_func_assert_works" = xyes; then
+ AC_CHECK_HEADERS(assert.h)
+fi
+])# AC_LIBTOOL_HEADER_ASSERT
+
+# _LT_AC_CHECK_DLFCN
+# --------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)
+])# _LT_AC_CHECK_DLFCN
+
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris* | sysv5*)
+ symcode='[[BDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $host_os in
+mingw*)
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+ symcode='[[ABCDGISTW]]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Write the raw and C identifiers.
+lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+ rm -f conftest*
+ cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+ if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[[]] =
+{
+EOF
+ sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$no_builtin_flag"
+ if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
+ pipe_works=yes
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&AC_FD_CC
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AC_FD_CC
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
+ fi
+ else
+ echo "$progname: failed program was:" >&AC_FD_CC
+ cat conftest.$ac_ext >&5
+ fi
+ rm -f conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ global_symbol_to_cdecl=
+ global_symbol_to_c_name_address=
+else
+ global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
+ global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
+fi
+if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
+then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+
+# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+# ---------------------------------
+AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
+[# Find the correct PATH separator. Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+ UNAME=${UNAME-`uname 2>/dev/null`}
+ case X$UNAME in
+ *-DOS) lt_cv_sys_path_separator=';' ;;
+ *) lt_cv_sys_path_separator=':' ;;
+ esac
+ PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+ [AC_DIVERT_PUSH(NOTICE)])
+_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+ ;;
+esac
+
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X[$]1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+ echo_test_string="`eval $cmd`" &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+AC_DIVERT_POP
+])# _LT_AC_PROG_ECHO_BACKSLASH
+
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+
+ exit (status);
+}]
+EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_unknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+# AC_LIBTOOL_DLOPEN_SELF
+# -------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+])# AC_LIBTOOL_DLOPEN_SELF
+
+AC_DEFUN([_LT_AC_LTCONFIG_HACK],
+[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+need_locks="$enable_libtool_lock"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+if test x"$host" != x"$build"; then
+ ac_tool_prefix=${host_alias}-
+else
+ ac_tool_prefix=
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case $host_os in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+ ;;
+ *)
+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="[$]2"
+
+AC_MSG_CHECKING([for objdir])
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+AC_MSG_RESULT($objdir)
+
+
+AC_ARG_WITH(pic,
+[ --with-pic try to use only PIC/non-PIC objects [default=use both]],
+pic_mode="$withval", pic_mode=default)
+test -z "$pic_mode" && pic_mode=default
+
+# We assume here that the value for lt_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+AC_CACHE_VAL(lt_cv_prog_cc_pic,
+[ lt_cv_prog_cc_pic=
+ lt_cv_prog_cc_shlib=
+ lt_cv_prog_cc_wl=
+ lt_cv_prog_cc_static=
+ lt_cv_prog_cc_no_builtin=
+ lt_cv_prog_cc_can_build_shared=$can_build_shared
+
+ if test "$GCC" = yes; then
+ lt_cv_prog_cc_wl='-Wl,'
+ lt_cv_prog_cc_static='-static'
+
+ case $host_os in
+ aix*)
+ # Below there is a dirty hack to force normal static linking with -ldl
+ # The problem is because libdl dynamically linked with both libc and
+ # libC (AIX C++ library), which obviously doesn't included in libraries
+ # list by gcc. This cause undefined symbols with -static flags.
+ # This hack allows C programs to be linked with "-static -ldl", but
+ # not sure about C++ programs.
+ lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_cv_prog_cc_pic='-fno-common'
+ ;;
+ cygwin* | mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_cv_prog_cc_pic='-DDLL_EXPORT'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_cv_prog_cc_pic=-Kconform_pic
+ fi
+ ;;
+ *)
+ lt_cv_prog_cc_pic='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for PIC flags for the system compiler.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ lt_cv_prog_cc_wl='-Wl,'
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_cv_prog_cc_static='-Bstatic'
+ else
+ lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
+ lt_cv_prog_cc_wl='-Wl,'
+ lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
+ lt_cv_prog_cc_pic='+Z'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_cv_prog_cc_wl='-Wl,'
+ lt_cv_prog_cc_static='-non_shared'
+ # PIC (with -KPIC) is the default.
+ ;;
+
+ cygwin* | mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_cv_prog_cc_pic='-DDLL_EXPORT'
+ ;;
+
+ newsos6)
+ lt_cv_prog_cc_pic='-KPIC'
+ lt_cv_prog_cc_static='-Bstatic'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ # All OSF/1 code is PIC.
+ lt_cv_prog_cc_wl='-Wl,'
+ lt_cv_prog_cc_static='-non_shared'
+ ;;
+
+ sco3.2v5*)
+ lt_cv_prog_cc_pic='-Kpic'
+ lt_cv_prog_cc_static='-dn'
+ lt_cv_prog_cc_shlib='-belf'
+ ;;
+
+ solaris*)
+ lt_cv_prog_cc_pic='-KPIC'
+ lt_cv_prog_cc_static='-Bstatic'
+ lt_cv_prog_cc_wl='-Wl,'
+ ;;
+
+ sunos4*)
+ lt_cv_prog_cc_pic='-PIC'
+ lt_cv_prog_cc_static='-Bstatic'
+ lt_cv_prog_cc_wl='-Qoption ld '
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ lt_cv_prog_cc_pic='-KPIC'
+ lt_cv_prog_cc_static='-Bstatic'
+ lt_cv_prog_cc_wl='-Wl,'
+ ;;
+
+ uts4*)
+ lt_cv_prog_cc_pic='-pic'
+ lt_cv_prog_cc_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_cv_prog_cc_pic='-Kconform_pic'
+ lt_cv_prog_cc_static='-Bstatic'
+ fi
+ ;;
+
+ *)
+ lt_cv_prog_cc_can_build_shared=no
+ ;;
+ esac
+ fi
+])
+if test -z "$lt_cv_prog_cc_pic"; then
+ AC_MSG_RESULT([none])
+else
+ AC_MSG_RESULT([$lt_cv_prog_cc_pic])
+
+ # Check to make sure the pic_flag actually works.
+ AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works])
+ AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+ AC_TRY_COMPILE([], [], [dnl
+ case $host_os in
+ hpux9* | hpux10* | hpux11*)
+ # On HP-UX, both CC and GCC only warn that PIC is supported... then
+ # they create non-PIC objects. So, if there were any warnings, we
+ # assume that PIC is not supported.
+ if test -s conftest.err; then
+ lt_cv_prog_cc_pic_works=no
+ else
+ lt_cv_prog_cc_pic_works=yes
+ fi
+ ;;
+ *)
+ lt_cv_prog_cc_pic_works=yes
+ ;;
+ esac
+ ], [dnl
+ lt_cv_prog_cc_pic_works=no
+ ])
+ CFLAGS="$save_CFLAGS"
+ ])
+
+ if test "X$lt_cv_prog_cc_pic_works" = Xno; then
+ lt_cv_prog_cc_pic=
+ lt_cv_prog_cc_can_build_shared=no
+ else
+ lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
+ fi
+
+ AC_MSG_RESULT([$lt_cv_prog_cc_pic_works])
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$lt_cv_prog_cc_shlib"; then
+ AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries])
+ if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then :
+ else
+ AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure])
+ lt_cv_prog_cc_can_build_shared=no
+ fi
+fi
+
+AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works])
+AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl
+ lt_cv_prog_cc_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+ AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes])
+ LDFLAGS="$save_LDFLAGS"
+])
+
+# Belt *and* braces to stop my trousers falling down:
+test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
+AC_MSG_RESULT([$lt_cv_prog_cc_static_works])
+
+pic_flag="$lt_cv_prog_cc_pic"
+special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
+wl="$lt_cv_prog_cc_wl"
+link_static_flag="$lt_cv_prog_cc_static"
+no_builtin_flag="$lt_cv_prog_cc_no_builtin"
+can_build_shared="$lt_cv_prog_cc_can_build_shared"
+
+
+# Check to see if options -o and -c are simultaneously supported by compiler
+AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext])
+AC_CACHE_VAL([lt_cv_compiler_c_o], [
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+echo "int some_variable = 0;" > conftest.$ac_ext
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory. Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+compiler_c_o=no
+if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+ lt_cv_compiler_c_o=no
+ else
+ lt_cv_compiler_c_o=yes
+ fi
+else
+ # Append any errors to the config.log.
+ cat out/conftest.err 1>&AC_FD_CC
+ lt_cv_compiler_c_o=no
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+])
+compiler_c_o=$lt_cv_compiler_c_o
+AC_MSG_RESULT([$compiler_c_o])
+
+if test x"$compiler_c_o" = x"yes"; then
+ # Check to see if we can write to a .lo
+ AC_MSG_CHECKING([if $compiler supports -c -o file.lo])
+ AC_CACHE_VAL([lt_cv_compiler_o_lo], [
+ lt_cv_compiler_o_lo=no
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -c -o conftest.lo"
+ save_objext="$ac_objext"
+ ac_objext=lo
+ AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ lt_cv_compiler_o_lo=no
+ else
+ lt_cv_compiler_o_lo=yes
+ fi
+ ])
+ ac_objext="$save_objext"
+ CFLAGS="$save_CFLAGS"
+ ])
+ compiler_o_lo=$lt_cv_compiler_o_lo
+ AC_MSG_RESULT([$compiler_o_lo])
+else
+ compiler_o_lo=no
+fi
+
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+if test "$GCC" = yes; then
+ # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+ AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions])
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+ compiler_rtti_exceptions=no
+ AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ compiler_rtti_exceptions=no
+ else
+ compiler_rtti_exceptions=yes
+ fi
+ ])
+ CFLAGS="$save_CFLAGS"
+ AC_MSG_RESULT([$compiler_rtti_exceptions])
+
+ if test "$compiler_rtti_exceptions" = "yes"; then
+ no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+ else
+ no_builtin_flag=' -fno-builtin'
+ fi
+fi
+
+# See if the linker supports building shared libraries.
+AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries])
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced. Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+openbsd*)
+ with_gnu_ld=no
+ ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX, the GNU linker is very broken
+ # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can use
+ # them.
+ ld_shlibs=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+
+ extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+ sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
+ test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+ if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+ else $CC -o impgen impgen.c ; fi)~
+ $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+ old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+ # cygwin and mingw dlls have different entry points and sets of symbols
+ # to exclude.
+ # FIXME: what about values for MSVC?
+ dll_entry=__cygwin_dll_entry@12
+ dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+ case $host_os in
+ mingw*)
+ # mingw values
+ dll_entry=_DllMainCRTStartup@12
+ dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+ ;;
+ esac
+
+ # mingw and cygwin differ, and it's simplest to just exclude the union
+ # of the two symbol sets.
+ dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+ # recent cygwin and mingw systems supply a stub DllMain which the user
+ # can override, but on older systems we have to supply one (in ltdll.c)
+ if test "x$lt_cv_need_dllmain" = "xyes"; then
+ ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
+ ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
+ test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+ else
+ ltdll_obj=
+ ltdll_cmds=
+ fi
+
+ # Extract the symbol export list from an `--export-all' def file,
+ # then regenerate the def file from the symbol export list, so that
+ # the compiled dll only exports the symbol export list.
+ # Be careful not to strip the DATA tag left be newer dlltools.
+ export_symbols_cmds="$ltdll_cmds"'
+ $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+ sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is.
+ # If DATA tags from a recent dlltool are present, honour them!
+ archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname-def;
+ else
+ echo EXPORTS > $output_objdir/$soname-def;
+ _lt_hint=1;
+ cat $export_symbols | while read symbol; do
+ set dummy \$symbol;
+ case \[$]# in
+ 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+ 4) echo " \[$]2 \[$]3 \[$]4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
+ *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
+ esac;
+ _lt_hint=`expr 1 + \$_lt_hint`;
+ done;
+ fi~
+ '"$ltdll_cmds"'
+ $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+ $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+ $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = yes; then
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # dlltool doesn't understand --whole-archive et. al.
+ whole_archive_flag_spec=
+ ;;
+ *)
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ ;;
+ esac
+ fi
+else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$link_static_flag"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ hardcode_direct=yes
+ archive_cmds=''
+ hardcode_libdir_separator=':'
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ esac
+
+ shared_flag='-shared'
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ shared_flag='${wl}-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall can do strange things, so it is better to
+ # generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+ archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='${wl}-berok'
+ # This is a bit strange, but is similar to how AIX traditionally builds
+ # it's shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ ;;
+
+ darwin* | rhapsody*)
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ allow_undefined_flag='-undefined suppress'
+ ;;
+ *) # Darwin 1.3 on
+ allow_undefined_flag='-flat_namespace -undefined suppress'
+ ;;
+ esac
+ # FIXME: Relying on posixy $() will cause problems for
+ # cross-compilation, but unfortunately the echo tests do not
+ # yet detect zsh echo's removal of \ escapes. Also zsh mangles
+ # `"' quotes if we put them in here... so don't!
+ archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
+ # We need to add '_' to the symbols in $export_symbols first
+ #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ whole_archive_flag_spec='-all_load $convenience'
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ case $host_os in
+ hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+ *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+ esac
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_minus_L=yes # Not in the search PATH, but as the default
+ # location of the library.
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ openbsd*)
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case "$host_os" in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ #Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+
+ sco3.2v5*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ ;;
+
+ solaris*)
+ # gcc --version < 3.0 without binutils cannot create self contained
+ # shared libraries reliably, requiring libgcc.a to resolve some of
+ # the object symbols generated in some cases. Libraries that use
+ # assert need libgcc.a to resolve __eprintf, for example. Linking
+ # a copy of libgcc.a into every shared library to guarantee resolving
+ # such symbols causes other problems: According to Tim Van Holder
+ # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
+ # (to the application) exception stack for one thing.
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ case `$CC --version 2>/dev/null` in
+ [[12]].*)
+ cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems, without
+*** introducing a dependency on libgcc.a. Therefore, libtool is disabling
+*** -no-undefined support, which will at least allow you to build shared
+*** libraries. However, you may find that when you link such libraries
+*** into an application without using GCC, you have to manually add
+*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to
+*** upgrade to a newer version of GCC. Another option is to rebuild your
+*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+ no_undefined_flag=
+ ;;
+ esac
+ fi
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv5*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ hardcode_libdir_flag_spec=
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4.2uw2*)
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=no
+ hardcode_runpath_var=yes
+ runpath_var=LD_RUN_PATH
+ ;;
+
+ sysv5uw7* | unixware7*)
+ no_undefined_flag='${wl}-z ${wl}text'
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+AC_MSG_RESULT([$ld_shlibs])
+test "$ld_shlibs" = no && can_build_shared=no
+
+# Check hardcoding attributes.
+AC_MSG_CHECKING([how to hardcode library paths into programs])
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var"; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$hardcode_shlibpath_var" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+AC_MSG_RESULT([$hardcode_action])
+
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+# PORTME Fill in your ld.so characteristics
+AC_MSG_CHECKING([dynamic linker characteristics])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}.so$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can
+ # not hardcode correct soname into executable. Probably we can
+ # add versioning support to collect2, so additional links can
+ # be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}.so$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ hardcode_into_libs=yes
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}.so'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi4*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ export_dynamic_flag_spec=-rdynamic
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ need_version=no
+ need_lib_prefix=no
+ case $GCC,$host_os in
+ yes,cygwin*)
+ library_names_spec='$libname.dll.a'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
+ postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog .libs/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ ;;
+ yes,mingw*)
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
+ ;;
+ yes,pw32*)
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+ ;;
+ *)
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ # FIXME: Relying on posixy $() will cause problems for
+ # cross-compilation, but unfortunately the echo tests do not
+ # yet detect zsh echo's removal of \ escapes.
+ library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
+ soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd*-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU/FreeBSD ld.so'
+ ;;
+
+freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ *)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ dynamic_linker="$host_os dld.sl"
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+ soname_spec='${libname}${release}.sl$major'
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *) version_type=irix ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case "$host_os" in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+os2*)
+ libname_spec='$name'
+ need_lib_prefix=no
+ library_names_spec='$libname.dll $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_version=no
+ need_lib_prefix=no
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ hardcode_into_libs=yes
+ ;;
+
+sco3.2v5*)
+ version_type=osf
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+ soname_spec='$libname.so.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+AC_LIBTOOL_DLOPEN_SELF
+
+if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+ AC_CACHE_VAL([lt_cv_archive_cmds_need_lc],
+ [$rm conftest*
+ echo 'static int dummy;' > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile); then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_cv_prog_cc_wl
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi])
+ AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc])
+ ;;
+ esac
+fi
+need_lc=${lt_cv_archive_cmds_need_lc-yes}
+
+# The second clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ :
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ test -f Makefile && make "$ltmain"
+fi
+
+if test -f "$ltmain"; then
+ trap "$rm \"${ofile}T\"; exit 1" 1 2 15
+ $rm -f "${ofile}T"
+
+ echo creating $ofile
+
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS SED \
+ AR AR_FLAGS CC LD LN_S NM SHELL \
+ reload_flag reload_cmds wl \
+ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+ thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+ library_names_spec soname_spec \
+ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+ postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+ old_striplib striplib file_magic_cmd export_symbols_cmds \
+ deplibs_check_method allow_undefined_flag no_undefined_flag \
+ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+ global_symbol_to_c_name_address \
+ hardcode_libdir_flag_spec hardcode_libdir_separator \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+ case $var in
+ reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+ extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ cat <<__EOF__ > "${ofile}T"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="${SED} -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# The default C compiler.
+CC=$lt_CC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_pic_flag
+pic_mode=$pic_mode
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$lt_compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "${ofile}T"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2*)
+ cat <<'EOF' >> "${ofile}T"
+ # This is a source program that is used to create dlls on Windows
+ # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+ # This is a source program that is used to create import libraries
+ # on Windows for dlls which lack them. Don't remove nor modify the
+ # starting and closing comments
+# /* impgen.c starts here */
+# /* Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+# This file is part of GNU libtool.
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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 <stdio.h> /* for printf() */
+# #include <unistd.h> /* for open(), lseek(), read() */
+# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
+# #include <string.h> /* for strdup() */
+#
+# /* O_BINARY isn't required (or even defined sometimes) under Unix */
+# #ifndef O_BINARY
+# #define O_BINARY 0
+# #endif
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[2];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 2);
+# return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[4];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 4);
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+# void *ptr;
+# {
+# unsigned char *b = ptr;
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+# int argc;
+# char *argv[];
+# {
+# int dll;
+# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+# unsigned long export_rva, export_size, nsections, secptr, expptr;
+# unsigned long name_rvas, nexp;
+# unsigned char *expdata, *erva;
+# char *filename, *dll_name;
+#
+# filename = argv[1];
+#
+# dll = open(filename, O_RDONLY|O_BINARY);
+# if (dll < 1)
+# return 1;
+#
+# dll_name = filename;
+#
+# for (i=0; filename[i]; i++)
+# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
+# dll_name = filename + i +1;
+#
+# pe_header_offset = pe_get32 (dll, 0x3c);
+# opthdr_ofs = pe_header_offset + 4 + 20;
+# num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+# if (num_entries < 1) /* no exports */
+# return 1;
+#
+# export_rva = pe_get32 (dll, opthdr_ofs + 96);
+# export_size = pe_get32 (dll, opthdr_ofs + 100);
+# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+# secptr = (pe_header_offset + 4 + 20 +
+# pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+# expptr = 0;
+# for (i = 0; i < nsections; i++)
+# {
+# char sname[8];
+# unsigned long secptr1 = secptr + 40 * i;
+# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# lseek(dll, secptr1, SEEK_SET);
+# read(dll, sname, 8);
+# if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# {
+# expptr = fptr + (export_rva - vaddr);
+# if (export_rva + export_size > vaddr + vsize)
+# export_size = vsize - (export_rva - vaddr);
+# break;
+# }
+# }
+#
+# expdata = (unsigned char*)malloc(export_size);
+# lseek (dll, expptr, SEEK_SET);
+# read (dll, expdata, export_size);
+# erva = expdata - export_rva;
+#
+# nexp = pe_as32 (expdata+24);
+# name_rvas = pe_as32 (expdata+32);
+#
+# printf ("EXPORTS\n");
+# for (i = 0; i<nexp; i++)
+# {
+# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+# }
+#
+# return 0;
+# }
+# /* impgen.c ends here */
+
+EOF
+ ;;
+ esac
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
+
+ mv -f "${ofile}T" "$ofile" || \
+ (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
+ chmod +x "$ofile"
+fi
+
+])# _LT_AC_LTCONFIG_HACK
+
+# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
+
+# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
+
+# AC_ENABLE_SHARED - implement the --enable-shared flag
+# Usage: AC_ENABLE_SHARED[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(shared,
+changequote(<<, >>)dnl
+<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
+])
+
+# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)])
+
+# AC_ENABLE_STATIC - implement the --enable-static flag
+# Usage: AC_ENABLE_STATIC[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(static,
+changequote(<<, >>)dnl
+<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
+])
+
+# AC_DISABLE_STATIC - set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)])
+
+
+# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
+# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
+# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
+# `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE(fast-install,
+changequote(<<, >>)dnl
+<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
+changequote([, ])dnl
+[p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac],
+enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
+])
+
+# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)])
+
+# AC_LIBTOOL_PICMODE - implement the --with-pic flag
+# Usage: AC_LIBTOOL_PICMODE[(MODE)]
+# Where MODE is either `yes' or `no'. If omitted, it defaults to
+# `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)])
+
+
+# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="ifelse([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+])
+
+
+# AC_PATH_MAGIC - find a file program which can recognise a shared library
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
+AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])
+
+
+# AC_PROG_LD - find the path to the GNU or non-GNU linker
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH(gnu-ld,
+[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by GCC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | [[A-Za-z]]:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])
+
+# AC_PROG_LD_GNU -
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ lt_cv_prog_gnu_ld=yes
+else
+ lt_cv_prog_gnu_ld=no
+fi])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])
+
+# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+])
+
+# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi4*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin* | mingw* | pw32*)
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ ;;
+
+freebsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20*|hpux11*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ irix5* | nonstopux*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1"
+ ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ case $host_cpu in
+ alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | arm* | m68k)
+ lt_cv_deplibs_check_method=pass_all ;;
+ *)
+ # glibc up to 2.1.1 does not perform some relocations on ARM
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+openbsd*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
+ else
+ lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+
+sysv5uw[[78]]* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+])
+
+
+# AC_PROG_NM - find the path to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
+AC_MSG_CHECKING([for BSD-compatible nm])
+AC_CACHE_VAL(lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm=$ac_dir/${ac_tool_prefix}nm
+ if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ else
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+AC_MSG_RESULT([$NM])
+])
+
+# AC_CHECK_LIBM - check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32*)
+ # These system don't have libm
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, main, LIBM="-lm")
+ ;;
+esac
+])
+
+# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl convenience library and LTDLINCL to the include flags for
+# the libltdl header and adds --enable-ltdl-convenience to the
+# configure arguments. Note that LIBLTDL and LTDLINCL are not
+# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
+# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
+# with '${top_builddir}/' and LTDLINCL will be prefixed with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])
+
+# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
+# the libltdl installable library and LTDLINCL to the include flags for
+# the libltdl header and adds --enable-ltdl-install to the configure
+# arguments. Note that LIBLTDL and LTDLINCL are not AC_SUBSTed, nor is
+# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
+# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
+# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed
+# with '${top_srcdir}/' (note the single quotes!). If your package is
+# not flat and you're not using automake, define top_builddir and
+# top_srcdir appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, main,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ LTDLINCL=
+ fi
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])
+
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
+
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
+
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+
+ # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=$TMPDIR/sed$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+ { (exit 1); exit 1; }
+}
+ _max=0
+ _count=0
+ # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+ # along with /bin/sed that truncates output.
+ for _sed in $_sed_list /usr/xpg4/bin/sed; do
+ test ! -f ${_sed} && break
+ cat /dev/null > "$tmp/sed.in"
+ _count=0
+ echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+ # Check for GNU sed and select it if it is found.
+ if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+ lt_cv_path_SED=${_sed}
+ break
+ fi
+ while true; do
+ cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+ mv "$tmp/sed.tmp" "$tmp/sed.in"
+ cp "$tmp/sed.in" "$tmp/sed.nl"
+ echo >>"$tmp/sed.nl"
+ ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+ cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+ # 40000 chars as input seems more than enough
+ test $_count -gt 10 && break
+ _count=`expr $_count + 1`
+ if test $_count -gt $_max; then
+ _max=$_count
+ lt_cv_path_SED=$_sed
+ fi
+ done
+ done
+ rm -rf "$tmp"
+])
+if test "X$SED" != "X"; then
+ lt_cv_path_SED=$SED
+else
+ SED=$lt_cv_path_SED
+fi
+AC_MSG_RESULT([$SED])
+])
+
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/bit.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/bit.c
new file mode 100644
index 000000000..9e1c1edc0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/bit.c
@@ -0,0 +1,237 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: bit.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# ifdef HAVE_LIMITS_H
+# include <limits.h>
+# else
+# define CHAR_BIT 8
+# endif
+
+# include "bit.h"
+
+/*
+ * This is the lookup table for computing the CRC-check word.
+ * As described in section 2.4.3.1 and depicted in Figure A.9
+ * of ISO/IEC 11172-3, the generator polynomial is:
+ *
+ * G(X) = X^16 + X^15 + X^2 + 1
+ */
+static
+unsigned short const crc_table[256] = {
+ 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
+ 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
+ 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
+ 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
+ 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
+ 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
+ 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
+ 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
+
+ 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
+ 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
+ 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
+ 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
+ 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
+ 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
+ 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
+ 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
+
+ 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
+ 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
+ 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
+ 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
+ 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
+ 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
+ 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
+ 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
+
+ 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
+ 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
+ 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
+ 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
+ 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
+ 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
+ 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
+ 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
+};
+
+# define CRC_POLY 0x8005
+
+/*
+ * NAME: bit->init()
+ * DESCRIPTION: initialize bit pointer struct
+ */
+void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte)
+{
+ bitptr->byte = byte;
+ bitptr->cache = 0;
+ bitptr->left = CHAR_BIT;
+}
+
+/*
+ * NAME: bit->length()
+ * DESCRIPTION: return number of bits between start and end points
+ */
+unsigned int mad_bit_length(struct mad_bitptr const *begin,
+ struct mad_bitptr const *end)
+{
+ return begin->left +
+ CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left);
+}
+
+/*
+ * NAME: bit->nextbyte()
+ * DESCRIPTION: return pointer to next unprocessed byte
+ */
+unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr)
+{
+ return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1;
+}
+
+/*
+ * NAME: bit->skip()
+ * DESCRIPTION: advance bit pointer
+ */
+void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len)
+{
+ bitptr->byte += len / CHAR_BIT;
+ bitptr->left -= len % CHAR_BIT;
+
+ if (bitptr->left > CHAR_BIT) {
+ bitptr->byte++;
+ bitptr->left += CHAR_BIT;
+ }
+
+ if (bitptr->left < CHAR_BIT)
+ bitptr->cache = *bitptr->byte;
+}
+
+/*
+ * NAME: bit->read()
+ * DESCRIPTION: read an arbitrary number of bits and return their UIMSBF value
+ */
+unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len)
+{
+ register unsigned long value;
+
+ if (bitptr->left == CHAR_BIT)
+ bitptr->cache = *bitptr->byte;
+
+ if (len < bitptr->left) {
+ value = (bitptr->cache & ((1 << bitptr->left) - 1)) >>
+ (bitptr->left - len);
+ bitptr->left -= len;
+
+ return value;
+ }
+
+ /* remaining bits in current byte */
+
+ value = bitptr->cache & ((1 << bitptr->left) - 1);
+ len -= bitptr->left;
+
+ bitptr->byte++;
+ bitptr->left = CHAR_BIT;
+
+ /* more bytes */
+
+ while (len >= CHAR_BIT) {
+ value = (value << CHAR_BIT) | *bitptr->byte++;
+ len -= CHAR_BIT;
+ }
+
+ if (len > 0) {
+ bitptr->cache = *bitptr->byte;
+
+ value = (value << len) | (bitptr->cache >> (CHAR_BIT - len));
+ bitptr->left -= len;
+ }
+
+ return value;
+}
+
+# if 0
+/*
+ * NAME: bit->write()
+ * DESCRIPTION: write an arbitrary number of bits
+ */
+void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len,
+ unsigned long value)
+{
+ unsigned char *ptr;
+
+ ptr = (unsigned char *) bitptr->byte;
+
+ /* ... */
+}
+# endif
+
+/*
+ * NAME: bit->crc()
+ * DESCRIPTION: compute CRC-check word
+ */
+unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len,
+ unsigned short init)
+{
+ register unsigned int crc;
+
+ for (crc = init; len >= 32; len -= 32) {
+ register unsigned long data;
+
+ data = mad_bit_read(&bitptr, 32);
+
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff];
+ crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff];
+ }
+
+ switch (len / 8) {
+ case 3: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+ case 2: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+ case 1: crc = (crc << 8) ^
+ crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
+
+ len %= 8;
+
+ case 0: break;
+ }
+
+ while (len--) {
+ register unsigned int msb;
+
+ msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15);
+
+ crc <<= 1;
+ if (msb & 1)
+ crc ^= CRC_POLY;
+ }
+
+ return crc & 0xffff;
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/bit.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/bit.h
new file mode 100644
index 000000000..6f81be703
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/bit.h
@@ -0,0 +1,47 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: bit.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_BIT_H
+# define LIBMAD_BIT_H
+
+struct mad_bitptr {
+ unsigned char const *byte;
+ unsigned short cache;
+ unsigned short left;
+};
+
+void mad_bit_init(struct mad_bitptr *, unsigned char const *);
+
+# define mad_bit_finish(bitptr) /* nothing */
+
+unsigned int mad_bit_length(struct mad_bitptr const *,
+ struct mad_bitptr const *);
+
+# define mad_bit_bitsleft(bitptr) ((bitptr)->left)
+unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
+
+void mad_bit_skip(struct mad_bitptr *, unsigned int);
+unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
+void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
+
+unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/config.guess b/src/filters/transform/mpadecfilter/libmad-0.15.0b/config.guess
new file mode 100644
index 000000000..b9ebec592
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/config.guess
@@ -0,0 +1,1391 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+timestamp='2003-05-19'
+
+# This file 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvmeppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mipseb-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit 0;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ DRS?6000:UNIX_SV:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7 && exit 0 ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c \
+ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && exit 0
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit 0 ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ # avoid double evaluation of $set_cc_for_build
+ test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ *:UNICOS/mp:*:*)
+ echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
+ # Determine whether the default compiler uses glibc.
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #if __GLIBC__ >= 2
+ LIBC=gnu
+ #else
+ LIBC=
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
+ x86:Interix*:3*)
+ echo i586-pc-interix3
+ exit 0 ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit 0 ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit 0 ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit 0 ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit 0 ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit 0 ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit 0 ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit 0 ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit 0 ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0 ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit 0 ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit 0 ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit 0 ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ case `uname -p` in
+ *86) UNAME_PROCESSOR=i686 ;;
+ powerpc) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit 0 ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit 0 ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit 0 ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit 0 ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit 0 ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/config.h.in b/src/filters/transform/mpadecfilter/libmad-0.15.0b/config.h.in
new file mode 100644
index 000000000..2d39ea4dd
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/config.h.in
@@ -0,0 +1,129 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to enable diagnostic debugging support. */
+#undef DEBUG
+
+/* Define to enable experimental code. */
+#undef EXPERIMENTAL
+
+/* Define to 1 if you have the <assert.h> header file. */
+#undef HAVE_ASSERT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the `fcntl' function. */
+#undef HAVE_FCNTL
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */
+#undef HAVE_MADD16_ASM
+
+/* Define if your MIPS CPU supports a 2-operand MADD instruction. */
+#undef HAVE_MADD_ASM
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `pipe' function. */
+#undef HAVE_PIPE
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `waitpid' function. */
+#undef HAVE_WAITPID
+
+/* Define to disable debugging assertions. */
+#undef NDEBUG
+
+/* Define to optimize for accuracy over speed. */
+#undef OPT_ACCURACY
+
+/* Define to optimize for speed over accuracy. */
+#undef OPT_SPEED
+
+/* Define to enable a fast subband synthesis approximation optimization. */
+#undef OPT_SSO
+
+/* Define to influence a strict interpretation of the ISO/IEC standards, even
+ if this is in opposition with best accepted practices. */
+#undef OPT_STRICT
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of a `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of a `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of a `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+ if it is not supported. */
+#undef inline
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/config.sub b/src/filters/transform/mpadecfilter/libmad-0.15.0b/config.sub
new file mode 100644
index 000000000..239869dae
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/config.sub
@@ -0,0 +1,1492 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+
+timestamp='2003-05-09'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit 0;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k \
+ | m32r | m68000 | m68k | m88k | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | msp430 \
+ | ns16k | ns32k \
+ | openrisc | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* \
+ | m32r-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | msp430-* \
+ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+ | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ mmix*)
+ basic_machine=mmix-knuth
+ os=-mmixware
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nv1)
+ basic_machine=nv1-cray
+ os=-unicosmp
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ or32 | or32-*)
+ basic_machine=or32-unknown
+ os=-coff
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i686-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic4x | c4x*)
+ basic_machine=tic4x-unknown
+ os=-coff
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparc | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/configure b/src/filters/transform/mpadecfilter/libmad-0.15.0b/configure
new file mode 100644
index 000000000..16f1a5c48
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/configure
@@ -0,0 +1,11360 @@
+#! /bin/sh
+# From configure.ac Id: configure.ac,v 1.7 2003/06/05 02:27:07 rob Exp .
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.57 for MPEG Audio Decoder 0.15.0b.
+#
+# Report bugs to <support@underbit.com>.
+#
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Find the correct PATH separator. Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+ UNAME=${UNAME-`uname 2>/dev/null`}
+ case X$UNAME in
+ *-DOS) lt_cv_sys_path_separator=';' ;;
+ *) lt_cv_sys_path_separator=':' ;;
+ esac
+ PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+ ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string="`eval $cmd`") 2>/dev/null &&
+ echo_test_string="`eval $cmd`" &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='MPEG Audio Decoder'
+PACKAGE_TARNAME='libmad'
+PACKAGE_VERSION='0.15.0b'
+PACKAGE_STRING='MPEG Audio Decoder 0.15.0b'
+PACKAGE_BUGREPORT='support@underbit.com'
+
+ac_unique_file="decoder.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS CCASFLAGS LN_S ECHO RANLIB ac_ct_RANLIB CPP EGREP LIBTOOL LIBTOOL_DEPS FPM ASO ASO_OBJS LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_option in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures MPEG Audio Decoder 0.15.0b to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of MPEG Audio Decoder 0.15.0b:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors
+ --enable-shared=PKGS build shared libraries default=yes
+ --enable-static=PKGS build static libraries default=yes
+ --enable-fast-install=PKGS optimize for fast installation default=yes
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-speed optimize for speed over accuracy
+ --enable-accuracy optimize for accuracy over speed
+ --enable-fpm=ARCH use ARCH-specific fixed-point math routines (one of:
+ intel, arm, mips, sparc, ppc, 64bit, default)
+ --enable-sso use subband synthesis optimization
+ --disable-aso disable architecture-specific optimizations
+ --enable-strict-iso use strict ISO/IEC interpretations
+ --enable-profiling generate profiling code
+ --enable-debugging enable diagnostic debugging support
+ --disable-debugging do not enable debugging and use more optimization
+ --enable-experimental enable experimental code
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-gnu-ld assume the C compiler uses GNU ld default=no
+ --with-pic try to use only PIC/non-PIC objects default=use both
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <support@underbit.com>.
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+MPEG Audio Decoder configure 0.15.0b
+generated by GNU Autoconf 2.57
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by MPEG Audio Decoder $as_me 0.15.0b, which was
+generated by GNU Autoconf 2.57. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h | sort
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core core.* *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+am__api_version="1.7"
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f $ac_dir/shtool; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+done
+
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL=$ac_install_sh
+ fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $. echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.make <<\_ACEOF
+all:
+ @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ SET_MAKE=
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+ # test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='libmad'
+ VERSION='0.15.0b'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STRIP=$ac_ct_STRIP
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+
+
+
+
+ ac_config_headers="$ac_config_headers config.h"
+
+
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+ ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+ ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output" >&5
+echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ ''\
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);' \
+ '#include <stdlib.h>'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+
+depcc="$CC" am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ echo '#include "conftest.h"' > conftest.c
+ echo 'int i;' > conftest.h
+ echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=conftest.c object=conftest.o \
+ depfile=conftest.Po tmpdepfile=conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o conftest.o conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep conftest.h conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored.
+ if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+# By default we simply use the C compiler to build assembly code.
+
+: ${CCAS='$(CC)'}
+# Set ASFLAGS if not already set.
+: ${CCASFLAGS='$(CFLAGS)'}
+
+
+
+if test "$GCC" = yes
+then
+ case "$host" in
+ *-*-mingw*)
+ case "$build" in
+ *-*-cygwin*)
+ CPPFLAGS="$CPPFLAGS -mno-cygwin"
+ LDFLAGS="$LDFLAGS -mno-cygwin"
+ ;;
+ esac
+ esac
+
+fi
+
+
+# Check whether --enable-shared or --disable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_shared=yes ;;
+no) enable_shared=no ;;
+*)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_shared=yes
+fi;
+# Check whether --enable-static or --disable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval="$enable_static"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_static=yes ;;
+no) enable_static=no ;;
+*)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_static=yes
+fi;
+# Check whether --enable-fast-install or --disable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
+case $enableval in
+yes) enable_fast_install=yes ;;
+no) enable_fast_install=no ;;
+*)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
+ for pkg in $enableval; do
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$ac_save_ifs"
+ ;;
+esac
+else
+ enable_fast_install=yes
+fi;
+# Find the correct PATH separator. Usually this is `:', but
+# DJGPP uses `;' like DOS.
+if test "X${PATH_SEPARATOR+set}" != Xset; then
+ UNAME=${UNAME-`uname 2>/dev/null`}
+ case X$UNAME in
+ *-DOS) lt_cv_sys_path_separator=';' ;;
+ *) lt_cv_sys_path_separator=':' ;;
+ esac
+ PATH_SEPARATOR=$lt_cv_sys_path_separator
+fi
+
+
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi;
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ echo "$as_me:$LINENO: checking for ld used by GCC" >&5
+echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | [A-Za-z]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
+else
+ echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -z "$LD"; then
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some GNU ld's only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
+ test "$with_gnu_ld" != no && break
+ else
+ test "$with_gnu_ld" != yes && break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+ lt_cv_prog_gnu_ld=yes
+else
+ lt_cv_prog_gnu_ld=no
+fi
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
+reload_flag=$lt_cv_ld_reload_flag
+test -n "$reload_flag" && reload_flag=" $reload_flag"
+
+echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6
+if test "${lt_cv_path_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm=$ac_dir/${ac_tool_prefix}nm
+ if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ else
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi
+fi
+
+NM="$lt_cv_path_NM"
+echo "$as_me:$LINENO: result: $NM" >&5
+echo "${ECHO_T}$NM" >&6
+
+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
+if test "${lt_cv_path_SED+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_executable_p="test -f"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ _sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+
+ # Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/sedXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=$TMPDIR/sed$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+ { (exit 1); exit 1; }
+}
+ _max=0
+ _count=0
+ # Add /usr/xpg4/bin/sed as it is typically found on Solaris
+ # along with /bin/sed that truncates output.
+ for _sed in $_sed_list /usr/xpg4/bin/sed; do
+ test ! -f ${_sed} && break
+ cat /dev/null > "$tmp/sed.in"
+ _count=0
+ echo ${ECHO_N-$ac_n} "0123456789${ECHO_C-$ac_c}" >"$tmp/sed.in"
+ # Check for GNU sed and select it if it is found.
+ if "${_sed}" --version 2>&1 < /dev/null | egrep '(GNU)' > /dev/null; then
+ lt_cv_path_SED=${_sed}
+ break
+ fi
+ while true; do
+ cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
+ mv "$tmp/sed.tmp" "$tmp/sed.in"
+ cp "$tmp/sed.in" "$tmp/sed.nl"
+ echo >>"$tmp/sed.nl"
+ ${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
+ cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
+ # 40000 chars as input seems more than enough
+ test $_count -gt 10 && break
+ _count=`expr $_count + 1`
+ if test $_count -gt $_max; then
+ _max=$_count
+ lt_cv_path_SED=$_sed
+ fi
+ done
+ done
+ rm -rf "$tmp"
+
+fi
+
+if test "X$SED" != "X"; then
+ lt_cv_path_SED=$SED
+else
+ SED=$lt_cv_path_SED
+fi
+echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given egrep regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix4* | aix5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi4*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin* | mingw* | pw32*)
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ case "$host_os" in
+ rhapsody* | darwin1.[012])
+ lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+ ;;
+ *) # Darwin 1.3 on
+ lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+ ;;
+ esac
+ ;;
+
+freebsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20*|hpux11*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ irix5* | nonstopux*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
+ ;;
+ *)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
+ ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ case $host_cpu in
+ alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64* | arm* | m68k)
+ lt_cv_deplibs_check_method=pass_all ;;
+ *)
+ # glibc up to 2.1.1 does not perform some relocations on ARM
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
+ esac
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+openbsd*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
+ else
+ lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ # this will be overridden with pass_all, but let us keep it just in case
+ lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sco3.2v5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+
+sysv5uw[78]* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+esac
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+
+
+
+
+
+
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+echo "$as_me:$LINENO: checking command to parse $NM output" >&5
+echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Transform the above into a raw symbol and a C symbol.
+symxfrm='\1 \2\3 \3'
+
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*) # Its linker distinguishes data from code symbols
+ lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris* | sysv5*)
+ symcode='[BDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $host_os in
+mingw*)
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
+ symcode='[ABCDGISTW]'
+fi
+
+# Try without a prefix undercore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Write the raw and C identifiers.
+lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+ rm -f conftest*
+ cat > conftest.$ac_ext <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+ (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if egrep ' nm_test_var$' "$nlist" >/dev/null; then
+ if egrep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
+
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{
+EOF
+ sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr) 0}
+};
+
+#ifdef __cplusplus
+}
+#endif
+EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ save_LIBS="$LIBS"
+ save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$no_builtin_flag"
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest$ac_exeext; then
+ pipe_works=yes
+ fi
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -f conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ global_symbol_to_cdecl=
+ global_symbol_to_c_name_address=
+else
+ global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
+ global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
+fi
+if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
+then
+ echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
+else
+ echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+# Only perform the check for file, if the check method requires it
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="/usr/bin:$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $MAGIC_CMD in
+ /*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
+ ;;
+ *)
+ ac_save_MAGIC_CMD="$MAGIC_CMD"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="/usr/bin:$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ egrep "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ MAGIC_CMD="$ac_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ RANLIB=$ac_ct_RANLIB
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ STRIP=$ac_ct_STRIP
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+enable_dlopen=no
+enable_win32_dll=no
+
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval="$enable_libtool_lock"
+
+fi;
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 4622 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ lt_cv_cc_needs_belf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+lt_cv_cc_needs_belf=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+
+
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except M$VC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+need_locks="$enable_libtool_lock"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+if test x"$host" != x"$build"; then
+ ac_tool_prefix=${host_alias}-
+else
+ ac_tool_prefix=
+fi
+
+# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+case $host_os in
+linux-gnu*) ;;
+linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+esac
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
+ ;;
+ *)
+ old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+# Allow CC to be a program name with arguments.
+set dummy $CC
+compiler="$2"
+
+echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6
+rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+echo "$as_me:$LINENO: result: $objdir" >&5
+echo "${ECHO_T}$objdir" >&6
+
+
+
+# Check whether --with-pic or --without-pic was given.
+if test "${with_pic+set}" = set; then
+ withval="$with_pic"
+ pic_mode="$withval"
+else
+ pic_mode=default
+fi;
+test -z "$pic_mode" && pic_mode=default
+
+# We assume here that the value for lt_cv_prog_cc_pic will not be cached
+# in isolation, and that seeing it set (from the cache) indicates that
+# the associated values are set (in the cache) correctly too.
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
+if test "${lt_cv_prog_cc_pic+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_cc_pic=
+ lt_cv_prog_cc_shlib=
+ lt_cv_prog_cc_wl=
+ lt_cv_prog_cc_static=
+ lt_cv_prog_cc_no_builtin=
+ lt_cv_prog_cc_can_build_shared=$can_build_shared
+
+ if test "$GCC" = yes; then
+ lt_cv_prog_cc_wl='-Wl,'
+ lt_cv_prog_cc_static='-static'
+
+ case $host_os in
+ aix*)
+ # Below there is a dirty hack to force normal static linking with -ldl
+ # The problem is because libdl dynamically linked with both libc and
+ # libC (AIX C++ library), which obviously doesn't included in libraries
+ # list by gcc. This cause undefined symbols with -static flags.
+ # This hack allows C programs to be linked with "-static -ldl", but
+ # not sure about C++ programs.
+ lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
+ ;;
+ amigaos*)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_cv_prog_cc_pic='-fno-common'
+ ;;
+ cygwin* | mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_cv_prog_cc_pic='-DDLL_EXPORT'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_cv_prog_cc_pic=-Kconform_pic
+ fi
+ ;;
+ *)
+ lt_cv_prog_cc_pic='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for PIC flags for the system compiler.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ lt_cv_prog_cc_wl='-Wl,'
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_cv_prog_cc_static='-Bstatic'
+ else
+ lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
+ lt_cv_prog_cc_wl='-Wl,'
+ lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
+ lt_cv_prog_cc_pic='+Z'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_cv_prog_cc_wl='-Wl,'
+ lt_cv_prog_cc_static='-non_shared'
+ # PIC (with -KPIC) is the default.
+ ;;
+
+ cygwin* | mingw* | pw32* | os2*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_cv_prog_cc_pic='-DDLL_EXPORT'
+ ;;
+
+ newsos6)
+ lt_cv_prog_cc_pic='-KPIC'
+ lt_cv_prog_cc_static='-Bstatic'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ # All OSF/1 code is PIC.
+ lt_cv_prog_cc_wl='-Wl,'
+ lt_cv_prog_cc_static='-non_shared'
+ ;;
+
+ sco3.2v5*)
+ lt_cv_prog_cc_pic='-Kpic'
+ lt_cv_prog_cc_static='-dn'
+ lt_cv_prog_cc_shlib='-belf'
+ ;;
+
+ solaris*)
+ lt_cv_prog_cc_pic='-KPIC'
+ lt_cv_prog_cc_static='-Bstatic'
+ lt_cv_prog_cc_wl='-Wl,'
+ ;;
+
+ sunos4*)
+ lt_cv_prog_cc_pic='-PIC'
+ lt_cv_prog_cc_static='-Bstatic'
+ lt_cv_prog_cc_wl='-Qoption ld '
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ lt_cv_prog_cc_pic='-KPIC'
+ lt_cv_prog_cc_static='-Bstatic'
+ lt_cv_prog_cc_wl='-Wl,'
+ ;;
+
+ uts4*)
+ lt_cv_prog_cc_pic='-pic'
+ lt_cv_prog_cc_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_cv_prog_cc_pic='-Kconform_pic'
+ lt_cv_prog_cc_static='-Bstatic'
+ fi
+ ;;
+
+ *)
+ lt_cv_prog_cc_can_build_shared=no
+ ;;
+ esac
+ fi
+
+fi
+
+if test -z "$lt_cv_prog_cc_pic"; then
+ echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
+else
+ echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic" >&5
+echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6
+
+ # Check to make sure the pic_flag actually works.
+ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6
+ if test "${lt_cv_prog_cc_pic_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ case $host_os in
+ hpux9* | hpux10* | hpux11*)
+ # On HP-UX, both CC and GCC only warn that PIC is supported... then
+ # they create non-PIC objects. So, if there were any warnings, we
+ # assume that PIC is not supported.
+ if test -s conftest.err; then
+ lt_cv_prog_cc_pic_works=no
+ else
+ lt_cv_prog_cc_pic_works=yes
+ fi
+ ;;
+ *)
+ lt_cv_prog_cc_pic_works=yes
+ ;;
+ esac
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ lt_cv_prog_cc_pic_works=no
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+
+fi
+
+
+ if test "X$lt_cv_prog_cc_pic_works" = Xno; then
+ lt_cv_prog_cc_pic=
+ lt_cv_prog_cc_can_build_shared=no
+ else
+ lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
+ fi
+
+ echo "$as_me:$LINENO: result: $lt_cv_prog_cc_pic_works" >&5
+echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6
+fi
+
+# Check for any special shared library compilation flags.
+if test -n "$lt_cv_prog_cc_shlib"; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5
+echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;}
+ if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then :
+ else
+ { echo "$as_me:$LINENO: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5
+echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;}
+ lt_cv_prog_cc_can_build_shared=no
+ fi
+fi
+
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6
+if test "${lt_cv_prog_cc_static_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_cc_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ lt_cv_prog_cc_static_works=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+
+
+# Belt *and* braces to stop my trousers falling down:
+test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
+echo "$as_me:$LINENO: result: $lt_cv_prog_cc_static_works" >&5
+echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6
+
+pic_flag="$lt_cv_prog_cc_pic"
+special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
+wl="$lt_cv_prog_cc_wl"
+link_static_flag="$lt_cv_prog_cc_static"
+no_builtin_flag="$lt_cv_prog_cc_no_builtin"
+can_build_shared="$lt_cv_prog_cc_can_build_shared"
+
+
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
+if test "${lt_cv_compiler_c_o+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+$rm -r conftest 2>/dev/null
+mkdir conftest
+cd conftest
+echo "int some_variable = 0;" > conftest.$ac_ext
+mkdir out
+# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
+# that will create temporary files in the current directory regardless of
+# the output directory. Thus, making CWD read-only will cause this test
+# to fail, enabling locking or at least warning the user not to do parallel
+# builds.
+chmod -w .
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
+compiler_c_o=no
+if { (eval echo configure:5151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s out/conftest.err; then
+ lt_cv_compiler_c_o=no
+ else
+ lt_cv_compiler_c_o=yes
+ fi
+else
+ # Append any errors to the config.log.
+ cat out/conftest.err 1>&5
+ lt_cv_compiler_c_o=no
+fi
+CFLAGS="$save_CFLAGS"
+chmod u+w .
+$rm conftest* out/*
+rmdir out
+cd ..
+rmdir conftest
+$rm -r conftest 2>/dev/null
+
+fi
+
+compiler_c_o=$lt_cv_compiler_c_o
+echo "$as_me:$LINENO: result: $compiler_c_o" >&5
+echo "${ECHO_T}$compiler_c_o" >&6
+
+if test x"$compiler_c_o" = x"yes"; then
+ # Check to see if we can write to a .lo
+ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.lo" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6
+ if test "${lt_cv_compiler_o_lo+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ lt_cv_compiler_o_lo=no
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -c -o conftest.lo"
+ save_objext="$ac_objext"
+ ac_objext=lo
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+int some_variable = 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ lt_cv_compiler_o_lo=no
+ else
+ lt_cv_compiler_o_lo=yes
+ fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ ac_objext="$save_objext"
+ CFLAGS="$save_CFLAGS"
+
+fi
+
+ compiler_o_lo=$lt_cv_compiler_o_lo
+ echo "$as_me:$LINENO: result: $compiler_o_lo" >&5
+echo "${ECHO_T}$compiler_o_lo" >&6
+else
+ compiler_o_lo=no
+fi
+
+# Check to see if we can do hard links to lock some files if needed
+hard_links="nottested"
+if test "$compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
+ if test "$hard_links" = no; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+if test "$GCC" = yes; then
+ # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
+ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
+ compiler_rtti_exceptions=no
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+int some_variable = 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ compiler_rtti_exceptions=no
+ else
+ compiler_rtti_exceptions=yes
+ fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$save_CFLAGS"
+ echo "$as_me:$LINENO: result: $compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$compiler_rtti_exceptions" >&6
+
+ if test "$compiler_rtti_exceptions" = "yes"; then
+ no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
+ else
+ no_builtin_flag=' -fno-builtin'
+ fi
+fi
+
+# See if the linker supports building shared libraries.
+echo "$as_me:$LINENO: checking whether the linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6
+
+allow_undefined_flag=
+no_undefined_flag=
+need_lib_prefix=unknown
+need_version=unknown
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+archive_cmds=
+archive_expsym_cmds=
+old_archive_from_new_cmds=
+old_archive_from_expsyms_cmds=
+export_dynamic_flag_spec=
+whole_archive_flag_spec=
+thread_safe_flag_spec=
+hardcode_into_libs=no
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+hardcode_shlibpath_var=unsupported
+runpath_var=
+link_all_deplibs=unknown
+always_export_symbols=no
+export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
+# include_expsyms should be a list of space-separated symbols to be *always*
+# included in the symbol list
+include_expsyms=
+# exclude_expsyms can be an egrep regular expression of symbols to exclude
+# it will be wrapped by ` (' and `)$', so one must not match beginning or
+# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+# as well as any symbol that contains `d'.
+exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
+# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+# platforms (ab)use it in PIC code, but their linkers get confused if
+# the symbol is explicitly referenced. Since portable code cannot
+# rely on this symbol name, it's probably fine to never include it in
+# preloaded symbol tables.
+extract_expsyms_cmds=
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+openbsd*)
+ with_gnu_ld=no
+ ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix3* | aix4* | aix5*)
+ # On AIX, the GNU linker is very broken
+ # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can use
+ # them.
+ ld_shlibs=no
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+
+ extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
+ sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
+ test -f $output_objdir/impgen.exe || (cd $output_objdir && \
+ if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
+ else $CC -o impgen impgen.c ; fi)~
+ $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
+
+ old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
+
+ # cygwin and mingw dlls have different entry points and sets of symbols
+ # to exclude.
+ # FIXME: what about values for MSVC?
+ dll_entry=__cygwin_dll_entry@12
+ dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
+ case $host_os in
+ mingw*)
+ # mingw values
+ dll_entry=_DllMainCRTStartup@12
+ dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
+ ;;
+ esac
+
+ # mingw and cygwin differ, and it's simplest to just exclude the union
+ # of the two symbol sets.
+ dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
+
+ # recent cygwin and mingw systems supply a stub DllMain which the user
+ # can override, but on older systems we have to supply one (in ltdll.c)
+ if test "x$lt_cv_need_dllmain" = "xyes"; then
+ ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
+ ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
+ test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
+ else
+ ltdll_obj=
+ ltdll_cmds=
+ fi
+
+ # Extract the symbol export list from an `--export-all' def file,
+ # then regenerate the def file from the symbol export list, so that
+ # the compiled dll only exports the symbol export list.
+ # Be careful not to strip the DATA tag left be newer dlltools.
+ export_symbols_cmds="$ltdll_cmds"'
+ $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
+ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
+
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is.
+ # If DATA tags from a recent dlltool are present, honour them!
+ archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname-def;
+ else
+ echo EXPORTS > $output_objdir/$soname-def;
+ _lt_hint=1;
+ cat $export_symbols | while read symbol; do
+ set dummy \$symbol;
+ case \$# in
+ 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
+ 4) echo " \$2 \$3 \$4 ; " >> $output_objdir/$soname-def; _lt_hint=`expr \$_lt_hint - 1`;;
+ *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;;
+ esac;
+ _lt_hint=`expr 1 + \$_lt_hint`;
+ done;
+ fi~
+ '"$ltdll_cmds"'
+ $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
+ $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
+ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
+ $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris* | sysv5*)
+ if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+EOF
+ elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = yes; then
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # dlltool doesn't understand --whole-archive et. al.
+ whole_archive_flag_spec=
+ ;;
+ *)
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ ;;
+ esac
+ fi
+else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$link_static_flag"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix4* | aix5*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ hardcode_direct=yes
+ archive_cmds=''
+ hardcode_libdir_separator=':'
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ hardcode_direct=yes
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ esac
+
+ shared_flag='-shared'
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ shared_flag='${wl}-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ # It seems that -bexpall can do strange things, so it is better to
+ # generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
+ archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
+ else
+ hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='${wl}-berok'
+ # This is a bit strange, but is similar to how AIX traditionally builds
+ # it's shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ ;;
+
+ darwin* | rhapsody*)
+ case "$host_os" in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag='-undefined suppress'
+ ;;
+ *) # Darwin 1.3 on
+ allow_undefined_flag='-flat_namespace -undefined suppress'
+ ;;
+ esac
+ # FIXME: Relying on posixy $() will cause problems for
+ # cross-compilation, but unfortunately the echo tests do not
+ # yet detect zsh echo's removal of \ escapes. Also zsh mangles
+ # `"' quotes if we put them in here... so don't!
+ archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
+ # We need to add '_' to the symbols in $export_symbols first
+ #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ whole_archive_flag_spec='-all_load $convenience'
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ case $host_os in
+ hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+ *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+ esac
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_minus_L=yes # Not in the search PATH, but as the default
+ # location of the library.
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ openbsd*)
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case "$host_os" in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
+
+ #Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ hardcode_libdir_separator=:
+ ;;
+
+ sco3.2v5*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ ;;
+
+ solaris*)
+ # gcc --version < 3.0 without binutils cannot create self contained
+ # shared libraries reliably, requiring libgcc.a to resolve some of
+ # the object symbols generated in some cases. Libraries that use
+ # assert need libgcc.a to resolve __eprintf, for example. Linking
+ # a copy of libgcc.a into every shared library to guarantee resolving
+ # such symbols causes other problems: According to Tim Van Holder
+ # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
+ # (to the application) exception stack for one thing.
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ case `$CC --version 2>/dev/null` in
+ [12].*)
+ cat <<EOF 1>&2
+
+*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
+*** create self contained shared libraries on Solaris systems, without
+*** introducing a dependency on libgcc.a. Therefore, libtool is disabling
+*** -no-undefined support, which will at least allow you to build shared
+*** libraries. However, you may find that when you link such libraries
+*** into an application without using GCC, you have to manually add
+*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to
+*** upgrade to a newer version of GCC. Another option is to rebuild your
+*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
+
+EOF
+ no_undefined_flag=
+ ;;
+ esac
+ fi
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *) # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv5*)
+ no_undefined_flag=' -z text'
+ # $CC -shared without GNU ld will not create a library from C++
+ # object files and a static libstdc++, better avoid it by now
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
+ hardcode_libdir_flag_spec=
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4.2uw2*)
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=no
+ hardcode_runpath_var=yes
+ runpath_var=LD_RUN_PATH
+ ;;
+
+ sysv5uw7* | unixware7*)
+ no_undefined_flag='${wl}-z ${wl}text'
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+fi
+echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6
+test "$ld_shlibs" = no && can_build_shared=no
+
+# Check hardcoding attributes.
+echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var"; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$hardcode_shlibpath_var" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6
+
+striplib=
+old_striplib=
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+# PORTME Fill in your ld.so characteristics
+echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}.so$major'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can
+ # not hardcode correct soname into executable. Probably we can
+ # add versioning support to collect2, so additional links can
+ # be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}.so$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ hardcode_into_libs=yes
+ ;;
+
+amigaos*)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
+ ;;
+
+beos*)
+ library_names_spec='${libname}.so'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi4*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ export_dynamic_flag_spec=-rdynamic
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32*)
+ version_type=windows
+ need_version=no
+ need_lib_prefix=no
+ case $GCC,$host_os in
+ yes,cygwin*)
+ library_names_spec='$libname.dll.a'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+ postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog .libs/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $rm \$dlpath'
+ ;;
+ yes,mingw*)
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g" -e "s,=/,/,g"`
+ ;;
+ yes,pw32*)
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll'
+ ;;
+ *)
+ library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ # FIXME: Relying on posixy $() will cause problems for
+ # cross-compilation, but unfortunately the echo tests do not
+ # yet detect zsh echo's removal of \ escapes.
+ library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
+ soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd*-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='GNU/FreeBSD ld.so'
+ ;;
+
+freebsd*)
+ objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ *)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ dynamic_linker="$host_os dld.sl"
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
+ soname_spec='${libname}${release}.sl$major'
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *) version_type=irix ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux-gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
+ soname_spec='${libname}${release}.so$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+openbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case "$host_os" in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+os2*)
+ libname_spec='$name'
+ need_lib_prefix=no
+ library_names_spec='$libname.dll $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_version=no
+ need_lib_prefix=no
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ hardcode_into_libs=yes
+ ;;
+
+sco3.2v5*)
+ version_type=osf
+ soname_spec='${libname}${release}.so$major'
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
+ soname_spec='${libname}${release}.so$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
+ soname_spec='$libname.so.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
+test "$dynamic_linker" = no && can_build_shared=no
+
+# Report the final consequences.
+echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6
+
+echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case "$host_os" in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+aix4*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
+
+echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
+
+if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ *)
+ echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
+if test "${ac_cv_func_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
+choke me
+#else
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != shl_load;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_shl_load=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
+if test $ac_cv_func_shl_load = yes; then
+ lt_cv_dlopen="shl_load"
+else
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char shl_load ();
+int
+main ()
+{
+shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_shl_load=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+if test $ac_cv_lib_dld_shl_load = yes; then
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+ echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+if test "${ac_cv_func_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != dlopen;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_dlopen=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+if test $ac_cv_func_dlopen = yes; then
+ lt_cv_dlopen="dlopen"
+else
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen ();
+int
+main ()
+{
+dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_svld_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_svld_dlopen=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
+if test $ac_cv_lib_svld_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dld_link ();
+int
+main ()
+{
+dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_dld_dld_link=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_dld_dld_link=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
+if test $ac_cv_lib_dld_dld_link = yes; then
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+#line 6996 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+
+ exit (status);
+}
+EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_unknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ LDFLAGS="$LDFLAGS $link_static_flag"
+ echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<EOF
+#line 7094 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+
+ exit (status);
+}
+EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
+ if test "${lt_cv_archive_cmds_need_lc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ $rm conftest*
+ echo 'static int dummy;' > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_cv_prog_cc_wl
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+fi
+
+ echo "$as_me:$LINENO: result: $lt_cv_archive_cmds_need_lc" >&5
+echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6
+ ;;
+ esac
+fi
+need_lc=${lt_cv_archive_cmds_need_lc-yes}
+
+# The second clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ :
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ test -f Makefile && make "$ltmain"
+fi
+
+if test -f "$ltmain"; then
+ trap "$rm \"${ofile}T\"; exit 1" 1 2 15
+ $rm -f "${ofile}T"
+
+ echo creating $ofile
+
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS SED \
+ AR AR_FLAGS CC LD LN_S NM SHELL \
+ reload_flag reload_cmds wl \
+ pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
+ thread_safe_flag_spec whole_archive_flag_spec libname_spec \
+ library_names_spec soname_spec \
+ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
+ old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
+ postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
+ old_striplib striplib file_magic_cmd export_symbols_cmds \
+ deplibs_check_method allow_undefined_flag no_undefined_flag \
+ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
+ global_symbol_to_c_name_address \
+ hardcode_libdir_flag_spec hardcode_libdir_separator \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
+
+ case $var in
+ reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
+ extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ cat <<__EOF__ > "${ofile}T"
+#! $SHELL
+
+# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# A sed that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="${SED} -e s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$need_lc
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# The default C compiler.
+CC=$lt_CC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_wl
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_pic_flag
+pic_mode=$pic_mode
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_compiler_c_o
+
+# Can we write directly to a .lo ?
+compiler_o_lo=$lt_compiler_o_lo
+
+# Must we lock files when doing compilation ?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_link_static_flag
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path="$fix_srcfile_path"
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "${ofile}T"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2*)
+ cat <<'EOF' >> "${ofile}T"
+ # This is a source program that is used to create dlls on Windows
+ # Don't remove nor modify the starting and closing comments
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+ # This is a source program that is used to create import libraries
+ # on Windows for dlls which lack them. Don't remove nor modify the
+ # starting and closing comments
+# /* impgen.c starts here */
+# /* Copyright (C) 1999-2000 Free Software Foundation, Inc.
+#
+# This file is part of GNU libtool.
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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 <stdio.h> /* for printf() */
+# #include <unistd.h> /* for open(), lseek(), read() */
+# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
+# #include <string.h> /* for strdup() */
+#
+# /* O_BINARY isn't required (or even defined sometimes) under Unix */
+# #ifndef O_BINARY
+# #define O_BINARY 0
+# #endif
+#
+# static unsigned int
+# pe_get16 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[2];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 2);
+# return b[0] + (b[1]<<8);
+# }
+#
+# static unsigned int
+# pe_get32 (fd, offset)
+# int fd;
+# int offset;
+# {
+# unsigned char b[4];
+# lseek (fd, offset, SEEK_SET);
+# read (fd, b, 4);
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# static unsigned int
+# pe_as32 (ptr)
+# void *ptr;
+# {
+# unsigned char *b = ptr;
+# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
+# }
+#
+# int
+# main (argc, argv)
+# int argc;
+# char *argv[];
+# {
+# int dll;
+# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
+# unsigned long export_rva, export_size, nsections, secptr, expptr;
+# unsigned long name_rvas, nexp;
+# unsigned char *expdata, *erva;
+# char *filename, *dll_name;
+#
+# filename = argv[1];
+#
+# dll = open(filename, O_RDONLY|O_BINARY);
+# if (dll < 1)
+# return 1;
+#
+# dll_name = filename;
+#
+# for (i=0; filename[i]; i++)
+# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
+# dll_name = filename + i +1;
+#
+# pe_header_offset = pe_get32 (dll, 0x3c);
+# opthdr_ofs = pe_header_offset + 4 + 20;
+# num_entries = pe_get32 (dll, opthdr_ofs + 92);
+#
+# if (num_entries < 1) /* no exports */
+# return 1;
+#
+# export_rva = pe_get32 (dll, opthdr_ofs + 96);
+# export_size = pe_get32 (dll, opthdr_ofs + 100);
+# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
+# secptr = (pe_header_offset + 4 + 20 +
+# pe_get16 (dll, pe_header_offset + 4 + 16));
+#
+# expptr = 0;
+# for (i = 0; i < nsections; i++)
+# {
+# char sname[8];
+# unsigned long secptr1 = secptr + 40 * i;
+# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
+# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
+# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
+# lseek(dll, secptr1, SEEK_SET);
+# read(dll, sname, 8);
+# if (vaddr <= export_rva && vaddr+vsize > export_rva)
+# {
+# expptr = fptr + (export_rva - vaddr);
+# if (export_rva + export_size > vaddr + vsize)
+# export_size = vsize - (export_rva - vaddr);
+# break;
+# }
+# }
+#
+# expdata = (unsigned char*)malloc(export_size);
+# lseek (dll, expptr, SEEK_SET);
+# read (dll, expdata, export_size);
+# erva = expdata - export_rva;
+#
+# nexp = pe_as32 (expdata+24);
+# name_rvas = pe_as32 (expdata+32);
+#
+# printf ("EXPORTS\n");
+# for (i = 0; i<nexp; i++)
+# {
+# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
+# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
+# }
+#
+# return 0;
+# }
+# /* impgen.c ends here */
+
+EOF
+ ;;
+ esac
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
+
+ mv -f "${ofile}T" "$ofile" || \
+ (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
+ chmod +x "$ofile"
+fi
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
+
+
+
+
+
+
+arch=""
+debug=""
+optimize=""
+profile=""
+
+set -- $CFLAGS
+CFLAGS=""
+
+if test "$GCC" = yes
+then
+ CFLAGS="-Wall"
+fi
+
+while test $# -gt 0
+do
+ case "$1" in
+ -Wall)
+ if test "$GCC" = yes
+ then
+ :
+ else
+ CFLAGS="$CFLAGS $1"
+ fi
+ shift
+ ;;
+ -g)
+ debug="-g"
+ shift
+ ;;
+ -mno-cygwin)
+ shift
+ ;;
+ -m*)
+ arch="$arch $1"
+ shift
+ ;;
+ -O2)
+ optimize="-O"
+ shift
+ ;;
+ -fomit-frame-pointer)
+ shift
+ ;;
+ -O*|-f*)
+ optimize="$optimize $1"
+ shift
+ ;;
+ *)
+ CFLAGS="$CFLAGS $1"
+ shift
+ ;;
+ esac
+done
+
+if test "$GCC" = yes
+then
+ if test -z "$arch"
+ then
+ case "$host" in
+ i386-*) ;;
+ i?86-*) arch="-march=i486" ;;
+ arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;;
+ armv4*-*) arch="-march=armv4 -mtune=strongarm" ;;
+ powerpc-*) ;;
+ mips*-agenda-*) arch="-mcpu=vr4100" ;;
+ mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
+ esac
+ fi
+
+ case "$optimize" in
+ -O|"-O "*)
+ optimize="-O"
+ optimize="$optimize -fforce-mem"
+ optimize="$optimize -fforce-addr"
+ : #x optimize="$optimize -finline-functions"
+ : #- optimize="$optimize -fstrength-reduce"
+ optimize="$optimize -fthread-jumps"
+ optimize="$optimize -fcse-follow-jumps"
+ optimize="$optimize -fcse-skip-blocks"
+ : #x optimize="$optimize -frerun-cse-after-loop"
+ : #x optimize="$optimize -frerun-loop-opt"
+ : #x optimize="$optimize -fgcse"
+ optimize="$optimize -fexpensive-optimizations"
+ optimize="$optimize -fregmove"
+ : #* optimize="$optimize -fdelayed-branch"
+ : #x optimize="$optimize -fschedule-insns"
+ optimize="$optimize -fschedule-insns2"
+ : #? optimize="$optimize -ffunction-sections"
+ : #? optimize="$optimize -fcaller-saves"
+ : #> optimize="$optimize -funroll-loops"
+ : #> optimize="$optimize -funroll-all-loops"
+ : #x optimize="$optimize -fmove-all-movables"
+ : #x optimize="$optimize -freduce-all-givs"
+ : #? optimize="$optimize -fstrict-aliasing"
+ : #* optimize="$optimize -fstructure-noalias"
+
+ case "$host" in
+ arm*-*)
+ optimize="$optimize -fstrength-reduce"
+ ;;
+ mips*-*)
+ optimize="$optimize -fstrength-reduce"
+ optimize="$optimize -finline-functions"
+ ;;
+ i?86-*)
+ optimize="$optimize -fstrength-reduce"
+ ;;
+ powerpc-apple-*)
+ # this triggers an internal compiler error with gcc2
+ : #optimize="$optimize -fstrength-reduce"
+
+ # this is really only beneficial with gcc3
+ : #optimize="$optimize -finline-functions"
+ ;;
+ *)
+ # this sometimes provokes bugs in gcc 2.95.2
+ : #optimize="$optimize -fstrength-reduce"
+ ;;
+ esac
+ ;;
+ esac
+fi
+
+case "$host" in
+ mips*-agenda-*)
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MADD16_ASM 1
+_ACEOF
+
+ ;;
+ mips*-luxsonor-*)
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MADD_ASM 1
+_ACEOF
+
+ ;;
+esac
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6
+if test "${ac_cv_header_sys_wait_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+int
+main ()
+{
+ int s;
+ wait (&s);
+ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_sys_wait_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
+if test $ac_cv_header_sys_wait_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_WAIT_H 1
+_ACEOF
+
+fi
+
+
+
+
+
+
+
+for ac_header in assert.h limits.h unistd.h sys/types.h fcntl.h errno.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+ yes:no )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+ no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_c_const=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6
+if test "${ac_cv_c_inline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ no)
+cat >>confdefs.h <<\_ACEOF
+#define inline
+_ACEOF
+ ;;
+ *) cat >>confdefs.h <<_ACEOF
+#define inline $ac_cv_c_inline
+_ACEOF
+ ;;
+esac
+
+echo "$as_me:$LINENO: checking for pid_t" >&5
+echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
+if test "${ac_cv_type_pid_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((pid_t *) 0)
+ return 0;
+if (sizeof (pid_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_pid_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_pid_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+echo "${ECHO_T}$ac_cv_type_pid_t" >&6
+if test $ac_cv_type_pid_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking for int" >&5
+echo $ECHO_N "checking for int... $ECHO_C" >&6
+if test "${ac_cv_type_int+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((int *) 0)
+ return 0;
+if (sizeof (int))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_int=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_int=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
+echo "${ECHO_T}$ac_cv_type_int" >&6
+
+echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6
+if test "${ac_cv_sizeof_int+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_int" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_int=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (int)); }
+unsigned long ulongval () { return (long) (sizeof (int)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (int))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (int))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (int))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_int=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (int), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_int=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6
+if test "${ac_cv_type_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((long *) 0)
+ return 0;
+if (sizeof (long))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6
+
+echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_long" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (long)); }
+unsigned long ulongval () { return (long) (sizeof (long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (long))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (long))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_long=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6
+if test "${ac_cv_type_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if ((long long *) 0)
+ return 0;
+if (sizeof (long long))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_long_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_type_long_long=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_long_long" >&6
+
+echo "$as_me:$LINENO: checking size of long long" >&5
+echo $ECHO_N "checking size of long long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$ac_cv_type_long_long" = yes; then
+ # The cast to unsigned long works around a bug in the HP C Compiler
+ # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+ # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+ # This bug is HP SR number 8606223364.
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo= ac_hi=
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; } ;;
+esac
+else
+ if test "$cross_compiling" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run test program while cross compiling
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+long longval () { return (long) (sizeof (long long)); }
+unsigned long ulongval () { return (long) (sizeof (long long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ exit (1);
+ if (((long) (sizeof (long long))) < 0)
+ {
+ long i = longval ();
+ if (i != ((long) (sizeof (long long))))
+ exit (1);
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long i = ulongval ();
+ if (i != ((long) (sizeof (long long))))
+ exit (1);
+ fprintf (f, "%lu\n", i);
+ }
+ exit (ferror (f) || fclose (f) != 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long_long=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (long long), 77
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+ ac_cv_sizeof_long_long=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+
+
+
+
+
+
+for ac_func in waitpid fcntl pipe fork
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+echo "$as_me:$LINENO: checking whether to optimize for speed or for accuracy" >&5
+echo $ECHO_N "checking whether to optimize for speed or for accuracy... $ECHO_C" >&6
+
+# Check whether --enable-speed or --disable-speed was given.
+if test "${enable_speed+set}" = set; then
+ enableval="$enable_speed"
+
+ case "$enableval" in
+ yes)
+ optimize_for="speed"
+
+cat >>confdefs.h <<\_ACEOF
+#define OPT_SPEED 1
+_ACEOF
+
+ ;;
+ esac
+
+fi;
+
+# Check whether --enable-accuracy or --disable-accuracy was given.
+if test "${enable_accuracy+set}" = set; then
+ enableval="$enable_accuracy"
+
+ case "$enableval" in
+ yes)
+ if test "$optimize_for" = "speed"
+ then
+ optimize_for="both"
+ else
+ optimize_for="accuracy"
+ fi
+
+cat >>confdefs.h <<\_ACEOF
+#define OPT_ACCURACY 1
+_ACEOF
+
+ ;;
+ esac
+
+fi;
+
+echo "$as_me:$LINENO: result: ${optimize_for-default}" >&5
+echo "${ECHO_T}${optimize_for-default}" >&6
+
+if test "$optimize_for" = "both"
+then
+ { { echo "$as_me:$LINENO: error: cannot optimize for both speed and accuracy" >&5
+echo "$as_me: error: cannot optimize for both speed and accuracy" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+echo "$as_me:$LINENO: checking for architecture-specific fixed-point math routines" >&5
+echo $ECHO_N "checking for architecture-specific fixed-point math routines... $ECHO_C" >&6
+# Check whether --enable-fpm or --disable-fpm was given.
+if test "${enable_fpm+set}" = set; then
+ enableval="$enable_fpm"
+
+ case "$enableval" in
+ yes) ;;
+ no|default|approx) FPM="DEFAULT" ;;
+ intel|i?86) FPM="INTEL" ;;
+ arm) FPM="ARM" ;;
+ mips) FPM="MIPS" ;;
+ sparc) FPM="SPARC" ;;
+ ppc|powerpc) FPM="PPC" ;;
+ 64bit) FPM="64BIT" ;;
+ float) FPM="FLOAT" ;;
+ *)
+ echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
+ { { echo "$as_me:$LINENO: error: bad --enable-fpm option" >&5
+echo "$as_me: error: bad --enable-fpm option" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+
+fi;
+
+if test -z "$FPM" && test "$GCC" = yes
+then
+ case "$host" in
+ i?86-*) FPM="INTEL" ;;
+ arm*-*) FPM="ARM" ;;
+ mips*-*) FPM="MIPS" ;;
+ sparc*-*) FPM="SPARC" ;;
+ powerpc*-*) FPM="PPC" ;;
+ # FIXME: need to test for 64-bit long long...
+ esac
+fi
+
+echo "$as_me:$LINENO: result: ${FPM=DEFAULT}" >&5
+echo "${ECHO_T}${FPM=DEFAULT}" >&6
+
+if test "$FPM" = "DEFAULT"
+then
+ { echo "$as_me:$LINENO: WARNING: default fixed-point math will yield limited accuracy" >&5
+echo "$as_me: WARNING: default fixed-point math will yield limited accuracy" >&2;}
+fi
+
+FPM="-DFPM_$FPM"
+
+# Check whether --enable-sso or --disable-sso was given.
+if test "${enable_sso+set}" = set; then
+ enableval="$enable_sso"
+
+ case "$enableval" in
+ yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define OPT_SSO 1
+_ACEOF
+
+ ;;
+ esac
+
+fi;
+
+# Check whether --enable-aso or --disable-aso was given.
+if test "${enable_aso+set}" = set; then
+ enableval="$enable_aso"
+
+else
+ enable_aso=yes
+fi;
+
+if test "$enable_aso" = yes
+then
+ case "$host" in
+ i?86-*)
+ : #ASO="$ASO -DASO_INTERLEAVE1"
+ ASO="$ASO -DASO_ZEROCHECK"
+ : #not yet #ASO="$ASO -DASO_SYNTH"
+ : #not yet #ASO_OBJS="synth_mmx.lo"
+ ;;
+ arm*-*)
+ ASO="$ASO -DASO_INTERLEAVE1"
+ ASO="$ASO -DASO_IMDCT"
+ ASO_OBJS="imdct_l_arm.lo"
+ ;;
+ mips*-*)
+ ASO="$ASO -DASO_INTERLEAVE2"
+ ASO="$ASO -DASO_ZEROCHECK"
+ ;;
+ esac
+fi
+
+echo "$as_me:$LINENO: checking for ISO/IEC interpretation" >&5
+echo $ECHO_N "checking for ISO/IEC interpretation... $ECHO_C" >&6
+# Check whether --enable-strict-iso or --disable-strict-iso was given.
+if test "${enable_strict_iso+set}" = set; then
+ enableval="$enable_strict_iso"
+
+ case "$enableval" in
+ yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define OPT_STRICT 1
+_ACEOF
+
+ interpretation="strict"
+ ;;
+ esac
+
+fi;
+echo "$as_me:$LINENO: result: ${interpretation-best accepted practices}" >&5
+echo "${ECHO_T}${interpretation-best accepted practices}" >&6
+
+echo "$as_me:$LINENO: checking whether to enable profiling" >&5
+echo $ECHO_N "checking whether to enable profiling... $ECHO_C" >&6
+# Check whether --enable-profiling or --disable-profiling was given.
+if test "${enable_profiling+set}" = set; then
+ enableval="$enable_profiling"
+
+ case "$enableval" in
+ yes) profile="-pg" ;;
+ esac
+
+fi;
+echo "$as_me:$LINENO: result: ${enable_profiling-no}" >&5
+echo "${ECHO_T}${enable_profiling-no}" >&6
+
+echo "$as_me:$LINENO: checking whether to enable debugging" >&5
+echo $ECHO_N "checking whether to enable debugging... $ECHO_C" >&6
+# Check whether --enable-debugging or --disable-debugging was given.
+if test "${enable_debugging+set}" = set; then
+ enableval="$enable_debugging"
+
+ case "$enableval" in
+ yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define DEBUG 1
+_ACEOF
+
+ optimize=""
+ ;;
+ no)
+ if test -n "$profile"
+ then
+ { { echo "$as_me:$LINENO: error: --enable-profiling and --disable-debugging are incompatible" >&5
+echo "$as_me: error: --enable-profiling and --disable-debugging are incompatible" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+
+cat >>confdefs.h <<\_ACEOF
+#define NDEBUG 1
+_ACEOF
+
+ debug=""
+ if test "$GCC" = yes
+ then
+ optimize="$optimize -fomit-frame-pointer"
+ fi
+ ;;
+ esac
+
+fi;
+echo "$as_me:$LINENO: result: ${enable_debugging-default}" >&5
+echo "${ECHO_T}${enable_debugging-default}" >&6
+
+echo "$as_me:$LINENO: checking whether to enable experimental code" >&5
+echo $ECHO_N "checking whether to enable experimental code... $ECHO_C" >&6
+# Check whether --enable-experimental or --disable-experimental was given.
+if test "${enable_experimental+set}" = set; then
+ enableval="$enable_experimental"
+
+ case "$enableval" in
+ yes)
+
+cat >>confdefs.h <<\_ACEOF
+#define EXPERIMENTAL 1
+_ACEOF
+
+ ;;
+ esac
+
+fi;
+echo "$as_me:$LINENO: result: ${enable_experimental-no}" >&5
+echo "${ECHO_T}${enable_experimental-no}" >&6
+
+
+test -n "$arch" && CFLAGS="$CFLAGS $arch"
+test -n "$debug" && CFLAGS="$CFLAGS $debug"
+test -n "$optimize" && CFLAGS="$CFLAGS $optimize"
+test -n "$profile" && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile"
+
+
+ ac_config_files="$ac_config_files Makefile msvc++/Makefile libmad.list"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+ cat confcache >$cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by MPEG Audio Decoder $as_me 0.15.0b, which was
+generated by GNU Autoconf 2.57. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+MPEG Audio Decoder config.status 0.15.0b
+configured by $0, generated by GNU Autoconf 2.57,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "msvc++/Makefile" ) CONFIG_FILES="$CONFIG_FILES msvc++/Makefile" ;;
+ "libmad.list" ) CONFIG_FILES="$CONFIG_FILES libmad.list" ;;
+ "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@CCAS@,$CCAS,;t t
+s,@CCASFLAGS@,$CCASFLAGS,;t t
+s,@LN_S@,$LN_S,;t t
+s,@ECHO@,$ECHO,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@LIBTOOL_DEPS@,$LIBTOOL_DEPS,;t t
+s,@FPM@,$FPM,;t t
+s,@ASO@,$ASO,;t t
+s,@ASO_OBJS@,$ASO_OBJS,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+ fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+ esac
+
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo $f;;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo $f
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo $srcdir/$f
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
+ esac
+
+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo $f;;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo $f
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo $srcdir/$f
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status. Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ echo "/* Generated by configure. */" >$tmp/config.h
+ else
+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
+ fi
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
+ fi
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
+ fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $ac_file | $ac_file:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X$ac_file : 'X\(//\)[^/]' \| \
+ X$ac_file : 'X\(//\)$' \| \
+ X$ac_file : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X$ac_file |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
+ # Extract the definition of DEP_FILES from the Makefile without
+ # running `make'.
+ DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n -e '/^U = / s///p' < "$mf"`
+ test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+ # We invoke sed twice because it is the simplest approach to
+ # changing $(DEPDIR) to its actual value in the expansion.
+ for file in `sed -n -e '
+ /^DEP_FILES = .*\\\\$/ {
+ s/^DEP_FILES = //
+ :loop
+ s/\\\\$//
+ p
+ n
+ /\\\\$/ b loop
+ p
+ }
+ /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p $dirpart/$fdir
+ else
+ as_dir=$dirpart/$fdir
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+ esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/configure.ac b/src/filters/transform/mpadecfilter/libmad-0.15.0b/configure.ac
new file mode 100644
index 000000000..32c804830
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/configure.ac
@@ -0,0 +1,432 @@
+dnl -*- m4 -*-
+dnl
+dnl libmad - MPEG audio decoder library
+dnl Copyright (C) 2000-2003 Underbit Technologies, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+AC_REVISION([$Id: configure.ac 111 2003-08-31 19:00:18Z gabest $])dnl
+
+dnl Process this file with autoconf to produce a configure script.
+
+AC_INIT([MPEG Audio Decoder], [0.15.0b], [support@underbit.com], [libmad])
+AC_PREREQ(2.53)
+
+AC_CONFIG_SRCDIR([decoder.h])
+
+AM_INIT_AUTOMAKE
+
+AM_CONFIG_HEADER([config.h])
+
+dnl System type.
+
+AC_CANONICAL_HOST
+
+dnl Checks for programs.
+
+AC_PROG_CC
+AM_PROG_AS
+
+if test "$GCC" = yes
+then
+ case "$host" in
+ *-*-mingw*)
+ case "$build" in
+ *-*-cygwin*)
+ CPPFLAGS="$CPPFLAGS -mno-cygwin"
+ LDFLAGS="$LDFLAGS -mno-cygwin"
+ ;;
+ esac
+ esac
+
+dnl case "$host" in
+dnl *-*-cygwin* | *-*-mingw*)
+dnl LDFLAGS="$LDFLAGS -no-undefined -mdll"
+dnl ;;
+dnl esac
+fi
+
+dnl Support for libtool.
+
+dnl AC_DISABLE_SHARED
+dnl AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL
+
+AC_SUBST(LIBTOOL_DEPS)
+
+dnl Compiler options.
+
+arch=""
+debug=""
+optimize=""
+profile=""
+
+set -- $CFLAGS
+CFLAGS=""
+
+if test "$GCC" = yes
+then
+ CFLAGS="-Wall"
+fi
+
+while test $# -gt 0
+do
+ case "$1" in
+ -Wall)
+ if test "$GCC" = yes
+ then
+ :
+ else
+ CFLAGS="$CFLAGS $1"
+ fi
+ shift
+ ;;
+ -g)
+ debug="-g"
+ shift
+ ;;
+ -mno-cygwin)
+ shift
+ ;;
+ -m*)
+ arch="$arch $1"
+ shift
+ ;;
+ -O2)
+ optimize="-O"
+ shift
+ ;;
+ -fomit-frame-pointer)
+ shift
+ ;;
+ -O*|-f*)
+ optimize="$optimize $1"
+ shift
+ ;;
+ *)
+ CFLAGS="$CFLAGS $1"
+ shift
+ ;;
+ esac
+done
+
+if test "$GCC" = yes
+then
+ if test -z "$arch"
+ then
+ case "$host" in
+ i386-*) ;;
+ i?86-*) arch="-march=i486" ;;
+ arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;;
+ armv4*-*) arch="-march=armv4 -mtune=strongarm" ;;
+ powerpc-*) ;;
+ mips*-agenda-*) arch="-mcpu=vr4100" ;;
+ mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
+ esac
+ fi
+
+ case "$optimize" in
+ -O|"-O "*)
+ optimize="-O"
+ optimize="$optimize -fforce-mem"
+ optimize="$optimize -fforce-addr"
+ : #x optimize="$optimize -finline-functions"
+ : #- optimize="$optimize -fstrength-reduce"
+ optimize="$optimize -fthread-jumps"
+ optimize="$optimize -fcse-follow-jumps"
+ optimize="$optimize -fcse-skip-blocks"
+ : #x optimize="$optimize -frerun-cse-after-loop"
+ : #x optimize="$optimize -frerun-loop-opt"
+ : #x optimize="$optimize -fgcse"
+ optimize="$optimize -fexpensive-optimizations"
+ optimize="$optimize -fregmove"
+ : #* optimize="$optimize -fdelayed-branch"
+ : #x optimize="$optimize -fschedule-insns"
+ optimize="$optimize -fschedule-insns2"
+ : #? optimize="$optimize -ffunction-sections"
+ : #? optimize="$optimize -fcaller-saves"
+ : #> optimize="$optimize -funroll-loops"
+ : #> optimize="$optimize -funroll-all-loops"
+ : #x optimize="$optimize -fmove-all-movables"
+ : #x optimize="$optimize -freduce-all-givs"
+ : #? optimize="$optimize -fstrict-aliasing"
+ : #* optimize="$optimize -fstructure-noalias"
+
+ case "$host" in
+ arm*-*)
+ optimize="$optimize -fstrength-reduce"
+ ;;
+ mips*-*)
+ optimize="$optimize -fstrength-reduce"
+ optimize="$optimize -finline-functions"
+ ;;
+ i?86-*)
+ optimize="$optimize -fstrength-reduce"
+ ;;
+ powerpc-apple-*)
+ # this triggers an internal compiler error with gcc2
+ : #optimize="$optimize -fstrength-reduce"
+
+ # this is really only beneficial with gcc3
+ : #optimize="$optimize -finline-functions"
+ ;;
+ *)
+ # this sometimes provokes bugs in gcc 2.95.2
+ : #optimize="$optimize -fstrength-reduce"
+ ;;
+ esac
+ ;;
+ esac
+fi
+
+case "$host" in
+ mips*-agenda-*)
+ AC_DEFINE(HAVE_MADD16_ASM, 1,
+ [Define if your MIPS CPU supports a 2-operand MADD16 instruction.])
+ ;;
+ mips*-luxsonor-*)
+ AC_DEFINE(HAVE_MADD_ASM, 1,
+ [Define if your MIPS CPU supports a 2-operand MADD instruction.])
+ ;;
+esac
+
+dnl Checks for header files.
+
+AC_HEADER_STDC
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(assert.h limits.h unistd.h sys/types.h fcntl.h errno.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_PID_T
+
+AC_CHECK_SIZEOF(int, 2)
+AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(long long, 8)
+
+dnl Checks for library functions.
+
+AC_CHECK_FUNCS(waitpid fcntl pipe fork)
+
+dnl Other options.
+
+AC_SUBST(FPM)
+AC_SUBST(ASO)
+AC_SUBST(ASO_OBJS)
+
+dnl handle --enable and --disable options
+
+AC_CACHE_SAVE
+
+AC_MSG_CHECKING(whether to optimize for speed or for accuracy)
+
+AC_ARG_ENABLE(speed, AC_HELP_STRING([--enable-speed],
+ [optimize for speed over accuracy]),
+[
+ case "$enableval" in
+ yes)
+ optimize_for="speed"
+ AC_DEFINE(OPT_SPEED, 1,
+ [Define to optimize for speed over accuracy.])
+ ;;
+ esac
+])
+
+AC_ARG_ENABLE(accuracy, AC_HELP_STRING([--enable-accuracy],
+ [optimize for accuracy over speed]),
+[
+ case "$enableval" in
+ yes)
+ if test "$optimize_for" = "speed"
+ then
+ optimize_for="both"
+ else
+ optimize_for="accuracy"
+ fi
+ AC_DEFINE(OPT_ACCURACY, 1,
+ [Define to optimize for accuracy over speed.])
+ ;;
+ esac
+])
+
+AC_MSG_RESULT(${optimize_for-default})
+
+if test "$optimize_for" = "both"
+then
+ AC_MSG_ERROR(cannot optimize for both speed and accuracy)
+fi
+
+AC_MSG_CHECKING(for architecture-specific fixed-point math routines)
+AC_ARG_ENABLE(fpm, AC_HELP_STRING([--enable-fpm=ARCH],
+ [use ARCH-specific fixed-point math routines
+ (one of: intel, arm, mips, sparc, ppc, 64bit, default)]),
+[
+ case "$enableval" in
+ yes) ;;
+ no|default|approx) FPM="DEFAULT" ;;
+ intel|i?86) FPM="INTEL" ;;
+ arm) FPM="ARM" ;;
+ mips) FPM="MIPS" ;;
+ sparc) FPM="SPARC" ;;
+ ppc|powerpc) FPM="PPC" ;;
+ 64bit) FPM="64BIT" ;;
+ float) FPM="FLOAT" ;;
+ *)
+ AC_MSG_RESULT(failed)
+ AC_MSG_ERROR([bad --enable-fpm option])
+ ;;
+ esac
+])
+
+if test -z "$FPM" && test "$GCC" = yes
+then
+ case "$host" in
+ i?86-*) FPM="INTEL" ;;
+ arm*-*) FPM="ARM" ;;
+ mips*-*) FPM="MIPS" ;;
+ sparc*-*) FPM="SPARC" ;;
+ powerpc*-*) FPM="PPC" ;;
+ # FIXME: need to test for 64-bit long long...
+ esac
+fi
+
+AC_MSG_RESULT(${FPM=DEFAULT})
+
+if test "$FPM" = "DEFAULT"
+then
+ AC_MSG_WARN([default fixed-point math will yield limited accuracy])
+fi
+
+FPM="-DFPM_$FPM"
+
+AC_ARG_ENABLE(sso, AC_HELP_STRING([--enable-sso],
+ [use subband synthesis optimization]),
+[
+ case "$enableval" in
+ yes)
+ AC_DEFINE(OPT_SSO, 1,
+ [Define to enable a fast subband synthesis approximation optimization.])
+ ;;
+ esac
+])
+
+AC_ARG_ENABLE(aso, AC_HELP_STRING([--disable-aso],
+ [disable architecture-specific optimizations]),
+ [], [enable_aso=yes])
+
+if test "$enable_aso" = yes
+then
+ case "$host" in
+ i?86-*)
+ : #ASO="$ASO -DASO_INTERLEAVE1"
+ ASO="$ASO -DASO_ZEROCHECK"
+ : #not yet #ASO="$ASO -DASO_SYNTH"
+ : #not yet #ASO_OBJS="synth_mmx.lo"
+ ;;
+ arm*-*)
+ ASO="$ASO -DASO_INTERLEAVE1"
+ ASO="$ASO -DASO_IMDCT"
+ ASO_OBJS="imdct_l_arm.lo"
+ ;;
+ mips*-*)
+ ASO="$ASO -DASO_INTERLEAVE2"
+ ASO="$ASO -DASO_ZEROCHECK"
+ ;;
+ esac
+fi
+
+AC_MSG_CHECKING(for ISO/IEC interpretation)
+AC_ARG_ENABLE(strict-iso, AC_HELP_STRING([--enable-strict-iso],
+ [use strict ISO/IEC interpretations]),
+[
+ case "$enableval" in
+ yes)
+ AC_DEFINE(OPT_STRICT, 1,
+ [Define to influence a strict interpretation of the ISO/IEC standards,
+ even if this is in opposition with best accepted practices.])
+ interpretation="strict"
+ ;;
+ esac
+])
+AC_MSG_RESULT(${interpretation-best accepted practices})
+
+AC_MSG_CHECKING(whether to enable profiling)
+AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling],
+ [generate profiling code]),
+[
+ case "$enableval" in
+ yes) profile="-pg" ;;
+ esac
+])
+AC_MSG_RESULT(${enable_profiling-no})
+
+AC_MSG_CHECKING(whether to enable debugging)
+AC_ARG_ENABLE(debugging, AC_HELP_STRING([--enable-debugging],
+ [enable diagnostic debugging support])
+AC_HELP_STRING([--disable-debugging],
+ [do not enable debugging and use more optimization]),
+[
+ case "$enableval" in
+ yes)
+ AC_DEFINE(DEBUG, 1,
+ [Define to enable diagnostic debugging support.])
+ optimize=""
+ ;;
+ no)
+ if test -n "$profile"
+ then
+ AC_MSG_ERROR(--enable-profiling and --disable-debugging are incompatible)
+ fi
+
+ AC_DEFINE(NDEBUG, 1,
+ [Define to disable debugging assertions.])
+ debug=""
+ if test "$GCC" = yes
+ then
+ optimize="$optimize -fomit-frame-pointer"
+ fi
+ ;;
+ esac
+])
+AC_MSG_RESULT(${enable_debugging-default})
+
+AC_MSG_CHECKING(whether to enable experimental code)
+AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
+ [enable experimental code]),
+[
+ case "$enableval" in
+ yes)
+ AC_DEFINE(EXPERIMENTAL, 1,
+ [Define to enable experimental code.])
+ ;;
+ esac
+])
+AC_MSG_RESULT(${enable_experimental-no})
+
+dnl Create output files.
+
+test -n "$arch" && CFLAGS="$CFLAGS $arch"
+test -n "$debug" && CFLAGS="$CFLAGS $debug"
+test -n "$optimize" && CFLAGS="$CFLAGS $optimize"
+test -n "$profile" && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile"
+
+dnl LTLIBOBJS=`echo "$LIBOBJS" | sed -e 's/\.o/.lo/g'`
+dnl AC_SUBST(LTLIBOBJS)
+
+AC_CONFIG_FILES([Makefile msvc++/Makefile \
+ libmad.list])
+AC_OUTPUT
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/decoder.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/decoder.c
new file mode 100644
index 000000000..629c7bae0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/decoder.c
@@ -0,0 +1,582 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: decoder.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+# endif
+
+# ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+# endif
+
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+
+# ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+# endif
+
+# include <stdlib.h>
+
+# ifdef HAVE_ERRNO_H
+# include <errno.h>
+# endif
+
+# include "stream.h"
+# include "frame.h"
+# include "synth.h"
+# include "decoder.h"
+
+/*
+ * NAME: decoder->init()
+ * DESCRIPTION: initialize a decoder object with callback routines
+ */
+void mad_decoder_init(struct mad_decoder *decoder, void *data,
+ enum mad_flow (*input_func)(void *,
+ struct mad_stream *),
+ enum mad_flow (*header_func)(void *,
+ struct mad_header const *),
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*error_func)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*message_func)(void *,
+ void *, unsigned int *))
+{
+ decoder->mode = -1;
+
+ decoder->options = 0;
+
+ decoder->async.pid = 0;
+ decoder->async.in = -1;
+ decoder->async.out = -1;
+
+ decoder->sync = 0;
+
+ decoder->cb_data = data;
+
+ decoder->input_func = input_func;
+ decoder->header_func = header_func;
+ decoder->filter_func = filter_func;
+ decoder->output_func = output_func;
+ decoder->error_func = error_func;
+ decoder->message_func = message_func;
+}
+
+int mad_decoder_finish(struct mad_decoder *decoder)
+{
+# if defined(USE_ASYNC)
+ if (decoder->mode == MAD_DECODER_MODE_ASYNC && decoder->async.pid) {
+ pid_t pid;
+ int status;
+
+ close(decoder->async.in);
+
+ do
+ pid = waitpid(decoder->async.pid, &status, 0);
+ while (pid == -1 && errno == EINTR);
+
+ decoder->mode = -1;
+
+ close(decoder->async.out);
+
+ decoder->async.pid = 0;
+ decoder->async.in = -1;
+ decoder->async.out = -1;
+
+ if (pid == -1)
+ return -1;
+
+ return (!WIFEXITED(status) || WEXITSTATUS(status)) ? -1 : 0;
+ }
+# endif
+
+ return 0;
+}
+
+# if defined(USE_ASYNC)
+static
+enum mad_flow send_io(int fd, void const *data, size_t len)
+{
+ char const *ptr = data;
+ ssize_t count;
+
+ while (len) {
+ do
+ count = write(fd, ptr, len);
+ while (count == -1 && errno == EINTR);
+
+ if (count == -1)
+ return MAD_FLOW_BREAK;
+
+ len -= count;
+ ptr += count;
+ }
+
+ return MAD_FLOW_CONTINUE;
+}
+
+static
+enum mad_flow receive_io(int fd, void *buffer, size_t len)
+{
+ char *ptr = buffer;
+ ssize_t count;
+
+ while (len) {
+ do
+ count = read(fd, ptr, len);
+ while (count == -1 && errno == EINTR);
+
+ if (count == -1)
+ return (errno == EAGAIN) ? MAD_FLOW_IGNORE : MAD_FLOW_BREAK;
+ else if (count == 0)
+ return MAD_FLOW_STOP;
+
+ len -= count;
+ ptr += count;
+ }
+
+ return MAD_FLOW_CONTINUE;
+}
+
+static
+enum mad_flow receive_io_blocking(int fd, void *buffer, size_t len)
+{
+ int flags, blocking;
+ enum mad_flow result;
+
+ flags = fcntl(fd, F_GETFL);
+ if (flags == -1)
+ return MAD_FLOW_BREAK;
+
+ blocking = flags & ~O_NONBLOCK;
+
+ if (blocking != flags &&
+ fcntl(fd, F_SETFL, blocking) == -1)
+ return MAD_FLOW_BREAK;
+
+ result = receive_io(fd, buffer, len);
+
+ if (flags != blocking &&
+ fcntl(fd, F_SETFL, flags) == -1)
+ return MAD_FLOW_BREAK;
+
+ return result;
+}
+
+static
+enum mad_flow send(int fd, void const *message, unsigned int size)
+{
+ enum mad_flow result;
+
+ /* send size */
+
+ result = send_io(fd, &size, sizeof(size));
+
+ /* send message */
+
+ if (result == MAD_FLOW_CONTINUE)
+ result = send_io(fd, message, size);
+
+ return result;
+}
+
+static
+enum mad_flow receive(int fd, void **message, unsigned int *size)
+{
+ enum mad_flow result;
+ unsigned int actual;
+
+ if (*message == 0)
+ *size = 0;
+
+ /* receive size */
+
+ result = receive_io(fd, &actual, sizeof(actual));
+
+ /* receive message */
+
+ if (result == MAD_FLOW_CONTINUE) {
+ if (actual > *size)
+ actual -= *size;
+ else {
+ *size = actual;
+ actual = 0;
+ }
+
+ if (*size > 0) {
+ if (*message == 0) {
+ *message = malloc(*size);
+ if (*message == 0)
+ return MAD_FLOW_BREAK;
+ }
+
+ result = receive_io_blocking(fd, *message, *size);
+ }
+
+ /* throw away remainder of message */
+
+ while (actual && result == MAD_FLOW_CONTINUE) {
+ char sink[256];
+ unsigned int len;
+
+ len = actual > sizeof(sink) ? sizeof(sink) : actual;
+
+ result = receive_io_blocking(fd, sink, len);
+
+ actual -= len;
+ }
+ }
+
+ return result;
+}
+
+static
+enum mad_flow check_message(struct mad_decoder *decoder)
+{
+ enum mad_flow result;
+ void *message = 0;
+ unsigned int size;
+
+ result = receive(decoder->async.in, &message, &size);
+
+ if (result == MAD_FLOW_CONTINUE) {
+ if (decoder->message_func == 0)
+ size = 0;
+ else {
+ result = decoder->message_func(decoder->cb_data, message, &size);
+
+ if (result == MAD_FLOW_IGNORE ||
+ result == MAD_FLOW_BREAK)
+ size = 0;
+ }
+
+ if (send(decoder->async.out, message, size) != MAD_FLOW_CONTINUE)
+ result = MAD_FLOW_BREAK;
+ }
+
+ if (message)
+ free(message);
+
+ return result;
+}
+# endif
+
+static
+enum mad_flow error_default(void *data, struct mad_stream *stream,
+ struct mad_frame *frame)
+{
+ int *bad_last_frame = data;
+
+ switch (stream->error) {
+ case MAD_ERROR_BADCRC:
+ if (*bad_last_frame)
+ mad_frame_mute(frame);
+ else
+ *bad_last_frame = 1;
+
+ return MAD_FLOW_IGNORE;
+
+ default:
+ return MAD_FLOW_CONTINUE;
+ }
+}
+
+static
+int run_sync(struct mad_decoder *decoder)
+{
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ void *error_data;
+ int bad_last_frame = 0;
+ struct mad_stream *stream;
+ struct mad_frame *frame;
+ struct mad_synth *synth;
+ int result = 0;
+
+ if (decoder->input_func == 0)
+ return 0;
+
+ if (decoder->error_func) {
+ error_func = decoder->error_func;
+ error_data = decoder->cb_data;
+ }
+ else {
+ error_func = error_default;
+ error_data = &bad_last_frame;
+ }
+
+ stream = &decoder->sync->stream;
+ frame = &decoder->sync->frame;
+ synth = &decoder->sync->synth;
+
+ mad_stream_init(stream);
+ mad_frame_init(frame);
+ mad_synth_init(synth);
+
+ mad_stream_options(stream, decoder->options);
+
+ do {
+ switch (decoder->input_func(decoder->cb_data, stream)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ continue;
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+
+ while (1) {
+# if defined(USE_ASYNC)
+ if (decoder->mode == MAD_DECODER_MODE_ASYNC) {
+ switch (check_message(decoder)) {
+ case MAD_FLOW_IGNORE:
+ case MAD_FLOW_CONTINUE:
+ break;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_STOP:
+ goto done;
+ }
+ }
+# endif
+
+ if (decoder->header_func) {
+ if (mad_header_decode(&frame->header, stream) == -1) {
+ if (!MAD_RECOVERABLE(stream->error))
+ break;
+
+ switch (error_func(error_data, stream, frame)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ case MAD_FLOW_CONTINUE:
+ default:
+ continue;
+ }
+ }
+
+ switch (decoder->header_func(decoder->cb_data, &frame->header)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ continue;
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+ }
+
+ if (mad_frame_decode(frame, stream) == -1) {
+ if (!MAD_RECOVERABLE(stream->error))
+ break;
+
+ switch (error_func(error_data, stream, frame)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ break;
+ case MAD_FLOW_CONTINUE:
+ default:
+ continue;
+ }
+ }
+ else
+ bad_last_frame = 0;
+
+ if (decoder->filter_func) {
+ switch (decoder->filter_func(decoder->cb_data, stream, frame)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ continue;
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+ }
+
+ mad_synth_frame(synth, frame);
+
+ if (decoder->output_func) {
+ switch (decoder->output_func(decoder->cb_data,
+ &frame->header, &synth->pcm)) {
+ case MAD_FLOW_STOP:
+ goto done;
+ case MAD_FLOW_BREAK:
+ goto fail;
+ case MAD_FLOW_IGNORE:
+ case MAD_FLOW_CONTINUE:
+ break;
+ }
+ }
+ }
+ }
+ while (stream->error == MAD_ERROR_BUFLEN);
+
+ fail:
+ result = -1;
+
+ done:
+ mad_synth_finish(synth);
+ mad_frame_finish(frame);
+ mad_stream_finish(stream);
+
+ return result;
+}
+
+# if defined(USE_ASYNC)
+static
+int run_async(struct mad_decoder *decoder)
+{
+ pid_t pid;
+ int ptoc[2], ctop[2], flags;
+
+ if (pipe(ptoc) == -1)
+ return -1;
+
+ if (pipe(ctop) == -1) {
+ close(ptoc[0]);
+ close(ptoc[1]);
+ return -1;
+ }
+
+ flags = fcntl(ptoc[0], F_GETFL);
+ if (flags == -1 ||
+ fcntl(ptoc[0], F_SETFL, flags | O_NONBLOCK) == -1) {
+ close(ctop[0]);
+ close(ctop[1]);
+ close(ptoc[0]);
+ close(ptoc[1]);
+ return -1;
+ }
+
+ pid = fork();
+ if (pid == -1) {
+ close(ctop[0]);
+ close(ctop[1]);
+ close(ptoc[0]);
+ close(ptoc[1]);
+ return -1;
+ }
+
+ decoder->async.pid = pid;
+
+ if (pid) {
+ /* parent */
+
+ close(ptoc[0]);
+ close(ctop[1]);
+
+ decoder->async.in = ctop[0];
+ decoder->async.out = ptoc[1];
+
+ return 0;
+ }
+
+ /* child */
+
+ close(ptoc[1]);
+ close(ctop[0]);
+
+ decoder->async.in = ptoc[0];
+ decoder->async.out = ctop[1];
+
+ _exit(run_sync(decoder));
+
+ /* not reached */
+ return -1;
+}
+# endif
+
+/*
+ * NAME: decoder->run()
+ * DESCRIPTION: run the decoder thread either synchronously or asynchronously
+ */
+int mad_decoder_run(struct mad_decoder *decoder, enum mad_decoder_mode mode)
+{
+ int result;
+ int (*run)(struct mad_decoder *) = 0;
+
+ switch (decoder->mode = mode) {
+ case MAD_DECODER_MODE_SYNC:
+ run = run_sync;
+ break;
+
+ case MAD_DECODER_MODE_ASYNC:
+# if defined(USE_ASYNC)
+ run = run_async;
+# endif
+ break;
+ }
+
+ if (run == 0)
+ return -1;
+
+ decoder->sync = malloc(sizeof(*decoder->sync));
+ if (decoder->sync == 0)
+ return -1;
+
+ result = run(decoder);
+
+ free(decoder->sync);
+ decoder->sync = 0;
+
+ return result;
+}
+
+/*
+ * NAME: decoder->message()
+ * DESCRIPTION: send a message to and receive a reply from the decoder process
+ */
+int mad_decoder_message(struct mad_decoder *decoder,
+ void *message, unsigned int *len)
+{
+# if defined(USE_ASYNC)
+ if (decoder->mode != MAD_DECODER_MODE_ASYNC ||
+ send(decoder->async.out, message, *len) != MAD_FLOW_CONTINUE ||
+ receive(decoder->async.in, &message, len) != MAD_FLOW_CONTINUE)
+ return -1;
+
+ return 0;
+# else
+ return -1;
+# endif
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/decoder.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/decoder.h
new file mode 100644
index 000000000..5a5cfaa7c
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/decoder.h
@@ -0,0 +1,91 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: decoder.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_DECODER_H
+# define LIBMAD_DECODER_H
+
+# include "stream.h"
+# include "frame.h"
+# include "synth.h"
+
+enum mad_decoder_mode {
+ MAD_DECODER_MODE_SYNC = 0,
+ MAD_DECODER_MODE_ASYNC
+};
+
+enum mad_flow {
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
+};
+
+struct mad_decoder {
+ enum mad_decoder_mode mode;
+
+ int options;
+
+ struct {
+ long pid;
+ int in;
+ int out;
+ } async;
+
+ struct {
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+ } *sync;
+
+ void *cb_data;
+
+ enum mad_flow (*input_func)(void *, struct mad_stream *);
+ enum mad_flow (*header_func)(void *, struct mad_header const *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *, struct mad_pcm *);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ enum mad_flow (*message_func)(void *, void *, unsigned int *);
+};
+
+void mad_decoder_init(struct mad_decoder *, void *,
+ enum mad_flow (*)(void *, struct mad_stream *),
+ enum mad_flow (*)(void *, struct mad_header const *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *, void *, unsigned int *));
+int mad_decoder_finish(struct mad_decoder *);
+
+# define mad_decoder_options(decoder, opts) \
+ ((void) ((decoder)->options = (opts)))
+
+int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
+int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/depcomp b/src/filters/transform/mpadecfilter/libmad-0.15.0b/depcomp
new file mode 100644
index 000000000..c73d1dc98
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/depcomp
@@ -0,0 +1,464 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+if test -z "$depfile"; then
+ base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
+ dir=`echo "$object" | sed 's,/.*$,/,'`
+ if test "$dir" = "$object"; then
+ dir=
+ fi
+ # FIXME: should be _deps on DOS.
+ depfile="$dir.deps/$base"
+fi
+
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. This file always lives in the current directory.
+ # Also, the AIX compiler puts `$object:' at the start of each line;
+ # $object doesn't have directory information.
+ stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ outname="$stripped.o"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Must come before tru64.
+
+ # Intel's C compiler understands `-MD -MF file'. However
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^[^:]*: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ tmpdepfile1="$dir.libs/$base.lo.d"
+ tmpdepfile2="$dir.libs/$base.d"
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1="$dir$base.o.d"
+ tmpdepfile2="$dir$base.d"
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile1"; then
+ tmpdepfile="$tmpdepfile1"
+ else
+ tmpdepfile="$tmpdepfile2"
+ fi
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a space and a tab in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the proprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the proprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the proprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/fixed.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/fixed.c
new file mode 100644
index 000000000..52ff440df
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/fixed.c
@@ -0,0 +1,81 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: fixed.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# include "fixed.h"
+
+/*
+ * NAME: fixed->abs()
+ * DESCRIPTION: return absolute value of a fixed-point number
+ */
+mad_fixed_t mad_f_abs(mad_fixed_t x)
+{
+ return x < 0 ? -x : x;
+}
+
+/*
+ * NAME: fixed->div()
+ * DESCRIPTION: perform division using fixed-point math
+ */
+mad_fixed_t mad_f_div(mad_fixed_t x, mad_fixed_t y)
+{
+ mad_fixed_t q, r;
+ unsigned int bits;
+
+ q = mad_f_abs(x / y);
+
+ if (x < 0) {
+ x = -x;
+ y = -y;
+ }
+
+ r = x % y;
+
+ if (y < 0) {
+ x = -x;
+ y = -y;
+ }
+
+ if (q > mad_f_intpart(MAD_F_MAX) &&
+ !(q == -mad_f_intpart(MAD_F_MIN) && r == 0 && (x < 0) != (y < 0)))
+ return 0;
+
+ for (bits = MAD_F_FRACBITS; bits && r; --bits) {
+ q <<= 1, r <<= 1;
+ if (r >= y)
+ r -= y, ++q;
+ }
+
+ /* round */
+ if (2 * r >= y)
+ ++q;
+
+ /* fix sign */
+ if ((x < 0) != (y < 0))
+ q = -q;
+
+ return q << bits;
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/fixed.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/fixed.h
new file mode 100644
index 000000000..2c4f04809
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/fixed.h
@@ -0,0 +1,484 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: fixed.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_FIXED_H
+# define LIBMAD_FIXED_H
+
+# if SIZEOF_INT >= 4
+typedef signed int mad_fixed_t;
+
+typedef signed int mad_fixed64hi_t;
+typedef unsigned int mad_fixed64lo_t;
+# else
+typedef signed long mad_fixed_t;
+
+typedef signed long mad_fixed64hi_t;
+typedef unsigned long mad_fixed64lo_t;
+# endif
+
+# if defined(_MSC_VER)
+# define mad_fixed64_t signed __int64
+# elif 1 || defined(__GNUC__)
+# define mad_fixed64_t signed long long
+# endif
+
+# if defined(FPM_FLOAT)
+typedef double mad_sample_t;
+# else
+typedef mad_fixed_t mad_sample_t;
+# endif
+
+/*
+ * Fixed-point format: 0xABBBBBBB
+ * A == whole part (sign + 3 bits)
+ * B == fractional part (28 bits)
+ *
+ * Values are signed two's complement, so the effective range is:
+ * 0x80000000 to 0x7fffffff
+ * -8.0 to +7.9999999962747097015380859375
+ *
+ * The smallest representable value is:
+ * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
+ *
+ * 28 bits of fractional accuracy represent about
+ * 8.6 digits of decimal accuracy.
+ *
+ * Fixed-point numbers can be added or subtracted as normal
+ * integers, but multiplication requires shifting the 64-bit result
+ * from 56 fractional bits back to 28 (and rounding.)
+ *
+ * Changing the definition of MAD_F_FRACBITS is only partially
+ * supported, and must be done with care.
+ */
+
+# define MAD_F_FRACBITS 28
+
+# if MAD_F_FRACBITS == 28
+# define MAD_F(x) ((mad_fixed_t) (x##L))
+# else
+# if MAD_F_FRACBITS < 28
+# warning "MAD_F_FRACBITS < 28"
+# define MAD_F(x) ((mad_fixed_t) \
+ (((x##L) + \
+ (1L << (28 - MAD_F_FRACBITS - 1))) >> \
+ (28 - MAD_F_FRACBITS)))
+# elif MAD_F_FRACBITS > 28
+# error "MAD_F_FRACBITS > 28 not currently supported"
+# define MAD_F(x) ((mad_fixed_t) \
+ ((x##L) << (MAD_F_FRACBITS - 28)))
+# endif
+# endif
+
+# define MAD_F_MIN ((mad_fixed_t) -0x80000000L)
+# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL)
+
+# define MAD_F_ONE MAD_F(0x10000000)
+
+# define mad_f_tofixed(x) ((mad_fixed_t) \
+ ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5))
+# define mad_f_todouble(x) ((double) \
+ ((x) / (double) (1L << MAD_F_FRACBITS)))
+
+# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS)
+# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1))
+ /* (x should be positive) */
+
+# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS)
+
+# define mad_f_add(x, y) ((x) + (y))
+# define mad_f_sub(x, y) ((x) - (y))
+
+# if defined(FPM_FLOAT)
+# error "FPM_FLOAT not yet supported"
+
+# undef MAD_F
+# define MAD_F(x) mad_f_todouble(x)
+
+# define mad_f_mul(x, y) ((x) * (y))
+# define mad_f_scale64
+
+# undef ASO_ZEROCHECK
+
+# elif defined(FPM_64BIT)
+
+/*
+ * This version should be the most accurate if 64-bit types are supported by
+ * the compiler, although it may not be the most efficient.
+ */
+# if defined(OPT_ACCURACY)
+# define mad_f_mul(x, y) \
+ ((mad_fixed_t) \
+ ((((mad_fixed64_t) (x) * (y)) + \
+ (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS))
+# else
+# define mad_f_mul(x, y) \
+ ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS))
+# endif
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+
+/* --- Intel --------------------------------------------------------------- */
+
+# elif defined(FPM_INTEL)
+
+# if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable: 4035) /* no return value */
+static __forceinline
+mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
+{
+ enum {
+ fracbits = MAD_F_FRACBITS
+ };
+
+ __asm {
+ mov eax, x
+ imul y
+ shrd eax, edx, fracbits
+ }
+
+ /* implicit return of eax */
+}
+# pragma warning(pop)
+
+# define mad_f_mul mad_f_mul_inline
+# define mad_f_scale64
+# else
+/*
+ * This Intel version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("imull %3" \
+ : "=a" (lo), "=d" (hi) \
+ : "%a" (x), "rm" (y) \
+ : "cc")
+
+# if defined(OPT_ACCURACY)
+/*
+ * This gives best accuracy but is not very fast.
+ */
+# define MAD_F_MLA(hi, lo, x, y) \
+ ({ mad_fixed64hi_t __hi; \
+ mad_fixed64lo_t __lo; \
+ MAD_F_MLX(__hi, __lo, (x), (y)); \
+ asm ("addl %2,%0\n\t" \
+ "adcl %3,%1" \
+ : "=rm" (lo), "=rm" (hi) \
+ : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \
+ : "cc"); \
+ })
+# endif /* OPT_ACCURACY */
+
+# if defined(OPT_ACCURACY)
+/*
+ * Surprisingly, this is faster than SHRD followed by ADC.
+ */
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed64hi_t __hi_; \
+ mad_fixed64lo_t __lo_; \
+ mad_fixed_t __result; \
+ asm ("addl %4,%2\n\t" \
+ "adcl %5,%3" \
+ : "=rm" (__lo_), "=rm" (__hi_) \
+ : "0" (lo), "1" (hi), \
+ "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \
+ : "cc"); \
+ asm ("shrdl %3,%2,%1" \
+ : "=rm" (__result) \
+ : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# else
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("shrdl %3,%2,%1" \
+ : "=rm" (__result) \
+ : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# endif /* OPT_ACCURACY */
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
+
+/* --- ARM ----------------------------------------------------------------- */
+
+# elif defined(FPM_ARM)
+
+/*
+ * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
+ * least significant bit is properly rounded at no CPU cycle cost!
+ */
+# if 1
+/*
+ * This is faster than the default implementation via MAD_F_MLX() and
+ * mad_f_scale64().
+ */
+# define mad_f_mul(x, y) \
+ ({ mad_fixed64hi_t __hi; \
+ mad_fixed64lo_t __lo; \
+ mad_fixed_t __result; \
+ asm ("smull %0, %1, %3, %4\n\t" \
+ "movs %0, %0, lsr %5\n\t" \
+ "adc %2, %0, %1, lsl %6" \
+ : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
+ : "%r" (x), "r" (y), \
+ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# endif
+
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("smull %0, %1, %2, %3" \
+ : "=&r" (lo), "=&r" (hi) \
+ : "%r" (x), "r" (y))
+
+# define MAD_F_MLA(hi, lo, x, y) \
+ asm ("smlal %0, %1, %2, %3" \
+ : "+r" (lo), "+r" (hi) \
+ : "%r" (x), "r" (y))
+
+# define MAD_F_MLN(hi, lo) \
+ asm ("rsbs %0, %2, #0\n\t" \
+ "rsc %1, %3, #0" \
+ : "=r" (lo), "=r" (hi) \
+ : "0" (lo), "1" (hi) \
+ : "cc")
+
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("movs %0, %1, lsr %3\n\t" \
+ "adc %0, %0, %2, lsl %4" \
+ : "=&r" (__result) \
+ : "r" (lo), "r" (hi), \
+ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+
+/* --- MIPS ---------------------------------------------------------------- */
+
+# elif defined(FPM_MIPS)
+
+/*
+ * This MIPS version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("mult %2,%3" \
+ : "=l" (lo), "=h" (hi) \
+ : "%r" (x), "r" (y))
+
+# if defined(HAVE_MADD_ASM)
+# define MAD_F_MLA(hi, lo, x, y) \
+ asm ("madd %2,%3" \
+ : "+l" (lo), "+h" (hi) \
+ : "%r" (x), "r" (y))
+# elif defined(HAVE_MADD16_ASM)
+/*
+ * This loses significant accuracy due to the 16-bit integer limit in the
+ * multiply/accumulate instruction.
+ */
+# define MAD_F_ML0(hi, lo, x, y) \
+ asm ("mult %2,%3" \
+ : "=l" (lo), "=h" (hi) \
+ : "%r" ((x) >> 12), "r" ((y) >> 16))
+# define MAD_F_MLA(hi, lo, x, y) \
+ asm ("madd16 %2,%3" \
+ : "+l" (lo), "+h" (hi) \
+ : "%r" ((x) >> 12), "r" ((y) >> 16))
+# define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo))
+# endif
+
+# if defined(OPT_SPEED)
+# define mad_f_scale64(hi, lo) \
+ ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS)))
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
+
+/* --- SPARC --------------------------------------------------------------- */
+
+# elif defined(FPM_SPARC)
+
+/*
+ * This SPARC V8 version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("smul %2, %3, %0\n\t" \
+ "rd %%y, %1" \
+ : "=r" (lo), "=r" (hi) \
+ : "%r" (x), "rI" (y))
+
+/* --- PowerPC ------------------------------------------------------------- */
+
+# elif defined(FPM_PPC)
+
+/*
+ * This PowerPC version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ do { \
+ asm ("mullw %0,%1,%2" \
+ : "=r" (lo) \
+ : "%r" (x), "r" (y)); \
+ asm ("mulhw %0,%1,%2" \
+ : "=r" (hi) \
+ : "%r" (x), "r" (y)); \
+ } \
+ while (0)
+
+# if defined(OPT_ACCURACY)
+/*
+ * This gives best accuracy but is not very fast.
+ */
+# define MAD_F_MLA(hi, lo, x, y) \
+ ({ mad_fixed64hi_t __hi; \
+ mad_fixed64lo_t __lo; \
+ MAD_F_MLX(__hi, __lo, (x), (y)); \
+ asm ("addc %0,%2,%3\n\t" \
+ "adde %1,%4,%5" \
+ : "=r" (lo), "=r" (hi) \
+ : "%r" (lo), "r" (__lo), \
+ "%r" (hi), "r" (__hi) \
+ : "xer"); \
+ })
+# endif
+
+# if defined(OPT_ACCURACY)
+/*
+ * This is slower than the truncating version below it.
+ */
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result, __round; \
+ asm ("rotrwi %0,%1,%2" \
+ : "=r" (__result) \
+ : "r" (lo), "i" (MAD_F_SCALEBITS)); \
+ asm ("extrwi %0,%1,1,0" \
+ : "=r" (__round) \
+ : "r" (__result)); \
+ asm ("insrwi %0,%1,%2,0" \
+ : "+r" (__result) \
+ : "r" (hi), "i" (MAD_F_SCALEBITS)); \
+ asm ("add %0,%1,%2" \
+ : "=r" (__result) \
+ : "%r" (__result), "r" (__round)); \
+ __result; \
+ })
+# else
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("rotrwi %0,%1,%2" \
+ : "=r" (__result) \
+ : "r" (lo), "i" (MAD_F_SCALEBITS)); \
+ asm ("insrwi %0,%1,%2,0" \
+ : "+r" (__result) \
+ : "r" (hi), "i" (MAD_F_SCALEBITS)); \
+ __result; \
+ })
+# endif
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+
+/* --- Default ------------------------------------------------------------- */
+
+# elif defined(FPM_DEFAULT)
+
+/*
+ * This version is the most portable but it loses significant accuracy.
+ * Furthermore, accuracy is biased against the second argument, so care
+ * should be taken when ordering operands.
+ *
+ * The scale factors are constant as this is not used with SSO.
+ *
+ * Pre-rounding is required to stay within the limits of compliance.
+ */
+# if defined(OPT_SPEED)
+# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16))
+# else
+# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \
+ (((y) + (1L << 15)) >> 16))
+# endif
+
+/* ------------------------------------------------------------------------- */
+
+# else
+# error "no FPM selected"
+# endif
+
+/* default implementations */
+
+# if !defined(mad_f_mul)
+# define mad_f_mul(x, y) \
+ ({ register mad_fixed64hi_t __hi; \
+ register mad_fixed64lo_t __lo; \
+ MAD_F_MLX(__hi, __lo, (x), (y)); \
+ mad_f_scale64(__hi, __lo); \
+ })
+# endif
+
+# if !defined(MAD_F_MLA)
+# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y)))
+# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y)))
+# define MAD_F_MLN(hi, lo) ((lo) = -(lo))
+# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo))
+# endif
+
+# if !defined(MAD_F_ML0)
+# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y))
+# endif
+
+# if !defined(MAD_F_MLN)
+# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi))
+# endif
+
+# if !defined(MAD_F_MLZ)
+# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo))
+# endif
+
+# if !defined(mad_f_scale64)
+# if defined(OPT_ACCURACY)
+# define mad_f_scale64(hi, lo) \
+ ((((mad_fixed_t) \
+ (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \
+ ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1)
+# else
+# define mad_f_scale64(hi, lo) \
+ ((mad_fixed_t) \
+ (((hi) << (32 - MAD_F_SCALEBITS)) | \
+ ((lo) >> MAD_F_SCALEBITS)))
+# endif
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
+
+/* C routines */
+
+mad_fixed_t mad_f_abs(mad_fixed_t);
+mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/frame.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/frame.c
new file mode 100644
index 000000000..76f33b83d
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/frame.c
@@ -0,0 +1,502 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: frame.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# include <stdlib.h>
+
+# include "bit.h"
+# include "stream.h"
+# include "frame.h"
+# include "timer.h"
+# include "layer12.h"
+# include "layer3.h"
+
+static
+unsigned long const bitrate_table[5][15] = {
+ /* MPEG-1 */
+ { 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, /* Layer I */
+ 256000, 288000, 320000, 352000, 384000, 416000, 448000 },
+ { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer II */
+ 128000, 160000, 192000, 224000, 256000, 320000, 384000 },
+ { 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, /* Layer III */
+ 112000, 128000, 160000, 192000, 224000, 256000, 320000 },
+
+ /* MPEG-2 LSF */
+ { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, /* Layer I */
+ 128000, 144000, 160000, 176000, 192000, 224000, 256000 },
+ { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, /* Layers */
+ 64000, 80000, 96000, 112000, 128000, 144000, 160000 } /* II & III */
+};
+
+static
+unsigned int const samplerate_table[3] = { 44100, 48000, 32000 };
+
+static
+int (*const decoder_table[3])(struct mad_stream *, struct mad_frame *) = {
+ mad_layer_I,
+ mad_layer_II,
+ mad_layer_III
+};
+
+/*
+ * NAME: header->init()
+ * DESCRIPTION: initialize header struct
+ */
+void mad_header_init(struct mad_header *header)
+{
+ header->layer = 0;
+ header->mode = 0;
+ header->mode_extension = 0;
+ header->emphasis = 0;
+
+ header->bitrate = 0;
+ header->samplerate = 0;
+
+ header->crc_check = 0;
+ header->crc_target = 0;
+
+ header->flags = 0;
+ header->private_bits = 0;
+
+ header->duration = mad_timer_zero;
+}
+
+/*
+ * NAME: frame->init()
+ * DESCRIPTION: initialize frame struct
+ */
+void mad_frame_init(struct mad_frame *frame)
+{
+ mad_header_init(&frame->header);
+
+ frame->options = 0;
+
+ frame->overlap = 0;
+ mad_frame_mute(frame);
+}
+
+/*
+ * NAME: frame->finish()
+ * DESCRIPTION: deallocate any dynamic memory associated with frame
+ */
+void mad_frame_finish(struct mad_frame *frame)
+{
+ mad_header_finish(&frame->header);
+
+ if (frame->overlap) {
+ free(frame->overlap);
+ frame->overlap = 0;
+ }
+}
+
+/*
+ * NAME: decode_header()
+ * DESCRIPTION: read header data and following CRC word
+ */
+static
+int decode_header(struct mad_header *header, struct mad_stream *stream)
+{
+ unsigned int index;
+
+ header->flags = 0;
+ header->private_bits = 0;
+
+ /* header() */
+
+ /* syncword */
+ mad_bit_skip(&stream->ptr, 11);
+
+ /* MPEG 2.5 indicator (really part of syncword) */
+ if (mad_bit_read(&stream->ptr, 1) == 0)
+ header->flags |= MAD_FLAG_MPEG_2_5_EXT;
+
+ /* ID */
+ if (mad_bit_read(&stream->ptr, 1) == 0)
+ header->flags |= MAD_FLAG_LSF_EXT;
+ else if (header->flags & MAD_FLAG_MPEG_2_5_EXT) {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ return -1;
+ }
+
+ /* layer */
+ header->layer = 4 - mad_bit_read(&stream->ptr, 2);
+
+ if (header->layer == 4) {
+ stream->error = MAD_ERROR_BADLAYER;
+ return -1;
+ }
+
+ /* protection_bit */
+ if (mad_bit_read(&stream->ptr, 1) == 0) {
+ header->flags |= MAD_FLAG_PROTECTION;
+ header->crc_check = mad_bit_crc(stream->ptr, 16, 0xffff);
+ }
+
+ /* bitrate_index */
+ index = mad_bit_read(&stream->ptr, 4);
+
+ if (index == 15) {
+ stream->error = MAD_ERROR_BADBITRATE;
+ return -1;
+ }
+
+ if (header->flags & MAD_FLAG_LSF_EXT)
+ header->bitrate = bitrate_table[3 + (header->layer >> 1)][index];
+ else
+ header->bitrate = bitrate_table[header->layer - 1][index];
+
+ /* sampling_frequency */
+ index = mad_bit_read(&stream->ptr, 2);
+
+ if (index == 3) {
+ stream->error = MAD_ERROR_BADSAMPLERATE;
+ return -1;
+ }
+
+ header->samplerate = samplerate_table[index];
+
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+ header->samplerate /= 2;
+
+ if (header->flags & MAD_FLAG_MPEG_2_5_EXT)
+ header->samplerate /= 2;
+ }
+
+ /* padding_bit */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->flags |= MAD_FLAG_PADDING;
+
+ /* private_bit */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->private_bits |= MAD_PRIVATE_HEADER;
+
+ /* mode */
+ header->mode = 3 - mad_bit_read(&stream->ptr, 2);
+
+ /* mode_extension */
+ header->mode_extension = mad_bit_read(&stream->ptr, 2);
+
+ /* copyright */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->flags |= MAD_FLAG_COPYRIGHT;
+
+ /* original/copy */
+ if (mad_bit_read(&stream->ptr, 1))
+ header->flags |= MAD_FLAG_ORIGINAL;
+
+ /* emphasis */
+ header->emphasis = mad_bit_read(&stream->ptr, 2);
+
+# if defined(OPT_STRICT)
+ /*
+ * ISO/IEC 11172-3 says this is a reserved emphasis value, but
+ * streams exist which use it anyway. Since the value is not important
+ * to the decoder proper, we allow it unless OPT_STRICT is defined.
+ */
+ if (header->emphasis == MAD_EMPHASIS_RESERVED) {
+ stream->error = MAD_ERROR_BADEMPHASIS;
+ return -1;
+ }
+# endif
+
+ /* error_check() */
+
+ /* crc_check */
+ if (header->flags & MAD_FLAG_PROTECTION)
+ header->crc_target = mad_bit_read(&stream->ptr, 16);
+
+ return 0;
+}
+
+/*
+ * NAME: free_bitrate()
+ * DESCRIPTION: attempt to discover the bitstream's free bitrate
+ */
+static
+int free_bitrate(struct mad_stream *stream, struct mad_header const *header)
+{
+ struct mad_bitptr keep_ptr;
+ unsigned long rate = 0;
+ unsigned int pad_slot, slots_per_frame;
+ unsigned char const *ptr = 0;
+
+ keep_ptr = stream->ptr;
+
+ pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
+ slots_per_frame = (header->layer == MAD_LAYER_III &&
+ (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
+
+ while (mad_stream_sync(stream) == 0) {
+ struct mad_stream peek_stream;
+ struct mad_header peek_header;
+
+ peek_stream = *stream;
+ peek_header = *header;
+
+ if (decode_header(&peek_header, &peek_stream) == 0 &&
+ peek_header.layer == header->layer &&
+ peek_header.samplerate == header->samplerate) {
+ unsigned int N;
+
+ ptr = mad_bit_nextbyte(&stream->ptr);
+
+ N = ptr - stream->this_frame;
+
+ if (header->layer == MAD_LAYER_I) {
+ rate = (unsigned long) header->samplerate *
+ (N - 4 * pad_slot + 4) / 48 / 1000;
+ }
+ else {
+ rate = (unsigned long) header->samplerate *
+ (N - pad_slot + 1) / slots_per_frame / 1000;
+ }
+
+ if (rate >= 8)
+ break;
+ }
+
+ mad_bit_skip(&stream->ptr, 8);
+ }
+
+ stream->ptr = keep_ptr;
+
+ if (rate < 8 || (header->layer == MAD_LAYER_III && rate > 640)) {
+ stream->error = MAD_ERROR_LOSTSYNC;
+ return -1;
+ }
+
+ stream->freerate = rate * 1000;
+
+ return 0;
+}
+
+/*
+ * NAME: header->decode()
+ * DESCRIPTION: read the next frame header from the stream
+ */
+int mad_header_decode(struct mad_header *header, struct mad_stream *stream)
+{
+ register unsigned char const *ptr, *end;
+ unsigned int pad_slot, N;
+
+ ptr = stream->next_frame;
+ end = stream->bufend;
+
+ if (ptr == 0) {
+ stream->error = MAD_ERROR_BUFPTR;
+ goto fail;
+ }
+
+ /* stream skip */
+ if (stream->skiplen) {
+ if (!stream->sync)
+ ptr = stream->this_frame;
+
+ if (end - ptr < stream->skiplen) {
+ stream->skiplen -= end - ptr;
+ stream->next_frame = end;
+
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
+ }
+
+ ptr += stream->skiplen;
+ stream->skiplen = 0;
+
+ stream->sync = 1;
+ }
+
+ sync:
+ /* synchronize */
+ if (stream->sync) {
+ if (end - ptr < MAD_BUFFER_GUARD) {
+ stream->next_frame = ptr;
+
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
+ }
+ else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
+ /* mark point where frame sync word was expected */
+ stream->this_frame = ptr;
+ stream->next_frame = ptr + 1;
+
+ stream->error = MAD_ERROR_LOSTSYNC;
+ goto fail;
+ }
+ }
+ else {
+ mad_bit_init(&stream->ptr, ptr);
+
+ if (mad_stream_sync(stream) == -1) {
+ if (end - stream->next_frame >= MAD_BUFFER_GUARD)
+ stream->next_frame = end - MAD_BUFFER_GUARD;
+
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
+ }
+
+ ptr = mad_bit_nextbyte(&stream->ptr);
+ }
+
+ /* begin processing */
+ stream->this_frame = ptr;
+ stream->next_frame = ptr + 1; /* possibly bogus sync word */
+
+ mad_bit_init(&stream->ptr, stream->this_frame);
+
+ if (decode_header(header, stream) == -1)
+ goto fail;
+
+ /* calculate frame duration */
+ mad_timer_set(&header->duration, 0,
+ 32 * MAD_NSBSAMPLES(header), header->samplerate);
+
+ /* calculate free bit rate */
+ if (header->bitrate == 0) {
+ if ((stream->freerate == 0 || !stream->sync) &&
+ free_bitrate(stream, header) == -1)
+ goto fail;
+
+ header->bitrate = stream->freerate;
+ header->flags |= MAD_FLAG_FREEFORMAT;
+ }
+
+ /* calculate beginning of next frame */
+ pad_slot = (header->flags & MAD_FLAG_PADDING) ? 1 : 0;
+
+ if (header->layer == MAD_LAYER_I)
+ N = ((12 * header->bitrate / header->samplerate) + pad_slot) * 4;
+ else {
+ unsigned int slots_per_frame;
+
+ slots_per_frame = (header->layer == MAD_LAYER_III &&
+ (header->flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
+
+ N = (slots_per_frame * header->bitrate / header->samplerate) + pad_slot;
+ }
+
+ /* verify there is enough data left in buffer to decode this frame */
+ if (N + MAD_BUFFER_GUARD > end - stream->this_frame) {
+ stream->next_frame = stream->this_frame;
+
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
+ }
+
+ stream->next_frame = stream->this_frame + N;
+
+ if (!stream->sync) {
+ /* check that a valid frame header follows this frame */
+
+ ptr = stream->next_frame;
+ if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
+ ptr = stream->next_frame = stream->this_frame + 1;
+ goto sync;
+ }
+
+ stream->sync = 1;
+ }
+
+ header->flags |= MAD_FLAG_INCOMPLETE;
+
+ return 0;
+
+ fail:
+ stream->sync = 0;
+
+ return -1;
+}
+
+/*
+ * NAME: frame->decode()
+ * DESCRIPTION: decode a single frame from a bitstream
+ */
+int mad_frame_decode(struct mad_frame *frame, struct mad_stream *stream)
+{
+ frame->options = stream->options;
+
+ /* header() */
+ /* error_check() */
+
+ if (!(frame->header.flags & MAD_FLAG_INCOMPLETE) &&
+ mad_header_decode(&frame->header, stream) == -1)
+ goto fail;
+
+ /* audio_data() */
+
+ frame->header.flags &= ~MAD_FLAG_INCOMPLETE;
+
+ if (decoder_table[frame->header.layer - 1](stream, frame) == -1) {
+ if (!MAD_RECOVERABLE(stream->error))
+ stream->next_frame = stream->this_frame;
+
+ goto fail;
+ }
+
+ /* ancillary_data() */
+
+ if (frame->header.layer != MAD_LAYER_III) {
+ struct mad_bitptr next_frame;
+
+ mad_bit_init(&next_frame, stream->next_frame);
+
+ stream->anc_ptr = stream->ptr;
+ stream->anc_bitlen = mad_bit_length(&stream->ptr, &next_frame);
+
+ mad_bit_finish(&next_frame);
+ }
+
+ return 0;
+
+ fail:
+ stream->anc_bitlen = 0;
+ return -1;
+}
+
+/*
+ * NAME: frame->mute()
+ * DESCRIPTION: zero all subband values so the frame becomes silent
+ */
+void mad_frame_mute(struct mad_frame *frame)
+{
+ unsigned int s, sb;
+
+ for (s = 0; s < 36; ++s) {
+ for (sb = 0; sb < 32; ++sb) {
+ frame->sbsample[0][s][sb] =
+ frame->sbsample[1][s][sb] = 0;
+ }
+ }
+
+ if (frame->overlap) {
+ for (s = 0; s < 18; ++s) {
+ for (sb = 0; sb < 32; ++sb) {
+ (*frame->overlap)[0][sb][s] =
+ (*frame->overlap)[1][sb][s] = 0;
+ }
+ }
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/frame.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/frame.h
new file mode 100644
index 000000000..dc27b1dd6
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/frame.h
@@ -0,0 +1,118 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: frame.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_FRAME_H
+# define LIBMAD_FRAME_H
+
+# include "fixed.h"
+# include "timer.h"
+# include "stream.h"
+
+enum mad_layer {
+ MAD_LAYER_I = 1, /* Layer I */
+ MAD_LAYER_II = 2, /* Layer II */
+ MAD_LAYER_III = 3 /* Layer III */
+};
+
+enum mad_mode {
+ MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
+ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
+ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
+ MAD_MODE_STEREO = 3 /* normal LR stereo */
+};
+
+enum mad_emphasis {
+ MAD_EMPHASIS_NONE = 0, /* no emphasis */
+ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
+ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
+ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
+};
+
+struct mad_header {
+ enum mad_layer layer; /* audio layer (1, 2, or 3) */
+ enum mad_mode mode; /* channel mode (see above) */
+ int mode_extension; /* additional mode info */
+ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
+
+ unsigned long bitrate; /* stream bitrate (bps) */
+ unsigned int samplerate; /* sampling frequency (Hz) */
+
+ unsigned short crc_check; /* frame CRC accumulator */
+ unsigned short crc_target; /* final target CRC checksum */
+
+ int flags; /* flags (see below) */
+ int private_bits; /* private bits (see below) */
+
+ mad_timer_t duration; /* audio playing time of frame */
+};
+
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
+
+ int options; /* decoding options (from stream) */
+
+ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
+ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
+};
+
+# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
+# define MAD_NSBSAMPLES(header) \
+ ((header)->layer == MAD_LAYER_I ? 12 : \
+ (((header)->layer == MAD_LAYER_III && \
+ ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
+
+enum {
+ MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
+ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
+
+ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
+ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
+ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
+ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
+
+ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
+ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
+ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
+
+ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
+ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
+ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
+};
+
+enum {
+ MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
+ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
+};
+
+void mad_header_init(struct mad_header *);
+
+# define mad_header_finish(header) /* nothing */
+
+int mad_header_decode(struct mad_header *, struct mad_stream *);
+
+void mad_frame_init(struct mad_frame *);
+void mad_frame_finish(struct mad_frame *);
+
+int mad_frame_decode(struct mad_frame *, struct mad_stream *);
+
+void mad_frame_mute(struct mad_frame *);
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/global.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/global.h
new file mode 100644
index 000000000..c49697e0a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/global.h
@@ -0,0 +1,58 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: global.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_GLOBAL_H
+# define LIBMAD_GLOBAL_H
+
+/* conditional debugging */
+
+# if defined(DEBUG) && defined(NDEBUG)
+# error "cannot define both DEBUG and NDEBUG"
+# endif
+
+# if defined(DEBUG)
+# include <stdio.h>
+# endif
+
+/* conditional features */
+
+# if defined(OPT_SPEED) && defined(OPT_ACCURACY)
+# error "cannot optimize for both speed and accuracy"
+# endif
+
+# if defined(OPT_SPEED) && !defined(OPT_SSO)
+# define OPT_SSO
+# endif
+
+# if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \
+ defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK)
+# define USE_ASYNC
+# endif
+
+# if !defined(HAVE_ASSERT_H)
+# if defined(NDEBUG)
+# define assert(x) /* nothing */
+# else
+# define assert(x) do { if (!(x)) abort(); } while (0)
+# endif
+# endif
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/huffman.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/huffman.c
new file mode 100644
index 000000000..8f5241b38
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/huffman.c
@@ -0,0 +1,3098 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: huffman.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# include "huffman.h"
+
+/*
+ * These are the Huffman code words for Layer III.
+ * The data for these tables are derived from Table B.7 of ISO/IEC 11172-3.
+ *
+ * These tables support decoding up to 4 Huffman code bits at a time.
+ */
+
+# if defined(__GNUC__)
+# define PTR(offs, bits) { ptr: { 0, bits, offs } }
+# define V(v, w, x, y, hlen) { value: { 1, hlen, v, w, x, y } }
+# else
+# define PTR(offs, bits) { { 0, bits, offs } }
+# define V(v, w, x, y, hlen) { { 1, hlen, (v << 0) | (w << 1) | \
+ (x << 2) | (y << 3) } }
+# endif
+
+static
+union huffquad const hufftabA[] = {
+ /* 0000 */ PTR(16, 2),
+ /* 0001 */ PTR(20, 2),
+ /* 0010 */ PTR(24, 1),
+ /* 0011 */ PTR(26, 1),
+ /* 0100 */ V(0, 0, 1, 0, 4),
+ /* 0101 */ V(0, 0, 0, 1, 4),
+ /* 0110 */ V(0, 1, 0, 0, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 0, 0, 0, 1),
+ /* 1001 */ V(0, 0, 0, 0, 1),
+ /* 1010 */ V(0, 0, 0, 0, 1),
+ /* 1011 */ V(0, 0, 0, 0, 1),
+ /* 1100 */ V(0, 0, 0, 0, 1),
+ /* 1101 */ V(0, 0, 0, 0, 1),
+ /* 1110 */ V(0, 0, 0, 0, 1),
+ /* 1111 */ V(0, 0, 0, 0, 1),
+
+ /* 0000 ... */
+ /* 00 */ V(1, 0, 1, 1, 2), /* 16 */
+ /* 01 */ V(1, 1, 1, 1, 2),
+ /* 10 */ V(1, 1, 0, 1, 2),
+ /* 11 */ V(1, 1, 1, 0, 2),
+
+ /* 0001 ... */
+ /* 00 */ V(0, 1, 1, 1, 2), /* 20 */
+ /* 01 */ V(0, 1, 0, 1, 2),
+ /* 10 */ V(1, 0, 0, 1, 1),
+ /* 11 */ V(1, 0, 0, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(0, 1, 1, 0, 1), /* 24 */
+ /* 1 */ V(0, 0, 1, 1, 1),
+
+ /* 0011 ... */
+ /* 0 */ V(1, 0, 1, 0, 1), /* 26 */
+ /* 1 */ V(1, 1, 0, 0, 1)
+};
+
+static
+union huffquad const hufftabB[] = {
+ /* 0000 */ V(1, 1, 1, 1, 4),
+ /* 0001 */ V(1, 1, 1, 0, 4),
+ /* 0010 */ V(1, 1, 0, 1, 4),
+ /* 0011 */ V(1, 1, 0, 0, 4),
+ /* 0100 */ V(1, 0, 1, 1, 4),
+ /* 0101 */ V(1, 0, 1, 0, 4),
+ /* 0110 */ V(1, 0, 0, 1, 4),
+ /* 0111 */ V(1, 0, 0, 0, 4),
+ /* 1000 */ V(0, 1, 1, 1, 4),
+ /* 1001 */ V(0, 1, 1, 0, 4),
+ /* 1010 */ V(0, 1, 0, 1, 4),
+ /* 1011 */ V(0, 1, 0, 0, 4),
+ /* 1100 */ V(0, 0, 1, 1, 4),
+ /* 1101 */ V(0, 0, 1, 0, 4),
+ /* 1110 */ V(0, 0, 0, 1, 4),
+ /* 1111 */ V(0, 0, 0, 0, 4)
+};
+
+# undef V
+# undef PTR
+
+# if defined(__GNUC__)
+# define PTR(offs, bits) { ptr: { 0, bits, offs } }
+# define V(x, y, hlen) { value: { 1, hlen, x, y } }
+# else
+# define PTR(offs, bits) { { 0, bits, offs } }
+# define V(x, y, hlen) { { 1, hlen, (x << 0) | (y << 4) } }
+# endif
+
+static
+union huffpair const hufftab0[] = {
+ /* */ V(0, 0, 0)
+};
+
+static
+union huffpair const hufftab1[] = {
+ /* 000 */ V(1, 1, 3),
+ /* 001 */ V(0, 1, 3),
+ /* 010 */ V(1, 0, 2),
+ /* 011 */ V(1, 0, 2),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1)
+};
+
+static
+union huffpair const hufftab2[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
+};
+
+static
+union huffpair const hufftab3[] = {
+ /* 000 */ PTR(8, 3),
+ /* 001 */ V(1, 0, 3),
+ /* 010 */ V(1, 1, 2),
+ /* 011 */ V(1, 1, 2),
+ /* 100 */ V(0, 1, 2),
+ /* 101 */ V(0, 1, 2),
+ /* 110 */ V(0, 0, 2),
+ /* 111 */ V(0, 0, 2),
+
+ /* 000 ... */
+ /* 000 */ V(2, 2, 3), /* 8 */
+ /* 001 */ V(0, 2, 3),
+ /* 010 */ V(1, 2, 2),
+ /* 011 */ V(1, 2, 2),
+ /* 100 */ V(2, 1, 2),
+ /* 101 */ V(2, 1, 2),
+ /* 110 */ V(2, 0, 2),
+ /* 111 */ V(2, 0, 2)
+};
+
+static
+union huffpair const hufftab5[] = {
+ /* 000 */ PTR(8, 4),
+ /* 001 */ V(1, 1, 3),
+ /* 010 */ V(0, 1, 3),
+ /* 011 */ V(1, 0, 3),
+ /* 100 */ V(0, 0, 1),
+ /* 101 */ V(0, 0, 1),
+ /* 110 */ V(0, 0, 1),
+ /* 111 */ V(0, 0, 1),
+
+ /* 000 ... */
+ /* 0000 */ PTR(24, 1), /* 8 */
+ /* 0001 */ V(3, 2, 4),
+ /* 0010 */ V(3, 1, 3),
+ /* 0011 */ V(3, 1, 3),
+ /* 0100 */ V(1, 3, 4),
+ /* 0101 */ V(0, 3, 4),
+ /* 0110 */ V(3, 0, 4),
+ /* 0111 */ V(2, 2, 4),
+ /* 1000 */ V(1, 2, 3),
+ /* 1001 */ V(1, 2, 3),
+ /* 1010 */ V(2, 1, 3),
+ /* 1011 */ V(2, 1, 3),
+ /* 1100 */ V(0, 2, 3),
+ /* 1101 */ V(0, 2, 3),
+ /* 1110 */ V(2, 0, 3),
+ /* 1111 */ V(2, 0, 3),
+
+ /* 000 0000 ... */
+ /* 0 */ V(3, 3, 1), /* 24 */
+ /* 1 */ V(2, 3, 1)
+};
+
+static
+union huffpair const hufftab6[] = {
+ /* 0000 */ PTR(16, 3),
+ /* 0001 */ PTR(24, 1),
+ /* 0010 */ PTR(26, 1),
+ /* 0011 */ V(1, 2, 4),
+ /* 0100 */ V(2, 1, 4),
+ /* 0101 */ V(2, 0, 4),
+ /* 0110 */ V(0, 1, 3),
+ /* 0111 */ V(0, 1, 3),
+ /* 1000 */ V(1, 1, 2),
+ /* 1001 */ V(1, 1, 2),
+ /* 1010 */ V(1, 1, 2),
+ /* 1011 */ V(1, 1, 2),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 000 */ V(3, 3, 3), /* 16 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(2, 3, 2),
+ /* 011 */ V(2, 3, 2),
+ /* 100 */ V(3, 2, 2),
+ /* 101 */ V(3, 2, 2),
+ /* 110 */ V(3, 0, 2),
+ /* 111 */ V(3, 0, 2),
+
+ /* 0001 ... */
+ /* 0 */ V(1, 3, 1), /* 24 */
+ /* 1 */ V(3, 1, 1),
+
+ /* 0010 ... */
+ /* 0 */ V(2, 2, 1), /* 26 */
+ /* 1 */ V(0, 2, 1)
+};
+
+static
+union huffpair const hufftab7[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 2), /* 16 */
+ /* 0001 */ PTR(56, 1),
+ /* 0010 */ PTR(58, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(60, 1),
+ /* 0110 */ V(5, 0, 4),
+ /* 0111 */ PTR(62, 1),
+ /* 1000 */ V(2, 4, 4),
+ /* 1001 */ V(4, 2, 4),
+ /* 1010 */ V(1, 4, 3),
+ /* 1011 */ V(1, 4, 3),
+ /* 1100 */ V(4, 1, 3),
+ /* 1101 */ V(4, 1, 3),
+ /* 1110 */ V(4, 0, 3),
+ /* 1111 */ V(4, 0, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(0, 4, 4), /* 32 */
+ /* 0001 */ V(2, 3, 4),
+ /* 0010 */ V(3, 2, 4),
+ /* 0011 */ V(0, 3, 4),
+ /* 0100 */ V(1, 3, 3),
+ /* 0101 */ V(1, 3, 3),
+ /* 0110 */ V(3, 1, 3),
+ /* 0111 */ V(3, 1, 3),
+ /* 1000 */ V(3, 0, 3),
+ /* 1001 */ V(3, 0, 3),
+ /* 1010 */ V(2, 2, 3),
+ /* 1011 */ V(2, 2, 3),
+ /* 1100 */ V(1, 2, 2),
+ /* 1101 */ V(1, 2, 2),
+ /* 1110 */ V(1, 2, 2),
+ /* 1111 */ V(1, 2, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 1, 1), /* 48 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(5, 5, 2), /* 52 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(3, 5, 1), /* 56 */
+ /* 1 */ V(4, 4, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(2, 5, 1), /* 58 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(0, 5, 1), /* 60 */
+ /* 1 */ V(3, 4, 1),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(4, 3, 1), /* 62 */
+ /* 1 */ V(3, 3, 1)
+};
+
+# if 0
+/* this version saves 8 entries (16 bytes) at the expense of
+ an extra lookup in 4 out of 36 cases */
+static
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 2),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(36, 3), /* 16 */
+ /* 0001 */ PTR(44, 2),
+ /* 0010 */ PTR(48, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(50, 1),
+ /* 0110 */ PTR(52, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 00 */ PTR(54, 2), /* 32 */
+ /* 01 */ V(2, 2, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 36 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 44 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 48 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 50 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 52 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0001 00 ... */
+ /* 00 */ V(1, 3, 2), /* 54 */
+ /* 01 */ V(3, 1, 2),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
+};
+# else
+static
+union huffpair const hufftab8[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ V(1, 2, 4),
+ /* 0011 */ V(2, 1, 4),
+ /* 0100 */ V(1, 1, 2),
+ /* 0101 */ V(1, 1, 2),
+ /* 0110 */ V(1, 1, 2),
+ /* 0111 */ V(1, 1, 2),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(48, 3), /* 16 */
+ /* 0001 */ PTR(56, 2),
+ /* 0010 */ PTR(60, 1),
+ /* 0011 */ V(1, 5, 4),
+ /* 0100 */ V(5, 1, 4),
+ /* 0101 */ PTR(62, 1),
+ /* 0110 */ PTR(64, 1),
+ /* 0111 */ V(2, 4, 4),
+ /* 1000 */ V(4, 2, 4),
+ /* 1001 */ V(1, 4, 4),
+ /* 1010 */ V(4, 1, 3),
+ /* 1011 */ V(4, 1, 3),
+ /* 1100 */ V(0, 4, 4),
+ /* 1101 */ V(4, 0, 4),
+ /* 1110 */ V(2, 3, 4),
+ /* 1111 */ V(3, 2, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(1, 3, 4), /* 32 */
+ /* 0001 */ V(3, 1, 4),
+ /* 0010 */ V(0, 3, 4),
+ /* 0011 */ V(3, 0, 4),
+ /* 0100 */ V(2, 2, 2),
+ /* 0101 */ V(2, 2, 2),
+ /* 0110 */ V(2, 2, 2),
+ /* 0111 */ V(2, 2, 2),
+ /* 1000 */ V(0, 2, 2),
+ /* 1001 */ V(0, 2, 2),
+ /* 1010 */ V(0, 2, 2),
+ /* 1011 */ V(0, 2, 2),
+ /* 1100 */ V(2, 0, 2),
+ /* 1101 */ V(2, 0, 2),
+ /* 1110 */ V(2, 0, 2),
+ /* 1111 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(5, 5, 3), /* 48 */
+ /* 001 */ V(5, 4, 3),
+ /* 010 */ V(4, 5, 2),
+ /* 011 */ V(4, 5, 2),
+ /* 100 */ V(5, 3, 1),
+ /* 101 */ V(5, 3, 1),
+ /* 110 */ V(5, 3, 1),
+ /* 111 */ V(5, 3, 1),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(3, 5, 2), /* 56 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(5, 2, 1), /* 60 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(3, 4, 1), /* 62 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(5, 0, 1), /* 64 */
+ /* 1 */ V(3, 3, 1)
+};
+# endif
+
+static
+union huffpair const hufftab9[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 3),
+ /* 0010 */ PTR(40, 2),
+ /* 0011 */ PTR(44, 2),
+ /* 0100 */ PTR(48, 1),
+ /* 0101 */ V(1, 2, 4),
+ /* 0110 */ V(2, 1, 4),
+ /* 0111 */ V(2, 0, 4),
+ /* 1000 */ V(1, 1, 3),
+ /* 1001 */ V(1, 1, 3),
+ /* 1010 */ V(0, 1, 3),
+ /* 1011 */ V(0, 1, 3),
+ /* 1100 */ V(1, 0, 3),
+ /* 1101 */ V(1, 0, 3),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(50, 1), /* 16 */
+ /* 0001 */ V(3, 5, 4),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ PTR(52, 1),
+ /* 0100 */ V(4, 4, 4),
+ /* 0101 */ V(2, 5, 4),
+ /* 0110 */ V(5, 2, 4),
+ /* 0111 */ V(1, 5, 4),
+ /* 1000 */ V(5, 1, 3),
+ /* 1001 */ V(5, 1, 3),
+ /* 1010 */ V(3, 4, 3),
+ /* 1011 */ V(3, 4, 3),
+ /* 1100 */ V(4, 3, 3),
+ /* 1101 */ V(4, 3, 3),
+ /* 1110 */ V(5, 0, 4),
+ /* 1111 */ V(0, 4, 4),
+
+ /* 0001 ... */
+ /* 000 */ V(2, 4, 3), /* 32 */
+ /* 001 */ V(4, 2, 3),
+ /* 010 */ V(3, 3, 3),
+ /* 011 */ V(4, 0, 3),
+ /* 100 */ V(1, 4, 2),
+ /* 101 */ V(1, 4, 2),
+ /* 110 */ V(4, 1, 2),
+ /* 111 */ V(4, 1, 2),
+
+ /* 0010 ... */
+ /* 00 */ V(2, 3, 2), /* 40 */
+ /* 01 */ V(3, 2, 2),
+ /* 10 */ V(1, 3, 1),
+ /* 11 */ V(1, 3, 1),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 1, 1), /* 44 */
+ /* 01 */ V(3, 1, 1),
+ /* 10 */ V(0, 3, 2),
+ /* 11 */ V(3, 0, 2),
+
+ /* 0100 ... */
+ /* 0 */ V(2, 2, 1), /* 48 */
+ /* 1 */ V(0, 2, 1),
+
+ /* 0000 0000 ... */
+ /* 0 */ V(5, 5, 1), /* 50 */
+ /* 1 */ V(4, 5, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(5, 4, 1), /* 52 */
+ /* 1 */ V(0, 5, 1)
+};
+
+static
+union huffpair const hufftab10[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 2),
+ /* 0011 */ V(1, 1, 4),
+ /* 0100 */ V(0, 1, 3),
+ /* 0101 */ V(0, 1, 3),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(52, 3), /* 16 */
+ /* 0001 */ PTR(60, 2),
+ /* 0010 */ PTR(64, 3),
+ /* 0011 */ PTR(72, 1),
+ /* 0100 */ PTR(74, 2),
+ /* 0101 */ PTR(78, 2),
+ /* 0110 */ PTR(82, 2),
+ /* 0111 */ V(1, 7, 4),
+ /* 1000 */ V(7, 1, 4),
+ /* 1001 */ PTR(86, 1),
+ /* 1010 */ PTR(88, 2),
+ /* 1011 */ PTR(92, 2),
+ /* 1100 */ V(1, 6, 4),
+ /* 1101 */ V(6, 1, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(96, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(98, 1), /* 32 */
+ /* 0001 */ PTR(100, 1),
+ /* 0010 */ V(1, 4, 4),
+ /* 0011 */ V(4, 1, 4),
+ /* 0100 */ V(4, 0, 4),
+ /* 0101 */ V(2, 3, 4),
+ /* 0110 */ V(3, 2, 4),
+ /* 0111 */ V(0, 3, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0010 ... */
+ /* 00 */ V(1, 2, 2), /* 48 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(7, 7, 3), /* 52 */
+ /* 001 */ V(6, 7, 3),
+ /* 010 */ V(7, 6, 3),
+ /* 011 */ V(5, 7, 3),
+ /* 100 */ V(7, 5, 3),
+ /* 101 */ V(6, 6, 3),
+ /* 110 */ V(4, 7, 2),
+ /* 111 */ V(4, 7, 2),
+
+ /* 0000 0001 ... */
+ /* 00 */ V(7, 4, 2), /* 60 */
+ /* 01 */ V(5, 6, 2),
+ /* 10 */ V(6, 5, 2),
+ /* 11 */ V(3, 7, 2),
+
+ /* 0000 0010 ... */
+ /* 000 */ V(7, 3, 2), /* 64 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(4, 6, 2),
+ /* 011 */ V(4, 6, 2),
+ /* 100 */ V(5, 5, 3),
+ /* 101 */ V(5, 4, 3),
+ /* 110 */ V(6, 3, 2),
+ /* 111 */ V(6, 3, 2),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(2, 7, 1), /* 72 */
+ /* 1 */ V(7, 2, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(6, 4, 2), /* 74 */
+ /* 01 */ V(0, 7, 2),
+ /* 10 */ V(7, 0, 1),
+ /* 11 */ V(7, 0, 1),
+
+ /* 0000 0101 ... */
+ /* 00 */ V(6, 2, 1), /* 78 */
+ /* 01 */ V(6, 2, 1),
+ /* 10 */ V(4, 5, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0000 0110 ... */
+ /* 00 */ V(0, 6, 1), /* 82 */
+ /* 01 */ V(0, 6, 1),
+ /* 10 */ V(5, 3, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0000 1001 ... */
+ /* 0 */ V(3, 6, 1), /* 86 */
+ /* 1 */ V(2, 6, 1),
+
+ /* 0000 1010 ... */
+ /* 00 */ V(2, 5, 2), /* 88 */
+ /* 01 */ V(5, 2, 2),
+ /* 10 */ V(1, 5, 1),
+ /* 11 */ V(1, 5, 1),
+
+ /* 0000 1011 ... */
+ /* 00 */ V(5, 1, 1), /* 92 */
+ /* 01 */ V(5, 1, 1),
+ /* 10 */ V(3, 4, 2),
+ /* 11 */ V(4, 3, 2),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(0, 5, 1), /* 96 */
+ /* 1 */ V(5, 0, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(2, 4, 1), /* 98 */
+ /* 1 */ V(4, 2, 1),
+
+ /* 0001 0001 ... */
+ /* 0 */ V(3, 3, 1), /* 100 */
+ /* 1 */ V(0, 4, 1)
+};
+
+static
+union huffpair const hufftab11[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 3),
+ /* 0100 */ V(1, 2, 4),
+ /* 0101 */ PTR(72, 1),
+ /* 0110 */ V(1, 1, 3),
+ /* 0111 */ V(1, 1, 3),
+ /* 1000 */ V(0, 1, 3),
+ /* 1001 */ V(0, 1, 3),
+ /* 1010 */ V(1, 0, 3),
+ /* 1011 */ V(1, 0, 3),
+ /* 1100 */ V(0, 0, 2),
+ /* 1101 */ V(0, 0, 2),
+ /* 1110 */ V(0, 0, 2),
+ /* 1111 */ V(0, 0, 2),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(74, 2), /* 16 */
+ /* 0001 */ PTR(78, 3),
+ /* 0010 */ PTR(86, 2),
+ /* 0011 */ PTR(90, 1),
+ /* 0100 */ PTR(92, 2),
+ /* 0101 */ V(2, 7, 4),
+ /* 0110 */ V(7, 2, 4),
+ /* 0111 */ PTR(96, 1),
+ /* 1000 */ V(7, 1, 3),
+ /* 1001 */ V(7, 1, 3),
+ /* 1010 */ V(1, 7, 4),
+ /* 1011 */ V(7, 0, 4),
+ /* 1100 */ V(3, 6, 4),
+ /* 1101 */ V(6, 3, 4),
+ /* 1110 */ V(6, 0, 4),
+ /* 1111 */ PTR(98, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(100, 1), /* 32 */
+ /* 0001 */ V(1, 5, 4),
+ /* 0010 */ V(6, 2, 3),
+ /* 0011 */ V(6, 2, 3),
+ /* 0100 */ V(2, 6, 4),
+ /* 0101 */ V(0, 6, 4),
+ /* 0110 */ V(1, 6, 3),
+ /* 0111 */ V(1, 6, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(5, 1, 4),
+ /* 1011 */ V(3, 4, 4),
+ /* 1100 */ V(5, 0, 4),
+ /* 1101 */ PTR(102, 1),
+ /* 1110 */ V(2, 4, 4),
+ /* 1111 */ V(4, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 4, 4), /* 48 */
+ /* 0001 */ V(4, 1, 4),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 0011 ... */
+ /* 000 */ V(0, 3, 3), /* 64 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(2, 1, 1),
+ /* 101 */ V(2, 1, 1),
+ /* 110 */ V(2, 1, 1),
+ /* 111 */ V(2, 1, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(0, 2, 1), /* 72 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 74 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 2),
+ /* 11 */ V(7, 5, 2),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(6, 6, 2), /* 78 */
+ /* 001 */ V(6, 6, 2),
+ /* 010 */ V(4, 7, 2),
+ /* 011 */ V(4, 7, 2),
+ /* 100 */ V(7, 4, 2),
+ /* 101 */ V(7, 4, 2),
+ /* 110 */ V(5, 7, 3),
+ /* 111 */ V(5, 5, 3),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(5, 6, 2), /* 86 */
+ /* 01 */ V(6, 5, 2),
+ /* 10 */ V(3, 7, 1),
+ /* 11 */ V(3, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(4, 5, 2), /* 92 */
+ /* 01 */ V(5, 4, 2),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(5, 3, 2),
+
+ /* 0000 0111 ... */
+ /* 0 */ V(6, 4, 1), /* 96 */
+ /* 1 */ V(0, 7, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(4, 4, 1), /* 98 */
+ /* 1 */ V(2, 5, 1),
+
+ /* 0001 0000 ... */
+ /* 0 */ V(5, 2, 1), /* 100 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(4, 3, 1), /* 102 */
+ /* 1 */ V(3, 3, 1)
+};
+
+static
+union huffpair const hufftab12[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ PTR(68, 3),
+ /* 0101 */ PTR(76, 1),
+ /* 0110 */ V(1, 2, 4),
+ /* 0111 */ V(2, 1, 4),
+ /* 1000 */ PTR(78, 1),
+ /* 1001 */ V(0, 0, 4),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 3),
+ /* 1101 */ V(0, 1, 3),
+ /* 1110 */ V(1, 0, 3),
+ /* 1111 */ V(1, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(80, 2), /* 16 */
+ /* 0001 */ PTR(84, 1),
+ /* 0010 */ PTR(86, 1),
+ /* 0011 */ PTR(88, 1),
+ /* 0100 */ V(5, 6, 4),
+ /* 0101 */ V(3, 7, 4),
+ /* 0110 */ PTR(90, 1),
+ /* 0111 */ V(2, 7, 4),
+ /* 1000 */ V(7, 2, 4),
+ /* 1001 */ V(4, 6, 4),
+ /* 1010 */ V(6, 4, 4),
+ /* 1011 */ V(1, 7, 4),
+ /* 1100 */ V(7, 1, 4),
+ /* 1101 */ PTR(92, 1),
+ /* 1110 */ V(3, 6, 4),
+ /* 1111 */ V(6, 3, 4),
+
+ /* 0001 ... */
+ /* 0000 */ V(4, 5, 4), /* 32 */
+ /* 0001 */ V(5, 4, 4),
+ /* 0010 */ V(4, 4, 4),
+ /* 0011 */ PTR(94, 1),
+ /* 0100 */ V(2, 6, 3),
+ /* 0101 */ V(2, 6, 3),
+ /* 0110 */ V(6, 2, 3),
+ /* 0111 */ V(6, 2, 3),
+ /* 1000 */ V(6, 1, 3),
+ /* 1001 */ V(6, 1, 3),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 0, 4),
+ /* 1100 */ V(3, 5, 4),
+ /* 1101 */ V(5, 3, 4),
+ /* 1110 */ V(2, 5, 4),
+ /* 1111 */ V(5, 2, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(1, 5, 3), /* 48 */
+ /* 0001 */ V(1, 5, 3),
+ /* 0010 */ V(5, 1, 3),
+ /* 0011 */ V(5, 1, 3),
+ /* 0100 */ V(3, 4, 3),
+ /* 0101 */ V(3, 4, 3),
+ /* 0110 */ V(4, 3, 3),
+ /* 0111 */ V(4, 3, 3),
+ /* 1000 */ V(5, 0, 4),
+ /* 1001 */ V(0, 4, 4),
+ /* 1010 */ V(2, 4, 3),
+ /* 1011 */ V(2, 4, 3),
+ /* 1100 */ V(4, 2, 3),
+ /* 1101 */ V(4, 2, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(3, 3, 2), /* 64 */
+ /* 01 */ V(4, 1, 2),
+ /* 10 */ V(2, 3, 2),
+ /* 11 */ V(3, 2, 2),
+
+ /* 0100 ... */
+ /* 000 */ V(4, 0, 3), /* 68 */
+ /* 001 */ V(0, 3, 3),
+ /* 010 */ V(3, 0, 2),
+ /* 011 */ V(3, 0, 2),
+ /* 100 */ V(1, 3, 1),
+ /* 101 */ V(1, 3, 1),
+ /* 110 */ V(1, 3, 1),
+ /* 111 */ V(1, 3, 1),
+
+ /* 0101 ... */
+ /* 0 */ V(3, 1, 1), /* 76 */
+ /* 1 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(0, 2, 1), /* 78 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 00 */ V(7, 7, 2), /* 80 */
+ /* 01 */ V(6, 7, 2),
+ /* 10 */ V(7, 6, 1),
+ /* 11 */ V(7, 6, 1),
+
+ /* 0000 0001 ... */
+ /* 0 */ V(5, 7, 1), /* 84 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0000 0010 ... */
+ /* 0 */ V(6, 6, 1), /* 86 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0000 0011 ... */
+ /* 0 */ V(7, 4, 1), /* 88 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0000 0110 ... */
+ /* 0 */ V(7, 3, 1), /* 90 */
+ /* 1 */ V(5, 5, 1),
+
+ /* 0000 1101 ... */
+ /* 0 */ V(0, 7, 1), /* 92 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0001 0011 ... */
+ /* 0 */ V(0, 6, 1), /* 94 */
+ /* 1 */ V(0, 5, 1)
+};
+
+static
+union huffpair const hufftab13[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 4), /* 16 */
+ /* 0001 */ PTR(84, 4),
+ /* 0010 */ PTR(100, 4),
+ /* 0011 */ PTR(116, 4),
+ /* 0100 */ PTR(132, 4),
+ /* 0101 */ PTR(148, 4),
+ /* 0110 */ PTR(164, 3),
+ /* 0111 */ PTR(172, 3),
+ /* 1000 */ PTR(180, 3),
+ /* 1001 */ PTR(188, 3),
+ /* 1010 */ PTR(196, 3),
+ /* 1011 */ PTR(204, 3),
+ /* 1100 */ PTR(212, 1),
+ /* 1101 */ PTR(214, 2),
+ /* 1110 */ PTR(218, 3),
+ /* 1111 */ PTR(226, 1),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(228, 2), /* 32 */
+ /* 0001 */ PTR(232, 2),
+ /* 0010 */ PTR(236, 2),
+ /* 0011 */ PTR(240, 2),
+ /* 0100 */ V(8, 1, 4),
+ /* 0101 */ PTR(244, 1),
+ /* 0110 */ PTR(246, 1),
+ /* 0111 */ PTR(248, 1),
+ /* 1000 */ PTR(250, 2),
+ /* 1001 */ PTR(254, 1),
+ /* 1010 */ V(1, 5, 4),
+ /* 1011 */ V(5, 1, 4),
+ /* 1100 */ PTR(256, 1),
+ /* 1101 */ PTR(258, 1),
+ /* 1110 */ PTR(260, 1),
+ /* 1111 */ V(1, 4, 4),
+
+ /* 0010 ... */
+ /* 0000 */ V(4, 1, 3), /* 48 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 4),
+ /* 0101 */ V(3, 2, 4),
+ /* 0110 */ V(1, 3, 3),
+ /* 0111 */ V(1, 3, 3),
+ /* 1000 */ V(3, 1, 3),
+ /* 1001 */ V(3, 1, 3),
+ /* 1010 */ V(0, 3, 3),
+ /* 1011 */ V(0, 3, 3),
+ /* 1100 */ V(3, 0, 3),
+ /* 1101 */ V(3, 0, 3),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(262, 4), /* 68 */
+ /* 0001 */ PTR(278, 4),
+ /* 0010 */ PTR(294, 4),
+ /* 0011 */ PTR(310, 3),
+ /* 0100 */ PTR(318, 2),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 3),
+ /* 0111 */ PTR(334, 2),
+ /* 1000 */ PTR(338, 1),
+ /* 1001 */ PTR(340, 2),
+ /* 1010 */ PTR(344, 2),
+ /* 1011 */ PTR(348, 2),
+ /* 1100 */ PTR(352, 2),
+ /* 1101 */ PTR(356, 2),
+ /* 1110 */ V(1, 15, 4),
+ /* 1111 */ V(15, 1, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 0, 4), /* 84 */
+ /* 0001 */ PTR(360, 1),
+ /* 0010 */ PTR(362, 1),
+ /* 0011 */ PTR(364, 1),
+ /* 0100 */ V(14, 2, 4),
+ /* 0101 */ PTR(366, 1),
+ /* 0110 */ V(1, 14, 4),
+ /* 0111 */ V(14, 1, 4),
+ /* 1000 */ PTR(368, 1),
+ /* 1001 */ PTR(370, 1),
+ /* 1010 */ PTR(372, 1),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 1),
+ /* 1101 */ PTR(378, 1),
+ /* 1110 */ V(12, 6, 4),
+ /* 1111 */ V(3, 13, 4),
+
+ /* 0000 0010 ... */
+ /* 0000 */ PTR(380, 1), /* 100 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(1, 13, 4),
+ /* 0100 */ V(11, 7, 4),
+ /* 0101 */ PTR(382, 1),
+ /* 0110 */ PTR(384, 1),
+ /* 0111 */ V(12, 3, 4),
+ /* 1000 */ PTR(386, 1),
+ /* 1001 */ V(4, 11, 4),
+ /* 1010 */ V(13, 1, 3),
+ /* 1011 */ V(13, 1, 3),
+ /* 1100 */ V(0, 13, 4),
+ /* 1101 */ V(13, 0, 4),
+ /* 1110 */ V(8, 10, 4),
+ /* 1111 */ V(10, 8, 4),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(4, 12, 4), /* 116 */
+ /* 0001 */ V(12, 4, 4),
+ /* 0010 */ V(6, 11, 4),
+ /* 0011 */ V(11, 6, 4),
+ /* 0100 */ V(3, 12, 3),
+ /* 0101 */ V(3, 12, 3),
+ /* 0110 */ V(2, 12, 3),
+ /* 0111 */ V(2, 12, 3),
+ /* 1000 */ V(12, 2, 3),
+ /* 1001 */ V(12, 2, 3),
+ /* 1010 */ V(5, 11, 3),
+ /* 1011 */ V(5, 11, 3),
+ /* 1100 */ V(11, 5, 4),
+ /* 1101 */ V(8, 9, 4),
+ /* 1110 */ V(1, 12, 3),
+ /* 1111 */ V(1, 12, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(12, 1, 3), /* 132 */
+ /* 0001 */ V(12, 1, 3),
+ /* 0010 */ V(9, 8, 4),
+ /* 0011 */ V(0, 12, 4),
+ /* 0100 */ V(12, 0, 3),
+ /* 0101 */ V(12, 0, 3),
+ /* 0110 */ V(11, 4, 4),
+ /* 0111 */ V(6, 10, 4),
+ /* 1000 */ V(10, 6, 4),
+ /* 1001 */ V(7, 9, 4),
+ /* 1010 */ V(3, 11, 3),
+ /* 1011 */ V(3, 11, 3),
+ /* 1100 */ V(11, 3, 3),
+ /* 1101 */ V(11, 3, 3),
+ /* 1110 */ V(8, 8, 4),
+ /* 1111 */ V(5, 10, 4),
+
+ /* 0000 0101 ... */
+ /* 0000 */ V(2, 11, 3), /* 148 */
+ /* 0001 */ V(2, 11, 3),
+ /* 0010 */ V(10, 5, 4),
+ /* 0011 */ V(6, 9, 4),
+ /* 0100 */ V(10, 4, 3),
+ /* 0101 */ V(10, 4, 3),
+ /* 0110 */ V(7, 8, 4),
+ /* 0111 */ V(8, 7, 4),
+ /* 1000 */ V(9, 4, 3),
+ /* 1001 */ V(9, 4, 3),
+ /* 1010 */ V(7, 7, 4),
+ /* 1011 */ V(7, 6, 4),
+ /* 1100 */ V(11, 2, 2),
+ /* 1101 */ V(11, 2, 2),
+ /* 1110 */ V(11, 2, 2),
+ /* 1111 */ V(11, 2, 2),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(1, 11, 2), /* 164 */
+ /* 001 */ V(1, 11, 2),
+ /* 010 */ V(11, 1, 2),
+ /* 011 */ V(11, 1, 2),
+ /* 100 */ V(0, 11, 3),
+ /* 101 */ V(11, 0, 3),
+ /* 110 */ V(9, 6, 3),
+ /* 111 */ V(4, 10, 3),
+
+ /* 0000 0111 ... */
+ /* 000 */ V(3, 10, 3), /* 172 */
+ /* 001 */ V(10, 3, 3),
+ /* 010 */ V(5, 9, 3),
+ /* 011 */ V(9, 5, 3),
+ /* 100 */ V(2, 10, 2),
+ /* 101 */ V(2, 10, 2),
+ /* 110 */ V(10, 2, 2),
+ /* 111 */ V(10, 2, 2),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(1, 10, 2), /* 180 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(10, 1, 2),
+ /* 011 */ V(10, 1, 2),
+ /* 100 */ V(0, 10, 3),
+ /* 101 */ V(6, 8, 3),
+ /* 110 */ V(10, 0, 2),
+ /* 111 */ V(10, 0, 2),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(8, 6, 3), /* 188 */
+ /* 001 */ V(4, 9, 3),
+ /* 010 */ V(9, 3, 2),
+ /* 011 */ V(9, 3, 2),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(5, 8, 3),
+ /* 110 */ V(8, 5, 3),
+ /* 111 */ V(6, 7, 3),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 9, 2), /* 196 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(5, 7, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 2),
+ /* 111 */ V(3, 8, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(8, 3, 2), /* 204 */
+ /* 001 */ V(8, 3, 2),
+ /* 010 */ V(6, 6, 3),
+ /* 011 */ V(4, 7, 3),
+ /* 100 */ V(7, 4, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(6, 5, 3),
+ /* 111 */ V(7, 3, 3),
+
+ /* 0000 1100 ... */
+ /* 0 */ V(1, 9, 1), /* 212 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0000 1101 ... */
+ /* 00 */ V(0, 9, 2), /* 214 */
+ /* 01 */ V(9, 0, 2),
+ /* 10 */ V(4, 8, 2),
+ /* 11 */ V(8, 4, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 2, 2), /* 218 */
+ /* 001 */ V(7, 2, 2),
+ /* 010 */ V(4, 6, 3),
+ /* 011 */ V(6, 4, 3),
+ /* 100 */ V(2, 8, 1),
+ /* 101 */ V(2, 8, 1),
+ /* 110 */ V(2, 8, 1),
+ /* 111 */ V(2, 8, 1),
+
+ /* 0000 1111 ... */
+ /* 0 */ V(8, 2, 1), /* 226 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(3, 7, 2), /* 228 */
+ /* 01 */ V(2, 7, 2),
+ /* 10 */ V(1, 7, 1),
+ /* 11 */ V(1, 7, 1),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(7, 1, 1), /* 232 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(5, 5, 2),
+ /* 11 */ V(0, 7, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(7, 0, 2), /* 236 */
+ /* 01 */ V(3, 6, 2),
+ /* 10 */ V(6, 3, 2),
+ /* 11 */ V(4, 5, 2),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(5, 4, 2), /* 240 */
+ /* 01 */ V(2, 6, 2),
+ /* 10 */ V(6, 2, 2),
+ /* 11 */ V(3, 5, 2),
+
+ /* 0001 0101 ... */
+ /* 0 */ V(0, 8, 1), /* 244 */
+ /* 1 */ V(8, 0, 1),
+
+ /* 0001 0110 ... */
+ /* 0 */ V(1, 6, 1), /* 246 */
+ /* 1 */ V(6, 1, 1),
+
+ /* 0001 0111 ... */
+ /* 0 */ V(0, 6, 1), /* 248 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(5, 3, 2), /* 250 */
+ /* 01 */ V(4, 4, 2),
+ /* 10 */ V(2, 5, 1),
+ /* 11 */ V(2, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(5, 2, 1), /* 254 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(3, 4, 1), /* 256 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(5, 0, 1), /* 258 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0001 1110 ... */
+ /* 0 */ V(4, 2, 1), /* 260 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0000 */ PTR(388, 3), /* 262 */
+ /* 0001 */ V(15, 15, 4),
+ /* 0010 */ V(14, 15, 4),
+ /* 0011 */ V(13, 15, 4),
+ /* 0100 */ V(14, 14, 4),
+ /* 0101 */ V(12, 15, 4),
+ /* 0110 */ V(13, 14, 4),
+ /* 0111 */ V(11, 15, 4),
+ /* 1000 */ V(15, 11, 4),
+ /* 1001 */ V(12, 14, 4),
+ /* 1010 */ V(13, 12, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 12, 3),
+ /* 1101 */ V(14, 12, 3),
+ /* 1110 */ V(13, 13, 3),
+ /* 1111 */ V(13, 13, 3),
+
+ /* 0000 0000 0001 ... */
+ /* 0000 */ V(15, 10, 4), /* 278 */
+ /* 0001 */ V(12, 13, 4),
+ /* 0010 */ V(11, 14, 3),
+ /* 0011 */ V(11, 14, 3),
+ /* 0100 */ V(14, 11, 3),
+ /* 0101 */ V(14, 11, 3),
+ /* 0110 */ V(9, 15, 3),
+ /* 0111 */ V(9, 15, 3),
+ /* 1000 */ V(15, 9, 3),
+ /* 1001 */ V(15, 9, 3),
+ /* 1010 */ V(14, 10, 3),
+ /* 1011 */ V(14, 10, 3),
+ /* 1100 */ V(11, 13, 3),
+ /* 1101 */ V(11, 13, 3),
+ /* 1110 */ V(13, 11, 3),
+ /* 1111 */ V(13, 11, 3),
+
+ /* 0000 0000 0010 ... */
+ /* 0000 */ V(8, 15, 3), /* 294 */
+ /* 0001 */ V(8, 15, 3),
+ /* 0010 */ V(15, 8, 3),
+ /* 0011 */ V(15, 8, 3),
+ /* 0100 */ V(12, 12, 3),
+ /* 0101 */ V(12, 12, 3),
+ /* 0110 */ V(10, 14, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(8, 14, 3),
+ /* 1001 */ V(8, 14, 3),
+ /* 1010 */ V(7, 15, 4),
+ /* 1011 */ V(7, 14, 4),
+ /* 1100 */ V(15, 7, 2),
+ /* 1101 */ V(15, 7, 2),
+ /* 1110 */ V(15, 7, 2),
+ /* 1111 */ V(15, 7, 2),
+
+ /* 0000 0000 0011 ... */
+ /* 000 */ V(13, 10, 2), /* 310 */
+ /* 001 */ V(13, 10, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(11, 12, 3),
+ /* 100 */ V(12, 11, 3),
+ /* 101 */ V(15, 6, 3),
+ /* 110 */ V(6, 15, 2),
+ /* 111 */ V(6, 15, 2),
+
+ /* 0000 0000 0100 ... */
+ /* 00 */ V(14, 8, 2), /* 318 */
+ /* 01 */ V(5, 15, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(13, 9, 2),
+
+ /* 0000 0000 0101 ... */
+ /* 00 */ V(15, 5, 2), /* 322 */
+ /* 01 */ V(14, 7, 2),
+ /* 10 */ V(10, 12, 2),
+ /* 11 */ V(11, 11, 2),
+
+ /* 0000 0000 0110 ... */
+ /* 000 */ V(4, 15, 2), /* 326 */
+ /* 001 */ V(4, 15, 2),
+ /* 010 */ V(15, 4, 2),
+ /* 011 */ V(15, 4, 2),
+ /* 100 */ V(12, 10, 3),
+ /* 101 */ V(14, 6, 3),
+ /* 110 */ V(15, 3, 2),
+ /* 111 */ V(15, 3, 2),
+
+ /* 0000 0000 0111 ... */
+ /* 00 */ V(3, 15, 1), /* 334 */
+ /* 01 */ V(3, 15, 1),
+ /* 10 */ V(8, 13, 2),
+ /* 11 */ V(13, 8, 2),
+
+ /* 0000 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 338 */
+ /* 1 */ V(15, 2, 1),
+
+ /* 0000 0000 1001 ... */
+ /* 00 */ V(6, 14, 2), /* 340 */
+ /* 01 */ V(9, 12, 2),
+ /* 10 */ V(0, 15, 1),
+ /* 11 */ V(0, 15, 1),
+
+ /* 0000 0000 1010 ... */
+ /* 00 */ V(12, 9, 2), /* 344 */
+ /* 01 */ V(5, 14, 2),
+ /* 10 */ V(10, 11, 1),
+ /* 11 */ V(10, 11, 1),
+
+ /* 0000 0000 1011 ... */
+ /* 00 */ V(7, 13, 2), /* 348 */
+ /* 01 */ V(13, 7, 2),
+ /* 10 */ V(4, 14, 1),
+ /* 11 */ V(4, 14, 1),
+
+ /* 0000 0000 1100 ... */
+ /* 00 */ V(12, 8, 2), /* 352 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(3, 14, 1),
+ /* 11 */ V(3, 14, 1),
+
+ /* 0000 0000 1101 ... */
+ /* 00 */ V(11, 9, 1), /* 356 */
+ /* 01 */ V(11, 9, 1),
+ /* 10 */ V(9, 11, 2),
+ /* 11 */ V(10, 10, 2),
+
+ /* 0000 0001 0001 ... */
+ /* 0 */ V(11, 10, 1), /* 360 */
+ /* 1 */ V(14, 5, 1),
+
+ /* 0000 0001 0010 ... */
+ /* 0 */ V(14, 4, 1), /* 362 */
+ /* 1 */ V(8, 12, 1),
+
+ /* 0000 0001 0011 ... */
+ /* 0 */ V(6, 13, 1), /* 364 */
+ /* 1 */ V(14, 3, 1),
+
+ /* 0000 0001 0101 ... */
+ /* 0 */ V(2, 14, 1), /* 366 */
+ /* 1 */ V(0, 14, 1),
+
+ /* 0000 0001 1000 ... */
+ /* 0 */ V(14, 0, 1), /* 368 */
+ /* 1 */ V(5, 13, 1),
+
+ /* 0000 0001 1001 ... */
+ /* 0 */ V(13, 5, 1), /* 370 */
+ /* 1 */ V(7, 12, 1),
+
+ /* 0000 0001 1010 ... */
+ /* 0 */ V(12, 7, 1), /* 372 */
+ /* 1 */ V(4, 13, 1),
+
+ /* 0000 0001 1011 ... */
+ /* 0 */ V(8, 11, 1), /* 374 */
+ /* 1 */ V(11, 8, 1),
+
+ /* 0000 0001 1100 ... */
+ /* 0 */ V(13, 4, 1), /* 376 */
+ /* 1 */ V(9, 10, 1),
+
+ /* 0000 0001 1101 ... */
+ /* 0 */ V(10, 9, 1), /* 378 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 0010 0000 ... */
+ /* 0 */ V(13, 3, 1), /* 380 */
+ /* 1 */ V(7, 11, 1),
+
+ /* 0000 0010 0101 ... */
+ /* 0 */ V(5, 12, 1), /* 382 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 0010 0110 ... */
+ /* 0 */ V(9, 9, 1), /* 384 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 0010 1000 ... */
+ /* 0 */ V(10, 7, 1), /* 386 */
+ /* 1 */ V(9, 7, 1),
+
+ /* 0000 0000 0000 0000 ... */
+ /* 000 */ V(15, 14, 3), /* 388 */
+ /* 001 */ V(15, 12, 3),
+ /* 010 */ V(15, 13, 2),
+ /* 011 */ V(15, 13, 2),
+ /* 100 */ V(14, 13, 1),
+ /* 101 */ V(14, 13, 1),
+ /* 110 */ V(14, 13, 1),
+ /* 111 */ V(14, 13, 1),
+
+ /* 0000 0000 0000 1011 ... */
+ /* 0 */ V(10, 15, 1), /* 396 */
+ /* 1 */ V(14, 9, 1)
+};
+
+static
+union huffpair const hufftab15[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 4),
+ /* 0100 */ PTR(80, 4),
+ /* 0101 */ PTR(96, 3),
+ /* 0110 */ PTR(104, 3),
+ /* 0111 */ PTR(112, 2),
+ /* 1000 */ PTR(116, 1),
+ /* 1001 */ PTR(118, 1),
+ /* 1010 */ V(1, 1, 3),
+ /* 1011 */ V(1, 1, 3),
+ /* 1100 */ V(0, 1, 4),
+ /* 1101 */ V(1, 0, 4),
+ /* 1110 */ V(0, 0, 3),
+ /* 1111 */ V(0, 0, 3),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(120, 4), /* 16 */
+ /* 0001 */ PTR(136, 4),
+ /* 0010 */ PTR(152, 4),
+ /* 0011 */ PTR(168, 4),
+ /* 0100 */ PTR(184, 4),
+ /* 0101 */ PTR(200, 3),
+ /* 0110 */ PTR(208, 3),
+ /* 0111 */ PTR(216, 4),
+ /* 1000 */ PTR(232, 3),
+ /* 1001 */ PTR(240, 3),
+ /* 1010 */ PTR(248, 3),
+ /* 1011 */ PTR(256, 3),
+ /* 1100 */ PTR(264, 2),
+ /* 1101 */ PTR(268, 3),
+ /* 1110 */ PTR(276, 3),
+ /* 1111 */ PTR(284, 2),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(288, 2), /* 32 */
+ /* 0001 */ PTR(292, 2),
+ /* 0010 */ PTR(296, 2),
+ /* 0011 */ PTR(300, 2),
+ /* 0100 */ PTR(304, 2),
+ /* 0101 */ PTR(308, 2),
+ /* 0110 */ PTR(312, 2),
+ /* 0111 */ PTR(316, 2),
+ /* 1000 */ PTR(320, 1),
+ /* 1001 */ PTR(322, 1),
+ /* 1010 */ PTR(324, 1),
+ /* 1011 */ PTR(326, 2),
+ /* 1100 */ PTR(330, 1),
+ /* 1101 */ PTR(332, 1),
+ /* 1110 */ PTR(334, 2),
+ /* 1111 */ PTR(338, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(340, 1), /* 48 */
+ /* 0001 */ PTR(342, 1),
+ /* 0010 */ V(9, 1, 4),
+ /* 0011 */ PTR(344, 1),
+ /* 0100 */ PTR(346, 1),
+ /* 0101 */ PTR(348, 1),
+ /* 0110 */ PTR(350, 1),
+ /* 0111 */ PTR(352, 1),
+ /* 1000 */ V(2, 8, 4),
+ /* 1001 */ V(8, 2, 4),
+ /* 1010 */ V(1, 8, 4),
+ /* 1011 */ V(8, 1, 4),
+ /* 1100 */ PTR(354, 1),
+ /* 1101 */ PTR(356, 1),
+ /* 1110 */ PTR(358, 1),
+ /* 1111 */ PTR(360, 1),
+
+ /* 0011 ... */
+ /* 0000 */ V(2, 7, 4), /* 64 */
+ /* 0001 */ V(7, 2, 4),
+ /* 0010 */ V(6, 4, 4),
+ /* 0011 */ V(1, 7, 4),
+ /* 0100 */ V(5, 5, 4),
+ /* 0101 */ V(7, 1, 4),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ V(3, 6, 4),
+ /* 1000 */ V(6, 3, 4),
+ /* 1001 */ V(4, 5, 4),
+ /* 1010 */ V(5, 4, 4),
+ /* 1011 */ V(2, 6, 4),
+ /* 1100 */ V(6, 2, 4),
+ /* 1101 */ V(1, 6, 4),
+ /* 1110 */ PTR(364, 1),
+ /* 1111 */ V(3, 5, 4),
+
+ /* 0100 ... */
+ /* 0000 */ V(6, 1, 3), /* 80 */
+ /* 0001 */ V(6, 1, 3),
+ /* 0010 */ V(5, 3, 4),
+ /* 0011 */ V(4, 4, 4),
+ /* 0100 */ V(2, 5, 3),
+ /* 0101 */ V(2, 5, 3),
+ /* 0110 */ V(5, 2, 3),
+ /* 0111 */ V(5, 2, 3),
+ /* 1000 */ V(1, 5, 3),
+ /* 1001 */ V(1, 5, 3),
+ /* 1010 */ V(5, 1, 3),
+ /* 1011 */ V(5, 1, 3),
+ /* 1100 */ V(0, 5, 4),
+ /* 1101 */ V(5, 0, 4),
+ /* 1110 */ V(3, 4, 3),
+ /* 1111 */ V(3, 4, 3),
+
+ /* 0101 ... */
+ /* 000 */ V(4, 3, 3), /* 96 */
+ /* 001 */ V(2, 4, 3),
+ /* 010 */ V(4, 2, 3),
+ /* 011 */ V(3, 3, 3),
+ /* 100 */ V(4, 1, 2),
+ /* 101 */ V(4, 1, 2),
+ /* 110 */ V(1, 4, 3),
+ /* 111 */ V(0, 4, 3),
+
+ /* 0110 ... */
+ /* 000 */ V(2, 3, 2), /* 104 */
+ /* 001 */ V(2, 3, 2),
+ /* 010 */ V(3, 2, 2),
+ /* 011 */ V(3, 2, 2),
+ /* 100 */ V(4, 0, 3),
+ /* 101 */ V(0, 3, 3),
+ /* 110 */ V(1, 3, 2),
+ /* 111 */ V(1, 3, 2),
+
+ /* 0111 ... */
+ /* 00 */ V(3, 1, 2), /* 112 */
+ /* 01 */ V(3, 0, 2),
+ /* 10 */ V(2, 2, 1),
+ /* 11 */ V(2, 2, 1),
+
+ /* 1000 ... */
+ /* 0 */ V(1, 2, 1), /* 116 */
+ /* 1 */ V(2, 1, 1),
+
+ /* 1001 ... */
+ /* 0 */ V(0, 2, 1), /* 118 */
+ /* 1 */ V(2, 0, 1),
+
+ /* 0000 0000 ... */
+ /* 0000 */ PTR(366, 1), /* 120 */
+ /* 0001 */ PTR(368, 1),
+ /* 0010 */ V(14, 14, 4),
+ /* 0011 */ PTR(370, 1),
+ /* 0100 */ PTR(372, 1),
+ /* 0101 */ PTR(374, 1),
+ /* 0110 */ V(15, 11, 4),
+ /* 0111 */ PTR(376, 1),
+ /* 1000 */ V(13, 13, 4),
+ /* 1001 */ V(10, 15, 4),
+ /* 1010 */ V(15, 10, 4),
+ /* 1011 */ V(11, 14, 4),
+ /* 1100 */ V(14, 11, 4),
+ /* 1101 */ V(12, 13, 4),
+ /* 1110 */ V(13, 12, 4),
+ /* 1111 */ V(9, 15, 4),
+
+ /* 0000 0001 ... */
+ /* 0000 */ V(15, 9, 4), /* 136 */
+ /* 0001 */ V(14, 10, 4),
+ /* 0010 */ V(11, 13, 4),
+ /* 0011 */ V(13, 11, 4),
+ /* 0100 */ V(8, 15, 4),
+ /* 0101 */ V(15, 8, 4),
+ /* 0110 */ V(12, 12, 4),
+ /* 0111 */ V(9, 14, 4),
+ /* 1000 */ V(14, 9, 4),
+ /* 1001 */ V(7, 15, 4),
+ /* 1010 */ V(15, 7, 4),
+ /* 1011 */ V(10, 13, 4),
+ /* 1100 */ V(13, 10, 4),
+ /* 1101 */ V(11, 12, 4),
+ /* 1110 */ V(6, 15, 4),
+ /* 1111 */ PTR(378, 1),
+
+ /* 0000 0010 ... */
+ /* 0000 */ V(12, 11, 3), /* 152 */
+ /* 0001 */ V(12, 11, 3),
+ /* 0010 */ V(15, 6, 3),
+ /* 0011 */ V(15, 6, 3),
+ /* 0100 */ V(8, 14, 4),
+ /* 0101 */ V(14, 8, 4),
+ /* 0110 */ V(5, 15, 4),
+ /* 0111 */ V(9, 13, 4),
+ /* 1000 */ V(15, 5, 3),
+ /* 1001 */ V(15, 5, 3),
+ /* 1010 */ V(7, 14, 3),
+ /* 1011 */ V(7, 14, 3),
+ /* 1100 */ V(14, 7, 3),
+ /* 1101 */ V(14, 7, 3),
+ /* 1110 */ V(10, 12, 3),
+ /* 1111 */ V(10, 12, 3),
+
+ /* 0000 0011 ... */
+ /* 0000 */ V(12, 10, 3), /* 168 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(13, 9, 4),
+ /* 0101 */ V(8, 13, 4),
+ /* 0110 */ V(4, 15, 3),
+ /* 0111 */ V(4, 15, 3),
+ /* 1000 */ V(15, 4, 3),
+ /* 1001 */ V(15, 4, 3),
+ /* 1010 */ V(3, 15, 3),
+ /* 1011 */ V(3, 15, 3),
+ /* 1100 */ V(15, 3, 3),
+ /* 1101 */ V(15, 3, 3),
+ /* 1110 */ V(13, 8, 3),
+ /* 1111 */ V(13, 8, 3),
+
+ /* 0000 0100 ... */
+ /* 0000 */ V(14, 6, 3), /* 184 */
+ /* 0001 */ V(14, 6, 3),
+ /* 0010 */ V(2, 15, 3),
+ /* 0011 */ V(2, 15, 3),
+ /* 0100 */ V(15, 2, 3),
+ /* 0101 */ V(15, 2, 3),
+ /* 0110 */ V(6, 14, 4),
+ /* 0111 */ V(15, 0, 4),
+ /* 1000 */ V(1, 15, 3),
+ /* 1001 */ V(1, 15, 3),
+ /* 1010 */ V(15, 1, 3),
+ /* 1011 */ V(15, 1, 3),
+ /* 1100 */ V(9, 12, 3),
+ /* 1101 */ V(9, 12, 3),
+ /* 1110 */ V(12, 9, 3),
+ /* 1111 */ V(12, 9, 3),
+
+ /* 0000 0101 ... */
+ /* 000 */ V(5, 14, 3), /* 200 */
+ /* 001 */ V(10, 11, 3),
+ /* 010 */ V(11, 10, 3),
+ /* 011 */ V(14, 5, 3),
+ /* 100 */ V(7, 13, 3),
+ /* 101 */ V(13, 7, 3),
+ /* 110 */ V(4, 14, 3),
+ /* 111 */ V(14, 4, 3),
+
+ /* 0000 0110 ... */
+ /* 000 */ V(8, 12, 3), /* 208 */
+ /* 001 */ V(12, 8, 3),
+ /* 010 */ V(3, 14, 3),
+ /* 011 */ V(6, 13, 3),
+ /* 100 */ V(13, 6, 3),
+ /* 101 */ V(14, 3, 3),
+ /* 110 */ V(9, 11, 3),
+ /* 111 */ V(11, 9, 3),
+
+ /* 0000 0111 ... */
+ /* 0000 */ V(2, 14, 3), /* 216 */
+ /* 0001 */ V(2, 14, 3),
+ /* 0010 */ V(10, 10, 3),
+ /* 0011 */ V(10, 10, 3),
+ /* 0100 */ V(14, 2, 3),
+ /* 0101 */ V(14, 2, 3),
+ /* 0110 */ V(1, 14, 3),
+ /* 0111 */ V(1, 14, 3),
+ /* 1000 */ V(14, 1, 3),
+ /* 1001 */ V(14, 1, 3),
+ /* 1010 */ V(0, 14, 4),
+ /* 1011 */ V(14, 0, 4),
+ /* 1100 */ V(5, 13, 3),
+ /* 1101 */ V(5, 13, 3),
+ /* 1110 */ V(13, 5, 3),
+ /* 1111 */ V(13, 5, 3),
+
+ /* 0000 1000 ... */
+ /* 000 */ V(7, 12, 3), /* 232 */
+ /* 001 */ V(12, 7, 3),
+ /* 010 */ V(4, 13, 3),
+ /* 011 */ V(8, 11, 3),
+ /* 100 */ V(13, 4, 2),
+ /* 101 */ V(13, 4, 2),
+ /* 110 */ V(11, 8, 3),
+ /* 111 */ V(9, 10, 3),
+
+ /* 0000 1001 ... */
+ /* 000 */ V(10, 9, 3), /* 240 */
+ /* 001 */ V(6, 12, 3),
+ /* 010 */ V(12, 6, 3),
+ /* 011 */ V(3, 13, 3),
+ /* 100 */ V(13, 3, 2),
+ /* 101 */ V(13, 3, 2),
+ /* 110 */ V(13, 2, 2),
+ /* 111 */ V(13, 2, 2),
+
+ /* 0000 1010 ... */
+ /* 000 */ V(2, 13, 3), /* 248 */
+ /* 001 */ V(0, 13, 3),
+ /* 010 */ V(1, 13, 2),
+ /* 011 */ V(1, 13, 2),
+ /* 100 */ V(7, 11, 2),
+ /* 101 */ V(7, 11, 2),
+ /* 110 */ V(11, 7, 2),
+ /* 111 */ V(11, 7, 2),
+
+ /* 0000 1011 ... */
+ /* 000 */ V(13, 1, 2), /* 256 */
+ /* 001 */ V(13, 1, 2),
+ /* 010 */ V(5, 12, 3),
+ /* 011 */ V(13, 0, 3),
+ /* 100 */ V(12, 5, 2),
+ /* 101 */ V(12, 5, 2),
+ /* 110 */ V(8, 10, 2),
+ /* 111 */ V(8, 10, 2),
+
+ /* 0000 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 264 */
+ /* 01 */ V(4, 12, 2),
+ /* 10 */ V(12, 4, 2),
+ /* 11 */ V(6, 11, 2),
+
+ /* 0000 1101 ... */
+ /* 000 */ V(11, 6, 2), /* 268 */
+ /* 001 */ V(11, 6, 2),
+ /* 010 */ V(9, 9, 3),
+ /* 011 */ V(0, 12, 3),
+ /* 100 */ V(3, 12, 2),
+ /* 101 */ V(3, 12, 2),
+ /* 110 */ V(12, 3, 2),
+ /* 111 */ V(12, 3, 2),
+
+ /* 0000 1110 ... */
+ /* 000 */ V(7, 10, 2), /* 276 */
+ /* 001 */ V(7, 10, 2),
+ /* 010 */ V(10, 7, 2),
+ /* 011 */ V(10, 7, 2),
+ /* 100 */ V(10, 6, 2),
+ /* 101 */ V(10, 6, 2),
+ /* 110 */ V(12, 0, 3),
+ /* 111 */ V(0, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 00 */ V(12, 2, 1), /* 284 */
+ /* 01 */ V(12, 2, 1),
+ /* 10 */ V(2, 12, 2),
+ /* 11 */ V(5, 11, 2),
+
+ /* 0001 0000 ... */
+ /* 00 */ V(11, 5, 2), /* 288 */
+ /* 01 */ V(1, 12, 2),
+ /* 10 */ V(8, 9, 2),
+ /* 11 */ V(9, 8, 2),
+
+ /* 0001 0001 ... */
+ /* 00 */ V(12, 1, 2), /* 292 */
+ /* 01 */ V(4, 11, 2),
+ /* 10 */ V(11, 4, 2),
+ /* 11 */ V(6, 10, 2),
+
+ /* 0001 0010 ... */
+ /* 00 */ V(3, 11, 2), /* 296 */
+ /* 01 */ V(7, 9, 2),
+ /* 10 */ V(11, 3, 1),
+ /* 11 */ V(11, 3, 1),
+
+ /* 0001 0011 ... */
+ /* 00 */ V(9, 7, 2), /* 300 */
+ /* 01 */ V(8, 8, 2),
+ /* 10 */ V(2, 11, 2),
+ /* 11 */ V(5, 10, 2),
+
+ /* 0001 0100 ... */
+ /* 00 */ V(11, 2, 1), /* 304 */
+ /* 01 */ V(11, 2, 1),
+ /* 10 */ V(10, 5, 2),
+ /* 11 */ V(1, 11, 2),
+
+ /* 0001 0101 ... */
+ /* 00 */ V(11, 1, 1), /* 308 */
+ /* 01 */ V(11, 1, 1),
+ /* 10 */ V(11, 0, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0001 0110 ... */
+ /* 00 */ V(9, 6, 2), /* 312 */
+ /* 01 */ V(4, 10, 2),
+ /* 10 */ V(10, 4, 2),
+ /* 11 */ V(7, 8, 2),
+
+ /* 0001 0111 ... */
+ /* 00 */ V(8, 7, 2), /* 316 */
+ /* 01 */ V(3, 10, 2),
+ /* 10 */ V(10, 3, 1),
+ /* 11 */ V(10, 3, 1),
+
+ /* 0001 1000 ... */
+ /* 0 */ V(5, 9, 1), /* 320 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0001 1001 ... */
+ /* 0 */ V(2, 10, 1), /* 322 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(1, 10, 1), /* 324 */
+ /* 1 */ V(10, 1, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(0, 10, 2), /* 326 */
+ /* 01 */ V(10, 0, 2),
+ /* 10 */ V(6, 8, 1),
+ /* 11 */ V(6, 8, 1),
+
+ /* 0001 1100 ... */
+ /* 0 */ V(8, 6, 1), /* 330 */
+ /* 1 */ V(4, 9, 1),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(9, 4, 1), /* 332 */
+ /* 1 */ V(3, 9, 1),
+
+ /* 0001 1110 ... */
+ /* 00 */ V(9, 3, 1), /* 334 */
+ /* 01 */ V(9, 3, 1),
+ /* 10 */ V(7, 7, 2),
+ /* 11 */ V(0, 9, 2),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(5, 8, 1), /* 338 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(2, 9, 1), /* 340 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(7, 6, 1), /* 342 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0010 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 344 */
+ /* 1 */ V(9, 0, 1),
+
+ /* 0010 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 346 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 348 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0010 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 350 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0010 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 352 */
+ /* 1 */ V(4, 7, 1),
+
+ /* 0010 1100 ... */
+ /* 0 */ V(7, 4, 1), /* 354 */
+ /* 1 */ V(0, 8, 1),
+
+ /* 0010 1101 ... */
+ /* 0 */ V(8, 0, 1), /* 356 */
+ /* 1 */ V(5, 6, 1),
+
+ /* 0010 1110 ... */
+ /* 0 */ V(6, 5, 1), /* 358 */
+ /* 1 */ V(3, 7, 1),
+
+ /* 0010 1111 ... */
+ /* 0 */ V(7, 3, 1), /* 360 */
+ /* 1 */ V(4, 6, 1),
+
+ /* 0011 0110 ... */
+ /* 0 */ V(0, 7, 1), /* 362 */
+ /* 1 */ V(7, 0, 1),
+
+ /* 0011 1110 ... */
+ /* 0 */ V(0, 6, 1), /* 364 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 0000 0000 0000 ... */
+ /* 0 */ V(15, 15, 1), /* 366 */
+ /* 1 */ V(14, 15, 1),
+
+ /* 0000 0000 0001 ... */
+ /* 0 */ V(15, 14, 1), /* 368 */
+ /* 1 */ V(13, 15, 1),
+
+ /* 0000 0000 0011 ... */
+ /* 0 */ V(15, 13, 1), /* 370 */
+ /* 1 */ V(12, 15, 1),
+
+ /* 0000 0000 0100 ... */
+ /* 0 */ V(15, 12, 1), /* 372 */
+ /* 1 */ V(13, 14, 1),
+
+ /* 0000 0000 0101 ... */
+ /* 0 */ V(14, 13, 1), /* 374 */
+ /* 1 */ V(11, 15, 1),
+
+ /* 0000 0000 0111 ... */
+ /* 0 */ V(12, 14, 1), /* 376 */
+ /* 1 */ V(14, 12, 1),
+
+ /* 0000 0001 1111 ... */
+ /* 0 */ V(10, 14, 1), /* 378 */
+ /* 1 */ V(0, 15, 1)
+};
+
+static
+union huffpair const hufftab16[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ PTR(64, 2),
+ /* 0100 */ V(1, 1, 4),
+ /* 0101 */ V(0, 1, 4),
+ /* 0110 */ V(1, 0, 3),
+ /* 0111 */ V(1, 0, 3),
+ /* 1000 */ V(0, 0, 1),
+ /* 1001 */ V(0, 0, 1),
+ /* 1010 */ V(0, 0, 1),
+ /* 1011 */ V(0, 0, 1),
+ /* 1100 */ V(0, 0, 1),
+ /* 1101 */ V(0, 0, 1),
+ /* 1110 */ V(0, 0, 1),
+ /* 1111 */ V(0, 0, 1),
+
+ /* 0000 ... */
+ /* 0000 */ PTR(68, 3), /* 16 */
+ /* 0001 */ PTR(76, 3),
+ /* 0010 */ PTR(84, 2),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(88, 2),
+ /* 0101 */ PTR(92, 1),
+ /* 0110 */ PTR(94, 4),
+ /* 0111 */ V(15, 2, 4),
+ /* 1000 */ PTR(110, 1),
+ /* 1001 */ V(1, 15, 4),
+ /* 1010 */ V(15, 1, 4),
+ /* 1011 */ PTR(112, 4),
+ /* 1100 */ PTR(128, 4),
+ /* 1101 */ PTR(144, 4),
+ /* 1110 */ PTR(160, 4),
+ /* 1111 */ PTR(176, 4),
+
+ /* 0001 ... */
+ /* 0000 */ PTR(192, 4), /* 32 */
+ /* 0001 */ PTR(208, 3),
+ /* 0010 */ PTR(216, 3),
+ /* 0011 */ PTR(224, 3),
+ /* 0100 */ PTR(232, 3),
+ /* 0101 */ PTR(240, 3),
+ /* 0110 */ PTR(248, 3),
+ /* 0111 */ PTR(256, 3),
+ /* 1000 */ PTR(264, 2),
+ /* 1001 */ PTR(268, 2),
+ /* 1010 */ PTR(272, 1),
+ /* 1011 */ PTR(274, 2),
+ /* 1100 */ PTR(278, 2),
+ /* 1101 */ PTR(282, 1),
+ /* 1110 */ V(5, 1, 4),
+ /* 1111 */ PTR(284, 1),
+
+ /* 0010 ... */
+ /* 0000 */ PTR(286, 1), /* 48 */
+ /* 0001 */ PTR(288, 1),
+ /* 0010 */ PTR(290, 1),
+ /* 0011 */ V(1, 4, 4),
+ /* 0100 */ V(4, 1, 4),
+ /* 0101 */ PTR(292, 1),
+ /* 0110 */ V(2, 3, 4),
+ /* 0111 */ V(3, 2, 4),
+ /* 1000 */ V(1, 3, 3),
+ /* 1001 */ V(1, 3, 3),
+ /* 1010 */ V(3, 1, 3),
+ /* 1011 */ V(3, 1, 3),
+ /* 1100 */ V(0, 3, 4),
+ /* 1101 */ V(3, 0, 4),
+ /* 1110 */ V(2, 2, 3),
+ /* 1111 */ V(2, 2, 3),
+
+ /* 0011 ... */
+ /* 00 */ V(1, 2, 2), /* 64 */
+ /* 01 */ V(2, 1, 2),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0000 0000 ... */
+ /* 000 */ V(14, 15, 3), /* 68 */
+ /* 001 */ V(15, 14, 3),
+ /* 010 */ V(13, 15, 3),
+ /* 011 */ V(15, 13, 3),
+ /* 100 */ V(12, 15, 3),
+ /* 101 */ V(15, 12, 3),
+ /* 110 */ V(11, 15, 3),
+ /* 111 */ V(15, 11, 3),
+
+ /* 0000 0001 ... */
+ /* 000 */ V(10, 15, 2), /* 76 */
+ /* 001 */ V(10, 15, 2),
+ /* 010 */ V(15, 10, 3),
+ /* 011 */ V(9, 15, 3),
+ /* 100 */ V(15, 9, 3),
+ /* 101 */ V(15, 8, 3),
+ /* 110 */ V(8, 15, 2),
+ /* 111 */ V(8, 15, 2),
+
+ /* 0000 0010 ... */
+ /* 00 */ V(7, 15, 2), /* 84 */
+ /* 01 */ V(15, 7, 2),
+ /* 10 */ V(6, 15, 2),
+ /* 11 */ V(15, 6, 2),
+
+ /* 0000 0100 ... */
+ /* 00 */ V(5, 15, 2), /* 88 */
+ /* 01 */ V(15, 5, 2),
+ /* 10 */ V(4, 15, 1),
+ /* 11 */ V(4, 15, 1),
+
+ /* 0000 0101 ... */
+ /* 0 */ V(15, 4, 1), /* 92 */
+ /* 1 */ V(15, 3, 1),
+
+ /* 0000 0110 ... */
+ /* 0000 */ V(15, 0, 1), /* 94 */
+ /* 0001 */ V(15, 0, 1),
+ /* 0010 */ V(15, 0, 1),
+ /* 0011 */ V(15, 0, 1),
+ /* 0100 */ V(15, 0, 1),
+ /* 0101 */ V(15, 0, 1),
+ /* 0110 */ V(15, 0, 1),
+ /* 0111 */ V(15, 0, 1),
+ /* 1000 */ V(3, 15, 2),
+ /* 1001 */ V(3, 15, 2),
+ /* 1010 */ V(3, 15, 2),
+ /* 1011 */ V(3, 15, 2),
+ /* 1100 */ PTR(294, 4),
+ /* 1101 */ PTR(310, 3),
+ /* 1110 */ PTR(318, 3),
+ /* 1111 */ PTR(326, 3),
+
+ /* 0000 1000 ... */
+ /* 0 */ V(2, 15, 1), /* 110 */
+ /* 1 */ V(0, 15, 1),
+
+ /* 0000 1011 ... */
+ /* 0000 */ PTR(334, 2), /* 112 */
+ /* 0001 */ PTR(338, 2),
+ /* 0010 */ PTR(342, 2),
+ /* 0011 */ PTR(346, 1),
+ /* 0100 */ PTR(348, 2),
+ /* 0101 */ PTR(352, 2),
+ /* 0110 */ PTR(356, 1),
+ /* 0111 */ PTR(358, 2),
+ /* 1000 */ PTR(362, 2),
+ /* 1001 */ PTR(366, 2),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ V(14, 3, 4),
+ /* 1100 */ PTR(374, 1),
+ /* 1101 */ PTR(376, 1),
+ /* 1110 */ PTR(378, 1),
+ /* 1111 */ PTR(380, 1),
+
+ /* 0000 1100 ... */
+ /* 0000 */ PTR(382, 1), /* 128 */
+ /* 0001 */ PTR(384, 1),
+ /* 0010 */ PTR(386, 1),
+ /* 0011 */ V(0, 13, 4),
+ /* 0100 */ PTR(388, 1),
+ /* 0101 */ PTR(390, 1),
+ /* 0110 */ PTR(392, 1),
+ /* 0111 */ V(3, 12, 4),
+ /* 1000 */ PTR(394, 1),
+ /* 1001 */ V(1, 12, 4),
+ /* 1010 */ V(12, 0, 4),
+ /* 1011 */ PTR(396, 1),
+ /* 1100 */ V(14, 2, 3),
+ /* 1101 */ V(14, 2, 3),
+ /* 1110 */ V(2, 14, 4),
+ /* 1111 */ V(1, 14, 4),
+
+ /* 0000 1101 ... */
+ /* 0000 */ V(13, 3, 4), /* 144 */
+ /* 0001 */ V(2, 13, 4),
+ /* 0010 */ V(13, 2, 4),
+ /* 0011 */ V(13, 1, 4),
+ /* 0100 */ V(3, 11, 4),
+ /* 0101 */ PTR(398, 1),
+ /* 0110 */ V(1, 13, 3),
+ /* 0111 */ V(1, 13, 3),
+ /* 1000 */ V(12, 4, 4),
+ /* 1001 */ V(6, 11, 4),
+ /* 1010 */ V(12, 3, 4),
+ /* 1011 */ V(10, 7, 4),
+ /* 1100 */ V(2, 12, 3),
+ /* 1101 */ V(2, 12, 3),
+ /* 1110 */ V(12, 2, 4),
+ /* 1111 */ V(11, 5, 4),
+
+ /* 0000 1110 ... */
+ /* 0000 */ V(12, 1, 4), /* 160 */
+ /* 0001 */ V(0, 12, 4),
+ /* 0010 */ V(4, 11, 4),
+ /* 0011 */ V(11, 4, 4),
+ /* 0100 */ V(6, 10, 4),
+ /* 0101 */ V(10, 6, 4),
+ /* 0110 */ V(11, 3, 3),
+ /* 0111 */ V(11, 3, 3),
+ /* 1000 */ V(5, 10, 4),
+ /* 1001 */ V(10, 5, 4),
+ /* 1010 */ V(2, 11, 3),
+ /* 1011 */ V(2, 11, 3),
+ /* 1100 */ V(11, 2, 3),
+ /* 1101 */ V(11, 2, 3),
+ /* 1110 */ V(1, 11, 3),
+ /* 1111 */ V(1, 11, 3),
+
+ /* 0000 1111 ... */
+ /* 0000 */ V(11, 1, 3), /* 176 */
+ /* 0001 */ V(11, 1, 3),
+ /* 0010 */ V(0, 11, 4),
+ /* 0011 */ V(11, 0, 4),
+ /* 0100 */ V(6, 9, 4),
+ /* 0101 */ V(9, 6, 4),
+ /* 0110 */ V(4, 10, 4),
+ /* 0111 */ V(10, 4, 4),
+ /* 1000 */ V(7, 8, 4),
+ /* 1001 */ V(8, 7, 4),
+ /* 1010 */ V(10, 3, 3),
+ /* 1011 */ V(10, 3, 3),
+ /* 1100 */ V(3, 10, 4),
+ /* 1101 */ V(5, 9, 4),
+ /* 1110 */ V(2, 10, 3),
+ /* 1111 */ V(2, 10, 3),
+
+ /* 0001 0000 ... */
+ /* 0000 */ V(9, 5, 4), /* 192 */
+ /* 0001 */ V(6, 8, 4),
+ /* 0010 */ V(10, 1, 3),
+ /* 0011 */ V(10, 1, 3),
+ /* 0100 */ V(8, 6, 4),
+ /* 0101 */ V(7, 7, 4),
+ /* 0110 */ V(9, 4, 3),
+ /* 0111 */ V(9, 4, 3),
+ /* 1000 */ V(4, 9, 4),
+ /* 1001 */ V(5, 7, 4),
+ /* 1010 */ V(6, 7, 3),
+ /* 1011 */ V(6, 7, 3),
+ /* 1100 */ V(10, 2, 2),
+ /* 1101 */ V(10, 2, 2),
+ /* 1110 */ V(10, 2, 2),
+ /* 1111 */ V(10, 2, 2),
+
+ /* 0001 0001 ... */
+ /* 000 */ V(1, 10, 2), /* 208 */
+ /* 001 */ V(1, 10, 2),
+ /* 010 */ V(0, 10, 3),
+ /* 011 */ V(10, 0, 3),
+ /* 100 */ V(3, 9, 3),
+ /* 101 */ V(9, 3, 3),
+ /* 110 */ V(5, 8, 3),
+ /* 111 */ V(8, 5, 3),
+
+ /* 0001 0010 ... */
+ /* 000 */ V(2, 9, 2), /* 216 */
+ /* 001 */ V(2, 9, 2),
+ /* 010 */ V(9, 2, 2),
+ /* 011 */ V(9, 2, 2),
+ /* 100 */ V(7, 6, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(1, 9, 2),
+ /* 111 */ V(1, 9, 2),
+
+ /* 0001 0011 ... */
+ /* 000 */ V(9, 1, 2), /* 224 */
+ /* 001 */ V(9, 1, 2),
+ /* 010 */ V(9, 0, 3),
+ /* 011 */ V(4, 8, 3),
+ /* 100 */ V(8, 4, 3),
+ /* 101 */ V(7, 5, 3),
+ /* 110 */ V(3, 8, 3),
+ /* 111 */ V(8, 3, 3),
+
+ /* 0001 0100 ... */
+ /* 000 */ V(6, 6, 3), /* 232 */
+ /* 001 */ V(2, 8, 3),
+ /* 010 */ V(8, 2, 2),
+ /* 011 */ V(8, 2, 2),
+ /* 100 */ V(4, 7, 3),
+ /* 101 */ V(7, 4, 3),
+ /* 110 */ V(1, 8, 2),
+ /* 111 */ V(1, 8, 2),
+
+ /* 0001 0101 ... */
+ /* 000 */ V(8, 1, 2), /* 240 */
+ /* 001 */ V(8, 1, 2),
+ /* 010 */ V(8, 0, 2),
+ /* 011 */ V(8, 0, 2),
+ /* 100 */ V(0, 8, 3),
+ /* 101 */ V(5, 6, 3),
+ /* 110 */ V(3, 7, 2),
+ /* 111 */ V(3, 7, 2),
+
+ /* 0001 0110 ... */
+ /* 000 */ V(7, 3, 2), /* 248 */
+ /* 001 */ V(7, 3, 2),
+ /* 010 */ V(6, 5, 3),
+ /* 011 */ V(4, 6, 3),
+ /* 100 */ V(2, 7, 2),
+ /* 101 */ V(2, 7, 2),
+ /* 110 */ V(7, 2, 2),
+ /* 111 */ V(7, 2, 2),
+
+ /* 0001 0111 ... */
+ /* 000 */ V(6, 4, 3), /* 256 */
+ /* 001 */ V(5, 5, 3),
+ /* 010 */ V(0, 7, 2),
+ /* 011 */ V(0, 7, 2),
+ /* 100 */ V(1, 7, 1),
+ /* 101 */ V(1, 7, 1),
+ /* 110 */ V(1, 7, 1),
+ /* 111 */ V(1, 7, 1),
+
+ /* 0001 1000 ... */
+ /* 00 */ V(7, 1, 1), /* 264 */
+ /* 01 */ V(7, 1, 1),
+ /* 10 */ V(7, 0, 2),
+ /* 11 */ V(3, 6, 2),
+
+ /* 0001 1001 ... */
+ /* 00 */ V(6, 3, 2), /* 268 */
+ /* 01 */ V(4, 5, 2),
+ /* 10 */ V(5, 4, 2),
+ /* 11 */ V(2, 6, 2),
+
+ /* 0001 1010 ... */
+ /* 0 */ V(6, 2, 1), /* 272 */
+ /* 1 */ V(1, 6, 1),
+
+ /* 0001 1011 ... */
+ /* 00 */ V(6, 1, 1), /* 274 */
+ /* 01 */ V(6, 1, 1),
+ /* 10 */ V(0, 6, 2),
+ /* 11 */ V(6, 0, 2),
+
+ /* 0001 1100 ... */
+ /* 00 */ V(5, 3, 1), /* 278 */
+ /* 01 */ V(5, 3, 1),
+ /* 10 */ V(3, 5, 2),
+ /* 11 */ V(4, 4, 2),
+
+ /* 0001 1101 ... */
+ /* 0 */ V(2, 5, 1), /* 282 */
+ /* 1 */ V(5, 2, 1),
+
+ /* 0001 1111 ... */
+ /* 0 */ V(1, 5, 1), /* 284 */
+ /* 1 */ V(0, 5, 1),
+
+ /* 0010 0000 ... */
+ /* 0 */ V(3, 4, 1), /* 286 */
+ /* 1 */ V(4, 3, 1),
+
+ /* 0010 0001 ... */
+ /* 0 */ V(5, 0, 1), /* 288 */
+ /* 1 */ V(2, 4, 1),
+
+ /* 0010 0010 ... */
+ /* 0 */ V(4, 2, 1), /* 290 */
+ /* 1 */ V(3, 3, 1),
+
+ /* 0010 0101 ... */
+ /* 0 */ V(0, 4, 1), /* 292 */
+ /* 1 */ V(4, 0, 1),
+
+ /* 0000 0110 1100 ... */
+ /* 0000 */ V(12, 14, 4), /* 294 */
+ /* 0001 */ PTR(400, 1),
+ /* 0010 */ V(13, 14, 3),
+ /* 0011 */ V(13, 14, 3),
+ /* 0100 */ V(14, 9, 3),
+ /* 0101 */ V(14, 9, 3),
+ /* 0110 */ V(14, 10, 4),
+ /* 0111 */ V(13, 9, 4),
+ /* 1000 */ V(14, 14, 2),
+ /* 1001 */ V(14, 14, 2),
+ /* 1010 */ V(14, 14, 2),
+ /* 1011 */ V(14, 14, 2),
+ /* 1100 */ V(14, 13, 3),
+ /* 1101 */ V(14, 13, 3),
+ /* 1110 */ V(14, 11, 3),
+ /* 1111 */ V(14, 11, 3),
+
+ /* 0000 0110 1101 ... */
+ /* 000 */ V(11, 14, 2), /* 310 */
+ /* 001 */ V(11, 14, 2),
+ /* 010 */ V(12, 13, 2),
+ /* 011 */ V(12, 13, 2),
+ /* 100 */ V(13, 12, 3),
+ /* 101 */ V(13, 11, 3),
+ /* 110 */ V(10, 14, 2),
+ /* 111 */ V(10, 14, 2),
+
+ /* 0000 0110 1110 ... */
+ /* 000 */ V(12, 12, 2), /* 318 */
+ /* 001 */ V(12, 12, 2),
+ /* 010 */ V(10, 13, 3),
+ /* 011 */ V(13, 10, 3),
+ /* 100 */ V(7, 14, 3),
+ /* 101 */ V(10, 12, 3),
+ /* 110 */ V(12, 10, 2),
+ /* 111 */ V(12, 10, 2),
+
+ /* 0000 0110 1111 ... */
+ /* 000 */ V(12, 9, 3), /* 326 */
+ /* 001 */ V(7, 13, 3),
+ /* 010 */ V(5, 14, 2),
+ /* 011 */ V(5, 14, 2),
+ /* 100 */ V(11, 13, 1),
+ /* 101 */ V(11, 13, 1),
+ /* 110 */ V(11, 13, 1),
+ /* 111 */ V(11, 13, 1),
+
+ /* 0000 1011 0000 ... */
+ /* 00 */ V(9, 14, 1), /* 334 */
+ /* 01 */ V(9, 14, 1),
+ /* 10 */ V(11, 12, 2),
+ /* 11 */ V(12, 11, 2),
+
+ /* 0000 1011 0001 ... */
+ /* 00 */ V(8, 14, 2), /* 338 */
+ /* 01 */ V(14, 8, 2),
+ /* 10 */ V(9, 13, 2),
+ /* 11 */ V(14, 7, 2),
+
+ /* 0000 1011 0010 ... */
+ /* 00 */ V(11, 11, 2), /* 342 */
+ /* 01 */ V(8, 13, 2),
+ /* 10 */ V(13, 8, 2),
+ /* 11 */ V(6, 14, 2),
+
+ /* 0000 1011 0011 ... */
+ /* 0 */ V(14, 6, 1), /* 346 */
+ /* 1 */ V(9, 12, 1),
+
+ /* 0000 1011 0100 ... */
+ /* 00 */ V(10, 11, 2), /* 348 */
+ /* 01 */ V(11, 10, 2),
+ /* 10 */ V(14, 5, 2),
+ /* 11 */ V(13, 7, 2),
+
+ /* 0000 1011 0101 ... */
+ /* 00 */ V(4, 14, 1), /* 352 */
+ /* 01 */ V(4, 14, 1),
+ /* 10 */ V(14, 4, 2),
+ /* 11 */ V(8, 12, 2),
+
+ /* 0000 1011 0110 ... */
+ /* 0 */ V(12, 8, 1), /* 356 */
+ /* 1 */ V(3, 14, 1),
+
+ /* 0000 1011 0111 ... */
+ /* 00 */ V(6, 13, 1), /* 358 */
+ /* 01 */ V(6, 13, 1),
+ /* 10 */ V(13, 6, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0000 1011 1000 ... */
+ /* 00 */ V(11, 9, 2), /* 362 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 1, 1),
+ /* 11 */ V(14, 1, 1),
+
+ /* 0000 1011 1001 ... */
+ /* 00 */ V(13, 4, 1), /* 366 */
+ /* 01 */ V(13, 4, 1),
+ /* 10 */ V(11, 8, 2),
+ /* 11 */ V(10, 9, 2),
+
+ /* 0000 1011 1010 ... */
+ /* 00 */ V(7, 11, 1), /* 370 */
+ /* 01 */ V(7, 11, 1),
+ /* 10 */ V(11, 7, 2),
+ /* 11 */ V(13, 0, 2),
+
+ /* 0000 1011 1100 ... */
+ /* 0 */ V(0, 14, 1), /* 374 */
+ /* 1 */ V(14, 0, 1),
+
+ /* 0000 1011 1101 ... */
+ /* 0 */ V(5, 13, 1), /* 376 */
+ /* 1 */ V(13, 5, 1),
+
+ /* 0000 1011 1110 ... */
+ /* 0 */ V(7, 12, 1), /* 378 */
+ /* 1 */ V(12, 7, 1),
+
+ /* 0000 1011 1111 ... */
+ /* 0 */ V(4, 13, 1), /* 380 */
+ /* 1 */ V(8, 11, 1),
+
+ /* 0000 1100 0000 ... */
+ /* 0 */ V(9, 10, 1), /* 382 */
+ /* 1 */ V(6, 12, 1),
+
+ /* 0000 1100 0001 ... */
+ /* 0 */ V(12, 6, 1), /* 384 */
+ /* 1 */ V(3, 13, 1),
+
+ /* 0000 1100 0010 ... */
+ /* 0 */ V(5, 12, 1), /* 386 */
+ /* 1 */ V(12, 5, 1),
+
+ /* 0000 1100 0100 ... */
+ /* 0 */ V(8, 10, 1), /* 388 */
+ /* 1 */ V(10, 8, 1),
+
+ /* 0000 1100 0101 ... */
+ /* 0 */ V(9, 9, 1), /* 390 */
+ /* 1 */ V(4, 12, 1),
+
+ /* 0000 1100 0110 ... */
+ /* 0 */ V(11, 6, 1), /* 392 */
+ /* 1 */ V(7, 10, 1),
+
+ /* 0000 1100 1000 ... */
+ /* 0 */ V(5, 11, 1), /* 394 */
+ /* 1 */ V(8, 9, 1),
+
+ /* 0000 1100 1011 ... */
+ /* 0 */ V(9, 8, 1), /* 396 */
+ /* 1 */ V(7, 9, 1),
+
+ /* 0000 1101 0101 ... */
+ /* 0 */ V(9, 7, 1), /* 398 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0000 0110 1100 0001 ... */
+ /* 0 */ V(14, 12, 1), /* 400 */
+ /* 1 */ V(13, 13, 1)
+};
+
+static
+union huffpair const hufftab24[] = {
+ /* 0000 */ PTR(16, 4),
+ /* 0001 */ PTR(32, 4),
+ /* 0010 */ PTR(48, 4),
+ /* 0011 */ V(15, 15, 4),
+ /* 0100 */ PTR(64, 4),
+ /* 0101 */ PTR(80, 4),
+ /* 0110 */ PTR(96, 4),
+ /* 0111 */ PTR(112, 4),
+ /* 1000 */ PTR(128, 4),
+ /* 1001 */ PTR(144, 4),
+ /* 1010 */ PTR(160, 3),
+ /* 1011 */ PTR(168, 2),
+ /* 1100 */ V(1, 1, 4),
+ /* 1101 */ V(0, 1, 4),
+ /* 1110 */ V(1, 0, 4),
+ /* 1111 */ V(0, 0, 4),
+
+ /* 0000 ... */
+ /* 0000 */ V(14, 15, 4), /* 16 */
+ /* 0001 */ V(15, 14, 4),
+ /* 0010 */ V(13, 15, 4),
+ /* 0011 */ V(15, 13, 4),
+ /* 0100 */ V(12, 15, 4),
+ /* 0101 */ V(15, 12, 4),
+ /* 0110 */ V(11, 15, 4),
+ /* 0111 */ V(15, 11, 4),
+ /* 1000 */ V(15, 10, 3),
+ /* 1001 */ V(15, 10, 3),
+ /* 1010 */ V(10, 15, 4),
+ /* 1011 */ V(9, 15, 4),
+ /* 1100 */ V(15, 9, 3),
+ /* 1101 */ V(15, 9, 3),
+ /* 1110 */ V(15, 8, 3),
+ /* 1111 */ V(15, 8, 3),
+
+ /* 0001 ... */
+ /* 0000 */ V(8, 15, 4), /* 32 */
+ /* 0001 */ V(7, 15, 4),
+ /* 0010 */ V(15, 7, 3),
+ /* 0011 */ V(15, 7, 3),
+ /* 0100 */ V(6, 15, 3),
+ /* 0101 */ V(6, 15, 3),
+ /* 0110 */ V(15, 6, 3),
+ /* 0111 */ V(15, 6, 3),
+ /* 1000 */ V(5, 15, 3),
+ /* 1001 */ V(5, 15, 3),
+ /* 1010 */ V(15, 5, 3),
+ /* 1011 */ V(15, 5, 3),
+ /* 1100 */ V(4, 15, 3),
+ /* 1101 */ V(4, 15, 3),
+ /* 1110 */ V(15, 4, 3),
+ /* 1111 */ V(15, 4, 3),
+
+ /* 0010 ... */
+ /* 0000 */ V(3, 15, 3), /* 48 */
+ /* 0001 */ V(3, 15, 3),
+ /* 0010 */ V(15, 3, 3),
+ /* 0011 */ V(15, 3, 3),
+ /* 0100 */ V(2, 15, 3),
+ /* 0101 */ V(2, 15, 3),
+ /* 0110 */ V(15, 2, 3),
+ /* 0111 */ V(15, 2, 3),
+ /* 1000 */ V(15, 1, 3),
+ /* 1001 */ V(15, 1, 3),
+ /* 1010 */ V(1, 15, 4),
+ /* 1011 */ V(15, 0, 4),
+ /* 1100 */ PTR(172, 3),
+ /* 1101 */ PTR(180, 3),
+ /* 1110 */ PTR(188, 3),
+ /* 1111 */ PTR(196, 3),
+
+ /* 0100 ... */
+ /* 0000 */ PTR(204, 4), /* 64 */
+ /* 0001 */ PTR(220, 3),
+ /* 0010 */ PTR(228, 3),
+ /* 0011 */ PTR(236, 3),
+ /* 0100 */ PTR(244, 2),
+ /* 0101 */ PTR(248, 2),
+ /* 0110 */ PTR(252, 2),
+ /* 0111 */ PTR(256, 2),
+ /* 1000 */ PTR(260, 2),
+ /* 1001 */ PTR(264, 2),
+ /* 1010 */ PTR(268, 2),
+ /* 1011 */ PTR(272, 2),
+ /* 1100 */ PTR(276, 2),
+ /* 1101 */ PTR(280, 3),
+ /* 1110 */ PTR(288, 2),
+ /* 1111 */ PTR(292, 2),
+
+ /* 0101 ... */
+ /* 0000 */ PTR(296, 2), /* 80 */
+ /* 0001 */ PTR(300, 3),
+ /* 0010 */ PTR(308, 2),
+ /* 0011 */ PTR(312, 3),
+ /* 0100 */ PTR(320, 1),
+ /* 0101 */ PTR(322, 2),
+ /* 0110 */ PTR(326, 2),
+ /* 0111 */ PTR(330, 1),
+ /* 1000 */ PTR(332, 2),
+ /* 1001 */ PTR(336, 1),
+ /* 1010 */ PTR(338, 1),
+ /* 1011 */ PTR(340, 1),
+ /* 1100 */ PTR(342, 1),
+ /* 1101 */ PTR(344, 1),
+ /* 1110 */ PTR(346, 1),
+ /* 1111 */ PTR(348, 1),
+
+ /* 0110 ... */
+ /* 0000 */ PTR(350, 1), /* 96 */
+ /* 0001 */ PTR(352, 1),
+ /* 0010 */ PTR(354, 1),
+ /* 0011 */ PTR(356, 1),
+ /* 0100 */ PTR(358, 1),
+ /* 0101 */ PTR(360, 1),
+ /* 0110 */ PTR(362, 1),
+ /* 0111 */ PTR(364, 1),
+ /* 1000 */ PTR(366, 1),
+ /* 1001 */ PTR(368, 1),
+ /* 1010 */ PTR(370, 2),
+ /* 1011 */ PTR(374, 1),
+ /* 1100 */ PTR(376, 2),
+ /* 1101 */ V(7, 3, 4),
+ /* 1110 */ PTR(380, 1),
+ /* 1111 */ V(7, 2, 4),
+
+ /* 0111 ... */
+ /* 0000 */ V(4, 6, 4), /* 112 */
+ /* 0001 */ V(6, 4, 4),
+ /* 0010 */ V(5, 5, 4),
+ /* 0011 */ V(7, 1, 4),
+ /* 0100 */ V(3, 6, 4),
+ /* 0101 */ V(6, 3, 4),
+ /* 0110 */ V(4, 5, 4),
+ /* 0111 */ V(5, 4, 4),
+ /* 1000 */ V(2, 6, 4),
+ /* 1001 */ V(6, 2, 4),
+ /* 1010 */ V(1, 6, 4),
+ /* 1011 */ V(6, 1, 4),
+ /* 1100 */ PTR(382, 1),
+ /* 1101 */ V(3, 5, 4),
+ /* 1110 */ V(5, 3, 4),
+ /* 1111 */ V(4, 4, 4),
+
+ /* 1000 ... */
+ /* 0000 */ V(2, 5, 4), /* 128 */
+ /* 0001 */ V(5, 2, 4),
+ /* 0010 */ V(1, 5, 4),
+ /* 0011 */ PTR(384, 1),
+ /* 0100 */ V(5, 1, 3),
+ /* 0101 */ V(5, 1, 3),
+ /* 0110 */ V(3, 4, 4),
+ /* 0111 */ V(4, 3, 4),
+ /* 1000 */ V(2, 4, 3),
+ /* 1001 */ V(2, 4, 3),
+ /* 1010 */ V(4, 2, 3),
+ /* 1011 */ V(4, 2, 3),
+ /* 1100 */ V(3, 3, 3),
+ /* 1101 */ V(3, 3, 3),
+ /* 1110 */ V(1, 4, 3),
+ /* 1111 */ V(1, 4, 3),
+
+ /* 1001 ... */
+ /* 0000 */ V(4, 1, 3), /* 144 */
+ /* 0001 */ V(4, 1, 3),
+ /* 0010 */ V(0, 4, 4),
+ /* 0011 */ V(4, 0, 4),
+ /* 0100 */ V(2, 3, 3),
+ /* 0101 */ V(2, 3, 3),
+ /* 0110 */ V(3, 2, 3),
+ /* 0111 */ V(3, 2, 3),
+ /* 1000 */ V(1, 3, 2),
+ /* 1001 */ V(1, 3, 2),
+ /* 1010 */ V(1, 3, 2),
+ /* 1011 */ V(1, 3, 2),
+ /* 1100 */ V(3, 1, 2),
+ /* 1101 */ V(3, 1, 2),
+ /* 1110 */ V(3, 1, 2),
+ /* 1111 */ V(3, 1, 2),
+
+ /* 1010 ... */
+ /* 000 */ V(0, 3, 3), /* 160 */
+ /* 001 */ V(3, 0, 3),
+ /* 010 */ V(2, 2, 2),
+ /* 011 */ V(2, 2, 2),
+ /* 100 */ V(1, 2, 1),
+ /* 101 */ V(1, 2, 1),
+ /* 110 */ V(1, 2, 1),
+ /* 111 */ V(1, 2, 1),
+
+ /* 1011 ... */
+ /* 00 */ V(2, 1, 1), /* 168 */
+ /* 01 */ V(2, 1, 1),
+ /* 10 */ V(0, 2, 2),
+ /* 11 */ V(2, 0, 2),
+
+ /* 0010 1100 ... */
+ /* 000 */ V(0, 15, 1), /* 172 */
+ /* 001 */ V(0, 15, 1),
+ /* 010 */ V(0, 15, 1),
+ /* 011 */ V(0, 15, 1),
+ /* 100 */ V(14, 14, 3),
+ /* 101 */ V(13, 14, 3),
+ /* 110 */ V(14, 13, 3),
+ /* 111 */ V(12, 14, 3),
+
+ /* 0010 1101 ... */
+ /* 000 */ V(14, 12, 3), /* 180 */
+ /* 001 */ V(13, 13, 3),
+ /* 010 */ V(11, 14, 3),
+ /* 011 */ V(14, 11, 3),
+ /* 100 */ V(12, 13, 3),
+ /* 101 */ V(13, 12, 3),
+ /* 110 */ V(10, 14, 3),
+ /* 111 */ V(14, 10, 3),
+
+ /* 0010 1110 ... */
+ /* 000 */ V(11, 13, 3), /* 188 */
+ /* 001 */ V(13, 11, 3),
+ /* 010 */ V(12, 12, 3),
+ /* 011 */ V(9, 14, 3),
+ /* 100 */ V(14, 9, 3),
+ /* 101 */ V(10, 13, 3),
+ /* 110 */ V(13, 10, 3),
+ /* 111 */ V(11, 12, 3),
+
+ /* 0010 1111 ... */
+ /* 000 */ V(12, 11, 3), /* 196 */
+ /* 001 */ V(8, 14, 3),
+ /* 010 */ V(14, 8, 3),
+ /* 011 */ V(9, 13, 3),
+ /* 100 */ V(13, 9, 3),
+ /* 101 */ V(7, 14, 3),
+ /* 110 */ V(14, 7, 3),
+ /* 111 */ V(10, 12, 3),
+
+ /* 0100 0000 ... */
+ /* 0000 */ V(12, 10, 3), /* 204 */
+ /* 0001 */ V(12, 10, 3),
+ /* 0010 */ V(11, 11, 3),
+ /* 0011 */ V(11, 11, 3),
+ /* 0100 */ V(8, 13, 3),
+ /* 0101 */ V(8, 13, 3),
+ /* 0110 */ V(13, 8, 3),
+ /* 0111 */ V(13, 8, 3),
+ /* 1000 */ V(0, 14, 4),
+ /* 1001 */ V(14, 0, 4),
+ /* 1010 */ V(0, 13, 3),
+ /* 1011 */ V(0, 13, 3),
+ /* 1100 */ V(14, 6, 2),
+ /* 1101 */ V(14, 6, 2),
+ /* 1110 */ V(14, 6, 2),
+ /* 1111 */ V(14, 6, 2),
+
+ /* 0100 0001 ... */
+ /* 000 */ V(6, 14, 3), /* 220 */
+ /* 001 */ V(9, 12, 3),
+ /* 010 */ V(12, 9, 2),
+ /* 011 */ V(12, 9, 2),
+ /* 100 */ V(5, 14, 2),
+ /* 101 */ V(5, 14, 2),
+ /* 110 */ V(11, 10, 2),
+ /* 111 */ V(11, 10, 2),
+
+ /* 0100 0010 ... */
+ /* 000 */ V(14, 5, 2), /* 228 */
+ /* 001 */ V(14, 5, 2),
+ /* 010 */ V(10, 11, 3),
+ /* 011 */ V(7, 13, 3),
+ /* 100 */ V(13, 7, 2),
+ /* 101 */ V(13, 7, 2),
+ /* 110 */ V(14, 4, 2),
+ /* 111 */ V(14, 4, 2),
+
+ /* 0100 0011 ... */
+ /* 000 */ V(8, 12, 2), /* 236 */
+ /* 001 */ V(8, 12, 2),
+ /* 010 */ V(12, 8, 2),
+ /* 011 */ V(12, 8, 2),
+ /* 100 */ V(4, 14, 3),
+ /* 101 */ V(2, 14, 3),
+ /* 110 */ V(3, 14, 2),
+ /* 111 */ V(3, 14, 2),
+
+ /* 0100 0100 ... */
+ /* 00 */ V(6, 13, 2), /* 244 */
+ /* 01 */ V(13, 6, 2),
+ /* 10 */ V(14, 3, 2),
+ /* 11 */ V(9, 11, 2),
+
+ /* 0100 0101 ... */
+ /* 00 */ V(11, 9, 2), /* 248 */
+ /* 01 */ V(10, 10, 2),
+ /* 10 */ V(14, 2, 2),
+ /* 11 */ V(1, 14, 2),
+
+ /* 0100 0110 ... */
+ /* 00 */ V(14, 1, 2), /* 252 */
+ /* 01 */ V(5, 13, 2),
+ /* 10 */ V(13, 5, 2),
+ /* 11 */ V(7, 12, 2),
+
+ /* 0100 0111 ... */
+ /* 00 */ V(12, 7, 2), /* 256 */
+ /* 01 */ V(4, 13, 2),
+ /* 10 */ V(8, 11, 2),
+ /* 11 */ V(11, 8, 2),
+
+ /* 0100 1000 ... */
+ /* 00 */ V(13, 4, 2), /* 260 */
+ /* 01 */ V(9, 10, 2),
+ /* 10 */ V(10, 9, 2),
+ /* 11 */ V(6, 12, 2),
+
+ /* 0100 1001 ... */
+ /* 00 */ V(12, 6, 2), /* 264 */
+ /* 01 */ V(3, 13, 2),
+ /* 10 */ V(13, 3, 2),
+ /* 11 */ V(2, 13, 2),
+
+ /* 0100 1010 ... */
+ /* 00 */ V(13, 2, 2), /* 268 */
+ /* 01 */ V(1, 13, 2),
+ /* 10 */ V(7, 11, 2),
+ /* 11 */ V(11, 7, 2),
+
+ /* 0100 1011 ... */
+ /* 00 */ V(13, 1, 2), /* 272 */
+ /* 01 */ V(5, 12, 2),
+ /* 10 */ V(12, 5, 2),
+ /* 11 */ V(8, 10, 2),
+
+ /* 0100 1100 ... */
+ /* 00 */ V(10, 8, 2), /* 276 */
+ /* 01 */ V(9, 9, 2),
+ /* 10 */ V(4, 12, 2),
+ /* 11 */ V(12, 4, 2),
+
+ /* 0100 1101 ... */
+ /* 000 */ V(6, 11, 2), /* 280 */
+ /* 001 */ V(6, 11, 2),
+ /* 010 */ V(11, 6, 2),
+ /* 011 */ V(11, 6, 2),
+ /* 100 */ V(13, 0, 3),
+ /* 101 */ V(0, 12, 3),
+ /* 110 */ V(3, 12, 2),
+ /* 111 */ V(3, 12, 2),
+
+ /* 0100 1110 ... */
+ /* 00 */ V(12, 3, 2), /* 288 */
+ /* 01 */ V(7, 10, 2),
+ /* 10 */ V(10, 7, 2),
+ /* 11 */ V(2, 12, 2),
+
+ /* 0100 1111 ... */
+ /* 00 */ V(12, 2, 2), /* 292 */
+ /* 01 */ V(5, 11, 2),
+ /* 10 */ V(11, 5, 2),
+ /* 11 */ V(1, 12, 2),
+
+ /* 0101 0000 ... */
+ /* 00 */ V(8, 9, 2), /* 296 */
+ /* 01 */ V(9, 8, 2),
+ /* 10 */ V(12, 1, 2),
+ /* 11 */ V(4, 11, 2),
+
+ /* 0101 0001 ... */
+ /* 000 */ V(12, 0, 3), /* 300 */
+ /* 001 */ V(0, 11, 3),
+ /* 010 */ V(3, 11, 2),
+ /* 011 */ V(3, 11, 2),
+ /* 100 */ V(11, 0, 3),
+ /* 101 */ V(0, 10, 3),
+ /* 110 */ V(1, 10, 2),
+ /* 111 */ V(1, 10, 2),
+
+ /* 0101 0010 ... */
+ /* 00 */ V(11, 4, 1), /* 308 */
+ /* 01 */ V(11, 4, 1),
+ /* 10 */ V(6, 10, 2),
+ /* 11 */ V(10, 6, 2),
+
+ /* 0101 0011 ... */
+ /* 000 */ V(7, 9, 2), /* 312 */
+ /* 001 */ V(7, 9, 2),
+ /* 010 */ V(9, 7, 2),
+ /* 011 */ V(9, 7, 2),
+ /* 100 */ V(10, 0, 3),
+ /* 101 */ V(0, 9, 3),
+ /* 110 */ V(9, 0, 2),
+ /* 111 */ V(9, 0, 2),
+
+ /* 0101 0100 ... */
+ /* 0 */ V(11, 3, 1), /* 320 */
+ /* 1 */ V(8, 8, 1),
+
+ /* 0101 0101 ... */
+ /* 00 */ V(2, 11, 2), /* 322 */
+ /* 01 */ V(5, 10, 2),
+ /* 10 */ V(11, 2, 1),
+ /* 11 */ V(11, 2, 1),
+
+ /* 0101 0110 ... */
+ /* 00 */ V(10, 5, 2), /* 326 */
+ /* 01 */ V(1, 11, 2),
+ /* 10 */ V(11, 1, 2),
+ /* 11 */ V(6, 9, 2),
+
+ /* 0101 0111 ... */
+ /* 0 */ V(9, 6, 1), /* 330 */
+ /* 1 */ V(10, 4, 1),
+
+ /* 0101 1000 ... */
+ /* 00 */ V(4, 10, 2), /* 332 */
+ /* 01 */ V(7, 8, 2),
+ /* 10 */ V(8, 7, 1),
+ /* 11 */ V(8, 7, 1),
+
+ /* 0101 1001 ... */
+ /* 0 */ V(3, 10, 1), /* 336 */
+ /* 1 */ V(10, 3, 1),
+
+ /* 0101 1010 ... */
+ /* 0 */ V(5, 9, 1), /* 338 */
+ /* 1 */ V(9, 5, 1),
+
+ /* 0101 1011 ... */
+ /* 0 */ V(2, 10, 1), /* 340 */
+ /* 1 */ V(10, 2, 1),
+
+ /* 0101 1100 ... */
+ /* 0 */ V(10, 1, 1), /* 342 */
+ /* 1 */ V(6, 8, 1),
+
+ /* 0101 1101 ... */
+ /* 0 */ V(8, 6, 1), /* 344 */
+ /* 1 */ V(7, 7, 1),
+
+ /* 0101 1110 ... */
+ /* 0 */ V(4, 9, 1), /* 346 */
+ /* 1 */ V(9, 4, 1),
+
+ /* 0101 1111 ... */
+ /* 0 */ V(3, 9, 1), /* 348 */
+ /* 1 */ V(9, 3, 1),
+
+ /* 0110 0000 ... */
+ /* 0 */ V(5, 8, 1), /* 350 */
+ /* 1 */ V(8, 5, 1),
+
+ /* 0110 0001 ... */
+ /* 0 */ V(2, 9, 1), /* 352 */
+ /* 1 */ V(6, 7, 1),
+
+ /* 0110 0010 ... */
+ /* 0 */ V(7, 6, 1), /* 354 */
+ /* 1 */ V(9, 2, 1),
+
+ /* 0110 0011 ... */
+ /* 0 */ V(1, 9, 1), /* 356 */
+ /* 1 */ V(9, 1, 1),
+
+ /* 0110 0100 ... */
+ /* 0 */ V(4, 8, 1), /* 358 */
+ /* 1 */ V(8, 4, 1),
+
+ /* 0110 0101 ... */
+ /* 0 */ V(5, 7, 1), /* 360 */
+ /* 1 */ V(7, 5, 1),
+
+ /* 0110 0110 ... */
+ /* 0 */ V(3, 8, 1), /* 362 */
+ /* 1 */ V(8, 3, 1),
+
+ /* 0110 0111 ... */
+ /* 0 */ V(6, 6, 1), /* 364 */
+ /* 1 */ V(2, 8, 1),
+
+ /* 0110 1000 ... */
+ /* 0 */ V(8, 2, 1), /* 366 */
+ /* 1 */ V(1, 8, 1),
+
+ /* 0110 1001 ... */
+ /* 0 */ V(4, 7, 1), /* 368 */
+ /* 1 */ V(7, 4, 1),
+
+ /* 0110 1010 ... */
+ /* 00 */ V(8, 1, 1), /* 370 */
+ /* 01 */ V(8, 1, 1),
+ /* 10 */ V(0, 8, 2),
+ /* 11 */ V(8, 0, 2),
+
+ /* 0110 1011 ... */
+ /* 0 */ V(5, 6, 1), /* 374 */
+ /* 1 */ V(6, 5, 1),
+
+ /* 0110 1100 ... */
+ /* 00 */ V(1, 7, 1), /* 376 */
+ /* 01 */ V(1, 7, 1),
+ /* 10 */ V(0, 7, 2),
+ /* 11 */ V(7, 0, 2),
+
+ /* 0110 1110 ... */
+ /* 0 */ V(3, 7, 1), /* 380 */
+ /* 1 */ V(2, 7, 1),
+
+ /* 0111 1100 ... */
+ /* 0 */ V(0, 6, 1), /* 382 */
+ /* 1 */ V(6, 0, 1),
+
+ /* 1000 0011 ... */
+ /* 0 */ V(0, 5, 1), /* 384 */
+ /* 1 */ V(5, 0, 1)
+};
+
+# undef V
+# undef PTR
+
+/* external tables */
+
+union huffquad const *const mad_huff_quad_table[2] = { hufftabA, hufftabB };
+
+struct hufftable const mad_huff_pair_table[32] = {
+ /* 0 */ { hufftab0, 0, 0 },
+ /* 1 */ { hufftab1, 0, 3 },
+ /* 2 */ { hufftab2, 0, 3 },
+ /* 3 */ { hufftab3, 0, 3 },
+ /* 4 */ { 0 /* not used */ },
+ /* 5 */ { hufftab5, 0, 3 },
+ /* 6 */ { hufftab6, 0, 4 },
+ /* 7 */ { hufftab7, 0, 4 },
+ /* 8 */ { hufftab8, 0, 4 },
+ /* 9 */ { hufftab9, 0, 4 },
+ /* 10 */ { hufftab10, 0, 4 },
+ /* 11 */ { hufftab11, 0, 4 },
+ /* 12 */ { hufftab12, 0, 4 },
+ /* 13 */ { hufftab13, 0, 4 },
+ /* 14 */ { 0 /* not used */ },
+ /* 15 */ { hufftab15, 0, 4 },
+ /* 16 */ { hufftab16, 1, 4 },
+ /* 17 */ { hufftab16, 2, 4 },
+ /* 18 */ { hufftab16, 3, 4 },
+ /* 19 */ { hufftab16, 4, 4 },
+ /* 20 */ { hufftab16, 6, 4 },
+ /* 21 */ { hufftab16, 8, 4 },
+ /* 22 */ { hufftab16, 10, 4 },
+ /* 23 */ { hufftab16, 13, 4 },
+ /* 24 */ { hufftab24, 4, 4 },
+ /* 25 */ { hufftab24, 5, 4 },
+ /* 26 */ { hufftab24, 6, 4 },
+ /* 27 */ { hufftab24, 7, 4 },
+ /* 28 */ { hufftab24, 8, 4 },
+ /* 29 */ { hufftab24, 9, 4 },
+ /* 30 */ { hufftab24, 11, 4 },
+ /* 31 */ { hufftab24, 13, 4 }
+};
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/huffman.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/huffman.h
new file mode 100644
index 000000000..7a83b8ae0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/huffman.h
@@ -0,0 +1,66 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: huffman.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_HUFFMAN_H
+# define LIBMAD_HUFFMAN_H
+
+union huffquad {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short v : 1;
+ unsigned short w : 1;
+ unsigned short x : 1;
+ unsigned short y : 1;
+ } value;
+ unsigned short final : 1;
+};
+
+union huffpair {
+ struct {
+ unsigned short final : 1;
+ unsigned short bits : 3;
+ unsigned short offset : 12;
+ } ptr;
+ struct {
+ unsigned short final : 1;
+ unsigned short hlen : 3;
+ unsigned short x : 4;
+ unsigned short y : 4;
+ } value;
+ unsigned short final : 1;
+};
+
+struct hufftable {
+ union huffpair const *table;
+ unsigned short linbits;
+ unsigned short startbits;
+};
+
+extern union huffquad const *const mad_huff_quad_table[2];
+extern struct hufftable const mad_huff_pair_table[32];
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/imdct_l_arm.S b/src/filters/transform/mpadecfilter/libmad-0.15.0b/imdct_l_arm.S
new file mode 100644
index 000000000..924aed44f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/imdct_l_arm.S
@@ -0,0 +1,1000 @@
+/*****************************************************************************
+* Copyright (C) 2000-2001 Andre McCurdy <armccurdy@yahoo.co.uk>
+*
+* 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@ either version 2 of the License, or
+* (at your option) any later version.
+*
+* 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
+*
+*****************************************************************************
+*
+* Notes:
+*
+*
+*****************************************************************************
+*
+* $Id: imdct_l_arm.S 111 2003-08-31 19:00:18Z gabest $
+*
+* 2001/03/24: Andre McCurdy <armccurdy@yahoo.co.uk>
+* - Corrected PIC unsafe loading of address of 'imdct36_long_karray'
+*
+* 2000/09/20: Robert Leslie <rob@mars.org>
+* - Added a global symbol with leading underscore per suggestion of
+* Simon Burge to support linking with the a.out format.
+*
+* 2000/09/15: Robert Leslie <rob@mars.org>
+* - Fixed a small bug where flags were changed before a conditional branch.
+*
+* 2000/09/15: Andre McCurdy <armccurdy@yahoo.co.uk>
+* - Applied Nicolas Pitre's rounding optimisation in all remaining places.
+*
+* 2000/09/09: Nicolas Pitre <nico@cam.org>
+* - Optimized rounding + scaling operations.
+*
+* 2000/08/09: Andre McCurdy <armccurdy@yahoo.co.uk>
+* - Original created.
+*
+****************************************************************************/
+
+
+/*
+ On entry:
+
+ r0 = pointer to 18 element input array
+ r1 = pointer to 36 element output array
+ r2 = windowing block type
+
+
+ Stack frame created during execution of the function:
+
+ Initial Holds:
+ Stack
+ pointer
+ minus:
+
+ 0
+ 4 lr
+ 8 r11
+ 12 r10
+ 16 r9
+ 20 r8
+ 24 r7
+ 28 r6
+ 32 r5
+ 36 r4
+
+ 40 r2 : windowing block type
+
+ 44 ct00 high
+ 48 ct00 low
+ 52 ct01 high
+ 56 ct01 low
+ 60 ct04 high
+ 64 ct04 low
+ 68 ct06 high
+ 72 ct06 low
+ 76 ct05 high
+ 80 ct05 low
+ 84 ct03 high
+ 88 ct03 low
+ 92 -ct05 high
+ 96 -ct05 low
+ 100 -ct07 high
+ 104 -ct07 low
+ 108 ct07 high
+ 112 ct07 low
+ 116 ct02 high
+ 120 ct02 low
+*/
+
+#define BLOCK_MODE_NORMAL 0
+#define BLOCK_MODE_START 1
+#define BLOCK_MODE_STOP 3
+
+
+#define X0 0x00
+#define X1 0x04
+#define X2 0x08
+#define X3 0x0C
+#define X4 0x10
+#define X5 0x14
+#define X6 0x18
+#define X7 0x1c
+#define X8 0x20
+#define X9 0x24
+#define X10 0x28
+#define X11 0x2c
+#define X12 0x30
+#define X13 0x34
+#define X14 0x38
+#define X15 0x3c
+#define X16 0x40
+#define X17 0x44
+
+#define x0 0x00
+#define x1 0x04
+#define x2 0x08
+#define x3 0x0C
+#define x4 0x10
+#define x5 0x14
+#define x6 0x18
+#define x7 0x1c
+#define x8 0x20
+#define x9 0x24
+#define x10 0x28
+#define x11 0x2c
+#define x12 0x30
+#define x13 0x34
+#define x14 0x38
+#define x15 0x3c
+#define x16 0x40
+#define x17 0x44
+#define x18 0x48
+#define x19 0x4c
+#define x20 0x50
+#define x21 0x54
+#define x22 0x58
+#define x23 0x5c
+#define x24 0x60
+#define x25 0x64
+#define x26 0x68
+#define x27 0x6c
+#define x28 0x70
+#define x29 0x74
+#define x30 0x78
+#define x31 0x7c
+#define x32 0x80
+#define x33 0x84
+#define x34 0x88
+#define x35 0x8c
+
+#define K00 0x0ffc19fd
+#define K01 0x00b2aa3e
+#define K02 0x0fdcf549
+#define K03 0x0216a2a2
+#define K04 0x0f9ee890
+#define K05 0x03768962
+#define K06 0x0f426cb5
+#define K07 0x04cfb0e2
+#define K08 0x0ec835e8
+#define K09 0x061f78aa
+#define K10 0x0e313245
+#define K11 0x07635284
+#define K12 0x0d7e8807
+#define K13 0x0898c779
+#define K14 0x0cb19346
+#define K15 0x09bd7ca0
+#define K16 0x0bcbe352
+#define K17 0x0acf37ad
+
+#define minus_K02 0xf0230ab7
+
+#define WL0 0x00b2aa3e
+#define WL1 0x0216a2a2
+#define WL2 0x03768962
+#define WL3 0x04cfb0e2
+#define WL4 0x061f78aa
+#define WL5 0x07635284
+#define WL6 0x0898c779
+#define WL7 0x09bd7ca0
+#define WL8 0x0acf37ad
+#define WL9 0x0bcbe352
+#define WL10 0x0cb19346
+#define WL11 0x0d7e8807
+#define WL12 0x0e313245
+#define WL13 0x0ec835e8
+#define WL14 0x0f426cb5
+#define WL15 0x0f9ee890
+#define WL16 0x0fdcf549
+#define WL17 0x0ffc19fd
+
+
+@*****************************************************************************
+
+
+ .text
+ .align
+
+ .global III_imdct_l
+ .global _III_imdct_l
+
+III_imdct_l:
+_III_imdct_l:
+
+ stmdb sp!, { r2, r4 - r11, lr } @ all callee saved regs, plus arg3
+
+ ldr r4, =K08 @ r4 = K08
+ ldr r5, =K09 @ r5 = K09
+ ldr r8, [r0, #X4] @ r8 = X4
+ ldr r9, [r0, #X13] @ r9 = X13
+ rsb r6, r4, #0 @ r6 = -K08
+ rsb r7, r5, #0 @ r7 = -K09
+
+ smull r2, r3, r4, r8 @ r2..r3 = (X4 * K08)
+ smlal r2, r3, r5, r9 @ r2..r3 = (X4 * K08) + (X13 * K09) = ct01
+
+ smull r10, lr, r8, r5 @ r10..lr = (X4 * K09)
+ smlal r10, lr, r9, r6 @ r10..lr = (X4 * K09) + (X13 * -K08) = ct00
+
+ ldr r8, [r0, #X7] @ r8 = X7
+ ldr r9, [r0, #X16] @ r9 = X16
+
+ stmdb sp!, { r2, r3, r10, lr } @ stack ct00_h, ct00_l, ct01_h, ct01_l
+
+ add r8, r8, r9 @ r8 = (X7 + X16)
+ ldr r9, [r0, #X1] @ r9 = X1
+
+ smlal r2, r3, r6, r8 @ r2..r3 = ct01 + ((X7 + X16) * -K08)
+ smlal r2, r3, r7, r9 @ r2..r3 += (X1 * -K09)
+
+ ldr r7, [r0, #X10] @ r7 = X10
+
+ rsbs r10, r10, #0
+ rsc lr, lr, #0 @ r10..lr = -ct00
+
+ smlal r2, r3, r5, r7 @ r2..r3 += (X10 * K09) = ct06
+
+ smlal r10, lr, r9, r6 @ r10..lr = -ct00 + ( X1 * -K08)
+ smlal r10, lr, r8, r5 @ r10..lr += ((X7 + X16) * K09)
+ smlal r10, lr, r7, r4 @ r10..lr += ( X10 * K08) = ct04
+
+ stmdb sp!, { r2, r3, r10, lr } @ stack ct04_h, ct04_l, ct06_h, ct06_l
+
+ @----
+
+ ldr r7, [r0, #X0]
+ ldr r8, [r0, #X11]
+ ldr r9, [r0, #X12]
+ sub r7, r7, r8
+ sub r7, r7, r9 @ r7 = (X0 - X11 -X12) = ct14
+
+ ldr r9, [r0, #X3]
+ ldr r8, [r0, #X8]
+ ldr r11, [r0, #X15]
+ sub r8, r8, r9
+ add r8, r8, r11 @ r8 = (X8 - X3 + X15) = ct16
+
+ add r11, r7, r8 @ r11 = ct14 + ct16 = ct18
+
+ smlal r2, r3, r6, r11 @ r2..r3 = ct06 + ((X0 - X11 - X3 + X15 + X8 - X12) * -K08)
+
+ ldr r6, [r0, #X2]
+ ldr r9, [r0, #X9]
+ ldr r12, [r0, #X14]
+ sub r6, r6, r9
+ sub r6, r6, r12 @ r6 = (X2 - X9 - X14) = ct15
+
+ ldr r9, [r0, #X5]
+ ldr r12, [r0, #X6]
+ sub r9, r9, r12
+ ldr r12, [r0, #X17]
+ sub r9, r9, r12 @ r9 = (X5 - X6 - X17) = ct17
+
+ add r12, r9, r6 @ r12 = ct15 + ct17 = ct19
+
+ smlal r2, r3, r5, r12 @ r2..r3 += ((X2 - X9 + X5 - X6 - X17 - X14) * K09)
+
+ smlal r10, lr, r11, r5 @ r10..lr = ct04 + (ct18 * K09)
+ smlal r10, lr, r12, r4 @ r10..lr = ct04 + (ct18 * K09) + (ct19 * K08)
+
+ movs r2, r2, lsr #28
+ adc r2, r2, r3, lsl #4 @ r2 = bits[59..28] of r2..r3
+ str r2, [r1, #x22] @ store result x22
+
+ movs r10, r10, lsr #28
+ adc r10, r10, lr, lsl #4 @ r10 = bits[59..28] of r10..lr
+ str r10, [r1, #x4] @ store result x4
+
+ @----
+
+ ldmia sp, { r2, r3, r4, r5 } @ r2..r3 = ct06, r4..r5 = ct04 (dont update sp)
+
+ @ r2..r3 = ct06
+ @ r4..r5 = ct04
+ @ r6 = ct15
+ @ r7 = ct14
+ @ r8 = ct16
+ @ r9 = ct17
+ @ r10 = .
+ @ r11 = .
+ @ r12 = .
+ @ lr = .
+
+ ldr r10, =K03 @ r10 = K03
+ ldr lr, =K15 @ lr = K15
+
+ smlal r2, r3, r10, r7 @ r2..r3 = ct06 + (ct14 * K03)
+ smlal r4, r5, lr, r7 @ r4..r5 = ct04 + (ct14 * K15)
+
+ ldr r12, =K14 @ r12 = K14
+ rsb r10, r10, #0 @ r10 = -K03
+
+ smlal r2, r3, lr, r6 @ r2..r3 += (ct15 * K15)
+ smlal r4, r5, r10, r6 @ r4..r5 += (ct15 * -K03)
+ smlal r2, r3, r12, r8 @ r2..r3 += (ct16 * K14)
+
+ ldr r11, =minus_K02 @ r11 = -K02
+ rsb r12, r12, #0 @ r12 = -K14
+
+ smlal r4, r5, r12, r9 @ r4..r5 += (ct17 * -K14)
+ smlal r2, r3, r11, r9 @ r2..r3 += (ct17 * -K02)
+ smlal r4, r5, r11, r8 @ r4..r5 += (ct16 * -K02)
+
+ movs r2, r2, lsr #28
+ adc r2, r2, r3, lsl #4 @ r2 = bits[59..28] of r2..r3
+ str r2, [r1, #x7] @ store result x7
+
+ movs r4, r4, lsr #28
+ adc r4, r4, r5, lsl #4 @ r4 = bits[59..28] of r4..r5
+ str r4, [r1, #x1] @ store result x1
+
+ @----
+
+ ldmia sp, { r2, r3, r4, r5 } @ r2..r3 = ct06, r4..r5 = ct04 (dont update sp)
+
+ @ r2..r3 = ct06
+ @ r4..r5 = ct04
+ @ r6 = ct15
+ @ r7 = ct14
+ @ r8 = ct16
+ @ r9 = ct17
+ @ r10 = -K03
+ @ r11 = -K02
+ @ r12 = -K14
+ @ lr = K15
+
+ rsbs r2, r2, #0
+ rsc r3, r3, #0 @ r2..r3 = -ct06
+
+ smlal r2, r3, r12, r7 @ r2..r3 = -ct06 + (ct14 * -K14)
+ smlal r2, r3, r10, r8 @ r2..r3 += (ct16 * -K03)
+
+ smlal r4, r5, r12, r6 @ r4..r5 = ct04 + (ct15 * -K14)
+ smlal r4, r5, r10, r9 @ r4..r5 += (ct17 * -K03)
+ smlal r4, r5, lr, r8 @ r4..r5 += (ct16 * K15)
+ smlal r4, r5, r11, r7 @ r4..r5 += (ct14 * -K02)
+
+ rsb lr, lr, #0 @ lr = -K15
+ rsb r11, r11, #0 @ r11 = K02
+
+ smlal r2, r3, lr, r9 @ r2..r3 += (ct17 * -K15)
+ smlal r2, r3, r11, r6 @ r2..r3 += (ct15 * K02)
+
+ movs r4, r4, lsr #28
+ adc r4, r4, r5, lsl #4 @ r4 = bits[59..28] of r4..r5
+ str r4, [r1, #x25] @ store result x25
+
+ movs r2, r2, lsr #28
+ adc r2, r2, r3, lsl #4 @ r2 = bits[59..28] of r2..r3
+ str r2, [r1, #x19] @ store result x19
+
+ @----
+
+ ldr r2, [sp, #16] @ r2 = ct01_l
+ ldr r3, [sp, #20] @ r3 = ct01_h
+
+ ldr r6, [r0, #X1]
+ ldr r8, [r0, #X7]
+ ldr r9, [r0, #X10]
+ ldr r7, [r0, #X16]
+
+ rsbs r2, r2, #0
+ rsc r3, r3, #0 @ r2..r3 = -ct01
+
+ mov r4, r2
+ mov r5, r3 @ r4..r5 = -ct01
+
+ @ r2..r3 = -ct01
+ @ r4..r5 = -ct01
+ @ r6 = X1
+ @ r7 = X16
+ @ r8 = X7
+ @ r9 = X10
+ @ r10 = -K03
+ @ r11 = K02
+ @ r12 = -K14
+ @ lr = -K15
+
+ smlal r4, r5, r12, r7 @ r4..r5 = -ct01 + (X16 * -K14)
+ smlal r2, r3, lr, r9 @ r2..r3 = -ct01 + (X10 * -K15)
+
+ smlal r4, r5, r10, r8 @ r4..r5 += (X7 * -K03)
+ smlal r2, r3, r10, r7 @ r2..r3 += (X16 * -K03)
+
+ smlal r4, r5, r11, r9 @ r4..r5 += (X10 * K02)
+ smlal r2, r3, r12, r8 @ r2..r3 += (X7 * -K14)
+
+ rsb lr, lr, #0 @ lr = K15
+ rsb r11, r11, #0 @ r11 = -K02
+
+ smlal r4, r5, lr, r6 @ r4..r5 += (X1 * K15) = ct05
+ smlal r2, r3, r11, r6 @ r2..r3 += (X1 * -K02) = ct03
+
+ stmdb sp!, { r2, r3, r4, r5 } @ stack ct05_h, ct05_l, ct03_h, ct03_l
+
+ rsbs r4, r4, #0
+ rsc r5, r5, #0 @ r4..r5 = -ct05
+
+ stmdb sp!, { r4, r5 } @ stack -ct05_h, -ct05_l
+
+ ldr r2, [sp, #48] @ r2 = ct00_l
+ ldr r3, [sp, #52] @ r3 = ct00_h
+
+ rsb r10, r10, #0 @ r10 = K03
+
+ rsbs r4, r2, #0
+ rsc r5, r3, #0 @ r4..r5 = -ct00
+
+ @ r2..r3 = ct00
+ @ r4..r5 = -ct00
+ @ r6 = X1
+ @ r7 = X16
+ @ r8 = X7
+ @ r9 = X10
+ @ r10 = K03
+ @ r11 = -K02
+ @ r12 = -K14
+ @ lr = K15
+
+ smlal r4, r5, r10, r6 @ r4..r5 = -ct00 + (X1 * K03)
+ smlal r2, r3, r10, r9 @ r2..r3 = ct00 + (X10 * K03)
+
+ smlal r4, r5, r12, r9 @ r4..r5 += (X10 * -K14)
+ smlal r2, r3, r12, r6 @ r2..r3 += (X1 * -K14)
+
+ smlal r4, r5, r11, r7 @ r4..r5 += (X16 * -K02)
+ smlal r4, r5, lr, r8 @ r4..r5 += (X7 * K15) = ct07
+
+ rsb lr, lr, #0 @ lr = -K15
+ rsb r11, r11, #0 @ r11 = K02
+
+ smlal r2, r3, r11, r8 @ r2..r3 += (X7 * K02)
+ smlal r2, r3, lr, r7 @ r2..r3 += (X16 * -K15) = ct02
+
+ rsbs r6, r4, #0
+ rsc r7, r5, #0 @ r6..r7 = -ct07
+
+ stmdb sp!, { r2 - r7 } @ stack -ct07_h, -ct07_l, ct07_h, ct07_l, ct02_h, ct02_l
+
+
+ @----
+
+ add r2, pc, #(imdct36_long_karray-.-8) @ r2 = base address of Knn array (PIC safe ?)
+
+
+loop:
+ ldr r12, [r0, #X0]
+
+ ldmia r2!, { r5 - r11 } @ first 7 words from Karray element
+
+ smull r3, r4, r5, r12 @ sum = (Kxx * X0)
+ ldr r12, [r0, #X2]
+ ldr r5, [r0, #X3]
+ smlal r3, r4, r6, r12 @ sum += (Kxx * X2)
+ ldr r12, [r0, #X5]
+ ldr r6, [r0, #X6]
+ smlal r3, r4, r7, r5 @ sum += (Kxx * X3)
+ smlal r3, r4, r8, r12 @ sum += (Kxx * X5)
+ ldr r12, [r0, #X8]
+ ldr r5, [r0, #X9]
+ smlal r3, r4, r9, r6 @ sum += (Kxx * X6)
+ smlal r3, r4, r10, r12 @ sum += (Kxx * X8)
+ smlal r3, r4, r11, r5 @ sum += (Kxx * X9)
+
+ ldmia r2!, { r5 - r10 } @ final 6 words from Karray element
+
+ ldr r11, [r0, #X11]
+ ldr r12, [r0, #X12]
+ smlal r3, r4, r5, r11 @ sum += (Kxx * X11)
+ ldr r11, [r0, #X14]
+ ldr r5, [r0, #X15]
+ smlal r3, r4, r6, r12 @ sum += (Kxx * X12)
+ smlal r3, r4, r7, r11 @ sum += (Kxx * X14)
+ ldr r11, [r0, #X17]
+ smlal r3, r4, r8, r5 @ sum += (Kxx * X15)
+ smlal r3, r4, r9, r11 @ sum += (Kxx * X17)
+
+ add r5, sp, r10, lsr #16 @ create index back into stack for required ctxx
+
+ ldmia r5, { r6, r7 } @ r6..r7 = ctxx
+
+ mov r8, r10, lsl #16 @ push ctxx index off the top end
+
+ adds r3, r3, r6 @ add low words
+ adc r4, r4, r7 @ add high words, with carry
+ movs r3, r3, lsr #28
+ adc r3, r3, r4, lsl #4 @ r3 = bits[59..28] of r3..r4
+
+ str r3, [r1, r8, lsr #24] @ push completion flag off the bottom end
+
+ movs r8, r8, lsl #8 @ push result location index off the top end
+ beq loop @ loop back if completion flag not set
+ b imdct_l_windowing @ branch to windowing stage if looping finished
+
+imdct36_long_karray:
+
+ .word K17, -K13, K10, -K06, -K05, K01, -K00, K04, -K07, K11, K12, -K16, 0x00000000
+ .word K13, K07, K16, K01, K10, -K05, K04, -K11, K00, -K17, K06, -K12, 0x00200800
+ .word K11, K17, K05, K12, -K01, K06, -K07, K00, -K13, K04, -K16, K10, 0x00200c00
+ .word K07, K00, -K12, K05, -K16, -K10, K11, -K17, K04, K13, K01, K06, 0x00001400
+ .word K05, K10, -K00, -K17, K07, -K13, K12, K06, -K16, K01, -K11, -K04, 0x00181800
+ .word K01, K05, -K07, -K11, K13, K17, -K16, -K12, K10, K06, -K04, -K00, 0x00102000
+ .word -K16, K12, -K11, K07, K04, -K00, -K01, K05, -K06, K10, K13, -K17, 0x00284800
+ .word -K12, K06, K17, -K00, -K11, K04, K05, -K10, K01, K16, -K07, -K13, 0x00085000
+ .word -K10, K16, K04, -K13, -K00, K07, K06, -K01, -K12, -K05, K17, K11, 0x00105400
+ .word -K06, -K01, K13, K04, K17, -K11, -K10, -K16, -K05, K12, K00, K07, 0x00185c00
+ .word -K04, -K11, -K01, K16, K06, K12, K13, -K07, -K17, -K00, -K10, -K05, 0x00006000
+ .word -K00, -K04, -K06, -K10, -K12, -K16, -K17, -K13, -K11, -K07, -K05, -K01, 0x00206801
+
+
+ @----
+ @-------------------------------------------------------------------------
+ @----
+
+imdct_l_windowing:
+
+ ldr r11, [sp, #80] @ fetch function parameter 3 from out of the stack
+ ldmia r1!, { r0, r2 - r9 } @ load 9 words from x0, update pointer
+
+ @ r0 = x0
+ @ r1 = &x[9]
+ @ r2 = x1
+ @ r3 = x2
+ @ r4 = x3
+ @ r5 = x4
+ @ r6 = x5
+ @ r7 = x6
+ @ r8 = x7
+ @ r9 = x8
+ @ r10 = .
+ @ r11 = window mode: (0 == normal), (1 == start block), (3 == stop block)
+ @ r12 = .
+ @ lr = .
+
+ cmp r11, #BLOCK_MODE_STOP @ setup flags
+ rsb r10, r0, #0 @ r10 = -x0 (DONT change flags !!)
+ beq stop_block_x0_to_x17
+
+
+ @ start and normal blocks are treated the same for x[0]..x[17]
+
+normal_block_x0_to_x17:
+
+ ldr r12, =WL9 @ r12 = window_l[9]
+
+ rsb r0, r9, #0 @ r0 = -x8
+ rsb r9, r2, #0 @ r9 = -x1
+ rsb r2, r8, #0 @ r2 = -x7
+ rsb r8, r3, #0 @ r8 = -x2
+ rsb r3, r7, #0 @ r3 = -x6
+ rsb r7, r4, #0 @ r7 = -x3
+ rsb r4, r6, #0 @ r4 = -x5
+ rsb r6, r5, #0 @ r6 = -x4
+
+ @ r0 = -x8
+ @ r1 = &x[9]
+ @ r2 = -x7
+ @ r3 = -x6
+ @ r4 = -x5
+ @ r5 = .
+ @ r6 = -x4
+ @ r7 = -x3
+ @ r8 = -x2
+ @ r9 = -x1
+ @ r10 = -x0
+ @ r11 = window mode: (0 == normal), (1 == start block), (3 == stop block)
+ @ r12 = window_l[9]
+ @ lr = .
+
+ smull r5, lr, r12, r0 @ r5..lr = (window_l[9] * (x[9] == -x[8]))
+ ldr r12, =WL10 @ r12 = window_l[10]
+ movs r5, r5, lsr #28
+ adc r0, r5, lr, lsl #4 @ r0 = bits[59..28] of windowed x9
+
+ smull r5, lr, r12, r2 @ r5..lr = (window_l[10] * (x[10] == -x[7]))
+ ldr r12, =WL11 @ r12 = window_l[11]
+ movs r5, r5, lsr #28
+ adc r2, r5, lr, lsl #4 @ r2 = bits[59..28] of windowed x10
+
+ smull r5, lr, r12, r3 @ r5..lr = (window_l[11] * (x[11] == -x[6]))
+ ldr r12, =WL12 @ r12 = window_l[12]
+ movs r5, r5, lsr #28
+ adc r3, r5, lr, lsl #4 @ r3 = bits[59..28] of windowed x11
+
+ smull r5, lr, r12, r4 @ r5..lr = (window_l[12] * (x[12] == -x[5]))
+ ldr r12, =WL13 @ r12 = window_l[13]
+ movs r5, r5, lsr #28
+ adc r4, r5, lr, lsl #4 @ r4 = bits[59..28] of windowed x12
+
+ smull r5, lr, r12, r6 @ r5..lr = (window_l[13] * (x[13] == -x[4]))
+ ldr r12, =WL14 @ r12 = window_l[14]
+ movs r5, r5, lsr #28
+ adc r6, r5, lr, lsl #4 @ r6 = bits[59..28] of windowed x13
+
+ smull r5, lr, r12, r7 @ r5..lr = (window_l[14] * (x[14] == -x[3]))
+ ldr r12, =WL15 @ r12 = window_l[15]
+ movs r5, r5, lsr #28
+ adc r7, r5, lr, lsl #4 @ r7 = bits[59..28] of windowed x14
+
+ smull r5, lr, r12, r8 @ r5..lr = (window_l[15] * (x[15] == -x[2]))
+ ldr r12, =WL16 @ r12 = window_l[16]
+ movs r5, r5, lsr #28
+ adc r8, r5, lr, lsl #4 @ r8 = bits[59..28] of windowed x15
+
+ smull r5, lr, r12, r9 @ r5..lr = (window_l[16] * (x[16] == -x[1]))
+ ldr r12, =WL17 @ r12 = window_l[17]
+ movs r5, r5, lsr #28
+ adc r9, r5, lr, lsl #4 @ r9 = bits[59..28] of windowed x16
+
+ smull r5, lr, r12, r10 @ r5..lr = (window_l[17] * (x[17] == -x[0]))
+ ldr r12, =WL0 @ r12 = window_l[0]
+ movs r5, r5, lsr #28
+ adc r10, r5, lr, lsl #4 @ r10 = bits[59..28] of windowed x17
+
+
+ stmia r1, { r0, r2 - r4, r6 - r10 } @ store windowed x[9] .. x[17]
+ ldmdb r1!, { r0, r2 - r9 } @ load 9 words downto (and including) x0
+
+
+ smull r10, lr, r12, r0 @ r10..lr = (window_l[0] * x[0])
+ ldr r12, =WL1 @ r12 = window_l[1]
+ movs r10, r10, lsr #28
+ adc r0, r10, lr, lsl #4 @ r0 = bits[59..28] of windowed x0
+
+ smull r10, lr, r12, r2 @ r10..lr = (window_l[1] * x[1])
+ ldr r12, =WL2 @ r12 = window_l[2]
+ movs r10, r10, lsr #28
+ adc r2, r10, lr, lsl #4 @ r2 = bits[59..28] of windowed x1
+
+ smull r10, lr, r12, r3 @ r10..lr = (window_l[2] * x[2])
+ ldr r12, =WL3 @ r12 = window_l[3]
+ movs r10, r10, lsr #28
+ adc r3, r10, lr, lsl #4 @ r3 = bits[59..28] of windowed x2
+
+ smull r10, lr, r12, r4 @ r10..lr = (window_l[3] * x[3])
+ ldr r12, =WL4 @ r12 = window_l[4]
+ movs r10, r10, lsr #28
+ adc r4, r10, lr, lsl #4 @ r4 = bits[59..28] of windowed x3
+
+ smull r10, lr, r12, r5 @ r10..lr = (window_l[4] * x[4])
+ ldr r12, =WL5 @ r12 = window_l[5]
+ movs r10, r10, lsr #28
+ adc r5, r10, lr, lsl #4 @ r5 = bits[59..28] of windowed x4
+
+ smull r10, lr, r12, r6 @ r10..lr = (window_l[5] * x[5])
+ ldr r12, =WL6 @ r12 = window_l[6]
+ movs r10, r10, lsr #28
+ adc r6, r10, lr, lsl #4 @ r6 = bits[59..28] of windowed x5
+
+ smull r10, lr, r12, r7 @ r10..lr = (window_l[6] * x[6])
+ ldr r12, =WL7 @ r12 = window_l[7]
+ movs r10, r10, lsr #28
+ adc r7, r10, lr, lsl #4 @ r7 = bits[59..28] of windowed x6
+
+ smull r10, lr, r12, r8 @ r10..lr = (window_l[7] * x[7])
+ ldr r12, =WL8 @ r12 = window_l[8]
+ movs r10, r10, lsr #28
+ adc r8, r10, lr, lsl #4 @ r8 = bits[59..28] of windowed x7
+
+ smull r10, lr, r12, r9 @ r10..lr = (window_l[8] * x[8])
+ movs r10, r10, lsr #28
+ adc r9, r10, lr, lsl #4 @ r9 = bits[59..28] of windowed x8
+
+ stmia r1, { r0, r2 - r9 } @ store windowed x[0] .. x[8]
+
+ cmp r11, #BLOCK_MODE_START
+ beq start_block_x18_to_x35
+
+
+ @----
+
+
+normal_block_x18_to_x35:
+
+ ldr r11, =WL3 @ r11 = window_l[3]
+ ldr r12, =WL4 @ r12 = window_l[4]
+
+ add r1, r1, #(18*4) @ r1 = &x[18]
+
+ ldmia r1!, { r0, r2 - r4, r6 - r10 } @ load 9 words from x18, update pointer
+
+ @ r0 = x18
+ @ r1 = &x[27]
+ @ r2 = x19
+ @ r3 = x20
+ @ r4 = x21
+ @ r5 = .
+ @ r6 = x22
+ @ r7 = x23
+ @ r8 = x24
+ @ r9 = x25
+ @ r10 = x26
+ @ r11 = window_l[3]
+ @ r12 = window_l[4]
+ @ lr = .
+
+ smull r5, lr, r12, r6 @ r5..lr = (window_l[4] * (x[22] == x[31]))
+ movs r5, r5, lsr #28
+ adc r5, r5, lr, lsl #4 @ r5 = bits[59..28] of windowed x31
+
+ smull r6, lr, r11, r4 @ r5..lr = (window_l[3] * (x[21] == x[32]))
+ ldr r12, =WL5 @ r12 = window_l[5]
+ movs r6, r6, lsr #28
+ adc r6, r6, lr, lsl #4 @ r6 = bits[59..28] of windowed x32
+
+ smull r4, lr, r12, r7 @ r4..lr = (window_l[5] * (x[23] == x[30]))
+ ldr r11, =WL1 @ r11 = window_l[1]
+ ldr r12, =WL2 @ r12 = window_l[2]
+ movs r4, r4, lsr #28
+ adc r4, r4, lr, lsl #4 @ r4 = bits[59..28] of windowed x30
+
+ smull r7, lr, r12, r3 @ r7..lr = (window_l[2] * (x[20] == x[33]))
+ ldr r12, =WL6 @ r12 = window_l[6]
+ movs r7, r7, lsr #28
+ adc r7, r7, lr, lsl #4 @ r7 = bits[59..28] of windowed x33
+
+ smull r3, lr, r12, r8 @ r3..lr = (window_l[6] * (x[24] == x[29]))
+ movs r3, r3, lsr #28
+ adc r3, r3, lr, lsl #4 @ r3 = bits[59..28] of windowed x29
+
+ smull r8, lr, r11, r2 @ r7..lr = (window_l[1] * (x[19] == x[34]))
+ ldr r12, =WL7 @ r12 = window_l[7]
+ ldr r11, =WL8 @ r11 = window_l[8]
+ movs r8, r8, lsr #28
+ adc r8, r8, lr, lsl #4 @ r8 = bits[59..28] of windowed x34
+
+ smull r2, lr, r12, r9 @ r7..lr = (window_l[7] * (x[25] == x[28]))
+ ldr r12, =WL0 @ r12 = window_l[0]
+ movs r2, r2, lsr #28
+ adc r2, r2, lr, lsl #4 @ r2 = bits[59..28] of windowed x28
+
+ smull r9, lr, r12, r0 @ r3..lr = (window_l[0] * (x[18] == x[35]))
+ movs r9, r9, lsr #28
+ adc r9, r9, lr, lsl #4 @ r9 = bits[59..28] of windowed x35
+
+ smull r0, lr, r11, r10 @ r7..lr = (window_l[8] * (x[26] == x[27]))
+ ldr r11, =WL16 @ r11 = window_l[16]
+ ldr r12, =WL17 @ r12 = window_l[17]
+ movs r0, r0, lsr #28
+ adc r0, r0, lr, lsl #4 @ r0 = bits[59..28] of windowed x27
+
+
+ stmia r1, { r0, r2 - r9 } @ store windowed x[27] .. x[35]
+ ldmdb r1!, { r0, r2 - r9 } @ load 9 words downto (and including) x18
+
+
+ smull r10, lr, r12, r0 @ r10..lr = (window_l[17] * x[18])
+ movs r10, r10, lsr #28
+ adc r0, r10, lr, lsl #4 @ r0 = bits[59..28] of windowed x0
+
+ smull r10, lr, r11, r2 @ r10..lr = (window_l[16] * x[19])
+ ldr r11, =WL14 @ r11 = window_l[14]
+ ldr r12, =WL15 @ r12 = window_l[15]
+ movs r10, r10, lsr #28
+ adc r2, r10, lr, lsl #4 @ r2 = bits[59..28] of windowed x1
+
+ smull r10, lr, r12, r3 @ r10..lr = (window_l[15] * x[20])
+ movs r10, r10, lsr #28
+ adc r3, r10, lr, lsl #4 @ r3 = bits[59..28] of windowed x2
+
+ smull r10, lr, r11, r4 @ r10..lr = (window_l[14] * x[21])
+ ldr r11, =WL12 @ r11 = window_l[12]
+ ldr r12, =WL13 @ r12 = window_l[13]
+ movs r10, r10, lsr #28
+ adc r4, r10, lr, lsl #4 @ r4 = bits[59..28] of windowed x3
+
+ smull r10, lr, r12, r5 @ r10..lr = (window_l[13] * x[22])
+ movs r10, r10, lsr #28
+ adc r5, r10, lr, lsl #4 @ r5 = bits[59..28] of windowed x4
+
+ smull r10, lr, r11, r6 @ r10..lr = (window_l[12] * x[23])
+ ldr r11, =WL10 @ r12 = window_l[10]
+ ldr r12, =WL11 @ r12 = window_l[11]
+ movs r10, r10, lsr #28
+ adc r6, r10, lr, lsl #4 @ r6 = bits[59..28] of windowed x5
+
+ smull r10, lr, r12, r7 @ r10..lr = (window_l[11] * x[24])
+ movs r10, r10, lsr #28
+ adc r7, r10, lr, lsl #4 @ r7 = bits[59..28] of windowed x6
+
+ smull r10, lr, r11, r8 @ r10..lr = (window_l[10] * x[25])
+ ldr r12, =WL9 @ r12 = window_l[9]
+ movs r10, r10, lsr #28
+ adc r8, r10, lr, lsl #4 @ r8 = bits[59..28] of windowed x7
+
+ smull r10, lr, r12, r9 @ r10..lr = (window_l[9] * x[26])
+
+ movs r10, r10, lsr #28
+ adc r9, r10, lr, lsl #4 @ r9 = bits[59..28] of windowed x8
+
+ stmia r1, { r0, r2 - r9 } @ store windowed x[18] .. x[26]
+
+ @----
+ @ NB there are 2 possible exits from this function - this is only one of them
+ @----
+
+ add sp, sp, #(21*4) @ return stack frame
+ ldmia sp!, { r4 - r11, pc } @ restore callee saved regs, and return
+
+ @----
+
+
+stop_block_x0_to_x17:
+
+ @ r0 = x0
+ @ r1 = &x[9]
+ @ r2 = x1
+ @ r3 = x2
+ @ r4 = x3
+ @ r5 = x4
+ @ r6 = x5
+ @ r7 = x6
+ @ r8 = x7
+ @ r9 = x8
+ @ r10 = -x0
+ @ r11 = window mode: (0 == normal), (1 == start block), (3 == stop block)
+ @ r12 = .
+ @ lr = .
+
+ rsb r0, r6, #0 @ r0 = -x5
+ rsb r6, r2, #0 @ r6 = -x1
+ rsb r2, r5, #0 @ r2 = -x4
+ rsb r5, r3, #0 @ r5 = -x2
+ rsb r3, r4, #0 @ r3 = -x3
+
+ add r1, r1, #(3*4) @ r1 = &x[12]
+ stmia r1, { r0, r2, r3, r5, r6, r10 } @ store unchanged x[12] .. x[17]
+
+ ldr r0, =WL1 @ r0 = window_l[1] == window_s[0]
+
+ rsb r10, r9, #0 @ r10 = -x8
+ rsb r12, r8, #0 @ r12 = -x7
+ rsb lr, r7, #0 @ lr = -x6
+
+ @ r0 = WL1
+ @ r1 = &x[12]
+ @ r2 = .
+ @ r3 = .
+ @ r4 = .
+ @ r5 = .
+ @ r6 = .
+ @ r7 = x6
+ @ r8 = x7
+ @ r9 = x8
+ @ r10 = -x8
+ @ r11 = window mode: (0 == normal), (1 == start block), (3 == stop block)
+ @ r12 = -x7
+ @ lr = -x6
+
+ smull r5, r6, r0, r7 @ r5..r6 = (window_l[1] * x[6])
+ ldr r2, =WL4 @ r2 = window_l[4] == window_s[1]
+ movs r5, r5, lsr #28
+ adc r7, r5, r6, lsl #4 @ r7 = bits[59..28] of windowed x6
+
+ smull r5, r6, r2, r8 @ r5..r6 = (window_l[4] * x[7])
+ ldr r3, =WL7 @ r3 = window_l[7] == window_s[2]
+ movs r5, r5, lsr #28
+ adc r8, r5, r6, lsl #4 @ r8 = bits[59..28] of windowed x7
+
+ smull r5, r6, r3, r9 @ r5..r6 = (window_l[7] * x[8])
+ ldr r4, =WL10 @ r4 = window_l[10] == window_s[3]
+ movs r5, r5, lsr #28
+ adc r9, r5, r6, lsl #4 @ r9 = bits[59..28] of windowed x8
+
+ smull r5, r6, r4, r10 @ r5..r6 = (window_l[10] * (x[9] == -x[8]))
+ ldr r0, =WL13 @ r0 = window_l[13] == window_s[4]
+ movs r5, r5, lsr #28
+ adc r10, r5, r6, lsl #4 @ r10 = bits[59..28] of windowed x9
+
+ smull r5, r6, r0, r12 @ r5..r6 = (window_l[13] * (x[10] == -x[7]))
+ ldr r2, =WL16 @ r2 = window_l[16] == window_s[5]
+ movs r5, r5, lsr #28
+ adc r12, r5, r6, lsl #4 @ r10 = bits[59..28] of windowed x9
+
+ smull r5, r6, r2, lr @ r5..r6 = (window_l[16] * (x[11] == -x[6]))
+
+ ldr r0, =0x00
+
+ movs r5, r5, lsr #28
+ adc lr, r5, r6, lsl #4 @ r10 = bits[59..28] of windowed x9
+
+ stmdb r1!, { r7 - r10, r12, lr } @ store windowed x[6] .. x[11]
+
+ ldr r5, =0x00
+ ldr r6, =0x00
+ ldr r2, =0x00
+ ldr r3, =0x00
+ ldr r4, =0x00
+
+ stmdb r1!, { r0, r2 - r6 } @ store windowed x[0] .. x[5]
+
+ b normal_block_x18_to_x35
+
+
+ @----
+
+
+start_block_x18_to_x35:
+
+ ldr r4, =WL1 @ r0 = window_l[1] == window_s[0]
+
+ add r1, r1, #(24*4) @ r1 = &x[24]
+
+ ldmia r1, { r0, r2, r3 } @ load 3 words from x24, dont update pointer
+
+ @ r0 = x24
+ @ r1 = &x[24]
+ @ r2 = x25
+ @ r3 = x26
+ @ r4 = WL1
+ @ r5 = WL4
+ @ r6 = WL7
+ @ r7 = WL10
+ @ r8 = WL13
+ @ r9 = WL16
+ @ r10 = .
+ @ r11 = .
+ @ r12 = .
+ @ lr = .
+
+ ldr r5, =WL4 @ r5 = window_l[4] == window_s[1]
+
+ smull r10, r11, r4, r0 @ r10..r11 = (window_l[1] * (x[24] == x[29]))
+ ldr r6, =WL7 @ r6 = window_l[7] == window_s[2]
+ movs r10, r10, lsr #28
+ adc lr, r10, r11, lsl #4 @ lr = bits[59..28] of windowed x29
+
+ smull r10, r11, r5, r2 @ r10..r11 = (window_l[4] * (x[25] == x[28]))
+ ldr r7, =WL10 @ r7 = window_l[10] == window_s[3]
+ movs r10, r10, lsr #28
+ adc r12, r10, r11, lsl #4 @ r12 = bits[59..28] of windowed x28
+
+ smull r10, r11, r6, r3 @ r10..r11 = (window_l[7] * (x[26] == x[27]))
+ ldr r8, =WL13 @ r8 = window_l[13] == window_s[4]
+ movs r10, r10, lsr #28
+ adc r4, r10, r11, lsl #4 @ r4 = bits[59..28] of windowed x27
+
+ smull r10, r11, r7, r3 @ r10..r11 = (window_l[10] * x[26])
+ ldr r9, =WL16 @ r9 = window_l[16] == window_s[5]
+ movs r10, r10, lsr #28
+ adc r3, r10, r11, lsl #4 @ r3 = bits[59..28] of windowed x26
+
+ smull r10, r11, r8, r2 @ r10..r11 = (window_l[13] * x[25])
+ ldr r5, =0x00
+ movs r10, r10, lsr #28
+ adc r2, r10, r11, lsl #4 @ r2 = bits[59..28] of windowed x25
+
+ smull r10, r11, r9, r0 @ r10..r11 = (window_l[16] * x[24])
+ ldr r6, =0x00
+ movs r10, r10, lsr #28
+ adc r0, r10, r11, lsl #4 @ r0 = bits[59..28] of windowed x24
+
+ stmia r1!, { r0, r2, r3, r4, r12, lr } @ store windowed x[24] .. x[29]
+
+ ldr r7, =0x00
+ ldr r8, =0x00
+ ldr r9, =0x00
+ ldr r10, =0x00
+
+ stmia r1!, { r5 - r10 } @ store windowed x[30] .. x[35]
+
+ @----
+ @ NB there are 2 possible exits from this function - this is only one of them
+ @----
+
+ add sp, sp, #(21*4) @ return stack frame
+ ldmia sp!, { r4 - r11, pc } @ restore callee saved regs, and return
+
+ @----
+ @END
+ @----
+
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/imdct_s.dat b/src/filters/transform/mpadecfilter/libmad-0.15.0b/imdct_s.dat
new file mode 100644
index 000000000..ed3ad77f0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/imdct_s.dat
@@ -0,0 +1,62 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: imdct_s.dat,v 1.7 2003/05/27 22:40:36 rob Exp $
+ */
+
+ /* 0 */ { MAD_F(0x09bd7ca0) /* 0.608761429 */,
+ -MAD_F(0x0ec835e8) /* -0.923879533 */,
+ -MAD_F(0x0216a2a2) /* -0.130526192 */,
+ MAD_F(0x0fdcf549) /* 0.991444861 */,
+ -MAD_F(0x061f78aa) /* -0.382683432 */,
+ -MAD_F(0x0cb19346) /* -0.793353340 */ },
+
+ /* 6 */ { -MAD_F(0x0cb19346) /* -0.793353340 */,
+ MAD_F(0x061f78aa) /* 0.382683432 */,
+ MAD_F(0x0fdcf549) /* 0.991444861 */,
+ MAD_F(0x0216a2a2) /* 0.130526192 */,
+ -MAD_F(0x0ec835e8) /* -0.923879533 */,
+ -MAD_F(0x09bd7ca0) /* -0.608761429 */ },
+
+ /* 1 */ { MAD_F(0x061f78aa) /* 0.382683432 */,
+ -MAD_F(0x0ec835e8) /* -0.923879533 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */,
+ -MAD_F(0x061f78aa) /* -0.382683432 */,
+ -MAD_F(0x061f78aa) /* -0.382683432 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */ },
+
+ /* 7 */ { -MAD_F(0x0ec835e8) /* -0.923879533 */,
+ -MAD_F(0x061f78aa) /* -0.382683432 */,
+ MAD_F(0x061f78aa) /* 0.382683432 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */,
+ MAD_F(0x061f78aa) /* 0.382683432 */ },
+
+ /* 2 */ { MAD_F(0x0216a2a2) /* 0.130526192 */,
+ -MAD_F(0x061f78aa) /* -0.382683432 */,
+ MAD_F(0x09bd7ca0) /* 0.608761429 */,
+ -MAD_F(0x0cb19346) /* -0.793353340 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */,
+ -MAD_F(0x0fdcf549) /* -0.991444861 */ },
+
+ /* 8 */ { -MAD_F(0x0fdcf549) /* -0.991444861 */,
+ -MAD_F(0x0ec835e8) /* -0.923879533 */,
+ -MAD_F(0x0cb19346) /* -0.793353340 */,
+ -MAD_F(0x09bd7ca0) /* -0.608761429 */,
+ -MAD_F(0x061f78aa) /* -0.382683432 */,
+ -MAD_F(0x0216a2a2) /* -0.130526192 */ }
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/install-sh b/src/filters/transform/mpadecfilter/libmad-0.15.0b/install-sh
new file mode 100644
index 000000000..2137f0f8a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/install-sh
@@ -0,0 +1,276 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd=$cpprog
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "$0: no input file specified" >&2
+ exit 1
+else
+ :
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d "$dst" ]; then
+ instcmd=:
+ chmodcmd=""
+ else
+ instcmd=$mkdirprog
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f "$src" ] || [ -d "$src" ]
+ then
+ :
+ else
+ echo "$0: $src does not exist" >&2
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "$0: no destination specified" >&2
+ exit 1
+ else
+ :
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d "$dst" ]
+ then
+ dst=$dst/`basename "$src"`
+ else
+ :
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+ '
+IFS="${IFS-$defaultIFS}"
+
+oIFS=$IFS
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS=$oIFS
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp=$pathcomp$1
+ shift
+
+ if [ ! -d "$pathcomp" ] ;
+ then
+ $mkdirprog "$pathcomp"
+ else
+ :
+ fi
+
+ pathcomp=$pathcomp/
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd "$dst" &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename "$dst"`
+ else
+ dstfile=`basename "$dst" $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename "$dst"`
+ else
+ :
+ fi
+
+# Make a couple of temp file names in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+ rmtmp=$dstdir/#rm.$$#
+
+# Trap to clean up temp files at exit.
+
+ trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+ trap '(exit $?); exit' 1 2 13 15
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd "$src" "$dsttmp" &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
+
+# Now remove or move aside any old file at destination location. We try this
+# two ways since rm can't unlink itself on some systems and the destination
+# file might be busy for other reasons. In this case, the final cleanup
+# might fail but the new file should still install successfully.
+
+{
+ if [ -f "$dstdir/$dstfile" ]
+ then
+ $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
+ $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
+ {
+ echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+ (exit 1); exit
+ }
+ else
+ :
+ fi
+} &&
+
+# Now rename the file to the real destination.
+
+ $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+
+fi &&
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+
+{
+ (exit 0); exit
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer12.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer12.c
new file mode 100644
index 000000000..5b5d411ed
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer12.c
@@ -0,0 +1,510 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: layer12.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# ifdef HAVE_LIMITS_H
+# include <limits.h>
+# else
+# define CHAR_BIT 8
+# endif
+
+# include "fixed.h"
+# include "bit.h"
+# include "stream.h"
+# include "frame.h"
+# include "layer12.h"
+
+/*
+ * scalefactor table
+ * used in both Layer I and Layer II decoding
+ */
+static
+mad_fixed_t const sf_table[64] = {
+# include "sf_table.dat"
+};
+
+/* --- Layer I ------------------------------------------------------------- */
+
+/* linear scaling table */
+static
+mad_fixed_t const linear_table[14] = {
+ MAD_F(0x15555555), /* 2^2 / (2^2 - 1) == 1.33333333333333 */
+ MAD_F(0x12492492), /* 2^3 / (2^3 - 1) == 1.14285714285714 */
+ MAD_F(0x11111111), /* 2^4 / (2^4 - 1) == 1.06666666666667 */
+ MAD_F(0x10842108), /* 2^5 / (2^5 - 1) == 1.03225806451613 */
+ MAD_F(0x10410410), /* 2^6 / (2^6 - 1) == 1.01587301587302 */
+ MAD_F(0x10204081), /* 2^7 / (2^7 - 1) == 1.00787401574803 */
+ MAD_F(0x10101010), /* 2^8 / (2^8 - 1) == 1.00392156862745 */
+ MAD_F(0x10080402), /* 2^9 / (2^9 - 1) == 1.00195694716243 */
+ MAD_F(0x10040100), /* 2^10 / (2^10 - 1) == 1.00097751710655 */
+ MAD_F(0x10020040), /* 2^11 / (2^11 - 1) == 1.00048851978505 */
+ MAD_F(0x10010010), /* 2^12 / (2^12 - 1) == 1.00024420024420 */
+ MAD_F(0x10008004), /* 2^13 / (2^13 - 1) == 1.00012208521548 */
+ MAD_F(0x10004001), /* 2^14 / (2^14 - 1) == 1.00006103888177 */
+ MAD_F(0x10002000) /* 2^15 / (2^15 - 1) == 1.00003051850948 */
+};
+
+/*
+ * NAME: I_sample()
+ * DESCRIPTION: decode one requantized Layer I sample from a bitstream
+ */
+static
+mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb)
+{
+ mad_fixed_t sample;
+
+ sample = mad_bit_read(ptr, nb);
+
+ /* invert most significant bit, extend sign, then scale to fixed format */
+
+ sample ^= 1 << (nb - 1);
+ sample |= -(sample & (1 << (nb - 1)));
+
+ sample <<= MAD_F_FRACBITS - (nb - 1);
+
+ /* requantize the sample */
+
+ /* s'' = (2^nb / (2^nb - 1)) * (s''' + 2^(-nb + 1)) */
+
+ sample += MAD_F_ONE >> (nb - 1);
+
+ return mad_f_mul(sample, linear_table[nb - 2]);
+
+ /* s' = factor * s'' */
+ /* (to be performed by caller) */
+}
+
+/*
+ * NAME: layer->I()
+ * DESCRIPTION: decode a single Layer I frame
+ */
+int mad_layer_I(struct mad_stream *stream, struct mad_frame *frame)
+{
+ struct mad_header *header = &frame->header;
+ unsigned int nch, bound, ch, s, sb, nb;
+ unsigned char allocation[2][32], scalefactor[2][32];
+
+ nch = MAD_NCHANNELS(header);
+
+ bound = 32;
+ if (header->mode == MAD_MODE_JOINT_STEREO) {
+ header->flags |= MAD_FLAG_I_STEREO;
+ bound = 4 + header->mode_extension * 4;
+ }
+
+ /* check CRC word */
+
+ if (header->flags & MAD_FLAG_PROTECTION) {
+ header->crc_check =
+ mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)),
+ header->crc_check);
+
+ if (header->crc_check != header->crc_target &&
+ !(frame->options & MAD_OPTION_IGNORECRC)) {
+ stream->error = MAD_ERROR_BADCRC;
+ return -1;
+ }
+ }
+
+ /* decode bit allocations */
+
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ nb = mad_bit_read(&stream->ptr, 4);
+
+ if (nb == 15) {
+ stream->error = MAD_ERROR_BADBITALLOC;
+ return -1;
+ }
+
+ allocation[ch][sb] = nb ? nb + 1 : 0;
+ }
+ }
+
+ for (sb = bound; sb < 32; ++sb) {
+ nb = mad_bit_read(&stream->ptr, 4);
+
+ if (nb == 15) {
+ stream->error = MAD_ERROR_BADBITALLOC;
+ return -1;
+ }
+
+ allocation[0][sb] =
+ allocation[1][sb] = nb ? nb + 1 : 0;
+ }
+
+ /* decode scalefactors */
+
+ for (sb = 0; sb < 32; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb]) {
+ scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6);
+
+# if defined(OPT_STRICT)
+ /*
+ * Scalefactor index 63 does not appear in Table B.1 of
+ * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
+ * so we only reject it if OPT_STRICT is defined.
+ */
+ if (scalefactor[ch][sb] == 63) {
+ stream->error = MAD_ERROR_BADSCALEFACTOR;
+ return -1;
+ }
+# endif
+ }
+ }
+ }
+
+ /* decode samples */
+
+ for (s = 0; s < 12; ++s) {
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ nb = allocation[ch][sb];
+ frame->sbsample[ch][s][sb] = nb ?
+ mad_f_mul(I_sample(&stream->ptr, nb),
+ sf_table[scalefactor[ch][sb]]) : 0;
+ }
+ }
+
+ for (sb = bound; sb < 32; ++sb) {
+ if ((nb = allocation[0][sb])) {
+ mad_fixed_t sample;
+
+ sample = I_sample(&stream->ptr, nb);
+
+ for (ch = 0; ch < nch; ++ch) {
+ frame->sbsample[ch][s][sb] =
+ mad_f_mul(sample, sf_table[scalefactor[ch][sb]]);
+ }
+ }
+ else {
+ for (ch = 0; ch < nch; ++ch)
+ frame->sbsample[ch][s][sb] = 0;
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* --- Layer II ------------------------------------------------------------ */
+
+/* possible quantization per subband table */
+static
+struct {
+ unsigned int sblimit;
+ unsigned char const offsets[30];
+} const sbquant_table[5] = {
+ /* ISO/IEC 11172-3 Table B.2a */
+ { 27, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 0 */
+ 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0 } },
+ /* ISO/IEC 11172-3 Table B.2b */
+ { 30, { 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, /* 1 */
+ 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0 } },
+ /* ISO/IEC 11172-3 Table B.2c */
+ { 8, { 5, 5, 2, 2, 2, 2, 2, 2 } }, /* 2 */
+ /* ISO/IEC 11172-3 Table B.2d */
+ { 12, { 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 } }, /* 3 */
+ /* ISO/IEC 13818-3 Table B.1 */
+ { 30, { 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, /* 4 */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }
+};
+
+/* bit allocation table */
+static
+struct {
+ unsigned short nbal;
+ unsigned short offset;
+} const bitalloc_table[8] = {
+ { 2, 0 }, /* 0 */
+ { 2, 3 }, /* 1 */
+ { 3, 3 }, /* 2 */
+ { 3, 1 }, /* 3 */
+ { 4, 2 }, /* 4 */
+ { 4, 3 }, /* 5 */
+ { 4, 4 }, /* 6 */
+ { 4, 5 } /* 7 */
+};
+
+/* offsets into quantization class table */
+static
+unsigned char const offset_table[6][15] = {
+ { 0, 1, 16 }, /* 0 */
+ { 0, 1, 2, 3, 4, 5, 16 }, /* 1 */
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 }, /* 2 */
+ { 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, /* 3 */
+ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16 }, /* 4 */
+ { 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 } /* 5 */
+};
+
+/* quantization class table */
+static
+struct quantclass {
+ unsigned short nlevels;
+ unsigned char group;
+ unsigned char bits;
+ mad_fixed_t C;
+ mad_fixed_t D;
+} const qc_table[17] = {
+# include "qc_table.dat"
+};
+
+/*
+ * NAME: II_samples()
+ * DESCRIPTION: decode three requantized Layer II samples from a bitstream
+ */
+static
+void II_samples(struct mad_bitptr *ptr,
+ struct quantclass const *quantclass,
+ mad_fixed_t output[3])
+{
+ unsigned int nb, s, sample[3];
+
+ if ((nb = quantclass->group)) {
+ unsigned int c, nlevels;
+
+ /* degrouping */
+ c = mad_bit_read(ptr, quantclass->bits);
+ nlevels = quantclass->nlevels;
+
+ for (s = 0; s < 3; ++s) {
+ sample[s] = c % nlevels;
+ c /= nlevels;
+ }
+ }
+ else {
+ nb = quantclass->bits;
+
+ for (s = 0; s < 3; ++s)
+ sample[s] = mad_bit_read(ptr, nb);
+ }
+
+ for (s = 0; s < 3; ++s) {
+ mad_fixed_t requantized;
+
+ /* invert most significant bit, extend sign, then scale to fixed format */
+
+ requantized = sample[s] ^ (1 << (nb - 1));
+ requantized |= -(requantized & (1 << (nb - 1)));
+
+ requantized <<= MAD_F_FRACBITS - (nb - 1);
+
+ /* requantize the sample */
+
+ /* s'' = C * (s''' + D) */
+
+ output[s] = mad_f_mul(requantized + quantclass->D, quantclass->C);
+
+ /* s' = factor * s'' */
+ /* (to be performed by caller) */
+ }
+}
+
+/*
+ * NAME: layer->II()
+ * DESCRIPTION: decode a single Layer II frame
+ */
+int mad_layer_II(struct mad_stream *stream, struct mad_frame *frame)
+{
+ struct mad_header *header = &frame->header;
+ struct mad_bitptr start;
+ unsigned int index, sblimit, nbal, nch, bound, gr, ch, s, sb;
+ unsigned char const *offsets;
+ unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3];
+ mad_fixed_t samples[3];
+
+ nch = MAD_NCHANNELS(header);
+
+ if (header->flags & MAD_FLAG_LSF_EXT)
+ index = 4;
+ else {
+ switch (nch == 2 ? header->bitrate / 2 : header->bitrate) {
+ case 32000:
+ case 48000:
+ index = (header->samplerate == 32000) ? 3 : 2;
+ break;
+
+ case 56000:
+ case 64000:
+ case 80000:
+ index = 0;
+ break;
+
+ default:
+ index = (header->samplerate == 48000) ? 0 : 1;
+ }
+ }
+
+ sblimit = sbquant_table[index].sblimit;
+ offsets = sbquant_table[index].offsets;
+
+ bound = 32;
+ if (header->mode == MAD_MODE_JOINT_STEREO) {
+ header->flags |= MAD_FLAG_I_STEREO;
+ bound = 4 + header->mode_extension * 4;
+ }
+
+ if (bound > sblimit)
+ bound = sblimit;
+
+ start = stream->ptr;
+
+ /* decode bit allocations */
+
+ for (sb = 0; sb < bound; ++sb) {
+ nbal = bitalloc_table[offsets[sb]].nbal;
+
+ for (ch = 0; ch < nch; ++ch)
+ allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal);
+ }
+
+ for (sb = bound; sb < sblimit; ++sb) {
+ nbal = bitalloc_table[offsets[sb]].nbal;
+
+ allocation[0][sb] =
+ allocation[1][sb] = mad_bit_read(&stream->ptr, nbal);
+ }
+
+ /* decode scalefactor selection info */
+
+ for (sb = 0; sb < sblimit; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb])
+ scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2);
+ }
+ }
+
+ /* check CRC word */
+
+ if (header->flags & MAD_FLAG_PROTECTION) {
+ header->crc_check =
+ mad_bit_crc(start, mad_bit_length(&start, &stream->ptr),
+ header->crc_check);
+
+ if (header->crc_check != header->crc_target &&
+ !(frame->options & MAD_OPTION_IGNORECRC)) {
+ stream->error = MAD_ERROR_BADCRC;
+ return -1;
+ }
+ }
+
+ /* decode scalefactors */
+
+ for (sb = 0; sb < sblimit; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb]) {
+ scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6);
+
+ switch (scfsi[ch][sb]) {
+ case 2:
+ scalefactor[ch][sb][2] =
+ scalefactor[ch][sb][1] =
+ scalefactor[ch][sb][0];
+ break;
+
+ case 0:
+ scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6);
+ /* fall through */
+
+ case 1:
+ case 3:
+ scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6);
+ }
+
+ if (scfsi[ch][sb] & 1)
+ scalefactor[ch][sb][1] = scalefactor[ch][sb][scfsi[ch][sb] - 1];
+
+# if defined(OPT_STRICT)
+ /*
+ * Scalefactor index 63 does not appear in Table B.1 of
+ * ISO/IEC 11172-3. Nonetheless, other implementations accept it,
+ * so we only reject it if OPT_STRICT is defined.
+ */
+ if (scalefactor[ch][sb][0] == 63 ||
+ scalefactor[ch][sb][1] == 63 ||
+ scalefactor[ch][sb][2] == 63) {
+ stream->error = MAD_ERROR_BADSCALEFACTOR;
+ return -1;
+ }
+# endif
+ }
+ }
+ }
+
+ /* decode samples */
+
+ for (gr = 0; gr < 12; ++gr) {
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if ((index = allocation[ch][sb])) {
+ index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
+
+ II_samples(&stream->ptr, &qc_table[index], samples);
+
+ for (s = 0; s < 3; ++s) {
+ frame->sbsample[ch][3 * gr + s][sb] =
+ mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
+ }
+ }
+ else {
+ for (s = 0; s < 3; ++s)
+ frame->sbsample[ch][3 * gr + s][sb] = 0;
+ }
+ }
+ }
+
+ for (sb = bound; sb < sblimit; ++sb) {
+ if ((index = allocation[0][sb])) {
+ index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
+
+ II_samples(&stream->ptr, &qc_table[index], samples);
+
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s) {
+ frame->sbsample[ch][3 * gr + s][sb] =
+ mad_f_mul(samples[s], sf_table[scalefactor[ch][sb][gr / 4]]);
+ }
+ }
+ }
+ else {
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s)
+ frame->sbsample[ch][3 * gr + s][sb] = 0;
+ }
+ }
+ }
+
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s) {
+ for (sb = sblimit; sb < 32; ++sb)
+ frame->sbsample[ch][3 * gr + s][sb] = 0;
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer12.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer12.h
new file mode 100644
index 000000000..f16753aa9
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer12.h
@@ -0,0 +1,31 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: layer12.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_LAYER12_H
+# define LIBMAD_LAYER12_H
+
+# include "stream.h"
+# include "frame.h"
+
+int mad_layer_I(struct mad_stream *, struct mad_frame *);
+int mad_layer_II(struct mad_stream *, struct mad_frame *);
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer3.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer3.c
new file mode 100644
index 000000000..2e7554e1c
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer3.c
@@ -0,0 +1,2502 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: layer3.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# include <stdlib.h>
+# include <string.h>
+
+# ifdef HAVE_ASSERT_H
+# include <assert.h>
+# endif
+
+# ifdef HAVE_LIMITS_H
+# include <limits.h>
+# else
+# define CHAR_BIT 8
+# endif
+
+# include "fixed.h"
+# include "bit.h"
+# include "stream.h"
+# include "frame.h"
+# include "huffman.h"
+# include "layer3.h"
+
+/* --- Layer III ----------------------------------------------------------- */
+
+enum {
+ count1table_select = 0x01,
+ scalefac_scale = 0x02,
+ preflag = 0x04,
+ mixed_block_flag = 0x08
+};
+
+enum {
+ I_STEREO = 0x1,
+ MS_STEREO = 0x2
+};
+
+struct sideinfo {
+ unsigned int main_data_begin;
+ unsigned int private_bits;
+
+ unsigned char scfsi[2];
+
+ struct granule {
+ struct channel {
+ /* from side info */
+ unsigned short part2_3_length;
+ unsigned short big_values;
+ unsigned short global_gain;
+ unsigned short scalefac_compress;
+
+ unsigned char flags;
+ unsigned char block_type;
+ unsigned char table_select[3];
+ unsigned char subblock_gain[3];
+ unsigned char region0_count;
+ unsigned char region1_count;
+
+ /* from main_data */
+ unsigned char scalefac[39]; /* scalefac_l and/or scalefac_s */
+ } ch[2];
+ } gr[2];
+};
+
+/*
+ * scalefactor bit lengths
+ * derived from section 2.4.2.7 of ISO/IEC 11172-3
+ */
+static
+struct {
+ unsigned char slen1;
+ unsigned char slen2;
+} const sflen_table[16] = {
+ { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, 3 },
+ { 3, 0 }, { 1, 1 }, { 1, 2 }, { 1, 3 },
+ { 2, 1 }, { 2, 2 }, { 2, 3 }, { 3, 1 },
+ { 3, 2 }, { 3, 3 }, { 4, 2 }, { 4, 3 }
+};
+
+/*
+ * number of LSF scalefactor band values
+ * derived from section 2.4.3.2 of ISO/IEC 13818-3
+ */
+static
+unsigned char const nsfb_table[6][3][4] = {
+ { { 6, 5, 5, 5 },
+ { 9, 9, 9, 9 },
+ { 6, 9, 9, 9 } },
+
+ { { 6, 5, 7, 3 },
+ { 9, 9, 12, 6 },
+ { 6, 9, 12, 6 } },
+
+ { { 11, 10, 0, 0 },
+ { 18, 18, 0, 0 },
+ { 15, 18, 0, 0 } },
+
+ { { 7, 7, 7, 0 },
+ { 12, 12, 12, 0 },
+ { 6, 15, 12, 0 } },
+
+ { { 6, 6, 6, 3 },
+ { 12, 9, 9, 6 },
+ { 6, 12, 9, 6 } },
+
+ { { 8, 8, 5, 0 },
+ { 15, 12, 9, 0 },
+ { 6, 18, 9, 0 } }
+};
+
+/*
+ * MPEG-1 scalefactor band widths
+ * derived from Table B.8 of ISO/IEC 11172-3
+ */
+static
+unsigned char const sfb_48000_long[] = {
+ 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10,
+ 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192
+};
+
+static
+unsigned char const sfb_44100_long[] = {
+ 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10,
+ 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158
+};
+
+static
+unsigned char const sfb_32000_long[] = {
+ 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12,
+ 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26
+};
+
+static
+unsigned char const sfb_48000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
+ 6, 6, 6, 6, 6, 10, 10, 10, 12, 12, 12, 14, 14,
+ 14, 16, 16, 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
+};
+
+static
+unsigned char const sfb_44100_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
+ 6, 6, 8, 8, 8, 10, 10, 10, 12, 12, 12, 14, 14,
+ 14, 18, 18, 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
+};
+
+static
+unsigned char const sfb_32000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6,
+ 6, 6, 8, 8, 8, 12, 12, 12, 16, 16, 16, 20, 20,
+ 20, 26, 26, 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
+};
+
+static
+unsigned char const sfb_48000_mixed[] = {
+ /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
+ /* short */ 4, 4, 4, 6, 6, 6, 6, 6, 6, 10,
+ 10, 10, 12, 12, 12, 14, 14, 14, 16, 16,
+ 16, 20, 20, 20, 26, 26, 26, 66, 66, 66
+};
+
+static
+unsigned char const sfb_44100_mixed[] = {
+ /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
+ /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 10,
+ 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
+ 18, 22, 22, 22, 30, 30, 30, 56, 56, 56
+};
+
+static
+unsigned char const sfb_32000_mixed[] = {
+ /* long */ 4, 4, 4, 4, 4, 4, 6, 6,
+ /* short */ 4, 4, 4, 6, 6, 6, 8, 8, 8, 12,
+ 12, 12, 16, 16, 16, 20, 20, 20, 26, 26,
+ 26, 34, 34, 34, 42, 42, 42, 12, 12, 12
+};
+
+/*
+ * MPEG-2 scalefactor band widths
+ * derived from Table B.2 of ISO/IEC 13818-3
+ */
+static
+unsigned char const sfb_24000_long[] = {
+ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
+ 18, 22, 26, 32, 38, 46, 54, 62, 70, 76, 36
+};
+
+static
+unsigned char const sfb_22050_long[] = {
+ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16,
+ 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54
+};
+
+# define sfb_16000_long sfb_22050_long
+
+static
+unsigned char const sfb_24000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
+ 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
+ 18, 24, 24, 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
+};
+
+static
+unsigned char const sfb_22050_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6,
+ 6, 6, 8, 8, 8, 10, 10, 10, 14, 14, 14, 18, 18,
+ 18, 26, 26, 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
+};
+
+static
+unsigned char const sfb_16000_short[] = {
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 8,
+ 8, 8, 10, 10, 10, 12, 12, 12, 14, 14, 14, 18, 18,
+ 18, 24, 24, 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
+};
+
+static
+unsigned char const sfb_24000_mixed[] = {
+ /* long */ 6, 6, 6, 6, 6, 6,
+ /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
+ 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
+ 24, 32, 32, 32, 44, 44, 44, 12, 12, 12
+};
+
+static
+unsigned char const sfb_22050_mixed[] = {
+ /* long */ 6, 6, 6, 6, 6, 6,
+ /* short */ 6, 6, 6, 6, 6, 6, 8, 8, 8, 10,
+ 10, 10, 14, 14, 14, 18, 18, 18, 26, 26,
+ 26, 32, 32, 32, 42, 42, 42, 18, 18, 18
+};
+
+static
+unsigned char const sfb_16000_mixed[] = {
+ /* long */ 6, 6, 6, 6, 6, 6,
+ /* short */ 6, 6, 6, 8, 8, 8, 10, 10, 10, 12,
+ 12, 12, 14, 14, 14, 18, 18, 18, 24, 24,
+ 24, 30, 30, 30, 40, 40, 40, 18, 18, 18
+};
+
+/*
+ * MPEG 2.5 scalefactor band widths
+ * derived from public sources
+ */
+# define sfb_12000_long sfb_16000_long
+# define sfb_11025_long sfb_12000_long
+
+static
+unsigned char const sfb_8000_long[] = {
+ 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32,
+ 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2
+};
+
+# define sfb_12000_short sfb_16000_short
+# define sfb_11025_short sfb_12000_short
+
+static
+unsigned char const sfb_8000_short[] = {
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 12, 12, 16,
+ 16, 16, 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36,
+ 36, 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
+};
+
+# define sfb_12000_mixed sfb_16000_mixed
+# define sfb_11025_mixed sfb_12000_mixed
+
+/* the 8000 Hz short block scalefactor bands do not break after
+ the first 36 frequency lines, so this is probably wrong */
+static
+unsigned char const sfb_8000_mixed[] = {
+ /* long */ 12, 12, 12,
+ /* short */ 4, 4, 4, 8, 8, 8, 12, 12, 12, 16, 16, 16,
+ 20, 20, 20, 24, 24, 24, 28, 28, 28, 36, 36, 36,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 26, 26, 26
+};
+
+static
+struct {
+ unsigned char const *l;
+ unsigned char const *s;
+ unsigned char const *m;
+} const sfbwidth_table[9] = {
+ { sfb_48000_long, sfb_48000_short, sfb_48000_mixed },
+ { sfb_44100_long, sfb_44100_short, sfb_44100_mixed },
+ { sfb_32000_long, sfb_32000_short, sfb_32000_mixed },
+ { sfb_24000_long, sfb_24000_short, sfb_24000_mixed },
+ { sfb_22050_long, sfb_22050_short, sfb_22050_mixed },
+ { sfb_16000_long, sfb_16000_short, sfb_16000_mixed },
+ { sfb_12000_long, sfb_12000_short, sfb_12000_mixed },
+ { sfb_11025_long, sfb_11025_short, sfb_11025_mixed },
+ { sfb_8000_long, sfb_8000_short, sfb_8000_mixed }
+};
+
+/*
+ * scalefactor band preemphasis (used only when preflag is set)
+ * derived from Table B.6 of ISO/IEC 11172-3
+ */
+static
+unsigned char const pretab[22] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0
+};
+
+/*
+ * table for requantization
+ *
+ * rq_table[x].mantissa * 2^(rq_table[x].exponent) = x^(4/3)
+ */
+static
+struct fixedfloat {
+ unsigned long mantissa : 27;
+ unsigned short exponent : 5;
+} const rq_table[8207] = {
+# include "rq_table.dat"
+};
+
+/*
+ * fractional powers of two
+ * used for requantization and joint stereo decoding
+ *
+ * root_table[3 + x] = 2^(x/4)
+ */
+static
+mad_fixed_t const root_table[7] = {
+ MAD_F(0x09837f05) /* 2^(-3/4) == 0.59460355750136 */,
+ MAD_F(0x0b504f33) /* 2^(-2/4) == 0.70710678118655 */,
+ MAD_F(0x0d744fcd) /* 2^(-1/4) == 0.84089641525371 */,
+ MAD_F(0x10000000) /* 2^( 0/4) == 1.00000000000000 */,
+ MAD_F(0x1306fe0a) /* 2^(+1/4) == 1.18920711500272 */,
+ MAD_F(0x16a09e66) /* 2^(+2/4) == 1.41421356237310 */,
+ MAD_F(0x1ae89f99) /* 2^(+3/4) == 1.68179283050743 */
+};
+
+/*
+ * coefficients for aliasing reduction
+ * derived from Table B.9 of ISO/IEC 11172-3
+ *
+ * c[] = { -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037 }
+ * cs[i] = 1 / sqrt(1 + c[i]^2)
+ * ca[i] = c[i] / sqrt(1 + c[i]^2)
+ */
+static
+mad_fixed_t const cs[8] = {
+ +MAD_F(0x0db84a81) /* +0.857492926 */, +MAD_F(0x0e1b9d7f) /* +0.881741997 */,
+ +MAD_F(0x0f31adcf) /* +0.949628649 */, +MAD_F(0x0fbba815) /* +0.983314592 */,
+ +MAD_F(0x0feda417) /* +0.995517816 */, +MAD_F(0x0ffc8fc8) /* +0.999160558 */,
+ +MAD_F(0x0fff964c) /* +0.999899195 */, +MAD_F(0x0ffff8d3) /* +0.999993155 */
+};
+
+static
+mad_fixed_t const ca[8] = {
+ -MAD_F(0x083b5fe7) /* -0.514495755 */, -MAD_F(0x078c36d2) /* -0.471731969 */,
+ -MAD_F(0x05039814) /* -0.313377454 */, -MAD_F(0x02e91dd1) /* -0.181913200 */,
+ -MAD_F(0x0183603a) /* -0.094574193 */, -MAD_F(0x00a7cb87) /* -0.040965583 */,
+ -MAD_F(0x003a2847) /* -0.014198569 */, -MAD_F(0x000f27b4) /* -0.003699975 */
+};
+
+/*
+ * IMDCT coefficients for short blocks
+ * derived from section 2.4.3.4.10.2 of ISO/IEC 11172-3
+ *
+ * imdct_s[i/even][k] = cos((PI / 24) * (2 * (i / 2) + 7) * (2 * k + 1))
+ * imdct_s[i /odd][k] = cos((PI / 24) * (2 * (6 + (i-1)/2) + 7) * (2 * k + 1))
+ */
+static
+mad_fixed_t const imdct_s[6][6] = {
+# include "imdct_s.dat"
+};
+
+# if !defined(ASO_IMDCT)
+/*
+ * windowing coefficients for long blocks
+ * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3
+ *
+ * window_l[i] = sin((PI / 36) * (i + 1/2))
+ */
+static
+mad_fixed_t const window_l[36] = {
+ MAD_F(0x00b2aa3e) /* 0.043619387 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
+ MAD_F(0x03768962) /* 0.216439614 */, MAD_F(0x04cfb0e2) /* 0.300705800 */,
+ MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x07635284) /* 0.461748613 */,
+ MAD_F(0x0898c779) /* 0.537299608 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
+ MAD_F(0x0acf37ad) /* 0.675590208 */, MAD_F(0x0bcbe352) /* 0.737277337 */,
+ MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x0d7e8807) /* 0.843391446 */,
+
+ MAD_F(0x0e313245) /* 0.887010833 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
+ MAD_F(0x0f426cb5) /* 0.953716951 */, MAD_F(0x0f9ee890) /* 0.976296007 */,
+ MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ffc19fd) /* 0.999048222 */,
+ MAD_F(0x0ffc19fd) /* 0.999048222 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
+ MAD_F(0x0f9ee890) /* 0.976296007 */, MAD_F(0x0f426cb5) /* 0.953716951 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0e313245) /* 0.887010833 */,
+
+ MAD_F(0x0d7e8807) /* 0.843391446 */, MAD_F(0x0cb19346) /* 0.793353340 */,
+ MAD_F(0x0bcbe352) /* 0.737277337 */, MAD_F(0x0acf37ad) /* 0.675590208 */,
+ MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0898c779) /* 0.537299608 */,
+ MAD_F(0x07635284) /* 0.461748613 */, MAD_F(0x061f78aa) /* 0.382683432 */,
+ MAD_F(0x04cfb0e2) /* 0.300705800 */, MAD_F(0x03768962) /* 0.216439614 */,
+ MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x00b2aa3e) /* 0.043619387 */,
+};
+# endif /* ASO_IMDCT */
+
+/*
+ * windowing coefficients for short blocks
+ * derived from section 2.4.3.4.10.3 of ISO/IEC 11172-3
+ *
+ * window_s[i] = sin((PI / 12) * (i + 1/2))
+ */
+static
+mad_fixed_t const window_s[12] = {
+ MAD_F(0x0216a2a2) /* 0.130526192 */, MAD_F(0x061f78aa) /* 0.382683432 */,
+ MAD_F(0x09bd7ca0) /* 0.608761429 */, MAD_F(0x0cb19346) /* 0.793353340 */,
+ MAD_F(0x0ec835e8) /* 0.923879533 */, MAD_F(0x0fdcf549) /* 0.991444861 */,
+ MAD_F(0x0fdcf549) /* 0.991444861 */, MAD_F(0x0ec835e8) /* 0.923879533 */,
+ MAD_F(0x0cb19346) /* 0.793353340 */, MAD_F(0x09bd7ca0) /* 0.608761429 */,
+ MAD_F(0x061f78aa) /* 0.382683432 */, MAD_F(0x0216a2a2) /* 0.130526192 */,
+};
+
+/*
+ * coefficients for intensity stereo processing
+ * derived from section 2.4.3.4.9.3 of ISO/IEC 11172-3
+ *
+ * is_ratio[i] = tan(i * (PI / 12))
+ * is_table[i] = is_ratio[i] / (1 + is_ratio[i])
+ */
+static
+mad_fixed_t const is_table[7] = {
+ MAD_F(0x00000000) /* 0.000000000 */,
+ MAD_F(0x0361962f) /* 0.211324865 */,
+ MAD_F(0x05db3d74) /* 0.366025404 */,
+ MAD_F(0x08000000) /* 0.500000000 */,
+ MAD_F(0x0a24c28c) /* 0.633974596 */,
+ MAD_F(0x0c9e69d1) /* 0.788675135 */,
+ MAD_F(0x10000000) /* 1.000000000 */
+};
+
+/*
+ * coefficients for LSF intensity stereo processing
+ * derived from section 2.4.3.2 of ISO/IEC 13818-3
+ *
+ * is_lsf_table[0][i] = (1 / sqrt(sqrt(2)))^(i + 1)
+ * is_lsf_table[1][i] = (1 / sqrt(2)) ^(i + 1)
+ */
+static
+mad_fixed_t const is_lsf_table[2][15] = {
+ {
+ MAD_F(0x0d744fcd) /* 0.840896415 */,
+ MAD_F(0x0b504f33) /* 0.707106781 */,
+ MAD_F(0x09837f05) /* 0.594603558 */,
+ MAD_F(0x08000000) /* 0.500000000 */,
+ MAD_F(0x06ba27e6) /* 0.420448208 */,
+ MAD_F(0x05a8279a) /* 0.353553391 */,
+ MAD_F(0x04c1bf83) /* 0.297301779 */,
+ MAD_F(0x04000000) /* 0.250000000 */,
+ MAD_F(0x035d13f3) /* 0.210224104 */,
+ MAD_F(0x02d413cd) /* 0.176776695 */,
+ MAD_F(0x0260dfc1) /* 0.148650889 */,
+ MAD_F(0x02000000) /* 0.125000000 */,
+ MAD_F(0x01ae89fa) /* 0.105112052 */,
+ MAD_F(0x016a09e6) /* 0.088388348 */,
+ MAD_F(0x01306fe1) /* 0.074325445 */
+ }, {
+ MAD_F(0x0b504f33) /* 0.707106781 */,
+ MAD_F(0x08000000) /* 0.500000000 */,
+ MAD_F(0x05a8279a) /* 0.353553391 */,
+ MAD_F(0x04000000) /* 0.250000000 */,
+ MAD_F(0x02d413cd) /* 0.176776695 */,
+ MAD_F(0x02000000) /* 0.125000000 */,
+ MAD_F(0x016a09e6) /* 0.088388348 */,
+ MAD_F(0x01000000) /* 0.062500000 */,
+ MAD_F(0x00b504f3) /* 0.044194174 */,
+ MAD_F(0x00800000) /* 0.031250000 */,
+ MAD_F(0x005a827a) /* 0.022097087 */,
+ MAD_F(0x00400000) /* 0.015625000 */,
+ MAD_F(0x002d413d) /* 0.011048543 */,
+ MAD_F(0x00200000) /* 0.007812500 */,
+ MAD_F(0x0016a09e) /* 0.005524272 */
+ }
+};
+
+/*
+ * NAME: III_sideinfo()
+ * DESCRIPTION: decode frame side information from a bitstream
+ */
+static
+enum mad_error III_sideinfo(struct mad_bitptr *ptr, unsigned int nch,
+ int lsf, struct sideinfo *si,
+ unsigned int *data_bitlen,
+ unsigned int *priv_bitlen)
+{
+ unsigned int ngr, gr, ch, i;
+ enum mad_error result = MAD_ERROR_NONE;
+
+ *data_bitlen = 0;
+ *priv_bitlen = lsf ? ((nch == 1) ? 1 : 2) : ((nch == 1) ? 5 : 3);
+
+ si->main_data_begin = mad_bit_read(ptr, lsf ? 8 : 9);
+ si->private_bits = mad_bit_read(ptr, *priv_bitlen);
+
+ ngr = 1;
+ if (!lsf) {
+ ngr = 2;
+
+ for (ch = 0; ch < nch; ++ch)
+ si->scfsi[ch] = mad_bit_read(ptr, 4);
+ }
+
+ for (gr = 0; gr < ngr; ++gr) {
+ struct granule *granule = &si->gr[gr];
+
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel *channel = &granule->ch[ch];
+
+ channel->part2_3_length = mad_bit_read(ptr, 12);
+ channel->big_values = mad_bit_read(ptr, 9);
+ channel->global_gain = mad_bit_read(ptr, 8);
+ channel->scalefac_compress = mad_bit_read(ptr, lsf ? 9 : 4);
+
+ *data_bitlen += channel->part2_3_length;
+
+ if (channel->big_values > 288 && result == 0)
+ result = MAD_ERROR_BADBIGVALUES;
+
+ channel->flags = 0;
+
+ /* window_switching_flag */
+ if (mad_bit_read(ptr, 1)) {
+ channel->block_type = mad_bit_read(ptr, 2);
+
+ if (channel->block_type == 0 && result == 0)
+ result = MAD_ERROR_BADBLOCKTYPE;
+
+ if (!lsf && channel->block_type == 2 && si->scfsi[ch] && result == 0)
+ result = MAD_ERROR_BADSCFSI;
+
+ channel->region0_count = 7;
+ channel->region1_count = 36;
+
+ if (mad_bit_read(ptr, 1))
+ channel->flags |= mixed_block_flag;
+ else if (channel->block_type == 2)
+ channel->region0_count = 8;
+
+ for (i = 0; i < 2; ++i)
+ channel->table_select[i] = mad_bit_read(ptr, 5);
+
+# if defined(DEBUG)
+ channel->table_select[2] = 4; /* not used */
+# endif
+
+ for (i = 0; i < 3; ++i)
+ channel->subblock_gain[i] = mad_bit_read(ptr, 3);
+ }
+ else {
+ channel->block_type = 0;
+
+ for (i = 0; i < 3; ++i)
+ channel->table_select[i] = mad_bit_read(ptr, 5);
+
+ channel->region0_count = mad_bit_read(ptr, 4);
+ channel->region1_count = mad_bit_read(ptr, 3);
+ }
+
+ /* [preflag,] scalefac_scale, count1table_select */
+ channel->flags |= mad_bit_read(ptr, lsf ? 2 : 3);
+ }
+ }
+
+ return result;
+}
+
+/*
+ * NAME: III_scalefactors_lsf()
+ * DESCRIPTION: decode channel scalefactors for LSF from a bitstream
+ */
+static
+unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr,
+ struct channel *channel,
+ struct channel *gr1ch, int mode_extension)
+{
+ struct mad_bitptr start;
+ unsigned int scalefac_compress, index, slen[4], part, n, i;
+ unsigned char const *nsfb;
+
+ start = *ptr;
+
+ scalefac_compress = channel->scalefac_compress;
+ index = (channel->block_type == 2) ?
+ ((channel->flags & mixed_block_flag) ? 2 : 1) : 0;
+
+ if (!((mode_extension & I_STEREO) && gr1ch)) {
+ if (scalefac_compress < 400) {
+ slen[0] = (scalefac_compress >> 4) / 5;
+ slen[1] = (scalefac_compress >> 4) % 5;
+ slen[2] = (scalefac_compress % 16) >> 2;
+ slen[3] = scalefac_compress % 4;
+
+ nsfb = nsfb_table[0][index];
+ }
+ else if (scalefac_compress < 500) {
+ scalefac_compress -= 400;
+
+ slen[0] = (scalefac_compress >> 2) / 5;
+ slen[1] = (scalefac_compress >> 2) % 5;
+ slen[2] = scalefac_compress % 4;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[1][index];
+ }
+ else {
+ scalefac_compress -= 500;
+
+ slen[0] = scalefac_compress / 3;
+ slen[1] = scalefac_compress % 3;
+ slen[2] = 0;
+ slen[3] = 0;
+
+ channel->flags |= preflag;
+
+ nsfb = nsfb_table[2][index];
+ }
+
+ n = 0;
+ for (part = 0; part < 4; ++part) {
+ for (i = 0; i < nsfb[part]; ++i)
+ channel->scalefac[n++] = mad_bit_read(ptr, slen[part]);
+ }
+
+ while (n < 39)
+ channel->scalefac[n++] = 0;
+ }
+ else { /* (mode_extension & I_STEREO) && gr1ch (i.e. ch == 1) */
+ scalefac_compress >>= 1;
+
+ if (scalefac_compress < 180) {
+ slen[0] = scalefac_compress / 36;
+ slen[1] = (scalefac_compress % 36) / 6;
+ slen[2] = (scalefac_compress % 36) % 6;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[3][index];
+ }
+ else if (scalefac_compress < 244) {
+ scalefac_compress -= 180;
+
+ slen[0] = (scalefac_compress % 64) >> 4;
+ slen[1] = (scalefac_compress % 16) >> 2;
+ slen[2] = scalefac_compress % 4;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[4][index];
+ }
+ else {
+ scalefac_compress -= 244;
+
+ slen[0] = scalefac_compress / 3;
+ slen[1] = scalefac_compress % 3;
+ slen[2] = 0;
+ slen[3] = 0;
+
+ nsfb = nsfb_table[5][index];
+ }
+
+ n = 0;
+ for (part = 0; part < 4; ++part) {
+ unsigned int max, is_pos;
+
+ max = (1 << slen[part]) - 1;
+
+ for (i = 0; i < nsfb[part]; ++i) {
+ is_pos = mad_bit_read(ptr, slen[part]);
+
+ channel->scalefac[n] = is_pos;
+ gr1ch->scalefac[n++] = (is_pos == max);
+ }
+ }
+
+ while (n < 39) {
+ channel->scalefac[n] = 0;
+ gr1ch->scalefac[n++] = 0; /* apparently not illegal */
+ }
+ }
+
+ return mad_bit_length(&start, ptr);
+}
+
+/*
+ * NAME: III_scalefactors()
+ * DESCRIPTION: decode channel scalefactors of one granule from a bitstream
+ */
+static
+unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel,
+ struct channel const *gr0ch, unsigned int scfsi)
+{
+ struct mad_bitptr start;
+ unsigned int slen1, slen2, sfbi;
+
+ start = *ptr;
+
+ slen1 = sflen_table[channel->scalefac_compress].slen1;
+ slen2 = sflen_table[channel->scalefac_compress].slen2;
+
+ if (channel->block_type == 2) {
+ unsigned int nsfb;
+
+ sfbi = 0;
+
+ nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3;
+ while (nsfb--)
+ channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1);
+
+ nsfb = 6 * 3;
+ while (nsfb--)
+ channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2);
+
+ nsfb = 1 * 3;
+ while (nsfb--)
+ channel->scalefac[sfbi++] = 0;
+ }
+ else { /* channel->block_type != 2 */
+ if (scfsi & 0x8) {
+ for (sfbi = 0; sfbi < 6; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 0; sfbi < 6; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
+ }
+
+ if (scfsi & 0x4) {
+ for (sfbi = 6; sfbi < 11; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 6; sfbi < 11; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
+ }
+
+ if (scfsi & 0x2) {
+ for (sfbi = 11; sfbi < 16; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 11; sfbi < 16; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
+ }
+
+ if (scfsi & 0x1) {
+ for (sfbi = 16; sfbi < 21; ++sfbi)
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+ for (sfbi = 16; sfbi < 21; ++sfbi)
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
+ }
+
+ channel->scalefac[21] = 0;
+ }
+
+ return mad_bit_length(&start, ptr);
+}
+
+/*
+ * The Layer III formula for requantization and scaling is defined by
+ * section 2.4.3.4.7.1 of ISO/IEC 11172-3, as follows:
+ *
+ * long blocks:
+ * xr[i] = sign(is[i]) * abs(is[i])^(4/3) *
+ * 2^((1/4) * (global_gain - 210)) *
+ * 2^-(scalefac_multiplier *
+ * (scalefac_l[sfb] + preflag * pretab[sfb]))
+ *
+ * short blocks:
+ * xr[i] = sign(is[i]) * abs(is[i])^(4/3) *
+ * 2^((1/4) * (global_gain - 210 - 8 * subblock_gain[w])) *
+ * 2^-(scalefac_multiplier * scalefac_s[sfb][w])
+ *
+ * where:
+ * scalefac_multiplier = (scalefac_scale + 1) / 2
+ *
+ * The routines III_exponents() and III_requantize() facilitate this
+ * calculation.
+ */
+
+/*
+ * NAME: III_exponents()
+ * DESCRIPTION: calculate scalefactor exponents
+ */
+static
+void III_exponents(struct channel const *channel,
+ unsigned char const *sfbwidth, signed int exponents[39])
+{
+ signed int gain;
+ unsigned int scalefac_multiplier, sfbi;
+
+ gain = (signed int) channel->global_gain - 210;
+ scalefac_multiplier = (channel->flags & scalefac_scale) ? 2 : 1;
+
+ if (channel->block_type == 2) {
+ unsigned int l;
+ signed int gain0, gain1, gain2;
+
+ sfbi = l = 0;
+
+ if (channel->flags & mixed_block_flag) {
+ unsigned int premask;
+
+ premask = (channel->flags & preflag) ? ~0 : 0;
+
+ /* long block subbands 0-1 */
+
+ while (l < 36) {
+ exponents[sfbi] = gain -
+ (signed int) ((channel->scalefac[sfbi] + (pretab[sfbi] & premask)) <<
+ scalefac_multiplier);
+
+ l += sfbwidth[sfbi++];
+ }
+ }
+
+ /* this is probably wrong for 8000 Hz short/mixed blocks */
+
+ gain0 = gain - 8 * (signed int) channel->subblock_gain[0];
+ gain1 = gain - 8 * (signed int) channel->subblock_gain[1];
+ gain2 = gain - 8 * (signed int) channel->subblock_gain[2];
+
+ while (l < 576) {
+ exponents[sfbi + 0] = gain0 -
+ (signed int) (channel->scalefac[sfbi + 0] << scalefac_multiplier);
+ exponents[sfbi + 1] = gain1 -
+ (signed int) (channel->scalefac[sfbi + 1] << scalefac_multiplier);
+ exponents[sfbi + 2] = gain2 -
+ (signed int) (channel->scalefac[sfbi + 2] << scalefac_multiplier);
+
+ l += 3 * sfbwidth[sfbi];
+ sfbi += 3;
+ }
+ }
+ else { /* channel->block_type != 2 */
+ if (channel->flags & preflag) {
+ for (sfbi = 0; sfbi < 22; ++sfbi) {
+ exponents[sfbi] = gain -
+ (signed int) ((channel->scalefac[sfbi] + pretab[sfbi]) <<
+ scalefac_multiplier);
+ }
+ }
+ else {
+ for (sfbi = 0; sfbi < 22; ++sfbi) {
+ exponents[sfbi] = gain -
+ (signed int) (channel->scalefac[sfbi] << scalefac_multiplier);
+ }
+ }
+ }
+}
+
+/*
+ * NAME: III_requantize()
+ * DESCRIPTION: requantize one (positive) value
+ */
+static
+mad_fixed_t III_requantize(unsigned int value, signed int exp)
+{
+ mad_fixed_t requantized;
+ signed int frac;
+ struct fixedfloat const *power;
+
+ frac = exp % 4; /* assumes sign(frac) == sign(exp) */
+ exp /= 4;
+
+ power = &rq_table[value];
+ requantized = power->mantissa;
+ exp += power->exponent;
+
+ if (exp < 0) {
+ if (-exp >= sizeof(mad_fixed_t) * CHAR_BIT) {
+ /* underflow */
+ requantized = 0;
+ }
+ else {
+ requantized += 1L << (-exp - 1);
+ requantized >>= -exp;
+ }
+ }
+ else {
+ if (exp >= 5) {
+ /* overflow */
+# if defined(DEBUG)
+ fprintf(stderr, "requantize overflow (%f * 2^%d)\n",
+ mad_f_todouble(requantized), exp);
+# endif
+ requantized = MAD_F_MAX;
+ }
+ else
+ requantized <<= exp;
+ }
+
+ return frac ? mad_f_mul(requantized, root_table[3 + frac]) : requantized;
+}
+
+/* we must take care that sz >= bits and sz < sizeof(long) lest bits == 0 */
+# define MASK(cache, sz, bits) \
+ (((cache) >> ((sz) - (bits))) & ((1 << (bits)) - 1))
+# define MASK1BIT(cache, sz) \
+ ((cache) & (1 << ((sz) - 1)))
+
+/*
+ * NAME: III_huffdecode()
+ * DESCRIPTION: decode Huffman code words of one channel of one granule
+ */
+static
+enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576],
+ struct channel *channel,
+ unsigned char const *sfbwidth,
+ unsigned int part2_length)
+{
+ signed int exponents[39], exp;
+ signed int const *expptr;
+ struct mad_bitptr peek;
+ signed int bits_left, cachesz;
+ register mad_fixed_t *xrptr;
+ mad_fixed_t const *sfbound;
+ register unsigned long bitcache;
+
+ bits_left = (signed) channel->part2_3_length - (signed) part2_length;
+ if (bits_left < 0)
+ return MAD_ERROR_BADPART3LEN;
+
+ III_exponents(channel, sfbwidth, exponents);
+
+ peek = *ptr;
+ mad_bit_skip(ptr, bits_left);
+
+ /* align bit reads to byte boundaries */
+ cachesz = mad_bit_bitsleft(&peek);
+ cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7;
+
+ bitcache = mad_bit_read(&peek, cachesz);
+ bits_left -= cachesz;
+
+ xrptr = &xr[0];
+
+ /* big_values */
+ {
+ unsigned int region, rcount;
+ struct hufftable const *entry;
+ union huffpair const *table;
+ unsigned int linbits, startbits, big_values, reqhits;
+ mad_fixed_t reqcache[16];
+
+ sfbound = xrptr + *sfbwidth++;
+ rcount = channel->region0_count + 1;
+
+ entry = &mad_huff_pair_table[channel->table_select[region = 0]];
+ table = entry->table;
+ linbits = entry->linbits;
+ startbits = entry->startbits;
+
+ if (table == 0)
+ return MAD_ERROR_BADHUFFTABLE;
+
+ expptr = &exponents[0];
+ exp = *expptr++;
+ reqhits = 0;
+
+ big_values = channel->big_values;
+
+ while (big_values-- && cachesz + bits_left > 0) {
+ union huffpair const *pair;
+ unsigned int clumpsz, value;
+ register mad_fixed_t requantized;
+
+ if (xrptr == sfbound) {
+ sfbound += *sfbwidth++;
+
+ /* change table if region boundary */
+
+ if (--rcount == 0) {
+ if (region == 0)
+ rcount = channel->region1_count + 1;
+ else
+ rcount = 0; /* all remaining */
+
+ entry = &mad_huff_pair_table[channel->table_select[++region]];
+ table = entry->table;
+ linbits = entry->linbits;
+ startbits = entry->startbits;
+
+ if (table == 0)
+ return MAD_ERROR_BADHUFFTABLE;
+ }
+
+ if (exp != *expptr) {
+ exp = *expptr;
+ reqhits = 0;
+ }
+
+ ++expptr;
+ }
+
+ if (cachesz < 21) {
+ unsigned int bits;
+
+ bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7;
+ bitcache = (bitcache << bits) | mad_bit_read(&peek, bits);
+ cachesz += bits;
+ bits_left -= bits;
+ }
+
+ /* hcod (0..19) */
+
+ clumpsz = startbits;
+ pair = &table[MASK(bitcache, cachesz, clumpsz)];
+
+ while (!pair->final) {
+ cachesz -= clumpsz;
+
+ clumpsz = pair->ptr.bits;
+ pair = &table[pair->ptr.offset + MASK(bitcache, cachesz, clumpsz)];
+ }
+
+ cachesz -= pair->value.hlen;
+
+ if (linbits) {
+ /* x (0..14) */
+
+ value = pair->value.x;
+
+ switch (value) {
+ case 0:
+ xrptr[0] = 0;
+ break;
+
+ case 15:
+ if (cachesz < linbits + 2) {
+ bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+ cachesz += 16;
+ bits_left -= 16;
+ }
+
+ value += MASK(bitcache, cachesz, linbits);
+ cachesz -= linbits;
+
+ requantized = III_requantize(value, exp);
+ goto x_final;
+
+ default:
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ x_final:
+ xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+
+ /* y (0..14) */
+
+ value = pair->value.y;
+
+ switch (value) {
+ case 0:
+ xrptr[1] = 0;
+ break;
+
+ case 15:
+ if (cachesz < linbits + 1) {
+ bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+ cachesz += 16;
+ bits_left -= 16;
+ }
+
+ value += MASK(bitcache, cachesz, linbits);
+ cachesz -= linbits;
+
+ requantized = III_requantize(value, exp);
+ goto y_final;
+
+ default:
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ y_final:
+ xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+ }
+ else {
+ /* x (0..1) */
+
+ value = pair->value.x;
+
+ if (value == 0)
+ xrptr[0] = 0;
+ else {
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+
+ /* y (0..1) */
+
+ value = pair->value.y;
+
+ if (value == 0)
+ xrptr[1] = 0;
+ else {
+ if (reqhits & (1 << value))
+ requantized = reqcache[value];
+ else {
+ reqhits |= (1 << value);
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
+ xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+ }
+
+ xrptr += 2;
+ }
+ }
+
+ if (cachesz + bits_left < 0)
+ return MAD_ERROR_BADHUFFDATA; /* big_values overrun */
+
+ /* count1 */
+ {
+ union huffquad const *table;
+ register mad_fixed_t requantized;
+
+ table = mad_huff_quad_table[channel->flags & count1table_select];
+
+ requantized = III_requantize(1, exp);
+
+ while (cachesz + bits_left > 0 && xrptr <= &xr[572]) {
+ union huffquad const *quad;
+
+ /* hcod (1..6) */
+
+ if (cachesz < 10) {
+ bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+ cachesz += 16;
+ bits_left -= 16;
+ }
+
+ quad = &table[MASK(bitcache, cachesz, 4)];
+
+ /* quad tables guaranteed to have at most one extra lookup */
+ if (!quad->final) {
+ cachesz -= 4;
+
+ quad = &table[quad->ptr.offset +
+ MASK(bitcache, cachesz, quad->ptr.bits)];
+ }
+
+ cachesz -= quad->value.hlen;
+
+ if (xrptr == sfbound) {
+ sfbound += *sfbwidth++;
+
+ if (exp != *expptr) {
+ exp = *expptr;
+ requantized = III_requantize(1, exp);
+ }
+
+ ++expptr;
+ }
+
+ /* v (0..1) */
+
+ xrptr[0] = quad->value.v ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+
+ /* w (0..1) */
+
+ xrptr[1] = quad->value.w ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+
+ xrptr += 2;
+
+ if (xrptr == sfbound) {
+ sfbound += *sfbwidth++;
+
+ if (exp != *expptr) {
+ exp = *expptr;
+ requantized = III_requantize(1, exp);
+ }
+
+ ++expptr;
+ }
+
+ /* x (0..1) */
+
+ xrptr[0] = quad->value.x ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+
+ /* y (0..1) */
+
+ xrptr[1] = quad->value.y ?
+ (MASK1BIT(bitcache, cachesz--) ? -requantized : requantized) : 0;
+
+ xrptr += 2;
+ }
+
+ if (cachesz + bits_left < 0) {
+# if 0 && defined(DEBUG)
+ fprintf(stderr, "huffman count1 overrun (%d bits)\n",
+ -(cachesz + bits_left));
+# endif
+
+ /* technically the bitstream is misformatted, but apparently
+ some encoders are just a bit sloppy with stuffing bits */
+
+ xrptr -= 4;
+ }
+ }
+
+ assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT);
+
+# if 0 && defined(DEBUG)
+ if (bits_left < 0)
+ fprintf(stderr, "read %d bits too many\n", -bits_left);
+ else if (cachesz + bits_left > 0)
+ fprintf(stderr, "%d stuffing bits\n", cachesz + bits_left);
+# endif
+
+ /* rzero */
+ while (xrptr < &xr[576]) {
+ xrptr[0] = 0;
+ xrptr[1] = 0;
+
+ xrptr += 2;
+ }
+
+ return MAD_ERROR_NONE;
+}
+
+# undef MASK
+# undef MASK1BIT
+
+/*
+ * NAME: III_reorder()
+ * DESCRIPTION: reorder frequency lines of a short block into subband order
+ */
+static
+void III_reorder(mad_fixed_t xr[576], struct channel const *channel,
+ unsigned char const sfbwidth[39])
+{
+ mad_fixed_t tmp[32][3][6];
+ unsigned int sb, l, f, w, sbw[3], sw[3];
+
+ /* this is probably wrong for 8000 Hz mixed blocks */
+
+ sb = 0;
+ if (channel->flags & mixed_block_flag) {
+ sb = 2;
+
+ l = 0;
+ while (l < 36)
+ l += *sfbwidth++;
+ }
+
+ for (w = 0; w < 3; ++w) {
+ sbw[w] = sb;
+ sw[w] = 0;
+ }
+
+ f = *sfbwidth++;
+ w = 0;
+
+ for (l = 18 * sb; l < 576; ++l) {
+ if (f-- == 0) {
+ f = *sfbwidth++ - 1;
+ w = (w + 1) % 3;
+ }
+
+ tmp[sbw[w]][w][sw[w]++] = xr[l];
+
+ if (sw[w] == 6) {
+ sw[w] = 0;
+ ++sbw[w];
+ }
+ }
+
+ memcpy(&xr[18 * sb], &tmp[sb], (576 - 18 * sb) * sizeof(mad_fixed_t));
+}
+
+/*
+ * NAME: III_stereo()
+ * DESCRIPTION: perform joint stereo processing on a granule
+ */
+static
+enum mad_error III_stereo(mad_fixed_t xr[2][576],
+ struct granule const *granule,
+ struct mad_header *header,
+ unsigned char const *sfbwidth)
+{
+ short modes[39];
+ unsigned int sfbi, l, n, i;
+
+ if (granule->ch[0].block_type !=
+ granule->ch[1].block_type ||
+ (granule->ch[0].flags & mixed_block_flag) !=
+ (granule->ch[1].flags & mixed_block_flag))
+ return MAD_ERROR_BADSTEREO;
+
+ for (i = 0; i < 39; ++i)
+ modes[i] = header->mode_extension;
+
+ /* intensity stereo */
+
+ if (header->mode_extension & I_STEREO) {
+ struct channel const *right_ch = &granule->ch[1];
+ mad_fixed_t const *right_xr = xr[1];
+ unsigned int is_pos;
+
+ header->flags |= MAD_FLAG_I_STEREO;
+
+ /* first determine which scalefactor bands are to be processed */
+
+ if (right_ch->block_type == 2) {
+ unsigned int lower, start, max, bound[3], w;
+
+ lower = start = max = bound[0] = bound[1] = bound[2] = 0;
+
+ sfbi = l = 0;
+
+ if (right_ch->flags & mixed_block_flag) {
+ while (l < 36) {
+ n = sfbwidth[sfbi++];
+
+ for (i = 0; i < n; ++i) {
+ if (right_xr[i]) {
+ lower = sfbi;
+ break;
+ }
+ }
+
+ right_xr += n;
+ l += n;
+ }
+
+ start = sfbi;
+ }
+
+ w = 0;
+ while (l < 576) {
+ n = sfbwidth[sfbi++];
+
+ for (i = 0; i < n; ++i) {
+ if (right_xr[i]) {
+ max = bound[w] = sfbi;
+ break;
+ }
+ }
+
+ right_xr += n;
+ l += n;
+ w = (w + 1) % 3;
+ }
+
+ if (max)
+ lower = start;
+
+ /* long blocks */
+
+ for (i = 0; i < lower; ++i)
+ modes[i] = header->mode_extension & ~I_STEREO;
+
+ /* short blocks */
+
+ w = 0;
+ for (i = start; i < max; ++i) {
+ if (i < bound[w])
+ modes[i] = header->mode_extension & ~I_STEREO;
+
+ w = (w + 1) % 3;
+ }
+ }
+ else { /* right_ch->block_type != 2 */
+ unsigned int bound;
+
+ bound = 0;
+ for (sfbi = l = 0; l < 576; l += n) {
+ n = sfbwidth[sfbi++];
+
+ for (i = 0; i < n; ++i) {
+ if (right_xr[i]) {
+ bound = sfbi;
+ break;
+ }
+ }
+
+ right_xr += n;
+ }
+
+ for (i = 0; i < bound; ++i)
+ modes[i] = header->mode_extension & ~I_STEREO;
+ }
+
+ /* now do the actual processing */
+
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+ unsigned char const *illegal_pos = granule[1].ch[1].scalefac;
+ mad_fixed_t const *lsf_scale;
+
+ /* intensity_scale */
+ lsf_scale = is_lsf_table[right_ch->scalefac_compress & 0x1];
+
+ for (sfbi = l = 0; l < 576; ++sfbi, l += n) {
+ n = sfbwidth[sfbi];
+
+ if (!(modes[sfbi] & I_STEREO))
+ continue;
+
+ if (illegal_pos[sfbi]) {
+ modes[sfbi] &= ~I_STEREO;
+ continue;
+ }
+
+ is_pos = right_ch->scalefac[sfbi];
+
+ for (i = 0; i < n; ++i) {
+ register mad_fixed_t left;
+
+ left = xr[0][l + i];
+
+ if (is_pos == 0)
+ xr[1][l + i] = left;
+ else {
+ register mad_fixed_t opposite;
+
+ opposite = mad_f_mul(left, lsf_scale[(is_pos - 1) / 2]);
+
+ if (is_pos & 1) {
+ xr[0][l + i] = opposite;
+ xr[1][l + i] = left;
+ }
+ else
+ xr[1][l + i] = opposite;
+ }
+ }
+ }
+ }
+ else { /* !(header->flags & MAD_FLAG_LSF_EXT) */
+ for (sfbi = l = 0; l < 576; ++sfbi, l += n) {
+ n = sfbwidth[sfbi];
+
+ if (!(modes[sfbi] & I_STEREO))
+ continue;
+
+ is_pos = right_ch->scalefac[sfbi];
+
+ if (is_pos >= 7) { /* illegal intensity position */
+ modes[sfbi] &= ~I_STEREO;
+ continue;
+ }
+
+ for (i = 0; i < n; ++i) {
+ register mad_fixed_t left;
+
+ left = xr[0][l + i];
+
+ xr[0][l + i] = mad_f_mul(left, is_table[ is_pos]);
+ xr[1][l + i] = mad_f_mul(left, is_table[6 - is_pos]);
+ }
+ }
+ }
+ }
+
+ /* middle/side stereo */
+
+ if (header->mode_extension & MS_STEREO) {
+ register mad_fixed_t invsqrt2;
+
+ header->flags |= MAD_FLAG_MS_STEREO;
+
+ invsqrt2 = root_table[3 + -2];
+
+ for (sfbi = l = 0; l < 576; ++sfbi, l += n) {
+ n = sfbwidth[sfbi];
+
+ if (modes[sfbi] != MS_STEREO)
+ continue;
+
+ for (i = 0; i < n; ++i) {
+ register mad_fixed_t m, s;
+
+ m = xr[0][l + i];
+ s = xr[1][l + i];
+
+ xr[0][l + i] = mad_f_mul(m + s, invsqrt2); /* l = (m + s) / sqrt(2) */
+ xr[1][l + i] = mad_f_mul(m - s, invsqrt2); /* r = (m - s) / sqrt(2) */
+ }
+ }
+ }
+
+ return MAD_ERROR_NONE;
+}
+
+/*
+ * NAME: III_aliasreduce()
+ * DESCRIPTION: perform frequency line alias reduction
+ */
+static
+void III_aliasreduce(mad_fixed_t xr[576], int lines)
+{
+ mad_fixed_t const *bound;
+ int i;
+
+ bound = &xr[lines];
+ for (xr += 18; xr < bound; xr += 18) {
+ for (i = 0; i < 8; ++i) {
+ register mad_fixed_t a, b;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ a = xr[-1 - i];
+ b = xr[ i];
+
+# if defined(ASO_ZEROCHECK)
+ if (a | b) {
+# endif
+ MAD_F_ML0(hi, lo, a, cs[i]);
+ MAD_F_MLA(hi, lo, -b, ca[i]);
+
+ xr[-1 - i] = MAD_F_MLZ(hi, lo);
+
+ MAD_F_ML0(hi, lo, b, cs[i]);
+ MAD_F_MLA(hi, lo, a, ca[i]);
+
+ xr[ i] = MAD_F_MLZ(hi, lo);
+# if defined(ASO_ZEROCHECK)
+ }
+# endif
+ }
+ }
+}
+
+# if defined(ASO_IMDCT)
+void III_imdct_l(mad_fixed_t const [18], mad_fixed_t [36], unsigned int);
+# else
+/*
+ * NAME: imdct36
+ * DESCRIPTION: perform X[18]->x[36] IMDCT
+ */
+static inline
+void imdct36(mad_fixed_t const X[18], mad_fixed_t x[36])
+{
+ mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
+ mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ MAD_F_ML0(hi, lo, X[4], MAD_F(0x0ec835e8));
+ MAD_F_MLA(hi, lo, X[13], MAD_F(0x061f78aa));
+
+ t6 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, (t14 = X[1] - X[10]), -MAD_F(0x061f78aa));
+ MAD_F_MLA(hi, lo, (t15 = X[7] + X[16]), -MAD_F(0x0ec835e8));
+
+ t0 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, (t8 = X[0] - X[11] - X[12]), MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, (t9 = X[2] - X[9] - X[14]), MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, (t10 = X[3] - X[8] - X[15]), -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, (t11 = X[5] - X[6] - X[17]), -MAD_F(0x0fdcf549));
+
+ x[7] = MAD_F_MLZ(hi, lo);
+ x[10] = -x[7];
+
+ MAD_F_ML0(hi, lo, t8, -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, t9, MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, t10, MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, t11, -MAD_F(0x09bd7ca0));
+
+ x[19] = x[34] = MAD_F_MLZ(hi, lo) - t0;
+
+ t12 = X[0] - X[3] + X[8] - X[11] - X[12] + X[15];
+ t13 = X[2] + X[5] - X[6] - X[9] - X[14] - X[17];
+
+ MAD_F_ML0(hi, lo, t12, -MAD_F(0x0ec835e8));
+ MAD_F_MLA(hi, lo, t13, MAD_F(0x061f78aa));
+
+ x[22] = x[31] = MAD_F_MLZ(hi, lo) + t0;
+
+ MAD_F_ML0(hi, lo, X[1], -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, X[7], MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, X[10], -MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, X[16], MAD_F(0x0cb19346));
+
+ t1 = MAD_F_MLZ(hi, lo) + t6;
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0f9ee890));
+
+ x[6] = MAD_F_MLZ(hi, lo) + t1;
+ x[11] = -x[6];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x04cfb0e2));
+
+ x[23] = x[30] = MAD_F_MLZ(hi, lo) + t1;
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0acf37ad));
+
+ x[18] = x[35] = MAD_F_MLZ(hi, lo) - t1;
+
+ MAD_F_ML0(hi, lo, X[4], MAD_F(0x061f78aa));
+ MAD_F_MLA(hi, lo, X[13], -MAD_F(0x0ec835e8));
+
+ t7 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, X[1], -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, X[7], MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, X[10], MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, X[16], -MAD_F(0x09bd7ca0));
+
+ t2 = MAD_F_MLZ(hi, lo);
+
+ MAD_F_MLA(hi, lo, X[0], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x0f426cb5));
+
+ x[5] = MAD_F_MLZ(hi, lo);
+ x[12] = -x[5];
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0bcbe352));
+
+ x[0] = MAD_F_MLZ(hi, lo) + t2;
+ x[17] = -x[0];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x03768962));
+
+ x[24] = x[29] = MAD_F_MLZ(hi, lo) + t2;
+
+ MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, X[7], -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, X[10], MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, X[16], MAD_F(0x0fdcf549));
+
+ t3 = MAD_F_MLZ(hi, lo) + t7;
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0ffc19fd));
+
+ x[8] = MAD_F_MLZ(hi, lo) + t3;
+ x[9] = -x[8];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x07635284));
+
+ x[21] = x[32] = MAD_F_MLZ(hi, lo) + t3;
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0898c779));
+
+ x[20] = x[33] = MAD_F_MLZ(hi, lo) - t3;
+
+ MAD_F_ML0(hi, lo, t14, -MAD_F(0x0ec835e8));
+ MAD_F_MLA(hi, lo, t15, MAD_F(0x061f78aa));
+
+ t4 = MAD_F_MLZ(hi, lo) - t7;
+
+ MAD_F_ML0(hi, lo, t12, MAD_F(0x061f78aa));
+ MAD_F_MLA(hi, lo, t13, MAD_F(0x0ec835e8));
+
+ x[4] = MAD_F_MLZ(hi, lo) + t4;
+ x[13] = -x[4];
+
+ MAD_F_ML0(hi, lo, t8, MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, t9, -MAD_F(0x0216a2a2));
+ MAD_F_MLA(hi, lo, t10, MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, t11, -MAD_F(0x0cb19346));
+
+ x[1] = MAD_F_MLZ(hi, lo) + t4;
+ x[16] = -x[1];
+
+ MAD_F_ML0(hi, lo, t8, -MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, t9, -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, t10, -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, t11, -MAD_F(0x0216a2a2));
+
+ x[25] = x[28] = MAD_F_MLZ(hi, lo) + t4;
+
+ MAD_F_ML0(hi, lo, X[1], -MAD_F(0x0fdcf549));
+ MAD_F_MLA(hi, lo, X[7], -MAD_F(0x0cb19346));
+ MAD_F_MLA(hi, lo, X[10], -MAD_F(0x09bd7ca0));
+ MAD_F_MLA(hi, lo, X[16], -MAD_F(0x0216a2a2));
+
+ t5 = MAD_F_MLZ(hi, lo) - t6;
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[6], MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[9], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[12], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[15], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x0d7e8807));
+
+ x[2] = MAD_F_MLZ(hi, lo) + t5;
+ x[15] = -x[2];
+
+ MAD_F_ML0(hi, lo, X[0], MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[2], MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[3], MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[5], MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x00b2aa3e));
+ MAD_F_MLA(hi, lo, X[8], MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[11], MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[14], MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[17], MAD_F(0x0e313245));
+
+ x[3] = MAD_F_MLZ(hi, lo) + t5;
+ x[14] = -x[3];
+
+ MAD_F_ML0(hi, lo, X[0], -MAD_F(0x0ffc19fd));
+ MAD_F_MLA(hi, lo, X[2], -MAD_F(0x0f9ee890));
+ MAD_F_MLA(hi, lo, X[3], -MAD_F(0x0f426cb5));
+ MAD_F_MLA(hi, lo, X[5], -MAD_F(0x0e313245));
+ MAD_F_MLA(hi, lo, X[6], -MAD_F(0x0d7e8807));
+ MAD_F_MLA(hi, lo, X[8], -MAD_F(0x0bcbe352));
+ MAD_F_MLA(hi, lo, X[9], -MAD_F(0x0acf37ad));
+ MAD_F_MLA(hi, lo, X[11], -MAD_F(0x0898c779));
+ MAD_F_MLA(hi, lo, X[12], -MAD_F(0x07635284));
+ MAD_F_MLA(hi, lo, X[14], -MAD_F(0x04cfb0e2));
+ MAD_F_MLA(hi, lo, X[15], -MAD_F(0x03768962));
+ MAD_F_MLA(hi, lo, X[17], -MAD_F(0x00b2aa3e));
+
+ x[26] = x[27] = MAD_F_MLZ(hi, lo) + t5;
+}
+
+/*
+ * NAME: III_imdct_l()
+ * DESCRIPTION: perform IMDCT and windowing for long blocks
+ */
+static
+void III_imdct_l(mad_fixed_t const X[18], mad_fixed_t z[36],
+ unsigned int block_type)
+{
+ unsigned int i;
+
+ /* IMDCT */
+
+ imdct36(X, z);
+
+ /* windowing */
+
+ switch (block_type) {
+ case 0: /* normal window */
+# if defined(ASO_INTERLEAVE1)
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = window_l[0];
+ tmp2 = window_l[1];
+
+ for (i = 0; i < 34; i += 2) {
+ z[i + 0] = mad_f_mul(z[i + 0], tmp1);
+ tmp1 = window_l[i + 2];
+ z[i + 1] = mad_f_mul(z[i + 1], tmp2);
+ tmp2 = window_l[i + 3];
+ }
+
+ z[34] = mad_f_mul(z[34], tmp1);
+ z[35] = mad_f_mul(z[35], tmp2);
+ }
+# elif defined(ASO_INTERLEAVE2)
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = z[0];
+ tmp2 = window_l[0];
+
+ for (i = 0; i < 35; ++i) {
+ z[i] = mad_f_mul(tmp1, tmp2);
+ tmp1 = z[i + 1];
+ tmp2 = window_l[i + 1];
+ }
+
+ z[35] = mad_f_mul(tmp1, tmp2);
+ }
+# elif 1
+ for (i = 0; i < 36; i += 4) {
+ z[i + 0] = mad_f_mul(z[i + 0], window_l[i + 0]);
+ z[i + 1] = mad_f_mul(z[i + 1], window_l[i + 1]);
+ z[i + 2] = mad_f_mul(z[i + 2], window_l[i + 2]);
+ z[i + 3] = mad_f_mul(z[i + 3], window_l[i + 3]);
+ }
+# else
+ for (i = 0; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]);
+# endif
+ break;
+
+ case 1: /* start block */
+ for (i = 0; i < 18; ++i) z[i] = mad_f_mul(z[i], window_l[i]);
+ /* (i = 18; i < 24; ++i) z[i] unchanged */
+ for (i = 24; i < 30; ++i) z[i] = mad_f_mul(z[i], window_s[i - 18]);
+ for (i = 30; i < 36; ++i) z[i] = 0;
+ break;
+
+ case 3: /* stop block */
+ for (i = 0; i < 6; ++i) z[i] = 0;
+ for (i = 6; i < 12; ++i) z[i] = mad_f_mul(z[i], window_s[i - 6]);
+ /* (i = 12; i < 18; ++i) z[i] unchanged */
+ for (i = 18; i < 36; ++i) z[i] = mad_f_mul(z[i], window_l[i]);
+ break;
+ }
+}
+# endif /* ASO_IMDCT */
+
+/*
+ * NAME: III_imdct_s()
+ * DESCRIPTION: perform IMDCT and windowing for short blocks
+ */
+static
+void III_imdct_s(mad_fixed_t const X[18], mad_fixed_t z[36])
+{
+ mad_fixed_t y[36], *yptr;
+ mad_fixed_t const *wptr;
+ int w, i;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ /* IMDCT */
+
+ yptr = &y[0];
+
+ for (w = 0; w < 3; ++w) {
+ register mad_fixed_t const (*s)[6];
+
+ s = imdct_s;
+
+ for (i = 0; i < 3; ++i) {
+ MAD_F_ML0(hi, lo, X[0], (*s)[0]);
+ MAD_F_MLA(hi, lo, X[1], (*s)[1]);
+ MAD_F_MLA(hi, lo, X[2], (*s)[2]);
+ MAD_F_MLA(hi, lo, X[3], (*s)[3]);
+ MAD_F_MLA(hi, lo, X[4], (*s)[4]);
+ MAD_F_MLA(hi, lo, X[5], (*s)[5]);
+
+ yptr[i + 0] = MAD_F_MLZ(hi, lo);
+ yptr[5 - i] = -yptr[i + 0];
+
+ ++s;
+
+ MAD_F_ML0(hi, lo, X[0], (*s)[0]);
+ MAD_F_MLA(hi, lo, X[1], (*s)[1]);
+ MAD_F_MLA(hi, lo, X[2], (*s)[2]);
+ MAD_F_MLA(hi, lo, X[3], (*s)[3]);
+ MAD_F_MLA(hi, lo, X[4], (*s)[4]);
+ MAD_F_MLA(hi, lo, X[5], (*s)[5]);
+
+ yptr[ i + 6] = MAD_F_MLZ(hi, lo);
+ yptr[11 - i] = yptr[i + 6];
+
+ ++s;
+ }
+
+ yptr += 12;
+ X += 6;
+ }
+
+ /* windowing, overlapping and concatenation */
+
+ yptr = &y[0];
+ wptr = &window_s[0];
+
+ for (i = 0; i < 6; ++i) {
+ z[i + 0] = 0;
+ z[i + 6] = mad_f_mul(yptr[ 0 + 0], wptr[0]);
+
+ MAD_F_ML0(hi, lo, yptr[ 0 + 6], wptr[6]);
+ MAD_F_MLA(hi, lo, yptr[12 + 0], wptr[0]);
+
+ z[i + 12] = MAD_F_MLZ(hi, lo);
+
+ MAD_F_ML0(hi, lo, yptr[12 + 6], wptr[6]);
+ MAD_F_MLA(hi, lo, yptr[24 + 0], wptr[0]);
+
+ z[i + 18] = MAD_F_MLZ(hi, lo);
+
+ z[i + 24] = mad_f_mul(yptr[24 + 6], wptr[6]);
+ z[i + 30] = 0;
+
+ ++yptr;
+ ++wptr;
+ }
+}
+
+/*
+ * NAME: III_overlap()
+ * DESCRIPTION: perform overlap-add of windowed IMDCT outputs
+ */
+static
+void III_overlap(mad_fixed_t const output[36], mad_fixed_t overlap[18],
+ mad_fixed_t sample[18][32], unsigned int sb)
+{
+ unsigned int i;
+
+# if defined(ASO_INTERLEAVE2)
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = overlap[0];
+ tmp2 = overlap[1];
+
+ for (i = 0; i < 16; i += 2) {
+ sample[i + 0][sb] = output[i + 0 + 0] + tmp1;
+ overlap[i + 0] = output[i + 0 + 18];
+ tmp1 = overlap[i + 2];
+
+ sample[i + 1][sb] = output[i + 1 + 0] + tmp2;
+ overlap[i + 1] = output[i + 1 + 18];
+ tmp2 = overlap[i + 3];
+ }
+
+ sample[16][sb] = output[16 + 0] + tmp1;
+ overlap[16] = output[16 + 18];
+ sample[17][sb] = output[17 + 0] + tmp2;
+ overlap[17] = output[17 + 18];
+ }
+# elif 0
+ for (i = 0; i < 18; i += 2) {
+ sample[i + 0][sb] = output[i + 0 + 0] + overlap[i + 0];
+ overlap[i + 0] = output[i + 0 + 18];
+
+ sample[i + 1][sb] = output[i + 1 + 0] + overlap[i + 1];
+ overlap[i + 1] = output[i + 1 + 18];
+ }
+# else
+ for (i = 0; i < 18; ++i) {
+ sample[i][sb] = output[i + 0] + overlap[i];
+ overlap[i] = output[i + 18];
+ }
+# endif
+}
+
+/*
+ * NAME: III_overlap_z()
+ * DESCRIPTION: perform "overlap-add" of zero IMDCT outputs
+ */
+static inline
+void III_overlap_z(mad_fixed_t overlap[18],
+ mad_fixed_t sample[18][32], unsigned int sb)
+{
+ unsigned int i;
+
+# if defined(ASO_INTERLEAVE2)
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = overlap[0];
+ tmp2 = overlap[1];
+
+ for (i = 0; i < 16; i += 2) {
+ sample[i + 0][sb] = tmp1;
+ overlap[i + 0] = 0;
+ tmp1 = overlap[i + 2];
+
+ sample[i + 1][sb] = tmp2;
+ overlap[i + 1] = 0;
+ tmp2 = overlap[i + 3];
+ }
+
+ sample[16][sb] = tmp1;
+ overlap[16] = 0;
+ sample[17][sb] = tmp2;
+ overlap[17] = 0;
+ }
+# else
+ for (i = 0; i < 18; ++i) {
+ sample[i][sb] = overlap[i];
+ overlap[i] = 0;
+ }
+# endif
+}
+
+/*
+ * NAME: III_freqinver()
+ * DESCRIPTION: perform subband frequency inversion for odd sample lines
+ */
+static
+void III_freqinver(mad_fixed_t sample[18][32], unsigned int sb)
+{
+ unsigned int i;
+
+# if 1 || defined(ASO_INTERLEAVE1) || defined(ASO_INTERLEAVE2)
+ {
+ register mad_fixed_t tmp1, tmp2;
+
+ tmp1 = sample[1][sb];
+ tmp2 = sample[3][sb];
+
+ for (i = 1; i < 13; i += 4) {
+ sample[i + 0][sb] = -tmp1;
+ tmp1 = sample[i + 4][sb];
+ sample[i + 2][sb] = -tmp2;
+ tmp2 = sample[i + 6][sb];
+ }
+
+ sample[13][sb] = -tmp1;
+ tmp1 = sample[17][sb];
+ sample[15][sb] = -tmp2;
+ sample[17][sb] = -tmp1;
+ }
+# else
+ for (i = 1; i < 18; i += 2)
+ sample[i][sb] = -sample[i][sb];
+# endif
+}
+
+/*
+ * NAME: III_decode()
+ * DESCRIPTION: decode frame main_data
+ */
+static
+enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
+ struct sideinfo *si, unsigned int nch)
+{
+ struct mad_header *header = &frame->header;
+ unsigned int sfreqi, ngr, gr;
+
+ {
+ unsigned int sfreq;
+
+ sfreq = header->samplerate;
+ if (header->flags & MAD_FLAG_MPEG_2_5_EXT)
+ sfreq *= 2;
+
+ /* 48000 => 0, 44100 => 1, 32000 => 2,
+ 24000 => 3, 22050 => 4, 16000 => 5 */
+ sfreqi = ((sfreq >> 7) & 0x000f) +
+ ((sfreq >> 15) & 0x0001) - 8;
+
+ if (header->flags & MAD_FLAG_MPEG_2_5_EXT)
+ sfreqi += 3;
+ }
+
+ /* scalefactors, Huffman decoding, requantization */
+
+ ngr = (header->flags & MAD_FLAG_LSF_EXT) ? 1 : 2;
+
+ for (gr = 0; gr < ngr; ++gr) {
+ struct granule *granule = &si->gr[gr];
+ unsigned char const *sfbwidth[2];
+ mad_fixed_t xr[2][576];
+ unsigned int ch;
+ enum mad_error error;
+
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel *channel = &granule->ch[ch];
+ unsigned int part2_length;
+
+ sfbwidth[ch] = sfbwidth_table[sfreqi].l;
+ if (channel->block_type == 2) {
+ sfbwidth[ch] = (channel->flags & mixed_block_flag) ?
+ sfbwidth_table[sfreqi].m : sfbwidth_table[sfreqi].s;
+ }
+
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+ part2_length = III_scalefactors_lsf(ptr, channel,
+ ch == 0 ? 0 : &si->gr[1].ch[1],
+ header->mode_extension);
+ }
+ else {
+ part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch],
+ gr == 0 ? 0 : si->scfsi[ch]);
+ }
+
+ error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length);
+ if (error)
+ return error;
+ }
+
+ /* joint stereo processing */
+
+ if (header->mode == MAD_MODE_JOINT_STEREO && header->mode_extension) {
+ error = III_stereo(xr, granule, header, sfbwidth[0]);
+ if (error)
+ return error;
+ }
+
+ /* reordering, alias reduction, IMDCT, overlap-add, frequency inversion */
+
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel const *channel = &granule->ch[ch];
+ mad_fixed_t (*sample)[32] = &frame->sbsample[ch][18 * gr];
+ unsigned int sb, l, i, sblimit;
+ mad_fixed_t output[36];
+
+ if (channel->block_type == 2) {
+ III_reorder(xr[ch], channel, sfbwidth[ch]);
+
+# if !defined(OPT_STRICT)
+ /*
+ * According to ISO/IEC 11172-3, "Alias reduction is not applied for
+ * granules with block_type == 2 (short block)." However, other
+ * sources suggest alias reduction should indeed be performed on the
+ * lower two subbands of mixed blocks. Most other implementations do
+ * this, so by default we will too.
+ */
+ if (channel->flags & mixed_block_flag)
+ III_aliasreduce(xr[ch], 36);
+# endif
+ }
+ else
+ III_aliasreduce(xr[ch], 576);
+
+ l = 0;
+
+ /* subbands 0-1 */
+
+ if (channel->block_type != 2 || (channel->flags & mixed_block_flag)) {
+ unsigned int block_type;
+
+ block_type = channel->block_type;
+ if (channel->flags & mixed_block_flag)
+ block_type = 0;
+
+ /* long blocks */
+ for (sb = 0; sb < 2; ++sb, l += 18) {
+ III_imdct_l(&xr[ch][l], output, block_type);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+ }
+ }
+ else {
+ /* short blocks */
+ for (sb = 0; sb < 2; ++sb, l += 18) {
+ III_imdct_s(&xr[ch][l], output);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+ }
+ }
+
+ III_freqinver(sample, 1);
+
+ /* (nonzero) subbands 2-31 */
+
+ i = 576;
+ while (i > 36 && xr[ch][i - 1] == 0)
+ --i;
+
+ sblimit = 32 - (576 - i) / 18;
+
+ if (channel->block_type != 2) {
+ /* long blocks */
+ for (sb = 2; sb < sblimit; ++sb, l += 18) {
+ III_imdct_l(&xr[ch][l], output, channel->block_type);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+
+ if (sb & 1)
+ III_freqinver(sample, sb);
+ }
+ }
+ else {
+ /* short blocks */
+ for (sb = 2; sb < sblimit; ++sb, l += 18) {
+ III_imdct_s(&xr[ch][l], output);
+ III_overlap(output, (*frame->overlap)[ch][sb], sample, sb);
+
+ if (sb & 1)
+ III_freqinver(sample, sb);
+ }
+ }
+
+ /* remaining (zero) subbands */
+
+ for (sb = sblimit; sb < 32; ++sb) {
+ III_overlap_z((*frame->overlap)[ch][sb], sample, sb);
+
+ if (sb & 1)
+ III_freqinver(sample, sb);
+ }
+ }
+ }
+
+ return MAD_ERROR_NONE;
+}
+
+/*
+ * NAME: layer->III()
+ * DESCRIPTION: decode a single Layer III frame
+ */
+int mad_layer_III(struct mad_stream *stream, struct mad_frame *frame)
+{
+ struct mad_header *header = &frame->header;
+ unsigned int nch, priv_bitlen, next_md_begin = 0;
+ unsigned int si_len, data_bitlen, md_len;
+ unsigned int frame_space, frame_used, frame_free;
+ struct mad_bitptr ptr;
+ struct sideinfo si;
+ enum mad_error error;
+ int result = 0;
+
+ /* allocate Layer III dynamic structures */
+
+ if (stream->main_data == 0) {
+ stream->main_data = malloc(MAD_BUFFER_MDLEN);
+ if (stream->main_data == 0) {
+ stream->error = MAD_ERROR_NOMEM;
+ return -1;
+ }
+ }
+
+ if (frame->overlap == 0) {
+ frame->overlap = calloc(2 * 32 * 18, sizeof(mad_fixed_t));
+ if (frame->overlap == 0) {
+ stream->error = MAD_ERROR_NOMEM;
+ return -1;
+ }
+ }
+
+ nch = MAD_NCHANNELS(header);
+ si_len = (header->flags & MAD_FLAG_LSF_EXT) ?
+ (nch == 1 ? 9 : 17) : (nch == 1 ? 17 : 32);
+
+ /* check frame sanity */
+
+ if (stream->next_frame - mad_bit_nextbyte(&stream->ptr) <
+ (signed int) si_len) {
+ stream->error = MAD_ERROR_BADFRAMELEN;
+ stream->md_len = 0;
+ return -1;
+ }
+
+ /* check CRC word */
+
+ if (header->flags & MAD_FLAG_PROTECTION) {
+ header->crc_check =
+ mad_bit_crc(stream->ptr, si_len * CHAR_BIT, header->crc_check);
+
+ if (header->crc_check != header->crc_target &&
+ !(frame->options & MAD_OPTION_IGNORECRC)) {
+ stream->error = MAD_ERROR_BADCRC;
+ result = -1;
+ }
+ }
+
+ /* decode frame side information */
+
+ error = III_sideinfo(&stream->ptr, nch, header->flags & MAD_FLAG_LSF_EXT,
+ &si, &data_bitlen, &priv_bitlen);
+ if (error && result == 0) {
+ stream->error = error;
+ result = -1;
+ }
+
+ header->flags |= priv_bitlen;
+ header->private_bits |= si.private_bits;
+
+ /* find main_data of next frame */
+
+ {
+ struct mad_bitptr peek;
+ unsigned long header;
+
+ mad_bit_init(&peek, stream->next_frame);
+
+ header = mad_bit_read(&peek, 32);
+ if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) {
+ if (!(header & 0x00010000L)) /* protection_bit */
+ mad_bit_skip(&peek, 16); /* crc_check */
+
+ next_md_begin =
+ mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8);
+ }
+
+ mad_bit_finish(&peek);
+ }
+
+ /* find main_data of this frame */
+
+ frame_space = stream->next_frame - mad_bit_nextbyte(&stream->ptr);
+
+ if (next_md_begin > si.main_data_begin + frame_space)
+ next_md_begin = 0;
+
+ md_len = si.main_data_begin + frame_space - next_md_begin;
+
+ frame_used = 0;
+
+ if (si.main_data_begin == 0) {
+ ptr = stream->ptr;
+ stream->md_len = 0;
+
+ frame_used = md_len;
+ }
+ else {
+ if (si.main_data_begin > stream->md_len) {
+ if (result == 0) {
+ stream->error = MAD_ERROR_BADDATAPTR;
+ result = -1;
+ }
+ }
+ else {
+ mad_bit_init(&ptr,
+ *stream->main_data + stream->md_len - si.main_data_begin);
+
+ if (md_len > si.main_data_begin) {
+ assert(stream->md_len + md_len -
+ si.main_data_begin <= MAD_BUFFER_MDLEN);
+
+ memcpy(*stream->main_data + stream->md_len,
+ mad_bit_nextbyte(&stream->ptr),
+ frame_used = md_len - si.main_data_begin);
+ stream->md_len += frame_used;
+ }
+ }
+ }
+
+ frame_free = frame_space - frame_used;
+
+ /* decode main_data */
+
+ if (result == 0) {
+ error = III_decode(&ptr, frame, &si, nch);
+ if (error) {
+ stream->error = error;
+ result = -1;
+ }
+
+ /* designate ancillary bits */
+
+ stream->anc_ptr = ptr;
+ stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen;
+ }
+
+# if 0 && defined(DEBUG)
+ fprintf(stderr,
+ "main_data_begin:%u, md_len:%u, frame_free:%u, "
+ "data_bitlen:%u, anc_bitlen: %u\n",
+ si.main_data_begin, md_len, frame_free,
+ data_bitlen, stream->anc_bitlen);
+# endif
+
+ /* preload main_data buffer with up to 511 bytes for next frame(s) */
+
+ if (frame_free >= next_md_begin) {
+ memcpy(*stream->main_data,
+ stream->next_frame - next_md_begin, next_md_begin);
+ stream->md_len = next_md_begin;
+ }
+ else {
+ if (md_len < si.main_data_begin) {
+ unsigned int extra;
+
+ extra = si.main_data_begin - md_len;
+ if (extra + frame_free > next_md_begin)
+ extra = next_md_begin - frame_free;
+
+ if (extra < stream->md_len) {
+ memmove(*stream->main_data,
+ *stream->main_data + stream->md_len - extra, extra);
+ stream->md_len = extra;
+ }
+ }
+ else
+ stream->md_len = 0;
+
+ memcpy(*stream->main_data + stream->md_len,
+ stream->next_frame - frame_free, frame_free);
+ stream->md_len += frame_free;
+ }
+
+ return result;
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer3.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer3.h
new file mode 100644
index 000000000..f59a9996f
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/layer3.h
@@ -0,0 +1,30 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: layer3.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_LAYER3_H
+# define LIBMAD_LAYER3_H
+
+# include "stream.h"
+# include "frame.h"
+
+int mad_layer_III(struct mad_stream *, struct mad_frame *);
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/libmad.list.in b/src/filters/transform/mpadecfilter/libmad-0.15.0b/libmad.list.in
new file mode 100644
index 000000000..2263ad659
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/libmad.list.in
@@ -0,0 +1,21 @@
+# @configure_input@
+
+# Directories...
+$prefix=@prefix@
+$exec_prefix=@exec_prefix@
+$srcdir=@srcdir@
+
+# Product information
+%product @PACKAGE@
+%copyright GPL
+%vendor Underbit Technologies, Inc. <info@underbit.com>
+%license @srcdir@/COPYING
+%readme @srcdir@/README
+%description libmad is an MPEG audio decoder library.
+%version @VERSION@
+%packager Giuseppe "Cowo" Corbelli <cowo@lugbs.linux.it>
+
+%system all
+f 0755 root root @libdir@/libmad.la .libs/libmad.lai
+f 0644 root root @libdir@/libmad.a .libs/libmad.a
+f 0644 root root @includedir@/mad.h mad.h
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/ltmain.sh b/src/filters/transform/mpadecfilter/libmad-0.15.0b/ltmain.sh
new file mode 100644
index 000000000..2df986ca4
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/ltmain.sh
@@ -0,0 +1,5107 @@
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The name of this program.
+progname=`$echo "$0" | ${SED} 's%^.*/%%'`
+modename="$progname"
+
+# Constants.
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.4.3
+TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo A|od -x` in
+ *[Cc]1*) # EBCDIC based system
+ SP2NL="tr '\100' '\n'"
+ NL2SP="tr '\r\n' '\100\100'"
+ ;;
+ *) # Assume ASCII based system
+ SP2NL="tr '\040' '\012'"
+ NL2SP="tr '\015\012' '\040\040'"
+ ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+if test "${LC_ALL+set}" = set; then
+ save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
+fi
+if test "${LANG+set}" = set; then
+ save_LANG="$LANG"; LANG=C; export LANG
+fi
+
+# Make sure IFS has a sensible default
+: ${IFS=" "}
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ echo "$modename: not configured to build any kind of library" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+
+# Parse our command line options once, thoroughly.
+while test $# -gt 0
+do
+ arg="$1"
+ shift
+
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ execute_dlfiles)
+ execute_dlfiles="$execute_dlfiles $arg"
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case $arg in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ exit 0
+ ;;
+
+ --config)
+ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
+ exit 0
+ ;;
+
+ --debug)
+ echo "$progname: enabling shell trace mode"
+ set -x
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+ exit 0
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --preserve-dup-deps) duplicate_deps="yes" ;;
+
+ --quiet | --silent)
+ show=:
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+fi
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ case $nonopt in
+ *cc | *++ | gcc* | *-gcc* | g++* | xlc*)
+ mode=link
+ for arg
+ do
+ case $arg in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case $mode in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ prev=
+ lastarg=
+ srcfile="$nonopt"
+ suppress_output=
+
+ user_target=no
+ for arg
+ do
+ case $prev in
+ "") ;;
+ xcompiler)
+ # Aesthetically quote the previous argument.
+ prev=
+ lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+
+ case $arg in
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ continue
+ ;;
+ esac
+
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ if test "$user_target" != "no"; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit 1
+ fi
+ user_target=next
+ ;;
+
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ lastarg="$lastarg $arg"
+ done
+ IFS="$save_ifs"
+ lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+ # Add the arguments to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ continue
+ ;;
+ esac
+
+ case $user_target in
+ next)
+ # The next one is the -o target name
+ user_target=yes
+ continue
+ ;;
+ yes)
+ # We got the output file
+ user_target=set
+ libobj="$arg"
+ continue
+ ;;
+ esac
+
+ # Accept the current argument as the source file.
+ lastarg="$srcfile"
+ srcfile="$arg"
+
+ # Aesthetically quote the previous argument.
+
+ # Backslashify any backslashes, double quotes, and dollar signs.
+ # These are the only characters that are still specially
+ # interpreted inside of double-quoted scrings.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $lastarg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ # Add the previous argument to base_compile.
+ if test -z "$base_compile"; then
+ base_compile="$lastarg"
+ else
+ base_compile="$base_compile $lastarg"
+ fi
+ done
+
+ case $user_target in
+ set)
+ ;;
+ no)
+ # Get the name of the library object.
+ libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ *)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSfmso]'
+ case $libobj in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case $libobj in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $libobj"
+ else
+ removelist="$libobj"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit 1" 1 2 15
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit 1" 1 2 15
+ else
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $run ln "$0" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+ echo $srcfile > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ # All platforms use -DPIC, to notify preprocessed assembler code.
+ command="$base_compile $srcfile $pic_flag -DPIC"
+ else
+ # Don't build PIC code
+ command="$base_compile $srcfile"
+ fi
+ if test "$build_old_libs" = yes; then
+ lo_libobj="$libobj"
+ dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$libobj"; then
+ dir="$objdir"
+ else
+ dir="$dir/$objdir"
+ fi
+ libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+
+ if test -d "$dir"; then
+ $show "$rm $libobj"
+ $run $rm $libobj
+ else
+ $show "$mkdir $dir"
+ $run $mkdir $dir
+ status=$?
+ if test $status -ne 0 && test ! -d $dir; then
+ exit $status
+ fi
+ fi
+ fi
+ if test "$compiler_o_lo" = yes; then
+ output_obj="$libobj"
+ command="$command -o $output_obj"
+ elif test "$compiler_c_o" = yes; then
+ output_obj="$obj"
+ command="$command -o $output_obj"
+ fi
+
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test x"$output_obj" != x"$libobj"; then
+ $show "$mv $output_obj $libobj"
+ if $run $mv $output_obj $libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # If we have no pic_flag, then copy the object into place and finish.
+ if (test -z "$pic_flag" || test "$pic_mode" != default) &&
+ test "$build_old_libs" = yes; then
+ # Rename the .lo from within objdir to obj
+ if test -f $obj; then
+ $show $rm $obj
+ $run $rm $obj
+ fi
+
+ $show "$mv $libobj $obj"
+ if $run $mv $libobj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
+ libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ # Now arrange that obj and lo_libobj become the same file
+ $show "(cd $xdir && $LN_S $baseobj $libobj)"
+ if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
+ fi
+ exit 0
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Allow error messages only from the first compilation.
+ suppress_output=' >/dev/null 2>&1'
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $srcfile"
+ else
+ # All platforms use -DPIC, to notify preprocessed assembler code.
+ command="$base_compile $srcfile $pic_flag -DPIC"
+ fi
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ output_obj="$obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit 1
+ fi
+
+ if test "$need_locks" = warn &&
+ test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
+ echo "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit 1
+ fi
+
+ # Just move the object if needed
+ if test x"$output_obj" != x"$obj"; then
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we do not
+ # accidentally link it into a program.
+ if test "$build_libtool_libs" != yes; then
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > \$libobj" || exit $?
+ else
+ # Move the .lo from within objdir
+ $show "$mv $libobj $lo_libobj"
+ if $run $mv $libobj $lo_libobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
+ fi
+ fi
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
+ fi
+
+ exit 0
+ ;;
+
+ # libtool link mode
+ link | relink)
+ modename="$modename: link"
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invokation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args="$nonopt"
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -all-static | -static)
+ if test "X$arg" = "X-all-static"; then
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ else
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ fi
+ build_libtool_libs=no
+ build_old_libs=yes
+ prefer_static_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test $# -gt 0; do
+ arg="$1"
+ shift
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+ ;;
+ *) qarg=$arg ;;
+ esac
+ libtool_args="$libtool_args $qarg"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit 1
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
+ prev=
+ compile_command="$compile_command $wl$qarg"
+ finalize_command="$finalize_command $wl$qarg"
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n $prev
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: more than one -exported-symbols argument is not allowed"
+ exit 1
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | no/*-*-nonstopux*)
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+ exit 1
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "*) ;;
+ *)
+ deplibs="$deplibs -L$dir"
+ lib_search_path="$lib_search_path $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-pw32* | *-*-beos*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-mingw* | *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # in order for the loader to find any dlls it needs.
+ $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+ $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit 1
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ continue
+ ;;
+
+ -static)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Wl,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $wl$flag"
+ linker_flags="$linker_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.lo | *.$objext)
+ # A library or standard object.
+ if test "$prev" = dlfiles; then
+ # This file was specified with -dlopen.
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $arg"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
+ prev=
+ else
+ case $arg in
+ *.lo) libobjs="$libobjs $arg" ;;
+ *) objs="$objs $arg" ;;
+ esac
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ deplibs="$deplibs $arg"
+ old_deplibs="$old_deplibs $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ dlfiles="$dlfiles $arg"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ dlprefiles="$dlprefiles $arg"
+ prev=
+ else
+ deplibs="$deplibs $arg"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done # argument parsing loop
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+ # Create the object directory.
+ if test ! -d $output_objdir; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ status=$?
+ if test $status -ne 0 && test ! -d $output_objdir; then
+ exit $status
+ fi
+ fi
+
+ # Determine the type of output
+ case $output in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ specialdeplibs=
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ libs="$libs $deplib"
+ done
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ notinst_path= # paths that contain not-installed libtool libraries
+ case $linkmode in
+ lib)
+ passes="conv link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+ for pass in $passes; do
+ if test $linkmode = prog; then
+ # Determine which files to process
+ case $pass in
+ dlopen)
+ libs="$dlfiles"
+ save_deplibs="$deplibs" # Collect dlpreopened libraries
+ deplibs=
+ ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ esac
+ fi
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -l*)
+ if test $linkmode = oldlib && test $linkmode = obj; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
+ continue
+ fi
+ if test $pass = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}.la"
+ if test -f "$lib"; then
+ found=yes
+ break
+ fi
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ ;; # -l
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test $pass = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ ;;
+ prog)
+ if test $pass = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test $pass = scan; then
+ deplibs="$deplib $deplibs"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ ;;
+ *)
+ $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test $pass = link; then
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) xrpath="$xrpath $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la) lib="$deplib" ;;
+ *.$libext)
+ if test $pass = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ if test "$deplibs_check_method" != pass_all; then
+ echo
+ echo "*** Warning: Trying to link with static lib archive $deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because the file extensions .$libext of this argument makes me believe"
+ echo "*** that it is just a static archive that I should not used here."
+ else
+ echo
+ echo "*** Warning: Linking the shared library $output against the"
+ echo "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
+ prog)
+ if test $pass != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ newdlprefiles="$newdlprefiles $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ newdlfiles="$newdlfiles $deplib"
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+ if test $found = yes || test -f "$lib"; then :
+ else
+ $echo "$modename: cannot find the library \`$lib'" 1>&2
+ exit 1
+ fi
+
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variable installed.
+ installed=yes
+
+ # Read the .la file
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test $linkmode = oldlib && test $linkmode = obj; }; then
+ # Add dl[pre]opened files of deplib
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+ if test $pass = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit 1
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+ elif test $linkmode != prog && test $linkmode != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit 1
+ fi
+ continue
+ fi # $pass = conv
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit 1
+ fi
+
+ # This library was specified with -dlopen.
+ if test $pass = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit 1
+ fi
+ if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload.
+ dlprefiles="$dlprefiles $lib"
+ else
+ newdlfiles="$newdlfiles $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ $echo "$modename: warning: library \`$lib' was moved." 1>&2
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$libdir"
+ absdir="$libdir"
+ fi
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi # $installed = yes
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+ if test $pass = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit 1
+ fi
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ newdlprefiles="$newdlprefiles $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ newdlprefiles="$newdlprefiles $dir/$dlname"
+ else
+ newdlprefiles="$newdlprefiles $dir/$linklib"
+ fi
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test $linkmode = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs"
+ fi
+ continue
+ fi
+
+ if test $linkmode = prog && test $pass != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+ esac
+ # Need to link against all dependency_libs?
+ if test $linkalldeplibs = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ link_static=no # Whether the deplib will be linked statically
+ if test -n "$library_names" &&
+ { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
+ # Link against this shared library
+
+ if test "$linkmode,$pass" = "prog,link" ||
+ { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ if test $linkmode = prog; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var"; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *" $absdir "*) ;;
+ *) temp_rpath="$temp_rpath $dir" ;;
+ esac
+ fi
+ fi
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+ libname=`eval \\$echo \"$libname_spec\"`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin*)
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ soname=`echo $soroot | ${SED} -e 's/^.*\///'`
+ newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ $show "extracting exported symbol list from \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ eval cmds=\"$extract_expsyms_cmds\"
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ $show "generating import library for \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ eval cmds=\"$old_archive_from_expsyms_cmds\"
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n $old_archive_from_expsyms_cmds
+
+ if test $linkmode = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\/]*)
+ add_dir="-L$inst_prefix_dir$libdir $add_dir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit 1
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+ if test $linkmode = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes && \
+ test "$hardcode_minus_L" != yes && \
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test $linkmode = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ add="-l$name"
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case "$libdir" in
+ [\/]*)
+ add_dir="-L$inst_prefix_dir$libdir $add_dir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test $linkmode = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test $linkmode = prog; then
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+
+ # Try to link the static library
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ echo
+ echo "*** Warning: This system can not link to static lib archive $lib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ echo "*** But as you try to build a module library, libtool will still create "
+ echo "*** a static module, that should work as long as the dlopening application"
+ echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ convenience="$convenience $dir/$old_library"
+ old_convenience="$old_convenience $dir/$old_library"
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test $linkmode = lib; then
+ if test -n "$dependency_libs" &&
+ { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
+ test $link_static = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ *) temp_deplibs="$temp_deplibs $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ newlib_search_path="$newlib_search_path $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+ if test $link_all_deplibs != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$deplib" && dir="."
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if grep "^installed=no" $deplib > /dev/null; then
+ path="-L$absdir/$objdir"
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ if test "$absdir" != "$libdir"; then
+ $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+ fi
+ path="-L$absdir"
+ fi
+ ;;
+ *) continue ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$deplibs $path" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ if test $pass = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test $pass != dlopen; then
+ test $pass != scan && dependency_libs="$newdependency_libs"
+ if test $pass != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ if test "$pass" = "conv" &&
+ { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
+ libs="$deplibs" # reset libs
+ deplibs=
+ fi
+ done # for pass
+ if test $linkmode = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
+
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ objs="$objs$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ eval libname=\"$libname_spec\"
+ else
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+ exit 1
+ else
+ echo
+ echo "*** Warning: Linking the shared library $output against the non-libtool"
+ echo "*** objects $objs is not portable!"
+ libobjs="$libobjs $objs"
+ fi
+ fi
+
+ if test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+ fi
+
+ set dummy $rpath
+ if test $# -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ libext=al
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ IFS="$save_ifs"
+
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ current="$2"
+ revision="$3"
+ age="$4"
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case $revision in
+ 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case $age in
+ 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test $age -gt $current; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit 1
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ minor_current=`expr $current + 1`
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current";
+ ;;
+
+ irix | nonstopux)
+ major=`expr $current - $age + 1`
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test $loop != 0; do
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux)
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ major=.`expr $current - $age`
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test $loop != 0; do
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ verstring="$verstring:${current}.0"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+
+ *)
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ verstring="0.0"
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=""
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+ fi
+
+ if test "$mode" != relink; then
+ # Remove our outputs.
+ $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
+ $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ for path in $notinst_path; do
+ lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
+ deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
+ dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
+ done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ temp_xrpath="$temp_xrpath -R$libdir"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) dlfiles="$dlfiles $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) dlprefiles="$dlprefiles $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ deplibs="$deplibs -framework System"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test $build_libtool_need_lc = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behaviour.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ $CC -o conftest conftest.c $deplibs
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which I believe you do not have"
+ echo "*** because a test_compile did reveal that the linker did not use it for"
+ echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occured in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ name="`expr $i : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ $rm conftest
+ $CC -o conftest conftest.c $i
+ # Did it work?
+ if test $? -eq 0 ; then
+ ldd_output=`ldd conftest`
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because a test_compile did reveal that the linker did not use this one"
+ echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ else
+ droppeddeps=yes
+ echo
+ echo "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | ${SED} 10q \
+ | egrep "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ echo "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ echo "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ echo "*** with $libname and none of the candidates passed a file format test"
+ echo "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name="`expr $a_deplib : '-l\(.*\)'`"
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check below in file_magic test
+ if eval echo \"$potent_lib\" 2>/dev/null \
+ | ${SED} 10q \
+ | egrep "$match_pattern_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ echo "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ echo "*** with $libname and none of the candidates passed a file format test"
+ echo "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
+ grep . >/dev/null; then
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ echo "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+
+ if test $allow_undefined = no; then
+ echo
+ echo "*** Since this library must not contain undefined symbols,"
+ echo "*** because either the platform does not support them or"
+ echo "*** it was explicitly requested with -no-undefined,"
+ echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ if test $hardcode_into_libs = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ dep_rpath="$dep_rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ test -z "$dlname" && dlname=$soname
+
+ lib="$output_objdir/$realname"
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Ensure that we have .o objects for linkers which dislike .lo
+ # (e.g. aix) in case we are running --disable-static
+ for obj in $libobjs; do
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ if test ! -f $xdir/$oldobj; then
+ $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
+ $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
+ fi
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ eval cmds=\"$export_symbols_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linker_flags="$linker_flags $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval cmds=\"$archive_expsym_cmds\"
+ else
+ save_deplibs="$deplibs"
+ for conv in $convenience; do
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ if test "$test_deplib" != "$conv"; then
+ tmp_deplibs="$tmp_deplibs $test_deplib"
+ fi
+ done
+ deplibs="$tmp_deplibs"
+ done
+ eval cmds=\"$archive_cmds\"
+ deplibs="$save_deplibs"
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+ exit 0
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
+ fi
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
+
+ case $output in
+ *.lo)
+ if test -n "$objs$old_deplibs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit 1
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $run $rm $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${obj}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ for xlib in $convenience; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ eval cmds=\"$reload_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ $show "echo timestamp > $libobj"
+ $run eval "echo timestamp > $libobj" || exit $?
+ exit 0
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ eval cmds=\"$reload_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ else
+ # Just create a symlink.
+ $show $rm $libobj
+ $run $rm $libobj
+ xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$libobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
+ oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
+ $show "(cd $xdir && $LN_S $oldobj $baseobj)"
+ $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit 0
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+ esac
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ case $host in
+ *darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ ;;
+ esac
+ ;;
+ esac
+
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$libdir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case $dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$output.exp"
+ $run $rm $export_symbols
+ $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ else
+ $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
+ $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
+ $run eval 'echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DPIC";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit 1
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+ fi
+
+ if test $need_relink = no || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $run $rm $output
+ # Link the executable and exit
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+ exit 0
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
+ case $0 in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*) exeext=.exe ;;
+ *) exeext= ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit 1" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ echo >> $output "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $echo \"\$relink_command_output\" >&2
+ $rm \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 ${SED}
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # win32 systems need to use the prog path for dll
+ # lookup to work
+ *-*-cygwin* | *-*-pw32*)
+ $echo >> $output "\
+ exec \$progdir/\$program \${1+\"\$@\"}
+"
+ ;;
+
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \$progdir\\\\\$program \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ # Export the path to the program.
+ PATH=\"\$progdir:\$PATH\"
+ export PATH
+
+ exec \$program \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit 0
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "mkdir $gentop"
+ $run mkdir "$gentop"
+ status=$?
+ if test $status -ne 0 && test ! -d "$gentop"; then
+ exit $status
+ fi
+ generated="$generated $gentop"
+
+ # Add in members from convenience archives.
+ for xlib in $addlibs; do
+ # Extract the objects.
+ case $xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
+ *) xabs=`pwd`"/$xlib" ;;
+ esac
+ xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
+ xdir="$gentop/$xlib"
+
+ $show "${rm}r $xdir"
+ $run ${rm}r "$xdir"
+ $show "mkdir $xdir"
+ $run mkdir "$xdir"
+ status=$?
+ if test $status -ne 0 && test ! -d "$xdir"; then
+ exit $status
+ fi
+ $show "(cd $xdir && $AR x $xabs)"
+ $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
+
+ oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
+ done
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ eval cmds=\"$old_archive_from_new_cmds\"
+ else
+ # Ensure that we have .o objects in place in case we decided
+ # not to build a shared library, and have fallen back to building
+ # static libs even though --disable-static was passed!
+ for oldobj in $oldobjs; do
+ if test ! -f $oldobj; then
+ xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$oldobj"; then
+ xdir="."
+ else
+ xdir="$xdir"
+ fi
+ baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
+ obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
+ $show "(cd $xdir && ${LN_S} $obj $baseobj)"
+ $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
+ fi
+ done
+
+ eval cmds=\"$old_archive_cmds\"
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ newdependency_libs="$newdependency_libs $libdir/$name"
+ ;;
+ *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+ for lib in $dlfiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ newdlfiles="$newdlfiles $libdir/$name"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit 1
+ fi
+ newdlprefiles="$newdlprefiles $libdir/$name"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $rm $output
+ # place dlname in correct position for cygwin
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test $need_relink = yes; then
+ $echo >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+ ;;
+ esac
+ exit 0
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg="$nonopt"
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest="$arg"
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f) prev="-f" ;;
+ -g) prev="-g" ;;
+ -m) prev="-m" ;;
+ -o) prev="-o" ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*) ;;
+
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest="$arg"
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test $# -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ library_names=
+ old_library=
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit 1
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
+ fi
+
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ exit 1
+ fi
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$srcname $destdir/$realname"
+ $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$striplib $destdir/$realname"
+ $run eval "$striplib $destdir/$realname" || exit $?
+ fi
+
+ if test $# -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ eval cmds=\"$postinstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit 0
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin*|*mingw*)
+ wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+ notinst_deplibs=
+ relink_command=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $wrapper ;;
+ *) . ./$wrapper ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$notinst_deplibs"; then
+ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+ exit 1
+ fi
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $wrapper ;;
+ *) . ./$wrapper ;;
+ esac
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir="/tmp"
+ test -n "$TMPDIR" && tmpdir="$TMPDIR"
+ tmpdir="$tmpdir/libtool-$$"
+ if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
+ else
+ $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
+ continue
+ fi
+ file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyways
+ case $install_prog,$host in
+ /usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
+ ;;
+ esac
+ ;;
+ esac
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$old_striplib $oldlib"
+ $run eval "$old_striplib $oldlib" || exit $?
+ fi
+
+ # Do each command in the postinstall commands.
+ eval cmds=\"$old_postinstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $0 --finish$current_libdirs'
+ else
+ exit 0
+ fi
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ eval cmds=\"$finish_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = ":" && exit 0
+
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ echo " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+ echo "See any operating system documentation about shared libraries for"
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ echo "----------------------------------------------------------------------"
+ exit 0
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit 1
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit 1
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved enviroment variables
+ if test "${save_LC_ALL+set}" = set; then
+ LC_ALL="$save_LC_ALL"; export LC_ALL
+ fi
+ if test "${save_LANG+set}" = set; then
+ LANG="$save_LANG"; export LANG
+ fi
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit 0
+ fi
+ ;;
+
+ # libtool clean and uninstall mode
+ clean | uninstall)
+ modename="$modename: $mode"
+ rm="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) rm="$rm $arg"; rmforce=yes ;;
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ fi
+
+ rmdirs=
+
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$file"; then
+ dir=.
+ objdir="$objdir"
+ else
+ objdir="$dir/$objdir"
+ fi
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ test $mode = uninstall && objdir="$dir"
+
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test $mode = clean; then
+ case " $rmdirs " in
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if (test -L "$file") >/dev/null 2>&1 \
+ || (test -h "$file") >/dev/null 2>&1 \
+ || test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $objdir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+ test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+
+ if test $mode = uninstall; then
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ eval cmds=\"$postuninstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test $? != 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ eval cmds=\"$old_postuninstall_cmds\"
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test $? != 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ fi
+ fi
+ ;;
+
+ *.lo)
+ if test "$build_old_libs" = yes; then
+ oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
+ rmfiles="$rmfiles $dir/$oldobj"
+ fi
+ ;;
+
+ *)
+ # Do a test to see if this is a libtool program.
+ if test $mode = clean &&
+ (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$file
+
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ rmfiles="$rmfiles $objdir/lt-$name"
+ fi
+ fi
+ ;;
+ esac
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles || exit_status=1
+ done
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ $show "rmdir $dir"
+ $run rmdir $dir >/dev/null 2>&1
+ fi
+ done
+
+ exit $exit_status
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ ;;
+ esac
+
+ if test -z "$exec_cmd"; then
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit 1
+ fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+ eval exec $exec_cmd
+ exit 1
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --version print version information
+
+MODE must be one of the following:
+
+ clean remove files from the build directory
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE."
+ exit 0
+ ;;
+
+clean)
+ $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit 1
+ ;;
+esac
+
+echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/mad.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/mad.h
new file mode 100644
index 000000000..112607015
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/mad.h
@@ -0,0 +1,948 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * If you would like to negotiate alternate licensing terms, you may do
+ * so by contacting: Underbit Technologies, Inc. <info@underbit.com>
+ */
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# define FPM_INTEL
+
+
+
+# define SIZEOF_INT 4
+# define SIZEOF_LONG 4
+# define SIZEOF_LONG_LONG 8
+
+
+/* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
+
+# ifndef LIBMAD_VERSION_H
+# define LIBMAD_VERSION_H
+
+# define MAD_VERSION_MAJOR 0
+# define MAD_VERSION_MINOR 15
+# define MAD_VERSION_PATCH 0
+# define MAD_VERSION_EXTRA " (beta)"
+
+# define MAD_VERSION_STRINGIZE(str) #str
+# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num)
+
+# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \
+ MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \
+ MAD_VERSION_STRING(MAD_VERSION_PATCH) \
+ MAD_VERSION_EXTRA
+
+# define MAD_PUBLISHYEAR "2000-2003"
+# define MAD_AUTHOR "Underbit Technologies, Inc."
+# define MAD_EMAIL "info@underbit.com"
+
+extern char const mad_version[];
+extern char const mad_copyright[];
+extern char const mad_author[];
+extern char const mad_build[];
+
+# endif
+
+/* Id: fixed.h,v 1.36 2003/05/28 04:36:00 rob Exp */
+
+# ifndef LIBMAD_FIXED_H
+# define LIBMAD_FIXED_H
+
+# if SIZEOF_INT >= 4
+typedef signed int mad_fixed_t;
+
+typedef signed int mad_fixed64hi_t;
+typedef unsigned int mad_fixed64lo_t;
+# else
+typedef signed long mad_fixed_t;
+
+typedef signed long mad_fixed64hi_t;
+typedef unsigned long mad_fixed64lo_t;
+# endif
+
+# if defined(_MSC_VER)
+# define mad_fixed64_t signed __int64
+# elif 1 || defined(__GNUC__)
+# define mad_fixed64_t signed long long
+# endif
+
+# if defined(FPM_FLOAT)
+typedef double mad_sample_t;
+# else
+typedef mad_fixed_t mad_sample_t;
+# endif
+
+/*
+ * Fixed-point format: 0xABBBBBBB
+ * A == whole part (sign + 3 bits)
+ * B == fractional part (28 bits)
+ *
+ * Values are signed two's complement, so the effective range is:
+ * 0x80000000 to 0x7fffffff
+ * -8.0 to +7.9999999962747097015380859375
+ *
+ * The smallest representable value is:
+ * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
+ *
+ * 28 bits of fractional accuracy represent about
+ * 8.6 digits of decimal accuracy.
+ *
+ * Fixed-point numbers can be added or subtracted as normal
+ * integers, but multiplication requires shifting the 64-bit result
+ * from 56 fractional bits back to 28 (and rounding.)
+ *
+ * Changing the definition of MAD_F_FRACBITS is only partially
+ * supported, and must be done with care.
+ */
+
+# define MAD_F_FRACBITS 28
+
+# if MAD_F_FRACBITS == 28
+# define MAD_F(x) ((mad_fixed_t) (x##L))
+# else
+# if MAD_F_FRACBITS < 28
+# warning "MAD_F_FRACBITS < 28"
+# define MAD_F(x) ((mad_fixed_t) \
+ (((x##L) + \
+ (1L << (28 - MAD_F_FRACBITS - 1))) >> \
+ (28 - MAD_F_FRACBITS)))
+# elif MAD_F_FRACBITS > 28
+# error "MAD_F_FRACBITS > 28 not currently supported"
+# define MAD_F(x) ((mad_fixed_t) \
+ ((x##L) << (MAD_F_FRACBITS - 28)))
+# endif
+# endif
+
+# define MAD_F_MIN ((mad_fixed_t) -0x80000000L)
+# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL)
+
+# define MAD_F_ONE MAD_F(0x10000000)
+
+# define mad_f_tofixed(x) ((mad_fixed_t) \
+ ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5))
+# define mad_f_todouble(x) ((double) \
+ ((x) / (double) (1L << MAD_F_FRACBITS)))
+
+# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS)
+# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1))
+ /* (x should be positive) */
+
+# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS)
+
+# define mad_f_add(x, y) ((x) + (y))
+# define mad_f_sub(x, y) ((x) - (y))
+
+# if defined(FPM_FLOAT)
+# error "FPM_FLOAT not yet supported"
+
+# undef MAD_F
+# define MAD_F(x) mad_f_todouble(x)
+
+# define mad_f_mul(x, y) ((x) * (y))
+# define mad_f_scale64
+
+# undef ASO_ZEROCHECK
+
+# elif defined(FPM_64BIT)
+
+/*
+ * This version should be the most accurate if 64-bit types are supported by
+ * the compiler, although it may not be the most efficient.
+ */
+# if defined(OPT_ACCURACY)
+# define mad_f_mul(x, y) \
+ ((mad_fixed_t) \
+ ((((mad_fixed64_t) (x) * (y)) + \
+ (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS))
+# else
+# define mad_f_mul(x, y) \
+ ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS))
+# endif
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+
+/* --- Intel --------------------------------------------------------------- */
+
+# elif defined(FPM_INTEL)
+
+# if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable: 4035) /* no return value */
+static __forceinline
+mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
+{
+ enum {
+ fracbits = MAD_F_FRACBITS
+ };
+
+ __asm {
+ mov eax, x
+ imul y
+ shrd eax, edx, fracbits
+ }
+
+ /* implicit return of eax */
+}
+# pragma warning(pop)
+
+# define mad_f_mul mad_f_mul_inline
+# define mad_f_scale64
+# else
+/*
+ * This Intel version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("imull %3" \
+ : "=a" (lo), "=d" (hi) \
+ : "%a" (x), "rm" (y) \
+ : "cc")
+
+# if defined(OPT_ACCURACY)
+/*
+ * This gives best accuracy but is not very fast.
+ */
+# define MAD_F_MLA(hi, lo, x, y) \
+ ({ mad_fixed64hi_t __hi; \
+ mad_fixed64lo_t __lo; \
+ MAD_F_MLX(__hi, __lo, (x), (y)); \
+ asm ("addl %2,%0\n\t" \
+ "adcl %3,%1" \
+ : "=rm" (lo), "=rm" (hi) \
+ : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \
+ : "cc"); \
+ })
+# endif /* OPT_ACCURACY */
+
+# if defined(OPT_ACCURACY)
+/*
+ * Surprisingly, this is faster than SHRD followed by ADC.
+ */
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed64hi_t __hi_; \
+ mad_fixed64lo_t __lo_; \
+ mad_fixed_t __result; \
+ asm ("addl %4,%2\n\t" \
+ "adcl %5,%3" \
+ : "=rm" (__lo_), "=rm" (__hi_) \
+ : "0" (lo), "1" (hi), \
+ "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \
+ : "cc"); \
+ asm ("shrdl %3,%2,%1" \
+ : "=rm" (__result) \
+ : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# else
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("shrdl %3,%2,%1" \
+ : "=rm" (__result) \
+ : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# endif /* OPT_ACCURACY */
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
+
+/* --- ARM ----------------------------------------------------------------- */
+
+# elif defined(FPM_ARM)
+
+/*
+ * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
+ * least significant bit is properly rounded at no CPU cycle cost!
+ */
+# if 1
+/*
+ * This is faster than the default implementation via MAD_F_MLX() and
+ * mad_f_scale64().
+ */
+# define mad_f_mul(x, y) \
+ ({ mad_fixed64hi_t __hi; \
+ mad_fixed64lo_t __lo; \
+ mad_fixed_t __result; \
+ asm ("smull %0, %1, %3, %4\n\t" \
+ "movs %0, %0, lsr %5\n\t" \
+ "adc %2, %0, %1, lsl %6" \
+ : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
+ : "%r" (x), "r" (y), \
+ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# endif
+
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("smull %0, %1, %2, %3" \
+ : "=&r" (lo), "=&r" (hi) \
+ : "%r" (x), "r" (y))
+
+# define MAD_F_MLA(hi, lo, x, y) \
+ asm ("smlal %0, %1, %2, %3" \
+ : "+r" (lo), "+r" (hi) \
+ : "%r" (x), "r" (y))
+
+# define MAD_F_MLN(hi, lo) \
+ asm ("rsbs %0, %2, #0\n\t" \
+ "rsc %1, %3, #0" \
+ : "=r" (lo), "=r" (hi) \
+ : "0" (lo), "1" (hi) \
+ : "cc")
+
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("movs %0, %1, lsr %3\n\t" \
+ "adc %0, %0, %2, lsl %4" \
+ : "=&r" (__result) \
+ : "r" (lo), "r" (hi), \
+ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+
+/* --- MIPS ---------------------------------------------------------------- */
+
+# elif defined(FPM_MIPS)
+
+/*
+ * This MIPS version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("mult %2,%3" \
+ : "=l" (lo), "=h" (hi) \
+ : "%r" (x), "r" (y))
+
+# if defined(HAVE_MADD_ASM)
+# define MAD_F_MLA(hi, lo, x, y) \
+ asm ("madd %2,%3" \
+ : "+l" (lo), "+h" (hi) \
+ : "%r" (x), "r" (y))
+# elif defined(HAVE_MADD16_ASM)
+/*
+ * This loses significant accuracy due to the 16-bit integer limit in the
+ * multiply/accumulate instruction.
+ */
+# define MAD_F_ML0(hi, lo, x, y) \
+ asm ("mult %2,%3" \
+ : "=l" (lo), "=h" (hi) \
+ : "%r" ((x) >> 12), "r" ((y) >> 16))
+# define MAD_F_MLA(hi, lo, x, y) \
+ asm ("madd16 %2,%3" \
+ : "+l" (lo), "+h" (hi) \
+ : "%r" ((x) >> 12), "r" ((y) >> 16))
+# define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo))
+# endif
+
+# if defined(OPT_SPEED)
+# define mad_f_scale64(hi, lo) \
+ ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS)))
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
+
+/* --- SPARC --------------------------------------------------------------- */
+
+# elif defined(FPM_SPARC)
+
+/*
+ * This SPARC V8 version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("smul %2, %3, %0\n\t" \
+ "rd %%y, %1" \
+ : "=r" (lo), "=r" (hi) \
+ : "%r" (x), "rI" (y))
+
+/* --- PowerPC ------------------------------------------------------------- */
+
+# elif defined(FPM_PPC)
+
+/*
+ * This PowerPC version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ do { \
+ asm ("mullw %0,%1,%2" \
+ : "=r" (lo) \
+ : "%r" (x), "r" (y)); \
+ asm ("mulhw %0,%1,%2" \
+ : "=r" (hi) \
+ : "%r" (x), "r" (y)); \
+ } \
+ while (0)
+
+# if defined(OPT_ACCURACY)
+/*
+ * This gives best accuracy but is not very fast.
+ */
+# define MAD_F_MLA(hi, lo, x, y) \
+ ({ mad_fixed64hi_t __hi; \
+ mad_fixed64lo_t __lo; \
+ MAD_F_MLX(__hi, __lo, (x), (y)); \
+ asm ("addc %0,%2,%3\n\t" \
+ "adde %1,%4,%5" \
+ : "=r" (lo), "=r" (hi) \
+ : "%r" (lo), "r" (__lo), \
+ "%r" (hi), "r" (__hi) \
+ : "xer"); \
+ })
+# endif
+
+# if defined(OPT_ACCURACY)
+/*
+ * This is slower than the truncating version below it.
+ */
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result, __round; \
+ asm ("rotrwi %0,%1,%2" \
+ : "=r" (__result) \
+ : "r" (lo), "i" (MAD_F_SCALEBITS)); \
+ asm ("extrwi %0,%1,1,0" \
+ : "=r" (__round) \
+ : "r" (__result)); \
+ asm ("insrwi %0,%1,%2,0" \
+ : "+r" (__result) \
+ : "r" (hi), "i" (MAD_F_SCALEBITS)); \
+ asm ("add %0,%1,%2" \
+ : "=r" (__result) \
+ : "%r" (__result), "r" (__round)); \
+ __result; \
+ })
+# else
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("rotrwi %0,%1,%2" \
+ : "=r" (__result) \
+ : "r" (lo), "i" (MAD_F_SCALEBITS)); \
+ asm ("insrwi %0,%1,%2,0" \
+ : "+r" (__result) \
+ : "r" (hi), "i" (MAD_F_SCALEBITS)); \
+ __result; \
+ })
+# endif
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+
+/* --- Default ------------------------------------------------------------- */
+
+# elif defined(FPM_DEFAULT)
+
+/*
+ * This version is the most portable but it loses significant accuracy.
+ * Furthermore, accuracy is biased against the second argument, so care
+ * should be taken when ordering operands.
+ *
+ * The scale factors are constant as this is not used with SSO.
+ *
+ * Pre-rounding is required to stay within the limits of compliance.
+ */
+# if defined(OPT_SPEED)
+# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16))
+# else
+# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \
+ (((y) + (1L << 15)) >> 16))
+# endif
+
+/* ------------------------------------------------------------------------- */
+
+# else
+# error "no FPM selected"
+# endif
+
+/* default implementations */
+
+# if !defined(mad_f_mul)
+# define mad_f_mul(x, y) \
+ ({ register mad_fixed64hi_t __hi; \
+ register mad_fixed64lo_t __lo; \
+ MAD_F_MLX(__hi, __lo, (x), (y)); \
+ mad_f_scale64(__hi, __lo); \
+ })
+# endif
+
+# if !defined(MAD_F_MLA)
+# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y)))
+# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y)))
+# define MAD_F_MLN(hi, lo) ((lo) = -(lo))
+# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo))
+# endif
+
+# if !defined(MAD_F_ML0)
+# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y))
+# endif
+
+# if !defined(MAD_F_MLN)
+# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi))
+# endif
+
+# if !defined(MAD_F_MLZ)
+# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo))
+# endif
+
+# if !defined(mad_f_scale64)
+# if defined(OPT_ACCURACY)
+# define mad_f_scale64(hi, lo) \
+ ((((mad_fixed_t) \
+ (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \
+ ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1)
+# else
+# define mad_f_scale64(hi, lo) \
+ ((mad_fixed_t) \
+ (((hi) << (32 - MAD_F_SCALEBITS)) | \
+ ((lo) >> MAD_F_SCALEBITS)))
+# endif
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
+
+/* C routines */
+
+mad_fixed_t mad_f_abs(mad_fixed_t);
+mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
+
+# endif
+
+/* Id: bit.h,v 1.11 2003/05/27 22:40:36 rob Exp */
+
+# ifndef LIBMAD_BIT_H
+# define LIBMAD_BIT_H
+
+struct mad_bitptr {
+ unsigned char const *byte;
+ unsigned short cache;
+ unsigned short left;
+};
+
+void mad_bit_init(struct mad_bitptr *, unsigned char const *);
+
+# define mad_bit_finish(bitptr) /* nothing */
+
+unsigned int mad_bit_length(struct mad_bitptr const *,
+ struct mad_bitptr const *);
+
+# define mad_bit_bitsleft(bitptr) ((bitptr)->left)
+unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
+
+void mad_bit_skip(struct mad_bitptr *, unsigned int);
+unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
+void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
+
+unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
+
+# endif
+
+/* Id: timer.h,v 1.15 2003/05/27 22:40:37 rob Exp */
+
+# ifndef LIBMAD_TIMER_H
+# define LIBMAD_TIMER_H
+
+typedef struct {
+ signed long seconds; /* whole seconds */
+ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
+} mad_timer_t;
+
+extern mad_timer_t const mad_timer_zero;
+
+# define MAD_TIMER_RESOLUTION 352800000UL
+
+enum mad_units {
+ MAD_UNITS_HOURS = -2,
+ MAD_UNITS_MINUTES = -1,
+ MAD_UNITS_SECONDS = 0,
+
+ /* metric units */
+
+ MAD_UNITS_DECISECONDS = 10,
+ MAD_UNITS_CENTISECONDS = 100,
+ MAD_UNITS_MILLISECONDS = 1000,
+
+ /* audio sample units */
+
+ MAD_UNITS_8000_HZ = 8000,
+ MAD_UNITS_11025_HZ = 11025,
+ MAD_UNITS_12000_HZ = 12000,
+
+ MAD_UNITS_16000_HZ = 16000,
+ MAD_UNITS_22050_HZ = 22050,
+ MAD_UNITS_24000_HZ = 24000,
+
+ MAD_UNITS_32000_HZ = 32000,
+ MAD_UNITS_44100_HZ = 44100,
+ MAD_UNITS_48000_HZ = 48000,
+
+ /* video frame/field units */
+
+ MAD_UNITS_24_FPS = 24,
+ MAD_UNITS_25_FPS = 25,
+ MAD_UNITS_30_FPS = 30,
+ MAD_UNITS_48_FPS = 48,
+ MAD_UNITS_50_FPS = 50,
+ MAD_UNITS_60_FPS = 60,
+
+ /* CD audio frames */
+
+ MAD_UNITS_75_FPS = 75,
+
+ /* video drop-frame units */
+
+ MAD_UNITS_23_976_FPS = -24,
+ MAD_UNITS_24_975_FPS = -25,
+ MAD_UNITS_29_97_FPS = -30,
+ MAD_UNITS_47_952_FPS = -48,
+ MAD_UNITS_49_95_FPS = -50,
+ MAD_UNITS_59_94_FPS = -60
+};
+
+# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
+
+int mad_timer_compare(mad_timer_t, mad_timer_t);
+
+# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
+
+void mad_timer_negate(mad_timer_t *);
+mad_timer_t mad_timer_abs(mad_timer_t);
+
+void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
+void mad_timer_add(mad_timer_t *, mad_timer_t);
+void mad_timer_multiply(mad_timer_t *, signed long);
+
+signed long mad_timer_count(mad_timer_t, enum mad_units);
+unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
+void mad_timer_string(mad_timer_t, char *, char const *,
+ enum mad_units, enum mad_units, unsigned long);
+
+# endif
+
+/* Id: stream.h,v 1.18 2003/05/27 22:40:37 rob Exp */
+
+# ifndef LIBMAD_STREAM_H
+# define LIBMAD_STREAM_H
+
+
+# define MAD_BUFFER_GUARD 8
+# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
+
+enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
+ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
+ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
+
+ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
+
+ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
+ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
+ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
+ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
+ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
+
+ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
+ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
+ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
+ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
+ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
+ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
+ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
+ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
+ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
+ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
+ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
+ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
+};
+
+# define MAD_RECOVERABLE(error) ((error) & 0xff00)
+
+struct mad_stream {
+ unsigned char const *buffer; /* input bitstream buffer */
+ unsigned char const *bufend; /* end of buffer */
+ unsigned long skiplen; /* bytes to skip before next frame */
+
+ int sync; /* stream sync found */
+ unsigned long freerate; /* free bitrate (fixed) */
+
+ unsigned char const *this_frame; /* start of current frame */
+ unsigned char const *next_frame; /* start of next frame */
+ struct mad_bitptr ptr; /* current processing bit pointer */
+
+ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
+ unsigned int anc_bitlen; /* number of ancillary bits */
+
+ unsigned char (*main_data)[MAD_BUFFER_MDLEN];
+ /* Layer III main_data() */
+ unsigned int md_len; /* bytes in main_data */
+
+ int options; /* decoding options (see below) */
+ enum mad_error error; /* error code (see above) */
+};
+
+enum {
+ MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
+# if 0 /* not yet implemented */
+ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
+ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
+# endif
+};
+
+void mad_stream_init(struct mad_stream *);
+void mad_stream_finish(struct mad_stream *);
+
+# define mad_stream_options(stream, opts) \
+ ((void) ((stream)->options = (opts)))
+
+void mad_stream_buffer(struct mad_stream *,
+ unsigned char const *, unsigned long);
+void mad_stream_skip(struct mad_stream *, unsigned long);
+
+int mad_stream_sync(struct mad_stream *);
+
+char const *mad_stream_errorstr(struct mad_stream const *);
+
+# endif
+
+/* Id: frame.h,v 1.19 2003/05/27 22:40:36 rob Exp */
+
+# ifndef LIBMAD_FRAME_H
+# define LIBMAD_FRAME_H
+
+
+enum mad_layer {
+ MAD_LAYER_I = 1, /* Layer I */
+ MAD_LAYER_II = 2, /* Layer II */
+ MAD_LAYER_III = 3 /* Layer III */
+};
+
+enum mad_mode {
+ MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
+ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
+ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
+ MAD_MODE_STEREO = 3 /* normal LR stereo */
+};
+
+enum mad_emphasis {
+ MAD_EMPHASIS_NONE = 0, /* no emphasis */
+ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
+ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
+ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
+};
+
+struct mad_header {
+ enum mad_layer layer; /* audio layer (1, 2, or 3) */
+ enum mad_mode mode; /* channel mode (see above) */
+ int mode_extension; /* additional mode info */
+ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
+
+ unsigned long bitrate; /* stream bitrate (bps) */
+ unsigned int samplerate; /* sampling frequency (Hz) */
+
+ unsigned short crc_check; /* frame CRC accumulator */
+ unsigned short crc_target; /* final target CRC checksum */
+
+ int flags; /* flags (see below) */
+ int private_bits; /* private bits (see below) */
+
+ mad_timer_t duration; /* audio playing time of frame */
+};
+
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
+
+ int options; /* decoding options (from stream) */
+
+ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
+ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
+};
+
+# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
+# define MAD_NSBSAMPLES(header) \
+ ((header)->layer == MAD_LAYER_I ? 12 : \
+ (((header)->layer == MAD_LAYER_III && \
+ ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
+
+enum {
+ MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
+ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
+
+ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
+ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
+ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
+ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
+
+ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
+ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
+ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
+
+ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
+ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
+ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
+};
+
+enum {
+ MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
+ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
+};
+
+void mad_header_init(struct mad_header *);
+
+# define mad_header_finish(header) /* nothing */
+
+int mad_header_decode(struct mad_header *, struct mad_stream *);
+
+void mad_frame_init(struct mad_frame *);
+void mad_frame_finish(struct mad_frame *);
+
+int mad_frame_decode(struct mad_frame *, struct mad_stream *);
+
+void mad_frame_mute(struct mad_frame *);
+
+# endif
+
+/* Id: synth.h,v 1.14 2003/05/27 22:40:37 rob Exp */
+
+# ifndef LIBMAD_SYNTH_H
+# define LIBMAD_SYNTH_H
+
+
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+};
+
+struct mad_synth {
+ mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
+ /* [ch][eo][peo][s][v] */
+
+ unsigned int phase; /* current processing phase */
+
+ struct mad_pcm pcm; /* PCM output */
+};
+
+/* single channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
+};
+
+/* dual channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
+};
+
+/* stereo PCM selector */
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
+};
+
+void mad_synth_init(struct mad_synth *);
+
+# define mad_synth_finish(synth) /* nothing */
+
+void mad_synth_mute(struct mad_synth *);
+
+void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
+
+# endif
+
+/* Id: decoder.h,v 1.16 2003/05/27 22:40:36 rob Exp */
+
+# ifndef LIBMAD_DECODER_H
+# define LIBMAD_DECODER_H
+
+
+enum mad_decoder_mode {
+ MAD_DECODER_MODE_SYNC = 0,
+ MAD_DECODER_MODE_ASYNC
+};
+
+enum mad_flow {
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
+};
+
+struct mad_decoder {
+ enum mad_decoder_mode mode;
+
+ int options;
+
+ struct {
+ long pid;
+ int in;
+ int out;
+ } async;
+
+ struct {
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+ } *sync;
+
+ void *cb_data;
+
+ enum mad_flow (*input_func)(void *, struct mad_stream *);
+ enum mad_flow (*header_func)(void *, struct mad_header const *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *, struct mad_pcm *);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ enum mad_flow (*message_func)(void *, void *, unsigned int *);
+};
+
+void mad_decoder_init(struct mad_decoder *, void *,
+ enum mad_flow (*)(void *, struct mad_stream *),
+ enum mad_flow (*)(void *, struct mad_header const *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *, void *, unsigned int *));
+int mad_decoder_finish(struct mad_decoder *);
+
+# define mad_decoder_options(decoder, opts) \
+ ((void) ((decoder)->options = (opts)))
+
+int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
+int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
+
+# endif
+
+# ifdef __cplusplus
+}
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/mad.h.sed b/src/filters/transform/mpadecfilter/libmad-0.15.0b/mad.h.sed
new file mode 100644
index 000000000..2055b883c
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/mad.h.sed
@@ -0,0 +1,36 @@
+#
+# libmad - MPEG audio decoder library
+# Copyright (C) 2000-2003 Underbit Technologies, Inc.
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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
+#
+# $Id: mad.h.sed 111 2003-08-31 19:00:18Z gabest $
+#
+
+/^\/\*$/{
+N
+s/ \* libmad - /&/
+t copy
+b next
+: copy
+g
+n
+s|^ \* \$\(Id: .*\) \$$|/* \1 */|p
+/^ \*\/$/d
+b copy
+}
+/^# *include "/d
+: next
+p
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/minimad.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/minimad.c
new file mode 100644
index 000000000..f16538283
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/minimad.c
@@ -0,0 +1,222 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: minimad.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# include <stdio.h>
+# include <unistd.h>
+# include <sys/stat.h>
+# include <sys/mman.h>
+
+# include "mad.h"
+
+/*
+ * This is perhaps the simplest example use of the MAD high-level API.
+ * Standard input is mapped into memory via mmap(), then the high-level API
+ * is invoked with three callbacks: input, output, and error. The output
+ * callback converts MAD's high-resolution PCM samples to 16 bits, then
+ * writes them to standard output in little-endian, stereo-interleaved
+ * format.
+ */
+
+static int decode(unsigned char const *, unsigned long);
+
+int main(int argc, char *argv[])
+{
+ struct stat stat;
+ void *fdm;
+
+ if (argc != 1)
+ return 1;
+
+ if (fstat(STDIN_FILENO, &stat) == -1 ||
+ stat.st_size == 0)
+ return 2;
+
+ fdm = mmap(0, stat.st_size, PROT_READ, MAP_SHARED, STDIN_FILENO, 0);
+ if (fdm == MAP_FAILED)
+ return 3;
+
+ decode(fdm, stat.st_size);
+
+ if (munmap(fdm, stat.st_size) == -1)
+ return 4;
+
+ return 0;
+}
+
+/*
+ * This is a private message structure. A generic pointer to this structure
+ * is passed to each of the callback functions. Put here any data you need
+ * to access from within the callbacks.
+ */
+
+struct buffer {
+ unsigned char const *start;
+ unsigned long length;
+};
+
+/*
+ * This is the input callback. The purpose of this callback is to (re)fill
+ * the stream buffer which is to be decoded. In this example, an entire file
+ * has been mapped into memory, so we just call mad_stream_buffer() with the
+ * address and length of the mapping. When this callback is called a second
+ * time, we are finished decoding.
+ */
+
+static
+enum mad_flow input(void *data,
+ struct mad_stream *stream)
+{
+ struct buffer *buffer = data;
+
+ if (!buffer->length)
+ return MAD_FLOW_STOP;
+
+ mad_stream_buffer(stream, buffer->start, buffer->length);
+
+ buffer->length = 0;
+
+ return MAD_FLOW_CONTINUE;
+}
+
+/*
+ * The following utility routine performs simple rounding, clipping, and
+ * scaling of MAD's high-resolution samples down to 16 bits. It does not
+ * perform any dithering or noise shaping, which would be recommended to
+ * obtain any exceptional audio quality. It is therefore not recommended to
+ * use this routine if high-quality output is desired.
+ */
+
+static inline
+signed int scale(mad_fixed_t sample)
+{
+ /* round */
+ sample += (1L << (MAD_F_FRACBITS - 16));
+
+ /* clip */
+ if (sample >= MAD_F_ONE)
+ sample = MAD_F_ONE - 1;
+ else if (sample < -MAD_F_ONE)
+ sample = -MAD_F_ONE;
+
+ /* quantize */
+ return sample >> (MAD_F_FRACBITS + 1 - 16);
+}
+
+/*
+ * This is the output callback function. It is called after each frame of
+ * MPEG audio data has been completely decoded. The purpose of this callback
+ * is to output (or play) the decoded PCM audio.
+ */
+
+static
+enum mad_flow output(void *data,
+ struct mad_header const *header,
+ struct mad_pcm *pcm)
+{
+ unsigned int nchannels, nsamples;
+ mad_fixed_t const *left_ch, *right_ch;
+
+ /* pcm->samplerate contains the sampling frequency */
+
+ nchannels = pcm->channels;
+ nsamples = pcm->length;
+ left_ch = pcm->samples[0];
+ right_ch = pcm->samples[1];
+
+ while (nsamples--) {
+ signed int sample;
+
+ /* output sample(s) in 16-bit signed little-endian PCM */
+
+ sample = scale(*left_ch++);
+ putchar((sample >> 0) & 0xff);
+ putchar((sample >> 8) & 0xff);
+
+ if (nchannels == 2) {
+ sample = scale(*right_ch++);
+ putchar((sample >> 0) & 0xff);
+ putchar((sample >> 8) & 0xff);
+ }
+ }
+
+ return MAD_FLOW_CONTINUE;
+}
+
+/*
+ * This is the error callback function. It is called whenever a decoding
+ * error occurs. The error is indicated by stream->error; the list of
+ * possible MAD_ERROR_* errors can be found in the mad.h (or
+ * libmad/stream.h) header file.
+ */
+
+static
+enum mad_flow error(void *data,
+ struct mad_stream *stream,
+ struct mad_frame *frame)
+{
+ struct buffer *buffer = data;
+
+ fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %u\n",
+ stream->error, mad_stream_errorstr(stream),
+ stream->this_frame - buffer->start);
+
+ /* return MAD_FLOW_BREAK here to stop decoding (and propagate an error) */
+
+ return MAD_FLOW_CONTINUE;
+}
+
+/*
+ * This is the function called by main() above to perform all the
+ * decoding. It instantiates a decoder object and configures it with the
+ * input, output, and error callback functions above. A single call to
+ * mad_decoder_run() continues until a callback function returns
+ * MAD_FLOW_STOP (to stop decoding) or MAD_FLOW_BREAK (to stop decoding and
+ * signal an error).
+ */
+
+static
+int decode(unsigned char const *start, unsigned long length)
+{
+ struct buffer buffer;
+ struct mad_decoder decoder;
+ int result;
+
+ /* initialize our private message structure */
+
+ buffer.start = start;
+ buffer.length = length;
+
+ /* configure input, output, and error functions */
+
+ mad_decoder_init(&decoder, &buffer,
+ input, 0 /* header */, 0 /* filter */, output,
+ error, 0 /* message */);
+
+ /* start decoding */
+
+ result = mad_decoder_run(&decoder, MAD_DECODER_MODE_SYNC);
+
+ /* release the decoder */
+
+ mad_decoder_finish(&decoder);
+
+ return result;
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/missing b/src/filters/transform/mpadecfilter/libmad-0.15.0b/missing
new file mode 100644
index 000000000..4432a8aab
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/missing
@@ -0,0 +1,336 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# 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; either version 2, or (at your option)
+# any later version.
+
+# 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+case "$1" in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing 0.4 - GNU automake"
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+ aclocal*)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case "$f" in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1Help2man' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+ test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f y.tab.h ]; then
+ echo >y.tab.h
+ fi
+ if [ ! -f y.tab.c ]; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if [ -f "$SRCFILE" ]; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if [ ! -f lex.yy.c ]; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+ fi
+ if [ -f "$file" ]; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
+ # We have makeinfo, but it failed.
+ exit 1
+ fi
+
+ echo 1>&2 "\
+WARNING: \`$1' is missing on your system. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+ if test -z "$file"; then
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+ fi
+ touch $file
+ ;;
+
+ tar)
+ shift
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ fi
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case "$firstarg" in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case "$firstarg" in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+ system. You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequirements for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/mkinstalldirs b/src/filters/transform/mpadecfilter/libmad-0.15.0b/mkinstalldirs
new file mode 100644
index 000000000..ba0325b9a
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/mkinstalldirs
@@ -0,0 +1,111 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
+
+# process command line arguments
+while test $# -gt 0 ; do
+ case $1 in
+ -h | --help | --h*) # -h for help
+ echo "$usage" 1>&2
+ exit 0
+ ;;
+ -m) # -m PERM arg
+ shift
+ test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+ dirmode=$1
+ shift
+ ;;
+ --) # stop option processing
+ shift
+ break
+ ;;
+ -*) # unknown option
+ echo "$usage" 1>&2
+ exit 1
+ ;;
+ *) # first non-opt arg
+ break
+ ;;
+ esac
+done
+
+for file
+do
+ if test -d "$file"; then
+ shift
+ else
+ break
+ fi
+done
+
+case $# in
+ 0) exit 0 ;;
+esac
+
+case $dirmode in
+ '')
+ if mkdir -p -- . 2>/dev/null; then
+ echo "mkdir -p -- $*"
+ exec mkdir -p -- "$@"
+ fi
+ ;;
+ *)
+ if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
+ echo "mkdir -m $dirmode -p -- $*"
+ exec mkdir -m "$dirmode" -p -- "$@"
+ fi
+ ;;
+esac
+
+for file
+do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d
+ do
+ pathcomp="$pathcomp$d"
+ case $pathcomp in
+ -*) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp"
+
+ mkdir "$pathcomp" || lasterr=$?
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ else
+ if test ! -z "$dirmode"; then
+ echo "chmod $dirmode $pathcomp"
+ lasterr=""
+ chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+ if test ! -z "$lasterr"; then
+ errstatus=$lasterr
+ fi
+ fi
+ fi
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# End:
+# mkinstalldirs ends here
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/Makefile.am b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/Makefile.am
new file mode 100644
index 000000000..b762e76c0
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/Makefile.am
@@ -0,0 +1,24 @@
+##
+## libmad - MPEG audio decoder library
+## Copyright (C) 2000-2003 Underbit Technologies, Inc.
+##
+## 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; either version 2 of the License, or
+## (at your option) any later version.
+##
+## 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
+##
+## $Id: Makefile.am 111 2003-08-31 19:00:18Z gabest $
+##
+
+## Process this file with automake to produce Makefile.in
+
+EXTRA_DIST = mad.h config.h libmad.dsp
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/Makefile.in b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/Makefile.in
new file mode 100644
index 000000000..3ecc5a6a2
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/Makefile.in
@@ -0,0 +1,276 @@
+# Makefile.in generated by automake 1.7.5 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+ASO = @ASO@
+ASO_OBJS = @ASO_OBJS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FPM = @FPM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+EXTRA_DIST = mad.h config.h libmad.dsp
+subdir = msvc++
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DIST_COMMON = Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign msvc++/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/config.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/config.h
new file mode 100644
index 000000000..56a5ab3eb
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/config.h
@@ -0,0 +1,130 @@
+/* config.h. Generated by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to enable diagnostic debugging support. */
+/* #undef DEBUG */
+
+/* Define to enable experimental code. */
+/* #undef EXPERIMENTAL */
+
+/* Define to 1 if you have the <assert.h> header file. */
+#define HAVE_ASSERT_H 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the `fcntl' function. */
+/* #undef HAVE_FCNTL */
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fork' function. */
+/* #undef HAVE_FORK */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */
+/* #undef HAVE_MADD16_ASM */
+
+/* Define if your MIPS CPU supports a 2-operand MADD instruction. */
+/* #undef HAVE_MADD_ASM */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `pipe' function. */
+/* #undef HAVE_PIPE */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+/* #undef HAVE_SYS_WAIT_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Define to 1 if you have the `waitpid' function. */
+/* #undef HAVE_WAITPID */
+
+/* Define to disable debugging assertions. */
+/* #undef NDEBUG */
+
+/* Define to optimize for accuracy over speed. */
+/* #undef OPT_ACCURACY */
+
+/* Define to optimize for speed over accuracy. */
+/* #undef OPT_SPEED */
+
+/* Define to enable a fast subband synthesis approximation optimization. */
+/* #undef OPT_SSO */
+
+/* Define to influence a strict interpretation of the ISO/IEC standards, even
+ if this is in opposition with best accepted practices. */
+/* #undef OPT_STRICT */
+
+/* Name of package */
+#define PACKAGE "libmad"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "support@underbit.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "MPEG Audio Decoder"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "MPEG Audio Decoder 0.15.0b"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libmad"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.15.0b"
+
+/* The size of a `int', as computed by sizeof. */
+#define SIZEOF_INT 4
+
+/* The size of a `long', as computed by sizeof. */
+#define SIZEOF_LONG 4
+
+/* The size of a `long long', as computed by sizeof. */
+#define SIZEOF_LONG_LONG 8
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "0.15.0b"
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
+ if it is not supported. */
+#define inline __inline
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad.vcproj b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad.vcproj
new file mode 100644
index 000000000..bbed91843
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad.vcproj
@@ -0,0 +1,413 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="libmad"
+ ProjectGUID="{D8365C15-2166-4DB6-8A2D-1C8F0239EB18}"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="."
+ PreprocessorDefinitions="FPM_DEFAULT;_LIB;HAVE_CONFIG_H;ASO_ZEROCHECK;WIN32;_DEBUG;DEBUG"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ PrecompiledHeaderFile=".\Debug/libmad.pch"
+ AssemblerOutput="0"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="1"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\libmadD.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="."
+ PreprocessorDefinitions="NDEBUG;FPM_INTEL;WIN32;_LIB;HAVE_CONFIG_H;ASO_ZEROCHECK"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ PrecompiledHeaderFile=".\Release/libmad.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\libmadR.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="c">
+ <File
+ RelativePath="..\bit.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\decoder.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\fixed.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\frame.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\huffman.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\layer12.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\layer3.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\stream.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\synth.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\timer.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\version.c">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h">
+ <File
+ RelativePath="..\bit.h">
+ </File>
+ <File
+ RelativePath="config.h">
+ </File>
+ <File
+ RelativePath="..\decoder.h">
+ </File>
+ <File
+ RelativePath="..\fixed.h">
+ </File>
+ <File
+ RelativePath="..\frame.h">
+ </File>
+ <File
+ RelativePath="..\global.h">
+ </File>
+ <File
+ RelativePath="..\huffman.h">
+ </File>
+ <File
+ RelativePath="..\layer12.h">
+ </File>
+ <File
+ RelativePath="..\layer3.h">
+ </File>
+ <File
+ RelativePath="..\stream.h">
+ </File>
+ <File
+ RelativePath="..\synth.h">
+ </File>
+ <File
+ RelativePath="..\timer.h">
+ </File>
+ <File
+ RelativePath="..\version.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Data Files"
+ Filter="dat">
+ <File
+ RelativePath="..\D.dat">
+ </File>
+ <File
+ RelativePath="..\imdct_s.dat">
+ </File>
+ <File
+ RelativePath="..\qc_table.dat">
+ </File>
+ <File
+ RelativePath="..\rq_table.dat">
+ </File>
+ <File
+ RelativePath="..\sf_table.dat">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad_vs2005.vcproj b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad_vs2005.vcproj
new file mode 100644
index 000000000..be06a47f8
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad_vs2005.vcproj
@@ -0,0 +1,542 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="libmad"
+ ProjectGUID="{D8365C15-2166-4DB6-8A2D-1C8F0239EB18}"
+ RootNamespace="libmad"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="."
+ PreprocessorDefinitions="FPM_DEFAULT;_LIB;HAVE_CONFIG_H;ASO_ZEROCHECK;WIN32;_DEBUG;DEBUG"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Debug/libmad.pch"
+ AssemblerOutput="0"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\libmadD.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="4"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="."
+ PreprocessorDefinitions="NDEBUG;FPM_INTEL;WIN32;_LIB;HAVE_CONFIG_H;ASO_ZEROCHECK"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\Release/libmad.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="3"
+ CompileAs="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\..\..\..\lib\libmadR.lib"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="c"
+ >
+ <File
+ RelativePath="..\bit.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\decoder.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\fixed.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\frame.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\huffman.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\layer12.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\layer3.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\stream.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\synth.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\timer.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\version.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="..\bit.h"
+ >
+ </File>
+ <File
+ RelativePath="config.h"
+ >
+ </File>
+ <File
+ RelativePath="..\decoder.h"
+ >
+ </File>
+ <File
+ RelativePath="..\fixed.h"
+ >
+ </File>
+ <File
+ RelativePath="..\frame.h"
+ >
+ </File>
+ <File
+ RelativePath="..\global.h"
+ >
+ </File>
+ <File
+ RelativePath="..\huffman.h"
+ >
+ </File>
+ <File
+ RelativePath="..\layer12.h"
+ >
+ </File>
+ <File
+ RelativePath="..\layer3.h"
+ >
+ </File>
+ <File
+ RelativePath="..\stream.h"
+ >
+ </File>
+ <File
+ RelativePath="..\synth.h"
+ >
+ </File>
+ <File
+ RelativePath="..\timer.h"
+ >
+ </File>
+ <File
+ RelativePath="..\version.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Data Files"
+ Filter="dat"
+ >
+ <File
+ RelativePath="..\D.dat"
+ >
+ </File>
+ <File
+ RelativePath="..\imdct_s.dat"
+ >
+ </File>
+ <File
+ RelativePath="..\qc_table.dat"
+ >
+ </File>
+ <File
+ RelativePath="..\rq_table.dat"
+ >
+ </File>
+ <File
+ RelativePath="..\sf_table.dat"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..12444eaab
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/libmad_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/mad.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/mad.h
new file mode 100644
index 000000000..112607015
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/msvc++/mad.h
@@ -0,0 +1,948 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * If you would like to negotiate alternate licensing terms, you may do
+ * so by contacting: Underbit Technologies, Inc. <info@underbit.com>
+ */
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# define FPM_INTEL
+
+
+
+# define SIZEOF_INT 4
+# define SIZEOF_LONG 4
+# define SIZEOF_LONG_LONG 8
+
+
+/* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */
+
+# ifndef LIBMAD_VERSION_H
+# define LIBMAD_VERSION_H
+
+# define MAD_VERSION_MAJOR 0
+# define MAD_VERSION_MINOR 15
+# define MAD_VERSION_PATCH 0
+# define MAD_VERSION_EXTRA " (beta)"
+
+# define MAD_VERSION_STRINGIZE(str) #str
+# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num)
+
+# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \
+ MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \
+ MAD_VERSION_STRING(MAD_VERSION_PATCH) \
+ MAD_VERSION_EXTRA
+
+# define MAD_PUBLISHYEAR "2000-2003"
+# define MAD_AUTHOR "Underbit Technologies, Inc."
+# define MAD_EMAIL "info@underbit.com"
+
+extern char const mad_version[];
+extern char const mad_copyright[];
+extern char const mad_author[];
+extern char const mad_build[];
+
+# endif
+
+/* Id: fixed.h,v 1.36 2003/05/28 04:36:00 rob Exp */
+
+# ifndef LIBMAD_FIXED_H
+# define LIBMAD_FIXED_H
+
+# if SIZEOF_INT >= 4
+typedef signed int mad_fixed_t;
+
+typedef signed int mad_fixed64hi_t;
+typedef unsigned int mad_fixed64lo_t;
+# else
+typedef signed long mad_fixed_t;
+
+typedef signed long mad_fixed64hi_t;
+typedef unsigned long mad_fixed64lo_t;
+# endif
+
+# if defined(_MSC_VER)
+# define mad_fixed64_t signed __int64
+# elif 1 || defined(__GNUC__)
+# define mad_fixed64_t signed long long
+# endif
+
+# if defined(FPM_FLOAT)
+typedef double mad_sample_t;
+# else
+typedef mad_fixed_t mad_sample_t;
+# endif
+
+/*
+ * Fixed-point format: 0xABBBBBBB
+ * A == whole part (sign + 3 bits)
+ * B == fractional part (28 bits)
+ *
+ * Values are signed two's complement, so the effective range is:
+ * 0x80000000 to 0x7fffffff
+ * -8.0 to +7.9999999962747097015380859375
+ *
+ * The smallest representable value is:
+ * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
+ *
+ * 28 bits of fractional accuracy represent about
+ * 8.6 digits of decimal accuracy.
+ *
+ * Fixed-point numbers can be added or subtracted as normal
+ * integers, but multiplication requires shifting the 64-bit result
+ * from 56 fractional bits back to 28 (and rounding.)
+ *
+ * Changing the definition of MAD_F_FRACBITS is only partially
+ * supported, and must be done with care.
+ */
+
+# define MAD_F_FRACBITS 28
+
+# if MAD_F_FRACBITS == 28
+# define MAD_F(x) ((mad_fixed_t) (x##L))
+# else
+# if MAD_F_FRACBITS < 28
+# warning "MAD_F_FRACBITS < 28"
+# define MAD_F(x) ((mad_fixed_t) \
+ (((x##L) + \
+ (1L << (28 - MAD_F_FRACBITS - 1))) >> \
+ (28 - MAD_F_FRACBITS)))
+# elif MAD_F_FRACBITS > 28
+# error "MAD_F_FRACBITS > 28 not currently supported"
+# define MAD_F(x) ((mad_fixed_t) \
+ ((x##L) << (MAD_F_FRACBITS - 28)))
+# endif
+# endif
+
+# define MAD_F_MIN ((mad_fixed_t) -0x80000000L)
+# define MAD_F_MAX ((mad_fixed_t) +0x7fffffffL)
+
+# define MAD_F_ONE MAD_F(0x10000000)
+
+# define mad_f_tofixed(x) ((mad_fixed_t) \
+ ((x) * (double) (1L << MAD_F_FRACBITS) + 0.5))
+# define mad_f_todouble(x) ((double) \
+ ((x) / (double) (1L << MAD_F_FRACBITS)))
+
+# define mad_f_intpart(x) ((x) >> MAD_F_FRACBITS)
+# define mad_f_fracpart(x) ((x) & ((1L << MAD_F_FRACBITS) - 1))
+ /* (x should be positive) */
+
+# define mad_f_fromint(x) ((x) << MAD_F_FRACBITS)
+
+# define mad_f_add(x, y) ((x) + (y))
+# define mad_f_sub(x, y) ((x) - (y))
+
+# if defined(FPM_FLOAT)
+# error "FPM_FLOAT not yet supported"
+
+# undef MAD_F
+# define MAD_F(x) mad_f_todouble(x)
+
+# define mad_f_mul(x, y) ((x) * (y))
+# define mad_f_scale64
+
+# undef ASO_ZEROCHECK
+
+# elif defined(FPM_64BIT)
+
+/*
+ * This version should be the most accurate if 64-bit types are supported by
+ * the compiler, although it may not be the most efficient.
+ */
+# if defined(OPT_ACCURACY)
+# define mad_f_mul(x, y) \
+ ((mad_fixed_t) \
+ ((((mad_fixed64_t) (x) * (y)) + \
+ (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS))
+# else
+# define mad_f_mul(x, y) \
+ ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS))
+# endif
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+
+/* --- Intel --------------------------------------------------------------- */
+
+# elif defined(FPM_INTEL)
+
+# if defined(_MSC_VER)
+# pragma warning(push)
+# pragma warning(disable: 4035) /* no return value */
+static __forceinline
+mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y)
+{
+ enum {
+ fracbits = MAD_F_FRACBITS
+ };
+
+ __asm {
+ mov eax, x
+ imul y
+ shrd eax, edx, fracbits
+ }
+
+ /* implicit return of eax */
+}
+# pragma warning(pop)
+
+# define mad_f_mul mad_f_mul_inline
+# define mad_f_scale64
+# else
+/*
+ * This Intel version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("imull %3" \
+ : "=a" (lo), "=d" (hi) \
+ : "%a" (x), "rm" (y) \
+ : "cc")
+
+# if defined(OPT_ACCURACY)
+/*
+ * This gives best accuracy but is not very fast.
+ */
+# define MAD_F_MLA(hi, lo, x, y) \
+ ({ mad_fixed64hi_t __hi; \
+ mad_fixed64lo_t __lo; \
+ MAD_F_MLX(__hi, __lo, (x), (y)); \
+ asm ("addl %2,%0\n\t" \
+ "adcl %3,%1" \
+ : "=rm" (lo), "=rm" (hi) \
+ : "r" (__lo), "r" (__hi), "0" (lo), "1" (hi) \
+ : "cc"); \
+ })
+# endif /* OPT_ACCURACY */
+
+# if defined(OPT_ACCURACY)
+/*
+ * Surprisingly, this is faster than SHRD followed by ADC.
+ */
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed64hi_t __hi_; \
+ mad_fixed64lo_t __lo_; \
+ mad_fixed_t __result; \
+ asm ("addl %4,%2\n\t" \
+ "adcl %5,%3" \
+ : "=rm" (__lo_), "=rm" (__hi_) \
+ : "0" (lo), "1" (hi), \
+ "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \
+ : "cc"); \
+ asm ("shrdl %3,%2,%1" \
+ : "=rm" (__result) \
+ : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# else
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("shrdl %3,%2,%1" \
+ : "=rm" (__result) \
+ : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# endif /* OPT_ACCURACY */
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
+
+/* --- ARM ----------------------------------------------------------------- */
+
+# elif defined(FPM_ARM)
+
+/*
+ * This ARM V4 version is as accurate as FPM_64BIT but much faster. The
+ * least significant bit is properly rounded at no CPU cycle cost!
+ */
+# if 1
+/*
+ * This is faster than the default implementation via MAD_F_MLX() and
+ * mad_f_scale64().
+ */
+# define mad_f_mul(x, y) \
+ ({ mad_fixed64hi_t __hi; \
+ mad_fixed64lo_t __lo; \
+ mad_fixed_t __result; \
+ asm ("smull %0, %1, %3, %4\n\t" \
+ "movs %0, %0, lsr %5\n\t" \
+ "adc %2, %0, %1, lsl %6" \
+ : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
+ : "%r" (x), "r" (y), \
+ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+# endif
+
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("smull %0, %1, %2, %3" \
+ : "=&r" (lo), "=&r" (hi) \
+ : "%r" (x), "r" (y))
+
+# define MAD_F_MLA(hi, lo, x, y) \
+ asm ("smlal %0, %1, %2, %3" \
+ : "+r" (lo), "+r" (hi) \
+ : "%r" (x), "r" (y))
+
+# define MAD_F_MLN(hi, lo) \
+ asm ("rsbs %0, %2, #0\n\t" \
+ "rsc %1, %3, #0" \
+ : "=r" (lo), "=r" (hi) \
+ : "0" (lo), "1" (hi) \
+ : "cc")
+
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("movs %0, %1, lsr %3\n\t" \
+ "adc %0, %0, %2, lsl %4" \
+ : "=&r" (__result) \
+ : "r" (lo), "r" (hi), \
+ "M" (MAD_F_SCALEBITS), "M" (32 - MAD_F_SCALEBITS) \
+ : "cc"); \
+ __result; \
+ })
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+
+/* --- MIPS ---------------------------------------------------------------- */
+
+# elif defined(FPM_MIPS)
+
+/*
+ * This MIPS version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("mult %2,%3" \
+ : "=l" (lo), "=h" (hi) \
+ : "%r" (x), "r" (y))
+
+# if defined(HAVE_MADD_ASM)
+# define MAD_F_MLA(hi, lo, x, y) \
+ asm ("madd %2,%3" \
+ : "+l" (lo), "+h" (hi) \
+ : "%r" (x), "r" (y))
+# elif defined(HAVE_MADD16_ASM)
+/*
+ * This loses significant accuracy due to the 16-bit integer limit in the
+ * multiply/accumulate instruction.
+ */
+# define MAD_F_ML0(hi, lo, x, y) \
+ asm ("mult %2,%3" \
+ : "=l" (lo), "=h" (hi) \
+ : "%r" ((x) >> 12), "r" ((y) >> 16))
+# define MAD_F_MLA(hi, lo, x, y) \
+ asm ("madd16 %2,%3" \
+ : "+l" (lo), "+h" (hi) \
+ : "%r" ((x) >> 12), "r" ((y) >> 16))
+# define MAD_F_MLZ(hi, lo) ((mad_fixed_t) (lo))
+# endif
+
+# if defined(OPT_SPEED)
+# define mad_f_scale64(hi, lo) \
+ ((mad_fixed_t) ((hi) << (32 - MAD_F_SCALEBITS)))
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
+
+/* --- SPARC --------------------------------------------------------------- */
+
+# elif defined(FPM_SPARC)
+
+/*
+ * This SPARC V8 version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ asm ("smul %2, %3, %0\n\t" \
+ "rd %%y, %1" \
+ : "=r" (lo), "=r" (hi) \
+ : "%r" (x), "rI" (y))
+
+/* --- PowerPC ------------------------------------------------------------- */
+
+# elif defined(FPM_PPC)
+
+/*
+ * This PowerPC version is fast and accurate; the disposition of the least
+ * significant bit depends on OPT_ACCURACY via mad_f_scale64().
+ */
+# define MAD_F_MLX(hi, lo, x, y) \
+ do { \
+ asm ("mullw %0,%1,%2" \
+ : "=r" (lo) \
+ : "%r" (x), "r" (y)); \
+ asm ("mulhw %0,%1,%2" \
+ : "=r" (hi) \
+ : "%r" (x), "r" (y)); \
+ } \
+ while (0)
+
+# if defined(OPT_ACCURACY)
+/*
+ * This gives best accuracy but is not very fast.
+ */
+# define MAD_F_MLA(hi, lo, x, y) \
+ ({ mad_fixed64hi_t __hi; \
+ mad_fixed64lo_t __lo; \
+ MAD_F_MLX(__hi, __lo, (x), (y)); \
+ asm ("addc %0,%2,%3\n\t" \
+ "adde %1,%4,%5" \
+ : "=r" (lo), "=r" (hi) \
+ : "%r" (lo), "r" (__lo), \
+ "%r" (hi), "r" (__hi) \
+ : "xer"); \
+ })
+# endif
+
+# if defined(OPT_ACCURACY)
+/*
+ * This is slower than the truncating version below it.
+ */
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result, __round; \
+ asm ("rotrwi %0,%1,%2" \
+ : "=r" (__result) \
+ : "r" (lo), "i" (MAD_F_SCALEBITS)); \
+ asm ("extrwi %0,%1,1,0" \
+ : "=r" (__round) \
+ : "r" (__result)); \
+ asm ("insrwi %0,%1,%2,0" \
+ : "+r" (__result) \
+ : "r" (hi), "i" (MAD_F_SCALEBITS)); \
+ asm ("add %0,%1,%2" \
+ : "=r" (__result) \
+ : "%r" (__result), "r" (__round)); \
+ __result; \
+ })
+# else
+# define mad_f_scale64(hi, lo) \
+ ({ mad_fixed_t __result; \
+ asm ("rotrwi %0,%1,%2" \
+ : "=r" (__result) \
+ : "r" (lo), "i" (MAD_F_SCALEBITS)); \
+ asm ("insrwi %0,%1,%2,0" \
+ : "+r" (__result) \
+ : "r" (hi), "i" (MAD_F_SCALEBITS)); \
+ __result; \
+ })
+# endif
+
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+
+/* --- Default ------------------------------------------------------------- */
+
+# elif defined(FPM_DEFAULT)
+
+/*
+ * This version is the most portable but it loses significant accuracy.
+ * Furthermore, accuracy is biased against the second argument, so care
+ * should be taken when ordering operands.
+ *
+ * The scale factors are constant as this is not used with SSO.
+ *
+ * Pre-rounding is required to stay within the limits of compliance.
+ */
+# if defined(OPT_SPEED)
+# define mad_f_mul(x, y) (((x) >> 12) * ((y) >> 16))
+# else
+# define mad_f_mul(x, y) ((((x) + (1L << 11)) >> 12) * \
+ (((y) + (1L << 15)) >> 16))
+# endif
+
+/* ------------------------------------------------------------------------- */
+
+# else
+# error "no FPM selected"
+# endif
+
+/* default implementations */
+
+# if !defined(mad_f_mul)
+# define mad_f_mul(x, y) \
+ ({ register mad_fixed64hi_t __hi; \
+ register mad_fixed64lo_t __lo; \
+ MAD_F_MLX(__hi, __lo, (x), (y)); \
+ mad_f_scale64(__hi, __lo); \
+ })
+# endif
+
+# if !defined(MAD_F_MLA)
+# define MAD_F_ML0(hi, lo, x, y) ((lo) = mad_f_mul((x), (y)))
+# define MAD_F_MLA(hi, lo, x, y) ((lo) += mad_f_mul((x), (y)))
+# define MAD_F_MLN(hi, lo) ((lo) = -(lo))
+# define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo))
+# endif
+
+# if !defined(MAD_F_ML0)
+# define MAD_F_ML0(hi, lo, x, y) MAD_F_MLX((hi), (lo), (x), (y))
+# endif
+
+# if !defined(MAD_F_MLN)
+# define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi))
+# endif
+
+# if !defined(MAD_F_MLZ)
+# define MAD_F_MLZ(hi, lo) mad_f_scale64((hi), (lo))
+# endif
+
+# if !defined(mad_f_scale64)
+# if defined(OPT_ACCURACY)
+# define mad_f_scale64(hi, lo) \
+ ((((mad_fixed_t) \
+ (((hi) << (32 - (MAD_F_SCALEBITS - 1))) | \
+ ((lo) >> (MAD_F_SCALEBITS - 1)))) + 1) >> 1)
+# else
+# define mad_f_scale64(hi, lo) \
+ ((mad_fixed_t) \
+ (((hi) << (32 - MAD_F_SCALEBITS)) | \
+ ((lo) >> MAD_F_SCALEBITS)))
+# endif
+# define MAD_F_SCALEBITS MAD_F_FRACBITS
+# endif
+
+/* C routines */
+
+mad_fixed_t mad_f_abs(mad_fixed_t);
+mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t);
+
+# endif
+
+/* Id: bit.h,v 1.11 2003/05/27 22:40:36 rob Exp */
+
+# ifndef LIBMAD_BIT_H
+# define LIBMAD_BIT_H
+
+struct mad_bitptr {
+ unsigned char const *byte;
+ unsigned short cache;
+ unsigned short left;
+};
+
+void mad_bit_init(struct mad_bitptr *, unsigned char const *);
+
+# define mad_bit_finish(bitptr) /* nothing */
+
+unsigned int mad_bit_length(struct mad_bitptr const *,
+ struct mad_bitptr const *);
+
+# define mad_bit_bitsleft(bitptr) ((bitptr)->left)
+unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
+
+void mad_bit_skip(struct mad_bitptr *, unsigned int);
+unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
+void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
+
+unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
+
+# endif
+
+/* Id: timer.h,v 1.15 2003/05/27 22:40:37 rob Exp */
+
+# ifndef LIBMAD_TIMER_H
+# define LIBMAD_TIMER_H
+
+typedef struct {
+ signed long seconds; /* whole seconds */
+ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
+} mad_timer_t;
+
+extern mad_timer_t const mad_timer_zero;
+
+# define MAD_TIMER_RESOLUTION 352800000UL
+
+enum mad_units {
+ MAD_UNITS_HOURS = -2,
+ MAD_UNITS_MINUTES = -1,
+ MAD_UNITS_SECONDS = 0,
+
+ /* metric units */
+
+ MAD_UNITS_DECISECONDS = 10,
+ MAD_UNITS_CENTISECONDS = 100,
+ MAD_UNITS_MILLISECONDS = 1000,
+
+ /* audio sample units */
+
+ MAD_UNITS_8000_HZ = 8000,
+ MAD_UNITS_11025_HZ = 11025,
+ MAD_UNITS_12000_HZ = 12000,
+
+ MAD_UNITS_16000_HZ = 16000,
+ MAD_UNITS_22050_HZ = 22050,
+ MAD_UNITS_24000_HZ = 24000,
+
+ MAD_UNITS_32000_HZ = 32000,
+ MAD_UNITS_44100_HZ = 44100,
+ MAD_UNITS_48000_HZ = 48000,
+
+ /* video frame/field units */
+
+ MAD_UNITS_24_FPS = 24,
+ MAD_UNITS_25_FPS = 25,
+ MAD_UNITS_30_FPS = 30,
+ MAD_UNITS_48_FPS = 48,
+ MAD_UNITS_50_FPS = 50,
+ MAD_UNITS_60_FPS = 60,
+
+ /* CD audio frames */
+
+ MAD_UNITS_75_FPS = 75,
+
+ /* video drop-frame units */
+
+ MAD_UNITS_23_976_FPS = -24,
+ MAD_UNITS_24_975_FPS = -25,
+ MAD_UNITS_29_97_FPS = -30,
+ MAD_UNITS_47_952_FPS = -48,
+ MAD_UNITS_49_95_FPS = -50,
+ MAD_UNITS_59_94_FPS = -60
+};
+
+# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
+
+int mad_timer_compare(mad_timer_t, mad_timer_t);
+
+# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
+
+void mad_timer_negate(mad_timer_t *);
+mad_timer_t mad_timer_abs(mad_timer_t);
+
+void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
+void mad_timer_add(mad_timer_t *, mad_timer_t);
+void mad_timer_multiply(mad_timer_t *, signed long);
+
+signed long mad_timer_count(mad_timer_t, enum mad_units);
+unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
+void mad_timer_string(mad_timer_t, char *, char const *,
+ enum mad_units, enum mad_units, unsigned long);
+
+# endif
+
+/* Id: stream.h,v 1.18 2003/05/27 22:40:37 rob Exp */
+
+# ifndef LIBMAD_STREAM_H
+# define LIBMAD_STREAM_H
+
+
+# define MAD_BUFFER_GUARD 8
+# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
+
+enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
+ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
+ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
+
+ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
+
+ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
+ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
+ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
+ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
+ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
+
+ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
+ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
+ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
+ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
+ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
+ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
+ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
+ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
+ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
+ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
+ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
+ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
+};
+
+# define MAD_RECOVERABLE(error) ((error) & 0xff00)
+
+struct mad_stream {
+ unsigned char const *buffer; /* input bitstream buffer */
+ unsigned char const *bufend; /* end of buffer */
+ unsigned long skiplen; /* bytes to skip before next frame */
+
+ int sync; /* stream sync found */
+ unsigned long freerate; /* free bitrate (fixed) */
+
+ unsigned char const *this_frame; /* start of current frame */
+ unsigned char const *next_frame; /* start of next frame */
+ struct mad_bitptr ptr; /* current processing bit pointer */
+
+ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
+ unsigned int anc_bitlen; /* number of ancillary bits */
+
+ unsigned char (*main_data)[MAD_BUFFER_MDLEN];
+ /* Layer III main_data() */
+ unsigned int md_len; /* bytes in main_data */
+
+ int options; /* decoding options (see below) */
+ enum mad_error error; /* error code (see above) */
+};
+
+enum {
+ MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
+# if 0 /* not yet implemented */
+ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
+ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
+# endif
+};
+
+void mad_stream_init(struct mad_stream *);
+void mad_stream_finish(struct mad_stream *);
+
+# define mad_stream_options(stream, opts) \
+ ((void) ((stream)->options = (opts)))
+
+void mad_stream_buffer(struct mad_stream *,
+ unsigned char const *, unsigned long);
+void mad_stream_skip(struct mad_stream *, unsigned long);
+
+int mad_stream_sync(struct mad_stream *);
+
+char const *mad_stream_errorstr(struct mad_stream const *);
+
+# endif
+
+/* Id: frame.h,v 1.19 2003/05/27 22:40:36 rob Exp */
+
+# ifndef LIBMAD_FRAME_H
+# define LIBMAD_FRAME_H
+
+
+enum mad_layer {
+ MAD_LAYER_I = 1, /* Layer I */
+ MAD_LAYER_II = 2, /* Layer II */
+ MAD_LAYER_III = 3 /* Layer III */
+};
+
+enum mad_mode {
+ MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
+ MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
+ MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
+ MAD_MODE_STEREO = 3 /* normal LR stereo */
+};
+
+enum mad_emphasis {
+ MAD_EMPHASIS_NONE = 0, /* no emphasis */
+ MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
+ MAD_EMPHASIS_CCITT_J_17 = 3, /* CCITT J.17 emphasis */
+ MAD_EMPHASIS_RESERVED = 2 /* unknown emphasis */
+};
+
+struct mad_header {
+ enum mad_layer layer; /* audio layer (1, 2, or 3) */
+ enum mad_mode mode; /* channel mode (see above) */
+ int mode_extension; /* additional mode info */
+ enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
+
+ unsigned long bitrate; /* stream bitrate (bps) */
+ unsigned int samplerate; /* sampling frequency (Hz) */
+
+ unsigned short crc_check; /* frame CRC accumulator */
+ unsigned short crc_target; /* final target CRC checksum */
+
+ int flags; /* flags (see below) */
+ int private_bits; /* private bits (see below) */
+
+ mad_timer_t duration; /* audio playing time of frame */
+};
+
+struct mad_frame {
+ struct mad_header header; /* MPEG audio header */
+
+ int options; /* decoding options (from stream) */
+
+ mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
+ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
+};
+
+# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
+# define MAD_NSBSAMPLES(header) \
+ ((header)->layer == MAD_LAYER_I ? 12 : \
+ (((header)->layer == MAD_LAYER_III && \
+ ((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
+
+enum {
+ MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
+ MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
+
+ MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
+ MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
+ MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
+ MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
+
+ MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
+ MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
+ MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
+
+ MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
+ MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
+ MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
+};
+
+enum {
+ MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
+ MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
+};
+
+void mad_header_init(struct mad_header *);
+
+# define mad_header_finish(header) /* nothing */
+
+int mad_header_decode(struct mad_header *, struct mad_stream *);
+
+void mad_frame_init(struct mad_frame *);
+void mad_frame_finish(struct mad_frame *);
+
+int mad_frame_decode(struct mad_frame *, struct mad_stream *);
+
+void mad_frame_mute(struct mad_frame *);
+
+# endif
+
+/* Id: synth.h,v 1.14 2003/05/27 22:40:37 rob Exp */
+
+# ifndef LIBMAD_SYNTH_H
+# define LIBMAD_SYNTH_H
+
+
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+};
+
+struct mad_synth {
+ mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
+ /* [ch][eo][peo][s][v] */
+
+ unsigned int phase; /* current processing phase */
+
+ struct mad_pcm pcm; /* PCM output */
+};
+
+/* single channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
+};
+
+/* dual channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
+};
+
+/* stereo PCM selector */
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
+};
+
+void mad_synth_init(struct mad_synth *);
+
+# define mad_synth_finish(synth) /* nothing */
+
+void mad_synth_mute(struct mad_synth *);
+
+void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
+
+# endif
+
+/* Id: decoder.h,v 1.16 2003/05/27 22:40:36 rob Exp */
+
+# ifndef LIBMAD_DECODER_H
+# define LIBMAD_DECODER_H
+
+
+enum mad_decoder_mode {
+ MAD_DECODER_MODE_SYNC = 0,
+ MAD_DECODER_MODE_ASYNC
+};
+
+enum mad_flow {
+ MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
+ MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
+ MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
+ MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
+};
+
+struct mad_decoder {
+ enum mad_decoder_mode mode;
+
+ int options;
+
+ struct {
+ long pid;
+ int in;
+ int out;
+ } async;
+
+ struct {
+ struct mad_stream stream;
+ struct mad_frame frame;
+ struct mad_synth synth;
+ } *sync;
+
+ void *cb_data;
+
+ enum mad_flow (*input_func)(void *, struct mad_stream *);
+ enum mad_flow (*header_func)(void *, struct mad_header const *);
+ enum mad_flow (*filter_func)(void *,
+ struct mad_stream const *, struct mad_frame *);
+ enum mad_flow (*output_func)(void *,
+ struct mad_header const *, struct mad_pcm *);
+ enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
+ enum mad_flow (*message_func)(void *, void *, unsigned int *);
+};
+
+void mad_decoder_init(struct mad_decoder *, void *,
+ enum mad_flow (*)(void *, struct mad_stream *),
+ enum mad_flow (*)(void *, struct mad_header const *),
+ enum mad_flow (*)(void *,
+ struct mad_stream const *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *,
+ struct mad_header const *,
+ struct mad_pcm *),
+ enum mad_flow (*)(void *,
+ struct mad_stream *,
+ struct mad_frame *),
+ enum mad_flow (*)(void *, void *, unsigned int *));
+int mad_decoder_finish(struct mad_decoder *);
+
+# define mad_decoder_options(decoder, opts) \
+ ((void) ((decoder)->options = (opts)))
+
+int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
+int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
+
+# endif
+
+# ifdef __cplusplus
+}
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/qc_table.dat b/src/filters/transform/mpadecfilter/libmad-0.15.0b/qc_table.dat
new file mode 100644
index 000000000..a676a7fdd
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/qc_table.dat
@@ -0,0 +1,77 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: qc_table.dat,v 1.6 2003/05/27 22:40:36 rob Exp $
+ */
+
+/*
+ * These are the Layer II classes of quantization.
+ * The table is derived from Table B.4 of ISO/IEC 11172-3.
+ */
+
+ { 3, 2, 5,
+ MAD_F(0x15555555) /* 1.33333333333 => 1.33333333209, e 0.00000000124 */,
+ MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ },
+ { 5, 3, 7,
+ MAD_F(0x1999999a) /* 1.60000000000 => 1.60000000149, e -0.00000000149 */,
+ MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ },
+ { 7, 0, 3,
+ MAD_F(0x12492492) /* 1.14285714286 => 1.14285714179, e 0.00000000107 */,
+ MAD_F(0x04000000) /* 0.25000000000 => 0.25000000000, e 0.00000000000 */ },
+ { 9, 4, 10,
+ MAD_F(0x1c71c71c) /* 1.77777777777 => 1.77777777612, e 0.00000000165 */,
+ MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ },
+ { 15, 0, 4,
+ MAD_F(0x11111111) /* 1.06666666666 => 1.06666666642, e 0.00000000024 */,
+ MAD_F(0x02000000) /* 0.12500000000 => 0.12500000000, e 0.00000000000 */ },
+ { 31, 0, 5,
+ MAD_F(0x10842108) /* 1.03225806452 => 1.03225806355, e 0.00000000097 */,
+ MAD_F(0x01000000) /* 0.06250000000 => 0.06250000000, e 0.00000000000 */ },
+ { 63, 0, 6,
+ MAD_F(0x10410410) /* 1.01587301587 => 1.01587301493, e 0.00000000094 */,
+ MAD_F(0x00800000) /* 0.03125000000 => 0.03125000000, e 0.00000000000 */ },
+ { 127, 0, 7,
+ MAD_F(0x10204081) /* 1.00787401575 => 1.00787401572, e 0.00000000003 */,
+ MAD_F(0x00400000) /* 0.01562500000 => 0.01562500000, e 0.00000000000 */ },
+ { 255, 0, 8,
+ MAD_F(0x10101010) /* 1.00392156863 => 1.00392156839, e 0.00000000024 */,
+ MAD_F(0x00200000) /* 0.00781250000 => 0.00781250000, e 0.00000000000 */ },
+ { 511, 0, 9,
+ MAD_F(0x10080402) /* 1.00195694716 => 1.00195694715, e 0.00000000001 */,
+ MAD_F(0x00100000) /* 0.00390625000 => 0.00390625000, e 0.00000000000 */ },
+ { 1023, 0, 10,
+ MAD_F(0x10040100) /* 1.00097751711 => 1.00097751617, e 0.00000000094 */,
+ MAD_F(0x00080000) /* 0.00195312500 => 0.00195312500, e 0.00000000000 */ },
+ { 2047, 0, 11,
+ MAD_F(0x10020040) /* 1.00048851979 => 1.00048851967, e 0.00000000012 */,
+ MAD_F(0x00040000) /* 0.00097656250 => 0.00097656250, e 0.00000000000 */ },
+ { 4095, 0, 12,
+ MAD_F(0x10010010) /* 1.00024420024 => 1.00024420023, e 0.00000000001 */,
+ MAD_F(0x00020000) /* 0.00048828125 => 0.00048828125, e 0.00000000000 */ },
+ { 8191, 0, 13,
+ MAD_F(0x10008004) /* 1.00012208522 => 1.00012208521, e 0.00000000001 */,
+ MAD_F(0x00010000) /* 0.00024414063 => 0.00024414062, e 0.00000000000 */ },
+ { 16383, 0, 14,
+ MAD_F(0x10004001) /* 1.00006103888 => 1.00006103888, e -0.00000000000 */,
+ MAD_F(0x00008000) /* 0.00012207031 => 0.00012207031, e -0.00000000000 */ },
+ { 32767, 0, 15,
+ MAD_F(0x10002000) /* 1.00003051851 => 1.00003051758, e 0.00000000093 */,
+ MAD_F(0x00004000) /* 0.00006103516 => 0.00006103516, e 0.00000000000 */ },
+ { 65535, 0, 16,
+ MAD_F(0x10001000) /* 1.00001525902 => 1.00001525879, e 0.00000000023 */,
+ MAD_F(0x00002000) /* 0.00003051758 => 0.00003051758, e 0.00000000000 */ }
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/rq_table.dat b/src/filters/transform/mpadecfilter/libmad-0.15.0b/rq_table.dat
new file mode 100644
index 000000000..4c41d12eb
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/rq_table.dat
@@ -0,0 +1,8747 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: rq_table.dat,v 1.6 2003/05/27 22:40:36 rob Exp $
+ */
+
+/*
+ * This is the lookup table used to compute x^(4/3) for Layer III
+ * requantization. To maintain the best possible accuracy, the value is
+ * stored as a normalized mantissa with exponent. The requantization
+ * algorithm recombines these parts with appropriate scaling.
+ */
+
+ /* 0 */ { MAD_F(0x00000000) /* 0.000000000 */, 0 },
+ /* 1 */ { MAD_F(0x04000000) /* 0.250000000 */, 2 },
+ /* 2 */ { MAD_F(0x050a28be) /* 0.314980262 */, 3 },
+ /* 3 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 4 },
+ /* 4 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 4 },
+ /* 5 */ { MAD_F(0x04466275) /* 0.267183742 */, 5 },
+ /* 6 */ { MAD_F(0x05738c72) /* 0.340710111 */, 5 },
+ /* 7 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 5 },
+ /* 8 */ { MAD_F(0x04000000) /* 0.250000000 */, 6 },
+ /* 9 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 6 },
+ /* 10 */ { MAD_F(0x0562d694) /* 0.336630420 */, 6 },
+ /* 11 */ { MAD_F(0x061dae96) /* 0.382246578 */, 6 },
+ /* 12 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 6 },
+ /* 13 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 6 },
+ /* 14 */ { MAD_F(0x0437be65) /* 0.263609310 */, 7 },
+ /* 15 */ { MAD_F(0x049fc824) /* 0.289009227 */, 7 },
+
+ /* 16 */ { MAD_F(0x050a28be) /* 0.314980262 */, 7 },
+ /* 17 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 7 },
+ /* 18 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 7 },
+ /* 19 */ { MAD_F(0x06566361) /* 0.396090870 */, 7 },
+ /* 20 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 7 },
+ /* 21 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 7 },
+ /* 22 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 7 },
+ /* 23 */ { MAD_F(0x04168b05) /* 0.255503674 */, 8 },
+ /* 24 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 8 },
+ /* 25 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 8 },
+ /* 26 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 8 },
+ /* 27 */ { MAD_F(0x05100000) /* 0.316406250 */, 8 },
+ /* 28 */ { MAD_F(0x05506451) /* 0.332126919 */, 8 },
+ /* 29 */ { MAD_F(0x05918e15) /* 0.348035890 */, 8 },
+ /* 30 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 8 },
+ /* 31 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 8 },
+
+ /* 32 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 8 },
+ /* 33 */ { MAD_F(0x069d9400) /* 0.413471222 */, 8 },
+ /* 34 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 8 },
+ /* 35 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 8 },
+ /* 36 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 8 },
+ /* 37 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 8 },
+ /* 38 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 8 },
+ /* 39 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 9 },
+ /* 40 */ { MAD_F(0x04466275) /* 0.267183742 */, 9 },
+ /* 41 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 9 },
+ /* 42 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 9 },
+ /* 43 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 9 },
+ /* 44 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 9 },
+ /* 45 */ { MAD_F(0x05007b49) /* 0.312617576 */, 9 },
+ /* 46 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 9 },
+ /* 47 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 9 },
+
+ /* 48 */ { MAD_F(0x05738c72) /* 0.340710111 */, 9 },
+ /* 49 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 9 },
+ /* 50 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 9 },
+ /* 51 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 9 },
+ /* 52 */ { MAD_F(0x0610b982) /* 0.379083164 */, 9 },
+ /* 53 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 9 },
+ /* 54 */ { MAD_F(0x0660db91) /* 0.398646895 */, 9 },
+ /* 55 */ { MAD_F(0x06894c90) /* 0.408520284 */, 9 },
+ /* 56 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 9 },
+ /* 57 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 9 },
+ /* 58 */ { MAD_F(0x07041636) /* 0.438497744 */, 9 },
+ /* 59 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 9 },
+ /* 60 */ { MAD_F(0x075722ef) /* 0.458773552 */, 9 },
+ /* 61 */ { MAD_F(0x078102b8) /* 0.468996735 */, 9 },
+ /* 62 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 9 },
+ /* 63 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 9 },
+
+ /* 64 */ { MAD_F(0x04000000) /* 0.250000000 */, 10 },
+ /* 65 */ { MAD_F(0x04156381) /* 0.255221850 */, 10 },
+ /* 66 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 10 },
+ /* 67 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 10 },
+ /* 68 */ { MAD_F(0x045635cf) /* 0.271047409 */, 10 },
+ /* 69 */ { MAD_F(0x046c083e) /* 0.276375048 */, 10 },
+ /* 70 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 10 },
+ /* 71 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 10 },
+ /* 72 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 10 },
+ /* 73 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 10 },
+ /* 74 */ { MAD_F(0x04dab524) /* 0.303395408 */, 10 },
+ /* 75 */ { MAD_F(0x04f12624) /* 0.308874267 */, 10 },
+ /* 76 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 10 },
+ /* 77 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 10 },
+ /* 78 */ { MAD_F(0x053511cb) /* 0.325456423 */, 10 },
+ /* 79 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 10 },
+
+ /* 80 */ { MAD_F(0x0562d694) /* 0.336630420 */, 10 },
+ /* 81 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 10 },
+ /* 82 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 10 },
+ /* 83 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 10 },
+ /* 84 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 10 },
+ /* 85 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 10 },
+ /* 86 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 10 },
+ /* 87 */ { MAD_F(0x0606012b) /* 0.376465960 */, 10 },
+ /* 88 */ { MAD_F(0x061dae96) /* 0.382246578 */, 10 },
+ /* 89 */ { MAD_F(0x06357302) /* 0.388049134 */, 10 },
+ /* 90 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 10 },
+ /* 91 */ { MAD_F(0x0665402d) /* 0.399719406 */, 10 },
+ /* 92 */ { MAD_F(0x067d4896) /* 0.405586801 */, 10 },
+ /* 93 */ { MAD_F(0x06956753) /* 0.411475493 */, 10 },
+ /* 94 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 10 },
+ /* 95 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 10 },
+
+ /* 96 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 10 },
+ /* 97 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 10 },
+ /* 98 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 10 },
+ /* 99 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 10 },
+ /* 100 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 10 },
+ /* 101 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 10 },
+ /* 102 */ { MAD_F(0x07724f64) /* 0.465407744 */, 10 },
+ /* 103 */ { MAD_F(0x078b4514) /* 0.471501425 */, 10 },
+ /* 104 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 10 },
+ /* 105 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 10 },
+ /* 106 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 10 },
+ /* 107 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 10 },
+ /* 108 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 11 },
+ /* 109 */ { MAD_F(0x04115aca) /* 0.254236974 */, 11 },
+ /* 110 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 11 },
+ /* 111 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 11 },
+
+ /* 112 */ { MAD_F(0x0437be65) /* 0.263609310 */, 11 },
+ /* 113 */ { MAD_F(0x04449dee) /* 0.266752177 */, 11 },
+ /* 114 */ { MAD_F(0x04518733) /* 0.269904329 */, 11 },
+ /* 115 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 11 },
+ /* 116 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 11 },
+ /* 117 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 11 },
+ /* 118 */ { MAD_F(0x04858c83) /* 0.282604707 */, 11 },
+ /* 119 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 11 },
+ /* 120 */ { MAD_F(0x049fc824) /* 0.289009227 */, 11 },
+ /* 121 */ { MAD_F(0x04acf402) /* 0.292224893 */, 11 },
+ /* 122 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 11 },
+ /* 123 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 11 },
+ /* 124 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 11 },
+ /* 125 */ { MAD_F(0x04e20000) /* 0.305175781 */, 11 },
+ /* 126 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 11 },
+ /* 127 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 11 },
+
+ /* 128 */ { MAD_F(0x050a28be) /* 0.314980262 */, 11 },
+ /* 129 */ { MAD_F(0x05179da4) /* 0.318265572 */, 11 },
+ /* 130 */ { MAD_F(0x05251b73) /* 0.321559381 */, 11 },
+ /* 131 */ { MAD_F(0x0532a220) /* 0.324861647 */, 11 },
+ /* 132 */ { MAD_F(0x054031a0) /* 0.328172327 */, 11 },
+ /* 133 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 11 },
+ /* 134 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 11 },
+ /* 135 */ { MAD_F(0x0569149c) /* 0.338154423 */, 11 },
+ /* 136 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 11 },
+ /* 137 */ { MAD_F(0x058481e9) /* 0.344850455 */, 11 },
+ /* 138 */ { MAD_F(0x0592456d) /* 0.348210741 */, 11 },
+ /* 139 */ { MAD_F(0x05a01176) /* 0.351579152 */, 11 },
+ /* 140 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 11 },
+ /* 141 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 11 },
+ /* 142 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 11 },
+ /* 143 */ { MAD_F(0x05d79601) /* 0.365133291 */, 11 },
+
+ /* 144 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 11 },
+ /* 145 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 11 },
+ /* 146 */ { MAD_F(0x060190ee) /* 0.375382356 */, 11 },
+ /* 147 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 11 },
+ /* 148 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 11 },
+ /* 149 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 11 },
+ /* 150 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 11 },
+ /* 151 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 11 },
+ /* 152 */ { MAD_F(0x06566361) /* 0.396090870 */, 11 },
+ /* 153 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 11 },
+ /* 154 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 11 },
+ /* 155 */ { MAD_F(0x068138f3) /* 0.406548452 */, 11 },
+ /* 156 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 11 },
+ /* 157 */ { MAD_F(0x069deed1) /* 0.413557833 */, 11 },
+ /* 158 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 11 },
+ /* 159 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 11 },
+
+ /* 160 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 11 },
+ /* 161 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 11 },
+ /* 162 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 11 },
+ /* 163 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 11 },
+ /* 164 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 11 },
+ /* 165 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 11 },
+ /* 166 */ { MAD_F(0x0720a087) /* 0.445465593 */, 11 },
+ /* 167 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 11 },
+ /* 168 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 11 },
+ /* 169 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 11 },
+ /* 170 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 11 },
+ /* 171 */ { MAD_F(0x076a454c) /* 0.463444993 */, 11 },
+ /* 172 */ { MAD_F(0x07791620) /* 0.467062117 */, 11 },
+ /* 173 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 11 },
+ /* 174 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 11 },
+ /* 175 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 11 },
+
+ /* 176 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 11 },
+ /* 177 */ { MAD_F(0x07c39812) /* 0.485252449 */, 11 },
+ /* 178 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 11 },
+ /* 179 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 11 },
+ /* 180 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 11 },
+ /* 181 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 11 },
+ /* 182 */ { MAD_F(0x0407673f) /* 0.251807447 */, 12 },
+ /* 183 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 12 },
+ /* 184 */ { MAD_F(0x04168b05) /* 0.255503674 */, 12 },
+ /* 185 */ { MAD_F(0x041e2230) /* 0.257356825 */, 12 },
+ /* 186 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 12 },
+ /* 187 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 12 },
+ /* 188 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 12 },
+ /* 189 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 12 },
+ /* 190 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 12 },
+ /* 191 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 12 },
+
+ /* 192 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 12 },
+ /* 193 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 12 },
+ /* 194 */ { MAD_F(0x04630eed) /* 0.274184158 */, 12 },
+ /* 195 */ { MAD_F(0x046ac896) /* 0.276070203 */, 12 },
+ /* 196 */ { MAD_F(0x047285a2) /* 0.277959474 */, 12 },
+ /* 197 */ { MAD_F(0x047a460c) /* 0.279851960 */, 12 },
+ /* 198 */ { MAD_F(0x048209d3) /* 0.281747652 */, 12 },
+ /* 199 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 12 },
+ /* 200 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 12 },
+ /* 201 */ { MAD_F(0x04996935) /* 0.287453849 */, 12 },
+ /* 202 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 12 },
+ /* 203 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 12 },
+ /* 204 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 12 },
+ /* 205 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 12 },
+ /* 206 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 12 },
+ /* 207 */ { MAD_F(0x04c88135) /* 0.298951346 */, 12 },
+
+ /* 208 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 12 },
+ /* 209 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 12 },
+ /* 210 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 12 },
+ /* 211 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 12 },
+ /* 212 */ { MAD_F(0x04f01963) /* 0.308617963 */, 12 },
+ /* 213 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 12 },
+ /* 214 */ { MAD_F(0x05000655) /* 0.312506041 */, 12 },
+ /* 215 */ { MAD_F(0x05080195) /* 0.314454634 */, 12 },
+ /* 216 */ { MAD_F(0x05100000) /* 0.316406250 */, 12 },
+ /* 217 */ { MAD_F(0x05180194) /* 0.318360880 */, 12 },
+ /* 218 */ { MAD_F(0x0520064f) /* 0.320318516 */, 12 },
+ /* 219 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 12 },
+ /* 220 */ { MAD_F(0x0530192e) /* 0.324242764 */, 12 },
+ /* 221 */ { MAD_F(0x0538274e) /* 0.326209359 */, 12 },
+ /* 222 */ { MAD_F(0x0540388a) /* 0.328178922 */, 12 },
+ /* 223 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 12 },
+
+ /* 224 */ { MAD_F(0x05506451) /* 0.332126919 */, 12 },
+ /* 225 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 12 },
+ /* 226 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 12 },
+ /* 227 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 12 },
+ /* 228 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 12 },
+ /* 229 */ { MAD_F(0x05790793) /* 0.342048241 */, 12 },
+ /* 230 */ { MAD_F(0x05813162) /* 0.344041237 */, 12 },
+ /* 231 */ { MAD_F(0x05895e39) /* 0.346037122 */, 12 },
+ /* 232 */ { MAD_F(0x05918e15) /* 0.348035890 */, 12 },
+ /* 233 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 12 },
+ /* 234 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 12 },
+ /* 235 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 12 },
+ /* 236 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 12 },
+ /* 237 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 12 },
+ /* 238 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 12 },
+ /* 239 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 12 },
+
+ /* 240 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 12 },
+ /* 241 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 12 },
+ /* 242 */ { MAD_F(0x05e41105) /* 0.368180294 */, 12 },
+ /* 243 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 12 },
+ /* 244 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 12 },
+ /* 245 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 12 },
+ /* 246 */ { MAD_F(0x060564b1) /* 0.376316732 */, 12 },
+ /* 247 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 12 },
+ /* 248 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 12 },
+ /* 249 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 12 },
+ /* 250 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 12 },
+ /* 251 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 12 },
+ /* 252 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 12 },
+ /* 253 */ { MAD_F(0x06402666) /* 0.390661620 */, 12 },
+ /* 254 */ { MAD_F(0x064896a7) /* 0.392721798 */, 12 },
+ /* 255 */ { MAD_F(0x065109be) /* 0.394784681 */, 12 },
+
+ /* 256 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 12 },
+ /* 257 */ { MAD_F(0x0661f867) /* 0.398918536 */, 12 },
+ /* 258 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 12 },
+ /* 259 */ { MAD_F(0x0672f252) /* 0.403063128 */, 12 },
+ /* 260 */ { MAD_F(0x067b737c) /* 0.405139433 */, 12 },
+ /* 261 */ { MAD_F(0x0683f771) /* 0.407218402 */, 12 },
+ /* 262 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 12 },
+ /* 263 */ { MAD_F(0x069507b5) /* 0.411384303 */, 12 },
+ /* 264 */ { MAD_F(0x069d9400) /* 0.413471222 */, 12 },
+ /* 265 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 12 },
+ /* 266 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 12 },
+ /* 267 */ { MAD_F(0x06b74971) /* 0.419747773 */, 12 },
+ /* 268 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 12 },
+ /* 269 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 12 },
+ /* 270 */ { MAD_F(0x06d11794) /* 0.426047876 */, 12 },
+ /* 271 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 12 },
+
+ /* 272 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 12 },
+ /* 273 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 12 },
+ /* 274 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 12 },
+ /* 275 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 12 },
+ /* 276 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 12 },
+ /* 277 */ { MAD_F(0x070dacea) /* 0.440838732 */, 12 },
+ /* 278 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 12 },
+ /* 279 */ { MAD_F(0x071f1459) /* 0.445087765 */, 12 },
+ /* 280 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 12 },
+ /* 281 */ { MAD_F(0x07308671) /* 0.449346964 */, 12 },
+ /* 282 */ { MAD_F(0x07394378) /* 0.451480360 */, 12 },
+ /* 283 */ { MAD_F(0x07420325) /* 0.453616280 */, 12 },
+ /* 284 */ { MAD_F(0x074ac575) /* 0.455754717 */, 12 },
+ /* 285 */ { MAD_F(0x07538a67) /* 0.457895665 */, 12 },
+ /* 286 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 12 },
+ /* 287 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 12 },
+
+ /* 288 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 12 },
+ /* 289 */ { MAD_F(0x0776b867) /* 0.466484455 */, 12 },
+ /* 290 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 12 },
+ /* 291 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 12 },
+ /* 292 */ { MAD_F(0x07913641) /* 0.472952132 */, 12 },
+ /* 293 */ { MAD_F(0x079a100c) /* 0.475112962 */, 12 },
+ /* 294 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 12 },
+ /* 295 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 12 },
+ /* 296 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 12 },
+ /* 297 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 12 },
+ /* 298 */ { MAD_F(0x07c67798) /* 0.485953899 */, 12 },
+ /* 299 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 12 },
+ /* 300 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 12 },
+ /* 301 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 12 },
+ /* 302 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 12 },
+ /* 303 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 12 },
+
+ /* 304 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 12 },
+ /* 305 */ { MAD_F(0x0402868e) /* 0.250616605 */, 13 },
+ /* 306 */ { MAD_F(0x040703ff) /* 0.251712795 */, 13 },
+ /* 307 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 13 },
+ /* 308 */ { MAD_F(0x041002a1) /* 0.253908756 */, 13 },
+ /* 309 */ { MAD_F(0x041483d1) /* 0.255008523 */, 13 },
+ /* 310 */ { MAD_F(0x04190640) /* 0.256109476 */, 13 },
+ /* 311 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 13 },
+ /* 312 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 13 },
+ /* 313 */ { MAD_F(0x042694fe) /* 0.259419433 */, 13 },
+ /* 314 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 13 },
+ /* 315 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 13 },
+ /* 316 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 13 },
+ /* 317 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 13 },
+ /* 318 */ { MAD_F(0x043d4635) /* 0.264959533 */, 13 },
+ /* 319 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 13 },
+
+ /* 320 */ { MAD_F(0x04466275) /* 0.267183742 */, 13 },
+ /* 321 */ { MAD_F(0x044af269) /* 0.268297587 */, 13 },
+ /* 322 */ { MAD_F(0x044f8393) /* 0.269412589 */, 13 },
+ /* 323 */ { MAD_F(0x045415f3) /* 0.270528746 */, 13 },
+ /* 324 */ { MAD_F(0x0458a989) /* 0.271646056 */, 13 },
+ /* 325 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 13 },
+ /* 326 */ { MAD_F(0x0461d451) /* 0.273884123 */, 13 },
+ /* 327 */ { MAD_F(0x04666b83) /* 0.275004875 */, 13 },
+ /* 328 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 13 },
+ /* 329 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 13 },
+ /* 330 */ { MAD_F(0x04743847) /* 0.278373983 */, 13 },
+ /* 331 */ { MAD_F(0x0478d440) /* 0.279499294 */, 13 },
+ /* 332 */ { MAD_F(0x047d716a) /* 0.280625739 */, 13 },
+ /* 333 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 13 },
+ /* 334 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 13 },
+ /* 335 */ { MAD_F(0x048b5003) /* 0.284011853 */, 13 },
+
+ /* 336 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 13 },
+ /* 337 */ { MAD_F(0x049494fb) /* 0.286274891 */, 13 },
+ /* 338 */ { MAD_F(0x0499393a) /* 0.287408091 */, 13 },
+ /* 339 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 13 },
+ /* 340 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 13 },
+ /* 341 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 13 },
+ /* 342 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 13 },
+ /* 343 */ { MAD_F(0x04b08000) /* 0.293090820 */, 13 },
+ /* 344 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 13 },
+ /* 345 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 13 },
+ /* 346 */ { MAD_F(0x04be8537) /* 0.296513762 */, 13 },
+ /* 347 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 13 },
+ /* 348 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 13 },
+ /* 349 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 13 },
+ /* 350 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 13 },
+ /* 351 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 13 },
+
+ /* 352 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 13 },
+ /* 353 */ { MAD_F(0x04df6458) /* 0.304539056 */, 13 },
+ /* 354 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 13 },
+ /* 355 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 13 },
+ /* 356 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 13 },
+ /* 357 */ { MAD_F(0x04f24618) /* 0.309148880 */, 13 },
+ /* 358 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 13 },
+ /* 359 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 13 },
+ /* 360 */ { MAD_F(0x05007b49) /* 0.312617576 */, 13 },
+ /* 361 */ { MAD_F(0x050539ef) /* 0.313775954 */, 13 },
+ /* 362 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 13 },
+ /* 363 */ { MAD_F(0x050eba98) /* 0.316095920 */, 13 },
+ /* 364 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 13 },
+ /* 365 */ { MAD_F(0x05183fba) /* 0.318420150 */, 13 },
+ /* 366 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 13 },
+ /* 367 */ { MAD_F(0x0521c950) /* 0.320748629 */, 13 },
+
+ /* 368 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 13 },
+ /* 369 */ { MAD_F(0x052b5757) /* 0.323081342 */, 13 },
+ /* 370 */ { MAD_F(0x05302003) /* 0.324249281 */, 13 },
+ /* 371 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 13 },
+ /* 372 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 13 },
+ /* 373 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 13 },
+ /* 374 */ { MAD_F(0x05434db9) /* 0.328931546 */, 13 },
+ /* 375 */ { MAD_F(0x05481be5) /* 0.330104730 */, 13 },
+ /* 376 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 13 },
+ /* 377 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 13 },
+ /* 378 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 13 },
+ /* 379 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 13 },
+ /* 380 */ { MAD_F(0x05603321) /* 0.335986261 */, 13 },
+ /* 381 */ { MAD_F(0x056507d6) /* 0.337165677 */, 13 },
+ /* 382 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 13 },
+ /* 383 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 13 },
+
+ /* 384 */ { MAD_F(0x05738c72) /* 0.340710111 */, 13 },
+ /* 385 */ { MAD_F(0x05786578) /* 0.341893646 */, 13 },
+ /* 386 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 13 },
+ /* 387 */ { MAD_F(0x05821abf) /* 0.344263788 */, 13 },
+ /* 388 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 13 },
+ /* 389 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 13 },
+ /* 390 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 13 },
+ /* 391 */ { MAD_F(0x05959222) /* 0.349016318 */, 13 },
+ /* 392 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 13 },
+ /* 393 */ { MAD_F(0x059f5438) /* 0.351398678 */, 13 },
+ /* 394 */ { MAD_F(0x05a436da) /* 0.352591376 */, 13 },
+ /* 395 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 13 },
+ /* 396 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 13 },
+ /* 397 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 13 },
+ /* 398 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 13 },
+ /* 399 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 13 },
+
+ /* 400 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 13 },
+ /* 401 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 13 },
+ /* 402 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 13 },
+ /* 403 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 13 },
+ /* 404 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 13 },
+ /* 405 */ { MAD_F(0x05da394d) /* 0.365777304 */, 13 },
+ /* 406 */ { MAD_F(0x05df2885) /* 0.366982004 */, 13 },
+ /* 407 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 13 },
+ /* 408 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 13 },
+ /* 409 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 13 },
+ /* 410 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 13 },
+ /* 411 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 13 },
+ /* 412 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 13 },
+ /* 413 */ { MAD_F(0x0601d004) /* 0.375442522 */, 13 },
+ /* 414 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 13 },
+ /* 415 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 13 },
+
+ /* 416 */ { MAD_F(0x0610b982) /* 0.379083164 */, 13 },
+ /* 417 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 13 },
+ /* 418 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 13 },
+ /* 419 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 13 },
+ /* 420 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 13 },
+ /* 421 */ { MAD_F(0x0629a863) /* 0.385170352 */, 13 },
+ /* 422 */ { MAD_F(0x062ea802) /* 0.386390694 */, 13 },
+ /* 423 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 13 },
+ /* 424 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 13 },
+ /* 425 */ { MAD_F(0x063dacee) /* 0.390057497 */, 13 },
+ /* 426 */ { MAD_F(0x0642b096) /* 0.391281687 */, 13 },
+ /* 427 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 13 },
+ /* 428 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 13 },
+ /* 429 */ { MAD_F(0x0651c193) /* 0.394959999 */, 13 },
+ /* 430 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 13 },
+ /* 431 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 13 },
+
+ /* 432 */ { MAD_F(0x0660db91) /* 0.398646895 */, 13 },
+ /* 433 */ { MAD_F(0x0665e639) /* 0.399877761 */, 13 },
+ /* 434 */ { MAD_F(0x066af1df) /* 0.401109575 */, 13 },
+ /* 435 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 13 },
+ /* 436 */ { MAD_F(0x06750c26) /* 0.403576041 */, 13 },
+ /* 437 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 13 },
+ /* 438 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 13 },
+ /* 439 */ { MAD_F(0x06843afb) /* 0.407282813 */, 13 },
+ /* 440 */ { MAD_F(0x06894c90) /* 0.408520284 */, 13 },
+ /* 441 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 13 },
+ /* 442 */ { MAD_F(0x069372ae) /* 0.410998038 */, 13 },
+ /* 443 */ { MAD_F(0x06988735) /* 0.412238319 */, 13 },
+ /* 444 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 13 },
+ /* 445 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 13 },
+ /* 446 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 13 },
+ /* 447 */ { MAD_F(0x06ace318) /* 0.417208762 */, 13 },
+
+ /* 448 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 13 },
+ /* 449 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 13 },
+ /* 450 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 13 },
+ /* 451 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 13 },
+ /* 452 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 13 },
+ /* 453 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 13 },
+ /* 454 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 13 },
+ /* 455 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 13 },
+ /* 456 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 13 },
+ /* 457 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 13 },
+ /* 458 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 13 },
+ /* 459 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 13 },
+ /* 460 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 13 },
+ /* 461 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 13 },
+ /* 462 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 13 },
+ /* 463 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 13 },
+
+ /* 464 */ { MAD_F(0x07041636) /* 0.438497744 */, 13 },
+ /* 465 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 13 },
+ /* 466 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 13 },
+ /* 467 */ { MAD_F(0x07139641) /* 0.442281965 */, 13 },
+ /* 468 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 13 },
+ /* 469 */ { MAD_F(0x071df058) /* 0.444809288 */, 13 },
+ /* 470 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 13 },
+ /* 471 */ { MAD_F(0x07284e34) /* 0.447340205 */, 13 },
+ /* 472 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 13 },
+ /* 473 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 13 },
+ /* 474 */ { MAD_F(0x0737e209) /* 0.451143300 */, 13 },
+ /* 475 */ { MAD_F(0x073d1530) /* 0.452412785 */, 13 },
+ /* 476 */ { MAD_F(0x07424946) /* 0.453683161 */, 13 },
+ /* 477 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 13 },
+ /* 478 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 13 },
+ /* 479 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 13 },
+
+ /* 480 */ { MAD_F(0x075722ef) /* 0.458773552 */, 13 },
+ /* 481 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 13 },
+ /* 482 */ { MAD_F(0x07619557) /* 0.461324062 */, 13 },
+ /* 483 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 13 },
+ /* 484 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 13 },
+ /* 485 */ { MAD_F(0x077147e2) /* 0.465156443 */, 13 },
+ /* 486 */ { MAD_F(0x0776853e) /* 0.466435663 */, 13 },
+ /* 487 */ { MAD_F(0x077bc385) /* 0.467715761 */, 13 },
+ /* 488 */ { MAD_F(0x078102b8) /* 0.468996735 */, 13 },
+ /* 489 */ { MAD_F(0x078642d6) /* 0.470278584 */, 13 },
+ /* 490 */ { MAD_F(0x078b83de) /* 0.471561307 */, 13 },
+ /* 491 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 13 },
+ /* 492 */ { MAD_F(0x079608ae) /* 0.474129372 */, 13 },
+ /* 493 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 13 },
+ /* 494 */ { MAD_F(0x07a09124) /* 0.476700918 */, 13 },
+ /* 495 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 13 },
+
+ /* 496 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 13 },
+ /* 497 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 13 },
+ /* 498 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 13 },
+ /* 499 */ { MAD_F(0x07baf635) /* 0.483144957 */, 13 },
+ /* 500 */ { MAD_F(0x07c04056) /* 0.484436356 */, 13 },
+ /* 501 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 13 },
+ /* 502 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 13 },
+ /* 503 */ { MAD_F(0x07d02424) /* 0.488315717 */, 13 },
+ /* 504 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 13 },
+ /* 505 */ { MAD_F(0x07dac083) /* 0.490906249 */, 13 },
+ /* 506 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 13 },
+ /* 507 */ { MAD_F(0x07e56078) /* 0.493500203 */, 13 },
+ /* 508 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 13 },
+ /* 509 */ { MAD_F(0x07f00401) /* 0.496097570 */, 13 },
+ /* 510 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 13 },
+ /* 511 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 13 },
+
+ /* 512 */ { MAD_F(0x04000000) /* 0.250000000 */, 14 },
+ /* 513 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 14 },
+ /* 514 */ { MAD_F(0x04055638) /* 0.251302930 */, 14 },
+ /* 515 */ { MAD_F(0x040801ff) /* 0.251955030 */, 14 },
+ /* 516 */ { MAD_F(0x040aae37) /* 0.252607552 */, 14 },
+ /* 517 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 14 },
+ /* 518 */ { MAD_F(0x041007fa) /* 0.253913860 */, 14 },
+ /* 519 */ { MAD_F(0x0412b586) /* 0.254567645 */, 14 },
+ /* 520 */ { MAD_F(0x04156381) /* 0.255221850 */, 14 },
+ /* 521 */ { MAD_F(0x041811ee) /* 0.255876475 */, 14 },
+ /* 522 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 14 },
+ /* 523 */ { MAD_F(0x041d7018) /* 0.257186980 */, 14 },
+ /* 524 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 14 },
+ /* 525 */ { MAD_F(0x0422d003) /* 0.258499157 */, 14 },
+ /* 526 */ { MAD_F(0x042580a0) /* 0.259155872 */, 14 },
+ /* 527 */ { MAD_F(0x042831ad) /* 0.259813002 */, 14 },
+
+ /* 528 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 14 },
+ /* 529 */ { MAD_F(0x042d9516) /* 0.261128510 */, 14 },
+ /* 530 */ { MAD_F(0x04304772) /* 0.261786886 */, 14 },
+ /* 531 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 14 },
+ /* 532 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 14 },
+ /* 533 */ { MAD_F(0x0438611f) /* 0.263764497 */, 14 },
+ /* 534 */ { MAD_F(0x043b1536) /* 0.264424527 */, 14 },
+ /* 535 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 14 },
+ /* 536 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 14 },
+ /* 537 */ { MAD_F(0x04433414) /* 0.266407088 */, 14 },
+ /* 538 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 14 },
+ /* 539 */ { MAD_F(0x0448a024) /* 0.267730848 */, 14 },
+ /* 540 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 14 },
+ /* 541 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 14 },
+ /* 542 */ { MAD_F(0x0450c575) /* 0.269719560 */, 14 },
+ /* 543 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 14 },
+
+ /* 544 */ { MAD_F(0x045635cf) /* 0.271047409 */, 14 },
+ /* 545 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 14 },
+ /* 546 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 14 },
+ /* 547 */ { MAD_F(0x045e6188) /* 0.273042234 */, 14 },
+ /* 548 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 14 },
+ /* 549 */ { MAD_F(0x0463d625) /* 0.274374147 */, 14 },
+ /* 550 */ { MAD_F(0x04669116) /* 0.275040710 */, 14 },
+ /* 551 */ { MAD_F(0x04694c74) /* 0.275707677 */, 14 },
+ /* 552 */ { MAD_F(0x046c083e) /* 0.276375048 */, 14 },
+ /* 553 */ { MAD_F(0x046ec474) /* 0.277042822 */, 14 },
+ /* 554 */ { MAD_F(0x04718116) /* 0.277710999 */, 14 },
+ /* 555 */ { MAD_F(0x04743e25) /* 0.278379578 */, 14 },
+ /* 556 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 14 },
+ /* 557 */ { MAD_F(0x0479b984) /* 0.279717940 */, 14 },
+ /* 558 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 14 },
+ /* 559 */ { MAD_F(0x047f3693) /* 0.281057905 */, 14 },
+
+ /* 560 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 14 },
+ /* 561 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 14 },
+ /* 562 */ { MAD_F(0x0487754c) /* 0.283070849 */, 14 },
+ /* 563 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 14 },
+ /* 564 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 14 },
+ /* 565 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 14 },
+ /* 566 */ { MAD_F(0x04927972) /* 0.285760350 */, 14 },
+ /* 567 */ { MAD_F(0x04953b85) /* 0.286433717 */, 14 },
+ /* 568 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 14 },
+ /* 569 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 14 },
+ /* 570 */ { MAD_F(0x049d843e) /* 0.288456194 */, 14 },
+ /* 571 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 14 },
+ /* 572 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 14 },
+ /* 573 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 14 },
+ /* 574 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 14 },
+ /* 575 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 14 },
+
+ /* 576 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 14 },
+ /* 577 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 14 },
+ /* 578 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 14 },
+ /* 579 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 14 },
+ /* 580 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 14 },
+ /* 581 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 14 },
+ /* 582 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 14 },
+ /* 583 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 14 },
+ /* 584 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 14 },
+ /* 585 */ { MAD_F(0x04c72771) /* 0.298621598 */, 14 },
+ /* 586 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 14 },
+ /* 587 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 14 },
+ /* 588 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 14 },
+ /* 589 */ { MAD_F(0x04d25169) /* 0.301347172 */, 14 },
+ /* 590 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 14 },
+ /* 591 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 14 },
+
+ /* 592 */ { MAD_F(0x04dab524) /* 0.303395408 */, 14 },
+ /* 593 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 14 },
+ /* 594 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 14 },
+ /* 595 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 14 },
+ /* 596 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 14 },
+ /* 597 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 14 },
+ /* 598 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 14 },
+ /* 599 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 14 },
+ /* 600 */ { MAD_F(0x04f12624) /* 0.308874267 */, 14 },
+ /* 601 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 14 },
+ /* 602 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 14 },
+ /* 603 */ { MAD_F(0x04f99721) /* 0.310935143 */, 14 },
+ /* 604 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 14 },
+ /* 605 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 14 },
+ /* 606 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 14 },
+ /* 607 */ { MAD_F(0x0504de05) /* 0.313688296 */, 14 },
+
+ /* 608 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 14 },
+ /* 609 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 14 },
+ /* 610 */ { MAD_F(0x050d575b) /* 0.315757136 */, 14 },
+ /* 611 */ { MAD_F(0x05102b42) /* 0.316447504 */, 14 },
+ /* 612 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 14 },
+ /* 613 */ { MAD_F(0x0515d440) /* 0.317829370 */, 14 },
+ /* 614 */ { MAD_F(0x0518a956) /* 0.318520867 */, 14 },
+ /* 615 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 14 },
+ /* 616 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 14 },
+ /* 617 */ { MAD_F(0x05212af5) /* 0.320597609 */, 14 },
+ /* 618 */ { MAD_F(0x0524019e) /* 0.321290606 */, 14 },
+ /* 619 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 14 },
+ /* 620 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 14 },
+ /* 621 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 14 },
+ /* 622 */ { MAD_F(0x052f602c) /* 0.324066327 */, 14 },
+ /* 623 */ { MAD_F(0x053238ca) /* 0.324761189 */, 14 },
+
+ /* 624 */ { MAD_F(0x053511cb) /* 0.325456423 */, 14 },
+ /* 625 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 14 },
+ /* 626 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 14 },
+ /* 627 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 14 },
+ /* 628 */ { MAD_F(0x054079b5) /* 0.328241070 */, 14 },
+ /* 629 */ { MAD_F(0x054354a8) /* 0.328938157 */, 14 },
+ /* 630 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 14 },
+ /* 631 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 14 },
+ /* 632 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 14 },
+ /* 633 */ { MAD_F(0x054ec453) /* 0.331730198 */, 14 },
+ /* 634 */ { MAD_F(0x0551a134) /* 0.332429129 */, 14 },
+ /* 635 */ { MAD_F(0x05547e79) /* 0.333128427 */, 14 },
+ /* 636 */ { MAD_F(0x05575c20) /* 0.333828093 */, 14 },
+ /* 637 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 14 },
+ /* 638 */ { MAD_F(0x055d1896) /* 0.335228525 */, 14 },
+ /* 639 */ { MAD_F(0x055ff764) /* 0.335929290 */, 14 },
+
+ /* 640 */ { MAD_F(0x0562d694) /* 0.336630420 */, 14 },
+ /* 641 */ { MAD_F(0x0565b627) /* 0.337331916 */, 14 },
+ /* 642 */ { MAD_F(0x0568961b) /* 0.338033777 */, 14 },
+ /* 643 */ { MAD_F(0x056b7671) /* 0.338736002 */, 14 },
+ /* 644 */ { MAD_F(0x056e5729) /* 0.339438592 */, 14 },
+ /* 645 */ { MAD_F(0x05713843) /* 0.340141545 */, 14 },
+ /* 646 */ { MAD_F(0x057419be) /* 0.340844862 */, 14 },
+ /* 647 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 14 },
+ /* 648 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 14 },
+ /* 649 */ { MAD_F(0x057cc077) /* 0.342956988 */, 14 },
+ /* 650 */ { MAD_F(0x057fa378) /* 0.343661754 */, 14 },
+ /* 651 */ { MAD_F(0x058286d9) /* 0.344366882 */, 14 },
+ /* 652 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 14 },
+ /* 653 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 14 },
+ /* 654 */ { MAD_F(0x058b3342) /* 0.346484431 */, 14 },
+ /* 655 */ { MAD_F(0x058e1827) /* 0.347191002 */, 14 },
+
+ /* 656 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 14 },
+ /* 657 */ { MAD_F(0x0593e311) /* 0.348605221 */, 14 },
+ /* 658 */ { MAD_F(0x0596c917) /* 0.349312869 */, 14 },
+ /* 659 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 14 },
+ /* 660 */ { MAD_F(0x059c9643) /* 0.350729240 */, 14 },
+ /* 661 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 14 },
+ /* 662 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 14 },
+ /* 663 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 14 },
+ /* 664 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 14 },
+ /* 665 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 14 },
+ /* 666 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 14 },
+ /* 667 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 14 },
+ /* 668 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 14 },
+ /* 669 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 14 },
+ /* 670 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 14 },
+ /* 671 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 14 },
+
+ /* 672 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 14 },
+ /* 673 */ { MAD_F(0x05c27057) /* 0.359970419 */, 14 },
+ /* 674 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 14 },
+ /* 675 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 14 },
+ /* 676 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 14 },
+ /* 677 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 14 },
+ /* 678 */ { MAD_F(0x05d11001) /* 0.363540655 */, 14 },
+ /* 679 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 14 },
+ /* 680 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 14 },
+ /* 681 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 14 },
+ /* 682 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 14 },
+ /* 683 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 14 },
+ /* 684 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 14 },
+ /* 685 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 14 },
+ /* 686 */ { MAD_F(0x05e88904) /* 0.369271294 */, 14 },
+ /* 687 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 14 },
+
+ /* 688 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 14 },
+ /* 689 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 14 },
+ /* 690 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 14 },
+ /* 691 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 14 },
+ /* 692 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 14 },
+ /* 693 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 14 },
+ /* 694 */ { MAD_F(0x0600196e) /* 0.375024253 */, 14 },
+ /* 695 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 14 },
+ /* 696 */ { MAD_F(0x0606012b) /* 0.376465960 */, 14 },
+ /* 697 */ { MAD_F(0x0608f595) /* 0.377187332 */, 14 },
+ /* 698 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 14 },
+ /* 699 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 14 },
+ /* 700 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 14 },
+ /* 701 */ { MAD_F(0x0614cada) /* 0.380076266 */, 14 },
+ /* 702 */ { MAD_F(0x0617c112) /* 0.380799360 */, 14 },
+ /* 703 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 14 },
+
+ /* 704 */ { MAD_F(0x061dae96) /* 0.382246578 */, 14 },
+ /* 705 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 14 },
+ /* 706 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 14 },
+ /* 707 */ { MAD_F(0x0626958f) /* 0.384419975 */, 14 },
+ /* 708 */ { MAD_F(0x06298def) /* 0.385145124 */, 14 },
+ /* 709 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 14 },
+ /* 710 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 14 },
+ /* 711 */ { MAD_F(0x06327934) /* 0.387322621 */, 14 },
+ /* 712 */ { MAD_F(0x06357302) /* 0.388049134 */, 14 },
+ /* 713 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 14 },
+ /* 714 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 14 },
+ /* 715 */ { MAD_F(0x063e6290) /* 0.390230715 */, 14 },
+ /* 716 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 14 },
+ /* 717 */ { MAD_F(0x06445960) /* 0.391686799 */, 14 },
+ /* 718 */ { MAD_F(0x06475551) /* 0.392415349 */, 14 },
+ /* 719 */ { MAD_F(0x064a519c) /* 0.393144238 */, 14 },
+
+ /* 720 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 14 },
+ /* 721 */ { MAD_F(0x06504b44) /* 0.394603028 */, 14 },
+ /* 722 */ { MAD_F(0x0653489f) /* 0.395332930 */, 14 },
+ /* 723 */ { MAD_F(0x06564655) /* 0.396063168 */, 14 },
+ /* 724 */ { MAD_F(0x06594465) /* 0.396793743 */, 14 },
+ /* 725 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 14 },
+ /* 726 */ { MAD_F(0x065f4195) /* 0.398255903 */, 14 },
+ /* 727 */ { MAD_F(0x066240b4) /* 0.398987487 */, 14 },
+ /* 728 */ { MAD_F(0x0665402d) /* 0.399719406 */, 14 },
+ /* 729 */ { MAD_F(0x06684000) /* 0.400451660 */, 14 },
+ /* 730 */ { MAD_F(0x066b402d) /* 0.401184249 */, 14 },
+ /* 731 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 14 },
+ /* 732 */ { MAD_F(0x06714194) /* 0.402650431 */, 14 },
+ /* 733 */ { MAD_F(0x067442ce) /* 0.403384024 */, 14 },
+ /* 734 */ { MAD_F(0x06774462) /* 0.404117949 */, 14 },
+ /* 735 */ { MAD_F(0x067a464f) /* 0.404852209 */, 14 },
+
+ /* 736 */ { MAD_F(0x067d4896) /* 0.405586801 */, 14 },
+ /* 737 */ { MAD_F(0x06804b36) /* 0.406321726 */, 14 },
+ /* 738 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 14 },
+ /* 739 */ { MAD_F(0x06865181) /* 0.407792573 */, 14 },
+ /* 740 */ { MAD_F(0x0689552c) /* 0.408528495 */, 14 },
+ /* 741 */ { MAD_F(0x068c5931) /* 0.409264748 */, 14 },
+ /* 742 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 14 },
+ /* 743 */ { MAD_F(0x06926245) /* 0.410738247 */, 14 },
+ /* 744 */ { MAD_F(0x06956753) /* 0.411475493 */, 14 },
+ /* 745 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 14 },
+ /* 746 */ { MAD_F(0x069b727b) /* 0.412950976 */, 14 },
+ /* 747 */ { MAD_F(0x069e7894) /* 0.413689213 */, 14 },
+ /* 748 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 14 },
+ /* 749 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 14 },
+ /* 750 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 14 },
+ /* 751 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 14 },
+
+ /* 752 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 14 },
+ /* 753 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 14 },
+ /* 754 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 14 },
+ /* 755 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 14 },
+ /* 756 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 14 },
+ /* 757 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 14 },
+ /* 758 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 14 },
+ /* 759 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 14 },
+ /* 760 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 14 },
+ /* 761 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 14 },
+ /* 762 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 14 },
+ /* 763 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 14 },
+ /* 764 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 14 },
+ /* 765 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 14 },
+ /* 766 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 14 },
+ /* 767 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 14 },
+
+ /* 768 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 14 },
+ /* 769 */ { MAD_F(0x06e15595) /* 0.430013259 */, 14 },
+ /* 770 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 14 },
+ /* 771 */ { MAD_F(0x06e771db) /* 0.431505065 */, 14 },
+ /* 772 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 14 },
+ /* 773 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 14 },
+ /* 774 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 14 },
+ /* 775 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 14 },
+ /* 776 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 14 },
+ /* 777 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 14 },
+ /* 778 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 14 },
+ /* 779 */ { MAD_F(0x06fff073) /* 0.437485172 */, 14 },
+ /* 780 */ { MAD_F(0x070301ca) /* 0.438234130 */, 14 },
+ /* 781 */ { MAD_F(0x07061377) /* 0.438983408 */, 14 },
+ /* 782 */ { MAD_F(0x0709257a) /* 0.439733006 */, 14 },
+ /* 783 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 14 },
+
+ /* 784 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 14 },
+ /* 785 */ { MAD_F(0x07125d84) /* 0.441983717 */, 14 },
+ /* 786 */ { MAD_F(0x071570de) /* 0.442734592 */, 14 },
+ /* 787 */ { MAD_F(0x0718848d) /* 0.443485785 */, 14 },
+ /* 788 */ { MAD_F(0x071b9891) /* 0.444237296 */, 14 },
+ /* 789 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 14 },
+ /* 790 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 14 },
+ /* 791 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 14 },
+ /* 792 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 14 },
+ /* 793 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 14 },
+ /* 794 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 14 },
+ /* 795 */ { MAD_F(0x07312e01) /* 0.449506765 */, 14 },
+ /* 796 */ { MAD_F(0x073444ae) /* 0.450260813 */, 14 },
+ /* 797 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 14 },
+ /* 798 */ { MAD_F(0x073a7307) /* 0.451769856 */, 14 },
+ /* 799 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 14 },
+
+ /* 800 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 14 },
+ /* 801 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 14 },
+ /* 802 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 14 },
+ /* 803 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 14 },
+ /* 804 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 14 },
+ /* 805 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 14 },
+ /* 806 */ { MAD_F(0x0753399d) /* 0.457818618 */, 14 },
+ /* 807 */ { MAD_F(0x075653eb) /* 0.458576125 */, 14 },
+ /* 808 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 14 },
+ /* 809 */ { MAD_F(0x075c8983) /* 0.460092079 */, 14 },
+ /* 810 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 14 },
+ /* 811 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 14 },
+ /* 812 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 14 },
+ /* 813 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 14 },
+ /* 814 */ { MAD_F(0x076c1538) /* 0.463887426 */, 14 },
+ /* 815 */ { MAD_F(0x076f3224) /* 0.464647430 */, 14 },
+
+ /* 816 */ { MAD_F(0x07724f64) /* 0.465407744 */, 14 },
+ /* 817 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 14 },
+ /* 818 */ { MAD_F(0x07788add) /* 0.466929306 */, 14 },
+ /* 819 */ { MAD_F(0x077ba916) /* 0.467690552 */, 14 },
+ /* 820 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 14 },
+ /* 821 */ { MAD_F(0x0781e683) /* 0.469213973 */, 14 },
+ /* 822 */ { MAD_F(0x078505b5) /* 0.469976148 */, 14 },
+ /* 823 */ { MAD_F(0x0788253b) /* 0.470738632 */, 14 },
+ /* 824 */ { MAD_F(0x078b4514) /* 0.471501425 */, 14 },
+ /* 825 */ { MAD_F(0x078e653f) /* 0.472264527 */, 14 },
+ /* 826 */ { MAD_F(0x079185be) /* 0.473027937 */, 14 },
+ /* 827 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 14 },
+ /* 828 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 14 },
+ /* 829 */ { MAD_F(0x079ae929) /* 0.475320014 */, 14 },
+ /* 830 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 14 },
+ /* 831 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 14 },
+
+ /* 832 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 14 },
+ /* 833 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 14 },
+ /* 834 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 14 },
+ /* 835 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 14 },
+ /* 836 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 14 },
+ /* 837 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 14 },
+ /* 838 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 14 },
+ /* 839 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 14 },
+ /* 840 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 14 },
+ /* 841 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 14 },
+ /* 842 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 14 },
+ /* 843 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 14 },
+ /* 844 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 14 },
+ /* 845 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 14 },
+ /* 846 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 14 },
+ /* 847 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 14 },
+
+ /* 848 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 14 },
+ /* 849 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 14 },
+ /* 850 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 14 },
+ /* 851 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 14 },
+ /* 852 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 14 },
+ /* 853 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 14 },
+ /* 854 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 14 },
+ /* 855 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 14 },
+ /* 856 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 14 },
+ /* 857 */ { MAD_F(0x07f31405) /* 0.496845266 */, 14 },
+ /* 858 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 14 },
+ /* 859 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 14 },
+ /* 860 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 14 },
+ /* 861 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 14 },
+ /* 862 */ { MAD_F(0x04017659) /* 0.250357008 */, 15 },
+ /* 863 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 15 },
+
+ /* 864 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 15 },
+ /* 865 */ { MAD_F(0x0406393d) /* 0.251519431 */, 15 },
+ /* 866 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 15 },
+ /* 867 */ { MAD_F(0x0409669d) /* 0.252295127 */, 15 },
+ /* 868 */ { MAD_F(0x040afd89) /* 0.252683198 */, 15 },
+ /* 869 */ { MAD_F(0x040c949e) /* 0.253071419 */, 15 },
+ /* 870 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 15 },
+ /* 871 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 15 },
+ /* 872 */ { MAD_F(0x04115aca) /* 0.254236974 */, 15 },
+ /* 873 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 15 },
+ /* 874 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 15 },
+ /* 875 */ { MAD_F(0x0416225d) /* 0.255403867 */, 15 },
+ /* 876 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 15 },
+ /* 877 */ { MAD_F(0x041952dc) /* 0.256182537 */, 15 },
+ /* 878 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 15 },
+ /* 879 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 15 },
+
+ /* 880 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 15 },
+ /* 881 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 15 },
+ /* 882 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 15 },
+ /* 883 */ { MAD_F(0x0422e811) /* 0.258522097 */, 15 },
+ /* 884 */ { MAD_F(0x04248179) /* 0.258912540 */, 15 },
+ /* 885 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 15 },
+ /* 886 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 15 },
+ /* 887 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 15 },
+ /* 888 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 15 },
+ /* 889 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 15 },
+ /* 890 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 15 },
+ /* 891 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 15 },
+ /* 892 */ { MAD_F(0x0431524c) /* 0.262041376 */, 15 },
+ /* 893 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 15 },
+ /* 894 */ { MAD_F(0x0434880a) /* 0.262825051 */, 15 },
+ /* 895 */ { MAD_F(0x04362324) /* 0.263217107 */, 15 },
+
+ /* 896 */ { MAD_F(0x0437be65) /* 0.263609310 */, 15 },
+ /* 897 */ { MAD_F(0x043959cd) /* 0.264001659 */, 15 },
+ /* 898 */ { MAD_F(0x043af55d) /* 0.264394153 */, 15 },
+ /* 899 */ { MAD_F(0x043c9113) /* 0.264786794 */, 15 },
+ /* 900 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 15 },
+ /* 901 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 15 },
+ /* 902 */ { MAD_F(0x04416522) /* 0.265965588 */, 15 },
+ /* 903 */ { MAD_F(0x04430174) /* 0.266358810 */, 15 },
+ /* 904 */ { MAD_F(0x04449dee) /* 0.266752177 */, 15 },
+ /* 905 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 15 },
+ /* 906 */ { MAD_F(0x0447d756) /* 0.267539347 */, 15 },
+ /* 907 */ { MAD_F(0x04497445) /* 0.267933149 */, 15 },
+ /* 908 */ { MAD_F(0x044b115a) /* 0.268327096 */, 15 },
+ /* 909 */ { MAD_F(0x044cae96) /* 0.268721187 */, 15 },
+ /* 910 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 15 },
+ /* 911 */ { MAD_F(0x044fe983) /* 0.269509804 */, 15 },
+
+ /* 912 */ { MAD_F(0x04518733) /* 0.269904329 */, 15 },
+ /* 913 */ { MAD_F(0x0453250a) /* 0.270298998 */, 15 },
+ /* 914 */ { MAD_F(0x0454c308) /* 0.270693811 */, 15 },
+ /* 915 */ { MAD_F(0x0456612d) /* 0.271088768 */, 15 },
+ /* 916 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 15 },
+ /* 917 */ { MAD_F(0x04599dea) /* 0.271879114 */, 15 },
+ /* 918 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 15 },
+ /* 919 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 15 },
+ /* 920 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 15 },
+ /* 921 */ { MAD_F(0x04601932) /* 0.273461530 */, 15 },
+ /* 922 */ { MAD_F(0x0461b864) /* 0.273857492 */, 15 },
+ /* 923 */ { MAD_F(0x046357bd) /* 0.274253597 */, 15 },
+ /* 924 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 15 },
+ /* 925 */ { MAD_F(0x046696e2) /* 0.275046238 */, 15 },
+ /* 926 */ { MAD_F(0x046836ae) /* 0.275442772 */, 15 },
+ /* 927 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 15 },
+
+ /* 928 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 15 },
+ /* 929 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 15 },
+ /* 930 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 15 },
+ /* 931 */ { MAD_F(0x047057e8) /* 0.277427584 */, 15 },
+ /* 932 */ { MAD_F(0x0471f899) /* 0.277824973 */, 15 },
+ /* 933 */ { MAD_F(0x04739971) /* 0.278222505 */, 15 },
+ /* 934 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 15 },
+ /* 935 */ { MAD_F(0x0476db92) /* 0.279017995 */, 15 },
+ /* 936 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 15 },
+ /* 937 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 15 },
+ /* 938 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 15 },
+ /* 939 */ { MAD_F(0x047d619e) /* 0.280610675 */, 15 },
+ /* 940 */ { MAD_F(0x047f0380) /* 0.281009199 */, 15 },
+ /* 941 */ { MAD_F(0x0480a588) /* 0.281407864 */, 15 },
+ /* 942 */ { MAD_F(0x048247b6) /* 0.281806670 */, 15 },
+ /* 943 */ { MAD_F(0x0483ea0a) /* 0.282205618 */, 15 },
+
+ /* 944 */ { MAD_F(0x04858c83) /* 0.282604707 */, 15 },
+ /* 945 */ { MAD_F(0x04872f22) /* 0.283003936 */, 15 },
+ /* 946 */ { MAD_F(0x0488d1e8) /* 0.283403307 */, 15 },
+ /* 947 */ { MAD_F(0x048a74d3) /* 0.283802818 */, 15 },
+ /* 948 */ { MAD_F(0x048c17e3) /* 0.284202470 */, 15 },
+ /* 949 */ { MAD_F(0x048dbb1a) /* 0.284602263 */, 15 },
+ /* 950 */ { MAD_F(0x048f5e76) /* 0.285002195 */, 15 },
+ /* 951 */ { MAD_F(0x049101f8) /* 0.285402269 */, 15 },
+ /* 952 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 15 },
+ /* 953 */ { MAD_F(0x0494496c) /* 0.286202836 */, 15 },
+ /* 954 */ { MAD_F(0x0495ed5f) /* 0.286603329 */, 15 },
+ /* 955 */ { MAD_F(0x04979177) /* 0.287003963 */, 15 },
+ /* 956 */ { MAD_F(0x049935b5) /* 0.287404737 */, 15 },
+ /* 957 */ { MAD_F(0x049ada19) /* 0.287805650 */, 15 },
+ /* 958 */ { MAD_F(0x049c7ea1) /* 0.288206703 */, 15 },
+ /* 959 */ { MAD_F(0x049e2350) /* 0.288607895 */, 15 },
+
+ /* 960 */ { MAD_F(0x049fc824) /* 0.289009227 */, 15 },
+ /* 961 */ { MAD_F(0x04a16d1d) /* 0.289410699 */, 15 },
+ /* 962 */ { MAD_F(0x04a3123b) /* 0.289812309 */, 15 },
+ /* 963 */ { MAD_F(0x04a4b77f) /* 0.290214059 */, 15 },
+ /* 964 */ { MAD_F(0x04a65ce8) /* 0.290615948 */, 15 },
+ /* 965 */ { MAD_F(0x04a80277) /* 0.291017976 */, 15 },
+ /* 966 */ { MAD_F(0x04a9a82b) /* 0.291420143 */, 15 },
+ /* 967 */ { MAD_F(0x04ab4e04) /* 0.291822449 */, 15 },
+ /* 968 */ { MAD_F(0x04acf402) /* 0.292224893 */, 15 },
+ /* 969 */ { MAD_F(0x04ae9a26) /* 0.292627476 */, 15 },
+ /* 970 */ { MAD_F(0x04b0406e) /* 0.293030197 */, 15 },
+ /* 971 */ { MAD_F(0x04b1e6dc) /* 0.293433057 */, 15 },
+ /* 972 */ { MAD_F(0x04b38d6f) /* 0.293836055 */, 15 },
+ /* 973 */ { MAD_F(0x04b53427) /* 0.294239192 */, 15 },
+ /* 974 */ { MAD_F(0x04b6db05) /* 0.294642466 */, 15 },
+ /* 975 */ { MAD_F(0x04b88207) /* 0.295045879 */, 15 },
+
+ /* 976 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 15 },
+ /* 977 */ { MAD_F(0x04bbd07a) /* 0.295853118 */, 15 },
+ /* 978 */ { MAD_F(0x04bd77ec) /* 0.296256944 */, 15 },
+ /* 979 */ { MAD_F(0x04bf1f82) /* 0.296660907 */, 15 },
+ /* 980 */ { MAD_F(0x04c0c73d) /* 0.297065009 */, 15 },
+ /* 981 */ { MAD_F(0x04c26f1d) /* 0.297469248 */, 15 },
+ /* 982 */ { MAD_F(0x04c41722) /* 0.297873624 */, 15 },
+ /* 983 */ { MAD_F(0x04c5bf4c) /* 0.298278137 */, 15 },
+ /* 984 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 15 },
+ /* 985 */ { MAD_F(0x04c9100d) /* 0.299087576 */, 15 },
+ /* 986 */ { MAD_F(0x04cab8a6) /* 0.299492500 */, 15 },
+ /* 987 */ { MAD_F(0x04cc6163) /* 0.299897562 */, 15 },
+ /* 988 */ { MAD_F(0x04ce0a44) /* 0.300302761 */, 15 },
+ /* 989 */ { MAD_F(0x04cfb34b) /* 0.300708096 */, 15 },
+ /* 990 */ { MAD_F(0x04d15c76) /* 0.301113568 */, 15 },
+ /* 991 */ { MAD_F(0x04d305c5) /* 0.301519176 */, 15 },
+
+ /* 992 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 15 },
+ /* 993 */ { MAD_F(0x04d658d2) /* 0.302330802 */, 15 },
+ /* 994 */ { MAD_F(0x04d80290) /* 0.302736820 */, 15 },
+ /* 995 */ { MAD_F(0x04d9ac72) /* 0.303142973 */, 15 },
+ /* 996 */ { MAD_F(0x04db5679) /* 0.303549263 */, 15 },
+ /* 997 */ { MAD_F(0x04dd00a4) /* 0.303955689 */, 15 },
+ /* 998 */ { MAD_F(0x04deaaf3) /* 0.304362251 */, 15 },
+ /* 999 */ { MAD_F(0x04e05567) /* 0.304768948 */, 15 },
+ /* 1000 */ { MAD_F(0x04e20000) /* 0.305175781 */, 15 },
+ /* 1001 */ { MAD_F(0x04e3aabd) /* 0.305582750 */, 15 },
+ /* 1002 */ { MAD_F(0x04e5559e) /* 0.305989854 */, 15 },
+ /* 1003 */ { MAD_F(0x04e700a3) /* 0.306397094 */, 15 },
+ /* 1004 */ { MAD_F(0x04e8abcd) /* 0.306804470 */, 15 },
+ /* 1005 */ { MAD_F(0x04ea571c) /* 0.307211980 */, 15 },
+ /* 1006 */ { MAD_F(0x04ec028e) /* 0.307619626 */, 15 },
+ /* 1007 */ { MAD_F(0x04edae25) /* 0.308027406 */, 15 },
+
+ /* 1008 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 15 },
+ /* 1009 */ { MAD_F(0x04f105bf) /* 0.308843373 */, 15 },
+ /* 1010 */ { MAD_F(0x04f2b1c3) /* 0.309251558 */, 15 },
+ /* 1011 */ { MAD_F(0x04f45dea) /* 0.309659879 */, 15 },
+ /* 1012 */ { MAD_F(0x04f60a36) /* 0.310068333 */, 15 },
+ /* 1013 */ { MAD_F(0x04f7b6a6) /* 0.310476923 */, 15 },
+ /* 1014 */ { MAD_F(0x04f9633a) /* 0.310885647 */, 15 },
+ /* 1015 */ { MAD_F(0x04fb0ff2) /* 0.311294505 */, 15 },
+ /* 1016 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 15 },
+ /* 1017 */ { MAD_F(0x04fe69ce) /* 0.312112625 */, 15 },
+ /* 1018 */ { MAD_F(0x050016f3) /* 0.312521885 */, 15 },
+ /* 1019 */ { MAD_F(0x0501c43b) /* 0.312931280 */, 15 },
+ /* 1020 */ { MAD_F(0x050371a7) /* 0.313340809 */, 15 },
+ /* 1021 */ { MAD_F(0x05051f37) /* 0.313750472 */, 15 },
+ /* 1022 */ { MAD_F(0x0506cceb) /* 0.314160269 */, 15 },
+ /* 1023 */ { MAD_F(0x05087ac2) /* 0.314570199 */, 15 },
+
+ /* 1024 */ { MAD_F(0x050a28be) /* 0.314980262 */, 15 },
+ /* 1025 */ { MAD_F(0x050bd6de) /* 0.315390460 */, 15 },
+ /* 1026 */ { MAD_F(0x050d8521) /* 0.315800790 */, 15 },
+ /* 1027 */ { MAD_F(0x050f3388) /* 0.316211255 */, 15 },
+ /* 1028 */ { MAD_F(0x0510e213) /* 0.316621852 */, 15 },
+ /* 1029 */ { MAD_F(0x051290c2) /* 0.317032582 */, 15 },
+ /* 1030 */ { MAD_F(0x05143f94) /* 0.317443446 */, 15 },
+ /* 1031 */ { MAD_F(0x0515ee8a) /* 0.317854442 */, 15 },
+ /* 1032 */ { MAD_F(0x05179da4) /* 0.318265572 */, 15 },
+ /* 1033 */ { MAD_F(0x05194ce1) /* 0.318676834 */, 15 },
+ /* 1034 */ { MAD_F(0x051afc42) /* 0.319088229 */, 15 },
+ /* 1035 */ { MAD_F(0x051cabc7) /* 0.319499756 */, 15 },
+ /* 1036 */ { MAD_F(0x051e5b6f) /* 0.319911417 */, 15 },
+ /* 1037 */ { MAD_F(0x05200b3a) /* 0.320323209 */, 15 },
+ /* 1038 */ { MAD_F(0x0521bb2a) /* 0.320735134 */, 15 },
+ /* 1039 */ { MAD_F(0x05236b3d) /* 0.321147192 */, 15 },
+
+ /* 1040 */ { MAD_F(0x05251b73) /* 0.321559381 */, 15 },
+ /* 1041 */ { MAD_F(0x0526cbcd) /* 0.321971703 */, 15 },
+ /* 1042 */ { MAD_F(0x05287c4a) /* 0.322384156 */, 15 },
+ /* 1043 */ { MAD_F(0x052a2cea) /* 0.322796742 */, 15 },
+ /* 1044 */ { MAD_F(0x052bddae) /* 0.323209460 */, 15 },
+ /* 1045 */ { MAD_F(0x052d8e96) /* 0.323622309 */, 15 },
+ /* 1046 */ { MAD_F(0x052f3fa1) /* 0.324035290 */, 15 },
+ /* 1047 */ { MAD_F(0x0530f0cf) /* 0.324448403 */, 15 },
+ /* 1048 */ { MAD_F(0x0532a220) /* 0.324861647 */, 15 },
+ /* 1049 */ { MAD_F(0x05345395) /* 0.325275023 */, 15 },
+ /* 1050 */ { MAD_F(0x0536052d) /* 0.325688530 */, 15 },
+ /* 1051 */ { MAD_F(0x0537b6e8) /* 0.326102168 */, 15 },
+ /* 1052 */ { MAD_F(0x053968c6) /* 0.326515938 */, 15 },
+ /* 1053 */ { MAD_F(0x053b1ac8) /* 0.326929839 */, 15 },
+ /* 1054 */ { MAD_F(0x053ccced) /* 0.327343870 */, 15 },
+ /* 1055 */ { MAD_F(0x053e7f35) /* 0.327758033 */, 15 },
+
+ /* 1056 */ { MAD_F(0x054031a0) /* 0.328172327 */, 15 },
+ /* 1057 */ { MAD_F(0x0541e42e) /* 0.328586751 */, 15 },
+ /* 1058 */ { MAD_F(0x054396df) /* 0.329001306 */, 15 },
+ /* 1059 */ { MAD_F(0x054549b4) /* 0.329415992 */, 15 },
+ /* 1060 */ { MAD_F(0x0546fcab) /* 0.329830808 */, 15 },
+ /* 1061 */ { MAD_F(0x0548afc6) /* 0.330245755 */, 15 },
+ /* 1062 */ { MAD_F(0x054a6303) /* 0.330660832 */, 15 },
+ /* 1063 */ { MAD_F(0x054c1663) /* 0.331076039 */, 15 },
+ /* 1064 */ { MAD_F(0x054dc9e7) /* 0.331491377 */, 15 },
+ /* 1065 */ { MAD_F(0x054f7d8d) /* 0.331906845 */, 15 },
+ /* 1066 */ { MAD_F(0x05513156) /* 0.332322443 */, 15 },
+ /* 1067 */ { MAD_F(0x0552e542) /* 0.332738170 */, 15 },
+ /* 1068 */ { MAD_F(0x05549951) /* 0.333154028 */, 15 },
+ /* 1069 */ { MAD_F(0x05564d83) /* 0.333570016 */, 15 },
+ /* 1070 */ { MAD_F(0x055801d8) /* 0.333986133 */, 15 },
+ /* 1071 */ { MAD_F(0x0559b64f) /* 0.334402380 */, 15 },
+
+ /* 1072 */ { MAD_F(0x055b6ae9) /* 0.334818756 */, 15 },
+ /* 1073 */ { MAD_F(0x055d1fa6) /* 0.335235262 */, 15 },
+ /* 1074 */ { MAD_F(0x055ed486) /* 0.335651898 */, 15 },
+ /* 1075 */ { MAD_F(0x05608988) /* 0.336068662 */, 15 },
+ /* 1076 */ { MAD_F(0x05623ead) /* 0.336485556 */, 15 },
+ /* 1077 */ { MAD_F(0x0563f3f5) /* 0.336902579 */, 15 },
+ /* 1078 */ { MAD_F(0x0565a960) /* 0.337319732 */, 15 },
+ /* 1079 */ { MAD_F(0x05675eed) /* 0.337737013 */, 15 },
+ /* 1080 */ { MAD_F(0x0569149c) /* 0.338154423 */, 15 },
+ /* 1081 */ { MAD_F(0x056aca6f) /* 0.338571962 */, 15 },
+ /* 1082 */ { MAD_F(0x056c8064) /* 0.338989630 */, 15 },
+ /* 1083 */ { MAD_F(0x056e367b) /* 0.339407426 */, 15 },
+ /* 1084 */ { MAD_F(0x056fecb5) /* 0.339825351 */, 15 },
+ /* 1085 */ { MAD_F(0x0571a311) /* 0.340243405 */, 15 },
+ /* 1086 */ { MAD_F(0x05735990) /* 0.340661587 */, 15 },
+ /* 1087 */ { MAD_F(0x05751032) /* 0.341079898 */, 15 },
+
+ /* 1088 */ { MAD_F(0x0576c6f5) /* 0.341498336 */, 15 },
+ /* 1089 */ { MAD_F(0x05787ddc) /* 0.341916903 */, 15 },
+ /* 1090 */ { MAD_F(0x057a34e4) /* 0.342335598 */, 15 },
+ /* 1091 */ { MAD_F(0x057bec0f) /* 0.342754421 */, 15 },
+ /* 1092 */ { MAD_F(0x057da35d) /* 0.343173373 */, 15 },
+ /* 1093 */ { MAD_F(0x057f5acc) /* 0.343592452 */, 15 },
+ /* 1094 */ { MAD_F(0x0581125e) /* 0.344011659 */, 15 },
+ /* 1095 */ { MAD_F(0x0582ca12) /* 0.344430993 */, 15 },
+ /* 1096 */ { MAD_F(0x058481e9) /* 0.344850455 */, 15 },
+ /* 1097 */ { MAD_F(0x058639e2) /* 0.345270045 */, 15 },
+ /* 1098 */ { MAD_F(0x0587f1fd) /* 0.345689763 */, 15 },
+ /* 1099 */ { MAD_F(0x0589aa3a) /* 0.346109608 */, 15 },
+ /* 1100 */ { MAD_F(0x058b629a) /* 0.346529580 */, 15 },
+ /* 1101 */ { MAD_F(0x058d1b1b) /* 0.346949679 */, 15 },
+ /* 1102 */ { MAD_F(0x058ed3bf) /* 0.347369906 */, 15 },
+ /* 1103 */ { MAD_F(0x05908c85) /* 0.347790260 */, 15 },
+
+ /* 1104 */ { MAD_F(0x0592456d) /* 0.348210741 */, 15 },
+ /* 1105 */ { MAD_F(0x0593fe77) /* 0.348631348 */, 15 },
+ /* 1106 */ { MAD_F(0x0595b7a3) /* 0.349052083 */, 15 },
+ /* 1107 */ { MAD_F(0x059770f1) /* 0.349472945 */, 15 },
+ /* 1108 */ { MAD_F(0x05992a61) /* 0.349893933 */, 15 },
+ /* 1109 */ { MAD_F(0x059ae3f3) /* 0.350315048 */, 15 },
+ /* 1110 */ { MAD_F(0x059c9da8) /* 0.350736290 */, 15 },
+ /* 1111 */ { MAD_F(0x059e577e) /* 0.351157658 */, 15 },
+ /* 1112 */ { MAD_F(0x05a01176) /* 0.351579152 */, 15 },
+ /* 1113 */ { MAD_F(0x05a1cb90) /* 0.352000773 */, 15 },
+ /* 1114 */ { MAD_F(0x05a385cc) /* 0.352422520 */, 15 },
+ /* 1115 */ { MAD_F(0x05a5402a) /* 0.352844394 */, 15 },
+ /* 1116 */ { MAD_F(0x05a6faa9) /* 0.353266393 */, 15 },
+ /* 1117 */ { MAD_F(0x05a8b54b) /* 0.353688519 */, 15 },
+ /* 1118 */ { MAD_F(0x05aa700e) /* 0.354110771 */, 15 },
+ /* 1119 */ { MAD_F(0x05ac2af3) /* 0.354533148 */, 15 },
+
+ /* 1120 */ { MAD_F(0x05ade5fa) /* 0.354955651 */, 15 },
+ /* 1121 */ { MAD_F(0x05afa123) /* 0.355378281 */, 15 },
+ /* 1122 */ { MAD_F(0x05b15c6d) /* 0.355801035 */, 15 },
+ /* 1123 */ { MAD_F(0x05b317d9) /* 0.356223916 */, 15 },
+ /* 1124 */ { MAD_F(0x05b4d367) /* 0.356646922 */, 15 },
+ /* 1125 */ { MAD_F(0x05b68f16) /* 0.357070053 */, 15 },
+ /* 1126 */ { MAD_F(0x05b84ae7) /* 0.357493310 */, 15 },
+ /* 1127 */ { MAD_F(0x05ba06da) /* 0.357916692 */, 15 },
+ /* 1128 */ { MAD_F(0x05bbc2ef) /* 0.358340200 */, 15 },
+ /* 1129 */ { MAD_F(0x05bd7f25) /* 0.358763832 */, 15 },
+ /* 1130 */ { MAD_F(0x05bf3b7c) /* 0.359187590 */, 15 },
+ /* 1131 */ { MAD_F(0x05c0f7f5) /* 0.359611472 */, 15 },
+ /* 1132 */ { MAD_F(0x05c2b490) /* 0.360035480 */, 15 },
+ /* 1133 */ { MAD_F(0x05c4714c) /* 0.360459613 */, 15 },
+ /* 1134 */ { MAD_F(0x05c62e2a) /* 0.360883870 */, 15 },
+ /* 1135 */ { MAD_F(0x05c7eb29) /* 0.361308252 */, 15 },
+
+ /* 1136 */ { MAD_F(0x05c9a84a) /* 0.361732758 */, 15 },
+ /* 1137 */ { MAD_F(0x05cb658c) /* 0.362157390 */, 15 },
+ /* 1138 */ { MAD_F(0x05cd22ef) /* 0.362582145 */, 15 },
+ /* 1139 */ { MAD_F(0x05cee074) /* 0.363007026 */, 15 },
+ /* 1140 */ { MAD_F(0x05d09e1b) /* 0.363432030 */, 15 },
+ /* 1141 */ { MAD_F(0x05d25be2) /* 0.363857159 */, 15 },
+ /* 1142 */ { MAD_F(0x05d419cb) /* 0.364282412 */, 15 },
+ /* 1143 */ { MAD_F(0x05d5d7d5) /* 0.364707789 */, 15 },
+ /* 1144 */ { MAD_F(0x05d79601) /* 0.365133291 */, 15 },
+ /* 1145 */ { MAD_F(0x05d9544e) /* 0.365558916 */, 15 },
+ /* 1146 */ { MAD_F(0x05db12bc) /* 0.365984665 */, 15 },
+ /* 1147 */ { MAD_F(0x05dcd14c) /* 0.366410538 */, 15 },
+ /* 1148 */ { MAD_F(0x05de8ffc) /* 0.366836535 */, 15 },
+ /* 1149 */ { MAD_F(0x05e04ece) /* 0.367262655 */, 15 },
+ /* 1150 */ { MAD_F(0x05e20dc1) /* 0.367688900 */, 15 },
+ /* 1151 */ { MAD_F(0x05e3ccd5) /* 0.368115267 */, 15 },
+
+ /* 1152 */ { MAD_F(0x05e58c0b) /* 0.368541759 */, 15 },
+ /* 1153 */ { MAD_F(0x05e74b61) /* 0.368968373 */, 15 },
+ /* 1154 */ { MAD_F(0x05e90ad9) /* 0.369395111 */, 15 },
+ /* 1155 */ { MAD_F(0x05eaca72) /* 0.369821973 */, 15 },
+ /* 1156 */ { MAD_F(0x05ec8a2b) /* 0.370248957 */, 15 },
+ /* 1157 */ { MAD_F(0x05ee4a06) /* 0.370676065 */, 15 },
+ /* 1158 */ { MAD_F(0x05f00a02) /* 0.371103295 */, 15 },
+ /* 1159 */ { MAD_F(0x05f1ca1f) /* 0.371530649 */, 15 },
+ /* 1160 */ { MAD_F(0x05f38a5d) /* 0.371958126 */, 15 },
+ /* 1161 */ { MAD_F(0x05f54abc) /* 0.372385725 */, 15 },
+ /* 1162 */ { MAD_F(0x05f70b3c) /* 0.372813448 */, 15 },
+ /* 1163 */ { MAD_F(0x05f8cbdc) /* 0.373241292 */, 15 },
+ /* 1164 */ { MAD_F(0x05fa8c9e) /* 0.373669260 */, 15 },
+ /* 1165 */ { MAD_F(0x05fc4d81) /* 0.374097350 */, 15 },
+ /* 1166 */ { MAD_F(0x05fe0e84) /* 0.374525563 */, 15 },
+ /* 1167 */ { MAD_F(0x05ffcfa8) /* 0.374953898 */, 15 },
+
+ /* 1168 */ { MAD_F(0x060190ee) /* 0.375382356 */, 15 },
+ /* 1169 */ { MAD_F(0x06035254) /* 0.375810936 */, 15 },
+ /* 1170 */ { MAD_F(0x060513da) /* 0.376239638 */, 15 },
+ /* 1171 */ { MAD_F(0x0606d582) /* 0.376668462 */, 15 },
+ /* 1172 */ { MAD_F(0x0608974a) /* 0.377097408 */, 15 },
+ /* 1173 */ { MAD_F(0x060a5934) /* 0.377526476 */, 15 },
+ /* 1174 */ { MAD_F(0x060c1b3d) /* 0.377955667 */, 15 },
+ /* 1175 */ { MAD_F(0x060ddd68) /* 0.378384979 */, 15 },
+ /* 1176 */ { MAD_F(0x060f9fb3) /* 0.378814413 */, 15 },
+ /* 1177 */ { MAD_F(0x0611621f) /* 0.379243968 */, 15 },
+ /* 1178 */ { MAD_F(0x061324ac) /* 0.379673646 */, 15 },
+ /* 1179 */ { MAD_F(0x0614e759) /* 0.380103444 */, 15 },
+ /* 1180 */ { MAD_F(0x0616aa27) /* 0.380533365 */, 15 },
+ /* 1181 */ { MAD_F(0x06186d16) /* 0.380963407 */, 15 },
+ /* 1182 */ { MAD_F(0x061a3025) /* 0.381393570 */, 15 },
+ /* 1183 */ { MAD_F(0x061bf354) /* 0.381823855 */, 15 },
+
+ /* 1184 */ { MAD_F(0x061db6a5) /* 0.382254261 */, 15 },
+ /* 1185 */ { MAD_F(0x061f7a15) /* 0.382684788 */, 15 },
+ /* 1186 */ { MAD_F(0x06213da7) /* 0.383115436 */, 15 },
+ /* 1187 */ { MAD_F(0x06230158) /* 0.383546205 */, 15 },
+ /* 1188 */ { MAD_F(0x0624c52a) /* 0.383977096 */, 15 },
+ /* 1189 */ { MAD_F(0x0626891d) /* 0.384408107 */, 15 },
+ /* 1190 */ { MAD_F(0x06284d30) /* 0.384839239 */, 15 },
+ /* 1191 */ { MAD_F(0x062a1164) /* 0.385270492 */, 15 },
+ /* 1192 */ { MAD_F(0x062bd5b8) /* 0.385701865 */, 15 },
+ /* 1193 */ { MAD_F(0x062d9a2c) /* 0.386133359 */, 15 },
+ /* 1194 */ { MAD_F(0x062f5ec1) /* 0.386564974 */, 15 },
+ /* 1195 */ { MAD_F(0x06312376) /* 0.386996709 */, 15 },
+ /* 1196 */ { MAD_F(0x0632e84b) /* 0.387428565 */, 15 },
+ /* 1197 */ { MAD_F(0x0634ad41) /* 0.387860541 */, 15 },
+ /* 1198 */ { MAD_F(0x06367257) /* 0.388292637 */, 15 },
+ /* 1199 */ { MAD_F(0x0638378d) /* 0.388724854 */, 15 },
+
+ /* 1200 */ { MAD_F(0x0639fce4) /* 0.389157191 */, 15 },
+ /* 1201 */ { MAD_F(0x063bc25b) /* 0.389589648 */, 15 },
+ /* 1202 */ { MAD_F(0x063d87f2) /* 0.390022225 */, 15 },
+ /* 1203 */ { MAD_F(0x063f4da9) /* 0.390454922 */, 15 },
+ /* 1204 */ { MAD_F(0x06411380) /* 0.390887739 */, 15 },
+ /* 1205 */ { MAD_F(0x0642d978) /* 0.391320675 */, 15 },
+ /* 1206 */ { MAD_F(0x06449f8f) /* 0.391753732 */, 15 },
+ /* 1207 */ { MAD_F(0x064665c7) /* 0.392186908 */, 15 },
+ /* 1208 */ { MAD_F(0x06482c1f) /* 0.392620204 */, 15 },
+ /* 1209 */ { MAD_F(0x0649f297) /* 0.393053619 */, 15 },
+ /* 1210 */ { MAD_F(0x064bb92f) /* 0.393487154 */, 15 },
+ /* 1211 */ { MAD_F(0x064d7fe8) /* 0.393920808 */, 15 },
+ /* 1212 */ { MAD_F(0x064f46c0) /* 0.394354582 */, 15 },
+ /* 1213 */ { MAD_F(0x06510db8) /* 0.394788475 */, 15 },
+ /* 1214 */ { MAD_F(0x0652d4d0) /* 0.395222488 */, 15 },
+ /* 1215 */ { MAD_F(0x06549c09) /* 0.395656619 */, 15 },
+
+ /* 1216 */ { MAD_F(0x06566361) /* 0.396090870 */, 15 },
+ /* 1217 */ { MAD_F(0x06582ad9) /* 0.396525239 */, 15 },
+ /* 1218 */ { MAD_F(0x0659f271) /* 0.396959728 */, 15 },
+ /* 1219 */ { MAD_F(0x065bba29) /* 0.397394336 */, 15 },
+ /* 1220 */ { MAD_F(0x065d8201) /* 0.397829062 */, 15 },
+ /* 1221 */ { MAD_F(0x065f49f9) /* 0.398263907 */, 15 },
+ /* 1222 */ { MAD_F(0x06611211) /* 0.398698871 */, 15 },
+ /* 1223 */ { MAD_F(0x0662da49) /* 0.399133954 */, 15 },
+ /* 1224 */ { MAD_F(0x0664a2a0) /* 0.399569155 */, 15 },
+ /* 1225 */ { MAD_F(0x06666b17) /* 0.400004475 */, 15 },
+ /* 1226 */ { MAD_F(0x066833ae) /* 0.400439913 */, 15 },
+ /* 1227 */ { MAD_F(0x0669fc65) /* 0.400875470 */, 15 },
+ /* 1228 */ { MAD_F(0x066bc53c) /* 0.401311145 */, 15 },
+ /* 1229 */ { MAD_F(0x066d8e32) /* 0.401746938 */, 15 },
+ /* 1230 */ { MAD_F(0x066f5748) /* 0.402182850 */, 15 },
+ /* 1231 */ { MAD_F(0x0671207e) /* 0.402618879 */, 15 },
+
+ /* 1232 */ { MAD_F(0x0672e9d4) /* 0.403055027 */, 15 },
+ /* 1233 */ { MAD_F(0x0674b349) /* 0.403491293 */, 15 },
+ /* 1234 */ { MAD_F(0x06767cde) /* 0.403927676 */, 15 },
+ /* 1235 */ { MAD_F(0x06784692) /* 0.404364178 */, 15 },
+ /* 1236 */ { MAD_F(0x067a1066) /* 0.404800797 */, 15 },
+ /* 1237 */ { MAD_F(0x067bda5a) /* 0.405237535 */, 15 },
+ /* 1238 */ { MAD_F(0x067da46d) /* 0.405674390 */, 15 },
+ /* 1239 */ { MAD_F(0x067f6ea0) /* 0.406111362 */, 15 },
+ /* 1240 */ { MAD_F(0x068138f3) /* 0.406548452 */, 15 },
+ /* 1241 */ { MAD_F(0x06830365) /* 0.406985660 */, 15 },
+ /* 1242 */ { MAD_F(0x0684cdf6) /* 0.407422985 */, 15 },
+ /* 1243 */ { MAD_F(0x068698a8) /* 0.407860427 */, 15 },
+ /* 1244 */ { MAD_F(0x06886378) /* 0.408297987 */, 15 },
+ /* 1245 */ { MAD_F(0x068a2e68) /* 0.408735664 */, 15 },
+ /* 1246 */ { MAD_F(0x068bf978) /* 0.409173458 */, 15 },
+ /* 1247 */ { MAD_F(0x068dc4a7) /* 0.409611370 */, 15 },
+
+ /* 1248 */ { MAD_F(0x068f8ff5) /* 0.410049398 */, 15 },
+ /* 1249 */ { MAD_F(0x06915b63) /* 0.410487544 */, 15 },
+ /* 1250 */ { MAD_F(0x069326f0) /* 0.410925806 */, 15 },
+ /* 1251 */ { MAD_F(0x0694f29c) /* 0.411364185 */, 15 },
+ /* 1252 */ { MAD_F(0x0696be68) /* 0.411802681 */, 15 },
+ /* 1253 */ { MAD_F(0x06988a54) /* 0.412241294 */, 15 },
+ /* 1254 */ { MAD_F(0x069a565e) /* 0.412680024 */, 15 },
+ /* 1255 */ { MAD_F(0x069c2288) /* 0.413118870 */, 15 },
+ /* 1256 */ { MAD_F(0x069deed1) /* 0.413557833 */, 15 },
+ /* 1257 */ { MAD_F(0x069fbb3a) /* 0.413996912 */, 15 },
+ /* 1258 */ { MAD_F(0x06a187c1) /* 0.414436108 */, 15 },
+ /* 1259 */ { MAD_F(0x06a35468) /* 0.414875420 */, 15 },
+ /* 1260 */ { MAD_F(0x06a5212f) /* 0.415314849 */, 15 },
+ /* 1261 */ { MAD_F(0x06a6ee14) /* 0.415754393 */, 15 },
+ /* 1262 */ { MAD_F(0x06a8bb18) /* 0.416194054 */, 15 },
+ /* 1263 */ { MAD_F(0x06aa883c) /* 0.416633831 */, 15 },
+
+ /* 1264 */ { MAD_F(0x06ac557f) /* 0.417073724 */, 15 },
+ /* 1265 */ { MAD_F(0x06ae22e1) /* 0.417513734 */, 15 },
+ /* 1266 */ { MAD_F(0x06aff062) /* 0.417953859 */, 15 },
+ /* 1267 */ { MAD_F(0x06b1be03) /* 0.418394100 */, 15 },
+ /* 1268 */ { MAD_F(0x06b38bc2) /* 0.418834457 */, 15 },
+ /* 1269 */ { MAD_F(0x06b559a1) /* 0.419274929 */, 15 },
+ /* 1270 */ { MAD_F(0x06b7279e) /* 0.419715518 */, 15 },
+ /* 1271 */ { MAD_F(0x06b8f5bb) /* 0.420156222 */, 15 },
+ /* 1272 */ { MAD_F(0x06bac3f6) /* 0.420597041 */, 15 },
+ /* 1273 */ { MAD_F(0x06bc9251) /* 0.421037977 */, 15 },
+ /* 1274 */ { MAD_F(0x06be60cb) /* 0.421479027 */, 15 },
+ /* 1275 */ { MAD_F(0x06c02f63) /* 0.421920193 */, 15 },
+ /* 1276 */ { MAD_F(0x06c1fe1b) /* 0.422361475 */, 15 },
+ /* 1277 */ { MAD_F(0x06c3ccf1) /* 0.422802871 */, 15 },
+ /* 1278 */ { MAD_F(0x06c59be7) /* 0.423244383 */, 15 },
+ /* 1279 */ { MAD_F(0x06c76afb) /* 0.423686010 */, 15 },
+
+ /* 1280 */ { MAD_F(0x06c93a2e) /* 0.424127753 */, 15 },
+ /* 1281 */ { MAD_F(0x06cb0981) /* 0.424569610 */, 15 },
+ /* 1282 */ { MAD_F(0x06ccd8f2) /* 0.425011582 */, 15 },
+ /* 1283 */ { MAD_F(0x06cea881) /* 0.425453669 */, 15 },
+ /* 1284 */ { MAD_F(0x06d07830) /* 0.425895871 */, 15 },
+ /* 1285 */ { MAD_F(0x06d247fe) /* 0.426338188 */, 15 },
+ /* 1286 */ { MAD_F(0x06d417ea) /* 0.426780620 */, 15 },
+ /* 1287 */ { MAD_F(0x06d5e7f5) /* 0.427223166 */, 15 },
+ /* 1288 */ { MAD_F(0x06d7b81f) /* 0.427665827 */, 15 },
+ /* 1289 */ { MAD_F(0x06d98868) /* 0.428108603 */, 15 },
+ /* 1290 */ { MAD_F(0x06db58cf) /* 0.428551493 */, 15 },
+ /* 1291 */ { MAD_F(0x06dd2955) /* 0.428994497 */, 15 },
+ /* 1292 */ { MAD_F(0x06def9fa) /* 0.429437616 */, 15 },
+ /* 1293 */ { MAD_F(0x06e0cabe) /* 0.429880849 */, 15 },
+ /* 1294 */ { MAD_F(0x06e29ba0) /* 0.430324197 */, 15 },
+ /* 1295 */ { MAD_F(0x06e46ca1) /* 0.430767659 */, 15 },
+
+ /* 1296 */ { MAD_F(0x06e63dc0) /* 0.431211234 */, 15 },
+ /* 1297 */ { MAD_F(0x06e80efe) /* 0.431654924 */, 15 },
+ /* 1298 */ { MAD_F(0x06e9e05b) /* 0.432098728 */, 15 },
+ /* 1299 */ { MAD_F(0x06ebb1d6) /* 0.432542647 */, 15 },
+ /* 1300 */ { MAD_F(0x06ed8370) /* 0.432986678 */, 15 },
+ /* 1301 */ { MAD_F(0x06ef5529) /* 0.433430824 */, 15 },
+ /* 1302 */ { MAD_F(0x06f12700) /* 0.433875084 */, 15 },
+ /* 1303 */ { MAD_F(0x06f2f8f5) /* 0.434319457 */, 15 },
+ /* 1304 */ { MAD_F(0x06f4cb09) /* 0.434763944 */, 15 },
+ /* 1305 */ { MAD_F(0x06f69d3c) /* 0.435208545 */, 15 },
+ /* 1306 */ { MAD_F(0x06f86f8d) /* 0.435653259 */, 15 },
+ /* 1307 */ { MAD_F(0x06fa41fd) /* 0.436098087 */, 15 },
+ /* 1308 */ { MAD_F(0x06fc148b) /* 0.436543029 */, 15 },
+ /* 1309 */ { MAD_F(0x06fde737) /* 0.436988083 */, 15 },
+ /* 1310 */ { MAD_F(0x06ffba02) /* 0.437433251 */, 15 },
+ /* 1311 */ { MAD_F(0x07018ceb) /* 0.437878533 */, 15 },
+
+ /* 1312 */ { MAD_F(0x07035ff3) /* 0.438323927 */, 15 },
+ /* 1313 */ { MAD_F(0x07053319) /* 0.438769435 */, 15 },
+ /* 1314 */ { MAD_F(0x0707065d) /* 0.439215056 */, 15 },
+ /* 1315 */ { MAD_F(0x0708d9c0) /* 0.439660790 */, 15 },
+ /* 1316 */ { MAD_F(0x070aad41) /* 0.440106636 */, 15 },
+ /* 1317 */ { MAD_F(0x070c80e1) /* 0.440552596 */, 15 },
+ /* 1318 */ { MAD_F(0x070e549f) /* 0.440998669 */, 15 },
+ /* 1319 */ { MAD_F(0x0710287b) /* 0.441444855 */, 15 },
+ /* 1320 */ { MAD_F(0x0711fc75) /* 0.441891153 */, 15 },
+ /* 1321 */ { MAD_F(0x0713d08d) /* 0.442337564 */, 15 },
+ /* 1322 */ { MAD_F(0x0715a4c4) /* 0.442784088 */, 15 },
+ /* 1323 */ { MAD_F(0x07177919) /* 0.443230724 */, 15 },
+ /* 1324 */ { MAD_F(0x07194d8c) /* 0.443677473 */, 15 },
+ /* 1325 */ { MAD_F(0x071b221e) /* 0.444124334 */, 15 },
+ /* 1326 */ { MAD_F(0x071cf6ce) /* 0.444571308 */, 15 },
+ /* 1327 */ { MAD_F(0x071ecb9b) /* 0.445018394 */, 15 },
+
+ /* 1328 */ { MAD_F(0x0720a087) /* 0.445465593 */, 15 },
+ /* 1329 */ { MAD_F(0x07227591) /* 0.445912903 */, 15 },
+ /* 1330 */ { MAD_F(0x07244ab9) /* 0.446360326 */, 15 },
+ /* 1331 */ { MAD_F(0x07262000) /* 0.446807861 */, 15 },
+ /* 1332 */ { MAD_F(0x0727f564) /* 0.447255509 */, 15 },
+ /* 1333 */ { MAD_F(0x0729cae7) /* 0.447703268 */, 15 },
+ /* 1334 */ { MAD_F(0x072ba087) /* 0.448151139 */, 15 },
+ /* 1335 */ { MAD_F(0x072d7646) /* 0.448599122 */, 15 },
+ /* 1336 */ { MAD_F(0x072f4c22) /* 0.449047217 */, 15 },
+ /* 1337 */ { MAD_F(0x0731221d) /* 0.449495424 */, 15 },
+ /* 1338 */ { MAD_F(0x0732f835) /* 0.449943742 */, 15 },
+ /* 1339 */ { MAD_F(0x0734ce6c) /* 0.450392173 */, 15 },
+ /* 1340 */ { MAD_F(0x0736a4c1) /* 0.450840715 */, 15 },
+ /* 1341 */ { MAD_F(0x07387b33) /* 0.451289368 */, 15 },
+ /* 1342 */ { MAD_F(0x073a51c4) /* 0.451738133 */, 15 },
+ /* 1343 */ { MAD_F(0x073c2872) /* 0.452187010 */, 15 },
+
+ /* 1344 */ { MAD_F(0x073dff3e) /* 0.452635998 */, 15 },
+ /* 1345 */ { MAD_F(0x073fd628) /* 0.453085097 */, 15 },
+ /* 1346 */ { MAD_F(0x0741ad30) /* 0.453534308 */, 15 },
+ /* 1347 */ { MAD_F(0x07438456) /* 0.453983630 */, 15 },
+ /* 1348 */ { MAD_F(0x07455b9a) /* 0.454433063 */, 15 },
+ /* 1349 */ { MAD_F(0x074732fc) /* 0.454882607 */, 15 },
+ /* 1350 */ { MAD_F(0x07490a7b) /* 0.455332262 */, 15 },
+ /* 1351 */ { MAD_F(0x074ae218) /* 0.455782029 */, 15 },
+ /* 1352 */ { MAD_F(0x074cb9d3) /* 0.456231906 */, 15 },
+ /* 1353 */ { MAD_F(0x074e91ac) /* 0.456681894 */, 15 },
+ /* 1354 */ { MAD_F(0x075069a3) /* 0.457131993 */, 15 },
+ /* 1355 */ { MAD_F(0x075241b7) /* 0.457582203 */, 15 },
+ /* 1356 */ { MAD_F(0x075419e9) /* 0.458032524 */, 15 },
+ /* 1357 */ { MAD_F(0x0755f239) /* 0.458482956 */, 15 },
+ /* 1358 */ { MAD_F(0x0757caa7) /* 0.458933498 */, 15 },
+ /* 1359 */ { MAD_F(0x0759a332) /* 0.459384151 */, 15 },
+
+ /* 1360 */ { MAD_F(0x075b7bdb) /* 0.459834914 */, 15 },
+ /* 1361 */ { MAD_F(0x075d54a1) /* 0.460285788 */, 15 },
+ /* 1362 */ { MAD_F(0x075f2d85) /* 0.460736772 */, 15 },
+ /* 1363 */ { MAD_F(0x07610687) /* 0.461187867 */, 15 },
+ /* 1364 */ { MAD_F(0x0762dfa6) /* 0.461639071 */, 15 },
+ /* 1365 */ { MAD_F(0x0764b8e3) /* 0.462090387 */, 15 },
+ /* 1366 */ { MAD_F(0x0766923e) /* 0.462541812 */, 15 },
+ /* 1367 */ { MAD_F(0x07686bb6) /* 0.462993348 */, 15 },
+ /* 1368 */ { MAD_F(0x076a454c) /* 0.463444993 */, 15 },
+ /* 1369 */ { MAD_F(0x076c1eff) /* 0.463896749 */, 15 },
+ /* 1370 */ { MAD_F(0x076df8d0) /* 0.464348615 */, 15 },
+ /* 1371 */ { MAD_F(0x076fd2be) /* 0.464800591 */, 15 },
+ /* 1372 */ { MAD_F(0x0771acca) /* 0.465252676 */, 15 },
+ /* 1373 */ { MAD_F(0x077386f3) /* 0.465704872 */, 15 },
+ /* 1374 */ { MAD_F(0x0775613a) /* 0.466157177 */, 15 },
+ /* 1375 */ { MAD_F(0x07773b9e) /* 0.466609592 */, 15 },
+
+ /* 1376 */ { MAD_F(0x07791620) /* 0.467062117 */, 15 },
+ /* 1377 */ { MAD_F(0x077af0bf) /* 0.467514751 */, 15 },
+ /* 1378 */ { MAD_F(0x077ccb7c) /* 0.467967495 */, 15 },
+ /* 1379 */ { MAD_F(0x077ea656) /* 0.468420349 */, 15 },
+ /* 1380 */ { MAD_F(0x0780814d) /* 0.468873312 */, 15 },
+ /* 1381 */ { MAD_F(0x07825c62) /* 0.469326384 */, 15 },
+ /* 1382 */ { MAD_F(0x07843794) /* 0.469779566 */, 15 },
+ /* 1383 */ { MAD_F(0x078612e3) /* 0.470232857 */, 15 },
+ /* 1384 */ { MAD_F(0x0787ee50) /* 0.470686258 */, 15 },
+ /* 1385 */ { MAD_F(0x0789c9da) /* 0.471139767 */, 15 },
+ /* 1386 */ { MAD_F(0x078ba581) /* 0.471593386 */, 15 },
+ /* 1387 */ { MAD_F(0x078d8146) /* 0.472047114 */, 15 },
+ /* 1388 */ { MAD_F(0x078f5d28) /* 0.472500951 */, 15 },
+ /* 1389 */ { MAD_F(0x07913927) /* 0.472954896 */, 15 },
+ /* 1390 */ { MAD_F(0x07931543) /* 0.473408951 */, 15 },
+ /* 1391 */ { MAD_F(0x0794f17d) /* 0.473863115 */, 15 },
+
+ /* 1392 */ { MAD_F(0x0796cdd4) /* 0.474317388 */, 15 },
+ /* 1393 */ { MAD_F(0x0798aa48) /* 0.474771769 */, 15 },
+ /* 1394 */ { MAD_F(0x079a86d9) /* 0.475226259 */, 15 },
+ /* 1395 */ { MAD_F(0x079c6388) /* 0.475680858 */, 15 },
+ /* 1396 */ { MAD_F(0x079e4053) /* 0.476135565 */, 15 },
+ /* 1397 */ { MAD_F(0x07a01d3c) /* 0.476590381 */, 15 },
+ /* 1398 */ { MAD_F(0x07a1fa42) /* 0.477045306 */, 15 },
+ /* 1399 */ { MAD_F(0x07a3d765) /* 0.477500339 */, 15 },
+ /* 1400 */ { MAD_F(0x07a5b4a5) /* 0.477955481 */, 15 },
+ /* 1401 */ { MAD_F(0x07a79202) /* 0.478410731 */, 15 },
+ /* 1402 */ { MAD_F(0x07a96f7d) /* 0.478866089 */, 15 },
+ /* 1403 */ { MAD_F(0x07ab4d14) /* 0.479321555 */, 15 },
+ /* 1404 */ { MAD_F(0x07ad2ac8) /* 0.479777130 */, 15 },
+ /* 1405 */ { MAD_F(0x07af089a) /* 0.480232813 */, 15 },
+ /* 1406 */ { MAD_F(0x07b0e688) /* 0.480688604 */, 15 },
+ /* 1407 */ { MAD_F(0x07b2c494) /* 0.481144503 */, 15 },
+
+ /* 1408 */ { MAD_F(0x07b4a2bc) /* 0.481600510 */, 15 },
+ /* 1409 */ { MAD_F(0x07b68102) /* 0.482056625 */, 15 },
+ /* 1410 */ { MAD_F(0x07b85f64) /* 0.482512848 */, 15 },
+ /* 1411 */ { MAD_F(0x07ba3de4) /* 0.482969179 */, 15 },
+ /* 1412 */ { MAD_F(0x07bc1c80) /* 0.483425618 */, 15 },
+ /* 1413 */ { MAD_F(0x07bdfb39) /* 0.483882164 */, 15 },
+ /* 1414 */ { MAD_F(0x07bfda0f) /* 0.484338818 */, 15 },
+ /* 1415 */ { MAD_F(0x07c1b902) /* 0.484795580 */, 15 },
+ /* 1416 */ { MAD_F(0x07c39812) /* 0.485252449 */, 15 },
+ /* 1417 */ { MAD_F(0x07c5773f) /* 0.485709426 */, 15 },
+ /* 1418 */ { MAD_F(0x07c75689) /* 0.486166511 */, 15 },
+ /* 1419 */ { MAD_F(0x07c935ef) /* 0.486623703 */, 15 },
+ /* 1420 */ { MAD_F(0x07cb1573) /* 0.487081002 */, 15 },
+ /* 1421 */ { MAD_F(0x07ccf513) /* 0.487538409 */, 15 },
+ /* 1422 */ { MAD_F(0x07ced4d0) /* 0.487995923 */, 15 },
+ /* 1423 */ { MAD_F(0x07d0b4aa) /* 0.488453544 */, 15 },
+
+ /* 1424 */ { MAD_F(0x07d294a0) /* 0.488911273 */, 15 },
+ /* 1425 */ { MAD_F(0x07d474b3) /* 0.489369108 */, 15 },
+ /* 1426 */ { MAD_F(0x07d654e4) /* 0.489827051 */, 15 },
+ /* 1427 */ { MAD_F(0x07d83530) /* 0.490285101 */, 15 },
+ /* 1428 */ { MAD_F(0x07da159a) /* 0.490743258 */, 15 },
+ /* 1429 */ { MAD_F(0x07dbf620) /* 0.491201522 */, 15 },
+ /* 1430 */ { MAD_F(0x07ddd6c3) /* 0.491659892 */, 15 },
+ /* 1431 */ { MAD_F(0x07dfb783) /* 0.492118370 */, 15 },
+ /* 1432 */ { MAD_F(0x07e1985f) /* 0.492576954 */, 15 },
+ /* 1433 */ { MAD_F(0x07e37958) /* 0.493035645 */, 15 },
+ /* 1434 */ { MAD_F(0x07e55a6e) /* 0.493494443 */, 15 },
+ /* 1435 */ { MAD_F(0x07e73ba0) /* 0.493953348 */, 15 },
+ /* 1436 */ { MAD_F(0x07e91cef) /* 0.494412359 */, 15 },
+ /* 1437 */ { MAD_F(0x07eafe5a) /* 0.494871476 */, 15 },
+ /* 1438 */ { MAD_F(0x07ecdfe2) /* 0.495330701 */, 15 },
+ /* 1439 */ { MAD_F(0x07eec187) /* 0.495790031 */, 15 },
+
+ /* 1440 */ { MAD_F(0x07f0a348) /* 0.496249468 */, 15 },
+ /* 1441 */ { MAD_F(0x07f28526) /* 0.496709012 */, 15 },
+ /* 1442 */ { MAD_F(0x07f46720) /* 0.497168662 */, 15 },
+ /* 1443 */ { MAD_F(0x07f64937) /* 0.497628418 */, 15 },
+ /* 1444 */ { MAD_F(0x07f82b6a) /* 0.498088280 */, 15 },
+ /* 1445 */ { MAD_F(0x07fa0dba) /* 0.498548248 */, 15 },
+ /* 1446 */ { MAD_F(0x07fbf026) /* 0.499008323 */, 15 },
+ /* 1447 */ { MAD_F(0x07fdd2af) /* 0.499468503 */, 15 },
+ /* 1448 */ { MAD_F(0x07ffb554) /* 0.499928790 */, 15 },
+ /* 1449 */ { MAD_F(0x0400cc0b) /* 0.250194591 */, 16 },
+ /* 1450 */ { MAD_F(0x0401bd7a) /* 0.250424840 */, 16 },
+ /* 1451 */ { MAD_F(0x0402aef7) /* 0.250655143 */, 16 },
+ /* 1452 */ { MAD_F(0x0403a083) /* 0.250885498 */, 16 },
+ /* 1453 */ { MAD_F(0x0404921c) /* 0.251115906 */, 16 },
+ /* 1454 */ { MAD_F(0x040583c4) /* 0.251346367 */, 16 },
+ /* 1455 */ { MAD_F(0x0406757a) /* 0.251576880 */, 16 },
+
+ /* 1456 */ { MAD_F(0x0407673f) /* 0.251807447 */, 16 },
+ /* 1457 */ { MAD_F(0x04085911) /* 0.252038066 */, 16 },
+ /* 1458 */ { MAD_F(0x04094af1) /* 0.252268738 */, 16 },
+ /* 1459 */ { MAD_F(0x040a3ce0) /* 0.252499463 */, 16 },
+ /* 1460 */ { MAD_F(0x040b2edd) /* 0.252730240 */, 16 },
+ /* 1461 */ { MAD_F(0x040c20e8) /* 0.252961071 */, 16 },
+ /* 1462 */ { MAD_F(0x040d1301) /* 0.253191953 */, 16 },
+ /* 1463 */ { MAD_F(0x040e0529) /* 0.253422889 */, 16 },
+ /* 1464 */ { MAD_F(0x040ef75e) /* 0.253653877 */, 16 },
+ /* 1465 */ { MAD_F(0x040fe9a1) /* 0.253884918 */, 16 },
+ /* 1466 */ { MAD_F(0x0410dbf3) /* 0.254116011 */, 16 },
+ /* 1467 */ { MAD_F(0x0411ce53) /* 0.254347157 */, 16 },
+ /* 1468 */ { MAD_F(0x0412c0c1) /* 0.254578356 */, 16 },
+ /* 1469 */ { MAD_F(0x0413b33d) /* 0.254809606 */, 16 },
+ /* 1470 */ { MAD_F(0x0414a5c7) /* 0.255040910 */, 16 },
+ /* 1471 */ { MAD_F(0x0415985f) /* 0.255272266 */, 16 },
+
+ /* 1472 */ { MAD_F(0x04168b05) /* 0.255503674 */, 16 },
+ /* 1473 */ { MAD_F(0x04177db9) /* 0.255735135 */, 16 },
+ /* 1474 */ { MAD_F(0x0418707c) /* 0.255966648 */, 16 },
+ /* 1475 */ { MAD_F(0x0419634c) /* 0.256198213 */, 16 },
+ /* 1476 */ { MAD_F(0x041a562a) /* 0.256429831 */, 16 },
+ /* 1477 */ { MAD_F(0x041b4917) /* 0.256661501 */, 16 },
+ /* 1478 */ { MAD_F(0x041c3c11) /* 0.256893223 */, 16 },
+ /* 1479 */ { MAD_F(0x041d2f1a) /* 0.257124998 */, 16 },
+ /* 1480 */ { MAD_F(0x041e2230) /* 0.257356825 */, 16 },
+ /* 1481 */ { MAD_F(0x041f1555) /* 0.257588704 */, 16 },
+ /* 1482 */ { MAD_F(0x04200888) /* 0.257820635 */, 16 },
+ /* 1483 */ { MAD_F(0x0420fbc8) /* 0.258052619 */, 16 },
+ /* 1484 */ { MAD_F(0x0421ef17) /* 0.258284654 */, 16 },
+ /* 1485 */ { MAD_F(0x0422e273) /* 0.258516742 */, 16 },
+ /* 1486 */ { MAD_F(0x0423d5de) /* 0.258748882 */, 16 },
+ /* 1487 */ { MAD_F(0x0424c956) /* 0.258981074 */, 16 },
+
+ /* 1488 */ { MAD_F(0x0425bcdd) /* 0.259213318 */, 16 },
+ /* 1489 */ { MAD_F(0x0426b071) /* 0.259445614 */, 16 },
+ /* 1490 */ { MAD_F(0x0427a414) /* 0.259677962 */, 16 },
+ /* 1491 */ { MAD_F(0x042897c4) /* 0.259910362 */, 16 },
+ /* 1492 */ { MAD_F(0x04298b83) /* 0.260142814 */, 16 },
+ /* 1493 */ { MAD_F(0x042a7f4f) /* 0.260375318 */, 16 },
+ /* 1494 */ { MAD_F(0x042b7329) /* 0.260607874 */, 16 },
+ /* 1495 */ { MAD_F(0x042c6711) /* 0.260840481 */, 16 },
+ /* 1496 */ { MAD_F(0x042d5b07) /* 0.261073141 */, 16 },
+ /* 1497 */ { MAD_F(0x042e4f0b) /* 0.261305852 */, 16 },
+ /* 1498 */ { MAD_F(0x042f431d) /* 0.261538616 */, 16 },
+ /* 1499 */ { MAD_F(0x0430373d) /* 0.261771431 */, 16 },
+ /* 1500 */ { MAD_F(0x04312b6b) /* 0.262004297 */, 16 },
+ /* 1501 */ { MAD_F(0x04321fa6) /* 0.262237216 */, 16 },
+ /* 1502 */ { MAD_F(0x043313f0) /* 0.262470186 */, 16 },
+ /* 1503 */ { MAD_F(0x04340847) /* 0.262703208 */, 16 },
+
+ /* 1504 */ { MAD_F(0x0434fcad) /* 0.262936282 */, 16 },
+ /* 1505 */ { MAD_F(0x0435f120) /* 0.263169407 */, 16 },
+ /* 1506 */ { MAD_F(0x0436e5a1) /* 0.263402584 */, 16 },
+ /* 1507 */ { MAD_F(0x0437da2f) /* 0.263635813 */, 16 },
+ /* 1508 */ { MAD_F(0x0438cecc) /* 0.263869093 */, 16 },
+ /* 1509 */ { MAD_F(0x0439c377) /* 0.264102425 */, 16 },
+ /* 1510 */ { MAD_F(0x043ab82f) /* 0.264335808 */, 16 },
+ /* 1511 */ { MAD_F(0x043bacf5) /* 0.264569243 */, 16 },
+ /* 1512 */ { MAD_F(0x043ca1c9) /* 0.264802730 */, 16 },
+ /* 1513 */ { MAD_F(0x043d96ab) /* 0.265036267 */, 16 },
+ /* 1514 */ { MAD_F(0x043e8b9b) /* 0.265269857 */, 16 },
+ /* 1515 */ { MAD_F(0x043f8098) /* 0.265503498 */, 16 },
+ /* 1516 */ { MAD_F(0x044075a3) /* 0.265737190 */, 16 },
+ /* 1517 */ { MAD_F(0x04416abc) /* 0.265970933 */, 16 },
+ /* 1518 */ { MAD_F(0x04425fe3) /* 0.266204728 */, 16 },
+ /* 1519 */ { MAD_F(0x04435518) /* 0.266438574 */, 16 },
+
+ /* 1520 */ { MAD_F(0x04444a5a) /* 0.266672472 */, 16 },
+ /* 1521 */ { MAD_F(0x04453fab) /* 0.266906421 */, 16 },
+ /* 1522 */ { MAD_F(0x04463508) /* 0.267140421 */, 16 },
+ /* 1523 */ { MAD_F(0x04472a74) /* 0.267374472 */, 16 },
+ /* 1524 */ { MAD_F(0x04481fee) /* 0.267608575 */, 16 },
+ /* 1525 */ { MAD_F(0x04491575) /* 0.267842729 */, 16 },
+ /* 1526 */ { MAD_F(0x044a0b0a) /* 0.268076934 */, 16 },
+ /* 1527 */ { MAD_F(0x044b00ac) /* 0.268311190 */, 16 },
+ /* 1528 */ { MAD_F(0x044bf65d) /* 0.268545497 */, 16 },
+ /* 1529 */ { MAD_F(0x044cec1b) /* 0.268779856 */, 16 },
+ /* 1530 */ { MAD_F(0x044de1e7) /* 0.269014265 */, 16 },
+ /* 1531 */ { MAD_F(0x044ed7c0) /* 0.269248726 */, 16 },
+ /* 1532 */ { MAD_F(0x044fcda8) /* 0.269483238 */, 16 },
+ /* 1533 */ { MAD_F(0x0450c39c) /* 0.269717800 */, 16 },
+ /* 1534 */ { MAD_F(0x0451b99f) /* 0.269952414 */, 16 },
+ /* 1535 */ { MAD_F(0x0452afaf) /* 0.270187079 */, 16 },
+
+ /* 1536 */ { MAD_F(0x0453a5cd) /* 0.270421794 */, 16 },
+ /* 1537 */ { MAD_F(0x04549bf9) /* 0.270656561 */, 16 },
+ /* 1538 */ { MAD_F(0x04559232) /* 0.270891379 */, 16 },
+ /* 1539 */ { MAD_F(0x04568879) /* 0.271126247 */, 16 },
+ /* 1540 */ { MAD_F(0x04577ece) /* 0.271361166 */, 16 },
+ /* 1541 */ { MAD_F(0x04587530) /* 0.271596136 */, 16 },
+ /* 1542 */ { MAD_F(0x04596ba0) /* 0.271831157 */, 16 },
+ /* 1543 */ { MAD_F(0x045a621e) /* 0.272066229 */, 16 },
+ /* 1544 */ { MAD_F(0x045b58a9) /* 0.272301352 */, 16 },
+ /* 1545 */ { MAD_F(0x045c4f42) /* 0.272536525 */, 16 },
+ /* 1546 */ { MAD_F(0x045d45e9) /* 0.272771749 */, 16 },
+ /* 1547 */ { MAD_F(0x045e3c9d) /* 0.273007024 */, 16 },
+ /* 1548 */ { MAD_F(0x045f335e) /* 0.273242350 */, 16 },
+ /* 1549 */ { MAD_F(0x04602a2e) /* 0.273477726 */, 16 },
+ /* 1550 */ { MAD_F(0x0461210b) /* 0.273713153 */, 16 },
+ /* 1551 */ { MAD_F(0x046217f5) /* 0.273948630 */, 16 },
+
+ /* 1552 */ { MAD_F(0x04630eed) /* 0.274184158 */, 16 },
+ /* 1553 */ { MAD_F(0x046405f3) /* 0.274419737 */, 16 },
+ /* 1554 */ { MAD_F(0x0464fd06) /* 0.274655366 */, 16 },
+ /* 1555 */ { MAD_F(0x0465f427) /* 0.274891046 */, 16 },
+ /* 1556 */ { MAD_F(0x0466eb55) /* 0.275126776 */, 16 },
+ /* 1557 */ { MAD_F(0x0467e291) /* 0.275362557 */, 16 },
+ /* 1558 */ { MAD_F(0x0468d9db) /* 0.275598389 */, 16 },
+ /* 1559 */ { MAD_F(0x0469d132) /* 0.275834270 */, 16 },
+ /* 1560 */ { MAD_F(0x046ac896) /* 0.276070203 */, 16 },
+ /* 1561 */ { MAD_F(0x046bc009) /* 0.276306185 */, 16 },
+ /* 1562 */ { MAD_F(0x046cb788) /* 0.276542218 */, 16 },
+ /* 1563 */ { MAD_F(0x046daf15) /* 0.276778302 */, 16 },
+ /* 1564 */ { MAD_F(0x046ea6b0) /* 0.277014435 */, 16 },
+ /* 1565 */ { MAD_F(0x046f9e58) /* 0.277250619 */, 16 },
+ /* 1566 */ { MAD_F(0x0470960e) /* 0.277486854 */, 16 },
+ /* 1567 */ { MAD_F(0x04718dd1) /* 0.277723139 */, 16 },
+
+ /* 1568 */ { MAD_F(0x047285a2) /* 0.277959474 */, 16 },
+ /* 1569 */ { MAD_F(0x04737d80) /* 0.278195859 */, 16 },
+ /* 1570 */ { MAD_F(0x0474756c) /* 0.278432294 */, 16 },
+ /* 1571 */ { MAD_F(0x04756d65) /* 0.278668780 */, 16 },
+ /* 1572 */ { MAD_F(0x0476656b) /* 0.278905316 */, 16 },
+ /* 1573 */ { MAD_F(0x04775d7f) /* 0.279141902 */, 16 },
+ /* 1574 */ { MAD_F(0x047855a1) /* 0.279378538 */, 16 },
+ /* 1575 */ { MAD_F(0x04794dd0) /* 0.279615224 */, 16 },
+ /* 1576 */ { MAD_F(0x047a460c) /* 0.279851960 */, 16 },
+ /* 1577 */ { MAD_F(0x047b3e56) /* 0.280088747 */, 16 },
+ /* 1578 */ { MAD_F(0x047c36ae) /* 0.280325583 */, 16 },
+ /* 1579 */ { MAD_F(0x047d2f12) /* 0.280562470 */, 16 },
+ /* 1580 */ { MAD_F(0x047e2784) /* 0.280799406 */, 16 },
+ /* 1581 */ { MAD_F(0x047f2004) /* 0.281036393 */, 16 },
+ /* 1582 */ { MAD_F(0x04801891) /* 0.281273429 */, 16 },
+ /* 1583 */ { MAD_F(0x0481112b) /* 0.281510516 */, 16 },
+
+ /* 1584 */ { MAD_F(0x048209d3) /* 0.281747652 */, 16 },
+ /* 1585 */ { MAD_F(0x04830288) /* 0.281984838 */, 16 },
+ /* 1586 */ { MAD_F(0x0483fb4b) /* 0.282222075 */, 16 },
+ /* 1587 */ { MAD_F(0x0484f41b) /* 0.282459361 */, 16 },
+ /* 1588 */ { MAD_F(0x0485ecf8) /* 0.282696697 */, 16 },
+ /* 1589 */ { MAD_F(0x0486e5e3) /* 0.282934082 */, 16 },
+ /* 1590 */ { MAD_F(0x0487dedb) /* 0.283171518 */, 16 },
+ /* 1591 */ { MAD_F(0x0488d7e1) /* 0.283409003 */, 16 },
+ /* 1592 */ { MAD_F(0x0489d0f4) /* 0.283646538 */, 16 },
+ /* 1593 */ { MAD_F(0x048aca14) /* 0.283884123 */, 16 },
+ /* 1594 */ { MAD_F(0x048bc341) /* 0.284121757 */, 16 },
+ /* 1595 */ { MAD_F(0x048cbc7c) /* 0.284359441 */, 16 },
+ /* 1596 */ { MAD_F(0x048db5c4) /* 0.284597175 */, 16 },
+ /* 1597 */ { MAD_F(0x048eaf1a) /* 0.284834959 */, 16 },
+ /* 1598 */ { MAD_F(0x048fa87d) /* 0.285072792 */, 16 },
+ /* 1599 */ { MAD_F(0x0490a1ed) /* 0.285310675 */, 16 },
+
+ /* 1600 */ { MAD_F(0x04919b6a) /* 0.285548607 */, 16 },
+ /* 1601 */ { MAD_F(0x049294f5) /* 0.285786589 */, 16 },
+ /* 1602 */ { MAD_F(0x04938e8d) /* 0.286024621 */, 16 },
+ /* 1603 */ { MAD_F(0x04948833) /* 0.286262702 */, 16 },
+ /* 1604 */ { MAD_F(0x049581e5) /* 0.286500832 */, 16 },
+ /* 1605 */ { MAD_F(0x04967ba5) /* 0.286739012 */, 16 },
+ /* 1606 */ { MAD_F(0x04977573) /* 0.286977242 */, 16 },
+ /* 1607 */ { MAD_F(0x04986f4d) /* 0.287215521 */, 16 },
+ /* 1608 */ { MAD_F(0x04996935) /* 0.287453849 */, 16 },
+ /* 1609 */ { MAD_F(0x049a632a) /* 0.287692227 */, 16 },
+ /* 1610 */ { MAD_F(0x049b5d2c) /* 0.287930654 */, 16 },
+ /* 1611 */ { MAD_F(0x049c573c) /* 0.288169131 */, 16 },
+ /* 1612 */ { MAD_F(0x049d5159) /* 0.288407657 */, 16 },
+ /* 1613 */ { MAD_F(0x049e4b83) /* 0.288646232 */, 16 },
+ /* 1614 */ { MAD_F(0x049f45ba) /* 0.288884857 */, 16 },
+ /* 1615 */ { MAD_F(0x04a03ffe) /* 0.289123530 */, 16 },
+
+ /* 1616 */ { MAD_F(0x04a13a50) /* 0.289362253 */, 16 },
+ /* 1617 */ { MAD_F(0x04a234af) /* 0.289601026 */, 16 },
+ /* 1618 */ { MAD_F(0x04a32f1b) /* 0.289839847 */, 16 },
+ /* 1619 */ { MAD_F(0x04a42995) /* 0.290078718 */, 16 },
+ /* 1620 */ { MAD_F(0x04a5241b) /* 0.290317638 */, 16 },
+ /* 1621 */ { MAD_F(0x04a61eaf) /* 0.290556607 */, 16 },
+ /* 1622 */ { MAD_F(0x04a71950) /* 0.290795626 */, 16 },
+ /* 1623 */ { MAD_F(0x04a813fe) /* 0.291034693 */, 16 },
+ /* 1624 */ { MAD_F(0x04a90eba) /* 0.291273810 */, 16 },
+ /* 1625 */ { MAD_F(0x04aa0982) /* 0.291512975 */, 16 },
+ /* 1626 */ { MAD_F(0x04ab0458) /* 0.291752190 */, 16 },
+ /* 1627 */ { MAD_F(0x04abff3b) /* 0.291991453 */, 16 },
+ /* 1628 */ { MAD_F(0x04acfa2b) /* 0.292230766 */, 16 },
+ /* 1629 */ { MAD_F(0x04adf528) /* 0.292470128 */, 16 },
+ /* 1630 */ { MAD_F(0x04aef032) /* 0.292709539 */, 16 },
+ /* 1631 */ { MAD_F(0x04afeb4a) /* 0.292948998 */, 16 },
+
+ /* 1632 */ { MAD_F(0x04b0e66e) /* 0.293188507 */, 16 },
+ /* 1633 */ { MAD_F(0x04b1e1a0) /* 0.293428065 */, 16 },
+ /* 1634 */ { MAD_F(0x04b2dcdf) /* 0.293667671 */, 16 },
+ /* 1635 */ { MAD_F(0x04b3d82b) /* 0.293907326 */, 16 },
+ /* 1636 */ { MAD_F(0x04b4d384) /* 0.294147031 */, 16 },
+ /* 1637 */ { MAD_F(0x04b5ceea) /* 0.294386784 */, 16 },
+ /* 1638 */ { MAD_F(0x04b6ca5e) /* 0.294626585 */, 16 },
+ /* 1639 */ { MAD_F(0x04b7c5de) /* 0.294866436 */, 16 },
+ /* 1640 */ { MAD_F(0x04b8c16c) /* 0.295106336 */, 16 },
+ /* 1641 */ { MAD_F(0x04b9bd06) /* 0.295346284 */, 16 },
+ /* 1642 */ { MAD_F(0x04bab8ae) /* 0.295586281 */, 16 },
+ /* 1643 */ { MAD_F(0x04bbb463) /* 0.295826327 */, 16 },
+ /* 1644 */ { MAD_F(0x04bcb024) /* 0.296066421 */, 16 },
+ /* 1645 */ { MAD_F(0x04bdabf3) /* 0.296306564 */, 16 },
+ /* 1646 */ { MAD_F(0x04bea7cf) /* 0.296546756 */, 16 },
+ /* 1647 */ { MAD_F(0x04bfa3b8) /* 0.296786996 */, 16 },
+
+ /* 1648 */ { MAD_F(0x04c09faf) /* 0.297027285 */, 16 },
+ /* 1649 */ { MAD_F(0x04c19bb2) /* 0.297267623 */, 16 },
+ /* 1650 */ { MAD_F(0x04c297c2) /* 0.297508009 */, 16 },
+ /* 1651 */ { MAD_F(0x04c393df) /* 0.297748444 */, 16 },
+ /* 1652 */ { MAD_F(0x04c49009) /* 0.297988927 */, 16 },
+ /* 1653 */ { MAD_F(0x04c58c41) /* 0.298229459 */, 16 },
+ /* 1654 */ { MAD_F(0x04c68885) /* 0.298470039 */, 16 },
+ /* 1655 */ { MAD_F(0x04c784d6) /* 0.298710668 */, 16 },
+ /* 1656 */ { MAD_F(0x04c88135) /* 0.298951346 */, 16 },
+ /* 1657 */ { MAD_F(0x04c97da0) /* 0.299192071 */, 16 },
+ /* 1658 */ { MAD_F(0x04ca7a18) /* 0.299432846 */, 16 },
+ /* 1659 */ { MAD_F(0x04cb769e) /* 0.299673668 */, 16 },
+ /* 1660 */ { MAD_F(0x04cc7330) /* 0.299914539 */, 16 },
+ /* 1661 */ { MAD_F(0x04cd6fcf) /* 0.300155459 */, 16 },
+ /* 1662 */ { MAD_F(0x04ce6c7b) /* 0.300396426 */, 16 },
+ /* 1663 */ { MAD_F(0x04cf6935) /* 0.300637443 */, 16 },
+
+ /* 1664 */ { MAD_F(0x04d065fb) /* 0.300878507 */, 16 },
+ /* 1665 */ { MAD_F(0x04d162ce) /* 0.301119620 */, 16 },
+ /* 1666 */ { MAD_F(0x04d25fae) /* 0.301360781 */, 16 },
+ /* 1667 */ { MAD_F(0x04d35c9b) /* 0.301601990 */, 16 },
+ /* 1668 */ { MAD_F(0x04d45995) /* 0.301843247 */, 16 },
+ /* 1669 */ { MAD_F(0x04d5569c) /* 0.302084553 */, 16 },
+ /* 1670 */ { MAD_F(0x04d653b0) /* 0.302325907 */, 16 },
+ /* 1671 */ { MAD_F(0x04d750d1) /* 0.302567309 */, 16 },
+ /* 1672 */ { MAD_F(0x04d84dff) /* 0.302808759 */, 16 },
+ /* 1673 */ { MAD_F(0x04d94b3a) /* 0.303050257 */, 16 },
+ /* 1674 */ { MAD_F(0x04da4881) /* 0.303291804 */, 16 },
+ /* 1675 */ { MAD_F(0x04db45d6) /* 0.303533399 */, 16 },
+ /* 1676 */ { MAD_F(0x04dc4337) /* 0.303775041 */, 16 },
+ /* 1677 */ { MAD_F(0x04dd40a6) /* 0.304016732 */, 16 },
+ /* 1678 */ { MAD_F(0x04de3e21) /* 0.304258471 */, 16 },
+ /* 1679 */ { MAD_F(0x04df3ba9) /* 0.304500257 */, 16 },
+
+ /* 1680 */ { MAD_F(0x04e0393e) /* 0.304742092 */, 16 },
+ /* 1681 */ { MAD_F(0x04e136e0) /* 0.304983975 */, 16 },
+ /* 1682 */ { MAD_F(0x04e2348f) /* 0.305225906 */, 16 },
+ /* 1683 */ { MAD_F(0x04e3324b) /* 0.305467885 */, 16 },
+ /* 1684 */ { MAD_F(0x04e43013) /* 0.305709911 */, 16 },
+ /* 1685 */ { MAD_F(0x04e52de9) /* 0.305951986 */, 16 },
+ /* 1686 */ { MAD_F(0x04e62bcb) /* 0.306194108 */, 16 },
+ /* 1687 */ { MAD_F(0x04e729ba) /* 0.306436279 */, 16 },
+ /* 1688 */ { MAD_F(0x04e827b6) /* 0.306678497 */, 16 },
+ /* 1689 */ { MAD_F(0x04e925bf) /* 0.306920763 */, 16 },
+ /* 1690 */ { MAD_F(0x04ea23d4) /* 0.307163077 */, 16 },
+ /* 1691 */ { MAD_F(0x04eb21f7) /* 0.307405438 */, 16 },
+ /* 1692 */ { MAD_F(0x04ec2026) /* 0.307647848 */, 16 },
+ /* 1693 */ { MAD_F(0x04ed1e62) /* 0.307890305 */, 16 },
+ /* 1694 */ { MAD_F(0x04ee1cab) /* 0.308132810 */, 16 },
+ /* 1695 */ { MAD_F(0x04ef1b01) /* 0.308375362 */, 16 },
+
+ /* 1696 */ { MAD_F(0x04f01963) /* 0.308617963 */, 16 },
+ /* 1697 */ { MAD_F(0x04f117d3) /* 0.308860611 */, 16 },
+ /* 1698 */ { MAD_F(0x04f2164f) /* 0.309103306 */, 16 },
+ /* 1699 */ { MAD_F(0x04f314d8) /* 0.309346050 */, 16 },
+ /* 1700 */ { MAD_F(0x04f4136d) /* 0.309588841 */, 16 },
+ /* 1701 */ { MAD_F(0x04f51210) /* 0.309831679 */, 16 },
+ /* 1702 */ { MAD_F(0x04f610bf) /* 0.310074565 */, 16 },
+ /* 1703 */ { MAD_F(0x04f70f7b) /* 0.310317499 */, 16 },
+ /* 1704 */ { MAD_F(0x04f80e44) /* 0.310560480 */, 16 },
+ /* 1705 */ { MAD_F(0x04f90d19) /* 0.310803509 */, 16 },
+ /* 1706 */ { MAD_F(0x04fa0bfc) /* 0.311046586 */, 16 },
+ /* 1707 */ { MAD_F(0x04fb0aeb) /* 0.311289710 */, 16 },
+ /* 1708 */ { MAD_F(0x04fc09e7) /* 0.311532881 */, 16 },
+ /* 1709 */ { MAD_F(0x04fd08ef) /* 0.311776100 */, 16 },
+ /* 1710 */ { MAD_F(0x04fe0805) /* 0.312019366 */, 16 },
+ /* 1711 */ { MAD_F(0x04ff0727) /* 0.312262680 */, 16 },
+
+ /* 1712 */ { MAD_F(0x05000655) /* 0.312506041 */, 16 },
+ /* 1713 */ { MAD_F(0x05010591) /* 0.312749449 */, 16 },
+ /* 1714 */ { MAD_F(0x050204d9) /* 0.312992905 */, 16 },
+ /* 1715 */ { MAD_F(0x0503042e) /* 0.313236408 */, 16 },
+ /* 1716 */ { MAD_F(0x0504038f) /* 0.313479959 */, 16 },
+ /* 1717 */ { MAD_F(0x050502fe) /* 0.313723556 */, 16 },
+ /* 1718 */ { MAD_F(0x05060279) /* 0.313967202 */, 16 },
+ /* 1719 */ { MAD_F(0x05070200) /* 0.314210894 */, 16 },
+ /* 1720 */ { MAD_F(0x05080195) /* 0.314454634 */, 16 },
+ /* 1721 */ { MAD_F(0x05090136) /* 0.314698420 */, 16 },
+ /* 1722 */ { MAD_F(0x050a00e3) /* 0.314942255 */, 16 },
+ /* 1723 */ { MAD_F(0x050b009e) /* 0.315186136 */, 16 },
+ /* 1724 */ { MAD_F(0x050c0065) /* 0.315430064 */, 16 },
+ /* 1725 */ { MAD_F(0x050d0039) /* 0.315674040 */, 16 },
+ /* 1726 */ { MAD_F(0x050e0019) /* 0.315918063 */, 16 },
+ /* 1727 */ { MAD_F(0x050f0006) /* 0.316162133 */, 16 },
+
+ /* 1728 */ { MAD_F(0x05100000) /* 0.316406250 */, 16 },
+ /* 1729 */ { MAD_F(0x05110006) /* 0.316650414 */, 16 },
+ /* 1730 */ { MAD_F(0x05120019) /* 0.316894625 */, 16 },
+ /* 1731 */ { MAD_F(0x05130039) /* 0.317138884 */, 16 },
+ /* 1732 */ { MAD_F(0x05140065) /* 0.317383189 */, 16 },
+ /* 1733 */ { MAD_F(0x0515009e) /* 0.317627541 */, 16 },
+ /* 1734 */ { MAD_F(0x051600e3) /* 0.317871941 */, 16 },
+ /* 1735 */ { MAD_F(0x05170135) /* 0.318116387 */, 16 },
+ /* 1736 */ { MAD_F(0x05180194) /* 0.318360880 */, 16 },
+ /* 1737 */ { MAD_F(0x051901ff) /* 0.318605421 */, 16 },
+ /* 1738 */ { MAD_F(0x051a0277) /* 0.318850008 */, 16 },
+ /* 1739 */ { MAD_F(0x051b02fc) /* 0.319094642 */, 16 },
+ /* 1740 */ { MAD_F(0x051c038d) /* 0.319339323 */, 16 },
+ /* 1741 */ { MAD_F(0x051d042a) /* 0.319584051 */, 16 },
+ /* 1742 */ { MAD_F(0x051e04d4) /* 0.319828826 */, 16 },
+ /* 1743 */ { MAD_F(0x051f058b) /* 0.320073647 */, 16 },
+
+ /* 1744 */ { MAD_F(0x0520064f) /* 0.320318516 */, 16 },
+ /* 1745 */ { MAD_F(0x0521071f) /* 0.320563431 */, 16 },
+ /* 1746 */ { MAD_F(0x052207fb) /* 0.320808393 */, 16 },
+ /* 1747 */ { MAD_F(0x052308e4) /* 0.321053402 */, 16 },
+ /* 1748 */ { MAD_F(0x052409da) /* 0.321298457 */, 16 },
+ /* 1749 */ { MAD_F(0x05250adc) /* 0.321543560 */, 16 },
+ /* 1750 */ { MAD_F(0x05260bea) /* 0.321788709 */, 16 },
+ /* 1751 */ { MAD_F(0x05270d06) /* 0.322033904 */, 16 },
+ /* 1752 */ { MAD_F(0x05280e2d) /* 0.322279147 */, 16 },
+ /* 1753 */ { MAD_F(0x05290f62) /* 0.322524436 */, 16 },
+ /* 1754 */ { MAD_F(0x052a10a3) /* 0.322769771 */, 16 },
+ /* 1755 */ { MAD_F(0x052b11f0) /* 0.323015154 */, 16 },
+ /* 1756 */ { MAD_F(0x052c134a) /* 0.323260583 */, 16 },
+ /* 1757 */ { MAD_F(0x052d14b0) /* 0.323506058 */, 16 },
+ /* 1758 */ { MAD_F(0x052e1623) /* 0.323751580 */, 16 },
+ /* 1759 */ { MAD_F(0x052f17a2) /* 0.323997149 */, 16 },
+
+ /* 1760 */ { MAD_F(0x0530192e) /* 0.324242764 */, 16 },
+ /* 1761 */ { MAD_F(0x05311ac6) /* 0.324488426 */, 16 },
+ /* 1762 */ { MAD_F(0x05321c6b) /* 0.324734134 */, 16 },
+ /* 1763 */ { MAD_F(0x05331e1c) /* 0.324979889 */, 16 },
+ /* 1764 */ { MAD_F(0x05341fda) /* 0.325225690 */, 16 },
+ /* 1765 */ { MAD_F(0x053521a4) /* 0.325471538 */, 16 },
+ /* 1766 */ { MAD_F(0x0536237b) /* 0.325717432 */, 16 },
+ /* 1767 */ { MAD_F(0x0537255e) /* 0.325963372 */, 16 },
+ /* 1768 */ { MAD_F(0x0538274e) /* 0.326209359 */, 16 },
+ /* 1769 */ { MAD_F(0x0539294a) /* 0.326455392 */, 16 },
+ /* 1770 */ { MAD_F(0x053a2b52) /* 0.326701472 */, 16 },
+ /* 1771 */ { MAD_F(0x053b2d67) /* 0.326947598 */, 16 },
+ /* 1772 */ { MAD_F(0x053c2f89) /* 0.327193770 */, 16 },
+ /* 1773 */ { MAD_F(0x053d31b6) /* 0.327439989 */, 16 },
+ /* 1774 */ { MAD_F(0x053e33f1) /* 0.327686254 */, 16 },
+ /* 1775 */ { MAD_F(0x053f3637) /* 0.327932565 */, 16 },
+
+ /* 1776 */ { MAD_F(0x0540388a) /* 0.328178922 */, 16 },
+ /* 1777 */ { MAD_F(0x05413aea) /* 0.328425326 */, 16 },
+ /* 1778 */ { MAD_F(0x05423d56) /* 0.328671776 */, 16 },
+ /* 1779 */ { MAD_F(0x05433fce) /* 0.328918272 */, 16 },
+ /* 1780 */ { MAD_F(0x05444253) /* 0.329164814 */, 16 },
+ /* 1781 */ { MAD_F(0x054544e4) /* 0.329411403 */, 16 },
+ /* 1782 */ { MAD_F(0x05464781) /* 0.329658038 */, 16 },
+ /* 1783 */ { MAD_F(0x05474a2b) /* 0.329904718 */, 16 },
+ /* 1784 */ { MAD_F(0x05484ce2) /* 0.330151445 */, 16 },
+ /* 1785 */ { MAD_F(0x05494fa4) /* 0.330398218 */, 16 },
+ /* 1786 */ { MAD_F(0x054a5273) /* 0.330645037 */, 16 },
+ /* 1787 */ { MAD_F(0x054b554e) /* 0.330891903 */, 16 },
+ /* 1788 */ { MAD_F(0x054c5836) /* 0.331138814 */, 16 },
+ /* 1789 */ { MAD_F(0x054d5b2a) /* 0.331385771 */, 16 },
+ /* 1790 */ { MAD_F(0x054e5e2b) /* 0.331632774 */, 16 },
+ /* 1791 */ { MAD_F(0x054f6138) /* 0.331879824 */, 16 },
+
+ /* 1792 */ { MAD_F(0x05506451) /* 0.332126919 */, 16 },
+ /* 1793 */ { MAD_F(0x05516776) /* 0.332374060 */, 16 },
+ /* 1794 */ { MAD_F(0x05526aa8) /* 0.332621247 */, 16 },
+ /* 1795 */ { MAD_F(0x05536de6) /* 0.332868480 */, 16 },
+ /* 1796 */ { MAD_F(0x05547131) /* 0.333115759 */, 16 },
+ /* 1797 */ { MAD_F(0x05557487) /* 0.333363084 */, 16 },
+ /* 1798 */ { MAD_F(0x055677ea) /* 0.333610455 */, 16 },
+ /* 1799 */ { MAD_F(0x05577b5a) /* 0.333857872 */, 16 },
+ /* 1800 */ { MAD_F(0x05587ed5) /* 0.334105334 */, 16 },
+ /* 1801 */ { MAD_F(0x0559825e) /* 0.334352843 */, 16 },
+ /* 1802 */ { MAD_F(0x055a85f2) /* 0.334600397 */, 16 },
+ /* 1803 */ { MAD_F(0x055b8992) /* 0.334847997 */, 16 },
+ /* 1804 */ { MAD_F(0x055c8d3f) /* 0.335095642 */, 16 },
+ /* 1805 */ { MAD_F(0x055d90f9) /* 0.335343334 */, 16 },
+ /* 1806 */ { MAD_F(0x055e94be) /* 0.335591071 */, 16 },
+ /* 1807 */ { MAD_F(0x055f9890) /* 0.335838854 */, 16 },
+
+ /* 1808 */ { MAD_F(0x05609c6e) /* 0.336086683 */, 16 },
+ /* 1809 */ { MAD_F(0x0561a058) /* 0.336334557 */, 16 },
+ /* 1810 */ { MAD_F(0x0562a44f) /* 0.336582477 */, 16 },
+ /* 1811 */ { MAD_F(0x0563a851) /* 0.336830443 */, 16 },
+ /* 1812 */ { MAD_F(0x0564ac60) /* 0.337078454 */, 16 },
+ /* 1813 */ { MAD_F(0x0565b07c) /* 0.337326511 */, 16 },
+ /* 1814 */ { MAD_F(0x0566b4a3) /* 0.337574614 */, 16 },
+ /* 1815 */ { MAD_F(0x0567b8d7) /* 0.337822762 */, 16 },
+ /* 1816 */ { MAD_F(0x0568bd17) /* 0.338070956 */, 16 },
+ /* 1817 */ { MAD_F(0x0569c163) /* 0.338319195 */, 16 },
+ /* 1818 */ { MAD_F(0x056ac5bc) /* 0.338567480 */, 16 },
+ /* 1819 */ { MAD_F(0x056bca20) /* 0.338815811 */, 16 },
+ /* 1820 */ { MAD_F(0x056cce91) /* 0.339064186 */, 16 },
+ /* 1821 */ { MAD_F(0x056dd30e) /* 0.339312608 */, 16 },
+ /* 1822 */ { MAD_F(0x056ed798) /* 0.339561075 */, 16 },
+ /* 1823 */ { MAD_F(0x056fdc2d) /* 0.339809587 */, 16 },
+
+ /* 1824 */ { MAD_F(0x0570e0cf) /* 0.340058145 */, 16 },
+ /* 1825 */ { MAD_F(0x0571e57d) /* 0.340306748 */, 16 },
+ /* 1826 */ { MAD_F(0x0572ea37) /* 0.340555397 */, 16 },
+ /* 1827 */ { MAD_F(0x0573eefd) /* 0.340804091 */, 16 },
+ /* 1828 */ { MAD_F(0x0574f3d0) /* 0.341052830 */, 16 },
+ /* 1829 */ { MAD_F(0x0575f8ae) /* 0.341301615 */, 16 },
+ /* 1830 */ { MAD_F(0x0576fd99) /* 0.341550445 */, 16 },
+ /* 1831 */ { MAD_F(0x05780290) /* 0.341799321 */, 16 },
+ /* 1832 */ { MAD_F(0x05790793) /* 0.342048241 */, 16 },
+ /* 1833 */ { MAD_F(0x057a0ca3) /* 0.342297207 */, 16 },
+ /* 1834 */ { MAD_F(0x057b11be) /* 0.342546219 */, 16 },
+ /* 1835 */ { MAD_F(0x057c16e6) /* 0.342795275 */, 16 },
+ /* 1836 */ { MAD_F(0x057d1c1a) /* 0.343044377 */, 16 },
+ /* 1837 */ { MAD_F(0x057e2159) /* 0.343293524 */, 16 },
+ /* 1838 */ { MAD_F(0x057f26a6) /* 0.343542717 */, 16 },
+ /* 1839 */ { MAD_F(0x05802bfe) /* 0.343791954 */, 16 },
+
+ /* 1840 */ { MAD_F(0x05813162) /* 0.344041237 */, 16 },
+ /* 1841 */ { MAD_F(0x058236d2) /* 0.344290564 */, 16 },
+ /* 1842 */ { MAD_F(0x05833c4f) /* 0.344539937 */, 16 },
+ /* 1843 */ { MAD_F(0x058441d8) /* 0.344789356 */, 16 },
+ /* 1844 */ { MAD_F(0x0585476c) /* 0.345038819 */, 16 },
+ /* 1845 */ { MAD_F(0x05864d0d) /* 0.345288327 */, 16 },
+ /* 1846 */ { MAD_F(0x058752ba) /* 0.345537880 */, 16 },
+ /* 1847 */ { MAD_F(0x05885873) /* 0.345787479 */, 16 },
+ /* 1848 */ { MAD_F(0x05895e39) /* 0.346037122 */, 16 },
+ /* 1849 */ { MAD_F(0x058a640a) /* 0.346286811 */, 16 },
+ /* 1850 */ { MAD_F(0x058b69e7) /* 0.346536545 */, 16 },
+ /* 1851 */ { MAD_F(0x058c6fd1) /* 0.346786323 */, 16 },
+ /* 1852 */ { MAD_F(0x058d75c6) /* 0.347036147 */, 16 },
+ /* 1853 */ { MAD_F(0x058e7bc8) /* 0.347286015 */, 16 },
+ /* 1854 */ { MAD_F(0x058f81d5) /* 0.347535929 */, 16 },
+ /* 1855 */ { MAD_F(0x059087ef) /* 0.347785887 */, 16 },
+
+ /* 1856 */ { MAD_F(0x05918e15) /* 0.348035890 */, 16 },
+ /* 1857 */ { MAD_F(0x05929447) /* 0.348285939 */, 16 },
+ /* 1858 */ { MAD_F(0x05939a84) /* 0.348536032 */, 16 },
+ /* 1859 */ { MAD_F(0x0594a0ce) /* 0.348786170 */, 16 },
+ /* 1860 */ { MAD_F(0x0595a724) /* 0.349036353 */, 16 },
+ /* 1861 */ { MAD_F(0x0596ad86) /* 0.349286580 */, 16 },
+ /* 1862 */ { MAD_F(0x0597b3f4) /* 0.349536853 */, 16 },
+ /* 1863 */ { MAD_F(0x0598ba6e) /* 0.349787170 */, 16 },
+ /* 1864 */ { MAD_F(0x0599c0f4) /* 0.350037532 */, 16 },
+ /* 1865 */ { MAD_F(0x059ac786) /* 0.350287939 */, 16 },
+ /* 1866 */ { MAD_F(0x059bce25) /* 0.350538391 */, 16 },
+ /* 1867 */ { MAD_F(0x059cd4cf) /* 0.350788887 */, 16 },
+ /* 1868 */ { MAD_F(0x059ddb85) /* 0.351039428 */, 16 },
+ /* 1869 */ { MAD_F(0x059ee247) /* 0.351290014 */, 16 },
+ /* 1870 */ { MAD_F(0x059fe915) /* 0.351540645 */, 16 },
+ /* 1871 */ { MAD_F(0x05a0efef) /* 0.351791320 */, 16 },
+
+ /* 1872 */ { MAD_F(0x05a1f6d5) /* 0.352042040 */, 16 },
+ /* 1873 */ { MAD_F(0x05a2fdc7) /* 0.352292804 */, 16 },
+ /* 1874 */ { MAD_F(0x05a404c5) /* 0.352543613 */, 16 },
+ /* 1875 */ { MAD_F(0x05a50bcf) /* 0.352794467 */, 16 },
+ /* 1876 */ { MAD_F(0x05a612e5) /* 0.353045365 */, 16 },
+ /* 1877 */ { MAD_F(0x05a71a07) /* 0.353296308 */, 16 },
+ /* 1878 */ { MAD_F(0x05a82135) /* 0.353547296 */, 16 },
+ /* 1879 */ { MAD_F(0x05a9286f) /* 0.353798328 */, 16 },
+ /* 1880 */ { MAD_F(0x05aa2fb5) /* 0.354049405 */, 16 },
+ /* 1881 */ { MAD_F(0x05ab3707) /* 0.354300526 */, 16 },
+ /* 1882 */ { MAD_F(0x05ac3e65) /* 0.354551691 */, 16 },
+ /* 1883 */ { MAD_F(0x05ad45ce) /* 0.354802901 */, 16 },
+ /* 1884 */ { MAD_F(0x05ae4d44) /* 0.355054156 */, 16 },
+ /* 1885 */ { MAD_F(0x05af54c6) /* 0.355305455 */, 16 },
+ /* 1886 */ { MAD_F(0x05b05c53) /* 0.355556799 */, 16 },
+ /* 1887 */ { MAD_F(0x05b163ed) /* 0.355808187 */, 16 },
+
+ /* 1888 */ { MAD_F(0x05b26b92) /* 0.356059619 */, 16 },
+ /* 1889 */ { MAD_F(0x05b37343) /* 0.356311096 */, 16 },
+ /* 1890 */ { MAD_F(0x05b47b00) /* 0.356562617 */, 16 },
+ /* 1891 */ { MAD_F(0x05b582c9) /* 0.356814182 */, 16 },
+ /* 1892 */ { MAD_F(0x05b68a9e) /* 0.357065792 */, 16 },
+ /* 1893 */ { MAD_F(0x05b7927f) /* 0.357317446 */, 16 },
+ /* 1894 */ { MAD_F(0x05b89a6c) /* 0.357569145 */, 16 },
+ /* 1895 */ { MAD_F(0x05b9a265) /* 0.357820887 */, 16 },
+ /* 1896 */ { MAD_F(0x05baaa69) /* 0.358072674 */, 16 },
+ /* 1897 */ { MAD_F(0x05bbb27a) /* 0.358324506 */, 16 },
+ /* 1898 */ { MAD_F(0x05bcba96) /* 0.358576381 */, 16 },
+ /* 1899 */ { MAD_F(0x05bdc2be) /* 0.358828301 */, 16 },
+ /* 1900 */ { MAD_F(0x05becaf2) /* 0.359080265 */, 16 },
+ /* 1901 */ { MAD_F(0x05bfd332) /* 0.359332273 */, 16 },
+ /* 1902 */ { MAD_F(0x05c0db7e) /* 0.359584326 */, 16 },
+ /* 1903 */ { MAD_F(0x05c1e3d6) /* 0.359836423 */, 16 },
+
+ /* 1904 */ { MAD_F(0x05c2ec39) /* 0.360088563 */, 16 },
+ /* 1905 */ { MAD_F(0x05c3f4a9) /* 0.360340748 */, 16 },
+ /* 1906 */ { MAD_F(0x05c4fd24) /* 0.360592977 */, 16 },
+ /* 1907 */ { MAD_F(0x05c605ab) /* 0.360845251 */, 16 },
+ /* 1908 */ { MAD_F(0x05c70e3e) /* 0.361097568 */, 16 },
+ /* 1909 */ { MAD_F(0x05c816dd) /* 0.361349929 */, 16 },
+ /* 1910 */ { MAD_F(0x05c91f87) /* 0.361602335 */, 16 },
+ /* 1911 */ { MAD_F(0x05ca283e) /* 0.361854784 */, 16 },
+ /* 1912 */ { MAD_F(0x05cb3100) /* 0.362107278 */, 16 },
+ /* 1913 */ { MAD_F(0x05cc39ce) /* 0.362359815 */, 16 },
+ /* 1914 */ { MAD_F(0x05cd42a8) /* 0.362612397 */, 16 },
+ /* 1915 */ { MAD_F(0x05ce4b8d) /* 0.362865022 */, 16 },
+ /* 1916 */ { MAD_F(0x05cf547f) /* 0.363117692 */, 16 },
+ /* 1917 */ { MAD_F(0x05d05d7c) /* 0.363370405 */, 16 },
+ /* 1918 */ { MAD_F(0x05d16685) /* 0.363623163 */, 16 },
+ /* 1919 */ { MAD_F(0x05d26f9a) /* 0.363875964 */, 16 },
+
+ /* 1920 */ { MAD_F(0x05d378bb) /* 0.364128809 */, 16 },
+ /* 1921 */ { MAD_F(0x05d481e7) /* 0.364381698 */, 16 },
+ /* 1922 */ { MAD_F(0x05d58b1f) /* 0.364634632 */, 16 },
+ /* 1923 */ { MAD_F(0x05d69463) /* 0.364887608 */, 16 },
+ /* 1924 */ { MAD_F(0x05d79db3) /* 0.365140629 */, 16 },
+ /* 1925 */ { MAD_F(0x05d8a70f) /* 0.365393694 */, 16 },
+ /* 1926 */ { MAD_F(0x05d9b076) /* 0.365646802 */, 16 },
+ /* 1927 */ { MAD_F(0x05dab9e9) /* 0.365899955 */, 16 },
+ /* 1928 */ { MAD_F(0x05dbc368) /* 0.366153151 */, 16 },
+ /* 1929 */ { MAD_F(0x05dcccf2) /* 0.366406390 */, 16 },
+ /* 1930 */ { MAD_F(0x05ddd689) /* 0.366659674 */, 16 },
+ /* 1931 */ { MAD_F(0x05dee02b) /* 0.366913001 */, 16 },
+ /* 1932 */ { MAD_F(0x05dfe9d8) /* 0.367166372 */, 16 },
+ /* 1933 */ { MAD_F(0x05e0f392) /* 0.367419787 */, 16 },
+ /* 1934 */ { MAD_F(0x05e1fd57) /* 0.367673246 */, 16 },
+ /* 1935 */ { MAD_F(0x05e30728) /* 0.367926748 */, 16 },
+
+ /* 1936 */ { MAD_F(0x05e41105) /* 0.368180294 */, 16 },
+ /* 1937 */ { MAD_F(0x05e51aed) /* 0.368433883 */, 16 },
+ /* 1938 */ { MAD_F(0x05e624e1) /* 0.368687517 */, 16 },
+ /* 1939 */ { MAD_F(0x05e72ee1) /* 0.368941193 */, 16 },
+ /* 1940 */ { MAD_F(0x05e838ed) /* 0.369194914 */, 16 },
+ /* 1941 */ { MAD_F(0x05e94304) /* 0.369448678 */, 16 },
+ /* 1942 */ { MAD_F(0x05ea4d27) /* 0.369702485 */, 16 },
+ /* 1943 */ { MAD_F(0x05eb5756) /* 0.369956336 */, 16 },
+ /* 1944 */ { MAD_F(0x05ec6190) /* 0.370210231 */, 16 },
+ /* 1945 */ { MAD_F(0x05ed6bd6) /* 0.370464169 */, 16 },
+ /* 1946 */ { MAD_F(0x05ee7628) /* 0.370718151 */, 16 },
+ /* 1947 */ { MAD_F(0x05ef8085) /* 0.370972177 */, 16 },
+ /* 1948 */ { MAD_F(0x05f08aee) /* 0.371226245 */, 16 },
+ /* 1949 */ { MAD_F(0x05f19563) /* 0.371480358 */, 16 },
+ /* 1950 */ { MAD_F(0x05f29fe3) /* 0.371734513 */, 16 },
+ /* 1951 */ { MAD_F(0x05f3aa6f) /* 0.371988712 */, 16 },
+
+ /* 1952 */ { MAD_F(0x05f4b507) /* 0.372242955 */, 16 },
+ /* 1953 */ { MAD_F(0x05f5bfab) /* 0.372497241 */, 16 },
+ /* 1954 */ { MAD_F(0x05f6ca5a) /* 0.372751570 */, 16 },
+ /* 1955 */ { MAD_F(0x05f7d514) /* 0.373005943 */, 16 },
+ /* 1956 */ { MAD_F(0x05f8dfdb) /* 0.373260359 */, 16 },
+ /* 1957 */ { MAD_F(0x05f9eaad) /* 0.373514819 */, 16 },
+ /* 1958 */ { MAD_F(0x05faf58a) /* 0.373769322 */, 16 },
+ /* 1959 */ { MAD_F(0x05fc0073) /* 0.374023868 */, 16 },
+ /* 1960 */ { MAD_F(0x05fd0b68) /* 0.374278458 */, 16 },
+ /* 1961 */ { MAD_F(0x05fe1669) /* 0.374533091 */, 16 },
+ /* 1962 */ { MAD_F(0x05ff2175) /* 0.374787767 */, 16 },
+ /* 1963 */ { MAD_F(0x06002c8d) /* 0.375042486 */, 16 },
+ /* 1964 */ { MAD_F(0x060137b0) /* 0.375297249 */, 16 },
+ /* 1965 */ { MAD_F(0x060242df) /* 0.375552055 */, 16 },
+ /* 1966 */ { MAD_F(0x06034e19) /* 0.375806904 */, 16 },
+ /* 1967 */ { MAD_F(0x0604595f) /* 0.376061796 */, 16 },
+
+ /* 1968 */ { MAD_F(0x060564b1) /* 0.376316732 */, 16 },
+ /* 1969 */ { MAD_F(0x0606700f) /* 0.376571710 */, 16 },
+ /* 1970 */ { MAD_F(0x06077b77) /* 0.376826732 */, 16 },
+ /* 1971 */ { MAD_F(0x060886ec) /* 0.377081797 */, 16 },
+ /* 1972 */ { MAD_F(0x0609926c) /* 0.377336905 */, 16 },
+ /* 1973 */ { MAD_F(0x060a9df8) /* 0.377592057 */, 16 },
+ /* 1974 */ { MAD_F(0x060ba98f) /* 0.377847251 */, 16 },
+ /* 1975 */ { MAD_F(0x060cb532) /* 0.378102489 */, 16 },
+ /* 1976 */ { MAD_F(0x060dc0e0) /* 0.378357769 */, 16 },
+ /* 1977 */ { MAD_F(0x060ecc9a) /* 0.378613093 */, 16 },
+ /* 1978 */ { MAD_F(0x060fd860) /* 0.378868460 */, 16 },
+ /* 1979 */ { MAD_F(0x0610e431) /* 0.379123870 */, 16 },
+ /* 1980 */ { MAD_F(0x0611f00d) /* 0.379379322 */, 16 },
+ /* 1981 */ { MAD_F(0x0612fbf5) /* 0.379634818 */, 16 },
+ /* 1982 */ { MAD_F(0x061407e9) /* 0.379890357 */, 16 },
+ /* 1983 */ { MAD_F(0x061513e8) /* 0.380145939 */, 16 },
+
+ /* 1984 */ { MAD_F(0x06161ff3) /* 0.380401563 */, 16 },
+ /* 1985 */ { MAD_F(0x06172c09) /* 0.380657231 */, 16 },
+ /* 1986 */ { MAD_F(0x0618382b) /* 0.380912942 */, 16 },
+ /* 1987 */ { MAD_F(0x06194458) /* 0.381168695 */, 16 },
+ /* 1988 */ { MAD_F(0x061a5091) /* 0.381424492 */, 16 },
+ /* 1989 */ { MAD_F(0x061b5cd5) /* 0.381680331 */, 16 },
+ /* 1990 */ { MAD_F(0x061c6925) /* 0.381936213 */, 16 },
+ /* 1991 */ { MAD_F(0x061d7581) /* 0.382192138 */, 16 },
+ /* 1992 */ { MAD_F(0x061e81e8) /* 0.382448106 */, 16 },
+ /* 1993 */ { MAD_F(0x061f8e5a) /* 0.382704117 */, 16 },
+ /* 1994 */ { MAD_F(0x06209ad8) /* 0.382960171 */, 16 },
+ /* 1995 */ { MAD_F(0x0621a761) /* 0.383216267 */, 16 },
+ /* 1996 */ { MAD_F(0x0622b3f6) /* 0.383472406 */, 16 },
+ /* 1997 */ { MAD_F(0x0623c096) /* 0.383728588 */, 16 },
+ /* 1998 */ { MAD_F(0x0624cd42) /* 0.383984813 */, 16 },
+ /* 1999 */ { MAD_F(0x0625d9f9) /* 0.384241080 */, 16 },
+
+ /* 2000 */ { MAD_F(0x0626e6bc) /* 0.384497391 */, 16 },
+ /* 2001 */ { MAD_F(0x0627f38a) /* 0.384753744 */, 16 },
+ /* 2002 */ { MAD_F(0x06290064) /* 0.385010139 */, 16 },
+ /* 2003 */ { MAD_F(0x062a0d49) /* 0.385266578 */, 16 },
+ /* 2004 */ { MAD_F(0x062b1a3a) /* 0.385523059 */, 16 },
+ /* 2005 */ { MAD_F(0x062c2736) /* 0.385779582 */, 16 },
+ /* 2006 */ { MAD_F(0x062d343d) /* 0.386036149 */, 16 },
+ /* 2007 */ { MAD_F(0x062e4150) /* 0.386292758 */, 16 },
+ /* 2008 */ { MAD_F(0x062f4e6f) /* 0.386549409 */, 16 },
+ /* 2009 */ { MAD_F(0x06305b99) /* 0.386806104 */, 16 },
+ /* 2010 */ { MAD_F(0x063168ce) /* 0.387062840 */, 16 },
+ /* 2011 */ { MAD_F(0x0632760f) /* 0.387319620 */, 16 },
+ /* 2012 */ { MAD_F(0x0633835b) /* 0.387576442 */, 16 },
+ /* 2013 */ { MAD_F(0x063490b2) /* 0.387833306 */, 16 },
+ /* 2014 */ { MAD_F(0x06359e15) /* 0.388090213 */, 16 },
+ /* 2015 */ { MAD_F(0x0636ab83) /* 0.388347163 */, 16 },
+
+ /* 2016 */ { MAD_F(0x0637b8fd) /* 0.388604155 */, 16 },
+ /* 2017 */ { MAD_F(0x0638c682) /* 0.388861190 */, 16 },
+ /* 2018 */ { MAD_F(0x0639d413) /* 0.389118267 */, 16 },
+ /* 2019 */ { MAD_F(0x063ae1af) /* 0.389375386 */, 16 },
+ /* 2020 */ { MAD_F(0x063bef56) /* 0.389632548 */, 16 },
+ /* 2021 */ { MAD_F(0x063cfd09) /* 0.389889752 */, 16 },
+ /* 2022 */ { MAD_F(0x063e0ac7) /* 0.390146999 */, 16 },
+ /* 2023 */ { MAD_F(0x063f1891) /* 0.390404289 */, 16 },
+ /* 2024 */ { MAD_F(0x06402666) /* 0.390661620 */, 16 },
+ /* 2025 */ { MAD_F(0x06413446) /* 0.390918994 */, 16 },
+ /* 2026 */ { MAD_F(0x06424232) /* 0.391176411 */, 16 },
+ /* 2027 */ { MAD_F(0x06435029) /* 0.391433869 */, 16 },
+ /* 2028 */ { MAD_F(0x06445e2b) /* 0.391691371 */, 16 },
+ /* 2029 */ { MAD_F(0x06456c39) /* 0.391948914 */, 16 },
+ /* 2030 */ { MAD_F(0x06467a52) /* 0.392206500 */, 16 },
+ /* 2031 */ { MAD_F(0x06478877) /* 0.392464128 */, 16 },
+
+ /* 2032 */ { MAD_F(0x064896a7) /* 0.392721798 */, 16 },
+ /* 2033 */ { MAD_F(0x0649a4e2) /* 0.392979511 */, 16 },
+ /* 2034 */ { MAD_F(0x064ab328) /* 0.393237266 */, 16 },
+ /* 2035 */ { MAD_F(0x064bc17a) /* 0.393495063 */, 16 },
+ /* 2036 */ { MAD_F(0x064ccfd8) /* 0.393752902 */, 16 },
+ /* 2037 */ { MAD_F(0x064dde40) /* 0.394010784 */, 16 },
+ /* 2038 */ { MAD_F(0x064eecb4) /* 0.394268707 */, 16 },
+ /* 2039 */ { MAD_F(0x064ffb33) /* 0.394526673 */, 16 },
+ /* 2040 */ { MAD_F(0x065109be) /* 0.394784681 */, 16 },
+ /* 2041 */ { MAD_F(0x06521854) /* 0.395042732 */, 16 },
+ /* 2042 */ { MAD_F(0x065326f5) /* 0.395300824 */, 16 },
+ /* 2043 */ { MAD_F(0x065435a1) /* 0.395558959 */, 16 },
+ /* 2044 */ { MAD_F(0x06554459) /* 0.395817135 */, 16 },
+ /* 2045 */ { MAD_F(0x0656531c) /* 0.396075354 */, 16 },
+ /* 2046 */ { MAD_F(0x065761ea) /* 0.396333615 */, 16 },
+ /* 2047 */ { MAD_F(0x065870c4) /* 0.396591918 */, 16 },
+
+ /* 2048 */ { MAD_F(0x06597fa9) /* 0.396850263 */, 16 },
+ /* 2049 */ { MAD_F(0x065a8e99) /* 0.397108650 */, 16 },
+ /* 2050 */ { MAD_F(0x065b9d95) /* 0.397367079 */, 16 },
+ /* 2051 */ { MAD_F(0x065cac9c) /* 0.397625550 */, 16 },
+ /* 2052 */ { MAD_F(0x065dbbae) /* 0.397884063 */, 16 },
+ /* 2053 */ { MAD_F(0x065ecacb) /* 0.398142619 */, 16 },
+ /* 2054 */ { MAD_F(0x065fd9f4) /* 0.398401216 */, 16 },
+ /* 2055 */ { MAD_F(0x0660e928) /* 0.398659855 */, 16 },
+ /* 2056 */ { MAD_F(0x0661f867) /* 0.398918536 */, 16 },
+ /* 2057 */ { MAD_F(0x066307b1) /* 0.399177259 */, 16 },
+ /* 2058 */ { MAD_F(0x06641707) /* 0.399436024 */, 16 },
+ /* 2059 */ { MAD_F(0x06652668) /* 0.399694831 */, 16 },
+ /* 2060 */ { MAD_F(0x066635d4) /* 0.399953679 */, 16 },
+ /* 2061 */ { MAD_F(0x0667454c) /* 0.400212570 */, 16 },
+ /* 2062 */ { MAD_F(0x066854ce) /* 0.400471503 */, 16 },
+ /* 2063 */ { MAD_F(0x0669645c) /* 0.400730477 */, 16 },
+
+ /* 2064 */ { MAD_F(0x066a73f5) /* 0.400989493 */, 16 },
+ /* 2065 */ { MAD_F(0x066b839a) /* 0.401248551 */, 16 },
+ /* 2066 */ { MAD_F(0x066c9349) /* 0.401507651 */, 16 },
+ /* 2067 */ { MAD_F(0x066da304) /* 0.401766793 */, 16 },
+ /* 2068 */ { MAD_F(0x066eb2ca) /* 0.402025976 */, 16 },
+ /* 2069 */ { MAD_F(0x066fc29b) /* 0.402285202 */, 16 },
+ /* 2070 */ { MAD_F(0x0670d278) /* 0.402544469 */, 16 },
+ /* 2071 */ { MAD_F(0x0671e25f) /* 0.402803777 */, 16 },
+ /* 2072 */ { MAD_F(0x0672f252) /* 0.403063128 */, 16 },
+ /* 2073 */ { MAD_F(0x06740250) /* 0.403322520 */, 16 },
+ /* 2074 */ { MAD_F(0x0675125a) /* 0.403581954 */, 16 },
+ /* 2075 */ { MAD_F(0x0676226e) /* 0.403841430 */, 16 },
+ /* 2076 */ { MAD_F(0x0677328e) /* 0.404100947 */, 16 },
+ /* 2077 */ { MAD_F(0x067842b9) /* 0.404360506 */, 16 },
+ /* 2078 */ { MAD_F(0x067952ef) /* 0.404620107 */, 16 },
+ /* 2079 */ { MAD_F(0x067a6330) /* 0.404879749 */, 16 },
+
+ /* 2080 */ { MAD_F(0x067b737c) /* 0.405139433 */, 16 },
+ /* 2081 */ { MAD_F(0x067c83d4) /* 0.405399159 */, 16 },
+ /* 2082 */ { MAD_F(0x067d9436) /* 0.405658926 */, 16 },
+ /* 2083 */ { MAD_F(0x067ea4a4) /* 0.405918735 */, 16 },
+ /* 2084 */ { MAD_F(0x067fb51d) /* 0.406178585 */, 16 },
+ /* 2085 */ { MAD_F(0x0680c5a2) /* 0.406438477 */, 16 },
+ /* 2086 */ { MAD_F(0x0681d631) /* 0.406698410 */, 16 },
+ /* 2087 */ { MAD_F(0x0682e6cb) /* 0.406958385 */, 16 },
+ /* 2088 */ { MAD_F(0x0683f771) /* 0.407218402 */, 16 },
+ /* 2089 */ { MAD_F(0x06850822) /* 0.407478460 */, 16 },
+ /* 2090 */ { MAD_F(0x068618de) /* 0.407738559 */, 16 },
+ /* 2091 */ { MAD_F(0x068729a5) /* 0.407998700 */, 16 },
+ /* 2092 */ { MAD_F(0x06883a77) /* 0.408258883 */, 16 },
+ /* 2093 */ { MAD_F(0x06894b55) /* 0.408519107 */, 16 },
+ /* 2094 */ { MAD_F(0x068a5c3d) /* 0.408779372 */, 16 },
+ /* 2095 */ { MAD_F(0x068b6d31) /* 0.409039679 */, 16 },
+
+ /* 2096 */ { MAD_F(0x068c7e2f) /* 0.409300027 */, 16 },
+ /* 2097 */ { MAD_F(0x068d8f39) /* 0.409560417 */, 16 },
+ /* 2098 */ { MAD_F(0x068ea04e) /* 0.409820848 */, 16 },
+ /* 2099 */ { MAD_F(0x068fb16e) /* 0.410081321 */, 16 },
+ /* 2100 */ { MAD_F(0x0690c299) /* 0.410341834 */, 16 },
+ /* 2101 */ { MAD_F(0x0691d3cf) /* 0.410602390 */, 16 },
+ /* 2102 */ { MAD_F(0x0692e511) /* 0.410862986 */, 16 },
+ /* 2103 */ { MAD_F(0x0693f65d) /* 0.411123624 */, 16 },
+ /* 2104 */ { MAD_F(0x069507b5) /* 0.411384303 */, 16 },
+ /* 2105 */ { MAD_F(0x06961917) /* 0.411645024 */, 16 },
+ /* 2106 */ { MAD_F(0x06972a85) /* 0.411905785 */, 16 },
+ /* 2107 */ { MAD_F(0x06983bfe) /* 0.412166588 */, 16 },
+ /* 2108 */ { MAD_F(0x06994d82) /* 0.412427433 */, 16 },
+ /* 2109 */ { MAD_F(0x069a5f11) /* 0.412688318 */, 16 },
+ /* 2110 */ { MAD_F(0x069b70ab) /* 0.412949245 */, 16 },
+ /* 2111 */ { MAD_F(0x069c8250) /* 0.413210213 */, 16 },
+
+ /* 2112 */ { MAD_F(0x069d9400) /* 0.413471222 */, 16 },
+ /* 2113 */ { MAD_F(0x069ea5bb) /* 0.413732273 */, 16 },
+ /* 2114 */ { MAD_F(0x069fb781) /* 0.413993364 */, 16 },
+ /* 2115 */ { MAD_F(0x06a0c953) /* 0.414254497 */, 16 },
+ /* 2116 */ { MAD_F(0x06a1db2f) /* 0.414515671 */, 16 },
+ /* 2117 */ { MAD_F(0x06a2ed16) /* 0.414776886 */, 16 },
+ /* 2118 */ { MAD_F(0x06a3ff09) /* 0.415038142 */, 16 },
+ /* 2119 */ { MAD_F(0x06a51106) /* 0.415299440 */, 16 },
+ /* 2120 */ { MAD_F(0x06a6230f) /* 0.415560778 */, 16 },
+ /* 2121 */ { MAD_F(0x06a73522) /* 0.415822157 */, 16 },
+ /* 2122 */ { MAD_F(0x06a84741) /* 0.416083578 */, 16 },
+ /* 2123 */ { MAD_F(0x06a9596a) /* 0.416345040 */, 16 },
+ /* 2124 */ { MAD_F(0x06aa6b9f) /* 0.416606542 */, 16 },
+ /* 2125 */ { MAD_F(0x06ab7ddf) /* 0.416868086 */, 16 },
+ /* 2126 */ { MAD_F(0x06ac9029) /* 0.417129671 */, 16 },
+ /* 2127 */ { MAD_F(0x06ada27f) /* 0.417391297 */, 16 },
+
+ /* 2128 */ { MAD_F(0x06aeb4e0) /* 0.417652964 */, 16 },
+ /* 2129 */ { MAD_F(0x06afc74b) /* 0.417914672 */, 16 },
+ /* 2130 */ { MAD_F(0x06b0d9c2) /* 0.418176420 */, 16 },
+ /* 2131 */ { MAD_F(0x06b1ec43) /* 0.418438210 */, 16 },
+ /* 2132 */ { MAD_F(0x06b2fed0) /* 0.418700041 */, 16 },
+ /* 2133 */ { MAD_F(0x06b41168) /* 0.418961912 */, 16 },
+ /* 2134 */ { MAD_F(0x06b5240a) /* 0.419223825 */, 16 },
+ /* 2135 */ { MAD_F(0x06b636b8) /* 0.419485778 */, 16 },
+ /* 2136 */ { MAD_F(0x06b74971) /* 0.419747773 */, 16 },
+ /* 2137 */ { MAD_F(0x06b85c34) /* 0.420009808 */, 16 },
+ /* 2138 */ { MAD_F(0x06b96f03) /* 0.420271884 */, 16 },
+ /* 2139 */ { MAD_F(0x06ba81dc) /* 0.420534001 */, 16 },
+ /* 2140 */ { MAD_F(0x06bb94c1) /* 0.420796159 */, 16 },
+ /* 2141 */ { MAD_F(0x06bca7b0) /* 0.421058358 */, 16 },
+ /* 2142 */ { MAD_F(0x06bdbaaa) /* 0.421320597 */, 16 },
+ /* 2143 */ { MAD_F(0x06becdb0) /* 0.421582878 */, 16 },
+
+ /* 2144 */ { MAD_F(0x06bfe0c0) /* 0.421845199 */, 16 },
+ /* 2145 */ { MAD_F(0x06c0f3db) /* 0.422107561 */, 16 },
+ /* 2146 */ { MAD_F(0x06c20702) /* 0.422369964 */, 16 },
+ /* 2147 */ { MAD_F(0x06c31a33) /* 0.422632407 */, 16 },
+ /* 2148 */ { MAD_F(0x06c42d6f) /* 0.422894891 */, 16 },
+ /* 2149 */ { MAD_F(0x06c540b6) /* 0.423157416 */, 16 },
+ /* 2150 */ { MAD_F(0x06c65408) /* 0.423419982 */, 16 },
+ /* 2151 */ { MAD_F(0x06c76765) /* 0.423682588 */, 16 },
+ /* 2152 */ { MAD_F(0x06c87acc) /* 0.423945235 */, 16 },
+ /* 2153 */ { MAD_F(0x06c98e3f) /* 0.424207923 */, 16 },
+ /* 2154 */ { MAD_F(0x06caa1bd) /* 0.424470652 */, 16 },
+ /* 2155 */ { MAD_F(0x06cbb545) /* 0.424733421 */, 16 },
+ /* 2156 */ { MAD_F(0x06ccc8d9) /* 0.424996230 */, 16 },
+ /* 2157 */ { MAD_F(0x06cddc77) /* 0.425259081 */, 16 },
+ /* 2158 */ { MAD_F(0x06cef020) /* 0.425521972 */, 16 },
+ /* 2159 */ { MAD_F(0x06d003d4) /* 0.425784903 */, 16 },
+
+ /* 2160 */ { MAD_F(0x06d11794) /* 0.426047876 */, 16 },
+ /* 2161 */ { MAD_F(0x06d22b5e) /* 0.426310889 */, 16 },
+ /* 2162 */ { MAD_F(0x06d33f32) /* 0.426573942 */, 16 },
+ /* 2163 */ { MAD_F(0x06d45312) /* 0.426837036 */, 16 },
+ /* 2164 */ { MAD_F(0x06d566fd) /* 0.427100170 */, 16 },
+ /* 2165 */ { MAD_F(0x06d67af2) /* 0.427363345 */, 16 },
+ /* 2166 */ { MAD_F(0x06d78ef3) /* 0.427626561 */, 16 },
+ /* 2167 */ { MAD_F(0x06d8a2fe) /* 0.427889817 */, 16 },
+ /* 2168 */ { MAD_F(0x06d9b714) /* 0.428153114 */, 16 },
+ /* 2169 */ { MAD_F(0x06dacb35) /* 0.428416451 */, 16 },
+ /* 2170 */ { MAD_F(0x06dbdf61) /* 0.428679828 */, 16 },
+ /* 2171 */ { MAD_F(0x06dcf398) /* 0.428943246 */, 16 },
+ /* 2172 */ { MAD_F(0x06de07d9) /* 0.429206704 */, 16 },
+ /* 2173 */ { MAD_F(0x06df1c26) /* 0.429470203 */, 16 },
+ /* 2174 */ { MAD_F(0x06e0307d) /* 0.429733743 */, 16 },
+ /* 2175 */ { MAD_F(0x06e144df) /* 0.429997322 */, 16 },
+
+ /* 2176 */ { MAD_F(0x06e2594c) /* 0.430260942 */, 16 },
+ /* 2177 */ { MAD_F(0x06e36dc4) /* 0.430524603 */, 16 },
+ /* 2178 */ { MAD_F(0x06e48246) /* 0.430788304 */, 16 },
+ /* 2179 */ { MAD_F(0x06e596d4) /* 0.431052045 */, 16 },
+ /* 2180 */ { MAD_F(0x06e6ab6c) /* 0.431315826 */, 16 },
+ /* 2181 */ { MAD_F(0x06e7c00f) /* 0.431579648 */, 16 },
+ /* 2182 */ { MAD_F(0x06e8d4bd) /* 0.431843511 */, 16 },
+ /* 2183 */ { MAD_F(0x06e9e976) /* 0.432107413 */, 16 },
+ /* 2184 */ { MAD_F(0x06eafe3a) /* 0.432371356 */, 16 },
+ /* 2185 */ { MAD_F(0x06ec1308) /* 0.432635339 */, 16 },
+ /* 2186 */ { MAD_F(0x06ed27e2) /* 0.432899362 */, 16 },
+ /* 2187 */ { MAD_F(0x06ee3cc6) /* 0.433163426 */, 16 },
+ /* 2188 */ { MAD_F(0x06ef51b4) /* 0.433427530 */, 16 },
+ /* 2189 */ { MAD_F(0x06f066ae) /* 0.433691674 */, 16 },
+ /* 2190 */ { MAD_F(0x06f17bb3) /* 0.433955859 */, 16 },
+ /* 2191 */ { MAD_F(0x06f290c2) /* 0.434220083 */, 16 },
+
+ /* 2192 */ { MAD_F(0x06f3a5dc) /* 0.434484348 */, 16 },
+ /* 2193 */ { MAD_F(0x06f4bb01) /* 0.434748653 */, 16 },
+ /* 2194 */ { MAD_F(0x06f5d030) /* 0.435012998 */, 16 },
+ /* 2195 */ { MAD_F(0x06f6e56b) /* 0.435277383 */, 16 },
+ /* 2196 */ { MAD_F(0x06f7fab0) /* 0.435541809 */, 16 },
+ /* 2197 */ { MAD_F(0x06f91000) /* 0.435806274 */, 16 },
+ /* 2198 */ { MAD_F(0x06fa255a) /* 0.436070780 */, 16 },
+ /* 2199 */ { MAD_F(0x06fb3ac0) /* 0.436335326 */, 16 },
+ /* 2200 */ { MAD_F(0x06fc5030) /* 0.436599912 */, 16 },
+ /* 2201 */ { MAD_F(0x06fd65ab) /* 0.436864538 */, 16 },
+ /* 2202 */ { MAD_F(0x06fe7b31) /* 0.437129204 */, 16 },
+ /* 2203 */ { MAD_F(0x06ff90c2) /* 0.437393910 */, 16 },
+ /* 2204 */ { MAD_F(0x0700a65d) /* 0.437658657 */, 16 },
+ /* 2205 */ { MAD_F(0x0701bc03) /* 0.437923443 */, 16 },
+ /* 2206 */ { MAD_F(0x0702d1b4) /* 0.438188269 */, 16 },
+ /* 2207 */ { MAD_F(0x0703e76f) /* 0.438453136 */, 16 },
+
+ /* 2208 */ { MAD_F(0x0704fd35) /* 0.438718042 */, 16 },
+ /* 2209 */ { MAD_F(0x07061306) /* 0.438982988 */, 16 },
+ /* 2210 */ { MAD_F(0x070728e2) /* 0.439247975 */, 16 },
+ /* 2211 */ { MAD_F(0x07083ec9) /* 0.439513001 */, 16 },
+ /* 2212 */ { MAD_F(0x070954ba) /* 0.439778067 */, 16 },
+ /* 2213 */ { MAD_F(0x070a6ab6) /* 0.440043173 */, 16 },
+ /* 2214 */ { MAD_F(0x070b80bc) /* 0.440308320 */, 16 },
+ /* 2215 */ { MAD_F(0x070c96ce) /* 0.440573506 */, 16 },
+ /* 2216 */ { MAD_F(0x070dacea) /* 0.440838732 */, 16 },
+ /* 2217 */ { MAD_F(0x070ec310) /* 0.441103997 */, 16 },
+ /* 2218 */ { MAD_F(0x070fd942) /* 0.441369303 */, 16 },
+ /* 2219 */ { MAD_F(0x0710ef7e) /* 0.441634649 */, 16 },
+ /* 2220 */ { MAD_F(0x071205c5) /* 0.441900034 */, 16 },
+ /* 2221 */ { MAD_F(0x07131c17) /* 0.442165460 */, 16 },
+ /* 2222 */ { MAD_F(0x07143273) /* 0.442430925 */, 16 },
+ /* 2223 */ { MAD_F(0x071548da) /* 0.442696430 */, 16 },
+
+ /* 2224 */ { MAD_F(0x07165f4b) /* 0.442961975 */, 16 },
+ /* 2225 */ { MAD_F(0x071775c8) /* 0.443227559 */, 16 },
+ /* 2226 */ { MAD_F(0x07188c4f) /* 0.443493184 */, 16 },
+ /* 2227 */ { MAD_F(0x0719a2e0) /* 0.443758848 */, 16 },
+ /* 2228 */ { MAD_F(0x071ab97d) /* 0.444024552 */, 16 },
+ /* 2229 */ { MAD_F(0x071bd024) /* 0.444290296 */, 16 },
+ /* 2230 */ { MAD_F(0x071ce6d6) /* 0.444556079 */, 16 },
+ /* 2231 */ { MAD_F(0x071dfd92) /* 0.444821902 */, 16 },
+ /* 2232 */ { MAD_F(0x071f1459) /* 0.445087765 */, 16 },
+ /* 2233 */ { MAD_F(0x07202b2b) /* 0.445353668 */, 16 },
+ /* 2234 */ { MAD_F(0x07214207) /* 0.445619610 */, 16 },
+ /* 2235 */ { MAD_F(0x072258ee) /* 0.445885592 */, 16 },
+ /* 2236 */ { MAD_F(0x07236fe0) /* 0.446151614 */, 16 },
+ /* 2237 */ { MAD_F(0x072486dc) /* 0.446417675 */, 16 },
+ /* 2238 */ { MAD_F(0x07259de3) /* 0.446683776 */, 16 },
+ /* 2239 */ { MAD_F(0x0726b4f4) /* 0.446949917 */, 16 },
+
+ /* 2240 */ { MAD_F(0x0727cc11) /* 0.447216097 */, 16 },
+ /* 2241 */ { MAD_F(0x0728e338) /* 0.447482317 */, 16 },
+ /* 2242 */ { MAD_F(0x0729fa69) /* 0.447748576 */, 16 },
+ /* 2243 */ { MAD_F(0x072b11a5) /* 0.448014875 */, 16 },
+ /* 2244 */ { MAD_F(0x072c28ec) /* 0.448281214 */, 16 },
+ /* 2245 */ { MAD_F(0x072d403d) /* 0.448547592 */, 16 },
+ /* 2246 */ { MAD_F(0x072e5799) /* 0.448814010 */, 16 },
+ /* 2247 */ { MAD_F(0x072f6f00) /* 0.449080467 */, 16 },
+ /* 2248 */ { MAD_F(0x07308671) /* 0.449346964 */, 16 },
+ /* 2249 */ { MAD_F(0x07319ded) /* 0.449613501 */, 16 },
+ /* 2250 */ { MAD_F(0x0732b573) /* 0.449880076 */, 16 },
+ /* 2251 */ { MAD_F(0x0733cd04) /* 0.450146692 */, 16 },
+ /* 2252 */ { MAD_F(0x0734e4a0) /* 0.450413347 */, 16 },
+ /* 2253 */ { MAD_F(0x0735fc46) /* 0.450680041 */, 16 },
+ /* 2254 */ { MAD_F(0x073713f7) /* 0.450946775 */, 16 },
+ /* 2255 */ { MAD_F(0x07382bb2) /* 0.451213548 */, 16 },
+
+ /* 2256 */ { MAD_F(0x07394378) /* 0.451480360 */, 16 },
+ /* 2257 */ { MAD_F(0x073a5b49) /* 0.451747213 */, 16 },
+ /* 2258 */ { MAD_F(0x073b7324) /* 0.452014104 */, 16 },
+ /* 2259 */ { MAD_F(0x073c8b0a) /* 0.452281035 */, 16 },
+ /* 2260 */ { MAD_F(0x073da2fa) /* 0.452548005 */, 16 },
+ /* 2261 */ { MAD_F(0x073ebaf5) /* 0.452815015 */, 16 },
+ /* 2262 */ { MAD_F(0x073fd2fa) /* 0.453082064 */, 16 },
+ /* 2263 */ { MAD_F(0x0740eb0a) /* 0.453349152 */, 16 },
+ /* 2264 */ { MAD_F(0x07420325) /* 0.453616280 */, 16 },
+ /* 2265 */ { MAD_F(0x07431b4a) /* 0.453883447 */, 16 },
+ /* 2266 */ { MAD_F(0x0744337a) /* 0.454150653 */, 16 },
+ /* 2267 */ { MAD_F(0x07454bb4) /* 0.454417899 */, 16 },
+ /* 2268 */ { MAD_F(0x074663f8) /* 0.454685184 */, 16 },
+ /* 2269 */ { MAD_F(0x07477c48) /* 0.454952508 */, 16 },
+ /* 2270 */ { MAD_F(0x074894a2) /* 0.455219872 */, 16 },
+ /* 2271 */ { MAD_F(0x0749ad06) /* 0.455487275 */, 16 },
+
+ /* 2272 */ { MAD_F(0x074ac575) /* 0.455754717 */, 16 },
+ /* 2273 */ { MAD_F(0x074bddee) /* 0.456022198 */, 16 },
+ /* 2274 */ { MAD_F(0x074cf672) /* 0.456289719 */, 16 },
+ /* 2275 */ { MAD_F(0x074e0f01) /* 0.456557278 */, 16 },
+ /* 2276 */ { MAD_F(0x074f279a) /* 0.456824877 */, 16 },
+ /* 2277 */ { MAD_F(0x0750403e) /* 0.457092516 */, 16 },
+ /* 2278 */ { MAD_F(0x075158ec) /* 0.457360193 */, 16 },
+ /* 2279 */ { MAD_F(0x075271a4) /* 0.457627909 */, 16 },
+ /* 2280 */ { MAD_F(0x07538a67) /* 0.457895665 */, 16 },
+ /* 2281 */ { MAD_F(0x0754a335) /* 0.458163460 */, 16 },
+ /* 2282 */ { MAD_F(0x0755bc0d) /* 0.458431294 */, 16 },
+ /* 2283 */ { MAD_F(0x0756d4f0) /* 0.458699167 */, 16 },
+ /* 2284 */ { MAD_F(0x0757eddd) /* 0.458967079 */, 16 },
+ /* 2285 */ { MAD_F(0x075906d5) /* 0.459235030 */, 16 },
+ /* 2286 */ { MAD_F(0x075a1fd7) /* 0.459503021 */, 16 },
+ /* 2287 */ { MAD_F(0x075b38e3) /* 0.459771050 */, 16 },
+
+ /* 2288 */ { MAD_F(0x075c51fa) /* 0.460039119 */, 16 },
+ /* 2289 */ { MAD_F(0x075d6b1c) /* 0.460307226 */, 16 },
+ /* 2290 */ { MAD_F(0x075e8448) /* 0.460575373 */, 16 },
+ /* 2291 */ { MAD_F(0x075f9d7f) /* 0.460843559 */, 16 },
+ /* 2292 */ { MAD_F(0x0760b6c0) /* 0.461111783 */, 16 },
+ /* 2293 */ { MAD_F(0x0761d00b) /* 0.461380047 */, 16 },
+ /* 2294 */ { MAD_F(0x0762e961) /* 0.461648350 */, 16 },
+ /* 2295 */ { MAD_F(0x076402c1) /* 0.461916691 */, 16 },
+ /* 2296 */ { MAD_F(0x07651c2c) /* 0.462185072 */, 16 },
+ /* 2297 */ { MAD_F(0x076635a2) /* 0.462453492 */, 16 },
+ /* 2298 */ { MAD_F(0x07674f22) /* 0.462721950 */, 16 },
+ /* 2299 */ { MAD_F(0x076868ac) /* 0.462990448 */, 16 },
+ /* 2300 */ { MAD_F(0x07698240) /* 0.463258984 */, 16 },
+ /* 2301 */ { MAD_F(0x076a9be0) /* 0.463527560 */, 16 },
+ /* 2302 */ { MAD_F(0x076bb589) /* 0.463796174 */, 16 },
+ /* 2303 */ { MAD_F(0x076ccf3d) /* 0.464064827 */, 16 },
+
+ /* 2304 */ { MAD_F(0x076de8fc) /* 0.464333519 */, 16 },
+ /* 2305 */ { MAD_F(0x076f02c5) /* 0.464602250 */, 16 },
+ /* 2306 */ { MAD_F(0x07701c98) /* 0.464871020 */, 16 },
+ /* 2307 */ { MAD_F(0x07713676) /* 0.465139829 */, 16 },
+ /* 2308 */ { MAD_F(0x0772505e) /* 0.465408676 */, 16 },
+ /* 2309 */ { MAD_F(0x07736a51) /* 0.465677563 */, 16 },
+ /* 2310 */ { MAD_F(0x0774844e) /* 0.465946488 */, 16 },
+ /* 2311 */ { MAD_F(0x07759e55) /* 0.466215452 */, 16 },
+ /* 2312 */ { MAD_F(0x0776b867) /* 0.466484455 */, 16 },
+ /* 2313 */ { MAD_F(0x0777d283) /* 0.466753496 */, 16 },
+ /* 2314 */ { MAD_F(0x0778ecaa) /* 0.467022577 */, 16 },
+ /* 2315 */ { MAD_F(0x077a06db) /* 0.467291696 */, 16 },
+ /* 2316 */ { MAD_F(0x077b2117) /* 0.467560854 */, 16 },
+ /* 2317 */ { MAD_F(0x077c3b5d) /* 0.467830050 */, 16 },
+ /* 2318 */ { MAD_F(0x077d55ad) /* 0.468099285 */, 16 },
+ /* 2319 */ { MAD_F(0x077e7008) /* 0.468368560 */, 16 },
+
+ /* 2320 */ { MAD_F(0x077f8a6d) /* 0.468637872 */, 16 },
+ /* 2321 */ { MAD_F(0x0780a4dc) /* 0.468907224 */, 16 },
+ /* 2322 */ { MAD_F(0x0781bf56) /* 0.469176614 */, 16 },
+ /* 2323 */ { MAD_F(0x0782d9da) /* 0.469446043 */, 16 },
+ /* 2324 */ { MAD_F(0x0783f469) /* 0.469715510 */, 16 },
+ /* 2325 */ { MAD_F(0x07850f02) /* 0.469985016 */, 16 },
+ /* 2326 */ { MAD_F(0x078629a5) /* 0.470254561 */, 16 },
+ /* 2327 */ { MAD_F(0x07874453) /* 0.470524145 */, 16 },
+ /* 2328 */ { MAD_F(0x07885f0b) /* 0.470793767 */, 16 },
+ /* 2329 */ { MAD_F(0x078979ce) /* 0.471063427 */, 16 },
+ /* 2330 */ { MAD_F(0x078a949a) /* 0.471333126 */, 16 },
+ /* 2331 */ { MAD_F(0x078baf72) /* 0.471602864 */, 16 },
+ /* 2332 */ { MAD_F(0x078cca53) /* 0.471872641 */, 16 },
+ /* 2333 */ { MAD_F(0x078de53f) /* 0.472142456 */, 16 },
+ /* 2334 */ { MAD_F(0x078f0035) /* 0.472412309 */, 16 },
+ /* 2335 */ { MAD_F(0x07901b36) /* 0.472682201 */, 16 },
+
+ /* 2336 */ { MAD_F(0x07913641) /* 0.472952132 */, 16 },
+ /* 2337 */ { MAD_F(0x07925156) /* 0.473222101 */, 16 },
+ /* 2338 */ { MAD_F(0x07936c76) /* 0.473492108 */, 16 },
+ /* 2339 */ { MAD_F(0x079487a0) /* 0.473762155 */, 16 },
+ /* 2340 */ { MAD_F(0x0795a2d4) /* 0.474032239 */, 16 },
+ /* 2341 */ { MAD_F(0x0796be13) /* 0.474302362 */, 16 },
+ /* 2342 */ { MAD_F(0x0797d95c) /* 0.474572524 */, 16 },
+ /* 2343 */ { MAD_F(0x0798f4af) /* 0.474842724 */, 16 },
+ /* 2344 */ { MAD_F(0x079a100c) /* 0.475112962 */, 16 },
+ /* 2345 */ { MAD_F(0x079b2b74) /* 0.475383239 */, 16 },
+ /* 2346 */ { MAD_F(0x079c46e7) /* 0.475653554 */, 16 },
+ /* 2347 */ { MAD_F(0x079d6263) /* 0.475923908 */, 16 },
+ /* 2348 */ { MAD_F(0x079e7dea) /* 0.476194300 */, 16 },
+ /* 2349 */ { MAD_F(0x079f997b) /* 0.476464731 */, 16 },
+ /* 2350 */ { MAD_F(0x07a0b516) /* 0.476735200 */, 16 },
+ /* 2351 */ { MAD_F(0x07a1d0bc) /* 0.477005707 */, 16 },
+
+ /* 2352 */ { MAD_F(0x07a2ec6c) /* 0.477276252 */, 16 },
+ /* 2353 */ { MAD_F(0x07a40827) /* 0.477546836 */, 16 },
+ /* 2354 */ { MAD_F(0x07a523eb) /* 0.477817459 */, 16 },
+ /* 2355 */ { MAD_F(0x07a63fba) /* 0.478088119 */, 16 },
+ /* 2356 */ { MAD_F(0x07a75b93) /* 0.478358818 */, 16 },
+ /* 2357 */ { MAD_F(0x07a87777) /* 0.478629555 */, 16 },
+ /* 2358 */ { MAD_F(0x07a99364) /* 0.478900331 */, 16 },
+ /* 2359 */ { MAD_F(0x07aaaf5c) /* 0.479171145 */, 16 },
+ /* 2360 */ { MAD_F(0x07abcb5f) /* 0.479441997 */, 16 },
+ /* 2361 */ { MAD_F(0x07ace76b) /* 0.479712887 */, 16 },
+ /* 2362 */ { MAD_F(0x07ae0382) /* 0.479983816 */, 16 },
+ /* 2363 */ { MAD_F(0x07af1fa3) /* 0.480254782 */, 16 },
+ /* 2364 */ { MAD_F(0x07b03bcf) /* 0.480525787 */, 16 },
+ /* 2365 */ { MAD_F(0x07b15804) /* 0.480796831 */, 16 },
+ /* 2366 */ { MAD_F(0x07b27444) /* 0.481067912 */, 16 },
+ /* 2367 */ { MAD_F(0x07b3908e) /* 0.481339032 */, 16 },
+
+ /* 2368 */ { MAD_F(0x07b4ace3) /* 0.481610189 */, 16 },
+ /* 2369 */ { MAD_F(0x07b5c941) /* 0.481881385 */, 16 },
+ /* 2370 */ { MAD_F(0x07b6e5aa) /* 0.482152620 */, 16 },
+ /* 2371 */ { MAD_F(0x07b8021d) /* 0.482423892 */, 16 },
+ /* 2372 */ { MAD_F(0x07b91e9b) /* 0.482695202 */, 16 },
+ /* 2373 */ { MAD_F(0x07ba3b22) /* 0.482966551 */, 16 },
+ /* 2374 */ { MAD_F(0x07bb57b4) /* 0.483237938 */, 16 },
+ /* 2375 */ { MAD_F(0x07bc7450) /* 0.483509362 */, 16 },
+ /* 2376 */ { MAD_F(0x07bd90f6) /* 0.483780825 */, 16 },
+ /* 2377 */ { MAD_F(0x07beada7) /* 0.484052326 */, 16 },
+ /* 2378 */ { MAD_F(0x07bfca61) /* 0.484323865 */, 16 },
+ /* 2379 */ { MAD_F(0x07c0e726) /* 0.484595443 */, 16 },
+ /* 2380 */ { MAD_F(0x07c203f5) /* 0.484867058 */, 16 },
+ /* 2381 */ { MAD_F(0x07c320cf) /* 0.485138711 */, 16 },
+ /* 2382 */ { MAD_F(0x07c43db2) /* 0.485410402 */, 16 },
+ /* 2383 */ { MAD_F(0x07c55aa0) /* 0.485682131 */, 16 },
+
+ /* 2384 */ { MAD_F(0x07c67798) /* 0.485953899 */, 16 },
+ /* 2385 */ { MAD_F(0x07c7949a) /* 0.486225704 */, 16 },
+ /* 2386 */ { MAD_F(0x07c8b1a7) /* 0.486497547 */, 16 },
+ /* 2387 */ { MAD_F(0x07c9cebd) /* 0.486769429 */, 16 },
+ /* 2388 */ { MAD_F(0x07caebde) /* 0.487041348 */, 16 },
+ /* 2389 */ { MAD_F(0x07cc0909) /* 0.487313305 */, 16 },
+ /* 2390 */ { MAD_F(0x07cd263e) /* 0.487585300 */, 16 },
+ /* 2391 */ { MAD_F(0x07ce437d) /* 0.487857333 */, 16 },
+ /* 2392 */ { MAD_F(0x07cf60c7) /* 0.488129404 */, 16 },
+ /* 2393 */ { MAD_F(0x07d07e1b) /* 0.488401513 */, 16 },
+ /* 2394 */ { MAD_F(0x07d19b79) /* 0.488673660 */, 16 },
+ /* 2395 */ { MAD_F(0x07d2b8e1) /* 0.488945845 */, 16 },
+ /* 2396 */ { MAD_F(0x07d3d653) /* 0.489218067 */, 16 },
+ /* 2397 */ { MAD_F(0x07d4f3cf) /* 0.489490328 */, 16 },
+ /* 2398 */ { MAD_F(0x07d61156) /* 0.489762626 */, 16 },
+ /* 2399 */ { MAD_F(0x07d72ee6) /* 0.490034962 */, 16 },
+
+ /* 2400 */ { MAD_F(0x07d84c81) /* 0.490307336 */, 16 },
+ /* 2401 */ { MAD_F(0x07d96a26) /* 0.490579748 */, 16 },
+ /* 2402 */ { MAD_F(0x07da87d5) /* 0.490852198 */, 16 },
+ /* 2403 */ { MAD_F(0x07dba58f) /* 0.491124686 */, 16 },
+ /* 2404 */ { MAD_F(0x07dcc352) /* 0.491397211 */, 16 },
+ /* 2405 */ { MAD_F(0x07dde120) /* 0.491669774 */, 16 },
+ /* 2406 */ { MAD_F(0x07defef7) /* 0.491942375 */, 16 },
+ /* 2407 */ { MAD_F(0x07e01cd9) /* 0.492215014 */, 16 },
+ /* 2408 */ { MAD_F(0x07e13ac5) /* 0.492487690 */, 16 },
+ /* 2409 */ { MAD_F(0x07e258bc) /* 0.492760404 */, 16 },
+ /* 2410 */ { MAD_F(0x07e376bc) /* 0.493033156 */, 16 },
+ /* 2411 */ { MAD_F(0x07e494c6) /* 0.493305946 */, 16 },
+ /* 2412 */ { MAD_F(0x07e5b2db) /* 0.493578773 */, 16 },
+ /* 2413 */ { MAD_F(0x07e6d0f9) /* 0.493851638 */, 16 },
+ /* 2414 */ { MAD_F(0x07e7ef22) /* 0.494124541 */, 16 },
+ /* 2415 */ { MAD_F(0x07e90d55) /* 0.494397481 */, 16 },
+
+ /* 2416 */ { MAD_F(0x07ea2b92) /* 0.494670459 */, 16 },
+ /* 2417 */ { MAD_F(0x07eb49d9) /* 0.494943475 */, 16 },
+ /* 2418 */ { MAD_F(0x07ec682a) /* 0.495216529 */, 16 },
+ /* 2419 */ { MAD_F(0x07ed8686) /* 0.495489620 */, 16 },
+ /* 2420 */ { MAD_F(0x07eea4eb) /* 0.495762748 */, 16 },
+ /* 2421 */ { MAD_F(0x07efc35b) /* 0.496035915 */, 16 },
+ /* 2422 */ { MAD_F(0x07f0e1d4) /* 0.496309119 */, 16 },
+ /* 2423 */ { MAD_F(0x07f20058) /* 0.496582360 */, 16 },
+ /* 2424 */ { MAD_F(0x07f31ee6) /* 0.496855639 */, 16 },
+ /* 2425 */ { MAD_F(0x07f43d7e) /* 0.497128956 */, 16 },
+ /* 2426 */ { MAD_F(0x07f55c20) /* 0.497402310 */, 16 },
+ /* 2427 */ { MAD_F(0x07f67acc) /* 0.497675702 */, 16 },
+ /* 2428 */ { MAD_F(0x07f79982) /* 0.497949132 */, 16 },
+ /* 2429 */ { MAD_F(0x07f8b842) /* 0.498222598 */, 16 },
+ /* 2430 */ { MAD_F(0x07f9d70c) /* 0.498496103 */, 16 },
+ /* 2431 */ { MAD_F(0x07faf5e1) /* 0.498769645 */, 16 },
+
+ /* 2432 */ { MAD_F(0x07fc14bf) /* 0.499043224 */, 16 },
+ /* 2433 */ { MAD_F(0x07fd33a8) /* 0.499316841 */, 16 },
+ /* 2434 */ { MAD_F(0x07fe529a) /* 0.499590496 */, 16 },
+ /* 2435 */ { MAD_F(0x07ff7197) /* 0.499864188 */, 16 },
+ /* 2436 */ { MAD_F(0x0400484f) /* 0.250068959 */, 17 },
+ /* 2437 */ { MAD_F(0x0400d7d7) /* 0.250205842 */, 17 },
+ /* 2438 */ { MAD_F(0x04016764) /* 0.250342744 */, 17 },
+ /* 2439 */ { MAD_F(0x0401f6f7) /* 0.250479665 */, 17 },
+ /* 2440 */ { MAD_F(0x0402868e) /* 0.250616605 */, 17 },
+ /* 2441 */ { MAD_F(0x0403162b) /* 0.250753563 */, 17 },
+ /* 2442 */ { MAD_F(0x0403a5cc) /* 0.250890540 */, 17 },
+ /* 2443 */ { MAD_F(0x04043573) /* 0.251027536 */, 17 },
+ /* 2444 */ { MAD_F(0x0404c51e) /* 0.251164550 */, 17 },
+ /* 2445 */ { MAD_F(0x040554cf) /* 0.251301583 */, 17 },
+ /* 2446 */ { MAD_F(0x0405e484) /* 0.251438635 */, 17 },
+ /* 2447 */ { MAD_F(0x0406743f) /* 0.251575706 */, 17 },
+
+ /* 2448 */ { MAD_F(0x040703ff) /* 0.251712795 */, 17 },
+ /* 2449 */ { MAD_F(0x040793c3) /* 0.251849903 */, 17 },
+ /* 2450 */ { MAD_F(0x0408238d) /* 0.251987029 */, 17 },
+ /* 2451 */ { MAD_F(0x0408b35b) /* 0.252124174 */, 17 },
+ /* 2452 */ { MAD_F(0x0409432f) /* 0.252261338 */, 17 },
+ /* 2453 */ { MAD_F(0x0409d308) /* 0.252398520 */, 17 },
+ /* 2454 */ { MAD_F(0x040a62e5) /* 0.252535721 */, 17 },
+ /* 2455 */ { MAD_F(0x040af2c8) /* 0.252672941 */, 17 },
+ /* 2456 */ { MAD_F(0x040b82b0) /* 0.252810180 */, 17 },
+ /* 2457 */ { MAD_F(0x040c129c) /* 0.252947436 */, 17 },
+ /* 2458 */ { MAD_F(0x040ca28e) /* 0.253084712 */, 17 },
+ /* 2459 */ { MAD_F(0x040d3284) /* 0.253222006 */, 17 },
+ /* 2460 */ { MAD_F(0x040dc280) /* 0.253359319 */, 17 },
+ /* 2461 */ { MAD_F(0x040e5281) /* 0.253496651 */, 17 },
+ /* 2462 */ { MAD_F(0x040ee286) /* 0.253634001 */, 17 },
+ /* 2463 */ { MAD_F(0x040f7291) /* 0.253771369 */, 17 },
+
+ /* 2464 */ { MAD_F(0x041002a1) /* 0.253908756 */, 17 },
+ /* 2465 */ { MAD_F(0x041092b5) /* 0.254046162 */, 17 },
+ /* 2466 */ { MAD_F(0x041122cf) /* 0.254183587 */, 17 },
+ /* 2467 */ { MAD_F(0x0411b2ed) /* 0.254321030 */, 17 },
+ /* 2468 */ { MAD_F(0x04124311) /* 0.254458491 */, 17 },
+ /* 2469 */ { MAD_F(0x0412d339) /* 0.254595971 */, 17 },
+ /* 2470 */ { MAD_F(0x04136367) /* 0.254733470 */, 17 },
+ /* 2471 */ { MAD_F(0x0413f399) /* 0.254870987 */, 17 },
+ /* 2472 */ { MAD_F(0x041483d1) /* 0.255008523 */, 17 },
+ /* 2473 */ { MAD_F(0x0415140d) /* 0.255146077 */, 17 },
+ /* 2474 */ { MAD_F(0x0415a44f) /* 0.255283650 */, 17 },
+ /* 2475 */ { MAD_F(0x04163495) /* 0.255421241 */, 17 },
+ /* 2476 */ { MAD_F(0x0416c4e1) /* 0.255558851 */, 17 },
+ /* 2477 */ { MAD_F(0x04175531) /* 0.255696480 */, 17 },
+ /* 2478 */ { MAD_F(0x0417e586) /* 0.255834127 */, 17 },
+ /* 2479 */ { MAD_F(0x041875e1) /* 0.255971792 */, 17 },
+
+ /* 2480 */ { MAD_F(0x04190640) /* 0.256109476 */, 17 },
+ /* 2481 */ { MAD_F(0x041996a4) /* 0.256247179 */, 17 },
+ /* 2482 */ { MAD_F(0x041a270d) /* 0.256384900 */, 17 },
+ /* 2483 */ { MAD_F(0x041ab77b) /* 0.256522639 */, 17 },
+ /* 2484 */ { MAD_F(0x041b47ef) /* 0.256660397 */, 17 },
+ /* 2485 */ { MAD_F(0x041bd867) /* 0.256798174 */, 17 },
+ /* 2486 */ { MAD_F(0x041c68e4) /* 0.256935969 */, 17 },
+ /* 2487 */ { MAD_F(0x041cf966) /* 0.257073782 */, 17 },
+ /* 2488 */ { MAD_F(0x041d89ed) /* 0.257211614 */, 17 },
+ /* 2489 */ { MAD_F(0x041e1a79) /* 0.257349465 */, 17 },
+ /* 2490 */ { MAD_F(0x041eab0a) /* 0.257487334 */, 17 },
+ /* 2491 */ { MAD_F(0x041f3b9f) /* 0.257625221 */, 17 },
+ /* 2492 */ { MAD_F(0x041fcc3a) /* 0.257763127 */, 17 },
+ /* 2493 */ { MAD_F(0x04205cda) /* 0.257901051 */, 17 },
+ /* 2494 */ { MAD_F(0x0420ed7f) /* 0.258038994 */, 17 },
+ /* 2495 */ { MAD_F(0x04217e28) /* 0.258176955 */, 17 },
+
+ /* 2496 */ { MAD_F(0x04220ed7) /* 0.258314934 */, 17 },
+ /* 2497 */ { MAD_F(0x04229f8a) /* 0.258452932 */, 17 },
+ /* 2498 */ { MAD_F(0x04233043) /* 0.258590948 */, 17 },
+ /* 2499 */ { MAD_F(0x0423c100) /* 0.258728983 */, 17 },
+ /* 2500 */ { MAD_F(0x042451c3) /* 0.258867036 */, 17 },
+ /* 2501 */ { MAD_F(0x0424e28a) /* 0.259005108 */, 17 },
+ /* 2502 */ { MAD_F(0x04257356) /* 0.259143198 */, 17 },
+ /* 2503 */ { MAD_F(0x04260428) /* 0.259281307 */, 17 },
+ /* 2504 */ { MAD_F(0x042694fe) /* 0.259419433 */, 17 },
+ /* 2505 */ { MAD_F(0x042725d9) /* 0.259557579 */, 17 },
+ /* 2506 */ { MAD_F(0x0427b6b9) /* 0.259695742 */, 17 },
+ /* 2507 */ { MAD_F(0x0428479e) /* 0.259833924 */, 17 },
+ /* 2508 */ { MAD_F(0x0428d888) /* 0.259972124 */, 17 },
+ /* 2509 */ { MAD_F(0x04296976) /* 0.260110343 */, 17 },
+ /* 2510 */ { MAD_F(0x0429fa6a) /* 0.260248580 */, 17 },
+ /* 2511 */ { MAD_F(0x042a8b63) /* 0.260386836 */, 17 },
+
+ /* 2512 */ { MAD_F(0x042b1c60) /* 0.260525110 */, 17 },
+ /* 2513 */ { MAD_F(0x042bad63) /* 0.260663402 */, 17 },
+ /* 2514 */ { MAD_F(0x042c3e6a) /* 0.260801712 */, 17 },
+ /* 2515 */ { MAD_F(0x042ccf77) /* 0.260940041 */, 17 },
+ /* 2516 */ { MAD_F(0x042d6088) /* 0.261078388 */, 17 },
+ /* 2517 */ { MAD_F(0x042df19e) /* 0.261216754 */, 17 },
+ /* 2518 */ { MAD_F(0x042e82b9) /* 0.261355137 */, 17 },
+ /* 2519 */ { MAD_F(0x042f13d9) /* 0.261493540 */, 17 },
+ /* 2520 */ { MAD_F(0x042fa4fe) /* 0.261631960 */, 17 },
+ /* 2521 */ { MAD_F(0x04303628) /* 0.261770399 */, 17 },
+ /* 2522 */ { MAD_F(0x0430c757) /* 0.261908856 */, 17 },
+ /* 2523 */ { MAD_F(0x0431588b) /* 0.262047331 */, 17 },
+ /* 2524 */ { MAD_F(0x0431e9c3) /* 0.262185825 */, 17 },
+ /* 2525 */ { MAD_F(0x04327b01) /* 0.262324337 */, 17 },
+ /* 2526 */ { MAD_F(0x04330c43) /* 0.262462867 */, 17 },
+ /* 2527 */ { MAD_F(0x04339d8a) /* 0.262601416 */, 17 },
+
+ /* 2528 */ { MAD_F(0x04342ed7) /* 0.262739982 */, 17 },
+ /* 2529 */ { MAD_F(0x0434c028) /* 0.262878568 */, 17 },
+ /* 2530 */ { MAD_F(0x0435517e) /* 0.263017171 */, 17 },
+ /* 2531 */ { MAD_F(0x0435e2d9) /* 0.263155792 */, 17 },
+ /* 2532 */ { MAD_F(0x04367439) /* 0.263294432 */, 17 },
+ /* 2533 */ { MAD_F(0x0437059e) /* 0.263433090 */, 17 },
+ /* 2534 */ { MAD_F(0x04379707) /* 0.263571767 */, 17 },
+ /* 2535 */ { MAD_F(0x04382876) /* 0.263710461 */, 17 },
+ /* 2536 */ { MAD_F(0x0438b9e9) /* 0.263849174 */, 17 },
+ /* 2537 */ { MAD_F(0x04394b61) /* 0.263987905 */, 17 },
+ /* 2538 */ { MAD_F(0x0439dcdf) /* 0.264126655 */, 17 },
+ /* 2539 */ { MAD_F(0x043a6e61) /* 0.264265422 */, 17 },
+ /* 2540 */ { MAD_F(0x043affe8) /* 0.264404208 */, 17 },
+ /* 2541 */ { MAD_F(0x043b9174) /* 0.264543012 */, 17 },
+ /* 2542 */ { MAD_F(0x043c2305) /* 0.264681834 */, 17 },
+ /* 2543 */ { MAD_F(0x043cb49a) /* 0.264820674 */, 17 },
+
+ /* 2544 */ { MAD_F(0x043d4635) /* 0.264959533 */, 17 },
+ /* 2545 */ { MAD_F(0x043dd7d4) /* 0.265098410 */, 17 },
+ /* 2546 */ { MAD_F(0x043e6979) /* 0.265237305 */, 17 },
+ /* 2547 */ { MAD_F(0x043efb22) /* 0.265376218 */, 17 },
+ /* 2548 */ { MAD_F(0x043f8cd0) /* 0.265515149 */, 17 },
+ /* 2549 */ { MAD_F(0x04401e83) /* 0.265654099 */, 17 },
+ /* 2550 */ { MAD_F(0x0440b03b) /* 0.265793066 */, 17 },
+ /* 2551 */ { MAD_F(0x044141f7) /* 0.265932052 */, 17 },
+ /* 2552 */ { MAD_F(0x0441d3b9) /* 0.266071056 */, 17 },
+ /* 2553 */ { MAD_F(0x04426580) /* 0.266210078 */, 17 },
+ /* 2554 */ { MAD_F(0x0442f74b) /* 0.266349119 */, 17 },
+ /* 2555 */ { MAD_F(0x0443891b) /* 0.266488177 */, 17 },
+ /* 2556 */ { MAD_F(0x04441af0) /* 0.266627254 */, 17 },
+ /* 2557 */ { MAD_F(0x0444acca) /* 0.266766349 */, 17 },
+ /* 2558 */ { MAD_F(0x04453ea9) /* 0.266905462 */, 17 },
+ /* 2559 */ { MAD_F(0x0445d08d) /* 0.267044593 */, 17 },
+
+ /* 2560 */ { MAD_F(0x04466275) /* 0.267183742 */, 17 },
+ /* 2561 */ { MAD_F(0x0446f463) /* 0.267322909 */, 17 },
+ /* 2562 */ { MAD_F(0x04478655) /* 0.267462094 */, 17 },
+ /* 2563 */ { MAD_F(0x0448184c) /* 0.267601298 */, 17 },
+ /* 2564 */ { MAD_F(0x0448aa48) /* 0.267740519 */, 17 },
+ /* 2565 */ { MAD_F(0x04493c49) /* 0.267879759 */, 17 },
+ /* 2566 */ { MAD_F(0x0449ce4f) /* 0.268019017 */, 17 },
+ /* 2567 */ { MAD_F(0x044a6059) /* 0.268158293 */, 17 },
+ /* 2568 */ { MAD_F(0x044af269) /* 0.268297587 */, 17 },
+ /* 2569 */ { MAD_F(0x044b847d) /* 0.268436899 */, 17 },
+ /* 2570 */ { MAD_F(0x044c1696) /* 0.268576229 */, 17 },
+ /* 2571 */ { MAD_F(0x044ca8b4) /* 0.268715577 */, 17 },
+ /* 2572 */ { MAD_F(0x044d3ad7) /* 0.268854943 */, 17 },
+ /* 2573 */ { MAD_F(0x044dccff) /* 0.268994328 */, 17 },
+ /* 2574 */ { MAD_F(0x044e5f2b) /* 0.269133730 */, 17 },
+ /* 2575 */ { MAD_F(0x044ef15d) /* 0.269273150 */, 17 },
+
+ /* 2576 */ { MAD_F(0x044f8393) /* 0.269412589 */, 17 },
+ /* 2577 */ { MAD_F(0x045015ce) /* 0.269552045 */, 17 },
+ /* 2578 */ { MAD_F(0x0450a80e) /* 0.269691520 */, 17 },
+ /* 2579 */ { MAD_F(0x04513a53) /* 0.269831013 */, 17 },
+ /* 2580 */ { MAD_F(0x0451cc9c) /* 0.269970523 */, 17 },
+ /* 2581 */ { MAD_F(0x04525eeb) /* 0.270110052 */, 17 },
+ /* 2582 */ { MAD_F(0x0452f13e) /* 0.270249599 */, 17 },
+ /* 2583 */ { MAD_F(0x04538396) /* 0.270389163 */, 17 },
+ /* 2584 */ { MAD_F(0x045415f3) /* 0.270528746 */, 17 },
+ /* 2585 */ { MAD_F(0x0454a855) /* 0.270668347 */, 17 },
+ /* 2586 */ { MAD_F(0x04553abb) /* 0.270807965 */, 17 },
+ /* 2587 */ { MAD_F(0x0455cd27) /* 0.270947602 */, 17 },
+ /* 2588 */ { MAD_F(0x04565f97) /* 0.271087257 */, 17 },
+ /* 2589 */ { MAD_F(0x0456f20c) /* 0.271226930 */, 17 },
+ /* 2590 */ { MAD_F(0x04578486) /* 0.271366620 */, 17 },
+ /* 2591 */ { MAD_F(0x04581705) /* 0.271506329 */, 17 },
+
+ /* 2592 */ { MAD_F(0x0458a989) /* 0.271646056 */, 17 },
+ /* 2593 */ { MAD_F(0x04593c11) /* 0.271785800 */, 17 },
+ /* 2594 */ { MAD_F(0x0459ce9e) /* 0.271925563 */, 17 },
+ /* 2595 */ { MAD_F(0x045a6130) /* 0.272065343 */, 17 },
+ /* 2596 */ { MAD_F(0x045af3c7) /* 0.272205142 */, 17 },
+ /* 2597 */ { MAD_F(0x045b8663) /* 0.272344958 */, 17 },
+ /* 2598 */ { MAD_F(0x045c1903) /* 0.272484793 */, 17 },
+ /* 2599 */ { MAD_F(0x045caba9) /* 0.272624645 */, 17 },
+ /* 2600 */ { MAD_F(0x045d3e53) /* 0.272764515 */, 17 },
+ /* 2601 */ { MAD_F(0x045dd102) /* 0.272904403 */, 17 },
+ /* 2602 */ { MAD_F(0x045e63b6) /* 0.273044310 */, 17 },
+ /* 2603 */ { MAD_F(0x045ef66e) /* 0.273184234 */, 17 },
+ /* 2604 */ { MAD_F(0x045f892b) /* 0.273324176 */, 17 },
+ /* 2605 */ { MAD_F(0x04601bee) /* 0.273464136 */, 17 },
+ /* 2606 */ { MAD_F(0x0460aeb5) /* 0.273604113 */, 17 },
+ /* 2607 */ { MAD_F(0x04614180) /* 0.273744109 */, 17 },
+
+ /* 2608 */ { MAD_F(0x0461d451) /* 0.273884123 */, 17 },
+ /* 2609 */ { MAD_F(0x04626727) /* 0.274024154 */, 17 },
+ /* 2610 */ { MAD_F(0x0462fa01) /* 0.274164204 */, 17 },
+ /* 2611 */ { MAD_F(0x04638ce0) /* 0.274304271 */, 17 },
+ /* 2612 */ { MAD_F(0x04641fc4) /* 0.274444356 */, 17 },
+ /* 2613 */ { MAD_F(0x0464b2ac) /* 0.274584459 */, 17 },
+ /* 2614 */ { MAD_F(0x0465459a) /* 0.274724580 */, 17 },
+ /* 2615 */ { MAD_F(0x0465d88c) /* 0.274864719 */, 17 },
+ /* 2616 */ { MAD_F(0x04666b83) /* 0.275004875 */, 17 },
+ /* 2617 */ { MAD_F(0x0466fe7f) /* 0.275145050 */, 17 },
+ /* 2618 */ { MAD_F(0x0467917f) /* 0.275285242 */, 17 },
+ /* 2619 */ { MAD_F(0x04682485) /* 0.275425452 */, 17 },
+ /* 2620 */ { MAD_F(0x0468b78f) /* 0.275565681 */, 17 },
+ /* 2621 */ { MAD_F(0x04694a9e) /* 0.275705926 */, 17 },
+ /* 2622 */ { MAD_F(0x0469ddb2) /* 0.275846190 */, 17 },
+ /* 2623 */ { MAD_F(0x046a70ca) /* 0.275986472 */, 17 },
+
+ /* 2624 */ { MAD_F(0x046b03e7) /* 0.276126771 */, 17 },
+ /* 2625 */ { MAD_F(0x046b970a) /* 0.276267088 */, 17 },
+ /* 2626 */ { MAD_F(0x046c2a31) /* 0.276407423 */, 17 },
+ /* 2627 */ { MAD_F(0x046cbd5c) /* 0.276547776 */, 17 },
+ /* 2628 */ { MAD_F(0x046d508d) /* 0.276688147 */, 17 },
+ /* 2629 */ { MAD_F(0x046de3c2) /* 0.276828535 */, 17 },
+ /* 2630 */ { MAD_F(0x046e76fc) /* 0.276968942 */, 17 },
+ /* 2631 */ { MAD_F(0x046f0a3b) /* 0.277109366 */, 17 },
+ /* 2632 */ { MAD_F(0x046f9d7e) /* 0.277249808 */, 17 },
+ /* 2633 */ { MAD_F(0x047030c7) /* 0.277390267 */, 17 },
+ /* 2634 */ { MAD_F(0x0470c414) /* 0.277530745 */, 17 },
+ /* 2635 */ { MAD_F(0x04715766) /* 0.277671240 */, 17 },
+ /* 2636 */ { MAD_F(0x0471eabc) /* 0.277811753 */, 17 },
+ /* 2637 */ { MAD_F(0x04727e18) /* 0.277952284 */, 17 },
+ /* 2638 */ { MAD_F(0x04731178) /* 0.278092832 */, 17 },
+ /* 2639 */ { MAD_F(0x0473a4dd) /* 0.278233399 */, 17 },
+
+ /* 2640 */ { MAD_F(0x04743847) /* 0.278373983 */, 17 },
+ /* 2641 */ { MAD_F(0x0474cbb5) /* 0.278514584 */, 17 },
+ /* 2642 */ { MAD_F(0x04755f29) /* 0.278655204 */, 17 },
+ /* 2643 */ { MAD_F(0x0475f2a1) /* 0.278795841 */, 17 },
+ /* 2644 */ { MAD_F(0x0476861d) /* 0.278936496 */, 17 },
+ /* 2645 */ { MAD_F(0x0477199f) /* 0.279077169 */, 17 },
+ /* 2646 */ { MAD_F(0x0477ad25) /* 0.279217860 */, 17 },
+ /* 2647 */ { MAD_F(0x047840b0) /* 0.279358568 */, 17 },
+ /* 2648 */ { MAD_F(0x0478d440) /* 0.279499294 */, 17 },
+ /* 2649 */ { MAD_F(0x047967d5) /* 0.279640037 */, 17 },
+ /* 2650 */ { MAD_F(0x0479fb6e) /* 0.279780799 */, 17 },
+ /* 2651 */ { MAD_F(0x047a8f0c) /* 0.279921578 */, 17 },
+ /* 2652 */ { MAD_F(0x047b22af) /* 0.280062375 */, 17 },
+ /* 2653 */ { MAD_F(0x047bb657) /* 0.280203189 */, 17 },
+ /* 2654 */ { MAD_F(0x047c4a03) /* 0.280344021 */, 17 },
+ /* 2655 */ { MAD_F(0x047cddb4) /* 0.280484871 */, 17 },
+
+ /* 2656 */ { MAD_F(0x047d716a) /* 0.280625739 */, 17 },
+ /* 2657 */ { MAD_F(0x047e0524) /* 0.280766624 */, 17 },
+ /* 2658 */ { MAD_F(0x047e98e4) /* 0.280907527 */, 17 },
+ /* 2659 */ { MAD_F(0x047f2ca8) /* 0.281048447 */, 17 },
+ /* 2660 */ { MAD_F(0x047fc071) /* 0.281189385 */, 17 },
+ /* 2661 */ { MAD_F(0x0480543e) /* 0.281330341 */, 17 },
+ /* 2662 */ { MAD_F(0x0480e811) /* 0.281471315 */, 17 },
+ /* 2663 */ { MAD_F(0x04817be8) /* 0.281612306 */, 17 },
+ /* 2664 */ { MAD_F(0x04820fc3) /* 0.281753315 */, 17 },
+ /* 2665 */ { MAD_F(0x0482a3a4) /* 0.281894341 */, 17 },
+ /* 2666 */ { MAD_F(0x04833789) /* 0.282035386 */, 17 },
+ /* 2667 */ { MAD_F(0x0483cb73) /* 0.282176447 */, 17 },
+ /* 2668 */ { MAD_F(0x04845f62) /* 0.282317527 */, 17 },
+ /* 2669 */ { MAD_F(0x0484f355) /* 0.282458624 */, 17 },
+ /* 2670 */ { MAD_F(0x0485874d) /* 0.282599738 */, 17 },
+ /* 2671 */ { MAD_F(0x04861b4a) /* 0.282740871 */, 17 },
+
+ /* 2672 */ { MAD_F(0x0486af4c) /* 0.282882021 */, 17 },
+ /* 2673 */ { MAD_F(0x04874352) /* 0.283023188 */, 17 },
+ /* 2674 */ { MAD_F(0x0487d75d) /* 0.283164373 */, 17 },
+ /* 2675 */ { MAD_F(0x04886b6d) /* 0.283305576 */, 17 },
+ /* 2676 */ { MAD_F(0x0488ff82) /* 0.283446796 */, 17 },
+ /* 2677 */ { MAD_F(0x0489939b) /* 0.283588034 */, 17 },
+ /* 2678 */ { MAD_F(0x048a27b9) /* 0.283729290 */, 17 },
+ /* 2679 */ { MAD_F(0x048abbdc) /* 0.283870563 */, 17 },
+ /* 2680 */ { MAD_F(0x048b5003) /* 0.284011853 */, 17 },
+ /* 2681 */ { MAD_F(0x048be42f) /* 0.284153161 */, 17 },
+ /* 2682 */ { MAD_F(0x048c7860) /* 0.284294487 */, 17 },
+ /* 2683 */ { MAD_F(0x048d0c96) /* 0.284435831 */, 17 },
+ /* 2684 */ { MAD_F(0x048da0d0) /* 0.284577192 */, 17 },
+ /* 2685 */ { MAD_F(0x048e350f) /* 0.284718570 */, 17 },
+ /* 2686 */ { MAD_F(0x048ec953) /* 0.284859966 */, 17 },
+ /* 2687 */ { MAD_F(0x048f5d9b) /* 0.285001380 */, 17 },
+
+ /* 2688 */ { MAD_F(0x048ff1e8) /* 0.285142811 */, 17 },
+ /* 2689 */ { MAD_F(0x0490863a) /* 0.285284259 */, 17 },
+ /* 2690 */ { MAD_F(0x04911a91) /* 0.285425726 */, 17 },
+ /* 2691 */ { MAD_F(0x0491aeec) /* 0.285567209 */, 17 },
+ /* 2692 */ { MAD_F(0x0492434c) /* 0.285708711 */, 17 },
+ /* 2693 */ { MAD_F(0x0492d7b0) /* 0.285850229 */, 17 },
+ /* 2694 */ { MAD_F(0x04936c1a) /* 0.285991766 */, 17 },
+ /* 2695 */ { MAD_F(0x04940088) /* 0.286133319 */, 17 },
+ /* 2696 */ { MAD_F(0x049494fb) /* 0.286274891 */, 17 },
+ /* 2697 */ { MAD_F(0x04952972) /* 0.286416480 */, 17 },
+ /* 2698 */ { MAD_F(0x0495bdee) /* 0.286558086 */, 17 },
+ /* 2699 */ { MAD_F(0x0496526f) /* 0.286699710 */, 17 },
+ /* 2700 */ { MAD_F(0x0496e6f5) /* 0.286841351 */, 17 },
+ /* 2701 */ { MAD_F(0x04977b7f) /* 0.286983010 */, 17 },
+ /* 2702 */ { MAD_F(0x0498100e) /* 0.287124686 */, 17 },
+ /* 2703 */ { MAD_F(0x0498a4a1) /* 0.287266380 */, 17 },
+
+ /* 2704 */ { MAD_F(0x0499393a) /* 0.287408091 */, 17 },
+ /* 2705 */ { MAD_F(0x0499cdd7) /* 0.287549820 */, 17 },
+ /* 2706 */ { MAD_F(0x049a6278) /* 0.287691566 */, 17 },
+ /* 2707 */ { MAD_F(0x049af71f) /* 0.287833330 */, 17 },
+ /* 2708 */ { MAD_F(0x049b8bca) /* 0.287975111 */, 17 },
+ /* 2709 */ { MAD_F(0x049c207a) /* 0.288116909 */, 17 },
+ /* 2710 */ { MAD_F(0x049cb52e) /* 0.288258725 */, 17 },
+ /* 2711 */ { MAD_F(0x049d49e7) /* 0.288400559 */, 17 },
+ /* 2712 */ { MAD_F(0x049ddea5) /* 0.288542409 */, 17 },
+ /* 2713 */ { MAD_F(0x049e7367) /* 0.288684278 */, 17 },
+ /* 2714 */ { MAD_F(0x049f082f) /* 0.288826163 */, 17 },
+ /* 2715 */ { MAD_F(0x049f9cfa) /* 0.288968067 */, 17 },
+ /* 2716 */ { MAD_F(0x04a031cb) /* 0.289109987 */, 17 },
+ /* 2717 */ { MAD_F(0x04a0c6a0) /* 0.289251925 */, 17 },
+ /* 2718 */ { MAD_F(0x04a15b7a) /* 0.289393881 */, 17 },
+ /* 2719 */ { MAD_F(0x04a1f059) /* 0.289535854 */, 17 },
+
+ /* 2720 */ { MAD_F(0x04a2853c) /* 0.289677844 */, 17 },
+ /* 2721 */ { MAD_F(0x04a31a24) /* 0.289819851 */, 17 },
+ /* 2722 */ { MAD_F(0x04a3af10) /* 0.289961876 */, 17 },
+ /* 2723 */ { MAD_F(0x04a44401) /* 0.290103919 */, 17 },
+ /* 2724 */ { MAD_F(0x04a4d8f7) /* 0.290245979 */, 17 },
+ /* 2725 */ { MAD_F(0x04a56df2) /* 0.290388056 */, 17 },
+ /* 2726 */ { MAD_F(0x04a602f1) /* 0.290530150 */, 17 },
+ /* 2727 */ { MAD_F(0x04a697f5) /* 0.290672262 */, 17 },
+ /* 2728 */ { MAD_F(0x04a72cfe) /* 0.290814392 */, 17 },
+ /* 2729 */ { MAD_F(0x04a7c20b) /* 0.290956538 */, 17 },
+ /* 2730 */ { MAD_F(0x04a8571d) /* 0.291098703 */, 17 },
+ /* 2731 */ { MAD_F(0x04a8ec33) /* 0.291240884 */, 17 },
+ /* 2732 */ { MAD_F(0x04a9814e) /* 0.291383083 */, 17 },
+ /* 2733 */ { MAD_F(0x04aa166e) /* 0.291525299 */, 17 },
+ /* 2734 */ { MAD_F(0x04aaab93) /* 0.291667532 */, 17 },
+ /* 2735 */ { MAD_F(0x04ab40bc) /* 0.291809783 */, 17 },
+
+ /* 2736 */ { MAD_F(0x04abd5ea) /* 0.291952051 */, 17 },
+ /* 2737 */ { MAD_F(0x04ac6b1c) /* 0.292094337 */, 17 },
+ /* 2738 */ { MAD_F(0x04ad0053) /* 0.292236640 */, 17 },
+ /* 2739 */ { MAD_F(0x04ad958f) /* 0.292378960 */, 17 },
+ /* 2740 */ { MAD_F(0x04ae2ad0) /* 0.292521297 */, 17 },
+ /* 2741 */ { MAD_F(0x04aec015) /* 0.292663652 */, 17 },
+ /* 2742 */ { MAD_F(0x04af555e) /* 0.292806024 */, 17 },
+ /* 2743 */ { MAD_F(0x04afeaad) /* 0.292948414 */, 17 },
+ /* 2744 */ { MAD_F(0x04b08000) /* 0.293090820 */, 17 },
+ /* 2745 */ { MAD_F(0x04b11557) /* 0.293233244 */, 17 },
+ /* 2746 */ { MAD_F(0x04b1aab4) /* 0.293375686 */, 17 },
+ /* 2747 */ { MAD_F(0x04b24015) /* 0.293518144 */, 17 },
+ /* 2748 */ { MAD_F(0x04b2d57a) /* 0.293660620 */, 17 },
+ /* 2749 */ { MAD_F(0x04b36ae4) /* 0.293803113 */, 17 },
+ /* 2750 */ { MAD_F(0x04b40053) /* 0.293945624 */, 17 },
+ /* 2751 */ { MAD_F(0x04b495c7) /* 0.294088151 */, 17 },
+
+ /* 2752 */ { MAD_F(0x04b52b3f) /* 0.294230696 */, 17 },
+ /* 2753 */ { MAD_F(0x04b5c0bc) /* 0.294373259 */, 17 },
+ /* 2754 */ { MAD_F(0x04b6563d) /* 0.294515838 */, 17 },
+ /* 2755 */ { MAD_F(0x04b6ebc3) /* 0.294658435 */, 17 },
+ /* 2756 */ { MAD_F(0x04b7814e) /* 0.294801049 */, 17 },
+ /* 2757 */ { MAD_F(0x04b816dd) /* 0.294943680 */, 17 },
+ /* 2758 */ { MAD_F(0x04b8ac71) /* 0.295086329 */, 17 },
+ /* 2759 */ { MAD_F(0x04b9420a) /* 0.295228995 */, 17 },
+ /* 2760 */ { MAD_F(0x04b9d7a7) /* 0.295371678 */, 17 },
+ /* 2761 */ { MAD_F(0x04ba6d49) /* 0.295514378 */, 17 },
+ /* 2762 */ { MAD_F(0x04bb02ef) /* 0.295657095 */, 17 },
+ /* 2763 */ { MAD_F(0x04bb989a) /* 0.295799830 */, 17 },
+ /* 2764 */ { MAD_F(0x04bc2e4a) /* 0.295942582 */, 17 },
+ /* 2765 */ { MAD_F(0x04bcc3fe) /* 0.296085351 */, 17 },
+ /* 2766 */ { MAD_F(0x04bd59b7) /* 0.296228138 */, 17 },
+ /* 2767 */ { MAD_F(0x04bdef74) /* 0.296370941 */, 17 },
+
+ /* 2768 */ { MAD_F(0x04be8537) /* 0.296513762 */, 17 },
+ /* 2769 */ { MAD_F(0x04bf1afd) /* 0.296656600 */, 17 },
+ /* 2770 */ { MAD_F(0x04bfb0c9) /* 0.296799455 */, 17 },
+ /* 2771 */ { MAD_F(0x04c04699) /* 0.296942327 */, 17 },
+ /* 2772 */ { MAD_F(0x04c0dc6d) /* 0.297085217 */, 17 },
+ /* 2773 */ { MAD_F(0x04c17247) /* 0.297228124 */, 17 },
+ /* 2774 */ { MAD_F(0x04c20824) /* 0.297371048 */, 17 },
+ /* 2775 */ { MAD_F(0x04c29e07) /* 0.297513989 */, 17 },
+ /* 2776 */ { MAD_F(0x04c333ee) /* 0.297656947 */, 17 },
+ /* 2777 */ { MAD_F(0x04c3c9da) /* 0.297799922 */, 17 },
+ /* 2778 */ { MAD_F(0x04c45fca) /* 0.297942915 */, 17 },
+ /* 2779 */ { MAD_F(0x04c4f5bf) /* 0.298085925 */, 17 },
+ /* 2780 */ { MAD_F(0x04c58bb8) /* 0.298228951 */, 17 },
+ /* 2781 */ { MAD_F(0x04c621b6) /* 0.298371996 */, 17 },
+ /* 2782 */ { MAD_F(0x04c6b7b9) /* 0.298515057 */, 17 },
+ /* 2783 */ { MAD_F(0x04c74dc0) /* 0.298658135 */, 17 },
+
+ /* 2784 */ { MAD_F(0x04c7e3cc) /* 0.298801231 */, 17 },
+ /* 2785 */ { MAD_F(0x04c879dd) /* 0.298944343 */, 17 },
+ /* 2786 */ { MAD_F(0x04c90ff2) /* 0.299087473 */, 17 },
+ /* 2787 */ { MAD_F(0x04c9a60c) /* 0.299230620 */, 17 },
+ /* 2788 */ { MAD_F(0x04ca3c2a) /* 0.299373784 */, 17 },
+ /* 2789 */ { MAD_F(0x04cad24d) /* 0.299516965 */, 17 },
+ /* 2790 */ { MAD_F(0x04cb6874) /* 0.299660163 */, 17 },
+ /* 2791 */ { MAD_F(0x04cbfea0) /* 0.299803378 */, 17 },
+ /* 2792 */ { MAD_F(0x04cc94d1) /* 0.299946611 */, 17 },
+ /* 2793 */ { MAD_F(0x04cd2b06) /* 0.300089860 */, 17 },
+ /* 2794 */ { MAD_F(0x04cdc140) /* 0.300233127 */, 17 },
+ /* 2795 */ { MAD_F(0x04ce577f) /* 0.300376411 */, 17 },
+ /* 2796 */ { MAD_F(0x04ceedc2) /* 0.300519711 */, 17 },
+ /* 2797 */ { MAD_F(0x04cf8409) /* 0.300663029 */, 17 },
+ /* 2798 */ { MAD_F(0x04d01a55) /* 0.300806364 */, 17 },
+ /* 2799 */ { MAD_F(0x04d0b0a6) /* 0.300949716 */, 17 },
+
+ /* 2800 */ { MAD_F(0x04d146fb) /* 0.301093085 */, 17 },
+ /* 2801 */ { MAD_F(0x04d1dd55) /* 0.301236472 */, 17 },
+ /* 2802 */ { MAD_F(0x04d273b4) /* 0.301379875 */, 17 },
+ /* 2803 */ { MAD_F(0x04d30a17) /* 0.301523295 */, 17 },
+ /* 2804 */ { MAD_F(0x04d3a07f) /* 0.301666733 */, 17 },
+ /* 2805 */ { MAD_F(0x04d436eb) /* 0.301810187 */, 17 },
+ /* 2806 */ { MAD_F(0x04d4cd5c) /* 0.301953659 */, 17 },
+ /* 2807 */ { MAD_F(0x04d563d1) /* 0.302097147 */, 17 },
+ /* 2808 */ { MAD_F(0x04d5fa4b) /* 0.302240653 */, 17 },
+ /* 2809 */ { MAD_F(0x04d690ca) /* 0.302384175 */, 17 },
+ /* 2810 */ { MAD_F(0x04d7274d) /* 0.302527715 */, 17 },
+ /* 2811 */ { MAD_F(0x04d7bdd5) /* 0.302671271 */, 17 },
+ /* 2812 */ { MAD_F(0x04d85461) /* 0.302814845 */, 17 },
+ /* 2813 */ { MAD_F(0x04d8eaf2) /* 0.302958436 */, 17 },
+ /* 2814 */ { MAD_F(0x04d98187) /* 0.303102044 */, 17 },
+ /* 2815 */ { MAD_F(0x04da1821) /* 0.303245668 */, 17 },
+
+ /* 2816 */ { MAD_F(0x04daaec0) /* 0.303389310 */, 17 },
+ /* 2817 */ { MAD_F(0x04db4563) /* 0.303532969 */, 17 },
+ /* 2818 */ { MAD_F(0x04dbdc0a) /* 0.303676645 */, 17 },
+ /* 2819 */ { MAD_F(0x04dc72b7) /* 0.303820337 */, 17 },
+ /* 2820 */ { MAD_F(0x04dd0967) /* 0.303964047 */, 17 },
+ /* 2821 */ { MAD_F(0x04dda01d) /* 0.304107774 */, 17 },
+ /* 2822 */ { MAD_F(0x04de36d7) /* 0.304251517 */, 17 },
+ /* 2823 */ { MAD_F(0x04decd95) /* 0.304395278 */, 17 },
+ /* 2824 */ { MAD_F(0x04df6458) /* 0.304539056 */, 17 },
+ /* 2825 */ { MAD_F(0x04dffb20) /* 0.304682850 */, 17 },
+ /* 2826 */ { MAD_F(0x04e091ec) /* 0.304826662 */, 17 },
+ /* 2827 */ { MAD_F(0x04e128bc) /* 0.304970491 */, 17 },
+ /* 2828 */ { MAD_F(0x04e1bf92) /* 0.305114336 */, 17 },
+ /* 2829 */ { MAD_F(0x04e2566b) /* 0.305258199 */, 17 },
+ /* 2830 */ { MAD_F(0x04e2ed4a) /* 0.305402078 */, 17 },
+ /* 2831 */ { MAD_F(0x04e3842d) /* 0.305545974 */, 17 },
+
+ /* 2832 */ { MAD_F(0x04e41b14) /* 0.305689888 */, 17 },
+ /* 2833 */ { MAD_F(0x04e4b200) /* 0.305833818 */, 17 },
+ /* 2834 */ { MAD_F(0x04e548f1) /* 0.305977765 */, 17 },
+ /* 2835 */ { MAD_F(0x04e5dfe6) /* 0.306121729 */, 17 },
+ /* 2836 */ { MAD_F(0x04e676df) /* 0.306265710 */, 17 },
+ /* 2837 */ { MAD_F(0x04e70dde) /* 0.306409708 */, 17 },
+ /* 2838 */ { MAD_F(0x04e7a4e0) /* 0.306553723 */, 17 },
+ /* 2839 */ { MAD_F(0x04e83be7) /* 0.306697755 */, 17 },
+ /* 2840 */ { MAD_F(0x04e8d2f3) /* 0.306841804 */, 17 },
+ /* 2841 */ { MAD_F(0x04e96a04) /* 0.306985869 */, 17 },
+ /* 2842 */ { MAD_F(0x04ea0118) /* 0.307129952 */, 17 },
+ /* 2843 */ { MAD_F(0x04ea9832) /* 0.307274051 */, 17 },
+ /* 2844 */ { MAD_F(0x04eb2f50) /* 0.307418168 */, 17 },
+ /* 2845 */ { MAD_F(0x04ebc672) /* 0.307562301 */, 17 },
+ /* 2846 */ { MAD_F(0x04ec5d99) /* 0.307706451 */, 17 },
+ /* 2847 */ { MAD_F(0x04ecf4c5) /* 0.307850618 */, 17 },
+
+ /* 2848 */ { MAD_F(0x04ed8bf5) /* 0.307994802 */, 17 },
+ /* 2849 */ { MAD_F(0x04ee2329) /* 0.308139003 */, 17 },
+ /* 2850 */ { MAD_F(0x04eeba63) /* 0.308283220 */, 17 },
+ /* 2851 */ { MAD_F(0x04ef51a0) /* 0.308427455 */, 17 },
+ /* 2852 */ { MAD_F(0x04efe8e2) /* 0.308571706 */, 17 },
+ /* 2853 */ { MAD_F(0x04f08029) /* 0.308715974 */, 17 },
+ /* 2854 */ { MAD_F(0x04f11774) /* 0.308860260 */, 17 },
+ /* 2855 */ { MAD_F(0x04f1aec4) /* 0.309004561 */, 17 },
+ /* 2856 */ { MAD_F(0x04f24618) /* 0.309148880 */, 17 },
+ /* 2857 */ { MAD_F(0x04f2dd71) /* 0.309293216 */, 17 },
+ /* 2858 */ { MAD_F(0x04f374cf) /* 0.309437568 */, 17 },
+ /* 2859 */ { MAD_F(0x04f40c30) /* 0.309581938 */, 17 },
+ /* 2860 */ { MAD_F(0x04f4a397) /* 0.309726324 */, 17 },
+ /* 2861 */ { MAD_F(0x04f53b02) /* 0.309870727 */, 17 },
+ /* 2862 */ { MAD_F(0x04f5d271) /* 0.310015147 */, 17 },
+ /* 2863 */ { MAD_F(0x04f669e5) /* 0.310159583 */, 17 },
+
+ /* 2864 */ { MAD_F(0x04f7015d) /* 0.310304037 */, 17 },
+ /* 2865 */ { MAD_F(0x04f798da) /* 0.310448507 */, 17 },
+ /* 2866 */ { MAD_F(0x04f8305c) /* 0.310592994 */, 17 },
+ /* 2867 */ { MAD_F(0x04f8c7e2) /* 0.310737498 */, 17 },
+ /* 2868 */ { MAD_F(0x04f95f6c) /* 0.310882018 */, 17 },
+ /* 2869 */ { MAD_F(0x04f9f6fb) /* 0.311026556 */, 17 },
+ /* 2870 */ { MAD_F(0x04fa8e8f) /* 0.311171110 */, 17 },
+ /* 2871 */ { MAD_F(0x04fb2627) /* 0.311315681 */, 17 },
+ /* 2872 */ { MAD_F(0x04fbbdc3) /* 0.311460269 */, 17 },
+ /* 2873 */ { MAD_F(0x04fc5564) /* 0.311604874 */, 17 },
+ /* 2874 */ { MAD_F(0x04fced0a) /* 0.311749495 */, 17 },
+ /* 2875 */ { MAD_F(0x04fd84b4) /* 0.311894133 */, 17 },
+ /* 2876 */ { MAD_F(0x04fe1c62) /* 0.312038788 */, 17 },
+ /* 2877 */ { MAD_F(0x04feb415) /* 0.312183460 */, 17 },
+ /* 2878 */ { MAD_F(0x04ff4bcd) /* 0.312328148 */, 17 },
+ /* 2879 */ { MAD_F(0x04ffe389) /* 0.312472854 */, 17 },
+
+ /* 2880 */ { MAD_F(0x05007b49) /* 0.312617576 */, 17 },
+ /* 2881 */ { MAD_F(0x0501130e) /* 0.312762314 */, 17 },
+ /* 2882 */ { MAD_F(0x0501aad8) /* 0.312907070 */, 17 },
+ /* 2883 */ { MAD_F(0x050242a6) /* 0.313051842 */, 17 },
+ /* 2884 */ { MAD_F(0x0502da78) /* 0.313196631 */, 17 },
+ /* 2885 */ { MAD_F(0x0503724f) /* 0.313341437 */, 17 },
+ /* 2886 */ { MAD_F(0x05040a2b) /* 0.313486259 */, 17 },
+ /* 2887 */ { MAD_F(0x0504a20b) /* 0.313631098 */, 17 },
+ /* 2888 */ { MAD_F(0x050539ef) /* 0.313775954 */, 17 },
+ /* 2889 */ { MAD_F(0x0505d1d8) /* 0.313920827 */, 17 },
+ /* 2890 */ { MAD_F(0x050669c5) /* 0.314065716 */, 17 },
+ /* 2891 */ { MAD_F(0x050701b7) /* 0.314210622 */, 17 },
+ /* 2892 */ { MAD_F(0x050799ae) /* 0.314355545 */, 17 },
+ /* 2893 */ { MAD_F(0x050831a9) /* 0.314500484 */, 17 },
+ /* 2894 */ { MAD_F(0x0508c9a8) /* 0.314645440 */, 17 },
+ /* 2895 */ { MAD_F(0x050961ac) /* 0.314790413 */, 17 },
+
+ /* 2896 */ { MAD_F(0x0509f9b4) /* 0.314935403 */, 17 },
+ /* 2897 */ { MAD_F(0x050a91c1) /* 0.315080409 */, 17 },
+ /* 2898 */ { MAD_F(0x050b29d2) /* 0.315225432 */, 17 },
+ /* 2899 */ { MAD_F(0x050bc1e8) /* 0.315370472 */, 17 },
+ /* 2900 */ { MAD_F(0x050c5a02) /* 0.315515528 */, 17 },
+ /* 2901 */ { MAD_F(0x050cf221) /* 0.315660601 */, 17 },
+ /* 2902 */ { MAD_F(0x050d8a44) /* 0.315805690 */, 17 },
+ /* 2903 */ { MAD_F(0x050e226c) /* 0.315950797 */, 17 },
+ /* 2904 */ { MAD_F(0x050eba98) /* 0.316095920 */, 17 },
+ /* 2905 */ { MAD_F(0x050f52c9) /* 0.316241059 */, 17 },
+ /* 2906 */ { MAD_F(0x050feafe) /* 0.316386216 */, 17 },
+ /* 2907 */ { MAD_F(0x05108337) /* 0.316531388 */, 17 },
+ /* 2908 */ { MAD_F(0x05111b75) /* 0.316676578 */, 17 },
+ /* 2909 */ { MAD_F(0x0511b3b8) /* 0.316821784 */, 17 },
+ /* 2910 */ { MAD_F(0x05124bff) /* 0.316967007 */, 17 },
+ /* 2911 */ { MAD_F(0x0512e44a) /* 0.317112247 */, 17 },
+
+ /* 2912 */ { MAD_F(0x05137c9a) /* 0.317257503 */, 17 },
+ /* 2913 */ { MAD_F(0x051414ee) /* 0.317402775 */, 17 },
+ /* 2914 */ { MAD_F(0x0514ad47) /* 0.317548065 */, 17 },
+ /* 2915 */ { MAD_F(0x051545a5) /* 0.317693371 */, 17 },
+ /* 2916 */ { MAD_F(0x0515de06) /* 0.317838693 */, 17 },
+ /* 2917 */ { MAD_F(0x0516766d) /* 0.317984033 */, 17 },
+ /* 2918 */ { MAD_F(0x05170ed7) /* 0.318129388 */, 17 },
+ /* 2919 */ { MAD_F(0x0517a746) /* 0.318274761 */, 17 },
+ /* 2920 */ { MAD_F(0x05183fba) /* 0.318420150 */, 17 },
+ /* 2921 */ { MAD_F(0x0518d832) /* 0.318565555 */, 17 },
+ /* 2922 */ { MAD_F(0x051970ae) /* 0.318710978 */, 17 },
+ /* 2923 */ { MAD_F(0x051a092f) /* 0.318856416 */, 17 },
+ /* 2924 */ { MAD_F(0x051aa1b5) /* 0.319001872 */, 17 },
+ /* 2925 */ { MAD_F(0x051b3a3f) /* 0.319147344 */, 17 },
+ /* 2926 */ { MAD_F(0x051bd2cd) /* 0.319292832 */, 17 },
+ /* 2927 */ { MAD_F(0x051c6b60) /* 0.319438338 */, 17 },
+
+ /* 2928 */ { MAD_F(0x051d03f7) /* 0.319583859 */, 17 },
+ /* 2929 */ { MAD_F(0x051d9c92) /* 0.319729398 */, 17 },
+ /* 2930 */ { MAD_F(0x051e3532) /* 0.319874952 */, 17 },
+ /* 2931 */ { MAD_F(0x051ecdd7) /* 0.320020524 */, 17 },
+ /* 2932 */ { MAD_F(0x051f6680) /* 0.320166112 */, 17 },
+ /* 2933 */ { MAD_F(0x051fff2d) /* 0.320311716 */, 17 },
+ /* 2934 */ { MAD_F(0x052097df) /* 0.320457337 */, 17 },
+ /* 2935 */ { MAD_F(0x05213095) /* 0.320602975 */, 17 },
+ /* 2936 */ { MAD_F(0x0521c950) /* 0.320748629 */, 17 },
+ /* 2937 */ { MAD_F(0x0522620f) /* 0.320894300 */, 17 },
+ /* 2938 */ { MAD_F(0x0522fad3) /* 0.321039987 */, 17 },
+ /* 2939 */ { MAD_F(0x0523939b) /* 0.321185691 */, 17 },
+ /* 2940 */ { MAD_F(0x05242c68) /* 0.321331411 */, 17 },
+ /* 2941 */ { MAD_F(0x0524c538) /* 0.321477148 */, 17 },
+ /* 2942 */ { MAD_F(0x05255e0e) /* 0.321622901 */, 17 },
+ /* 2943 */ { MAD_F(0x0525f6e8) /* 0.321768671 */, 17 },
+
+ /* 2944 */ { MAD_F(0x05268fc6) /* 0.321914457 */, 17 },
+ /* 2945 */ { MAD_F(0x052728a9) /* 0.322060260 */, 17 },
+ /* 2946 */ { MAD_F(0x0527c190) /* 0.322206079 */, 17 },
+ /* 2947 */ { MAD_F(0x05285a7b) /* 0.322351915 */, 17 },
+ /* 2948 */ { MAD_F(0x0528f36b) /* 0.322497768 */, 17 },
+ /* 2949 */ { MAD_F(0x05298c5f) /* 0.322643636 */, 17 },
+ /* 2950 */ { MAD_F(0x052a2558) /* 0.322789522 */, 17 },
+ /* 2951 */ { MAD_F(0x052abe55) /* 0.322935424 */, 17 },
+ /* 2952 */ { MAD_F(0x052b5757) /* 0.323081342 */, 17 },
+ /* 2953 */ { MAD_F(0x052bf05d) /* 0.323227277 */, 17 },
+ /* 2954 */ { MAD_F(0x052c8968) /* 0.323373228 */, 17 },
+ /* 2955 */ { MAD_F(0x052d2277) /* 0.323519196 */, 17 },
+ /* 2956 */ { MAD_F(0x052dbb8a) /* 0.323665180 */, 17 },
+ /* 2957 */ { MAD_F(0x052e54a2) /* 0.323811180 */, 17 },
+ /* 2958 */ { MAD_F(0x052eedbe) /* 0.323957197 */, 17 },
+ /* 2959 */ { MAD_F(0x052f86de) /* 0.324103231 */, 17 },
+
+ /* 2960 */ { MAD_F(0x05302003) /* 0.324249281 */, 17 },
+ /* 2961 */ { MAD_F(0x0530b92d) /* 0.324395347 */, 17 },
+ /* 2962 */ { MAD_F(0x0531525b) /* 0.324541430 */, 17 },
+ /* 2963 */ { MAD_F(0x0531eb8d) /* 0.324687530 */, 17 },
+ /* 2964 */ { MAD_F(0x053284c4) /* 0.324833646 */, 17 },
+ /* 2965 */ { MAD_F(0x05331dff) /* 0.324979778 */, 17 },
+ /* 2966 */ { MAD_F(0x0533b73e) /* 0.325125926 */, 17 },
+ /* 2967 */ { MAD_F(0x05345082) /* 0.325272091 */, 17 },
+ /* 2968 */ { MAD_F(0x0534e9ca) /* 0.325418273 */, 17 },
+ /* 2969 */ { MAD_F(0x05358317) /* 0.325564471 */, 17 },
+ /* 2970 */ { MAD_F(0x05361c68) /* 0.325710685 */, 17 },
+ /* 2971 */ { MAD_F(0x0536b5be) /* 0.325856916 */, 17 },
+ /* 2972 */ { MAD_F(0x05374f17) /* 0.326003163 */, 17 },
+ /* 2973 */ { MAD_F(0x0537e876) /* 0.326149427 */, 17 },
+ /* 2974 */ { MAD_F(0x053881d9) /* 0.326295707 */, 17 },
+ /* 2975 */ { MAD_F(0x05391b40) /* 0.326442003 */, 17 },
+
+ /* 2976 */ { MAD_F(0x0539b4ab) /* 0.326588316 */, 17 },
+ /* 2977 */ { MAD_F(0x053a4e1b) /* 0.326734645 */, 17 },
+ /* 2978 */ { MAD_F(0x053ae78f) /* 0.326880990 */, 17 },
+ /* 2979 */ { MAD_F(0x053b8108) /* 0.327027352 */, 17 },
+ /* 2980 */ { MAD_F(0x053c1a85) /* 0.327173730 */, 17 },
+ /* 2981 */ { MAD_F(0x053cb407) /* 0.327320125 */, 17 },
+ /* 2982 */ { MAD_F(0x053d4d8d) /* 0.327466536 */, 17 },
+ /* 2983 */ { MAD_F(0x053de717) /* 0.327612963 */, 17 },
+ /* 2984 */ { MAD_F(0x053e80a6) /* 0.327759407 */, 17 },
+ /* 2985 */ { MAD_F(0x053f1a39) /* 0.327905867 */, 17 },
+ /* 2986 */ { MAD_F(0x053fb3d0) /* 0.328052344 */, 17 },
+ /* 2987 */ { MAD_F(0x05404d6c) /* 0.328198837 */, 17 },
+ /* 2988 */ { MAD_F(0x0540e70c) /* 0.328345346 */, 17 },
+ /* 2989 */ { MAD_F(0x054180b1) /* 0.328491871 */, 17 },
+ /* 2990 */ { MAD_F(0x05421a5a) /* 0.328638413 */, 17 },
+ /* 2991 */ { MAD_F(0x0542b407) /* 0.328784971 */, 17 },
+
+ /* 2992 */ { MAD_F(0x05434db9) /* 0.328931546 */, 17 },
+ /* 2993 */ { MAD_F(0x0543e76f) /* 0.329078137 */, 17 },
+ /* 2994 */ { MAD_F(0x0544812a) /* 0.329224744 */, 17 },
+ /* 2995 */ { MAD_F(0x05451ae9) /* 0.329371367 */, 17 },
+ /* 2996 */ { MAD_F(0x0545b4ac) /* 0.329518007 */, 17 },
+ /* 2997 */ { MAD_F(0x05464e74) /* 0.329664663 */, 17 },
+ /* 2998 */ { MAD_F(0x0546e840) /* 0.329811336 */, 17 },
+ /* 2999 */ { MAD_F(0x05478211) /* 0.329958024 */, 17 },
+ /* 3000 */ { MAD_F(0x05481be5) /* 0.330104730 */, 17 },
+ /* 3001 */ { MAD_F(0x0548b5bf) /* 0.330251451 */, 17 },
+ /* 3002 */ { MAD_F(0x05494f9c) /* 0.330398189 */, 17 },
+ /* 3003 */ { MAD_F(0x0549e97e) /* 0.330544943 */, 17 },
+ /* 3004 */ { MAD_F(0x054a8364) /* 0.330691713 */, 17 },
+ /* 3005 */ { MAD_F(0x054b1d4f) /* 0.330838499 */, 17 },
+ /* 3006 */ { MAD_F(0x054bb73e) /* 0.330985302 */, 17 },
+ /* 3007 */ { MAD_F(0x054c5132) /* 0.331132121 */, 17 },
+
+ /* 3008 */ { MAD_F(0x054ceb2a) /* 0.331278957 */, 17 },
+ /* 3009 */ { MAD_F(0x054d8526) /* 0.331425808 */, 17 },
+ /* 3010 */ { MAD_F(0x054e1f26) /* 0.331572676 */, 17 },
+ /* 3011 */ { MAD_F(0x054eb92b) /* 0.331719560 */, 17 },
+ /* 3012 */ { MAD_F(0x054f5334) /* 0.331866461 */, 17 },
+ /* 3013 */ { MAD_F(0x054fed42) /* 0.332013377 */, 17 },
+ /* 3014 */ { MAD_F(0x05508754) /* 0.332160310 */, 17 },
+ /* 3015 */ { MAD_F(0x0551216b) /* 0.332307260 */, 17 },
+ /* 3016 */ { MAD_F(0x0551bb85) /* 0.332454225 */, 17 },
+ /* 3017 */ { MAD_F(0x055255a4) /* 0.332601207 */, 17 },
+ /* 3018 */ { MAD_F(0x0552efc8) /* 0.332748205 */, 17 },
+ /* 3019 */ { MAD_F(0x055389f0) /* 0.332895219 */, 17 },
+ /* 3020 */ { MAD_F(0x0554241c) /* 0.333042249 */, 17 },
+ /* 3021 */ { MAD_F(0x0554be4c) /* 0.333189296 */, 17 },
+ /* 3022 */ { MAD_F(0x05555881) /* 0.333336359 */, 17 },
+ /* 3023 */ { MAD_F(0x0555f2ba) /* 0.333483438 */, 17 },
+
+ /* 3024 */ { MAD_F(0x05568cf8) /* 0.333630533 */, 17 },
+ /* 3025 */ { MAD_F(0x0557273a) /* 0.333777645 */, 17 },
+ /* 3026 */ { MAD_F(0x0557c180) /* 0.333924772 */, 17 },
+ /* 3027 */ { MAD_F(0x05585bcb) /* 0.334071916 */, 17 },
+ /* 3028 */ { MAD_F(0x0558f61a) /* 0.334219076 */, 17 },
+ /* 3029 */ { MAD_F(0x0559906d) /* 0.334366253 */, 17 },
+ /* 3030 */ { MAD_F(0x055a2ac5) /* 0.334513445 */, 17 },
+ /* 3031 */ { MAD_F(0x055ac521) /* 0.334660654 */, 17 },
+ /* 3032 */ { MAD_F(0x055b5f81) /* 0.334807879 */, 17 },
+ /* 3033 */ { MAD_F(0x055bf9e6) /* 0.334955120 */, 17 },
+ /* 3034 */ { MAD_F(0x055c944f) /* 0.335102377 */, 17 },
+ /* 3035 */ { MAD_F(0x055d2ebd) /* 0.335249651 */, 17 },
+ /* 3036 */ { MAD_F(0x055dc92e) /* 0.335396941 */, 17 },
+ /* 3037 */ { MAD_F(0x055e63a5) /* 0.335544246 */, 17 },
+ /* 3038 */ { MAD_F(0x055efe1f) /* 0.335691568 */, 17 },
+ /* 3039 */ { MAD_F(0x055f989e) /* 0.335838906 */, 17 },
+
+ /* 3040 */ { MAD_F(0x05603321) /* 0.335986261 */, 17 },
+ /* 3041 */ { MAD_F(0x0560cda8) /* 0.336133631 */, 17 },
+ /* 3042 */ { MAD_F(0x05616834) /* 0.336281018 */, 17 },
+ /* 3043 */ { MAD_F(0x056202c4) /* 0.336428421 */, 17 },
+ /* 3044 */ { MAD_F(0x05629d59) /* 0.336575840 */, 17 },
+ /* 3045 */ { MAD_F(0x056337f2) /* 0.336723275 */, 17 },
+ /* 3046 */ { MAD_F(0x0563d28f) /* 0.336870726 */, 17 },
+ /* 3047 */ { MAD_F(0x05646d30) /* 0.337018193 */, 17 },
+ /* 3048 */ { MAD_F(0x056507d6) /* 0.337165677 */, 17 },
+ /* 3049 */ { MAD_F(0x0565a280) /* 0.337313176 */, 17 },
+ /* 3050 */ { MAD_F(0x05663d2f) /* 0.337460692 */, 17 },
+ /* 3051 */ { MAD_F(0x0566d7e1) /* 0.337608224 */, 17 },
+ /* 3052 */ { MAD_F(0x05677298) /* 0.337755772 */, 17 },
+ /* 3053 */ { MAD_F(0x05680d54) /* 0.337903336 */, 17 },
+ /* 3054 */ { MAD_F(0x0568a814) /* 0.338050916 */, 17 },
+ /* 3055 */ { MAD_F(0x056942d8) /* 0.338198513 */, 17 },
+
+ /* 3056 */ { MAD_F(0x0569dda0) /* 0.338346125 */, 17 },
+ /* 3057 */ { MAD_F(0x056a786d) /* 0.338493753 */, 17 },
+ /* 3058 */ { MAD_F(0x056b133e) /* 0.338641398 */, 17 },
+ /* 3059 */ { MAD_F(0x056bae13) /* 0.338789059 */, 17 },
+ /* 3060 */ { MAD_F(0x056c48ed) /* 0.338936736 */, 17 },
+ /* 3061 */ { MAD_F(0x056ce3cb) /* 0.339084429 */, 17 },
+ /* 3062 */ { MAD_F(0x056d7ead) /* 0.339232138 */, 17 },
+ /* 3063 */ { MAD_F(0x056e1994) /* 0.339379863 */, 17 },
+ /* 3064 */ { MAD_F(0x056eb47f) /* 0.339527604 */, 17 },
+ /* 3065 */ { MAD_F(0x056f4f6e) /* 0.339675361 */, 17 },
+ /* 3066 */ { MAD_F(0x056fea62) /* 0.339823134 */, 17 },
+ /* 3067 */ { MAD_F(0x0570855a) /* 0.339970924 */, 17 },
+ /* 3068 */ { MAD_F(0x05712056) /* 0.340118729 */, 17 },
+ /* 3069 */ { MAD_F(0x0571bb56) /* 0.340266550 */, 17 },
+ /* 3070 */ { MAD_F(0x0572565b) /* 0.340414388 */, 17 },
+ /* 3071 */ { MAD_F(0x0572f164) /* 0.340562242 */, 17 },
+
+ /* 3072 */ { MAD_F(0x05738c72) /* 0.340710111 */, 17 },
+ /* 3073 */ { MAD_F(0x05742784) /* 0.340857997 */, 17 },
+ /* 3074 */ { MAD_F(0x0574c29a) /* 0.341005899 */, 17 },
+ /* 3075 */ { MAD_F(0x05755db4) /* 0.341153816 */, 17 },
+ /* 3076 */ { MAD_F(0x0575f8d3) /* 0.341301750 */, 17 },
+ /* 3077 */ { MAD_F(0x057693f6) /* 0.341449700 */, 17 },
+ /* 3078 */ { MAD_F(0x05772f1d) /* 0.341597666 */, 17 },
+ /* 3079 */ { MAD_F(0x0577ca49) /* 0.341745648 */, 17 },
+ /* 3080 */ { MAD_F(0x05786578) /* 0.341893646 */, 17 },
+ /* 3081 */ { MAD_F(0x057900ad) /* 0.342041659 */, 17 },
+ /* 3082 */ { MAD_F(0x05799be5) /* 0.342189689 */, 17 },
+ /* 3083 */ { MAD_F(0x057a3722) /* 0.342337735 */, 17 },
+ /* 3084 */ { MAD_F(0x057ad263) /* 0.342485797 */, 17 },
+ /* 3085 */ { MAD_F(0x057b6da8) /* 0.342633875 */, 17 },
+ /* 3086 */ { MAD_F(0x057c08f2) /* 0.342781969 */, 17 },
+ /* 3087 */ { MAD_F(0x057ca440) /* 0.342930079 */, 17 },
+
+ /* 3088 */ { MAD_F(0x057d3f92) /* 0.343078205 */, 17 },
+ /* 3089 */ { MAD_F(0x057ddae9) /* 0.343226347 */, 17 },
+ /* 3090 */ { MAD_F(0x057e7644) /* 0.343374505 */, 17 },
+ /* 3091 */ { MAD_F(0x057f11a3) /* 0.343522679 */, 17 },
+ /* 3092 */ { MAD_F(0x057fad06) /* 0.343670869 */, 17 },
+ /* 3093 */ { MAD_F(0x0580486e) /* 0.343819075 */, 17 },
+ /* 3094 */ { MAD_F(0x0580e3da) /* 0.343967296 */, 17 },
+ /* 3095 */ { MAD_F(0x05817f4a) /* 0.344115534 */, 17 },
+ /* 3096 */ { MAD_F(0x05821abf) /* 0.344263788 */, 17 },
+ /* 3097 */ { MAD_F(0x0582b638) /* 0.344412058 */, 17 },
+ /* 3098 */ { MAD_F(0x058351b5) /* 0.344560343 */, 17 },
+ /* 3099 */ { MAD_F(0x0583ed36) /* 0.344708645 */, 17 },
+ /* 3100 */ { MAD_F(0x058488bc) /* 0.344856963 */, 17 },
+ /* 3101 */ { MAD_F(0x05852446) /* 0.345005296 */, 17 },
+ /* 3102 */ { MAD_F(0x0585bfd4) /* 0.345153646 */, 17 },
+ /* 3103 */ { MAD_F(0x05865b67) /* 0.345302011 */, 17 },
+
+ /* 3104 */ { MAD_F(0x0586f6fd) /* 0.345450393 */, 17 },
+ /* 3105 */ { MAD_F(0x05879298) /* 0.345598790 */, 17 },
+ /* 3106 */ { MAD_F(0x05882e38) /* 0.345747203 */, 17 },
+ /* 3107 */ { MAD_F(0x0588c9dc) /* 0.345895632 */, 17 },
+ /* 3108 */ { MAD_F(0x05896583) /* 0.346044077 */, 17 },
+ /* 3109 */ { MAD_F(0x058a0130) /* 0.346192538 */, 17 },
+ /* 3110 */ { MAD_F(0x058a9ce0) /* 0.346341015 */, 17 },
+ /* 3111 */ { MAD_F(0x058b3895) /* 0.346489508 */, 17 },
+ /* 3112 */ { MAD_F(0x058bd44e) /* 0.346638017 */, 17 },
+ /* 3113 */ { MAD_F(0x058c700b) /* 0.346786542 */, 17 },
+ /* 3114 */ { MAD_F(0x058d0bcd) /* 0.346935082 */, 17 },
+ /* 3115 */ { MAD_F(0x058da793) /* 0.347083639 */, 17 },
+ /* 3116 */ { MAD_F(0x058e435d) /* 0.347232211 */, 17 },
+ /* 3117 */ { MAD_F(0x058edf2b) /* 0.347380799 */, 17 },
+ /* 3118 */ { MAD_F(0x058f7afe) /* 0.347529403 */, 17 },
+ /* 3119 */ { MAD_F(0x059016d5) /* 0.347678023 */, 17 },
+
+ /* 3120 */ { MAD_F(0x0590b2b0) /* 0.347826659 */, 17 },
+ /* 3121 */ { MAD_F(0x05914e8f) /* 0.347975311 */, 17 },
+ /* 3122 */ { MAD_F(0x0591ea73) /* 0.348123979 */, 17 },
+ /* 3123 */ { MAD_F(0x0592865b) /* 0.348272662 */, 17 },
+ /* 3124 */ { MAD_F(0x05932247) /* 0.348421362 */, 17 },
+ /* 3125 */ { MAD_F(0x0593be37) /* 0.348570077 */, 17 },
+ /* 3126 */ { MAD_F(0x05945a2c) /* 0.348718808 */, 17 },
+ /* 3127 */ { MAD_F(0x0594f625) /* 0.348867555 */, 17 },
+ /* 3128 */ { MAD_F(0x05959222) /* 0.349016318 */, 17 },
+ /* 3129 */ { MAD_F(0x05962e24) /* 0.349165097 */, 17 },
+ /* 3130 */ { MAD_F(0x0596ca2a) /* 0.349313892 */, 17 },
+ /* 3131 */ { MAD_F(0x05976634) /* 0.349462702 */, 17 },
+ /* 3132 */ { MAD_F(0x05980242) /* 0.349611528 */, 17 },
+ /* 3133 */ { MAD_F(0x05989e54) /* 0.349760370 */, 17 },
+ /* 3134 */ { MAD_F(0x05993a6b) /* 0.349909228 */, 17 },
+ /* 3135 */ { MAD_F(0x0599d686) /* 0.350058102 */, 17 },
+
+ /* 3136 */ { MAD_F(0x059a72a5) /* 0.350206992 */, 17 },
+ /* 3137 */ { MAD_F(0x059b0ec9) /* 0.350355897 */, 17 },
+ /* 3138 */ { MAD_F(0x059baaf1) /* 0.350504818 */, 17 },
+ /* 3139 */ { MAD_F(0x059c471d) /* 0.350653756 */, 17 },
+ /* 3140 */ { MAD_F(0x059ce34d) /* 0.350802708 */, 17 },
+ /* 3141 */ { MAD_F(0x059d7f81) /* 0.350951677 */, 17 },
+ /* 3142 */ { MAD_F(0x059e1bba) /* 0.351100662 */, 17 },
+ /* 3143 */ { MAD_F(0x059eb7f7) /* 0.351249662 */, 17 },
+ /* 3144 */ { MAD_F(0x059f5438) /* 0.351398678 */, 17 },
+ /* 3145 */ { MAD_F(0x059ff07e) /* 0.351547710 */, 17 },
+ /* 3146 */ { MAD_F(0x05a08cc7) /* 0.351696758 */, 17 },
+ /* 3147 */ { MAD_F(0x05a12915) /* 0.351845821 */, 17 },
+ /* 3148 */ { MAD_F(0x05a1c567) /* 0.351994901 */, 17 },
+ /* 3149 */ { MAD_F(0x05a261be) /* 0.352143996 */, 17 },
+ /* 3150 */ { MAD_F(0x05a2fe18) /* 0.352293107 */, 17 },
+ /* 3151 */ { MAD_F(0x05a39a77) /* 0.352442233 */, 17 },
+
+ /* 3152 */ { MAD_F(0x05a436da) /* 0.352591376 */, 17 },
+ /* 3153 */ { MAD_F(0x05a4d342) /* 0.352740534 */, 17 },
+ /* 3154 */ { MAD_F(0x05a56fad) /* 0.352889708 */, 17 },
+ /* 3155 */ { MAD_F(0x05a60c1d) /* 0.353038898 */, 17 },
+ /* 3156 */ { MAD_F(0x05a6a891) /* 0.353188103 */, 17 },
+ /* 3157 */ { MAD_F(0x05a7450a) /* 0.353337325 */, 17 },
+ /* 3158 */ { MAD_F(0x05a7e186) /* 0.353486562 */, 17 },
+ /* 3159 */ { MAD_F(0x05a87e07) /* 0.353635814 */, 17 },
+ /* 3160 */ { MAD_F(0x05a91a8c) /* 0.353785083 */, 17 },
+ /* 3161 */ { MAD_F(0x05a9b715) /* 0.353934367 */, 17 },
+ /* 3162 */ { MAD_F(0x05aa53a2) /* 0.354083667 */, 17 },
+ /* 3163 */ { MAD_F(0x05aaf034) /* 0.354232983 */, 17 },
+ /* 3164 */ { MAD_F(0x05ab8cca) /* 0.354382314 */, 17 },
+ /* 3165 */ { MAD_F(0x05ac2964) /* 0.354531662 */, 17 },
+ /* 3166 */ { MAD_F(0x05acc602) /* 0.354681025 */, 17 },
+ /* 3167 */ { MAD_F(0x05ad62a5) /* 0.354830403 */, 17 },
+
+ /* 3168 */ { MAD_F(0x05adff4c) /* 0.354979798 */, 17 },
+ /* 3169 */ { MAD_F(0x05ae9bf7) /* 0.355129208 */, 17 },
+ /* 3170 */ { MAD_F(0x05af38a6) /* 0.355278634 */, 17 },
+ /* 3171 */ { MAD_F(0x05afd559) /* 0.355428075 */, 17 },
+ /* 3172 */ { MAD_F(0x05b07211) /* 0.355577533 */, 17 },
+ /* 3173 */ { MAD_F(0x05b10ecd) /* 0.355727006 */, 17 },
+ /* 3174 */ { MAD_F(0x05b1ab8d) /* 0.355876494 */, 17 },
+ /* 3175 */ { MAD_F(0x05b24851) /* 0.356025999 */, 17 },
+ /* 3176 */ { MAD_F(0x05b2e51a) /* 0.356175519 */, 17 },
+ /* 3177 */ { MAD_F(0x05b381e6) /* 0.356325054 */, 17 },
+ /* 3178 */ { MAD_F(0x05b41eb7) /* 0.356474606 */, 17 },
+ /* 3179 */ { MAD_F(0x05b4bb8c) /* 0.356624173 */, 17 },
+ /* 3180 */ { MAD_F(0x05b55866) /* 0.356773756 */, 17 },
+ /* 3181 */ { MAD_F(0x05b5f543) /* 0.356923354 */, 17 },
+ /* 3182 */ { MAD_F(0x05b69225) /* 0.357072969 */, 17 },
+ /* 3183 */ { MAD_F(0x05b72f0b) /* 0.357222598 */, 17 },
+
+ /* 3184 */ { MAD_F(0x05b7cbf5) /* 0.357372244 */, 17 },
+ /* 3185 */ { MAD_F(0x05b868e3) /* 0.357521905 */, 17 },
+ /* 3186 */ { MAD_F(0x05b905d6) /* 0.357671582 */, 17 },
+ /* 3187 */ { MAD_F(0x05b9a2cd) /* 0.357821275 */, 17 },
+ /* 3188 */ { MAD_F(0x05ba3fc8) /* 0.357970983 */, 17 },
+ /* 3189 */ { MAD_F(0x05badcc7) /* 0.358120707 */, 17 },
+ /* 3190 */ { MAD_F(0x05bb79ca) /* 0.358270446 */, 17 },
+ /* 3191 */ { MAD_F(0x05bc16d2) /* 0.358420201 */, 17 },
+ /* 3192 */ { MAD_F(0x05bcb3de) /* 0.358569972 */, 17 },
+ /* 3193 */ { MAD_F(0x05bd50ee) /* 0.358719758 */, 17 },
+ /* 3194 */ { MAD_F(0x05bdee02) /* 0.358869560 */, 17 },
+ /* 3195 */ { MAD_F(0x05be8b1a) /* 0.359019378 */, 17 },
+ /* 3196 */ { MAD_F(0x05bf2837) /* 0.359169211 */, 17 },
+ /* 3197 */ { MAD_F(0x05bfc558) /* 0.359319060 */, 17 },
+ /* 3198 */ { MAD_F(0x05c0627d) /* 0.359468925 */, 17 },
+ /* 3199 */ { MAD_F(0x05c0ffa6) /* 0.359618805 */, 17 },
+
+ /* 3200 */ { MAD_F(0x05c19cd3) /* 0.359768701 */, 17 },
+ /* 3201 */ { MAD_F(0x05c23a05) /* 0.359918612 */, 17 },
+ /* 3202 */ { MAD_F(0x05c2d73a) /* 0.360068540 */, 17 },
+ /* 3203 */ { MAD_F(0x05c37474) /* 0.360218482 */, 17 },
+ /* 3204 */ { MAD_F(0x05c411b2) /* 0.360368440 */, 17 },
+ /* 3205 */ { MAD_F(0x05c4aef5) /* 0.360518414 */, 17 },
+ /* 3206 */ { MAD_F(0x05c54c3b) /* 0.360668404 */, 17 },
+ /* 3207 */ { MAD_F(0x05c5e986) /* 0.360818409 */, 17 },
+ /* 3208 */ { MAD_F(0x05c686d5) /* 0.360968429 */, 17 },
+ /* 3209 */ { MAD_F(0x05c72428) /* 0.361118466 */, 17 },
+ /* 3210 */ { MAD_F(0x05c7c17f) /* 0.361268517 */, 17 },
+ /* 3211 */ { MAD_F(0x05c85eda) /* 0.361418585 */, 17 },
+ /* 3212 */ { MAD_F(0x05c8fc3a) /* 0.361568668 */, 17 },
+ /* 3213 */ { MAD_F(0x05c9999e) /* 0.361718766 */, 17 },
+ /* 3214 */ { MAD_F(0x05ca3706) /* 0.361868881 */, 17 },
+ /* 3215 */ { MAD_F(0x05cad472) /* 0.362019010 */, 17 },
+
+ /* 3216 */ { MAD_F(0x05cb71e2) /* 0.362169156 */, 17 },
+ /* 3217 */ { MAD_F(0x05cc0f57) /* 0.362319316 */, 17 },
+ /* 3218 */ { MAD_F(0x05ccaccf) /* 0.362469493 */, 17 },
+ /* 3219 */ { MAD_F(0x05cd4a4c) /* 0.362619685 */, 17 },
+ /* 3220 */ { MAD_F(0x05cde7cd) /* 0.362769892 */, 17 },
+ /* 3221 */ { MAD_F(0x05ce8552) /* 0.362920115 */, 17 },
+ /* 3222 */ { MAD_F(0x05cf22dc) /* 0.363070354 */, 17 },
+ /* 3223 */ { MAD_F(0x05cfc069) /* 0.363220608 */, 17 },
+ /* 3224 */ { MAD_F(0x05d05dfb) /* 0.363370878 */, 17 },
+ /* 3225 */ { MAD_F(0x05d0fb91) /* 0.363521163 */, 17 },
+ /* 3226 */ { MAD_F(0x05d1992b) /* 0.363671464 */, 17 },
+ /* 3227 */ { MAD_F(0x05d236c9) /* 0.363821780 */, 17 },
+ /* 3228 */ { MAD_F(0x05d2d46c) /* 0.363972112 */, 17 },
+ /* 3229 */ { MAD_F(0x05d37212) /* 0.364122459 */, 17 },
+ /* 3230 */ { MAD_F(0x05d40fbd) /* 0.364272822 */, 17 },
+ /* 3231 */ { MAD_F(0x05d4ad6c) /* 0.364423200 */, 17 },
+
+ /* 3232 */ { MAD_F(0x05d54b1f) /* 0.364573594 */, 17 },
+ /* 3233 */ { MAD_F(0x05d5e8d6) /* 0.364724004 */, 17 },
+ /* 3234 */ { MAD_F(0x05d68691) /* 0.364874429 */, 17 },
+ /* 3235 */ { MAD_F(0x05d72451) /* 0.365024869 */, 17 },
+ /* 3236 */ { MAD_F(0x05d7c215) /* 0.365175325 */, 17 },
+ /* 3237 */ { MAD_F(0x05d85fdc) /* 0.365325796 */, 17 },
+ /* 3238 */ { MAD_F(0x05d8fda8) /* 0.365476283 */, 17 },
+ /* 3239 */ { MAD_F(0x05d99b79) /* 0.365626786 */, 17 },
+ /* 3240 */ { MAD_F(0x05da394d) /* 0.365777304 */, 17 },
+ /* 3241 */ { MAD_F(0x05dad726) /* 0.365927837 */, 17 },
+ /* 3242 */ { MAD_F(0x05db7502) /* 0.366078386 */, 17 },
+ /* 3243 */ { MAD_F(0x05dc12e3) /* 0.366228950 */, 17 },
+ /* 3244 */ { MAD_F(0x05dcb0c8) /* 0.366379530 */, 17 },
+ /* 3245 */ { MAD_F(0x05dd4eb1) /* 0.366530125 */, 17 },
+ /* 3246 */ { MAD_F(0x05ddec9e) /* 0.366680736 */, 17 },
+ /* 3247 */ { MAD_F(0x05de8a90) /* 0.366831362 */, 17 },
+
+ /* 3248 */ { MAD_F(0x05df2885) /* 0.366982004 */, 17 },
+ /* 3249 */ { MAD_F(0x05dfc67f) /* 0.367132661 */, 17 },
+ /* 3250 */ { MAD_F(0x05e0647d) /* 0.367283334 */, 17 },
+ /* 3251 */ { MAD_F(0x05e1027f) /* 0.367434022 */, 17 },
+ /* 3252 */ { MAD_F(0x05e1a085) /* 0.367584725 */, 17 },
+ /* 3253 */ { MAD_F(0x05e23e8f) /* 0.367735444 */, 17 },
+ /* 3254 */ { MAD_F(0x05e2dc9e) /* 0.367886179 */, 17 },
+ /* 3255 */ { MAD_F(0x05e37ab0) /* 0.368036929 */, 17 },
+ /* 3256 */ { MAD_F(0x05e418c7) /* 0.368187694 */, 17 },
+ /* 3257 */ { MAD_F(0x05e4b6e2) /* 0.368338475 */, 17 },
+ /* 3258 */ { MAD_F(0x05e55501) /* 0.368489271 */, 17 },
+ /* 3259 */ { MAD_F(0x05e5f324) /* 0.368640082 */, 17 },
+ /* 3260 */ { MAD_F(0x05e6914c) /* 0.368790909 */, 17 },
+ /* 3261 */ { MAD_F(0x05e72f77) /* 0.368941752 */, 17 },
+ /* 3262 */ { MAD_F(0x05e7cda7) /* 0.369092610 */, 17 },
+ /* 3263 */ { MAD_F(0x05e86bda) /* 0.369243483 */, 17 },
+
+ /* 3264 */ { MAD_F(0x05e90a12) /* 0.369394372 */, 17 },
+ /* 3265 */ { MAD_F(0x05e9a84e) /* 0.369545276 */, 17 },
+ /* 3266 */ { MAD_F(0x05ea468e) /* 0.369696195 */, 17 },
+ /* 3267 */ { MAD_F(0x05eae4d3) /* 0.369847130 */, 17 },
+ /* 3268 */ { MAD_F(0x05eb831b) /* 0.369998080 */, 17 },
+ /* 3269 */ { MAD_F(0x05ec2168) /* 0.370149046 */, 17 },
+ /* 3270 */ { MAD_F(0x05ecbfb8) /* 0.370300027 */, 17 },
+ /* 3271 */ { MAD_F(0x05ed5e0d) /* 0.370451024 */, 17 },
+ /* 3272 */ { MAD_F(0x05edfc66) /* 0.370602036 */, 17 },
+ /* 3273 */ { MAD_F(0x05ee9ac3) /* 0.370753063 */, 17 },
+ /* 3274 */ { MAD_F(0x05ef3924) /* 0.370904105 */, 17 },
+ /* 3275 */ { MAD_F(0x05efd78a) /* 0.371055163 */, 17 },
+ /* 3276 */ { MAD_F(0x05f075f3) /* 0.371206237 */, 17 },
+ /* 3277 */ { MAD_F(0x05f11461) /* 0.371357326 */, 17 },
+ /* 3278 */ { MAD_F(0x05f1b2d3) /* 0.371508430 */, 17 },
+ /* 3279 */ { MAD_F(0x05f25148) /* 0.371659549 */, 17 },
+
+ /* 3280 */ { MAD_F(0x05f2efc2) /* 0.371810684 */, 17 },
+ /* 3281 */ { MAD_F(0x05f38e40) /* 0.371961834 */, 17 },
+ /* 3282 */ { MAD_F(0x05f42cc3) /* 0.372113000 */, 17 },
+ /* 3283 */ { MAD_F(0x05f4cb49) /* 0.372264181 */, 17 },
+ /* 3284 */ { MAD_F(0x05f569d3) /* 0.372415377 */, 17 },
+ /* 3285 */ { MAD_F(0x05f60862) /* 0.372566589 */, 17 },
+ /* 3286 */ { MAD_F(0x05f6a6f5) /* 0.372717816 */, 17 },
+ /* 3287 */ { MAD_F(0x05f7458b) /* 0.372869058 */, 17 },
+ /* 3288 */ { MAD_F(0x05f7e426) /* 0.373020316 */, 17 },
+ /* 3289 */ { MAD_F(0x05f882c5) /* 0.373171589 */, 17 },
+ /* 3290 */ { MAD_F(0x05f92169) /* 0.373322877 */, 17 },
+ /* 3291 */ { MAD_F(0x05f9c010) /* 0.373474181 */, 17 },
+ /* 3292 */ { MAD_F(0x05fa5ebb) /* 0.373625500 */, 17 },
+ /* 3293 */ { MAD_F(0x05fafd6b) /* 0.373776834 */, 17 },
+ /* 3294 */ { MAD_F(0x05fb9c1e) /* 0.373928184 */, 17 },
+ /* 3295 */ { MAD_F(0x05fc3ad6) /* 0.374079549 */, 17 },
+
+ /* 3296 */ { MAD_F(0x05fcd992) /* 0.374230929 */, 17 },
+ /* 3297 */ { MAD_F(0x05fd7852) /* 0.374382325 */, 17 },
+ /* 3298 */ { MAD_F(0x05fe1716) /* 0.374533735 */, 17 },
+ /* 3299 */ { MAD_F(0x05feb5de) /* 0.374685162 */, 17 },
+ /* 3300 */ { MAD_F(0x05ff54aa) /* 0.374836603 */, 17 },
+ /* 3301 */ { MAD_F(0x05fff37b) /* 0.374988060 */, 17 },
+ /* 3302 */ { MAD_F(0x0600924f) /* 0.375139532 */, 17 },
+ /* 3303 */ { MAD_F(0x06013128) /* 0.375291019 */, 17 },
+ /* 3304 */ { MAD_F(0x0601d004) /* 0.375442522 */, 17 },
+ /* 3305 */ { MAD_F(0x06026ee5) /* 0.375594040 */, 17 },
+ /* 3306 */ { MAD_F(0x06030dca) /* 0.375745573 */, 17 },
+ /* 3307 */ { MAD_F(0x0603acb3) /* 0.375897122 */, 17 },
+ /* 3308 */ { MAD_F(0x06044ba0) /* 0.376048685 */, 17 },
+ /* 3309 */ { MAD_F(0x0604ea91) /* 0.376200265 */, 17 },
+ /* 3310 */ { MAD_F(0x06058987) /* 0.376351859 */, 17 },
+ /* 3311 */ { MAD_F(0x06062880) /* 0.376503468 */, 17 },
+
+ /* 3312 */ { MAD_F(0x0606c77d) /* 0.376655093 */, 17 },
+ /* 3313 */ { MAD_F(0x0607667f) /* 0.376806733 */, 17 },
+ /* 3314 */ { MAD_F(0x06080585) /* 0.376958389 */, 17 },
+ /* 3315 */ { MAD_F(0x0608a48f) /* 0.377110059 */, 17 },
+ /* 3316 */ { MAD_F(0x0609439c) /* 0.377261745 */, 17 },
+ /* 3317 */ { MAD_F(0x0609e2ae) /* 0.377413446 */, 17 },
+ /* 3318 */ { MAD_F(0x060a81c4) /* 0.377565163 */, 17 },
+ /* 3319 */ { MAD_F(0x060b20df) /* 0.377716894 */, 17 },
+ /* 3320 */ { MAD_F(0x060bbffd) /* 0.377868641 */, 17 },
+ /* 3321 */ { MAD_F(0x060c5f1f) /* 0.378020403 */, 17 },
+ /* 3322 */ { MAD_F(0x060cfe46) /* 0.378172181 */, 17 },
+ /* 3323 */ { MAD_F(0x060d9d70) /* 0.378323973 */, 17 },
+ /* 3324 */ { MAD_F(0x060e3c9f) /* 0.378475781 */, 17 },
+ /* 3325 */ { MAD_F(0x060edbd1) /* 0.378627604 */, 17 },
+ /* 3326 */ { MAD_F(0x060f7b08) /* 0.378779442 */, 17 },
+ /* 3327 */ { MAD_F(0x06101a43) /* 0.378931296 */, 17 },
+
+ /* 3328 */ { MAD_F(0x0610b982) /* 0.379083164 */, 17 },
+ /* 3329 */ { MAD_F(0x061158c5) /* 0.379235048 */, 17 },
+ /* 3330 */ { MAD_F(0x0611f80c) /* 0.379386947 */, 17 },
+ /* 3331 */ { MAD_F(0x06129757) /* 0.379538862 */, 17 },
+ /* 3332 */ { MAD_F(0x061336a6) /* 0.379690791 */, 17 },
+ /* 3333 */ { MAD_F(0x0613d5fa) /* 0.379842736 */, 17 },
+ /* 3334 */ { MAD_F(0x06147551) /* 0.379994696 */, 17 },
+ /* 3335 */ { MAD_F(0x061514ad) /* 0.380146671 */, 17 },
+ /* 3336 */ { MAD_F(0x0615b40c) /* 0.380298661 */, 17 },
+ /* 3337 */ { MAD_F(0x06165370) /* 0.380450666 */, 17 },
+ /* 3338 */ { MAD_F(0x0616f2d8) /* 0.380602687 */, 17 },
+ /* 3339 */ { MAD_F(0x06179243) /* 0.380754723 */, 17 },
+ /* 3340 */ { MAD_F(0x061831b3) /* 0.380906774 */, 17 },
+ /* 3341 */ { MAD_F(0x0618d127) /* 0.381058840 */, 17 },
+ /* 3342 */ { MAD_F(0x0619709f) /* 0.381210921 */, 17 },
+ /* 3343 */ { MAD_F(0x061a101b) /* 0.381363018 */, 17 },
+
+ /* 3344 */ { MAD_F(0x061aaf9c) /* 0.381515130 */, 17 },
+ /* 3345 */ { MAD_F(0x061b4f20) /* 0.381667257 */, 17 },
+ /* 3346 */ { MAD_F(0x061beea8) /* 0.381819399 */, 17 },
+ /* 3347 */ { MAD_F(0x061c8e34) /* 0.381971556 */, 17 },
+ /* 3348 */ { MAD_F(0x061d2dc5) /* 0.382123728 */, 17 },
+ /* 3349 */ { MAD_F(0x061dcd59) /* 0.382275916 */, 17 },
+ /* 3350 */ { MAD_F(0x061e6cf2) /* 0.382428118 */, 17 },
+ /* 3351 */ { MAD_F(0x061f0c8f) /* 0.382580336 */, 17 },
+ /* 3352 */ { MAD_F(0x061fac2f) /* 0.382732569 */, 17 },
+ /* 3353 */ { MAD_F(0x06204bd4) /* 0.382884817 */, 17 },
+ /* 3354 */ { MAD_F(0x0620eb7d) /* 0.383037080 */, 17 },
+ /* 3355 */ { MAD_F(0x06218b2a) /* 0.383189358 */, 17 },
+ /* 3356 */ { MAD_F(0x06222adb) /* 0.383341652 */, 17 },
+ /* 3357 */ { MAD_F(0x0622ca90) /* 0.383493960 */, 17 },
+ /* 3358 */ { MAD_F(0x06236a49) /* 0.383646284 */, 17 },
+ /* 3359 */ { MAD_F(0x06240a06) /* 0.383798623 */, 17 },
+
+ /* 3360 */ { MAD_F(0x0624a9c7) /* 0.383950977 */, 17 },
+ /* 3361 */ { MAD_F(0x0625498d) /* 0.384103346 */, 17 },
+ /* 3362 */ { MAD_F(0x0625e956) /* 0.384255730 */, 17 },
+ /* 3363 */ { MAD_F(0x06268923) /* 0.384408129 */, 17 },
+ /* 3364 */ { MAD_F(0x062728f5) /* 0.384560544 */, 17 },
+ /* 3365 */ { MAD_F(0x0627c8ca) /* 0.384712973 */, 17 },
+ /* 3366 */ { MAD_F(0x062868a4) /* 0.384865418 */, 17 },
+ /* 3367 */ { MAD_F(0x06290881) /* 0.385017878 */, 17 },
+ /* 3368 */ { MAD_F(0x0629a863) /* 0.385170352 */, 17 },
+ /* 3369 */ { MAD_F(0x062a4849) /* 0.385322842 */, 17 },
+ /* 3370 */ { MAD_F(0x062ae832) /* 0.385475347 */, 17 },
+ /* 3371 */ { MAD_F(0x062b8820) /* 0.385627867 */, 17 },
+ /* 3372 */ { MAD_F(0x062c2812) /* 0.385780402 */, 17 },
+ /* 3373 */ { MAD_F(0x062cc808) /* 0.385932953 */, 17 },
+ /* 3374 */ { MAD_F(0x062d6802) /* 0.386085518 */, 17 },
+ /* 3375 */ { MAD_F(0x062e0800) /* 0.386238098 */, 17 },
+
+ /* 3376 */ { MAD_F(0x062ea802) /* 0.386390694 */, 17 },
+ /* 3377 */ { MAD_F(0x062f4808) /* 0.386543304 */, 17 },
+ /* 3378 */ { MAD_F(0x062fe812) /* 0.386695930 */, 17 },
+ /* 3379 */ { MAD_F(0x06308820) /* 0.386848570 */, 17 },
+ /* 3380 */ { MAD_F(0x06312832) /* 0.387001226 */, 17 },
+ /* 3381 */ { MAD_F(0x0631c849) /* 0.387153897 */, 17 },
+ /* 3382 */ { MAD_F(0x06326863) /* 0.387306582 */, 17 },
+ /* 3383 */ { MAD_F(0x06330881) /* 0.387459283 */, 17 },
+ /* 3384 */ { MAD_F(0x0633a8a3) /* 0.387611999 */, 17 },
+ /* 3385 */ { MAD_F(0x063448ca) /* 0.387764730 */, 17 },
+ /* 3386 */ { MAD_F(0x0634e8f4) /* 0.387917476 */, 17 },
+ /* 3387 */ { MAD_F(0x06358923) /* 0.388070237 */, 17 },
+ /* 3388 */ { MAD_F(0x06362955) /* 0.388223013 */, 17 },
+ /* 3389 */ { MAD_F(0x0636c98c) /* 0.388375804 */, 17 },
+ /* 3390 */ { MAD_F(0x063769c6) /* 0.388528610 */, 17 },
+ /* 3391 */ { MAD_F(0x06380a05) /* 0.388681431 */, 17 },
+
+ /* 3392 */ { MAD_F(0x0638aa48) /* 0.388834268 */, 17 },
+ /* 3393 */ { MAD_F(0x06394a8e) /* 0.388987119 */, 17 },
+ /* 3394 */ { MAD_F(0x0639ead9) /* 0.389139985 */, 17 },
+ /* 3395 */ { MAD_F(0x063a8b28) /* 0.389292866 */, 17 },
+ /* 3396 */ { MAD_F(0x063b2b7b) /* 0.389445762 */, 17 },
+ /* 3397 */ { MAD_F(0x063bcbd1) /* 0.389598674 */, 17 },
+ /* 3398 */ { MAD_F(0x063c6c2c) /* 0.389751600 */, 17 },
+ /* 3399 */ { MAD_F(0x063d0c8b) /* 0.389904541 */, 17 },
+ /* 3400 */ { MAD_F(0x063dacee) /* 0.390057497 */, 17 },
+ /* 3401 */ { MAD_F(0x063e4d55) /* 0.390210468 */, 17 },
+ /* 3402 */ { MAD_F(0x063eedc0) /* 0.390363455 */, 17 },
+ /* 3403 */ { MAD_F(0x063f8e2f) /* 0.390516456 */, 17 },
+ /* 3404 */ { MAD_F(0x06402ea2) /* 0.390669472 */, 17 },
+ /* 3405 */ { MAD_F(0x0640cf19) /* 0.390822503 */, 17 },
+ /* 3406 */ { MAD_F(0x06416f94) /* 0.390975549 */, 17 },
+ /* 3407 */ { MAD_F(0x06421013) /* 0.391128611 */, 17 },
+
+ /* 3408 */ { MAD_F(0x0642b096) /* 0.391281687 */, 17 },
+ /* 3409 */ { MAD_F(0x0643511d) /* 0.391434778 */, 17 },
+ /* 3410 */ { MAD_F(0x0643f1a8) /* 0.391587884 */, 17 },
+ /* 3411 */ { MAD_F(0x06449237) /* 0.391741005 */, 17 },
+ /* 3412 */ { MAD_F(0x064532ca) /* 0.391894141 */, 17 },
+ /* 3413 */ { MAD_F(0x0645d361) /* 0.392047292 */, 17 },
+ /* 3414 */ { MAD_F(0x064673fc) /* 0.392200458 */, 17 },
+ /* 3415 */ { MAD_F(0x0647149c) /* 0.392353638 */, 17 },
+ /* 3416 */ { MAD_F(0x0647b53f) /* 0.392506834 */, 17 },
+ /* 3417 */ { MAD_F(0x064855e6) /* 0.392660045 */, 17 },
+ /* 3418 */ { MAD_F(0x0648f691) /* 0.392813271 */, 17 },
+ /* 3419 */ { MAD_F(0x06499740) /* 0.392966511 */, 17 },
+ /* 3420 */ { MAD_F(0x064a37f4) /* 0.393119767 */, 17 },
+ /* 3421 */ { MAD_F(0x064ad8ab) /* 0.393273038 */, 17 },
+ /* 3422 */ { MAD_F(0x064b7966) /* 0.393426323 */, 17 },
+ /* 3423 */ { MAD_F(0x064c1a25) /* 0.393579623 */, 17 },
+
+ /* 3424 */ { MAD_F(0x064cbae9) /* 0.393732939 */, 17 },
+ /* 3425 */ { MAD_F(0x064d5bb0) /* 0.393886269 */, 17 },
+ /* 3426 */ { MAD_F(0x064dfc7b) /* 0.394039614 */, 17 },
+ /* 3427 */ { MAD_F(0x064e9d4b) /* 0.394192974 */, 17 },
+ /* 3428 */ { MAD_F(0x064f3e1e) /* 0.394346349 */, 17 },
+ /* 3429 */ { MAD_F(0x064fdef5) /* 0.394499739 */, 17 },
+ /* 3430 */ { MAD_F(0x06507fd0) /* 0.394653144 */, 17 },
+ /* 3431 */ { MAD_F(0x065120b0) /* 0.394806564 */, 17 },
+ /* 3432 */ { MAD_F(0x0651c193) /* 0.394959999 */, 17 },
+ /* 3433 */ { MAD_F(0x0652627a) /* 0.395113448 */, 17 },
+ /* 3434 */ { MAD_F(0x06530366) /* 0.395266913 */, 17 },
+ /* 3435 */ { MAD_F(0x0653a455) /* 0.395420392 */, 17 },
+ /* 3436 */ { MAD_F(0x06544548) /* 0.395573886 */, 17 },
+ /* 3437 */ { MAD_F(0x0654e640) /* 0.395727395 */, 17 },
+ /* 3438 */ { MAD_F(0x0655873b) /* 0.395880919 */, 17 },
+ /* 3439 */ { MAD_F(0x0656283a) /* 0.396034458 */, 17 },
+
+ /* 3440 */ { MAD_F(0x0656c93d) /* 0.396188012 */, 17 },
+ /* 3441 */ { MAD_F(0x06576a45) /* 0.396341581 */, 17 },
+ /* 3442 */ { MAD_F(0x06580b50) /* 0.396495164 */, 17 },
+ /* 3443 */ { MAD_F(0x0658ac5f) /* 0.396648763 */, 17 },
+ /* 3444 */ { MAD_F(0x06594d73) /* 0.396802376 */, 17 },
+ /* 3445 */ { MAD_F(0x0659ee8a) /* 0.396956004 */, 17 },
+ /* 3446 */ { MAD_F(0x065a8fa5) /* 0.397109647 */, 17 },
+ /* 3447 */ { MAD_F(0x065b30c4) /* 0.397263305 */, 17 },
+ /* 3448 */ { MAD_F(0x065bd1e7) /* 0.397416978 */, 17 },
+ /* 3449 */ { MAD_F(0x065c730f) /* 0.397570666 */, 17 },
+ /* 3450 */ { MAD_F(0x065d143a) /* 0.397724368 */, 17 },
+ /* 3451 */ { MAD_F(0x065db569) /* 0.397878085 */, 17 },
+ /* 3452 */ { MAD_F(0x065e569c) /* 0.398031818 */, 17 },
+ /* 3453 */ { MAD_F(0x065ef7d3) /* 0.398185565 */, 17 },
+ /* 3454 */ { MAD_F(0x065f990e) /* 0.398339326 */, 17 },
+ /* 3455 */ { MAD_F(0x06603a4e) /* 0.398493103 */, 17 },
+
+ /* 3456 */ { MAD_F(0x0660db91) /* 0.398646895 */, 17 },
+ /* 3457 */ { MAD_F(0x06617cd8) /* 0.398800701 */, 17 },
+ /* 3458 */ { MAD_F(0x06621e23) /* 0.398954522 */, 17 },
+ /* 3459 */ { MAD_F(0x0662bf72) /* 0.399108358 */, 17 },
+ /* 3460 */ { MAD_F(0x066360c5) /* 0.399262209 */, 17 },
+ /* 3461 */ { MAD_F(0x0664021c) /* 0.399416075 */, 17 },
+ /* 3462 */ { MAD_F(0x0664a377) /* 0.399569955 */, 17 },
+ /* 3463 */ { MAD_F(0x066544d6) /* 0.399723851 */, 17 },
+ /* 3464 */ { MAD_F(0x0665e639) /* 0.399877761 */, 17 },
+ /* 3465 */ { MAD_F(0x066687a0) /* 0.400031686 */, 17 },
+ /* 3466 */ { MAD_F(0x0667290b) /* 0.400185625 */, 17 },
+ /* 3467 */ { MAD_F(0x0667ca79) /* 0.400339580 */, 17 },
+ /* 3468 */ { MAD_F(0x06686bec) /* 0.400493549 */, 17 },
+ /* 3469 */ { MAD_F(0x06690d63) /* 0.400647534 */, 17 },
+ /* 3470 */ { MAD_F(0x0669aede) /* 0.400801533 */, 17 },
+ /* 3471 */ { MAD_F(0x066a505d) /* 0.400955546 */, 17 },
+
+ /* 3472 */ { MAD_F(0x066af1df) /* 0.401109575 */, 17 },
+ /* 3473 */ { MAD_F(0x066b9366) /* 0.401263618 */, 17 },
+ /* 3474 */ { MAD_F(0x066c34f1) /* 0.401417676 */, 17 },
+ /* 3475 */ { MAD_F(0x066cd67f) /* 0.401571749 */, 17 },
+ /* 3476 */ { MAD_F(0x066d7812) /* 0.401725837 */, 17 },
+ /* 3477 */ { MAD_F(0x066e19a9) /* 0.401879939 */, 17 },
+ /* 3478 */ { MAD_F(0x066ebb43) /* 0.402034056 */, 17 },
+ /* 3479 */ { MAD_F(0x066f5ce2) /* 0.402188188 */, 17 },
+ /* 3480 */ { MAD_F(0x066ffe84) /* 0.402342335 */, 17 },
+ /* 3481 */ { MAD_F(0x0670a02a) /* 0.402496497 */, 17 },
+ /* 3482 */ { MAD_F(0x067141d5) /* 0.402650673 */, 17 },
+ /* 3483 */ { MAD_F(0x0671e383) /* 0.402804864 */, 17 },
+ /* 3484 */ { MAD_F(0x06728535) /* 0.402959070 */, 17 },
+ /* 3485 */ { MAD_F(0x067326ec) /* 0.403113291 */, 17 },
+ /* 3486 */ { MAD_F(0x0673c8a6) /* 0.403267526 */, 17 },
+ /* 3487 */ { MAD_F(0x06746a64) /* 0.403421776 */, 17 },
+
+ /* 3488 */ { MAD_F(0x06750c26) /* 0.403576041 */, 17 },
+ /* 3489 */ { MAD_F(0x0675adec) /* 0.403730320 */, 17 },
+ /* 3490 */ { MAD_F(0x06764fb6) /* 0.403884615 */, 17 },
+ /* 3491 */ { MAD_F(0x0676f184) /* 0.404038924 */, 17 },
+ /* 3492 */ { MAD_F(0x06779356) /* 0.404193247 */, 17 },
+ /* 3493 */ { MAD_F(0x0678352c) /* 0.404347586 */, 17 },
+ /* 3494 */ { MAD_F(0x0678d706) /* 0.404501939 */, 17 },
+ /* 3495 */ { MAD_F(0x067978e4) /* 0.404656307 */, 17 },
+ /* 3496 */ { MAD_F(0x067a1ac6) /* 0.404810690 */, 17 },
+ /* 3497 */ { MAD_F(0x067abcac) /* 0.404965087 */, 17 },
+ /* 3498 */ { MAD_F(0x067b5e95) /* 0.405119499 */, 17 },
+ /* 3499 */ { MAD_F(0x067c0083) /* 0.405273926 */, 17 },
+ /* 3500 */ { MAD_F(0x067ca275) /* 0.405428368 */, 17 },
+ /* 3501 */ { MAD_F(0x067d446a) /* 0.405582824 */, 17 },
+ /* 3502 */ { MAD_F(0x067de664) /* 0.405737295 */, 17 },
+ /* 3503 */ { MAD_F(0x067e8861) /* 0.405891781 */, 17 },
+
+ /* 3504 */ { MAD_F(0x067f2a62) /* 0.406046281 */, 17 },
+ /* 3505 */ { MAD_F(0x067fcc68) /* 0.406200796 */, 17 },
+ /* 3506 */ { MAD_F(0x06806e71) /* 0.406355326 */, 17 },
+ /* 3507 */ { MAD_F(0x0681107e) /* 0.406509870 */, 17 },
+ /* 3508 */ { MAD_F(0x0681b28f) /* 0.406664429 */, 17 },
+ /* 3509 */ { MAD_F(0x068254a4) /* 0.406819003 */, 17 },
+ /* 3510 */ { MAD_F(0x0682f6bd) /* 0.406973592 */, 17 },
+ /* 3511 */ { MAD_F(0x068398da) /* 0.407128195 */, 17 },
+ /* 3512 */ { MAD_F(0x06843afb) /* 0.407282813 */, 17 },
+ /* 3513 */ { MAD_F(0x0684dd20) /* 0.407437445 */, 17 },
+ /* 3514 */ { MAD_F(0x06857f49) /* 0.407592093 */, 17 },
+ /* 3515 */ { MAD_F(0x06862176) /* 0.407746754 */, 17 },
+ /* 3516 */ { MAD_F(0x0686c3a6) /* 0.407901431 */, 17 },
+ /* 3517 */ { MAD_F(0x068765db) /* 0.408056122 */, 17 },
+ /* 3518 */ { MAD_F(0x06880814) /* 0.408210828 */, 17 },
+ /* 3519 */ { MAD_F(0x0688aa50) /* 0.408365549 */, 17 },
+
+ /* 3520 */ { MAD_F(0x06894c90) /* 0.408520284 */, 17 },
+ /* 3521 */ { MAD_F(0x0689eed5) /* 0.408675034 */, 17 },
+ /* 3522 */ { MAD_F(0x068a911d) /* 0.408829798 */, 17 },
+ /* 3523 */ { MAD_F(0x068b3369) /* 0.408984577 */, 17 },
+ /* 3524 */ { MAD_F(0x068bd5b9) /* 0.409139371 */, 17 },
+ /* 3525 */ { MAD_F(0x068c780e) /* 0.409294180 */, 17 },
+ /* 3526 */ { MAD_F(0x068d1a66) /* 0.409449003 */, 17 },
+ /* 3527 */ { MAD_F(0x068dbcc1) /* 0.409603840 */, 17 },
+ /* 3528 */ { MAD_F(0x068e5f21) /* 0.409758693 */, 17 },
+ /* 3529 */ { MAD_F(0x068f0185) /* 0.409913560 */, 17 },
+ /* 3530 */ { MAD_F(0x068fa3ed) /* 0.410068441 */, 17 },
+ /* 3531 */ { MAD_F(0x06904658) /* 0.410223338 */, 17 },
+ /* 3532 */ { MAD_F(0x0690e8c8) /* 0.410378249 */, 17 },
+ /* 3533 */ { MAD_F(0x06918b3c) /* 0.410533174 */, 17 },
+ /* 3534 */ { MAD_F(0x06922db3) /* 0.410688114 */, 17 },
+ /* 3535 */ { MAD_F(0x0692d02e) /* 0.410843069 */, 17 },
+
+ /* 3536 */ { MAD_F(0x069372ae) /* 0.410998038 */, 17 },
+ /* 3537 */ { MAD_F(0x06941531) /* 0.411153022 */, 17 },
+ /* 3538 */ { MAD_F(0x0694b7b8) /* 0.411308021 */, 17 },
+ /* 3539 */ { MAD_F(0x06955a43) /* 0.411463034 */, 17 },
+ /* 3540 */ { MAD_F(0x0695fcd2) /* 0.411618062 */, 17 },
+ /* 3541 */ { MAD_F(0x06969f65) /* 0.411773104 */, 17 },
+ /* 3542 */ { MAD_F(0x069741fb) /* 0.411928161 */, 17 },
+ /* 3543 */ { MAD_F(0x0697e496) /* 0.412083232 */, 17 },
+ /* 3544 */ { MAD_F(0x06988735) /* 0.412238319 */, 17 },
+ /* 3545 */ { MAD_F(0x069929d7) /* 0.412393419 */, 17 },
+ /* 3546 */ { MAD_F(0x0699cc7e) /* 0.412548535 */, 17 },
+ /* 3547 */ { MAD_F(0x069a6f28) /* 0.412703664 */, 17 },
+ /* 3548 */ { MAD_F(0x069b11d6) /* 0.412858809 */, 17 },
+ /* 3549 */ { MAD_F(0x069bb489) /* 0.413013968 */, 17 },
+ /* 3550 */ { MAD_F(0x069c573f) /* 0.413169142 */, 17 },
+ /* 3551 */ { MAD_F(0x069cf9f9) /* 0.413324330 */, 17 },
+
+ /* 3552 */ { MAD_F(0x069d9cb7) /* 0.413479532 */, 17 },
+ /* 3553 */ { MAD_F(0x069e3f78) /* 0.413634750 */, 17 },
+ /* 3554 */ { MAD_F(0x069ee23e) /* 0.413789982 */, 17 },
+ /* 3555 */ { MAD_F(0x069f8508) /* 0.413945228 */, 17 },
+ /* 3556 */ { MAD_F(0x06a027d5) /* 0.414100489 */, 17 },
+ /* 3557 */ { MAD_F(0x06a0caa7) /* 0.414255765 */, 17 },
+ /* 3558 */ { MAD_F(0x06a16d7c) /* 0.414411055 */, 17 },
+ /* 3559 */ { MAD_F(0x06a21055) /* 0.414566359 */, 17 },
+ /* 3560 */ { MAD_F(0x06a2b333) /* 0.414721679 */, 17 },
+ /* 3561 */ { MAD_F(0x06a35614) /* 0.414877012 */, 17 },
+ /* 3562 */ { MAD_F(0x06a3f8f9) /* 0.415032361 */, 17 },
+ /* 3563 */ { MAD_F(0x06a49be2) /* 0.415187723 */, 17 },
+ /* 3564 */ { MAD_F(0x06a53ece) /* 0.415343101 */, 17 },
+ /* 3565 */ { MAD_F(0x06a5e1bf) /* 0.415498493 */, 17 },
+ /* 3566 */ { MAD_F(0x06a684b4) /* 0.415653899 */, 17 },
+ /* 3567 */ { MAD_F(0x06a727ac) /* 0.415809320 */, 17 },
+
+ /* 3568 */ { MAD_F(0x06a7caa9) /* 0.415964756 */, 17 },
+ /* 3569 */ { MAD_F(0x06a86da9) /* 0.416120206 */, 17 },
+ /* 3570 */ { MAD_F(0x06a910ad) /* 0.416275670 */, 17 },
+ /* 3571 */ { MAD_F(0x06a9b3b5) /* 0.416431149 */, 17 },
+ /* 3572 */ { MAD_F(0x06aa56c1) /* 0.416586643 */, 17 },
+ /* 3573 */ { MAD_F(0x06aaf9d1) /* 0.416742151 */, 17 },
+ /* 3574 */ { MAD_F(0x06ab9ce5) /* 0.416897673 */, 17 },
+ /* 3575 */ { MAD_F(0x06ac3ffc) /* 0.417053210 */, 17 },
+ /* 3576 */ { MAD_F(0x06ace318) /* 0.417208762 */, 17 },
+ /* 3577 */ { MAD_F(0x06ad8637) /* 0.417364328 */, 17 },
+ /* 3578 */ { MAD_F(0x06ae295b) /* 0.417519909 */, 17 },
+ /* 3579 */ { MAD_F(0x06aecc82) /* 0.417675504 */, 17 },
+ /* 3580 */ { MAD_F(0x06af6fad) /* 0.417831113 */, 17 },
+ /* 3581 */ { MAD_F(0x06b012dc) /* 0.417986737 */, 17 },
+ /* 3582 */ { MAD_F(0x06b0b60f) /* 0.418142376 */, 17 },
+ /* 3583 */ { MAD_F(0x06b15946) /* 0.418298029 */, 17 },
+
+ /* 3584 */ { MAD_F(0x06b1fc81) /* 0.418453696 */, 17 },
+ /* 3585 */ { MAD_F(0x06b29fbf) /* 0.418609378 */, 17 },
+ /* 3586 */ { MAD_F(0x06b34302) /* 0.418765075 */, 17 },
+ /* 3587 */ { MAD_F(0x06b3e648) /* 0.418920786 */, 17 },
+ /* 3588 */ { MAD_F(0x06b48992) /* 0.419076511 */, 17 },
+ /* 3589 */ { MAD_F(0x06b52ce0) /* 0.419232251 */, 17 },
+ /* 3590 */ { MAD_F(0x06b5d032) /* 0.419388005 */, 17 },
+ /* 3591 */ { MAD_F(0x06b67388) /* 0.419543774 */, 17 },
+ /* 3592 */ { MAD_F(0x06b716e2) /* 0.419699557 */, 17 },
+ /* 3593 */ { MAD_F(0x06b7ba3f) /* 0.419855355 */, 17 },
+ /* 3594 */ { MAD_F(0x06b85da1) /* 0.420011167 */, 17 },
+ /* 3595 */ { MAD_F(0x06b90106) /* 0.420166994 */, 17 },
+ /* 3596 */ { MAD_F(0x06b9a470) /* 0.420322835 */, 17 },
+ /* 3597 */ { MAD_F(0x06ba47dd) /* 0.420478690 */, 17 },
+ /* 3598 */ { MAD_F(0x06baeb4e) /* 0.420634560 */, 17 },
+ /* 3599 */ { MAD_F(0x06bb8ec3) /* 0.420790445 */, 17 },
+
+ /* 3600 */ { MAD_F(0x06bc323b) /* 0.420946343 */, 17 },
+ /* 3601 */ { MAD_F(0x06bcd5b8) /* 0.421102257 */, 17 },
+ /* 3602 */ { MAD_F(0x06bd7939) /* 0.421258184 */, 17 },
+ /* 3603 */ { MAD_F(0x06be1cbd) /* 0.421414127 */, 17 },
+ /* 3604 */ { MAD_F(0x06bec045) /* 0.421570083 */, 17 },
+ /* 3605 */ { MAD_F(0x06bf63d1) /* 0.421726054 */, 17 },
+ /* 3606 */ { MAD_F(0x06c00761) /* 0.421882040 */, 17 },
+ /* 3607 */ { MAD_F(0x06c0aaf5) /* 0.422038039 */, 17 },
+ /* 3608 */ { MAD_F(0x06c14e8d) /* 0.422194054 */, 17 },
+ /* 3609 */ { MAD_F(0x06c1f229) /* 0.422350082 */, 17 },
+ /* 3610 */ { MAD_F(0x06c295c8) /* 0.422506125 */, 17 },
+ /* 3611 */ { MAD_F(0x06c3396c) /* 0.422662183 */, 17 },
+ /* 3612 */ { MAD_F(0x06c3dd13) /* 0.422818255 */, 17 },
+ /* 3613 */ { MAD_F(0x06c480be) /* 0.422974341 */, 17 },
+ /* 3614 */ { MAD_F(0x06c5246d) /* 0.423130442 */, 17 },
+ /* 3615 */ { MAD_F(0x06c5c820) /* 0.423286557 */, 17 },
+
+ /* 3616 */ { MAD_F(0x06c66bd6) /* 0.423442686 */, 17 },
+ /* 3617 */ { MAD_F(0x06c70f91) /* 0.423598830 */, 17 },
+ /* 3618 */ { MAD_F(0x06c7b34f) /* 0.423754988 */, 17 },
+ /* 3619 */ { MAD_F(0x06c85712) /* 0.423911161 */, 17 },
+ /* 3620 */ { MAD_F(0x06c8fad8) /* 0.424067348 */, 17 },
+ /* 3621 */ { MAD_F(0x06c99ea2) /* 0.424223550 */, 17 },
+ /* 3622 */ { MAD_F(0x06ca4270) /* 0.424379765 */, 17 },
+ /* 3623 */ { MAD_F(0x06cae641) /* 0.424535996 */, 17 },
+ /* 3624 */ { MAD_F(0x06cb8a17) /* 0.424692240 */, 17 },
+ /* 3625 */ { MAD_F(0x06cc2df0) /* 0.424848499 */, 17 },
+ /* 3626 */ { MAD_F(0x06ccd1ce) /* 0.425004772 */, 17 },
+ /* 3627 */ { MAD_F(0x06cd75af) /* 0.425161060 */, 17 },
+ /* 3628 */ { MAD_F(0x06ce1994) /* 0.425317362 */, 17 },
+ /* 3629 */ { MAD_F(0x06cebd7d) /* 0.425473678 */, 17 },
+ /* 3630 */ { MAD_F(0x06cf6169) /* 0.425630009 */, 17 },
+ /* 3631 */ { MAD_F(0x06d0055a) /* 0.425786354 */, 17 },
+
+ /* 3632 */ { MAD_F(0x06d0a94e) /* 0.425942714 */, 17 },
+ /* 3633 */ { MAD_F(0x06d14d47) /* 0.426099088 */, 17 },
+ /* 3634 */ { MAD_F(0x06d1f143) /* 0.426255476 */, 17 },
+ /* 3635 */ { MAD_F(0x06d29543) /* 0.426411878 */, 17 },
+ /* 3636 */ { MAD_F(0x06d33947) /* 0.426568295 */, 17 },
+ /* 3637 */ { MAD_F(0x06d3dd4e) /* 0.426724726 */, 17 },
+ /* 3638 */ { MAD_F(0x06d4815a) /* 0.426881172 */, 17 },
+ /* 3639 */ { MAD_F(0x06d52569) /* 0.427037632 */, 17 },
+ /* 3640 */ { MAD_F(0x06d5c97c) /* 0.427194106 */, 17 },
+ /* 3641 */ { MAD_F(0x06d66d93) /* 0.427350594 */, 17 },
+ /* 3642 */ { MAD_F(0x06d711ae) /* 0.427507097 */, 17 },
+ /* 3643 */ { MAD_F(0x06d7b5cd) /* 0.427663614 */, 17 },
+ /* 3644 */ { MAD_F(0x06d859f0) /* 0.427820146 */, 17 },
+ /* 3645 */ { MAD_F(0x06d8fe16) /* 0.427976692 */, 17 },
+ /* 3646 */ { MAD_F(0x06d9a240) /* 0.428133252 */, 17 },
+ /* 3647 */ { MAD_F(0x06da466f) /* 0.428289826 */, 17 },
+
+ /* 3648 */ { MAD_F(0x06daeaa1) /* 0.428446415 */, 17 },
+ /* 3649 */ { MAD_F(0x06db8ed6) /* 0.428603018 */, 17 },
+ /* 3650 */ { MAD_F(0x06dc3310) /* 0.428759635 */, 17 },
+ /* 3651 */ { MAD_F(0x06dcd74d) /* 0.428916267 */, 17 },
+ /* 3652 */ { MAD_F(0x06dd7b8f) /* 0.429072913 */, 17 },
+ /* 3653 */ { MAD_F(0x06de1fd4) /* 0.429229573 */, 17 },
+ /* 3654 */ { MAD_F(0x06dec41d) /* 0.429386248 */, 17 },
+ /* 3655 */ { MAD_F(0x06df686a) /* 0.429542937 */, 17 },
+ /* 3656 */ { MAD_F(0x06e00cbb) /* 0.429699640 */, 17 },
+ /* 3657 */ { MAD_F(0x06e0b10f) /* 0.429856357 */, 17 },
+ /* 3658 */ { MAD_F(0x06e15567) /* 0.430013089 */, 17 },
+ /* 3659 */ { MAD_F(0x06e1f9c4) /* 0.430169835 */, 17 },
+ /* 3660 */ { MAD_F(0x06e29e24) /* 0.430326595 */, 17 },
+ /* 3661 */ { MAD_F(0x06e34287) /* 0.430483370 */, 17 },
+ /* 3662 */ { MAD_F(0x06e3e6ef) /* 0.430640159 */, 17 },
+ /* 3663 */ { MAD_F(0x06e48b5b) /* 0.430796962 */, 17 },
+
+ /* 3664 */ { MAD_F(0x06e52fca) /* 0.430953779 */, 17 },
+ /* 3665 */ { MAD_F(0x06e5d43d) /* 0.431110611 */, 17 },
+ /* 3666 */ { MAD_F(0x06e678b4) /* 0.431267457 */, 17 },
+ /* 3667 */ { MAD_F(0x06e71d2f) /* 0.431424317 */, 17 },
+ /* 3668 */ { MAD_F(0x06e7c1ae) /* 0.431581192 */, 17 },
+ /* 3669 */ { MAD_F(0x06e86630) /* 0.431738080 */, 17 },
+ /* 3670 */ { MAD_F(0x06e90ab7) /* 0.431894983 */, 17 },
+ /* 3671 */ { MAD_F(0x06e9af41) /* 0.432051900 */, 17 },
+ /* 3672 */ { MAD_F(0x06ea53cf) /* 0.432208832 */, 17 },
+ /* 3673 */ { MAD_F(0x06eaf860) /* 0.432365778 */, 17 },
+ /* 3674 */ { MAD_F(0x06eb9cf6) /* 0.432522737 */, 17 },
+ /* 3675 */ { MAD_F(0x06ec418f) /* 0.432679712 */, 17 },
+ /* 3676 */ { MAD_F(0x06ece62d) /* 0.432836700 */, 17 },
+ /* 3677 */ { MAD_F(0x06ed8ace) /* 0.432993703 */, 17 },
+ /* 3678 */ { MAD_F(0x06ee2f73) /* 0.433150720 */, 17 },
+ /* 3679 */ { MAD_F(0x06eed41b) /* 0.433307751 */, 17 },
+
+ /* 3680 */ { MAD_F(0x06ef78c8) /* 0.433464796 */, 17 },
+ /* 3681 */ { MAD_F(0x06f01d78) /* 0.433621856 */, 17 },
+ /* 3682 */ { MAD_F(0x06f0c22c) /* 0.433778929 */, 17 },
+ /* 3683 */ { MAD_F(0x06f166e4) /* 0.433936017 */, 17 },
+ /* 3684 */ { MAD_F(0x06f20ba0) /* 0.434093120 */, 17 },
+ /* 3685 */ { MAD_F(0x06f2b060) /* 0.434250236 */, 17 },
+ /* 3686 */ { MAD_F(0x06f35523) /* 0.434407367 */, 17 },
+ /* 3687 */ { MAD_F(0x06f3f9eb) /* 0.434564512 */, 17 },
+ /* 3688 */ { MAD_F(0x06f49eb6) /* 0.434721671 */, 17 },
+ /* 3689 */ { MAD_F(0x06f54385) /* 0.434878844 */, 17 },
+ /* 3690 */ { MAD_F(0x06f5e857) /* 0.435036032 */, 17 },
+ /* 3691 */ { MAD_F(0x06f68d2e) /* 0.435193233 */, 17 },
+ /* 3692 */ { MAD_F(0x06f73208) /* 0.435350449 */, 17 },
+ /* 3693 */ { MAD_F(0x06f7d6e6) /* 0.435507679 */, 17 },
+ /* 3694 */ { MAD_F(0x06f87bc8) /* 0.435664924 */, 17 },
+ /* 3695 */ { MAD_F(0x06f920ae) /* 0.435822182 */, 17 },
+
+ /* 3696 */ { MAD_F(0x06f9c597) /* 0.435979455 */, 17 },
+ /* 3697 */ { MAD_F(0x06fa6a85) /* 0.436136741 */, 17 },
+ /* 3698 */ { MAD_F(0x06fb0f76) /* 0.436294042 */, 17 },
+ /* 3699 */ { MAD_F(0x06fbb46b) /* 0.436451358 */, 17 },
+ /* 3700 */ { MAD_F(0x06fc5964) /* 0.436608687 */, 17 },
+ /* 3701 */ { MAD_F(0x06fcfe60) /* 0.436766031 */, 17 },
+ /* 3702 */ { MAD_F(0x06fda361) /* 0.436923388 */, 17 },
+ /* 3703 */ { MAD_F(0x06fe4865) /* 0.437080760 */, 17 },
+ /* 3704 */ { MAD_F(0x06feed6d) /* 0.437238146 */, 17 },
+ /* 3705 */ { MAD_F(0x06ff9279) /* 0.437395547 */, 17 },
+ /* 3706 */ { MAD_F(0x07003788) /* 0.437552961 */, 17 },
+ /* 3707 */ { MAD_F(0x0700dc9c) /* 0.437710389 */, 17 },
+ /* 3708 */ { MAD_F(0x070181b3) /* 0.437867832 */, 17 },
+ /* 3709 */ { MAD_F(0x070226ce) /* 0.438025289 */, 17 },
+ /* 3710 */ { MAD_F(0x0702cbed) /* 0.438182760 */, 17 },
+ /* 3711 */ { MAD_F(0x0703710f) /* 0.438340245 */, 17 },
+
+ /* 3712 */ { MAD_F(0x07041636) /* 0.438497744 */, 17 },
+ /* 3713 */ { MAD_F(0x0704bb60) /* 0.438655258 */, 17 },
+ /* 3714 */ { MAD_F(0x0705608e) /* 0.438812785 */, 17 },
+ /* 3715 */ { MAD_F(0x070605c0) /* 0.438970327 */, 17 },
+ /* 3716 */ { MAD_F(0x0706aaf5) /* 0.439127883 */, 17 },
+ /* 3717 */ { MAD_F(0x0707502f) /* 0.439285453 */, 17 },
+ /* 3718 */ { MAD_F(0x0707f56c) /* 0.439443037 */, 17 },
+ /* 3719 */ { MAD_F(0x07089aad) /* 0.439600635 */, 17 },
+ /* 3720 */ { MAD_F(0x07093ff2) /* 0.439758248 */, 17 },
+ /* 3721 */ { MAD_F(0x0709e53a) /* 0.439915874 */, 17 },
+ /* 3722 */ { MAD_F(0x070a8a86) /* 0.440073515 */, 17 },
+ /* 3723 */ { MAD_F(0x070b2fd7) /* 0.440231170 */, 17 },
+ /* 3724 */ { MAD_F(0x070bd52a) /* 0.440388839 */, 17 },
+ /* 3725 */ { MAD_F(0x070c7a82) /* 0.440546522 */, 17 },
+ /* 3726 */ { MAD_F(0x070d1fde) /* 0.440704219 */, 17 },
+ /* 3727 */ { MAD_F(0x070dc53d) /* 0.440861930 */, 17 },
+
+ /* 3728 */ { MAD_F(0x070e6aa0) /* 0.441019655 */, 17 },
+ /* 3729 */ { MAD_F(0x070f1007) /* 0.441177395 */, 17 },
+ /* 3730 */ { MAD_F(0x070fb571) /* 0.441335148 */, 17 },
+ /* 3731 */ { MAD_F(0x07105ae0) /* 0.441492916 */, 17 },
+ /* 3732 */ { MAD_F(0x07110052) /* 0.441650697 */, 17 },
+ /* 3733 */ { MAD_F(0x0711a5c8) /* 0.441808493 */, 17 },
+ /* 3734 */ { MAD_F(0x07124b42) /* 0.441966303 */, 17 },
+ /* 3735 */ { MAD_F(0x0712f0bf) /* 0.442124127 */, 17 },
+ /* 3736 */ { MAD_F(0x07139641) /* 0.442281965 */, 17 },
+ /* 3737 */ { MAD_F(0x07143bc6) /* 0.442439817 */, 17 },
+ /* 3738 */ { MAD_F(0x0714e14f) /* 0.442597683 */, 17 },
+ /* 3739 */ { MAD_F(0x071586db) /* 0.442755564 */, 17 },
+ /* 3740 */ { MAD_F(0x07162c6c) /* 0.442913458 */, 17 },
+ /* 3741 */ { MAD_F(0x0716d200) /* 0.443071366 */, 17 },
+ /* 3742 */ { MAD_F(0x07177798) /* 0.443229289 */, 17 },
+ /* 3743 */ { MAD_F(0x07181d34) /* 0.443387226 */, 17 },
+
+ /* 3744 */ { MAD_F(0x0718c2d3) /* 0.443545176 */, 17 },
+ /* 3745 */ { MAD_F(0x07196877) /* 0.443703141 */, 17 },
+ /* 3746 */ { MAD_F(0x071a0e1e) /* 0.443861120 */, 17 },
+ /* 3747 */ { MAD_F(0x071ab3c9) /* 0.444019113 */, 17 },
+ /* 3748 */ { MAD_F(0x071b5977) /* 0.444177119 */, 17 },
+ /* 3749 */ { MAD_F(0x071bff2a) /* 0.444335140 */, 17 },
+ /* 3750 */ { MAD_F(0x071ca4e0) /* 0.444493175 */, 17 },
+ /* 3751 */ { MAD_F(0x071d4a9a) /* 0.444651224 */, 17 },
+ /* 3752 */ { MAD_F(0x071df058) /* 0.444809288 */, 17 },
+ /* 3753 */ { MAD_F(0x071e9619) /* 0.444967365 */, 17 },
+ /* 3754 */ { MAD_F(0x071f3bde) /* 0.445125456 */, 17 },
+ /* 3755 */ { MAD_F(0x071fe1a8) /* 0.445283561 */, 17 },
+ /* 3756 */ { MAD_F(0x07208774) /* 0.445441680 */, 17 },
+ /* 3757 */ { MAD_F(0x07212d45) /* 0.445599814 */, 17 },
+ /* 3758 */ { MAD_F(0x0721d319) /* 0.445757961 */, 17 },
+ /* 3759 */ { MAD_F(0x072278f1) /* 0.445916122 */, 17 },
+
+ /* 3760 */ { MAD_F(0x07231ecd) /* 0.446074298 */, 17 },
+ /* 3761 */ { MAD_F(0x0723c4ad) /* 0.446232487 */, 17 },
+ /* 3762 */ { MAD_F(0x07246a90) /* 0.446390690 */, 17 },
+ /* 3763 */ { MAD_F(0x07251077) /* 0.446548908 */, 17 },
+ /* 3764 */ { MAD_F(0x0725b662) /* 0.446707139 */, 17 },
+ /* 3765 */ { MAD_F(0x07265c51) /* 0.446865385 */, 17 },
+ /* 3766 */ { MAD_F(0x07270244) /* 0.447023644 */, 17 },
+ /* 3767 */ { MAD_F(0x0727a83a) /* 0.447181918 */, 17 },
+ /* 3768 */ { MAD_F(0x07284e34) /* 0.447340205 */, 17 },
+ /* 3769 */ { MAD_F(0x0728f431) /* 0.447498507 */, 17 },
+ /* 3770 */ { MAD_F(0x07299a33) /* 0.447656822 */, 17 },
+ /* 3771 */ { MAD_F(0x072a4038) /* 0.447815152 */, 17 },
+ /* 3772 */ { MAD_F(0x072ae641) /* 0.447973495 */, 17 },
+ /* 3773 */ { MAD_F(0x072b8c4e) /* 0.448131853 */, 17 },
+ /* 3774 */ { MAD_F(0x072c325e) /* 0.448290224 */, 17 },
+ /* 3775 */ { MAD_F(0x072cd873) /* 0.448448609 */, 17 },
+
+ /* 3776 */ { MAD_F(0x072d7e8b) /* 0.448607009 */, 17 },
+ /* 3777 */ { MAD_F(0x072e24a7) /* 0.448765422 */, 17 },
+ /* 3778 */ { MAD_F(0x072ecac6) /* 0.448923850 */, 17 },
+ /* 3779 */ { MAD_F(0x072f70e9) /* 0.449082291 */, 17 },
+ /* 3780 */ { MAD_F(0x07301710) /* 0.449240746 */, 17 },
+ /* 3781 */ { MAD_F(0x0730bd3b) /* 0.449399216 */, 17 },
+ /* 3782 */ { MAD_F(0x0731636a) /* 0.449557699 */, 17 },
+ /* 3783 */ { MAD_F(0x0732099c) /* 0.449716196 */, 17 },
+ /* 3784 */ { MAD_F(0x0732afd2) /* 0.449874708 */, 17 },
+ /* 3785 */ { MAD_F(0x0733560c) /* 0.450033233 */, 17 },
+ /* 3786 */ { MAD_F(0x0733fc49) /* 0.450191772 */, 17 },
+ /* 3787 */ { MAD_F(0x0734a28b) /* 0.450350325 */, 17 },
+ /* 3788 */ { MAD_F(0x073548d0) /* 0.450508892 */, 17 },
+ /* 3789 */ { MAD_F(0x0735ef18) /* 0.450667473 */, 17 },
+ /* 3790 */ { MAD_F(0x07369565) /* 0.450826068 */, 17 },
+ /* 3791 */ { MAD_F(0x07373bb5) /* 0.450984677 */, 17 },
+
+ /* 3792 */ { MAD_F(0x0737e209) /* 0.451143300 */, 17 },
+ /* 3793 */ { MAD_F(0x07388861) /* 0.451301937 */, 17 },
+ /* 3794 */ { MAD_F(0x07392ebc) /* 0.451460588 */, 17 },
+ /* 3795 */ { MAD_F(0x0739d51c) /* 0.451619252 */, 17 },
+ /* 3796 */ { MAD_F(0x073a7b7f) /* 0.451777931 */, 17 },
+ /* 3797 */ { MAD_F(0x073b21e5) /* 0.451936623 */, 17 },
+ /* 3798 */ { MAD_F(0x073bc850) /* 0.452095330 */, 17 },
+ /* 3799 */ { MAD_F(0x073c6ebe) /* 0.452254050 */, 17 },
+ /* 3800 */ { MAD_F(0x073d1530) /* 0.452412785 */, 17 },
+ /* 3801 */ { MAD_F(0x073dbba6) /* 0.452571533 */, 17 },
+ /* 3802 */ { MAD_F(0x073e621f) /* 0.452730295 */, 17 },
+ /* 3803 */ { MAD_F(0x073f089c) /* 0.452889071 */, 17 },
+ /* 3804 */ { MAD_F(0x073faf1d) /* 0.453047861 */, 17 },
+ /* 3805 */ { MAD_F(0x074055a2) /* 0.453206665 */, 17 },
+ /* 3806 */ { MAD_F(0x0740fc2a) /* 0.453365483 */, 17 },
+ /* 3807 */ { MAD_F(0x0741a2b6) /* 0.453524315 */, 17 },
+
+ /* 3808 */ { MAD_F(0x07424946) /* 0.453683161 */, 17 },
+ /* 3809 */ { MAD_F(0x0742efd9) /* 0.453842020 */, 17 },
+ /* 3810 */ { MAD_F(0x07439671) /* 0.454000894 */, 17 },
+ /* 3811 */ { MAD_F(0x07443d0c) /* 0.454159781 */, 17 },
+ /* 3812 */ { MAD_F(0x0744e3aa) /* 0.454318683 */, 17 },
+ /* 3813 */ { MAD_F(0x07458a4d) /* 0.454477598 */, 17 },
+ /* 3814 */ { MAD_F(0x074630f3) /* 0.454636527 */, 17 },
+ /* 3815 */ { MAD_F(0x0746d79d) /* 0.454795470 */, 17 },
+ /* 3816 */ { MAD_F(0x07477e4b) /* 0.454954427 */, 17 },
+ /* 3817 */ { MAD_F(0x074824fc) /* 0.455113397 */, 17 },
+ /* 3818 */ { MAD_F(0x0748cbb1) /* 0.455272382 */, 17 },
+ /* 3819 */ { MAD_F(0x0749726a) /* 0.455431381 */, 17 },
+ /* 3820 */ { MAD_F(0x074a1927) /* 0.455590393 */, 17 },
+ /* 3821 */ { MAD_F(0x074abfe7) /* 0.455749419 */, 17 },
+ /* 3822 */ { MAD_F(0x074b66ab) /* 0.455908459 */, 17 },
+ /* 3823 */ { MAD_F(0x074c0d73) /* 0.456067513 */, 17 },
+
+ /* 3824 */ { MAD_F(0x074cb43e) /* 0.456226581 */, 17 },
+ /* 3825 */ { MAD_F(0x074d5b0d) /* 0.456385663 */, 17 },
+ /* 3826 */ { MAD_F(0x074e01e0) /* 0.456544759 */, 17 },
+ /* 3827 */ { MAD_F(0x074ea8b7) /* 0.456703868 */, 17 },
+ /* 3828 */ { MAD_F(0x074f4f91) /* 0.456862992 */, 17 },
+ /* 3829 */ { MAD_F(0x074ff66f) /* 0.457022129 */, 17 },
+ /* 3830 */ { MAD_F(0x07509d51) /* 0.457181280 */, 17 },
+ /* 3831 */ { MAD_F(0x07514437) /* 0.457340445 */, 17 },
+ /* 3832 */ { MAD_F(0x0751eb20) /* 0.457499623 */, 17 },
+ /* 3833 */ { MAD_F(0x0752920d) /* 0.457658816 */, 17 },
+ /* 3834 */ { MAD_F(0x075338fd) /* 0.457818022 */, 17 },
+ /* 3835 */ { MAD_F(0x0753dff2) /* 0.457977243 */, 17 },
+ /* 3836 */ { MAD_F(0x075486ea) /* 0.458136477 */, 17 },
+ /* 3837 */ { MAD_F(0x07552de6) /* 0.458295725 */, 17 },
+ /* 3838 */ { MAD_F(0x0755d4e5) /* 0.458454987 */, 17 },
+ /* 3839 */ { MAD_F(0x07567be8) /* 0.458614262 */, 17 },
+
+ /* 3840 */ { MAD_F(0x075722ef) /* 0.458773552 */, 17 },
+ /* 3841 */ { MAD_F(0x0757c9fa) /* 0.458932855 */, 17 },
+ /* 3842 */ { MAD_F(0x07587108) /* 0.459092172 */, 17 },
+ /* 3843 */ { MAD_F(0x0759181a) /* 0.459251503 */, 17 },
+ /* 3844 */ { MAD_F(0x0759bf30) /* 0.459410848 */, 17 },
+ /* 3845 */ { MAD_F(0x075a664a) /* 0.459570206 */, 17 },
+ /* 3846 */ { MAD_F(0x075b0d67) /* 0.459729579 */, 17 },
+ /* 3847 */ { MAD_F(0x075bb488) /* 0.459888965 */, 17 },
+ /* 3848 */ { MAD_F(0x075c5bac) /* 0.460048365 */, 17 },
+ /* 3849 */ { MAD_F(0x075d02d5) /* 0.460207779 */, 17 },
+ /* 3850 */ { MAD_F(0x075daa01) /* 0.460367206 */, 17 },
+ /* 3851 */ { MAD_F(0x075e5130) /* 0.460526648 */, 17 },
+ /* 3852 */ { MAD_F(0x075ef864) /* 0.460686103 */, 17 },
+ /* 3853 */ { MAD_F(0x075f9f9b) /* 0.460845572 */, 17 },
+ /* 3854 */ { MAD_F(0x076046d6) /* 0.461005055 */, 17 },
+ /* 3855 */ { MAD_F(0x0760ee14) /* 0.461164552 */, 17 },
+
+ /* 3856 */ { MAD_F(0x07619557) /* 0.461324062 */, 17 },
+ /* 3857 */ { MAD_F(0x07623c9d) /* 0.461483586 */, 17 },
+ /* 3858 */ { MAD_F(0x0762e3e6) /* 0.461643124 */, 17 },
+ /* 3859 */ { MAD_F(0x07638b34) /* 0.461802676 */, 17 },
+ /* 3860 */ { MAD_F(0x07643285) /* 0.461962242 */, 17 },
+ /* 3861 */ { MAD_F(0x0764d9d9) /* 0.462121821 */, 17 },
+ /* 3862 */ { MAD_F(0x07658132) /* 0.462281414 */, 17 },
+ /* 3863 */ { MAD_F(0x0766288e) /* 0.462441021 */, 17 },
+ /* 3864 */ { MAD_F(0x0766cfee) /* 0.462600642 */, 17 },
+ /* 3865 */ { MAD_F(0x07677751) /* 0.462760276 */, 17 },
+ /* 3866 */ { MAD_F(0x07681eb9) /* 0.462919924 */, 17 },
+ /* 3867 */ { MAD_F(0x0768c624) /* 0.463079586 */, 17 },
+ /* 3868 */ { MAD_F(0x07696d92) /* 0.463239262 */, 17 },
+ /* 3869 */ { MAD_F(0x076a1505) /* 0.463398951 */, 17 },
+ /* 3870 */ { MAD_F(0x076abc7b) /* 0.463558655 */, 17 },
+ /* 3871 */ { MAD_F(0x076b63f4) /* 0.463718372 */, 17 },
+
+ /* 3872 */ { MAD_F(0x076c0b72) /* 0.463878102 */, 17 },
+ /* 3873 */ { MAD_F(0x076cb2f3) /* 0.464037847 */, 17 },
+ /* 3874 */ { MAD_F(0x076d5a78) /* 0.464197605 */, 17 },
+ /* 3875 */ { MAD_F(0x076e0200) /* 0.464357377 */, 17 },
+ /* 3876 */ { MAD_F(0x076ea98c) /* 0.464517163 */, 17 },
+ /* 3877 */ { MAD_F(0x076f511c) /* 0.464676962 */, 17 },
+ /* 3878 */ { MAD_F(0x076ff8b0) /* 0.464836776 */, 17 },
+ /* 3879 */ { MAD_F(0x0770a047) /* 0.464996603 */, 17 },
+ /* 3880 */ { MAD_F(0x077147e2) /* 0.465156443 */, 17 },
+ /* 3881 */ { MAD_F(0x0771ef80) /* 0.465316298 */, 17 },
+ /* 3882 */ { MAD_F(0x07729723) /* 0.465476166 */, 17 },
+ /* 3883 */ { MAD_F(0x07733ec9) /* 0.465636048 */, 17 },
+ /* 3884 */ { MAD_F(0x0773e672) /* 0.465795943 */, 17 },
+ /* 3885 */ { MAD_F(0x07748e20) /* 0.465955853 */, 17 },
+ /* 3886 */ { MAD_F(0x077535d1) /* 0.466115776 */, 17 },
+ /* 3887 */ { MAD_F(0x0775dd85) /* 0.466275713 */, 17 },
+
+ /* 3888 */ { MAD_F(0x0776853e) /* 0.466435663 */, 17 },
+ /* 3889 */ { MAD_F(0x07772cfa) /* 0.466595627 */, 17 },
+ /* 3890 */ { MAD_F(0x0777d4ba) /* 0.466755605 */, 17 },
+ /* 3891 */ { MAD_F(0x07787c7d) /* 0.466915597 */, 17 },
+ /* 3892 */ { MAD_F(0x07792444) /* 0.467075602 */, 17 },
+ /* 3893 */ { MAD_F(0x0779cc0f) /* 0.467235621 */, 17 },
+ /* 3894 */ { MAD_F(0x077a73dd) /* 0.467395654 */, 17 },
+ /* 3895 */ { MAD_F(0x077b1baf) /* 0.467555701 */, 17 },
+ /* 3896 */ { MAD_F(0x077bc385) /* 0.467715761 */, 17 },
+ /* 3897 */ { MAD_F(0x077c6b5f) /* 0.467875835 */, 17 },
+ /* 3898 */ { MAD_F(0x077d133c) /* 0.468035922 */, 17 },
+ /* 3899 */ { MAD_F(0x077dbb1d) /* 0.468196023 */, 17 },
+ /* 3900 */ { MAD_F(0x077e6301) /* 0.468356138 */, 17 },
+ /* 3901 */ { MAD_F(0x077f0ae9) /* 0.468516267 */, 17 },
+ /* 3902 */ { MAD_F(0x077fb2d5) /* 0.468676409 */, 17 },
+ /* 3903 */ { MAD_F(0x07805ac5) /* 0.468836565 */, 17 },
+
+ /* 3904 */ { MAD_F(0x078102b8) /* 0.468996735 */, 17 },
+ /* 3905 */ { MAD_F(0x0781aaaf) /* 0.469156918 */, 17 },
+ /* 3906 */ { MAD_F(0x078252aa) /* 0.469317115 */, 17 },
+ /* 3907 */ { MAD_F(0x0782faa8) /* 0.469477326 */, 17 },
+ /* 3908 */ { MAD_F(0x0783a2aa) /* 0.469637550 */, 17 },
+ /* 3909 */ { MAD_F(0x07844aaf) /* 0.469797788 */, 17 },
+ /* 3910 */ { MAD_F(0x0784f2b8) /* 0.469958040 */, 17 },
+ /* 3911 */ { MAD_F(0x07859ac5) /* 0.470118305 */, 17 },
+ /* 3912 */ { MAD_F(0x078642d6) /* 0.470278584 */, 17 },
+ /* 3913 */ { MAD_F(0x0786eaea) /* 0.470438877 */, 17 },
+ /* 3914 */ { MAD_F(0x07879302) /* 0.470599183 */, 17 },
+ /* 3915 */ { MAD_F(0x07883b1e) /* 0.470759503 */, 17 },
+ /* 3916 */ { MAD_F(0x0788e33d) /* 0.470919836 */, 17 },
+ /* 3917 */ { MAD_F(0x07898b60) /* 0.471080184 */, 17 },
+ /* 3918 */ { MAD_F(0x078a3386) /* 0.471240545 */, 17 },
+ /* 3919 */ { MAD_F(0x078adbb0) /* 0.471400919 */, 17 },
+
+ /* 3920 */ { MAD_F(0x078b83de) /* 0.471561307 */, 17 },
+ /* 3921 */ { MAD_F(0x078c2c10) /* 0.471721709 */, 17 },
+ /* 3922 */ { MAD_F(0x078cd445) /* 0.471882125 */, 17 },
+ /* 3923 */ { MAD_F(0x078d7c7e) /* 0.472042554 */, 17 },
+ /* 3924 */ { MAD_F(0x078e24ba) /* 0.472202996 */, 17 },
+ /* 3925 */ { MAD_F(0x078eccfb) /* 0.472363453 */, 17 },
+ /* 3926 */ { MAD_F(0x078f753e) /* 0.472523923 */, 17 },
+ /* 3927 */ { MAD_F(0x07901d86) /* 0.472684406 */, 17 },
+ /* 3928 */ { MAD_F(0x0790c5d1) /* 0.472844904 */, 17 },
+ /* 3929 */ { MAD_F(0x07916e20) /* 0.473005414 */, 17 },
+ /* 3930 */ { MAD_F(0x07921672) /* 0.473165939 */, 17 },
+ /* 3931 */ { MAD_F(0x0792bec8) /* 0.473326477 */, 17 },
+ /* 3932 */ { MAD_F(0x07936722) /* 0.473487029 */, 17 },
+ /* 3933 */ { MAD_F(0x07940f80) /* 0.473647594 */, 17 },
+ /* 3934 */ { MAD_F(0x0794b7e1) /* 0.473808173 */, 17 },
+ /* 3935 */ { MAD_F(0x07956045) /* 0.473968765 */, 17 },
+
+ /* 3936 */ { MAD_F(0x079608ae) /* 0.474129372 */, 17 },
+ /* 3937 */ { MAD_F(0x0796b11a) /* 0.474289991 */, 17 },
+ /* 3938 */ { MAD_F(0x0797598a) /* 0.474450625 */, 17 },
+ /* 3939 */ { MAD_F(0x079801fd) /* 0.474611272 */, 17 },
+ /* 3940 */ { MAD_F(0x0798aa74) /* 0.474771932 */, 17 },
+ /* 3941 */ { MAD_F(0x079952ee) /* 0.474932606 */, 17 },
+ /* 3942 */ { MAD_F(0x0799fb6d) /* 0.475093294 */, 17 },
+ /* 3943 */ { MAD_F(0x079aa3ef) /* 0.475253995 */, 17 },
+ /* 3944 */ { MAD_F(0x079b4c74) /* 0.475414710 */, 17 },
+ /* 3945 */ { MAD_F(0x079bf4fd) /* 0.475575439 */, 17 },
+ /* 3946 */ { MAD_F(0x079c9d8a) /* 0.475736181 */, 17 },
+ /* 3947 */ { MAD_F(0x079d461b) /* 0.475896936 */, 17 },
+ /* 3948 */ { MAD_F(0x079deeaf) /* 0.476057705 */, 17 },
+ /* 3949 */ { MAD_F(0x079e9747) /* 0.476218488 */, 17 },
+ /* 3950 */ { MAD_F(0x079f3fe2) /* 0.476379285 */, 17 },
+ /* 3951 */ { MAD_F(0x079fe881) /* 0.476540095 */, 17 },
+
+ /* 3952 */ { MAD_F(0x07a09124) /* 0.476700918 */, 17 },
+ /* 3953 */ { MAD_F(0x07a139ca) /* 0.476861755 */, 17 },
+ /* 3954 */ { MAD_F(0x07a1e274) /* 0.477022606 */, 17 },
+ /* 3955 */ { MAD_F(0x07a28b22) /* 0.477183470 */, 17 },
+ /* 3956 */ { MAD_F(0x07a333d3) /* 0.477344348 */, 17 },
+ /* 3957 */ { MAD_F(0x07a3dc88) /* 0.477505239 */, 17 },
+ /* 3958 */ { MAD_F(0x07a48541) /* 0.477666144 */, 17 },
+ /* 3959 */ { MAD_F(0x07a52dfd) /* 0.477827062 */, 17 },
+ /* 3960 */ { MAD_F(0x07a5d6bd) /* 0.477987994 */, 17 },
+ /* 3961 */ { MAD_F(0x07a67f80) /* 0.478148940 */, 17 },
+ /* 3962 */ { MAD_F(0x07a72847) /* 0.478309899 */, 17 },
+ /* 3963 */ { MAD_F(0x07a7d112) /* 0.478470871 */, 17 },
+ /* 3964 */ { MAD_F(0x07a879e1) /* 0.478631857 */, 17 },
+ /* 3965 */ { MAD_F(0x07a922b3) /* 0.478792857 */, 17 },
+ /* 3966 */ { MAD_F(0x07a9cb88) /* 0.478953870 */, 17 },
+ /* 3967 */ { MAD_F(0x07aa7462) /* 0.479114897 */, 17 },
+
+ /* 3968 */ { MAD_F(0x07ab1d3e) /* 0.479275937 */, 17 },
+ /* 3969 */ { MAD_F(0x07abc61f) /* 0.479436991 */, 17 },
+ /* 3970 */ { MAD_F(0x07ac6f03) /* 0.479598058 */, 17 },
+ /* 3971 */ { MAD_F(0x07ad17eb) /* 0.479759139 */, 17 },
+ /* 3972 */ { MAD_F(0x07adc0d6) /* 0.479920233 */, 17 },
+ /* 3973 */ { MAD_F(0x07ae69c6) /* 0.480081341 */, 17 },
+ /* 3974 */ { MAD_F(0x07af12b8) /* 0.480242463 */, 17 },
+ /* 3975 */ { MAD_F(0x07afbbaf) /* 0.480403598 */, 17 },
+ /* 3976 */ { MAD_F(0x07b064a8) /* 0.480564746 */, 17 },
+ /* 3977 */ { MAD_F(0x07b10da6) /* 0.480725908 */, 17 },
+ /* 3978 */ { MAD_F(0x07b1b6a7) /* 0.480887083 */, 17 },
+ /* 3979 */ { MAD_F(0x07b25fac) /* 0.481048272 */, 17 },
+ /* 3980 */ { MAD_F(0x07b308b5) /* 0.481209475 */, 17 },
+ /* 3981 */ { MAD_F(0x07b3b1c1) /* 0.481370691 */, 17 },
+ /* 3982 */ { MAD_F(0x07b45ad0) /* 0.481531920 */, 17 },
+ /* 3983 */ { MAD_F(0x07b503e4) /* 0.481693163 */, 17 },
+
+ /* 3984 */ { MAD_F(0x07b5acfb) /* 0.481854420 */, 17 },
+ /* 3985 */ { MAD_F(0x07b65615) /* 0.482015690 */, 17 },
+ /* 3986 */ { MAD_F(0x07b6ff33) /* 0.482176973 */, 17 },
+ /* 3987 */ { MAD_F(0x07b7a855) /* 0.482338270 */, 17 },
+ /* 3988 */ { MAD_F(0x07b8517b) /* 0.482499580 */, 17 },
+ /* 3989 */ { MAD_F(0x07b8faa4) /* 0.482660904 */, 17 },
+ /* 3990 */ { MAD_F(0x07b9a3d0) /* 0.482822242 */, 17 },
+ /* 3991 */ { MAD_F(0x07ba4d01) /* 0.482983592 */, 17 },
+ /* 3992 */ { MAD_F(0x07baf635) /* 0.483144957 */, 17 },
+ /* 3993 */ { MAD_F(0x07bb9f6c) /* 0.483306335 */, 17 },
+ /* 3994 */ { MAD_F(0x07bc48a7) /* 0.483467726 */, 17 },
+ /* 3995 */ { MAD_F(0x07bcf1e6) /* 0.483629131 */, 17 },
+ /* 3996 */ { MAD_F(0x07bd9b28) /* 0.483790549 */, 17 },
+ /* 3997 */ { MAD_F(0x07be446e) /* 0.483951980 */, 17 },
+ /* 3998 */ { MAD_F(0x07beedb8) /* 0.484113426 */, 17 },
+ /* 3999 */ { MAD_F(0x07bf9705) /* 0.484274884 */, 17 },
+
+ /* 4000 */ { MAD_F(0x07c04056) /* 0.484436356 */, 17 },
+ /* 4001 */ { MAD_F(0x07c0e9aa) /* 0.484597842 */, 17 },
+ /* 4002 */ { MAD_F(0x07c19302) /* 0.484759341 */, 17 },
+ /* 4003 */ { MAD_F(0x07c23c5e) /* 0.484920853 */, 17 },
+ /* 4004 */ { MAD_F(0x07c2e5bd) /* 0.485082379 */, 17 },
+ /* 4005 */ { MAD_F(0x07c38f20) /* 0.485243918 */, 17 },
+ /* 4006 */ { MAD_F(0x07c43887) /* 0.485405471 */, 17 },
+ /* 4007 */ { MAD_F(0x07c4e1f1) /* 0.485567037 */, 17 },
+ /* 4008 */ { MAD_F(0x07c58b5f) /* 0.485728617 */, 17 },
+ /* 4009 */ { MAD_F(0x07c634d0) /* 0.485890210 */, 17 },
+ /* 4010 */ { MAD_F(0x07c6de45) /* 0.486051817 */, 17 },
+ /* 4011 */ { MAD_F(0x07c787bd) /* 0.486213436 */, 17 },
+ /* 4012 */ { MAD_F(0x07c83139) /* 0.486375070 */, 17 },
+ /* 4013 */ { MAD_F(0x07c8dab9) /* 0.486536717 */, 17 },
+ /* 4014 */ { MAD_F(0x07c9843c) /* 0.486698377 */, 17 },
+ /* 4015 */ { MAD_F(0x07ca2dc3) /* 0.486860051 */, 17 },
+
+ /* 4016 */ { MAD_F(0x07cad74e) /* 0.487021738 */, 17 },
+ /* 4017 */ { MAD_F(0x07cb80dc) /* 0.487183438 */, 17 },
+ /* 4018 */ { MAD_F(0x07cc2a6e) /* 0.487345152 */, 17 },
+ /* 4019 */ { MAD_F(0x07ccd403) /* 0.487506879 */, 17 },
+ /* 4020 */ { MAD_F(0x07cd7d9c) /* 0.487668620 */, 17 },
+ /* 4021 */ { MAD_F(0x07ce2739) /* 0.487830374 */, 17 },
+ /* 4022 */ { MAD_F(0x07ced0d9) /* 0.487992142 */, 17 },
+ /* 4023 */ { MAD_F(0x07cf7a7d) /* 0.488153923 */, 17 },
+ /* 4024 */ { MAD_F(0x07d02424) /* 0.488315717 */, 17 },
+ /* 4025 */ { MAD_F(0x07d0cdcf) /* 0.488477525 */, 17 },
+ /* 4026 */ { MAD_F(0x07d1777e) /* 0.488639346 */, 17 },
+ /* 4027 */ { MAD_F(0x07d22130) /* 0.488801181 */, 17 },
+ /* 4028 */ { MAD_F(0x07d2cae5) /* 0.488963029 */, 17 },
+ /* 4029 */ { MAD_F(0x07d3749f) /* 0.489124890 */, 17 },
+ /* 4030 */ { MAD_F(0x07d41e5c) /* 0.489286765 */, 17 },
+ /* 4031 */ { MAD_F(0x07d4c81c) /* 0.489448653 */, 17 },
+
+ /* 4032 */ { MAD_F(0x07d571e0) /* 0.489610555 */, 17 },
+ /* 4033 */ { MAD_F(0x07d61ba8) /* 0.489772470 */, 17 },
+ /* 4034 */ { MAD_F(0x07d6c573) /* 0.489934398 */, 17 },
+ /* 4035 */ { MAD_F(0x07d76f42) /* 0.490096340 */, 17 },
+ /* 4036 */ { MAD_F(0x07d81915) /* 0.490258295 */, 17 },
+ /* 4037 */ { MAD_F(0x07d8c2eb) /* 0.490420263 */, 17 },
+ /* 4038 */ { MAD_F(0x07d96cc4) /* 0.490582245 */, 17 },
+ /* 4039 */ { MAD_F(0x07da16a2) /* 0.490744240 */, 17 },
+ /* 4040 */ { MAD_F(0x07dac083) /* 0.490906249 */, 17 },
+ /* 4041 */ { MAD_F(0x07db6a67) /* 0.491068271 */, 17 },
+ /* 4042 */ { MAD_F(0x07dc144f) /* 0.491230306 */, 17 },
+ /* 4043 */ { MAD_F(0x07dcbe3b) /* 0.491392355 */, 17 },
+ /* 4044 */ { MAD_F(0x07dd682a) /* 0.491554417 */, 17 },
+ /* 4045 */ { MAD_F(0x07de121d) /* 0.491716492 */, 17 },
+ /* 4046 */ { MAD_F(0x07debc13) /* 0.491878581 */, 17 },
+ /* 4047 */ { MAD_F(0x07df660d) /* 0.492040683 */, 17 },
+
+ /* 4048 */ { MAD_F(0x07e0100a) /* 0.492202799 */, 17 },
+ /* 4049 */ { MAD_F(0x07e0ba0c) /* 0.492364928 */, 17 },
+ /* 4050 */ { MAD_F(0x07e16410) /* 0.492527070 */, 17 },
+ /* 4051 */ { MAD_F(0x07e20e19) /* 0.492689225 */, 17 },
+ /* 4052 */ { MAD_F(0x07e2b824) /* 0.492851394 */, 17 },
+ /* 4053 */ { MAD_F(0x07e36234) /* 0.493013576 */, 17 },
+ /* 4054 */ { MAD_F(0x07e40c47) /* 0.493175772 */, 17 },
+ /* 4055 */ { MAD_F(0x07e4b65e) /* 0.493337981 */, 17 },
+ /* 4056 */ { MAD_F(0x07e56078) /* 0.493500203 */, 17 },
+ /* 4057 */ { MAD_F(0x07e60a95) /* 0.493662438 */, 17 },
+ /* 4058 */ { MAD_F(0x07e6b4b7) /* 0.493824687 */, 17 },
+ /* 4059 */ { MAD_F(0x07e75edc) /* 0.493986949 */, 17 },
+ /* 4060 */ { MAD_F(0x07e80904) /* 0.494149225 */, 17 },
+ /* 4061 */ { MAD_F(0x07e8b330) /* 0.494311514 */, 17 },
+ /* 4062 */ { MAD_F(0x07e95d60) /* 0.494473816 */, 17 },
+ /* 4063 */ { MAD_F(0x07ea0793) /* 0.494636131 */, 17 },
+
+ /* 4064 */ { MAD_F(0x07eab1ca) /* 0.494798460 */, 17 },
+ /* 4065 */ { MAD_F(0x07eb5c04) /* 0.494960802 */, 17 },
+ /* 4066 */ { MAD_F(0x07ec0642) /* 0.495123158 */, 17 },
+ /* 4067 */ { MAD_F(0x07ecb084) /* 0.495285526 */, 17 },
+ /* 4068 */ { MAD_F(0x07ed5ac9) /* 0.495447908 */, 17 },
+ /* 4069 */ { MAD_F(0x07ee0512) /* 0.495610304 */, 17 },
+ /* 4070 */ { MAD_F(0x07eeaf5e) /* 0.495772712 */, 17 },
+ /* 4071 */ { MAD_F(0x07ef59ae) /* 0.495935134 */, 17 },
+ /* 4072 */ { MAD_F(0x07f00401) /* 0.496097570 */, 17 },
+ /* 4073 */ { MAD_F(0x07f0ae58) /* 0.496260018 */, 17 },
+ /* 4074 */ { MAD_F(0x07f158b3) /* 0.496422480 */, 17 },
+ /* 4075 */ { MAD_F(0x07f20311) /* 0.496584955 */, 17 },
+ /* 4076 */ { MAD_F(0x07f2ad72) /* 0.496747444 */, 17 },
+ /* 4077 */ { MAD_F(0x07f357d8) /* 0.496909945 */, 17 },
+ /* 4078 */ { MAD_F(0x07f40240) /* 0.497072460 */, 17 },
+ /* 4079 */ { MAD_F(0x07f4acad) /* 0.497234989 */, 17 },
+
+ /* 4080 */ { MAD_F(0x07f5571d) /* 0.497397530 */, 17 },
+ /* 4081 */ { MAD_F(0x07f60190) /* 0.497560085 */, 17 },
+ /* 4082 */ { MAD_F(0x07f6ac07) /* 0.497722653 */, 17 },
+ /* 4083 */ { MAD_F(0x07f75682) /* 0.497885235 */, 17 },
+ /* 4084 */ { MAD_F(0x07f80100) /* 0.498047829 */, 17 },
+ /* 4085 */ { MAD_F(0x07f8ab82) /* 0.498210437 */, 17 },
+ /* 4086 */ { MAD_F(0x07f95607) /* 0.498373058 */, 17 },
+ /* 4087 */ { MAD_F(0x07fa0090) /* 0.498535693 */, 17 },
+ /* 4088 */ { MAD_F(0x07faab1c) /* 0.498698341 */, 17 },
+ /* 4089 */ { MAD_F(0x07fb55ac) /* 0.498861002 */, 17 },
+ /* 4090 */ { MAD_F(0x07fc0040) /* 0.499023676 */, 17 },
+ /* 4091 */ { MAD_F(0x07fcaad7) /* 0.499186364 */, 17 },
+ /* 4092 */ { MAD_F(0x07fd5572) /* 0.499349064 */, 17 },
+ /* 4093 */ { MAD_F(0x07fe0010) /* 0.499511778 */, 17 },
+ /* 4094 */ { MAD_F(0x07feaab2) /* 0.499674506 */, 17 },
+ /* 4095 */ { MAD_F(0x07ff5557) /* 0.499837246 */, 17 },
+
+ /* 4096 */ { MAD_F(0x04000000) /* 0.250000000 */, 18 },
+ /* 4097 */ { MAD_F(0x04005556) /* 0.250081384 */, 18 },
+ /* 4098 */ { MAD_F(0x0400aaae) /* 0.250162774 */, 18 },
+ /* 4099 */ { MAD_F(0x04010008) /* 0.250244170 */, 18 },
+ /* 4100 */ { MAD_F(0x04015563) /* 0.250325574 */, 18 },
+ /* 4101 */ { MAD_F(0x0401aac1) /* 0.250406984 */, 18 },
+ /* 4102 */ { MAD_F(0x04020020) /* 0.250488400 */, 18 },
+ /* 4103 */ { MAD_F(0x04025581) /* 0.250569824 */, 18 },
+ /* 4104 */ { MAD_F(0x0402aae3) /* 0.250651254 */, 18 },
+ /* 4105 */ { MAD_F(0x04030048) /* 0.250732690 */, 18 },
+ /* 4106 */ { MAD_F(0x040355ae) /* 0.250814133 */, 18 },
+ /* 4107 */ { MAD_F(0x0403ab16) /* 0.250895583 */, 18 },
+ /* 4108 */ { MAD_F(0x04040080) /* 0.250977039 */, 18 },
+ /* 4109 */ { MAD_F(0x040455eb) /* 0.251058502 */, 18 },
+ /* 4110 */ { MAD_F(0x0404ab59) /* 0.251139971 */, 18 },
+ /* 4111 */ { MAD_F(0x040500c8) /* 0.251221448 */, 18 },
+
+ /* 4112 */ { MAD_F(0x04055638) /* 0.251302930 */, 18 },
+ /* 4113 */ { MAD_F(0x0405abab) /* 0.251384420 */, 18 },
+ /* 4114 */ { MAD_F(0x0406011f) /* 0.251465916 */, 18 },
+ /* 4115 */ { MAD_F(0x04065696) /* 0.251547418 */, 18 },
+ /* 4116 */ { MAD_F(0x0406ac0e) /* 0.251628927 */, 18 },
+ /* 4117 */ { MAD_F(0x04070187) /* 0.251710443 */, 18 },
+ /* 4118 */ { MAD_F(0x04075703) /* 0.251791965 */, 18 },
+ /* 4119 */ { MAD_F(0x0407ac80) /* 0.251873494 */, 18 },
+ /* 4120 */ { MAD_F(0x040801ff) /* 0.251955030 */, 18 },
+ /* 4121 */ { MAD_F(0x04085780) /* 0.252036572 */, 18 },
+ /* 4122 */ { MAD_F(0x0408ad02) /* 0.252118121 */, 18 },
+ /* 4123 */ { MAD_F(0x04090287) /* 0.252199676 */, 18 },
+ /* 4124 */ { MAD_F(0x0409580d) /* 0.252281238 */, 18 },
+ /* 4125 */ { MAD_F(0x0409ad95) /* 0.252362807 */, 18 },
+ /* 4126 */ { MAD_F(0x040a031e) /* 0.252444382 */, 18 },
+ /* 4127 */ { MAD_F(0x040a58aa) /* 0.252525963 */, 18 },
+
+ /* 4128 */ { MAD_F(0x040aae37) /* 0.252607552 */, 18 },
+ /* 4129 */ { MAD_F(0x040b03c6) /* 0.252689147 */, 18 },
+ /* 4130 */ { MAD_F(0x040b5957) /* 0.252770748 */, 18 },
+ /* 4131 */ { MAD_F(0x040baee9) /* 0.252852356 */, 18 },
+ /* 4132 */ { MAD_F(0x040c047e) /* 0.252933971 */, 18 },
+ /* 4133 */ { MAD_F(0x040c5a14) /* 0.253015592 */, 18 },
+ /* 4134 */ { MAD_F(0x040cafab) /* 0.253097220 */, 18 },
+ /* 4135 */ { MAD_F(0x040d0545) /* 0.253178854 */, 18 },
+ /* 4136 */ { MAD_F(0x040d5ae0) /* 0.253260495 */, 18 },
+ /* 4137 */ { MAD_F(0x040db07d) /* 0.253342143 */, 18 },
+ /* 4138 */ { MAD_F(0x040e061c) /* 0.253423797 */, 18 },
+ /* 4139 */ { MAD_F(0x040e5bbd) /* 0.253505457 */, 18 },
+ /* 4140 */ { MAD_F(0x040eb15f) /* 0.253587125 */, 18 },
+ /* 4141 */ { MAD_F(0x040f0703) /* 0.253668799 */, 18 },
+ /* 4142 */ { MAD_F(0x040f5ca9) /* 0.253750479 */, 18 },
+ /* 4143 */ { MAD_F(0x040fb251) /* 0.253832166 */, 18 },
+
+ /* 4144 */ { MAD_F(0x041007fa) /* 0.253913860 */, 18 },
+ /* 4145 */ { MAD_F(0x04105da6) /* 0.253995560 */, 18 },
+ /* 4146 */ { MAD_F(0x0410b353) /* 0.254077266 */, 18 },
+ /* 4147 */ { MAD_F(0x04110901) /* 0.254158980 */, 18 },
+ /* 4148 */ { MAD_F(0x04115eb2) /* 0.254240700 */, 18 },
+ /* 4149 */ { MAD_F(0x0411b464) /* 0.254322426 */, 18 },
+ /* 4150 */ { MAD_F(0x04120a18) /* 0.254404159 */, 18 },
+ /* 4151 */ { MAD_F(0x04125fce) /* 0.254485899 */, 18 },
+ /* 4152 */ { MAD_F(0x0412b586) /* 0.254567645 */, 18 },
+ /* 4153 */ { MAD_F(0x04130b3f) /* 0.254649397 */, 18 },
+ /* 4154 */ { MAD_F(0x041360fa) /* 0.254731157 */, 18 },
+ /* 4155 */ { MAD_F(0x0413b6b7) /* 0.254812922 */, 18 },
+ /* 4156 */ { MAD_F(0x04140c75) /* 0.254894695 */, 18 },
+ /* 4157 */ { MAD_F(0x04146236) /* 0.254976474 */, 18 },
+ /* 4158 */ { MAD_F(0x0414b7f8) /* 0.255058259 */, 18 },
+ /* 4159 */ { MAD_F(0x04150dbc) /* 0.255140051 */, 18 },
+
+ /* 4160 */ { MAD_F(0x04156381) /* 0.255221850 */, 18 },
+ /* 4161 */ { MAD_F(0x0415b949) /* 0.255303655 */, 18 },
+ /* 4162 */ { MAD_F(0x04160f12) /* 0.255385467 */, 18 },
+ /* 4163 */ { MAD_F(0x041664dd) /* 0.255467285 */, 18 },
+ /* 4164 */ { MAD_F(0x0416baaa) /* 0.255549110 */, 18 },
+ /* 4165 */ { MAD_F(0x04171078) /* 0.255630941 */, 18 },
+ /* 4166 */ { MAD_F(0x04176648) /* 0.255712779 */, 18 },
+ /* 4167 */ { MAD_F(0x0417bc1a) /* 0.255794624 */, 18 },
+ /* 4168 */ { MAD_F(0x041811ee) /* 0.255876475 */, 18 },
+ /* 4169 */ { MAD_F(0x041867c3) /* 0.255958332 */, 18 },
+ /* 4170 */ { MAD_F(0x0418bd9b) /* 0.256040196 */, 18 },
+ /* 4171 */ { MAD_F(0x04191374) /* 0.256122067 */, 18 },
+ /* 4172 */ { MAD_F(0x0419694e) /* 0.256203944 */, 18 },
+ /* 4173 */ { MAD_F(0x0419bf2b) /* 0.256285828 */, 18 },
+ /* 4174 */ { MAD_F(0x041a1509) /* 0.256367718 */, 18 },
+ /* 4175 */ { MAD_F(0x041a6ae9) /* 0.256449615 */, 18 },
+
+ /* 4176 */ { MAD_F(0x041ac0cb) /* 0.256531518 */, 18 },
+ /* 4177 */ { MAD_F(0x041b16ae) /* 0.256613428 */, 18 },
+ /* 4178 */ { MAD_F(0x041b6c94) /* 0.256695344 */, 18 },
+ /* 4179 */ { MAD_F(0x041bc27b) /* 0.256777267 */, 18 },
+ /* 4180 */ { MAD_F(0x041c1863) /* 0.256859197 */, 18 },
+ /* 4181 */ { MAD_F(0x041c6e4e) /* 0.256941133 */, 18 },
+ /* 4182 */ { MAD_F(0x041cc43a) /* 0.257023076 */, 18 },
+ /* 4183 */ { MAD_F(0x041d1a28) /* 0.257105025 */, 18 },
+ /* 4184 */ { MAD_F(0x041d7018) /* 0.257186980 */, 18 },
+ /* 4185 */ { MAD_F(0x041dc60a) /* 0.257268942 */, 18 },
+ /* 4186 */ { MAD_F(0x041e1bfd) /* 0.257350911 */, 18 },
+ /* 4187 */ { MAD_F(0x041e71f2) /* 0.257432886 */, 18 },
+ /* 4188 */ { MAD_F(0x041ec7e9) /* 0.257514868 */, 18 },
+ /* 4189 */ { MAD_F(0x041f1de1) /* 0.257596856 */, 18 },
+ /* 4190 */ { MAD_F(0x041f73dc) /* 0.257678851 */, 18 },
+ /* 4191 */ { MAD_F(0x041fc9d8) /* 0.257760852 */, 18 },
+
+ /* 4192 */ { MAD_F(0x04201fd5) /* 0.257842860 */, 18 },
+ /* 4193 */ { MAD_F(0x042075d5) /* 0.257924875 */, 18 },
+ /* 4194 */ { MAD_F(0x0420cbd6) /* 0.258006895 */, 18 },
+ /* 4195 */ { MAD_F(0x042121d9) /* 0.258088923 */, 18 },
+ /* 4196 */ { MAD_F(0x042177de) /* 0.258170957 */, 18 },
+ /* 4197 */ { MAD_F(0x0421cde5) /* 0.258252997 */, 18 },
+ /* 4198 */ { MAD_F(0x042223ed) /* 0.258335044 */, 18 },
+ /* 4199 */ { MAD_F(0x042279f7) /* 0.258417097 */, 18 },
+ /* 4200 */ { MAD_F(0x0422d003) /* 0.258499157 */, 18 },
+ /* 4201 */ { MAD_F(0x04232611) /* 0.258581224 */, 18 },
+ /* 4202 */ { MAD_F(0x04237c20) /* 0.258663297 */, 18 },
+ /* 4203 */ { MAD_F(0x0423d231) /* 0.258745376 */, 18 },
+ /* 4204 */ { MAD_F(0x04242844) /* 0.258827462 */, 18 },
+ /* 4205 */ { MAD_F(0x04247e58) /* 0.258909555 */, 18 },
+ /* 4206 */ { MAD_F(0x0424d46e) /* 0.258991654 */, 18 },
+ /* 4207 */ { MAD_F(0x04252a87) /* 0.259073760 */, 18 },
+
+ /* 4208 */ { MAD_F(0x042580a0) /* 0.259155872 */, 18 },
+ /* 4209 */ { MAD_F(0x0425d6bc) /* 0.259237990 */, 18 },
+ /* 4210 */ { MAD_F(0x04262cd9) /* 0.259320115 */, 18 },
+ /* 4211 */ { MAD_F(0x042682f8) /* 0.259402247 */, 18 },
+ /* 4212 */ { MAD_F(0x0426d919) /* 0.259484385 */, 18 },
+ /* 4213 */ { MAD_F(0x04272f3b) /* 0.259566529 */, 18 },
+ /* 4214 */ { MAD_F(0x04278560) /* 0.259648680 */, 18 },
+ /* 4215 */ { MAD_F(0x0427db86) /* 0.259730838 */, 18 },
+ /* 4216 */ { MAD_F(0x042831ad) /* 0.259813002 */, 18 },
+ /* 4217 */ { MAD_F(0x042887d7) /* 0.259895173 */, 18 },
+ /* 4218 */ { MAD_F(0x0428de02) /* 0.259977350 */, 18 },
+ /* 4219 */ { MAD_F(0x0429342f) /* 0.260059533 */, 18 },
+ /* 4220 */ { MAD_F(0x04298a5e) /* 0.260141723 */, 18 },
+ /* 4221 */ { MAD_F(0x0429e08e) /* 0.260223920 */, 18 },
+ /* 4222 */ { MAD_F(0x042a36c0) /* 0.260306123 */, 18 },
+ /* 4223 */ { MAD_F(0x042a8cf4) /* 0.260388332 */, 18 },
+
+ /* 4224 */ { MAD_F(0x042ae32a) /* 0.260470548 */, 18 },
+ /* 4225 */ { MAD_F(0x042b3962) /* 0.260552771 */, 18 },
+ /* 4226 */ { MAD_F(0x042b8f9b) /* 0.260635000 */, 18 },
+ /* 4227 */ { MAD_F(0x042be5d6) /* 0.260717235 */, 18 },
+ /* 4228 */ { MAD_F(0x042c3c12) /* 0.260799477 */, 18 },
+ /* 4229 */ { MAD_F(0x042c9251) /* 0.260881725 */, 18 },
+ /* 4230 */ { MAD_F(0x042ce891) /* 0.260963980 */, 18 },
+ /* 4231 */ { MAD_F(0x042d3ed3) /* 0.261046242 */, 18 },
+ /* 4232 */ { MAD_F(0x042d9516) /* 0.261128510 */, 18 },
+ /* 4233 */ { MAD_F(0x042deb5c) /* 0.261210784 */, 18 },
+ /* 4234 */ { MAD_F(0x042e41a3) /* 0.261293065 */, 18 },
+ /* 4235 */ { MAD_F(0x042e97ec) /* 0.261375352 */, 18 },
+ /* 4236 */ { MAD_F(0x042eee36) /* 0.261457646 */, 18 },
+ /* 4237 */ { MAD_F(0x042f4482) /* 0.261539946 */, 18 },
+ /* 4238 */ { MAD_F(0x042f9ad1) /* 0.261622253 */, 18 },
+ /* 4239 */ { MAD_F(0x042ff120) /* 0.261704566 */, 18 },
+
+ /* 4240 */ { MAD_F(0x04304772) /* 0.261786886 */, 18 },
+ /* 4241 */ { MAD_F(0x04309dc5) /* 0.261869212 */, 18 },
+ /* 4242 */ { MAD_F(0x0430f41a) /* 0.261951545 */, 18 },
+ /* 4243 */ { MAD_F(0x04314a71) /* 0.262033884 */, 18 },
+ /* 4244 */ { MAD_F(0x0431a0c9) /* 0.262116229 */, 18 },
+ /* 4245 */ { MAD_F(0x0431f723) /* 0.262198581 */, 18 },
+ /* 4246 */ { MAD_F(0x04324d7f) /* 0.262280940 */, 18 },
+ /* 4247 */ { MAD_F(0x0432a3dd) /* 0.262363305 */, 18 },
+ /* 4248 */ { MAD_F(0x0432fa3d) /* 0.262445676 */, 18 },
+ /* 4249 */ { MAD_F(0x0433509e) /* 0.262528054 */, 18 },
+ /* 4250 */ { MAD_F(0x0433a701) /* 0.262610438 */, 18 },
+ /* 4251 */ { MAD_F(0x0433fd65) /* 0.262692829 */, 18 },
+ /* 4252 */ { MAD_F(0x043453cc) /* 0.262775227 */, 18 },
+ /* 4253 */ { MAD_F(0x0434aa34) /* 0.262857630 */, 18 },
+ /* 4254 */ { MAD_F(0x0435009d) /* 0.262940040 */, 18 },
+ /* 4255 */ { MAD_F(0x04355709) /* 0.263022457 */, 18 },
+
+ /* 4256 */ { MAD_F(0x0435ad76) /* 0.263104880 */, 18 },
+ /* 4257 */ { MAD_F(0x043603e5) /* 0.263187310 */, 18 },
+ /* 4258 */ { MAD_F(0x04365a56) /* 0.263269746 */, 18 },
+ /* 4259 */ { MAD_F(0x0436b0c9) /* 0.263352188 */, 18 },
+ /* 4260 */ { MAD_F(0x0437073d) /* 0.263434637 */, 18 },
+ /* 4261 */ { MAD_F(0x04375db3) /* 0.263517093 */, 18 },
+ /* 4262 */ { MAD_F(0x0437b42a) /* 0.263599554 */, 18 },
+ /* 4263 */ { MAD_F(0x04380aa4) /* 0.263682023 */, 18 },
+ /* 4264 */ { MAD_F(0x0438611f) /* 0.263764497 */, 18 },
+ /* 4265 */ { MAD_F(0x0438b79c) /* 0.263846979 */, 18 },
+ /* 4266 */ { MAD_F(0x04390e1a) /* 0.263929466 */, 18 },
+ /* 4267 */ { MAD_F(0x0439649b) /* 0.264011960 */, 18 },
+ /* 4268 */ { MAD_F(0x0439bb1d) /* 0.264094461 */, 18 },
+ /* 4269 */ { MAD_F(0x043a11a1) /* 0.264176968 */, 18 },
+ /* 4270 */ { MAD_F(0x043a6826) /* 0.264259481 */, 18 },
+ /* 4271 */ { MAD_F(0x043abead) /* 0.264342001 */, 18 },
+
+ /* 4272 */ { MAD_F(0x043b1536) /* 0.264424527 */, 18 },
+ /* 4273 */ { MAD_F(0x043b6bc1) /* 0.264507060 */, 18 },
+ /* 4274 */ { MAD_F(0x043bc24d) /* 0.264589599 */, 18 },
+ /* 4275 */ { MAD_F(0x043c18dc) /* 0.264672145 */, 18 },
+ /* 4276 */ { MAD_F(0x043c6f6c) /* 0.264754697 */, 18 },
+ /* 4277 */ { MAD_F(0x043cc5fd) /* 0.264837255 */, 18 },
+ /* 4278 */ { MAD_F(0x043d1c91) /* 0.264919820 */, 18 },
+ /* 4279 */ { MAD_F(0x043d7326) /* 0.265002392 */, 18 },
+ /* 4280 */ { MAD_F(0x043dc9bc) /* 0.265084969 */, 18 },
+ /* 4281 */ { MAD_F(0x043e2055) /* 0.265167554 */, 18 },
+ /* 4282 */ { MAD_F(0x043e76ef) /* 0.265250144 */, 18 },
+ /* 4283 */ { MAD_F(0x043ecd8b) /* 0.265332741 */, 18 },
+ /* 4284 */ { MAD_F(0x043f2429) /* 0.265415345 */, 18 },
+ /* 4285 */ { MAD_F(0x043f7ac8) /* 0.265497955 */, 18 },
+ /* 4286 */ { MAD_F(0x043fd169) /* 0.265580571 */, 18 },
+ /* 4287 */ { MAD_F(0x0440280c) /* 0.265663194 */, 18 },
+
+ /* 4288 */ { MAD_F(0x04407eb1) /* 0.265745823 */, 18 },
+ /* 4289 */ { MAD_F(0x0440d557) /* 0.265828459 */, 18 },
+ /* 4290 */ { MAD_F(0x04412bff) /* 0.265911101 */, 18 },
+ /* 4291 */ { MAD_F(0x044182a9) /* 0.265993749 */, 18 },
+ /* 4292 */ { MAD_F(0x0441d955) /* 0.266076404 */, 18 },
+ /* 4293 */ { MAD_F(0x04423002) /* 0.266159065 */, 18 },
+ /* 4294 */ { MAD_F(0x044286b1) /* 0.266241733 */, 18 },
+ /* 4295 */ { MAD_F(0x0442dd61) /* 0.266324407 */, 18 },
+ /* 4296 */ { MAD_F(0x04433414) /* 0.266407088 */, 18 },
+ /* 4297 */ { MAD_F(0x04438ac8) /* 0.266489775 */, 18 },
+ /* 4298 */ { MAD_F(0x0443e17e) /* 0.266572468 */, 18 },
+ /* 4299 */ { MAD_F(0x04443835) /* 0.266655168 */, 18 },
+ /* 4300 */ { MAD_F(0x04448eef) /* 0.266737874 */, 18 },
+ /* 4301 */ { MAD_F(0x0444e5aa) /* 0.266820587 */, 18 },
+ /* 4302 */ { MAD_F(0x04453c66) /* 0.266903306 */, 18 },
+ /* 4303 */ { MAD_F(0x04459325) /* 0.266986031 */, 18 },
+
+ /* 4304 */ { MAD_F(0x0445e9e5) /* 0.267068763 */, 18 },
+ /* 4305 */ { MAD_F(0x044640a7) /* 0.267151501 */, 18 },
+ /* 4306 */ { MAD_F(0x0446976a) /* 0.267234246 */, 18 },
+ /* 4307 */ { MAD_F(0x0446ee30) /* 0.267316997 */, 18 },
+ /* 4308 */ { MAD_F(0x044744f7) /* 0.267399755 */, 18 },
+ /* 4309 */ { MAD_F(0x04479bc0) /* 0.267482518 */, 18 },
+ /* 4310 */ { MAD_F(0x0447f28a) /* 0.267565289 */, 18 },
+ /* 4311 */ { MAD_F(0x04484956) /* 0.267648065 */, 18 },
+ /* 4312 */ { MAD_F(0x0448a024) /* 0.267730848 */, 18 },
+ /* 4313 */ { MAD_F(0x0448f6f4) /* 0.267813638 */, 18 },
+ /* 4314 */ { MAD_F(0x04494dc5) /* 0.267896434 */, 18 },
+ /* 4315 */ { MAD_F(0x0449a498) /* 0.267979236 */, 18 },
+ /* 4316 */ { MAD_F(0x0449fb6d) /* 0.268062045 */, 18 },
+ /* 4317 */ { MAD_F(0x044a5243) /* 0.268144860 */, 18 },
+ /* 4318 */ { MAD_F(0x044aa91c) /* 0.268227681 */, 18 },
+ /* 4319 */ { MAD_F(0x044afff6) /* 0.268310509 */, 18 },
+
+ /* 4320 */ { MAD_F(0x044b56d1) /* 0.268393343 */, 18 },
+ /* 4321 */ { MAD_F(0x044badaf) /* 0.268476184 */, 18 },
+ /* 4322 */ { MAD_F(0x044c048e) /* 0.268559031 */, 18 },
+ /* 4323 */ { MAD_F(0x044c5b6f) /* 0.268641885 */, 18 },
+ /* 4324 */ { MAD_F(0x044cb251) /* 0.268724744 */, 18 },
+ /* 4325 */ { MAD_F(0x044d0935) /* 0.268807611 */, 18 },
+ /* 4326 */ { MAD_F(0x044d601b) /* 0.268890483 */, 18 },
+ /* 4327 */ { MAD_F(0x044db703) /* 0.268973362 */, 18 },
+ /* 4328 */ { MAD_F(0x044e0dec) /* 0.269056248 */, 18 },
+ /* 4329 */ { MAD_F(0x044e64d7) /* 0.269139139 */, 18 },
+ /* 4330 */ { MAD_F(0x044ebbc4) /* 0.269222037 */, 18 },
+ /* 4331 */ { MAD_F(0x044f12b3) /* 0.269304942 */, 18 },
+ /* 4332 */ { MAD_F(0x044f69a3) /* 0.269387853 */, 18 },
+ /* 4333 */ { MAD_F(0x044fc095) /* 0.269470770 */, 18 },
+ /* 4334 */ { MAD_F(0x04501788) /* 0.269553694 */, 18 },
+ /* 4335 */ { MAD_F(0x04506e7e) /* 0.269636624 */, 18 },
+
+ /* 4336 */ { MAD_F(0x0450c575) /* 0.269719560 */, 18 },
+ /* 4337 */ { MAD_F(0x04511c6e) /* 0.269802503 */, 18 },
+ /* 4338 */ { MAD_F(0x04517368) /* 0.269885452 */, 18 },
+ /* 4339 */ { MAD_F(0x0451ca64) /* 0.269968408 */, 18 },
+ /* 4340 */ { MAD_F(0x04522162) /* 0.270051370 */, 18 },
+ /* 4341 */ { MAD_F(0x04527862) /* 0.270134338 */, 18 },
+ /* 4342 */ { MAD_F(0x0452cf63) /* 0.270217312 */, 18 },
+ /* 4343 */ { MAD_F(0x04532666) /* 0.270300293 */, 18 },
+ /* 4344 */ { MAD_F(0x04537d6b) /* 0.270383281 */, 18 },
+ /* 4345 */ { MAD_F(0x0453d472) /* 0.270466275 */, 18 },
+ /* 4346 */ { MAD_F(0x04542b7a) /* 0.270549275 */, 18 },
+ /* 4347 */ { MAD_F(0x04548284) /* 0.270632281 */, 18 },
+ /* 4348 */ { MAD_F(0x0454d98f) /* 0.270715294 */, 18 },
+ /* 4349 */ { MAD_F(0x0455309c) /* 0.270798313 */, 18 },
+ /* 4350 */ { MAD_F(0x045587ab) /* 0.270881339 */, 18 },
+ /* 4351 */ { MAD_F(0x0455debc) /* 0.270964371 */, 18 },
+
+ /* 4352 */ { MAD_F(0x045635cf) /* 0.271047409 */, 18 },
+ /* 4353 */ { MAD_F(0x04568ce3) /* 0.271130454 */, 18 },
+ /* 4354 */ { MAD_F(0x0456e3f9) /* 0.271213505 */, 18 },
+ /* 4355 */ { MAD_F(0x04573b10) /* 0.271296562 */, 18 },
+ /* 4356 */ { MAD_F(0x04579229) /* 0.271379626 */, 18 },
+ /* 4357 */ { MAD_F(0x0457e944) /* 0.271462696 */, 18 },
+ /* 4358 */ { MAD_F(0x04584061) /* 0.271545772 */, 18 },
+ /* 4359 */ { MAD_F(0x0458977f) /* 0.271628855 */, 18 },
+ /* 4360 */ { MAD_F(0x0458ee9f) /* 0.271711944 */, 18 },
+ /* 4361 */ { MAD_F(0x045945c1) /* 0.271795040 */, 18 },
+ /* 4362 */ { MAD_F(0x04599ce5) /* 0.271878142 */, 18 },
+ /* 4363 */ { MAD_F(0x0459f40a) /* 0.271961250 */, 18 },
+ /* 4364 */ { MAD_F(0x045a4b31) /* 0.272044365 */, 18 },
+ /* 4365 */ { MAD_F(0x045aa259) /* 0.272127486 */, 18 },
+ /* 4366 */ { MAD_F(0x045af984) /* 0.272210613 */, 18 },
+ /* 4367 */ { MAD_F(0x045b50b0) /* 0.272293746 */, 18 },
+
+ /* 4368 */ { MAD_F(0x045ba7dd) /* 0.272376886 */, 18 },
+ /* 4369 */ { MAD_F(0x045bff0d) /* 0.272460033 */, 18 },
+ /* 4370 */ { MAD_F(0x045c563e) /* 0.272543185 */, 18 },
+ /* 4371 */ { MAD_F(0x045cad71) /* 0.272626344 */, 18 },
+ /* 4372 */ { MAD_F(0x045d04a5) /* 0.272709510 */, 18 },
+ /* 4373 */ { MAD_F(0x045d5bdc) /* 0.272792681 */, 18 },
+ /* 4374 */ { MAD_F(0x045db313) /* 0.272875859 */, 18 },
+ /* 4375 */ { MAD_F(0x045e0a4d) /* 0.272959044 */, 18 },
+ /* 4376 */ { MAD_F(0x045e6188) /* 0.273042234 */, 18 },
+ /* 4377 */ { MAD_F(0x045eb8c5) /* 0.273125431 */, 18 },
+ /* 4378 */ { MAD_F(0x045f1004) /* 0.273208635 */, 18 },
+ /* 4379 */ { MAD_F(0x045f6745) /* 0.273291844 */, 18 },
+ /* 4380 */ { MAD_F(0x045fbe87) /* 0.273375060 */, 18 },
+ /* 4381 */ { MAD_F(0x046015cb) /* 0.273458283 */, 18 },
+ /* 4382 */ { MAD_F(0x04606d10) /* 0.273541511 */, 18 },
+ /* 4383 */ { MAD_F(0x0460c457) /* 0.273624747 */, 18 },
+
+ /* 4384 */ { MAD_F(0x04611ba0) /* 0.273707988 */, 18 },
+ /* 4385 */ { MAD_F(0x046172eb) /* 0.273791236 */, 18 },
+ /* 4386 */ { MAD_F(0x0461ca37) /* 0.273874490 */, 18 },
+ /* 4387 */ { MAD_F(0x04622185) /* 0.273957750 */, 18 },
+ /* 4388 */ { MAD_F(0x046278d5) /* 0.274041017 */, 18 },
+ /* 4389 */ { MAD_F(0x0462d026) /* 0.274124290 */, 18 },
+ /* 4390 */ { MAD_F(0x0463277a) /* 0.274207569 */, 18 },
+ /* 4391 */ { MAD_F(0x04637ece) /* 0.274290855 */, 18 },
+ /* 4392 */ { MAD_F(0x0463d625) /* 0.274374147 */, 18 },
+ /* 4393 */ { MAD_F(0x04642d7d) /* 0.274457445 */, 18 },
+ /* 4394 */ { MAD_F(0x046484d7) /* 0.274540749 */, 18 },
+ /* 4395 */ { MAD_F(0x0464dc33) /* 0.274624060 */, 18 },
+ /* 4396 */ { MAD_F(0x04653390) /* 0.274707378 */, 18 },
+ /* 4397 */ { MAD_F(0x04658aef) /* 0.274790701 */, 18 },
+ /* 4398 */ { MAD_F(0x0465e250) /* 0.274874031 */, 18 },
+ /* 4399 */ { MAD_F(0x046639b2) /* 0.274957367 */, 18 },
+
+ /* 4400 */ { MAD_F(0x04669116) /* 0.275040710 */, 18 },
+ /* 4401 */ { MAD_F(0x0466e87c) /* 0.275124059 */, 18 },
+ /* 4402 */ { MAD_F(0x04673fe3) /* 0.275207414 */, 18 },
+ /* 4403 */ { MAD_F(0x0467974d) /* 0.275290775 */, 18 },
+ /* 4404 */ { MAD_F(0x0467eeb7) /* 0.275374143 */, 18 },
+ /* 4405 */ { MAD_F(0x04684624) /* 0.275457517 */, 18 },
+ /* 4406 */ { MAD_F(0x04689d92) /* 0.275540897 */, 18 },
+ /* 4407 */ { MAD_F(0x0468f502) /* 0.275624284 */, 18 },
+ /* 4408 */ { MAD_F(0x04694c74) /* 0.275707677 */, 18 },
+ /* 4409 */ { MAD_F(0x0469a3e7) /* 0.275791076 */, 18 },
+ /* 4410 */ { MAD_F(0x0469fb5c) /* 0.275874482 */, 18 },
+ /* 4411 */ { MAD_F(0x046a52d3) /* 0.275957894 */, 18 },
+ /* 4412 */ { MAD_F(0x046aaa4b) /* 0.276041312 */, 18 },
+ /* 4413 */ { MAD_F(0x046b01c5) /* 0.276124737 */, 18 },
+ /* 4414 */ { MAD_F(0x046b5941) /* 0.276208167 */, 18 },
+ /* 4415 */ { MAD_F(0x046bb0bf) /* 0.276291605 */, 18 },
+
+ /* 4416 */ { MAD_F(0x046c083e) /* 0.276375048 */, 18 },
+ /* 4417 */ { MAD_F(0x046c5fbf) /* 0.276458498 */, 18 },
+ /* 4418 */ { MAD_F(0x046cb741) /* 0.276541954 */, 18 },
+ /* 4419 */ { MAD_F(0x046d0ec5) /* 0.276625416 */, 18 },
+ /* 4420 */ { MAD_F(0x046d664b) /* 0.276708885 */, 18 },
+ /* 4421 */ { MAD_F(0x046dbdd3) /* 0.276792360 */, 18 },
+ /* 4422 */ { MAD_F(0x046e155c) /* 0.276875841 */, 18 },
+ /* 4423 */ { MAD_F(0x046e6ce7) /* 0.276959328 */, 18 },
+ /* 4424 */ { MAD_F(0x046ec474) /* 0.277042822 */, 18 },
+ /* 4425 */ { MAD_F(0x046f1c02) /* 0.277126322 */, 18 },
+ /* 4426 */ { MAD_F(0x046f7392) /* 0.277209829 */, 18 },
+ /* 4427 */ { MAD_F(0x046fcb24) /* 0.277293341 */, 18 },
+ /* 4428 */ { MAD_F(0x047022b8) /* 0.277376860 */, 18 },
+ /* 4429 */ { MAD_F(0x04707a4d) /* 0.277460385 */, 18 },
+ /* 4430 */ { MAD_F(0x0470d1e4) /* 0.277543917 */, 18 },
+ /* 4431 */ { MAD_F(0x0471297c) /* 0.277627455 */, 18 },
+
+ /* 4432 */ { MAD_F(0x04718116) /* 0.277710999 */, 18 },
+ /* 4433 */ { MAD_F(0x0471d8b2) /* 0.277794549 */, 18 },
+ /* 4434 */ { MAD_F(0x04723050) /* 0.277878106 */, 18 },
+ /* 4435 */ { MAD_F(0x047287ef) /* 0.277961669 */, 18 },
+ /* 4436 */ { MAD_F(0x0472df90) /* 0.278045238 */, 18 },
+ /* 4437 */ { MAD_F(0x04733733) /* 0.278128813 */, 18 },
+ /* 4438 */ { MAD_F(0x04738ed7) /* 0.278212395 */, 18 },
+ /* 4439 */ { MAD_F(0x0473e67d) /* 0.278295983 */, 18 },
+ /* 4440 */ { MAD_F(0x04743e25) /* 0.278379578 */, 18 },
+ /* 4441 */ { MAD_F(0x047495ce) /* 0.278463178 */, 18 },
+ /* 4442 */ { MAD_F(0x0474ed79) /* 0.278546785 */, 18 },
+ /* 4443 */ { MAD_F(0x04754526) /* 0.278630398 */, 18 },
+ /* 4444 */ { MAD_F(0x04759cd4) /* 0.278714018 */, 18 },
+ /* 4445 */ { MAD_F(0x0475f484) /* 0.278797643 */, 18 },
+ /* 4446 */ { MAD_F(0x04764c36) /* 0.278881275 */, 18 },
+ /* 4447 */ { MAD_F(0x0476a3ea) /* 0.278964914 */, 18 },
+
+ /* 4448 */ { MAD_F(0x0476fb9f) /* 0.279048558 */, 18 },
+ /* 4449 */ { MAD_F(0x04775356) /* 0.279132209 */, 18 },
+ /* 4450 */ { MAD_F(0x0477ab0e) /* 0.279215866 */, 18 },
+ /* 4451 */ { MAD_F(0x047802c8) /* 0.279299529 */, 18 },
+ /* 4452 */ { MAD_F(0x04785a84) /* 0.279383199 */, 18 },
+ /* 4453 */ { MAD_F(0x0478b242) /* 0.279466875 */, 18 },
+ /* 4454 */ { MAD_F(0x04790a01) /* 0.279550557 */, 18 },
+ /* 4455 */ { MAD_F(0x047961c2) /* 0.279634245 */, 18 },
+ /* 4456 */ { MAD_F(0x0479b984) /* 0.279717940 */, 18 },
+ /* 4457 */ { MAD_F(0x047a1149) /* 0.279801641 */, 18 },
+ /* 4458 */ { MAD_F(0x047a690f) /* 0.279885348 */, 18 },
+ /* 4459 */ { MAD_F(0x047ac0d6) /* 0.279969061 */, 18 },
+ /* 4460 */ { MAD_F(0x047b18a0) /* 0.280052781 */, 18 },
+ /* 4461 */ { MAD_F(0x047b706b) /* 0.280136507 */, 18 },
+ /* 4462 */ { MAD_F(0x047bc837) /* 0.280220239 */, 18 },
+ /* 4463 */ { MAD_F(0x047c2006) /* 0.280303978 */, 18 },
+
+ /* 4464 */ { MAD_F(0x047c77d6) /* 0.280387722 */, 18 },
+ /* 4465 */ { MAD_F(0x047ccfa8) /* 0.280471473 */, 18 },
+ /* 4466 */ { MAD_F(0x047d277b) /* 0.280555230 */, 18 },
+ /* 4467 */ { MAD_F(0x047d7f50) /* 0.280638994 */, 18 },
+ /* 4468 */ { MAD_F(0x047dd727) /* 0.280722764 */, 18 },
+ /* 4469 */ { MAD_F(0x047e2eff) /* 0.280806540 */, 18 },
+ /* 4470 */ { MAD_F(0x047e86d9) /* 0.280890322 */, 18 },
+ /* 4471 */ { MAD_F(0x047edeb5) /* 0.280974110 */, 18 },
+ /* 4472 */ { MAD_F(0x047f3693) /* 0.281057905 */, 18 },
+ /* 4473 */ { MAD_F(0x047f8e72) /* 0.281141706 */, 18 },
+ /* 4474 */ { MAD_F(0x047fe653) /* 0.281225513 */, 18 },
+ /* 4475 */ { MAD_F(0x04803e35) /* 0.281309326 */, 18 },
+ /* 4476 */ { MAD_F(0x04809619) /* 0.281393146 */, 18 },
+ /* 4477 */ { MAD_F(0x0480edff) /* 0.281476972 */, 18 },
+ /* 4478 */ { MAD_F(0x048145e7) /* 0.281560804 */, 18 },
+ /* 4479 */ { MAD_F(0x04819dd0) /* 0.281644643 */, 18 },
+
+ /* 4480 */ { MAD_F(0x0481f5bb) /* 0.281728487 */, 18 },
+ /* 4481 */ { MAD_F(0x04824da7) /* 0.281812338 */, 18 },
+ /* 4482 */ { MAD_F(0x0482a595) /* 0.281896195 */, 18 },
+ /* 4483 */ { MAD_F(0x0482fd85) /* 0.281980059 */, 18 },
+ /* 4484 */ { MAD_F(0x04835577) /* 0.282063928 */, 18 },
+ /* 4485 */ { MAD_F(0x0483ad6a) /* 0.282147804 */, 18 },
+ /* 4486 */ { MAD_F(0x0484055f) /* 0.282231686 */, 18 },
+ /* 4487 */ { MAD_F(0x04845d56) /* 0.282315574 */, 18 },
+ /* 4488 */ { MAD_F(0x0484b54e) /* 0.282399469 */, 18 },
+ /* 4489 */ { MAD_F(0x04850d48) /* 0.282483370 */, 18 },
+ /* 4490 */ { MAD_F(0x04856544) /* 0.282567277 */, 18 },
+ /* 4491 */ { MAD_F(0x0485bd41) /* 0.282651190 */, 18 },
+ /* 4492 */ { MAD_F(0x04861540) /* 0.282735109 */, 18 },
+ /* 4493 */ { MAD_F(0x04866d40) /* 0.282819035 */, 18 },
+ /* 4494 */ { MAD_F(0x0486c543) /* 0.282902967 */, 18 },
+ /* 4495 */ { MAD_F(0x04871d47) /* 0.282986905 */, 18 },
+
+ /* 4496 */ { MAD_F(0x0487754c) /* 0.283070849 */, 18 },
+ /* 4497 */ { MAD_F(0x0487cd54) /* 0.283154800 */, 18 },
+ /* 4498 */ { MAD_F(0x0488255d) /* 0.283238757 */, 18 },
+ /* 4499 */ { MAD_F(0x04887d67) /* 0.283322720 */, 18 },
+ /* 4500 */ { MAD_F(0x0488d574) /* 0.283406689 */, 18 },
+ /* 4501 */ { MAD_F(0x04892d82) /* 0.283490665 */, 18 },
+ /* 4502 */ { MAD_F(0x04898591) /* 0.283574646 */, 18 },
+ /* 4503 */ { MAD_F(0x0489dda3) /* 0.283658634 */, 18 },
+ /* 4504 */ { MAD_F(0x048a35b6) /* 0.283742628 */, 18 },
+ /* 4505 */ { MAD_F(0x048a8dca) /* 0.283826629 */, 18 },
+ /* 4506 */ { MAD_F(0x048ae5e1) /* 0.283910635 */, 18 },
+ /* 4507 */ { MAD_F(0x048b3df9) /* 0.283994648 */, 18 },
+ /* 4508 */ { MAD_F(0x048b9612) /* 0.284078667 */, 18 },
+ /* 4509 */ { MAD_F(0x048bee2e) /* 0.284162692 */, 18 },
+ /* 4510 */ { MAD_F(0x048c464b) /* 0.284246723 */, 18 },
+ /* 4511 */ { MAD_F(0x048c9e69) /* 0.284330761 */, 18 },
+
+ /* 4512 */ { MAD_F(0x048cf68a) /* 0.284414805 */, 18 },
+ /* 4513 */ { MAD_F(0x048d4eac) /* 0.284498855 */, 18 },
+ /* 4514 */ { MAD_F(0x048da6cf) /* 0.284582911 */, 18 },
+ /* 4515 */ { MAD_F(0x048dfef5) /* 0.284666974 */, 18 },
+ /* 4516 */ { MAD_F(0x048e571c) /* 0.284751042 */, 18 },
+ /* 4517 */ { MAD_F(0x048eaf44) /* 0.284835117 */, 18 },
+ /* 4518 */ { MAD_F(0x048f076f) /* 0.284919198 */, 18 },
+ /* 4519 */ { MAD_F(0x048f5f9b) /* 0.285003285 */, 18 },
+ /* 4520 */ { MAD_F(0x048fb7c8) /* 0.285087379 */, 18 },
+ /* 4521 */ { MAD_F(0x04900ff8) /* 0.285171479 */, 18 },
+ /* 4522 */ { MAD_F(0x04906829) /* 0.285255584 */, 18 },
+ /* 4523 */ { MAD_F(0x0490c05b) /* 0.285339697 */, 18 },
+ /* 4524 */ { MAD_F(0x04911890) /* 0.285423815 */, 18 },
+ /* 4525 */ { MAD_F(0x049170c6) /* 0.285507939 */, 18 },
+ /* 4526 */ { MAD_F(0x0491c8fd) /* 0.285592070 */, 18 },
+ /* 4527 */ { MAD_F(0x04922137) /* 0.285676207 */, 18 },
+
+ /* 4528 */ { MAD_F(0x04927972) /* 0.285760350 */, 18 },
+ /* 4529 */ { MAD_F(0x0492d1ae) /* 0.285844499 */, 18 },
+ /* 4530 */ { MAD_F(0x049329ed) /* 0.285928655 */, 18 },
+ /* 4531 */ { MAD_F(0x0493822c) /* 0.286012816 */, 18 },
+ /* 4532 */ { MAD_F(0x0493da6e) /* 0.286096984 */, 18 },
+ /* 4533 */ { MAD_F(0x049432b1) /* 0.286181158 */, 18 },
+ /* 4534 */ { MAD_F(0x04948af6) /* 0.286265338 */, 18 },
+ /* 4535 */ { MAD_F(0x0494e33d) /* 0.286349525 */, 18 },
+ /* 4536 */ { MAD_F(0x04953b85) /* 0.286433717 */, 18 },
+ /* 4537 */ { MAD_F(0x049593cf) /* 0.286517916 */, 18 },
+ /* 4538 */ { MAD_F(0x0495ec1b) /* 0.286602121 */, 18 },
+ /* 4539 */ { MAD_F(0x04964468) /* 0.286686332 */, 18 },
+ /* 4540 */ { MAD_F(0x04969cb7) /* 0.286770550 */, 18 },
+ /* 4541 */ { MAD_F(0x0496f508) /* 0.286854773 */, 18 },
+ /* 4542 */ { MAD_F(0x04974d5a) /* 0.286939003 */, 18 },
+ /* 4543 */ { MAD_F(0x0497a5ae) /* 0.287023239 */, 18 },
+
+ /* 4544 */ { MAD_F(0x0497fe03) /* 0.287107481 */, 18 },
+ /* 4545 */ { MAD_F(0x0498565a) /* 0.287191729 */, 18 },
+ /* 4546 */ { MAD_F(0x0498aeb3) /* 0.287275983 */, 18 },
+ /* 4547 */ { MAD_F(0x0499070e) /* 0.287360244 */, 18 },
+ /* 4548 */ { MAD_F(0x04995f6a) /* 0.287444511 */, 18 },
+ /* 4549 */ { MAD_F(0x0499b7c8) /* 0.287528784 */, 18 },
+ /* 4550 */ { MAD_F(0x049a1027) /* 0.287613063 */, 18 },
+ /* 4551 */ { MAD_F(0x049a6889) /* 0.287697348 */, 18 },
+ /* 4552 */ { MAD_F(0x049ac0eb) /* 0.287781640 */, 18 },
+ /* 4553 */ { MAD_F(0x049b1950) /* 0.287865937 */, 18 },
+ /* 4554 */ { MAD_F(0x049b71b6) /* 0.287950241 */, 18 },
+ /* 4555 */ { MAD_F(0x049bca1e) /* 0.288034551 */, 18 },
+ /* 4556 */ { MAD_F(0x049c2287) /* 0.288118867 */, 18 },
+ /* 4557 */ { MAD_F(0x049c7af2) /* 0.288203190 */, 18 },
+ /* 4558 */ { MAD_F(0x049cd35f) /* 0.288287518 */, 18 },
+ /* 4559 */ { MAD_F(0x049d2bce) /* 0.288371853 */, 18 },
+
+ /* 4560 */ { MAD_F(0x049d843e) /* 0.288456194 */, 18 },
+ /* 4561 */ { MAD_F(0x049ddcaf) /* 0.288540541 */, 18 },
+ /* 4562 */ { MAD_F(0x049e3523) /* 0.288624894 */, 18 },
+ /* 4563 */ { MAD_F(0x049e8d98) /* 0.288709253 */, 18 },
+ /* 4564 */ { MAD_F(0x049ee60e) /* 0.288793619 */, 18 },
+ /* 4565 */ { MAD_F(0x049f3e87) /* 0.288877990 */, 18 },
+ /* 4566 */ { MAD_F(0x049f9701) /* 0.288962368 */, 18 },
+ /* 4567 */ { MAD_F(0x049fef7c) /* 0.289046752 */, 18 },
+ /* 4568 */ { MAD_F(0x04a047fa) /* 0.289131142 */, 18 },
+ /* 4569 */ { MAD_F(0x04a0a079) /* 0.289215538 */, 18 },
+ /* 4570 */ { MAD_F(0x04a0f8f9) /* 0.289299941 */, 18 },
+ /* 4571 */ { MAD_F(0x04a1517c) /* 0.289384349 */, 18 },
+ /* 4572 */ { MAD_F(0x04a1a9ff) /* 0.289468764 */, 18 },
+ /* 4573 */ { MAD_F(0x04a20285) /* 0.289553185 */, 18 },
+ /* 4574 */ { MAD_F(0x04a25b0c) /* 0.289637612 */, 18 },
+ /* 4575 */ { MAD_F(0x04a2b395) /* 0.289722045 */, 18 },
+
+ /* 4576 */ { MAD_F(0x04a30c20) /* 0.289806485 */, 18 },
+ /* 4577 */ { MAD_F(0x04a364ac) /* 0.289890930 */, 18 },
+ /* 4578 */ { MAD_F(0x04a3bd3a) /* 0.289975382 */, 18 },
+ /* 4579 */ { MAD_F(0x04a415c9) /* 0.290059840 */, 18 },
+ /* 4580 */ { MAD_F(0x04a46e5a) /* 0.290144304 */, 18 },
+ /* 4581 */ { MAD_F(0x04a4c6ed) /* 0.290228774 */, 18 },
+ /* 4582 */ { MAD_F(0x04a51f81) /* 0.290313250 */, 18 },
+ /* 4583 */ { MAD_F(0x04a57818) /* 0.290397733 */, 18 },
+ /* 4584 */ { MAD_F(0x04a5d0af) /* 0.290482221 */, 18 },
+ /* 4585 */ { MAD_F(0x04a62949) /* 0.290566716 */, 18 },
+ /* 4586 */ { MAD_F(0x04a681e4) /* 0.290651217 */, 18 },
+ /* 4587 */ { MAD_F(0x04a6da80) /* 0.290735724 */, 18 },
+ /* 4588 */ { MAD_F(0x04a7331f) /* 0.290820237 */, 18 },
+ /* 4589 */ { MAD_F(0x04a78bbf) /* 0.290904756 */, 18 },
+ /* 4590 */ { MAD_F(0x04a7e460) /* 0.290989281 */, 18 },
+ /* 4591 */ { MAD_F(0x04a83d03) /* 0.291073813 */, 18 },
+
+ /* 4592 */ { MAD_F(0x04a895a8) /* 0.291158351 */, 18 },
+ /* 4593 */ { MAD_F(0x04a8ee4f) /* 0.291242894 */, 18 },
+ /* 4594 */ { MAD_F(0x04a946f7) /* 0.291327444 */, 18 },
+ /* 4595 */ { MAD_F(0x04a99fa1) /* 0.291412001 */, 18 },
+ /* 4596 */ { MAD_F(0x04a9f84c) /* 0.291496563 */, 18 },
+ /* 4597 */ { MAD_F(0x04aa50fa) /* 0.291581131 */, 18 },
+ /* 4598 */ { MAD_F(0x04aaa9a8) /* 0.291665706 */, 18 },
+ /* 4599 */ { MAD_F(0x04ab0259) /* 0.291750286 */, 18 },
+ /* 4600 */ { MAD_F(0x04ab5b0b) /* 0.291834873 */, 18 },
+ /* 4601 */ { MAD_F(0x04abb3bf) /* 0.291919466 */, 18 },
+ /* 4602 */ { MAD_F(0x04ac0c74) /* 0.292004065 */, 18 },
+ /* 4603 */ { MAD_F(0x04ac652b) /* 0.292088670 */, 18 },
+ /* 4604 */ { MAD_F(0x04acbde4) /* 0.292173281 */, 18 },
+ /* 4605 */ { MAD_F(0x04ad169e) /* 0.292257899 */, 18 },
+ /* 4606 */ { MAD_F(0x04ad6f5a) /* 0.292342522 */, 18 },
+ /* 4607 */ { MAD_F(0x04adc818) /* 0.292427152 */, 18 },
+
+ /* 4608 */ { MAD_F(0x04ae20d7) /* 0.292511788 */, 18 },
+ /* 4609 */ { MAD_F(0x04ae7998) /* 0.292596430 */, 18 },
+ /* 4610 */ { MAD_F(0x04aed25a) /* 0.292681078 */, 18 },
+ /* 4611 */ { MAD_F(0x04af2b1e) /* 0.292765732 */, 18 },
+ /* 4612 */ { MAD_F(0x04af83e4) /* 0.292850392 */, 18 },
+ /* 4613 */ { MAD_F(0x04afdcac) /* 0.292935058 */, 18 },
+ /* 4614 */ { MAD_F(0x04b03575) /* 0.293019731 */, 18 },
+ /* 4615 */ { MAD_F(0x04b08e40) /* 0.293104409 */, 18 },
+ /* 4616 */ { MAD_F(0x04b0e70c) /* 0.293189094 */, 18 },
+ /* 4617 */ { MAD_F(0x04b13fda) /* 0.293273785 */, 18 },
+ /* 4618 */ { MAD_F(0x04b198aa) /* 0.293358482 */, 18 },
+ /* 4619 */ { MAD_F(0x04b1f17b) /* 0.293443185 */, 18 },
+ /* 4620 */ { MAD_F(0x04b24a4e) /* 0.293527894 */, 18 },
+ /* 4621 */ { MAD_F(0x04b2a322) /* 0.293612609 */, 18 },
+ /* 4622 */ { MAD_F(0x04b2fbf9) /* 0.293697331 */, 18 },
+ /* 4623 */ { MAD_F(0x04b354d1) /* 0.293782058 */, 18 },
+
+ /* 4624 */ { MAD_F(0x04b3adaa) /* 0.293866792 */, 18 },
+ /* 4625 */ { MAD_F(0x04b40685) /* 0.293951532 */, 18 },
+ /* 4626 */ { MAD_F(0x04b45f62) /* 0.294036278 */, 18 },
+ /* 4627 */ { MAD_F(0x04b4b840) /* 0.294121029 */, 18 },
+ /* 4628 */ { MAD_F(0x04b51120) /* 0.294205788 */, 18 },
+ /* 4629 */ { MAD_F(0x04b56a02) /* 0.294290552 */, 18 },
+ /* 4630 */ { MAD_F(0x04b5c2e6) /* 0.294375322 */, 18 },
+ /* 4631 */ { MAD_F(0x04b61bcb) /* 0.294460098 */, 18 },
+ /* 4632 */ { MAD_F(0x04b674b1) /* 0.294544881 */, 18 },
+ /* 4633 */ { MAD_F(0x04b6cd99) /* 0.294629669 */, 18 },
+ /* 4634 */ { MAD_F(0x04b72683) /* 0.294714464 */, 18 },
+ /* 4635 */ { MAD_F(0x04b77f6f) /* 0.294799265 */, 18 },
+ /* 4636 */ { MAD_F(0x04b7d85c) /* 0.294884072 */, 18 },
+ /* 4637 */ { MAD_F(0x04b8314b) /* 0.294968885 */, 18 },
+ /* 4638 */ { MAD_F(0x04b88a3b) /* 0.295053704 */, 18 },
+ /* 4639 */ { MAD_F(0x04b8e32d) /* 0.295138529 */, 18 },
+
+ /* 4640 */ { MAD_F(0x04b93c21) /* 0.295223360 */, 18 },
+ /* 4641 */ { MAD_F(0x04b99516) /* 0.295308197 */, 18 },
+ /* 4642 */ { MAD_F(0x04b9ee0d) /* 0.295393041 */, 18 },
+ /* 4643 */ { MAD_F(0x04ba4706) /* 0.295477890 */, 18 },
+ /* 4644 */ { MAD_F(0x04baa000) /* 0.295562746 */, 18 },
+ /* 4645 */ { MAD_F(0x04baf8fc) /* 0.295647608 */, 18 },
+ /* 4646 */ { MAD_F(0x04bb51fa) /* 0.295732476 */, 18 },
+ /* 4647 */ { MAD_F(0x04bbaaf9) /* 0.295817349 */, 18 },
+ /* 4648 */ { MAD_F(0x04bc03fa) /* 0.295902229 */, 18 },
+ /* 4649 */ { MAD_F(0x04bc5cfc) /* 0.295987115 */, 18 },
+ /* 4650 */ { MAD_F(0x04bcb600) /* 0.296072008 */, 18 },
+ /* 4651 */ { MAD_F(0x04bd0f06) /* 0.296156906 */, 18 },
+ /* 4652 */ { MAD_F(0x04bd680d) /* 0.296241810 */, 18 },
+ /* 4653 */ { MAD_F(0x04bdc116) /* 0.296326721 */, 18 },
+ /* 4654 */ { MAD_F(0x04be1a21) /* 0.296411637 */, 18 },
+ /* 4655 */ { MAD_F(0x04be732d) /* 0.296496560 */, 18 },
+
+ /* 4656 */ { MAD_F(0x04becc3b) /* 0.296581488 */, 18 },
+ /* 4657 */ { MAD_F(0x04bf254a) /* 0.296666423 */, 18 },
+ /* 4658 */ { MAD_F(0x04bf7e5b) /* 0.296751364 */, 18 },
+ /* 4659 */ { MAD_F(0x04bfd76e) /* 0.296836311 */, 18 },
+ /* 4660 */ { MAD_F(0x04c03083) /* 0.296921264 */, 18 },
+ /* 4661 */ { MAD_F(0x04c08999) /* 0.297006223 */, 18 },
+ /* 4662 */ { MAD_F(0x04c0e2b0) /* 0.297091188 */, 18 },
+ /* 4663 */ { MAD_F(0x04c13bca) /* 0.297176159 */, 18 },
+ /* 4664 */ { MAD_F(0x04c194e4) /* 0.297261136 */, 18 },
+ /* 4665 */ { MAD_F(0x04c1ee01) /* 0.297346120 */, 18 },
+ /* 4666 */ { MAD_F(0x04c2471f) /* 0.297431109 */, 18 },
+ /* 4667 */ { MAD_F(0x04c2a03f) /* 0.297516105 */, 18 },
+ /* 4668 */ { MAD_F(0x04c2f960) /* 0.297601106 */, 18 },
+ /* 4669 */ { MAD_F(0x04c35283) /* 0.297686114 */, 18 },
+ /* 4670 */ { MAD_F(0x04c3aba8) /* 0.297771128 */, 18 },
+ /* 4671 */ { MAD_F(0x04c404ce) /* 0.297856147 */, 18 },
+
+ /* 4672 */ { MAD_F(0x04c45df6) /* 0.297941173 */, 18 },
+ /* 4673 */ { MAD_F(0x04c4b720) /* 0.298026205 */, 18 },
+ /* 4674 */ { MAD_F(0x04c5104b) /* 0.298111243 */, 18 },
+ /* 4675 */ { MAD_F(0x04c56978) /* 0.298196287 */, 18 },
+ /* 4676 */ { MAD_F(0x04c5c2a7) /* 0.298281337 */, 18 },
+ /* 4677 */ { MAD_F(0x04c61bd7) /* 0.298366393 */, 18 },
+ /* 4678 */ { MAD_F(0x04c67508) /* 0.298451456 */, 18 },
+ /* 4679 */ { MAD_F(0x04c6ce3c) /* 0.298536524 */, 18 },
+ /* 4680 */ { MAD_F(0x04c72771) /* 0.298621598 */, 18 },
+ /* 4681 */ { MAD_F(0x04c780a7) /* 0.298706679 */, 18 },
+ /* 4682 */ { MAD_F(0x04c7d9df) /* 0.298791765 */, 18 },
+ /* 4683 */ { MAD_F(0x04c83319) /* 0.298876858 */, 18 },
+ /* 4684 */ { MAD_F(0x04c88c55) /* 0.298961956 */, 18 },
+ /* 4685 */ { MAD_F(0x04c8e592) /* 0.299047061 */, 18 },
+ /* 4686 */ { MAD_F(0x04c93ed1) /* 0.299132172 */, 18 },
+ /* 4687 */ { MAD_F(0x04c99811) /* 0.299217288 */, 18 },
+
+ /* 4688 */ { MAD_F(0x04c9f153) /* 0.299302411 */, 18 },
+ /* 4689 */ { MAD_F(0x04ca4a97) /* 0.299387540 */, 18 },
+ /* 4690 */ { MAD_F(0x04caa3dc) /* 0.299472675 */, 18 },
+ /* 4691 */ { MAD_F(0x04cafd23) /* 0.299557816 */, 18 },
+ /* 4692 */ { MAD_F(0x04cb566b) /* 0.299642963 */, 18 },
+ /* 4693 */ { MAD_F(0x04cbafb5) /* 0.299728116 */, 18 },
+ /* 4694 */ { MAD_F(0x04cc0901) /* 0.299813275 */, 18 },
+ /* 4695 */ { MAD_F(0x04cc624e) /* 0.299898440 */, 18 },
+ /* 4696 */ { MAD_F(0x04ccbb9d) /* 0.299983611 */, 18 },
+ /* 4697 */ { MAD_F(0x04cd14ee) /* 0.300068789 */, 18 },
+ /* 4698 */ { MAD_F(0x04cd6e40) /* 0.300153972 */, 18 },
+ /* 4699 */ { MAD_F(0x04cdc794) /* 0.300239161 */, 18 },
+ /* 4700 */ { MAD_F(0x04ce20e9) /* 0.300324357 */, 18 },
+ /* 4701 */ { MAD_F(0x04ce7a40) /* 0.300409558 */, 18 },
+ /* 4702 */ { MAD_F(0x04ced399) /* 0.300494765 */, 18 },
+ /* 4703 */ { MAD_F(0x04cf2cf3) /* 0.300579979 */, 18 },
+
+ /* 4704 */ { MAD_F(0x04cf864f) /* 0.300665198 */, 18 },
+ /* 4705 */ { MAD_F(0x04cfdfad) /* 0.300750424 */, 18 },
+ /* 4706 */ { MAD_F(0x04d0390c) /* 0.300835656 */, 18 },
+ /* 4707 */ { MAD_F(0x04d0926d) /* 0.300920893 */, 18 },
+ /* 4708 */ { MAD_F(0x04d0ebcf) /* 0.301006137 */, 18 },
+ /* 4709 */ { MAD_F(0x04d14533) /* 0.301091387 */, 18 },
+ /* 4710 */ { MAD_F(0x04d19e99) /* 0.301176643 */, 18 },
+ /* 4711 */ { MAD_F(0x04d1f800) /* 0.301261904 */, 18 },
+ /* 4712 */ { MAD_F(0x04d25169) /* 0.301347172 */, 18 },
+ /* 4713 */ { MAD_F(0x04d2aad4) /* 0.301432446 */, 18 },
+ /* 4714 */ { MAD_F(0x04d30440) /* 0.301517726 */, 18 },
+ /* 4715 */ { MAD_F(0x04d35dae) /* 0.301603012 */, 18 },
+ /* 4716 */ { MAD_F(0x04d3b71d) /* 0.301688304 */, 18 },
+ /* 4717 */ { MAD_F(0x04d4108e) /* 0.301773602 */, 18 },
+ /* 4718 */ { MAD_F(0x04d46a01) /* 0.301858906 */, 18 },
+ /* 4719 */ { MAD_F(0x04d4c375) /* 0.301944216 */, 18 },
+
+ /* 4720 */ { MAD_F(0x04d51ceb) /* 0.302029532 */, 18 },
+ /* 4721 */ { MAD_F(0x04d57662) /* 0.302114854 */, 18 },
+ /* 4722 */ { MAD_F(0x04d5cfdb) /* 0.302200182 */, 18 },
+ /* 4723 */ { MAD_F(0x04d62956) /* 0.302285516 */, 18 },
+ /* 4724 */ { MAD_F(0x04d682d2) /* 0.302370856 */, 18 },
+ /* 4725 */ { MAD_F(0x04d6dc50) /* 0.302456203 */, 18 },
+ /* 4726 */ { MAD_F(0x04d735d0) /* 0.302541555 */, 18 },
+ /* 4727 */ { MAD_F(0x04d78f51) /* 0.302626913 */, 18 },
+ /* 4728 */ { MAD_F(0x04d7e8d4) /* 0.302712277 */, 18 },
+ /* 4729 */ { MAD_F(0x04d84258) /* 0.302797648 */, 18 },
+ /* 4730 */ { MAD_F(0x04d89bde) /* 0.302883024 */, 18 },
+ /* 4731 */ { MAD_F(0x04d8f566) /* 0.302968406 */, 18 },
+ /* 4732 */ { MAD_F(0x04d94eef) /* 0.303053794 */, 18 },
+ /* 4733 */ { MAD_F(0x04d9a87a) /* 0.303139189 */, 18 },
+ /* 4734 */ { MAD_F(0x04da0207) /* 0.303224589 */, 18 },
+ /* 4735 */ { MAD_F(0x04da5b95) /* 0.303309995 */, 18 },
+
+ /* 4736 */ { MAD_F(0x04dab524) /* 0.303395408 */, 18 },
+ /* 4737 */ { MAD_F(0x04db0eb6) /* 0.303480826 */, 18 },
+ /* 4738 */ { MAD_F(0x04db6849) /* 0.303566251 */, 18 },
+ /* 4739 */ { MAD_F(0x04dbc1dd) /* 0.303651681 */, 18 },
+ /* 4740 */ { MAD_F(0x04dc1b73) /* 0.303737117 */, 18 },
+ /* 4741 */ { MAD_F(0x04dc750b) /* 0.303822560 */, 18 },
+ /* 4742 */ { MAD_F(0x04dccea5) /* 0.303908008 */, 18 },
+ /* 4743 */ { MAD_F(0x04dd2840) /* 0.303993463 */, 18 },
+ /* 4744 */ { MAD_F(0x04dd81dc) /* 0.304078923 */, 18 },
+ /* 4745 */ { MAD_F(0x04dddb7a) /* 0.304164390 */, 18 },
+ /* 4746 */ { MAD_F(0x04de351a) /* 0.304249862 */, 18 },
+ /* 4747 */ { MAD_F(0x04de8ebc) /* 0.304335340 */, 18 },
+ /* 4748 */ { MAD_F(0x04dee85f) /* 0.304420825 */, 18 },
+ /* 4749 */ { MAD_F(0x04df4203) /* 0.304506315 */, 18 },
+ /* 4750 */ { MAD_F(0x04df9baa) /* 0.304591812 */, 18 },
+ /* 4751 */ { MAD_F(0x04dff552) /* 0.304677314 */, 18 },
+
+ /* 4752 */ { MAD_F(0x04e04efb) /* 0.304762823 */, 18 },
+ /* 4753 */ { MAD_F(0x04e0a8a6) /* 0.304848337 */, 18 },
+ /* 4754 */ { MAD_F(0x04e10253) /* 0.304933858 */, 18 },
+ /* 4755 */ { MAD_F(0x04e15c01) /* 0.305019384 */, 18 },
+ /* 4756 */ { MAD_F(0x04e1b5b1) /* 0.305104917 */, 18 },
+ /* 4757 */ { MAD_F(0x04e20f63) /* 0.305190455 */, 18 },
+ /* 4758 */ { MAD_F(0x04e26916) /* 0.305275999 */, 18 },
+ /* 4759 */ { MAD_F(0x04e2c2cb) /* 0.305361550 */, 18 },
+ /* 4760 */ { MAD_F(0x04e31c81) /* 0.305447106 */, 18 },
+ /* 4761 */ { MAD_F(0x04e37639) /* 0.305532669 */, 18 },
+ /* 4762 */ { MAD_F(0x04e3cff3) /* 0.305618237 */, 18 },
+ /* 4763 */ { MAD_F(0x04e429ae) /* 0.305703811 */, 18 },
+ /* 4764 */ { MAD_F(0x04e4836b) /* 0.305789392 */, 18 },
+ /* 4765 */ { MAD_F(0x04e4dd29) /* 0.305874978 */, 18 },
+ /* 4766 */ { MAD_F(0x04e536e9) /* 0.305960571 */, 18 },
+ /* 4767 */ { MAD_F(0x04e590ab) /* 0.306046169 */, 18 },
+
+ /* 4768 */ { MAD_F(0x04e5ea6e) /* 0.306131773 */, 18 },
+ /* 4769 */ { MAD_F(0x04e64433) /* 0.306217383 */, 18 },
+ /* 4770 */ { MAD_F(0x04e69df9) /* 0.306303000 */, 18 },
+ /* 4771 */ { MAD_F(0x04e6f7c1) /* 0.306388622 */, 18 },
+ /* 4772 */ { MAD_F(0x04e7518b) /* 0.306474250 */, 18 },
+ /* 4773 */ { MAD_F(0x04e7ab56) /* 0.306559885 */, 18 },
+ /* 4774 */ { MAD_F(0x04e80523) /* 0.306645525 */, 18 },
+ /* 4775 */ { MAD_F(0x04e85ef2) /* 0.306731171 */, 18 },
+ /* 4776 */ { MAD_F(0x04e8b8c2) /* 0.306816823 */, 18 },
+ /* 4777 */ { MAD_F(0x04e91293) /* 0.306902481 */, 18 },
+ /* 4778 */ { MAD_F(0x04e96c67) /* 0.306988145 */, 18 },
+ /* 4779 */ { MAD_F(0x04e9c63b) /* 0.307073816 */, 18 },
+ /* 4780 */ { MAD_F(0x04ea2012) /* 0.307159492 */, 18 },
+ /* 4781 */ { MAD_F(0x04ea79ea) /* 0.307245174 */, 18 },
+ /* 4782 */ { MAD_F(0x04ead3c4) /* 0.307330862 */, 18 },
+ /* 4783 */ { MAD_F(0x04eb2d9f) /* 0.307416556 */, 18 },
+
+ /* 4784 */ { MAD_F(0x04eb877c) /* 0.307502256 */, 18 },
+ /* 4785 */ { MAD_F(0x04ebe15b) /* 0.307587962 */, 18 },
+ /* 4786 */ { MAD_F(0x04ec3b3b) /* 0.307673674 */, 18 },
+ /* 4787 */ { MAD_F(0x04ec951c) /* 0.307759392 */, 18 },
+ /* 4788 */ { MAD_F(0x04ecef00) /* 0.307845115 */, 18 },
+ /* 4789 */ { MAD_F(0x04ed48e5) /* 0.307930845 */, 18 },
+ /* 4790 */ { MAD_F(0x04eda2cb) /* 0.308016581 */, 18 },
+ /* 4791 */ { MAD_F(0x04edfcb3) /* 0.308102323 */, 18 },
+ /* 4792 */ { MAD_F(0x04ee569d) /* 0.308188071 */, 18 },
+ /* 4793 */ { MAD_F(0x04eeb088) /* 0.308273824 */, 18 },
+ /* 4794 */ { MAD_F(0x04ef0a75) /* 0.308359584 */, 18 },
+ /* 4795 */ { MAD_F(0x04ef6464) /* 0.308445350 */, 18 },
+ /* 4796 */ { MAD_F(0x04efbe54) /* 0.308531121 */, 18 },
+ /* 4797 */ { MAD_F(0x04f01846) /* 0.308616899 */, 18 },
+ /* 4798 */ { MAD_F(0x04f07239) /* 0.308702682 */, 18 },
+ /* 4799 */ { MAD_F(0x04f0cc2e) /* 0.308788472 */, 18 },
+
+ /* 4800 */ { MAD_F(0x04f12624) /* 0.308874267 */, 18 },
+ /* 4801 */ { MAD_F(0x04f1801d) /* 0.308960068 */, 18 },
+ /* 4802 */ { MAD_F(0x04f1da16) /* 0.309045876 */, 18 },
+ /* 4803 */ { MAD_F(0x04f23412) /* 0.309131689 */, 18 },
+ /* 4804 */ { MAD_F(0x04f28e0f) /* 0.309217508 */, 18 },
+ /* 4805 */ { MAD_F(0x04f2e80d) /* 0.309303334 */, 18 },
+ /* 4806 */ { MAD_F(0x04f3420d) /* 0.309389165 */, 18 },
+ /* 4807 */ { MAD_F(0x04f39c0f) /* 0.309475002 */, 18 },
+ /* 4808 */ { MAD_F(0x04f3f612) /* 0.309560845 */, 18 },
+ /* 4809 */ { MAD_F(0x04f45017) /* 0.309646694 */, 18 },
+ /* 4810 */ { MAD_F(0x04f4aa1e) /* 0.309732549 */, 18 },
+ /* 4811 */ { MAD_F(0x04f50426) /* 0.309818410 */, 18 },
+ /* 4812 */ { MAD_F(0x04f55e30) /* 0.309904277 */, 18 },
+ /* 4813 */ { MAD_F(0x04f5b83b) /* 0.309990150 */, 18 },
+ /* 4814 */ { MAD_F(0x04f61248) /* 0.310076028 */, 18 },
+ /* 4815 */ { MAD_F(0x04f66c56) /* 0.310161913 */, 18 },
+
+ /* 4816 */ { MAD_F(0x04f6c666) /* 0.310247804 */, 18 },
+ /* 4817 */ { MAD_F(0x04f72078) /* 0.310333700 */, 18 },
+ /* 4818 */ { MAD_F(0x04f77a8b) /* 0.310419603 */, 18 },
+ /* 4819 */ { MAD_F(0x04f7d4a0) /* 0.310505511 */, 18 },
+ /* 4820 */ { MAD_F(0x04f82eb7) /* 0.310591426 */, 18 },
+ /* 4821 */ { MAD_F(0x04f888cf) /* 0.310677346 */, 18 },
+ /* 4822 */ { MAD_F(0x04f8e2e9) /* 0.310763272 */, 18 },
+ /* 4823 */ { MAD_F(0x04f93d04) /* 0.310849205 */, 18 },
+ /* 4824 */ { MAD_F(0x04f99721) /* 0.310935143 */, 18 },
+ /* 4825 */ { MAD_F(0x04f9f13f) /* 0.311021087 */, 18 },
+ /* 4826 */ { MAD_F(0x04fa4b5f) /* 0.311107037 */, 18 },
+ /* 4827 */ { MAD_F(0x04faa581) /* 0.311192993 */, 18 },
+ /* 4828 */ { MAD_F(0x04faffa4) /* 0.311278955 */, 18 },
+ /* 4829 */ { MAD_F(0x04fb59c9) /* 0.311364923 */, 18 },
+ /* 4830 */ { MAD_F(0x04fbb3ef) /* 0.311450897 */, 18 },
+ /* 4831 */ { MAD_F(0x04fc0e17) /* 0.311536877 */, 18 },
+
+ /* 4832 */ { MAD_F(0x04fc6841) /* 0.311622862 */, 18 },
+ /* 4833 */ { MAD_F(0x04fcc26c) /* 0.311708854 */, 18 },
+ /* 4834 */ { MAD_F(0x04fd1c99) /* 0.311794851 */, 18 },
+ /* 4835 */ { MAD_F(0x04fd76c7) /* 0.311880855 */, 18 },
+ /* 4836 */ { MAD_F(0x04fdd0f7) /* 0.311966864 */, 18 },
+ /* 4837 */ { MAD_F(0x04fe2b29) /* 0.312052880 */, 18 },
+ /* 4838 */ { MAD_F(0x04fe855c) /* 0.312138901 */, 18 },
+ /* 4839 */ { MAD_F(0x04fedf91) /* 0.312224928 */, 18 },
+ /* 4840 */ { MAD_F(0x04ff39c7) /* 0.312310961 */, 18 },
+ /* 4841 */ { MAD_F(0x04ff93ff) /* 0.312397000 */, 18 },
+ /* 4842 */ { MAD_F(0x04ffee38) /* 0.312483045 */, 18 },
+ /* 4843 */ { MAD_F(0x05004874) /* 0.312569096 */, 18 },
+ /* 4844 */ { MAD_F(0x0500a2b0) /* 0.312655153 */, 18 },
+ /* 4845 */ { MAD_F(0x0500fcef) /* 0.312741216 */, 18 },
+ /* 4846 */ { MAD_F(0x0501572e) /* 0.312827284 */, 18 },
+ /* 4847 */ { MAD_F(0x0501b170) /* 0.312913359 */, 18 },
+
+ /* 4848 */ { MAD_F(0x05020bb3) /* 0.312999439 */, 18 },
+ /* 4849 */ { MAD_F(0x050265f8) /* 0.313085526 */, 18 },
+ /* 4850 */ { MAD_F(0x0502c03e) /* 0.313171618 */, 18 },
+ /* 4851 */ { MAD_F(0x05031a86) /* 0.313257716 */, 18 },
+ /* 4852 */ { MAD_F(0x050374cf) /* 0.313343820 */, 18 },
+ /* 4853 */ { MAD_F(0x0503cf1a) /* 0.313429931 */, 18 },
+ /* 4854 */ { MAD_F(0x05042967) /* 0.313516047 */, 18 },
+ /* 4855 */ { MAD_F(0x050483b5) /* 0.313602168 */, 18 },
+ /* 4856 */ { MAD_F(0x0504de05) /* 0.313688296 */, 18 },
+ /* 4857 */ { MAD_F(0x05053856) /* 0.313774430 */, 18 },
+ /* 4858 */ { MAD_F(0x050592a9) /* 0.313860570 */, 18 },
+ /* 4859 */ { MAD_F(0x0505ecfd) /* 0.313946715 */, 18 },
+ /* 4860 */ { MAD_F(0x05064754) /* 0.314032867 */, 18 },
+ /* 4861 */ { MAD_F(0x0506a1ab) /* 0.314119024 */, 18 },
+ /* 4862 */ { MAD_F(0x0506fc04) /* 0.314205187 */, 18 },
+ /* 4863 */ { MAD_F(0x0507565f) /* 0.314291357 */, 18 },
+
+ /* 4864 */ { MAD_F(0x0507b0bc) /* 0.314377532 */, 18 },
+ /* 4865 */ { MAD_F(0x05080b1a) /* 0.314463713 */, 18 },
+ /* 4866 */ { MAD_F(0x05086579) /* 0.314549900 */, 18 },
+ /* 4867 */ { MAD_F(0x0508bfdb) /* 0.314636092 */, 18 },
+ /* 4868 */ { MAD_F(0x05091a3d) /* 0.314722291 */, 18 },
+ /* 4869 */ { MAD_F(0x050974a2) /* 0.314808496 */, 18 },
+ /* 4870 */ { MAD_F(0x0509cf08) /* 0.314894706 */, 18 },
+ /* 4871 */ { MAD_F(0x050a296f) /* 0.314980923 */, 18 },
+ /* 4872 */ { MAD_F(0x050a83d8) /* 0.315067145 */, 18 },
+ /* 4873 */ { MAD_F(0x050ade43) /* 0.315153373 */, 18 },
+ /* 4874 */ { MAD_F(0x050b38af) /* 0.315239607 */, 18 },
+ /* 4875 */ { MAD_F(0x050b931d) /* 0.315325847 */, 18 },
+ /* 4876 */ { MAD_F(0x050bed8d) /* 0.315412093 */, 18 },
+ /* 4877 */ { MAD_F(0x050c47fe) /* 0.315498345 */, 18 },
+ /* 4878 */ { MAD_F(0x050ca271) /* 0.315584603 */, 18 },
+ /* 4879 */ { MAD_F(0x050cfce5) /* 0.315670866 */, 18 },
+
+ /* 4880 */ { MAD_F(0x050d575b) /* 0.315757136 */, 18 },
+ /* 4881 */ { MAD_F(0x050db1d2) /* 0.315843411 */, 18 },
+ /* 4882 */ { MAD_F(0x050e0c4b) /* 0.315929693 */, 18 },
+ /* 4883 */ { MAD_F(0x050e66c5) /* 0.316015980 */, 18 },
+ /* 4884 */ { MAD_F(0x050ec141) /* 0.316102273 */, 18 },
+ /* 4885 */ { MAD_F(0x050f1bbf) /* 0.316188572 */, 18 },
+ /* 4886 */ { MAD_F(0x050f763e) /* 0.316274877 */, 18 },
+ /* 4887 */ { MAD_F(0x050fd0bf) /* 0.316361187 */, 18 },
+ /* 4888 */ { MAD_F(0x05102b42) /* 0.316447504 */, 18 },
+ /* 4889 */ { MAD_F(0x051085c6) /* 0.316533826 */, 18 },
+ /* 4890 */ { MAD_F(0x0510e04b) /* 0.316620155 */, 18 },
+ /* 4891 */ { MAD_F(0x05113ad3) /* 0.316706489 */, 18 },
+ /* 4892 */ { MAD_F(0x0511955b) /* 0.316792829 */, 18 },
+ /* 4893 */ { MAD_F(0x0511efe6) /* 0.316879175 */, 18 },
+ /* 4894 */ { MAD_F(0x05124a72) /* 0.316965527 */, 18 },
+ /* 4895 */ { MAD_F(0x0512a4ff) /* 0.317051885 */, 18 },
+
+ /* 4896 */ { MAD_F(0x0512ff8e) /* 0.317138249 */, 18 },
+ /* 4897 */ { MAD_F(0x05135a1f) /* 0.317224618 */, 18 },
+ /* 4898 */ { MAD_F(0x0513b4b1) /* 0.317310994 */, 18 },
+ /* 4899 */ { MAD_F(0x05140f45) /* 0.317397375 */, 18 },
+ /* 4900 */ { MAD_F(0x051469da) /* 0.317483762 */, 18 },
+ /* 4901 */ { MAD_F(0x0514c471) /* 0.317570155 */, 18 },
+ /* 4902 */ { MAD_F(0x05151f0a) /* 0.317656554 */, 18 },
+ /* 4903 */ { MAD_F(0x051579a4) /* 0.317742959 */, 18 },
+ /* 4904 */ { MAD_F(0x0515d440) /* 0.317829370 */, 18 },
+ /* 4905 */ { MAD_F(0x05162edd) /* 0.317915786 */, 18 },
+ /* 4906 */ { MAD_F(0x0516897c) /* 0.318002209 */, 18 },
+ /* 4907 */ { MAD_F(0x0516e41c) /* 0.318088637 */, 18 },
+ /* 4908 */ { MAD_F(0x05173ebe) /* 0.318175071 */, 18 },
+ /* 4909 */ { MAD_F(0x05179962) /* 0.318261511 */, 18 },
+ /* 4910 */ { MAD_F(0x0517f407) /* 0.318347957 */, 18 },
+ /* 4911 */ { MAD_F(0x05184eae) /* 0.318434409 */, 18 },
+
+ /* 4912 */ { MAD_F(0x0518a956) /* 0.318520867 */, 18 },
+ /* 4913 */ { MAD_F(0x05190400) /* 0.318607330 */, 18 },
+ /* 4914 */ { MAD_F(0x05195eab) /* 0.318693800 */, 18 },
+ /* 4915 */ { MAD_F(0x0519b958) /* 0.318780275 */, 18 },
+ /* 4916 */ { MAD_F(0x051a1407) /* 0.318866756 */, 18 },
+ /* 4917 */ { MAD_F(0x051a6eb7) /* 0.318953243 */, 18 },
+ /* 4918 */ { MAD_F(0x051ac969) /* 0.319039736 */, 18 },
+ /* 4919 */ { MAD_F(0x051b241c) /* 0.319126235 */, 18 },
+ /* 4920 */ { MAD_F(0x051b7ed1) /* 0.319212739 */, 18 },
+ /* 4921 */ { MAD_F(0x051bd987) /* 0.319299250 */, 18 },
+ /* 4922 */ { MAD_F(0x051c3440) /* 0.319385766 */, 18 },
+ /* 4923 */ { MAD_F(0x051c8ef9) /* 0.319472288 */, 18 },
+ /* 4924 */ { MAD_F(0x051ce9b4) /* 0.319558816 */, 18 },
+ /* 4925 */ { MAD_F(0x051d4471) /* 0.319645350 */, 18 },
+ /* 4926 */ { MAD_F(0x051d9f2f) /* 0.319731890 */, 18 },
+ /* 4927 */ { MAD_F(0x051df9ef) /* 0.319818435 */, 18 },
+
+ /* 4928 */ { MAD_F(0x051e54b1) /* 0.319904987 */, 18 },
+ /* 4929 */ { MAD_F(0x051eaf74) /* 0.319991544 */, 18 },
+ /* 4930 */ { MAD_F(0x051f0a38) /* 0.320078107 */, 18 },
+ /* 4931 */ { MAD_F(0x051f64ff) /* 0.320164676 */, 18 },
+ /* 4932 */ { MAD_F(0x051fbfc6) /* 0.320251251 */, 18 },
+ /* 4933 */ { MAD_F(0x05201a90) /* 0.320337832 */, 18 },
+ /* 4934 */ { MAD_F(0x0520755b) /* 0.320424419 */, 18 },
+ /* 4935 */ { MAD_F(0x0520d027) /* 0.320511011 */, 18 },
+ /* 4936 */ { MAD_F(0x05212af5) /* 0.320597609 */, 18 },
+ /* 4937 */ { MAD_F(0x052185c5) /* 0.320684213 */, 18 },
+ /* 4938 */ { MAD_F(0x0521e096) /* 0.320770823 */, 18 },
+ /* 4939 */ { MAD_F(0x05223b69) /* 0.320857439 */, 18 },
+ /* 4940 */ { MAD_F(0x0522963d) /* 0.320944061 */, 18 },
+ /* 4941 */ { MAD_F(0x0522f113) /* 0.321030688 */, 18 },
+ /* 4942 */ { MAD_F(0x05234bea) /* 0.321117322 */, 18 },
+ /* 4943 */ { MAD_F(0x0523a6c3) /* 0.321203961 */, 18 },
+
+ /* 4944 */ { MAD_F(0x0524019e) /* 0.321290606 */, 18 },
+ /* 4945 */ { MAD_F(0x05245c7a) /* 0.321377257 */, 18 },
+ /* 4946 */ { MAD_F(0x0524b758) /* 0.321463913 */, 18 },
+ /* 4947 */ { MAD_F(0x05251237) /* 0.321550576 */, 18 },
+ /* 4948 */ { MAD_F(0x05256d18) /* 0.321637244 */, 18 },
+ /* 4949 */ { MAD_F(0x0525c7fb) /* 0.321723919 */, 18 },
+ /* 4950 */ { MAD_F(0x052622df) /* 0.321810599 */, 18 },
+ /* 4951 */ { MAD_F(0x05267dc4) /* 0.321897285 */, 18 },
+ /* 4952 */ { MAD_F(0x0526d8ab) /* 0.321983976 */, 18 },
+ /* 4953 */ { MAD_F(0x05273394) /* 0.322070674 */, 18 },
+ /* 4954 */ { MAD_F(0x05278e7e) /* 0.322157377 */, 18 },
+ /* 4955 */ { MAD_F(0x0527e96a) /* 0.322244087 */, 18 },
+ /* 4956 */ { MAD_F(0x05284457) /* 0.322330802 */, 18 },
+ /* 4957 */ { MAD_F(0x05289f46) /* 0.322417523 */, 18 },
+ /* 4958 */ { MAD_F(0x0528fa37) /* 0.322504249 */, 18 },
+ /* 4959 */ { MAD_F(0x05295529) /* 0.322590982 */, 18 },
+
+ /* 4960 */ { MAD_F(0x0529b01d) /* 0.322677720 */, 18 },
+ /* 4961 */ { MAD_F(0x052a0b12) /* 0.322764465 */, 18 },
+ /* 4962 */ { MAD_F(0x052a6609) /* 0.322851215 */, 18 },
+ /* 4963 */ { MAD_F(0x052ac101) /* 0.322937971 */, 18 },
+ /* 4964 */ { MAD_F(0x052b1bfb) /* 0.323024732 */, 18 },
+ /* 4965 */ { MAD_F(0x052b76f7) /* 0.323111500 */, 18 },
+ /* 4966 */ { MAD_F(0x052bd1f4) /* 0.323198273 */, 18 },
+ /* 4967 */ { MAD_F(0x052c2cf2) /* 0.323285052 */, 18 },
+ /* 4968 */ { MAD_F(0x052c87f2) /* 0.323371837 */, 18 },
+ /* 4969 */ { MAD_F(0x052ce2f4) /* 0.323458628 */, 18 },
+ /* 4970 */ { MAD_F(0x052d3df7) /* 0.323545425 */, 18 },
+ /* 4971 */ { MAD_F(0x052d98fc) /* 0.323632227 */, 18 },
+ /* 4972 */ { MAD_F(0x052df403) /* 0.323719036 */, 18 },
+ /* 4973 */ { MAD_F(0x052e4f0b) /* 0.323805850 */, 18 },
+ /* 4974 */ { MAD_F(0x052eaa14) /* 0.323892670 */, 18 },
+ /* 4975 */ { MAD_F(0x052f051f) /* 0.323979496 */, 18 },
+
+ /* 4976 */ { MAD_F(0x052f602c) /* 0.324066327 */, 18 },
+ /* 4977 */ { MAD_F(0x052fbb3a) /* 0.324153165 */, 18 },
+ /* 4978 */ { MAD_F(0x0530164a) /* 0.324240008 */, 18 },
+ /* 4979 */ { MAD_F(0x0530715b) /* 0.324326857 */, 18 },
+ /* 4980 */ { MAD_F(0x0530cc6e) /* 0.324413712 */, 18 },
+ /* 4981 */ { MAD_F(0x05312783) /* 0.324500572 */, 18 },
+ /* 4982 */ { MAD_F(0x05318299) /* 0.324587439 */, 18 },
+ /* 4983 */ { MAD_F(0x0531ddb0) /* 0.324674311 */, 18 },
+ /* 4984 */ { MAD_F(0x053238ca) /* 0.324761189 */, 18 },
+ /* 4985 */ { MAD_F(0x053293e4) /* 0.324848073 */, 18 },
+ /* 4986 */ { MAD_F(0x0532ef01) /* 0.324934963 */, 18 },
+ /* 4987 */ { MAD_F(0x05334a1e) /* 0.325021858 */, 18 },
+ /* 4988 */ { MAD_F(0x0533a53e) /* 0.325108760 */, 18 },
+ /* 4989 */ { MAD_F(0x0534005f) /* 0.325195667 */, 18 },
+ /* 4990 */ { MAD_F(0x05345b81) /* 0.325282580 */, 18 },
+ /* 4991 */ { MAD_F(0x0534b6a5) /* 0.325369498 */, 18 },
+
+ /* 4992 */ { MAD_F(0x053511cb) /* 0.325456423 */, 18 },
+ /* 4993 */ { MAD_F(0x05356cf2) /* 0.325543353 */, 18 },
+ /* 4994 */ { MAD_F(0x0535c81b) /* 0.325630290 */, 18 },
+ /* 4995 */ { MAD_F(0x05362345) /* 0.325717232 */, 18 },
+ /* 4996 */ { MAD_F(0x05367e71) /* 0.325804179 */, 18 },
+ /* 4997 */ { MAD_F(0x0536d99f) /* 0.325891133 */, 18 },
+ /* 4998 */ { MAD_F(0x053734ce) /* 0.325978092 */, 18 },
+ /* 4999 */ { MAD_F(0x05378ffe) /* 0.326065057 */, 18 },
+ /* 5000 */ { MAD_F(0x0537eb30) /* 0.326152028 */, 18 },
+ /* 5001 */ { MAD_F(0x05384664) /* 0.326239005 */, 18 },
+ /* 5002 */ { MAD_F(0x0538a199) /* 0.326325988 */, 18 },
+ /* 5003 */ { MAD_F(0x0538fcd0) /* 0.326412976 */, 18 },
+ /* 5004 */ { MAD_F(0x05395808) /* 0.326499970 */, 18 },
+ /* 5005 */ { MAD_F(0x0539b342) /* 0.326586970 */, 18 },
+ /* 5006 */ { MAD_F(0x053a0e7d) /* 0.326673976 */, 18 },
+ /* 5007 */ { MAD_F(0x053a69ba) /* 0.326760988 */, 18 },
+
+ /* 5008 */ { MAD_F(0x053ac4f9) /* 0.326848005 */, 18 },
+ /* 5009 */ { MAD_F(0x053b2039) /* 0.326935028 */, 18 },
+ /* 5010 */ { MAD_F(0x053b7b7b) /* 0.327022057 */, 18 },
+ /* 5011 */ { MAD_F(0x053bd6be) /* 0.327109092 */, 18 },
+ /* 5012 */ { MAD_F(0x053c3203) /* 0.327196132 */, 18 },
+ /* 5013 */ { MAD_F(0x053c8d49) /* 0.327283178 */, 18 },
+ /* 5014 */ { MAD_F(0x053ce891) /* 0.327370231 */, 18 },
+ /* 5015 */ { MAD_F(0x053d43da) /* 0.327457288 */, 18 },
+ /* 5016 */ { MAD_F(0x053d9f25) /* 0.327544352 */, 18 },
+ /* 5017 */ { MAD_F(0x053dfa72) /* 0.327631421 */, 18 },
+ /* 5018 */ { MAD_F(0x053e55c0) /* 0.327718497 */, 18 },
+ /* 5019 */ { MAD_F(0x053eb10f) /* 0.327805578 */, 18 },
+ /* 5020 */ { MAD_F(0x053f0c61) /* 0.327892665 */, 18 },
+ /* 5021 */ { MAD_F(0x053f67b3) /* 0.327979757 */, 18 },
+ /* 5022 */ { MAD_F(0x053fc308) /* 0.328066855 */, 18 },
+ /* 5023 */ { MAD_F(0x05401e5e) /* 0.328153960 */, 18 },
+
+ /* 5024 */ { MAD_F(0x054079b5) /* 0.328241070 */, 18 },
+ /* 5025 */ { MAD_F(0x0540d50e) /* 0.328328185 */, 18 },
+ /* 5026 */ { MAD_F(0x05413068) /* 0.328415307 */, 18 },
+ /* 5027 */ { MAD_F(0x05418bc4) /* 0.328502434 */, 18 },
+ /* 5028 */ { MAD_F(0x0541e722) /* 0.328589567 */, 18 },
+ /* 5029 */ { MAD_F(0x05424281) /* 0.328676706 */, 18 },
+ /* 5030 */ { MAD_F(0x05429de2) /* 0.328763850 */, 18 },
+ /* 5031 */ { MAD_F(0x0542f944) /* 0.328851001 */, 18 },
+ /* 5032 */ { MAD_F(0x054354a8) /* 0.328938157 */, 18 },
+ /* 5033 */ { MAD_F(0x0543b00d) /* 0.329025319 */, 18 },
+ /* 5034 */ { MAD_F(0x05440b74) /* 0.329112486 */, 18 },
+ /* 5035 */ { MAD_F(0x054466dd) /* 0.329199660 */, 18 },
+ /* 5036 */ { MAD_F(0x0544c247) /* 0.329286839 */, 18 },
+ /* 5037 */ { MAD_F(0x05451db2) /* 0.329374024 */, 18 },
+ /* 5038 */ { MAD_F(0x0545791f) /* 0.329461215 */, 18 },
+ /* 5039 */ { MAD_F(0x0545d48e) /* 0.329548411 */, 18 },
+
+ /* 5040 */ { MAD_F(0x05462ffe) /* 0.329635614 */, 18 },
+ /* 5041 */ { MAD_F(0x05468b70) /* 0.329722822 */, 18 },
+ /* 5042 */ { MAD_F(0x0546e6e3) /* 0.329810036 */, 18 },
+ /* 5043 */ { MAD_F(0x05474258) /* 0.329897255 */, 18 },
+ /* 5044 */ { MAD_F(0x05479dce) /* 0.329984481 */, 18 },
+ /* 5045 */ { MAD_F(0x0547f946) /* 0.330071712 */, 18 },
+ /* 5046 */ { MAD_F(0x054854c0) /* 0.330158949 */, 18 },
+ /* 5047 */ { MAD_F(0x0548b03b) /* 0.330246191 */, 18 },
+ /* 5048 */ { MAD_F(0x05490bb7) /* 0.330333440 */, 18 },
+ /* 5049 */ { MAD_F(0x05496735) /* 0.330420694 */, 18 },
+ /* 5050 */ { MAD_F(0x0549c2b5) /* 0.330507954 */, 18 },
+ /* 5051 */ { MAD_F(0x054a1e36) /* 0.330595220 */, 18 },
+ /* 5052 */ { MAD_F(0x054a79b9) /* 0.330682491 */, 18 },
+ /* 5053 */ { MAD_F(0x054ad53d) /* 0.330769768 */, 18 },
+ /* 5054 */ { MAD_F(0x054b30c3) /* 0.330857051 */, 18 },
+ /* 5055 */ { MAD_F(0x054b8c4b) /* 0.330944340 */, 18 },
+
+ /* 5056 */ { MAD_F(0x054be7d4) /* 0.331031635 */, 18 },
+ /* 5057 */ { MAD_F(0x054c435e) /* 0.331118935 */, 18 },
+ /* 5058 */ { MAD_F(0x054c9eea) /* 0.331206241 */, 18 },
+ /* 5059 */ { MAD_F(0x054cfa78) /* 0.331293553 */, 18 },
+ /* 5060 */ { MAD_F(0x054d5607) /* 0.331380870 */, 18 },
+ /* 5061 */ { MAD_F(0x054db197) /* 0.331468193 */, 18 },
+ /* 5062 */ { MAD_F(0x054e0d2a) /* 0.331555522 */, 18 },
+ /* 5063 */ { MAD_F(0x054e68bd) /* 0.331642857 */, 18 },
+ /* 5064 */ { MAD_F(0x054ec453) /* 0.331730198 */, 18 },
+ /* 5065 */ { MAD_F(0x054f1fe9) /* 0.331817544 */, 18 },
+ /* 5066 */ { MAD_F(0x054f7b82) /* 0.331904896 */, 18 },
+ /* 5067 */ { MAD_F(0x054fd71c) /* 0.331992254 */, 18 },
+ /* 5068 */ { MAD_F(0x055032b7) /* 0.332079617 */, 18 },
+ /* 5069 */ { MAD_F(0x05508e54) /* 0.332166986 */, 18 },
+ /* 5070 */ { MAD_F(0x0550e9f3) /* 0.332254361 */, 18 },
+ /* 5071 */ { MAD_F(0x05514593) /* 0.332341742 */, 18 },
+
+ /* 5072 */ { MAD_F(0x0551a134) /* 0.332429129 */, 18 },
+ /* 5073 */ { MAD_F(0x0551fcd8) /* 0.332516521 */, 18 },
+ /* 5074 */ { MAD_F(0x0552587c) /* 0.332603919 */, 18 },
+ /* 5075 */ { MAD_F(0x0552b423) /* 0.332691323 */, 18 },
+ /* 5076 */ { MAD_F(0x05530fca) /* 0.332778732 */, 18 },
+ /* 5077 */ { MAD_F(0x05536b74) /* 0.332866147 */, 18 },
+ /* 5078 */ { MAD_F(0x0553c71f) /* 0.332953568 */, 18 },
+ /* 5079 */ { MAD_F(0x055422cb) /* 0.333040995 */, 18 },
+ /* 5080 */ { MAD_F(0x05547e79) /* 0.333128427 */, 18 },
+ /* 5081 */ { MAD_F(0x0554da29) /* 0.333215865 */, 18 },
+ /* 5082 */ { MAD_F(0x055535da) /* 0.333303309 */, 18 },
+ /* 5083 */ { MAD_F(0x0555918c) /* 0.333390759 */, 18 },
+ /* 5084 */ { MAD_F(0x0555ed40) /* 0.333478214 */, 18 },
+ /* 5085 */ { MAD_F(0x055648f6) /* 0.333565675 */, 18 },
+ /* 5086 */ { MAD_F(0x0556a4ad) /* 0.333653142 */, 18 },
+ /* 5087 */ { MAD_F(0x05570066) /* 0.333740615 */, 18 },
+
+ /* 5088 */ { MAD_F(0x05575c20) /* 0.333828093 */, 18 },
+ /* 5089 */ { MAD_F(0x0557b7dc) /* 0.333915577 */, 18 },
+ /* 5090 */ { MAD_F(0x05581399) /* 0.334003067 */, 18 },
+ /* 5091 */ { MAD_F(0x05586f58) /* 0.334090562 */, 18 },
+ /* 5092 */ { MAD_F(0x0558cb19) /* 0.334178063 */, 18 },
+ /* 5093 */ { MAD_F(0x055926db) /* 0.334265570 */, 18 },
+ /* 5094 */ { MAD_F(0x0559829e) /* 0.334353083 */, 18 },
+ /* 5095 */ { MAD_F(0x0559de63) /* 0.334440601 */, 18 },
+ /* 5096 */ { MAD_F(0x055a3a2a) /* 0.334528126 */, 18 },
+ /* 5097 */ { MAD_F(0x055a95f2) /* 0.334615655 */, 18 },
+ /* 5098 */ { MAD_F(0x055af1bb) /* 0.334703191 */, 18 },
+ /* 5099 */ { MAD_F(0x055b4d87) /* 0.334790732 */, 18 },
+ /* 5100 */ { MAD_F(0x055ba953) /* 0.334878279 */, 18 },
+ /* 5101 */ { MAD_F(0x055c0522) /* 0.334965832 */, 18 },
+ /* 5102 */ { MAD_F(0x055c60f1) /* 0.335053391 */, 18 },
+ /* 5103 */ { MAD_F(0x055cbcc3) /* 0.335140955 */, 18 },
+
+ /* 5104 */ { MAD_F(0x055d1896) /* 0.335228525 */, 18 },
+ /* 5105 */ { MAD_F(0x055d746a) /* 0.335316100 */, 18 },
+ /* 5106 */ { MAD_F(0x055dd040) /* 0.335403682 */, 18 },
+ /* 5107 */ { MAD_F(0x055e2c17) /* 0.335491269 */, 18 },
+ /* 5108 */ { MAD_F(0x055e87f0) /* 0.335578861 */, 18 },
+ /* 5109 */ { MAD_F(0x055ee3cb) /* 0.335666460 */, 18 },
+ /* 5110 */ { MAD_F(0x055f3fa7) /* 0.335754064 */, 18 },
+ /* 5111 */ { MAD_F(0x055f9b85) /* 0.335841674 */, 18 },
+ /* 5112 */ { MAD_F(0x055ff764) /* 0.335929290 */, 18 },
+ /* 5113 */ { MAD_F(0x05605344) /* 0.336016911 */, 18 },
+ /* 5114 */ { MAD_F(0x0560af27) /* 0.336104538 */, 18 },
+ /* 5115 */ { MAD_F(0x05610b0a) /* 0.336192171 */, 18 },
+ /* 5116 */ { MAD_F(0x056166f0) /* 0.336279809 */, 18 },
+ /* 5117 */ { MAD_F(0x0561c2d7) /* 0.336367453 */, 18 },
+ /* 5118 */ { MAD_F(0x05621ebf) /* 0.336455103 */, 18 },
+ /* 5119 */ { MAD_F(0x05627aa9) /* 0.336542759 */, 18 },
+
+ /* 5120 */ { MAD_F(0x0562d694) /* 0.336630420 */, 18 },
+ /* 5121 */ { MAD_F(0x05633281) /* 0.336718087 */, 18 },
+ /* 5122 */ { MAD_F(0x05638e70) /* 0.336805760 */, 18 },
+ /* 5123 */ { MAD_F(0x0563ea60) /* 0.336893439 */, 18 },
+ /* 5124 */ { MAD_F(0x05644651) /* 0.336981123 */, 18 },
+ /* 5125 */ { MAD_F(0x0564a244) /* 0.337068813 */, 18 },
+ /* 5126 */ { MAD_F(0x0564fe39) /* 0.337156508 */, 18 },
+ /* 5127 */ { MAD_F(0x05655a2f) /* 0.337244209 */, 18 },
+ /* 5128 */ { MAD_F(0x0565b627) /* 0.337331916 */, 18 },
+ /* 5129 */ { MAD_F(0x05661220) /* 0.337419629 */, 18 },
+ /* 5130 */ { MAD_F(0x05666e1a) /* 0.337507347 */, 18 },
+ /* 5131 */ { MAD_F(0x0566ca17) /* 0.337595071 */, 18 },
+ /* 5132 */ { MAD_F(0x05672614) /* 0.337682801 */, 18 },
+ /* 5133 */ { MAD_F(0x05678214) /* 0.337770537 */, 18 },
+ /* 5134 */ { MAD_F(0x0567de15) /* 0.337858278 */, 18 },
+ /* 5135 */ { MAD_F(0x05683a17) /* 0.337946025 */, 18 },
+
+ /* 5136 */ { MAD_F(0x0568961b) /* 0.338033777 */, 18 },
+ /* 5137 */ { MAD_F(0x0568f220) /* 0.338121535 */, 18 },
+ /* 5138 */ { MAD_F(0x05694e27) /* 0.338209299 */, 18 },
+ /* 5139 */ { MAD_F(0x0569aa30) /* 0.338297069 */, 18 },
+ /* 5140 */ { MAD_F(0x056a063a) /* 0.338384844 */, 18 },
+ /* 5141 */ { MAD_F(0x056a6245) /* 0.338472625 */, 18 },
+ /* 5142 */ { MAD_F(0x056abe52) /* 0.338560412 */, 18 },
+ /* 5143 */ { MAD_F(0x056b1a61) /* 0.338648204 */, 18 },
+ /* 5144 */ { MAD_F(0x056b7671) /* 0.338736002 */, 18 },
+ /* 5145 */ { MAD_F(0x056bd283) /* 0.338823806 */, 18 },
+ /* 5146 */ { MAD_F(0x056c2e96) /* 0.338911616 */, 18 },
+ /* 5147 */ { MAD_F(0x056c8aab) /* 0.338999431 */, 18 },
+ /* 5148 */ { MAD_F(0x056ce6c1) /* 0.339087252 */, 18 },
+ /* 5149 */ { MAD_F(0x056d42d9) /* 0.339175078 */, 18 },
+ /* 5150 */ { MAD_F(0x056d9ef2) /* 0.339262910 */, 18 },
+ /* 5151 */ { MAD_F(0x056dfb0d) /* 0.339350748 */, 18 },
+
+ /* 5152 */ { MAD_F(0x056e5729) /* 0.339438592 */, 18 },
+ /* 5153 */ { MAD_F(0x056eb347) /* 0.339526441 */, 18 },
+ /* 5154 */ { MAD_F(0x056f0f66) /* 0.339614296 */, 18 },
+ /* 5155 */ { MAD_F(0x056f6b87) /* 0.339702157 */, 18 },
+ /* 5156 */ { MAD_F(0x056fc7aa) /* 0.339790023 */, 18 },
+ /* 5157 */ { MAD_F(0x057023cd) /* 0.339877895 */, 18 },
+ /* 5158 */ { MAD_F(0x05707ff3) /* 0.339965773 */, 18 },
+ /* 5159 */ { MAD_F(0x0570dc1a) /* 0.340053656 */, 18 },
+ /* 5160 */ { MAD_F(0x05713843) /* 0.340141545 */, 18 },
+ /* 5161 */ { MAD_F(0x0571946d) /* 0.340229440 */, 18 },
+ /* 5162 */ { MAD_F(0x0571f098) /* 0.340317340 */, 18 },
+ /* 5163 */ { MAD_F(0x05724cc5) /* 0.340405246 */, 18 },
+ /* 5164 */ { MAD_F(0x0572a8f4) /* 0.340493158 */, 18 },
+ /* 5165 */ { MAD_F(0x05730524) /* 0.340581075 */, 18 },
+ /* 5166 */ { MAD_F(0x05736156) /* 0.340668999 */, 18 },
+ /* 5167 */ { MAD_F(0x0573bd89) /* 0.340756927 */, 18 },
+
+ /* 5168 */ { MAD_F(0x057419be) /* 0.340844862 */, 18 },
+ /* 5169 */ { MAD_F(0x057475f4) /* 0.340932802 */, 18 },
+ /* 5170 */ { MAD_F(0x0574d22c) /* 0.341020748 */, 18 },
+ /* 5171 */ { MAD_F(0x05752e65) /* 0.341108699 */, 18 },
+ /* 5172 */ { MAD_F(0x05758aa0) /* 0.341196656 */, 18 },
+ /* 5173 */ { MAD_F(0x0575e6dc) /* 0.341284619 */, 18 },
+ /* 5174 */ { MAD_F(0x0576431a) /* 0.341372587 */, 18 },
+ /* 5175 */ { MAD_F(0x05769f59) /* 0.341460562 */, 18 },
+ /* 5176 */ { MAD_F(0x0576fb9a) /* 0.341548541 */, 18 },
+ /* 5177 */ { MAD_F(0x057757dd) /* 0.341636527 */, 18 },
+ /* 5178 */ { MAD_F(0x0577b421) /* 0.341724518 */, 18 },
+ /* 5179 */ { MAD_F(0x05781066) /* 0.341812515 */, 18 },
+ /* 5180 */ { MAD_F(0x05786cad) /* 0.341900517 */, 18 },
+ /* 5181 */ { MAD_F(0x0578c8f5) /* 0.341988525 */, 18 },
+ /* 5182 */ { MAD_F(0x0579253f) /* 0.342076539 */, 18 },
+ /* 5183 */ { MAD_F(0x0579818b) /* 0.342164558 */, 18 },
+
+ /* 5184 */ { MAD_F(0x0579ddd8) /* 0.342252584 */, 18 },
+ /* 5185 */ { MAD_F(0x057a3a27) /* 0.342340614 */, 18 },
+ /* 5186 */ { MAD_F(0x057a9677) /* 0.342428651 */, 18 },
+ /* 5187 */ { MAD_F(0x057af2c8) /* 0.342516693 */, 18 },
+ /* 5188 */ { MAD_F(0x057b4f1c) /* 0.342604741 */, 18 },
+ /* 5189 */ { MAD_F(0x057bab70) /* 0.342692794 */, 18 },
+ /* 5190 */ { MAD_F(0x057c07c6) /* 0.342780853 */, 18 },
+ /* 5191 */ { MAD_F(0x057c641e) /* 0.342868918 */, 18 },
+ /* 5192 */ { MAD_F(0x057cc077) /* 0.342956988 */, 18 },
+ /* 5193 */ { MAD_F(0x057d1cd2) /* 0.343045064 */, 18 },
+ /* 5194 */ { MAD_F(0x057d792e) /* 0.343133146 */, 18 },
+ /* 5195 */ { MAD_F(0x057dd58c) /* 0.343221233 */, 18 },
+ /* 5196 */ { MAD_F(0x057e31eb) /* 0.343309326 */, 18 },
+ /* 5197 */ { MAD_F(0x057e8e4c) /* 0.343397425 */, 18 },
+ /* 5198 */ { MAD_F(0x057eeaae) /* 0.343485529 */, 18 },
+ /* 5199 */ { MAD_F(0x057f4712) /* 0.343573639 */, 18 },
+
+ /* 5200 */ { MAD_F(0x057fa378) /* 0.343661754 */, 18 },
+ /* 5201 */ { MAD_F(0x057fffde) /* 0.343749876 */, 18 },
+ /* 5202 */ { MAD_F(0x05805c47) /* 0.343838003 */, 18 },
+ /* 5203 */ { MAD_F(0x0580b8b1) /* 0.343926135 */, 18 },
+ /* 5204 */ { MAD_F(0x0581151c) /* 0.344014273 */, 18 },
+ /* 5205 */ { MAD_F(0x05817189) /* 0.344102417 */, 18 },
+ /* 5206 */ { MAD_F(0x0581cdf7) /* 0.344190566 */, 18 },
+ /* 5207 */ { MAD_F(0x05822a67) /* 0.344278722 */, 18 },
+ /* 5208 */ { MAD_F(0x058286d9) /* 0.344366882 */, 18 },
+ /* 5209 */ { MAD_F(0x0582e34c) /* 0.344455049 */, 18 },
+ /* 5210 */ { MAD_F(0x05833fc0) /* 0.344543221 */, 18 },
+ /* 5211 */ { MAD_F(0x05839c36) /* 0.344631398 */, 18 },
+ /* 5212 */ { MAD_F(0x0583f8ae) /* 0.344719582 */, 18 },
+ /* 5213 */ { MAD_F(0x05845527) /* 0.344807771 */, 18 },
+ /* 5214 */ { MAD_F(0x0584b1a1) /* 0.344895965 */, 18 },
+ /* 5215 */ { MAD_F(0x05850e1e) /* 0.344984165 */, 18 },
+
+ /* 5216 */ { MAD_F(0x05856a9b) /* 0.345072371 */, 18 },
+ /* 5217 */ { MAD_F(0x0585c71a) /* 0.345160583 */, 18 },
+ /* 5218 */ { MAD_F(0x0586239b) /* 0.345248800 */, 18 },
+ /* 5219 */ { MAD_F(0x0586801d) /* 0.345337023 */, 18 },
+ /* 5220 */ { MAD_F(0x0586dca1) /* 0.345425251 */, 18 },
+ /* 5221 */ { MAD_F(0x05873926) /* 0.345513485 */, 18 },
+ /* 5222 */ { MAD_F(0x058795ac) /* 0.345601725 */, 18 },
+ /* 5223 */ { MAD_F(0x0587f235) /* 0.345689970 */, 18 },
+ /* 5224 */ { MAD_F(0x05884ebe) /* 0.345778221 */, 18 },
+ /* 5225 */ { MAD_F(0x0588ab49) /* 0.345866478 */, 18 },
+ /* 5226 */ { MAD_F(0x058907d6) /* 0.345954740 */, 18 },
+ /* 5227 */ { MAD_F(0x05896464) /* 0.346043008 */, 18 },
+ /* 5228 */ { MAD_F(0x0589c0f4) /* 0.346131281 */, 18 },
+ /* 5229 */ { MAD_F(0x058a1d85) /* 0.346219560 */, 18 },
+ /* 5230 */ { MAD_F(0x058a7a18) /* 0.346307845 */, 18 },
+ /* 5231 */ { MAD_F(0x058ad6ac) /* 0.346396135 */, 18 },
+
+ /* 5232 */ { MAD_F(0x058b3342) /* 0.346484431 */, 18 },
+ /* 5233 */ { MAD_F(0x058b8fd9) /* 0.346572733 */, 18 },
+ /* 5234 */ { MAD_F(0x058bec72) /* 0.346661040 */, 18 },
+ /* 5235 */ { MAD_F(0x058c490c) /* 0.346749353 */, 18 },
+ /* 5236 */ { MAD_F(0x058ca5a8) /* 0.346837671 */, 18 },
+ /* 5237 */ { MAD_F(0x058d0246) /* 0.346925996 */, 18 },
+ /* 5238 */ { MAD_F(0x058d5ee4) /* 0.347014325 */, 18 },
+ /* 5239 */ { MAD_F(0x058dbb85) /* 0.347102661 */, 18 },
+ /* 5240 */ { MAD_F(0x058e1827) /* 0.347191002 */, 18 },
+ /* 5241 */ { MAD_F(0x058e74ca) /* 0.347279348 */, 18 },
+ /* 5242 */ { MAD_F(0x058ed16f) /* 0.347367700 */, 18 },
+ /* 5243 */ { MAD_F(0x058f2e15) /* 0.347456058 */, 18 },
+ /* 5244 */ { MAD_F(0x058f8abd) /* 0.347544422 */, 18 },
+ /* 5245 */ { MAD_F(0x058fe766) /* 0.347632791 */, 18 },
+ /* 5246 */ { MAD_F(0x05904411) /* 0.347721165 */, 18 },
+ /* 5247 */ { MAD_F(0x0590a0be) /* 0.347809546 */, 18 },
+
+ /* 5248 */ { MAD_F(0x0590fd6c) /* 0.347897931 */, 18 },
+ /* 5249 */ { MAD_F(0x05915a1b) /* 0.347986323 */, 18 },
+ /* 5250 */ { MAD_F(0x0591b6cc) /* 0.348074720 */, 18 },
+ /* 5251 */ { MAD_F(0x0592137e) /* 0.348163123 */, 18 },
+ /* 5252 */ { MAD_F(0x05927032) /* 0.348251531 */, 18 },
+ /* 5253 */ { MAD_F(0x0592cce8) /* 0.348339945 */, 18 },
+ /* 5254 */ { MAD_F(0x0593299f) /* 0.348428365 */, 18 },
+ /* 5255 */ { MAD_F(0x05938657) /* 0.348516790 */, 18 },
+ /* 5256 */ { MAD_F(0x0593e311) /* 0.348605221 */, 18 },
+ /* 5257 */ { MAD_F(0x05943fcd) /* 0.348693657 */, 18 },
+ /* 5258 */ { MAD_F(0x05949c8a) /* 0.348782099 */, 18 },
+ /* 5259 */ { MAD_F(0x0594f948) /* 0.348870547 */, 18 },
+ /* 5260 */ { MAD_F(0x05955608) /* 0.348959000 */, 18 },
+ /* 5261 */ { MAD_F(0x0595b2ca) /* 0.349047459 */, 18 },
+ /* 5262 */ { MAD_F(0x05960f8c) /* 0.349135923 */, 18 },
+ /* 5263 */ { MAD_F(0x05966c51) /* 0.349224393 */, 18 },
+
+ /* 5264 */ { MAD_F(0x0596c917) /* 0.349312869 */, 18 },
+ /* 5265 */ { MAD_F(0x059725de) /* 0.349401350 */, 18 },
+ /* 5266 */ { MAD_F(0x059782a7) /* 0.349489837 */, 18 },
+ /* 5267 */ { MAD_F(0x0597df72) /* 0.349578329 */, 18 },
+ /* 5268 */ { MAD_F(0x05983c3e) /* 0.349666827 */, 18 },
+ /* 5269 */ { MAD_F(0x0598990c) /* 0.349755331 */, 18 },
+ /* 5270 */ { MAD_F(0x0598f5db) /* 0.349843840 */, 18 },
+ /* 5271 */ { MAD_F(0x059952ab) /* 0.349932355 */, 18 },
+ /* 5272 */ { MAD_F(0x0599af7d) /* 0.350020876 */, 18 },
+ /* 5273 */ { MAD_F(0x059a0c51) /* 0.350109402 */, 18 },
+ /* 5274 */ { MAD_F(0x059a6926) /* 0.350197933 */, 18 },
+ /* 5275 */ { MAD_F(0x059ac5fc) /* 0.350286470 */, 18 },
+ /* 5276 */ { MAD_F(0x059b22d4) /* 0.350375013 */, 18 },
+ /* 5277 */ { MAD_F(0x059b7fae) /* 0.350463562 */, 18 },
+ /* 5278 */ { MAD_F(0x059bdc89) /* 0.350552116 */, 18 },
+ /* 5279 */ { MAD_F(0x059c3965) /* 0.350640675 */, 18 },
+
+ /* 5280 */ { MAD_F(0x059c9643) /* 0.350729240 */, 18 },
+ /* 5281 */ { MAD_F(0x059cf323) /* 0.350817811 */, 18 },
+ /* 5282 */ { MAD_F(0x059d5004) /* 0.350906388 */, 18 },
+ /* 5283 */ { MAD_F(0x059dace6) /* 0.350994970 */, 18 },
+ /* 5284 */ { MAD_F(0x059e09cb) /* 0.351083557 */, 18 },
+ /* 5285 */ { MAD_F(0x059e66b0) /* 0.351172150 */, 18 },
+ /* 5286 */ { MAD_F(0x059ec397) /* 0.351260749 */, 18 },
+ /* 5287 */ { MAD_F(0x059f2080) /* 0.351349353 */, 18 },
+ /* 5288 */ { MAD_F(0x059f7d6a) /* 0.351437963 */, 18 },
+ /* 5289 */ { MAD_F(0x059fda55) /* 0.351526579 */, 18 },
+ /* 5290 */ { MAD_F(0x05a03742) /* 0.351615200 */, 18 },
+ /* 5291 */ { MAD_F(0x05a09431) /* 0.351703827 */, 18 },
+ /* 5292 */ { MAD_F(0x05a0f121) /* 0.351792459 */, 18 },
+ /* 5293 */ { MAD_F(0x05a14e12) /* 0.351881097 */, 18 },
+ /* 5294 */ { MAD_F(0x05a1ab05) /* 0.351969740 */, 18 },
+ /* 5295 */ { MAD_F(0x05a207fa) /* 0.352058389 */, 18 },
+
+ /* 5296 */ { MAD_F(0x05a264f0) /* 0.352147044 */, 18 },
+ /* 5297 */ { MAD_F(0x05a2c1e7) /* 0.352235704 */, 18 },
+ /* 5298 */ { MAD_F(0x05a31ee1) /* 0.352324369 */, 18 },
+ /* 5299 */ { MAD_F(0x05a37bdb) /* 0.352413041 */, 18 },
+ /* 5300 */ { MAD_F(0x05a3d8d7) /* 0.352501718 */, 18 },
+ /* 5301 */ { MAD_F(0x05a435d5) /* 0.352590400 */, 18 },
+ /* 5302 */ { MAD_F(0x05a492d4) /* 0.352679088 */, 18 },
+ /* 5303 */ { MAD_F(0x05a4efd4) /* 0.352767782 */, 18 },
+ /* 5304 */ { MAD_F(0x05a54cd6) /* 0.352856481 */, 18 },
+ /* 5305 */ { MAD_F(0x05a5a9da) /* 0.352945186 */, 18 },
+ /* 5306 */ { MAD_F(0x05a606df) /* 0.353033896 */, 18 },
+ /* 5307 */ { MAD_F(0x05a663e5) /* 0.353122612 */, 18 },
+ /* 5308 */ { MAD_F(0x05a6c0ed) /* 0.353211333 */, 18 },
+ /* 5309 */ { MAD_F(0x05a71df7) /* 0.353300061 */, 18 },
+ /* 5310 */ { MAD_F(0x05a77b02) /* 0.353388793 */, 18 },
+ /* 5311 */ { MAD_F(0x05a7d80e) /* 0.353477531 */, 18 },
+
+ /* 5312 */ { MAD_F(0x05a8351c) /* 0.353566275 */, 18 },
+ /* 5313 */ { MAD_F(0x05a8922c) /* 0.353655024 */, 18 },
+ /* 5314 */ { MAD_F(0x05a8ef3c) /* 0.353743779 */, 18 },
+ /* 5315 */ { MAD_F(0x05a94c4f) /* 0.353832540 */, 18 },
+ /* 5316 */ { MAD_F(0x05a9a963) /* 0.353921306 */, 18 },
+ /* 5317 */ { MAD_F(0x05aa0678) /* 0.354010077 */, 18 },
+ /* 5318 */ { MAD_F(0x05aa638f) /* 0.354098855 */, 18 },
+ /* 5319 */ { MAD_F(0x05aac0a8) /* 0.354187637 */, 18 },
+ /* 5320 */ { MAD_F(0x05ab1dc2) /* 0.354276426 */, 18 },
+ /* 5321 */ { MAD_F(0x05ab7add) /* 0.354365220 */, 18 },
+ /* 5322 */ { MAD_F(0x05abd7fa) /* 0.354454019 */, 18 },
+ /* 5323 */ { MAD_F(0x05ac3518) /* 0.354542824 */, 18 },
+ /* 5324 */ { MAD_F(0x05ac9238) /* 0.354631635 */, 18 },
+ /* 5325 */ { MAD_F(0x05acef5a) /* 0.354720451 */, 18 },
+ /* 5326 */ { MAD_F(0x05ad4c7d) /* 0.354809272 */, 18 },
+ /* 5327 */ { MAD_F(0x05ada9a1) /* 0.354898100 */, 18 },
+
+ /* 5328 */ { MAD_F(0x05ae06c7) /* 0.354986932 */, 18 },
+ /* 5329 */ { MAD_F(0x05ae63ee) /* 0.355075771 */, 18 },
+ /* 5330 */ { MAD_F(0x05aec117) /* 0.355164615 */, 18 },
+ /* 5331 */ { MAD_F(0x05af1e41) /* 0.355253464 */, 18 },
+ /* 5332 */ { MAD_F(0x05af7b6d) /* 0.355342319 */, 18 },
+ /* 5333 */ { MAD_F(0x05afd89b) /* 0.355431180 */, 18 },
+ /* 5334 */ { MAD_F(0x05b035c9) /* 0.355520046 */, 18 },
+ /* 5335 */ { MAD_F(0x05b092fa) /* 0.355608917 */, 18 },
+ /* 5336 */ { MAD_F(0x05b0f02b) /* 0.355697795 */, 18 },
+ /* 5337 */ { MAD_F(0x05b14d5f) /* 0.355786677 */, 18 },
+ /* 5338 */ { MAD_F(0x05b1aa94) /* 0.355875566 */, 18 },
+ /* 5339 */ { MAD_F(0x05b207ca) /* 0.355964460 */, 18 },
+ /* 5340 */ { MAD_F(0x05b26502) /* 0.356053359 */, 18 },
+ /* 5341 */ { MAD_F(0x05b2c23b) /* 0.356142264 */, 18 },
+ /* 5342 */ { MAD_F(0x05b31f76) /* 0.356231175 */, 18 },
+ /* 5343 */ { MAD_F(0x05b37cb2) /* 0.356320091 */, 18 },
+
+ /* 5344 */ { MAD_F(0x05b3d9f0) /* 0.356409012 */, 18 },
+ /* 5345 */ { MAD_F(0x05b4372f) /* 0.356497940 */, 18 },
+ /* 5346 */ { MAD_F(0x05b4946f) /* 0.356586872 */, 18 },
+ /* 5347 */ { MAD_F(0x05b4f1b2) /* 0.356675811 */, 18 },
+ /* 5348 */ { MAD_F(0x05b54ef5) /* 0.356764754 */, 18 },
+ /* 5349 */ { MAD_F(0x05b5ac3a) /* 0.356853704 */, 18 },
+ /* 5350 */ { MAD_F(0x05b60981) /* 0.356942659 */, 18 },
+ /* 5351 */ { MAD_F(0x05b666c9) /* 0.357031619 */, 18 },
+ /* 5352 */ { MAD_F(0x05b6c413) /* 0.357120585 */, 18 },
+ /* 5353 */ { MAD_F(0x05b7215e) /* 0.357209557 */, 18 },
+ /* 5354 */ { MAD_F(0x05b77eab) /* 0.357298534 */, 18 },
+ /* 5355 */ { MAD_F(0x05b7dbf9) /* 0.357387516 */, 18 },
+ /* 5356 */ { MAD_F(0x05b83948) /* 0.357476504 */, 18 },
+ /* 5357 */ { MAD_F(0x05b89699) /* 0.357565498 */, 18 },
+ /* 5358 */ { MAD_F(0x05b8f3ec) /* 0.357654497 */, 18 },
+ /* 5359 */ { MAD_F(0x05b95140) /* 0.357743502 */, 18 },
+
+ /* 5360 */ { MAD_F(0x05b9ae95) /* 0.357832512 */, 18 },
+ /* 5361 */ { MAD_F(0x05ba0bec) /* 0.357921528 */, 18 },
+ /* 5362 */ { MAD_F(0x05ba6945) /* 0.358010550 */, 18 },
+ /* 5363 */ { MAD_F(0x05bac69f) /* 0.358099576 */, 18 },
+ /* 5364 */ { MAD_F(0x05bb23fa) /* 0.358188609 */, 18 },
+ /* 5365 */ { MAD_F(0x05bb8157) /* 0.358277647 */, 18 },
+ /* 5366 */ { MAD_F(0x05bbdeb6) /* 0.358366690 */, 18 },
+ /* 5367 */ { MAD_F(0x05bc3c16) /* 0.358455739 */, 18 },
+ /* 5368 */ { MAD_F(0x05bc9977) /* 0.358544794 */, 18 },
+ /* 5369 */ { MAD_F(0x05bcf6da) /* 0.358633854 */, 18 },
+ /* 5370 */ { MAD_F(0x05bd543e) /* 0.358722920 */, 18 },
+ /* 5371 */ { MAD_F(0x05bdb1a4) /* 0.358811991 */, 18 },
+ /* 5372 */ { MAD_F(0x05be0f0b) /* 0.358901067 */, 18 },
+ /* 5373 */ { MAD_F(0x05be6c74) /* 0.358990150 */, 18 },
+ /* 5374 */ { MAD_F(0x05bec9df) /* 0.359079237 */, 18 },
+ /* 5375 */ { MAD_F(0x05bf274a) /* 0.359168331 */, 18 },
+
+ /* 5376 */ { MAD_F(0x05bf84b8) /* 0.359257429 */, 18 },
+ /* 5377 */ { MAD_F(0x05bfe226) /* 0.359346534 */, 18 },
+ /* 5378 */ { MAD_F(0x05c03f97) /* 0.359435644 */, 18 },
+ /* 5379 */ { MAD_F(0x05c09d08) /* 0.359524759 */, 18 },
+ /* 5380 */ { MAD_F(0x05c0fa7c) /* 0.359613880 */, 18 },
+ /* 5381 */ { MAD_F(0x05c157f0) /* 0.359703006 */, 18 },
+ /* 5382 */ { MAD_F(0x05c1b566) /* 0.359792138 */, 18 },
+ /* 5383 */ { MAD_F(0x05c212de) /* 0.359881276 */, 18 },
+ /* 5384 */ { MAD_F(0x05c27057) /* 0.359970419 */, 18 },
+ /* 5385 */ { MAD_F(0x05c2cdd2) /* 0.360059567 */, 18 },
+ /* 5386 */ { MAD_F(0x05c32b4e) /* 0.360148721 */, 18 },
+ /* 5387 */ { MAD_F(0x05c388cb) /* 0.360237881 */, 18 },
+ /* 5388 */ { MAD_F(0x05c3e64b) /* 0.360327046 */, 18 },
+ /* 5389 */ { MAD_F(0x05c443cb) /* 0.360416216 */, 18 },
+ /* 5390 */ { MAD_F(0x05c4a14d) /* 0.360505392 */, 18 },
+ /* 5391 */ { MAD_F(0x05c4fed1) /* 0.360594574 */, 18 },
+
+ /* 5392 */ { MAD_F(0x05c55c56) /* 0.360683761 */, 18 },
+ /* 5393 */ { MAD_F(0x05c5b9dc) /* 0.360772953 */, 18 },
+ /* 5394 */ { MAD_F(0x05c61764) /* 0.360862152 */, 18 },
+ /* 5395 */ { MAD_F(0x05c674ed) /* 0.360951355 */, 18 },
+ /* 5396 */ { MAD_F(0x05c6d278) /* 0.361040564 */, 18 },
+ /* 5397 */ { MAD_F(0x05c73005) /* 0.361129779 */, 18 },
+ /* 5398 */ { MAD_F(0x05c78d93) /* 0.361218999 */, 18 },
+ /* 5399 */ { MAD_F(0x05c7eb22) /* 0.361308225 */, 18 },
+ /* 5400 */ { MAD_F(0x05c848b3) /* 0.361397456 */, 18 },
+ /* 5401 */ { MAD_F(0x05c8a645) /* 0.361486693 */, 18 },
+ /* 5402 */ { MAD_F(0x05c903d9) /* 0.361575935 */, 18 },
+ /* 5403 */ { MAD_F(0x05c9616e) /* 0.361665183 */, 18 },
+ /* 5404 */ { MAD_F(0x05c9bf05) /* 0.361754436 */, 18 },
+ /* 5405 */ { MAD_F(0x05ca1c9d) /* 0.361843695 */, 18 },
+ /* 5406 */ { MAD_F(0x05ca7a37) /* 0.361932959 */, 18 },
+ /* 5407 */ { MAD_F(0x05cad7d2) /* 0.362022229 */, 18 },
+
+ /* 5408 */ { MAD_F(0x05cb356e) /* 0.362111504 */, 18 },
+ /* 5409 */ { MAD_F(0x05cb930d) /* 0.362200785 */, 18 },
+ /* 5410 */ { MAD_F(0x05cbf0ac) /* 0.362290071 */, 18 },
+ /* 5411 */ { MAD_F(0x05cc4e4d) /* 0.362379362 */, 18 },
+ /* 5412 */ { MAD_F(0x05ccabf0) /* 0.362468660 */, 18 },
+ /* 5413 */ { MAD_F(0x05cd0994) /* 0.362557962 */, 18 },
+ /* 5414 */ { MAD_F(0x05cd6739) /* 0.362647271 */, 18 },
+ /* 5415 */ { MAD_F(0x05cdc4e0) /* 0.362736584 */, 18 },
+ /* 5416 */ { MAD_F(0x05ce2289) /* 0.362825904 */, 18 },
+ /* 5417 */ { MAD_F(0x05ce8033) /* 0.362915228 */, 18 },
+ /* 5418 */ { MAD_F(0x05ceddde) /* 0.363004559 */, 18 },
+ /* 5419 */ { MAD_F(0x05cf3b8b) /* 0.363093894 */, 18 },
+ /* 5420 */ { MAD_F(0x05cf9939) /* 0.363183236 */, 18 },
+ /* 5421 */ { MAD_F(0x05cff6e9) /* 0.363272582 */, 18 },
+ /* 5422 */ { MAD_F(0x05d0549a) /* 0.363361935 */, 18 },
+ /* 5423 */ { MAD_F(0x05d0b24d) /* 0.363451292 */, 18 },
+
+ /* 5424 */ { MAD_F(0x05d11001) /* 0.363540655 */, 18 },
+ /* 5425 */ { MAD_F(0x05d16db7) /* 0.363630024 */, 18 },
+ /* 5426 */ { MAD_F(0x05d1cb6e) /* 0.363719398 */, 18 },
+ /* 5427 */ { MAD_F(0x05d22927) /* 0.363808778 */, 18 },
+ /* 5428 */ { MAD_F(0x05d286e1) /* 0.363898163 */, 18 },
+ /* 5429 */ { MAD_F(0x05d2e49d) /* 0.363987554 */, 18 },
+ /* 5430 */ { MAD_F(0x05d3425a) /* 0.364076950 */, 18 },
+ /* 5431 */ { MAD_F(0x05d3a018) /* 0.364166352 */, 18 },
+ /* 5432 */ { MAD_F(0x05d3fdd8) /* 0.364255759 */, 18 },
+ /* 5433 */ { MAD_F(0x05d45b9a) /* 0.364345171 */, 18 },
+ /* 5434 */ { MAD_F(0x05d4b95d) /* 0.364434589 */, 18 },
+ /* 5435 */ { MAD_F(0x05d51721) /* 0.364524013 */, 18 },
+ /* 5436 */ { MAD_F(0x05d574e7) /* 0.364613442 */, 18 },
+ /* 5437 */ { MAD_F(0x05d5d2af) /* 0.364702877 */, 18 },
+ /* 5438 */ { MAD_F(0x05d63078) /* 0.364792317 */, 18 },
+ /* 5439 */ { MAD_F(0x05d68e42) /* 0.364881762 */, 18 },
+
+ /* 5440 */ { MAD_F(0x05d6ec0e) /* 0.364971213 */, 18 },
+ /* 5441 */ { MAD_F(0x05d749db) /* 0.365060669 */, 18 },
+ /* 5442 */ { MAD_F(0x05d7a7aa) /* 0.365150131 */, 18 },
+ /* 5443 */ { MAD_F(0x05d8057a) /* 0.365239599 */, 18 },
+ /* 5444 */ { MAD_F(0x05d8634c) /* 0.365329072 */, 18 },
+ /* 5445 */ { MAD_F(0x05d8c11f) /* 0.365418550 */, 18 },
+ /* 5446 */ { MAD_F(0x05d91ef4) /* 0.365508034 */, 18 },
+ /* 5447 */ { MAD_F(0x05d97cca) /* 0.365597523 */, 18 },
+ /* 5448 */ { MAD_F(0x05d9daa1) /* 0.365687018 */, 18 },
+ /* 5449 */ { MAD_F(0x05da387a) /* 0.365776518 */, 18 },
+ /* 5450 */ { MAD_F(0x05da9655) /* 0.365866024 */, 18 },
+ /* 5451 */ { MAD_F(0x05daf431) /* 0.365955536 */, 18 },
+ /* 5452 */ { MAD_F(0x05db520e) /* 0.366045052 */, 18 },
+ /* 5453 */ { MAD_F(0x05dbafed) /* 0.366134574 */, 18 },
+ /* 5454 */ { MAD_F(0x05dc0dce) /* 0.366224102 */, 18 },
+ /* 5455 */ { MAD_F(0x05dc6baf) /* 0.366313635 */, 18 },
+
+ /* 5456 */ { MAD_F(0x05dcc993) /* 0.366403174 */, 18 },
+ /* 5457 */ { MAD_F(0x05dd2778) /* 0.366492718 */, 18 },
+ /* 5458 */ { MAD_F(0x05dd855e) /* 0.366582267 */, 18 },
+ /* 5459 */ { MAD_F(0x05dde346) /* 0.366671822 */, 18 },
+ /* 5460 */ { MAD_F(0x05de412f) /* 0.366761383 */, 18 },
+ /* 5461 */ { MAD_F(0x05de9f1a) /* 0.366850949 */, 18 },
+ /* 5462 */ { MAD_F(0x05defd06) /* 0.366940520 */, 18 },
+ /* 5463 */ { MAD_F(0x05df5af3) /* 0.367030097 */, 18 },
+ /* 5464 */ { MAD_F(0x05dfb8e2) /* 0.367119680 */, 18 },
+ /* 5465 */ { MAD_F(0x05e016d3) /* 0.367209267 */, 18 },
+ /* 5466 */ { MAD_F(0x05e074c5) /* 0.367298861 */, 18 },
+ /* 5467 */ { MAD_F(0x05e0d2b8) /* 0.367388459 */, 18 },
+ /* 5468 */ { MAD_F(0x05e130ad) /* 0.367478064 */, 18 },
+ /* 5469 */ { MAD_F(0x05e18ea4) /* 0.367567673 */, 18 },
+ /* 5470 */ { MAD_F(0x05e1ec9c) /* 0.367657288 */, 18 },
+ /* 5471 */ { MAD_F(0x05e24a95) /* 0.367746909 */, 18 },
+
+ /* 5472 */ { MAD_F(0x05e2a890) /* 0.367836535 */, 18 },
+ /* 5473 */ { MAD_F(0x05e3068c) /* 0.367926167 */, 18 },
+ /* 5474 */ { MAD_F(0x05e3648a) /* 0.368015804 */, 18 },
+ /* 5475 */ { MAD_F(0x05e3c289) /* 0.368105446 */, 18 },
+ /* 5476 */ { MAD_F(0x05e4208a) /* 0.368195094 */, 18 },
+ /* 5477 */ { MAD_F(0x05e47e8c) /* 0.368284747 */, 18 },
+ /* 5478 */ { MAD_F(0x05e4dc8f) /* 0.368374406 */, 18 },
+ /* 5479 */ { MAD_F(0x05e53a94) /* 0.368464070 */, 18 },
+ /* 5480 */ { MAD_F(0x05e5989b) /* 0.368553740 */, 18 },
+ /* 5481 */ { MAD_F(0x05e5f6a3) /* 0.368643415 */, 18 },
+ /* 5482 */ { MAD_F(0x05e654ac) /* 0.368733096 */, 18 },
+ /* 5483 */ { MAD_F(0x05e6b2b7) /* 0.368822782 */, 18 },
+ /* 5484 */ { MAD_F(0x05e710c4) /* 0.368912473 */, 18 },
+ /* 5485 */ { MAD_F(0x05e76ed2) /* 0.369002170 */, 18 },
+ /* 5486 */ { MAD_F(0x05e7cce1) /* 0.369091873 */, 18 },
+ /* 5487 */ { MAD_F(0x05e82af2) /* 0.369181581 */, 18 },
+
+ /* 5488 */ { MAD_F(0x05e88904) /* 0.369271294 */, 18 },
+ /* 5489 */ { MAD_F(0x05e8e718) /* 0.369361013 */, 18 },
+ /* 5490 */ { MAD_F(0x05e9452d) /* 0.369450737 */, 18 },
+ /* 5491 */ { MAD_F(0x05e9a343) /* 0.369540467 */, 18 },
+ /* 5492 */ { MAD_F(0x05ea015c) /* 0.369630202 */, 18 },
+ /* 5493 */ { MAD_F(0x05ea5f75) /* 0.369719942 */, 18 },
+ /* 5494 */ { MAD_F(0x05eabd90) /* 0.369809688 */, 18 },
+ /* 5495 */ { MAD_F(0x05eb1bad) /* 0.369899440 */, 18 },
+ /* 5496 */ { MAD_F(0x05eb79cb) /* 0.369989197 */, 18 },
+ /* 5497 */ { MAD_F(0x05ebd7ea) /* 0.370078959 */, 18 },
+ /* 5498 */ { MAD_F(0x05ec360b) /* 0.370168727 */, 18 },
+ /* 5499 */ { MAD_F(0x05ec942d) /* 0.370258500 */, 18 },
+ /* 5500 */ { MAD_F(0x05ecf251) /* 0.370348279 */, 18 },
+ /* 5501 */ { MAD_F(0x05ed5076) /* 0.370438063 */, 18 },
+ /* 5502 */ { MAD_F(0x05edae9d) /* 0.370527853 */, 18 },
+ /* 5503 */ { MAD_F(0x05ee0cc5) /* 0.370617648 */, 18 },
+
+ /* 5504 */ { MAD_F(0x05ee6aef) /* 0.370707448 */, 18 },
+ /* 5505 */ { MAD_F(0x05eec91a) /* 0.370797254 */, 18 },
+ /* 5506 */ { MAD_F(0x05ef2746) /* 0.370887065 */, 18 },
+ /* 5507 */ { MAD_F(0x05ef8574) /* 0.370976882 */, 18 },
+ /* 5508 */ { MAD_F(0x05efe3a4) /* 0.371066704 */, 18 },
+ /* 5509 */ { MAD_F(0x05f041d5) /* 0.371156532 */, 18 },
+ /* 5510 */ { MAD_F(0x05f0a007) /* 0.371246365 */, 18 },
+ /* 5511 */ { MAD_F(0x05f0fe3b) /* 0.371336203 */, 18 },
+ /* 5512 */ { MAD_F(0x05f15c70) /* 0.371426047 */, 18 },
+ /* 5513 */ { MAD_F(0x05f1baa7) /* 0.371515897 */, 18 },
+ /* 5514 */ { MAD_F(0x05f218df) /* 0.371605751 */, 18 },
+ /* 5515 */ { MAD_F(0x05f27719) /* 0.371695612 */, 18 },
+ /* 5516 */ { MAD_F(0x05f2d554) /* 0.371785477 */, 18 },
+ /* 5517 */ { MAD_F(0x05f33390) /* 0.371875348 */, 18 },
+ /* 5518 */ { MAD_F(0x05f391cf) /* 0.371965225 */, 18 },
+ /* 5519 */ { MAD_F(0x05f3f00e) /* 0.372055107 */, 18 },
+
+ /* 5520 */ { MAD_F(0x05f44e4f) /* 0.372144994 */, 18 },
+ /* 5521 */ { MAD_F(0x05f4ac91) /* 0.372234887 */, 18 },
+ /* 5522 */ { MAD_F(0x05f50ad5) /* 0.372324785 */, 18 },
+ /* 5523 */ { MAD_F(0x05f5691b) /* 0.372414689 */, 18 },
+ /* 5524 */ { MAD_F(0x05f5c761) /* 0.372504598 */, 18 },
+ /* 5525 */ { MAD_F(0x05f625aa) /* 0.372594513 */, 18 },
+ /* 5526 */ { MAD_F(0x05f683f3) /* 0.372684433 */, 18 },
+ /* 5527 */ { MAD_F(0x05f6e23f) /* 0.372774358 */, 18 },
+ /* 5528 */ { MAD_F(0x05f7408b) /* 0.372864289 */, 18 },
+ /* 5529 */ { MAD_F(0x05f79ed9) /* 0.372954225 */, 18 },
+ /* 5530 */ { MAD_F(0x05f7fd29) /* 0.373044167 */, 18 },
+ /* 5531 */ { MAD_F(0x05f85b7a) /* 0.373134114 */, 18 },
+ /* 5532 */ { MAD_F(0x05f8b9cc) /* 0.373224066 */, 18 },
+ /* 5533 */ { MAD_F(0x05f91820) /* 0.373314024 */, 18 },
+ /* 5534 */ { MAD_F(0x05f97675) /* 0.373403987 */, 18 },
+ /* 5535 */ { MAD_F(0x05f9d4cc) /* 0.373493956 */, 18 },
+
+ /* 5536 */ { MAD_F(0x05fa3324) /* 0.373583930 */, 18 },
+ /* 5537 */ { MAD_F(0x05fa917e) /* 0.373673910 */, 18 },
+ /* 5538 */ { MAD_F(0x05faefd9) /* 0.373763895 */, 18 },
+ /* 5539 */ { MAD_F(0x05fb4e36) /* 0.373853885 */, 18 },
+ /* 5540 */ { MAD_F(0x05fbac94) /* 0.373943881 */, 18 },
+ /* 5541 */ { MAD_F(0x05fc0af3) /* 0.374033882 */, 18 },
+ /* 5542 */ { MAD_F(0x05fc6954) /* 0.374123889 */, 18 },
+ /* 5543 */ { MAD_F(0x05fcc7b7) /* 0.374213901 */, 18 },
+ /* 5544 */ { MAD_F(0x05fd261b) /* 0.374303918 */, 18 },
+ /* 5545 */ { MAD_F(0x05fd8480) /* 0.374393941 */, 18 },
+ /* 5546 */ { MAD_F(0x05fde2e7) /* 0.374483970 */, 18 },
+ /* 5547 */ { MAD_F(0x05fe414f) /* 0.374574003 */, 18 },
+ /* 5548 */ { MAD_F(0x05fe9fb9) /* 0.374664042 */, 18 },
+ /* 5549 */ { MAD_F(0x05fefe24) /* 0.374754087 */, 18 },
+ /* 5550 */ { MAD_F(0x05ff5c91) /* 0.374844137 */, 18 },
+ /* 5551 */ { MAD_F(0x05ffbaff) /* 0.374934192 */, 18 },
+
+ /* 5552 */ { MAD_F(0x0600196e) /* 0.375024253 */, 18 },
+ /* 5553 */ { MAD_F(0x060077df) /* 0.375114319 */, 18 },
+ /* 5554 */ { MAD_F(0x0600d651) /* 0.375204391 */, 18 },
+ /* 5555 */ { MAD_F(0x060134c5) /* 0.375294468 */, 18 },
+ /* 5556 */ { MAD_F(0x0601933b) /* 0.375384550 */, 18 },
+ /* 5557 */ { MAD_F(0x0601f1b1) /* 0.375474638 */, 18 },
+ /* 5558 */ { MAD_F(0x0602502a) /* 0.375564731 */, 18 },
+ /* 5559 */ { MAD_F(0x0602aea3) /* 0.375654830 */, 18 },
+ /* 5560 */ { MAD_F(0x06030d1e) /* 0.375744934 */, 18 },
+ /* 5561 */ { MAD_F(0x06036b9b) /* 0.375835043 */, 18 },
+ /* 5562 */ { MAD_F(0x0603ca19) /* 0.375925158 */, 18 },
+ /* 5563 */ { MAD_F(0x06042898) /* 0.376015278 */, 18 },
+ /* 5564 */ { MAD_F(0x06048719) /* 0.376105404 */, 18 },
+ /* 5565 */ { MAD_F(0x0604e59c) /* 0.376195535 */, 18 },
+ /* 5566 */ { MAD_F(0x0605441f) /* 0.376285671 */, 18 },
+ /* 5567 */ { MAD_F(0x0605a2a5) /* 0.376375813 */, 18 },
+
+ /* 5568 */ { MAD_F(0x0606012b) /* 0.376465960 */, 18 },
+ /* 5569 */ { MAD_F(0x06065fb4) /* 0.376556113 */, 18 },
+ /* 5570 */ { MAD_F(0x0606be3d) /* 0.376646271 */, 18 },
+ /* 5571 */ { MAD_F(0x06071cc8) /* 0.376736434 */, 18 },
+ /* 5572 */ { MAD_F(0x06077b55) /* 0.376826603 */, 18 },
+ /* 5573 */ { MAD_F(0x0607d9e3) /* 0.376916777 */, 18 },
+ /* 5574 */ { MAD_F(0x06083872) /* 0.377006957 */, 18 },
+ /* 5575 */ { MAD_F(0x06089703) /* 0.377097141 */, 18 },
+ /* 5576 */ { MAD_F(0x0608f595) /* 0.377187332 */, 18 },
+ /* 5577 */ { MAD_F(0x06095429) /* 0.377277528 */, 18 },
+ /* 5578 */ { MAD_F(0x0609b2be) /* 0.377367729 */, 18 },
+ /* 5579 */ { MAD_F(0x060a1155) /* 0.377457935 */, 18 },
+ /* 5580 */ { MAD_F(0x060a6fed) /* 0.377548147 */, 18 },
+ /* 5581 */ { MAD_F(0x060ace86) /* 0.377638364 */, 18 },
+ /* 5582 */ { MAD_F(0x060b2d21) /* 0.377728587 */, 18 },
+ /* 5583 */ { MAD_F(0x060b8bbe) /* 0.377818815 */, 18 },
+
+ /* 5584 */ { MAD_F(0x060bea5c) /* 0.377909049 */, 18 },
+ /* 5585 */ { MAD_F(0x060c48fb) /* 0.377999288 */, 18 },
+ /* 5586 */ { MAD_F(0x060ca79c) /* 0.378089532 */, 18 },
+ /* 5587 */ { MAD_F(0x060d063e) /* 0.378179781 */, 18 },
+ /* 5588 */ { MAD_F(0x060d64e1) /* 0.378270036 */, 18 },
+ /* 5589 */ { MAD_F(0x060dc387) /* 0.378360297 */, 18 },
+ /* 5590 */ { MAD_F(0x060e222d) /* 0.378450563 */, 18 },
+ /* 5591 */ { MAD_F(0x060e80d5) /* 0.378540834 */, 18 },
+ /* 5592 */ { MAD_F(0x060edf7f) /* 0.378631110 */, 18 },
+ /* 5593 */ { MAD_F(0x060f3e29) /* 0.378721392 */, 18 },
+ /* 5594 */ { MAD_F(0x060f9cd6) /* 0.378811680 */, 18 },
+ /* 5595 */ { MAD_F(0x060ffb83) /* 0.378901972 */, 18 },
+ /* 5596 */ { MAD_F(0x06105a33) /* 0.378992270 */, 18 },
+ /* 5597 */ { MAD_F(0x0610b8e3) /* 0.379082574 */, 18 },
+ /* 5598 */ { MAD_F(0x06111795) /* 0.379172883 */, 18 },
+ /* 5599 */ { MAD_F(0x06117649) /* 0.379263197 */, 18 },
+
+ /* 5600 */ { MAD_F(0x0611d4fe) /* 0.379353516 */, 18 },
+ /* 5601 */ { MAD_F(0x061233b4) /* 0.379443841 */, 18 },
+ /* 5602 */ { MAD_F(0x0612926c) /* 0.379534172 */, 18 },
+ /* 5603 */ { MAD_F(0x0612f125) /* 0.379624507 */, 18 },
+ /* 5604 */ { MAD_F(0x06134fe0) /* 0.379714848 */, 18 },
+ /* 5605 */ { MAD_F(0x0613ae9c) /* 0.379805195 */, 18 },
+ /* 5606 */ { MAD_F(0x06140d5a) /* 0.379895547 */, 18 },
+ /* 5607 */ { MAD_F(0x06146c19) /* 0.379985904 */, 18 },
+ /* 5608 */ { MAD_F(0x0614cada) /* 0.380076266 */, 18 },
+ /* 5609 */ { MAD_F(0x0615299c) /* 0.380166634 */, 18 },
+ /* 5610 */ { MAD_F(0x0615885f) /* 0.380257008 */, 18 },
+ /* 5611 */ { MAD_F(0x0615e724) /* 0.380347386 */, 18 },
+ /* 5612 */ { MAD_F(0x061645ea) /* 0.380437770 */, 18 },
+ /* 5613 */ { MAD_F(0x0616a4b2) /* 0.380528160 */, 18 },
+ /* 5614 */ { MAD_F(0x0617037b) /* 0.380618555 */, 18 },
+ /* 5615 */ { MAD_F(0x06176246) /* 0.380708955 */, 18 },
+
+ /* 5616 */ { MAD_F(0x0617c112) /* 0.380799360 */, 18 },
+ /* 5617 */ { MAD_F(0x06181fdf) /* 0.380889771 */, 18 },
+ /* 5618 */ { MAD_F(0x06187eae) /* 0.380980187 */, 18 },
+ /* 5619 */ { MAD_F(0x0618dd7e) /* 0.381070609 */, 18 },
+ /* 5620 */ { MAD_F(0x06193c50) /* 0.381161036 */, 18 },
+ /* 5621 */ { MAD_F(0x06199b24) /* 0.381251468 */, 18 },
+ /* 5622 */ { MAD_F(0x0619f9f8) /* 0.381341906 */, 18 },
+ /* 5623 */ { MAD_F(0x061a58ce) /* 0.381432349 */, 18 },
+ /* 5624 */ { MAD_F(0x061ab7a6) /* 0.381522798 */, 18 },
+ /* 5625 */ { MAD_F(0x061b167f) /* 0.381613251 */, 18 },
+ /* 5626 */ { MAD_F(0x061b7559) /* 0.381703711 */, 18 },
+ /* 5627 */ { MAD_F(0x061bd435) /* 0.381794175 */, 18 },
+ /* 5628 */ { MAD_F(0x061c3313) /* 0.381884645 */, 18 },
+ /* 5629 */ { MAD_F(0x061c91f1) /* 0.381975120 */, 18 },
+ /* 5630 */ { MAD_F(0x061cf0d2) /* 0.382065601 */, 18 },
+ /* 5631 */ { MAD_F(0x061d4fb3) /* 0.382156087 */, 18 },
+
+ /* 5632 */ { MAD_F(0x061dae96) /* 0.382246578 */, 18 },
+ /* 5633 */ { MAD_F(0x061e0d7b) /* 0.382337075 */, 18 },
+ /* 5634 */ { MAD_F(0x061e6c61) /* 0.382427577 */, 18 },
+ /* 5635 */ { MAD_F(0x061ecb48) /* 0.382518084 */, 18 },
+ /* 5636 */ { MAD_F(0x061f2a31) /* 0.382608597 */, 18 },
+ /* 5637 */ { MAD_F(0x061f891b) /* 0.382699115 */, 18 },
+ /* 5638 */ { MAD_F(0x061fe807) /* 0.382789638 */, 18 },
+ /* 5639 */ { MAD_F(0x062046f4) /* 0.382880167 */, 18 },
+ /* 5640 */ { MAD_F(0x0620a5e3) /* 0.382970701 */, 18 },
+ /* 5641 */ { MAD_F(0x062104d3) /* 0.383061241 */, 18 },
+ /* 5642 */ { MAD_F(0x062163c4) /* 0.383151786 */, 18 },
+ /* 5643 */ { MAD_F(0x0621c2b7) /* 0.383242336 */, 18 },
+ /* 5644 */ { MAD_F(0x062221ab) /* 0.383332891 */, 18 },
+ /* 5645 */ { MAD_F(0x062280a1) /* 0.383423452 */, 18 },
+ /* 5646 */ { MAD_F(0x0622df98) /* 0.383514018 */, 18 },
+ /* 5647 */ { MAD_F(0x06233e91) /* 0.383604590 */, 18 },
+
+ /* 5648 */ { MAD_F(0x06239d8b) /* 0.383695167 */, 18 },
+ /* 5649 */ { MAD_F(0x0623fc86) /* 0.383785749 */, 18 },
+ /* 5650 */ { MAD_F(0x06245b83) /* 0.383876337 */, 18 },
+ /* 5651 */ { MAD_F(0x0624ba82) /* 0.383966930 */, 18 },
+ /* 5652 */ { MAD_F(0x06251981) /* 0.384057528 */, 18 },
+ /* 5653 */ { MAD_F(0x06257883) /* 0.384148132 */, 18 },
+ /* 5654 */ { MAD_F(0x0625d785) /* 0.384238741 */, 18 },
+ /* 5655 */ { MAD_F(0x06263689) /* 0.384329355 */, 18 },
+ /* 5656 */ { MAD_F(0x0626958f) /* 0.384419975 */, 18 },
+ /* 5657 */ { MAD_F(0x0626f496) /* 0.384510600 */, 18 },
+ /* 5658 */ { MAD_F(0x0627539e) /* 0.384601230 */, 18 },
+ /* 5659 */ { MAD_F(0x0627b2a8) /* 0.384691866 */, 18 },
+ /* 5660 */ { MAD_F(0x062811b3) /* 0.384782507 */, 18 },
+ /* 5661 */ { MAD_F(0x062870c0) /* 0.384873153 */, 18 },
+ /* 5662 */ { MAD_F(0x0628cfce) /* 0.384963805 */, 18 },
+ /* 5663 */ { MAD_F(0x06292ede) /* 0.385054462 */, 18 },
+
+ /* 5664 */ { MAD_F(0x06298def) /* 0.385145124 */, 18 },
+ /* 5665 */ { MAD_F(0x0629ed01) /* 0.385235792 */, 18 },
+ /* 5666 */ { MAD_F(0x062a4c15) /* 0.385326465 */, 18 },
+ /* 5667 */ { MAD_F(0x062aab2a) /* 0.385417143 */, 18 },
+ /* 5668 */ { MAD_F(0x062b0a41) /* 0.385507827 */, 18 },
+ /* 5669 */ { MAD_F(0x062b6959) /* 0.385598516 */, 18 },
+ /* 5670 */ { MAD_F(0x062bc873) /* 0.385689211 */, 18 },
+ /* 5671 */ { MAD_F(0x062c278e) /* 0.385779910 */, 18 },
+ /* 5672 */ { MAD_F(0x062c86aa) /* 0.385870615 */, 18 },
+ /* 5673 */ { MAD_F(0x062ce5c8) /* 0.385961326 */, 18 },
+ /* 5674 */ { MAD_F(0x062d44e8) /* 0.386052041 */, 18 },
+ /* 5675 */ { MAD_F(0x062da408) /* 0.386142762 */, 18 },
+ /* 5676 */ { MAD_F(0x062e032a) /* 0.386233489 */, 18 },
+ /* 5677 */ { MAD_F(0x062e624e) /* 0.386324221 */, 18 },
+ /* 5678 */ { MAD_F(0x062ec173) /* 0.386414958 */, 18 },
+ /* 5679 */ { MAD_F(0x062f209a) /* 0.386505700 */, 18 },
+
+ /* 5680 */ { MAD_F(0x062f7fc1) /* 0.386596448 */, 18 },
+ /* 5681 */ { MAD_F(0x062fdeeb) /* 0.386687201 */, 18 },
+ /* 5682 */ { MAD_F(0x06303e16) /* 0.386777959 */, 18 },
+ /* 5683 */ { MAD_F(0x06309d42) /* 0.386868723 */, 18 },
+ /* 5684 */ { MAD_F(0x0630fc6f) /* 0.386959492 */, 18 },
+ /* 5685 */ { MAD_F(0x06315b9e) /* 0.387050266 */, 18 },
+ /* 5686 */ { MAD_F(0x0631bacf) /* 0.387141045 */, 18 },
+ /* 5687 */ { MAD_F(0x06321a01) /* 0.387231830 */, 18 },
+ /* 5688 */ { MAD_F(0x06327934) /* 0.387322621 */, 18 },
+ /* 5689 */ { MAD_F(0x0632d869) /* 0.387413416 */, 18 },
+ /* 5690 */ { MAD_F(0x0633379f) /* 0.387504217 */, 18 },
+ /* 5691 */ { MAD_F(0x063396d7) /* 0.387595023 */, 18 },
+ /* 5692 */ { MAD_F(0x0633f610) /* 0.387685835 */, 18 },
+ /* 5693 */ { MAD_F(0x0634554a) /* 0.387776652 */, 18 },
+ /* 5694 */ { MAD_F(0x0634b486) /* 0.387867474 */, 18 },
+ /* 5695 */ { MAD_F(0x063513c3) /* 0.387958301 */, 18 },
+
+ /* 5696 */ { MAD_F(0x06357302) /* 0.388049134 */, 18 },
+ /* 5697 */ { MAD_F(0x0635d242) /* 0.388139972 */, 18 },
+ /* 5698 */ { MAD_F(0x06363184) /* 0.388230816 */, 18 },
+ /* 5699 */ { MAD_F(0x063690c7) /* 0.388321665 */, 18 },
+ /* 5700 */ { MAD_F(0x0636f00b) /* 0.388412519 */, 18 },
+ /* 5701 */ { MAD_F(0x06374f51) /* 0.388503378 */, 18 },
+ /* 5702 */ { MAD_F(0x0637ae99) /* 0.388594243 */, 18 },
+ /* 5703 */ { MAD_F(0x06380de1) /* 0.388685113 */, 18 },
+ /* 5704 */ { MAD_F(0x06386d2b) /* 0.388775988 */, 18 },
+ /* 5705 */ { MAD_F(0x0638cc77) /* 0.388866869 */, 18 },
+ /* 5706 */ { MAD_F(0x06392bc4) /* 0.388957755 */, 18 },
+ /* 5707 */ { MAD_F(0x06398b12) /* 0.389048646 */, 18 },
+ /* 5708 */ { MAD_F(0x0639ea62) /* 0.389139542 */, 18 },
+ /* 5709 */ { MAD_F(0x063a49b4) /* 0.389230444 */, 18 },
+ /* 5710 */ { MAD_F(0x063aa906) /* 0.389321352 */, 18 },
+ /* 5711 */ { MAD_F(0x063b085a) /* 0.389412264 */, 18 },
+
+ /* 5712 */ { MAD_F(0x063b67b0) /* 0.389503182 */, 18 },
+ /* 5713 */ { MAD_F(0x063bc707) /* 0.389594105 */, 18 },
+ /* 5714 */ { MAD_F(0x063c265f) /* 0.389685033 */, 18 },
+ /* 5715 */ { MAD_F(0x063c85b9) /* 0.389775967 */, 18 },
+ /* 5716 */ { MAD_F(0x063ce514) /* 0.389866906 */, 18 },
+ /* 5717 */ { MAD_F(0x063d4471) /* 0.389957850 */, 18 },
+ /* 5718 */ { MAD_F(0x063da3cf) /* 0.390048800 */, 18 },
+ /* 5719 */ { MAD_F(0x063e032f) /* 0.390139755 */, 18 },
+ /* 5720 */ { MAD_F(0x063e6290) /* 0.390230715 */, 18 },
+ /* 5721 */ { MAD_F(0x063ec1f2) /* 0.390321681 */, 18 },
+ /* 5722 */ { MAD_F(0x063f2156) /* 0.390412651 */, 18 },
+ /* 5723 */ { MAD_F(0x063f80bb) /* 0.390503628 */, 18 },
+ /* 5724 */ { MAD_F(0x063fe022) /* 0.390594609 */, 18 },
+ /* 5725 */ { MAD_F(0x06403f8a) /* 0.390685596 */, 18 },
+ /* 5726 */ { MAD_F(0x06409ef3) /* 0.390776588 */, 18 },
+ /* 5727 */ { MAD_F(0x0640fe5e) /* 0.390867585 */, 18 },
+
+ /* 5728 */ { MAD_F(0x06415dcb) /* 0.390958588 */, 18 },
+ /* 5729 */ { MAD_F(0x0641bd38) /* 0.391049596 */, 18 },
+ /* 5730 */ { MAD_F(0x06421ca7) /* 0.391140609 */, 18 },
+ /* 5731 */ { MAD_F(0x06427c18) /* 0.391231627 */, 18 },
+ /* 5732 */ { MAD_F(0x0642db8a) /* 0.391322651 */, 18 },
+ /* 5733 */ { MAD_F(0x06433afd) /* 0.391413680 */, 18 },
+ /* 5734 */ { MAD_F(0x06439a72) /* 0.391504714 */, 18 },
+ /* 5735 */ { MAD_F(0x0643f9e9) /* 0.391595754 */, 18 },
+ /* 5736 */ { MAD_F(0x06445960) /* 0.391686799 */, 18 },
+ /* 5737 */ { MAD_F(0x0644b8d9) /* 0.391777849 */, 18 },
+ /* 5738 */ { MAD_F(0x06451854) /* 0.391868905 */, 18 },
+ /* 5739 */ { MAD_F(0x064577d0) /* 0.391959966 */, 18 },
+ /* 5740 */ { MAD_F(0x0645d74d) /* 0.392051032 */, 18 },
+ /* 5741 */ { MAD_F(0x064636cc) /* 0.392142103 */, 18 },
+ /* 5742 */ { MAD_F(0x0646964c) /* 0.392233180 */, 18 },
+ /* 5743 */ { MAD_F(0x0646f5ce) /* 0.392324262 */, 18 },
+
+ /* 5744 */ { MAD_F(0x06475551) /* 0.392415349 */, 18 },
+ /* 5745 */ { MAD_F(0x0647b4d5) /* 0.392506442 */, 18 },
+ /* 5746 */ { MAD_F(0x0648145b) /* 0.392597540 */, 18 },
+ /* 5747 */ { MAD_F(0x064873e3) /* 0.392688643 */, 18 },
+ /* 5748 */ { MAD_F(0x0648d36b) /* 0.392779751 */, 18 },
+ /* 5749 */ { MAD_F(0x064932f6) /* 0.392870865 */, 18 },
+ /* 5750 */ { MAD_F(0x06499281) /* 0.392961984 */, 18 },
+ /* 5751 */ { MAD_F(0x0649f20e) /* 0.393053108 */, 18 },
+ /* 5752 */ { MAD_F(0x064a519c) /* 0.393144238 */, 18 },
+ /* 5753 */ { MAD_F(0x064ab12c) /* 0.393235372 */, 18 },
+ /* 5754 */ { MAD_F(0x064b10be) /* 0.393326513 */, 18 },
+ /* 5755 */ { MAD_F(0x064b7050) /* 0.393417658 */, 18 },
+ /* 5756 */ { MAD_F(0x064bcfe4) /* 0.393508809 */, 18 },
+ /* 5757 */ { MAD_F(0x064c2f7a) /* 0.393599965 */, 18 },
+ /* 5758 */ { MAD_F(0x064c8f11) /* 0.393691126 */, 18 },
+ /* 5759 */ { MAD_F(0x064ceea9) /* 0.393782292 */, 18 },
+
+ /* 5760 */ { MAD_F(0x064d4e43) /* 0.393873464 */, 18 },
+ /* 5761 */ { MAD_F(0x064dadde) /* 0.393964641 */, 18 },
+ /* 5762 */ { MAD_F(0x064e0d7a) /* 0.394055823 */, 18 },
+ /* 5763 */ { MAD_F(0x064e6d18) /* 0.394147011 */, 18 },
+ /* 5764 */ { MAD_F(0x064eccb8) /* 0.394238204 */, 18 },
+ /* 5765 */ { MAD_F(0x064f2c59) /* 0.394329402 */, 18 },
+ /* 5766 */ { MAD_F(0x064f8bfb) /* 0.394420605 */, 18 },
+ /* 5767 */ { MAD_F(0x064feb9e) /* 0.394511814 */, 18 },
+ /* 5768 */ { MAD_F(0x06504b44) /* 0.394603028 */, 18 },
+ /* 5769 */ { MAD_F(0x0650aaea) /* 0.394694247 */, 18 },
+ /* 5770 */ { MAD_F(0x06510a92) /* 0.394785472 */, 18 },
+ /* 5771 */ { MAD_F(0x06516a3b) /* 0.394876702 */, 18 },
+ /* 5772 */ { MAD_F(0x0651c9e6) /* 0.394967937 */, 18 },
+ /* 5773 */ { MAD_F(0x06522992) /* 0.395059177 */, 18 },
+ /* 5774 */ { MAD_F(0x06528940) /* 0.395150423 */, 18 },
+ /* 5775 */ { MAD_F(0x0652e8ef) /* 0.395241673 */, 18 },
+
+ /* 5776 */ { MAD_F(0x0653489f) /* 0.395332930 */, 18 },
+ /* 5777 */ { MAD_F(0x0653a851) /* 0.395424191 */, 18 },
+ /* 5778 */ { MAD_F(0x06540804) /* 0.395515458 */, 18 },
+ /* 5779 */ { MAD_F(0x065467b9) /* 0.395606730 */, 18 },
+ /* 5780 */ { MAD_F(0x0654c76f) /* 0.395698007 */, 18 },
+ /* 5781 */ { MAD_F(0x06552726) /* 0.395789289 */, 18 },
+ /* 5782 */ { MAD_F(0x065586df) /* 0.395880577 */, 18 },
+ /* 5783 */ { MAD_F(0x0655e699) /* 0.395971870 */, 18 },
+ /* 5784 */ { MAD_F(0x06564655) /* 0.396063168 */, 18 },
+ /* 5785 */ { MAD_F(0x0656a612) /* 0.396154472 */, 18 },
+ /* 5786 */ { MAD_F(0x065705d0) /* 0.396245780 */, 18 },
+ /* 5787 */ { MAD_F(0x06576590) /* 0.396337094 */, 18 },
+ /* 5788 */ { MAD_F(0x0657c552) /* 0.396428414 */, 18 },
+ /* 5789 */ { MAD_F(0x06582514) /* 0.396519738 */, 18 },
+ /* 5790 */ { MAD_F(0x065884d9) /* 0.396611068 */, 18 },
+ /* 5791 */ { MAD_F(0x0658e49e) /* 0.396702403 */, 18 },
+
+ /* 5792 */ { MAD_F(0x06594465) /* 0.396793743 */, 18 },
+ /* 5793 */ { MAD_F(0x0659a42e) /* 0.396885089 */, 18 },
+ /* 5794 */ { MAD_F(0x065a03f7) /* 0.396976440 */, 18 },
+ /* 5795 */ { MAD_F(0x065a63c3) /* 0.397067796 */, 18 },
+ /* 5796 */ { MAD_F(0x065ac38f) /* 0.397159157 */, 18 },
+ /* 5797 */ { MAD_F(0x065b235d) /* 0.397250524 */, 18 },
+ /* 5798 */ { MAD_F(0x065b832d) /* 0.397341896 */, 18 },
+ /* 5799 */ { MAD_F(0x065be2fe) /* 0.397433273 */, 18 },
+ /* 5800 */ { MAD_F(0x065c42d0) /* 0.397524655 */, 18 },
+ /* 5801 */ { MAD_F(0x065ca2a3) /* 0.397616043 */, 18 },
+ /* 5802 */ { MAD_F(0x065d0279) /* 0.397707436 */, 18 },
+ /* 5803 */ { MAD_F(0x065d624f) /* 0.397798834 */, 18 },
+ /* 5804 */ { MAD_F(0x065dc227) /* 0.397890237 */, 18 },
+ /* 5805 */ { MAD_F(0x065e2200) /* 0.397981646 */, 18 },
+ /* 5806 */ { MAD_F(0x065e81db) /* 0.398073059 */, 18 },
+ /* 5807 */ { MAD_F(0x065ee1b7) /* 0.398164479 */, 18 },
+
+ /* 5808 */ { MAD_F(0x065f4195) /* 0.398255903 */, 18 },
+ /* 5809 */ { MAD_F(0x065fa174) /* 0.398347333 */, 18 },
+ /* 5810 */ { MAD_F(0x06600154) /* 0.398438767 */, 18 },
+ /* 5811 */ { MAD_F(0x06606136) /* 0.398530207 */, 18 },
+ /* 5812 */ { MAD_F(0x0660c119) /* 0.398621653 */, 18 },
+ /* 5813 */ { MAD_F(0x066120fd) /* 0.398713103 */, 18 },
+ /* 5814 */ { MAD_F(0x066180e3) /* 0.398804559 */, 18 },
+ /* 5815 */ { MAD_F(0x0661e0cb) /* 0.398896020 */, 18 },
+ /* 5816 */ { MAD_F(0x066240b4) /* 0.398987487 */, 18 },
+ /* 5817 */ { MAD_F(0x0662a09e) /* 0.399078958 */, 18 },
+ /* 5818 */ { MAD_F(0x06630089) /* 0.399170435 */, 18 },
+ /* 5819 */ { MAD_F(0x06636077) /* 0.399261917 */, 18 },
+ /* 5820 */ { MAD_F(0x0663c065) /* 0.399353404 */, 18 },
+ /* 5821 */ { MAD_F(0x06642055) /* 0.399444897 */, 18 },
+ /* 5822 */ { MAD_F(0x06648046) /* 0.399536395 */, 18 },
+ /* 5823 */ { MAD_F(0x0664e039) /* 0.399627898 */, 18 },
+
+ /* 5824 */ { MAD_F(0x0665402d) /* 0.399719406 */, 18 },
+ /* 5825 */ { MAD_F(0x0665a022) /* 0.399810919 */, 18 },
+ /* 5826 */ { MAD_F(0x06660019) /* 0.399902438 */, 18 },
+ /* 5827 */ { MAD_F(0x06666011) /* 0.399993962 */, 18 },
+ /* 5828 */ { MAD_F(0x0666c00b) /* 0.400085491 */, 18 },
+ /* 5829 */ { MAD_F(0x06672006) /* 0.400177026 */, 18 },
+ /* 5830 */ { MAD_F(0x06678003) /* 0.400268565 */, 18 },
+ /* 5831 */ { MAD_F(0x0667e000) /* 0.400360110 */, 18 },
+ /* 5832 */ { MAD_F(0x06684000) /* 0.400451660 */, 18 },
+ /* 5833 */ { MAD_F(0x0668a000) /* 0.400543216 */, 18 },
+ /* 5834 */ { MAD_F(0x06690003) /* 0.400634776 */, 18 },
+ /* 5835 */ { MAD_F(0x06696006) /* 0.400726342 */, 18 },
+ /* 5836 */ { MAD_F(0x0669c00b) /* 0.400817913 */, 18 },
+ /* 5837 */ { MAD_F(0x066a2011) /* 0.400909489 */, 18 },
+ /* 5838 */ { MAD_F(0x066a8019) /* 0.401001071 */, 18 },
+ /* 5839 */ { MAD_F(0x066ae022) /* 0.401092657 */, 18 },
+
+ /* 5840 */ { MAD_F(0x066b402d) /* 0.401184249 */, 18 },
+ /* 5841 */ { MAD_F(0x066ba039) /* 0.401275847 */, 18 },
+ /* 5842 */ { MAD_F(0x066c0046) /* 0.401367449 */, 18 },
+ /* 5843 */ { MAD_F(0x066c6055) /* 0.401459057 */, 18 },
+ /* 5844 */ { MAD_F(0x066cc065) /* 0.401550670 */, 18 },
+ /* 5845 */ { MAD_F(0x066d2076) /* 0.401642288 */, 18 },
+ /* 5846 */ { MAD_F(0x066d8089) /* 0.401733911 */, 18 },
+ /* 5847 */ { MAD_F(0x066de09e) /* 0.401825540 */, 18 },
+ /* 5848 */ { MAD_F(0x066e40b3) /* 0.401917173 */, 18 },
+ /* 5849 */ { MAD_F(0x066ea0cb) /* 0.402008812 */, 18 },
+ /* 5850 */ { MAD_F(0x066f00e3) /* 0.402100457 */, 18 },
+ /* 5851 */ { MAD_F(0x066f60fd) /* 0.402192106 */, 18 },
+ /* 5852 */ { MAD_F(0x066fc118) /* 0.402283761 */, 18 },
+ /* 5853 */ { MAD_F(0x06702135) /* 0.402375420 */, 18 },
+ /* 5854 */ { MAD_F(0x06708153) /* 0.402467086 */, 18 },
+ /* 5855 */ { MAD_F(0x0670e173) /* 0.402558756 */, 18 },
+
+ /* 5856 */ { MAD_F(0x06714194) /* 0.402650431 */, 18 },
+ /* 5857 */ { MAD_F(0x0671a1b6) /* 0.402742112 */, 18 },
+ /* 5858 */ { MAD_F(0x067201da) /* 0.402833798 */, 18 },
+ /* 5859 */ { MAD_F(0x067261ff) /* 0.402925489 */, 18 },
+ /* 5860 */ { MAD_F(0x0672c226) /* 0.403017186 */, 18 },
+ /* 5861 */ { MAD_F(0x0673224e) /* 0.403108887 */, 18 },
+ /* 5862 */ { MAD_F(0x06738277) /* 0.403200594 */, 18 },
+ /* 5863 */ { MAD_F(0x0673e2a2) /* 0.403292306 */, 18 },
+ /* 5864 */ { MAD_F(0x067442ce) /* 0.403384024 */, 18 },
+ /* 5865 */ { MAD_F(0x0674a2fc) /* 0.403475746 */, 18 },
+ /* 5866 */ { MAD_F(0x0675032b) /* 0.403567474 */, 18 },
+ /* 5867 */ { MAD_F(0x0675635b) /* 0.403659207 */, 18 },
+ /* 5868 */ { MAD_F(0x0675c38d) /* 0.403750945 */, 18 },
+ /* 5869 */ { MAD_F(0x067623c0) /* 0.403842688 */, 18 },
+ /* 5870 */ { MAD_F(0x067683f4) /* 0.403934437 */, 18 },
+ /* 5871 */ { MAD_F(0x0676e42a) /* 0.404026190 */, 18 },
+
+ /* 5872 */ { MAD_F(0x06774462) /* 0.404117949 */, 18 },
+ /* 5873 */ { MAD_F(0x0677a49b) /* 0.404209714 */, 18 },
+ /* 5874 */ { MAD_F(0x067804d5) /* 0.404301483 */, 18 },
+ /* 5875 */ { MAD_F(0x06786510) /* 0.404393258 */, 18 },
+ /* 5876 */ { MAD_F(0x0678c54d) /* 0.404485037 */, 18 },
+ /* 5877 */ { MAD_F(0x0679258c) /* 0.404576822 */, 18 },
+ /* 5878 */ { MAD_F(0x067985cb) /* 0.404668613 */, 18 },
+ /* 5879 */ { MAD_F(0x0679e60c) /* 0.404760408 */, 18 },
+ /* 5880 */ { MAD_F(0x067a464f) /* 0.404852209 */, 18 },
+ /* 5881 */ { MAD_F(0x067aa693) /* 0.404944014 */, 18 },
+ /* 5882 */ { MAD_F(0x067b06d8) /* 0.405035825 */, 18 },
+ /* 5883 */ { MAD_F(0x067b671f) /* 0.405127642 */, 18 },
+ /* 5884 */ { MAD_F(0x067bc767) /* 0.405219463 */, 18 },
+ /* 5885 */ { MAD_F(0x067c27b1) /* 0.405311290 */, 18 },
+ /* 5886 */ { MAD_F(0x067c87fc) /* 0.405403122 */, 18 },
+ /* 5887 */ { MAD_F(0x067ce848) /* 0.405494959 */, 18 },
+
+ /* 5888 */ { MAD_F(0x067d4896) /* 0.405586801 */, 18 },
+ /* 5889 */ { MAD_F(0x067da8e5) /* 0.405678648 */, 18 },
+ /* 5890 */ { MAD_F(0x067e0935) /* 0.405770501 */, 18 },
+ /* 5891 */ { MAD_F(0x067e6987) /* 0.405862359 */, 18 },
+ /* 5892 */ { MAD_F(0x067ec9da) /* 0.405954222 */, 18 },
+ /* 5893 */ { MAD_F(0x067f2a2f) /* 0.406046090 */, 18 },
+ /* 5894 */ { MAD_F(0x067f8a85) /* 0.406137963 */, 18 },
+ /* 5895 */ { MAD_F(0x067feadd) /* 0.406229842 */, 18 },
+ /* 5896 */ { MAD_F(0x06804b36) /* 0.406321726 */, 18 },
+ /* 5897 */ { MAD_F(0x0680ab90) /* 0.406413615 */, 18 },
+ /* 5898 */ { MAD_F(0x06810beb) /* 0.406505509 */, 18 },
+ /* 5899 */ { MAD_F(0x06816c49) /* 0.406597408 */, 18 },
+ /* 5900 */ { MAD_F(0x0681cca7) /* 0.406689313 */, 18 },
+ /* 5901 */ { MAD_F(0x06822d07) /* 0.406781223 */, 18 },
+ /* 5902 */ { MAD_F(0x06828d68) /* 0.406873138 */, 18 },
+ /* 5903 */ { MAD_F(0x0682edcb) /* 0.406965058 */, 18 },
+
+ /* 5904 */ { MAD_F(0x06834e2f) /* 0.407056983 */, 18 },
+ /* 5905 */ { MAD_F(0x0683ae94) /* 0.407148914 */, 18 },
+ /* 5906 */ { MAD_F(0x06840efb) /* 0.407240850 */, 18 },
+ /* 5907 */ { MAD_F(0x06846f63) /* 0.407332791 */, 18 },
+ /* 5908 */ { MAD_F(0x0684cfcd) /* 0.407424737 */, 18 },
+ /* 5909 */ { MAD_F(0x06853038) /* 0.407516688 */, 18 },
+ /* 5910 */ { MAD_F(0x068590a4) /* 0.407608645 */, 18 },
+ /* 5911 */ { MAD_F(0x0685f112) /* 0.407700606 */, 18 },
+ /* 5912 */ { MAD_F(0x06865181) /* 0.407792573 */, 18 },
+ /* 5913 */ { MAD_F(0x0686b1f2) /* 0.407884545 */, 18 },
+ /* 5914 */ { MAD_F(0x06871264) /* 0.407976522 */, 18 },
+ /* 5915 */ { MAD_F(0x068772d7) /* 0.408068505 */, 18 },
+ /* 5916 */ { MAD_F(0x0687d34c) /* 0.408160492 */, 18 },
+ /* 5917 */ { MAD_F(0x068833c2) /* 0.408252485 */, 18 },
+ /* 5918 */ { MAD_F(0x06889439) /* 0.408344483 */, 18 },
+ /* 5919 */ { MAD_F(0x0688f4b2) /* 0.408436486 */, 18 },
+
+ /* 5920 */ { MAD_F(0x0689552c) /* 0.408528495 */, 18 },
+ /* 5921 */ { MAD_F(0x0689b5a8) /* 0.408620508 */, 18 },
+ /* 5922 */ { MAD_F(0x068a1625) /* 0.408712527 */, 18 },
+ /* 5923 */ { MAD_F(0x068a76a4) /* 0.408804551 */, 18 },
+ /* 5924 */ { MAD_F(0x068ad724) /* 0.408896580 */, 18 },
+ /* 5925 */ { MAD_F(0x068b37a5) /* 0.408988614 */, 18 },
+ /* 5926 */ { MAD_F(0x068b9827) /* 0.409080653 */, 18 },
+ /* 5927 */ { MAD_F(0x068bf8ac) /* 0.409172698 */, 18 },
+ /* 5928 */ { MAD_F(0x068c5931) /* 0.409264748 */, 18 },
+ /* 5929 */ { MAD_F(0x068cb9b8) /* 0.409356803 */, 18 },
+ /* 5930 */ { MAD_F(0x068d1a40) /* 0.409448863 */, 18 },
+ /* 5931 */ { MAD_F(0x068d7aca) /* 0.409540928 */, 18 },
+ /* 5932 */ { MAD_F(0x068ddb54) /* 0.409632999 */, 18 },
+ /* 5933 */ { MAD_F(0x068e3be1) /* 0.409725074 */, 18 },
+ /* 5934 */ { MAD_F(0x068e9c6f) /* 0.409817155 */, 18 },
+ /* 5935 */ { MAD_F(0x068efcfe) /* 0.409909241 */, 18 },
+
+ /* 5936 */ { MAD_F(0x068f5d8e) /* 0.410001332 */, 18 },
+ /* 5937 */ { MAD_F(0x068fbe20) /* 0.410093428 */, 18 },
+ /* 5938 */ { MAD_F(0x06901eb4) /* 0.410185530 */, 18 },
+ /* 5939 */ { MAD_F(0x06907f48) /* 0.410277637 */, 18 },
+ /* 5940 */ { MAD_F(0x0690dfde) /* 0.410369748 */, 18 },
+ /* 5941 */ { MAD_F(0x06914076) /* 0.410461865 */, 18 },
+ /* 5942 */ { MAD_F(0x0691a10f) /* 0.410553988 */, 18 },
+ /* 5943 */ { MAD_F(0x069201a9) /* 0.410646115 */, 18 },
+ /* 5944 */ { MAD_F(0x06926245) /* 0.410738247 */, 18 },
+ /* 5945 */ { MAD_F(0x0692c2e2) /* 0.410830385 */, 18 },
+ /* 5946 */ { MAD_F(0x06932380) /* 0.410922528 */, 18 },
+ /* 5947 */ { MAD_F(0x06938420) /* 0.411014676 */, 18 },
+ /* 5948 */ { MAD_F(0x0693e4c1) /* 0.411106829 */, 18 },
+ /* 5949 */ { MAD_F(0x06944563) /* 0.411198987 */, 18 },
+ /* 5950 */ { MAD_F(0x0694a607) /* 0.411291151 */, 18 },
+ /* 5951 */ { MAD_F(0x069506ad) /* 0.411383320 */, 18 },
+
+ /* 5952 */ { MAD_F(0x06956753) /* 0.411475493 */, 18 },
+ /* 5953 */ { MAD_F(0x0695c7fc) /* 0.411567672 */, 18 },
+ /* 5954 */ { MAD_F(0x069628a5) /* 0.411659857 */, 18 },
+ /* 5955 */ { MAD_F(0x06968950) /* 0.411752046 */, 18 },
+ /* 5956 */ { MAD_F(0x0696e9fc) /* 0.411844240 */, 18 },
+ /* 5957 */ { MAD_F(0x06974aaa) /* 0.411936440 */, 18 },
+ /* 5958 */ { MAD_F(0x0697ab59) /* 0.412028645 */, 18 },
+ /* 5959 */ { MAD_F(0x06980c09) /* 0.412120855 */, 18 },
+ /* 5960 */ { MAD_F(0x06986cbb) /* 0.412213070 */, 18 },
+ /* 5961 */ { MAD_F(0x0698cd6e) /* 0.412305290 */, 18 },
+ /* 5962 */ { MAD_F(0x06992e23) /* 0.412397516 */, 18 },
+ /* 5963 */ { MAD_F(0x06998ed9) /* 0.412489746 */, 18 },
+ /* 5964 */ { MAD_F(0x0699ef90) /* 0.412581982 */, 18 },
+ /* 5965 */ { MAD_F(0x069a5049) /* 0.412674223 */, 18 },
+ /* 5966 */ { MAD_F(0x069ab103) /* 0.412766469 */, 18 },
+ /* 5967 */ { MAD_F(0x069b11bf) /* 0.412858720 */, 18 },
+
+ /* 5968 */ { MAD_F(0x069b727b) /* 0.412950976 */, 18 },
+ /* 5969 */ { MAD_F(0x069bd33a) /* 0.413043238 */, 18 },
+ /* 5970 */ { MAD_F(0x069c33f9) /* 0.413135505 */, 18 },
+ /* 5971 */ { MAD_F(0x069c94ba) /* 0.413227776 */, 18 },
+ /* 5972 */ { MAD_F(0x069cf57d) /* 0.413320053 */, 18 },
+ /* 5973 */ { MAD_F(0x069d5641) /* 0.413412335 */, 18 },
+ /* 5974 */ { MAD_F(0x069db706) /* 0.413504623 */, 18 },
+ /* 5975 */ { MAD_F(0x069e17cc) /* 0.413596915 */, 18 },
+ /* 5976 */ { MAD_F(0x069e7894) /* 0.413689213 */, 18 },
+ /* 5977 */ { MAD_F(0x069ed95e) /* 0.413781515 */, 18 },
+ /* 5978 */ { MAD_F(0x069f3a28) /* 0.413873823 */, 18 },
+ /* 5979 */ { MAD_F(0x069f9af4) /* 0.413966136 */, 18 },
+ /* 5980 */ { MAD_F(0x069ffbc2) /* 0.414058454 */, 18 },
+ /* 5981 */ { MAD_F(0x06a05c91) /* 0.414150778 */, 18 },
+ /* 5982 */ { MAD_F(0x06a0bd61) /* 0.414243106 */, 18 },
+ /* 5983 */ { MAD_F(0x06a11e32) /* 0.414335440 */, 18 },
+
+ /* 5984 */ { MAD_F(0x06a17f05) /* 0.414427779 */, 18 },
+ /* 5985 */ { MAD_F(0x06a1dfda) /* 0.414520122 */, 18 },
+ /* 5986 */ { MAD_F(0x06a240b0) /* 0.414612471 */, 18 },
+ /* 5987 */ { MAD_F(0x06a2a187) /* 0.414704826 */, 18 },
+ /* 5988 */ { MAD_F(0x06a3025f) /* 0.414797185 */, 18 },
+ /* 5989 */ { MAD_F(0x06a36339) /* 0.414889549 */, 18 },
+ /* 5990 */ { MAD_F(0x06a3c414) /* 0.414981919 */, 18 },
+ /* 5991 */ { MAD_F(0x06a424f1) /* 0.415074294 */, 18 },
+ /* 5992 */ { MAD_F(0x06a485cf) /* 0.415166674 */, 18 },
+ /* 5993 */ { MAD_F(0x06a4e6ae) /* 0.415259059 */, 18 },
+ /* 5994 */ { MAD_F(0x06a5478f) /* 0.415351449 */, 18 },
+ /* 5995 */ { MAD_F(0x06a5a871) /* 0.415443844 */, 18 },
+ /* 5996 */ { MAD_F(0x06a60955) /* 0.415536244 */, 18 },
+ /* 5997 */ { MAD_F(0x06a66a3a) /* 0.415628650 */, 18 },
+ /* 5998 */ { MAD_F(0x06a6cb20) /* 0.415721061 */, 18 },
+ /* 5999 */ { MAD_F(0x06a72c08) /* 0.415813476 */, 18 },
+
+ /* 6000 */ { MAD_F(0x06a78cf1) /* 0.415905897 */, 18 },
+ /* 6001 */ { MAD_F(0x06a7eddb) /* 0.415998324 */, 18 },
+ /* 6002 */ { MAD_F(0x06a84ec7) /* 0.416090755 */, 18 },
+ /* 6003 */ { MAD_F(0x06a8afb4) /* 0.416183191 */, 18 },
+ /* 6004 */ { MAD_F(0x06a910a3) /* 0.416275633 */, 18 },
+ /* 6005 */ { MAD_F(0x06a97193) /* 0.416368079 */, 18 },
+ /* 6006 */ { MAD_F(0x06a9d284) /* 0.416460531 */, 18 },
+ /* 6007 */ { MAD_F(0x06aa3377) /* 0.416552988 */, 18 },
+ /* 6008 */ { MAD_F(0x06aa946b) /* 0.416645450 */, 18 },
+ /* 6009 */ { MAD_F(0x06aaf561) /* 0.416737917 */, 18 },
+ /* 6010 */ { MAD_F(0x06ab5657) /* 0.416830389 */, 18 },
+ /* 6011 */ { MAD_F(0x06abb750) /* 0.416922867 */, 18 },
+ /* 6012 */ { MAD_F(0x06ac1849) /* 0.417015349 */, 18 },
+ /* 6013 */ { MAD_F(0x06ac7944) /* 0.417107837 */, 18 },
+ /* 6014 */ { MAD_F(0x06acda41) /* 0.417200330 */, 18 },
+ /* 6015 */ { MAD_F(0x06ad3b3e) /* 0.417292828 */, 18 },
+
+ /* 6016 */ { MAD_F(0x06ad9c3d) /* 0.417385331 */, 18 },
+ /* 6017 */ { MAD_F(0x06adfd3e) /* 0.417477839 */, 18 },
+ /* 6018 */ { MAD_F(0x06ae5e40) /* 0.417570352 */, 18 },
+ /* 6019 */ { MAD_F(0x06aebf43) /* 0.417662871 */, 18 },
+ /* 6020 */ { MAD_F(0x06af2047) /* 0.417755394 */, 18 },
+ /* 6021 */ { MAD_F(0x06af814d) /* 0.417847923 */, 18 },
+ /* 6022 */ { MAD_F(0x06afe255) /* 0.417940457 */, 18 },
+ /* 6023 */ { MAD_F(0x06b0435e) /* 0.418032996 */, 18 },
+ /* 6024 */ { MAD_F(0x06b0a468) /* 0.418125540 */, 18 },
+ /* 6025 */ { MAD_F(0x06b10573) /* 0.418218089 */, 18 },
+ /* 6026 */ { MAD_F(0x06b16680) /* 0.418310643 */, 18 },
+ /* 6027 */ { MAD_F(0x06b1c78e) /* 0.418403203 */, 18 },
+ /* 6028 */ { MAD_F(0x06b2289e) /* 0.418495767 */, 18 },
+ /* 6029 */ { MAD_F(0x06b289af) /* 0.418588337 */, 18 },
+ /* 6030 */ { MAD_F(0x06b2eac1) /* 0.418680911 */, 18 },
+ /* 6031 */ { MAD_F(0x06b34bd5) /* 0.418773491 */, 18 },
+
+ /* 6032 */ { MAD_F(0x06b3acea) /* 0.418866076 */, 18 },
+ /* 6033 */ { MAD_F(0x06b40e00) /* 0.418958666 */, 18 },
+ /* 6034 */ { MAD_F(0x06b46f18) /* 0.419051262 */, 18 },
+ /* 6035 */ { MAD_F(0x06b4d031) /* 0.419143862 */, 18 },
+ /* 6036 */ { MAD_F(0x06b5314c) /* 0.419236467 */, 18 },
+ /* 6037 */ { MAD_F(0x06b59268) /* 0.419329078 */, 18 },
+ /* 6038 */ { MAD_F(0x06b5f385) /* 0.419421694 */, 18 },
+ /* 6039 */ { MAD_F(0x06b654a4) /* 0.419514314 */, 18 },
+ /* 6040 */ { MAD_F(0x06b6b5c4) /* 0.419606940 */, 18 },
+ /* 6041 */ { MAD_F(0x06b716e6) /* 0.419699571 */, 18 },
+ /* 6042 */ { MAD_F(0x06b77808) /* 0.419792208 */, 18 },
+ /* 6043 */ { MAD_F(0x06b7d92d) /* 0.419884849 */, 18 },
+ /* 6044 */ { MAD_F(0x06b83a52) /* 0.419977495 */, 18 },
+ /* 6045 */ { MAD_F(0x06b89b79) /* 0.420070147 */, 18 },
+ /* 6046 */ { MAD_F(0x06b8fca1) /* 0.420162803 */, 18 },
+ /* 6047 */ { MAD_F(0x06b95dcb) /* 0.420255465 */, 18 },
+
+ /* 6048 */ { MAD_F(0x06b9bef6) /* 0.420348132 */, 18 },
+ /* 6049 */ { MAD_F(0x06ba2023) /* 0.420440803 */, 18 },
+ /* 6050 */ { MAD_F(0x06ba8150) /* 0.420533481 */, 18 },
+ /* 6051 */ { MAD_F(0x06bae280) /* 0.420626163 */, 18 },
+ /* 6052 */ { MAD_F(0x06bb43b0) /* 0.420718850 */, 18 },
+ /* 6053 */ { MAD_F(0x06bba4e2) /* 0.420811542 */, 18 },
+ /* 6054 */ { MAD_F(0x06bc0615) /* 0.420904240 */, 18 },
+ /* 6055 */ { MAD_F(0x06bc674a) /* 0.420996942 */, 18 },
+ /* 6056 */ { MAD_F(0x06bcc880) /* 0.421089650 */, 18 },
+ /* 6057 */ { MAD_F(0x06bd29b7) /* 0.421182362 */, 18 },
+ /* 6058 */ { MAD_F(0x06bd8af0) /* 0.421275080 */, 18 },
+ /* 6059 */ { MAD_F(0x06bdec2a) /* 0.421367803 */, 18 },
+ /* 6060 */ { MAD_F(0x06be4d66) /* 0.421460531 */, 18 },
+ /* 6061 */ { MAD_F(0x06beaea3) /* 0.421553264 */, 18 },
+ /* 6062 */ { MAD_F(0x06bf0fe1) /* 0.421646003 */, 18 },
+ /* 6063 */ { MAD_F(0x06bf7120) /* 0.421738746 */, 18 },
+
+ /* 6064 */ { MAD_F(0x06bfd261) /* 0.421831494 */, 18 },
+ /* 6065 */ { MAD_F(0x06c033a4) /* 0.421924248 */, 18 },
+ /* 6066 */ { MAD_F(0x06c094e7) /* 0.422017007 */, 18 },
+ /* 6067 */ { MAD_F(0x06c0f62c) /* 0.422109770 */, 18 },
+ /* 6068 */ { MAD_F(0x06c15773) /* 0.422202539 */, 18 },
+ /* 6069 */ { MAD_F(0x06c1b8bb) /* 0.422295313 */, 18 },
+ /* 6070 */ { MAD_F(0x06c21a04) /* 0.422388092 */, 18 },
+ /* 6071 */ { MAD_F(0x06c27b4e) /* 0.422480876 */, 18 },
+ /* 6072 */ { MAD_F(0x06c2dc9a) /* 0.422573665 */, 18 },
+ /* 6073 */ { MAD_F(0x06c33de8) /* 0.422666460 */, 18 },
+ /* 6074 */ { MAD_F(0x06c39f36) /* 0.422759259 */, 18 },
+ /* 6075 */ { MAD_F(0x06c40086) /* 0.422852064 */, 18 },
+ /* 6076 */ { MAD_F(0x06c461d8) /* 0.422944873 */, 18 },
+ /* 6077 */ { MAD_F(0x06c4c32a) /* 0.423037688 */, 18 },
+ /* 6078 */ { MAD_F(0x06c5247f) /* 0.423130508 */, 18 },
+ /* 6079 */ { MAD_F(0x06c585d4) /* 0.423223333 */, 18 },
+
+ /* 6080 */ { MAD_F(0x06c5e72b) /* 0.423316162 */, 18 },
+ /* 6081 */ { MAD_F(0x06c64883) /* 0.423408997 */, 18 },
+ /* 6082 */ { MAD_F(0x06c6a9dd) /* 0.423501838 */, 18 },
+ /* 6083 */ { MAD_F(0x06c70b38) /* 0.423594683 */, 18 },
+ /* 6084 */ { MAD_F(0x06c76c94) /* 0.423687533 */, 18 },
+ /* 6085 */ { MAD_F(0x06c7cdf2) /* 0.423780389 */, 18 },
+ /* 6086 */ { MAD_F(0x06c82f51) /* 0.423873249 */, 18 },
+ /* 6087 */ { MAD_F(0x06c890b1) /* 0.423966115 */, 18 },
+ /* 6088 */ { MAD_F(0x06c8f213) /* 0.424058985 */, 18 },
+ /* 6089 */ { MAD_F(0x06c95376) /* 0.424151861 */, 18 },
+ /* 6090 */ { MAD_F(0x06c9b4da) /* 0.424244742 */, 18 },
+ /* 6091 */ { MAD_F(0x06ca1640) /* 0.424337628 */, 18 },
+ /* 6092 */ { MAD_F(0x06ca77a8) /* 0.424430519 */, 18 },
+ /* 6093 */ { MAD_F(0x06cad910) /* 0.424523415 */, 18 },
+ /* 6094 */ { MAD_F(0x06cb3a7a) /* 0.424616316 */, 18 },
+ /* 6095 */ { MAD_F(0x06cb9be5) /* 0.424709222 */, 18 },
+
+ /* 6096 */ { MAD_F(0x06cbfd52) /* 0.424802133 */, 18 },
+ /* 6097 */ { MAD_F(0x06cc5ec0) /* 0.424895050 */, 18 },
+ /* 6098 */ { MAD_F(0x06ccc030) /* 0.424987971 */, 18 },
+ /* 6099 */ { MAD_F(0x06cd21a0) /* 0.425080898 */, 18 },
+ /* 6100 */ { MAD_F(0x06cd8313) /* 0.425173829 */, 18 },
+ /* 6101 */ { MAD_F(0x06cde486) /* 0.425266766 */, 18 },
+ /* 6102 */ { MAD_F(0x06ce45fb) /* 0.425359708 */, 18 },
+ /* 6103 */ { MAD_F(0x06cea771) /* 0.425452655 */, 18 },
+ /* 6104 */ { MAD_F(0x06cf08e9) /* 0.425545607 */, 18 },
+ /* 6105 */ { MAD_F(0x06cf6a62) /* 0.425638564 */, 18 },
+ /* 6106 */ { MAD_F(0x06cfcbdc) /* 0.425731526 */, 18 },
+ /* 6107 */ { MAD_F(0x06d02d58) /* 0.425824493 */, 18 },
+ /* 6108 */ { MAD_F(0x06d08ed5) /* 0.425917465 */, 18 },
+ /* 6109 */ { MAD_F(0x06d0f053) /* 0.426010443 */, 18 },
+ /* 6110 */ { MAD_F(0x06d151d3) /* 0.426103425 */, 18 },
+ /* 6111 */ { MAD_F(0x06d1b354) /* 0.426196412 */, 18 },
+
+ /* 6112 */ { MAD_F(0x06d214d7) /* 0.426289405 */, 18 },
+ /* 6113 */ { MAD_F(0x06d2765a) /* 0.426382403 */, 18 },
+ /* 6114 */ { MAD_F(0x06d2d7e0) /* 0.426475405 */, 18 },
+ /* 6115 */ { MAD_F(0x06d33966) /* 0.426568413 */, 18 },
+ /* 6116 */ { MAD_F(0x06d39aee) /* 0.426661426 */, 18 },
+ /* 6117 */ { MAD_F(0x06d3fc77) /* 0.426754444 */, 18 },
+ /* 6118 */ { MAD_F(0x06d45e02) /* 0.426847467 */, 18 },
+ /* 6119 */ { MAD_F(0x06d4bf8e) /* 0.426940495 */, 18 },
+ /* 6120 */ { MAD_F(0x06d5211c) /* 0.427033528 */, 18 },
+ /* 6121 */ { MAD_F(0x06d582aa) /* 0.427126566 */, 18 },
+ /* 6122 */ { MAD_F(0x06d5e43a) /* 0.427219609 */, 18 },
+ /* 6123 */ { MAD_F(0x06d645cc) /* 0.427312657 */, 18 },
+ /* 6124 */ { MAD_F(0x06d6a75f) /* 0.427405711 */, 18 },
+ /* 6125 */ { MAD_F(0x06d708f3) /* 0.427498769 */, 18 },
+ /* 6126 */ { MAD_F(0x06d76a88) /* 0.427591833 */, 18 },
+ /* 6127 */ { MAD_F(0x06d7cc1f) /* 0.427684901 */, 18 },
+
+ /* 6128 */ { MAD_F(0x06d82db8) /* 0.427777975 */, 18 },
+ /* 6129 */ { MAD_F(0x06d88f51) /* 0.427871054 */, 18 },
+ /* 6130 */ { MAD_F(0x06d8f0ec) /* 0.427964137 */, 18 },
+ /* 6131 */ { MAD_F(0x06d95288) /* 0.428057226 */, 18 },
+ /* 6132 */ { MAD_F(0x06d9b426) /* 0.428150320 */, 18 },
+ /* 6133 */ { MAD_F(0x06da15c5) /* 0.428243419 */, 18 },
+ /* 6134 */ { MAD_F(0x06da7766) /* 0.428336523 */, 18 },
+ /* 6135 */ { MAD_F(0x06dad907) /* 0.428429632 */, 18 },
+ /* 6136 */ { MAD_F(0x06db3aaa) /* 0.428522746 */, 18 },
+ /* 6137 */ { MAD_F(0x06db9c4f) /* 0.428615865 */, 18 },
+ /* 6138 */ { MAD_F(0x06dbfdf5) /* 0.428708989 */, 18 },
+ /* 6139 */ { MAD_F(0x06dc5f9c) /* 0.428802119 */, 18 },
+ /* 6140 */ { MAD_F(0x06dcc145) /* 0.428895253 */, 18 },
+ /* 6141 */ { MAD_F(0x06dd22ee) /* 0.428988392 */, 18 },
+ /* 6142 */ { MAD_F(0x06dd849a) /* 0.429081537 */, 18 },
+ /* 6143 */ { MAD_F(0x06dde646) /* 0.429174686 */, 18 },
+
+ /* 6144 */ { MAD_F(0x06de47f4) /* 0.429267841 */, 18 },
+ /* 6145 */ { MAD_F(0x06dea9a4) /* 0.429361001 */, 18 },
+ /* 6146 */ { MAD_F(0x06df0b54) /* 0.429454165 */, 18 },
+ /* 6147 */ { MAD_F(0x06df6d06) /* 0.429547335 */, 18 },
+ /* 6148 */ { MAD_F(0x06dfceba) /* 0.429640510 */, 18 },
+ /* 6149 */ { MAD_F(0x06e0306f) /* 0.429733690 */, 18 },
+ /* 6150 */ { MAD_F(0x06e09225) /* 0.429826874 */, 18 },
+ /* 6151 */ { MAD_F(0x06e0f3dc) /* 0.429920064 */, 18 },
+ /* 6152 */ { MAD_F(0x06e15595) /* 0.430013259 */, 18 },
+ /* 6153 */ { MAD_F(0x06e1b74f) /* 0.430106459 */, 18 },
+ /* 6154 */ { MAD_F(0x06e2190b) /* 0.430199664 */, 18 },
+ /* 6155 */ { MAD_F(0x06e27ac8) /* 0.430292875 */, 18 },
+ /* 6156 */ { MAD_F(0x06e2dc86) /* 0.430386090 */, 18 },
+ /* 6157 */ { MAD_F(0x06e33e46) /* 0.430479310 */, 18 },
+ /* 6158 */ { MAD_F(0x06e3a007) /* 0.430572535 */, 18 },
+ /* 6159 */ { MAD_F(0x06e401c9) /* 0.430665765 */, 18 },
+
+ /* 6160 */ { MAD_F(0x06e4638d) /* 0.430759001 */, 18 },
+ /* 6161 */ { MAD_F(0x06e4c552) /* 0.430852241 */, 18 },
+ /* 6162 */ { MAD_F(0x06e52718) /* 0.430945487 */, 18 },
+ /* 6163 */ { MAD_F(0x06e588e0) /* 0.431038737 */, 18 },
+ /* 6164 */ { MAD_F(0x06e5eaa9) /* 0.431131993 */, 18 },
+ /* 6165 */ { MAD_F(0x06e64c73) /* 0.431225253 */, 18 },
+ /* 6166 */ { MAD_F(0x06e6ae3f) /* 0.431318519 */, 18 },
+ /* 6167 */ { MAD_F(0x06e7100c) /* 0.431411790 */, 18 },
+ /* 6168 */ { MAD_F(0x06e771db) /* 0.431505065 */, 18 },
+ /* 6169 */ { MAD_F(0x06e7d3ab) /* 0.431598346 */, 18 },
+ /* 6170 */ { MAD_F(0x06e8357c) /* 0.431691632 */, 18 },
+ /* 6171 */ { MAD_F(0x06e8974e) /* 0.431784923 */, 18 },
+ /* 6172 */ { MAD_F(0x06e8f922) /* 0.431878218 */, 18 },
+ /* 6173 */ { MAD_F(0x06e95af8) /* 0.431971519 */, 18 },
+ /* 6174 */ { MAD_F(0x06e9bcce) /* 0.432064825 */, 18 },
+ /* 6175 */ { MAD_F(0x06ea1ea6) /* 0.432158136 */, 18 },
+
+ /* 6176 */ { MAD_F(0x06ea807f) /* 0.432251452 */, 18 },
+ /* 6177 */ { MAD_F(0x06eae25a) /* 0.432344773 */, 18 },
+ /* 6178 */ { MAD_F(0x06eb4436) /* 0.432438099 */, 18 },
+ /* 6179 */ { MAD_F(0x06eba614) /* 0.432531431 */, 18 },
+ /* 6180 */ { MAD_F(0x06ec07f2) /* 0.432624767 */, 18 },
+ /* 6181 */ { MAD_F(0x06ec69d2) /* 0.432718108 */, 18 },
+ /* 6182 */ { MAD_F(0x06eccbb4) /* 0.432811454 */, 18 },
+ /* 6183 */ { MAD_F(0x06ed2d97) /* 0.432904805 */, 18 },
+ /* 6184 */ { MAD_F(0x06ed8f7b) /* 0.432998162 */, 18 },
+ /* 6185 */ { MAD_F(0x06edf160) /* 0.433091523 */, 18 },
+ /* 6186 */ { MAD_F(0x06ee5347) /* 0.433184889 */, 18 },
+ /* 6187 */ { MAD_F(0x06eeb52f) /* 0.433278261 */, 18 },
+ /* 6188 */ { MAD_F(0x06ef1719) /* 0.433371637 */, 18 },
+ /* 6189 */ { MAD_F(0x06ef7904) /* 0.433465019 */, 18 },
+ /* 6190 */ { MAD_F(0x06efdaf0) /* 0.433558405 */, 18 },
+ /* 6191 */ { MAD_F(0x06f03cde) /* 0.433651797 */, 18 },
+
+ /* 6192 */ { MAD_F(0x06f09ecc) /* 0.433745193 */, 18 },
+ /* 6193 */ { MAD_F(0x06f100bd) /* 0.433838595 */, 18 },
+ /* 6194 */ { MAD_F(0x06f162ae) /* 0.433932001 */, 18 },
+ /* 6195 */ { MAD_F(0x06f1c4a1) /* 0.434025413 */, 18 },
+ /* 6196 */ { MAD_F(0x06f22696) /* 0.434118830 */, 18 },
+ /* 6197 */ { MAD_F(0x06f2888b) /* 0.434212251 */, 18 },
+ /* 6198 */ { MAD_F(0x06f2ea82) /* 0.434305678 */, 18 },
+ /* 6199 */ { MAD_F(0x06f34c7b) /* 0.434399110 */, 18 },
+ /* 6200 */ { MAD_F(0x06f3ae75) /* 0.434492546 */, 18 },
+ /* 6201 */ { MAD_F(0x06f41070) /* 0.434585988 */, 18 },
+ /* 6202 */ { MAD_F(0x06f4726c) /* 0.434679435 */, 18 },
+ /* 6203 */ { MAD_F(0x06f4d46a) /* 0.434772887 */, 18 },
+ /* 6204 */ { MAD_F(0x06f53669) /* 0.434866344 */, 18 },
+ /* 6205 */ { MAD_F(0x06f59869) /* 0.434959806 */, 18 },
+ /* 6206 */ { MAD_F(0x06f5fa6b) /* 0.435053272 */, 18 },
+ /* 6207 */ { MAD_F(0x06f65c6e) /* 0.435146744 */, 18 },
+
+ /* 6208 */ { MAD_F(0x06f6be73) /* 0.435240221 */, 18 },
+ /* 6209 */ { MAD_F(0x06f72079) /* 0.435333703 */, 18 },
+ /* 6210 */ { MAD_F(0x06f78280) /* 0.435427190 */, 18 },
+ /* 6211 */ { MAD_F(0x06f7e489) /* 0.435520682 */, 18 },
+ /* 6212 */ { MAD_F(0x06f84693) /* 0.435614179 */, 18 },
+ /* 6213 */ { MAD_F(0x06f8a89e) /* 0.435707681 */, 18 },
+ /* 6214 */ { MAD_F(0x06f90aaa) /* 0.435801188 */, 18 },
+ /* 6215 */ { MAD_F(0x06f96cb8) /* 0.435894700 */, 18 },
+ /* 6216 */ { MAD_F(0x06f9cec8) /* 0.435988217 */, 18 },
+ /* 6217 */ { MAD_F(0x06fa30d8) /* 0.436081739 */, 18 },
+ /* 6218 */ { MAD_F(0x06fa92ea) /* 0.436175266 */, 18 },
+ /* 6219 */ { MAD_F(0x06faf4fe) /* 0.436268799 */, 18 },
+ /* 6220 */ { MAD_F(0x06fb5712) /* 0.436362336 */, 18 },
+ /* 6221 */ { MAD_F(0x06fbb928) /* 0.436455878 */, 18 },
+ /* 6222 */ { MAD_F(0x06fc1b40) /* 0.436549425 */, 18 },
+ /* 6223 */ { MAD_F(0x06fc7d58) /* 0.436642977 */, 18 },
+
+ /* 6224 */ { MAD_F(0x06fcdf72) /* 0.436736534 */, 18 },
+ /* 6225 */ { MAD_F(0x06fd418e) /* 0.436830096 */, 18 },
+ /* 6226 */ { MAD_F(0x06fda3ab) /* 0.436923664 */, 18 },
+ /* 6227 */ { MAD_F(0x06fe05c9) /* 0.437017236 */, 18 },
+ /* 6228 */ { MAD_F(0x06fe67e8) /* 0.437110813 */, 18 },
+ /* 6229 */ { MAD_F(0x06feca09) /* 0.437204395 */, 18 },
+ /* 6230 */ { MAD_F(0x06ff2c2b) /* 0.437297982 */, 18 },
+ /* 6231 */ { MAD_F(0x06ff8e4f) /* 0.437391575 */, 18 },
+ /* 6232 */ { MAD_F(0x06fff073) /* 0.437485172 */, 18 },
+ /* 6233 */ { MAD_F(0x0700529a) /* 0.437578774 */, 18 },
+ /* 6234 */ { MAD_F(0x0700b4c1) /* 0.437672381 */, 18 },
+ /* 6235 */ { MAD_F(0x070116ea) /* 0.437765994 */, 18 },
+ /* 6236 */ { MAD_F(0x07017914) /* 0.437859611 */, 18 },
+ /* 6237 */ { MAD_F(0x0701db40) /* 0.437953233 */, 18 },
+ /* 6238 */ { MAD_F(0x07023d6c) /* 0.438046860 */, 18 },
+ /* 6239 */ { MAD_F(0x07029f9b) /* 0.438140493 */, 18 },
+
+ /* 6240 */ { MAD_F(0x070301ca) /* 0.438234130 */, 18 },
+ /* 6241 */ { MAD_F(0x070363fb) /* 0.438327772 */, 18 },
+ /* 6242 */ { MAD_F(0x0703c62d) /* 0.438421419 */, 18 },
+ /* 6243 */ { MAD_F(0x07042861) /* 0.438515072 */, 18 },
+ /* 6244 */ { MAD_F(0x07048a96) /* 0.438608729 */, 18 },
+ /* 6245 */ { MAD_F(0x0704eccc) /* 0.438702391 */, 18 },
+ /* 6246 */ { MAD_F(0x07054f04) /* 0.438796059 */, 18 },
+ /* 6247 */ { MAD_F(0x0705b13d) /* 0.438889731 */, 18 },
+ /* 6248 */ { MAD_F(0x07061377) /* 0.438983408 */, 18 },
+ /* 6249 */ { MAD_F(0x070675b3) /* 0.439077090 */, 18 },
+ /* 6250 */ { MAD_F(0x0706d7f0) /* 0.439170778 */, 18 },
+ /* 6251 */ { MAD_F(0x07073a2e) /* 0.439264470 */, 18 },
+ /* 6252 */ { MAD_F(0x07079c6e) /* 0.439358167 */, 18 },
+ /* 6253 */ { MAD_F(0x0707feaf) /* 0.439451869 */, 18 },
+ /* 6254 */ { MAD_F(0x070860f1) /* 0.439545577 */, 18 },
+ /* 6255 */ { MAD_F(0x0708c335) /* 0.439639289 */, 18 },
+
+ /* 6256 */ { MAD_F(0x0709257a) /* 0.439733006 */, 18 },
+ /* 6257 */ { MAD_F(0x070987c0) /* 0.439826728 */, 18 },
+ /* 6258 */ { MAD_F(0x0709ea08) /* 0.439920456 */, 18 },
+ /* 6259 */ { MAD_F(0x070a4c51) /* 0.440014188 */, 18 },
+ /* 6260 */ { MAD_F(0x070aae9b) /* 0.440107925 */, 18 },
+ /* 6261 */ { MAD_F(0x070b10e7) /* 0.440201667 */, 18 },
+ /* 6262 */ { MAD_F(0x070b7334) /* 0.440295414 */, 18 },
+ /* 6263 */ { MAD_F(0x070bd583) /* 0.440389167 */, 18 },
+ /* 6264 */ { MAD_F(0x070c37d2) /* 0.440482924 */, 18 },
+ /* 6265 */ { MAD_F(0x070c9a23) /* 0.440576686 */, 18 },
+ /* 6266 */ { MAD_F(0x070cfc76) /* 0.440670453 */, 18 },
+ /* 6267 */ { MAD_F(0x070d5eca) /* 0.440764225 */, 18 },
+ /* 6268 */ { MAD_F(0x070dc11f) /* 0.440858002 */, 18 },
+ /* 6269 */ { MAD_F(0x070e2375) /* 0.440951784 */, 18 },
+ /* 6270 */ { MAD_F(0x070e85cd) /* 0.441045572 */, 18 },
+ /* 6271 */ { MAD_F(0x070ee826) /* 0.441139364 */, 18 },
+
+ /* 6272 */ { MAD_F(0x070f4a80) /* 0.441233161 */, 18 },
+ /* 6273 */ { MAD_F(0x070facdc) /* 0.441326963 */, 18 },
+ /* 6274 */ { MAD_F(0x07100f39) /* 0.441420770 */, 18 },
+ /* 6275 */ { MAD_F(0x07107198) /* 0.441514582 */, 18 },
+ /* 6276 */ { MAD_F(0x0710d3f8) /* 0.441608399 */, 18 },
+ /* 6277 */ { MAD_F(0x07113659) /* 0.441702221 */, 18 },
+ /* 6278 */ { MAD_F(0x071198bb) /* 0.441796048 */, 18 },
+ /* 6279 */ { MAD_F(0x0711fb1f) /* 0.441889880 */, 18 },
+ /* 6280 */ { MAD_F(0x07125d84) /* 0.441983717 */, 18 },
+ /* 6281 */ { MAD_F(0x0712bfeb) /* 0.442077559 */, 18 },
+ /* 6282 */ { MAD_F(0x07132253) /* 0.442171406 */, 18 },
+ /* 6283 */ { MAD_F(0x071384bc) /* 0.442265257 */, 18 },
+ /* 6284 */ { MAD_F(0x0713e726) /* 0.442359114 */, 18 },
+ /* 6285 */ { MAD_F(0x07144992) /* 0.442452976 */, 18 },
+ /* 6286 */ { MAD_F(0x0714abff) /* 0.442546843 */, 18 },
+ /* 6287 */ { MAD_F(0x07150e6e) /* 0.442640715 */, 18 },
+
+ /* 6288 */ { MAD_F(0x071570de) /* 0.442734592 */, 18 },
+ /* 6289 */ { MAD_F(0x0715d34f) /* 0.442828473 */, 18 },
+ /* 6290 */ { MAD_F(0x071635c1) /* 0.442922360 */, 18 },
+ /* 6291 */ { MAD_F(0x07169835) /* 0.443016252 */, 18 },
+ /* 6292 */ { MAD_F(0x0716faaa) /* 0.443110148 */, 18 },
+ /* 6293 */ { MAD_F(0x07175d21) /* 0.443204050 */, 18 },
+ /* 6294 */ { MAD_F(0x0717bf99) /* 0.443297957 */, 18 },
+ /* 6295 */ { MAD_F(0x07182212) /* 0.443391868 */, 18 },
+ /* 6296 */ { MAD_F(0x0718848d) /* 0.443485785 */, 18 },
+ /* 6297 */ { MAD_F(0x0718e709) /* 0.443579706 */, 18 },
+ /* 6298 */ { MAD_F(0x07194986) /* 0.443673633 */, 18 },
+ /* 6299 */ { MAD_F(0x0719ac04) /* 0.443767564 */, 18 },
+ /* 6300 */ { MAD_F(0x071a0e84) /* 0.443861501 */, 18 },
+ /* 6301 */ { MAD_F(0x071a7105) /* 0.443955442 */, 18 },
+ /* 6302 */ { MAD_F(0x071ad388) /* 0.444049389 */, 18 },
+ /* 6303 */ { MAD_F(0x071b360c) /* 0.444143340 */, 18 },
+
+ /* 6304 */ { MAD_F(0x071b9891) /* 0.444237296 */, 18 },
+ /* 6305 */ { MAD_F(0x071bfb18) /* 0.444331258 */, 18 },
+ /* 6306 */ { MAD_F(0x071c5d9f) /* 0.444425224 */, 18 },
+ /* 6307 */ { MAD_F(0x071cc029) /* 0.444519195 */, 18 },
+ /* 6308 */ { MAD_F(0x071d22b3) /* 0.444613171 */, 18 },
+ /* 6309 */ { MAD_F(0x071d853f) /* 0.444707153 */, 18 },
+ /* 6310 */ { MAD_F(0x071de7cc) /* 0.444801139 */, 18 },
+ /* 6311 */ { MAD_F(0x071e4a5b) /* 0.444895130 */, 18 },
+ /* 6312 */ { MAD_F(0x071eaceb) /* 0.444989126 */, 18 },
+ /* 6313 */ { MAD_F(0x071f0f7c) /* 0.445083127 */, 18 },
+ /* 6314 */ { MAD_F(0x071f720e) /* 0.445177133 */, 18 },
+ /* 6315 */ { MAD_F(0x071fd4a2) /* 0.445271144 */, 18 },
+ /* 6316 */ { MAD_F(0x07203737) /* 0.445365160 */, 18 },
+ /* 6317 */ { MAD_F(0x072099ce) /* 0.445459181 */, 18 },
+ /* 6318 */ { MAD_F(0x0720fc66) /* 0.445553206 */, 18 },
+ /* 6319 */ { MAD_F(0x07215eff) /* 0.445647237 */, 18 },
+
+ /* 6320 */ { MAD_F(0x0721c19a) /* 0.445741273 */, 18 },
+ /* 6321 */ { MAD_F(0x07222436) /* 0.445835314 */, 18 },
+ /* 6322 */ { MAD_F(0x072286d3) /* 0.445929359 */, 18 },
+ /* 6323 */ { MAD_F(0x0722e971) /* 0.446023410 */, 18 },
+ /* 6324 */ { MAD_F(0x07234c11) /* 0.446117466 */, 18 },
+ /* 6325 */ { MAD_F(0x0723aeb2) /* 0.446211526 */, 18 },
+ /* 6326 */ { MAD_F(0x07241155) /* 0.446305592 */, 18 },
+ /* 6327 */ { MAD_F(0x072473f9) /* 0.446399662 */, 18 },
+ /* 6328 */ { MAD_F(0x0724d69e) /* 0.446493738 */, 18 },
+ /* 6329 */ { MAD_F(0x07253944) /* 0.446587818 */, 18 },
+ /* 6330 */ { MAD_F(0x07259bec) /* 0.446681903 */, 18 },
+ /* 6331 */ { MAD_F(0x0725fe95) /* 0.446775994 */, 18 },
+ /* 6332 */ { MAD_F(0x07266140) /* 0.446870089 */, 18 },
+ /* 6333 */ { MAD_F(0x0726c3ec) /* 0.446964189 */, 18 },
+ /* 6334 */ { MAD_F(0x07272699) /* 0.447058294 */, 18 },
+ /* 6335 */ { MAD_F(0x07278947) /* 0.447152404 */, 18 },
+
+ /* 6336 */ { MAD_F(0x0727ebf7) /* 0.447246519 */, 18 },
+ /* 6337 */ { MAD_F(0x07284ea8) /* 0.447340639 */, 18 },
+ /* 6338 */ { MAD_F(0x0728b15b) /* 0.447434764 */, 18 },
+ /* 6339 */ { MAD_F(0x0729140f) /* 0.447528894 */, 18 },
+ /* 6340 */ { MAD_F(0x072976c4) /* 0.447623029 */, 18 },
+ /* 6341 */ { MAD_F(0x0729d97a) /* 0.447717169 */, 18 },
+ /* 6342 */ { MAD_F(0x072a3c32) /* 0.447811314 */, 18 },
+ /* 6343 */ { MAD_F(0x072a9eeb) /* 0.447905463 */, 18 },
+ /* 6344 */ { MAD_F(0x072b01a6) /* 0.447999618 */, 18 },
+ /* 6345 */ { MAD_F(0x072b6461) /* 0.448093778 */, 18 },
+ /* 6346 */ { MAD_F(0x072bc71e) /* 0.448187942 */, 18 },
+ /* 6347 */ { MAD_F(0x072c29dd) /* 0.448282112 */, 18 },
+ /* 6348 */ { MAD_F(0x072c8c9d) /* 0.448376286 */, 18 },
+ /* 6349 */ { MAD_F(0x072cef5e) /* 0.448470466 */, 18 },
+ /* 6350 */ { MAD_F(0x072d5220) /* 0.448564650 */, 18 },
+ /* 6351 */ { MAD_F(0x072db4e4) /* 0.448658839 */, 18 },
+
+ /* 6352 */ { MAD_F(0x072e17a9) /* 0.448753033 */, 18 },
+ /* 6353 */ { MAD_F(0x072e7a6f) /* 0.448847233 */, 18 },
+ /* 6354 */ { MAD_F(0x072edd37) /* 0.448941437 */, 18 },
+ /* 6355 */ { MAD_F(0x072f4000) /* 0.449035646 */, 18 },
+ /* 6356 */ { MAD_F(0x072fa2ca) /* 0.449129860 */, 18 },
+ /* 6357 */ { MAD_F(0x07300596) /* 0.449224079 */, 18 },
+ /* 6358 */ { MAD_F(0x07306863) /* 0.449318303 */, 18 },
+ /* 6359 */ { MAD_F(0x0730cb32) /* 0.449412531 */, 18 },
+ /* 6360 */ { MAD_F(0x07312e01) /* 0.449506765 */, 18 },
+ /* 6361 */ { MAD_F(0x073190d2) /* 0.449601004 */, 18 },
+ /* 6362 */ { MAD_F(0x0731f3a5) /* 0.449695247 */, 18 },
+ /* 6363 */ { MAD_F(0x07325678) /* 0.449789496 */, 18 },
+ /* 6364 */ { MAD_F(0x0732b94d) /* 0.449883749 */, 18 },
+ /* 6365 */ { MAD_F(0x07331c23) /* 0.449978008 */, 18 },
+ /* 6366 */ { MAD_F(0x07337efb) /* 0.450072271 */, 18 },
+ /* 6367 */ { MAD_F(0x0733e1d4) /* 0.450166540 */, 18 },
+
+ /* 6368 */ { MAD_F(0x073444ae) /* 0.450260813 */, 18 },
+ /* 6369 */ { MAD_F(0x0734a78a) /* 0.450355091 */, 18 },
+ /* 6370 */ { MAD_F(0x07350a67) /* 0.450449374 */, 18 },
+ /* 6371 */ { MAD_F(0x07356d45) /* 0.450543662 */, 18 },
+ /* 6372 */ { MAD_F(0x0735d025) /* 0.450637955 */, 18 },
+ /* 6373 */ { MAD_F(0x07363306) /* 0.450732253 */, 18 },
+ /* 6374 */ { MAD_F(0x073695e8) /* 0.450826556 */, 18 },
+ /* 6375 */ { MAD_F(0x0736f8cb) /* 0.450920864 */, 18 },
+ /* 6376 */ { MAD_F(0x07375bb0) /* 0.451015176 */, 18 },
+ /* 6377 */ { MAD_F(0x0737be96) /* 0.451109494 */, 18 },
+ /* 6378 */ { MAD_F(0x0738217e) /* 0.451203817 */, 18 },
+ /* 6379 */ { MAD_F(0x07388467) /* 0.451298144 */, 18 },
+ /* 6380 */ { MAD_F(0x0738e751) /* 0.451392477 */, 18 },
+ /* 6381 */ { MAD_F(0x07394a3d) /* 0.451486814 */, 18 },
+ /* 6382 */ { MAD_F(0x0739ad29) /* 0.451581156 */, 18 },
+ /* 6383 */ { MAD_F(0x073a1017) /* 0.451675503 */, 18 },
+
+ /* 6384 */ { MAD_F(0x073a7307) /* 0.451769856 */, 18 },
+ /* 6385 */ { MAD_F(0x073ad5f8) /* 0.451864213 */, 18 },
+ /* 6386 */ { MAD_F(0x073b38ea) /* 0.451958575 */, 18 },
+ /* 6387 */ { MAD_F(0x073b9bdd) /* 0.452052942 */, 18 },
+ /* 6388 */ { MAD_F(0x073bfed2) /* 0.452147313 */, 18 },
+ /* 6389 */ { MAD_F(0x073c61c8) /* 0.452241690 */, 18 },
+ /* 6390 */ { MAD_F(0x073cc4bf) /* 0.452336072 */, 18 },
+ /* 6391 */ { MAD_F(0x073d27b8) /* 0.452430458 */, 18 },
+ /* 6392 */ { MAD_F(0x073d8ab2) /* 0.452524850 */, 18 },
+ /* 6393 */ { MAD_F(0x073dedae) /* 0.452619246 */, 18 },
+ /* 6394 */ { MAD_F(0x073e50aa) /* 0.452713648 */, 18 },
+ /* 6395 */ { MAD_F(0x073eb3a8) /* 0.452808054 */, 18 },
+ /* 6396 */ { MAD_F(0x073f16a8) /* 0.452902465 */, 18 },
+ /* 6397 */ { MAD_F(0x073f79a8) /* 0.452996882 */, 18 },
+ /* 6398 */ { MAD_F(0x073fdcaa) /* 0.453091303 */, 18 },
+ /* 6399 */ { MAD_F(0x07403fad) /* 0.453185729 */, 18 },
+
+ /* 6400 */ { MAD_F(0x0740a2b2) /* 0.453280160 */, 18 },
+ /* 6401 */ { MAD_F(0x074105b8) /* 0.453374595 */, 18 },
+ /* 6402 */ { MAD_F(0x074168bf) /* 0.453469036 */, 18 },
+ /* 6403 */ { MAD_F(0x0741cbc8) /* 0.453563482 */, 18 },
+ /* 6404 */ { MAD_F(0x07422ed2) /* 0.453657932 */, 18 },
+ /* 6405 */ { MAD_F(0x074291dd) /* 0.453752388 */, 18 },
+ /* 6406 */ { MAD_F(0x0742f4e9) /* 0.453846848 */, 18 },
+ /* 6407 */ { MAD_F(0x074357f7) /* 0.453941314 */, 18 },
+ /* 6408 */ { MAD_F(0x0743bb06) /* 0.454035784 */, 18 },
+ /* 6409 */ { MAD_F(0x07441e17) /* 0.454130259 */, 18 },
+ /* 6410 */ { MAD_F(0x07448129) /* 0.454224739 */, 18 },
+ /* 6411 */ { MAD_F(0x0744e43c) /* 0.454319224 */, 18 },
+ /* 6412 */ { MAD_F(0x07454750) /* 0.454413714 */, 18 },
+ /* 6413 */ { MAD_F(0x0745aa66) /* 0.454508209 */, 18 },
+ /* 6414 */ { MAD_F(0x07460d7d) /* 0.454602708 */, 18 },
+ /* 6415 */ { MAD_F(0x07467095) /* 0.454697213 */, 18 },
+
+ /* 6416 */ { MAD_F(0x0746d3af) /* 0.454791723 */, 18 },
+ /* 6417 */ { MAD_F(0x074736ca) /* 0.454886237 */, 18 },
+ /* 6418 */ { MAD_F(0x074799e7) /* 0.454980756 */, 18 },
+ /* 6419 */ { MAD_F(0x0747fd04) /* 0.455075281 */, 18 },
+ /* 6420 */ { MAD_F(0x07486023) /* 0.455169810 */, 18 },
+ /* 6421 */ { MAD_F(0x0748c344) /* 0.455264344 */, 18 },
+ /* 6422 */ { MAD_F(0x07492665) /* 0.455358883 */, 18 },
+ /* 6423 */ { MAD_F(0x07498988) /* 0.455453427 */, 18 },
+ /* 6424 */ { MAD_F(0x0749ecac) /* 0.455547976 */, 18 },
+ /* 6425 */ { MAD_F(0x074a4fd2) /* 0.455642529 */, 18 },
+ /* 6426 */ { MAD_F(0x074ab2f9) /* 0.455737088 */, 18 },
+ /* 6427 */ { MAD_F(0x074b1621) /* 0.455831652 */, 18 },
+ /* 6428 */ { MAD_F(0x074b794b) /* 0.455926220 */, 18 },
+ /* 6429 */ { MAD_F(0x074bdc75) /* 0.456020793 */, 18 },
+ /* 6430 */ { MAD_F(0x074c3fa1) /* 0.456115372 */, 18 },
+ /* 6431 */ { MAD_F(0x074ca2cf) /* 0.456209955 */, 18 },
+
+ /* 6432 */ { MAD_F(0x074d05fe) /* 0.456304543 */, 18 },
+ /* 6433 */ { MAD_F(0x074d692e) /* 0.456399136 */, 18 },
+ /* 6434 */ { MAD_F(0x074dcc5f) /* 0.456493733 */, 18 },
+ /* 6435 */ { MAD_F(0x074e2f92) /* 0.456588336 */, 18 },
+ /* 6436 */ { MAD_F(0x074e92c6) /* 0.456682944 */, 18 },
+ /* 6437 */ { MAD_F(0x074ef5fb) /* 0.456777556 */, 18 },
+ /* 6438 */ { MAD_F(0x074f5932) /* 0.456872174 */, 18 },
+ /* 6439 */ { MAD_F(0x074fbc6a) /* 0.456966796 */, 18 },
+ /* 6440 */ { MAD_F(0x07501fa3) /* 0.457061423 */, 18 },
+ /* 6441 */ { MAD_F(0x075082de) /* 0.457156056 */, 18 },
+ /* 6442 */ { MAD_F(0x0750e61a) /* 0.457250693 */, 18 },
+ /* 6443 */ { MAD_F(0x07514957) /* 0.457345335 */, 18 },
+ /* 6444 */ { MAD_F(0x0751ac96) /* 0.457439981 */, 18 },
+ /* 6445 */ { MAD_F(0x07520fd6) /* 0.457534633 */, 18 },
+ /* 6446 */ { MAD_F(0x07527317) /* 0.457629290 */, 18 },
+ /* 6447 */ { MAD_F(0x0752d659) /* 0.457723951 */, 18 },
+
+ /* 6448 */ { MAD_F(0x0753399d) /* 0.457818618 */, 18 },
+ /* 6449 */ { MAD_F(0x07539ce2) /* 0.457913289 */, 18 },
+ /* 6450 */ { MAD_F(0x07540029) /* 0.458007965 */, 18 },
+ /* 6451 */ { MAD_F(0x07546371) /* 0.458102646 */, 18 },
+ /* 6452 */ { MAD_F(0x0754c6ba) /* 0.458197332 */, 18 },
+ /* 6453 */ { MAD_F(0x07552a04) /* 0.458292023 */, 18 },
+ /* 6454 */ { MAD_F(0x07558d50) /* 0.458386719 */, 18 },
+ /* 6455 */ { MAD_F(0x0755f09d) /* 0.458481420 */, 18 },
+ /* 6456 */ { MAD_F(0x075653eb) /* 0.458576125 */, 18 },
+ /* 6457 */ { MAD_F(0x0756b73b) /* 0.458670836 */, 18 },
+ /* 6458 */ { MAD_F(0x07571a8c) /* 0.458765551 */, 18 },
+ /* 6459 */ { MAD_F(0x07577dde) /* 0.458860271 */, 18 },
+ /* 6460 */ { MAD_F(0x0757e131) /* 0.458954996 */, 18 },
+ /* 6461 */ { MAD_F(0x07584486) /* 0.459049726 */, 18 },
+ /* 6462 */ { MAD_F(0x0758a7dd) /* 0.459144461 */, 18 },
+ /* 6463 */ { MAD_F(0x07590b34) /* 0.459239201 */, 18 },
+
+ /* 6464 */ { MAD_F(0x07596e8d) /* 0.459333946 */, 18 },
+ /* 6465 */ { MAD_F(0x0759d1e7) /* 0.459428695 */, 18 },
+ /* 6466 */ { MAD_F(0x075a3542) /* 0.459523450 */, 18 },
+ /* 6467 */ { MAD_F(0x075a989f) /* 0.459618209 */, 18 },
+ /* 6468 */ { MAD_F(0x075afbfd) /* 0.459712973 */, 18 },
+ /* 6469 */ { MAD_F(0x075b5f5d) /* 0.459807742 */, 18 },
+ /* 6470 */ { MAD_F(0x075bc2bd) /* 0.459902516 */, 18 },
+ /* 6471 */ { MAD_F(0x075c261f) /* 0.459997295 */, 18 },
+ /* 6472 */ { MAD_F(0x075c8983) /* 0.460092079 */, 18 },
+ /* 6473 */ { MAD_F(0x075cece7) /* 0.460186867 */, 18 },
+ /* 6474 */ { MAD_F(0x075d504d) /* 0.460281661 */, 18 },
+ /* 6475 */ { MAD_F(0x075db3b5) /* 0.460376459 */, 18 },
+ /* 6476 */ { MAD_F(0x075e171d) /* 0.460471262 */, 18 },
+ /* 6477 */ { MAD_F(0x075e7a87) /* 0.460566071 */, 18 },
+ /* 6478 */ { MAD_F(0x075eddf2) /* 0.460660884 */, 18 },
+ /* 6479 */ { MAD_F(0x075f415f) /* 0.460755701 */, 18 },
+
+ /* 6480 */ { MAD_F(0x075fa4cc) /* 0.460850524 */, 18 },
+ /* 6481 */ { MAD_F(0x0760083b) /* 0.460945352 */, 18 },
+ /* 6482 */ { MAD_F(0x07606bac) /* 0.461040184 */, 18 },
+ /* 6483 */ { MAD_F(0x0760cf1e) /* 0.461135022 */, 18 },
+ /* 6484 */ { MAD_F(0x07613291) /* 0.461229864 */, 18 },
+ /* 6485 */ { MAD_F(0x07619605) /* 0.461324711 */, 18 },
+ /* 6486 */ { MAD_F(0x0761f97b) /* 0.461419563 */, 18 },
+ /* 6487 */ { MAD_F(0x07625cf2) /* 0.461514420 */, 18 },
+ /* 6488 */ { MAD_F(0x0762c06a) /* 0.461609282 */, 18 },
+ /* 6489 */ { MAD_F(0x076323e3) /* 0.461704149 */, 18 },
+ /* 6490 */ { MAD_F(0x0763875e) /* 0.461799020 */, 18 },
+ /* 6491 */ { MAD_F(0x0763eadb) /* 0.461893897 */, 18 },
+ /* 6492 */ { MAD_F(0x07644e58) /* 0.461988778 */, 18 },
+ /* 6493 */ { MAD_F(0x0764b1d7) /* 0.462083664 */, 18 },
+ /* 6494 */ { MAD_F(0x07651557) /* 0.462178555 */, 18 },
+ /* 6495 */ { MAD_F(0x076578d8) /* 0.462273451 */, 18 },
+
+ /* 6496 */ { MAD_F(0x0765dc5b) /* 0.462368352 */, 18 },
+ /* 6497 */ { MAD_F(0x07663fdf) /* 0.462463257 */, 18 },
+ /* 6498 */ { MAD_F(0x0766a364) /* 0.462558168 */, 18 },
+ /* 6499 */ { MAD_F(0x076706eb) /* 0.462653083 */, 18 },
+ /* 6500 */ { MAD_F(0x07676a73) /* 0.462748003 */, 18 },
+ /* 6501 */ { MAD_F(0x0767cdfc) /* 0.462842928 */, 18 },
+ /* 6502 */ { MAD_F(0x07683187) /* 0.462937858 */, 18 },
+ /* 6503 */ { MAD_F(0x07689513) /* 0.463032793 */, 18 },
+ /* 6504 */ { MAD_F(0x0768f8a0) /* 0.463127733 */, 18 },
+ /* 6505 */ { MAD_F(0x07695c2e) /* 0.463222678 */, 18 },
+ /* 6506 */ { MAD_F(0x0769bfbe) /* 0.463317627 */, 18 },
+ /* 6507 */ { MAD_F(0x076a234f) /* 0.463412581 */, 18 },
+ /* 6508 */ { MAD_F(0x076a86e2) /* 0.463507540 */, 18 },
+ /* 6509 */ { MAD_F(0x076aea75) /* 0.463602504 */, 18 },
+ /* 6510 */ { MAD_F(0x076b4e0a) /* 0.463697473 */, 18 },
+ /* 6511 */ { MAD_F(0x076bb1a1) /* 0.463792447 */, 18 },
+
+ /* 6512 */ { MAD_F(0x076c1538) /* 0.463887426 */, 18 },
+ /* 6513 */ { MAD_F(0x076c78d1) /* 0.463982409 */, 18 },
+ /* 6514 */ { MAD_F(0x076cdc6c) /* 0.464077398 */, 18 },
+ /* 6515 */ { MAD_F(0x076d4007) /* 0.464172391 */, 18 },
+ /* 6516 */ { MAD_F(0x076da3a4) /* 0.464267389 */, 18 },
+ /* 6517 */ { MAD_F(0x076e0742) /* 0.464362392 */, 18 },
+ /* 6518 */ { MAD_F(0x076e6ae2) /* 0.464457399 */, 18 },
+ /* 6519 */ { MAD_F(0x076ece82) /* 0.464552412 */, 18 },
+ /* 6520 */ { MAD_F(0x076f3224) /* 0.464647430 */, 18 },
+ /* 6521 */ { MAD_F(0x076f95c8) /* 0.464742452 */, 18 },
+ /* 6522 */ { MAD_F(0x076ff96c) /* 0.464837479 */, 18 },
+ /* 6523 */ { MAD_F(0x07705d12) /* 0.464932511 */, 18 },
+ /* 6524 */ { MAD_F(0x0770c0ba) /* 0.465027548 */, 18 },
+ /* 6525 */ { MAD_F(0x07712462) /* 0.465122590 */, 18 },
+ /* 6526 */ { MAD_F(0x0771880c) /* 0.465217637 */, 18 },
+ /* 6527 */ { MAD_F(0x0771ebb7) /* 0.465312688 */, 18 },
+
+ /* 6528 */ { MAD_F(0x07724f64) /* 0.465407744 */, 18 },
+ /* 6529 */ { MAD_F(0x0772b312) /* 0.465502806 */, 18 },
+ /* 6530 */ { MAD_F(0x077316c1) /* 0.465597872 */, 18 },
+ /* 6531 */ { MAD_F(0x07737a71) /* 0.465692943 */, 18 },
+ /* 6532 */ { MAD_F(0x0773de23) /* 0.465788018 */, 18 },
+ /* 6533 */ { MAD_F(0x077441d6) /* 0.465883099 */, 18 },
+ /* 6534 */ { MAD_F(0x0774a58a) /* 0.465978184 */, 18 },
+ /* 6535 */ { MAD_F(0x07750940) /* 0.466073275 */, 18 },
+ /* 6536 */ { MAD_F(0x07756cf7) /* 0.466168370 */, 18 },
+ /* 6537 */ { MAD_F(0x0775d0af) /* 0.466263470 */, 18 },
+ /* 6538 */ { MAD_F(0x07763468) /* 0.466358575 */, 18 },
+ /* 6539 */ { MAD_F(0x07769823) /* 0.466453684 */, 18 },
+ /* 6540 */ { MAD_F(0x0776fbdf) /* 0.466548799 */, 18 },
+ /* 6541 */ { MAD_F(0x07775f9d) /* 0.466643918 */, 18 },
+ /* 6542 */ { MAD_F(0x0777c35c) /* 0.466739043 */, 18 },
+ /* 6543 */ { MAD_F(0x0778271c) /* 0.466834172 */, 18 },
+
+ /* 6544 */ { MAD_F(0x07788add) /* 0.466929306 */, 18 },
+ /* 6545 */ { MAD_F(0x0778ee9f) /* 0.467024445 */, 18 },
+ /* 6546 */ { MAD_F(0x07795263) /* 0.467119588 */, 18 },
+ /* 6547 */ { MAD_F(0x0779b629) /* 0.467214737 */, 18 },
+ /* 6548 */ { MAD_F(0x077a19ef) /* 0.467309890 */, 18 },
+ /* 6549 */ { MAD_F(0x077a7db7) /* 0.467405048 */, 18 },
+ /* 6550 */ { MAD_F(0x077ae180) /* 0.467500211 */, 18 },
+ /* 6551 */ { MAD_F(0x077b454b) /* 0.467595379 */, 18 },
+ /* 6552 */ { MAD_F(0x077ba916) /* 0.467690552 */, 18 },
+ /* 6553 */ { MAD_F(0x077c0ce3) /* 0.467785729 */, 18 },
+ /* 6554 */ { MAD_F(0x077c70b2) /* 0.467880912 */, 18 },
+ /* 6555 */ { MAD_F(0x077cd481) /* 0.467976099 */, 18 },
+ /* 6556 */ { MAD_F(0x077d3852) /* 0.468071291 */, 18 },
+ /* 6557 */ { MAD_F(0x077d9c24) /* 0.468166488 */, 18 },
+ /* 6558 */ { MAD_F(0x077dfff8) /* 0.468261690 */, 18 },
+ /* 6559 */ { MAD_F(0x077e63cd) /* 0.468356896 */, 18 },
+
+ /* 6560 */ { MAD_F(0x077ec7a3) /* 0.468452108 */, 18 },
+ /* 6561 */ { MAD_F(0x077f2b7a) /* 0.468547324 */, 18 },
+ /* 6562 */ { MAD_F(0x077f8f53) /* 0.468642545 */, 18 },
+ /* 6563 */ { MAD_F(0x077ff32d) /* 0.468737771 */, 18 },
+ /* 6564 */ { MAD_F(0x07805708) /* 0.468833002 */, 18 },
+ /* 6565 */ { MAD_F(0x0780bae5) /* 0.468928237 */, 18 },
+ /* 6566 */ { MAD_F(0x07811ec3) /* 0.469023478 */, 18 },
+ /* 6567 */ { MAD_F(0x078182a2) /* 0.469118723 */, 18 },
+ /* 6568 */ { MAD_F(0x0781e683) /* 0.469213973 */, 18 },
+ /* 6569 */ { MAD_F(0x07824a64) /* 0.469309228 */, 18 },
+ /* 6570 */ { MAD_F(0x0782ae47) /* 0.469404488 */, 18 },
+ /* 6571 */ { MAD_F(0x0783122c) /* 0.469499752 */, 18 },
+ /* 6572 */ { MAD_F(0x07837612) /* 0.469595022 */, 18 },
+ /* 6573 */ { MAD_F(0x0783d9f9) /* 0.469690296 */, 18 },
+ /* 6574 */ { MAD_F(0x07843de1) /* 0.469785575 */, 18 },
+ /* 6575 */ { MAD_F(0x0784a1ca) /* 0.469880859 */, 18 },
+
+ /* 6576 */ { MAD_F(0x078505b5) /* 0.469976148 */, 18 },
+ /* 6577 */ { MAD_F(0x078569a2) /* 0.470071442 */, 18 },
+ /* 6578 */ { MAD_F(0x0785cd8f) /* 0.470166740 */, 18 },
+ /* 6579 */ { MAD_F(0x0786317e) /* 0.470262043 */, 18 },
+ /* 6580 */ { MAD_F(0x0786956e) /* 0.470357351 */, 18 },
+ /* 6581 */ { MAD_F(0x0786f95f) /* 0.470452664 */, 18 },
+ /* 6582 */ { MAD_F(0x07875d52) /* 0.470547982 */, 18 },
+ /* 6583 */ { MAD_F(0x0787c146) /* 0.470643305 */, 18 },
+ /* 6584 */ { MAD_F(0x0788253b) /* 0.470738632 */, 18 },
+ /* 6585 */ { MAD_F(0x07888932) /* 0.470833964 */, 18 },
+ /* 6586 */ { MAD_F(0x0788ed2a) /* 0.470929301 */, 18 },
+ /* 6587 */ { MAD_F(0x07895123) /* 0.471024643 */, 18 },
+ /* 6588 */ { MAD_F(0x0789b51d) /* 0.471119990 */, 18 },
+ /* 6589 */ { MAD_F(0x078a1919) /* 0.471215341 */, 18 },
+ /* 6590 */ { MAD_F(0x078a7d16) /* 0.471310698 */, 18 },
+ /* 6591 */ { MAD_F(0x078ae114) /* 0.471406059 */, 18 },
+
+ /* 6592 */ { MAD_F(0x078b4514) /* 0.471501425 */, 18 },
+ /* 6593 */ { MAD_F(0x078ba915) /* 0.471596796 */, 18 },
+ /* 6594 */ { MAD_F(0x078c0d17) /* 0.471692171 */, 18 },
+ /* 6595 */ { MAD_F(0x078c711a) /* 0.471787552 */, 18 },
+ /* 6596 */ { MAD_F(0x078cd51f) /* 0.471882937 */, 18 },
+ /* 6597 */ { MAD_F(0x078d3925) /* 0.471978327 */, 18 },
+ /* 6598 */ { MAD_F(0x078d9d2d) /* 0.472073722 */, 18 },
+ /* 6599 */ { MAD_F(0x078e0135) /* 0.472169122 */, 18 },
+ /* 6600 */ { MAD_F(0x078e653f) /* 0.472264527 */, 18 },
+ /* 6601 */ { MAD_F(0x078ec94b) /* 0.472359936 */, 18 },
+ /* 6602 */ { MAD_F(0x078f2d57) /* 0.472455350 */, 18 },
+ /* 6603 */ { MAD_F(0x078f9165) /* 0.472550769 */, 18 },
+ /* 6604 */ { MAD_F(0x078ff574) /* 0.472646193 */, 18 },
+ /* 6605 */ { MAD_F(0x07905985) /* 0.472741622 */, 18 },
+ /* 6606 */ { MAD_F(0x0790bd96) /* 0.472837055 */, 18 },
+ /* 6607 */ { MAD_F(0x079121a9) /* 0.472932493 */, 18 },
+
+ /* 6608 */ { MAD_F(0x079185be) /* 0.473027937 */, 18 },
+ /* 6609 */ { MAD_F(0x0791e9d3) /* 0.473123384 */, 18 },
+ /* 6610 */ { MAD_F(0x07924dea) /* 0.473218837 */, 18 },
+ /* 6611 */ { MAD_F(0x0792b202) /* 0.473314295 */, 18 },
+ /* 6612 */ { MAD_F(0x0793161c) /* 0.473409757 */, 18 },
+ /* 6613 */ { MAD_F(0x07937a37) /* 0.473505224 */, 18 },
+ /* 6614 */ { MAD_F(0x0793de53) /* 0.473600696 */, 18 },
+ /* 6615 */ { MAD_F(0x07944270) /* 0.473696173 */, 18 },
+ /* 6616 */ { MAD_F(0x0794a68f) /* 0.473791655 */, 18 },
+ /* 6617 */ { MAD_F(0x07950aaf) /* 0.473887141 */, 18 },
+ /* 6618 */ { MAD_F(0x07956ed0) /* 0.473982632 */, 18 },
+ /* 6619 */ { MAD_F(0x0795d2f2) /* 0.474078128 */, 18 },
+ /* 6620 */ { MAD_F(0x07963716) /* 0.474173629 */, 18 },
+ /* 6621 */ { MAD_F(0x07969b3b) /* 0.474269135 */, 18 },
+ /* 6622 */ { MAD_F(0x0796ff62) /* 0.474364645 */, 18 },
+ /* 6623 */ { MAD_F(0x07976389) /* 0.474460161 */, 18 },
+
+ /* 6624 */ { MAD_F(0x0797c7b2) /* 0.474555681 */, 18 },
+ /* 6625 */ { MAD_F(0x07982bdd) /* 0.474651205 */, 18 },
+ /* 6626 */ { MAD_F(0x07989008) /* 0.474746735 */, 18 },
+ /* 6627 */ { MAD_F(0x0798f435) /* 0.474842270 */, 18 },
+ /* 6628 */ { MAD_F(0x07995863) /* 0.474937809 */, 18 },
+ /* 6629 */ { MAD_F(0x0799bc92) /* 0.475033353 */, 18 },
+ /* 6630 */ { MAD_F(0x079a20c3) /* 0.475128902 */, 18 },
+ /* 6631 */ { MAD_F(0x079a84f5) /* 0.475224456 */, 18 },
+ /* 6632 */ { MAD_F(0x079ae929) /* 0.475320014 */, 18 },
+ /* 6633 */ { MAD_F(0x079b4d5d) /* 0.475415578 */, 18 },
+ /* 6634 */ { MAD_F(0x079bb193) /* 0.475511146 */, 18 },
+ /* 6635 */ { MAD_F(0x079c15ca) /* 0.475606719 */, 18 },
+ /* 6636 */ { MAD_F(0x079c7a03) /* 0.475702296 */, 18 },
+ /* 6637 */ { MAD_F(0x079cde3c) /* 0.475797879 */, 18 },
+ /* 6638 */ { MAD_F(0x079d4277) /* 0.475893466 */, 18 },
+ /* 6639 */ { MAD_F(0x079da6b4) /* 0.475989058 */, 18 },
+
+ /* 6640 */ { MAD_F(0x079e0af1) /* 0.476084655 */, 18 },
+ /* 6641 */ { MAD_F(0x079e6f30) /* 0.476180257 */, 18 },
+ /* 6642 */ { MAD_F(0x079ed370) /* 0.476275863 */, 18 },
+ /* 6643 */ { MAD_F(0x079f37b2) /* 0.476371475 */, 18 },
+ /* 6644 */ { MAD_F(0x079f9bf5) /* 0.476467091 */, 18 },
+ /* 6645 */ { MAD_F(0x07a00039) /* 0.476562712 */, 18 },
+ /* 6646 */ { MAD_F(0x07a0647e) /* 0.476658338 */, 18 },
+ /* 6647 */ { MAD_F(0x07a0c8c5) /* 0.476753968 */, 18 },
+ /* 6648 */ { MAD_F(0x07a12d0c) /* 0.476849603 */, 18 },
+ /* 6649 */ { MAD_F(0x07a19156) /* 0.476945243 */, 18 },
+ /* 6650 */ { MAD_F(0x07a1f5a0) /* 0.477040888 */, 18 },
+ /* 6651 */ { MAD_F(0x07a259ec) /* 0.477136538 */, 18 },
+ /* 6652 */ { MAD_F(0x07a2be39) /* 0.477232193 */, 18 },
+ /* 6653 */ { MAD_F(0x07a32287) /* 0.477327852 */, 18 },
+ /* 6654 */ { MAD_F(0x07a386d7) /* 0.477423516 */, 18 },
+ /* 6655 */ { MAD_F(0x07a3eb28) /* 0.477519185 */, 18 },
+
+ /* 6656 */ { MAD_F(0x07a44f7a) /* 0.477614858 */, 18 },
+ /* 6657 */ { MAD_F(0x07a4b3ce) /* 0.477710537 */, 18 },
+ /* 6658 */ { MAD_F(0x07a51822) /* 0.477806220 */, 18 },
+ /* 6659 */ { MAD_F(0x07a57c78) /* 0.477901908 */, 18 },
+ /* 6660 */ { MAD_F(0x07a5e0d0) /* 0.477997601 */, 18 },
+ /* 6661 */ { MAD_F(0x07a64528) /* 0.478093299 */, 18 },
+ /* 6662 */ { MAD_F(0x07a6a982) /* 0.478189001 */, 18 },
+ /* 6663 */ { MAD_F(0x07a70ddd) /* 0.478284708 */, 18 },
+ /* 6664 */ { MAD_F(0x07a7723a) /* 0.478380420 */, 18 },
+ /* 6665 */ { MAD_F(0x07a7d698) /* 0.478476137 */, 18 },
+ /* 6666 */ { MAD_F(0x07a83af7) /* 0.478571858 */, 18 },
+ /* 6667 */ { MAD_F(0x07a89f57) /* 0.478667585 */, 18 },
+ /* 6668 */ { MAD_F(0x07a903b9) /* 0.478763316 */, 18 },
+ /* 6669 */ { MAD_F(0x07a9681c) /* 0.478859052 */, 18 },
+ /* 6670 */ { MAD_F(0x07a9cc80) /* 0.478954793 */, 18 },
+ /* 6671 */ { MAD_F(0x07aa30e5) /* 0.479050538 */, 18 },
+
+ /* 6672 */ { MAD_F(0x07aa954c) /* 0.479146288 */, 18 },
+ /* 6673 */ { MAD_F(0x07aaf9b4) /* 0.479242043 */, 18 },
+ /* 6674 */ { MAD_F(0x07ab5e1e) /* 0.479337803 */, 18 },
+ /* 6675 */ { MAD_F(0x07abc288) /* 0.479433568 */, 18 },
+ /* 6676 */ { MAD_F(0x07ac26f4) /* 0.479529337 */, 18 },
+ /* 6677 */ { MAD_F(0x07ac8b61) /* 0.479625111 */, 18 },
+ /* 6678 */ { MAD_F(0x07acefd0) /* 0.479720890 */, 18 },
+ /* 6679 */ { MAD_F(0x07ad543f) /* 0.479816674 */, 18 },
+ /* 6680 */ { MAD_F(0x07adb8b0) /* 0.479912463 */, 18 },
+ /* 6681 */ { MAD_F(0x07ae1d23) /* 0.480008256 */, 18 },
+ /* 6682 */ { MAD_F(0x07ae8196) /* 0.480104054 */, 18 },
+ /* 6683 */ { MAD_F(0x07aee60b) /* 0.480199857 */, 18 },
+ /* 6684 */ { MAD_F(0x07af4a81) /* 0.480295664 */, 18 },
+ /* 6685 */ { MAD_F(0x07afaef9) /* 0.480391477 */, 18 },
+ /* 6686 */ { MAD_F(0x07b01372) /* 0.480487294 */, 18 },
+ /* 6687 */ { MAD_F(0x07b077ec) /* 0.480583116 */, 18 },
+
+ /* 6688 */ { MAD_F(0x07b0dc67) /* 0.480678943 */, 18 },
+ /* 6689 */ { MAD_F(0x07b140e4) /* 0.480774774 */, 18 },
+ /* 6690 */ { MAD_F(0x07b1a561) /* 0.480870611 */, 18 },
+ /* 6691 */ { MAD_F(0x07b209e1) /* 0.480966452 */, 18 },
+ /* 6692 */ { MAD_F(0x07b26e61) /* 0.481062298 */, 18 },
+ /* 6693 */ { MAD_F(0x07b2d2e3) /* 0.481158148 */, 18 },
+ /* 6694 */ { MAD_F(0x07b33766) /* 0.481254004 */, 18 },
+ /* 6695 */ { MAD_F(0x07b39bea) /* 0.481349864 */, 18 },
+ /* 6696 */ { MAD_F(0x07b4006f) /* 0.481445729 */, 18 },
+ /* 6697 */ { MAD_F(0x07b464f6) /* 0.481541598 */, 18 },
+ /* 6698 */ { MAD_F(0x07b4c97e) /* 0.481637473 */, 18 },
+ /* 6699 */ { MAD_F(0x07b52e08) /* 0.481733352 */, 18 },
+ /* 6700 */ { MAD_F(0x07b59292) /* 0.481829236 */, 18 },
+ /* 6701 */ { MAD_F(0x07b5f71e) /* 0.481925125 */, 18 },
+ /* 6702 */ { MAD_F(0x07b65bac) /* 0.482021019 */, 18 },
+ /* 6703 */ { MAD_F(0x07b6c03a) /* 0.482116917 */, 18 },
+
+ /* 6704 */ { MAD_F(0x07b724ca) /* 0.482212820 */, 18 },
+ /* 6705 */ { MAD_F(0x07b7895b) /* 0.482308728 */, 18 },
+ /* 6706 */ { MAD_F(0x07b7eded) /* 0.482404640 */, 18 },
+ /* 6707 */ { MAD_F(0x07b85281) /* 0.482500558 */, 18 },
+ /* 6708 */ { MAD_F(0x07b8b716) /* 0.482596480 */, 18 },
+ /* 6709 */ { MAD_F(0x07b91bac) /* 0.482692407 */, 18 },
+ /* 6710 */ { MAD_F(0x07b98044) /* 0.482788339 */, 18 },
+ /* 6711 */ { MAD_F(0x07b9e4dc) /* 0.482884275 */, 18 },
+ /* 6712 */ { MAD_F(0x07ba4976) /* 0.482980216 */, 18 },
+ /* 6713 */ { MAD_F(0x07baae12) /* 0.483076162 */, 18 },
+ /* 6714 */ { MAD_F(0x07bb12ae) /* 0.483172113 */, 18 },
+ /* 6715 */ { MAD_F(0x07bb774c) /* 0.483268069 */, 18 },
+ /* 6716 */ { MAD_F(0x07bbdbeb) /* 0.483364029 */, 18 },
+ /* 6717 */ { MAD_F(0x07bc408c) /* 0.483459994 */, 18 },
+ /* 6718 */ { MAD_F(0x07bca52d) /* 0.483555964 */, 18 },
+ /* 6719 */ { MAD_F(0x07bd09d0) /* 0.483651939 */, 18 },
+
+ /* 6720 */ { MAD_F(0x07bd6e75) /* 0.483747918 */, 18 },
+ /* 6721 */ { MAD_F(0x07bdd31a) /* 0.483843902 */, 18 },
+ /* 6722 */ { MAD_F(0x07be37c1) /* 0.483939891 */, 18 },
+ /* 6723 */ { MAD_F(0x07be9c69) /* 0.484035885 */, 18 },
+ /* 6724 */ { MAD_F(0x07bf0113) /* 0.484131883 */, 18 },
+ /* 6725 */ { MAD_F(0x07bf65bd) /* 0.484227886 */, 18 },
+ /* 6726 */ { MAD_F(0x07bfca69) /* 0.484323894 */, 18 },
+ /* 6727 */ { MAD_F(0x07c02f16) /* 0.484419907 */, 18 },
+ /* 6728 */ { MAD_F(0x07c093c5) /* 0.484515924 */, 18 },
+ /* 6729 */ { MAD_F(0x07c0f875) /* 0.484611946 */, 18 },
+ /* 6730 */ { MAD_F(0x07c15d26) /* 0.484707973 */, 18 },
+ /* 6731 */ { MAD_F(0x07c1c1d8) /* 0.484804005 */, 18 },
+ /* 6732 */ { MAD_F(0x07c2268b) /* 0.484900041 */, 18 },
+ /* 6733 */ { MAD_F(0x07c28b40) /* 0.484996083 */, 18 },
+ /* 6734 */ { MAD_F(0x07c2eff6) /* 0.485092128 */, 18 },
+ /* 6735 */ { MAD_F(0x07c354ae) /* 0.485188179 */, 18 },
+
+ /* 6736 */ { MAD_F(0x07c3b967) /* 0.485284235 */, 18 },
+ /* 6737 */ { MAD_F(0x07c41e21) /* 0.485380295 */, 18 },
+ /* 6738 */ { MAD_F(0x07c482dc) /* 0.485476360 */, 18 },
+ /* 6739 */ { MAD_F(0x07c4e798) /* 0.485572430 */, 18 },
+ /* 6740 */ { MAD_F(0x07c54c56) /* 0.485668504 */, 18 },
+ /* 6741 */ { MAD_F(0x07c5b115) /* 0.485764583 */, 18 },
+ /* 6742 */ { MAD_F(0x07c615d6) /* 0.485860667 */, 18 },
+ /* 6743 */ { MAD_F(0x07c67a97) /* 0.485956756 */, 18 },
+ /* 6744 */ { MAD_F(0x07c6df5a) /* 0.486052849 */, 18 },
+ /* 6745 */ { MAD_F(0x07c7441e) /* 0.486148948 */, 18 },
+ /* 6746 */ { MAD_F(0x07c7a8e4) /* 0.486245051 */, 18 },
+ /* 6747 */ { MAD_F(0x07c80daa) /* 0.486341158 */, 18 },
+ /* 6748 */ { MAD_F(0x07c87272) /* 0.486437271 */, 18 },
+ /* 6749 */ { MAD_F(0x07c8d73c) /* 0.486533388 */, 18 },
+ /* 6750 */ { MAD_F(0x07c93c06) /* 0.486629510 */, 18 },
+ /* 6751 */ { MAD_F(0x07c9a0d2) /* 0.486725637 */, 18 },
+
+ /* 6752 */ { MAD_F(0x07ca059f) /* 0.486821768 */, 18 },
+ /* 6753 */ { MAD_F(0x07ca6a6d) /* 0.486917905 */, 18 },
+ /* 6754 */ { MAD_F(0x07cacf3d) /* 0.487014045 */, 18 },
+ /* 6755 */ { MAD_F(0x07cb340e) /* 0.487110191 */, 18 },
+ /* 6756 */ { MAD_F(0x07cb98e0) /* 0.487206342 */, 18 },
+ /* 6757 */ { MAD_F(0x07cbfdb4) /* 0.487302497 */, 18 },
+ /* 6758 */ { MAD_F(0x07cc6288) /* 0.487398657 */, 18 },
+ /* 6759 */ { MAD_F(0x07ccc75e) /* 0.487494821 */, 18 },
+ /* 6760 */ { MAD_F(0x07cd2c36) /* 0.487590991 */, 18 },
+ /* 6761 */ { MAD_F(0x07cd910e) /* 0.487687165 */, 18 },
+ /* 6762 */ { MAD_F(0x07cdf5e8) /* 0.487783344 */, 18 },
+ /* 6763 */ { MAD_F(0x07ce5ac3) /* 0.487879528 */, 18 },
+ /* 6764 */ { MAD_F(0x07cebfa0) /* 0.487975716 */, 18 },
+ /* 6765 */ { MAD_F(0x07cf247d) /* 0.488071909 */, 18 },
+ /* 6766 */ { MAD_F(0x07cf895c) /* 0.488168107 */, 18 },
+ /* 6767 */ { MAD_F(0x07cfee3c) /* 0.488264310 */, 18 },
+
+ /* 6768 */ { MAD_F(0x07d0531e) /* 0.488360517 */, 18 },
+ /* 6769 */ { MAD_F(0x07d0b801) /* 0.488456729 */, 18 },
+ /* 6770 */ { MAD_F(0x07d11ce5) /* 0.488552946 */, 18 },
+ /* 6771 */ { MAD_F(0x07d181ca) /* 0.488649167 */, 18 },
+ /* 6772 */ { MAD_F(0x07d1e6b0) /* 0.488745394 */, 18 },
+ /* 6773 */ { MAD_F(0x07d24b98) /* 0.488841625 */, 18 },
+ /* 6774 */ { MAD_F(0x07d2b081) /* 0.488937860 */, 18 },
+ /* 6775 */ { MAD_F(0x07d3156c) /* 0.489034101 */, 18 },
+ /* 6776 */ { MAD_F(0x07d37a57) /* 0.489130346 */, 18 },
+ /* 6777 */ { MAD_F(0x07d3df44) /* 0.489226596 */, 18 },
+ /* 6778 */ { MAD_F(0x07d44432) /* 0.489322851 */, 18 },
+ /* 6779 */ { MAD_F(0x07d4a922) /* 0.489419110 */, 18 },
+ /* 6780 */ { MAD_F(0x07d50e13) /* 0.489515375 */, 18 },
+ /* 6781 */ { MAD_F(0x07d57305) /* 0.489611643 */, 18 },
+ /* 6782 */ { MAD_F(0x07d5d7f8) /* 0.489707917 */, 18 },
+ /* 6783 */ { MAD_F(0x07d63cec) /* 0.489804195 */, 18 },
+
+ /* 6784 */ { MAD_F(0x07d6a1e2) /* 0.489900479 */, 18 },
+ /* 6785 */ { MAD_F(0x07d706d9) /* 0.489996766 */, 18 },
+ /* 6786 */ { MAD_F(0x07d76bd2) /* 0.490093059 */, 18 },
+ /* 6787 */ { MAD_F(0x07d7d0cb) /* 0.490189356 */, 18 },
+ /* 6788 */ { MAD_F(0x07d835c6) /* 0.490285658 */, 18 },
+ /* 6789 */ { MAD_F(0x07d89ac2) /* 0.490381965 */, 18 },
+ /* 6790 */ { MAD_F(0x07d8ffc0) /* 0.490478277 */, 18 },
+ /* 6791 */ { MAD_F(0x07d964be) /* 0.490574593 */, 18 },
+ /* 6792 */ { MAD_F(0x07d9c9be) /* 0.490670914 */, 18 },
+ /* 6793 */ { MAD_F(0x07da2ebf) /* 0.490767239 */, 18 },
+ /* 6794 */ { MAD_F(0x07da93c2) /* 0.490863570 */, 18 },
+ /* 6795 */ { MAD_F(0x07daf8c6) /* 0.490959905 */, 18 },
+ /* 6796 */ { MAD_F(0x07db5dcb) /* 0.491056245 */, 18 },
+ /* 6797 */ { MAD_F(0x07dbc2d1) /* 0.491152589 */, 18 },
+ /* 6798 */ { MAD_F(0x07dc27d9) /* 0.491248939 */, 18 },
+ /* 6799 */ { MAD_F(0x07dc8ce1) /* 0.491345293 */, 18 },
+
+ /* 6800 */ { MAD_F(0x07dcf1ec) /* 0.491441651 */, 18 },
+ /* 6801 */ { MAD_F(0x07dd56f7) /* 0.491538015 */, 18 },
+ /* 6802 */ { MAD_F(0x07ddbc04) /* 0.491634383 */, 18 },
+ /* 6803 */ { MAD_F(0x07de2111) /* 0.491730756 */, 18 },
+ /* 6804 */ { MAD_F(0x07de8621) /* 0.491827134 */, 18 },
+ /* 6805 */ { MAD_F(0x07deeb31) /* 0.491923516 */, 18 },
+ /* 6806 */ { MAD_F(0x07df5043) /* 0.492019903 */, 18 },
+ /* 6807 */ { MAD_F(0x07dfb556) /* 0.492116295 */, 18 },
+ /* 6808 */ { MAD_F(0x07e01a6a) /* 0.492212691 */, 18 },
+ /* 6809 */ { MAD_F(0x07e07f80) /* 0.492309093 */, 18 },
+ /* 6810 */ { MAD_F(0x07e0e496) /* 0.492405499 */, 18 },
+ /* 6811 */ { MAD_F(0x07e149ae) /* 0.492501909 */, 18 },
+ /* 6812 */ { MAD_F(0x07e1aec8) /* 0.492598325 */, 18 },
+ /* 6813 */ { MAD_F(0x07e213e2) /* 0.492694745 */, 18 },
+ /* 6814 */ { MAD_F(0x07e278fe) /* 0.492791170 */, 18 },
+ /* 6815 */ { MAD_F(0x07e2de1b) /* 0.492887599 */, 18 },
+
+ /* 6816 */ { MAD_F(0x07e3433a) /* 0.492984033 */, 18 },
+ /* 6817 */ { MAD_F(0x07e3a859) /* 0.493080472 */, 18 },
+ /* 6818 */ { MAD_F(0x07e40d7a) /* 0.493176916 */, 18 },
+ /* 6819 */ { MAD_F(0x07e4729c) /* 0.493273365 */, 18 },
+ /* 6820 */ { MAD_F(0x07e4d7c0) /* 0.493369818 */, 18 },
+ /* 6821 */ { MAD_F(0x07e53ce4) /* 0.493466275 */, 18 },
+ /* 6822 */ { MAD_F(0x07e5a20a) /* 0.493562738 */, 18 },
+ /* 6823 */ { MAD_F(0x07e60732) /* 0.493659205 */, 18 },
+ /* 6824 */ { MAD_F(0x07e66c5a) /* 0.493755677 */, 18 },
+ /* 6825 */ { MAD_F(0x07e6d184) /* 0.493852154 */, 18 },
+ /* 6826 */ { MAD_F(0x07e736af) /* 0.493948635 */, 18 },
+ /* 6827 */ { MAD_F(0x07e79bdb) /* 0.494045122 */, 18 },
+ /* 6828 */ { MAD_F(0x07e80109) /* 0.494141612 */, 18 },
+ /* 6829 */ { MAD_F(0x07e86638) /* 0.494238108 */, 18 },
+ /* 6830 */ { MAD_F(0x07e8cb68) /* 0.494334608 */, 18 },
+ /* 6831 */ { MAD_F(0x07e93099) /* 0.494431113 */, 18 },
+
+ /* 6832 */ { MAD_F(0x07e995cc) /* 0.494527623 */, 18 },
+ /* 6833 */ { MAD_F(0x07e9fb00) /* 0.494624137 */, 18 },
+ /* 6834 */ { MAD_F(0x07ea6035) /* 0.494720656 */, 18 },
+ /* 6835 */ { MAD_F(0x07eac56b) /* 0.494817180 */, 18 },
+ /* 6836 */ { MAD_F(0x07eb2aa3) /* 0.494913709 */, 18 },
+ /* 6837 */ { MAD_F(0x07eb8fdc) /* 0.495010242 */, 18 },
+ /* 6838 */ { MAD_F(0x07ebf516) /* 0.495106780 */, 18 },
+ /* 6839 */ { MAD_F(0x07ec5a51) /* 0.495203322 */, 18 },
+ /* 6840 */ { MAD_F(0x07ecbf8e) /* 0.495299870 */, 18 },
+ /* 6841 */ { MAD_F(0x07ed24cc) /* 0.495396422 */, 18 },
+ /* 6842 */ { MAD_F(0x07ed8a0b) /* 0.495492978 */, 18 },
+ /* 6843 */ { MAD_F(0x07edef4c) /* 0.495589540 */, 18 },
+ /* 6844 */ { MAD_F(0x07ee548e) /* 0.495686106 */, 18 },
+ /* 6845 */ { MAD_F(0x07eeb9d1) /* 0.495782677 */, 18 },
+ /* 6846 */ { MAD_F(0x07ef1f15) /* 0.495879252 */, 18 },
+ /* 6847 */ { MAD_F(0x07ef845b) /* 0.495975833 */, 18 },
+
+ /* 6848 */ { MAD_F(0x07efe9a1) /* 0.496072418 */, 18 },
+ /* 6849 */ { MAD_F(0x07f04ee9) /* 0.496169007 */, 18 },
+ /* 6850 */ { MAD_F(0x07f0b433) /* 0.496265602 */, 18 },
+ /* 6851 */ { MAD_F(0x07f1197d) /* 0.496362201 */, 18 },
+ /* 6852 */ { MAD_F(0x07f17ec9) /* 0.496458804 */, 18 },
+ /* 6853 */ { MAD_F(0x07f1e416) /* 0.496555413 */, 18 },
+ /* 6854 */ { MAD_F(0x07f24965) /* 0.496652026 */, 18 },
+ /* 6855 */ { MAD_F(0x07f2aeb5) /* 0.496748644 */, 18 },
+ /* 6856 */ { MAD_F(0x07f31405) /* 0.496845266 */, 18 },
+ /* 6857 */ { MAD_F(0x07f37958) /* 0.496941894 */, 18 },
+ /* 6858 */ { MAD_F(0x07f3deab) /* 0.497038526 */, 18 },
+ /* 6859 */ { MAD_F(0x07f44400) /* 0.497135162 */, 18 },
+ /* 6860 */ { MAD_F(0x07f4a956) /* 0.497231804 */, 18 },
+ /* 6861 */ { MAD_F(0x07f50ead) /* 0.497328450 */, 18 },
+ /* 6862 */ { MAD_F(0x07f57405) /* 0.497425100 */, 18 },
+ /* 6863 */ { MAD_F(0x07f5d95f) /* 0.497521756 */, 18 },
+
+ /* 6864 */ { MAD_F(0x07f63eba) /* 0.497618416 */, 18 },
+ /* 6865 */ { MAD_F(0x07f6a416) /* 0.497715081 */, 18 },
+ /* 6866 */ { MAD_F(0x07f70974) /* 0.497811750 */, 18 },
+ /* 6867 */ { MAD_F(0x07f76ed3) /* 0.497908425 */, 18 },
+ /* 6868 */ { MAD_F(0x07f7d433) /* 0.498005103 */, 18 },
+ /* 6869 */ { MAD_F(0x07f83994) /* 0.498101787 */, 18 },
+ /* 6870 */ { MAD_F(0x07f89ef7) /* 0.498198475 */, 18 },
+ /* 6871 */ { MAD_F(0x07f9045a) /* 0.498295168 */, 18 },
+ /* 6872 */ { MAD_F(0x07f969c0) /* 0.498391866 */, 18 },
+ /* 6873 */ { MAD_F(0x07f9cf26) /* 0.498488568 */, 18 },
+ /* 6874 */ { MAD_F(0x07fa348e) /* 0.498585275 */, 18 },
+ /* 6875 */ { MAD_F(0x07fa99f6) /* 0.498681987 */, 18 },
+ /* 6876 */ { MAD_F(0x07faff60) /* 0.498778704 */, 18 },
+ /* 6877 */ { MAD_F(0x07fb64cc) /* 0.498875425 */, 18 },
+ /* 6878 */ { MAD_F(0x07fbca38) /* 0.498972150 */, 18 },
+ /* 6879 */ { MAD_F(0x07fc2fa6) /* 0.499068881 */, 18 },
+
+ /* 6880 */ { MAD_F(0x07fc9516) /* 0.499165616 */, 18 },
+ /* 6881 */ { MAD_F(0x07fcfa86) /* 0.499262356 */, 18 },
+ /* 6882 */ { MAD_F(0x07fd5ff8) /* 0.499359101 */, 18 },
+ /* 6883 */ { MAD_F(0x07fdc56b) /* 0.499455850 */, 18 },
+ /* 6884 */ { MAD_F(0x07fe2adf) /* 0.499552604 */, 18 },
+ /* 6885 */ { MAD_F(0x07fe9054) /* 0.499649362 */, 18 },
+ /* 6886 */ { MAD_F(0x07fef5cb) /* 0.499746126 */, 18 },
+ /* 6887 */ { MAD_F(0x07ff5b43) /* 0.499842894 */, 18 },
+ /* 6888 */ { MAD_F(0x07ffc0bc) /* 0.499939666 */, 18 },
+ /* 6889 */ { MAD_F(0x0400131b) /* 0.250018222 */, 19 },
+ /* 6890 */ { MAD_F(0x040045d9) /* 0.250066613 */, 19 },
+ /* 6891 */ { MAD_F(0x04007897) /* 0.250115006 */, 19 },
+ /* 6892 */ { MAD_F(0x0400ab57) /* 0.250163402 */, 19 },
+ /* 6893 */ { MAD_F(0x0400de16) /* 0.250211800 */, 19 },
+ /* 6894 */ { MAD_F(0x040110d7) /* 0.250260200 */, 19 },
+ /* 6895 */ { MAD_F(0x04014398) /* 0.250308603 */, 19 },
+
+ /* 6896 */ { MAD_F(0x04017659) /* 0.250357008 */, 19 },
+ /* 6897 */ { MAD_F(0x0401a91c) /* 0.250405415 */, 19 },
+ /* 6898 */ { MAD_F(0x0401dbdf) /* 0.250453825 */, 19 },
+ /* 6899 */ { MAD_F(0x04020ea2) /* 0.250502237 */, 19 },
+ /* 6900 */ { MAD_F(0x04024166) /* 0.250550652 */, 19 },
+ /* 6901 */ { MAD_F(0x0402742b) /* 0.250599068 */, 19 },
+ /* 6902 */ { MAD_F(0x0402a6f0) /* 0.250647488 */, 19 },
+ /* 6903 */ { MAD_F(0x0402d9b6) /* 0.250695909 */, 19 },
+ /* 6904 */ { MAD_F(0x04030c7d) /* 0.250744333 */, 19 },
+ /* 6905 */ { MAD_F(0x04033f44) /* 0.250792759 */, 19 },
+ /* 6906 */ { MAD_F(0x0403720c) /* 0.250841187 */, 19 },
+ /* 6907 */ { MAD_F(0x0403a4d5) /* 0.250889618 */, 19 },
+ /* 6908 */ { MAD_F(0x0403d79e) /* 0.250938051 */, 19 },
+ /* 6909 */ { MAD_F(0x04040a68) /* 0.250986487 */, 19 },
+ /* 6910 */ { MAD_F(0x04043d32) /* 0.251034924 */, 19 },
+ /* 6911 */ { MAD_F(0x04046ffd) /* 0.251083365 */, 19 },
+
+ /* 6912 */ { MAD_F(0x0404a2c9) /* 0.251131807 */, 19 },
+ /* 6913 */ { MAD_F(0x0404d595) /* 0.251180252 */, 19 },
+ /* 6914 */ { MAD_F(0x04050862) /* 0.251228699 */, 19 },
+ /* 6915 */ { MAD_F(0x04053b30) /* 0.251277148 */, 19 },
+ /* 6916 */ { MAD_F(0x04056dfe) /* 0.251325600 */, 19 },
+ /* 6917 */ { MAD_F(0x0405a0cd) /* 0.251374054 */, 19 },
+ /* 6918 */ { MAD_F(0x0405d39c) /* 0.251422511 */, 19 },
+ /* 6919 */ { MAD_F(0x0406066c) /* 0.251470970 */, 19 },
+ /* 6920 */ { MAD_F(0x0406393d) /* 0.251519431 */, 19 },
+ /* 6921 */ { MAD_F(0x04066c0e) /* 0.251567894 */, 19 },
+ /* 6922 */ { MAD_F(0x04069ee0) /* 0.251616360 */, 19 },
+ /* 6923 */ { MAD_F(0x0406d1b3) /* 0.251664828 */, 19 },
+ /* 6924 */ { MAD_F(0x04070486) /* 0.251713299 */, 19 },
+ /* 6925 */ { MAD_F(0x0407375a) /* 0.251761772 */, 19 },
+ /* 6926 */ { MAD_F(0x04076a2e) /* 0.251810247 */, 19 },
+ /* 6927 */ { MAD_F(0x04079d03) /* 0.251858724 */, 19 },
+
+ /* 6928 */ { MAD_F(0x0407cfd9) /* 0.251907204 */, 19 },
+ /* 6929 */ { MAD_F(0x040802af) /* 0.251955686 */, 19 },
+ /* 6930 */ { MAD_F(0x04083586) /* 0.252004171 */, 19 },
+ /* 6931 */ { MAD_F(0x0408685e) /* 0.252052658 */, 19 },
+ /* 6932 */ { MAD_F(0x04089b36) /* 0.252101147 */, 19 },
+ /* 6933 */ { MAD_F(0x0408ce0f) /* 0.252149638 */, 19 },
+ /* 6934 */ { MAD_F(0x040900e8) /* 0.252198132 */, 19 },
+ /* 6935 */ { MAD_F(0x040933c2) /* 0.252246628 */, 19 },
+ /* 6936 */ { MAD_F(0x0409669d) /* 0.252295127 */, 19 },
+ /* 6937 */ { MAD_F(0x04099978) /* 0.252343627 */, 19 },
+ /* 6938 */ { MAD_F(0x0409cc54) /* 0.252392131 */, 19 },
+ /* 6939 */ { MAD_F(0x0409ff31) /* 0.252440636 */, 19 },
+ /* 6940 */ { MAD_F(0x040a320e) /* 0.252489144 */, 19 },
+ /* 6941 */ { MAD_F(0x040a64ec) /* 0.252537654 */, 19 },
+ /* 6942 */ { MAD_F(0x040a97cb) /* 0.252586166 */, 19 },
+ /* 6943 */ { MAD_F(0x040acaaa) /* 0.252634681 */, 19 },
+
+ /* 6944 */ { MAD_F(0x040afd89) /* 0.252683198 */, 19 },
+ /* 6945 */ { MAD_F(0x040b306a) /* 0.252731718 */, 19 },
+ /* 6946 */ { MAD_F(0x040b634b) /* 0.252780240 */, 19 },
+ /* 6947 */ { MAD_F(0x040b962c) /* 0.252828764 */, 19 },
+ /* 6948 */ { MAD_F(0x040bc90e) /* 0.252877290 */, 19 },
+ /* 6949 */ { MAD_F(0x040bfbf1) /* 0.252925819 */, 19 },
+ /* 6950 */ { MAD_F(0x040c2ed5) /* 0.252974350 */, 19 },
+ /* 6951 */ { MAD_F(0x040c61b9) /* 0.253022883 */, 19 },
+ /* 6952 */ { MAD_F(0x040c949e) /* 0.253071419 */, 19 },
+ /* 6953 */ { MAD_F(0x040cc783) /* 0.253119957 */, 19 },
+ /* 6954 */ { MAD_F(0x040cfa69) /* 0.253168498 */, 19 },
+ /* 6955 */ { MAD_F(0x040d2d4f) /* 0.253217040 */, 19 },
+ /* 6956 */ { MAD_F(0x040d6037) /* 0.253265585 */, 19 },
+ /* 6957 */ { MAD_F(0x040d931e) /* 0.253314133 */, 19 },
+ /* 6958 */ { MAD_F(0x040dc607) /* 0.253362682 */, 19 },
+ /* 6959 */ { MAD_F(0x040df8f0) /* 0.253411234 */, 19 },
+
+ /* 6960 */ { MAD_F(0x040e2bda) /* 0.253459789 */, 19 },
+ /* 6961 */ { MAD_F(0x040e5ec4) /* 0.253508345 */, 19 },
+ /* 6962 */ { MAD_F(0x040e91af) /* 0.253556904 */, 19 },
+ /* 6963 */ { MAD_F(0x040ec49b) /* 0.253605466 */, 19 },
+ /* 6964 */ { MAD_F(0x040ef787) /* 0.253654029 */, 19 },
+ /* 6965 */ { MAD_F(0x040f2a74) /* 0.253702595 */, 19 },
+ /* 6966 */ { MAD_F(0x040f5d61) /* 0.253751164 */, 19 },
+ /* 6967 */ { MAD_F(0x040f904f) /* 0.253799734 */, 19 },
+ /* 6968 */ { MAD_F(0x040fc33e) /* 0.253848307 */, 19 },
+ /* 6969 */ { MAD_F(0x040ff62d) /* 0.253896883 */, 19 },
+ /* 6970 */ { MAD_F(0x0410291d) /* 0.253945460 */, 19 },
+ /* 6971 */ { MAD_F(0x04105c0e) /* 0.253994040 */, 19 },
+ /* 6972 */ { MAD_F(0x04108eff) /* 0.254042622 */, 19 },
+ /* 6973 */ { MAD_F(0x0410c1f1) /* 0.254091207 */, 19 },
+ /* 6974 */ { MAD_F(0x0410f4e3) /* 0.254139794 */, 19 },
+ /* 6975 */ { MAD_F(0x041127d6) /* 0.254188383 */, 19 },
+
+ /* 6976 */ { MAD_F(0x04115aca) /* 0.254236974 */, 19 },
+ /* 6977 */ { MAD_F(0x04118dbe) /* 0.254285568 */, 19 },
+ /* 6978 */ { MAD_F(0x0411c0b3) /* 0.254334165 */, 19 },
+ /* 6979 */ { MAD_F(0x0411f3a9) /* 0.254382763 */, 19 },
+ /* 6980 */ { MAD_F(0x0412269f) /* 0.254431364 */, 19 },
+ /* 6981 */ { MAD_F(0x04125996) /* 0.254479967 */, 19 },
+ /* 6982 */ { MAD_F(0x04128c8d) /* 0.254528572 */, 19 },
+ /* 6983 */ { MAD_F(0x0412bf85) /* 0.254577180 */, 19 },
+ /* 6984 */ { MAD_F(0x0412f27e) /* 0.254625790 */, 19 },
+ /* 6985 */ { MAD_F(0x04132577) /* 0.254674403 */, 19 },
+ /* 6986 */ { MAD_F(0x04135871) /* 0.254723017 */, 19 },
+ /* 6987 */ { MAD_F(0x04138b6c) /* 0.254771635 */, 19 },
+ /* 6988 */ { MAD_F(0x0413be67) /* 0.254820254 */, 19 },
+ /* 6989 */ { MAD_F(0x0413f163) /* 0.254868876 */, 19 },
+ /* 6990 */ { MAD_F(0x0414245f) /* 0.254917500 */, 19 },
+ /* 6991 */ { MAD_F(0x0414575c) /* 0.254966126 */, 19 },
+
+ /* 6992 */ { MAD_F(0x04148a5a) /* 0.255014755 */, 19 },
+ /* 6993 */ { MAD_F(0x0414bd58) /* 0.255063386 */, 19 },
+ /* 6994 */ { MAD_F(0x0414f057) /* 0.255112019 */, 19 },
+ /* 6995 */ { MAD_F(0x04152356) /* 0.255160655 */, 19 },
+ /* 6996 */ { MAD_F(0x04155657) /* 0.255209292 */, 19 },
+ /* 6997 */ { MAD_F(0x04158957) /* 0.255257933 */, 19 },
+ /* 6998 */ { MAD_F(0x0415bc59) /* 0.255306575 */, 19 },
+ /* 6999 */ { MAD_F(0x0415ef5b) /* 0.255355220 */, 19 },
+ /* 7000 */ { MAD_F(0x0416225d) /* 0.255403867 */, 19 },
+ /* 7001 */ { MAD_F(0x04165561) /* 0.255452517 */, 19 },
+ /* 7002 */ { MAD_F(0x04168864) /* 0.255501169 */, 19 },
+ /* 7003 */ { MAD_F(0x0416bb69) /* 0.255549823 */, 19 },
+ /* 7004 */ { MAD_F(0x0416ee6e) /* 0.255598479 */, 19 },
+ /* 7005 */ { MAD_F(0x04172174) /* 0.255647138 */, 19 },
+ /* 7006 */ { MAD_F(0x0417547a) /* 0.255695799 */, 19 },
+ /* 7007 */ { MAD_F(0x04178781) /* 0.255744463 */, 19 },
+
+ /* 7008 */ { MAD_F(0x0417ba89) /* 0.255793128 */, 19 },
+ /* 7009 */ { MAD_F(0x0417ed91) /* 0.255841796 */, 19 },
+ /* 7010 */ { MAD_F(0x0418209a) /* 0.255890467 */, 19 },
+ /* 7011 */ { MAD_F(0x041853a3) /* 0.255939139 */, 19 },
+ /* 7012 */ { MAD_F(0x041886ad) /* 0.255987814 */, 19 },
+ /* 7013 */ { MAD_F(0x0418b9b8) /* 0.256036492 */, 19 },
+ /* 7014 */ { MAD_F(0x0418ecc3) /* 0.256085171 */, 19 },
+ /* 7015 */ { MAD_F(0x04191fcf) /* 0.256133853 */, 19 },
+ /* 7016 */ { MAD_F(0x041952dc) /* 0.256182537 */, 19 },
+ /* 7017 */ { MAD_F(0x041985e9) /* 0.256231224 */, 19 },
+ /* 7018 */ { MAD_F(0x0419b8f7) /* 0.256279913 */, 19 },
+ /* 7019 */ { MAD_F(0x0419ec05) /* 0.256328604 */, 19 },
+ /* 7020 */ { MAD_F(0x041a1f15) /* 0.256377297 */, 19 },
+ /* 7021 */ { MAD_F(0x041a5224) /* 0.256425993 */, 19 },
+ /* 7022 */ { MAD_F(0x041a8534) /* 0.256474691 */, 19 },
+ /* 7023 */ { MAD_F(0x041ab845) /* 0.256523392 */, 19 },
+
+ /* 7024 */ { MAD_F(0x041aeb57) /* 0.256572095 */, 19 },
+ /* 7025 */ { MAD_F(0x041b1e69) /* 0.256620800 */, 19 },
+ /* 7026 */ { MAD_F(0x041b517c) /* 0.256669507 */, 19 },
+ /* 7027 */ { MAD_F(0x041b848f) /* 0.256718217 */, 19 },
+ /* 7028 */ { MAD_F(0x041bb7a3) /* 0.256766929 */, 19 },
+ /* 7029 */ { MAD_F(0x041beab8) /* 0.256815643 */, 19 },
+ /* 7030 */ { MAD_F(0x041c1dcd) /* 0.256864359 */, 19 },
+ /* 7031 */ { MAD_F(0x041c50e3) /* 0.256913078 */, 19 },
+ /* 7032 */ { MAD_F(0x041c83fa) /* 0.256961800 */, 19 },
+ /* 7033 */ { MAD_F(0x041cb711) /* 0.257010523 */, 19 },
+ /* 7034 */ { MAD_F(0x041cea28) /* 0.257059249 */, 19 },
+ /* 7035 */ { MAD_F(0x041d1d41) /* 0.257107977 */, 19 },
+ /* 7036 */ { MAD_F(0x041d505a) /* 0.257156708 */, 19 },
+ /* 7037 */ { MAD_F(0x041d8373) /* 0.257205440 */, 19 },
+ /* 7038 */ { MAD_F(0x041db68e) /* 0.257254175 */, 19 },
+ /* 7039 */ { MAD_F(0x041de9a8) /* 0.257302913 */, 19 },
+
+ /* 7040 */ { MAD_F(0x041e1cc4) /* 0.257351652 */, 19 },
+ /* 7041 */ { MAD_F(0x041e4fe0) /* 0.257400394 */, 19 },
+ /* 7042 */ { MAD_F(0x041e82fd) /* 0.257449139 */, 19 },
+ /* 7043 */ { MAD_F(0x041eb61a) /* 0.257497885 */, 19 },
+ /* 7044 */ { MAD_F(0x041ee938) /* 0.257546634 */, 19 },
+ /* 7045 */ { MAD_F(0x041f1c57) /* 0.257595386 */, 19 },
+ /* 7046 */ { MAD_F(0x041f4f76) /* 0.257644139 */, 19 },
+ /* 7047 */ { MAD_F(0x041f8296) /* 0.257692895 */, 19 },
+ /* 7048 */ { MAD_F(0x041fb5b6) /* 0.257741653 */, 19 },
+ /* 7049 */ { MAD_F(0x041fe8d7) /* 0.257790414 */, 19 },
+ /* 7050 */ { MAD_F(0x04201bf9) /* 0.257839176 */, 19 },
+ /* 7051 */ { MAD_F(0x04204f1b) /* 0.257887941 */, 19 },
+ /* 7052 */ { MAD_F(0x0420823e) /* 0.257936709 */, 19 },
+ /* 7053 */ { MAD_F(0x0420b561) /* 0.257985478 */, 19 },
+ /* 7054 */ { MAD_F(0x0420e885) /* 0.258034250 */, 19 },
+ /* 7055 */ { MAD_F(0x04211baa) /* 0.258083025 */, 19 },
+
+ /* 7056 */ { MAD_F(0x04214ed0) /* 0.258131801 */, 19 },
+ /* 7057 */ { MAD_F(0x042181f6) /* 0.258180580 */, 19 },
+ /* 7058 */ { MAD_F(0x0421b51c) /* 0.258229361 */, 19 },
+ /* 7059 */ { MAD_F(0x0421e843) /* 0.258278145 */, 19 },
+ /* 7060 */ { MAD_F(0x04221b6b) /* 0.258326931 */, 19 },
+ /* 7061 */ { MAD_F(0x04224e94) /* 0.258375719 */, 19 },
+ /* 7062 */ { MAD_F(0x042281bd) /* 0.258424509 */, 19 },
+ /* 7063 */ { MAD_F(0x0422b4e6) /* 0.258473302 */, 19 },
+ /* 7064 */ { MAD_F(0x0422e811) /* 0.258522097 */, 19 },
+ /* 7065 */ { MAD_F(0x04231b3c) /* 0.258570894 */, 19 },
+ /* 7066 */ { MAD_F(0x04234e67) /* 0.258619694 */, 19 },
+ /* 7067 */ { MAD_F(0x04238193) /* 0.258668496 */, 19 },
+ /* 7068 */ { MAD_F(0x0423b4c0) /* 0.258717300 */, 19 },
+ /* 7069 */ { MAD_F(0x0423e7ee) /* 0.258766106 */, 19 },
+ /* 7070 */ { MAD_F(0x04241b1c) /* 0.258814915 */, 19 },
+ /* 7071 */ { MAD_F(0x04244e4a) /* 0.258863726 */, 19 },
+
+ /* 7072 */ { MAD_F(0x04248179) /* 0.258912540 */, 19 },
+ /* 7073 */ { MAD_F(0x0424b4a9) /* 0.258961356 */, 19 },
+ /* 7074 */ { MAD_F(0x0424e7da) /* 0.259010174 */, 19 },
+ /* 7075 */ { MAD_F(0x04251b0b) /* 0.259058994 */, 19 },
+ /* 7076 */ { MAD_F(0x04254e3d) /* 0.259107817 */, 19 },
+ /* 7077 */ { MAD_F(0x0425816f) /* 0.259156642 */, 19 },
+ /* 7078 */ { MAD_F(0x0425b4a2) /* 0.259205469 */, 19 },
+ /* 7079 */ { MAD_F(0x0425e7d6) /* 0.259254298 */, 19 },
+ /* 7080 */ { MAD_F(0x04261b0a) /* 0.259303130 */, 19 },
+ /* 7081 */ { MAD_F(0x04264e3f) /* 0.259351964 */, 19 },
+ /* 7082 */ { MAD_F(0x04268174) /* 0.259400801 */, 19 },
+ /* 7083 */ { MAD_F(0x0426b4aa) /* 0.259449639 */, 19 },
+ /* 7084 */ { MAD_F(0x0426e7e1) /* 0.259498480 */, 19 },
+ /* 7085 */ { MAD_F(0x04271b18) /* 0.259547324 */, 19 },
+ /* 7086 */ { MAD_F(0x04274e50) /* 0.259596169 */, 19 },
+ /* 7087 */ { MAD_F(0x04278188) /* 0.259645017 */, 19 },
+
+ /* 7088 */ { MAD_F(0x0427b4c2) /* 0.259693868 */, 19 },
+ /* 7089 */ { MAD_F(0x0427e7fb) /* 0.259742720 */, 19 },
+ /* 7090 */ { MAD_F(0x04281b36) /* 0.259791575 */, 19 },
+ /* 7091 */ { MAD_F(0x04284e71) /* 0.259840432 */, 19 },
+ /* 7092 */ { MAD_F(0x042881ac) /* 0.259889291 */, 19 },
+ /* 7093 */ { MAD_F(0x0428b4e8) /* 0.259938153 */, 19 },
+ /* 7094 */ { MAD_F(0x0428e825) /* 0.259987017 */, 19 },
+ /* 7095 */ { MAD_F(0x04291b63) /* 0.260035883 */, 19 },
+ /* 7096 */ { MAD_F(0x04294ea1) /* 0.260084752 */, 19 },
+ /* 7097 */ { MAD_F(0x042981df) /* 0.260133623 */, 19 },
+ /* 7098 */ { MAD_F(0x0429b51f) /* 0.260182496 */, 19 },
+ /* 7099 */ { MAD_F(0x0429e85f) /* 0.260231372 */, 19 },
+ /* 7100 */ { MAD_F(0x042a1b9f) /* 0.260280249 */, 19 },
+ /* 7101 */ { MAD_F(0x042a4ee0) /* 0.260329129 */, 19 },
+ /* 7102 */ { MAD_F(0x042a8222) /* 0.260378012 */, 19 },
+ /* 7103 */ { MAD_F(0x042ab564) /* 0.260426896 */, 19 },
+
+ /* 7104 */ { MAD_F(0x042ae8a7) /* 0.260475783 */, 19 },
+ /* 7105 */ { MAD_F(0x042b1beb) /* 0.260524673 */, 19 },
+ /* 7106 */ { MAD_F(0x042b4f2f) /* 0.260573564 */, 19 },
+ /* 7107 */ { MAD_F(0x042b8274) /* 0.260622458 */, 19 },
+ /* 7108 */ { MAD_F(0x042bb5ba) /* 0.260671354 */, 19 },
+ /* 7109 */ { MAD_F(0x042be900) /* 0.260720252 */, 19 },
+ /* 7110 */ { MAD_F(0x042c1c46) /* 0.260769153 */, 19 },
+ /* 7111 */ { MAD_F(0x042c4f8e) /* 0.260818056 */, 19 },
+ /* 7112 */ { MAD_F(0x042c82d6) /* 0.260866961 */, 19 },
+ /* 7113 */ { MAD_F(0x042cb61e) /* 0.260915869 */, 19 },
+ /* 7114 */ { MAD_F(0x042ce967) /* 0.260964779 */, 19 },
+ /* 7115 */ { MAD_F(0x042d1cb1) /* 0.261013691 */, 19 },
+ /* 7116 */ { MAD_F(0x042d4ffb) /* 0.261062606 */, 19 },
+ /* 7117 */ { MAD_F(0x042d8346) /* 0.261111522 */, 19 },
+ /* 7118 */ { MAD_F(0x042db692) /* 0.261160441 */, 19 },
+ /* 7119 */ { MAD_F(0x042de9de) /* 0.261209363 */, 19 },
+
+ /* 7120 */ { MAD_F(0x042e1d2b) /* 0.261258286 */, 19 },
+ /* 7121 */ { MAD_F(0x042e5078) /* 0.261307212 */, 19 },
+ /* 7122 */ { MAD_F(0x042e83c6) /* 0.261356140 */, 19 },
+ /* 7123 */ { MAD_F(0x042eb715) /* 0.261405071 */, 19 },
+ /* 7124 */ { MAD_F(0x042eea64) /* 0.261454004 */, 19 },
+ /* 7125 */ { MAD_F(0x042f1db4) /* 0.261502939 */, 19 },
+ /* 7126 */ { MAD_F(0x042f5105) /* 0.261551876 */, 19 },
+ /* 7127 */ { MAD_F(0x042f8456) /* 0.261600816 */, 19 },
+ /* 7128 */ { MAD_F(0x042fb7a8) /* 0.261649758 */, 19 },
+ /* 7129 */ { MAD_F(0x042feafa) /* 0.261698702 */, 19 },
+ /* 7130 */ { MAD_F(0x04301e4d) /* 0.261747649 */, 19 },
+ /* 7131 */ { MAD_F(0x043051a1) /* 0.261796597 */, 19 },
+ /* 7132 */ { MAD_F(0x043084f5) /* 0.261845548 */, 19 },
+ /* 7133 */ { MAD_F(0x0430b84a) /* 0.261894502 */, 19 },
+ /* 7134 */ { MAD_F(0x0430eb9f) /* 0.261943458 */, 19 },
+ /* 7135 */ { MAD_F(0x04311ef5) /* 0.261992416 */, 19 },
+
+ /* 7136 */ { MAD_F(0x0431524c) /* 0.262041376 */, 19 },
+ /* 7137 */ { MAD_F(0x043185a3) /* 0.262090338 */, 19 },
+ /* 7138 */ { MAD_F(0x0431b8fb) /* 0.262139303 */, 19 },
+ /* 7139 */ { MAD_F(0x0431ec54) /* 0.262188270 */, 19 },
+ /* 7140 */ { MAD_F(0x04321fad) /* 0.262237240 */, 19 },
+ /* 7141 */ { MAD_F(0x04325306) /* 0.262286211 */, 19 },
+ /* 7142 */ { MAD_F(0x04328661) /* 0.262335185 */, 19 },
+ /* 7143 */ { MAD_F(0x0432b9bc) /* 0.262384162 */, 19 },
+ /* 7144 */ { MAD_F(0x0432ed17) /* 0.262433140 */, 19 },
+ /* 7145 */ { MAD_F(0x04332074) /* 0.262482121 */, 19 },
+ /* 7146 */ { MAD_F(0x043353d0) /* 0.262531104 */, 19 },
+ /* 7147 */ { MAD_F(0x0433872e) /* 0.262580089 */, 19 },
+ /* 7148 */ { MAD_F(0x0433ba8c) /* 0.262629077 */, 19 },
+ /* 7149 */ { MAD_F(0x0433edea) /* 0.262678067 */, 19 },
+ /* 7150 */ { MAD_F(0x0434214a) /* 0.262727059 */, 19 },
+ /* 7151 */ { MAD_F(0x043454aa) /* 0.262776054 */, 19 },
+
+ /* 7152 */ { MAD_F(0x0434880a) /* 0.262825051 */, 19 },
+ /* 7153 */ { MAD_F(0x0434bb6b) /* 0.262874050 */, 19 },
+ /* 7154 */ { MAD_F(0x0434eecd) /* 0.262923051 */, 19 },
+ /* 7155 */ { MAD_F(0x0435222f) /* 0.262972055 */, 19 },
+ /* 7156 */ { MAD_F(0x04355592) /* 0.263021061 */, 19 },
+ /* 7157 */ { MAD_F(0x043588f6) /* 0.263070069 */, 19 },
+ /* 7158 */ { MAD_F(0x0435bc5a) /* 0.263119079 */, 19 },
+ /* 7159 */ { MAD_F(0x0435efbf) /* 0.263168092 */, 19 },
+ /* 7160 */ { MAD_F(0x04362324) /* 0.263217107 */, 19 },
+ /* 7161 */ { MAD_F(0x0436568a) /* 0.263266125 */, 19 },
+ /* 7162 */ { MAD_F(0x043689f1) /* 0.263315144 */, 19 },
+ /* 7163 */ { MAD_F(0x0436bd58) /* 0.263364166 */, 19 },
+ /* 7164 */ { MAD_F(0x0436f0c0) /* 0.263413191 */, 19 },
+ /* 7165 */ { MAD_F(0x04372428) /* 0.263462217 */, 19 },
+ /* 7166 */ { MAD_F(0x04375791) /* 0.263511246 */, 19 },
+ /* 7167 */ { MAD_F(0x04378afb) /* 0.263560277 */, 19 },
+
+ /* 7168 */ { MAD_F(0x0437be65) /* 0.263609310 */, 19 },
+ /* 7169 */ { MAD_F(0x0437f1d0) /* 0.263658346 */, 19 },
+ /* 7170 */ { MAD_F(0x0438253c) /* 0.263707384 */, 19 },
+ /* 7171 */ { MAD_F(0x043858a8) /* 0.263756424 */, 19 },
+ /* 7172 */ { MAD_F(0x04388c14) /* 0.263805466 */, 19 },
+ /* 7173 */ { MAD_F(0x0438bf82) /* 0.263854511 */, 19 },
+ /* 7174 */ { MAD_F(0x0438f2f0) /* 0.263903558 */, 19 },
+ /* 7175 */ { MAD_F(0x0439265e) /* 0.263952607 */, 19 },
+ /* 7176 */ { MAD_F(0x043959cd) /* 0.264001659 */, 19 },
+ /* 7177 */ { MAD_F(0x04398d3d) /* 0.264050713 */, 19 },
+ /* 7178 */ { MAD_F(0x0439c0ae) /* 0.264099769 */, 19 },
+ /* 7179 */ { MAD_F(0x0439f41f) /* 0.264148827 */, 19 },
+ /* 7180 */ { MAD_F(0x043a2790) /* 0.264197888 */, 19 },
+ /* 7181 */ { MAD_F(0x043a5b02) /* 0.264246951 */, 19 },
+ /* 7182 */ { MAD_F(0x043a8e75) /* 0.264296016 */, 19 },
+ /* 7183 */ { MAD_F(0x043ac1e9) /* 0.264345084 */, 19 },
+
+ /* 7184 */ { MAD_F(0x043af55d) /* 0.264394153 */, 19 },
+ /* 7185 */ { MAD_F(0x043b28d2) /* 0.264443225 */, 19 },
+ /* 7186 */ { MAD_F(0x043b5c47) /* 0.264492300 */, 19 },
+ /* 7187 */ { MAD_F(0x043b8fbd) /* 0.264541376 */, 19 },
+ /* 7188 */ { MAD_F(0x043bc333) /* 0.264590455 */, 19 },
+ /* 7189 */ { MAD_F(0x043bf6aa) /* 0.264639536 */, 19 },
+ /* 7190 */ { MAD_F(0x043c2a22) /* 0.264688620 */, 19 },
+ /* 7191 */ { MAD_F(0x043c5d9a) /* 0.264737706 */, 19 },
+ /* 7192 */ { MAD_F(0x043c9113) /* 0.264786794 */, 19 },
+ /* 7193 */ { MAD_F(0x043cc48d) /* 0.264835884 */, 19 },
+ /* 7194 */ { MAD_F(0x043cf807) /* 0.264884976 */, 19 },
+ /* 7195 */ { MAD_F(0x043d2b82) /* 0.264934071 */, 19 },
+ /* 7196 */ { MAD_F(0x043d5efd) /* 0.264983168 */, 19 },
+ /* 7197 */ { MAD_F(0x043d9279) /* 0.265032268 */, 19 },
+ /* 7198 */ { MAD_F(0x043dc5f6) /* 0.265081369 */, 19 },
+ /* 7199 */ { MAD_F(0x043df973) /* 0.265130473 */, 19 },
+
+ /* 7200 */ { MAD_F(0x043e2cf1) /* 0.265179580 */, 19 },
+ /* 7201 */ { MAD_F(0x043e6070) /* 0.265228688 */, 19 },
+ /* 7202 */ { MAD_F(0x043e93ef) /* 0.265277799 */, 19 },
+ /* 7203 */ { MAD_F(0x043ec76e) /* 0.265326912 */, 19 },
+ /* 7204 */ { MAD_F(0x043efaef) /* 0.265376027 */, 19 },
+ /* 7205 */ { MAD_F(0x043f2e6f) /* 0.265425145 */, 19 },
+ /* 7206 */ { MAD_F(0x043f61f1) /* 0.265474264 */, 19 },
+ /* 7207 */ { MAD_F(0x043f9573) /* 0.265523387 */, 19 },
+ /* 7208 */ { MAD_F(0x043fc8f6) /* 0.265572511 */, 19 },
+ /* 7209 */ { MAD_F(0x043ffc79) /* 0.265621638 */, 19 },
+ /* 7210 */ { MAD_F(0x04402ffd) /* 0.265670766 */, 19 },
+ /* 7211 */ { MAD_F(0x04406382) /* 0.265719898 */, 19 },
+ /* 7212 */ { MAD_F(0x04409707) /* 0.265769031 */, 19 },
+ /* 7213 */ { MAD_F(0x0440ca8d) /* 0.265818167 */, 19 },
+ /* 7214 */ { MAD_F(0x0440fe13) /* 0.265867305 */, 19 },
+ /* 7215 */ { MAD_F(0x0441319a) /* 0.265916445 */, 19 },
+
+ /* 7216 */ { MAD_F(0x04416522) /* 0.265965588 */, 19 },
+ /* 7217 */ { MAD_F(0x044198aa) /* 0.266014732 */, 19 },
+ /* 7218 */ { MAD_F(0x0441cc33) /* 0.266063880 */, 19 },
+ /* 7219 */ { MAD_F(0x0441ffbc) /* 0.266113029 */, 19 },
+ /* 7220 */ { MAD_F(0x04423346) /* 0.266162181 */, 19 },
+ /* 7221 */ { MAD_F(0x044266d1) /* 0.266211334 */, 19 },
+ /* 7222 */ { MAD_F(0x04429a5c) /* 0.266260491 */, 19 },
+ /* 7223 */ { MAD_F(0x0442cde8) /* 0.266309649 */, 19 },
+ /* 7224 */ { MAD_F(0x04430174) /* 0.266358810 */, 19 },
+ /* 7225 */ { MAD_F(0x04433501) /* 0.266407973 */, 19 },
+ /* 7226 */ { MAD_F(0x0443688f) /* 0.266457138 */, 19 },
+ /* 7227 */ { MAD_F(0x04439c1d) /* 0.266506305 */, 19 },
+ /* 7228 */ { MAD_F(0x0443cfac) /* 0.266555475 */, 19 },
+ /* 7229 */ { MAD_F(0x0444033c) /* 0.266604647 */, 19 },
+ /* 7230 */ { MAD_F(0x044436cc) /* 0.266653822 */, 19 },
+ /* 7231 */ { MAD_F(0x04446a5d) /* 0.266702998 */, 19 },
+
+ /* 7232 */ { MAD_F(0x04449dee) /* 0.266752177 */, 19 },
+ /* 7233 */ { MAD_F(0x0444d180) /* 0.266801358 */, 19 },
+ /* 7234 */ { MAD_F(0x04450513) /* 0.266850541 */, 19 },
+ /* 7235 */ { MAD_F(0x044538a6) /* 0.266899727 */, 19 },
+ /* 7236 */ { MAD_F(0x04456c39) /* 0.266948915 */, 19 },
+ /* 7237 */ { MAD_F(0x04459fce) /* 0.266998105 */, 19 },
+ /* 7238 */ { MAD_F(0x0445d363) /* 0.267047298 */, 19 },
+ /* 7239 */ { MAD_F(0x044606f8) /* 0.267096492 */, 19 },
+ /* 7240 */ { MAD_F(0x04463a8f) /* 0.267145689 */, 19 },
+ /* 7241 */ { MAD_F(0x04466e25) /* 0.267194888 */, 19 },
+ /* 7242 */ { MAD_F(0x0446a1bd) /* 0.267244090 */, 19 },
+ /* 7243 */ { MAD_F(0x0446d555) /* 0.267293294 */, 19 },
+ /* 7244 */ { MAD_F(0x044708ee) /* 0.267342500 */, 19 },
+ /* 7245 */ { MAD_F(0x04473c87) /* 0.267391708 */, 19 },
+ /* 7246 */ { MAD_F(0x04477021) /* 0.267440919 */, 19 },
+ /* 7247 */ { MAD_F(0x0447a3bb) /* 0.267490131 */, 19 },
+
+ /* 7248 */ { MAD_F(0x0447d756) /* 0.267539347 */, 19 },
+ /* 7249 */ { MAD_F(0x04480af2) /* 0.267588564 */, 19 },
+ /* 7250 */ { MAD_F(0x04483e8e) /* 0.267637783 */, 19 },
+ /* 7251 */ { MAD_F(0x0448722b) /* 0.267687005 */, 19 },
+ /* 7252 */ { MAD_F(0x0448a5c9) /* 0.267736229 */, 19 },
+ /* 7253 */ { MAD_F(0x0448d967) /* 0.267785456 */, 19 },
+ /* 7254 */ { MAD_F(0x04490d05) /* 0.267834685 */, 19 },
+ /* 7255 */ { MAD_F(0x044940a5) /* 0.267883915 */, 19 },
+ /* 7256 */ { MAD_F(0x04497445) /* 0.267933149 */, 19 },
+ /* 7257 */ { MAD_F(0x0449a7e5) /* 0.267982384 */, 19 },
+ /* 7258 */ { MAD_F(0x0449db86) /* 0.268031622 */, 19 },
+ /* 7259 */ { MAD_F(0x044a0f28) /* 0.268080862 */, 19 },
+ /* 7260 */ { MAD_F(0x044a42ca) /* 0.268130104 */, 19 },
+ /* 7261 */ { MAD_F(0x044a766d) /* 0.268179349 */, 19 },
+ /* 7262 */ { MAD_F(0x044aaa11) /* 0.268228595 */, 19 },
+ /* 7263 */ { MAD_F(0x044addb5) /* 0.268277844 */, 19 },
+
+ /* 7264 */ { MAD_F(0x044b115a) /* 0.268327096 */, 19 },
+ /* 7265 */ { MAD_F(0x044b44ff) /* 0.268376349 */, 19 },
+ /* 7266 */ { MAD_F(0x044b78a5) /* 0.268425605 */, 19 },
+ /* 7267 */ { MAD_F(0x044bac4c) /* 0.268474863 */, 19 },
+ /* 7268 */ { MAD_F(0x044bdff3) /* 0.268524123 */, 19 },
+ /* 7269 */ { MAD_F(0x044c139b) /* 0.268573386 */, 19 },
+ /* 7270 */ { MAD_F(0x044c4743) /* 0.268622651 */, 19 },
+ /* 7271 */ { MAD_F(0x044c7aec) /* 0.268671918 */, 19 },
+ /* 7272 */ { MAD_F(0x044cae96) /* 0.268721187 */, 19 },
+ /* 7273 */ { MAD_F(0x044ce240) /* 0.268770459 */, 19 },
+ /* 7274 */ { MAD_F(0x044d15eb) /* 0.268819733 */, 19 },
+ /* 7275 */ { MAD_F(0x044d4997) /* 0.268869009 */, 19 },
+ /* 7276 */ { MAD_F(0x044d7d43) /* 0.268918287 */, 19 },
+ /* 7277 */ { MAD_F(0x044db0ef) /* 0.268967568 */, 19 },
+ /* 7278 */ { MAD_F(0x044de49d) /* 0.269016851 */, 19 },
+ /* 7279 */ { MAD_F(0x044e184b) /* 0.269066136 */, 19 },
+
+ /* 7280 */ { MAD_F(0x044e4bf9) /* 0.269115423 */, 19 },
+ /* 7281 */ { MAD_F(0x044e7fa8) /* 0.269164713 */, 19 },
+ /* 7282 */ { MAD_F(0x044eb358) /* 0.269214005 */, 19 },
+ /* 7283 */ { MAD_F(0x044ee708) /* 0.269263299 */, 19 },
+ /* 7284 */ { MAD_F(0x044f1ab9) /* 0.269312595 */, 19 },
+ /* 7285 */ { MAD_F(0x044f4e6b) /* 0.269361894 */, 19 },
+ /* 7286 */ { MAD_F(0x044f821d) /* 0.269411195 */, 19 },
+ /* 7287 */ { MAD_F(0x044fb5cf) /* 0.269460498 */, 19 },
+ /* 7288 */ { MAD_F(0x044fe983) /* 0.269509804 */, 19 },
+ /* 7289 */ { MAD_F(0x04501d37) /* 0.269559111 */, 19 },
+ /* 7290 */ { MAD_F(0x045050eb) /* 0.269608421 */, 19 },
+ /* 7291 */ { MAD_F(0x045084a0) /* 0.269657734 */, 19 },
+ /* 7292 */ { MAD_F(0x0450b856) /* 0.269707048 */, 19 },
+ /* 7293 */ { MAD_F(0x0450ec0d) /* 0.269756365 */, 19 },
+ /* 7294 */ { MAD_F(0x04511fc4) /* 0.269805684 */, 19 },
+ /* 7295 */ { MAD_F(0x0451537b) /* 0.269855005 */, 19 },
+
+ /* 7296 */ { MAD_F(0x04518733) /* 0.269904329 */, 19 },
+ /* 7297 */ { MAD_F(0x0451baec) /* 0.269953654 */, 19 },
+ /* 7298 */ { MAD_F(0x0451eea5) /* 0.270002982 */, 19 },
+ /* 7299 */ { MAD_F(0x0452225f) /* 0.270052313 */, 19 },
+ /* 7300 */ { MAD_F(0x0452561a) /* 0.270101645 */, 19 },
+ /* 7301 */ { MAD_F(0x045289d5) /* 0.270150980 */, 19 },
+ /* 7302 */ { MAD_F(0x0452bd91) /* 0.270200317 */, 19 },
+ /* 7303 */ { MAD_F(0x0452f14d) /* 0.270249656 */, 19 },
+ /* 7304 */ { MAD_F(0x0453250a) /* 0.270298998 */, 19 },
+ /* 7305 */ { MAD_F(0x045358c8) /* 0.270348341 */, 19 },
+ /* 7306 */ { MAD_F(0x04538c86) /* 0.270397687 */, 19 },
+ /* 7307 */ { MAD_F(0x0453c045) /* 0.270447036 */, 19 },
+ /* 7308 */ { MAD_F(0x0453f405) /* 0.270496386 */, 19 },
+ /* 7309 */ { MAD_F(0x045427c5) /* 0.270545739 */, 19 },
+ /* 7310 */ { MAD_F(0x04545b85) /* 0.270595094 */, 19 },
+ /* 7311 */ { MAD_F(0x04548f46) /* 0.270644451 */, 19 },
+
+ /* 7312 */ { MAD_F(0x0454c308) /* 0.270693811 */, 19 },
+ /* 7313 */ { MAD_F(0x0454f6cb) /* 0.270743173 */, 19 },
+ /* 7314 */ { MAD_F(0x04552a8e) /* 0.270792537 */, 19 },
+ /* 7315 */ { MAD_F(0x04555e51) /* 0.270841903 */, 19 },
+ /* 7316 */ { MAD_F(0x04559216) /* 0.270891271 */, 19 },
+ /* 7317 */ { MAD_F(0x0455c5db) /* 0.270940642 */, 19 },
+ /* 7318 */ { MAD_F(0x0455f9a0) /* 0.270990015 */, 19 },
+ /* 7319 */ { MAD_F(0x04562d66) /* 0.271039390 */, 19 },
+ /* 7320 */ { MAD_F(0x0456612d) /* 0.271088768 */, 19 },
+ /* 7321 */ { MAD_F(0x045694f4) /* 0.271138148 */, 19 },
+ /* 7322 */ { MAD_F(0x0456c8bc) /* 0.271187530 */, 19 },
+ /* 7323 */ { MAD_F(0x0456fc84) /* 0.271236914 */, 19 },
+ /* 7324 */ { MAD_F(0x0457304e) /* 0.271286301 */, 19 },
+ /* 7325 */ { MAD_F(0x04576417) /* 0.271335689 */, 19 },
+ /* 7326 */ { MAD_F(0x045797e2) /* 0.271385080 */, 19 },
+ /* 7327 */ { MAD_F(0x0457cbac) /* 0.271434474 */, 19 },
+
+ /* 7328 */ { MAD_F(0x0457ff78) /* 0.271483869 */, 19 },
+ /* 7329 */ { MAD_F(0x04583344) /* 0.271533267 */, 19 },
+ /* 7330 */ { MAD_F(0x04586711) /* 0.271582667 */, 19 },
+ /* 7331 */ { MAD_F(0x04589ade) /* 0.271632069 */, 19 },
+ /* 7332 */ { MAD_F(0x0458ceac) /* 0.271681474 */, 19 },
+ /* 7333 */ { MAD_F(0x0459027b) /* 0.271730880 */, 19 },
+ /* 7334 */ { MAD_F(0x0459364a) /* 0.271780289 */, 19 },
+ /* 7335 */ { MAD_F(0x04596a19) /* 0.271829701 */, 19 },
+ /* 7336 */ { MAD_F(0x04599dea) /* 0.271879114 */, 19 },
+ /* 7337 */ { MAD_F(0x0459d1bb) /* 0.271928530 */, 19 },
+ /* 7338 */ { MAD_F(0x045a058c) /* 0.271977948 */, 19 },
+ /* 7339 */ { MAD_F(0x045a395e) /* 0.272027368 */, 19 },
+ /* 7340 */ { MAD_F(0x045a6d31) /* 0.272076790 */, 19 },
+ /* 7341 */ { MAD_F(0x045aa104) /* 0.272126215 */, 19 },
+ /* 7342 */ { MAD_F(0x045ad4d8) /* 0.272175642 */, 19 },
+ /* 7343 */ { MAD_F(0x045b08ad) /* 0.272225071 */, 19 },
+
+ /* 7344 */ { MAD_F(0x045b3c82) /* 0.272274503 */, 19 },
+ /* 7345 */ { MAD_F(0x045b7058) /* 0.272323936 */, 19 },
+ /* 7346 */ { MAD_F(0x045ba42e) /* 0.272373372 */, 19 },
+ /* 7347 */ { MAD_F(0x045bd805) /* 0.272422810 */, 19 },
+ /* 7348 */ { MAD_F(0x045c0bdd) /* 0.272472251 */, 19 },
+ /* 7349 */ { MAD_F(0x045c3fb5) /* 0.272521693 */, 19 },
+ /* 7350 */ { MAD_F(0x045c738e) /* 0.272571138 */, 19 },
+ /* 7351 */ { MAD_F(0x045ca767) /* 0.272620585 */, 19 },
+ /* 7352 */ { MAD_F(0x045cdb41) /* 0.272670035 */, 19 },
+ /* 7353 */ { MAD_F(0x045d0f1b) /* 0.272719486 */, 19 },
+ /* 7354 */ { MAD_F(0x045d42f7) /* 0.272768940 */, 19 },
+ /* 7355 */ { MAD_F(0x045d76d2) /* 0.272818396 */, 19 },
+ /* 7356 */ { MAD_F(0x045daaaf) /* 0.272867855 */, 19 },
+ /* 7357 */ { MAD_F(0x045dde8c) /* 0.272917315 */, 19 },
+ /* 7358 */ { MAD_F(0x045e1269) /* 0.272966778 */, 19 },
+ /* 7359 */ { MAD_F(0x045e4647) /* 0.273016243 */, 19 },
+
+ /* 7360 */ { MAD_F(0x045e7a26) /* 0.273065710 */, 19 },
+ /* 7361 */ { MAD_F(0x045eae06) /* 0.273115180 */, 19 },
+ /* 7362 */ { MAD_F(0x045ee1e6) /* 0.273164652 */, 19 },
+ /* 7363 */ { MAD_F(0x045f15c6) /* 0.273214126 */, 19 },
+ /* 7364 */ { MAD_F(0x045f49a7) /* 0.273263602 */, 19 },
+ /* 7365 */ { MAD_F(0x045f7d89) /* 0.273313081 */, 19 },
+ /* 7366 */ { MAD_F(0x045fb16c) /* 0.273362561 */, 19 },
+ /* 7367 */ { MAD_F(0x045fe54f) /* 0.273412044 */, 19 },
+ /* 7368 */ { MAD_F(0x04601932) /* 0.273461530 */, 19 },
+ /* 7369 */ { MAD_F(0x04604d16) /* 0.273511017 */, 19 },
+ /* 7370 */ { MAD_F(0x046080fb) /* 0.273560507 */, 19 },
+ /* 7371 */ { MAD_F(0x0460b4e1) /* 0.273609999 */, 19 },
+ /* 7372 */ { MAD_F(0x0460e8c7) /* 0.273659493 */, 19 },
+ /* 7373 */ { MAD_F(0x04611cad) /* 0.273708989 */, 19 },
+ /* 7374 */ { MAD_F(0x04615094) /* 0.273758488 */, 19 },
+ /* 7375 */ { MAD_F(0x0461847c) /* 0.273807989 */, 19 },
+
+ /* 7376 */ { MAD_F(0x0461b864) /* 0.273857492 */, 19 },
+ /* 7377 */ { MAD_F(0x0461ec4d) /* 0.273906997 */, 19 },
+ /* 7378 */ { MAD_F(0x04622037) /* 0.273956505 */, 19 },
+ /* 7379 */ { MAD_F(0x04625421) /* 0.274006015 */, 19 },
+ /* 7380 */ { MAD_F(0x0462880c) /* 0.274055527 */, 19 },
+ /* 7381 */ { MAD_F(0x0462bbf7) /* 0.274105041 */, 19 },
+ /* 7382 */ { MAD_F(0x0462efe3) /* 0.274154558 */, 19 },
+ /* 7383 */ { MAD_F(0x046323d0) /* 0.274204076 */, 19 },
+ /* 7384 */ { MAD_F(0x046357bd) /* 0.274253597 */, 19 },
+ /* 7385 */ { MAD_F(0x04638bab) /* 0.274303121 */, 19 },
+ /* 7386 */ { MAD_F(0x0463bf99) /* 0.274352646 */, 19 },
+ /* 7387 */ { MAD_F(0x0463f388) /* 0.274402174 */, 19 },
+ /* 7388 */ { MAD_F(0x04642778) /* 0.274451704 */, 19 },
+ /* 7389 */ { MAD_F(0x04645b68) /* 0.274501236 */, 19 },
+ /* 7390 */ { MAD_F(0x04648f59) /* 0.274550771 */, 19 },
+ /* 7391 */ { MAD_F(0x0464c34a) /* 0.274600307 */, 19 },
+
+ /* 7392 */ { MAD_F(0x0464f73c) /* 0.274649846 */, 19 },
+ /* 7393 */ { MAD_F(0x04652b2f) /* 0.274699387 */, 19 },
+ /* 7394 */ { MAD_F(0x04655f22) /* 0.274748931 */, 19 },
+ /* 7395 */ { MAD_F(0x04659316) /* 0.274798476 */, 19 },
+ /* 7396 */ { MAD_F(0x0465c70a) /* 0.274848024 */, 19 },
+ /* 7397 */ { MAD_F(0x0465faff) /* 0.274897574 */, 19 },
+ /* 7398 */ { MAD_F(0x04662ef5) /* 0.274947126 */, 19 },
+ /* 7399 */ { MAD_F(0x046662eb) /* 0.274996681 */, 19 },
+ /* 7400 */ { MAD_F(0x046696e2) /* 0.275046238 */, 19 },
+ /* 7401 */ { MAD_F(0x0466cad9) /* 0.275095797 */, 19 },
+ /* 7402 */ { MAD_F(0x0466fed1) /* 0.275145358 */, 19 },
+ /* 7403 */ { MAD_F(0x046732ca) /* 0.275194921 */, 19 },
+ /* 7404 */ { MAD_F(0x046766c3) /* 0.275244487 */, 19 },
+ /* 7405 */ { MAD_F(0x04679abd) /* 0.275294055 */, 19 },
+ /* 7406 */ { MAD_F(0x0467ceb7) /* 0.275343625 */, 19 },
+ /* 7407 */ { MAD_F(0x046802b2) /* 0.275393198 */, 19 },
+
+ /* 7408 */ { MAD_F(0x046836ae) /* 0.275442772 */, 19 },
+ /* 7409 */ { MAD_F(0x04686aaa) /* 0.275492349 */, 19 },
+ /* 7410 */ { MAD_F(0x04689ea7) /* 0.275541928 */, 19 },
+ /* 7411 */ { MAD_F(0x0468d2a4) /* 0.275591509 */, 19 },
+ /* 7412 */ { MAD_F(0x046906a2) /* 0.275641093 */, 19 },
+ /* 7413 */ { MAD_F(0x04693aa1) /* 0.275690679 */, 19 },
+ /* 7414 */ { MAD_F(0x04696ea0) /* 0.275740267 */, 19 },
+ /* 7415 */ { MAD_F(0x0469a2a0) /* 0.275789857 */, 19 },
+ /* 7416 */ { MAD_F(0x0469d6a0) /* 0.275839449 */, 19 },
+ /* 7417 */ { MAD_F(0x046a0aa1) /* 0.275889044 */, 19 },
+ /* 7418 */ { MAD_F(0x046a3ea3) /* 0.275938641 */, 19 },
+ /* 7419 */ { MAD_F(0x046a72a5) /* 0.275988240 */, 19 },
+ /* 7420 */ { MAD_F(0x046aa6a8) /* 0.276037842 */, 19 },
+ /* 7421 */ { MAD_F(0x046adaab) /* 0.276087445 */, 19 },
+ /* 7422 */ { MAD_F(0x046b0eaf) /* 0.276137051 */, 19 },
+ /* 7423 */ { MAD_F(0x046b42b3) /* 0.276186659 */, 19 },
+
+ /* 7424 */ { MAD_F(0x046b76b9) /* 0.276236269 */, 19 },
+ /* 7425 */ { MAD_F(0x046baabe) /* 0.276285882 */, 19 },
+ /* 7426 */ { MAD_F(0x046bdec5) /* 0.276335497 */, 19 },
+ /* 7427 */ { MAD_F(0x046c12cc) /* 0.276385113 */, 19 },
+ /* 7428 */ { MAD_F(0x046c46d3) /* 0.276434733 */, 19 },
+ /* 7429 */ { MAD_F(0x046c7adb) /* 0.276484354 */, 19 },
+ /* 7430 */ { MAD_F(0x046caee4) /* 0.276533978 */, 19 },
+ /* 7431 */ { MAD_F(0x046ce2ee) /* 0.276583604 */, 19 },
+ /* 7432 */ { MAD_F(0x046d16f7) /* 0.276633232 */, 19 },
+ /* 7433 */ { MAD_F(0x046d4b02) /* 0.276682862 */, 19 },
+ /* 7434 */ { MAD_F(0x046d7f0d) /* 0.276732495 */, 19 },
+ /* 7435 */ { MAD_F(0x046db319) /* 0.276782129 */, 19 },
+ /* 7436 */ { MAD_F(0x046de725) /* 0.276831766 */, 19 },
+ /* 7437 */ { MAD_F(0x046e1b32) /* 0.276881406 */, 19 },
+ /* 7438 */ { MAD_F(0x046e4f40) /* 0.276931047 */, 19 },
+ /* 7439 */ { MAD_F(0x046e834e) /* 0.276980691 */, 19 },
+
+ /* 7440 */ { MAD_F(0x046eb75c) /* 0.277030337 */, 19 },
+ /* 7441 */ { MAD_F(0x046eeb6c) /* 0.277079985 */, 19 },
+ /* 7442 */ { MAD_F(0x046f1f7c) /* 0.277129635 */, 19 },
+ /* 7443 */ { MAD_F(0x046f538c) /* 0.277179288 */, 19 },
+ /* 7444 */ { MAD_F(0x046f879d) /* 0.277228942 */, 19 },
+ /* 7445 */ { MAD_F(0x046fbbaf) /* 0.277278600 */, 19 },
+ /* 7446 */ { MAD_F(0x046fefc1) /* 0.277328259 */, 19 },
+ /* 7447 */ { MAD_F(0x047023d4) /* 0.277377920 */, 19 },
+ /* 7448 */ { MAD_F(0x047057e8) /* 0.277427584 */, 19 },
+ /* 7449 */ { MAD_F(0x04708bfc) /* 0.277477250 */, 19 },
+ /* 7450 */ { MAD_F(0x0470c011) /* 0.277526918 */, 19 },
+ /* 7451 */ { MAD_F(0x0470f426) /* 0.277576588 */, 19 },
+ /* 7452 */ { MAD_F(0x0471283c) /* 0.277626261 */, 19 },
+ /* 7453 */ { MAD_F(0x04715c52) /* 0.277675936 */, 19 },
+ /* 7454 */ { MAD_F(0x04719069) /* 0.277725613 */, 19 },
+ /* 7455 */ { MAD_F(0x0471c481) /* 0.277775292 */, 19 },
+
+ /* 7456 */ { MAD_F(0x0471f899) /* 0.277824973 */, 19 },
+ /* 7457 */ { MAD_F(0x04722cb2) /* 0.277874657 */, 19 },
+ /* 7458 */ { MAD_F(0x047260cc) /* 0.277924343 */, 19 },
+ /* 7459 */ { MAD_F(0x047294e6) /* 0.277974031 */, 19 },
+ /* 7460 */ { MAD_F(0x0472c900) /* 0.278023722 */, 19 },
+ /* 7461 */ { MAD_F(0x0472fd1b) /* 0.278073414 */, 19 },
+ /* 7462 */ { MAD_F(0x04733137) /* 0.278123109 */, 19 },
+ /* 7463 */ { MAD_F(0x04736554) /* 0.278172806 */, 19 },
+ /* 7464 */ { MAD_F(0x04739971) /* 0.278222505 */, 19 },
+ /* 7465 */ { MAD_F(0x0473cd8e) /* 0.278272207 */, 19 },
+ /* 7466 */ { MAD_F(0x047401ad) /* 0.278321910 */, 19 },
+ /* 7467 */ { MAD_F(0x047435cb) /* 0.278371616 */, 19 },
+ /* 7468 */ { MAD_F(0x047469eb) /* 0.278421324 */, 19 },
+ /* 7469 */ { MAD_F(0x04749e0b) /* 0.278471035 */, 19 },
+ /* 7470 */ { MAD_F(0x0474d22c) /* 0.278520747 */, 19 },
+ /* 7471 */ { MAD_F(0x0475064d) /* 0.278570462 */, 19 },
+
+ /* 7472 */ { MAD_F(0x04753a6f) /* 0.278620179 */, 19 },
+ /* 7473 */ { MAD_F(0x04756e91) /* 0.278669898 */, 19 },
+ /* 7474 */ { MAD_F(0x0475a2b4) /* 0.278719619 */, 19 },
+ /* 7475 */ { MAD_F(0x0475d6d7) /* 0.278769343 */, 19 },
+ /* 7476 */ { MAD_F(0x04760afc) /* 0.278819069 */, 19 },
+ /* 7477 */ { MAD_F(0x04763f20) /* 0.278868797 */, 19 },
+ /* 7478 */ { MAD_F(0x04767346) /* 0.278918527 */, 19 },
+ /* 7479 */ { MAD_F(0x0476a76c) /* 0.278968260 */, 19 },
+ /* 7480 */ { MAD_F(0x0476db92) /* 0.279017995 */, 19 },
+ /* 7481 */ { MAD_F(0x04770fba) /* 0.279067731 */, 19 },
+ /* 7482 */ { MAD_F(0x047743e1) /* 0.279117471 */, 19 },
+ /* 7483 */ { MAD_F(0x0477780a) /* 0.279167212 */, 19 },
+ /* 7484 */ { MAD_F(0x0477ac33) /* 0.279216956 */, 19 },
+ /* 7485 */ { MAD_F(0x0477e05c) /* 0.279266701 */, 19 },
+ /* 7486 */ { MAD_F(0x04781486) /* 0.279316449 */, 19 },
+ /* 7487 */ { MAD_F(0x047848b1) /* 0.279366200 */, 19 },
+
+ /* 7488 */ { MAD_F(0x04787cdc) /* 0.279415952 */, 19 },
+ /* 7489 */ { MAD_F(0x0478b108) /* 0.279465707 */, 19 },
+ /* 7490 */ { MAD_F(0x0478e535) /* 0.279515464 */, 19 },
+ /* 7491 */ { MAD_F(0x04791962) /* 0.279565223 */, 19 },
+ /* 7492 */ { MAD_F(0x04794d8f) /* 0.279614984 */, 19 },
+ /* 7493 */ { MAD_F(0x047981be) /* 0.279664748 */, 19 },
+ /* 7494 */ { MAD_F(0x0479b5ed) /* 0.279714513 */, 19 },
+ /* 7495 */ { MAD_F(0x0479ea1c) /* 0.279764281 */, 19 },
+ /* 7496 */ { MAD_F(0x047a1e4c) /* 0.279814051 */, 19 },
+ /* 7497 */ { MAD_F(0x047a527d) /* 0.279863824 */, 19 },
+ /* 7498 */ { MAD_F(0x047a86ae) /* 0.279913598 */, 19 },
+ /* 7499 */ { MAD_F(0x047abae0) /* 0.279963375 */, 19 },
+ /* 7500 */ { MAD_F(0x047aef12) /* 0.280013154 */, 19 },
+ /* 7501 */ { MAD_F(0x047b2346) /* 0.280062935 */, 19 },
+ /* 7502 */ { MAD_F(0x047b5779) /* 0.280112719 */, 19 },
+ /* 7503 */ { MAD_F(0x047b8bad) /* 0.280162504 */, 19 },
+
+ /* 7504 */ { MAD_F(0x047bbfe2) /* 0.280212292 */, 19 },
+ /* 7505 */ { MAD_F(0x047bf418) /* 0.280262082 */, 19 },
+ /* 7506 */ { MAD_F(0x047c284e) /* 0.280311875 */, 19 },
+ /* 7507 */ { MAD_F(0x047c5c84) /* 0.280361669 */, 19 },
+ /* 7508 */ { MAD_F(0x047c90bb) /* 0.280411466 */, 19 },
+ /* 7509 */ { MAD_F(0x047cc4f3) /* 0.280461265 */, 19 },
+ /* 7510 */ { MAD_F(0x047cf92c) /* 0.280511066 */, 19 },
+ /* 7511 */ { MAD_F(0x047d2d65) /* 0.280560869 */, 19 },
+ /* 7512 */ { MAD_F(0x047d619e) /* 0.280610675 */, 19 },
+ /* 7513 */ { MAD_F(0x047d95d8) /* 0.280660483 */, 19 },
+ /* 7514 */ { MAD_F(0x047dca13) /* 0.280710292 */, 19 },
+ /* 7515 */ { MAD_F(0x047dfe4e) /* 0.280760105 */, 19 },
+ /* 7516 */ { MAD_F(0x047e328a) /* 0.280809919 */, 19 },
+ /* 7517 */ { MAD_F(0x047e66c7) /* 0.280859736 */, 19 },
+ /* 7518 */ { MAD_F(0x047e9b04) /* 0.280909554 */, 19 },
+ /* 7519 */ { MAD_F(0x047ecf42) /* 0.280959375 */, 19 },
+
+ /* 7520 */ { MAD_F(0x047f0380) /* 0.281009199 */, 19 },
+ /* 7521 */ { MAD_F(0x047f37bf) /* 0.281059024 */, 19 },
+ /* 7522 */ { MAD_F(0x047f6bff) /* 0.281108852 */, 19 },
+ /* 7523 */ { MAD_F(0x047fa03f) /* 0.281158682 */, 19 },
+ /* 7524 */ { MAD_F(0x047fd47f) /* 0.281208514 */, 19 },
+ /* 7525 */ { MAD_F(0x048008c1) /* 0.281258348 */, 19 },
+ /* 7526 */ { MAD_F(0x04803d02) /* 0.281308184 */, 19 },
+ /* 7527 */ { MAD_F(0x04807145) /* 0.281358023 */, 19 },
+ /* 7528 */ { MAD_F(0x0480a588) /* 0.281407864 */, 19 },
+ /* 7529 */ { MAD_F(0x0480d9cc) /* 0.281457707 */, 19 },
+ /* 7530 */ { MAD_F(0x04810e10) /* 0.281507552 */, 19 },
+ /* 7531 */ { MAD_F(0x04814255) /* 0.281557400 */, 19 },
+ /* 7532 */ { MAD_F(0x0481769a) /* 0.281607250 */, 19 },
+ /* 7533 */ { MAD_F(0x0481aae0) /* 0.281657101 */, 19 },
+ /* 7534 */ { MAD_F(0x0481df27) /* 0.281706956 */, 19 },
+ /* 7535 */ { MAD_F(0x0482136e) /* 0.281756812 */, 19 },
+
+ /* 7536 */ { MAD_F(0x048247b6) /* 0.281806670 */, 19 },
+ /* 7537 */ { MAD_F(0x04827bfe) /* 0.281856531 */, 19 },
+ /* 7538 */ { MAD_F(0x0482b047) /* 0.281906394 */, 19 },
+ /* 7539 */ { MAD_F(0x0482e491) /* 0.281956259 */, 19 },
+ /* 7540 */ { MAD_F(0x048318db) /* 0.282006127 */, 19 },
+ /* 7541 */ { MAD_F(0x04834d26) /* 0.282055996 */, 19 },
+ /* 7542 */ { MAD_F(0x04838171) /* 0.282105868 */, 19 },
+ /* 7543 */ { MAD_F(0x0483b5bd) /* 0.282155742 */, 19 },
+ /* 7544 */ { MAD_F(0x0483ea0a) /* 0.282205618 */, 19 },
+ /* 7545 */ { MAD_F(0x04841e57) /* 0.282255496 */, 19 },
+ /* 7546 */ { MAD_F(0x048452a4) /* 0.282305377 */, 19 },
+ /* 7547 */ { MAD_F(0x048486f3) /* 0.282355260 */, 19 },
+ /* 7548 */ { MAD_F(0x0484bb42) /* 0.282405145 */, 19 },
+ /* 7549 */ { MAD_F(0x0484ef91) /* 0.282455032 */, 19 },
+ /* 7550 */ { MAD_F(0x048523e1) /* 0.282504921 */, 19 },
+ /* 7551 */ { MAD_F(0x04855832) /* 0.282554813 */, 19 },
+
+ /* 7552 */ { MAD_F(0x04858c83) /* 0.282604707 */, 19 },
+ /* 7553 */ { MAD_F(0x0485c0d5) /* 0.282654603 */, 19 },
+ /* 7554 */ { MAD_F(0x0485f527) /* 0.282704501 */, 19 },
+ /* 7555 */ { MAD_F(0x0486297a) /* 0.282754401 */, 19 },
+ /* 7556 */ { MAD_F(0x04865dce) /* 0.282804304 */, 19 },
+ /* 7557 */ { MAD_F(0x04869222) /* 0.282854209 */, 19 },
+ /* 7558 */ { MAD_F(0x0486c677) /* 0.282904116 */, 19 },
+ /* 7559 */ { MAD_F(0x0486facc) /* 0.282954025 */, 19 },
+ /* 7560 */ { MAD_F(0x04872f22) /* 0.283003936 */, 19 },
+ /* 7561 */ { MAD_F(0x04876379) /* 0.283053850 */, 19 },
+ /* 7562 */ { MAD_F(0x048797d0) /* 0.283103766 */, 19 },
+ /* 7563 */ { MAD_F(0x0487cc28) /* 0.283153684 */, 19 },
+ /* 7564 */ { MAD_F(0x04880080) /* 0.283203604 */, 19 },
+ /* 7565 */ { MAD_F(0x048834d9) /* 0.283253527 */, 19 },
+ /* 7566 */ { MAD_F(0x04886933) /* 0.283303451 */, 19 },
+ /* 7567 */ { MAD_F(0x04889d8d) /* 0.283353378 */, 19 },
+
+ /* 7568 */ { MAD_F(0x0488d1e8) /* 0.283403307 */, 19 },
+ /* 7569 */ { MAD_F(0x04890643) /* 0.283453238 */, 19 },
+ /* 7570 */ { MAD_F(0x04893a9f) /* 0.283503172 */, 19 },
+ /* 7571 */ { MAD_F(0x04896efb) /* 0.283553107 */, 19 },
+ /* 7572 */ { MAD_F(0x0489a358) /* 0.283603045 */, 19 },
+ /* 7573 */ { MAD_F(0x0489d7b6) /* 0.283652985 */, 19 },
+ /* 7574 */ { MAD_F(0x048a0c14) /* 0.283702927 */, 19 },
+ /* 7575 */ { MAD_F(0x048a4073) /* 0.283752872 */, 19 },
+ /* 7576 */ { MAD_F(0x048a74d3) /* 0.283802818 */, 19 },
+ /* 7577 */ { MAD_F(0x048aa933) /* 0.283852767 */, 19 },
+ /* 7578 */ { MAD_F(0x048add93) /* 0.283902718 */, 19 },
+ /* 7579 */ { MAD_F(0x048b11f5) /* 0.283952671 */, 19 },
+ /* 7580 */ { MAD_F(0x048b4656) /* 0.284002627 */, 19 },
+ /* 7581 */ { MAD_F(0x048b7ab9) /* 0.284052584 */, 19 },
+ /* 7582 */ { MAD_F(0x048baf1c) /* 0.284102544 */, 19 },
+ /* 7583 */ { MAD_F(0x048be37f) /* 0.284152506 */, 19 },
+
+ /* 7584 */ { MAD_F(0x048c17e3) /* 0.284202470 */, 19 },
+ /* 7585 */ { MAD_F(0x048c4c48) /* 0.284252436 */, 19 },
+ /* 7586 */ { MAD_F(0x048c80ad) /* 0.284302405 */, 19 },
+ /* 7587 */ { MAD_F(0x048cb513) /* 0.284352376 */, 19 },
+ /* 7588 */ { MAD_F(0x048ce97a) /* 0.284402349 */, 19 },
+ /* 7589 */ { MAD_F(0x048d1de1) /* 0.284452324 */, 19 },
+ /* 7590 */ { MAD_F(0x048d5249) /* 0.284502301 */, 19 },
+ /* 7591 */ { MAD_F(0x048d86b1) /* 0.284552281 */, 19 },
+ /* 7592 */ { MAD_F(0x048dbb1a) /* 0.284602263 */, 19 },
+ /* 7593 */ { MAD_F(0x048def83) /* 0.284652246 */, 19 },
+ /* 7594 */ { MAD_F(0x048e23ed) /* 0.284702233 */, 19 },
+ /* 7595 */ { MAD_F(0x048e5858) /* 0.284752221 */, 19 },
+ /* 7596 */ { MAD_F(0x048e8cc3) /* 0.284802211 */, 19 },
+ /* 7597 */ { MAD_F(0x048ec12f) /* 0.284852204 */, 19 },
+ /* 7598 */ { MAD_F(0x048ef59b) /* 0.284902199 */, 19 },
+ /* 7599 */ { MAD_F(0x048f2a08) /* 0.284952196 */, 19 },
+
+ /* 7600 */ { MAD_F(0x048f5e76) /* 0.285002195 */, 19 },
+ /* 7601 */ { MAD_F(0x048f92e4) /* 0.285052197 */, 19 },
+ /* 7602 */ { MAD_F(0x048fc753) /* 0.285102201 */, 19 },
+ /* 7603 */ { MAD_F(0x048ffbc2) /* 0.285152206 */, 19 },
+ /* 7604 */ { MAD_F(0x04903032) /* 0.285202214 */, 19 },
+ /* 7605 */ { MAD_F(0x049064a3) /* 0.285252225 */, 19 },
+ /* 7606 */ { MAD_F(0x04909914) /* 0.285302237 */, 19 },
+ /* 7607 */ { MAD_F(0x0490cd86) /* 0.285352252 */, 19 },
+ /* 7608 */ { MAD_F(0x049101f8) /* 0.285402269 */, 19 },
+ /* 7609 */ { MAD_F(0x0491366b) /* 0.285452288 */, 19 },
+ /* 7610 */ { MAD_F(0x04916ade) /* 0.285502309 */, 19 },
+ /* 7611 */ { MAD_F(0x04919f52) /* 0.285552332 */, 19 },
+ /* 7612 */ { MAD_F(0x0491d3c7) /* 0.285602358 */, 19 },
+ /* 7613 */ { MAD_F(0x0492083c) /* 0.285652386 */, 19 },
+ /* 7614 */ { MAD_F(0x04923cb2) /* 0.285702416 */, 19 },
+ /* 7615 */ { MAD_F(0x04927128) /* 0.285752448 */, 19 },
+
+ /* 7616 */ { MAD_F(0x0492a59f) /* 0.285802482 */, 19 },
+ /* 7617 */ { MAD_F(0x0492da17) /* 0.285852519 */, 19 },
+ /* 7618 */ { MAD_F(0x04930e8f) /* 0.285902557 */, 19 },
+ /* 7619 */ { MAD_F(0x04934308) /* 0.285952598 */, 19 },
+ /* 7620 */ { MAD_F(0x04937781) /* 0.286002641 */, 19 },
+ /* 7621 */ { MAD_F(0x0493abfb) /* 0.286052687 */, 19 },
+ /* 7622 */ { MAD_F(0x0493e076) /* 0.286102734 */, 19 },
+ /* 7623 */ { MAD_F(0x049414f1) /* 0.286152784 */, 19 },
+ /* 7624 */ { MAD_F(0x0494496c) /* 0.286202836 */, 19 },
+ /* 7625 */ { MAD_F(0x04947de9) /* 0.286252890 */, 19 },
+ /* 7626 */ { MAD_F(0x0494b266) /* 0.286302946 */, 19 },
+ /* 7627 */ { MAD_F(0x0494e6e3) /* 0.286353005 */, 19 },
+ /* 7628 */ { MAD_F(0x04951b61) /* 0.286403065 */, 19 },
+ /* 7629 */ { MAD_F(0x04954fe0) /* 0.286453128 */, 19 },
+ /* 7630 */ { MAD_F(0x0495845f) /* 0.286503193 */, 19 },
+ /* 7631 */ { MAD_F(0x0495b8df) /* 0.286553260 */, 19 },
+
+ /* 7632 */ { MAD_F(0x0495ed5f) /* 0.286603329 */, 19 },
+ /* 7633 */ { MAD_F(0x049621e0) /* 0.286653401 */, 19 },
+ /* 7634 */ { MAD_F(0x04965662) /* 0.286703475 */, 19 },
+ /* 7635 */ { MAD_F(0x04968ae4) /* 0.286753551 */, 19 },
+ /* 7636 */ { MAD_F(0x0496bf67) /* 0.286803629 */, 19 },
+ /* 7637 */ { MAD_F(0x0496f3ea) /* 0.286853709 */, 19 },
+ /* 7638 */ { MAD_F(0x0497286e) /* 0.286903792 */, 19 },
+ /* 7639 */ { MAD_F(0x04975cf2) /* 0.286953876 */, 19 },
+ /* 7640 */ { MAD_F(0x04979177) /* 0.287003963 */, 19 },
+ /* 7641 */ { MAD_F(0x0497c5fd) /* 0.287054052 */, 19 },
+ /* 7642 */ { MAD_F(0x0497fa83) /* 0.287104143 */, 19 },
+ /* 7643 */ { MAD_F(0x04982f0a) /* 0.287154237 */, 19 },
+ /* 7644 */ { MAD_F(0x04986392) /* 0.287204332 */, 19 },
+ /* 7645 */ { MAD_F(0x0498981a) /* 0.287254430 */, 19 },
+ /* 7646 */ { MAD_F(0x0498cca2) /* 0.287304530 */, 19 },
+ /* 7647 */ { MAD_F(0x0499012c) /* 0.287354632 */, 19 },
+
+ /* 7648 */ { MAD_F(0x049935b5) /* 0.287404737 */, 19 },
+ /* 7649 */ { MAD_F(0x04996a40) /* 0.287454843 */, 19 },
+ /* 7650 */ { MAD_F(0x04999ecb) /* 0.287504952 */, 19 },
+ /* 7651 */ { MAD_F(0x0499d356) /* 0.287555063 */, 19 },
+ /* 7652 */ { MAD_F(0x049a07e2) /* 0.287605176 */, 19 },
+ /* 7653 */ { MAD_F(0x049a3c6f) /* 0.287655291 */, 19 },
+ /* 7654 */ { MAD_F(0x049a70fc) /* 0.287705409 */, 19 },
+ /* 7655 */ { MAD_F(0x049aa58a) /* 0.287755528 */, 19 },
+ /* 7656 */ { MAD_F(0x049ada19) /* 0.287805650 */, 19 },
+ /* 7657 */ { MAD_F(0x049b0ea8) /* 0.287855774 */, 19 },
+ /* 7658 */ { MAD_F(0x049b4337) /* 0.287905900 */, 19 },
+ /* 7659 */ { MAD_F(0x049b77c8) /* 0.287956028 */, 19 },
+ /* 7660 */ { MAD_F(0x049bac58) /* 0.288006159 */, 19 },
+ /* 7661 */ { MAD_F(0x049be0ea) /* 0.288056292 */, 19 },
+ /* 7662 */ { MAD_F(0x049c157c) /* 0.288106427 */, 19 },
+ /* 7663 */ { MAD_F(0x049c4a0e) /* 0.288156564 */, 19 },
+
+ /* 7664 */ { MAD_F(0x049c7ea1) /* 0.288206703 */, 19 },
+ /* 7665 */ { MAD_F(0x049cb335) /* 0.288256844 */, 19 },
+ /* 7666 */ { MAD_F(0x049ce7ca) /* 0.288306988 */, 19 },
+ /* 7667 */ { MAD_F(0x049d1c5e) /* 0.288357134 */, 19 },
+ /* 7668 */ { MAD_F(0x049d50f4) /* 0.288407282 */, 19 },
+ /* 7669 */ { MAD_F(0x049d858a) /* 0.288457432 */, 19 },
+ /* 7670 */ { MAD_F(0x049dba21) /* 0.288507584 */, 19 },
+ /* 7671 */ { MAD_F(0x049deeb8) /* 0.288557739 */, 19 },
+ /* 7672 */ { MAD_F(0x049e2350) /* 0.288607895 */, 19 },
+ /* 7673 */ { MAD_F(0x049e57e8) /* 0.288658054 */, 19 },
+ /* 7674 */ { MAD_F(0x049e8c81) /* 0.288708215 */, 19 },
+ /* 7675 */ { MAD_F(0x049ec11b) /* 0.288758379 */, 19 },
+ /* 7676 */ { MAD_F(0x049ef5b5) /* 0.288808544 */, 19 },
+ /* 7677 */ { MAD_F(0x049f2a50) /* 0.288858712 */, 19 },
+ /* 7678 */ { MAD_F(0x049f5eeb) /* 0.288908881 */, 19 },
+ /* 7679 */ { MAD_F(0x049f9387) /* 0.288959053 */, 19 },
+
+ /* 7680 */ { MAD_F(0x049fc824) /* 0.289009227 */, 19 },
+ /* 7681 */ { MAD_F(0x049ffcc1) /* 0.289059404 */, 19 },
+ /* 7682 */ { MAD_F(0x04a0315e) /* 0.289109582 */, 19 },
+ /* 7683 */ { MAD_F(0x04a065fd) /* 0.289159763 */, 19 },
+ /* 7684 */ { MAD_F(0x04a09a9b) /* 0.289209946 */, 19 },
+ /* 7685 */ { MAD_F(0x04a0cf3b) /* 0.289260131 */, 19 },
+ /* 7686 */ { MAD_F(0x04a103db) /* 0.289310318 */, 19 },
+ /* 7687 */ { MAD_F(0x04a1387b) /* 0.289360507 */, 19 },
+ /* 7688 */ { MAD_F(0x04a16d1d) /* 0.289410699 */, 19 },
+ /* 7689 */ { MAD_F(0x04a1a1be) /* 0.289460893 */, 19 },
+ /* 7690 */ { MAD_F(0x04a1d661) /* 0.289511088 */, 19 },
+ /* 7691 */ { MAD_F(0x04a20b04) /* 0.289561287 */, 19 },
+ /* 7692 */ { MAD_F(0x04a23fa7) /* 0.289611487 */, 19 },
+ /* 7693 */ { MAD_F(0x04a2744b) /* 0.289661689 */, 19 },
+ /* 7694 */ { MAD_F(0x04a2a8f0) /* 0.289711894 */, 19 },
+ /* 7695 */ { MAD_F(0x04a2dd95) /* 0.289762101 */, 19 },
+
+ /* 7696 */ { MAD_F(0x04a3123b) /* 0.289812309 */, 19 },
+ /* 7697 */ { MAD_F(0x04a346e2) /* 0.289862521 */, 19 },
+ /* 7698 */ { MAD_F(0x04a37b89) /* 0.289912734 */, 19 },
+ /* 7699 */ { MAD_F(0x04a3b030) /* 0.289962949 */, 19 },
+ /* 7700 */ { MAD_F(0x04a3e4d8) /* 0.290013167 */, 19 },
+ /* 7701 */ { MAD_F(0x04a41981) /* 0.290063387 */, 19 },
+ /* 7702 */ { MAD_F(0x04a44e2b) /* 0.290113609 */, 19 },
+ /* 7703 */ { MAD_F(0x04a482d5) /* 0.290163833 */, 19 },
+ /* 7704 */ { MAD_F(0x04a4b77f) /* 0.290214059 */, 19 },
+ /* 7705 */ { MAD_F(0x04a4ec2a) /* 0.290264288 */, 19 },
+ /* 7706 */ { MAD_F(0x04a520d6) /* 0.290314519 */, 19 },
+ /* 7707 */ { MAD_F(0x04a55582) /* 0.290364751 */, 19 },
+ /* 7708 */ { MAD_F(0x04a58a2f) /* 0.290414986 */, 19 },
+ /* 7709 */ { MAD_F(0x04a5bedd) /* 0.290465224 */, 19 },
+ /* 7710 */ { MAD_F(0x04a5f38b) /* 0.290515463 */, 19 },
+ /* 7711 */ { MAD_F(0x04a62839) /* 0.290565705 */, 19 },
+
+ /* 7712 */ { MAD_F(0x04a65ce8) /* 0.290615948 */, 19 },
+ /* 7713 */ { MAD_F(0x04a69198) /* 0.290666194 */, 19 },
+ /* 7714 */ { MAD_F(0x04a6c648) /* 0.290716442 */, 19 },
+ /* 7715 */ { MAD_F(0x04a6faf9) /* 0.290766692 */, 19 },
+ /* 7716 */ { MAD_F(0x04a72fab) /* 0.290816945 */, 19 },
+ /* 7717 */ { MAD_F(0x04a7645d) /* 0.290867199 */, 19 },
+ /* 7718 */ { MAD_F(0x04a79910) /* 0.290917456 */, 19 },
+ /* 7719 */ { MAD_F(0x04a7cdc3) /* 0.290967715 */, 19 },
+ /* 7720 */ { MAD_F(0x04a80277) /* 0.291017976 */, 19 },
+ /* 7721 */ { MAD_F(0x04a8372b) /* 0.291068239 */, 19 },
+ /* 7722 */ { MAD_F(0x04a86be0) /* 0.291118505 */, 19 },
+ /* 7723 */ { MAD_F(0x04a8a096) /* 0.291168772 */, 19 },
+ /* 7724 */ { MAD_F(0x04a8d54c) /* 0.291219042 */, 19 },
+ /* 7725 */ { MAD_F(0x04a90a03) /* 0.291269314 */, 19 },
+ /* 7726 */ { MAD_F(0x04a93eba) /* 0.291319588 */, 19 },
+ /* 7727 */ { MAD_F(0x04a97372) /* 0.291369865 */, 19 },
+
+ /* 7728 */ { MAD_F(0x04a9a82b) /* 0.291420143 */, 19 },
+ /* 7729 */ { MAD_F(0x04a9dce4) /* 0.291470424 */, 19 },
+ /* 7730 */ { MAD_F(0x04aa119d) /* 0.291520706 */, 19 },
+ /* 7731 */ { MAD_F(0x04aa4658) /* 0.291570991 */, 19 },
+ /* 7732 */ { MAD_F(0x04aa7b13) /* 0.291621278 */, 19 },
+ /* 7733 */ { MAD_F(0x04aaafce) /* 0.291671568 */, 19 },
+ /* 7734 */ { MAD_F(0x04aae48a) /* 0.291721859 */, 19 },
+ /* 7735 */ { MAD_F(0x04ab1947) /* 0.291772153 */, 19 },
+ /* 7736 */ { MAD_F(0x04ab4e04) /* 0.291822449 */, 19 },
+ /* 7737 */ { MAD_F(0x04ab82c2) /* 0.291872747 */, 19 },
+ /* 7738 */ { MAD_F(0x04abb780) /* 0.291923047 */, 19 },
+ /* 7739 */ { MAD_F(0x04abec3f) /* 0.291973349 */, 19 },
+ /* 7740 */ { MAD_F(0x04ac20fe) /* 0.292023653 */, 19 },
+ /* 7741 */ { MAD_F(0x04ac55be) /* 0.292073960 */, 19 },
+ /* 7742 */ { MAD_F(0x04ac8a7f) /* 0.292124269 */, 19 },
+ /* 7743 */ { MAD_F(0x04acbf40) /* 0.292174580 */, 19 },
+
+ /* 7744 */ { MAD_F(0x04acf402) /* 0.292224893 */, 19 },
+ /* 7745 */ { MAD_F(0x04ad28c5) /* 0.292275208 */, 19 },
+ /* 7746 */ { MAD_F(0x04ad5d88) /* 0.292325526 */, 19 },
+ /* 7747 */ { MAD_F(0x04ad924b) /* 0.292375845 */, 19 },
+ /* 7748 */ { MAD_F(0x04adc70f) /* 0.292426167 */, 19 },
+ /* 7749 */ { MAD_F(0x04adfbd4) /* 0.292476491 */, 19 },
+ /* 7750 */ { MAD_F(0x04ae3099) /* 0.292526817 */, 19 },
+ /* 7751 */ { MAD_F(0x04ae655f) /* 0.292577145 */, 19 },
+ /* 7752 */ { MAD_F(0x04ae9a26) /* 0.292627476 */, 19 },
+ /* 7753 */ { MAD_F(0x04aeceed) /* 0.292677808 */, 19 },
+ /* 7754 */ { MAD_F(0x04af03b4) /* 0.292728143 */, 19 },
+ /* 7755 */ { MAD_F(0x04af387d) /* 0.292778480 */, 19 },
+ /* 7756 */ { MAD_F(0x04af6d45) /* 0.292828819 */, 19 },
+ /* 7757 */ { MAD_F(0x04afa20f) /* 0.292879160 */, 19 },
+ /* 7758 */ { MAD_F(0x04afd6d9) /* 0.292929504 */, 19 },
+ /* 7759 */ { MAD_F(0x04b00ba3) /* 0.292979849 */, 19 },
+
+ /* 7760 */ { MAD_F(0x04b0406e) /* 0.293030197 */, 19 },
+ /* 7761 */ { MAD_F(0x04b0753a) /* 0.293080547 */, 19 },
+ /* 7762 */ { MAD_F(0x04b0aa06) /* 0.293130899 */, 19 },
+ /* 7763 */ { MAD_F(0x04b0ded3) /* 0.293181253 */, 19 },
+ /* 7764 */ { MAD_F(0x04b113a1) /* 0.293231610 */, 19 },
+ /* 7765 */ { MAD_F(0x04b1486f) /* 0.293281968 */, 19 },
+ /* 7766 */ { MAD_F(0x04b17d3d) /* 0.293332329 */, 19 },
+ /* 7767 */ { MAD_F(0x04b1b20c) /* 0.293382692 */, 19 },
+ /* 7768 */ { MAD_F(0x04b1e6dc) /* 0.293433057 */, 19 },
+ /* 7769 */ { MAD_F(0x04b21bad) /* 0.293483424 */, 19 },
+ /* 7770 */ { MAD_F(0x04b2507d) /* 0.293533794 */, 19 },
+ /* 7771 */ { MAD_F(0x04b2854f) /* 0.293584165 */, 19 },
+ /* 7772 */ { MAD_F(0x04b2ba21) /* 0.293634539 */, 19 },
+ /* 7773 */ { MAD_F(0x04b2eef4) /* 0.293684915 */, 19 },
+ /* 7774 */ { MAD_F(0x04b323c7) /* 0.293735293 */, 19 },
+ /* 7775 */ { MAD_F(0x04b3589b) /* 0.293785673 */, 19 },
+
+ /* 7776 */ { MAD_F(0x04b38d6f) /* 0.293836055 */, 19 },
+ /* 7777 */ { MAD_F(0x04b3c244) /* 0.293886440 */, 19 },
+ /* 7778 */ { MAD_F(0x04b3f71a) /* 0.293936826 */, 19 },
+ /* 7779 */ { MAD_F(0x04b42bf0) /* 0.293987215 */, 19 },
+ /* 7780 */ { MAD_F(0x04b460c7) /* 0.294037606 */, 19 },
+ /* 7781 */ { MAD_F(0x04b4959e) /* 0.294087999 */, 19 },
+ /* 7782 */ { MAD_F(0x04b4ca76) /* 0.294138395 */, 19 },
+ /* 7783 */ { MAD_F(0x04b4ff4e) /* 0.294188792 */, 19 },
+ /* 7784 */ { MAD_F(0x04b53427) /* 0.294239192 */, 19 },
+ /* 7785 */ { MAD_F(0x04b56901) /* 0.294289593 */, 19 },
+ /* 7786 */ { MAD_F(0x04b59ddb) /* 0.294339997 */, 19 },
+ /* 7787 */ { MAD_F(0x04b5d2b6) /* 0.294390403 */, 19 },
+ /* 7788 */ { MAD_F(0x04b60791) /* 0.294440812 */, 19 },
+ /* 7789 */ { MAD_F(0x04b63c6d) /* 0.294491222 */, 19 },
+ /* 7790 */ { MAD_F(0x04b6714a) /* 0.294541635 */, 19 },
+ /* 7791 */ { MAD_F(0x04b6a627) /* 0.294592049 */, 19 },
+
+ /* 7792 */ { MAD_F(0x04b6db05) /* 0.294642466 */, 19 },
+ /* 7793 */ { MAD_F(0x04b70fe3) /* 0.294692885 */, 19 },
+ /* 7794 */ { MAD_F(0x04b744c2) /* 0.294743306 */, 19 },
+ /* 7795 */ { MAD_F(0x04b779a1) /* 0.294793730 */, 19 },
+ /* 7796 */ { MAD_F(0x04b7ae81) /* 0.294844155 */, 19 },
+ /* 7797 */ { MAD_F(0x04b7e362) /* 0.294894583 */, 19 },
+ /* 7798 */ { MAD_F(0x04b81843) /* 0.294945013 */, 19 },
+ /* 7799 */ { MAD_F(0x04b84d24) /* 0.294995445 */, 19 },
+ /* 7800 */ { MAD_F(0x04b88207) /* 0.295045879 */, 19 },
+ /* 7801 */ { MAD_F(0x04b8b6ea) /* 0.295096315 */, 19 },
+ /* 7802 */ { MAD_F(0x04b8ebcd) /* 0.295146753 */, 19 },
+ /* 7803 */ { MAD_F(0x04b920b1) /* 0.295197194 */, 19 },
+ /* 7804 */ { MAD_F(0x04b95596) /* 0.295247637 */, 19 },
+ /* 7805 */ { MAD_F(0x04b98a7b) /* 0.295298082 */, 19 },
+ /* 7806 */ { MAD_F(0x04b9bf61) /* 0.295348529 */, 19 },
+ /* 7807 */ { MAD_F(0x04b9f447) /* 0.295398978 */, 19 },
+
+ /* 7808 */ { MAD_F(0x04ba292e) /* 0.295449429 */, 19 },
+ /* 7809 */ { MAD_F(0x04ba5e16) /* 0.295499883 */, 19 },
+ /* 7810 */ { MAD_F(0x04ba92fe) /* 0.295550338 */, 19 },
+ /* 7811 */ { MAD_F(0x04bac7e6) /* 0.295600796 */, 19 },
+ /* 7812 */ { MAD_F(0x04bafcd0) /* 0.295651256 */, 19 },
+ /* 7813 */ { MAD_F(0x04bb31b9) /* 0.295701718 */, 19 },
+ /* 7814 */ { MAD_F(0x04bb66a4) /* 0.295752183 */, 19 },
+ /* 7815 */ { MAD_F(0x04bb9b8f) /* 0.295802649 */, 19 },
+ /* 7816 */ { MAD_F(0x04bbd07a) /* 0.295853118 */, 19 },
+ /* 7817 */ { MAD_F(0x04bc0566) /* 0.295903588 */, 19 },
+ /* 7818 */ { MAD_F(0x04bc3a53) /* 0.295954061 */, 19 },
+ /* 7819 */ { MAD_F(0x04bc6f40) /* 0.296004536 */, 19 },
+ /* 7820 */ { MAD_F(0x04bca42e) /* 0.296055013 */, 19 },
+ /* 7821 */ { MAD_F(0x04bcd91d) /* 0.296105493 */, 19 },
+ /* 7822 */ { MAD_F(0x04bd0e0c) /* 0.296155974 */, 19 },
+ /* 7823 */ { MAD_F(0x04bd42fb) /* 0.296206458 */, 19 },
+
+ /* 7824 */ { MAD_F(0x04bd77ec) /* 0.296256944 */, 19 },
+ /* 7825 */ { MAD_F(0x04bdacdc) /* 0.296307432 */, 19 },
+ /* 7826 */ { MAD_F(0x04bde1ce) /* 0.296357922 */, 19 },
+ /* 7827 */ { MAD_F(0x04be16c0) /* 0.296408414 */, 19 },
+ /* 7828 */ { MAD_F(0x04be4bb2) /* 0.296458908 */, 19 },
+ /* 7829 */ { MAD_F(0x04be80a5) /* 0.296509405 */, 19 },
+ /* 7830 */ { MAD_F(0x04beb599) /* 0.296559904 */, 19 },
+ /* 7831 */ { MAD_F(0x04beea8d) /* 0.296610404 */, 19 },
+ /* 7832 */ { MAD_F(0x04bf1f82) /* 0.296660907 */, 19 },
+ /* 7833 */ { MAD_F(0x04bf5477) /* 0.296711413 */, 19 },
+ /* 7834 */ { MAD_F(0x04bf896d) /* 0.296761920 */, 19 },
+ /* 7835 */ { MAD_F(0x04bfbe64) /* 0.296812429 */, 19 },
+ /* 7836 */ { MAD_F(0x04bff35b) /* 0.296862941 */, 19 },
+ /* 7837 */ { MAD_F(0x04c02852) /* 0.296913455 */, 19 },
+ /* 7838 */ { MAD_F(0x04c05d4b) /* 0.296963971 */, 19 },
+ /* 7839 */ { MAD_F(0x04c09243) /* 0.297014489 */, 19 },
+
+ /* 7840 */ { MAD_F(0x04c0c73d) /* 0.297065009 */, 19 },
+ /* 7841 */ { MAD_F(0x04c0fc37) /* 0.297115531 */, 19 },
+ /* 7842 */ { MAD_F(0x04c13131) /* 0.297166056 */, 19 },
+ /* 7843 */ { MAD_F(0x04c1662d) /* 0.297216582 */, 19 },
+ /* 7844 */ { MAD_F(0x04c19b28) /* 0.297267111 */, 19 },
+ /* 7845 */ { MAD_F(0x04c1d025) /* 0.297317642 */, 19 },
+ /* 7846 */ { MAD_F(0x04c20521) /* 0.297368175 */, 19 },
+ /* 7847 */ { MAD_F(0x04c23a1f) /* 0.297418710 */, 19 },
+ /* 7848 */ { MAD_F(0x04c26f1d) /* 0.297469248 */, 19 },
+ /* 7849 */ { MAD_F(0x04c2a41b) /* 0.297519787 */, 19 },
+ /* 7850 */ { MAD_F(0x04c2d91b) /* 0.297570329 */, 19 },
+ /* 7851 */ { MAD_F(0x04c30e1a) /* 0.297620873 */, 19 },
+ /* 7852 */ { MAD_F(0x04c3431b) /* 0.297671418 */, 19 },
+ /* 7853 */ { MAD_F(0x04c3781c) /* 0.297721967 */, 19 },
+ /* 7854 */ { MAD_F(0x04c3ad1d) /* 0.297772517 */, 19 },
+ /* 7855 */ { MAD_F(0x04c3e21f) /* 0.297823069 */, 19 },
+
+ /* 7856 */ { MAD_F(0x04c41722) /* 0.297873624 */, 19 },
+ /* 7857 */ { MAD_F(0x04c44c25) /* 0.297924180 */, 19 },
+ /* 7858 */ { MAD_F(0x04c48129) /* 0.297974739 */, 19 },
+ /* 7859 */ { MAD_F(0x04c4b62d) /* 0.298025300 */, 19 },
+ /* 7860 */ { MAD_F(0x04c4eb32) /* 0.298075863 */, 19 },
+ /* 7861 */ { MAD_F(0x04c52038) /* 0.298126429 */, 19 },
+ /* 7862 */ { MAD_F(0x04c5553e) /* 0.298176996 */, 19 },
+ /* 7863 */ { MAD_F(0x04c58a44) /* 0.298227565 */, 19 },
+ /* 7864 */ { MAD_F(0x04c5bf4c) /* 0.298278137 */, 19 },
+ /* 7865 */ { MAD_F(0x04c5f453) /* 0.298328711 */, 19 },
+ /* 7866 */ { MAD_F(0x04c6295c) /* 0.298379287 */, 19 },
+ /* 7867 */ { MAD_F(0x04c65e65) /* 0.298429865 */, 19 },
+ /* 7868 */ { MAD_F(0x04c6936e) /* 0.298480445 */, 19 },
+ /* 7869 */ { MAD_F(0x04c6c878) /* 0.298531028 */, 19 },
+ /* 7870 */ { MAD_F(0x04c6fd83) /* 0.298581612 */, 19 },
+ /* 7871 */ { MAD_F(0x04c7328e) /* 0.298632199 */, 19 },
+
+ /* 7872 */ { MAD_F(0x04c7679a) /* 0.298682788 */, 19 },
+ /* 7873 */ { MAD_F(0x04c79ca7) /* 0.298733379 */, 19 },
+ /* 7874 */ { MAD_F(0x04c7d1b4) /* 0.298783972 */, 19 },
+ /* 7875 */ { MAD_F(0x04c806c1) /* 0.298834567 */, 19 },
+ /* 7876 */ { MAD_F(0x04c83bcf) /* 0.298885165 */, 19 },
+ /* 7877 */ { MAD_F(0x04c870de) /* 0.298935764 */, 19 },
+ /* 7878 */ { MAD_F(0x04c8a5ed) /* 0.298986366 */, 19 },
+ /* 7879 */ { MAD_F(0x04c8dafd) /* 0.299036970 */, 19 },
+ /* 7880 */ { MAD_F(0x04c9100d) /* 0.299087576 */, 19 },
+ /* 7881 */ { MAD_F(0x04c9451e) /* 0.299138184 */, 19 },
+ /* 7882 */ { MAD_F(0x04c97a30) /* 0.299188794 */, 19 },
+ /* 7883 */ { MAD_F(0x04c9af42) /* 0.299239406 */, 19 },
+ /* 7884 */ { MAD_F(0x04c9e455) /* 0.299290021 */, 19 },
+ /* 7885 */ { MAD_F(0x04ca1968) /* 0.299340638 */, 19 },
+ /* 7886 */ { MAD_F(0x04ca4e7c) /* 0.299391256 */, 19 },
+ /* 7887 */ { MAD_F(0x04ca8391) /* 0.299441877 */, 19 },
+
+ /* 7888 */ { MAD_F(0x04cab8a6) /* 0.299492500 */, 19 },
+ /* 7889 */ { MAD_F(0x04caedbb) /* 0.299543126 */, 19 },
+ /* 7890 */ { MAD_F(0x04cb22d1) /* 0.299593753 */, 19 },
+ /* 7891 */ { MAD_F(0x04cb57e8) /* 0.299644382 */, 19 },
+ /* 7892 */ { MAD_F(0x04cb8d00) /* 0.299695014 */, 19 },
+ /* 7893 */ { MAD_F(0x04cbc217) /* 0.299745648 */, 19 },
+ /* 7894 */ { MAD_F(0x04cbf730) /* 0.299796284 */, 19 },
+ /* 7895 */ { MAD_F(0x04cc2c49) /* 0.299846922 */, 19 },
+ /* 7896 */ { MAD_F(0x04cc6163) /* 0.299897562 */, 19 },
+ /* 7897 */ { MAD_F(0x04cc967d) /* 0.299948204 */, 19 },
+ /* 7898 */ { MAD_F(0x04cccb98) /* 0.299998849 */, 19 },
+ /* 7899 */ { MAD_F(0x04cd00b3) /* 0.300049495 */, 19 },
+ /* 7900 */ { MAD_F(0x04cd35cf) /* 0.300100144 */, 19 },
+ /* 7901 */ { MAD_F(0x04cd6aeb) /* 0.300150795 */, 19 },
+ /* 7902 */ { MAD_F(0x04cda008) /* 0.300201448 */, 19 },
+ /* 7903 */ { MAD_F(0x04cdd526) /* 0.300252103 */, 19 },
+
+ /* 7904 */ { MAD_F(0x04ce0a44) /* 0.300302761 */, 19 },
+ /* 7905 */ { MAD_F(0x04ce3f63) /* 0.300353420 */, 19 },
+ /* 7906 */ { MAD_F(0x04ce7482) /* 0.300404082 */, 19 },
+ /* 7907 */ { MAD_F(0x04cea9a2) /* 0.300454745 */, 19 },
+ /* 7908 */ { MAD_F(0x04cedec3) /* 0.300505411 */, 19 },
+ /* 7909 */ { MAD_F(0x04cf13e4) /* 0.300556079 */, 19 },
+ /* 7910 */ { MAD_F(0x04cf4906) /* 0.300606749 */, 19 },
+ /* 7911 */ { MAD_F(0x04cf7e28) /* 0.300657421 */, 19 },
+ /* 7912 */ { MAD_F(0x04cfb34b) /* 0.300708096 */, 19 },
+ /* 7913 */ { MAD_F(0x04cfe86e) /* 0.300758772 */, 19 },
+ /* 7914 */ { MAD_F(0x04d01d92) /* 0.300809451 */, 19 },
+ /* 7915 */ { MAD_F(0x04d052b6) /* 0.300860132 */, 19 },
+ /* 7916 */ { MAD_F(0x04d087db) /* 0.300910815 */, 19 },
+ /* 7917 */ { MAD_F(0x04d0bd01) /* 0.300961500 */, 19 },
+ /* 7918 */ { MAD_F(0x04d0f227) /* 0.301012187 */, 19 },
+ /* 7919 */ { MAD_F(0x04d1274e) /* 0.301062876 */, 19 },
+
+ /* 7920 */ { MAD_F(0x04d15c76) /* 0.301113568 */, 19 },
+ /* 7921 */ { MAD_F(0x04d1919e) /* 0.301164261 */, 19 },
+ /* 7922 */ { MAD_F(0x04d1c6c6) /* 0.301214957 */, 19 },
+ /* 7923 */ { MAD_F(0x04d1fbef) /* 0.301265655 */, 19 },
+ /* 7924 */ { MAD_F(0x04d23119) /* 0.301316355 */, 19 },
+ /* 7925 */ { MAD_F(0x04d26643) /* 0.301367057 */, 19 },
+ /* 7926 */ { MAD_F(0x04d29b6e) /* 0.301417761 */, 19 },
+ /* 7927 */ { MAD_F(0x04d2d099) /* 0.301468468 */, 19 },
+ /* 7928 */ { MAD_F(0x04d305c5) /* 0.301519176 */, 19 },
+ /* 7929 */ { MAD_F(0x04d33af2) /* 0.301569887 */, 19 },
+ /* 7930 */ { MAD_F(0x04d3701f) /* 0.301620599 */, 19 },
+ /* 7931 */ { MAD_F(0x04d3a54d) /* 0.301671314 */, 19 },
+ /* 7932 */ { MAD_F(0x04d3da7b) /* 0.301722031 */, 19 },
+ /* 7933 */ { MAD_F(0x04d40faa) /* 0.301772751 */, 19 },
+ /* 7934 */ { MAD_F(0x04d444d9) /* 0.301823472 */, 19 },
+ /* 7935 */ { MAD_F(0x04d47a09) /* 0.301874195 */, 19 },
+
+ /* 7936 */ { MAD_F(0x04d4af3a) /* 0.301924921 */, 19 },
+ /* 7937 */ { MAD_F(0x04d4e46b) /* 0.301975649 */, 19 },
+ /* 7938 */ { MAD_F(0x04d5199c) /* 0.302026378 */, 19 },
+ /* 7939 */ { MAD_F(0x04d54ecf) /* 0.302077110 */, 19 },
+ /* 7940 */ { MAD_F(0x04d58401) /* 0.302127845 */, 19 },
+ /* 7941 */ { MAD_F(0x04d5b935) /* 0.302178581 */, 19 },
+ /* 7942 */ { MAD_F(0x04d5ee69) /* 0.302229319 */, 19 },
+ /* 7943 */ { MAD_F(0x04d6239d) /* 0.302280060 */, 19 },
+ /* 7944 */ { MAD_F(0x04d658d2) /* 0.302330802 */, 19 },
+ /* 7945 */ { MAD_F(0x04d68e08) /* 0.302381547 */, 19 },
+ /* 7946 */ { MAD_F(0x04d6c33e) /* 0.302432294 */, 19 },
+ /* 7947 */ { MAD_F(0x04d6f875) /* 0.302483043 */, 19 },
+ /* 7948 */ { MAD_F(0x04d72dad) /* 0.302533794 */, 19 },
+ /* 7949 */ { MAD_F(0x04d762e5) /* 0.302584547 */, 19 },
+ /* 7950 */ { MAD_F(0x04d7981d) /* 0.302635303 */, 19 },
+ /* 7951 */ { MAD_F(0x04d7cd56) /* 0.302686060 */, 19 },
+
+ /* 7952 */ { MAD_F(0x04d80290) /* 0.302736820 */, 19 },
+ /* 7953 */ { MAD_F(0x04d837ca) /* 0.302787581 */, 19 },
+ /* 7954 */ { MAD_F(0x04d86d05) /* 0.302838345 */, 19 },
+ /* 7955 */ { MAD_F(0x04d8a240) /* 0.302889111 */, 19 },
+ /* 7956 */ { MAD_F(0x04d8d77c) /* 0.302939879 */, 19 },
+ /* 7957 */ { MAD_F(0x04d90cb9) /* 0.302990650 */, 19 },
+ /* 7958 */ { MAD_F(0x04d941f6) /* 0.303041422 */, 19 },
+ /* 7959 */ { MAD_F(0x04d97734) /* 0.303092197 */, 19 },
+ /* 7960 */ { MAD_F(0x04d9ac72) /* 0.303142973 */, 19 },
+ /* 7961 */ { MAD_F(0x04d9e1b1) /* 0.303193752 */, 19 },
+ /* 7962 */ { MAD_F(0x04da16f0) /* 0.303244533 */, 19 },
+ /* 7963 */ { MAD_F(0x04da4c30) /* 0.303295316 */, 19 },
+ /* 7964 */ { MAD_F(0x04da8171) /* 0.303346101 */, 19 },
+ /* 7965 */ { MAD_F(0x04dab6b2) /* 0.303396889 */, 19 },
+ /* 7966 */ { MAD_F(0x04daebf4) /* 0.303447678 */, 19 },
+ /* 7967 */ { MAD_F(0x04db2136) /* 0.303498469 */, 19 },
+
+ /* 7968 */ { MAD_F(0x04db5679) /* 0.303549263 */, 19 },
+ /* 7969 */ { MAD_F(0x04db8bbc) /* 0.303600059 */, 19 },
+ /* 7970 */ { MAD_F(0x04dbc100) /* 0.303650857 */, 19 },
+ /* 7971 */ { MAD_F(0x04dbf644) /* 0.303701657 */, 19 },
+ /* 7972 */ { MAD_F(0x04dc2b8a) /* 0.303752459 */, 19 },
+ /* 7973 */ { MAD_F(0x04dc60cf) /* 0.303803263 */, 19 },
+ /* 7974 */ { MAD_F(0x04dc9616) /* 0.303854070 */, 19 },
+ /* 7975 */ { MAD_F(0x04dccb5c) /* 0.303904878 */, 19 },
+ /* 7976 */ { MAD_F(0x04dd00a4) /* 0.303955689 */, 19 },
+ /* 7977 */ { MAD_F(0x04dd35ec) /* 0.304006502 */, 19 },
+ /* 7978 */ { MAD_F(0x04dd6b34) /* 0.304057317 */, 19 },
+ /* 7979 */ { MAD_F(0x04dda07d) /* 0.304108134 */, 19 },
+ /* 7980 */ { MAD_F(0x04ddd5c7) /* 0.304158953 */, 19 },
+ /* 7981 */ { MAD_F(0x04de0b11) /* 0.304209774 */, 19 },
+ /* 7982 */ { MAD_F(0x04de405c) /* 0.304260597 */, 19 },
+ /* 7983 */ { MAD_F(0x04de75a7) /* 0.304311423 */, 19 },
+
+ /* 7984 */ { MAD_F(0x04deaaf3) /* 0.304362251 */, 19 },
+ /* 7985 */ { MAD_F(0x04dee040) /* 0.304413080 */, 19 },
+ /* 7986 */ { MAD_F(0x04df158d) /* 0.304463912 */, 19 },
+ /* 7987 */ { MAD_F(0x04df4adb) /* 0.304514746 */, 19 },
+ /* 7988 */ { MAD_F(0x04df8029) /* 0.304565582 */, 19 },
+ /* 7989 */ { MAD_F(0x04dfb578) /* 0.304616421 */, 19 },
+ /* 7990 */ { MAD_F(0x04dfeac7) /* 0.304667261 */, 19 },
+ /* 7991 */ { MAD_F(0x04e02017) /* 0.304718103 */, 19 },
+ /* 7992 */ { MAD_F(0x04e05567) /* 0.304768948 */, 19 },
+ /* 7993 */ { MAD_F(0x04e08ab8) /* 0.304819795 */, 19 },
+ /* 7994 */ { MAD_F(0x04e0c00a) /* 0.304870644 */, 19 },
+ /* 7995 */ { MAD_F(0x04e0f55c) /* 0.304921495 */, 19 },
+ /* 7996 */ { MAD_F(0x04e12aaf) /* 0.304972348 */, 19 },
+ /* 7997 */ { MAD_F(0x04e16002) /* 0.305023203 */, 19 },
+ /* 7998 */ { MAD_F(0x04e19556) /* 0.305074060 */, 19 },
+ /* 7999 */ { MAD_F(0x04e1caab) /* 0.305124920 */, 19 },
+
+ /* 8000 */ { MAD_F(0x04e20000) /* 0.305175781 */, 19 },
+ /* 8001 */ { MAD_F(0x04e23555) /* 0.305226645 */, 19 },
+ /* 8002 */ { MAD_F(0x04e26aac) /* 0.305277511 */, 19 },
+ /* 8003 */ { MAD_F(0x04e2a002) /* 0.305328379 */, 19 },
+ /* 8004 */ { MAD_F(0x04e2d55a) /* 0.305379249 */, 19 },
+ /* 8005 */ { MAD_F(0x04e30ab2) /* 0.305430121 */, 19 },
+ /* 8006 */ { MAD_F(0x04e3400a) /* 0.305480995 */, 19 },
+ /* 8007 */ { MAD_F(0x04e37563) /* 0.305531872 */, 19 },
+ /* 8008 */ { MAD_F(0x04e3aabd) /* 0.305582750 */, 19 },
+ /* 8009 */ { MAD_F(0x04e3e017) /* 0.305633631 */, 19 },
+ /* 8010 */ { MAD_F(0x04e41572) /* 0.305684513 */, 19 },
+ /* 8011 */ { MAD_F(0x04e44acd) /* 0.305735398 */, 19 },
+ /* 8012 */ { MAD_F(0x04e48029) /* 0.305786285 */, 19 },
+ /* 8013 */ { MAD_F(0x04e4b585) /* 0.305837174 */, 19 },
+ /* 8014 */ { MAD_F(0x04e4eae2) /* 0.305888066 */, 19 },
+ /* 8015 */ { MAD_F(0x04e52040) /* 0.305938959 */, 19 },
+
+ /* 8016 */ { MAD_F(0x04e5559e) /* 0.305989854 */, 19 },
+ /* 8017 */ { MAD_F(0x04e58afd) /* 0.306040752 */, 19 },
+ /* 8018 */ { MAD_F(0x04e5c05c) /* 0.306091652 */, 19 },
+ /* 8019 */ { MAD_F(0x04e5f5bc) /* 0.306142554 */, 19 },
+ /* 8020 */ { MAD_F(0x04e62b1c) /* 0.306193457 */, 19 },
+ /* 8021 */ { MAD_F(0x04e6607d) /* 0.306244364 */, 19 },
+ /* 8022 */ { MAD_F(0x04e695df) /* 0.306295272 */, 19 },
+ /* 8023 */ { MAD_F(0x04e6cb41) /* 0.306346182 */, 19 },
+ /* 8024 */ { MAD_F(0x04e700a3) /* 0.306397094 */, 19 },
+ /* 8025 */ { MAD_F(0x04e73607) /* 0.306448009 */, 19 },
+ /* 8026 */ { MAD_F(0x04e76b6b) /* 0.306498925 */, 19 },
+ /* 8027 */ { MAD_F(0x04e7a0cf) /* 0.306549844 */, 19 },
+ /* 8028 */ { MAD_F(0x04e7d634) /* 0.306600765 */, 19 },
+ /* 8029 */ { MAD_F(0x04e80b99) /* 0.306651688 */, 19 },
+ /* 8030 */ { MAD_F(0x04e84100) /* 0.306702613 */, 19 },
+ /* 8031 */ { MAD_F(0x04e87666) /* 0.306753540 */, 19 },
+
+ /* 8032 */ { MAD_F(0x04e8abcd) /* 0.306804470 */, 19 },
+ /* 8033 */ { MAD_F(0x04e8e135) /* 0.306855401 */, 19 },
+ /* 8034 */ { MAD_F(0x04e9169e) /* 0.306906334 */, 19 },
+ /* 8035 */ { MAD_F(0x04e94c07) /* 0.306957270 */, 19 },
+ /* 8036 */ { MAD_F(0x04e98170) /* 0.307008208 */, 19 },
+ /* 8037 */ { MAD_F(0x04e9b6da) /* 0.307059148 */, 19 },
+ /* 8038 */ { MAD_F(0x04e9ec45) /* 0.307110090 */, 19 },
+ /* 8039 */ { MAD_F(0x04ea21b0) /* 0.307161034 */, 19 },
+ /* 8040 */ { MAD_F(0x04ea571c) /* 0.307211980 */, 19 },
+ /* 8041 */ { MAD_F(0x04ea8c88) /* 0.307262928 */, 19 },
+ /* 8042 */ { MAD_F(0x04eac1f5) /* 0.307313879 */, 19 },
+ /* 8043 */ { MAD_F(0x04eaf762) /* 0.307364831 */, 19 },
+ /* 8044 */ { MAD_F(0x04eb2cd0) /* 0.307415786 */, 19 },
+ /* 8045 */ { MAD_F(0x04eb623f) /* 0.307466743 */, 19 },
+ /* 8046 */ { MAD_F(0x04eb97ae) /* 0.307517702 */, 19 },
+ /* 8047 */ { MAD_F(0x04ebcd1e) /* 0.307568663 */, 19 },
+
+ /* 8048 */ { MAD_F(0x04ec028e) /* 0.307619626 */, 19 },
+ /* 8049 */ { MAD_F(0x04ec37ff) /* 0.307670591 */, 19 },
+ /* 8050 */ { MAD_F(0x04ec6d71) /* 0.307721558 */, 19 },
+ /* 8051 */ { MAD_F(0x04eca2e3) /* 0.307772528 */, 19 },
+ /* 8052 */ { MAD_F(0x04ecd855) /* 0.307823499 */, 19 },
+ /* 8053 */ { MAD_F(0x04ed0dc8) /* 0.307874473 */, 19 },
+ /* 8054 */ { MAD_F(0x04ed433c) /* 0.307925449 */, 19 },
+ /* 8055 */ { MAD_F(0x04ed78b0) /* 0.307976426 */, 19 },
+ /* 8056 */ { MAD_F(0x04edae25) /* 0.308027406 */, 19 },
+ /* 8057 */ { MAD_F(0x04ede39a) /* 0.308078389 */, 19 },
+ /* 8058 */ { MAD_F(0x04ee1910) /* 0.308129373 */, 19 },
+ /* 8059 */ { MAD_F(0x04ee4e87) /* 0.308180359 */, 19 },
+ /* 8060 */ { MAD_F(0x04ee83fe) /* 0.308231347 */, 19 },
+ /* 8061 */ { MAD_F(0x04eeb976) /* 0.308282338 */, 19 },
+ /* 8062 */ { MAD_F(0x04eeeeee) /* 0.308333331 */, 19 },
+ /* 8063 */ { MAD_F(0x04ef2467) /* 0.308384325 */, 19 },
+
+ /* 8064 */ { MAD_F(0x04ef59e0) /* 0.308435322 */, 19 },
+ /* 8065 */ { MAD_F(0x04ef8f5a) /* 0.308486321 */, 19 },
+ /* 8066 */ { MAD_F(0x04efc4d5) /* 0.308537322 */, 19 },
+ /* 8067 */ { MAD_F(0x04effa50) /* 0.308588325 */, 19 },
+ /* 8068 */ { MAD_F(0x04f02fcb) /* 0.308639331 */, 19 },
+ /* 8069 */ { MAD_F(0x04f06547) /* 0.308690338 */, 19 },
+ /* 8070 */ { MAD_F(0x04f09ac4) /* 0.308741348 */, 19 },
+ /* 8071 */ { MAD_F(0x04f0d041) /* 0.308792359 */, 19 },
+ /* 8072 */ { MAD_F(0x04f105bf) /* 0.308843373 */, 19 },
+ /* 8073 */ { MAD_F(0x04f13b3e) /* 0.308894389 */, 19 },
+ /* 8074 */ { MAD_F(0x04f170bd) /* 0.308945407 */, 19 },
+ /* 8075 */ { MAD_F(0x04f1a63c) /* 0.308996427 */, 19 },
+ /* 8076 */ { MAD_F(0x04f1dbbd) /* 0.309047449 */, 19 },
+ /* 8077 */ { MAD_F(0x04f2113d) /* 0.309098473 */, 19 },
+ /* 8078 */ { MAD_F(0x04f246bf) /* 0.309149499 */, 19 },
+ /* 8079 */ { MAD_F(0x04f27c40) /* 0.309200528 */, 19 },
+
+ /* 8080 */ { MAD_F(0x04f2b1c3) /* 0.309251558 */, 19 },
+ /* 8081 */ { MAD_F(0x04f2e746) /* 0.309302591 */, 19 },
+ /* 8082 */ { MAD_F(0x04f31cc9) /* 0.309353626 */, 19 },
+ /* 8083 */ { MAD_F(0x04f3524d) /* 0.309404663 */, 19 },
+ /* 8084 */ { MAD_F(0x04f387d2) /* 0.309455702 */, 19 },
+ /* 8085 */ { MAD_F(0x04f3bd57) /* 0.309506743 */, 19 },
+ /* 8086 */ { MAD_F(0x04f3f2dd) /* 0.309557786 */, 19 },
+ /* 8087 */ { MAD_F(0x04f42864) /* 0.309608831 */, 19 },
+ /* 8088 */ { MAD_F(0x04f45dea) /* 0.309659879 */, 19 },
+ /* 8089 */ { MAD_F(0x04f49372) /* 0.309710928 */, 19 },
+ /* 8090 */ { MAD_F(0x04f4c8fa) /* 0.309761980 */, 19 },
+ /* 8091 */ { MAD_F(0x04f4fe83) /* 0.309813033 */, 19 },
+ /* 8092 */ { MAD_F(0x04f5340c) /* 0.309864089 */, 19 },
+ /* 8093 */ { MAD_F(0x04f56996) /* 0.309915147 */, 19 },
+ /* 8094 */ { MAD_F(0x04f59f20) /* 0.309966207 */, 19 },
+ /* 8095 */ { MAD_F(0x04f5d4ab) /* 0.310017269 */, 19 },
+
+ /* 8096 */ { MAD_F(0x04f60a36) /* 0.310068333 */, 19 },
+ /* 8097 */ { MAD_F(0x04f63fc2) /* 0.310119400 */, 19 },
+ /* 8098 */ { MAD_F(0x04f6754f) /* 0.310170468 */, 19 },
+ /* 8099 */ { MAD_F(0x04f6aadc) /* 0.310221539 */, 19 },
+ /* 8100 */ { MAD_F(0x04f6e06a) /* 0.310272611 */, 19 },
+ /* 8101 */ { MAD_F(0x04f715f8) /* 0.310323686 */, 19 },
+ /* 8102 */ { MAD_F(0x04f74b87) /* 0.310374763 */, 19 },
+ /* 8103 */ { MAD_F(0x04f78116) /* 0.310425842 */, 19 },
+ /* 8104 */ { MAD_F(0x04f7b6a6) /* 0.310476923 */, 19 },
+ /* 8105 */ { MAD_F(0x04f7ec37) /* 0.310528006 */, 19 },
+ /* 8106 */ { MAD_F(0x04f821c8) /* 0.310579091 */, 19 },
+ /* 8107 */ { MAD_F(0x04f85759) /* 0.310630179 */, 19 },
+ /* 8108 */ { MAD_F(0x04f88cec) /* 0.310681268 */, 19 },
+ /* 8109 */ { MAD_F(0x04f8c27e) /* 0.310732360 */, 19 },
+ /* 8110 */ { MAD_F(0x04f8f812) /* 0.310783453 */, 19 },
+ /* 8111 */ { MAD_F(0x04f92da6) /* 0.310834549 */, 19 },
+
+ /* 8112 */ { MAD_F(0x04f9633a) /* 0.310885647 */, 19 },
+ /* 8113 */ { MAD_F(0x04f998cf) /* 0.310936747 */, 19 },
+ /* 8114 */ { MAD_F(0x04f9ce65) /* 0.310987849 */, 19 },
+ /* 8115 */ { MAD_F(0x04fa03fb) /* 0.311038953 */, 19 },
+ /* 8116 */ { MAD_F(0x04fa3992) /* 0.311090059 */, 19 },
+ /* 8117 */ { MAD_F(0x04fa6f29) /* 0.311141168 */, 19 },
+ /* 8118 */ { MAD_F(0x04faa4c1) /* 0.311192278 */, 19 },
+ /* 8119 */ { MAD_F(0x04fada59) /* 0.311243390 */, 19 },
+ /* 8120 */ { MAD_F(0x04fb0ff2) /* 0.311294505 */, 19 },
+ /* 8121 */ { MAD_F(0x04fb458c) /* 0.311345622 */, 19 },
+ /* 8122 */ { MAD_F(0x04fb7b26) /* 0.311396741 */, 19 },
+ /* 8123 */ { MAD_F(0x04fbb0c1) /* 0.311447862 */, 19 },
+ /* 8124 */ { MAD_F(0x04fbe65c) /* 0.311498985 */, 19 },
+ /* 8125 */ { MAD_F(0x04fc1bf8) /* 0.311550110 */, 19 },
+ /* 8126 */ { MAD_F(0x04fc5194) /* 0.311601237 */, 19 },
+ /* 8127 */ { MAD_F(0x04fc8731) /* 0.311652366 */, 19 },
+
+ /* 8128 */ { MAD_F(0x04fcbcce) /* 0.311703498 */, 19 },
+ /* 8129 */ { MAD_F(0x04fcf26c) /* 0.311754631 */, 19 },
+ /* 8130 */ { MAD_F(0x04fd280b) /* 0.311805767 */, 19 },
+ /* 8131 */ { MAD_F(0x04fd5daa) /* 0.311856905 */, 19 },
+ /* 8132 */ { MAD_F(0x04fd934a) /* 0.311908044 */, 19 },
+ /* 8133 */ { MAD_F(0x04fdc8ea) /* 0.311959186 */, 19 },
+ /* 8134 */ { MAD_F(0x04fdfe8b) /* 0.312010330 */, 19 },
+ /* 8135 */ { MAD_F(0x04fe342c) /* 0.312061476 */, 19 },
+ /* 8136 */ { MAD_F(0x04fe69ce) /* 0.312112625 */, 19 },
+ /* 8137 */ { MAD_F(0x04fe9f71) /* 0.312163775 */, 19 },
+ /* 8138 */ { MAD_F(0x04fed514) /* 0.312214927 */, 19 },
+ /* 8139 */ { MAD_F(0x04ff0ab8) /* 0.312266082 */, 19 },
+ /* 8140 */ { MAD_F(0x04ff405c) /* 0.312317238 */, 19 },
+ /* 8141 */ { MAD_F(0x04ff7601) /* 0.312368397 */, 19 },
+ /* 8142 */ { MAD_F(0x04ffaba6) /* 0.312419558 */, 19 },
+ /* 8143 */ { MAD_F(0x04ffe14c) /* 0.312470720 */, 19 },
+
+ /* 8144 */ { MAD_F(0x050016f3) /* 0.312521885 */, 19 },
+ /* 8145 */ { MAD_F(0x05004c9a) /* 0.312573052 */, 19 },
+ /* 8146 */ { MAD_F(0x05008241) /* 0.312624222 */, 19 },
+ /* 8147 */ { MAD_F(0x0500b7e9) /* 0.312675393 */, 19 },
+ /* 8148 */ { MAD_F(0x0500ed92) /* 0.312726566 */, 19 },
+ /* 8149 */ { MAD_F(0x0501233b) /* 0.312777742 */, 19 },
+ /* 8150 */ { MAD_F(0x050158e5) /* 0.312828919 */, 19 },
+ /* 8151 */ { MAD_F(0x05018e90) /* 0.312880099 */, 19 },
+ /* 8152 */ { MAD_F(0x0501c43b) /* 0.312931280 */, 19 },
+ /* 8153 */ { MAD_F(0x0501f9e6) /* 0.312982464 */, 19 },
+ /* 8154 */ { MAD_F(0x05022f92) /* 0.313033650 */, 19 },
+ /* 8155 */ { MAD_F(0x0502653f) /* 0.313084838 */, 19 },
+ /* 8156 */ { MAD_F(0x05029aec) /* 0.313136028 */, 19 },
+ /* 8157 */ { MAD_F(0x0502d09a) /* 0.313187220 */, 19 },
+ /* 8158 */ { MAD_F(0x05030648) /* 0.313238414 */, 19 },
+ /* 8159 */ { MAD_F(0x05033bf7) /* 0.313289611 */, 19 },
+
+ /* 8160 */ { MAD_F(0x050371a7) /* 0.313340809 */, 19 },
+ /* 8161 */ { MAD_F(0x0503a757) /* 0.313392010 */, 19 },
+ /* 8162 */ { MAD_F(0x0503dd07) /* 0.313443212 */, 19 },
+ /* 8163 */ { MAD_F(0x050412b9) /* 0.313494417 */, 19 },
+ /* 8164 */ { MAD_F(0x0504486a) /* 0.313545624 */, 19 },
+ /* 8165 */ { MAD_F(0x05047e1d) /* 0.313596833 */, 19 },
+ /* 8166 */ { MAD_F(0x0504b3cf) /* 0.313648044 */, 19 },
+ /* 8167 */ { MAD_F(0x0504e983) /* 0.313699257 */, 19 },
+ /* 8168 */ { MAD_F(0x05051f37) /* 0.313750472 */, 19 },
+ /* 8169 */ { MAD_F(0x050554eb) /* 0.313801689 */, 19 },
+ /* 8170 */ { MAD_F(0x05058aa0) /* 0.313852909 */, 19 },
+ /* 8171 */ { MAD_F(0x0505c056) /* 0.313904130 */, 19 },
+ /* 8172 */ { MAD_F(0x0505f60c) /* 0.313955354 */, 19 },
+ /* 8173 */ { MAD_F(0x05062bc3) /* 0.314006579 */, 19 },
+ /* 8174 */ { MAD_F(0x0506617a) /* 0.314057807 */, 19 },
+ /* 8175 */ { MAD_F(0x05069732) /* 0.314109037 */, 19 },
+
+ /* 8176 */ { MAD_F(0x0506cceb) /* 0.314160269 */, 19 },
+ /* 8177 */ { MAD_F(0x050702a4) /* 0.314211502 */, 19 },
+ /* 8178 */ { MAD_F(0x0507385d) /* 0.314262739 */, 19 },
+ /* 8179 */ { MAD_F(0x05076e17) /* 0.314313977 */, 19 },
+ /* 8180 */ { MAD_F(0x0507a3d2) /* 0.314365217 */, 19 },
+ /* 8181 */ { MAD_F(0x0507d98d) /* 0.314416459 */, 19 },
+ /* 8182 */ { MAD_F(0x05080f49) /* 0.314467704 */, 19 },
+ /* 8183 */ { MAD_F(0x05084506) /* 0.314518950 */, 19 },
+ /* 8184 */ { MAD_F(0x05087ac2) /* 0.314570199 */, 19 },
+ /* 8185 */ { MAD_F(0x0508b080) /* 0.314621449 */, 19 },
+ /* 8186 */ { MAD_F(0x0508e63e) /* 0.314672702 */, 19 },
+ /* 8187 */ { MAD_F(0x05091bfd) /* 0.314723957 */, 19 },
+ /* 8188 */ { MAD_F(0x050951bc) /* 0.314775214 */, 19 },
+ /* 8189 */ { MAD_F(0x0509877c) /* 0.314826473 */, 19 },
+ /* 8190 */ { MAD_F(0x0509bd3c) /* 0.314877734 */, 19 },
+ /* 8191 */ { MAD_F(0x0509f2fd) /* 0.314928997 */, 19 },
+
+ /* 8192 */ { MAD_F(0x050a28be) /* 0.314980262 */, 19 },
+ /* 8193 */ { MAD_F(0x050a5e80) /* 0.315031530 */, 19 },
+ /* 8194 */ { MAD_F(0x050a9443) /* 0.315082799 */, 19 },
+ /* 8195 */ { MAD_F(0x050aca06) /* 0.315134071 */, 19 },
+ /* 8196 */ { MAD_F(0x050affc9) /* 0.315185344 */, 19 },
+ /* 8197 */ { MAD_F(0x050b358e) /* 0.315236620 */, 19 },
+ /* 8198 */ { MAD_F(0x050b6b52) /* 0.315287898 */, 19 },
+ /* 8199 */ { MAD_F(0x050ba118) /* 0.315339178 */, 19 },
+ /* 8200 */ { MAD_F(0x050bd6de) /* 0.315390460 */, 19 },
+ /* 8201 */ { MAD_F(0x050c0ca4) /* 0.315441744 */, 19 },
+ /* 8202 */ { MAD_F(0x050c426b) /* 0.315493030 */, 19 },
+ /* 8203 */ { MAD_F(0x050c7833) /* 0.315544318 */, 19 },
+ /* 8204 */ { MAD_F(0x050cadfb) /* 0.315595608 */, 19 },
+ /* 8205 */ { MAD_F(0x050ce3c4) /* 0.315646901 */, 19 },
+ /* 8206 */ { MAD_F(0x050d198d) /* 0.315698195 */, 19 }
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/sf_table.dat b/src/filters/transform/mpadecfilter/libmad-0.15.0b/sf_table.dat
new file mode 100644
index 000000000..d4295af97
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/sf_table.dat
@@ -0,0 +1,106 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: sf_table.dat,v 1.6 2003/05/27 22:40:37 rob Exp $
+ */
+
+/*
+ * These are the scalefactor values for Layer I and Layer II.
+ * The values are from Table B.1 of ISO/IEC 11172-3.
+ *
+ * There is some error introduced by the 32-bit fixed-point representation;
+ * the amount of error is shown. For 16-bit PCM output, this shouldn't be
+ * too much of a problem.
+ *
+ * Strictly speaking, Table B.1 has only 63 entries (0-62), thus a strict
+ * interpretation of ISO/IEC 11172-3 would suggest that a scalefactor index of
+ * 63 is invalid. However, for better compatibility with current practices, we
+ * add a 64th entry.
+ */
+
+ MAD_F(0x20000000), /* 2.000000000000 => 2.000000000000, e 0.000000000000 */
+ MAD_F(0x1965fea5), /* 1.587401051968 => 1.587401051074, e 0.000000000894 */
+ MAD_F(0x1428a2fa), /* 1.259921049895 => 1.259921051562, e -0.000000001667 */
+ MAD_F(0x10000000), /* 1.000000000000 => 1.000000000000, e 0.000000000000 */
+ MAD_F(0x0cb2ff53), /* 0.793700525984 => 0.793700527400, e -0.000000001416 */
+ MAD_F(0x0a14517d), /* 0.629960524947 => 0.629960525781, e -0.000000000833 */
+ MAD_F(0x08000000), /* 0.500000000000 => 0.500000000000, e 0.000000000000 */
+ MAD_F(0x06597fa9), /* 0.396850262992 => 0.396850261837, e 0.000000001155 */
+
+ MAD_F(0x050a28be), /* 0.314980262474 => 0.314980261028, e 0.000000001446 */
+ MAD_F(0x04000000), /* 0.250000000000 => 0.250000000000, e 0.000000000000 */
+ MAD_F(0x032cbfd5), /* 0.198425131496 => 0.198425132781, e -0.000000001285 */
+ MAD_F(0x0285145f), /* 0.157490131237 => 0.157490130514, e 0.000000000723 */
+ MAD_F(0x02000000), /* 0.125000000000 => 0.125000000000, e 0.000000000000 */
+ MAD_F(0x01965fea), /* 0.099212565748 => 0.099212564528, e 0.000000001220 */
+ MAD_F(0x01428a30), /* 0.078745065618 => 0.078745067120, e -0.000000001501 */
+ MAD_F(0x01000000), /* 0.062500000000 => 0.062500000000, e 0.000000000000 */
+
+ MAD_F(0x00cb2ff5), /* 0.049606282874 => 0.049606282264, e 0.000000000610 */
+ MAD_F(0x00a14518), /* 0.039372532809 => 0.039372533560, e -0.000000000751 */
+ MAD_F(0x00800000), /* 0.031250000000 => 0.031250000000, e 0.000000000000 */
+ MAD_F(0x006597fb), /* 0.024803141437 => 0.024803142995, e -0.000000001558 */
+ MAD_F(0x0050a28c), /* 0.019686266405 => 0.019686266780, e -0.000000000375 */
+ MAD_F(0x00400000), /* 0.015625000000 => 0.015625000000, e 0.000000000000 */
+ MAD_F(0x0032cbfd), /* 0.012401570719 => 0.012401569635, e 0.000000001084 */
+ MAD_F(0x00285146), /* 0.009843133202 => 0.009843133390, e -0.000000000188 */
+
+ MAD_F(0x00200000), /* 0.007812500000 => 0.007812500000, e 0.000000000000 */
+ MAD_F(0x001965ff), /* 0.006200785359 => 0.006200786680, e -0.000000001321 */
+ MAD_F(0x001428a3), /* 0.004921566601 => 0.004921566695, e -0.000000000094 */
+ MAD_F(0x00100000), /* 0.003906250000 => 0.003906250000, e 0.000000000000 */
+ MAD_F(0x000cb2ff), /* 0.003100392680 => 0.003100391477, e 0.000000001202 */
+ MAD_F(0x000a1451), /* 0.002460783301 => 0.002460781485, e 0.000000001816 */
+ MAD_F(0x00080000), /* 0.001953125000 => 0.001953125000, e 0.000000000000 */
+ MAD_F(0x00065980), /* 0.001550196340 => 0.001550197601, e -0.000000001262 */
+
+ MAD_F(0x00050a29), /* 0.001230391650 => 0.001230392605, e -0.000000000955 */
+ MAD_F(0x00040000), /* 0.000976562500 => 0.000976562500, e 0.000000000000 */
+ MAD_F(0x00032cc0), /* 0.000775098170 => 0.000775098801, e -0.000000000631 */
+ MAD_F(0x00028514), /* 0.000615195825 => 0.000615194440, e 0.000000001385 */
+ MAD_F(0x00020000), /* 0.000488281250 => 0.000488281250, e 0.000000000000 */
+ MAD_F(0x00019660), /* 0.000387549085 => 0.000387549400, e -0.000000000315 */
+ MAD_F(0x0001428a), /* 0.000307597913 => 0.000307597220, e 0.000000000693 */
+ MAD_F(0x00010000), /* 0.000244140625 => 0.000244140625, e 0.000000000000 */
+
+ MAD_F(0x0000cb30), /* 0.000193774542 => 0.000193774700, e -0.000000000158 */
+ MAD_F(0x0000a145), /* 0.000153798956 => 0.000153798610, e 0.000000000346 */
+ MAD_F(0x00008000), /* 0.000122070313 => 0.000122070313, e 0.000000000000 */
+ MAD_F(0x00006598), /* 0.000096887271 => 0.000096887350, e -0.000000000079 */
+ MAD_F(0x000050a3), /* 0.000076899478 => 0.000076901168, e -0.000000001689 */
+ MAD_F(0x00004000), /* 0.000061035156 => 0.000061035156, e 0.000000000000 */
+ MAD_F(0x000032cc), /* 0.000048443636 => 0.000048443675, e -0.000000000039 */
+ MAD_F(0x00002851), /* 0.000038449739 => 0.000038448721, e 0.000000001018 */
+
+ MAD_F(0x00002000), /* 0.000030517578 => 0.000030517578, e 0.000000000000 */
+ MAD_F(0x00001966), /* 0.000024221818 => 0.000024221838, e -0.000000000020 */
+ MAD_F(0x00001429), /* 0.000019224870 => 0.000019226223, e -0.000000001354 */
+ MAD_F(0x00001000), /* 0.000015258789 => 0.000015258789, e -0.000000000000 */
+ MAD_F(0x00000cb3), /* 0.000012110909 => 0.000012110919, e -0.000000000010 */
+ MAD_F(0x00000a14), /* 0.000009612435 => 0.000009611249, e 0.000000001186 */
+ MAD_F(0x00000800), /* 0.000007629395 => 0.000007629395, e -0.000000000000 */
+ MAD_F(0x00000659), /* 0.000006055454 => 0.000006053597, e 0.000000001858 */
+
+ MAD_F(0x0000050a), /* 0.000004806217 => 0.000004805624, e 0.000000000593 */
+ MAD_F(0x00000400), /* 0.000003814697 => 0.000003814697, e 0.000000000000 */
+ MAD_F(0x0000032d), /* 0.000003027727 => 0.000003028661, e -0.000000000934 */
+ MAD_F(0x00000285), /* 0.000002403109 => 0.000002402812, e 0.000000000296 */
+ MAD_F(0x00000200), /* 0.000001907349 => 0.000001907349, e -0.000000000000 */
+ MAD_F(0x00000196), /* 0.000001513864 => 0.000001512468, e 0.000000001396 */
+ MAD_F(0x00000143), /* 0.000001201554 => 0.000001203269, e -0.000000001714 */
+ MAD_F(0x00000000) /* this compatibility entry is not part of Table B.1 */
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/stream.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/stream.c
new file mode 100644
index 000000000..a90973a45
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/stream.c
@@ -0,0 +1,160 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: stream.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# include <stdlib.h>
+
+# include "bit.h"
+# include "stream.h"
+
+/*
+ * NAME: stream->init()
+ * DESCRIPTION: initialize stream struct
+ */
+void mad_stream_init(struct mad_stream *stream)
+{
+ stream->buffer = 0;
+ stream->bufend = 0;
+ stream->skiplen = 0;
+
+ stream->sync = 0;
+ stream->freerate = 0;
+
+ stream->this_frame = 0;
+ stream->next_frame = 0;
+ mad_bit_init(&stream->ptr, 0);
+
+ mad_bit_init(&stream->anc_ptr, 0);
+ stream->anc_bitlen = 0;
+
+ stream->main_data = 0;
+ stream->md_len = 0;
+
+ stream->options = 0;
+ stream->error = MAD_ERROR_NONE;
+}
+
+/*
+ * NAME: stream->finish()
+ * DESCRIPTION: deallocate any dynamic memory associated with stream
+ */
+void mad_stream_finish(struct mad_stream *stream)
+{
+ if (stream->main_data) {
+ free(stream->main_data);
+ stream->main_data = 0;
+ }
+
+ mad_bit_finish(&stream->anc_ptr);
+ mad_bit_finish(&stream->ptr);
+}
+
+/*
+ * NAME: stream->buffer()
+ * DESCRIPTION: set stream buffer pointers
+ */
+void mad_stream_buffer(struct mad_stream *stream,
+ unsigned char const *buffer, unsigned long length)
+{
+ stream->buffer = buffer;
+ stream->bufend = buffer + length;
+
+ stream->this_frame = buffer;
+ stream->next_frame = buffer;
+
+ stream->sync = 1;
+
+ mad_bit_init(&stream->ptr, buffer);
+}
+
+/*
+ * NAME: stream->skip()
+ * DESCRIPTION: arrange to skip bytes before the next frame
+ */
+void mad_stream_skip(struct mad_stream *stream, unsigned long length)
+{
+ stream->skiplen += length;
+}
+
+/*
+ * NAME: stream->sync()
+ * DESCRIPTION: locate the next stream sync word
+ */
+int mad_stream_sync(struct mad_stream *stream)
+{
+ register unsigned char const *ptr, *end;
+
+ ptr = mad_bit_nextbyte(&stream->ptr);
+ end = stream->bufend;
+
+ while (ptr < end - 1 &&
+ !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
+ ++ptr;
+
+ if (end - ptr < MAD_BUFFER_GUARD)
+ return -1;
+
+ mad_bit_init(&stream->ptr, ptr);
+
+ return 0;
+}
+
+/*
+ * NAME: stream->errorstr()
+ * DESCRIPTION: return a string description of the current error condition
+ */
+char const *mad_stream_errorstr(struct mad_stream const *stream)
+{
+ switch (stream->error) {
+ case MAD_ERROR_NONE: return "no error";
+
+ case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)";
+ case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer";
+
+ case MAD_ERROR_NOMEM: return "not enough memory";
+
+ case MAD_ERROR_LOSTSYNC: return "lost synchronization";
+ case MAD_ERROR_BADLAYER: return "reserved header layer value";
+ case MAD_ERROR_BADBITRATE: return "forbidden bitrate value";
+ case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value";
+ case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value";
+
+ case MAD_ERROR_BADCRC: return "CRC check failed";
+ case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value";
+ case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index";
+ case MAD_ERROR_BADFRAMELEN: return "bad frame length";
+ case MAD_ERROR_BADBIGVALUES: return "bad big_values count";
+ case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type";
+ case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info";
+ case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer";
+ case MAD_ERROR_BADPART3LEN: return "bad audio data length";
+ case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select";
+ case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun";
+ case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS";
+ }
+
+ return 0;
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/stream.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/stream.h
new file mode 100644
index 000000000..735d6f8c7
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/stream.h
@@ -0,0 +1,107 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: stream.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_STREAM_H
+# define LIBMAD_STREAM_H
+
+# include "bit.h"
+
+# define MAD_BUFFER_GUARD 8
+# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
+
+enum mad_error {
+ MAD_ERROR_NONE = 0x0000, /* no error */
+
+ MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
+ MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
+
+ MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
+
+ MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
+ MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
+ MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
+ MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
+ MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
+
+ MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
+ MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
+ MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
+ MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
+ MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
+ MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
+ MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
+ MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
+ MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
+ MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
+ MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
+ MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
+};
+
+# define MAD_RECOVERABLE(error) ((error) & 0xff00)
+
+struct mad_stream {
+ unsigned char const *buffer; /* input bitstream buffer */
+ unsigned char const *bufend; /* end of buffer */
+ unsigned long skiplen; /* bytes to skip before next frame */
+
+ int sync; /* stream sync found */
+ unsigned long freerate; /* free bitrate (fixed) */
+
+ unsigned char const *this_frame; /* start of current frame */
+ unsigned char const *next_frame; /* start of next frame */
+ struct mad_bitptr ptr; /* current processing bit pointer */
+
+ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
+ unsigned int anc_bitlen; /* number of ancillary bits */
+
+ unsigned char (*main_data)[MAD_BUFFER_MDLEN];
+ /* Layer III main_data() */
+ unsigned int md_len; /* bytes in main_data */
+
+ int options; /* decoding options (see below) */
+ enum mad_error error; /* error code (see above) */
+};
+
+enum {
+ MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
+ MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
+# if 0 /* not yet implemented */
+ MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
+ MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
+ MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
+# endif
+};
+
+void mad_stream_init(struct mad_stream *);
+void mad_stream_finish(struct mad_stream *);
+
+# define mad_stream_options(stream, opts) \
+ ((void) ((stream)->options = (opts)))
+
+void mad_stream_buffer(struct mad_stream *,
+ unsigned char const *, unsigned long);
+void mad_stream_skip(struct mad_stream *, unsigned long);
+
+int mad_stream_sync(struct mad_stream *);
+
+char const *mad_stream_errorstr(struct mad_stream const *);
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/synth.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/synth.c
new file mode 100644
index 000000000..023e39233
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/synth.c
@@ -0,0 +1,857 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: synth.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# include "fixed.h"
+# include "frame.h"
+# include "synth.h"
+
+/*
+ * NAME: synth->init()
+ * DESCRIPTION: initialize synth struct
+ */
+void mad_synth_init(struct mad_synth *synth)
+{
+ mad_synth_mute(synth);
+
+ synth->phase = 0;
+
+ synth->pcm.samplerate = 0;
+ synth->pcm.channels = 0;
+ synth->pcm.length = 0;
+}
+
+/*
+ * NAME: synth->mute()
+ * DESCRIPTION: zero all polyphase filterbank values, resetting synthesis
+ */
+void mad_synth_mute(struct mad_synth *synth)
+{
+ unsigned int ch, s, v;
+
+ for (ch = 0; ch < 2; ++ch) {
+ for (s = 0; s < 16; ++s) {
+ for (v = 0; v < 8; ++v) {
+ synth->filter[ch][0][0][s][v] = synth->filter[ch][0][1][s][v] =
+ synth->filter[ch][1][0][s][v] = synth->filter[ch][1][1][s][v] = 0;
+ }
+ }
+ }
+}
+
+/*
+ * An optional optimization called here the Subband Synthesis Optimization
+ * (SSO) improves the performance of subband synthesis at the expense of
+ * accuracy.
+ *
+ * The idea is to simplify 32x32->64-bit multiplication to 32x32->32 such
+ * that extra scaling and rounding are not necessary. This often allows the
+ * compiler to use faster 32-bit multiply-accumulate instructions instead of
+ * explicit 64-bit multiply, shift, and add instructions.
+ *
+ * SSO works like this: a full 32x32->64-bit multiply of two mad_fixed_t
+ * values requires the result to be right-shifted 28 bits to be properly
+ * scaled to the same fixed-point format. Right shifts can be applied at any
+ * time to either operand or to the result, so the optimization involves
+ * careful placement of these shifts to minimize the loss of accuracy.
+ *
+ * First, a 14-bit shift is applied with rounding at compile-time to the D[]
+ * table of coefficients for the subband synthesis window. This only loses 2
+ * bits of accuracy because the lower 12 bits are always zero. A second
+ * 12-bit shift occurs after the DCT calculation. This loses 12 bits of
+ * accuracy. Finally, a third 2-bit shift occurs just before the sample is
+ * saved in the PCM buffer. 14 + 12 + 2 == 28 bits.
+ */
+
+/* FPM_DEFAULT without OPT_SSO will actually lose accuracy and performance */
+
+# if defined(FPM_DEFAULT) && !defined(OPT_SSO)
+# define OPT_SSO
+# endif
+
+/* second SSO shift, with rounding */
+
+# if defined(OPT_SSO)
+# define SHIFT(x) (((x) + (1L << 11)) >> 12)
+# else
+# define SHIFT(x) (x)
+# endif
+
+/* possible DCT speed optimization */
+
+# if defined(OPT_SPEED) && defined(MAD_F_MLX)
+# define OPT_DCTO
+# define MUL(x, y) \
+ ({ mad_fixed64hi_t hi; \
+ mad_fixed64lo_t lo; \
+ MAD_F_MLX(hi, lo, (x), (y)); \
+ hi << (32 - MAD_F_SCALEBITS - 3); \
+ })
+# else
+# undef OPT_DCTO
+# define MUL(x, y) mad_f_mul((x), (y))
+# endif
+
+/*
+ * NAME: dct32()
+ * DESCRIPTION: perform fast in[32]->out[32] DCT
+ */
+static
+void dct32(mad_fixed_t const in[32], unsigned int slot,
+ mad_fixed_t lo[16][8], mad_fixed_t hi[16][8])
+{
+ mad_fixed_t t0, t1, t2, t3, t4, t5, t6, t7;
+ mad_fixed_t t8, t9, t10, t11, t12, t13, t14, t15;
+ mad_fixed_t t16, t17, t18, t19, t20, t21, t22, t23;
+ mad_fixed_t t24, t25, t26, t27, t28, t29, t30, t31;
+ mad_fixed_t t32, t33, t34, t35, t36, t37, t38, t39;
+ mad_fixed_t t40, t41, t42, t43, t44, t45, t46, t47;
+ mad_fixed_t t48, t49, t50, t51, t52, t53, t54, t55;
+ mad_fixed_t t56, t57, t58, t59, t60, t61, t62, t63;
+ mad_fixed_t t64, t65, t66, t67, t68, t69, t70, t71;
+ mad_fixed_t t72, t73, t74, t75, t76, t77, t78, t79;
+ mad_fixed_t t80, t81, t82, t83, t84, t85, t86, t87;
+ mad_fixed_t t88, t89, t90, t91, t92, t93, t94, t95;
+ mad_fixed_t t96, t97, t98, t99, t100, t101, t102, t103;
+ mad_fixed_t t104, t105, t106, t107, t108, t109, t110, t111;
+ mad_fixed_t t112, t113, t114, t115, t116, t117, t118, t119;
+ mad_fixed_t t120, t121, t122, t123, t124, t125, t126, t127;
+ mad_fixed_t t128, t129, t130, t131, t132, t133, t134, t135;
+ mad_fixed_t t136, t137, t138, t139, t140, t141, t142, t143;
+ mad_fixed_t t144, t145, t146, t147, t148, t149, t150, t151;
+ mad_fixed_t t152, t153, t154, t155, t156, t157, t158, t159;
+ mad_fixed_t t160, t161, t162, t163, t164, t165, t166, t167;
+ mad_fixed_t t168, t169, t170, t171, t172, t173, t174, t175;
+ mad_fixed_t t176;
+
+ /* costab[i] = cos(PI / (2 * 32) * i) */
+
+# if defined(OPT_DCTO)
+# define costab1 MAD_F(0x7fd8878e)
+# define costab2 MAD_F(0x7f62368f)
+# define costab3 MAD_F(0x7e9d55fc)
+# define costab4 MAD_F(0x7d8a5f40)
+# define costab5 MAD_F(0x7c29fbee)
+# define costab6 MAD_F(0x7a7d055b)
+# define costab7 MAD_F(0x78848414)
+# define costab8 MAD_F(0x7641af3d)
+# define costab9 MAD_F(0x73b5ebd1)
+# define costab10 MAD_F(0x70e2cbc6)
+# define costab11 MAD_F(0x6dca0d14)
+# define costab12 MAD_F(0x6a6d98a4)
+# define costab13 MAD_F(0x66cf8120)
+# define costab14 MAD_F(0x62f201ac)
+# define costab15 MAD_F(0x5ed77c8a)
+# define costab16 MAD_F(0x5a82799a)
+# define costab17 MAD_F(0x55f5a4d2)
+# define costab18 MAD_F(0x5133cc94)
+# define costab19 MAD_F(0x4c3fdff4)
+# define costab20 MAD_F(0x471cece7)
+# define costab21 MAD_F(0x41ce1e65)
+# define costab22 MAD_F(0x3c56ba70)
+# define costab23 MAD_F(0x36ba2014)
+# define costab24 MAD_F(0x30fbc54d)
+# define costab25 MAD_F(0x2b1f34eb)
+# define costab26 MAD_F(0x25280c5e)
+# define costab27 MAD_F(0x1f19f97b)
+# define costab28 MAD_F(0x18f8b83c)
+# define costab29 MAD_F(0x12c8106f)
+# define costab30 MAD_F(0x0c8bd35e)
+# define costab31 MAD_F(0x0647d97c)
+# else
+# define costab1 MAD_F(0x0ffb10f2) /* 0.998795456 */
+# define costab2 MAD_F(0x0fec46d2) /* 0.995184727 */
+# define costab3 MAD_F(0x0fd3aac0) /* 0.989176510 */
+# define costab4 MAD_F(0x0fb14be8) /* 0.980785280 */
+# define costab5 MAD_F(0x0f853f7e) /* 0.970031253 */
+# define costab6 MAD_F(0x0f4fa0ab) /* 0.956940336 */
+# define costab7 MAD_F(0x0f109082) /* 0.941544065 */
+# define costab8 MAD_F(0x0ec835e8) /* 0.923879533 */
+# define costab9 MAD_F(0x0e76bd7a) /* 0.903989293 */
+# define costab10 MAD_F(0x0e1c5979) /* 0.881921264 */
+# define costab11 MAD_F(0x0db941a3) /* 0.857728610 */
+# define costab12 MAD_F(0x0d4db315) /* 0.831469612 */
+# define costab13 MAD_F(0x0cd9f024) /* 0.803207531 */
+# define costab14 MAD_F(0x0c5e4036) /* 0.773010453 */
+# define costab15 MAD_F(0x0bdaef91) /* 0.740951125 */
+# define costab16 MAD_F(0x0b504f33) /* 0.707106781 */
+# define costab17 MAD_F(0x0abeb49a) /* 0.671558955 */
+# define costab18 MAD_F(0x0a267993) /* 0.634393284 */
+# define costab19 MAD_F(0x0987fbfe) /* 0.595699304 */
+# define costab20 MAD_F(0x08e39d9d) /* 0.555570233 */
+# define costab21 MAD_F(0x0839c3cd) /* 0.514102744 */
+# define costab22 MAD_F(0x078ad74e) /* 0.471396737 */
+# define costab23 MAD_F(0x06d74402) /* 0.427555093 */
+# define costab24 MAD_F(0x061f78aa) /* 0.382683432 */
+# define costab25 MAD_F(0x0563e69d) /* 0.336889853 */
+# define costab26 MAD_F(0x04a5018c) /* 0.290284677 */
+# define costab27 MAD_F(0x03e33f2f) /* 0.242980180 */
+# define costab28 MAD_F(0x031f1708) /* 0.195090322 */
+# define costab29 MAD_F(0x0259020e) /* 0.146730474 */
+# define costab30 MAD_F(0x01917a6c) /* 0.098017140 */
+# define costab31 MAD_F(0x00c8fb30) /* 0.049067674 */
+# endif
+
+ t0 = in[0] + in[31]; t16 = MUL(in[0] - in[31], costab1);
+ t1 = in[15] + in[16]; t17 = MUL(in[15] - in[16], costab31);
+
+ t41 = t16 + t17;
+ t59 = MUL(t16 - t17, costab2);
+ t33 = t0 + t1;
+ t50 = MUL(t0 - t1, costab2);
+
+ t2 = in[7] + in[24]; t18 = MUL(in[7] - in[24], costab15);
+ t3 = in[8] + in[23]; t19 = MUL(in[8] - in[23], costab17);
+
+ t42 = t18 + t19;
+ t60 = MUL(t18 - t19, costab30);
+ t34 = t2 + t3;
+ t51 = MUL(t2 - t3, costab30);
+
+ t4 = in[3] + in[28]; t20 = MUL(in[3] - in[28], costab7);
+ t5 = in[12] + in[19]; t21 = MUL(in[12] - in[19], costab25);
+
+ t43 = t20 + t21;
+ t61 = MUL(t20 - t21, costab14);
+ t35 = t4 + t5;
+ t52 = MUL(t4 - t5, costab14);
+
+ t6 = in[4] + in[27]; t22 = MUL(in[4] - in[27], costab9);
+ t7 = in[11] + in[20]; t23 = MUL(in[11] - in[20], costab23);
+
+ t44 = t22 + t23;
+ t62 = MUL(t22 - t23, costab18);
+ t36 = t6 + t7;
+ t53 = MUL(t6 - t7, costab18);
+
+ t8 = in[1] + in[30]; t24 = MUL(in[1] - in[30], costab3);
+ t9 = in[14] + in[17]; t25 = MUL(in[14] - in[17], costab29);
+
+ t45 = t24 + t25;
+ t63 = MUL(t24 - t25, costab6);
+ t37 = t8 + t9;
+ t54 = MUL(t8 - t9, costab6);
+
+ t10 = in[6] + in[25]; t26 = MUL(in[6] - in[25], costab13);
+ t11 = in[9] + in[22]; t27 = MUL(in[9] - in[22], costab19);
+
+ t46 = t26 + t27;
+ t64 = MUL(t26 - t27, costab26);
+ t38 = t10 + t11;
+ t55 = MUL(t10 - t11, costab26);
+
+ t12 = in[2] + in[29]; t28 = MUL(in[2] - in[29], costab5);
+ t13 = in[13] + in[18]; t29 = MUL(in[13] - in[18], costab27);
+
+ t47 = t28 + t29;
+ t65 = MUL(t28 - t29, costab10);
+ t39 = t12 + t13;
+ t56 = MUL(t12 - t13, costab10);
+
+ t14 = in[5] + in[26]; t30 = MUL(in[5] - in[26], costab11);
+ t15 = in[10] + in[21]; t31 = MUL(in[10] - in[21], costab21);
+
+ t48 = t30 + t31;
+ t66 = MUL(t30 - t31, costab22);
+ t40 = t14 + t15;
+ t57 = MUL(t14 - t15, costab22);
+
+ t69 = t33 + t34; t89 = MUL(t33 - t34, costab4);
+ t70 = t35 + t36; t90 = MUL(t35 - t36, costab28);
+ t71 = t37 + t38; t91 = MUL(t37 - t38, costab12);
+ t72 = t39 + t40; t92 = MUL(t39 - t40, costab20);
+ t73 = t41 + t42; t94 = MUL(t41 - t42, costab4);
+ t74 = t43 + t44; t95 = MUL(t43 - t44, costab28);
+ t75 = t45 + t46; t96 = MUL(t45 - t46, costab12);
+ t76 = t47 + t48; t97 = MUL(t47 - t48, costab20);
+
+ t78 = t50 + t51; t100 = MUL(t50 - t51, costab4);
+ t79 = t52 + t53; t101 = MUL(t52 - t53, costab28);
+ t80 = t54 + t55; t102 = MUL(t54 - t55, costab12);
+ t81 = t56 + t57; t103 = MUL(t56 - t57, costab20);
+
+ t83 = t59 + t60; t106 = MUL(t59 - t60, costab4);
+ t84 = t61 + t62; t107 = MUL(t61 - t62, costab28);
+ t85 = t63 + t64; t108 = MUL(t63 - t64, costab12);
+ t86 = t65 + t66; t109 = MUL(t65 - t66, costab20);
+
+ t113 = t69 + t70;
+ t114 = t71 + t72;
+
+ /* 0 */ hi[15][slot] = SHIFT(t113 + t114);
+ /* 16 */ lo[ 0][slot] = SHIFT(MUL(t113 - t114, costab16));
+
+ t115 = t73 + t74;
+ t116 = t75 + t76;
+
+ t32 = t115 + t116;
+
+ /* 1 */ hi[14][slot] = SHIFT(t32);
+
+ t118 = t78 + t79;
+ t119 = t80 + t81;
+
+ t58 = t118 + t119;
+
+ /* 2 */ hi[13][slot] = SHIFT(t58);
+
+ t121 = t83 + t84;
+ t122 = t85 + t86;
+
+ t67 = t121 + t122;
+
+ t49 = (t67 * 2) - t32;
+
+ /* 3 */ hi[12][slot] = SHIFT(t49);
+
+ t125 = t89 + t90;
+ t126 = t91 + t92;
+
+ t93 = t125 + t126;
+
+ /* 4 */ hi[11][slot] = SHIFT(t93);
+
+ t128 = t94 + t95;
+ t129 = t96 + t97;
+
+ t98 = t128 + t129;
+
+ t68 = (t98 * 2) - t49;
+
+ /* 5 */ hi[10][slot] = SHIFT(t68);
+
+ t132 = t100 + t101;
+ t133 = t102 + t103;
+
+ t104 = t132 + t133;
+
+ t82 = (t104 * 2) - t58;
+
+ /* 6 */ hi[ 9][slot] = SHIFT(t82);
+
+ t136 = t106 + t107;
+ t137 = t108 + t109;
+
+ t110 = t136 + t137;
+
+ t87 = (t110 * 2) - t67;
+
+ t77 = (t87 * 2) - t68;
+
+ /* 7 */ hi[ 8][slot] = SHIFT(t77);
+
+ t141 = MUL(t69 - t70, costab8);
+ t142 = MUL(t71 - t72, costab24);
+ t143 = t141 + t142;
+
+ /* 8 */ hi[ 7][slot] = SHIFT(t143);
+ /* 24 */ lo[ 8][slot] =
+ SHIFT((MUL(t141 - t142, costab16) * 2) - t143);
+
+ t144 = MUL(t73 - t74, costab8);
+ t145 = MUL(t75 - t76, costab24);
+ t146 = t144 + t145;
+
+ t88 = (t146 * 2) - t77;
+
+ /* 9 */ hi[ 6][slot] = SHIFT(t88);
+
+ t148 = MUL(t78 - t79, costab8);
+ t149 = MUL(t80 - t81, costab24);
+ t150 = t148 + t149;
+
+ t105 = (t150 * 2) - t82;
+
+ /* 10 */ hi[ 5][slot] = SHIFT(t105);
+
+ t152 = MUL(t83 - t84, costab8);
+ t153 = MUL(t85 - t86, costab24);
+ t154 = t152 + t153;
+
+ t111 = (t154 * 2) - t87;
+
+ t99 = (t111 * 2) - t88;
+
+ /* 11 */ hi[ 4][slot] = SHIFT(t99);
+
+ t157 = MUL(t89 - t90, costab8);
+ t158 = MUL(t91 - t92, costab24);
+ t159 = t157 + t158;
+
+ t127 = (t159 * 2) - t93;
+
+ /* 12 */ hi[ 3][slot] = SHIFT(t127);
+
+ t160 = (MUL(t125 - t126, costab16) * 2) - t127;
+
+ /* 20 */ lo[ 4][slot] = SHIFT(t160);
+ /* 28 */ lo[12][slot] =
+ SHIFT((((MUL(t157 - t158, costab16) * 2) - t159) * 2) - t160);
+
+ t161 = MUL(t94 - t95, costab8);
+ t162 = MUL(t96 - t97, costab24);
+ t163 = t161 + t162;
+
+ t130 = (t163 * 2) - t98;
+
+ t112 = (t130 * 2) - t99;
+
+ /* 13 */ hi[ 2][slot] = SHIFT(t112);
+
+ t164 = (MUL(t128 - t129, costab16) * 2) - t130;
+
+ t166 = MUL(t100 - t101, costab8);
+ t167 = MUL(t102 - t103, costab24);
+ t168 = t166 + t167;
+
+ t134 = (t168 * 2) - t104;
+
+ t120 = (t134 * 2) - t105;
+
+ /* 14 */ hi[ 1][slot] = SHIFT(t120);
+
+ t135 = (MUL(t118 - t119, costab16) * 2) - t120;
+
+ /* 18 */ lo[ 2][slot] = SHIFT(t135);
+
+ t169 = (MUL(t132 - t133, costab16) * 2) - t134;
+
+ t151 = (t169 * 2) - t135;
+
+ /* 22 */ lo[ 6][slot] = SHIFT(t151);
+
+ t170 = (((MUL(t148 - t149, costab16) * 2) - t150) * 2) - t151;
+
+ /* 26 */ lo[10][slot] = SHIFT(t170);
+ /* 30 */ lo[14][slot] =
+ SHIFT((((((MUL(t166 - t167, costab16) * 2) -
+ t168) * 2) - t169) * 2) - t170);
+
+ t171 = MUL(t106 - t107, costab8);
+ t172 = MUL(t108 - t109, costab24);
+ t173 = t171 + t172;
+
+ t138 = (t173 * 2) - t110;
+
+ t123 = (t138 * 2) - t111;
+
+ t139 = (MUL(t121 - t122, costab16) * 2) - t123;
+
+ t117 = (t123 * 2) - t112;
+
+ /* 15 */ hi[ 0][slot] = SHIFT(t117);
+
+ t124 = (MUL(t115 - t116, costab16) * 2) - t117;
+
+ /* 17 */ lo[ 1][slot] = SHIFT(t124);
+
+ t131 = (t139 * 2) - t124;
+
+ /* 19 */ lo[ 3][slot] = SHIFT(t131);
+
+ t140 = (t164 * 2) - t131;
+
+ /* 21 */ lo[ 5][slot] = SHIFT(t140);
+
+ t174 = (MUL(t136 - t137, costab16) * 2) - t138;
+
+ t155 = (t174 * 2) - t139;
+
+ t147 = (t155 * 2) - t140;
+
+ /* 23 */ lo[ 7][slot] = SHIFT(t147);
+
+ t156 = (((MUL(t144 - t145, costab16) * 2) - t146) * 2) - t147;
+
+ /* 25 */ lo[ 9][slot] = SHIFT(t156);
+
+ t175 = (((MUL(t152 - t153, costab16) * 2) - t154) * 2) - t155;
+
+ t165 = (t175 * 2) - t156;
+
+ /* 27 */ lo[11][slot] = SHIFT(t165);
+
+ t176 = (((((MUL(t161 - t162, costab16) * 2) -
+ t163) * 2) - t164) * 2) - t165;
+
+ /* 29 */ lo[13][slot] = SHIFT(t176);
+ /* 31 */ lo[15][slot] =
+ SHIFT((((((((MUL(t171 - t172, costab16) * 2) -
+ t173) * 2) - t174) * 2) - t175) * 2) - t176);
+
+ /*
+ * Totals:
+ * 80 multiplies
+ * 80 additions
+ * 119 subtractions
+ * 49 shifts (not counting SSO)
+ */
+}
+
+# undef MUL
+# undef SHIFT
+
+/* third SSO shift and/or D[] optimization preshift */
+
+# if defined(OPT_SSO)
+# if MAD_F_FRACBITS != 28
+# error "MAD_F_FRACBITS must be 28 to use OPT_SSO"
+# endif
+# define ML0(hi, lo, x, y) ((lo) = (x) * (y))
+# define MLA(hi, lo, x, y) ((lo) += (x) * (y))
+# define MLN(hi, lo) ((lo) = -(lo))
+# define MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo))
+# define SHIFT(x) ((x) >> 2)
+# define PRESHIFT(x) ((MAD_F(x) + (1L << 13)) >> 14)
+# else
+# define ML0(hi, lo, x, y) MAD_F_ML0((hi), (lo), (x), (y))
+# define MLA(hi, lo, x, y) MAD_F_MLA((hi), (lo), (x), (y))
+# define MLN(hi, lo) MAD_F_MLN((hi), (lo))
+# define MLZ(hi, lo) MAD_F_MLZ((hi), (lo))
+# define SHIFT(x) (x)
+# if defined(MAD_F_SCALEBITS)
+# undef MAD_F_SCALEBITS
+# define MAD_F_SCALEBITS (MAD_F_FRACBITS - 12)
+# define PRESHIFT(x) (MAD_F(x) >> 12)
+# else
+# define PRESHIFT(x) MAD_F(x)
+# endif
+# endif
+
+static
+mad_fixed_t const D[17][32] = {
+# include "D.dat"
+};
+
+# if defined(ASO_SYNTH)
+void synth_full(struct mad_synth *, struct mad_frame const *,
+ unsigned int, unsigned int);
+# else
+/*
+ * NAME: synth->full()
+ * DESCRIPTION: perform full frequency PCM synthesis
+ */
+static
+void synth_full(struct mad_synth *synth, struct mad_frame const *frame,
+ unsigned int nch, unsigned int ns)
+{
+ unsigned int phase, ch, s, sb, pe, po;
+ mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
+ mad_fixed_t const (*sbsample)[36][32];
+ register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
+ register mad_fixed_t const (*Dptr)[32], *ptr;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ for (ch = 0; ch < nch; ++ch) {
+ sbsample = &frame->sbsample[ch];
+ filter = &synth->filter[ch];
+ phase = synth->phase;
+ pcm1 = synth->pcm.samples[ch];
+
+ for (s = 0; s < ns; ++s) {
+ dct32((*sbsample)[s], phase >> 1,
+ (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
+
+ pe = phase & ~1;
+ po = ((phase - 1) & 0xf) | 1;
+
+ /* calculate 32 samples */
+
+ fe = &(*filter)[0][ phase & 1][0];
+ fx = &(*filter)[0][~phase & 1][0];
+ fo = &(*filter)[1][~phase & 1][0];
+
+ Dptr = &D[0];
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fx)[0], ptr[ 0]);
+ MLA(hi, lo, (*fx)[1], ptr[14]);
+ MLA(hi, lo, (*fx)[2], ptr[12]);
+ MLA(hi, lo, (*fx)[3], ptr[10]);
+ MLA(hi, lo, (*fx)[4], ptr[ 8]);
+ MLA(hi, lo, (*fx)[5], ptr[ 6]);
+ MLA(hi, lo, (*fx)[6], ptr[ 4]);
+ MLA(hi, lo, (*fx)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ pcm2 = pcm1 + 30;
+
+ for (sb = 1; sb < 16; ++sb) {
+ ++fe;
+ ++Dptr;
+
+ /* D[32 - sb][i] == -D[sb][31 - i] */
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ ptr = *Dptr - pe;
+ ML0(hi, lo, (*fe)[0], ptr[31 - 16]);
+ MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
+
+ ptr = *Dptr - po;
+ MLA(hi, lo, (*fo)[7], ptr[31 - 2]);
+ MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
+
+ *pcm2-- = SHIFT(MLZ(hi, lo));
+
+ ++fo;
+ }
+
+ ++Dptr;
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+
+ *pcm1 = SHIFT(-MLZ(hi, lo));
+ pcm1 += 16;
+
+ phase = (phase + 1) % 16;
+ }
+ }
+}
+# endif
+
+/*
+ * NAME: synth->half()
+ * DESCRIPTION: perform half frequency PCM synthesis
+ */
+static
+void synth_half(struct mad_synth *synth, struct mad_frame const *frame,
+ unsigned int nch, unsigned int ns)
+{
+ unsigned int phase, ch, s, sb, pe, po;
+ mad_fixed_t *pcm1, *pcm2, (*filter)[2][2][16][8];
+ mad_fixed_t const (*sbsample)[36][32];
+ register mad_fixed_t (*fe)[8], (*fx)[8], (*fo)[8];
+ register mad_fixed_t const (*Dptr)[32], *ptr;
+ register mad_fixed64hi_t hi;
+ register mad_fixed64lo_t lo;
+
+ for (ch = 0; ch < nch; ++ch) {
+ sbsample = &frame->sbsample[ch];
+ filter = &synth->filter[ch];
+ phase = synth->phase;
+ pcm1 = synth->pcm.samples[ch];
+
+ for (s = 0; s < ns; ++s) {
+ dct32((*sbsample)[s], phase >> 1,
+ (*filter)[0][phase & 1], (*filter)[1][phase & 1]);
+
+ pe = phase & ~1;
+ po = ((phase - 1) & 0xf) | 1;
+
+ /* calculate 16 samples */
+
+ fe = &(*filter)[0][ phase & 1][0];
+ fx = &(*filter)[0][~phase & 1][0];
+ fo = &(*filter)[1][~phase & 1][0];
+
+ Dptr = &D[0];
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fx)[0], ptr[ 0]);
+ MLA(hi, lo, (*fx)[1], ptr[14]);
+ MLA(hi, lo, (*fx)[2], ptr[12]);
+ MLA(hi, lo, (*fx)[3], ptr[10]);
+ MLA(hi, lo, (*fx)[4], ptr[ 8]);
+ MLA(hi, lo, (*fx)[5], ptr[ 6]);
+ MLA(hi, lo, (*fx)[6], ptr[ 4]);
+ MLA(hi, lo, (*fx)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ pcm2 = pcm1 + 14;
+
+ for (sb = 1; sb < 16; ++sb) {
+ ++fe;
+ ++Dptr;
+
+ /* D[32 - sb][i] == -D[sb][31 - i] */
+
+ if (!(sb & 1)) {
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+ MLN(hi, lo);
+
+ ptr = *Dptr + pe;
+ MLA(hi, lo, (*fe)[7], ptr[ 2]);
+ MLA(hi, lo, (*fe)[6], ptr[ 4]);
+ MLA(hi, lo, (*fe)[5], ptr[ 6]);
+ MLA(hi, lo, (*fe)[4], ptr[ 8]);
+ MLA(hi, lo, (*fe)[3], ptr[10]);
+ MLA(hi, lo, (*fe)[2], ptr[12]);
+ MLA(hi, lo, (*fe)[1], ptr[14]);
+ MLA(hi, lo, (*fe)[0], ptr[ 0]);
+
+ *pcm1++ = SHIFT(MLZ(hi, lo));
+
+ ptr = *Dptr - po;
+ ML0(hi, lo, (*fo)[7], ptr[31 - 2]);
+ MLA(hi, lo, (*fo)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fo)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fo)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fo)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fo)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fo)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fo)[0], ptr[31 - 16]);
+
+ ptr = *Dptr - pe;
+ MLA(hi, lo, (*fe)[0], ptr[31 - 16]);
+ MLA(hi, lo, (*fe)[1], ptr[31 - 14]);
+ MLA(hi, lo, (*fe)[2], ptr[31 - 12]);
+ MLA(hi, lo, (*fe)[3], ptr[31 - 10]);
+ MLA(hi, lo, (*fe)[4], ptr[31 - 8]);
+ MLA(hi, lo, (*fe)[5], ptr[31 - 6]);
+ MLA(hi, lo, (*fe)[6], ptr[31 - 4]);
+ MLA(hi, lo, (*fe)[7], ptr[31 - 2]);
+
+ *pcm2-- = SHIFT(MLZ(hi, lo));
+ }
+
+ ++fo;
+ }
+
+ ++Dptr;
+
+ ptr = *Dptr + po;
+ ML0(hi, lo, (*fo)[0], ptr[ 0]);
+ MLA(hi, lo, (*fo)[1], ptr[14]);
+ MLA(hi, lo, (*fo)[2], ptr[12]);
+ MLA(hi, lo, (*fo)[3], ptr[10]);
+ MLA(hi, lo, (*fo)[4], ptr[ 8]);
+ MLA(hi, lo, (*fo)[5], ptr[ 6]);
+ MLA(hi, lo, (*fo)[6], ptr[ 4]);
+ MLA(hi, lo, (*fo)[7], ptr[ 2]);
+
+ *pcm1 = SHIFT(-MLZ(hi, lo));
+ pcm1 += 8;
+
+ phase = (phase + 1) % 16;
+ }
+ }
+}
+
+/*
+ * NAME: synth->frame()
+ * DESCRIPTION: perform PCM synthesis of frame subband samples
+ */
+void mad_synth_frame(struct mad_synth *synth, struct mad_frame const *frame)
+{
+ unsigned int nch, ns;
+ void (*synth_frame)(struct mad_synth *, struct mad_frame const *,
+ unsigned int, unsigned int);
+
+ nch = MAD_NCHANNELS(&frame->header);
+ ns = MAD_NSBSAMPLES(&frame->header);
+
+ synth->pcm.samplerate = frame->header.samplerate;
+ synth->pcm.channels = nch;
+ synth->pcm.length = 32 * ns;
+
+ synth_frame = synth_full;
+
+ if (frame->options & MAD_OPTION_HALFSAMPLERATE) {
+ synth->pcm.samplerate /= 2;
+ synth->pcm.length /= 2;
+
+ synth_frame = synth_half;
+ }
+
+ synth_frame(synth, frame, nch, ns);
+
+ synth->phase = (synth->phase + ns) % 16;
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/synth.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/synth.h
new file mode 100644
index 000000000..77a3a5edd
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/synth.h
@@ -0,0 +1,69 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: synth.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_SYNTH_H
+# define LIBMAD_SYNTH_H
+
+# include "fixed.h"
+# include "frame.h"
+
+struct mad_pcm {
+ unsigned int samplerate; /* sampling frequency (Hz) */
+ unsigned short channels; /* number of channels */
+ unsigned short length; /* number of samples per channel */
+ mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
+};
+
+struct mad_synth {
+ mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
+ /* [ch][eo][peo][s][v] */
+
+ unsigned int phase; /* current processing phase */
+
+ struct mad_pcm pcm; /* PCM output */
+};
+
+/* single channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_SINGLE = 0
+};
+
+/* dual channel PCM selector */
+enum {
+ MAD_PCM_CHANNEL_DUAL_1 = 0,
+ MAD_PCM_CHANNEL_DUAL_2 = 1
+};
+
+/* stereo PCM selector */
+enum {
+ MAD_PCM_CHANNEL_STEREO_LEFT = 0,
+ MAD_PCM_CHANNEL_STEREO_RIGHT = 1
+};
+
+void mad_synth_init(struct mad_synth *);
+
+# define mad_synth_finish(synth) /* nothing */
+
+void mad_synth_mute(struct mad_synth *);
+
+void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/timer.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/timer.c
new file mode 100644
index 000000000..cefe1b677
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/timer.c
@@ -0,0 +1,485 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: timer.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# include <stdio.h>
+
+# ifdef HAVE_ASSERT_H
+# include <assert.h>
+# endif
+
+# include "timer.h"
+
+mad_timer_t const mad_timer_zero = { 0, 0 };
+
+/*
+ * NAME: timer->compare()
+ * DESCRIPTION: indicate relative order of two timers
+ */
+int mad_timer_compare(mad_timer_t timer1, mad_timer_t timer2)
+{
+ signed long diff;
+
+ diff = timer1.seconds - timer2.seconds;
+ if (diff < 0)
+ return -1;
+ else if (diff > 0)
+ return +1;
+
+ diff = timer1.fraction - timer2.fraction;
+ if (diff < 0)
+ return -1;
+ else if (diff > 0)
+ return +1;
+
+ return 0;
+}
+
+/*
+ * NAME: timer->negate()
+ * DESCRIPTION: invert the sign of a timer
+ */
+void mad_timer_negate(mad_timer_t *timer)
+{
+ timer->seconds = -timer->seconds;
+
+ if (timer->fraction) {
+ timer->seconds -= 1;
+ timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction;
+ }
+}
+
+/*
+ * NAME: timer->abs()
+ * DESCRIPTION: return the absolute value of a timer
+ */
+mad_timer_t mad_timer_abs(mad_timer_t timer)
+{
+ if (timer.seconds < 0)
+ mad_timer_negate(&timer);
+
+ return timer;
+}
+
+/*
+ * NAME: reduce_timer()
+ * DESCRIPTION: carry timer fraction into seconds
+ */
+static
+void reduce_timer(mad_timer_t *timer)
+{
+ timer->seconds += timer->fraction / MAD_TIMER_RESOLUTION;
+ timer->fraction %= MAD_TIMER_RESOLUTION;
+}
+
+/*
+ * NAME: gcd()
+ * DESCRIPTION: compute greatest common denominator
+ */
+static
+unsigned long gcd(unsigned long num1, unsigned long num2)
+{
+ unsigned long tmp;
+
+ while (num2) {
+ tmp = num2;
+ num2 = num1 % num2;
+ num1 = tmp;
+ }
+
+ return num1;
+}
+
+/*
+ * NAME: reduce_rational()
+ * DESCRIPTION: convert rational expression to lowest terms
+ */
+static
+void reduce_rational(unsigned long *numer, unsigned long *denom)
+{
+ unsigned long factor;
+
+ factor = gcd(*numer, *denom);
+
+ assert(factor != 0);
+
+ *numer /= factor;
+ *denom /= factor;
+}
+
+/*
+ * NAME: scale_rational()
+ * DESCRIPTION: solve numer/denom == ?/scale avoiding overflowing
+ */
+static
+unsigned long scale_rational(unsigned long numer, unsigned long denom,
+ unsigned long scale)
+{
+ reduce_rational(&numer, &denom);
+ reduce_rational(&scale, &denom);
+
+ assert(denom != 0);
+
+ if (denom < scale)
+ return numer * (scale / denom) + numer * (scale % denom) / denom;
+ if (denom < numer)
+ return scale * (numer / denom) + scale * (numer % denom) / denom;
+
+ return numer * scale / denom;
+}
+
+/*
+ * NAME: timer->set()
+ * DESCRIPTION: set timer to specific (positive) value
+ */
+void mad_timer_set(mad_timer_t *timer, unsigned long seconds,
+ unsigned long numer, unsigned long denom)
+{
+ timer->seconds = seconds;
+ if (numer >= denom && denom > 0) {
+ timer->seconds += numer / denom;
+ numer %= denom;
+ }
+
+ switch (denom) {
+ case 0:
+ case 1:
+ timer->fraction = 0;
+ break;
+
+ case MAD_TIMER_RESOLUTION:
+ timer->fraction = numer;
+ break;
+
+ case 1000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 1000);
+ break;
+
+ case 8000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 8000);
+ break;
+
+ case 11025:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 11025);
+ break;
+
+ case 12000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 12000);
+ break;
+
+ case 16000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 16000);
+ break;
+
+ case 22050:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 22050);
+ break;
+
+ case 24000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 24000);
+ break;
+
+ case 32000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 32000);
+ break;
+
+ case 44100:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 44100);
+ break;
+
+ case 48000:
+ timer->fraction = numer * (MAD_TIMER_RESOLUTION / 48000);
+ break;
+
+ default:
+ timer->fraction = scale_rational(numer, denom, MAD_TIMER_RESOLUTION);
+ break;
+ }
+
+ if (timer->fraction >= MAD_TIMER_RESOLUTION)
+ reduce_timer(timer);
+}
+
+/*
+ * NAME: timer->add()
+ * DESCRIPTION: add one timer to another
+ */
+void mad_timer_add(mad_timer_t *timer, mad_timer_t incr)
+{
+ timer->seconds += incr.seconds;
+ timer->fraction += incr.fraction;
+
+ if (timer->fraction >= MAD_TIMER_RESOLUTION)
+ reduce_timer(timer);
+}
+
+/*
+ * NAME: timer->multiply()
+ * DESCRIPTION: multiply a timer by a scalar value
+ */
+void mad_timer_multiply(mad_timer_t *timer, signed long scalar)
+{
+ mad_timer_t addend;
+ unsigned long factor;
+
+ factor = scalar;
+ if (scalar < 0) {
+ factor = -scalar;
+ mad_timer_negate(timer);
+ }
+
+ addend = *timer;
+ *timer = mad_timer_zero;
+
+ while (factor) {
+ if (factor & 1)
+ mad_timer_add(timer, addend);
+
+ mad_timer_add(&addend, addend);
+ factor >>= 1;
+ }
+}
+
+/*
+ * NAME: timer->count()
+ * DESCRIPTION: return timer value in selected units
+ */
+signed long mad_timer_count(mad_timer_t timer, enum mad_units units)
+{
+ switch (units) {
+ case MAD_UNITS_HOURS:
+ return timer.seconds / 60 / 60;
+
+ case MAD_UNITS_MINUTES:
+ return timer.seconds / 60;
+
+ case MAD_UNITS_SECONDS:
+ return timer.seconds;
+
+ case MAD_UNITS_DECISECONDS:
+ case MAD_UNITS_CENTISECONDS:
+ case MAD_UNITS_MILLISECONDS:
+
+ case MAD_UNITS_8000_HZ:
+ case MAD_UNITS_11025_HZ:
+ case MAD_UNITS_12000_HZ:
+ case MAD_UNITS_16000_HZ:
+ case MAD_UNITS_22050_HZ:
+ case MAD_UNITS_24000_HZ:
+ case MAD_UNITS_32000_HZ:
+ case MAD_UNITS_44100_HZ:
+ case MAD_UNITS_48000_HZ:
+
+ case MAD_UNITS_24_FPS:
+ case MAD_UNITS_25_FPS:
+ case MAD_UNITS_30_FPS:
+ case MAD_UNITS_48_FPS:
+ case MAD_UNITS_50_FPS:
+ case MAD_UNITS_60_FPS:
+ case MAD_UNITS_75_FPS:
+ return timer.seconds * (signed long) units +
+ (signed long) scale_rational(timer.fraction, MAD_TIMER_RESOLUTION,
+ units);
+
+ case MAD_UNITS_23_976_FPS:
+ case MAD_UNITS_24_975_FPS:
+ case MAD_UNITS_29_97_FPS:
+ case MAD_UNITS_47_952_FPS:
+ case MAD_UNITS_49_95_FPS:
+ case MAD_UNITS_59_94_FPS:
+ return (mad_timer_count(timer, -units) + 1) * 1000 / 1001;
+ }
+
+ /* unsupported units */
+ return 0;
+}
+
+/*
+ * NAME: timer->fraction()
+ * DESCRIPTION: return fractional part of timer in arbitrary terms
+ */
+unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom)
+{
+ timer = mad_timer_abs(timer);
+
+ switch (denom) {
+ case 0:
+ return timer.fraction ?
+ MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1;
+
+ case MAD_TIMER_RESOLUTION:
+ return timer.fraction;
+
+ default:
+ return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom);
+ }
+}
+
+/*
+ * NAME: timer->string()
+ * DESCRIPTION: write a string representation of a timer using a template
+ */
+void mad_timer_string(mad_timer_t timer,
+ char *dest, char const *format, enum mad_units units,
+ enum mad_units fracunits, unsigned long subparts)
+{
+ unsigned long hours, minutes, seconds, sub;
+ unsigned int frac;
+
+ timer = mad_timer_abs(timer);
+
+ seconds = timer.seconds;
+ frac = sub = 0;
+
+ switch (fracunits) {
+ case MAD_UNITS_HOURS:
+ case MAD_UNITS_MINUTES:
+ case MAD_UNITS_SECONDS:
+ break;
+
+ case MAD_UNITS_DECISECONDS:
+ case MAD_UNITS_CENTISECONDS:
+ case MAD_UNITS_MILLISECONDS:
+
+ case MAD_UNITS_8000_HZ:
+ case MAD_UNITS_11025_HZ:
+ case MAD_UNITS_12000_HZ:
+ case MAD_UNITS_16000_HZ:
+ case MAD_UNITS_22050_HZ:
+ case MAD_UNITS_24000_HZ:
+ case MAD_UNITS_32000_HZ:
+ case MAD_UNITS_44100_HZ:
+ case MAD_UNITS_48000_HZ:
+
+ case MAD_UNITS_24_FPS:
+ case MAD_UNITS_25_FPS:
+ case MAD_UNITS_30_FPS:
+ case MAD_UNITS_48_FPS:
+ case MAD_UNITS_50_FPS:
+ case MAD_UNITS_60_FPS:
+ case MAD_UNITS_75_FPS:
+ {
+ unsigned long denom;
+
+ denom = MAD_TIMER_RESOLUTION / fracunits;
+
+ frac = timer.fraction / denom;
+ sub = scale_rational(timer.fraction % denom, denom, subparts);
+ }
+ break;
+
+ case MAD_UNITS_23_976_FPS:
+ case MAD_UNITS_24_975_FPS:
+ case MAD_UNITS_29_97_FPS:
+ case MAD_UNITS_47_952_FPS:
+ case MAD_UNITS_49_95_FPS:
+ case MAD_UNITS_59_94_FPS:
+ /* drop-frame encoding */
+ /* N.B. this is only well-defined for MAD_UNITS_29_97_FPS */
+ {
+ unsigned long frame, cycle, d, m;
+
+ frame = mad_timer_count(timer, fracunits);
+
+ cycle = -fracunits * 60 * 10 - (10 - 1) * 2;
+
+ d = frame / cycle;
+ m = frame % cycle;
+ frame += (10 - 1) * 2 * d;
+ if (m > 2)
+ frame += 2 * ((m - 2) / (cycle / 10));
+
+ frac = frame % -fracunits;
+ seconds = frame / -fracunits;
+ }
+ break;
+ }
+
+ switch (units) {
+ case MAD_UNITS_HOURS:
+ minutes = seconds / 60;
+ hours = minutes / 60;
+
+ sprintf(dest, format,
+ hours,
+ (unsigned int) (minutes % 60),
+ (unsigned int) (seconds % 60),
+ frac, sub);
+ break;
+
+ case MAD_UNITS_MINUTES:
+ minutes = seconds / 60;
+
+ sprintf(dest, format,
+ minutes,
+ (unsigned int) (seconds % 60),
+ frac, sub);
+ break;
+
+ case MAD_UNITS_SECONDS:
+ sprintf(dest, format,
+ seconds,
+ frac, sub);
+ break;
+
+ case MAD_UNITS_23_976_FPS:
+ case MAD_UNITS_24_975_FPS:
+ case MAD_UNITS_29_97_FPS:
+ case MAD_UNITS_47_952_FPS:
+ case MAD_UNITS_49_95_FPS:
+ case MAD_UNITS_59_94_FPS:
+ if (fracunits < 0) {
+ /* not yet implemented */
+ sub = 0;
+ }
+
+ /* fall through */
+
+ case MAD_UNITS_DECISECONDS:
+ case MAD_UNITS_CENTISECONDS:
+ case MAD_UNITS_MILLISECONDS:
+
+ case MAD_UNITS_8000_HZ:
+ case MAD_UNITS_11025_HZ:
+ case MAD_UNITS_12000_HZ:
+ case MAD_UNITS_16000_HZ:
+ case MAD_UNITS_22050_HZ:
+ case MAD_UNITS_24000_HZ:
+ case MAD_UNITS_32000_HZ:
+ case MAD_UNITS_44100_HZ:
+ case MAD_UNITS_48000_HZ:
+
+ case MAD_UNITS_24_FPS:
+ case MAD_UNITS_25_FPS:
+ case MAD_UNITS_30_FPS:
+ case MAD_UNITS_48_FPS:
+ case MAD_UNITS_50_FPS:
+ case MAD_UNITS_60_FPS:
+ case MAD_UNITS_75_FPS:
+ sprintf(dest, format, mad_timer_count(timer, units), sub);
+ break;
+ }
+}
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/timer.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/timer.h
new file mode 100644
index 000000000..703a86390
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/timer.h
@@ -0,0 +1,100 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: timer.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_TIMER_H
+# define LIBMAD_TIMER_H
+
+typedef struct {
+ signed long seconds; /* whole seconds */
+ unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
+} mad_timer_t;
+
+extern mad_timer_t const mad_timer_zero;
+
+# define MAD_TIMER_RESOLUTION 352800000UL
+
+enum mad_units {
+ MAD_UNITS_HOURS = -2,
+ MAD_UNITS_MINUTES = -1,
+ MAD_UNITS_SECONDS = 0,
+
+ /* metric units */
+
+ MAD_UNITS_DECISECONDS = 10,
+ MAD_UNITS_CENTISECONDS = 100,
+ MAD_UNITS_MILLISECONDS = 1000,
+
+ /* audio sample units */
+
+ MAD_UNITS_8000_HZ = 8000,
+ MAD_UNITS_11025_HZ = 11025,
+ MAD_UNITS_12000_HZ = 12000,
+
+ MAD_UNITS_16000_HZ = 16000,
+ MAD_UNITS_22050_HZ = 22050,
+ MAD_UNITS_24000_HZ = 24000,
+
+ MAD_UNITS_32000_HZ = 32000,
+ MAD_UNITS_44100_HZ = 44100,
+ MAD_UNITS_48000_HZ = 48000,
+
+ /* video frame/field units */
+
+ MAD_UNITS_24_FPS = 24,
+ MAD_UNITS_25_FPS = 25,
+ MAD_UNITS_30_FPS = 30,
+ MAD_UNITS_48_FPS = 48,
+ MAD_UNITS_50_FPS = 50,
+ MAD_UNITS_60_FPS = 60,
+
+ /* CD audio frames */
+
+ MAD_UNITS_75_FPS = 75,
+
+ /* video drop-frame units */
+
+ MAD_UNITS_23_976_FPS = -24,
+ MAD_UNITS_24_975_FPS = -25,
+ MAD_UNITS_29_97_FPS = -30,
+ MAD_UNITS_47_952_FPS = -48,
+ MAD_UNITS_49_95_FPS = -50,
+ MAD_UNITS_59_94_FPS = -60
+};
+
+# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
+
+int mad_timer_compare(mad_timer_t, mad_timer_t);
+
+# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
+
+void mad_timer_negate(mad_timer_t *);
+mad_timer_t mad_timer_abs(mad_timer_t);
+
+void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
+void mad_timer_add(mad_timer_t *, mad_timer_t);
+void mad_timer_multiply(mad_timer_t *, signed long);
+
+signed long mad_timer_count(mad_timer_t, enum mad_units);
+unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
+void mad_timer_string(mad_timer_t, char *, char const *,
+ enum mad_units, enum mad_units, unsigned long);
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/version.c b/src/filters/transform/mpadecfilter/libmad-0.15.0b/version.c
new file mode 100644
index 000000000..a3db5d349
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/version.c
@@ -0,0 +1,91 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: version.c 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifdef HAVE_CONFIG_H
+# include "config.h"
+# endif
+
+# include "global.h"
+
+# include "version.h"
+
+char const mad_version[] = "MPEG Audio Decoder " MAD_VERSION;
+char const mad_copyright[] = "Copyright (C) " MAD_PUBLISHYEAR " " MAD_AUTHOR;
+char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">";
+
+char const mad_build[] = ""
+# if defined(DEBUG)
+ "DEBUG "
+# elif defined(NDEBUG)
+ "NDEBUG "
+# endif
+
+# if defined(EXPERIMENTAL)
+ "EXPERIMENTAL "
+# endif
+
+# if defined(FPM_64BIT)
+ "FPM_64BIT "
+# elif defined(FPM_INTEL)
+ "FPM_INTEL "
+# elif defined(FPM_ARM)
+ "FPM_ARM "
+# elif defined(FPM_MIPS)
+ "FPM_MIPS "
+# elif defined(FPM_SPARC)
+ "FPM_SPARC "
+# elif defined(FPM_PPC)
+ "FPM_PPC "
+# elif defined(FPM_DEFAULT)
+ "FPM_DEFAULT "
+# endif
+
+# if defined(ASO_IMDCT)
+ "ASO_IMDCT "
+# endif
+# if defined(ASO_INTERLEAVE1)
+ "ASO_INTERLEAVE1 "
+# endif
+# if defined(ASO_INTERLEAVE2)
+ "ASO_INTERLEAVE2 "
+# endif
+# if defined(ASO_ZEROCHECK)
+ "ASO_ZEROCHECK "
+# endif
+
+# if defined(OPT_SPEED)
+ "OPT_SPEED "
+# elif defined(OPT_ACCURACY)
+ "OPT_ACCURACY "
+# endif
+
+# if defined(OPT_SSO)
+ "OPT_SSO "
+# endif
+
+# if defined(OPT_DCTO) /* never defined here */
+ "OPT_DCTO "
+# endif
+
+# if defined(OPT_STRICT)
+ "OPT_STRICT "
+# endif
+;
diff --git a/src/filters/transform/mpadecfilter/libmad-0.15.0b/version.h b/src/filters/transform/mpadecfilter/libmad-0.15.0b/version.h
new file mode 100644
index 000000000..64948ba18
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/libmad-0.15.0b/version.h
@@ -0,0 +1,47 @@
+/*
+ * libmad - MPEG audio decoder library
+ * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ *
+ * $Id: version.h 111 2003-08-31 19:00:18Z gabest $
+ */
+
+# ifndef LIBMAD_VERSION_H
+# define LIBMAD_VERSION_H
+
+# define MAD_VERSION_MAJOR 0
+# define MAD_VERSION_MINOR 15
+# define MAD_VERSION_PATCH 0
+# define MAD_VERSION_EXTRA " (beta)"
+
+# define MAD_VERSION_STRINGIZE(str) #str
+# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num)
+
+# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \
+ MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \
+ MAD_VERSION_STRING(MAD_VERSION_PATCH) \
+ MAD_VERSION_EXTRA
+
+# define MAD_PUBLISHYEAR "2000-2003"
+# define MAD_AUTHOR "Underbit Technologies, Inc."
+# define MAD_EMAIL "info@underbit.com"
+
+extern char const mad_version[];
+extern char const mad_copyright[];
+extern char const mad_author[];
+extern char const mad_build[];
+
+# endif
diff --git a/src/filters/transform/mpadecfilter/resource.h b/src/filters/transform/mpadecfilter/resource.h
new file mode 100644
index 000000000..98107aaad
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by MpaDecFilter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/transform/mpadecfilter/stdafx.cpp b/src/filters/transform/mpadecfilter/stdafx.cpp
new file mode 100644
index 000000000..bdacb59f9
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// MpaDecFilter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/transform/mpadecfilter/stdafx.h b/src/filters/transform/mpadecfilter/stdafx.h
new file mode 100644
index 000000000..0029f3c7e
--- /dev/null
+++ b/src/filters/transform/mpadecfilter/stdafx.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
diff --git a/src/filters/transform/mpeg2decfilter/IMpeg2DecFilter.h b/src/filters/transform/mpeg2decfilter/IMpeg2DecFilter.h
new file mode 100644
index 000000000..c4112dcc1
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/IMpeg2DecFilter.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+typedef enum {DIAuto, DIWeave, DIBlend, DIBob, DIFieldShift} ditype;
+
+[uuid("0ABEAA65-0317-47B9-AE1D-D9EA905AFD25")]
+interface IMpeg2DecFilter : public IUnknown
+{
+ STDMETHOD(SetDeinterlaceMethod(ditype di)) = 0;
+ STDMETHOD_(ditype, GetDeinterlaceMethod()) = 0;
+
+ // Brightness: -255.0 to 255.0, default 0.0
+ // Contrast: 0.0 to 10.0, default 1.0
+ // Hue: -180.0 to +180.0, default 0.0
+ // Saturation: 0.0 to 10.0, default 1.0
+
+ STDMETHOD(SetBrightness(float brightness)) = 0;
+ STDMETHOD(SetContrast(float contrast)) = 0;
+ STDMETHOD(SetHue(float hue)) = 0;
+ STDMETHOD(SetSaturation(float saturation)) = 0;
+ STDMETHOD_(float, GetBrightness()) = 0;
+ STDMETHOD_(float, GetContrast()) = 0;
+ STDMETHOD_(float, GetHue()) = 0;
+ STDMETHOD_(float, GetSaturation()) = 0;
+
+ STDMETHOD(EnableForcedSubtitles(bool fEnable)) = 0;
+ STDMETHOD_(bool, IsForcedSubtitlesEnabled()) = 0;
+
+ STDMETHOD(EnablePlanarYUV(bool fEnable)) = 0;
+ STDMETHOD_(bool, IsPlanarYUVEnabled()) = 0;
+
+ STDMETHOD(EnableInterlaced(bool fEnable)) = 0;
+ STDMETHOD_(bool, IsInterlacedEnabled()) = 0;
+};
+
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.cpp b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.cpp
new file mode 100644
index 000000000..1661e8b12
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.cpp
@@ -0,0 +1,2179 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <math.h>
+#include <atlbase.h>
+#include <ks.h>
+#include <ksmedia.h>
+#include "libmpeg2.h"
+#include "Mpeg2DecFilter.h"
+
+#include <xmmintrin.h>
+#include <emmintrin.h>
+
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+#define EPSILON 1e-4
+
+#ifdef REGISTER_FILTER
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_DVD_ENCRYPTED_PACK, &MEDIASUBTYPE_MPEG2_VIDEO},
+ {&MEDIATYPE_MPEG2_PACK, &MEDIASUBTYPE_MPEG2_VIDEO},
+ {&MEDIATYPE_MPEG2_PES, &MEDIASUBTYPE_MPEG2_VIDEO},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG2_VIDEO},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Packet},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Payload},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_IYUV},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut}
+};
+
+const AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CMpeg2DecFilter), L"MPV Decoder Filter", 0x40000002, countof(sudpPins), sudpPins},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CMpeg2DecFilter>, NULL, &sudFilter[0]},
+ {L"CMpeg2DecPropertyPage", &__uuidof(CMpeg2DecSettingsWnd), CreateInstance<CInternalPropertyPageTempl<CMpeg2DecSettingsWnd> >},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+STDAPI DllRegisterServer()
+{
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+//
+
+#include "..\..\..\..\include\detours\detours.h"
+
+DETOUR_TRAMPOLINE(BOOL WINAPI Real_IsDebuggerPresent(), IsDebuggerPresent);
+BOOL WINAPI Mine_IsDebuggerPresent()
+{
+ TRACE(_T("Oops, somebody was trying to be naughty! (called IsDebuggerPresent)\n"));
+ return FALSE;
+}
+
+DETOUR_TRAMPOLINE(LONG WINAPI Real_ChangeDisplaySettingsExA(LPCSTR lpszDeviceName, LPDEVMODEA lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam), ChangeDisplaySettingsExA);
+DETOUR_TRAMPOLINE(LONG WINAPI Real_ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam), ChangeDisplaySettingsExW);
+LONG WINAPI Mine_ChangeDisplaySettingsEx(LONG ret, DWORD dwFlags, LPVOID lParam)
+{
+ if(dwFlags&CDS_VIDEOPARAMETERS)
+ {
+ VIDEOPARAMETERS* vp = (VIDEOPARAMETERS*)lParam;
+
+ if(vp->Guid == GUIDFromCString(_T("{02C62061-1097-11d1-920F-00A024DF156E}"))
+ && (vp->dwFlags&VP_FLAGS_COPYPROTECT))
+ {
+ if(vp->dwCommand == VP_COMMAND_GET)
+ {
+ if((vp->dwTVStandard&VP_TV_STANDARD_WIN_VGA) && vp->dwTVStandard != VP_TV_STANDARD_WIN_VGA)
+ {
+ TRACE(_T("Ooops, tv-out enabled? macrovision checks suck..."));
+ vp->dwTVStandard = VP_TV_STANDARD_WIN_VGA;
+ }
+ }
+ else if(vp->dwCommand == VP_COMMAND_SET)
+ {
+ TRACE(_T("Ooops, as I already told ya, no need for any macrovision bs here"));
+ return 0;
+ }
+ }
+ }
+
+ return ret;
+}
+LONG WINAPI Mine_ChangeDisplaySettingsExA(LPCSTR lpszDeviceName, LPDEVMODEA lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam)
+{
+ return Mine_ChangeDisplaySettingsEx(Real_ChangeDisplaySettingsExA(lpszDeviceName, lpDevMode, hwnd, dwFlags, lParam), dwFlags, lParam);
+}
+LONG WINAPI Mine_ChangeDisplaySettingsExW(LPCWSTR lpszDeviceName, LPDEVMODEW lpDevMode, HWND hwnd, DWORD dwFlags, LPVOID lParam)
+{
+ return Mine_ChangeDisplaySettingsEx(Real_ChangeDisplaySettingsExW(lpszDeviceName, lpDevMode, hwnd, dwFlags, lParam), dwFlags, lParam);
+}
+
+//
+
+#include "..\..\FilterApp.h"
+
+class CMpeg2DecFilterApp : public CFilterApp
+{
+public:
+ BOOL InitInstance()
+ {
+ if(!__super::InitInstance()) return FALSE;
+ DetourFunctionWithTrampoline((PBYTE)Real_IsDebuggerPresent, (PBYTE)Mine_IsDebuggerPresent);
+ DetourFunctionWithTrampoline((PBYTE)Real_ChangeDisplaySettingsExA, (PBYTE)Mine_ChangeDisplaySettingsExA);
+ DetourFunctionWithTrampoline((PBYTE)Real_ChangeDisplaySettingsExW, (PBYTE)Mine_ChangeDisplaySettingsExW);
+ return TRUE;
+ }
+};
+
+CMpeg2DecFilterApp theApp;
+
+#endif
+
+//
+// CMpeg2DecFilter
+//
+
+CMpeg2DecFilter::CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr)
+ : CBaseVideoFilter(NAME("CMpeg2DecFilter"), lpunk, phr, __uuidof(this), 1)
+ , m_fWaitForKeyFrame(true)
+{
+ delete m_pInput;
+// delete m_pOutput;
+
+ if(FAILED(*phr)) return;
+
+ if(!(m_pInput = new CMpeg2DecInputPin(this, phr, L"Video"))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
+
+// if(!(m_pOutput = new CMpeg2DecOutputPin(this, phr, L"Output"))) *phr = E_OUTOFMEMORY;
+// if(FAILED(*phr)) return;
+
+ if(!(m_pSubpicInput = new CSubpicInputPin(this, phr))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
+
+ if(!(m_pClosedCaptionOutput = new CClosedCaptionOutputPin(this, m_pLock, phr))) *phr = E_OUTOFMEMORY;
+ if(FAILED(*phr)) return;
+
+ SetDeinterlaceMethod(DIAuto);
+ SetBrightness(0.0f);
+ SetContrast(1.0f);
+ SetHue(0.0f);
+ SetSaturation(1.0f);
+ EnableForcedSubtitles(true);
+ EnablePlanarYUV(true);
+ EnableInterlaced(false);
+
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Open(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder"), KEY_READ))
+ {
+ DWORD dw;
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("DeinterlaceMethod"), dw)) SetDeinterlaceMethod((ditype)dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Brightness"), dw)) SetBrightness(*(float*)&dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Contrast"), dw)) SetContrast(*(float*)&dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Hue"), dw)) SetHue(*(float*)&dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Saturation"), dw)) SetSaturation(*(float*)&dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("ForcedSubtitles"), dw)) EnableForcedSubtitles(!!dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("PlanarYUV"), dw)) EnablePlanarYUV(!!dw);
+ if(ERROR_SUCCESS == key.QueryDWORDValue(_T("Interlaced"), dw)) EnableInterlaced(!!dw);
+ }
+
+ m_rate.Rate = 10000;
+ m_rate.StartTime = 0;
+}
+
+CMpeg2DecFilter::~CMpeg2DecFilter()
+{
+ CRegKey key;
+ if(ERROR_SUCCESS == key.Create(HKEY_CURRENT_USER, _T("Software\\Gabest\\Filters\\MPEG Video Decoder")))
+ {
+ key.SetDWORDValue(_T("DeinterlaceMethod"), m_ditype);
+ key.SetDWORDValue(_T("Brightness"), *(DWORD*)&m_bright);
+ key.SetDWORDValue(_T("Contrast"), *(DWORD*)&m_cont);
+ key.SetDWORDValue(_T("Hue"), *(DWORD*)&m_hue);
+ key.SetDWORDValue(_T("Saturation"), *(DWORD*)&m_sat);
+ key.SetDWORDValue(_T("ForcedSubtitles"), m_fForcedSubs);
+ key.SetDWORDValue(_T("PlanarYUV"), m_fPlanarYUV);
+ key.SetDWORDValue(_T("Interlaced"), m_fInterlaced);
+ }
+
+ delete m_pSubpicInput;
+ delete m_pClosedCaptionOutput;
+}
+
+STDMETHODIMP CMpeg2DecFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(IMpeg2DecFilter)
+ QI(ISpecifyPropertyPages)
+ QI(ISpecifyPropertyPages2)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+int CMpeg2DecFilter::GetPinCount()
+{
+ return 4;
+}
+
+CBasePin* CMpeg2DecFilter::GetPin(int n)
+{
+ switch(n)
+ {
+ case 0: return m_pInput;
+ case 1: return m_pOutput;
+ case 2: return m_pSubpicInput;
+ case 3: return m_pClosedCaptionOutput;
+ }
+ return NULL;
+}
+
+HRESULT CMpeg2DecFilter::EndOfStream()
+{
+ CAutoLock cAutoLock(&m_csReceive);
+ m_pClosedCaptionOutput->EndOfStream();
+ return __super::EndOfStream();
+}
+
+HRESULT CMpeg2DecFilter::BeginFlush()
+{
+ m_pClosedCaptionOutput->DeliverBeginFlush();
+ return __super::BeginFlush();
+}
+
+HRESULT CMpeg2DecFilter::EndFlush()
+{
+ m_pClosedCaptionOutput->DeliverEndFlush();
+ return __super::EndFlush();
+}
+
+HRESULT CMpeg2DecFilter::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+ m_pClosedCaptionOutput->DeliverNewSegment(tStart, tStop, dRate);
+ m_fDropFrames = false;
+ return __super::NewSegment(tStart, tStop, dRate);
+}
+
+void CMpeg2DecFilter::InputTypeChanged()
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ TRACE(_T("ResetMpeg2Decoder()\n"));
+
+ for(int i = 0; i < countof(m_dec->m_pictures); i++)
+ {
+ m_dec->m_pictures[i].rtStart = m_dec->m_pictures[i].rtStop = _I64_MIN+1;
+ m_dec->m_pictures[i].fDelivered = false;
+ m_dec->m_pictures[i].flags &= ~PIC_MASK_CODING_TYPE;
+ }
+
+ const CMediaType& mt = m_pInput->CurrentMediaType();
+
+ BYTE* pSequenceHeader = NULL;
+ DWORD cbSequenceHeader = 0;
+
+ if(mt.formattype == FORMAT_MPEGVideo)
+ {
+ pSequenceHeader = ((MPEG1VIDEOINFO*)mt.Format())->bSequenceHeader;
+ cbSequenceHeader = ((MPEG1VIDEOINFO*)mt.Format())->cbSequenceHeader;
+ }
+ else if(mt.formattype == FORMAT_MPEG2_VIDEO)
+ {
+ pSequenceHeader = (BYTE*)((MPEG2VIDEOINFO*)mt.Format())->dwSequenceHeader;
+ cbSequenceHeader = ((MPEG2VIDEOINFO*)mt.Format())->cbSequenceHeader;
+ }
+
+ m_dec->mpeg2_close();
+ m_dec->mpeg2_init();
+
+ m_dec->mpeg2_buffer(pSequenceHeader, pSequenceHeader + cbSequenceHeader);
+
+ m_fWaitForKeyFrame = true;
+
+ m_fFilm = false;
+ m_fb.flags = 0;
+}
+
+void CMpeg2DecFilter::SetDeinterlaceMethod()
+{
+ ASSERT(m_dec->m_info.m_sequence);
+ ASSERT(m_dec->m_info.m_display_picture);
+
+ DWORD seqflags = m_dec->m_info.m_sequence->flags;
+ DWORD oldflags = m_fb.flags;
+ DWORD newflags = m_dec->m_info.m_display_picture->flags;
+
+ if(!(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
+ && !(oldflags & PIC_FLAG_REPEAT_FIRST_FIELD)
+ && (newflags & PIC_FLAG_PROGRESSIVE_FRAME))
+ {
+ if(!m_fFilm && (newflags & PIC_FLAG_REPEAT_FIRST_FIELD))
+ {
+ TRACE(_T("m_fFilm = true\n"));
+ m_fFilm = true;
+ }
+ else if(m_fFilm && !(newflags & PIC_FLAG_REPEAT_FIRST_FIELD))
+ {
+ TRACE(_T("m_fFilm = false\n"));
+ m_fFilm = false;
+ }
+ }
+
+ const CMediaType& mt = m_pOutput->CurrentMediaType();
+
+ if(mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced))
+ {
+ m_fb.di = DIWeave;
+ }
+ else
+ {
+ m_fb.di = GetDeinterlaceMethod();
+
+ if(m_fb.di == DIAuto || m_fb.di != DIWeave && m_fb.di != DIBlend && m_fb.di != DIBob && m_fb.di != DIFieldShift)
+ {
+ if(seqflags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
+ m_fb.di = DIWeave; // hurray!
+ else if(m_fFilm)
+ m_fb.di = DIWeave; // we are lucky
+ else if(!(m_fb.flags & PIC_FLAG_PROGRESSIVE_FRAME))
+ m_fb.di = DIBlend; // ok, clear thing
+ else
+ // big trouble here, the progressive_frame bit is not reliable :'(
+ // frames without temporal field diffs can be only detected when ntsc
+ // uses the repeat field flag (signaled with m_fFilm), if it's not set
+ // or we have pal then we might end up blending the fields unnecessarily...
+ m_fb.di = DIBlend;
+ }
+ }
+
+ m_fb.flags = newflags;
+}
+
+void CMpeg2DecFilter::SetTypeSpecificFlags(IMediaSample* pMS)
+{
+ if(CComQIPtr<IMediaSample2> pMS2 = pMS)
+ {
+ AM_SAMPLE2_PROPERTIES props;
+ if(SUCCEEDED(pMS2->GetProperties(sizeof(props), (BYTE*)&props)))
+ {
+ props.dwTypeSpecificFlags &= ~0x7f;
+
+ const CMediaType& mt = m_pOutput->CurrentMediaType();
+ if(mt.formattype == FORMAT_VideoInfo2 && (((VIDEOINFOHEADER2*)mt.pbFormat)->dwInterlaceFlags & AMINTERLACE_IsInterlaced))
+ {
+ // props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_WEAVE;
+
+ if(m_fb.flags & PIC_FLAG_TOP_FIELD_FIRST)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_FIELD1FIRST;
+ if(m_fb.flags & PIC_FLAG_REPEAT_FIRST_FIELD)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_REPEAT_FIELD;
+
+ if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_I_SAMPLE;
+ if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_P)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_P_SAMPLE;
+ if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B)
+ props.dwTypeSpecificFlags |= AM_VIDEO_FLAG_B_SAMPLE;
+ }
+
+ pMS2->SetProperties(sizeof(props), (BYTE*)&props);
+ }
+ }
+}
+
+HRESULT CMpeg2DecFilter::Transform(IMediaSample* pIn)
+{
+ HRESULT hr;
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pIn->GetPointer(&pDataIn)))
+ return hr;
+
+ long len = pIn->GetActualDataLength();
+
+ ((CDeCSSInputPin*)m_pInput)->StripPacket(pDataIn, len);
+
+ if(pIn->IsDiscontinuity() == S_OK)
+ {
+ InputTypeChanged();
+ }
+
+ REFERENCE_TIME rtStart = _I64_MIN, rtStop = _I64_MIN;
+ hr = pIn->GetTime(&rtStart, &rtStop);
+ if(FAILED(hr)) rtStart = rtStop = _I64_MIN;
+
+ while(len >= 0)
+ {
+ mpeg2_state_t state = m_dec->mpeg2_parse();
+
+ __asm emms; // this one is missing somewhere in the precompiled mmx obj files
+
+ switch(state)
+ {
+ case STATE_BUFFER:
+ if(len > 0) {m_dec->mpeg2_buffer(pDataIn, pDataIn + len); len = 0;}
+ else len = -1;
+ break;
+ case STATE_INVALID:
+ TRACE(_T("*** STATE_INVALID\n"));
+ break;
+ case STATE_GOP:
+ m_pClosedCaptionOutput->Deliver(m_dec->m_info.m_user_data, m_dec->m_info.m_user_data_len);
+ break;
+ case STATE_SEQUENCE:
+ m_AvgTimePerFrame = m_dec->m_info.m_sequence->frame_period
+ ? 10i64 * m_dec->m_info.m_sequence->frame_period / 27
+ : ((VIDEOINFOHEADER*)m_pInput->CurrentMediaType().Format())->AvgTimePerFrame;
+ break;
+ case STATE_PICTURE:
+ m_dec->m_picture->rtStart = rtStart; rtStart = _I64_MIN;
+ m_dec->m_picture->fDelivered = false;
+ m_dec->mpeg2_skip(m_fDropFrames && (m_dec->m_picture->flags&PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_B);
+ break;
+ case STATE_SLICE:
+ case STATE_END:
+ {
+ mpeg2_picture_t* picture = m_dec->m_info.m_display_picture;
+ mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
+
+ if(picture && !(picture->flags&PIC_FLAG_SKIP) && fbuf)
+ {
+ ASSERT(!picture->fDelivered);
+
+ picture->fDelivered = true;
+
+ // frame buffer
+
+ int w = m_dec->m_info.m_sequence->picture_width;
+ int h = m_dec->m_info.m_sequence->picture_height;
+ int pitch = (m_dec->m_info.m_sequence->width + 31) & ~31;
+
+ if(m_fb.w != w || m_fb.h != h || m_fb.pitch != pitch)
+ m_fb.alloc(w, h, pitch);
+
+ // start - end
+
+ m_fb.rtStart = picture->rtStart;
+ if(m_fb.rtStart == _I64_MIN) m_fb.rtStart = m_fb.rtStop;
+ m_fb.rtStop = m_fb.rtStart + m_AvgTimePerFrame * picture->nb_fields / (m_dec->m_info.m_display_picture_2nd ? 1 : 2);
+
+ REFERENCE_TIME rtStart = m_fb.rtStart;
+ REFERENCE_TIME rtStop = m_fb.rtStop;
+
+ //
+
+ SetDeinterlaceMethod();
+
+ if(S_OK != (hr = DeliverFast())
+ && S_OK != (hr = DeliverNormal()))
+ return hr;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ return S_OK;
+}
+
+HRESULT CMpeg2DecFilter::IsVideoInterlaced()
+{
+ return IsInterlacedEnabled();
+}
+
+HRESULT CMpeg2DecFilter::DeliverFast()
+{
+ HRESULT hr;
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
+ if(!fbuf) return S_FALSE;
+
+ {
+
+ CAutoLock cAutoLock2(&m_csProps);
+
+ if(GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator
+ || m_pSubpicInput->HasAnythingToRender(m_fb.rtStart)
+ || fabs(m_bright) > EPSILON || fabs(m_cont-1.0) > EPSILON
+ || fabs(m_hue) > EPSILON || fabs(m_sat-1.0) > EPSILON)
+ return S_FALSE;
+ }
+
+ if((m_fb.flags & PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I)
+ m_fWaitForKeyFrame = false;
+
+ if(m_fb.rtStart < 0 || m_fWaitForKeyFrame)
+ return S_OK;
+
+ const CMediaType& mt = m_pOutput->CurrentMediaType();
+
+ if(mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12)
+ return S_FALSE;
+
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ if(mt.subtype != MEDIASUBTYPE_I420 && mt.subtype != MEDIASUBTYPE_IYUV && mt.subtype != MEDIASUBTYPE_YV12)
+ return S_FALSE;
+
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&mt, &bihOut);
+
+ int w = bihOut.biWidth;
+ int h = abs(bihOut.biHeight);
+ int srcpitch = m_dec->m_info.m_sequence->width; // TODO (..+7)&~7; ?
+ int dstpitch = bihOut.biWidth;
+
+ BYTE* y = pDataOut;
+ BYTE* u = y + dstpitch*h;
+ BYTE* v = y + dstpitch*h*5/4;
+
+ if(bihOut.biCompression == '21VY') {BYTE* tmp = u; u = v; v = tmp;}
+
+ if(m_fb.di == DIWeave)
+ {
+ BitBltFromI420ToI420(w, h, y, u, v, dstpitch, fbuf->buf[0], fbuf->buf[1], fbuf->buf[2], srcpitch);
+ }
+ else if(m_fb.di == DIBlend)
+ {
+ DeinterlaceBlend(y, fbuf->buf[0], w, h, dstpitch, srcpitch);
+ DeinterlaceBlend(u, fbuf->buf[1], w/2, h/2, dstpitch/2, srcpitch/2);
+ DeinterlaceBlend(v, fbuf->buf[2], w/2, h/2, dstpitch/2, srcpitch/2);
+ }
+ else // TODO
+ {
+ return S_FALSE;
+ }
+
+ if(h == 1088)
+ {
+ memset(y + dstpitch*(h-8), 0xff, dstpitch*8);
+ memset(u + dstpitch*(h-8)/4, 0x80, dstpitch*8/4);
+ memset(v + dstpitch*(h-8)/4, 0x80, dstpitch*8/4);
+ }
+
+ if(CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput))
+ {
+ CAutoLock cAutoLock(&pPin->m_csRateLock);
+
+ if(m_rate.Rate != pPin->m_ratechange.Rate)
+ {
+ m_rate.Rate = pPin->m_ratechange.Rate;
+ m_rate.StartTime = m_fb.rtStart;
+ }
+ }
+
+ REFERENCE_TIME rtStart = m_fb.rtStart;
+ REFERENCE_TIME rtStop = m_fb.rtStop;
+
+ rtStart = m_rate.StartTime + (rtStart - m_rate.StartTime) * m_rate.Rate / 10000;
+ rtStop = m_rate.StartTime + (rtStop - m_rate.StartTime) * m_rate.Rate / 10000;
+
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
+
+ //
+
+ SetTypeSpecificFlags(pOut);
+
+ //
+
+ return m_pOutput->Deliver(pOut);
+}
+
+HRESULT CMpeg2DecFilter::DeliverNormal()
+{
+ HRESULT hr;
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ mpeg2_fbuf_t* fbuf = m_dec->m_info.m_display_fbuf;
+ if(!fbuf) return S_FALSE;
+
+ int w = m_fb.w;
+ int h = m_fb.h;
+ int spitch = m_dec->m_info.m_sequence->width; // TODO (..+7)&~7; ?
+ int dpitch = m_fb.pitch;
+
+ REFERENCE_TIME rtStart = m_fb.rtStart;
+ REFERENCE_TIME rtStop = m_fb.rtStop;
+
+ bool tff = !!(m_fb.flags&PIC_FLAG_TOP_FIELD_FIRST);
+
+ // deinterlace
+
+ if(m_fb.di == DIWeave)
+ {
+ BitBltFromI420ToI420(w, h, m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], dpitch, fbuf->buf[0], fbuf->buf[1], fbuf->buf[2], spitch);
+ }
+ else if(m_fb.di == DIBlend)
+ {
+ DeinterlaceBlend(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch);
+ DeinterlaceBlend(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2);
+ DeinterlaceBlend(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2);
+ }
+ else if(m_fb.di == DIBob)
+ {
+ DeinterlaceBob(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, tff);
+ DeinterlaceBob(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, tff);
+ DeinterlaceBob(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, tff);
+
+ m_fb.rtStart = rtStart;
+ m_fb.rtStop = (rtStart + rtStop) / 2;
+ }
+ else if(m_fb.di == DIFieldShift)
+ {
+ int soffset = tff ? 0 : spitch;
+ int doffset = tff ? 0 : dpitch;
+ BitBltFromRGBToRGB(w, h/2, m_fb.buf[0] + doffset, dpitch*2, 8, fbuf->buf[0] + soffset, spitch*2, 8);
+ BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[1] + doffset/2, dpitch, 8, fbuf->buf[1] + soffset/2, spitch, 8);
+ BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[2] + doffset/2, dpitch, 8, fbuf->buf[2] + soffset/2, spitch, 8);
+ }
+
+ // postproc
+
+ ApplyBrContHueSat(m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], w, h, dpitch);
+
+ // deliver
+
+ if(FAILED(hr = Deliver(false)))
+ return hr;
+
+ if(m_fb.di == DIBob)
+ {
+ DeinterlaceBob(m_fb.buf[0], fbuf->buf[0], w, h, dpitch, spitch, !tff);
+ DeinterlaceBob(m_fb.buf[1], fbuf->buf[1], w/2, h/2, dpitch/2, spitch/2, !tff);
+ DeinterlaceBob(m_fb.buf[2], fbuf->buf[2], w/2, h/2, dpitch/2, spitch/2, !tff);
+
+ m_fb.rtStart = (rtStart + rtStop) / 2;
+ m_fb.rtStop = rtStop;
+
+ // postproc
+
+ ApplyBrContHueSat(m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], w, h, dpitch);
+
+ // deliver
+
+ if(FAILED(hr = Deliver(false)))
+ return hr;
+ }
+ else if(m_fb.di == DIFieldShift)
+ {
+ int soffset = !tff ? 0 : spitch;
+ int doffset = !tff ? 0 : dpitch;
+ BitBltFromRGBToRGB(w, h/2, m_fb.buf[0] + doffset, dpitch*2, 8, fbuf->buf[0] + soffset, spitch*2, 8);
+ BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[1] + doffset/2, dpitch, 8, fbuf->buf[1] + soffset/2, spitch, 8);
+ BitBltFromRGBToRGB(w/2, h/4, m_fb.buf[2] + doffset/2, dpitch, 8, fbuf->buf[2] + soffset/2, spitch, 8);
+ }
+
+ return S_OK;
+}
+
+
+HRESULT CMpeg2DecFilter::Deliver(bool fRepeatLast)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ if((m_fb.flags&PIC_MASK_CODING_TYPE) == PIC_FLAG_CODING_TYPE_I)
+ m_fWaitForKeyFrame = false;
+
+ if(m_fb.rtStart < 0 || m_fWaitForKeyFrame)
+ return S_OK;
+
+ HRESULT hr;
+
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = GetDeliveryBuffer(m_fb.w, m_fb.h, &pOut))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ if(m_fb.h == 1088)
+ {
+ memset(m_fb.buf[0] + m_fb.w*(m_fb.h-8), 0xff, m_fb.pitch*8);
+ memset(m_fb.buf[1] + m_fb.w*(m_fb.h-8)/4, 0x80, m_fb.pitch*8/4);
+ memset(m_fb.buf[2] + m_fb.w*(m_fb.h-8)/4, 0x80, m_fb.pitch*8/4);
+ }
+
+ BYTE** buf = &m_fb.buf[0];
+
+ if(m_pSubpicInput->HasAnythingToRender(m_fb.rtStart))
+ {
+ BitBltFromI420ToI420(m_fb.w, m_fb.h,
+ m_fb.buf[3], m_fb.buf[4], m_fb.buf[5], m_fb.pitch,
+ m_fb.buf[0], m_fb.buf[1], m_fb.buf[2], m_fb.pitch);
+
+ buf = &m_fb.buf[3];
+
+ m_pSubpicInput->RenderSubpics(m_fb.rtStart, buf, m_fb.pitch, m_fb.h);
+ }
+
+ CopyBuffer(pDataOut, buf, (m_fb.w+7)&~7, m_fb.h, m_fb.pitch, MEDIASUBTYPE_I420, !(m_fb.flags & PIC_FLAG_PROGRESSIVE_FRAME));
+
+ //
+
+ if(CMpeg2DecInputPin* pPin = dynamic_cast<CMpeg2DecInputPin*>(m_pInput))
+ {
+ CAutoLock cAutoLock(&pPin->m_csRateLock);
+
+ if(m_rate.Rate != pPin->m_ratechange.Rate)
+ {
+ m_rate.Rate = pPin->m_ratechange.Rate;
+ m_rate.StartTime = m_fb.rtStart;
+ }
+ }
+
+ REFERENCE_TIME rtStart = m_fb.rtStart;
+ REFERENCE_TIME rtStop = m_fb.rtStop;
+
+ rtStart = m_rate.StartTime + (rtStart - m_rate.StartTime) * m_rate.Rate / 10000;
+ rtStop = m_rate.StartTime + (rtStop - m_rate.StartTime) * m_rate.Rate / 10000;
+
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
+
+ //
+
+ SetTypeSpecificFlags(pOut);
+
+ //
+
+ hr = m_pOutput->Deliver(pOut);
+
+ return hr;
+}
+
+#include "..\..\..\..\include\IFilterVersion.h"
+
+HRESULT CMpeg2DecFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
+{
+ if(dir == PINDIR_OUTPUT)
+ {
+ if(GetCLSID(m_pInput->GetConnected()) == CLSID_DVDNavigator)
+ {
+ // one of these needed for dynamic format changes
+
+ CLSID clsid = GetCLSID(pPin);
+
+ DWORD ver = 0;
+ if(CComQIPtr<IFilterVersion> pFV = GetFilterFromPin(pPin))
+ ver = pFV->GetFilterVersion();
+
+ if(clsid != CLSID_OverlayMixer
+ /*&& clsid != CLSID_OverlayMixer2*/
+ && clsid != CLSID_VideoMixingRenderer
+ && clsid != CLSID_VideoMixingRenderer9
+ && clsid != GUIDFromCString(_T("{04FE9017-F873-410E-871E-AB91661A4EF7}")) // ffdshow
+ && (clsid != GUIDFromCString(_T("{93A22E7A-5091-45ef-BA61-6DA26156A5D0}")) || ver < 0x0234) // dvobsub
+ && (clsid != GUIDFromCString(_T("{9852A670-F845-491b-9BE6-EBD841B8A613}")) || ver < 0x0234) // dvobsub auto
+ && clsid != CLSID_DXR) // Haali's video renderer
+ return E_FAIL;
+ }
+ }
+
+ return __super::CheckConnect(dir, pPin);
+}
+
+HRESULT CMpeg2DecFilter::CheckInputType(const CMediaType* mtIn)
+{
+ if(mtIn->formattype == FORMAT_MPEG2_VIDEO && mtIn->pbFormat)
+ {
+ MPEG2VIDEOINFO* vih = (MPEG2VIDEOINFO*)mtIn->pbFormat;
+ if(vih->cbSequenceHeader > 0 && (vih->dwSequenceHeader[0] & 0x00ffffff) != 0x00010000)
+ return VFW_E_TYPE_NOT_ACCEPTED;
+ }
+
+ return (mtIn->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
+ || mtIn->majortype == MEDIATYPE_MPEG2_PACK && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
+ || mtIn->majortype == MEDIATYPE_MPEG2_PES && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
+ || mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_MPEG2_VIDEO
+ || mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_MPEG1Packet
+ || mtIn->majortype == MEDIATYPE_Video && mtIn->subtype == MEDIASUBTYPE_MPEG1Payload)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CMpeg2DecFilter::CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut)
+{
+ bool fPlanarYUV = mtOut->subtype == MEDIASUBTYPE_YV12
+ || mtOut->subtype == MEDIASUBTYPE_I420
+ || mtOut->subtype == MEDIASUBTYPE_IYUV;
+
+ return SUCCEEDED(__super::CheckTransform(mtIn, mtOut))
+ && (!fPlanarYUV || IsPlanarYUVEnabled())
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+DWORD g_clock;
+
+HRESULT CMpeg2DecFilter::StartStreaming()
+{
+ HRESULT hr = __super::StartStreaming();
+ if(FAILED(hr)) return hr;
+
+ m_dec.Attach(new CMpeg2Dec());
+ if(!m_dec) return E_OUTOFMEMORY;
+
+ InputTypeChanged();
+
+// g_clock = clock();
+
+ return S_OK;
+}
+
+HRESULT CMpeg2DecFilter::StopStreaming()
+{
+/*
+ CString str;
+ str.Format(_T("%d"), clock()-g_clock);
+ AfxMessageBox(str);
+*/
+ m_dec.Free();
+
+ return __super::StopStreaming();
+}
+
+HRESULT CMpeg2DecFilter::AlterQuality(Quality q)
+{
+ if(q.Late > 100*10000i64) m_fDropFrames = true;
+ else if(q.Late <= 0) m_fDropFrames = false;
+
+// TRACE(_T("CMpeg2DecFilter::AlterQuality: Type=%d, Proportion=%d, Late=%I64d, TimeStamp=%I64d\n"), q.Type, q.Proportion, q.Late, q.TimeStamp);
+ return S_OK;
+}
+
+// ISpecifyPropertyPages2
+
+STDMETHODIMP CMpeg2DecFilter::GetPages(CAUUID* pPages)
+{
+ CheckPointer(pPages, E_POINTER);
+
+ pPages->cElems = 1;
+ pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID) * pPages->cElems);
+ pPages->pElems[0] = __uuidof(CMpeg2DecSettingsWnd);
+
+ return S_OK;
+}
+
+STDMETHODIMP CMpeg2DecFilter::CreatePage(const GUID& guid, IPropertyPage** ppPage)
+{
+ CheckPointer(ppPage, E_POINTER);
+
+ if(*ppPage != NULL) return E_INVALIDARG;
+
+ HRESULT hr;
+
+ if(guid == __uuidof(CMpeg2DecSettingsWnd))
+ {
+ (*ppPage = new CInternalPropertyPageTempl<CMpeg2DecSettingsWnd>(NULL, &hr))->AddRef();
+ }
+
+ return *ppPage ? S_OK : E_FAIL;
+}
+
+// IMpeg2DecFilter
+
+STDMETHODIMP CMpeg2DecFilter::SetDeinterlaceMethod(ditype di)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ m_ditype = di;
+ return S_OK;
+}
+
+STDMETHODIMP_(ditype) CMpeg2DecFilter::GetDeinterlaceMethod()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_ditype;
+}
+
+void CMpeg2DecFilter::CalcBrCont(BYTE* YTbl, float bright, float cont)
+{
+ int Cont = (int)(cont * 512);
+ int Bright = (int)bright;
+
+ for(int i = 0; i < 256; i++)
+ {
+ int y = ((Cont * (i - 16)) >> 9) + Bright + 16;
+ YTbl[i] = min(max(y, 0), 255);
+// YTbl[i] = min(max(y, 16), 235);
+ }
+}
+
+void CMpeg2DecFilter::CalcHueSat(BYTE* UTbl, BYTE* VTbl, float hue, float sat)
+{
+ int Sat = (int)(sat * 512);
+ double Hue = (hue * 3.1415926) / 180.0;
+ int Sin = (int)(sin(Hue) * 4096);
+ int Cos = (int)(cos(Hue) * 4096);
+
+ for(int y = 0; y < 256; y++)
+ {
+ for(int x = 0; x < 256; x++)
+ {
+ int u = x - 128;
+ int v = y - 128;
+ int ux = (u * Cos + v * Sin) >> 12;
+ v = (v * Cos - u * Sin) >> 12;
+ u = ((ux * Sat) >> 9) + 128;
+ v = ((v * Sat) >> 9) + 128;
+ u = min(max(u, 16), 235);
+ v = min(max(v, 16), 235);
+ UTbl[(y << 8) | x] = u;
+ VTbl[(y << 8) | x] = v;
+ }
+ }
+}
+
+void CMpeg2DecFilter::ApplyBrContHueSat(BYTE* srcy, BYTE* srcu, BYTE* srcv, int w, int h, int pitch)
+{
+ CAutoLock cAutoLock(&m_csProps);
+
+ if(fabs(m_bright) > EPSILON || fabs(m_cont-1.0) > EPSILON)
+ {
+ int size = pitch*h;
+
+ if((g_cpuid.m_flags&CCpuID::sse2) && ((DWORD_PTR)srcy & 15) == 0)
+ {
+ short Cont = (short)(min(max(m_cont, 0) * 512, (1<<16)-1));
+ short Bright = (short)(m_bright + 16);
+
+ __m128i bc = _mm_set_epi16(Bright, Cont, Bright, Cont, Bright, Cont, Bright, Cont);
+
+ __m128i zero = _mm_setzero_si128();
+ __m128i _16 = _mm_set1_epi16(16);
+ __m128i _512 = _mm_set1_epi16(512);
+
+ for(int i = 0, j = size>>4; i < j; i++)
+ {
+ __m128i r = _mm_load_si128((__m128i*)&srcy[i*16]);
+
+ __m128i rl = _mm_unpacklo_epi8(r, zero);
+ __m128i rh = _mm_unpackhi_epi8(r, zero);
+
+ rl = _mm_subs_epi16(rl, _16);
+ rh = _mm_subs_epi16(rh, _16);
+
+ __m128i rll = _mm_unpacklo_epi16(rl, _512);
+ __m128i rlh = _mm_unpackhi_epi16(rl, _512);
+ __m128i rhl = _mm_unpacklo_epi16(rh, _512);
+ __m128i rhh = _mm_unpackhi_epi16(rh, _512);
+
+ rll = _mm_madd_epi16(rll, bc);
+ rlh = _mm_madd_epi16(rlh, bc);
+ rhl = _mm_madd_epi16(rhl, bc);
+ rhh = _mm_madd_epi16(rhh, bc);
+
+ rll = _mm_srai_epi32(rll, 9);
+ rlh = _mm_srai_epi32(rlh, 9);
+ rhl = _mm_srai_epi32(rhl, 9);
+ rhh = _mm_srai_epi32(rhh, 9);
+
+ rl = _mm_packs_epi32(rll, rlh);
+ rh = _mm_packs_epi32(rhl, rhh);
+
+ r = _mm_packus_epi16(rl, rh);
+
+ _mm_store_si128((__m128i*)&srcy[i*16], r);
+ }
+
+ srcy += size>>4;
+ size &= 15;
+ }
+
+ for(; size > 0; size--)
+ {
+ *srcy++ = m_YTbl[*srcy];
+ }
+ }
+
+ pitch /= 2;
+ w /= 2;
+ h /= 2;
+
+ if(fabs(m_hue) > EPSILON || fabs(m_sat-1.0) > EPSILON)
+ {
+ for(int size = pitch*h; size > 0; size--)
+ {
+ WORD uv = (*srcv<<8)|*srcu;
+ *srcu++ = m_UTbl[uv];
+ *srcv++ = m_VTbl[uv];
+ }
+ }
+}
+
+STDMETHODIMP CMpeg2DecFilter::SetBrightness(float bright)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ CalcBrCont(m_YTbl, m_bright = bright, m_cont);
+ return S_OK;
+}
+
+STDMETHODIMP CMpeg2DecFilter::SetContrast(float cont)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ CalcBrCont(m_YTbl, m_bright, m_cont = cont);
+ return S_OK;
+}
+
+STDMETHODIMP CMpeg2DecFilter::SetHue(float hue)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ CalcHueSat(m_UTbl, m_VTbl, m_hue = hue, m_sat);
+ return S_OK;
+}
+
+STDMETHODIMP CMpeg2DecFilter::SetSaturation(float sat)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ CalcHueSat(m_UTbl, m_VTbl, m_hue, m_sat = sat);
+ return S_OK;
+}
+
+STDMETHODIMP_(float) CMpeg2DecFilter::GetBrightness()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_bright;
+}
+
+STDMETHODIMP_(float) CMpeg2DecFilter::GetContrast()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_cont;
+}
+
+STDMETHODIMP_(float) CMpeg2DecFilter::GetHue()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_hue;
+}
+
+STDMETHODIMP_(float) CMpeg2DecFilter::GetSaturation()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_sat;
+}
+
+STDMETHODIMP CMpeg2DecFilter::EnableForcedSubtitles(bool fEnable)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ m_fForcedSubs = fEnable;
+ return S_OK;
+}
+
+STDMETHODIMP_(bool) CMpeg2DecFilter::IsForcedSubtitlesEnabled()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_fForcedSubs;
+}
+
+STDMETHODIMP CMpeg2DecFilter::EnablePlanarYUV(bool fEnable)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ m_fPlanarYUV = fEnable;
+ return S_OK;
+}
+
+STDMETHODIMP_(bool) CMpeg2DecFilter::IsPlanarYUVEnabled()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_fPlanarYUV;
+}
+
+STDMETHODIMP CMpeg2DecFilter::EnableInterlaced(bool fEnable)
+{
+ CAutoLock cAutoLock(&m_csProps);
+ m_fInterlaced = fEnable;
+ return S_OK;
+}
+
+STDMETHODIMP_(bool) CMpeg2DecFilter::IsInterlacedEnabled()
+{
+ CAutoLock cAutoLock(&m_csProps);
+ return m_fInterlaced;
+}
+
+//
+// CMpeg2DecInputPin
+//
+
+CMpeg2DecInputPin::CMpeg2DecInputPin(CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName)
+ : CDeCSSInputPin(NAME("CMpeg2DecInputPin"), pFilter, phr, pName)
+{
+ m_CorrectTS = 0;
+ m_ratechange.Rate = 10000;
+ m_ratechange.StartTime = _I64_MAX;
+}
+
+// IKsPropertySet
+
+STDMETHODIMP CMpeg2DecInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
+{
+ if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/)
+ return __super::Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
+
+ if(PropSet == AM_KSPROPSETID_TSRateChange)
+ switch(Id)
+ {
+ case AM_RATE_SimpleRateChange:
+ {
+ AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
+ if(!m_CorrectTS) return E_PROP_ID_UNSUPPORTED;
+ CAutoLock cAutoLock(&m_csRateLock);
+ m_ratechange = *p;
+ DbgLog((LOG_TRACE, 0, _T("StartTime=%I64d, Rate=%d"), p->StartTime, p->Rate));
+ }
+ break;
+ case AM_RATE_UseRateVersion:
+ {
+ WORD* p = (WORD*)pPropertyData;
+ if(*p > 0x0101) return E_PROP_ID_UNSUPPORTED;
+ }
+ break;
+ case AM_RATE_CorrectTS:
+ {
+ LONG* p = (LONG*)pPropertyData;
+ m_CorrectTS = *p;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+/*
+ if(PropSet == AM_KSPROPSETID_DVD_RateChange)
+ switch(Id)
+ {
+ case AM_RATE_ChangeRate:
+ {
+ AM_DVD_ChangeRate* p = (AM_DVD_ChangeRate*)pPropertyData;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+*/
+ return S_OK;
+}
+
+STDMETHODIMP CMpeg2DecInputPin::Get(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength, ULONG* pBytesReturned)
+{
+ if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/)
+ return __super::Get(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength, pBytesReturned);
+
+ if(PropSet == AM_KSPROPSETID_TSRateChange)
+ switch(Id)
+ {
+ case AM_RATE_SimpleRateChange:
+ {
+ AM_SimpleRateChange* p = (AM_SimpleRateChange*)pPropertyData;
+ return E_PROP_ID_UNSUPPORTED;
+ }
+ break;
+ case AM_RATE_MaxFullDataRate:
+ {
+ AM_MaxFullDataRate* p = (AM_MaxFullDataRate*)pPropertyData;
+ *p = 8*10000;
+ *pBytesReturned = sizeof(AM_MaxFullDataRate);
+ }
+ break;
+ case AM_RATE_QueryFullFrameRate:
+ {
+ AM_QueryRate* p = (AM_QueryRate*)pPropertyData;
+ p->lMaxForwardFullFrame = 8*10000;
+ p->lMaxReverseFullFrame = 8*10000;
+ *pBytesReturned = sizeof(AM_QueryRate);
+ }
+ break;
+ case AM_RATE_QueryLastRateSegPTS:
+ {
+ REFERENCE_TIME* p = (REFERENCE_TIME*)pPropertyData;
+ return E_PROP_ID_UNSUPPORTED;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+/*
+ if(PropSet == AM_KSPROPSETID_DVD_RateChange)
+ switch(Id)
+ {
+ case AM_RATE_FullDataRateMax:
+ {
+ AM_MaxFullDataRate* p = (AM_MaxFullDataRate*)pPropertyData;
+ }
+ break;
+ case AM_RATE_ReverseDecode:
+ {
+ LONG* p = (LONG*)pPropertyData;
+ }
+ break;
+ case AM_RATE_DecoderPosition:
+ {
+ AM_DVD_DecoderPosition* p = (AM_DVD_DecoderPosition*)pPropertyData;
+ }
+ break;
+ case AM_RATE_DecoderVersion:
+ {
+ LONG* p = (LONG*)pPropertyData;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+*/
+ return S_OK;
+}
+
+STDMETHODIMP CMpeg2DecInputPin::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
+{
+ if(PropSet != AM_KSPROPSETID_TSRateChange /*&& PropSet != AM_KSPROPSETID_DVD_RateChange*/)
+ return __super::QuerySupported(PropSet, Id, pTypeSupport);
+
+ if(PropSet == AM_KSPROPSETID_TSRateChange)
+ switch(Id)
+ {
+ case AM_RATE_SimpleRateChange:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_RATE_MaxFullDataRate:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_UseRateVersion:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_RATE_QueryFullFrameRate:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_QueryLastRateSegPTS:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_CorrectTS:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+/*
+ if(PropSet == AM_KSPROPSETID_DVD_RateChange)
+ switch(Id)
+ {
+ case AM_RATE_ChangeRate:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_RATE_FullDataRateMax:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_ReverseDecode:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_DecoderPosition:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ case AM_RATE_DecoderVersion:
+ *pTypeSupport = KSPROPERTY_SUPPORT_GET;
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+*/
+ return S_OK;
+}
+
+//
+// CMpeg2DecOutputPin
+//
+
+CMpeg2DecOutputPin::CMpeg2DecOutputPin(CBaseVideoFilter* pFilter, HRESULT* phr, LPWSTR pName)
+ : CBaseVideoOutputPin(NAME("CMpeg2DecOutputPin"), pFilter, phr, pName)
+{
+}
+
+HRESULT CMpeg2DecOutputPin::Active()
+{
+ CAutoLock cAutoLock(m_pLock);
+
+ // TODO
+
+ if(m_Connected && !m_pOutputQueue)
+ {
+ HRESULT hr = NOERROR;
+
+ m_pOutputQueue.Attach(new COutputQueue(m_Connected, &hr));
+ if(!m_pOutputQueue) hr = E_OUTOFMEMORY;
+
+ if(FAILED(hr))
+ {
+ m_pOutputQueue.Free();
+ return hr;
+ }
+ }
+
+ return __super::Active();
+}
+
+HRESULT CMpeg2DecOutputPin::Inactive()
+{
+ CAutoLock cAutoLock(m_pLock);
+ m_pOutputQueue.Free();
+ return __super::Inactive();
+}
+
+HRESULT CMpeg2DecOutputPin::Deliver(IMediaSample* pMediaSample)
+{
+ if(!m_pOutputQueue) return NOERROR;
+ pMediaSample->AddRef();
+ return m_pOutputQueue->Receive(pMediaSample);
+}
+
+#define CallQueue(call) \
+ if(!m_pOutputQueue) return NOERROR; \
+ m_pOutputQueue->##call; \
+ return NOERROR; \
+
+HRESULT CMpeg2DecOutputPin::DeliverEndOfStream()
+{
+ CallQueue(EOS());
+}
+
+HRESULT CMpeg2DecOutputPin::DeliverBeginFlush()
+{
+ CallQueue(BeginFlush());
+}
+
+HRESULT CMpeg2DecOutputPin::DeliverEndFlush()
+{
+ CallQueue(EndFlush());
+}
+
+HRESULT CMpeg2DecOutputPin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CallQueue(NewSegment(tStart, tStop, dRate));
+}
+
+
+//
+// CSubpicInputPin
+//
+
+#define PTS2RT(pts) (10000i64*pts/90)
+
+CSubpicInputPin::CSubpicInputPin(CTransformFilter* pFilter, HRESULT* phr)
+ : CMpeg2DecInputPin(pFilter, phr, L"SubPicture")
+ , m_spon(TRUE)
+ , m_fsppal(false)
+{
+ m_sppal[0].Y = 0x00;
+ m_sppal[0].U = m_sppal[0].V = 0x80;
+ m_sppal[1].Y = 0xe0;
+ m_sppal[1].U = m_sppal[1].V = 0x80;
+ m_sppal[2].Y = 0x80;
+ m_sppal[2].U = m_sppal[2].V = 0x80;
+ m_sppal[3].Y = 0x20;
+ m_sppal[3].U = m_sppal[3].V = 0x80;
+}
+
+HRESULT CSubpicInputPin::CheckMediaType(const CMediaType* mtIn)
+{
+ return (mtIn->majortype == MEDIATYPE_DVD_ENCRYPTED_PACK
+ || mtIn->majortype == MEDIATYPE_MPEG2_PACK
+ || mtIn->majortype == MEDIATYPE_MPEG2_PES
+ || mtIn->majortype == MEDIATYPE_Video)
+ && (mtIn->subtype == MEDIASUBTYPE_DVD_SUBPICTURE
+ || mtIn->subtype == MEDIASUBTYPE_CVD_SUBPICTURE
+ || mtIn->subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CSubpicInputPin::SetMediaType(const CMediaType* mtIn)
+{
+ return CBasePin::SetMediaType(mtIn);
+}
+
+bool CSubpicInputPin::HasAnythingToRender(REFERENCE_TIME rt)
+{
+ if(!IsConnected()) return(false);
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ POSITION pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ spu* sp = m_sps.GetNext(pos);
+ if(sp->m_rtStart <= rt && rt < sp->m_rtStop && (/*sp->m_psphli ||*/ sp->m_fForced || m_spon))
+ return(true);
+ }
+
+ return(false);
+}
+
+void CSubpicInputPin::RenderSubpics(REFERENCE_TIME rt, BYTE** yuv, int w, int h)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ POSITION pos;
+
+ // remove no longer needed things first
+ pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ spu* sp = m_sps.GetNext(pos);
+ if(sp->m_rtStop <= rt) m_sps.RemoveAt(cur);
+ }
+
+ pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ spu* sp = m_sps.GetNext(pos);
+ if(sp->m_rtStart <= rt && rt < sp->m_rtStop
+ && (m_spon || sp->m_fForced && (((CMpeg2DecFilter*)m_pFilter)->IsForcedSubtitlesEnabled() || sp->m_psphli)))
+ sp->Render(rt, yuv, w, h, m_sppal, m_fsppal);
+ }
+}
+
+HRESULT CSubpicInputPin::Transform(IMediaSample* pSample)
+{
+ HRESULT hr;
+
+ AM_MEDIA_TYPE* pmt;
+ if(SUCCEEDED(pSample->GetMediaType(&pmt)) && pmt)
+ {
+ CMediaType mt(*pmt);
+ SetMediaType(&mt);
+ DeleteMediaType(pmt);
+ }
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(hr = pSample->GetPointer(&pDataIn))) return hr;
+
+ long len = pSample->GetActualDataLength();
+
+ StripPacket(pDataIn, len);
+
+ if(len <= 0) return S_FALSE;
+
+ if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE)
+ {
+ pDataIn += 4;
+ len -= 4;
+ }
+
+ if(len <= 0) return S_FALSE;
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ REFERENCE_TIME rtStart = 0, rtStop = 0;
+ hr = pSample->GetTime(&rtStart, &rtStop);
+
+ bool fRefresh = false;
+
+ if(FAILED(hr))
+ {
+ if(!m_sps.IsEmpty())
+ {
+ spu* sp = m_sps.GetTail();
+ sp->SetCount(sp->GetCount() + len);
+ memcpy(sp->GetData() + sp->GetCount() - len, pDataIn, len);
+ }
+ }
+ else
+ {
+ POSITION pos = m_sps.GetTailPosition();
+ while(pos)
+ {
+ POSITION cur = pos;
+ spu* sp = m_sps.GetPrev(pos);
+ if(sp->m_rtStop == _I64_MAX)
+ {
+ sp->m_rtStop = rtStart;
+ break;
+ }
+ }
+
+ CAutoPtr<spu> p;
+
+ if(m_mt.subtype == MEDIASUBTYPE_DVD_SUBPICTURE) p.Attach(new dvdspu());
+ else if(m_mt.subtype == MEDIASUBTYPE_CVD_SUBPICTURE) p.Attach(new cvdspu());
+ else if(m_mt.subtype == MEDIASUBTYPE_SVCD_SUBPICTURE) p.Attach(new svcdspu());
+ else return E_FAIL;
+
+ p->m_rtStart = rtStart;
+ p->m_rtStop = _I64_MAX;
+
+ p->SetCount(len);
+ memcpy(p->GetData(), pDataIn, len);
+
+ if(m_sphli && p->m_rtStart == PTS2RT(m_sphli->StartPTM))
+ {
+ p->m_psphli = m_sphli;
+ fRefresh = true;
+ }
+
+ m_sps.AddTail(p);
+ }
+
+ if(!m_sps.IsEmpty())
+ {
+ m_sps.GetTail()->Parse();
+ }
+
+ if(fRefresh)
+ {
+// ((CMpeg2DecFilter*)m_pFilter)->Deliver(true);
+ }
+
+ return S_FALSE;
+}
+
+STDMETHODIMP CSubpicInputPin::EndFlush()
+{
+ CAutoLock cAutoLock(&m_csReceive);
+ m_sps.RemoveAll();
+ return S_OK;
+}
+
+// IKsPropertySet
+
+STDMETHODIMP CSubpicInputPin::Set(REFGUID PropSet, ULONG Id, LPVOID pInstanceData, ULONG InstanceLength, LPVOID pPropertyData, ULONG DataLength)
+{
+ if(PropSet != AM_KSPROPSETID_DvdSubPic)
+ return __super::Set(PropSet, Id, pInstanceData, InstanceLength, pPropertyData, DataLength);
+
+ bool fRefresh = false;
+
+ switch(Id)
+ {
+ case AM_PROPERTY_DVDSUBPIC_PALETTE:
+ {
+ CAutoLock cAutoLock(&m_csReceive);
+
+ AM_PROPERTY_SPPAL* pSPPAL = (AM_PROPERTY_SPPAL*)pPropertyData;
+ memcpy(m_sppal, pSPPAL->sppal, sizeof(AM_PROPERTY_SPPAL));
+ m_fsppal = true;
+
+ DbgLog((LOG_TRACE, 0, _T("new palette")));
+ }
+ break;
+ case AM_PROPERTY_DVDSUBPIC_HLI:
+ {
+ CAutoLock cAutoLock(&m_csReceive);
+
+ AM_PROPERTY_SPHLI* pSPHLI = (AM_PROPERTY_SPHLI*)pPropertyData;
+
+ m_sphli.Free();
+
+ if(pSPHLI->HLISS)
+ {
+ POSITION pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ spu* sp = m_sps.GetNext(pos);
+ if(sp->m_rtStart <= PTS2RT(pSPHLI->StartPTM) && PTS2RT(pSPHLI->StartPTM) < sp->m_rtStop)
+ {
+ fRefresh = true;
+ sp->m_psphli.Free();
+ sp->m_psphli.Attach(new AM_PROPERTY_SPHLI());
+ memcpy((AM_PROPERTY_SPHLI*)sp->m_psphli, pSPHLI, sizeof(AM_PROPERTY_SPHLI));
+ }
+ }
+
+ if(!fRefresh) // save it for later, a subpic might be late for this hli
+ {
+ m_sphli.Attach(new AM_PROPERTY_SPHLI());
+ memcpy((AM_PROPERTY_SPHLI*)m_sphli, pSPHLI, sizeof(AM_PROPERTY_SPHLI));
+ }
+ }
+ else
+ {
+ POSITION pos = m_sps.GetHeadPosition();
+ while(pos)
+ {
+ spu* sp = m_sps.GetNext(pos);
+ fRefresh |= !!sp->m_psphli;
+ sp->m_psphli.Free();
+ }
+ }
+
+ if(pSPHLI->HLISS)
+ DbgLog((LOG_TRACE, 0, _T("hli: %I64d - %I64d, (%d,%d) - (%d,%d)"),
+ PTS2RT(pSPHLI->StartPTM)/10000, PTS2RT(pSPHLI->EndPTM)/10000,
+ pSPHLI->StartX, pSPHLI->StartY, pSPHLI->StopX, pSPHLI->StopY));
+ }
+ break;
+ case AM_PROPERTY_DVDSUBPIC_COMPOSIT_ON:
+ {
+ CAutoLock cAutoLock(&m_csReceive);
+
+ AM_PROPERTY_COMPOSIT_ON* pCompositOn = (AM_PROPERTY_COMPOSIT_ON*)pPropertyData;
+ m_spon = *pCompositOn;
+ }
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+
+ if(fRefresh)
+ {
+ ((CMpeg2DecFilter*)m_pFilter)->Deliver(true);
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CSubpicInputPin::QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport)
+{
+ if(PropSet != AM_KSPROPSETID_DvdSubPic)
+ return __super::QuerySupported(PropSet, Id, pTypeSupport);
+
+ switch(Id)
+ {
+ case AM_PROPERTY_DVDSUBPIC_PALETTE:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDSUBPIC_HLI:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ case AM_PROPERTY_DVDSUBPIC_COMPOSIT_ON:
+ *pTypeSupport = KSPROPERTY_SUPPORT_SET;
+ break;
+ default:
+ return E_PROP_ID_UNSUPPORTED;
+ }
+
+ return S_OK;
+}
+
+// CSubpicInputPin::spu
+
+static __inline BYTE GetNibble(BYTE* p, DWORD* offset, int& nField, int& fAligned)
+{
+ BYTE ret = (p[offset[nField]] >> (fAligned << 2)) & 0x0f;
+ offset[nField] += 1-fAligned;
+ fAligned = !fAligned;
+ return ret;
+}
+
+static __inline BYTE GetHalfNibble(BYTE* p, DWORD* offset, int& nField, int& n)
+{
+ BYTE ret = (p[offset[nField]] >> (n << 1)) & 0x03;
+ if(!n) offset[nField]++;
+ n = (n-1+4)&3;
+ return ret;
+}
+
+static __inline void DrawPixel(BYTE** yuv, CPoint pt, int pitch, AM_DVD_YUV& c)
+{
+ if(c.Reserved == 0) return;
+
+ BYTE* p = &yuv[0][pt.y*pitch + pt.x];
+// *p = (*p*(15-contrast) + sppal[color].Y*contrast)>>4;
+ *p -= (*p - c.Y) * c.Reserved >> 4;
+
+ if(pt.y&1) return; // since U/V is half res there is no need to overwrite the same line again
+
+ pt.x = (pt.x + 1) / 2;
+ pt.y = (pt.y /*+ 1*/) / 2; // only paint the upper field always, don't round it
+ pitch /= 2;
+
+ // U/V is exchanged? wierd but looks true when comparing the outputted colors from other decoders
+
+ p = &yuv[1][pt.y*pitch + pt.x];
+// *p = (BYTE)(((((int)*p-0x80)*(15-contrast) + ((int)sppal[color].V-0x80)*contrast) >> 4) + 0x80);
+ *p -= (*p - c.V) * c.Reserved >> 4;
+
+ p = &yuv[2][pt.y*pitch + pt.x];
+// *p = (BYTE)(((((int)*p-0x80)*(15-contrast) + ((int)sppal[color].U-0x80)*contrast) >> 4) + 0x80);
+ *p -= (*p - c.U) * c.Reserved >> 4;
+
+ // Neighter of the blending formulas are accurate (">>4" should be "/15").
+ // Even though the second one is a bit worse, since we are scaling the difference only,
+ // the error is still not noticable.
+}
+
+static __inline void DrawPixels(BYTE** yuv, int pitch, CPoint pt, int len, AM_DVD_YUV& c, CRect& rc)
+{
+ if(pt.y < rc.top || pt.y >= rc.bottom) return;
+ if(pt.x < rc.left) {len -= rc.left - pt.x; pt.x = rc.left;}
+ if(pt.x + len > rc.right) len = rc.right - pt.x;
+ if(len <= 0 || pt.x >= rc.right) return;
+
+ if(c.Reserved == 0)
+ {
+ if(rc.IsRectEmpty())
+ return;
+
+ if(pt.y < rc.top || pt.y >= rc.bottom
+ || pt.x+len < rc.left || pt.x >= rc.right)
+ return;
+ }
+
+ while(len-- > 0)
+ {
+ DrawPixel(yuv, pt, pitch, c);
+ pt.x++;
+ }
+}
+
+// CSubpicInputPin::dvdspu
+
+bool CSubpicInputPin::dvdspu::Parse()
+{
+ m_offsets.RemoveAll();
+
+ BYTE* p = GetData();
+
+ WORD packetsize = (p[0]<<8)|p[1];
+ WORD datasize = (p[2]<<8)|p[3];
+
+ if(packetsize > GetCount() || datasize > packetsize)
+ return(false);
+
+ int i, next = datasize;
+
+ #define GetWORD (p[i]<<8)|p[i+1]; i += 2
+
+ do
+ {
+ i = next;
+
+ int pts = GetWORD;
+ next = GetWORD;
+
+ if(next > packetsize || next < datasize)
+ return(false);
+
+ REFERENCE_TIME rt = m_rtStart + 1024*PTS2RT(pts);
+
+ for(bool fBreak = false; !fBreak; )
+ {
+ int len = 0;
+
+ switch(p[i])
+ {
+ case 0x00: len = 0; break;
+ case 0x01: len = 0; break;
+ case 0x02: len = 0; break;
+ case 0x03: len = 2; break;
+ case 0x04: len = 2; break;
+ case 0x05: len = 6; break;
+ case 0x06: len = 4; break;
+ default: len = 0; break;
+ }
+
+ if(i+len >= packetsize)
+ {
+ TRACE(_T("Warning: Wrong subpicture parameter block ending\n"));
+ break;
+ }
+
+ switch(p[i++])
+ {
+ case 0x00: // forced start displaying
+ m_fForced = true;
+ break;
+ case 0x01: // normal start displaying
+ m_fForced = false;
+ break;
+ case 0x02: // stop displaying
+ m_rtStop = rt;
+ break;
+ case 0x03:
+ m_sphli.ColCon.emph2col = p[i]>>4;
+ m_sphli.ColCon.emph1col = p[i]&0xf;
+ m_sphli.ColCon.patcol = p[i+1]>>4;
+ m_sphli.ColCon.backcol = p[i+1]&0xf;
+ i += 2;
+ break;
+ case 0x04:
+ m_sphli.ColCon.emph2con = p[i]>>4;
+ m_sphli.ColCon.emph1con = p[i]&0xf;
+ m_sphli.ColCon.patcon = p[i+1]>>4;
+ m_sphli.ColCon.backcon = p[i+1]&0xf;
+ i += 2;
+ break;
+ case 0x05:
+ m_sphli.StartX = (p[i]<<4) + (p[i+1]>>4);
+ m_sphli.StopX = ((p[i+1]&0x0f)<<8) + p[i+2]+1;
+ m_sphli.StartY = (p[i+3]<<4) + (p[i+4]>>4);
+ m_sphli.StopY = ((p[i+4]&0x0f)<<8) + p[i+5]+1;
+ i += 6;
+ break;
+ case 0x06:
+ m_offset[0] = GetWORD;
+ m_offset[1] = GetWORD;
+ break;
+ case 0xff: // end of ctrlblk
+ fBreak = true;
+ continue;
+ default: // skip this ctrlblk
+ fBreak = true;
+ break;
+ }
+ }
+
+ offset_t o = {rt, m_sphli};
+ m_offsets.AddTail(o); // is it always going to be sorted?
+ }
+ while(i <= next && i < packetsize);
+
+ return(true);
+}
+
+void CSubpicInputPin::dvdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h, AM_DVD_YUV* sppal, bool fsppal)
+{
+ BYTE* p = GetData();
+ DWORD offset[2] = {m_offset[0], m_offset[1]};
+
+ AM_PROPERTY_SPHLI sphli = m_sphli;
+ CPoint pt(sphli.StartX, sphli.StartY);
+ CRect rc(pt, CPoint(sphli.StopX, sphli.StopY));
+
+ CRect rcclip(0, 0, w, h);
+ rcclip &= rc;
+
+ if(m_psphli)
+ {
+ rcclip &= CRect(m_psphli->StartX, m_psphli->StartY, m_psphli->StopX, m_psphli->StopY);
+ sphli = *m_psphli;
+ }
+ else if(m_offsets.GetCount() > 1)
+ {
+ POSITION pos = m_offsets.GetTailPosition();
+ while(pos)
+ {
+ const offset_t& o = m_offsets.GetPrev(pos);
+ if(rt >= o.rt) {sphli = o.sphli; break;}
+ }
+ }
+
+ AM_DVD_YUV pal[4];
+ pal[0] = sppal[fsppal ? sphli.ColCon.backcol : 0];
+ pal[0].Reserved = sphli.ColCon.backcon;
+ pal[1] = sppal[fsppal ? sphli.ColCon.patcol : 1];
+ pal[1].Reserved = sphli.ColCon.patcon;
+ pal[2] = sppal[fsppal ? sphli.ColCon.emph1col : 2];
+ pal[2].Reserved = sphli.ColCon.emph1con;
+ pal[3] = sppal[fsppal ? sphli.ColCon.emph2col : 3];
+ pal[3].Reserved = sphli.ColCon.emph2con;
+
+ int nField = 0;
+ int fAligned = 1;
+
+ DWORD end[2] = {offset[1], (p[2]<<8)|p[3]};
+
+ while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1]))
+ {
+ DWORD code;
+
+ if((code = GetNibble(p, offset, nField, fAligned)) >= 0x4
+ || (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x10
+ || (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x40
+ || (code = (code << 4) | GetNibble(p, offset, nField, fAligned)) >= 0x100)
+ {
+ DrawPixels(yuv, w, pt, code >> 2, pal[code&3], rcclip);
+ if((pt.x += code >> 2) < rc.right) continue;
+ }
+
+ DrawPixels(yuv, w, pt, rc.right - pt.x, pal[code&3], rcclip);
+
+ if(!fAligned) GetNibble(p, offset, nField, fAligned); // align to byte
+
+ pt.x = rc.left;
+ pt.y++;
+ nField = 1 - nField;
+ }
+}
+
+// CSubpicInputPin::cvdspu
+
+bool CSubpicInputPin::cvdspu::Parse()
+{
+ BYTE* p = GetData();
+
+ WORD packetsize = (p[0]<<8)|p[1];
+ WORD datasize = (p[2]<<8)|p[3];
+
+ if(packetsize > GetCount() || datasize > packetsize)
+ return(false);
+
+ p = GetData() + datasize;
+
+ for(int i = datasize, j = packetsize-4; i <= j; i+=4, p+=4)
+ {
+ switch(p[0])
+ {
+ case 0x0c:
+ break;
+ case 0x04:
+ m_rtStop = m_rtStart + 10000i64*((p[1]<<16)|(p[2]<<8)|p[3])/90;
+ break;
+ case 0x17:
+ m_sphli.StartX = ((p[1]&0x0f)<<6) + (p[2]>>2);
+ m_sphli.StartY = ((p[2]&0x03)<<8) + p[3];
+ break;
+ case 0x1f:
+ m_sphli.StopX = ((p[1]&0x0f)<<6) + (p[2]>>2);
+ m_sphli.StopY = ((p[2]&0x03)<<8) + p[3];
+ break;
+ case 0x24: case 0x25: case 0x26: case 0x27:
+ m_sppal[0][p[0]-0x24].Y = p[1];
+ m_sppal[0][p[0]-0x24].U = p[2];
+ m_sppal[0][p[0]-0x24].V = p[3];
+ break;
+ case 0x2c: case 0x2d: case 0x2e: case 0x2f:
+ m_sppal[1][p[0]-0x2c].Y = p[1];
+ m_sppal[1][p[0]-0x2c].U = p[2];
+ m_sppal[1][p[0]-0x2c].V = p[3];
+ break;
+ case 0x37:
+ m_sppal[0][3].Reserved = p[2]>>4;
+ m_sppal[0][2].Reserved = p[2]&0xf;
+ m_sppal[0][1].Reserved = p[3]>>4;
+ m_sppal[0][0].Reserved = p[3]&0xf;
+ break;
+ case 0x3f:
+ m_sppal[1][3].Reserved = p[2]>>4;
+ m_sppal[1][2].Reserved = p[2]&0xf;
+ m_sppal[1][1].Reserved = p[3]>>4;
+ m_sppal[1][0].Reserved = p[3]&0xf;
+ break;
+ case 0x47:
+ m_offset[0] = (p[2]<<8)|p[3];
+ break;
+ case 0x4f:
+ m_offset[1] = (p[2]<<8)|p[3];
+ break;
+ default:
+ break;
+ }
+ }
+
+ return(true);
+}
+
+void CSubpicInputPin::cvdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h, AM_DVD_YUV* sppal, bool fsppal)
+{
+ BYTE* p = GetData();
+ DWORD offset[2] = {m_offset[0], m_offset[1]};
+
+ CRect rcclip(0, 0, w, h);
+
+ /* FIXME: startx/y looks to be wrong in the sample I tested
+ CPoint pt(m_sphli.StartX, m_sphli.StartY);
+ CRect rc(pt, CPoint(m_sphli.StopX, m_sphli.StopY));
+ */
+
+ CSize size(m_sphli.StopX - m_sphli.StartX, m_sphli.StopY - m_sphli.StartY);
+ CPoint pt((rcclip.Width() - size.cx) / 2, (rcclip.Height()*3 - size.cy*1) / 4);
+ CRect rc(pt, size);
+
+ int nField = 0;
+ int fAligned = 1;
+
+ DWORD end[2] = {offset[1], (p[2]<<8)|p[3]};
+
+ while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1]))
+ {
+ BYTE code;
+
+ if((code = GetNibble(p, offset, nField, fAligned)) >= 0x4)
+ {
+ DrawPixels(yuv, w, pt, code >> 2, m_sppal[0][code&3], rcclip);
+ pt.x += code >> 2;
+ continue;
+ }
+
+ code = GetNibble(p, offset, nField, fAligned);
+ DrawPixels(yuv, w, pt, rc.right - pt.x, m_sppal[0][code&3], rcclip);
+
+ if(!fAligned) GetNibble(p, offset, nField, fAligned); // align to byte
+
+ pt.x = rc.left;
+ pt.y++;
+ nField = 1 - nField;
+ }
+}
+
+// CSubpicInputPin::svcdspu
+
+bool CSubpicInputPin::svcdspu::Parse()
+{
+ BYTE* p = GetData();
+ BYTE* p0 = p;
+
+ if(GetCount() < 2)
+ return(false);
+
+ WORD packetsize = (p[0]<<8)|p[1]; p += 2;
+
+ if(packetsize > GetCount())
+ return(false);
+
+ bool duration = !!(*p++&0x04);
+
+ *p++; // unknown
+
+ if(duration)
+ {
+ m_rtStop = m_rtStart + 10000i64*((p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3])/90;
+ p += 4;
+ }
+
+ m_sphli.StartX = m_sphli.StopX = (p[0]<<8)|p[1]; p += 2;
+ m_sphli.StartY = m_sphli.StopY = (p[0]<<8)|p[1]; p += 2;
+ m_sphli.StopX += (p[0]<<8)|p[1]; p += 2;
+ m_sphli.StopY += (p[0]<<8)|p[1]; p += 2;
+
+ for(int i = 0; i < 4; i++)
+ {
+ m_sppal[i].Y = *p++;
+ m_sppal[i].U = *p++;
+ m_sppal[i].V = *p++;
+ m_sppal[i].Reserved = *p++ >> 4;
+ }
+
+ if(*p++&0xc0)
+ p += 4; // duration of the shift operation should be here, but it is untested
+
+ m_offset[1] = (p[0]<<8)|p[1]; p += 2;
+
+ m_offset[0] = p - p0;
+ m_offset[1] += m_offset[0];
+
+ return(true);
+}
+
+void CSubpicInputPin::svcdspu::Render(REFERENCE_TIME rt, BYTE** yuv, int w, int h, AM_DVD_YUV* sppal, bool fsppal)
+{
+ BYTE* p = GetData();
+ DWORD offset[2] = {m_offset[0], m_offset[1]};
+
+ CRect rcclip(0, 0, w, h);
+
+ /* FIXME: startx/y looks to be wrong in the sample I tested (yes, this one too!)
+ CPoint pt(m_sphli.StartX, m_sphli.StartY);
+ CRect rc(pt, CPoint(m_sphli.StopX, m_sphli.StopY));
+ */
+
+ CSize size(m_sphli.StopX - m_sphli.StartX, m_sphli.StopY - m_sphli.StartY);
+ CPoint pt((rcclip.Width() - size.cx) / 2, (rcclip.Height()*3 - size.cy*1) / 4);
+ CRect rc(pt, size);
+
+ int nField = 0;
+ int n = 3;
+
+ DWORD end[2] = {offset[1], (p[2]<<8)|p[3]};
+
+ while((nField == 0 && offset[0] < end[0]) || (nField == 1 && offset[1] < end[1]))
+ {
+ BYTE code = GetHalfNibble(p, offset, nField, n);
+ BYTE repeat = 1 + (code == 0 ? GetHalfNibble(p, offset, nField, n) : 0);
+
+ DrawPixels(yuv, w, pt, repeat, m_sppal[code&3], rcclip);
+ if((pt.x += repeat) < rc.right) continue;
+
+ while(n != 3)
+ GetHalfNibble(p, offset, nField, n); // align to byte
+
+ pt.x = rc.left;
+ pt.y++;
+ nField = 1 - nField;
+ }
+}
+
+//
+// CClosedCaptionOutputPin
+//
+
+CClosedCaptionOutputPin::CClosedCaptionOutputPin(CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr)
+ : CBaseOutputPin(NAME("CClosedCaptionOutputPin"), pFilter, pLock, phr, L"~CC")
+{
+}
+
+HRESULT CClosedCaptionOutputPin::CheckMediaType(const CMediaType* mtOut)
+{
+ return mtOut->majortype == MEDIATYPE_AUXLine21Data && mtOut->subtype == MEDIASUBTYPE_Line21_GOPPacket
+ ? S_OK
+ : VFW_E_TYPE_NOT_ACCEPTED;
+}
+
+HRESULT CClosedCaptionOutputPin::GetMediaType(int iPosition, CMediaType* pmt)
+{
+ if(iPosition < 0) return E_INVALIDARG;
+ if(iPosition > 0) return VFW_S_NO_MORE_ITEMS;
+
+ pmt->InitMediaType();
+ pmt->majortype = MEDIATYPE_AUXLine21Data;
+ pmt->subtype = MEDIASUBTYPE_Line21_GOPPacket;
+ pmt->formattype = FORMAT_None;
+
+ return S_OK;
+}
+
+HRESULT CClosedCaptionOutputPin::DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties)
+{
+ pProperties->cBuffers = 1;
+ pProperties->cbBuffer = 2048;
+ pProperties->cbAlign = 1;
+ pProperties->cbPrefix = 0;
+
+ HRESULT hr;
+ ALLOCATOR_PROPERTIES Actual;
+ if(FAILED(hr = pAllocator->SetProperties(pProperties, &Actual)))
+ return hr;
+
+ return pProperties->cBuffers > Actual.cBuffers || pProperties->cbBuffer > Actual.cbBuffer
+ ? E_FAIL
+ : NOERROR;
+}
+
+HRESULT CClosedCaptionOutputPin::Deliver(const void* ptr, int len)
+{
+ HRESULT hr = S_FALSE;
+
+ if(len > 4 && ptr && *(DWORD*)ptr == 0xf8014343 && IsConnected())
+ {
+ CComPtr<IMediaSample> pSample;
+ GetDeliveryBuffer(&pSample, NULL, NULL, 0);
+ BYTE* pData = NULL;
+ pSample->GetPointer(&pData);
+ *(DWORD*)pData = 0xb2010000;
+ memcpy(pData + 4, ptr, len);
+ pSample->SetActualDataLength(len + 4);
+ hr = __super::Deliver(pSample);
+ }
+
+ return hr;
+} \ No newline at end of file
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.def b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.def
new file mode 100644
index 000000000..074ec06fc
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.def
@@ -0,0 +1,7 @@
+LIBRARY "Mpeg2DecFilter.ax"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.h b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.h
new file mode 100644
index 000000000..076d525e4
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.h
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+#include <Videoacc.h>
+#include "..\..\..\decss\DeCSSInputPin.h"
+#include "..\BaseVideoFilter\BaseVideoFilter.h"
+#include "IMpeg2DecFilter.h"
+#include "Mpeg2DecSettingsWnd.h"
+
+class CSubpicInputPin;
+class CClosedCaptionOutputPin;
+class CMpeg2Dec;
+
+[uuid("39F498AF-1A09-4275-B193-673B0BA3D478")]
+class CMpeg2DecFilter
+ : public CBaseVideoFilter
+ , public IMpeg2DecFilter
+ , public ISpecifyPropertyPages2
+{
+ CSubpicInputPin* m_pSubpicInput;
+ CClosedCaptionOutputPin* m_pClosedCaptionOutput;
+
+ CAutoPtr<CMpeg2Dec> m_dec;
+
+ REFERENCE_TIME m_AvgTimePerFrame;
+ bool m_fWaitForKeyFrame;
+
+ struct framebuf
+ {
+ int w, h, pitch;
+ BYTE* buf_base;
+ BYTE* buf[6];
+ REFERENCE_TIME rtStart, rtStop;
+ DWORD flags;
+ ditype di;
+ framebuf()
+ {
+ w = h = pitch = 0;
+ buf_base = NULL;
+ memset(&buf, 0, sizeof(buf));
+ rtStart = rtStop = 0;
+ flags = 0;
+ }
+ ~framebuf() {free();}
+ void alloc(int w, int h, int pitch)
+ {
+ this->w = w; this->h = h; this->pitch = pitch;
+ int size = pitch*h;
+ buf_base = (BYTE*)_aligned_malloc(size*3+6*32, 32);
+ BYTE* p = buf_base;
+ buf[0] = p; p += (size + 31) & ~31;
+ buf[3] = p; p += (size + 31) & ~31;
+ buf[1] = p; p += (size/4 + 31) & ~31;
+ buf[4] = p; p += (size/4 + 31) & ~31;
+ buf[2] = p; p += (size/4 + 31) & ~31;
+ buf[5] = p; p += (size/4 + 31) & ~31;
+ }
+ void free()
+ {
+ if(buf_base) _aligned_free(buf_base);
+ buf_base = NULL;
+ }
+ } m_fb;
+
+ bool m_fFilm;
+ void SetDeinterlaceMethod();
+ void SetTypeSpecificFlags(IMediaSample* pMS);
+
+ AM_SimpleRateChange m_rate;
+
+protected:
+ void InputTypeChanged();
+ HRESULT Transform(IMediaSample* pIn);
+ HRESULT IsVideoInterlaced();
+
+public:
+ CMpeg2DecFilter(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CMpeg2DecFilter();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ HRESULT DeliverFast();
+ HRESULT DeliverNormal();
+ HRESULT Deliver(bool fRepeatLast);
+
+ int GetPinCount();
+ CBasePin* GetPin(int n);
+
+ HRESULT EndOfStream();
+ HRESULT BeginFlush();
+ HRESULT EndFlush();
+ HRESULT NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+ HRESULT CheckConnect(PIN_DIRECTION dir, IPin* pPin);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+ HRESULT CheckTransform(const CMediaType* mtIn, const CMediaType* mtOut);
+
+ HRESULT StartStreaming();
+ HRESULT StopStreaming();
+
+ bool m_fDropFrames;
+ HRESULT AlterQuality(Quality q);
+
+protected:
+ CCritSec m_csProps;
+ ditype m_ditype;
+ float m_bright, m_cont, m_hue, m_sat;
+ BYTE m_YTbl[256], m_UTbl[256*256], m_VTbl[256*256];
+ bool m_fForcedSubs;
+ bool m_fPlanarYUV;
+ bool m_fInterlaced;
+
+ static void CalcBrCont(BYTE* YTbl, float bright, float cont);
+ static void CalcHueSat(BYTE* UTbl, BYTE* VTbl, float hue, float sat);
+ void ApplyBrContHueSat(BYTE* srcy, BYTE* srcu, BYTE* srcv, int w, int h, int pitch);
+
+public:
+
+ // ISpecifyPropertyPages2
+
+ STDMETHODIMP GetPages(CAUUID* pPages);
+ STDMETHODIMP CreatePage(const GUID& guid, IPropertyPage** ppPage);
+
+ // IMpeg2DecFilter
+
+ STDMETHODIMP SetDeinterlaceMethod(ditype di);
+ STDMETHODIMP_(ditype) GetDeinterlaceMethod();
+
+ STDMETHODIMP SetBrightness(float bright);
+ STDMETHODIMP SetContrast(float cont);
+ STDMETHODIMP SetHue(float hue);
+ STDMETHODIMP SetSaturation(float sat);
+ STDMETHODIMP_(float) GetBrightness();
+ STDMETHODIMP_(float) GetContrast();
+ STDMETHODIMP_(float) GetHue();
+ STDMETHODIMP_(float) GetSaturation();
+
+ STDMETHODIMP EnableForcedSubtitles(bool fEnable);
+ STDMETHODIMP_(bool) IsForcedSubtitlesEnabled();
+
+ STDMETHODIMP EnablePlanarYUV(bool fEnable);
+ STDMETHODIMP_(bool) IsPlanarYUVEnabled();
+
+ // IMpeg2DecFilter2
+
+ STDMETHODIMP EnableInterlaced(bool fEnable);
+ STDMETHODIMP_(bool) IsInterlacedEnabled();
+};
+
+class CMpeg2DecInputPin : public CDeCSSInputPin
+{
+ LONG m_CorrectTS;
+
+public:
+ CMpeg2DecInputPin(CTransformFilter* pFilter, HRESULT* phr, LPWSTR pName);
+
+ CCritSec m_csRateLock;
+ AM_SimpleRateChange m_ratechange;
+
+ // IKsPropertySet
+ STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength);
+ STDMETHODIMP Get(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength, ULONG* pBytesReturned);
+ STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport);
+};
+
+class CMpeg2DecOutputPin : public CBaseVideoOutputPin
+{
+public:
+ CMpeg2DecOutputPin(CBaseVideoFilter* pFilter, HRESULT* phr, LPWSTR pName);
+
+ CAutoPtr<COutputQueue> m_pOutputQueue;
+
+ HRESULT Active();
+ HRESULT Inactive();
+
+ HRESULT Deliver(IMediaSample* pMediaSample);
+ HRESULT DeliverEndOfStream();
+ HRESULT DeliverBeginFlush();
+ HRESULT DeliverEndFlush();
+ HRESULT DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+};
+
+class CSubpicInputPin : public CMpeg2DecInputPin
+{
+ CCritSec m_csReceive;
+
+ AM_PROPERTY_COMPOSIT_ON m_spon;
+ AM_DVD_YUV m_sppal[16];
+ bool m_fsppal;
+ CAutoPtr<AM_PROPERTY_SPHLI> m_sphli; // temp
+
+ class spu : public CAtlArray<BYTE>
+ {
+ public:
+ bool m_fForced;
+ REFERENCE_TIME m_rtStart, m_rtStop;
+ DWORD m_offset[2];
+ AM_PROPERTY_SPHLI m_sphli; // parsed
+ CAutoPtr<AM_PROPERTY_SPHLI> m_psphli; // for the menu (optional)
+ spu() {memset(&m_sphli, 0, sizeof(m_sphli)); m_fForced = false; m_rtStart = m_rtStop = 0;}
+ virtual ~spu() {}
+ virtual bool Parse() = 0;
+ virtual void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal) = 0;
+ };
+
+ class dvdspu : public spu
+ {
+ public:
+ struct offset_t {REFERENCE_TIME rt; AM_PROPERTY_SPHLI sphli;};
+ CAtlList<offset_t> m_offsets;
+ bool Parse();
+ void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal);
+ };
+
+ class cvdspu : public spu
+ {
+ public:
+ AM_DVD_YUV m_sppal[2][4];
+ cvdspu() {memset(m_sppal, 0, sizeof(m_sppal));}
+ bool Parse();
+ void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal);
+ };
+
+ class svcdspu : public spu
+ {
+ public:
+ AM_DVD_YUV m_sppal[4];
+ svcdspu() {memset(m_sppal, 0, sizeof(m_sppal));}
+ bool Parse();
+ void Render(REFERENCE_TIME rt, BYTE** p, int w, int h, AM_DVD_YUV* sppal, bool fsppal);
+ };
+
+ CAutoPtrList<spu> m_sps;
+
+protected:
+ HRESULT Transform(IMediaSample* pSample);
+
+public:
+ CSubpicInputPin(CTransformFilter* pFilter, HRESULT* phr);
+
+ bool HasAnythingToRender(REFERENCE_TIME rt);
+ void RenderSubpics(REFERENCE_TIME rt, BYTE** p, int w, int h);
+
+ HRESULT CheckMediaType(const CMediaType* mtIn);
+ HRESULT SetMediaType(const CMediaType* mtIn);
+
+ // we shouldn't pass these to the filter from this pin
+ STDMETHODIMP EndOfStream() {return S_OK;}
+ STDMETHODIMP BeginFlush() {return S_OK;}
+ STDMETHODIMP EndFlush();
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) {return S_OK;}
+
+ // IKsPropertySet
+ STDMETHODIMP Set(REFGUID PropSet, ULONG Id, LPVOID InstanceData, ULONG InstanceLength, LPVOID PropertyData, ULONG DataLength);
+ STDMETHODIMP QuerySupported(REFGUID PropSet, ULONG Id, ULONG* pTypeSupport);
+};
+
+class CClosedCaptionOutputPin : public CBaseOutputPin
+{
+public:
+ CClosedCaptionOutputPin(CBaseFilter* pFilter, CCritSec* pLock, HRESULT* phr);
+
+ HRESULT CheckMediaType(const CMediaType* mtOut);
+ HRESULT GetMediaType(int iPosition, CMediaType* pmt);
+ HRESULT DecideBufferSize(IMemAllocator* pAllocator, ALLOCATOR_PROPERTIES* pProperties);
+
+ CMediaType& CurrentMediaType() {return m_mt;}
+
+ HRESULT Deliver(const void* ptr, int len);
+};
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.rc b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.rc
new file mode 100644
index 000000000..2d6d96cb5
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.rc
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,2
+ PRODUCTVERSION 1,0,0,2
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://gabest.org/"
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "MPEG-1/2 Decoder Filter for DirectShow"
+ VALUE "FileVersion", "1, 0, 0, 2"
+ VALUE "InternalName", " Mpeg2Dec Filter"
+ VALUE "LegalCopyright", "Copyright (C) 2003-2006 Gabest"
+ VALUE "OriginalFilename", "Mpeg2DecFilter.ax"
+ VALUE "ProductName", " Mpeg2Dec Filter"
+ VALUE "ProductVersion", "1, 0, 0, 2"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.sln b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.sln
new file mode 100644
index 000000000..7a709f630
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.sln
@@ -0,0 +1,102 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mpeg2DecFilter", "Mpeg2DecFilter.vcproj", "{305BAB2D-0D75-4FBC-8BCD-A2917392B48C}"
+ ProjectSection(ProjectDependencies) = postProject
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575} = {1A2DFD1A-3C6C-44D1-909D-294AF646B575}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601} = {6BA829DC-20C1-4B6B-BF63-7601FEB64601}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decss", "..\..\..\decss\decss.vcproj", "{1A2DFD1A-3C6C-44D1-909D-294AF646B575}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{6BA829DC-20C1-4B6B-BF63-7601FEB64601}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug.ActiveCfg = Debug|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug.Build.0 = Debug|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug lib.ActiveCfg = Debug lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug lib.Build.0 = Debug lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release.ActiveCfg = Release|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release.Build.0 = Release|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release lib.ActiveCfg = Release lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release lib.Build.0 = Release lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode.Build.0 = Release Unicode|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {305BAB2D-0D75-4FBC-8BCD-A2917392B48C}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.ActiveCfg = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug.Build.0 = Debug|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug lib.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug lib.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.ActiveCfg = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release.Build.0 = Release|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release lib.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release lib.Build.0 = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode.Build.0 = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {1A2DFD1A-3C6C-44D1-909D-294AF646B575}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug.ActiveCfg = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug.Build.0 = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug lib.ActiveCfg = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug lib.Build.0 = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release.ActiveCfg = Release|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release.Build.0 = Release|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release lib.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release lib.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.vcproj b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.vcproj
new file mode 100644
index 000000000..9fea6118a
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter.vcproj
@@ -0,0 +1,566 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Mpeg2DecFilter"
+ ProjectGUID="{305BAB2D-0D75-4FBC-8BCD-A2917392B48C}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj decssD.lib dsutilD.lib strmbaseD.lib basevideofilterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib;../../../../lib/detours"
+ ModuleDefinitionFile="Mpeg2DecFilter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="1"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj decssR.lib dsutilR.lib strmbaseR.lib basevideofilterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib;../../../../lib/detours"
+ ModuleDefinitionFile="Mpeg2DecFilter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj decssDU.lib dsutilDU.lib strmbaseDU.lib basevideofilterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib;../../../../lib/detours"
+ ModuleDefinitionFile="Mpeg2DecFilter.def"
+ GenerateDebugInformation="TRUE"
+ SubSystem="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="1"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="FALSE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj decssRU.lib dsutilRU.lib strmbaseRU.lib basevideofilterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib;../../../../lib/detours"
+ ModuleDefinitionFile="Mpeg2DecFilter.def"
+ GenerateDebugInformation="FALSE"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="1"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="1"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="1"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\idct_sse2.cpp">
+ </File>
+ <File
+ RelativePath=".\libmpeg2.cpp">
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ OptimizeForProcessor="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ OptimizeForProcessor="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\mc_sse2.cpp">
+ </File>
+ <File
+ RelativePath=".\Mpeg2DecFilter.cpp">
+ </File>
+ <File
+ RelativePath=".\Mpeg2DecSettingsWnd.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\IMpeg2DecFilter.h">
+ </File>
+ <File
+ RelativePath=".\libmpeg2.h">
+ </File>
+ <File
+ RelativePath=".\Mpeg2DecFilter.h">
+ </File>
+ <File
+ RelativePath=".\Mpeg2DecSettingsWnd.h">
+ </File>
+ <File
+ RelativePath=".\resource.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath=".\Mpeg2DecFilter.rc">
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="TRUE">
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="1"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter_vs2005.vcproj b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter_vs2005.vcproj
new file mode 100644
index 000000000..cc83270fc
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter_vs2005.vcproj
@@ -0,0 +1,846 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="Mpeg2DecFilter"
+ ProjectGUID="{305BAB2D-0D75-4FBC-8BCD-A2917392B48C}"
+ RootNamespace="Mpeg2DecFilter"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj decssD.lib dsutilD.lib strmbaseD.lib basevideofilterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib;../../../../lib/detours"
+ ModuleDefinitionFile="Mpeg2DecFilter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj decssR.lib dsutilR.lib strmbaseR.lib basevideofilterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib;../../../../lib/detours"
+ ModuleDefinitionFile="Mpeg2DecFilter.def"
+ DelayLoadDLLs=""
+ GenerateDebugInformation="false"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;_DEBUG;_USRDLL"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj decssDU.lib dsutilDU.lib strmbaseDU.lib basevideofilterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib;../../../../lib/detours"
+ ModuleDefinitionFile="Mpeg2DecFilter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="REGISTER_FILTER;WIN32;NDEBUG;_USRDLL"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="idct_mmx.obj motion_comp_mmx.obj decssRU.lib dsutilRU.lib strmbaseRU.lib basevideofilterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).ax"
+ AdditionalLibraryDirectories="../../../../lib;../../../../lib/detours"
+ ModuleDefinitionFile="Mpeg2DecFilter.def"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ OutputDirectory="Debug lib"
+ IntermediateDirectory="Debug lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="basevideofilterD.lib idct_mmx.obj motion_comp_mmx.obj"
+ OutputFile="../../../../lib/$(ProjectName)D.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ OutputDirectory="Debug Unicode lib"
+ IntermediateDirectory="Debug Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="basevideofilterDU.lib idct_mmx.obj motion_comp_mmx.obj"
+ OutputFile="../../../../lib/$(ProjectName)DU.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ OutputDirectory="Release lib"
+ IntermediateDirectory="Release lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="basevideofilterR.lib idct_mmx.obj motion_comp_mmx.obj"
+ OutputFile="../../../../lib/$(ProjectName)R.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ OutputDirectory="Release Unicode lib"
+ IntermediateDirectory="Release Unicode lib"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="false"
+ ForceConformanceInForLoopScope="true"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="basevideofilterRU.lib idct_mmx.obj motion_comp_mmx.obj"
+ OutputFile="../../../../lib/$(ProjectName)RU.lib"
+ AdditionalLibraryDirectories="../../../../lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
+ >
+ <File
+ RelativePath=".\idct_sse2.cpp"
+ >
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AssemblerOutput="4"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\libmpeg2.cpp"
+ >
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AssemblerOutput="4"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\mc_sse2.cpp"
+ >
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AssemblerOutput="4"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Mpeg2DecFilter.cpp"
+ >
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AssemblerOutput="4"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Mpeg2DecSettingsWnd.cpp"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc"
+ >
+ <File
+ RelativePath=".\IMpeg2DecFilter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\libmpeg2.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Mpeg2DecFilter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Mpeg2DecSettingsWnd.h"
+ >
+ </File>
+ <File
+ RelativePath=".\resource.h"
+ >
+ </File>
+ <File
+ RelativePath="stdafx.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath=".\Mpeg2DecFilter.rc"
+ >
+ <FileConfiguration
+ Name="Debug lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode lib|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="1"
+ />
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter_vs2005.vcproj.POLUX.Casimir666.user b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter_vs2005.vcproj.POLUX.Casimir666.user
new file mode 100644
index 000000000..aab4336a0
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecFilter_vs2005.vcproj.POLUX.Casimir666.user
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioUserFile
+ ProjectType="Visual C++"
+ Version="8.00"
+ ShowAllFiles="false"
+ >
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode lib|Win32"
+ >
+ <DebugSettings
+ Command=""
+ WorkingDirectory=""
+ CommandArguments=""
+ Attach="false"
+ DebuggerType="3"
+ Remote="1"
+ RemoteMachine="POLUX"
+ RemoteCommand=""
+ HttpUrl=""
+ PDBPath=""
+ SQLDebugging=""
+ Environment=""
+ EnvironmentMerge="true"
+ DebuggerFlavor=""
+ MPIRunCommand=""
+ MPIRunArguments=""
+ MPIRunWorkingDirectory=""
+ ApplicationCommand=""
+ ApplicationArguments=""
+ ShimCommand=""
+ MPIAcceptMode=""
+ MPIAcceptFilter=""
+ />
+ </Configuration>
+ </Configurations>
+</VisualStudioUserFile>
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecSettingsWnd.cpp b/src/filters/transform/mpeg2decfilter/Mpeg2DecSettingsWnd.cpp
new file mode 100644
index 000000000..fb1fbbac3
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecSettingsWnd.cpp
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "Mpeg2DecSettingsWnd.h"
+#include "..\..\..\dsutil\dsutil.h"
+
+//
+// CMpeg2DecSettingsWnd
+//
+
+CMpeg2DecSettingsWnd::CMpeg2DecSettingsWnd()
+{
+}
+
+bool CMpeg2DecSettingsWnd::OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks)
+{
+ ASSERT(!m_pM2DF);
+
+ m_pM2DF.Release();
+
+ POSITION pos = pUnks.GetHeadPosition();
+ while(pos && !(m_pM2DF = pUnks.GetNext(pos)));
+
+ if(!m_pM2DF) return false;
+
+ m_ditype = m_pM2DF->GetDeinterlaceMethod();
+ m_procamp[0] = m_pM2DF->GetBrightness();
+ m_procamp[1] = m_pM2DF->GetContrast();
+ m_procamp[2] = m_pM2DF->GetHue();
+ m_procamp[3] = m_pM2DF->GetSaturation();
+ m_forcedsubs = m_pM2DF->IsForcedSubtitlesEnabled();
+ m_planaryuv = m_pM2DF->IsPlanarYUVEnabled();
+ m_interlaced = m_pM2DF->IsInterlacedEnabled();
+
+ return true;
+}
+
+void CMpeg2DecSettingsWnd::OnDisconnect()
+{
+ m_pM2DF.Release();
+}
+
+bool CMpeg2DecSettingsWnd::OnActivate()
+{
+ DWORD dwStyle = WS_VISIBLE|WS_CHILD|WS_TABSTOP;
+
+ CPoint p(10, 10);
+
+ m_planaryuv_check.Create(_T("Enable planar YUV media types (VY12, I420, IYUY)"), dwStyle|BS_AUTOCHECKBOX, CRect(p, CSize(300, m_fontheight)), this, IDC_PP_CHECK1);
+ m_planaryuv_check.SetCheck(m_planaryuv ? BST_CHECKED : BST_UNCHECKED);
+ p.y += m_fontheight + 5;
+
+ m_interlaced_check.Create(_T("Set interlaced flag in output media type"), dwStyle|BS_AUTOCHECKBOX, CRect(p, CSize(300, m_fontheight)), this, IDC_PP_CHECK2);
+ m_interlaced_check.SetCheck(m_interlaced ? BST_CHECKED : BST_UNCHECKED);
+ p.y += m_fontheight + 5;
+
+ m_forcedsubs_check.Create(_T("Always display forced subtitles"), dwStyle|BS_AUTOCHECKBOX, CRect(p, CSize(300, m_fontheight)), this, IDC_PP_CHECK3);
+ m_forcedsubs_check.SetCheck(m_forcedsubs ? BST_CHECKED : BST_UNCHECKED);
+ p.y += m_fontheight + 5;
+
+ p.y += 10;
+
+ m_ditype_static.Create(_T("Deinterlacing"), dwStyle, CRect(p, CSize(70, m_fontheight)), this);
+ m_ditype_combo.Create(dwStyle|CBS_DROPDOWNLIST, CRect(p + CSize(85, -3), CSize(100, 200)), this, IDC_PP_COMBO1);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Auto")), (DWORD)DIAuto);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Weave")), (DWORD)DIWeave);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Blend")), (DWORD)DIBlend);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Bob")), (DWORD)DIBob);
+ m_ditype_combo.SetItemData(m_ditype_combo.AddString(_T("Field Shift")), (DWORD)DIFieldShift);
+ m_ditype_combo.SetCurSel(0);
+ for(int i = 0; i < m_ditype_combo.GetCount(); i++)
+ if((int)m_ditype_combo.GetItemData(i) == m_ditype)
+ m_ditype_combo.SetCurSel(i);
+
+ p.y += m_fontheight + 20;
+
+ for(int i = 0, h = max(20, m_fontheight)+1; i < countof(m_procamp_slider); i++, p.y += h)
+ {
+ static const TCHAR* labels[] = {_T("Brightness"), _T("Contrast"), _T("Hue"), _T("Saturation")};
+ m_procamp_static[i].Create(labels[i], dwStyle, CRect(p, CSize(70, h)), this);
+ m_procamp_slider[i].Create(dwStyle, CRect(p + CPoint(80, 0), CSize(200, h)), this, IDC_PP_SLIDER1+i);
+ m_procamp_value[i].Create(_T(""), dwStyle, CRect(p + CPoint(280, 0), CSize(40, h)), this);
+ }
+
+ m_procamp_slider[0].SetRange(0, 2*128);
+ m_procamp_slider[0].SetTic(128);
+ m_procamp_slider[0].SetPos((int)(m_procamp[0] + (m_procamp[0] >= 0 ? 0.5f : -0.5f)) + 128);
+ m_procamp_slider[1].SetRange(0, 200);
+ m_procamp_slider[1].SetTic(100);
+ m_procamp_slider[1].SetPos((int)(100*m_procamp[1] + 0.5f));
+ m_procamp_slider[2].SetRange(0, 2*180);
+ m_procamp_slider[2].SetTic(180);
+ m_procamp_slider[2].SetPos((int)(m_procamp[2] + (m_procamp[2] >= 0 ? 0.5f : -0.5f)) + 180);
+ m_procamp_slider[3].SetRange(0, 200);
+ m_procamp_slider[3].SetTic(100);
+ m_procamp_slider[3].SetPos((int)(100*m_procamp[3] + 0.5f));
+
+ p.y += 5;
+
+ m_procamp_tv2pc.Create(_T("TV->PC"), dwStyle, CRect(p + CPoint(80 + 200/2 - 55, 0), CSize(50, 20)), this, IDC_PP_BUTTON1);
+ m_procamp_reset.Create(_T("Reset"), dwStyle, CRect(p + CPoint(80 + 200/2 + 5, 0), CSize(50, 20)), this, IDC_PP_BUTTON2);
+
+ p.y += 30;
+
+ UpdateProcampValues();
+
+ m_note_static.Create(
+ _T("Note: Using a non-planar output format, bob deinterlacer, or adjusting color properies ")
+ _T("can degrade performance. \"Auto\" deinterlacer will switch to \"Blend\" when necessary."),
+ dwStyle, CRect(p, CSize(320, m_fontheight * 3)), this);
+
+ for(CWnd* pWnd = GetWindow(GW_CHILD); pWnd; pWnd = pWnd->GetNextWindow())
+ pWnd->SetFont(&m_font, FALSE);
+
+ return true;
+}
+
+void CMpeg2DecSettingsWnd::OnDeactivate()
+{
+ m_ditype = (ditype)m_ditype_combo.GetItemData(m_ditype_combo.GetCurSel());
+ m_procamp[0] = (float)m_procamp_slider[0].GetPos() - 128;
+ m_procamp[1] = (float)m_procamp_slider[1].GetPos() / 100;
+ m_procamp[2] = (float)m_procamp_slider[2].GetPos() - 180;
+ m_procamp[3] = (float)m_procamp_slider[3].GetPos() / 100;
+ m_planaryuv = !!IsDlgButtonChecked(m_planaryuv_check.GetDlgCtrlID());
+ m_interlaced = !!IsDlgButtonChecked(m_interlaced_check.GetDlgCtrlID());
+ m_forcedsubs = !!IsDlgButtonChecked(m_forcedsubs_check.GetDlgCtrlID());
+}
+
+bool CMpeg2DecSettingsWnd::OnApply()
+{
+ OnDeactivate();
+
+ if(m_pM2DF)
+ {
+ m_pM2DF->SetDeinterlaceMethod(m_ditype);
+ m_pM2DF->SetBrightness(m_procamp[0]);
+ m_pM2DF->SetContrast(m_procamp[1]);
+ m_pM2DF->SetHue(m_procamp[2]);
+ m_pM2DF->SetSaturation(m_procamp[3]);
+ m_pM2DF->EnableForcedSubtitles(m_forcedsubs);
+ m_pM2DF->EnablePlanarYUV(m_planaryuv);
+ m_pM2DF->EnableInterlaced(m_interlaced);
+ }
+
+ return true;
+}
+
+void CMpeg2DecSettingsWnd::UpdateProcampValues()
+{
+ CString str;
+
+ str.Format(_T("%d"), m_procamp_slider[0].GetPos() - 128);
+ m_procamp_value[0].SetWindowText(str);
+ str.Format(_T("%d%%"), m_procamp_slider[1].GetPos());
+ m_procamp_value[1].SetWindowText(str);
+ str.Format(_T("%d"), m_procamp_slider[2].GetPos() - 180);
+ m_procamp_value[2].SetWindowText(str);
+ str.Format(_T("%d%%"), m_procamp_slider[3].GetPos());
+ m_procamp_value[3].SetWindowText(str);
+}
+
+BEGIN_MESSAGE_MAP(CMpeg2DecSettingsWnd, CInternalPropertyPageWnd)
+ ON_BN_CLICKED(IDC_PP_BUTTON1, OnButtonProcampPc2Tv)
+ ON_BN_CLICKED(IDC_PP_BUTTON2, OnButtonProcampReset)
+ ON_BN_CLICKED(IDC_PP_CHECK2, OnButtonInterlaced)
+ ON_WM_HSCROLL()
+END_MESSAGE_MAP()
+
+void CMpeg2DecSettingsWnd::OnButtonProcampPc2Tv()
+{
+ m_procamp_slider[0].SetPos(128 - 16);
+ m_procamp_slider[1].SetPos(100 * 255/(235-16));
+
+ UpdateProcampValues();
+}
+
+void CMpeg2DecSettingsWnd::OnButtonProcampReset()
+{
+ m_procamp_slider[0].SetPos(128);
+ m_procamp_slider[1].SetPos(100);
+ m_procamp_slider[2].SetPos(180);
+ m_procamp_slider[3].SetPos(100);
+
+ UpdateProcampValues();
+}
+
+void CMpeg2DecSettingsWnd::OnButtonInterlaced()
+{
+ m_ditype_combo.EnableWindow(!IsDlgButtonChecked(m_interlaced_check.GetDlgCtrlID()));
+}
+
+void CMpeg2DecSettingsWnd::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ UpdateProcampValues();
+
+ __super::OnHScroll(nSBCode, nPos, pScrollBar);
+}
diff --git a/src/filters/transform/mpeg2decfilter/Mpeg2DecSettingsWnd.h b/src/filters/transform/mpeg2decfilter/Mpeg2DecSettingsWnd.h
new file mode 100644
index 000000000..ab4b3937d
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/Mpeg2DecSettingsWnd.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\InternalPropertyPage.h"
+#include "IMpeg2DecFilter.h"
+#include <afxcmn.h>
+
+[uuid("E5FB6957-65E6-491B-BB37-B25C9FE3BEA7")]
+class CMpeg2DecSettingsWnd : public CInternalPropertyPageWnd
+{
+ CComQIPtr<IMpeg2DecFilter> m_pM2DF;
+
+ ditype m_ditype;
+ float m_procamp[4];
+ bool m_planaryuv;
+ bool m_interlaced;
+ bool m_forcedsubs;
+
+ enum
+ {
+ IDC_PP_COMBO1 = 10000,
+ IDC_PP_SLIDER1,
+ IDC_PP_SLIDER2,
+ IDC_PP_SLIDER3,
+ IDC_PP_SLIDER4,
+ IDC_PP_CHECK1,
+ IDC_PP_CHECK2,
+ IDC_PP_CHECK3,
+ IDC_PP_BUTTON1,
+ IDC_PP_BUTTON2,
+ };
+
+ CStatic m_ditype_static;
+ CComboBox m_ditype_combo;
+ CStatic m_procamp_static[4];
+ CSliderCtrl m_procamp_slider[4];
+ CStatic m_procamp_value[4];
+ CButton m_procamp_tv2pc;
+ CButton m_procamp_reset;
+ CButton m_planaryuv_check;
+ CButton m_interlaced_check;
+ CButton m_forcedsubs_check;
+ CStatic m_note_static;
+
+ void UpdateProcampValues();
+
+public:
+ CMpeg2DecSettingsWnd();
+
+ bool OnConnect(const CInterfaceList<IUnknown, &IID_IUnknown>& pUnks);
+ void OnDisconnect();
+ bool OnActivate();
+ void OnDeactivate();
+ bool OnApply();
+
+ static LPCTSTR GetWindowTitle() {return _T("Settings");}
+
+ DECLARE_MESSAGE_MAP()
+
+ afx_msg void OnButtonProcampPc2Tv();
+ afx_msg void OnButtonProcampReset();
+ afx_msg void OnButtonInterlaced();
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+}; \ No newline at end of file
diff --git a/src/filters/transform/mpeg2decfilter/idct_mmx.obj b/src/filters/transform/mpeg2decfilter/idct_mmx.obj
new file mode 100644
index 000000000..d5dcbe5aa
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/idct_mmx.obj
Binary files differ
diff --git a/src/filters/transform/mpeg2decfilter/idct_sse2.cpp b/src/filters/transform/mpeg2decfilter/idct_sse2.cpp
new file mode 100644
index 000000000..e603bb8e3
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/idct_sse2.cpp
@@ -0,0 +1,524 @@
+#include "stdafx.h"
+#include "libmpeg2.h"
+
+// Intel's SSE2 implementation of iDCT
+// AP-945
+// http://cache-www.intel.com/cd/00/00/01/76/17680_w_idct.pdf
+
+#define BITS_INV_ACC 4 // 4 or 5 for IEEE
+#define SHIFT_INV_ROW 16 - BITS_INV_ACC
+#define SHIFT_INV_COL 1 + BITS_INV_ACC
+const short RND_INV_ROW = 1024 * (6 - BITS_INV_ACC); //1 << (SHIFT_INV_ROW-1)
+const short RND_INV_COL = 16 * (BITS_INV_ACC - 3); // 1 << (SHIFT_INV_COL-1)
+const short RND_INV_CORR = RND_INV_COL - 1; // correction -1.0 and round
+
+__declspec(align(16)) short M128_one_corr[8] = {1,1,1,1,1,1,1,1};
+__declspec(align(16)) short M128_round_inv_row[8] = {RND_INV_ROW, 0, RND_INV_ROW, 0, RND_INV_ROW, 0, RND_INV_ROW, 0};
+__declspec(align(16)) short M128_round_inv_col[8] = {RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL};
+__declspec(align(16)) short M128_round_inv_corr[8]= {RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR};
+__declspec(align(16)) short M128_tg_1_16[8] = {13036, 13036, 13036, 13036, 13036, 13036, 13036, 13036}; // tg * (2<<16) + 0.5
+__declspec(align(16)) short M128_tg_2_16[8] = {27146, 27146, 27146, 27146, 27146, 27146, 27146, 27146}; // tg * (2<<16) + 0.5
+__declspec(align(16)) short M128_tg_3_16[8] = {-21746, -21746, -21746, -21746, -21746, -21746, -21746, -21746}; // tg * (2<<16) + 0.5
+__declspec(align(16)) short M128_cos_4_16[8] = {-19195, -19195, -19195, -19195, -19195, -19195, -19195, -19195};// cos * (2<<16) + 0.5
+
+//-----------------------------------------------------------------------------
+// Table for rows 0,4 - constants are multiplied on cos_4_16
+//movq -> w13 w12 w09 w08 w05 w04 w01 w00
+// w15 w14 w11 w10 w07 w06 w03 w02
+// w29 w28 w25 w24 w21 w20 w17 w16
+// w31 w30 w27 w26 w23 w22 w19 w18
+
+__declspec(align(16)) short M128_tab_i_04[] =
+{
+ 16384, 21407, 16384, 8867, //movq -> w05 w04 w01 w00
+ 16384, -8867, 16384, -21407, // w13 w12 w09 w08
+ 16384, 8867, -16384, -21407, // w07 w06 w03 w02
+ -16384, 21407, 16384, -8867, // w15 w14 w11 w10
+ 22725, 19266, 19266, -4520, // w21 w20 w17 w16
+ 12873, -22725, 4520, -12873, // w29 w28 w25 w24
+ 12873, 4520, -22725, -12873, // w23 w22 w19 w18
+ 4520, 19266, 19266, -22725 // w31 w30 w27 w26
+};
+
+// Table for rows 1,7 - constants are multiplied on cos_1_16
+
+__declspec(align(16)) short M128_tab_i_17[] =
+{
+ 22725, 29692, 22725, 12299, //movq -> w05 w04 w01 w00
+ 22725, -12299, 22725, -29692, // w13 w12 w09 w08
+ 22725, 12299, -22725, -29692, // w07 w06 w03 w02
+ -22725, 29692, 22725, -12299, // w15 w14 w11 w10
+ 31521, 26722, 26722, -6270, // w21 w20 w17 w16
+ 17855, -31521, 6270, -17855, // w29 w28 w25 w24
+ 17855, 6270, -31521, -17855, // w23 w22 w19 w18
+ 6270, 26722, 26722, -31521 // w31 w30 w27 w26
+};
+
+// Table for rows 2,6 - constants are multiplied on cos_2_16
+
+__declspec(align(16)) short M128_tab_i_26[] =
+{
+ 21407, 27969, 21407, 11585, //movq -> w05 w04 w01 w00
+ 21407, -11585, 21407, -27969, // w13 w12 w09 w08
+ 21407, 11585, -21407, -27969, // w07 w06 w03 w02
+ -21407, 27969, 21407, -11585, // w15 w14 w11 w10
+ 29692, 25172, 25172, -5906, // w21 w20 w17 w16
+ 16819, -29692, 5906, -16819, // w29 w28 w25 w24
+ 16819, 5906, -29692, -16819, // w23 w22 w19 w18
+ 5906, 25172, 25172, -29692 // w31 w30 w27 w26
+};
+
+// Table for rows 3,5 - constants are multiplied on cos_3_16
+
+__declspec(align(16)) short M128_tab_i_35[] =
+{
+ 19266, 25172, 19266, 10426, //movq -> w05 w04 w01 w00
+ 19266, -10426, 19266, -25172, // w13 w12 w09 w08
+ 19266, 10426, -19266, -25172, // w07 w06 w03 w02
+ -19266, 25172, 19266, -10426, // w15 w14 w11 w10
+ 26722, 22654, 22654, -5315, // w21 w20 w17 w16
+ 15137, -26722, 5315, -15137, // w29 w28 w25 w24
+ 15137, 5315, -26722, -15137, // w23 w22 w19 w18
+ 5315, 22654, 22654, -26722 // w31 w30 w27 w26
+};
+
+//-----------------------------------------------------------------------------
+/*
+;=============================================================================
+;=============================================================================
+;=============================================================================
+;
+; Inverse DCT
+;
+;-----------------------------------------------------------------------------
+;
+; This implementation calculates iDCT-2D by a row-column method.
+; On the first stage the iDCT-1D is calculated for each row with use
+; direct algorithm, on the second stage the calculation is executed
+; at once for four columns with use of scaled iDCT-1D algorithm.
+; Base R&Y algorithm for iDCT-1D is modified for second stage.
+;
+;=============================================================================
+;-----------------------------------------------------------------------------
+;
+; The first stage - inverse DCTs of rows
+;
+;-----------------------------------------------------------------------------
+; The 8-point inverse DCT direct algorithm
+;-----------------------------------------------------------------------------
+;
+; static const short w[32] = {
+; FIX(cos_4_16), FIX(cos_2_16), FIX(cos_4_16), FIX(cos_6_16),
+; FIX(cos_4_16), FIX(cos_6_16), -FIX(cos_4_16), -FIX(cos_2_16),
+; FIX(cos_4_16), -FIX(cos_6_16), -FIX(cos_4_16), FIX(cos_2_16),
+; FIX(cos_4_16), -FIX(cos_2_16), FIX(cos_4_16), -FIX(cos_6_16),
+; FIX(cos_1_16), FIX(cos_3_16), FIX(cos_5_16), FIX(cos_7_16),
+; FIX(cos_3_16), -FIX(cos_7_16), -FIX(cos_1_16), -FIX(cos_5_16),
+; FIX(cos_5_16), -FIX(cos_1_16), FIX(cos_7_16), FIX(cos_3_16),
+; FIX(cos_7_16), -FIX(cos_5_16), FIX(cos_3_16), -FIX(cos_1_16) };
+;
+; #define DCT_8_INV_ROW(x, y)
+; {
+; int a0, a1, a2, a3, b0, b1, b2, b3;
+;
+; a0 = x[0] * w[ 0] + x[2] * w[ 1] + x[4] * w[ 2] + x[6] * w[ 3];
+; a1 = x[0] * w[ 4] + x[2] * w[ 5] + x[4] * w[ 6] + x[6] * w[ 7];
+; a2 = x[0] * w[ 8] + x[2] * w[ 9] + x[4] * w[10] + x[6] * w[11];
+; a3 = x[0] * w[12] + x[2] * w[13] + x[4] * w[14] + x[6] * w[15];
+; b0 = x[1] * w[16] + x[3] * w[17] + x[5] * w[18] + x[7] * w[19];
+; b1 = x[1] * w[20] + x[3] * w[21] + x[5] * w[22] + x[7] * w[23];
+; b2 = x[1] * w[24] + x[3] * w[25] + x[5] * w[26] + x[7] * w[27];
+; b3 = x[1] * w[28] + x[3] * w[29] + x[5] * w[30] + x[7] * w[31];
+;
+; y[0] = SHIFT_ROUND ( a0 + b0 );
+; y[1] = SHIFT_ROUND ( a1 + b1 );
+; y[2] = SHIFT_ROUND ( a2 + b2 );
+; y[3] = SHIFT_ROUND ( a3 + b3 );
+; y[4] = SHIFT_ROUND ( a3 - b3 );
+; y[5] = SHIFT_ROUND ( a2 - b2 );
+; y[6] = SHIFT_ROUND ( a1 - b1 );
+; y[7] = SHIFT_ROUND ( a0 - b0 );
+; }
+;
+;-----------------------------------------------------------------------------
+;
+; In this implementation the outputs of the iDCT-1D are multiplied
+; for rows 0,4 - on cos_4_16,
+; for rows 1,7 - on cos_1_16,
+; for rows 2,6 - on cos_2_16,
+; for rows 3,5 - on cos_3_16
+; and are shifted to the left for rise of accuracy
+;
+; For used constants
+; FIX(float_const) = (short) (float_const * (1<<15) + 0.5)
+;
+;-----------------------------------------------------------------------------
+;-----------------------------------------------------------------------------
+;
+; The second stage - inverse DCTs of columns
+;
+; The inputs are multiplied
+; for rows 0,4 - on cos_4_16,
+; for rows 1,7 - on cos_1_16,
+; for rows 2,6 - on cos_2_16,
+; for rows 3,5 - on cos_3_16
+; and are shifted to the left for rise of accuracy
+;
+;-----------------------------------------------------------------------------
+;
+; The 8-point scaled inverse DCT algorithm (26a8m)
+;
+;-----------------------------------------------------------------------------
+;
+; #define DCT_8_INV_COL(x, y)
+; {
+; short t0, t1, t2, t3, t4, t5, t6, t7;
+; short tp03, tm03, tp12, tm12, tp65, tm65;
+; short tp465, tm465, tp765, tm765;
+;
+; tp765 = x[1] + x[7] * tg_1_16;
+; tp465 = x[1] * tg_1_16 - x[7];
+; tm765 = x[5] * tg_3_16 + x[3];
+; tm465 = x[5] - x[3] * tg_3_16;
+;
+; t7 = tp765 + tm765;
+; tp65 = tp765 - tm765;
+; t4 = tp465 + tm465;
+; tm65 = tp465 - tm465;
+;
+; t6 = ( tp65 + tm65 ) * cos_4_16;
+; t5 = ( tp65 - tm65 ) * cos_4_16;
+;
+; tp03 = x[0] + x[4];
+; tp12 = x[0] - x[4];
+;
+; tm03 = x[2] + x[6] * tg_2_16;
+; tm12 = x[2] * tg_2_16 - x[6];
+;
+; t0 = tp03 + tm03;
+; t3 = tp03 - tm03;
+; t1 = tp12 + tm12;
+; t2 = tp12 - tm12;
+;
+; y[0] = SHIFT_ROUND ( t0 + t7 );
+; y[7] = SHIFT_ROUND ( t0 - t7 );
+; y[1] = SHIFT_ROUND ( t1 + t6 );
+; y[6] = SHIFT_ROUND ( t1 - t6 );
+; y[2] = SHIFT_ROUND ( t2 + t5 );
+; y[5] = SHIFT_ROUND ( t2 - t5 );
+; y[3] = SHIFT_ROUND ( t3 + t4 );
+; y[4] = SHIFT_ROUND ( t3 - t4 );
+; }
+;
+;-----------------------------------------------------------------------------
+*/
+//xmm7 = round_inv_row
+#define DCT_8_INV_ROW __asm{ \
+ __asm pshuflw xmm0, xmm0, 0xD8 \
+ __asm pshufd xmm1, xmm0, 0 \
+ __asm pmaddwd xmm1, [esi] \
+ __asm pshufd xmm3, xmm0, 0x55 \
+ __asm pshufhw xmm0, xmm0, 0xD8 \
+ __asm pmaddwd xmm3, [esi+32] \
+ __asm pshufd xmm2, xmm0, 0xAA \
+ __asm pshufd xmm0, xmm0, 0xFF \
+ __asm pmaddwd xmm2, [esi+16] \
+ __asm pshufhw xmm4, xmm4, 0xD8 \
+ __asm paddd xmm1, M128_round_inv_row \
+ __asm pshuflw xmm4, xmm4, 0xD8 \
+ __asm pmaddwd xmm0, [esi+48] \
+ __asm pshufd xmm5, xmm4, 0 \
+ __asm pshufd xmm6, xmm4, 0xAA \
+ __asm pmaddwd xmm5, [ecx] \
+ __asm paddd xmm1, xmm2 \
+ __asm movdqa xmm2, xmm1 \
+ __asm pshufd xmm7, xmm4, 0x55 \
+ __asm pmaddwd xmm6, [ecx+16] \
+ __asm paddd xmm0, xmm3 \
+ __asm pshufd xmm4, xmm4, 0xFF \
+ __asm psubd xmm2, xmm0 \
+ __asm pmaddwd xmm7, [ecx+32] \
+ __asm paddd xmm0, xmm1 \
+ __asm psrad xmm2, 12 \
+ __asm paddd xmm5, M128_round_inv_row \
+ __asm pmaddwd xmm4, [ecx+48] \
+ __asm paddd xmm5, xmm6 \
+ __asm movdqa xmm6, xmm5 \
+ __asm psrad xmm0, 12 \
+ __asm pshufd xmm2, xmm2, 0x1B \
+ __asm packssdw xmm0, xmm2 \
+ __asm paddd xmm4, xmm7 \
+ __asm psubd xmm6, xmm4 \
+ __asm paddd xmm4, xmm5 \
+ __asm psrad xmm6, 12 \
+ __asm psrad xmm4, 12 \
+ __asm pshufd xmm6, xmm6, 0x1B \
+ __asm packssdw xmm4, xmm6 \
+}
+#define DCT_8_INV_COL_8 __asm{ \
+ __asm movdqa xmm1, XMMWORD PTR M128_tg_3_16 \
+ __asm movdqa xmm2, xmm0 \
+ __asm movdqa xmm3, XMMWORD PTR [edx+3*16] \
+ __asm pmulhw xmm0, xmm1 \
+ __asm pmulhw xmm1, xmm3 \
+ __asm movdqa xmm5, XMMWORD PTR M128_tg_1_16 \
+ __asm movdqa xmm6, xmm4 \
+ __asm pmulhw xmm4, xmm5 \
+ __asm paddsw xmm0, xmm2 \
+ __asm pmulhw xmm5, [edx+1*16] \
+ __asm paddsw xmm1, xmm3 \
+ __asm movdqa xmm7, XMMWORD PTR [edx+6*16] \
+ __asm paddsw xmm0, xmm3 \
+ __asm movdqa xmm3, XMMWORD PTR M128_tg_2_16 \
+ __asm psubsw xmm2, xmm1 \
+ __asm pmulhw xmm7, xmm3 \
+ __asm movdqa xmm1, xmm0 \
+ __asm pmulhw xmm3, [edx+2*16] \
+ __asm psubsw xmm5, xmm6 \
+ __asm paddsw xmm4, [edx+1*16] \
+ __asm paddsw xmm0, xmm4 \
+ __asm paddsw xmm0, XMMWORD PTR M128_one_corr \
+ __asm psubsw xmm4, xmm1 \
+ __asm movdqa xmm6, xmm5 \
+ __asm psubsw xmm5, xmm2 \
+ __asm paddsw xmm5, XMMWORD PTR M128_one_corr \
+ __asm paddsw xmm6, xmm2 \
+ __asm movdqa [edx+7*16], xmm0 \
+ __asm movdqa xmm1, xmm4 \
+ __asm movdqa xmm0, XMMWORD PTR M128_cos_4_16 \
+ __asm paddsw xmm4, xmm5 \
+ __asm movdqa xmm2, XMMWORD PTR M128_cos_4_16 \
+ __asm pmulhw xmm2, xmm4 \
+ __asm movdqa [edx+3*16], xmm6 \
+ __asm psubsw xmm1, xmm5 \
+ __asm paddsw xmm7, [edx+2*16] \
+ __asm psubsw xmm3, [edx+6*16] \
+ __asm movdqa xmm6, [edx] \
+ __asm pmulhw xmm0, xmm1 \
+ __asm movdqa xmm5, [edx+4*16] \
+ __asm paddsw xmm5, xmm6 \
+ __asm psubsw xmm6, [edx+4*16] \
+ __asm paddsw xmm4, xmm2 \
+ __asm por xmm4, XMMWORD PTR M128_one_corr \
+ __asm paddsw xmm0, xmm1 \
+ __asm por xmm0, XMMWORD PTR M128_one_corr \
+ __asm movdqa xmm2, xmm5 \
+ __asm paddsw xmm5, xmm7 \
+ __asm movdqa xmm1, xmm6 \
+ __asm paddsw xmm5, XMMWORD PTR M128_round_inv_col \
+ __asm psubsw xmm2, xmm7 \
+ __asm movdqa xmm7, [edx+7*16] \
+ __asm paddsw xmm6, xmm3 \
+ __asm paddsw xmm6, XMMWORD PTR M128_round_inv_col \
+ __asm paddsw xmm7, xmm5 \
+ __asm psraw xmm7, SHIFT_INV_COL \
+ __asm psubsw xmm1, xmm3 \
+ __asm paddsw xmm1, XMMWORD PTR M128_round_inv_corr \
+ __asm movdqa xmm3, xmm6 \
+ __asm paddsw xmm2, XMMWORD PTR M128_round_inv_corr \
+ __asm paddsw xmm6, xmm4 \
+ __asm movdqa [edx], xmm7 \
+ __asm psraw xmm6, SHIFT_INV_COL \
+ __asm movdqa xmm7, xmm1 \
+ __asm paddsw xmm1, xmm0 \
+ __asm movdqa [edx+1*16], xmm6 \
+ __asm psraw xmm1, SHIFT_INV_COL \
+ __asm movdqa xmm6, [edx+3*16] \
+ __asm psubsw xmm7, xmm0 \
+ __asm psraw xmm7, SHIFT_INV_COL \
+ __asm movdqa [edx+2*16], xmm1 \
+ __asm psubsw xmm5, [edx+7*16] \
+ __asm psraw xmm5, SHIFT_INV_COL \
+ __asm movdqa [edx+7*16], xmm5 \
+ __asm psubsw xmm3, xmm4 \
+ __asm paddsw xmm6, xmm2 \
+ __asm psubsw xmm2, [edx+3*16] \
+ __asm psraw xmm6, SHIFT_INV_COL \
+ __asm psraw xmm2, SHIFT_INV_COL \
+ __asm movdqa [edx+3*16], xmm6 \
+ __asm psraw xmm3, SHIFT_INV_COL \
+ __asm movdqa [edx+4*16], xmm2 \
+ __asm movdqa [edx+5*16], xmm7 \
+ __asm movdqa [edx+6*16], xmm3 \
+}
+
+//assumes src and destination are aligned on a 16-byte boundary
+
+static void idct_M128ASM(short* src)
+{
+ ASSERT(((DWORD)src & 0xf) == 0); //aligned on 16-byte boundary
+
+ __asm mov edx, src
+
+ __asm movdqa xmm0, XMMWORD PTR[edx] //row 1
+ __asm lea esi, M128_tab_i_04
+ __asm movdqa xmm4, XMMWORD PTR[edx+16*2] //row 3
+ __asm lea ecx, M128_tab_i_26
+ DCT_8_INV_ROW; //Row 1, tab_i_04 and Row 3, tab_i_26
+ __asm movdqa XMMWORD PTR[edx], xmm0
+ __asm movdqa XMMWORD PTR[edx+16*2], xmm4
+
+ __asm movdqa xmm0, XMMWORD PTR[edx+16*4] //row 5
+ //__asm lea esi, M128_tab_i_04
+ __asm movdqa xmm4, XMMWORD PTR[edx+16*6] //row 7
+ //__asm lea ecx, M128_tab_i_26
+ DCT_8_INV_ROW; //Row 5, tab_i_04 and Row 7, tab_i_26
+ __asm movdqa XMMWORD PTR[edx+16*4], xmm0
+ __asm movdqa XMMWORD PTR[edx+16*6], xmm4
+
+ __asm movdqa xmm0, XMMWORD PTR[edx+16*3] //row 4
+ __asm lea esi, M128_tab_i_35
+ __asm movdqa xmm4, XMMWORD PTR[edx+16*1] //row 2
+ __asm lea ecx, M128_tab_i_17
+ DCT_8_INV_ROW; //Row 4, tab_i_35 and Row 2, tab_i_17
+ __asm movdqa XMMWORD PTR[edx+16*3], xmm0
+ __asm movdqa XMMWORD PTR[edx+16*1], xmm4
+
+ __asm movdqa xmm0, XMMWORD PTR[edx+16*5] //row 6
+ //__asm lea esi, M128_tab_i_35
+ __asm movdqa xmm4, XMMWORD PTR[edx+16*7] //row 8
+ //__asm lea ecx, M128_tab_i_17
+ DCT_8_INV_ROW; //Row 6, tab_i_35 and Row 8, tab_i_17
+ //__asm movdqa XMMWORD PTR[edx+16*5], xmm0
+ //__asm movdqa xmm0, XMMWORD PTR [edx+16*5] /* 0 /* x5 */
+ //__asm movdqa XMMWORD PTR[edx+16*7], xmm4
+ //__asm movdqa xmm4, XMMWORD PTR [edx+7*16]/* 4 ; x7 */
+ DCT_8_INV_COL_8
+ // __asm emms
+}
+
+/////////////
+
+#define CLIP(x) (x < 0 ? 0 : x > 255 ? 255 : x)
+
+#include <xmmintrin.h>
+#include <emmintrin.h>
+
+void mpeg2_idct_copy_sse2(int16_t* block, uint8_t* dest, const int stride)
+{
+ idct_M128ASM(block);
+/*
+ for(int i = 0; i < 8; i++)
+ {
+ dest[0] = CLIP(block[0]);
+ dest[1] = CLIP(block[1]);
+ dest[2] = CLIP(block[2]);
+ dest[3] = CLIP(block[3]);
+ dest[4] = CLIP(block[4]);
+ dest[5] = CLIP(block[5]);
+ dest[6] = CLIP(block[6]);
+ dest[7] = CLIP(block[7]);
+
+ memset(block, 0, sizeof(short)*8);
+
+ dest += stride;
+ block += 8;
+ }
+*/
+ __m128i* src = (__m128i*)block;
+ __m128i zero = _mm_setzero_si128();
+
+ __m128i r0 = _mm_packus_epi16(_mm_load_si128(&src[0]), _mm_load_si128(&src[1]));
+ __m128i r1 = _mm_packus_epi16(_mm_load_si128(&src[2]), _mm_load_si128(&src[3]));
+ __m128i r2 = _mm_packus_epi16(_mm_load_si128(&src[4]), _mm_load_si128(&src[5]));
+ __m128i r3 = _mm_packus_epi16(_mm_load_si128(&src[6]), _mm_load_si128(&src[7]));
+
+ _mm_storel_pi((__m64*)&dest[0*stride], *(__m128*)&r0);
+ _mm_storeh_pi((__m64*)&dest[1*stride], *(__m128*)&r0);
+ _mm_storel_pi((__m64*)&dest[2*stride], *(__m128*)&r1);
+ _mm_storeh_pi((__m64*)&dest[3*stride], *(__m128*)&r1);
+ _mm_storel_pi((__m64*)&dest[4*stride], *(__m128*)&r2);
+ _mm_storeh_pi((__m64*)&dest[5*stride], *(__m128*)&r2);
+ _mm_storel_pi((__m64*)&dest[6*stride], *(__m128*)&r3);
+ _mm_storeh_pi((__m64*)&dest[7*stride], *(__m128*)&r3);
+
+ _mm_store_si128(&src[0], zero);
+ _mm_store_si128(&src[1], zero);
+ _mm_store_si128(&src[2], zero);
+ _mm_store_si128(&src[3], zero);
+ _mm_store_si128(&src[4], zero);
+ _mm_store_si128(&src[5], zero);
+ _mm_store_si128(&src[6], zero);
+ _mm_store_si128(&src[7], zero);
+}
+
+void mpeg2_idct_add_sse2(const int last, int16_t* block, uint8_t* dest, const int stride)
+{
+ idct_M128ASM(block);
+
+ /*
+ for(int i = 0; i < 8; i++)
+ {
+ dest[0] = CLIP(block[0] + dest[0]);
+ dest[1] = CLIP(block[1] + dest[1]);
+ dest[2] = CLIP(block[2] + dest[2]);
+ dest[3] = CLIP(block[3] + dest[3]);
+ dest[4] = CLIP(block[4] + dest[4]);
+ dest[5] = CLIP(block[5] + dest[5]);
+ dest[6] = CLIP(block[6] + dest[6]);
+ dest[7] = CLIP(block[7] + dest[7]);
+
+ memset(block, 0, sizeof(short)*8);
+
+ dest += stride;
+ block += 8;
+ }
+ */
+
+ __m128i* src = (__m128i*)block;
+ __m128i zero = _mm_setzero_si128();
+
+ __m128i r0 = _mm_load_si128(&src[0]);
+ __m128i r1 = _mm_load_si128(&src[1]);
+ __m128i r2 = _mm_load_si128(&src[2]);
+ __m128i r3 = _mm_load_si128(&src[3]);
+ __m128i r4 = _mm_load_si128(&src[4]);
+ __m128i r5 = _mm_load_si128(&src[5]);
+ __m128i r6 = _mm_load_si128(&src[6]);
+ __m128i r7 = _mm_load_si128(&src[7]);
+
+ __m128 q0 = _mm_loadl_pi(*(__m128*)&zero, (__m64*)&dest[0*stride]);
+ __m128 q1 = _mm_loadl_pi(*(__m128*)&zero, (__m64*)&dest[1*stride]);
+ __m128 q2 = _mm_loadl_pi(*(__m128*)&zero, (__m64*)&dest[2*stride]);
+ __m128 q3 = _mm_loadl_pi(*(__m128*)&zero, (__m64*)&dest[3*stride]);
+ __m128 q4 = _mm_loadl_pi(*(__m128*)&zero, (__m64*)&dest[4*stride]);
+ __m128 q5 = _mm_loadl_pi(*(__m128*)&zero, (__m64*)&dest[5*stride]);
+ __m128 q6 = _mm_loadl_pi(*(__m128*)&zero, (__m64*)&dest[6*stride]);
+ __m128 q7 = _mm_loadl_pi(*(__m128*)&zero, (__m64*)&dest[7*stride]);
+
+ r0 = _mm_adds_epi16(r0, _mm_unpacklo_epi8(*(__m128i*)&q0, zero));
+ r1 = _mm_adds_epi16(r1, _mm_unpacklo_epi8(*(__m128i*)&q1, zero));
+ r2 = _mm_adds_epi16(r2, _mm_unpacklo_epi8(*(__m128i*)&q2, zero));
+ r3 = _mm_adds_epi16(r3, _mm_unpacklo_epi8(*(__m128i*)&q3, zero));
+ r4 = _mm_adds_epi16(r4, _mm_unpacklo_epi8(*(__m128i*)&q4, zero));
+ r5 = _mm_adds_epi16(r5, _mm_unpacklo_epi8(*(__m128i*)&q5, zero));
+ r6 = _mm_adds_epi16(r6, _mm_unpacklo_epi8(*(__m128i*)&q6, zero));
+ r7 = _mm_adds_epi16(r7, _mm_unpacklo_epi8(*(__m128i*)&q7, zero));
+
+ r0 = _mm_packus_epi16(r0, r1);
+ r1 = _mm_packus_epi16(r2, r3);
+ r2 = _mm_packus_epi16(r4, r5);
+ r3 = _mm_packus_epi16(r6, r7);
+
+ _mm_storel_pi((__m64*)&dest[0*stride], *(__m128*)&r0);
+ _mm_storeh_pi((__m64*)&dest[1*stride], *(__m128*)&r0);
+ _mm_storel_pi((__m64*)&dest[2*stride], *(__m128*)&r1);
+ _mm_storeh_pi((__m64*)&dest[3*stride], *(__m128*)&r1);
+ _mm_storel_pi((__m64*)&dest[4*stride], *(__m128*)&r2);
+ _mm_storeh_pi((__m64*)&dest[5*stride], *(__m128*)&r2);
+ _mm_storel_pi((__m64*)&dest[6*stride], *(__m128*)&r3);
+ _mm_storeh_pi((__m64*)&dest[7*stride], *(__m128*)&r3);
+
+ _mm_store_si128(&src[0], zero);
+ _mm_store_si128(&src[1], zero);
+ _mm_store_si128(&src[2], zero);
+ _mm_store_si128(&src[3], zero);
+ _mm_store_si128(&src[4], zero);
+ _mm_store_si128(&src[5], zero);
+ _mm_store_si128(&src[6], zero);
+ _mm_store_si128(&src[7], zero);
+}
+
+void mpeg2_idct_init_sse2()
+{
+}
diff --git a/src/filters/transform/mpeg2decfilter/libmpeg2.cpp b/src/filters/transform/mpeg2decfilter/libmpeg2.cpp
new file mode 100644
index 000000000..239d856ad
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/libmpeg2.cpp
@@ -0,0 +1,3740 @@
+/*
+ * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ * See http://libmpeg2.sourceforge.net/ for updates.
+ *
+ * mpeg2dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * mpeg2dec 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 "stdafx.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <malloc.h>
+#include "libmpeg2.h"
+#include "..\..\..\DSUtil\vd.h"
+
+// decode
+
+#define SEQ_EXT 2
+#define SEQ_DISPLAY_EXT 4
+#define QUANT_MATRIX_EXT 8
+#define COPYRIGHT_EXT 0x10
+#define PIC_DISPLAY_EXT 0x80
+#define PIC_CODING_EXT 0x100
+
+/* default intra quant matrix, in zig-zag order */
+static const uint8_t default_intra_quantizer_matrix[64] = {
+ 8,
+ 16, 16,
+ 19, 16, 19,
+ 22, 22, 22, 22,
+ 22, 22, 26, 24, 26,
+ 27, 27, 27, 26, 26, 26,
+ 26, 27, 27, 27, 29, 29, 29,
+ 34, 34, 34, 29, 29, 29, 27, 27,
+ 29, 29, 32, 32, 34, 34, 37,
+ 38, 37, 35, 35, 34, 35,
+ 38, 38, 40, 40, 40,
+ 48, 48, 46, 46,
+ 56, 56, 58,
+ 69, 69,
+ 83
+};
+
+static uint8_t mpeg2_scan_norm_2[64] = {
+ /* Zig-Zag scan pattern */
+ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
+ 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
+ 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
+ 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
+};
+
+static uint8_t mpeg2_scan_alt_2[64] = {
+ /* Alternate scan pattern */
+ 0, 8, 16, 24, 1, 9, 2, 10, 17, 25, 32, 40, 48, 56, 57, 49,
+ 41, 33, 26, 18, 3, 11, 4, 12, 19, 27, 34, 42, 50, 58, 35, 43,
+ 51, 59, 20, 28, 5, 13, 6, 14, 21, 29, 36, 44, 52, 60, 37, 45,
+ 53, 61, 22, 30, 7, 15, 23, 31, 38, 46, 54, 62, 39, 47, 55, 63
+};
+
+// dummy
+extern "C" uint8_t mpeg2_scan_norm[64];
+extern "C" uint8_t mpeg2_scan_alt[64];
+uint8_t mpeg2_scan_norm[64];
+uint8_t mpeg2_scan_alt[64];
+
+// idct (c)
+
+#define W1 2841 /* 2048 * sqrt (2) * cos (1 * pi / 16) */
+#define W2 2676 /* 2048 * sqrt (2) * cos (2 * pi / 16) */
+#define W3 2408 /* 2048 * sqrt (2) * cos (3 * pi / 16) */
+#define W5 1609 /* 2048 * sqrt (2) * cos (5 * pi / 16) */
+#define W6 1108 /* 2048 * sqrt (2) * cos (6 * pi / 16) */
+#define W7 565 /* 2048 * sqrt (2) * cos (7 * pi / 16) */
+
+/*
+ * In legal streams, the IDCT output should be between -384 and +384.
+ * In corrupted streams, it is possible to force the IDCT output to go
+ * to +-3826 - this is the worst case for a column IDCT where the
+ * column inputs are 16-bit values.
+ */
+static uint8_t mpeg2_clip[3840 * 2 + 256];
+#define CLIP(i) ((mpeg2_clip + 3840)[i])
+
+#define BUTTERFLY(t0,t1,W0,W1,d0,d1) \
+{ \
+ int tmp = W0 * (d0 + d1); \
+ t0 = tmp + (W1 - W0) * d1; \
+ t1 = tmp - (W1 + W0) * d0; \
+}
+
+static void __inline idct_row(int16_t* block)
+{
+ int d0, d1, d2, d3;
+ int a0, a1, a2, a3, b0, b1, b2, b3;
+ int t0, t1, t2, t3;
+
+ /* shortcut */
+ if(!(block[1] | ((int32_t *)block)[1] | ((int32_t *)block)[2] | ((int32_t *)block)[3]))
+ {
+ uint32_t tmp = (uint16_t) (block[0] << 3);
+ tmp |= tmp << 16;
+ ((int32_t *)block)[0] = tmp;
+ ((int32_t *)block)[1] = tmp;
+ ((int32_t *)block)[2] = tmp;
+ ((int32_t *)block)[3] = tmp;
+ return;
+ }
+
+ d0 = (block[0] << 11) + 128;
+ d1 = block[1];
+ d2 = block[2] << 11;
+ d3 = block[3];
+ t0 = d0 + d2;
+ t1 = d0 - d2;
+ BUTTERFLY(t2, t3, W6, W2, d3, d1);
+ a0 = t0 + t2;
+ a1 = t1 + t3;
+ a2 = t1 - t3;
+ a3 = t0 - t2;
+
+ d0 = block[4];
+ d1 = block[5];
+ d2 = block[6];
+ d3 = block[7];
+ BUTTERFLY(t0, t1, W7, W1, d3, d0);
+ BUTTERFLY(t2, t3, W3, W5, d1, d2);
+ b0 = t0 + t2;
+ b3 = t1 + t3;
+ t0 -= t2;
+ t1 -= t3;
+ b1 = ((t0 + t1) * 181) >> 8;
+ b2 = ((t0 - t1) * 181) >> 8;
+
+ block[0] = (a0 + b0) >> 8;
+ block[1] = (a1 + b1) >> 8;
+ block[2] = (a2 + b2) >> 8;
+ block[3] = (a3 + b3) >> 8;
+ block[4] = (a3 - b3) >> 8;
+ block[5] = (a2 - b2) >> 8;
+ block[6] = (a1 - b1) >> 8;
+ block[7] = (a0 - b0) >> 8;
+}
+
+static void __inline idct_col(int16_t* block)
+{
+ int d0, d1, d2, d3;
+ int a0, a1, a2, a3, b0, b1, b2, b3;
+ int t0, t1, t2, t3;
+
+ d0 = (block[8*0] << 11) + 65536;
+ d1 = block[8*1];
+ d2 = block[8*2] << 11;
+ d3 = block[8*3];
+ t0 = d0 + d2;
+ t1 = d0 - d2;
+ BUTTERFLY(t2, t3, W6, W2, d3, d1);
+ a0 = t0 + t2;
+ a1 = t1 + t3;
+ a2 = t1 - t3;
+ a3 = t0 - t2;
+
+ d0 = block[8*4];
+ d1 = block[8*5];
+ d2 = block[8*6];
+ d3 = block[8*7];
+ BUTTERFLY(t0, t1, W7, W1, d3, d0);
+ BUTTERFLY(t2, t3, W3, W5, d1, d2);
+ b0 = t0 + t2;
+ b3 = t1 + t3;
+ t0 = (t0 - t2) >> 8;
+ t1 = (t1 - t3) >> 8;
+ b1 = (t0 + t1) * 181;
+ b2 = (t0 - t1) * 181;
+
+ block[8*0] = (a0 + b0) >> 17;
+ block[8*1] = (a1 + b1) >> 17;
+ block[8*2] = (a2 + b2) >> 17;
+ block[8*3] = (a3 + b3) >> 17;
+ block[8*4] = (a3 - b3) >> 17;
+ block[8*5] = (a2 - b2) >> 17;
+ block[8*6] = (a1 - b1) >> 17;
+ block[8*7] = (a0 - b0) >> 17;
+}
+
+static void mpeg2_idct_copy_c(int16_t* block, uint8_t* dest, const int stride)
+{
+ for(int i = 0; i < 8; i++) idct_row(block + 8 * i);
+ for(int i = 0; i < 8; i++) idct_col(block + i);
+ for(int i = 0; i < 8; i++)
+ {
+ dest[0] = CLIP(block[0]);
+ dest[1] = CLIP(block[1]);
+ dest[2] = CLIP(block[2]);
+ dest[3] = CLIP(block[3]);
+ dest[4] = CLIP(block[4]);
+ dest[5] = CLIP(block[5]);
+ dest[6] = CLIP(block[6]);
+ dest[7] = CLIP(block[7]);
+
+ block[0] = 0; block[1] = 0; block[2] = 0; block[3] = 0;
+ block[4] = 0; block[5] = 0; block[6] = 0; block[7] = 0;
+
+ dest += stride;
+ block += 8;
+ }
+}
+
+static void mpeg2_idct_add_c(const int last, int16_t* block, uint8_t* dest, const int stride)
+{
+ if(last != 129 || (block[0] & 7) == 4)
+ {
+ for(int i = 0; i < 8; i++) idct_row(block + 8 * i);
+ for(int i = 0; i < 8; i++) idct_col(block + i);
+ for(int i = 0; i < 8; i++)
+ {
+ dest[0] = CLIP(block[0] + dest[0]);
+ dest[1] = CLIP(block[1] + dest[1]);
+ dest[2] = CLIP(block[2] + dest[2]);
+ dest[3] = CLIP(block[3] + dest[3]);
+ dest[4] = CLIP(block[4] + dest[4]);
+ dest[5] = CLIP(block[5] + dest[5]);
+ dest[6] = CLIP(block[6] + dest[6]);
+ dest[7] = CLIP(block[7] + dest[7]);
+
+ block[0] = 0; block[1] = 0; block[2] = 0; block[3] = 0;
+ block[4] = 0; block[5] = 0; block[6] = 0; block[7] = 0;
+
+ dest += stride;
+ block += 8;
+ }
+ }
+ else
+ {
+ int DC = (block[0] + 4) >> 3;
+ block[0] = block[63] = 0;
+ for(int i = 0; i < 8; i++)
+ {
+ dest[0] = CLIP(DC + dest[0]);
+ dest[1] = CLIP(DC + dest[1]);
+ dest[2] = CLIP(DC + dest[2]);
+ dest[3] = CLIP(DC + dest[3]);
+ dest[4] = CLIP(DC + dest[4]);
+ dest[5] = CLIP(DC + dest[5]);
+ dest[6] = CLIP(DC + dest[6]);
+ dest[7] = CLIP(DC + dest[7]);
+ dest += stride;
+ }
+ }
+}
+
+static void mpeg2_idct_init_c()
+{
+ for(int i = -3840; i < 3840 + 256; i++)
+ {
+ CLIP(i) = (i < 0) ? 0 : ((i > 255) ? 255 : i);
+ }
+
+ // only needed with idct_c
+
+ for(int i = 0; i < 64; i++)
+ {
+ mpeg2_scan_norm_2[i] = ((mpeg2_scan_norm_2[i] & 0x36) >> 1) | ((mpeg2_scan_norm_2[i] & 0x09) << 2);
+ mpeg2_scan_alt_2[i] = ((mpeg2_scan_alt_2[i] & 0x36) >> 1) | ((mpeg2_scan_alt_2[i] & 0x09) << 2);
+ }
+}
+
+// mc (c)
+
+#define avg2(a,b) ((a+b+1)>>1)
+#define avg4(a,b,c,d) ((a+b+c+d+2)>>2)
+
+#define predict_o(i) (ref[i])
+#define predict_x(i) (avg2(ref[i], ref[i+1]))
+#define predict_y(i) (avg2(ref[i], (ref+stride)[i]))
+#define predict_xy(i) (avg4(ref[i], ref[i+1], (ref+stride)[i], (ref+stride)[i+1]))
+
+#define put(predictor,i) dest[i] = predictor(i)
+#define avg(predictor,i) dest[i] = avg2(predictor(i), dest[i])
+
+/* mc function template */
+
+#define MC_FUNC(op,xy) \
+static void MC_##op##_##xy##_16_c (uint8_t* dest, const uint8_t* ref, const int stride, int height) \
+{ \
+ do { \
+ op (predict_##xy, 0); \
+ op (predict_##xy, 1); \
+ op (predict_##xy, 2); \
+ op (predict_##xy, 3); \
+ op (predict_##xy, 4); \
+ op (predict_##xy, 5); \
+ op (predict_##xy, 6); \
+ op (predict_##xy, 7); \
+ op (predict_##xy, 8); \
+ op (predict_##xy, 9); \
+ op (predict_##xy, 10); \
+ op (predict_##xy, 11); \
+ op (predict_##xy, 12); \
+ op (predict_##xy, 13); \
+ op (predict_##xy, 14); \
+ op (predict_##xy, 15); \
+ ref += stride; \
+ dest += stride; \
+ } while (--height); \
+} \
+static void MC_##op##_##xy##_8_c (uint8_t * dest, const uint8_t * ref, const int stride, int height) \
+{ \
+ do { \
+ op (predict_##xy, 0); \
+ op (predict_##xy, 1); \
+ op (predict_##xy, 2); \
+ op (predict_##xy, 3); \
+ op (predict_##xy, 4); \
+ op (predict_##xy, 5); \
+ op (predict_##xy, 6); \
+ op (predict_##xy, 7); \
+ ref += stride; \
+ dest += stride; \
+ } while (--height); \
+}
+
+/* definitions of the actual mc functions */
+
+MC_FUNC(put,o)
+MC_FUNC(avg,o)
+MC_FUNC(put,x)
+MC_FUNC(avg,x)
+MC_FUNC(put,y)
+MC_FUNC(avg,y)
+MC_FUNC(put,xy)
+MC_FUNC(avg,xy)
+
+#define MPEG2_MC_EXTERN(x) mpeg2_mc_t mpeg2_mc_##x = { \
+ {MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \
+ MC_put_o_8_##x, MC_put_x_8_##x, MC_put_y_8_##x, MC_put_xy_8_##x}, \
+ {MC_avg_o_16_##x, MC_avg_x_16_##x, MC_avg_y_16_##x, MC_avg_xy_16_##x, \
+ MC_avg_o_8_##x, MC_avg_x_8_##x, MC_avg_y_8_##x, MC_avg_xy_8_##x} \
+};
+
+MPEG2_MC_EXTERN(c)
+
+// idct (mmx)
+
+extern "C" void mpeg2_idct_copy_mmx(int16_t* block, uint8_t* dest, const int stride);
+extern "C" void mpeg2_idct_add_mmx(const int last, int16_t* block, uint8_t* dest, const int stride);
+
+static void mpeg2_idct_init_mmx()
+{
+ for(int i = 0; i < 64; i++)
+ {
+ mpeg2_scan_norm_2[i] = (mpeg2_scan_norm_2[i] & 0x38) | ((mpeg2_scan_norm_2[i] & 6) >> 1) | ((mpeg2_scan_norm_2[i] & 1) << 2);
+ mpeg2_scan_alt_2[i] = (mpeg2_scan_alt_2[i] & 0x38) | ((mpeg2_scan_alt_2[i] & 6) >> 1) | ((mpeg2_scan_alt_2[i] & 1) << 2);
+ }
+}
+
+// mc (mmx)
+
+extern "C" mpeg2_mc_t mpeg2_mc_mmx;
+
+// idct (sse2)
+
+extern void mpeg2_idct_init_sse2();
+extern void mpeg2_idct_copy_sse2(int16_t* block, uint8_t* dest, const int stride);
+extern void mpeg2_idct_add_sse2(const int last, int16_t* block, uint8_t* dest, const int stride);
+
+// mc (sse2)
+
+extern mpeg2_mc_t mpeg2_mc_sse2;
+
+// idct (null)
+
+static void mpeg2_idct_init_null() {}
+static void mpeg2_idct_copy_null(int16_t* block, uint8_t* dest, const int stride) {}
+static void mpeg2_idct_add_null(const int last, int16_t* block, uint8_t* dest, const int stride) {}
+
+// mc (null)
+
+static void MC_null(uint8_t* dest, const uint8_t* ref, const int stride, int height) {}
+
+mpeg2_mc_t mpeg2_mc_null =
+{
+ {MC_null, MC_null, MC_null, MC_null, MC_null, MC_null, MC_null, MC_null},
+ {MC_null, MC_null, MC_null, MC_null, MC_null, MC_null, MC_null, MC_null}
+};
+
+//
+
+CMpeg2Dec::CMpeg2Dec()
+{
+ m_shift = 0;
+ m_is_display_initialized = 0;
+ m_action = NULL;
+ m_state = STATE_BUFFER;
+ m_ext_state = 0;
+
+ m_chunk_buffer = m_chunk_start = m_chunk_ptr = NULL;
+ m_code = 0;
+
+ m_pts_current = m_pts_previous = 0;
+ m_num_pts = m_bytes_since_pts = 0;
+
+ m_first = 0;
+ m_alloc_index = 0;
+ m_first_decode_slice = m_nb_decode_slices = 0;
+
+ memset(&m_new_sequence, 0, sizeof(m_new_sequence));
+ memset(&m_sequence, 0, sizeof(m_sequence));
+ memset(&m_gop, 0, sizeof(m_gop));
+ memset(&m_pictures, 0, sizeof(m_pictures));
+ m_picture = NULL;
+ memset(&m_fbuf, 0, sizeof(m_fbuf));
+ memset(&m_fbuf_alloc, 0, sizeof(m_fbuf_alloc));
+
+ m_buf_start = m_buf_end = NULL;
+
+ m_display_offset_x = m_display_offset_y = 0;
+
+ m_copy_matrix = 0;
+ memset(&m_intra_quantizer_matrix, 0, sizeof(m_intra_quantizer_matrix));
+ memset(&m_non_intra_quantizer_matrix, 0, sizeof(m_non_intra_quantizer_matrix));
+
+ //
+
+ mpeg2_init();
+}
+
+CMpeg2Dec::~CMpeg2Dec()
+{
+ mpeg2_close();
+}
+
+void CMpeg2Dec::mpeg2_init()
+{
+ m_chunk_buffer = (uint8_t*)_aligned_malloc(BUFFER_SIZE + 4, 16);
+ m_shift = 0xffffff00;
+ m_code = 0xb4;
+ m_action = &CMpeg2Dec::mpeg2_seek_sequence;
+ m_sequence.width = (unsigned)-1;
+}
+
+void CMpeg2Dec::mpeg2_close()
+{
+ /* static uint8_t finalizer[] = {0,0,1,0xb4}; */
+ /* mpeg2_decode_data (mpeg2dec, finalizer, finalizer+4); */
+
+ mpeg2_header_state_init();
+ _aligned_free(m_chunk_buffer);
+}
+
+//
+
+int CMpeg2Dec::skip_chunk(int bytes)
+{
+ if(!bytes)
+ return 0;
+
+ int len = 0;
+
+ uint8_t* current = m_buf_start;
+ uint8_t* limit = current + bytes;
+
+ while(current < limit)
+ {
+ if(m_shift == 0x00000100)
+ {
+ m_shift = 0xffffff00;
+ len = ++current - m_buf_start;
+ break;
+ }
+
+ m_shift = (m_shift | *current++) << 8;
+ }
+
+ m_buf_start = current;
+
+ return len;
+}
+
+int CMpeg2Dec::copy_chunk(int bytes)
+{
+ if(!bytes)
+ return 0;
+
+ int len = 0;
+
+ // this assembly gives us a nice speed up
+ // 36 sec down to 32 sec decoding the ts.stream.tpr test file
+ // (idtc, mc was set to null)
+
+ __asm
+ {
+ mov ebx, this
+ mov esi, [ebx].m_buf_start
+ mov edi, [ebx].m_chunk_ptr
+ mov ecx, bytes
+ mov edx, [ebx].m_shift
+
+ copy_chunk_loop:
+
+ cmp edx, 0x00000100
+ jne copy_chunk_continue
+ mov edx, 0xffffff00
+
+ inc edi
+ mov [ebx].m_chunk_ptr, edi
+
+ inc esi
+ mov eax, esi
+ sub eax, [ebx].m_buf_start
+ mov len, eax
+
+ jmp copy_chunk_end
+
+ copy_chunk_continue:
+
+ movzx eax, byte ptr [esi]
+ or edx, eax
+ shl edx, 8
+ mov byte ptr [edi], al
+ inc esi
+ inc edi
+ dec ecx
+ jnz copy_chunk_loop
+
+ copy_chunk_end:
+
+ mov [ebx].m_buf_start, esi
+ mov [ebx].m_shift, edx
+ }
+/*
+ uint8_t* chunk_ptr = m_chunk_ptr;
+ uint8_t* current = m_buf_start;
+ uint8_t* limit = current + bytes;
+
+ while(current < limit)
+ {
+ if(m_shift == 0x00000100)
+ {
+ m_shift = 0xffffff00;
+ len = ++current - m_buf_start;
+ m_chunk_ptr = ++chunk_ptr;
+ break;
+ }
+
+ m_shift = (m_shift | (*chunk_ptr++ = *current++)) << 8;
+ }
+
+ m_buf_start = current;
+*/
+ return len;
+}
+
+mpeg2_state_t CMpeg2Dec::seek_chunk()
+{
+ int size = m_buf_end - m_buf_start;
+
+ if(int skipped = skip_chunk(size))
+ {
+ m_bytes_since_pts += skipped;
+ m_code = m_buf_start[-1];
+ return (mpeg2_state_t)-1;
+ }
+
+ m_bytes_since_pts += size;
+ return STATE_BUFFER;
+}
+
+mpeg2_state_t CMpeg2Dec::seek_header()
+{
+ while(m_code != 0xb3 && (m_code != 0xb7 && m_code != 0xb8 && m_code || m_sequence.width == (unsigned)-1))
+ {
+ if(seek_chunk() == STATE_BUFFER)
+ return STATE_BUFFER;
+ }
+
+ m_chunk_start = m_chunk_ptr = m_chunk_buffer;
+
+ return m_code
+ ? mpeg2_parse_header()
+ : mpeg2_header_picture_start();
+}
+
+mpeg2_state_t CMpeg2Dec::seek_sequence()
+{
+ mpeg2_header_state_init();
+ m_action = &CMpeg2Dec::seek_header;
+ return seek_header();
+}
+
+//
+
+void CMpeg2Dec::mpeg2_buffer(uint8_t* start, uint8_t* end)
+{
+ m_buf_start = start;
+ m_buf_end = end;
+}
+
+int CMpeg2Dec::mpeg2_getpos()
+{
+ return m_buf_end - m_buf_start;
+}
+
+//
+
+mpeg2_state_t CMpeg2Dec::mpeg2_parse()
+{
+ if(m_action)
+ {
+ mpeg2_state_t state = (this->*m_action)();
+ if((int)state >= 0)
+ return state;
+ }
+
+ while(1)
+ {
+ while((unsigned)(m_code - m_first_decode_slice) < m_nb_decode_slices)
+ {
+ int size_buffer = m_buf_end - m_buf_start;
+ int size_chunk = (m_chunk_buffer + BUFFER_SIZE - m_chunk_ptr);
+ int copied;
+
+ if(size_buffer <= size_chunk)
+ {
+ copied = copy_chunk(size_buffer);
+ if(!copied)
+ {
+ m_bytes_since_pts += size_buffer;
+ m_chunk_ptr += size_buffer;
+ return STATE_BUFFER;
+ }
+ }
+ else
+ {
+ copied = copy_chunk(size_chunk);
+ if(!copied)
+ {
+ /* filled the chunk buffer without finding a start code */
+ m_bytes_since_pts += size_chunk;
+ m_action = &CMpeg2Dec::seek_chunk;
+ return STATE_INVALID;
+ }
+ }
+
+ m_bytes_since_pts += copied;
+
+ m_decoder.mpeg2_slice(m_code, m_chunk_start);
+ m_code = m_buf_start[-1];
+ m_chunk_ptr = m_chunk_start;
+ }
+
+ if((unsigned)(m_code - 1) >= 0xb0 - 1)
+ break;
+ if(seek_chunk() == STATE_BUFFER)
+ return STATE_BUFFER;
+ }
+
+ switch(m_code)
+ {
+ case 0x00:
+ m_action = &CMpeg2Dec::mpeg2_header_picture_start;
+ return m_state;
+ case 0xb7:
+ m_action = &CMpeg2Dec::mpeg2_header_end;
+ break;
+ case 0xb3:
+ case 0xb8:
+ m_action = &CMpeg2Dec::mpeg2_parse_header;
+ break;
+ case 0xbe:
+ m_action = &CMpeg2Dec::seek_chunk;
+ return STATE_PADDING;
+ default:
+ m_action = &CMpeg2Dec::seek_chunk;
+ return STATE_INVALID;
+ }
+
+ if(m_state != STATE_SLICE)
+ m_state = STATE_INVALID;
+
+ return m_state;
+}
+
+
+void CMpeg2Dec::mpeg2_skip(int skip)
+{
+ m_first_decode_slice = 1;
+ m_nb_decode_slices = skip ? 0 : (0xb0 - 1);
+}
+
+void CMpeg2Dec::mpeg2_slice_region(int start, int end)
+{
+ start = (start < 1) ? 1 : (start > 0xb0) ? 0xb0 : start;
+ end = (end < start) ? start : (end > 0xb0) ? 0xb0 : end;
+ m_first_decode_slice = start;
+ m_nb_decode_slices = end - start;
+}
+
+void CMpeg2Dec::mpeg2_pts(uint32_t pts)
+{
+ m_pts_previous = m_pts_current;
+ m_pts_current = pts;
+ m_num_pts++;
+ m_bytes_since_pts = 0;
+}
+
+//
+
+/* decode.c */
+
+#define RECEIVED(code,state) (((state) << 8) + (code))
+
+mpeg2_state_t CMpeg2Dec::mpeg2_seek_sequence()
+{
+ mpeg2_header_state_init();
+ m_action = &CMpeg2Dec::seek_header;
+ return seek_header();
+}
+
+mpeg2_state_t CMpeg2Dec::mpeg2_parse_header()
+{
+ static int (CMpeg2Dec::* process_header[]) () =
+ {
+ &CMpeg2Dec::mpeg2_header_picture,
+ &CMpeg2Dec::mpeg2_header_extension,
+ &CMpeg2Dec::mpeg2_header_user_data,
+ &CMpeg2Dec::mpeg2_header_sequence,
+ NULL, NULL, NULL, NULL,
+ &CMpeg2Dec::mpeg2_header_gop
+ };
+
+ m_action = &CMpeg2Dec::mpeg2_parse_header;
+
+ while(1)
+ {
+ int size_buffer = m_buf_end - m_buf_start;
+ int size_chunk = (m_chunk_buffer + BUFFER_SIZE - m_chunk_ptr);
+ int copied;
+ if(size_buffer <= size_chunk)
+ {
+ copied = copy_chunk(size_buffer);
+ if(!copied)
+ {
+ m_bytes_since_pts += size_buffer;
+ m_chunk_ptr += size_buffer;
+ return STATE_BUFFER;
+ }
+ }
+ else
+ {
+ copied = copy_chunk(size_chunk);
+ if(!copied)
+ {
+ /* filled the chunk buffer without finding a start code */
+ m_bytes_since_pts += size_chunk;
+ m_code = 0xb4;
+ m_action = &CMpeg2Dec::seek_header;
+ return STATE_INVALID;
+ }
+ }
+ m_bytes_since_pts += copied;
+
+ if((this->*(process_header[m_code & 0x0b]))())
+ {
+ m_code = m_buf_start[-1];
+ m_action = &CMpeg2Dec::seek_header;
+ return STATE_INVALID;
+ }
+
+ m_code = m_buf_start[-1];
+
+ switch(RECEIVED(m_code, m_state))
+ {
+ /* state transition after a sequence header */
+ case RECEIVED(0x00, STATE_SEQUENCE):
+ m_action = &CMpeg2Dec::mpeg2_header_picture_start;
+ case RECEIVED(0xb8, STATE_SEQUENCE):
+ mpeg2_header_sequence_finalize();
+ break;
+
+ /* other legal state transitions */
+ case RECEIVED (0x00, STATE_GOP):
+ m_action = &CMpeg2Dec::mpeg2_header_picture_start;
+ break;
+ case RECEIVED (0x01, STATE_PICTURE):
+ case RECEIVED (0x01, STATE_PICTURE_2ND):
+ mpeg2_header_matrix_finalize();
+ m_action = &CMpeg2Dec::mpeg2_header_slice_start;
+ break;
+
+ /* legal headers within a given state */
+ case RECEIVED (0xb2, STATE_SEQUENCE):
+ case RECEIVED (0xb2, STATE_GOP):
+ case RECEIVED (0xb2, STATE_PICTURE):
+ case RECEIVED (0xb2, STATE_PICTURE_2ND):
+ case RECEIVED (0xb5, STATE_SEQUENCE):
+ case RECEIVED (0xb5, STATE_PICTURE):
+ case RECEIVED (0xb5, STATE_PICTURE_2ND):
+ m_chunk_ptr = m_chunk_start;
+ continue;
+
+ default:
+ m_action = &CMpeg2Dec::seek_header;
+ return STATE_INVALID;
+ }
+
+ m_chunk_start = m_chunk_ptr = m_chunk_buffer;
+ return m_state;
+ }
+}
+
+/* header.c */
+
+void CMpeg2Dec::mpeg2_header_state_init()
+{
+ if(m_sequence.width != (unsigned)-1)
+ {
+ m_sequence.width = (unsigned)-1;
+ for(int i = 0; i < m_alloc_index; i++)
+ _aligned_free(m_fbuf_alloc[i].buf[0]);
+ }
+
+ m_decoder.m_scan = mpeg2_scan_norm_2;
+ m_picture = m_pictures;
+ m_fbuf[0] = &m_fbuf_alloc[0];
+ m_fbuf[1] = &m_fbuf_alloc[1];
+ m_fbuf[2] = &m_fbuf_alloc[2];
+ m_first = true;
+ m_alloc_index = 0;
+ m_first_decode_slice = 1;
+ m_nb_decode_slices = 0xb0 - 1;
+}
+
+int CMpeg2Dec::mpeg2_header_sequence()
+{
+ uint8_t* buffer = m_chunk_start;
+ mpeg2_sequence_t* sequence = &m_new_sequence;
+ static unsigned int frame_period[9] = {0, 1126125, 1125000, 1080000, 900900, 900000, 540000, 450450, 450000};
+
+ if((buffer[6] & 0x20) != 0x20) /* missing marker_bit */
+ return 1;
+
+ int i = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2];
+ if(!(sequence->display_width = sequence->picture_width = i >> 12))
+ return 1;
+ if(!(sequence->display_height = sequence->picture_height = i & 0xfff))
+ return 1;
+
+ sequence->width = (sequence->picture_width + 15) & ~15;
+ sequence->height = (sequence->picture_height + 15) & ~15;
+ sequence->chroma_width = sequence->width >> 1;
+ sequence->chroma_height = sequence->height >> 1;
+ sequence->flags = (SEQ_FLAG_PROGRESSIVE_SEQUENCE | SEQ_VIDEO_FORMAT_UNSPECIFIED);
+ sequence->pixel_width = buffer[3] >> 4; /* aspect ratio */
+ sequence->frame_period = 0;
+ if((buffer[3] & 15) < 9) sequence->frame_period = frame_period[buffer[3] & 15];
+ sequence->byte_rate = (buffer[4]<<10) | (buffer[5]<<2) | (buffer[6]>>6);
+ sequence->vbv_buffer_size = ((buffer[6]<<16)|(buffer[7]<<8))&0x1ff800;
+ if(buffer[7] & 4) sequence->flags |= SEQ_FLAG_CONSTRAINED_PARAMETERS;
+
+ m_copy_matrix = 3;
+ if(buffer[7] & 2)
+ {
+ for(i = 0; i < 64; i++)
+ m_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = (buffer[i+7] << 7) | (buffer[i+8] >> 1);
+ buffer += 64;
+ }
+ else
+ {
+ for (i = 0; i < 64; i++)
+ m_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = default_intra_quantizer_matrix[i];
+ }
+
+ if(buffer[7] & 1)
+ {
+ for(i = 0; i < 64; i++)
+ m_non_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = buffer[i+8];
+ }
+ else
+ {
+ for(i = 0; i < 64; i++)
+ m_non_intra_quantizer_matrix[i] = 16;
+ }
+
+ sequence->profile_level_id = 0x80;
+ sequence->colour_primaries = 0;
+ sequence->transfer_characteristics = 0;
+ sequence->matrix_coefficients = 0;
+
+ m_ext_state = SEQ_EXT;
+ m_state = STATE_SEQUENCE;
+ m_display_offset_x = m_display_offset_y = 0;
+
+ m_info.Reset();
+ m_info.m_gop = NULL;
+
+ return 0;
+}
+
+int CMpeg2Dec::mpeg2_header_gop()
+{
+ uint8_t* buffer = m_chunk_start;
+ m_info.Reset();
+ if(!(buffer[1] & 8))
+ return 1;
+ m_info.m_gop = &m_gop;
+ m_gop.hours = (buffer[0] >> 2) & 31;
+ m_gop.minutes = ((buffer[0] << 4) | (buffer[1] >> 4)) & 63;
+ m_gop.seconds = ((buffer[1] << 3) | (buffer[2] >> 5)) & 63;
+ m_gop.pictures = ((buffer[2] << 1) | (buffer[3] >> 7)) & 63;
+ m_gop.flags = (buffer[0] >> 7) | ((buffer[3] >> 4) & 6);
+ m_state = STATE_GOP;
+ return 0;
+}
+
+mpeg2_state_t CMpeg2Dec::mpeg2_header_picture_start()
+{
+ {
+ mpeg2_picture_t* picture;
+
+ if(m_state != STATE_SLICE_1ST)
+ {
+ m_state = STATE_PICTURE;
+ picture = m_pictures;
+ if((m_decoder.m_coding_type != PIC_FLAG_CODING_TYPE_B) ^ (m_picture >= m_pictures + 2))
+ picture += 2;
+ }
+ else
+ {
+ m_state = STATE_PICTURE_2ND;
+ picture = m_picture + 1; /* second field picture */
+ }
+
+ m_picture = picture;
+ }
+
+ m_picture->flags = 0;
+
+ if(m_num_pts)
+ {
+ if(m_bytes_since_pts >= 4)
+ {
+ m_num_pts = 0;
+ m_picture->pts = m_pts_current;
+ m_picture->flags = PIC_FLAG_PTS;
+ }
+ else if(m_num_pts > 1)
+ {
+ m_num_pts = 1;
+ m_picture->pts = m_pts_previous;
+ m_picture->flags = PIC_FLAG_PTS;
+ }
+ }
+
+ m_picture->display_offset[0].x =
+ m_picture->display_offset[1].x =
+ m_picture->display_offset[2].x = m_display_offset_x;
+ m_picture->display_offset[0].y =
+ m_picture->display_offset[1].y =
+ m_picture->display_offset[2].y = m_display_offset_y;
+
+ return mpeg2_parse_header();
+}
+
+int CMpeg2Dec::mpeg2_header_picture()
+{
+ uint8_t* buffer = m_chunk_start;
+ mpeg2_picture_t* picture = m_picture;
+ int type;
+ int low_delay;
+
+ type = (buffer [1] >> 3) & 7;
+ low_delay = m_sequence.flags & SEQ_FLAG_LOW_DELAY;
+
+ if(m_state == STATE_PICTURE)
+ {
+ mpeg2_picture_t* other;
+
+ m_decoder.m_second_field = 0;
+ other = m_pictures;
+ if(other == picture)
+ other += 2;
+ if(m_decoder.m_coding_type != PIC_FLAG_CODING_TYPE_B)
+ {
+ m_fbuf[2] = m_fbuf[1];
+ m_fbuf[1] = m_fbuf[0];
+ }
+ m_fbuf[0] = NULL;
+ m_info.Reset();
+ m_info.m_current_picture = picture;
+ m_info.m_display_picture = picture;
+ if(type != PIC_FLAG_CODING_TYPE_B)
+ {
+ if(!low_delay)
+ {
+ if(m_first) {
+ m_info.m_display_picture = NULL;
+ m_first = false;
+ }
+ else
+ {
+ m_info.m_display_picture = other;
+ if(other->nb_fields == 1)
+ m_info.m_display_picture_2nd = other + 1;
+ m_info.m_display_fbuf = m_fbuf[1];
+ }
+ }
+
+ if(!low_delay + !NULL/*m_convert_start*/)
+ m_info.m_discard_fbuf = m_fbuf[!low_delay + !NULL/*m_convert_start*/];
+ }
+
+ while(m_alloc_index < 3)
+ {
+ mpeg2_fbuf_t* fbuf = &m_fbuf_alloc[m_alloc_index++];
+ fbuf->id = NULL;
+
+ int size = m_decoder.m_width * m_decoder.m_height;
+ fbuf->buf[0] = (uint8_t*)_aligned_malloc(6 * size >> 2, 16);
+ fbuf->buf[1] = fbuf->buf[0] + size;
+ fbuf->buf[2] = fbuf->buf[1] + (size >> 2);
+ memset(fbuf->buf[0], 0x10, size);
+ memset(fbuf->buf[1], 0x80, size >> 2);
+ memset(fbuf->buf[2], 0x80, size >> 2);
+ }
+ mpeg2_set_fbuf(type);
+ }
+ else
+ {
+ m_decoder.m_second_field = 1;
+ m_info.m_current_picture_2nd = picture;
+ m_info.m_user_data = NULL; m_info.m_user_data_len = 0;
+ if(low_delay || type == PIC_FLAG_CODING_TYPE_B)
+ m_info.m_display_picture_2nd = picture;
+ }
+ m_ext_state = PIC_CODING_EXT;
+
+ picture->temporal_reference = (buffer[0] << 2) | (buffer[1] >> 6);
+
+ m_decoder.m_coding_type = type;
+ picture->flags |= type;
+
+ if(type == PIC_FLAG_CODING_TYPE_P || type == PIC_FLAG_CODING_TYPE_B)
+ {
+ /* forward_f_code and backward_f_code - used in mpeg1 only */
+ m_decoder.m_f_motion.f_code[1] = (buffer[3] >> 2) & 1;
+ m_decoder.m_f_motion.f_code[0] = (((buffer[3] << 1) | (buffer[4] >> 7)) & 7) - 1;
+ m_decoder.m_b_motion.f_code[1] = (buffer[4] >> 6) & 1;
+ m_decoder.m_b_motion.f_code[0] = ((buffer[4] >> 3) & 7) - 1;
+ }
+
+ /* XXXXXX decode extra_information_picture as well */
+
+ picture->nb_fields = 2;
+
+ m_decoder.m_intra_dc_precision = 0;
+ m_decoder.m_frame_pred_frame_dct = 1;
+ m_decoder.m_q_scale_type = 0;
+ m_decoder.m_concealment_motion_vectors = 0;
+ m_decoder.m_scan = mpeg2_scan_norm_2;
+ m_decoder.m_picture_structure = FRAME_PICTURE;
+ m_copy_matrix = 0;
+
+ return 0;
+}
+
+int CMpeg2Dec::mpeg2_header_extension()
+{
+ static int (CMpeg2Dec::* parser[]) () =
+ {
+ NULL,
+ &CMpeg2Dec::sequence_ext,
+ &CMpeg2Dec::sequence_display_ext,
+ &CMpeg2Dec::quant_matrix_ext,
+ &CMpeg2Dec::copyright_ext,
+ NULL, NULL,
+ &CMpeg2Dec::picture_display_ext,
+ &CMpeg2Dec::picture_coding_ext
+ };
+
+ int ext, ext_bit;
+
+ ext = m_chunk_start[0] >> 4;
+ ext_bit = 1 << ext;
+
+ if(!(m_ext_state & ext_bit)) /* ignore illegal extensions */
+ return 0;
+ m_ext_state &= ~ext_bit;
+ return (this->*parser[ext])();
+}
+
+int CMpeg2Dec::mpeg2_header_user_data()
+{
+ if(!m_info.m_user_data_len) m_info.m_user_data = m_chunk_start;
+ else m_info.m_user_data_len += 3;
+
+ m_info.m_user_data_len += (m_chunk_ptr - 4 - m_chunk_start);
+ m_chunk_start = m_chunk_ptr - 1;
+
+ return 0;
+}
+
+void CMpeg2Dec::mpeg2_header_matrix_finalize()
+{
+ if(m_copy_matrix & 1)
+ memcpy(m_decoder.m_intra_quantizer_matrix, m_intra_quantizer_matrix, 64);
+
+ if(m_copy_matrix & 2)
+ memcpy(m_decoder.m_non_intra_quantizer_matrix, m_non_intra_quantizer_matrix, 64);
+}
+
+void mpeg2_sequence_t::finalize()
+{
+ int w, h;
+
+ byte_rate *= 50;
+
+ if(flags & SEQ_FLAG_MPEG2)
+ {
+ switch(pixel_width)
+ {
+ case 1: /* square pixels */
+ pixel_width = pixel_height = 1; return;
+ case 2: /* 4:3 aspect ratio */
+ w = 4; h = 3; break;
+ case 3: /* 16:9 aspect ratio */
+ w = 16; h = 9; break;
+ case 4: /* 2.21:1 aspect ratio */
+ w = 221; h = 100; break;
+ default: /* illegal */
+ pixel_width = pixel_height = 0; return;
+ }
+
+ w *= display_height;
+ h *= display_width;
+ }
+ else
+ {
+ if(byte_rate == 50 * 0x3ffff)
+ byte_rate = 0; /* mpeg-1 VBR */
+
+ switch(pixel_width)
+ {
+ case 0: case 15: /* illegal */
+ pixel_width = pixel_height = 0; return;
+ case 1: /* square pixels */
+ pixel_width = pixel_height = 1; return;
+ case 3: /* 720x576 16:9 */
+ pixel_width = 64; pixel_height = 45; return;
+ case 6: /* 720x480 16:9 */
+ pixel_width = 32; pixel_height = 27; return;
+ case 12: /* 720*480 4:3 */
+ pixel_width = 8; pixel_height = 9; return;
+ default:
+ h = 88 * pixel_width + 1171;
+ w = 2000;
+ }
+ }
+
+ pixel_width = w;
+ pixel_height = h;
+
+ /* find greatest common divisor */
+ while(w) {int tmp = w; w = h % tmp; h = tmp;}
+
+ pixel_width /= h;
+ pixel_height /= h;
+}
+
+void CMpeg2Dec::mpeg2_header_sequence_finalize()
+{
+ mpeg2_sequence_t* sequence = &m_new_sequence;
+
+ sequence->finalize();
+
+ mpeg2_header_matrix_finalize();
+
+ m_decoder.m_mpeg1 = !(sequence->flags & SEQ_FLAG_MPEG2);
+ m_decoder.m_width = sequence->width;
+ m_decoder.m_height = sequence->height;
+ m_decoder.m_vertical_position_extension = (sequence->picture_height > 2800);
+
+ /*
+ * according to 6.1.1.6, repeat sequence headers should be
+ * identical to the original. However some DVDs dont respect that
+ * and have different bitrates in the repeat sequence headers. So
+ * we'll ignore that in the comparison and still consider these as
+ * repeat sequence headers.
+ */
+
+ // EDIT: some dvds will work if we allow the last three fields to vary (which aren't needed anyway)
+
+ m_sequence.byte_rate = sequence->byte_rate;
+ if(!memcmp(&m_sequence, sequence, FIELD_OFFSET(mpeg2_sequence_t, colour_primaries) /*sizeof(mpeg2_sequence_t)*/))
+ {
+ m_state = STATE_SEQUENCE_REPEATED;
+ }
+ else if(m_sequence.width != (unsigned)-1)
+ {
+ m_action = &CMpeg2Dec::mpeg2_seek_sequence;
+ m_state = STATE_INVALID; /* XXXX STATE_INVALID_END ? */
+ return;
+ }
+ m_sequence = *sequence;
+
+ m_info.m_sequence = &m_sequence;
+}
+
+mpeg2_state_t CMpeg2Dec::mpeg2_header_slice_start()
+{
+ m_info.m_user_data = NULL;
+ m_info.m_user_data_len = 0;
+ m_state = (m_picture->nb_fields > 1 || m_state == STATE_PICTURE_2ND) ? STATE_SLICE : STATE_SLICE_1ST;
+
+ if(!m_nb_decode_slices)
+ {
+ m_picture->flags |= PIC_FLAG_SKIP;
+ }
+ else
+ {
+ int b_type = m_decoder.m_coding_type == B_TYPE;
+ m_decoder.mpeg2_init_fbuf(m_fbuf[0]->buf, m_fbuf[b_type + 1]->buf, m_fbuf[b_type]->buf);
+ }
+
+ m_action = NULL;
+
+ return (mpeg2_state_t)-1;
+}
+
+mpeg2_state_t CMpeg2Dec::mpeg2_header_end()
+{
+ mpeg2_picture_t* picture = m_pictures;
+
+ int b_type = m_decoder.m_coding_type == B_TYPE;
+
+ if((m_picture >= picture + 2) ^ b_type)
+ picture = m_pictures + 2;
+
+ m_state = STATE_END;
+ m_info.Reset();
+
+ if(!(m_sequence.flags & SEQ_FLAG_LOW_DELAY))
+ {
+ m_info.m_display_picture = picture;
+ if(picture->nb_fields == 1)
+ m_info.m_display_picture_2nd = picture + 1;
+ m_info.m_display_fbuf = m_fbuf[b_type];
+ m_info.m_discard_fbuf = m_fbuf[b_type + 1];
+ }
+ else
+ {
+ m_info.m_discard_fbuf = m_fbuf[b_type];
+ }
+
+ m_action = &CMpeg2Dec::mpeg2_seek_sequence;
+ m_first = true;
+
+ return STATE_END;
+}
+
+void CMpeg2Dec::mpeg2_set_fbuf(int coding_type)
+{
+ for(int i = 0; i < 3; i++)
+ {
+ if(m_fbuf[1] != &m_fbuf_alloc[i] && m_fbuf[2] != &m_fbuf_alloc[i])
+ {
+ m_fbuf[0] = &m_fbuf_alloc[i];
+ m_info.m_current_fbuf = m_fbuf[0];
+ if(coding_type == B_TYPE || (m_sequence.flags & SEQ_FLAG_LOW_DELAY))
+ {
+ if(coding_type == B_TYPE)
+ m_info.m_discard_fbuf = m_fbuf[0];
+ m_info.m_display_fbuf = m_fbuf[0];
+ }
+ break;
+ }
+ }
+}
+
+//
+
+int CMpeg2Dec::sequence_ext()
+{
+ uint8_t* buffer = m_chunk_start;
+ mpeg2_sequence_t* sequence = &m_new_sequence;
+
+ if(!(buffer[3]&1))
+ return 1;
+
+ sequence->profile_level_id = (buffer[0] << 4) | (buffer[1] >> 4);
+
+ sequence->display_width =
+ sequence->picture_width += ((buffer[1] << 13) | (buffer[2] << 5)) & 0x3000;
+ sequence->display_height =
+ sequence->picture_height += (buffer[2] << 7) & 0x3000;
+
+ sequence->width = (sequence->picture_width + 15) & ~15;
+ sequence->height = (sequence->picture_height + 15) & ~15;
+
+ sequence->flags |= SEQ_FLAG_MPEG2;
+
+ if(!(buffer[1] & 8))
+ {
+ sequence->flags &= ~SEQ_FLAG_PROGRESSIVE_SEQUENCE;
+ sequence->height = (sequence->height + 31) & ~31;
+ }
+
+ if(buffer[5] & 0x80)
+ {
+ sequence->flags |= SEQ_FLAG_LOW_DELAY;
+ }
+
+ sequence->chroma_width = sequence->width;
+ sequence->chroma_height = sequence->height;
+
+ switch(buffer[1] & 6)
+ {
+ case 0: /* invalid */
+ return 1;
+ case 2: /* 4:2:0 */
+ sequence->chroma_height >>= 1;
+ case 4: /* 4:2:2 */
+ sequence->chroma_width >>= 1;
+ }
+
+ sequence->byte_rate += ((buffer[2]<<25) | (buffer[3]<<17)) & 0x3ffc0000;
+
+ sequence->vbv_buffer_size |= buffer[4] << 21;
+
+ sequence->frame_period =
+ sequence->frame_period * ((buffer[5]&31)+1) / (((buffer[5]>>2)&3)+1);
+
+ m_ext_state = SEQ_DISPLAY_EXT;
+
+ return 0;
+}
+
+int CMpeg2Dec::sequence_display_ext()
+{
+ uint8_t* buffer = m_chunk_start;
+ mpeg2_sequence_t* sequence = &m_new_sequence;
+
+ uint32_t flags = (sequence->flags & ~SEQ_MASK_VIDEO_FORMAT) | ((buffer[0]<<4) & SEQ_MASK_VIDEO_FORMAT);
+ if(buffer[0] & 1)
+ {
+ flags |= SEQ_FLAG_COLOUR_DESCRIPTION;
+ sequence->colour_primaries = buffer[1];
+ sequence->transfer_characteristics = buffer[2];
+ sequence->matrix_coefficients = buffer[3];
+ buffer += 3;
+ }
+
+ if(!(buffer[2] & 2)) /* missing marker_bit */
+ return 1;
+
+ // ???
+// sequence->flags = flags;
+
+ sequence->display_width = (buffer[1] << 6) | (buffer[2] >> 2);
+ sequence->display_height = ((buffer[2]& 1 ) << 13) | (buffer[3] << 5) | (buffer[4] >> 3);
+
+ return 0;
+}
+
+int CMpeg2Dec::quant_matrix_ext()
+{
+ uint8_t* buffer = m_chunk_start;
+
+ if(buffer[0] & 8)
+ {
+ for(int i = 0; i < 64; i++)
+ m_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = (buffer[i] << 5) | (buffer[i+1] >> 3);
+ m_copy_matrix |= 1;
+ buffer += 64;
+ }
+
+ if(buffer[0] & 4)
+ {
+ for(int i = 0; i < 64; i++)
+ m_non_intra_quantizer_matrix[mpeg2_scan_norm_2[i]] = (buffer[i] << 6) | (buffer[i+1] >> 2);
+ m_copy_matrix |= 2;
+ }
+
+ return 0;
+}
+
+int CMpeg2Dec::copyright_ext()
+{
+ return 0;
+}
+
+int CMpeg2Dec::picture_display_ext()
+{
+ uint8_t* buffer = m_chunk_start;
+ mpeg2_picture_t* picture = m_picture;
+
+ int nb_pos = picture->nb_fields;
+ if(m_sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE)
+ nb_pos >>= 1;
+
+ int i = 0;
+
+ for(; i < nb_pos; i++)
+ {
+ int x = ((buffer[4*i] << 24) | (buffer[4*i+1] << 16) |
+ (buffer[4*i+2] << 8) | buffer[4*i+3]) >> (11-2*i);
+ int y = ((buffer[4*i+2] << 24) | (buffer[4*i+3] << 16) |
+ (buffer[4*i+4] << 8) | buffer[4*i+5]) >> (10-2*i);
+ if(!(x&y&1))
+ return 1;
+
+ picture->display_offset[i].x = m_display_offset_x = x >> 1;
+ picture->display_offset[i].y = m_display_offset_y = y >> 1;
+ }
+
+ for(; i < 3; i++)
+ {
+ picture->display_offset[i].x = m_display_offset_x;
+ picture->display_offset[i].y = m_display_offset_y;
+ }
+
+ return 0;
+}
+
+int CMpeg2Dec::picture_coding_ext()
+{
+ uint8_t* buffer = m_chunk_start;
+ mpeg2_picture_t* picture = m_picture;
+
+ /* pre subtract 1 for use later in compute_motion_vector */
+ m_decoder.m_f_motion.f_code[0] = (buffer[0] & 15) - 1;
+ m_decoder.m_f_motion.f_code[1] = (buffer[1] >> 4) - 1;
+ m_decoder.m_b_motion.f_code[0] = (buffer[1] & 15) - 1;
+ m_decoder.m_b_motion.f_code[1] = (buffer[2] >> 4) - 1;
+
+ m_decoder.m_intra_dc_precision = (buffer[2] >> 2) & 3;
+ m_decoder.m_picture_structure = buffer[2] & 3;
+ switch(m_decoder.m_picture_structure)
+ {
+ case TOP_FIELD:
+ picture->flags |= PIC_FLAG_TOP_FIELD_FIRST;
+ case BOTTOM_FIELD:
+ picture->nb_fields = 1;
+ break;
+ case FRAME_PICTURE:
+ if(!(m_sequence.flags & SEQ_FLAG_PROGRESSIVE_SEQUENCE))
+ {
+ picture->nb_fields = (buffer[3] & 2) ? 3 : 2;
+ picture->flags |= (buffer[3] & 128) ? PIC_FLAG_TOP_FIELD_FIRST : 0;
+ }
+ else
+ {
+ picture->nb_fields = (buffer[3]&2) ? ((buffer[3]&128) ? 6 : 4) : 2;
+ }
+ break;
+ default:
+ return 1;
+ }
+
+ m_decoder.m_top_field_first = buffer[3] >> 7;
+ m_decoder.m_frame_pred_frame_dct = (buffer[3] >> 6) & 1;
+ m_decoder.m_concealment_motion_vectors = (buffer[3] >> 5) & 1;
+ m_decoder.m_q_scale_type = (buffer[3] >> 4) & 1;
+ m_decoder.m_intra_vlc_format = (buffer[3] >> 3) & 1;
+ m_decoder.m_scan = (buffer[3] & 4) ? mpeg2_scan_alt_2 : mpeg2_scan_norm_2;
+
+ if(buffer[3] & 2)
+ picture->flags |= PIC_FLAG_REPEAT_FIRST_FIELD;
+
+ picture->flags |= (buffer[4] & 0x80) ? PIC_FLAG_PROGRESSIVE_FRAME : 0;
+ if(buffer[4] & 0x40)
+ picture->flags |= (((buffer[4]<<26) | (buffer[5]<<18) | (buffer[6]<<10)) & PIC_MASK_COMPOSITE_DISPLAY) | PIC_FLAG_COMPOSITE_DISPLAY;
+
+ m_ext_state = PIC_DISPLAY_EXT | COPYRIGHT_EXT | QUANT_MATRIX_EXT;
+
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+// vlc
+
+#define GETWORD(bit_buf,shift,bit_ptr) \
+do { \
+ bit_buf |= ((bit_ptr[0] << 8) | bit_ptr[1]) << (shift); \
+ bit_ptr += 2; \
+} while (0)
+/*
+void bitstream_init(const uint8_t * start)
+{
+ m_bitstream_buf =
+ (start[0] << 24) | (start[1] << 16) | (start[2] << 8) | start[3];
+ m_bitstream_ptr = start + 4;
+ m_bitstream_bits = -16;
+}
+*/
+/* make sure that there are at least 16 valid bits in bit_buf */
+#define NEEDBITS \
+do { \
+ if (bits > 0) { \
+ GETWORD (bit_buf, bits, bit_ptr); \
+ bits -= 16; \
+ } \
+} while (0)
+
+/* remove num valid bits from bit_buf */
+#define DUMPBITS(num) \
+do { \
+ bit_buf <<= (num); \
+ bits += (num); \
+} while (0)
+
+/* take num bits from the high part of bit_buf and zero extend them */
+#define UBITS(bit_buf,num) (((uint32_t)(bit_buf)) >> (32 - (num)))
+
+/* take num bits from the high part of bit_buf and sign extend them */
+#define SBITS(bit_buf,num) (((int32_t)(bit_buf)) >> (32 - (num)))
+
+typedef struct {
+ uint8_t modes;
+ uint8_t len;
+} MBtab;
+
+typedef struct {
+ uint8_t delta;
+ uint8_t len;
+} MVtab;
+
+typedef struct {
+ int8_t dmv;
+ uint8_t len;
+} DMVtab;
+
+typedef struct {
+ uint8_t cbp;
+ uint8_t len;
+} CBPtab;
+
+typedef struct {
+ uint8_t size;
+ uint8_t len;
+} DCtab;
+
+typedef struct {
+ uint8_t run;
+ uint8_t level;
+ uint8_t len;
+} DCTtab;
+
+typedef struct {
+ uint8_t mba;
+ uint8_t len;
+} MBAtab;
+
+
+#define INTRA MACROBLOCK_INTRA
+#define QUANT MACROBLOCK_QUANT
+
+static const MBtab MB_I [] = {
+ {INTRA|QUANT, 2}, {INTRA, 1}
+};
+
+#define MC MACROBLOCK_MOTION_FORWARD
+#define CODED MACROBLOCK_PATTERN
+
+static const MBtab MB_P [] = {
+ {INTRA|QUANT, 6}, {CODED|QUANT, 5}, {MC|CODED|QUANT, 5}, {INTRA, 5},
+ {MC, 3}, {MC, 3}, {MC, 3}, {MC, 3},
+ {CODED, 2}, {CODED, 2}, {CODED, 2}, {CODED, 2},
+ {CODED, 2}, {CODED, 2}, {CODED, 2}, {CODED, 2},
+ {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1},
+ {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1},
+ {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1},
+ {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}, {MC|CODED, 1}
+};
+
+#define FWD MACROBLOCK_MOTION_FORWARD
+#define BWD MACROBLOCK_MOTION_BACKWARD
+#define INTER MACROBLOCK_MOTION_FORWARD|MACROBLOCK_MOTION_BACKWARD
+
+static const MBtab MB_B [] = {
+ {0, 0}, {INTRA|QUANT, 6},
+ {BWD|CODED|QUANT, 6}, {FWD|CODED|QUANT, 6},
+ {INTER|CODED|QUANT, 5}, {INTER|CODED|QUANT, 5},
+ {INTRA, 5}, {INTRA, 5},
+ {FWD, 4}, {FWD, 4}, {FWD, 4}, {FWD, 4},
+ {FWD|CODED, 4}, {FWD|CODED, 4}, {FWD|CODED, 4}, {FWD|CODED, 4},
+ {BWD, 3}, {BWD, 3}, {BWD, 3}, {BWD, 3},
+ {BWD, 3}, {BWD, 3}, {BWD, 3}, {BWD, 3},
+ {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3},
+ {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3}, {BWD|CODED, 3},
+ {INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
+ {INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
+ {INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
+ {INTER, 2}, {INTER, 2}, {INTER, 2}, {INTER, 2},
+ {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2},
+ {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2},
+ {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2},
+ {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}, {INTER|CODED, 2}
+};
+
+#undef INTRA
+#undef QUANT
+#undef MC
+#undef CODED
+#undef FWD
+#undef BWD
+#undef INTER
+
+
+static const MVtab MV_4 [] = {
+ { 3, 6}, { 2, 4}, { 1, 3}, { 1, 3}, { 0, 2}, { 0, 2}, { 0, 2}, { 0, 2}
+};
+
+static const MVtab MV_10 [] = {
+ { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10}, { 0,10},
+ { 0,10}, { 0,10}, { 0,10}, { 0,10}, {15,10}, {14,10}, {13,10}, {12,10},
+ {11,10}, {10,10}, { 9, 9}, { 9, 9}, { 8, 9}, { 8, 9}, { 7, 9}, { 7, 9},
+ { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7}, { 6, 7},
+ { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7}, { 5, 7},
+ { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}, { 4, 7}
+};
+
+
+static const DMVtab DMV_2 [] = {
+ { 0, 1}, { 0, 1}, { 1, 2}, {-1, 2}
+};
+
+
+static const CBPtab CBP_7 [] = {
+ {0x22, 7}, {0x12, 7}, {0x0a, 7}, {0x06, 7},
+ {0x21, 7}, {0x11, 7}, {0x09, 7}, {0x05, 7},
+ {0x3f, 6}, {0x3f, 6}, {0x03, 6}, {0x03, 6},
+ {0x24, 6}, {0x24, 6}, {0x18, 6}, {0x18, 6},
+ {0x3e, 5}, {0x3e, 5}, {0x3e, 5}, {0x3e, 5},
+ {0x02, 5}, {0x02, 5}, {0x02, 5}, {0x02, 5},
+ {0x3d, 5}, {0x3d, 5}, {0x3d, 5}, {0x3d, 5},
+ {0x01, 5}, {0x01, 5}, {0x01, 5}, {0x01, 5},
+ {0x38, 5}, {0x38, 5}, {0x38, 5}, {0x38, 5},
+ {0x34, 5}, {0x34, 5}, {0x34, 5}, {0x34, 5},
+ {0x2c, 5}, {0x2c, 5}, {0x2c, 5}, {0x2c, 5},
+ {0x1c, 5}, {0x1c, 5}, {0x1c, 5}, {0x1c, 5},
+ {0x28, 5}, {0x28, 5}, {0x28, 5}, {0x28, 5},
+ {0x14, 5}, {0x14, 5}, {0x14, 5}, {0x14, 5},
+ {0x30, 5}, {0x30, 5}, {0x30, 5}, {0x30, 5},
+ {0x0c, 5}, {0x0c, 5}, {0x0c, 5}, {0x0c, 5},
+ {0x20, 4}, {0x20, 4}, {0x20, 4}, {0x20, 4},
+ {0x20, 4}, {0x20, 4}, {0x20, 4}, {0x20, 4},
+ {0x10, 4}, {0x10, 4}, {0x10, 4}, {0x10, 4},
+ {0x10, 4}, {0x10, 4}, {0x10, 4}, {0x10, 4},
+ {0x08, 4}, {0x08, 4}, {0x08, 4}, {0x08, 4},
+ {0x08, 4}, {0x08, 4}, {0x08, 4}, {0x08, 4},
+ {0x04, 4}, {0x04, 4}, {0x04, 4}, {0x04, 4},
+ {0x04, 4}, {0x04, 4}, {0x04, 4}, {0x04, 4},
+ {0x3c, 3}, {0x3c, 3}, {0x3c, 3}, {0x3c, 3},
+ {0x3c, 3}, {0x3c, 3}, {0x3c, 3}, {0x3c, 3},
+ {0x3c, 3}, {0x3c, 3}, {0x3c, 3}, {0x3c, 3},
+ {0x3c, 3}, {0x3c, 3}, {0x3c, 3}, {0x3c, 3}
+};
+
+static const CBPtab CBP_9 [] = {
+ {0, 0}, {0x00, 9}, {0x27, 9}, {0x1b, 9},
+ {0x3b, 9}, {0x37, 9}, {0x2f, 9}, {0x1f, 9},
+ {0x3a, 8}, {0x3a, 8}, {0x36, 8}, {0x36, 8},
+ {0x2e, 8}, {0x2e, 8}, {0x1e, 8}, {0x1e, 8},
+ {0x39, 8}, {0x39, 8}, {0x35, 8}, {0x35, 8},
+ {0x2d, 8}, {0x2d, 8}, {0x1d, 8}, {0x1d, 8},
+ {0x26, 8}, {0x26, 8}, {0x1a, 8}, {0x1a, 8},
+ {0x25, 8}, {0x25, 8}, {0x19, 8}, {0x19, 8},
+ {0x2b, 8}, {0x2b, 8}, {0x17, 8}, {0x17, 8},
+ {0x33, 8}, {0x33, 8}, {0x0f, 8}, {0x0f, 8},
+ {0x2a, 8}, {0x2a, 8}, {0x16, 8}, {0x16, 8},
+ {0x32, 8}, {0x32, 8}, {0x0e, 8}, {0x0e, 8},
+ {0x29, 8}, {0x29, 8}, {0x15, 8}, {0x15, 8},
+ {0x31, 8}, {0x31, 8}, {0x0d, 8}, {0x0d, 8},
+ {0x23, 8}, {0x23, 8}, {0x13, 8}, {0x13, 8},
+ {0x0b, 8}, {0x0b, 8}, {0x07, 8}, {0x07, 8}
+};
+
+
+static const DCtab DC_lum_5 [] = {
+ {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
+ {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
+ {0, 3}, {0, 3}, {0, 3}, {0, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3},
+ {4, 3}, {4, 3}, {4, 3}, {4, 3}, {5, 4}, {5, 4}, {6, 5}
+};
+
+static const DCtab DC_chrom_5 [] = {
+ {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2},
+ {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
+ {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
+ {3, 3}, {3, 3}, {3, 3}, {3, 3}, {4, 4}, {4, 4}, {5, 5}
+};
+
+static const DCtab DC_long [] = {
+ {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, { 6, 5}, { 6, 5},
+ {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, {6, 5}, { 6, 5}, { 6, 5},
+ {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, {7, 6}, { 7, 6}, { 7, 6},
+ {8, 7}, {8, 7}, {8, 7}, {8, 7}, {9, 8}, {9, 8}, {10, 9}, {11, 9}
+};
+
+
+static const DCTtab DCT_16 [] = {
+ {129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
+ {129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
+ {129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
+ {129, 0, 0}, {129, 0, 0}, {129, 0, 0}, {129, 0, 0},
+ { 2,18, 0}, { 2,17, 0}, { 2,16, 0}, { 2,15, 0},
+ { 7, 3, 0}, { 17, 2, 0}, { 16, 2, 0}, { 15, 2, 0},
+ { 14, 2, 0}, { 13, 2, 0}, { 12, 2, 0}, { 32, 1, 0},
+ { 31, 1, 0}, { 30, 1, 0}, { 29, 1, 0}, { 28, 1, 0}
+};
+
+static const DCTtab DCT_15 [] = {
+ { 1,40,15}, { 1,39,15}, { 1,38,15}, { 1,37,15},
+ { 1,36,15}, { 1,35,15}, { 1,34,15}, { 1,33,15},
+ { 1,32,15}, { 2,14,15}, { 2,13,15}, { 2,12,15},
+ { 2,11,15}, { 2,10,15}, { 2, 9,15}, { 2, 8,15},
+ { 1,31,14}, { 1,31,14}, { 1,30,14}, { 1,30,14},
+ { 1,29,14}, { 1,29,14}, { 1,28,14}, { 1,28,14},
+ { 1,27,14}, { 1,27,14}, { 1,26,14}, { 1,26,14},
+ { 1,25,14}, { 1,25,14}, { 1,24,14}, { 1,24,14},
+ { 1,23,14}, { 1,23,14}, { 1,22,14}, { 1,22,14},
+ { 1,21,14}, { 1,21,14}, { 1,20,14}, { 1,20,14},
+ { 1,19,14}, { 1,19,14}, { 1,18,14}, { 1,18,14},
+ { 1,17,14}, { 1,17,14}, { 1,16,14}, { 1,16,14}
+};
+
+static const DCTtab DCT_13 [] = {
+ { 11, 2,13}, { 10, 2,13}, { 6, 3,13}, { 4, 4,13},
+ { 3, 5,13}, { 2, 7,13}, { 2, 6,13}, { 1,15,13},
+ { 1,14,13}, { 1,13,13}, { 1,12,13}, { 27, 1,13},
+ { 26, 1,13}, { 25, 1,13}, { 24, 1,13}, { 23, 1,13},
+ { 1,11,12}, { 1,11,12}, { 9, 2,12}, { 9, 2,12},
+ { 5, 3,12}, { 5, 3,12}, { 1,10,12}, { 1,10,12},
+ { 3, 4,12}, { 3, 4,12}, { 8, 2,12}, { 8, 2,12},
+ { 22, 1,12}, { 22, 1,12}, { 21, 1,12}, { 21, 1,12},
+ { 1, 9,12}, { 1, 9,12}, { 20, 1,12}, { 20, 1,12},
+ { 19, 1,12}, { 19, 1,12}, { 2, 5,12}, { 2, 5,12},
+ { 4, 3,12}, { 4, 3,12}, { 1, 8,12}, { 1, 8,12},
+ { 7, 2,12}, { 7, 2,12}, { 18, 1,12}, { 18, 1,12}
+};
+
+static const DCTtab DCT_B14_10 [] = {
+ { 17, 1,10}, { 6, 2,10}, { 1, 7,10}, { 3, 3,10},
+ { 2, 4,10}, { 16, 1,10}, { 15, 1,10}, { 5, 2,10}
+};
+
+static const DCTtab DCT_B14_8 [] = {
+ { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},
+ { 3, 2, 7}, { 3, 2, 7}, { 10, 1, 7}, { 10, 1, 7},
+ { 1, 4, 7}, { 1, 4, 7}, { 9, 1, 7}, { 9, 1, 7},
+ { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6}, { 8, 1, 6},
+ { 7, 1, 6}, { 7, 1, 6}, { 7, 1, 6}, { 7, 1, 6},
+ { 2, 2, 6}, { 2, 2, 6}, { 2, 2, 6}, { 2, 2, 6},
+ { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6},
+ { 14, 1, 8}, { 1, 6, 8}, { 13, 1, 8}, { 12, 1, 8},
+ { 4, 2, 8}, { 2, 3, 8}, { 1, 5, 8}, { 11, 1, 8}
+};
+
+static const DCTtab DCT_B14AC_5 [] = {
+ { 1, 3, 5}, { 5, 1, 5}, { 4, 1, 5},
+ { 1, 2, 4}, { 1, 2, 4}, { 3, 1, 4}, { 3, 1, 4},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ {129, 0, 2}, {129, 0, 2}, {129, 0, 2}, {129, 0, 2},
+ {129, 0, 2}, {129, 0, 2}, {129, 0, 2}, {129, 0, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}
+};
+
+static const DCTtab DCT_B14DC_5 [] = {
+ { 1, 3, 5}, { 5, 1, 5}, { 4, 1, 5},
+ { 1, 2, 4}, { 1, 2, 4}, { 3, 1, 4}, { 3, 1, 4},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1},
+ { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1},
+ { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1},
+ { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}, { 1, 1, 1}
+};
+
+static const DCTtab DCT_B15_10 [] = {
+ { 6, 2, 9}, { 6, 2, 9}, { 15, 1, 9}, { 15, 1, 9},
+ { 3, 4,10}, { 17, 1,10}, { 16, 1, 9}, { 16, 1, 9}
+};
+
+static const DCTtab DCT_B15_8 [] = {
+ { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6}, { 65, 0, 6},
+ { 8, 1, 7}, { 8, 1, 7}, { 9, 1, 7}, { 9, 1, 7},
+ { 7, 1, 7}, { 7, 1, 7}, { 3, 2, 7}, { 3, 2, 7},
+ { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6}, { 1, 7, 6},
+ { 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6}, { 1, 6, 6},
+ { 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6}, { 5, 1, 6},
+ { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6}, { 6, 1, 6},
+ { 2, 5, 8}, { 12, 1, 8}, { 1,11, 8}, { 1,10, 8},
+ { 14, 1, 8}, { 13, 1, 8}, { 4, 2, 8}, { 2, 4, 8},
+ { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5},
+ { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5}, { 3, 1, 5},
+ { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5},
+ { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5}, { 2, 2, 5},
+ { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5},
+ { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5}, { 4, 1, 5},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3}, { 2, 1, 3},
+ {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
+ {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
+ {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
+ {129, 0, 4}, {129, 0, 4}, {129, 0, 4}, {129, 0, 4},
+ { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
+ { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
+ { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
+ { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4}, { 1, 3, 4},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2}, { 1, 1, 2},
+ { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
+ { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
+ { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
+ { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
+ { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
+ { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
+ { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
+ { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3}, { 1, 2, 3},
+ { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5},
+ { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5}, { 1, 4, 5},
+ { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5},
+ { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5}, { 1, 5, 5},
+ { 10, 1, 7}, { 10, 1, 7}, { 2, 3, 7}, { 2, 3, 7},
+ { 11, 1, 7}, { 11, 1, 7}, { 1, 8, 7}, { 1, 8, 7},
+ { 1, 9, 7}, { 1, 9, 7}, { 1,12, 8}, { 1,13, 8},
+ { 3, 3, 8}, { 5, 2, 8}, { 1,14, 8}, { 1,15, 8}
+};
+
+
+static const MBAtab MBA_5 [] = {
+ {6, 5}, {5, 5}, {4, 4}, {4, 4}, {3, 4}, {3, 4},
+ {2, 3}, {2, 3}, {2, 3}, {2, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 3},
+ {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1},
+ {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}, {0, 1}
+};
+
+static const MBAtab MBA_11 [] = {
+ {32, 11}, {31, 11}, {30, 11}, {29, 11},
+ {28, 11}, {27, 11}, {26, 11}, {25, 11},
+ {24, 11}, {23, 11}, {22, 11}, {21, 11},
+ {20, 10}, {20, 10}, {19, 10}, {19, 10},
+ {18, 10}, {18, 10}, {17, 10}, {17, 10},
+ {16, 10}, {16, 10}, {15, 10}, {15, 10},
+ {14, 8}, {14, 8}, {14, 8}, {14, 8},
+ {14, 8}, {14, 8}, {14, 8}, {14, 8},
+ {13, 8}, {13, 8}, {13, 8}, {13, 8},
+ {13, 8}, {13, 8}, {13, 8}, {13, 8},
+ {12, 8}, {12, 8}, {12, 8}, {12, 8},
+ {12, 8}, {12, 8}, {12, 8}, {12, 8},
+ {11, 8}, {11, 8}, {11, 8}, {11, 8},
+ {11, 8}, {11, 8}, {11, 8}, {11, 8},
+ {10, 8}, {10, 8}, {10, 8}, {10, 8},
+ {10, 8}, {10, 8}, {10, 8}, {10, 8},
+ { 9, 8}, { 9, 8}, { 9, 8}, { 9, 8},
+ { 9, 8}, { 9, 8}, { 9, 8}, { 9, 8},
+ { 8, 7}, { 8, 7}, { 8, 7}, { 8, 7},
+ { 8, 7}, { 8, 7}, { 8, 7}, { 8, 7},
+ { 8, 7}, { 8, 7}, { 8, 7}, { 8, 7},
+ { 8, 7}, { 8, 7}, { 8, 7}, { 8, 7},
+ { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7},
+ { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7},
+ { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7},
+ { 7, 7}, { 7, 7}, { 7, 7}, { 7, 7}
+};
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+static int non_linear_quantizer_scale [] = {
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 10, 12, 14, 16, 18, 20, 22,
+ 24, 28, 32, 36, 40, 44, 48, 52,
+ 56, 64, 72, 80, 88, 96, 104, 112
+};
+
+bool CMpeg2Decoder::m_idct_initialized = false;
+
+CMpeg2Decoder::CMpeg2Decoder()
+{
+ memset(&m_b_motion, 0, sizeof(m_b_motion));
+ memset(&m_f_motion, 0, sizeof(m_f_motion));
+
+ m_DCTblock = (int16_t*)_aligned_malloc(64*sizeof(int16_t), 16);
+ memset(m_DCTblock, 0, 64*sizeof(int16_t));
+
+ m_bitstream_buf = 0;
+ m_bitstream_bits = 0;
+ m_bitstream_ptr = NULL;
+
+ memset(&m_dest, 0, sizeof(m_dest));
+ memset(&m_picture_dest, 0, sizeof(m_picture_dest));
+
+ m_offset = m_stride = m_uv_stride = 0;
+ m_limit_x = m_limit_y_16 = m_limit_y_8 = m_limit_y = 0;
+
+ memset(&m_dc_dct_pred, 0, sizeof(m_dc_dct_pred));
+
+ m_quantizer_scale = m_dmv_offset = 0;
+ m_v_offset = 0;
+
+ memset(&m_intra_quantizer_matrix, 0, sizeof(m_intra_quantizer_matrix));
+ memset(&m_non_intra_quantizer_matrix, 0, sizeof(m_non_intra_quantizer_matrix));
+
+ m_width = m_height = 0;
+ m_vertical_position_extension = 0;
+
+ m_coding_type = 0;
+
+ m_intra_dc_precision = 0;
+ m_picture_structure = 0;
+ m_frame_pred_frame_dct = 0;
+ m_concealment_motion_vectors = 0;
+ m_q_scale_type = 0;
+ m_intra_vlc_format = 0;
+ m_top_field_first = 0;
+
+ m_scan = NULL;
+
+ m_second_field = 0;
+
+ m_mpeg1 = 0;
+
+// //
+/**/
+ if(g_cpuid.m_flags&CCpuID::sse2)
+ {
+ m_idct_init = mpeg2_idct_init_sse2;
+ m_idct_copy = mpeg2_idct_copy_sse2;
+ m_idct_add = mpeg2_idct_add_sse2;
+ m_mc = &mpeg2_mc_sse2;
+ }
+ else if(g_cpuid.m_flags&CCpuID::mmx)
+ {
+ m_idct_init = mpeg2_idct_init_mmx;
+ m_idct_copy = mpeg2_idct_copy_mmx;
+ m_idct_add = mpeg2_idct_add_mmx;
+ m_mc = &mpeg2_mc_mmx;
+ }
+ else
+ {
+ m_idct_init = mpeg2_idct_init_c;
+ m_idct_copy = mpeg2_idct_copy_c;
+ m_idct_add = mpeg2_idct_add_c;
+ m_mc = &mpeg2_mc_c;
+ }
+/*
+m_idct_init = mpeg2_idct_init_null;
+m_idct_copy = mpeg2_idct_copy_null;
+m_idct_add = mpeg2_idct_add_null;
+m_mc = &mpeg2_mc_null;
+*/
+ if(!m_idct_initialized)
+ {
+ m_idct_init();
+ m_idct_initialized = true;
+ }
+}
+
+CMpeg2Decoder::~CMpeg2Decoder()
+{
+ if(m_DCTblock) _aligned_free(m_DCTblock);
+}
+
+#define bit_buf (m_bitstream_buf)
+#define bits (m_bitstream_bits)
+#define bit_ptr (m_bitstream_ptr)
+
+int CMpeg2Decoder::get_macroblock_modes()
+{
+ int macroblock_modes;
+ const MBtab* tab;
+
+ switch(m_coding_type)
+ {
+ case P_TYPE:
+ tab = MB_P + UBITS(bit_buf, 5);
+ DUMPBITS(tab->len);
+ macroblock_modes = tab->modes;
+
+ if(m_picture_structure != FRAME_PICTURE)
+ {
+ if(macroblock_modes & MACROBLOCK_MOTION_FORWARD)
+ {
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+ }
+
+ return macroblock_modes;
+ }
+ else if(m_frame_pred_frame_dct)
+ {
+ if(macroblock_modes & MACROBLOCK_MOTION_FORWARD)
+ macroblock_modes |= MC_FRAME;
+
+ return macroblock_modes;
+ }
+
+ if(macroblock_modes & MACROBLOCK_MOTION_FORWARD)
+ {
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+ }
+
+ if(macroblock_modes & (MACROBLOCK_INTRA|MACROBLOCK_PATTERN))
+ {
+ macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
+ DUMPBITS(1);
+ }
+
+ return macroblock_modes;
+
+ case B_TYPE:
+ tab = MB_B + UBITS(bit_buf, 6);
+ DUMPBITS(tab->len);
+ macroblock_modes = tab->modes;
+
+ if(m_picture_structure != FRAME_PICTURE)
+ {
+ if(!(macroblock_modes & MACROBLOCK_INTRA))
+ {
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+ }
+
+ return macroblock_modes;
+ }
+ else if(m_frame_pred_frame_dct)
+ {
+ // if(!(macroblock_modes & MACROBLOCK_INTRA))
+ macroblock_modes |= MC_FRAME;
+
+ return macroblock_modes;
+ }
+/*
+ if(macroblock_modes & MACROBLOCK_INTRA)
+ goto intra;
+
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+
+ if(macroblock_modes & (MACROBLOCK_INTRA|MACROBLOCK_PATTERN))
+ {
+intra:
+ macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
+ DUMPBITS(1);
+ }
+*/
+ if(!(macroblock_modes & MACROBLOCK_INTRA))
+ {
+ macroblock_modes |= UBITS(bit_buf, 2) * MOTION_TYPE_BASE;
+ DUMPBITS(2);
+ }
+
+ if(macroblock_modes & (MACROBLOCK_INTRA|MACROBLOCK_PATTERN))
+ {
+ macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
+ DUMPBITS(1);
+ }
+
+ return macroblock_modes;
+
+ case I_TYPE:
+ tab = MB_I + UBITS(bit_buf, 1);
+ DUMPBITS(tab->len);
+ macroblock_modes = tab->modes;
+
+ if(!m_frame_pred_frame_dct && m_picture_structure == FRAME_PICTURE)
+ {
+ macroblock_modes |= UBITS(bit_buf, 1) * DCT_TYPE_INTERLACED;
+ DUMPBITS(1);
+ }
+
+ return macroblock_modes;
+
+ case D_TYPE:
+
+ DUMPBITS(1);
+ return MACROBLOCK_INTRA;
+ }
+
+ return 0;
+}
+
+int CMpeg2Decoder::get_quantizer_scale()
+{
+ int quantizer_scale_code = UBITS(bit_buf, 5);
+ DUMPBITS(5);
+
+ return m_q_scale_type
+ ? non_linear_quantizer_scale[quantizer_scale_code]
+ : (quantizer_scale_code << 1);
+}
+
+int CMpeg2Decoder::get_motion_delta(const int f_code)
+{
+ int delta;
+ int sign;
+ const MVtab* tab;
+
+ if(bit_buf & 0x80000000)
+ {
+ DUMPBITS(1);
+ return 0;
+ }
+ else if(bit_buf >= 0x0c000000)
+ {
+ tab = MV_4 + UBITS(bit_buf, 4);
+ delta = (tab->delta << f_code) + 1;
+ bits += tab->len + f_code + 1;
+ bit_buf <<= tab->len;
+
+ sign = SBITS(bit_buf, 1);
+ bit_buf <<= 1;
+
+ if(f_code)
+ {
+ delta += UBITS(bit_buf, f_code);
+ }
+
+ bit_buf <<= f_code;
+
+ return (delta ^ sign) - sign;
+ }
+ else
+ {
+ tab = MV_10 + UBITS(bit_buf, 10);
+ delta = (tab->delta << f_code) + 1;
+ bits += tab->len + 1;
+ bit_buf <<= tab->len;
+
+ sign = SBITS(bit_buf, 1);
+ bit_buf <<= 1;
+
+ if(f_code)
+ {
+ NEEDBITS;
+ delta += UBITS(bit_buf, f_code);
+ DUMPBITS(f_code);
+ }
+
+ return (delta ^ sign) - sign;
+ }
+}
+
+int CMpeg2Decoder::bound_motion_vector(const int vector, const int f_code)
+{
+ return ((int32_t)vector << (27 - f_code)) >> (27 - f_code);
+}
+
+int CMpeg2Decoder::get_dmv()
+{
+ const DMVtab* tab = DMV_2 + UBITS(bit_buf, 2);
+ DUMPBITS(tab->len);
+ return tab->dmv;
+}
+
+int CMpeg2Decoder::get_coded_block_pattern()
+{
+ const CBPtab* tab;
+
+ NEEDBITS;
+
+ if(bit_buf >= 0x20000000)
+ {
+ tab = CBP_7 + (UBITS(bit_buf, 7) - 16);
+ DUMPBITS(tab->len);
+ return tab->cbp;
+ }
+ else
+ {
+ tab = CBP_9 + UBITS(bit_buf, 9);
+ DUMPBITS(tab->len);
+ return tab->cbp;
+ }
+}
+
+int CMpeg2Decoder::get_luma_dc_dct_diff()
+{
+ const DCtab* tab;
+ int size;
+ int dc_diff;
+
+ if(bit_buf < 0xf8000000)
+ {
+ tab = DC_lum_5 + UBITS(bit_buf, 5);
+ size = tab->size;
+ if(size)
+ {
+ bits += tab->len + size;
+ bit_buf <<= tab->len;
+ dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
+ bit_buf <<= size;
+ return dc_diff;
+ }
+ else
+ {
+ DUMPBITS(3);
+ return 0;
+ }
+ }
+ else
+ {
+ tab = DC_long + (UBITS(bit_buf, 9) - 0x1e0);
+ size = tab->size;
+ DUMPBITS(tab->len);
+ NEEDBITS;
+ dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
+ DUMPBITS(size);
+ return dc_diff;
+ }
+}
+
+int CMpeg2Decoder::get_chroma_dc_dct_diff()
+{
+ const DCtab* tab;
+ int size;
+ int dc_diff;
+
+ if(bit_buf < 0xf8000000)
+ {
+ tab = DC_chrom_5 + UBITS(bit_buf, 5);
+ size = tab->size;
+
+ if(size)
+ {
+ bits += tab->len + size;
+ bit_buf <<= tab->len;
+ dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
+ bit_buf <<= size;
+ return dc_diff;
+ }
+ else
+ {
+ DUMPBITS(2);
+ return 0;
+ }
+ }
+ else
+ {
+ tab = DC_long + (UBITS(bit_buf, 10) - 0x3e0);
+ size = tab->size;
+ DUMPBITS(tab->len + 1);
+ NEEDBITS;
+ dc_diff = UBITS(bit_buf, size) - UBITS(SBITS(~bit_buf, 1), size);
+ DUMPBITS(size);
+ return dc_diff;
+ }
+}
+
+#undef bit_buf
+#undef bits
+#undef bit_ptr
+
+#define SATURATE(val) \
+do { \
+ if((uint32_t)(val + 2048) > 4095) \
+ val = SBITS(val, 1) ^ 2047; \
+} while (0)
+
+void CMpeg2Decoder::get_intra_block_B14()
+{
+ int i, j;
+ int val;
+ const uint8_t* scan = m_scan;
+ const uint8_t* quant_matrix = m_intra_quantizer_matrix;
+ int quantizer_scale = m_quantizer_scale;
+ int mismatch;
+ const DCTtab* tab;
+ uint32_t bit_buf;
+ int bits;
+ const uint8_t* bit_ptr;
+ int16_t* dest;
+
+ dest = m_DCTblock;
+ i = 0;
+ mismatch = ~dest[0];
+
+ bit_buf = m_bitstream_buf;
+ bits = m_bitstream_bits;
+ bit_ptr = m_bitstream_ptr;
+
+ NEEDBITS;
+
+ while(1)
+ {
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
+
+ i += tab->run;
+ if(i >= 64)
+ break; /* end of block */
+
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
+
+ // if(bitstream_get (1)) val = -val;
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check needed to avoid buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = (SBITS(bit_buf, 12) * quantizer_scale * quant_matrix[j]) / 16;
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ DUMPBITS(12);
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD (bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ dest[63] ^= mismatch & 1;
+ DUMPBITS(2); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
+}
+
+void CMpeg2Decoder::get_intra_block_B15()
+{
+ int i, j;
+ int val;
+ const uint8_t* scan = m_scan;
+ const uint8_t* quant_matrix = m_intra_quantizer_matrix;
+ int quantizer_scale = m_quantizer_scale;
+ int mismatch;
+ const DCTtab* tab;
+ uint32_t bit_buf;
+ int bits;
+ const uint8_t* bit_ptr;
+ int16_t* dest;
+
+ dest = m_DCTblock;
+ i = 0;
+ mismatch = ~dest[0];
+
+ bit_buf = m_bitstream_buf;
+ bits = m_bitstream_bits;
+ bit_ptr = m_bitstream_ptr;
+
+ NEEDBITS;
+
+ while(1)
+ {
+ if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B15_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ {
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
+
+ // if(bitstream_get (1)) val = -val;
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+ else
+ {
+ /* end of block. I commented out this code because if we */
+ /* dont exit here we will still exit at the later test :) */
+
+ /* if(i >= 128) break; */ /* end of block */
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check against buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = (SBITS(bit_buf, 12) *
+ quantizer_scale * quant_matrix[j]) / 16;
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ DUMPBITS(12);
+ NEEDBITS;
+
+ continue;
+ }
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B15_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD(bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ dest[63] ^= mismatch & 1;
+ DUMPBITS(4); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
+}
+
+int CMpeg2Decoder::get_non_intra_block()
+{
+ int i, j;
+ int val;
+ const uint8_t* scan = m_scan;
+ const uint8_t* quant_matrix = m_non_intra_quantizer_matrix;
+ int quantizer_scale = m_quantizer_scale;
+ int mismatch;
+ const DCTtab* tab;
+ uint32_t bit_buf;
+ int bits;
+ const uint8_t* bit_ptr;
+ int16_t* dest;
+
+ i = -1;
+ mismatch = 1;
+ dest = m_DCTblock;
+
+ bit_buf = m_bitstream_buf;
+ bits = m_bitstream_bits;
+ bit_ptr = m_bitstream_ptr;
+
+ NEEDBITS;
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14DC_5 + (UBITS(bit_buf, 5) - 5);
+ goto entry_1;
+ }
+ else
+ {
+ goto entry_2;
+ }
+
+ while(1)
+ {
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
+entry_1:
+ i += tab->run;
+ if(i >= 64)
+ break; /* end of block */
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = ((2*tab->level+1) * quantizer_scale * quant_matrix[j]) >> 5;
+
+ /* if(bitstream_get (1)) val = -val; */
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+
+entry_2:
+ if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check needed to avoid buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = 2 * (SBITS(bit_buf, 12) + SBITS(bit_buf, 1)) + 1;
+ val = (val * quantizer_scale * quant_matrix[j]) / 32;
+
+ SATURATE(val);
+ dest[j] = val;
+ mismatch ^= val;
+
+ DUMPBITS(12);
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD (bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ dest[63] ^= mismatch & 1;
+ DUMPBITS(2); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
+
+ return i;
+}
+
+void CMpeg2Decoder::get_mpeg1_intra_block()
+{
+ int i, j;
+ int val;
+ const uint8_t* scan = m_scan;
+ const uint8_t* quant_matrix = m_intra_quantizer_matrix;
+ int quantizer_scale = m_quantizer_scale;
+ const DCTtab* tab;
+ uint32_t bit_buf;
+ int bits;
+ const uint8_t* bit_ptr;
+ int16_t* dest;
+
+ i = 0;
+ dest = m_DCTblock;
+
+ bit_buf = m_bitstream_buf;
+ bits = m_bitstream_bits;
+ bit_ptr = m_bitstream_ptr;
+
+ NEEDBITS;
+
+ while(1)
+ {
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
+
+ i += tab->run;
+ if(i >= 64)
+ break; /* end of block */
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = (tab->level * quantizer_scale * quant_matrix[j]) >> 4;
+
+ /* oddification */
+ val = (val - 1) | 1;
+
+ /* if(bitstream_get (1)) val = -val; */
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check needed to avoid buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = SBITS(bit_buf, 8);
+ if(!(val & 0x7f))
+ {
+ DUMPBITS(8);
+ val = UBITS(bit_buf, 8) + 2 * val;
+ }
+ val = (val * quantizer_scale * quant_matrix[j]) / 16;
+
+ /* oddification */
+ val = (val + ~SBITS(val, 1)) | 1;
+
+ SATURATE(val);
+ dest[j] = val;
+
+ DUMPBITS(8);
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD(bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ DUMPBITS(2); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
+}
+
+int CMpeg2Decoder::get_mpeg1_non_intra_block()
+{
+ int i, j;
+ int val;
+ const uint8_t* scan = m_scan;
+ const uint8_t* quant_matrix = m_non_intra_quantizer_matrix;
+ int quantizer_scale = m_quantizer_scale;
+ const DCTtab* tab;
+ uint32_t bit_buf;
+ int bits;
+ const uint8_t* bit_ptr;
+ int16_t* dest;
+
+ i = -1;
+ dest = m_DCTblock;
+
+ bit_buf = m_bitstream_buf;
+ bits = m_bitstream_bits;
+ bit_ptr = m_bitstream_ptr;
+
+ NEEDBITS;
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14DC_5 + (UBITS(bit_buf, 5) - 5);
+ goto entry_1;
+ }
+ else
+ {
+ goto entry_2;
+ }
+
+ while(1)
+ {
+ if(bit_buf >= 0x28000000)
+ {
+ tab = DCT_B14AC_5 + (UBITS(bit_buf, 5) - 5);
+entry_1:
+ i += tab->run;
+ if(i >= 64)
+ break; /* end of block */
+normal_code:
+ j = scan[i];
+ bit_buf <<= tab->len;
+ bits += tab->len + 1;
+ val = ((2*tab->level+1) * quantizer_scale * quant_matrix[j]) >> 5;
+
+ /* oddification */
+ val = (val - 1) | 1;
+
+ /* if(bitstream_get (1)) val = -val; */
+ val = (val ^ SBITS(bit_buf, 1)) - SBITS(bit_buf, 1);
+
+ SATURATE(val);
+ dest[j] = val;
+
+ bit_buf <<= 1;
+ NEEDBITS;
+
+ continue;
+ }
+
+entry_2:
+ if(bit_buf >= 0x04000000)
+ {
+ tab = DCT_B14_8 + (UBITS(bit_buf, 8) - 4);
+
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+
+ /* escape code */
+
+ i += UBITS(bit_buf << 6, 6) - 64;
+ if(i >= 64)
+ break; /* illegal, check needed to avoid buffer overflow */
+
+ j = scan[i];
+
+ DUMPBITS(12);
+ NEEDBITS;
+ val = SBITS(bit_buf, 8);
+ if(!(val & 0x7f))
+ {
+ DUMPBITS(8);
+ val = UBITS(bit_buf, 8) + 2 * val;
+ }
+ val = 2 * (val + SBITS(val, 1)) + 1;
+ val = (val * quantizer_scale * quant_matrix[j]) / 32;
+
+ /* oddification */
+ val = (val + ~SBITS(val, 1)) | 1;
+
+ SATURATE(val);
+ dest[j] = val;
+
+ DUMPBITS(8);
+ NEEDBITS;
+
+ continue;
+ }
+ else if(bit_buf >= 0x02000000)
+ {
+ tab = DCT_B14_10 + (UBITS(bit_buf, 10) - 8);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00800000)
+ {
+ tab = DCT_13 + (UBITS(bit_buf, 13) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else if(bit_buf >= 0x00200000)
+ {
+ tab = DCT_15 + (UBITS(bit_buf, 15) - 16);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+ else
+ {
+ tab = DCT_16 + UBITS(bit_buf, 16);
+ bit_buf <<= 16;
+ GETWORD (bit_buf, bits + 16, bit_ptr);
+ i += tab->run;
+ if(i < 64)
+ goto normal_code;
+ }
+
+ break; /* illegal, check needed to avoid buffer overflow */
+ }
+
+ DUMPBITS(2); /* dump end of block code */
+ m_bitstream_buf = bit_buf;
+ m_bitstream_bits = bits;
+ m_bitstream_ptr = bit_ptr;
+
+ return i;
+}
+
+#define bit_buf (m_bitstream_buf)
+#define bits (m_bitstream_bits)
+#define bit_ptr (m_bitstream_ptr)
+
+void CMpeg2Decoder::slice_intra_DCT(const int cc, uint8_t* dest, int stride)
+{
+ NEEDBITS;
+
+ /* Get the intra DC coefficient and inverse quantize it */
+ m_dc_dct_pred[cc] += (cc == 0)
+ ? get_luma_dc_dct_diff()
+ : get_chroma_dc_dct_diff();
+
+ m_DCTblock[0] = m_dc_dct_pred[cc] << (3 - m_intra_dc_precision);
+
+ if(m_mpeg1)
+ {
+ if(m_coding_type != D_TYPE)
+ get_mpeg1_intra_block();
+ }
+ else if(m_intra_vlc_format)
+ {
+ get_intra_block_B15();
+ }
+ else
+ {
+ get_intra_block_B14();
+ }
+
+ m_idct_copy(m_DCTblock, dest, stride);
+}
+
+void CMpeg2Decoder::slice_non_intra_DCT(uint8_t* dest, int stride)
+{
+ int last = m_mpeg1
+ ? get_mpeg1_non_intra_block()
+ : get_non_intra_block ();
+
+ m_idct_add(last, m_DCTblock, dest, stride);
+}
+
+void CMpeg2Decoder::MOTION(
+ mpeg2_mc_fct * const * const table, uint8_t** ref,
+ int motion_x, int motion_y,
+ unsigned int size, unsigned int y, unsigned int limit_y)
+{
+ unsigned int pos_x, pos_y, xy_half, offset, dest_offset;
+
+ pos_x = 2 * m_offset + motion_x;
+ pos_y = 2 * m_v_offset + motion_y + 2 * y;
+
+ if(pos_x > m_limit_x)
+ {
+ pos_x = ((int)pos_x < 0) ? 0 : m_limit_x;
+ motion_x = pos_x - 2 * m_offset;
+ }
+
+ if(pos_y > limit_y)
+ {
+ pos_y = ((int)pos_y < 0) ? 0 : limit_y;
+ motion_y = pos_y - 2 * m_v_offset - 2 * y;
+ }
+
+ xy_half = ((pos_y & 1) << 1) | (pos_x & 1);
+ offset = (pos_x >> 1) + (pos_y >> 1) * m_stride;
+ table[xy_half] (m_dest[0] + y * m_stride + m_offset, ref[0] + offset, m_stride, size);
+
+ motion_x /= 2; motion_y /= 2;
+
+ xy_half = ((motion_y & 1) << 1) | (motion_x & 1);
+ offset = ((m_offset + motion_x) >> 1) + ((((m_v_offset + motion_y) >> 1) + y/2) * m_uv_stride);
+ dest_offset = y/2 * m_uv_stride + (m_offset >> 1);
+ table[4+xy_half] (m_dest[1] + dest_offset, ref[1] + offset, m_uv_stride, size/2);
+ table[4+xy_half] (m_dest[2] + dest_offset, ref[2] + offset, m_uv_stride, size/2);
+}
+
+void CMpeg2Decoder::MOTION_FIELD(
+ mpeg2_mc_fct * const * const table, uint8_t** ref,
+ int motion_x, int motion_y,
+ int dest_field, int src_field, unsigned int op)
+{
+ unsigned int pos_x, pos_y, xy_half, offset, dest_offset;
+
+ pos_x = 2 * m_offset + motion_x;
+ pos_y = m_v_offset + motion_y;
+
+ if(pos_x > m_limit_x)
+ {
+ pos_x = ((int)pos_x < 0) ? 0 : m_limit_x;
+ motion_x = pos_x - 2 * m_offset;
+ }
+
+ if(pos_y > m_limit_y)
+ {
+ pos_y = ((int)pos_y < 0) ? 0 : m_limit_y;
+ motion_y = pos_y - m_v_offset;
+ }
+
+ xy_half = ((pos_y & 1) << 1) | (pos_x & 1);
+ offset = (pos_x >> 1) + ((op ? (pos_y | 1) : (pos_y & ~1)) + src_field) * m_stride;
+ table[xy_half] (m_dest[0] + dest_field * m_stride + m_offset, ref[0] + offset, 2 * m_stride, 8);
+
+ motion_x /= 2; motion_y /= 2;
+
+ xy_half = ((motion_y & 1) << 1) | (motion_x & 1);
+ offset = ((m_offset + motion_x) >> 1) + (((m_v_offset >> 1) + (op ? (motion_y | 1) :(motion_y & ~1)) + src_field) * m_uv_stride);
+ dest_offset = dest_field * m_uv_stride + (m_offset >> 1);
+ table[4+xy_half] (m_dest[1] + dest_offset, ref[1] + offset, 2 * m_uv_stride, 4);
+ table[4+xy_half] (m_dest[2] + dest_offset, ref[2] + offset, 2 * m_uv_stride, 4);
+}
+
+void CMpeg2Decoder::motion_mp1(motion_t* motion, mpeg2_mc_fct * const * const table)
+{
+ int motion_x, motion_y;
+
+ NEEDBITS;
+ motion_x = motion->pmv[0][0] + (get_motion_delta(motion->f_code[0]) << motion->f_code[1]);
+ motion_x = bound_motion_vector(motion_x, motion->f_code[0] + motion->f_code[1]);
+ motion->pmv[0][0] = motion_x;
+
+ NEEDBITS;
+ motion_y = motion->pmv[0][1] + (get_motion_delta(motion->f_code[0]) << motion->f_code[1]);
+ motion_y = bound_motion_vector(motion_y, motion->f_code[0] + motion->f_code[1]);
+ motion->pmv[0][1] = motion_y;
+
+ MOTION(table, motion->ref[0], motion_x, motion_y, 16, 0, m_limit_y_16);
+}
+
+void CMpeg2Decoder::motion_fr_frame(motion_t* motion, mpeg2_mc_fct * const * const table)
+{
+ int motion_x, motion_y;
+
+ NEEDBITS;
+ motion_x = motion->pmv[0][0] + get_motion_delta(motion->f_code[0]);
+ motion_x = bound_motion_vector(motion_x, motion->f_code[0]);
+ motion->pmv[1][0] = motion->pmv[0][0] = motion_x;
+
+ NEEDBITS;
+ motion_y = motion->pmv[0][1] + get_motion_delta(motion->f_code[1]);
+ motion_y = bound_motion_vector (motion_y, motion->f_code[1]);
+ motion->pmv[1][1] = motion->pmv[0][1] = motion_y;
+
+ MOTION(table, motion->ref[0], motion_x, motion_y, 16, 0, m_limit_y_16);
+}
+
+void CMpeg2Decoder::motion_fr_field(motion_t* motion, mpeg2_mc_fct * const * const table)
+{
+ int motion_x, motion_y, field;
+
+ NEEDBITS;
+ field = UBITS(bit_buf, 1);
+ DUMPBITS(1);
+
+ motion_x = motion->pmv[0][0] + get_motion_delta(motion->f_code[0]);
+ motion_x = bound_motion_vector(motion_x, motion->f_code[0]);
+ motion->pmv[0][0] = motion_x;
+
+ NEEDBITS;
+ motion_y = (motion->pmv[0][1] >> 1) + get_motion_delta(motion->f_code[1]);
+ /* motion_y = bound_motion_vector(motion_y, motion->f_code[1]); */
+ motion->pmv[0][1] = motion_y << 1;
+
+ MOTION_FIELD(table, motion->ref[0], motion_x, motion_y, 0, field, 0);
+
+ NEEDBITS;
+ field = UBITS(bit_buf, 1);
+ DUMPBITS(1);
+
+ motion_x = motion->pmv[1][0] + get_motion_delta(motion->f_code[0]);
+ motion_x = bound_motion_vector(motion_x, motion->f_code[0]);
+ motion->pmv[1][0] = motion_x;
+
+ NEEDBITS;
+ motion_y = (motion->pmv[1][1] >> 1) + get_motion_delta(motion->f_code[1]);
+ /* motion_y = bound_motion_vector(motion_y, motion->f_code[1]); */
+ motion->pmv[1][1] = motion_y << 1;
+
+ MOTION_FIELD(table, motion->ref[0], motion_x, motion_y, 1, field, 0);
+}
+
+void CMpeg2Decoder::motion_fr_dmv(motion_t* motion, mpeg2_mc_fct * const * const table)
+{
+ int motion_x, motion_y, dmv_x, dmv_y, m, other_x, other_y;
+
+ NEEDBITS;
+ motion_x = motion->pmv[0][0] + get_motion_delta(motion->f_code[0]);
+ motion_x = bound_motion_vector(motion_x, motion->f_code[0]);
+ motion->pmv[1][0] = motion->pmv[0][0] = motion_x;
+ NEEDBITS;
+ dmv_x = get_dmv();
+
+ motion_y = (motion->pmv[0][1] >> 1) + get_motion_delta(motion->f_code[1]);
+ /* motion_y = bound_motion_vector (motion_y, motion->f_code[1]); */
+ motion->pmv[1][1] = motion->pmv[0][1] = motion_y << 1;
+ dmv_y = get_dmv();
+
+ m = m_top_field_first ? 1 : 3;
+ other_x = ((motion_x * m + (motion_x > 0)) >> 1) + dmv_x;
+ other_y = ((motion_y * m + (motion_y > 0)) >> 1) + dmv_y - 1;
+ MOTION_FIELD(m_mc->put, motion->ref[0], other_x, other_y, 0, 0, 1);
+
+ m = m_top_field_first ? 3 : 1;
+ other_x = ((motion_x * m + (motion_x > 0)) >> 1) + dmv_x;
+ other_y = ((motion_y * m + (motion_y > 0)) >> 1) + dmv_y + 1;
+ MOTION_FIELD(m_mc->put, motion->ref[0], other_x, other_y, 1, 0, 0);
+
+ unsigned int pos_x, pos_y, xy_half, offset;
+
+ pos_x = 2 * m_offset + motion_x;
+ pos_y = m_v_offset + motion_y;
+ if(pos_x > m_limit_x)
+ {
+ pos_x = ((int)pos_x < 0) ? 0 : m_limit_x;
+ motion_x = pos_x - 2 * m_offset;
+ }
+ if(pos_y > m_limit_y)
+ {
+ pos_y = ((int)pos_y < 0) ? 0 : m_limit_y;
+ motion_y = pos_y - m_v_offset;
+ }
+
+ xy_half = ((pos_y & 1) << 1) | (pos_x & 1);
+ offset = (pos_x >> 1) + (pos_y & ~1) * m_stride;
+ m_mc->avg[xy_half](m_dest[0] + m_offset, motion->ref[0][0] + offset, 2 * m_stride, 8);
+ m_mc->avg[xy_half](m_dest[0] + m_stride + m_offset, motion->ref[0][0] + m_stride + offset, 2 * m_stride, 8);
+ motion_x /= 2;
+ motion_y /= 2;
+ xy_half = ((motion_y & 1) << 1) | (motion_x & 1);
+ offset = ((m_offset + motion_x) >> 1) + ((m_v_offset >> 1) + (motion_y & ~1)) * m_uv_stride;
+ m_mc->avg[4+xy_half](m_dest[1] + (m_offset >> 1), motion->ref[0][1] + offset, 2 * m_uv_stride, 4);
+ m_mc->avg[4+xy_half](m_dest[1] + m_uv_stride + (m_offset >> 1), motion->ref[0][1] + m_uv_stride + offset, 2 * m_uv_stride, 4);
+ m_mc->avg[4+xy_half](m_dest[2] + (m_offset >> 1), motion->ref[0][2] + offset, 2 * m_uv_stride, 4);
+ m_mc->avg[4+xy_half](m_dest[2] + m_uv_stride + (m_offset >> 1), motion->ref[0][2] + m_uv_stride + offset, 2 * m_uv_stride, 4);
+}
+
+void CMpeg2Decoder::motion_reuse(motion_t* motion, mpeg2_mc_fct * const * const table)
+{
+ int motion_x, motion_y;
+
+ motion_x = motion->pmv[0][0];
+ motion_y = motion->pmv[0][1];
+
+ MOTION(table, motion->ref[0], motion_x, motion_y, 16, 0, m_limit_y_16);
+}
+
+void CMpeg2Decoder::motion_zero(motion_t* motion, mpeg2_mc_fct * const * const table)
+{
+ unsigned int offset;
+
+ table[0](m_dest[0] + m_offset, motion->ref[0][0] + m_offset + m_v_offset * m_stride, m_stride, 16);
+ offset = (m_offset >> 1) + (m_v_offset >> 1) * m_uv_stride;
+ table[4](m_dest[1] + (m_offset >> 1), motion->ref[0][1] + offset, m_uv_stride, 8);
+ table[4](m_dest[2] + (m_offset >> 1), motion->ref[0][2] + offset, m_uv_stride, 8);
+}
+
+/* like motion_frame, but parsing without actual motion compensation */
+void CMpeg2Decoder::motion_fr_conceal()
+{
+ int tmp;
+
+ NEEDBITS;
+ tmp = (m_f_motion.pmv[0][0] + get_motion_delta(m_f_motion.f_code[0]));
+ tmp = bound_motion_vector(tmp, m_f_motion.f_code[0]);
+ m_f_motion.pmv[1][0] = m_f_motion.pmv[0][0] = tmp;
+
+ NEEDBITS;
+ tmp = m_f_motion.pmv[0][1] + get_motion_delta(m_f_motion.f_code[1]);
+ tmp = bound_motion_vector(tmp, m_f_motion.f_code[1]);
+ m_f_motion.pmv[1][1] = m_f_motion.pmv[0][1] = tmp;
+
+ DUMPBITS(1); /* remove marker_bit */
+}
+
+void CMpeg2Decoder::motion_fi_field(motion_t * motion, mpeg2_mc_fct * const * const table)
+{
+ int motion_x, motion_y;
+ uint8_t** ref_field;
+
+ NEEDBITS;
+ ref_field = motion->ref2[UBITS(bit_buf, 1)];
+ DUMPBITS(1);
+
+ motion_x = motion->pmv[0][0] + get_motion_delta(motion->f_code[0]);
+ motion_x = bound_motion_vector (motion_x, motion->f_code[0]);
+ motion->pmv[1][0] = motion->pmv[0][0] = motion_x;
+
+ NEEDBITS;
+ motion_y = motion->pmv[0][1] + get_motion_delta(motion->f_code[1]);
+ motion_y = bound_motion_vector(motion_y, motion->f_code[1]);
+ motion->pmv[1][1] = motion->pmv[0][1] = motion_y;
+
+ MOTION(table, ref_field, motion_x, motion_y, 16, 0, m_limit_y_16);
+}
+
+void CMpeg2Decoder::motion_fi_16x8(motion_t* motion, mpeg2_mc_fct * const * const table)
+{
+ int motion_x, motion_y;
+ uint8_t** ref_field;
+
+ NEEDBITS;
+ ref_field = motion->ref2[UBITS(bit_buf, 1)];
+ DUMPBITS(1);
+
+ motion_x = motion->pmv[0][0] + get_motion_delta(motion->f_code[0]);
+ motion_x = bound_motion_vector(motion_x, motion->f_code[0]);
+ motion->pmv[0][0] = motion_x;
+
+ NEEDBITS;
+ motion_y = motion->pmv[0][1] + get_motion_delta(motion->f_code[1]);
+ motion_y = bound_motion_vector(motion_y, motion->f_code[1]);
+ motion->pmv[0][1] = motion_y;
+
+ MOTION(table, ref_field, motion_x, motion_y, 8, 0, m_limit_y_8);
+
+ NEEDBITS;
+ ref_field = motion->ref2[UBITS(bit_buf, 1)];
+ DUMPBITS(1);
+
+ motion_x = motion->pmv[1][0] + get_motion_delta(motion->f_code[0]);
+ motion_x = bound_motion_vector (motion_x, motion->f_code[0]);
+ motion->pmv[1][0] = motion_x;
+
+ NEEDBITS;
+ motion_y = motion->pmv[1][1] + get_motion_delta(motion->f_code[1]);
+ motion_y = bound_motion_vector(motion_y, motion->f_code[1]);
+ motion->pmv[1][1] = motion_y;
+
+ MOTION(table, ref_field, motion_x, motion_y, 8, 8, m_limit_y_8);
+}
+
+void CMpeg2Decoder::motion_fi_dmv(motion_t* motion, mpeg2_mc_fct * const * const table)
+{
+ int motion_x, motion_y, other_x, other_y;
+
+ NEEDBITS;
+ motion_x = motion->pmv[0][0] + get_motion_delta(motion->f_code[0]);
+ motion_x = bound_motion_vector(motion_x, motion->f_code[0]);
+ motion->pmv[1][0] = motion->pmv[0][0] = motion_x;
+ NEEDBITS;
+ other_x = ((motion_x + (motion_x > 0)) >> 1) + get_dmv();
+
+ motion_y = motion->pmv[0][1] + get_motion_delta(motion->f_code[1]);
+ motion_y = bound_motion_vector(motion_y, motion->f_code[1]);
+ motion->pmv[1][1] = motion->pmv[0][1] = motion_y;
+ other_y = ((motion_y + (motion_y > 0)) >> 1) + get_dmv () + m_dmv_offset;
+
+ MOTION(m_mc->put, motion->ref[0], motion_x, motion_y, 16, 0, m_limit_y_16);
+ MOTION(m_mc->avg, motion->ref[1], other_x, other_y, 16, 0, m_limit_y_16);
+}
+
+void CMpeg2Decoder::motion_fi_conceal()
+{
+ int tmp;
+
+ NEEDBITS;
+ DUMPBITS(1); /* remove field_select */
+
+ tmp = m_f_motion.pmv[0][0] + get_motion_delta (m_f_motion.f_code[0]);
+ tmp = bound_motion_vector(tmp, m_f_motion.f_code[0]);
+ m_f_motion.pmv[1][0] = m_f_motion.pmv[0][0] = tmp;
+
+ NEEDBITS;
+ tmp = m_f_motion.pmv[0][1] + get_motion_delta(m_f_motion.f_code[1]);
+ tmp = bound_motion_vector(tmp, m_f_motion.f_code[1]);
+ m_f_motion.pmv[1][1] = m_f_motion.pmv[0][1] = tmp;
+
+ DUMPBITS(1); /* remove marker_bit */
+}
+
+#define MOTION_CALL(routine, direction) \
+do { \
+ if((direction) & MACROBLOCK_MOTION_FORWARD) \
+ routine(&m_f_motion, m_mc->put); \
+ if((direction) & MACROBLOCK_MOTION_BACKWARD) \
+ routine(&m_b_motion, (direction & MACROBLOCK_MOTION_FORWARD) ? m_mc->avg : m_mc->put); \
+} while (0)
+
+#define NEXT_MACROBLOCK \
+do { \
+ m_offset += 16; \
+ if(m_offset == m_width) { \
+ m_dest[0] += 16 * m_stride; \
+ m_dest[1] += 4 * m_stride; \
+ m_dest[2] += 4 * m_stride; \
+ m_v_offset += 16; \
+ if(m_v_offset > m_limit_y) \
+ return; \
+ m_offset = 0; \
+ } \
+} while (0)
+
+void CMpeg2Decoder::mpeg2_init_fbuf(uint8_t* current_fbuf[3], uint8_t* forward_fbuf[3], uint8_t* backward_fbuf[3])
+{
+ int offset, stride, height, bottom_field;
+
+ stride = m_width;
+ bottom_field = (m_picture_structure == BOTTOM_FIELD);
+ offset = bottom_field ? stride : 0;
+ height = m_height;
+
+ m_picture_dest[0] = current_fbuf[0] + offset;
+ m_picture_dest[1] = current_fbuf[1] + (offset >> 1);
+ m_picture_dest[2] = current_fbuf[2] + (offset >> 1);
+
+ m_f_motion.ref[0][0] = forward_fbuf[0] + offset;
+ m_f_motion.ref[0][1] = forward_fbuf[1] + (offset >> 1);
+ m_f_motion.ref[0][2] = forward_fbuf[2] + (offset >> 1);
+
+ m_b_motion.ref[0][0] = backward_fbuf[0] + offset;
+ m_b_motion.ref[0][1] = backward_fbuf[1] + (offset >> 1);
+ m_b_motion.ref[0][2] = backward_fbuf[2] + (offset >> 1);
+
+ if(m_picture_structure != FRAME_PICTURE)
+ {
+ m_dmv_offset = bottom_field ? 1 : -1;
+ m_f_motion.ref2[0] = m_f_motion.ref[bottom_field];
+ m_f_motion.ref2[1] = m_f_motion.ref[!bottom_field];
+ m_b_motion.ref2[0] = m_b_motion.ref[bottom_field];
+ m_b_motion.ref2[1] = m_b_motion.ref[!bottom_field];
+ offset = stride - offset;
+
+ if(m_second_field && (m_coding_type != B_TYPE))
+ forward_fbuf = current_fbuf;
+
+ m_f_motion.ref[1][0] = forward_fbuf[0] + offset;
+ m_f_motion.ref[1][1] = forward_fbuf[1] + (offset >> 1);
+ m_f_motion.ref[1][2] = forward_fbuf[2] + (offset >> 1);
+
+ m_b_motion.ref[1][0] = backward_fbuf[0] + offset;
+ m_b_motion.ref[1][1] = backward_fbuf[1] + (offset >> 1);
+ m_b_motion.ref[1][2] = backward_fbuf[2] + (offset >> 1);
+
+ stride <<= 1;
+ height >>= 1;
+ }
+
+ m_stride = stride;
+ m_uv_stride = stride >> 1;
+ m_limit_x = 2 * m_width - 32;
+ m_limit_y_16 = 2 * height - 32;
+ m_limit_y_8 = 2 * height - 16;
+ m_limit_y = height - 16;
+}
+
+int CMpeg2Decoder::slice_init(int code)
+{
+ int offset;
+ const MBAtab* mba;
+
+ m_dc_dct_pred[0] = m_dc_dct_pred[1] =
+ m_dc_dct_pred[2] = 128 << m_intra_dc_precision;
+
+ m_f_motion.pmv[0][0] = m_f_motion.pmv[0][1] = 0;
+ m_f_motion.pmv[1][0] = m_f_motion.pmv[1][1] = 0;
+ m_b_motion.pmv[0][0] = m_b_motion.pmv[0][1] = 0;
+ m_b_motion.pmv[1][0] = m_b_motion.pmv[1][1] = 0;
+
+ if(m_vertical_position_extension)
+ {
+ code += UBITS(bit_buf, 3) << 7;
+ DUMPBITS(3);
+ }
+
+ m_v_offset = (code - 1) * 16;
+ offset = (code - 1) * m_stride * 4;
+
+ m_dest[0] = m_picture_dest[0] + offset * 4;
+ m_dest[1] = m_picture_dest[1] + offset;
+ m_dest[2] = m_picture_dest[2] + offset;
+
+ m_quantizer_scale = get_quantizer_scale();
+
+ /* ignore intra_slice and all the extra data */
+ while(bit_buf & 0x80000000)
+ {
+ DUMPBITS(9);
+ NEEDBITS;
+ }
+
+ /* decode initial macroblock address increment */
+ offset = 0;
+ while(1)
+ {
+ if(bit_buf >= 0x08000000)
+ {
+ mba = MBA_5 + (UBITS(bit_buf, 6) - 2);
+ break;
+ }
+ else if(bit_buf >= 0x01800000)
+ {
+ mba = MBA_11 + (UBITS(bit_buf, 12) - 24);
+ break;
+ }
+ else
+ {
+ switch(UBITS(bit_buf, 12))
+ {
+ case 8: /* macroblock_escape */
+ offset += 33;
+ DUMPBITS(11);
+ NEEDBITS;
+ continue;
+ case 15: /* macroblock_stuffing (MPEG1 only) */
+ bit_buf &= 0xfffff;
+ DUMPBITS(11);
+ NEEDBITS;
+ continue;
+ default: /* error */
+ return 1;
+ }
+ }
+ }
+
+ DUMPBITS(mba->len + 1);
+ m_offset = (offset + mba->mba) << 4;
+
+ while(m_offset - m_width >= 0)
+ {
+ m_offset -= m_width;
+ m_dest[0] += 16 * m_stride;
+ m_dest[1] += 4 * m_stride;
+ m_dest[2] += 4 * m_stride;
+ m_v_offset += 16;
+ }
+
+ if(m_v_offset > m_limit_y)
+ return 1;
+
+ return 0;
+}
+
+void CMpeg2Decoder::mpeg2_slice(int code, const uint8_t* buffer)
+{
+ m_bitstream_buf = (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
+ m_bitstream_ptr = buffer + 4;
+ m_bitstream_bits = -16;
+
+ if(slice_init(code))
+ return;
+
+ while(1)
+ {
+ int macroblock_modes;
+ int mba_inc;
+ const MBAtab * mba;
+
+ NEEDBITS;
+
+ macroblock_modes = get_macroblock_modes();
+
+ /* maybe integrate MACROBLOCK_QUANT test into get_macroblock_modes ? */
+ if(macroblock_modes & MACROBLOCK_QUANT)
+ m_quantizer_scale = get_quantizer_scale();
+
+ if(macroblock_modes & MACROBLOCK_INTRA)
+ {
+ int DCT_offset, DCT_stride;
+ int offset;
+ uint8_t* dest_y;
+
+ if(m_concealment_motion_vectors)
+ {
+ if(m_picture_structure == FRAME_PICTURE) motion_fr_conceal();
+ else motion_fi_conceal();
+ }
+ else
+ {
+ m_f_motion.pmv[0][0] = m_f_motion.pmv[0][1] = 0;
+ m_f_motion.pmv[1][0] = m_f_motion.pmv[1][1] = 0;
+ m_b_motion.pmv[0][0] = m_b_motion.pmv[0][1] = 0;
+ m_b_motion.pmv[1][0] = m_b_motion.pmv[1][1] = 0;
+ }
+
+ if(macroblock_modes & DCT_TYPE_INTERLACED)
+ {
+ DCT_offset = m_stride;
+ DCT_stride = m_stride * 2;
+ }
+ else
+ {
+ DCT_offset = m_stride * 8;
+ DCT_stride = m_stride;
+ }
+
+ offset = m_offset;
+ dest_y = m_dest[0] + offset;
+ slice_intra_DCT(0, dest_y, DCT_stride);
+ slice_intra_DCT(0, dest_y + 8, DCT_stride);
+ slice_intra_DCT(0, dest_y + DCT_offset, DCT_stride);
+ slice_intra_DCT(0, dest_y + DCT_offset + 8, DCT_stride);
+ slice_intra_DCT(1, m_dest[1] + (offset >> 1), m_uv_stride);
+ slice_intra_DCT (2, m_dest[2] + (offset >> 1), m_uv_stride);
+
+ if(m_coding_type == D_TYPE)
+ {
+ NEEDBITS;
+ DUMPBITS(1);
+ }
+ }
+ else
+ {
+ if(m_picture_structure == FRAME_PICTURE)
+ {
+ switch((macroblock_modes >> 6) & 3) // macroblock_modes & MOTION_TYPE_MASK
+ {
+ case 0:
+ // non-intra mb without forward mv in a P picture //
+ m_f_motion.pmv[0][0] = 0;
+ m_f_motion.pmv[0][1] = 0;
+ m_f_motion.pmv[1][0] = 0;
+ m_f_motion.pmv[1][1] = 0;
+ MOTION_CALL(motion_zero, MACROBLOCK_MOTION_FORWARD);
+ break;
+
+ case 1: // MC_FIELD:
+ MOTION_CALL(motion_fr_field, macroblock_modes);
+ break;
+
+ case 2: // MC_FRAME:
+
+ if(m_mpeg1) MOTION_CALL(motion_mp1, macroblock_modes);
+ else MOTION_CALL (motion_fr_frame, macroblock_modes);
+ break;
+
+ case 3: // MC_DMV:
+ MOTION_CALL(motion_fr_dmv, MACROBLOCK_MOTION_FORWARD);
+ break;
+
+ default:
+ __assume(0);
+ }
+ }
+ else
+ {
+ switch((macroblock_modes >> 6) & 3) // macroblock_modes & MOTION_TYPE_MASK
+ {
+ case 0:
+ /* non-intra mb without forward mv in a P picture */
+ m_f_motion.pmv[0][0] = 0;
+ m_f_motion.pmv[0][1] = 0;
+ m_f_motion.pmv[1][0] = 0;
+ m_f_motion.pmv[1][1] = 0;
+ MOTION_CALL(motion_zero, MACROBLOCK_MOTION_FORWARD);
+ break;
+
+ case 1: // MC_FIELD
+ MOTION_CALL(motion_fi_field, macroblock_modes);
+ break;
+
+ case 2: // MC_16X8
+ MOTION_CALL(motion_fi_16x8, macroblock_modes);
+ break;
+
+ case 3: // MC_DMV
+ MOTION_CALL(motion_fi_dmv, MACROBLOCK_MOTION_FORWARD);
+ break;
+
+ default:
+ __assume(0);
+ }
+ }
+
+ if(macroblock_modes & MACROBLOCK_PATTERN)
+ {
+ int coded_block_pattern;
+ int DCT_offset, DCT_stride;
+ int offset;
+ uint8_t* dest_y;
+
+ if(macroblock_modes & DCT_TYPE_INTERLACED)
+ {
+ DCT_offset = m_stride;
+ DCT_stride = m_stride * 2;
+ }
+ else
+ {
+ DCT_offset = m_stride * 8;
+ DCT_stride = m_stride;
+ }
+
+ coded_block_pattern = get_coded_block_pattern();
+
+ offset = m_offset;
+ dest_y = m_dest[0] + offset;
+
+ if(coded_block_pattern & 0x20)
+ slice_non_intra_DCT(dest_y, DCT_stride);
+ if(coded_block_pattern & 0x10)
+ slice_non_intra_DCT(dest_y + 8, DCT_stride);
+ if(coded_block_pattern & 0x08)
+ slice_non_intra_DCT(dest_y + DCT_offset, DCT_stride);
+ if(coded_block_pattern & 0x04)
+ slice_non_intra_DCT(dest_y + DCT_offset + 8, DCT_stride);
+ if(coded_block_pattern & 0x2)
+ slice_non_intra_DCT(m_dest[1] + (offset >> 1), m_uv_stride);
+ if(coded_block_pattern & 0x1)
+ slice_non_intra_DCT(m_dest[2] + (offset >> 1), m_uv_stride);
+ }
+
+ m_dc_dct_pred[0] =
+ m_dc_dct_pred[1] =
+ m_dc_dct_pred[2] = 128 << m_intra_dc_precision;
+ }
+
+ NEXT_MACROBLOCK;
+
+ NEEDBITS;
+ mba_inc = 0;
+ while(1)
+ {
+ if(bit_buf >= 0x10000000)
+ {
+ mba = MBA_5 + (UBITS(bit_buf, 5) - 2);
+ break;
+ }
+ else if(bit_buf >= 0x03000000)
+ {
+ mba = MBA_11 + (UBITS(bit_buf, 11) - 24);
+ break;
+ }
+ else
+ {
+ switch(UBITS(bit_buf, 11))
+ {
+ case 8: /* macroblock_escape */
+ mba_inc += 33;
+ /* pass through */
+ case 15: /* macroblock_stuffing (MPEG1 only) */
+ DUMPBITS(11);
+ NEEDBITS;
+ continue;
+ default: /* end of slice, or error */
+ return;
+ }
+ }
+ }
+
+ DUMPBITS(mba->len);
+ mba_inc += mba->mba;
+
+ if(mba_inc)
+ {
+ m_dc_dct_pred[0] =
+ m_dc_dct_pred[1] =
+ m_dc_dct_pred[2] = 128 << m_intra_dc_precision;
+
+ if(m_coding_type == P_TYPE)
+ {
+ m_f_motion.pmv[0][0] = m_f_motion.pmv[0][1] = 0;
+ m_f_motion.pmv[1][0] = m_f_motion.pmv[1][1] = 0;
+
+ do {
+ MOTION_CALL(motion_zero, MACROBLOCK_MOTION_FORWARD);
+ NEXT_MACROBLOCK;
+ } while(--mba_inc);
+ }
+ else
+ {
+ do {
+ MOTION_CALL (motion_reuse, macroblock_modes);
+ NEXT_MACROBLOCK;
+ } while(--mba_inc);
+ }
+ }
+ }
+}
+
+#undef bit_buf
+#undef bits
+#undef bit_ptr
+
+///////////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////////////////
+
+CMpeg2Info::CMpeg2Info()
+{
+ m_sequence = NULL;
+ m_gop = NULL;
+ Reset();
+}
+
+CMpeg2Info::~CMpeg2Info()
+{
+}
+
+void CMpeg2Info::Reset()
+{
+ m_current_picture = m_current_picture_2nd = NULL;
+ m_display_picture = m_display_picture_2nd = NULL;
+ m_current_fbuf = m_display_fbuf = m_discard_fbuf = NULL;
+ m_user_data = NULL;
+ m_user_data_len = 0;
+}
+
diff --git a/src/filters/transform/mpeg2decfilter/libmpeg2.h b/src/filters/transform/mpeg2decfilter/libmpeg2.h
new file mode 100644
index 000000000..76c425ef1
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/libmpeg2.h
@@ -0,0 +1,403 @@
+/*
+ * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
+ * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
+ * See http://libmpeg2.sourceforge.net/ for updates.
+ *
+ * mpeg2dec 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * mpeg2dec 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
+ */
+
+#pragma once
+
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed int int32_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+
+#define MPEG2_VERSION(a,b,c) (((a)<<16)|((b)<<8)|(c))
+#define MPEG2_RELEASE MPEG2_VERSION (0, 3, 2) /* 0.3.2 */
+
+#define SEQ_FLAG_MPEG2 1
+#define SEQ_FLAG_CONSTRAINED_PARAMETERS 2
+#define SEQ_FLAG_PROGRESSIVE_SEQUENCE 4
+#define SEQ_FLAG_LOW_DELAY 8
+#define SEQ_FLAG_COLOUR_DESCRIPTION 16
+
+#define SEQ_MASK_VIDEO_FORMAT 0xe0
+#define SEQ_VIDEO_FORMAT_COMPONENT 0
+#define SEQ_VIDEO_FORMAT_PAL 0x20
+#define SEQ_VIDEO_FORMAT_NTSC 0x40
+#define SEQ_VIDEO_FORMAT_SECAM 0x60
+#define SEQ_VIDEO_FORMAT_MAC 0x80
+#define SEQ_VIDEO_FORMAT_UNSPECIFIED 0xa0
+
+typedef struct {
+ unsigned int width, height;
+ unsigned int chroma_width, chroma_height;
+ unsigned int byte_rate;
+ unsigned int vbv_buffer_size;
+ uint32_t flags;
+
+ unsigned int picture_width, picture_height;
+ unsigned int display_width, display_height;
+ unsigned int pixel_width, pixel_height;
+ unsigned int frame_period;
+
+ uint8_t profile_level_id;
+ uint8_t colour_primaries;
+ uint8_t transfer_characteristics;
+ uint8_t matrix_coefficients;
+
+ void finalize();
+} mpeg2_sequence_t;
+
+#define GOP_FLAG_DROP_FRAME 1
+#define GOP_FLAG_BROKEN_LINK 2
+#define GOP_FLAG_CLOSED_GOP 4
+
+typedef struct {
+ uint8_t hours;
+ uint8_t minutes;
+ uint8_t seconds;
+ uint8_t pictures;
+ uint32_t flags;
+} mpeg2_gop_t;
+
+#define PIC_MASK_CODING_TYPE 7
+#define PIC_FLAG_CODING_TYPE_I 1
+#define PIC_FLAG_CODING_TYPE_P 2
+#define PIC_FLAG_CODING_TYPE_B 3
+#define PIC_FLAG_CODING_TYPE_D 4
+
+#define PIC_FLAG_TOP_FIELD_FIRST 8
+#define PIC_FLAG_PROGRESSIVE_FRAME 16
+#define PIC_FLAG_COMPOSITE_DISPLAY 32
+#define PIC_FLAG_SKIP 64
+#define PIC_FLAG_PTS 128
+#define PIC_FLAG_REPEAT_FIRST_FIELD 256
+#define PIC_MASK_COMPOSITE_DISPLAY 0xfffff000
+
+typedef struct {
+ unsigned int temporal_reference;
+ unsigned int nb_fields;
+ uint32_t pts;
+ uint32_t flags;
+ struct {
+ int x, y;
+ } display_offset[3];
+ __int64 rtStart, rtStop;
+ bool fDiscontinuity, fDelivered;
+} mpeg2_picture_t;
+
+typedef struct {
+ uint8_t* buf[3];
+ void* id;
+} mpeg2_fbuf_t;
+
+typedef enum {
+ STATE_BUFFER = 0,
+ STATE_SEQUENCE = 1,
+ STATE_SEQUENCE_REPEATED = 2,
+ STATE_GOP = 3,
+ STATE_PICTURE = 4,
+ STATE_SLICE_1ST = 5,
+ STATE_PICTURE_2ND = 6,
+ STATE_SLICE = 7,
+ STATE_END = 8,
+ STATE_INVALID = 9,
+ STATE_PADDING = 10
+} mpeg2_state_t;
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+/* macroblock modes */
+#define MACROBLOCK_INTRA 1
+#define MACROBLOCK_PATTERN 2
+#define MACROBLOCK_MOTION_BACKWARD 4
+#define MACROBLOCK_MOTION_FORWARD 8
+#define MACROBLOCK_QUANT 16
+#define DCT_TYPE_INTERLACED 32
+/* motion_type */
+#define MOTION_TYPE_MASK (3*64)
+#define MOTION_TYPE_BASE 64
+#define MC_FIELD (1*64)
+#define MC_FRAME (2*64)
+#define MC_16X8 (2*64)
+#define MC_DMV (3*64)
+
+/* picture structure */
+#define TOP_FIELD 1
+#define BOTTOM_FIELD 2
+#define FRAME_PICTURE 3
+
+/* picture coding type */
+#define I_TYPE 1
+#define P_TYPE 2
+#define B_TYPE 3
+#define D_TYPE 4
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+typedef void mpeg2_mc_fct(uint8_t*, const uint8_t*, int, int);
+typedef struct {mpeg2_mc_fct* put[8]; mpeg2_mc_fct* avg[8];} mpeg2_mc_t;
+
+class CMpeg2Decoder
+{
+public:
+ /* Motion vectors */
+ /* The f_ and b_ correspond to the forward and backward motion */
+ /* predictors */
+
+ struct motion_t {
+ uint8_t* ref[2][3];
+ uint8_t** ref2[2];
+ int pmv[2][2];
+ int f_code[2];
+ } m_b_motion, m_f_motion;
+
+private:
+ int get_macroblock_modes();
+ int get_quantizer_scale();
+ int get_motion_delta(const int f_code);
+ int bound_motion_vector(const int vector, const int f_code);
+ int get_dmv();
+ int get_coded_block_pattern();
+ int get_luma_dc_dct_diff();
+ int get_chroma_dc_dct_diff();
+
+ void get_intra_block_B14();
+ void get_intra_block_B15();
+ int get_non_intra_block();
+ void get_mpeg1_intra_block();
+ int get_mpeg1_non_intra_block();
+ void slice_intra_DCT(const int cc, uint8_t* dest, int stride);
+ void slice_non_intra_DCT(uint8_t* dest, int stride);
+
+ void MOTION(mpeg2_mc_fct * const * const table, uint8_t** ref, int motion_x, int motion_y, unsigned int size, unsigned int y, unsigned int limit_y);
+ void MOTION_FIELD(mpeg2_mc_fct * const * const table, uint8_t** ref, int motion_x, int motion_y, int dest_field, int src_field, unsigned int op);
+
+ void motion_mp1(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fr_frame(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fr_field(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fr_dmv(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_reuse(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_zero(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fr_conceal();
+ void motion_fi_field(motion_t * motion, mpeg2_mc_fct * const * const table);
+ void motion_fi_16x8(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fi_dmv(motion_t* motion, mpeg2_mc_fct * const * const table);
+ void motion_fi_conceal();
+
+ int slice_init(int code);
+
+ static bool m_idct_initialized;
+ void (*m_idct_init)();
+ void (*m_idct_copy)(int16_t* block, uint8_t* dest, const int stride);
+ void (*m_idct_add)(const int last, int16_t* block, uint8_t* dest, const int stride);
+ mpeg2_mc_t* m_mc;
+
+public:
+ CMpeg2Decoder();
+ virtual ~CMpeg2Decoder();
+
+ void mpeg2_init_fbuf(uint8_t* current_fbuf[3], uint8_t* forward_fbuf[3], uint8_t* backward_fbuf[3]);
+ void mpeg2_slice(int code, const uint8_t* buffer);
+
+ int16_t* m_DCTblock;
+
+ /* bit parsing stuff */
+ uint32_t m_bitstream_buf; /* current 32 bit working set */
+ int m_bitstream_bits; /* used bits in working set */
+ const uint8_t* m_bitstream_ptr; /* buffer with stream data */
+
+ uint8_t* m_dest[3];
+ uint8_t* m_picture_dest[3];
+
+ int m_offset, m_stride, m_uv_stride;
+ unsigned int m_limit_x, m_limit_y_16, m_limit_y_8, m_limit_y;
+
+ /* predictor for DC coefficients in intra blocks */
+ int16_t m_dc_dct_pred[3];
+
+ int m_quantizer_scale; /* remove */
+ int m_dmv_offset; /* remove */
+ unsigned int m_v_offset; /* remove */
+
+ /* now non-slice-specific information */
+
+ /* sequence header stuff */
+ uint8_t m_intra_quantizer_matrix[64];
+ uint8_t m_non_intra_quantizer_matrix[64];
+
+ /* The width and height of the picture snapped to macroblock units */
+ int m_width, m_height;
+ int m_vertical_position_extension;
+
+ /* picture header stuff */
+
+ /* what type of picture this is (I, P, B, D) */
+ int m_coding_type;
+
+ /* picture coding extension stuff */
+
+ /* quantization factor for intra dc coefficients */
+ int m_intra_dc_precision;
+ /* top/bottom/both fields */
+ int m_picture_structure;
+ /* bool to indicate all predictions are frame based */
+ int m_frame_pred_frame_dct;
+ /* bool to indicate whether intra blocks have motion vectors */
+ /* (for concealment) */
+ int m_concealment_motion_vectors;
+ /* bit to indicate which quantization table to use */
+ int m_q_scale_type;
+ /* bool to use different vlc tables */
+ int m_intra_vlc_format;
+ /* used for DMV MC */
+ int m_top_field_first;
+
+ /* stuff derived from bitstream */
+
+ /* pointer to the zigzag scan we're supposed to be using */
+ const uint8_t* m_scan;
+
+ int m_second_field;
+
+ int m_mpeg1;
+};
+
+class CMpeg2Info
+{
+public:
+ CMpeg2Info();
+ virtual ~CMpeg2Info();
+
+ void Reset();
+
+ mpeg2_sequence_t* m_sequence;
+ mpeg2_gop_t* m_gop;
+ mpeg2_picture_t* m_current_picture;
+ mpeg2_picture_t* m_current_picture_2nd;
+ mpeg2_fbuf_t* m_current_fbuf;
+ mpeg2_picture_t* m_display_picture;
+ mpeg2_picture_t* m_display_picture_2nd;
+ mpeg2_fbuf_t* m_display_fbuf;
+ mpeg2_fbuf_t* m_discard_fbuf;
+ const uint8_t* m_user_data;
+ int m_user_data_len;
+};
+
+class CMpeg2Dec
+{
+ int skip_chunk(int bytes);
+ int copy_chunk(int bytes);
+ mpeg2_state_t seek_chunk(), seek_header(), seek_sequence();
+
+ int sequence_ext();
+ int sequence_display_ext();
+ int quant_matrix_ext();
+ int copyright_ext();
+ int picture_display_ext();
+ int picture_coding_ext();
+
+public:
+ CMpeg2Dec();
+ virtual ~CMpeg2Dec();
+
+ void mpeg2_init();
+ void mpeg2_close();
+
+ void mpeg2_buffer(uint8_t* start, uint8_t* end);
+ int mpeg2_getpos();
+ mpeg2_state_t mpeg2_parse();
+
+ void mpeg2_skip(int skip);
+ void mpeg2_slice_region(int start, int end);
+
+ void mpeg2_pts(uint32_t pts);
+
+ /* decode.c */
+ mpeg2_state_t mpeg2_seek_sequence();
+ mpeg2_state_t mpeg2_parse_header();
+
+ /* header.c */
+ void mpeg2_header_state_init();
+ int mpeg2_header_sequence();
+ int mpeg2_header_gop();
+ mpeg2_state_t mpeg2_header_picture_start();
+ int mpeg2_header_picture();
+ int mpeg2_header_extension();
+ int mpeg2_header_user_data();
+ void mpeg2_header_matrix_finalize();
+ void mpeg2_header_sequence_finalize();
+ mpeg2_state_t mpeg2_header_slice_start();
+ mpeg2_state_t mpeg2_header_end();
+ void mpeg2_set_fbuf(int coding_type);
+
+ enum {BUFFER_SIZE = 1194 * 1024};
+
+
+ CMpeg2Decoder m_decoder;
+ CMpeg2Info m_info;
+
+ uint32_t m_shift;
+ int m_is_display_initialized;
+ mpeg2_state_t (CMpeg2Dec::* m_action)();
+ mpeg2_state_t m_state;
+ uint32_t m_ext_state;
+
+ /* allocated in init - gcc has problems allocating such big structures */
+ uint8_t* m_chunk_buffer;
+ /* pointer to start of the current chunk */
+ uint8_t* m_chunk_start;
+ /* pointer to current position in chunk_buffer */
+ uint8_t* m_chunk_ptr;
+ /* last start code ? */
+ uint8_t m_code;
+
+ /* PTS */
+ uint32_t m_pts_current, m_pts_previous;
+ int m_num_pts;
+ int m_bytes_since_pts;
+
+ bool m_first;
+ int m_alloc_index;
+ uint8_t m_first_decode_slice;
+ uint8_t m_nb_decode_slices;
+
+ mpeg2_sequence_t m_new_sequence;
+ mpeg2_sequence_t m_sequence;
+ mpeg2_gop_t m_gop;
+ mpeg2_picture_t m_pictures[4];
+ mpeg2_picture_t* m_picture;
+ /*const*/ mpeg2_fbuf_t* m_fbuf[3]; /* 0: current fbuf, 1-2: prediction fbufs */
+
+ mpeg2_fbuf_t m_fbuf_alloc[3];
+
+ uint8_t* m_buf_start;
+ uint8_t* m_buf_end;
+
+ int16_t m_display_offset_x, m_display_offset_y;
+
+ int m_copy_matrix;
+ uint8_t m_intra_quantizer_matrix[64];
+ uint8_t m_non_intra_quantizer_matrix[64];
+};
diff --git a/src/filters/transform/mpeg2decfilter/mc_sse2.cpp b/src/filters/transform/mpeg2decfilter/mc_sse2.cpp
new file mode 100644
index 000000000..444d1a1b8
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/mc_sse2.cpp
@@ -0,0 +1,645 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * Based on Intel's AP-942
+ *
+ */
+
+#include "stdafx.h"
+#include "libmpeg2.h"
+#include <emmintrin.h>
+
+__declspec(align(16)) static BYTE const_1_16_bytes[] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
+
+static void MC_put_o_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov esi, height
+ mov eax, stride
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ MC_put_o_16_sse2_loop:
+
+ movdqu xmm0, [edx]
+ movdqu xmm1, [edx+eax]
+ movdqu xmm2, [edx+edi]
+ movdqu xmm3, [edx+ebx]
+ movdqa [ecx], xmm0
+ movdqa [ecx+eax], xmm1
+ movdqa [ecx+edi], xmm2
+ movdqa [ecx+ebx], xmm3
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_put_o_16_sse2_loop
+ }
+}
+
+static void MC_put_o_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov esi, height
+ mov eax, stride
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ MC_put_o_8_sse2_loop:
+
+ movlpd xmm0, [edx]
+ movlpd xmm1, [edx+eax]
+ movlpd xmm2, [edx+edi]
+ movlpd xmm3, [edx+ebx]
+ movlpd [ecx], xmm0
+ movlpd [ecx+eax], xmm1
+ movlpd [ecx+edi], xmm2
+ movlpd [ecx+ebx], xmm3
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_put_o_8_sse2_loop
+ }
+}
+
+static void MC_put_x_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ MC_put_x_16_sse2_loop:
+
+ movdqu xmm0, [edx]
+ movdqu xmm1, [edx+1]
+ movdqu xmm2, [edx+eax]
+ movdqu xmm3, [edx+eax+1]
+ movdqu xmm4, [edx+edi]
+ movdqu xmm5, [edx+edi+1]
+ movdqu xmm6, [edx+ebx]
+ movdqu xmm7, [edx+ebx+1]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ pavgb xmm4, xmm5
+ pavgb xmm6, xmm7
+ movdqa [ecx], xmm0
+ movdqa [ecx+eax], xmm2
+ movdqa [ecx+edi], xmm4
+ movdqa [ecx+ebx], xmm6
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_put_x_16_sse2_loop
+ }
+}
+
+static void MC_put_x_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ MC_put_x_8_sse2_loop:
+
+ movlpd xmm0, [edx]
+ movlpd xmm1, [edx+1]
+ movhpd xmm0, [edx+eax]
+ movhpd xmm1, [edx+eax+1]
+ movlpd xmm2, [edx+edi]
+ movlpd xmm3, [edx+edi+1]
+ movhpd xmm2, [edx+ebx]
+ movhpd xmm3, [edx+ebx+1]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ movlpd [ecx], xmm0
+ movhpd [ecx+eax], xmm0
+ movlpd [ecx+edi], xmm2
+ movhpd [ecx+ebx], xmm2
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_put_x_8_sse2_loop
+ }
+}
+
+static void MC_put_y_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ movdqu xmm0, [edx]
+
+ MC_put_y_16_sse2_loop:
+
+ movdqu xmm1, [edx+eax]
+ movdqu xmm2, [edx+edi]
+ movdqu xmm3, [edx+ebx]
+ movdqu xmm4, [edx+edi*2]
+ pavgb xmm0, xmm1
+ pavgb xmm1, xmm2
+ pavgb xmm2, xmm3
+ pavgb xmm3, xmm4
+ movdqa [ecx], xmm0
+ movdqa [ecx+eax], xmm1
+ movdqa [ecx+edi], xmm2
+ movdqa [ecx+ebx], xmm3
+ movdqa xmm0, xmm4
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_put_y_16_sse2_loop
+ }
+}
+
+static void MC_put_y_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ movlpd xmm0, [edx]
+
+ MC_put_y_8_sse2_loop:
+
+ movlpd xmm1, [edx+eax]
+ movlpd xmm2, [edx+edi]
+ movlpd xmm3, [edx+ebx]
+ movlpd xmm4, [edx+edi*2]
+ pavgb xmm0, xmm1
+ pavgb xmm1, xmm2
+ pavgb xmm2, xmm3
+ pavgb xmm3, xmm4
+ movlpd [ecx], xmm0
+ movlpd [ecx+eax], xmm1
+ movlpd [ecx+edi], xmm2
+ movlpd [ecx+ebx], xmm3
+ movdqa xmm0, xmm4
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_put_y_8_sse2_loop
+ }
+}
+
+static void MC_put_xy_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+
+ movdqa xmm7, [const_1_16_bytes]
+ movdqu xmm0, [edx]
+ movdqu xmm1, [edx+1]
+
+ MC_put_xy_16_sse2_loop:
+
+ movdqu xmm2, [edx+eax]
+ movdqu xmm3, [edx+eax+1]
+ movdqu xmm4, [edx+edi]
+ movdqu xmm5, [edx+edi+1]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ movdqa xmm1, xmm5
+ pavgb xmm5, xmm4
+ psubusb xmm2, xmm7
+ pavgb xmm0, xmm2
+ pavgb xmm2, xmm5
+ movdqa [ecx], xmm0
+ movdqa xmm0, xmm4
+ movdqa [ecx+eax], xmm2
+ lea edx, [edx+edi]
+ lea ecx, [ecx+edi]
+
+ sub esi, 2
+
+ jg MC_put_xy_16_sse2_loop
+ }
+}
+
+static void MC_put_xy_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+
+ movdqa xmm7, [const_1_16_bytes]
+ movlpd xmm0, [edx]
+ movlpd xmm1, [edx+1]
+
+ MC_put_xy_8_sse2_loop:
+
+ movlpd xmm2, [edx+eax]
+ movlpd xmm3, [edx+eax+1]
+ movlpd xmm4, [edx+edi]
+ movlpd xmm5, [edx+edi+1]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ movdqa xmm1, xmm5
+ pavgb xmm5, xmm4
+ psubusb xmm2, xmm7
+ pavgb xmm0, xmm2
+ pavgb xmm2, xmm5
+ movlpd [ecx], xmm0
+ movdqa xmm0, xmm4
+ movlpd [ecx+eax], xmm2
+ lea edx, [edx+edi]
+ lea ecx, [ecx+edi]
+
+ sub esi, 2
+
+ jg MC_put_xy_8_sse2_loop
+ }
+
+}
+
+static void MC_avg_o_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov esi, height
+ mov eax, stride
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ MC_avg_o_16_sse2_loop:
+
+ movdqu xmm0, [edx]
+ movdqu xmm1, [edx+eax]
+ movdqu xmm2, [edx+edi]
+ movdqu xmm3, [edx+ebx]
+ pavgb xmm0, [ecx]
+ pavgb xmm1, [ecx+eax]
+ pavgb xmm2, [ecx+edi]
+ pavgb xmm3, [ecx+ebx]
+ movdqa [ecx], xmm0
+ movdqa [ecx+eax], xmm1
+ movdqa [ecx+edi], xmm2
+ movdqa [ecx+ebx], xmm3
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_avg_o_16_sse2_loop
+ }
+}
+
+static void MC_avg_o_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov esi, height
+ mov eax, stride
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ MC_avg_o_8_sse2_loop:
+
+ movlpd xmm0, [edx]
+ movhpd xmm0, [edx+eax]
+ movlpd xmm2, [edx+edi]
+ movhpd xmm2, [edx+ebx]
+ movlpd xmm1, [ecx]
+ movhpd xmm1, [ecx+eax]
+ movlpd xmm3, [ecx+edi]
+ movhpd xmm3, [ecx+ebx]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ movlpd [ecx], xmm0
+ movhpd [ecx+eax], xmm0
+ movlpd [ecx+edi], xmm2
+ movhpd [ecx+ebx], xmm2
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_avg_o_8_sse2_loop
+ }
+}
+
+static void MC_avg_x_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ MC_avg_x_16_sse2_loop:
+
+ movdqu xmm0, [edx]
+ movdqu xmm1, [edx+1]
+ movdqu xmm2, [edx+eax]
+ movdqu xmm3, [edx+eax+1]
+ movdqu xmm4, [edx+edi]
+ movdqu xmm5, [edx+edi+1]
+ movdqu xmm6, [edx+ebx]
+ movdqu xmm7, [edx+ebx+1]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ pavgb xmm4, xmm5
+ pavgb xmm6, xmm7
+ pavgb xmm0, [ecx]
+ pavgb xmm2, [ecx+eax]
+ pavgb xmm4, [ecx+edi]
+ pavgb xmm6, [ecx+ebx]
+ movdqa [ecx], xmm0
+ movdqa [ecx+eax], xmm2
+ movdqa [ecx+edi], xmm4
+ movdqa [ecx+ebx], xmm6
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_avg_x_16_sse2_loop
+ }
+}
+
+static void MC_avg_x_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ MC_avg_x_8_sse2_loop:
+
+ movlpd xmm0, [edx]
+ movlpd xmm1, [edx+1]
+ movhpd xmm0, [edx+eax]
+ movhpd xmm1, [edx+eax+1]
+ movlpd xmm2, [edx+edi]
+ movlpd xmm3, [edx+edi+1]
+ movhpd xmm2, [edx+ebx]
+ movhpd xmm3, [edx+ebx+1]
+ movlpd xmm4, [ecx]
+ movhpd xmm4, [ecx+eax]
+ movlpd xmm5, [ecx+edi]
+ movhpd xmm5, [ecx+ebx]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ pavgb xmm0, xmm4
+ pavgb xmm2, xmm5
+ movlpd [ecx], xmm0
+ movhpd [ecx+eax], xmm0
+ movlpd [ecx+edi], xmm2
+ movhpd [ecx+ebx], xmm2
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_avg_x_8_sse2_loop
+ }
+}
+
+static void MC_avg_y_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ movdqu xmm0, [edx]
+
+ MC_avg_y_16_sse2_loop:
+
+ movdqu xmm1, [edx+eax]
+ movdqu xmm2, [edx+edi]
+ movdqu xmm3, [edx+ebx]
+ movdqu xmm4, [edx+edi*2]
+ pavgb xmm0, xmm1
+ pavgb xmm1, xmm2
+ pavgb xmm2, xmm3
+ pavgb xmm3, xmm4
+ pavgb xmm0, [ecx]
+ pavgb xmm1, [ecx+eax]
+ pavgb xmm2, [ecx+edi]
+ pavgb xmm3, [ecx+ebx]
+ movdqa [ecx], xmm0
+ movdqa [ecx+eax], xmm1
+ movdqa [ecx+edi], xmm2
+ movdqa [ecx+ebx], xmm3
+ movdqa xmm0, xmm4
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_avg_y_16_sse2_loop
+ }
+}
+
+static void MC_avg_y_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+ lea ebx, [edi+eax]
+
+ movhpd xmm0, [edx]
+ movlpd xmm0, [edx+eax]
+
+ MC_avg_y_8_sse2_loop:
+
+ movlhps xmm1, xmm0
+ movlpd xmm1, [edx+edi]
+ movlhps xmm2, xmm1
+ movlpd xmm2, [edx+ebx]
+ movlhps xmm3, xmm2
+ movlpd xmm3, [edx+edi*2]
+ movhpd xmm4, [ecx]
+ movlpd xmm4, [ecx+eax]
+ movhpd xmm5, [ecx+edi]
+ movlpd xmm5, [ecx+ebx]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ pavgb xmm0, xmm4
+ pavgb xmm2, xmm5
+ movhpd [ecx], xmm0
+ movlpd [ecx+eax], xmm0
+ movhpd [ecx+edi], xmm2
+ movlpd [ecx+ebx], xmm2
+ movdqa xmm0, xmm3
+ lea edx, [edx+edi*2]
+ lea ecx, [ecx+edi*2]
+
+ sub esi, 4
+
+ jg MC_avg_y_8_sse2_loop
+ }
+}
+
+static void MC_avg_xy_16_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+
+ movdqa xmm7, [const_1_16_bytes]
+ movdqu xmm0, [edx]
+ movdqu xmm1, [edx+1]
+
+ MC_avg_xy_16_sse2_loop:
+
+ movdqu xmm2, [edx+eax]
+ movdqu xmm3, [edx+eax+1]
+ movdqu xmm4, [edx+edi]
+ movdqu xmm5, [edx+edi+1]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ movdqa xmm1, xmm5
+ pavgb xmm5, xmm4
+ psubusb xmm2, xmm7
+ pavgb xmm0, xmm2
+ pavgb xmm2, xmm5
+ pavgb xmm0, [ecx]
+ pavgb xmm2, [ecx+eax]
+ movdqa [ecx], xmm0
+ movdqa xmm0, xmm4
+ movdqa [ecx+eax], xmm2
+ lea edx, [edx+edi]
+ lea ecx, [ecx+edi]
+
+ sub esi, 2
+
+ jg MC_avg_xy_16_sse2_loop
+ }
+}
+
+static void MC_avg_xy_8_sse2(uint8_t* dest, const uint8_t* ref, const int stride, int height)
+{
+ __asm
+ {
+ mov edx, ref
+ mov ecx, dest
+ mov eax, stride
+ mov esi, height
+ lea edi, [eax+eax]
+
+ movdqa xmm7, [const_1_16_bytes]
+ movhpd xmm0, [edx]
+ movlpd xmm0, [edx+eax]
+ movhpd xmm2, [edx+1]
+ movlpd xmm2, [edx+eax+1]
+
+ MC_avg_xy_8_sse2_loop:
+
+ movhpd xmm1, [edx+eax]
+ movlpd xmm1, [edx+edi]
+ movhpd xmm3, [edx+eax+1]
+ movlpd xmm3, [edx+edi+1]
+ pavgb xmm0, xmm1
+ pavgb xmm2, xmm3
+ psubusb xmm0, xmm7
+ pavgb xmm0, xmm2
+ movhpd xmm4, [ecx]
+ movlpd xmm4, [ecx+eax]
+ pavgb xmm0, xmm4
+ movhpd [ecx], xmm0
+ movlpd [ecx+eax], xmm0
+ movdqa xmm0, xmm1
+ movdqa xmm2, xmm3
+ lea edx, [edx+edi]
+ lea ecx, [ecx+edi]
+
+ sub esi, 2
+
+ jg MC_avg_xy_8_sse2_loop
+ }
+}
+
+mpeg2_mc_t mpeg2_mc_sse2 =
+{
+ {MC_put_o_16_sse2, MC_put_x_16_sse2, MC_put_y_16_sse2, MC_put_xy_16_sse2,
+ MC_put_o_8_sse2, MC_put_x_8_sse2, MC_put_y_8_sse2, MC_put_xy_8_sse2},
+ {MC_avg_o_16_sse2, MC_avg_x_16_sse2, MC_avg_y_16_sse2, MC_avg_xy_16_sse2,
+ MC_avg_o_8_sse2, MC_avg_x_8_sse2, MC_avg_y_8_sse2, MC_avg_xy_8_sse2}
+}; \ No newline at end of file
diff --git a/src/filters/transform/mpeg2decfilter/motion_comp_mmx.obj b/src/filters/transform/mpeg2decfilter/motion_comp_mmx.obj
new file mode 100644
index 000000000..6be317582
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/motion_comp_mmx.obj
Binary files differ
diff --git a/src/filters/transform/mpeg2decfilter/resource.h b/src/filters/transform/mpeg2decfilter/resource.h
new file mode 100644
index 000000000..a0608acaf
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by Mpeg2DecFilter.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/src/filters/transform/mpeg2decfilter/stdafx.cpp b/src/filters/transform/mpeg2decfilter/stdafx.cpp
new file mode 100644
index 000000000..4b29d63b8
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// mpeg2decds.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/filters/transform/mpeg2decfilter/stdafx.h b/src/filters/transform/mpeg2decfilter/stdafx.h
new file mode 100644
index 000000000..714c23efc
--- /dev/null
+++ b/src/filters/transform/mpeg2decfilter/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
+#include <amvideo.h>
diff --git a/src/filters/transform/vsfilter/Copy.cpp b/src/filters/transform/vsfilter/Copy.cpp
new file mode 100644
index 000000000..cbdfebf55
--- /dev/null
+++ b/src/filters/transform/vsfilter/Copy.cpp
@@ -0,0 +1,561 @@
+// Copyright 2003-2006 Gabest
+// http://www.gabest.org
+//
+// 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; either version 2 of the License, or
+// (at your option) any later version.
+//
+// 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., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
+// http://www.gnu.org/copyleft/gpl.html
+
+#include "stdafx.h"
+#include <math.h>
+#include "DirectVobSubFilter.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+extern int c2y_yb[256];
+extern int c2y_yg[256];
+extern int c2y_yr[256];
+extern void ColorConvInit();
+
+void BltLineRGB32(DWORD* d, BYTE* sub, int w, const GUID& subtype)
+{
+ if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV)
+ {
+ BYTE* db = (BYTE*)d;
+ BYTE* dbtend = db + w;
+
+ for(; db < dbtend; sub+=4, db++)
+ {
+ if(sub[3] < 0xff)
+ {
+ int y = (c2y_yb[sub[0]] + c2y_yg[sub[1]] + c2y_yr[sub[2]] + 0x108000) >> 16;
+ *db = y; // w/o colors
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_YUY2)
+ {
+ WORD* ds = (WORD*)d;
+ WORD* dstend = ds + w;
+
+ for(; ds < dstend; sub+=4, ds++)
+ {
+ if(sub[3] < 0xff)
+ {
+ int y = (c2y_yb[sub[0]] + c2y_yg[sub[1]] + c2y_yr[sub[2]] + 0x108000) >> 16;
+ *ds = 0x8000|y; // w/o colors
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_RGB555)
+ {
+ WORD* ds = (WORD*)d;
+ WORD* dstend = ds + w;
+
+ for(; ds < dstend; sub+=4, ds++)
+ {
+ if(sub[3] < 0xff)
+ {
+ *ds = ((*((DWORD*)sub)>>9)&0x7c00)|((*((DWORD*)sub)>>6)&0x03e0)|((*((DWORD*)sub)>>3)&0x001f);
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_RGB565)
+ {
+ WORD* ds = (WORD*)d;
+ WORD* dstend = ds + w;
+
+ for(; ds < dstend; sub+=4, ds++)
+ {
+ if(sub[3] < 0xff)
+ {
+ *ds = ((*((DWORD*)sub)>>8)&0xf800)|((*((DWORD*)sub)>>5)&0x07e0)|((*((DWORD*)sub)>>3)&0x001f);
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_RGB24)
+ {
+ BYTE* dt = (BYTE*)d;
+ BYTE* dstend = dt + w*3;
+
+ for(; dt < dstend; sub+=4, dt+=3)
+ {
+ if(sub[3] < 0xff)
+ {
+ dt[0] = sub[0];
+ dt[1] = sub[1];
+ dt[2] = sub[2];
+ }
+ }
+ }
+ else if(subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32)
+ {
+ DWORD* dstend = d + w;
+
+ for(; d < dstend; sub+=4, d++)
+ {
+ if(sub[3] < 0xff) *d = *((DWORD*)sub)&0xffffff;
+ }
+ }
+}
+
+/* ResX2 */
+void Scale2x(const GUID& subtype, BYTE* d, int dpitch, BYTE* s, int spitch, int w, int h)
+{
+ if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ for(BYTE* s3 = s1 + (w-1); s1 < s3; s1 += 1, d1 += 2)
+ {
+ d1[0] = s1[0];
+ d1[1] = (s1[0]+s1[1])>>1;
+ }
+
+ d1[0] = d1[1] = s1[0];
+
+ s1 += 1;
+ d1 += 2;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines8(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_YUY2)
+ {
+ unsigned __int64 __0xffffffff00000000 = 0xffffffff00000000;
+ unsigned __int64 __0x00000000ffffffff = 0x00000000ffffffff;
+ unsigned __int64 __0x00ff00ff00ff00ff = 0x00ff00ff00ff00ff;
+
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch)
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ // row0, 4 pixels: y1|u1|y2|v1|y3|u2|y4|v2
+ // ->
+ // row0, 8 pixels: y1|u1|(y1+y2)/2|v1|y2|(u1+u2)/2|(y2+y3)/2|(v1+v2)/2
+
+ __asm
+ {
+ mov esi, s1
+ mov edi, d1
+
+ mov ecx, w
+ shr ecx, 1
+ dec ecx
+
+ movq mm4, __0x00ff00ff00ff00ff
+ movq mm5, __0x00000000ffffffff
+ movq mm6, __0xffffffff00000000
+row_loop1:
+ movq mm0, [esi]
+ movq mm2, mm0
+
+ pand mm0, mm4 // mm0 = 00y400y300y200y1
+ psrlw mm2, 8 // mm2 = 00u200v200u100v1
+
+
+ movq mm1, mm0
+
+ pand mm0, mm5 // mm0 = 0000000000y200y1
+
+ psllq mm1, 16
+ pand mm1, mm6 // mm1 = 00y300y200000000
+
+ por mm1, mm0 // mm1 = 00y300y200y200y1
+
+ punpcklwd mm0, mm0 // mm0 = 00y200y200y100y1
+
+ paddw mm0, mm1
+ psrlw mm0, 1 // mm0 = (mm0 + mm1) / 2
+
+
+ movq mm1, mm2
+ punpckldq mm1, mm1 // mm1 = 00u100v100u100v1
+
+ paddw mm1, mm2
+ psrlw mm1, 1 // mm1 = (mm1 + mm2) / 2
+
+
+ psllw mm1, 8
+ por mm0, mm1 // mm0 = (v1+v2)/2|(y2+y3)/2|(u1+u2)/2|y2|v1|(y1+y2)/2|u1|y1
+
+ movq [edi], mm0
+
+ lea esi, [esi+4]
+ lea edi, [edi+8]
+
+ dec ecx
+ jnz row_loop1
+
+ mov s1, esi
+ mov d1, edi
+ };
+
+ *d1++ = s1[0];
+ *d1++ = s1[1];
+ *d1++ =(s1[0]+s1[2])>>1;
+ *d1++ = s1[3];
+
+ *d1++ = s1[2];
+ *d1++ = s1[1];
+ *d1++ = s1[2];
+ *d1++ = s1[3];
+
+ s1 += 4;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines8(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_RGB555)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ for(BYTE* s3 = s1 + (w-1)*2; s1 < s3; s1 += 2, d1 += 4)
+ {
+ *((WORD*)d1) = *((WORD*)s1);
+ *((WORD*)d1+1) =
+ ((((*((WORD*)s1)&0x7c00) + (*((WORD*)s1+1)&0x7c00)) >> 1)&0x7c00)|
+ ((((*((WORD*)s1)&0x03e0) + (*((WORD*)s1+1)&0x03e0)) >> 1)&0x03e0)|
+ ((((*((WORD*)s1)&0x001f) + (*((WORD*)s1+1)&0x001f)) >> 1)&0x001f);
+ }
+
+ *((WORD*)d1) = *((WORD*)s1);
+ *((WORD*)d1+1) = *((WORD*)s1);
+
+ s1 += 2;
+ d1 += 4;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines555(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_RGB565)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ for(BYTE* s3 = s1 + (w-1)*2; s1 < s3; s1 += 2, d1 += 4)
+ {
+ *((WORD*)d1) = *((WORD*)s1);
+ *((WORD*)d1+1) =
+ ((((*((WORD*)s1)&0xf800) + (*((WORD*)s1+1)&0xf800)) >> 1)&0xf800)|
+ ((((*((WORD*)s1)&0x07e0) + (*((WORD*)s1+1)&0x07e0)) >> 1)&0x07e0)|
+ ((((*((WORD*)s1)&0x001f) + (*((WORD*)s1+1)&0x001f)) >> 1)&0x001f);
+ }
+
+ *((WORD*)d1) = *((WORD*)s1);
+ *((WORD*)d1+1) = *((WORD*)s1);
+
+ s1 += 2;
+ d1 += 4;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines565(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_RGB24)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch) // TODO: replace this mess with mmx code
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ for(BYTE* s3 = s1 + (w-1)*3; s1 < s3; s1 += 3, d1 += 6)
+ {
+ d1[0] = s1[0];
+ d1[1] = s1[1];
+ d1[2] = s1[2];
+ d1[3] = (s1[0]+s1[3])>>1;
+ d1[4] = (s1[1]+s1[4])>>1;
+ d1[5] = (s1[2]+s1[5])>>1;
+ }
+
+ d1[0] = d1[3] = s1[0];
+ d1[1] = d1[4] = s1[1];
+ d1[2] = d1[5] = s1[2];
+
+ s1 += 3;
+ d1 += 6;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines8(d, h*2, dpitch);
+ }
+ else if(subtype == MEDIASUBTYPE_RGB32 || subtype == MEDIASUBTYPE_ARGB32)
+ {
+ BYTE* s1;
+ BYTE* s2;
+ BYTE* d1;
+
+ for(s1 = s, s2 = s + h*spitch, d1 = d; s1 < s2; d1 += dpitch)
+ {
+ BYTE* stmp = s1 + spitch;
+ BYTE* dtmp = d1 + dpitch;
+
+ __asm
+ {
+ mov esi, s1
+ mov edi, d1
+
+ mov ecx, w
+ dec ecx
+
+ pxor mm0, mm0
+row_loop3:
+ movq mm1, [esi]
+ movq mm2, mm1
+
+ punpcklbw mm1, mm0 // mm1 = 00xx00r100g100b1
+ punpckhbw mm2, mm0 // mm2 = 00xx00r200g200b2
+
+ paddw mm2, mm1
+ psrlw mm2, 1 // mm2 = (mm1 + mm2) / 2
+
+ packuswb mm1, mm2
+
+ movq [edi], mm1
+
+ lea esi, [esi+4]
+ lea edi, [edi+8]
+
+ dec ecx
+ jnz row_loop3
+
+ mov s1, esi
+ mov d1, edi
+ };
+
+ *((DWORD*)d1) = *((DWORD*)s1);
+ *((DWORD*)d1+1) = *((DWORD*)s1);
+
+ s1 += 4;
+ d1 += 8;
+
+ s1 = stmp;
+ d1 = dtmp;
+ }
+
+ AvgLines8(d, h*2, dpitch);
+ }
+
+ __asm emms;
+}
+
+HRESULT CDirectVobSubFilter::Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, int bpp, const GUID& subtype, DWORD black)
+{
+ int wIn = in.cx, hIn = in.cy, pitchIn = ((wIn*bpp>>3)+3)&~3;
+ int wSub = sub.cx, hSub = sub.cy, pitchSub = ((wSub*bpp>>3)+3)&~3;
+ bool fScale2x = wIn*2 <= wSub;
+
+ if(fScale2x) wIn <<= 1, hIn <<= 1;
+
+ int left = ((wSub - wIn)>>1)&~1;
+ int mid = wIn;
+ int right = left + ((wSub - wIn)&1);
+
+ int dpLeft = left*bpp>>3;
+ int dpMid = mid*bpp>>3;
+ int dpRight = right*bpp>>3;
+
+ ASSERT(wSub >= wIn);
+
+ {
+ int i = 0, j = 0;
+
+ j += (hSub - hIn) >> 1;
+
+ for(; i < j; i++, pSub += pitchSub)
+ {
+ memsetd(pSub, black, dpLeft+dpMid+dpRight);
+ }
+
+ j += hIn;
+
+ if(hIn > hSub)
+ pIn += pitchIn * ((hIn - hSub) >> (fScale2x?2:1));
+
+ if(fScale2x)
+ {
+ Scale2x(subtype,
+ pSub + dpLeft, pitchSub, pIn, pitchIn,
+ in.cx, (min(j, hSub) - i) >> 1);
+
+ for(int k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub)
+ {
+ memsetd(pSub, black, dpLeft);
+ memsetd(pSub + dpLeft+dpMid, black, dpRight);
+ }
+ }
+ else
+ {
+ for(int k = min(j, hSub); i < k; i++, pIn += pitchIn, pSub += pitchSub)
+ {
+ memsetd(pSub, black, dpLeft);
+ memcpy(pSub + dpLeft, pIn, dpMid);
+ memsetd(pSub + dpLeft+dpMid, black, dpRight);
+ }
+ }
+
+ j = hSub;
+
+ for(; i < j; i++, pSub += pitchSub)
+ {
+ memsetd(pSub, black, dpLeft+dpMid+dpRight);
+ }
+ }
+
+ return NOERROR;
+}
+
+void CDirectVobSubFilter::PrintMessages(BYTE* pOut)
+{
+ if(!m_hdc || !m_hbm)
+ return;
+
+ ColorConvInit();
+
+ const GUID& subtype = m_pOutput->CurrentMediaType().subtype;
+
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+
+ CString msg, tmp;
+
+ if(m_fOSD)
+ {
+ tmp.Format(_T("in: %dx%d %s\nout: %dx%d %s\n"),
+ m_w, m_h,
+ Subtype2String(m_pInput->CurrentMediaType().subtype),
+ bihOut.biWidth, bihOut.biHeight,
+ Subtype2String(m_pOutput->CurrentMediaType().subtype));
+ msg += tmp;
+
+ tmp.Format(_T("real fps: %.3f, current fps: %.3f\nmedia time: %d, subtitle time: %d [ms]\nframe number: %d (calculated)\nrate: %.4f\n"),
+ m_fps, m_fMediaFPSEnabled?m_MediaFPS:fabs(m_fps),
+ (int)m_tPrev.Millisecs(), (int)(CalcCurrentTime()/10000),
+ (int)(m_tPrev.m_time * m_fps / 10000000),
+ m_pInput->CurrentRate());
+ msg += tmp;
+
+ CAutoLock cAutoLock(&m_csQueueLock);
+
+ if(m_pSubPicQueue)
+ {
+ int nSubPics = -1;
+ REFERENCE_TIME rtNow = -1, rtStart = -1, rtStop = -1;
+ m_pSubPicQueue->GetStats(nSubPics, rtNow, rtStart, rtStop);
+ tmp.Format(_T("queue stats: %I64d - %I64d [ms]\n"), rtStart/10000, rtStop/10000);
+ msg += tmp;
+
+ for(int i = 0; i < nSubPics; i++)
+ {
+ m_pSubPicQueue->GetStats(i, rtStart, rtStop);
+ tmp.Format(_T("%d: %I64d - %I64d [ms]\n"), i, rtStart/10000, rtStop/10000);
+ msg += tmp;
+ }
+
+ }
+ }
+
+ if(msg.IsEmpty()) return;
+
+ HANDLE hOldBitmap = SelectObject(m_hdc, m_hbm);
+ HANDLE hOldFont = SelectObject(m_hdc, m_hfont);
+
+ SetTextColor(m_hdc, 0xffffff);
+ SetBkMode(m_hdc, TRANSPARENT);
+ SetMapMode(m_hdc, MM_TEXT);
+
+ BITMAP bm;
+ GetObject(m_hbm, sizeof(BITMAP), &bm);
+
+ CRect r(0, 0, bm.bmWidth, bm.bmHeight);
+ DrawText(m_hdc, msg, _tcslen(msg), &r, DT_CALCRECT|DT_EXTERNALLEADING|DT_NOPREFIX|DT_WORDBREAK);
+
+ r += CPoint(10, 10);
+ r &= CRect(0, 0, bm.bmWidth, bm.bmHeight);
+
+ DrawText(m_hdc, msg, _tcslen(msg), &r, DT_LEFT|DT_TOP|DT_NOPREFIX|DT_WORDBREAK);
+
+ BYTE* pIn = (BYTE*)bm.bmBits;
+ int pitchIn = bm.bmWidthBytes;
+ int pitchOut = bihOut.biWidth * bihOut.biBitCount >> 3;
+
+ if(subtype == MEDIASUBTYPE_YV12 || subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV)
+ pitchOut = bihOut.biWidth;
+
+ pitchIn = (pitchIn+3)&~3;
+ pitchOut = (pitchOut+3)&~3;
+
+ if(bihOut.biHeight > 0 && bihOut.biCompression <= 3) // flip if the dst bitmap is flipped rgb (m_hbm is a top-down bitmap, not like the subpictures)
+ {
+ pOut += pitchOut * (abs(bihOut.biHeight)-1);
+ pitchOut = -pitchOut;
+ }
+
+ pIn += pitchIn * r.top;
+ pOut += pitchOut * r.top;
+
+ for(int w = min(r.right, m_w), h = r.Height(); h--; pIn += pitchIn, pOut += pitchOut)
+ {
+ BltLineRGB32((DWORD*)pOut, pIn, w, subtype);
+ memsetd(pIn, 0xff000000, r.right*4);
+ }
+
+ SelectObject(m_hdc, hOldBitmap);
+ SelectObject(m_hdc, hOldFont);
+}
diff --git a/src/filters/transform/vsfilter/DirectVobSub.cpp b/src/filters/transform/vsfilter/DirectVobSub.cpp
new file mode 100644
index 000000000..c5d8177ba
--- /dev/null
+++ b/src/filters/transform/vsfilter/DirectVobSub.cpp
@@ -0,0 +1,629 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "DirectVobSub.h"
+#include "VSFilter.h"
+
+CDirectVobSub::CDirectVobSub()
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ BYTE* pData;
+ UINT nSize;
+
+ m_iSelectedLanguage = 0;
+ m_fHideSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), 0);
+ m_fDoPreBuffering = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), 1);
+ m_fOverridePlacement = !!theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), 0);
+ m_PlacementXperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), 50);
+ m_PlacementYperc = theApp.GetProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), 90);
+ m_fBufferVobSub = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), 1);
+ m_fOnlyShowForcedVobSubs = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), 0);
+ m_fPolygonize = !!theApp.GetProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), 0);
+ m_defStyle <<= theApp.GetProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), _T(""));
+ m_fFlipPicture = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), 0);
+ m_fFlipSubtitles = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), 0);
+ m_fOSD = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), 0);
+ m_fSaveFullPath = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), 0);
+ m_nReloaderDisableCount = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0) ? 1 : 0;
+ m_SubtitleDelay = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), 0);
+ m_SubtitleSpeedMul = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), 1000);
+ m_SubtitleSpeedDiv = theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), 1000);
+ m_fMediaFPSEnabled = !!theApp.GetProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), 0);
+ pData = NULL;
+ if(theApp.GetProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), &pData, &nSize) && pData)
+ {
+ if(nSize != sizeof(m_MediaFPS)) m_MediaFPS = 25.0;
+ else memcpy(&m_MediaFPS, pData, sizeof(m_MediaFPS));
+ delete [] pData;
+ }
+ m_ZoomRect.left = m_ZoomRect.top = 0;
+ m_ZoomRect.right = m_ZoomRect.bottom = 1;
+
+ m_fForced = false;
+}
+
+CDirectVobSub::~CDirectVobSub()
+{
+ CAutoLock cAutoLock(&m_propsLock);
+}
+
+STDMETHODIMP CDirectVobSub::get_FileName(WCHAR* fn)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(!fn) return E_POINTER;
+
+#ifdef UNICODE
+ wcscpy(fn, m_FileName);
+#else
+ mbstowcs(fn, m_FileName, m_FileName.GetLength()+1);
+#endif
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_FileName(WCHAR* fn)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(!fn) return E_POINTER;
+
+ CString tmp = fn;
+ if(!m_FileName.Left(m_FileName.ReverseFind('.')+1).CompareNoCase(tmp.Left(tmp.ReverseFind('.')+1))) return S_FALSE;
+
+#ifdef UNICODE
+ m_FileName = fn;
+#else
+ CHARSETINFO cs={0};
+ ::TranslateCharsetInfo((DWORD *)DEFAULT_CHARSET, &cs, TCI_SRCCHARSET);
+ CHAR* buff = m_FileName.GetBuffer(MAX_PATH*2);
+ int len = WideCharToMultiByte(cs.ciACP/*CP_OEMCP*/, NULL, fn, -1, buff, MAX_PATH*2, NULL, NULL);
+ m_FileName.ReleaseBuffer(len+1);
+#endif
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_LanguageCount(int* nLangs)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ return nLangs ? *nLangs = 0, S_OK : E_POINTER;
+}
+
+STDMETHODIMP CDirectVobSub::get_LanguageName(int iLanguage, WCHAR** ppName)
+{
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_SelectedLanguage(int* iSelected)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ return iSelected ? *iSelected = m_iSelectedLanguage, S_OK : E_POINTER;
+}
+
+STDMETHODIMP CDirectVobSub::put_SelectedLanguage(int iSelected)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_iSelectedLanguage == iSelected) return S_FALSE;
+
+ int nCount;
+ if(FAILED(get_LanguageCount(&nCount))
+ || iSelected < 0
+ || iSelected >= nCount)
+ return E_FAIL;
+
+ m_iSelectedLanguage = iSelected;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_HideSubtitles(bool* fHideSubtitles)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ return fHideSubtitles ? *fHideSubtitles = m_fHideSubtitles, S_OK : E_POINTER;
+}
+
+STDMETHODIMP CDirectVobSub::put_HideSubtitles(bool fHideSubtitles)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_fHideSubtitles == fHideSubtitles) return S_FALSE;
+
+ m_fHideSubtitles = fHideSubtitles;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_PreBuffering(bool* fDoPreBuffering)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ return fDoPreBuffering ? *fDoPreBuffering = m_fDoPreBuffering, S_OK : E_POINTER;
+}
+
+STDMETHODIMP CDirectVobSub::put_PreBuffering(bool fDoPreBuffering)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_fDoPreBuffering == fDoPreBuffering) return S_FALSE;
+
+ m_fDoPreBuffering = fDoPreBuffering;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_Placement(bool* fOverridePlacement, int* xperc, int* yperc)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(fOverridePlacement) *fOverridePlacement = m_fOverridePlacement;
+ if(xperc) *xperc = m_PlacementXperc;
+ if(yperc) *yperc = m_PlacementYperc;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_Placement(bool fOverridePlacement, int xperc, int yperc)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_fOverridePlacement == fOverridePlacement && m_PlacementXperc == xperc && m_PlacementYperc == yperc) return S_FALSE;
+
+ m_fOverridePlacement = fOverridePlacement;
+ m_PlacementXperc = xperc;
+ m_PlacementYperc = yperc;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_VobSubSettings(bool* fBuffer, bool* fOnlyShowForcedSubs, bool* fPolygonize)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(fBuffer) *fBuffer = m_fBufferVobSub;
+ if(fOnlyShowForcedSubs) *fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
+ if(fPolygonize) *fPolygonize = m_fPolygonize;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fPolygonize)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_fBufferVobSub == fBuffer && m_fOnlyShowForcedVobSubs == fOnlyShowForcedSubs && m_fPolygonize == fPolygonize) return S_FALSE;
+
+ m_fBufferVobSub = fBuffer;
+ m_fOnlyShowForcedVobSubs = fOnlyShowForcedSubs;
+ m_fPolygonize = fPolygonize;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_TextSettings(void* lf, int lflen, COLORREF* color, bool* fShadow, bool* fOutline, bool* fAdvancedRenderer)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(lf)
+ {
+ if(lflen == sizeof(LOGFONTA))
+ strcpy(((LOGFONTA*)lf)->lfFaceName, CStringA(m_defStyle.fontName));
+ else if(lflen == sizeof(LOGFONTW))
+ wcscpy(((LOGFONTW*)lf)->lfFaceName, CStringW(m_defStyle.fontName));
+ else
+ return E_INVALIDARG;
+
+ ((LOGFONT*)lf)->lfCharSet = m_defStyle.charSet;
+ ((LOGFONT*)lf)->lfItalic = m_defStyle.fItalic;
+ ((LOGFONT*)lf)->lfHeight = m_defStyle.fontSize;
+ ((LOGFONT*)lf)->lfWeight = m_defStyle.fontWeight;
+ ((LOGFONT*)lf)->lfStrikeOut = m_defStyle.fStrikeOut;
+ ((LOGFONT*)lf)->lfUnderline = m_defStyle.fUnderline;
+ }
+
+ if(color) *color = m_defStyle.colors[0];
+ if(fShadow) *fShadow = m_defStyle.shadowDepth>0;
+ if(fOutline) *fOutline = m_defStyle.outlineWidth>0;
+ if(fAdvancedRenderer) *fAdvancedRenderer = m_fAdvancedRenderer;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(lf)
+ {
+ if(lflen == sizeof(LOGFONTA))
+ m_defStyle.fontName = ((LOGFONTA*)lf)->lfFaceName;
+ else if(lflen == sizeof(LOGFONTW))
+ m_defStyle.fontName = ((LOGFONTW*)lf)->lfFaceName;
+ else
+ return E_INVALIDARG;
+
+ m_defStyle.charSet = ((LOGFONT*)lf)->lfCharSet;
+ m_defStyle.fItalic = !!((LOGFONT*)lf)->lfItalic;
+ m_defStyle.fontSize = ((LOGFONT*)lf)->lfHeight;
+ m_defStyle.fontWeight = ((LOGFONT*)lf)->lfWeight;
+ m_defStyle.fStrikeOut = !!((LOGFONT*)lf)->lfStrikeOut;
+ m_defStyle.fUnderline = !!((LOGFONT*)lf)->lfUnderline;
+
+ if(m_defStyle.fontSize < 0)
+ {
+ HDC hdc = ::GetDC(0);
+ m_defStyle.fontSize = -m_defStyle.fontSize * 72 / GetDeviceCaps(hdc, LOGPIXELSY);
+ ::ReleaseDC(0, hdc);
+ }
+
+ }
+
+ m_defStyle.colors[0] = color;
+ m_defStyle.shadowDepth = fShadow?2:0;
+ m_defStyle.outlineWidth = fOutline?2:0;
+
+ return S_OK;
+
+}
+
+STDMETHODIMP CDirectVobSub::get_Flip(bool* fPicture, bool* fSubtitles)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(fPicture) *fPicture = m_fFlipPicture;
+ if(fSubtitles) *fSubtitles = m_fFlipSubtitles;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_Flip(bool fPicture, bool fSubtitles)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_fFlipPicture == fPicture && m_fFlipSubtitles == fSubtitles) return S_FALSE;
+
+ m_fFlipPicture = fPicture;
+ m_fFlipSubtitles = fSubtitles;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_OSD(bool* fOSD)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ return fOSD ? *fOSD = m_fOSD, S_OK : E_POINTER;
+}
+
+STDMETHODIMP CDirectVobSub::put_OSD(bool fOSD)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_fOSD == fOSD) return S_FALSE;
+
+ m_fOSD = fOSD;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_SaveFullPath(bool* fSaveFullPath)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ return fSaveFullPath ? *fSaveFullPath = m_fSaveFullPath, S_OK : E_POINTER;
+}
+
+STDMETHODIMP CDirectVobSub::put_SaveFullPath(bool fSaveFullPath)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_fSaveFullPath == fSaveFullPath) return S_FALSE;
+
+ m_fSaveFullPath = fSaveFullPath;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_SubtitleTiming(int* delay, int* speedmul, int* speeddiv)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(delay) *delay = m_SubtitleDelay;
+ if(speedmul) *speedmul = m_SubtitleSpeedMul;
+ if(speeddiv) *speeddiv = m_SubtitleSpeedDiv;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_SubtitleTiming(int delay, int speedmul, int speeddiv)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_SubtitleDelay == delay && m_SubtitleSpeedMul == speedmul && m_SubtitleSpeedDiv == speeddiv) return S_FALSE;
+
+ m_SubtitleDelay = delay;
+ m_SubtitleSpeedMul = speedmul;
+ if(speeddiv > 0) m_SubtitleSpeedDiv = speeddiv;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_MediaFPS(bool* fEnabled, double* fps)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(fEnabled) *fEnabled = m_fMediaFPSEnabled;
+ if(fps) *fps = m_MediaFPS;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_MediaFPS(bool fEnabled, double fps)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(m_fMediaFPSEnabled == fEnabled && m_MediaFPS == fps) return S_FALSE;
+
+ m_fMediaFPSEnabled = fEnabled;
+ if(fps > 0) m_MediaFPS = fps;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_ZoomRect(NORMALIZEDRECT* rect)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(!rect) return E_POINTER;
+
+ *rect = m_ZoomRect;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_ZoomRect(NORMALIZEDRECT* rect)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(!rect) return E_POINTER;
+
+ if(!memcmp(&m_ZoomRect, rect, sizeof(m_ZoomRect))) return S_FALSE;
+
+ m_ZoomRect = *rect;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::UpdateRegistry()
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_HIDE), m_fHideSubtitles);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DOPREBUFFERING), m_fDoPreBuffering);
+ theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_OVERRIDEPLACEMENT), m_fOverridePlacement);
+ theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_XPERC), m_PlacementXperc);
+ theApp.WriteProfileInt(ResStr(IDS_R_TEXT), ResStr(IDS_RT_YPERC), m_PlacementYperc);
+ theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_BUFFER), m_fBufferVobSub);
+ theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_ONLYSHOWFORCEDSUBS), m_fOnlyShowForcedVobSubs);
+ theApp.WriteProfileInt(ResStr(IDS_R_VOBSUB), ResStr(IDS_RV_POLYGONIZE), m_fPolygonize);
+ CString style;
+ theApp.WriteProfileString(ResStr(IDS_R_TEXT), ResStr(IDS_RT_STYLE), style <<= m_defStyle);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPPICTURE), m_fFlipPicture);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FLIPSUBTITLES), m_fFlipSubtitles);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SHOWOSDSTATS), m_fOSD);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SAVEFULLPATH), m_fSaveFullPath);
+ theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLEDELAY), m_SubtitleDelay);
+ theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDMUL), m_SubtitleSpeedMul);
+ theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_SUBTITLESPEEDDIV), m_SubtitleSpeedDiv);
+ theApp.WriteProfileInt(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPSENABLED), m_fMediaFPSEnabled);
+ theApp.WriteProfileBinary(ResStr(IDS_R_TIMING), ResStr(IDS_RTM_MEDIAFPS), (BYTE*)&m_MediaFPS, sizeof(m_MediaFPS));
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::HasConfigDialog(int iSelected)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CDirectVobSub::ShowConfigDialog(int iSelected, HWND hWndParent)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CDirectVobSub::IsSubtitleReloaderLocked(bool* fLocked)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(!fLocked) return E_POINTER;
+
+ bool fDisabled;
+ get_SubtitleReloader(&fDisabled);
+
+ *fLocked = fDisabled || m_nReloaderDisableCount > 0;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::LockSubtitleReloader(bool fLock)
+{
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(fLock) m_nReloaderDisableCount++;
+ else m_nReloaderDisableCount--;
+
+ ASSERT(m_nReloaderDisableCount >= 0);
+ if(m_nReloaderDisableCount < 0) m_nReloaderDisableCount = 0;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_SubtitleReloader(bool* fDisabled)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(fDisabled) *fDisabled = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), 0);
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_SubtitleReloader(bool fDisable)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ bool b;
+ get_SubtitleReloader(&b);
+ if(b == fDisable) return S_FALSE;
+
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_DISABLERELOADER), fDisable);
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_ExtendPicture(int* horizontal, int* vertical, int* resx2, int* resx2minw, int* resx2minh)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(horizontal) *horizontal = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), 0) & 1;
+ if(vertical) *vertical = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), 1);
+ if(resx2) *resx2 = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), 2) & 3;
+ if(resx2minw) *resx2minw = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), 384);
+ if(resx2minh) *resx2minh = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), 288);
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_ExtendPicture(int horizontal, int vertical, int resx2, int resx2minw, int resx2minh)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ int i[5];
+ get_ExtendPicture(i, i+1, i+2, i+3, i+4);
+ if(i[0] == horizontal && i[1] == vertical && i[2] == resx2 && i[3] == resx2minw && i[4] == resx2minh) return S_FALSE;
+
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_MOD32FIX), horizontal & 1);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTPIC), vertical);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2), resx2 & 3);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINW), resx2minw);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_RESX2MINH), resx2minh);
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_LoadSettings(int* level, bool* fExternalLoad, bool* fWebLoad, bool* fEmbeddedLoad)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(level) *level = theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), 0) & 3;
+ if(fExternalLoad) *fExternalLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), 1);
+ if(fWebLoad) *fWebLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), 0);
+ if(fEmbeddedLoad) *fEmbeddedLoad = !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), 1);
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_LoadSettings(int level, bool fExternalLoad, bool fWebLoad, bool fEmbeddedLoad)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ int i;
+ bool b[3];
+ get_LoadSettings(&i, b, b+1, b+2);
+ if(i == level && b[0] == fExternalLoad && b[1] == fWebLoad && b[2] == fEmbeddedLoad) return S_FALSE;
+
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_LOADLEVEL), level & 3);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EXTERNALLOAD), fExternalLoad);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_WEBLOAD), fWebLoad);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_EMBEDDEDLOAD), fEmbeddedLoad);
+
+ return S_OK;
+}
+
+// IDirectVobSub2
+
+STDMETHODIMP CDirectVobSub::AdviseSubClock(ISubClock* pSubClock)
+{
+ m_pSubClock = pSubClock;
+ return S_OK;
+}
+
+STDMETHODIMP_(bool) CDirectVobSub::get_Forced()
+{
+ return m_fForced;
+}
+
+STDMETHODIMP CDirectVobSub::put_Forced(bool fForced)
+{
+ m_fForced = fForced;
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::get_TextSettings(STSStyle* pDefStyle)
+{
+ CheckPointer(pDefStyle, E_POINTER);
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ *pDefStyle = m_defStyle;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSub::put_TextSettings(STSStyle* pDefStyle)
+{
+ CheckPointer(pDefStyle, E_POINTER);
+
+ CAutoLock cAutoLock(&m_propsLock);
+
+ if(!memcmp(&m_defStyle, pDefStyle, sizeof(m_defStyle)))
+ return S_FALSE;
+
+ m_defStyle = *pDefStyle;
+
+ return S_OK;
+}
+
+// IFilterVersion
+
+STDMETHODIMP_(DWORD) CDirectVobSub::GetFilterVersion()
+{
+ return 0x0234;
+}
diff --git a/src/filters/transform/vsfilter/DirectVobSub.h b/src/filters/transform/vsfilter/DirectVobSub.h
new file mode 100644
index 000000000..1f44b33a6
--- /dev/null
+++ b/src/filters/transform/vsfilter/DirectVobSub.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "IDirectVobSub.h"
+#include "..\..\..\..\include\IFilterVersion.h"
+
+class CDirectVobSub : public IDirectVobSub2, public IFilterVersion
+{
+protected:
+ CDirectVobSub();
+ virtual ~CDirectVobSub();
+
+protected:
+ CCritSec m_propsLock;
+
+ CString m_FileName;
+ int m_iSelectedLanguage;
+ bool m_fHideSubtitles;
+ bool m_fDoPreBuffering;
+ bool m_fOverridePlacement;
+ int m_PlacementXperc, m_PlacementYperc;
+ bool m_fBufferVobSub, m_fOnlyShowForcedVobSubs, m_fPolygonize;
+
+ STSStyle m_defStyle;
+
+ bool m_fAdvancedRenderer;
+ bool m_fFlipPicture, m_fFlipSubtitles;
+ bool m_fOSD;
+ int m_nReloaderDisableCount;
+ int m_SubtitleDelay, m_SubtitleSpeedMul, m_SubtitleSpeedDiv;
+ bool m_fMediaFPSEnabled;
+ double m_MediaFPS;
+ bool m_fSaveFullPath;
+ NORMALIZEDRECT m_ZoomRect;
+
+ CComPtr<ISubClock> m_pSubClock;
+ bool m_fForced;
+
+public:
+
+ // IDirectVobSub
+
+ STDMETHODIMP get_FileName(WCHAR* fn);
+ STDMETHODIMP put_FileName(WCHAR* fn);
+ STDMETHODIMP get_LanguageCount(int* nLangs);
+ STDMETHODIMP get_LanguageName(int iLanguage, WCHAR** ppName);
+ STDMETHODIMP get_SelectedLanguage(int* iSelected);
+ STDMETHODIMP put_SelectedLanguage(int iSelected);
+ STDMETHODIMP get_HideSubtitles(bool* fHideSubtitles);
+ STDMETHODIMP put_HideSubtitles(bool fHideSubtitles);
+ STDMETHODIMP get_PreBuffering(bool* fDoPreBuffering);
+ STDMETHODIMP put_PreBuffering(bool fDoPreBuffering);
+ STDMETHODIMP get_Placement(bool* fOverridePlacement, int* xperc, int* yperc);
+ STDMETHODIMP put_Placement(bool fOverridePlacement, int xperc, int yperc);
+ STDMETHODIMP get_VobSubSettings(bool* fBuffer, bool* fOnlyShowForcedSubs, bool* fPolygonize);
+ STDMETHODIMP put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fPolygonize);
+ STDMETHODIMP get_TextSettings(void* lf, int lflen, COLORREF* color, bool* fShadow, bool* fOutline, bool* fAdvancedRenderer);
+ STDMETHODIMP put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer);
+ STDMETHODIMP get_Flip(bool* fPicture, bool* fSubtitles);
+ STDMETHODIMP put_Flip(bool fPicture, bool fSubtitles);
+ STDMETHODIMP get_OSD(bool* fShowOSD);
+ STDMETHODIMP put_OSD(bool fShowOSD);
+ STDMETHODIMP get_SaveFullPath(bool* fSaveFullPath);
+ STDMETHODIMP put_SaveFullPath(bool fSaveFullPath);
+ STDMETHODIMP get_SubtitleTiming(int* delay, int* speedmul, int* speeddiv);
+ STDMETHODIMP put_SubtitleTiming(int delay, int speedmul, int speeddiv);
+ STDMETHODIMP get_MediaFPS(bool* fEnabled, double* fps);
+ STDMETHODIMP put_MediaFPS(bool fEnabled, double fps);
+ STDMETHODIMP get_ZoomRect(NORMALIZEDRECT* rect);
+ STDMETHODIMP put_ZoomRect(NORMALIZEDRECT* rect);
+ STDMETHODIMP get_ColorFormat(int* iPosition) {return E_NOTIMPL;}
+ STDMETHODIMP put_ColorFormat(int iPosition) {return E_NOTIMPL;}
+
+ STDMETHODIMP UpdateRegistry();
+
+ STDMETHODIMP HasConfigDialog(int iSelected);
+ STDMETHODIMP ShowConfigDialog(int iSelected, HWND hWndParent);
+
+ // settings for the rest are stored in the registry
+
+ STDMETHODIMP IsSubtitleReloaderLocked(bool* fLocked);
+ STDMETHODIMP LockSubtitleReloader(bool fLock);
+ STDMETHODIMP get_SubtitleReloader(bool* fDisabled);
+ STDMETHODIMP put_SubtitleReloader(bool fDisable);
+
+ // the followings need a partial or full reloading of the filter
+
+ STDMETHODIMP get_ExtendPicture(int* horizontal, int* vertical, int* resx2, int* resx2minw, int* resx2minh);
+ STDMETHODIMP put_ExtendPicture(int horizontal, int vertical, int resx2, int resx2minw, int resx2minh);
+ STDMETHODIMP get_LoadSettings(int* level, bool* fExternalLoad, bool* fWebLoad, bool* fEmbeddedLoad);
+ STDMETHODIMP put_LoadSettings(int level, bool fExternalLoad, bool fWebLoad, bool fEmbeddedLoad);
+
+ // IDirectVobSub2
+
+ STDMETHODIMP AdviseSubClock(ISubClock* pSubClock);
+ STDMETHODIMP_(bool) get_Forced();
+ STDMETHODIMP put_Forced(bool fForced);
+ STDMETHODIMP get_TextSettings(STSStyle* pDefStyle);
+ STDMETHODIMP put_TextSettings(STSStyle* pDefStyle);
+
+ // IFilterVersion
+
+ STDMETHODIMP_(DWORD) GetFilterVersion();
+}; \ No newline at end of file
diff --git a/src/filters/transform/vsfilter/DirectVobSubFilter.cpp b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp
new file mode 100644
index 000000000..2b81ef246
--- /dev/null
+++ b/src/filters/transform/vsfilter/DirectVobSubFilter.cpp
@@ -0,0 +1,1707 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <math.h>
+#include <time.h>
+#include "DirectVobSubFilter.h"
+#include "TextInputPin.h"
+#include "DirectVobSubPropPage.h"
+#include "VSFilter.h"
+#include "systray.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+#include "..\..\..\SubPic\MemSubPic.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+///////////////////////////////////////////////////////////////////////////
+
+/*removeme*/
+bool g_RegOK = true;//false; // doesn't work with the dvd graph builder
+#include "valami.cpp"
+
+////////////////////////////////////////////////////////////////////////////
+//
+// Constructor
+//
+
+CDirectVobSubFilter::CDirectVobSubFilter(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid)
+ : CBaseVideoFilter(NAME("CDirectVobSubFilter"), punk, phr, clsid)
+ , m_nSubtitleId(-1)
+ , m_fMSMpeg4Fix(false)
+ , m_fDivxPlusFix(false)
+ , m_fps(25)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ m_hdc = 0;
+ m_hbm = 0;
+ m_hfont = 0;
+
+ {
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(lf));
+ lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfOutPrecision = OUT_CHARACTER_PRECIS;
+ lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ lf.lfQuality = ANTIALIASED_QUALITY;
+ HDC hdc = GetDC(NULL);
+ lf.lfHeight = -MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72);
+ ReleaseDC(NULL, hdc);
+ lf.lfWeight = FW_BOLD;
+ _tcscpy(lf.lfFaceName, _T("Arial"));
+ m_hfont = CreateFontIndirect(&lf);
+ }
+
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Hint"), _T("The first three are fixed, but you can add more up to ten entries."));
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Path0"), _T("."));
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Path1"), _T("c:\\subtitles"));
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), _T("Path2"), _T(".\\subtitles"));
+
+ m_fLoading = true;
+
+ m_hSystrayThread = 0;
+ m_tbid.hSystrayWnd = NULL;
+ m_tbid.graph = NULL;
+ m_tbid.fRunOnce = false;
+ m_tbid.fShowIcon = (theApp.m_AppName.Find(_T("zplayer"), 0) < 0 || !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), 0));
+
+ HRESULT hr = S_OK;
+ m_pTextInput.Add(new CTextInputPin(this, m_pLock, &m_csSubLock, &hr));
+ ASSERT(SUCCEEDED(hr));
+
+ CAMThread::Create();
+ m_frd.EndThreadEvent.Create(0, FALSE, FALSE, 0);
+ m_frd.RefreshEvent.Create(0, FALSE, FALSE, 0);
+}
+
+CDirectVobSubFilter::~CDirectVobSubFilter()
+{
+ CAutoLock cAutoLock(&m_csQueueLock);
+ if(m_pSubPicQueue) m_pSubPicQueue->Invalidate();
+ m_pSubPicQueue = NULL;
+
+ if(m_hfont) {DeleteObject(m_hfont); m_hfont = 0;}
+ if(m_hbm) {DeleteObject(m_hbm); m_hbm = 0;}
+ if(m_hdc) {DeleteObject(m_hdc); m_hdc = 0;}
+
+ for(int i = 0; i < m_pTextInput.GetSize(); i++)
+ delete m_pTextInput[i];
+
+ m_frd.EndThreadEvent.Set();
+ CAMThread::Close();
+}
+
+STDMETHODIMP CDirectVobSubFilter::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+
+ return
+ QI(IDirectVobSub)
+ QI(IDirectVobSub2)
+ QI(IFilterVersion)
+ QI(ISpecifyPropertyPages)
+ QI(IAMStreamSelect)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// CBaseVideoFilter
+
+void CDirectVobSubFilter::GetOutputSize(int& w, int& h, int& arx, int& ary)
+{
+ CSize s(w, h), os = s;
+ AdjustFrameSize(s);
+ w = s.cx;
+ h = s.cy;
+
+ if(w != os.cx)
+ {
+ while(arx < 100) arx *= 10, ary *= 10;
+ arx = arx * w / os.cx;
+ }
+
+ if(h != os.cy)
+ {
+ while(ary < 100) arx *= 10, ary *= 10;
+ ary = ary * h / os.cy;
+ }
+}
+
+HRESULT CDirectVobSubFilter::Transform(IMediaSample* pIn)
+{
+ HRESULT hr;
+
+
+ REFERENCE_TIME rtStart, rtStop;
+ if(SUCCEEDED(pIn->GetTime(&rtStart, &rtStop)))
+ {
+ double dRate = m_pInput->CurrentRate();
+
+ m_tPrev = m_pInput->CurrentStartTime() + dRate*rtStart;
+
+ REFERENCE_TIME rtAvgTimePerFrame = rtStop - rtStart;
+ if(CComQIPtr<ISubClock2> pSC2 = m_pSubClock)
+ {
+ REFERENCE_TIME rt;
+ if(S_OK == pSC2->GetAvgTimePerFrame(&rt))
+ rtAvgTimePerFrame = rt;
+ }
+
+ m_fps = 10000000.0/rtAvgTimePerFrame / dRate;
+ }
+
+ //
+
+ {
+ CAutoLock cAutoLock(&m_csQueueLock);
+
+ if(m_pSubPicQueue)
+ {
+ m_pSubPicQueue->SetTime(CalcCurrentTime());
+ m_pSubPicQueue->SetFPS(m_fps);
+ }
+ }
+
+ //
+
+ BYTE* pDataIn = NULL;
+ if(FAILED(pIn->GetPointer(&pDataIn)) || !pDataIn)
+ return S_FALSE;
+
+ const CMediaType& mt = m_pInput->CurrentMediaType();
+
+ BITMAPINFOHEADER bihIn;
+ ExtractBIH(&mt, &bihIn);
+
+ bool fYV12 = (mt.subtype == MEDIASUBTYPE_YV12 || mt.subtype == MEDIASUBTYPE_I420 || mt.subtype == MEDIASUBTYPE_IYUV);
+ int bpp = fYV12 ? 8 : bihIn.biBitCount;
+ DWORD black = fYV12 ? 0x10101010 : (bihIn.biCompression == '2YUY') ? 0x80108010 : 0;
+
+ CSize sub(m_w, m_h);
+ CSize in(bihIn.biWidth, bihIn.biHeight);
+
+ if(FAILED(Copy((BYTE*)m_pTempPicBuff, pDataIn, sub, in, bpp, mt.subtype, black)))
+ return E_FAIL;
+
+ if(fYV12)
+ {
+ BYTE* pSubV = (BYTE*)m_pTempPicBuff + (sub.cx*bpp>>3)*sub.cy;
+ BYTE* pInV = pDataIn + (in.cx*bpp>>3)*in.cy;
+ sub.cx >>= 1; sub.cy >>= 1; in.cx >>= 1; in.cy >>= 1;
+ BYTE* pSubU = pSubV + (sub.cx*bpp>>3)*sub.cy;
+ BYTE* pInU = pInV + (in.cx*bpp>>3)*in.cy;
+ if(FAILED(Copy(pSubV, pInV, sub, in, bpp, mt.subtype, 0x80808080)))
+ return E_FAIL;
+ if(FAILED(Copy(pSubU, pInU, sub, in, bpp, mt.subtype, 0x80808080)))
+ return E_FAIL;
+ }
+
+ //
+
+ SubPicDesc spd = m_spd;
+
+ CComPtr<IMediaSample> pOut;
+ BYTE* pDataOut = NULL;
+ if(FAILED(hr = GetDeliveryBuffer(spd.w, spd.h, &pOut))
+ || FAILED(hr = pOut->GetPointer(&pDataOut)))
+ return hr;
+
+ pOut->SetTime(&rtStart, &rtStop);
+ pOut->SetMediaTime(NULL, NULL);
+
+ pOut->SetDiscontinuity(pIn->IsDiscontinuity() == S_OK);
+ pOut->SetSyncPoint(pIn->IsSyncPoint() == S_OK);
+ pOut->SetPreroll(pIn->IsPreroll() == S_OK);
+
+ //
+
+ BITMAPINFOHEADER bihOut;
+ ExtractBIH(&m_pOutput->CurrentMediaType(), &bihOut);
+
+ bool fInputFlipped = bihIn.biHeight >= 0 && bihIn.biCompression <= 3;
+ bool fOutputFlipped = bihOut.biHeight >= 0 && bihOut.biCompression <= 3;
+
+ bool fFlip = fInputFlipped != fOutputFlipped;
+ if(m_fFlipPicture) fFlip = !fFlip;
+ if(m_fMSMpeg4Fix) fFlip = !fFlip;
+// if(m_fDivxPlusFix) fFlip = !fFlip;
+
+ bool fFlipSub = fOutputFlipped;
+ if(m_fFlipSubtitles) fFlipSub = !fFlipSub;
+// if(m_fDivxPlusFix) fFlipSub = !fFlipSub;
+
+ //
+
+ {
+ CAutoLock cAutoLock(&m_csQueueLock);
+
+ if(m_pSubPicQueue)
+ {
+ CComPtr<ISubPic> pSubPic;
+ if(SUCCEEDED(m_pSubPicQueue->LookupSubPic(CalcCurrentTime(), &pSubPic)) && pSubPic)
+ {
+ CRect r;
+ pSubPic->GetDirtyRect(r);
+
+ if(fFlip ^ fFlipSub)
+ spd.h = -spd.h;
+
+ pSubPic->AlphaBlt(r, r, &spd);
+ }
+ }
+ }
+
+ CopyBuffer(pDataOut, (BYTE*)spd.bits, spd.w, abs(spd.h)*(fFlip?-1:1), spd.pitch, mt.subtype);
+
+ PrintMessages(pDataOut);
+
+ return m_pOutput->Deliver(pOut);
+}
+
+// CBaseFilter
+
+CBasePin* CDirectVobSubFilter::GetPin(int n)
+{
+ if(n < __super::GetPinCount())
+ return __super::GetPin(n);
+
+ n -= __super::GetPinCount();
+
+ if(n >= 0 && n < m_pTextInput.GetSize())
+ return m_pTextInput[n];
+
+ n -= m_pTextInput.GetSize();
+
+ return NULL;
+}
+
+int CDirectVobSubFilter::GetPinCount()
+{
+ return __super::GetPinCount() + m_pTextInput.GetSize();
+}
+
+HRESULT CDirectVobSubFilter::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName)
+{
+ if(pGraph)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0))
+ {
+ unsigned __int64 ver = GetFileVersion(_T("divx_c32.ax"));
+ if(((ver >> 48)&0xffff) == 4 && ((ver >> 32)&0xffff) == 2)
+ {
+ DWORD dwVersion = GetVersion();
+ DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
+ DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
+
+ if(dwVersion < 0x80000000 && dwWindowsMajorVersion >= 5)
+ {
+ AfxMessageBox(IDS_DIVX_WARNING);
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 1);
+ }
+ }
+ }
+
+ /*removeme*/
+ if(!g_RegOK)
+ {
+ DllRegisterServer();
+ g_RegOK = true;
+ }
+ }
+ else
+ {
+ if(m_hSystrayThread)
+ {
+ SendMessage(m_tbid.hSystrayWnd, WM_CLOSE, 0, 0);
+
+ if(WaitForSingleObject(m_hSystrayThread, 10000) != WAIT_OBJECT_0)
+ {
+ DbgLog((LOG_TRACE, 0, _T("CALL THE AMBULANCE!!!")));
+ TerminateThread(m_hSystrayThread, (DWORD)-1);
+ }
+
+ m_hSystrayThread = 0;
+ }
+ }
+
+ return __super::JoinFilterGraph(pGraph, pName);
+}
+
+STDMETHODIMP CDirectVobSubFilter::QueryFilterInfo(FILTER_INFO* pInfo)
+{
+ CheckPointer(pInfo, E_POINTER);
+ ValidateReadWritePtr(pInfo, sizeof(FILTER_INFO));
+
+ if(!get_Forced())
+ return __super::QueryFilterInfo(pInfo);
+
+ wcscpy(pInfo->achName, L"DirectVobSub (forced auto-loading version)");
+ if(pInfo->pGraph = m_pGraph) m_pGraph->AddRef();
+
+ return S_OK;
+}
+
+// CTransformFilter
+
+HRESULT CDirectVobSubFilter::SetMediaType(PIN_DIRECTION dir, const CMediaType* pmt)
+{
+ HRESULT hr = __super::SetMediaType(dir, pmt);
+ if(FAILED(hr)) return hr;
+
+ if(dir == PINDIR_INPUT)
+ {
+ CAutoLock cAutoLock(&m_csReceive);
+
+ REFERENCE_TIME atpf =
+ pmt->formattype == FORMAT_VideoInfo ? ((VIDEOINFOHEADER*)pmt->Format())->AvgTimePerFrame :
+ pmt->formattype == FORMAT_VideoInfo2 ? ((VIDEOINFOHEADER2*)pmt->Format())->AvgTimePerFrame :
+ 0;
+
+ m_fps = atpf ? 10000000.0 / atpf : 25;
+
+ InitSubPicQueue();
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+
+ }
+
+ return hr;
+}
+
+HRESULT CDirectVobSubFilter::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ /*removeme*/
+ if(HmGyanusVagyTeNekem(pPin)) return(E_FAIL);
+ }
+
+ return __super::CheckConnect(dir, pPin);
+}
+
+HRESULT CDirectVobSubFilter::CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ CComPtr<IBaseFilter> pFilter;
+
+ // needed when we have a decoder with a version number of 3.x
+ if(SUCCEEDED(m_pGraph->FindFilterByName(L"DivX MPEG-4 DVD Video Decompressor ", &pFilter))
+ && (GetFileVersion(_T("divx_c32.ax")) >> 48) <= 4
+ || SUCCEEDED(m_pGraph->FindFilterByName(L"Microcrap MPEG-4 Video Decompressor", &pFilter))
+ || SUCCEEDED(m_pGraph->FindFilterByName(L"Microsoft MPEG-4 Video Decompressor", &pFilter))
+ && (GetFileVersion(_T("mpg4ds32.ax")) >> 48) <= 3)
+ {
+ m_fMSMpeg4Fix = true;
+ }
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ if(!m_hSystrayThread)
+ {
+ m_tbid.graph = m_pGraph;
+ m_tbid.dvs = static_cast<IDirectVobSub*>(this);
+
+ DWORD tid;
+ m_hSystrayThread = CreateThread(0, 0, SystrayThreadProc, &m_tbid, 0, &tid);
+ }
+
+ // HACK: triggers CBaseVideoFilter::SetMediaType to adjust m_w/m_h/.. and InitSubPicQueue() to realloc buffers
+ m_pInput->SetMediaType(&m_pInput->CurrentMediaType());
+ }
+
+ return __super::CompleteConnect(dir, pReceivePin);
+}
+
+HRESULT CDirectVobSubFilter::BreakConnect(PIN_DIRECTION dir)
+{
+ if(dir == PINDIR_INPUT)
+ {
+ if(m_pOutput->IsConnected())
+ {
+ m_pOutput->GetConnected()->Disconnect();
+ m_pOutput->Disconnect();
+ }
+ }
+ else if(dir == PINDIR_OUTPUT)
+ {
+ // not really needed, but may free up a little memory
+ CAutoLock cAutoLock(&m_csQueueLock);
+ m_pSubPicQueue = NULL;
+ }
+
+ return __super::BreakConnect(dir);
+}
+
+HRESULT CDirectVobSubFilter::StartStreaming()
+{
+ m_fLoading = false;
+
+ InitSubPicQueue();
+
+ m_tbid.fRunOnce = true;
+
+ CComPtr<IBaseFilter> pFilter;
+ m_fDivxPlusFix = SUCCEEDED(m_pGraph->FindFilterByName(L"HPlus YUV Video Renderer", &pFilter));
+
+ put_MediaFPS(m_fMediaFPSEnabled, m_MediaFPS);
+
+ return __super::StartStreaming();
+}
+
+HRESULT CDirectVobSubFilter::StopStreaming()
+{
+ InvalidateSubtitle();
+
+ return __super::StopStreaming();
+}
+
+HRESULT CDirectVobSubFilter::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ m_tPrev = tStart;
+ return __super::NewSegment(tStart, tStop, dRate);
+}
+
+//
+
+REFERENCE_TIME CDirectVobSubFilter::CalcCurrentTime()
+{
+ REFERENCE_TIME rt = m_pSubClock ? m_pSubClock->GetTime() : m_tPrev;
+ return (rt - 10000i64*m_SubtitleDelay) * m_SubtitleSpeedMul / m_SubtitleSpeedDiv; // no, it won't overflow if we use normal parameters (__int64 is enough for about 2000 hours if we multiply it by the max: 65536 as m_SubtitleSpeedMul)
+}
+
+void CDirectVobSubFilter::InitSubPicQueue()
+{
+ CAutoLock cAutoLock(&m_csQueueLock);
+
+ m_pSubPicQueue = NULL;
+
+ m_pTempPicBuff.Free();
+ m_pTempPicBuff.Allocate(4*m_w*m_h);
+
+ const GUID& subtype = m_pInput->CurrentMediaType().subtype;
+
+ BITMAPINFOHEADER bihIn;
+ ExtractBIH(&m_pInput->CurrentMediaType(), &bihIn);
+
+ m_spd.type = -1;
+ if(subtype == MEDIASUBTYPE_YV12) m_spd.type = MSP_YV12;
+ else if(subtype == MEDIASUBTYPE_I420 || subtype == MEDIASUBTYPE_IYUV) m_spd.type = MSP_IYUV;
+ else if(subtype == MEDIASUBTYPE_YUY2) m_spd.type = MSP_YUY2;
+ else if(subtype == MEDIASUBTYPE_RGB32) m_spd.type = MSP_RGB32;
+ else if(subtype == MEDIASUBTYPE_RGB24) m_spd.type = MSP_RGB24;
+ else if(subtype == MEDIASUBTYPE_RGB565) m_spd.type = MSP_RGB16;
+ else if(subtype == MEDIASUBTYPE_RGB555) m_spd.type = MSP_RGB15;
+ m_spd.w = m_w;
+ m_spd.h = m_h;
+ m_spd.bpp = (m_spd.type == MSP_YV12 || m_spd.type == MSP_IYUV) ? 8 : bihIn.biBitCount;
+ m_spd.pitch = m_spd.w*m_spd.bpp>>3;
+ m_spd.bits = (void*)m_pTempPicBuff;
+
+ CComPtr<ISubPicAllocator> pSubPicAllocator = new CMemSubPicAllocator(m_spd.type, CSize(m_w, m_h));
+
+ CSize video(bihIn.biWidth, bihIn.biHeight), window = video;
+ if(AdjustFrameSize(window)) video += video;
+ ASSERT(window == CSize(m_w, m_h));
+
+ pSubPicAllocator->SetCurSize(window);
+ pSubPicAllocator->SetCurVidRect(CRect(CPoint((window.cx - video.cx)/2, (window.cy - video.cy)/2), video));
+
+ HRESULT hr = S_OK;
+ m_pSubPicQueue = m_fDoPreBuffering
+ ? (ISubPicQueue*)new CSubPicQueue(10, pSubPicAllocator, &hr)
+ : (ISubPicQueue*)new CSubPicQueueNoThread(pSubPicAllocator, &hr);
+
+ if(FAILED(hr)) m_pSubPicQueue = NULL;
+
+ UpdateSubtitle(false);
+
+ if(m_hbm) {DeleteObject(m_hbm); m_hbm = NULL;}
+ if(m_hdc) {DeleteDC(m_hdc); m_hdc = NULL;}
+
+ struct {BITMAPINFOHEADER bih; DWORD mask[3];} b = {{sizeof(BITMAPINFOHEADER), m_w, -(int)m_h, 1, 32, BI_BITFIELDS, 0, 0, 0, 0, 0}, 0xFF0000, 0x00FF00, 0x0000FF};
+ m_hdc = CreateCompatibleDC(NULL);
+ m_hbm = CreateDIBSection(m_hdc, (BITMAPINFO*)&b, DIB_RGB_COLORS, NULL, NULL, 0);
+
+ BITMAP bm;
+ GetObject(m_hbm, sizeof(bm), &bm);
+ memsetd(bm.bmBits, 0xFF000000, bm.bmHeight*bm.bmWidthBytes);
+}
+
+bool CDirectVobSubFilter::AdjustFrameSize(CSize& s)
+{
+ int horizontal, vertical, resx2, resx2minw, resx2minh;
+ get_ExtendPicture(&horizontal, &vertical, &resx2, &resx2minw, &resx2minh);
+
+ bool fRet = (resx2 == 1) || (resx2 == 2 && s.cx*s.cy <= resx2minw*resx2minh);
+
+ if(fRet)
+ {
+ s.cx <<= 1;
+ s.cy <<= 1;
+ }
+
+ int h;
+ switch(vertical&0x7f)
+ {
+ case 1:
+ h = s.cx * 9 / 16;
+ if(s.cy < h || !!(vertical&0x80)) s.cy = (h + 3) & ~3;
+ break;
+ case 2:
+ h = s.cx * 3 / 4;
+ if(s.cy < h || !!(vertical&0x80)) s.cy = (h + 3) & ~3;
+ break;
+ case 3:
+ h = 480;
+ if(s.cy < h || !!(vertical&0x80)) s.cy = (h + 3) & ~3;
+ break;
+ case 4:
+ h = 576;
+ if(s.cy < h || !!(vertical&0x80)) s.cy = (h + 3) & ~3;
+ break;
+ }
+
+ if(horizontal == 1)
+ {
+ s.cx = (s.cx + 31) & ~31;
+ s.cy = (s.cy + 1) & ~1;
+ }
+
+ return(fRet);
+}
+
+STDMETHODIMP CDirectVobSubFilter::Count(DWORD* pcStreams)
+{
+ if(!pcStreams) return E_POINTER;
+
+ *pcStreams = 0;
+
+ int nLangs = 0;
+ if(SUCCEEDED(get_LanguageCount(&nLangs)))
+ (*pcStreams) += nLangs;
+
+ (*pcStreams) += 2; // enable ... disable
+
+ (*pcStreams) += 2; // normal flipped
+
+ return S_OK;
+}
+
+#define MAXPREFLANGS 5
+
+int CDirectVobSubFilter::FindPreferedLanguage(bool fHideToo)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ int nLangs;
+ get_LanguageCount(&nLangs);
+
+ if(nLangs <= 0) return(0);
+
+ for(int i = 0; i < MAXPREFLANGS; i++)
+ {
+ CString tmp;
+ tmp.Format(IDS_RL_LANG, i);
+
+ CString lang = theApp.GetProfileString(ResStr(IDS_R_PREFLANGS), tmp);
+
+ if(!lang.IsEmpty())
+ {
+ for(int ret = 0; ret < nLangs; ret++)
+ {
+ CString l;
+ WCHAR* pName = NULL;
+ get_LanguageName(ret, &pName);
+ l = pName;
+ CoTaskMemFree(pName);
+
+ if(!l.CompareNoCase(lang)) return(ret);
+ }
+ }
+ }
+
+ return(0);
+}
+
+void CDirectVobSubFilter::UpdatePreferedLanguages(CString l)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CString langs[MAXPREFLANGS+1];
+
+ int i = 0, j = 0, k = -1;
+ for(; i < MAXPREFLANGS; i++)
+ {
+ CString tmp;
+ tmp.Format(IDS_RL_LANG, i);
+
+ langs[j] = theApp.GetProfileString(ResStr(IDS_R_PREFLANGS), tmp);
+
+ if(!langs[j].IsEmpty())
+ {
+ if(!langs[j].CompareNoCase(l)) k = j;
+ j++;
+ }
+ }
+
+ if(k == -1)
+ {
+ langs[k = j] = l;
+ j++;
+ }
+
+ // move the selected to the top of the list
+
+ while(k > 0)
+ {
+ CString tmp = langs[k]; langs[k] = langs[k-1]; langs[k-1] = tmp;
+ k--;
+ }
+
+ // move "Hide subtitles" to the last position if it wasn't our selection
+
+ CString hidesubs;
+ hidesubs.LoadString(IDS_M_HIDESUBTITLES);
+
+ for(k = 1; k < j; k++)
+ {
+ if(!langs[k].CompareNoCase(hidesubs)) break;
+ }
+
+ while(k < j-1)
+ {
+ CString tmp = langs[k]; langs[k] = langs[k+1]; langs[k+1] = tmp;
+ k++;
+ }
+
+ for(i = 0; i < j; i++)
+ {
+ CString tmp;
+ tmp.Format(IDS_RL_LANG, i);
+
+ theApp.WriteProfileString(ResStr(IDS_R_PREFLANGS), tmp, langs[i]);
+ }
+}
+
+STDMETHODIMP CDirectVobSubFilter::Enable(long lIndex, DWORD dwFlags)
+{
+ if(!(dwFlags & AMSTREAMSELECTENABLE_ENABLE))
+ return E_NOTIMPL;
+
+ int nLangs = 0;
+ get_LanguageCount(&nLangs);
+
+ if(!(lIndex >= 0 && lIndex < nLangs+2+2))
+ return E_INVALIDARG;
+
+ int i = lIndex-1;
+
+ if(i == -1 && !m_fLoading) // we need this because when loading something stupid media player pushes the first stream it founds, which is "enable" in our case
+ {
+ put_HideSubtitles(false);
+ }
+ else if(i >= 0 && i < nLangs)
+ {
+ put_HideSubtitles(false);
+ put_SelectedLanguage(i);
+
+ WCHAR* pName = NULL;
+ if(SUCCEEDED(get_LanguageName(i, &pName)))
+ {
+ UpdatePreferedLanguages(CString(pName));
+ if(pName) CoTaskMemFree(pName);
+ }
+ }
+ else if(i == nLangs && !m_fLoading)
+ {
+ put_HideSubtitles(true);
+ }
+ else if((i == nLangs+1 || i == nLangs+2) && !m_fLoading)
+ {
+ put_Flip(i == nLangs+2, m_fFlipSubtitles);
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSubFilter::Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ int nLangs = 0;
+ get_LanguageCount(&nLangs);
+
+ if(!(lIndex >= 0 && lIndex < nLangs+2+2))
+ return E_INVALIDARG;
+
+ int i = lIndex-1;
+
+ if(ppmt) *ppmt = CreateMediaType(&m_pInput->CurrentMediaType());
+
+ if(pdwFlags)
+ {
+ *pdwFlags = 0;
+
+ if(i == -1 && !m_fHideSubtitles
+ || i >= 0 && i < nLangs && i == m_iSelectedLanguage
+ || i == nLangs && m_fHideSubtitles
+ || i == nLangs+1 && !m_fFlipPicture
+ || i == nLangs+2 && m_fFlipPicture)
+ {
+ *pdwFlags |= AMSTREAMSELECTINFO_ENABLED;
+ }
+ }
+
+ if(plcid) *plcid = 0;
+
+ if(pdwGroup) *pdwGroup = 0x648E51;
+
+ if(ppszName)
+ {
+ *ppszName = NULL;
+
+ CStringW str;
+ if(i == -1) str = ResStr(IDS_M_SHOWSUBTITLES);
+ else if(i >= 0 && i < nLangs) get_LanguageName(i, ppszName);
+ else if(i == nLangs) str = ResStr(IDS_M_HIDESUBTITLES);
+ else if(i == nLangs+1) {str = ResStr(IDS_M_ORIGINALPICTURE); if(pdwGroup) (*pdwGroup)++;}
+ else if(i == nLangs+2) {str = ResStr(IDS_M_FLIPPEDPICTURE); if(pdwGroup) (*pdwGroup)++;}
+
+ if(!str.IsEmpty())
+ {
+ *ppszName = (WCHAR*)CoTaskMemAlloc((str.GetLength()+1)*sizeof(WCHAR));
+ if(*ppszName == NULL) return S_FALSE;
+ wcscpy(*ppszName, str);
+ }
+ }
+
+ if(ppObject) *ppObject = NULL;
+
+ if(ppUnk) *ppUnk = NULL;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDirectVobSubFilter::GetClassID(CLSID* pClsid)
+{
+ if(pClsid == NULL) return E_POINTER;
+ *pClsid = m_clsid;
+ return NOERROR;
+}
+
+STDMETHODIMP CDirectVobSubFilter::GetPages(CAUUID* pPages)
+{
+ CheckPointer(pPages, E_POINTER);
+
+ pPages->cElems = 7;
+ pPages->pElems = (GUID*)CoTaskMemAlloc(sizeof(GUID)*pPages->cElems);
+
+ if(pPages->pElems == NULL) return E_OUTOFMEMORY;
+
+ int i = 0;
+ pPages->pElems[i++] = __uuidof(CDVSMainPPage);
+ pPages->pElems[i++] = __uuidof(CDVSGeneralPPage);
+ pPages->pElems[i++] = __uuidof(CDVSMiscPPage);
+ pPages->pElems[i++] = __uuidof(CDVSTimingPPage);
+ pPages->pElems[i++] = __uuidof(CDVSColorPPage);
+ pPages->pElems[i++] = __uuidof(CDVSPathsPPage);
+ pPages->pElems[i++] = __uuidof(CDVSAboutPPage);
+
+ return NOERROR;
+}
+
+// IDirectVobSub
+
+STDMETHODIMP CDirectVobSubFilter::put_FileName(WCHAR* fn)
+{
+ HRESULT hr = CDirectVobSub::put_FileName(fn);
+
+ if(hr == S_OK && !Open())
+ {
+ m_FileName.Empty();
+ hr = E_FAIL;
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::get_LanguageCount(int* nLangs)
+{
+ HRESULT hr = CDirectVobSub::get_LanguageCount(nLangs);
+
+ if(hr == NOERROR && nLangs)
+ {
+ CAutoLock cAutolock(&m_csQueueLock);
+
+ *nLangs = 0;
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos) (*nLangs) += m_pSubStreams.GetNext(pos)->GetStreamCount();
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::get_LanguageName(int iLanguage, WCHAR** ppName)
+{
+ HRESULT hr = CDirectVobSub::get_LanguageName(iLanguage, ppName);
+
+ if(!ppName) return E_POINTER;
+
+ if(hr == NOERROR)
+ {
+ CAutoLock cAutolock(&m_csQueueLock);
+
+ hr = E_INVALIDARG;
+
+ int i = iLanguage;
+
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(i >= 0 && pos)
+ {
+ CComPtr<ISubStream> pSubStream = m_pSubStreams.GetNext(pos);
+
+ if(i < pSubStream->GetStreamCount())
+ {
+ pSubStream->GetStreamInfo(i, ppName, NULL);
+ hr = NOERROR;
+ break;
+ }
+
+ i -= pSubStream->GetStreamCount();
+ }
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::put_SelectedLanguage(int iSelected)
+{
+ HRESULT hr = CDirectVobSub::put_SelectedLanguage(iSelected);
+
+ if(hr == NOERROR)
+ {
+ UpdateSubtitle(false);
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::put_HideSubtitles(bool fHideSubtitles)
+{
+ HRESULT hr = CDirectVobSub::put_HideSubtitles(fHideSubtitles);
+
+ if(hr == NOERROR)
+ {
+ UpdateSubtitle(false);
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::put_PreBuffering(bool fDoPreBuffering)
+{
+ HRESULT hr = CDirectVobSub::put_PreBuffering(fDoPreBuffering);
+
+ if(hr == NOERROR)
+ {
+ InitSubPicQueue();
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::put_Placement(bool fOverridePlacement, int xperc, int yperc)
+{
+ HRESULT hr = CDirectVobSub::put_Placement(fOverridePlacement, xperc, yperc);
+
+ if(hr == NOERROR)
+ {
+ UpdateSubtitle(true);
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fReserved)
+{
+ HRESULT hr = CDirectVobSub::put_VobSubSettings(fBuffer, fOnlyShowForcedSubs, fReserved);
+
+ if(hr == NOERROR)
+ {
+// UpdateSubtitle(false);
+ InvalidateSubtitle();
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer)
+{
+ HRESULT hr = CDirectVobSub::put_TextSettings(lf, lflen, color, fShadow, fOutline, fAdvancedRenderer);
+
+ if(hr == NOERROR)
+ {
+// UpdateSubtitle(true);
+ InvalidateSubtitle();
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::put_SubtitleTiming(int delay, int speedmul, int speeddiv)
+{
+ HRESULT hr = CDirectVobSub::put_SubtitleTiming(delay, speedmul, speeddiv);
+
+ if(hr == NOERROR)
+ {
+ InvalidateSubtitle();
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::get_MediaFPS(bool* fEnabled, double* fps)
+{
+ HRESULT hr = CDirectVobSub::get_MediaFPS(fEnabled, fps);
+
+ CComQIPtr<IMediaSeeking> pMS = m_pGraph;
+ double rate;
+ if(pMS && SUCCEEDED(pMS->GetRate(&rate)))
+ {
+ m_MediaFPS = rate * m_fps;
+ if(fps) *fps = m_MediaFPS;
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::put_MediaFPS(bool fEnabled, double fps)
+{
+ HRESULT hr = CDirectVobSub::put_MediaFPS(fEnabled, fps);
+
+ CComQIPtr<IMediaSeeking> pMS = m_pGraph;
+ if(pMS)
+ {
+ if(hr == NOERROR)
+ {
+ hr = pMS->SetRate(m_fMediaFPSEnabled ? m_MediaFPS / m_fps : 1.0);
+ }
+
+ double dRate;
+ if(SUCCEEDED(pMS->GetRate(&dRate)))
+ m_MediaFPS = dRate * m_fps;
+ }
+
+ return hr;
+}
+
+STDMETHODIMP CDirectVobSubFilter::get_ZoomRect(NORMALIZEDRECT* rect)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CDirectVobSubFilter::put_ZoomRect(NORMALIZEDRECT* rect)
+{
+ return E_NOTIMPL;
+}
+
+// IDirectVobSub2
+
+STDMETHODIMP CDirectVobSubFilter::put_TextSettings(STSStyle* pDefStyle)
+{
+ HRESULT hr = CDirectVobSub::put_TextSettings(pDefStyle);
+
+ if(hr == NOERROR)
+ {
+ UpdateSubtitle(true);
+ }
+
+ return hr;
+}
+
+// IDirectVobSubFilterColor
+
+STDMETHODIMP CDirectVobSubFilter::HasConfigDialog(int iSelected)
+{
+ int nLangs;
+ if(FAILED(get_LanguageCount(&nLangs))) return E_FAIL;
+ return E_FAIL;
+ // TODO: temporally disabled since we don't have a new textsub/vobsub editor dlg for dvs yet
+// return(nLangs >= 0 && iSelected < nLangs ? S_OK : E_FAIL);
+}
+
+STDMETHODIMP CDirectVobSubFilter::ShowConfigDialog(int iSelected, HWND hWndParent)
+{
+ // TODO: temporally disabled since we don't have a new textsub/vobsub editor dlg for dvs yet
+ return(E_FAIL);
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+CDirectVobSubFilter2::CDirectVobSubFilter2(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid) :
+ CDirectVobSubFilter(punk, phr, clsid)
+{
+}
+
+HRESULT CDirectVobSubFilter2::CheckConnect(PIN_DIRECTION dir, IPin* pPin)
+{
+ CPinInfo pi;
+ if(FAILED(pPin->QueryPinInfo(&pi))) return E_FAIL;
+
+ if(CComQIPtr<IDirectVobSub>(pi.pFilter)) return E_FAIL;
+
+ if(dir == PINDIR_INPUT)
+ {
+ CFilterInfo fi;
+ if(SUCCEEDED(pi.pFilter->QueryFilterInfo(&fi))
+ && !wcsnicmp(fi.achName, L"Overlay Mixer", 13))
+ return(E_FAIL);
+ }
+ else
+ {
+ }
+
+ return __super::CheckConnect(dir, pPin);
+}
+
+HRESULT CDirectVobSubFilter2::JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName)
+{
+ if(pGraph)
+ {
+ BeginEnumFilters(pGraph, pEF, pBF)
+ {
+ if(pBF != (IBaseFilter*)this && CComQIPtr<IDirectVobSub>(pBF))
+ return E_FAIL;
+ }
+ EndEnumFilters
+
+ // don't look... we will do some serious graph hacking again...
+ //
+ // we will add dvs2 to the filter graph cache
+ // - if the main app has already added some kind of renderer or overlay mixer (anything which accepts video on its input)
+ // and
+ // - if we have a reason to auto-load (we don't want to make any trouble when there is no need :)
+ //
+ // This whole workaround is needed because the video stream will always be connected
+ // to the pre-added filters first, no matter how high merit we have.
+
+ if(!get_Forced())
+ {
+ BeginEnumFilters(pGraph, pEF, pBF)
+ {
+ if(CComQIPtr<IDirectVobSub>(pBF))
+ continue;
+
+ CComPtr<IPin> pInPin = GetFirstPin(pBF, PINDIR_INPUT);
+ CComPtr<IPin> pOutPin = GetFirstPin(pBF, PINDIR_OUTPUT);
+
+ if(!pInPin)
+ continue;
+
+ CComPtr<IPin> pPin;
+ if(pInPin && SUCCEEDED(pInPin->ConnectedTo(&pPin))
+ || pOutPin && SUCCEEDED(pOutPin->ConnectedTo(&pPin)))
+ continue;
+
+ if(pOutPin && GetFilterName(pBF) == _T("Overlay Mixer"))
+ continue;
+
+ bool fVideoInputPin = false;
+
+ do
+ {
+ BITMAPINFOHEADER bih = {sizeof(BITMAPINFOHEADER), 384, 288, 1, 16, '2YUY', 384*288*2, 0, 0, 0, 0};
+
+ CMediaType cmt;
+ cmt.majortype = MEDIATYPE_Video;
+ cmt.subtype = MEDIASUBTYPE_YUY2;
+ cmt.formattype = FORMAT_VideoInfo;
+ cmt.pUnk = NULL;
+ cmt.bFixedSizeSamples = TRUE;
+ cmt.bTemporalCompression = TRUE;
+ cmt.lSampleSize = 384*288*2;
+ VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)cmt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+ memset(vih, 0, sizeof(VIDEOINFOHEADER));
+ memcpy(&vih->bmiHeader, &bih, sizeof(bih));
+ vih->AvgTimePerFrame = 400000;
+
+ if(SUCCEEDED(pInPin->QueryAccept(&cmt)))
+ {
+ fVideoInputPin = true;
+ break;
+ }
+
+ VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)cmt.AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
+ memset(vih2, 0, sizeof(VIDEOINFOHEADER2));
+ memcpy(&vih2->bmiHeader, &bih, sizeof(bih));
+ vih2->AvgTimePerFrame = 400000;
+ vih2->dwPictAspectRatioX = 384;
+ vih2->dwPictAspectRatioY = 288;
+
+ if(SUCCEEDED(pInPin->QueryAccept(&cmt)))
+ {
+ fVideoInputPin = true;
+ break;
+ }
+ }
+ while(false);
+
+ if(fVideoInputPin)
+ {
+ CComPtr<IBaseFilter> pDVS;
+ if(ShouldWeAutoload(pGraph) && SUCCEEDED(pDVS.CoCreateInstance(__uuidof(CDirectVobSubFilter2))))
+ {
+ CComQIPtr<IDirectVobSub2>(pDVS)->put_Forced(true);
+ CComQIPtr<IGraphConfig>(pGraph)->AddFilterToCache(pDVS);
+ }
+
+ break;
+ }
+ }
+ EndEnumFilters
+ }
+ }
+ else
+ {
+ }
+
+ return __super::JoinFilterGraph(pGraph, pName);
+}
+
+HRESULT CDirectVobSubFilter2::CheckInputType(const CMediaType* mtIn)
+{
+ HRESULT hr = __super::CheckInputType(mtIn);
+
+ if(FAILED(hr) || m_pInput->IsConnected()) return hr;
+
+ if(!ShouldWeAutoload(m_pGraph)) return VFW_E_TYPE_NOT_ACCEPTED;
+
+ GetRidOfInternalScriptRenderer();
+
+ return NOERROR;
+}
+
+bool CDirectVobSubFilter2::ShouldWeAutoload(IFilterGraph* pGraph)
+{
+ TCHAR blacklistedapps[][32] =
+ {
+ _T("WM8EUTIL."), // wmp8 encoder's dummy renderer releases the outputted media sample after calling Receive on its input pin (yes, even when dvobsub isn't registered at all)
+ _T("explorer."), // as some users reported thumbnail preview loads dvobsub, I've never experienced this yet...
+ _T("producer."), // this is real's producer
+ };
+
+ for(int i = 0; i < countof(blacklistedapps); i++)
+ {
+ if(theApp.m_AppName.Find(blacklistedapps[i]) >= 0)
+ return(false);
+ }
+
+ int level;
+ bool m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad;
+ get_LoadSettings(&level, &m_fExternalLoad, &m_fWebLoad, &m_fEmbeddedLoad);
+
+ if(level < 0 || level >= 2) return(false);
+
+ bool fRet = false;
+
+ if(level == 1)
+ fRet = m_fExternalLoad = m_fWebLoad = m_fEmbeddedLoad = true;
+
+ // find text stream on known splitters
+
+ if(!fRet && m_fEmbeddedLoad)
+ {
+ CComPtr<IBaseFilter> pBF;
+ if((pBF = FindFilter(CLSID_OggSplitter, pGraph)) || (pBF = FindFilter(CLSID_AviSplitter, pGraph))
+ || (pBF = FindFilter(L"{34293064-02F2-41D5-9D75-CC5967ACA1AB}", pGraph)) // matroska demux
+ || (pBF = FindFilter(L"{0A68C3B5-9164-4a54-AFAF-995B2FF0E0D4}", pGraph)) // matroska source
+ || (pBF = FindFilter(L"{149D2E01-C32E-4939-80F6-C07B81015A7A}", pGraph)) // matroska splitter
+ || (pBF = FindFilter(L"{9AB95E90-1F37-427e-9B3D-257FB0CB25F7}", pGraph)) // Haali's matroska splitter (?)
+ || (pBF = FindFilter(L"{55DA30FC-F16B-49fc-BAA5-AE59FC65F82D}", pGraph)) // Haali's matroska splitter
+ || (pBF = FindFilter(L"{52B63861-DC93-11CE-A099-00AA00479A58}", pGraph)) // 3ivx splitter
+ || (pBF = FindFilter(L"{6D3688CE-3E9D-42F4-92CA-8A11119D25CD}", pGraph)) // our ogg source
+ || (pBF = FindFilter(L"{9FF48807-E133-40AA-826F-9B2959E5232D}", pGraph)) // our ogg splitter
+ || (pBF = FindFilter(L"{803E8280-F3CE-4201-982C-8CD8FB512004}", pGraph)) // dsm source
+ || (pBF = FindFilter(L"{0912B4DD-A30A-4568-B590-7179EBB420EC}", pGraph)) // dsm splitter
+ || (pBF = FindFilter(L"{3CCC052E-BDEE-408a-BEA7-90914EF2964B}", pGraph)) // mp4 source
+ || (pBF = FindFilter(L"{61F47056-E400-43d3-AF1E-AB7DFFD4C4AD}", pGraph))) // mp4 splitter
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ BeginEnumMediaTypes(pPin, pEM, pmt)
+ {
+ if(pmt->majortype == MEDIATYPE_Text || pmt->majortype == MEDIATYPE_Subtitle)
+ {
+ fRet = true;
+ break;
+ }
+ }
+ EndEnumMediaTypes(pmt)
+ if(fRet) break;
+ }
+ EndEnumFilters
+ }
+ }
+
+ // find file name
+
+ CStringW fn;
+
+ BeginEnumFilters(pGraph, pEF, pBF)
+ {
+ if(CComQIPtr<IFileSourceFilter> pFSF = pBF)
+ {
+ LPOLESTR fnw = NULL;
+ if(!pFSF || FAILED(pFSF->GetCurFile(&fnw, NULL)) || !fnw)
+ continue;
+ fn = CString(fnw);
+ CoTaskMemFree(fnw);
+ break;
+ }
+ }
+ EndEnumFilters
+
+ if((m_fExternalLoad || m_fWebLoad) && (m_fWebLoad || !(wcsstr(fn, L"http://") || wcsstr(fn, L"mms://"))))
+ {
+ bool fTemp = m_fHideSubtitles;
+ fRet = !fn.IsEmpty() && SUCCEEDED(put_FileName((LPWSTR)(LPCWSTR)fn))
+ || SUCCEEDED(put_FileName(L"c:\\tmp.srt"))
+ || fRet;
+ if(fTemp) m_fHideSubtitles = true;
+ }
+
+ return(fRet);
+}
+
+void CDirectVobSubFilter2::GetRidOfInternalScriptRenderer()
+{
+ while(CComPtr<IBaseFilter> pBF = FindFilter(L"{48025243-2D39-11CE-875D-00608CB78066}", m_pGraph))
+ {
+ BeginEnumPins(pBF, pEP, pPin)
+ {
+ PIN_DIRECTION dir;
+ CComPtr<IPin> pPinTo;
+
+ if(SUCCEEDED(pPin->QueryDirection(&dir)) && dir == PINDIR_INPUT
+ && SUCCEEDED(pPin->ConnectedTo(&pPinTo)))
+ {
+ m_pGraph->Disconnect(pPinTo);
+ m_pGraph->Disconnect(pPin);
+ m_pGraph->ConnectDirect(pPinTo, GetPin(2 + m_pTextInput.GetSize()-1), NULL);
+ }
+ }
+ EndEnumPins
+
+ if(FAILED(m_pGraph->RemoveFilter(pBF)))
+ break;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+bool CDirectVobSubFilter::Open()
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CAutoLock cAutolock(&m_csQueueLock);
+
+ m_pSubStreams.RemoveAll();
+
+ m_frd.files.RemoveAll();
+
+ CStringArray paths;
+
+ for(int i = 0; i < 10; i++)
+ {
+ CString tmp;
+ tmp.Format(IDS_RP_PATH, i);
+ CString path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp);
+ if(!path.IsEmpty()) paths.Add(path);
+ }
+
+ SubFiles ret;
+ GetSubFileNames(m_FileName, paths, ret);
+
+ for(int i = 0; i < ret.GetSize(); i++)
+ {
+ if(m_frd.files.Find(ret[i].fn))
+ continue;
+
+ CComPtr<ISubStream> pSubStream;
+
+ if(!pSubStream)
+ {
+ CAutoPtr<CVobSubFile> pVSF(new CVobSubFile(&m_csSubLock));
+ if(pVSF && pVSF->Open(ret[i].fn) && pVSF->GetStreamCount() > 0)
+ {
+ pSubStream = pVSF.Detach();
+ m_frd.files.AddTail(ret[i].fn.Left(ret[i].fn.GetLength()-4) + _T(".sub"));
+ }
+ }
+
+ if(!pSubStream)
+ {
+ CAutoPtr<CRenderedTextSubtitle> pRTS(new CRenderedTextSubtitle(&m_csSubLock));
+ if(pRTS && pRTS->Open(ret[i].fn, DEFAULT_CHARSET) && pRTS->GetStreamCount() > 0)
+ {
+ pSubStream = pRTS.Detach();
+ m_frd.files.AddTail(ret[i].fn + _T(".style"));
+ }
+ }
+
+ if(pSubStream)
+ {
+ m_pSubStreams.AddTail(pSubStream);
+ m_frd.files.AddTail(ret[i].fn);
+ }
+ }
+
+ for(int i = 0; i < m_pTextInput.GetSize(); i++)
+ {
+ if(m_pTextInput[i]->IsConnected())
+ m_pSubStreams.AddTail(m_pTextInput[i]->GetSubStream());
+ }
+
+ if(S_FALSE == put_SelectedLanguage(FindPreferedLanguage()))
+ UpdateSubtitle(false); // make sure pSubPicProvider of our queue gets updated even if the stream number hasn't changed
+
+ m_frd.RefreshEvent.Set();
+
+ return(m_pSubStreams.GetCount() > 0);
+}
+
+void CDirectVobSubFilter::UpdateSubtitle(bool fApplyDefStyle)
+{
+ CAutoLock cAutolock(&m_csQueueLock);
+
+ if(!m_pSubPicQueue) return;
+
+ InvalidateSubtitle();
+
+ CComPtr<ISubStream> pSubStream;
+
+ if(!m_fHideSubtitles)
+ {
+ int i = m_iSelectedLanguage;
+
+ for(POSITION pos = m_pSubStreams.GetHeadPosition(); i >= 0 && pos; pSubStream = NULL)
+ {
+ pSubStream = m_pSubStreams.GetNext(pos);
+
+ if(i < pSubStream->GetStreamCount())
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+ pSubStream->SetStream(i);
+ break;
+ }
+
+ i -= pSubStream->GetStreamCount();
+ }
+ }
+
+ SetSubtitle(pSubStream, fApplyDefStyle);
+}
+
+void CDirectVobSubFilter::SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle)
+{
+ CAutoLock cAutolock(&m_csQueueLock);
+
+ if(pSubStream)
+ {
+ CAutoLock cAutolock(&m_csSubLock);
+
+ CLSID clsid;
+ pSubStream->GetClassID(&clsid);
+
+ if(clsid == __uuidof(CVobSubFile))
+ {
+ CVobSubSettings* pVSS = (CVobSubFile*)(ISubStream*)pSubStream;
+
+ if(fApplyDefStyle)
+ {
+ pVSS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc, 1, 1);
+ pVSS->m_fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
+ }
+ }
+ else if(clsid == __uuidof(CVobSubStream))
+ {
+ CVobSubSettings* pVSS = (CVobSubStream*)(ISubStream*)pSubStream;
+
+ if(fApplyDefStyle)
+ {
+ pVSS->SetAlignment(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc, 1, 1);
+ pVSS->m_fOnlyShowForcedSubs = m_fOnlyShowForcedVobSubs;
+ }
+ }
+ else if(clsid == __uuidof(CRenderedTextSubtitle))
+ {
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)pSubStream;
+
+ if(fApplyDefStyle || pRTS->m_fUsingAutoGeneratedDefaultStyle)
+ {
+ STSStyle s = m_defStyle;
+
+ if(m_fOverridePlacement)
+ {
+ s.scrAlignment = 2;
+ int w = pRTS->m_dstScreenSize.cx;
+ int h = pRTS->m_dstScreenSize.cy;
+ int mw = w - s.marginRect.left - s.marginRect.right;
+ s.marginRect.bottom = h - MulDiv(h, m_PlacementYperc, 100);
+ s.marginRect.left = MulDiv(w, m_PlacementXperc, 100) - mw/2;
+ s.marginRect.right = w - (s.marginRect.left + mw);
+ }
+
+ pRTS->SetDefaultStyle(s);
+ }
+
+ pRTS->Deinit();
+ }
+ }
+
+ if(!fApplyDefStyle)
+ {
+ int i = 0;
+
+ POSITION pos = m_pSubStreams.GetHeadPosition();
+ while(pos)
+ {
+ CComPtr<ISubStream> pSubStream2 = m_pSubStreams.GetNext(pos);
+
+ if(pSubStream == pSubStream2)
+ {
+ m_iSelectedLanguage = i + pSubStream2->GetStream();
+ break;
+ }
+
+ i += pSubStream2->GetStreamCount();
+ }
+ }
+
+ m_nSubtitleId = (DWORD_PTR)pSubStream;
+
+ if(m_pSubPicQueue)
+ m_pSubPicQueue->SetSubPicProvider(CComQIPtr<ISubPicProvider>(pSubStream));
+}
+
+void CDirectVobSubFilter::InvalidateSubtitle(REFERENCE_TIME rtInvalidate, DWORD_PTR nSubtitleId)
+{
+ CAutoLock cAutolock(&m_csQueueLock);
+
+ if(m_pSubPicQueue)
+ {
+ if(nSubtitleId == -1 || nSubtitleId == m_nSubtitleId)
+ m_pSubPicQueue->Invalidate(rtInvalidate);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+
+void CDirectVobSubFilter::AddSubStream(ISubStream* pSubStream)
+{
+ CAutoLock cAutoLock(&m_csQueueLock);
+
+ POSITION pos = m_pSubStreams.Find(pSubStream);
+ if(!pos) m_pSubStreams.AddTail(pSubStream);
+
+ int len = m_pTextInput.GetSize();
+ for(int i = 0; i < m_pTextInput.GetSize(); i++)
+ if(m_pTextInput[i]->IsConnected()) len--;
+
+ if(len == 0)
+ {
+ HRESULT hr = S_OK;
+ m_pTextInput.Add(new CTextInputPin(this, m_pLock, &m_csSubLock, &hr));
+ }
+}
+
+void CDirectVobSubFilter::RemoveSubStream(ISubStream* pSubStream)
+{
+ CAutoLock cAutoLock(&m_csQueueLock);
+
+ POSITION pos = m_pSubStreams.Find(pSubStream);
+ if(pos) m_pSubStreams.RemoveAt(pos);
+}
+
+void CDirectVobSubFilter::Post_EC_OLE_EVENT(CString str, DWORD_PTR nSubtitleId)
+{
+ if(nSubtitleId != -1 && nSubtitleId != m_nSubtitleId)
+ return;
+
+ CComQIPtr<IMediaEventSink> pMES = m_pGraph;
+ if(!pMES) return;
+
+ CComBSTR bstr1("Text"), bstr2(" ");
+
+ str.Trim();
+ if(!str.IsEmpty()) bstr2 = CStringA(str);
+
+ pMES->Notify(EC_OLE_EVENT, (LONG_PTR)bstr1.Detach(), (LONG_PTR)bstr2.Detach());
+}
+
+////////////////////////////////////////////////////////////////
+
+void CDirectVobSubFilter::SetupFRD(CStringArray& paths, CArray<HANDLE>& handles)
+{
+ CAutoLock cAutolock(&m_csSubLock);
+
+ for(int i = 2; i < handles.GetSize(); i++)
+ {
+ FindCloseChangeNotification(handles[i]);
+ }
+
+ paths.RemoveAll();
+ handles.RemoveAll();
+
+ handles.Add(m_frd.EndThreadEvent);
+ handles.Add(m_frd.RefreshEvent);
+
+ m_frd.mtime.SetSize(m_frd.files.GetSize());
+
+ POSITION pos = m_frd.files.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ CString fn = m_frd.files.GetNext(pos);
+
+ CFileStatus status;
+ if(CFileGetStatus(fn, status))
+ m_frd.mtime[i] = status.m_mtime;
+
+ fn.Replace('\\', '/');
+ fn = fn.Left(fn.ReverseFind('/')+1);
+
+ bool fFound = false;
+
+ for(int j = 0; !fFound && j < paths.GetSize(); j++)
+ {
+ if(paths[j] == fn) fFound = true;
+ }
+
+ if(!fFound)
+ {
+ paths.Add(fn);
+
+ HANDLE h = FindFirstChangeNotification(fn, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
+ if(h != INVALID_HANDLE_VALUE) handles.Add(h);
+ }
+ }
+}
+
+DWORD CDirectVobSubFilter::ThreadProc()
+{
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_LOWEST/*THREAD_PRIORITY_BELOW_NORMAL*/);
+
+ CStringArray paths;
+ CArray<HANDLE> handles;
+
+ SetupFRD(paths, handles);
+
+ while(1)
+ {
+ DWORD idx = WaitForMultipleObjects(handles.GetSize(), handles.GetData(), FALSE, INFINITE);
+
+ if(idx == (WAIT_OBJECT_0 + 0)) // m_frd.hEndThreadEvent
+ {
+ break;
+ }
+ if(idx == (WAIT_OBJECT_0 + 1)) // m_frd.hRefreshEvent
+ {
+ SetupFRD(paths, handles);
+ }
+ else if(idx >= (WAIT_OBJECT_0 + 2) && idx < (WAIT_OBJECT_0 + handles.GetSize()))
+ {
+ bool fLocked = true;
+ IsSubtitleReloaderLocked(&fLocked);
+ if(fLocked) continue;
+
+ if(FindNextChangeNotification(handles[idx - WAIT_OBJECT_0]) == FALSE)
+ break;
+
+ int j = 0;
+
+ POSITION pos = m_frd.files.GetHeadPosition();
+ for(int i = 0; pos && j == 0; i++)
+ {
+ CString fn = m_frd.files.GetNext(pos);
+
+ CFileStatus status;
+ if(CFileGetStatus(fn, status) && m_frd.mtime[i] != status.m_mtime)
+ {
+ for(j = 0; j < 10; j++)
+ {
+ if(FILE* f = _tfopen(fn, _T("rb+")))
+ {
+ fclose(f);
+ j = 0;
+ break;
+ }
+ else
+ {
+ Sleep(100);
+ j++;
+ }
+ }
+ }
+ }
+
+ if(j > 0)
+ {
+ SetupFRD(paths, handles);
+ }
+ else
+ {
+ Sleep(500);
+
+ POSITION pos = m_frd.files.GetHeadPosition();
+ for(int i = 0; pos; i++)
+ {
+ CFileStatus status;
+ if(CFileGetStatus(m_frd.files.GetNext(pos), status)
+ && m_frd.mtime[i] != status.m_mtime)
+ {
+ Open();
+ SetupFRD(paths, handles);
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ for(int i = 2; i < handles.GetSize(); i++)
+ {
+ FindCloseChangeNotification(handles[i]);
+ }
+
+ return 0;
+}
diff --git a/src/filters/transform/vsfilter/DirectVobSubFilter.h b/src/filters/transform/vsfilter/DirectVobSubFilter.h
new file mode 100644
index 000000000..b4011ab88
--- /dev/null
+++ b/src/filters/transform/vsfilter/DirectVobSubFilter.h
@@ -0,0 +1,195 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlsync.h>
+#include "DirectVobSub.h"
+#include "..\BaseVideoFilter\BaseVideoFilter.h"
+#include "..\..\..\subtitles\VobSubFile.h"
+#include "..\..\..\subtitles\RTS.h"
+
+typedef struct
+{
+ HWND hSystrayWnd;
+ IFilterGraph* graph;
+ IDirectVobSub* dvs;
+ bool fRunOnce, fShowIcon;
+} SystrayIconData;
+
+/* This is for graphedit */
+
+[uuid("93A22E7A-5091-45ef-BA61-6DA26156A5D0")]
+class CDirectVobSubFilter
+ : public CBaseVideoFilter
+ , public CDirectVobSub
+ , public ISpecifyPropertyPages
+ , public IAMStreamSelect
+ , public CAMThread
+{
+ friend class CTextInputPin;
+
+ CCritSec m_csQueueLock;
+ CComPtr<ISubPicQueue> m_pSubPicQueue;
+ void InitSubPicQueue();
+ SubPicDesc m_spd;
+
+ bool AdjustFrameSize(CSize& s);
+
+protected:
+ void GetOutputSize(int& w, int& h, int& arx, int& ary);
+ HRESULT Transform(IMediaSample* pIn);
+
+public:
+ CDirectVobSubFilter(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid = __uuidof(CDirectVobSubFilter));
+ virtual ~CDirectVobSubFilter();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // CBaseFilter
+
+ CBasePin* GetPin(int n);
+ int GetPinCount();
+
+ STDMETHODIMP JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName);
+ STDMETHODIMP QueryFilterInfo(FILTER_INFO* pInfo);
+
+ // CTransformFilter
+ HRESULT SetMediaType(PIN_DIRECTION dir, const CMediaType* pMediaType),
+ CheckConnect(PIN_DIRECTION dir, IPin* pPin),
+ CompleteConnect(PIN_DIRECTION dir, IPin* pReceivePin),
+ BreakConnect(PIN_DIRECTION dir),
+ StartStreaming(),
+ StopStreaming(),
+ NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+ CArray<CTextInputPin*> m_pTextInput;
+
+ // IDirectVobSub
+ STDMETHODIMP put_FileName(WCHAR* fn);
+ STDMETHODIMP get_LanguageCount(int* nLangs);
+ STDMETHODIMP get_LanguageName(int iLanguage, WCHAR** ppName);
+ STDMETHODIMP put_SelectedLanguage(int iSelected);
+ STDMETHODIMP put_HideSubtitles(bool fHideSubtitles);
+ STDMETHODIMP put_PreBuffering(bool fDoPreBuffering);
+ STDMETHODIMP put_Placement(bool fOverridePlacement, int xperc, int yperc);
+ STDMETHODIMP put_VobSubSettings(bool fBuffer, bool fOnlyShowForcedSubs, bool fPolygonize);
+ STDMETHODIMP put_TextSettings(void* lf, int lflen, COLORREF color, bool fShadow, bool fOutline, bool fAdvancedRenderer);
+ STDMETHODIMP put_SubtitleTiming(int delay, int speedmul, int speeddiv);
+ STDMETHODIMP get_MediaFPS(bool* fEnabled, double* fps);
+ STDMETHODIMP put_MediaFPS(bool fEnabled, double fps);
+ STDMETHODIMP get_ZoomRect(NORMALIZEDRECT* rect);
+ STDMETHODIMP put_ZoomRect(NORMALIZEDRECT* rect);
+ STDMETHODIMP HasConfigDialog(int iSelected);
+ STDMETHODIMP ShowConfigDialog(int iSelected, HWND hWndParent);
+
+ // IDirectVobSub2
+ STDMETHODIMP put_TextSettings(STSStyle* pDefStyle);
+
+ // ISpecifyPropertyPages
+ STDMETHODIMP GetPages(CAUUID* pPages);
+
+ // IAMStreamSelect
+ STDMETHODIMP Count(DWORD* pcStreams);
+ STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
+ STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
+
+ // CPersistStream
+ STDMETHODIMP GetClassID(CLSID* pClsid);
+
+protected:
+ HRESULT ChangeMediaType(int iPosition);
+
+ HDC m_hdc;
+ HBITMAP m_hbm;
+ HFONT m_hfont;
+ void PrintMessages(BYTE* pOut);
+
+/* ResX2 */
+ CAutoVectorPtr<BYTE> m_pTempPicBuff;
+ HRESULT Copy(BYTE* pSub, BYTE* pIn, CSize sub, CSize in, int bpp, const GUID& subtype, DWORD black);
+
+ // segment start time, absolute time
+ CRefTime m_tPrev;
+ REFERENCE_TIME CalcCurrentTime();
+
+ double m_fps;
+
+ // 3.x- versions of microsoft's mpeg4 codec output flipped image
+ bool m_fMSMpeg4Fix;
+
+ // DivxPlus puts our picture upside-down on the tv
+ bool m_fDivxPlusFix;
+
+ // don't set the "hide subtitles" stream until we are finished with loading
+ bool m_fLoading;
+
+ bool Open();
+
+ int FindPreferedLanguage(bool fHideToo = true);
+ void UpdatePreferedLanguages(CString lang);
+
+ CCritSec m_csSubLock;
+ CInterfaceList<ISubStream> m_pSubStreams;
+ DWORD_PTR m_nSubtitleId;
+ void UpdateSubtitle(bool fApplyDefStyle = true);
+ void SetSubtitle(ISubStream* pSubStream, bool fApplyDefStyle = true);
+ void InvalidateSubtitle(REFERENCE_TIME rtInvalidate = -1, DWORD_PTR nSubtitleId = -1);
+
+ // the text input pin is using these
+ void AddSubStream(ISubStream* pSubStream);
+ void RemoveSubStream(ISubStream* pSubStream);
+ void Post_EC_OLE_EVENT(CString str, DWORD_PTR nSubtitleId = -1);
+
+private:
+ class CFileReloaderData
+ {
+ public:
+ ATL::CEvent EndThreadEvent, RefreshEvent;
+ CAtlList<CString> files;
+ CArray<CTime> mtime;
+ } m_frd;
+
+ void SetupFRD(CStringArray& paths, CArray<HANDLE>& handles);
+ DWORD ThreadProc();
+
+private:
+ HANDLE m_hSystrayThread;
+ SystrayIconData m_tbid;
+};
+
+/* The "auto-loading" version */
+
+[uuid("9852A670-F845-491b-9BE6-EBD841B8A613")]
+class CDirectVobSubFilter2 : public CDirectVobSubFilter
+{
+ bool ShouldWeAutoload(IFilterGraph* pGraph);
+ void GetRidOfInternalScriptRenderer();
+
+public:
+ CDirectVobSubFilter2(LPUNKNOWN punk, HRESULT* phr, const GUID& clsid = __uuidof(CDirectVobSubFilter2));
+
+ HRESULT CheckConnect(PIN_DIRECTION dir, IPin* pPin);
+ STDMETHODIMP JoinFilterGraph(IFilterGraph* pGraph, LPCWSTR pName);
+ HRESULT CheckInputType(const CMediaType* mtIn);
+};
+
diff --git a/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp b/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp
new file mode 100644
index 000000000..cbea3aee2
--- /dev/null
+++ b/src/filters/transform/vsfilter/DirectVobSubPropPage.cpp
@@ -0,0 +1,1176 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <commdlg.h>
+#include <afxdlgs.h>
+#include "DirectVobSubFilter.h"
+#include "DirectVobSubPropPage.h"
+#include "VSFilter.h"
+#include "StyleEditorDialog.h"
+
+#include "..\..\..\DSUtil\DSUtil.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+
+BOOL WINAPI MyGetDialogSize(int iResourceID, DLGPROC pDlgProc, LPARAM lParam, SIZE* pResult)
+{
+ HWND hwnd = CreateDialogParam(AfxGetResourceHandle(),
+ MAKEINTRESOURCE(iResourceID),
+ GetDesktopWindow(),
+ pDlgProc,
+ lParam);
+
+ if(hwnd == NULL) return FALSE;
+
+ RECT rc;
+ GetWindowRect(hwnd, &rc);
+ pResult->cx = rc.right - rc.left;
+ pResult->cy = rc.bottom - rc.top;
+
+ DestroyWindow(hwnd);
+
+ return TRUE;
+}
+
+STDMETHODIMP CDVSBasePPage::GetPageInfo(LPPROPPAGEINFO pPageInfo)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CString str;
+ if(!str.LoadString(m_TitleId)) return E_FAIL;
+
+ WCHAR wszTitle[STR_MAX_LENGTH];
+#ifdef UNICODE
+ wcscpy(wszTitle, str);
+#else
+ mbstowcs(wszTitle, str, str.GetLength()+1);
+#endif
+
+ CheckPointer(pPageInfo, E_POINTER);
+
+ // Allocate dynamic memory for the property page title
+
+ LPOLESTR pszTitle;
+ HRESULT hr = AMGetWideString(wszTitle, &pszTitle);
+ if(FAILED(hr)) {NOTE("No caption memory"); return hr;}
+
+ pPageInfo->cb = sizeof(PROPPAGEINFO);
+ pPageInfo->pszTitle = pszTitle;
+ pPageInfo->pszDocString = NULL;
+ pPageInfo->pszHelpFile = NULL;
+ pPageInfo->dwHelpContext = 0;
+ // Set defaults in case GetDialogSize fails
+ pPageInfo->size.cx = 340;
+ pPageInfo->size.cy = 150;
+
+ MyGetDialogSize(m_DialogId, DialogProc, 0L, &pPageInfo->size);
+
+ return NOERROR;
+}
+
+STDMETHODIMP CDVSBasePPage::Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CheckPointer(pRect,E_POINTER);
+/*
+ // Return failure if SetObject has not been called.
+ if (m_bObjectSet == FALSE) {
+ return E_UNEXPECTED;
+ }
+*/
+ if(m_hwnd) return E_UNEXPECTED;
+
+ m_hwnd = CreateDialogParam(AfxGetResourceHandle(), MAKEINTRESOURCE(m_DialogId), hwndParent, DialogProc, (LPARAM)this);
+ if(m_hwnd == NULL) return E_OUTOFMEMORY;
+
+ OnActivate();
+ Move(pRect);
+ return Show(SW_SHOWNORMAL);
+}
+
+/* CDVSBasePPage */
+
+CDVSBasePPage::CDVSBasePPage(TCHAR* pName, LPUNKNOWN lpunk, int DialogId, int TitleId) :
+ CBasePropertyPage(pName, lpunk, DialogId, TitleId),
+ m_bIsInitialized(FALSE),
+ m_fAttached(false),
+ m_fDisableInstantUpdate(false)
+{
+}
+
+BOOL CDVSBasePPage::OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ if(m_bIsInitialized)
+ {
+ m_bDirty = TRUE;
+ if(m_pPageSite) m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);
+
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ case CBN_SELCHANGE:
+ case EN_CHANGE:
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(!m_fDisableInstantUpdate
+ && !(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_INSTANTUPDATE)
+ && !!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 0))
+ OnApplyChanges();
+ }
+ }
+ }
+ }
+ break;
+
+ case WM_NCDESTROY:
+ DetachControls();
+ break;
+ }
+
+ return OnMessage(uMsg, wParam, lParam)
+ ? 0
+ : CBasePropertyPage::OnReceiveMessage(hwnd,uMsg,wParam,lParam);
+}
+
+HRESULT CDVSBasePPage::OnConnect(IUnknown* pUnknown)
+{
+ if(!(m_pDirectVobSub = pUnknown)) return E_NOINTERFACE;
+
+ m_pDirectVobSub->LockSubtitleReloader(true); // *
+
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ UpdateObjectData(false);
+
+ m_bIsInitialized = FALSE;
+
+ return NOERROR;
+}
+
+HRESULT CDVSBasePPage::OnDisconnect()
+{
+ if(m_pDirectVobSub == NULL) return E_UNEXPECTED;
+
+ m_pDirectVobSub->LockSubtitleReloader(false); // *
+
+ // for some reason OnDisconnect() will be called twice, that's why we
+ // need to release m_pDirectVobSub manually on the first call to avoid
+ // a second "m_pDirectVobSub->LockSubtitleReloader(false);"
+
+ m_pDirectVobSub.Release();
+
+ return NOERROR;
+}
+
+HRESULT CDVSBasePPage::OnActivate()
+{
+ ASSERT(m_pDirectVobSub);
+
+ AttachControls();
+
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ UpdateControlData(false);
+
+ m_bIsInitialized = TRUE;
+
+ return NOERROR;
+}
+
+HRESULT CDVSBasePPage::OnDeactivate()
+{
+ ASSERT(m_pDirectVobSub);
+
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ UpdateControlData(true);
+
+ m_bIsInitialized = FALSE;
+
+ return NOERROR;
+}
+
+HRESULT CDVSBasePPage::OnApplyChanges()
+{
+ ASSERT(m_pDirectVobSub);
+
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(m_bIsInitialized)
+ {
+ OnDeactivate();
+ UpdateObjectData(true);
+ m_pDirectVobSub->UpdateRegistry(); // *
+ OnActivate();
+ }
+
+ return NOERROR;
+}
+
+void CDVSBasePPage::AttachControls()
+{
+ DetachControls();
+
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ POSITION pos = m_controls.GetStartPosition();
+ while(pos)
+ {
+ UINT id;
+ CWnd* pControl;
+ m_controls.GetNextAssoc(pos, id, pControl);
+ if(pControl)
+ {
+ BOOL fRet = pControl->Attach(GetDlgItem(m_Dlg, id));
+ ASSERT(fRet);
+ }
+ }
+
+ m_fAttached = true;
+}
+
+void CDVSBasePPage::DetachControls()
+{
+ if(!m_fAttached) return;
+
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ POSITION pos = m_controls.GetStartPosition();
+ while(pos)
+ {
+ UINT id;
+ CWnd* pControl;
+ m_controls.GetNextAssoc(pos, id, pControl);
+ if(pControl) pControl->Detach();
+ }
+
+ m_fAttached = false;
+}
+
+void CDVSBasePPage::BindControl(UINT id, CWnd& control)
+{
+ m_controls[id] = &control;
+}
+
+/* CDVSMainPPage */
+
+CDVSMainPPage::CDVSMainPPage(LPUNKNOWN pUnk, HRESULT* phr) :
+ CDVSBasePPage(NAME("DirectVobSub Property Page (main)"), pUnk, IDD_DVSMAINPAGE, IDD_DVSMAINPAGE),
+ m_nLangs(0),
+ m_ppLangs(NULL)
+{
+ BindControl(IDC_FILENAME, m_fnedit);
+ BindControl(IDC_LANGCOMBO, m_langs);
+ BindControl(IDC_OVERRIDEPLACEMENT, m_oplacement);
+ BindControl(IDC_SPIN1, m_subposx);
+ BindControl(IDC_SPIN2, m_subposy);
+ BindControl(IDC_FONT, m_font);
+ BindControl(IDC_ONLYSHOWFORCEDSUBS, m_forcedsubs);
+}
+
+CDVSMainPPage::~CDVSMainPPage()
+{
+ FreeLangs();
+}
+
+void CDVSMainPPage::FreeLangs()
+{
+ if(m_nLangs > 0 && m_ppLangs)
+ {
+ for(int i = 0; i < m_nLangs; i++) CoTaskMemFree(m_ppLangs[i]);
+ CoTaskMemFree(m_ppLangs);
+ m_nLangs = 0;
+ m_ppLangs = NULL;
+ }
+}
+
+void CDVSMainPPage::AllocLangs(int nLangs)
+{
+ m_ppLangs = (WCHAR**)CoTaskMemRealloc(m_ppLangs, sizeof(WCHAR*)*nLangs);
+ m_nLangs = nLangs;
+}
+
+bool CDVSMainPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ {
+ if(LOWORD(wParam) == IDC_OPEN)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CFileDialog fd(TRUE, NULL, NULL,
+ OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST,
+ _T(".idx .smi .sub .srt .psb .ssa .ass .usf|*.idx;*.smi;*.sub;*.srt;*.psb;*.ssa;*.ass;*.usf|"),
+ CDialog::FromHandle(m_Dlg), 0);
+
+ if(fd.DoModal() == IDOK)
+ {
+ m_fnedit.SetWindowText(fd.GetPathName());
+ }
+
+ return(true);
+ }
+ else if(LOWORD(wParam) == IDC_FONT)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CStyleEditorDialog dlg(_T("Default"), &m_defStyle, CWnd::FromHandle(m_hwnd));
+
+ if(dlg.DoModal() == IDOK)
+ {
+ m_defStyle = dlg.m_stss;
+ CString str = m_defStyle.fontName;
+ if(str.GetLength() > 18) str = str.Left(16).TrimRight() + _T("...");
+ m_font.SetWindowText(str);
+ }
+
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
+}
+
+void CDVSMainPPage::UpdateObjectData(bool fSave)
+{
+ if(fSave)
+ {
+ if(m_pDirectVobSub->put_FileName(m_fn) == S_OK)
+ {
+ int nLangs;
+ m_pDirectVobSub->get_LanguageCount(&nLangs);
+ AllocLangs(nLangs);
+ for(int i = 0; i < m_nLangs; i++) m_pDirectVobSub->get_LanguageName(i, &m_ppLangs[i]);
+ m_pDirectVobSub->get_SelectedLanguage(&m_iSelectedLanguage);
+ }
+
+ m_pDirectVobSub->put_SelectedLanguage(m_iSelectedLanguage);
+ m_pDirectVobSub->put_Placement(m_fOverridePlacement, m_PlacementXperc, m_PlacementYperc);
+ m_pDirectVobSub->put_VobSubSettings(true, m_fOnlyShowForcedVobSubs, false);
+ m_pDirectVobSub->put_TextSettings(&m_defStyle);
+ }
+ else
+ {
+ m_pDirectVobSub->get_FileName(m_fn);
+ int nLangs;
+ m_pDirectVobSub->get_LanguageCount(&nLangs);
+ AllocLangs(nLangs);
+ for(int i = 0; i < m_nLangs; i++) m_pDirectVobSub->get_LanguageName(i, &m_ppLangs[i]);
+ m_pDirectVobSub->get_SelectedLanguage(&m_iSelectedLanguage);
+ m_pDirectVobSub->get_Placement(&m_fOverridePlacement, &m_PlacementXperc, &m_PlacementYperc);
+ m_pDirectVobSub->get_VobSubSettings(NULL, &m_fOnlyShowForcedVobSubs, NULL);
+ m_pDirectVobSub->get_TextSettings(&m_defStyle);
+ }
+}
+
+void CDVSMainPPage::UpdateControlData(bool fSave)
+{
+ if(fSave)
+ {
+ CString fn;
+ m_fnedit.GetWindowText(fn);
+#ifdef UNICODE
+ wcscpy(m_fn, fn);
+#else
+ mbstowcs(m_fn, fn, fn.GetLength()+1);
+#endif
+ m_iSelectedLanguage = m_langs.GetCurSel();
+ m_fOverridePlacement = !!m_oplacement.GetCheck();
+ m_PlacementXperc = m_subposx.GetPos();
+ m_PlacementYperc = m_subposy.GetPos();
+ m_fOnlyShowForcedVobSubs = !!m_forcedsubs.GetCheck();
+ }
+ else
+ {
+ m_fnedit.SetWindowText(CString(m_fn));
+ m_oplacement.SetCheck(m_fOverridePlacement);
+ m_subposx.SetRange(-20, 120);
+ m_subposx.SetPos(m_PlacementXperc);
+ m_subposx.EnableWindow(m_fOverridePlacement);
+ m_subposy.SetRange(-20, 120);
+ m_subposy.SetPos(m_PlacementYperc);
+ m_subposy.EnableWindow(m_fOverridePlacement);
+ m_font.SetWindowText(m_defStyle.fontName);
+ m_forcedsubs.SetCheck(m_fOnlyShowForcedVobSubs);
+ m_langs.ResetContent();
+ m_langs.EnableWindow(m_nLangs > 0);
+ for(int i = 0; i < m_nLangs; i++) m_langs.AddString(CString(m_ppLangs[i]));
+ m_langs.SetCurSel(m_iSelectedLanguage);
+ }
+}
+
+/* CDVSGeneralPPage */
+
+CDVSGeneralPPage::CDVSGeneralPPage(LPUNKNOWN pUnk, HRESULT* phr) :
+ CDVSBasePPage(NAME("DirectVobSub Property Page (global settings)"), pUnk, IDD_DVSGENERALPAGE, IDD_DVSGENERALPAGE)
+{
+ BindControl(IDC_VEREXTCOMBO, m_verext);
+ BindControl(IDC_MOD32FIX, m_mod32fix);
+ BindControl(IDC_RESX2COMBO, m_resx2);
+ BindControl(IDC_SPIN3, m_resx2w);
+ BindControl(IDC_SPIN4, m_resx2h);
+ BindControl(IDC_LOADCOMBO, m_load);
+ BindControl(IDC_EXTLOAD, m_extload);
+ BindControl(IDC_WEBLOAD, m_webload);
+ BindControl(IDC_EMBLOAD, m_embload);
+}
+
+bool CDVSGeneralPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch(HIWORD(wParam))
+ {
+ case CBN_SELCHANGE:
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(LOWORD(wParam) == IDC_RESX2COMBO)
+ {
+ m_resx2w.EnableWindow(m_resx2.GetCurSel() == 2);
+ m_resx2h.EnableWindow(m_resx2.GetCurSel() == 2);
+ return(true);
+ }
+ else if(LOWORD(wParam) == IDC_LOADCOMBO)
+ {
+ m_extload.EnableWindow(m_load.GetCurSel() == 1);
+ m_webload.EnableWindow(m_load.GetCurSel() == 1);
+ m_embload.EnableWindow(m_load.GetCurSel() == 1);
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
+}
+
+void CDVSGeneralPPage::UpdateObjectData(bool fSave)
+{
+ if(fSave)
+ {
+ m_pDirectVobSub->put_ExtendPicture(m_HorExt, m_VerExt, m_ResX2, m_ResX2minw, m_ResX2minh);
+ m_pDirectVobSub->put_LoadSettings(m_LoadLevel, m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad);
+ }
+ else
+ {
+ m_pDirectVobSub->get_ExtendPicture(&m_HorExt, &m_VerExt, &m_ResX2, &m_ResX2minw, &m_ResX2minh);
+ m_pDirectVobSub->get_LoadSettings(&m_LoadLevel, &m_fExternalLoad, &m_fWebLoad, &m_fEmbeddedLoad);
+ }
+}
+
+void CDVSGeneralPPage::UpdateControlData(bool fSave)
+{
+ if(fSave)
+ {
+ if(m_verext.GetCurSel() >= 0) m_VerExt = m_verext.GetItemData(m_verext.GetCurSel());
+ m_HorExt = !!m_mod32fix.GetCheck();
+ if(m_resx2.GetCurSel() >= 0) m_ResX2 = m_resx2.GetItemData(m_resx2.GetCurSel());
+ m_ResX2minw = m_resx2w.GetPos();
+ m_ResX2minh = m_resx2h.GetPos();
+ if(m_load.GetCurSel() >= 0) m_LoadLevel = m_load.GetItemData(m_load.GetCurSel());
+ m_fExternalLoad = !!m_extload.GetCheck();
+ m_fWebLoad = !!m_webload.GetCheck();
+ m_fEmbeddedLoad = !!m_embload.GetCheck();
+ }
+ else
+ {
+ m_verext.ResetContent();
+ m_verext.AddString(ResStr(IDS_ORGHEIGHT)); m_verext.SetItemData(0, 0);
+ m_verext.AddString(ResStr(IDS_EXTTO169)); m_verext.SetItemData(1, 1);
+ m_verext.AddString(ResStr(IDS_EXTTO43)); m_verext.SetItemData(2, 2);
+ m_verext.AddString(ResStr(IDS_EXTTO480)); m_verext.SetItemData(3, 3);
+ m_verext.AddString(ResStr(IDS_EXTTO576)); m_verext.SetItemData(4, 4);
+ m_verext.AddString(ResStr(IDS_CROPTO169)); m_verext.SetItemData(5, 0x81);
+ m_verext.AddString(ResStr(IDS_CROPTO43)); m_verext.SetItemData(6, 0x82);
+ m_verext.SetCurSel((m_VerExt&0x7f) + ((m_VerExt&0x80)?4:0));
+ m_mod32fix.SetCheck(m_HorExt&1);
+ m_resx2.ResetContent();
+ m_resx2.AddString(ResStr(IDS_ORGRES)); m_resx2.SetItemData(0, 0);
+ m_resx2.AddString(ResStr(IDS_DBLRES)); m_resx2.SetItemData(1, 1);
+ m_resx2.AddString(ResStr(IDS_DBLRESIF)); m_resx2.SetItemData(2, 2);
+ m_resx2.SetCurSel(m_ResX2);
+ m_resx2w.SetRange(0, 2048);
+ m_resx2w.SetPos(m_ResX2minw);
+ m_resx2w.EnableWindow(m_ResX2 == 2);
+ m_resx2h.SetRange(0, 2048);
+ m_resx2h.SetPos(m_ResX2minh);
+ m_resx2h.EnableWindow(m_ResX2 == 2);
+ m_load.ResetContent();
+ m_load.AddString(ResStr(IDS_DONOTLOAD)); m_load.SetItemData(0, 2);
+ m_load.AddString(ResStr(IDS_LOADWHENNEEDED)); m_load.SetItemData(1, 0);
+ m_load.AddString(ResStr(IDS_ALWAYSLOAD)); m_load.SetItemData(2, 1);
+ m_load.SetCurSel(!m_LoadLevel?1:m_LoadLevel==1?2:0);
+ m_extload.SetCheck(m_fExternalLoad);
+ m_webload.SetCheck(m_fWebLoad);
+ m_embload.SetCheck(m_fEmbeddedLoad);
+ m_extload.EnableWindow(m_load.GetCurSel() == 1);
+ m_webload.EnableWindow(m_load.GetCurSel() == 1);
+ m_embload.EnableWindow(m_load.GetCurSel() == 1);
+ }
+}
+
+/* CDVSMiscPPage */
+
+CDVSMiscPPage::CDVSMiscPPage(LPUNKNOWN pUnk, HRESULT* phr) :
+ CDVSBasePPage(NAME("DirectVobSub Property Page (misc settings)"), pUnk, IDD_DVSMISCPAGE, IDD_DVSMISCPAGE)
+{
+ BindControl(IDC_FLIP, m_flippic);
+ BindControl(IDC_FLIPSUB, m_flipsub);
+ BindControl(IDC_HIDE, m_hidesub);
+ BindControl(IDC_SHOWOSDSTATS, m_showosd);
+ BindControl(IDC_PREBUFFERING, m_prebuff);
+ BindControl(IDC_AUTORELOAD, m_autoreload);
+ BindControl(IDC_SAVEFULLPATH, m_savefullpath);
+ BindControl(IDC_INSTANTUPDATE, m_instupd);
+}
+
+bool CDVSMiscPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ {
+ if(LOWORD(wParam) == IDC_INSTANTUPDATE)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), !!m_instupd.GetCheck());
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
+}
+
+void CDVSMiscPPage::UpdateObjectData(bool fSave)
+{
+ if(fSave)
+ {
+ m_pDirectVobSub->put_Flip(m_fFlipPicture, m_fFlipSubtitles);
+ m_pDirectVobSub->put_HideSubtitles(m_fHideSubtitles);
+ m_pDirectVobSub->put_OSD(m_fOSD);
+ m_pDirectVobSub->put_PreBuffering(m_fDoPreBuffering);
+ m_pDirectVobSub->put_SubtitleReloader(m_fReloaderDisabled);
+ m_pDirectVobSub->put_SaveFullPath(m_fSaveFullPath);
+ }
+ else
+ {
+ m_pDirectVobSub->get_Flip(&m_fFlipPicture, &m_fFlipSubtitles);
+ m_pDirectVobSub->get_HideSubtitles(&m_fHideSubtitles);
+ m_pDirectVobSub->get_OSD(&m_fOSD);
+ m_pDirectVobSub->get_PreBuffering(&m_fDoPreBuffering);
+ m_pDirectVobSub->get_SubtitleReloader(&m_fReloaderDisabled);
+ m_pDirectVobSub->get_SaveFullPath(&m_fSaveFullPath);
+ }
+}
+
+void CDVSMiscPPage::UpdateControlData(bool fSave)
+{
+ if(fSave)
+ {
+ m_fFlipPicture = !!m_flippic.GetCheck();
+ m_fFlipSubtitles = !!m_flipsub.GetCheck();
+ m_fHideSubtitles = !!m_hidesub.GetCheck();
+ m_fSaveFullPath = !!m_savefullpath.GetCheck();
+ m_fDoPreBuffering = !!m_prebuff.GetCheck();
+ m_fOSD = !!m_showosd.GetCheck();
+ m_fReloaderDisabled = !m_autoreload.GetCheck();
+ }
+ else
+ {
+ m_flippic.SetCheck(m_fFlipPicture);
+ m_flipsub.SetCheck(m_fFlipSubtitles);
+ m_hidesub.SetCheck(m_fHideSubtitles);
+ m_savefullpath.SetCheck(m_fSaveFullPath);
+ m_prebuff.SetCheck(m_fDoPreBuffering);
+ m_showosd.SetCheck(m_fOSD);
+ m_autoreload.SetCheck(!m_fReloaderDisabled);
+ m_instupd.SetCheck(!!theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_INSTANTUPDATE), 0));
+ }
+}
+
+/* CDVSTimingPPage */
+
+CDVSTimingPPage::CDVSTimingPPage(LPUNKNOWN pUnk, HRESULT* phr) :
+ CDVSBasePPage(NAME("DirectVobSub Timing Property Page"), pUnk, IDD_DVSTIMINGPAGE, IDD_DVSTIMINGPAGE)
+{
+ BindControl(IDC_MODFPS, m_modfps);
+ BindControl(IDC_FPS, m_fps);
+ BindControl(IDC_SPIN5, m_subdelay);
+ BindControl(IDC_SPIN6, m_subspeedmul);
+ BindControl(IDC_SPIN9, m_subspeeddiv);
+}
+
+bool CDVSTimingPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ {
+ if(LOWORD(wParam) == IDC_MODFPS)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ m_fps.EnableWindow(!!m_modfps.GetCheck());
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
+}
+
+void CDVSTimingPPage::UpdateObjectData(bool fSave)
+{
+ if(fSave)
+ {
+ m_pDirectVobSub->put_SubtitleTiming(m_SubtitleDelay, m_SubtitleSpeedMul, m_SubtitleSpeedDiv);
+ m_pDirectVobSub->put_MediaFPS(m_fMediaFPSEnabled, m_MediaFPS);
+ }
+ else
+ {
+ m_pDirectVobSub->get_SubtitleTiming(&m_SubtitleDelay, &m_SubtitleSpeedMul, &m_SubtitleSpeedDiv);
+ m_pDirectVobSub->get_MediaFPS(&m_fMediaFPSEnabled, &m_MediaFPS);
+ }
+}
+
+void CDVSTimingPPage::UpdateControlData(bool fSave)
+{
+ if(fSave)
+ {
+ m_fMediaFPSEnabled = !!m_modfps.GetCheck();
+ CString fpsstr;
+ m_fps.GetWindowText(fpsstr);
+ float fps;
+ if(_stscanf(fpsstr, _T("%f"), &fps) == 1) m_MediaFPS = fps;
+#if _MFC_VER >= 0x0700
+ m_SubtitleDelay = m_subdelay.GetPos32();
+ m_SubtitleSpeedMul = m_subspeedmul.GetPos32();
+ m_SubtitleSpeedDiv = m_subspeeddiv.GetPos32();
+#else
+ m_SubtitleDelay = SendMessage(GetDlgItem(m_Dlg, IDC_SPIN5), UDM_GETPOS32, 0, 0);
+ m_SubtitleSpeedMul = SendMessage(GetDlgItem(m_Dlg, IDC_SPIN6), UDM_GETPOS32, 0, 0);
+ m_SubtitleSpeedDiv = SendMessage(GetDlgItem(m_Dlg, IDC_SPIN9), UDM_GETPOS32, 0, 0);
+#endif
+ }
+ else
+ {
+ m_modfps.SetCheck(m_fMediaFPSEnabled);
+ CString fpsstr;
+ fpsstr.Format(_T("%.4f"), m_MediaFPS);
+ m_fps.SetWindowText(fpsstr);
+ m_fps.EnableWindow(m_fMediaFPSEnabled);
+ m_subdelay.SetRange32(-180*60*1000, 180*60*1000);
+ m_subspeedmul.SetRange32(0, 1000000);
+ m_subspeeddiv.SetRange32(1, 1000000);
+#if _MFC_VER >= 0x0700
+ m_subdelay.SetPos32(m_SubtitleDelay);
+ m_subspeedmul.SetPos32(m_SubtitleSpeedMul);
+ m_subspeeddiv.SetPos32(m_SubtitleSpeedDiv);
+#else
+ SendMessage(GetDlgItem(m_Dlg, IDC_SPIN5), UDM_SETPOS32, 0, (LPARAM)m_SubtitleDelay);
+ SendMessage(GetDlgItem(m_Dlg, IDC_SPIN6), UDM_SETPOS32, 0, (LPARAM)m_SubtitleSpeedMul);
+ SendMessage(GetDlgItem(m_Dlg, IDC_SPIN9), UDM_SETPOS32, 0, (LPARAM)m_SubtitleSpeedDiv);
+#endif
+ }
+}
+
+/* CDVSAboutPPage */
+
+CDVSAboutPPage::CDVSAboutPPage(LPUNKNOWN lpunk, HRESULT* phr) :
+ CDVSBasePPage(NAME("About Property Page"), lpunk, IDD_DVSABOUTPAGE, IDD_DVSABOUTPAGE)
+{
+
+}
+
+bool CDVSAboutPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ {
+ if(LOWORD(wParam) == IDC_HOMEPAGEBTN)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_HOMEPAGE), NULL, NULL, SW_SHOWNORMAL);
+ return(true);
+ }
+ else if(LOWORD(wParam) == IDC_BUGREPORTBTN)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ ShellExecute(m_Dlg, _T("open"), ResStr(IDS_URL_EMAIL), NULL, NULL, SW_SHOWNORMAL);
+ return(true);
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
+}
+
+/* CDVSZoomPPage */
+
+CDVSZoomPPage::CDVSZoomPPage(LPUNKNOWN pUnk, HRESULT* phr) :
+ CDVSBasePPage(NAME("DirectVobSub Zoom Property Page"), pUnk, IDD_DVSZOOMPAGE, IDD_DVSZOOMPAGE)
+{
+ BindControl(IDC_SPIN1, m_posx);
+ BindControl(IDC_SPIN2, m_posy);
+ BindControl(IDC_SPIN7, m_scalex);
+ BindControl(IDC_SPIN8, m_scaley);
+}
+
+bool CDVSZoomPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch(HIWORD(wParam))
+ {
+ case EN_CHANGE:
+ {
+ if(LOWORD(wParam) == IDC_EDIT1 || LOWORD(wParam) == IDC_EDIT2
+ || LOWORD(wParam) == IDC_EDIT7 || LOWORD(wParam) == IDC_EDIT8)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+ UpdateControlData(true);
+ UpdateObjectData(true);
+ return(true);
+ }
+ }
+
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
+}
+
+void CDVSZoomPPage::UpdateControlData(bool fSave)
+{
+ if(fSave)
+ {
+ m_rect.left = 1.0f * (short)m_posx.GetPos() / 100;
+ m_rect.top = 1.0f * (short)m_posy.GetPos() / 100;
+ m_rect.right = m_rect.left + 1.0f * (short)m_scalex.GetPos() / 100;
+ m_rect.bottom = m_rect.top + 1.0f * (short)m_scaley.GetPos() / 100;
+ }
+ else
+ {
+ m_posx.SetRange(-100, 100);
+ m_posx.SetPos((int)(m_rect.left*100));
+ m_posy.SetRange(-100, 100);
+ m_posy.SetPos((int)(m_rect.top*100));
+ m_scalex.SetRange(-300, 300);
+ m_scalex.SetPos((int)((m_rect.right-m_rect.left)*100));
+ m_scaley.SetRange(-300, 300);
+ m_scaley.SetPos((int)((m_rect.bottom-m_rect.top)*100));
+ }
+}
+
+void CDVSZoomPPage::UpdateObjectData(bool fSave)
+{
+ if(fSave)
+ {
+ m_pDirectVobSub->put_ZoomRect(&m_rect);
+ }
+ else
+ {
+ m_pDirectVobSub->get_ZoomRect(&m_rect);
+ }
+}
+
+// TODO: Make CDVSColorPPage and CDVSPathsPPage use an interface on DirectVobSub instead of the registry to communicate
+
+/* CDVSColorPPage */
+
+CDVSColorPPage::CDVSColorPPage(LPUNKNOWN pUnk, HRESULT* phr) :
+ CDVSBasePPage(NAME("DirectVobSub Color Property Page"), pUnk, IDD_DVSCOLORPAGE, IDD_DVSCOLORPAGE)
+{
+ BindControl(IDC_PREFLIST, m_preflist);
+ BindControl(IDC_DYNCHGLIST, m_dynchglist);
+ BindControl(IDC_FORCERGBCHK, m_forcergb);
+
+ m_fDisableInstantUpdate = true;
+}
+
+bool CDVSColorPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch(HIWORD(wParam))
+ {
+ case LBN_DBLCLK:
+ if((HWND)lParam == m_dynchglist.m_hWnd)
+ {
+ int old = -1;
+ m_pDirectVobSub->get_ColorFormat(&old);
+ if(FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel())))
+ m_dynchglist.SetCurSel(old);
+
+ return(true);
+ }
+ break;
+
+ case BN_CLICKED:
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDC_COLORCHANGE:
+ {
+ int old = -1;
+ m_pDirectVobSub->get_ColorFormat(&old);
+ if(FAILED(m_pDirectVobSub->put_ColorFormat(m_dynchglist.GetCurSel())))
+ m_dynchglist.SetCurSel(old);
+
+ return(true);
+ }
+ case IDC_COLORUP:
+ {
+ int sel = m_preflist.GetCurSel();
+ if(sel > 0)
+ {
+ CString str;
+ m_preflist.GetText(sel, str);
+ int iPos = (int)m_preflist.GetItemData(sel);
+ m_preflist.DeleteString(sel);
+ sel--;
+ m_preflist.InsertString(sel, str);
+ m_preflist.SetItemData(sel, iPos);
+ m_preflist.SetCurSel(sel);
+ }
+
+ return(true);
+ }
+ case IDC_COLORDOWN:
+ {
+ int sel = m_preflist.GetCurSel();
+ if(sel >= 0 && sel < m_preflist.GetCount()-1)
+ {
+ CString str;
+ m_preflist.GetText(sel, str);
+ int iPos = (int)m_preflist.GetItemData(sel);
+ m_preflist.DeleteString(sel);
+ sel++;
+ m_preflist.InsertString(sel, str);
+ m_preflist.SetItemData(sel, iPos);
+ m_preflist.SetCurSel(sel);
+ }
+
+ return(true);
+ }
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
+}
+
+void CDVSColorPPage::UpdateObjectData(bool fSave)
+{
+ if(fSave)
+ {
+ }
+ else
+ {
+ }
+}
+
+void CDVSColorPPage::UpdateControlData(bool fSave)
+{
+ if(fSave)
+ {
+ if(m_preflist.GetCount() == VIHSIZE)
+ {
+ BYTE* pData = new BYTE[VIHSIZE];
+
+ for(int i = 0; i < m_preflist.GetCount(); i++)
+ pData[i] = (BYTE)m_preflist.GetItemData(i);
+
+ theApp.WriteProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), pData, VIHSIZE);
+
+ delete [] pData;
+ }
+ else ASSERT(0);
+
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FORCERGB), !!m_forcergb.GetCheck());
+ }
+ else
+ {
+ m_preflist.ResetContent();
+ m_dynchglist.ResetContent();
+
+ BYTE* pData = NULL;
+ UINT nSize;
+
+ if(!theApp.GetProfileBinary(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_COLORFORMATS), &pData, &nSize)
+ || !pData || nSize != VIHSIZE)
+ {
+ if(pData) delete [] pData, pData = NULL;
+
+ nSize = VIHSIZE;
+ pData = new BYTE[VIHSIZE];
+ for(int i = 0; i < VIHSIZE; i++) pData[i] = i;
+ }
+
+ if(pData)
+ {
+ for(int i = 0; i < (int)nSize; i++)
+ {
+ m_dynchglist.AddString(VIH2String(pData[i]));
+ m_dynchglist.SetItemData(i, pData[i]);
+ m_preflist.AddString(VIH2String(pData[i]));
+ m_preflist.SetItemData(i, pData[i]);
+ }
+
+ int iPosition = -1;
+ m_pDirectVobSub->get_ColorFormat(&iPosition);
+ m_dynchglist.SetCurSel(iPosition);
+
+ delete [] pData;
+ }
+
+ m_forcergb.SetCheck(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_FORCERGB), 0)?BST_CHECKED:BST_UNCHECKED);
+ }
+}
+
+/* CDVSPathsPPage */
+
+CDVSPathsPPage::CDVSPathsPPage(LPUNKNOWN pUnk, HRESULT* phr) :
+ CDVSBasePPage(NAME("DirectVobSub Paths Property Page"), pUnk, IDD_DVSPATHSPAGE, IDD_DVSPATHSPAGE)
+{
+ BindControl(IDC_PATHLIST, m_pathlist);
+ BindControl(IDC_PATHEDIT, m_path);
+ BindControl(IDC_BROWSE, m_browse);
+ BindControl(IDC_REMOVE, m_remove);
+ BindControl(IDC_ADD, m_add);
+
+ m_fDisableInstantUpdate = true;
+}
+
+bool CDVSPathsPPage::OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch(HIWORD(wParam))
+ {
+ case LBN_SELCHANGE:
+ if((HWND)lParam == m_pathlist.m_hWnd)
+ {
+ int i = m_pathlist.GetCurSel();
+ m_remove.EnableWindow(i >= 3 ? TRUE : FALSE);
+ if(i >= 0)
+ {
+ CString path;
+ m_pathlist.GetText(i, path);
+ m_path.SetWindowText(path);
+ }
+ return(true);
+ }
+ break;
+
+ case LBN_SELCANCEL:
+ if((HWND)lParam == m_pathlist.m_hWnd)
+ {
+ m_remove.EnableWindow(FALSE);
+ return(true);
+ }
+ break;
+
+ case BN_CLICKED:
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDC_BROWSE:
+ {
+ TCHAR pathbuff[MAX_PATH];
+
+ BROWSEINFO bi;
+ bi.hwndOwner = m_Dlg;
+ bi.pidlRoot = NULL;
+ bi.pszDisplayName = pathbuff;
+ bi.lpszTitle = _T("");
+ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_EDITBOX | BIF_VALIDATE | BIF_USENEWUI;
+ bi.lpfn = NULL;
+ bi.lParam = 0;
+ bi.iImage = 0;
+
+ LPITEMIDLIST iil;
+ if(iil = SHBrowseForFolder(&bi))
+ {
+ SHGetPathFromIDList(iil, pathbuff);
+ m_path.SetWindowText(pathbuff);
+ }
+
+ return(true);
+ }
+ break;
+
+ case IDC_REMOVE:
+ {
+ int i = m_pathlist.GetCurSel();
+ if(i >= 0)
+ {
+ m_pathlist.DeleteString(i);
+ i = min(i, m_pathlist.GetCount()-1);
+ if(i >= 0 && m_pathlist.GetCount() > 0)
+ {
+ m_pathlist.SetCurSel(i);
+ m_remove.EnableWindow(i >= 3 ? TRUE : FALSE);
+ }
+ }
+
+ return(true);
+ }
+ break;
+
+ case IDC_ADD:
+ {
+ CString path;
+ m_path.GetWindowText(path);
+ if(!path.IsEmpty() && m_pathlist.FindString(-1, path) < 0)
+ m_pathlist.AddString(path);
+
+ return(true);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return(false);
+}
+
+void CDVSPathsPPage::UpdateObjectData(bool fSave)
+{
+ if(fSave)
+ {
+ CString chk(_T("123456789")), path, tmp;
+ int i = 0;
+ do
+ {
+ tmp.Format(ResStr(IDS_RP_PATH), i++);
+ path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, chk);
+ if(path != chk) theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, _T(""));
+ }
+ while(path != chk);
+
+ for(i = 0; i < m_paths.GetSize(); i++)
+ {
+ tmp.Format(ResStr(IDS_RP_PATH), i);
+ theApp.WriteProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, m_paths[i]);
+ }
+ }
+ else
+ {
+ CString chk(_T("123456789")), path, tmp;
+ int i = 0;
+ do
+ {
+ if(!path.IsEmpty()) m_paths.Add(path);
+ tmp.Format(ResStr(IDS_RP_PATH), i++);
+ path = theApp.GetProfileString(ResStr(IDS_R_DEFTEXTPATHES), tmp, chk);
+ }
+ while(path != chk);
+ }
+}
+
+void CDVSPathsPPage::UpdateControlData(bool fSave)
+{
+ if(fSave)
+ {
+ m_paths.RemoveAll();
+ for(int i = 0; i < m_pathlist.GetCount(); i++)
+ {
+ CString path;
+ m_pathlist.GetText(i, path);
+ m_paths.Add(path);
+ }
+ }
+ else
+ {
+ m_pathlist.ResetContent();
+ for(int i = 0; i < m_paths.GetSize(); i++)
+ m_pathlist.AddString(m_paths[i]);
+
+ m_remove.EnableWindow(FALSE);
+ m_add.EnableWindow(TRUE);
+ }
+}
diff --git a/src/filters/transform/vsfilter/DirectVobSubPropPage.h b/src/filters/transform/vsfilter/DirectVobSubPropPage.h
new file mode 100644
index 000000000..f2da279a4
--- /dev/null
+++ b/src/filters/transform/vsfilter/DirectVobSubPropPage.h
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <afxcmn.h>
+#include "IDirectVobSub.h"
+
+class CDVSBasePPage : public CBasePropertyPage
+{
+public:
+ // we have to override these to use external, resource-only dlls
+ STDMETHODIMP GetPageInfo(LPPROPPAGEINFO pPageInfo);
+ STDMETHODIMP Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal);
+
+protected:
+ CComQIPtr<IDirectVobSub2> m_pDirectVobSub;
+
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) {return(false);}
+ virtual void UpdateObjectData(bool fSave) {}
+ virtual void UpdateControlData(bool fSave) {}
+
+protected:
+ CDVSBasePPage(TCHAR* pName, LPUNKNOWN lpunk, int DialogId, int TitleId);
+
+ bool m_fDisableInstantUpdate;
+
+private:
+ BOOL m_bIsInitialized;
+
+ HRESULT OnConnect(IUnknown* pUnknown), OnDisconnect(), OnActivate(), OnDeactivate(), OnApplyChanges();
+ BOOL OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+private:
+ bool m_fAttached;
+ void AttachControls(), DetachControls();
+
+ CMap<UINT, UINT&, CWnd*, CWnd*> m_controls;
+
+protected:
+ void BindControl(UINT id, CWnd& control);
+};
+
+[uuid("60765CF5-01C2-4ee7-A44B-C791CF25FEA0")]
+class CDVSMainPPage : public CDVSBasePPage
+{
+ void FreeLangs(), AllocLangs(int nLangs);
+
+ WCHAR m_fn[MAX_PATH];
+ int m_iSelectedLanguage, m_nLangs;
+ WCHAR** m_ppLangs;
+ bool m_fOverridePlacement;
+ int m_PlacementXperc, m_PlacementYperc;
+ STSStyle m_defStyle;
+ bool m_fOnlyShowForcedVobSubs;
+
+ CEdit m_fnedit;
+ CComboBox m_langs;
+ CButton m_oplacement;
+ CSpinButtonCtrl m_subposx, m_subposy;
+ CButton m_font, m_forcedsubs;
+
+protected:
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
+
+public:
+ CDVSMainPPage(LPUNKNOWN lpunk, HRESULT* phr);
+ virtual ~CDVSMainPPage();
+};
+
+[uuid("0180E49C-13BF-46db-9AFD-9F52292E1C22")]
+class CDVSGeneralPPage : public CDVSBasePPage
+{
+ int m_HorExt, m_VerExt, m_ResX2, m_ResX2minw, m_ResX2minh;
+ int m_LoadLevel;
+ bool m_fExternalLoad, m_fWebLoad, m_fEmbeddedLoad;
+
+ CComboBox m_verext;
+ CButton m_mod32fix;
+ CComboBox m_resx2;
+ CSpinButtonCtrl m_resx2w, m_resx2h;
+ CComboBox m_load;
+ CButton m_extload, m_webload, m_embload;
+
+protected:
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
+
+public:
+ CDVSGeneralPPage(LPUNKNOWN lpunk, HRESULT* phr);
+};
+
+[uuid("A8B25C0E-0894-4531-B668-AB1599FAF7F6")]
+class CDVSMiscPPage : public CDVSBasePPage
+{
+ bool m_fFlipPicture, m_fFlipSubtitles, m_fHideSubtitles, m_fOSD, m_fDoPreBuffering, m_fReloaderDisabled, m_fSaveFullPath;
+
+ CButton m_flippic, m_flipsub, m_hidesub, m_showosd, m_prebuff, m_autoreload, m_savefullpath, m_instupd;
+
+protected:
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
+
+public:
+ CDVSMiscPPage(LPUNKNOWN lpunk, HRESULT* phr);
+};
+
+[uuid("ACE4747B-35BD-4e97-9DD7-1D4245B0695C")]
+class CDVSTimingPPage : public CDVSBasePPage
+{
+ int m_SubtitleSpeedMul, m_SubtitleSpeedDiv, m_SubtitleDelay;
+ bool m_fMediaFPSEnabled;
+ double m_MediaFPS;
+
+ CButton m_modfps;
+ CEdit m_fps;
+ CSpinButtonCtrl m_subdelay, m_subspeedmul, m_subspeeddiv;
+
+protected:
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
+
+public:
+ CDVSTimingPPage(LPUNKNOWN lpunk, HRESULT* phr);
+};
+
+[uuid("F544E0F5-CA3C-47ea-A64D-35FCF1602396")]
+class CDVSAboutPPage : public CDVSBasePPage
+{
+protected:
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+public:
+ CDVSAboutPPage(LPUNKNOWN lpunk, HRESULT* phr);
+};
+
+[uuid("525F116F-04AD-40a2-AE2F-A0C4E1AFEF98")]
+class CDVSZoomPPage : public CDVSBasePPage
+{
+ NORMALIZEDRECT m_rect;
+
+ CSpinButtonCtrl m_posx, m_posy, m_scalex, m_scaley;
+
+protected:
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
+
+public:
+ CDVSZoomPPage(LPUNKNOWN lpunk, HRESULT* phr);
+};
+
+[uuid("C2D6D98F-09CA-4524-AF64-1049B5665C9C")]
+class CDVSColorPPage : public CDVSBasePPage
+{
+ CListBox m_preflist, m_dynchglist;
+ CButton m_forcergb;
+
+protected:
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
+
+public:
+ CDVSColorPPage(LPUNKNOWN lpunk, HRESULT* phr);
+};
+
+[uuid("CE77C59C-CFD2-429f-868C-8B04D23F94CA")]
+class CDVSPathsPPage : public CDVSBasePPage
+{
+ CStringArray m_paths;
+
+ CListBox m_pathlist;
+ CEdit m_path;
+ CButton m_browse, m_remove, m_add;
+
+protected:
+ virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
+ virtual void UpdateControlData(bool fSave);
+ virtual void UpdateObjectData(bool fSave);
+
+public:
+ CDVSPathsPPage(LPUNKNOWN lpunk, HRESULT* phr);
+};
diff --git a/src/filters/transform/vsfilter/IDirectVobSub.h b/src/filters/transform/vsfilter/IDirectVobSub.h
new file mode 100644
index 000000000..9bd26603d
--- /dev/null
+++ b/src/filters/transform/vsfilter/IDirectVobSub.h
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\..\subtitles\STS.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ [uuid("EBE1FB08-3957-47ca-AF13-5827E5442E56")]
+ interface IDirectVobSub : public IUnknown
+ {
+ STDMETHOD(get_FileName) (THIS_
+ WCHAR* fn // fn should point to a buffer allocated to at least the length of MAX_PATH (=260)
+ ) PURE;
+
+ STDMETHOD(put_FileName) (THIS_
+ WCHAR* fn
+ ) PURE;
+
+ STDMETHOD(get_LanguageCount) (THIS_
+ int* nLangs
+ ) PURE;
+
+ STDMETHOD(get_LanguageName) (THIS_
+ int iLanguage,
+ WCHAR** ppName // the returned *ppName is allocated with CoTaskMemAlloc
+ ) PURE;
+
+ STDMETHOD(get_SelectedLanguage) (THIS_
+ int* iSelected
+ ) PURE;
+
+ STDMETHOD(put_SelectedLanguage) (THIS_
+ int iSelected
+ ) PURE;
+
+ STDMETHOD(get_HideSubtitles) (THIS_
+ bool* fHideSubtitles
+ ) PURE;
+
+ STDMETHOD(put_HideSubtitles) (THIS_
+ bool fHideSubtitles
+ ) PURE;
+
+ STDMETHOD(get_PreBuffering) (THIS_
+ bool* fDoPreBuffering
+ ) PURE;
+
+ STDMETHOD(put_PreBuffering) (THIS_
+ bool fDoPreBuffering
+ ) PURE;
+
+ STDMETHOD(get_Placement) (THIS_
+ bool* fOverridePlacement,
+ int* xperc,
+ int* yperc
+ ) PURE;
+
+ STDMETHOD(put_Placement) (THIS_
+ bool fOverridePlacement,
+ int xperc,
+ int yperc
+ ) PURE;
+
+ STDMETHOD(get_VobSubSettings) (THIS_
+ bool* fBuffer,
+ bool* fOnlyShowForcedSubs,
+ bool* fPolygonize
+ ) PURE;
+
+ STDMETHOD(put_VobSubSettings) (THIS_
+ bool fBuffer,
+ bool fOnlyShowForcedSubs,
+ bool fPolygonize
+ ) PURE;
+
+ STDMETHOD(get_TextSettings) (THIS_
+ void* lf,
+ int lflen, // depending on lflen, lf must point to LOGFONTA or LOGFONTW
+ COLORREF* color,
+ bool* fShadow,
+ bool* fOutline,
+ bool* fAdvancedRenderer
+ ) PURE;
+
+ STDMETHOD(put_TextSettings) (THIS_
+ void* lf,
+ int lflen,
+ COLORREF color,
+ bool fShadow,
+ bool fOutline,
+ bool fAdvancedRenderer
+ ) PURE;
+
+ STDMETHOD(get_Flip) (THIS_
+ bool* fPicture,
+ bool* fSubtitles
+ ) PURE;
+
+ STDMETHOD(put_Flip) (THIS_
+ bool fPicture,
+ bool fSubtitles
+ ) PURE;
+
+ STDMETHOD(get_OSD) (THIS_
+ bool* fOSD
+ ) PURE;
+
+ STDMETHOD(put_OSD) (THIS_
+ bool fOSD
+ ) PURE;
+
+ STDMETHOD(get_SaveFullPath) (THIS_
+ bool* fSaveFullPath
+ ) PURE;
+
+ STDMETHOD(put_SaveFullPath) (THIS_
+ bool fSaveFullPath
+ ) PURE;
+
+ STDMETHOD(get_SubtitleTiming) (THIS_
+ int* delay,
+ int* speedmul,
+ int* speeddiv
+ ) PURE;
+
+ STDMETHOD(put_SubtitleTiming) (THIS_
+ int delay,
+ int speedmul,
+ int speeddiv
+ ) PURE;
+
+ STDMETHOD(get_MediaFPS) (THIS_
+ bool* fEnabled,
+ double* fps
+ ) PURE;
+
+ STDMETHOD(put_MediaFPS) (THIS_
+ bool fEnabled,
+ double fps
+ ) PURE;
+
+ // no longer supported
+
+ STDMETHOD(get_ColorFormat) (THIS_
+ int* iPosition
+ ) PURE;
+
+ STDMETHOD(put_ColorFormat) (THIS_
+ int iPosition
+ ) PURE;
+
+ //
+
+ STDMETHOD(get_ZoomRect) (THIS_
+ NORMALIZEDRECT* rect
+ ) PURE;
+
+ STDMETHOD(put_ZoomRect) (THIS_
+ NORMALIZEDRECT* rect
+ ) PURE;
+
+ //
+
+ STDMETHOD(UpdateRegistry) (THIS_
+ ) PURE;
+
+ //
+
+ STDMETHOD(HasConfigDialog) (THIS_
+ int iSelected
+ ) PURE;
+
+ STDMETHOD(ShowConfigDialog) (THIS_ // if available, this will popup a child dialog allowing the user to edit the style options
+ int iSelected,
+ HWND hWndParent
+ ) PURE;
+
+ //
+
+ STDMETHOD(IsSubtitleReloaderLocked) (THIS_
+ bool* fLocked
+ ) PURE;
+
+ STDMETHOD(LockSubtitleReloader) (THIS_
+ bool fLock
+ ) PURE;
+
+ STDMETHOD(get_SubtitleReloader) (THIS_
+ bool* fDisabled
+ ) PURE;
+
+ STDMETHOD(put_SubtitleReloader) (THIS_
+ bool fDisable
+ ) PURE;
+
+ //
+
+ STDMETHOD(get_ExtendPicture) (THIS_
+ int* horizontal, // 0 - disabled, 1 - mod32 extension (width = (width+31)&~31)
+ int* vertical, // 0 - disabled, 1 - 16:9, 2 - 4:3, 0x80 - crop (use crop together with 16:9 or 4:3, eg 0x81 will crop to 16:9 if the picture was taller)
+ int* resx2, // 0 - disabled, 1 - enabled, 2 - depends on the original resolution
+ int* resx2minw, // resolution doubler will be used if width*height <= resx2minw*resx2minh (resx2minw*resx2minh equals to 384*288 by default)
+ int* resx2minh
+ ) PURE;
+
+ STDMETHOD(put_ExtendPicture) (THIS_
+ int horizontal,
+ int vertical,
+ int resx2,
+ int resx2minw,
+ int resx2minh
+ ) PURE;
+
+ STDMETHOD(get_LoadSettings) (THIS_
+ int* level, // 0 - when needed, 1 - always, 2 - disabled
+ bool* fExternalLoad,
+ bool* fWebLoad,
+ bool* fEmbeddedLoad
+ ) PURE;
+
+ STDMETHOD(put_LoadSettings) (THIS_
+ int level,
+ bool fExternalLoad,
+ bool fWebLoad,
+ bool fEmbeddedLoad
+ ) PURE;
+ };
+
+ [uuid("FE6EC6A0-21CA-4970-9EF0-B296F7F38AF0")]
+ interface ISubClock : public IUnknown
+ {
+ STDMETHOD(SetTime)(REFERENCE_TIME rt) PURE;
+ STDMETHOD_(REFERENCE_TIME, GetTime)() PURE;
+ };
+
+ [uuid("0665B760-FBC1-46C3-A35F-E471527C96A4")]
+ interface ISubClock2 : public ISubClock
+ {
+ STDMETHOD(SetAvgTimePerFrame)(REFERENCE_TIME rt) PURE;
+ STDMETHOD(GetAvgTimePerFrame)(REFERENCE_TIME* prt) PURE; // return S_OK only if *prt was set and is valid
+ };
+
+ [uuid("AB52FC9C-2415-4dca-BC1C-8DCC2EAE8150")]
+ interface IDirectVobSub2 : public IDirectVobSub
+ {
+ STDMETHOD(AdviseSubClock) (THIS_
+ ISubClock* pSubClock
+ ) PURE;
+
+ STDMETHOD_(bool, get_Forced) (THIS_
+ ) PURE;
+
+ STDMETHOD(put_Forced) (THIS_
+ bool fForced
+ ) PURE;
+
+ STDMETHOD(get_TextSettings) (THIS_
+ STSStyle* pDefStyle
+ ) PURE;
+
+ STDMETHOD(put_TextSettings) (THIS_
+ STSStyle* pDefStyle
+ ) PURE;
+ };
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/filters/transform/vsfilter/StdAfx.cpp b/src/filters/transform/vsfilter/StdAfx.cpp
new file mode 100644
index 000000000..502682104
--- /dev/null
+++ b/src/filters/transform/vsfilter/StdAfx.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// stdafx.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
diff --git a/src/filters/transform/vsfilter/StdAfx.h b/src/filters/transform/vsfilter/StdAfx.h
new file mode 100644
index 000000000..d25f8f79a
--- /dev/null
+++ b/src/filters/transform/vsfilter/StdAfx.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#if !defined(AFX_STDAFX_H__E8AD1C3F_323D_4812_A1DE_AA2419CE2AF3__INCLUDED_)
+#define AFX_STDAFX_H__E8AD1C3F_323D_4812_A1DE_AA2419CE2AF3__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define STRICT
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif
+#define _ATL_APARTMENT_THREADED
+
+#include <afxwin.h>
+#include <afxdisp.h>
+
+#include <atlbase.h>
+//You may derive a class from CComModule and use it if you want to override
+//something, but do not change the name of _Module
+extern CComModule _Module;
+#include <atlcom.h>
+
+#define AFX_CLASS AFX_CLASS_IMPORT
+
+#include <streams.h>
+#include <dvdmedia.h>
+#include "..\..\..\DSUtil\DSUtil.h"
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__E8AD1C3F_323D_4812_A1DE_AA2419CE2AF3__INCLUDED)
diff --git a/src/filters/transform/vsfilter/StyleEditorDialog.cpp b/src/filters/transform/vsfilter/StyleEditorDialog.cpp
new file mode 100644
index 000000000..8712f2918
--- /dev/null
+++ b/src/filters/transform/vsfilter/StyleEditorDialog.cpp
@@ -0,0 +1,282 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// StyleEditorDialog.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <math.h>
+#include <afxdlgs.h>
+#include "StyleEditorDialog.h"
+
+IMPLEMENT_DYNAMIC(CColorStatic, CStatic)
+
+BEGIN_MESSAGE_MAP(CColorStatic, CStatic)
+END_MESSAGE_MAP()
+
+
+// CStyleEditorDialog dialog
+
+IMPLEMENT_DYNAMIC(CStyleEditorDialog, CDialog)
+CStyleEditorDialog::CStyleEditorDialog(CString title, STSStyle* pstss, CWnd* pParent /*=NULL*/)
+ : CDialog(CStyleEditorDialog::IDD, pParent)
+ , m_title(title)
+ , m_stss(*pstss)
+ , m_pParent(pParent)
+ , m_iCharset(0)
+ , m_spacing(0)
+ , m_angle(0)
+ , m_scalex(0)
+ , m_scaley(0)
+ , m_borderstyle(0)
+ , m_borderwidth(0)
+ , m_shadowdepth(0)
+ , m_screenalignment(0)
+ , m_margin(0,0,0,0)
+ , m_linkalphasliders(FALSE)
+{
+}
+
+CStyleEditorDialog::~CStyleEditorDialog()
+{
+}
+
+void CStyleEditorDialog::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_BUTTON1, m_font);
+ DDX_CBIndex(pDX, IDC_COMBO1, m_iCharset);
+ DDX_Control(pDX, IDC_COMBO1, m_charset);
+ DDX_Text(pDX, IDC_EDIT3, m_spacing);
+ DDX_Control(pDX, IDC_SPIN3, m_spacingspin);
+ DDX_Text(pDX, IDC_EDIT11, m_angle);
+ DDX_Control(pDX, IDC_SPIN10, m_anglespin);
+ DDX_Text(pDX, IDC_EDIT5, m_scalex);
+ DDX_Control(pDX, IDC_SPIN4, m_scalexspin);
+ DDX_Text(pDX, IDC_EDIT6, m_scaley);
+ DDX_Control(pDX, IDC_SPIN5, m_scaleyspin);
+ DDX_Radio(pDX, IDC_RADIO1, m_borderstyle);
+ DDX_Text(pDX, IDC_EDIT1, m_borderwidth);
+ DDX_Control(pDX, IDC_SPIN1, m_borderwidthspin);
+ DDX_Text(pDX, IDC_EDIT2, m_shadowdepth);
+ DDX_Control(pDX, IDC_SPIN2, m_shadowdepthspin);
+ DDX_Radio(pDX, IDC_RADIO3, m_screenalignment);
+ DDX_Text(pDX, IDC_EDIT7, m_margin.left);
+ DDX_Control(pDX, IDC_SPIN6, m_marginleftspin);
+ DDX_Text(pDX, IDC_EDIT8, m_margin.right);
+ DDX_Control(pDX, IDC_SPIN7, m_marginrightspin);
+ DDX_Text(pDX, IDC_EDIT9, m_margin.top);
+ DDX_Control(pDX, IDC_SPIN8, m_margintopspin);
+ DDX_Text(pDX, IDC_EDIT10, m_margin.bottom);
+ DDX_Control(pDX, IDC_SPIN9, m_marginbottomspin);
+ DDX_Control(pDX, IDC_COLORPRI, m_color[0]);
+ DDX_Control(pDX, IDC_COLORSEC, m_color[1]);
+ DDX_Control(pDX, IDC_COLOROUTL, m_color[2]);
+ DDX_Control(pDX, IDC_COLORSHAD, m_color[3]);
+ DDX_Slider(pDX, IDC_SLIDER2, m_alpha[0]);
+ DDX_Slider(pDX, IDC_SLIDER3, m_alpha[1]);
+ DDX_Slider(pDX, IDC_SLIDER5, m_alpha[2]);
+ DDX_Slider(pDX, IDC_SLIDER6, m_alpha[3]);
+ DDX_Control(pDX, IDC_SLIDER2, m_alphasliders[0]);
+ DDX_Control(pDX, IDC_SLIDER3, m_alphasliders[1]);
+ DDX_Control(pDX, IDC_SLIDER5, m_alphasliders[2]);
+ DDX_Control(pDX, IDC_SLIDER6, m_alphasliders[3]);
+ DDX_Check(pDX, IDC_CHECK1, m_linkalphasliders);
+}
+
+void CStyleEditorDialog::UpdateControlData(bool fSave)
+{
+ if(fSave)
+ {
+ UpdateData();
+
+ if(m_iCharset >= 0) m_stss.charSet = m_charset.GetItemData(m_iCharset);
+ m_stss.fontSpacing = m_spacing;
+ m_stss.fontAngleZ = m_angle;
+ m_stss.fontScaleX = m_scalex;
+ m_stss.fontScaleY = m_scaley;
+
+ m_stss.borderStyle = m_borderstyle;
+ m_stss.outlineWidth = m_borderwidth;
+ m_stss.shadowDepth = m_shadowdepth;
+
+ m_stss.scrAlignment = m_screenalignment+1;
+ m_stss.marginRect = m_margin;
+
+ for(int i = 0; i < 4; i++) m_stss.alpha[i] = 255-m_alpha[i];
+ }
+ else
+ {
+ m_font.SetWindowText(m_stss.fontName);
+ m_iCharset = -1;
+ for(int i = 0; i < CharSetLen; i++)
+ {
+ CString str;
+ str.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
+ m_charset.AddString(str);
+ m_charset.SetItemData(i, CharSetList[i]);
+ if(m_stss.charSet == CharSetList[i]) m_iCharset = i;
+ }
+ // TODO: allow floats in these edit boxes
+ m_spacing = m_stss.fontSpacing;
+ m_spacingspin.SetRange32(-10000, 10000);
+ while(m_stss.fontAngleZ < 0) m_stss.fontAngleZ += 360;
+ m_angle = fmod(m_stss.fontAngleZ, 360);
+ m_anglespin.SetRange32(0, 359);
+ m_scalex = m_stss.fontScaleX;
+ m_scalexspin.SetRange32(-10000, 10000);
+ m_scaley = m_stss.fontScaleY;
+ m_scaleyspin.SetRange32(-10000, 10000);
+
+ m_borderstyle = m_stss.borderStyle;
+ m_borderwidth = m_stss.outlineWidth;
+ m_borderwidthspin.SetRange32(0, 10000);
+ m_shadowdepth = m_stss.shadowDepth;
+ m_shadowdepthspin.SetRange32(0, 10000);
+
+ m_screenalignment = m_stss.scrAlignment-1;
+ m_margin = m_stss.marginRect;
+ m_marginleftspin.SetRange32(-10000, 10000);
+ m_marginrightspin.SetRange32(-10000, 10000);
+ m_margintopspin.SetRange32(-10000, 10000);
+ m_marginbottomspin.SetRange32(-10000, 10000);
+
+ for(int i = 0; i < 4; i++)
+ {
+ m_color[i].SetColorPtr(&m_stss.colors[i]);
+ m_alpha[i] = 255-m_stss.alpha[i];
+ m_alphasliders[i].SetRange(0, 255);
+ }
+
+ m_linkalphasliders = FALSE;
+
+ UpdateData(FALSE);
+ }
+}
+
+void CStyleEditorDialog::AskColor(int i)
+{
+ CColorDialog dlg(m_stss.colors[i]);
+ dlg.m_cc.Flags |= CC_FULLOPEN;
+ if(dlg.DoModal() == IDOK)
+ {
+ m_stss.colors[i] = dlg.m_cc.rgbResult;
+ m_color[i].Invalidate();
+ }
+}
+
+BEGIN_MESSAGE_MAP(CStyleEditorDialog, CDialog)
+ ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
+ ON_STN_CLICKED(IDC_COLORPRI, OnStnClickedColorpri)
+ ON_STN_CLICKED(IDC_COLORSEC, OnStnClickedColorsec)
+ ON_STN_CLICKED(IDC_COLOROUTL, OnStnClickedColoroutl)
+ ON_STN_CLICKED(IDC_COLORSHAD, OnStnClickedColorshad)
+ ON_BN_CLICKED(IDC_CHECK1, OnBnClickedCheck1)
+ ON_WM_HSCROLL()
+END_MESSAGE_MAP()
+
+
+// CStyleEditorDialog message handlers
+
+BOOL CStyleEditorDialog::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ SetWindowText(_T("Style Editor - \"") + m_title + _T("\""));
+
+ UpdateControlData(false);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CStyleEditorDialog::OnOK()
+{
+ UpdateControlData(true);
+
+ CDialog::OnOK();
+}
+
+void CStyleEditorDialog::OnBnClickedButton1()
+{
+ LOGFONT lf;
+ lf <<= m_stss;
+
+ CFontDialog dlg(&lf, CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT|CF_FORCEFONTEXIST|CF_SCALABLEONLY|CF_EFFECTS);
+ if(dlg.DoModal() == IDOK)
+ {
+ CString str(lf.lfFaceName);
+ if(str.GetLength() > 16) str = str.Left(14) + _T("...");
+ m_font.SetWindowText(str);
+
+ for(int i = 0, j = m_charset.GetCount(); i < j; i++)
+ {
+ if(m_charset.GetItemData(i) == lf.lfCharSet)
+ {
+ m_charset.SetCurSel(i);
+ break;
+ }
+ }
+
+ m_stss = lf;
+ }
+}
+
+void CStyleEditorDialog::OnStnClickedColorpri()
+{
+ AskColor(0);
+}
+
+void CStyleEditorDialog::OnStnClickedColorsec()
+{
+ AskColor(1);
+}
+
+void CStyleEditorDialog::OnStnClickedColoroutl()
+{
+ AskColor(2);
+}
+
+void CStyleEditorDialog::OnStnClickedColorshad()
+{
+ AskColor(3);
+}
+
+void CStyleEditorDialog::OnBnClickedCheck1()
+{
+ UpdateData();
+
+ int avg = 0;
+ for(int i = 0; i < 4; i++) avg += m_alphasliders[i].GetPos();
+ avg /= 4;
+ for(int i = 0; i < 4; i++) m_alphasliders[i].SetPos(avg);
+}
+
+void CStyleEditorDialog::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
+{
+ if(m_linkalphasliders && pScrollBar)
+ {
+ int pos = ((CSliderCtrl*)pScrollBar)->GetPos();
+ for(int i = 0; i < 4; i++) m_alphasliders[i].SetPos(pos);
+ }
+
+ CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
+}
diff --git a/src/filters/transform/vsfilter/StyleEditorDialog.h b/src/filters/transform/vsfilter/StyleEditorDialog.h
new file mode 100644
index 000000000..0c5c2054d
--- /dev/null
+++ b/src/filters/transform/vsfilter/StyleEditorDialog.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+#include "resource.h"
+#include "afxwin.h"
+#include "afxcmn.h"
+#include "..\..\..\subtitles\STS.h"
+
+// CColorStatic dialog
+
+class CColorStatic : public CStatic
+{
+ DECLARE_DYNAMIC(CColorStatic)
+
+ COLORREF* m_pColor;
+
+public:
+ CColorStatic(CWnd* pParent = NULL) : m_pColor(NULL) {}
+ virtual ~CColorStatic() {}
+
+ void SetColorPtr(COLORREF* pColor) {m_pColor = pColor;}
+
+ DECLARE_MESSAGE_MAP()
+
+protected:
+ virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
+ {
+ CRect r;
+ GetClientRect(r);
+ CDC::FromHandle(lpDrawItemStruct->hDC)->FillSolidRect(r, m_pColor ? *m_pColor : ::GetSysColor(COLOR_BTNFACE));
+ }
+};
+
+// CStyleEditorDialog dialog
+
+class CStyleEditorDialog : public CDialog
+{
+ DECLARE_DYNAMIC(CStyleEditorDialog)
+
+ CString m_title;
+ CWnd* m_pParent;
+
+ void UpdateControlData(bool fSave);
+ void AskColor(int i);
+
+public:
+ CStyleEditorDialog(CString title, STSStyle* pstss, CWnd* pParent = NULL); // standard constructor
+ virtual ~CStyleEditorDialog();
+
+// Dialog Data
+ enum { IDD = IDD_STYLEDIALOG };
+
+ STSStyle m_stss;
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL OnInitDialog();
+ virtual void OnOK();
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ CButton m_font;
+ int m_iCharset;
+ CComboBox m_charset;
+ int m_spacing;
+ CSpinButtonCtrl m_spacingspin;
+ int m_angle;
+ CSpinButtonCtrl m_anglespin;
+ int m_scalex;
+ CSpinButtonCtrl m_scalexspin;
+ int m_scaley;
+ CSpinButtonCtrl m_scaleyspin;
+ int m_borderstyle;
+ int m_borderwidth;
+ CSpinButtonCtrl m_borderwidthspin;
+ int m_shadowdepth;
+ CSpinButtonCtrl m_shadowdepthspin;
+ int m_screenalignment;
+ CRect m_margin;
+ CSpinButtonCtrl m_marginleftspin;
+ CSpinButtonCtrl m_marginrightspin;
+ CSpinButtonCtrl m_margintopspin;
+ CSpinButtonCtrl m_marginbottomspin;
+ CColorStatic m_color[4];
+ int m_alpha[4];
+ CSliderCtrl m_alphasliders[4];
+ BOOL m_linkalphasliders;
+
+ afx_msg void OnBnClickedButton1();
+ afx_msg void OnStnClickedColorpri();
+ afx_msg void OnStnClickedColorsec();
+ afx_msg void OnStnClickedColoroutl();
+ afx_msg void OnStnClickedColorshad();
+ afx_msg void OnBnClickedCheck1();
+ afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
+};
diff --git a/src/filters/transform/vsfilter/Systray.cpp b/src/filters/transform/vsfilter/Systray.cpp
new file mode 100644
index 000000000..9a4655316
--- /dev/null
+++ b/src/filters/transform/vsfilter/Systray.cpp
@@ -0,0 +1,421 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "resource.h"
+#include "DirectVobSubFilter.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+// hWnd == INVALID_HANDLE_VALUE - get name, hWnd != INVALID_HANDLE_VALUE - show ppage
+static TCHAR* CallPPage(IFilterGraph* pGraph, int idx, HWND hWnd);
+
+static HHOOK g_hHook = (HHOOK)INVALID_HANDLE_VALUE;
+
+static UINT WM_DVSPREVSUB = RegisterWindowMessage(TEXT("WM_DVSPREVSUB"));
+static UINT WM_DVSNEXTSUB = RegisterWindowMessage(TEXT("WM_DVSNEXTSUB"));
+static UINT WM_DVSHIDESUB = RegisterWindowMessage(TEXT("WM_DVSHIDESUB"));
+static UINT WM_DVSSHOWSUB = RegisterWindowMessage(TEXT("WM_DVSSHOWSUB"));
+static UINT WM_DVSSHOWHIDESUB = RegisterWindowMessage(TEXT("WM_DVSSHOWHIDESUB"));
+static UINT s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
+static UINT WM_NOTIFYICON = RegisterWindowMessage(TEXT("MYWM_NOTIFYICON"));
+
+LRESULT CALLBACK HookProc(UINT code, WPARAM wParam, LPARAM lParam)
+{
+ MSG* msg = (MSG*)lParam;
+
+ if(msg->message == WM_KEYDOWN)
+ {
+ switch(msg->wParam)
+ {
+ case VK_F13: PostMessage(HWND_BROADCAST, WM_DVSPREVSUB, 0, 0); break;
+ case VK_F14: PostMessage(HWND_BROADCAST, WM_DVSNEXTSUB, 0, 0); break;
+ case VK_F15: PostMessage(HWND_BROADCAST, WM_DVSHIDESUB, 0, 0); break;
+ case VK_F16: PostMessage(HWND_BROADCAST, WM_DVSSHOWSUB, 0, 0); break;
+ case VK_F17: PostMessage(HWND_BROADCAST, WM_DVSSHOWHIDESUB, 0, 0); break;
+ default: break;
+ }
+ }
+
+ // Always call next hook in chain
+ return CallNextHookEx(g_hHook, code, wParam, lParam);
+}
+
+class CSystrayWindow : public CWnd
+{
+ SystrayIconData* m_tbid;
+
+ void StepSub(int dir)
+ {
+ int iSelected, nLangs;
+ if(FAILED(m_tbid->dvs->get_LanguageCount(&nLangs))) return;
+ if(FAILED(m_tbid->dvs->get_SelectedLanguage(&iSelected))) return;
+ if(nLangs > 0) m_tbid->dvs->put_SelectedLanguage((iSelected+dir+nLangs)%nLangs);
+ }
+
+ void ShowSub(bool fShow)
+ {
+ m_tbid->dvs->put_HideSubtitles(!fShow);
+ }
+
+ void ToggleSub()
+ {
+ bool fShow;
+ if(FAILED(m_tbid->dvs->get_HideSubtitles(&fShow))) return;
+ m_tbid->dvs->put_HideSubtitles(!fShow);
+ }
+
+public:
+ CSystrayWindow(SystrayIconData* tbid) : m_tbid(tbid) {}
+
+protected:
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnClose();
+ afx_msg void OnDestroy();
+ afx_msg void OnTimer(UINT nIDEvent);
+ afx_msg LRESULT OnDVSPrevSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnDVSNextSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnDVSHideSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnDVSShowSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnDVSShowHideSub(WPARAM, LPARAM);
+ afx_msg LRESULT OnTaskBarRestart(WPARAM, LPARAM);
+ afx_msg LRESULT OnNotifyIcon(WPARAM, LPARAM);
+};
+
+BEGIN_MESSAGE_MAP(CSystrayWindow, CWnd)
+ ON_WM_CREATE()
+ ON_WM_CLOSE()
+ ON_WM_DESTROY()
+ ON_WM_TIMER()
+ ON_REGISTERED_MESSAGE(WM_DVSPREVSUB, OnDVSPrevSub)
+ ON_REGISTERED_MESSAGE(WM_DVSNEXTSUB, OnDVSNextSub)
+ ON_REGISTERED_MESSAGE(WM_DVSHIDESUB, OnDVSHideSub)
+ ON_REGISTERED_MESSAGE(WM_DVSSHOWSUB, OnDVSShowSub)
+ ON_REGISTERED_MESSAGE(WM_DVSSHOWHIDESUB, OnDVSShowHideSub)
+ ON_REGISTERED_MESSAGE(s_uTaskbarRestart, OnTaskBarRestart)
+ ON_REGISTERED_MESSAGE(WM_NOTIFYICON, OnNotifyIcon)
+END_MESSAGE_MAP()
+
+int CSystrayWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if(CWnd::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ if(g_hHook == INVALID_HANDLE_VALUE)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+// g_hHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, AfxGetInstanceHandle(), 0);
+ }
+
+ SetTimer(1, 5000, NULL);
+
+ PostMessage(s_uTaskbarRestart);
+
+ return 0;
+}
+
+void CSystrayWindow::OnClose()
+{
+ DestroyWindow();
+}
+
+void CSystrayWindow::OnDestroy()
+{
+ NOTIFYICONDATA tnid;
+ tnid.cbSize = sizeof(NOTIFYICONDATA);
+ tnid.hWnd = m_hWnd;
+ tnid.uID = IDI_ICON1;
+ Shell_NotifyIcon(NIM_DELETE, &tnid);
+
+ if(g_hHook != INVALID_HANDLE_VALUE)
+ {
+ UnhookWindowsHookEx(g_hHook);
+ g_hHook = (HHOOK)INVALID_HANDLE_VALUE;
+ }
+
+ PostQuitMessage(0);
+}
+
+void CSystrayWindow::OnTimer(UINT nIDEvent)
+{
+ if(nIDEvent == 1)
+ {
+ UINT fScreenSaver = 0;
+ if(SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, (PVOID)&fScreenSaver, 0))
+ {
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, 0, SPIF_SENDWININICHANGE); // this might not be needed at all...
+ SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, fScreenSaver, 0, SPIF_SENDWININICHANGE);
+ }
+ }
+
+ CWnd::OnTimer(nIDEvent);
+}
+
+LRESULT CSystrayWindow::OnDVSPrevSub(WPARAM, LPARAM)
+ {StepSub(-1); return 0;}
+LRESULT CSystrayWindow::OnDVSNextSub(WPARAM, LPARAM)
+ {StepSub(+1); return 0;}
+LRESULT CSystrayWindow::OnDVSHideSub(WPARAM, LPARAM)
+ {ShowSub(false); return 0;}
+LRESULT CSystrayWindow::OnDVSShowSub(WPARAM, LPARAM)
+ {ShowSub(true); return 0;}
+LRESULT CSystrayWindow::OnDVSShowHideSub(WPARAM, LPARAM)
+ {ToggleSub(); return 0;}
+
+LRESULT CSystrayWindow::OnTaskBarRestart(WPARAM, LPARAM)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(m_tbid->fShowIcon)
+ {
+ NOTIFYICONDATA tnid;
+ tnid.cbSize = sizeof(NOTIFYICONDATA);
+ tnid.hWnd = m_hWnd;
+ tnid.uID = IDI_ICON1;
+ tnid.hIcon = (HICON)LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON1));
+// tnid.hIcon = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 0, 0, LR_LOADTRANSPARENT);
+ tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
+ tnid.uCallbackMessage = WM_NOTIFYICON;
+ lstrcpyn(tnid.szTip, TEXT("DirectVobSub"), sizeof(tnid.szTip));
+
+ BOOL res = Shell_NotifyIcon(NIM_ADD, &tnid);
+
+ if(tnid.hIcon) DestroyIcon(tnid.hIcon);
+
+ return res?0:-1;
+ }
+
+ return 0;
+}
+
+LRESULT CSystrayWindow::OnNotifyIcon(WPARAM wParam, LPARAM lParam)
+{
+ if((UINT)wParam != IDI_ICON1)
+ return -1;
+
+ HWND hWnd = m_hWnd;
+
+ switch((UINT)lParam)
+ {
+ case WM_LBUTTONDBLCLK:
+ {
+ // IMPORTANT: we must not hold the graph at the same time as showing the property page
+ // or else when closing the app the graph doesn't get released and dvobsub's JoinFilterGraph
+ // is never called to close us down.
+
+ CComPtr<IBaseFilter> pBF2;
+
+ BeginEnumFilters(m_tbid->graph, pEF, pBF)
+ {
+ if(!CComQIPtr<IDirectVobSub>(pBF))
+ continue;
+
+ if(CComQIPtr<IVideoWindow> pVW = m_tbid->graph)
+ {
+ HWND hwnd;
+ if(SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
+ || SUCCEEDED(pVW->get_MessageDrain((OAHWND*)&hwnd)))
+ hWnd = hwnd;
+ }
+
+ pBF2 = pBF;
+
+ break;
+ }
+ EndEnumFilters
+
+ if(pBF2)
+ ShowPPage(pBF2, hWnd);
+ }
+ break;
+
+ case WM_RBUTTONDOWN:
+ {
+ POINT p;
+ GetCursorPos(&p);
+
+ CInterfaceArray<IAMStreamSelect> pStreams;
+ CStringArray names;
+
+ BeginEnumFilters(m_tbid->graph, pEF, pBF)
+ {
+ CString name = GetFilterName(pBF);
+ if(name.IsEmpty()) continue;
+
+ if(CComQIPtr<IAMStreamSelect> pSS = pBF)
+ {
+ pStreams.Add(pSS);
+ names.Add(name);
+ }
+ }
+ EndEnumFilters
+
+ CMenu popup;
+ popup.CreatePopupMenu();
+
+ for(int j = 0; j < pStreams.GetCount(); j++)
+ {
+ bool fMMSwitcher = !names[j].Compare(_T("Morgan Stream Switcher"));
+
+ DWORD cStreams = 0;
+ pStreams[j]->Count(&cStreams);
+
+ DWORD flags, group, prevgroup = -1;
+
+ for(UINT i = 0; i < cStreams; i++)
+ {
+ WCHAR* pName = NULL;
+
+ if(S_OK == pStreams[j]->Info(i, 0, &flags, 0, &group, &pName, 0, 0))
+ {
+ if(prevgroup != group && i > 1)
+ {
+ if(fMMSwitcher) {cStreams = i; break;}
+ popup.AppendMenu(MF_SEPARATOR);
+ }
+ prevgroup = group;
+
+ if(pName)
+ {
+ popup.AppendMenu(MF_ENABLED|MF_STRING|(flags?MF_CHECKED:MF_UNCHECKED), (1<<15)|(j<<8)|(i), CString(pName));
+ CoTaskMemFree(pName);
+ }
+ }
+ }
+
+ if(cStreams > 0) popup.AppendMenu(MF_SEPARATOR);
+ }
+
+ int i;
+
+ TCHAR* str;
+ for(i = 0; str = CallPPage(m_tbid->graph, i, (HWND)INVALID_HANDLE_VALUE); i++)
+ {
+ if(_tcsncmp(str, _T("DivX MPEG"), 9) || m_tbid->fRunOnce) // divx3's ppage will crash if the graph hasn't been run at least once yet
+ popup.AppendMenu(MF_ENABLED|MF_STRING|MF_UNCHECKED, (1<<14)|(i), str);
+
+ delete [] str;
+ }
+
+ SetForegroundWindow();
+ UINT id = popup.TrackPopupMenu(TPM_LEFTBUTTON|TPM_RETURNCMD, p.x, p.y, CWnd::FromHandle(hWnd), 0);
+ PostMessage(WM_NULL);
+
+ if(id & (1<<15))
+ {
+ pStreams[(id>>8)&0x3f]->Enable(id&0xff, AMSTREAMSELECTENABLE_ENABLE);
+ }
+ else if(id & (1<<14))
+ {
+ if(CComQIPtr<IVideoWindow> pVW = m_tbid->graph)
+ {
+ HWND hwnd;
+ if(SUCCEEDED(pVW->get_Owner((OAHWND*)&hwnd))
+ || SUCCEEDED(pVW->get_MessageDrain((OAHWND*)&hwnd)))
+ hWnd = hwnd;
+ }
+
+ CallPPage(m_tbid->graph, id&0xff, hWnd);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+//
+
+DWORD CALLBACK SystrayThreadProc(void* pParam)
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CSystrayWindow wnd((SystrayIconData*)pParam);
+ if(!wnd.CreateEx(0, AfxRegisterWndClass(0), _T("DVSWND"), WS_OVERLAPPED, CRect(0, 0, 0, 0), NULL, 0, NULL))
+ return -1;
+
+ ((SystrayIconData*)pParam)->hSystrayWnd = wnd.m_hWnd;
+
+ MSG msg;
+ while(GetMessage(&msg, NULL/*wnd.m_hWnd*/, 0, 0))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+
+ return 0;
+}
+
+// TODO: replace this function
+
+// hWnd == INVALID_HANDLE_VALUE - get name, hWnd != INVALID_HANDLE_VALUE - show ppage
+static TCHAR* CallPPage(IFilterGraph* pGraph, int idx, HWND hWnd)
+{
+ int i = 0;
+ bool fFound = false;
+
+ WCHAR* wstr = NULL;
+ CComPtr<IBaseFilter> pFilter;
+ CAUUID caGUID;
+ caGUID.pElems = NULL;
+
+ BeginEnumFilters(pGraph, pEF, pBF)
+ {
+ CComQIPtr<ISpecifyPropertyPages> pSPS = pBF;
+ if(!pSPS) continue;
+
+ if(i == idx)
+ {
+ pFilter = pBF;
+ pSPS->GetPages(&caGUID);
+ wstr = _wcsdup(CStringW(GetFilterName(pBF))); // double char-wchar conversion happens in the non-unicode build, but anyway... :)
+ break;
+ }
+
+ i++;
+ }
+ EndEnumFilters
+
+ TCHAR* ret = NULL;
+
+ if(pFilter)
+ {
+ if(hWnd != INVALID_HANDLE_VALUE)
+ {
+ ShowPPage(pFilter, hWnd);
+ }
+ else
+ {
+ if(ret = new TCHAR[wcslen(wstr)+1])
+ _tcscpy(ret, CString(wstr));
+ }
+ }
+
+ if(caGUID.pElems) CoTaskMemFree(caGUID.pElems);
+ if(wstr) free(wstr);
+
+ return(ret);
+}
diff --git a/src/filters/transform/vsfilter/Systray.h b/src/filters/transform/vsfilter/Systray.h
new file mode 100644
index 000000000..0e41e4835
--- /dev/null
+++ b/src/filters/transform/vsfilter/Systray.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+extern DWORD CALLBACK SystrayThreadProc(void* pParam);
diff --git a/src/filters/transform/vsfilter/TextInputPin.cpp b/src/filters/transform/vsfilter/TextInputPin.cpp
new file mode 100644
index 000000000..2abd2b431
--- /dev/null
+++ b/src/filters/transform/vsfilter/TextInputPin.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "DirectVobSubFilter.h"
+#include "TextInputPin.h"
+#include "..\..\..\DSUtil\DSUtil.h"
+
+CTextInputPin::CTextInputPin(CDirectVobSubFilter* pFilter, CCritSec* pLock, CCritSec* pSubLock, HRESULT* phr)
+ : CSubtitleInputPin(pFilter, pLock, pSubLock, phr)
+ , m_pDVS(pFilter)
+{
+}
+
+void CTextInputPin::AddSubStream(ISubStream* pSubStream)
+{
+ m_pDVS->AddSubStream(pSubStream);
+}
+
+void CTextInputPin::RemoveSubStream(ISubStream* pSubStream)
+{
+ m_pDVS->RemoveSubStream(pSubStream);
+}
+
+void CTextInputPin::InvalidateSubtitle(REFERENCE_TIME rtStart, ISubStream* pSubStream)
+{
+ m_pDVS->InvalidateSubtitle(rtStart, (DWORD_PTR)(ISubStream*)pSubStream);
+}
diff --git a/src/filters/transform/vsfilter/TextInputPin.h b/src/filters/transform/vsfilter/TextInputPin.h
new file mode 100644
index 000000000..4a3d1debf
--- /dev/null
+++ b/src/filters/transform/vsfilter/TextInputPin.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\..\..\subtitles\SubtitleInputPin.h"
+
+class CDirectVobSubFilter;
+
+class CTextInputPin : public CSubtitleInputPin
+{
+ CDirectVobSubFilter* m_pDVS;
+
+protected:
+ void AddSubStream(ISubStream* pSubStream);
+ void RemoveSubStream(ISubStream* pSubStream);
+ void InvalidateSubtitle(REFERENCE_TIME rtStart, ISubStream* pSubStream);
+
+public:
+ CTextInputPin(CDirectVobSubFilter* pFilter, CCritSec* pLock, CCritSec* pSubLock, HRESULT* phr);
+};
+
diff --git a/src/filters/transform/vsfilter/VSFilter.cpp b/src/filters/transform/vsfilter/VSFilter.cpp
new file mode 100644
index 000000000..0ace5ae2c
--- /dev/null
+++ b/src/filters/transform/vsfilter/VSFilter.cpp
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "DirectVobSubFilter.h"
+#include "DirectVobSubPropPage.h"
+#include "VSFilter.h"
+#include "..\..\..\DSUtil\MediaTypes.h"
+
+#include <initguid.h>
+#include "..\..\..\..\include\moreuuids.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CVSFilterApp
+
+BEGIN_MESSAGE_MAP(CVSFilterApp, CWinApp)
+END_MESSAGE_MAP()
+
+CVSFilterApp::CVSFilterApp()
+{
+}
+
+extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
+
+BOOL CVSFilterApp::InitInstance()
+{
+ if(!CWinApp::InitInstance())
+ return FALSE;
+
+ SetRegistryKey(_T("Gabest"));
+
+ DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_ATTACH, 0); // "DllMain" of the dshow baseclasses
+
+ STARTUPINFO si;
+ GetStartupInfo(&si);
+ m_AppName = CString(si.lpTitle);
+ m_AppName.Replace('\\', '/');
+ m_AppName = m_AppName.Mid(m_AppName.ReverseFind('/')+1);
+ m_AppName.MakeLower();
+
+ return TRUE;
+}
+
+int CVSFilterApp::ExitInstance()
+{
+ DllEntryPoint(AfxGetInstanceHandle(), DLL_PROCESS_DETACH, 0); // "DllMain" of the dshow baseclasses
+
+ return CWinApp::ExitInstance();
+}
+
+HINSTANCE CVSFilterApp::LoadAppLangResourceDLL()
+{
+ CString fn;
+ fn.ReleaseBufferSetLength(::GetModuleFileName(m_hInstance, fn.GetBuffer(MAX_PATH), MAX_PATH));
+ fn = fn.Mid(fn.ReverseFind('\\')+1);
+ fn = fn.Left(fn.ReverseFind('.')+1);
+ fn = fn + _T("lang");
+ return ::LoadLibrary(fn);
+}
+
+CVSFilterApp theApp;
+
+//////////////////////////////////////////////////////////////////////////
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn[] =
+{
+ {&MEDIATYPE_NULL, &MEDIASUBTYPE_NULL},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_YUY2},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_YV12},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_I420},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_IYUV},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB32},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB565},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB555},
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_RGB24},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesIn2[] =
+{
+ {&MEDIATYPE_Text, &MEDIASUBTYPE_None},
+};
+
+const AMOVIESETUP_MEDIATYPE sudPinTypesOut[] =
+{
+ {&MEDIATYPE_Video, &MEDIASUBTYPE_None},
+};
+
+const AMOVIESETUP_PIN sudpPins[] =
+{
+ {L"Input", FALSE, FALSE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesIn), sudPinTypesIn},
+ {L"Output", FALSE, TRUE, FALSE, FALSE, &CLSID_NULL, NULL, countof(sudPinTypesOut), sudPinTypesOut},
+ {L"Input2", TRUE, FALSE, FALSE, TRUE, &CLSID_NULL, NULL, countof(sudPinTypesIn2), sudPinTypesIn2}
+};
+
+/*const*/ AMOVIESETUP_FILTER sudFilter[] =
+{
+ {&__uuidof(CDirectVobSubFilter), L"DirectVobSub", MERIT_DO_NOT_USE, countof(sudpPins), sudpPins},
+ {&__uuidof(CDirectVobSubFilter2), L"DirectVobSub (auto-loading version)", MERIT_PREFERRED+2, countof(sudpPins), sudpPins},
+};
+
+CFactoryTemplate g_Templates[] =
+{
+ {sudFilter[0].strName, sudFilter[0].clsID, CreateInstance<CDirectVobSubFilter>, NULL, &sudFilter[0]},
+ {sudFilter[1].strName, sudFilter[1].clsID, CreateInstance<CDirectVobSubFilter2>, NULL, &sudFilter[1]},
+ {L"DVSMainPPage", &__uuidof(CDVSMainPPage), CreateInstance<CDVSMainPPage>},
+ {L"DVSGeneralPPage", &__uuidof(CDVSGeneralPPage), CreateInstance<CDVSGeneralPPage>},
+ {L"DVSMiscPPage", &__uuidof(CDVSMiscPPage), CreateInstance<CDVSMiscPPage>},
+ {L"DVSTimingPPage", &__uuidof(CDVSTimingPPage), CreateInstance<CDVSTimingPPage>},
+ {L"DVSZoomPPage", &__uuidof(CDVSZoomPPage), CreateInstance<CDVSZoomPPage>},
+ {L"DVSColorPPage", &__uuidof(CDVSColorPPage), CreateInstance<CDVSColorPPage>},
+ {L"DVSPathsPPage", &__uuidof(CDVSPathsPPage), CreateInstance<CDVSPathsPPage>},
+ {L"DVSAboutPPage", &__uuidof(CDVSAboutPPage), CreateInstance<CDVSAboutPPage>},
+};
+
+int g_cTemplates = countof(g_Templates);
+
+//////////////////////////////
+/*removeme*/
+extern void JajDeGonoszVagyok();
+
+STDAPI DllRegisterServer()
+{
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0) != 1)
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_SEENDIVXWARNING), 0);
+
+ if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), -1) == -1)
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_VMRZOOMENABLED), 0);
+
+ if(theApp.GetProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), -1) == -1)
+ theApp.WriteProfileInt(ResStr(IDS_R_GENERAL), ResStr(IDS_RG_ENABLEZPICON), 0);
+
+ /*removeme*/
+ JajDeGonoszVagyok();
+
+ return AMovieDllRegisterServer2(TRUE);
+}
+
+STDAPI DllUnregisterServer()
+{
+// DVS_WriteProfileInt2(IDS_R_GENERAL, IDS_RG_SEENDIVXWARNING, 0);
+
+ return AMovieDllRegisterServer2(FALSE);
+}
+
+void CALLBACK DirectVobSub(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
+{
+ if(FAILED(::CoInitialize(0))) return;
+
+ CComPtr<IBaseFilter> pFilter;
+ CComQIPtr<ISpecifyPropertyPages> pSpecify;
+
+ if(SUCCEEDED(pFilter.CoCreateInstance(__uuidof(CDirectVobSubFilter))) && (pSpecify = pFilter))
+ {
+ ShowPPage(pFilter, hwnd);
+ }
+
+ ::CoUninitialize();
+}
diff --git a/src/filters/transform/vsfilter/VSFilter.def b/src/filters/transform/vsfilter/VSFilter.def
new file mode 100644
index 000000000..af5ac09ef
--- /dev/null
+++ b/src/filters/transform/vsfilter/VSFilter.def
@@ -0,0 +1,10 @@
+; VSFilter.def : Declares the module parameters.
+
+LIBRARY "VSFilter.dll"
+
+EXPORTS
+ DllCanUnloadNow PRIVATE
+ DllGetClassObject PRIVATE
+ DllRegisterServer PRIVATE
+ DllUnregisterServer PRIVATE
+ DirectVobSub
diff --git a/src/filters/transform/vsfilter/VSFilter.h b/src/filters/transform/vsfilter/VSFilter.h
new file mode 100644
index 000000000..1fafb0c2d
--- /dev/null
+++ b/src/filters/transform/vsfilter/VSFilter.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "resource.h"
+
+class CVSFilterApp : public CWinApp
+{
+public:
+ CVSFilterApp();
+
+ CString m_AppName;
+
+protected:
+ HINSTANCE LoadAppLangResourceDLL();
+
+public:
+ BOOL InitInstance();
+ BOOL ExitInstance();
+
+ DECLARE_MESSAGE_MAP()
+};
+
+extern CVSFilterApp theApp;
+
+#define ResStr(id) CString(MAKEINTRESOURCE(id))
diff --git a/src/filters/transform/vsfilter/VSFilter.rc b/src/filters/transform/vsfilter/VSFilter.rc
new file mode 100644
index 000000000..95e17589e
--- /dev/null
+++ b/src/filters/transform/vsfilter/VSFilter.rc
@@ -0,0 +1,599 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,1,3
+ PRODUCTVERSION 1,0,1,3
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "Visit http://gabest.org/ for updates."
+ VALUE "CompanyName", "Gabest"
+ VALUE "FileDescription", "VobSub & TextSub filter for DirectShow/VirtualDub/Avisynth"
+ VALUE "FileVersion", "1, 0, 1, 3"
+ VALUE "InternalName", "VSFilter"
+ VALUE "LegalCopyright", "Copyright (C) 2001-2006 Gabest"
+ VALUE "OriginalFilename", "VSFilter.DLL"
+ VALUE "ProductName", "VSFilter"
+ VALUE "ProductVersion", "1, 0, 1, 3"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_DVSABOUTPAGE DIALOGEX 0, 0, 247, 188
+STYLE DS_SETFONT | WS_CHILD
+FONT 8, "MS Sans Serif", 400, 0, 0x1
+BEGIN
+ GROUPBOX "",IDC_STATIC,7,7,232,151
+ LTEXT "DirectVobSub 2.37\nCopyright 2001-2006 Gabest",IDC_STATIC,13,17,183,19
+ LTEXT "Credits:\n- SAMI format support by Sanger && Wilowisp of SPKOR\n- Handling of some basic html style modifier tags in SAMI done by [maven]",IDC_STATIC,14,39,218,32
+ LTEXT "- Advanced Text Renderer is using the 'Rasterizer' class \nof Avery Lee's subtitler plugin\n- Command line ppage launcher by @livier",IDC_STATIC,14,70,219,26
+ PUSHBUTTON "Homepage",IDC_HOMEPAGEBTN,63,132,50,14,BS_FLAT
+ PUSHBUTTON "Bug Report",IDC_BUGREPORTBTN,133,132,50,14,BS_FLAT
+ LTEXT "- Adding hotkeys, Chinese (Taiwan) && Chinese (P.R.C.) localized, Kii Ali <kiiali@cpatch.org>",IDC_STATIC,14,95,206,20
+END
+
+IDD_DVSCOLORPAGE DIALOGEX 0, 0, 247, 188
+STYLE DS_SETFONT | WS_CHILD
+FONT 8, "MS Sans Serif", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Preference Order",IDC_STATIC,7,7,70,156
+ GROUPBOX "Dynamic Change",IDC_STATIC,84,7,70,156
+ LISTBOX IDC_PREFLIST,15,19,53,115,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ LISTBOX IDC_DYNCHGLIST,92,19,53,115,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Dynamic format change may only work under Windows XP using the Video Mixing Render and only into color formats supported by the video card or the desktop color depth.",IDC_DYNCHGWARNING,160,19,72,75
+ LTEXT "For the old renderer you have to adjust the preference list and re-open the video file.",IDC_DYNCHGWARNING2,160,96,71,42
+ PUSHBUTTON "&Up",IDC_COLORUP,16,141,25,12
+ PUSHBUTTON "&Down",IDC_COLORDOWN,41,141,25,12
+ PUSHBUTTON "&Change!",IDC_COLORCHANGE,102,141,33,12
+ CONTROL "&Force RGB",IDC_FORCERGBCHK,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,170,142,51,10
+END
+
+IDD_DVSGENERALPAGE DIALOGEX 0, 0, 247, 188
+STYLE DS_SETFONT | WS_CHILD
+FONT 8, "MS Sans Serif", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Picture Size",IDC_STATIC,7,7,233,136
+ LTEXT "Vertical padding (if you want to move the subtitles below the picture)",IDC_STATIC,17,21,213,17
+ COMBOBOX IDC_VEREXTCOMBO,26,36,86,62,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Horizontal padding (check this if you can't run the video in the yuy2 or yv12 format)",IDC_STATIC,17,57,213,18
+ CONTROL "&MOD32 fix",IDC_MOD32FIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,80,51,10
+ LTEXT "Resolution (doubling the picture size needs more processing power but allows higher quality subtitles)",IDC_STATIC,17,96,213,18
+ COMBOBOX IDC_RESX2COMBO,26,120,86,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT3,133,120,34,12,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
+ CONTROL "",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,158,119,11,14
+ LTEXT "x",IDC_STATIC,171,122,8,8
+ EDITTEXT IDC_EDIT4,179,120,32,12,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
+ CONTROL "",IDC_SPIN4,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,205,119,11,14
+ GROUPBOX "Loading",IDC_STATIC,7,146,233,35
+ COMBOBOX IDC_LOADCOMBO,17,160,78,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CONTROL "E&xternal",IDC_EXTLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,103,160,39,12
+ CONTROL "We&b",IDC_WEBLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,149,160,28,12
+ CONTROL "&Embedded",IDC_EMBLOAD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,183,160,47,12
+END
+
+IDD_DVSMAINPAGE DIALOGEX 0, 0, 247, 226
+STYLE DS_SETFONT | WS_CHILD
+FONT 8, "MS Sans Serif", 400, 0, 0x1
+BEGIN
+ EDITTEXT IDC_FILENAME,7,7,184,14,ES_AUTOHSCROLL | ES_READONLY
+ PUSHBUTTON "&Open...",IDC_OPEN,196,7,43,14
+ CONTROL "Ove&rride placement",IDC_OVERRIDEPLACEMENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,132,34,100,12
+ LTEXT "H:",IDC_STATIC,139,50,9,8
+ EDITTEXT IDC_EDIT1,149,50,32,12,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
+ CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,171,53,11,14
+ LTEXT "V:",IDC_STATIC,184,50,8,8
+ EDITTEXT IDC_EDIT2,195,50,32,12,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
+ CONTROL "Spin1",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,210,53,11,14
+ GROUPBOX "Text Settings",IDC_STATIC,7,74,111,35
+ PUSHBUTTON "Arial",IDC_FONT,15,88,95,13
+ GROUPBOX "VobSub Settings",IDC_STATIC,124,74,115,35
+ CONTROL "Only show &forced subtitles",IDC_ONLYSHOWFORCEDSUBS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,132,88,99,12
+ GROUPBOX "General Settings",IDC_STATIC,7,24,232,47
+ COMBOBOX IDC_LANGCOMBO,15,50,95,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ CTEXT "This space was intentionally left blank... :)",IDC_STATIC,7,188,232,31,SS_CENTERIMAGE | NOT WS_VISIBLE | WS_BORDER
+ LTEXT "Language:",IDC_STATIC,15,37,35,8
+END
+
+IDD_DVSMISCPAGE DIALOGEX 0, 0, 247, 188
+STYLE DS_SETFONT | WS_CHILD | WS_SYSMENU
+FONT 8, "MS Sans Serif", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Picture Output",IDC_STATIC,7,7,232,81
+ CONTROL "Flip &picture vertically",IDC_FLIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,21,78,10
+ CONTROL "Flip &subtitles vertically",IDC_FLIPSUB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,109,21,84,10
+ LTEXT "(subtitles and the picture flip independently)",IDC_STATIC,26,33,142,9
+ CONTROL "&Hide subtitles",IDC_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,58,10
+ CONTROL "Show &OSD statistics",IDC_SHOWOSDSTATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,62,80,10
+ LTEXT "(don't do benchmarks on the playback while having this on ;)",IDC_STATIC,26,73,195,8
+ CONTROL "Pre-&buffer subpictures",IDC_PREBUFFERING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,95,88,10
+ CONTROL "&Auto-reload subtitle files after detecting modification",IDC_AUTORELOAD,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,112,185,10
+ LTEXT " (reloading is disabled while showing the property pages)",IDC_STATIC,26,123,182,8
+ CONTROL "&Save full path into .grf",IDC_SAVEFULLPATH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,136,91,10
+ CONTROL "Appl&y changes immediately",IDC_INSTANTUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,153,104,10
+END
+
+IDD_DVSPATHSPAGE DIALOGEX 0, 0, 247, 188
+STYLE DS_SETFONT | WS_CHILD
+FONT 8, "MS Sans Serif", 400, 0, 0x1
+BEGIN
+ LTEXT "The auto-loader will search these paths for matching subtitles:\n(a path may be absolute or relative)",IDC_STATIC,7,7,233,17
+ LISTBOX IDC_PATHLIST,7,26,233,119,LBS_NOINTEGRALHEIGHT | LBS_WANTKEYBOARDINPUT | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_PATHEDIT,7,148,233,14,ES_AUTOHSCROLL
+ PUSHBUTTON "&Browse...",IDC_BROWSE,7,167,50,14
+ PUSHBUTTON "&Remove",IDC_REMOVE,137,167,50,14
+ PUSHBUTTON "&Add",IDC_ADD,190,167,50,14
+END
+
+IDD_DVSTIMINGPAGE DIALOGEX 0, 0, 247, 188
+STYLE DS_SETFONT | WS_CHILD
+FONT 8, "MS Sans Serif", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Subtitle Timing",IDC_STATIC,7,7,233,96
+ LTEXT "Delay (enter a positive number if the subtitles are late, or a negative if they come early)",IDC_STATIC,14,20,219,16
+ EDITTEXT IDC_EDIT5,20,41,48,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN5,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,60,45,11,14
+ LTEXT "(millisecs)",IDC_STATIC,73,43,31,8
+ LTEXT "Speed Ratio (this may be useful for using a subtitle originally synchronized to a video with a different fps)",IDC_STATIC,14,61,219,18
+ EDITTEXT IDC_EDIT6,20,82,39,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN6,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,48,87,11,14
+ LTEXT ":",IDC_STATIC,64,84,8,8
+ EDITTEXT IDC_EDIT9,72,82,39,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,102,85,11,14
+ LTEXT "(subtitles : video)",IDC_STATIC,120,83,56,8
+ GROUPBOX "Playback rate (experimental)",IDC_STATIC,7,108,233,34
+ CONTROL "Force fps:",IDC_MODFPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,121,47,12
+ EDITTEXT IDC_FPS,72,121,36,12,ES_CENTER | ES_AUTOHSCROLL
+ LTEXT "- operability depends on other filters\n- may cause a/v desync",IDC_STATIC,114,118,120,18
+END
+
+IDD_DVSZOOMPAGE DIALOGEX 0, 0, 247, 188
+STYLE DS_SETFONT | WS_CHILD
+FONT 8, "MS Sans Serif", 400, 0, 0x1
+BEGIN
+ LTEXT "x pos:",IDC_STATIC,16,14,20,8
+ EDITTEXT IDC_EDIT1,46,11,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER
+ CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,77,11,11,14
+ LTEXT "y pos:",IDC_STATIC,16,34,20,8
+ EDITTEXT IDC_EDIT2,46,31,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER
+ CONTROL "Spin1",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,77,31,11,14
+ LTEXT "x scale:",IDC_STATIC,11,54,25,8
+ EDITTEXT IDC_EDIT7,46,51,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER
+ CONTROL "Spin1",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,77,51,11,14
+ LTEXT "y scale:",IDC_STATIC,11,74,25,8
+ EDITTEXT IDC_EDIT8,46,71,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY | ES_NUMBER
+ CONTROL "Spin1",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,77,71,11,14
+END
+
+IDD_TEXTSUBOPENTEMPLATE DIALOGEX 0, 0, 208, 16
+STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ COMBOBOX IDC_COMBO1,54,0,105,92,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Character set:",IDC_STATIC,5,2,48,8
+END
+
+IDD_STYLEDIALOG DIALOGEX 0, 0, 323, 219
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Style Editor"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ GROUPBOX "Font",IDC_STATIC,7,7,109,130
+ PUSHBUTTON "Font",IDC_BUTTON1,15,20,93,13
+ COMBOBOX IDC_COMBO1,15,39,93,52,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Spacing",IDC_STATIC,21,60,26,8
+ EDITTEXT IDC_EDIT3,64,58,34,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN3,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,97,58,11,14
+ LTEXT "Angle (z,°)",IDC_STATIC,21,79,36,8
+ EDITTEXT IDC_EDIT11,64,77,34,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN10,"msctls_updown32",UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,97,77,11,14
+ LTEXT "Scale (x,%)",IDC_STATIC,21,98,39,8
+ EDITTEXT IDC_EDIT5,64,96,34,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN4,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,97,96,11,14
+ LTEXT "Scale (y,%)",IDC_STATIC,21,117,39,8
+ EDITTEXT IDC_EDIT6,64,115,34,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN5,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,97,115,11,14
+ GROUPBOX "Border Style",IDC_STATIC,7,140,110,71
+ CONTROL "Outline",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP,15,156,39,10
+ CONTROL "Opaque box",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,59,156,55,10
+ LTEXT "Border width",IDC_STATIC,17,174,42,8
+ EDITTEXT IDC_EDIT1,71,171,34,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,102,170,11,14
+ LTEXT "Shadow depth",IDC_STATIC,17,193,47,8
+ EDITTEXT IDC_EDIT2,71,190,34,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,102,191,11,14
+ GROUPBOX "Screen Alignment && Margins",IDC_STATIC,125,7,187,52
+ CONTROL "",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON | WS_GROUP,134,42,11,8
+ CONTROL "",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,146,42,11,8
+ CONTROL "",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,158,42,11,8
+ CONTROL "",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,134,31,11,8
+ CONTROL "",IDC_RADIO7,"Button",BS_AUTORADIOBUTTON,146,31,11,8
+ CONTROL "",IDC_RADIO8,"Button",BS_AUTORADIOBUTTON,158,31,11,8
+ CONTROL "",IDC_RADIO9,"Button",BS_AUTORADIOBUTTON,134,20,11,8
+ CONTROL "",IDC_RADIO10,"Button",BS_AUTORADIOBUTTON,146,20,11,8
+ CONTROL "",IDC_RADIO11,"Button",BS_AUTORADIOBUTTON,158,20,11,8
+ LTEXT "Left",IDC_STATIC,176,22,14,8
+ EDITTEXT IDC_EDIT7,198,19,34,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN6,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,227,19,11,14
+ LTEXT "Right",IDC_STATIC,176,39,18,8
+ EDITTEXT IDC_EDIT8,198,37,34,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN7,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,227,37,11,14
+ LTEXT "Top",IDC_STATIC,240,22,13,8
+ EDITTEXT IDC_EDIT9,268,19,34,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN8,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,296,17,11,14
+ LTEXT "Bottom",IDC_STATIC,240,39,24,8
+ EDITTEXT IDC_EDIT10,268,37,34,14,ES_RIGHT | ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN9,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,296,37,11,14
+ GROUPBOX "Colors && Transparency",IDC_STATIC,125,63,187,110
+ LTEXT "Primary",IDC_STATIC,133,88,25,8
+ CONTROL "",IDC_COLORPRI,"Static",SS_OWNERDRAW | SS_NOTIFY,175,85,16,14,WS_EX_DLGMODALFRAME
+ CONTROL "",IDC_SLIDER2,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,198,86,103,13
+ LTEXT "Secondary",IDC_STATIC,133,105,34,8
+ CONTROL "",IDC_COLORSEC,"Static",SS_OWNERDRAW | SS_NOTIFY,175,102,16,14,WS_EX_DLGMODALFRAME
+ CONTROL "",IDC_SLIDER3,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,198,103,103,13
+ LTEXT "Outline",IDC_STATIC,133,122,24,8
+ CONTROL "",IDC_COLOROUTL,"Static",SS_OWNERDRAW | SS_NOTIFY,175,119,16,14,WS_EX_DLGMODALFRAME
+ CONTROL "",IDC_SLIDER5,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,198,120,103,13
+ LTEXT "Shadow",IDC_STATIC,133,139,26,8
+ CONTROL "",IDC_COLORSHAD,"Static",SS_OWNERDRAW | SS_NOTIFY,175,136,16,14,WS_EX_DLGMODALFRAME
+ CONTROL "",IDC_SLIDER6,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,198,137,103,13
+ CONTROL "Link alpha channels",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,213,154,76,10
+ PUSHBUTTON "Cancel",IDCANCEL,211,197,50,14
+ DEFPUSHBUTTON "OK",IDOK,265,197,50,14
+ LTEXT "100%",IDC_STATIC,289,76,20,8
+ LTEXT "0%",IDC_STATIC,200,76,12,8
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1 ICON "res\\Icon_147.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_DVSABOUTPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 239
+ VERTGUIDE, 14
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 181
+ HORZGUIDE, 139
+ END
+
+ IDD_DVSCOLORPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 239
+ VERTGUIDE, 41
+ VERTGUIDE, 118
+ VERTGUIDE, 160
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 181
+ HORZGUIDE, 19
+ HORZGUIDE, 134
+ HORZGUIDE, 147
+ HORZGUIDE, 153
+ HORZGUIDE, 163
+ END
+
+ IDD_DVSGENERALPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 240
+ VERTGUIDE, 17
+ VERTGUIDE, 26
+ VERTGUIDE, 112
+ VERTGUIDE, 240
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 181
+ HORZGUIDE, 126
+ HORZGUIDE, 166
+ END
+
+ IDD_DVSMAINPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 239
+ VERTGUIDE, 15
+ VERTGUIDE, 27
+ VERTGUIDE, 110
+ VERTGUIDE, 124
+ VERTGUIDE, 132
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 219
+ HORZGUIDE, 24
+ HORZGUIDE, 188
+ END
+
+ IDD_DVSMISCPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 239
+ VERTGUIDE, 16
+ VERTGUIDE, 26
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 181
+ HORZGUIDE, 26
+ END
+
+ IDD_DVSPATHSPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 240
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 181
+ END
+
+ IDD_DVSTIMINGPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 240
+ VERTGUIDE, 20
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 181
+ HORZGUIDE, 127
+ END
+
+ IDD_DVSZOOMPAGE, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 239
+ VERTGUIDE, 36
+ VERTGUIDE, 46
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 181
+ HORZGUIDE, 18
+ HORZGUIDE, 38
+ HORZGUIDE, 58
+ HORZGUIDE, 78
+ END
+
+ IDD_STYLEDIALOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 316
+ VERTGUIDE, 136
+ VERTGUIDE, 186
+ VERTGUIDE, 201
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 212
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_PROJNAME "&DirectVobSub"
+ IDD_DVSPATHSPAGE "&Paths"
+ IDS_PROJNAME2 "&Subtitle Source"
+ IDS_DIVX_WARNING "The found DivX DirectShow decoder (divx_c32.ax) may be\nincompatible with the current operating system. Please, try\nto install version 3.11 or 4.0+.\n\n(This message will appear only once per installation)"
+ IDD_DVSABOUTPAGE "&About"
+ IDS_R_TEXT "Text"
+ IDS_R_VOBSUB "VobSub"
+ IDS_R_DEFTEXTPATHES "DefTextPathes"
+ IDS_R_PREFLANGS "PreferedLanguages"
+ IDS_RG_SAVEFULLPATH "SaveFullPath"
+ IDS_RG_EXTPIC "Extpic"
+ IDS_RG_MOD32FIX "Mod32Fix"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RG_LOADLEVEL "LoadLevel"
+ IDS_RG_INSTANTUPDATE "InstantUpdate"
+ IDS_RG_FLIPPICTURE "FlipPicture"
+ IDS_RG_HIDE "Hide"
+ IDS_RG_NOYUY2COLORS "NoYUY2Colors"
+ IDS_RG_DOPREBUFFERING "DoPreBuffering"
+ IDS_RG_SHOWOSDSTATS "ShowOSDStats"
+ IDS_RG_SEENDIVXWARNING "SeenDivxWarning"
+ IDS_RG_RESX2 "ResX2Mode"
+ IDS_RG_RESX2MINW "ResX2MinWidth"
+ IDS_RG_RESX2MINH "ResX2MinHeight"
+ IDS_RTM_MEDIAFPS "MediaFPS"
+ IDS_RT_SHADOW "Shadow"
+ IDS_RT_OUTLINE "Outline"
+ IDS_RT_LOGFONT "LOGFONT"
+ IDS_RT_COLOR "Color"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RT_OVERRIDEPLACEMENT "OverridePlacement"
+ IDS_RT_XPERC "XPerc"
+ IDS_RT_YPERC "YPerc"
+ IDS_RV_BUFFER "Buffer"
+ IDS_RP_PATH "Path%d"
+ IDS_RL_LANG "Lang%d"
+ IDS_M_SHOWSUBTITLES "Show Subtitles"
+ IDS_M_HIDESUBTITLES "Hide Subtitles"
+ IDS_M_ORIGINALPICTURE "Original Picture"
+ IDS_M_FLIPPEDPICTURE "Flipped Picture"
+ IDS_RV_POLYGONIZE "Polygonize"
+ IDS_RG_EXTERNALLOAD "ExtLoad"
+ IDS_RG_WEBLOAD "WebLoad"
+ IDS_RG_EMBEDDEDLOAD "EmbLoad"
+ IDS_URL_HOMEPAGE "http://gabest.org/"
+ IDS_URL_EMAIL "mailto:gabest@freemail.hu"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_R_TIMING "Timing"
+ IDS_RTM_SUBTITLEDELAY "Subtitle Delay"
+ IDS_RTM_SUBTITLESPEEDMUL "Subtitle Speedmul"
+ IDS_RT_ADVANCEDRENDERER "AdvancedRenderer"
+ IDS_RV_ONLYSHOWFORCEDSUBS "OnlyShowForcedSubs"
+ IDS_ORGHEIGHT "Original height"
+ IDS_RG_VMRZOOMENABLED "VMRZoomEnabled"
+ IDS_RTM_SUBTITLESPEEDDIV "Subtitle Speeddiv"
+ IDS_RG_COLORFORMATS "Color Formats"
+ IDS_EXTTO169 "Extend to 16:9"
+ IDS_RG_FORCERGB "ForceRGB"
+ IDS_RG_ENABLEZPICON "EnableZPIcon"
+ IDS_RG_FLIPSUBTITLES "FlipSubtitles"
+ IDS_RTM_MEDIAFPSENABLED "MediaFPSEnabled"
+ IDS_RG_DISABLERELOADER "DisableReloader"
+ IDS_EXTTO43 "Extend to 4:3"
+END
+
+STRINGTABLE
+BEGIN
+ IDD_DVSCOLORPAGE "&Colors"
+ IDD_DVSGENERALPAGE "&General"
+ IDD_DVSTIMINGPAGE "&Timing"
+ IDD_DVSMISCPAGE "M&isc"
+ IDS_R_GENERAL "General"
+END
+
+STRINGTABLE
+BEGIN
+ IDD_DVSMAINPAGE "&Main"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_CROPTO169 "Crop to 16:9"
+ IDS_CROPTO43 "Crop to 4:3"
+ IDS_ORGRES "Original resolution"
+ IDS_DBLRES "Doubled resolution"
+ IDS_DBLRESIF "Double if smaller than"
+ IDS_DONOTLOAD "Do not load"
+ IDS_LOADWHENNEEDED "Load when needed"
+ IDS_ALWAYSLOAD "Always load"
+ IDS_EXTTO576 "Extend to 576 lines"
+ IDS_EXTTO480 "Extend to 480 lines"
+END
+
+STRINGTABLE
+BEGIN
+ IDS_RT_STYLE "Style"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/src/filters/transform/vsfilter/VSFilter.sln b/src/filters/transform/vsfilter/VSFilter.sln
new file mode 100644
index 000000000..965327718
--- /dev/null
+++ b/src/filters/transform/vsfilter/VSFilter.sln
@@ -0,0 +1,145 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VSFilter", "VSFilter.vcproj", "{F671100C-469F-4723-AAC4-B7FE4F5B8DC4}"
+ ProjectSection(ProjectDependencies) = postProject
+ {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680}
+ {D514EA4D-EAFB-47A9-A437-A582CA571251} = {D514EA4D-EAFB-47A9-A437-A582CA571251}
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601} = {6BA829DC-20C1-4B6B-BF63-7601FEB64601}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subpic", "..\..\..\subpic\subpic.vcproj", "{D514EA4D-EAFB-47A9-A437-A582CA571251}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitles", "..\..\..\subtitles\subtitles.vcproj", "{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D514EA4D-EAFB-47A9-A437-A582CA571251} = {D514EA4D-EAFB-47A9-A437-A582CA571251}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseClasses", "C:\Program Files\Microsoft DirectX 9.0 SDK (October 2004)\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{6BA829DC-20C1-4B6B-BF63-7601FEB64601}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basevideofilter", "..\basevideofilter\basevideofilter.vcproj", "{54DDA60F-E528-4D07-A152-960A1E818680}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug lib = Debug lib
+ Debug Unicode = Debug Unicode
+ Debug Unicode lib = Debug Unicode lib
+ Release = Release
+ Release lib = Release lib
+ Release Unicode = Release Unicode
+ Release Unicode lib = Release Unicode lib
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug.ActiveCfg = Debug|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug.Build.0 = Debug|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug lib.ActiveCfg = Debug|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug lib.Build.0 = Debug|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release.ActiveCfg = Release|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release.Build.0 = Release|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release lib.ActiveCfg = Release|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release lib.Build.0 = Release|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode.Build.0 = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug.ActiveCfg = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug.Build.0 = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug lib.ActiveCfg = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug lib.Build.0 = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release.ActiveCfg = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release.Build.0 = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release lib.ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release lib.Build.0 = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode.Build.0 = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug lib.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug lib.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.Build.0 = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release lib.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release lib.Build.0 = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.Build.0 = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug.ActiveCfg = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug.Build.0 = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug lib.ActiveCfg = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug lib.Build.0 = Debug|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode lib.ActiveCfg = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Debug Unicode lib.Build.0 = Debug Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release.ActiveCfg = Release|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release.Build.0 = Release|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release lib.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release lib.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode.Build.0 = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode lib.ActiveCfg = Release Unicode|Win32
+ {6BA829DC-20C1-4B6B-BF63-7601FEB64601}.Release Unicode lib.Build.0 = Release Unicode|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug.ActiveCfg = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug.Build.0 = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug lib.ActiveCfg = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug lib.Build.0 = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode.ActiveCfg = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode.Build.0 = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode lib.ActiveCfg = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode lib.Build.0 = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release.ActiveCfg = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release.Build.0 = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release lib.ActiveCfg = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release lib.Build.0 = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode.ActiveCfg = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode.Build.0 = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode lib.ActiveCfg = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode lib.Build.0 = Release Unicode lib|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/transform/vsfilter/VSFilter.vcproj b/src/filters/transform/vsfilter/VSFilter.vcproj
new file mode 100644
index 000000000..90bc1f339
--- /dev/null
+++ b/src/filters/transform/vsfilter/VSFilter.vcproj
@@ -0,0 +1,420 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="VSFilter"
+ ProjectGUID="{F671100C-469F-4723-AAC4-B7FE4F5B8DC4}"
+ SccProjectName=""
+ SccLocalPath=""
+ Keyword="AtlProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="1"
+ WholeProgramOptimization="FALSE">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;WINVER=0x0500;_WIN32_WINNT=0x501;ISOLATION_AWARE_ENABLED"
+ MinimalRebuild="FALSE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\$(OutDir)/$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib subtitlesDU.lib subpicDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile=".\VSFilter.def"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\$(OutDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ ImportLibrary=".\$(OutDir)/$(ProjectName).lib"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\$(OutDir)/$(ProjectName).tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG;AFX_RESOURCE_DLL;AFX_TARG_ENU"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;WINVER=0x0500;_WIN32_WINNT=0x501;ISOLATION_AWARE_ENABLED"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\$(OutDir)/$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib subtitlesD.lib subpicD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile=".\VSFilter.def"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\$(OutDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ ImportLibrary=".\$(OutDir)/$(ProjectName).lib"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\$(OutDir)/$(ProjectName).tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG;AFX_RESOURCE_DLL;AFX_TARG_ENU"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ UseOfATL="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="1"
+ WholeProgramOptimization="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ GlobalOptimizations="TRUE"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OptimizeForProcessor="2"
+ OptimizeForWindowsApplication="TRUE"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;WINVER=0x0500;_WIN32_WINNT=0x501;ISOLATION_AWARE_ENABLED"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\$(OutDir)/$(ProjectName).pch"
+ AssemblerOutput="0"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="TRUE"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="delayimp.lib strmbaseRU.lib dsutilRU.lib subtitlesRU.lib subpicRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).dll"
+ Version=""
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile=".\VSFilter.def"
+ DelayLoadDLLs="oleacc.dll"
+ ProgramDatabaseFile=".\$(OutDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ ImportLibrary=".\$(OutDir)/$(ProjectName).lib"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\$(OutDir)/$(ProjectName).tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\..\bin\upx.exe --best --compress-icons=0 &quot;$(TargetPath)&quot;"
+ ExcludedFromBuild="FALSE"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;NDEBUG;AFX_RESOURCE_DLL;AFX_TARG_ENU"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ UseOfATL="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ GlobalOptimizations="TRUE"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OptimizeForProcessor="2"
+ OptimizeForWindowsApplication="TRUE"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;WINVER=0x0500;_WIN32_WINNT=0x501;ISOLATION_AWARE_ENABLED"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\$(OutDir)/$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="FALSE"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="delayimp.lib strmbaseR.lib dsutilR.lib subtitlesR.lib subpicR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).dll"
+ Version=""
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile=".\VSFilter.def"
+ DelayLoadDLLs="oleacc.dll"
+ ProgramDatabaseFile=".\$(OutDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ ImportLibrary=".\$(OutDir)/$(ProjectName).lib"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\$(OutDir)/$(ProjectName).tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="..\..\..\..\bin\upx.exe --best --compress-icons=0 &quot;$(TargetPath)&quot;"
+ ExcludedFromBuild="FALSE"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;NDEBUG;AFX_RESOURCE_DLL;AFX_TARG_ENU"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath="Copy.cpp">
+ </File>
+ <File
+ RelativePath="DirectVobSub.cpp">
+ </File>
+ <File
+ RelativePath=".\DirectVobSubFilter.cpp">
+ </File>
+ <File
+ RelativePath=".\DirectVobSubPropPage.cpp">
+ </File>
+ <File
+ RelativePath="plugins.cpp">
+ </File>
+ <File
+ RelativePath=".\StdAfx.cpp">
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\StdAfx.h">
+ </File>
+ <File
+ RelativePath="StyleEditorDialog.cpp">
+ </File>
+ <File
+ RelativePath=".\systray.cpp">
+ </File>
+ <File
+ RelativePath="TextInputPin.cpp">
+ </File>
+ <File
+ RelativePath="VSFilter.cpp">
+ </File>
+ <File
+ RelativePath=".\VSFilter.def">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ <File
+ RelativePath="DirectVobSub.h">
+ </File>
+ <File
+ RelativePath=".\DirectVobSubFilter.h">
+ </File>
+ <File
+ RelativePath=".\DirectVobSubPropPage.h">
+ </File>
+ <File
+ RelativePath=".\IDirectVobSub.h">
+ </File>
+ <File
+ RelativePath="StyleEditorDialog.h">
+ </File>
+ <File
+ RelativePath=".\systray.h">
+ </File>
+ <File
+ RelativePath="TextInputPin.h">
+ </File>
+ <File
+ RelativePath="VSFilter.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ <File
+ RelativePath="res\Icon_147.ico">
+ </File>
+ <File
+ RelativePath="resource.h">
+ </File>
+ <File
+ RelativePath="res\VSFilter.manifest">
+ </File>
+ <File
+ RelativePath="VSFilter.rc">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/vsfilter/VSFilter_vs2005.sln b/src/filters/transform/vsfilter/VSFilter_vs2005.sln
new file mode 100644
index 000000000..7318a4af1
--- /dev/null
+++ b/src/filters/transform/vsfilter/VSFilter_vs2005.sln
@@ -0,0 +1,200 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VSFilter", "VSFilter_vs2005.vcproj", "{F671100C-469F-4723-AAC4-B7FE4F5B8DC4}"
+ ProjectSection(ProjectDependencies) = postProject
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E} = {7CDC5863-9F36-468D-A634-6D7799E0A15E}
+ {FC70988B-1AE5-4381-866D-4F405E28AC42} = {FC70988B-1AE5-4381-866D-4F405E28AC42}
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4} = {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}
+ {D514EA4D-EAFB-47A9-A437-A582CA571251} = {D514EA4D-EAFB-47A9-A437-A582CA571251}
+ {54DDA60F-E528-4D07-A152-960A1E818680} = {54DDA60F-E528-4D07-A152-960A1E818680}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subpic", "..\..\..\subpic\subpic_vs2005.vcproj", "{D514EA4D-EAFB-47A9-A437-A582CA571251}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitles", "..\..\..\subtitles\subtitles_vs2005.vcproj", "{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}"
+ ProjectSection(ProjectDependencies) = postProject
+ {D514EA4D-EAFB-47A9-A437-A582CA571251} = {D514EA4D-EAFB-47A9-A437-A582CA571251}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dsutil", "..\..\..\dsutil\dsutil_vs2005.vcproj", "{FC70988B-1AE5-4381-866D-4F405E28AC42}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "basevideofilter", "..\basevideofilter\basevideofilter_vs2005.vcproj", "{54DDA60F-E528-4D07-A152-960A1E818680}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baseclasses", "C:\Program Files\Microsoft DirectX 9.0 SDK\Samples\C++\DirectShow\BaseClasses\baseclasses.vcproj", "{7CDC5863-9F36-468D-A634-6D7799E0A15E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug lib|Win32 = Debug lib|Win32
+ Debug lib|Win64 (AMD64) = Debug lib|Win64 (AMD64)
+ Debug Unicode lib|Win32 = Debug Unicode lib|Win32
+ Debug Unicode lib|Win64 (AMD64) = Debug Unicode lib|Win64 (AMD64)
+ Debug Unicode|Win32 = Debug Unicode|Win32
+ Debug Unicode|Win64 (AMD64) = Debug Unicode|Win64 (AMD64)
+ Debug|Win32 = Debug|Win32
+ Debug|Win64 (AMD64) = Debug|Win64 (AMD64)
+ Release lib|Win32 = Release lib|Win32
+ Release lib|Win64 (AMD64) = Release lib|Win64 (AMD64)
+ Release Unicode lib|Win32 = Release Unicode lib|Win32
+ Release Unicode lib|Win64 (AMD64) = Release Unicode lib|Win64 (AMD64)
+ Release Unicode|Win32 = Release Unicode|Win32
+ Release Unicode|Win64 (AMD64) = Release Unicode|Win64 (AMD64)
+ Release|Win32 = Release|Win32
+ Release|Win64 (AMD64) = Release|Win64 (AMD64)
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug lib|Win32.ActiveCfg = Debug|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug lib|Win32.Build.0 = Debug|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode lib|Win32.Build.0 = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug Unicode|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug|Win32.Build.0 = Debug|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Debug|Win64 (AMD64).ActiveCfg = Debug|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release lib|Win32.ActiveCfg = Release|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release lib|Win32.Build.0 = Release|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode lib|Win32.ActiveCfg = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode lib|Win32.Build.0 = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release Unicode|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release|Win32.ActiveCfg = Release|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release|Win32.Build.0 = Release|Win32
+ {F671100C-469F-4723-AAC4-B7FE4F5B8DC4}.Release|Win64 (AMD64).ActiveCfg = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug lib|Win32.ActiveCfg = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug lib|Win32.Build.0 = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode lib|Win32.Build.0 = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug|Win32.Build.0 = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug|Win64 (AMD64).ActiveCfg = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release lib|Win32.ActiveCfg = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release lib|Win32.Build.0 = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode lib|Win32.ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode lib|Win32.Build.0 = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release|Win32.ActiveCfg = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release|Win32.Build.0 = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release|Win64 (AMD64).ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug lib|Win32.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug lib|Win32.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode lib|Win32.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug|Win32.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug|Win64 (AMD64).ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release lib|Win32.ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release lib|Win32.Build.0 = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode lib|Win32.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode lib|Win32.Build.0 = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release|Win32.ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release|Win32.Build.0 = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release|Win64 (AMD64).ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib|Win32.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib|Win32.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib|Win32.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug Unicode|Win64 (AMD64).ActiveCfg = Debug Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug|Win32.Build.0 = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Debug|Win64 (AMD64).ActiveCfg = Debug|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib|Win32.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib|Win32.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib|Win32.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib|Win32.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release Unicode|Win64 (AMD64).ActiveCfg = Release Unicode|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release|Win32.ActiveCfg = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release|Win32.Build.0 = Release|Win32
+ {FC70988B-1AE5-4381-866D-4F405E28AC42}.Release|Win64 (AMD64).ActiveCfg = Release|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug lib|Win32.ActiveCfg = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug lib|Win32.Build.0 = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug lib|Win64 (AMD64).ActiveCfg = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode lib|Win32.Build.0 = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode lib|Win64 (AMD64).ActiveCfg = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|Win32.ActiveCfg = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|Win32.Build.0 = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug Unicode|Win64 (AMD64).ActiveCfg = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug|Win32.ActiveCfg = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug|Win32.Build.0 = Debug lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Debug|Win64 (AMD64).ActiveCfg = Debug Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release lib|Win32.ActiveCfg = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release lib|Win32.Build.0 = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release lib|Win64 (AMD64).ActiveCfg = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode lib|Win32.ActiveCfg = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode lib|Win32.Build.0 = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode lib|Win64 (AMD64).ActiveCfg = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|Win32.ActiveCfg = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|Win32.Build.0 = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release Unicode|Win64 (AMD64).ActiveCfg = Release Unicode lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release|Win32.ActiveCfg = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release|Win32.Build.0 = Release lib|Win32
+ {54DDA60F-E528-4D07-A152-960A1E818680}.Release|Win64 (AMD64).ActiveCfg = Release Unicode lib|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug lib|Win32.ActiveCfg = Debug|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug lib|Win32.Build.0 = Debug|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug lib|Win64 (AMD64).Build.0 = Debug Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug Unicode lib|Win32.ActiveCfg = Debug Unicode|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug Unicode lib|Win64 (AMD64).ActiveCfg = Debug Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug Unicode lib|Win64 (AMD64).Build.0 = Debug Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug Unicode|Win64 (AMD64).ActiveCfg = Debug Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug Unicode|Win64 (AMD64).Build.0 = Debug Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug|Win32.Build.0 = Debug|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug|Win64 (AMD64).ActiveCfg = Debug|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Debug|Win64 (AMD64).Build.0 = Debug|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release lib|Win32.ActiveCfg = Release|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release lib|Win32.Build.0 = Release|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release lib|Win64 (AMD64).Build.0 = Release Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release Unicode lib|Win32.ActiveCfg = Release Unicode|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release Unicode lib|Win32.Build.0 = Release Unicode|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release Unicode lib|Win64 (AMD64).ActiveCfg = Release Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release Unicode lib|Win64 (AMD64).Build.0 = Release Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release Unicode|Win32.Build.0 = Release Unicode|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release Unicode|Win64 (AMD64).ActiveCfg = Release Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release Unicode|Win64 (AMD64).Build.0 = Release Unicode|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release|Win32.ActiveCfg = Release|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release|Win32.Build.0 = Release|Win32
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release|Win64 (AMD64).ActiveCfg = Release|Win64 (AMD64)
+ {7CDC5863-9F36-468D-A634-6D7799E0A15E}.Release|Win64 (AMD64).Build.0 = Release|Win64 (AMD64)
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/filters/transform/vsfilter/VSFilter_vs2005.vcproj b/src/filters/transform/vsfilter/VSFilter_vs2005.vcproj
new file mode 100644
index 000000000..c04be6a32
--- /dev/null
+++ b/src/filters/transform/vsfilter/VSFilter_vs2005.vcproj
@@ -0,0 +1,560 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="VSFilter"
+ ProjectGUID="{F671100C-469F-4723-AAC4-B7FE4F5B8DC4}"
+ RootNamespace="VSFilter"
+ Keyword="AtlProj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\$(OutDir)/$(ProjectName).tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;WINVER=0x0500;_WIN32_WINNT=0x501;ISOLATION_AWARE_ENABLED;"
+ MinimalRebuild="false"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\$(OutDir)/$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG;AFX_RESOURCE_DLL;AFX_TARG_ENU"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="strmbaseDU.lib dsutilDU.lib subtitlesDU.lib subpicDU.lib basevideofilterDU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile=".\VSFilter.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\$(OutDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ ImportLibrary=".\$(OutDir)/$(ProjectName).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\$(OutDir)/$(ProjectName).tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL;WINVER=0x0500;_WIN32_WINNT=0x501;ISOLATION_AWARE_ENABLED;"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\$(OutDir)/$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;_DEBUG;AFX_RESOURCE_DLL;AFX_TARG_ENU"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ RegisterOutput="true"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="strmbaseD.lib dsutilD.lib subtitlesD.lib subpicD.lib basevideofilterD.lib"
+ OutputFile="$(OutDir)/$(ProjectName).dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile=".\VSFilter.def"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\$(OutDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ ImportLibrary=".\$(OutDir)/$(ProjectName).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ UseOfATL="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\$(OutDir)/$(ProjectName).tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;WINVER=0x0500;_WIN32_WINNT=0x501;ISOLATION_AWARE_ENABLED;"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\$(OutDir)/$(ProjectName).pch"
+ AssemblerOutput="0"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="0"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;NDEBUG;AFX_RESOURCE_DLL;AFX_TARG_ENU"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="delayimp.lib strmbaseRU.lib dsutilRU.lib subtitlesRU.lib subpicRU.lib basevideofilterRU.lib"
+ OutputFile="$(OutDir)/$(ProjectName).dll"
+ Version=""
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile=".\VSFilter.def"
+ DelayLoadDLLs="oleacc.dll"
+ ProgramDatabaseFile=".\$(OutDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ ImportLibrary=".\$(OutDir)/$(ProjectName).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine=""
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="2"
+ UseOfMFC="1"
+ UseOfATL="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\$(OutDir)/$(ProjectName).tlb"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL;WINVER=0x0500;_WIN32_WINNT=0x501;ISOLATION_AWARE_ENABLED;"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ ForceConformanceInForLoopScope="true"
+ RuntimeTypeInfo="true"
+ PrecompiledHeaderThrough="stdafx.h"
+ PrecompiledHeaderFile=".\$(OutDir)/$(ProjectName).pch"
+ AssemblerListingLocation=".\$(OutDir)/"
+ ObjectFile=".\$(OutDir)/"
+ ProgramDataBaseFileName=".\$(OutDir)/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DisableSpecificWarnings="4995;4996"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_AFXDLL;NDEBUG;AFX_RESOURCE_DLL;AFX_TARG_ENU"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="/MACHINE:I386"
+ AdditionalDependencies="delayimp.lib strmbaseR.lib dsutilR.lib subtitlesR.lib subpicR.lib basevideofilterR.lib"
+ OutputFile="$(OutDir)/$(ProjectName).dll"
+ Version=""
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ AdditionalLibraryDirectories="..\..\..\..\lib"
+ ModuleDefinitionFile=".\VSFilter.def"
+ DelayLoadDLLs="oleacc.dll"
+ ProgramDatabaseFile=".\$(OutDir)/$(ProjectName).pdb"
+ SubSystem="2"
+ ImportLibrary=".\$(OutDir)/$(ProjectName).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine=""
+ ExcludedFromBuild="false"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="Copy.cpp"
+ >
+ </File>
+ <File
+ RelativePath="DirectVobSub.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\DirectVobSubFilter.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\DirectVobSubPropPage.cpp"
+ >
+ </File>
+ <File
+ RelativePath="plugins.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\StdAfx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\StdAfx.h"
+ >
+ </File>
+ <File
+ RelativePath="StyleEditorDialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\systray.cpp"
+ >
+ </File>
+ <File
+ RelativePath="TextInputPin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="VSFilter.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\VSFilter.def"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="DirectVobSub.h"
+ >
+ </File>
+ <File
+ RelativePath=".\DirectVobSubFilter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\DirectVobSubPropPage.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IDirectVobSub.h"
+ >
+ </File>
+ <File
+ RelativePath="StyleEditorDialog.h"
+ >
+ </File>
+ <File
+ RelativePath=".\systray.h"
+ >
+ </File>
+ <File
+ RelativePath="TextInputPin.h"
+ >
+ </File>
+ <File
+ RelativePath="VSFilter.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="res\Icon_147.ico"
+ >
+ </File>
+ <File
+ RelativePath="resource.h"
+ >
+ </File>
+ <File
+ RelativePath="VSFilter.rc"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/filters/transform/vsfilter/plugins.cpp b/src/filters/transform/vsfilter/plugins.cpp
new file mode 100644
index 000000000..b8cdb2e59
--- /dev/null
+++ b/src/filters/transform/vsfilter/plugins.cpp
@@ -0,0 +1,716 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <afxdlgs.h>
+#include <atlpath.h>
+#include "resource.h"
+#include "..\..\..\subtitles\VobSubFile.h"
+#include "..\..\..\subtitles\RTS.h"
+#include "..\..\..\SubPic\MemSubPic.h"
+
+//
+// Generic interface
+//
+
+namespace Plugin
+{
+
+class CFilter : public CAMThread, public CCritSec
+{
+private:
+ CString m_fn;
+
+protected:
+ float m_fps;
+ CCritSec m_csSubLock;
+ CComPtr<ISubPicQueue> m_pSubPicQueue;
+ CComPtr<ISubPicProvider> m_pSubPicProvider;
+ DWORD_PTR m_SubPicProviderId;
+
+public:
+ CFilter() : m_fps(-1), m_SubPicProviderId(0) {CAMThread::Create();}
+ virtual ~CFilter() {CAMThread::CallWorker(0);}
+
+ CString GetFileName() {CAutoLock cAutoLock(this); return m_fn;}
+ void SetFileName(CString fn) {CAutoLock cAutoLock(this); m_fn = fn;}
+
+ bool Render(SubPicDesc& dst, REFERENCE_TIME rt, float fps)
+ {
+ if(!m_pSubPicProvider)
+ return(false);
+
+ CSize size(dst.w, dst.h);
+
+ if(!m_pSubPicQueue)
+ {
+ CComPtr<ISubPicAllocator> pAllocator = new CMemSubPicAllocator(dst.type, size);
+
+ HRESULT hr;
+ if(!(m_pSubPicQueue = new CSubPicQueueNoThread(pAllocator, &hr)) || FAILED(hr))
+ {
+ m_pSubPicQueue = NULL;
+ return(false);
+ }
+ }
+
+ if(m_SubPicProviderId != (DWORD_PTR)(ISubPicProvider*)m_pSubPicProvider)
+ {
+ m_pSubPicQueue->SetSubPicProvider(m_pSubPicProvider);
+ m_SubPicProviderId = (DWORD_PTR)(ISubPicProvider*)m_pSubPicProvider;
+ }
+
+ CComPtr<ISubPic> pSubPic;
+ if(!m_pSubPicQueue->LookupSubPic(rt, &pSubPic))
+ return(false);
+
+ CRect r;
+ pSubPic->GetDirtyRect(r);
+
+ if(dst.type == MSP_RGB32 || dst.type == MSP_RGB24 || dst.type == MSP_RGB16 || dst.type == MSP_RGB15)
+ dst.h = -dst.h;
+
+ pSubPic->AlphaBlt(r, r, &dst);
+
+ return(true);
+ }
+
+ DWORD ThreadProc()
+ {
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_LOWEST);
+
+ CArray<HANDLE> handles;
+ handles.Add(GetRequestHandle());
+
+ CString fn = GetFileName();
+ CFileStatus fs;
+ fs.m_mtime = 0;
+ CFileGetStatus(fn, fs);
+
+ while(1)
+ {
+ DWORD i = WaitForMultipleObjects(handles.GetSize(), handles.GetData(), FALSE, 1000);
+
+ if(WAIT_OBJECT_0 == i)
+ {
+ Reply(S_OK);
+ break;
+ }
+ else if(WAIT_ABANDONED_0 == i)
+ {
+ break;
+ }
+ else if(WAIT_OBJECT_0 + 1 >= i && i <= WAIT_OBJECT_0 + handles.GetCount())
+ {
+ if(FindNextChangeNotification(handles[i - WAIT_OBJECT_0]))
+ {
+ CFileStatus fs2;
+ fs2.m_mtime = 0;
+ CFileGetStatus(fn, fs2);
+
+ if(fs.m_mtime < fs2.m_mtime)
+ {
+ fs.m_mtime = fs2.m_mtime;
+
+ if(CComQIPtr<ISubStream> pSubStream = m_pSubPicProvider)
+ {
+ CAutoLock cAutoLock(&m_csSubLock);
+ pSubStream->Reload();
+ }
+ }
+ }
+ }
+ else if(WAIT_TIMEOUT == i)
+ {
+ CString fn2 = GetFileName();
+
+ if(fn != fn2)
+ {
+ CPath p(fn2);
+ p.RemoveFileSpec();
+ HANDLE h = FindFirstChangeNotification(p, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
+ if(h != INVALID_HANDLE_VALUE)
+ {
+ fn = fn2;
+ handles.SetSize(1);
+ handles.Add(h);
+ }
+ }
+ }
+ }
+
+ for(int i = 1; i < handles.GetCount(); i++)
+ FindCloseChangeNotification(handles[i]);
+
+ return 0;
+ }
+};
+
+class CVobSubFilter : virtual public CFilter
+{
+public:
+ CVobSubFilter(CString fn = _T(""))
+ {
+ if(!fn.IsEmpty()) Open(fn);
+ }
+
+ bool Open(CString fn)
+ {
+ SetFileName(_T(""));
+ m_pSubPicProvider = NULL;
+
+ if(CVobSubFile* vsf = new CVobSubFile(&m_csSubLock))
+ {
+ m_pSubPicProvider = (ISubPicProvider*)vsf;
+ if(vsf->Open(CString(fn))) SetFileName(fn);
+ else m_pSubPicProvider = NULL;
+ }
+
+ return !!m_pSubPicProvider;
+ }
+};
+
+class CTextSubFilter : virtual public CFilter
+{
+ int m_CharSet;
+
+public:
+ CTextSubFilter(CString fn = _T(""), int CharSet = DEFAULT_CHARSET, float fps = -1)
+ : m_CharSet(CharSet)
+ {
+ m_fps = fps;
+ if(!fn.IsEmpty()) Open(fn, CharSet);
+ }
+
+ int GetCharSet() {return(m_CharSet);}
+
+ bool Open(CString fn, int CharSet = DEFAULT_CHARSET)
+ {
+ SetFileName(_T(""));
+ m_pSubPicProvider = NULL;
+
+ if(CRenderedTextSubtitle* rts = new CRenderedTextSubtitle(&m_csSubLock))
+ {
+ m_pSubPicProvider = (ISubPicProvider*)rts;
+ if(rts->Open(CString(fn), CharSet)) SetFileName(fn);
+ else m_pSubPicProvider = NULL;
+ }
+
+ return !!m_pSubPicProvider;
+ }
+};
+
+//
+// VirtualDub interface
+//
+
+namespace VirtualDub
+{
+ #include "..\..\..\..\include\VirtualDub\VirtualDub.h"
+
+ class CVirtualDubFilter : virtual public CFilter
+ {
+ public:
+ CVirtualDubFilter() {}
+ virtual ~CVirtualDubFilter() {}
+
+ virtual int RunProc(const FilterActivation* fa, const FilterFunctions* ff)
+ {
+ SubPicDesc dst;
+ dst.type = MSP_RGB32;
+ dst.w = fa->src.w;
+ dst.h = fa->src.h;
+ dst.bpp = 32;
+ dst.pitch = fa->src.pitch;
+ dst.bits = (LPVOID)fa->src.data;
+
+ Render(dst, 10000i64*fa->pfsi->lSourceFrameMS, (float)1000 / fa->pfsi->lMicrosecsPerFrame);
+
+ return 0;
+ }
+
+ virtual long ParamProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ fa->dst.offset = fa->src.offset;
+ fa->dst.modulo = fa->src.modulo;
+ fa->dst.pitch = fa->src.pitch;
+
+ return 0;
+ }
+
+ virtual int ConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd) = 0;
+ virtual void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str) = 0;
+ virtual bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen) = 0;
+ };
+
+ class CVobSubVirtualDubFilter : public CVobSubFilter, public CVirtualDubFilter
+ {
+ public:
+ CVobSubVirtualDubFilter(CString fn = _T(""))
+ : CVobSubFilter(fn) {}
+
+ int ConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY,
+ _T("VobSub files (*.idx;*.sub)|*.idx;*.sub||"), CWnd::FromHandle(hwnd), 0);
+
+ if(fd.DoModal() != IDOK) return 1;
+
+ return Open(fd.GetPathName()) ? 0 : 1;
+ }
+
+ void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
+ {
+ sprintf(str, " (%s)", !GetFileName().IsEmpty() ? CStringA(GetFileName()) : " (empty)");
+ }
+
+ bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen)
+ {
+ CStringA fn(GetFileName());
+ fn.Replace("\\", "\\\\");
+ _snprintf(buf, buflen, "Config(\"%s\")", fn);
+ return(true);
+ }
+ };
+
+ class CTextSubVirtualDubFilter : public CTextSubFilter, public CVirtualDubFilter
+ {
+ public:
+ CTextSubVirtualDubFilter(CString fn = _T(""), int CharSet = DEFAULT_CHARSET)
+ : CTextSubFilter(fn, CharSet) {}
+
+ int ConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd)
+ {
+ AFX_MANAGE_STATE(AfxGetStaticModuleState());
+
+ const TCHAR formats[] = _T("TextSub files (*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt)|*.sub;*.srt;*.smi;*.ssa;*.ass;*.xss;*.psb;*.txt||");
+ CFileDialog fd(TRUE, NULL, GetFileName(), OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_ENABLETEMPLATE|OFN_ENABLEHOOK,
+ formats, CWnd::FromHandle(hwnd), OPENFILENAME_SIZE_VERSION_400 /*0*/);
+
+ UINT CALLBACK OpenHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam);
+
+ fd.m_pOFN->hInstance = AfxGetResourceHandle();
+ fd.m_pOFN->lpTemplateName = MAKEINTRESOURCE(IDD_TEXTSUBOPENTEMPLATE);
+ fd.m_pOFN->lpfnHook = OpenHookProc;
+ fd.m_pOFN->lCustData = (LPARAM)DEFAULT_CHARSET;
+
+ if(fd.DoModal() != IDOK) return 1;
+
+ return Open(fd.GetPathName(), fd.m_pOFN->lCustData) ? 0 : 1;
+ }
+
+ void StringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
+ {
+ if(!GetFileName().IsEmpty()) sprintf(str, " (%s, %d)", CStringA(GetFileName()), GetCharSet());
+ else sprintf(str, " (empty)");
+ }
+
+ bool FssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen)
+ {
+ CStringA fn(GetFileName());
+ fn.Replace("\\", "\\\\");
+ _snprintf(buf, buflen, "Config(\"%s\", %d)", fn, GetCharSet());
+ return(true);
+ }
+ };
+
+ int vobsubInitProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ return !(*(CVirtualDubFilter**)fa->filter_data = new CVobSubVirtualDubFilter());
+ }
+
+ int textsubInitProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ return !(*(CVirtualDubFilter**)fa->filter_data = new CTextSubVirtualDubFilter());
+ }
+
+ void baseDeinitProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) delete f, f = NULL;
+ }
+
+ int baseRunProc(const FilterActivation* fa, const FilterFunctions* ff)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->RunProc(fa, ff) : 1;
+ }
+
+ long baseParamProc(FilterActivation* fa, const FilterFunctions* ff)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->ParamProc(fa, ff) : 1;
+ }
+
+ int baseConfigProc(FilterActivation* fa, const FilterFunctions* ff, HWND hwnd)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->ConfigProc(fa, ff, hwnd) : 1;
+ }
+
+ void baseStringProc(const FilterActivation* fa, const FilterFunctions* ff, char* str)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) f->StringProc(fa, ff, str);
+ }
+
+ bool baseFssProc(FilterActivation* fa, const FilterFunctions* ff, char* buf, int buflen)
+ {
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ return f ? f->FssProc(fa, ff, buf, buflen) : false;
+ }
+
+ void vobsubScriptConfig(IScriptInterpreter* isi, void* lpVoid, CScriptValue* argv, int argc)
+ {
+ FilterActivation* fa = (FilterActivation*)lpVoid;
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) delete f;
+ f = new CVobSubVirtualDubFilter(CString(*argv[0].asString()));
+ *(CVirtualDubFilter**)fa->filter_data = f;
+ }
+
+ void textsubScriptConfig(IScriptInterpreter* isi, void* lpVoid, CScriptValue* argv, int argc)
+ {
+ FilterActivation* fa = (FilterActivation*)lpVoid;
+ CVirtualDubFilter* f = *(CVirtualDubFilter**)fa->filter_data;
+ if(f) delete f;
+ f = new CTextSubVirtualDubFilter(CString(*argv[0].asString()), argv[1].asInt());
+ *(CVirtualDubFilter**)fa->filter_data = f;
+ }
+
+ ScriptFunctionDef vobsub_func_defs[]={
+ { (ScriptFunctionPtr)vobsubScriptConfig, "Config", "0s" },
+ { NULL },
+ };
+
+ CScriptObject vobsub_obj={
+ NULL, vobsub_func_defs
+ };
+
+ struct FilterDefinition filterDef_vobsub =
+ {
+ NULL, NULL, NULL, // next, prev, module
+ "VobSub", // name
+ "Adds subtitles from a vob sequence.", // desc
+ "Gabest", // maker
+ NULL, // private_data
+ sizeof(CVirtualDubFilter**), // inst_data_size
+ vobsubInitProc, // initProc
+ baseDeinitProc, // deinitProc
+ baseRunProc, // runProc
+ baseParamProc, // paramProc
+ baseConfigProc, // configProc
+ baseStringProc, // stringProc
+ NULL, // startProc
+ NULL, // endProc
+ &vobsub_obj, // script_obj
+ baseFssProc, // fssProc
+ };
+
+ ScriptFunctionDef textsub_func_defs[]={
+ { (ScriptFunctionPtr)textsubScriptConfig, "Config", "0si" },
+ { NULL },
+ };
+
+ CScriptObject textsub_obj={
+ NULL, textsub_func_defs
+ };
+
+ struct FilterDefinition filterDef_textsub =
+ {
+ NULL, NULL, NULL, // next, prev, module
+ "TextSub", // name
+ "Adds subtitles from srt, sub, psb, smi, ssa, ass file formats.", // desc
+ "Gabest", // maker
+ NULL, // private_data
+ sizeof(CVirtualDubFilter**), // inst_data_size
+ textsubInitProc, // initProc
+ baseDeinitProc, // deinitProc
+ baseRunProc, // runProc
+ baseParamProc, // paramProc
+ baseConfigProc, // configProc
+ baseStringProc, // stringProc
+ NULL, // startProc
+ NULL, // endProc
+ &textsub_obj, // script_obj
+ baseFssProc, // fssProc
+ };
+
+ static FilterDefinition* fd_vobsub;
+ static FilterDefinition* fd_textsub;
+
+ extern "C" __declspec(dllexport) int __cdecl VirtualdubFilterModuleInit2(FilterModule *fm, const FilterFunctions *ff, int& vdfd_ver, int& vdfd_compat)
+ {
+ if(!(fd_vobsub = ff->addFilter(fm, &filterDef_vobsub, sizeof(FilterDefinition)))
+ || !(fd_textsub = ff->addFilter(fm, &filterDef_textsub, sizeof(FilterDefinition))))
+ return 1;
+
+ vdfd_ver = VIRTUALDUB_FILTERDEF_VERSION;
+ vdfd_compat = VIRTUALDUB_FILTERDEF_COMPATIBLE;
+
+ return 0;
+ }
+
+ extern "C" __declspec(dllexport) void __cdecl VirtualdubFilterModuleDeinit(FilterModule *fm, const FilterFunctions *ff)
+ {
+ ff->removeFilter(fd_textsub);
+ ff->removeFilter(fd_vobsub);
+ }
+}
+
+//
+// Avisynth interface
+//
+
+namespace AviSynth1
+{
+ #include "..\..\..\..\include\avisynth\avisynth1.h"
+
+ class CAvisynthFilter : public GenericVideoFilter, virtual public CFilter
+ {
+ public:
+ CAvisynthFilter(PClip c, IScriptEnvironment* env) : GenericVideoFilter(c) {}
+
+ PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env)
+ {
+ PVideoFrame frame = child->GetFrame(n, env);
+
+ env->MakeWritable(&frame);
+
+ SubPicDesc dst;
+ dst.w = vi.width;
+ dst.h = vi.height;
+ dst.pitch = frame->GetPitch();
+ dst.bits = (void**)frame->GetWritePtr();
+ dst.bpp = vi.BitsPerPixel();
+ dst.type =
+ vi.IsRGB32() ? MSP_RGB32 :
+ vi.IsRGB24() ? MSP_RGB24 :
+ vi.IsYUY2() ? MSP_YUY2 :
+ -1;
+
+ float fps = m_fps > 0 ? m_fps : (float)vi.fps_numerator / vi.fps_denominator;
+
+ Render(dst, (REFERENCE_TIME)(10000000i64 * n / fps), fps);
+
+ return(frame);
+ }
+ };
+
+ class CVobSubAvisynthFilter : public CVobSubFilter, public CAvisynthFilter
+ {
+ public:
+ CVobSubAvisynthFilter(PClip c, const char* fn, IScriptEnvironment* env)
+ : CVobSubFilter(CString(fn))
+ , CAvisynthFilter(c, env)
+ {
+ if(!m_pSubPicProvider)
+ env->ThrowError("VobSub: Can't open \"%s\"", fn);
+ }
+ };
+
+ AVSValue __cdecl VobSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CVobSubAvisynthFilter(args[0].AsClip(), args[1].AsString(), env));
+ }
+
+ class CTextSubAvisynthFilter : public CTextSubFilter, public CAvisynthFilter
+ {
+ public:
+ CTextSubAvisynthFilter(PClip c, IScriptEnvironment* env, const char* fn, int CharSet = DEFAULT_CHARSET, float fps = -1)
+ : CTextSubFilter(CString(fn), CharSet, fps)
+ , CAvisynthFilter(c, env)
+ {
+ if(!m_pSubPicProvider)
+ env->ThrowError("TextSub: Can't open \"%s\"", fn);
+ }
+ };
+
+ AVSValue __cdecl TextSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString()));
+ }
+
+ AVSValue __cdecl TextSubCreateSI(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString(), args[2].AsInt()));
+ }
+
+ AVSValue __cdecl TextSubCreateSIF(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString(), args[2].AsInt(), args[3].AsFloat()));
+ }
+
+ extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit(IScriptEnvironment* env)
+ {
+ env->AddFunction("VobSub", "cs", VobSubCreateS, 0);
+ env->AddFunction("TextSub", "cs", TextSubCreateS, 0);
+ env->AddFunction("TextSub", "csi", TextSubCreateSI, 0);
+ env->AddFunction("TextSub", "csif", TextSubCreateSIF, 0);
+ return(NULL);
+ }
+}
+
+namespace AviSynth25
+{
+ #include "..\..\..\..\include\avisynth\avisynth25.h"
+
+ static bool s_fSwapUV = false;
+
+ class CAvisynthFilter : public GenericVideoFilter, virtual public CFilter
+ {
+ public:
+ CAvisynthFilter(PClip c, IScriptEnvironment* env) : GenericVideoFilter(c) {}
+
+ PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env)
+ {
+ PVideoFrame frame = child->GetFrame(n, env);
+
+ env->MakeWritable(&frame);
+
+ SubPicDesc dst;
+ dst.w = vi.width;
+ dst.h = vi.height;
+ dst.pitch = frame->GetPitch();
+ dst.pitchUV = frame->GetPitch(PLANAR_U);
+ dst.bits = (void**)frame->GetWritePtr();
+ dst.bitsU = frame->GetWritePtr(PLANAR_U);
+ dst.bitsV = frame->GetWritePtr(PLANAR_V);
+ dst.bpp = dst.pitch/dst.w*8; //vi.BitsPerPixel();
+ dst.type =
+ vi.IsRGB32() ? MSP_RGB32 :
+ vi.IsRGB24() ? MSP_RGB24 :
+ vi.IsYUY2() ? MSP_YUY2 :
+ /*vi.IsYV12()*/ vi.pixel_type == VideoInfo::CS_YV12 ? (s_fSwapUV?MSP_IYUV:MSP_YV12) :
+ /*vi.IsIYUV()*/ vi.pixel_type == VideoInfo::CS_IYUV ? (s_fSwapUV?MSP_YV12:MSP_IYUV) :
+ -1;
+
+ float fps = m_fps > 0 ? m_fps : (float)vi.fps_numerator / vi.fps_denominator;
+
+ Render(dst, (REFERENCE_TIME)(10000000i64 * n / fps), fps);
+
+ return(frame);
+ }
+ };
+
+ class CVobSubAvisynthFilter : public CVobSubFilter, public CAvisynthFilter
+ {
+ public:
+ CVobSubAvisynthFilter(PClip c, const char* fn, IScriptEnvironment* env)
+ : CVobSubFilter(CString(fn))
+ , CAvisynthFilter(c, env)
+ {
+ if(!m_pSubPicProvider)
+ env->ThrowError("VobSub: Can't open \"%s\"", fn);
+ }
+ };
+
+ AVSValue __cdecl VobSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CVobSubAvisynthFilter(args[0].AsClip(), args[1].AsString(), env));
+ }
+
+ class CTextSubAvisynthFilter : public CTextSubFilter, public CAvisynthFilter
+ {
+ public:
+ CTextSubAvisynthFilter(PClip c, IScriptEnvironment* env, const char* fn, int CharSet = DEFAULT_CHARSET, float fps = -1)
+ : CTextSubFilter(CString(fn), CharSet, fps)
+ , CAvisynthFilter(c, env)
+ {
+ if(!m_pSubPicProvider)
+ env->ThrowError("TextSub: Can't open \"%s\"", fn);
+ }
+ };
+
+ AVSValue __cdecl TextSubCreateS(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString()));
+ }
+
+ AVSValue __cdecl TextSubCreateSI(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString(), args[2].AsInt()));
+ }
+
+ AVSValue __cdecl TextSubCreateSIF(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ return(new CTextSubAvisynthFilter(args[0].AsClip(), env, args[1].AsString(), args[2].AsInt(), args[3].AsFloat()));
+ }
+
+ AVSValue __cdecl TextSubSwapUV(AVSValue args, void* user_data, IScriptEnvironment* env)
+ {
+ s_fSwapUV = args[0].AsBool(false);
+ return(AVSValue());
+ }
+
+ extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env)
+ {
+ env->AddFunction("VobSub", "cs", VobSubCreateS, 0);
+ env->AddFunction("TextSub", "cs", TextSubCreateS, 0);
+ env->AddFunction("TextSub", "csi", TextSubCreateSI, 0);
+ env->AddFunction("TextSub", "csif", TextSubCreateSIF, 0);
+ env->AddFunction("TextSubSwapUV", "b", TextSubSwapUV, 0);
+ return(NULL);
+ }
+}
+
+}
+
+UINT CALLBACK OpenHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch(uiMsg)
+ {
+ case WM_NOTIFY:
+ {
+ OPENFILENAME* ofn = ((OFNOTIFY *)lParam)->lpOFN;
+
+ if(((NMHDR *)lParam)->code == CDN_FILEOK)
+ {
+ ofn->lCustData = (LPARAM)CharSetList[SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_GETCURSEL, 0, 0)];
+ }
+
+ break;
+ }
+
+ case WM_INITDIALOG:
+ {
+ SetWindowLong(hDlg, GWL_USERDATA, lParam);
+
+ for(int i = 0; i < CharSetLen; i++)
+ {
+ CString s;
+ s.Format(_T("%s (%d)"), CharSetNames[i], CharSetList[i]);
+ SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_ADDSTRING, 0, (LONG)(LPCTSTR)s);
+ if(CharSetList[i] == (int)((OPENFILENAME*)lParam)->lCustData)
+ SendMessage(GetDlgItem(hDlg, IDC_COMBO1), CB_SETCURSEL, i, 0);
+ }
+
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
diff --git a/src/filters/transform/vsfilter/res/Icon_147.ico b/src/filters/transform/vsfilter/res/Icon_147.ico
new file mode 100644
index 000000000..4414c25de
--- /dev/null
+++ b/src/filters/transform/vsfilter/res/Icon_147.ico
Binary files differ
diff --git a/src/filters/transform/vsfilter/res/VSFilter.manifest b/src/filters/transform/vsfilter/res/VSFilter.manifest
new file mode 100644
index 000000000..5b178847f
--- /dev/null
+++ b/src/filters/transform/vsfilter/res/VSFilter.manifest
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<!--assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="X86"
+ name="Gabest.VobSub.Filter"
+ type="win32"
+/-->
+<description>DirectVobSub</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="X86"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+</assembly>
+
diff --git a/src/filters/transform/vsfilter/resource.h b/src/filters/transform/vsfilter/resource.h
new file mode 100644
index 000000000..29bdcd885
--- /dev/null
+++ b/src/filters/transform/vsfilter/resource.h
@@ -0,0 +1,183 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by VSFilter.rc
+//
+#define IDS_PROJNAME 100
+#define IDD_DVSPATHSPAGE 101
+#define IDS_PROJNAME2 102
+#define IDS_DIVX_WARNING 103
+#define IDD_DVSABOUTPAGE 104
+#define IDS_R_TEXT 105
+#define IDS_R_VOBSUB 106
+#define IDS_R_DEFTEXTPATHES 107
+#define IDS_R_PREFLANGS 108
+#define IDS_RG_SAVEFULLPATH 109
+#define IDS_RG_EXTPIC 110
+#define IDS_RG_MOD32FIX 111
+#define IDS_RG_LOADLEVEL 112
+#define IDS_RG_INSTANTUPDATE 113
+#define IDS_RG_FLIPPICTURE 114
+#define IDS_RG_HIDE 115
+#define IDS_RG_NOYUY2COLORS 116
+#define IDS_RG_DOPREBUFFERING 117
+#define IDS_RG_SHOWOSDSTATS 118
+#define IDS_RG_SEENDIVXWARNING 119
+#define IDS_RG_RESX2 120
+#define IDS_RG_RESX2MINW 121
+#define IDS_RG_RESX2MINH 122
+#define IDS_RTM_MEDIAFPS 123
+#define IDS_RT_SHADOW 124
+#define IDS_RT_OUTLINE 125
+#define IDS_RT_LOGFONT 126
+#define IDS_RT_COLOR 127
+#define IDS_RT_OVERRIDEPLACEMENT 128
+#define IDS_RT_XPERC 129
+#define IDS_RT_YPERC 130
+#define IDS_RV_BUFFER 131
+#define IDS_RP_PATH 132
+#define IDS_RL_LANG 133
+#define IDS_M_SHOWSUBTITLES 134
+#define IDS_M_HIDESUBTITLES 135
+#define IDS_M_ORIGINALPICTURE 136
+#define IDS_M_FLIPPEDPICTURE 137
+#define IDS_RV_POLYGONIZE 138
+#define IDS_RG_EXTERNALLOAD 139
+#define IDS_RG_WEBLOAD 140
+#define IDS_RG_EMBEDDEDLOAD 141
+#define IDS_URL_HOMEPAGE 142
+#define IDS_URL_EMAIL 143
+#define IDS_R_TIMING 144
+#define IDS_RTM_SUBTITLEDELAY 145
+#define IDS_RTM_SUBTITLESPEEDMUL 146
+#define IDS_RT_ADVANCEDRENDERER 147
+#define IDS_RV_ONLYSHOWFORCEDSUBS 148
+#define IDS_ORGHEIGHT 149
+#define IDS_RG_VMRZOOMENABLED 150
+#define IDS_RTM_SUBTITLESPEEDDIV 151
+#define IDS_RG_COLORFORMATS 152
+#define IDS_EXTTO169 153
+#define IDS_RG_FORCERGB 154
+#define IDS_RG_ENABLEZPICON 155
+#define IDS_RG_FLIPSUBTITLES 156
+#define IDS_RTM_MEDIAFPSENABLED 157
+#define IDS_RG_DISABLERELOADER 158
+#define IDS_EXTTO43 159
+#define IDS_CROPTO169 160
+#define IDS_CROPTO43 161
+#define IDS_ORGRES 162
+#define IDS_DBLRES 163
+#define IDS_DBLRESIF 164
+#define IDS_DONOTLOAD 165
+#define IDS_LOADWHENNEEDED 166
+#define IDS_ALWAYSLOAD 167
+#define IDS_EXTTO576 168
+#define IDS_EXTTO480 169
+#define IDC_FILENAME 201
+#define IDD_DVSMAINPAGE 201
+#define IDC_OPEN 202
+#define IDC_HOMEPAGEBTN 202
+#define IDD_DVSZOOMPAGE 202
+#define IDC_FLIP 203
+#define IDC_HIDE 204
+#define IDC_FLIPSUB 205
+#define IDC_CACHESUB 206
+#define IDC_ONLYSHOWFORCEDSUBS 207
+#define IDC_POLYGONIZE 208
+#define IDC_FONT 212
+#define IDC_BUGREPORTBTN 212
+#define IDC_CONFIGDLG 213
+#define IDC_SHADOW 214
+#define IDI_ICON1 214
+#define IDC_LANGCOMBO 215
+#define IDD_DVSCOLORPAGE 218
+#define IDC_OUTLINE 220
+#define IDD_DVSGENERALPAGE 220
+#define IDC_MOD32FIX 221
+#define IDD_DVSTIMINGPAGE 221
+#define IDD_DVSMISCPAGE 222
+#define IDC_PREBUFFERING 223
+#define IDS_R_GENERAL 223
+#define IDC_EMBLOAD 224
+#define IDS_RT_STYLE 224
+#define IDC_SHOWOSDSTATS 225
+#define IDC_OVERRIDEPLACEMENT 226
+#define IDC_EDIT1 228
+#define IDC_EDIT2 229
+#define IDC_EDIT7 230
+#define IDC_AUTORELOAD 230
+#define IDD_TEXTSUBOPENTEMPLATE 230
+#define IDC_SPIN1 231
+#define IDC_SPIN2 232
+#define IDC_SPIN7 233
+#define IDC_MODFPS 233
+#define IDC_EDIT8 234
+#define IDC_ADVANCEDRENDERER 234
+#define IDC_SPIN8 235
+#define IDC_EXTLOAD 235
+#define IDC_WEBLOAD 236
+#define IDC_EDIT3 238
+#define IDC_SPIN3 239
+#define IDC_EDIT4 240
+#define IDD_STYLEDIALOG 240
+#define IDC_SPIN4 241
+#define IDC_EDIT5 242
+#define IDC_SPIN5 243
+#define IDC_EDIT6 244
+#define IDC_SPIN6 245
+#define IDC_EDIT9 246
+#define IDC_SPIN9 247
+#define IDC_PREFLIST 257
+#define IDC_DYNCHGLIST 259
+#define IDC_COLORUP 261
+#define IDC_COLORDOWN 262
+#define IDC_COLORCHANGE 263
+#define IDC_DYNCHGWARNING 266
+#define IDC_DYNCHGWARNING2 268
+#define IDC_FORCERGBCHK 269
+#define IDC_RESX2COMBO 290
+#define IDC_VEREXTCOMBO 298
+#define IDC_LOADCOMBO 299
+#define IDC_FPS 300
+#define IDC_SAVEFULLPATH 303
+#define IDC_INSTANTUPDATE 305
+#define IDC_PATHLIST 307
+#define IDC_ADD 308
+#define IDC_REMOVE 309
+#define IDC_BROWSE 310
+#define IDC_PATHEDIT 311
+#define IDC_COMBO1 312
+#define IDC_SLIDER2 1020
+#define IDC_SLIDER3 1021
+#define IDC_RADIO1 1022
+#define IDC_RADIO2 1023
+#define IDC_CHECK1 1025
+#define IDC_BUTTON1 1037
+#define IDC_EDIT10 1042
+#define IDC_RADIO3 1044
+#define IDC_RADIO4 1045
+#define IDC_RADIO5 1046
+#define IDC_RADIO6 1047
+#define IDC_SLIDER5 1048
+#define IDC_SLIDER6 1049
+#define IDC_EDIT11 1050
+#define IDC_SPIN10 1051
+#define IDC_RADIO7 1056
+#define IDC_RADIO8 1057
+#define IDC_RADIO9 1058
+#define IDC_RADIO10 1059
+#define IDC_RADIO11 1060
+#define IDC_COLORPRI 1063
+#define IDC_COLORSEC 1064
+#define IDC_COLOROUTL 1065
+#define IDC_COLORSHAD 1066
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 231
+#define _APS_NEXT_COMMAND_VALUE 32770
+#define _APS_NEXT_CONTROL_VALUE 313
+#define _APS_NEXT_SYMED_VALUE 103
+#endif
+#endif
diff --git a/src/filters/transform/vsfilter/valami.cpp b/src/filters/transform/vsfilter/valami.cpp
new file mode 100644
index 000000000..b2115e6f7
--- /dev/null
+++ b/src/filters/transform/vsfilter/valami.cpp
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "..\..\..\DSUtil\DSUtil.h"
+
+static TCHAR str1[][256] =
+/*
+{
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9D2935C7-3D8B-4EF6-B0D1-C14064698794}"), // divxg400
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{8CE3343E-2289-4BAE-AE57-5106A40AF552}"), // divxg400force
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{00A95963-3BE5-48C0-AD9F-3356D67EA09D}"), // ogg sub mixer
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{70E102B0-5556-11CE-97C0-00AA0055595A}"), // video renderer (old)
+ _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{6BC1CFFA-8FC1-4261-AC22-CFB4CC38DB50}"), // video renderer (vmr)
+};
+*/
+{
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x2b,
+ 0x56, 0x20, 0x2b, 0x21, 0x27, 0x51, 0x25, 0x3f,
+ 0x21, 0x56, 0x2a, 0x50, 0x3f, 0x26, 0x57, 0x54,
+ 0x24, 0x3f, 0x50, 0x22, 0x56, 0x23, 0x3f, 0x51,
+ 0x23, 0x26, 0x22, 0x24, 0x26, 0x24, 0x2b, 0x2a,
+ 0x25, 0x2b, 0x26, 0x6f, 0x12
+ },
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x2a,
+ 0x51, 0x57, 0x21, 0x21, 0x26, 0x21, 0x57, 0x3f,
+ 0x20, 0x20, 0x2a, 0x2b, 0x3f, 0x26, 0x50, 0x53,
+ 0x57, 0x3f, 0x53, 0x57, 0x27, 0x25, 0x3f, 0x27,
+ 0x23, 0x22, 0x24, 0x53, 0x26, 0x22, 0x53, 0x54,
+ 0x27, 0x27, 0x20, 0x6f, 0x12
+ },
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x22,
+ 0x22, 0x53, 0x2b, 0x27, 0x2b, 0x24, 0x21, 0x3f,
+ 0x21, 0x50, 0x57, 0x27, 0x3f, 0x26, 0x2a, 0x51,
+ 0x22, 0x3f, 0x53, 0x56, 0x2b, 0x54, 0x3f, 0x21,
+ 0x21, 0x27, 0x24, 0x56, 0x24, 0x25, 0x57, 0x53,
+ 0x22, 0x2b, 0x56, 0x6f, 0x12
+ },
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x25,
+ 0x22, 0x57, 0x23, 0x22, 0x20, 0x50, 0x22, 0x3f,
+ 0x27, 0x27, 0x27, 0x24, 0x3f, 0x23, 0x23, 0x51,
+ 0x57, 0x3f, 0x2b, 0x25, 0x51, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x53, 0x22, 0x22, 0x27, 0x27, 0x27,
+ 0x2b, 0x27, 0x53, 0x6f, 0x12
+ },
+ {
+ 0x51, 0x5e, 0x41, 0x5b, 0x56, 0x4e, 0x69, 0x22,
+ 0x2a, 0x21, 0x2a, 0x24, 0x21, 0x54, 0x23, 0x3f,
+ 0x25, 0x22, 0x56, 0x57, 0x3f, 0x23, 0x23, 0x76,
+ 0x22, 0x3f, 0x50, 0x56, 0x26, 0x22, 0x3f, 0x22,
+ 0x22, 0x53, 0x22, 0x51, 0x2b, 0x23, 0x23, 0x51,
+ 0x57, 0x2a, 0x24, 0x6f, 0x4e, 0x5b, 0x7c, 0x61,
+ 0x66, 0x73, 0x7c, 0x71, 0x77, 0x4e, 0x69, 0x24,
+ 0x50, 0x51, 0x23, 0x51, 0x54, 0x54, 0x53, 0x3f,
+ 0x2a, 0x54, 0x51, 0x23, 0x3f, 0x26, 0x20, 0x24,
+ 0x23, 0x3f, 0x53, 0x51, 0x20, 0x20, 0x3f, 0x51,
+ 0x54, 0x50, 0x26, 0x51, 0x51, 0x21, 0x2a, 0x56,
+ 0x50, 0x27, 0x22, 0x6f, 0x12
+ },
+};
+
+static TCHAR str2[] = // _T("FilterData");
+{
+ 0x72, 0x5d, 0x58, 0x40, 0x51, 0x46, 0x70, 0x55,
+ 0x40, 0x55, 0x34,
+};
+
+static TCHAR str3[] = // _T("FriendlyName");
+{
+ 0x10, 0x24, 0x3f, 0x33, 0x38, 0x32, 0x3a, 0x2f,
+ 0x18, 0x37, 0x3b, 0x33, 0x56,
+};
+
+
+#define LEN1 (countof(str1))
+#define LEN11 (countof(str1[0]))
+#define LEN2 (countof(str2))
+#define LEN3 (countof(str3))
+
+static void dencode()
+{
+ int i, j;
+ for(i = 0; i < LEN1; i++) for(j = 0; j < LEN11; j++) str1[i][j] ^= 0x12;
+ for(i = 0; i < LEN2; i++) str2[i] ^= 0x34;
+ for(i = 0; i < LEN3; i++) str3[i] ^= 0x56;
+}
+
+extern /*const*/ AMOVIESETUP_FILTER sudFilter[2];
+
+void JajDeGonoszVagyok()
+{
+ dencode();
+
+ DWORD mymerit = sudFilter[1].dwMerit;
+
+ for(int i = 0; i < LEN1; i++)
+ {
+ HKEY hKey;
+
+ if(RegOpenKeyEx(HKEY_CLASSES_ROOT, str1[i], 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+ {
+ BYTE* pData = NULL;
+ DWORD size = 0;
+
+ if(RegQueryValueEx(hKey, str2, 0, NULL, NULL, &size) == ERROR_SUCCESS)
+ {
+ pData = new BYTE[size];
+
+ if(pData && RegQueryValueEx(hKey, str2, 0, NULL, pData, &size) == ERROR_SUCCESS)
+ {
+ DWORD merit = *((DWORD*)(pData+4));
+
+ if(merit < 0xffffffff) merit++;
+
+ if(mymerit < merit)
+ mymerit = merit;
+ }
+
+ if(pData) delete [] pData;
+ }
+
+ RegCloseKey(hKey);
+ }
+ }
+
+ if(mymerit > sudFilter[1].dwMerit)
+ {
+/*
+ CString myguid = _T("CLSID\\{083863F1-70DE-11d0-BD40-00A0C911CE86}\\Instance\\{9852A670-F845-491b-9BE6-EBD841B8A613}");
+
+ HKEY hKey;
+
+ if(RegOpenKeyEx(HKEY_CLASSES_ROOT, myguid, 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
+ {
+ BYTE* pData = NULL;
+ DWORD size = 0;
+
+ if(RegQueryValueEx(hKey, str2, 0, NULL, NULL, &size) == ERROR_SUCCESS)
+ {
+ pData = new BYTE[size];
+
+ if(pData && RegQueryValueEx(hKey, str2, 0, NULL, pData, &size) == ERROR_SUCCESS)
+ {
+ *((DWORD*)(pData+4)) = mymerit;
+ if(RegSetValueEx(hKey, str2, 0, REG_BINARY, pData, size) != ERROR_SUCCESS)
+ {
+ int i = 0;
+ }
+ }
+
+ if(pData) delete [] pData;
+ }
+
+ RegCloseKey(hKey);
+ }
+*/
+ sudFilter[1].dwMerit = mymerit;
+ }
+
+ dencode();
+}
+
+bool HmGyanusVagyTeNekem(IPin* pPin)
+{
+ dencode();
+
+ pPin->AddRef();
+
+ bool fFail = false;
+
+ for(int i = 0; i < 3 && !fFail; i++)
+ {
+ BYTE* pData = NULL;
+ DWORD size = 0;
+
+ HKEY hKey;
+
+ if(RegOpenKeyEx(HKEY_CLASSES_ROOT, str1[i], 0, KEY_READ, &hKey) == ERROR_SUCCESS)
+ {
+ if(RegQueryValueEx(hKey, str3, 0, NULL, NULL, &size) == ERROR_SUCCESS)
+ {
+ pData = new BYTE[size];
+
+ if(pData)
+ {
+ if(RegQueryValueEx(hKey, str3, 0, NULL, pData, &size) != ERROR_SUCCESS)
+ {
+ delete [] pData;
+ pData = NULL;
+ }
+ }
+ }
+
+ RegCloseKey(hKey);
+ }
+
+ if(pData)
+ {
+ CPinInfo pi;
+ if(SUCCEEDED(pPin->QueryPinInfo(&pi)) && pi.pFilter)
+ {
+ CFilterInfo fi;
+ if(SUCCEEDED(pi.pFilter->QueryFilterInfo(&fi))
+ && !wcsncmp((WCHAR*)pData, fi.achName, wcslen((WCHAR*)pData)))
+ fFail = true;
+ }
+
+ delete [] pData;
+ }
+ }
+
+ pPin->Release();
+
+ dencode();
+
+ return(fFail);
+} \ No newline at end of file
diff --git a/src/subpic/CoordGeom.cpp b/src/subpic/CoordGeom.cpp
new file mode 100644
index 000000000..7df30f8c8
--- /dev/null
+++ b/src/subpic/CoordGeom.cpp
@@ -0,0 +1,520 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <math.h>
+#include "CoordGeom.h"
+
+#define EPSILON (1e-7)
+#define BIGNUMBER (1e+9)
+#define IsZero(d) (fabs(d) < EPSILON)
+
+//
+// Vector
+//
+
+Vector::Vector(float x, float y, float z)
+{
+ this->x = x;
+ this->y = y;
+ this->z = z;
+}
+
+void Vector::Set(float x, float y, float z)
+{
+ this->x = x;
+ this->y = y;
+ this->z = z;
+}
+
+float Vector::Length()
+{
+ return(sqrt(x * x + y * y + z * z));
+}
+
+float Vector::Sum()
+{
+ return(x + y + z);
+}
+
+float Vector::CrossSum()
+{
+ return(x*y + x*z + y*z);
+}
+
+Vector Vector::Cross()
+{
+ return(Vector(x*y, x*z, y*z));
+}
+
+Vector Vector::Pow(float exp)
+{
+ return(exp == 0 ? Vector(1, 1, 1) : exp == 1 ? *this : Vector(pow(x, exp), pow(y, exp), pow(z, exp)));
+}
+
+Vector Vector::Unit()
+{
+ float l = Length();
+ if(!l || l == 1) return(*this);
+ return(*this * (1 / l));
+}
+
+Vector& Vector::Unitalize()
+{
+ return(*this = Unit());
+}
+
+Vector Vector::Normal(Vector& a, Vector& b)
+{
+ return((a - *this) % (b - a));
+}
+
+float Vector::Angle(Vector& a, Vector& b)
+{
+ return(((a - *this).Unit()).Angle((b - *this).Unit()));
+}
+
+float Vector::Angle(Vector& a)
+{
+ float angle = *this | a;
+ return((angle > 1) ? 0 : (angle < -1) ? PI : acos(angle));
+}
+
+void Vector::Angle(float& u, float& v)
+{
+ Vector n = Unit();
+
+ u = asin(n.y);
+
+ if(IsZero(n.z)) v = PI/2 * Sgn(n.x);
+ else if(n.z > 0) v = atan(n.x / n.z);
+ else if(n.z < 0) v = IsZero(n.x) ? PI : (PI * Sgn(n.x) + atan(n.x / n.z));
+}
+
+Vector Vector::Angle()
+{
+ Vector ret;
+ Angle(ret.x, ret.y);
+ ret.z = 0;
+ return(ret);
+}
+
+Vector& Vector::Min(Vector& a)
+{
+ x = (x < a.x) ? x : a.x;
+ y = (y < a.y) ? y : a.y;
+ z = (z < a.z) ? z : a.z;
+ return(*this);
+}
+
+Vector& Vector::Max(Vector& a)
+{
+ x = (x > a.x) ? x : a.x;
+ y = (y > a.y) ? y : a.y;
+ z = (z > a.z) ? z : a.z;
+ return(*this);
+}
+
+Vector Vector::Abs()
+{
+ return(Vector(fabs(x), fabs(y), fabs(z)));
+}
+
+Vector Vector::Reflect(Vector& n)
+{
+ return(n * ((-*this) | n) * 2 - (-*this));
+}
+
+Vector Vector::Refract(Vector& N, float nFront, float nBack, float* nOut)
+{
+ Vector D = -*this;
+
+ float N_dot_D = (N | D);
+ float n = N_dot_D >= 0 ? (nFront / nBack) : (nBack / nFront);
+
+ Vector cos_D = N * N_dot_D;
+ Vector sin_T = (cos_D - D) * n;
+
+ float len_sin_T = sin_T | sin_T;
+
+ if(len_sin_T > 1)
+ {
+ if(nOut) {*nOut = N_dot_D >= 0 ? nFront : nBack;}
+ return((*this).Reflect(N));
+ }
+
+ float N_dot_T = sqrt(1.0 - len_sin_T);
+ if(N_dot_D < 0) N_dot_T = -N_dot_T;
+
+ if(nOut) {*nOut = N_dot_D >= 0 ? nBack : nFront;}
+
+ return(sin_T - (N * N_dot_T));
+}
+
+Vector Vector::Refract2(Vector& N, float nFrom, float nTo, float* nOut)
+{
+ Vector D = -*this;
+
+ float N_dot_D = (N | D);
+ float n = nFrom / nTo;
+
+ Vector cos_D = N * N_dot_D;
+ Vector sin_T = (cos_D - D) * n;
+
+ float len_sin_T = sin_T | sin_T;
+
+ if(len_sin_T > 1)
+ {
+ if(nOut) {*nOut = nFrom;}
+ return((*this).Reflect(N));
+ }
+
+ float N_dot_T = sqrt(1.0 - len_sin_T);
+ if(N_dot_D < 0) N_dot_T = -N_dot_T;
+
+ if(nOut) {*nOut = nTo;}
+
+ return(sin_T - (N * N_dot_T));
+}
+
+float Vector::operator | (Vector& v)
+{
+ return(x * v.x + y * v.y + z * v.z);
+}
+
+Vector Vector::operator % (Vector& v)
+{
+ return(Vector(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x));
+}
+
+float& Vector::operator [] (int i)
+{
+ return(!i ? x : (i == 1) ? y : z);
+}
+
+Vector Vector::operator - ()
+{
+ return(Vector(-x, -y, -z));
+}
+
+bool Vector::operator == (const Vector& v) const
+{
+ if(IsZero(x - v.x) && IsZero(y - v.y) && IsZero(z - v.z)) return(true);
+ return(false);
+}
+
+bool Vector::operator != (const Vector& v) const
+{
+ return((*this == v) ? false : true);
+}
+
+Vector Vector::operator + (float d)
+{
+ return(Vector(x + d, y + d, z + d));
+}
+
+Vector Vector::operator + (Vector& v)
+{
+ return(Vector(x + v.x, y + v.y, z + v.z));
+}
+
+Vector Vector::operator - (float d)
+{
+ return(Vector(x - d, y - d, z - d));
+}
+
+Vector Vector::operator - (Vector& v)
+{
+ return(Vector(x - v.x, y - v.y, z - v.z));
+}
+
+Vector Vector::operator * (float d)
+{
+ return(Vector(x * d, y * d, z * d));
+}
+
+Vector Vector::operator * (Vector& v)
+{
+ return(Vector(x * v.x, y * v.y, z * v.z));
+}
+
+Vector Vector::operator / (float d)
+{
+ return(Vector(x / d, y / d, z / d));
+}
+
+Vector Vector::operator / (Vector& v)
+{
+ return(Vector(x / v.x, y / v.y, z / v.z));
+}
+
+Vector& Vector::operator += (float d)
+{
+ x += d; y += d; z += d;
+ return(*this);
+}
+
+Vector& Vector::operator += (Vector& v)
+{
+ x += v.x; y += v.y; z += v.z;
+ return(*this);
+}
+
+Vector& Vector::operator -= (float d)
+{
+ x -= d; y -= d; z -= d;
+ return(*this);
+}
+
+Vector& Vector::operator -= (Vector& v)
+{
+ x -= v.x; y -= v.y; z -= v.z;
+ return(*this);
+}
+
+Vector& Vector::operator *= (float d)
+{
+ x *= d; y *= d; z *= d;
+ return(*this);
+}
+
+Vector& Vector::operator *= (Vector& v)
+{
+ x *= v.x; y *= v.y; z *= v.z;
+ return(*this);
+}
+
+Vector& Vector::operator /= (float d)
+{
+ x /= d; y /= d; z /= d;
+ return(*this);
+}
+
+Vector& Vector::operator /= (Vector& v)
+{
+ x /= v.x; y /= v.y; z /= v.z;
+ return(*this);
+}
+
+//
+// Ray
+//
+
+Ray::Ray(Vector& p, Vector& d)
+{
+ this->p = p;
+ this->d = d;
+}
+
+void Ray::Set(Vector& p, Vector& d)
+{
+ this->p = p;
+ this->d = d;
+}
+
+float Ray::GetDistanceFrom(Ray& r)
+{
+ float t = (d | r.d);
+ if(IsZero(t)) return(-BIGNUMBER); // plane is paralell to the ray, return -infinite
+ return(((r.p - p) | r.d) / t);
+}
+
+float Ray::GetDistanceFrom(Vector& v)
+{
+ float t = ((v - p) | d) / (d | d);
+ return(((p + d*t) - v).Length());
+}
+
+Vector Ray::operator [] (float t)
+{
+ return(p + d*t);
+}
+
+//
+// XForm
+//
+
+XForm::XForm(Ray& r, Vector& s, bool isWorldToLocal)
+{
+ Initalize(r, s, isWorldToLocal);
+}
+
+void XForm::Initalize()
+{
+ m.Initalize();
+}
+
+void XForm::Initalize(Ray& r, Vector& s, bool isWorldToLocal)
+{
+ Initalize();
+
+ if(m_isWorldToLocal = isWorldToLocal)
+ {
+ *this -= r.p;
+ *this >>= r.d;
+ *this /= s;
+
+ }
+ else
+ {
+ *this *= s;
+ *this <<= r.d;
+ *this += r.p;
+ }
+}
+
+void XForm::operator *= (Vector& v)
+{
+ Matrix s;
+ s.mat[0][0] = v.x;
+ s.mat[1][1] = v.y;
+ s.mat[2][2] = v.z;
+ m *= s;
+}
+
+void XForm::operator += (Vector& v)
+{
+ Matrix t;
+ t.mat[3][0] = v.x;
+ t.mat[3][1] = v.y;
+ t.mat[3][2] = v.z;
+ m *= t;
+}
+
+void XForm::operator <<= (Vector& v)
+{
+ Matrix x;
+ x.mat[1][1] = cos(v.x); x.mat[1][2] = -sin(v.x);
+ x.mat[2][1] = sin(v.x); x.mat[2][2] = cos(v.x);
+
+ Matrix y;
+ y.mat[0][0] = cos(v.y); y.mat[0][2] = -sin(v.y);
+ y.mat[2][0] = sin(v.y); y.mat[2][2] = cos(v.y);
+
+ Matrix z;
+ z.mat[0][0] = cos(v.z); z.mat[0][1] = -sin(v.z);
+ z.mat[1][0] = sin(v.z); z.mat[1][1] = cos(v.z);
+
+ m = m_isWorldToLocal ? (m * y * x * z) : (m * z * x * y);
+}
+
+void XForm::operator /= (Vector& v)
+{
+ Vector s;
+ s.x = IsZero(v.x) ? 0 : 1 / v.x;
+ s.y = IsZero(v.y) ? 0 : 1 / v.y;
+ s.z = IsZero(v.z) ? 0 : 1 / v.z;
+ *this *= s;
+}
+
+void XForm::operator -= (Vector& v)
+{
+ *this += -v;
+}
+
+void XForm::operator >>= (Vector& v)
+{
+ *this <<= -v;
+}
+
+Vector XForm::operator < (Vector& n)
+{
+ Vector ret;
+
+ ret.x = n.x * m.mat[0][0] +
+ n.y * m.mat[1][0] +
+ n.z * m.mat[2][0];
+ ret.y = n.x * m.mat[0][1] +
+ n.y * m.mat[1][1] +
+ n.z * m.mat[2][1];
+ ret.z = n.x * m.mat[0][2] +
+ n.y * m.mat[1][2] +
+ n.z * m.mat[2][2];
+
+ return(ret);
+}
+
+Vector XForm::operator << (Vector& v)
+{
+ Vector ret;
+
+ ret.x = v.x * m.mat[0][0] +
+ v.y * m.mat[1][0] +
+ v.z * m.mat[2][0] +
+ m.mat[3][0];
+ ret.y = v.x * m.mat[0][1] +
+ v.y * m.mat[1][1] +
+ v.z * m.mat[2][1] +
+ m.mat[3][1];
+ ret.z = v.x * m.mat[0][2] +
+ v.y * m.mat[1][2] +
+ v.z * m.mat[2][2] +
+ m.mat[3][2];
+
+ return(ret);
+}
+
+Ray XForm::operator << (Ray& r)
+{
+ return(Ray(*this << r.p, *this < r.d));
+}
+
+//
+// XForm::Matrix
+//
+
+XForm::Matrix::Matrix()
+{
+ Initalize();
+}
+
+void XForm::Matrix::Initalize()
+{
+ mat[0][0] = 1; mat[0][1] = 0; mat[0][2] = 0; mat[0][3] = 0;
+ mat[1][0] = 0; mat[1][1] = 1; mat[1][2] = 0; mat[1][3] = 0;
+ mat[2][0] = 0; mat[2][1] = 0; mat[2][2] = 1; mat[2][3] = 0;
+ mat[3][0] = 0; mat[3][1] = 0; mat[3][2] = 0; mat[3][3] = 1;
+}
+
+XForm::Matrix XForm::Matrix::operator * (Matrix& m)
+{
+ Matrix ret;
+
+ for(int i = 0; i < 4; i++)
+ {
+ for(int j = 0; j < 4; j++)
+ {
+ ret.mat[i][j] = mat[i][0] * m.mat[0][j] +
+ mat[i][1] * m.mat[1][j] +
+ mat[i][2] * m.mat[2][j] +
+ mat[i][3] * m.mat[3][j];
+
+ if(IsZero(ret.mat[i][j])) ret.mat[i][j] = 0;
+ }
+ }
+
+ return(ret);
+}
+
+XForm::Matrix& XForm::Matrix::operator *= (XForm::Matrix& m)
+{
+ return(*this = *this * m);
+}
diff --git a/src/subpic/CoordGeom.h b/src/subpic/CoordGeom.h
new file mode 100644
index 000000000..4084d8b25
--- /dev/null
+++ b/src/subpic/CoordGeom.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#ifndef PI
+#define PI (3.141592654f)
+#endif
+
+#define DegToRad(d) ((d)*PI/180.0)
+#define RadToDeg(r) ((r)*180.0/PI)
+#define Sgn(d) (IsZero(d) ? 0 : (d) > 0 ? 1 : -1)
+#define SgnPow(d, p) (IsZero(d) ? 0 : (pow(fabs(d), p) * Sgn(d)))
+
+class Vector
+{
+public:
+ float x, y, z;
+
+ Vector() {x = y = z = 0;}
+ Vector(float x, float y, float z);
+ void Set(float x, float y, float z);
+
+ Vector Normal(Vector& a, Vector& b);
+ float Angle(Vector& a, Vector& b);
+ float Angle(Vector& a);
+ void Angle(float& u, float& v); // returns spherical coords in radian, -PI/2 <= u <= PI/2, -PI <= v <= PI
+ Vector Angle(); // does like prev., returns 'u' in 'ret.x', and 'v' in 'ret.y'
+
+ Vector Unit();
+ Vector& Unitalize();
+ float Length();
+ float Sum(); // x + y + z
+ float CrossSum(); // xy + xz + yz
+ Vector Cross(); // xy, xz, yz
+ Vector Pow(float exp);
+
+ Vector& Min(Vector& a);
+ Vector& Max(Vector& a);
+ Vector Abs();
+
+ Vector Reflect(Vector& n);
+ Vector Refract(Vector& n, float nFront, float nBack, float* nOut = NULL);
+ Vector Refract2(Vector& n, float nFrom, float nTo, float* nOut = NULL);
+
+ Vector operator - ();
+ float& operator [] (int i);
+
+ float operator | (Vector& v); // dot
+ Vector operator % (Vector& v); // cross
+
+ bool operator == (const Vector& v) const;
+ bool operator != (const Vector& v) const;
+
+ Vector operator + (float d);
+ Vector operator + (Vector& v);
+ Vector operator - (float d);
+ Vector operator - (Vector& v);
+ Vector operator * (float d);
+ Vector operator * (Vector& v);
+ Vector operator / (float d);
+ Vector operator / (Vector& v);
+ Vector& operator += (float d);
+ Vector& operator += (Vector& v);
+ Vector& operator -= (float d);
+ Vector& operator -= (Vector& v);
+ Vector& operator *= (float d);
+ Vector& operator *= (Vector& v);
+ Vector& operator /= (float d);
+ Vector& operator /= (Vector& v);
+};
+
+class Ray
+{
+public:
+ Vector p, d;
+
+ Ray() {}
+ Ray(Vector& p, Vector& d);
+ void Set(Vector& p, Vector& d);
+
+ float GetDistanceFrom(Ray& r); // r = plane
+ float GetDistanceFrom(Vector& v); // v = point
+
+ Vector operator [] (float t);
+};
+
+class XForm
+{
+ class Matrix
+ {
+ public:
+ float mat[4][4];
+
+ Matrix();
+ void Initalize();
+
+ Matrix operator * (Matrix& m);
+ Matrix& operator *= (Matrix& m);
+ } m;
+
+ bool m_isWorldToLocal;
+
+public:
+ XForm() {}
+ XForm(Ray& r, Vector& s, bool isWorldToLocal = true);
+
+ void Initalize();
+ void Initalize(Ray& r, Vector& s, bool isWorldToLocal = true);
+
+ void operator *= (Vector& s); // scale
+ void operator += (Vector& t); // translate
+ void operator <<= (Vector& r); // rotate
+
+ void operator /= (Vector& s); // scale
+ void operator -= (Vector& t); // translate
+ void operator >>= (Vector& r); // rotate
+
+// transformations
+ Vector operator < (Vector& n); // normal
+ Vector operator << (Vector& v); // vector
+ Ray operator << (Ray& r); // ray
+};
diff --git a/src/subpic/DX7SubPic.cpp b/src/subpic/DX7SubPic.cpp
new file mode 100644
index 000000000..aefff8d6d
--- /dev/null
+++ b/src/subpic/DX7SubPic.cpp
@@ -0,0 +1,293 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <ddraw.h>
+#include <d3d.h>
+#include "DX7SubPic.h"
+
+//
+// CDX7SubPic
+//
+
+CDX7SubPic::CDX7SubPic(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pSurface)
+ : m_pSurface(pSurface)
+ , m_pD3DDev(pD3DDev)
+{
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ if(SUCCEEDED(m_pSurface->GetSurfaceDesc(&ddsd)))
+ {
+ m_maxsize.SetSize(ddsd.dwWidth, ddsd.dwHeight);
+ m_rcDirty.SetRect(0, 0, ddsd.dwWidth, ddsd.dwHeight);
+ }
+}
+
+// ISubPic
+
+STDMETHODIMP_(void*) CDX7SubPic::GetObject()
+{
+ return (void*)(IDirectDrawSurface7*)m_pSurface;
+}
+
+STDMETHODIMP CDX7SubPic::GetDesc(SubPicDesc& spd)
+{
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ if(FAILED(m_pSurface->GetSurfaceDesc(&ddsd)))
+ return E_FAIL;
+
+ spd.type = 0;
+ spd.w = m_size.cx;
+ spd.h = m_size.cy;
+ spd.bpp = (WORD)ddsd.ddpfPixelFormat.dwRGBBitCount;
+ spd.pitch = ddsd.lPitch;
+ spd.bits = ddsd.lpSurface; // should be NULL
+ spd.vidrect = m_vidrect;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDX7SubPic::CopyTo(ISubPic* pSubPic)
+{
+ HRESULT hr;
+ if(FAILED(hr = __super::CopyTo(pSubPic)))
+ return hr;
+
+ CPoint p = m_rcDirty.TopLeft();
+ hr = m_pD3DDev->Load((IDirectDrawSurface7*)pSubPic->GetObject(), &p, (IDirectDrawSurface7*)GetObject(), m_rcDirty, 0);
+
+ return SUCCEEDED(hr) ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CDX7SubPic::ClearDirtyRect(DWORD color)
+{
+ if(m_rcDirty.IsRectEmpty())
+ return S_FALSE;
+
+ DDBLTFX fx;
+ INITDDSTRUCT(fx);
+ fx.dwFillColor = color;
+ m_pSurface->Blt(&m_rcDirty, NULL, NULL, DDBLT_WAIT|DDBLT_COLORFILL, &fx);
+
+ m_rcDirty.SetRectEmpty();
+
+ return S_OK;
+}
+
+STDMETHODIMP CDX7SubPic::Lock(SubPicDesc& spd)
+{
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ if(FAILED(m_pSurface->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT, NULL)))
+ return E_FAIL;
+
+ spd.type = 0;
+ spd.w = m_size.cx;
+ spd.h = m_size.cy;
+ spd.bpp = (WORD)ddsd.ddpfPixelFormat.dwRGBBitCount;
+ spd.pitch = ddsd.lPitch;
+ spd.bits = ddsd.lpSurface;
+ spd.vidrect = m_vidrect;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDX7SubPic::Unlock(RECT* pDirtyRect)
+{
+ m_pSurface->Unlock(NULL);
+
+ if(pDirtyRect)
+ {
+ m_rcDirty = *pDirtyRect;
+ m_rcDirty.InflateRect(1, 1);
+ m_rcDirty &= CRect(CPoint(0, 0), m_size);
+ }
+ else
+ {
+ m_rcDirty = CRect(CPoint(0, 0), m_size);
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CDX7SubPic::AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget)
+{
+ ASSERT(pTarget == NULL);
+
+ if(!m_pD3DDev || !m_pSurface || !pSrc || !pDst)
+ return E_POINTER;
+
+ CRect src(*pSrc), dst(*pDst);
+
+ HRESULT hr;
+
+ do
+ {
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ if(FAILED(hr = m_pSurface->GetSurfaceDesc(&ddsd)))
+ break;
+
+ float w = (float)ddsd.dwWidth;
+ float h = (float)ddsd.dwHeight;
+
+ struct
+ {
+ float x, y, z, rhw;
+ float tu, tv;
+ }
+ pVertices[] =
+ {
+ {(float)dst.left, (float)dst.top, 0.5f, 2.0f, (float)src.left / w, (float)src.top / h},
+ {(float)dst.right, (float)dst.top, 0.5f, 2.0f, (float)src.right / w, (float)src.top / h},
+ {(float)dst.left, (float)dst.bottom, 0.5f, 2.0f, (float)src.left / w, (float)src.bottom / h},
+ {(float)dst.right, (float)dst.bottom, 0.5f, 2.0f, (float)src.right / w, (float)src.bottom / h},
+ };
+/*
+ for(int i = 0; i < countof(pVertices); i++)
+ {
+ pVertices[i].x -= 0.5;
+ pVertices[i].y -= 0.5;
+ }
+*/
+ hr = m_pD3DDev->SetTexture(0, m_pSurface);
+
+ m_pD3DDev->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
+ m_pD3DDev->SetRenderState(D3DRENDERSTATE_LIGHTING, FALSE);
+ m_pD3DDev->SetRenderState(D3DRENDERSTATE_BLENDENABLE, TRUE);
+ m_pD3DDev->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); // pre-multiplied src and ...
+ m_pD3DDev->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA); // ... inverse alpha channel for dst
+
+ m_pD3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ m_pD3DDev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+ m_pD3DDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
+
+ m_pD3DDev->SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTFG_LINEAR);
+ m_pD3DDev->SetTextureStageState(0, D3DTSS_MINFILTER, D3DTFN_LINEAR);
+ m_pD3DDev->SetTextureStageState(0, D3DTSS_MIPFILTER, D3DTFP_LINEAR);
+
+ m_pD3DDev->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP);
+
+ /*//
+
+ D3DDEVICEDESC7 d3ddevdesc;
+ m_pD3DDev->GetCaps(&d3ddevdesc);
+ if(d3ddevdesc.dpcTriCaps.dwAlphaCmpCaps & D3DPCMPCAPS_LESS)
+ {
+ m_pD3DDev->SetRenderState(D3DRENDERSTATE_ALPHAREF, (DWORD)0x000000FE);
+ m_pD3DDev->SetRenderState(D3DRENDERSTATE_ALPHATESTENABLE, TRUE);
+ m_pD3DDev->SetRenderState(D3DRENDERSTATE_ALPHAFUNC, D3DPCMPCAPS_LESS);
+ }
+
+ *///
+
+ if(FAILED(hr = m_pD3DDev->BeginScene()))
+ break;
+
+ hr = m_pD3DDev->DrawPrimitive(D3DPT_TRIANGLESTRIP,
+ D3DFVF_XYZRHW | D3DFVF_TEX1,
+ pVertices, 4, D3DDP_WAIT);
+ m_pD3DDev->EndScene();
+
+ //
+
+ m_pD3DDev->SetTexture(0, NULL);
+
+ return S_OK;
+ }
+ while(0);
+
+ return E_FAIL;
+}
+
+//
+// CDX7SubPicAllocator
+//
+
+CDX7SubPicAllocator::CDX7SubPicAllocator(IDirect3DDevice7* pD3DDev, SIZE maxsize, bool fPow2Textures)
+ : ISubPicAllocatorImpl(maxsize, true, fPow2Textures)
+ , m_pD3DDev(pD3DDev)
+ , m_maxsize(maxsize)
+{
+}
+
+// ISubPicAllocator
+
+STDMETHODIMP CDX7SubPicAllocator::ChangeDevice(IUnknown* pDev)
+{
+ CComQIPtr<IDirect3DDevice7, &IID_IDirect3DDevice7> pD3DDev = pDev;
+ if(!pD3DDev) return E_NOINTERFACE;
+
+ CAutoLock cAutoLock(this);
+ m_pD3DDev = pD3DDev;
+
+ return __super::ChangeDevice(pDev);
+}
+
+// ISubPicAllocatorImpl
+
+bool CDX7SubPicAllocator::Alloc(bool fStatic, ISubPic** ppSubPic)
+{
+ if(!ppSubPic)
+ return(false);
+
+ CAutoLock cAutoLock(this);
+
+ DDSURFACEDESC2 ddsd;
+ INITDDSTRUCT(ddsd);
+ ddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT;
+ ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | (fStatic ? DDSCAPS_SYSTEMMEMORY : 0);
+ ddsd.ddsCaps.dwCaps2 = fStatic ? 0 : (DDSCAPS2_TEXTUREMANAGE|DDSCAPS2_HINTSTATIC);
+ ddsd.dwWidth = m_maxsize.cx;
+ ddsd.dwHeight = m_maxsize.cy;
+ ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
+ ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB|DDPF_ALPHAPIXELS;
+ ddsd.ddpfPixelFormat.dwRGBBitCount = 32;
+ ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0xFF000000;
+ ddsd.ddpfPixelFormat.dwRBitMask = 0x00FF0000;
+ ddsd.ddpfPixelFormat.dwGBitMask = 0x0000FF00;
+ ddsd.ddpfPixelFormat.dwBBitMask = 0x000000FF;
+
+ if(m_fPow2Textures)
+ {
+ ddsd.dwWidth = ddsd.dwHeight = 1;
+ while(ddsd.dwWidth < m_maxsize.cx) ddsd.dwWidth <<= 1;
+ while(ddsd.dwHeight < m_maxsize.cy) ddsd.dwHeight <<= 1;
+ }
+
+
+ CComPtr<IDirect3D7> pD3D;
+ CComQIPtr<IDirectDraw7, &IID_IDirectDraw7> pDD;
+ if(FAILED(m_pD3DDev->GetDirect3D(&pD3D)) || !pD3D || !(pDD = pD3D))
+ return(false);
+
+ CComPtr<IDirectDrawSurface7> pSurface;
+ if(FAILED(pDD->CreateSurface(&ddsd, &pSurface, NULL)))
+ return(false);
+
+ if(!(*ppSubPic = new CDX7SubPic(m_pD3DDev, pSurface)))
+ return(false);
+
+ (*ppSubPic)->AddRef();
+
+ return(true);
+}
diff --git a/src/subpic/DX7SubPic.h b/src/subpic/DX7SubPic.h
new file mode 100644
index 000000000..e6445a227
--- /dev/null
+++ b/src/subpic/DX7SubPic.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "ISubPic.h"
+
+// CDX7SubPic
+
+class CDX7SubPic : public ISubPicImpl
+{
+ CComPtr<IDirect3DDevice7> m_pD3DDev;
+ CComPtr<IDirectDrawSurface7> m_pSurface;
+
+protected:
+ STDMETHODIMP_(void*) GetObject(); // returns IDirectDrawSurface7*
+
+public:
+ CDX7SubPic(IDirect3DDevice7* pD3DDev, IDirectDrawSurface7* pSurface);
+
+ // ISubPic
+ STDMETHODIMP GetDesc(SubPicDesc& spd);
+ STDMETHODIMP CopyTo(ISubPic* pSubPic);
+ STDMETHODIMP ClearDirtyRect(DWORD color);
+ STDMETHODIMP Lock(SubPicDesc& spd);
+ STDMETHODIMP Unlock(RECT* pDirtyRect);
+ STDMETHODIMP AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget);
+};
+
+// CDX7SubPicAllocator
+
+class CDX7SubPicAllocator : public ISubPicAllocatorImpl, public CCritSec
+{
+ CComPtr<IDirect3DDevice7> m_pD3DDev;
+ CSize m_maxsize;
+
+ bool Alloc(bool fStatic, ISubPic** ppSubPic);
+
+public:
+ CDX7SubPicAllocator(IDirect3DDevice7* pD3DDev, SIZE maxsize, bool fPow2Textures);
+
+ // ISubPicAllocator
+ STDMETHODIMP ChangeDevice(IUnknown* pDev);
+};
diff --git a/src/subpic/DX9SubPic.cpp b/src/subpic/DX9SubPic.cpp
new file mode 100644
index 000000000..4f70babaa
--- /dev/null
+++ b/src/subpic/DX9SubPic.cpp
@@ -0,0 +1,357 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <d3d9.h>
+#include <Vmr9.h>
+#include "DX9SubPic.h"
+
+//
+// CDX9SubPic
+//
+
+CDX9SubPic::CDX9SubPic(IDirect3DSurface9* pSurface)
+ : m_pSurface(pSurface)
+{
+ D3DSURFACE_DESC d3dsd;
+ ZeroMemory(&d3dsd, sizeof(d3dsd));
+ if(SUCCEEDED(m_pSurface->GetDesc(&d3dsd)))
+ {
+ m_maxsize.SetSize(d3dsd.Width, d3dsd.Height);
+ m_rcDirty.SetRect(0, 0, d3dsd.Width, d3dsd.Height);
+ }
+}
+
+// ISubPic
+
+STDMETHODIMP_(void*) CDX9SubPic::GetObject()
+{
+ CComPtr<IDirect3DTexture9> pTexture;
+ if(SUCCEEDED(m_pSurface->GetContainer(IID_IDirect3DTexture9, (void**)&pTexture)))
+ return (void*)(IDirect3DTexture9*)pTexture;
+
+ return NULL;
+}
+
+STDMETHODIMP CDX9SubPic::GetDesc(SubPicDesc& spd)
+{
+ D3DSURFACE_DESC d3dsd;
+ ZeroMemory(&d3dsd, sizeof(d3dsd));
+ if(FAILED(m_pSurface->GetDesc(&d3dsd)))
+ return E_FAIL;
+
+ spd.type = 0;
+ spd.w = m_size.cx;
+ spd.h = m_size.cy;
+ spd.bpp =
+ d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 :
+ d3dsd.Format == D3DFMT_A4R4G4B4 ? 16 : 0;
+ spd.pitch = 0;
+ spd.bits = NULL;
+ spd.vidrect = m_vidrect;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDX9SubPic::CopyTo(ISubPic* pSubPic)
+{
+ HRESULT hr;
+ if(FAILED(hr = __super::CopyTo(pSubPic)))
+ return hr;
+
+ if(m_rcDirty.IsRectEmpty())
+ return S_FALSE;
+
+ CComPtr<IDirect3DDevice9> pD3DDev;
+ if(!m_pSurface || FAILED(m_pSurface->GetDevice(&pD3DDev)) || !pD3DDev)
+ return E_FAIL;
+
+ hr = pD3DDev->UpdateTexture((IDirect3DTexture9*)GetObject(), (IDirect3DTexture9*)pSubPic->GetObject());
+
+ return SUCCEEDED(hr) ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CDX9SubPic::ClearDirtyRect(DWORD color)
+{
+ if(m_rcDirty.IsRectEmpty())
+ return S_FALSE;
+
+ CComPtr<IDirect3DDevice9> pD3DDev;
+ if(!m_pSurface || FAILED(m_pSurface->GetDevice(&pD3DDev)) || !pD3DDev)
+ return E_FAIL;
+
+ SubPicDesc spd;
+ if(SUCCEEDED(Lock(spd)))
+ {
+ int h = m_rcDirty.Height();
+
+ BYTE* ptr = (BYTE*)spd.bits + spd.pitch*m_rcDirty.top + (m_rcDirty.left*spd.bpp>>3);
+
+ if(spd.bpp == 16)
+ {
+ while(h-- > 0)
+ {
+ WORD* start = (WORD*)ptr;
+ WORD* end = start + m_rcDirty.Width();
+ while(start < end) *start++ = (WORD)color;
+ ptr += spd.pitch;
+ }
+ }
+ else if(spd.bpp == 32)
+ {
+ while(h-- > 0)
+ {
+ DWORD* start = (DWORD*)ptr;
+ DWORD* end = start + m_rcDirty.Width();
+ while(start < end) *start++ = color;
+ ptr += spd.pitch;
+ }
+ }
+/*
+ DWORD* ptr = (DWORD*)bm.bits;
+ DWORD* end = ptr + bm.h*bm.wBytes/4;
+ while(ptr < end) *ptr++ = color;
+*/
+ Unlock(NULL);
+ }
+
+// HRESULT hr = pD3DDev->ColorFill(m_pSurface, m_rcDirty, color);
+
+ m_rcDirty.SetRectEmpty();
+
+ return S_OK;
+}
+
+STDMETHODIMP CDX9SubPic::Lock(SubPicDesc& spd)
+{
+ D3DSURFACE_DESC d3dsd;
+ ZeroMemory(&d3dsd, sizeof(d3dsd));
+ if(FAILED(m_pSurface->GetDesc(&d3dsd)))
+ return E_FAIL;
+
+ D3DLOCKED_RECT LockedRect;
+ ZeroMemory(&LockedRect, sizeof(LockedRect));
+ if(FAILED(m_pSurface->LockRect(&LockedRect, NULL, 0)))
+ return E_FAIL;
+
+ spd.type = 0;
+ spd.w = m_size.cx;
+ spd.h = m_size.cy;
+ spd.bpp =
+ d3dsd.Format == D3DFMT_A8R8G8B8 ? 32 :
+ d3dsd.Format == D3DFMT_A4R4G4B4 ? 16 : 0;
+ spd.pitch = LockedRect.Pitch;
+ spd.bits = LockedRect.pBits;
+ spd.vidrect = m_vidrect;
+
+ return S_OK;
+}
+
+STDMETHODIMP CDX9SubPic::Unlock(RECT* pDirtyRect)
+{
+ m_pSurface->UnlockRect();
+
+ if(pDirtyRect)
+ {
+ m_rcDirty = *pDirtyRect;
+ m_rcDirty.InflateRect(1, 1);
+ m_rcDirty &= CRect(CPoint(0, 0), m_size);
+ }
+ else
+ {
+ m_rcDirty = CRect(CPoint(0, 0), m_size);
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CDX9SubPic::AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget)
+{
+ ASSERT(pTarget == NULL);
+
+ if(!pSrc || !pDst)
+ return E_POINTER;
+
+ CRect src(*pSrc), dst(*pDst);
+
+ CComPtr<IDirect3DDevice9> pD3DDev;
+ CComPtr<IDirect3DTexture9> pTexture = (IDirect3DTexture9*)GetObject();
+ if(!pTexture || FAILED(pTexture->GetDevice(&pD3DDev)) || !pD3DDev)
+ return E_NOINTERFACE;
+
+ HRESULT hr;
+
+ do
+ {
+ D3DSURFACE_DESC d3dsd;
+ ZeroMemory(&d3dsd, sizeof(d3dsd));
+ if(FAILED(pTexture->GetLevelDesc(0, &d3dsd)) /*|| d3dsd.Type != D3DRTYPE_TEXTURE*/)
+ break;
+
+ float w = (float)d3dsd.Width;
+ float h = (float)d3dsd.Height;
+
+ struct
+ {
+ float x, y, z, rhw;
+ float tu, tv;
+ }
+ pVertices[] =
+ {
+ {(float)dst.left, (float)dst.top, 0.5f, 2.0f, (float)src.left / w, (float)src.top / h},
+ {(float)dst.right, (float)dst.top, 0.5f, 2.0f, (float)src.right / w, (float)src.top / h},
+ {(float)dst.left, (float)dst.bottom, 0.5f, 2.0f, (float)src.left / w, (float)src.bottom / h},
+ {(float)dst.right, (float)dst.bottom, 0.5f, 2.0f, (float)src.right / w, (float)src.bottom / h},
+ };
+/*
+ for(int i = 0; i < countof(pVertices); i++)
+ {
+ pVertices[i].x -= 0.5;
+ pVertices[i].y -= 0.5;
+ }
+*/
+
+ hr = pD3DDev->SetTexture(0, pTexture);
+
+ DWORD abe, sb, db;
+ hr = pD3DDev->GetRenderState(D3DRS_ALPHABLENDENABLE, &abe);
+ hr = pD3DDev->GetRenderState(D3DRS_SRCBLEND, &sb);
+ hr = pD3DDev->GetRenderState(D3DRS_DESTBLEND, &db);
+
+ hr = pD3DDev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+ hr = pD3DDev->SetRenderState(D3DRS_LIGHTING, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ZENABLE, FALSE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
+ hr = pD3DDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); // pre-multiplied src and ...
+ hr = pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_SRCALPHA); // ... inverse alpha channel for dst
+
+ hr = pD3DDev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ hr = pD3DDev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+ hr = pD3DDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
+
+ hr = pD3DDev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
+ hr = pD3DDev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
+ hr = pD3DDev->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
+
+ hr = pD3DDev->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+ hr = pD3DDev->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+
+ /*//
+
+ D3DCAPS9 d3dcaps9;
+ hr = pD3DDev->GetDeviceCaps(&d3dcaps9);
+ if(d3dcaps9.AlphaCmpCaps & D3DPCMPCAPS_LESS)
+ {
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHAREF, (DWORD)0x000000FE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
+ hr = pD3DDev->SetRenderState(D3DRS_ALPHAFUNC, D3DPCMPCAPS_LESS);
+ }
+
+ *///
+
+ hr = pD3DDev->SetPixelShader(NULL);
+
+ if(FAILED(hr = pD3DDev->BeginScene()))
+ break;
+
+ hr = pD3DDev->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
+ hr = pD3DDev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pVertices, sizeof(pVertices[0]));
+
+ hr = pD3DDev->EndScene();
+
+ //
+
+ pD3DDev->SetTexture(0, NULL);
+
+ pD3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, abe);
+ pD3DDev->SetRenderState(D3DRS_SRCBLEND, sb);
+ pD3DDev->SetRenderState(D3DRS_DESTBLEND, db);
+
+ return S_OK;
+ }
+ while(0);
+
+ return E_FAIL;
+}
+
+//
+// CDX9SubPicAllocator
+//
+
+CDX9SubPicAllocator::CDX9SubPicAllocator(IDirect3DDevice9* pD3DDev, SIZE maxsize, bool fPow2Textures)
+ : ISubPicAllocatorImpl(maxsize, true, fPow2Textures)
+ , m_pD3DDev(pD3DDev)
+ , m_maxsize(maxsize)
+{
+ m_pD3DDev = pD3DDev;
+ m_maxsize = maxsize;
+}
+
+// ISubPicAllocator
+
+STDMETHODIMP CDX9SubPicAllocator::ChangeDevice(IUnknown* pDev)
+{
+ CComQIPtr<IDirect3DDevice9> pD3DDev = pDev;
+ if(!pD3DDev) return E_NOINTERFACE;
+
+ CAutoLock cAutoLock(this);
+ m_pD3DDev = pD3DDev;
+
+ return __super::ChangeDevice(pDev);
+}
+
+// ISubPicAllocatorImpl
+
+bool CDX9SubPicAllocator::Alloc(bool fStatic, ISubPic** ppSubPic)
+{
+ if(!ppSubPic)
+ return(false);
+
+ CAutoLock cAutoLock(this);
+
+ *ppSubPic = NULL;
+
+ CComPtr<IDirect3DSurface9> pSurface;
+
+ int Width = m_maxsize.cx;
+ int Height = m_maxsize.cy;
+
+ if(m_fPow2Textures)
+ {
+ Width = Height = 1;
+ while(Width < m_maxsize.cx) Width <<= 1;
+ while(Height < m_maxsize.cy) Height <<= 1;
+ }
+
+ CComPtr<IDirect3DTexture9> pTexture;
+ if(FAILED(m_pD3DDev->CreateTexture(Width, Height, 1, 0, D3DFMT_A8R8G8B8, fStatic?D3DPOOL_SYSTEMMEM:D3DPOOL_DEFAULT, &pTexture, NULL)))
+ return(false);
+
+ if(FAILED(pTexture->GetSurfaceLevel(0, &pSurface)))
+ return(false);
+
+ if(!(*ppSubPic = new CDX9SubPic(pSurface)))
+ return(false);
+
+ (*ppSubPic)->AddRef();
+
+ return(true);
+}
diff --git a/src/subpic/DX9SubPic.h b/src/subpic/DX9SubPic.h
new file mode 100644
index 000000000..9b7688a45
--- /dev/null
+++ b/src/subpic/DX9SubPic.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "ISubPic.h"
+
+// CDX9SubPic
+
+class CDX9SubPic : public ISubPicImpl
+{
+ CComPtr<IDirect3DSurface9> m_pSurface;
+
+protected:
+ STDMETHODIMP_(void*) GetObject(); // returns IDirect3DTexture9*
+
+public:
+ CDX9SubPic(IDirect3DSurface9* pSurface);
+
+ // ISubPic
+ STDMETHODIMP GetDesc(SubPicDesc& spd);
+ STDMETHODIMP CopyTo(ISubPic* pSubPic);
+ STDMETHODIMP ClearDirtyRect(DWORD color);
+ STDMETHODIMP Lock(SubPicDesc& spd);
+ STDMETHODIMP Unlock(RECT* pDirtyRect);
+ STDMETHODIMP AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget);
+};
+
+// CDX9SubPicAllocator
+
+class CDX9SubPicAllocator : public ISubPicAllocatorImpl, public CCritSec
+{
+ CComPtr<IDirect3DDevice9> m_pD3DDev;
+ CSize m_maxsize;
+
+ bool Alloc(bool fStatic, ISubPic** ppSubPic);
+
+public:
+ CDX9SubPicAllocator(IDirect3DDevice9* pD3DDev, SIZE maxsize, bool fPow2Textures);
+
+ // ISubPicAllocator
+ STDMETHODIMP ChangeDevice(IUnknown* pDev);
+};
+
+[uuid("CD6D2AA5-20D3-4ebe-A8A9-34D3B00CC253")]
+interface ISubRenderCallback : public IUnknown
+{
+ // NULL means release current device, textures and other resources
+ STDMETHOD(SetDevice)(IDirect3DDevice9 *dev) = 0;
+
+ // destination video rectangle, will be inside (0, 0)-(width, height)
+ // width,height is the size of the entire output window
+ STDMETHOD(Render)(REFERENCE_TIME rtStart,
+ int left, int top, int bottom, int right,
+ int width, int height) = 0;
+};
+
+[uuid("E602585E-C05A-4828-AC69-AF92997F2E0C")]
+interface ISubRenderCallback2 : public ISubRenderCallback
+{
+ STDMETHOD(RenderEx)(REFERENCE_TIME rtStart, REFERENCE_TIME rtStop,
+ REFERENCE_TIME AvgTimePerFrame,
+ int left, int top, int right, int bottom,
+ int width, int height) = 0;
+};
+
+[uuid("9CC7F9F7-3ED1-493c-AF65-527EA1D9947F")]
+interface ISubRender : public IUnknown
+{
+ STDMETHOD(SetCallback)(ISubRenderCallback *cb) = 0;
+};
diff --git a/src/subpic/ISubPic.cpp b/src/subpic/ISubPic.cpp
new file mode 100644
index 000000000..f6f3eab3f
--- /dev/null
+++ b/src/subpic/ISubPic.cpp
@@ -0,0 +1,861 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "ISubPic.h"
+#include "..\DSUtil\DSUtil.h"
+
+//
+// ISubPicImpl
+//
+
+ISubPicImpl::ISubPicImpl()
+ : CUnknown(NAME("ISubPicImpl"), NULL)
+ , m_rtStart(0), m_rtStop(0)
+ , m_rcDirty(0, 0, 0, 0), m_maxsize(0, 0), m_size(0, 0), m_vidrect(0, 0, 0, 0)
+{
+}
+
+STDMETHODIMP ISubPicImpl::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(ISubPic)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ISubPic
+
+STDMETHODIMP_(REFERENCE_TIME) ISubPicImpl::GetStart()
+{
+ return(m_rtStart);
+}
+
+STDMETHODIMP_(REFERENCE_TIME) ISubPicImpl::GetStop()
+{
+ return(m_rtStop);
+}
+
+STDMETHODIMP_(void) ISubPicImpl::SetStart(REFERENCE_TIME rtStart)
+{
+ m_rtStart = rtStart;
+}
+
+STDMETHODIMP_(void) ISubPicImpl::SetStop(REFERENCE_TIME rtStop)
+{
+ m_rtStop = rtStop;
+}
+
+STDMETHODIMP ISubPicImpl::CopyTo(ISubPic* pSubPic)
+{
+ if(!pSubPic)
+ return E_POINTER;
+
+ pSubPic->SetStart(m_rtStart);
+ pSubPic->SetStop(m_rtStop);
+ pSubPic->SetDirtyRect(m_rcDirty);
+ pSubPic->SetSize(m_size, m_vidrect);
+
+ return S_OK;
+}
+
+STDMETHODIMP ISubPicImpl::GetDirtyRect(RECT* pDirtyRect)
+{
+ return pDirtyRect ? *pDirtyRect = m_rcDirty, S_OK : E_POINTER;
+}
+
+STDMETHODIMP ISubPicImpl::SetDirtyRect(RECT* pDirtyRect)
+{
+ return pDirtyRect ? m_rcDirty = *pDirtyRect, S_OK : E_POINTER;
+}
+
+STDMETHODIMP ISubPicImpl::GetMaxSize(SIZE* pMaxSize)
+{
+ return pMaxSize ? *pMaxSize = m_maxsize, S_OK : E_POINTER;
+}
+
+STDMETHODIMP ISubPicImpl::SetSize(SIZE size, RECT vidrect)
+{
+ m_size = size;
+ m_vidrect = vidrect;
+
+ if(m_size.cx > m_maxsize.cx)
+ {
+ m_size.cy = MulDiv(m_size.cy, m_maxsize.cx, m_size.cx);
+ m_size.cx = m_maxsize.cx;
+ }
+
+ if(m_size.cy > m_maxsize.cy)
+ {
+ m_size.cx = MulDiv(m_size.cx, m_maxsize.cy, m_size.cy);
+ m_size.cy = m_maxsize.cy;
+ }
+
+ if(m_size.cx != size.cx || m_size.cy != size.cy)
+ {
+ m_vidrect.top = MulDiv(m_vidrect.top, m_size.cx, size.cx);
+ m_vidrect.bottom = MulDiv(m_vidrect.bottom, m_size.cx, size.cx);
+ m_vidrect.left = MulDiv(m_vidrect.left, m_size.cy, size.cy);
+ m_vidrect.right = MulDiv(m_vidrect.right, m_size.cy, size.cy);
+ }
+
+ return S_OK;
+}
+
+//
+// ISubPicAllocatorImpl
+//
+
+ISubPicAllocatorImpl::ISubPicAllocatorImpl(SIZE cursize, bool fDynamicWriteOnly, bool fPow2Textures)
+ : CUnknown(NAME("ISubPicAllocatorImpl"), NULL)
+ , m_cursize(cursize)
+ , m_fDynamicWriteOnly(fDynamicWriteOnly)
+ , m_fPow2Textures(fPow2Textures)
+{
+ m_curvidrect = CRect(CPoint(0,0), m_cursize);
+}
+
+STDMETHODIMP ISubPicAllocatorImpl::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(ISubPicAllocator)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ISubPicAllocator
+
+STDMETHODIMP ISubPicAllocatorImpl::SetCurSize(SIZE cursize)
+{
+ m_cursize = cursize;
+ return S_OK;
+}
+
+STDMETHODIMP ISubPicAllocatorImpl::SetCurVidRect(RECT curvidrect)
+{
+ m_curvidrect = curvidrect;
+ return S_OK;
+}
+
+STDMETHODIMP ISubPicAllocatorImpl::GetStatic(ISubPic** ppSubPic)
+{
+ if(!ppSubPic)
+ return E_POINTER;
+
+ if(!m_pStatic)
+ {
+ if(!Alloc(true, &m_pStatic) || !m_pStatic)
+ return E_OUTOFMEMORY;
+ }
+
+ m_pStatic->SetSize(m_cursize, m_curvidrect);
+
+ (*ppSubPic = m_pStatic)->AddRef();
+
+ return S_OK;
+}
+
+STDMETHODIMP ISubPicAllocatorImpl::AllocDynamic(ISubPic** ppSubPic)
+{
+ if(!ppSubPic)
+ return E_POINTER;
+
+ if(!Alloc(false, ppSubPic) || !*ppSubPic)
+ return E_OUTOFMEMORY;
+
+ (*ppSubPic)->SetSize(m_cursize, m_curvidrect);
+
+ return S_OK;
+}
+
+STDMETHODIMP_(bool) ISubPicAllocatorImpl::IsDynamicWriteOnly()
+{
+ return(m_fDynamicWriteOnly);
+}
+
+STDMETHODIMP ISubPicAllocatorImpl::ChangeDevice(IUnknown* pDev)
+{
+ m_pStatic = NULL;
+ return S_OK;
+}
+
+//
+// ISubPicProviderImpl
+//
+
+ISubPicProviderImpl::ISubPicProviderImpl(CCritSec* pLock)
+ : CUnknown(NAME("ISubPicProviderImpl"), NULL)
+ , m_pLock(pLock)
+{
+}
+
+ISubPicProviderImpl::~ISubPicProviderImpl()
+{
+}
+
+STDMETHODIMP ISubPicProviderImpl::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(ISubPicProvider)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ISubPicProvider
+
+STDMETHODIMP ISubPicProviderImpl::Lock()
+{
+ return m_pLock ? m_pLock->Lock(), S_OK : E_FAIL;
+}
+
+STDMETHODIMP ISubPicProviderImpl::Unlock()
+{
+ return m_pLock ? m_pLock->Unlock(), S_OK : E_FAIL;
+}
+
+//
+// ISubPicQueueImpl
+//
+
+ISubPicQueueImpl::ISubPicQueueImpl(ISubPicAllocator* pAllocator, HRESULT* phr)
+ : CUnknown(NAME("ISubPicQueueImpl"), NULL)
+ , m_pAllocator(pAllocator)
+ , m_rtNow(0)
+ , m_fps(25.0)
+{
+ if(phr) *phr = S_OK;
+
+ if(!m_pAllocator)
+ {
+ if(phr) *phr = E_FAIL;
+ return;
+ }
+}
+
+ISubPicQueueImpl::~ISubPicQueueImpl()
+{
+}
+
+STDMETHODIMP ISubPicQueueImpl::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(ISubPicQueue)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ISubPicQueue
+
+STDMETHODIMP ISubPicQueueImpl::SetSubPicProvider(ISubPicProvider* pSubPicProvider)
+{
+ CAutoLock cAutoLock(&m_csSubPicProvider);
+
+// if(m_pSubPicProvider != pSubPicProvider)
+ {
+ m_pSubPicProvider = pSubPicProvider;
+
+ Invalidate();
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP ISubPicQueueImpl::GetSubPicProvider(ISubPicProvider** pSubPicProvider)
+{
+ if(!pSubPicProvider)
+ return E_POINTER;
+
+ CAutoLock cAutoLock(&m_csSubPicProvider);
+
+ if(m_pSubPicProvider)
+ (*pSubPicProvider = m_pSubPicProvider)->AddRef();
+
+ return !!*pSubPicProvider ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP ISubPicQueueImpl::SetFPS(double fps)
+{
+ m_fps = fps;
+
+ return S_OK;
+}
+
+STDMETHODIMP ISubPicQueueImpl::SetTime(REFERENCE_TIME rtNow)
+{
+ m_rtNow = rtNow;
+
+ return S_OK;
+}
+
+// private
+
+HRESULT ISubPicQueueImpl::RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double fps)
+{
+ HRESULT hr = E_FAIL;
+
+ if(!pSubPic)
+ return hr;
+
+ CComPtr<ISubPicProvider> pSubPicProvider;
+ if(FAILED(GetSubPicProvider(&pSubPicProvider)) || !pSubPicProvider)
+ return hr;
+
+ if(FAILED(pSubPicProvider->Lock()))
+ return hr;
+
+ SubPicDesc spd;
+ if(SUCCEEDED(pSubPic->ClearDirtyRect(0xFF000000))
+ && SUCCEEDED(pSubPic->Lock(spd)))
+ {
+ CRect r(0,0,0,0);
+ hr = pSubPicProvider->Render(spd, (rtStart+rtStop)/2, fps, r);
+
+ pSubPic->SetStart(rtStart);
+ pSubPic->SetStop(rtStop);
+
+ pSubPic->Unlock(r);
+ }
+
+ pSubPicProvider->Unlock();
+
+ return hr;
+}
+
+//
+// CSubPicQueue
+//
+
+CSubPicQueue::CSubPicQueue(int nMaxSubPic, ISubPicAllocator* pAllocator, HRESULT* phr)
+ : ISubPicQueueImpl(pAllocator, phr)
+ , m_nMaxSubPic(nMaxSubPic)
+ , m_rtQueueStart(0)
+{
+ if(phr && FAILED(*phr))
+ return;
+
+ if(m_nMaxSubPic < 1)
+ {if(phr) *phr = E_INVALIDARG; return;}
+
+ m_fBreakBuffering = false;
+ for(int i = 0; i < EVENT_COUNT; i++)
+ m_ThreadEvents[i] = CreateEvent(NULL, FALSE, FALSE, NULL);
+ CAMThread::Create();
+}
+
+CSubPicQueue::~CSubPicQueue()
+{
+ m_fBreakBuffering = true;
+ SetEvent(m_ThreadEvents[EVENT_EXIT]);
+ CAMThread::Close();
+ for(int i = 0; i < EVENT_COUNT; i++)
+ CloseHandle(m_ThreadEvents[i]);
+}
+
+// ISubPicQueue
+
+STDMETHODIMP CSubPicQueue::SetFPS(double fps)
+{
+ HRESULT hr = __super::SetFPS(fps);
+ if(FAILED(hr)) return hr;
+
+ SetEvent(m_ThreadEvents[EVENT_TIME]);
+
+ return S_OK;
+}
+
+STDMETHODIMP CSubPicQueue::SetTime(REFERENCE_TIME rtNow)
+{
+ HRESULT hr = __super::SetTime(rtNow);
+ if(FAILED(hr)) return hr;
+
+ SetEvent(m_ThreadEvents[EVENT_TIME]);
+
+ return S_OK;
+}
+
+STDMETHODIMP CSubPicQueue::Invalidate(REFERENCE_TIME rtInvalidate)
+{
+ {
+// CAutoLock cQueueLock(&m_csQueueLock);
+// RemoveAll();
+
+ m_rtInvalidate = rtInvalidate;
+ m_fBreakBuffering = true;
+ SetEvent(m_ThreadEvents[EVENT_TIME]);
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP_(bool) CSubPicQueue::LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic)
+{
+ if(!ppSubPic)
+ return(false);
+
+ *ppSubPic = NULL;
+
+ CAutoLock cQueueLock(&m_csQueueLock);
+
+ POSITION pos = GetHeadPosition();
+ while(pos)
+ {
+ CComPtr<ISubPic> pSubPic = GetNext(pos);
+ if(pSubPic->GetStart() <= rtNow && rtNow < pSubPic->GetStop())
+ {
+ *ppSubPic = pSubPic.Detach();
+ break;
+ }
+ }
+
+ return(!!*ppSubPic);
+}
+
+STDMETHODIMP CSubPicQueue::GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
+{
+ CAutoLock cQueueLock(&m_csQueueLock);
+
+ nSubPics = GetCount();
+ rtNow = m_rtNow;
+ rtStart = m_rtQueueStart;
+ rtStop = GetCount() > 0 ? GetTail()->GetStop() : rtStart;
+
+ return S_OK;
+}
+
+STDMETHODIMP CSubPicQueue::GetStats(int nSubPic, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
+{
+ CAutoLock cQueueLock(&m_csQueueLock);
+
+ rtStart = rtStop = -1;
+
+ if(nSubPic >= 0 && nSubPic < (int)GetCount())
+ {
+ if(POSITION pos = FindIndex(nSubPic))
+ {
+ rtStart = GetAt(pos)->GetStart();
+ rtStop = GetAt(pos)->GetStop();
+ }
+ }
+ else
+ {
+ return E_INVALIDARG;
+ }
+
+ return S_OK;
+}
+
+// private
+
+REFERENCE_TIME CSubPicQueue::UpdateQueue()
+{
+ CAutoLock cQueueLock(&m_csQueueLock);
+
+ REFERENCE_TIME rtNow = m_rtNow;
+
+ if(rtNow < m_rtQueueStart)
+ {
+ RemoveAll();
+ }
+ else
+ {
+ while(GetCount() > 0 && rtNow >= GetHead()->GetStop())
+ RemoveHead();
+ }
+
+ m_rtQueueStart = rtNow;
+
+ if(GetCount() > 0)
+ rtNow = GetTail()->GetStop();
+
+ return(rtNow);
+}
+
+void CSubPicQueue::AppendQueue(ISubPic* pSubPic)
+{
+ CAutoLock cQueueLock(&m_csQueueLock);
+
+ AddTail(pSubPic);
+}
+
+// overrides
+
+DWORD CSubPicQueue::ThreadProc()
+{
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_LOWEST/*THREAD_PRIORITY_BELOW_NORMAL*/);
+
+ while((WaitForMultipleObjects(EVENT_COUNT, m_ThreadEvents, FALSE, INFINITE) - WAIT_OBJECT_0) == EVENT_TIME)
+ {
+ double fps = m_fps;
+ REFERENCE_TIME rtNow = UpdateQueue();
+
+ int nMaxSubPic = m_nMaxSubPic;
+
+ CComPtr<ISubPicProvider> pSubPicProvider;
+ if(SUCCEEDED(GetSubPicProvider(&pSubPicProvider)) && pSubPicProvider
+ && SUCCEEDED(pSubPicProvider->Lock()))
+ {
+ for(POSITION pos = pSubPicProvider->GetStartPosition(rtNow, fps);
+ pos && !m_fBreakBuffering && GetCount() < (size_t)nMaxSubPic;
+ pos = pSubPicProvider->GetNext(pos))
+ {
+ REFERENCE_TIME rtStart = pSubPicProvider->GetStart(pos, fps);
+ REFERENCE_TIME rtStop = pSubPicProvider->GetStop(pos, fps);
+
+ if(m_rtNow >= rtStart)
+ {
+// m_fBufferUnderrun = true;
+ if(m_rtNow >= rtStop) continue;
+ }
+
+ if(rtStart >= m_rtNow + 60*10000000i64) // we are already one minute ahead, this should be enough
+ break;
+
+ if(rtNow < rtStop)
+ {
+ CComPtr<ISubPic> pStatic;
+ if(FAILED(m_pAllocator->GetStatic(&pStatic)))
+ break;
+
+ HRESULT hr = RenderTo(pStatic, rtStart, rtStop, fps);
+
+ if(FAILED(hr))
+ break;
+
+ if(S_OK != hr) // subpic was probably empty
+ continue;
+
+ CComPtr<ISubPic> pDynamic;
+ if(FAILED(m_pAllocator->AllocDynamic(&pDynamic))
+ || FAILED(pStatic->CopyTo(pDynamic)))
+ break;
+
+ AppendQueue(pDynamic);
+ }
+ }
+
+ pSubPicProvider->Unlock();
+ }
+
+ if(m_fBreakBuffering)
+ {
+ CAutoLock cQueueLock(&m_csQueueLock);
+
+ REFERENCE_TIME rtInvalidate = m_rtInvalidate;
+
+ while(GetCount() && GetTail()->GetStop() > rtInvalidate)
+ {
+ if(GetTail()->GetStart() < rtInvalidate)
+ GetTail()->SetStop(rtInvalidate);
+ else
+ RemoveTail();
+ }
+
+ m_fBreakBuffering = false;
+ }
+ }
+
+ return(0);
+}
+
+//
+// CSubPicQueueNoThread
+//
+
+CSubPicQueueNoThread::CSubPicQueueNoThread(ISubPicAllocator* pAllocator, HRESULT* phr)
+ : ISubPicQueueImpl(pAllocator, phr)
+{
+}
+
+CSubPicQueueNoThread::~CSubPicQueueNoThread()
+{
+}
+
+// ISubPicQueue
+
+STDMETHODIMP CSubPicQueueNoThread::Invalidate(REFERENCE_TIME rtInvalidate)
+{
+ CAutoLock cQueueLock(&m_csLock);
+
+ m_pSubPic = NULL;
+
+ return S_OK;
+}
+
+STDMETHODIMP_(bool) CSubPicQueueNoThread::LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic)
+{
+ if(!ppSubPic)
+ return(false);
+
+ *ppSubPic = NULL;
+
+ CComPtr<ISubPic> pSubPic;
+
+ {
+ CAutoLock cAutoLock(&m_csLock);
+
+ if(!m_pSubPic)
+ {
+ if(FAILED(m_pAllocator->AllocDynamic(&m_pSubPic)))
+ return(false);
+ }
+
+ pSubPic = m_pSubPic;
+ }
+
+ if(pSubPic->GetStart() <= rtNow && rtNow < pSubPic->GetStop())
+ {
+ (*ppSubPic = pSubPic)->AddRef();
+ }
+ else
+ {
+ CComPtr<ISubPicProvider> pSubPicProvider;
+ if(SUCCEEDED(GetSubPicProvider(&pSubPicProvider)) && pSubPicProvider
+ && SUCCEEDED(pSubPicProvider->Lock()))
+ {
+ double fps = m_fps;
+
+ if(POSITION pos = pSubPicProvider->GetStartPosition(rtNow, fps))
+ {
+ REFERENCE_TIME rtStart = pSubPicProvider->GetStart(pos, fps);
+ REFERENCE_TIME rtStop = pSubPicProvider->GetStop(pos, fps);
+
+ if(pSubPicProvider->IsAnimated(pos))
+ {
+ rtStart = rtNow;
+ rtStop = rtNow+1;
+ }
+
+ if(rtStart <= rtNow && rtNow < rtStop)
+ {
+ if(m_pAllocator->IsDynamicWriteOnly())
+ {
+ CComPtr<ISubPic> pStatic;
+ if(SUCCEEDED(m_pAllocator->GetStatic(&pStatic))
+ && SUCCEEDED(RenderTo(pStatic, rtStart, rtStop, fps))
+ && SUCCEEDED(pStatic->CopyTo(pSubPic)))
+ (*ppSubPic = pSubPic)->AddRef();
+ }
+ else
+ {
+ if(SUCCEEDED(RenderTo(m_pSubPic, rtStart, rtStop, fps)))
+ (*ppSubPic = pSubPic)->AddRef();
+ }
+ }
+ }
+
+ pSubPicProvider->Unlock();
+
+ if(*ppSubPic)
+ {
+ CAutoLock cAutoLock(&m_csLock);
+
+ m_pSubPic = *ppSubPic;
+ }
+ }
+ }
+
+ return(!!*ppSubPic);
+}
+
+STDMETHODIMP CSubPicQueueNoThread::GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
+{
+ CAutoLock cAutoLock(&m_csLock);
+
+ nSubPics = 0;
+ rtNow = m_rtNow;
+ rtStart = rtStop = 0;
+
+ if(m_pSubPic)
+ {
+ nSubPics = 1;
+ rtStart = m_pSubPic->GetStart();
+ rtStop = m_pSubPic->GetStop();
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CSubPicQueueNoThread::GetStats(int nSubPic, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop)
+{
+ CAutoLock cAutoLock(&m_csLock);
+
+ if(!m_pSubPic || nSubPic != 0)
+ return E_INVALIDARG;
+
+ rtStart = m_pSubPic->GetStart();
+ rtStop = m_pSubPic->GetStop();
+
+ return S_OK;
+}
+
+//
+// ISubPicAllocatorPresenterImpl
+//
+
+ISubPicAllocatorPresenterImpl::ISubPicAllocatorPresenterImpl(HWND hWnd, HRESULT& hr)
+ : CUnknown(NAME("ISubPicAllocatorPresenterImpl"), NULL)
+ , m_hWnd(hWnd)
+ , m_NativeVideoSize(0, 0), m_AspectRatio(0, 0)
+ , m_VideoRect(0, 0, 0, 0), m_WindowRect(0, 0, 0, 0)
+ , m_fps(25.0)
+{
+ if(!IsWindow(m_hWnd)) {hr = E_INVALIDARG; return;}
+ GetWindowRect(m_hWnd, &m_WindowRect);
+ SetVideoAngle(Vector(), false);
+ hr = S_OK;
+}
+
+ISubPicAllocatorPresenterImpl::~ISubPicAllocatorPresenterImpl()
+{
+}
+
+STDMETHODIMP ISubPicAllocatorPresenterImpl::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(ISubPicAllocatorPresenter)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+void ISubPicAllocatorPresenterImpl::AlphaBltSubPic(CSize size, SubPicDesc* pTarget)
+{
+ CComPtr<ISubPic> pSubPic;
+ if(m_pSubPicQueue->LookupSubPic(m_rtNow, &pSubPic))
+ {
+ SubPicDesc spd;
+ pSubPic->GetDesc(spd);
+
+ if(spd.w > 0 && spd.h > 0)
+ {
+ CRect r;
+ pSubPic->GetDirtyRect(r);
+
+ // FIXME
+ r.DeflateRect(1, 1);
+
+ CRect rDstText(
+ r.left * size.cx / spd.w,
+ r.top * size.cy / spd.h,
+ r.right * size.cx / spd.w,
+ r.bottom * size.cy / spd.h);
+
+ pSubPic->AlphaBlt(r, rDstText, pTarget);
+ }
+ }
+}
+
+// ISubPicAllocatorPresenter
+
+STDMETHODIMP_(SIZE) ISubPicAllocatorPresenterImpl::GetVideoSize(bool fCorrectAR)
+{
+ CSize VideoSize(m_NativeVideoSize);
+
+ if(fCorrectAR && m_AspectRatio.cx > 0 && m_AspectRatio.cy > 0)
+ VideoSize.cx = VideoSize.cy*m_AspectRatio.cx/m_AspectRatio.cy;
+
+ return(VideoSize);
+}
+
+STDMETHODIMP_(void) ISubPicAllocatorPresenterImpl::SetPosition(RECT w, RECT v)
+{
+ bool fWindowPosChanged = !!(m_WindowRect != w);
+ bool fWindowSizeChanged = !!(m_WindowRect.Size() != CRect(w).Size());
+
+ m_WindowRect = w;
+
+ bool fVideoRectChanged = !!(m_VideoRect != v);
+
+ m_VideoRect = v;
+
+ if(fWindowSizeChanged || fVideoRectChanged)
+ {
+ if(m_pAllocator)
+ {
+ m_pAllocator->SetCurSize(m_WindowRect.Size());
+ m_pAllocator->SetCurVidRect(m_VideoRect);
+ }
+
+ if(m_pSubPicQueue)
+ {
+ m_pSubPicQueue->Invalidate();
+ }
+ }
+
+ if(fWindowPosChanged || fVideoRectChanged)
+ Paint(fWindowSizeChanged || fVideoRectChanged);
+}
+
+STDMETHODIMP_(void) ISubPicAllocatorPresenterImpl::SetTime(REFERENCE_TIME rtNow)
+{
+/*
+ if(m_rtNow <= rtNow && rtNow <= m_rtNow + 1000000)
+ return;
+*/
+ m_rtNow = rtNow;
+
+ if(m_pSubPicQueue)
+ {
+ m_pSubPicQueue->SetTime(rtNow);
+ }
+}
+
+STDMETHODIMP_(double) ISubPicAllocatorPresenterImpl::GetFPS()
+{
+ return(m_fps);
+}
+
+STDMETHODIMP_(void) ISubPicAllocatorPresenterImpl::SetSubPicProvider(ISubPicProvider* pSubPicProvider)
+{
+ m_SubPicProvider = pSubPicProvider;
+
+ if(m_pSubPicQueue)
+ m_pSubPicQueue->SetSubPicProvider(pSubPicProvider);
+}
+
+STDMETHODIMP_(void) ISubPicAllocatorPresenterImpl::Invalidate(REFERENCE_TIME rtInvalidate)
+{
+ if(m_pSubPicQueue)
+ m_pSubPicQueue->Invalidate(rtInvalidate);
+}
+
+#include <math.h>
+
+void ISubPicAllocatorPresenterImpl::Transform(CRect r, Vector v[4])
+{
+ v[0] = Vector(r.left, r.top, 0);
+ v[1] = Vector(r.right, r.top, 0);
+ v[2] = Vector(r.left, r.bottom, 0);
+ v[3] = Vector(r.right, r.bottom, 0);
+
+ Vector center(r.CenterPoint().x, r.CenterPoint().y, 0);
+ int l = (int)(Vector(r.Size().cx, r.Size().cy, 0).Length()*1.5f)+1;
+
+ for(int i = 0; i < 4; i++)
+ {
+ v[i] = m_xform << (v[i] - center);
+ v[i].z = v[i].z / l + 0.5f;
+ v[i].x /= v[i].z*2;
+ v[i].y /= v[i].z*2;
+ v[i] += center;
+ }
+}
+
+STDMETHODIMP ISubPicAllocatorPresenterImpl::SetVideoAngle(Vector v, bool fRepaint)
+{
+ m_xform = XForm(Ray(Vector(0, 0, 0), v), Vector(1, 1, 1), false);
+ if(fRepaint) Paint(true);
+ return S_OK;
+}
diff --git a/src/subpic/ISubPic.h b/src/subpic/ISubPic.h
new file mode 100644
index 000000000..a6f417517
--- /dev/null
+++ b/src/subpic/ISubPic.h
@@ -0,0 +1,405 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlbase.h>
+#include <atlcoll.h>
+#include "CoordGeom.h"
+
+#pragma pack(push, 1)
+struct SubPicDesc
+{
+ int type;
+ int w, h, bpp, pitch, pitchUV;
+ void* bits;
+ BYTE* bitsU;
+ BYTE* bitsV;
+ RECT vidrect; // video rectangle
+
+ struct SubPicDesc() {type = 0; w = h = bpp = pitch = pitchUV = 0; bits = NULL; bitsU = bitsV = NULL;}
+};
+#pragma pack(pop)
+
+//
+// ISubPic
+//
+
+[uuid("449E11F3-52D1-4a27-AA61-E2733AC92CC0")]
+interface ISubPic : public IUnknown
+{
+ STDMETHOD_(void*, GetObject) () PURE;
+
+ STDMETHOD_(REFERENCE_TIME, GetStart) () PURE;
+ STDMETHOD_(REFERENCE_TIME, GetStop) () PURE;
+ STDMETHOD_(void, SetStart) (REFERENCE_TIME rtStart) PURE;
+ STDMETHOD_(void, SetStop) (REFERENCE_TIME rtStop) PURE;
+
+ STDMETHOD (GetDesc) (SubPicDesc& spd /*[out]*/) PURE;
+ STDMETHOD (CopyTo) (ISubPic* pSubPic /*[in]*/) PURE;
+
+ STDMETHOD (ClearDirtyRect) (DWORD color /*[in]*/) PURE;
+ STDMETHOD (GetDirtyRect) (RECT* pDirtyRect /*[out]*/) PURE;
+ STDMETHOD (SetDirtyRect) (RECT* pDirtyRect /*[in]*/) PURE;
+
+ STDMETHOD (GetMaxSize) (SIZE* pMaxSize /*[out]*/) PURE;
+ STDMETHOD (SetSize) (SIZE pSize /*[in]*/, RECT vidrect /*[in]*/) PURE;
+
+ STDMETHOD (Lock) (SubPicDesc& spd /*[out]*/) PURE;
+ STDMETHOD (Unlock) (RECT* pDirtyRect /*[in]*/) PURE;
+
+ STDMETHOD (AlphaBlt) (RECT* pSrc, RECT* pDst, SubPicDesc* pTarget = NULL /*[in]*/) PURE;
+};
+
+class ISubPicImpl : public CUnknown, public ISubPic
+{
+protected:
+ REFERENCE_TIME m_rtStart, m_rtStop;
+ CRect m_rcDirty;
+ CSize m_maxsize, m_size;
+ CRect m_vidrect;
+
+public:
+ ISubPicImpl();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPic
+
+ STDMETHODIMP_(REFERENCE_TIME) GetStart();
+ STDMETHODIMP_(REFERENCE_TIME) GetStop();
+ STDMETHODIMP_(void) SetStart(REFERENCE_TIME rtStart);
+ STDMETHODIMP_(void) SetStop(REFERENCE_TIME rtStop);
+
+ STDMETHODIMP GetDesc(SubPicDesc& spd) = 0;
+ STDMETHODIMP CopyTo(ISubPic* pSubPic);
+
+ STDMETHODIMP ClearDirtyRect(DWORD color) = 0;
+ STDMETHODIMP GetDirtyRect(RECT* pDirtyRect);
+ STDMETHODIMP SetDirtyRect(RECT* pDirtyRect);
+
+ STDMETHODIMP GetMaxSize(SIZE* pMaxSize);
+ STDMETHODIMP SetSize(SIZE size, RECT vidrect);
+
+ STDMETHODIMP Lock(SubPicDesc& spd) = 0;
+ STDMETHODIMP Unlock(RECT* pDirtyRect) = 0;
+
+ STDMETHODIMP AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget) = 0;
+};
+
+//
+// ISubPicAllocator
+//
+
+[uuid("CF7C3C23-6392-4a42-9E72-0736CFF793CB")]
+interface ISubPicAllocator : public IUnknown
+{
+ STDMETHOD (SetCurSize) (SIZE size /*[in]*/) PURE;
+ STDMETHOD (SetCurVidRect) (RECT curvidrect) PURE;
+
+ STDMETHOD (GetStatic) (ISubPic** ppSubPic /*[out]*/) PURE;
+ STDMETHOD (AllocDynamic) (ISubPic** ppSubPic /*[out]*/) PURE;
+
+ STDMETHOD_(bool, IsDynamicWriteOnly) () PURE;
+
+ STDMETHOD (ChangeDevice) (IUnknown* pDev) PURE;
+};
+
+
+class ISubPicAllocatorImpl : public CUnknown, public ISubPicAllocator
+{
+ CComPtr<ISubPic> m_pStatic;
+
+private:
+ CSize m_cursize;
+ CRect m_curvidrect;
+ bool m_fDynamicWriteOnly;
+
+ virtual bool Alloc(bool fStatic, ISubPic** ppSubPic) = 0;
+
+protected:
+ bool m_fPow2Textures;
+
+public:
+ ISubPicAllocatorImpl(SIZE cursize, bool fDynamicWriteOnly, bool fPow2Textures);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicAllocator
+
+ STDMETHODIMP SetCurSize(SIZE cursize);
+ STDMETHODIMP SetCurVidRect(RECT curvidrect);
+ STDMETHODIMP GetStatic(ISubPic** ppSubPic);
+ STDMETHODIMP AllocDynamic(ISubPic** ppSubPic);
+ STDMETHODIMP_(bool) IsDynamicWriteOnly();
+ STDMETHODIMP ChangeDevice(IUnknown* pDev);
+};
+
+//
+// ISubPicProvider
+//
+
+[uuid("D62B9A1A-879A-42db-AB04-88AA8F243CFD")]
+interface ISubPicProvider : public IUnknown
+{
+ STDMETHOD (Lock) () PURE;
+ STDMETHOD (Unlock) () PURE;
+
+ STDMETHOD_(POSITION, GetStartPosition) (REFERENCE_TIME rt, double fps) PURE;
+ STDMETHOD_(POSITION, GetNext) (POSITION pos) PURE;
+
+ STDMETHOD_(REFERENCE_TIME, GetStart) (POSITION pos, double fps) PURE;
+ STDMETHOD_(REFERENCE_TIME, GetStop) (POSITION pos, double fps) PURE;
+
+ STDMETHOD_(bool, IsAnimated) (POSITION pos) PURE;
+
+ STDMETHOD (Render) (SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox) PURE;
+};
+
+class ISubPicProviderImpl : public CUnknown, public ISubPicProvider
+{
+protected:
+ CCritSec* m_pLock;
+
+public:
+ ISubPicProviderImpl(CCritSec* pLock);
+ virtual ~ISubPicProviderImpl();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicProvider
+
+ STDMETHODIMP Lock();
+ STDMETHODIMP Unlock();
+
+ STDMETHODIMP_(POSITION) GetStartPosition(REFERENCE_TIME rt, double fps) = 0;
+ STDMETHODIMP_(POSITION) GetNext(POSITION pos) = 0;
+
+ STDMETHODIMP_(REFERENCE_TIME) GetStart(POSITION pos, double fps) = 0;
+ STDMETHODIMP_(REFERENCE_TIME) GetStop(POSITION pos, double fps) = 0;
+
+ STDMETHODIMP Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox) = 0;
+};
+
+//
+// ISubPicQueue
+//
+
+[uuid("C8334466-CD1E-4ad1-9D2D-8EE8519BD180")]
+interface ISubPicQueue : public IUnknown
+{
+ STDMETHOD (SetSubPicProvider) (ISubPicProvider* pSubPicProvider /*[in]*/) PURE;
+ STDMETHOD (GetSubPicProvider) (ISubPicProvider** pSubPicProvider /*[out]*/) PURE;
+
+ STDMETHOD (SetFPS) (double fps /*[in]*/) PURE;
+ STDMETHOD (SetTime) (REFERENCE_TIME rtNow /*[in]*/) PURE;
+
+ STDMETHOD (Invalidate) (REFERENCE_TIME rtInvalidate = -1) PURE;
+ STDMETHOD_(bool, LookupSubPic) (REFERENCE_TIME rtNow /*[in]*/, ISubPic** ppSubPic /*[out]*/) PURE;
+
+ STDMETHOD (GetStats) (int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop /*[out]*/) PURE;
+ STDMETHOD (GetStats) (int nSubPic /*[in]*/, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop /*[out]*/) PURE;
+};
+
+class ISubPicQueueImpl : public CUnknown, public ISubPicQueue
+{
+ CCritSec m_csSubPicProvider;
+ CComPtr<ISubPicProvider> m_pSubPicProvider;
+
+protected:
+ double m_fps;
+ REFERENCE_TIME m_rtNow;
+
+ CComPtr<ISubPicAllocator> m_pAllocator;
+
+ HRESULT RenderTo(ISubPic* pSubPic, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double fps);
+
+public:
+ ISubPicQueueImpl(ISubPicAllocator* pAllocator, HRESULT* phr);
+ virtual ~ISubPicQueueImpl();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicQueue
+
+ STDMETHODIMP SetSubPicProvider(ISubPicProvider* pSubPicProvider);
+ STDMETHODIMP GetSubPicProvider(ISubPicProvider** pSubPicProvider);
+
+ STDMETHODIMP SetFPS(double fps);
+ STDMETHODIMP SetTime(REFERENCE_TIME rtNow);
+/*
+ STDMETHODIMP Invalidate(REFERENCE_TIME rtInvalidate = -1) = 0;
+ STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic) = 0;
+
+ STDMETHODIMP GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop) = 0;
+ STDMETHODIMP GetStats(int nSubPics, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop) = 0;
+*/
+};
+
+class CSubPicQueue : public ISubPicQueueImpl, private CInterfaceList<ISubPic>, private CAMThread
+{
+ int m_nMaxSubPic;
+
+ CCritSec m_csQueueLock; // for protecting CInterfaceList<ISubPic>
+ REFERENCE_TIME UpdateQueue();
+ void AppendQueue(ISubPic* pSubPic);
+
+ REFERENCE_TIME m_rtQueueStart, m_rtInvalidate;
+
+ // CAMThread
+
+ bool m_fBreakBuffering;
+ enum {EVENT_EXIT, EVENT_TIME, EVENT_COUNT}; // IMPORTANT: _EXIT must come before _TIME if we want to exit fast from the destructor
+ HANDLE m_ThreadEvents[EVENT_COUNT];
+ DWORD ThreadProc();
+
+public:
+ CSubPicQueue(int nMaxSubPic, ISubPicAllocator* pAllocator, HRESULT* phr);
+ virtual ~CSubPicQueue();
+
+ // ISubPicQueue
+
+ STDMETHODIMP SetFPS(double fps);
+ STDMETHODIMP SetTime(REFERENCE_TIME rtNow);
+
+ STDMETHODIMP Invalidate(REFERENCE_TIME rtInvalidate = -1);
+ STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic);
+
+ STDMETHODIMP GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
+ STDMETHODIMP GetStats(int nSubPic, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
+};
+
+class CSubPicQueueNoThread : public ISubPicQueueImpl
+{
+ CCritSec m_csLock;
+ CComPtr<ISubPic> m_pSubPic;
+
+public:
+ CSubPicQueueNoThread(ISubPicAllocator* pAllocator, HRESULT* phr);
+ virtual ~CSubPicQueueNoThread();
+
+ // ISubPicQueue
+
+ STDMETHODIMP Invalidate(REFERENCE_TIME rtInvalidate = -1);
+ STDMETHODIMP_(bool) LookupSubPic(REFERENCE_TIME rtNow, ISubPic** ppSubPic);
+
+ STDMETHODIMP GetStats(int& nSubPics, REFERENCE_TIME& rtNow, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
+ STDMETHODIMP GetStats(int nSubPic, REFERENCE_TIME& rtStart, REFERENCE_TIME& rtStop);
+};
+
+//
+// ISubPicAllocatorPresenter
+//
+
+[uuid("CF75B1F0-535C-4074-8869-B15F177F944E")]
+interface ISubPicAllocatorPresenter : public IUnknown
+{
+ STDMETHOD (CreateRenderer) (IUnknown** ppRenderer) PURE;
+
+ STDMETHOD_(SIZE, GetVideoSize) (bool fCorrectAR = true) PURE;
+ STDMETHOD_(void, SetPosition) (RECT w, RECT v) PURE;
+ STDMETHOD_(bool, Paint) (bool fAll) PURE;
+
+ STDMETHOD_(void, SetTime) (REFERENCE_TIME rtNow) PURE;
+ STDMETHOD_(double, GetFPS) () PURE;
+
+ STDMETHOD_(void, SetSubPicProvider) (ISubPicProvider* pSubPicProvider) PURE;
+ STDMETHOD_(void, Invalidate) (REFERENCE_TIME rtInvalidate = -1) PURE;
+
+ STDMETHOD (GetDIB) (BYTE* lpDib, DWORD* size) PURE;
+
+ STDMETHOD (SetVideoAngle) (Vector v, bool fRepaint = true) PURE;
+ STDMETHOD (SetPixelShader) (LPCSTR pSrcData, LPCSTR pTarget) PURE;
+};
+
+class ISubPicAllocatorPresenterImpl
+ : public CUnknown
+ , public CCritSec
+ , public ISubPicAllocatorPresenter
+{
+protected:
+ HWND m_hWnd;
+ CSize m_spMaxSize; // TODO:
+ int m_spMaxQueued; // TODO:
+
+ CSize m_NativeVideoSize, m_AspectRatio;
+ CRect m_VideoRect, m_WindowRect;
+
+ REFERENCE_TIME m_rtNow;
+ double m_fps;
+
+ CComPtr<ISubPicProvider> m_SubPicProvider;
+ CComPtr<ISubPicAllocator> m_pAllocator;
+ CComPtr<ISubPicQueue> m_pSubPicQueue;
+
+ void AlphaBltSubPic(CSize size, SubPicDesc* pTarget = NULL);
+
+ XForm m_xform;
+ void Transform(CRect r, Vector v[4]);
+
+public:
+ ISubPicAllocatorPresenterImpl(HWND hWnd, HRESULT& hr);
+ virtual ~ISubPicAllocatorPresenterImpl();
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicAllocatorPresenter
+
+ STDMETHODIMP CreateRenderer(IUnknown** ppRenderer) = 0;
+
+ STDMETHODIMP_(SIZE) GetVideoSize(bool fCorrectAR = true);
+ STDMETHODIMP_(void) SetPosition(RECT w, RECT v);
+ STDMETHODIMP_(bool) Paint(bool fAll) = 0;
+
+ STDMETHODIMP_(void) SetTime(REFERENCE_TIME rtNow);
+ STDMETHODIMP_(double) GetFPS();
+
+ STDMETHODIMP_(void) SetSubPicProvider(ISubPicProvider* pSubPicProvider);
+ STDMETHODIMP_(void) Invalidate(REFERENCE_TIME rtInvalidate = -1);
+
+ STDMETHODIMP GetDIB(BYTE* lpDib, DWORD* size) {return E_NOTIMPL;}
+
+ STDMETHODIMP SetVideoAngle(Vector v, bool fRepaint = true);
+ STDMETHODIMP SetPixelShader(LPCSTR pSrcData, LPCSTR pTarget) {return E_NOTIMPL;}
+};
+
+//
+// ISubStream
+//
+
+[uuid("DE11E2FB-02D3-45e4-A174-6B7CE2783BDB")]
+interface ISubStream : public IPersist
+{
+ STDMETHOD_(int, GetStreamCount) () PURE;
+ STDMETHOD (GetStreamInfo) (int i, WCHAR** ppName, LCID* pLCID) PURE;
+ STDMETHOD_(int, GetStream) () PURE;
+ STDMETHOD (SetStream) (int iStream) PURE;
+ STDMETHOD (Reload) () PURE;
+
+ // TODO: get rid of IPersist to identify type and use only
+ // interface functions to modify the settings of the substream
+};
+
diff --git a/src/subpic/MemSubPic.cpp b/src/subpic/MemSubPic.cpp
new file mode 100644
index 000000000..0b7dbcb0a
--- /dev/null
+++ b/src/subpic/MemSubPic.cpp
@@ -0,0 +1,575 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "MemSubPic.h"
+
+// color conv
+
+unsigned char Clip_base[256*3];
+unsigned char* Clip = Clip_base + 256;
+
+const int c2y_cyb = int(0.114*219/255*65536+0.5);
+const int c2y_cyg = int(0.587*219/255*65536+0.5);
+const int c2y_cyr = int(0.299*219/255*65536+0.5);
+const int c2y_cu = int(1.0/2.018*1024+0.5);
+const int c2y_cv = int(1.0/1.596*1024+0.5);
+
+int c2y_yb[256];
+int c2y_yg[256];
+int c2y_yr[256];
+
+const int y2c_cbu = int(2.018*65536+0.5);
+const int y2c_cgu = int(0.391*65536+0.5);
+const int y2c_cgv = int(0.813*65536+0.5);
+const int y2c_crv = int(1.596*65536+0.5);
+int y2c_bu[256];
+int y2c_gu[256];
+int y2c_gv[256];
+int y2c_rv[256];
+
+const int cy_cy = int(255.0/219.0*65536+0.5);
+const int cy_cy2 = int(255.0/219.0*32768+0.5);
+
+bool fColorConvInitOK = false;
+
+void ColorConvInit()
+{
+ if(fColorConvInitOK) return;
+
+ int i;
+
+ for(i = 0; i < 256; i++)
+ {
+ Clip_base[i] = 0;
+ Clip_base[i+256] = i;
+ Clip_base[i+512] = 255;
+ }
+
+ for(i = 0; i < 256; i++)
+ {
+ c2y_yb[i] = c2y_cyb*i;
+ c2y_yg[i] = c2y_cyg*i;
+ c2y_yr[i] = c2y_cyr*i;
+
+ y2c_bu[i] = y2c_cbu*(i-128);
+ y2c_gu[i] = y2c_cgu*(i-128);
+ y2c_gv[i] = y2c_cgv*(i-128);
+ y2c_rv[i] = y2c_crv*(i-128);
+ }
+
+ fColorConvInitOK = true;
+}
+
+#define rgb2yuv(r1,g1,b1,r2,g2,b2) \
+ int y1 = (c2y_yb[b1] + c2y_yg[g1] + c2y_yr[r1] + 0x108000) >> 16; \
+ int y2 = (c2y_yb[b2] + c2y_yg[g2] + c2y_yr[r2] + 0x108000) >> 16; \
+\
+ int scaled_y = (y1+y2-32) * cy_cy2; \
+\
+ unsigned char u = Clip[(((((b1+b2)<<15) - scaled_y) >> 10) * c2y_cu + 0x800000 + 0x8000) >> 16]; \
+ unsigned char v = Clip[(((((r1+r2)<<15) - scaled_y) >> 10) * c2y_cv + 0x800000 + 0x8000) >> 16]; \
+
+//
+// CMemSubPic
+//
+
+CMemSubPic::CMemSubPic(SubPicDesc& spd)
+ : m_spd(spd)
+{
+ m_maxsize.SetSize(spd.w, spd.h);
+ m_rcDirty.SetRect(0, 0, spd.w, spd.h);
+}
+
+CMemSubPic::~CMemSubPic()
+{
+ delete [] m_spd.bits, m_spd.bits = NULL;
+}
+
+// ISubPic
+
+STDMETHODIMP_(void*) CMemSubPic::GetObject()
+{
+ return (void*)&m_spd;
+}
+
+STDMETHODIMP CMemSubPic::GetDesc(SubPicDesc& spd)
+{
+ spd.type = m_spd.type;
+ spd.w = m_size.cx;
+ spd.h = m_size.cy;
+ spd.bpp = m_spd.bpp;
+ spd.pitch = m_spd.pitch;
+ spd.bits = m_spd.bits;
+ spd.bitsU = m_spd.bitsU;
+ spd.bitsV = m_spd.bitsV;
+ spd.vidrect = m_vidrect;
+
+ return S_OK;
+}
+
+STDMETHODIMP CMemSubPic::CopyTo(ISubPic* pSubPic)
+{
+ HRESULT hr;
+ if(FAILED(hr = __super::CopyTo(pSubPic)))
+ return hr;
+
+ SubPicDesc src, dst;
+ if(FAILED(GetDesc(src)) || FAILED(pSubPic->GetDesc(dst)))
+ return E_FAIL;
+
+ int w = m_rcDirty.Width(), h = m_rcDirty.Height();
+
+ BYTE* s = (BYTE*)src.bits + src.pitch*m_rcDirty.top + m_rcDirty.left*4;
+ BYTE* d = (BYTE*)dst.bits + dst.pitch*m_rcDirty.top + m_rcDirty.left*4;
+
+ for(int j = 0; j < h; j++, s += src.pitch, d += dst.pitch)
+ memcpy(d, s, w*4);
+
+ return S_OK;
+}
+
+STDMETHODIMP CMemSubPic::ClearDirtyRect(DWORD color)
+{
+ if(m_rcDirty.IsRectEmpty())
+ return S_FALSE;
+
+ BYTE* p = (BYTE*)m_spd.bits + m_spd.pitch*m_rcDirty.top + m_rcDirty.left*(m_spd.bpp>>3);
+ for(int j = 0, h = m_rcDirty.Height(); j < h; j++, p += m_spd.pitch)
+ {
+// memsetd(p, 0, m_rcDirty.Width());
+
+ int w = m_rcDirty.Width();
+ __asm
+ {
+ mov eax, color
+ mov ecx, w
+ mov edi, p
+ cld
+ rep stosd
+ }
+ }
+
+ m_rcDirty.SetRectEmpty();
+
+ return S_OK;
+}
+
+STDMETHODIMP CMemSubPic::Lock(SubPicDesc& spd)
+{
+ return GetDesc(spd);
+}
+
+STDMETHODIMP CMemSubPic::Unlock(RECT* pDirtyRect)
+{
+ m_rcDirty = pDirtyRect ? *pDirtyRect : CRect(0,0,m_spd.w,m_spd.h);
+
+ if(m_rcDirty.IsRectEmpty())
+ return S_OK;
+
+ if(m_spd.type == MSP_YUY2 || m_spd.type == MSP_YV12 || m_spd.type == MSP_IYUV || m_spd.type == MSP_AYUV)
+ {
+ ColorConvInit();
+
+ if(m_spd.type == MSP_YUY2 || m_spd.type == MSP_YV12 || m_spd.type == MSP_IYUV)
+ {
+ m_rcDirty.left &= ~1;
+ m_rcDirty.right = (m_rcDirty.right+1)&~1;
+
+ if(m_spd.type == MSP_YV12 || m_spd.type == MSP_IYUV)
+ {
+ m_rcDirty.top &= ~1;
+ m_rcDirty.bottom = (m_rcDirty.bottom+1)&~1;
+ }
+ }
+ }
+
+ int w = m_rcDirty.Width(), h = m_rcDirty.Height();
+
+ BYTE* top = (BYTE*)m_spd.bits + m_spd.pitch*m_rcDirty.top + m_rcDirty.left*4;
+ BYTE* bottom = top + m_spd.pitch*h;
+
+ if(m_spd.type == MSP_RGB16)
+ {
+ for(; top < bottom ; top += m_spd.pitch)
+ {
+ DWORD* s = (DWORD*)top;
+ DWORD* e = s + w;
+ for(; s < e; s++)
+ {
+ *s = ((*s>>3)&0x1f000000)|((*s>>8)&0xf800)|((*s>>5)&0x07e0)|((*s>>3)&0x001f);
+// *s = (*s&0xff000000)|((*s>>8)&0xf800)|((*s>>5)&0x07e0)|((*s>>3)&0x001f);
+ }
+ }
+ }
+ else if(m_spd.type == MSP_RGB15)
+ {
+ for(; top < bottom; top += m_spd.pitch)
+ {
+ DWORD* s = (DWORD*)top;
+ DWORD* e = s + w;
+ for(; s < e; s++)
+ {
+ *s = ((*s>>3)&0x1f000000)|((*s>>9)&0x7c00)|((*s>>6)&0x03e0)|((*s>>3)&0x001f);
+// *s = (*s&0xff000000)|((*s>>9)&0x7c00)|((*s>>6)&0x03e0)|((*s>>3)&0x001f);
+ }
+ }
+ }
+ else if(m_spd.type == MSP_YUY2 || m_spd.type == MSP_YV12 || m_spd.type == MSP_IYUV)
+ {
+ for(; top < bottom ; top += m_spd.pitch)
+ {
+ BYTE* s = top;
+ BYTE* e = s + w*4;
+ for(; s < e; s+=8) // ARGB ARGB -> AxYU AxYV
+ {
+ if((s[3]+s[7]) < 0x1fe)
+ {
+ s[1] = (c2y_yb[s[0]] + c2y_yg[s[1]] + c2y_yr[s[2]] + 0x108000) >> 16;
+ s[5] = (c2y_yb[s[4]] + c2y_yg[s[5]] + c2y_yr[s[6]] + 0x108000) >> 16;
+
+ int scaled_y = (s[1]+s[5]-32) * cy_cy2;
+
+ s[0] = Clip[(((((s[0]+s[4])<<15) - scaled_y) >> 10) * c2y_cu + 0x800000 + 0x8000) >> 16];
+ s[4] = Clip[(((((s[2]+s[6])<<15) - scaled_y) >> 10) * c2y_cv + 0x800000 + 0x8000) >> 16];
+ }
+ else
+ {
+ s[1] = s[5] = 0x10;
+ s[0] = s[4] = 0x80;
+ }
+ }
+ }
+ }
+ else if(m_spd.type == MSP_AYUV)
+ {
+ for(; top < bottom ; top += m_spd.pitch)
+ {
+ BYTE* s = top;
+ BYTE* e = s + w*4;
+ for(; s < e; s+=4) // ARGB -> AYUV
+ {
+ if(s[3] < 0xff)
+ {
+ int y = (c2y_yb[s[0]] + c2y_yg[s[1]] + c2y_yr[s[2]] + 0x108000) >> 16;
+ int scaled_y = (y-32) * cy_cy;
+ s[1] = Clip[((((s[0]<<16) - scaled_y) >> 10) * c2y_cu + 0x800000 + 0x8000) >> 16];
+ s[0] = Clip[((((s[2]<<16) - scaled_y) >> 10) * c2y_cv + 0x800000 + 0x8000) >> 16];
+ s[2] = y;
+ }
+ else
+ {
+ s[0] = s[1] = 0x80;
+ s[2] = 0x10;
+ }
+ }
+ }
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP CMemSubPic::AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget)
+{
+ ASSERT(pTarget);
+
+ if(!pSrc || !pDst || !pTarget)
+ return E_POINTER;
+
+ const SubPicDesc& src = m_spd;
+ SubPicDesc dst = *pTarget; // copy, because we might modify it
+
+ if(src.type != dst.type)
+ return E_INVALIDARG;
+
+ CRect rs(*pSrc), rd(*pDst);
+
+ if(dst.h < 0)
+ {
+ dst.h = -dst.h;
+ rd.bottom = dst.h - rd.bottom;
+ rd.top = dst.h - rd.top;
+ }
+
+ if(rs.Width() != rd.Width() || rs.Height() != abs(rd.Height()))
+ return E_INVALIDARG;
+
+ int w = rs.Width(), h = rs.Height();
+
+ BYTE* s = (BYTE*)src.bits + src.pitch*rs.top + rs.left*4;
+ BYTE* d = (BYTE*)dst.bits + dst.pitch*rd.top + ((rd.left*dst.bpp)>>3);
+
+ if(rd.top > rd.bottom)
+ {
+ if(dst.type == MSP_RGB32 || dst.type == MSP_RGB24
+ || dst.type == MSP_RGB16 || dst.type == MSP_RGB15
+ || dst.type == MSP_YUY2 || dst.type == MSP_AYUV)
+ {
+ d = (BYTE*)dst.bits + dst.pitch*(rd.top-1) + (rd.left*dst.bpp>>3);
+ }
+ else if(dst.type == MSP_YV12 || dst.type == MSP_IYUV)
+ {
+ d = (BYTE*)dst.bits + dst.pitch*(rd.top-1) + (rd.left*8>>3);
+ }
+ else
+ {
+ return E_NOTIMPL;
+ }
+
+ dst.pitch = -dst.pitch;
+ }
+
+ for(int j = 0; j < h; j++, s += src.pitch, d += dst.pitch)
+ {
+ if(dst.type == MSP_RGB32 || dst.type == MSP_AYUV)
+ {
+ BYTE* s2 = s;
+ BYTE* s2end = s2 + w*4;
+ DWORD* d2 = (DWORD*)d;
+ for(; s2 < s2end; s2 += 4, d2++)
+ {
+ if(s2[3] < 0xff)
+ {
+ *d2 = (((((*d2&0x00ff00ff)*s2[3])>>8) + (*((DWORD*)s2)&0x00ff00ff))&0x00ff00ff)
+ | (((((*d2&0x0000ff00)*s2[3])>>8) + (*((DWORD*)s2)&0x0000ff00))&0x0000ff00);
+ }
+ }
+ }
+ else if(dst.type == MSP_RGB24)
+ {
+ BYTE* s2 = s;
+ BYTE* s2end = s2 + w*4;
+ BYTE* d2 = d;
+ for(; s2 < s2end; s2 += 4, d2 += 3)
+ {
+ if(s2[3] < 0xff)
+ {
+ d2[0] = ((d2[0]*s2[3])>>8) + s2[0];
+ d2[1] = ((d2[1]*s2[3])>>8) + s2[1];
+ d2[2] = ((d2[2]*s2[3])>>8) + s2[2];
+ }
+ }
+ }
+ else if(dst.type == MSP_RGB16)
+ {
+ BYTE* s2 = s;
+ BYTE* s2end = s2 + w*4;
+ WORD* d2 = (WORD*)d;
+ for(; s2 < s2end; s2 += 4, d2++)
+ {
+ if(s2[3] < 0x1f)
+ {
+
+ *d2 = (WORD)((((((*d2&0xf81f)*s2[3])>>5) + (*(DWORD*)s2&0xf81f))&0xf81f)
+ | (((((*d2&0x07e0)*s2[3])>>5) + (*(DWORD*)s2&0x07e0))&0x07e0));
+/* *d2 = (WORD)((((((*d2&0xf800)*s2[3])>>8) + (*(DWORD*)s2&0xf800))&0xf800)
+ | (((((*d2&0x07e0)*s2[3])>>8) + (*(DWORD*)s2&0x07e0))&0x07e0)
+ | (((((*d2&0x001f)*s2[3])>>8) + (*(DWORD*)s2&0x001f))&0x001f));
+*/
+ }
+ }
+ }
+ else if(dst.type == MSP_RGB15)
+ {
+ BYTE* s2 = s;
+ BYTE* s2end = s2 + w*4;
+ WORD* d2 = (WORD*)d;
+ for(; s2 < s2end; s2 += 4, d2++)
+ {
+ if(s2[3] < 0x1f)
+ {
+ *d2 = (WORD)((((((*d2&0x7c1f)*s2[3])>>5) + (*(DWORD*)s2&0x7c1f))&0x7c1f)
+ | (((((*d2&0x03e0)*s2[3])>>5) + (*(DWORD*)s2&0x03e0))&0x03e0));
+/* *d2 = (WORD)((((((*d2&0x7c00)*s2[3])>>8) + (*(DWORD*)s2&0x7c00))&0x7c00)
+ | (((((*d2&0x03e0)*s2[3])>>8) + (*(DWORD*)s2&0x03e0))&0x03e0)
+ | (((((*d2&0x001f)*s2[3])>>8) + (*(DWORD*)s2&0x001f))&0x001f));
+*/ }
+ }
+ }
+ else if(dst.type == MSP_YUY2)
+ {
+// BYTE y1, y2, u, v;
+ unsigned int ia, c;
+
+ BYTE* s2 = s;
+ BYTE* s2end = s2 + w*4;
+ DWORD* d2 = (DWORD*)d;
+ for(; s2 < s2end; s2 += 8, d2++)
+ {
+ ia = (s2[3]+s2[7])>>1;
+ if(ia < 0xff)
+ {
+/* y1 = (BYTE)(((((*d2&0xff)-0x10)*s2[3])>>8) + s2[1]); // + y1;
+ y2 = (BYTE)((((((*d2>>16)&0xff)-0x10)*s2[7])>>8) + s2[5]); // + y2;
+ u = (BYTE)((((((*d2>>8)&0xff)-0x80)*ia)>>8) + s2[0]); // + u;
+ v = (BYTE)((((((*d2>>24)&0xff)-0x80)*ia)>>8) + s2[4]); // + v;
+
+ *d2 = (v<<24)|(y2<<16)|(u<<8)|y1;
+*/
+ static const __int64 _8181 = 0x0080001000800010i64;
+
+ ia = (ia<<24)|(s2[7]<<16)|(ia<<8)|s2[3];
+ c = (s2[4]<<24)|(s2[5]<<16)|(s2[0]<<8)|s2[1]; // (v<<24)|(y2<<16)|(u<<8)|y1;
+
+ __asm
+ {
+ mov esi, s2
+ mov edi, d2
+ pxor mm0, mm0
+ movq mm1, _8181
+ movd mm2, c
+ punpcklbw mm2, mm0
+ movd mm3, [edi]
+ punpcklbw mm3, mm0
+ movd mm4, ia
+ punpcklbw mm4, mm0
+ psrlw mm4, 1
+ psubsw mm3, mm1
+ pmullw mm3, mm4
+ psraw mm3, 7
+ paddsw mm3, mm2
+ packuswb mm3, mm3
+ movd [edi], mm3
+ };
+ }
+ }
+ }
+ else if(dst.type == MSP_YV12 || dst.type == MSP_IYUV)
+ {
+ BYTE* s2 = s;
+ BYTE* s2end = s2 + w*4;
+ BYTE* d2 = d;
+ for(; s2 < s2end; s2 += 4, d2++)
+ {
+ if(s2[3] < 0xff)
+ {
+ d2[0] = (((d2[0]-0x10)*s2[3])>>8) + s2[1];
+ }
+ }
+ }
+ else
+ {
+ return E_NOTIMPL;
+ }
+ }
+
+ dst.pitch = abs(dst.pitch);
+
+ if(dst.type == MSP_YV12 || dst.type == MSP_IYUV)
+ {
+ int w2 = w/2, h2 = h/2;
+
+ if(!dst.pitchUV)
+ {
+ dst.pitchUV = dst.pitch/2;
+ }
+
+ int sizep4 = dst.pitchUV*dst.h/2;
+
+ BYTE* ss[2];
+ ss[0] = (BYTE*)src.bits + src.pitch*rs.top + rs.left*4;
+ ss[1] = ss[0] + 4;
+
+ if(!dst.bitsU || !dst.bitsV)
+ {
+ dst.bitsU = (BYTE*)dst.bits + dst.pitch*dst.h;
+ dst.bitsV = dst.bitsU + dst.pitchUV*dst.h/2;
+
+ if(dst.type == MSP_YV12)
+ {
+ BYTE* p = dst.bitsU;
+ dst.bitsU = dst.bitsV;
+ dst.bitsV = p;
+ }
+ }
+
+ BYTE* dd[2];
+ dd[0] = dst.bitsU + dst.pitchUV*rd.top/2 + rd.left/2;
+ dd[1] = dst.bitsV + dst.pitchUV*rd.top/2 + rd.left/2;
+
+ if(rd.top > rd.bottom)
+ {
+ dd[0] = dst.bitsU + dst.pitchUV*(rd.top/2-1) + rd.left/2;
+ dd[1] = dst.bitsV + dst.pitchUV*(rd.top/2-1) + rd.left/2;
+ dst.pitchUV = -dst.pitchUV;
+ }
+
+ for(int i = 0; i < 2; i++)
+ {
+ s = ss[i]; d = dd[i];
+ BYTE* is = ss[1-i];
+ for(int j = 0; j < h2; j++, s += src.pitch*2, d += dst.pitchUV, is += src.pitch*2)
+ {
+ BYTE* s2 = s;
+ BYTE* s2end = s2 + w*4;
+ BYTE* d2 = d;
+ BYTE* is2 = is;
+ for(; s2 < s2end; s2 += 8, d2++, is2 += 8)
+ {
+ unsigned int ia = (s2[3]+s2[3+src.pitch]+is2[3]+is2[3+src.pitch])>>2;
+ if(ia < 0xff)
+ {
+ *d2 = (((*d2-0x80)*ia)>>8) + ((s2[0]+s2[src.pitch])>>1);
+ }
+ }
+ }
+ }
+ }
+
+ __asm emms;
+
+ return S_OK;
+}
+
+//
+// CMemSubPicAllocator
+//
+
+CMemSubPicAllocator::CMemSubPicAllocator(int type, SIZE maxsize)
+ : ISubPicAllocatorImpl(maxsize, false, false)
+ , m_type(type)
+ , m_maxsize(maxsize)
+{
+}
+
+// ISubPicAllocatorImpl
+
+bool CMemSubPicAllocator::Alloc(bool fStatic, ISubPic** ppSubPic)
+{
+ if(!ppSubPic)
+ return(false);
+
+ SubPicDesc spd;
+ spd.w = m_maxsize.cx;
+ spd.h = m_maxsize.cy;
+ spd.bpp = 32;
+ spd.pitch = (spd.w*spd.bpp)>>3;
+ spd.type = m_type;
+ if(!(spd.bits = new BYTE[spd.pitch*spd.h]))
+ return(false);
+
+ if(!(*ppSubPic = new CMemSubPic(spd)))
+ return(false);
+
+ (*ppSubPic)->AddRef();
+
+ return(true);
+}
diff --git a/src/subpic/MemSubPic.h b/src/subpic/MemSubPic.h
new file mode 100644
index 000000000..b41bb4b76
--- /dev/null
+++ b/src/subpic/MemSubPic.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "ISubPic.h"
+
+enum {MSP_RGB32,MSP_RGB24,MSP_RGB16,MSP_RGB15,MSP_YUY2,MSP_YV12,MSP_IYUV,MSP_AYUV};
+
+// CMemSubPic
+
+class CMemSubPic : public ISubPicImpl
+{
+ SubPicDesc m_spd;
+
+protected:
+ STDMETHODIMP_(void*) GetObject(); // returns SubPicDesc*
+
+public:
+ CMemSubPic(SubPicDesc& spd);
+ virtual ~CMemSubPic();
+
+ // ISubPic
+ STDMETHODIMP GetDesc(SubPicDesc& spd);
+ STDMETHODIMP CopyTo(ISubPic* pSubPic);
+ STDMETHODIMP ClearDirtyRect(DWORD color);
+ STDMETHODIMP Lock(SubPicDesc& spd);
+ STDMETHODIMP Unlock(RECT* pDirtyRect);
+ STDMETHODIMP AlphaBlt(RECT* pSrc, RECT* pDst, SubPicDesc* pTarget);
+};
+
+// CMemSubPicAllocator
+
+class CMemSubPicAllocator : public ISubPicAllocatorImpl
+{
+ int m_type;
+ CSize m_maxsize;
+
+ bool Alloc(bool fStatic, ISubPic** ppSubPic);
+
+public:
+ CMemSubPicAllocator(int type, SIZE maxsize);
+};
+
diff --git a/src/subpic/stdafx.cpp b/src/subpic/stdafx.cpp
new file mode 100644
index 000000000..59020e2ef
--- /dev/null
+++ b/src/subpic/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// subpic.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/subpic/stdafx.h b/src/subpic/stdafx.h
new file mode 100644
index 000000000..bb3e2754b
--- /dev/null
+++ b/src/subpic/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#include <dvdmedia.h>
+#include "..\DSUtil\DSUtil.h"
diff --git a/src/subpic/subpic.sln b/src/subpic/subpic.sln
new file mode 100644
index 000000000..0067cddc9
--- /dev/null
+++ b/src/subpic/subpic.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subpic", "subpic.vcproj", "{D514EA4D-EAFB-47A9-A437-A582CA571251}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug.ActiveCfg = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug.Build.0 = Debug|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release.ActiveCfg = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release.Build.0 = Release|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {D514EA4D-EAFB-47A9-A437-A582CA571251}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/subpic/subpic.vcproj b/src/subpic/subpic.vcproj
new file mode 100644
index 000000000..ca95e217a
--- /dev/null
+++ b/src/subpic/subpic.vcproj
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="subpic"
+ ProjectGUID="{D514EA4D-EAFB-47A9-A437-A582CA571251}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="d3d9.lib ddraw.lib"
+ OutputFile="../../lib/$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="d3d9.lib ddraw.lib"
+ OutputFile="../../lib/$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="d3d9.lib ddraw.lib"
+ OutputFile="../../lib/$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="d3d9.lib ddraw.lib"
+ OutputFile="../../lib/$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath=".\CoordGeom.cpp">
+ </File>
+ <File
+ RelativePath="DX7SubPic.cpp">
+ </File>
+ <File
+ RelativePath="DX9SubPic.cpp">
+ </File>
+ <File
+ RelativePath="ISubPic.cpp">
+ </File>
+ <File
+ RelativePath="MemSubPic.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath=".\CoordGeom.h">
+ </File>
+ <File
+ RelativePath="DX7SubPic.h">
+ </File>
+ <File
+ RelativePath="DX9SubPic.h">
+ </File>
+ <File
+ RelativePath="ISubPic.h">
+ </File>
+ <File
+ RelativePath="MemSubPic.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="1"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/subpic/subpic.vcproj.vspscc b/src/subpic/subpic.vcproj.vspscc
new file mode 100644
index 000000000..2d370f91c
--- /dev/null
+++ b/src/subpic/subpic.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:subpic"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/src/subtitles/CCDecoder.cpp b/src/subtitles/CCDecoder.cpp
new file mode 100644
index 000000000..503b4af5e
--- /dev/null
+++ b/src/subtitles/CCDecoder.cpp
@@ -0,0 +1,384 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "ccdecoder.h"
+
+CCDecoder::CCDecoder(CString fn, CString rawfn) : m_fn(fn), m_rawfn(rawfn)
+{
+ m_sts.CreateDefaultStyle(ANSI_CHARSET);
+
+ m_time = 0;
+ m_fEndOfCaption = false;
+ memset(m_buff, 0, sizeof(m_buff));
+ memset(m_disp, 0, sizeof(m_disp));
+ m_cursor = CPoint(0, 0);
+
+ if(!m_rawfn.IsEmpty())
+ _tremove(m_rawfn);
+}
+
+CCDecoder::~CCDecoder()
+{
+ if(!m_sts.IsEmpty() && !m_fn.IsEmpty())
+ {
+ m_sts.Sort();
+ m_sts.SaveAs(m_fn, EXTSRT, -1, CTextFile::ASCII);
+ m_sts.SaveAs(m_fn.Left(m_fn.ReverseFind('.')+1) + _T("utf8.srt"), EXTSRT, -1, CTextFile::UTF8);
+ m_sts.SaveAs(m_fn.Left(m_fn.ReverseFind('.')+1) + _T("utf16le.srt"), EXTSRT, -1, CTextFile::LE16);
+ m_sts.SaveAs(m_fn.Left(m_fn.ReverseFind('.')+1) + _T("utf16be.srt"), EXTSRT, -1, CTextFile::BE16);
+ }
+}
+
+void CCDecoder::MoveCursor(int x, int y)
+{
+ m_cursor = CPoint(x, y);
+ if(m_cursor.x < 0) m_cursor.x = 0;
+ if(m_cursor.y < 0) m_cursor.y = 0;
+ if(m_cursor.x >= 32) m_cursor.x = 0, m_cursor.y++;
+ if(m_cursor.y >= 16) m_cursor.y = 0;
+}
+
+void CCDecoder::OffsetCursor(int x, int y)
+{
+ MoveCursor(m_cursor.x + x, m_cursor.y + y);
+}
+
+void CCDecoder::PutChar(WCHAR c)
+{
+ m_buff[m_cursor.y][m_cursor.x] = c;
+ OffsetCursor(1, 0);
+}
+
+void CCDecoder::SaveDisp(__int64 time)
+{
+ CStringW str;
+
+ for(int row = 0; row < 16; row++)
+ {
+ bool fNonEmptyRow = false;
+
+ for(int col = 0; col < 32; col++)
+ {
+ if(m_disp[row][col])
+ {
+ CStringW str2(&m_disp[row][col]);
+ if(fNonEmptyRow) str += ' ';
+ str += str2;
+ col += str2.GetLength();
+ fNonEmptyRow = true;
+ }
+ }
+
+ if(fNonEmptyRow) str += '\n';
+ }
+
+ if(str.IsEmpty()) return;
+
+ m_sts.Add(str, true, (int)m_time, (int)time);
+}
+
+void CCDecoder::DecodeCC(BYTE* buff, int len, __int64 time)
+{
+ if(!m_rawfn.IsEmpty())
+ {
+ if(FILE* f = _tfopen(m_rawfn, _T("at")))
+ {
+ _ftprintf(f, _T("%02d:%02d:%02d.%03d\n"),
+ (int)(time/1000/60/60),
+ (int)((time/1000/60)%60),
+ (int)((time/1000)%60),
+ (int)(time%1000));
+
+ for(int i = 0; i < len; i++)
+ {
+ _ftprintf(f, _T("%02x"), buff[i]);
+ if(i < len-1) _ftprintf(f, _T(" "));
+ if(i > 0 && (i&15)==15) _ftprintf(f, _T("\n"));
+ }
+ if(len > 0) _ftprintf(f, _T("\n\n"));
+ fclose(f);
+ }
+ }
+
+ for(int i = 0; i < len; i++)
+ {
+ BYTE c = buff[i]&0x7f;
+ if(c >= 0x20)
+ {
+ static WCHAR charmap[0x60] =
+ {
+ ' ','!','"','#','$','%','&','\'','(',')','á','+',',','-','.','/',
+ '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?',
+ '@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
+ 'P','Q','R','S','T','U','V','W','X','Y','Z','[','é',']','í','ó',
+ 'ú','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o',
+ 'p','q','r','s','t','u','v','w','x','y','z','ç','÷','N','n','?'
+ };
+
+ PutChar(charmap[c - 0x20]);
+ }
+ else if(buff[i] != 0x80 && i < len-1)
+ {
+ // codes and special characters are supposed to be doubled
+ if(i < len-3 && buff[i] == buff[i+2] && buff[i+1] == buff[i+3])
+ i += 2;
+
+ c = buff[i+1]&0x7f;
+ if(buff[i] == 0x91 && c >= 0x20 && c < 0x30) // formating
+ {
+ // TODO
+ }
+ else if(buff[i] == 0x91 && c == 0x39) // transparent space
+ {
+ OffsetCursor(1, 0);
+ }
+ else if(buff[i] == 0x91 && c >= 0x30 && c < 0x40) // special characters
+ {
+ static WCHAR charmap[0x10] =
+ {
+ 0x00ae, // (r)egistered
+ 0x00b0, // degree
+ 0x00bd, // 1/2
+ 0x00bf, // inverted question mark
+ 0x2122, // trade mark
+ 0x00a2, // cent
+ 0x00a3, // pound
+ 0x266a, // music
+ 0x00e0, // a`
+ 0x00ff, // transparent space, handled above
+ 0x00e8, // e`
+ 0x00e2, // a^
+ 0x00ea, // e^
+ 0x00ee, // i^
+ 0x00f4, // o^
+ 0x00fb, // u^
+ };
+
+ PutChar(charmap[c - 0x30]);
+ }
+ else if(buff[i] == 0x92 && c >= 0x20 && c < 0x40) // extended characters
+ {
+ static WCHAR charmap[0x20] =
+ {
+ 0x00c0, // A'
+ 0x00c9, // E'
+ 0x00d3, // O'
+ 0x00da, // U'
+ 0x00dc, // U:
+ 0x00fc, // u:
+ 0x2018, // `
+ 0x00a1, // inverted !
+ 0x002a, // *
+ 0x2019, // '
+ 0x002d, // -
+ 0x00a9, // (c)opyright
+ 0x2120, // SM
+ 0x00b7, // . (dot in the middle)
+ 0x201c, // inverted "
+ 0x201d, // "
+
+ 0x00c1, // A`
+ 0x00c2, // A^
+ 0x00c7, // C,
+ 0x00c8, // E`
+ 0x00ca, // E^
+ 0x00cb, // E:
+ 0x00eb, // e:
+ 0x00ce, // I^
+ 0x00cf, // I:
+ 0x00ef, // i:
+ 0x00d4, // O^
+ 0x00d9, // U`
+ 0x00f9, // u`
+ 0x00db, // U^
+ 0x00ab, // <<
+ 0x00bb, // >>
+ };
+
+ PutChar(charmap[c - 0x20]);
+ }
+ else if(buff[i] == 0x13 && c >= 0x20 && c < 0x40) // more extended characters
+ {
+ static WCHAR charmap[0x20] =
+ {
+ 0x00c3, // A~
+ 0x00e3, // a~
+ 0x00cd, // I'
+ 0x00cc, // I`
+ 0x00ec, // i`
+ 0x00d2, // O`
+ 0x00f2, // o`
+ 0x00d5, // O~
+ 0x00f5, // o~
+ 0x007b, // {
+ 0x007d, // }
+ 0x005c, // /* \ */
+ 0x005e, // ^
+ 0x005f, // _
+ 0x00a6, // |
+ 0x007e, // ~
+
+ 0x00c4, // A:
+ 0x00e4, // a:
+ 0x00d6, // O:
+ 0x00f6, // o:
+ 0x00df, // B (ss in german)
+ 0x00a5, // Y=
+ 0x00a4, // ox
+ 0x007c, // |
+ 0x00c5, // Ao
+ 0x00e5, // ao
+ 0x00d8, // O/
+ 0x00f8, // o/
+ 0x250c, // |-
+ 0x2510, // -|
+ 0x2514, // |_
+ 0x2518, // _|
+ };
+
+ PutChar(charmap[c - 0x20]);
+ }
+ else if(buff[i] == 0x94 && buff[i+1] == 0xae) // Erase Non-displayed [buffer] Memory
+ {
+ memset(m_buff, 0, sizeof(m_buff));
+ }
+ else if(buff[i] == 0x94 && buff[i+1] == 0x20) // Resume Caption Loading
+ {
+ memset(m_buff, 0, sizeof(m_buff));
+ }
+ else if(buff[i] == 0x94 && buff[i+1] == 0x2f) // End Of Caption
+ {
+ if(memcmp(m_disp, m_buff, sizeof(m_disp)) != 0)
+ {
+ if(m_fEndOfCaption)
+ SaveDisp(time + (i/2)*1000/30);
+
+ m_fEndOfCaption = true;
+ memcpy(m_disp, m_buff, sizeof(m_disp));
+ m_time = time + (i/2)*1000/30;
+ }
+ }
+ else if(buff[i] == 0x94 && buff[i+1] == 0x2c) // Erase Displayed Memory
+ {
+ if(m_fEndOfCaption)
+ {
+ m_fEndOfCaption = false;
+ SaveDisp(time + (i/2)*1000/30);
+ }
+
+ memset(m_disp, 0, sizeof(m_disp));
+ }
+ else if(buff[i] == 0x97 && (buff[i+1] == 0xa1 || buff[i+1] == 0xa2 || buff[i+1] == 0x23)) // Tab Over
+ {
+ OffsetCursor(buff[i+1]&3, 0);
+ }
+ else if(buff[i] == 0x91 || buff[i] == 0x92 || buff[i] == 0x15 || buff[i] == 0x16
+ || buff[i] == 0x97 || buff[i] == 0x10 || buff[i] == 0x13 || buff[i] == 0x94) // curpos, color, underline
+ {
+ int row = 0;
+ switch(buff[i])
+ {
+ default:
+ case 0x91: row = 0; break;
+ case 0x92: row = 2; break;
+ case 0x15: row = 4; break;
+ case 0x16: row = 6; break;
+ case 0x97: row = 8; break;
+ case 0x10: row = 10; break;
+ case 0x13: row = 12; break;
+ case 0x94: row = 14; break;
+ }
+ if(buff[i+1]&0x20) row++;
+
+ int col = buff[i+1]&0xe;
+ if(col == 0 || (col > 0 && !(buff[i+1]&0x10))) col = 0;
+ else col <<= 1;
+
+ MoveCursor(col, row);
+ }
+ else
+ {
+ int iiii = 0;
+ }
+
+ i++;
+ }
+ }
+}
+
+void CCDecoder::ExtractCC(BYTE* buff, int len, __int64 time)
+{
+ for(int i = 0; i < len-9; i++)
+ {
+ if(*(DWORD*)&buff[i] == 0xb2010000 && *(DWORD*)&buff[i+4] == 0xf8014343)
+ {
+ i += 8;
+ int nBytes = buff[i++]&0x3f;
+ if(nBytes > 0)
+ {
+ nBytes = (nBytes+1)&~1;
+
+ BYTE* pData1 = new BYTE[nBytes];
+ BYTE* pData2 = new BYTE[nBytes];
+
+ if(pData1 && pData2)
+ {
+ int nBytes1 = 0, nBytes2 = 0;
+
+ for(int j = 0; j < nBytes && i < 0x800;)
+ {
+ if(buff[i++] == 0xff)
+ {
+ pData1[nBytes1++] = buff[i++];
+ pData1[nBytes1++] = buff[i++];
+ }
+ else i+=2;
+
+ j++;
+
+ if(j >= nBytes) break;
+
+ if(buff[i++] == 0xff)
+ {
+ pData2[nBytes2++] = buff[i++];
+ pData2[nBytes2++] = buff[i++];
+ }
+ else i+=2;
+
+ j++;
+ }
+
+ if(nBytes1 > 0)
+ DecodeCC(pData1, nBytes1, time);
+
+ if(nBytes2 > 0)
+ DecodeCC(pData2, nBytes2, time);
+ }
+
+ if(pData1) delete [] pData1;
+ if(pData2) delete [] pData2;
+ }
+
+ break;
+ }
+ }
+}
diff --git a/src/subtitles/CCDecoder.h b/src/subtitles/CCDecoder.h
new file mode 100644
index 000000000..5733de9ca
--- /dev/null
+++ b/src/subtitles/CCDecoder.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "STS.h"
+
+class CCDecoder
+{
+ CSimpleTextSubtitle m_sts;
+ CString m_fn, m_rawfn;
+ __int64 m_time;
+ bool m_fEndOfCaption;
+ WCHAR m_buff[16][33], m_disp[16][33];
+ CPoint m_cursor;
+
+ void SaveDisp(__int64 time);
+ void MoveCursor(int x, int y);
+ void OffsetCursor(int x, int y);
+ void PutChar(WCHAR c);
+
+public:
+ CCDecoder(CString fn = _T(""), CString rawfn = _T(""));
+ virtual ~CCDecoder();
+ void DecodeCC(BYTE* buff, int len, __int64 time);
+ void ExtractCC(BYTE* buff, int len, __int64 time);
+ CSimpleTextSubtitle& GetSTS() {return m_sts;}
+};
+
+
diff --git a/src/subtitles/GFN.cpp b/src/subtitles/GFN.cpp
new file mode 100644
index 000000000..4318a2aa1
--- /dev/null
+++ b/src/subtitles/GFN.cpp
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <io.h>
+#include "TextFile.h"
+#include "GFN.h"
+
+TCHAR* exttypestr[] =
+{
+ _T("srt"), _T("sub"), _T("smi"), _T("psb"),
+ _T("ssa"), _T("ass"), _T("idx"), _T("usf"),
+ _T("xss"), _T("txt"), _T("ssf")
+};
+
+static TCHAR* ext[2][countof(exttypestr)] =
+{
+ {
+ _T(".srt"), _T(".sub"), _T(".smi"), _T(".psb"),
+ _T(".ssa"), _T(".ass"), _T(".idx"), _T(".usf"),
+ _T(".xss"), _T(".txt"), _T(".ssf")
+ },
+ {
+ _T(".*.srt"), _T(".*.sub"), _T(".*.smi"), _T(".*.psb"),
+ _T(".*.ssa"), _T(".*.ass"), _T(".*.dummyidx"), _T(".*.usf"),
+ _T(".*.xss"), _T(".*.txt"), _T(".*.ssf")
+ },
+};
+
+#define WEBSUBEXT _T(".wse")
+
+static int SubFileCompare(const void* elem1, const void* elem2)
+{
+ return(((SubFile*)elem1)->fn.CompareNoCase(((SubFile*)elem2)->fn));
+}
+
+void GetSubFileNames(CString fn, CAtlArray<CString>& paths, CAtlArray<SubFile>& ret)
+{
+ ret.RemoveAll();
+
+ int extlistnum = countof(ext);
+ int extsubnum = countof(ext[0]);
+
+ fn.Replace('\\', '/');
+
+ bool fWeb = false;
+ {
+// int i = fn.Find(_T("://"));
+ int i = fn.Find(_T("http://"));
+ if(i > 0) {fn = _T("http") + fn.Mid(i); fWeb = true;}
+ }
+
+ int l = fn.GetLength(), l2 = l;
+ l2 = fn.ReverseFind('.');
+ l = fn.ReverseFind('/') + 1;
+ if(l2 < l) l2 = l;
+
+ CString orgpath = fn.Left(l);
+ CString title = fn.Mid(l, l2-l);
+ CString filename = title + _T(".nooneexpectsthespanishinquisition");
+
+ if(!fWeb)
+ {
+ // struct _tfinddata_t file, file2;
+ // long hFile, hFile2 = 0;
+
+ WIN32_FIND_DATA wfd, wfd2;
+ HANDLE hFile, hFile2;
+
+ for(int k = 0; k < paths.GetCount(); k++)
+ {
+ CString path = paths[k];
+ path.Replace('\\', '/');
+
+ l = path.GetLength();
+ if(l > 0 && path[l-1] != '/') path += '/';
+
+ if(path.Find(':') == -1 && path.Find(_T("\\\\")) != 0) path = orgpath + path;
+
+ path.Replace(_T("/./"), _T("/"));
+ path.Replace('/', '\\');
+
+ // CAtlList<CString> sl;
+
+ bool fEmpty = true;
+
+ if((hFile = FindFirstFile(path + title + "*", &wfd)) != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if(filename.CompareNoCase(wfd.cFileName) != 0)
+ {
+ fEmpty = false;
+ // sl.AddTail(path + file.name);
+ }
+ }
+ while(FindNextFile(hFile, &wfd));
+
+ FindClose(hFile);
+ }
+
+ // TODO: use 'sl' in the next step to find files (already a nice speedup as it is now...)
+ if(fEmpty) continue;
+
+ for(int j = 0; j < extlistnum; j++)
+ {
+ for(int i = 0; i < extsubnum; i++)
+ {
+ if((hFile = FindFirstFile(path + title + ext[j][i], &wfd)) != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ CString fn = path + wfd.cFileName;
+
+ hFile2 = INVALID_HANDLE_VALUE;
+
+ if(j == 0 || (hFile2 = FindFirstFile(fn.Left(fn.ReverseFind('.')) + _T(".avi"), &wfd2)) == INVALID_HANDLE_VALUE)
+ {
+ SubFile f;
+ f.fn = fn;
+ ret.Add(f);
+ }
+
+ if(hFile2 != INVALID_HANDLE_VALUE)
+ {
+ FindClose(hFile2);
+ }
+ }
+ while(FindNextFile(hFile, &wfd));
+
+ FindClose(hFile);
+ }
+ }
+ }
+ }
+ }
+ else if(l > 7)
+ {
+ CWebTextFile wtf; // :)
+ if(wtf.Open(orgpath + title + WEBSUBEXT))
+ {
+ CString fn;
+ while(wtf.ReadString(fn) && fn.Find(_T("://")) >= 0)
+ {
+ SubFile f;
+ f.fn = fn;
+ ret.Add(f);
+ }
+ }
+ }
+
+ // sort files, this way the user can define the order (movie.00.English.srt, movie.01.Hungarian.srt, etc)
+
+ qsort(ret.GetData(), ret.GetCount(), sizeof(SubFile), SubFileCompare);
+}
diff --git a/src/subtitles/GFN.h b/src/subtitles/GFN.h
new file mode 100644
index 000000000..b6c03b917
--- /dev/null
+++ b/src/subtitles/GFN.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+
+enum exttype {EXTSRT = 0, EXTSUB, EXTSMI, EXTPSB, EXTSSA, EXTASS, EXTIDX, EXTUSF, EXTXSS};
+extern TCHAR* exttypestr[];
+typedef struct {CString fn; /*exttype ext;*/} SubFile;
+extern void GetSubFileNames(CString fn, CAtlArray<CString>& paths, CAtlArray<SubFile>& ret);
diff --git a/src/subtitles/RTS.cpp b/src/subtitles/RTS.cpp
new file mode 100644
index 000000000..f38686bda
--- /dev/null
+++ b/src/subtitles/RTS.cpp
@@ -0,0 +1,2482 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <math.h>
+#include <time.h>
+#include "RTS.h"
+
+// WARNING: this isn't very thread safe, use only one RTS a time.
+static HDC g_hDC;
+static int g_hDC_refcnt = 0;
+
+static long revcolor(long c)
+{
+ return ((c&0xff0000)>>16) + (c&0xff00) + ((c&0xff)<<16);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+// CMyFont
+
+CMyFont::CMyFont(STSStyle& style)
+{
+ LOGFONT lf;
+ memset(&lf, 0, sizeof(lf));
+ lf <<= style;
+ lf.lfHeight = (LONG)(style.fontSize+0.5);
+ lf.lfOutPrecision = OUT_TT_PRECIS;
+ lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ lf.lfQuality = ANTIALIASED_QUALITY;
+ lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE;
+lf.lfEscapement = lf.lfOrientation = 0;
+ if(!CreateFontIndirect(&lf))
+ {
+ _tcscpy(lf.lfFaceName, _T("Arial"));
+ CreateFontIndirect(&lf);
+ }
+
+ HFONT hOldFont = (HFONT)SelectObject(g_hDC, *this);
+ TEXTMETRIC tm;
+ BOOL b = GetTextMetrics(g_hDC, &tm);
+ DWORD ret = GetLastError();
+ m_ascent = ((tm.tmAscent + 4) >> 3);
+ m_descent = ((tm.tmDescent + 4) >> 3);
+ SelectObject(g_hDC, hOldFont);
+}
+
+// CWord
+
+CWord::CWord(STSStyle& style, CStringW str, int ktype, int kstart, int kend)
+ : m_style(style), m_str(str)
+ , m_width(0), m_ascent(0), m_descent(0)
+ , m_ktype(ktype), m_kstart(kstart), m_kend(kend)
+ , m_fDrawn(false), m_p(INT_MAX, INT_MAX)
+ , m_fLineBreak(false), m_fWhiteSpaceChar(false)
+ , m_pOpaqueBox(NULL)
+{
+ if(str.IsEmpty())
+ {
+ m_fWhiteSpaceChar = m_fLineBreak = true;
+ }
+
+ CMyFont font(m_style);
+ m_ascent = (int)(m_style.fontScaleY/100*font.m_ascent);
+ m_descent = (int)(m_style.fontScaleY/100*font.m_descent);
+ m_width = 0;
+}
+
+CWord::~CWord()
+{
+ if(m_pOpaqueBox) delete m_pOpaqueBox;
+}
+
+bool CWord::Append(CWord* w)
+{
+ if(!(m_style == w->m_style)
+ || m_fLineBreak || w->m_fLineBreak
+ || w->m_kstart != w->m_kend || m_ktype != w->m_ktype) return(false);
+
+ m_fWhiteSpaceChar = m_fWhiteSpaceChar && w->m_fWhiteSpaceChar;
+ m_str += w->m_str;
+ m_width += w->m_width;
+
+ m_fDrawn = false;
+ m_p = CPoint(INT_MAX, INT_MAX);
+
+ return(true);
+}
+
+void CWord::Paint(CPoint p, CPoint org)
+{
+ if(!m_str) return;
+
+ if(!m_fDrawn)
+ {
+ if(!CreatePath()) return;
+
+ Transform(CPoint((org.x-p.x)*8, (org.y-p.y)*8));
+
+ if(!ScanConvert()) return;
+
+ if(m_style.borderStyle == 0 && m_style.outlineWidth > 0)
+ {
+ if(!CreateWidenedRegion((int)(m_style.outlineWidth+0.5))) return;
+ }
+ else if(m_style.borderStyle == 1)
+ {
+ if(!CreateOpaqueBox()) return;
+ }
+
+ m_fDrawn = true;
+
+ if(!Rasterize(p.x&7, p.y&7, m_style.fBlur)) return;
+ }
+ else if((m_p.x&7) != (p.x&7) || (m_p.y&7) != (p.y&7))
+ {
+ Rasterize(p.x&7, p.y&7, m_style.fBlur);
+ }
+
+ m_p = p;
+
+ if(m_pOpaqueBox)
+ m_pOpaqueBox->Paint(p, org);
+}
+
+void CWord::Transform(CPoint org)
+{
+ double scalex = m_style.fontScaleX/100;
+ double scaley = m_style.fontScaleY/100;
+
+ double caz = cos((3.1415/180)*m_style.fontAngleZ);
+ double saz = sin((3.1415/180)*m_style.fontAngleZ);
+ double cax = cos((3.1415/180)*m_style.fontAngleX);
+ double sax = sin((3.1415/180)*m_style.fontAngleX);
+ double cay = cos((3.1415/180)*m_style.fontAngleY);
+ double say = sin((3.1415/180)*m_style.fontAngleY);
+
+ for(int i = 0; i < mPathPoints; i++)
+ {
+ double x, y, z, xx, yy, zz;
+
+ x = scalex * mpPathPoints[i].x - org.x;
+ y = scaley * mpPathPoints[i].y - org.y;
+ z = 0;
+
+ xx = x*caz + y*saz;
+ yy = -(x*saz - y*caz);
+ zz = z;
+
+ x = xx;
+ y = yy*cax + zz*sax;
+ z = yy*sax - zz*cax;
+
+ xx = x*cay + z*say;
+ yy = y;
+ zz = x*say - z*cay;
+
+ zz = max(zz, -19000);
+
+ x = (xx * 20000) / (zz + 20000);
+ y = (yy * 20000) / (zz + 20000);
+
+ mpPathPoints[i].x = (LONG)(x + org.x + 0.5);
+ mpPathPoints[i].y = (LONG)(y + org.y + 0.5);
+ }
+}
+
+bool CWord::CreateOpaqueBox()
+{
+ if(m_pOpaqueBox) return(true);
+
+ STSStyle style = m_style;
+ style.borderStyle = 0;
+ style.outlineWidth = 0;
+ style.colors[0] = m_style.colors[2];
+ style.alpha[0] = m_style.alpha[2];
+
+ int w = (int)(m_style.outlineWidth + 0.5);
+
+ CStringW str;
+ str.Format(L"m %d %d l %d %d %d %d %d %d",
+ -w, -w,
+ m_width+w, -w,
+ m_width+w, m_ascent+m_descent+w,
+ -w, m_ascent+m_descent+w);
+
+ m_pOpaqueBox = new CPolygon(style, str, 0, 0, 0, 1.0/8, 1.0/8, 0);
+
+ return(!!m_pOpaqueBox);
+}
+
+// CText
+
+CText::CText(STSStyle& style, CStringW str, int ktype, int kstart, int kend)
+ : CWord(style, str, ktype, kstart, kend)
+{
+ if(m_str.GetLength() == 1 && m_str[0] == ' ')
+ {
+ m_fWhiteSpaceChar = true;
+ }
+
+ CMyFont font(m_style);
+
+ HFONT hOldFont = (HFONT)SelectObject(g_hDC, font);
+
+ if(m_style.fontSpacing || (long)GetVersion() < 0)
+ {
+ bool bFirstPath = true;
+
+ for(LPCWSTR s = m_str; *s; s++)
+ {
+ CSize extent;
+ if(!GetTextExtentPoint32W(g_hDC, s, 1, &extent)) {SelectObject(g_hDC, hOldFont); ASSERT(0); return;}
+ m_width += extent.cx + (int)m_style.fontSpacing;
+ }
+// m_width -= (int)m_style.fontSpacing; // TODO: subtract only at the end of the line
+ }
+ else
+ {
+ CSize extent;
+ if(!GetTextExtentPoint32W(g_hDC, m_str, wcslen(str), &extent)) {SelectObject(g_hDC, hOldFont); ASSERT(0); return;}
+ m_width += extent.cx;
+ }
+
+ m_width = (int)(m_style.fontScaleX/100*m_width + 4) >> 3;
+
+ SelectObject(g_hDC, hOldFont);
+}
+
+CWord* CText::Copy()
+{
+ return(new CText(m_style, m_str, m_ktype, m_kstart, m_kend));
+}
+
+bool CText::Append(CWord* w)
+{
+ return(dynamic_cast<CText*>(w) && CWord::Append(w));
+}
+
+bool CText::CreatePath()
+{
+ CMyFont font(m_style);
+ HFONT hOldFont = (HFONT)SelectObject(g_hDC, font);
+
+ int width = 0;
+
+ if(m_style.fontSpacing || (long)GetVersion() < 0)
+ {
+ bool bFirstPath = true;
+
+ for(LPCWSTR s = m_str; *s; s++)
+ {
+ CSize extent;
+ if(!GetTextExtentPoint32W(g_hDC, s, 1, &extent)) {SelectObject(g_hDC, hOldFont); ASSERT(0); return(false);}
+
+ PartialBeginPath(g_hDC, bFirstPath); bFirstPath = false;
+ TextOutW(g_hDC, 0, 0, s, 1);
+ PartialEndPath(g_hDC, width, 0);
+
+ width += extent.cx + (int)m_style.fontSpacing;
+ }
+ }
+ else
+ {
+ CSize extent;
+ if(!GetTextExtentPoint32W(g_hDC, m_str, m_str.GetLength(), &extent)) {SelectObject(g_hDC, hOldFont); ASSERT(0); return(false);}
+
+ BeginPath(g_hDC);
+ TextOutW(g_hDC, 0, 0, m_str, m_str.GetLength());
+ EndPath(g_hDC);
+ }
+
+ SelectObject(g_hDC, hOldFont);
+
+ return(true);
+}
+
+// CPolygon
+
+CPolygon::CPolygon(STSStyle& style, CStringW str, int ktype, int kstart, int kend, double scalex, double scaley, int baseline)
+ : CWord(style, str, ktype, kstart, kend)
+ , m_scalex(scalex), m_scaley(scaley), m_baseline(baseline)
+{
+ ParseStr();
+}
+
+CPolygon::~CPolygon()
+{
+}
+
+CWord* CPolygon::Copy()
+{
+ return(new CPolygon(m_style, m_str, m_ktype, m_kstart, m_kend, m_scalex, m_scaley, m_baseline));
+}
+
+bool CPolygon::Append(CWord* w)
+{
+ int width = m_width;
+
+ CPolygon* p = dynamic_cast<CPolygon*>(w);
+ if(!p) return(false);
+
+ // TODO
+ return(false);
+
+ return(true);
+}
+
+bool CPolygon::GetLONG(CStringW& str, LONG& ret)
+{
+ LPWSTR s = (LPWSTR)(LPCWSTR)str, e = s;
+ ret = wcstol(str, &e, 10);
+ str = str.Mid(e - s);
+ return(e > s);
+}
+
+bool CPolygon::GetPOINT(CStringW& str, POINT& ret)
+{
+ return(GetLONG(str, ret.x) && GetLONG(str, ret.y));
+}
+
+bool CPolygon::ParseStr()
+{
+ if(m_pathTypesOrg.GetCount() > 0) return(true);
+
+ CPoint p;
+ int i, j, lastsplinestart = -1, firstmoveto = -1, lastmoveto = -1;
+
+ CStringW str = m_str;
+ str.SpanIncluding(L"mnlbspc 0123456789");
+ str.Replace(L"m", L"*m");
+ str.Replace(L"n", L"*n");
+ str.Replace(L"l", L"*l");
+ str.Replace(L"b", L"*b");
+ str.Replace(L"s", L"*s");
+ str.Replace(L"p", L"*p");
+ str.Replace(L"c", L"*c");
+
+ int k = 0;
+ for(CStringW s = str.Tokenize(L"*", k); !s.IsEmpty(); s = str.Tokenize(L"*", k))
+ {
+ WCHAR c = s[0];
+ s.TrimLeft(L"mnlbspc ");
+ switch(c)
+ {
+ case 'm':
+ lastmoveto = m_pathTypesOrg.GetCount();
+ if(firstmoveto == -1) firstmoveto = lastmoveto;
+ while(GetPOINT(s, p)) {m_pathTypesOrg.Add(PT_MOVETO); m_pathPointsOrg.Add(p);}
+ break;
+ case 'n':
+ while(GetPOINT(s, p)) {m_pathTypesOrg.Add(PT_MOVETONC); m_pathPointsOrg.Add(p);}
+ break;
+ case 'l':
+ while(GetPOINT(s, p)) {m_pathTypesOrg.Add(PT_LINETO); m_pathPointsOrg.Add(p);}
+ break;
+ case 'b':
+ j = m_pathTypesOrg.GetCount();
+ while(GetPOINT(s, p)) {m_pathTypesOrg.Add(PT_BEZIERTO); m_pathPointsOrg.Add(p); j++;}
+ j = m_pathTypesOrg.GetCount() - ((m_pathTypesOrg.GetCount()-j)%3);
+ m_pathTypesOrg.SetCount(j); m_pathPointsOrg.SetCount(j);
+ break;
+ case 's':
+ j = lastsplinestart = m_pathTypesOrg.GetCount();
+ i = 3;
+ while(i-- && GetPOINT(s, p)) {m_pathTypesOrg.Add(PT_BSPLINETO); m_pathPointsOrg.Add(p); j++;}
+ if(m_pathTypesOrg.GetCount()-lastsplinestart < 3) {m_pathTypesOrg.SetCount(lastsplinestart); m_pathPointsOrg.SetCount(lastsplinestart); lastsplinestart = -1;}
+ // no break here
+ case 'p':
+ while(GetPOINT(s, p)) {m_pathTypesOrg.Add(PT_BSPLINEPATCHTO); m_pathPointsOrg.Add(p); j++;}
+ break;
+ case 'c':
+ if(lastsplinestart > 0)
+ {
+ m_pathTypesOrg.Add(PT_BSPLINEPATCHTO);
+ m_pathTypesOrg.Add(PT_BSPLINEPATCHTO);
+ m_pathTypesOrg.Add(PT_BSPLINEPATCHTO);
+ p = m_pathPointsOrg[lastsplinestart-1]; // we need p for temp storage, because operator [] will return a reference to CPoint and Add() may reallocate its internal buffer (this is true for MFC 7.0 but not for 6.0, hehe)
+ m_pathPointsOrg.Add(p);
+ p = m_pathPointsOrg[lastsplinestart];
+ m_pathPointsOrg.Add(p);
+ p = m_pathPointsOrg[lastsplinestart+1];
+ m_pathPointsOrg.Add(p);
+ lastsplinestart = -1;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+/*
+ LPCWSTR str = m_str;
+ while(*str)
+ {
+ while(*str && *str != 'm' && *str != 'n' && *str != 'l' && *str != 'b' && *str != 's' && *str != 'p' && *str != 'c') str++;
+
+ if(!*str) break;
+
+ switch(*str++)
+ {
+ case 'm':
+ lastmoveto = m_pathTypesOrg.GetCount();
+ if(firstmoveto == -1) firstmoveto = lastmoveto;
+ while(GetPOINT(str, p)) {m_pathTypesOrg.Add(PT_MOVETO); m_pathPointsOrg.Add(p);}
+ break;
+ case 'n':
+ while(GetPOINT(str, p)) {m_pathTypesOrg.Add(PT_MOVETONC); m_pathPointsOrg.Add(p);}
+ break;
+ case 'l':
+ while(GetPOINT(str, p)) {m_pathTypesOrg.Add(PT_LINETO); m_pathPointsOrg.Add(p);}
+ break;
+ case 'b':
+ j = m_pathTypesOrg.GetCount();
+ while(GetPOINT(str, p)) {m_pathTypesOrg.Add(PT_BEZIERTO); m_pathPointsOrg.Add(p); j++;}
+ j = m_pathTypesOrg.GetCount() - ((m_pathTypesOrg.GetCount()-j)%3);
+ m_pathTypesOrg.SetCount(j); m_pathPointsOrg.SetCount(j);
+ break;
+ case 's':
+ j = lastsplinestart = m_pathTypesOrg.GetCount();
+ i = 3;
+ while(i-- && GetPOINT(str, p)) {m_pathTypesOrg.Add(PT_BSPLINETO); m_pathPointsOrg.Add(p); j++;}
+ if(m_pathTypesOrg.GetCount()-lastsplinestart < 3) {m_pathTypesOrg.SetCount(lastsplinestart); m_pathPointsOrg.SetCount(lastsplinestart); lastsplinestart = -1;}
+ // no break here
+ case 'p':
+ while(GetPOINT(str, p)) {m_pathTypesOrg.Add(PT_BSPLINEPATCHTO); m_pathPointsOrg.Add(p); j++;}
+ break;
+ case 'c':
+ if(lastsplinestart > 0)
+ {
+ m_pathTypesOrg.Add(PT_BSPLINEPATCHTO);
+ m_pathTypesOrg.Add(PT_BSPLINEPATCHTO);
+ m_pathTypesOrg.Add(PT_BSPLINEPATCHTO);
+ p = m_pathPointsOrg[lastsplinestart-1]; // we need p for temp storage, because operator [] will return a reference to CPoint and Add() may reallocate its internal buffer (this is true for MFC 7.0 but not for 6.0, hehe)
+ m_pathPointsOrg.Add(p);
+ p = m_pathPointsOrg[lastsplinestart];
+ m_pathPointsOrg.Add(p);
+ p = m_pathPointsOrg[lastsplinestart+1];
+ m_pathPointsOrg.Add(p);
+ lastsplinestart = -1;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if(firstmoveto > 0) break;
+ }
+*/
+ if(lastmoveto == -1 || firstmoveto > 0)
+ {
+ m_pathTypesOrg.RemoveAll();
+ m_pathPointsOrg.RemoveAll();
+ return(false);
+ }
+
+ int minx = INT_MAX, miny = INT_MAX, maxx = -INT_MAX, maxy = -INT_MAX;
+
+ for(i = 0; i < m_pathTypesOrg.GetCount(); i++)
+ {
+ m_pathPointsOrg[i].x = (int)(64 * m_scalex * m_pathPointsOrg[i].x);
+ m_pathPointsOrg[i].y = (int)(64 * m_scaley * m_pathPointsOrg[i].y);
+ if(minx > m_pathPointsOrg[i].x) minx = m_pathPointsOrg[i].x;
+ if(miny > m_pathPointsOrg[i].y) miny = m_pathPointsOrg[i].y;
+ if(maxx < m_pathPointsOrg[i].x) maxx = m_pathPointsOrg[i].x;
+ if(maxy < m_pathPointsOrg[i].y) maxy = m_pathPointsOrg[i].y;
+ }
+
+ m_width = max(maxx - minx, 0);
+ m_ascent = max(maxy - miny, 0);
+
+ int baseline = (int)(64 * m_scaley * m_baseline);
+ m_descent = baseline;
+ m_ascent -= baseline;
+
+ m_width = ((int)(m_style.fontScaleX/100 * m_width) + 4) >> 3;
+ m_ascent = ((int)(m_style.fontScaleY/100 * m_ascent) + 4) >> 3;
+ m_descent = ((int)(m_style.fontScaleY/100 * m_descent) + 4) >> 3;
+
+ return(true);
+}
+
+bool CPolygon::CreatePath()
+{
+ int len = m_pathTypesOrg.GetCount();
+ if(len == 0) return(false);
+
+ if(mPathPoints != len)
+ {
+ mpPathTypes = (BYTE*)realloc(mpPathTypes, len*sizeof(BYTE));
+ mpPathPoints = (POINT*)realloc(mpPathPoints, len*sizeof(POINT));
+ if(!mpPathTypes || !mpPathPoints) return(false);
+ mPathPoints = len;
+ }
+
+ memcpy(mpPathTypes, m_pathTypesOrg.GetData(), len*sizeof(BYTE));
+ memcpy(mpPathPoints, m_pathPointsOrg.GetData(), len*sizeof(POINT));
+
+ return(true);
+}
+
+// CClipper
+
+CClipper::CClipper(CStringW str, CSize size, double scalex, double scaley)
+ : CPolygon(STSStyle(), str, 0, 0, 0, scalex, scaley, 0)
+{
+ m_size.cx = m_size.cy = 0;
+ m_pAlphaMask = NULL;
+
+ if(size.cx < 0 || size.cy < 0 || !(m_pAlphaMask = new BYTE[size.cx*size.cy])) return;
+
+ m_size = size;
+
+ memset(m_pAlphaMask, 0, size.cx*size.cy);
+
+ Paint(CPoint(0, 0), CPoint(0, 0));
+
+ int w = mOverlayWidth, h = mOverlayHeight;
+
+ int x = (mOffsetX+4)>>3, y = (mOffsetY+4)>>3;
+ int xo = 0, yo = 0;
+
+ if(x < 0) {xo = -x; w -= -x; x = 0;}
+ if(y < 0) {yo = -y; h -= -y; y = 0;}
+ if(x+w > m_size.cx) w = m_size.cx-x;
+ if(y+h > m_size.cy) h = m_size.cy-y;
+
+ if(w <= 0 || h <= 0) return;
+
+ const BYTE* src = mpOverlayBuffer + 2*(mOverlayWidth * yo + xo);
+ BYTE* dst = m_pAlphaMask + m_size.cx * y + x;
+
+ while(h--)
+ {
+ for(int wt=0; wt<w; ++wt)
+ dst[wt] = src[wt*2];
+
+ src += 2*mOverlayWidth;
+ dst += m_size.cx;
+ }
+}
+
+CClipper::~CClipper()
+{
+ if(m_pAlphaMask) delete [] m_pAlphaMask;
+ m_pAlphaMask = NULL;
+}
+
+CWord* CClipper::Copy()
+{
+ return(new CClipper(m_str, m_size, m_scalex, m_scaley));
+}
+
+bool CClipper::Append(CWord* w)
+{
+ return(false);
+}
+
+// CLine
+
+CLine::~CLine()
+{
+ POSITION pos = GetHeadPosition();
+ while(pos) delete GetNext(pos);
+}
+
+void CLine::Compact()
+{
+ POSITION pos = GetHeadPosition();
+ while(pos)
+ {
+ CWord* w = GetNext(pos);
+ if(!w->m_fWhiteSpaceChar) break;
+
+ m_width -= w->m_width;
+ delete w;
+ RemoveHead();
+ }
+
+ pos = GetTailPosition();
+ while(pos)
+ {
+ CWord* w = GetPrev(pos);
+ if(!w->m_fWhiteSpaceChar) break;
+
+ m_width -= w->m_width;
+ delete w;
+ RemoveTail();
+ }
+
+ if(IsEmpty()) return;
+
+ CLine l;
+ l.AddTailList(this);
+ RemoveAll();
+
+ CWord* last = NULL;
+
+ pos = l.GetHeadPosition();
+ while(pos)
+ {
+ CWord* w = l.GetNext(pos);
+
+ if(!last || !last->Append(w))
+ AddTail(last = w->Copy());
+ }
+
+ m_ascent = m_descent = m_border = 0;
+
+ pos = GetHeadPosition();
+ while(pos)
+ {
+ CWord* w = GetNext(pos);
+
+ if(m_ascent < w->m_ascent) m_ascent = w->m_ascent;
+ if(m_descent < w->m_descent) m_descent = w->m_descent;
+ if(m_border < w->m_style.outlineWidth) m_border = (int)(w->m_style.outlineWidth+0.5);
+ }
+}
+
+CRect CLine::PaintShadow(SubPicDesc& spd, CRect& clipRect, BYTE* pAlphaMask, CPoint p, CPoint org, int time, int alpha)
+{
+ CRect bbox(0, 0, 0, 0);
+
+ POSITION pos = GetHeadPosition();
+ while(pos)
+ {
+ CWord* w = GetNext(pos);
+
+ if(w->m_fLineBreak) return(bbox); // should not happen since this class is just a line of text without any breaks
+
+ if(w->m_style.shadowDepth > 0)
+ {
+ int x = p.x + (int)(w->m_style.shadowDepth+0.5);
+ int y = p.y + m_ascent - w->m_ascent + (int)(w->m_style.shadowDepth+0.5);
+
+ DWORD a = 0xff - w->m_style.alpha[3];
+ if(alpha > 0) a = MulDiv(a, 0xff - alpha, 0xff);
+ COLORREF shadow = revcolor(w->m_style.colors[3]) | (a<<24);
+ long sw[6] = {shadow, -1};
+
+ w->Paint(CPoint(x, y), org);
+
+ if(w->m_style.borderStyle == 0)
+ {
+ bbox |= w->Draw(spd, clipRect, pAlphaMask, x, y, sw,
+ w->m_ktype > 0 || w->m_style.alpha[0] < 0xff,
+ w->m_style.outlineWidth > 0 && !(w->m_ktype == 2 && time < w->m_kstart));
+ }
+ else if(w->m_style.borderStyle == 1 && w->m_pOpaqueBox)
+ {
+ bbox |= w->m_pOpaqueBox->Draw(spd, clipRect, pAlphaMask, x, y, sw, true, false);
+ }
+ }
+
+ p.x += w->m_width;
+ }
+
+ return(bbox);
+}
+
+CRect CLine::PaintOutline(SubPicDesc& spd, CRect& clipRect, BYTE* pAlphaMask, CPoint p, CPoint org, int time, int alpha)
+{
+ CRect bbox(0, 0, 0, 0);
+
+ POSITION pos = GetHeadPosition();
+ while(pos)
+ {
+ CWord* w = GetNext(pos);
+
+ if(w->m_fLineBreak) return(bbox); // should not happen since this class is just a line of text without any breaks
+
+// if((w->m_style.outlineWidth > 0 || w->m_style.borderStyle == 1 && w->m_style.outlineWidth == 0) && !(w->m_ktype == 2 && time < w->m_kstart))
+ if(w->m_style.outlineWidth > 0 && !(w->m_ktype == 2 && time < w->m_kstart))
+ {
+ int x = p.x;
+ int y = p.y + m_ascent - w->m_ascent;
+
+ DWORD aoutline = w->m_style.alpha[2];
+ if(alpha > 0) aoutline += MulDiv(alpha, 0xff - w->m_style.alpha[2], 0xff);
+ COLORREF outline = revcolor(w->m_style.colors[2]) | ((0xff-aoutline)<<24);
+ long sw[6] = {outline, -1};
+
+ w->Paint(CPoint(x, y), org);
+
+ if(w->m_style.borderStyle == 0)
+ {
+ bbox |= w->Draw(spd, clipRect, pAlphaMask, x, y, sw, !w->m_style.alpha[0] && !w->m_style.alpha[1], true);
+ }
+ else if(w->m_style.borderStyle == 1 && w->m_pOpaqueBox)
+ {
+ bbox |= w->m_pOpaqueBox->Draw(spd, clipRect, pAlphaMask, x, y, sw, true/*!w->m_style.alpha[0] && !w->m_style.alpha[1]*/, false);
+ }
+ }
+
+ p.x += w->m_width;
+ }
+
+ return(bbox);
+}
+
+CRect CLine::PaintBody(SubPicDesc& spd, CRect& clipRect, BYTE* pAlphaMask, CPoint p, CPoint org, int time, int alpha)
+{
+ CRect bbox(0, 0, 0, 0);
+
+ POSITION pos = GetHeadPosition();
+ while(pos)
+ {
+ CWord* w = GetNext(pos);
+
+ if(w->m_fLineBreak) return(bbox); // should not happen since this class is just a line of text without any breaks
+
+ int x = p.x;
+ int y = p.y + m_ascent - w->m_ascent;
+
+ // colors
+
+ DWORD aprimary = w->m_style.alpha[0];
+ if(alpha > 0) aprimary += MulDiv(alpha, 0xff - w->m_style.alpha[0], 0xff);
+ COLORREF primary = revcolor(w->m_style.colors[0]) | ((0xff-aprimary)<<24);
+
+ DWORD asecondary = w->m_style.alpha[1];
+ if(alpha > 0) asecondary += MulDiv(alpha, 0xff - w->m_style.alpha[1], 0xff);
+ COLORREF secondary = revcolor(w->m_style.colors[1]) | ((0xff-asecondary)<<24);
+
+ long sw[6] = {primary, 0, secondary};
+
+ // karaoke
+
+ double t;
+
+ if(w->m_ktype == 0 || w->m_ktype == 2)
+ {
+ t = time < w->m_kstart ? 0 : 1;
+ }
+ else if(w->m_ktype == 1)
+ {
+ if(time < w->m_kstart) t = 0;
+ else if(time < w->m_kend)
+ {
+ t = 1.0 * (time - w->m_kstart) / (w->m_kend - w->m_kstart);
+
+ double angle = fmod(w->m_style.fontAngleZ, 360.0);
+ if(angle > 90 && angle < 270)
+ {
+ t = 1-t;
+ COLORREF tmp = sw[0]; sw[0] = sw[2]; sw[2] = tmp;
+ }
+ }
+ else t = 1.0;
+ }
+
+ if(t >= 1)
+ {
+ sw[1] = 0xffffffff;
+ }
+
+ sw[3] = (int)(w->m_style.outlineWidth + t*w->m_width) >> 3;
+ sw[4] = sw[2];
+ sw[5] = 0x00ffffff;
+
+ w->Paint(CPoint(x, y), org);
+
+ bbox |= w->Draw(spd, clipRect, pAlphaMask, x, y, sw, true, false);
+
+ p.x += w->m_width;
+ }
+
+ return(bbox);
+}
+
+
+// CSubtitle
+
+CSubtitle::CSubtitle()
+{
+ memset(m_effects, 0, sizeof(Effect*)*EF_NUMBEROFEFFECTS);
+ m_pClipper = NULL;
+ m_scalex = m_scaley = 1;
+}
+
+CSubtitle::~CSubtitle()
+{
+ Empty();
+}
+
+void CSubtitle::Empty()
+{
+ POSITION pos = GetHeadPosition();
+ while(pos) delete GetNext(pos);
+
+ pos = m_words.GetHeadPosition();
+ while(pos) delete m_words.GetNext(pos);
+
+ for(int i = 0; i < EF_NUMBEROFEFFECTS; i++) {if(m_effects[i]) delete m_effects[i];}
+ memset(m_effects, 0, sizeof(Effect*)*EF_NUMBEROFEFFECTS);
+
+ if(m_pClipper) delete m_pClipper;
+ m_pClipper = NULL;
+}
+
+int CSubtitle::GetFullWidth()
+{
+ int width = 0;
+
+ POSITION pos = m_words.GetHeadPosition();
+ while(pos) width += m_words.GetNext(pos)->m_width;
+
+ return(width);
+}
+
+int CSubtitle::GetFullLineWidth(POSITION pos)
+{
+ int width = 0;
+
+ while(pos)
+ {
+ CWord* w = m_words.GetNext(pos);
+ if(w->m_fLineBreak) break;
+ width += w->m_width;
+ }
+
+ return(width);
+}
+
+int CSubtitle::GetWrapWidth(POSITION pos, int maxwidth)
+{
+ if(m_wrapStyle == 0 || m_wrapStyle == 3)
+ {
+ if(maxwidth > 0)
+ {
+// int fullwidth = GetFullWidth();
+ int fullwidth = GetFullLineWidth(pos);
+
+ int minwidth = fullwidth / ((abs(fullwidth) / maxwidth) + 1);
+
+ int width = 0, wordwidth = 0;
+
+ while(pos && width < minwidth)
+ {
+ CWord* w = m_words.GetNext(pos);
+ wordwidth = w->m_width;
+ if(abs(width + wordwidth) < abs(maxwidth)) width += wordwidth;
+ }
+
+ maxwidth = width;
+
+ if(m_wrapStyle == 3 && pos) maxwidth -= wordwidth;
+ }
+ }
+ else if(m_wrapStyle == 1)
+ {
+// maxwidth = maxwidth;
+ }
+ else if(m_wrapStyle == 2)
+ {
+ maxwidth = INT_MAX;
+ }
+
+ return(maxwidth);
+}
+
+CLine* CSubtitle::GetNextLine(POSITION& pos, int maxwidth)
+{
+ if(pos == NULL) return(NULL);
+
+ CLine* ret = new CLine();
+ if(!ret) return(NULL);
+
+ ret->m_width = ret->m_ascent = ret->m_descent = ret->m_border = 0;
+
+ maxwidth = GetWrapWidth(pos, maxwidth);
+
+ bool fEmptyLine = true;
+
+ while(pos)
+ {
+ CWord* w = m_words.GetNext(pos);
+
+ if(ret->m_ascent < w->m_ascent) ret->m_ascent = w->m_ascent;
+ if(ret->m_descent < w->m_descent) ret->m_descent = w->m_descent;
+ if(ret->m_border < w->m_style.outlineWidth) ret->m_border = (int)(w->m_style.outlineWidth+0.5);
+
+ if(w->m_fLineBreak)
+ {
+ if(fEmptyLine) {ret->m_ascent /= 2; ret->m_descent /= 2; ret->m_border = 0;}
+
+ ret->Compact();
+
+ return(ret);
+ }
+
+ fEmptyLine = false;
+
+ bool fWSC = w->m_fWhiteSpaceChar;
+
+ int width = w->m_width;
+ POSITION pos2 = pos;
+ while(pos2)
+ {
+ if(m_words.GetAt(pos2)->m_fWhiteSpaceChar != fWSC
+ || m_words.GetAt(pos2)->m_fLineBreak) break;
+
+ CWord* w2 = m_words.GetNext(pos2);
+ width += w2->m_width;
+ }
+
+ if((ret->m_width += width) <= maxwidth || ret->IsEmpty())
+ {
+ ret->AddTail(w->Copy());
+
+ while(pos != pos2)
+ {
+ ret->AddTail(m_words.GetNext(pos)->Copy());
+ }
+
+ pos = pos2;
+ }
+ else
+ {
+ if(pos) m_words.GetPrev(pos);
+ else pos = m_words.GetTailPosition();
+
+ ret->m_width -= width;
+
+ break;
+ }
+ }
+
+ ret->Compact();
+
+ return(ret);
+}
+
+void CSubtitle::CreateClippers(CSize size)
+{
+ size.cx >>= 3;
+ size.cy >>= 3;
+
+ if(m_effects[EF_BANNER] && m_effects[EF_BANNER]->param[2])
+ {
+ int width = m_effects[EF_BANNER]->param[2];
+
+ int w = size.cx, h = size.cy;
+
+ if(!m_pClipper)
+ {
+ CStringW str;
+ str.Format(L"m %d %d l %d %d %d %d %d %d", 0, 0, w, 0, w, h, 0, h);
+ m_pClipper = new CClipper(str, size, 1, 1);
+ if(!m_pClipper) return;
+ }
+
+ int da = (64<<8)/width;
+ BYTE* am = m_pClipper->m_pAlphaMask;
+
+ for(int j = 0; j < h; j++, am += w)
+ {
+ int a = 0;
+ int k = min(width, w);
+
+ for(int i = 0; i < k; i++, a += da)
+ am[i] = (am[i]*a)>>14;
+
+ a = 0x40<<8;
+ k = w-width;
+
+ if(k < 0) {a -= -k*da; k = 0;}
+
+ for(int i = k; i < w; i++, a -= da)
+ am[i] = (am[i]*a)>>14;
+ }
+ }
+ else if(m_effects[EF_SCROLL] && m_effects[EF_SCROLL]->param[4])
+ {
+ int height = m_effects[EF_SCROLL]->param[4];
+
+ int w = size.cx, h = size.cy;
+
+ if(!m_pClipper)
+ {
+ CStringW str;
+ str.Format(L"m %d %d l %d %d %d %d %d %d", 0, 0, w, 0, w, h, 0, h);
+ m_pClipper = new CClipper(str, size, 1, 1);
+ if(!m_pClipper) return;
+ }
+
+ int da = (64<<8)/height;
+ int a = 0;
+ int k = m_effects[EF_SCROLL]->param[0]>>3;
+ int l = k+height;
+ if(k < 0) {a += -k*da; k = 0;}
+ if(l > h) {l = h;}
+
+ if(k < h)
+ {
+ BYTE* am = &m_pClipper->m_pAlphaMask[k*w];
+
+ memset(m_pClipper->m_pAlphaMask, 0, am - m_pClipper->m_pAlphaMask);
+
+ for(int j = k; j < l; j++, a += da)
+ {
+ for(int i = 0; i < w; i++, am++)
+ *am = ((*am)*a)>>14;
+ }
+ }
+
+ da = -(64<<8)/height;
+ a = 0x40<<8;
+ l = m_effects[EF_SCROLL]->param[1]>>3;
+ k = l-height;
+ if(k < 0) {a += -k*da; k = 0;}
+ if(l > h) {l = h;}
+
+ if(k < h)
+ {
+ BYTE* am = &m_pClipper->m_pAlphaMask[k*w];
+
+ int j = k;
+ for(; j < l; j++, a += da)
+ {
+ for(int i = 0; i < w; i++, am++)
+ *am = ((*am)*a)>>14;
+ }
+
+ memset(am, 0, (h-j)*w);
+ }
+ }
+}
+
+void CSubtitle::MakeLines(CSize size, CRect marginRect)
+{
+ CSize spaceNeeded(0, 0);
+
+ bool fFirstLine = true;
+
+ m_topborder = m_bottomborder = 0;
+
+ CLine* l = NULL;
+
+ POSITION pos = m_words.GetHeadPosition();
+ while(pos)
+ {
+ l = GetNextLine(pos, size.cx - marginRect.left - marginRect.right);
+ if(!l) break;
+
+ if(fFirstLine) {m_topborder = l->m_border; fFirstLine = false;}
+
+ spaceNeeded.cx = max(l->m_width, spaceNeeded.cx);
+ spaceNeeded.cy += l->m_ascent + l->m_descent;
+
+ AddTail(l);
+ }
+
+ if(l) m_bottomborder = l->m_border;
+
+ m_rect = CRect(
+ CPoint((m_scrAlignment%3) == 1 ? marginRect.left
+ : (m_scrAlignment%3) == 2 ? (marginRect.left + (size.cx - marginRect.right) - spaceNeeded.cx + 1) / 2
+ : (size.cx - marginRect.right - spaceNeeded.cx),
+ m_scrAlignment <= 3 ? (size.cy - marginRect.bottom - spaceNeeded.cy)
+ : m_scrAlignment <= 6 ? (marginRect.top + (size.cy - marginRect.bottom) - spaceNeeded.cy + 1) / 2
+ : marginRect.top),
+ spaceNeeded);
+}
+
+// CScreenLayoutAllocator
+
+void CScreenLayoutAllocator::Empty()
+{
+ m_subrects.RemoveAll();
+}
+
+void CScreenLayoutAllocator::AdvanceToSegment(int segment, const CAtlArray<int>& sa)
+{
+ POSITION pos = m_subrects.GetHeadPosition();
+ while(pos)
+ {
+ POSITION prev = pos;
+
+ SubRect& sr = m_subrects.GetNext(pos);
+
+ bool fFound = false;
+
+ if(abs(sr.segment - segment) <= 1) // using abs() makes it possible to play the subs backwards, too :)
+ {
+ for(int i = 0; i < sa.GetCount() && !fFound; i++)
+ {
+ if(sa[i] == sr.entry)
+ {
+ sr.segment = segment;
+ fFound = true;
+ }
+ }
+ }
+
+ if(!fFound) m_subrects.RemoveAt(prev);
+ }
+}
+
+CRect CScreenLayoutAllocator::AllocRect(CSubtitle* s, int segment, int entry, int layer, int collisions)
+{
+ // TODO: handle collisions == 1 (reversed collisions)
+
+ POSITION pos = m_subrects.GetHeadPosition();
+ while(pos)
+ {
+ SubRect& sr = m_subrects.GetNext(pos);
+ if(sr.segment == segment && sr.entry == entry)
+ {
+ return(sr.r + CRect(0, -s->m_topborder, 0, -s->m_bottomborder));
+ }
+ }
+
+ CRect r = s->m_rect + CRect(0, s->m_topborder, 0, s->m_bottomborder);
+
+ bool fSearchDown = s->m_scrAlignment > 3;
+
+ bool fOK;
+
+ do
+ {
+ fOK = true;
+
+ pos = m_subrects.GetHeadPosition();
+ while(pos)
+ {
+ SubRect& sr = m_subrects.GetNext(pos);
+
+ if(layer == sr.layer && !(r & sr.r).IsRectEmpty())
+ {
+ if(fSearchDown)
+ {
+ r.bottom = sr.r.bottom + r.Height();
+ r.top = sr.r.bottom;
+ }
+ else
+ {
+ r.top = sr.r.top - r.Height();
+ r.bottom = sr.r.top;
+ }
+
+ fOK = false;
+ }
+ }
+ }
+ while(!fOK);
+
+ SubRect sr;
+ sr.r = r;
+ sr.segment = segment;
+ sr.entry = entry;
+ sr.layer = layer;
+ m_subrects.AddTail(sr);
+
+ return(sr.r + CRect(0, -s->m_topborder, 0, -s->m_bottomborder));
+}
+
+// CRenderedTextSubtitle
+
+CRenderedTextSubtitle::CRenderedTextSubtitle(CCritSec* pLock)
+ : ISubPicProviderImpl(pLock)
+{
+ m_size = CSize(0, 0);
+
+ if(g_hDC_refcnt == 0)
+ {
+ g_hDC = CreateCompatibleDC(NULL);
+ SetBkMode(g_hDC, TRANSPARENT);
+ SetTextColor(g_hDC, 0xffffff);
+ SetMapMode(g_hDC, MM_TEXT);
+ }
+
+ g_hDC_refcnt++;
+}
+
+CRenderedTextSubtitle::~CRenderedTextSubtitle()
+{
+ Deinit();
+
+ g_hDC_refcnt--;
+ if(g_hDC_refcnt == 0) DeleteDC(g_hDC);
+}
+
+void CRenderedTextSubtitle::Copy(CSimpleTextSubtitle& sts)
+{
+ __super::Copy(sts);
+
+ m_size = CSize(0, 0);
+
+ if(CRenderedTextSubtitle* pRTS = dynamic_cast<CRenderedTextSubtitle*>(&sts))
+ {
+ m_size = pRTS->m_size;
+ }
+}
+
+void CRenderedTextSubtitle::Empty()
+{
+ Deinit();
+
+ __super::Empty();
+}
+
+void CRenderedTextSubtitle::OnChanged()
+{
+ __super::OnChanged();
+
+ POSITION pos = m_subtitleCache.GetStartPosition();
+ while(pos)
+ {
+ int i;
+ CSubtitle* s;
+ m_subtitleCache.GetNextAssoc(pos, i, s);
+ delete s;
+ }
+
+ m_subtitleCache.RemoveAll();
+
+ m_sla.Empty();
+}
+
+bool CRenderedTextSubtitle::Init(CSize size, CRect vidrect)
+{
+ Deinit();
+
+ m_size = CSize(size.cx*8, size.cy*8);
+ m_vidrect = CRect(vidrect.left*8, vidrect.top*8, vidrect.right*8, vidrect.bottom*8);
+
+ m_sla.Empty();
+
+ return(true);
+}
+
+void CRenderedTextSubtitle::Deinit()
+{
+ POSITION pos = m_subtitleCache.GetStartPosition();
+ while(pos)
+ {
+ int i;
+ CSubtitle* s;
+ m_subtitleCache.GetNextAssoc(pos, i, s);
+ delete s;
+ }
+
+ m_subtitleCache.RemoveAll();
+
+ m_sla.Empty();
+
+ m_size = CSize(0, 0);
+ m_vidrect.SetRectEmpty();
+}
+
+void CRenderedTextSubtitle::ParseEffect(CSubtitle* sub, CString str)
+{
+ str.Trim();
+ if(!sub || str.IsEmpty()) return;
+
+ const TCHAR* s = _tcschr(str, ';');
+ if(!s) {s = (LPTSTR)(LPCTSTR)str; s += str.GetLength()-1;}
+ s++;
+ CString effect = str.Left(s - str);
+
+ if(!effect.CompareNoCase(_T("Banner;")))
+ {
+ int delay, lefttoright = 0, fadeawaywidth = 0;
+ if(_stscanf(s, _T("%d;%d;%d"), &delay, &lefttoright, &fadeawaywidth) < 1) return;
+
+ Effect* e = new Effect;
+ if(!e) return;
+
+ sub->m_effects[e->type = EF_BANNER] = e;
+ e->param[0] = (int)(max(1.0*delay/sub->m_scalex, 1));
+ e->param[1] = lefttoright;
+ e->param[2] = (int)(sub->m_scalex*fadeawaywidth);
+
+ sub->m_wrapStyle = 2;
+ }
+ else if(!effect.CompareNoCase(_T("Scroll up;")) || !effect.CompareNoCase(_T("Scroll down;")))
+ {
+ int top, bottom, delay, fadeawayheight = 0;
+ if(_stscanf(s, _T("%d;%d;%d;%d"), &top, &bottom, &delay, &fadeawayheight) < 3) return;
+
+ if(top > bottom) {int tmp = top; top = bottom; bottom = tmp;}
+
+ Effect* e = new Effect;
+ if(!e) return;
+
+ sub->m_effects[e->type = EF_SCROLL] = e;
+ e->param[0] = (int)(sub->m_scaley*top*8);
+ e->param[1] = (int)(sub->m_scaley*bottom*8);
+ e->param[2] = (int)(max(1.0*delay/sub->m_scaley, 1));
+ e->param[3] = (effect.GetLength() == 12);
+ e->param[4] = (int)(sub->m_scaley*fadeawayheight);
+ }
+}
+
+void CRenderedTextSubtitle::ParseString(CSubtitle* sub, CStringW str, STSStyle& style)
+{
+ if(!sub) return;
+
+ str.Replace(L"\\N", L"\n");
+ str.Replace(L"\\n", (sub->m_wrapStyle < 2 || sub->m_wrapStyle == 3) ? L" " : L"\n");
+ str.Replace(L"\\h", L"\x00A0");
+
+ for(int i = 0, j = 0, len = str.GetLength(); j <= len; j++)
+ {
+ WCHAR c = str[j];
+
+ if(c != '\n' && c != ' ' && c != '\x00A0' && c != 0)
+ continue;
+
+ if(i < j)
+ {
+ if(CWord* w = new CText(style, str.Mid(i, j-i), m_ktype, m_kstart, m_kend))
+ {
+ sub->m_words.AddTail(w);
+ m_kstart = m_kend;
+ }
+ }
+
+ if(c == '\n')
+ {
+ if(CWord* w = new CText(style, CStringW(), m_ktype, m_kstart, m_kend))
+ {
+ sub->m_words.AddTail(w);
+ m_kstart = m_kend;
+ }
+ }
+ else if(c == ' ' || c == '\x00A0')
+ {
+ if(CWord* w = new CText(style, CStringW(c), m_ktype, m_kstart, m_kend))
+ {
+ sub->m_words.AddTail(w);
+ m_kstart = m_kend;
+ }
+ }
+
+ i = j+1;
+ }
+
+ return;
+}
+
+void CRenderedTextSubtitle::ParsePolygon(CSubtitle* sub, CStringW str, STSStyle& style)
+{
+ if(!sub || !str.GetLength() || !m_nPolygon) return;
+
+ if(CWord* w = new CPolygon(style, str, m_ktype, m_kstart, m_kend, sub->m_scalex/(1<<(m_nPolygon-1)), sub->m_scaley/(1<<(m_nPolygon-1)), m_polygonBaselineOffset))
+ {
+ sub->m_words.AddTail(w);
+ m_kstart = m_kend;
+ }
+}
+
+bool CRenderedTextSubtitle::ParseSSATag(CSubtitle* sub, CStringW str, STSStyle& style, STSStyle& org, bool fAnimate)
+{
+ if(!sub) return(false);
+
+ int nTags = 0, nUnrecognizedTags = 0;
+
+ for(int i = 0, j; (j = str.Find('\\', i)) >= 0; i = j)
+ {
+ CStringW cmd;
+ for(WCHAR c = str[++j]; c && c != '(' && c != '\\'; cmd += c, c = str[++j]);
+ cmd.Trim();
+ if(cmd.IsEmpty()) continue;
+
+ CAtlArray<CStringW> params;
+
+ if(str[j] == '(')
+ {
+ CStringW param;
+ for(WCHAR c = str[++j]; c && c != ')'; param += c, c = str[++j]);
+ param.Trim();
+
+ while(!param.IsEmpty())
+ {
+ int i = param.Find(','), j = param.Find('\\');
+
+ if(i >= 0 && (j < 0 || i < j))
+ {
+ CStringW s = param.Left(i).Trim();
+ if(!s.IsEmpty()) params.Add(s);
+ param = i+1 < param.GetLength() ? param.Mid(i+1) : L"";
+ }
+ else
+ {
+ param.Trim();
+ if(!param.IsEmpty()) params.Add(param);
+ param.Empty();
+ }
+ }
+ }
+
+ if(!cmd.Find(L"1c") || !cmd.Find(L"2c") || !cmd.Find(L"3c") || !cmd.Find(L"4c"))
+ params.Add(cmd.Mid(2).Trim(L"&H")), cmd = cmd.Left(2);
+ else if(!cmd.Find(L"1a") || !cmd.Find(L"2a") || !cmd.Find(L"3a") || !cmd.Find(L"4a"))
+ params.Add(cmd.Mid(2).Trim(L"&H")), cmd = cmd.Left(2);
+ else if(!cmd.Find(L"alpha"))
+ params.Add(cmd.Mid(5).Trim(L"&H")), cmd = cmd.Left(5);
+ else if(!cmd.Find(L"an"))
+ params.Add(cmd.Mid(2)), cmd = cmd.Left(2);
+ else if(!cmd.Find(L"a"))
+ params.Add(cmd.Mid(1)), cmd = cmd.Left(1);
+ else if(!cmd.Find(L"bord"))
+ params.Add(cmd.Mid(4)), cmd = cmd.Left(4);
+ else if(!cmd.Find(L"be"))
+ params.Add(cmd.Mid(2)), cmd = cmd.Left(2);
+ else if(!cmd.Find(L"b"))
+ params.Add(cmd.Mid(1)), cmd = cmd.Left(1);
+ else if(!cmd.Find(L"clip"))
+ ;
+ else if(!cmd.Find(L"c"))
+ params.Add(cmd.Mid(1).Trim(L"&H")), cmd = cmd.Left(1);
+ else if(!cmd.Find(L"fade"))
+ ;
+ else if(!cmd.Find(L"fe"))
+ params.Add(cmd.Mid(2)), cmd = cmd.Left(2);
+ else if(!cmd.Find(L"fn"))
+ params.Add(cmd.Mid(2)), cmd = cmd.Left(2);
+ else if(!cmd.Find(L"frx") || !cmd.Find(L"fry") || !cmd.Find(L"frz"))
+ params.Add(cmd.Mid(3)), cmd = cmd.Left(3);
+ else if(!cmd.Find(L"fr"))
+ params.Add(cmd.Mid(2)), cmd = cmd.Left(2);
+ else if(!cmd.Find(L"fscx") || !cmd.Find(L"fscy"))
+ params.Add(cmd.Mid(4)), cmd = cmd.Left(4);
+ else if(!cmd.Find(L"fsc"))
+ params.Add(cmd.Mid(3)), cmd = cmd.Left(3);
+ else if(!cmd.Find(L"fsp"))
+ params.Add(cmd.Mid(3)), cmd = cmd.Left(3);
+ else if(!cmd.Find(L"fs"))
+ params.Add(cmd.Mid(2)), cmd = cmd.Left(2);
+ else if(!cmd.Find(L"i"))
+ params.Add(cmd.Mid(1)), cmd = cmd.Left(1);
+ else if(!cmd.Find(L"kt") || !cmd.Find(L"kf") || !cmd.Find(L"ko"))
+ params.Add(cmd.Mid(2)), cmd = cmd.Left(2);
+ else if(!cmd.Find(L"k") || !cmd.Find(L"K"))
+ params.Add(cmd.Mid(1)), cmd = cmd.Left(1);
+ else if(!cmd.Find(L"move"))
+ ;
+ else if(!cmd.Find(L"org"))
+ ;
+ else if(!cmd.Find(L"pbo"))
+ params.Add(cmd.Mid(3)), cmd = cmd.Left(3);
+ else if(!cmd.Find(L"pos"))
+ ;
+ else if(!cmd.Find(L"p"))
+ params.Add(cmd.Mid(1)), cmd = cmd.Left(1);
+ else if(!cmd.Find(L"q"))
+ params.Add(cmd.Mid(1)), cmd = cmd.Left(1);
+ else if(!cmd.Find(L"r"))
+ params.Add(cmd.Mid(1)), cmd = cmd.Left(1);
+ else if(!cmd.Find(L"shad"))
+ params.Add(cmd.Mid(4)), cmd = cmd.Left(4);
+ else if(!cmd.Find(L"s"))
+ params.Add(cmd.Mid(1)), cmd = cmd.Left(1);
+ else if(!cmd.Find(L"t"))
+ ;
+ else if(!cmd.Find(L"u"))
+ params.Add(cmd.Mid(1)), cmd = cmd.Left(1);
+ else
+ nUnrecognizedTags++;
+
+ nTags++;
+
+ // TODO: call ParseStyleModifier(cmd, params, ..) and move the rest there
+
+ CStringW p = params.GetCount() > 0 ? params[0] : L"";
+
+ if(cmd == "1c" || cmd == L"2c" || cmd == L"3c" || cmd == L"4c")
+ {
+ int i = cmd[0] - '1';
+
+ DWORD c = wcstol(p, NULL, 16);
+ style.colors[i] = !p.IsEmpty()
+ ? (((int)CalcAnimation(c&0xff, style.colors[i]&0xff, fAnimate))&0xff
+ |((int)CalcAnimation(c&0xff00, style.colors[i]&0xff00, fAnimate))&0xff00
+ |((int)CalcAnimation(c&0xff0000, style.colors[i]&0xff0000, fAnimate))&0xff0000)
+ : org.colors[i];
+ }
+ else if(cmd == L"1a" || cmd == L"2a" || cmd == L"3a" || cmd == L"4a")
+ {
+ int i = cmd[0] - '1';
+
+ style.alpha[i] = !p.IsEmpty()
+ ? (BYTE)CalcAnimation(wcstol(p, NULL, 16), style.alpha[i], fAnimate)
+ : org.alpha[i];
+ }
+ else if(cmd == L"alpha")
+ {
+ for(int i = 0; i < 4; i++)
+ {
+ style.alpha[i] = !p.IsEmpty()
+ ? (BYTE)CalcAnimation(wcstol(p, NULL, 16), style.alpha[i], fAnimate)
+ : org.alpha[i];
+ }
+ }
+ else if(cmd == L"an")
+ {
+ int n = wcstol(p, NULL, 10);
+ if(sub->m_scrAlignment < 0)
+ sub->m_scrAlignment = (n > 0 && n < 10) ? n : org.scrAlignment;
+ }
+ else if(cmd == L"a")
+ {
+ int n = wcstol(p, NULL, 10);
+ if(sub->m_scrAlignment < 0)
+ sub->m_scrAlignment = (n > 0 && n < 12) ? ((((n-1)&3)+1)+((n&4)?6:0)+((n&8)?3:0)) : org.scrAlignment;
+ }
+ else if(cmd == L"bord")
+ {
+ double n = CalcAnimation(wcstod(p, NULL), style.outlineWidth, fAnimate);
+ style.outlineWidth = !p.IsEmpty()
+ ? (n < 0 ? 0 : n)
+ : org.outlineWidth;
+ }
+ else if(cmd == L"be")
+ {
+ int n = wcstol(p, NULL, 10);
+ style.fBlur = !p.IsEmpty()
+ ? (n == 0 ? false : n == 1 ? true : org.fBlur)
+ : org.fBlur;
+ }
+ else if(cmd == L"b")
+ {
+ int n = wcstol(p, NULL, 10);
+ style.fontWeight = !p.IsEmpty()
+ ? (n == 0 ? FW_NORMAL : n == 1 ? FW_BOLD : n >= 100 ? n : org.fontWeight)
+ : org.fontWeight;
+ }
+ else if(cmd == L"clip")
+ {
+ if(params.GetCount() == 1 && !sub->m_pClipper)
+ {
+ sub->m_pClipper = new CClipper(params[0], CSize(m_size.cx>>3, m_size.cy>>3), sub->m_scalex, sub->m_scaley);
+ }
+ else if(params.GetCount() == 2 && !sub->m_pClipper)
+ {
+ int scale = max(wcstol(p, NULL, 10), 1);
+ sub->m_pClipper = new CClipper(params[1], CSize(m_size.cx>>3, m_size.cy>>3), sub->m_scalex/(1<<(scale-1)), sub->m_scaley/(1<<(scale-1)));
+ }
+ else if(params.GetCount() == 4)
+ {
+ CRect r;
+
+ r.SetRect(
+ wcstol(params[0], NULL, 10),
+ wcstol(params[1], NULL, 10),
+ wcstol(params[2], NULL, 10),
+ wcstol(params[3], NULL, 10));
+
+ CPoint o(0, 0);
+
+ if(sub->m_relativeTo == 1) // TODO: this should also apply to the other two clippings above
+ {
+ o.x = m_vidrect.left>>3;
+ o.y = m_vidrect.top>>3;
+ }
+
+ sub->m_clip.SetRect(
+ (int)CalcAnimation(sub->m_scalex*r.left + o.x, sub->m_clip.left, fAnimate),
+ (int)CalcAnimation(sub->m_scaley*r.top + o.y, sub->m_clip.top, fAnimate),
+ (int)CalcAnimation(sub->m_scalex*r.right + o.x, sub->m_clip.right, fAnimate),
+ (int)CalcAnimation(sub->m_scaley*r.bottom + o.y, sub->m_clip.bottom, fAnimate));
+ }
+ }
+ else if(cmd == L"c")
+ {
+ DWORD c = wcstol(p, NULL, 16);
+ style.colors[0] = !p.IsEmpty()
+ ? (((int)CalcAnimation(c&0xff, style.colors[0]&0xff, fAnimate))&0xff
+ |((int)CalcAnimation(c&0xff00, style.colors[0]&0xff00, fAnimate))&0xff00
+ |((int)CalcAnimation(c&0xff0000, style.colors[0]&0xff0000, fAnimate))&0xff0000)
+ : org.colors[0];
+ }
+ else if(cmd == L"fade" || cmd == L"fad")
+ {
+ if(params.GetCount() == 7 && !sub->m_effects[EF_FADE])// {\fade(a1=param[0], a2=param[1], a3=param[2], t1=t[0], t2=t[1], t3=t[2], t4=t[3])
+ {
+ if(Effect* e = new Effect)
+ {
+ for(int i = 0; i < 3; i++)
+ e->param[i] = wcstol(params[i], NULL, 10);
+ for(int i = 0; i < 4; i++)
+ e->t[i] = wcstol(params[3+i], NULL, 10);
+
+ sub->m_effects[EF_FADE] = e;
+ }
+ }
+ else if(params.GetCount() == 2 && !sub->m_effects[EF_FADE]) // {\fad(t1=t[1], t2=t[2])
+ {
+ if(Effect* e = new Effect)
+ {
+ e->param[0] = e->param[2] = 0xff;
+ e->param[1] = 0x00;
+ for(int i = 1; i < 3; i++)
+ e->t[i] = wcstol(params[i-1], NULL, 10);
+ e->t[0] = e->t[3] = -1; // will be substituted with "start" and "end"
+
+ sub->m_effects[EF_FADE] = e;
+ }
+ }
+ }
+ else if(cmd == L"fe")
+ {
+ int n = wcstol(p, NULL, 10);
+ style.charSet = !p.IsEmpty()
+ ? n
+ : org.charSet;
+ }
+ else if(cmd == L"fn")
+ {
+ style.fontName = (!p.IsEmpty() && p != '0')
+ ? CString(p).Trim()
+ : org.fontName;
+ }
+ else if(cmd == L"frx")
+ {
+ style.fontAngleX = !p.IsEmpty()
+ ? CalcAnimation(wcstod(p, NULL), style.fontAngleX, fAnimate)
+ : org.fontAngleX;
+ }
+ else if(cmd == L"fry")
+ {
+ style.fontAngleY = !p.IsEmpty()
+ ? CalcAnimation(wcstod(p, NULL), style.fontAngleY, fAnimate)
+ : org.fontAngleY;
+ }
+ else if(cmd == L"frz" || cmd == L"fr")
+ {
+ style.fontAngleZ = !p.IsEmpty()
+ ? CalcAnimation(wcstod(p, NULL), style.fontAngleZ, fAnimate)
+ : org.fontAngleZ;
+ }
+ else if(cmd == L"fscx")
+ {
+ double n = CalcAnimation(wcstol(p, NULL, 10), style.fontScaleX, fAnimate);
+ style.fontScaleX = !p.IsEmpty()
+ ? ((n < 0) ? 0 : n)
+ : org.fontScaleX;
+ }
+ else if(cmd == L"fscy")
+ {
+ double n = CalcAnimation(wcstol(p, NULL, 10), style.fontScaleY, fAnimate);
+ style.fontScaleY = !p.IsEmpty()
+ ? ((n < 0) ? 0 : n)
+ : org.fontScaleY;
+ }
+ else if(cmd == L"fsc")
+ {
+ style.fontScaleX = org.fontScaleX;
+ style.fontScaleY = org.fontScaleY;
+ }
+ else if(cmd == L"fsp")
+ {
+ style.fontSpacing = !p.IsEmpty()
+ ? CalcAnimation(wcstod(p, NULL), style.fontSpacing, fAnimate)
+ : org.fontSpacing;
+ }
+ else if(cmd == L"fs")
+ {
+ if(!p.IsEmpty())
+ {
+ if(p[0] == '-' || p[0] == '+')
+ {
+ double n = CalcAnimation(style.fontSize + style.fontSize*wcstol(p, NULL, 10)/10, style.fontSize, fAnimate);
+ style.fontSize = (n > 0) ? n : org.fontSize;
+ }
+ else
+ {
+ double n = CalcAnimation(wcstol(p, NULL, 10), style.fontSize, fAnimate);
+ style.fontSize = (n > 0) ? n : org.fontSize;
+ }
+ }
+ else
+ {
+ style.fontSize = org.fontSize;
+ }
+ }
+ else if(cmd == L"i")
+ {
+ int n = wcstol(p, NULL, 10);
+ style.fItalic = !p.IsEmpty()
+ ? (n == 0 ? false : n == 1 ? true : org.fItalic)
+ : org.fItalic;
+ }
+ else if(cmd == L"kt")
+ {
+ m_kstart = !p.IsEmpty()
+ ? wcstol(p, NULL, 10)*10
+ : 0;
+ m_kend = m_kstart;
+ }
+ else if(cmd == L"kf" || cmd == L"K")
+ {
+ m_ktype = 1;
+ m_kstart = m_kend;
+ m_kend += !p.IsEmpty()
+ ? wcstol(p, NULL, 10)*10
+ : 1000;
+ }
+ else if(cmd == L"ko")
+ {
+ m_ktype = 2;
+ m_kstart = m_kend;
+ m_kend += !p.IsEmpty()
+ ? wcstol(p, NULL, 10)*10
+ : 1000;
+ }
+ else if(cmd == L"k")
+ {
+ m_ktype = 0;
+ m_kstart = m_kend;
+ m_kend += !p.IsEmpty()
+ ? wcstol(p, NULL, 10)*10
+ : 1000;
+ }
+ else if(cmd == L"move") // {\move(x1=param[0], y1=param[1], x2=param[2], y2=param[3][, t1=t[0], t2=t[1]])}
+ {
+ if((params.GetCount() == 4 || params.GetCount() == 6) && !sub->m_effects[EF_MOVE])
+ {
+ if(Effect* e = new Effect)
+ {
+ e->param[0] = (int)(sub->m_scalex*wcstol(params[0], NULL, 10)*8);
+ e->param[1] = (int)(sub->m_scaley*wcstol(params[1], NULL, 10)*8);
+ e->param[2] = (int)(sub->m_scalex*wcstol(params[2], NULL, 10)*8);
+ e->param[3] = (int)(sub->m_scaley*wcstol(params[3], NULL, 10)*8);
+
+ e->t[0] = e->t[1] = -1;
+
+ if(params.GetCount() == 6)
+ {
+ for(int i = 0; i < 2; i++)
+ e->t[i] = wcstol(params[4+i], NULL, 10);
+ }
+
+ sub->m_effects[EF_MOVE] = e;
+ }
+ }
+ }
+ else if(cmd == L"org") // {\org(x=param[0], y=param[1])}
+ {
+ if(params.GetCount() == 2 && !sub->m_effects[EF_ORG])
+ {
+ if(Effect* e = new Effect)
+ {
+ e->param[0] = (int)(sub->m_scalex*wcstol(params[0], NULL, 10)*8);
+ e->param[1] = (int)(sub->m_scaley*wcstol(params[1], NULL, 10)*8);
+
+ sub->m_effects[EF_ORG] = e;
+ }
+ }
+ }
+ else if(cmd == L"pbo")
+ {
+ m_polygonBaselineOffset = wcstol(p, NULL, 10);
+ }
+ else if(cmd == L"pos")
+ {
+ if(params.GetCount() == 2 && !sub->m_effects[EF_MOVE])
+ {
+ if(Effect* e = new Effect)
+ {
+ e->param[0] = e->param[2] = (int)(sub->m_scalex*wcstol(params[0], NULL, 10)*8);
+ e->param[1] = e->param[3] = (int)(sub->m_scaley*wcstol(params[1], NULL, 10)*8);
+ e->t[0] = e->t[1] = 0;
+
+ sub->m_effects[EF_MOVE] = e;
+ }
+ }
+ }
+ else if(cmd == L"p")
+ {
+ int n = wcstol(p, NULL, 10);
+ m_nPolygon = (n <= 0 ? 0 : n);
+ }
+ else if(cmd == L"q")
+ {
+ int n = wcstol(p, NULL, 10);
+ sub->m_wrapStyle = !p.IsEmpty() && (0 <= n && n <= 3)
+ ? n
+ : m_defaultWrapStyle;
+ }
+ else if(cmd == L"r")
+ {
+ STSStyle* val;
+ style = (!p.IsEmpty() && m_styles.Lookup(CString(p), val) && val) ? *val : org;
+ }
+ else if(cmd == L"shad")
+ {
+ double n = CalcAnimation(wcstod(p, NULL), style.shadowDepth, fAnimate);
+ style.shadowDepth = !p.IsEmpty()
+ ? (n < 0 ? 0 : n)
+ : org.shadowDepth;
+ }
+ else if(cmd == L"s")
+ {
+ int n = wcstol(p, NULL, 10);
+ style.fStrikeOut = !p.IsEmpty()
+ ? (n == 0 ? false : n == 1 ? true : org.fStrikeOut)
+ : org.fStrikeOut;
+ }
+ else if(cmd == L"t") // \t([<t1>,<t2>,][<accel>,]<style modifiers>)
+ {
+ p.Empty();
+
+ m_animStart = m_animEnd = 0;
+ m_animAccel = 1;
+
+ if(params.GetCount() == 1)
+ {
+ p = params[0];
+ }
+ else if(params.GetCount() == 2)
+ {
+ m_animAccel = wcstod(params[0], NULL);
+ p = params[1];
+ }
+ else if(params.GetCount() == 3)
+ {
+ m_animStart = (int)wcstod(params[0], NULL);
+ m_animEnd = (int)wcstod(params[1], NULL);
+ p = params[2];
+ }
+ else if(params.GetCount() == 4)
+ {
+ m_animStart = wcstol(params[0], NULL, 10);
+ m_animEnd = wcstol(params[1], NULL, 10);
+ m_animAccel = wcstod(params[2], NULL);
+ p = params[3];
+ }
+
+ ParseSSATag(sub, p, style, org, true);
+
+ sub->m_fAnimated = true;
+ }
+ else if(cmd == L"u")
+ {
+ int n = wcstol(p, NULL, 10);
+ style.fUnderline = !p.IsEmpty()
+ ? (n == 0 ? false : n == 1 ? true : org.fUnderline)
+ : org.fUnderline;
+ }
+ }
+
+// return(nUnrecognizedTags < nTags);
+ return(true); // there are ppl keeping coments inside {}, lets make them happy now
+}
+
+bool CRenderedTextSubtitle::ParseHtmlTag(CSubtitle* sub, CStringW str, STSStyle& style, STSStyle& org)
+{
+ if(str.Find(L"!--") == 0)
+ return(true);
+
+ bool fClosing = str[0] == '/';
+ str.Trim(L" /");
+
+ int i = str.Find(' ');
+ if(i < 0) i = str.GetLength();
+
+ CStringW tag = str.Left(i).MakeLower();
+ str = str.Mid(i).Trim();
+
+ CAtlArray<CStringW> attribs, params;
+ while((i = str.Find('=')) > 0)
+ {
+ attribs.Add(str.Left(i).Trim().MakeLower());
+ str = str.Mid(i+1);
+ for(i = 0; _istspace(str[i]); i++);
+ str = str.Mid(i);
+ if(str[0] == '\"') {str = str.Mid(1); i = str.Find('\"');}
+ else i = str.Find(' ');
+ if(i < 0) i = str.GetLength();
+ params.Add(str.Left(i).Trim().MakeLower());
+ str = str.Mid(i+1);
+ }
+
+ if(tag == L"text")
+ ;
+ else if(tag == L"b" || tag == L"strong")
+ style.fontWeight = !fClosing ? FW_BOLD : org.fontWeight;
+ else if(tag == L"i" || tag == L"em")
+ style.fItalic = !fClosing ? true : org.fItalic;
+ else if(tag == L"u")
+ style.fUnderline = !fClosing ? true : org.fUnderline;
+ else if(tag == L"s" || tag == L"strike" || tag == L"del")
+ style.fStrikeOut = !fClosing ? true : org.fStrikeOut;
+ else if(tag == L"font")
+ {
+ if(!fClosing)
+ {
+ for(i = 0; i < attribs.GetCount(); i++)
+ {
+ if(params[i].IsEmpty()) continue;
+
+ int nColor = -1;
+
+ if(attribs[i] == L"face")
+ {
+ style.fontName = params[i];
+ }
+ else if(attribs[i] == L"size")
+ {
+ if(params[i][0] == '+')
+ style.fontSize += wcstol(params[i], NULL, 10);
+ else if(params[i][0] == '-')
+ style.fontSize -= wcstol(params[i], NULL, 10);
+ else
+ style.fontSize = wcstol(params[i], NULL, 10);
+ }
+ else if(attribs[i] == L"color")
+ {
+ nColor = 0;
+ }
+ else if(attribs[i] == L"outline-color")
+ {
+ nColor = 2;
+ }
+ else if(attribs[i] == L"outline-level")
+ {
+ style.outlineWidth = wcstol(params[i], NULL, 10);
+ }
+ else if(attribs[i] == L"shadow-color")
+ {
+ nColor = 3;
+ }
+ else if(attribs[i] == L"shadow-level")
+ {
+ style.shadowDepth = wcstol(params[i], NULL, 10);
+ }
+
+ if(nColor >= 0 && nColor < 4)
+ {
+ CString key = WToT(params[i]).TrimLeft('#');
+ DWORD val;
+ if(g_colors.Lookup(key, val))
+ style.colors[nColor] = val;
+ else if((style.colors[nColor] = _tcstol(key, NULL, 16)) == 0)
+ style.colors[nColor] = 0x00ffffff; // default is white
+ style.colors[nColor] = ((style.colors[nColor]>>16)&0xff)|((style.colors[nColor]&0xff)<<16)|(style.colors[nColor]&0x00ff00);
+ }
+ }
+ }
+ else
+ {
+ style.fontName = org.fontName;
+ style.fontSize = org.fontSize;
+ memcpy(style.colors, org.colors, sizeof(style.colors));
+ }
+ }
+ else if(tag == L"k" && attribs.GetCount() == 1 && attribs[0] == L"t")
+ {
+ m_ktype = 1;
+ m_kstart = m_kend;
+ m_kend += wcstol(params[0], NULL, 10);
+ }
+ else
+ return(false);
+
+ return(true);
+}
+
+double CRenderedTextSubtitle::CalcAnimation(double dst, double src, bool fAnimate)
+{
+ int s = m_animStart ? m_animStart : 0;
+ int e = m_animEnd ? m_animEnd : m_delay;
+
+ if(fabs(dst-src) >= 0.0001 && fAnimate)
+ {
+ if(m_time < s) dst = src;
+ else if(s <= m_time && m_time < e)
+ {
+ double t = pow(1.0 * (m_time - s) / (e - s), m_animAccel);
+ dst = (1 - t) * src + t * dst;
+ }
+// else dst = dst;
+ }
+
+ return(dst);
+}
+
+CSubtitle* CRenderedTextSubtitle::GetSubtitle(int entry)
+{
+ CSubtitle* sub;
+ if(m_subtitleCache.Lookup(entry, sub))
+ {
+ if(sub->m_fAnimated) {delete sub; sub = NULL;}
+ else return(sub);
+ }
+
+ sub = new CSubtitle();
+ if(!sub) return(NULL);
+
+ CStringW str = GetStrW(entry, true);
+
+ STSStyle stss, orgstss;
+ GetStyle(entry, stss);
+ orgstss = stss;
+
+ sub->m_clip.SetRect(0, 0, m_size.cx>>3, m_size.cy>>3);
+ sub->m_scrAlignment = -stss.scrAlignment;
+ sub->m_wrapStyle = m_defaultWrapStyle;
+ sub->m_fAnimated = false;
+ sub->m_relativeTo = stss.relativeTo;
+
+ sub->m_scalex = m_dstScreenSize.cx > 0 ? 1.0 * (stss.relativeTo == 1 ? m_vidrect.Width() : m_size.cx) / (m_dstScreenSize.cx*8) : 1.0;
+ sub->m_scaley = m_dstScreenSize.cy > 0 ? 1.0 * (stss.relativeTo == 1 ? m_vidrect.Height() : m_size.cy) / (m_dstScreenSize.cy*8) : 1.0;
+
+ m_animStart = m_animEnd = 0;
+ m_animAccel = 1;
+ m_ktype = m_kstart = m_kend = 0;
+ m_nPolygon = 0;
+ m_polygonBaselineOffset = 0;
+
+ ParseEffect(sub, GetAt(entry).effect);
+
+ while(!str.IsEmpty())
+ {
+ bool fParsed = false;
+
+ int i;
+
+ if(str[0] == '{' && (i = str.Find(L'}')) > 0)
+ {
+ if(fParsed = ParseSSATag(sub, str.Mid(1, i-1), stss, orgstss))
+ str = str.Mid(i+1);
+ }
+ else if(str[0] == '<' && (i = str.Find(L'>')) > 0)
+ {
+ if(fParsed = ParseHtmlTag(sub, str.Mid(1, i-1), stss, orgstss))
+ str = str.Mid(i+1);
+ }
+
+ if(fParsed)
+ {
+ i = str.FindOneOf(L"{<");
+ if(i < 0) i = str.GetLength();
+ if(i == 0) continue;
+ }
+ else
+ {
+ i = str.Mid(1).FindOneOf(L"{<");
+ if(i < 0) i = str.GetLength()-1;
+ i++;
+ }
+
+ STSStyle tmp = stss;
+
+ tmp.fontSize = sub->m_scaley*tmp.fontSize*64;
+ tmp.fontSpacing = sub->m_scalex*tmp.fontSpacing*64;
+ tmp.outlineWidth *= (m_fScaledBAS ? ((sub->m_scalex+sub->m_scaley)/2) : 1) * 8;
+ tmp.shadowDepth *= (m_fScaledBAS ? ((sub->m_scalex+sub->m_scaley)/2) : 1) * 8;
+
+ if(m_nPolygon)
+ {
+ ParsePolygon(sub, str.Left(i), tmp);
+ }
+ else
+ {
+ ParseString(sub, str.Left(i), tmp);
+ }
+
+ str = str.Mid(i);
+ }
+
+ // just a "work-around" solution... in most cases nobody will want to use \org together with moving but without rotating the subs
+ if(sub->m_effects[EF_ORG] && (sub->m_effects[EF_MOVE] || sub->m_effects[EF_BANNER] || sub->m_effects[EF_SCROLL]))
+ sub->m_fAnimated = true;
+
+ sub->m_scrAlignment = abs(sub->m_scrAlignment);
+
+ STSEntry stse = GetAt(entry);
+ CRect marginRect = stse.marginRect;
+ if(marginRect.left == 0) marginRect.left = orgstss.marginRect.left;
+ if(marginRect.top == 0) marginRect.top = orgstss.marginRect.top;
+ if(marginRect.right == 0) marginRect.right = orgstss.marginRect.right;
+ if(marginRect.bottom == 0) marginRect.bottom = orgstss.marginRect.bottom;
+ marginRect.left = (int)(sub->m_scalex*marginRect.left*8);
+ marginRect.top = (int)(sub->m_scaley*marginRect.top*8);
+ marginRect.right = (int)(sub->m_scalex*marginRect.right*8);
+ marginRect.bottom = (int)(sub->m_scaley*marginRect.bottom*8);
+
+ if(stss.relativeTo == 1)
+ {
+ marginRect.left += m_vidrect.left;
+ marginRect.top += m_vidrect.top;
+ marginRect.right += m_size.cx - m_vidrect.right;
+ marginRect.bottom += m_size.cy - m_vidrect.bottom;
+ }
+
+ sub->CreateClippers(m_size);
+
+ sub->MakeLines(m_size, marginRect);
+
+ m_subtitleCache[entry] = sub;
+
+ return(sub);
+}
+
+//
+
+STDMETHODIMP CRenderedTextSubtitle::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+ *ppv = NULL;
+
+ return
+ QI(IPersist)
+ QI(ISubStream)
+ QI(ISubPicProvider)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ISubPicProvider
+
+STDMETHODIMP_(POSITION) CRenderedTextSubtitle::GetStartPosition(REFERENCE_TIME rt, double fps)
+{
+ int iSegment = -1;
+ SearchSubs((int)(rt/10000), fps, &iSegment, NULL);
+
+ if(iSegment < 0) iSegment = 0;
+
+ return(GetNext((POSITION)iSegment));
+}
+
+STDMETHODIMP_(POSITION) CRenderedTextSubtitle::GetNext(POSITION pos)
+{
+ int iSegment = (int)pos;
+
+ const STSSegment* stss;
+ while((stss = GetSegment(iSegment)) && stss->subs.GetCount() == 0)
+ iSegment++;
+
+ return(stss ? (POSITION)(iSegment+1) : NULL);
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CRenderedTextSubtitle::GetStart(POSITION pos, double fps)
+{
+ return(10000i64 * TranslateSegmentStart((int)pos-1, fps));
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CRenderedTextSubtitle::GetStop(POSITION pos, double fps)
+{
+ return(10000i64 * TranslateSegmentEnd((int)pos-1, fps));
+}
+
+STDMETHODIMP_(bool) CRenderedTextSubtitle::IsAnimated(POSITION pos)
+{
+ // TODO
+ return(true);
+}
+
+struct LSub {int idx, layer, readorder;};
+
+static int lscomp(const void* ls1, const void* ls2)
+{
+ int ret = ((LSub*)ls1)->layer - ((LSub*)ls2)->layer;
+ if(!ret) ret = ((LSub*)ls1)->readorder - ((LSub*)ls2)->readorder;
+ return(ret);
+}
+
+STDMETHODIMP CRenderedTextSubtitle::Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox)
+{
+ CRect bbox2(0,0,0,0);
+
+ if(m_size != CSize(spd.w*8, spd.h*8) || m_vidrect != CRect(spd.vidrect.left*8, spd.vidrect.top*8, spd.vidrect.right*8, spd.vidrect.bottom*8))
+ Init(CSize(spd.w, spd.h), spd.vidrect);
+
+ int t = (int)(rt / 10000);
+
+ int segment;
+ const STSSegment* stss = SearchSubs(t, fps, &segment);
+ if(!stss) return S_FALSE;
+
+ // clear any cached subs not in the range of +/-30secs measured from the segment's bounds
+ {
+ POSITION pos = m_subtitleCache.GetStartPosition();
+ while(pos)
+ {
+ int key;
+ CSubtitle* value;
+ m_subtitleCache.GetNextAssoc(pos, key, value);
+
+ STSEntry& stse = GetAt(key);
+ if(stse.end <= (t-30000) || stse.start > (t+30000))
+ {
+ delete value;
+ m_subtitleCache.RemoveKey(key);
+ pos = m_subtitleCache.GetStartPosition();
+ }
+ }
+ }
+
+ m_sla.AdvanceToSegment(segment, stss->subs);
+
+ CAtlArray<LSub> subs;
+
+ for(int i = 0, j = stss->subs.GetCount(); i < j; i++)
+ {
+ LSub ls;
+ ls.idx = stss->subs[i];
+ ls.layer = GetAt(stss->subs[i]).layer;
+ ls.readorder = GetAt(stss->subs[i]).readorder;
+ subs.Add(ls);
+ }
+
+ qsort(subs.GetData(), subs.GetCount(), sizeof(LSub), lscomp);
+
+ for(int i = 0, j = subs.GetCount(); i < j; i++)
+ {
+ int entry = subs[i].idx;
+
+ STSEntry stse = GetAt(entry);
+
+ {
+ int start = TranslateStart(entry, fps);
+ m_time = t - start;
+ m_delay = TranslateEnd(entry, fps) - start;
+ }
+
+ CSubtitle* s = GetSubtitle(entry);
+ if(!s) continue;
+
+ CRect clipRect = s->m_clip;
+ CRect r = s->m_rect;
+ CSize spaceNeeded = r.Size();
+
+ // apply the effects
+
+ bool fPosOverride = false, fOrgOverride = false;
+
+ int alpha = 0x00;
+
+ CPoint org2;
+
+ for(int k = 0; k < EF_NUMBEROFEFFECTS; k++)
+ {
+ if(!s->m_effects[k]) continue;
+
+ switch(k)
+ {
+ case EF_MOVE: // {\move(x1=param[0], y1=param[1], x2=param[2], y2=param[3], t1=t[0], t2=t[1])}
+ {
+ CPoint p;
+ CPoint p1(s->m_effects[k]->param[0], s->m_effects[k]->param[1]);
+ CPoint p2(s->m_effects[k]->param[2], s->m_effects[k]->param[3]);
+ int t1 = s->m_effects[k]->t[0];
+ int t2 = s->m_effects[k]->t[1];
+
+ if(t2 < t1) {int t = t1; t1 = t2; t2 = t;}
+
+ if(t1 <= 0 && t2 <= 0) {t1 = 0; t2 = m_delay;}
+
+ if(m_time <= t1) p = p1;
+ else if(t1 < m_time && m_time < t2)
+ {
+ double t = 1.0*(m_time-t1)/(t2-t1);
+ p.x = (int)((1-t)*p1.x + t*p2.x);
+ p.y = (int)((1-t)*p1.y + t*p2.y);
+ }
+ else p = p2;
+
+ r = CRect(
+ CPoint((s->m_scrAlignment%3) == 1 ? p.x : (s->m_scrAlignment%3) == 0 ? p.x - spaceNeeded.cx : p.x - (spaceNeeded.cx+1)/2,
+ s->m_scrAlignment <= 3 ? p.y - spaceNeeded.cy : s->m_scrAlignment <= 6 ? p.y - (spaceNeeded.cy+1)/2 : p.y),
+ spaceNeeded);
+
+ if(s->m_relativeTo == 1)
+ r.OffsetRect(m_vidrect.TopLeft());
+
+ fPosOverride = true;
+ }
+ break;
+ case EF_ORG: // {\org(x=param[0], y=param[1])}
+ {
+ org2 = CPoint(s->m_effects[k]->param[0], s->m_effects[k]->param[1]);
+
+ fOrgOverride = true;
+ }
+ break;
+ case EF_FADE: // {\fade(a1=param[0], a2=param[1], a3=param[2], t1=t[0], t2=t[1], t3=t[2], t4=t[3]) or {\fad(t1=t[1], t2=t[2])
+ {
+ int t1 = s->m_effects[k]->t[0];
+ int t2 = s->m_effects[k]->t[1];
+ int t3 = s->m_effects[k]->t[2];
+ int t4 = s->m_effects[k]->t[3];
+
+ if(t1 == -1 && t4 == -1) {t1 = 0; t3 = m_delay-t3; t4 = m_delay;}
+
+ if(m_time < t1) alpha = s->m_effects[k]->param[0];
+ else if(m_time >= t1 && m_time < t2)
+ {
+ double t = 1.0 * (m_time - t1) / (t2 - t1);
+ alpha = (int)(s->m_effects[k]->param[0]*(1-t) + s->m_effects[k]->param[1]*t);
+ }
+ else if(m_time >= t2 && m_time < t3) alpha = s->m_effects[k]->param[1];
+ else if(m_time >= t3 && m_time < t4)
+ {
+ double t = 1.0 * (m_time - t3) / (t4 - t3);
+ alpha = (int)(s->m_effects[k]->param[1]*(1-t) + s->m_effects[k]->param[2]*t);
+ }
+ else if(m_time >= t4) alpha = s->m_effects[k]->param[2];
+ }
+ break;
+ case EF_BANNER: // Banner;delay=param[0][;leftoright=param[1];fadeawaywidth=param[2]]
+ {
+ int left = s->m_relativeTo == 1 ? m_vidrect.left : 0,
+ right = s->m_relativeTo == 1 ? m_vidrect.right : m_size.cx;
+
+ r.left = !!s->m_effects[k]->param[1]
+ ? (left/*marginRect.left*/ - spaceNeeded.cx) + (int)(m_time*8.0/s->m_effects[k]->param[0])
+ : (right /*- marginRect.right*/) - (int)(m_time*8.0/s->m_effects[k]->param[0]);
+
+ r.right = r.left + spaceNeeded.cx;
+
+ clipRect &= CRect(left>>3, clipRect.top, right>>3, clipRect.bottom);
+
+ fPosOverride = true;
+ }
+ break;
+ case EF_SCROLL: // Scroll up/down(toptobottom=param[3]);top=param[0];bottom=param[1];delay=param[2][;fadeawayheight=param[4]]
+ {
+ r.top = !!s->m_effects[k]->param[3]
+ ? s->m_effects[k]->param[0] + (int)(m_time*8.0/s->m_effects[k]->param[2]) - spaceNeeded.cy
+ : s->m_effects[k]->param[1] - (int)(m_time*8.0/s->m_effects[k]->param[2]);
+
+ r.bottom = r.top + spaceNeeded.cy;
+
+ CRect cr(0, (s->m_effects[k]->param[0] + 4) >> 3, spd.w, (s->m_effects[k]->param[1] + 4) >> 3);
+
+ if(s->m_relativeTo == 1)
+ r.top += m_vidrect.top,
+ r.bottom += m_vidrect.top,
+ cr.top += m_vidrect.top>>3,
+ cr.bottom += m_vidrect.top>>3;
+
+ clipRect &= cr;
+
+ fPosOverride = true;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ if(!fPosOverride && !fOrgOverride && !s->m_fAnimated)
+ r = m_sla.AllocRect(s, segment, entry, stse.layer, m_collisions);
+
+ CPoint org;
+ org.x = (s->m_scrAlignment%3) == 1 ? r.left : (s->m_scrAlignment%3) == 2 ? r.CenterPoint().x : r.right;
+ org.y = s->m_scrAlignment <= 3 ? r.bottom : s->m_scrAlignment <= 6 ? r.CenterPoint().y : r.top;
+
+ if(!fOrgOverride) org2 = org;
+
+ BYTE* pAlphaMask = s->m_pClipper?s->m_pClipper->m_pAlphaMask:NULL;
+
+ CPoint p, p2(0, r.top);
+
+ POSITION pos;
+
+ p = p2;
+
+ pos = s->GetHeadPosition();
+ while(pos)
+ {
+ CLine* l = s->GetNext(pos);
+
+ p.x = (s->m_scrAlignment%3) == 1 ? org.x
+ : (s->m_scrAlignment%3) == 0 ? org.x - l->m_width
+ : org.x - (l->m_width/2);
+
+ bbox2 |= l->PaintShadow(spd, clipRect, pAlphaMask, p, org2, m_time, alpha);
+
+ p.y += l->m_ascent + l->m_descent;
+ }
+
+ p = p2;
+
+ pos = s->GetHeadPosition();
+ while(pos)
+ {
+ CLine* l = s->GetNext(pos);
+
+ p.x = (s->m_scrAlignment%3) == 1 ? org.x
+ : (s->m_scrAlignment%3) == 0 ? org.x - l->m_width
+ : org.x - (l->m_width/2);
+
+ bbox2 |= l->PaintOutline(spd, clipRect, pAlphaMask, p, org2, m_time, alpha);
+
+ p.y += l->m_ascent + l->m_descent;
+ }
+
+ p = p2;
+
+ pos = s->GetHeadPosition();
+ while(pos)
+ {
+ CLine* l = s->GetNext(pos);
+
+ p.x = (s->m_scrAlignment%3) == 1 ? org.x
+ : (s->m_scrAlignment%3) == 0 ? org.x - l->m_width
+ : org.x - (l->m_width/2);
+
+ bbox2 |= l->PaintBody(spd, clipRect, pAlphaMask, p, org2, m_time, alpha);
+
+ p.y += l->m_ascent + l->m_descent;
+ }
+ }
+
+ bbox = bbox2;
+
+ return (subs.GetCount() && !bbox2.IsRectEmpty()) ? S_OK : S_FALSE;
+}
+
+// IPersist
+
+STDMETHODIMP CRenderedTextSubtitle::GetClassID(CLSID* pClassID)
+{
+ return pClassID ? *pClassID = __uuidof(this), S_OK : E_POINTER;
+}
+
+// ISubStream
+
+STDMETHODIMP_(int) CRenderedTextSubtitle::GetStreamCount()
+{
+ return(1);
+}
+
+STDMETHODIMP CRenderedTextSubtitle::GetStreamInfo(int iStream, WCHAR** ppName, LCID* pLCID)
+{
+ if(iStream != 0) return E_INVALIDARG;
+
+ if(ppName)
+ {
+ if(!(*ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppName, CStringW(m_name));
+ }
+
+ if(pLCID)
+ {
+ *pLCID = 0; // TODO
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP_(int) CRenderedTextSubtitle::GetStream()
+{
+ return(0);
+}
+
+STDMETHODIMP CRenderedTextSubtitle::SetStream(int iStream)
+{
+ return iStream == 0 ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CRenderedTextSubtitle::Reload()
+{
+ CFileStatus s;
+ if(!CFile::GetStatus(m_path, s)) return E_FAIL;
+ return !m_path.IsEmpty() && Open(m_path, DEFAULT_CHARSET) ? S_OK : E_FAIL;
+}
diff --git a/src/subtitles/RTS.h b/src/subtitles/RTS.h
new file mode 100644
index 000000000..759816231
--- /dev/null
+++ b/src/subtitles/RTS.h
@@ -0,0 +1,267 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "STS.h"
+#include "Rasterizer.h"
+#include "..\SubPic\ISubPic.h"
+
+class CMyFont : public CFont
+{
+public:
+ int m_ascent, m_descent;
+
+ CMyFont(STSStyle& style);
+};
+
+class CPolygon;
+
+class CWord : public Rasterizer
+{
+ bool m_fDrawn;
+ CPoint m_p;
+
+ void Transform(CPoint org);
+
+ bool CreateOpaqueBox();
+
+protected:
+ CStringW m_str;
+
+ virtual bool CreatePath() = 0;
+
+public:
+ bool m_fWhiteSpaceChar, m_fLineBreak;
+
+ STSStyle m_style;
+
+ CPolygon* m_pOpaqueBox;
+
+ int m_ktype, m_kstart, m_kend;
+
+ int m_width, m_ascent, m_descent;
+
+ CWord(STSStyle& style, CStringW str, int ktype, int kstart, int kend); // str[0] = 0 -> m_fLineBreak = true (in this case we only need and use the height of m_font from the whole class)
+ virtual ~CWord();
+
+ virtual CWord* Copy() = 0;
+ virtual bool Append(CWord* w);
+
+ void Paint(CPoint p, CPoint org);
+};
+
+class CText : public CWord
+{
+protected:
+ virtual bool CreatePath();
+
+public:
+ CText(STSStyle& style, CStringW str, int ktype, int kstart, int kend);
+
+ virtual CWord* Copy();
+ virtual bool Append(CWord* w);
+};
+
+class CPolygon : public CWord
+{
+ bool GetLONG(CStringW& str, LONG& ret);
+ bool GetPOINT(CStringW& str, POINT& ret);
+ bool ParseStr();
+
+protected:
+ double m_scalex, m_scaley;
+ int m_baseline;
+
+ CAtlArray<BYTE> m_pathTypesOrg;
+ CAtlArray<CPoint> m_pathPointsOrg;
+
+ virtual bool CreatePath();
+
+public:
+ CPolygon(STSStyle& style, CStringW str, int ktype, int kstart, int kend, double scalex, double scaley, int baseline);
+ virtual ~CPolygon();
+
+ virtual CWord* Copy();
+ virtual bool Append(CWord* w);
+};
+
+class CClipper : public CPolygon
+{
+private:
+ CWord* Copy();
+ virtual bool Append(CWord* w);
+
+public:
+ CClipper(CStringW str, CSize size, double scalex, double scaley);
+ virtual ~CClipper();
+
+ CSize m_size;
+ BYTE* m_pAlphaMask;
+};
+
+class CLine : public CAtlList<CWord*>
+{
+public:
+ int m_width, m_ascent, m_descent, m_border;
+
+ virtual ~CLine();
+
+ void Compact();
+
+ CRect PaintShadow(SubPicDesc& spd, CRect& clipRect, BYTE* pAlphaMask, CPoint p, CPoint org, int time, int alpha);
+ CRect PaintOutline(SubPicDesc& spd, CRect& clipRect, BYTE* pAlphaMask, CPoint p, CPoint org, int time, int alpha);
+ CRect PaintBody(SubPicDesc& spd, CRect& clipRect, BYTE* pAlphaMask, CPoint p, CPoint org, int time, int alpha);
+};
+
+enum eftype
+{
+ EF_MOVE = 0, // {\move(x1=param[0], y1=param[1], x2=param[2], y2=param[3], t1=t[0], t2=t[1])} or {\pos(x=param[0], y=param[1])}
+ EF_ORG, // {\org(x=param[0], y=param[1])}
+ EF_FADE, // {\fade(a1=param[0], a2=param[1], a3=param[2], t1=t[0], t2=t[1], t3=t[2], t4=t[3])} or {\fad(t1=t[1], t2=t[2])
+ EF_BANNER, // Banner;delay=param[0][;lefttoright=param[1];fadeawaywidth=param[2]]
+ EF_SCROLL, // Scroll up/down=param[3];top=param[0];bottom=param[1];delay=param[2][;fadeawayheight=param[4]]
+};
+
+#define EF_NUMBEROFEFFECTS 5
+
+class Effect
+{
+public:
+ enum eftype type;
+ int param[8];
+ int t[4];
+};
+
+class CSubtitle : public CAtlList<CLine*>
+{
+ int GetFullWidth();
+ int GetFullLineWidth(POSITION pos);
+ int GetWrapWidth(POSITION pos, int maxwidth);
+ CLine* GetNextLine(POSITION& pos, int maxwidth);
+
+public:
+ int m_scrAlignment;
+ int m_wrapStyle;
+ bool m_fAnimated;
+ int m_relativeTo;
+
+ Effect* m_effects[EF_NUMBEROFEFFECTS];
+
+ CAtlList<CWord*> m_words;
+
+ CClipper* m_pClipper;
+
+ CRect m_rect, m_clip;
+ int m_topborder, m_bottomborder;
+
+ double m_scalex, m_scaley;
+
+public:
+ CSubtitle();
+ virtual ~CSubtitle();
+ virtual void Empty();
+
+ void CreateClippers(CSize size);
+
+ void MakeLines(CSize size, CRect marginRect);
+};
+
+class CScreenLayoutAllocator
+{
+ typedef struct
+ {
+ CRect r;
+ int segment, entry, layer;
+ } SubRect;
+
+ CAtlList<SubRect> m_subrects;
+
+public:
+ virtual void Empty();
+
+ void AdvanceToSegment(int segment, const CAtlArray<int>& sa);
+ CRect AllocRect(CSubtitle* s, int segment, int entry, int layer, int collisions);
+};
+
+[uuid("537DCACA-2812-4a4f-B2C6-1A34C17ADEB0")]
+class CRenderedTextSubtitle : public CSimpleTextSubtitle, public ISubPicProviderImpl, public ISubStream
+{
+ CAtlMap<int, CSubtitle*> m_subtitleCache;
+
+ CScreenLayoutAllocator m_sla;
+
+ CSize m_size;
+ CRect m_vidrect;
+
+ // temp variables, used when parsing the script
+ int m_time, m_delay;
+ int m_animStart, m_animEnd;
+ double m_animAccel;
+ int m_ktype, m_kstart, m_kend;
+ int m_nPolygon;
+ int m_polygonBaselineOffset;
+
+ void ParseEffect(CSubtitle* sub, CString str);
+ void ParseString(CSubtitle* sub, CStringW str, STSStyle& style);
+ void ParsePolygon(CSubtitle* sub, CStringW str, STSStyle& style);
+ bool ParseSSATag(CSubtitle* sub, CStringW str, STSStyle& style, STSStyle& org, bool fAnimate = false);
+ bool ParseHtmlTag(CSubtitle* sub, CStringW str, STSStyle& style, STSStyle& org);
+
+ double CalcAnimation(double dst, double src, bool fAnimate);
+
+ CSubtitle* GetSubtitle(int entry);
+
+protected:
+ virtual void OnChanged();
+
+public:
+ CRenderedTextSubtitle(CCritSec* pLock);
+ virtual ~CRenderedTextSubtitle();
+
+ virtual void Copy(CSimpleTextSubtitle& sts);
+ virtual void Empty();
+
+public:
+ bool Init(CSize size, CRect vidrect); // will call Deinit()
+ void Deinit();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicProvider
+ STDMETHODIMP_(POSITION) GetStartPosition(REFERENCE_TIME rt, double fps);
+ STDMETHODIMP_(POSITION) GetNext(POSITION pos);
+ STDMETHODIMP_(REFERENCE_TIME) GetStart(POSITION pos, double fps);
+ STDMETHODIMP_(REFERENCE_TIME) GetStop(POSITION pos, double fps);
+ STDMETHODIMP_(bool) IsAnimated(POSITION pos);
+ STDMETHODIMP Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox);
+
+ // IPersist
+ STDMETHODIMP GetClassID(CLSID* pClassID);
+
+ // ISubStream
+ STDMETHODIMP_(int) GetStreamCount();
+ STDMETHODIMP GetStreamInfo(int i, WCHAR** ppName, LCID* pLCID);
+ STDMETHODIMP_(int) GetStream();
+ STDMETHODIMP SetStream(int iStream);
+ STDMETHODIMP Reload();
+};
diff --git a/src/subtitles/Rasterizer.cpp b/src/subtitles/Rasterizer.cpp
new file mode 100644
index 000000000..218965a91
--- /dev/null
+++ b/src/subtitles/Rasterizer.cpp
@@ -0,0 +1,957 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <string.h>
+#include <math.h>
+#include <vector>
+#include <algorithm>
+#include "Rasterizer.h"
+
+Rasterizer::Rasterizer() : mpPathTypes(NULL), mpPathPoints(NULL), mPathPoints(0), mpOverlayBuffer(NULL)
+{
+ mOverlayWidth = mOverlayHeight = 0;
+ mPathOffsetX = mPathOffsetY = 0;
+ mOffsetX = mOffsetY = 0;
+}
+
+Rasterizer::~Rasterizer()
+{
+ _TrashPath();
+ _TrashOverlay();
+}
+
+void Rasterizer::_TrashPath()
+{
+ delete [] mpPathTypes;
+ delete [] mpPathPoints;
+ mpPathTypes = NULL;
+ mpPathPoints = NULL;
+ mPathPoints = 0;
+}
+
+void Rasterizer::_TrashOverlay()
+{
+ delete [] mpOverlayBuffer;
+ mpOverlayBuffer = NULL;
+}
+
+void Rasterizer::_ReallocEdgeBuffer(int edges)
+{
+ mEdgeHeapSize = edges;
+ mpEdgeBuffer = (Edge*)realloc(mpEdgeBuffer, sizeof(Edge)*edges);
+}
+
+void Rasterizer::_EvaluateBezier(int ptbase, bool fBSpline)
+{
+ const POINT* pt0 = mpPathPoints + ptbase;
+ const POINT* pt1 = mpPathPoints + ptbase + 1;
+ const POINT* pt2 = mpPathPoints + ptbase + 2;
+ const POINT* pt3 = mpPathPoints + ptbase + 3;
+
+ double x0 = pt0->x;
+ double x1 = pt1->x;
+ double x2 = pt2->x;
+ double x3 = pt3->x;
+ double y0 = pt0->y;
+ double y1 = pt1->y;
+ double y2 = pt2->y;
+ double y3 = pt3->y;
+
+ double cx3, cx2, cx1, cx0, cy3, cy2, cy1, cy0;
+
+ if(fBSpline)
+ {
+ // 1 [-1 +3 -3 +1]
+ // - * [+3 -6 +3 0]
+ // 6 [-3 0 +3 0]
+ // [+1 +4 +1 0]
+
+ double _1div6 = 1.0/6.0;
+
+ cx3 = _1div6*(- x0+3*x1-3*x2+x3);
+ cx2 = _1div6*( 3*x0-6*x1+3*x2);
+ cx1 = _1div6*(-3*x0 +3*x2);
+ cx0 = _1div6*( x0+4*x1+1*x2);
+
+ cy3 = _1div6*(- y0+3*y1-3*y2+y3);
+ cy2 = _1div6*( 3*y0-6*y1+3*y2);
+ cy1 = _1div6*(-3*y0 +3*y2);
+ cy0 = _1div6*( y0+4*y1+1*y2);
+ }
+ else // bezier
+ {
+ // [-1 +3 -3 +1]
+ // [+3 -6 +3 0]
+ // [-3 +3 0 0]
+ // [+1 0 0 0]
+
+ cx3 = - x0+3*x1-3*x2+x3;
+ cx2 = 3*x0-6*x1+3*x2;
+ cx1 = -3*x0+3*x1;
+ cx0 = x0;
+
+ cy3 = - y0+3*y1-3*y2+y3;
+ cy2 = 3*y0-6*y1+3*y2;
+ cy1 = -3*y0+3*y1;
+ cy0 = y0;
+ }
+
+ //
+ // This equation is from Graphics Gems I.
+ //
+ // The idea is that since we're approximating a cubic curve with lines,
+ // any error we incur is due to the curvature of the line, which we can
+ // estimate by calculating the maximum acceleration of the curve. For
+ // a cubic, the acceleration (second derivative) is a line, meaning that
+ // the absolute maximum acceleration must occur at either the beginning
+ // (|c2|) or the end (|c2+c3|). Our bounds here are a little more
+ // conservative than that, but that's okay.
+ //
+ // If the acceleration of the parametric formula is zero (c2 = c3 = 0),
+ // that component of the curve is linear and does not incur any error.
+ // If a=0 for both X and Y, the curve is a line segment and we can
+ // use a step size of 1.
+
+ double maxaccel1 = fabs(2*cy2) + fabs(6*cy3);
+ double maxaccel2 = fabs(2*cx2) + fabs(6*cx3);
+
+ double maxaccel = maxaccel1 > maxaccel2 ? maxaccel1 : maxaccel2;
+ double h = 1.0;
+
+ if(maxaccel > 8.0) h = sqrt(8.0 / maxaccel);
+
+ if(!fFirstSet) {firstp.x = (LONG)cx0; firstp.y = (LONG)cy0; lastp = firstp; fFirstSet = true;}
+
+ for(double t = 0; t < 1.0; t += h)
+ {
+ double x = cx0 + t*(cx1 + t*(cx2 + t*cx3));
+ double y = cy0 + t*(cy1 + t*(cy2 + t*cy3));
+ _EvaluateLine(lastp.x, lastp.y, (int)x, (int)y);
+ }
+
+ double x = cx0 + cx1 + cx2 + cx3;
+ double y = cy0 + cy1 + cy2 + cy3;
+ _EvaluateLine(lastp.x, lastp.y, (int)x, (int)y);
+}
+
+void Rasterizer::_EvaluateLine(int pt1idx, int pt2idx)
+{
+ const POINT* pt1 = mpPathPoints + pt1idx;
+ const POINT* pt2 = mpPathPoints + pt2idx;
+
+ _EvaluateLine(pt1->x, pt1->y, pt2->x, pt2->y);
+}
+
+void Rasterizer::_EvaluateLine(int x0, int y0, int x1, int y1)
+{
+ if(lastp.x != x0 || lastp.y != y0)
+ {
+ _EvaluateLine(lastp.x, lastp.y, x0, y0);
+ }
+
+ if(!fFirstSet) {firstp.x = x0; firstp.y = y0; fFirstSet = true;}
+ lastp.x = x1; lastp.y = y1;
+
+ if(y1 > y0) // down
+ {
+ __int64 xacc = (__int64)x0 << 13;
+
+ // prestep y0 down
+
+ int dy = y1 - y0;
+ int y = ((y0 + 3)&~7) + 4;
+ int iy = y >> 3;
+
+ y1 = (y1 - 5) >> 3;
+
+ if(iy <= y1)
+ {
+ __int64 invslope = (__int64(x1 - x0) << 16) / dy;
+
+ while(mEdgeNext + y1 + 1 - iy > mEdgeHeapSize)
+ _ReallocEdgeBuffer(mEdgeHeapSize*2);
+
+ xacc += (invslope * (y - y0)) >> 3;
+
+ while(iy <= y1)
+ {
+ int ix = (int)((xacc + 32768) >> 16);
+
+ mpEdgeBuffer[mEdgeNext].next = mpScanBuffer[iy];
+ mpEdgeBuffer[mEdgeNext].posandflag = ix*2 + 1;
+
+ mpScanBuffer[iy] = mEdgeNext++;
+
+ ++iy;
+ xacc += invslope;
+ }
+ }
+ }
+ else if(y1 < y0) // up
+ {
+ __int64 xacc = (__int64)x1 << 13;
+
+ // prestep y1 down
+
+ int dy = y0 - y1;
+ int y = ((y1 + 3)&~7) + 4;
+ int iy = y >> 3;
+
+ y0 = (y0 - 5) >> 3;
+
+ if(iy <= y0)
+ {
+ __int64 invslope = (__int64(x0 - x1) << 16) / dy;
+
+ while(mEdgeNext + y0 + 1 - iy > mEdgeHeapSize)
+ _ReallocEdgeBuffer(mEdgeHeapSize*2);
+
+ xacc += (invslope * (y - y1)) >> 3;
+
+ while(iy <= y0)
+ {
+ int ix = (int)((xacc + 32768) >> 16);
+
+ mpEdgeBuffer[mEdgeNext].next = mpScanBuffer[iy];
+ mpEdgeBuffer[mEdgeNext].posandflag = ix*2;
+
+ mpScanBuffer[iy] = mEdgeNext++;
+
+ ++iy;
+ xacc += invslope;
+ }
+ }
+ }
+}
+
+bool Rasterizer::BeginPath(HDC hdc)
+{
+ _TrashPath();
+
+ return !!::BeginPath(hdc);
+}
+
+bool Rasterizer::EndPath(HDC hdc)
+{
+ ::CloseFigure(hdc);
+
+ if(::EndPath(hdc))
+ {
+ mPathPoints = GetPath(hdc, NULL, NULL, 0);
+
+ if(!mPathPoints)
+ return true;
+
+ mpPathTypes = (BYTE*)malloc(sizeof(BYTE) * mPathPoints);
+ mpPathPoints = (POINT*)malloc(sizeof(POINT) * mPathPoints);
+
+ if(mPathPoints == GetPath(hdc, mpPathPoints, mpPathTypes, mPathPoints))
+ return true;
+ }
+
+ ::AbortPath(hdc);
+
+ return false;
+}
+
+bool Rasterizer::PartialBeginPath(HDC hdc, bool bClearPath)
+{
+ if(bClearPath)
+ _TrashPath();
+
+ return !!::BeginPath(hdc);
+}
+
+bool Rasterizer::PartialEndPath(HDC hdc, long dx, long dy)
+{
+ ::CloseFigure(hdc);
+
+ if(::EndPath(hdc))
+ {
+ int nPoints;
+ BYTE* pNewTypes;
+ POINT* pNewPoints;
+
+ nPoints = GetPath(hdc, NULL, NULL, 0);
+
+ if(!nPoints)
+ return true;
+
+ pNewTypes = (BYTE*)realloc(mpPathTypes, (mPathPoints + nPoints) * sizeof(BYTE));
+ pNewPoints = (POINT*)realloc(mpPathPoints, (mPathPoints + nPoints) * sizeof(POINT));
+
+ if(pNewTypes)
+ mpPathTypes = pNewTypes;
+
+ if(pNewPoints)
+ mpPathPoints = pNewPoints;
+
+ BYTE* pTypes = new BYTE[nPoints];
+ POINT* pPoints = new POINT[nPoints];
+
+ if(pNewTypes && pNewPoints && nPoints == GetPath(hdc, pPoints, pTypes, nPoints))
+ {
+ for(int i = 0; i < nPoints; ++i)
+ {
+ mpPathPoints[mPathPoints + i].x = pPoints[i].x + dx;
+ mpPathPoints[mPathPoints + i].y = pPoints[i].y + dy;
+ mpPathTypes[mPathPoints + i] = pTypes[i];
+ }
+
+ mPathPoints += nPoints;
+
+ delete[] pTypes;
+ delete[] pPoints;
+ return true;
+ }
+ else
+ DebugBreak();
+
+ delete[] pTypes;
+ delete[] pPoints;
+ }
+
+ ::AbortPath(hdc);
+
+ return false;
+}
+
+bool Rasterizer::ScanConvert()
+{
+ int lastmoveto = -1;
+ int i;
+
+ // Drop any outlines we may have.
+
+ mOutline.clear();
+ mWideOutline.clear();
+
+ // Determine bounding box
+
+ if(!mPathPoints)
+ {
+ mPathOffsetX = mPathOffsetY = 0;
+ mWidth = mHeight = 0;
+ return 0;
+ }
+
+ int minx = INT_MAX;
+ int miny = INT_MAX;
+ int maxx = INT_MIN;
+ int maxy = INT_MIN;
+
+ for(i=0; i<mPathPoints; ++i)
+ {
+ int ix = mpPathPoints[i].x;
+ int iy = mpPathPoints[i].y;
+
+ if(ix < minx) minx = ix;
+ if(ix > maxx) maxx = ix;
+ if(iy < miny) miny = iy;
+ if(iy > maxy) maxy = iy;
+ }
+
+ minx = (minx >> 3) & ~7;
+ miny = (miny >> 3) & ~7;
+ maxx = (maxx + 7) >> 3;
+ maxy = (maxy + 7) >> 3;
+
+ for(i=0; i<mPathPoints; ++i)
+ {
+ mpPathPoints[i].x -= minx*8;
+ mpPathPoints[i].y -= miny*8;
+ }
+
+ if(minx > maxx || miny > maxy)
+ {
+ mWidth = mHeight = 0;
+ mPathOffsetX = mPathOffsetY = 0;
+ _TrashPath();
+ return true;
+ }
+
+ mWidth = maxx + 1 - minx;
+ mHeight = maxy + 1 - miny;
+
+ mPathOffsetX = minx;
+ mPathOffsetY = miny;
+
+ // Initialize edge buffer. We use edge 0 as a sentinel.
+
+ mEdgeNext = 1;
+ mEdgeHeapSize = 2048;
+ mpEdgeBuffer = (Edge*)malloc(sizeof(Edge)*mEdgeHeapSize);
+
+ // Initialize scanline list.
+
+ mpScanBuffer = new unsigned int[mHeight];
+ memset(mpScanBuffer, 0, mHeight*sizeof(unsigned int));
+
+ // Scan convert the outline. Yuck, Bezier curves....
+
+ // Unfortunately, Windows 95/98 GDI has a bad habit of giving us text
+ // paths with all but the first figure left open, so we can't rely
+ // on the PT_CLOSEFIGURE flag being used appropriately.
+
+ fFirstSet = false;
+ firstp.x = firstp.y = 0;
+ lastp.x = lastp.y = 0;
+
+ for(i=0; i<mPathPoints; ++i)
+ {
+ BYTE t = mpPathTypes[i] & ~PT_CLOSEFIGURE;
+
+ switch(t)
+ {
+ case PT_MOVETO:
+ if(lastmoveto >= 0 && firstp != lastp)
+ _EvaluateLine(lastp.x, lastp.y, firstp.x, firstp.y);
+ lastmoveto = i;
+ fFirstSet = false;
+ lastp = mpPathPoints[i];
+ break;
+ case PT_MOVETONC:
+ break;
+ case PT_LINETO:
+ if(mPathPoints - (i-1) >= 2) _EvaluateLine(i-1, i);
+ break;
+ case PT_BEZIERTO:
+ if(mPathPoints - (i-1) >= 4) _EvaluateBezier(i-1, false);
+ i += 2;
+ break;
+ case PT_BSPLINETO:
+ if(mPathPoints - (i-1) >= 4) _EvaluateBezier(i-1, true);
+ i += 2;
+ break;
+ case PT_BSPLINEPATCHTO:
+ if(mPathPoints - (i-3) >= 4) _EvaluateBezier(i-3, true);
+ break;
+ }
+ }
+
+ if(lastmoveto >= 0 && firstp != lastp)
+ _EvaluateLine(lastp.x, lastp.y, firstp.x, firstp.y);
+
+ // Free the path since we don't need it anymore.
+
+ _TrashPath();
+
+ // Convert the edges to spans. We couldn't do this before because some of
+ // the regions may have winding numbers >+1 and it would have been a pain
+ // to try to adjust the spans on the fly. We use one heap to detangle
+ // a scanline's worth of edges from the singly-linked lists, and another
+ // to collect the actual scans.
+
+ std::vector<int> heap;
+
+ mOutline.reserve(mEdgeNext / 2);
+
+ __int64 y = 0;
+
+ for(y=0; y<mHeight; ++y)
+ {
+ int count = 0;
+
+ // Detangle scanline into edge heap.
+
+ for(unsigned ptr = (unsigned)(mpScanBuffer[y]&0xffffffff); ptr; ptr = mpEdgeBuffer[ptr].next)
+ {
+ heap.push_back(mpEdgeBuffer[ptr].posandflag);
+ }
+
+ // Sort edge heap. Note that we conveniently made the opening edges
+ // one more than closing edges at the same spot, so we won't have any
+ // problems with abutting spans.
+
+ std::sort(heap.begin(), heap.end()/*begin() + heap.size()*/);
+
+ // Process edges and add spans. Since we only check for a non-zero
+ // winding number, it doesn't matter which way the outlines go!
+
+ std::vector<int>::iterator itX1 = heap.begin();
+ std::vector<int>::iterator itX2 = heap.end(); // begin() + heap.size();
+
+ int x1, x2;
+
+ for(; itX1 != itX2; ++itX1)
+ {
+ int x = *itX1;
+
+ if(!count)
+ x1 = (x>>1);
+
+ if(x&1)
+ ++count;
+ else
+ --count;
+
+ if(!count)
+ {
+ x2 = (x>>1);
+
+ if(x2>x1)
+ mOutline.push_back(std::pair<__int64,__int64>((y<<32)+x1+0x4000000040000000i64, (y<<32)+x2+0x4000000040000000i64)); // G: damn Avery, this is evil! :)
+ }
+ }
+
+ heap.clear();
+ }
+
+ // Dump the edge and scan buffers, since we no longer need them.
+
+ free(mpEdgeBuffer);
+ delete [] mpScanBuffer;
+
+ // All done!
+
+ return true;
+}
+
+using namespace std;
+
+void Rasterizer::_OverlapRegion(tSpanBuffer& dst, tSpanBuffer& src, int dx, int dy)
+{
+ tSpanBuffer temp;
+
+ temp.reserve(dst.size() + src.size());
+
+ dst.swap(temp);
+
+ tSpanBuffer::iterator itA = temp.begin();
+ tSpanBuffer::iterator itAE = temp.end();
+ tSpanBuffer::iterator itB = src.begin();
+ tSpanBuffer::iterator itBE = src.end();
+
+ // Don't worry -- even if dy<0 this will still work! // G: hehe, the evil twin :)
+
+ unsigned __int64 offset1 = (((__int64)dy)<<32) - dx;
+ unsigned __int64 offset2 = (((__int64)dy)<<32) + dx;
+
+ while(itA != itAE && itB != itBE)
+ {
+ if((*itB).first + offset1 < (*itA).first)
+ {
+ // B span is earlier. Use it.
+
+ unsigned __int64 x1 = (*itB).first + offset1;
+ unsigned __int64 x2 = (*itB).second + offset2;
+
+ ++itB;
+
+ // B spans don't overlap, so begin merge loop with A first.
+
+ for(;;)
+ {
+ // If we run out of A spans or the A span doesn't overlap,
+ // then the next B span can't either (because B spans don't
+ // overlap) and we exit.
+
+ if(itA == itAE || (*itA).first > x2)
+ break;
+
+ do {x2 = _MAX(x2, (*itA++).second);}
+ while(itA != itAE && (*itA).first <= x2);
+
+ // If we run out of B spans or the B span doesn't overlap,
+ // then the next A span can't either (because A spans don't
+ // overlap) and we exit.
+
+ if(itB == itBE || (*itB).first + offset1 > x2)
+ break;
+
+ do {x2 = _MAX(x2, (*itB++).second + offset2);}
+ while(itB != itBE && (*itB).first + offset1 <= x2);
+ }
+
+ // Flush span.
+
+ dst.push_back(tSpan(x1, x2));
+ }
+ else
+ {
+ // A span is earlier. Use it.
+
+ unsigned __int64 x1 = (*itA).first;
+ unsigned __int64 x2 = (*itA).second;
+
+ ++itA;
+
+ // A spans don't overlap, so begin merge loop with B first.
+
+ for(;;)
+ {
+ // If we run out of B spans or the B span doesn't overlap,
+ // then the next A span can't either (because A spans don't
+ // overlap) and we exit.
+
+ if(itB == itBE || (*itB).first + offset1 > x2)
+ break;
+
+ do {x2 = _MAX(x2, (*itB++).second + offset2);}
+ while(itB != itBE && (*itB).first + offset1 <= x2);
+
+ // If we run out of A spans or the A span doesn't overlap,
+ // then the next B span can't either (because B spans don't
+ // overlap) and we exit.
+
+ if(itA == itAE || (*itA).first > x2)
+ break;
+
+ do {x2 = _MAX(x2, (*itA++).second);}
+ while(itA != itAE && (*itA).first <= x2);
+ }
+
+ // Flush span.
+
+ dst.push_back(tSpan(x1, x2));
+ }
+ }
+
+ // Copy over leftover spans.
+
+ while(itA != itAE)
+ dst.push_back(*itA++);
+
+ while(itB != itBE)
+ {
+ dst.push_back(tSpan((*itB).first + offset1, (*itB).second + offset2));
+ ++itB;
+ }
+}
+
+bool Rasterizer::CreateWidenedRegion(int r)
+{
+ if(r < 0) r = 0;
+
+ for(int y = -r; y <= r; ++y)
+ {
+ int x = (int)(0.5 + sqrt(float(r*r - y*y)));
+
+ _OverlapRegion(mWideOutline, mOutline, x, y);
+ }
+
+ mWideBorder = r;
+
+ return true;
+}
+
+void Rasterizer::DeleteOutlines()
+{
+ mWideOutline.clear();
+ mOutline.clear();
+}
+
+bool Rasterizer::Rasterize(int xsub, int ysub, bool fBlur)
+{
+ _TrashOverlay();
+
+ if(!mWidth || !mHeight)
+ {
+ mOverlayWidth = mOverlayHeight = 0;
+ return true;
+ }
+
+ xsub &= 7;
+ ysub &= 7;
+
+ int width = mWidth + xsub;
+ int height = mHeight + ysub;
+
+ mOffsetX = mPathOffsetX - xsub;
+ mOffsetY = mPathOffsetY - ysub;
+
+ mWideBorder = (mWideBorder+7)&~7;
+
+ if(!mWideOutline.empty())
+ {
+ width += 2*mWideBorder;
+ height += 2*mWideBorder;
+
+ xsub += mWideBorder;
+ ysub += mWideBorder;
+
+ mOffsetX -= mWideBorder;
+ mOffsetY -= mWideBorder;
+ }
+
+ mOverlayWidth = ((width+7)>>3) + 1;
+ mOverlayHeight = ((height+7)>>3) + 1;
+
+ mpOverlayBuffer = new byte[2 * mOverlayWidth * mOverlayHeight];
+ memset(mpOverlayBuffer, 0, 2 * mOverlayWidth * mOverlayHeight);
+
+ // Are we doing a border?
+
+ tSpanBuffer* pOutline[2] = {&mOutline, &mWideOutline};
+
+ for(int i = countof(pOutline)-1; i >= 0; i--)
+ {
+ tSpanBuffer::iterator it = pOutline[i]->begin();
+ tSpanBuffer::iterator itEnd = pOutline[i]->end();
+
+ for(; it!=itEnd; ++it)
+ {
+ int y = (int)(((*it).first >> 32) - 0x40000000 + ysub);
+ int x1 = (int)(((*it).first & 0xffffffff) - 0x40000000 + xsub);
+ int x2 = (int)(((*it).second & 0xffffffff) - 0x40000000 + xsub);
+
+ if(x2 > x1)
+ {
+ int first = x1>>3;
+ int last = (x2-1)>>3;
+ byte* dst = mpOverlayBuffer + 2*(mOverlayWidth*(y>>3) + first) + i;
+
+ if(first == last)
+ *dst += x2-x1;
+ else
+ {
+ *dst += ((first+1)<<3) - x1;
+ dst += 2;
+
+ while(++first < last)
+ {
+ *dst += 0x08;
+ dst += 2;
+ }
+
+ *dst += x2 - (last<<3);
+ }
+ }
+ }
+ }
+
+ if(fBlur && mOverlayWidth >= 3 && mOverlayHeight >= 3)
+ {
+ int pitch = mOverlayWidth*2;
+
+ byte* tmp = new byte[pitch*mOverlayHeight];
+ if(!tmp) return(false);
+
+ memcpy(tmp, mpOverlayBuffer, pitch*mOverlayHeight);
+
+ int border = !mWideOutline.empty() ? 1 : 0;
+
+ for(int j = 1; j < mOverlayHeight-1; j++)
+ {
+ byte* src = tmp + pitch*j + 2 + border;
+ byte* dst = mpOverlayBuffer + pitch*j + 2 + border;
+
+ for(int i = 1; i < mOverlayWidth-1; i++, src+=2, dst+=2)
+ {
+ *dst = (src[-2-pitch] + (src[-pitch]<<1) + src[+2-pitch]
+ + (src[-2]<<1) + (src[0]<<2) + (src[+2]<<1)
+ + src[-2+pitch] + (src[+pitch]<<1) + src[+2+pitch]) >> 4;
+ }
+ }
+
+ delete [] tmp;
+ }
+
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+#define pixmix(s) { \
+ int a = (((s)*(color>>24))>>6)&0xff; \
+ int ia = 256-a; \
+ \
+ dst[wt] = ((((dst[wt]&0x00ff00ff)*ia + (color&0x00ff00ff)*a)&0xff00ff00)>>8) \
+ | ((((dst[wt]&0x0000ff00)*ia + (color&0x0000ff00)*a)&0x00ff0000)>>8) \
+ | ((((dst[wt]>>8)&0x00ff0000)*ia)&0xff000000); \
+ } \
+
+#include <xmmintrin.h>
+#include <emmintrin.h>
+
+__forceinline void pixmix_sse2(DWORD* dst, DWORD color, DWORD alpha)
+{
+ alpha = ((alpha * (color>>24)) >> 6) & 0xff;
+ color &= 0xffffff;
+
+ __m128i zero = _mm_setzero_si128();
+ __m128i a = _mm_set1_epi32((alpha << 16) | (0x100 - alpha));
+ __m128i d = _mm_unpacklo_epi8(_mm_cvtsi32_si128(*dst), zero);
+ __m128i s = _mm_unpacklo_epi8(_mm_cvtsi32_si128(color), zero);
+ __m128i r = _mm_unpacklo_epi16(d, s);
+
+ r = _mm_madd_epi16(r, a);
+ r = _mm_srli_epi32(r, 8);
+ r = _mm_packs_epi32(r, r);
+ r = _mm_packus_epi16(r, r);
+
+ *dst = (DWORD)_mm_cvtsi128_si32(r);
+}
+
+#include "../dsutil/vd.h"
+
+CRect Rasterizer::Draw(SubPicDesc& spd, CRect& clipRect, byte* pAlphaMask, int xsub, int ysub, const long* switchpts, bool fBody, bool fBorder)
+{
+ CRect bbox(0, 0, 0, 0);
+
+ if(!switchpts || !fBody && !fBorder) return(bbox);
+
+ // clip
+
+ CRect r(0, 0, spd.w, spd.h);
+ r &= clipRect;
+
+ int x = (xsub + mOffsetX + 4)>>3;
+ int y = (ysub + mOffsetY + 4)>>3;
+ int w = mOverlayWidth;
+ int h = mOverlayHeight;
+ int xo = 0, yo = 0;
+
+ if(x < r.left) {xo = r.left-x; w -= r.left-x; x = r.left;}
+ if(y < r.top) {yo = r.top-y; h -= r.top-y; y = r.top;}
+ if(x+w > r.right) w = r.right-x;
+ if(y+h > r.bottom) h = r.bottom-y;
+
+ if(w <= 0 || h <= 0) return(bbox);
+
+ bbox.SetRect(x, y, x+w, y+h);
+ bbox &= CRect(0, 0, spd.w, spd.h);
+
+ // draw
+
+ const byte* src = mpOverlayBuffer + 2*(mOverlayWidth * yo + xo);
+ const byte* s = fBorder ? (src+1) : src;
+ const byte* am = pAlphaMask + spd.w * y + x;
+ unsigned long* dst = (unsigned long *)((char *)spd.bits + spd.pitch * y) + x;
+
+ unsigned long color = switchpts[0];
+
+ bool fSSE2 = !!(g_cpuid.m_flags & CCpuID::sse2);
+
+ while(h--)
+ {
+ if(!pAlphaMask)
+ {
+ if(switchpts[1] == 0xffffffff)
+ {
+ if(fBody)
+ {
+ if(fSSE2) for(int wt=0; wt<w; ++wt) pixmix_sse2(&dst[wt], color, s[wt*2]);
+ else for(int wt=0; wt<w; ++wt) pixmix(s[wt*2]);
+ }
+ else
+ {
+ if(fSSE2) for(int wt=0; wt<w; ++wt) pixmix_sse2(&dst[wt], color, src[wt*2+1] - src[wt*2]);
+ else for(int wt=0; wt<w; ++wt) pixmix(src[wt*2+1] - src[wt*2]);
+ }
+ }
+ else
+ {
+ const long *sw = switchpts;
+
+ if(fBody)
+ {
+ if(fSSE2)
+ for(int wt=0; wt<w; ++wt)
+ {
+ if(wt+xo >= sw[1]) {while(wt+xo >= sw[1]) sw += 2; color = sw[-2];}
+ pixmix_sse2(&dst[wt], color, s[wt*2]);
+ }
+ else
+ for(int wt=0; wt<w; ++wt)
+ {
+ if(wt+xo >= sw[1]) {while(wt+xo >= sw[1]) sw += 2; color = sw[-2];}
+ pixmix(s[wt*2]);
+ }
+ }
+ else
+ {
+ if(fSSE2)
+ for(int wt=0; wt<w; ++wt)
+ {
+ if(wt+xo >= sw[1]) {while(wt+xo >= sw[1]) sw += 2; color = sw[-2];}
+ pixmix_sse2(&dst[wt], color, src[wt*2+1] - src[wt*2]);
+ }
+ else
+ for(int wt=0; wt<w; ++wt)
+ {
+ if(wt+xo >= sw[1]) {while(wt+xo >= sw[1]) sw += 2; color = sw[-2];}
+ pixmix(src[wt*2+1] - src[wt*2]);
+ }
+ }
+ }
+ }
+ else
+ {
+ if(switchpts[1] == 0xffffffff)
+ {
+ if(fBody)
+ {
+ if(fSSE2) for(int wt=0; wt<w; ++wt) pixmix_sse2(&dst[wt], color, s[wt*2] * am[wt]);
+ else for(int wt=0; wt<w; ++wt) pixmix(s[wt*2] * am[wt]);
+ }
+ else
+ {
+ if(fSSE2) for(int wt=0; wt<w; ++wt) pixmix_sse2(&dst[wt], color, (src[wt*2+1] - src[wt*2]) * am[wt]);
+ else for(int wt=0; wt<w; ++wt) pixmix((src[wt*2+1] - src[wt*2]) * am[wt]);
+ }
+ }
+ else
+ {
+ const long *sw = switchpts;
+
+ if(fBody)
+ {
+ if(fSSE2)
+ for(int wt=0; wt<w; ++wt)
+ {
+ if(wt+xo >= sw[1]) {while(wt+xo >= sw[1]) sw += 2; color = sw[-2];}
+ pixmix_sse2(&dst[wt], color, s[wt*2] * am[wt]);
+ }
+ else
+ for(int wt=0; wt<w; ++wt)
+ {
+ if(wt+xo >= sw[1]) {while(wt+xo >= sw[1]) sw += 2; color = sw[-2];}
+ pixmix(s[wt*2] * am[wt]);
+ }
+ }
+ else
+ {
+ if(fSSE2)
+ for(int wt=0; wt<w; ++wt)
+ {
+ if(wt+xo >= sw[1]) {while(wt+xo >= sw[1]) sw += 2; color = sw[-2];}
+ pixmix_sse2(&dst[wt], color, (src[wt*2+1] - src[wt*2]) * am[wt]);
+ }
+ else
+ for(int wt=0; wt<w; ++wt)
+ {
+ if(wt+xo >= sw[1]) {while(wt+xo >= sw[1]) sw += 2; color = sw[-2];}
+ pixmix((src[wt*2+1] - src[wt*2]) * am[wt]);
+ }
+ }
+ }
+ }
+
+ src += 2*mOverlayWidth;
+ s += 2*mOverlayWidth;
+ am += spd.w;
+ dst = (unsigned long *)((char *)dst + spd.pitch);
+ }
+
+ return bbox;
+}
diff --git a/src/subtitles/Rasterizer.h b/src/subtitles/Rasterizer.h
new file mode 100644
index 000000000..1493b7f76
--- /dev/null
+++ b/src/subtitles/Rasterizer.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <vector>
+#include "..\SubPic\ISubPic.h"
+
+#define PT_MOVETONC 0xfe
+#define PT_BSPLINETO 0xfc
+#define PT_BSPLINEPATCHTO 0xfa
+
+class Rasterizer
+{
+ bool fFirstSet;
+ CPoint firstp, lastp;
+
+protected:
+ BYTE* mpPathTypes;
+ POINT* mpPathPoints;
+ int mPathPoints;
+
+private:
+ int mWidth, mHeight;
+
+ typedef std::pair<unsigned __int64, unsigned __int64> tSpan;
+ typedef std::vector<tSpan> tSpanBuffer;
+
+ tSpanBuffer mOutline;
+ tSpanBuffer mWideOutline;
+ int mWideBorder;
+
+ struct Edge {
+ int next;
+ int posandflag;
+ } *mpEdgeBuffer;
+ unsigned mEdgeHeapSize;
+ unsigned mEdgeNext;
+
+ unsigned int* mpScanBuffer;
+
+ typedef unsigned char byte;
+
+protected:
+ byte *mpOverlayBuffer;
+ int mOverlayWidth, mOverlayHeight;
+ int mPathOffsetX, mPathOffsetY;
+ int mOffsetX, mOffsetY;
+
+private:
+ void _TrashPath();
+ void _TrashOverlay();
+ void _ReallocEdgeBuffer(int edges);
+ void _EvaluateBezier(int ptbase, bool fBSpline);
+ void _EvaluateLine(int pt1idx, int pt2idx);
+ void _EvaluateLine(int x0, int y0, int x1, int y1);
+ static void _OverlapRegion(tSpanBuffer& dst, tSpanBuffer& src, int dx, int dy);
+
+public:
+ Rasterizer();
+ virtual ~Rasterizer();
+
+ bool BeginPath(HDC hdc);
+ bool EndPath(HDC hdc);
+ bool PartialBeginPath(HDC hdc, bool bClearPath);
+ bool PartialEndPath(HDC hdc, long dx, long dy);
+ bool ScanConvert();
+ bool CreateWidenedRegion(int border);
+ void DeleteOutlines();
+ bool Rasterize(int xsub, int ysub, bool fBlur);
+ CRect Draw(SubPicDesc& spd, CRect& clipRect, byte* pAlphaMask, int xsub, int ysub, const long* switchpts, bool fBody, bool fBorder);
+};
+
diff --git a/src/subtitles/SSF.cpp b/src/subtitles/SSF.cpp
new file mode 100644
index 000000000..e4578bcec
--- /dev/null
+++ b/src/subtitles/SSF.cpp
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "SSF.h"
+
+CRenderedSSF::CRenderedSSF(CCritSec* pLock)
+ : ISubPicProviderImpl(pLock)
+{
+}
+
+CRenderedSSF::~CRenderedSSF()
+{
+}
+
+bool CRenderedSSF::Open(CString fn, CString name)
+{
+ m_fn.Empty();
+ m_name.Empty();
+ m_psf.Free();
+
+ if(name.IsEmpty())
+ {
+ CString str = fn;
+ str.Replace('\\', '/');
+ name = str.Left(str.ReverseFind('.'));
+ name = name.Mid(name.ReverseFind('/')+1);
+ name = name.Mid(name.ReverseFind('.')+1);
+ }
+
+ try
+ {
+ if(Open(ssf::FileStream(fn), name))
+ {
+ m_fn = fn;
+ return true;
+ }
+ }
+ catch(ssf::Exception& e)
+ {
+ TRACE(_T("%s\n"), e.ToString());
+ }
+
+ return false;
+}
+
+bool CRenderedSSF::Open(ssf::Stream& s, CString name)
+{
+ m_fn.Empty();
+ m_name.Empty();
+ m_psf.Free();
+
+ try
+ {
+ m_psf.Attach(new ssf::SubtitleFile());
+ m_psf->Parse(s);
+#ifdef DEBUG
+ m_psf->Dump(ssf::PLow);
+ double at = 0;
+ for(int i = 9000; i < 12000; i += 10)
+ {
+ double at = (double)i/1000;
+ CAutoPtrList<ssf::Subtitle> subs;
+ m_psf->Lookup(at, subs);
+ POSITION pos = subs.GetHeadPosition();
+ while(pos)
+ {
+ const ssf::Subtitle* s = subs.GetNext(pos);
+
+ POSITION pos = s->m_text.GetHeadPosition();
+ while(pos)
+ {
+ const ssf::Text& t = s->m_text.GetNext(pos);
+ TRACE(_T("%.3f: [%.2f] %s\n"), at, t.style.font.size, t.str);
+ }
+ }
+ }
+#endif
+ m_name = name;
+ return true;
+ }
+ catch(ssf::Exception& e)
+ {
+ TRACE(_T("%s\n"), e.ToString());
+ }
+
+ return false;
+}
+
+STDMETHODIMP CRenderedSSF::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+ *ppv = NULL;
+
+ return
+ QI(IPersist)
+ QI(ISubStream)
+ QI(ISubPicProvider)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ISubPicProvider
+
+STDMETHODIMP_(POSITION) CRenderedSSF::GetStartPosition(REFERENCE_TIME rt, double fps)
+{
+ size_t k;
+ return m_psf && m_psf->m_segments.Lookup((double)rt/10000000, k) ? (POSITION)(++k) : NULL;
+}
+
+STDMETHODIMP_(POSITION) CRenderedSSF::GetNext(POSITION pos)
+{
+ size_t k = (size_t)pos;
+ return m_psf && m_psf->m_segments.GetSegment(k) ? (POSITION)(++k) : NULL;
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CRenderedSSF::GetStart(POSITION pos, double fps)
+{
+ size_t k = (size_t)pos-1;
+ const ssf::SubtitleFile::Segment* s = m_psf ? m_psf->m_segments.GetSegment(k) : NULL;
+ return s ? (REFERENCE_TIME)(s->m_start*10000000) : 0;
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CRenderedSSF::GetStop(POSITION pos, double fps)
+{
+ CheckPointer(m_psf, 0);
+
+ size_t k = (size_t)pos-1;
+ const ssf::SubtitleFile::Segment* s = m_psf ? m_psf->m_segments.GetSegment(k) : NULL;
+ return s ? (REFERENCE_TIME)(s->m_stop*10000000) : 0;
+}
+
+STDMETHODIMP_(bool) CRenderedSSF::IsAnimated(POSITION pos)
+{
+ return true;
+}
+
+STDMETHODIMP CRenderedSSF::Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox)
+{
+ CheckPointer(m_psf, E_UNEXPECTED);
+
+ CAutoLock csAutoLock(m_pLock);
+
+ double at = (double)rt/10000000;
+
+ CAutoPtrList<ssf::Subtitle> subs;
+ m_psf->Lookup(at, subs);
+
+ POSITION pos = subs.GetHeadPosition();
+ while(pos)
+ {
+ ssf::Subtitle* s = subs.GetNext(pos);
+
+ // TODO: render s...
+
+ TRACE(_T("start: %.3f, stop: %.3f\n"), s->m_time.start, s->m_time.stop);
+
+ POSITION pos = s->m_text.GetHeadPosition();
+ while(pos)
+ {
+ ssf::Text& t = s->m_text.GetNext(pos);
+/*
+
+ ssf::Placement& p = t.style.placement;
+ TRACE(_T("%.1f: %d [%.0f-%.0f-%.0f-%.0f, %f, %.0f-%.0f-%.0f-%.0f] '%s'\n"),
+ at,
+ t.style.fill.id,
+ t.style.font.color[0], t.style.font.color[1], t.style.font.color[2], t.style.font.color[3],
+ t.style.fill.width,
+ t.style.fill.color[0], t.style.fill.color[1], t.style.fill.color[2], t.style.fill.color[3],
+ t.str);
+*/
+ }
+
+ TRACE(_T("------------\n"));
+ }
+
+ return E_NOTIMPL;
+}
+
+// IPersist
+
+STDMETHODIMP CRenderedSSF::GetClassID(CLSID* pClassID)
+{
+ return pClassID ? *pClassID = __uuidof(this), S_OK : E_POINTER;
+}
+
+// ISubStream
+
+STDMETHODIMP_(int) CRenderedSSF::GetStreamCount()
+{
+ return 1;
+}
+
+STDMETHODIMP CRenderedSSF::GetStreamInfo(int iStream, WCHAR** ppName, LCID* pLCID)
+{
+ if(iStream != 0) return E_INVALIDARG;
+
+ if(ppName)
+ {
+ if(!(*ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppName, CStringW(m_name));
+ }
+
+ if(pLCID)
+ {
+ *pLCID = 0; // TODO
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP_(int) CRenderedSSF::GetStream()
+{
+ return 0;
+}
+
+STDMETHODIMP CRenderedSSF::SetStream(int iStream)
+{
+ return iStream == 0 ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CRenderedSSF::Reload()
+{
+ CAutoLock csAutoLock(m_pLock);
+
+ return !m_fn.IsEmpty() && Open(m_fn, m_name) ? S_OK : E_FAIL;
+}
diff --git a/src/subtitles/SSF.h b/src/subtitles/SSF.h
new file mode 100644
index 000000000..4dc5f9b1f
--- /dev/null
+++ b/src/subtitles/SSF.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+//#include "Rasterizer.h"
+#include "..\SubPic\ISubPic.h"
+#include ".\libssf\SubtitleFile.h"
+
+#pragma once
+
+[uuid("E0593632-0AB7-47CA-8BE1-E9D2A6A4825E")]
+class CRenderedSSF : public ISubPicProviderImpl, public ISubStream
+{
+ CString m_fn, m_name;
+ CAutoPtr<ssf::SubtitleFile> m_psf;
+
+public:
+ CRenderedSSF(CCritSec* pLock);
+ virtual ~CRenderedSSF();
+
+ bool Open(CString fn, CString name = _T(""));
+ bool Open(ssf::Stream& s, CString name);
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicProvider
+ STDMETHODIMP_(POSITION) GetStartPosition(REFERENCE_TIME rt, double fps);
+ STDMETHODIMP_(POSITION) GetNext(POSITION pos);
+ STDMETHODIMP_(REFERENCE_TIME) GetStart(POSITION pos, double fps);
+ STDMETHODIMP_(REFERENCE_TIME) GetStop(POSITION pos, double fps);
+ STDMETHODIMP_(bool) IsAnimated(POSITION pos);
+ STDMETHODIMP Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox);
+
+ // IPersist
+ STDMETHODIMP GetClassID(CLSID* pClassID);
+
+ // ISubStream
+ STDMETHODIMP_(int) GetStreamCount();
+ STDMETHODIMP GetStreamInfo(int i, WCHAR** ppName, LCID* pLCID);
+ STDMETHODIMP_(int) GetStream();
+ STDMETHODIMP SetStream(int iStream);
+ STDMETHODIMP Reload();
+};
diff --git a/src/subtitles/STS.cpp b/src/subtitles/STS.cpp
new file mode 100644
index 000000000..80425e11f
--- /dev/null
+++ b/src/subtitles/STS.cpp
@@ -0,0 +1,3036 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "STS.h"
+#include <atlbase.h>
+
+// gathered from http://www.netwave.or.jp/~shikai/shikai/shcolor.htm
+
+struct htmlcolor {TCHAR* name; DWORD color;} hmtlcolors[] =
+{
+ {_T("white"), 0xffffff},
+ {_T("whitesmoke"), 0xf5f5f5},
+ {_T("ghostwhite"), 0xf8f8ff},
+ {_T("snow"), 0xfffafa},
+ {_T("gainsboro"), 0xdcdcdc},
+ {_T("lightgrey"), 0xd3d3d3},
+ {_T("silver"), 0xc0c0c0},
+ {_T("darkgray"), 0xa9a9a9},
+ {_T("gray"), 0x808080},
+ {_T("dimgray"), 0x696969},
+ {_T("lightslategray"), 0x778899},
+ {_T("slategray"), 0x708090},
+ {_T("darkslategray"), 0x2f4f4f},
+ {_T("black"), 0x000000},
+
+ {_T("azure"), 0xf0ffff},
+ {_T("aliceblue"), 0xf0f8ff},
+ {_T("mintcream"), 0xf5fffa},
+ {_T("honeydew"), 0xf0fff0},
+ {_T("lightcyan"), 0xe0ffff},
+ {_T("paleturqoise"), 0xafeeee},
+ {_T("powderblue"), 0xb0e0e6},
+ {_T("lightblue"), 0xadd8ed},
+ {_T("lightsteelblue"), 0xb0c4de},
+ {_T("skyblue"), 0x87ceeb},
+ {_T("lightskyblue"), 0x87cefa},
+ {_T("cyan"), 0x00ffff},
+ {_T("aqua"), 0x00ff80},
+ {_T("deepskyblue"), 0x00bfff},
+ {_T("aquamarine"), 0x7fffd4},
+ {_T("turquoise"), 0x40e0d0},
+ {_T("darkturquoise"), 0x00ced1},
+ {_T("lightseagreen"), 0x20b2aa},
+ {_T("mediumturquoise"), 0x40e0dd},
+ {_T("mediumaquamarine"), 0x66cdaa},
+ {_T("cadetblue"), 0x5f9ea0},
+ {_T("teal"), 0x008080},
+ {_T("darkcyan"), 0x008b8b},
+ {_T("comflowerblue"), 0x6495ed},
+ {_T("dodgerblue"), 0x1e90ff},
+ {_T("steelblue"), 0x4682b4},
+ {_T("royalblue"), 0x4169e1},
+ {_T("blue"), 0x0000ff},
+ {_T("mediumblue"), 0x0000cd},
+ {_T("mediumslateblue"), 0x7b68ee},
+ {_T("slateblue"), 0x6a5acd},
+ {_T("darkslateblue"), 0x483d8b},
+ {_T("darkblue"), 0x00008b},
+ {_T("midnightblue"), 0x191970},
+ {_T("navy"), 0x000080},
+
+ {_T("palegreen"), 0x98fb98},
+ {_T("lightgreen"), 0x90ee90},
+ {_T("mediumspringgreen"), 0x00fa9a},
+ {_T("springgreen"), 0x00ff7f},
+ {_T("chartreuse"), 0x7fff00},
+ {_T("lawngreen"), 0x7cfc00},
+ {_T("lime"), 0x00ff00},
+ {_T("limegreen"), 0x32cd32},
+ {_T("greenyellow"), 0xadff2f},
+ {_T("yellowgreen"), 0x9acd32},
+ {_T("darkseagreen"), 0x8fbc8f},
+ {_T("mediumseagreen"), 0x3cb371},
+ {_T("seagreen"), 0x2e8b57},
+ {_T("olivedrab"), 0x6b8e23},
+ {_T("forestgreen"), 0x228b22},
+ {_T("green"), 0x008000},
+ {_T("darkkhaki"), 0xbdb76b},
+ {_T("olive"), 0x808000},
+ {_T("darkolivegreen"), 0x556b2f},
+ {_T("darkgreen"), 0x006400},
+
+ {_T("floralwhite"), 0xfffaf0},
+ {_T("seashell"), 0xfff5ee},
+ {_T("ivory"), 0xfffff0},
+ {_T("beige"), 0xf5f5dc},
+ {_T("cornsilk"), 0xfff8dc},
+ {_T("lemonchiffon"), 0xfffacd},
+ {_T("lightyellow"), 0xffffe0},
+ {_T("lightgoldenrodyellow"), 0xfafad2},
+ {_T("papayawhip"), 0xffefd5},
+ {_T("blanchedalmond"), 0xffedcd},
+ {_T("palegoldenrod"), 0xeee8aa},
+ {_T("khaki"), 0xf0eb8c},
+ {_T("bisque"), 0xffe4c4},
+ {_T("moccasin"), 0xffe4b5},
+ {_T("navajowhite"), 0xffdead},
+ {_T("peachpuff"), 0xffdab9},
+ {_T("yellow"), 0xffff00},
+ {_T("gold"), 0xffd700},
+ {_T("wheat"), 0xf5deb3},
+ {_T("orange"), 0xffa500},
+ {_T("darkorange"), 0xff8c00},
+
+ {_T("oldlace"), 0xfdf5e6},
+ {_T("linen"), 0xfaf0e6},
+ {_T("antiquewhite"), 0xfaebd7},
+ {_T("lightsalmon"), 0xffa07a},
+ {_T("darksalmon"), 0xe9967a},
+ {_T("salmon"), 0xfa8072},
+ {_T("lightcoral"), 0xf08080},
+ {_T("indianred"), 0xcd5c5c},
+ {_T("coral"), 0xff7f50},
+ {_T("tomato"), 0xff6347},
+ {_T("orangered"), 0xff4500},
+ {_T("red"), 0xff0000},
+ {_T("crimson"), 0xdc143c},
+ {_T("firebrick"), 0xb22222},
+ {_T("maroon"), 0x800000},
+ {_T("darkred"), 0x8b0000},
+
+ {_T("lavender"), 0xe6e6fe},
+ {_T("lavenderblush"), 0xfff0f5},
+ {_T("mistyrose"), 0xffe4e1},
+ {_T("thistle"), 0xd8bfd8},
+ {_T("pink"), 0xffc0cb},
+ {_T("lightpink"), 0xffb6c1},
+ {_T("palevioletred"), 0xdb7093},
+ {_T("hotpink"), 0xff69b4},
+ {_T("fuchsia"), 0xff00ee},
+ {_T("magenta"), 0xff00ff},
+ {_T("mediumvioletred"), 0xc71585},
+ {_T("deeppink"), 0xff1493},
+ {_T("plum"), 0xdda0dd},
+ {_T("violet"), 0xee82ee},
+ {_T("orchid"), 0xda70d6},
+ {_T("mediumorchid"), 0xba55d3},
+ {_T("mediumpurple"), 0x9370db},
+ {_T("purple"), 0x9370db},
+ {_T("blueviolet"), 0x8a2be2},
+ {_T("darkviolet"), 0x9400d3},
+ {_T("darkorchid"), 0x9932cc},
+
+ {_T("tan"), 0xd2b48c},
+ {_T("burlywood"), 0xdeb887},
+ {_T("sandybrown"), 0xf4a460},
+ {_T("peru"), 0xcd853f},
+ {_T("goldenrod"), 0xdaa520},
+ {_T("darkgoldenrod"), 0xb8860b},
+ {_T("chocolate"), 0xd2691e},
+ {_T("rosybrown"), 0xbc8f8f},
+ {_T("sienna"), 0xa0522d},
+ {_T("saddlebrown"), 0x8b4513},
+ {_T("brown"), 0xa52a2a},
+};
+
+CHtmlColorMap::CHtmlColorMap()
+{
+ for(int i = 0; i < countof(hmtlcolors); i++)
+ SetAt(hmtlcolors[i].name, hmtlcolors[i].color);
+}
+
+CHtmlColorMap g_colors;
+
+//
+
+BYTE CharSetList[] =
+{
+ ANSI_CHARSET,
+ DEFAULT_CHARSET,
+ SYMBOL_CHARSET,
+ SHIFTJIS_CHARSET,
+ HANGEUL_CHARSET,
+ HANGUL_CHARSET,
+ GB2312_CHARSET,
+ CHINESEBIG5_CHARSET,
+ OEM_CHARSET,
+ JOHAB_CHARSET,
+ HEBREW_CHARSET,
+ ARABIC_CHARSET,
+ GREEK_CHARSET,
+ TURKISH_CHARSET,
+ VIETNAMESE_CHARSET,
+ THAI_CHARSET,
+ EASTEUROPE_CHARSET,
+ RUSSIAN_CHARSET,
+ MAC_CHARSET,
+ BALTIC_CHARSET
+};
+
+TCHAR* CharSetNames[] =
+{
+ _T("ANSI"),
+ _T("DEFAULT"),
+ _T("SYMBOL"),
+ _T("SHIFTJIS"),
+ _T("HANGEUL"),
+ _T("HANGUL"),
+ _T("GB2312"),
+ _T("CHINESEBIG5"),
+ _T("OEM"),
+ _T("JOHAB"),
+ _T("HEBREW"),
+ _T("ARABIC"),
+ _T("GREEK"),
+ _T("TURKISH"),
+ _T("VIETNAMESE"),
+ _T("THAI"),
+ _T("EASTEUROPE"),
+ _T("RUSSIAN"),
+ _T("MAC"),
+ _T("BALTIC"),
+};
+
+int CharSetLen = countof(CharSetList);
+
+//
+
+static DWORD CharSetToCodePage(DWORD dwCharSet)
+{
+ CHARSETINFO cs={0};
+ ::TranslateCharsetInfo((DWORD *)dwCharSet, &cs, TCI_SRCCHARSET);
+ return cs.ciACP;
+}
+
+int FindChar(CStringW str, WCHAR c, int pos, bool fUnicode, int CharSet)
+{
+ if(fUnicode) return(str.Find(c, pos));
+
+ int fStyleMod = 0;
+
+ DWORD cp = CharSetToCodePage(CharSet);
+ int OrgCharSet = CharSet;
+
+ for(int i = 0, j = str.GetLength(), k; i < j; i++)
+ {
+ WCHAR c2 = str[i];
+
+ if(IsDBCSLeadByteEx(cp, (BYTE)c2)) i++;
+ else if(i >= pos)
+ {
+ if(c2 == c) return(i);
+ }
+
+ if(c2 == '{') fStyleMod++;
+ else if(fStyleMod > 0)
+ {
+ if(c2 == '}') fStyleMod--;
+ else if(c2 == 'e' && i >= 3 && i < j-1 && str.Mid(i-2, 3) == L"\\fe")
+ {
+ CharSet = 0;
+ for(k = i+1; _istdigit(str[k]); k++) CharSet = CharSet*10 + (str[k] - '0');
+ if(k == i+1) CharSet = OrgCharSet;
+
+ cp = CharSetToCodePage(CharSet);
+ }
+ }
+ }
+
+ return(-1);
+}
+/*
+int FindChar(CStringA str, char c, int pos, bool fUnicode, int CharSet)
+{
+ ASSERT(!fUnicode);
+
+ return(FindChar(AToW(str), c, pos, false, CharSet));
+}
+*/
+static CStringW ToMBCS(CStringW str, DWORD CharSet)
+{
+ CStringW ret;
+
+ DWORD cp = CharSetToCodePage(CharSet);
+
+ for(int i = 0, j = str.GetLength(); i < j; i++)
+ {
+ WCHAR wc = str.GetAt(i);
+ char c[8];
+
+ int len;
+ if((len = WideCharToMultiByte(cp, 0, &wc, 1, c, 8, NULL, NULL)) > 0)
+ {
+ for(int k = 0; k < len; k++)
+ ret += (WCHAR)(BYTE)c[k];
+ }
+ else
+ {
+ ret += '?';
+ }
+ }
+
+ return(ret);
+}
+
+static CStringW UnicodeSSAToMBCS(CStringW str, DWORD CharSet)
+{
+ CStringW ret;
+
+ int OrgCharSet = CharSet;
+
+ for(int j = 0; j < str.GetLength(); )
+ {
+ j = str.Find('{', j);
+ if(j >= 0)
+ {
+ ret += ToMBCS(str.Left(j), CharSet);
+ str = str.Mid(j);
+
+ j = str.Find('}');
+ if(j < 0)
+ {
+ ret += ToMBCS(str, CharSet);
+ break;
+ }
+ else
+ {
+ int k = str.Find(L"\\fe");
+ if(k >= 0 && k < j)
+ {
+ CharSet = 0;
+ int l = k+3;
+ for(; _istdigit(str[l]); l++) CharSet = CharSet*10 + (str[l] - '0');
+ if(l == k+3) CharSet = OrgCharSet;
+ }
+
+ j++;
+
+ ret += ToMBCS(str.Left(j), OrgCharSet);
+ str = str.Mid(j);
+ j = 0;
+ }
+ }
+ else
+ {
+ ret += ToMBCS(str, CharSet);
+ break;
+ }
+ }
+
+ return(ret);
+}
+
+static CStringW ToUnicode(CStringW str, DWORD CharSet)
+{
+ CStringW ret;
+
+ DWORD cp = CharSetToCodePage(CharSet);
+
+ for(int i = 0, j = str.GetLength(); i < j; i++)
+ {
+ WCHAR wc = str.GetAt(i);
+ char c = wc&0xff;
+
+ if(IsDBCSLeadByteEx(cp, (BYTE)wc))
+ {
+ i++;
+
+ if(i < j)
+ {
+ char cc[2];
+ cc[0] = c;
+ cc[1] = (char)str.GetAt(i);
+
+ MultiByteToWideChar(cp, 0, cc, 2, &wc, 1);
+ }
+ }
+ else
+ {
+ MultiByteToWideChar(cp, 0, &c, 1, &wc, 1);
+ }
+
+ ret += wc;
+ }
+
+ return(ret);
+}
+
+static CStringW MBCSSSAToUnicode(CStringW str, int CharSet)
+{
+ CStringW ret;
+
+ int OrgCharSet = CharSet;
+
+ for(int j = 0; j < str.GetLength(); )
+ {
+ j = FindChar(str, '{', 0, false, CharSet);
+
+ if(j >= 0)
+ {
+ ret += ToUnicode(str.Left(j), CharSet);
+ str = str.Mid(j);
+
+ j = FindChar(str, '}', 0, false, CharSet);
+
+ if(j < 0)
+ {
+ ret += ToUnicode(str, CharSet);
+ break;
+ }
+ else
+ {
+ int k = str.Find(L"\\fe");
+ if(k >= 0 && k < j)
+ {
+ CharSet = 0;
+ int l = k+3;
+ for(; _istdigit(str[l]); l++) CharSet = CharSet*10 + (str[l] - '0');
+ if(l == k+3) CharSet = OrgCharSet;
+ }
+
+ j++;
+
+ ret += ToUnicode(str.Left(j), OrgCharSet);
+ str = str.Mid(j);
+ j = 0;
+ }
+ }
+ else
+ {
+ ret += ToUnicode(str, CharSet);
+ break;
+ }
+ }
+
+ return(ret);
+}
+
+CStringW RemoveSSATags(CStringW str, bool fUnicode, int CharSet)
+{
+ for(int i = 0, j; i < str.GetLength(); )
+ {
+ if((i = FindChar(str, '{', i, fUnicode, CharSet)) < 0) break;
+ if((j = FindChar(str, '}', i, fUnicode, CharSet)) < 0) break;
+ str.Delete(i, j-i+1);
+ }
+
+ str.Replace(L"\\N", L"\n");
+ str.Replace(L"\\n", L"\n");
+ str.Replace(L"\\h", L" ");
+
+ return(str);
+}
+
+//
+
+static CStringW SubRipper2SSA(CStringW str, int CharSet)
+{
+ str.Replace(L"<i>", L"{\\i1}");
+ str.Replace(L"</i>", L"{\\i}");
+ str.Replace(L"<b>", L"{\\b1}");
+ str.Replace(L"</b>", L"{\\b}");
+ str.Replace(L"<u>", L"{\\u1}");
+ str.Replace(L"</u>", L"{\\u}");
+
+ return(str);
+}
+
+static bool OpenSubRipper(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ int num = 0;
+
+ CStringW buff;
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty()) continue;
+
+ WCHAR sep;
+ int hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2;
+ int c = swscanf(buff, L"%d%c%d%c%d%c%d --> %d%c%d%c%d%c%d\n",
+ &hh1, &sep, &mm1, &sep, &ss1, &sep, &ms1,
+ &hh2, &sep, &mm2, &sep, &ss2, &sep, &ms2);
+
+ if(c == 1) // numbering
+ {
+ num = hh1;
+ }
+ else if(c == 14) // time info
+ {
+ CStringW str, tmp;
+
+ bool fFoundEmpty = false;
+
+ while(file->ReadString(tmp))
+ {
+ tmp.Trim();
+ if(tmp.IsEmpty()) fFoundEmpty = true;
+
+ int num2;
+ WCHAR c;
+ if(swscanf(tmp, L"%d%c", &num2, &c) == 1 && fFoundEmpty)
+ {
+ num = num2;
+ break;
+ }
+
+ str += tmp + '\n';
+ }
+
+ ret.Add(
+ SubRipper2SSA(str, CharSet),
+ file->IsUnicode(),
+ (((hh1*60 + mm1)*60) + ss1)*1000 + ms1,
+ (((hh2*60 + mm2)*60) + ss2)*1000 + ms2);
+ }
+ else if(c != EOF) // might be another format
+ {
+ return(false);
+ }
+ }
+
+ return(ret.GetCount() > 0);
+}
+
+static bool OpenOldSubRipper(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ CStringW buff;
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty()) continue;
+
+ for(int i = 0; i < buff.GetLength(); i++)
+ {
+ if((i = FindChar(buff, '|', i, file->IsUnicode(), CharSet)) < 0) break;
+ buff.SetAt(i, '\n');
+ }
+
+ int hh1, mm1, ss1, hh2, mm2, ss2;
+ int c = swscanf(buff, L"{%d:%d:%d}{%d:%d:%d}", &hh1, &mm1, &ss1, &hh2, &mm2, &ss2);
+
+ if(c == 6)
+ {
+ ret.Add(
+ buff.Mid(buff.Find('}', buff.Find('}')+1)+1),
+ file->IsUnicode(),
+ (((hh1*60 + mm1)*60) + ss1)*1000,
+ (((hh2*60 + mm2)*60) + ss2)*1000);
+ }
+ else if(c != EOF) // might be another format
+ {
+ return(false);
+ }
+ }
+
+ return(ret.GetCount() > 0);
+}
+
+static bool OpenSubViewer(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ STSStyle def;
+ CStringW font, color, size;
+ bool fBold, fItalic, fStriked, fUnderline;
+
+ CStringW buff;
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty()) continue;
+
+ if(buff[0] == '[')
+ {
+ for(int i = 0; i < buff.GetLength() && buff[i]== '['; )
+ {
+ int j = buff.Find(']', ++i);
+ if(j < i) break;
+
+ CStringW tag = buff.Mid(i,j-i);
+ tag.Trim();
+ tag.MakeLower();
+
+ i += j-i;
+
+ j = buff.Find('[', ++i);
+ if(j < 0) j = buff.GetLength();
+
+ CStringW param = buff.Mid(i,j-i);
+ param.Trim(L" \\t,");
+
+ i = j;
+
+ if(tag == L"font")
+ font = def.fontName.CompareNoCase(WToT(param)) ? param : L"";
+ else if(tag == L"colf")
+ color = def.colors[0] != wcstol(((LPCWSTR)param)+2, 0, 16) ? param : L"";
+ else if(tag == L"size")
+ size = def.fontSize != wcstol(param, 0, 10) ? param : L"";
+ else if(tag == L"style")
+ {
+ if(param.Find(L"no") >= 0)
+ {
+ fBold = fItalic = fStriked = fUnderline = false;
+ }
+ else
+ {
+ fBold = def.fontWeight < FW_BOLD && param.Find(L"bd") >= 0;
+ fItalic = def.fItalic && param.Find(L"it") >= 0;
+ fStriked = def.fStrikeOut && param.Find(L"st") >= 0;
+ fUnderline = def.fUnderline && param.Find(L"ud") >= 0;
+ }
+ }
+ }
+
+ continue;
+ }
+
+ WCHAR sep;
+ int hh1, mm1, ss1, hs1, hh2, mm2, ss2, hs2;
+ int c = swscanf(buff, L"%d:%d:%d%c%d,%d:%d:%d%c%d\n",
+ &hh1, &mm1, &ss1, &sep, &hs1, &hh2, &mm2, &ss2, &sep, &hs2);
+
+ if(c == 10)
+ {
+ CStringW str;
+ file->ReadString(str);
+
+ str.Replace(L"[br]", L"\\N");
+
+ CStringW prefix;
+ if(!font.IsEmpty()) prefix += L"\\fn" + font;
+ if(!color.IsEmpty()) prefix += L"\\c" + color;
+ if(!size.IsEmpty()) prefix += L"\\fs" + size;
+ if(fBold) prefix += L"\\b1";
+ if(fItalic) prefix += L"\\i1";
+ if(fStriked) prefix += L"\\s1";
+ if(fUnderline) prefix += L"\\u1";
+ if(!prefix.IsEmpty()) str = L"{" + prefix + L"}" + str;
+
+ ret.Add(str,
+ file->IsUnicode(),
+ (((hh1*60 + mm1)*60) + ss1)*1000 + hs1*10,
+ (((hh2*60 + mm2)*60) + ss2)*1000 + hs2*10);
+ }
+ else if(c != EOF) // might be another format
+ {
+ return(false);
+ }
+ }
+
+ return(ret.GetCount() > 0);
+}
+
+static STSStyle* GetMicroDVDStyle(CString str, int CharSet)
+{
+ STSStyle* ret = new STSStyle();
+ if(!ret) return(NULL);
+
+ for(int i = 0, len = str.GetLength(); i < len; i++)
+ {
+ int j = str.Find('{', i);
+ if(j < 0) j = len;
+
+ if(j >= len) break;
+
+ int k = str.Find('}', j);
+ if(k < 0) k = len;
+
+ CString code = str.Mid(j, k-j);
+ if(code.GetLength() > 2) code.SetAt(1, (TCHAR)towlower(code[1]));
+
+ if(!_tcsnicmp(code, _T("{c:$"), 4))
+ {
+ _stscanf(code, _T("{c:$%x"), &ret->colors[0]);
+ }
+ else if(!_tcsnicmp(code, _T("{f:"), 3))
+ {
+ ret->fontName = code.Mid(3);
+ }
+ else if(!_tcsnicmp(code, _T("{s:"), 3))
+ {
+ float f;
+ if(1 == _stscanf(code, _T("{s:%f"), &f))
+ ret->fontSize = f;
+ }
+ else if(!_tcsnicmp(code, _T("{h:"), 3))
+ {
+ _stscanf(code, _T("{h:%d"), &ret->charSet);
+ }
+ else if(!_tcsnicmp(code, _T("{y:"), 3))
+ {
+ code.MakeLower();
+ if(code.Find('b') >= 0) ret->fontWeight = FW_BOLD;
+ if(code.Find('i') >= 0) ret->fItalic = true;
+ if(code.Find('u') >= 0) ret->fUnderline = true;
+ if(code.Find('s') >= 0) ret->fStrikeOut = true;
+ }
+ else if(!_tcsnicmp(code, _T("{p:"), 3))
+ {
+ int p;
+ _stscanf(code, _T("{p:%d"), &p);
+ ret->scrAlignment = (p == 0) ? 8 : 2;
+ }
+
+ i = k;
+ }
+
+ return(ret);
+}
+
+static CStringW MicroDVD2SSA(CStringW str, bool fUnicode, int CharSet)
+{
+ CStringW ret;
+
+ enum {COLOR=0, FONTNAME, FONTSIZE, FONTCHARSET, BOLD, ITALIC, UNDERLINE, STRIKEOUT};
+ bool fRestore[8];
+ int fRestoreLen = 8;
+ memset(fRestore, 0, sizeof(bool)*fRestoreLen);
+
+ for(int pos = 0, eol; pos < str.GetLength(); pos++)
+ {
+ if((eol = FindChar(str, '|', pos, fUnicode, CharSet)) < 0) eol = str.GetLength();
+
+ CStringW line = str.Mid(pos, eol-pos);
+
+ pos = eol;
+
+ for(int i = 0, j, k, len = line.GetLength(); i < len; i++)
+ {
+ if((j = FindChar(line, '{', i, fUnicode, CharSet)) < 0) j = str.GetLength();
+
+ ret += line.Mid(i, j-i);
+
+ if(j >= len) break;
+
+ if((k = FindChar(line, '}', j, fUnicode, CharSet)) < 0) k = len;
+
+ {
+ CStringW code = line.Mid(j, k-j);
+
+ if(!wcsnicmp(code, L"{c:$", 4))
+ {
+ fRestore[COLOR] = (iswupper(code[1]) == 0);
+ code.MakeLower();
+
+ int color;
+ swscanf(code, L"{c:$%x", &color);
+ code.Format(L"{\\c&H%x&}", color);
+ ret += code;
+ }
+ else if(!wcsnicmp(code, L"{f:", 3))
+ {
+ fRestore[FONTNAME] = (iswupper(code[1]) == 0);
+
+ code.Format(L"{\\fn%s}", code.Mid(3));
+ ret += code;
+ }
+ else if(!wcsnicmp(code, L"{s:", 3))
+ {
+ fRestore[FONTSIZE] = (iswupper(code[1]) == 0);
+ code.MakeLower();
+
+ float size;
+ swscanf(code, L"{s:%f", &size);
+ code.Format(L"{\\fs%f}", size);
+ ret += code;
+ }
+ else if(!wcsnicmp(code, L"{h:", 3))
+ {
+ fRestore[COLOR] = (_istupper(code[1]) == 0);
+ code.MakeLower();
+
+ int CharSet;
+ swscanf(code, L"{h:%d", &CharSet);
+ code.Format(L"{\\fe%d}", CharSet);
+ ret += code;
+ }
+ else if(!wcsnicmp(code, L"{y:", 3))
+ {
+ bool f = (_istupper(code[1]) == 0);
+
+ code.MakeLower();
+
+ ret += '{';
+ if(code.Find('b') >= 0) {ret += L"\\b1"; fRestore[BOLD] = f;}
+ if(code.Find('i') >= 0) {ret += L"\\i1"; fRestore[ITALIC] = f;}
+ if(code.Find('u') >= 0) {ret += L"\\u1"; fRestore[UNDERLINE] = f;}
+ if(code.Find('s') >= 0) {ret += L"\\s1"; fRestore[STRIKEOUT] = f;}
+ ret += '}';
+ }
+ else if(!wcsnicmp(code, L"{o:", 3))
+ {
+ code.MakeLower();
+
+ int x, y;
+ TCHAR c;
+ swscanf(code, L"{o:%d%c%d", &x, &c, &y);
+ code.Format(L"{\\move(%d,%d,0,0,0,0)}", x, y);
+ ret += code;
+ }
+ else ret += code;
+ }
+
+ i = k;
+ }
+
+ if(pos >= str.GetLength()) break;
+
+ for(int i = 0; i < fRestoreLen; i++)
+ {
+ if(fRestore[i])
+ {
+ switch(i)
+ {
+ case COLOR: ret += L"{\\c}"; break;
+ case FONTNAME: ret += L"{\\fn}"; break;
+ case FONTSIZE: ret += L"{\\fs}"; break;
+ case FONTCHARSET: ret += L"{\\fe}"; break;
+ case BOLD: ret += L"{\\b}"; break;
+ case ITALIC: ret += L"{\\i}"; break;
+ case UNDERLINE: ret += L"{\\u}"; break;
+ case STRIKEOUT: ret += L"{\\s}"; break;
+ default: break;
+ }
+ }
+ }
+
+ memset(fRestore, 0, sizeof(bool)*fRestoreLen);
+
+ ret += L"\\N";
+ }
+
+ return(ret);
+}
+
+static bool OpenMicroDVD(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ bool fCheck = false, fCheck2 = false;
+
+ CString style(_T("Default"));
+
+ CStringW buff;;
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty()) continue;
+
+ int start, end;
+ int c = swscanf(buff, L"{%d}{%d}", &start, &end);
+
+ if(c != 2) {c = swscanf(buff, L"{%d}{}", &start)+1; end = start + 60; fCheck = true;}
+
+ if(c != 2)
+ {
+ int i;
+ if(buff.Find('{') == 0 && (i = buff.Find('}')) > 1 && i < buff.GetLength())
+ {
+ if(STSStyle* s = GetMicroDVDStyle(WToT(buff.Mid(i+1)), CharSet))
+ {
+ style = buff.Mid(1, i-1);
+ style.MakeUpper();
+ if(style.GetLength()) {CString str = style.Mid(1); str.MakeLower(); style = style.Left(1) + str;}
+ ret.AddStyle(style, s);
+ CharSet = s->charSet;
+ continue;
+ }
+ }
+ }
+
+ if(c == 2)
+ {
+ if(fCheck2 && ret.GetCount())
+ {
+ STSEntry& stse = ret[ret.GetCount()-1];
+ stse.end = min(stse.end, start);
+ fCheck2 = false;
+ }
+
+ ret.Add(
+ MicroDVD2SSA(buff.Mid(buff.Find('}', buff.Find('}')+1)+1), file->IsUnicode(), CharSet),
+ file->IsUnicode(),
+ start, end,
+ style);
+
+ if(fCheck)
+ {
+ fCheck = false;
+ fCheck2 = true;
+ }
+ }
+ else if(c != EOF) // might be another format
+ {
+ return(false);
+ }
+ }
+
+ return(ret.GetCount() > 0);
+}
+
+static void ReplaceNoCase(CStringW& str, CStringW from, CStringW to)
+{
+ CStringW lstr = str;
+ lstr.MakeLower();
+
+ int i, j, k;
+
+ for(i = 0, j = str.GetLength(); i < j; )
+ {
+ if((k = lstr.Find(from, i)) >= 0)
+ {
+ str.Delete(k, from.GetLength()); lstr.Delete(k, from.GetLength());
+ str.Insert(k, to); lstr.Insert(k, to);
+ i = k + to.GetLength();
+ j = str.GetLength();
+ }
+ else break;
+ }
+}
+
+static CStringW SMI2SSA(CStringW str, int CharSet)
+{
+ ReplaceNoCase(str, L"&nbsp;", L" ");
+ ReplaceNoCase(str, L"&quot;", L"\"");
+ ReplaceNoCase(str, L"<br>", L"\\N");
+ ReplaceNoCase(str, L"<i>", L"{\\i1}");
+ ReplaceNoCase(str, L"</i>", L"{\\i}");
+ ReplaceNoCase(str, L"<b>", L"{\\b1}");
+ ReplaceNoCase(str, L"</b>", L"{\\b}");
+
+ CStringW lstr = str;
+ lstr.MakeLower();
+
+ // maven@maven.de
+ // now parse line
+ for(int i = 0, j = str.GetLength(); i < j; )
+ {
+ int k;
+ if((k = lstr.Find('<', i)) < 0) break;
+
+ int chars_inserted = 0;
+
+ int l = 1;
+ for(; k+l < j && lstr[k+l] != '>'; l++);
+ l++;
+
+// Modified by Cookie Monster
+ if (lstr.Find(L"<font ", k) == k)
+ {
+ CStringW args = lstr.Mid(k+6, l-6); // delete "<font "
+ CStringW arg ;
+
+ args.Remove('\"'); args.Remove('#'); // may include 2 * " + #
+ arg.TrimLeft(); arg.TrimRight(L" >");
+
+ for (;;)
+ {
+ args.TrimLeft();
+ arg = args.SpanExcluding(L" \t>");
+ args = args.Mid(arg.GetLength());
+
+ if(arg.IsEmpty())
+ break;
+ if (arg.Find(L"color=") == 0 )
+ {
+ DWORD color;
+
+ arg = arg.Mid(6); // delete "color="
+ if ( arg.IsEmpty())
+ continue;
+
+ DWORD val;
+ if(g_colors.Lookup(CString(arg), val))
+ color = (DWORD)val;
+ else if((color = wcstol(arg, NULL, 16) ) == 0)
+ color = 0x00ffffff; // default is white
+
+ arg.Format(L"%02x%02x%02x", color&0xff, (color>>8)&0xff, (color>>16)&0xff);
+ lstr.Insert(k + l + chars_inserted, CStringW(L"{\\c&H") + arg + L"&}");
+ str.Insert(k + l + chars_inserted, CStringW(L"{\\c&H") + arg + L"&}");
+ chars_inserted += 5 + arg.GetLength() + 2;
+ }
+/*
+ else if (arg.Find(_T("size=" )) == 0 )
+ {
+ uint fsize;
+
+ arg = arg.Mid(5); // delete "size="
+ if ( arg.GetLength() == 0)
+ continue;
+
+ if ( fsize = _tcstol(arg, &tmp, 10) == 0 )
+ continue;
+
+ lstr.Insert(k + l + chars_inserted, CString(_T("{\\fs")) + arg + _T("&}"));
+ str.Insert(k + l + chars_inserted, CString(_T("{\\fs")) + arg + _T("&}"));
+ chars_inserted += 4 + arg.GetLength() + 2;
+ }
+*/
+ }
+ }
+
+// Original Code
+/*
+ if (lstr.Find(L"<font color=", k) == k)
+ {
+ CStringW arg = lstr.Mid(k+12, l-12); // may include 2 * " + #
+
+ arg.Remove('\"');
+ arg.Remove('#');
+ arg.TrimLeft(); arg.TrimRight(L" >");
+
+ if(arg.GetLength() > 0)
+ {
+ DWORD color;
+
+ CString key = WToT(arg);
+ void* val;
+ if(g_colors.Lookup(key, val)) color = (DWORD)val;
+ else color = wcstol(arg, NULL, 16);
+
+ arg.Format(L"%02x%02x%02x", color&0xff, (color>>8)&0xff, (color>>16)&0xff);
+ }
+
+ lstr.Insert(k + l + chars_inserted, L"{\\c&H" + arg + L"&}");
+ str.Insert(k + l + chars_inserted, L"{\\c&H" + arg + L"&}");
+ chars_inserted += 5 + arg.GetLength() + 2;
+ }
+*/
+ else if (lstr.Find(L"</font>", k) == k)
+ {
+ lstr.Insert(k + l + chars_inserted, L"{\\c}");
+ str.Insert(k + l + chars_inserted, L"{\\c}");
+ chars_inserted += 4;
+ }
+
+ str.Delete(k, l); lstr.Delete(k, l);
+ i = k + chars_inserted;
+ j = str.GetLength();
+ }
+
+ return(str);
+}
+
+static bool OpenSami(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ CStringW buff, caption;
+
+ ULONGLONG pos = file->GetPosition();
+
+ bool fSAMI = false;
+
+ while(file->ReadString(buff) && !fSAMI)
+ {
+ if(buff.MakeUpper().Find(L"<SAMI>") >= 0) fSAMI = true;
+ }
+
+ if(!fSAMI) return(false);
+
+ file->Seek(pos, 0);
+
+ bool fComment = false;
+
+ int start_time = 0;
+
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty()) continue;
+
+ CStringW ubuff = buff;
+ ubuff.MakeUpper();
+
+ if(ubuff.Find(L"<!--") >= 0 || ubuff.Find(L"<TITLE>") >= 0)
+ fComment = true;
+
+ if(!fComment)
+ {
+ int i;
+
+ if((i = ubuff.Find(L"<SYNC START=")) >= 0)
+ {
+ int time = 0;
+
+ for(i = 12; i < ubuff.GetLength(); i++)
+ {
+ if(ubuff[i] != '>' && ubuff[i] != 'M')
+ {
+ if(iswdigit(ubuff[i]))
+ {
+ time *= 10;
+ time += ubuff[i] - 0x30;
+ }
+ }
+ else break;
+ }
+
+ ret.Add(
+ SMI2SSA(caption, CharSet),
+ file->IsUnicode(),
+ start_time, time);
+
+ start_time = time;
+ caption.Empty();
+ }
+
+ caption += buff;
+ }
+
+ if(ubuff.Find(L"-->") >= 0 || ubuff.Find(L"</TITLE>") >= 0)
+ fComment = false;
+ }
+
+ ret.Add(
+ SMI2SSA(caption, CharSet),
+ file->IsUnicode(),
+ start_time, MAXLONG);
+
+ return(true);
+}
+
+static bool OpenVPlayer(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ CStringW buff;
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty()) continue;
+
+ for(int i = 0; i < buff.GetLength(); i++)
+ {
+ if((i = FindChar(buff, '|', i, file->IsUnicode(), CharSet)) < 0) break;
+ buff.SetAt(i, '\n');
+ }
+
+ int hh, mm, ss;
+ int c = swscanf(buff, L"%d:%d:%d:", &hh, &mm, &ss);
+
+ if(c == 3)
+ {
+ CStringW str = buff.Mid(buff.Find(':', buff.Find(':', buff.Find(':')+1)+1)+1);
+ ret.Add(str,
+ file->IsUnicode(),
+ (((hh*60 + mm)*60) + ss)*1000,
+ (((hh*60 + mm)*60) + ss)*1000 + 1000 + 50*str.GetLength());
+ }
+ else if(c != EOF) // might be another format
+ {
+ return(false);
+ }
+ }
+
+ return(ret.GetCount() > 0);
+}
+
+CStringW GetStr(CStringW& buff, char sep = ',') //throw(...)
+{
+ buff.TrimLeft();
+
+ int pos = buff.Find(sep);
+ if(pos < 0)
+ {
+ pos = buff.GetLength();
+ if(pos < 1) throw 1;
+ }
+
+ CStringW ret = buff.Left(pos);
+ if(pos < buff.GetLength()) buff = buff.Mid(pos+1);
+
+ return(ret);
+}
+
+int GetInt(CStringW& buff, char sep = ',') //throw(...)
+{
+ CStringW str;
+
+ str = GetStr(buff, sep);
+ str.MakeLower();
+
+ CStringW fmtstr = str.GetLength() > 2 && (str.Left(2) == L"&h" || str.Left(2) == L"0x")
+ ? str = str.Mid(2), L"%x"
+ : L"%d";
+
+ int ret;
+ if(swscanf(str, fmtstr, &ret) != 1) throw 1;
+
+ return(ret);
+}
+
+double GetFloat(CStringW& buff, char sep = ',') //throw(...)
+{
+ CStringW str;
+
+ str = GetStr(buff, sep);
+ str.MakeLower();
+
+ float ret;
+ if(swscanf(str, L"%f", &ret) != 1) throw 1;
+
+ return((double)ret);
+}
+
+static bool LoadFont(CString& font)
+{
+ int len = font.GetLength();
+
+ CAutoVectorPtr<BYTE> pData;
+ if(len == 0 || (len&3) == 1 || !pData.Allocate(len))
+ return(false);
+
+ const TCHAR* s = font;
+ const TCHAR* e = s + len;
+ for(BYTE* p = pData; s < e; s++, p++) *p = *s - 33;
+
+ for(int i = 0, j = 0, k = len&~3; i < k; i+=4, j+=3)
+ {
+ pData[j+0] = ((pData[i+0]&63)<<2)|((pData[i+1]>>4)& 3);
+ pData[j+1] = ((pData[i+1]&15)<<4)|((pData[i+2]>>2)&15);
+ pData[j+2] = ((pData[i+2]& 3)<<6)|((pData[i+3]>>0)&63);
+ }
+
+ int datalen = (len&~3)*3/4;
+
+ if((len&3) == 2)
+ {
+ pData[datalen++] = ((pData[(len&~3)+0]&63)<<2)|((pData[(len&~3)+1]>>4)&3);
+ }
+ else if((len&3) == 3)
+ {
+ pData[datalen++] = ((pData[(len&~3)+0]&63)<<2)|((pData[(len&~3)+1]>>4)& 3);
+ pData[datalen++] = ((pData[(len&~3)+1]&15)<<4)|((pData[(len&~3)+2]>>2)&15);
+ }
+
+ HANDLE hFont = INVALID_HANDLE_VALUE;
+
+ if(HMODULE hModule = LoadLibrary(_T("GDI32.DLL")))
+ {
+ typedef HANDLE (WINAPI *PAddFontMemResourceEx)( IN PVOID, IN DWORD, IN PVOID , IN DWORD*);
+ if(PAddFontMemResourceEx f = (PAddFontMemResourceEx)GetProcAddress(hModule, "AddFontMemResourceEx"))
+ {
+ DWORD cFonts;
+ hFont = f(pData, datalen, NULL, &cFonts);
+ }
+
+ FreeLibrary(hModule);
+ }
+
+ if(hFont == INVALID_HANDLE_VALUE)
+ {
+ TCHAR path[MAX_PATH];
+ GetTempPath(MAX_PATH, path);
+
+ DWORD chksum = 0;
+ for(int i = 0, j = datalen>>2; i < j; i++)
+ chksum += ((DWORD*)(BYTE*)pData)[i];
+
+ CString fn;
+ fn.Format(_T("%sfont%08x.ttf"), path, chksum);
+
+ CFileStatus fs;
+ if(!CFileGetStatus(fn, fs))
+ {
+ CFile f;
+ if(f.Open(fn, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary|CFile::shareDenyWrite))
+ {
+ f.Write(pData, datalen);
+ f.Close();
+ }
+ }
+
+ AddFontResource(fn);
+ }
+
+ return(true);
+}
+
+static bool LoadUUEFont(CTextFile* file)
+{
+ CString s, font;
+ while(file->ReadString(s))
+ {
+ s.Trim();
+ if(s.IsEmpty() || s[0] == '[') break;
+ if(s.Find(_T("fontname:")) == 0) {LoadFont(font); font.Empty(); continue;}
+
+ font += s;
+ }
+
+ if(!font.IsEmpty())
+ LoadFont(font);
+
+ return(true);
+}
+
+static bool OpenSubStationAlpha(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ bool fRet = false;
+
+ int version = 3, sver = 3;
+
+ CStringW buff;
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty() || buff.GetAt(0) == ';') continue;
+
+ CStringW entry;
+
+// try {
+ entry = GetStr(buff, ':');
+// }
+// catch(...) {continue;}
+
+ entry.MakeLower();
+
+ if(entry == L"[script info]")
+ {
+ fRet = true;
+ }
+ else if(entry == L"playresx")
+ {
+ try {ret.m_dstScreenSize.cx = GetInt(buff);}
+ catch(...) {ret.m_dstScreenSize = CSize(0, 0); return(false);}
+
+ if(ret.m_dstScreenSize.cy <= 0)
+ {
+ ret.m_dstScreenSize.cy = (ret.m_dstScreenSize.cx == 1280)
+ ? 1024
+ : ret.m_dstScreenSize.cx * 3 / 4;
+ }
+ }
+ else if(entry == L"playresy")
+ {
+ try {ret.m_dstScreenSize.cy = GetInt(buff);}
+ catch(...) {ret.m_dstScreenSize = CSize(0, 0); return(false);}
+
+ if(ret.m_dstScreenSize.cx <= 0)
+ {
+ ret.m_dstScreenSize.cx = (ret.m_dstScreenSize.cy == 1024)
+ ? 1280
+ : ret.m_dstScreenSize.cy * 4 / 3;
+ }
+ }
+ else if(entry == L"wrapstyle")
+ {
+ try {ret.m_defaultWrapStyle = GetInt(buff);}
+ catch(...) {ret.m_defaultWrapStyle = 1; return(false);}
+ }
+ else if(entry == L"scripttype")
+ {
+ if(buff.GetLength() >= 4 && !buff.Right(4).CompareNoCase(L"4.00")) version = sver = 4;
+ else if(buff.GetLength() >= 5 && !buff.Right(5).CompareNoCase(L"4.00+")) version = sver = 5;
+ else if(buff.GetLength() >= 6 && !buff.Right(6).CompareNoCase(L"4.00++")) version = sver = 6;
+ }
+ else if(entry == L"collisions")
+ {
+ buff = GetStr(buff);
+ buff.MakeLower();
+ ret.m_collisions = buff.Find(L"reverse") >= 0 ? 1 : 0;
+ }
+ else if(entry == L"scaledborderandshadow")
+ {
+ buff = GetStr(buff);
+ buff.MakeLower();
+ ret.m_fScaledBAS = buff.Find(L"yes") >= 0;
+ }
+ else if(entry == L"[v4 styles]")
+ {
+ fRet = true;
+ sver = 4;
+ }
+ else if(entry == L"[v4+ styles]")
+ {
+ fRet = true;
+ sver = 5;
+ }
+ else if(entry == L"[v4++ styles]")
+ {
+ fRet = true;
+ sver = 6;
+ }
+ else if(entry == L"style")
+ {
+ STSStyle* style = new STSStyle;
+ if(!style) return(false);
+
+ try
+ {
+ CString StyleName;
+ int alpha;
+
+ StyleName = WToT(GetStr(buff));
+ style->fontName = WToT(GetStr(buff));
+ style->fontSize = GetFloat(buff);
+ for(int i = 0; i < 4; i++) style->colors[i] = (COLORREF)GetInt(buff);
+ style->fontWeight = !!GetInt(buff) ? FW_BOLD : FW_NORMAL;
+ style->fItalic = !!GetInt(buff);
+if(sver >= 5) style->fUnderline = !!GetInt(buff);
+if(sver >= 5) style->fStrikeOut = !!GetInt(buff);
+if(sver >= 5) style->fontScaleX = GetFloat(buff);
+if(sver >= 5) style->fontScaleY = GetFloat(buff);
+if(sver >= 5) style->fontSpacing = GetFloat(buff);
+if(sver >= 5) style->fontAngleZ = GetFloat(buff);
+if(sver >= 4) style->borderStyle = GetInt(buff);
+ style->outlineWidth = GetFloat(buff);
+ style->shadowDepth = GetFloat(buff);
+ style->scrAlignment = GetInt(buff);
+ style->marginRect.left = GetInt(buff);
+ style->marginRect.right = GetInt(buff);
+ style->marginRect.top = style->marginRect.bottom = GetInt(buff);
+if(sver >= 6) style->marginRect.bottom = GetInt(buff);
+if(sver <= 4) alpha = GetInt(buff);
+ style->charSet = GetInt(buff);
+if(sver >= 6) style->relativeTo = GetInt(buff);
+
+if(sver <= 4) style->colors[2] = style->colors[3]; // style->colors[2] is used for drawing the outline
+if(sver <= 4) alpha = max(min(alpha, 0xff), 0);
+if(sver <= 4) {for(int i = 0; i < 3; i++) style->alpha[i] = alpha; style->alpha[3] = 0x80;}
+if(sver >= 5) for(int i = 0; i < 4; i++) {style->alpha[i] = (BYTE)(style->colors[i]>>24); style->colors[i] &= 0xffffff;}
+if(sver >= 5) style->fontScaleX = max(style->fontScaleX, 0);
+if(sver >= 5) style->fontScaleY = max(style->fontScaleY, 0);
+if(sver >= 5) style->fontSpacing = max(style->fontSpacing, 0);
+ style->fontAngleX = style->fontAngleY = 0;
+ style->borderStyle = style->borderStyle == 1 ? 0 : style->borderStyle == 3 ? 1 : 0;
+ style->outlineWidth = max(style->outlineWidth, 0);
+ style->shadowDepth = max(style->shadowDepth, 0);
+if(sver <= 4) style->scrAlignment = (style->scrAlignment&4) ? ((style->scrAlignment&3)+6) // top
+ : (style->scrAlignment&8) ? ((style->scrAlignment&3)+3) // mid
+ : (style->scrAlignment&3); // bottom
+
+ StyleName.TrimLeft('*');
+
+ ret.AddStyle(StyleName, style);
+ }
+ catch(...)
+ {
+ delete style;
+ return(false);
+ }
+ }
+ else if(entry == L"[events]")
+ {
+ fRet = true;
+ }
+ else if(entry == _T("dialogue"))
+ {
+ try
+ {
+ int hh1, mm1, ss1, ms1_div10, hh2, mm2, ss2, ms2_div10, layer = 0;
+ CString Style, Actor, Effect;
+ CRect marginRect;
+
+if(version <= 4){GetStr(buff, '='); GetInt(buff);} /* Marked = */
+if(version >= 5)layer = GetInt(buff);
+ hh1 = GetInt(buff, ':');
+ mm1 = GetInt(buff, ':');
+ ss1 = GetInt(buff, '.');
+ ms1_div10 = GetInt(buff);
+ hh2 = GetInt(buff, ':');
+ mm2 = GetInt(buff, ':');
+ ss2 = GetInt(buff, '.');
+ ms2_div10 = GetInt(buff);
+ Style = WToT(GetStr(buff));
+ Actor = WToT(GetStr(buff));
+ marginRect.left = GetInt(buff);
+ marginRect.right = GetInt(buff);
+ marginRect.top = marginRect.bottom = GetInt(buff);
+if(version >= 6)marginRect.bottom = GetInt(buff);
+ Effect = WToT(GetStr(buff));
+
+ int len = min(Effect.GetLength(), buff.GetLength());
+ if(Effect.Left(len) == WToT(buff.Left(len))) Effect.Empty();
+
+ Style.TrimLeft('*');
+ if(!Style.CompareNoCase(_T("Default"))) Style = _T("Default");
+
+ ret.Add(buff,
+ file->IsUnicode(),
+ (((hh1*60 + mm1)*60) + ss1)*1000 + ms1_div10*10,
+ (((hh2*60 + mm2)*60) + ss2)*1000 + ms2_div10*10,
+ Style, Actor, Effect,
+ marginRect,
+ layer);
+ }
+ catch(...)
+ {
+ return(false);
+ }
+ }
+ else if(entry == L"fontname")
+ {
+ LoadUUEFont(file);
+ }
+ }
+
+ return(fRet);
+}
+
+static bool OpenXombieSub(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ float version = 0;
+
+// CMapStringToPtr stylemap;
+
+ CStringW buff;
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty() || buff.GetAt(0) == ';') continue;
+
+ CStringW entry;
+
+// try {
+ entry = GetStr(buff, '=');
+// }
+// catch(...) {continue;}
+
+ entry.MakeLower();
+
+ if(entry == L"version")
+ {
+ version = (float)GetFloat(buff);
+ }
+ else if(entry == L"screenhorizontal")
+ {
+ try {ret.m_dstScreenSize.cx = GetInt(buff);}
+ catch(...) {ret.m_dstScreenSize = CSize(0, 0); return(false);}
+
+ if(ret.m_dstScreenSize.cy <= 0)
+ {
+ ret.m_dstScreenSize.cy = (ret.m_dstScreenSize.cx == 1280)
+ ? 1024
+ : ret.m_dstScreenSize.cx * 3 / 4;
+ }
+ }
+ else if(entry == L"screenvertical")
+ {
+ try {ret.m_dstScreenSize.cy = GetInt(buff);}
+ catch(...) {ret.m_dstScreenSize = CSize(0, 0); return(false);}
+
+ if(ret.m_dstScreenSize.cx <= 0)
+ {
+ ret.m_dstScreenSize.cx = (ret.m_dstScreenSize.cy == 1024)
+ ? 1280
+ : ret.m_dstScreenSize.cy * 4 / 3;
+ }
+ }
+ else if(entry == L"style")
+ {
+ STSStyle* style = new STSStyle;
+ if(!style) return(false);
+
+ try
+ {
+ CString StyleName;
+
+ StyleName = WToT(GetStr(buff)) + _T("_") + WToT(GetStr(buff));
+ style->fontName = WToT(GetStr(buff));
+ style->fontSize = GetFloat(buff);
+ for(int i = 0; i < 4; i++) style->colors[i] = (COLORREF)GetInt(buff);
+ for(int i = 0; i < 4; i++) style->alpha[i] = GetInt(buff);
+ style->fontWeight = !!GetInt(buff) ? FW_BOLD : FW_NORMAL;
+ style->fItalic = !!GetInt(buff);
+ style->fUnderline = !!GetInt(buff);
+ style->fStrikeOut = !!GetInt(buff);
+ style->fBlur = !!GetInt(buff);
+ style->fontScaleX = GetFloat(buff);
+ style->fontScaleY = GetFloat(buff);
+ style->fontSpacing = GetFloat(buff);
+ style->fontAngleX = GetFloat(buff);
+ style->fontAngleY = GetFloat(buff);
+ style->fontAngleZ = GetFloat(buff);
+ style->borderStyle = GetInt(buff);
+ style->outlineWidth = GetFloat(buff);
+ style->shadowDepth = GetFloat(buff);
+ style->scrAlignment = GetInt(buff);
+ style->marginRect.left = GetInt(buff);
+ style->marginRect.right = GetInt(buff);
+ style->marginRect.top = style->marginRect.bottom = GetInt(buff);
+ style->charSet = GetInt(buff);
+
+ style->fontScaleX = max(style->fontScaleX, 0);
+ style->fontScaleY = max(style->fontScaleY, 0);
+ style->fontSpacing = max(style->fontSpacing, 0);
+ style->borderStyle = style->borderStyle == 1 ? 0 : style->borderStyle == 3 ? 1 : 0;
+ style->outlineWidth = max(style->outlineWidth, 0);
+ style->shadowDepth = max(style->shadowDepth, 0);
+
+ ret.AddStyle(StyleName, style);
+ }
+ catch(...)
+ {
+ delete style;
+ return(false);
+ }
+ }
+ else if(entry == L"line")
+ {
+ try
+ {
+ CString id;
+ int hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2, layer = 0;
+ CString Style, Actor;
+ CRect marginRect;
+
+ if(GetStr(buff) != L"D") continue;
+ id = GetStr(buff);
+ layer = GetInt(buff);
+ hh1 = GetInt(buff, ':');
+ mm1 = GetInt(buff, ':');
+ ss1 = GetInt(buff, '.');
+ ms1 = GetInt(buff);
+ hh2 = GetInt(buff, ':');
+ mm2 = GetInt(buff, ':');
+ ss2 = GetInt(buff, '.');
+ ms2 = GetInt(buff);
+ Style = WToT(GetStr(buff)) + _T("_") + WToT(GetStr(buff));
+ Actor = WToT(GetStr(buff));
+ marginRect.left = GetInt(buff);
+ marginRect.right = GetInt(buff);
+ marginRect.top = marginRect.bottom = GetInt(buff);
+
+ Style.TrimLeft('*');
+ if(!Style.CompareNoCase(_T("Default"))) Style = _T("Default");
+
+ ret.Add(buff,
+ file->IsUnicode(),
+ (((hh1*60 + mm1)*60) + ss1)*1000 + ms1,
+ (((hh2*60 + mm2)*60) + ss2)*1000 + ms2,
+ Style, Actor, _T(""),
+ marginRect,
+ layer);
+ }
+ catch(...)
+ {
+ return(false);
+ }
+ }
+ else if(entry == L"fontname")
+ {
+ LoadUUEFont(file);
+ }
+ }
+
+ return(ret.GetCount() > 0);
+}
+
+#include "USFSubtitles.h"
+
+static bool OpenUSF(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ CString str;
+ while(file->ReadString(str))
+ {
+ if(str.Find(_T("USFSubtitles")) >= 0)
+ {
+ CUSFSubtitles usf;
+ if(usf.Read(file->GetFilePath()) && usf.ConvertToSTS(ret))
+ return(true);
+
+ break;
+ }
+ }
+
+ return(false);
+}
+
+static CStringW MPL22SSA(CStringW str)
+{
+ CAtlList<CStringW> sl;
+ Explode(str, sl, '|');
+ POSITION pos = sl.GetHeadPosition();
+ while(pos)
+ {
+ CStringW& s = sl.GetNext(pos);
+ if(s[0] == '/') {s = L"{\\i1}" + s.Mid(1) + L"{\\i0}";}
+ }
+ str = Implode(sl, '\n');
+ str.Replace(L"\n", L"\\N");
+ return str;
+}
+
+static bool OpenMPL2(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet)
+{
+ CStringW buff;;
+ while(file->ReadString(buff))
+ {
+ buff.Trim();
+ if(buff.IsEmpty()) continue;
+
+ int start, end;
+ int c = swscanf(buff, L"[%d][%d]", &start, &end);
+
+ if(c == 2)
+ {
+ ret.Add(
+ MPL22SSA(buff.Mid(buff.Find(']', buff.Find(']')+1)+1)),
+ file->IsUnicode(),
+ start*100, end*100);
+ }
+ else if(c != EOF) // might be another format
+ {
+ return(false);
+ }
+ }
+
+ return(ret.GetCount() > 0);
+}
+
+typedef bool (*STSOpenFunct)(CTextFile* file, CSimpleTextSubtitle& ret, int CharSet);
+
+typedef struct {STSOpenFunct open; tmode mode;} OpenFunctStruct;
+
+static OpenFunctStruct OpenFuncts[] =
+{
+ OpenSubRipper, TIME,
+ OpenOldSubRipper, TIME,
+ OpenSubViewer, TIME,
+ OpenMicroDVD, FRAME,
+ OpenSami, TIME,
+ OpenVPlayer, TIME,
+ OpenSubStationAlpha, TIME,
+ OpenXombieSub, TIME,
+ OpenUSF, TIME,
+ OpenMPL2, TIME,
+};
+
+static int nOpenFuncts = countof(OpenFuncts);
+
+//
+
+CSimpleTextSubtitle::CSimpleTextSubtitle()
+{
+ m_mode = TIME;
+ m_dstScreenSize = CSize(0, 0);
+ m_defaultWrapStyle = 0;
+ m_collisions = 0;
+ m_fScaledBAS = false;
+ m_encoding = CTextFile::ASCII;
+}
+
+CSimpleTextSubtitle::~CSimpleTextSubtitle()
+{
+ Empty();
+}
+/*
+CSimpleTextSubtitle::CSimpleTextSubtitle(CSimpleTextSubtitle& sts)
+{
+ *this = sts;
+}
+
+CSimpleTextSubtitle& CSimpleTextSubtitle::operator = (CSimpleTextSubtitle& sts)
+{
+ Empty();
+
+ m_name = sts.m_name;
+ m_mode = sts.m_mode;
+ m_dstScreenSize = sts.m_dstScreenSize;
+ m_defaultWrapStyle = sts.m_defaultWrapStyle;
+ m_collisions = sts.m_collisions;
+ m_fScaledBAS = sts.m_fScaledBAS;
+ m_fSSA = sts.m_fSSA;
+ m_fUsingAutoGeneratedDefaultStyle = sts.m_fUsingAutoGeneratedDefaultStyle;
+ CopyStyles(sts.m_styles);
+ m_segments.Copy(sts.m_segments);
+ Copy(sts);
+
+ return(*this);
+}
+*/
+
+void CSimpleTextSubtitle::Copy(CSimpleTextSubtitle& sts)
+{
+ Empty();
+
+ m_name = sts.m_name;
+ m_mode = sts.m_mode;
+ m_dstScreenSize = sts.m_dstScreenSize;
+ m_defaultWrapStyle = sts.m_defaultWrapStyle;
+ m_collisions = sts.m_collisions;
+ m_fScaledBAS = sts.m_fScaledBAS;
+ m_encoding = sts.m_encoding;
+ m_fUsingAutoGeneratedDefaultStyle = sts.m_fUsingAutoGeneratedDefaultStyle;
+ CopyStyles(sts.m_styles);
+ m_segments.Copy(sts.m_segments);
+ __super::Copy(sts);
+}
+
+void CSimpleTextSubtitle::Append(CSimpleTextSubtitle& sts, int timeoff)
+{
+ if(timeoff < 0)
+ {
+ timeoff = GetCount() > 0 ? GetAt(GetCount()-1).end : 0;
+ }
+
+ for(int i = 0, j = GetCount(); i < j; i++)
+ {
+ if(GetAt(i).start > timeoff)
+ {
+ RemoveAt(i, j - i);
+ break;
+ }
+ }
+
+ CopyStyles(sts.m_styles, true);
+
+ for(int i = 0, j = sts.GetCount(); i < j; i++)
+ {
+ STSEntry stse = sts.GetAt(i);
+ stse.start += timeoff;
+ stse.end += timeoff;
+ stse.readorder += GetCount();
+ __super::Add(stse);
+ }
+
+ CreateSegments();
+}
+
+void CSTSStyleMap::Free()
+{
+ POSITION pos = GetStartPosition();
+ while(pos)
+ {
+ CString key;
+ STSStyle* val;
+ GetNextAssoc(pos, key, val);
+ delete val;
+ }
+
+ RemoveAll();
+}
+
+bool CSimpleTextSubtitle::CopyStyles(const CSTSStyleMap& styles, bool fAppend)
+{
+ if(!fAppend) m_styles.Free();
+
+ POSITION pos = styles.GetStartPosition();
+ while(pos)
+ {
+ CString key;
+ STSStyle* val;
+ styles.GetNextAssoc(pos, key, val);
+
+ STSStyle* s = new STSStyle;
+ if(!s) return(false);
+
+ *s = *val;
+
+ AddStyle(key, s);
+ }
+
+ return(true);
+}
+
+void CSimpleTextSubtitle::Empty()
+{
+ m_dstScreenSize = CSize(0, 0);
+ m_styles.Free();
+ m_segments.RemoveAll();
+ RemoveAll();
+}
+
+void CSimpleTextSubtitle::Add(CStringW str, bool fUnicode, int start, int end, CString style, CString actor, CString effect, CRect marginRect, int layer, int readorder)
+{
+ if(str.Trim().IsEmpty() || start > end) return;
+
+ str.Remove('\r');
+ str.Replace(L"\n", L"\\N");
+ if(style.IsEmpty()) style = _T("Default");
+ style.TrimLeft('*');
+
+ STSEntry sub;
+ sub.str = str;
+ sub.fUnicode = fUnicode;
+ sub.style = style;
+ sub.actor = actor;
+ sub.effect = effect;
+ sub.marginRect = marginRect;
+ sub.layer = layer;
+ sub.start = start;
+ sub.end = end;
+ sub.readorder = readorder < 0 ? GetCount() : readorder;
+ int n = __super::Add(sub);
+
+ int len = m_segments.GetCount();
+
+ if(len == 0)
+ {
+ STSSegment stss(start, end);
+ stss.subs.Add(n);
+ m_segments.Add(stss);
+ }
+ else if(end <= m_segments[0].start)
+ {
+ STSSegment stss(start, end);
+ stss.subs.Add(n);
+ m_segments.InsertAt(0, stss);
+ }
+ else if(start >= m_segments[len-1].end)
+ {
+ STSSegment stss(start, end);
+ stss.subs.Add(n);
+ m_segments.Add(stss);
+ }
+ else
+ {
+ if(start < m_segments[0].start)
+ {
+ STSSegment stss(start, m_segments[0].start);
+ stss.subs.Add(n);
+ start = m_segments[0].start;
+ m_segments.InsertAt(0, stss);
+ }
+
+ for(int i = 0; i < m_segments.GetCount(); i++)
+ {
+ STSSegment& s = m_segments[i];
+
+ if(start >= s.end)
+ continue;
+
+ if(end <= s.start)
+ break;
+
+ if(s.start < start && start < s.end)
+ {
+ STSSegment stss(s.start, start);
+ stss.subs.Copy(s.subs);
+ s.start = start;
+ m_segments.InsertAt(i, stss);
+ continue;
+ }
+
+ if(start <= s.start && s.end <= end)
+ {
+ for(int j = 0, k = s.subs.GetCount(); j <= k; j++)
+ {
+ if(j == k || sub.readorder < GetAt(s.subs[j]).readorder)
+ s.subs.InsertAt(j, n);
+ }
+// s.subs.Add(n);
+ }
+
+ if(s.start < end && end < s.end)
+ {
+ STSSegment stss(s.start, end);
+ stss.subs.Copy(s.subs);
+ for(int j = 0, k = s.subs.GetCount(); j <= k; j++)
+ {
+ if(j == k || sub.readorder < GetAt(stss.subs[j]).readorder)
+ stss.subs.InsertAt(j, n);
+ }
+// stss.subs.Add(n);
+ s.start = end;
+ m_segments.InsertAt(i, stss);
+ }
+ }
+
+ if(end > m_segments[m_segments.GetCount()-1].end)
+ {
+ STSSegment stss(m_segments[m_segments.GetCount()-1].end, end);
+ stss.subs.Add(n);
+ m_segments.Add(stss);
+ }
+ }
+
+/*
+ str.Remove('\r');
+ str.Replace(L"\n", L"\\N");
+ if(style.IsEmpty()) style = _T("Default");
+
+ int j = m_segments.GetCount();
+ for(int i = j-1; i >= 0; i--)
+ {
+ if(m_segments[i].end <= start)
+ {
+ break;
+ }
+ else if(m_segments[i].start >= start)
+ {
+ m_segments.SetCount(m_segments.GetCount()-1);
+ j--;
+ }
+ else if(m_segments[i].end > start)
+ {
+ if(i < j-1) m_segments.RemoveAt(i+1, j-i-1);
+ m_segments[i].end = start;
+ break;
+ }
+ }
+
+ if(m_segments.GetCount() == 0 && j > 0)
+ CSTSArray::RemoveAll();
+
+ STSSegment stss(start, end);
+ int len = GetCount();
+ stss.subs.Add(len);
+ m_segments.Add(stss);
+
+ STSEntry sub;
+ sub.str = str;
+ sub.fUnicode = fUnicode;
+ sub.style = style;
+ sub.actor = actor;
+ sub.effect = effect;
+ sub.marginRect = marginRect;
+ sub.layer = layer;
+ sub.start = start;
+ sub.end = end;
+ sub.readorder = GetCount();
+ CSTSArray::Add(sub);
+*/
+}
+
+STSStyle* CSimpleTextSubtitle::CreateDefaultStyle(int CharSet)
+{
+ CString def(_T("Default"));
+
+ STSStyle* ret = NULL;
+
+ if(!m_styles.Lookup(def, ret))
+ {
+ STSStyle* style = new STSStyle();
+ style->charSet = CharSet;
+ AddStyle(def, style);
+ m_styles.Lookup(def, ret);
+
+ m_fUsingAutoGeneratedDefaultStyle = true;
+ }
+ else
+ {
+ m_fUsingAutoGeneratedDefaultStyle = false;
+ }
+
+ return ret;
+}
+
+void CSimpleTextSubtitle::ChangeUnknownStylesToDefault()
+{
+ CAtlMap<CString, STSStyle*, CStringElementTraits<CString> > unknown;
+ bool fReport = true;
+
+ for(int i = 0; i < GetCount(); i++)
+ {
+ STSEntry& stse = GetAt(i);
+
+ STSStyle* val;
+ if(!m_styles.Lookup(stse.style, val))
+ {
+ if(!unknown.Lookup(stse.style, val))
+ {
+ if(fReport)
+ {
+ CString msg;
+ msg.Format(_T("Unknown style found: \"%s\", changed to \"Default\"!\n\nPress Cancel to ignore further warnings."), stse.style);
+ if(MessageBox(NULL, msg, _T("Warning"), MB_OKCANCEL|MB_ICONWARNING) != IDOK) fReport = false;
+ }
+
+ unknown[stse.style] = NULL;
+ }
+
+ stse.style = _T("Default");
+ }
+ }
+}
+
+void CSimpleTextSubtitle::AddStyle(CString name, STSStyle* style)
+{
+ int i, j;
+
+ if(name.IsEmpty()) name = _T("Default");
+
+ STSStyle* val;
+ if(m_styles.Lookup(name, val))
+ {
+ if(*val == *style)
+ {
+ delete style;
+ return;
+ }
+
+ int len = name.GetLength();
+
+ for(i = len; i > 0 && _istdigit(name[i-1]); i--);
+
+ int idx = 1;
+
+ CString name2 = name;
+
+ if(i < len && _stscanf(name.Right(len-i), _T("%d"), &idx) == 1)
+ {
+ name2 = name.Left(i);
+ }
+
+ idx++;
+
+ CString name3;
+ do
+ {
+ name3.Format(_T("%s%d"), name2, idx);
+ idx++;
+ }
+ while(m_styles.Lookup(name3));
+
+ m_styles.RemoveKey(name);
+ m_styles[name3] = val;
+
+ for(i = 0, j = GetCount(); i < j; i++)
+ {
+ STSEntry& stse = GetAt(i);
+ if(stse.style == name) stse.style = name3;
+ }
+ }
+
+ m_styles[name] = style;
+}
+
+bool CSimpleTextSubtitle::SetDefaultStyle(STSStyle& s)
+{
+ STSStyle* val;
+ if(!m_styles.Lookup(_T("Default"), val)) return false;
+ *val = s;
+ m_fUsingAutoGeneratedDefaultStyle = false;
+ return true;
+}
+
+bool CSimpleTextSubtitle::GetDefaultStyle(STSStyle& s)
+{
+ STSStyle* val;
+ if(!m_styles.Lookup(_T("Default"), val)) return false;
+ s = *val;
+ return true;
+}
+
+void CSimpleTextSubtitle::ConvertToTimeBased(double fps)
+{
+ if(m_mode == TIME) return;
+
+ for(int i = 0, j = GetCount(); i < j; i++)
+ {
+ STSEntry& stse = (*this)[i];
+ stse.start = int(1.0 * stse.start * 1000 / fps + 0.5);
+ stse.end = int(1.0 * stse.end * 1000 / fps + 0.5);
+ }
+
+ m_mode = TIME;
+
+ CreateSegments();
+}
+
+void CSimpleTextSubtitle::ConvertToFrameBased(double fps)
+{
+ if(m_mode == FRAME) return;
+
+ for(int i = 0, j = GetCount(); i < j; i++)
+ {
+ STSEntry& stse = (*this)[i];
+ stse.start = int(1.0 * stse.start * fps / 1000 + 0.5);
+ stse.end = int(1.0 * stse.end * fps / 1000 + 0.5);
+ }
+
+ m_mode = FRAME;
+
+ CreateSegments();
+}
+
+int CSimpleTextSubtitle::SearchSub(int t, double fps)
+{
+ int i = 0, j = GetCount() - 1, ret = -1;
+
+ if(j >= 0 && t >= TranslateStart(j, fps))
+ {
+ return(j);
+ }
+
+ while(i < j)
+ {
+ int mid = (i + j) >> 1;
+
+ int midt = TranslateStart(mid, fps);
+
+ if(t == midt)
+ {
+ while(mid > 0 && t == TranslateStart(mid-1, fps)) mid--;
+ ret = mid;
+ break;
+ }
+ else if(t < midt)
+ {
+ ret = -1;
+ if(j == mid) mid--;
+ j = mid;
+ }
+ else if(t > midt)
+ {
+ ret = mid;
+ if(i == mid) mid++;
+ i = mid;
+ }
+ }
+
+ return(ret);
+}
+
+const STSSegment* CSimpleTextSubtitle::SearchSubs(int t, double fps, /*[out]*/ int* iSegment, int* nSegments)
+{
+ int i = 0, j = m_segments.GetCount() - 1, ret = -1;
+
+ if(nSegments) *nSegments = j+1;
+
+ if(j >= 0 && t >= TranslateSegmentStart(j, fps) && t < TranslateSegmentEnd(j, fps))
+ {
+ if(iSegment) *iSegment = j;
+ return(&m_segments[j]);
+ }
+
+ if(j >= 0 && t >= TranslateSegmentEnd(j, fps))
+ {
+ if(iSegment) *iSegment = j+1;
+ return(NULL);
+ }
+
+ if(j > 0 && t < TranslateSegmentStart(i, fps))
+ {
+ if(iSegment) *iSegment = -1;
+ return(NULL);
+ }
+
+ while(i < j)
+ {
+ int mid = (i + j) >> 1;
+
+ int midt = TranslateSegmentStart(mid, fps);
+
+ if(t == midt)
+ {
+ ret = mid;
+ break;
+ }
+ else if(t < midt)
+ {
+ ret = -1;
+ if(j == mid) mid--;
+ j = mid;
+ }
+ else if(t > midt)
+ {
+ ret = mid;
+ if(i == mid) mid++;
+ i = mid;
+ }
+ }
+
+ if(0 <= ret && ret < m_segments.GetCount())
+ {
+ if(iSegment) *iSegment = ret;
+ }
+
+ if(0 <= ret && ret < m_segments.GetCount()
+ && m_segments[ret].subs.GetCount() > 0
+ && TranslateSegmentStart(ret, fps) <= t && t < TranslateSegmentEnd(ret, fps))
+ {
+ return(&m_segments[ret]);
+ }
+
+ return(NULL);
+}
+
+int CSimpleTextSubtitle::TranslateStart(int i, double fps)
+{
+ return(i < 0 || GetCount() <= i ? -1 :
+ m_mode == TIME ? GetAt(i).start :
+ m_mode == FRAME ? (int)(GetAt(i).start*1000/fps) :
+ 0);
+}
+
+int CSimpleTextSubtitle::TranslateEnd(int i, double fps)
+{
+ return(i < 0 || GetCount() <= i ? -1 :
+ m_mode == TIME ? GetAt(i).end :
+ m_mode == FRAME ? (int)(GetAt(i).end*1000/fps) :
+ 0);
+}
+
+int CSimpleTextSubtitle::TranslateSegmentStart(int i, double fps)
+{
+ return(i < 0 || m_segments.GetCount() <= i ? -1 :
+ m_mode == TIME ? m_segments[i].start :
+ m_mode == FRAME ? (int)(m_segments[i].start*1000/fps) :
+ 0);
+}
+
+int CSimpleTextSubtitle::TranslateSegmentEnd(int i, double fps)
+{
+ return(i < 0 || m_segments.GetCount() <= i ? -1 :
+ m_mode == TIME ? m_segments[i].end :
+ m_mode == FRAME ? (int)(m_segments[i].end*1000/fps) :
+ 0);
+}
+
+STSStyle* CSimpleTextSubtitle::GetStyle(int i)
+{
+ CString def = _T("Default");
+
+ STSStyle* style = NULL;
+ m_styles.Lookup(GetAt(i).style, style);
+
+ STSStyle* defstyle = NULL;
+ m_styles.Lookup(def, defstyle);
+
+ if(!style)
+ {
+ style = defstyle;
+ }
+
+ ASSERT(style);
+
+ return style;
+}
+
+bool CSimpleTextSubtitle::GetStyle(int i, STSStyle& stss)
+{
+ CString def = _T("Default");
+
+ STSStyle* style = NULL;
+ m_styles.Lookup(GetAt(i).style, style);
+
+ STSStyle* defstyle = NULL;
+ m_styles.Lookup(def, defstyle);
+
+ if(!style)
+ {
+ if(!defstyle)
+ {
+ defstyle = CreateDefaultStyle(DEFAULT_CHARSET);
+ }
+
+ style = defstyle;
+ }
+
+ if(!style) {ASSERT(0); return false;}
+
+ stss = *style;
+ if(stss.relativeTo == 2 && defstyle)
+ stss.relativeTo = defstyle->relativeTo;
+
+ return true;
+}
+
+int CSimpleTextSubtitle::GetCharSet(int i)
+{
+ STSStyle stss;
+ GetStyle(i, stss);
+ return(stss.charSet);
+}
+
+bool CSimpleTextSubtitle::IsEntryUnicode(int i)
+{
+ return(GetAt(i).fUnicode);
+}
+
+void CSimpleTextSubtitle::ConvertUnicode(int i, bool fUnicode)
+{
+ STSEntry& stse = GetAt(i);
+
+ if(stse.fUnicode ^ fUnicode)
+ {
+ int CharSet = GetCharSet(i);
+
+ stse.str = fUnicode
+ ? MBCSSSAToUnicode(stse.str, CharSet)
+ : UnicodeSSAToMBCS(stse.str, CharSet);
+
+ stse.fUnicode = fUnicode;
+ }
+}
+
+CStringA CSimpleTextSubtitle::GetStrA(int i, bool fSSA)
+{
+ return(WToA(GetStrWA(i, fSSA)));
+}
+
+CStringW CSimpleTextSubtitle::GetStrW(int i, bool fSSA)
+{
+ bool fUnicode = IsEntryUnicode(i);
+ int CharSet = GetCharSet(i);
+
+ CStringW str = GetAt(i).str;
+
+ if(!fUnicode)
+ str = MBCSSSAToUnicode(str, CharSet);
+
+ if(!fSSA)
+ str = RemoveSSATags(str, fUnicode, CharSet);
+
+ return(str);
+}
+
+CStringW CSimpleTextSubtitle::GetStrWA(int i, bool fSSA)
+{
+ bool fUnicode = IsEntryUnicode(i);
+ int CharSet = GetCharSet(i);
+
+ CStringW str = GetAt(i).str;
+
+ if(fUnicode)
+ str = UnicodeSSAToMBCS(str, CharSet);
+
+ if(!fSSA)
+ str = RemoveSSATags(str, fUnicode, CharSet);
+
+ return(str);
+}
+
+void CSimpleTextSubtitle::SetStr(int i, CStringA str, bool fUnicode)
+{
+ SetStr(i, AToW(str), false);
+}
+
+void CSimpleTextSubtitle::SetStr(int i, CStringW str, bool fUnicode)
+{
+ STSEntry& stse = GetAt(i);
+
+ str.Replace(L"\n", L"\\N");
+
+ if(stse.fUnicode && !fUnicode) stse.str = MBCSSSAToUnicode(str, GetCharSet(i));
+ else if(!stse.fUnicode && fUnicode) stse.str = UnicodeSSAToMBCS(str, GetCharSet(i));
+ else stse.str = str;
+}
+
+static int comp1(const void* a, const void* b)
+{
+ int ret = ((STSEntry*)a)->start - ((STSEntry*)b)->start;
+ if(ret == 0) ret = ((STSEntry*)a)->layer - ((STSEntry*)b)->layer;
+ if(ret == 0) ret = ((STSEntry*)a)->readorder - ((STSEntry*)b)->readorder;
+ return(ret);
+}
+
+static int comp2(const void* a, const void* b)
+{
+ return(((STSEntry*)a)->readorder - ((STSEntry*)b)->readorder);
+}
+
+void CSimpleTextSubtitle::Sort(bool fRestoreReadorder)
+{
+ qsort(GetData(), GetCount(), sizeof(STSEntry), !fRestoreReadorder ? comp1 : comp2);
+ CreateSegments();
+}
+
+static int intcomp(const void* i1, const void* i2)
+{
+ return(*((int*)i1) - *((int*)i2));
+}
+
+void CSimpleTextSubtitle::CreateSegments()
+{
+ m_segments.RemoveAll();
+
+ int i, j;
+
+ CAtlArray<int> breakpoints;
+
+ for(i = 0; i < GetCount(); i++)
+ {
+ STSEntry& stse = GetAt(i);
+ breakpoints.Add(stse.start);
+ breakpoints.Add(stse.end);
+ }
+
+ qsort(breakpoints.GetData(), breakpoints.GetCount(), sizeof(int), intcomp);
+
+ int* ptr = breakpoints.GetData(), prev = ptr ? *ptr : NULL;
+
+ for(i = breakpoints.GetCount(); i > 0; i--, ptr++)
+ {
+ if(*ptr != prev)
+ {
+ m_segments.Add(STSSegment(prev, *ptr));
+ prev = *ptr;
+ }
+ }
+
+ for(i = 0; i < GetCount(); i++)
+ {
+ STSEntry& stse = GetAt(i);
+ for(j = 0; j < m_segments.GetCount() && m_segments[j].start < stse.start; j++);
+ for(; j < m_segments.GetCount() && m_segments[j].end <= stse.end; j++)
+ m_segments[j].subs.Add(i);
+ }
+
+ OnChanged();
+/*
+ for(i = 0, j = m_segments.GetCount(); i < j; i++)
+ {
+ STSSegment& stss = m_segments[i];
+
+ TRACE(_T("%d - %d"), stss.start, stss.end);
+
+ for(int k = 0, l = stss.subs.GetCount(); k < l; k++)
+ {
+ TRACE(_T(", %d"), stss.subs[k]);
+ }
+
+ TRACE(_T("\n"));
+ }
+*/
+}
+
+bool CSimpleTextSubtitle::Open(CString fn, int CharSet, CString name)
+{
+ Empty();
+
+ CWebTextFile f;
+ if(!f.Open(fn)) return(false);
+
+ fn.Replace('\\', '/');
+ if(name.IsEmpty())
+ {
+ name = fn.Left(fn.ReverseFind('.'));
+ name = name.Mid(name.ReverseFind('/')+1);
+ name = name.Mid(name.ReverseFind('.')+1);
+ }
+
+ return(Open(&f, CharSet, name));
+}
+
+static int CountLines(CTextFile* f, ULONGLONG from, ULONGLONG to)
+{
+ int n = 0;
+ CString s;
+ f->Seek(from, 0);
+ while(f->ReadString(s) && f->GetPosition() < to) n++;
+ return(n);
+}
+
+bool CSimpleTextSubtitle::Open(CTextFile* f, int CharSet, CString name)
+{
+ Empty();
+
+ ULONGLONG pos = f->GetPosition();
+
+ for(int i = 0; i < nOpenFuncts; i++)
+ {
+ if(!OpenFuncts[i].open(f, *this, CharSet) /*|| !GetCount()*/)
+ {
+ if(GetCount() > 0)
+ {
+ int n = CountLines(f, pos, f->GetPosition());
+ CString s;
+ s.Format(_T("Syntax error at line %d!\t"), n+1);
+ AfxMessageBox(s, MB_OK|MB_ICONERROR);
+ Empty();
+ break;
+ }
+
+ f->Seek(pos, 0);
+ Empty();
+ continue;
+ }
+
+ m_name = name;
+ m_mode = OpenFuncts[i].mode;
+ m_encoding = f->GetEncoding();
+ m_path = f->GetFilePath();
+
+// Sort();
+ CreateSegments();
+
+ CWebTextFile f2;
+ if(f2.Open(f->GetFilePath() + _T(".style")))
+ OpenSubStationAlpha(&f2, *this, CharSet);
+
+ CreateDefaultStyle(CharSet);
+
+ ChangeUnknownStylesToDefault();
+
+ if(m_dstScreenSize == CSize(0, 0)) m_dstScreenSize = CSize(384, 288);
+
+ return(true);
+ }
+
+ return(false);
+}
+
+bool CSimpleTextSubtitle::Open(BYTE* data, int len, int CharSet, CString name)
+{
+ TCHAR path[MAX_PATH];
+ if(!GetTempPath(MAX_PATH, path)) return(false);
+
+ TCHAR fn[MAX_PATH];
+ if(!GetTempFileName(path, _T("vs"), 0, fn)) return(false);
+
+ FILE* tmp = _tfopen(fn, _T("wb"));
+ if(!tmp) return(false);
+
+ int i = 0;
+ for(; i <= (len-1024); i += 1024) fwrite(&data[i], 1024, 1, tmp);
+ if(len > i) fwrite(&data[i], len - i, 1, tmp);
+
+ fclose(tmp);
+
+ bool fRet = Open(fn, CharSet, name);
+
+ _tremove(fn);
+
+ return(fRet);
+}
+
+bool CSimpleTextSubtitle::SaveAs(CString fn, exttype et, double fps, CTextFile::enc e)
+{
+ if(fn.Mid(fn.ReverseFind('.')+1).CompareNoCase(exttypestr[et]))
+ {
+ if(fn[fn.GetLength()-1] != '.') fn += _T(".");
+ fn += exttypestr[et];
+ }
+
+ CTextFile f;
+ if(!f.Save(fn, e))
+ return(false);
+
+ if(et == EXTSMI)
+ {
+ CString str;
+
+ str += _T("<SAMI>\n<HEAD>\n");
+ str += _T("<STYLE TYPE=\"text/css\">\n");
+ str += _T("<!--\n");
+ str += _T("P {margin-left: 16pt; margin-right: 16pt; margin-bottom: 16pt; margin-top: 16pt;\n");
+ str += _T(" text-align: center; font-size: 18pt; font-family: arial; font-weight: bold; color: #f0f0f0;}\n");
+ str += _T(".UNKNOWNCC {Name:Unknown; lang:en-US; SAMIType:CC;}\n");
+ str += _T("-->\n");
+ str += _T("</STYLE>\n");
+ str += _T("</HEAD>\n");
+ str += _T("\n");
+ str += _T("<BODY>\n");
+
+ f.WriteString(str);
+ }
+ else if(et == EXTSSA || et == EXTASS)
+ {
+ CString str;
+
+ str = _T("[Script Info]\n");
+ str += (et == EXTSSA) ? _T("; This is a Sub Station Alpha v4 script.\n") : _T("; This is an Advanced Sub Station Alpha v4+ script.\n");
+ str += _T("; For Sub Station Alpha info and downloads,\n");
+ str += _T("; go to http://www.eswat.demon.co.uk/\n");
+ str += _T("; or email kotus@eswat.demon.co.uk\n");
+ str += _T("; \n");
+ if(et == EXTASS)
+ {
+ str += _T("; Advanced Sub Station Alpha script format developed by #Anime-Fansubs@EfNET\n");
+ str += _T("; http://www.anime-fansubs.org\n");
+ str += _T("; \n");
+ str += _T("; For additional info and downloads go to http://gabest.org/\n");
+ str += _T("; or email gabest@freemail.hu\n");
+ str += _T("; \n");
+ }
+ str += _T("; Note: This file was saved by Subresync.\n");
+ str += _T("; \n");
+ str += (et == EXTSSA) ? _T("ScriptType: v4.00\n") : _T("ScriptType: v4.00+\n");
+ str += (m_collisions == 0) ? _T("Collisions: Normal\n") : _T("Collisions: Reverse\n");
+ if(et == EXTASS && m_fScaledBAS) str += _T("ScaledBorderAndShadow: Yes\n");
+ str += _T("PlayResX: %d\n");
+ str += _T("PlayResY: %d\n");
+ str += _T("Timer: 100.0000\n");
+ str += _T("\n");
+ str += (et == EXTSSA)
+ ? _T("[V4 Styles]\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding\n")
+ : _T("[V4+ Styles]\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\n");
+
+ CString str2;
+ str2.Format(str, m_dstScreenSize.cx, m_dstScreenSize.cy);
+ f.WriteString(str2);
+
+ str = (et == EXTSSA)
+ ? _T("Style: %s,%s,%d,&H%06x,&H%06x,&H%06x,&H%06x,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n")
+ : _T("Style: %s,%s,%d,&H%08x,&H%08x,&H%08x,&H%08x,%d,%d,%d,%d,%d,%d,%d,%.2f,%d,%d,%d,%d,%d,%d,%d,%d\n");
+
+ POSITION pos = m_styles.GetStartPosition();
+ while(pos)
+ {
+ CString key;
+ STSStyle* s;
+ m_styles.GetNextAssoc(pos, key, s);
+
+ if(et == EXTSSA)
+ {
+ CString str2;
+ str2.Format(str, key,
+ s->fontName, (int)s->fontSize,
+ s->colors[0]&0xffffff,
+ s->colors[1]&0xffffff,
+ s->colors[2]&0xffffff,
+ s->colors[3]&0xffffff,
+ s->fontWeight > FW_NORMAL ? -1 : 0, s->fItalic ? -1 : 0,
+ s->borderStyle == 0 ? 1 : s->borderStyle == 1 ? 3 : 0,
+ (int)s->outlineWidth, (int)s->shadowDepth,
+ s->scrAlignment <= 3 ? s->scrAlignment : s->scrAlignment <= 6 ? ((s->scrAlignment-3)|8) : s->scrAlignment <= 9 ? ((s->scrAlignment-6)|4) : 2,
+ s->marginRect.left, s->marginRect.right, (s->marginRect.top + s->marginRect.bottom) / 2,
+ s->alpha[0],
+ s->charSet);
+ f.WriteString(str2);
+ }
+ else
+ {
+ CString str2;
+ str2.Format(str, key,
+ s->fontName, (int)s->fontSize,
+ (s->colors[0]&0xffffff) | (s->alpha[0]<<24),
+ (s->colors[1]&0xffffff) | (s->alpha[1]<<24),
+ (s->colors[2]&0xffffff) | (s->alpha[2]<<24),
+ (s->colors[3]&0xffffff) | (s->alpha[3]<<24),
+ s->fontWeight > FW_NORMAL ? -1 : 0,
+ s->fItalic ? -1 : 0, s->fUnderline ? -1 : 0, s->fStrikeOut ? -1 : 0,
+ (int)s->fontScaleX, (int)s->fontScaleY,
+ (int)s->fontSpacing, (float)s->fontAngleZ,
+ s->borderStyle == 0 ? 1 : s->borderStyle == 1 ? 3 : 0,
+ (int)s->outlineWidth, (int)s->shadowDepth,
+ s->scrAlignment,
+ s->marginRect.left, s->marginRect.right, (s->marginRect.top + s->marginRect.bottom) / 2,
+ s->charSet);
+ f.WriteString(str2);
+ }
+ }
+
+ if(GetCount() > 0)
+ {
+ str = _T("\n");
+ str += _T("[Events]\n");
+ str += (et == EXTSSA)
+ ? _T("Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n")
+ : _T("Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text\n");
+ f.WriteString(str);
+ }
+ }
+
+ CStringW fmt =
+ et == EXTSRT ? L"%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n%s\n\n" :
+ et == EXTSUB ? L"{%d}{%d}%s\n" :
+ et == EXTSMI ? L"<SYNC Start=%d><P Class=UNKNOWNCC>\n%s\n<SYNC Start=%d><P Class=UNKNOWNCC>&nbsp;\n" :
+ et == EXTPSB ? L"{%d:%02d:%02d}{%d:%02d:%02d}%s\n" :
+ et == EXTSSA ? L"Dialogue: Marked=0,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s,%s,%04d,%04d,%04d,%s,%s\n" :
+ et == EXTASS ? L"Dialogue: %d,%d:%02d:%02d.%02d,%d:%02d:%02d.%02d,%s,%s,%04d,%04d,%04d,%s,%s\n" :
+ L"";
+// Sort(true);
+
+ for(int i = 0, j = GetCount(), k = 0; i < j; i++)
+ {
+ STSEntry& stse = GetAt(i);
+
+ int t1 = TranslateStart(i, fps);
+ if(t1 < 0) {k++; continue;}
+
+ int t2 = TranslateEnd(i, fps);
+
+ int hh1 = (t1/60/60/1000);
+ int mm1 = (t1/60/1000)%60;
+ int ss1 = (t1/1000)%60;
+ int ms1 = (t1)%1000;
+ int hh2 = (t2/60/60/1000);
+ int mm2 = (t2/60/1000)%60;
+ int ss2 = (t2/1000)%60;
+ int ms2 = (t2)%1000;
+
+ CStringW str = f.IsUnicode()
+ ? GetStrW(i, et == EXTSSA || et == EXTASS)
+ : GetStrWA(i, et == EXTSSA || et == EXTASS);
+
+ CStringW str2;
+
+ if(et == EXTSRT)
+ {
+ str2.Format(fmt, i-k+1, hh1, mm1, ss1, ms1, hh2, mm2, ss2, ms2, str);
+ }
+ else if(et == EXTSUB)
+ {
+ str.Replace('\n', '|');
+ str2.Format(fmt, int(t1*fps/1000), int(t2*fps/1000), str);
+ }
+ else if(et == EXTSMI)
+ {
+ str.Replace(L"\n", L"<br>");
+ str2.Format(fmt, t1, str, t2);
+ }
+ else if(et == EXTPSB)
+ {
+ str.Replace('\n', '|');
+ str2.Format(fmt, hh1, mm1, ss1, hh2, mm2, ss2, str);
+ }
+ else if(et == EXTSSA)
+ {
+ str.Replace(L"\n", L"\\N");
+ str2.Format(fmt,
+ hh1, mm1, ss1, ms1/10,
+ hh2, mm2, ss2, ms2/10,
+ TToW(stse.style), TToW(stse.actor),
+ stse.marginRect.left, stse.marginRect.right, (stse.marginRect.top + stse.marginRect.bottom) / 2,
+ TToW(stse.effect), str);
+ }
+ else if(et == EXTASS)
+ {
+ str.Replace(L"\n", L"\\N");
+ str2.Format(fmt,
+ stse.layer,
+ hh1, mm1, ss1, ms1/10,
+ hh2, mm2, ss2, ms2/10,
+ TToW(stse.style), TToW(stse.actor),
+ stse.marginRect.left, stse.marginRect.right, (stse.marginRect.top + stse.marginRect.bottom) / 2,
+ TToW(stse.effect), str);
+ }
+
+ f.WriteString(str2);
+ }
+
+// Sort();
+
+ if(et == EXTSMI)
+ {
+ f.WriteString(_T("</BODY>\n</SAMI>\n"));
+ }
+
+ STSStyle* s;
+ if(!m_fUsingAutoGeneratedDefaultStyle && m_styles.Lookup(_T("Default"), s) && et != EXTSSA && et != EXTASS)
+ {
+ CTextFile f;
+ if(!f.Save(fn + _T(".style"), e))
+ return(false);
+
+ CString str, str2;
+
+ str += _T("ScriptType: v4.00+\n");
+ str += _T("PlayResX: %d\n");
+ str += _T("PlayResY: %d\n");
+ str += _T("\n");
+ str += _T("[V4+ Styles]\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\n");
+ str2.Format(str, m_dstScreenSize.cx, m_dstScreenSize.cy);
+ f.WriteString(str2);
+
+ str = _T("Style: Default,%s,%d,&H%08x,&H%08x,&H%08x,&H%08x,%d,%d,%d,%d,%d,%d,%d,%.2f,%d,%d,%d,%d,%d,%d,%d,%d\n");
+ str2.Format(str,
+ s->fontName, (int)s->fontSize,
+ (s->colors[0]&0xffffff) | (s->alpha[0]<<24),
+ (s->colors[1]&0xffffff) | (s->alpha[1]<<24),
+ (s->colors[2]&0xffffff) | (s->alpha[2]<<24),
+ (s->colors[3]&0xffffff) | (s->alpha[3]<<24),
+ s->fontWeight > FW_NORMAL ? -1 : 0,
+ s->fItalic ? -1 : 0, s->fUnderline ? -1 : 0, s->fStrikeOut ? -1 : 0,
+ (int)s->fontScaleX, (int)s->fontScaleY,
+ (int)s->fontSpacing, (float)s->fontAngleZ,
+ s->borderStyle == 0 ? 1 : s->borderStyle == 1 ? 3 : 0,
+ (int)s->outlineWidth, (int)s->shadowDepth,
+ s->scrAlignment,
+ s->marginRect.left, s->marginRect.right, (s->marginRect.top + s->marginRect.bottom) / 2,
+ s->charSet);
+ f.WriteString(str2);
+ }
+
+ return(true);
+}
+
+////////////////////////////////////////////////////////////////////
+
+STSStyle::STSStyle()
+{
+ SetDefault();
+}
+
+void STSStyle::SetDefault()
+{
+ marginRect = CRect(20, 20, 20, 20);
+ scrAlignment = 2;
+ borderStyle = 0;
+ outlineWidth = 2;
+ shadowDepth = 3;
+ colors[0] = 0x00ffffff;
+ colors[1] = 0x0000ffff;
+ colors[2] = 0x00000000;
+ colors[3] = 0x00000000;
+ alpha[0] = 0x00;
+ alpha[1] = 0x00;
+ alpha[2] = 0x00;
+ alpha[3] = 0x80;
+ charSet = DEFAULT_CHARSET;
+ fontName = _T("Arial");
+ fontSize = 18;
+ fontScaleX = fontScaleY = 100;
+ fontSpacing = 0;
+ fontWeight = FW_BOLD;
+ fItalic = false;
+ fUnderline = false;
+ fStrikeOut = false;
+ fBlur = false;
+ fontAngleZ = fontAngleX = fontAngleY = 0;
+ relativeTo = 2;
+}
+
+bool STSStyle::operator == (STSStyle& s)
+{
+ return(marginRect == s.marginRect
+ && scrAlignment == s.scrAlignment
+ && borderStyle == s.borderStyle
+ && outlineWidth == s.outlineWidth
+ && shadowDepth == s.shadowDepth
+ && *((int*)&colors[0]) == *((int*)&s.colors[0])
+ && *((int*)&colors[1]) == *((int*)&s.colors[1])
+ && *((int*)&colors[2]) == *((int*)&s.colors[2])
+ && *((int*)&colors[3]) == *((int*)&s.colors[3])
+ && alpha[0] == s.alpha[0]
+ && alpha[1] == s.alpha[1]
+ && alpha[2] == s.alpha[2]
+ && alpha[3] == s.alpha[3]
+ && fBlur == s.fBlur
+ && relativeTo == s.relativeTo
+ && IsFontStyleEqual(s));
+}
+
+bool STSStyle::IsFontStyleEqual(STSStyle& s)
+{
+ return(
+ charSet == s.charSet
+ && fontName == s.fontName
+ && fontSize == s.fontSize
+ && fontScaleX == s.fontScaleX
+ && fontScaleY == s.fontScaleY
+ && fontSpacing == s.fontSpacing
+ && fontWeight == s.fontWeight
+ && fItalic == s.fItalic
+ && fUnderline == s.fUnderline
+ && fStrikeOut == s.fStrikeOut
+ && fontAngleZ == s.fontAngleZ
+ && fontAngleX == s.fontAngleX
+ && fontAngleY == s.fontAngleY);
+}
+
+void STSStyle::operator = (LOGFONT& lf)
+{
+ charSet = lf.lfCharSet;
+ fontName = lf.lfFaceName;
+ HDC hDC = GetDC(0);
+ fontSize = -MulDiv(lf.lfHeight, 72, GetDeviceCaps(hDC, LOGPIXELSY));
+ ReleaseDC(0, hDC);
+// fontAngleZ = (float)(1.0*lf.lfEscapement/10);
+ fontWeight = lf.lfWeight;
+ fItalic = !!lf.lfItalic;
+ fUnderline = !!lf.lfUnderline;
+ fStrikeOut = !!lf.lfStrikeOut;
+}
+
+LOGFONTA& operator <<= (LOGFONTA& lfa, STSStyle& s)
+{
+ lfa.lfCharSet = s.charSet;
+#ifdef UNICODE
+ wcstombs(lfa.lfFaceName, s.fontName, 32);
+#else
+ strncpy(lfa.lfFaceName, s.fontName, 32);
+#endif
+ HDC hDC = GetDC(0);
+ lfa.lfHeight = -MulDiv((int)(s.fontSize+0.5), GetDeviceCaps(hDC, LOGPIXELSY), 72);
+ ReleaseDC(0, hDC);
+ lfa.lfWeight = s.fontWeight;
+ lfa.lfItalic = s.fItalic?-1:0;
+ lfa.lfUnderline = s.fUnderline?-1:0;
+ lfa.lfStrikeOut = s.fStrikeOut?-1:0;
+
+ return(lfa);
+}
+
+LOGFONTW& operator <<= (LOGFONTW& lfw, STSStyle& s)
+{
+ lfw.lfCharSet = s.charSet;
+#ifdef UNICODE
+ wcsncpy(lfw.lfFaceName, s.fontName, 32);
+#else
+ mbstowcs(lfw.lfFaceName, s.fontName, 32);
+#endif
+ HDC hDC = GetDC(0);
+ lfw.lfHeight = -MulDiv((int)(s.fontSize+0.5), GetDeviceCaps(hDC, LOGPIXELSY), 72);
+ ReleaseDC(0, hDC);
+ lfw.lfWeight = s.fontWeight;
+ lfw.lfItalic = s.fItalic?-1:0;
+ lfw.lfUnderline = s.fUnderline?-1:0;
+ lfw.lfStrikeOut = s.fStrikeOut?-1:0;
+
+ return(lfw);
+}
+
+CString& operator <<= (CString& style, STSStyle& s)
+{
+ style.Format(_T("%d,%d,%d,%d,%d,%d,%f,%f,0x%06x,0x%06x,0x%06x,0x%06x,0x%02x,0x%02x,0x%02x,0x%02x,%d,%s,%f,%f,%f,%f,%d,%d,%d,%d,%d,%f,%f,%f,%d"),
+ s.marginRect.left,s.marginRect.right,s.marginRect.top,s.marginRect.bottom,
+ s.scrAlignment, s.borderStyle, s.outlineWidth, s.shadowDepth,
+ s.colors[0], s.colors[1], s.colors[2], s.colors[3], s.alpha[0], s.alpha[1], s.alpha[2], s.alpha[3],
+ s.charSet,
+ s.fontName, s.fontSize, s.fontScaleX, s.fontScaleY, s.fontSpacing, s.fontWeight,
+ (int)s.fItalic, (int)s.fUnderline, (int)s.fStrikeOut, (int)s.fBlur,
+ s.fontAngleZ, s.fontAngleX, s.fontAngleY,
+ s.relativeTo);
+
+ return(style);
+}
+
+STSStyle& operator <<= (STSStyle& s, CString& style)
+{
+ s.SetDefault();
+
+ try
+ {
+ CStringW str = TToW(style);
+ s.marginRect.left = GetInt(str); s.marginRect.right = GetInt(str); s.marginRect.top = GetInt(str); s.marginRect.bottom = GetInt(str);
+ s.scrAlignment = GetInt(str); s.borderStyle = GetInt(str); s.outlineWidth = GetFloat(str); s.shadowDepth = GetFloat(str);
+ for(int i = 0; i < 4; i++) s.colors[i] = (COLORREF)GetInt(str);
+ for(int i = 0; i < 4; i++) s.alpha[i] = GetInt(str);
+ s.charSet = GetInt(str);
+ s.fontName = WToT(GetStr(str)); s.fontSize = GetFloat(str);
+ s.fontScaleX = GetFloat(str); s.fontScaleY = GetFloat(str);
+ s.fontSpacing = GetFloat(str); s.fontWeight = GetInt(str);
+ s.fItalic = !!GetInt(str); s.fUnderline = !!GetInt(str); s.fStrikeOut = !!GetInt(str); s.fBlur = !!GetInt(str);
+ s.fontAngleZ = GetFloat(str); s.fontAngleX = GetFloat(str); s.fontAngleY = GetFloat(str);
+ s.relativeTo = GetInt(str);
+ }
+ catch(...)
+ {
+ s.SetDefault();
+ }
+
+ return(s);
+}
+
diff --git a/src/subtitles/STS.h b/src/subtitles/STS.h
new file mode 100644
index 000000000..ad0bad29f
--- /dev/null
+++ b/src/subtitles/STS.h
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+#include <wxutil.h>
+#include "TextFile.h"
+#include "GFN.h"
+
+typedef enum {TIME, FRAME} tmode; // the meaning of STSEntry::start/end
+
+class STSStyle
+{
+public:
+ CRect marginRect; // measured from the sides
+ int scrAlignment; // 1 - 9: as on the numpad, 0: default
+ int borderStyle; // 0: outline, 1: opaque box
+ double outlineWidth;
+ double shadowDepth;
+ COLORREF colors[4]; // usually: {primary, secondary, outline/background, shadow}
+ BYTE alpha[4];
+ int charSet;
+ CString fontName;
+ double fontSize; // height
+ double fontScaleX, fontScaleY; // percent
+ double fontSpacing; // +/- pixels
+ int fontWeight;
+ bool fItalic;
+ bool fUnderline;
+ bool fStrikeOut;
+ bool fBlur;
+ double fontAngleZ, fontAngleX, fontAngleY;
+ int relativeTo; // 0: window, 1: video, 2: undefined (~window)
+
+ STSStyle();
+
+ void SetDefault();
+
+ bool operator == (STSStyle& s);
+ bool IsFontStyleEqual(STSStyle& s);
+
+ void operator = (LOGFONT& lf);
+
+ friend LOGFONTA& operator <<= (LOGFONTA& lfa, STSStyle& s);
+ friend LOGFONTW& operator <<= (LOGFONTW& lfw, STSStyle& s);
+
+ friend CString& operator <<= (CString& style, STSStyle& s);
+ friend STSStyle& operator <<= (STSStyle& s, CString& style);
+};
+
+class CSTSStyleMap : public CAtlMap<CString, STSStyle*, CStringElementTraits<CString> >
+{
+public:
+ CSTSStyleMap() {}
+ virtual ~CSTSStyleMap() {Free();}
+ void Free();
+};
+
+typedef struct
+{
+ CStringW str;
+ bool fUnicode;
+ CString style, actor, effect;
+ CRect marginRect;
+ int layer;
+ int start, end;
+ int readorder;
+} STSEntry;
+
+class STSSegment
+{
+public:
+ int start, end;
+ CAtlArray<int> subs;
+
+ STSSegment() {};
+ STSSegment(int s, int e) {start = s; end = e;}
+ STSSegment(const STSSegment& stss) {*this = stss;}
+ void operator = (const STSSegment& stss) {start = stss.start; end = stss.end; subs.Copy(stss.subs);}
+};
+
+class CSimpleTextSubtitle : public CAtlArray<STSEntry>
+{
+ friend class CSubtitleEditorDlg;
+
+protected:
+ CAtlArray<STSSegment> m_segments;
+ virtual void OnChanged() {}
+
+public:
+ CString m_name;
+ tmode m_mode;
+ CTextFile::enc m_encoding;
+ CString m_path;
+
+ CSize m_dstScreenSize;
+ int m_defaultWrapStyle;
+ int m_collisions;
+ bool m_fScaledBAS;
+
+ bool m_fUsingAutoGeneratedDefaultStyle;
+
+ CSTSStyleMap m_styles;
+
+public:
+ CSimpleTextSubtitle();
+ virtual ~CSimpleTextSubtitle();
+
+ virtual void Copy(CSimpleTextSubtitle& sts);
+ virtual void Empty();
+
+ void Sort(bool fRestoreReadorder = false);
+ void CreateSegments();
+
+ void Append(CSimpleTextSubtitle& sts, int timeoff = -1);
+
+ bool Open(CString fn, int CharSet, CString name = _T(""));
+ bool Open(CTextFile* f, int CharSet, CString name);
+ bool Open(BYTE* data, int len, int CharSet, CString name);
+ bool SaveAs(CString fn, exttype et, double fps = -1, CTextFile::enc = CTextFile::ASCII);
+
+ void Add(CStringW str, bool fUnicode, int start, int end, CString style = _T("Default"), CString actor = _T(""), CString effect = _T(""), CRect marginRect = CRect(0,0,0,0), int layer = 0, int readorder = -1);
+
+ STSStyle* CreateDefaultStyle(int CharSet);
+ void ChangeUnknownStylesToDefault();
+ void AddStyle(CString name, STSStyle* style); // style will be stored and freed in Empty() later
+ bool CopyStyles(const CSTSStyleMap& styles, bool fAppend = false);
+
+ bool SetDefaultStyle(STSStyle& s);
+ bool GetDefaultStyle(STSStyle& s);
+
+ void ConvertToTimeBased(double fps);
+ void ConvertToFrameBased(double fps);
+
+ int TranslateStart(int i, double fps);
+ int TranslateEnd(int i, double fps);
+ int SearchSub(int t, double fps);
+
+ int TranslateSegmentStart(int i, double fps);
+ int TranslateSegmentEnd(int i, double fps);
+ const STSSegment* SearchSubs(int t, double fps, /*[out]*/ int* iSegment = NULL, int* nSegments = NULL);
+ const STSSegment* GetSegment(int iSegment) {return iSegment >= 0 && iSegment < (int)m_segments.GetCount() ? &m_segments[iSegment] : NULL;}
+
+ STSStyle* GetStyle(int i);
+ bool GetStyle(int i, STSStyle& stss);
+ int GetCharSet(int i);
+ bool IsEntryUnicode(int i);
+ void ConvertUnicode(int i, bool fUnicode);
+
+ CStringA GetStrA(int i, bool fSSA = false);
+ CStringW GetStrW(int i, bool fSSA = false);
+ CStringW GetStrWA(int i, bool fSSA = false);
+
+#ifdef UNICODE
+#define GetStr GetStrW
+#else
+#define GetStr GetStrA
+#endif
+
+ void SetStr(int i, CStringA str, bool fUnicode /* ignored */);
+ void SetStr(int i, CStringW str, bool fUnicode);
+};
+
+extern BYTE CharSetList[];
+extern TCHAR* CharSetNames[];
+extern int CharSetLen;
+
+class CHtmlColorMap : public CAtlMap<CString, DWORD, CStringElementTraits<CString> > {public: CHtmlColorMap();};
+extern CHtmlColorMap g_colors;
+
diff --git a/src/subtitles/SubtitleInputPin.cpp b/src/subtitles/SubtitleInputPin.cpp
new file mode 100644
index 000000000..af7fd2ad6
--- /dev/null
+++ b/src/subtitles/SubtitleInputPin.cpp
@@ -0,0 +1,344 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "SubtitleInputPin.h"
+#include "VobSubFile.h"
+#include "RTS.h"
+
+#include <initguid.h>
+#include "..\..\include\moreuuids.h"
+
+// our first format id
+#define __GAB1__ "GAB1"
+
+// our tags for __GAB1__ (ushort) + size (ushort)
+
+// "lang" + '0'
+#define __GAB1_LANGUAGE__ 0
+// (int)start+(int)stop+(char*)line+'0'
+#define __GAB1_ENTRY__ 1
+// L"lang" + '0'
+#define __GAB1_LANGUAGE_UNICODE__ 2
+// (int)start+(int)stop+(WCHAR*)line+'0'
+#define __GAB1_ENTRY_UNICODE__ 3
+
+// same as __GAB1__, but the size is (uint) and only __GAB1_LANGUAGE_UNICODE__ is valid
+#define __GAB2__ "GAB2"
+
+// (BYTE*)
+#define __GAB1_RAWTEXTSUBTITLE__ 4
+
+CSubtitleInputPin::CSubtitleInputPin(CBaseFilter* pFilter, CCritSec* pLock, CCritSec* pSubLock, HRESULT* phr)
+ : CBaseInputPin(NAME("CSubtitleInputPin"), pFilter, pLock, phr, L"Input")
+ , m_pSubLock(pSubLock)
+{
+ m_bCanReconnectWhenActive = TRUE;
+}
+
+HRESULT CSubtitleInputPin::CheckMediaType(const CMediaType* pmt)
+{
+ return pmt->majortype == MEDIATYPE_Text && (pmt->subtype == MEDIASUBTYPE_NULL || pmt->subtype == FOURCCMap((DWORD)0))
+ || pmt->majortype == MEDIATYPE_Subtitle && pmt->subtype == MEDIASUBTYPE_UTF8
+ || pmt->majortype == MEDIATYPE_Subtitle && (pmt->subtype == MEDIASUBTYPE_SSA || pmt->subtype == MEDIASUBTYPE_ASS || pmt->subtype == MEDIASUBTYPE_ASS2)
+ || pmt->majortype == MEDIATYPE_Subtitle && (pmt->subtype == MEDIASUBTYPE_VOBSUB)
+ ? S_OK
+ : E_FAIL;
+}
+
+HRESULT CSubtitleInputPin::CompleteConnect(IPin* pReceivePin)
+{
+ if(m_mt.majortype == MEDIATYPE_Text)
+ {
+ if(!(m_pSubStream = new CRenderedTextSubtitle(m_pSubLock))) return E_FAIL;
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
+ pRTS->m_name = CString(GetPinName(pReceivePin)) + _T(" (embeded)");
+ pRTS->m_dstScreenSize = CSize(384, 288);
+ pRTS->CreateDefaultStyle(DEFAULT_CHARSET);
+ }
+ else if(m_mt.majortype == MEDIATYPE_Subtitle)
+ {
+ SUBTITLEINFO* psi = (SUBTITLEINFO*)m_mt.pbFormat;
+ DWORD dwOffset = psi->dwOffset;
+
+ CString name = ISO6392ToLanguage(psi->IsoLang);
+ if(name.IsEmpty()) name = _T("English");
+ if(wcslen(psi->TrackName) > 0) name += _T(" (") + CString(psi->TrackName) + _T(")");
+
+ if(m_mt.subtype == MEDIASUBTYPE_UTF8
+ /*|| m_mt.subtype == MEDIASUBTYPE_USF*/
+ || m_mt.subtype == MEDIASUBTYPE_SSA
+ || m_mt.subtype == MEDIASUBTYPE_ASS
+ || m_mt.subtype == MEDIASUBTYPE_ASS2)
+ {
+ if(!(m_pSubStream = new CRenderedTextSubtitle(m_pSubLock))) return E_FAIL;
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
+ pRTS->m_name = name;
+ pRTS->m_dstScreenSize = CSize(384, 288);
+ pRTS->CreateDefaultStyle(DEFAULT_CHARSET);
+
+ if(dwOffset > 0 && m_mt.cbFormat - dwOffset > 0)
+ {
+ CMediaType mt = m_mt;
+ if(mt.pbFormat[dwOffset+0] != 0xef
+ && mt.pbFormat[dwOffset+1] != 0xbb
+ && mt.pbFormat[dwOffset+2] != 0xfb)
+ {
+ dwOffset -= 3;
+ mt.pbFormat[dwOffset+0] = 0xef;
+ mt.pbFormat[dwOffset+1] = 0xbb;
+ mt.pbFormat[dwOffset+2] = 0xbf;
+ }
+
+ pRTS->Open(mt.pbFormat + dwOffset, mt.cbFormat - dwOffset, DEFAULT_CHARSET, pRTS->m_name);
+ }
+
+ }
+ else if(m_mt.subtype == MEDIASUBTYPE_VOBSUB)
+ {
+ if(!(m_pSubStream = new CVobSubStream(m_pSubLock))) return E_FAIL;
+ CVobSubStream* pVSS = (CVobSubStream*)(ISubStream*)m_pSubStream;
+ pVSS->Open(name, m_mt.pbFormat + dwOffset, m_mt.cbFormat - dwOffset);
+ }
+ }
+
+ AddSubStream(m_pSubStream);
+
+ return __super::CompleteConnect(pReceivePin);
+}
+
+HRESULT CSubtitleInputPin::BreakConnect()
+{
+ RemoveSubStream(m_pSubStream);
+ m_pSubStream = NULL;
+
+ ASSERT(IsStopped());
+
+ return __super::BreakConnect();
+}
+
+STDMETHODIMP CSubtitleInputPin::ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt)
+{
+ if(m_Connected)
+ {
+ RemoveSubStream(m_pSubStream);
+ m_pSubStream = NULL;
+
+ m_Connected->Release();
+ m_Connected = NULL;
+ }
+
+ return __super::ReceiveConnection(pConnector, pmt);
+}
+
+STDMETHODIMP CSubtitleInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+ CAutoLock cAutoLock(&m_csReceive);
+
+ if(m_mt.majortype == MEDIATYPE_Text
+ || m_mt.majortype == MEDIATYPE_Subtitle
+ && (m_mt.subtype == MEDIASUBTYPE_UTF8
+ /*|| m_mt.subtype == MEDIASUBTYPE_USF*/
+ || m_mt.subtype == MEDIASUBTYPE_SSA
+ || m_mt.subtype == MEDIASUBTYPE_ASS
+ || m_mt.subtype == MEDIASUBTYPE_ASS2))
+ {
+ CAutoLock cAutoLock(m_pSubLock);
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
+ pRTS->RemoveAll();
+ pRTS->CreateSegments();
+ }
+ else if(m_mt.majortype == MEDIATYPE_Subtitle
+ && (m_mt.subtype == MEDIASUBTYPE_VOBSUB))
+ {
+ CAutoLock cAutoLock(m_pSubLock);
+ CVobSubStream* pVSS = (CVobSubStream*)(ISubStream*)m_pSubStream;
+ pVSS->RemoveAll();
+ }
+
+ return __super::NewSegment(tStart, tStop, dRate);
+}
+
+STDMETHODIMP CSubtitleInputPin::Receive(IMediaSample* pSample)
+{
+ HRESULT hr;
+
+ hr = __super::Receive(pSample);
+ if(FAILED(hr)) return hr;
+
+ CAutoLock cAutoLock(&m_csReceive);
+
+ REFERENCE_TIME tStart, tStop;
+ pSample->GetTime(&tStart, &tStop);
+ tStart += m_tStart;
+ tStop += m_tStart;
+
+ BYTE* pData = NULL;
+ hr = pSample->GetPointer(&pData);
+ if(FAILED(hr) || pData == NULL) return hr;
+
+ int len = pSample->GetActualDataLength();
+
+ bool fInvalidate = false;
+
+ if(m_mt.majortype == MEDIATYPE_Text)
+ {
+ CAutoLock cAutoLock(m_pSubLock);
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
+
+ if(!strncmp((char*)pData, __GAB1__, strlen(__GAB1__)))
+ {
+ char* ptr = (char*)&pData[strlen(__GAB1__)+1];
+ char* end = (char*)&pData[len];
+
+ while(ptr < end)
+ {
+ WORD tag = *((WORD*)(ptr)); ptr += 2;
+ WORD size = *((WORD*)(ptr)); ptr += 2;
+
+ if(tag == __GAB1_LANGUAGE__)
+ {
+ pRTS->m_name = CString(ptr);
+ }
+ else if(tag == __GAB1_ENTRY__)
+ {
+ pRTS->Add(AToW(&ptr[8]), false, *(int*)ptr, *(int*)(ptr+4));
+ fInvalidate = true;
+ }
+ else if(tag == __GAB1_LANGUAGE_UNICODE__)
+ {
+ pRTS->m_name = (WCHAR*)ptr;
+ }
+ else if(tag == __GAB1_ENTRY_UNICODE__)
+ {
+ pRTS->Add((WCHAR*)(ptr+8), true, *(int*)ptr, *(int*)(ptr+4));
+ fInvalidate = true;
+ }
+
+ ptr += size;
+ }
+ }
+ else if(!strncmp((char*)pData, __GAB2__, strlen(__GAB2__)))
+ {
+ char* ptr = (char*)&pData[strlen(__GAB2__)+1];
+ char* end = (char*)&pData[len];
+
+ while(ptr < end)
+ {
+ WORD tag = *((WORD*)(ptr)); ptr += 2;
+ DWORD size = *((DWORD*)(ptr)); ptr += 4;
+
+ if(tag == __GAB1_LANGUAGE_UNICODE__)
+ {
+ pRTS->m_name = (WCHAR*)ptr;
+ }
+ else if(tag == __GAB1_RAWTEXTSUBTITLE__)
+ {
+ pRTS->Open((BYTE*)ptr, size, DEFAULT_CHARSET, pRTS->m_name);
+ fInvalidate = true;
+ }
+
+ ptr += size;
+ }
+ }
+ else if(pData != 0 && len > 1 && *pData != 0)
+ {
+ CStringA str((char*)pData, len);
+
+ str.Replace("\r\n", "\n");
+ str.Trim();
+
+ if(!str.IsEmpty())
+ {
+ pRTS->Add(AToW(str), false, (int)(tStart / 10000), (int)(tStop / 10000));
+ fInvalidate = true;
+ }
+ }
+ }
+ else if(m_mt.majortype == MEDIATYPE_Subtitle)
+ {
+ CAutoLock cAutoLock(m_pSubLock);
+
+ if(m_mt.subtype == MEDIASUBTYPE_UTF8)
+ {
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
+
+ CStringW str = UTF8To16(CStringA((LPCSTR)pData, len)).Trim();
+ if(!str.IsEmpty())
+ {
+ pRTS->Add(str, true, (int)(tStart / 10000), (int)(tStop / 10000));
+ fInvalidate = true;
+ }
+ }
+ else if(m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS || m_mt.subtype == MEDIASUBTYPE_ASS2)
+ {
+ CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
+
+ CStringW str = UTF8To16(CStringA((LPCSTR)pData, len)).Trim();
+ if(!str.IsEmpty())
+ {
+ STSEntry stse;
+
+ int fields = m_mt.subtype == MEDIASUBTYPE_ASS2 ? 10 : 9;
+
+ CAtlList<CStringW> sl;
+ Explode(str, sl, ',', fields);
+ if(sl.GetCount() == fields)
+ {
+ stse.readorder = wcstol(sl.RemoveHead(), NULL, 10);
+ stse.layer = wcstol(sl.RemoveHead(), NULL, 10);
+ stse.style = sl.RemoveHead();
+ stse.actor = sl.RemoveHead();
+ stse.marginRect.left = wcstol(sl.RemoveHead(), NULL, 10);
+ stse.marginRect.right = wcstol(sl.RemoveHead(), NULL, 10);
+ stse.marginRect.top = stse.marginRect.bottom = wcstol(sl.RemoveHead(), NULL, 10);
+ if(fields == 10) stse.marginRect.bottom = wcstol(sl.RemoveHead(), NULL, 10);
+ stse.effect = sl.RemoveHead();
+ stse.str = sl.RemoveHead();
+ }
+
+ if(!stse.str.IsEmpty())
+ {
+ pRTS->Add(stse.str, true, (int)(tStart / 10000), (int)(tStop / 10000),
+ stse.style, stse.actor, stse.effect, stse.marginRect, stse.layer, stse.readorder);
+ fInvalidate = true;
+ }
+ }
+ }
+ else if(m_mt.subtype == MEDIASUBTYPE_VOBSUB)
+ {
+ CVobSubStream* pVSS = (CVobSubStream*)(ISubStream*)m_pSubStream;
+ pVSS->Add(tStart, tStop, pData, len);
+ }
+ }
+
+ if(fInvalidate)
+ {
+ TRACE(_T("InvalidateSubtitle(%I64d, ..)\n"), tStart);
+ // IMPORTANT: m_pSubLock must not be locked when calling this
+ InvalidateSubtitle(tStart, m_pSubStream);
+ }
+
+ hr = S_OK;
+
+ return hr;
+}
+
diff --git a/src/subtitles/SubtitleInputPin.h b/src/subtitles/SubtitleInputPin.h
new file mode 100644
index 000000000..fbe60051b
--- /dev/null
+++ b/src/subtitles/SubtitleInputPin.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "..\subpic\ISubPic.h"
+
+//
+// CSubtitleInputPin
+//
+
+class CSubtitleInputPin : public CBaseInputPin
+{
+ CCritSec m_csReceive;
+
+ CCritSec* m_pSubLock;
+ CComPtr<ISubStream> m_pSubStream;
+
+protected:
+ virtual void AddSubStream(ISubStream* pSubStream) = 0;
+ virtual void RemoveSubStream(ISubStream* pSubStream) = 0;
+ virtual void InvalidateSubtitle(REFERENCE_TIME rtStart, ISubStream* pSubStream) = 0;
+
+public:
+ CSubtitleInputPin(CBaseFilter* pFilter, CCritSec* pLock, CCritSec* pSubLock, HRESULT* phr);
+
+ HRESULT CheckMediaType(const CMediaType* pmt);
+ HRESULT CompleteConnect(IPin* pReceivePin);
+ HRESULT BreakConnect();
+ STDMETHODIMP ReceiveConnection(IPin* pConnector, const AM_MEDIA_TYPE* pmt);
+ STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ STDMETHODIMP Receive(IMediaSample* pSample);
+
+ ISubStream* GetSubStream() {return m_pSubStream;}
+};
diff --git a/src/subtitles/TextFile.cpp b/src/subtitles/TextFile.cpp
new file mode 100644
index 000000000..9811e79be
--- /dev/null
+++ b/src/subtitles/TextFile.cpp
@@ -0,0 +1,532 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <atlbase.h>
+#include <afxinet.h>
+#include "TextFile.h"
+
+CTextFile::CTextFile(enc e)
+{
+ m_encoding = m_defaultencoding = e;
+ m_offset = 0;
+}
+
+bool CTextFile::Open(LPCTSTR lpszFileName)
+{
+ if(!__super::Open(lpszFileName, modeRead|typeBinary|shareDenyWrite))
+ return(false);
+
+ m_encoding = m_defaultencoding;
+ m_offset = 0;
+
+ if(__super::GetLength() >= 2)
+ {
+ WORD w;
+ if(sizeof(w) != Read(&w, sizeof(w)))
+ return Close(), false;
+
+ if(w == 0xfeff)
+ {
+ m_encoding = LE16;
+ m_offset = 2;
+ }
+ else if(w == 0xfffe)
+ {
+ m_encoding = BE16;
+ m_offset = 2;
+ }
+ else if(w == 0xbbef && __super::GetLength() >= 3)
+ {
+ BYTE b;
+ if(sizeof(b) != Read(&b, sizeof(b)))
+ return Close(), false;
+
+ if(b == 0xbf)
+ {
+ m_encoding = UTF8;
+ m_offset = 3;
+ }
+ }
+ }
+
+ if(m_encoding == m_defaultencoding)
+ {
+ __super::Close(); // CWebTextFile::Close() would delete the temp file if we called it...
+ if(!__super::Open(lpszFileName, modeRead|typeText|shareDenyWrite))
+ return(false);
+ }
+
+ return(true);
+}
+
+bool CTextFile::Save(LPCTSTR lpszFileName, enc e)
+{
+ if(!__super::Open(lpszFileName, modeCreate|modeWrite|shareDenyWrite|(e==ASCII?typeText:typeBinary)))
+ return(false);
+
+ if(e == UTF8)
+ {
+ BYTE b[3] = {0xef,0xbb,0xbf};
+ Write(b, sizeof(b));
+ }
+ else if(e == LE16)
+ {
+ BYTE b[2] = {0xff,0xfe};
+ Write(b, sizeof(b));
+ }
+ else if(e == BE16)
+ {
+ BYTE b[2] = {0xfe,0xff};
+ Write(b, sizeof(b));
+ }
+
+ m_encoding = e;
+
+ return(true);
+}
+
+CTextFile::enc CTextFile::GetEncoding()
+{
+ return(m_encoding);
+}
+
+bool CTextFile::IsUnicode()
+{
+ return(m_encoding == UTF8 || m_encoding == LE16 || m_encoding == BE16);
+}
+
+// CFile
+
+CString CTextFile::GetFilePath() const
+{
+ // to avoid a CException coming from CTime
+ return m_strFileName; // __super::GetFilePath();
+}
+
+// CStdioFile
+
+ULONGLONG CTextFile::GetPosition() const
+{
+ return(CStdioFile::GetPosition() - m_offset);
+}
+
+ULONGLONG CTextFile::GetLength() const
+{
+ return(CStdioFile::GetLength() - m_offset);
+}
+
+ULONGLONG CTextFile::Seek(LONGLONG lOff, UINT nFrom)
+{
+ ULONGLONG pos = GetPosition();
+ ULONGLONG len = GetLength();
+
+ switch(nFrom)
+ {
+ default:
+ case begin: lOff = lOff; break;
+ case current: lOff = pos + lOff; break;
+ case end: lOff = len - lOff; break;
+ }
+
+ lOff = max(min(lOff, len), 0) + m_offset;
+
+ pos = CStdioFile::Seek(lOff, begin) - m_offset;
+
+ return(pos);
+}
+
+void CTextFile::WriteString(LPCSTR lpsz/*CStringA str*/)
+{
+ CStringA str(lpsz);
+
+ if(m_encoding == ASCII)
+ {
+ __super::WriteString(AToT(str));
+ }
+ else if(m_encoding == ANSI)
+ {
+ str.Replace("\n", "\r\n");
+ Write((LPCSTR)str, str.GetLength());
+ }
+ else if(m_encoding == UTF8)
+ {
+ WriteString(AToW(str));
+ }
+ else if(m_encoding == LE16)
+ {
+ WriteString(AToW(str));
+ }
+ else if(m_encoding == BE16)
+ {
+ WriteString(AToW(str));
+ }
+}
+
+void CTextFile::WriteString(LPCWSTR lpsz/*CStringW str*/)
+{
+ CStringW str(lpsz);
+
+ if(m_encoding == ASCII)
+ {
+ __super::WriteString(WToT(str));
+ }
+ else if(m_encoding == ANSI)
+ {
+ str.Replace(L"\n", L"\r\n");
+ CStringA stra = CStringA(CString(str));
+ Write((LPCSTR)stra, stra.GetLength());
+ }
+ else if(m_encoding == UTF8)
+ {
+ str.Replace(L"\n", L"\r\n");
+ for(int i = 0; i < str.GetLength(); i++)
+ {
+ DWORD c = (WORD)str[i];
+
+ if(0 <= c && c < 0x80) // 0xxxxxxx
+ {
+ Write(&c, 1);
+ }
+ else if(0x80 <= c && c < 0x800) // 110xxxxx 10xxxxxx
+ {
+ c = 0xc080|((c<<2)&0x1f00)|(c&0x003f);
+ Write((BYTE*)&c+1, 1);
+ Write(&c, 1);
+ }
+ else if(0x800 <= c && c < 0xFFFF) // 1110xxxx 10xxxxxx 10xxxxxx
+ {
+ c = 0xe08080|((c<<4)&0x0f0000)|((c<<2)&0x3f00)|(c&0x003f);
+ Write((BYTE*)&c+2, 1);
+ Write((BYTE*)&c+1, 1);
+ Write(&c, 1);
+ }
+ else
+ {
+ c = '?';
+ Write(&c, 1);
+ }
+ }
+ }
+ else if(m_encoding == LE16)
+ {
+ str.Replace(L"\n", L"\r\n");
+ Write((LPCWSTR)str, str.GetLength()*2);
+ }
+ else if(m_encoding == BE16)
+ {
+ str.Replace(L"\n", L"\r\n");
+ for(int i = 0; i < str.GetLength(); i++)
+ str.SetAt(i, ((str[i]>>8)&0x00ff)|((str[i]<<8)&0xff00));
+ Write((LPCWSTR)str, str.GetLength()*2);
+ }
+}
+
+BOOL CTextFile::ReadString(CStringA& str)
+{
+ bool fEOF = true;
+
+ str.Empty();
+
+ if(m_encoding == ASCII)
+ {
+ CString s;
+ fEOF = !__super::ReadString(s);
+ str = TToA(s);
+ }
+ else if(m_encoding == ANSI)
+ {
+ char c;
+ while(Read(&c, sizeof(c)) == sizeof(c))
+ {
+ fEOF = false;
+ if(c == '\r') continue;
+ if(c == '\n') break;
+ str += c;
+ }
+ }
+ else if(m_encoding == UTF8)
+ {
+ BYTE b;
+ while(Read(&b, sizeof(b)) == sizeof(b))
+ {
+ fEOF = false;
+ char c = '?';
+ if(!(b&0x80)) // 0xxxxxxx
+ {
+ c = b&0x7f;
+ }
+ else if((b&0xe0) == 0xc0) // 110xxxxx 10xxxxxx
+ {
+ if(Read(&b, sizeof(b)) != sizeof(b)) break;
+ }
+ else if((b&0xf0) == 0xe0) // 1110xxxx 10xxxxxx 10xxxxxx
+ {
+ if(Read(&b, sizeof(b)) != sizeof(b)) break;
+ if(Read(&b, sizeof(b)) != sizeof(b)) break;
+ }
+ if(c == '\r') continue;
+ if(c == '\n') break;
+ str += c;
+ }
+ }
+ else if(m_encoding == LE16)
+ {
+ WORD w;
+ while(Read(&w, sizeof(w)) == sizeof(w))
+ {
+ fEOF = false;
+ char c = '?';
+ if(!(w&0xff00)) c = w&0xff;
+ if(c == '\r') continue;
+ if(c == '\n') break;
+ str += c;
+ }
+ }
+ else if(m_encoding == BE16)
+ {
+ WORD w;
+ while(Read(&w, sizeof(w)) == sizeof(w))
+ {
+ fEOF = false;
+ char c = '?';
+ if(!(w&0xff)) c = w>>8;
+ if(c == '\r') continue;
+ if(c == '\n') break;
+ str += c;
+ }
+ }
+
+ return(!fEOF);
+}
+
+BOOL CTextFile::ReadString(CStringW& str)
+{
+ bool fEOF = true;
+
+ str.Empty();
+
+ if(m_encoding == ASCII)
+ {
+ CString s;
+ fEOF = !__super::ReadString(s);
+ str = TToW(s);
+ }
+ else if(m_encoding == ANSI)
+ {
+ CStringA stra;
+ char c;
+ while(Read(&c, sizeof(c)) == sizeof(c))
+ {
+ fEOF = false;
+ if(c == '\r') continue;
+ if(c == '\n') break;
+ stra += c;
+ }
+ str = CStringW(CString(stra));
+ }
+ else if(m_encoding == UTF8)
+ {
+ BYTE b;
+ while(Read(&b, sizeof(b)) == sizeof(b))
+ {
+ fEOF = false;
+ WCHAR c = '?';
+ if(!(b&0x80)) // 0xxxxxxx
+ {
+ c = b&0x7f;
+ }
+ else if((b&0xe0) == 0xc0) // 110xxxxx 10xxxxxx
+ {
+ c = (b&0x1f)<<6;
+ if(Read(&b, sizeof(b)) != sizeof(b)) break;
+ c |= (b&0x3f);
+ }
+ else if((b&0xf0) == 0xe0) // 1110xxxx 10xxxxxx 10xxxxxx
+ {
+ c = (b&0x0f)<<12;
+ if(Read(&b, sizeof(b)) != sizeof(b)) break;
+ c |= (b&0x3f)<<6;
+ if(Read(&b, sizeof(b)) != sizeof(b)) break;
+ c |= (b&0x3f);
+ }
+ if(c == '\r') continue;
+ if(c == '\n') break;
+ str += c;
+ }
+ }
+ else if(m_encoding == LE16)
+ {
+ WCHAR wc;
+ while(Read(&wc, sizeof(wc)) == sizeof(wc))
+ {
+ fEOF = false;
+ if(wc == '\r') continue;
+ if(wc == '\n') break;
+ str += wc;
+ }
+ }
+ else if(m_encoding == BE16)
+ {
+ WCHAR wc;
+ while(Read(&wc, sizeof(wc)) == sizeof(wc))
+ {
+ fEOF = false;
+ wc = ((wc>>8)&0x00ff)|((wc<<8)&0xff00);
+ if(wc == '\r') continue;
+ if(wc == '\n') break;
+ str += wc;
+ }
+ }
+
+ return(!fEOF);
+}
+
+//
+// CWebTextFile
+//
+
+CWebTextFile::CWebTextFile(LONGLONG llMaxSize)
+ : m_llMaxSize(llMaxSize)
+{
+}
+
+bool CWebTextFile::Open(LPCTSTR lpszFileName)
+{
+ CString fn(lpszFileName);
+
+ if(fn.Find(_T("http://")) != 0)
+ return __super::Open(lpszFileName);
+
+ try
+ {
+ CInternetSession is;
+
+ CAutoPtr<CStdioFile> f(is.OpenURL(fn, 1, INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_EXISTING_CONNECT));
+ if(!f) return(false);
+
+ TCHAR path[MAX_PATH];
+ GetTempPath(MAX_PATH, path);
+
+ fn = path + fn.Mid(fn.ReverseFind('/')+1);
+ int i = fn.Find(_T("?"));
+ if(i > 0) fn = fn.Left(i);
+ CFile temp;
+ if(!temp.Open(fn, modeCreate|modeWrite|typeBinary|shareDenyWrite))
+ {
+ f->Close();
+ return(false);
+ }
+
+ BYTE buff[1024];
+ int len, total = 0;
+ while((len = f->Read(buff, 1024)) == 1024 && (m_llMaxSize < 0 || (total+=1024) < m_llMaxSize))
+ temp.Write(buff, len);
+ if(len > 0) temp.Write(buff, len);
+
+ m_tempfn = fn;
+
+ f->Close(); // must close it because the desctructor doesn't seem to do it and we will get an exception when "is" is destroying
+ }
+ catch(CInternetException* ie)
+ {
+ ie->Delete();
+ return(false);
+ }
+
+ return __super::Open(m_tempfn);
+}
+
+bool CWebTextFile::Save(LPCTSTR lpszFileName, enc e)
+{
+ // CWebTextFile is read-only...
+ ASSERT(0);
+ return(false);
+}
+
+void CWebTextFile::Close()
+{
+ __super::Close();
+
+ if(!m_tempfn.IsEmpty())
+ {
+ _tremove(m_tempfn);
+ m_tempfn.Empty();
+ }
+}
+
+///////////////////////////////////////////////////////////////
+
+CStringW AToW(CStringA str)
+{
+ CStringW ret;
+ for(int i = 0, j = str.GetLength(); i < j; i++)
+ ret += (WCHAR)(BYTE)str[i];
+ return(ret);
+}
+
+CStringA WToA(CStringW str)
+{
+ CStringA ret;
+ for(int i = 0, j = str.GetLength(); i < j; i++)
+ ret += (CHAR)(WORD)str[i];
+ return(ret);
+}
+
+CString AToT(CStringA str)
+{
+ CString ret;
+ for(int i = 0, j = str.GetLength(); i < j; i++)
+ ret += (TCHAR)(BYTE)str[i];
+ return(ret);
+}
+
+CString WToT(CStringW str)
+{
+ CString ret;
+ for(int i = 0, j = str.GetLength(); i < j; i++)
+ ret += (TCHAR)(WORD)str[i];
+ return(ret);
+}
+
+CStringA TToA(CString str)
+{
+ CStringA ret;
+#ifdef UNICODE
+ for(int i = 0, j = str.GetLength(); i < j; i++)
+ ret += (CHAR)(BYTE)str[i];
+#else
+ ret = str;
+#endif
+ return(ret);
+}
+
+CStringW TToW(CString str)
+{
+ CStringW ret;
+#ifdef UNICODE
+ ret = str;
+#else
+ for(int i = 0, j = str.GetLength(); i < j; i++)
+ ret += (WCHAR)(BYTE)str[i];
+#endif
+ return(ret);
+}
diff --git a/src/subtitles/TextFile.h b/src/subtitles/TextFile.h
new file mode 100644
index 000000000..82ecc5238
--- /dev/null
+++ b/src/subtitles/TextFile.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <afx.h>
+
+class CTextFile : protected CStdioFile
+{
+public:
+ typedef enum {ASCII, UTF8, LE16, BE16, ANSI} enc;
+
+private:
+ enc m_encoding, m_defaultencoding;
+ int m_offset;
+
+public:
+ CTextFile(enc e = ASCII);
+
+ virtual bool Open(LPCTSTR lpszFileName);
+ virtual bool Save(LPCTSTR lpszFileName, enc e /*= ASCII*/);
+
+ enc GetEncoding();
+ bool IsUnicode();
+
+ // CFile
+
+ CString GetFilePath() const;
+
+ // CStdioFile
+
+ ULONGLONG GetPosition() const;
+ ULONGLONG GetLength() const;
+ ULONGLONG Seek(LONGLONG lOff, UINT nFrom);
+
+ void WriteString(LPCSTR lpsz/*CStringA str*/);
+ void WriteString(LPCWSTR lpsz/*CStringW str*/);
+ BOOL ReadString(CStringA& str);
+ BOOL ReadString(CStringW& str);
+};
+
+class CWebTextFile : public CTextFile
+{
+ LONGLONG m_llMaxSize;
+ CString m_tempfn;
+
+public:
+ CWebTextFile(LONGLONG llMaxSize = 1024*1024);
+
+ bool Open(LPCTSTR lpszFileName);
+ bool Save(LPCTSTR lpszFileName, enc e /*= ASCII*/);
+ void Close();
+};
+
+extern CStringW AToW(CStringA str);
+extern CStringA WToA(CStringW str);
+extern CString AToT(CStringA str);
+extern CString WToT(CStringW str);
+extern CStringA TToA(CString str);
+extern CStringW TToW(CString str);
diff --git a/src/subtitles/USFSubtitles.cpp b/src/subtitles/USFSubtitles.cpp
new file mode 100644
index 000000000..ea805b24d
--- /dev/null
+++ b/src/subtitles/USFSubtitles.cpp
@@ -0,0 +1,772 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "usfsubtitles.h"
+
+#define DeclareNameAndValue(pNode, name, val) \
+ CComBSTR name; \
+ pNode->get_nodeName(&name); \
+ name.ToLower(); \
+ CComVariant val; \
+ pNode->get_nodeValue(&val); \
+
+#define BeginEnumAttribs(pNode, pChild, name, value) \
+ {CComPtr<IXMLDOMNamedNodeMap> pAttribs; \
+ if(SUCCEEDED(pNode->get_attributes(&pAttribs)) && pAttribs != NULL) \
+ { \
+ CComPtr<IXMLDOMNode> pChild; \
+ for(pAttribs->nextNode(&pChild); pChild; pChild = NULL, pAttribs->nextNode(&pChild)) \
+ { \
+
+#define EndEnumAttribs }}}
+
+#define BeginEnumChildren(pNode, pChild) \
+ {CComPtr<IXMLDOMNode> pChild, pNext; \
+ for(pNode->get_firstChild(&pChild); pChild; pNext = NULL, pChild->get_nextSibling(&pNext), pChild = pNext) \
+ { \
+
+#define EndEnumChildren }}
+
+static CStringW GetText(CComPtr<IXMLDOMNode> pNode)
+{
+ CComBSTR bstr;
+ pNode->get_text(&bstr);
+
+ return(CStringW(bstr));
+}
+
+static CStringW GetXML(CComPtr<IXMLDOMNode> pNode)
+{
+ CComBSTR bstr;
+ pNode->get_xml(&bstr);
+ CStringW str(bstr);
+ str.Remove('\r');
+ str.Replace('\n', ' ');
+ for(int i = 0; (i = str.Find(L" ", i)) >= 0; )
+ {
+ for(++i; i < str.GetLength() && (str[i] == '\n' || str[i] == ' ');)
+ str.Delete(i);
+ }
+ return(str);
+}
+
+static CStringW GetAttrib(CStringW attrib, CComPtr<IXMLDOMNode> pNode)
+{
+ CStringW ret;
+
+ BeginEnumAttribs(pNode, pChild, name, val)
+ {
+ DeclareNameAndValue(pChild, name, val);
+
+ if(CStringW(name) == attrib && val.vt == VT_BSTR) // TODO: prepare for other types
+ {
+ ret = val.bstrVal;
+ break;
+ }
+ }
+ EndEnumAttribs
+
+ return(ret);
+}
+
+static int TimeToInt(CStringW str)
+{
+ CAtlList<CStringW> sl;
+ int i = 0;
+ for(CStringW token = str.Tokenize(L":.,", i); !token.IsEmpty(); token = str.Tokenize(L":.,", i))
+ sl.AddHead(token);
+
+ if(sl.GetCount() > 4)
+ return(-1);
+
+ int time = 0;
+
+ int mul[4] = {1,1000,60*1000,60*60*1000};
+ POSITION pos = sl.GetHeadPosition();
+ for(i = 0; pos; i++)
+ {
+ const WCHAR* s = sl.GetNext(pos);
+ WCHAR* tmp = NULL;
+ int t = wcstol(s, &tmp, 10);
+ if(s >= tmp) return(-1);
+ time += t * mul[i];
+ }
+
+ return(time);
+}
+
+static DWORD StringToDWORD(CStringW str)
+{
+ if(str.IsEmpty()) return(0);
+ if(str[0] == '#') return((DWORD)wcstol(str, NULL, 16));
+ else return((DWORD)wcstol(str, NULL, 10));
+}
+
+static DWORD ColorToDWORD(CStringW str)
+{
+ if(str.IsEmpty()) return(0);
+
+ DWORD ret = 0;
+
+ if(str[0] == '#')
+ {
+ ret = (DWORD)wcstol(str.TrimLeft('#'), NULL, 16);
+ }
+ else
+ {
+ g_colors.Lookup(CString(str), ret);
+ }
+
+ ret = ((ret&0xff)<<16)|(ret&0xff00ff00)|((ret>>16)&0xff);
+
+ return(ret);
+}
+
+static int TranslateAlignment(CStringW alignment)
+{
+ return
+ !alignment.CompareNoCase(L"BottomLeft") ? 1 :
+ !alignment.CompareNoCase(L"BottomCenter") ? 2 :
+ !alignment.CompareNoCase(L"BottomRight") ? 3 :
+ !alignment.CompareNoCase(L"MiddleLeft") ? 4 :
+ !alignment.CompareNoCase(L"MiddleCenter") ? 5 :
+ !alignment.CompareNoCase(L"MiddleRight") ? 6 :
+ !alignment.CompareNoCase(L"TopLeft") ? 7 :
+ !alignment.CompareNoCase(L"TopCenter") ? 8 :
+ !alignment.CompareNoCase(L"TopRight") ? 9 :
+ 2;
+}
+
+static int TranslateMargin(CStringW margin, int wndsize)
+{
+ int ret = 0;
+
+ if(!margin.IsEmpty())
+ {
+ ret = wcstol(margin, NULL, 10);
+ if(margin.Find('%') >= 0) ret = wndsize * ret / 100;
+ }
+
+ return(ret);
+}
+
+////////////////
+
+CUSFSubtitles::CUSFSubtitles()
+{
+}
+
+CUSFSubtitles::~CUSFSubtitles()
+{
+}
+
+bool CUSFSubtitles::Read(LPCTSTR fn)
+{
+ VARIANT_BOOL vb;
+ CComPtr<IXMLDOMDocument> pDoc;
+ if(FAILED(pDoc.CoCreateInstance(CLSID_DOMDocument))
+ || FAILED(pDoc->put_async(VARIANT_FALSE))
+ || FAILED(pDoc->load(CComVariant(fn), &vb)) || vb != VARIANT_TRUE)
+ return(false);
+
+ styles.RemoveAll();
+ effects.RemoveAll();
+ texts.RemoveAll();
+
+ if(!ParseUSFSubtitles(CComQIPtr<IXMLDOMNode>(pDoc)))
+ return(false);
+
+ POSITION pos = styles.GetHeadPosition();
+ while(pos)
+ {
+ style_t* def = styles.GetNext(pos);
+
+ if(def->name.CompareNoCase(L"Default"))
+ continue;
+
+ POSITION pos2 = styles.GetHeadPosition();
+ while(pos2)
+ {
+ style_t* s = styles.GetNext(pos2);
+
+ if(!s->name.CompareNoCase(L"Default"))
+ continue;
+
+ if(s->fontstyle.face.IsEmpty()) s->fontstyle.face = def->fontstyle.face;
+ if(s->fontstyle.size.IsEmpty()) s->fontstyle.size = def->fontstyle.size;
+ if(s->fontstyle.color[0].IsEmpty()) s->fontstyle.color[0] = def->fontstyle.color[0];
+ if(s->fontstyle.color[1].IsEmpty()) s->fontstyle.color[1] = def->fontstyle.color[1];
+ if(s->fontstyle.color[2].IsEmpty()) s->fontstyle.color[2] = def->fontstyle.color[2];
+ if(s->fontstyle.color[3].IsEmpty()) s->fontstyle.color[3] = def->fontstyle.color[3];
+ if(s->fontstyle.italic.IsEmpty()) s->fontstyle.italic = def->fontstyle.italic;
+ if(s->fontstyle.weight.IsEmpty()) s->fontstyle.weight = def->fontstyle.weight;
+ if(s->fontstyle.underline.IsEmpty()) s->fontstyle.underline = def->fontstyle.underline;
+ if(s->fontstyle.alpha.IsEmpty()) s->fontstyle.alpha = def->fontstyle.alpha;
+ if(s->fontstyle.outline.IsEmpty()) s->fontstyle.outline = def->fontstyle.outline;
+ if(s->fontstyle.shadow.IsEmpty()) s->fontstyle.shadow = def->fontstyle.shadow;
+ if(s->fontstyle.wrap.IsEmpty()) s->fontstyle.wrap = def->fontstyle.wrap;
+ if(s->pal.alignment.IsEmpty()) s->pal.alignment = def->pal.alignment;
+ if(s->pal.relativeto.IsEmpty()) s->pal.relativeto = def->pal.relativeto;
+ if(s->pal.horizontal_margin.IsEmpty()) s->pal.horizontal_margin = def->pal.horizontal_margin;
+ if(s->pal.vertical_margin.IsEmpty()) s->pal.vertical_margin = def->pal.vertical_margin;
+ if(s->pal.rotate[0].IsEmpty()) s->pal.rotate[0] = def->pal.rotate[0];
+ if(s->pal.rotate[1].IsEmpty()) s->pal.rotate[1] = def->pal.rotate[1];
+ if(s->pal.rotate[2].IsEmpty()) s->pal.rotate[2] = def->pal.rotate[2];
+ }
+
+ break;
+ }
+
+ pos = texts.GetHeadPosition();
+ while(pos)
+ {
+ text_t* t = texts.GetNext(pos);
+ if(t->style.IsEmpty()) t->style = L"Default";
+ }
+
+ return(true);
+}
+
+bool CUSFSubtitles::ConvertToSTS(CSimpleTextSubtitle& sts)
+{
+ sts.m_name = metadata.language.text;
+ sts.m_encoding = CTextFile::UTF8;
+ sts.m_dstScreenSize = CSize(640, 480);
+ sts.m_fScaledBAS = true;
+ sts.m_defaultWrapStyle = 1;
+
+ // TODO: map metadata.language.code to charset num (windows doesn't have such a function...)
+ int charSet = DEFAULT_CHARSET;
+
+ POSITION pos = styles.GetHeadPosition();
+ while(pos)
+ {
+ style_t* s = styles.GetNext(pos);
+
+ if(!s->name.CompareNoCase(L"Default") && !s->fontstyle.wrap.IsEmpty())
+ {
+ sts.m_defaultWrapStyle =
+ !s->fontstyle.wrap.CompareNoCase(L"no") ? 2 :
+ !s->fontstyle.wrap.CompareNoCase(L"auto") ? 1 :
+ 1;
+ }
+
+ STSStyle* stss = new STSStyle;
+ if(!stss) continue;
+
+ if(!s->pal.horizontal_margin.IsEmpty())
+ stss->marginRect.left = stss->marginRect.right = TranslateMargin(s->pal.horizontal_margin, sts.m_dstScreenSize.cx);
+ if(!s->pal.vertical_margin.IsEmpty())
+ stss->marginRect.top = stss->marginRect.bottom = TranslateMargin(s->pal.vertical_margin, sts.m_dstScreenSize.cy);
+
+ stss->scrAlignment = TranslateAlignment(s->pal.alignment);
+
+ if(!s->pal.relativeto.IsEmpty()) stss->relativeTo =
+ !s->pal.relativeto.CompareNoCase(L"window") ? 0 :
+ !s->pal.relativeto.CompareNoCase(L"video") ? 1 :
+ 0;
+
+ stss->borderStyle = 0;
+ if(!s->fontstyle.outline.IsEmpty()) stss->outlineWidth = wcstol(s->fontstyle.outline, NULL, 10);
+ if(!s->fontstyle.shadow.IsEmpty()) stss->shadowDepth = wcstol(s->fontstyle.shadow, NULL, 10);
+
+ for(int i = 0; i < 4; i++)
+ {
+ DWORD color = ColorToDWORD(s->fontstyle.color[i]);
+ int alpha = (BYTE)wcstol(s->fontstyle.alpha, NULL, 10);
+
+ stss->colors[i] = color & 0xffffff;
+ stss->alpha[i] = (BYTE)(color>>24);
+
+ stss->alpha[i] = stss->alpha[i] + (255 - stss->alpha[i]) * min(max(alpha, 0), 100) / 100;
+ }
+
+ if(!s->fontstyle.face.IsEmpty()) stss->fontName = s->fontstyle.face;
+ if(!s->fontstyle.size.IsEmpty()) stss->fontSize = wcstol(s->fontstyle.size, NULL, 10);
+ if(!s->fontstyle.weight.IsEmpty()) stss->fontWeight =
+ !s->fontstyle.weight.CompareNoCase(L"normal") ? FW_NORMAL :
+ !s->fontstyle.weight.CompareNoCase(L"bold") ? FW_BOLD :
+ !s->fontstyle.weight.CompareNoCase(L"lighter") ? FW_LIGHT :
+ !s->fontstyle.weight.CompareNoCase(L"bolder") ? FW_SEMIBOLD :
+ wcstol(s->fontstyle.weight, NULL, 10);
+ if(stss->fontWeight == 0) stss->fontWeight = FW_NORMAL;
+ if(!s->fontstyle.italic.IsEmpty()) stss->fItalic = s->fontstyle.italic.CompareNoCase(L"yes") == 0;
+ if(!s->fontstyle.underline.IsEmpty()) stss->fUnderline = s->fontstyle.underline.CompareNoCase(L"yes") == 0;
+ if(!s->pal.rotate[0].IsEmpty()) stss->fontAngleZ = wcstol(s->pal.rotate[0], NULL, 10);
+ if(!s->pal.rotate[1].IsEmpty()) stss->fontAngleX = wcstol(s->pal.rotate[1], NULL, 10);
+ if(!s->pal.rotate[2].IsEmpty()) stss->fontAngleY = wcstol(s->pal.rotate[2], NULL, 10);
+
+ stss->charSet = charSet;
+
+ sts.AddStyle(WToT(s->name), stss);
+ }
+
+ pos = texts.GetHeadPosition();
+ while(pos)
+ {
+ text_t* t = texts.GetNext(pos);
+
+ if(!t->pal.alignment.IsEmpty())
+ {
+ CStringW s;
+ s.Format(L"{\\an%d}", TranslateAlignment(t->pal.alignment));
+ t->str = s + t->str;
+ }
+
+ CRect marginRect;
+ marginRect.SetRectEmpty();
+
+ if(!t->pal.horizontal_margin.IsEmpty())
+ marginRect.left = marginRect.right = TranslateMargin(t->pal.horizontal_margin, sts.m_dstScreenSize.cx);
+ if(!t->pal.vertical_margin.IsEmpty())
+ marginRect.top = marginRect.bottom = TranslateMargin(t->pal.vertical_margin, sts.m_dstScreenSize.cy);
+
+ WCHAR rtags[3][8] = {L"{\\rz%d}", L"{\\rx%d}", L"{\\ry%d}"};
+ for(int i = 0; i < 3; i++)
+ {
+ if(int angle = wcstol(t->pal.rotate[i], NULL, 10))
+ {
+ CStringW str;
+ str.Format(rtags[i], angle);
+ t->str = str + t->str;
+ }
+ }
+
+ if(t->style.CompareNoCase(L"Default") != 0)
+ {
+ POSITION pos = styles.GetHeadPosition();
+ while(pos)
+ {
+ style_t* s = styles.GetNext(pos);
+ if(s->name == t->style && !s->fontstyle.wrap.IsEmpty())
+ {
+ int WrapStyle =
+ !s->fontstyle.wrap.CompareNoCase(L"no") ? 2 :
+ !s->fontstyle.wrap.CompareNoCase(L"auto") ? 1 :
+ 1;
+
+ if(WrapStyle != sts.m_defaultWrapStyle)
+ {
+ CStringW str;
+ str.Format(L"{\\q%d}", WrapStyle);
+ t->str = str + t->str;
+ }
+
+ break;
+ }
+ }
+ }
+
+ // TODO: apply effects as {\t(..)} after usf's standard clearly defines them
+
+ sts.Add(t->str, true, t->start, t->stop, WToT(t->style), _T(""), _T(""), marginRect);
+ }
+
+ return(true);
+}
+
+bool CUSFSubtitles::ParseUSFSubtitles(CComPtr<IXMLDOMNode> pNode)
+{
+ DeclareNameAndValue(pNode, name, val);
+
+ if(name == L"usfsubtitles")
+ {
+ // metadata
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ DeclareNameAndValue(pChild, name, val);
+
+ if(name == L"metadata")
+ {
+ ParseMetadata(pChild, metadata);
+ }
+ }
+ EndEnumChildren
+
+ // styles
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ DeclareNameAndValue(pChild, name, val);
+
+ if(name == L"styles")
+ {
+ BeginEnumChildren(pChild, pGrandChild) // :)
+ {
+ DeclareNameAndValue(pGrandChild, name, val);
+
+ if(name == L"style")
+ {
+ CAutoPtr<style_t> s(new style_t);
+ if(s)
+ {
+ ParseStyle(pGrandChild, s);
+ styles.AddTail(s);
+ }
+ }
+ }
+ EndEnumChildren
+ }
+ }
+ EndEnumChildren
+
+ // effects
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ DeclareNameAndValue(pChild, name, val);
+
+ if(name == L"effects")
+ {
+ BeginEnumChildren(pChild, pGrandChild) // :)
+ {
+ DeclareNameAndValue(pGrandChild, name, val);
+
+ if(name == L"effect")
+ {
+ CAutoPtr<effect_t> e(new effect_t);
+ if(e)
+ {
+ ParseEffect(pGrandChild, e);
+ effects.AddTail(e);
+ }
+ }
+ }
+ EndEnumChildren
+ }
+ }
+ EndEnumChildren
+
+ // subtitles
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ DeclareNameAndValue(pChild, name, val);
+
+ if(name == L"subtitles")
+ {
+ BeginEnumChildren(pChild, pGrandChild) // :)
+ {
+ DeclareNameAndValue(pGrandChild, name, val);
+
+ if(name == L"subtitle")
+ {
+ CStringW sstart = GetAttrib(L"start", pGrandChild);
+ CStringW sstop = GetAttrib(L"stop", pGrandChild);
+ CStringW sduration = GetAttrib(L"duration", pGrandChild);
+ if(sstart.IsEmpty() || (sstop.IsEmpty() && sduration.IsEmpty()))
+ continue;
+
+ int start = TimeToInt(sstart);
+ int stop = !sstop.IsEmpty() ? TimeToInt(sstop) : (start + TimeToInt(sduration));
+
+ ParseSubtitle(pGrandChild, start, stop);
+ }
+ }
+ EndEnumChildren
+ }
+ }
+ EndEnumChildren
+
+ return(true);
+ }
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ if(ParseUSFSubtitles(pChild))
+ {
+ return(true);
+ }
+ }
+ EndEnumChildren
+
+ return(false);
+}
+
+void CUSFSubtitles::ParseMetadata(CComPtr<IXMLDOMNode> pNode, metadata_t& m)
+{
+ DeclareNameAndValue(pNode, name, val);
+
+ if(name == L"title")
+ {
+ m.title = GetText(pNode);
+ }
+ else if(name == L"date")
+ {
+ m.date = GetText(pNode);
+ }
+ else if(name == L"comment")
+ {
+ m.comment = GetText(pNode);
+ }
+ else if(name == L"author")
+ {
+ BeginEnumChildren(pNode, pChild)
+ {
+ DeclareNameAndValue(pChild, name, val);
+
+ if(name == L"name")
+ m.author.name = GetText(pChild);
+ else if(name == L"email")
+ m.author.email = GetText(pChild);
+ else if(name == L"url")
+ m.author.url = GetText(pChild);
+ }
+ EndEnumChildren
+
+ return;
+ }
+ else if(name == L"language")
+ {
+ m.language.text = GetText(pNode);
+ m.language.code = GetAttrib(L"code", pNode);
+ }
+ else if(name == L"languageext")
+ {
+ m.languageext.text = GetText(pNode);
+ m.languageext.code = GetAttrib(L"code", pNode);
+ }
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ ParseMetadata(pChild, metadata);
+ }
+ EndEnumChildren
+}
+
+void CUSFSubtitles::ParseStyle(CComPtr<IXMLDOMNode> pNode, style_t* s)
+{
+ DeclareNameAndValue(pNode, name, val);
+
+ if(name == L"style")
+ {
+ s->name = GetAttrib(L"name", pNode);
+ }
+ else if(name == L"fontstyle")
+ {
+ ParseFontstyle(pNode, s->fontstyle);
+ return;
+ }
+ else if(name == L"position")
+ {
+ ParsePal(pNode, s->pal);
+ return;
+ }
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ ParseStyle(pChild, s);
+ }
+ EndEnumChildren
+}
+
+void CUSFSubtitles::ParseFontstyle(CComPtr<IXMLDOMNode> pNode, fontstyle_t& fs)
+{
+ fs.face = GetAttrib(L"face", pNode);
+ fs.size = GetAttrib(L"size", pNode);
+ fs.color[0] = GetAttrib(L"color", pNode);
+ fs.color[1] = GetAttrib(L"back-color", pNode);
+ fs.color[2] = GetAttrib(L"outline-color", pNode);
+ fs.color[3] = GetAttrib(L"shadow-color", pNode);
+ fs.italic = GetAttrib(L"italic", pNode);
+ fs.weight = GetAttrib(L"weight", pNode);
+ fs.underline = GetAttrib(L"underline", pNode);
+ fs.alpha = GetAttrib(L"alpha", pNode);
+ fs.outline = GetAttrib(L"outline-level", pNode);
+ fs.shadow = GetAttrib(L"shadow-level", pNode);
+ fs.wrap = GetAttrib(L"wrap", pNode);
+}
+
+void CUSFSubtitles::ParsePal(CComPtr<IXMLDOMNode> pNode, posattriblist_t& pal)
+{
+ pal.alignment = GetAttrib(L"alignment", pNode);
+ pal.relativeto = GetAttrib(L"relative-to", pNode);
+ pal.horizontal_margin = GetAttrib(L"horizontal-margin", pNode);
+ pal.vertical_margin = GetAttrib(L"vertical-margin", pNode);
+ pal.rotate[0] = GetAttrib(L"rotate-z", pNode);
+ pal.rotate[1] = GetAttrib(L"rotate-x", pNode);
+ pal.rotate[2] = GetAttrib(L"rotate-y", pNode);
+}
+
+void CUSFSubtitles::ParseEffect(CComPtr<IXMLDOMNode> pNode, effect_t* e)
+{
+ DeclareNameAndValue(pNode, name, val);
+
+ if(name == L"effect")
+ {
+ e->name = GetAttrib(L"name", pNode);
+ }
+ else if(name == L"keyframes")
+ {
+ BeginEnumChildren(pNode, pChild)
+ {
+ DeclareNameAndValue(pChild, name, val);
+
+ if(name == L"keyframe")
+ {
+ CAutoPtr<keyframe_t> k(new keyframe_t);
+ if(k)
+ {
+ ParseKeyframe(pChild, k);
+ e->keyframes.AddTail(k);
+ }
+ }
+ }
+ EndEnumChildren
+
+ return;
+ }
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ ParseEffect(pChild, e);
+ }
+ EndEnumChildren
+}
+
+void CUSFSubtitles::ParseKeyframe(CComPtr<IXMLDOMNode> pNode, keyframe_t* k)
+{
+ DeclareNameAndValue(pNode, name, val);
+
+ if(name == L"keyframe")
+ {
+ k->position = GetAttrib(L"position", pNode);
+ }
+ else if(name == L"fontstyle")
+ {
+ ParseFontstyle(pNode, k->fontstyle);
+ return;
+ }
+ else if(name == L"position")
+ {
+ ParsePal(pNode, k->pal);
+ return;
+ }
+}
+
+void CUSFSubtitles::ParseSubtitle(CComPtr<IXMLDOMNode> pNode, int start, int stop)
+{
+ DeclareNameAndValue(pNode, name, val);
+
+ if(name == L"text" || name == L"karaoke")
+ {
+ CAutoPtr<text_t> t(new text_t);
+ if(t)
+ {
+ t->start = start;
+ t->stop = stop;
+ t->style = GetAttrib(L"style", pNode);
+ t->effect = GetAttrib(L"effect", pNode);
+ ParsePal(pNode, t->pal);
+ ParseText(pNode, t->str);
+ texts.AddTail(t);
+ }
+
+ return;
+ }
+// else if
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ ParseSubtitle(pChild, start, stop);
+ }
+ EndEnumChildren
+}
+
+void CUSFSubtitles::ParseText(CComPtr<IXMLDOMNode> pNode, CStringW& str)
+{
+ DeclareNameAndValue(pNode, name, val);
+
+ CStringW prefix, postfix;
+
+ if(name == L"b")
+ {
+ prefix = L"{\\b1}";
+ postfix = L"{\\b}";
+ }
+ else if(name == L"i")
+ {
+ prefix = L"{\\i1}";
+ postfix = L"{\\i}";
+ }
+ else if(name == L"u")
+ {
+ prefix = L"{\\u1}";
+ postfix = L"{\\u}";
+ }
+ else if(name == L"font")
+ {
+ fontstyle_t fs;
+ ParseFontstyle(pNode, fs);
+
+ if(!fs.face.IsEmpty()) {prefix += L"{\\fn" + fs.face + L"}"; postfix += L"{\\fn}";}
+ if(!fs.size.IsEmpty()) {prefix += L"{\\fs" + fs.size + L"}"; postfix += L"{\\fs}";}
+ if(!fs.outline.IsEmpty()) {prefix += L"{\\bord" + fs.outline + L"}"; postfix += L"{\\bord}";}
+ if(!fs.shadow.IsEmpty()) {prefix += L"{\\shad" + fs.shadow + L"}"; postfix += L"{\\shad}";}
+
+ for(int i = 0; i < 4; i++)
+ {
+ if(!fs.color[i].IsEmpty())
+ {
+ CStringW s;
+ s.Format(L"{\\%dc&H%06x&}", i+1, ColorToDWORD(fs.color[i]));
+ prefix += s;
+ s.Format(L"{\\%dc}", i+1);
+ postfix += s;
+ }
+ }
+ }
+ else if(name == L"k")
+ {
+ int t = wcstol(GetAttrib(L"t", pNode), NULL, 10);
+ CStringW s;
+ s.Format(L"{\\kf%d}", t / 10);
+ str += s;
+ return;
+ }
+ else if(name == L"br")
+ {
+ str += L"\\N";
+ return;
+ }
+ else if(name == L"#text")
+ {
+ str += GetXML(pNode);
+ return;
+ }
+
+ BeginEnumChildren(pNode, pChild)
+ {
+ CStringW s;
+ ParseText(pChild, s);
+ str += s;
+ }
+ EndEnumChildren
+
+ str = prefix + str + postfix;
+}
+
+void CUSFSubtitles::ParseShape(CComPtr<IXMLDOMNode> pNode)
+{
+ // no specs on this yet
+}
diff --git a/src/subtitles/USFSubtitles.h b/src/subtitles/USFSubtitles.h
new file mode 100644
index 000000000..0783e4a58
--- /dev/null
+++ b/src/subtitles/USFSubtitles.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+#include "STS.h"
+
+// metadata
+typedef struct {CStringW name, email, url;} author_t;
+typedef struct {CStringW code, text;} language_t;
+typedef struct {CStringW title, date, comment; author_t author; language_t language, languageext;} metadata_t;
+// style
+typedef struct {CStringW alignment, relativeto, horizontal_margin, vertical_margin, rotate[3];} posattriblist_t;
+typedef struct {CStringW face, size, color[4], weight, italic, underline, alpha, outline, shadow, wrap;} fontstyle_t;
+typedef struct {CStringW name; fontstyle_t fontstyle; posattriblist_t pal;} style_t;
+// effect
+typedef struct {CStringW position; fontstyle_t fontstyle; posattriblist_t pal;} keyframe_t;
+typedef struct {CStringW name; CAutoPtrList<keyframe_t> keyframes;} effect_t;
+// subtitle/text
+typedef struct {int start, stop; CStringW effect, style, str; posattriblist_t pal;} text_t;
+
+class CUSFSubtitles
+{
+ bool ParseUSFSubtitles(CComPtr<IXMLDOMNode> pNode);
+ void ParseMetadata(CComPtr<IXMLDOMNode> pNode, metadata_t& m);
+ void ParseStyle(CComPtr<IXMLDOMNode> pNode, style_t* s);
+ void ParseFontstyle(CComPtr<IXMLDOMNode> pNode, fontstyle_t& fs);
+ void ParsePal(CComPtr<IXMLDOMNode> pNode, posattriblist_t& pal);
+ void ParseEffect(CComPtr<IXMLDOMNode> pNode, effect_t* e);
+ void ParseKeyframe(CComPtr<IXMLDOMNode> pNode, keyframe_t* k);
+ void ParseSubtitle(CComPtr<IXMLDOMNode> pNode, int start, int stop);
+ void ParseText(CComPtr<IXMLDOMNode> pNode, CStringW& assstr);
+ void ParseShape(CComPtr<IXMLDOMNode> pNode);
+
+public:
+ CUSFSubtitles();
+ virtual ~CUSFSubtitles();
+
+ bool Read(LPCTSTR fn);
+// bool Write(LPCTSTR fn); // TODO
+
+ metadata_t metadata;
+ CAutoPtrList<style_t> styles;
+ CAutoPtrList<effect_t> effects;
+ CAutoPtrList<text_t> texts;
+
+ bool ConvertToSTS(CSimpleTextSubtitle& sts);
+// bool ConvertFromSTS(CSimpleTextSubtitle& sts); // TODO
+};
diff --git a/src/subtitles/VobSubFile.cpp b/src/subtitles/VobSubFile.cpp
new file mode 100644
index 000000000..14bfddf85
--- /dev/null
+++ b/src/subtitles/VobSubFile.cpp
@@ -0,0 +1,2368 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include <winioctl.h>
+#include "TextFile.h"
+#include "..\..\include\unrar\unrar.h"
+#include "VobSubFile.h"
+
+//
+
+struct lang_type {unsigned short id; TCHAR lang_long[64];} lang_tbl[] =
+{
+ {'--', _T("(Not detected)")},
+ {'cc', _T("Closed Caption")},
+ {'aa', _T("Afar")},
+ {'ab', _T("Abkhazian")},
+ {'af', _T("Afrikaans")},
+ {'am', _T("Amharic")},
+ {'ar', _T("Arabic")},
+ {'as', _T("Assamese")},
+ {'ay', _T("Aymara")},
+ {'az', _T("Azerbaijani")},
+ {'ba', _T("Bashkir")},
+ {'be', _T("Byelorussian")},
+ {'bg', _T("Bulgarian")},
+ {'bh', _T("Bihari")},
+ {'bi', _T("Bislama")},
+ {'bn', _T("Bengali; Bangla")},
+ {'bo', _T("Tibetan")},
+ {'br', _T("Breton")},
+ {'ca', _T("Catalan")},
+ {'co', _T("Corsican")},
+ {'cs', _T("Czech")},
+ {'cy', _T("Welsh")},
+ {'da', _T("Dansk")},
+ {'de', _T("Deutsch")},
+ {'dz', _T("Bhutani")},
+ {'el', _T("Greek")},
+ {'en', _T("English")},
+ {'eo', _T("Esperanto")},
+ {'es', _T("Espanol")},
+ {'et', _T("Estonian")},
+ {'eu', _T("Basque")},
+ {'fa', _T("Persian")},
+ {'fi', _T("Finnish")},
+ {'fj', _T("Fiji")},
+ {'fo', _T("Faroese")},
+ {'fr', _T("Francais")},
+ {'fy', _T("Frisian")},
+ {'ga', _T("Irish")},
+ {'gd', _T("Scots Gaelic")},
+ {'gl', _T("Galician")},
+ {'gn', _T("Guarani")},
+ {'gu', _T("Gujarati")},
+ {'ha', _T("Hausa")},
+ {'he', _T("Hebrew")},
+ {'hi', _T("Hindi")},
+ {'hr', _T("Hrvatski")},
+ {'hu', _T("Hungarian")},
+ {'hy', _T("Armenian")},
+ {'ia', _T("Interlingua")},
+ {'id', _T("Indonesian")},
+ {'ie', _T("Interlingue")},
+ {'ik', _T("Inupiak")},
+ {'in', _T("Indonesian")},
+ {'is', _T("Islenska")},
+ {'it', _T("Italiano")},
+ {'iu', _T("Inuktitut")},
+ {'iw', _T("Hebrew")},
+ {'ja', _T("Japanese")},
+ {'ji', _T("Yiddish")},
+ {'jw', _T("Javanese")},
+ {'ka', _T("Georgian")},
+ {'kk', _T("Kazakh")},
+ {'kl', _T("Greenlandic")},
+ {'km', _T("Cambodian")},
+ {'kn', _T("Kannada")},
+ {'ko', _T("Korean")},
+ {'ks', _T("Kashmiri")},
+ {'ku', _T("Kurdish")},
+ {'ky', _T("Kirghiz")},
+ {'la', _T("Latin")},
+ {'ln', _T("Lingala")},
+ {'lo', _T("Laothian")},
+ {'lt', _T("Lithuanian")},
+ {'lv', _T("Latvian, Lettish")},
+ {'mg', _T("Malagasy")},
+ {'mi', _T("Maori")},
+ {'mk', _T("Macedonian")},
+ {'ml', _T("Malayalam")},
+ {'mn', _T("Mongolian")},
+ {'mo', _T("Moldavian")},
+ {'mr', _T("Marathi")},
+ {'ms', _T("Malay")},
+ {'mt', _T("Maltese")},
+ {'my', _T("Burmese")},
+ {'na', _T("Nauru")},
+ {'ne', _T("Nepali")},
+ {'nl', _T("Nederlands")},
+ {'no', _T("Norsk")},
+ {'oc', _T("Occitan")},
+ {'om', _T("(Afan) Oromo")},
+ {'or', _T("Oriya")},
+ {'pa', _T("Punjabi")},
+ {'pl', _T("Polish")},
+ {'ps', _T("Pashto, Pushto")},
+ {'pt', _T("Portugues")},
+ {'qu', _T("Quechua")},
+ {'rm', _T("Rhaeto-Romance")},
+ {'rn', _T("Kirundi")},
+ {'ro', _T("Romanian")},
+ {'ru', _T("Russian")},
+ {'rw', _T("Kinyarwanda")},
+ {'sa', _T("Sanskrit")},
+ {'sd', _T("Sindhi")},
+ {'sg', _T("Sangho")},
+ {'sh', _T("Serbo-Croatian")},
+ {'si', _T("Sinhalese")},
+ {'sk', _T("Slovak")},
+ {'sl', _T("Slovenian")},
+ {'sm', _T("Samoan")},
+ {'sn', _T("Shona")},
+ {'so', _T("Somali")},
+ {'sq', _T("Albanian")},
+ {'sr', _T("Serbian")},
+ {'ss', _T("Siswati")},
+ {'st', _T("Sesotho")},
+ {'su', _T("Sundanese")},
+ {'sv', _T("Svenska")},
+ {'sw', _T("Swahili")},
+ {'ta', _T("Tamil")},
+ {'te', _T("Telugu")},
+ {'tg', _T("Tajik")},
+ {'th', _T("Thai")},
+ {'ti', _T("Tigrinya")},
+ {'tk', _T("Turkmen")},
+ {'tl', _T("Tagalog")},
+ {'tn', _T("Setswana")},
+ {'to', _T("Tonga")},
+ {'tr', _T("Turkish")},
+ {'ts', _T("Tsonga")},
+ {'tt', _T("Tatar")},
+ {'tw', _T("Twi")},
+ {'ug', _T("Uighur")},
+ {'uk', _T("Ukrainian")},
+ {'ur', _T("Urdu")},
+ {'uz', _T("Uzbek")},
+ {'vi', _T("Vietnamese")},
+ {'vo', _T("Volapuk")},
+ {'wo', _T("Wolof")},
+ {'xh', _T("Xhosa")},
+ {'yi', _T("Yiddish")}, // formerly ji
+ {'yo', _T("Yoruba")},
+ {'za', _T("Zhuang")},
+ {'zh', _T("Chinese")},
+ {'zu', _T("Zulu")},
+};
+
+int find_lang(unsigned short id)
+{
+ int mid, lo = 0, hi = countof(lang_tbl) - 1;
+
+ while(lo < hi)
+ {
+ mid = (lo + hi) >> 1;
+ if(id < lang_tbl[mid].id) hi = mid;
+ else if(id > lang_tbl[mid].id) lo = mid + 1;
+ else return(mid);
+ }
+
+ return(id == lang_tbl[lo].id ? lo : 0);
+}
+
+CString FindLangFromId(WORD id)
+{
+ return(lang_tbl[find_lang(id)].lang_long);
+}
+
+//
+// CVobSubFile
+//
+
+CVobSubFile::CVobSubFile(CCritSec* pLock)
+ : ISubPicProviderImpl(pLock)
+ , m_sub(1024*1024)
+{
+}
+
+CVobSubFile::~CVobSubFile()
+{
+}
+
+//
+
+bool CVobSubFile::Copy(CVobSubFile& vsf)
+{
+ Close();
+
+ *(CVobSubSettings*)this = *(CVobSubSettings*)&vsf;
+ m_title = vsf.m_title;
+ m_iLang = vsf.m_iLang;
+
+ m_sub.SetLength(vsf.m_sub.GetLength());
+ m_sub.SeekToBegin();
+
+ for(int i = 0; i < 32; i++)
+ {
+ SubLang& src = vsf.m_langs[i];
+ SubLang& dst = m_langs[i];
+
+ dst.id = src.id;
+ dst.name = src.name;
+ dst.alt = src.alt;
+
+ for(int j = 0; j < src.subpos.GetCount(); j++)
+ {
+ SubPos& sp = src.subpos[j];
+ if(!sp.fValid) continue;
+
+ if(sp.filepos != vsf.m_sub.Seek(sp.filepos, CFile::begin))
+ continue;
+
+ sp.filepos = m_sub.GetPosition();
+
+ BYTE buff[2048];
+ vsf.m_sub.Read(buff, 2048);
+ m_sub.Write(buff, 2048);
+
+ WORD packetsize = (buff[buff[0x16]+0x18]<<8) | buff[buff[0x16]+0x19];
+
+ for(int k = 0, size, sizeleft = packetsize - 4;
+ k < packetsize - 4;
+ k += size, sizeleft -= size)
+ {
+ int hsize = buff[0x16]+0x18 + ((buff[0x15]&0x80) ? 4 : 0);
+ size = min(sizeleft, 2048 - hsize);
+
+ if(size != sizeleft)
+ {
+ while(vsf.m_sub.Read(buff, 2048))
+ {
+ if(!(buff[0x15]&0x80) && buff[buff[0x16]+0x17] == (i|0x20)) break;
+ }
+
+ m_sub.Write(buff, 2048);
+ }
+ }
+
+ dst.subpos.Add(sp);
+ }
+ }
+
+ m_sub.SetLength(m_sub.GetPosition());
+
+ return(true);
+}
+
+//
+
+void CVobSubFile::TrimExtension(CString& fn)
+{
+ int i = fn.ReverseFind('.');
+ if(i > 0)
+ {
+ CString ext = fn.Mid(i).MakeLower();
+ if(ext == _T(".ifo") || ext == _T(".idx") || ext == _T(".sub")
+ || ext == _T(".sst") || ext == _T(".son") || ext == _T(".rar"))
+ fn = fn.Left(i);
+ }
+}
+
+bool CVobSubFile::Open(CString fn)
+{
+ TrimExtension(fn);
+
+ do
+ {
+ Close();
+
+ int ver;
+ if(!ReadIdx(fn + _T(".idx"), ver))
+ break;
+
+ if(ver < 6 && !ReadIfo(fn + _T(".ifo")))
+ break;
+
+ if(!ReadSub(fn + _T(".sub")) && !ReadRar(fn + _T(".rar")))
+ break;
+
+ m_title = fn;
+
+ for(int i = 0; i < 32; i++)
+ {
+ CAtlArray<SubPos>& sp = m_langs[i].subpos;
+
+ for(int j = 0; j < sp.GetCount(); j++)
+ {
+ sp[j].stop = sp[j].start;
+ sp[j].fForced = false;
+
+ int packetsize = 0, datasize = 0;
+ BYTE* buff = GetPacket(j, packetsize, datasize, i);
+ if(!buff) continue;
+
+ m_img.delay = j < (sp.GetCount()-1) ? sp[j+1].start - sp[j].start : 3000;
+ m_img.GetPacketInfo(buff, packetsize, datasize);
+ if(j < (sp.GetCount()-1)) m_img.delay = min(m_img.delay, sp[j+1].start - sp[j].start);
+
+ sp[j].stop = sp[j].start + m_img.delay;
+ sp[j].fForced = m_img.fForced;
+
+ if(j > 0 && sp[j-1].stop > sp[j].start)
+ sp[j-1].stop = sp[j].start;
+
+ delete [] buff;
+ }
+ }
+
+ return(true);
+ }
+ while(false);
+
+ Close();
+
+ return(false);
+}
+
+bool CVobSubFile::Save(CString fn, SubFormat sf)
+{
+ TrimExtension(fn);
+
+ CVobSubFile vsf(NULL);
+ if(!vsf.Copy(*this))
+ return(false);
+
+ switch(sf)
+ {
+ case VobSub: return vsf.SaveVobSub(fn); break;
+ case WinSubMux: return vsf.SaveWinSubMux(fn); break;
+ case Scenarist: return vsf.SaveScenarist(fn); break;
+ case Maestro: return vsf.SaveMaestro(fn); break;
+ default: break;
+ }
+
+ return(false);
+}
+
+void CVobSubFile::Close()
+{
+ InitSettings();
+ m_title.Empty();
+ m_sub.SetLength(0);
+ m_img.Invalidate();
+ m_iLang = -1;
+ for(int i = 0; i < 32; i++)
+ {
+ m_langs[i].id = 0;
+ m_langs[i].name.Empty();
+ m_langs[i].alt.Empty();
+ m_langs[i].subpos.RemoveAll();
+ }
+}
+
+//
+
+bool CVobSubFile::ReadIdx(CString fn, int& ver)
+{
+ CWebTextFile f;
+ if(!f.Open(fn))
+ return(false);
+
+ bool fError = false;
+
+ int id = -1, delay = 0, vobid = -1, cellid = -1;
+ __int64 celltimestamp = 0;
+
+ CString str;
+ for(int line = 0; !fError && f.ReadString(str); line++)
+ {
+ str.Trim();
+
+ if(line == 0)
+ {
+ TCHAR buff[] = _T("VobSub index file, v");
+
+ const TCHAR* s = str;
+
+ int i = str.Find(buff);
+ if(i < 0 || _stscanf(&s[i+_tcslen(buff)], _T("%d"), &ver) != 1
+ || ver > VOBSUBIDXVER)
+ {
+ AfxMessageBox(_T("Wrong file version!"));
+ fError = true;
+ continue;
+ }
+ }
+ else if(!str.GetLength())
+ {
+ continue;
+ }
+ else if(str[0] == _T('#'))
+ {
+ TCHAR buff[] = _T("Vob/Cell ID:");
+
+ const TCHAR* s = str;
+
+ int i = str.Find(buff);
+ if(i >= 0)
+ {
+ _stscanf(&s[i+_tcslen(buff)], _T("%d, %d (PTS: %d)"), &vobid, &cellid, &celltimestamp);
+ }
+
+ continue;
+ }
+
+ int i = str.Find(':');
+ if(i <= 0) continue;
+
+ CString entry = str.Left(i).MakeLower();
+
+ str = str.Mid(i+1);
+ str.Trim();
+ if(str.IsEmpty()) continue;
+
+ if(entry == _T("size"))
+ {
+ int x, y;
+ if(_stscanf(str, _T("%dx%d"), &x, &y) != 2) fError = true;
+ m_size.cx = x;
+ m_size.cy = y;
+ }
+ else if(entry == _T("org"))
+ {
+ if(_stscanf(str, _T("%d,%d"), &m_x, &m_y) != 2) fError = true;
+ else m_org = CPoint(m_x, m_y);
+ }
+ else if(entry == _T("scale"))
+ {
+ if(ver < 5)
+ {
+ int scale = 100;
+ if(_stscanf(str, _T("%d%%"), &scale) != 1) fError = true;
+ m_scale_x = m_scale_y = scale;
+ }
+ else
+ {
+ if(_stscanf(str, _T("%d%%,%d%%"), &m_scale_x, &m_scale_y) != 2) fError = true;
+ }
+ }
+ else if(entry == _T("alpha"))
+ {
+ if(_stscanf(str, _T("%d"), &m_alpha) != 1) fError = true;
+ }
+ else if(entry == _T("smooth"))
+ {
+ str.MakeLower();
+
+ if(str.Find(_T("old")) >= 0 || str.Find(_T("2")) >= 0) m_fSmooth = 2;
+ else if(str.Find(_T("on")) >= 0 || str.Find(_T("1")) >= 0) m_fSmooth = 1;
+ else if(str.Find(_T("off")) >= 0 || str.Find(_T("0")) >= 0) m_fSmooth = 0;
+ else fError = true;
+ }
+ else if(entry == _T("fadein/out"))
+ {
+ if(_stscanf(str, _T("%d,%d"), &m_fadein, &m_fadeout) != 2) fError = true;
+ }
+ else if(entry == _T("align"))
+ {
+ str.MakeLower();
+
+ int i = 0, j = 0;
+ for(CString token = str.Tokenize(_T(" "), i);
+ j < 3 && !fError && !token.IsEmpty();
+ token = str.Tokenize(_T(" "), i), j++)
+ {
+ if(j == 0)
+ {
+ if(token == _T("on") || token == _T("1")) m_fAlign = true;
+ else if(token == _T("off") || token == _T("0")) m_fAlign = false;
+ else fError = true;
+ }
+ else if(j == 1)
+ {
+ if(token == _T("at")) {j--; continue;}
+
+ if(token == _T("left")) m_alignhor = 0;
+ else if(token == _T("center")) m_alignhor = 1;
+ else if(token == _T("right")) m_alignhor = 2;
+ else fError = true;
+ }
+ else if(j == 2)
+ {
+ if(token == _T("top")) m_alignver = 0;
+ else if(token == _T("center")) m_alignver = 1;
+ else if(token == _T("bottom")) m_alignver = 2;
+ else fError = true;
+ }
+ }
+ }
+ else if(entry == _T("time offset"))
+ {
+ bool fNegative = false;
+ if(str[0] == '-') fNegative = true;
+ str.TrimLeft(_T("+-"));
+
+ TCHAR c;
+ int hh, mm, ss, ms;
+ int n = _stscanf(str, _T("%d%c%d%c%d%c%d"), &hh, &c, &mm, &c, &ss, &c, &ms);
+
+ m_toff = n == 1
+ ? hh * (fNegative ? -1 : 1)
+ : n == 4+3
+ ? (hh*60*60*1000 + mm*60*1000 + ss*1000 + ms) * (fNegative ? -1 : 1)
+ : fError = true, 0;
+ }
+ else if(entry == _T("forced subs"))
+ {
+ str.MakeLower();
+
+ if(str.Find(_T("on")) >= 0 || str.Find(_T("1")) >= 0) m_fOnlyShowForcedSubs = true;
+ else if(str.Find(_T("off")) >= 0 || str.Find(_T("0")) >= 0) m_fOnlyShowForcedSubs = false;
+ else fError = true;
+ }
+ else if(entry == _T("langidx"))
+ {
+ if(_stscanf(str, _T("%d"), &m_iLang) != 1) fError = true;
+ }
+ else if(entry == _T("palette"))
+ {
+ if(_stscanf(str, _T("%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x"),
+ &m_orgpal[0], &m_orgpal[1], &m_orgpal[2], &m_orgpal[3],
+ &m_orgpal[4], &m_orgpal[5], &m_orgpal[6], &m_orgpal[7],
+ &m_orgpal[8], &m_orgpal[9], &m_orgpal[10], &m_orgpal[11],
+ &m_orgpal[12], &m_orgpal[13], &m_orgpal[14], &m_orgpal[15]
+ ) != 16) fError = true;
+ }
+ else if(entry == _T("custom colors"))
+ {
+ str.MakeLower();
+
+ if(str.Find(_T("on")) == 0 || str.Find(_T("1")) == 0) m_fCustomPal = true;
+ else if(str.Find(_T("off")) == 0 || str.Find(_T("0")) == 0) m_fCustomPal = false;
+ else fError = true;
+
+ i = str.Find(_T("tridx:"));
+ if(i < 0) {fError = true; continue;}
+ str = str.Mid(i + (int)_tcslen(_T("tridx:")));
+
+ int tridx;
+ if(_stscanf(str, _T("%x"), &tridx) != 1) {fError = true; continue;}
+ tridx = ((tridx&0x1000)>>12) | ((tridx&0x100)>>7) | ((tridx&0x10)>>2) | ((tridx&1)<<3);
+
+ i = str.Find(_T("colors:"));
+ if(i < 0) {fError = true; continue;}
+ str = str.Mid(i + (int)_tcslen(_T("colors:")));
+
+ RGBQUAD pal[4];
+ if(_stscanf(str, _T("%x,%x,%x,%x"), &pal[0], &pal[1], &pal[2], &pal[3]) != 4) {fError = true; continue;}
+
+ SetCustomPal(pal, tridx);
+ }
+ else if(entry == _T("id"))
+ {
+ str.MakeLower();
+
+ int langid = ((str[0]&0xff)<<8)|(str[1]&0xff);
+
+ i = str.Find(_T("index:"));
+ if(i < 0) {fError = true; continue;}
+ str = str.Mid(i + (int)_tcslen(_T("index:")));
+
+ if(_stscanf(str, _T("%d"), &id) != 1 || id < 0 || id >= 32) {fError = true; continue;}
+
+ m_langs[id].id = langid;
+ m_langs[id].name = lang_tbl[find_lang(langid)].lang_long;
+ m_langs[id].alt = lang_tbl[find_lang(langid)].lang_long;
+
+ delay = 0;
+ }
+ else if(id >= 0 && entry == _T("alt"))
+ {
+ m_langs[id].alt = str;
+ }
+ else if(id >= 0 && entry == _T("delay"))
+ {
+ bool fNegative = false;
+ if(str[0] == '-') fNegative = true;
+ str.TrimLeft(_T("+-"));
+
+ TCHAR c;
+ int hh, mm, ss, ms;
+ if(_stscanf(str, _T("%d%c%d%c%d%c%d"), &hh, &c, &mm, &c, &ss, &c, &ms) != 4+3) {fError = true; continue;}
+
+ delay += (hh*60*60*1000 + mm*60*1000 + ss*1000 + ms) * (fNegative ? -1 : 1);
+ }
+ else if(id >= 0 && entry == _T("timestamp"))
+ {
+ SubPos sb;
+
+ sb.vobid = vobid;
+ sb.cellid = cellid;
+ sb.celltimestamp = celltimestamp;
+ sb.fValid = true;
+
+ bool fNegative = false;
+ if(str[0] == '-') fNegative = true;
+ str.TrimLeft(_T("+-"));
+
+ TCHAR c;
+ int hh, mm, ss, ms;
+ if(_stscanf(str, _T("%d%c%d%c%d%c%d"), &hh, &c, &mm, &c, &ss, &c, &ms) != 4+3) {fError = true; continue;}
+
+ sb.start = (hh*60*60*1000 + mm*60*1000 + ss*1000 + ms) * (fNegative ? -1 : 1) + delay;
+
+ i = str.Find(_T("filepos:"));
+ if(i < 0) {fError = true; continue;}
+ str = str.Mid(i + (int)_tcslen(_T("filepos:")));
+
+ if(_stscanf(str, _T("%I64x"), &sb.filepos) != 1) {fError = true; continue;}
+
+ if(delay < 0 && m_langs[id].subpos.GetCount() > 0)
+ {
+ __int64 ts = m_langs[id].subpos[m_langs[id].subpos.GetCount()-1].start;
+
+ if(sb.start < ts)
+ {
+ delay += (int)(ts - sb.start);
+ sb.start = ts;
+ }
+ }
+
+ m_langs[id].subpos.Add(sb);
+ }
+ else fError = true;
+ }
+
+ return(!fError);
+}
+
+bool CVobSubFile::ReadSub(CString fn)
+{
+ CFile f;
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ return(false);
+
+ m_sub.SetLength(f.GetLength());
+ m_sub.SeekToBegin();
+
+ int len;
+ BYTE buff[2048];
+ while((len = f.Read(buff, sizeof(buff))) > 0 && *(DWORD*)buff == 0xba010000)
+ m_sub.Write(buff, len);
+
+ return(true);
+}
+
+static unsigned char* RARbuff = NULL;
+static unsigned int RARpos = 0;
+
+static int PASCAL MyProcessDataProc(unsigned char* Addr, int Size)
+{
+ ASSERT(RARbuff);
+
+ memcpy(&RARbuff[RARpos], Addr, Size);
+ RARpos += Size;
+
+ return(1);
+}
+
+bool CVobSubFile::ReadRar(CString fn)
+{
+ HMODULE h = LoadLibrary(_T("unrar.dll"));
+ if(!h) return(false);
+
+ RAROpenArchiveEx OpenArchiveEx = (RAROpenArchiveEx)GetProcAddress(h, "RAROpenArchiveEx");
+ RARCloseArchive CloseArchive = (RARCloseArchive)GetProcAddress(h, "RARCloseArchive");
+ RARReadHeaderEx ReadHeaderEx = (RARReadHeaderEx)GetProcAddress(h, "RARReadHeaderEx");
+ RARProcessFile ProcessFile = (RARProcessFile)GetProcAddress(h, "RARProcessFile");
+ RARSetChangeVolProc SetChangeVolProc = (RARSetChangeVolProc)GetProcAddress(h, "RARSetChangeVolProc");
+ RARSetProcessDataProc SetProcessDataProc = (RARSetProcessDataProc)GetProcAddress(h, "RARSetProcessDataProc");
+ RARSetPassword SetPassword = (RARSetPassword)GetProcAddress(h, "RARSetPassword");
+
+ if(!(OpenArchiveEx && CloseArchive && ReadHeaderEx && ProcessFile
+ && SetChangeVolProc && SetProcessDataProc && SetPassword))
+ {
+ FreeLibrary(h);
+ return(false);
+ }
+
+ struct RAROpenArchiveDataEx ArchiveDataEx;
+ memset(&ArchiveDataEx, 0, sizeof(ArchiveDataEx));
+#ifdef UNICODE
+ ArchiveDataEx.ArcNameW = (LPTSTR)(LPCTSTR)fn;
+ char fnA[MAX_PATH];
+ if(wcstombs(fnA, fn, fn.GetLength()+1) == -1) fnA[0] = 0;
+ ArchiveDataEx.ArcName = fnA;
+#else
+ ArchiveDataEx.ArcName = (LPTSTR)(LPCTSTR)fn;
+#endif
+ ArchiveDataEx.OpenMode = RAR_OM_EXTRACT;
+ ArchiveDataEx.CmtBuf = 0;
+ HANDLE hrar = OpenArchiveEx(&ArchiveDataEx);
+ if(!hrar)
+ {
+ FreeLibrary(h);
+ return(false);
+ }
+
+ SetProcessDataProc(hrar, MyProcessDataProc);
+
+ struct RARHeaderDataEx HeaderDataEx;
+ HeaderDataEx.CmtBuf = NULL;
+
+ while(ReadHeaderEx(hrar, &HeaderDataEx) == 0)
+ {
+#ifdef UNICODE
+ CString subfn(HeaderDataEx.FileNameW);
+#else
+ CString subfn(HeaderDataEx.FileName);
+#endif
+
+ if(!subfn.Right(4).CompareNoCase(_T(".sub")))
+ {
+ CAutoVectorPtr<BYTE> buff;
+ if(!buff.Allocate(HeaderDataEx.UnpSize))
+ {
+ CloseArchive(hrar);
+ FreeLibrary(h);
+ return(false);
+ }
+
+ RARbuff = buff;
+ RARpos = 0;
+
+ if(ProcessFile(hrar, RAR_TEST, NULL, NULL))
+ {
+ CloseArchive(hrar);
+ FreeLibrary(h);
+
+ return(false);
+ }
+
+ m_sub.SetLength(HeaderDataEx.UnpSize);
+ m_sub.SeekToBegin();
+ m_sub.Write(buff, HeaderDataEx.UnpSize);
+ m_sub.SeekToBegin();
+
+ RARbuff = NULL;
+ RARpos = 0;
+
+ break;
+ }
+
+ ProcessFile(hrar, RAR_SKIP, NULL, NULL);
+ }
+
+ CloseArchive(hrar);
+ FreeLibrary(h);
+
+ return(true);
+}
+
+#define ReadBEdw(var) \
+ f.Read(&((BYTE*)&var)[3], 1); \
+ f.Read(&((BYTE*)&var)[2], 1); \
+ f.Read(&((BYTE*)&var)[1], 1); \
+ f.Read(&((BYTE*)&var)[0], 1); \
+
+bool CVobSubFile::ReadIfo(CString fn)
+{
+ CFile f;
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ return(false);
+
+ /* PGC1 */
+
+ f.Seek(0xc0+0x0c, SEEK_SET);
+
+ DWORD pos;
+ ReadBEdw(pos);
+
+ f.Seek(pos*0x800 + 0x0c, CFile::begin);
+
+ DWORD offset;
+ ReadBEdw(offset);
+
+ /* Subpic palette */
+
+ f.Seek(pos*0x800 + offset + 0xa4, CFile::begin);
+
+ for(int i = 0; i < 16; i++)
+ {
+ BYTE y, u, v, tmp;
+
+ f.Read(&tmp, 1);
+ f.Read(&y, 1);
+ f.Read(&u, 1);
+ f.Read(&v, 1);
+
+ y = (y-16)*255/219;
+
+ m_orgpal[i].rgbRed = (BYTE)min(max(1.0*y + 1.4022*(u-128), 0), 255);
+ m_orgpal[i].rgbGreen = (BYTE)min(max(1.0*y - 0.3456*(u-128) - 0.7145*(v-128), 0), 255);
+ m_orgpal[i].rgbBlue = (BYTE)min(max(1.0*y + 1.7710*(v-128), 0) , 255);
+ }
+
+ return(true);
+}
+
+bool CVobSubFile::WriteIdx(CString fn)
+{
+ CTextFile f;
+ if(!f.Save(fn, CTextFile::ASCII))
+ return(false);
+
+ CString str;
+ str.Format(_T("# VobSub index file, v%d (do not modify this line!)\n"), VOBSUBIDXVER);
+
+ f.WriteString(str);
+ f.WriteString(_T("# \n"));
+ f.WriteString(_T("# To repair desyncronization, you can insert gaps this way:\n"));
+ f.WriteString(_T("# (it usually happens after vob id changes)\n"));
+ f.WriteString(_T("# \n"));
+ f.WriteString(_T("#\t delay: [sign]hh:mm:ss:ms\n"));
+ f.WriteString(_T("# \n"));
+ f.WriteString(_T("# Where:\n"));
+ f.WriteString(_T("#\t [sign]: +, - (optional)\n"));
+ f.WriteString(_T("#\t hh: hours (0 <= hh)\n"));
+ f.WriteString(_T("#\t mm/ss: minutes/seconds (0 <= mm/ss <= 59)\n"));
+ f.WriteString(_T("#\t ms: milliseconds (0 <= ms <= 999)\n"));
+ f.WriteString(_T("# \n"));
+ f.WriteString(_T("#\t Note: You can't position a sub before the previous with a negative value.\n"));
+ f.WriteString(_T("# \n"));
+ f.WriteString(_T("# You can also modify timestamps or delete a few subs you don't like.\n"));
+ f.WriteString(_T("# Just make sure they stay in increasing order.\n"));
+ f.WriteString(_T("\n"));
+ f.WriteString(_T("\n"));
+
+ // Settings
+
+ f.WriteString(_T("# Settings\n\n"));
+
+ f.WriteString(_T("# Original frame size\n"));
+ str.Format(_T("size: %dx%d\n\n"), m_size.cx, m_size.cy);
+ f.WriteString(str);
+
+ f.WriteString(_T("# Origin, relative to the upper-left corner, can be overloaded by aligment\n"));
+ str.Format(_T("org: %d, %d\n\n"), m_x, m_y);
+ f.WriteString(str);
+
+ f.WriteString(_T("# Image scaling (hor,ver), origin is at the upper-left corner or at the alignment coord (x, y)\n"));
+ str.Format(_T("scale: %d%%, %d%%\n\n"), m_scale_x, m_scale_y);
+ f.WriteString(str);
+
+ f.WriteString(_T("# Alpha blending\n"));
+ str.Format(_T("alpha: %d%%\n\n"), m_alpha);
+ f.WriteString(str);
+
+ f.WriteString(_T("# Smoothing for very blocky images (use OLD for no filtering)\n"));
+ str.Format(_T("smooth: %s\n\n"), m_fSmooth == 0 ? _T("OFF") : m_fSmooth == 1 ? _T("ON") : _T("OLD"));
+ f.WriteString(str);
+
+ f.WriteString(_T("# In millisecs\n"));
+ str.Format(_T("fadein/out: %d, %d\n\n"), m_fadein, m_fadeout);
+ f.WriteString(str);
+
+ f.WriteString(_T("# Force subtitle placement relative to (org.x, org.y)\n"));
+ str.Format(_T("align: %s %s %s\n\n"),
+ m_fAlign ? _T("ON at") : _T("OFF at"),
+ m_alignhor == 0 ? _T("LEFT") : m_alignhor == 1 ? _T("CENTER") : m_alignhor == 2 ? _T("RIGHT") : _T(""),
+ m_alignver == 0 ? _T("TOP") : m_alignver == 1 ? _T("CENTER") : m_alignver == 2 ? _T("BOTTOM") : _T(""));
+ f.WriteString(str);
+
+ f.WriteString(_T("# For correcting non-progressive desync. (in millisecs or hh:mm:ss:ms)\n"));
+ f.WriteString(_T("# Note: Not effective in DirectVobSub, use \"delay: ... \" instead.\n"));
+ str.Format(_T("time offset: %d\n\n"), m_toff);
+ f.WriteString(str);
+
+ f.WriteString(_T("# ON: displays only forced subtitles, OFF: shows everything\n"));
+ str.Format(_T("forced subs: %s\n\n"), m_fOnlyShowForcedSubs ? _T("ON") : _T("OFF"));
+ f.WriteString(str);
+
+ f.WriteString(_T("# The original palette of the DVD\n"));
+ str.Format(_T("palette: %06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x, %06x\n\n"),
+ *((unsigned int*)&m_orgpal[0])&0xffffff,
+ *((unsigned int*)&m_orgpal[1])&0xffffff,
+ *((unsigned int*)&m_orgpal[2])&0xffffff,
+ *((unsigned int*)&m_orgpal[3])&0xffffff,
+ *((unsigned int*)&m_orgpal[4])&0xffffff,
+ *((unsigned int*)&m_orgpal[5])&0xffffff,
+ *((unsigned int*)&m_orgpal[6])&0xffffff,
+ *((unsigned int*)&m_orgpal[7])&0xffffff,
+ *((unsigned int*)&m_orgpal[8])&0xffffff,
+ *((unsigned int*)&m_orgpal[9])&0xffffff,
+ *((unsigned int*)&m_orgpal[10])&0xffffff,
+ *((unsigned int*)&m_orgpal[11])&0xffffff,
+ *((unsigned int*)&m_orgpal[12])&0xffffff,
+ *((unsigned int*)&m_orgpal[13])&0xffffff,
+ *((unsigned int*)&m_orgpal[14])&0xffffff,
+ *((unsigned int*)&m_orgpal[15])&0xffffff);
+ f.WriteString(str);
+
+ int tridx = (!!(m_tridx&1))*0x1000 + (!!(m_tridx&2))*0x100 + (!!(m_tridx&4))*0x10 + (!!(m_tridx&8));
+
+ f.WriteString(_T("# Custom colors (transp idxs and the four colors)\n"));
+ str.Format(_T("custom colors: %s, tridx: %04x, colors: %06x, %06x, %06x, %06x\n\n"),
+ m_fCustomPal ? _T("ON") : _T("OFF"),
+ tridx,
+ *((unsigned int*)&m_cuspal[0])&0xffffff,
+ *((unsigned int*)&m_cuspal[1])&0xffffff,
+ *((unsigned int*)&m_cuspal[2])&0xffffff,
+ *((unsigned int*)&m_cuspal[3])&0xffffff);
+ f.WriteString(str);
+
+ f.WriteString(_T("# Language index in use\n"));
+ str.Format(_T("langidx: %d\n\n"), m_iLang);
+ f.WriteString(str);
+
+ // Subs
+
+ for(int i = 0; i < 32; i++)
+ {
+ SubLang& sl = m_langs[i];
+
+ CAtlArray<SubPos>& sp = sl.subpos;
+ if(sp.IsEmpty() && !sl.id) continue;
+
+ str.Format(_T("# %s\n"), sl.name);
+ f.WriteString(str);
+
+ ASSERT(sl.id);
+ if(!sl.id) sl.id = '--';
+ str.Format(_T("id: %c%c, index: %d\n"), sl.id>>8, sl.id&0xff, i);
+ f.WriteString(str);
+
+ str.Format(_T("# Decomment next line to activate alternative name in DirectVobSub / Windows Media Player 6.x\n"));
+ f.WriteString(str);
+ str.Format(_T("alt: %s\n"), sl.alt);
+ if(sl.name == sl.alt) str = _T("# ") + str;
+ f.WriteString(str);
+
+ char vobid = -1, cellid = -1;
+
+ for(int j = 0; j < sp.GetCount(); j++)
+ {
+ if(!sp[j].fValid) continue;
+
+ if(sp[j].vobid != vobid || sp[j].cellid != cellid)
+ {
+ str.Format(_T("# Vob/Cell ID: %d, %d (PTS: %d)\n"), sp[j].vobid, sp[j].cellid, sp[j].celltimestamp);
+ f.WriteString(str);
+ vobid = sp[j].vobid;
+ cellid = sp[j].cellid;
+ }
+
+ str.Format(_T("timestamp: %s%02d:%02d:%02d:%03d, filepos: %09I64x\n"),
+ sp[j].start < 0 ? _T("-") : _T(""),
+ abs(int((sp[j].start/1000/60/60)%60)),
+ abs(int((sp[j].start/1000/60)%60)),
+ abs(int((sp[j].start/1000)%60)),
+ abs(int((sp[j].start)%1000)),
+ sp[j].filepos);
+ f.WriteString(str);
+ }
+
+ f.WriteString(_T("\n"));
+ }
+
+ return(true);
+}
+
+bool CVobSubFile::WriteSub(CString fn)
+{
+ CFile f;
+ if(!f.Open(fn, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary|CFile::shareDenyWrite))
+ return(false);
+
+ if(m_sub.GetLength() == 0)
+ return(true); // nothing to do...
+
+ m_sub.SeekToBegin();
+
+ int len;
+ BYTE buff[2048];
+ while((len = m_sub.Read(buff, sizeof(buff))) > 0 && *(DWORD*)buff == 0xba010000)
+ f.Write(buff, len);
+
+ return(true);
+}
+
+//
+
+BYTE* CVobSubFile::GetPacket(int idx, int& packetsize, int& datasize, int iLang)
+{
+ BYTE* ret = NULL;
+
+ if(iLang < 0 || iLang >= 32) iLang = m_iLang;
+ CAtlArray<SubPos>& sp = m_langs[iLang].subpos;
+
+ do
+ {
+ if(idx < 0 || idx >= sp.GetCount())
+ break;
+
+ if(m_sub.Seek(sp[idx].filepos, CFile::begin) != sp[idx].filepos)
+ break;
+
+ BYTE buff[0x800];
+ if(sizeof(buff) != m_sub.Read(buff, sizeof(buff)))
+ break;
+
+ BYTE offset = buff[0x16];
+
+ // let's check a few things to make sure...
+ if(*(DWORD*)&buff[0x00] != 0xba010000
+ || *(DWORD*)&buff[0x0e] != 0xbd010000
+ || !(buff[0x15] & 0x80)
+ || (buff[0x17] & 0xf0) != 0x20
+ || (buff[buff[0x16] + 0x17] & 0xe0) != 0x20
+ || (buff[buff[0x16] + 0x17] & 0x1f) != iLang)
+ break;
+
+ packetsize = (buff[buff[0x16] + 0x18] << 8) + buff[buff[0x16] + 0x19];
+ datasize = (buff[buff[0x16] + 0x1a] << 8) + buff[buff[0x16] + 0x1b];
+
+ ret = new BYTE[packetsize];
+ if(!ret) break;
+
+ int i = 0, sizeleft = packetsize;
+ for(int size;
+ i < packetsize;
+ i += size, sizeleft -= size)
+ {
+ int hsize = 0x18 + buff[0x16];
+ size = min(sizeleft, 0x800 - hsize);
+ memcpy(&ret[i], &buff[hsize], size);
+
+ if(size != sizeleft)
+ {
+ while(m_sub.Read(buff, sizeof(buff)))
+ {
+ if(/*!(buff[0x15] & 0x80) &&*/ buff[buff[0x16] + 0x17] == (iLang|0x20))
+ break;
+ }
+ }
+ }
+
+ if(i != packetsize || sizeleft > 0)
+ delete [] ret, ret = NULL;
+ }
+ while(false);
+
+ return(ret);
+}
+
+bool CVobSubFile::GetFrame(int idx, int iLang)
+{
+ if(iLang < 0 || iLang >= 32) iLang = m_iLang;
+ CAtlArray<SubPos>& sp = m_langs[iLang].subpos;
+
+ if(idx < 0 || idx >= sp.GetCount())
+ return(false);
+
+ if(m_img.iLang != iLang || m_img.iIdx != idx)
+ {
+ int packetsize = 0, datasize = 0;
+ CAutoVectorPtr<BYTE> buff;
+ buff.Attach(GetPacket(idx, packetsize, datasize, iLang));
+ if(!buff || packetsize <= 0 || datasize <= 0) return(false);
+
+ m_img.start = sp[idx].start;
+ m_img.delay = idx < (sp.GetCount()-1)
+ ? sp[idx+1].start - sp[idx].start
+ : 3000;
+
+ bool ret = m_img.Decode(buff, packetsize, datasize, m_fCustomPal, m_tridx, m_orgpal, m_cuspal, true);
+
+ if(idx < (sp.GetCount()-1))
+ m_img.delay = min(m_img.delay, sp[idx+1].start - m_img.start);
+
+ if(!ret) return(false);
+
+ m_img.iIdx = idx;
+ m_img.iLang = iLang;
+ }
+
+ return(m_fOnlyShowForcedSubs ? m_img.fForced : true);
+}
+
+bool CVobSubFile::GetFrameByTimeStamp(__int64 time)
+{
+ return(GetFrame(GetFrameIdxByTimeStamp(time)));
+}
+
+int CVobSubFile::GetFrameIdxByTimeStamp(__int64 time)
+{
+ if(m_iLang < 0 || m_iLang >= 32)
+ return(-1);
+
+ CAtlArray<SubPos>& sp = m_langs[m_iLang].subpos;
+
+ int i = 0, j = (int)sp.GetCount() - 1, ret = -1;
+
+ if(j >= 0 && time >= sp[j].start)
+ return(j);
+
+ while(i < j)
+ {
+ int mid = (i + j) >> 1;
+ int midstart = (int)sp[mid].start;
+
+ if(time == midstart) {ret = mid; break;}
+ else if(time < midstart) {ret = -1; if(j == mid) mid--; j = mid;}
+ else if(time > midstart) {ret = mid; if(i == mid) mid++; i = mid;}
+ }
+
+ return(ret);
+}
+
+//
+
+STDMETHODIMP CVobSubFile::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+ *ppv = NULL;
+
+ return
+ QI(IPersist)
+ QI(ISubStream)
+ QI(ISubPicProvider)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ISubPicProvider
+
+// TODO: return segments for the fade-in/out time (with animated set to "true" of course)
+
+STDMETHODIMP_(POSITION) CVobSubFile::GetStartPosition(REFERENCE_TIME rt, double fps)
+{
+ rt /= 10000;
+
+ int i = GetFrameIdxByTimeStamp(rt);
+
+ if(!GetFrame(i))
+ return(NULL);
+
+ if(rt >= (m_img.start + m_img.delay))
+ {
+ if(!GetFrame(++i))
+ return(NULL);
+ }
+
+ return((POSITION)(i+1));
+}
+
+STDMETHODIMP_(POSITION) CVobSubFile::GetNext(POSITION pos)
+{
+ int i = (int)pos;
+ return(GetFrame(i) ? (POSITION)(i+1) : NULL);
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CVobSubFile::GetStart(POSITION pos, double fps)
+{
+ int i = (int)pos-1;
+ return(GetFrame(i) ? 10000i64*m_img.start : 0);
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CVobSubFile::GetStop(POSITION pos, double fps)
+{
+ int i = (int)pos-1;
+ return(GetFrame(i) ? 10000i64*(m_img.start + m_img.delay) : 0);
+}
+
+STDMETHODIMP_(bool) CVobSubFile::IsAnimated(POSITION pos)
+{
+ return(false);
+}
+
+STDMETHODIMP CVobSubFile::Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox)
+{
+ if(spd.bpp != 32) return E_INVALIDARG;
+
+ rt /= 10000;
+
+ if(!GetFrame(GetFrameIdxByTimeStamp(rt)))
+ return E_FAIL;
+
+ if(rt >= (m_img.start + m_img.delay))
+ return E_FAIL;
+
+ return __super::Render(spd, bbox);
+}
+
+// IPersist
+
+STDMETHODIMP CVobSubFile::GetClassID(CLSID* pClassID)
+{
+ return pClassID ? *pClassID = __uuidof(this), S_OK : E_POINTER;
+}
+
+// ISubStream
+
+STDMETHODIMP_(int) CVobSubFile::GetStreamCount()
+{
+ int iStreamCount = 0;
+ for(int i = 0; i < 32; i++)
+ if(m_langs[i].subpos.GetCount()) iStreamCount++;
+ return(iStreamCount);
+}
+
+STDMETHODIMP CVobSubFile::GetStreamInfo(int iStream, WCHAR** ppName, LCID* pLCID)
+{
+ for(int i = 0; i < 32; i++)
+ {
+ SubLang& sl = m_langs[i];
+
+ if(sl.subpos.IsEmpty() || iStream-- > 0)
+ continue;
+
+ if(ppName)
+ {
+ if(!(*ppName = (WCHAR*)CoTaskMemAlloc((sl.alt.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+
+ wcscpy(*ppName, CStringW(sl.alt));
+ }
+
+ if(pLCID)
+ {
+ *pLCID = 0; // TODO: make lcid out of "sl.id"
+ }
+
+ return S_OK;
+ }
+
+ return E_FAIL;
+}
+
+STDMETHODIMP_(int) CVobSubFile::GetStream()
+{
+ int iStream = 0;
+
+ for(int i = 0; i < m_iLang; i++)
+ if(!m_langs[i].subpos.IsEmpty()) iStream++;
+
+ return(iStream);
+}
+
+STDMETHODIMP CVobSubFile::SetStream(int iStream)
+{
+ for(int i = 0; i < 32; i++)
+ {
+ CAtlArray<SubPos>& sp = m_langs[i].subpos;
+
+ if(sp.IsEmpty() || iStream-- > 0)
+ continue;
+
+ m_iLang = i;
+
+ m_img.Invalidate();
+
+ break;
+ }
+
+ return iStream < 0 ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CVobSubFile::Reload()
+{
+ CFileStatus s;
+ if(!CFile::GetStatus(m_title + _T(".idx"), s)) return E_FAIL;
+ return !m_title.IsEmpty() && Open(m_title) ? S_OK : E_FAIL;
+}
+
+// StretchBlt
+
+static void PixelAtBiLinear(RGBQUAD& c, int x, int y, CVobSubImage& src)
+{
+ int w = src.rect.Width(),
+ h = src.rect.Height();
+
+ int x1 = (x >> 16), y1 = (y >> 16) * w,
+ x2 = min(x1 + 1, w-1), y2 = min(y1 + w, (h-1)*w);
+
+ RGBQUAD* ptr = src.lpPixels;
+
+ RGBQUAD c11 = ptr[y1 + x1], c12 = ptr[y1 + x2],
+ c21 = ptr[y2 + x1], c22 = ptr[y2 + x2];
+
+ __int64 u2 = x & 0xffff,
+ v2 = y & 0xffff,
+ u1 = 0x10000 - u2,
+ v1 = 0x10000 - v2;
+
+ int v1u1 = int(v1*u1 >> 16) * c11.rgbReserved,
+ v1u2 = int(v1*u2 >> 16) * c12.rgbReserved,
+ v2u1 = int(v2*u1 >> 16) * c21.rgbReserved,
+ v2u2 = int(v2*u2 >> 16) * c22.rgbReserved;
+
+ c.rgbRed = (c11.rgbRed * v1u1 + c12.rgbRed * v1u2
+ + c21.rgbRed * v2u1 + c22.rgbRed * v2u2) >> 24;
+ c.rgbGreen = (c11.rgbGreen * v1u1 + c12.rgbGreen * v1u2
+ + c21.rgbGreen * v2u1 + c22.rgbGreen * v2u2) >> 24;
+ c.rgbBlue = (c11.rgbBlue * v1u1 + c12.rgbBlue * v1u2
+ + c21.rgbBlue * v2u1 + c22.rgbBlue * v2u2) >> 24;
+ c.rgbReserved = (v1u1 + v1u2
+ + v2u1 + v2u2) >> 16;
+}
+
+static void StretchBlt(SubPicDesc& spd, CRect dstrect, CVobSubImage& src)
+{
+ if(dstrect.IsRectEmpty()) return;
+
+ if((dstrect & CRect(0, 0, spd.w, spd.h)).IsRectEmpty()) return;
+
+ int sw = src.rect.Width(),
+ sh = src.rect.Height(),
+ dw = dstrect.Width(),
+ dh = dstrect.Height();
+
+ int srcx = 0,
+ srcy = 0,
+ srcdx = (sw << 16) / dw >> 1,
+ srcdy = (sh << 16) / dh >> 1;
+
+ if(dstrect.left < 0) {srcx = -dstrect.left * (srcdx<<1); dstrect.left = 0;}
+ if(dstrect.top < 0) {srcy = -dstrect.top * (srcdy<<1); dstrect.top = 0;}
+ if(dstrect.right > spd.w) {dstrect.right = spd.w;}
+ if(dstrect.bottom > spd.h) {dstrect.bottom = spd.h;}
+
+ if((dstrect & CRect(0, 0, spd.w, spd.h)).IsRectEmpty()) return;
+
+ dw = dstrect.Width();
+ dh = dstrect.Height();
+
+ for(int y = dstrect.top; y < dstrect.bottom; y++, srcy += (srcdy<<1))
+ {
+ RGBQUAD* ptr = (RGBQUAD*)&((BYTE*)spd.bits)[y*spd.pitch] + dstrect.left;
+ RGBQUAD* endptr = ptr + dw;
+
+ for(int sx = srcx; ptr < endptr; sx += (srcdx<<1), ptr++)
+ {
+// PixelAtBiLinear(*ptr, sx, srcy, src);
+////
+ RGBQUAD cc[4];
+
+ PixelAtBiLinear(cc[0], sx, srcy, src);
+ PixelAtBiLinear(cc[1], sx+srcdx, srcy, src);
+ PixelAtBiLinear(cc[2], sx, srcy+srcdy, src);
+ PixelAtBiLinear(cc[3], sx+srcdx, srcy+srcdy, src);
+
+ ptr->rgbRed = (cc[0].rgbRed + cc[1].rgbRed + cc[2].rgbRed + cc[3].rgbRed) >> 2;
+ ptr->rgbGreen = (cc[0].rgbGreen + cc[1].rgbGreen + cc[2].rgbGreen + cc[3].rgbGreen) >> 2;
+ ptr->rgbBlue = (cc[0].rgbBlue + cc[1].rgbBlue + cc[2].rgbBlue + cc[3].rgbBlue) >> 2;
+ ptr->rgbReserved = (cc[0].rgbReserved + cc[1].rgbReserved + cc[2].rgbReserved + cc[3].rgbReserved) >> 2;
+////
+ ptr->rgbRed = ptr->rgbRed * ptr->rgbReserved >> 8;
+ ptr->rgbGreen = ptr->rgbGreen * ptr->rgbReserved >> 8;
+ ptr->rgbBlue = ptr->rgbBlue * ptr->rgbReserved >> 8;
+ ptr->rgbReserved = ~ptr->rgbReserved;
+
+ }
+ }
+}
+
+//
+// CVobSubSettings
+//
+
+void CVobSubSettings::InitSettings()
+{
+ m_size.SetSize(720, 480);
+ m_toff = m_x = m_y = 0;
+ m_org.SetPoint(0, 0);
+ m_scale_x = m_scale_y = m_alpha = 100;
+ m_fadein = m_fadeout = 50;
+ m_fSmooth = 0;
+ m_fAlign = false;
+ m_alignhor = m_alignver = 0;
+ m_fOnlyShowForcedSubs = false;
+ m_fCustomPal = false;
+ m_tridx = 0;
+ memset(m_orgpal, 0, sizeof(m_orgpal));
+ memset(m_cuspal, 0, sizeof(m_cuspal));
+}
+
+bool CVobSubSettings::GetCustomPal(RGBQUAD* cuspal, int& tridx)
+{
+ memcpy(cuspal, m_cuspal, sizeof(RGBQUAD)*4);
+ tridx = m_tridx;
+ return(m_fCustomPal);
+}
+
+void CVobSubSettings::SetCustomPal(RGBQUAD* cuspal, int tridx)
+{
+ memcpy(m_cuspal, cuspal, sizeof(RGBQUAD)*4);
+ m_tridx = tridx & 0xf;
+ for(int i = 0; i < 4; i++) m_cuspal[i].rgbReserved = (tridx&(1<<i)) ? 0 : 0xff;
+ m_img.Invalidate();
+}
+
+void CVobSubSettings::GetDestrect(CRect& r)
+{
+ int w = MulDiv(m_img.rect.Width(), m_scale_x, 100);
+ int h = MulDiv(m_img.rect.Height(), m_scale_y, 100);
+
+ if(!m_fAlign)
+ {
+ r.left = MulDiv(m_img.rect.left, m_scale_x, 100);
+ r.right = MulDiv(m_img.rect.right, m_scale_x, 100);
+ r.top = MulDiv(m_img.rect.top, m_scale_y, 100);
+ r.bottom = MulDiv(m_img.rect.bottom, m_scale_y, 100);
+ }
+ else
+ {
+ switch(m_alignhor)
+ {
+ case 0: r.left = 0; r.right = w; break; // left
+ case 1: r.left = -(w>>1); r.right = -(w>>1) + w; break; // center
+ case 2: r.left = -w; r.right = 0; break; // right
+ default:
+ r.left = MulDiv(m_img.rect.left, m_scale_x, 100);
+ r.right = MulDiv(m_img.rect.right, m_scale_x, 100);
+ break;
+ }
+
+ switch(m_alignver)
+ {
+ case 0: r.top = 0; r.bottom = h; break; // top
+ case 1: r.top = -(h>>1); r.bottom = -(h>>1) + h; break; // center
+ case 2: r.top = -h; r.bottom = 0; break; // bottom
+ default:
+ r.top = MulDiv(m_img.rect.top, m_scale_y, 100);
+ r.bottom = MulDiv(m_img.rect.bottom, m_scale_y, 100);
+ break;
+ }
+ }
+
+ r += m_org;
+}
+
+void CVobSubSettings::GetDestrect(CRect& r, int w, int h)
+{
+ GetDestrect(r);
+
+ r.left = MulDiv(r.left, w, m_size.cx);
+ r.right = MulDiv(r.right, w, m_size.cx);
+ r.top = MulDiv(r.top, h, m_size.cy);
+ r.bottom = MulDiv(r.bottom, h, m_size.cy);
+}
+
+void CVobSubSettings::SetAlignment(bool fAlign, int x, int y, int hor, int ver)
+{
+ if(m_fAlign = fAlign)
+ {
+ m_org.x = MulDiv(m_size.cx, x, 100);
+ m_org.y = MulDiv(m_size.cy, y, 100);
+ m_alignhor = min(max(hor, 0), 2);
+ m_alignver = min(max(ver, 0), 2);
+ }
+ else
+ {
+ m_org.x = m_x;
+ m_org.y = m_y;
+ }
+}
+
+#include "RTS.h"
+
+HRESULT CVobSubSettings::Render(SubPicDesc& spd, RECT& bbox)
+{
+ CRect r;
+ GetDestrect(r, spd.w, spd.h);
+ StretchBlt(spd, r, m_img);
+/*
+CRenderedTextSubtitle rts(NULL);
+rts.CreateDefaultStyle(DEFAULT_CHARSET);
+rts.m_dstScreenSize.SetSize(m_size.cx, m_size.cy);
+CStringW assstr;
+m_img.Polygonize(assstr, false);
+REFERENCE_TIME rtStart = 10000i64*m_img.start, rtStop = 10000i64*(m_img.start+m_img.delay);
+rts.Add(assstr, true, rtStart, rtStop);
+rts.Render(spd, (rtStart+rtStop)/2, 25, r);
+*/
+ r &= CRect(CPoint(0, 0), CSize(spd.w, spd.h));
+ bbox = r;
+ return !r.IsRectEmpty() ? S_OK : S_FALSE;
+}
+
+/////////////////////////////////////////////////////////
+
+static bool CompressFile(CString fn)
+{
+ if(GetVersion() < 0)
+ return(false);
+
+ BOOL b = FALSE;
+
+ HANDLE h = CreateFile(fn, GENERIC_WRITE|GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0);
+ if(h != INVALID_HANDLE_VALUE)
+ {
+ USHORT us = COMPRESSION_FORMAT_DEFAULT;
+ DWORD nBytesReturned;
+ b = DeviceIoControl(h, FSCTL_SET_COMPRESSION, (LPVOID)&us, 2, NULL, 0, (LPDWORD)&nBytesReturned, NULL);
+ CloseHandle(h);
+ }
+
+ return(!!b);
+}
+
+bool CVobSubFile::SaveVobSub(CString fn)
+{
+ return WriteIdx(fn + _T(".idx")) && WriteSub(fn + _T(".sub"));
+}
+
+bool CVobSubFile::SaveWinSubMux(CString fn)
+{
+ TrimExtension(fn);
+
+ CStdioFile f;
+ if(!f.Open(fn + _T(".sub"), CFile::modeCreate|CFile::modeWrite|CFile::typeText|CFile::shareDenyWrite))
+ return(false);
+
+ m_img.Invalidate();
+
+ CAutoVectorPtr<BYTE> p4bpp;
+ if(!p4bpp.Allocate(720*576/2))
+ return(false);
+
+ CAtlArray<SubPos>& sp = m_langs[m_iLang].subpos;
+ for(int i = 0; i < sp.GetCount(); i++)
+ {
+ if(!GetFrame(i)) continue;
+
+ int pal[4] = {0, 1, 2, 3};
+
+ for(int j = 0; j < 5; j++)
+ {
+ if(j == 4 || !m_img.pal[j].tr)
+ {
+ j &= 3;
+ memset(p4bpp, (j<<4)|j, 720*576/2);
+ pal[j] ^= pal[0], pal[0] ^= pal[j], pal[j] ^= pal[0];
+ break;
+ }
+ }
+
+ int tr[4] = {m_img.pal[pal[0]].tr, m_img.pal[pal[1]].tr, m_img.pal[pal[2]].tr, m_img.pal[pal[3]].tr};
+
+ DWORD uipal[4+12];
+
+ if(!m_fCustomPal)
+ {
+ uipal[0] = *((DWORD*)&m_img.orgpal[m_img.pal[pal[0]].pal]);
+ uipal[1] = *((DWORD*)&m_img.orgpal[m_img.pal[pal[1]].pal]);
+ uipal[2] = *((DWORD*)&m_img.orgpal[m_img.pal[pal[2]].pal]);
+ uipal[3] = *((DWORD*)&m_img.orgpal[m_img.pal[pal[3]].pal]);
+ }
+ else
+ {
+ uipal[0] = *((DWORD*)&m_img.cuspal[pal[0]]) & 0xffffff;
+ uipal[1] = *((DWORD*)&m_img.cuspal[pal[1]]) & 0xffffff;
+ uipal[2] = *((DWORD*)&m_img.cuspal[pal[2]]) & 0xffffff;
+ uipal[3] = *((DWORD*)&m_img.cuspal[pal[3]]) & 0xffffff;
+ }
+
+ CAtlMap<DWORD,BYTE> palmap;
+ palmap[uipal[0]] = 0;
+ palmap[uipal[1]] = 1;
+ palmap[uipal[2]] = 2;
+ palmap[uipal[3]] = 3;
+
+ uipal[0] = 0xff; // blue background
+
+ int w = m_img.rect.Width()-2;
+ int h = m_img.rect.Height()-2;
+ int pitch = (((w+1)>>1) + 3) & ~3;
+
+ for(int y = 0; y < h; y++)
+ {
+ DWORD* p = (DWORD*)&m_img.lpPixels[(y+1)*(w+2)+1];
+
+ for(int x = 0; x < w; x++, p++)
+ {
+ BYTE c = 0;
+
+ if(*p & 0xff000000)
+ {
+ DWORD uic = *p & 0xffffff;
+ palmap.Lookup(uic, c);
+ }
+
+ BYTE& c4bpp = p4bpp[(h-y-1)*pitch+(x>>1)];
+ c4bpp = (x&1) ? ((c4bpp&0xf0)|c) : ((c4bpp&0x0f)|(c<<4));
+ }
+ }
+
+ int t1 = m_img.start, t2 = t1 + m_img.delay /*+ (m_size.cy==480?(1000/29.97+1):(1000/25))*/;
+
+ ASSERT(t2>t1);
+
+ if(t2 <= 0) continue;
+ if(t1 < 0) t1 = 0;
+
+ CString bmpfn;
+ bmpfn.Format(_T("%s_%06d.bmp"), fn, i+1);
+
+ CString str;
+ str.Format(_T("%s\t%02d:%02d:%02d:%02d %02d:%02d:%02d:%02d\t%03d %03d %03d %03d %d %d %d %d\n"),
+ bmpfn,
+ t1/1000/60/60, (t1/1000/60)%60, (t1/1000)%60, (t1%1000)/10,
+ t2/1000/60/60, (t2/1000/60)%60, (t2/1000)%60, (t2%1000)/10,
+ m_img.rect.Width(), m_img.rect.Height(), m_img.rect.left, m_img.rect.top,
+ (tr[0]<<4)|tr[0], (tr[1]<<4)|tr[1], (tr[2]<<4)|tr[2], (tr[3]<<4)|tr[3]);
+ f.WriteString(str);
+
+ BITMAPFILEHEADER fhdr =
+ {
+ 0x4d42,
+ sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 16*sizeof(RGBQUAD) + pitch*h,
+ 0, 0,
+ sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 16*sizeof(RGBQUAD)
+ };
+
+ BITMAPINFOHEADER ihdr =
+ {
+ sizeof(BITMAPINFOHEADER),
+ w, h, 1, 4, 0,
+ 0,
+ pitch*h, 0,
+ 16, 4
+ };
+
+ CFile bmp;
+ if(bmp.Open(bmpfn, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary|CFile::shareDenyWrite))
+ {
+ bmp.Write(&fhdr, sizeof(fhdr));
+ bmp.Write(&ihdr, sizeof(ihdr));
+ bmp.Write(uipal, sizeof(RGBQUAD)*16);
+ bmp.Write(p4bpp, pitch*h);
+ bmp.Close();
+
+ CompressFile(bmpfn);
+ }
+ }
+
+ return(true);
+}
+
+bool CVobSubFile::SaveScenarist(CString fn)
+{
+ TrimExtension(fn);
+
+ CStdioFile f;
+ if(!f.Open(fn + _T(".sst"), CFile::modeCreate|CFile::modeWrite|CFile::typeText|CFile::shareDenyWrite))
+ return(false);
+
+ m_img.Invalidate();
+
+ fn.Replace('\\', '/');
+ CString title = fn.Mid(fn.ReverseFind('/')+1);
+
+ TCHAR buff[MAX_PATH], * pFilePart = buff;
+ if(GetFullPathName(fn, MAX_PATH, buff, &pFilePart) == 0)
+ return(false);
+
+ CString fullpath = CString(buff).Left(pFilePart - buff);
+ fullpath.TrimRight(_T("\\/"));
+ if(fullpath.IsEmpty())
+ return(false);
+
+ CString str, str2;
+ str += _T("st_format\t2\n");
+ str += _T("Display_Start\t%s\n");
+ str += _T("TV_Type\t\t%s\n");
+ str += _T("Tape_Type\tNON_DROP\n");
+ str += _T("Pixel_Area\t(0 %d)\n");
+ str += _T("Directory\t%s\n");
+ str += _T("Subtitle\t%s\n");
+ str += _T("Display_Area\t(0 2 719 %d)\n");
+ str += _T("Contrast\t(15 15 15 0)\n");
+ str += _T("\n");
+ str += _T("PA\t(0 0 255 - - - )\n");
+ str += _T("E1\t(255 0 0 - - - )\n");
+ str += _T("E2\t(0 0 0 - - - )\n");
+ str += _T("BG\t(255 255 255 - - - )\n");
+ str += _T("\n");
+ str += _T("SP_NUMBER\tSTART\tEND\tFILE_NAME\n");
+ str2.Format(str,
+ !m_fOnlyShowForcedSubs ? _T("non_forced") : _T("forced"),
+ m_size.cy == 480 ? _T("NTSC") : _T("PAL"),
+ m_size.cy-3,
+ fullpath,
+ title,
+ m_size.cy == 480 ? 479 : 574);
+
+ f.WriteString(str2);
+
+ f.Flush();
+
+ RGBQUAD pal[16] =
+ {
+ {255, 0, 0, 0},
+ {0, 0, 255, 0},
+ {0, 0, 0, 0},
+ {255, 255, 255, 0},
+ {0, 255, 0, 0},
+ {255, 0, 255, 0},
+ {0, 255, 255, 0},
+ {125, 125, 0, 0},
+ {125, 125, 125, 0},
+ {225, 225, 225, 0},
+ {0, 0, 125, 0},
+ {0, 125, 0, 0},
+ {125, 0, 0, 0},
+ {255, 0, 222, 0},
+ {0, 125, 222, 0},
+ {125, 0, 125, 0},
+ };
+
+ BITMAPFILEHEADER fhdr =
+ {
+ 0x4d42,
+ sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 16*sizeof(RGBQUAD) + 360*(m_size.cy-2),
+ 0, 0,
+ sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 16*sizeof(RGBQUAD)
+ };
+
+ BITMAPINFOHEADER ihdr =
+ {
+ sizeof(BITMAPINFOHEADER),
+ 720, m_size.cy-2, 1, 4, 0,
+ 360*(m_size.cy-2),
+ 0, 0,
+ 16, 4
+ };
+
+ bool fCustomPal = m_fCustomPal;
+ m_fCustomPal = true;
+ RGBQUAD tempCusPal[4], newCusPal[4+12] = {{255, 0, 0, 0}, {0, 0, 255, 0}, {0, 0, 0, 0}, {255, 255, 255, 0}};
+ memcpy(tempCusPal, m_cuspal, sizeof(tempCusPal));
+ memcpy(m_cuspal, newCusPal, sizeof(m_cuspal));
+
+ CAutoVectorPtr<BYTE> p4bpp;
+ if(!p4bpp.Allocate((m_size.cy-2)*360))
+ return(false);
+
+ BYTE colormap[16];
+
+ for(int i = 0; i < 16; i++)
+ {
+ int idx = 0, maxdif = 255*255*3+1;
+
+ for(int j = 0; j < 16 && maxdif; j++)
+ {
+ int rdif = pal[j].rgbRed - m_orgpal[i].rgbRed;
+ int gdif = pal[j].rgbGreen - m_orgpal[i].rgbGreen;
+ int bdif = pal[j].rgbBlue - m_orgpal[i].rgbBlue;
+
+ int dif = rdif*rdif + gdif*gdif + bdif*bdif;
+ if(dif < maxdif) {maxdif = dif; idx = j;}
+ }
+
+ colormap[i] = idx+1;
+ }
+
+ int pc[4] = {1, 1, 1, 1}, pa[4] = {15, 15, 15, 0};
+
+ CAtlArray<SubPos>& sp = m_langs[m_iLang].subpos;
+ for(int i = 0, k = 0; i < sp.GetCount(); i++)
+ {
+ if(!GetFrame(i)) continue;
+
+ for(int j = 0; j < 5; j++)
+ {
+ if(j == 4 || !m_img.pal[j].tr)
+ {
+ j &= 3;
+ memset(p4bpp, (j<<4)|j, (m_size.cy-2)*360);
+ break;
+ }
+ }
+
+ for(int y = max(m_img.rect.top+1, 2); y < m_img.rect.bottom-1; y++)
+ {
+ ASSERT(m_size.cy-y-1 >= 0);
+ if(m_size.cy-y-1 < 0) break;
+
+ DWORD* p = (DWORD*)&m_img.lpPixels[(y-m_img.rect.top)*m_img.rect.Width()+1];
+
+ for(int x = m_img.rect.left+1; x < m_img.rect.right-1; x++, p++)
+ {
+ DWORD rgb = *p&0xffffff;
+ BYTE c = rgb == 0x0000ff ? 0 : rgb == 0xff0000 ? 1 : rgb == 0x000000 ? 2 : 3;
+ BYTE& c4bpp = p4bpp[(m_size.cy-y-1)*360+(x>>1)];
+ c4bpp = (x&1) ? ((c4bpp&0xf0)|c) : ((c4bpp&0x0f)|(c<<4));
+ }
+ }
+
+ CString bmpfn;
+ bmpfn.Format(_T("%s_%04d.bmp"), fn, i+1);
+ title = bmpfn.Mid(bmpfn.ReverseFind('/')+1);
+
+ // E1, E2, P, Bg
+ int c[4] = {colormap[m_img.pal[1].pal], colormap[m_img.pal[2].pal], colormap[m_img.pal[0].pal], colormap[m_img.pal[3].pal]};
+ c[0]^=c[1], c[1]^=c[0], c[0]^=c[1];
+
+ if(memcmp(pc, c, sizeof(c)))
+ {
+ memcpy(pc, c, sizeof(c));
+ str.Format(_T("Color\t (%d %d %d %d)\n"), c[0], c[1], c[2], c[3]);
+ f.WriteString(str);
+ }
+
+ // E1, E2, P, Bg
+ int a[4] = {m_img.pal[1].tr, m_img.pal[2].tr, m_img.pal[0].tr, m_img.pal[3].tr};
+ a[0]^=a[1], a[1]^=a[0], a[0]^=a[1];
+
+ if(memcmp(pa, a, sizeof(a)))
+ {
+ memcpy(pa, a, sizeof(a));
+ str.Format(_T("Contrast (%d %d %d %d)\n"), a[0], a[1], a[2], a[3]);
+ f.WriteString(str);
+ }
+
+ int t1 = sp[i].start;
+ int h1 = t1/1000/60/60, m1 = (t1/1000/60)%60, s1 = (t1/1000)%60;
+ int f1 = (int)((m_size.cy==480?29.97:25)*(t1%1000)/1000);
+
+ int t2 = sp[i].stop;
+ int h2 = t2/1000/60/60, m2 = (t2/1000/60)%60, s2 = (t2/1000)%60;
+ int f2 = (int)((m_size.cy==480?29.97:25)*(t2%1000)/1000);
+
+ if(t2 <= 0) continue;
+ if(t1 < 0) t1 = 0;
+
+ if(h1 == h2 && m1 == m2 && s1 == s2 && f1 == f2)
+ {
+ f2++;
+ if(f2 == (m_size.cy==480?30:25)) {f2 = 0; s2++; if(s2 == 60) {s2 = 0; m2++; if(m2 == 60) {m2 = 0; h2++;}}}
+ }
+
+ if(i < sp.GetCount()-1)
+ {
+ int t3 = sp[i+1].start;
+ int h3 = t3/1000/60/60, m3 = (t3/1000/60)%60, s3 = (t3/1000)%60;
+ int f3 = (int)((m_size.cy==480?29.97:25)*(t3%1000)/1000);
+
+ if(h3 == h2 && m3 == m2 && s3 == s2 && f3 == f2)
+ {
+ f2--;
+ if(f2 == -1) {f2 = (m_size.cy==480?29:24); s2--; if(s2 == -1) {s2 = 59; m2--; if(m2 == -1) {m2 = 59; if(h2 > 0) h2--;}}}
+ }
+ }
+
+ if(h1 == h2 && m1 == m2 && s1 == s2 && f1 == f2)
+ continue;
+
+ str.Format(_T("%04d\t%02d:%02d:%02d:%02d\t%02d:%02d:%02d:%02d\t%s\n"),
+ ++k,
+ h1, m1, s1, f1,
+ h2, m2, s2, f2,
+ title);
+ f.WriteString(str);
+
+ CFile bmp;
+ if(bmp.Open(bmpfn, CFile::modeCreate|CFile::modeWrite|CFile::modeRead|CFile::typeBinary))
+ {
+ bmp.Write(&fhdr, sizeof(fhdr));
+ bmp.Write(&ihdr, sizeof(ihdr));
+ bmp.Write(newCusPal, sizeof(RGBQUAD)*16);
+ bmp.Write(p4bpp, 360*(m_size.cy-2));
+ bmp.Close();
+
+ CompressFile(bmpfn);
+ }
+ }
+
+ m_fCustomPal = fCustomPal;
+ memcpy(m_cuspal, tempCusPal, sizeof(m_cuspal));
+
+ return(true);
+}
+
+bool CVobSubFile::SaveMaestro(CString fn)
+{
+ TrimExtension(fn);
+
+ CStdioFile f;
+ if(!f.Open(fn + _T(".son"), CFile::modeCreate|CFile::modeWrite|CFile::typeText|CFile::shareDenyWrite))
+ return(false);
+
+ m_img.Invalidate();
+
+ fn.Replace('\\', '/');
+ CString title = fn.Mid(fn.ReverseFind('/')+1);
+
+ TCHAR buff[MAX_PATH], * pFilePart = buff;
+ if(GetFullPathName(fn, MAX_PATH, buff, &pFilePart) == 0)
+ return(false);
+
+ CString fullpath = CString(buff).Left(pFilePart - buff);
+ fullpath.TrimRight(_T("\\/"));
+ if(fullpath.IsEmpty())
+ return(false);
+
+ CString str, str2;
+ str += _T("st_format\t2\n");
+ str += _T("Display_Start\t%s\n");
+ str += _T("TV_Type\t\t%s\n");
+ str += _T("Tape_Type\tNON_DROP\n");
+ str += _T("Pixel_Area\t(0 %d)\n");
+ str += _T("Directory\t%s\n");
+ str += _T("Subtitle\t%s\n");
+ str += _T("Display_Area\t(0 2 719 %d)\n");
+ str += _T("Contrast\t(15 15 15 0)\n");
+ str += _T("\n");
+ str += _T("SP_NUMBER\tSTART\tEND\tFILE_NAME\n");
+ str2.Format(str,
+ !m_fOnlyShowForcedSubs ? _T("non_forced") : _T("forced"),
+ m_size.cy == 480 ? _T("NTSC") : _T("PAL"),
+ m_size.cy-3,
+ fullpath,
+ title,
+ m_size.cy == 480 ? 479 : 574);
+
+ f.WriteString(str2);
+
+ f.Flush();
+
+ RGBQUAD pal[16] =
+ {
+ {255, 0, 0, 0},
+ {0, 0, 255, 0},
+ {0, 0, 0, 0},
+ {255, 255, 255, 0},
+ {0, 255, 0, 0},
+ {255, 0, 255, 0},
+ {0, 255, 255, 0},
+ {125, 125, 0, 0},
+ {125, 125, 125, 0},
+ {225, 225, 225, 0},
+ {0, 0, 125, 0},
+ {0, 125, 0, 0},
+ {125, 0, 0, 0},
+ {255, 0, 222, 0},
+ {0, 125, 222, 0},
+ {125, 0, 125, 0},
+ };
+
+ BITMAPFILEHEADER fhdr =
+ {
+ 0x4d42,
+ sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 16*sizeof(RGBQUAD) + 360*(m_size.cy-2),
+ 0, 0,
+ sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + 16*sizeof(RGBQUAD)
+ };
+
+ BITMAPINFOHEADER ihdr =
+ {
+ sizeof(BITMAPINFOHEADER),
+ 720, m_size.cy-2, 1, 4, 0,
+ 360*(m_size.cy-2),
+ 0, 0,
+ 16, 4
+ };
+
+ bool fCustomPal = m_fCustomPal;
+ m_fCustomPal = true;
+ RGBQUAD tempCusPal[4], newCusPal[4+12] = {{255, 0, 0, 0}, {0, 0, 255, 0}, {0, 0, 0, 0}, {255, 255, 255, 0}};
+ memcpy(tempCusPal, m_cuspal, sizeof(tempCusPal));
+ memcpy(m_cuspal, newCusPal, sizeof(m_cuspal));
+
+ CAutoVectorPtr<BYTE> p4bpp;
+ if(!p4bpp.Allocate((m_size.cy-2)*360))
+ return(false);
+
+ BYTE colormap[16];
+ for(int i = 0; i < 16; i++)
+ colormap[i] = i;
+
+ CFile spf;
+ if(spf.Open(fn + _T(".spf"), CFile::modeCreate|CFile::modeWrite|CFile::typeBinary))
+ {
+ for(int i = 0; i < 16; i++)
+ {
+ COLORREF c = (m_orgpal[i].rgbBlue<<16) | (m_orgpal[i].rgbGreen<<8) | m_orgpal[i].rgbRed;
+ spf.Write(&c, sizeof(COLORREF));
+ }
+
+ spf.Close();
+ }
+
+ int pc[4] = {1,1,1,1}, pa[4] = {15,15,15,0};
+
+ CAtlArray<SubPos>& sp = m_langs[m_iLang].subpos;
+ for(int i = 0, k = 0; i < sp.GetCount(); i++)
+ {
+ if(!GetFrame(i)) continue;
+
+ for(int j = 0; j < 5; j++)
+ {
+ if(j == 4 || !m_img.pal[j].tr)
+ {
+ j &= 3;
+ memset(p4bpp, (j<<4)|j, (m_size.cy-2)*360);
+ break;
+ }
+ }
+
+ for(int y = max(m_img.rect.top+1, 2); y < m_img.rect.bottom-1; y++)
+ {
+ ASSERT(m_size.cy-y-1 >= 0);
+ if(m_size.cy-y-1 < 0) break;
+
+ DWORD* p = (DWORD*)&m_img.lpPixels[(y-m_img.rect.top)*m_img.rect.Width()+1];
+
+ for(int x = m_img.rect.left+1; x < m_img.rect.right-1; x++, p++)
+ {
+ DWORD rgb = *p&0xffffff;
+ BYTE c = rgb == 0x0000ff ? 0 : rgb == 0xff0000 ? 1 : rgb == 0x000000 ? 2 : 3;
+ BYTE& c4bpp = p4bpp[(m_size.cy-y-1)*360+(x>>1)];
+ c4bpp = (x&1) ? ((c4bpp&0xf0)|c) : ((c4bpp&0x0f)|(c<<4));
+ }
+ }
+
+ CString bmpfn;
+ bmpfn.Format(_T("%s_%04d.bmp"), fn, i+1);
+ title = bmpfn.Mid(bmpfn.ReverseFind('/')+1);
+
+ // E1, E2, P, Bg
+ int c[4] = {colormap[m_img.pal[1].pal], colormap[m_img.pal[2].pal], colormap[m_img.pal[0].pal], colormap[m_img.pal[3].pal]};
+
+ if(memcmp(pc, c, sizeof(c)))
+ {
+ memcpy(pc, c, sizeof(c));
+ str.Format(_T("Color\t (%d %d %d %d)\n"), c[0], c[1], c[2], c[3]);
+ f.WriteString(str);
+ }
+
+ // E1, E2, P, Bg
+ int a[4] = {m_img.pal[1].tr, m_img.pal[2].tr, m_img.pal[0].tr, m_img.pal[3].tr};
+
+ if(memcmp(pa, a, sizeof(a)))
+ {
+ memcpy(pa, a, sizeof(a));
+ str.Format(_T("Contrast (%d %d %d %d)\n"), a[0], a[1], a[2], a[3]);
+ f.WriteString(str);
+ }
+
+ int t1 = sp[i].start;
+ int h1 = t1/1000/60/60, m1 = (t1/1000/60)%60, s1 = (t1/1000)%60;
+ int f1 = (int)((m_size.cy==480?29.97:25)*(t1%1000)/1000);
+
+ int t2 = sp[i].stop;
+ int h2 = t2/1000/60/60, m2 = (t2/1000/60)%60, s2 = (t2/1000)%60;
+ int f2 = (int)((m_size.cy==480?29.97:25)*(t2%1000)/1000);
+
+ if(t2 <= 0) continue;
+ if(t1 < 0) t1 = 0;
+
+ if(h1 == h2 && m1 == m2 && s1 == s2 && f1 == f2)
+ {
+ f2++;
+ if(f2 == (m_size.cy==480?30:25)) {f2 = 0; s2++; if(s2 == 60) {s2 = 0; m2++; if(m2 == 60) {m2 = 0; h2++;}}}
+ }
+
+ if(i < sp.GetCount()-1)
+ {
+ int t3 = sp[i+1].start;
+ int h3 = t3/1000/60/60, m3 = (t3/1000/60)%60, s3 = (t3/1000)%60;
+ int f3 = (int)((m_size.cy==480?29.97:25)*(t3%1000)/1000);
+
+ if(h3 == h2 && m3 == m2 && s3 == s2 && f3 == f2)
+ {
+ f2--;
+ if(f2 == -1) {f2 = (m_size.cy==480?29:24); s2--; if(s2 == -1) {s2 = 59; m2--; if(m2 == -1) {m2 = 59; if(h2 > 0) h2--;}}}
+ }
+ }
+
+ if(h1 == h2 && m1 == m2 && s1 == s2 && f1 == f2)
+ continue;
+
+ str.Format(_T("%04d\t%02d:%02d:%02d:%02d\t%02d:%02d:%02d:%02d\t%s\n"),
+ ++k,
+ h1, m1, s1, f1,
+ h2, m2, s2, f2,
+ title);
+ f.WriteString(str);
+
+ CFile bmp;
+ if(bmp.Open(bmpfn, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary))
+ {
+ bmp.Write(&fhdr, sizeof(fhdr));
+ bmp.Write(&ihdr, sizeof(ihdr));
+ bmp.Write(newCusPal, sizeof(RGBQUAD)*16);
+ bmp.Write(p4bpp, 360*(m_size.cy-2));
+ bmp.Close();
+
+ CompressFile(bmpfn);
+ }
+ }
+
+ m_fCustomPal = fCustomPal;
+ memcpy(m_cuspal, tempCusPal, sizeof(m_cuspal));
+
+ return(true);
+}
+
+//
+// CVobSubStream
+//
+
+CVobSubStream::CVobSubStream(CCritSec* pLock)
+ : ISubPicProviderImpl(pLock)
+{
+}
+
+CVobSubStream::~CVobSubStream()
+{
+}
+
+void CVobSubStream::Open(CString name, BYTE* pData, int len)
+{
+ CAutoLock cAutoLock(&m_csSubPics);
+
+ m_name = name;
+
+ CAtlList<CString> lines;
+ Explode(CString(CStringA((CHAR*)pData, len)), lines, '\n');
+ while(lines.GetCount())
+ {
+ CAtlList<CString> sl;
+ Explode(lines.RemoveHead(), sl, ':', 2);
+ if(sl.GetCount() != 2) continue;
+ CString key = sl.GetHead();
+ CString value = sl.GetTail();
+ if(key == _T("size"))
+ _stscanf(value, _T("%dx %d"), &m_size.cx, &m_size.cy);
+ else if(key == _T("org"))
+ _stscanf(value, _T("%d, %d"), &m_org.x, &m_org.y);
+ else if(key == _T("scale"))
+ _stscanf(value, _T("%d%%, %d%%"), &m_scale_x, &m_scale_y);
+ else if(key == _T("alpha"))
+ _stscanf(value, _T("%d%%"), &m_alpha);
+ else if(key == _T("smooth"))
+ m_fSmooth =
+ value == _T("0") || value == _T("OFF") ? 0 :
+ value == _T("1") || value == _T("ON") ? 1 :
+ value == _T("2") || value == _T("OLD") ? 2 :
+ 0;
+ else if(key == _T("align"))
+ {
+ Explode(value, sl, ' ');
+ if(sl.GetCount() == 4) sl.RemoveAt(sl.FindIndex(1));
+ if(sl.GetCount() == 3)
+ {
+ m_fAlign = sl.RemoveHead() == _T("ON");
+ CString hor = sl.GetHead(), ver = sl.GetTail();
+ m_alignhor = hor == _T("LEFT") ? 0 : hor == _T("CENTER") ? 1 : hor == _T("RIGHT") ? 2 : 1;
+ m_alignver = ver == _T("TOP") ? 0 : ver == _T("CENTER") ? 1 : ver == _T("BOTTOM") ? 2 : 2;
+ }
+ }
+ else if(key == _T("fade in/out"))
+ _stscanf(value, _T("%d%, %d%"), &m_fadein, &m_fadeout);
+ else if(key == _T("time offset"))
+ m_toff = _tcstol(value, NULL, 10);
+ else if(key == _T("forced subs"))
+ m_fOnlyShowForcedSubs = value == _T("1") || value == _T("ON");
+ else if(key == _T("palette"))
+ {
+ Explode(value, sl, ',', 16);
+ for(int i = 0; i < 16 && sl.GetCount(); i++)
+ *(DWORD*)&m_orgpal[i] = _tcstol(sl.RemoveHead(), NULL, 16);
+ }
+ else if(key == _T("custom colors"))
+ {
+ m_fCustomPal = Explode(value, sl, ',', 3) == _T("ON");
+ if(sl.GetCount() == 3)
+ {
+ sl.RemoveHead();
+ CAtlList<CString> tridx, colors;
+ Explode(sl.RemoveHead(), tridx, ':', 2);
+ if(tridx.RemoveHead() == _T("tridx"))
+ {
+ TCHAR tr[4];
+ _stscanf(tridx.RemoveHead(), _T("%c%c%c%c"), &tr[0], &tr[1], &tr[2], &tr[3]);
+ for(int i = 0; i < 4; i++)
+ m_tridx |= ((tr[i]=='1')?1:0)<<i;
+ }
+ Explode(sl.RemoveHead(), colors, ':', 2);
+ if(colors.RemoveHead() == _T("colors"))
+ {
+ Explode(colors.RemoveHead(), colors, ',', 4);
+ for(int i = 0; i < 4 && colors.GetCount(); i++)
+ *(DWORD*)&m_cuspal[i] = _tcstol(colors.RemoveHead(), NULL, 16);
+ }
+ }
+ }
+ }
+}
+
+void CVobSubStream::Add(REFERENCE_TIME tStart, REFERENCE_TIME tStop, BYTE* pData, int len)
+{
+ if(len <= 4 || ((pData[0]<<8)|pData[1]) != len) return;
+
+ CVobSubImage vsi;
+ vsi.GetPacketInfo(pData, (pData[0]<<8)|pData[1], (pData[2]<<8)|pData[3]);
+
+ CAutoPtr<SubPic> p(new SubPic());
+ p->tStart = tStart;
+ p->tStop = vsi.delay > 0 ? (tStart + 10000i64*vsi.delay) : tStop;
+ p->pData.SetCount(len);
+ memcpy(p->pData.GetData(), pData, p->pData.GetCount());
+
+ CAutoLock cAutoLock(&m_csSubPics);
+ while(m_subpics.GetCount() && m_subpics.GetTail()->tStart >= tStart)
+ m_subpics.RemoveTail();
+ m_subpics.AddTail(p);
+}
+
+void CVobSubStream::RemoveAll()
+{
+ CAutoLock cAutoLock(&m_csSubPics);
+ m_subpics.RemoveAll();
+}
+
+STDMETHODIMP CVobSubStream::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ CheckPointer(ppv, E_POINTER);
+ *ppv = NULL;
+
+ return
+ QI(IPersist)
+ QI(ISubStream)
+ QI(ISubPicProvider)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+// ISubPicProvider
+
+STDMETHODIMP_(POSITION) CVobSubStream::GetStartPosition(REFERENCE_TIME rt, double fps)
+{
+ CAutoLock cAutoLock(&m_csSubPics);
+ POSITION pos = m_subpics.GetTailPosition();
+ for(; pos; m_subpics.GetPrev(pos))
+ {
+ SubPic* sp = m_subpics.GetAt(pos);
+ if(sp->tStart <= rt)
+ {
+ if(sp->tStop <= rt) m_subpics.GetNext(pos);
+ break;
+ }
+ }
+ return(pos);
+}
+
+STDMETHODIMP_(POSITION) CVobSubStream::GetNext(POSITION pos)
+{
+ CAutoLock cAutoLock(&m_csSubPics);
+ m_subpics.GetNext(pos);
+ return pos;
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CVobSubStream::GetStart(POSITION pos, double fps)
+{
+ CAutoLock cAutoLock(&m_csSubPics);
+ return m_subpics.GetAt(pos)->tStart;
+}
+
+STDMETHODIMP_(REFERENCE_TIME) CVobSubStream::GetStop(POSITION pos, double fps)
+{
+ CAutoLock cAutoLock(&m_csSubPics);
+ return m_subpics.GetAt(pos)->tStop;
+}
+
+STDMETHODIMP_(bool) CVobSubStream::IsAnimated(POSITION pos)
+{
+ return(false);
+}
+
+STDMETHODIMP CVobSubStream::Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox)
+{
+ if(spd.bpp != 32) return E_INVALIDARG;
+
+ POSITION pos = m_subpics.GetTailPosition();
+ for(; pos; m_subpics.GetPrev(pos))
+ {
+ SubPic* sp = m_subpics.GetAt(pos);
+ if(sp->tStart <= rt && rt < sp->tStop)
+ {
+ if(m_img.iIdx != (int)pos)
+ {
+ BYTE* pData = sp->pData.GetData();
+ m_img.Decode(
+ pData, (pData[0]<<8)|pData[1], (pData[2]<<8)|pData[3],
+ m_fCustomPal, m_tridx, m_orgpal, m_cuspal, true);
+ m_img.iIdx = (int)pos;
+ }
+
+ return __super::Render(spd, bbox);
+ }
+ }
+
+ return E_FAIL;
+}
+
+// IPersist
+
+STDMETHODIMP CVobSubStream::GetClassID(CLSID* pClassID)
+{
+ return pClassID ? *pClassID = __uuidof(this), S_OK : E_POINTER;
+}
+
+// ISubStream
+
+STDMETHODIMP_(int) CVobSubStream::GetStreamCount()
+{
+ return 1;
+}
+
+STDMETHODIMP CVobSubStream::GetStreamInfo(int i, WCHAR** ppName, LCID* pLCID)
+{
+ CAutoLock cAutoLock(&m_csSubPics);
+
+ if(ppName)
+ {
+ if(!(*ppName = (WCHAR*)CoTaskMemAlloc((m_name.GetLength()+1)*sizeof(WCHAR))))
+ return E_OUTOFMEMORY;
+ wcscpy(*ppName, CStringW(m_name));
+ }
+
+ if(pLCID)
+ {
+ *pLCID = 0; // TODO
+ }
+
+ return S_OK;
+}
+
+STDMETHODIMP_(int) CVobSubStream::GetStream()
+{
+ return 0;
+}
+
+STDMETHODIMP CVobSubStream::SetStream(int iStream)
+{
+ return iStream == 0 ? S_OK : E_FAIL;
+}
diff --git a/src/subtitles/VobSubFile.h b/src/subtitles/VobSubFile.h
new file mode 100644
index 000000000..3ce9c374c
--- /dev/null
+++ b/src/subtitles/VobSubFile.h
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+#include "VobSubImage.h"
+#include "..\SubPic\ISubPic.h"
+
+#define VOBSUBIDXVER 7
+
+extern CString FindLangFromId(WORD id);
+
+class CVobSubSettings
+{
+protected:
+ HRESULT Render(SubPicDesc& spd, RECT& bbox);
+
+public:
+ CSize m_size;
+ int m_x, m_y;
+ CPoint m_org;
+ int m_scale_x, m_scale_y; // % (don't set it to unsigned because as a side effect it will mess up negative coordinates in GetDestrect())
+ int m_alpha; // %
+ int m_fSmooth; // 0: OFF, 1: ON, 2: OLD (means no filtering at all)
+ int m_fadein, m_fadeout; // ms
+ bool m_fAlign;
+ int m_alignhor, m_alignver; // 0: left/top, 1: center, 2: right/bottom
+ unsigned int m_toff; // ms
+ bool m_fOnlyShowForcedSubs;
+ bool m_fCustomPal;
+ int m_tridx;
+ RGBQUAD m_orgpal[16], m_cuspal[4];
+
+ CVobSubImage m_img;
+
+ CVobSubSettings() {InitSettings();}
+ void InitSettings();
+
+ bool GetCustomPal(RGBQUAD* cuspal, int& tridx);
+ void SetCustomPal(RGBQUAD* cuspal, int tridx);
+
+ void GetDestrect(CRect& r); // destrect of m_img, considering the current alignment mode
+ void GetDestrect(CRect& r, int w, int h); // this will scale it to the frame size of (w, h)
+
+ void SetAlignment(bool fAlign, int x, int y, int hor, int ver);
+};
+
+[uuid("998D4C9A-460F-4de6-BDCD-35AB24F94ADF")]
+class CVobSubFile : public CVobSubSettings, public ISubStream, public ISubPicProviderImpl
+{
+protected:
+ CString m_title;
+
+ void TrimExtension(CString& fn);
+ bool ReadIdx(CString fn, int& ver), ReadSub(CString fn), ReadRar(CString fn), ReadIfo(CString fn);
+ bool WriteIdx(CString fn), WriteSub(CString fn);
+
+ CMemFile m_sub;
+
+ BYTE* GetPacket(int idx, int& packetsize, int& datasize, int iLang = -1);
+ bool GetFrame(int idx, int iLang = -1);
+ bool GetFrameByTimeStamp(__int64 time);
+ int GetFrameIdxByTimeStamp(__int64 time);
+
+ bool SaveVobSub(CString fn);
+ bool SaveWinSubMux(CString fn);
+ bool SaveScenarist(CString fn);
+ bool SaveMaestro(CString fn);
+
+public:
+ typedef struct
+ {
+ __int64 filepos;
+ __int64 start, stop;
+ bool fForced;
+ char vobid, cellid;
+ __int64 celltimestamp;
+ bool fValid;
+ } SubPos;
+
+ typedef struct
+ {
+ int id;
+ CString name, alt;
+ CAtlArray<SubPos> subpos;
+ } SubLang;
+
+ int m_iLang;
+ SubLang m_langs[32];
+
+public:
+ CVobSubFile(CCritSec* pLock);
+ virtual ~CVobSubFile();
+
+ bool Copy(CVobSubFile& vsf);
+
+ typedef enum {None,VobSub,WinSubMux,Scenarist,Maestro} SubFormat;
+
+ bool Open(CString fn);
+ bool Save(CString fn, SubFormat sf = VobSub);
+ void Close();
+
+ CString GetTitle() {return(m_title);}
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicProvider
+ STDMETHODIMP_(POSITION) GetStartPosition(REFERENCE_TIME rt, double fps);
+ STDMETHODIMP_(POSITION) GetNext(POSITION pos);
+ STDMETHODIMP_(REFERENCE_TIME) GetStart(POSITION pos, double fps);
+ STDMETHODIMP_(REFERENCE_TIME) GetStop(POSITION pos, double fps);
+ STDMETHODIMP_(bool) IsAnimated(POSITION pos);
+ STDMETHODIMP Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox);
+
+ // IPersist
+ STDMETHODIMP GetClassID(CLSID* pClassID);
+
+ // ISubStream
+ STDMETHODIMP_(int) GetStreamCount();
+ STDMETHODIMP GetStreamInfo(int i, WCHAR** ppName, LCID* pLCID);
+ STDMETHODIMP_(int) GetStream();
+ STDMETHODIMP SetStream(int iStream);
+ STDMETHODIMP Reload();
+};
+
+[uuid("D7FBFB45-2D13-494F-9B3D-FFC9557D5C45")]
+class CVobSubStream : public CVobSubSettings, public ISubStream, public ISubPicProviderImpl
+{
+ CString m_name;
+
+ CCritSec m_csSubPics;
+ struct SubPic {REFERENCE_TIME tStart, tStop; CAtlArray<BYTE> pData;};
+ CAutoPtrList<SubPic> m_subpics;
+
+public:
+ CVobSubStream(CCritSec* pLock);
+ virtual ~CVobSubStream();
+
+ void Open(CString name, BYTE* pData, int len);
+
+ void Add(REFERENCE_TIME tStart, REFERENCE_TIME tStop, BYTE* pData, int len);
+ void RemoveAll();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // ISubPicProvider
+ STDMETHODIMP_(POSITION) GetStartPosition(REFERENCE_TIME rt, double fps);
+ STDMETHODIMP_(POSITION) GetNext(POSITION pos);
+ STDMETHODIMP_(REFERENCE_TIME) GetStart(POSITION pos, double fps);
+ STDMETHODIMP_(REFERENCE_TIME) GetStop(POSITION pos, double fps);
+ STDMETHODIMP_(bool) IsAnimated(POSITION pos);
+ STDMETHODIMP Render(SubPicDesc& spd, REFERENCE_TIME rt, double fps, RECT& bbox);
+
+ // IPersist
+ STDMETHODIMP GetClassID(CLSID* pClassID);
+
+ // ISubStream
+ STDMETHODIMP_(int) GetStreamCount();
+ STDMETHODIMP GetStreamInfo(int i, WCHAR** ppName, LCID* pLCID);
+ STDMETHODIMP_(int) GetStream();
+ STDMETHODIMP SetStream(int iStream);
+ STDMETHODIMP Reload() {return E_NOTIMPL;}
+};
diff --git a/src/subtitles/VobSubFileRipper.cpp b/src/subtitles/VobSubFileRipper.cpp
new file mode 100644
index 000000000..aca8e01a5
--- /dev/null
+++ b/src/subtitles/VobSubFileRipper.cpp
@@ -0,0 +1,1259 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "StdAfx.h"
+#include "vobsubfileripper.h"
+#include "..\decss\VobDec.h"
+#include "..\subtitles\CCDecoder.h"
+
+//
+// CVobSubFileRipper
+//
+
+CVobSubFileRipper::CVobSubFileRipper()
+ : CVobSubFile(NULL)
+ , m_fThreadActive(false)
+ , m_fBreakThread(false)
+ , m_fIndexing(false)
+{
+ m_rd.Reset();
+ CAMThread::Create();
+}
+
+CVobSubFileRipper::~CVobSubFileRipper()
+{
+ CAMThread::CallWorker(CMD_EXIT);
+ CAMThread::Close();
+}
+
+STDMETHODIMP CVobSubFileRipper::NonDelegatingQueryInterface(REFIID riid, void** ppv)
+{
+ return
+ QI(IVSFRipper)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+}
+
+void CVobSubFileRipper::Log(log_t type, LPCTSTR lpszFormat, ...)
+{
+ CAutoLock cAutoLock(&m_csCallback);
+ if(!m_pCallback) return;
+
+ TCHAR buff[1024];
+
+ va_list args;
+ va_start(args, lpszFormat);
+ _vstprintf(buff, lpszFormat, args);
+ va_end(args);
+
+ CString msg;
+ switch(type)
+ {
+ default:
+ case LOG_INFO: msg = _T(""); break;
+ case LOG_WARNING: msg = _T("WARNING: "); break;
+ case LOG_ERROR: msg = _T("ERROR: "); break;
+ }
+
+ msg += buff;
+
+ m_pCallback->OnMessage(msg);
+}
+
+void CVobSubFileRipper::Progress(double progress)
+{
+ CAutoLock cAutoLock(&m_csCallback);
+ if(!m_pCallback) return;
+
+ m_pCallback->OnProgress(progress);
+}
+
+void CVobSubFileRipper::Finished(bool fSucceeded)
+{
+ CAutoLock cAutoLock(&m_csCallback);
+ if(!m_pCallback) return;
+
+ m_pCallback->OnFinished(fSucceeded);
+}
+
+#define ReadBEb(var) \
+ f.Read(&((BYTE*)&var)[0], 1); \
+
+#define ReadBEw(var) \
+ f.Read(&((BYTE*)&var)[1], 1); \
+ f.Read(&((BYTE*)&var)[0], 1); \
+
+#define ReadBEdw(var) \
+ f.Read(&((BYTE*)&var)[3], 1); \
+ f.Read(&((BYTE*)&var)[2], 1); \
+ f.Read(&((BYTE*)&var)[1], 1); \
+ f.Read(&((BYTE*)&var)[0], 1); \
+
+bool CVobSubFileRipper::LoadIfo(CString fn)
+{
+ CString str;
+
+ CFileStatus status;
+ if(!CFileGetStatus(fn, status) || !status.m_size)
+ {
+ Log(LOG_ERROR, _T("Invalid ifo"));
+ return(false);
+ }
+
+ CFile f;
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ {
+ Log(LOG_ERROR, _T("Cannot open ifo"));
+ return(false);
+ }
+
+ Log(LOG_INFO, _T("Opening ifo OK"));
+
+ char hdr[13];
+ f.Read(hdr, 12);
+ hdr[12] = 0;
+ if(strcmp(hdr, "DVDVIDEO-VTS"))
+ {
+ Log(LOG_ERROR, _T("Not a Video Title Set IFO file!"));
+ return(false);
+ }
+
+ // lang ids
+
+ f.Seek(0x254, CFile::begin);
+
+ WORD ids[32];
+ memset(ids, 0, sizeof(ids));
+
+ int len = 0;
+ ReadBEw(len);
+
+ for(int i = 0; i < len; i++)
+ {
+ f.Seek(2, CFile::current); // 01 00 ?
+ ReadBEw(ids[i]);
+ if(ids[i] == 0) ids[i] = '--';
+ f.Seek(2, CFile::current); // 00 00 ?
+ }
+
+ /* Video info */
+
+ f.Seek(0x200, CFile::begin);
+ f.Read(&m_rd.vidinfo, 2);
+
+ SIZE res[4][2] =
+ {
+ {{720,480},{720,576}},
+ {{704,480},{704,576}},
+ {{352,480},{352,576}},
+ {{352,240},{352,288}}
+ };
+
+ m_rd.vidsize = res[m_rd.vidinfo.source_res][m_rd.vidinfo.system&1];
+
+ double rate = (m_rd.vidinfo.system == 0) ? 30.0/29.97 : 1.0;
+
+ /* PGCs */
+
+ {
+ DWORD offset;
+
+ DWORD pgcpos;
+ f.Seek(0xc0+0x0c, CFile::begin);
+ ReadBEdw(pgcpos);
+ pgcpos *= 0x800;
+
+ WORD nPGC;
+ f.Seek(pgcpos, CFile::begin);
+ ReadBEw(nPGC);
+
+ m_rd.pgcs.RemoveAll();
+ m_rd.pgcs.SetCount(nPGC);
+
+ for(int i = 0; i < nPGC; i++)
+ {
+ PGC& pgc = m_rd.pgcs[i];
+
+ f.Seek(pgcpos + 8 + i*8 + 4, CFile::begin);
+ ReadBEdw(offset);
+ offset += pgcpos;
+
+ BYTE nProgs, nCells;
+ f.Seek(offset + 2, CFile::begin);
+ ReadBEb(nProgs);
+ ReadBEb(nCells);
+
+ //
+
+ memcpy(pgc.ids, ids, sizeof(ids));
+
+ struct splanginfo {BYTE res1, id1, id2, res2;};
+ splanginfo splinfo[32];
+
+ f.Seek(offset + 0x1c, CFile::begin);
+ f.Read(splinfo, 32*4);
+
+ for(int j = 0; j < 32; j++)
+ {
+ if(splinfo[j].id1 || splinfo[i].id2)
+ {
+ WORD tmpids[32];
+ memset(tmpids, 0, sizeof(tmpids));
+
+ for(j = 0; j < 32; j++)
+ {
+ if(!(splinfo[j].res1 & 0x80)) break;
+
+ pgc.ids[splinfo[j].id1] = ids[j];
+ pgc.ids[splinfo[j].id2] = ids[j];
+ }
+
+ break;
+ }
+ }
+
+ //
+
+ f.Seek(offset + 0xa4, CFile::begin);
+
+ for(int j = 0; j < 16; j++)
+ {
+ BYTE y, u, v, tmp;
+
+ f.Read(&tmp, 1);
+ f.Read(&y, 1);
+ f.Read(&u, 1);
+ f.Read(&v, 1);
+
+ y = (y-16)*255/219;
+
+ pgc.pal[j].rgbRed = (BYTE)min(max(1.0*y + 1.4022*(u-128), 0), 255);
+ pgc.pal[j].rgbGreen = (BYTE)min(max(1.0*y - 0.3456*(u-128) - 0.7145*(v-128), 0), 255);
+ pgc.pal[j].rgbBlue = (BYTE)min(max(1.0*y + 1.7710*(v-128), 0) , 255);
+ }
+
+ //
+
+ WORD progoff, celladdroff, vobcelloff;
+ f.Seek(offset + 0xe6, CFile::begin);
+ ReadBEw(progoff);
+ f.Seek(offset + 0xe8, CFile::begin);
+ ReadBEw(celladdroff);
+ f.Seek(offset + 0xea, CFile::begin);
+ ReadBEw(vobcelloff);
+
+ //
+
+ CAtlArray<BYTE> progs;
+ progs.SetCount(nProgs);
+ f.Seek(offset + progoff, CFile::begin);
+ f.Read(progs.GetData(), nProgs);
+
+ //
+
+ pgc.angles[0].SetCount(nCells);
+ pgc.iSelAngle = 0;
+
+ //
+
+ f.Seek(offset + vobcelloff, CFile::begin);
+ for(int j = 0; j < nCells; j++)
+ {
+ ReadBEw(pgc.angles[0][j].vob);
+ ReadBEw(pgc.angles[0][j].cell);
+ }
+
+ //
+
+ DWORD tOffset = 0, tTotal = 0;
+
+ int iAngle = 0;
+
+ pgc.nAngles = 0;
+
+ f.Seek(offset + celladdroff, CFile::begin);
+ for(int j = 0; j < nCells; j++)
+ {
+ BYTE b;
+ ReadBEb(b);
+ switch(b>>6)
+ {
+ case 0: iAngle = 0; break; // normal
+ case 1: iAngle = 1; break; // first angle block
+ case 2: iAngle++; break; // middle angle block
+ case 3: iAngle++; break; // last angle block (no more should follow)
+ }
+ pgc.angles[0][j].iAngle = iAngle;
+ pgc.nAngles = max(pgc.nAngles, iAngle);
+
+ f.Seek(3, CFile::current);
+ ReadBEdw(pgc.angles[0][j].tTime);
+ ReadBEdw(pgc.angles[0][j].start);
+ f.Seek(8, CFile::current);
+ ReadBEdw(pgc.angles[0][j].end);
+
+ float fps;
+ switch((pgc.angles[0][j].tTime>>6)&0x3)
+ {
+ default:
+ case 3: fps = 30; break;
+ case 1: fps = 25; break;
+ }
+
+ int t = pgc.angles[0][j].tTime;
+ int hh = ((t>>28)&0xf)*10+((t>>24)&0xf);
+ int mm = ((t>>20)&0xf)*10+((t>>16)&0xf);
+ int ss = ((t>>12)&0xf)*10+((t>>8)&0xf);
+ int ms = (int)(1000.0 * (((t>>4)&0x3)*10+((t>>0)&0xf)) / fps);
+ pgc.angles[0][j].tTime = (DWORD)((((hh*60+mm)*60+ss)*1000+ms)*rate);
+
+ // time discontinuity
+ if(b&0x02) tOffset = tTotal;
+ pgc.angles[0][j].fDiscontinuity = !!(b&0x02);
+
+ pgc.angles[0][j].tTotal = tTotal;
+ pgc.angles[0][j].tOffset = tOffset;
+
+ tTotal += pgc.angles[0][j].tTime;
+ }
+
+ for(iAngle = 1; iAngle <= 9; iAngle++)
+ {
+ tOffset = tTotal = 0;
+
+ for(int j = 0, k = 0; j < nCells; j++)
+ {
+ if(pgc.angles[0][j].iAngle != 0
+ && pgc.angles[0][j].iAngle != iAngle)
+ continue;
+
+ pgc.angles[iAngle].Add(pgc.angles[0][j]);
+
+ if(pgc.angles[iAngle][k].fDiscontinuity) tOffset = tTotal;
+
+ pgc.angles[iAngle][k].tTotal = tTotal;
+ pgc.angles[iAngle][k].tOffset = tOffset;
+
+ tTotal += pgc.angles[iAngle][k].tTime;
+
+ k++;
+ }
+ }
+ }
+ }
+
+ Log(LOG_INFO, _T("Parsing ifo OK"));
+
+ return(true);
+}
+
+bool CVobSubFileRipper::LoadVob(CString fn)
+{
+ Log(LOG_INFO, _T("Searching vobs..."));
+/*
+ CAtlList<CString> m_vobs;
+
+ fn = fn.Left(fn.ReverseFind('.')+1);
+ fn.TrimRight(_T(".0123456789"));
+ for(int i = 0; i < 100; i++)
+ {
+ CString vob;
+ vob.Format(_T("%s%d.vob"), fn, i);
+
+ CFileStatus status;
+ if(!(CFileGetStatus(vob, status) && status.m_size))
+ {
+ if(i > 0) break;
+ else continue;
+ }
+
+ if(status.m_size&0x7ff)
+ {
+ Log(LOG_ERROR, _T("Length of %s is not n*2048!"), vob);
+ m_vobs.RemoveAll();
+ break;
+ }
+
+ CString str = _T("Found ") + vob;
+
+ if(i == 0)
+ {
+ str += _T(" (skipping, if not a menu vob rename it)");
+ }
+ else
+ {
+ m_vobs.AddTail(vob);
+ }
+
+ Log(LOG_INFO, str);
+ }
+
+ if(m_vobs.GetCount() <= 0)
+ {
+ Log(LOG_ERROR, _T("Nothing found! (%s*.vob)"), fn);
+ return(false);
+ }
+*/
+ CAtlList<CString> vobs;
+ if(!m_vob.Open(fn, vobs/*m_vobs*/))
+ {
+ Log(LOG_ERROR, _T("Cannot open vob sequence"));
+ return(false);
+ }
+
+ if(vobs.GetCount() <= 0)
+ {
+ Log(LOG_ERROR, _T("Nothing found! (%s*.vob)"), fn);
+ return(false);
+ }
+
+ POSITION pos = vobs.GetHeadPosition();
+ while(pos) Log(LOG_INFO, _T("Found ") + vobs.GetNext(pos));
+
+ if(m_vob.IsDVD())
+ {
+ Log(LOG_INFO, _T("DVD detected..."));
+
+ BYTE key[5];
+
+ if(m_vob.HasDiscKey(key))
+ Log(LOG_INFO, _T("Disc key: %02x%02x%02x%02x%02x"), key[0], key[1], key[2], key[3], key[4]);
+ else
+ Log(LOG_WARNING, _T("Couldn't get the disc key"));
+
+ if(m_vob.HasTitleKey(key))
+ Log(LOG_INFO, _T("Title key: %02x%02x%02x%02x%02x"), key[0], key[1], key[2], key[3], key[4]);
+ else
+ Log(LOG_WARNING, _T("Couldn't get the title key"));
+
+ BYTE buff[2048];
+
+ m_vob.Seek(0);
+ if(!m_vob.Read(buff))
+ {
+ Log(LOG_ERROR, _T("Can't read vob, please unlock it with a software player!"));
+ return(false);
+ }
+ m_vob.Seek(0);
+ }
+
+ return(true);
+}
+
+DWORD CVobSubFileRipper::ThreadProc()
+{
+ SetThreadPriority(m_hThread, THREAD_PRIORITY_BELOW_NORMAL);
+
+ while(1)
+ {
+ DWORD cmd = GetRequest();
+
+ m_fThreadActive = true;
+
+ switch(cmd)
+ {
+ case CMD_EXIT:
+ Reply(S_OK);
+ return 0;
+
+ case CMD_INDEX:
+ Reply(S_OK);
+ {
+ m_fIndexing = true;
+ bool fSucceeded = Create();
+ m_fIndexing = false;
+ Finished(fSucceeded);
+ }
+ break;
+
+ default:
+ Reply(E_FAIL);
+ return -1;
+ }
+
+ m_fBreakThread = false;
+ m_fThreadActive = false;
+ }
+
+ return 1;
+}
+
+static int SubPosSortProc(const void* e1, const void* e2)
+{
+ return((int)(((CVobSubFile::SubPos*)e1)->start - ((CVobSubFile::SubPos*)e2)->start));
+}
+
+bool CVobSubFileRipper::Create()
+{
+ CAutoLock cAutoLock(&m_csAccessLock);
+
+ if(m_rd.iSelPGC < 0 || m_rd.iSelPGC >= m_rd.pgcs.GetCount())
+ {
+ Log(LOG_ERROR, _T("Invalid program chain number (%d)!"), m_rd.iSelPGC);
+ return(false);
+ }
+
+ PGC& pgc = m_rd.pgcs[m_rd.iSelPGC];
+
+ if(pgc.iSelAngle < 0 || pgc.iSelAngle > 9 || pgc.angles[pgc.iSelAngle].GetCount() == 0)
+ {
+ Log(LOG_ERROR, _T("Invalid angle number (%d)!"), pgc.iSelAngle);
+ return(false);
+ }
+
+ CAtlArray<vc_t>& angle = pgc.angles[pgc.iSelAngle];
+
+ if(m_rd.selids.GetCount() == 0 && !m_rd.fClosedCaption)
+ {
+ Log(LOG_ERROR, _T("No valid stream set to be extacted!"));
+ return(false);
+ }
+
+ if(m_rd.selvcs.GetCount() == 0)
+ {
+ Log(LOG_ERROR, _T("No valid vob/cell id set to be extacted!"));
+ return(false);
+ }
+
+ Log(LOG_INFO, _T("Indexing..."));
+
+ // initalize CVobSubFile
+ CVobSubFile::Close();
+ InitSettings();
+ m_title = m_outfn;
+ m_size = m_rd.vidsize;
+ TrimExtension(m_title);
+ memcpy(m_orgpal, pgc.pal, sizeof(m_orgpal));
+ m_sub.SetLength(0);
+
+ CCDecoder ccdec(m_title + _T(".cc.srt"), m_title + _T(".cc.raw"));
+
+ CVobDec vd;
+
+ __int64 SCR, PTS, tOffset = 0, tPrevOffset = 0, tTotal = 0, tStart = 0;
+ int vob = 0, cell = 0;
+ bool fDiscontinuity = false, fDiscontinuityFixApplied = false, fNavpackFound = false;
+
+ int PTSframeoffset = 0, minPTSframeoffset = 0;
+
+ if(m_rd.fResetTime)
+ {
+ for(int i = 0; i < angle.GetCount() && ((angle[i].vob<<16)|angle[i].cell) != m_rd.selvcs[0]; i++)
+ tStart += angle[i].tTime;
+
+ Log(LOG_INFO, _T("Counting timestamps from %I64dms (v%02dc%02d)"),
+ tStart, m_rd.selvcs[0]>>16, m_rd.selvcs[0]&0xffff);
+ }
+
+ CAtlMap<DWORD, int> selvcmap;
+ selvcmap.RemoveAll();
+ for(int i = 0; i < m_rd.selvcs.GetCount(); i++)
+ selvcmap[m_rd.selvcs[i]] = 90000;
+
+ CAtlArray<vcchunk> chunks, foundchunks, loadedchunks;
+
+ if(m_vob.IsDVD())
+ {
+ Log(LOG_INFO, _T("Indexing mode: DVD"));
+
+ for(int i = 0; i < angle.GetCount(); i++)
+ {
+ DWORD vc = (angle[i].vob<<16)|angle[i].cell;
+ if(!selvcmap.Lookup(vc))
+ continue;
+
+ vcchunk c = {2048i64*angle[i].start, 2048i64*angle[i].end+2048, vc};
+ chunks.Add(c);
+
+ Log(LOG_INFO, _T("Adding: 0x%x - 0x%x (lba) for vob %d cell %d"),
+ angle[i].start, angle[i].end, angle[i].vob, angle[i].cell);
+ }
+ }
+ else if(LoadChunks(loadedchunks))
+ {
+ Log(LOG_INFO, _T("Indexing mode: File"));
+
+ for(int i = 0; i < loadedchunks.GetCount(); i++)
+ {
+ DWORD vcid = loadedchunks[i].vc;
+ if(!selvcmap.Lookup(vcid))
+ continue;
+
+ chunks.Add(loadedchunks[i]);
+ }
+
+ Log(LOG_INFO, _T(".chunk file loaded"));
+ }
+ else
+ {
+ Log(LOG_INFO, _T("Indexing mode: File"));
+
+ chunks.RemoveAll();
+ vcchunk c = {0, 2048i64*m_vob.GetLength(), 0};
+ chunks.Add(c);
+ }
+
+ __int64 sizedone = 0, sizetotal = 0;
+ for(int i = 0; i < chunks.GetCount(); i++)
+ sizetotal += chunks[i].end - chunks[i].start;
+
+ for(int i = 0; !m_fBreakThread && i < chunks.GetCount(); i++)
+ {
+ __int64 curpos = chunks[i].start, endpos = chunks[i].end;
+
+ vcchunk curchunk = {curpos, curpos, chunks[i].vc};
+
+ for(m_vob.Seek((int)(curpos/2048)); !m_fBreakThread && curpos < endpos; curpos += 2048, sizedone += 2048)
+ {
+ if(!(curpos&0x7ffff))
+ Progress(1.0 * sizedone / sizetotal);
+
+ static BYTE buff[2048];
+
+ if(!m_vob.Read(buff))
+ {
+ Log(LOG_ERROR, _T("Cannot read, either locked dvd or truncated/missing files!"));
+ return(false);
+ }
+
+ curchunk.end = curpos;
+
+ if(buff[0x14] & 0x30)
+ {
+ if(!vd.m_fFoundKey)
+ {
+ Log(LOG_INFO, _T("Encrypted sector found, searching key..."));
+
+ __int64 savepos = curpos;
+
+ m_vob.Seek(0);
+ for(__int64 pos = 0; !m_fBreakThread && pos < endpos; pos += 2048)
+ {
+ if(!m_vob.Read(buff))
+ {
+ Log(LOG_ERROR, _T("Cannot read, either locked dvd or truncated/missing files!"));
+ return(false);
+ }
+
+ if(vd.FindKey(buff))
+ break;
+ }
+
+ if(m_fBreakThread)
+ break;
+
+ if(!vd.m_fFoundKey)
+ {
+ Log(LOG_ERROR, _T("Key not found, can't decrypt!"));
+ return(false);
+ }
+
+ Log(LOG_INFO, _T("Key found, continuing extraction..."));
+
+ m_vob.Seek((int)((curpos = savepos)/2048));
+ m_vob.Read(buff);
+ }
+
+ vd.Decrypt(buff);
+ }
+
+ if(*((DWORD*)&buff[0]) != 0xba010000)
+ {
+ Log(LOG_WARNING, _T("Bad sector header at block %08d!"), (int)(curpos/2048));
+
+ if(AfxMessageBox(_T("Bad packet header found, do you want to continue?"), MB_YESNO) == IDNO)
+ {
+ Log(LOG_ERROR, _T("Terminated!"));
+ return(false);
+ }
+ }
+
+ SCR = (__int64(buff[0x04] & 0x38) >> 3) << 30
+ | __int64(buff[0x04] & 0x03) << 28
+ | __int64(buff[0x05]) << 20
+ | (__int64(buff[0x06] & 0xf8) >> 3) << 15
+ | __int64(buff[0x06] & 0x03) << 13
+ | __int64(buff[0x07]) << 5
+ | (__int64(buff[0x08] & 0xf8) >> 3) << 0;
+
+ bool hasPTS = false;
+
+ if((*(DWORD*)&buff[0x0e] == 0xe0010000 || *(DWORD*)&buff[0x0e] == 0xbd010000)
+ && buff[0x15] & 0x80)
+ {
+ PTS = (__int64)(buff[0x17] & 0x0e) << 29 // 32-30 (+marker)
+ | ((__int64)(buff[0x18]) << 22) // 29-22
+ | ((__int64)(buff[0x19] & 0xfe) << 14) // 21-15 (+marker)
+ | ((__int64)(buff[0x1a]) << 7) // 14-07
+ | ((__int64)(buff[0x1b]) >> 1); // 06-00 (+marker)
+
+ hasPTS = true;
+ }
+
+ if(*((DWORD*)&buff[0x0e]) == 0xbb010000)
+ {
+ fNavpackFound = true;
+
+ if(vob == buff[0x420] && cell == buff[0x422])
+ continue;
+
+ vob = buff[0x420];
+ cell = buff[0x422];
+
+ tOffset = tTotal = 0;
+
+ for(int i = 0; i < angle.GetCount(); i++)
+ {
+ if(angle[i].vob == vob && angle[i].cell == cell)
+ {
+ tPrevOffset = tOffset;
+ tOffset = (__int64)angle[i].tOffset;
+ tTotal = (__int64)angle[i].tTotal;
+ fDiscontinuity = angle[i].fDiscontinuity;
+ fDiscontinuityFixApplied = false;
+ break;
+ }
+ }
+
+ if(curchunk.vc != ((vob<<16)|cell))
+ {
+ if(curchunk.vc != 0) foundchunks.Add(curchunk);
+ curchunk.start = curchunk.end = curpos;
+ curchunk.vc = (vob<<16)|cell;
+ }
+
+ CString str, str2;
+ str.Format(_T("v%02d c%02d lba%08d"), vob, cell, (int)(curpos/2048));
+ UINT vcid = (vob<<16)|cell;
+ if(!selvcmap.Lookup(vcid, minPTSframeoffset)) str2 = _T(", skipping");
+ else str2.Format(_T(", total=%I64dms, off=%I64dms, corr=%I64dms, discont.:%d"),
+ tTotal, tOffset, -tStart, (int)fDiscontinuity);
+ Log(LOG_INFO, str + str2);
+ }
+
+ DWORD vcid = (vob<<16)|cell;
+ if(!selvcmap.Lookup(vcid, minPTSframeoffset))
+ continue;
+
+ if(hasPTS && fDiscontinuity && !fDiscontinuityFixApplied)
+ {
+ __int64 tDiff = tOffset - tPrevOffset;
+ if(tDiff > 0 && tDiff < (PTS/90+1000))
+ {
+ CString str;
+ str.Format(_T("False discontinuity detected, correcting time by %I64dms"), -tDiff);
+ Log(LOG_INFO, str);
+
+ tStart += tDiff;
+ }
+ fDiscontinuityFixApplied = true;
+ }
+
+ if(*(DWORD*)&buff[0x0e] == 0xe0010000)
+ {
+ if(fDiscontinuity)
+ {
+ if(PTS < minPTSframeoffset)
+ {
+ selvcmap[vcid] = PTSframeoffset = PTS;
+ }
+
+ fDiscontinuity = false;
+ }
+
+ if(m_rd.fClosedCaption)
+ ccdec.ExtractCC(buff, 2048, tOffset + ((PTS - PTSframeoffset) / 90) - tStart);
+ }
+ else if(*(DWORD*)&buff[0x0e] == 0xbd010000)
+ {
+ BYTE id = buff[0x17 + buff[0x16]], iLang = id&0x1f;
+
+ if((id & 0xe0) == 0x20 && m_rd.selids.Lookup(iLang))
+ {
+ if(hasPTS)
+ {
+ SubPos sb;
+ sb.filepos = m_sub.GetPosition();
+ sb.start = tOffset + ((PTS - PTSframeoffset) / 90) - tStart;
+ sb.vobid = (char)vob;
+ sb.cellid = (char)cell;
+ sb.celltimestamp = tTotal;
+ sb.fValid = true;
+ m_langs[iLang].subpos.Add(sb);
+ }
+
+ m_sub.Write(buff, 2048);
+ }
+ }
+ }
+
+ if(curchunk.vc != ((vob<<16)|cell))
+ {
+ if(curchunk.vc != 0) foundchunks.Add(curchunk);
+ curchunk.start = curchunk.end = curpos;
+ curchunk.vc = (vob<<16)|cell;
+ }
+ }
+
+ if(sizedone < sizetotal)
+ {
+ Log(LOG_ERROR, _T("Indexing terminated before reaching the end!"));
+ Progress(0);
+ return(false);
+ }
+
+ if(!fNavpackFound)
+ {
+ Log(LOG_ERROR, _T("Could not find any system header start code! (0x000001bb)"));
+ if(!m_vob.IsDVD()) Log(LOG_ERROR, _T("Make sure the ripper doesn't strip these packets."));
+ Progress(0);
+ return(false);
+ }
+
+ Log(LOG_INFO, _T("Indexing finished"));
+ Progress(1);
+
+ for(int i = 0; i < 32; i++)
+ {
+ if(m_iLang == -1 && m_langs[i].subpos.GetCount() > 0) m_iLang = i;
+ m_langs[i].id = pgc.ids[i];
+ m_langs[i].name = m_langs[i].alt = FindLangFromId(m_langs[i].id);
+
+ CAtlArray<SubPos>& sp = m_langs[i].subpos;
+ qsort(sp.GetData(), sp.GetCount(), sizeof(SubPos), SubPosSortProc);
+
+ if(m_rd.fForcedOnly)
+ {
+ Log(LOG_INFO, _T("Searching for forced subs..."));
+ Progress(0);
+
+ for(int j = 0, len = sp.GetCount(); j < len; j++)
+ {
+ Progress(1.0 * j / len);
+
+ sp[j].fValid = false;
+ int packetsize = 0, datasize = 0;
+ if(BYTE* buff = GetPacket(j, packetsize, datasize, i))
+ {
+ m_img.GetPacketInfo(buff, packetsize, datasize);
+ sp[j].fValid = m_img.fForced;
+ delete [] buff;
+ }
+ }
+
+ Progress(1);
+ }
+ }
+
+ Log(LOG_INFO, _T("Saving files..."));
+
+ if(m_iLang != -1)
+ {
+ if(!Save(m_title))
+ {
+ Log(LOG_ERROR, _T("Could not save output files!"));
+ return(false);
+ }
+ }
+
+ Log(LOG_INFO, _T("Subtitles saved"));
+
+ if(!m_vob.IsDVD() && loadedchunks.GetCount() == 0)
+ {
+ if(SaveChunks(foundchunks))
+ {
+ Log(LOG_INFO, _T(".chunk file saved"));
+ }
+ }
+
+ Log(LOG_INFO, _T("Done!"));
+
+ return(true);
+}
+
+static const DWORD s_version = 1;
+
+bool CVobSubFileRipper::LoadChunks(CAtlArray<vcchunk>& chunks)
+{
+ CFile f;
+
+ CString fn = m_infn;
+ TrimExtension(fn);
+ fn += _T(".chunks");
+
+ DWORD chksum = 0, chunklen, version;
+ __int64 voblen;
+
+ if(!f.Open(fn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ return(false);
+ f.Read(&version, sizeof(version));
+ if(version == 1)
+ {
+ f.Read(&chksum, sizeof(chksum));
+ f.Read(&voblen, sizeof(voblen));
+ f.Read(&chunklen, sizeof(chunklen));
+ chunks.SetCount(chunklen);
+ f.Read(chunks.GetData(), sizeof(vcchunk)*chunks.GetCount());
+ }
+ f.Close();
+
+ if(voblen != m_vob.GetLength())
+ {
+ chunks.RemoveAll();
+ return(false);
+ }
+
+ if(!f.Open(m_infn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ return(false);
+ DWORD dw, chksum2 = 0;
+ while(f.Read(&dw, sizeof(dw)) == sizeof(dw)) chksum2 += dw;
+ f.Close();
+
+ if(chksum != chksum2)
+ {
+ chunks.RemoveAll();
+ return(false);
+ }
+
+ return(true);
+}
+
+bool CVobSubFileRipper::SaveChunks(CAtlArray<vcchunk>& chunks)
+{
+ CFile f;
+
+ CString fn = m_infn;
+ TrimExtension(fn);
+ fn += _T(".chunks");
+
+ DWORD chksum = 0, chunklen = chunks.GetCount();
+ __int64 voblen = m_vob.GetLength();
+
+ if(!f.Open(m_infn, CFile::modeRead|CFile::typeBinary|CFile::shareDenyWrite))
+ return(false);
+ DWORD dw;
+ while(f.Read(&dw, sizeof(dw)) == sizeof(dw)) chksum += dw;
+ f.Close();
+
+ if(!f.Open(fn, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary|CFile::shareDenyWrite))
+ return(false);
+ f.Write(&s_version, sizeof(s_version));
+ f.Write(&chksum, sizeof(chksum));
+ f.Write(&voblen, sizeof(voblen));
+ f.Write(&chunklen, sizeof(chunklen));
+ f.Write(chunks.GetData(), sizeof(vcchunk)*chunklen);
+ f.Close();
+
+ return(true);
+}
+
+// IVSFRipper
+
+STDMETHODIMP CVobSubFileRipper::SetCallBack(IVSFRipperCallback* pCallback)
+{
+ CAutoLock cAutoLock(&m_csCallback);
+ m_pCallback = pCallback;
+ return S_OK;
+}
+
+STDMETHODIMP CVobSubFileRipper::LoadParamFile(CString fn)
+{
+ CAutoLock cAutoLock(&m_csAccessLock);
+
+ m_rd.Reset();
+
+ CStdioFile f;
+ if(!f.Open(fn, CFile::modeRead|CFile::typeText))
+ return E_FAIL;
+
+ TCHAR langid[256];
+
+ enum {P_INPUT, P_OUTPUT, P_PGC, P_ANGLE, P_LANGS, P_OPTIONS};
+ int phase = P_INPUT;
+
+ CString line;
+ while(f.ReadString(line))
+ {
+ if(line.Trim().IsEmpty() || line[0] == '#') continue;
+
+ if(phase == P_INPUT)
+ {
+ if(S_OK != SetInput(line)) break;
+ phase = P_OUTPUT;
+ }
+ else if(phase == P_OUTPUT)
+ {
+ if(S_OK != SetOutput(line)) break;
+ phase = P_PGC;
+ }
+ else if(phase == P_PGC)
+ {
+ m_rd.iSelPGC = _tcstol(line, NULL, 10)-1;
+ if(m_rd.iSelPGC < 0 || m_rd.iSelPGC >= m_rd.pgcs.GetCount()) break;
+ phase = P_ANGLE;
+ }
+ else if(phase == 3)
+ {
+ PGC& pgc = m_rd.pgcs[m_rd.iSelPGC];
+
+ pgc.iSelAngle = _tcstol(line, NULL, 10);
+ if(pgc.iSelAngle < 0 || pgc.iSelAngle > max(1, pgc.nAngles) || pgc.iSelAngle > 9) break;
+
+ CAtlArray<vc_t>& angle = pgc.angles[pgc.iSelAngle];
+
+ if(line.Find('v') >= 0)
+ {
+ int vob = 0, cell = 0;
+
+ line += ' ';
+
+ TCHAR* s = (LPTSTR)(LPCTSTR)line;
+ TCHAR* e = s + line.GetLength();
+ while(s < e)
+ {
+ if(*s == 'v' || s == e-1)
+ {
+ s++;
+ if(vob != 0 && cell == 0)
+ {
+ for(int i = 0; i < angle.GetCount(); i++)
+ {
+ if(angle[i].vob == vob)
+ m_rd.selvcs.Add((angle[i].vob<<16)|angle[i].cell);
+ }
+ }
+
+ vob = _tcstol(s, &s, 10);
+ cell = 0;
+ }
+ else if(*s == 'c' && vob > 0)
+ {
+ s++;
+ cell = _tcstol(s, &s, 10);
+
+ for(int i = 0; i < angle.GetCount(); i++)
+ {
+ if(angle[i].vob == vob && angle[i].cell == cell)
+ {
+ m_rd.selvcs.Add((vob<<16)|cell);
+ break;
+ }
+ }
+ }
+ else
+ {
+ s++;
+ }
+ }
+ }
+ else
+ {
+ for(int i = 0; i < angle.GetCount(); i++)
+ m_rd.selvcs.Add((angle[i].vob<<16)|angle[i].cell);
+ }
+
+ phase = P_LANGS;
+ }
+ else if(phase == 4)
+ {
+ if(!line.CompareNoCase(_T("ALL")))
+ {
+ for(int i = 0; i < 32; i++) m_rd.selids[i] = true;
+ m_rd.fClosedCaption = true;
+ phase = P_OPTIONS;
+ }
+ else
+ {
+ line += ' ';
+
+ while(line.GetLength() > 0)
+ {
+ int n = line.Find(_T(" "));
+
+ CString lang = line.Left(n);
+
+ line = line.Mid(n);
+ line.TrimLeft();
+
+ n = 0;
+
+ int langnum;
+
+ if(_istdigit(lang[0]))
+ {
+ n = _stscanf(lang, _T("%d"), &langnum);
+ if(n != 1) break;
+
+ m_rd.selids[langnum] = true;
+ }
+ else if(_istalpha(lang[0]))
+ {
+ n = _stscanf(lang, _T("%s"), langid);
+ if(n != 1) break;
+
+ int id = (langid[0] << 8) + langid[1];
+
+ if(id == 'cc')
+ {
+ m_rd.fClosedCaption = true;
+ }
+ else
+ {
+ m_rd.selids[id] = true;
+ }
+ }
+ else break;
+
+ if(n != 1) break;
+ }
+
+ if((m_rd.selids.GetCount() > 0 || m_rd.fClosedCaption) && line.IsEmpty())
+ phase = P_OPTIONS;
+ }
+ }
+ else if(phase == 5 && !line.CompareNoCase(_T("CLOSE")))
+ m_rd.fClose = true;
+ else if(phase == 5 && !line.CompareNoCase(_T("BEEP")))
+ m_rd.fBeep = true;
+ else if(phase == 5 && !line.CompareNoCase(_T("RESETTIME")))
+ m_rd.fResetTime = true;
+ else if(phase == 5 && !line.CompareNoCase(_T("FORCEDONLY")))
+ m_rd.fForcedOnly = true;
+ else if(phase == 5 && !line.CompareNoCase(_T("CLOSEIGNOREERRORS")))
+ m_rd.fCloseIgnoreError = true;
+
+ }
+
+ m_rd.fAuto = true;
+
+ return phase == P_OPTIONS ? S_OK : E_FAIL;
+}
+
+STDMETHODIMP CVobSubFileRipper::SetInput(CString infn)
+{
+ CAutoLock cAutoLock(&m_csAccessLock);
+
+ m_rd.Reset();
+
+ if(!LoadIfo(infn) || !LoadVob(infn))
+ return E_INVALIDARG;
+
+ m_infn = infn;
+
+ return S_OK;
+}
+
+STDMETHODIMP CVobSubFileRipper::SetOutput(CString outfn)
+{
+ CAutoLock cAutoLock(&m_csAccessLock);
+ m_outfn = outfn;
+ return S_OK;
+}
+
+STDMETHODIMP CVobSubFileRipper::GetRipperData(VSFRipperData& rd)
+{
+ CAutoLock cAutoLock(&m_csAccessLock);
+ rd.Copy(m_rd);
+ return S_OK;
+}
+
+STDMETHODIMP CVobSubFileRipper::UpdateRipperData(VSFRipperData& rd)
+{
+ CAutoLock cAutoLock(&m_csAccessLock);
+ m_rd.Copy(rd);
+ return S_OK;
+}
+
+STDMETHODIMP CVobSubFileRipper::Index()
+{
+ if(m_fIndexing) return E_FAIL;
+ CAMThread::CallWorker(CMD_INDEX);
+ return S_OK;
+}
+
+
+STDMETHODIMP CVobSubFileRipper::IsIndexing()
+{
+ return m_fIndexing ? S_OK : S_FALSE;
+}
+
+STDMETHODIMP CVobSubFileRipper::Abort(bool fSavePartial)
+{
+ m_fBreakThread = true;
+ return S_OK;
+}
+
+//
+
+void VSFRipperData::Reset()
+{
+ vidsize.SetSize(0,0);
+ memset(&vidinfo, 0, sizeof(vidinfo));
+ pgcs.RemoveAll();
+ iSelPGC = -1;
+ fResetTime = fClosedCaption = true;
+ fForcedOnly = false;
+ fClose = fBeep = fAuto = false;
+ fCloseIgnoreError = false;
+
+ selvcs.RemoveAll();
+ selids.RemoveAll();
+}
+
+void VSFRipperData::Copy(VSFRipperData& rd)
+{
+ Reset();
+
+ vidsize = rd.vidsize;
+ vidinfo = rd.vidinfo;
+ if(int len = rd.pgcs.GetCount())
+ {
+ pgcs.SetCount(len);
+ for(int i = 0; i < len; i++)
+ {
+ PGC& src = rd.pgcs[i];
+ PGC& dst = pgcs[i];
+ dst.nAngles = src.nAngles;
+ for(int i = 0; i < countof(dst.angles); i++)
+ dst.angles[i].Copy(src.angles[i]);
+ dst.iSelAngle = src.iSelAngle;
+ memcpy(dst.pal, src.pal, sizeof(src.pal));
+ memcpy(dst.ids, src.ids, sizeof(src.ids));
+ }
+ }
+ iSelPGC = rd.iSelPGC;
+ fResetTime = rd.fResetTime;
+ fClosedCaption = rd.fClosedCaption;
+ fForcedOnly = rd.fForcedOnly;
+ fClose = rd.fClose;
+ fBeep = rd.fBeep;
+ fAuto = rd.fAuto;
+ fCloseIgnoreError = rd.fCloseIgnoreError;
+ selvcs.Copy(rd.selvcs);
+ POSITION pos = rd.selids.GetStartPosition();
+ while(pos)
+ {
+ BYTE key;
+ bool val;
+ rd.selids.GetNextAssoc(pos, key, val);
+ selids[key] = val;
+ }
+}
+
diff --git a/src/subtitles/VobSubFileRipper.h b/src/subtitles/VobSubFileRipper.h
new file mode 100644
index 000000000..2abccc4ad
--- /dev/null
+++ b/src/subtitles/VobSubFileRipper.h
@@ -0,0 +1,193 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+#include "..\decss\VobFile.h"
+#include "VobSubFile.h"
+
+#pragma pack(push)
+#pragma pack(1)
+
+typedef struct
+{
+ WORD perm_displ : 2;
+ WORD ratio : 2;
+ WORD system : 2;
+ WORD compression : 2;
+ WORD mode : 1;
+ WORD letterboxed : 1;
+ WORD source_res : 2;
+ WORD cbrvbr : 2;
+ WORD line21_2 : 1;
+ WORD line21_1 : 1;
+} vidinfo;
+
+typedef struct
+{
+ BYTE vob, cell;
+ DWORD tTime, tOffset, tTotal;
+ DWORD start, end;
+ int iAngle;
+ bool fDiscontinuity;
+} vc_t;
+
+typedef struct
+{
+ int nAngles;
+ CAtlArray<vc_t> angles[10];
+ int iSelAngle;
+ RGBQUAD pal[16];
+ WORD ids[32];
+} PGC;
+
+typedef struct VSFRipperData_t
+{
+ CSize vidsize;
+ vidinfo vidinfo;
+ CAtlArray<PGC> pgcs;
+ int iSelPGC;
+ bool fResetTime, fClosedCaption, fForcedOnly;
+
+ bool fClose, fBeep, fAuto; // only used by the UI externally, but may be set through the parameter file
+ bool fCloseIgnoreError;
+
+ CAtlArray<UINT> selvcs;
+ CAtlMap<BYTE, bool> selids;
+
+ void Reset();
+ void Copy(struct VSFRipperData_t& rd);
+
+} VSFRipperData;
+
+typedef struct {__int64 start, end; DWORD vc;} vcchunk;
+
+#pragma pack(pop)
+
+// note: these interfaces only meant to be used internally with static linking
+
+//
+// IVSFRipperCallback
+//
+
+[uuid("9E2EBB5C-AD7C-452f-A48B-38685716AC46")]
+interface IVSFRipperCallback : public IUnknown
+{
+ STDMETHOD (OnMessage) (LPCTSTR msg) PURE;
+ STDMETHOD (OnProgress) (double progress /*0->1*/) PURE;
+ STDMETHOD (OnFinished) (bool fSucceeded) PURE;
+};
+
+// IVSFRipperCallbackImpl
+
+#ifndef QI
+#define QI(i) (riid == __uuidof(i)) ? GetInterface((i*)this, ppv) :
+#endif
+
+class IVSFRipperCallbackImpl : public CUnknown, public IVSFRipperCallback
+{
+protected:
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv)
+ {
+ return
+ QI(IVSFRipperCallback)
+ __super::NonDelegatingQueryInterface(riid, ppv);
+ }
+
+ // IVSFRipperCallback
+ STDMETHODIMP OnMessage(LPCTSTR msg) {return S_FALSE;}
+ STDMETHODIMP OnProgress(double progress /*0->1*/) {return S_FALSE;}
+ STDMETHODIMP OnFinished(bool fSucceeded) {return S_FALSE;}
+
+public:
+ IVSFRipperCallbackImpl() : CUnknown(NAME("IVSFRipperCallbackImpl"), NULL) {}
+};
+
+//
+// IVSFRipper
+//
+
+[uuid("69F935BB-B8D0-43f5-AA2E-BBD0851CC9A6")]
+interface IVSFRipper : public IUnknown
+{
+ STDMETHOD (SetCallBack) (IVSFRipperCallback* pCallback) PURE;
+ STDMETHOD (LoadParamFile) (CString fn) PURE;
+ STDMETHOD (SetInput) (CString infn) PURE;
+ STDMETHOD (SetOutput) (CString outfn) PURE;
+ STDMETHOD (GetRipperData) (VSFRipperData& rd) PURE;
+ STDMETHOD (UpdateRipperData) (VSFRipperData& rd) PURE;
+ STDMETHOD (Index) () PURE;
+ STDMETHOD (IsIndexing) () PURE;
+ STDMETHOD (Abort) (bool fSavePartial) PURE;
+};
+
+class CVobSubFileRipper : public CVobSubFile, protected CAMThread, public IVSFRipper
+{
+private:
+ bool m_fThreadActive, m_fBreakThread, m_fIndexing;
+ enum {CMD_EXIT, CMD_INDEX};
+ DWORD ThreadProc();
+ bool Create();
+
+ //
+
+ typedef enum {LOG_INFO, LOG_WARNING, LOG_ERROR} log_t;
+ void Log(log_t type, LPCTSTR lpszFormat, ...);
+ void Progress(double progress);
+ void Finished(bool fSucceeded);
+
+ //
+
+ CCritSec m_csAccessLock;
+ CString m_infn, m_outfn;
+ CVobFile m_vob;
+ VSFRipperData m_rd;
+
+ bool LoadIfo(CString fn);
+ bool LoadVob(CString fn);
+ bool LoadChunks(CAtlArray<vcchunk>& chunks);
+ bool SaveChunks(CAtlArray<vcchunk>& chunks);
+
+ //
+
+ CCritSec m_csCallback;
+ CComPtr<IVSFRipperCallback> m_pCallback;
+
+public:
+ CVobSubFileRipper();
+ virtual ~CVobSubFileRipper();
+
+ DECLARE_IUNKNOWN
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+ // IVSFRipper
+ STDMETHODIMP SetCallBack(IVSFRipperCallback* pCallback);
+ STDMETHODIMP LoadParamFile(CString fn);
+ STDMETHODIMP SetInput(CString infn);
+ STDMETHODIMP SetOutput(CString outfn);
+ STDMETHODIMP GetRipperData(VSFRipperData& rd);
+ STDMETHODIMP UpdateRipperData(VSFRipperData& rd);
+ STDMETHODIMP Index();
+ STDMETHODIMP IsIndexing();
+ STDMETHODIMP Abort(bool fSavePartial);
+};
diff --git a/src/subtitles/VobSubImage.cpp b/src/subtitles/VobSubImage.cpp
new file mode 100644
index 000000000..211e8da47
--- /dev/null
+++ b/src/subtitles/VobSubImage.cpp
@@ -0,0 +1,1188 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "VobSubImage.h"
+
+CVobSubImage::CVobSubImage()
+{
+ iLang = iIdx = -1;
+ fForced = false;
+ start = delay = 0;
+ rect = CRect(0,0,0,0);
+ lpPixels = lpTemp1 = lpTemp2 = NULL;
+ org = CSize(0,0);
+}
+
+CVobSubImage::~CVobSubImage()
+{
+ Free();
+}
+
+bool CVobSubImage::Alloc(int w, int h)
+{
+ // if there is nothing to crop TrimSubImage might even add a 1 pixel
+ // wide border around the text, that's why we need a bit more memory
+ // to be allocated.
+
+ if(lpTemp1 == NULL || w*h > org.cx*org.cy)
+ {
+ Free();
+
+ lpTemp1 = new RGBQUAD[w*h];
+ if(!lpTemp1) return(false);
+
+ lpTemp2 = new RGBQUAD[(w+2)*(h+2)];
+ if(!lpTemp2) {delete [] lpTemp1; lpTemp1 = NULL; return(false);}
+
+ org.cx = w;
+ org.cy = h;
+ }
+
+ lpPixels = lpTemp1;
+
+ return(true);
+}
+
+void CVobSubImage::Free()
+{
+ if(lpTemp1) delete [] lpTemp1;
+ lpTemp1 = NULL;
+
+ if(lpTemp2) delete [] lpTemp2;
+ lpTemp2 = NULL;
+
+ lpPixels = NULL;
+}
+
+bool CVobSubImage::Decode(BYTE* lpData, int packetsize, int datasize,
+ bool fCustomPal,
+ int tridx,
+ RGBQUAD* orgpal /*[16]*/, RGBQUAD* cuspal /*[4]*/,
+ bool fTrim)
+{
+ GetPacketInfo(lpData, packetsize, datasize);
+
+ if(!Alloc(rect.Width(), rect.Height())) return(false);
+
+ lpPixels = lpTemp1;
+
+ nPlane = 0;
+ fAligned = 1;
+
+ this->fCustomPal = fCustomPal;
+ this->orgpal = orgpal;
+ this->tridx = tridx;
+ this->cuspal = cuspal;
+
+ CPoint p(rect.left, rect.top);
+
+ int end0 = nOffset[1];
+ int end1 = datasize;
+
+ while((nPlane == 0 && nOffset[0] < end0) || (nPlane == 1 && nOffset[1] < end1))
+ {
+ DWORD code;
+
+ if((code = GetNibble(lpData)) >= 0x4
+ || (code = (code << 4) | GetNibble(lpData)) >= 0x10
+ || (code = (code << 4) | GetNibble(lpData)) >= 0x40
+ || (code = (code << 4) | GetNibble(lpData)) >= 0x100)
+ {
+ DrawPixels(p, code >> 2, code & 3);
+ if((p.x += code >> 2) < rect.right) continue;
+ }
+
+ DrawPixels(p, rect.right - p.x, code & 3);
+
+ if(!fAligned) GetNibble(lpData); // align to byte
+
+ p.x = rect.left;
+ p.y++;
+ nPlane = 1 - nPlane;
+ }
+
+ rect.bottom = min(p.y, rect.bottom);
+
+ if(fTrim) TrimSubImage();
+
+ return(true);
+}
+
+void CVobSubImage::GetPacketInfo(BYTE* lpData, int packetsize, int datasize)
+{
+// delay = 0;
+
+ int i, nextctrlblk = datasize;
+ WORD pal = 0, tr = 0;
+
+ do
+ {
+ i = nextctrlblk;
+
+ int t = (lpData[i] << 8) | lpData[i+1]; i += 2;
+ nextctrlblk = (lpData[i] << 8) | lpData[i+1]; i += 2;
+
+ if(nextctrlblk > packetsize || nextctrlblk < datasize)
+ {
+ ASSERT(0);
+ return;
+ }
+
+ bool fBreak = false;
+
+ while(!fBreak)
+ {
+ int len = 0;
+
+ switch(lpData[i])
+ {
+ case 0x00: len = 0; break;
+ case 0x01: len = 0; break;
+ case 0x02: len = 0; break;
+ case 0x03: len = 2; break;
+ case 0x04: len = 2; break;
+ case 0x05: len = 6; break;
+ case 0x06: len = 4; break;
+ default: len = 0; break;
+ }
+
+ if(i+len >= packetsize)
+ {
+ TRACE(_T("Warning: Wrong subpicture parameter block ending\n"));
+ break;
+ }
+
+ switch(lpData[i++])
+ {
+ case 0x00: // forced start displaying
+ fForced = true;
+ break;
+ case 0x01: // start displaying
+ fForced = false;
+ break;
+ case 0x02: // stop displaying
+ delay = 1024 * t / 90;
+ break;
+ case 0x03:
+ pal = (lpData[i] << 8) | lpData[i+1]; i += 2;
+ break;
+ case 0x04:
+ tr = (lpData[i] << 8) | lpData[i+1]; i += 2;
+//tr &= 0x00f0;
+ break;
+ case 0x05:
+ rect = CRect((lpData[i] << 4) + (lpData[i+1] >> 4),
+ (lpData[i+3] << 4) + (lpData[i+4] >> 4),
+ ((lpData[i+1] & 0x0f) << 8) + lpData[i+2] + 1,
+ ((lpData[i+4] & 0x0f) << 8) + lpData[i+5] + 1);
+ i += 6;
+ break;
+ case 0x06:
+ nOffset[0] = (lpData[i] << 8) + lpData[i+1]; i += 2;
+ nOffset[1] = (lpData[i] << 8) + lpData[i+1]; i += 2;
+ break;
+ case 0xff: // end of ctrlblk
+ fBreak = true;
+ continue;
+ default: // skip this ctrlblk
+ fBreak = true;
+ break;
+ }
+ }
+ }
+ while(i <= nextctrlblk && i < packetsize);
+
+ for(i = 0; i < 4; i++)
+ {
+ this->pal[i].pal = (pal >> (i << 2)) & 0xf;
+ this->pal[i].tr = (tr >> (i << 2)) & 0xf;
+ }
+}
+
+BYTE CVobSubImage::GetNibble(BYTE* lpData)
+{
+ WORD& off = nOffset[nPlane];
+ BYTE ret = (lpData[off] >> (fAligned << 2)) & 0x0f;
+ fAligned = !fAligned;
+ off += fAligned;
+ return(ret);
+}
+
+void CVobSubImage::DrawPixels(CPoint p, int length, int colorid)
+{
+ if(length <= 0
+ || p.x + length < rect.left
+ || p.x >= rect.right
+ || p.y < rect.top
+ || p.y >= rect.bottom)
+ {
+ return;
+ }
+
+ if(p.x < rect.left) p.x = rect.left;
+ if(p.x + length >= rect.right) length = rect.right - p.x;
+
+ RGBQUAD* ptr = &lpPixels[rect.Width() * (p.y - rect.top) + (p.x - rect.left)];
+
+ RGBQUAD c;
+
+ if(!fCustomPal)
+ {
+ c = orgpal[pal[colorid].pal];
+ c.rgbReserved = (pal[colorid].tr<<4)|pal[colorid].tr;
+ }
+ else
+ {
+ c = cuspal[colorid];
+ }
+
+ while(length-- > 0) *ptr++ = c;
+}
+
+void CVobSubImage::TrimSubImage()
+{
+ CRect r;
+ r.left = rect.Width();
+ r.top = rect.Height();
+ r.right = 0;
+ r.bottom = 0;
+
+ RGBQUAD* ptr = lpTemp1;
+
+ for(int j = 0, y = rect.Height(); j < y; j++)
+ {
+ for(int i = 0, x = rect.Width(); i < x; i++, ptr++)
+ {
+ if(ptr->rgbReserved)
+ {
+ if(r.top > j) r.top = j;
+ if(r.bottom < j) r.bottom = j;
+ if(r.left > i) r.left = i;
+ if(r.right < i) r.right = i;
+ }
+ }
+ }
+
+ if(r.left > r.right || r.top > r.bottom) return;
+
+ r += CRect(0, 0, 1, 1);
+
+ r &= CRect(CPoint(0,0), rect.Size());
+
+ int w = r.Width(), h = r.Height();
+
+ DWORD offset = r.top*rect.Width() + r.left;
+
+ r += CRect(1, 1, 1, 1);
+
+ DWORD* src = (DWORD*)&lpTemp1[offset];
+ DWORD* dst = (DWORD*)&lpTemp2[1 + w + 1];
+
+ memset(lpTemp2, 0, (1 + w + 1)*sizeof(RGBQUAD));
+
+ for(int height = h; height; height--, src += rect.Width())
+ {
+ *dst++ = 0;
+ memcpy(dst, src, w*sizeof(RGBQUAD)); dst += w;
+ *dst++ = 0;
+ }
+
+ memset(dst, 0, (1 + w + 1)*sizeof(RGBQUAD));
+
+ lpPixels = lpTemp2;
+
+ rect = r + rect.TopLeft();
+}
+
+////////////////////////////////
+
+#include "RTS.h"
+#include <math.h>
+
+#define GP(xx, yy) (((xx) < 0 || (yy) < 0 || (xx) >= w || (yy) >= h) ? 0 : p[(yy)*w+(xx)])
+
+CAutoPtrList<COutline>* CVobSubImage::GetOutlineList(CPoint& topleft)
+{
+ int w = rect.Width(), h = rect.Height(), len = w*h;
+ if(len <= 0) return NULL;
+
+ CAutoVectorPtr<BYTE> p;
+ if(!p.Allocate(len)) return NULL;
+
+ CAutoPtrList<COutline>* ol = new CAutoPtrList<COutline>();
+ if(!ol) return NULL;
+
+ BYTE* cp = p;
+ RGBQUAD* rgbp = (RGBQUAD*)lpPixels;
+
+ for(int i = 0; i < len; i++, cp++, rgbp++)
+ *cp = !!rgbp->rgbReserved;
+
+ enum {UP, RIGHT, DOWN, LEFT};
+
+ topleft.x = topleft.y = INT_MAX;
+
+ while(1)
+ {
+ cp = p;
+
+ int x, y;
+
+ for(y = 0; y < h; y++)
+ {
+ for(x = 0; x < w-1; x++, cp++)
+ {
+ if(cp[0] == 0 && cp[1] == 1) break;
+ }
+
+ if(x < w-1) break;
+
+ cp++;
+ }
+
+ if(y == h) break;
+
+ int prevdir, dir = UP;
+
+ int ox = x, oy = y, odir = dir;
+
+ CAutoPtr<COutline> o(new COutline);
+ if(!o) break;
+
+ do
+ {
+ CPoint pp;
+ BYTE fl, fr, br;
+
+ prevdir = dir;
+
+ switch(prevdir)
+ {
+ case UP:
+ pp = CPoint(x+1, y);
+ fl = GP(x, y-1);
+ fr = GP(x+1, y-1);
+ br = GP(x+1, y);
+ break;
+ case RIGHT:
+ pp = CPoint(x+1, y+1);
+ fl = GP(x+1, y);
+ fr = GP(x+1, y+1);
+ br = GP(x, y+1);
+ break;
+ case DOWN:
+ pp = CPoint(x, y+1);
+ fl = GP(x, y+1);
+ fr = GP(x-1, y+1);
+ br = GP(x-1, y);
+ break;
+ case LEFT:
+ pp = CPoint(x, y);
+ fl = GP(x-1, y);
+ fr = GP(x-1, y-1);
+ br = GP(x, y-1);
+ break;
+ }
+
+ // turning left if:
+ // o . | o .
+ // ^ o | < o
+ // turning right if:
+ // x x | x >
+ // ^ o | x o
+ //
+ // o set, x empty, . can be anything
+
+ if(fl==1) dir = (dir-1+4)&3;
+ else if(fl!=1 && fr!=1 && br==1) dir = (dir+1)&3;
+ else if(p[y*w+x]&16) {ASSERT(0); break;} // we are going around in one place (this must not happen if the starting conditions were correct)
+
+ p[y*w+x] = (p[y*w+x]<<1) | 2; // increase turn count (== log2(highordbit(*p)))
+
+ switch(dir)
+ {
+ case UP:
+ if(prevdir == LEFT) {x--; y--;}
+ if(prevdir == UP) y--;
+ break;
+ case RIGHT:
+ if(prevdir == UP) {x++; y--;}
+ if(prevdir == RIGHT) x++;
+ break;
+ case DOWN:
+ if(prevdir == RIGHT) {x++; y++;}
+ if(prevdir == DOWN) y++;
+ break;
+ case LEFT:
+ if(prevdir == DOWN) {x--; y++;}
+ if(prevdir == LEFT) x--;
+ break;
+ }
+
+ int d = dir - prevdir;
+ o->Add(pp, d == 3 ? -1 : d == -3 ? 1 : d);
+
+ if(topleft.x > pp.x) topleft.x = pp.x;
+ if(topleft.y > pp.y) topleft.y = pp.y;
+ }
+ while(!(x == ox && y == oy && dir == odir));
+
+ if(o->pa.GetCount() > 0 && (x == ox && y == oy && dir == odir))
+ {
+ ol->AddTail(o);
+ }
+ else
+ {
+ ASSERT(0);
+ }
+ }
+
+ return(ol);
+}
+
+static bool FitLine(COutline& o, int& start, int& end)
+{
+ int len = o.pa.GetCount();
+ if(len < 7) return(false); // small segments should be handled with beziers...
+
+ for(start = 0; start < len && !o.da[start]; start++);
+ for(end = len-1; end > start && !o.da[end]; end--);
+
+ if(end-start < 8 || end-start < (len-end)+(start-0)) return(false);
+
+ CUIntArray la, ra;
+
+ int i, j, k;
+
+ for(i = start+1, j = end, k = start; i <= j; i++)
+ {
+ if(!o.da[i]) continue;
+ if(o.da[i] == o.da[k]) return(false);
+ if(o.da[i] == -1) la.Add(i-k);
+ else ra.Add(i-k);
+ k = i;
+ }
+
+ bool fl = true, fr = true;
+
+ // these tests are completly heuristic and might be redundant a bit...
+
+ for(i = 0, j = la.GetSize(); i < j && fl; i++) {if(la[i] != 1) fl = false;}
+ for(i = 0, j = ra.GetSize(); i < j && fr; i++) {if(ra[i] != 1) fr = false;}
+
+ if(!fl && !fr) return(false); // can't be a line if there are bigger steps than one in both directions (lines are usually drawn by stepping one either horizontally or vertically)
+ if(fl && fr && 1.0*(end-start)/((len-end)*2+(start-0)*2) > 0.4) return(false); // if this section is relatively too small it may only be a rounded corner
+ if(!fl && la.GetSize() > 0 && la.GetSize() <= 4 && (la[0] == 1 && la[la.GetSize()-1] == 1)) return(false); // one step at both ends, doesn't sound good for a line (may be it was skewed, so only eliminate smaller sections where beziers going to look just as good)
+ if(!fr && ra.GetSize() > 0 && ra.GetSize() <= 4 && (ra[0] == 1 && ra[ra.GetSize()-1] == 1)) return(false); // -''-
+
+ CUIntArray& a = !fl ? la : ra;
+
+ len = a.GetSize();
+
+ int sum = 0;
+
+ for(i = 0, j = INT_MAX, k = 0; i < len; i++)
+ {
+ if(j > a[i]) j = a[i];
+ if(k < a[i]) k = a[i];
+ sum += a[i];
+ }
+
+ if(k - j > 2 && 1.0*sum/len < 2) return(false);
+ if(k - j > 2 && 1.0*sum/len >= 2 && len < 4) return(false);
+
+ if((la.GetSize()/2+ra.GetSize()/2)/2 <= 2)
+ {
+ if((k+j)/2 < 2 && k*j!=1) return(false);
+ }
+
+ double err = 0;
+
+ CPoint sp = o.pa[start], ep = o.pa[end];
+
+ double minerr = 0, maxerr = 0;
+
+ double vx = ep.x - sp.x, vy = ep.y - sp.y, l = sqrt(vx*vx+vy*vy);
+ vx /= l; vy /= l;
+
+ for(i = start+1, j = end-1; i <= j; i++)
+ {
+ CPoint p = o.pa[i], dp = p - sp;
+ double t = vx*dp.x+vy*dp.y, dx = vx*t + sp.x - p.x, dy = vy*t + sp.y - p.y;
+ t = dx*dx+dy*dy;
+ err += t;
+ t = sqrt(t);
+ if(vy*dx-dy*vx < 0) {if(minerr > -t) minerr = -t;}
+ else {if(maxerr < t) maxerr = t;}
+ }
+
+ return((maxerr-minerr)/l < 0.1 || err/l < 1.5 || (fabs(maxerr) < 8 && fabs(minerr) < 8));
+}
+
+static int CalcPossibleCurveDegree(COutline& o)
+{
+ int len2 = o.da.GetCount();
+
+ CUIntArray la;
+
+ for(int i = 0, j = 0; j < len2; j++)
+ {
+ if(j == len2-1 || o.da[j])
+ {
+ la.Add(j-i);
+ i = j;
+ }
+ }
+
+ int len = la.GetCount();
+
+ int ret = 0;
+
+ // check if we can find a reason to add a penalty degree, or two :P
+ // it is mainly about looking for distant corners
+ {
+ int penalty = 0;
+
+ int ma[2] = {0, 0};
+ for(int i = 0; i < len; i++) ma[i&1] += la[i];
+
+ int ca[2] = {ma[0], ma[1]};
+ for(int i = 0; i < len; i++)
+ {
+ ca[i&1] -= la[i];
+
+ double c1 = 1.0*ca[0]/ma[0], c2 = 1.0*ca[1]/ma[1], c3 = 1.0*la[i]/ma[i&1];
+
+ if(len2 > 16 && (fabs(c1-c2) > 0.7 || (c3 > 0.6 && la[i] > 5)))
+ {penalty = 2; break;}
+
+ if(fabs(c1-c2) > 0.6 || (c3 > 0.4 && la[i] > 5))
+ {penalty = 1;}
+ }
+
+ ret += penalty;
+ }
+
+ la[0] <<= 1;
+ la[len-1] <<= 1;
+
+ for(int i = 0; i < len; i+=2)
+ {
+ if(la[i] > 1) {ret++; i--;} // prependicular to the last chosen section and bigger then 1 -> add a degree and continue with the other dir
+ }
+
+ return(ret);
+}
+
+inline double vectlen(CPoint p)
+{
+ return(sqrt((double)(p.x*p.x+p.y*p.y)));
+}
+
+inline double vectlen(CPoint p1, CPoint p2)
+{
+ return(vectlen(p2 - p1));
+}
+
+static bool MinMaxCosfi(COutline& o, double& mincf, double& maxcf) // not really cosfi, it is weighted by the distance from the segment endpoints, and since it would be always between -1 and 0, the applied sign marks side
+{
+ CAtlArray<CPoint>& pa = o.pa;
+
+ int len = (int)pa.GetCount();
+ if(len < 6) return(false);
+
+ mincf = 1;
+ maxcf = -1;
+
+ CPoint p = pa[len-1] - pa[0];
+ double l = vectlen(p);
+
+ for(int i = 2; i < len-2; i++) // skip the endpoints, they aren't accurate
+ {
+ CPoint p1 = pa[0] - pa[i], p2 = pa[len-1] - pa[i];
+ double l1 = vectlen(p1), l2 = vectlen(p2);
+ int sign = p1.x*p.y-p1.y*p.x >= 0 ? 1 : -1;
+
+ double c = (1.0*len/2 - fabs(i - 1.0*len/2)) / len * 2; // c: 0 -> 1 -> 0
+
+ double cosfi = (1+(p1.x*p2.x+p1.y*p2.y)/(l1*l2)) * sign * c;
+ if(mincf > cosfi) mincf = cosfi;
+ if(maxcf < cosfi) maxcf = cosfi;
+ }
+
+ return(true);
+}
+
+static bool FitBezierVH(COutline& o, CPoint& p1, CPoint& p2)
+{
+ int i;
+
+ CAtlArray<CPoint>& pa = o.pa;
+
+ int len = (int)pa.GetCount();
+
+ if(len <= 1)
+ {
+ return(false);
+ }
+ else if(len == 2)
+ {
+ CPoint mid = pa[0]+pa[1];
+ mid.x >>= 1;
+ mid.y >>= 1;
+ p1 = p2 = mid;
+ return(true);
+ }
+
+ CPoint dir1 = pa[1] - pa[0], dir2 = pa[len-2] - pa[len-1];
+ if((dir1.x&&dir1.y)||(dir2.x&&dir2.y))
+ return(false); // we are only fitting beziers with hor./ver. endings
+
+ if(CalcPossibleCurveDegree(o) > 3)
+ return(false);
+
+ double mincf, maxcf;
+ if(MinMaxCosfi(o, mincf, maxcf))
+ {
+ if(maxcf-mincf > 0.8
+ || maxcf-mincf > 0.6 && (maxcf >= 0.4 || mincf <= -0.4))
+ return(false);
+ }
+
+ CPoint p0 = p1 = pa[0];
+ CPoint p3 = p2 = pa[len-1];
+
+ CAtlArray<double> pl;
+ pl.SetCount(len);
+
+ double c10 = 0, c11 = 0, c12 = 0, c13 = 0, c1x = 0, c1y = 0;
+ double c20 = 0, c21 = 0, c22 = 0, c23 = 0, c2x = 0, c2y = 0;
+ double length = 0;
+
+ for(pl[0] = 0, i = 1; i < len; i++)
+ {
+ CPoint diff = (pa[i] - pa[i-1]);
+ pl[i] = (length += sqrt((double)(diff.x*diff.x+diff.y*diff.y)));
+ }
+
+ for(i = 0; i < len; i++)
+ {
+ double t1 = pl[i] / length;
+ double t2 = t1*t1;
+ double t3 = t2*t1;
+ double it1 = 1 - t1;
+ double it2 = it1*it1;
+ double it3 = it2*it1;
+
+ double dc1 = 3.0*it2*t1;
+ double dc2 = 3.0*it1*t2;
+
+ c10 += it3*dc1;
+ c11 += dc1*dc1;
+ c12 += dc2*dc1;
+ c13 += t3*dc1;
+ c1x += pa[i].x*dc1;
+ c1y += pa[i].y*dc1;
+
+ c20 += it3*dc2;
+ c21 += dc1*dc2;
+ c22 += dc2*dc2;
+ c23 += t3*dc2;
+ c2x += pa[i].x*dc2;
+ c2y += pa[i].y*dc2;
+ }
+
+ if(dir1.y == 0 && dir2.x == 0)
+ {
+ p1.x = (int)((c1x - c10*p0.x - c12*p3.x - c13*p3.x) / c11 + 0.5);
+ p2.y = (int)((c2y - c20*p0.y - c21*p0.y - c23*p3.y) / c22 + 0.5);
+ }
+ else if(dir1.x == 0 && dir2.y == 0)
+ {
+ p2.x = (int)((c2x - c20*p0.x - c21*p0.x - c23*p3.x) / c22 + 0.5);
+ p1.y = (int)((c1y - c10*p0.y - c12*p3.y - c13*p3.y) / c11 + 0.5);
+ }
+ else if(dir1.y == 0 && dir2.y == 0)
+ {
+ // cramer's rule
+ double D = c11*c22 - c12*c21;
+ p1.x = (int)(((c1x-c10*p0.x-c13*p3.x)*c22 - c12*(c2x-c20*p0.x-c23*p3.x)) / D + 0.5);
+ p2.x = (int)((c11*(c2x-c20*p0.x-c23*p3.x) - (c1x-c10*p0.x-c13*p3.x)*c21) / D + 0.5);
+ }
+ else if(dir1.x == 0 && dir2.x == 0)
+ {
+ // cramer's rule
+ double D = c11*c22 - c12*c21;
+ p1.y = (int)(((c1y-c10*p0.y-c13*p3.y)*c22 - c12*(c2y-c20*p0.y-c23*p3.y)) / D + 0.5);
+ p2.y = (int)((c11*(c2y-c20*p0.y-c23*p3.y) - (c1y-c10*p0.y-c13*p3.y)*c21) / D + 0.5);
+ }
+ else // must not happen
+ {
+ ASSERT(0);
+ return(false);
+ }
+
+ // check for "inside-out" beziers
+ CPoint dir3 = p1 - p0, dir4 = p2 - p3;
+ if((dir1.x*dir3.x+dir1.y*dir3.y) <= 0 || (dir2.x*dir4.x+dir2.y*dir4.y) <= 0)
+ return(false);
+
+ return(true);
+}
+
+int CVobSubImage::GrabSegment(int start, COutline& o, COutline& ret)
+{
+ ret.RemoveAll();
+
+ int len = o.pa.GetCount();
+
+ int cur = (start)%len, first = -1, last = -1;
+ int curDir = 0, lastDir = 0;
+
+ for(int i = 0; i < len; i++)
+ {
+ cur = (cur+1)%len;
+
+ if(o.da[cur] == 0) continue;
+
+ if(first == -1) first = cur;
+
+ if(lastDir == o.da[cur])
+ {
+ CPoint startp = o.pa[first]+o.pa[start]; startp.x >>= 1; startp.y >>= 1;
+ CPoint endp = o.pa[last]+o.pa[cur]; endp.x >>= 1; endp.y >>= 1;
+
+ if(first < start) first += len;
+ start = ((start+first)>>1)+1;
+ if(start >= len) start -= len;
+ if(cur < last) cur += len;
+ cur = ((last+cur+1)>>1);
+ if(cur >= len) cur -= len;
+
+ ret.Add(startp, 0);
+
+ while(start != cur)
+ {
+ ret.Add(o.pa[start], o.da[start]);
+
+ start++;
+ if(start >= len) start -= len;
+ }
+
+ ret.Add(endp, 0);
+
+ return(last);
+ }
+
+ lastDir = o.da[cur];
+ last = cur;
+ }
+
+ ASSERT(0);
+
+ return(start);
+}
+
+void CVobSubImage::SplitOutline(COutline& o, COutline& o1, COutline& o2)
+{
+ int len = o.pa.GetCount();
+ if(len < 4) return;
+
+ CAtlArray<UINT> la, sa, ea;
+
+ int i, j, k;
+
+ for(i = 0, j = 0; j < len; j++)
+ {
+ if(j == len-1 || o.da[j])
+ {
+ la.Add(j-i);
+ sa.Add(i);
+ ea.Add(j);
+ i = j;
+ }
+ }
+
+ int maxlen = 0, maxidx = -1;
+ int maxlen2 = 0, maxidx2 = -1;
+
+ for(i = 0; i < la.GetCount(); i++)
+ {
+ if(maxlen < la[i])
+ {
+ maxlen = la[i];
+ maxidx = i;
+ }
+
+ if(maxlen2 < la[i] && i > 0 && i < la.GetCount()-1)
+ {
+ maxlen2 = la[i];
+ maxidx2 = i;
+ }
+ }
+
+ if(maxlen == maxlen2) maxidx = maxidx2; // if equal choose the inner section
+
+ j = (sa[maxidx] + ea[maxidx]) >> 1, k = (sa[maxidx] + ea[maxidx] + 1) >> 1;
+
+ o1.RemoveAll();
+ o2.RemoveAll();
+
+ for(i = 0; i <= j; i++)
+ o1.Add(o.pa[i], o.da[i]);
+
+ if(j != k)
+ {
+ CPoint mid = o.pa[j]+o.pa[k]; mid.x >>= 1; mid.y >>= 1;
+ o1.Add(mid, 0);
+ o2.Add(mid, 0);
+ }
+
+ for(i = k; i < len; i++)
+ o2.Add(o.pa[i], o.da[i]);
+}
+
+void CVobSubImage::AddSegment(COutline& o, CAtlArray<BYTE>& pathTypes, CAtlArray<CPoint>& pathPoints)
+{
+ int i, len = o.pa.GetCount();
+ if(len < 3) return;
+
+ int nLeftTurns = 0, nRightTurns = 0;
+
+ for(i = 0; i < len; i++)
+ {
+ if(o.da[i] == -1) nLeftTurns++;
+ else if(o.da[i] == 1) nRightTurns++;
+ }
+
+ if(nLeftTurns == 0 && nRightTurns == 0) // line
+ {
+ pathTypes.Add(PT_LINETO);
+ pathPoints.Add(o.pa[len-1]);
+
+ return;
+ }
+
+ if(nLeftTurns == 0 || nRightTurns == 0) // b-spline
+ {
+ pathTypes.Add(PT_MOVETONC);
+ pathPoints.Add(o.pa[0]+(o.pa[0]-o.pa[1]));
+
+ for(i = 0; i < 3; i++)
+ {
+ pathTypes.Add(PT_BSPLINETO);
+ pathPoints.Add(o.pa[i]);
+ }
+
+ for(; i < len; i++)
+ {
+ pathTypes.Add(PT_BSPLINEPATCHTO);
+ pathPoints.Add(o.pa[i]);
+ }
+
+ pathTypes.Add(PT_BSPLINEPATCHTO);
+ pathPoints.Add(o.pa[len-1]+(o.pa[len-1]-o.pa[len-2]));
+
+ pathTypes.Add(PT_MOVETONC);
+ pathPoints.Add(o.pa[len-1]);
+
+ return;
+ }
+
+ int start, end;
+ if(FitLine(o, start, end)) // b-spline, line, b-spline
+ {
+ pathTypes.Add(PT_MOVETONC);
+ pathPoints.Add(o.pa[0]+(o.pa[0]-o.pa[1]));
+
+ pathTypes.Add(PT_BSPLINETO);
+ pathPoints.Add(o.pa[0]);
+
+ pathTypes.Add(PT_BSPLINETO);
+ pathPoints.Add(o.pa[1]);
+
+ CPoint p[4], pp, d = o.pa[end] - o.pa[start];
+ double l = sqrt((double)(d.x*d.x+d.y*d.y)), dx = 1.0 * d.x / l, dy = 1.0 * d.y / l;
+
+ pp = o.pa[start]-o.pa[start-1];
+ double l1 = abs(pp.x)+abs(pp.y);
+ pp = o.pa[end]-o.pa[end+1];
+ double l2 = abs(pp.x)+abs(pp.y);
+ p[0] = CPoint((int)(1.0 * o.pa[start].x + dx*l1 + 0.5), (int)(1.0 * o.pa[start].y + dy*l1 + 0.5));
+ p[1] = CPoint((int)(1.0 * o.pa[start].x + dx*l1*2 + 0.5), (int)(1.0 * o.pa[start].y + dy*l1*2 + 0.5));
+ p[2] = CPoint((int)(1.0 * o.pa[end].x - dx*l2*2 + 0.5), (int)(1.0 * o.pa[end].y - dy*l2*2 + 0.5));
+ p[3] = CPoint((int)(1.0 * o.pa[end].x - dx*l2 + 0.5), (int)(1.0 * o.pa[end].y - dy*l2 + 0.5));
+
+ if(start == 1)
+ {
+ pathTypes.Add(PT_BSPLINETO);
+ pathPoints.Add(p[0]);
+ }
+ else
+ {
+ pathTypes.Add(PT_BSPLINETO);
+ pathPoints.Add(o.pa[2]);
+
+ for(int i = 3; i <= start; i++)
+ {
+ pathTypes.Add(PT_BSPLINEPATCHTO);
+ pathPoints.Add(o.pa[i]);
+ }
+
+ pathTypes.Add(PT_BSPLINEPATCHTO);
+ pathPoints.Add(p[0]);
+ }
+
+ pathTypes.Add(PT_BSPLINEPATCHTO);
+ pathPoints.Add(p[1]);
+
+ pathTypes.Add(PT_MOVETONC);
+ pathPoints.Add(p[0]);
+
+ pathTypes.Add(PT_LINETO);
+ pathPoints.Add(p[3]);
+
+ pathTypes.Add(PT_MOVETONC);
+ pathPoints.Add(p[2]);
+
+ pathTypes.Add(PT_BSPLINEPATCHTO);
+ pathPoints.Add(p[3]);
+
+ for(i = end; i < len; i++)
+ {
+ pathTypes.Add(PT_BSPLINEPATCHTO);
+ pathPoints.Add(o.pa[i]);
+ }
+
+ pathTypes.Add(PT_BSPLINEPATCHTO);
+ pathPoints.Add(o.pa[len-1]+(o.pa[len-1]-o.pa[len-2]));
+
+ pathTypes.Add(PT_MOVETONC);
+ pathPoints.Add(o.pa[len-1]);
+
+ return;
+ }
+
+ CPoint p1, p2;
+ if(FitBezierVH(o, p1, p2)) // bezier
+ {
+ pathTypes.Add(PT_BEZIERTO);
+ pathPoints.Add(p1);
+ pathTypes.Add(PT_BEZIERTO);
+ pathPoints.Add(p2);
+ pathTypes.Add(PT_BEZIERTO);
+ pathPoints.Add(o.pa[o.pa.GetCount()-1]);
+
+ return;
+ }
+
+ COutline o1, o2;
+ SplitOutline(o, o1, o2);
+ AddSegment(o1, pathTypes, pathPoints);
+ AddSegment(o2, pathTypes, pathPoints);
+}
+
+bool CVobSubImage::Polygonize(CAtlArray<BYTE>& pathTypes, CAtlArray<CPoint>& pathPoints, bool fSmooth, int scale)
+{
+ CPoint topleft;
+ CAutoPtr<CAutoPtrList<COutline> > ol(GetOutlineList(topleft));
+ if(!ol) return(false);
+
+ POSITION pos;
+
+ pos = ol->GetHeadPosition();
+ while(pos)
+ {
+ CAtlArray<CPoint>& pa = ol->GetNext(pos)->pa;
+ for(int i = 0; i < pa.GetCount(); i++)
+ {
+ pa[i].x = (pa[i].x-topleft.x)<<scale;
+ pa[i].y = (pa[i].y-topleft.y)<<scale;
+ }
+ }
+
+ pos = ol->GetHeadPosition();
+ while(pos)
+ {
+ COutline& o = *ol->GetNext(pos), o2;
+
+ if(fSmooth)
+ {
+ int i = 0, iFirst = -1;
+
+ while(1)
+ {
+ i = GrabSegment(i, o, o2);
+
+ if(i == iFirst) break;
+
+ if(iFirst < 0)
+ {
+ iFirst = i;
+ pathTypes.Add(PT_MOVETO);
+ pathPoints.Add(o2.pa[0]);
+ }
+
+ AddSegment(o2, pathTypes, pathPoints);
+ }
+ }
+ else
+ {
+/*
+ for(int i = 1, len = o.pa.GetSize(); i < len; i++)
+ {
+ if(int dir = o.da[i-1])
+ {
+ CPoint dir2 = o.pa[i] - o.pa[i-1];
+ dir2.x /= 2; dir2.y /= 2;
+ CPoint dir1 = dir > 0 ? CPoint(dir2.y, -dir2.x) : CPoint(-dir2.y, dir2.x);
+ i = i;
+ o.pa[i-1] -= dir1;
+ o.pa.InsertAt(i, o.pa[i-1] + dir2);
+ o.da.InsertAt(i, -dir);
+ o.pa.InsertAt(i+1, o.pa[i] + dir1);
+ o.da.InsertAt(i+1, dir);
+ i += 2;
+ len += 2;
+ }
+ }
+*/
+ pathTypes.Add(PT_MOVETO);
+ pathPoints.Add(o.pa[0]);
+
+ for(int i = 1, len = o.pa.GetCount(); i < len; i++)
+ {
+ pathTypes.Add(PT_LINETO);
+ pathPoints.Add(o.pa[i]);
+ }
+ }
+ }
+
+ return !pathTypes.IsEmpty();
+}
+
+bool CVobSubImage::Polygonize(CStringW& assstr, bool fSmooth, int scale)
+{
+ CAtlArray<BYTE> pathTypes;
+ CAtlArray<CPoint> pathPoints;
+
+ if(!Polygonize(pathTypes, pathPoints, fSmooth, scale))
+ return(false);
+
+ assstr.Format(L"{\\an7\\pos(%d,%d)\\p%d}", rect.left, rect.top, 1+scale);
+// assstr.Format(L"{\\p%d}", 1+scale);
+
+ BYTE lastType = 0;
+
+ int nPoints = pathTypes.GetCount();
+
+ for(int i = 0; i < nPoints; i++)
+ {
+ CStringW s;
+
+ switch(pathTypes[i])
+ {
+ case PT_MOVETO:
+ if(lastType != PT_MOVETO) assstr += L"m ";
+ s.Format(L"%d %d ", pathPoints[i].x, pathPoints[i].y);
+ break;
+ case PT_MOVETONC:
+ if(lastType != PT_MOVETONC) assstr += L"n ";
+ s.Format(L"%d %d ", pathPoints[i].x, pathPoints[i].y);
+ break;
+ case PT_LINETO:
+ if(lastType != PT_LINETO) assstr += L"l ";
+ s.Format(L"%d %d ", pathPoints[i].x, pathPoints[i].y);
+ break;
+ case PT_BEZIERTO:
+ if(i < nPoints-2)
+ {
+ if(lastType != PT_BEZIERTO) assstr += L"b ";
+ s.Format(L"%d %d %d %d %d %d ", pathPoints[i].x, pathPoints[i].y, pathPoints[i+1].x, pathPoints[i+1].y, pathPoints[i+2].x, pathPoints[i+2].y);
+ i+=2;
+ }
+ break;
+ case PT_BSPLINETO:
+ if(i < nPoints-2)
+ {
+ if(lastType != PT_BSPLINETO) assstr += L"s ";
+ s.Format(L"%d %d %d %d %d %d ", pathPoints[i].x, pathPoints[i].y, pathPoints[i+1].x, pathPoints[i+1].y, pathPoints[i+2].x, pathPoints[i+2].y);
+ i+=2;
+ }
+ break;
+ case PT_BSPLINEPATCHTO:
+ if(lastType != PT_BSPLINEPATCHTO) assstr += L"p ";
+ s.Format(L"%d %d ", pathPoints[i].x, pathPoints[i].y);
+ break;
+ }
+
+ lastType = pathTypes[i];
+
+ assstr += s;
+ }
+
+ assstr += L"{\\p0}";
+
+ return nPoints > 0;
+}
+
+void CVobSubImage::Scale2x()
+{
+ int w = rect.Width(), h = rect.Height();
+
+ DWORD* src = (DWORD*)lpPixels;
+ DWORD* dst = new DWORD[w*h];
+
+ for(int y = 0; y < h; y++)
+ {
+ for(int x = 0; x < w; x++, src++, dst++)
+ {
+ DWORD E = *src;
+
+ DWORD A = x > 0 && y > 0 ? src[-w-1] : E;
+ DWORD B = y > 0 ? src[-w] : E;
+ DWORD C = x < w-1 && y > 0 ? src[-w+1] : E;
+
+ DWORD D = x > 0 ? src[-1] : E;;
+ DWORD F = x < w-1 ? src[+1] : E;;
+
+ DWORD G = x > 0 && y < h-1 ? src[+w-1] : E;
+ DWORD H = y < h-1 ? src[+w] : E;
+ DWORD I = x < w-1 && y < h-1 ? src[+w+1] : E;
+
+ DWORD E0 = D == B && B != F && D != H ? D : E;
+ DWORD E1 = B == F && B != D && F != H ? F : E;
+ DWORD E2 = D == H && D != B && H != F ? D : E;
+ DWORD E3 = H == F && D != H && B != F ? F : E;
+
+ *dst = ((((E0&0x00ff00ff)+(E1&0x00ff00ff)+(E2&0x00ff00ff)+(E3&0x00ff00ff)+2)>>2)&0x00ff00ff)
+ | (((((E0>>8)&0x00ff00ff)+((E1>>8)&0x00ff00ff)+((E2>>8)&0x00ff00ff)+((E3>>8)&0x00ff00ff)+2)<<6)&0xff00ff00);
+ }
+ }
+
+ src -= w*h;
+ dst -= w*h;
+
+ memcpy(src, dst, w*h*4);
+
+ delete [] dst;
+}
diff --git a/src/subtitles/VobSubImage.h b/src/subtitles/VobSubImage.h
new file mode 100644
index 000000000..13a990c8f
--- /dev/null
+++ b/src/subtitles/VobSubImage.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include <atlcoll.h>
+
+typedef struct
+{
+ CAtlArray<CPoint> pa;
+ CAtlArray<int> da;
+ void RemoveAll() {pa.RemoveAll(); da.RemoveAll();}
+ void Add(CPoint p, int d) {pa.Add(p); da.Add(d);}
+} COutline;
+
+class CVobSubImage
+{
+ friend class CVobSubFile;
+
+private:
+ CSize org;
+ RGBQUAD* lpTemp1;
+ RGBQUAD* lpTemp2;
+
+ WORD nOffset[2], nPlane;
+ bool fCustomPal;
+ char fAligned; // we are also using this for calculations, that's why it is char instead of bool...
+ int tridx;
+ RGBQUAD* orgpal /*[16]*/,* cuspal /*[4]*/;
+
+ bool Alloc(int w, int h);
+ void Free();
+
+ BYTE GetNibble(BYTE* lpData);
+ void DrawPixels(CPoint p, int length, int colorid);
+ void TrimSubImage();
+
+public:
+ int iLang, iIdx;
+ bool fForced;
+ __int64 start, delay;
+ CRect rect;
+ typedef struct {BYTE pal:4, tr:4;} SubPal;
+ SubPal pal[4];
+ RGBQUAD* lpPixels;
+
+ CVobSubImage();
+ virtual ~CVobSubImage();
+
+ void Invalidate() {iLang = iIdx = -1;}
+
+ void GetPacketInfo(BYTE* lpData, int packetsize, int datasize);
+ bool Decode(BYTE* lpData, int packetsize, int datasize,
+ bool fCustomPal,
+ int tridx,
+ RGBQUAD* orgpal /*[16]*/, RGBQUAD* cuspal /*[4]*/,
+ bool fTrim);
+
+ /////////
+
+private:
+ CAutoPtrList<COutline>* GetOutlineList(CPoint& topleft);
+ int GrabSegment(int start, COutline& o, COutline& ret);
+ void SplitOutline(COutline& o, COutline& o1, COutline& o2);
+ void AddSegment(COutline& o, CAtlArray<BYTE>& pathTypes, CAtlArray<CPoint>& pathPoints);
+
+public:
+ bool Polygonize(CAtlArray<BYTE>& pathTypes, CAtlArray<CPoint>& pathPoints, bool fSmooth, int scale);
+ bool Polygonize(CStringW& assstr, bool fSmooth = true, int scale = 3);
+
+ void Scale2x();
+};
diff --git a/src/subtitles/libssf/Exception.cpp b/src/subtitles/libssf/Exception.cpp
new file mode 100644
index 000000000..56b72d1e7
--- /dev/null
+++ b/src/subtitles/libssf/Exception.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "Exception.h"
+
+namespace ssf
+{
+ Exception::Exception(LPCTSTR fmt, ...)
+ {
+ va_list args;
+ va_start(args, fmt);
+ int len = _vsctprintf(fmt, args) + 1;
+ if(len > 0) _vstprintf_s(m_msg.GetBufferSetLength(len), len, fmt, args);
+ va_end(args);
+ }
+} \ No newline at end of file
diff --git a/src/subtitles/libssf/Exception.h b/src/subtitles/libssf/Exception.h
new file mode 100644
index 000000000..0141e9f06
--- /dev/null
+++ b/src/subtitles/libssf/Exception.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+namespace ssf
+{
+ class Exception
+ {
+ CString m_msg;
+
+ public:
+ Exception(LPCTSTR fmt, ...);
+
+ CString ToString() {return m_msg;}
+ };
+} \ No newline at end of file
diff --git a/src/subtitles/libssf/File.cpp b/src/subtitles/libssf/File.cpp
new file mode 100644
index 000000000..c8b996cdf
--- /dev/null
+++ b/src/subtitles/libssf/File.cpp
@@ -0,0 +1,261 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "File.h"
+
+#ifndef _istcsym
+#define _istcsym(c) (_istalnum(c) || (c) == '_')
+#endif
+
+namespace ssf
+{
+ File::File()
+ {
+ }
+
+ File::~File()
+ {
+ }
+
+ void File::Parse(Stream& s, LPCTSTR predef)
+ {
+ Reference* pRef = CreateRootRef();
+
+ SetDefaultPriority(PLow);
+
+ try {ParseDefs(CharacterStream(predef), pRef);}
+ catch(Exception& e) {ASSERT(0); TRACE(_T("%s\n"), e.ToString());}
+
+ SetDefaultPriority(PNormal);
+
+ ParseDefs(s, pRef);
+
+ Commit();
+
+ if(s.PeekChar() != Stream::EOS)
+ {
+ TRACE(_T("Warning: parsing ended before EOF!\n"));
+ }
+ }
+
+ void File::ParseDefs(Stream& s, Reference* pParentRef)
+ {
+ while(s.SkipWhiteSpace(_T(";")) != '}' && s.PeekChar() != Stream::EOS)
+ {
+ NodePriority priority = PNormal;
+ CAtlList<CString> types;
+ CString name;
+
+ int c = s.SkipWhiteSpace();
+
+ if(c == '*') {s.GetChar(); priority = PLow;}
+ else if(c == '!') {s.GetChar(); priority = PHigh;}
+
+ ParseTypes(s, types);
+
+ if(s.SkipWhiteSpace() == '#')
+ {
+ s.GetChar();
+ ParseName(s, name);
+ }
+
+ if(types.IsEmpty())
+ {
+ if(name.IsEmpty()) s.ThrowError(_T("syntax error"));
+ types.AddTail(_T("?"));
+ }
+
+ Reference* pRef = pParentRef;
+
+ while(types.GetCount() > 1)
+ pRef = CreateRef(CreateDef(pRef, types.RemoveHead()));
+
+ Definition* pDef = NULL;
+
+ if(!types.IsEmpty())
+ pDef = CreateDef(pRef, types.RemoveHead(), name, priority);
+
+ c = s.SkipWhiteSpace(_T(":="));
+
+ if(c == '"' || c == '\'') ParseQuotedString(s, pDef);
+ else if(_istdigit(c) || c == '+' || c == '-') ParseNumber(s, pDef);
+ else if(pDef->IsType(_T("@"))) ParseBlock(s, pDef);
+ else ParseRefs(s, pDef);
+ }
+
+ s.GetChar();
+ }
+
+ void File::ParseTypes(Stream& s, CAtlList<CString>& types)
+ {
+ types.RemoveAll();
+
+ CString str;
+
+ for(int c = s.SkipWhiteSpace(); _istcsym(c) || c == '.' || c == '@'; c = s.PeekChar())
+ {
+ c = s.GetChar();
+
+ if(c == '.')
+ {
+ if(str.IsEmpty()) s.ThrowError(_T("'type' cannot be an empty string"));
+ if(!_istcsym(s.PeekChar())) s.ThrowError(_T("unexpected dot after type '%s'"), str);
+
+ types.AddTail(str);
+ str.Empty();
+ }
+ else
+ {
+ if(str.IsEmpty() && _istdigit(c)) s.ThrowError(_T("'type' cannot start with a number"));
+ if((!str.IsEmpty() || !types.IsEmpty()) && c == '@') s.ThrowError(_T("unexpected @ in 'type'"));
+
+ str += (TCHAR)c;
+ }
+ }
+
+ if(!str.IsEmpty())
+ {
+ types.AddTail(str);
+ }
+ }
+
+ void File::ParseName(Stream& s, CString& name)
+ {
+ name.Empty();
+
+ for(int c = s.SkipWhiteSpace(); _istcsym(c); c = s.PeekChar())
+ {
+ if(name.IsEmpty() && _istdigit(c)) s.ThrowError(_T("'name' cannot start with a number"));
+ name += (TCHAR)s.GetChar();
+ }
+ }
+
+ void File::ParseQuotedString(Stream& s, Definition* pDef)
+ {
+ CString v;
+
+ int quote = s.SkipWhiteSpace();
+ if(quote != '"' && quote != '\'') s.ThrowError(_T("expected qouted string"));
+ s.GetChar();
+
+ for(int c = s.PeekChar(); c != Stream::EOS; c = s.PeekChar())
+ {
+ c = s.GetChar();
+ if(c == quote) {pDef->SetAsValue(Definition::string, v); return;}
+ if(c == '\n') s.ThrowError(_T("qouted string terminated unexpectedly by a new-line character"));
+ if(c == '\\') c = s.GetChar();
+ if(c == Stream::EOS) s.ThrowError(_T("qouted string terminated unexpectedly by EOS"));
+ v += (TCHAR)c;
+ }
+
+ s.ThrowError(_T("unterminated quoted string"));
+ }
+
+ void File::ParseNumber(Stream& s, Definition* pDef)
+ {
+ CString v, u;
+
+ for(int c = s.SkipWhiteSpace(); _istxdigit(c) || _tcschr(_T("+-.x:"), c); c = s.PeekChar())
+ {
+ if((c == '+' || c == '-') && !v.IsEmpty()
+ || (c == '.' && (v.IsEmpty() || v.Find('.') >= 0 || v.Find(_T("x")) >= 0))
+ || (c == 'x' && v != _T("0"))
+ || (c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F') && v.Find(_T("0x")) != 0
+ || (c == ':' && v.IsEmpty()))
+ {
+ s.ThrowError(_T("unexpected character '%c' in number"), (TCHAR)c);
+ }
+
+ v += (TCHAR)s.GetChar();
+ }
+
+ if(v.IsEmpty()) s.ThrowError(_T("invalid number"));
+
+ for(int c = s.SkipWhiteSpace(); _istcsym(c); c = s.PeekChar())
+ {
+ u += (TCHAR)s.GetChar();
+ }
+
+ pDef->SetAsNumber(v, u);
+ }
+
+ void File::ParseBlock(Stream& s, Definition* pDef)
+ {
+ CString v;
+
+ int c = s.SkipWhiteSpace(_T(":="));
+ if(c != '{') s.ThrowError(_T("expected '{'"));
+ s.GetChar();
+
+ int depth = 0;
+
+ for(int c = s.PeekChar(); c != Stream::EOS; c = s.PeekChar())
+ {
+ c = s.GetChar();
+ if(c == '}' && depth == 0) {pDef->SetAsValue(Definition::block, v); return;}
+ if(c == '\\') {v += (TCHAR)c; c = s.GetChar();}
+ else if(c == '{') depth++;
+ else if(c == '}') depth--;
+ if(c == Stream::EOS) s.ThrowError(_T("block terminated unexpectedly by EOS"));
+ v += (TCHAR)c;
+ }
+
+ s.ThrowError(_T("unterminated block"));
+ }
+
+ void File::ParseRefs(Stream& s, Definition* pParentDef, LPCTSTR term)
+ {
+ int c = s.SkipWhiteSpace();
+
+ do
+ {
+ if(pParentDef->IsValue()) s.ThrowError(_T("cannot mix references with other values"));
+
+ if(c == '{')
+ {
+ s.GetChar();
+ ParseDefs(s, CreateRef(pParentDef));
+ }
+ else if(_istcsym(c))
+ {
+ CString str;
+ ParseName(s, str);
+
+ // TODO: allow spec references: parent.<type>, self.<type>, child.<type>
+
+ Definition* pDef = GetDefByName(str);
+ if(!pDef) s.ThrowError(_T("cannot find definition of '%s'"), str);
+
+ if(!pParentDef->IsVisible(pDef)) s.ThrowError(_T("cannot access '%s' from here"), str);
+
+ pParentDef->AddTail(pDef);
+ }
+ else if(!_tcschr(term, c) && c != Stream::EOS)
+ {
+ s.ThrowError(_T("unexpected character '%c'"), (TCHAR)c);
+ }
+
+ c = s.SkipWhiteSpace();
+ }
+ while(!_tcschr(term, c) && c != Stream::EOS);
+ }
+}
diff --git a/src/subtitles/libssf/File.h b/src/subtitles/libssf/File.h
new file mode 100644
index 000000000..a299db31e
--- /dev/null
+++ b/src/subtitles/libssf/File.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "Stream.h"
+#include "NodeFactory.h"
+
+namespace ssf
+{
+ class File : public NodeFactory
+ {
+ public:
+ File();
+ virtual ~File();
+
+ void Parse(Stream& s, LPCTSTR predef = NULL);
+
+ void ParseDefs(Stream& s, Reference* pParentRef);
+ void ParseTypes(Stream& s, CAtlList<CString>& types);
+ void ParseName(Stream& s, CString& name);
+ void ParseQuotedString(Stream& s, Definition* pDef);
+ void ParseNumber(Stream& s, Definition* pDef);
+ void ParseBlock(Stream& s, Definition* pDef);
+ void ParseRefs(Stream& s, Definition* pParentDef, LPCTSTR term = _T(";}]"));
+ };
+} \ No newline at end of file
diff --git a/src/subtitles/libssf/Node.cpp b/src/subtitles/libssf/Node.cpp
new file mode 100644
index 000000000..bfe4e823b
--- /dev/null
+++ b/src/subtitles/libssf/Node.cpp
@@ -0,0 +1,488 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "Node.h"
+#include "NodeFactory.h"
+#include "Exception.h"
+#include "Split.h"
+
+#include <math.h>
+
+namespace ssf
+{
+ Node::Node(const NodeFactory* pnf, CString name)
+ : m_pnf(pnf)
+ , m_type(_T("?"))
+ , m_name(name)
+ , m_priority(PNormal)
+ , m_parent(NULL)
+ {
+ ASSERT(m_pnf);
+ }
+
+ void Node::AddTail(Node* pNode)
+ {
+ if(POSITION pos = m_nodes.Find(pNode)) // TODO: slow
+ {
+ m_nodes.MoveToTail(pos);
+ return;
+ }
+
+ m_nodes.AddTail(pNode);
+ m_name2node[pNode->m_name] = pNode;
+ }
+
+ bool Node::IsNameUnknown()
+ {
+ return m_name.IsEmpty() || !!_istdigit(m_name[0]);
+ }
+
+ bool Node::IsTypeUnknown()
+ {
+ return m_type.IsEmpty() || m_type == _T("?");
+ }
+
+ bool Node::IsType(CString type)
+ {
+ return m_type == type;
+ }
+
+ void Node::GetChildDefs(CAtlList<Definition*>& l, LPCTSTR type, bool fFirst)
+ {
+ CAtlList<Definition*> rdl[3];
+
+ if(fFirst)
+ {
+ if(Definition* pDef = m_pnf->GetDefByName(m_type))
+ {
+ pDef->GetChildDefs(rdl[pDef->m_priority], type, false);
+ }
+ }
+
+ POSITION pos = m_nodes.GetHeadPosition();
+ while(pos)
+ {
+ if(Node* pNode = m_nodes.GetNext(pos))
+ {
+ pNode->GetChildDefs(rdl[pNode->m_priority], type, false);
+ }
+ }
+
+ for(int i = 0; i < sizeof(rdl)/sizeof(rdl[0]); i++)
+ {
+ l.AddTailList(&rdl[i]);
+ }
+ }
+
+ // Reference
+
+ Reference::Reference(const NodeFactory* pnf, CString name)
+ : Node(pnf, name)
+ {
+ }
+
+ Reference::~Reference()
+ {
+ }
+
+ void Reference::GetChildDefs(CAtlList<Definition*>& l, LPCTSTR type, bool fFirst)
+ {
+ CAtlList<Definition*> rdl[3];
+
+ POSITION pos = m_nodes.GetHeadPosition();
+ while(pos)
+ {
+ if(Definition* pDef = dynamic_cast<Definition*>(m_nodes.GetNext(pos)))
+ {
+ if(!type || pDef->m_type == type) // TODO: faster lookup
+ {
+ rdl[pDef->m_priority].AddTail(pDef);
+ }
+ }
+ }
+
+ for(int i = 0; i < sizeof(rdl)/sizeof(rdl[0]); i++)
+ {
+ l.AddTailList(&rdl[i]);
+ }
+ }
+
+ void Reference::Dump(NodePriority priority, int level, bool fLast)
+ {
+ if(m_priority < priority) return;
+
+ CString tabs;
+
+ if(level > 0)
+ {
+ tabs.Format(_T("%%%ds"), level*4);
+ tabs.Format(CString(tabs), _T(" "));
+ }
+
+ // TRACE(tabs + _T("\n") + tabs + _T(" {\n"));
+ TRACE(_T(" {\n"));
+
+ POSITION pos = m_nodes.GetHeadPosition();
+ while(pos)
+ {
+ if(Definition* pDef = dynamic_cast<Definition*>(m_nodes.GetNext(pos)))
+ {
+ pDef->Dump(priority, level + 1, pos == NULL);
+ }
+ }
+
+ TRACE(tabs + _T("}"));
+ }
+
+ // Definition
+
+ Definition::Definition(const NodeFactory* pnf, CString name)
+ : Node(pnf, name)
+ , m_status(node)
+ , m_autotype(false)
+ {
+ }
+
+ Definition::~Definition()
+ {
+ RemoveFromCache();
+ }
+
+ bool Definition::IsVisible(Definition* pDef)
+ {
+ Node* pNode = m_parent;
+
+ while(pNode)
+ {
+ if(pNode->m_name2node.Lookup(pDef->m_name))
+ {
+ return true;
+ }
+
+ pNode = pNode->m_parent;
+ }
+
+ return false;
+ }
+
+ void Definition::AddTail(Node* pNode)
+ {
+// if(Reference* pRef = dynamic_cast<Reference*>(pNode))
+ {
+ ASSERT(m_status == node);
+
+ m_status = node;
+
+ if(IsTypeUnknown() && !pNode->IsTypeUnknown())
+ {
+ m_type = pNode->m_type;
+ m_autotype = true;
+ }
+
+ RemoveFromCache(pNode->m_type);
+ }
+
+ __super::AddTail(pNode);
+ }
+
+ Definition& Definition::operator[] (LPCTSTR type)
+ {
+ Definition* pRetDef = NULL;
+ if(m_type2def.Lookup(type, pRetDef))
+ return *pRetDef;
+
+ pRetDef = new Definition(m_pnf, _T(""));
+ pRetDef->m_priority = PLow;
+ pRetDef->m_type = type;
+ m_type2def[type] = pRetDef;
+
+ CAtlList<Definition*> l;
+ GetChildDefs(l, type);
+
+ while(!l.IsEmpty())
+ {
+ Definition* pDef = l.RemoveHead();
+
+ pRetDef->m_priority = pDef->m_priority;
+ pRetDef->m_parent = pDef->m_parent;
+
+ if(pDef->IsValue())
+ {
+ pRetDef->SetAsValue(pDef->m_status, pDef->m_value, pDef->m_unit);
+ }
+ else
+ {
+ pRetDef->m_status = node;
+ pRetDef->m_nodes.AddTailList(&pDef->m_nodes);
+ }
+ }
+
+ return *pRetDef;
+ }
+
+ void Definition::RemoveFromCache(LPCTSTR type)
+ {
+ if(!type)
+ {
+ POSITION pos = m_type2def.GetStartPosition();
+ while(pos) delete m_type2def.GetNextValue(pos);
+ }
+ else if(CAtlStringMap<Definition*>::CPair* p = m_type2def.Lookup(type))
+ {
+ delete p->m_value;
+ m_type2def.RemoveKey(type);
+ }
+ }
+
+ bool Definition::IsValue(status_t s)
+ {
+ return s ? m_status == s : m_status != node;
+ }
+
+ void Definition::SetAsValue(status_t s, CString v, CString u)
+ {
+ ASSERT(s != node);
+
+ m_nodes.RemoveAll();
+ m_name2node.RemoveAll();
+
+ m_status = s;
+
+ m_value = v;
+ m_unit = u;
+ }
+
+ void Definition::SetAsNumber(CString v, CString u)
+ {
+ SetAsValue(number, v, u);
+
+ Number<double> n;
+ GetAsNumber(n); // will throw an exception if not a number
+ }
+
+ template<class T>
+ void Definition::GetAsNumber(Number<T>& n, CAtlStringMap<T>* n2n)
+ {
+ CString str = m_value;
+ str.Replace(_T(" "), _T(""));
+
+ n.value = 0;
+ n.unit = m_unit;
+ n.sign = 0;
+
+ if(n2n)
+ {
+ if(m_status == node) throw Exception(_T("expected value type"));
+
+ if(CAtlStringMap<T>::CPair* p = n2n->Lookup(str))
+ {
+ n.value = p->m_value;
+ return;
+ }
+ }
+
+ if(m_status != number) throw Exception(_T("expected number"));
+
+ n.sign = str.Find('+') == 0 ? 1 : str.Find('-') == 0 ? -1 : 0;
+ str.TrimLeft(_T("+-"));
+
+ if(str.Find(_T("0x")) == 0)
+ {
+ if(n.sign) throw Exception(_T("hex values must be unsigned"));
+
+ n.value = (T)_tcstoul(str.Mid(2), NULL, 16);
+ }
+ else
+ {
+ Split sa(_T(":"), str);
+ Split sa2(_T("."), sa ? sa[sa-1] : _T(""));
+
+ if(sa == 0 || sa2 == 0 || sa2 > 2) throw Exception(_T("invalid number"));
+
+ double d = 0;
+ for(size_t i = 0; i < sa; i++) {d *= 60; d += _tcstoul(sa[i], NULL, 10);}
+ if(sa2 > 1) d += (double)_tcstoul(sa2[1], NULL, 10) / pow((float)10, sa2[1].GetLength());
+
+ if(n.unit == _T("ms")) {d /= 1000; n.unit = _T("s");}
+ else if(n.unit == _T("m")) {d *= 60; n.unit = _T("s");}
+ else if(n.unit == _T("h")) {d *= 3600; n.unit = _T("s");}
+
+ n.value = (T)d;
+
+ if(n.sign) n.value *= n.sign;
+ }
+ }
+
+ void Definition::GetAsString(CString& str)
+ {
+ if(m_status == node) throw Exception(_T("expected value type"));
+
+ str = m_value;
+ }
+
+ void Definition::GetAsNumber(Number<int>& n, CAtlStringMap<int>* n2n) {return GetAsNumber<int>(n, n2n);}
+ void Definition::GetAsNumber(Number<DWORD>& n, CAtlStringMap<DWORD>* n2n) {return GetAsNumber<DWORD>(n, n2n);}
+ void Definition::GetAsNumber(Number<double>& n, CAtlStringMap<double>* n2n) {return GetAsNumber<double>(n, n2n);}
+
+ void Definition::GetAsBoolean(bool& b)
+ {
+ static CAtlStringMap<bool> s2b;
+
+ if(s2b.IsEmpty())
+ {
+ s2b[_T("true")] = true;
+ s2b[_T("on")] = true;
+ s2b[_T("yes")] = true;
+ s2b[_T("1")] = true;
+ s2b[_T("false")] = false;
+ s2b[_T("off")] = false;
+ s2b[_T("no")] = false;
+ s2b[_T("0")] = false;
+ }
+
+ if(!s2b.Lookup(m_value, b)) // m_status != boolean && m_status != number ||
+ {
+ throw Exception(_T("expected boolean"));
+ }
+ }
+
+ bool Definition::GetAsTime(Time& t, CAtlStringMap<double>& offset, CAtlStringMap<double>* n2n, int default_id)
+ {
+ Definition& time = (*this)[_T("time")];
+
+ CString id;
+ if(time[_T("id")].IsValue()) id = time[_T("id")];
+ else id.Format(_T("%d"), default_id);
+
+ double scale = time[_T("scale")].IsValue() ? time[_T("scale")] : 1.0;
+
+ if(time[_T("start")].IsValue() && time[_T("stop")].IsValue())
+ {
+ time[_T("start")].GetAsNumber(t.start, n2n);
+ time[_T("stop")].GetAsNumber(t.stop, n2n);
+
+ if(t.start.unit.IsEmpty()) t.start.value *= scale;
+ if(t.stop.unit.IsEmpty()) t.stop.value *= scale;
+
+ double o = 0;
+ offset.Lookup(id, o);
+
+ if(t.start.sign != 0) t.start.value = o + t.start.value;
+ if(t.stop.sign != 0) t.stop.value = t.start.value + t.stop.value;
+
+ offset[id] = t.stop.value;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ Definition::operator LPCTSTR()
+ {
+ CString str;
+ GetAsString(str);
+ return str;
+ }
+
+ Definition::operator double()
+ {
+ double d;
+ GetAsNumber(d);
+ return d;
+ }
+
+ Definition::operator bool()
+ {
+ bool b;
+ GetAsBoolean(b);
+ return b;
+ }
+
+ void Definition::Dump(NodePriority priority, int level, bool fLast)
+ {
+ if(m_priority < priority) return;
+
+ CString tabs;
+
+ if(level > 0)
+ {
+ tabs.Format(_T("%%%ds"), level*4);
+ tabs.Format(CString(tabs), _T(" "));
+ }
+
+ CString str = tabs;
+ if(m_priority == PLow) str += '*';
+ else if(m_priority == PHigh) str += '!';
+ if(!IsTypeUnknown() && !m_autotype) str += m_type;
+ if(!IsNameUnknown()) str += _T("#") + m_name;
+ str += _T(":");
+ TRACE(_T("%s"), str);
+
+ if(!m_nodes.IsEmpty())
+ {
+ POSITION pos = m_nodes.GetHeadPosition();
+ while(pos)
+ {
+ Node* pNode = m_nodes.GetNext(pos);
+
+ if(Reference* pRef = dynamic_cast<Reference*>(pNode))
+ {
+ pRef->Dump(priority, level, fLast);
+ }
+ else
+ {
+ ASSERT(!pNode->IsNameUnknown());
+ TRACE(_T(" %s"), pNode->m_name);
+ }
+ }
+
+ TRACE(_T(";\n"));
+
+ if(!fLast && (!m_nodes.IsEmpty() || level == 0)) TRACE(_T("\n"));
+ }
+ else if(m_status == string)
+ {
+ CString str = m_value;
+ str.Replace(_T("\""), _T("\\\""));
+ TRACE(_T(" \"%s\";\n"), str);
+ }
+ else if(m_status == number)
+ {
+ CString str = m_value;
+ if(!m_unit.IsEmpty()) str += m_unit;
+ TRACE(_T(" %s;\n"), str);
+ }
+ else if(m_status == boolean)
+ {
+ TRACE(_T(" %s;\n"), m_value);
+ }
+ else if(m_status == block)
+ {
+ TRACE(_T(" {%s};\n"), m_value);
+ }
+ else
+ {
+ TRACE(_T(" null;\n"));
+ }
+ }
+}
diff --git a/src/subtitles/libssf/Node.h b/src/subtitles/libssf/Node.h
new file mode 100644
index 000000000..7c7782d59
--- /dev/null
+++ b/src/subtitles/libssf/Node.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+namespace ssf
+{
+ template <class T = CString, class S = CString>
+ class CAtlStringMap : public CAtlMap<S, T, CStringElementTraits<S> >
+ {
+ public:
+ CAtlStringMap() {}
+ CAtlStringMap(const CAtlStringMap& s2t) {*this = s2t;}
+ CAtlStringMap& operator = (const CAtlStringMap& s2t)
+ {
+ RemoveAll();
+ POSITION pos = s2t.GetStartPosition();
+ while(pos) {const CAtlStringMap::CPair* p = s2t.GetNext(pos); SetAt(p->m_key, p->m_value);}
+ return *this;
+ }
+ };
+
+ class Definition;
+ class NodeFactory;
+
+ enum NodePriority {PLow, PNormal, PHigh};
+
+ class Node
+ {
+ protected:
+ const NodeFactory* m_pnf;
+
+ public:
+ Node* m_parent;
+ CAtlList<Node*> m_nodes;
+ CAtlStringMap<Node*> m_name2node;
+ CString m_type, m_name;
+ NodePriority m_priority;
+
+ Node(const NodeFactory* pnf, CString name);
+ virtual ~Node() {}
+
+ bool IsNameUnknown();
+ bool IsTypeUnknown();
+ bool IsType(CString type);
+
+ virtual void AddTail(Node* pNode);
+ virtual void GetChildDefs(CAtlList<Definition*>& l, LPCTSTR type = NULL, bool fFirst = true);
+ virtual void Dump(NodePriority minpriority = PNormal, int level = 0, bool fLast = false) = 0;
+ };
+
+ class Reference : public Node
+ {
+ public:
+ Reference(const NodeFactory* pnf, CString name);
+ virtual ~Reference();
+
+ void GetChildDefs(CAtlList<Definition*>& l, LPCTSTR type = NULL, bool fFirst = true);
+ void Dump(NodePriority minpriority = PNormal, int level = 0, bool fLast = false);
+ };
+
+ class Definition : public Node
+ {
+ public:
+ template<typename T> struct Number {T value; int sign; CString unit;};
+ struct Time {Number<double> start, stop;};
+
+ enum status_t {node, string, number, boolean, block};
+
+ private:
+ status_t m_status;
+ bool m_autotype;
+ CString m_value, m_unit;
+
+ CAtlStringMap<Definition*> m_type2def;
+ void RemoveFromCache(LPCTSTR type = NULL);
+
+ template<typename T>
+ void GetAsNumber(Number<T>& n, CAtlStringMap<T>* n2n = NULL);
+
+ public:
+ Definition(const NodeFactory* pnf, CString name);
+ virtual ~Definition();
+
+ bool IsVisible(Definition* pDef);
+
+ void AddTail(Node* pNode);
+ void Dump(NodePriority minpriority = PNormal, int level = 0, bool fLast = false);
+
+ Definition& operator[] (LPCTSTR type);
+
+ bool IsValue(status_t s = (status_t)0);
+
+ void SetAsValue(status_t s, CString v, CString u = _T(""));
+ void SetAsNumber(CString v, CString u = _T(""));
+
+ void GetAsString(CString& str);
+ void GetAsNumber(Number<int>& n, CAtlStringMap<int>* n2n = NULL);
+ void GetAsNumber(Number<DWORD>& n, CAtlStringMap<DWORD>* n2n = NULL);
+ void GetAsNumber(Number<double>& n, CAtlStringMap<double>* n2n = NULL);
+ template<typename T>
+ void GetAsNumber(T& t, CAtlStringMap<T>* n2n = NULL) {Number<T> n; GetAsNumber(n, n2n); t = n.value; if(n.sign) t *= n.sign;}
+ void GetAsBoolean(bool& b);
+ bool GetAsTime(Time& t, CAtlStringMap<double>& offset, CAtlStringMap<double>* n2n = NULL, int default_id = 0);
+
+ operator LPCTSTR();
+ operator double();
+ operator bool();
+ };
+}
diff --git a/src/subtitles/libssf/NodeFactory.cpp b/src/subtitles/libssf/NodeFactory.cpp
new file mode 100644
index 000000000..796b27c4b
--- /dev/null
+++ b/src/subtitles/libssf/NodeFactory.cpp
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "NodeFactory.h"
+#include "Exception.h"
+
+namespace ssf
+{
+ NodeFactory::NodeFactory()
+ : m_counter(0)
+ , m_root(NULL)
+ , m_priority(PNormal)
+ {
+ }
+
+ NodeFactory::~NodeFactory()
+ {
+ RemoveAll();
+ }
+
+ CString NodeFactory::GenName()
+ {
+ CString name;
+ name.Format(_T("%I64d"), m_counter++);
+ return name;
+ }
+
+ void NodeFactory::RemoveAll()
+ {
+ m_root = NULL;
+
+ POSITION pos = m_nodes.GetStartPosition();
+ while(pos) delete m_nodes.GetNextValue(pos);
+ m_nodes.RemoveAll();
+
+ m_newnodes.RemoveAll();
+ }
+
+ void NodeFactory::Commit()
+ {
+ m_newnodes.RemoveAll();
+ }
+
+ void NodeFactory::Rollback()
+ {
+ POSITION pos = m_newnodes.GetTailPosition();
+ while(pos)
+ {
+ if(CAtlStringMap<Node*>::CPair* p = m_nodes.Lookup(m_newnodes.GetPrev(pos)))
+ {
+ delete p->m_value; // TODO: remove it from "parent"->m_nodes too
+ m_nodes.RemoveKey(p->m_key);
+ }
+ }
+ }
+
+ Reference* NodeFactory::CreateRootRef()
+ {
+ RemoveAll();
+ m_root = CreateRef(NULL);
+ return m_root;
+ }
+
+ Reference* NodeFactory::GetRootRef() const
+ {
+ ASSERT(m_root);
+ return m_root;
+ }
+
+ Reference* NodeFactory::CreateRef(Definition* pParentDef)
+ {
+ CString name = GenName();
+
+ Reference* pRef = new Reference(this, name);
+
+ m_nodes.SetAt(name, pRef);
+ m_newnodes.AddTail(name);
+
+ if(pParentDef)
+ {
+ pParentDef->AddTail(pRef);
+ pRef->m_parent = pParentDef;
+ }
+
+ return pRef;
+ }
+
+ Definition* NodeFactory::CreateDef(Reference* pParentRef, CString type, CString name, NodePriority priority)
+ {
+ Definition* pDef = NULL;
+
+ if(name.IsEmpty())
+ {
+ name = GenName();
+ }
+ else
+ {
+ pDef = GetDefByName(name);
+
+ if(pDef)
+ {
+ if(pDef->m_priority != PLow)
+ {
+ throw Exception(_T("redefinition of '%s' is not allowed"), name);
+ }
+
+ if(!pDef->IsTypeUnknown() && !pDef->IsType(type))
+ {
+ throw Exception(_T("cannot redefine type of %s to %s"), name, type);
+ }
+ }
+ }
+
+ if(!pDef)
+ {
+ pDef = new Definition(this, name);
+
+ m_nodes.SetAt(name, pDef);
+ m_newnodes.AddTail(name);
+
+ if(pParentRef)
+ {
+ pParentRef->AddTail(pDef);
+ pDef->m_parent = pParentRef;
+ }
+ }
+
+ pDef->m_type = type;
+ pDef->m_priority = priority == PNormal ? m_priority : priority;
+
+ return pDef;
+ }
+
+ Definition* NodeFactory::GetDefByName(CString name) const
+ {
+ Node* pNode = NULL;
+ m_nodes.Lookup(name, pNode);
+ return dynamic_cast<Definition*>(pNode);
+ }
+
+ void NodeFactory::Dump(NodePriority priority) const
+ {
+ if(!m_root) return;
+
+ POSITION pos = m_root->m_nodes.GetHeadPosition();
+ while(pos) m_root->m_nodes.GetNext(pos)->Dump(priority);
+ }
+}
diff --git a/src/subtitles/libssf/NodeFactory.h b/src/subtitles/libssf/NodeFactory.h
new file mode 100644
index 000000000..2f06147a4
--- /dev/null
+++ b/src/subtitles/libssf/NodeFactory.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "Node.h"
+
+namespace ssf
+{
+ class NodeFactory
+ {
+ Reference* m_root;
+ CAtlStringMap<Node*> m_nodes;
+ CAtlList<CString> m_newnodes;
+ NodePriority m_priority;
+
+ unsigned __int64 m_counter;
+ CString GenName();
+
+ public:
+ NodeFactory();
+ virtual ~NodeFactory();
+
+ virtual void RemoveAll();
+
+ void SetDefaultPriority(NodePriority priority) {m_priority = priority;}
+
+ void Commit();
+ void Rollback();
+
+ Reference* CreateRootRef();
+ Reference* GetRootRef() const;
+ Reference* CreateRef(Definition* pParentDef);
+ Definition* CreateDef(Reference* pParentRef = NULL, CString type = _T(""), CString name = _T(""), NodePriority priority = PNormal);
+ Definition* GetDefByName(CString name) const;
+
+ void Dump(NodePriority priority) const;
+ };
+}
diff --git a/src/subtitles/libssf/Split.cpp b/src/subtitles/libssf/Split.cpp
new file mode 100644
index 000000000..c3f4e7933
--- /dev/null
+++ b/src/subtitles/libssf/Split.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "Split.h"
+
+namespace ssf
+{
+ Split::Split(LPCTSTR sep, CString str, size_t limit, SplitType type)
+ {
+ RemoveAll();
+
+ if(size_t seplen = _tcslen(sep))
+ {
+ for(int i = 0, j = 0, len = str.GetLength();
+ i <= len && (limit == 0 || GetCount() < limit);
+ i = j + (int)seplen)
+ {
+ j = str.Find(sep, i);
+ if(j < 0) j = len;
+
+ CString s = i < j ? str.Mid(i, j - i) : _T("");
+
+ switch(type)
+ {
+ case Min: s.Trim(); // fall through
+ case Def: if(s.IsEmpty()) break; // else fall through
+ case Max: Add(s); break;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/subtitles/libssf/Split.h b/src/subtitles/libssf/Split.h
new file mode 100644
index 000000000..ec62a03d6
--- /dev/null
+++ b/src/subtitles/libssf/Split.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+namespace ssf
+{
+ class Split : public CAtlArray<CString>
+ {
+ public:
+ enum SplitType {Min, Def, Max};
+ Split(LPCTSTR sep, CString str, size_t limit = 0, SplitType type = Def);
+ operator size_t() {return GetCount();}
+ };
+} \ No newline at end of file
diff --git a/src/subtitles/libssf/Stream.cpp b/src/subtitles/libssf/Stream.cpp
new file mode 100644
index 000000000..e14e78c82
--- /dev/null
+++ b/src/subtitles/libssf/Stream.cpp
@@ -0,0 +1,239 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "Stream.h"
+
+namespace ssf
+{
+ Stream::Stream()
+ : m_encoding(none)
+ , m_line(0)
+ , m_col(-1)
+ {
+
+ }
+
+ Stream::~Stream()
+ {
+ }
+
+ int Stream::NextChar()
+ {
+ if(m_encoding == none)
+ {
+ m_encoding = unknown;
+
+ switch(NextByte())
+ {
+ case 0xef:
+ if(NextByte() == 0xbb && NextByte() == 0xbf) m_encoding = utf8;
+ break;
+ case 0xff:
+ if(NextByte() == 0xfe) m_encoding = utf16le;
+ break;
+ case 0xfe:
+ if(NextByte() == 0xff) m_encoding = utf16be;
+ break;
+ }
+ }
+
+ if(m_encoding == unknown)
+ {
+ throw Exception(_T("unknown character encoding, missing BOM"));
+ }
+
+ int i, c;
+
+ int cur = NextByte();
+
+ switch(m_encoding)
+ {
+ case utf8:
+ for(i = 7; i >= 0 && (cur & (1 << i)); i--);
+ cur &= (1 << i) - 1;
+ while(++i < 7) {c = NextByte(); if(c == EOS) {cur = EOS; break;} cur = (cur << 6) | (c & 0x3f);}
+ break;
+ case utf16le:
+ c = NextByte();
+ if(c == EOS) {cur = EOS; break;}
+ cur = (c << 8) | cur;
+ break;
+ case utf16be:
+ c = NextByte();
+ if(c == EOS) {cur = EOS; break;}
+ cur = cur | (c << 8);
+ break;
+ case tchar:
+ break;
+ }
+
+ return cur;
+ }
+
+ int Stream::PushChar()
+ {
+ int c = NextChar();
+ m_queue.AddTail(c);
+ return c;
+ }
+
+ int Stream::PopChar()
+ {
+ if(m_queue.IsEmpty()) ThrowError(_T("fatal stream error"));
+
+ int c = m_queue.RemoveHead();
+
+ if(c != EOS)
+ {
+ if(c == '\n') {m_line++; m_col = -1;}
+ m_col++;
+ }
+
+ return c;
+ }
+
+ int Stream::PeekChar()
+ {
+ while(m_queue.GetCount() < 2) PushChar();
+
+ ASSERT(m_queue.GetCount() == 2);
+
+ if(m_queue.GetHead() == '/' && m_queue.GetTail() == '/')
+ {
+ while(!m_queue.IsEmpty()) PopChar();
+ int c;
+ do {PushChar(); c = PopChar();} while(!(c == '\n' || c == EOS));
+ return PeekChar();
+ }
+ else if(m_queue.GetHead() == '/' && m_queue.GetTail() == '*')
+ {
+ while(!m_queue.IsEmpty()) PopChar();
+ int c1, c2;
+ PushChar();
+ do {c2 = PushChar(); c1 = PopChar();} while(!((c1 == '*' && c2 == '/') || c1 == EOS));
+ PopChar();
+ return PeekChar();
+ }
+
+ return m_queue.GetHead();
+ }
+
+ int Stream::GetChar()
+ {
+ if(m_queue.GetCount() < 2) PeekChar();
+ return PopChar();
+ }
+
+ bool Stream::IsWhiteSpace(int c, LPCTSTR morechars)
+ {
+ return c != 0xa0 && _istspace(c) || morechars && _tcschr(morechars, (TCHAR)c);
+ }
+
+ int Stream::SkipWhiteSpace(LPCTSTR morechars)
+ {
+ int c = PeekChar();
+ for(; IsWhiteSpace(c, morechars); c = PeekChar())
+ GetChar();
+ return c;
+ }
+
+ void Stream::ThrowError(LPCTSTR fmt, ...)
+ {
+ va_list args;
+ va_start(args, fmt);
+ int len = _vsctprintf(fmt, args) + 1;
+ CString str;
+ if(len > 0) _vstprintf_s(str.GetBufferSetLength(len), len, fmt, args);
+ va_end(args);
+
+ throw Exception(_T("Error (Ln %d Col %d): %s"), m_line+1, m_col+1, str);
+ }
+
+ // FileStream
+
+ FileStream::FileStream(const TCHAR* fn)
+ : m_file(NULL)
+ {
+ if(_tfopen_s(&m_file, fn, _T("r")) != 0) ThrowError(_T("cannot open file '%s'"), fn);
+ }
+
+ FileStream::~FileStream()
+ {
+ if(m_file) {fclose(m_file); m_file = NULL;}
+ }
+
+ int FileStream::NextByte()
+ {
+ if(!m_file) ThrowError(_T("file pointer is NULL"));
+ return fgetc(m_file);
+ }
+
+ // MemoryStream
+
+ MemoryStream::MemoryStream(BYTE* pBytes, int len, bool fCopy, bool fFree)
+ : m_pBytes(NULL)
+ , m_pos(0)
+ , m_len(len)
+ {
+ if(fCopy)
+ {
+ m_pBytes = new BYTE[len];
+ if(m_pBytes) memcpy(m_pBytes, pBytes, len);
+ m_fFree = true;
+ }
+ else
+ {
+ m_pBytes = pBytes;
+ m_fFree = fFree;
+ }
+
+ if(!m_pBytes) ThrowError(_T("memory stream pointer is NULL"));
+ }
+
+ MemoryStream::~MemoryStream()
+ {
+ if(m_fFree) delete [] m_pBytes;
+ m_pBytes = NULL;
+ }
+
+ int MemoryStream::NextByte()
+ {
+ if(!m_pBytes) ThrowError(_T("memory stream pointer is NULL"));
+ if(m_pos >= m_len) return Stream::EOS;
+ return (int)m_pBytes[m_pos++];
+ }
+
+ // CharacterStream
+
+ CharacterStream::CharacterStream(CString str)
+ : m_str(str)
+ , m_pos(0)
+ {
+ m_encoding = Stream::tchar;
+ }
+
+ int CharacterStream::NextByte()
+ {
+ if(m_pos >= m_str.GetLength()) return Stream::EOS;
+ return m_str[m_pos++];
+ }
+} \ No newline at end of file
diff --git a/src/subtitles/libssf/Stream.h b/src/subtitles/libssf/Stream.h
new file mode 100644
index 000000000..3dde9809c
--- /dev/null
+++ b/src/subtitles/libssf/Stream.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "Exception.h"
+
+namespace ssf
+{
+ class Stream
+ {
+ public:
+ enum {EOS = -1};
+ enum {none, unknown, utf8, utf16le, utf16be, tchar} m_encoding;
+
+ private:
+ int m_line, m_col;
+
+ CAtlList<int> m_queue;
+ int PushChar(), PopChar();
+
+ int NextChar();
+
+ protected:
+ virtual int NextByte() = 0;
+
+ public:
+ Stream();
+ virtual ~Stream();
+
+ int PeekChar(), GetChar();
+
+ static bool IsWhiteSpace(int c, LPCTSTR morechars = NULL);
+ int SkipWhiteSpace(LPCTSTR morechars = NULL);
+
+ void ThrowError(LPCTSTR fmt, ...);
+ };
+
+ class FileStream : public Stream
+ {
+ FILE* m_file;
+
+ protected:
+ int NextByte();
+
+ public:
+ FileStream(const TCHAR* fn);
+ ~FileStream();
+ };
+
+ class MemoryStream : public Stream
+ {
+ BYTE* m_pBytes;
+ int m_pos, m_len;
+ bool m_fFree;
+
+ protected:
+ int NextByte();
+
+ public:
+ MemoryStream(BYTE* pBytes, int len, bool fCopy, bool fFree);
+ ~MemoryStream();
+ };
+
+ class CharacterStream : public Stream
+ {
+ CString m_str;
+ int m_pos;
+
+ protected:
+ int NextByte();
+
+ public:
+ CharacterStream(CString str);
+ };
+} \ No newline at end of file
diff --git a/src/subtitles/libssf/Subtitle.cpp b/src/subtitles/libssf/Subtitle.cpp
new file mode 100644
index 000000000..8ddc2c4de
--- /dev/null
+++ b/src/subtitles/libssf/Subtitle.cpp
@@ -0,0 +1,551 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "Subtitle.h"
+#include "Split.h"
+#include <math.h>
+
+namespace ssf
+{
+ struct Subtitle::n2n_t Subtitle::m_n2n;
+
+ Subtitle::Subtitle(File* pFile)
+ : m_pFile(pFile)
+ {
+ if(m_n2n.align[0].IsEmpty())
+ {
+ m_n2n.align[0][_T("left")] = 0;
+ m_n2n.align[0][_T("center")] = 0.5;
+ m_n2n.align[0][_T("middle")] = 0.5;
+ m_n2n.align[0][_T("right")] = 1;
+ }
+
+ if(m_n2n.align[1].IsEmpty())
+ {
+ m_n2n.align[1][_T("top")] = 0;
+ m_n2n.align[1][_T("middle")] = 0.5;
+ m_n2n.align[1][_T("center")] = 0.5;
+ m_n2n.align[1][_T("bottom")] = 1;
+ }
+
+ if(m_n2n.weight.IsEmpty())
+ {
+ m_n2n.weight[_T("thin")] = FW_THIN;
+ m_n2n.weight[_T("normal")] = FW_NORMAL;
+ m_n2n.weight[_T("bold")] = FW_BOLD;
+ }
+
+ if(m_n2n.transition.IsEmpty())
+ {
+ m_n2n.transition[_T("start")] = 0;
+ m_n2n.transition[_T("stop")] = 1e10;
+ m_n2n.transition[_T("linear")] = 1;
+ }
+ }
+
+ Subtitle::~Subtitle()
+ {
+ }
+
+ bool Subtitle::Parse(Definition* pDef, double start, double stop, double at)
+ {
+ ASSERT(m_pFile && pDef);
+
+ m_text.RemoveAll();
+
+ m_time.start = start;
+ m_time.stop = stop;
+
+ at -= start;
+
+ Fill::gen_id = 0;
+
+ try
+ {
+ Definition& frame = (*pDef)[_T("frame")];
+
+ m_frame.reference = frame[_T("reference")];
+ m_frame.resolution.cx = frame[_T("resolution")][_T("cx")];
+ m_frame.resolution.cy = frame[_T("resolution")][_T("cy")];
+
+ Definition& direction = (*pDef)[_T("direction")];
+
+ m_direction.primary = direction[_T("primary")];
+ m_direction.secondary = direction[_T("secondary")];
+
+ m_wrap = (*pDef)[_T("wrap")];
+
+ m_layer = (*pDef)[_T("layer")];
+
+ m_pFile->Commit();
+
+ Style style;
+ GetStyle(&(*pDef)[_T("style")], style);
+
+ CAtlStringMap<double> offset;
+ Definition& block = (*pDef)[_T("@")];
+ Parse(CharacterStream((LPCTSTR)block), style, at, offset, dynamic_cast<Reference*>(block.m_parent));
+
+ m_pFile->Rollback();
+
+ // TODO: trimming should be done by the renderer later, after breaking the words into lines
+
+ while(!m_text.IsEmpty() && (m_text.GetHead().str == Text::SP || m_text.GetHead().str == Text::LSEP))
+ m_text.RemoveHead();
+
+ while(!m_text.IsEmpty() && (m_text.GetTail().str == Text::SP || m_text.GetTail().str == Text::LSEP))
+ m_text.RemoveTail();
+ }
+ catch(Exception& e)
+ {
+ TRACE(_T("%s"), e.ToString());
+ return false;
+ }
+
+ return true;
+ }
+
+ void Subtitle::GetStyle(Definition* pDef, Style& style)
+ {
+ style.placement.pos.x = 0;
+ style.placement.pos.y = 0;
+ style.placement.pos.auto_x = true;
+ style.placement.pos.auto_y = true;
+
+ Rect frame = {0, m_frame.resolution.cx, m_frame.resolution.cy, 0};
+
+ style.placement.clip = frame;
+
+ //
+
+ style.linebreak = (*pDef)[_T("linebreak")];
+
+ Definition& placement = (*pDef)[_T("placement")];
+
+ Definition& clip = placement[_T("clip")];
+
+ if(clip.IsValue(Definition::string))
+ {
+ CString str = clip;
+
+ if(str == _T("frame")) style.placement.clip = frame;
+ // else ?
+ }
+ else
+ {
+ if(clip[_T("t")].IsValue()) style.placement.clip.t = clip[_T("t")];
+ if(clip[_T("r")].IsValue()) style.placement.clip.r = clip[_T("r")];
+ if(clip[_T("b")].IsValue()) style.placement.clip.b = clip[_T("b")];
+ if(clip[_T("l")].IsValue()) style.placement.clip.l = clip[_T("l")];
+ }
+
+ CAtlStringMap<double> n2n_margin;
+
+ n2n_margin[_T("top")] = frame.t;
+ n2n_margin[_T("right")] = frame.r;
+ n2n_margin[_T("bottom")] = frame.b;
+ n2n_margin[_T("left")] = frame.l;
+
+ placement[_T("margin")][_T("t")].GetAsNumber(style.placement.margin.t, &n2n_margin);
+ placement[_T("margin")][_T("r")].GetAsNumber(style.placement.margin.r, &n2n_margin);
+ placement[_T("margin")][_T("b")].GetAsNumber(style.placement.margin.b, &n2n_margin);
+ placement[_T("margin")][_T("l")].GetAsNumber(style.placement.margin.l, &n2n_margin);
+
+ placement[_T("align")][_T("h")].GetAsNumber(style.placement.align.h, &m_n2n.align[0]);
+ placement[_T("align")][_T("v")].GetAsNumber(style.placement.align.v, &m_n2n.align[1]);
+
+ if(placement[_T("pos")][_T("x")].IsValue()) {style.placement.pos.x = placement[_T("pos")][_T("x")]; style.placement.pos.auto_x = false;}
+ if(placement[_T("pos")][_T("y")].IsValue()) {style.placement.pos.y = placement[_T("pos")][_T("y")]; style.placement.pos.auto_y = false;}
+
+ placement[_T("offset")][_T("x")].GetAsNumber(style.placement.offset.x);
+ placement[_T("offset")][_T("y")].GetAsNumber(style.placement.offset.y);
+
+ style.placement.angle.x = placement[_T("angle")][_T("x")];
+ style.placement.angle.y = placement[_T("angle")][_T("y")];
+ style.placement.angle.z = placement[_T("angle")][_T("z")];
+
+ Definition& font = (*pDef)[_T("font")];
+
+ style.font.face = font[_T("face")];
+ style.font.size = font[_T("size")];
+ font[_T("weight")].GetAsNumber(style.font.weight, &m_n2n.weight);
+ style.font.color[0] = font[_T("color")][_T("a")];
+ style.font.color[1] = font[_T("color")][_T("r")];
+ style.font.color[2] = font[_T("color")][_T("g")];
+ style.font.color[3] = font[_T("color")][_T("b")];
+ style.font.underline = font[_T("underline")];
+ style.font.strikethrough = font[_T("strikethrough")];
+ style.font.italic = font[_T("italic")];
+ style.font.spacing = font[_T("spacing")];
+ style.font.scale.cx = font[_T("scale")][_T("cx")];
+ style.font.scale.cy = font[_T("scale")][_T("cy")];
+
+ Definition& background = (*pDef)[_T("background")];
+
+ style.background.color[0] = background[_T("color")][_T("a")];
+ style.background.color[1] = background[_T("color")][_T("r")];
+ style.background.color[2] = background[_T("color")][_T("g")];
+ style.background.color[3] = background[_T("color")][_T("b")];
+ style.background.size = background[_T("size")];
+ style.background.type = background[_T("type")];
+
+ Definition& shadow = (*pDef)[_T("shadow")];
+
+ style.shadow.color[0] = shadow[_T("color")][_T("a")];
+ style.shadow.color[1] = shadow[_T("color")][_T("r")];
+ style.shadow.color[2] = shadow[_T("color")][_T("g")];
+ style.shadow.color[3] = shadow[_T("color")][_T("b")];
+ style.shadow.depth = shadow[_T("depth")];
+ style.shadow.angle = shadow[_T("angle")];
+ style.shadow.blur = shadow[_T("blur")];
+
+ Definition& fill = (*pDef)[_T("fill")];
+
+ style.fill.color[0] = fill[_T("color")][_T("a")];
+ style.fill.color[1] = fill[_T("color")][_T("r")];
+ style.fill.color[2] = fill[_T("color")][_T("g")];
+ style.fill.color[3] = fill[_T("color")][_T("b")];
+ style.fill.width = fill[_T("width")];
+ }
+
+ double Subtitle::GetMixWeight(Definition* pDef, double at, CAtlStringMap<double>& offset, int default_id)
+ {
+ double t = 1;
+
+ try
+ {
+ CAtlStringMap<double> n2n;
+
+ n2n[_T("start")] = 0;
+ n2n[_T("stop")] = m_time.stop - m_time.start;
+
+ Definition::Time time;
+ if(pDef->GetAsTime(time, offset, &n2n, default_id) && time.start.value < time.stop.value)
+ {
+ t = (at - time.start.value) / (time.stop.value - time.start.value);
+
+ if(t < 0) t = 0;
+ else if(t > 1) t = 1;
+
+ if((*pDef)[_T("loop")].IsValue()) t *= (double)(*pDef)[_T("loop")];
+
+ CString direction = (*pDef)[_T("direction")].IsValue() ? (*pDef)[_T("direction")] : _T("fw");
+ if(direction == _T("fwbw") || direction == _T("bwfw")) t *= 2;
+
+ double n;
+ t = modf(t, &n);
+
+ if(direction == _T("bw")
+ || direction == _T("fwbw") && ((int)n & 1)
+ || direction == _T("bwfw") && !((int)n & 1))
+ t = 1 - t;
+
+ double accel = 1;
+
+ if((*pDef)[_T("transition")].IsValue())
+ {
+ Definition::Number<double> n;
+ (*pDef)[_T("transition")].GetAsNumber(n, &m_n2n.transition);
+ if(n.value >= 0) accel = n.value;
+ }
+
+ t = accel == 0 ? 1 :
+ accel == 1 ? t :
+ accel >= 1e10 ? 0 :
+ pow(t, accel);
+ }
+ }
+ catch(Exception&)
+ {
+ }
+
+ return t;
+ }
+
+ template<class T>
+ bool Subtitle::MixValue(Definition& def, T& value, double t)
+ {
+ CAtlStringMap<T> n2n;
+ return MixValue(def, value, t, &n2n);
+ }
+
+ template<>
+ bool Subtitle::MixValue(Definition& def, double& value, double t)
+ {
+ CAtlStringMap<double> n2n;
+ return MixValue(def, value, t, &n2n);
+ }
+
+ template<class T>
+ bool Subtitle::MixValue(Definition& def, T& value, double t, CAtlStringMap<T>* n2n)
+ {
+ if(!def.IsValue()) return false;
+
+ if(t >= 0.5)
+ {
+ if(n2n && def.IsValue(Definition::string))
+ {
+ if(CAtlStringMap<T>::CPair* p = n2n->Lookup(def))
+ {
+ value = p->m_value;
+ return true;
+ }
+ }
+
+ value = (T)def;
+ }
+
+ return true;
+ }
+
+ template<>
+ bool Subtitle::MixValue(Definition& def, double& value, double t, CAtlStringMap<double>* n2n)
+ {
+ if(!def.IsValue()) return false;
+
+ if(t > 0)
+ {
+ if(n2n && def.IsValue(Definition::string))
+ {
+ if(CAtlStringMap<double>::CPair* p = n2n->Lookup(def))
+ {
+ value += (p->m_value - value) * t;
+ return true;
+ }
+ }
+
+ value += ((double)def - value) * t;
+ }
+
+ return true;
+ }
+
+ void Subtitle::MixStyle(Definition* pDef, Style& dst, double t)
+ {
+ const Style src = dst;
+
+ if(t <= 0) return;
+ else if(t > 1) t = 1;
+
+ MixValue((*pDef)[_T("linebreak")], dst.linebreak, t);
+
+ Definition& placement = (*pDef)[_T("placement")];
+
+ MixValue(placement[_T("clip")][_T("t")], dst.placement.clip.t, t);
+ MixValue(placement[_T("clip")][_T("r")], dst.placement.clip.r, t);
+ MixValue(placement[_T("clip")][_T("b")], dst.placement.clip.b, t);
+ MixValue(placement[_T("clip")][_T("l")], dst.placement.clip.l, t);
+ MixValue(placement[_T("align")][_T("h")], dst.placement.align.h, t, &m_n2n.align[0]);
+ MixValue(placement[_T("align")][_T("v")], dst.placement.align.v, t, &m_n2n.align[1]);
+ dst.placement.pos.auto_x = !MixValue(placement[_T("pos")][_T("x")], dst.placement.pos.x, dst.placement.pos.auto_x ? 1 : t);
+ dst.placement.pos.auto_y = !MixValue(placement[_T("pos")][_T("y")], dst.placement.pos.y, dst.placement.pos.auto_y ? 1 : t);
+ MixValue(placement[_T("offset")][_T("x")], dst.placement.offset.x, t);
+ MixValue(placement[_T("offset")][_T("y")], dst.placement.offset.y, t);
+ MixValue(placement[_T("angle")][_T("x")], dst.placement.angle.x, t);
+ MixValue(placement[_T("angle")][_T("y")], dst.placement.angle.y, t);
+ MixValue(placement[_T("angle")][_T("z")], dst.placement.angle.z, t);
+
+ Definition& font = (*pDef)[_T("font")];
+
+ MixValue(font[_T("face")], dst.font.face, t);
+ MixValue(font[_T("size")], dst.font.size, t);
+ MixValue(font[_T("weight")], dst.font.weight, t, &m_n2n.weight);
+ MixValue(font[_T("color")][_T("a")], dst.font.color[0], t);
+ MixValue(font[_T("color")][_T("r")], dst.font.color[1], t);
+ MixValue(font[_T("color")][_T("g")], dst.font.color[2], t);
+ MixValue(font[_T("color")][_T("b")], dst.font.color[3], t);
+ MixValue(font[_T("underline")], dst.font.underline, t);
+ MixValue(font[_T("strikethrough")], dst.font.strikethrough, t);
+ MixValue(font[_T("italic")], dst.font.italic, t);
+ MixValue(font[_T("spacing")], dst.font.spacing, t);
+ MixValue(font[_T("scale")][_T("cx")], dst.font.scale.cx, t);
+ MixValue(font[_T("scale")][_T("cy")], dst.font.scale.cy, t);
+
+ Definition& background = (*pDef)[_T("background")];
+
+ MixValue(background[_T("color")][_T("a")], dst.background.color[0], t);
+ MixValue(background[_T("color")][_T("r")], dst.background.color[1], t);
+ MixValue(background[_T("color")][_T("g")], dst.background.color[2], t);
+ MixValue(background[_T("color")][_T("b")], dst.background.color[3], t);
+ MixValue(background[_T("size")], dst.background.size, t);
+ MixValue(background[_T("type")], dst.background.type, t);
+
+ Definition& shadow = (*pDef)[_T("shadow")];
+
+ MixValue(shadow[_T("color")][_T("a")], dst.shadow.color[0], t);
+ MixValue(shadow[_T("color")][_T("r")], dst.shadow.color[1], t);
+ MixValue(shadow[_T("color")][_T("g")], dst.shadow.color[2], t);
+ MixValue(shadow[_T("color")][_T("b")], dst.shadow.color[3], t);
+ MixValue(shadow[_T("depth")], dst.shadow.depth, t);
+ MixValue(shadow[_T("angle")], dst.shadow.angle, t);
+ MixValue(shadow[_T("blur")], dst.shadow.blur, t);
+
+ Definition& fill = (*pDef)[_T("fill")];
+
+ MixValue(fill[_T("color")][_T("a")], dst.fill.color[0], t);
+ MixValue(fill[_T("color")][_T("r")], dst.fill.color[1], t);
+ MixValue(fill[_T("color")][_T("g")], dst.fill.color[2], t);
+ MixValue(fill[_T("color")][_T("b")], dst.fill.color[3], t);
+ MixValue(fill[_T("width")], dst.fill.width, t);
+
+ if(fill.m_priority >= PNormal) // this assumes there is no way to set low priority inline overrides
+ {
+ if(dst.fill.id > 0) throw Exception(_T("cannot apply fill more than once on the same text"));
+ dst.fill.id = ++Fill::gen_id;
+ }
+ }
+
+ void Subtitle::Parse(Stream& s, Style style, double at, CAtlStringMap<double> offset, Reference* pParentRef)
+ {
+ Text text;
+ text.style = style;
+
+ for(int c = s.PeekChar(); c != Stream::EOS; c = s.PeekChar())
+ {
+ s.GetChar();
+
+ if(c == '[')
+ {
+ AddText(text);
+
+ style = text.style;
+
+ CAtlStringMap<double> inneroffset = offset;
+
+ int default_id = 0;
+
+ do
+ {
+ Definition* pDef = m_pFile->CreateDef(pParentRef);
+
+ m_pFile->ParseRefs(s, pDef, _T(",;]"));
+
+ ASSERT(pDef->IsType(_T("style")) || pDef->IsTypeUnknown());
+
+ double t = GetMixWeight(pDef, at, offset, ++default_id);
+
+ MixStyle(pDef, style, t);
+
+ s.SkipWhiteSpace();
+ c = s.GetChar();
+ }
+ while(c == ',' || c == ';');
+
+ if(c != ']') s.ThrowError(_T("unterminated override"));
+
+ bool fWhiteSpaceNext = s.IsWhiteSpace(s.PeekChar());
+ c = s.SkipWhiteSpace();
+
+ if(c == '{')
+ {
+ s.GetChar();
+ Parse(s, style, at, inneroffset, pParentRef);
+ }
+ else
+ {
+ if(fWhiteSpaceNext) text.str += (TCHAR)Text::SP;
+ text.style = style;
+ }
+ }
+ else if(c == ']')
+ {
+ s.ThrowError(_T("unexpected ] found"));
+ }
+ else if(c == '{')
+ {
+ AddText(text);
+ Parse(s, text.style, at, offset, pParentRef);
+ }
+ else if(c == '}')
+ {
+ break;
+ }
+ else
+ {
+ if(c == '\\')
+ {
+ c = s.GetChar();
+ if(c == Stream::EOS) break;
+ else if(c == 'n') {AddText(text); text.str = (TCHAR)Text::LSEP; AddText(text); continue;}
+ else if(c == 'h') c = Text::NBSP;
+ }
+
+ AddChar(text, (TCHAR)c);
+ }
+ }
+
+ AddText(text);
+ }
+
+ void Subtitle::AddChar(Text& t, TCHAR c)
+ {
+ bool f1 = !t.str.IsEmpty() && Stream::IsWhiteSpace(t.str[t.str.GetLength()-1]);
+ bool f2 = Stream::IsWhiteSpace(c);
+ if(f2) c = Text::SP;
+ if(!f1 || !f2) t.str += (TCHAR)c;
+ }
+
+ void Subtitle::AddText(Text& t)
+ {
+ if(t.str.IsEmpty()) return;
+
+ Split sa(_T(" "), t.str, 0, Split::Max);
+
+ for(size_t i = 0, n = sa; i < n; i++)
+ {
+ CString str = sa[i];
+
+ if(!str.IsEmpty())
+ {
+ t.str = str;
+ m_text.AddTail(t);
+ }
+
+ if(i < n-1 && (m_text.IsEmpty() || m_text.GetTail().str != Text::SP))
+ {
+ t.str = (TCHAR)Text::SP;
+ m_text.AddTail(t);
+ }
+ }
+
+ t.str.Empty();
+ }
+
+ //
+
+ Point Placement::TopLeft(Rect r, Size s)
+ {
+ r.l += margin.l;
+ r.t += margin.t;
+ r.r -= margin.r;
+ r.b -= margin.b;
+
+ Point p;
+ if(pos.auto_x) p.x = r.l + ((r.r - r.l) - s.cx) * align.h;
+ else p.x = pos.x - s.cx * align.h;
+ if(pos.auto_y) p.y = r.t + ((r.b - r.t) - s.cy) * align.v;
+ else p.y = pos.y - s.cy * align.v;
+ return p;
+ }
+
+ unsigned int Fill::gen_id = 0;
+} \ No newline at end of file
diff --git a/src/subtitles/libssf/Subtitle.h b/src/subtitles/libssf/Subtitle.h
new file mode 100644
index 000000000..ad334cc02
--- /dev/null
+++ b/src/subtitles/libssf/Subtitle.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "File.h"
+
+namespace ssf
+{
+ struct Point {double x, y; bool auto_x, auto_y;};
+ struct Size {double cx, cy;};
+ struct Rect {double t, r, b, l;};
+ struct Align {double v, h;};
+ struct Angle {double x, y, z;};
+ struct Frame {CString reference; Size resolution;};
+ struct Direction {CString primary, secondary;};
+ struct Time {double start, stop;};
+ struct Background {double color[4], size; CString type;};
+ struct Shadow {double color[4], depth, angle, blur;};
+ struct Placement {Rect clip, margin; Align align; Point pos, offset; Angle angle; Point TopLeft(Rect r, Size s);};
+
+ struct Font
+ {
+ CString face;
+ double size, weight;
+ double color[4];
+ bool underline, strikethrough, italic;
+ double spacing;
+ Size scale;
+ };
+
+ struct Fill
+ {
+ static unsigned int gen_id;
+ int id;
+ double color[4];
+ double width;
+ struct Fill() : id(0) {}
+ };
+
+ struct Style
+ {
+ CString linebreak;
+ Placement placement;
+ Font font;
+ Background background;
+ Shadow shadow;
+ Fill fill;
+ };
+
+ struct Text
+ {
+ enum {SP = 0x20, NBSP = 0xa0, LSEP = 0x0a};
+ Style style;
+ CString str;
+ };
+
+ class Subtitle
+ {
+ static struct n2n_t {CAtlStringMap<double> align[2], weight, transition;} m_n2n;
+
+ File* m_pFile;
+
+ void GetStyle(Definition* pDef, Style& style);
+ double GetMixWeight(Definition* pDef, double at, CAtlStringMap<double>& offset, int default_id);
+ template<class T> bool MixValue(Definition& def, T& value, double t);
+ template<> bool MixValue(Definition& def, double& value, double t);
+ template<class T> bool MixValue(Definition& def, T& value, double t, CAtlStringMap<T>* n2n);
+ template<> bool MixValue(Definition& def, double& value, double t, CAtlStringMap<double>* n2n);
+ void MixStyle(Definition* pDef, Style& dst, double t);
+
+ void Parse(Stream& s, Style style, double at, CAtlStringMap<double> offset, Reference* pParentRef);
+
+ void AddChar(Text& t, TCHAR c);
+ void AddText(Text& t);
+
+ public:
+ Frame m_frame;
+ Direction m_direction;
+ CString m_wrap;
+ double m_layer;
+ Time m_time;
+ CAtlList<Text> m_text;
+
+ public:
+ Subtitle(File* pFile);
+ virtual ~Subtitle();
+
+ bool Parse(Definition* pDef, double start, double stop, double at);
+ };
+}; \ No newline at end of file
diff --git a/src/subtitles/libssf/SubtitleFile.cpp b/src/subtitles/libssf/SubtitleFile.cpp
new file mode 100644
index 000000000..6f4bdf061
--- /dev/null
+++ b/src/subtitles/libssf/SubtitleFile.cpp
@@ -0,0 +1,355 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "stdafx.h"
+#include "SubtitleFile.h"
+
+namespace ssf
+{
+ SubtitleFile::SubtitleFile()
+ {
+ }
+
+ SubtitleFile::~SubtitleFile()
+ {
+ }
+
+ void SubtitleFile::Parse(Stream& s)
+ {
+ m_segments.RemoveAll();
+
+ __super::Parse(s, s_predef);
+
+ // TODO: check file.format == "ssf" and file.version == 1
+
+ CAtlList<Definition*> defs;
+ GetRootRef()->GetChildDefs(defs, _T("subtitle"));
+
+ CAtlStringMap<double> offset;
+
+ POSITION pos = defs.GetHeadPosition();
+ while(pos)
+ {
+ Definition* pDef = defs.GetNext(pos);
+
+ try
+ {
+ Definition::Time time;
+
+ if(pDef->GetAsTime(time, offset) && (*pDef)[_T("@")].IsValue())
+ {
+ m_segments.Insert(time.start.value, time.stop.value, pDef);
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ }
+
+ bool SubtitleFile::Lookup(double at, CAutoPtrList<Subtitle>& subs)
+ {
+ if(!subs.IsEmpty()) {ASSERT(0); return false;}
+
+ CAtlList<SegmentItem> sis;
+ m_segments.Lookup(at, sis);
+
+ POSITION pos = sis.GetHeadPosition();
+ while(pos)
+ {
+ SegmentItem& si = sis.GetNext(pos);
+
+ CAutoPtr<Subtitle> s(new Subtitle(this));
+
+ if(s->Parse(si.pDef, si.start, si.stop, at))
+ {
+ for(POSITION pos = subs.GetHeadPosition(); pos; subs.GetNext(pos))
+ {
+ if(s->m_layer < subs.GetAt(pos)->m_layer)
+ {
+ subs.InsertBefore(pos, s);
+ break;
+ }
+ }
+
+ if(s)
+ {
+ subs.AddTail(s);
+ }
+ }
+ }
+
+ return !subs.IsEmpty();
+ }
+
+ //
+
+ SubtitleFile::Segment::Segment(double start, double stop, const SegmentItem* si)
+ {
+ m_start = start;
+ m_stop = stop;
+ if(si) AddTail(*si);
+ }
+
+ SubtitleFile::Segment::Segment(const Segment& s)
+ {
+ *this = s;
+ }
+
+ void SubtitleFile::Segment::operator = (const Segment& s)
+ {
+ m_start = s.m_start;
+ m_stop = s.m_stop;
+ RemoveAll();
+ AddTailList(&s);
+ }
+
+ //
+
+ void SubtitleFile::SegmentList::RemoveAll()
+ {
+ __super::RemoveAll();
+ m_index.RemoveAll();
+ }
+
+ void SubtitleFile::SegmentList::Insert(double start, double stop, Definition* pDef)
+ {
+ if(start >= stop) {ASSERT(0); return;}
+
+ m_index.RemoveAll();
+
+ SegmentItem si = {pDef, start, stop};
+
+ if(IsEmpty())
+ {
+ AddTail(Segment(start, stop, &si));
+ return;
+ }
+
+ Segment& head = GetHead();
+ Segment& tail = GetTail();
+
+ if(start >= tail.m_stop && stop > tail.m_stop)
+ {
+ if(start > tail.m_stop) AddTail(Segment(tail.m_stop, start));
+ AddTail(Segment(start, stop, &si));
+ }
+ else if(start < head.m_start && stop <= head.m_start)
+ {
+ if(stop < head.m_start) AddHead(Segment(stop, head.m_start));
+ AddHead(Segment(start, stop, &si));
+ }
+ else
+ {
+ if(start < head.m_start)
+ {
+ AddHead(Segment(start, head.m_start, &si));
+ start = head.m_start;
+ }
+
+ if(stop > tail.m_stop)
+ {
+ AddTail(Segment(tail.m_stop, stop, &si));
+ stop = tail.m_stop;
+ }
+
+ for(POSITION pos = GetHeadPosition(); pos; GetNext(pos))
+ {
+ Segment& s = GetAt(pos);
+
+ if(start >= s.m_stop) continue;
+ if(stop <= s.m_start) break;
+
+ if(s.m_start < start && start < s.m_stop)
+ {
+ Segment s2 = s;
+ s2.m_start = start;
+ InsertAfter(pos, s2);
+ s.m_stop = start;
+ }
+ else if(s.m_start == start)
+ {
+ if(stop > s.m_stop)
+ {
+ start = s.m_stop;
+ }
+ else if(stop < s.m_stop)
+ {
+ Segment s2 = s;
+ s2.m_start = stop;
+ InsertAfter(pos, s2);
+ s.m_stop = stop;
+ }
+
+ s.AddTail(si);
+ }
+ }
+ }
+ }
+
+ size_t SubtitleFile::SegmentList::Index(bool fForce)
+ {
+ if(m_index.IsEmpty() || fForce)
+ {
+ m_index.RemoveAll();
+ POSITION pos = GetHeadPosition();
+ while(pos) m_index.Add(&GetNext(pos));
+ }
+
+ return m_index.GetCount();
+ }
+
+ void SubtitleFile::SegmentList::Lookup(double at, CAtlList<SegmentItem>& sis)
+ {
+ sis.RemoveAll();
+
+ size_t k;
+ if(Lookup(at, k))
+ {
+ sis.AddTailList(GetSegment(k));
+ }
+ }
+
+ bool SubtitleFile::SegmentList::Lookup(double at, size_t& k)
+ {
+ if(!Index()) return false;
+
+ size_t i = 0, j = m_index.GetCount()-1;
+
+ if(m_index[i]->m_start <= at && at < m_index[j]->m_stop)
+ do
+ {
+ k = (i+j)/2;
+ if(m_index[k]->m_start <= at && at < m_index[k]->m_stop) {return true;}
+ else if(at < m_index[k]->m_start) {if(j == k) k--; j = k;}
+ else if(at >= m_index[k]->m_stop) {if(i == k) k++; i = k;}
+ }
+ while(i <= j);
+
+ return false;
+ }
+
+ const SubtitleFile::Segment* SubtitleFile::SegmentList::GetSegment(size_t k)
+ {
+ return 0 <= k && k < m_index.GetCount() ? m_index[k] : NULL;
+ }
+
+ // TODO: this should be overridable from outside
+
+ LPCTSTR SubtitleFile::s_predef =
+ _T("color#white {a: 255; r: 255; g: 255; b: 255;}; \n")
+ _T("color#black {a: 255; r: 0; g: 0; b: 0;}; \n")
+ _T("color#gray {a: 255; r: 128; g: 128; b: 128;}; \n")
+ _T("color#red {a: 255; r: 255; g: 0; b: 0;}; \n")
+ _T("color#green {a: 255; r: 0; g: 255; b: 0;}; \n")
+ _T("color#blue {a: 255; r: 0; g: 0; b: 255;}; \n")
+ _T("color#cyan {a: 255; r: 0; g: 255; b: 255;}; \n")
+ _T("color#yellow {a: 255; r: 255; g: 255; b: 0;}; \n")
+ _T("color#magenta {a: 255; r: 255; g: 0; b: 255;}; \n")
+ _T(" \n")
+ _T("align#topleft {v: \"top\"; h: \"left\";}; \n")
+ _T("align#topcenter {v: \"top\"; h: \"center\";}; \n")
+ _T("align#topright {v: \"top\"; h: \"right\";}; \n")
+ _T("align#middleleft {v: \"middle\"; h: \"left\";}; \n")
+ _T("align#middlecenter {v: \"middle\"; h: \"center\";}; \n")
+ _T("align#middleright {v: \"middle\"; h: \"right\";}; \n")
+ _T("align#bottomleft {v: \"bottom\"; h: \"left\";}; \n")
+ _T("align#bottomcenter {v: \"bottom\"; h: \"center\";}; \n")
+ _T("align#bottomright {v: \"bottom\"; h: \"right\";}; \n")
+ _T(" \n")
+ _T("time#time {scale: 1;}; \n")
+ _T("time#startstop {start: \"start\"; stop: \"stop\";}; \n")
+ _T(" \n")
+ _T("#b {font.weight: \"bold\"}; \n")
+ _T("#i {font.italic: \"true\"}; \n")
+ _T("#u {font.underline: \"true\"}; \n")
+ _T("#s {font.strikethrough: \"true\"}; \n")
+ _T(" \n")
+ _T("#nobr {linebreak: \"none\"}; \n")
+ _T(" \n")
+ _T("subtitle#subtitle \n")
+ _T("{ \n")
+ _T(" frame \n")
+ _T(" { \n")
+ _T(" reference: \"video\"; \n")
+ _T(" resolution: {cx: 640; cy: 480;}; \n")
+ _T(" }; \n")
+ _T(" \n")
+ _T(" direction \n")
+ _T(" { \n")
+ _T(" primary: \"right\"; \n")
+ _T(" secondary: \"down\"; \n")
+ _T(" }; \n")
+ _T(" \n")
+ _T(" wrap: \"normal\"; \n")
+ _T(" \n")
+ _T(" layer: 0; \n")
+ _T(" \n")
+ _T(" style \n")
+ _T(" { \n")
+ _T(" linebreak: \"word\"; \n")
+ _T(" \n")
+ _T(" placement \n")
+ _T(" { \n")
+ _T(" clip: \"frame\"; \n")
+ _T(" margin: {t: 0; r: 0; b: 0; l: 0;}; \n")
+ _T(" align: bottomcenter; \n")
+ _T(" pos: \"auto\" \n")
+ _T(" offset: {x: 0; y: 0;}; \n")
+ _T(" angle: {x: 0; y: 0; z: 0;}; \n")
+ _T(" }; \n")
+ _T(" \n")
+ _T(" font \n")
+ _T(" { \n")
+ _T(" face: \"Arial\"; \n")
+ _T(" size: 20; \n")
+ _T(" weight: \"bold\"; \n")
+ _T(" color: white; \n")
+ _T(" underline: \"false\"; \n")
+ _T(" strikethrough: \"false\"; \n")
+ _T(" italic: \"false\"; \n")
+ _T(" spacing: 0; \n")
+ _T(" scale: {cx: 1; cy: 1;}; \n")
+ _T(" }; \n")
+ _T(" \n")
+ _T(" background \n")
+ _T(" { \n")
+ _T(" color: black; \n")
+ _T(" size: 2; \n")
+ _T(" type: \"outline\"; \n")
+ _T(" }; \n")
+ _T(" \n")
+ _T(" shadow \n")
+ _T(" { \n")
+ _T(" color: black {a: 128;}; \n")
+ _T(" depth: 2; \n")
+ _T(" angle: -45; \n")
+ _T(" blur: 0; \n")
+ _T(" }; \n")
+ _T(" \n")
+ _T(" fill \n")
+ _T(" { \n")
+ _T(" color: yellow; \n")
+ _T(" width: 0; \n")
+ _T(" }; \n")
+ _T(" }; \n")
+ _T("}; \n");
+}
diff --git a/src/subtitles/libssf/SubtitleFile.h b/src/subtitles/libssf/SubtitleFile.h
new file mode 100644
index 000000000..161f7566a
--- /dev/null
+++ b/src/subtitles/libssf/SubtitleFile.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+#include "File.h"
+#include "Subtitle.h"
+
+namespace ssf
+{
+ class SubtitleFile : public File
+ {
+ static LPCTSTR s_predef;
+
+ public:
+ struct SegmentItem
+ {
+ Definition* pDef;
+ double start, stop;
+ };
+
+ class Segment : public CAtlList<SegmentItem>
+ {
+ public:
+ double m_start, m_stop;
+ Segment() {}
+ Segment(double start, double stop, const SegmentItem* si = NULL);
+ Segment(const Segment& s);
+ void operator = (const Segment& s);
+ };
+
+ class SegmentList : public CAtlList<Segment>
+ {
+ CAtlArray<Segment*> m_index;
+ size_t Index(bool fForce = false);
+
+ public:
+ void RemoveAll();
+ void Insert(double start, double stop, Definition* pDef);
+ void Lookup(double at, CAtlList<SegmentItem>& sis);
+ bool Lookup(double at, size_t& k);
+ const Segment* GetSegment(size_t k);
+ };
+
+ SegmentList m_segments;
+
+ public:
+ SubtitleFile();
+ virtual ~SubtitleFile();
+
+ void Parse(Stream& s);
+ bool Lookup(double at, CAutoPtrList<Subtitle>& subs);
+ };
+} \ No newline at end of file
diff --git a/src/subtitles/libssf/demo/demo.ssa b/src/subtitles/libssf/demo/demo.ssa
new file mode 100644
index 000000000..f6a05fad7
--- /dev/null
+++ b/src/subtitles/libssf/demo/demo.ssa
@@ -0,0 +1,87 @@
+[Script Info]
+; This is a Sub Station Alpha v4 script.
+; For Sub Station Alpha info and downloads,
+; go to http://www.eswat.demon.co.uk/
+; or email kotus@eswat.demon.co.uk
+;
+ScriptType: v4.00
+Collisions: Normal
+PlayResX: 320
+PlayResY: 240
+Timer: 100.0000
+
+[V4 Styles]
+Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
+Style: MainB,Arial,14,&H00ffff,&H00ff00,&H000000,&H000000, 0,-1,1,2,4,1,16,16,16,0,0
+Style: Default,Arial,18,&Hffffff,&H00ffff,&H000000,&H000000, -1, 0,1,2,3,2,20,20,20,0,1
+Style: MainT,Arial,14,&H00ffff,&H00ff00,&H000000,&H000000, 0, 0,1,2,4,5,16,16,16,0,0
+Style: Karaoke,Arial,14,&H40ffff,&Hff4040,&H000000,&H000000, 0, 0,1,2,4,5,16,16,16,0,0
+Style: B4S4B,Arial,14,&He0e0e0,&H00ff00,&H804000,&H804000, 0,-1,1,4,4,5,16,16,40,0,0
+Style: B0S0K,Arial,14,&He0e0e0,&H00ff00,&H000000,&H000000, 0,-1,1,0,0,5,16,16,40,0,0
+Style: B2S2R,Arial,14,&He0e0e0,&H00ff00,&H004080,&H004080, 0,-1,1,2,2,5,16,16,40,0,0
+Style: B2S6G,Arial,14,&He0e0e0,&H00ff00,&H408000,&H408000, 0,-1,1,2,6,5,16,16,40,0,0
+Style: ShiftJIS,MS Gothic,20,&He0e0e0,&H00ff00,&H000000,&H000000, 0, 0,1,2,4,5,16,16,16,0,128
+Style: Timer,Arial,14,&H00ffff,&H00ff00,&H000000,&H000000, 0,-1,1,2,4,5,16,16,40,0,0
+
+
+[Events]
+Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
+Dialogue: Marked=0,0:00:00.00,0:00:05.00,MainB,,0000,0000,0000,!Effect,{\q1}Subtitler filter for VirtualDub\NDemonstration script\N\NAvery Lee <phaeron@virtualdub.org>
+Dialogue: Marked=0,0:00:05.00,0:00:10.00,MainB,,0000,0000,0000,!Effect,{\q1}Introduction\N\NThis script will demonstrate some of the simpler features of the subtitler. You will want to refer to the {\fnCourier New\b1}readme.txt{\r} file for a more complete reference.
+Dialogue: Marked=0,0:00:10.00,0:00:21.00,MainB,,0000,0000,0000,!Effect,{\q1}Dialogue lines\N\NScripts are based on dialogue lines. Each dialogue line has a start time, an end time, and text to display in between.
+Dialogue: Marked=0,0:00:10.00,0:00:11.00,Timer,,0000,0000,0000,!Effect,0:00
+Dialogue: Marked=0,0:00:11.00,0:00:12.00,Timer,,0000,0000,0000,!Effect,0:01
+Dialogue: Marked=0,0:00:12.00,0:00:13.00,Timer,,0000,0000,0000,!Effect,0:02
+Dialogue: Marked=0,0:00:13.00,0:00:14.00,Timer,,0000,0000,0000,!Effect,0:03
+Dialogue: Marked=0,0:00:14.00,0:00:15.00,Timer,,0000,0000,0000,!Effect,0:04
+Dialogue: Marked=0,0:00:15.00,0:00:16.00,Timer,,0000,0000,0000,!Effect,0:05
+Dialogue: Marked=0,0:00:16.00,0:00:17.00,Timer,,0000,0000,0000,!Effect,0:06
+Dialogue: Marked=0,0:00:17.00,0:00:18.00,Timer,,0000,0000,0000,!Effect,0:07
+Dialogue: Marked=0,0:00:18.00,0:00:19.00,Timer,,0000,0000,0000,!Effect,0:08
+Dialogue: Marked=0,0:00:19.00,0:00:20.00,Timer,,0000,0000,0000,!Effect,0:09
+Dialogue: Marked=0,0:00:20.00,0:00:21.00,Timer,,0000,0000,0000,!Effect,0:10
+Dialogue: Marked=0,0:00:12.00,0:00:15.00,MainT,,0000,0000,0000,!Effect,{\c&H80FF00&}Hello.
+Dialogue: Marked=0,0:00:16.00,0:00:19.00,MainT,,0000,0000,0000,!Effect,{\c&HE0E0E0&}Oh, hi.
+Dialogue: Marked=0,0:00:10.00,0:00:12.00,MainT,,0000,0000,0080,!Effect,{\c&H407F00&}[02:00-05:00] Hello.
+Dialogue: Marked=0,0:00:12.00,0:00:15.00,MainT,,0000,0000,0080,!Effect,{\c&H80FF00&}[02:00-05:00] Hello.
+Dialogue: Marked=0,0:00:15.00,0:00:21.00,MainT,,0000,0000,0080,!Effect,{\c&H407F00&}[02:00-05:00] Hello.
+Dialogue: Marked=0,0:00:10.00,0:00:16.00,MainT,,0000,0000,0080,!Effect,{\c&H707070&}[06:00-09:00] Oh, hi.
+Dialogue: Marked=0,0:00:16.00,0:00:19.00,MainT,,0000,0000,0080,!Effect,{\c&HE0E0E0&}[06:00-09:00] Oh, hi.
+Dialogue: Marked=0,0:00:19.00,0:00:21.00,MainT,,0000,0000,0080,!Effect,{\c&H707070&}[06:00-09:00] Oh, hi.
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0055,0055,0000,!Effect,{\q1\a10}Alignment\N\NDialogue lines may be placed in any of three horizontal placements and any of three vertical placements.
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a1\c&HE0E0E0&}Bottom\Nleft
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a2\c&HE0E0E0&}Bottom\Ncenter
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a3\c&HE0E0E0&}Bottom\Nright
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a5\c&HE0E0E0&}Top\Nleft
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a6\c&HE0E0E0&}Top\Ncenter
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a7\c&HE0E0E0&}Top\Nright
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a9\c&HE0E0E0&}Middle\Nleft
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a11\c&HE0E0E0&}Middle\Nright
+Dialogue: Marked=0,0:00:35.00,0:00:45.00,MainB,,0000,0000,0000,!Effect,{\q1}Text styles\N\NText may be varied in font, size, color, and style.
+Dialogue: Marked=0,0:00:35.00,0:00:45.00,MainT,,0000,0000,0000,!Effect,{\q1}You can have your text in {\c&H4060FF&}red{\r}, {\c&H60FF40&}green{\r}, and {\c&HFF6040&}blue{\r}; {\fnCourier New}Courier{\r}; {\fs16}16 point{\r} or {\fs32}32 point{\r}; {\b1}bold{\r}, {\i1}italic{\r}, or even {\b1\i1}bold italic{\r}.
+Dialogue: Marked=0,0:00:47.00,0:00:57.00,MainB,,0000,0000,0000,!Effect,{\q1}Wrapping styles\N\NThree wrapping modes are supported: manual only, automatic wrapping, and smart wrapping. Smart wrapping is automatic wrapping, but with the lines broken as evenly as possible.
+Dialogue: Marked=0,0:00:47.00,0:00:57.00,MainT,,0000,0000,0000,!Effect,{\q2\c&HE0FF80&}This line uses manual wrapping and won't\nbe wrapped except where explicitly broken.
+Dialogue: Marked=0,0:00:47.00,0:00:57.00,MainT,,0000,0000,0045,!Effect,{\q1\c&H80E0FF&}This line uses automatic wrapping and is broken automatically.
+Dialogue: Marked=0,0:00:47.00,0:00:57.00,MainT,,0000,0000,0090,!Effect,{\q0\a6\c&HFFE080&}This line uses smart wrapping and is broken with even lines. It's good for centered text.
+Dialogue: Marked=0,0:00:59.00,0:01:24.00,MainB,,0000,0000,0000,!Effect,{\q1}Collisions\N\NIf two dialogue items attempt to display at the same time and place, the second one is pushed clear of the first. However, text stays in place after it is resolved, even if the collider disappears.
+Dialogue: Marked=0,0:01:02.00,0:01:07.00,MainT,,0000,0000,0000,!Effect,{\q1\c&HE0E0E0&}Man, I gotta get out of here!
+Dialogue: Marked=0,0:01:07.00,0:01:17.00,MainT,,0000,0000,0000,!Effect,{\q1\c&HE0E0E0&}Which way should I go? I'm not going back to school....
+Dialogue: Marked=0,0:01:10.00,0:01:21.00,MainT,,0000,0000,0000,!Effect,{\q1\a7\c&H50D0FF&}Ranma, you're in the way! Move!
+Dialogue: Marked=0,0:01:15.00,0:01:21.30,MainT,,0000,0000,0000,!Effect,{\q1\c&HE0E0E0&}Why would I move for an uncute tomboy like you?
+Dialogue: Marked=0,0:01:21.00,0:01:25.00,MainT,,0000,0000,0000,!Effect,{\q1\a7\c&H50D0FF&}Ranma no baka!!!
+Dialogue: Marked=0,0:01:21.50,0:01:24.00,MainT,,0000,0000,0000,!Effect,{\q1\c&HE0E0E0&}*wham*
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,MainB,,0000,0000,0000,!Effect,{\q1}Shadows and borders\N\NYou can vary the depth of the translucent shadow as well as the thickness and color of the border.
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,B0S0K,,0000,0000,0000,!Effect,Border=0, shadow=0
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,B2S2R,,0000,0000,0030,!Effect,Border=2, shadow=2 (red)
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,B2S6G,,0000,0000,0060,!Effect,Border=2, shadow=6 (green)
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,B4S4B,,0000,0000,0090,!Effect,Border=4, shadow=4 (blue)
+Dialogue: Marked=0,0:01:38.00,0:01:48.00,MainB,,0000,0000,0000,!Effect,{\q1}Karaoke\N\NLetting people sing to music is dangerous. But if they're going to do it anyway, they might as well have some help. Both snap and smooth styles are supported.
+Dialogue: Marked=0,0:01:40.00,0:01:45.00,Karaoke,,0000,0000,0000,Karaoke,{\fs18\k100}one {\k100}two {\k50}three-{\k50}and {\k100}four
+Dialogue: Marked=0,0:01:40.00,0:01:45.00,Karaoke,,0000,0000,0030,Karaoke,{\fs18\K100}one {\K100}two {\K50}three-{\K50}and {\K100}four
+Dialogue: Marked=0,0:01:50.00,0:02:00.00,MainB,,0000,0000,0000,!Effect,{\q1}DBCS (double-byte character set) support\N\NIf you have the appropriate language support installed, you can display far-east text in your subtitles. (By the way, I don't really know Japanese, so I'm kind of winged it above with the JWPce dictionary.)
+Dialogue: Marked=0,0:01:50.00,0:02:00.00,ShiftJIS,,0000,0000,0000,!Effect,{\q1}{\fe0}[Keitarou]{\fe128}‚¾BBB‘åä•vH
+Dialogue: Marked=0,0:01:52.00,0:02:00.00,ShiftJIS,,0000,0000,0000,!Effect,{\a7\q1\c&HFFFF00&\fe0}[Naru]{\fe128}‰½‚æI
+Dialogue: Marked=0,0:02:02.00,0:02:17.00,MainB,,0000,0000,0000,!Effect,{\q1}Motion effects\N\NYou can scroll text in like a banner, or up the screen.
+Dialogue: Marked=0,0:02:02.00,0:02:17.00,MainT,,0000,0000,0000,Banner;30,Text is fun. We like scrolling text.
+Dialogue: Marked=0,0:02:02.00,0:02:17.00,MainT,,0000,0000,0000,Scroll Up;40;50;120,{\q1}You can scroll lots of text up this way. Personally, I find it a little annoying to have a lot of text coming up very slowly on screen, but it's a useful technique to have for credits and other long lists in tabular form.
+Dialogue: Marked=0,0:02:19.00,0:02:50.00,MainB,,0000,0000,0000,!Effect,{\q1}Conclusion\N\NThat concludes the demo. I hope you've enjoyed the brief glimpse I've given you here, and encourage you to read the {\fnCourier New\b1}readme.txt{\r} file for more information on the effects you've seen here. Also, if you're bored, try loading this script into Kotus' Sub Station Alpha V4 program. Not all effects will render correctly, but most of the file will. Have fun, and keep on subtitling!\N\N{\fnCourier New}--{\r}Avery Lee <phaeron@virtualdub.org>\N{\fnCourier New}\h\h{\r}Author of VirtualDub and the 'subtitler' filter
diff --git a/src/subtitles/libssf/demo/demo.ssf b/src/subtitles/libssf/demo/demo.ssf
new file mode 100644
index 000000000..dbce4e759
--- /dev/null
+++ b/src/subtitles/libssf/demo/demo.ssf
@@ -0,0 +1,591 @@
+/*
+ This file is the direct translation of demo.ssa of the "subtitler" virtualdub plugin
+*/
+
+file#file
+{
+ format: "ssf";
+ version: 1;
+};
+
+/*
+PlayResX: 320
+PlayResY: 240
+*/
+
+subtitle#subtitle
+{
+ frame
+ {
+ reference: "video";
+ resolution: {cx: 320; cy: 240;};
+ };
+
+ style
+ {
+ placement {align: bottomleft; margin {t: 16; r: 16; b: 16; l: 16;};};
+ font {size: 14; weight: "normal"; color: yellow;};
+ shadow.depth: 4;
+ };
+};
+
+/*
+Style: MainB,Arial,14,&H00ffff,&H00ff00,&H000000,&H000000, 0,-1,1,2,4,1,16,16,16,0,0
+Style: Default,Arial,18,&Hffffff,&H00ffff,&H000000,&H000000, -1, 0,1,2,3,2,20,20,20,0,1
+Style: MainT,Arial,14,&H00ffff,&H00ff00,&H000000,&H000000, 0, 0,1,2,4,5,16,16,16,0,0
+Style: Karaoke,Arial,14,&H40ffff,&Hff4040,&H000000,&H000000, 0, 0,1,2,4,5,16,16,16,0,0
+Style: B4S4B,Arial,14,&He0e0e0,&H00ff00,&H804000,&H804000, 0,-1,1,4,4,5,16,16,40,0,0
+Style: B0S0K,Arial,14,&He0e0e0,&H00ff00,&H000000,&H000000, 0,-1,1,0,0,5,16,16,40,0,0
+Style: B2S2R,Arial,14,&He0e0e0,&H00ff00,&H004080,&H004080, 0,-1,1,2,2,5,16,16,40,0,0
+Style: B2S6G,Arial,14,&He0e0e0,&H00ff00,&H408000,&H408000, 0,-1,1,2,6,5,16,16,40,0,0
+Style: ShiftJIS,MS Gothic,20,&He0e0e0,&H00ff00,&H000000,&H000000, 0, 0,1,2,4,5,16,16,16,0,128
+Style: Timer,Arial,14,&H00ffff,&H00ff00,&H000000,&H000000, 0,-1,1,2,4,5,16,16,40,0,0
+*/
+
+#MainT {placement.align: topleft;};
+#MainB {font.italic: "true";};
+#Karaoke : MainT {font.color.b: 0x40;};
+#Timer : MainT MainB {placement.margin.t: 40;};
+#BxSxC : Timer {font.color {r: 0xe0; g: 0xe0; b: 0xe0;};};
+#B4S4B : BxSxC {background {color: {r: 0x00; g: 0x40; b: 0x80;}; size: 4;};};
+#B0S0K : BxSxC {background.size: 0; shadow.depth: 0;};
+#B2S2R : BxSxC {background.color {r: 0x80; g: 0x40; b: 0x00;}; shadow.depth: 2;};
+#B2S6G : BxSxC {background.color {r: 0x00; g: 0x80; b: 0x40;}; shadow.depth: 6;};
+#ShiftJIS : MainT {font {face: "MS Gothic"; size: 20; color: {r: 0xe0; g: 0xe0; b: 0xe0;};};};
+
+/*
+Dialogue: Marked=0,0:00:00.00,0:00:05.00,MainB,,0000,0000,0000,!Effect,{\q1}Subtitler filter for VirtualDub\NDemonstration script\N\NAvery Lee <phaeron@virtualdub.org>
+Dialogue: Marked=0,0:00:05.00,0:00:10.00,MainB,,0000,0000,0000,!Effect,{\q1}Introduction\N\NThis script will demonstrate some of the simpler features of the subtitler. You will want to refer to the {\fnCourier New\b1}readme.txt{\r} file for a more complete reference.
+Dialogue: Marked=0,0:00:10.00,0:00:21.00,MainB,,0000,0000,0000,!Effect,{\q1}Dialogue lines\N\NScripts are based on dialogue lines. Each dialogue line has a start time, an end time, and text to display in between.
+*/
+
+#notes
+{
+ style: MainB;
+};
+
+subtitle : notes
+{
+ time {start: 00:00:00.000; stop: 00:00:05.000;};
+
+ @ {
+ Subtitler filter for VirtualDub\n
+ Demonstration script\n\n
+ Avery Lee <phaeron@virtualdub.org>
+ };
+};
+
+subtitle : notes
+{
+ time {start: 00:00:05.000; stop: 00:00:10.000;};
+
+ @ {
+ Introduction\n\n
+ This script will demonstrate some of the simpler features of the subtitler. You will want to
+ refer to the [{font {face: "Courier New"; weight: "bold";};}] {readme.txt} file for a more
+ complete reference.
+ };
+};
+
+subtitle : notes
+{
+ time {start: 00:00:10.000; stop: 00:00:21.000;};
+
+ @ {
+ Dialogue lines\n\n
+ Scripts are based on dialogue lines. Each dialogue line has a start time, an end time, and text
+ to display in between.
+ };
+};
+
+/*
+Dialogue: Marked=0,0:00:10.00,0:00:11.00,Timer,,0000,0000,0000,!Effect,0:00
+Dialogue: Marked=0,0:00:11.00,0:00:12.00,Timer,,0000,0000,0000,!Effect,0:01
+Dialogue: Marked=0,0:00:12.00,0:00:13.00,Timer,,0000,0000,0000,!Effect,0:02
+Dialogue: Marked=0,0:00:13.00,0:00:14.00,Timer,,0000,0000,0000,!Effect,0:03
+Dialogue: Marked=0,0:00:14.00,0:00:15.00,Timer,,0000,0000,0000,!Effect,0:04
+Dialogue: Marked=0,0:00:15.00,0:00:16.00,Timer,,0000,0000,0000,!Effect,0:05
+Dialogue: Marked=0,0:00:16.00,0:00:17.00,Timer,,0000,0000,0000,!Effect,0:06
+Dialogue: Marked=0,0:00:17.00,0:00:18.00,Timer,,0000,0000,0000,!Effect,0:07
+Dialogue: Marked=0,0:00:18.00,0:00:19.00,Timer,,0000,0000,0000,!Effect,0:08
+Dialogue: Marked=0,0:00:19.00,0:00:20.00,Timer,,0000,0000,0000,!Effect,0:09
+Dialogue: Marked=0,0:00:20.00,0:00:21.00,Timer,,0000,0000,0000,!Effect,0:10
+*/
+
+#clocktest
+{
+ time {start: +0s; stop: +1s;};
+ style: Timer;
+};
+
+subtitle : clocktest {@ {0:00}; time.start: 00:00:10.000;};
+subtitle : clocktest {@ {0:01};};
+subtitle : clocktest {@ {0:02};};
+subtitle : clocktest {@ {0:03};};
+subtitle : clocktest {@ {0:04};};
+subtitle : clocktest {@ {0:05};};
+subtitle : clocktest {@ {0:06};};
+subtitle : clocktest {@ {0:07};};
+subtitle : clocktest {@ {0:08};};
+subtitle : clocktest {@ {0:09};};
+subtitle : clocktest {@ {0:10};};
+
+/*
+Dialogue: Marked=0,0:00:12.00,0:00:15.00,MainT,,0000,0000,0000,!Effect,{\c&H80FF00&}Hello.
+Dialogue: Marked=0,0:00:16.00,0:00:19.00,MainT,,0000,0000,0000,!Effect,{\c&HE0E0E0&}Oh, hi.
+Dialogue: Marked=0,0:00:10.00,0:00:12.00,MainT,,0000,0000,0080,!Effect,{\c&H407F00&}[02:00-05:00] Hello.
+Dialogue: Marked=0,0:00:12.00,0:00:15.00,MainT,,0000,0000,0080,!Effect,{\c&H80FF00&}[02:00-05:00] Hello.
+Dialogue: Marked=0,0:00:15.00,0:00:21.00,MainT,,0000,0000,0080,!Effect,{\c&H407F00&}[02:00-05:00] Hello.
+Dialogue: Marked=0,0:00:10.00,0:00:16.00,MainT,,0000,0000,0080,!Effect,{\c&H707070&}[06:00-09:00] Oh, hi.
+Dialogue: Marked=0,0:00:16.00,0:00:19.00,MainT,,0000,0000,0080,!Effect,{\c&HE0E0E0&}[06:00-09:00] Oh, hi.
+Dialogue: Marked=0,0:00:19.00,0:00:21.00,MainT,,0000,0000,0080,!Effect,{\c&H707070&}[06:00-09:00] Oh, hi.
+*/
+
+subtitle
+{
+ time {start: 00:00:12.000; stop: 00:00:15.000;};
+ style: MainT {font.color {r: 0x00; g: 0xff; b: 0x80;};};
+ @ {Hello.};
+};
+
+subtitle
+{
+ time {start: 00:00:16.000; stop: 00:00:19.000;};
+ style: MainT {font.color {r: 0xe0; g: 0xe0; b: 0xe0;};};
+ @ {Oh, hi.};
+};
+
+#dialogtest
+{
+ style: MainT {placement.margin.t: 80;};
+ time.start: +0s;
+};
+
+#dialogtest1 : dialogtest
+{
+ @ {\[02:00-05:00\] Hello.};
+};
+
+#dialogtest2 : dialogtest
+{
+ @ {\[06:00-09:00\] Oh, hi.};
+};
+
+subtitle : dialogtest1
+{
+ time.start: 00:00:10.000;
+ time.stop: +2s;
+ style.font.color {r: 0x00; g: 0x7f; b: 0x40;};
+};
+
+subtitle : dialogtest1
+{
+ time.stop: +3s;
+ style.font.color {r: 0x00; g: 0xff; b: 0x80;};
+};
+
+subtitle : dialogtest1
+{
+ time.stop: +6s;
+ style.font.color {r: 0x00; g: 0x7f; b: 0x40;};
+};
+
+subtitle : dialogtest2
+{
+ time.start: 00:00:10.000;
+ time.stop: +6s;
+ style.font.color {r: 0x70; g: 0x70; b: 0x70;};
+};
+
+subtitle : dialogtest2
+{
+ time.stop: +3s;
+ style.font.color {r: 0xe0; g: 0xe0; b: 0xe0;};
+};
+
+subtitle : dialogtest2
+{
+ time.stop: +2s;
+ style.font.color {r: 0x70; g: 0x70; b: 0x70;};
+};
+
+/*
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0055,0055,0000,!Effect,{\q1\a10}Alignment\N\NDialogue lines may be placed in any of three horizontal placements and any of three vertical placements.
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a1\c&HE0E0E0&}Bottom\Nleft
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a2\c&HE0E0E0&}Bottom\Ncenter
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a3\c&HE0E0E0&}Bottom\Nright
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a5\c&HE0E0E0&}Top\Nleft
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a6\c&HE0E0E0&}Top\Ncenter
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a7\c&HE0E0E0&}Top\Nright
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a9\c&HE0E0E0&}Middle\Nleft
+Dialogue: Marked=0,0:00:23.00,0:00:33.00,MainB,,0008,0008,0008,!Effect,{\a11\c&HE0E0E0&}Middle\Nright
+*/
+
+#aligntest : notes
+{
+ time {start: 00:00:23.000; stop: 00:00:33.000;};
+ style {placement.margin {t: 8; r: 8; b: 8; l: 8;}; font.color {r: 0xe0; g: 0xe0; b: 0xe0;};};
+};
+
+subtitle : aligntest
+{
+ style.placement {align: middlecenter; margin {r: 55; l: 55;};};
+
+ @ {
+ Alignment\n\n
+ Dialogue lines may be placed in any of three horizontal placements and any of three vertical placements.
+ };
+};
+
+subtitle : aligntest {style.placement.align: bottomleft; @ {Bottom\nleft};};
+subtitle : aligntest {style.placement.align: bottomcenter; @ {Bottom\ncenter};};
+subtitle : aligntest {style.placement.align: bottomright; @ {Bottom\nright};};
+subtitle : aligntest {style.placement.align: topleft; @ {Top\nleft};};
+subtitle : aligntest {style.placement.align: topcenter; @ {Top\ncenter};};
+subtitle : aligntest {style.placement.align: topright; @ {Top\nright};};
+subtitle : aligntest {style.placement.align: middleleft; @ {Middle\nleft};};
+subtitle : aligntest {style.placement.align: middleright; @ {Middle\nright};};
+
+/*
+Dialogue: Marked=0,0:00:35.00,0:00:45.00,MainB,,0000,0000,0000,!Effect,{\q1}Text styles\N\NText may be varied in font, size, color, and style.
+Dialogue: Marked=0,0:00:35.00,0:00:45.00,MainT,,0000,0000,0000,!Effect,{\q1}You can have your text in {\c&H4060FF&}red{\r}, {\c&H60FF40&}green{\r}, and {\c&HFF6040&}blue{\r}; {\fnCourier New}Courier{\r}; {\fs16}16 point{\r} or {\fs32}32 point{\r}; {\b1}bold{\r}, {\i1}italic{\r}, or even {\b1\i1}bold italic{\r}.
+*/
+
+#fonttest
+{
+ time {start: 00:00:35.000; stop: 00:00:45.000;};
+};
+
+subtitle : fonttest notes
+{
+ @ {
+ Text styles\n\n
+ Text may be varied in font, size, color, and style.
+ };
+};
+
+subtitle : fonttest
+{
+ style: MainT;
+
+ @ {
+ You can have your text in
+ [{font.color {r: 0xff; g: 0x60; b: 0x40;};}] {red},
+ [{font.color {r: 0x40; g: 0xff; b: 0x60;};}] {green}, and
+ [{font.color {r: 0x40; g: 0x60; b: 0xff;};}] {blue};
+ [{font.face: "Courier New";}] {Courier};
+ [{font.size: 16;}] {16 point} or
+ [{font.size: 32;}] {32 point};
+ [{font.weight: "bold";}] {bold},
+ [{font.italic: "true";}] {italic},
+ or even
+ [{font {weight: "bold"; italic: "true";};}] {bold italic}.
+ };
+};
+
+/*
+Dialogue: Marked=0,0:00:47.00,0:00:57.00,MainB,,0000,0000,0000,!Effect,{\q1}Wrapping styles\N\NThree wrapping modes are supported: manual only, automatic wrapping, and smart wrapping. Smart wrapping is automatic wrapping, but with the lines broken as evenly as possible.
+Dialogue: Marked=0,0:00:47.00,0:00:57.00,MainT,,0000,0000,0000,!Effect,{\q2\c&HE0FF80&}This line uses manual wrapping and won't\nbe wrapped except where explicitly broken.
+Dialogue: Marked=0,0:00:47.00,0:00:57.00,MainT,,0000,0000,0045,!Effect,{\q1\c&H80E0FF&}This line uses automatic wrapping and is broken automatically.
+Dialogue: Marked=0,0:00:47.00,0:00:57.00,MainT,,0000,0000,0090,!Effect,{\q0\a6\c&HFFE080&}This line uses smart wrapping and is broken with even lines. It's good for centered text.
+*/
+
+#wraptest
+{
+ time {start: 00:00:47.000; stop: 00:00:57.000;};
+ style: MainT;
+};
+
+subtitle : wraptest notes
+{
+ @ {
+ Wrapping styles\n\n
+ Three wrapping modes are supported: manual only, automatic wrapping, and smart wrapping.
+ Smart wrapping is automatic wrapping, but with the lines broken as evenly as possible.
+ };
+};
+
+subtitle : wraptest
+{
+ style {font.color {r: 0x80; g: 0xff; b: 0xe0;};};
+ wrap: "manual";
+ @ {This line uses manual wrapping and won't\nbe wrapped except where explicitly broken.};
+};
+
+subtitle : wraptest
+{
+ style {font.color {r: 0xff; g: 0xe0; b: 0x80;}; placement.margin.top: 45;};
+ wrap: "normal";
+ @ {This line uses automatic wrapping and is broken automatically.};
+};
+
+subtitle : wraptest
+{
+ style {font.color {r: 0x80; g: 0xe0; b: 0xff;}; placement.margin.top: 90; placement.align: topcenter; };
+ wrap: "even";
+ @ {This line uses smart wrapping and is broken with even lines. It's good for centered text.};
+};
+
+/*
+Dialogue: Marked=0,0:00:59.00,0:01:24.00,MainB,,0000,0000,0000,!Effect,{\q1}Collisions\N\NIf two dialogue items attempt to display at the same time and place, the second one is pushed clear of the first. However, text stays in place after it is resolved, even if the collider disappears.
+Dialogue: Marked=0,0:01:02.00,0:01:07.00,MainT,,0000,0000,0000,!Effect,{\q1\c&HE0E0E0&}Man, I gotta get out of here!
+Dialogue: Marked=0,0:01:07.00,0:01:17.00,MainT,,0000,0000,0000,!Effect,{\q1\c&HE0E0E0&}Which way should I go? I'm not going back to school....
+Dialogue: Marked=0,0:01:10.00,0:01:21.00,MainT,,0000,0000,0000,!Effect,{\q1\a7\c&H50D0FF&}Ranma, you're in the way! Move!
+Dialogue: Marked=0,0:01:15.00,0:01:21.30,MainT,,0000,0000,0000,!Effect,{\q1\c&HE0E0E0&}Why would I move for an uncute tomboy like you?
+Dialogue: Marked=0,0:01:21.00,0:01:25.00,MainT,,0000,0000,0000,!Effect,{\q1\a7\c&H50D0FF&}Ranma no baka!!!
+Dialogue: Marked=0,0:01:21.50,0:01:24.00,MainT,,0000,0000,0000,!Effect,{\q1\c&HE0E0E0&}*wham*
+*/
+
+subtitle : notes
+{
+ time {start: 00:00:59.000; stop: 00:01:24.000;};
+
+ @ {
+ Collisions\n\n
+ If two dialogue items attempt to display at the same time and place, the second one is
+ pushed clear of the first. However, text stays in place after it is resolved, even if
+ the collider disappears.
+ };
+};
+
+#actor1
+{
+ style: MainT {font.color {r: 0xe0; g: 0xe0; b: 0xe0;};};
+};
+
+#actor2
+{
+ style: MainT {font.color {r: 0xff; g: 0xd0; b: 0x50;}; placement.align: topright;};
+};
+
+subtitle : actor1
+{
+ time {start: 00:01:02.000; stop: 00:01:07.000;};
+ @ {Man, I gotta get out of here!};
+};
+
+subtitle : actor1
+{
+ time {start: 00:01:07.000; stop: 00:01:17.000;};
+ @ {Which way should I go? I'm not going back to school....};
+};
+
+subtitle : actor2
+{
+ time {start: 00:01:10.000; stop: 00:01:21.000;};
+ @ {Ranma, you're in the way! Move!};
+};
+
+subtitle : actor1
+{
+ time {start: 00:01:15.000; stop: 00:01:21.300;};
+ @ {Why would I move for an uncute tomboy like you?};
+};
+
+subtitle : actor2
+{
+ time {start: 00:01:21.000; stop: 00:01:25.000;};
+ @ {Ranma no baka!!!};
+};
+
+subtitle : actor1
+{
+ time {start: 00:01:21.500; stop: 00:01:24.000;};
+ @ {*wham*};
+};
+
+/*
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,MainB,,0000,0000,0000,!Effect,{\q1}Shadows and borders\N\NYou can vary the depth of the translucent shadow as well as the thickness and color of the border.
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,B0S0K,,0000,0000,0000,!Effect,Border=0, shadow=0
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,B2S2R,,0000,0000,0030,!Effect,Border=2, shadow=2 (red)
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,B2S6G,,0000,0000,0060,!Effect,Border=2, shadow=6 (green)
+Dialogue: Marked=0,0:01:26.00,0:01:36.00,B4S4B,,0000,0000,0090,!Effect,Border=4, shadow=4 (blue)
+*/
+
+#bordershadowtest
+{
+ time {start: 00:01:26.000; stop: 00:01:36.000;};
+};
+
+subtitle : bordershadowtest notes
+{
+ @ {
+ Shadows and borders\n\n
+ You can vary the depth of the translucent shadow as well as the thickness and color of the border.
+ };
+};
+
+subtitle : bordershadowtest
+{
+ style: B0S0K;
+ @ {Border=0, shadow=0};
+};
+
+subtitle : bordershadowtest
+{
+ style: B2S2R {placement.margin.t: 30;};
+ @ {Border=2, shadow=2 (red)};
+};
+
+subtitle : bordershadowtest
+{
+ style: B2S6G {placement.margin.t: 60;};
+ @ {Border=2, shadow=6 (green)};
+};
+
+subtitle : bordershadowtest
+{
+ style: B4S4B {placement.margin.t: 90;};
+ @ {Border=4, shadow=4 (blue)};
+};
+
+/*
+Dialogue: Marked=0,0:01:38.00,0:01:48.00,MainB,,0000,0000,0000,!Effect,{\q1}Karaoke\N\NLetting people sing to music is dangerous. But if they're going to do it anyway, they might as well have some help. Both snap and smooth styles are supported.
+Dialogue: Marked=0,0:01:40.00,0:01:45.00,Karaoke,,0000,0000,0000,Karaoke,{\fs18\k100}one {\k100}two {\k50}three-{\k50}and {\k100}four
+Dialogue: Marked=0,0:01:40.00,0:01:45.00,Karaoke,,0000,0000,0030,Karaoke,{\fs18\K100}one {\K100}two {\K50}three-{\K50}and {\K100}four
+*/
+
+subtitle : notes
+{
+ time {start: 00:01:38.000; stop: 00:01:48.000;};
+
+ @ {
+ Karaoke\n\n
+ Letting people sing to music is dangerous. But if they're going to do it anyway,
+ they might as well have some help. Both snap and smooth styles are supported.
+ };
+};
+
+#karaoketest
+{
+ time {start: 00:01:40.000; stop: 00:01:45.000;};
+ style: Karaoke {font.size: 18;};
+};
+
+#hlcolor {r: 0x40; g: 0x40; b: 0xff;};
+#hleffect1 {time {scale: 0.01; start: +0s;}; font.color: hlcolor;};
+#hleffect2 {time {scale: 0.01; start: +0s;}; fill.width: 1;};
+
+subtitle : karaoketest
+{
+ @ {
+ [hleffect1 {time.stop: +200;}] {one}
+ [hleffect1 {time.stop: +100;}] {two}
+ [hleffect1 {time.stop: +50;}] {three-}
+ [hleffect1 {time.stop: +50;}] {and}
+ [hleffect1 {time.stop: +100;}] {four}
+ };
+};
+
+subtitle : karaoketest
+{
+ style {placement.margin.t: 30; fill.color: hlcolor;};
+
+ @ {
+ [hleffect2 {time.stop: +200;}] {one}
+ [hleffect2 {time.stop: +100;}] {two}
+ [hleffect2 {time.stop: +50;}] {three-}
+ [hleffect2 {time.stop: +50;}] {and}
+ [hleffect2 {time.stop: +100;}] {four}
+ };
+};
+
+/*
+Dialogue: Marked=0,0:01:50.00,0:02:00.00,MainB,,0000,0000,0000,!Effect,{\q1}DBCS (double-byte character set) support\N\NIf you have the appropriate language support installed, you can display far-east text in your subtitles. (By the way, I don't really know Japanese, so I'm kind of winged it above with the JWPce dictionary.)
+Dialogue: Marked=0,0:01:50.00,0:02:00.00,ShiftJIS,,0000,0000,0000,!Effect,{\q1}{\fe0}[Keitarou]{\fe128} ...
+Dialogue: Marked=0,0:01:52.00,0:02:00.00,ShiftJIS,,0000,0000,0000,!Effect,{\a7\q1\c&HFFFF00&\fe0}[Naru]{\fe128} ...
+*/
+
+subtitle : notes
+{
+ time {start: 00:01:50.000; stop: 00:02:00.000;};
+
+ @ {
+ DBCS (double-byte character set) support\n\n
+ If you have the appropriate language support installed, you can display far-east text
+ in your subtitles. (By the way, I don't really know Japanese, so I'm kind of winged it
+ above with the JWPce dictionary.)
+ };
+};
+
+subtitle
+{
+ time {start: 00:01:50.000; stop: 00:02:00.000;};
+ style: ShiftJIS;
+ @ {\[Keitarou\] ã ã€‚。。大丈夫};
+};
+
+subtitle
+{
+ time {start: 00:01:52.000; stop: 00:02:00.000;};
+ style: ShiftJIS {color: yellow; placement.align: topright;};
+ @ {\[Naru\] 何よï¼};
+};
+
+/*
+Dialogue: Marked=0,0:02:02.00,0:02:17.00,MainB,,0000,0000,0000,!Effect,{\q1}Motion effects\N\NYou can scroll text in like a banner, or up the screen.
+Dialogue: Marked=0,0:02:02.00,0:02:17.00,MainT,,0000,0000,0000,Banner;30,Text is fun. We like scrolling text.
+Dialogue: Marked=0,0:02:02.00,0:02:17.00,MainT,,0000,0000,0000,Scroll Up;40;50;120,{\q1}You can scroll lots of text up this way. Personally, I find it a little annoying to have a lot of text coming up very slowly on screen, but it's a useful technique to have for credits and other long lists in tabular form.
+*/
+
+#effecttest
+{
+ time {start: 00:02:02.000; stop: 00:02:17.000;};
+ style: MainT;
+};
+
+subtitle : effecttest notes
+{
+ @ {
+ Motion effects\n\n
+ You can scroll text in like a banner, or up the screen.
+ };
+};
+
+subtitle : effecttest
+{
+ wrap: "manual";
+ style.placement {margin {l: "right"; r: "left";}; align.h = "left";};
+ #hscroll {time {start: "start"; stop: "stop";}; placement.align.h = "right";};
+
+ @ {
+ [hscroll]
+ Text is fun. We like scrolling text.
+ };
+};
+
+subtitle : effecttest
+{
+ style.placement {margin {t: 120; b: 40;}; clip {t: 40; b: 120;}; align.v = "top";};
+ #vscroll {time {start: "start"; stop: "stop";}; placement.align.v = "bottom";};
+
+ @ {
+ [vscroll]
+ You can scroll lots of text up this way. Personally, I find it a little annoying
+ to have a lot of text coming up very slowly on screen, but it's a useful technique
+ to have for credits and other long lists in tabular form.
+ };
+};
+
+/*
+Dialogue: Marked=0,0:02:19.00,0:02:50.00,MainB,,0000,0000,0000,!Effect,{\q1}Conclusion\N\NThat concludes the demo. I hope you've enjoyed the brief glimpse I've given you here, and encourage you to read the {\fnCourier New\b1}readme.txt{\r} file for more information on the effects you've seen here. Also, if you're bored, try loading this script into Kotus' Sub Station Alpha V4 program. Not all effects will render correctly, but most of the file will. Have fun, and keep on subtitling!\N\N{\fnCourier New}--{\r}Avery Lee <phaeron@virtualdub.org>\N{\fnCourier New}\h\h{\r}Author of VirtualDub and the 'subtitler' filter
+*/
+
+subtitle : notes
+{
+ time {start: 00:02:19.000; stop: 00:02:50.000;};
+
+ #monospace {font.face: "Courier New";};
+ #monospacebold : monospace {font.weight: "bold";};
+
+ @ {
+ Conclusion\n\n
+ That concludes the demo. I hope you've enjoyed the brief glimpse I've given you here,
+ and encourage you to read the [monospacebold] {readme.txt} file for more information
+ on the effects you've seen here. Also, if you're bored, try loading this script into
+ Kotus' Sub Station Alpha V4 program. Not all effects will render correctly, but most
+ of the file will. Have fun, and keep on subtitling!\n\n
+ [monospace]{--}Avery Lee <phaeron@virtualdub.org>\n
+ [monospace]{\h\h}Author of VirtualDub and the 'subtitler' filter
+ };
+};
diff --git a/src/subtitles/libssf/docs/ssf-specs.txt b/src/subtitles/libssf/docs/ssf-specs.txt
new file mode 100644
index 000000000..081d4ea6c
--- /dev/null
+++ b/src/subtitles/libssf/docs/ssf-specs.txt
@@ -0,0 +1,586 @@
+Structured Subtitle Format 1.0 (boring name, need a better one)
+------------------------------
+
+The encoding must be utf-8/16le/16be with the BOM at the beginning.
+
+Parsing is prefered to be stream oriented, which means:
+- new-line characters in text do not differ from the rest of the white-space characters
+- forward references are not allowed
+
+Comments
+--------
+
+// a comment, ends at the end of the line
+/* this is a comment, too */
+
+Syntax
+------
+
+Fortunatelly, there is only one general way to define something. The elements are broken
+into lines for better understanding, but they can be compressed into one single line as well,
+whichever suits your preference. The term "type" could be read as "attribute" or "member of
+a structure" too.
+
+[!]
+[type[.type[..]]]
+[#name]
+[: | =]
+[refs | quoted string | num | bool | raw]
+;
+
+As you can see nearly everything is optional, even the terminating semi-colon is not required
+when a closing bracket ends the definition anyway. However, either type or #name must be given,
+otherwise there would be no meaning of the expression.
+
+"!":
+- gives the definition high priority, normal priority types of the same kind cannot override it:
+ #a {!t: 123;};
+ #b {t: 234;};
+ #c a b; // t of c equals to 123
+ - works on references too:
+ !#a {t: 123;};
+ #b {t: 234;};
+ #ab a b;
+ #c ab; // t of c still equals to 123
+- there are also low priority definitions, but only the parser is allowed to use them to predefine the defaults.
+
+"type" and "name":
+- alphanumeric or underscore characters only, without spaces
+- cannot start with a number
+- case-sensitive
+
+"type":
+- type is optional but can be inherited through referencing other names which happen to have a type already
+ color#c1 {a: 0x80;};
+ #c2: c1; // c2 also has the type of color now
+ #c3: c2; // c3 too
+- if there is a type already additional references cannot change it
+- when mixing different types (not recommended) the first one decides
+- there is one special type which have an important but a limited use: @ (see 'subtitle' for an example usage)
+ - it is not parsed for references or nested definitions
+ - the content of the following block {...} is saved as-is for the application
+ - cannot be global or named and therefore referenced
+ - { and } have to be escaped with \ inside the block (other block specific characters may as well)
+- type.type.type.... is equal to writing: type {type {type {...};};};
+
+"name":
+- every name is globally visible
+- redefining a name is forbidden, unless it was predefined by the application
+- using the type as the name (type#type) can change the type's default values
+ - however, the scope is important:
+
+ subtitle#subtitle {style.font.size: 20;};
+ style#style {font.size: 30;};
+ style#s1 {font.face: "Arial";};
+ style#s2 : s1 {font.color: red;};
+ subtitle#a {style: s2 {font.weight: "normal";};};
+
+ Here font.size equals to 20, because it inherits from subtitle#subtitle.style instead of the
+ global style#style, additionally it gets the properties of s2-s1 and the inline def. If it also
+ inherited properties from style#style through s2-s1 indirectly, there would be two default base
+ definitions and the order of overriding eachother would not be clear.
+
+ subtitle#a.style
+ <- subtitle#subtitle.style
+ <- s2 <- s1 <-NOT- style#style
+ <- {font.weight: "normal";}
+
+"refs":
+- combination of any names or nested definitions separated by spaces
+- forward references are not allowed
+- referencing a value type directly is not allowed: (TODO: this may change)
+ OK:
+ color#c1: {a: 12;};
+ color#c2: c1;
+ BAD:
+ #twelve: 12;
+ color#c2: {a: twelve;};
+- 'name' must have been defined by a parent node
+ OK:
+ #c1: {a: 12;};
+ style#s1 {color: c1;};
+ style#s2 {color: c1;};
+ BAD:
+ style#s1 {color#c1: {a: 12;};};
+ style#s2 {color: c1;}; // c1 cannot be accessed here
+
+"quoted string" or 'quoted string':
+- \ escapes characters, including " and '
+- cannot contain any new-line characters
+
+"num":
+- decimal, hexadecimal (prefixed with: 0x), float [+ unit (optional, see 'time' below for an example)]
+- there are numbers with restricted range or special formatting:
+ - degrees: <num> mod 360
+ - percent: must be between 0 and 1
+ - time: [+] [<num>:[<num>:[<num>.]]]<num> | <num>h | <num>m | <num>s | <num>ms
+
+"bool":
+- "true" | "false" | "on" | "off" | "yes" | "no" | 1 | 0
+- unrecognizable values will result in unpredictable behaviour, since there can't be a default fallback value
+
+Recognized types and attributes
+-------------------------------
+
+file
+{
+ format: <string>; // identifies the file format ("ssf")
+ version: <num>; // file format version (1)
+ language: <string>; // iso6392
+ title: <string>;
+ year: <num>;
+ author: <string>;
+};
+
+color
+{
+ // a, r, g, b: 0 - 255 or 0x00 - 0xff
+
+ a: <num>;
+ r: <num>;
+ g: <num>;
+ b: <num>;
+};
+
+point
+{
+ x: <num>;
+ y: <num>;
+};
+
+size
+{
+ cx: <num>;
+ cy: <num>;
+};
+
+rect
+{
+ t: <num>;
+ r: <num>;
+ b: <num>;
+ l: <num>;
+};
+
+align
+{
+ // when given in percent, 0 means top/left, 1 bottom/right, 0.5 middle/center
+
+ v: ["top" | "middle" | "bottom" | <percent>];
+ h: ["left" | "center" | "right" | <percent>];
+};
+
+angle
+{
+ x: <degrees>;
+ y: <degrees>;
+ z: <degrees>;
+};
+
+frame
+{
+ reference: ["video" | "window"];
+ resolution: <size>;
+};
+
+direction
+{
+ primary: ["right" | "left" | "down" | "up"];
+ secondary: ["right" | "left" | "down" | "up"]; // must be perpendicular to primary
+};
+
+placement
+{
+ clip: ["frame" | <rect>]; // anything drawn outside this rectangle is clipped
+ margin: <rect>; // "top" "right" "bottom" "left" are also valid values for the rect members, they refer to the values of the "frame" rect (0, 0, frame.resolution.cx, frame.resolution.cy)
+ align: <align>;
+ pos: ["auto" | <point>]; // absolute values, pos.x or pos.y can be animated only when both the source and destination style defined it
+ offset: <point>; // relative to pos, unlike pos this can be applied to fragments of the text as an override
+ angle: <angle>; // origin of rotation is the alignment point
+};
+
+font
+{
+ face: <string>;
+ size: <num>;
+ weight: ["normal" | "bold" | "thin" | <num>];
+ color: <color>;
+ underline: <bool>;
+ strikethrough: <bool>;
+ italic: <bool>;
+ spacing: <num>;
+ scale: <size>;
+};
+
+background
+{
+ color: <color>;
+ size: <num>;
+ type: ["outline" | "box"];
+};
+
+shadow
+{
+ color: <color>;
+ depth: <num>;
+ angle: <degrees>;
+ blur: <percent>;
+};
+
+fill
+{
+ color: <color>;
+ width: <percent>;
+
+ // It cannot be applied to the same text multiple times as an override.
+ //
+ // #k1 {fill.width:1; time {start: +0; stop: +1s;}};
+ // #k2 {fill.width:1; time {start: 0; stop: 2s;}};
+ //
+ // OK:
+ // [k1] {Hello}
+ //
+ // BAD:
+ // [k1] {Wo[k2]{r}ld!}
+ //
+};
+
+time
+{
+ id: [<string> | <num>];
+ start: <time>; // inclusive
+ stop: <time>; // exclusive
+ scale: <num>; // if the time was set WITHOUT a unit, then start and stop are measured in [scale * seconds]
+};
+
+style
+{
+ linebreak: ["word" | "char" | "none"]; // ignored if subtitle.wrap: "manual"
+ placement: <placement>;
+ font: <font>;
+ background: <background>;
+ shadow: <shadow>;
+ fill: <fill>;
+};
+
+animation
+{
+ time: <time>; // before start: previous style, after stop: this style, animation is done between start and stop according to transition
+ transition: ["linear" | "start" | "stop" | <num>]; // <num> is the same as the acceleration parameter of advanced ssa (see the "ass-specs"), "start" or "stop" sets num to 0 and inf, "linear" sets it to 1.0
+ loop: <num>; // the number of times the effect should repeat, e.g. loop set to 2 makes the style turn from src to dst twice, between start => (start+stop)/2 and (start+stop)/2 => stop
+ direction: ["fw" | "bw" | "fwbw" | "bwfw"]; // "bwfw" and "fwbw" makes the value of loop multiplied by two internally
+};
+
+subtitle
+{
+ frame: <frame>;
+ direction: <direction>;
+ wrap: ["normal" | "even" | "manual"];
+ layer: <num>;
+ time: <time>;
+ style: <style>;
+ @: {... dialog lines ...};
+
+ To have a subtitle displayed the minimal set of fields required are:
+ - time.start
+ - time.stop
+ - @
+
+ About dialog lines
+ ------------------
+
+ All white-space will be compressed into one space character.
+
+ Special characters can be enforced:
+ - new-line: \n
+ - non-breaking space: \h
+
+ Empty space will be completly removed at these places:
+ - before and after outermost text block brackets:
+ @ { --> here <-- Hello World! --> here <-- }
+ - between the inner closing and opening brackets of overrides:
+ [s1] --> here <-- {Hello World!}
+ - around forced new-lines:
+ Hello --> here <-- \n --> here <-- World!
+
+ When neighboring spaces have different styles, the style of the trailing space is used:
+ #u {font.underline: "true"};
+ #s {font.strikethrough: "true"};
+ [u] { Hello }
+ [s] { World! }
+ =>
+ Hello_World!-
+ ______-------
+
+ These special characters have to be escaped with a backslash:
+ { } [ ] \
+
+ Style overrides
+ ---------------
+
+ [refs] {... more dialog text ...}
+
+ "name" as in type#name ... is unimportant and ignored.
+
+ If there is a text block right after an override, the new style will be used only inside
+ that block.
+
+ Examples:
+
+ [s1] {s1 applies only to this block.}
+
+ [s2] s2 applies till the end of the container block.
+
+ [s1 s2 {color: red;} s3] {Multiple styles are valid just like in a normal ref list}
+
+ {
+ Nesting text blocks. Some may have overrides, others may not.
+
+ [s1]
+ {
+ Every text block will be trimmed and white-space compressed,
+ so we can use the space freely to make it a bit more readable.
+
+ {Yet another nested block}
+ }
+ }
+
+ Animation:
+
+ The override is style + animation mixed.
+
+ [{time.stop: +00:00:01.000; transition: "linear"; font.size: 20;}]
+ {
+ Here the size of the font gradually becomes 20 after one second.
+ }
+
+ [{font.color: white;}]
+ {
+ [{time.stop: +00:00:10.000; font.color: black;}]
+ {Text turns from white to black in the first 10 seconds}
+
+ [a1]
+ {This one does whatever a1 tells to do}
+ }
+
+ [{time.start: "start"; time.stop: "stop"; font.size: 20}]
+ {
+ This is a way to refer to the subtitle's own start and stop values.
+
+ You can predefine it for easier use:
+
+ #a1 {time.start: "start"; time.stop: "stop";};
+ [a1 {font.size: 20}] {...}
+ }
+
+ Karaoke effect using animation:
+
+ [{background.size: 0;}]
+ {
+ [{time.start: 0s; time.stop: +1s; background.size: 10;}]
+ {Ka}
+ [{time.start: 1s; time.stop: +1s; background.size: 10;}]
+ {ra}
+ [{time.start: 2s; time.stop: +1s; background.size: 10;}]
+ {o}
+ [{time.start: 3s; time.stop: +1s; background.size: 10;}]
+ {ke!}
+ }
+
+ To simplify the above, we can predefine the common parameters:
+
+ #s1 {background.size: 0;};
+ #a1 {time.start: +0s; time.stop: +1s; background.size: 10;};
+
+ [s1]
+ {
+ [a1]{Ka}[a1]{ra}[a1]{o}[a1 {font.color: red;}]{ke!}
+
+ // That last piece has even turned into a red in the end :)
+
+ // And to make sure s1 has not been red already, we could derive it
+ // from "whitefont" (defined somewhere else as: #whitefont {font.color: white;};)
+
+ [a1]{Ka}[a1]{ra}[a1]{o}[a1 whitefont {font.color: red;};}]{ke!}
+ }
+
+ When specifying multiple style references watch out for the start/stop values
+ of time. Since they override eachother you should only set them once.
+
+ #a2 {font.color.a: 0;};
+ #a3 {placement.angle.x: 360;};
+
+ [s1] [a1 a2 a3]{Ka}[a1 a2 a3]{ra}[a1 a2 a3]{o}[a1 a2 a3]{ke!}
+
+ If you want to be even lazier:
+
+ #a4: a1 a2 a3;
+
+ [s1] [a4]{Ka}[a4]{ra}[a4]{o}[a4]{ke!}
+
+ To avoid the times overriding eachother use either nested text blocks ...
+
+ #a2 {time.start: +0.5s; time.stop: +1s; font.color.a: 0;};
+ #a3 {time.start: +1s; time.stop: +1s; placement.angle.x: 360;};
+
+ [s1] [a1]{[a2]{[a3]Ka}}[a1]{[a2]{[a3]ra}}[a1]{[a2]{[a3]o}}[a1]{[a2]{[a3]ke}}
+
+ ... or a list of references were each has a different time.id ...
+
+ #a1 {time {id: 1; start: +0s; stop: +1s;}; background.size: 10;};
+ #a2 {time {id: 2; start: +0.5s; stop: +1s;}; font.color.a: 0;};
+ #a3 {time {id: 3; start: +1s; stop: +1s;}; placement.angle.x: 360;};
+
+ [s1] [a1,a2,a3]{Ka}[a1,a2,a3]{ra}[a1,a2,a3]{o}[a1,a2,a3]{ke!}
+
+ ... or just let it auto-number the ids, each timer id becomes the actual position
+ in the comma separated list (a1 id => 1, a2 id => 2, a3 id => 3).
+
+ #a1 {time {start: +0s; stop: +1s;}; background.size: 10;};
+ #a2 {time {start: +0.5s; stop: +1s;}; font.color.a: 0;};
+ #a3 {time {start: +1s; stop: +1s;}; placement.angle.x: 360;};
+
+ [s1] [a1,a2,a3]{Ka}[a1,a2,a3]{ra}[a1,a2,a3]{o}[a1,a2,a3]{ke!}
+
+ It is also possible to leave some of the ref list slots empty.
+
+ [s1] [a1,a2,a3]{Ka}[,a2,a3]{ra}[a1,,a3]{o}[a1,a2,]{ke!}
+
+};
+
+Defaults and predefined names
+-----------------------------
+
+These must be predefined by the application, where each definition is low priority.
+
+color#white {a: 255; r: 255; g: 255; b: 255;};
+color#black {a: 255; r: 0; g: 0; b: 0;};
+color#gray {a: 255; r: 128; g: 128; b: 128;};
+color#red {a: 255; r: 255; g: 0; b: 0;};
+color#green {a: 255; r: 0; g: 255; b: 0;};
+color#blue {a: 255; r: 0; g: 0; b: 255;};
+color#cyan {a: 255; r: 0; g: 255; b: 255;};
+color#yellow {a: 255; r: 255; g: 255; b: 0;};
+color#magenta {a: 255; r: 255; g: 0; b: 255;};
+
+align#topleft {v: "top"; h: "left";};
+align#topcenter {v: "top"; h: "center";};
+align#topright {v: "top"; h: "right";};
+align#middleleft {v: "middle"; h: "left";};
+align#middlecenter {v: "middle"; h: "center";};
+align#middleright {v: "middle"; h: "right";};
+align#bottomleft {v: "bottom"; h: "left";};
+align#bottomcenter {v: "bottom"; h: "center";};
+align#bottomright {v: "bottom"; h: "right";};
+
+time#time {scale: 1;};
+time#startstop {start: "start"; stop: "stop";};
+
+#b {font.weight: "bold"};
+#i {font.italic: "true"};
+#u {font.underline: "true"};
+#s {font.strikethrough: "true"};
+
+#nobr {linebreak: "none"};
+
+subtitle#subtitle
+{
+ frame
+ {
+ reference: "video";
+ resolution: {cx: 640; cy: 480;};
+ };
+
+ direction
+ {
+ primary: "right";
+ secondary: "down";
+ };
+
+ wrap: "normal";
+
+ layer: 0;
+
+ style
+ {
+ linebreak: "word";
+
+ placement
+ {
+ clip: "frame";
+ margin: {t: 0; r: 0; b: 0; l: 0;};
+ align: bottomcenter;
+ pos: "auto";
+ offset: {x: 0; y: 0;};
+ angle: {x: 0; y: 0; z: 0;};
+ };
+
+ font
+ {
+ face: "Arial";
+ size: 20;
+ weight: "bold";
+ color: white;
+ underline: "false";
+ strikethrough: "false";
+ italic: "false";
+ spacing: 0;
+ scale: {cx: 1; cy: 1;};
+ };
+
+ background
+ {
+ color: black;
+ size: 2;
+ type: "outline";
+ };
+
+ shadow
+ {
+ color: black {a: 128;};
+ depth: 2;
+ angle: -45;
+ blur: 0;
+ };
+
+ fill
+ {
+ color: yellow;
+ width: 0;
+ };
+ };
+};
+
+Streaming
+---------
+
+Correct packetization is important when a subtitle file has to be embeded into a media
+file. Putting everything into the header would be trivial, but sending the whole track
+data ahead cannot be called streaming really, and it also makes editing impossible
+unless the application learns how to parse and resave our format.
+
+The recommended way of segmenting ssf into media samples:
+- Search top level definitions which do not satisfy the requirements of a displayable
+subtitle (one of start/stop/@ is absent) and save them into the file header of the media
+file as the initializer data for playback.
+- Multiplex the rest of the top level definitions as media samples, their timestamps
+shall be used for interleaving with other streams.
+
+Example:
+
+#mystyle {font.face: "Times New Roman";};
+subtitle#s1 {time.start: 2s;};
+subtitle#s2 : s1 {style: mystyle; time.stop: +1s; @ {2s -> 3s};};
+subtitle#s3 {style: mystyle; time.start: 5s; @ {5s -> 7s};};
+subtitle#s4 : s3 {time.stop: +2s;};
+
+File header:
+
+#mystyle {font.face: "Times New Roman";};
+subtitle#s1 {time.start: 2s;};
+subtitle#s3 {style: mystyle; time.start: 5s; @ {5s -> 7s};};
+
+Media samples:
+
+subtitle#s2 : s1 {style: mystyle; time.stop: +1s; @ {2s -> 3s};};
+subtitle#s4 : s3 {time.stop: +2s;};
diff --git a/src/subtitles/libssf/libssf.ncb b/src/subtitles/libssf/libssf.ncb
new file mode 100644
index 000000000..a25581764
--- /dev/null
+++ b/src/subtitles/libssf/libssf.ncb
Binary files differ
diff --git a/src/subtitles/libssf/libssf.sln b/src/subtitles/libssf/libssf.sln
new file mode 100644
index 000000000..4e9f10cda
--- /dev/null
+++ b/src/subtitles/libssf/libssf.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libssf", "libssf.vcproj", "{DD9D2D92-2241-408A-859E-B85D444B7E3C}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug.ActiveCfg = Debug|Win32
+ {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug.Build.0 = Debug|Win32
+ {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release.ActiveCfg = Release|Win32
+ {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release.Build.0 = Release|Win32
+ {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {DD9D2D92-2241-408A-859E-B85D444B7E3C}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/subtitles/libssf/libssf.suo b/src/subtitles/libssf/libssf.suo
new file mode 100644
index 000000000..a30066609
--- /dev/null
+++ b/src/subtitles/libssf/libssf.suo
Binary files differ
diff --git a/src/subtitles/libssf/libssf.vcproj b/src/subtitles/libssf/libssf.vcproj
new file mode 100644
index 000000000..71da88eb0
--- /dev/null
+++ b/src/subtitles/libssf/libssf.vcproj
@@ -0,0 +1,299 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="libssf"
+ ProjectGUID="{DD9D2D92-2241-408A-859E-B85D444B7E3C}"
+ RootNamespace="libssf"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ WholeProgramOptimization="FALSE">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\$(ProjectName)D.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ WholeProgramOptimization="FALSE">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ WholeProgramOptimization="FALSE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\$(ProjectName)R.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ WholeProgramOptimization="FALSE">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\$(ProjectName)DU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ WholeProgramOptimization="FALSE">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ WholeProgramOptimization="FALSE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\$(ProjectName)RU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\Exception.cpp">
+ </File>
+ <File
+ RelativePath=".\File.cpp">
+ </File>
+ <File
+ RelativePath=".\Node.cpp">
+ </File>
+ <File
+ RelativePath=".\NodeFactory.cpp">
+ </File>
+ <File
+ RelativePath=".\Split.cpp">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Stream.cpp">
+ </File>
+ <File
+ RelativePath=".\Subtitle.cpp">
+ </File>
+ <File
+ RelativePath=".\SubtitleFile.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\Exception.h">
+ </File>
+ <File
+ RelativePath=".\File.h">
+ </File>
+ <File
+ RelativePath=".\Node.h">
+ </File>
+ <File
+ RelativePath=".\NodeFactory.h">
+ </File>
+ <File
+ RelativePath=".\Split.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ <File
+ RelativePath=".\Stream.h">
+ </File>
+ <File
+ RelativePath=".\Subtitle.h">
+ </File>
+ <File
+ RelativePath=".\SubtitleFile.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ <File
+ RelativePath=".\demo\demo.ssa">
+ </File>
+ <File
+ RelativePath=".\demo\demo.ssf">
+ </File>
+ <File
+ RelativePath=".\docs\ssf-specs.txt">
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/subtitles/libssf/libssf.vcproj.old b/src/subtitles/libssf/libssf.vcproj.old
new file mode 100644
index 000000000..a1506eaf6
--- /dev/null
+++ b/src/subtitles/libssf/libssf.vcproj.old
@@ -0,0 +1,423 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7,00"
+ Name="libssf"
+ ProjectGUID="{DD9D2D92-2241-408A-859E-B85D444B7E3C}"
+ RootNamespace="libssf"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\$(ProjectName)D.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ WholeProgramOptimization="false"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\$(ProjectName)R.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\$(ProjectName)DU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1"
+ WholeProgramOptimization="0"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="true"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="true"
+ WholeProgramOptimization="false"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\$(ProjectName)RU.lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\Exception.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\File.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Node.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\NodeFactory.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Split.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Stream.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Subtitle.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\SubtitleFile.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\Exception.h"
+ >
+ </File>
+ <File
+ RelativePath=".\File.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Node.h"
+ >
+ </File>
+ <File
+ RelativePath=".\NodeFactory.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Split.h"
+ >
+ </File>
+ <File
+ RelativePath=".\stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Stream.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Subtitle.h"
+ >
+ </File>
+ <File
+ RelativePath=".\SubtitleFile.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <File
+ RelativePath=".\demo\demo.ssa"
+ >
+ </File>
+ <File
+ RelativePath=".\demo\demo.ssf"
+ >
+ </File>
+ <File
+ RelativePath=".\docs\ssf-specs.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/subtitles/libssf/stdafx.cpp b/src/subtitles/libssf/stdafx.cpp
new file mode 100644
index 000000000..87a70aa14
--- /dev/null
+++ b/src/subtitles/libssf/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// libssf.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/subtitles/libssf/stdafx.h b/src/subtitles/libssf/stdafx.h
new file mode 100644
index 000000000..8f2377137
--- /dev/null
+++ b/src/subtitles/libssf/stdafx.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Allow use of features specific to Windows XP or later.
+#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
+#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
+#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
+#endif
+
+#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
+#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
+#endif
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+#include <atlcoll.h> // MFC core and standard components
+
+
+
+// TODO: reference additional headers your program requires here
diff --git a/src/subtitles/stdafx.cpp b/src/subtitles/stdafx.cpp
new file mode 100644
index 000000000..3dd05c6af
--- /dev/null
+++ b/src/subtitles/stdafx.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.cpp : source file that includes just the standard includes
+// subtitles.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/subtitles/stdafx.h b/src/subtitles/stdafx.h
new file mode 100644
index 000000000..0d7d3f6fe
--- /dev/null
+++ b/src/subtitles/stdafx.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
+
+#include <streams.h>
+#import "msxml.dll"
+#include "..\DSUtil\DSUtil.h"
diff --git a/src/subtitles/subtitles.sln b/src/subtitles/subtitles.sln
new file mode 100644
index 000000000..4c6da0526
--- /dev/null
+++ b/src/subtitles/subtitles.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "subtitles", "subtitles.vcproj", "{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.ActiveCfg = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug.Build.0 = Debug|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.ActiveCfg = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release.Build.0 = Release|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/subtitles/subtitles.vcproj b/src/subtitles/subtitles.vcproj
new file mode 100644
index 000000000..e0774e2a9
--- /dev/null
+++ b/src/subtitles/subtitles.vcproj
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="subtitles"
+ ProjectGUID="{5E56335F-0FB1-4EEA-B240-D8DC5E0608E4}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="FALSE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/subtitlesD.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="2"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ TreatWChar_tAsBuiltInType="FALSE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/subtitlesR.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="FALSE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/subtitlesDU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ InlineFunctionExpansion="2"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="2"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ TreatWChar_tAsBuiltInType="FALSE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/subtitlesRU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="CCDecoder.cpp">
+ </File>
+ <File
+ RelativePath="GFN.cpp">
+ </File>
+ <File
+ RelativePath="Rasterizer.cpp">
+ </File>
+ <File
+ RelativePath="RTS.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="0"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\SSF.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="STS.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ RuntimeTypeInfo="TRUE"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\SubtitleInputPin.cpp">
+ </File>
+ <File
+ RelativePath="TextFile.cpp">
+ </File>
+ <File
+ RelativePath="USFSubtitles.cpp">
+ </File>
+ <File
+ RelativePath="VobSubFile.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AssemblerOutput="0"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AssemblerOutput="0"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AssemblerOutput="0"
+ BrowseInformation="0"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ AssemblerOutput="0"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="VobSubFileRipper.cpp">
+ </File>
+ <File
+ RelativePath="VobSubImage.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="CCDecoder.h">
+ </File>
+ <File
+ RelativePath="GFN.h">
+ </File>
+ <File
+ RelativePath="Rasterizer.h">
+ </File>
+ <File
+ RelativePath="RTS.h">
+ </File>
+ <File
+ RelativePath=".\SSF.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="STS.h">
+ </File>
+ <File
+ RelativePath=".\SubtitleInputPin.h">
+ </File>
+ <File
+ RelativePath="TextFile.h">
+ </File>
+ <File
+ RelativePath="USFSubtitles.h">
+ </File>
+ <File
+ RelativePath="VobSubFile.h">
+ </File>
+ <File
+ RelativePath="VobSubFileRipper.h">
+ </File>
+ <File
+ RelativePath="VobSubImage.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="1"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/subtitles/subtitles.vcproj.vspscc b/src/subtitles/subtitles.vcproj.vspscc
new file mode 100644
index 000000000..84073450c
--- /dev/null
+++ b/src/subtitles/subtitles.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:subtitles"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/src/ui/CmdUI/CmdUI.cpp b/src/ui/CmdUI/CmdUI.cpp
new file mode 100644
index 000000000..c1bf6d16d
--- /dev/null
+++ b/src/ui/CmdUI/CmdUI.cpp
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+// CmdUIDialog.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include <afxpriv.h>
+#include "CmdUI.h"
+
+// CCmdUIDialog dialog
+
+IMPLEMENT_DYNAMIC(CCmdUIDialog, CDialog)
+
+CCmdUIDialog::CCmdUIDialog()
+{
+}
+
+CCmdUIDialog::CCmdUIDialog(UINT nIDTemplate, CWnd* pParent /*=NULL*/)
+ : CDialog(nIDTemplate, pParent)
+{
+}
+
+CCmdUIDialog::CCmdUIDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
+ : CDialog(lpszTemplateName, pParentWnd)
+{
+}
+
+CCmdUIDialog::~CCmdUIDialog()
+{
+}
+
+LRESULT CCmdUIDialog::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ LRESULT ret = __super::DefWindowProc(message, wParam, lParam);
+
+ if(message == WM_INITDIALOG)
+ {
+ SendMessage(WM_KICKIDLE);
+ }
+
+ return(ret);
+}
+
+BEGIN_MESSAGE_MAP(CCmdUIDialog, CDialog)
+ ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
+ ON_WM_INITMENUPOPUP()
+END_MESSAGE_MAP()
+
+
+// CCmdUIDialog message handlers
+
+void CCmdUIDialog::OnKickIdle()
+{
+ UpdateDialogControls(this, false);
+
+ // TODO: maybe we should send this call to modeless child cdialogs too
+}
+
+// Q242577
+
+void CCmdUIDialog::OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu)
+{
+ ASSERT(pPopupMenu != NULL);
+ // Check the enabled state of various menu items.
+
+ CCmdUI state;
+ state.m_pMenu = pPopupMenu;
+ ASSERT(state.m_pOther == NULL);
+ ASSERT(state.m_pParentMenu == NULL);
+
+ // Determine if menu is popup in top-level menu and set m_pOther to
+ // it if so (m_pParentMenu == NULL indicates that it is secondary popup).
+ HMENU hParentMenu;
+ if (AfxGetThreadState()->m_hTrackingMenu == pPopupMenu->m_hMenu)
+ state.m_pParentMenu = pPopupMenu; // Parent == child for tracking popup.
+ else if ((hParentMenu = ::GetMenu(m_hWnd)) != NULL)
+ {
+ CWnd* pParent = this;
+ // Child windows don't have menus--need to go to the top!
+ if (pParent != NULL &&
+ (hParentMenu = ::GetMenu(pParent->m_hWnd)) != NULL)
+ {
+ int nIndexMax = ::GetMenuItemCount(hParentMenu);
+ for (int nIndex = 0; nIndex < nIndexMax; nIndex++)
+ {
+ if (::GetSubMenu(hParentMenu, nIndex) == pPopupMenu->m_hMenu)
+ {
+ // When popup is found, m_pParentMenu is containing menu.
+ state.m_pParentMenu = CMenu::FromHandle(hParentMenu);
+ break;
+ }
+ }
+ }
+ }
+
+ state.m_nIndexMax = pPopupMenu->GetMenuItemCount();
+ for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
+ state.m_nIndex++)
+ {
+ state.m_nID = pPopupMenu->GetMenuItemID(state.m_nIndex);
+ if (state.m_nID == 0)
+ continue; // Menu separator or invalid cmd - ignore it.
+
+ ASSERT(state.m_pOther == NULL);
+ ASSERT(state.m_pMenu != NULL);
+ if (state.m_nID == (UINT)-1)
+ {
+ // Possibly a popup menu, route to first item of that popup.
+ state.m_pSubMenu = pPopupMenu->GetSubMenu(state.m_nIndex);
+ if (state.m_pSubMenu == NULL ||
+ (state.m_nID = state.m_pSubMenu->GetMenuItemID(0)) == 0 ||
+ state.m_nID == (UINT)-1)
+ {
+ continue; // First item of popup can't be routed to.
+ }
+ state.DoUpdate(this, TRUE); // Popups are never auto disabled.
+ }
+ else
+ {
+ // Normal menu item.
+ // Auto enable/disable if frame window has m_bAutoMenuEnable
+ // set and command is _not_ a system command.
+ state.m_pSubMenu = NULL;
+ state.DoUpdate(this, FALSE);
+ }
+
+ // Adjust for menu deletions and additions.
+ UINT nCount = pPopupMenu->GetMenuItemCount();
+ if (nCount < state.m_nIndexMax)
+ {
+ state.m_nIndex -= (state.m_nIndexMax - nCount);
+ while (state.m_nIndex < nCount &&
+ pPopupMenu->GetMenuItemID(state.m_nIndex) == state.m_nID)
+ {
+ state.m_nIndex++;
+ }
+ }
+ state.m_nIndexMax = nCount;
+ }
+}
+
+// CCmdUIPropertyPage
+
+IMPLEMENT_DYNAMIC(CCmdUIPropertyPage, CPropertyPage)
+CCmdUIPropertyPage::CCmdUIPropertyPage(UINT nIDTemplate, UINT nIDCaption)
+ : CPropertyPage(nIDTemplate, nIDCaption)
+{
+}
+
+CCmdUIPropertyPage::~CCmdUIPropertyPage()
+{
+}
+
+LRESULT CCmdUIPropertyPage::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
+{
+ if(message == WM_COMMAND)
+ {
+ switch(HIWORD(wParam))
+ {
+ case BN_CLICKED: case CBN_SELCHANGE: case EN_CHANGE:
+ SetModified();
+ default:;
+ }
+ }
+
+ LRESULT ret = __super::DefWindowProc(message, wParam, lParam);
+
+ if(message == WM_INITDIALOG)
+ {
+ SendMessage(WM_KICKIDLE);
+ }
+
+ return(ret);
+}
+
+BEGIN_MESSAGE_MAP(CCmdUIPropertyPage, CPropertyPage)
+ ON_MESSAGE_VOID(WM_KICKIDLE, OnKickIdle)
+END_MESSAGE_MAP()
+
+
+// CCmdUIPropertyPage message handlers
+
+void CCmdUIPropertyPage::OnKickIdle()
+{
+ UpdateDialogControls(this, false);
+
+ // TODO: maybe we should send this call to modeless child cPropertyPages too
+}
+
diff --git a/src/ui/CmdUI/CmdUI.h b/src/ui/CmdUI/CmdUI.h
new file mode 100644
index 000000000..1f57f574f
--- /dev/null
+++ b/src/ui/CmdUI/CmdUI.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2003-2006 Gabest
+ * http://www.gabest.org
+ *
+ * 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; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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 GNU Make; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#pragma once
+
+// CCmdUIDialog dialog
+
+#include <afxdlgs.h>
+
+class CCmdUIDialog : public CDialog
+{
+ DECLARE_DYNAMIC(CCmdUIDialog)
+
+public:
+ CCmdUIDialog();
+ CCmdUIDialog(UINT nIDTemplate, CWnd* pParent = NULL);
+ CCmdUIDialog(LPCTSTR lpszTemplateName, CWnd* pParent = NULL);
+ virtual ~CCmdUIDialog();
+
+protected:
+ virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnKickIdle();
+ afx_msg void OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu);
+};
+
+
+// CCmdUIPropertyPage
+
+class CCmdUIPropertyPage : public CPropertyPage
+{
+ DECLARE_DYNAMIC(CCmdUIPropertyPage)
+
+public:
+ CCmdUIPropertyPage(UINT nIDTemplate, UINT nIDCaption = 0); // standard constructor
+ virtual ~CCmdUIPropertyPage();
+
+protected:
+ virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+
+ DECLARE_MESSAGE_MAP()
+
+public:
+ afx_msg void OnKickIdle();
+};
+
diff --git a/src/ui/CmdUI/CmdUI.sln b/src/ui/CmdUI/CmdUI.sln
new file mode 100644
index 000000000..7e470283a
--- /dev/null
+++ b/src/ui/CmdUI/CmdUI.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdUI", "CmdUI.vcproj", "{03208025-D5C2-426A-B0FA-251D4338F30C}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug.ActiveCfg = Debug|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug.Build.0 = Debug|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release.ActiveCfg = Release|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release.Build.0 = Release|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/ui/CmdUI/CmdUI.vcproj b/src/ui/CmdUI/CmdUI.vcproj
new file mode 100644
index 000000000..e5853c680
--- /dev/null
+++ b/src/ui/CmdUI/CmdUI.vcproj
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="CmdUI"
+ ProjectGUID="{03208025-D5C2-426A-B0FA-251D4338F30C}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\CmdUID.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\CmdUIR.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\CmdUIDU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\CmdUIRU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\CmdUI.cpp">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\CmdUI.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/ui/CmdUI/CmdUI.vcproj.vspscc b/src/ui/CmdUI/CmdUI.vcproj.vspscc
new file mode 100644
index 000000000..8ea292629
--- /dev/null
+++ b/src/ui/CmdUI/CmdUI.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:ui\\CmdUI"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/src/ui/CmdUI/stdafx.cpp b/src/ui/CmdUI/stdafx.cpp
new file mode 100644
index 000000000..ce9b31f47
--- /dev/null
+++ b/src/ui/CmdUI/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// CmdUI.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/ui/CmdUI/stdafx.h b/src/ui/CmdUI/stdafx.h
new file mode 100644
index 000000000..e8fa7c384
--- /dev/null
+++ b/src/ui/CmdUI/stdafx.h
@@ -0,0 +1,19 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
diff --git a/src/ui/ResizableLib/Artistic-License.txt b/src/ui/ResizableLib/Artistic-License.txt
new file mode 100644
index 000000000..803d2293e
--- /dev/null
+++ b/src/ui/ResizableLib/Artistic-License.txt
@@ -0,0 +1,99 @@
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package
+may be copied, such that the Copyright Holder maintains some semblance of
+artistic control over the development of the package, while giving the users of
+the package the right to use and distribute the Package in a more-or-less
+customary fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+ * "Package" refers to the collection of files distributed by the Copyright
+ Holder, and derivatives of that collection of files created through textual
+ modification.
+ * "Standard Version" refers to such a Package if it has not been modified,
+ or has been modified in accordance with the wishes of the Copyright Holder.
+ * "Copyright Holder" is whoever is named in the copyright or copyrights for
+ the package.
+ * "You" is you, if you're thinking about copying or distributing this
+ Package.
+ * "Reasonable copying fee" is whatever you can justify on the basis of media
+ cost, duplication charges, time of people involved, and so on. (You will not
+ be required to justify it to the Copyright Holder, but only to the computing
+ community at large as a market that must bear the fee.)
+ * "Freely Available" means that no fee is charged for the item itself,
+ though there may be fees involved in handling the item. It also means that
+ recipients of the item may redistribute it under the same conditions they
+ received it.
+
+1. You may make and give away verbatim copies of the source form of the
+ Standard Version of this Package without restriction, provided that you
+ duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived
+ from the Public Domain or from the Copyright Holder. A Package modified in such
+ a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided
+ that you insert a prominent notice in each changed file stating how and when you
+ changed that file, and provided that you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise make them
+ Freely Available, such as by posting said modifications to Usenet or an
+ equivalent medium, or placing the modifications on a major archive site such
+ as ftp.uu.net, or by allowing the Copyright Holder to include your
+ modifications in the Standard Version of the Package.
+
+ b) use the modified Package only within your corporation or
+ organization.
+
+ c) rename any non-standard executables so the names do not conflict with
+ standard executables, which must also be provided, and provide a separate
+ manual page for each non-standard executable that clearly documents how it
+ differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or
+ executable form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files,
+ together with instructions (in the manual page or equivalent) on where to get
+ the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of the
+ Package with your modifications.
+
+ c) accompany any non-standard executables with their corresponding Standard
+ Version executables, giving the non-standard executables non-standard names,
+ and clearly documenting the differences in manual pages (or equivalent),
+ together with instructions on where to get the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+ Package. You may charge any fee you choose for support of this Package. You may
+ not charge a fee for this Package itself. However, you may distribute this
+ Package in aggregate with other (possibly commercial) programs as part of a
+ larger (possibly commercial) software distribution provided that you do not
+ advertise this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output
+ from the programs of this Package do not automatically fall under the copyright
+ of this Package, but belong to whomever generated them, and may be sold
+ commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall
+ not be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
diff --git a/src/ui/ResizableLib/ResizableDialog.cpp b/src/ui/ResizableLib/ResizableDialog.cpp
new file mode 100644
index 000000000..d61d4472b
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableDialog.cpp
@@ -0,0 +1,161 @@
+// ResizableDialog.cpp : implementation file
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ResizableDialog.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CResizableDialog
+
+inline void CResizableDialog::PrivateConstruct()
+{
+ m_bEnableSaveRestore = FALSE;
+ m_dwGripTempState = 1;
+}
+
+CResizableDialog::CResizableDialog()
+{
+ PrivateConstruct();
+}
+
+CResizableDialog::CResizableDialog(UINT nIDTemplate, CWnd* pParentWnd)
+ : CCmdUIDialog(nIDTemplate, pParentWnd)
+{
+ PrivateConstruct();
+}
+
+CResizableDialog::CResizableDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd)
+ : CCmdUIDialog(lpszTemplateName, pParentWnd)
+{
+ PrivateConstruct();
+}
+
+CResizableDialog::~CResizableDialog()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CResizableDialog, CCmdUIDialog)
+ //{{AFX_MSG_MAP(CResizableDialog)
+ ON_WM_GETMINMAXINFO()
+ ON_WM_SIZE()
+ ON_WM_DESTROY()
+ ON_WM_CREATE()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CResizableDialog message handlers
+
+int CResizableDialog::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if (__super::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ // child dialogs don't want resizable border or size grip,
+ // nor they can handle the min/max size constraints
+ BOOL bChild = GetStyle() & WS_CHILD;
+
+ if (!bChild)
+ {
+ // keep client area
+ CRect rect;
+ GetClientRect(&rect);
+ // set resizable style
+ ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME);
+ // adjust size to reflect new style
+ ::AdjustWindowRectEx(&rect, GetStyle(),
+ ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
+ SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED|
+ SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);
+
+ // set the initial size as the min track size
+ SetMinTrackSize(rect.Size());
+ }
+
+ // create and init the size-grip
+ if (!CreateSizeGrip(!bChild))
+ return -1;
+
+ return 0;
+}
+
+void CResizableDialog::OnDestroy()
+{
+ if (m_bEnableSaveRestore)
+ SaveWindowRect(m_sSection, m_bRectOnly);
+
+ // remove child windows
+ RemoveAllAnchors();
+
+ __super::OnDestroy();
+}
+
+void CResizableDialog::OnSize(UINT nType, int cx, int cy)
+{
+ CWnd::OnSize(nType, cx, cy);
+
+ if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
+ return; // arrangement not needed
+
+ if (nType == SIZE_MAXIMIZED)
+ HideSizeGrip(&m_dwGripTempState);
+ else
+ ShowSizeGrip(&m_dwGripTempState);
+
+ // update grip and layout
+ UpdateSizeGrip();
+ ArrangeLayout();
+}
+
+void CResizableDialog::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
+{
+ MinMaxInfo(lpMMI);
+}
+
+// NOTE: this must be called after setting the layout
+// to have the dialog and its controls displayed properly
+void CResizableDialog::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly)
+{
+ m_sSection = pszSection;
+
+ m_bEnableSaveRestore = TRUE;
+ m_bRectOnly = bRectOnly;
+
+ // restore immediately
+ LoadWindowRect(pszSection, bRectOnly);
+}
+
+
+BOOL CResizableDialog::OnEraseBkgnd(CDC* pDC)
+{
+ // Windows XP doesn't like clipping regions ...try this!
+ EraseBackground(pDC);
+ return TRUE;
+
+/* ClipChildren(pDC); // old-method (for safety)
+
+ return CDialog::OnEraseBkgnd(pDC);
+*/
+}
diff --git a/src/ui/ResizableLib/ResizableDialog.h b/src/ui/ResizableLib/ResizableDialog.h
new file mode 100644
index 000000000..49a016d65
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableDialog.h
@@ -0,0 +1,101 @@
+#if !defined(AFX_RESIZABLEDIALOG_H__INCLUDED_)
+#define AFX_RESIZABLEDIALOG_H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+// ResizableDialog.h : header file
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "ResizableLayout.h"
+#include "ResizableGrip.h"
+#include "ResizableMinMax.h"
+#include "ResizableState.h"
+#include "..\CmdUI\CmdUI.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CResizableDialog window
+
+class CResizableDialog : public CCmdUIDialog, public CResizableLayout,
+ public CResizableGrip, public CResizableMinMax,
+ public CResizableState
+{
+
+// Construction
+public:
+ CResizableDialog();
+ CResizableDialog(UINT nIDTemplate, CWnd* pParentWnd = NULL);
+ CResizableDialog(LPCTSTR lpszTemplateName, CWnd* pParentWnd = NULL);
+
+// Attributes
+private:
+ // support for temporarily hiding the grip
+ DWORD m_dwGripTempState;
+
+ // flags
+ BOOL m_bEnableSaveRestore;
+ BOOL m_bRectOnly;
+
+ // internal status
+ CString m_sSection; // section name (identifies a parent window)
+
+// Operations
+public:
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CResizableDialog)
+ protected:
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ virtual ~CResizableDialog();
+
+// used internally
+private:
+ void PrivateConstruct();
+
+// callable from derived classes
+protected:
+ // section to use in app's profile
+ void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE);
+
+ virtual CWnd* GetResizableWnd()
+ {
+ // make the layout know its parent window
+ return this;
+ };
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CResizableDialog)
+ afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnDestroy();
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_RESIZABLEDIALOG_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/ResizableGrip.cpp b/src/ui/ResizableLib/ResizableGrip.cpp
new file mode 100644
index 000000000..f1464dbb7
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableGrip.cpp
@@ -0,0 +1,310 @@
+// ResizableGrip.cpp: implementation of the CResizableGrip class.
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ResizableGrip.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CResizableGrip::CResizableGrip()
+{
+ m_nShowCount = 0;
+}
+
+CResizableGrip::~CResizableGrip()
+{
+
+}
+
+void CResizableGrip::UpdateSizeGrip()
+{
+ ASSERT(::IsWindow(m_wndGrip.m_hWnd));
+
+ // size-grip goes bottom right in the client area
+ // (any right-to-left adjustment should go here)
+
+ RECT rect;
+ GetResizableWnd()->GetClientRect(&rect);
+
+ rect.left = rect.right - m_wndGrip.m_size.cx;
+ rect.top = rect.bottom - m_wndGrip.m_size.cy;
+
+ // must stay below other children
+ m_wndGrip.SetWindowPos(&CWnd::wndBottom, rect.left, rect.top, 0, 0,
+ SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOREPOSITION
+ | (IsSizeGripVisible() ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
+}
+
+// pbStatus points to a variable, maintained by the caller, that
+// holds its visibility status. Initialize the variable with 1
+// to allow to temporarily hide the grip, 0 to allow to
+// temporarily show the grip (with respect to the dwMask bit).
+
+// NB: visibility is effective only after an update
+
+void CResizableGrip::ShowSizeGrip(DWORD* pStatus, DWORD dwMask /*= 1*/)
+{
+ ASSERT(pStatus != NULL);
+
+ if (!(*pStatus & dwMask))
+ {
+ m_nShowCount++;
+ (*pStatus) |= dwMask;
+ }
+}
+
+void CResizableGrip::HideSizeGrip(DWORD* pStatus, DWORD dwMask /*= 1*/)
+{
+ ASSERT(pStatus != NULL);
+
+ if (*pStatus & dwMask)
+ {
+ m_nShowCount--;
+ (*pStatus) &= ~dwMask;
+ }
+}
+
+BOOL CResizableGrip::IsSizeGripVisible()
+{
+ // NB: visibility is effective only after an update
+ return (m_nShowCount > 0);
+}
+
+void CResizableGrip::SetSizeGripVisibility(BOOL bVisible)
+{
+ if (bVisible)
+ m_nShowCount = 1;
+ else
+ m_nShowCount = 0;
+}
+
+BOOL CResizableGrip::SetSizeGripBkMode(int nBkMode)
+{
+ if (::IsWindow(m_wndGrip.m_hWnd))
+ {
+ if (nBkMode == OPAQUE)
+ m_wndGrip.SetTransparency(FALSE);
+ else if (nBkMode == TRANSPARENT)
+ m_wndGrip.SetTransparency(TRUE);
+ else
+ return FALSE;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void CResizableGrip::SetSizeGripShape(BOOL bTriangular)
+{
+ m_wndGrip.SetTriangularShape(bTriangular);
+}
+
+BOOL CResizableGrip::CreateSizeGrip(BOOL bVisible /*= TRUE*/,
+ BOOL bTriangular /*= TRUE*/, BOOL bTransparent /*= FALSE*/)
+{
+ // create grip
+ CRect rect(0 , 0, m_wndGrip.m_size.cx, m_wndGrip.m_size.cy);
+ BOOL bRet = m_wndGrip.Create(WS_CHILD | WS_CLIPSIBLINGS
+ | SBS_SIZEGRIP, rect, GetResizableWnd(), 0);
+
+ if (bRet)
+ {
+ // set options
+ m_wndGrip.SetTriangularShape(bTriangular);
+ m_wndGrip.SetTransparency(bTransparent);
+ SetSizeGripVisibility(bVisible);
+
+ // update position
+ UpdateSizeGrip();
+ }
+
+ return bRet;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CSizeGrip implementation
+
+BOOL CResizableGrip::CSizeGrip::IsRTL()
+{
+ return GetExStyle() & 0x00400000L/*WS_EX_LAYOUTRTL*/;
+}
+
+BOOL CResizableGrip::CSizeGrip::PreCreateWindow(CREATESTRUCT& cs)
+{
+ // set window size
+ m_size.cx = GetSystemMetrics(SM_CXVSCROLL);
+ m_size.cy = GetSystemMetrics(SM_CYHSCROLL);
+
+ cs.cx = m_size.cx;
+ cs.cy = m_size.cy;
+
+ return CScrollBar::PreCreateWindow(cs);
+}
+
+LRESULT CResizableGrip::CSizeGrip::WindowProc(UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ switch (message)
+ {
+ case WM_GETDLGCODE:
+ // fix to prevent the control to gain focus, using arrow keys
+ // (standard grip returns DLGC_WANTARROWS, like any standard scrollbar)
+ return DLGC_STATIC;
+
+ case WM_NCHITTEST:
+ // choose proper cursor shape
+ if (IsRTL())
+ return HTBOTTOMLEFT;
+ else
+ return HTBOTTOMRIGHT;
+ break;
+
+ case WM_SETTINGCHANGE:
+ {
+ // update grip's size
+ CSize sizeOld = m_size;
+ m_size.cx = GetSystemMetrics(SM_CXVSCROLL);
+ m_size.cy = GetSystemMetrics(SM_CYHSCROLL);
+
+ // resize transparency bitmaps
+ if (m_bTransparent)
+ {
+ CClientDC dc(this);
+
+ // destroy bitmaps
+ m_bmGrip.DeleteObject();
+ m_bmMask.DeleteObject();
+
+ // re-create bitmaps
+ m_bmGrip.CreateCompatibleBitmap(&dc, m_size.cx, m_size.cy);
+ m_bmMask.CreateBitmap(m_size.cx, m_size.cy, 1, 1, NULL);
+ }
+
+ // re-calc shape
+ if (m_bTriangular)
+ SetTriangularShape(m_bTriangular);
+
+ // reposition the grip
+ CRect rect;
+ GetWindowRect(rect);
+ rect.InflateRect(m_size.cx - sizeOld.cx, m_size.cy - sizeOld.cy, 0, 0);
+ ::MapWindowPoints(NULL, GetParent()->GetSafeHwnd(), (LPPOINT)&rect, 2);
+ MoveWindow(rect, TRUE);
+ }
+ break;
+
+ case WM_DESTROY:
+ // perform clean up
+ if (m_bTransparent)
+ SetTransparency(FALSE);
+ break;
+
+ case WM_PAINT:
+ if (m_bTransparent)
+ {
+ CPaintDC dc(this);
+
+ // select bitmaps
+ CBitmap *pOldGrip, *pOldMask;
+
+ pOldGrip = m_dcGrip.SelectObject(&m_bmGrip);
+ pOldMask = m_dcMask.SelectObject(&m_bmMask);
+
+ // obtain original grip bitmap, make the mask and prepare masked bitmap
+ CScrollBar::WindowProc(WM_PAINT, (WPARAM)m_dcGrip.GetSafeHdc(), lParam);
+ m_dcGrip.SetBkColor(m_dcGrip.GetPixel(0, 0));
+ m_dcMask.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCCOPY);
+ m_dcGrip.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, 0x00220326);
+
+ // draw transparently
+ dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcMask, 0, 0, SRCAND);
+ dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_dcGrip, 0, 0, SRCPAINT);
+
+ // unselect bitmaps
+ m_dcGrip.SelectObject(pOldGrip);
+ m_dcMask.SelectObject(pOldMask);
+
+ return 0;
+ }
+ break;
+ }
+
+ return CScrollBar::WindowProc(message, wParam, lParam);
+}
+
+void CResizableGrip::CSizeGrip::SetTransparency(BOOL bActivate)
+{
+ // creates or deletes DCs and Bitmaps used for
+ // implementing a transparent size grip
+
+ if (bActivate && !m_bTransparent)
+ {
+ m_bTransparent = TRUE;
+
+ CClientDC dc(this);
+
+ // create memory DCs and bitmaps
+ m_dcGrip.CreateCompatibleDC(&dc);
+ m_bmGrip.CreateCompatibleBitmap(&dc, m_size.cx, m_size.cy);
+
+ m_dcMask.CreateCompatibleDC(&dc);
+ m_bmMask.CreateBitmap(m_size.cx, m_size.cy, 1, 1, NULL);
+ }
+ else if (!bActivate && m_bTransparent)
+ {
+ m_bTransparent = FALSE;
+
+ // destroy memory DCs and bitmaps
+ m_dcGrip.DeleteDC();
+ m_bmGrip.DeleteObject();
+
+ m_dcMask.DeleteDC();
+ m_bmMask.DeleteObject();
+ }
+}
+
+void CResizableGrip::CSizeGrip::SetTriangularShape(BOOL bEnable)
+{
+ m_bTriangular = bEnable;
+
+ if (bEnable)
+ {
+ // set a triangular window region
+ CRect rect;
+ GetWindowRect(rect);
+ rect.OffsetRect(-rect.TopLeft());
+ POINT arrPoints[] =
+ {
+ { rect.left, rect.bottom },
+ { rect.right, rect.bottom },
+ { rect.right, rect.top }
+ };
+ CRgn rgnGrip;
+ rgnGrip.CreatePolygonRgn(arrPoints, 3, WINDING);
+ SetWindowRgn((HRGN)rgnGrip.Detach(), IsWindowVisible());
+ }
+ else
+ {
+ SetWindowRgn((HRGN)NULL, IsWindowVisible());
+ }
+}
diff --git a/src/ui/ResizableLib/ResizableGrip.h b/src/ui/ResizableLib/ResizableGrip.h
new file mode 100644
index 000000000..0a85514b9
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableGrip.h
@@ -0,0 +1,81 @@
+// ResizableGrip.h: interface for the CResizableGrip class.
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_RESIZABLEGRIP_H__INCLUDED_)
+#define AFX_RESIZABLEGRIP_H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+class CResizableGrip
+{
+private:
+ class CSizeGrip : public CScrollBar
+ {
+ public:
+ CSizeGrip()
+ {
+ m_bTransparent = FALSE;
+ m_bTriangular = FALSE;
+ m_size.cx = 0;
+ m_size.cy = 0;
+ }
+
+ void SetTriangularShape(BOOL bEnable);
+ void SetTransparency(BOOL bActivate);
+
+ BOOL IsRTL(); // right-to-left layout support
+
+ virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
+
+ SIZE m_size; // holds grip size
+
+ protected:
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+
+ BOOL m_bTriangular; // triangular shape active
+ BOOL m_bTransparent; // transparency active
+
+ // memory DCs and bitmaps for transparent grip
+ CDC m_dcGrip, m_dcMask;
+ CBitmap m_bmGrip, m_bmMask;
+ };
+
+ CSizeGrip m_wndGrip; // grip control
+ int m_nShowCount; // support for hiding the grip
+
+protected:
+ // create a size grip, with options
+ BOOL CreateSizeGrip(BOOL bVisible = TRUE,
+ BOOL bTriangular = TRUE, BOOL bTransparent = FALSE);
+
+ BOOL IsSizeGripVisible(); // TRUE if grip is set to be visible
+ void SetSizeGripVisibility(BOOL bVisible); // set default visibility
+ void UpdateSizeGrip(); // update the grip's visibility and position
+ void ShowSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp show the size grip
+ void HideSizeGrip(DWORD* pStatus, DWORD dwMask = 1); // temp hide the size grip
+ BOOL SetSizeGripBkMode(int nBkMode); // like CDC::SetBkMode
+ void SetSizeGripShape(BOOL bTriangular);
+
+ virtual CWnd* GetResizableWnd() = 0;
+
+public:
+ CResizableGrip();
+ virtual ~CResizableGrip();
+};
+
+#endif // !defined(AFX_RESIZABLEGRIP_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/ResizableLayout.cpp b/src/ui/ResizableLib/ResizableLayout.cpp
new file mode 100644
index 000000000..e1aef85f4
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableLayout.cpp
@@ -0,0 +1,518 @@
+// ResizableLayout.cpp: implementation of the CResizableLayout class.
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "commctrl.h"
+#include "ResizableLayout.h"
+#include "ResizableMsgSupport.inl"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+// In August 2002 Platform SDK, some guy at MS thought it was time to
+// add the missing symbol BS_TYPEMASK, but forgot its original meaning
+// and so now he's telling us not to use that symbol because its
+// value is likely to change in the future SDK releases, including all
+// the BS_* style bits in the mask, not just the button's type as the
+// symbol's name suggests. So now we're forced to use another symbol!
+#define _BS_TYPEMASK 0x0000000FL
+
+void CResizableLayout::AddAnchor(HWND hWnd, CSize sizeTypeTL, CSize sizeTypeBR)
+{
+ CWnd* pParent = GetResizableWnd();
+
+ // child window must be valid
+ ASSERT(::IsWindow(hWnd));
+ // must be child of parent window
+// ASSERT(::IsChild(pParent->GetSafeHwnd(), hWnd));
+ // top-left anchor must be valid
+ ASSERT(sizeTypeTL != NOANCHOR);
+
+ // get control's window class
+ CString sClassName;
+ GetClassName(hWnd, sClassName.GetBufferSetLength(MAX_PATH), MAX_PATH);
+ sClassName.ReleaseBuffer();
+
+ // get parent window's rect
+ CRect rectParent;
+ GetTotalClientRect(&rectParent);
+ // and child control's rect
+ CRect rectChild;
+ ::GetWindowRect(hWnd, &rectChild);
+ ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2);
+
+ // adjust position, if client area has been scrolled
+ rectChild.OffsetRect(-rectParent.TopLeft());
+
+ // go calculate margins
+ CSize sizeMarginTL, sizeMarginBR;
+
+ if (sizeTypeBR == NOANCHOR)
+ sizeTypeBR = sizeTypeTL;
+
+ // calculate margin for the top-left corner
+
+ sizeMarginTL.cx = rectChild.left - rectParent.Width() * sizeTypeTL.cx / 100;
+ sizeMarginTL.cy = rectChild.top - rectParent.Height() * sizeTypeTL.cy / 100;
+
+ // calculate margin for the bottom-right corner
+
+ sizeMarginBR.cx = rectChild.right - rectParent.Width() * sizeTypeBR.cx / 100;
+ sizeMarginBR.cy = rectChild.bottom - rectParent.Height() * sizeTypeBR.cy / 100;
+
+ // prepare the structure
+ LayoutInfo layout(hWnd, sizeTypeTL, sizeMarginTL,
+ sizeTypeBR, sizeMarginBR, sClassName);
+
+ // initialize resize properties (overridable)
+ InitResizeProperties(layout);
+
+ // must not be already there!
+ // (this is probably due to a duplicate call to AddAnchor)
+ POSITION pos;
+ ASSERT(!m_mapLayout.Lookup(hWnd, pos));
+
+ // add to the list and the map
+ pos = m_listLayout.AddTail(layout);
+ m_mapLayout.SetAt(hWnd, pos);
+}
+
+void CResizableLayout::AddAnchorCallback(UINT nCallbackID)
+{
+ // one callback control cannot rely upon another callback control's
+ // size and/or position (they're updated all together at the end)
+ // it can however use a non-callback control, which is updated before
+
+ // add to the list
+ LayoutInfo layout;
+ layout.nCallbackID = nCallbackID;
+ m_listLayoutCB.AddTail(layout);
+}
+
+BOOL CResizableLayout::ArrangeLayoutCallback(CResizableLayout::LayoutInfo& /*layout*/)
+{
+ ASSERT(FALSE);
+ // must be overridden, if callback is used
+
+ return FALSE; // no output data
+}
+
+void CResizableLayout::ArrangeLayout()
+{
+ // common vars
+ UINT uFlags;
+ LayoutInfo layout;
+ CRect rectParent, rectChild;
+ GetTotalClientRect(&rectParent); // get parent window's rect
+ int count = m_listLayout.GetCount();
+ int countCB = m_listLayoutCB.GetCount();
+
+ // reposition child windows
+ HDWP hdwp = ::BeginDeferWindowPos(count + countCB);
+
+ POSITION pos = m_listLayout.GetHeadPosition();
+ while (pos != NULL)
+ {
+ // get layout info
+ layout = m_listLayout.GetNext(pos);
+
+ // calculate new child's position, size and flags for SetWindowPos
+ CalcNewChildPosition(layout, rectParent, rectChild, uFlags);
+
+ // only if size or position changed
+ if ((uFlags & (SWP_NOMOVE|SWP_NOSIZE)) != (SWP_NOMOVE|SWP_NOSIZE))
+ {
+ hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left,
+ rectChild.top, rectChild.Width(), rectChild.Height(), uFlags);
+ }
+ }
+
+ // for callback items you may use GetAnchorPosition to know the
+ // new position and size of a non-callback item after resizing
+
+ pos = m_listLayoutCB.GetHeadPosition();
+ while (pos != NULL)
+ {
+ // get layout info
+ layout = m_listLayoutCB.GetNext(pos);
+ // request layout data
+ if (!ArrangeLayoutCallback(layout))
+ continue;
+
+ // calculate new child's position, size and flags for SetWindowPos
+ CalcNewChildPosition(layout, rectParent, rectChild, uFlags);
+
+ // only if size or position changed
+ if ((uFlags & (SWP_NOMOVE|SWP_NOSIZE)) != (SWP_NOMOVE|SWP_NOSIZE))
+ {
+ hdwp = ::DeferWindowPos(hdwp, layout.hWnd, NULL, rectChild.left,
+ rectChild.top, rectChild.Width(), rectChild.Height(), uFlags);
+ }
+ }
+
+ // finally move all the windows at once
+ ::EndDeferWindowPos(hdwp);
+}
+
+void CResizableLayout::ClipChildWindow(const CResizableLayout::LayoutInfo& layout,
+ CRgn* pRegion)
+{
+ // obtain window position
+ CRect rect;
+ ::GetWindowRect(layout.hWnd, &rect);
+ ::MapWindowPoints(NULL, GetResizableWnd()->m_hWnd, (LPPOINT)&rect, 2);
+
+ // use window region if any
+ CRgn rgn;
+ rgn.CreateRectRgn(0,0,0,0);
+ switch (::GetWindowRgn(layout.hWnd, rgn))
+ {
+ case COMPLEXREGION:
+ case SIMPLEREGION:
+ rgn.OffsetRgn(rect.TopLeft());
+ break;
+
+ default:
+ rgn.SetRectRgn(&rect);
+ }
+
+ // get the clipping property
+ BOOL bClipping = layout.properties.bAskClipping ?
+ LikesClipping(layout) : layout.properties.bCachedLikesClipping;
+
+ // modify region accordingly
+ if (bClipping)
+ pRegion->CombineRgn(pRegion, &rgn, RGN_DIFF);
+ else
+ pRegion->CombineRgn(pRegion, &rgn, RGN_OR);
+}
+
+void CResizableLayout::GetClippingRegion(CRgn* pRegion)
+{
+ CWnd* pWnd = GetResizableWnd();
+
+ // System's default clipping area is screen's size,
+ // not enough for max track size, for example:
+ // if screen is 1024 x 768 and resizing border is 4 pixels,
+ // maximized size is 1024+4*2=1032 x 768+4*2=776,
+ // but max track size is 4 pixels bigger 1036 x 780 (don't ask me why!)
+ // So, if you resize the window to maximum size, the last 4 pixels
+ // are clipped out by the default clipping region, that gets created
+ // as soon as you call clipping functions (my guess).
+
+ // reset clipping region to the whole client area
+ CRect rect;
+ pWnd->GetClientRect(&rect);
+ pRegion->CreateRectRgnIndirect(&rect);
+
+ // clip only anchored controls
+ LayoutInfo layout;
+ POSITION pos = m_listLayout.GetHeadPosition();
+ while (pos != NULL)
+ {
+ // get layout info
+ layout = m_listLayout.GetNext(pos);
+
+ if (::IsWindowVisible(layout.hWnd))
+ ClipChildWindow(layout, pRegion);
+ }
+ pos = m_listLayoutCB.GetHeadPosition();
+ while (pos != NULL)
+ {
+ // get layout info
+ layout = m_listLayoutCB.GetNext(pos);
+ // request data
+ if (!ArrangeLayoutCallback(layout))
+ continue;
+
+ if (::IsWindowVisible(layout.hWnd))
+ ClipChildWindow(layout, pRegion);
+ }
+
+ // fix for RTL layouts (1 pixel of horz offset)
+ if (pWnd->GetExStyle() & 0x00400000L/*WS_EX_LAYOUTRTL*/)
+ pRegion->OffsetRgn(-1,0);
+}
+
+void CResizableLayout::EraseBackground(CDC* pDC)
+{
+ HWND hWnd = GetResizableWnd()->GetSafeHwnd();
+
+ // retrieve the background brush
+ HBRUSH hBrush = NULL;
+
+ // is this a dialog box?
+ // (using class atom is quickier than using the class name)
+ ATOM atomWndClass = (ATOM)::GetClassLong(hWnd, GCW_ATOM);
+ if (atomWndClass == (ATOM)0x8002)
+ {
+ // send a message to the dialog box
+ hBrush = (HBRUSH)::SendMessage(hWnd, WM_CTLCOLORDLG,
+ (WPARAM)pDC->GetSafeHdc(), (LPARAM)hWnd);
+ }
+ else
+ {
+ // take the background brush from the window's class
+ hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCL_HBRBACKGROUND);
+ }
+
+ // fill the clipped background
+ CRgn rgn;
+ GetClippingRegion(&rgn);
+
+ ::FillRgn(pDC->GetSafeHdc(), rgn, hBrush);
+}
+
+// support legacy code (will disappear in future versions)
+void CResizableLayout::ClipChildren(CDC* pDC)
+{
+ CRgn rgn;
+ GetClippingRegion(&rgn);
+ // the clipping region is in device units
+ rgn.OffsetRgn(-pDC->GetWindowOrg());
+ pDC->SelectClipRgn(&rgn);
+}
+
+void CResizableLayout::GetTotalClientRect(LPRECT lpRect)
+{
+ GetResizableWnd()->GetClientRect(lpRect);
+}
+
+BOOL CResizableLayout::NeedsRefresh(const CResizableLayout::LayoutInfo& layout,
+ const CRect& rectOld, const CRect& rectNew)
+{
+ if (layout.bMsgSupport)
+ {
+ REFRESHPROPERTY refresh;
+ refresh.rcOld = rectOld;
+ refresh.rcNew = rectNew;
+ if (Send_NeedsRefresh(layout.hWnd, &refresh))
+ return refresh.bNeedsRefresh;
+ }
+
+ int nDiffWidth = (rectNew.Width() - rectOld.Width());
+ int nDiffHeight = (rectNew.Height() - rectOld.Height());
+
+ // is the same size?
+ if (nDiffWidth == 0 && nDiffHeight == 0)
+ return FALSE;
+
+ // optimistic, no need to refresh
+ BOOL bRefresh = FALSE;
+
+ // window classes that need refresh when resized
+ if (layout.sWndClass == WC_STATIC)
+ {
+ DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE);
+
+ switch (style & SS_TYPEMASK)
+ {
+ case SS_LEFT:
+ case SS_CENTER:
+ case SS_RIGHT:
+ // word-wrapped text
+ bRefresh = bRefresh || (nDiffWidth != 0);
+ // vertically centered text
+ if (style & SS_CENTERIMAGE)
+ bRefresh = bRefresh || (nDiffHeight != 0);
+ break;
+
+ case SS_LEFTNOWORDWRAP:
+ // text with ellipsis
+ if (style & SS_ELLIPSISMASK)
+ bRefresh = bRefresh || (nDiffWidth != 0);
+ // vertically centered text
+ if (style & SS_CENTERIMAGE)
+ bRefresh = bRefresh || (nDiffHeight != 0);
+ break;
+
+ case SS_ENHMETAFILE:
+ case SS_BITMAP:
+ case SS_ICON:
+ // images
+ case SS_BLACKFRAME:
+ case SS_GRAYFRAME:
+ case SS_WHITEFRAME:
+ case SS_ETCHEDFRAME:
+ // and frames
+ bRefresh = TRUE;
+ break;
+ }
+ }
+
+ // window classes that don't redraw client area correctly
+ // when the hor scroll pos changes due to a resizing
+ BOOL bHScroll = FALSE;
+ if (layout.sWndClass == WC_LISTBOX)
+ bHScroll = TRUE;
+
+ // fix for horizontally scrollable windows
+ if (bHScroll && (nDiffWidth > 0))
+ {
+ // get max scroll position
+ SCROLLINFO info;
+ info.cbSize = sizeof(SCROLLINFO);
+ info.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
+ if (::GetScrollInfo(layout.hWnd, SB_HORZ, &info))
+ {
+ // subtract the page size
+ info.nMax -= __max(info.nPage-1,0);
+ }
+
+ // resizing will cause the text to scroll on the right
+ // because the scrollbar is going beyond the right limit
+ if ((info.nMax > 0) && (info.nPos + nDiffWidth > info.nMax))
+ {
+ // needs repainting, due to horiz scrolling
+ bRefresh = TRUE;
+ }
+ }
+
+ return bRefresh;
+}
+
+BOOL CResizableLayout::LikesClipping(const CResizableLayout::LayoutInfo& layout)
+{
+ if (layout.bMsgSupport)
+ {
+ CLIPPINGPROPERTY clipping;
+ if (Send_LikesClipping(layout.hWnd, &clipping))
+ return clipping.bLikesClipping;
+ }
+
+ DWORD style = ::GetWindowLong(layout.hWnd, GWL_STYLE);
+
+ // skip windows that wants background repainted
+ if (layout.sWndClass == TOOLBARCLASSNAME && (style & TBSTYLE_TRANSPARENT))
+ return FALSE;
+ else if (layout.sWndClass == WC_BUTTON)
+ {
+ CRect rect;
+ switch (style & _BS_TYPEMASK)
+ {
+ case BS_GROUPBOX:
+ return FALSE;
+
+ case BS_OWNERDRAW:
+ // ownerdraw buttons must return correct hittest code
+ // to notify their transparency to the system and this library
+ ::GetWindowRect(layout.hWnd, &rect);
+ if ( HTTRANSPARENT == ::SendMessage(layout.hWnd,
+ WM_NCHITTEST, 0, MAKELPARAM(rect.left, rect.top)) )
+ return FALSE;
+ break;
+ }
+ return TRUE;
+ }
+ else if (layout.sWndClass == WC_STATIC)
+ {
+ switch (style & SS_TYPEMASK)
+ {
+ case SS_LEFT:
+ case SS_CENTER:
+ case SS_RIGHT:
+ case SS_SIMPLE:
+ case SS_LEFTNOWORDWRAP:
+ // text
+ case SS_BLACKRECT:
+ case SS_GRAYRECT:
+ case SS_WHITERECT:
+ // filled rects
+ case SS_ETCHEDHORZ:
+ case SS_ETCHEDVERT:
+ // etched lines
+ case SS_BITMAP:
+ // bitmaps
+ return TRUE;
+ break;
+
+ case SS_ICON:
+ case SS_ENHMETAFILE:
+ if (style & SS_CENTERIMAGE)
+ return FALSE;
+ return TRUE;
+ break;
+
+ default:
+ return FALSE;
+ }
+ }
+
+ // assume the others like clipping
+ return TRUE;
+}
+
+void CResizableLayout::CalcNewChildPosition(const CResizableLayout::LayoutInfo& layout,
+ const CRect &rectParent, CRect &rectChild, UINT& uFlags)
+{
+ CWnd* pParent = GetResizableWnd();
+
+ ::GetWindowRect(layout.hWnd, &rectChild);
+ ::MapWindowPoints(NULL, pParent->m_hWnd, (LPPOINT)&rectChild, 2);
+
+ CRect rectNew;
+
+ // calculate new top-left corner
+ rectNew.left = layout.sizeMarginTL.cx + rectParent.Width() * layout.sizeTypeTL.cx / 100;
+ rectNew.top = layout.sizeMarginTL.cy + rectParent.Height() * layout.sizeTypeTL.cy / 100;
+
+ // calculate new bottom-right corner
+ rectNew.right = layout.sizeMarginBR.cx + rectParent.Width() * layout.sizeTypeBR.cx / 100;
+ rectNew.bottom = layout.sizeMarginBR.cy + rectParent.Height() * layout.sizeTypeBR.cy / 100;
+
+ // adjust position, if client area has been scrolled
+ rectNew.OffsetRect(rectParent.TopLeft());
+
+ // get the refresh property
+ BOOL bRefresh = layout.properties.bAskRefresh ?
+ NeedsRefresh(layout, rectChild, rectNew) : layout.properties.bCachedNeedsRefresh;
+
+ // set flags
+ uFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREPOSITION;
+ if (bRefresh)
+ uFlags |= SWP_NOCOPYBITS;
+ if (rectNew.TopLeft() == rectChild.TopLeft())
+ uFlags |= SWP_NOMOVE;
+ if (rectNew.Size() == rectChild.Size())
+ uFlags |= SWP_NOSIZE;
+
+ // update rect
+ rectChild = rectNew;
+}
+
+void CResizableLayout::InitResizeProperties(CResizableLayout::LayoutInfo &layout)
+{
+ // check if custom window supports this library
+ // (properties must be correctly set by the window)
+ layout.bMsgSupport = Send_QueryProperties(layout.hWnd, &layout.properties);
+
+ // default properties
+ if (!layout.bMsgSupport)
+ {
+ // clipping property is assumed as static
+ layout.properties.bAskClipping = FALSE;
+ layout.properties.bCachedLikesClipping = LikesClipping(layout);
+ // refresh property is assumed as dynamic
+ layout.properties.bAskRefresh = TRUE;
+ }
+}
diff --git a/src/ui/ResizableLib/ResizableLayout.h b/src/ui/ResizableLib/ResizableLayout.h
new file mode 100644
index 000000000..0d57623db
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableLayout.h
@@ -0,0 +1,196 @@
+// ResizableLayout.h: interface for the CResizableLayout class.
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_RESIZABLELAYOUT_H__INCLUDED_)
+#define AFX_RESIZABLELAYOUT_H__INCLUDED_
+
+#include <afxtempl.h>
+#include "ResizableMsgSupport.h"
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+// useful compatibility constants (the only one required is NOANCHOR)
+
+const CSize NOANCHOR(-1,-1),
+ TOP_LEFT(0,0), TOP_CENTER(50,0), TOP_RIGHT(100,0),
+ MIDDLE_LEFT(0,50), MIDDLE_CENTER(50,50), MIDDLE_RIGHT(100,50),
+ BOTTOM_LEFT(0,100), BOTTOM_CENTER(50,100), BOTTOM_RIGHT(100,100);
+
+
+class CResizableLayout
+{
+protected:
+ class LayoutInfo
+ {
+ public:
+ HWND hWnd;
+ UINT nCallbackID;
+
+ CString sWndClass;
+
+ // upper-left corner
+ SIZE sizeTypeTL;
+ SIZE sizeMarginTL;
+
+ // bottom-right corner
+ SIZE sizeTypeBR;
+ SIZE sizeMarginBR;
+
+ // custom window support
+ BOOL bMsgSupport;
+ RESIZEPROPERTIES properties;
+
+ public:
+ LayoutInfo() : hWnd(NULL), nCallbackID(0), bMsgSupport(FALSE)
+ {
+ sizeTypeTL.cx = 0;
+ sizeTypeTL.cy = 0;
+ sizeMarginTL.cx = 0;
+ sizeMarginTL.cy = 0;
+ sizeTypeBR.cx = 0;
+ sizeTypeBR.cy = 0;
+ sizeMarginBR.cx = 0;
+ sizeMarginBR.cy = 0;
+ memset(&properties, 0, sizeof properties);
+ }
+
+ LayoutInfo(HWND hwnd, SIZE tl_t, SIZE tl_m,
+ SIZE br_t, SIZE br_m, CString classname)
+ : hWnd(hwnd), nCallbackID(0),
+ sWndClass(classname), bMsgSupport(FALSE),
+ sizeTypeTL(tl_t), sizeMarginTL(tl_m),
+ sizeTypeBR(br_t), sizeMarginBR(br_m)
+ {
+ memset(&properties, 0, sizeof properties);
+ }
+ };
+
+private:
+ // list of repositionable controls
+ CMap<HWND, HWND, POSITION, POSITION> m_mapLayout;
+ CList<LayoutInfo, LayoutInfo&> m_listLayout;
+ CList<LayoutInfo, LayoutInfo&> m_listLayoutCB;
+
+ void ClipChildWindow(const CResizableLayout::LayoutInfo &layout, CRgn* pRegion);
+
+ void CalcNewChildPosition(const CResizableLayout::LayoutInfo &layout,
+ const CRect &rectParent, CRect &rectChild, UINT& uFlags);
+
+protected:
+ // override to initialize resize properties (clipping, refresh)
+ virtual void InitResizeProperties(CResizableLayout::LayoutInfo& layout);
+
+ // override to specify clipping for unsupported windows
+ virtual BOOL LikesClipping(const CResizableLayout::LayoutInfo &layout);
+
+ // override to specify refresh for unsupported windows
+ virtual BOOL NeedsRefresh(const CResizableLayout::LayoutInfo &layout,
+ const CRect &rectOld, const CRect &rectNew);
+
+ // paint the background on the given DC (for XP theme's compatibility)
+ void EraseBackground(CDC* pDC);
+
+ // clip out child windows from the given DC (support old code)
+ void ClipChildren(CDC* pDC);
+
+ // get the clipping region (without clipped child windows)
+ void GetClippingRegion(CRgn* pRegion);
+
+ // override for scrollable or expanding parent windows
+ virtual void GetTotalClientRect(LPRECT lpRect);
+
+ // add anchors to a control, given its HWND
+ void AddAnchor(HWND hWnd, CSize sizeTypeTL, CSize sizeTypeBR = NOANCHOR);
+
+ // add anchors to a control, given its ID
+ void AddAnchor(UINT nID, CSize sizeTypeTL, CSize sizeTypeBR = NOANCHOR)
+ {
+ AddAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
+ sizeTypeTL, sizeTypeBR);
+ }
+
+ // add a callback (control ID or HWND is unknown or may change)
+ void AddAnchorCallback(UINT nCallbackID);
+
+ // get rect of an anchored window, given the parent's client area
+ BOOL GetAnchorPosition(HWND hWnd, const CRect &rectParent,
+ CRect &rectChild, UINT* lpFlags = NULL)
+ {
+ POSITION pos;
+ if (!m_mapLayout.Lookup(hWnd, pos))
+ return FALSE;
+
+ UINT uTmpFlags;
+ CalcNewChildPosition(m_listLayout.GetAt(pos), rectParent, rectChild,
+ (lpFlags != NULL) ? (*lpFlags) : uTmpFlags);
+ return TRUE;
+ }
+
+ // get rect of an anchored window, given the parent's client area
+ BOOL GetAnchorPosition(UINT nID, const CRect &rectParent,
+ CRect &rectChild, UINT* lpFlags = NULL)
+ {
+ return GetAnchorPosition(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID),
+ rectParent, rectChild, lpFlags);
+ }
+
+ // remove an anchored control from the layout, given its HWND
+ BOOL RemoveAnchor(HWND hWnd)
+ {
+ POSITION pos;
+ if (!m_mapLayout.Lookup(hWnd, pos))
+ return FALSE;
+
+ m_listLayout.RemoveAt(pos);
+ return m_mapLayout.RemoveKey(hWnd);
+ }
+
+ // remove an anchored control from the layout, given its HWND
+ BOOL RemoveAnchor(UINT nID)
+ {
+ return RemoveAnchor(::GetDlgItem(GetResizableWnd()->GetSafeHwnd(), nID));
+ }
+
+ // reset layout content
+ void RemoveAllAnchors()
+ {
+ m_mapLayout.RemoveAll();
+ m_listLayout.RemoveAll();
+ m_listLayoutCB.RemoveAll();
+ }
+
+ // adjust children's layout, when parent's size changes
+ void ArrangeLayout();
+
+ // override to provide dynamic control's layout info
+ virtual BOOL ArrangeLayoutCallback(CResizableLayout::LayoutInfo& layout);
+
+ // override to provide the parent window
+ virtual CWnd* GetResizableWnd() = 0;
+
+public:
+ CResizableLayout() { }
+
+ virtual ~CResizableLayout()
+ {
+ // just for safety
+ RemoveAllAnchors();
+ }
+};
+
+#endif // !defined(AFX_RESIZABLELAYOUT_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/ResizableLib.sln b/src/ui/ResizableLib/ResizableLib.sln
new file mode 100644
index 000000000..d133fa546
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableLib.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResizableLib", "ResizableLib.vcproj", "{4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug.ActiveCfg = Debug|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug.Build.0 = Debug|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release.ActiveCfg = Release|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release.Build.0 = Release|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/ui/ResizableLib/ResizableLib.vcproj b/src/ui/ResizableLib/ResizableLib.vcproj
new file mode 100644
index 000000000..e09f5697f
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableLib.vcproj
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="ResizableLib"
+ ProjectGUID="{4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\ResizableLibD.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\ResizableLibR.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\ResizableLibDU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="..\..\..\lib\ResizableLibRU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\ResizableDialog.cpp">
+ </File>
+ <File
+ RelativePath=".\ResizableGrip.cpp">
+ </File>
+ <File
+ RelativePath=".\ResizableLayout.cpp">
+ </File>
+ <File
+ RelativePath=".\ResizableMinMax.cpp">
+ </File>
+ <File
+ RelativePath=".\ResizablePage.cpp">
+ </File>
+ <File
+ RelativePath=".\ResizableSheet.cpp">
+ </File>
+ <File
+ RelativePath=".\ResizableState.cpp">
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\ResizableDialog.h">
+ </File>
+ <File
+ RelativePath=".\ResizableGrip.h">
+ </File>
+ <File
+ RelativePath=".\ResizableLayout.h">
+ </File>
+ <File
+ RelativePath=".\ResizableMinMax.h">
+ </File>
+ <File
+ RelativePath=".\ResizableMsgSupport.h">
+ </File>
+ <File
+ RelativePath=".\ResizableMsgSupport.inl">
+ </File>
+ <File
+ RelativePath=".\ResizablePage.h">
+ </File>
+ <File
+ RelativePath=".\ResizableSheet.h">
+ </File>
+ <File
+ RelativePath=".\ResizableState.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt">
+ </File>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/ui/ResizableLib/ResizableLib.vcproj.vspscc b/src/ui/ResizableLib/ResizableLib.vcproj.vspscc
new file mode 100644
index 000000000..ea1a71456
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableLib.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:ui\\ResizableLib"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/src/ui/ResizableLib/ResizableMinMax.cpp b/src/ui/ResizableLib/ResizableMinMax.cpp
new file mode 100644
index 000000000..74e576d99
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableMinMax.cpp
@@ -0,0 +1,95 @@
+// ResizableMinMax.cpp: implementation of the CResizableMinMax class.
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ResizableMinMax.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CResizableMinMax::CResizableMinMax()
+{
+ m_bUseMinTrack = FALSE;
+ m_bUseMaxTrack = FALSE;
+ m_bUseMaxRect = FALSE;
+}
+
+CResizableMinMax::~CResizableMinMax()
+{
+
+}
+
+void CResizableMinMax::MinMaxInfo(LPMINMAXINFO lpMMI)
+{
+ if (m_bUseMinTrack)
+ lpMMI->ptMinTrackSize = m_ptMinTrackSize;
+
+ if (m_bUseMaxTrack)
+ lpMMI->ptMaxTrackSize = m_ptMaxTrackSize;
+
+ if (m_bUseMaxRect)
+ {
+ lpMMI->ptMaxPosition = m_ptMaxPos;
+ lpMMI->ptMaxSize = m_ptMaxSize;
+ }
+}
+
+void CResizableMinMax::SetMaximizedRect(const CRect& rc)
+{
+ m_bUseMaxRect = TRUE;
+
+ m_ptMaxPos = rc.TopLeft();
+ m_ptMaxSize.x = rc.Width();
+ m_ptMaxSize.y = rc.Height();
+}
+
+void CResizableMinMax::ResetMaximizedRect()
+{
+ m_bUseMaxRect = FALSE;
+}
+
+void CResizableMinMax::SetMinTrackSize(const CSize& size)
+{
+ m_bUseMinTrack = TRUE;
+
+ m_ptMinTrackSize.x = size.cx;
+ m_ptMinTrackSize.y = size.cy;
+}
+
+void CResizableMinMax::ResetMinTrackSize()
+{
+ m_bUseMinTrack = FALSE;
+}
+
+void CResizableMinMax::SetMaxTrackSize(const CSize& size)
+{
+ m_bUseMaxTrack = TRUE;
+
+ m_ptMaxTrackSize.x = size.cx;
+ m_ptMaxTrackSize.y = size.cy;
+}
+
+void CResizableMinMax::ResetMaxTrackSize()
+{
+ m_bUseMaxTrack = FALSE;
+}
diff --git a/src/ui/ResizableLib/ResizableMinMax.h b/src/ui/ResizableLib/ResizableMinMax.h
new file mode 100644
index 000000000..557780323
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableMinMax.h
@@ -0,0 +1,53 @@
+// ResizableMinMax.h: interface for the CResizableMinMax class.
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_RESIZABLEMINMAX_H__INCLUDED_)
+#define AFX_RESIZABLEMINMAX_H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+class CResizableMinMax
+{
+// Attributes
+private:
+ // flags
+ BOOL m_bUseMaxTrack;
+ BOOL m_bUseMinTrack;
+ BOOL m_bUseMaxRect;
+
+ POINT m_ptMinTrackSize; // min tracking size
+ POINT m_ptMaxTrackSize; // max tracking size
+ POINT m_ptMaxPos; // maximized position
+ POINT m_ptMaxSize; // maximized size
+
+public:
+ CResizableMinMax();
+ virtual ~CResizableMinMax();
+
+protected:
+ void MinMaxInfo(LPMINMAXINFO lpMMI);
+
+ void SetMaximizedRect(const CRect& rc); // set window rect when maximized
+ void ResetMaximizedRect(); // reset to default maximized rect
+ void SetMinTrackSize(const CSize& size); // set minimum tracking size
+ void ResetMinTrackSize(); // reset to default minimum tracking size
+ void SetMaxTrackSize(const CSize& size); // set maximum tracking size
+ void ResetMaxTrackSize(); // reset to default maximum tracking size
+};
+
+#endif // !defined(AFX_RESIZABLEMINMAX_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/ResizableMsgSupport.h b/src/ui/ResizableLib/ResizableMsgSupport.h
new file mode 100644
index 000000000..68d45fe9f
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableMsgSupport.h
@@ -0,0 +1,61 @@
+// ResizableMsgSupport.h: some declarations to support custom resizable wnds
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_RESIZABLEMSGSUPPORT_H__INCLUDED_)
+#define AFX_RESIZABLEMSGSUPPORT_H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+typedef struct tagRESIZEPROPERTIES
+{
+ // wether to ask for resizing properties every time
+ BOOL bAskClipping;
+ BOOL bAskRefresh;
+ // otherwise, use the cached properties
+ BOOL bCachedLikesClipping;
+ BOOL bCachedNeedsRefresh;
+
+ // initialize with valid data
+ tagRESIZEPROPERTIES() : bAskClipping(TRUE), bAskRefresh(TRUE) {}
+
+} RESIZEPROPERTIES, *PRESIZEPROPERTIES, *LPRESIZEPROPERTIES;
+
+
+typedef struct tagCLIPPINGPROPERTY
+{
+ BOOL bLikesClipping;
+
+ // initialize with valid data
+ tagCLIPPINGPROPERTY() : bLikesClipping(FALSE) {}
+
+} CLIPPINGPROPERTY, *PCLIPPINGPROPERTY, *LPCLIPPINGPROPERTY;
+
+
+typedef struct tagREFRESHPROPERTY
+{
+ BOOL bNeedsRefresh;
+ RECT rcOld;
+ RECT rcNew;
+
+ // initialize with valid data
+ tagREFRESHPROPERTY() : bNeedsRefresh(TRUE) {}
+
+} REFRESHPROPERTY, *PREFRESHPROPERTY, *LPREFRESHPROPERTY;
+
+
+#endif // !defined(AFX_RESIZABLEMSGSUPPORT_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/ResizableMsgSupport.inl b/src/ui/ResizableLib/ResizableMsgSupport.inl
new file mode 100644
index 000000000..f8f3b41e8
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableMsgSupport.inl
@@ -0,0 +1,56 @@
+// ResizableMsgSupport.inl: some definitions to support custom resizable wnds
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+
+// registered message to communicate with the library
+// (defined so that in the same executable it is initialized only once)
+const UINT WMU_RESIZESUPPORT = ::RegisterWindowMessage(_T("WMU_RESIZESUPPORT"));
+
+// if the message is implemented the returned value must be non-zero
+// the default window procedure returns zero for unhandled messages
+
+// wParam is one of the following RSZSUP_* values, lParam as specified
+
+#define RSZSUP_QUERYPROPERTIES 101 // lParam = LPRESIZEPROPERTIES
+
+#define RSZSUP_LIKESCLIPPING 102 // lParam = LPCLIPPINGPROPERTY
+
+#define RSZSUP_NEEDSREFRESH 103 // lParam = LPREFRESHPROPERTY
+
+
+/////////////////////////////////////////////////////////////////////////////
+// utility functions
+
+inline BOOL Send_QueryProperties(HWND hWnd, LPRESIZEPROPERTIES pResizeProperties)
+{
+ ASSERT(::IsWindow(hWnd));
+ return (0 != SendMessage(hWnd, WMU_RESIZESUPPORT,
+ RSZSUP_QUERYPROPERTIES, (LPARAM)pResizeProperties));
+}
+
+inline BOOL Send_LikesClipping(HWND hWnd, LPCLIPPINGPROPERTY pClippingProperty)
+{
+ ASSERT(::IsWindow(hWnd));
+ return (0 != SendMessage(hWnd, WMU_RESIZESUPPORT,
+ RSZSUP_LIKESCLIPPING, (LPARAM)pClippingProperty));
+}
+
+inline BOOL Send_NeedsRefresh(HWND hWnd, LPREFRESHPROPERTY pRefreshProperty)
+{
+ ASSERT(::IsWindow(hWnd));
+ return (0 != SendMessage(hWnd, WMU_RESIZESUPPORT,
+ RSZSUP_NEEDSREFRESH, (LPARAM)pRefreshProperty));
+}
diff --git a/src/ui/ResizableLib/ResizablePage.cpp b/src/ui/ResizableLib/ResizablePage.cpp
new file mode 100644
index 000000000..10c49366e
--- /dev/null
+++ b/src/ui/ResizableLib/ResizablePage.cpp
@@ -0,0 +1,78 @@
+// ResizablePage.cpp : implementation file
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ResizablePage.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CResizablePage
+
+IMPLEMENT_DYNCREATE(CResizablePage, CPropertyPage)
+
+CResizablePage::CResizablePage()
+{
+}
+
+CResizablePage::CResizablePage(UINT nIDTemplate, UINT nIDCaption)
+ : CPropertyPage(nIDTemplate, nIDCaption)
+{
+}
+
+CResizablePage::CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption)
+ : CPropertyPage(lpszTemplateName, nIDCaption)
+{
+}
+
+CResizablePage::~CResizablePage()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CResizablePage, CPropertyPage)
+ //{{AFX_MSG_MAP(CResizablePage)
+ ON_WM_SIZE()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CResizablePage message handlers
+
+void CResizablePage::OnSize(UINT nType, int cx, int cy)
+{
+ CWnd::OnSize(nType, cx, cy);
+
+ ArrangeLayout();
+}
+
+BOOL CResizablePage::OnEraseBkgnd(CDC* pDC)
+{
+ // Windows XP doesn't like clipping regions ...try this!
+ EraseBackground(pDC);
+ return TRUE;
+
+/* ClipChildren(pDC); // old-method (for safety)
+
+ return CPropertyPage::OnEraseBkgnd(pDC);
+*/
+}
diff --git a/src/ui/ResizableLib/ResizablePage.h b/src/ui/ResizableLib/ResizablePage.h
new file mode 100644
index 000000000..4c8218634
--- /dev/null
+++ b/src/ui/ResizableLib/ResizablePage.h
@@ -0,0 +1,78 @@
+#if !defined(AFX_RESIZABLEPAGE_H__INCLUDED_)
+#define AFX_RESIZABLEPAGE_H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+// ResizablePage.h : header file
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "ResizableLayout.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CResizablePage window
+
+class CResizablePage : public CPropertyPage, public CResizableLayout
+{
+ DECLARE_DYNCREATE(CResizablePage)
+
+// Construction
+public:
+ CResizablePage();
+ CResizablePage(UINT nIDTemplate, UINT nIDCaption = 0);
+ CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption = 0);
+
+// Attributes
+public:
+
+// Operations
+public:
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CResizablePage)
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ virtual ~CResizablePage();
+
+// callable from derived classes
+protected:
+
+ virtual CWnd* GetResizableWnd()
+ {
+ // make the layout know its parent window
+ return this;
+ };
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CResizablePage)
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_RESIZABLEPAGE_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/ResizableSheet.cpp b/src/ui/ResizableLib/ResizableSheet.cpp
new file mode 100644
index 000000000..95ac673a0
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableSheet.cpp
@@ -0,0 +1,355 @@
+// ResizableSheet.cpp : implementation file
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ResizableSheet.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CResizableSheet
+
+IMPLEMENT_DYNAMIC(CResizableSheet, CPropertySheet)
+
+inline void CResizableSheet::PrivateConstruct()
+{
+ m_bEnableSaveRestore = FALSE;
+ m_bSavePage = FALSE;
+ m_dwGripTempState = 1;
+}
+
+
+CResizableSheet::CResizableSheet()
+{
+ PrivateConstruct();
+}
+
+CResizableSheet::CResizableSheet(UINT nIDCaption, CWnd *pParentWnd, UINT iSelectPage)
+ : CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
+{
+ PrivateConstruct();
+}
+
+CResizableSheet::CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd, UINT iSelectPage)
+ : CPropertySheet(pszCaption, pParentWnd, iSelectPage)
+{
+ PrivateConstruct();
+}
+
+CResizableSheet::~CResizableSheet()
+{
+}
+
+BEGIN_MESSAGE_MAP(CResizableSheet, CPropertySheet)
+ //{{AFX_MSG_MAP(CResizableSheet)
+ ON_WM_GETMINMAXINFO()
+ ON_WM_SIZE()
+ ON_WM_DESTROY()
+ ON_WM_CREATE()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
+ ON_NOTIFY_REFLECT_EX(PSN_SETACTIVE, OnPageChanging)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CResizableSheet message handlers
+
+int CResizableSheet::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ // keep client area
+ CRect rect;
+ GetClientRect(&rect);
+ // set resizable style
+ ModifyStyle(DS_MODALFRAME, WS_POPUP | WS_THICKFRAME);
+ // adjust size to reflect new style
+ ::AdjustWindowRectEx(&rect, GetStyle(),
+ ::IsMenu(GetMenu()->GetSafeHmenu()), GetExStyle());
+ SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_FRAMECHANGED|
+ SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);
+
+ // create and init the size-grip
+ if (!CreateSizeGrip())
+ return -1;
+
+ return 0;
+}
+
+BOOL CResizableSheet::OnInitDialog()
+{
+ BOOL bResult = CPropertySheet::OnInitDialog();
+
+ // set the initial size as the min track size
+ CRect rc;
+ GetWindowRect(&rc);
+ SetMinTrackSize(rc.Size());
+
+ // initialize layout
+ PresetLayout();
+
+ // prevent flickering
+ GetTabControl()->ModifyStyle(0, WS_CLIPSIBLINGS);
+
+ return bResult;
+}
+
+void CResizableSheet::OnDestroy()
+{
+ if (m_bEnableSaveRestore)
+ {
+ SaveWindowRect(m_sSection, m_bRectOnly);
+ SavePage();
+ }
+
+ RemoveAllAnchors();
+
+ CPropertySheet::OnDestroy();
+}
+
+// maps an index to a button ID and vice-versa
+static UINT _propButtons[] =
+{
+ IDOK, IDCANCEL, ID_APPLY_NOW, IDHELP,
+ ID_WIZBACK, ID_WIZNEXT, ID_WIZFINISH
+};
+const int _propButtonsCount = sizeof(_propButtons)/sizeof(UINT);
+
+// horizontal line in wizard mode
+#define ID_WIZLINE ID_WIZFINISH+1
+
+void CResizableSheet::PresetLayout()
+{
+ if (IsWizard()) // wizard mode
+ {
+ // hide tab control
+ GetTabControl()->ShowWindow(SW_HIDE);
+
+ AddAnchor(ID_WIZLINE, BOTTOM_LEFT, BOTTOM_RIGHT);
+ }
+ else // tab mode
+ {
+ AddAnchor(AFX_IDC_TAB_CONTROL, TOP_LEFT, BOTTOM_RIGHT);
+ }
+
+ // add a callback for active page (which can change at run-time)
+ AddAnchorCallback(1);
+
+ // use *total* parent size to have correct margins
+ CRect rectPage, rectSheet;
+ GetTotalClientRect(&rectSheet);
+
+ GetActivePage()->GetWindowRect(&rectPage);
+ ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectPage, 2);
+
+ // pre-calculate margins
+ m_sizePageTL = rectPage.TopLeft() - rectSheet.TopLeft();
+ m_sizePageBR = rectPage.BottomRight() - rectSheet.BottomRight();
+
+ // add all possible buttons, if they exist
+ for (int i = 0; i < _propButtonsCount; i++)
+ {
+ if (NULL != GetDlgItem(_propButtons[i]))
+ AddAnchor(_propButtons[i], BOTTOM_RIGHT);
+ }
+}
+
+BOOL CResizableSheet::ArrangeLayoutCallback(LayoutInfo &layout)
+{
+ if (layout.nCallbackID != 1) // we only added 1 callback
+ return CResizableLayout::ArrangeLayoutCallback(layout);
+
+ // set layout info for active page
+ layout.hWnd = (HWND)::SendMessage(m_hWnd, PSM_GETCURRENTPAGEHWND, 0, 0);
+ if (!::IsWindow(layout.hWnd))
+ return FALSE;
+
+ // set margins
+ if (IsWizard()) // wizard mode
+ {
+ // use pre-calculated margins
+ layout.sizeMarginTL = m_sizePageTL;
+ layout.sizeMarginBR = m_sizePageBR;
+ }
+ else // tab mode
+ {
+ CTabCtrl* pTab = GetTabControl();
+ ASSERT(pTab != NULL);
+
+ // get tab position after resizing and calc page rect
+ CRect rectPage, rectSheet;
+ GetTotalClientRect(&rectSheet);
+
+ VERIFY(GetAnchorPosition(pTab->m_hWnd, rectSheet, rectPage));
+ pTab->AdjustRect(FALSE, &rectPage);
+
+ // set margins
+ layout.sizeMarginTL = rectPage.TopLeft() - rectSheet.TopLeft();
+ layout.sizeMarginBR = rectPage.BottomRight() - rectSheet.BottomRight();
+ }
+
+ // set anchor types
+ layout.sizeTypeTL = TOP_LEFT;
+ layout.sizeTypeBR = BOTTOM_RIGHT;
+
+ // use this layout info
+ return TRUE;
+}
+
+void CResizableSheet::OnSize(UINT nType, int cx, int cy)
+{
+ CWnd::OnSize(nType, cx, cy);
+
+ if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW)
+ return; // arrangement not needed
+
+ if (nType == SIZE_MAXIMIZED)
+ HideSizeGrip(&m_dwGripTempState);
+ else
+ ShowSizeGrip(&m_dwGripTempState);
+
+ // update grip and layout
+ UpdateSizeGrip();
+ ArrangeLayout();
+}
+
+BOOL CResizableSheet::OnPageChanging(NMHDR* /*pNotifyStruct*/, LRESULT* /*pResult*/)
+{
+ // update new wizard page
+ // active page changes after this notification
+ PostMessage(WM_SIZE);
+
+ return FALSE; // continue routing
+}
+
+BOOL CResizableSheet::OnEraseBkgnd(CDC* pDC)
+{
+ // Windows XP doesn't like clipping regions ...try this!
+ EraseBackground(pDC);
+ return TRUE;
+
+/* ClipChildren(pDC); // old-method (for safety)
+
+ return CPropertySheet::OnEraseBkgnd(pDC);
+*/
+}
+
+void CResizableSheet::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
+{
+ MinMaxInfo(lpMMI);
+}
+
+// protected members
+
+int CResizableSheet::GetMinWidth()
+{
+ CWnd* pWnd = NULL;
+ CRect rectWnd, rectSheet;
+ GetTotalClientRect(&rectSheet);
+
+ int max = 0, min = rectSheet.Width();
+ // search for leftmost and rightmost button margins
+ for (int i = 0; i < 7; i++)
+ {
+ pWnd = GetDlgItem(_propButtons[i]);
+ // exclude not present or hidden buttons
+ if (pWnd == NULL || !(pWnd->GetStyle() & WS_VISIBLE))
+ continue;
+
+ // left position is relative to the right border
+ // of the parent window (negative value)
+ pWnd->GetWindowRect(&rectWnd);
+ ::MapWindowPoints(NULL, m_hWnd, (LPPOINT)&rectWnd, 2);
+ int left = rectSheet.right - rectWnd.left;
+ int right = rectSheet.right - rectWnd.right;
+
+ if (left > max)
+ max = left;
+ if (right < min)
+ min = right;
+ }
+
+ // sizing border width
+ int border = GetSystemMetrics(SM_CXSIZEFRAME);
+
+ // compute total width
+ return max + min + 2*border;
+}
+
+
+// NOTE: this must be called after all the other settings
+// to have the window and its controls displayed properly
+void CResizableSheet::EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly, BOOL bWithPage)
+{
+ m_sSection = pszSection;
+ m_bSavePage = bWithPage;
+
+ m_bEnableSaveRestore = TRUE;
+ m_bRectOnly = bRectOnly;
+
+ // restore immediately
+ LoadWindowRect(pszSection, bRectOnly);
+ LoadPage();
+}
+
+// private memebers
+
+// used to save/restore active page
+// either in the registry or a private .INI file
+// depending on your application settings
+
+#define ACTIVEPAGE _T("ActivePage")
+
+void CResizableSheet::SavePage()
+{
+ if (!m_bSavePage)
+ return;
+
+ // saves active page index, zero (the first) if problems
+ // cannot use GetActivePage, because it always fails
+
+ CTabCtrl *pTab = GetTabControl();
+ int page = 0;
+
+ if (pTab != NULL)
+ page = pTab->GetCurSel();
+ if (page < 0)
+ page = 0;
+
+ AfxGetApp()->WriteProfileInt(m_sSection, ACTIVEPAGE, page);
+}
+
+void CResizableSheet::LoadPage()
+{
+ // restore active page, zero (the first) if not found
+ int page = AfxGetApp()->GetProfileInt(m_sSection, ACTIVEPAGE, 0);
+
+ if (m_bSavePage)
+ {
+ SetActivePage(page);
+ ArrangeLayout(); // needs refresh
+ }
+}
+
+void CResizableSheet::RefreshLayout()
+{
+ SendMessage(WM_SIZE);
+}
diff --git a/src/ui/ResizableLib/ResizableSheet.h b/src/ui/ResizableLib/ResizableSheet.h
new file mode 100644
index 000000000..c82a63798
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableSheet.h
@@ -0,0 +1,114 @@
+#if !defined(AFX_RESIZABLESHEET_H__INCLUDED_)
+#define AFX_RESIZABLESHEET_H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "ResizableLayout.h"
+#include "ResizableGrip.h"
+#include "ResizableMinMax.h"
+#include "ResizableState.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// ResizableSheet.h : header file
+//
+
+class CResizableSheet : public CPropertySheet, public CResizableLayout,
+ public CResizableGrip, public CResizableMinMax,
+ public CResizableState
+{
+ DECLARE_DYNAMIC(CResizableSheet)
+
+// Construction
+public:
+ CResizableSheet();
+ CResizableSheet(UINT nIDCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
+ CResizableSheet(LPCTSTR pszCaption, CWnd *pParentWnd = NULL, UINT iSelectPage = 0);
+
+// Attributes
+private:
+ // support for temporarily hiding the grip
+ DWORD m_dwGripTempState;
+
+ // flags
+ BOOL m_bEnableSaveRestore;
+ BOOL m_bRectOnly;
+ BOOL m_bSavePage;
+
+ // layout vars
+ CSize m_sizePageTL, m_sizePageBR;
+
+ // internal status
+ CString m_sSection; // section name (identifies a parent window)
+
+// Operations
+public:
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CResizableSheet)
+ public:
+ virtual BOOL OnInitDialog();
+ //}}AFX_VIRTUAL
+ protected:
+
+// Implementation
+public:
+ void RefreshLayout();
+ virtual ~CResizableSheet();
+
+// used internally
+private:
+ void PresetLayout();
+ void PrivateConstruct();
+ void SavePage();
+ void LoadPage();
+
+ BOOL IsWizard() { return (m_psh.dwFlags & PSH_WIZARD); }
+
+// callable from derived classes
+protected:
+ // section to use in app's profile
+ void EnableSaveRestore(LPCTSTR pszSection, BOOL bRectOnly = FALSE,
+ BOOL bWithPage = FALSE);
+ int GetMinWidth(); // minimum width to display all buttons
+
+
+ virtual CWnd* GetResizableWnd()
+ {
+ // make the layout know its parent window
+ return this;
+ };
+
+// Generated message map functions
+protected:
+ virtual BOOL ArrangeLayoutCallback(LayoutInfo& layout);
+ //{{AFX_MSG(CResizableSheet)
+ afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnDestroy();
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+ afx_msg BOOL OnPageChanging(NMHDR* pNotifyStruct, LRESULT* pResult);
+ DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // AFX_RESIZABLESHEET_H__INCLUDED_
diff --git a/src/ui/ResizableLib/ResizableState.cpp b/src/ui/ResizableLib/ResizableState.cpp
new file mode 100644
index 000000000..be7e05e4c
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableState.cpp
@@ -0,0 +1,111 @@
+// ResizableState.cpp: implementation of the CResizableState class.
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ResizableState.h"
+
+#ifdef _DEBUG
+#undef THIS_FILE
+static char THIS_FILE[]=__FILE__;
+#define new DEBUG_NEW
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CResizableState::CResizableState()
+{
+
+}
+
+CResizableState::~CResizableState()
+{
+
+}
+
+
+// used to save/restore window's size and position
+// either in the registry or a private .INI file
+// depending on your application settings
+
+#define PLACEMENT_ENT _T("WindowPlacement")
+#define PLACEMENT_FMT _T("%d,%d,%d,%d,%d,%d")
+
+BOOL CResizableState::SaveWindowRect(LPCTSTR pszSection, BOOL bRectOnly)
+{
+ CString data;
+ WINDOWPLACEMENT wp;
+
+ ZeroMemory(&wp, sizeof(WINDOWPLACEMENT));
+ wp.length = sizeof(WINDOWPLACEMENT);
+ if (!GetResizableWnd()->GetWindowPlacement(&wp))
+ return FALSE;
+
+ RECT& rc = wp.rcNormalPosition; // alias
+
+ if (bRectOnly) // save size/pos only (normal state)
+ {
+ // use screen coordinates
+ GetResizableWnd()->GetWindowRect(&rc);
+
+ data.Format(PLACEMENT_FMT, rc.left, rc.top,
+ rc.right, rc.bottom, SW_NORMAL, 0);
+ }
+ else // save also min/max state
+ {
+ // use workspace coordinates
+ data.Format(PLACEMENT_FMT, rc.left, rc.top,
+ rc.right, rc.bottom, wp.showCmd, wp.flags);
+ }
+
+ return AfxGetApp()->WriteProfileString(pszSection, PLACEMENT_ENT, data);
+}
+
+BOOL CResizableState::LoadWindowRect(LPCTSTR pszSection, BOOL bRectOnly)
+{
+ CString data;
+ WINDOWPLACEMENT wp;
+
+ data = AfxGetApp()->GetProfileString(pszSection, PLACEMENT_ENT);
+
+ if (data.IsEmpty()) // never saved before
+ return FALSE;
+
+ ZeroMemory(&wp, sizeof(WINDOWPLACEMENT));
+ wp.length = sizeof(WINDOWPLACEMENT);
+ if (!GetResizableWnd()->GetWindowPlacement(&wp))
+ return FALSE;
+
+ RECT& rc = wp.rcNormalPosition; // alias
+
+ if (_stscanf(data, PLACEMENT_FMT, &rc.left, &rc.top,
+ &rc.right, &rc.bottom, &wp.showCmd, &wp.flags) == 6)
+ {
+ if (bRectOnly) // restore size/pos only
+ {
+ CRect rect(rc);
+ return GetResizableWnd()->SetWindowPos(NULL, rect.left, rect.top,
+ rect.Width(), rect.Height(), SWP_NOACTIVATE | SWP_NOZORDER |
+ SWP_NOREPOSITION);
+ }
+ else // restore also min/max state
+ {
+ return GetResizableWnd()->SetWindowPlacement(&wp);
+ }
+ }
+ return FALSE;
+}
diff --git a/src/ui/ResizableLib/ResizableState.h b/src/ui/ResizableLib/ResizableState.h
new file mode 100644
index 000000000..1e5e7c35f
--- /dev/null
+++ b/src/ui/ResizableLib/ResizableState.h
@@ -0,0 +1,38 @@
+// ResizableState.h: interface for the CResizableState class.
+//
+/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (C) 2000-2002 by Paolo Messina
+// (http://www.geocities.com/ppescher - ppescher@yahoo.com)
+//
+// The contents of this file are subject to the Artistic License (the "License").
+// You may not use this file except in compliance with the License.
+// You may obtain a copy of the License at:
+// http://www.opensource.org/licenses/artistic-license.html
+//
+// If you find this code useful, credits would be nice!
+//
+/////////////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_RESIZABLESTATE_H__INCLUDED_)
+#define AFX_RESIZABLESTATE_H__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+class CResizableState
+{
+protected:
+ // non-zero if successful
+ BOOL LoadWindowRect(LPCTSTR pszSection, BOOL bRectOnly);
+ BOOL SaveWindowRect(LPCTSTR pszSection, BOOL bRectOnly);
+
+ virtual CWnd* GetResizableWnd() = 0;
+
+public:
+ CResizableState();
+ virtual ~CResizableState();
+};
+
+#endif // !defined(AFX_RESIZABLESTATE_H__INCLUDED_)
diff --git a/src/ui/ResizableLib/stdafx.cpp b/src/ui/ResizableLib/stdafx.cpp
new file mode 100644
index 000000000..c317ca142
--- /dev/null
+++ b/src/ui/ResizableLib/stdafx.cpp
@@ -0,0 +1,9 @@
+// stdafx.cpp : source file that includes just the standard includes
+// ResizableLib.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
+
diff --git a/src/ui/ResizableLib/stdafx.h b/src/ui/ResizableLib/stdafx.h
new file mode 100644
index 000000000..0619dd32c
--- /dev/null
+++ b/src/ui/ResizableLib/stdafx.h
@@ -0,0 +1,21 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+#include <afxcmn.h>
+#include <afxdlgs.h>
+
+// TODO: reference additional headers your program requires here
diff --git a/src/ui/TreePropSheet/PropPageFrame.cpp b/src/ui/TreePropSheet/PropPageFrame.cpp
new file mode 100644
index 000000000..db76d6546
--- /dev/null
+++ b/src/ui/TreePropSheet/PropPageFrame.cpp
@@ -0,0 +1,195 @@
+/********************************************************************
+*
+* Copyright (c) 2002 Sven Wiegand <mail@sven-wiegand.de>
+*
+* You can use this and modify this in any way you want,
+* BUT LEAVE THIS HEADER INTACT.
+*
+* Redistribution is appreciated.
+*
+* $Workfile:$
+* $Revision: 8 $
+* $Modtime:$
+* $Author: gabest $
+*
+* Revision History:
+* $History:$
+*
+*********************************************************************/
+
+#include "stdafx.h"
+#include "PropPageFrame.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+
+
+namespace TreePropSheet
+{
+
+
+//-------------------------------------------------------------------
+// class CPropPageFrame
+//-------------------------------------------------------------------
+
+CPropPageFrame::CPropPageFrame()
+: m_bShowCaption(FALSE),
+ m_nCaptionHeight(0),
+ m_hCaptionIcon(NULL),
+ m_dwMsgFormat(DT_CENTER|DT_VCENTER|DT_NOPREFIX|DT_SINGLELINE)
+{
+}
+
+
+CPropPageFrame::~CPropPageFrame()
+{
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// Operations
+
+
+void CPropPageFrame::ShowCaption(BOOL bEnable)
+{
+ m_bShowCaption = bEnable;
+ SafeUpdateWindow(CalcCaptionArea());
+}
+
+
+BOOL CPropPageFrame::GetShowCaption() const
+{
+ return m_bShowCaption;
+}
+
+
+void CPropPageFrame::SetCaption(LPCTSTR lpszCaption, HICON hIcon /*= NULL*/)
+{
+ m_strCaption = lpszCaption;
+ m_hCaptionIcon = hIcon;
+ SafeUpdateWindow(CalcCaptionArea());
+}
+
+
+CString CPropPageFrame::GetCaption(HICON *pIcon /* = NULL */) const
+{
+ if (pIcon)
+ *pIcon = m_hCaptionIcon;
+ return m_strCaption;
+}
+
+
+void CPropPageFrame::SetCaptionHeight(int nCaptionHeight)
+{
+ m_nCaptionHeight = nCaptionHeight;
+ SafeUpdateWindow(CalcCaptionArea());
+}
+
+
+int CPropPageFrame::GetCaptionHeight() const
+{
+ return m_nCaptionHeight;
+}
+
+
+void CPropPageFrame::SetMsgText(LPCTSTR lpszMsg)
+{
+ m_strMsg = lpszMsg;
+ SafeUpdateWindow(CalcMsgArea());
+}
+
+
+CString CPropPageFrame::GetMsgText() const
+{
+ return m_strMsg;
+}
+
+
+void CPropPageFrame::SetMsgFormat(DWORD dwFormat)
+{
+ m_dwMsgFormat = dwFormat;
+ SafeUpdateWindow(CalcMsgArea());
+}
+
+
+DWORD CPropPageFrame::GetMsgFormat() const
+{
+ return m_dwMsgFormat;
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// Overridable implementation helpers
+
+void CPropPageFrame::Draw(CDC *pDc)
+{
+ if (GetShowCaption())
+ DrawCaption(pDc, CalcCaptionArea(), m_strCaption, m_hCaptionIcon);
+ DrawMsg(pDc, CalcMsgArea(), m_strMsg, m_dwMsgFormat);
+}
+
+
+CRect CPropPageFrame::CalcMsgArea()
+{
+ ASSERT(IsWindow(GetWnd()->GetSafeHwnd()));
+
+ CRect rectMsg;
+ GetWnd()->GetClientRect(rectMsg);
+ if (GetShowCaption())
+ rectMsg.top+= GetCaptionHeight();
+
+ return rectMsg;
+}
+
+
+void CPropPageFrame::DrawMsg(CDC *pDc, CRect rect, LPCTSTR lpszMsg, DWORD dwFormat)
+{
+ CFont *pPrevFont = dynamic_cast<CFont*>(pDc->SelectStockObject(DEFAULT_GUI_FONT));
+ int nPrevBkMode = pDc->SetBkMode(TRANSPARENT);
+
+ pDc->DrawText(GetMsgText(), rect, GetMsgFormat());
+
+ pDc->SetBkMode(nPrevBkMode);
+ pDc->SelectObject(pPrevFont);
+}
+
+
+CRect CPropPageFrame::CalcCaptionArea()
+{
+ ASSERT(IsWindow(GetWnd()->GetSafeHwnd()));
+
+ CRect rectCaption;
+ GetWnd()->GetClientRect(rectCaption);
+ if (!GetShowCaption())
+ rectCaption.bottom = rectCaption.top;
+ else
+ rectCaption.bottom = rectCaption.top+GetCaptionHeight();
+
+ return rectCaption;
+}
+
+
+void CPropPageFrame::DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon)
+{
+ // should be implemented by specialized classes
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// Implementation helpers
+
+void CPropPageFrame::SafeUpdateWindow(LPCRECT lpRect /* = NULL */)
+{
+ if (!IsWindow(GetWnd()->GetSafeHwnd()))
+ return;
+
+ GetWnd()->InvalidateRect(lpRect, TRUE);
+}
+
+
+
+} //namespace TreePropSheet
diff --git a/src/ui/TreePropSheet/PropPageFrame.h b/src/ui/TreePropSheet/PropPageFrame.h
new file mode 100644
index 000000000..9c8c63f5d
--- /dev/null
+++ b/src/ui/TreePropSheet/PropPageFrame.h
@@ -0,0 +1,306 @@
+/********************************************************************
+*
+* Copyright (c) 2002 Sven Wiegand <mail@sven-wiegand.de>
+*
+* You can use this and modify this in any way you want,
+* BUT LEAVE THIS HEADER INTACT.
+*
+* Redistribution is appreciated.
+*
+* $Workfile:$
+* $Revision: 126 $
+* $Modtime:$
+* $Author: gabest $
+*
+* Revision History:
+* $History:$
+*
+*********************************************************************/
+
+
+#if !defined(AFX_PROPPAGEFRAME_H__B968548B_F0B4_4C35_85DD_C44242A9D368__INCLUDED_)
+#define AFX_PROPPAGEFRAME_H__B968548B_F0B4_4C35_85DD_C44242A9D368__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+
+namespace TreePropSheet
+{
+
+
+/**
+An object of an CPropertyPageFrame-derived class is used by
+CTreePropSheet to display a frame for the property pages.
+
+Derived classes have to implement at least the Create() and the
+GetWnd() method, which
+returns a pointer to the CWnd-obect of the window, that has been
+created by the call to the Create() method. An implementation can
+provide the CWnd-object by using it as a property or by deriving
+from CWnd or a more specialiced class. This way has been choosen
+instead of deriving CPropPageFrame from CWnd, to allow derived class
+to derive from more specialized classes than CWnd
+(i.e. CStatic, etc.). From the WM_PAINT-handler of your derived class
+you have to call the Draw()-method.
+
+Most implementations will also implement the DrawCaption() and
+DrawMsg() methods, to provide custom drawing functionality.
+
+@author Sven Wiegand
+*/
+class /*AFX_EXT_CLASS*/ CPropPageFrame
+{
+// Construction/Destruction
+public:
+ CPropPageFrame();
+ virtual ~CPropPageFrame();
+
+// Operations
+public:
+ /**
+ Has to create a window with the specified properties.
+
+ @param dwWindowStyle
+ Standard window styles, to apply to the window to create.
+ @param rect
+ Position and size of the window to create.
+ @param pwndParent
+ Parent window. (Never be NULL).
+ @param nID
+ Window id.
+
+ @return
+ TRUE on success, FALSE otherwise.
+ */
+ virtual BOOL Create(DWORD dwWindowStyle, const RECT &rect, CWnd *pwndParent, UINT nID) = 0;
+
+ /**
+ Returns a pointer to the window object, that represents the frame.
+ */
+ virtual CWnd* GetWnd() = 0;
+
+ /**
+ Enables or disables page caption.
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the caption rectangle, to force it to be redrawn.
+ */
+ virtual void ShowCaption(BOOL bEnable);
+
+ /**
+ Returns TRUE if captions are enabled, FALSE otherwise.
+ */
+ BOOL GetShowCaption() const;
+
+ /**
+ Sets the height of the caption in pixels. This value is ignored
+ until the caption is enabled by ShowCaption(TRUE).
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the caption rectangle, to force it to be redrawn.
+ */
+ virtual void SetCaptionHeight(int nCaptionHeight);
+
+ /**
+ Returns the caption height, that has been most recently set by a
+ call to the SetCaptionHeight() method.
+ */
+ int GetCaptionHeight() const;
+
+ /**
+ Sets caption text an icon.
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the caption rectangle, to force it to be redrawn.
+
+ @param lpszCaption
+ Text to display for the caption.
+ @param hIcon
+ Icon to display for the caption.
+ */
+ virtual void SetCaption(LPCTSTR lpszCaption, HICON hIcon = NULL);
+
+ /**
+ Returns the caption, that has been set most recently using the
+ SetCaption() method.
+
+ @param pIcon
+ Pointer to a HICON variable, that should receive the handle of
+ the currently set icon or NULL, if there is no icon or a NULL
+ pointer, if the caller is not interested in the icon.
+
+ @return
+ The text that has been set most recently using the SetCaption()
+ method.
+ */
+ CString GetCaption(HICON *pIcon = NULL) const;
+
+ /**
+ Sets the text to display.
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the message rectangle, to force it to be redrawn.
+ */
+ virtual void SetMsgText(LPCTSTR lpszMsg);
+
+ /**
+ Returns the text currently displayed.
+ */
+ CString GetMsgText() const;
+
+ /**
+ Specifies the format to draw the text with, set by SetMsgText().
+
+ This default implementation calls the SafeUpdateWindow() method
+ with the message rectangle, to force it to be redrawn.
+
+ @param dwFormat
+ Combination of the DT_* flags, specified by the Win32 function
+ DrawText().
+ */
+ virtual void SetMsgFormat(DWORD dwFormat);
+
+ /**
+ Returns the format to draw the text with, set by SetMsgText().
+
+ @see SetMsgFormat()
+ */
+ DWORD GetMsgFormat() const;
+
+// Overridable implementation helpers
+protected:
+ /**
+ Draws the whole frame including caption (if enabled) and message.
+
+ This method calculates the rectangles for the message area and
+ the caption area using the CalcMsgArea() and the CalcCaptionArea()
+ methods, draws then the caption calling the DrawCaption() method
+ (only if caption is enabled) and afterwards the message calling
+ the DrawMsg() method.
+
+ You should call this method from the WM_PAINT-handler of your
+ derived class.
+
+ @param pDc
+ Device context to draw in.
+ */
+ virtual void Draw(CDC *pDc);
+
+ /**
+ Calculates the area, the message, set by SetMsgText() should be
+ displayed in. The returned rectangle (client coordinates) will be
+ passed to DrawMsg().
+
+ This default implementation calls the CalcCaptionArea() method,
+ substracts the returned rectangle from the client area and returns
+ the result.
+ */
+ virtual CRect CalcMsgArea();
+
+ /**
+ Draws the message with the specified format.
+
+ This default implementation draws the given msg using the specified
+ properties.
+
+ @param pDc
+ Device context to draw in.
+ @param rect
+ Rectangle to draw the message in.
+ @param lpszMsg
+ Message to draw.
+ @param dwFormat.
+ Combination of the DT_* flags, specified by the Win32 function
+ DrawText() to draw the message with.
+ */
+ virtual void DrawMsg(CDC *pDc, CRect rect, LPCTSTR lpszMsg, DWORD dwFormat);
+
+ /**
+ Calculates the caption area. The caption area is the rectangular
+ range, the current page's caption should be drawn in.
+
+ The caption can be enabled or disabled using the ShowCaption()
+ method. This method should return an empty rect, if the caption
+ is disabled. If the caption is enabled the height of the rect
+ should be as large, as specified by the latest call to the
+ SetCaptionHeight() method.
+
+ The rectangle, returned by this method will be passed to the
+ DrawCaption() method to draw the caption.
+
+ If the caption is enabled currently, this default implementation
+ returns a rectangle, that has the width of the client area and
+ the height, specified by the latest call to SetCaptionHeight(),
+ starting and y-position 0. If the caption is disabled at the
+ moment, this method returns an empty rectangle with the width of
+ the client area.
+ */
+ virtual CRect CalcCaptionArea();
+
+ /**
+ Draws the caption.
+
+ This default implementation draws nothing.
+
+ @param pDc
+ Device context to draw in.
+ @param rect
+ Rectangle to draw the caption in.
+ @param lpszCaption
+ Text to display in the caption.
+ @param hIcon
+ Icon to display in the caption.
+ */
+ virtual void DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon);
+
+// Implementation helpers
+protected:
+ /**
+ If the m_hWnd property of the CWnd-object returend by GetWnd()
+ specifies a valid window, this method will invalidate the specified
+ rectangle, to schedule it for repaint, otherwise the method will
+ return without doing anything.
+
+ @param lpRect
+ Pointer to the rectangular area, that should be marked for
+ repainting or NULL, if the whole client area should be marked
+ for repainting.
+ */
+ void SafeUpdateWindow(LPCRECT lpRect = NULL);
+
+// Properties
+private:
+ /** TRUE if the caption should be drawn, FALSE otherwise. */
+ BOOL m_bShowCaption;
+
+ /** Height of the caption in pixels, if it is enabled. */
+ int m_nCaptionHeight;
+
+ /** Text to display in the caption. */
+ CString m_strCaption;
+
+ /**
+ Icon to display in the caption or NULL if no icon should be
+ displayed.
+ */
+ HICON m_hCaptionIcon;
+
+ /** Message text to display. */
+ CString m_strMsg;
+
+ /** Style to use when drawing the message text m_strMsg. */
+ DWORD m_dwMsgFormat;
+};
+
+
+} //namespace TreePropSheet
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.
+
+#endif // AFX_PROPPAGEFRAME_H__B968548B_F0B4_4C35_85DD_C44242A9D368__INCLUDED_
diff --git a/src/ui/TreePropSheet/PropPageFrameDefault.cpp b/src/ui/TreePropSheet/PropPageFrameDefault.cpp
new file mode 100644
index 000000000..ce0b59130
--- /dev/null
+++ b/src/ui/TreePropSheet/PropPageFrameDefault.cpp
@@ -0,0 +1,399 @@
+/********************************************************************
+*
+* Copyright (c) 2002 Sven Wiegand <mail@sven-wiegand.de>
+*
+* You can use this and modify this in any way you want,
+* BUT LEAVE THIS HEADER INTACT.
+*
+* Redistribution is appreciated.
+*
+* $Workfile:$
+* $Revision: 8 $
+* $Modtime:$
+* $Author: gabest $
+*
+* Revision History:
+* $History:$
+*
+*********************************************************************/
+
+#include "stdafx.h"
+#include "PropPageFrameDefault.h"
+
+
+namespace TreePropSheet
+{
+
+
+//uncomment the following line, if you don't have installed the
+//new platform SDK
+#define XPSUPPORT
+
+#ifdef XPSUPPORT
+#include <uxtheme.h>
+#include <tmschema.h>
+#endif
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+//-------------------------------------------------------------------
+// class CThemeLib
+//-------------------------------------------------------------------
+
+#define THEMEAPITYPE(f) typedef HRESULT (__stdcall *_##f)
+#define THEMEAPITYPE_(t, f) typedef t (__stdcall *_##f)
+#define THEMEAPIPTR(f) _##f m_p##f
+
+#ifdef XPSUPPORT
+ #define THEMECALL(f) return (*m_p##f)
+ #define GETTHEMECALL(f) m_p##f = (_##f)GetProcAddress(m_hThemeLib, #f)
+#else
+ void ThemeDummy(...) {ASSERT(FALSE);}
+ #define HTHEME void*
+ #define TABP_PANE 0
+ #define THEMECALL(f) return 0; ThemeDummy
+ #define GETTHEMECALL(f) m_p##f = NULL
+#endif
+
+
+/**
+Helper class for loading the uxtheme DLL and providing their
+functions.
+
+One global object of this class exists.
+
+@author Sven Wiegand
+*/
+class CThemeLib
+{
+// construction/destruction
+public:
+ CThemeLib();
+ ~CThemeLib();
+
+// operations
+public:
+ /**
+ Returns TRUE if the call wrappers are available, FALSE otherwise.
+ */
+ BOOL IsAvailable() const;
+
+// call wrappers
+public:
+ BOOL IsThemeActive()
+ {THEMECALL(IsThemeActive)();}
+
+ HTHEME OpenThemeData(HWND hwnd, LPCWSTR pszClassList)
+ {THEMECALL(OpenThemeData)(hwnd, pszClassList);}
+
+ HRESULT CloseThemeData(HTHEME hTheme)
+ {THEMECALL(CloseThemeData)(hTheme);}
+
+ HRESULT GetThemeBackgroundContentRect(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, OUT RECT *pContentRect)
+ {THEMECALL(GetThemeBackgroundContentRect)(hTheme, hdc, iPartId, iStateId, pBoundingRect, pContentRect);}
+
+ HRESULT DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect)
+ {THEMECALL(DrawThemeBackground)(hTheme, hdc, iPartId, iStateId, pRect, pClipRect);}
+
+// function pointers
+private:
+#ifdef XPSUPPORT
+ THEMEAPITYPE_(BOOL, IsThemeActive)();
+ THEMEAPIPTR(IsThemeActive);
+
+ THEMEAPITYPE_(HTHEME, OpenThemeData)(HWND hwnd, LPCWSTR pszClassList);
+ THEMEAPIPTR(OpenThemeData);
+
+ THEMEAPITYPE(CloseThemeData)(HTHEME hTheme);
+ THEMEAPIPTR(CloseThemeData);
+
+ THEMEAPITYPE(GetThemeBackgroundContentRect)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, OUT RECT *pContentRect);
+ THEMEAPIPTR(GetThemeBackgroundContentRect);
+
+ THEMEAPITYPE(DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect);
+ THEMEAPIPTR(DrawThemeBackground);
+#endif
+
+// properties
+private:
+ /** instance handle to the library or NULL. */
+ HINSTANCE m_hThemeLib;
+};
+
+/**
+One and only instance of CThemeLib.
+*/
+static CThemeLib g_ThemeLib;
+
+
+CThemeLib::CThemeLib()
+: m_hThemeLib(NULL)
+{
+#ifdef XPSUPPORT
+ m_hThemeLib = LoadLibrary(_T("uxtheme.dll"));
+ if (!m_hThemeLib)
+ return;
+
+ GETTHEMECALL(IsThemeActive);
+ GETTHEMECALL(OpenThemeData);
+ GETTHEMECALL(CloseThemeData);
+ GETTHEMECALL(GetThemeBackgroundContentRect);
+ GETTHEMECALL(DrawThemeBackground);
+#endif
+}
+
+
+CThemeLib::~CThemeLib()
+{
+ if (m_hThemeLib)
+ FreeLibrary(m_hThemeLib);
+}
+
+
+BOOL CThemeLib::IsAvailable() const
+{
+ return m_hThemeLib!=NULL;
+}
+
+
+//-------------------------------------------------------------------
+// class CPropPageFrameDefault
+//-------------------------------------------------------------------
+
+BEGIN_MESSAGE_MAP(CPropPageFrameDefault, CWnd)
+ //{{AFX_MSG_MAP(CPropPageFrameDefault)
+ ON_WM_PAINT()
+ ON_WM_ERASEBKGND()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+
+CPropPageFrameDefault::CPropPageFrameDefault()
+{
+}
+
+
+CPropPageFrameDefault::~CPropPageFrameDefault()
+{
+ if (m_Images.GetSafeHandle())
+ m_Images.DeleteImageList();
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// Overridings
+
+BOOL CPropPageFrameDefault::Create(DWORD dwWindowStyle, const RECT &rect, CWnd *pwndParent, UINT nID)
+{
+ return CWnd::Create(
+ AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW, AfxGetApp()->LoadStandardCursor(IDC_ARROW), GetSysColorBrush(COLOR_3DFACE)),
+ _T("Page Frame"),
+ dwWindowStyle, rect, pwndParent, nID);
+}
+
+CWnd* CPropPageFrameDefault::GetWnd()
+{
+ return static_cast<CWnd*>(this);
+}
+
+void CPropPageFrameDefault::SetCaption(LPCTSTR lpszCaption, HICON hIcon /*= NULL*/)
+{
+ CPropPageFrame::SetCaption(lpszCaption, hIcon);
+
+ // build image list
+ if (m_Images.GetSafeHandle())
+ m_Images.DeleteImageList();
+ if (hIcon)
+ {
+ ICONINFO ii;
+ if (!GetIconInfo(hIcon, &ii))
+ return;
+
+ CBitmap bmMask;
+ bmMask.Attach(ii.hbmMask);
+ if (ii.hbmColor) DeleteObject(ii.hbmColor);
+
+ BITMAP bm;
+ bmMask.GetBitmap(&bm);
+
+ if (!m_Images.Create(bm.bmWidth, bm.bmHeight, ILC_COLOR32|ILC_MASK, 0, 1))
+ return;
+
+ if (m_Images.Add(hIcon) == -1)
+ m_Images.DeleteImageList();
+ }
+}
+
+CRect CPropPageFrameDefault::CalcMsgArea()
+{
+ CRect rect;
+ GetClientRect(rect);
+ if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
+ {
+ HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
+ if (hTheme)
+ {
+ CRect rectContent;
+ CDC *pDc = GetDC();
+ g_ThemeLib.GetThemeBackgroundContentRect(hTheme, pDc->m_hDC, TABP_PANE, 0, rect, rectContent);
+ ReleaseDC(pDc);
+ g_ThemeLib.CloseThemeData(hTheme);
+
+ if (GetShowCaption())
+ rectContent.top = rect.top+GetCaptionHeight()+1;
+ rect = rectContent;
+ }
+ }
+ else if (GetShowCaption())
+ rect.top+= GetCaptionHeight()+1;
+
+ return rect;
+}
+
+
+CRect CPropPageFrameDefault::CalcCaptionArea()
+{
+ CRect rect;
+ GetClientRect(rect);
+ if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
+ {
+ HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
+ if (hTheme)
+ {
+ CRect rectContent;
+ CDC *pDc = GetDC();
+ g_ThemeLib.GetThemeBackgroundContentRect(hTheme, pDc->m_hDC, TABP_PANE, 0, rect, rectContent);
+ ReleaseDC(pDc);
+ g_ThemeLib.CloseThemeData(hTheme);
+
+ if (GetShowCaption())
+ rectContent.bottom = rect.top+GetCaptionHeight();
+ else
+ rectContent.bottom = rectContent.top;
+
+ rect = rectContent;
+ }
+ }
+ else
+ {
+ if (GetShowCaption())
+ rect.bottom = rect.top+GetCaptionHeight();
+ else
+ rect.bottom = rect.top;
+ }
+
+ return rect;
+}
+
+void CPropPageFrameDefault::DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon)
+{
+ COLORREF clrLeft = GetSysColor(COLOR_INACTIVECAPTION);
+ COLORREF clrRight = pDc->GetPixel(rect.right-1, rect.top);
+ FillGradientRectH(pDc, rect, clrLeft, clrRight);
+
+ // draw icon
+ if (hIcon && m_Images.GetSafeHandle() && m_Images.GetImageCount() == 1)
+ {
+ IMAGEINFO ii;
+ m_Images.GetImageInfo(0, &ii);
+ CPoint pt(3, rect.CenterPoint().y - (ii.rcImage.bottom-ii.rcImage.top)/2);
+ m_Images.Draw(pDc, 0, pt, ILD_TRANSPARENT);
+ rect.left+= (ii.rcImage.right-ii.rcImage.left) + 3;
+ }
+
+ // draw text
+ rect.left+= 2;
+
+ COLORREF clrPrev = pDc->SetTextColor(GetSysColor(COLOR_CAPTIONTEXT));
+ int nBkStyle = pDc->SetBkMode(TRANSPARENT);
+ CFont *pFont = (CFont*)pDc->SelectStockObject(SYSTEM_FONT);
+
+ CFont* pSysFont = pDc->GetCurrentFont();
+ LOGFONT lf;
+ pSysFont->GetLogFont(&lf);
+ lf.lfHeight = rect.Height();
+ lf.lfWidth = 0;
+ _tcscpy(lf.lfFaceName, _T("Arial"));
+ CFont f;
+ f.CreateFontIndirect(&lf);
+ pDc->SelectObject(&f);
+
+ pDc->DrawText(lpszCaption, rect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
+
+ pDc->SetTextColor(clrPrev);
+ pDc->SetBkMode(nBkStyle);
+ pDc->SelectObject(pFont);
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// Implementation helpers
+
+void CPropPageFrameDefault::FillGradientRectH(CDC *pDc, const RECT &rect, COLORREF clrLeft, COLORREF clrRight)
+{
+ // pre calculation
+ int nSteps = rect.right-rect.left;
+ int nRRange = GetRValue(clrRight)-GetRValue(clrLeft);
+ int nGRange = GetGValue(clrRight)-GetGValue(clrLeft);
+ int nBRange = GetBValue(clrRight)-GetBValue(clrLeft);
+
+ double dRStep = (double)nRRange/(double)nSteps;
+ double dGStep = (double)nGRange/(double)nSteps;
+ double dBStep = (double)nBRange/(double)nSteps;
+
+ double dR = (double)GetRValue(clrLeft);
+ double dG = (double)GetGValue(clrLeft);
+ double dB = (double)GetBValue(clrLeft);
+
+ CPen *pPrevPen = NULL;
+ for (int x = rect.left; x <= rect.right; ++x)
+ {
+ CPen Pen(PS_SOLID, 1, RGB((BYTE)dR, (BYTE)dG, (BYTE)dB));
+ pPrevPen = pDc->SelectObject(&Pen);
+ pDc->MoveTo(x, rect.top);
+ pDc->LineTo(x, rect.bottom);
+ pDc->SelectObject(pPrevPen);
+
+ dR+= dRStep;
+ dG+= dGStep;
+ dB+= dBStep;
+ }
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// message handlers
+
+void CPropPageFrameDefault::OnPaint()
+{
+ CPaintDC dc(this);
+ Draw(&dc);
+}
+
+
+BOOL CPropPageFrameDefault::OnEraseBkgnd(CDC* pDC)
+{
+ if (g_ThemeLib.IsAvailable() && g_ThemeLib.IsThemeActive())
+ {
+ HTHEME hTheme = g_ThemeLib.OpenThemeData(m_hWnd, L"Tab");
+ if (hTheme)
+ {
+ CRect rect;
+ GetClientRect(rect);
+ g_ThemeLib.DrawThemeBackground(hTheme, pDC->m_hDC, TABP_PANE, 0, rect, NULL);
+
+ g_ThemeLib.CloseThemeData(hTheme);
+ }
+ return TRUE;
+ }
+ else
+ {
+ return CWnd::OnEraseBkgnd(pDC);
+ }
+}
+
+} //namespace TreePropSheet
diff --git a/src/ui/TreePropSheet/PropPageFrameDefault.h b/src/ui/TreePropSheet/PropPageFrameDefault.h
new file mode 100644
index 000000000..0e0523151
--- /dev/null
+++ b/src/ui/TreePropSheet/PropPageFrameDefault.h
@@ -0,0 +1,119 @@
+/********************************************************************
+*
+* Copyright (c) 2002 Sven Wiegand <mail@sven-wiegand.de>
+*
+* You can use this and modify this in any way you want,
+* BUT LEAVE THIS HEADER INTACT.
+*
+* Redistribution is appreciated.
+*
+* $Workfile:$
+* $Revision: 126 $
+* $Modtime:$
+* $Author: gabest $
+*
+* Revision History:
+* $History:$
+*
+*********************************************************************/
+
+
+#if !defined(AFX_PROPPAGEFRAMEDEFAULT_H__5C5B7AC9_2DF5_4E8C_8F5E_DE2CC04BBED7__INCLUDED_)
+#define AFX_PROPPAGEFRAMEDEFAULT_H__5C5B7AC9_2DF5_4E8C_8F5E_DE2CC04BBED7__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "PropPageFrame.h"
+#include <afxcmn.h>
+
+
+namespace TreePropSheet
+{
+
+
+/**
+An implementation of CPropPageFrame, that works well for Windows XP
+styled systems and older windows versions (without themes).
+
+@author Sven Wiegand
+*/
+class /*AFX_EXT_CLASS*/ CPropPageFrameDefault : public CWnd,
+ public CPropPageFrame
+{
+// construction/destruction
+public:
+ CPropPageFrameDefault();
+ virtual ~CPropPageFrameDefault();
+
+// operations
+public:
+
+// overridings
+public:
+ virtual BOOL Create(DWORD dwWindowStyle, const RECT &rect, CWnd *pwndParent, UINT nID);
+ virtual CWnd* GetWnd();
+ virtual void SetCaption(LPCTSTR lpszCaption, HICON hIcon = NULL);
+
+
+protected:
+ virtual CRect CalcMsgArea();
+ virtual CRect CalcCaptionArea();
+ virtual void DrawCaption(CDC *pDc, CRect rect, LPCTSTR lpszCaption, HICON hIcon);
+
+// Implementation helpers
+protected:
+ /**
+ Fills a rectangular area with a gradient color starting at the left
+ side with the color clrLeft and ending at the right sight with the
+ color clrRight.
+
+ @param pDc
+ Device context to draw the rectangle in.
+ @param rect
+ Rectangular area to fill.
+ @param clrLeft
+ Color on the left side.
+ @param clrRight
+ Color on the right side.
+ */
+ void FillGradientRectH(CDC *pDc, const RECT &rect, COLORREF clrLeft, COLORREF clrRight);
+
+ /**
+ Returns TRUE if Windows XP theme support is available, FALSE
+ otherwise.
+ */
+ BOOL ThemeSupport() const;
+
+protected:
+ //{{AFX_VIRTUAL(CPropPageFrameDefault)
+ //}}AFX_VIRTUAL
+
+// message handlers
+protected:
+ //{{AFX_MSG(CPropPageFrameDefault)
+ afx_msg void OnPaint();
+ afx_msg BOOL OnEraseBkgnd(CDC* pDC);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+
+// attributes
+protected:
+ /**
+ Image list that contains only the current icon or nothing if there
+ is no icon.
+ */
+ CImageList m_Images;
+};
+
+
+} //namespace TreePropSheet
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.
+
+#endif // AFX_PROPPAGEFRAMEDEFAULT_H__5C5B7AC9_2DF5_4E8C_8F5E_DE2CC04BBED7__INCLUDED_
diff --git a/src/ui/TreePropSheet/TreePropSheet.cpp b/src/ui/TreePropSheet/TreePropSheet.cpp
new file mode 100644
index 000000000..9c5c9f8ec
--- /dev/null
+++ b/src/ui/TreePropSheet/TreePropSheet.cpp
@@ -0,0 +1,989 @@
+/********************************************************************
+*
+* Copyright (c) 2002 Sven Wiegand <mail@sven-wiegand.de>
+*
+* You can use this and modify this in any way you want,
+* BUT LEAVE THIS HEADER INTACT.
+*
+* Redistribution is appreciated.
+*
+* $Workfile:$
+* $Revision: 126 $
+* $Modtime:$
+* $Author: gabest $
+*
+* Revision History:
+* $History:$
+*
+*********************************************************************/
+
+
+#include "stdafx.h"
+#include "TreePropSheet.h"
+#include "PropPageFrameDefault.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+
+
+namespace TreePropSheet
+{
+
+//-------------------------------------------------------------------
+// class CTreePropSheet
+//-------------------------------------------------------------------
+
+BEGIN_MESSAGE_MAP(CTreePropSheet, CPropertySheet)
+ //{{AFX_MSG_MAP(CTreePropSheet)
+ ON_WM_DESTROY()
+ //}}AFX_MSG_MAP
+ ON_MESSAGE(PSM_ADDPAGE, OnAddPage)
+ ON_MESSAGE(PSM_REMOVEPAGE, OnRemovePage)
+ ON_MESSAGE(PSM_SETCURSEL, OnSetCurSel)
+ ON_MESSAGE(PSM_SETCURSELID, OnSetCurSelId)
+ ON_MESSAGE(PSM_ISDIALOGMESSAGE, OnIsDialogMessage)
+
+ ON_NOTIFY(TVN_SELCHANGINGA, s_unPageTreeId, OnPageTreeSelChanging)
+ ON_NOTIFY(TVN_SELCHANGINGW, s_unPageTreeId, OnPageTreeSelChanging)
+ ON_NOTIFY(TVN_SELCHANGEDA, s_unPageTreeId, OnPageTreeSelChanged)
+ ON_NOTIFY(TVN_SELCHANGEDW, s_unPageTreeId, OnPageTreeSelChanged)
+END_MESSAGE_MAP()
+
+IMPLEMENT_DYNAMIC(CTreePropSheet, CPropertySheet)
+
+const UINT CTreePropSheet::s_unPageTreeId = 0x7EEE;
+
+CTreePropSheet::CTreePropSheet()
+: m_bPageTreeSelChangedActive(FALSE),
+ m_bTreeViewMode(TRUE),
+ m_bPageCaption(FALSE),
+ m_bTreeImages(FALSE),
+ m_nPageTreeWidth(150),
+ m_pwndPageTree(NULL),
+ m_pFrame(NULL)
+{}
+
+
+CTreePropSheet::CTreePropSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
+: CPropertySheet(nIDCaption, pParentWnd, iSelectPage),
+ m_bPageTreeSelChangedActive(FALSE),
+ m_bTreeViewMode(TRUE),
+ m_bPageCaption(FALSE),
+ m_bTreeImages(FALSE),
+ m_nPageTreeWidth(150),
+ m_pwndPageTree(NULL),
+ m_pFrame(NULL)
+{
+}
+
+
+CTreePropSheet::CTreePropSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
+: CPropertySheet(pszCaption, pParentWnd, iSelectPage),
+ m_bPageTreeSelChangedActive(FALSE),
+ m_bTreeViewMode(TRUE),
+ m_bPageCaption(FALSE),
+ m_bTreeImages(FALSE),
+ m_nPageTreeWidth(150),
+ m_pwndPageTree(NULL),
+ m_pFrame(NULL)
+{
+}
+
+
+CTreePropSheet::~CTreePropSheet()
+{
+ if(m_Images.GetSafeHandle()) m_Images.DeleteImageList();
+ delete m_pwndPageTree, m_pwndPageTree = NULL;
+ delete m_pFrame, m_pFrame = NULL;
+}
+
+/////////////////////////////////////////////////////////////////////
+// Operationen
+
+BOOL CTreePropSheet::SetTreeViewMode(BOOL bTreeViewMode /* = TRUE */, BOOL bPageCaption /* = FALSE */, BOOL bTreeImages /* = FALSE */)
+{
+ if (IsWindow(m_hWnd))
+ {
+ // needs to becalled, before the window has been created
+ ASSERT(FALSE);
+ return FALSE;
+ }
+
+ m_bTreeViewMode = bTreeViewMode;
+ if (m_bTreeViewMode)
+ {
+ m_bPageCaption = bPageCaption;
+ m_bTreeImages = bTreeImages;
+ }
+
+ return TRUE;
+}
+
+
+BOOL CTreePropSheet::SetTreeWidth(int nWidth)
+{
+ if (IsWindow(m_hWnd))
+ {
+ // needs to be called, before the window is created.
+ ASSERT(FALSE);
+ return FALSE;
+ }
+
+ m_nPageTreeWidth = nWidth;
+
+ return TRUE;
+}
+
+
+void CTreePropSheet::SetEmptyPageText(LPCTSTR lpszEmptyPageText)
+{
+ m_strEmptyPageMessage = lpszEmptyPageText;
+}
+
+
+DWORD CTreePropSheet::SetEmptyPageTextFormat(DWORD dwFormat)
+{
+ DWORD dwPrevFormat = m_pFrame->GetMsgFormat();
+ m_pFrame->SetMsgFormat(dwFormat);
+ return dwPrevFormat;
+}
+
+
+BOOL CTreePropSheet::SetTreeDefaultImages(CImageList *pImages)
+{
+ if (pImages->GetImageCount() != 2)
+ {
+ ASSERT(FALSE);
+ return FALSE;
+ }
+
+ if (m_DefaultImages.GetSafeHandle())
+ m_DefaultImages.DeleteImageList();
+ m_DefaultImages.Create(pImages);
+
+ // update, if necessary
+ if (IsWindow(m_hWnd))
+ RefillPageTree();
+
+ return TRUE;
+}
+
+
+BOOL CTreePropSheet::SetTreeDefaultImages(UINT unBitmapID, int cx, COLORREF crMask)
+{
+ if (m_DefaultImages.GetSafeHandle())
+ m_DefaultImages.DeleteImageList();
+ if (!m_DefaultImages.Create(unBitmapID, cx, 0, crMask))
+ return FALSE;
+
+ if (m_DefaultImages.GetImageCount() != 2)
+ {
+ m_DefaultImages.DeleteImageList();
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+CTreeCtrl* CTreePropSheet::GetPageTreeControl()
+{
+ return m_pwndPageTree;
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// public helpers
+
+BOOL CTreePropSheet::SetPageIcon(CPropertyPage *pPage, HICON hIcon)
+{
+ pPage->m_psp.dwFlags|= PSP_USEHICON;
+ pPage->m_psp.hIcon = hIcon;
+ return TRUE;
+}
+
+
+BOOL CTreePropSheet::SetPageIcon(CPropertyPage *pPage, UINT unIconId)
+{
+ HICON hIcon = AfxGetApp()->LoadIcon(unIconId);
+ if (!hIcon)
+ return FALSE;
+
+ return SetPageIcon(pPage, hIcon);
+}
+
+
+BOOL CTreePropSheet::SetPageIcon(CPropertyPage *pPage, CImageList &Images, int nImage)
+{
+ HICON hIcon = Images.ExtractIcon(nImage);
+ if (!hIcon)
+ return FALSE;
+
+ return SetPageIcon(pPage, hIcon);
+}
+
+
+BOOL CTreePropSheet::DestroyPageIcon(CPropertyPage *pPage)
+{
+ if (!pPage || !(pPage->m_psp.dwFlags&PSP_USEHICON) || !pPage->m_psp.hIcon)
+ return FALSE;
+
+ DestroyIcon(pPage->m_psp.hIcon);
+ pPage->m_psp.dwFlags&= ~PSP_USEHICON;
+ pPage->m_psp.hIcon = NULL;
+
+ return TRUE;
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// Overridable implementation helpers
+
+CString CTreePropSheet::GenerateEmptyPageMessage(LPCTSTR lpszEmptyPageMessage, LPCTSTR lpszCaption)
+{
+ CString strMsg;
+ strMsg.Format(lpszEmptyPageMessage, lpszCaption);
+ return strMsg;
+}
+
+
+CTreeCtrl* CTreePropSheet::CreatePageTreeObject()
+{
+ return new CTreeCtrl;
+}
+
+
+CPropPageFrame* CTreePropSheet::CreatePageFrame()
+{
+ return new CPropPageFrameDefault;
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// Implementation helpers
+
+void CTreePropSheet::MoveChildWindows(int nDx, int nDy)
+{
+ CWnd *pWnd = GetWindow(GW_CHILD);
+ while (pWnd)
+ {
+ CRect rect;
+ pWnd->GetWindowRect(rect);
+ rect.OffsetRect(nDx, nDy);
+ ScreenToClient(rect);
+ pWnd->MoveWindow(rect);
+
+ pWnd = pWnd->GetNextWindow();
+ }
+}
+
+
+void CTreePropSheet::RefillPageTree()
+{
+ if (!IsWindow(m_hWnd))
+ return;
+
+ m_pwndPageTree->DeleteAllItems();
+
+ CTabCtrl *pTabCtrl = GetTabControl();
+ if (!IsWindow(pTabCtrl->GetSafeHwnd()))
+ {
+ ASSERT(FALSE);
+ return;
+ }
+
+ const int nPageCount = pTabCtrl->GetItemCount();
+
+ // rebuild image list
+ if (m_bTreeImages)
+ {
+ for (int i = m_Images.GetImageCount()-1; i >= 0; --i)
+ m_Images.Remove(i);
+
+ // add page images
+ CImageList *pPageImages = pTabCtrl->GetImageList();
+ if (pPageImages)
+ {
+ for (int nImage = 0; nImage < pPageImages->GetImageCount(); ++nImage)
+ {
+ HICON hIcon = pPageImages->ExtractIcon(nImage);
+ m_Images.Add(hIcon);
+ DestroyIcon(hIcon);
+ }
+ }
+
+ // add default images
+ if (m_DefaultImages.GetSafeHandle())
+ {
+ HICON hIcon;
+
+ // add default images
+ hIcon = m_DefaultImages.ExtractIcon(0);
+ if (hIcon)
+ {
+ m_Images.Add(hIcon);
+ DestroyIcon(hIcon);
+ }
+ hIcon = m_DefaultImages.ExtractIcon(1);
+ {
+ m_Images.Add(hIcon);
+ DestroyIcon(hIcon);
+ }
+ }
+ }
+
+ // insert tree items
+ for (int nPage = 0; nPage < nPageCount; ++nPage)
+ {
+ // Get title and image of the page
+ CString strPagePath;
+
+ TCITEM ti;
+ ZeroMemory(&ti, sizeof(ti));
+ ti.mask = TCIF_TEXT|TCIF_IMAGE;
+ ti.cchTextMax = MAX_PATH;
+ ti.pszText = strPagePath.GetBuffer(ti.cchTextMax);
+ ASSERT(ti.pszText);
+ if (!ti.pszText)
+ return;
+
+ pTabCtrl->GetItem(nPage, &ti);
+ strPagePath.ReleaseBuffer();
+
+ // Create an item in the tree for the page
+ HTREEITEM hItem = CreatePageTreeItem(ti.pszText);
+ ASSERT(hItem);
+ if (hItem)
+ {
+ m_pwndPageTree->SetItemData(hItem, nPage);
+
+ // set image
+ if (m_bTreeImages)
+ {
+ int nImage = ti.iImage;
+ if (nImage < 0 || nImage >= m_Images.GetImageCount())
+ nImage = m_DefaultImages.GetSafeHandle()? m_Images.GetImageCount()-1 : -1;
+
+ m_pwndPageTree->SetItemImage(hItem, nImage, nImage);
+ }
+ }
+ }
+}
+
+
+HTREEITEM CTreePropSheet::CreatePageTreeItem(LPCTSTR lpszPath, HTREEITEM hParent /* = TVI_ROOT */)
+{
+ CString strPath(lpszPath);
+ CString strTopMostItem(SplitPageTreePath(strPath));
+
+ // Check if an item with the given text does already exist
+ HTREEITEM hItem = NULL;
+ HTREEITEM hChild = m_pwndPageTree->GetChildItem(hParent);
+ while (hChild)
+ {
+ if (m_pwndPageTree->GetItemText(hChild) == strTopMostItem)
+ {
+ hItem = hChild;
+ break;
+ }
+ hChild = m_pwndPageTree->GetNextItem(hChild, TVGN_NEXT);
+ }
+
+ // If item with that text does not already exist, create a new one
+ if (!hItem)
+ {
+ hItem = m_pwndPageTree->InsertItem(strTopMostItem, hParent);
+ m_pwndPageTree->SetItemData(hItem, -1);
+ if (!strPath.IsEmpty() && m_bTreeImages && m_DefaultImages.GetSafeHandle())
+ // set folder image
+ m_pwndPageTree->SetItemImage(hItem, m_Images.GetImageCount()-2, m_Images.GetImageCount()-2);
+ }
+ if (!hItem)
+ {
+ ASSERT(FALSE);
+ return NULL;
+ }
+
+ if (strPath.IsEmpty())
+ return hItem;
+ else
+ return CreatePageTreeItem(strPath, hItem);
+}
+
+
+CString CTreePropSheet::SplitPageTreePath(CString &strRest)
+{
+ int nSeperatorPos = 0;
+ while (TRUE)
+ {
+ nSeperatorPos = strRest.Find(_T("::"), nSeperatorPos);
+ if (nSeperatorPos == -1)
+ {
+ CString strItem(strRest);
+ strRest.Empty();
+ return strItem;
+ }
+ else if (nSeperatorPos>0)
+ {
+ // if there is an odd number of backslashes infront of the
+ // seperator, than do not interpret it as separator
+ int nBackslashCount = 0;
+ for (int nPos = nSeperatorPos-1; nPos >= 0 && strRest[nPos]==_T('\\'); --nPos, ++nBackslashCount);
+ if (nBackslashCount%2 == 0)
+ break;
+ else
+ ++nSeperatorPos;
+ }
+ }
+
+ CString strItem(strRest.Left(nSeperatorPos));
+ strItem.Replace(_T("\\::"), _T("::"));
+ strItem.Replace(_T("\\\\"), _T("\\"));
+ strRest = strRest.Mid(nSeperatorPos+2);
+ return strItem;
+}
+
+
+BOOL CTreePropSheet::KillActiveCurrentPage()
+{
+ HWND hCurrentPage = PropSheet_GetCurrentPageHwnd(m_hWnd);
+ if (!IsWindow(hCurrentPage))
+ {
+ ASSERT(FALSE);
+ return TRUE;
+ }
+
+ // Check if the current page is really active (if page is invisible
+ // an virtual empty page is the active one.
+ if (!::IsWindowVisible(hCurrentPage))
+ return TRUE;
+
+ // Try to deactivate current page
+ PSHNOTIFY pshn;
+ pshn.hdr.code = PSN_KILLACTIVE;
+ pshn.hdr.hwndFrom = m_hWnd;
+ pshn.hdr.idFrom = GetDlgCtrlID();
+ pshn.lParam = 0;
+ if (::SendMessage(hCurrentPage, WM_NOTIFY, pshn.hdr.idFrom, (LPARAM)&pshn))
+ // current page does not allow page change
+ return FALSE;
+
+ // Hide the page
+ ::ShowWindow(hCurrentPage, SW_HIDE);
+
+ return TRUE;
+}
+
+
+HTREEITEM CTreePropSheet::GetPageTreeItem(int nPage, HTREEITEM hRoot /* = TVI_ROOT */)
+{
+ // Special handling for root case
+ if (hRoot == TVI_ROOT)
+ hRoot = m_pwndPageTree->GetNextItem(NULL, TVGN_ROOT);
+
+ // Check parameters
+ if (nPage < 0 || nPage >= GetPageCount())
+ {
+ ASSERT(FALSE);
+ return NULL;
+ }
+
+ if (hRoot == NULL)
+ {
+ ASSERT(FALSE);
+ return NULL;
+ }
+
+ // we are performing a simple linear search here, because we are
+ // expecting only little data
+ HTREEITEM hItem = hRoot;
+ while (hItem)
+ {
+ if ((signed)m_pwndPageTree->GetItemData(hItem) == nPage)
+ return hItem;
+ if (m_pwndPageTree->ItemHasChildren(hItem))
+ {
+ HTREEITEM hResult = GetPageTreeItem(nPage, m_pwndPageTree->GetNextItem(hItem, TVGN_CHILD));
+ if (hResult)
+ return hResult;
+ }
+
+ hItem = m_pwndPageTree->GetNextItem(hItem, TVGN_NEXT);
+ }
+
+ // we've found nothing, if we arrive here
+ return hItem;
+}
+
+
+BOOL CTreePropSheet::SelectPageTreeItem(int nPage)
+{
+ HTREEITEM hItem = GetPageTreeItem(nPage);
+ if (!hItem)
+ return FALSE;
+
+ return m_pwndPageTree->SelectItem(hItem);
+}
+
+
+BOOL CTreePropSheet::SelectCurrentPageTreeItem()
+{
+ CTabCtrl *pTab = GetTabControl();
+ if (!IsWindow(pTab->GetSafeHwnd()))
+ return FALSE;
+
+ return SelectPageTreeItem(pTab->GetCurSel());
+}
+
+
+void CTreePropSheet::UpdateCaption()
+{
+ HWND hPage = PropSheet_GetCurrentPageHwnd(GetSafeHwnd());
+ BOOL bRealPage = IsWindow(hPage) && ::IsWindowVisible(hPage);
+ HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
+ if (!hItem)
+ return;
+ CString strCaption = m_pwndPageTree->GetItemText(hItem);
+
+ // if empty page, then update empty page message
+ if (!bRealPage)
+ m_pFrame->SetMsgText(GenerateEmptyPageMessage(m_strEmptyPageMessage, strCaption));
+
+ // if no captions are displayed, cancel here
+ if (!m_pFrame->GetShowCaption())
+ return;
+
+ // get tab control, to the the images from
+ CTabCtrl *pTabCtrl = GetTabControl();
+ if (!IsWindow(pTabCtrl->GetSafeHwnd()))
+ {
+ ASSERT(FALSE);
+ return;
+ }
+
+ if (m_bTreeImages)
+ {
+ // get image from tree
+ int nImage;
+ m_pwndPageTree->GetItemImage(hItem, nImage, nImage);
+ HICON hIcon = m_Images.ExtractIcon(nImage);
+ m_pFrame->SetCaption(strCaption, hIcon);
+ if (hIcon)
+ DestroyIcon(hIcon);
+ }
+ else if (bRealPage)
+ {
+ // get image from hidden (original) tab provided by the original
+ // implementation
+ CImageList *pImages = pTabCtrl->GetImageList();
+ if (pImages)
+ {
+ TCITEM ti;
+ ZeroMemory(&ti, sizeof(ti));
+ ti.mask = TCIF_IMAGE;
+
+ HICON hIcon = NULL;
+ if (pTabCtrl->GetItem((int)m_pwndPageTree->GetItemData(hItem), &ti))
+ hIcon = pImages->ExtractIcon(ti.iImage);
+
+ m_pFrame->SetCaption(strCaption, hIcon);
+ if (hIcon)
+ DestroyIcon(hIcon);
+ }
+ else
+ m_pFrame->SetCaption(strCaption);
+ }
+ else
+ m_pFrame->SetCaption(strCaption);
+}
+
+
+void CTreePropSheet::ActivatePreviousPage()
+{
+ if (!IsWindow(m_hWnd))
+ return;
+
+ if (!IsWindow(m_pwndPageTree->GetSafeHwnd()))
+ {
+ // normal tab property sheet. Simply use page index
+ int nPageIndex = GetActiveIndex();
+ if (nPageIndex<0 || nPageIndex>=GetPageCount())
+ return;
+
+ int nPrevIndex = (nPageIndex==0)? GetPageCount()-1 : nPageIndex-1;
+ SetActivePage(nPrevIndex);
+ }
+ else
+ {
+ // property sheet with page tree.
+ // we need a more sophisticated handling here, than simply using
+ // the page index, because we won't skip empty pages.
+ // so we have to walk the page tree
+ HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
+ ASSERT(hItem);
+ if (!hItem)
+ return;
+
+ HTREEITEM hPrevItem = NULL;
+ if (hPrevItem=m_pwndPageTree->GetPrevSiblingItem(hItem))
+ {
+ while (m_pwndPageTree->ItemHasChildren(hPrevItem))
+ {
+ hPrevItem = m_pwndPageTree->GetChildItem(hPrevItem);
+ while (m_pwndPageTree->GetNextSiblingItem(hPrevItem))
+ hPrevItem = m_pwndPageTree->GetNextSiblingItem(hPrevItem);
+ }
+ }
+ else
+ hPrevItem=m_pwndPageTree->GetParentItem(hItem);
+
+ if (!hPrevItem)
+ {
+ // no prev item, so cycle to the last item
+ hPrevItem = m_pwndPageTree->GetRootItem();
+
+ while (TRUE)
+ {
+ while (m_pwndPageTree->GetNextSiblingItem(hPrevItem))
+ hPrevItem = m_pwndPageTree->GetNextSiblingItem(hPrevItem);
+
+ if (m_pwndPageTree->ItemHasChildren(hPrevItem))
+ hPrevItem = m_pwndPageTree->GetChildItem(hPrevItem);
+ else
+ break;
+ }
+ }
+
+ if (hPrevItem)
+ m_pwndPageTree->SelectItem(hPrevItem);
+ }
+}
+
+
+void CTreePropSheet::ActivateNextPage()
+{
+ if (!IsWindow(m_hWnd))
+ return;
+
+ if (!IsWindow(m_pwndPageTree->GetSafeHwnd()))
+ {
+ // normal tab property sheet. Simply use page index
+ int nPageIndex = GetActiveIndex();
+ if (nPageIndex<0 || nPageIndex>=GetPageCount())
+ return;
+
+ int nNextIndex = (nPageIndex==GetPageCount()-1)? 0 : nPageIndex+1;
+ SetActivePage(nNextIndex);
+ }
+ else
+ {
+ // property sheet with page tree.
+ // we need a more sophisticated handling here, than simply using
+ // the page index, because we won't skip empty pages.
+ // so we have to walk the page tree
+ HTREEITEM hItem = m_pwndPageTree->GetSelectedItem();
+ ASSERT(hItem);
+ if (!hItem)
+ return;
+
+ HTREEITEM hNextItem = NULL;
+ if (hNextItem=m_pwndPageTree->GetChildItem(hItem))
+ ;
+ else if (hNextItem=m_pwndPageTree->GetNextSiblingItem(hItem))
+ ;
+ else if (m_pwndPageTree->GetParentItem(hItem))
+ {
+ while (!hNextItem)
+ {
+ hItem = m_pwndPageTree->GetParentItem(hItem);
+ if (!hItem)
+ break;
+
+ hNextItem = m_pwndPageTree->GetNextSiblingItem(hItem);
+ }
+ }
+
+ if (!hNextItem)
+ // no next item -- so cycle to the first item
+ hNextItem = m_pwndPageTree->GetRootItem();
+
+ if (hNextItem)
+ m_pwndPageTree->SelectItem(hNextItem);
+ }
+}
+
+
+/////////////////////////////////////////////////////////////////////
+// Overridings
+
+BOOL CTreePropSheet::OnInitDialog()
+{
+ if (m_bTreeViewMode)
+ {
+ // be sure, there are no stacked tabs, because otherwise the
+ // page caption will be to large in tree view mode
+ EnableStackedTabs(FALSE);
+
+ // Initialize image list.
+ if (m_DefaultImages.GetSafeHandle())
+ {
+ IMAGEINFO ii;
+ m_DefaultImages.GetImageInfo(0, &ii);
+ if (ii.hbmImage) DeleteObject(ii.hbmImage);
+ if (ii.hbmMask) DeleteObject(ii.hbmMask);
+ m_Images.Create(ii.rcImage.right-ii.rcImage.left, ii.rcImage.bottom-ii.rcImage.top, ILC_COLOR32|ILC_MASK, 0, 1);
+ }
+ else
+ m_Images.Create(16, 16, ILC_COLOR32|ILC_MASK, 0, 1);
+ }
+
+ // perform default implementation
+ BOOL bResult = __super::OnInitDialog();
+
+ if (!m_bTreeViewMode)
+ // stop here, if we would like to use tabs
+ return bResult;
+
+ // Get tab control...
+ CTabCtrl *pTab = GetTabControl();
+ if (!IsWindow(pTab->GetSafeHwnd()))
+ {
+ ASSERT(FALSE);
+ return bResult;
+ }
+
+ // ... and hide it
+ pTab->ShowWindow(SW_HIDE);
+ pTab->EnableWindow(FALSE);
+
+ // Place another (empty) tab ctrl, to get a frame instead
+ CRect rectFrame;
+ pTab->GetWindowRect(rectFrame);
+ ScreenToClient(rectFrame);
+
+ m_pFrame = CreatePageFrame();
+ if (!m_pFrame)
+ {
+ ASSERT(FALSE);
+ AfxThrowMemoryException();
+ }
+ m_pFrame->Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0xFFFF);
+ m_pFrame->ShowCaption(m_bPageCaption);
+
+ // Lets make place for the tree ctrl
+ const int nTreeWidth = m_nPageTreeWidth;
+ const int nTreeSpace = 5;
+
+ CRect rectSheet;
+ GetWindowRect(rectSheet);
+ rectSheet.right+= nTreeWidth;
+ SetWindowPos(NULL, -1, -1, rectSheet.Width(), rectSheet.Height(), SWP_NOZORDER|SWP_NOMOVE);
+ CenterWindow();
+
+ MoveChildWindows(nTreeWidth, 0);
+
+ // Lets calculate the rectangle for the tree ctrl
+ CRect rectTree(rectFrame);
+ rectTree.right = rectTree.left + nTreeWidth - nTreeSpace;
+
+ // calculate caption height
+ CTabCtrl wndTabCtrl;
+ wndTabCtrl.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS, rectFrame, this, 0x1234);
+ wndTabCtrl.InsertItem(0, _T(""));
+ CRect rectFrameCaption;
+ wndTabCtrl.GetItemRect(0, rectFrameCaption);
+ wndTabCtrl.DestroyWindow();
+ m_pFrame->SetCaptionHeight(rectFrameCaption.Height());
+
+ // if no caption should be displayed, make the window smaller in
+ // height
+ if (!m_bPageCaption)
+ {
+ // make frame smaller
+ m_pFrame->GetWnd()->GetWindowRect(rectFrame);
+ ScreenToClient(rectFrame);
+ rectFrame.top+= rectFrameCaption.Height();
+ m_pFrame->GetWnd()->MoveWindow(rectFrame);
+
+ // move all child windows up
+ MoveChildWindows(0, -rectFrameCaption.Height());
+
+ // modify rectangle for the tree ctrl
+ rectTree.bottom-= rectFrameCaption.Height();
+
+ // make us smaller
+ CRect rect;
+ GetWindowRect(rect);
+ rect.top+= rectFrameCaption.Height()/2;
+ rect.bottom-= rectFrameCaption.Height()-rectFrameCaption.Height()/2;
+// if (GetParent())
+// GetParent()->ScreenToClient(rect);
+ MoveWindow(rect);
+ }
+
+ // finally create tht tree control
+ const DWORD dwTreeStyle = TVS_SHOWSELALWAYS|TVS_TRACKSELECT|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS;
+ m_pwndPageTree = CreatePageTreeObject();
+ if (!m_pwndPageTree)
+ {
+ ASSERT(FALSE);
+ AfxThrowMemoryException();
+ }
+
+ // MFC7-support here (Thanks to Rainer Wollgarten)
+ #if _MFC_VER >= 0x0700
+ {
+ m_pwndPageTree->CreateEx(
+ WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY,
+ WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle,
+ rectTree, this, s_unPageTreeId);
+ }
+ #else
+ {
+ m_pwndPageTree->CreateEx(
+ WS_EX_CLIENTEDGE|WS_EX_NOPARENTNOTIFY,
+ _T("SysTreeView32"), _T("PageTree"),
+ WS_TABSTOP|WS_CHILD|WS_VISIBLE|dwTreeStyle,
+ rectTree, this, s_unPageTreeId);
+ }
+ #endif
+
+ if (m_bTreeImages)
+ {
+ m_pwndPageTree->SetImageList(&m_Images, TVSIL_NORMAL);
+ m_pwndPageTree->SetImageList(&m_Images, TVSIL_STATE);
+ }
+
+ // Fill the tree ctrl
+ RefillPageTree();
+
+ // Select item for the current page
+ if (pTab->GetCurSel() > -1)
+ SelectPageTreeItem(pTab->GetCurSel());
+
+ return bResult;
+}
+
+
+void CTreePropSheet::OnDestroy()
+{
+ __super::OnDestroy();
+
+ if(m_pwndPageTree && m_pwndPageTree->m_hWnd)
+ m_pwndPageTree->DestroyWindow();
+
+ if(m_pFrame && m_pFrame->GetWnd()->m_hWnd)
+ m_pFrame->GetWnd()->DestroyWindow();
+}
+
+
+LRESULT CTreePropSheet::OnAddPage(WPARAM wParam, LPARAM lParam)
+{
+ LRESULT lResult = DefWindowProc(PSM_ADDPAGE, wParam, lParam);
+ if (!m_bTreeViewMode)
+ return lResult;
+
+ RefillPageTree();
+ SelectCurrentPageTreeItem();
+
+ return lResult;
+}
+
+
+LRESULT CTreePropSheet::OnRemovePage(WPARAM wParam, LPARAM lParam)
+{
+ LRESULT lResult = DefWindowProc(PSM_REMOVEPAGE, wParam, lParam);
+ if (!m_bTreeViewMode)
+ return lResult;
+
+ RefillPageTree();
+ SelectCurrentPageTreeItem();
+
+ return lResult;
+}
+
+
+LRESULT CTreePropSheet::OnSetCurSel(WPARAM wParam, LPARAM lParam)
+{
+ LRESULT lResult = DefWindowProc(PSM_SETCURSEL, wParam, lParam);
+ if (!m_bTreeViewMode)
+ return lResult;
+
+ SelectCurrentPageTreeItem();
+ UpdateCaption();
+ return lResult;
+}
+
+
+LRESULT CTreePropSheet::OnSetCurSelId(WPARAM wParam, LPARAM lParam)
+{
+ LRESULT lResult = DefWindowProc(PSM_SETCURSEL, wParam, lParam);
+ if (!m_bTreeViewMode)
+ return lResult;
+
+ SelectCurrentPageTreeItem();
+ UpdateCaption();
+ return lResult;
+}
+
+
+void CTreePropSheet::OnPageTreeSelChanging(NMHDR *pNotifyStruct, LRESULT *plResult)
+{
+ *plResult = 0;
+ if (m_bPageTreeSelChangedActive)
+ return;
+ else
+ m_bPageTreeSelChangedActive = TRUE;
+
+ NMTREEVIEW *pTvn = reinterpret_cast<NMTREEVIEW*>(pNotifyStruct);
+ int nPage = m_pwndPageTree->GetItemData(pTvn->itemNew.hItem);
+ BOOL bResult;
+ if (nPage<0 || (unsigned)nPage>=m_pwndPageTree->GetCount())
+ bResult = KillActiveCurrentPage();
+ else
+ bResult = SetActivePage(nPage);
+
+ if (!bResult)
+ // prevent selection to change
+ *plResult = TRUE;
+
+ // Set focus to tree ctrl (I guess that's what the user expects)
+ m_pwndPageTree->SetFocus();
+
+ m_bPageTreeSelChangedActive = FALSE;
+
+ return;
+}
+
+
+void CTreePropSheet::OnPageTreeSelChanged(NMHDR *pNotifyStruct, LRESULT *plResult)
+{
+ *plResult = 0;
+
+ UpdateCaption();
+
+ return;
+}
+
+
+LRESULT CTreePropSheet::OnIsDialogMessage(WPARAM wParam, LPARAM lParam)
+{
+ MSG *pMsg = reinterpret_cast<MSG*>(lParam);
+ if (pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_TAB && GetKeyState(VK_CONTROL)&0x8000)
+ {
+ if (GetKeyState(VK_SHIFT)&0x8000)
+ ActivatePreviousPage();
+ else
+ ActivateNextPage();
+ return TRUE;
+ }
+
+
+ return __super::DefWindowProc(PSM_ISDIALOGMESSAGE, wParam, lParam);
+}
+
+} //namespace TreePropSheet
diff --git a/src/ui/TreePropSheet/TreePropSheet.h b/src/ui/TreePropSheet/TreePropSheet.h
new file mode 100644
index 000000000..ba98a396e
--- /dev/null
+++ b/src/ui/TreePropSheet/TreePropSheet.h
@@ -0,0 +1,483 @@
+/********************************************************************
+*
+* Copyright (c) 2002 Sven Wiegand <mail@sven-wiegand.de>
+*
+* You can use this and modify this in any way you want,
+* BUT LEAVE THIS HEADER INTACT.
+*
+* Redistribution is appreciated.
+*
+* $Workfile:$
+* $Revision: 126 $
+* $Modtime:$
+* $Author: gabest $
+*
+* Revision History:
+* $History:$
+*
+*********************************************************************/
+
+
+#if !defined(AFX_TREEPROPSHEET_H__50695CFB_FCE4_4188_ADB4_BF05A5488E41__INCLUDED_)
+#define AFX_TREEPROPSHEET_H__50695CFB_FCE4_4188_ADB4_BF05A5488E41__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "PropPageFrame.h"
+#include <afxtempl.h>
+#include <afxdlgs.h>
+#include <afxcmn.h>
+
+namespace TreePropSheet
+{
+
+/**
+A property sheet, which can use a tree control instead of a tab
+control, to give the user access to the different pages.
+
+You can use it exactly the same way, as a CPropertySheet object.
+Simply create CPropertyPage objects and add them via AddPage() to
+the sheet. If you would like to use the tree view mode (default),
+you can specify the path of the pages in the tree, by their name:
+The names of the pages can contain
+double colons ("::"), which will specify the path of that page in the
+tree control. I.e. if you have three pages with the following names:
+1. _T("Appearance::Toolbars")
+2. _T("Appearance::Menus")
+3. _T("Directories")
+the tree would look as follow:
+\verbatim
+Appearance
+|
++-Toolbars
+|
++-Menus
+
+Directories
+\endverbatim
+If you would like to use a double colon, which should not be
+interpreted as a path seperator, prefix it with a backslash ("\\::").
+
+To disable tree view mode and use the standard tabbed mode, call
+the SetTreeViewMode() method. This also allows you, to enable page
+captions and tree images for tree view mode. If you would like to
+have images in the tree, but not all of your pages specify images or
+there are tree view items, which are not attached to a page (only
+parent items for real page items), you have to set default images
+using the SetTreeDefaultImages() method -- otherwise their may appear
+display errors.
+
+If the user selects a tree view item, which does not belong to a page,
+because it is just a parent item for real page items, no page will
+be displayed, instead a message will be displayed, that can be set
+via SetEmptyPageText().
+
+@author Sven Wiegand
+*/
+
+class /*AFX_EXT_CLASS*/ CTreePropSheet : public CPropertySheet
+{
+ DECLARE_DYNAMIC(CTreePropSheet)
+
+// Construction/Destruction
+public:
+ CTreePropSheet();
+ CTreePropSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
+ CTreePropSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
+ virtual ~CTreePropSheet();
+
+// Operations
+public:
+ /**
+ Call this method, if you would like to use a tree control to browse
+ the pages, instead of the tab control.
+
+ This method needs to becalled, before DoModal() or Create(). If the
+ window has already been created, the method will fail.
+
+ @param bTreeViewMode
+ Pass TRUE to provide a tree view control instead of a tab control
+ to browse the pages, pass FALSE to use the normal tab control.
+ @param bPageCaption
+ TRUE if a caption should be displayed for each page. The caption
+ contains the page title and an icon if specified with the page.
+ Ignored if bTreeViewMode is FALSE.
+ @param bTreeImages
+ TRUE if the page icons should be displayed in the page tree,
+ FALSE if there should be no icons in the page tree. Ignored if
+ bTreeViewMode is FALSE. If not all of your pages are containing
+ icons, or if there will be empty pages (parent nodes without a
+ related page, you need to call SetTreeDefaultImages() to avoid
+ display errors.
+
+ @return
+ TRUE on success or FALSE, if the window has already been created.
+ */
+ BOOL SetTreeViewMode(BOOL bTreeViewMode = TRUE, BOOL bPageCaption = FALSE, BOOL bTreeImages = FALSE);
+
+ /**
+ Specifies the width of the tree control, when the sheet is in tree
+ view mode. The default value (if this method is not called) is 150
+ pixels.
+
+ This method needs to be called, before DoModeal() or Create().
+ Otherwise it will fail.
+
+ @param nWidth
+ The width in pixels for the page tree.
+
+ @return
+ TRUE on success, FALSE otherwise (if the window has already been
+ created).
+ */
+ BOOL SetTreeWidth(int nWidth);
+
+ /**
+ Specifies the text to be drawn on empty pages (pages for tree view
+ items, that are not related to a page, because they are only
+ parents for other items). This is only needed in tree view mode.
+
+ The specified text can contains a single "%s" placeholder which
+ will be replaced with the title of the empty page.
+ */
+ void SetEmptyPageText(LPCTSTR lpszEmptyPageText);
+
+ /**
+ Allows you to specify, how the empty page message (see
+ SetEmptyPageText()) should be drawn.
+
+ @param dwFormat
+ A combination of the DT_* flags available for the Win32-API
+ function DrawText(), that should be used to draw the text.
+ The default value is:
+ \code
+ DT_CENTER|DT_VCENTER|DT_NOPREFIX|DT_SINGLELINE
+ \endcode
+
+ @return
+ The previous format.
+ */
+ DWORD SetEmptyPageTextFormat(DWORD dwFormat);
+
+ //@{
+ /**
+ Defines the images, that should be used for pages without icons and
+ for empty parent nodes. The list contains exactly to images:
+ 1. An image that should be used for parent tree nodes, without a
+ page asignd.
+ 2. An image that should be used for pages, which are not specifying
+ any icons.
+ Standard image size is 16x16 Pixels, but if you call this method
+ before creating the sheet, the size of image 0 in this list will
+ be assumed as your preferred image size and all other icons must
+ have the same size.
+
+ @param pImages
+ Pointer to an image list with exactly to images, that should be
+ used as default images. The images are copied to an internal
+ list, so that the given list can be deleted after this call.
+ @param unBitmapID
+ Resource identifier for the bitmap, that contains the default
+ images. The resource should contain exactly to images.
+ @param cx
+ Width of a singe image in pixels.
+ @param crMask
+ Color that should be interpreted as transparent.
+
+ @return
+ TRUE on success, FALSE otherwise.
+ */
+ BOOL SetTreeDefaultImages(CImageList *pImages);
+ BOOL SetTreeDefaultImages(UINT unBitmapID, int cx, COLORREF crMask);
+ //@}
+
+ /**
+ Returns a pointer to the tree control, when the sheet is in
+ tree view mode, NULL otherwise.
+ */
+ CTreeCtrl* GetPageTreeControl();
+
+// Public helpers
+public:
+ //@{
+ /**
+ This helper allows you to easily set the icon of a property page.
+
+ This static method does nothing more, than extracting the specified
+ image as an icon from the given image list and assign the
+ icon-handle to the hIcon property of the pages PROPSHEETPAGE
+ structure (m_psp) and modify the structures flags, so that the
+ image will be recognized.
+
+ You need to call this method for a page, before adding the page
+ to a property sheet.
+
+ @important
+ If you are using the CImageList-version, you are responsible for
+ destroying the extracted icon with DestroyIcon() or the static
+ DestroyPageIcon() method.
+
+ @see DestroyPageIcon()
+
+ @param pPage
+ Property page to set the image for.
+ @param hIcon
+ Handle to icon that should be set for the page.
+ @param unIconId
+ Ressource identifier for the icon to set.
+ @param Images
+ Reference of the image list to extract the icon from.
+ @param nImage
+ Zero based index of the image in pImages, that should be used
+ as an icon.
+
+ @return
+ TRUE on success, FALSE if an error occured.
+ */
+ static BOOL SetPageIcon(CPropertyPage *pPage, HICON hIcon);
+ static BOOL SetPageIcon(CPropertyPage *pPage, UINT unIconId);
+ static BOOL SetPageIcon(CPropertyPage *pPage, CImageList &Images, int nImage);
+ //@}
+
+ /**
+ Checks, if the PSP_USEHICON flag is set in the PROPSHEETPAGE struct;
+ If this is the case, the flag will be removed and the icon
+ specified by the hIcon attribute of the PROPSHEETPAGE struct will
+ be destroyed using DestroyIcon().
+
+ @note
+ You only have to call DestroyIcon() for icons, that have been
+ created using CreateIconIndirect() (i.e. used by
+ CImageList::ExtractIcon()).
+
+ @return
+ TRUE on success, FALSE if the PSP_USEHICON flag was not set or
+ if the icon handle was NULL.
+ */
+ static BOOL DestroyPageIcon(CPropertyPage *pPage);
+
+// Overridable implementation helpers
+protected:
+ /**
+ Will be called to generate the message, that should be displayed on
+ an empty page, when the sheet is in tree view mode
+
+ This default implementation simply returns lpszEmptyPageMessage
+ with the optional "%s" placeholder replaced by lpszCaption.
+
+ @param lpszEmptyPageMessage
+ The string, set by SetEmptyPageMessage(). This string may contain
+ a "%s" placeholder.
+ @param lpszCaption
+ The title of the empty page.
+ */
+ virtual CString GenerateEmptyPageMessage(LPCTSTR lpszEmptyPageMessage, LPCTSTR lpszCaption);
+
+ /**
+ Will be called during creation process, to create the CTreeCtrl
+ object (the object, not the window!).
+
+ Allows you to inject your own CTreeCtrl-derived classes.
+
+ This default implementation simply creates a CTreeCtrl with new
+ and returns it.
+ */
+ virtual CTreeCtrl* CreatePageTreeObject();
+
+ /**
+ Will be called during creation process, to create the object, that
+ is responsible for drawing the frame around the pages, drawing the
+ empty page message and the caption.
+
+ Allows you to inject your own CPropPageFrame-derived classes.
+
+ This default implementation simply creates a CPropPageFrameTab with
+ new and returns it.
+ */
+ virtual CPropPageFrame* CreatePageFrame();
+
+// Implementation helpers
+protected:
+ /**
+ Moves all childs by the specified amount of pixels.
+
+ @param nDx
+ Pixels to move the childs in horizontal direction (can be
+ negative).
+ @param nDy
+ Pixels to move the childs in vertical direction (can be
+ negative).
+ */
+ void MoveChildWindows(int nDx, int nDy);
+
+ /**
+ Refills the tree that contains the entries for the several pages.
+ */
+ void RefillPageTree();
+
+ /**
+ Creates the specified path in the page tree and returns the handle
+ of the most child item created.
+
+ @param lpszPath
+ Path of the item to create (see description of this class).
+ @param hParentItem
+ Handle of the item under which the path should be created or
+ TVI_ROOT to start from the root.
+ */
+ HTREEITEM CreatePageTreeItem(LPCTSTR lpszPath, HTREEITEM hParent = TVI_ROOT);
+
+ /**
+ Splits the given path into the topmost item and the rest. See
+ description of this class for detailed path information.
+
+ I.e. when given the string "Appearance::Toolbars::Customize", the
+ method will return "Appearance" and after the call strRest will
+ be "Toolbars::Customize".
+ */
+ CString SplitPageTreePath(CString &strRest);
+
+ /**
+ Tries to deactivate the current page, and hides it if successfull,
+ so that an empty page becomes visible.
+
+ @return
+ TRUE if the current page has been deactivated successfully,
+ FALSE if the currently active page prevents a page change.
+ */
+ BOOL KillActiveCurrentPage();
+
+ /**
+ Returns the page tree item, that representates the specified page
+ or NULL, if no such icon exists.
+
+ @param nPage
+ Zero based page index, for which the item to retrieve.
+ @param hRoot
+ Item to start the search at or TVI_ROOT to search the whole
+ tree.
+ */
+ HTREEITEM GetPageTreeItem(int nPage, HTREEITEM hRoot = TVI_ROOT);
+
+ /**
+ Selects and shows the item, representing the specified page.
+
+ @param nPage
+ Zero based page index.
+
+ @return
+ TRUE on success, FALSE if no item does exist for the specified
+ page.
+ */
+ BOOL SelectPageTreeItem(int nPage);
+
+ /**
+ Selects and shows the tree item for the currently active page.
+
+ @return
+ TRUE on success, FALSE if no item exists for the currently active
+ page or if it was not possible to get information about the
+ currently active page.
+ */
+ BOOL SelectCurrentPageTreeItem();
+
+ /**
+ Updates the caption for the currently selected page (if the caption
+ is enabled).
+ */
+ void UpdateCaption();
+
+ /**
+ Activates the previous page in the page order or the last one, if
+ the current one is the first.
+
+ This method does never fail.
+ */
+ void ActivatePreviousPage();
+
+ /**
+ Activates the next page in the page order or the first one, if the
+ current one is the last.
+
+ This method does never fail.
+ */
+ void ActivateNextPage();
+
+// Overridings
+protected:
+ //{{AFX_VIRTUAL(CTreePropSheet)
+ public:
+ virtual BOOL OnInitDialog();
+ //}}AFX_VIRTUAL
+
+// Message handlers
+protected:
+ //{{AFX_MSG(CTreePropSheet)
+ afx_msg void OnDestroy();
+ //}}AFX_MSG
+ afx_msg LRESULT OnAddPage(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnRemovePage(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnSetCurSel(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnSetCurSelId(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnIsDialogMessage(WPARAM wParam, LPARAM lParam);
+
+ afx_msg void OnPageTreeSelChanging(NMHDR *pNotifyStruct, LRESULT *plResult);
+ afx_msg void OnPageTreeSelChanged(NMHDR *pNotifyStruct, LRESULT *plResult);
+ DECLARE_MESSAGE_MAP()
+
+// Properties
+private:
+ /** TRUE if we should use the tree control instead of the tab ctrl. */
+ BOOL m_bTreeViewMode;
+
+ /** The tree control */
+ CTreeCtrl *m_pwndPageTree;
+
+ /** The frame around the pages */
+ CPropPageFrame *m_pFrame;
+
+ /**
+ TRUE, if a tree item selection by OnPageTreeSelChanged() is
+ performed currently.
+ */
+ BOOL m_bPageTreeSelChangedActive;
+
+ /** TRUE if a page caption should be displayed, FALSE otherwise. */
+ BOOL m_bPageCaption;
+
+ /** TRUE if images should be displayed in the tree. */
+ BOOL m_bTreeImages;
+
+ /** Images to be displayed in the tree control. */
+ CImageList m_Images;
+
+ /** Default images. */
+ CImageList m_DefaultImages;
+
+ /**
+ Message to be displayed on empty pages. May contain a "%s"
+ placeholder which will be replaced by the caption of the empty
+ page.
+ */
+ CString m_strEmptyPageMessage;
+
+ /** The width of the page tree control in pixels. */
+ int m_nPageTreeWidth;
+
+// Static Properties
+private:
+ /** The id of the tree view control, that shows the pages. */
+ static const UINT s_unPageTreeId;
+};
+
+
+} //namespace TreePropSheet
+
+/////////////////////////////////////////////////////////////////////////////
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein.
+
+#endif // AFX_TREEPROPSHEET_H__50695CFB_FCE4_4188_ADB4_BF05A5488E41__INCLUDED_
diff --git a/src/ui/TreePropSheet/TreePropSheet.sln b/src/ui/TreePropSheet/TreePropSheet.sln
new file mode 100644
index 000000000..ddaa4f48e
--- /dev/null
+++ b/src/ui/TreePropSheet/TreePropSheet.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TreePropSheet", "TreePropSheet.vcproj", "{AB494732-EF6D-44D0-BCF8-80FF04858D10}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug.ActiveCfg = Debug|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug.Build.0 = Debug|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release.ActiveCfg = Release|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release.Build.0 = Release|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/ui/TreePropSheet/TreePropSheet.vcproj b/src/ui/TreePropSheet/TreePropSheet.vcproj
new file mode 100644
index 000000000..35a355015
--- /dev/null
+++ b/src/ui/TreePropSheet/TreePropSheet.vcproj
@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="TreePropSheet"
+ ProjectGUID="{AB494732-EF6D-44D0-BCF8-80FF04858D10}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../lib/TreePropSheetD.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../lib/TreePropSheetR.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../lib/TreePropSheetDU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../lib/TreePropSheetRU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="PropPageFrame.cpp">
+ </File>
+ <File
+ RelativePath="PropPageFrameDefault.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="TreePropSheet.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="PropPageFrame.h">
+ </File>
+ <File
+ RelativePath="PropPageFrameDefault.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ <File
+ RelativePath="TreePropSheet.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/ui/TreePropSheet/TreePropSheet.vcproj.vspscc b/src/ui/TreePropSheet/TreePropSheet.vcproj.vspscc
new file mode 100644
index 000000000..caf8a2e8e
--- /dev/null
+++ b/src/ui/TreePropSheet/TreePropSheet.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:ui\\TreePropSheet"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/src/ui/TreePropSheet/stdafx.cpp b/src/ui/TreePropSheet/stdafx.cpp
new file mode 100644
index 000000000..a3364a6bc
--- /dev/null
+++ b/src/ui/TreePropSheet/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// TreePropSheet.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/ui/TreePropSheet/stdafx.h b/src/ui/TreePropSheet/stdafx.h
new file mode 100644
index 000000000..58101e98b
--- /dev/null
+++ b/src/ui/TreePropSheet/stdafx.h
@@ -0,0 +1,18 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
diff --git a/src/ui/sizecbar/scbarcf.cpp b/src/ui/sizecbar/scbarcf.cpp
new file mode 100644
index 000000000..776555c15
--- /dev/null
+++ b/src/ui/sizecbar/scbarcf.cpp
@@ -0,0 +1,234 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// CSizingControlBarCF Version 2.43
+//
+// Created: Dec 21, 1998 Last Modified: August 03, 2000
+//
+// See the official site at www.datamekanix.com for documentation and
+// the latest news.
+//
+/////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
+//
+// This code is free for personal and commercial use, providing this
+// notice remains intact in the source files and all eventual changes are
+// clearly marked with comments.
+//
+// You must obtain the author's consent before you can include this code
+// in a software library.
+//
+// No warrantee of any kind, express or implied, is included with this
+// software; use at your own risk, responsibility for damages (if any) to
+// anyone resulting from the use of this software rests entirely with the
+// user.
+//
+// Send bug reports, bug fixes, enhancements, requests, flames, etc. to
+// cristi@datamekanix.com or post them at the message board at the site.
+/////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "scbarcf.h"
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBarCF
+
+IMPLEMENT_DYNAMIC(CSizingControlBarCF, baseCSizingControlBarCF);
+
+int CALLBACK EnumFontFamProc(ENUMLOGFONT FAR *lpelf,
+ NEWTEXTMETRIC FAR *lpntm,
+ int FontType,
+ LPARAM lParam)
+{
+ UNUSED_ALWAYS(lpelf);
+ UNUSED_ALWAYS(lpntm);
+ UNUSED_ALWAYS(FontType);
+ UNUSED_ALWAYS(lParam);
+
+ return 0;
+}
+
+CSizingControlBarCF::CSizingControlBarCF()
+{
+ m_bActive = FALSE;
+
+ CDC dc;
+ dc.CreateCompatibleDC(NULL);
+
+ m_sFontFace = (::EnumFontFamilies(dc.m_hDC,
+ _T("Tahoma"), (FONTENUMPROC) EnumFontFamProc, 0) == 0) ?
+ _T("Tahoma") : _T("Arial");
+
+ dc.DeleteDC();
+
+}
+
+BEGIN_MESSAGE_MAP(CSizingControlBarCF, baseCSizingControlBarCF)
+ //{{AFX_MSG_MAP(CSizingControlBarCF)
+ //}}AFX_MSG_MAP
+ ON_MESSAGE(WM_SETTEXT, OnSetText)
+END_MESSAGE_MAP()
+
+void CSizingControlBarCF::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
+{
+ baseCSizingControlBarCF::OnUpdateCmdUI(pTarget, bDisableIfNoHndler);
+
+ if (!HasGripper())
+ return;
+
+ BOOL bNeedPaint = FALSE;
+
+ CWnd* pFocus = GetFocus();
+ BOOL bActiveOld = m_bActive;
+
+ m_bActive = (pFocus->GetSafeHwnd() && IsChild(pFocus));
+
+ if (m_bActive != bActiveOld)
+ bNeedPaint = TRUE;
+
+ if (bNeedPaint)
+ SendMessage(WM_NCPAINT);
+}
+
+// gradient defines (if not already defined)
+#ifndef COLOR_GRADIENTACTIVECAPTION
+#define COLOR_GRADIENTACTIVECAPTION 27
+#define COLOR_GRADIENTINACTIVECAPTION 28
+#define SPI_GETGRADIENTCAPTIONS 0x1008
+#endif
+
+void CSizingControlBarCF::NcPaintGripper(CDC* pDC, CRect rcClient)
+{
+ if (!HasGripper())
+ return;
+
+ // compute the caption rectangle
+ BOOL bHorz = IsHorzDocked();
+ CRect rcGrip = rcClient;
+ CRect rcBtn = m_biHide.GetRect();
+ if (bHorz)
+ { // right side gripper
+ rcGrip.left -= m_cyGripper + 1;
+ rcGrip.right = rcGrip.left + 11;
+ rcGrip.top = rcBtn.bottom + 3;
+ }
+ else
+ { // gripper at top
+ rcGrip.top -= m_cyGripper + 1;
+ rcGrip.bottom = rcGrip.top + 11;
+ rcGrip.right = rcBtn.left - 3;
+ }
+ rcGrip.InflateRect(bHorz ? 1 : 0, bHorz ? 0 : 1);
+
+ // draw the caption background
+ //CBrush br;
+ COLORREF clrCptn = m_bActive ?
+ ::GetSysColor(COLOR_ACTIVECAPTION) :
+ ::GetSysColor(COLOR_INACTIVECAPTION);
+
+ // query gradient info (usually TRUE for Win98/Win2k)
+ BOOL bGradient = FALSE;
+ ::SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &bGradient, 0);
+
+ if (!bGradient)
+ pDC->FillSolidRect(&rcGrip, clrCptn); // solid color
+ else
+ {
+ // gradient from left to right or from bottom to top
+ // get second gradient color (the right end)
+ COLORREF clrCptnRight = m_bActive ?
+ ::GetSysColor(COLOR_GRADIENTACTIVECAPTION) :
+ ::GetSysColor(COLOR_GRADIENTINACTIVECAPTION);
+
+ // this will make 2^6 = 64 fountain steps
+ int nShift = 6;
+ int nSteps = 1 << nShift;
+
+ for (int i = 0; i < nSteps; i++)
+ {
+ // do a little alpha blending
+ int nR = (GetRValue(clrCptn) * (nSteps - i) +
+ GetRValue(clrCptnRight) * i) >> nShift;
+ int nG = (GetGValue(clrCptn) * (nSteps - i) +
+ GetGValue(clrCptnRight) * i) >> nShift;
+ int nB = (GetBValue(clrCptn) * (nSteps - i) +
+ GetBValue(clrCptnRight) * i) >> nShift;
+
+ COLORREF cr = RGB(nR, nG, nB);
+
+ // then paint with the resulting color
+ CRect r2 = rcGrip;
+ if (bHorz)
+ {
+ r2.bottom = rcGrip.bottom -
+ ((i * rcGrip.Height()) >> nShift);
+ r2.top = rcGrip.bottom -
+ (((i + 1) * rcGrip.Height()) >> nShift);
+ if (r2.Height() > 0)
+ pDC->FillSolidRect(r2, cr);
+ }
+ else
+ {
+ r2.left = rcGrip.left +
+ ((i * rcGrip.Width()) >> nShift);
+ r2.right = rcGrip.left +
+ (((i + 1) * rcGrip.Width()) >> nShift);
+ if (r2.Width() > 0)
+ pDC->FillSolidRect(r2, cr);
+ }
+ }
+ }
+
+ // draw the caption text - first select a font
+ CFont font;
+ int ppi = pDC->GetDeviceCaps(LOGPIXELSX);
+ int pointsize = MulDiv(85, 96, ppi); // 8.5 points at 96 ppi
+
+ LOGFONT lf;
+ BOOL bFont = font.CreatePointFont(pointsize, m_sFontFace);
+ if (bFont)
+ {
+ // get the text color
+ COLORREF clrCptnText = m_bActive ?
+ ::GetSysColor(COLOR_CAPTIONTEXT) :
+ ::GetSysColor(COLOR_INACTIVECAPTIONTEXT);
+
+ int nOldBkMode = pDC->SetBkMode(TRANSPARENT);
+ COLORREF clrOldText = pDC->SetTextColor(clrCptnText);
+
+ if (bHorz)
+ {
+ // rotate text 90 degrees CCW if horizontally docked
+ font.GetLogFont(&lf);
+ font.DeleteObject();
+ lf.lfEscapement = 900;
+ font.CreateFontIndirect(&lf);
+ }
+
+ CFont* pOldFont = pDC->SelectObject(&font);
+ CString sTitle;
+ GetWindowText(sTitle);
+
+ CPoint ptOrg = bHorz ?
+ CPoint(rcGrip.left - 1, rcGrip.bottom - 3) :
+ CPoint(rcGrip.left + 3, rcGrip.top - 1);
+
+ pDC->ExtTextOut(ptOrg.x, ptOrg.y,
+ ETO_CLIPPED, rcGrip, sTitle, NULL);
+
+ pDC->SelectObject(pOldFont);
+ pDC->SetBkMode(nOldBkMode);
+ pDC->SetTextColor(clrOldText);
+ }
+
+ // draw the button
+ m_biHide.Paint(pDC);
+}
+
+LRESULT CSizingControlBarCF::OnSetText(WPARAM wParam, LPARAM lParam)
+{
+ LRESULT lResult = baseCSizingControlBarCF::OnSetText(wParam, lParam);
+
+ SendMessage(WM_NCPAINT);
+
+ return lResult;
+}
diff --git a/src/ui/sizecbar/scbarcf.h b/src/ui/sizecbar/scbarcf.h
new file mode 100644
index 000000000..3fb36bfcf
--- /dev/null
+++ b/src/ui/sizecbar/scbarcf.h
@@ -0,0 +1,78 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// CSizingControlBarCF Version 2.43
+//
+// Created: Dec 21, 1998 Last Modified: August 03, 2000
+//
+// See the official site at www.datamekanix.com for documentation and
+// the latest news.
+//
+/////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
+//
+// This code is free for personal and commercial use, providing this
+// notice remains intact in the source files and all eventual changes are
+// clearly marked with comments.
+//
+// You must obtain the author's consent before you can include this code
+// in a software library.
+//
+// No warrantee of any kind, express or implied, is included with this
+// software; use at your own risk, responsibility for damages (if any) to
+// anyone resulting from the use of this software rests entirely with the
+// user.
+//
+// Send bug reports, bug fixes, enhancements, requests, flames, etc. to
+// cristi@datamekanix.com or post them at the message board at the site.
+/////////////////////////////////////////////////////////////////////////
+
+#if !defined(__SCBARCF_H__)
+#define __SCBARCF_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+// scbarcf.h : header file
+//
+
+#include "scbarg.h"
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBarCF
+
+#ifndef baseCSizingControlBarCF
+#define baseCSizingControlBarCF CSizingControlBarG
+#endif
+
+class CSizingControlBarCF : public baseCSizingControlBarCF
+{
+ DECLARE_DYNAMIC(CSizingControlBarCF)
+
+// Construction
+public:
+ CSizingControlBarCF();
+
+// Overridables
+ virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
+
+// Implementation
+protected:
+ // implementation helpers
+ virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
+
+protected:
+ BOOL m_bActive; // a child has focus
+ CString m_sFontFace;
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CSizingControlBarCF)
+ //}}AFX_MSG
+ afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
+
+ DECLARE_MESSAGE_MAP()
+};
+
+/////////////////////////////////////////////////////////////////////////
+
+#endif // !defined(__SCBARCF_H__)
diff --git a/src/ui/sizecbar/scbarg.cpp b/src/ui/sizecbar/scbarg.cpp
new file mode 100644
index 000000000..f6eb86485
--- /dev/null
+++ b/src/ui/sizecbar/scbarg.cpp
@@ -0,0 +1,242 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// CSizingControlBarG Version 2.43
+//
+// Created: Jan 24, 1998 Last Modified: August 03, 2000
+//
+// See the official site at www.datamekanix.com for documentation and
+// the latest news.
+//
+/////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
+//
+// This code is free for personal and commercial use, providing this
+// notice remains intact in the source files and all eventual changes are
+// clearly marked with comments.
+//
+// You must obtain the author's consent before you can include this code
+// in a software library.
+//
+// No warrantee of any kind, express or implied, is included with this
+// software; use at your own risk, responsibility for damages (if any) to
+// anyone resulting from the use of this software rests entirely with the
+// user.
+//
+// Send bug reports, bug fixes, enhancements, requests, flames, etc. to
+// cristi@datamekanix.com or post them at the message board at the site.
+/////////////////////////////////////////////////////////////////////////
+
+// sizecbar.cpp : implementation file
+//
+
+#include "stdafx.h"
+
+#include "scbarg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBarG
+
+IMPLEMENT_DYNAMIC(CSizingControlBarG, baseCSizingControlBarG);
+
+CSizingControlBarG::CSizingControlBarG()
+{
+ m_cyGripper = 12;
+}
+
+CSizingControlBarG::~CSizingControlBarG()
+{
+}
+
+BEGIN_MESSAGE_MAP(CSizingControlBarG, baseCSizingControlBarG)
+ //{{AFX_MSG_MAP(CSizingControlBarG)
+ ON_WM_NCLBUTTONUP()
+ ON_WM_NCHITTEST()
+ //}}AFX_MSG_MAP
+ ON_MESSAGE(WM_SETTEXT, OnSetText)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBarG message handlers
+
+/////////////////////////////////////////////////////////////////////////
+// Mouse Handling
+//
+
+void CSizingControlBarG::OnNcLButtonUp(UINT nHitTest, CPoint point)
+{
+ if (nHitTest == HTCLOSE)
+ m_pDockSite->ShowControlBar(this, FALSE, FALSE); // hide
+
+ baseCSizingControlBarG::OnNcLButtonUp(nHitTest, point);
+}
+
+void CSizingControlBarG::NcCalcClient(LPRECT pRc, UINT nDockBarID)
+{
+ CRect rcBar(pRc); // save the bar rect
+
+ // subtract edges
+ baseCSizingControlBarG::NcCalcClient(pRc, nDockBarID);
+
+ if (!HasGripper())
+ return;
+
+ CRect rc(pRc); // the client rect as calculated by the base class
+
+ BOOL bHorz = (nDockBarID == AFX_IDW_DOCKBAR_TOP) ||
+ (nDockBarID == AFX_IDW_DOCKBAR_BOTTOM);
+
+ if (bHorz)
+ rc.DeflateRect(m_cyGripper, 0, 0, 0);
+ else
+ rc.DeflateRect(0, m_cyGripper, 0, 0);
+
+ // set position for the "x" (hide bar) button
+ CPoint ptOrgBtn;
+ if (bHorz)
+ ptOrgBtn = CPoint(rc.left - 13, rc.top);
+ else
+ ptOrgBtn = CPoint(rc.right - 12, rc.top - 13);
+
+ m_biHide.Move(ptOrgBtn - rcBar.TopLeft());
+
+ *pRc = rc;
+}
+
+void CSizingControlBarG::NcPaintGripper(CDC* pDC, CRect rcClient)
+{
+ if (!HasGripper())
+ return;
+
+ // paints a simple "two raised lines" gripper
+ // override this if you want a more sophisticated gripper
+ CRect gripper = rcClient;
+ CRect rcbtn = m_biHide.GetRect();
+ BOOL bHorz = IsHorzDocked();
+
+ gripper.DeflateRect(1, 1);
+ if (bHorz)
+ { // gripper at left
+ gripper.left -= m_cyGripper;
+ gripper.right = gripper.left + 3;
+ gripper.top = rcbtn.bottom + 3;
+ }
+ else
+ { // gripper at top
+ gripper.top -= m_cyGripper;
+ gripper.bottom = gripper.top + 3;
+ gripper.right = rcbtn.left - 3;
+ }
+
+ pDC->Draw3dRect(gripper, ::GetSysColor(COLOR_BTNHIGHLIGHT),
+ ::GetSysColor(COLOR_BTNSHADOW));
+
+ gripper.OffsetRect(bHorz ? 3 : 0, bHorz ? 0 : 3);
+
+ pDC->Draw3dRect(gripper, ::GetSysColor(COLOR_BTNHIGHLIGHT),
+ ::GetSysColor(COLOR_BTNSHADOW));
+
+ m_biHide.Paint(pDC);
+}
+
+UINT CSizingControlBarG::OnNcHitTest(CPoint point)
+{
+ CRect rcBar;
+ GetWindowRect(rcBar);
+
+ LRESULT nRet = baseCSizingControlBarG::OnNcHitTest(point);
+ if (nRet != HTCLIENT)
+ return nRet;
+
+ CRect rc = m_biHide.GetRect();
+ rc.OffsetRect(rcBar.TopLeft());
+ if (rc.PtInRect(point))
+ return HTCLOSE;
+
+ return HTCLIENT;
+}
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBarG implementation helpers
+
+void CSizingControlBarG::OnUpdateCmdUI(CFrameWnd* pTarget,
+ BOOL bDisableIfNoHndler)
+{
+ UNUSED_ALWAYS(bDisableIfNoHndler);
+ UNUSED_ALWAYS(pTarget);
+
+ if (!HasGripper())
+ return;
+
+ BOOL bNeedPaint = FALSE;
+
+ CPoint pt;
+ ::GetCursorPos(&pt);
+ BOOL bHit = (OnNcHitTest(pt) == HTCLOSE);
+ BOOL bLButtonDown = (::GetKeyState(VK_LBUTTON) < 0);
+
+ BOOL bWasPushed = m_biHide.bPushed;
+ m_biHide.bPushed = bHit && bLButtonDown;
+
+ BOOL bWasRaised = m_biHide.bRaised;
+ m_biHide.bRaised = bHit && !bLButtonDown;
+
+ bNeedPaint |= (m_biHide.bPushed ^ bWasPushed) ||
+ (m_biHide.bRaised ^ bWasRaised);
+
+ if (bNeedPaint)
+ SendMessage(WM_NCPAINT);
+}
+
+/////////////////////////////////////////////////////////////////////////
+// CSCBButton
+
+CSCBButton::CSCBButton()
+{
+ bRaised = FALSE;
+ bPushed = FALSE;
+}
+
+void CSCBButton::Paint(CDC* pDC)
+{
+ CRect rc = GetRect();
+
+ if (bPushed)
+ pDC->Draw3dRect(rc, ::GetSysColor(COLOR_BTNSHADOW),
+ ::GetSysColor(COLOR_BTNHIGHLIGHT));
+ else
+ if (bRaised)
+ pDC->Draw3dRect(rc, ::GetSysColor(COLOR_BTNHIGHLIGHT),
+ ::GetSysColor(COLOR_BTNSHADOW));
+
+ COLORREF clrOldTextColor = pDC->GetTextColor();
+ pDC->SetTextColor(::GetSysColor(COLOR_BTNTEXT));
+ int nPrevBkMode = pDC->SetBkMode(TRANSPARENT);
+ CFont font;
+ int ppi = pDC->GetDeviceCaps(LOGPIXELSX);
+ int pointsize = MulDiv(60, 96, ppi); // 6 points at 96 ppi
+ font.CreatePointFont(pointsize, _T("Marlett"));
+ CFont* oldfont = pDC->SelectObject(&font);
+
+ pDC->TextOut(ptOrg.x + 2, ptOrg.y + 2, CString(_T("r"))); // x-like
+
+ pDC->SelectObject(oldfont);
+ pDC->SetBkMode(nPrevBkMode);
+ pDC->SetTextColor(clrOldTextColor);
+}
+
+BOOL CSizingControlBarG::HasGripper() const
+{
+#if defined(_SCB_MINIFRAME_CAPTION) || !defined(_SCB_REPLACE_MINIFRAME)
+ // if the miniframe has a caption, don't display the gripper
+ if (IsFloating())
+ return FALSE;
+#endif //_SCB_MINIFRAME_CAPTION
+
+ return TRUE;
+} \ No newline at end of file
diff --git a/src/ui/sizecbar/scbarg.h b/src/ui/sizecbar/scbarg.h
new file mode 100644
index 000000000..160850c6a
--- /dev/null
+++ b/src/ui/sizecbar/scbarg.h
@@ -0,0 +1,113 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// CSizingControlBarG Version 2.43
+//
+// Created: Jan 24, 1998 Last Modified: August 03, 2000
+//
+// See the official site at www.datamekanix.com for documentation and
+// the latest news.
+//
+/////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
+//
+// This code is free for personal and commercial use, providing this
+// notice remains intact in the source files and all eventual changes are
+// clearly marked with comments.
+//
+// You must obtain the author's consent before you can include this code
+// in a software library.
+//
+// No warrantee of any kind, express or implied, is included with this
+// software; use at your own risk, responsibility for damages (if any) to
+// anyone resulting from the use of this software rests entirely with the
+// user.
+//
+// Send bug reports, bug fixes, enhancements, requests, flames, etc. to
+// cristi@datamekanix.com or post them at the message board at the site.
+/////////////////////////////////////////////////////////////////////////
+
+#if !defined(__SCBARG_H__)
+#define __SCBARG_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#include "sizecbar.h"
+
+/////////////////////////////////////////////////////////////////////////
+// CSCBButton (button info) helper class
+
+class CSCBButton
+{
+public:
+ CSCBButton();
+
+ void Move(CPoint ptTo) {ptOrg = ptTo; };
+ CRect GetRect() { return CRect(ptOrg, CSize(11, 11)); };
+ void Paint(CDC* pDC);
+
+ BOOL bPushed;
+ BOOL bRaised;
+
+protected:
+ CPoint ptOrg;
+};
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBar control bar
+
+#ifndef baseCSizingControlBarG
+#define baseCSizingControlBarG CSizingControlBar
+#endif
+
+class CSizingControlBarG : public baseCSizingControlBarG
+{
+ DECLARE_DYNAMIC(CSizingControlBarG);
+
+// Construction
+public:
+ CSizingControlBarG();
+
+// Attributes
+public:
+ virtual BOOL HasGripper() const;
+
+// Operations
+public:
+
+// Overridables
+ virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
+
+// Overrides
+public:
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CSizingControlBarG)
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ virtual ~CSizingControlBarG();
+
+protected:
+ // implementation helpers
+ virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
+ virtual void NcCalcClient(LPRECT pRc, UINT nDockBarID);
+
+protected:
+ int m_cyGripper;
+
+ CSCBButton m_biHide;
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CSizingControlBarG)
+ afx_msg UINT OnNcHitTest(CPoint point);
+ afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point);
+ //}}AFX_MSG
+
+ DECLARE_MESSAGE_MAP()
+};
+
+#endif // !defined(__SCBARG_H__)
+
diff --git a/src/ui/sizecbar/sizecbar.cpp b/src/ui/sizecbar/sizecbar.cpp
new file mode 100644
index 000000000..e5e9c9fe0
--- /dev/null
+++ b/src/ui/sizecbar/sizecbar.cpp
@@ -0,0 +1,1419 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// CSizingControlBar Version 2.43
+//
+// Created: Jan 24, 1998 Last Modified: August 03, 2000
+//
+// See the official site at www.datamekanix.com for documentation and
+// the latest news.
+//
+/////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
+//
+// This code is free for personal and commercial use, providing this
+// notice remains intact in the source files and all eventual changes are
+// clearly marked with comments.
+//
+// You must obtain the author's consent before you can include this code
+// in a software library.
+//
+// No warrantee of any kind, express or implied, is included with this
+// software; use at your own risk, responsibility for damages (if any) to
+// anyone resulting from the use of this software rests entirely with the
+// user.
+//
+// Send bug reports, bug fixes, enhancements, requests, flames, etc. to
+// cristi@datamekanix.com or post them at the message board at the site.
+//
+// The sources and a short version of the docs are also available at
+// www.codeproject.com . Look for a "Docking Windows" section and check
+// the version to be sure you get the latest one ;)
+//
+// Hint: These classes are intended to be used as base classes. Do not
+// simply add your code to these file - instead create a new class
+// derived from one of CSizingControlBarXX classes and put there what
+// you need. See CMyBar classes in the demo projects for examples.
+// Modify this file only to fix bugs, and don't forget to send me a copy.
+/////////////////////////////////////////////////////////////////////////
+// Acknowledgements:
+// o Thanks to Harlan R. Seymour for his continuous support during
+// development of this code.
+// o Thanks to Dundas Software for the opportunity
+// to test this code on real-life applications.
+// o Some ideas for the gripper came from the CToolBarEx flat toolbar
+// by Joerg Koenig. Thanks, Joerg!
+// o Thanks to Robert Wolpow for the code on which CDockContext based
+// dialgonal resizing is based.
+// o Thanks to the following people for various bug fixes and/or
+// enhancements: Chris Maunder, Jakawan Ratiwanich, Udo Schaefer,
+// Anatoly Ivasyuk, Peter Hauptmann.
+// o And, of course, many thanks to all of you who used this code,
+// for the invaluable feedback I received.
+/////////////////////////////////////////////////////////////////////////
+
+// sizecbar.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "sizecbar.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBar
+
+IMPLEMENT_DYNAMIC(CSizingControlBar, baseCSizingControlBar);
+
+CSizingControlBar::CSizingControlBar()
+{
+ m_szMinHorz = CSize(33, 32);
+ m_szMinVert = CSize(33, 32);
+ m_szMinFloat = CSize(37, 32);
+ m_szHorz = CSize(200, 200);
+ m_szVert = CSize(200, 200);
+ m_szFloat = CSize(200, 200);
+ m_bTracking = FALSE;
+ m_bKeepSize = FALSE;
+ m_bParentSizing = FALSE;
+ m_cxEdge = 5;
+ m_bDragShowContent = FALSE;
+ m_nDockBarID = 0;
+ m_dwSCBStyle = 0;
+}
+
+CSizingControlBar::~CSizingControlBar()
+{
+}
+
+BEGIN_MESSAGE_MAP(CSizingControlBar, baseCSizingControlBar)
+ //{{AFX_MSG_MAP(CSizingControlBar)
+ ON_WM_CREATE()
+ ON_WM_PAINT()
+ ON_WM_NCPAINT()
+ ON_WM_NCCALCSIZE()
+ ON_WM_WINDOWPOSCHANGING()
+ ON_WM_CAPTURECHANGED()
+ ON_WM_SETTINGCHANGE()
+ ON_WM_LBUTTONUP()
+ ON_WM_MOUSEMOVE()
+ ON_WM_NCLBUTTONDOWN()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_LBUTTONDBLCLK()
+ ON_WM_RBUTTONDOWN()
+ ON_WM_NCMOUSEMOVE()
+ ON_WM_NCHITTEST()
+ ON_WM_CLOSE()
+ ON_WM_SIZE()
+ //}}AFX_MSG_MAP
+ ON_MESSAGE(WM_SETTEXT, OnSetText)
+END_MESSAGE_MAP()
+
+// old creation method, still here for compatibility reasons
+BOOL CSizingControlBar::Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
+ CSize sizeDefault, BOOL bHasGripper,
+ UINT nID, DWORD dwStyle)
+{
+ UNUSED_ALWAYS(bHasGripper);
+
+ m_szHorz = m_szVert = m_szFloat = sizeDefault;
+ return Create(lpszWindowName, pParentWnd, nID, dwStyle);
+}
+
+// preffered creation method
+BOOL CSizingControlBar::Create(LPCTSTR lpszWindowName,
+ CWnd* pParentWnd, UINT nID,
+ DWORD dwStyle)
+{
+ // must have a parent
+ ASSERT_VALID(pParentWnd);
+ // cannot be both fixed and dynamic
+ // (CBRS_SIZE_DYNAMIC is used for resizng when floating)
+ ASSERT (!((dwStyle & CBRS_SIZE_FIXED) &&
+ (dwStyle & CBRS_SIZE_DYNAMIC)));
+
+ m_dwStyle = dwStyle & CBRS_ALL; // save the control bar styles
+
+ // register and create the window - skip CControlBar::Create()
+ CString wndclass = ::AfxRegisterWndClass(CS_DBLCLKS,
+ ::LoadCursor(NULL, IDC_ARROW),
+ ::GetSysColorBrush(COLOR_BTNFACE), 0);
+
+ dwStyle &= ~CBRS_ALL; // keep only the generic window styles
+ dwStyle |= WS_CLIPCHILDREN; // prevents flashing
+ if (!CWnd::Create(wndclass, lpszWindowName, dwStyle,
+ CRect(0, 0, 0, 0), pParentWnd, nID))
+ return FALSE;
+
+ return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBar operations
+#if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION)
+void CSizingControlBar::EnableDocking(DWORD dwDockStyle)
+{
+ // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only
+ ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
+ // cannot have the CBRS_FLOAT_MULTI style
+ ASSERT((dwDockStyle & CBRS_FLOAT_MULTI) == 0);
+ // the bar must have CBRS_SIZE_DYNAMIC style
+ ASSERT((m_dwStyle & CBRS_SIZE_DYNAMIC) != 0);
+
+ m_dwDockStyle = dwDockStyle;
+ if (m_pDockContext == NULL)
+ m_pDockContext = new CSCBDockContext(this);
+
+ // permanently wire the bar's owner to its current parent
+ if (m_hWndOwner == NULL)
+ m_hWndOwner = ::GetParent(m_hWnd);
+}
+#endif
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBar message handlers
+
+int CSizingControlBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if (baseCSizingControlBar::OnCreate(lpCreateStruct) == -1)
+ return -1;
+
+ // query SPI_GETDRAGFULLWINDOWS system parameter
+ // OnSettingChange() will update m_bDragShowContent
+ m_bDragShowContent = FALSE;
+ ::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0,
+ &m_bDragShowContent, 0);
+
+ // uncomment this line if you want raised borders
+// m_dwSCBStyle |= SCBS_SHOWEDGES;
+
+ return 0;
+}
+
+
+LRESULT CSizingControlBar::OnSetText(WPARAM wParam, LPARAM lParam)
+{
+ UNUSED_ALWAYS(wParam);
+
+ LRESULT lResult = CWnd::Default();
+
+ if (IsFloating() &&
+ GetParentFrame()->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd)))
+ {
+ m_pDockBar->SetWindowText((LPCTSTR) lParam); // update dockbar
+ GetParentFrame()->DelayRecalcLayout(); // refresh miniframe
+ }
+
+ return lResult;
+}
+
+const BOOL CSizingControlBar::IsFloating() const
+{
+ return !IsHorzDocked() && !IsVertDocked();
+}
+
+const BOOL CSizingControlBar::IsHorzDocked() const
+{
+ return (m_nDockBarID == AFX_IDW_DOCKBAR_TOP ||
+ m_nDockBarID == AFX_IDW_DOCKBAR_BOTTOM);
+}
+
+const BOOL CSizingControlBar::IsVertDocked() const
+{
+ return (m_nDockBarID == AFX_IDW_DOCKBAR_LEFT ||
+ m_nDockBarID == AFX_IDW_DOCKBAR_RIGHT);
+}
+
+const BOOL CSizingControlBar::IsSideTracking() const
+{
+ // don't call this when not tracking
+ ASSERT(m_bTracking && !IsFloating());
+
+ return (m_htEdge == HTLEFT || m_htEdge == HTRIGHT) ?
+ IsHorzDocked() : IsVertDocked();
+}
+
+CSize CSizingControlBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
+{
+ if (bStretch) // the bar is stretched (is not the child of a dockbar)
+ if (bHorz)
+ return CSize(32767, m_szHorz.cy);
+ else
+ return CSize(m_szVert.cx, 32767);
+
+ // dirty cast - we need access to protected CDockBar members
+ CSCBDockBar* pDockBar = (CSCBDockBar*) m_pDockBar;
+
+ // force imediate RecalcDelayShow() for all sizing bars on the row
+ // with delayShow/delayHide flags set to avoid IsVisible() problems
+ CSCBArray arrSCBars;
+ GetRowSizingBars(arrSCBars);
+ AFX_SIZEPARENTPARAMS layout;
+ layout.hDWP = pDockBar->m_bLayoutQuery ?
+ NULL : ::BeginDeferWindowPos(arrSCBars.GetSize());
+ for (int i = 0; i < arrSCBars.GetSize(); i++)
+ if (arrSCBars[i]->m_nStateFlags & (delayHide|delayShow))
+ arrSCBars[i]->RecalcDelayShow(&layout);
+ if (layout.hDWP != NULL)
+ ::EndDeferWindowPos(layout.hDWP);
+
+ // get available length
+ CRect rc = pDockBar->m_rectLayout;
+ if (rc.IsRectEmpty())
+ m_pDockSite->GetClientRect(&rc);
+ int nLengthTotal = bHorz ? rc.Width() + 2 : rc.Height() - 2;
+
+ if (IsVisible() && !IsFloating() &&
+ m_bParentSizing && arrSCBars[0] == this)
+ if (NegotiateSpace(nLengthTotal, (bHorz != FALSE)))
+ AlignControlBars();
+
+ m_bParentSizing = FALSE;
+
+ if (bHorz)
+ return CSize(max(m_szMinHorz.cx, m_szHorz.cx),
+ max(m_szMinHorz.cy, m_szHorz.cy));
+
+ return CSize(max(m_szMinVert.cx, m_szVert.cx),
+ max(m_szMinVert.cy, m_szVert.cy));
+}
+
+CSize CSizingControlBar::CalcDynamicLayout(int nLength, DWORD dwMode)
+{
+ if (dwMode & (LM_HORZDOCK | LM_VERTDOCK)) // docked ?
+ {
+ if (nLength == -1)
+ m_bParentSizing = TRUE;
+
+ return baseCSizingControlBar::CalcDynamicLayout(nLength, dwMode);
+ }
+
+ if (dwMode & LM_MRUWIDTH) return m_szFloat;
+ if (dwMode & LM_COMMIT) return m_szFloat; // already committed
+
+#ifndef _SCB_REPLACE_MINIFRAME
+ // check for dialgonal resizing hit test
+ int nHitTest = m_pDockContext->m_nHitTest;
+ if (IsFloating() &&
+ (nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT ||
+ nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT))
+ {
+ CPoint ptCursor;
+ ::GetCursorPos(&ptCursor);
+
+ CRect rFrame, rBar;
+ GetParentFrame()->GetWindowRect(&rFrame);
+ GetWindowRect(&rBar);
+
+ if (nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT)
+ {
+ m_szFloat.cx = rFrame.left + rBar.Width() - ptCursor.x;
+ m_pDockContext->m_rectFrameDragHorz.left =
+ min(ptCursor.x, rFrame.left + rBar.Width() - m_szMinFloat.cx);
+ }
+
+ if (nHitTest == HTTOPLEFT || nHitTest == HTTOPRIGHT)
+ {
+ m_szFloat.cy = rFrame.top + rBar.Height() - ptCursor.y;
+ m_pDockContext->m_rectFrameDragHorz.top =
+ min(ptCursor.y, rFrame.top + rBar.Height() - m_szMinFloat.cy);
+ }
+
+ if (nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT)
+ m_szFloat.cx = rBar.Width() + ptCursor.x - rFrame.right;
+
+ if (nHitTest == HTBOTTOMLEFT || nHitTest == HTBOTTOMRIGHT)
+ m_szFloat.cy = rBar.Height() + ptCursor.y - rFrame.bottom;
+ }
+ else
+#endif //_SCB_REPLACE_MINIFRAME
+ ((dwMode & LM_LENGTHY) ? m_szFloat.cy : m_szFloat.cx) = nLength;
+
+ m_szFloat.cx = max(m_szFloat.cx, m_szMinFloat.cx);
+ m_szFloat.cy = max(m_szFloat.cy, m_szMinFloat.cy);
+
+ return m_szFloat;
+}
+
+void CSizingControlBar::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
+{
+ // force non-client recalc if moved or resized
+ lpwndpos->flags |= SWP_FRAMECHANGED;
+
+ baseCSizingControlBar::OnWindowPosChanging(lpwndpos);
+
+ // find on which side are we docked
+ m_nDockBarID = GetParent()->GetDlgCtrlID();
+
+ if (!IsFloating())
+ if (lpwndpos->flags & SWP_SHOWWINDOW)
+ m_bKeepSize = TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////
+// Mouse Handling
+//
+void CSizingControlBar::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ if (m_pDockBar != NULL)
+ {
+ // start the drag
+ ASSERT(m_pDockContext != NULL);
+ ClientToScreen(&point);
+ m_pDockContext->StartDrag(point);
+ }
+ else
+ CWnd::OnLButtonDown(nFlags, point);
+}
+
+void CSizingControlBar::OnLButtonDblClk(UINT nFlags, CPoint point)
+{
+ if (m_pDockBar != NULL)
+ {
+ // toggle docking
+ ASSERT(m_pDockContext != NULL);
+ m_pDockContext->ToggleDocking();
+ }
+ else
+ CWnd::OnLButtonDblClk(nFlags, point);
+}
+
+void CSizingControlBar::OnNcLButtonDown(UINT nHitTest, CPoint point)
+{
+ UNUSED_ALWAYS(point);
+
+ if (m_bTracking || IsFloating())
+ return;
+
+ if ((nHitTest >= HTSIZEFIRST) && (nHitTest <= HTSIZELAST))
+ StartTracking(nHitTest, point); // sizing edge hit
+}
+
+void CSizingControlBar::OnLButtonUp(UINT nFlags, CPoint point)
+{
+ if (m_bTracking)
+ StopTracking();
+
+ baseCSizingControlBar::OnLButtonUp(nFlags, point);
+}
+
+void CSizingControlBar::OnRButtonDown(UINT nFlags, CPoint point)
+{
+ if (m_bTracking)
+ StopTracking();
+
+ baseCSizingControlBar::OnRButtonDown(nFlags, point);
+}
+
+void CSizingControlBar::OnMouseMove(UINT nFlags, CPoint point)
+{
+ if (m_bTracking)
+ {
+ CPoint ptScreen = point;
+ ClientToScreen(&ptScreen);
+
+ OnTrackUpdateSize(ptScreen);
+ }
+
+ baseCSizingControlBar::OnMouseMove(nFlags, point);
+}
+
+void CSizingControlBar::OnCaptureChanged(CWnd *pWnd)
+{
+ if (m_bTracking && (pWnd != this))
+ StopTracking();
+
+ baseCSizingControlBar::OnCaptureChanged(pWnd);
+}
+
+void CSizingControlBar::OnNcCalcSize(BOOL bCalcValidRects,
+ NCCALCSIZE_PARAMS FAR* lpncsp)
+{
+ UNUSED_ALWAYS(bCalcValidRects);
+
+#ifndef _SCB_REPLACE_MINIFRAME
+ // Enable diagonal resizing for floating miniframe
+ if (IsFloating())
+ {
+ CFrameWnd* pFrame = GetParentFrame();
+ if (pFrame != NULL &&
+ pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)))
+ {
+ DWORD dwStyle = ::GetWindowLong(pFrame->m_hWnd, GWL_STYLE);
+ if ((dwStyle & MFS_4THICKFRAME) != 0)
+ {
+ pFrame->ModifyStyle(MFS_4THICKFRAME, 0); // clear
+ GetParent()->ModifyStyle(0, WS_CLIPCHILDREN);
+ }
+ }
+ }
+#endif _SCB_REPLACE_MINIFRAME
+
+ // compute the the client area
+ m_dwSCBStyle &= ~SCBS_EDGEALL;
+
+ // add resizing edges between bars on the same row
+ if (!IsFloating() && m_pDockBar != NULL)
+ {
+ CSCBArray arrSCBars;
+ int nThis;
+ GetRowSizingBars(arrSCBars, nThis);
+
+ BOOL bHorz = IsHorzDocked();
+ if (nThis > 0)
+ m_dwSCBStyle |= bHorz ? SCBS_EDGELEFT : SCBS_EDGETOP;
+
+ if (nThis < arrSCBars.GetUpperBound())
+ m_dwSCBStyle |= bHorz ? SCBS_EDGERIGHT : SCBS_EDGEBOTTOM;
+ }
+
+ NcCalcClient(&lpncsp->rgrc[0], m_nDockBarID);
+}
+
+void CSizingControlBar::NcCalcClient(LPRECT pRc, UINT nDockBarID)
+{
+ CRect rc(pRc);
+
+ rc.DeflateRect(3, 5, 3, 3);
+ if (nDockBarID != AFX_IDW_DOCKBAR_FLOAT)
+ rc.DeflateRect(2, 0, 2, 2);
+
+ switch(nDockBarID)
+ {
+ case AFX_IDW_DOCKBAR_TOP:
+ m_dwSCBStyle |= SCBS_EDGEBOTTOM;
+ break;
+ case AFX_IDW_DOCKBAR_BOTTOM:
+ m_dwSCBStyle |= SCBS_EDGETOP;
+ break;
+ case AFX_IDW_DOCKBAR_LEFT:
+ m_dwSCBStyle |= SCBS_EDGERIGHT;
+ break;
+ case AFX_IDW_DOCKBAR_RIGHT:
+ m_dwSCBStyle |= SCBS_EDGELEFT;
+ break;
+ }
+
+ // make room for edges only if they will be painted
+ if (m_dwSCBStyle & SCBS_SHOWEDGES)
+ rc.DeflateRect(
+ (m_dwSCBStyle & SCBS_EDGELEFT) ? m_cxEdge : 0,
+ (m_dwSCBStyle & SCBS_EDGETOP) ? m_cxEdge : 0,
+ (m_dwSCBStyle & SCBS_EDGERIGHT) ? m_cxEdge : 0,
+ (m_dwSCBStyle & SCBS_EDGEBOTTOM) ? m_cxEdge : 0);
+
+ *pRc = rc;
+}
+
+void CSizingControlBar::OnNcPaint()
+{
+ // get window DC that is clipped to the non-client area
+ CWindowDC dc(this);
+
+ CRect rcClient, rcBar;
+ GetClientRect(rcClient);
+ ClientToScreen(rcClient);
+ GetWindowRect(rcBar);
+ rcClient.OffsetRect(-rcBar.TopLeft());
+ rcBar.OffsetRect(-rcBar.TopLeft());
+
+ CDC mdc;
+ mdc.CreateCompatibleDC(&dc);
+
+ CBitmap bm;
+ bm.CreateCompatibleBitmap(&dc, rcBar.Width(), rcBar.Height());
+ CBitmap* pOldBm = mdc.SelectObject(&bm);
+
+ // draw borders in non-client area
+ CRect rcDraw = rcBar;
+ DrawBorders(&mdc, rcDraw);
+
+ // erase the NC background
+ mdc.FillRect(rcDraw, CBrush::FromHandle(
+ (HBRUSH) GetClassLong(m_hWnd, GCL_HBRBACKGROUND)));
+
+ if (m_dwSCBStyle & SCBS_SHOWEDGES)
+ {
+ CRect rcEdge; // paint the sizing edges
+ for (int i = 0; i < 4; i++)
+ if (GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
+ mdc.Draw3dRect(rcEdge, ::GetSysColor(COLOR_BTNHIGHLIGHT),
+ ::GetSysColor(COLOR_BTNSHADOW));
+ }
+
+ NcPaintGripper(&mdc, rcClient);
+
+ // client area is not our bussiness :)
+ dc.IntersectClipRect(rcBar);
+ dc.ExcludeClipRect(rcClient);
+
+ dc.BitBlt(0, 0, rcBar.Width(), rcBar.Height(), &mdc, 0, 0, SRCCOPY);
+
+ ReleaseDC(&dc);
+
+ mdc.SelectObject(pOldBm);
+ bm.DeleteObject();
+ mdc.DeleteDC();
+}
+
+void CSizingControlBar::NcPaintGripper(CDC* pDC, CRect rcClient)
+{
+ UNUSED_ALWAYS(pDC);
+ UNUSED_ALWAYS(rcClient);
+}
+
+void CSizingControlBar::OnPaint()
+{
+ // overridden to skip border painting based on clientrect
+ CPaintDC dc(this);
+}
+
+UINT CSizingControlBar::OnNcHitTest(CPoint point)
+{
+ CRect rcBar, rcEdge;
+ GetWindowRect(rcBar);
+
+ if (!IsFloating())
+ for (int i = 0; i < 4; i++)
+ if (GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
+ if (rcEdge.PtInRect(point))
+ return GetEdgeHTCode(i);
+
+ return HTCLIENT;
+}
+
+void CSizingControlBar::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
+{
+ baseCSizingControlBar::OnSettingChange(uFlags, lpszSection);
+
+ m_bDragShowContent = FALSE;
+ ::SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0,
+ &m_bDragShowContent, 0); // update
+}
+
+void CSizingControlBar::OnSize(UINT nType, int cx, int cy)
+{
+ UNUSED_ALWAYS(nType);
+
+ if ((m_dwSCBStyle & SCBS_SIZECHILD) != 0)
+ {
+ // automatic child resizing - only one child is allowed
+ CWnd* pWnd = GetWindow(GW_CHILD);
+ if (pWnd != NULL)
+ {
+ pWnd->MoveWindow(0, 0, cx, cy);
+ ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
+ }
+ }
+}
+
+void CSizingControlBar::OnClose()
+{
+ // do nothing: protection against accidentally destruction by the
+ // child control (i.e. if user hits Esc in a child editctrl)
+}
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBar implementation helpers
+
+void CSizingControlBar::StartTracking(UINT nHitTest, CPoint point)
+{
+ SetCapture();
+
+ // make sure no updates are pending
+ if (!m_bDragShowContent)
+ RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
+
+ m_htEdge = nHitTest;
+ m_bTracking = TRUE;
+
+ BOOL bHorz = IsHorzDocked();
+ BOOL bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
+
+ m_nTrackPosOld = bHorzTracking ? point.x : point.y;
+
+ CRect rcBar, rcEdge;
+ GetWindowRect(rcBar);
+ GetEdgeRect(rcBar, m_htEdge, rcEdge);
+ m_nTrackEdgeOfs = m_nTrackPosOld -
+ (bHorzTracking ? rcEdge.CenterPoint().x : rcEdge.CenterPoint().y);
+
+ CSCBArray arrSCBars;
+ int nThis;
+ GetRowSizingBars(arrSCBars, nThis);
+
+ m_nTrackPosMin = m_nTrackPosMax = m_nTrackPosOld;
+ if (!IsSideTracking())
+ {
+ // calc minwidth as the max minwidth of the sizing bars on row
+ int nMinWidth = bHorz ? m_szMinHorz.cy : m_szMinVert.cx;
+ for (int i = 0; i < arrSCBars.GetSize(); i++)
+ nMinWidth = max(nMinWidth, bHorz ?
+ arrSCBars[i]->m_szMinHorz.cy :
+ arrSCBars[i]->m_szMinVert.cx);
+ int nExcessWidth = (bHorz ? m_szHorz.cy : m_szVert.cx) - nMinWidth;
+
+ // the control bar cannot grow with more than the width of
+ // remaining client area of the mainframe
+ CRect rcT;
+ m_pDockSite->RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST,
+ reposQuery, &rcT, NULL, TRUE);
+ int nMaxWidth = bHorz ? rcT.Height() - 2 : rcT.Width() - 2;
+
+ BOOL bTopOrLeft = m_htEdge == HTTOP || m_htEdge == HTLEFT;
+
+ m_nTrackPosMin -= bTopOrLeft ? nMaxWidth : nExcessWidth;
+ m_nTrackPosMax += bTopOrLeft ? nExcessWidth : nMaxWidth;
+ }
+ else
+ {
+ // side tracking:
+ // max size is the actual size plus the amount the other
+ // sizing bars can be decreased until they reach their minsize
+ if (m_htEdge == HTBOTTOM || m_htEdge == HTRIGHT)
+ nThis++;
+
+ for (int i = 0; i < arrSCBars.GetSize(); i++)
+ {
+ CSizingControlBar* pBar = arrSCBars[i];
+
+ int nExcessWidth = bHorz ?
+ pBar->m_szHorz.cx - pBar->m_szMinHorz.cx :
+ pBar->m_szVert.cy - pBar->m_szMinVert.cy;
+
+ if (i < nThis)
+ m_nTrackPosMin -= nExcessWidth;
+ else
+ m_nTrackPosMax += nExcessWidth;
+ }
+ }
+
+ OnTrackInvertTracker(); // draw tracker
+}
+
+void CSizingControlBar::StopTracking()
+{
+ OnTrackInvertTracker(); // erase tracker
+
+ m_bTracking = FALSE;
+ ReleaseCapture();
+
+ m_pDockSite->DelayRecalcLayout();
+}
+
+void CSizingControlBar::OnTrackUpdateSize(CPoint& point)
+{
+ ASSERT(!IsFloating());
+
+ BOOL bHorzTrack = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
+
+ int nTrackPos = bHorzTrack ? point.x : point.y;
+ nTrackPos = max(m_nTrackPosMin, min(m_nTrackPosMax, nTrackPos));
+
+ int nDelta = nTrackPos - m_nTrackPosOld;
+
+ if (nDelta == 0)
+ return; // no pos change
+
+ OnTrackInvertTracker(); // erase tracker
+
+ m_nTrackPosOld = nTrackPos;
+
+ BOOL bHorz = IsHorzDocked();
+
+ CSize sizeNew = bHorz ? m_szHorz : m_szVert;
+ switch (m_htEdge)
+ {
+ case HTLEFT: sizeNew -= CSize(nDelta, 0); break;
+ case HTTOP: sizeNew -= CSize(0, nDelta); break;
+ case HTRIGHT: sizeNew += CSize(nDelta, 0); break;
+ case HTBOTTOM: sizeNew += CSize(0, nDelta); break;
+ }
+
+ CSCBArray arrSCBars;
+ int nThis;
+ GetRowSizingBars(arrSCBars, nThis);
+
+ if (!IsSideTracking())
+ for (int i = 0; i < arrSCBars.GetSize(); i++)
+ {
+ CSizingControlBar* pBar = arrSCBars[i];
+ // make same width (or height)
+ (bHorz ? pBar->m_szHorz.cy : pBar->m_szVert.cx) =
+ bHorz ? sizeNew.cy : sizeNew.cx;
+ }
+ else
+ {
+ int nGrowingBar = nThis;
+ BOOL bBefore = m_htEdge == HTTOP || m_htEdge == HTLEFT;
+ if (bBefore && nDelta > 0)
+ nGrowingBar--;
+ if (!bBefore && nDelta < 0)
+ nGrowingBar++;
+ if (nGrowingBar != nThis)
+ bBefore = !bBefore;
+
+ // nGrowing is growing
+ nDelta = abs(nDelta);
+ CSizingControlBar* pBar = arrSCBars[nGrowingBar];
+ (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) += nDelta;
+
+ // the others are shrinking
+ int nFirst = bBefore ? nGrowingBar - 1 : nGrowingBar + 1;
+ int nLimit = bBefore ? -1 : arrSCBars.GetSize();
+
+ for (int i = nFirst; nDelta != 0 && i != nLimit; i += (bBefore ? -1 : 1))
+ {
+ CSizingControlBar* pBar = arrSCBars[i];
+
+ int nDeltaT = min(nDelta,
+ (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) -
+ (bHorz ? pBar->m_szMinHorz.cx : pBar->m_szMinVert.cy));
+
+ (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) -= nDeltaT;
+ nDelta -= nDeltaT;
+ }
+ }
+
+ OnTrackInvertTracker(); // redraw tracker at new pos
+
+ if (m_bDragShowContent)
+ m_pDockSite->DelayRecalcLayout();
+}
+
+void CSizingControlBar::OnTrackInvertTracker()
+{
+ ASSERT(m_bTracking);
+
+ if (m_bDragShowContent)
+ return; // don't show tracker if DragFullWindows is on
+
+ BOOL bHorz = IsHorzDocked();
+ CRect rc, rcBar, rcDock, rcFrame;
+ GetWindowRect(rcBar);
+ m_pDockBar->GetWindowRect(rcDock);
+ m_pDockSite->GetWindowRect(rcFrame);
+ VERIFY(GetEdgeRect(rcBar, m_htEdge, rc));
+ if (!IsSideTracking())
+ rc = bHorz ?
+ CRect(rcDock.left + 1, rc.top, rcDock.right - 1, rc.bottom) :
+ CRect(rc.left, rcDock.top + 1, rc.right, rcDock.bottom - 1);
+
+ BOOL bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
+ int nOfs = m_nTrackPosOld - m_nTrackEdgeOfs;
+ nOfs -= bHorzTracking ? rc.CenterPoint().x : rc.CenterPoint().y;
+ rc.OffsetRect(bHorzTracking ? nOfs : 0, bHorzTracking ? 0 : nOfs);
+ rc.OffsetRect(-rcFrame.TopLeft());
+
+ CDC *pDC = m_pDockSite->GetDCEx(NULL,
+ DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE);
+ CBrush* pBrush = CDC::GetHalftoneBrush();
+ CBrush* pBrushOld = pDC->SelectObject(pBrush);
+
+ pDC->PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATINVERT);
+
+ pDC->SelectObject(pBrushOld);
+ m_pDockSite->ReleaseDC(pDC);
+}
+
+BOOL CSizingControlBar::GetEdgeRect(CRect rcWnd, UINT nHitTest,
+ CRect& rcEdge)
+{
+ rcEdge = rcWnd;
+ if (m_dwSCBStyle & SCBS_SHOWEDGES)
+ rcEdge.DeflateRect(1, 1);
+ BOOL bHorz = IsHorzDocked();
+
+ switch (nHitTest)
+ {
+ case HTLEFT:
+ if (!(m_dwSCBStyle & SCBS_EDGELEFT)) return FALSE;
+ rcEdge.right = rcEdge.left + m_cxEdge;
+ rcEdge.DeflateRect(0, bHorz ? m_cxEdge: 0);
+ break;
+ case HTTOP:
+ if (!(m_dwSCBStyle & SCBS_EDGETOP)) return FALSE;
+ rcEdge.bottom = rcEdge.top + m_cxEdge;
+ rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
+ break;
+ case HTRIGHT:
+ if (!(m_dwSCBStyle & SCBS_EDGERIGHT)) return FALSE;
+ rcEdge.left = rcEdge.right - m_cxEdge;
+ rcEdge.DeflateRect(0, bHorz ? m_cxEdge: 0);
+ break;
+ case HTBOTTOM:
+ if (!(m_dwSCBStyle & SCBS_EDGEBOTTOM)) return FALSE;
+ rcEdge.top = rcEdge.bottom - m_cxEdge;
+ rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
+ break;
+ default:
+ ASSERT(FALSE); // invalid hit test code
+ }
+ return TRUE;
+}
+
+UINT CSizingControlBar::GetEdgeHTCode(int nEdge)
+{
+ if (nEdge == 0) return HTLEFT;
+ if (nEdge == 1) return HTTOP;
+ if (nEdge == 2) return HTRIGHT;
+ if (nEdge == 3) return HTBOTTOM;
+ ASSERT(FALSE); // invalid edge code
+ return HTNOWHERE;
+}
+
+void CSizingControlBar::GetRowInfo(int& nFirst, int& nLast, int& nThis)
+{
+ ASSERT_VALID(m_pDockBar); // verify bounds
+
+ nThis = m_pDockBar->FindBar(this);
+ ASSERT(nThis != -1);
+
+ int i, nBars = m_pDockBar->m_arrBars.GetSize();
+
+ // find the first and the last bar in row
+ for (nFirst = -1, i = nThis - 1; i >= 0 && nFirst == -1; i--)
+ if (m_pDockBar->m_arrBars[i] == NULL)
+ nFirst = i + 1;
+ for (nLast = -1, i = nThis + 1; i < nBars && nLast == -1; i++)
+ if (m_pDockBar->m_arrBars[i] == NULL)
+ nLast = i - 1;
+
+ ASSERT((nLast != -1) && (nFirst != -1));
+}
+
+void CSizingControlBar::GetRowSizingBars(CSCBArray& arrSCBars)
+{
+ int nThis; // dummy
+ GetRowSizingBars(arrSCBars, nThis);
+}
+
+void CSizingControlBar::GetRowSizingBars(CSCBArray& arrSCBars, int& nThis)
+{
+ arrSCBars.RemoveAll();
+
+ int nFirstT, nLastT, nThisT;
+ GetRowInfo(nFirstT, nLastT, nThisT);
+
+ nThis = -1;
+ for (int i = nFirstT; i <= nLastT; i++)
+ {
+ CSizingControlBar* pBar =
+ (CSizingControlBar*) m_pDockBar->m_arrBars[i];
+ if (HIWORD(pBar) == 0) continue; // placeholder
+ if (!pBar->IsVisible()) continue;
+ if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ {
+ if (pBar == this)
+ nThis = arrSCBars.GetSize();
+
+ arrSCBars.Add(pBar);
+ }
+ }
+}
+
+BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz)
+{
+ ASSERT(bHorz == IsHorzDocked());
+
+ int nFirst, nLast, nThis;
+ GetRowInfo(nFirst, nLast, nThis);
+
+ int nLengthAvail = nLengthTotal;
+ int nLengthActual = 0;
+ int nLengthMin = 2;
+ int nWidthMax = 0;
+ CSizingControlBar* pBar;
+
+ for (int i = nFirst; i <= nLast; i++)
+ {
+ pBar = (CSizingControlBar*) m_pDockBar->m_arrBars[i];
+ if (HIWORD(pBar) == 0) continue; // placeholder
+ if (!pBar->IsVisible()) continue;
+ BOOL bIsSizingBar =
+ pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar));
+
+ int nLengthBar; // minimum length of the bar
+ if (bIsSizingBar)
+ nLengthBar = bHorz ? pBar->m_szMinHorz.cx - 2 :
+ pBar->m_szMinVert.cy - 2;
+ else
+ {
+ CRect rcBar;
+ pBar->GetWindowRect(&rcBar);
+ nLengthBar = bHorz ? rcBar.Width() - 2 : rcBar.Height() - 2;
+ }
+
+ nLengthMin += nLengthBar;
+ if (nLengthMin > nLengthTotal)
+ {
+ // split the row after fixed bar
+ if (i < nThis)
+ {
+ m_pDockBar->m_arrBars.InsertAt(i + 1,
+ (CControlBar*) NULL);
+ return FALSE;
+ }
+
+ // only this sizebar remains on the row, adjust it to minsize
+ if (i == nThis)
+ {
+ if (bHorz)
+ m_szHorz.cx = m_szMinHorz.cx;
+ else
+ m_szVert.cy = m_szMinVert.cy;
+
+ return TRUE; // the dockbar will split the row for us
+ }
+
+ // we have enough bars - go negotiate with them
+ m_pDockBar->m_arrBars.InsertAt(i, (CControlBar*) NULL);
+ nLast = i - 1;
+ break;
+ }
+
+ if (bIsSizingBar)
+ {
+ nLengthActual += bHorz ? pBar->m_szHorz.cx - 2 :
+ pBar->m_szVert.cy - 2;
+ nWidthMax = max(nWidthMax, bHorz ? pBar->m_szHorz.cy :
+ pBar->m_szVert.cx);
+ }
+ else
+ nLengthAvail -= nLengthBar;
+ }
+
+ CSCBArray arrSCBars;
+ GetRowSizingBars(arrSCBars);
+ int nNumBars = arrSCBars.GetSize();
+ int nDelta = nLengthAvail - nLengthActual;
+
+ // return faster when there is only one sizing bar per row (this one)
+ if (nNumBars == 1)
+ {
+ ASSERT(arrSCBars[0] == this);
+
+ if (nDelta == 0)
+ return TRUE;
+
+ m_bKeepSize = FALSE;
+ (bHorz ? m_szHorz.cx : m_szVert.cy) += nDelta;
+
+ return TRUE;
+ }
+
+ // make all the bars the same width
+ for (int i = 0; i < nNumBars; i++)
+ if (bHorz)
+ arrSCBars[i]->m_szHorz.cy = nWidthMax;
+ else
+ arrSCBars[i]->m_szVert.cx = nWidthMax;
+
+ // distribute the difference between the bars,
+ // but don't shrink them below their minsizes
+ while (nDelta != 0)
+ {
+ int nDeltaOld = nDelta;
+ for (int i = 0; i < nNumBars; i++)
+ {
+ pBar = arrSCBars[i];
+ int nLMin = bHorz ?
+ pBar->m_szMinHorz.cx : pBar->m_szMinVert.cy;
+ int nL = bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy;
+
+ if ((nL == nLMin) && (nDelta < 0) || // already at min length
+ pBar->m_bKeepSize) // or wants to keep its size
+ continue;
+
+ // sign of nDelta
+ int nDelta2 = (nDelta == 0) ? 0 : ((nDelta < 0) ? -1 : 1);
+
+ (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) += nDelta2;
+ nDelta -= nDelta2;
+ if (nDelta == 0) break;
+ }
+ // clear m_bKeepSize flags
+ if ((nDeltaOld == nDelta) || (nDelta == 0))
+ for (int i = 0; i < nNumBars; i++)
+ arrSCBars[i]->m_bKeepSize = FALSE;
+ }
+
+ return TRUE;
+}
+
+void CSizingControlBar::AlignControlBars()
+{
+ int nFirst, nLast, nThis;
+ GetRowInfo(nFirst, nLast, nThis);
+
+ BOOL bHorz = IsHorzDocked();
+ BOOL bNeedRecalc = FALSE;
+ int nAlign = bHorz ? -2 : 0;
+
+ CRect rc, rcDock;
+ m_pDockBar->GetWindowRect(&rcDock);
+
+ for (int i = nFirst; i <= nLast; i++)
+ {
+ CSizingControlBar* pBar =
+ (CSizingControlBar*) m_pDockBar->m_arrBars[i];
+ if (HIWORD(pBar) == 0) continue; // placeholder
+ if (!pBar->IsVisible()) continue;
+
+ pBar->GetWindowRect(&rc);
+ rc.OffsetRect(-rcDock.TopLeft());
+
+ if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ rc = CRect(rc.TopLeft(),
+ bHorz ? pBar->m_szHorz : pBar->m_szVert);
+
+ if ((bHorz ? rc.left : rc.top) != nAlign)
+ {
+ if (!bHorz)
+ rc.OffsetRect(0, nAlign - rc.top - 2);
+ else if (m_nDockBarID == AFX_IDW_DOCKBAR_TOP)
+ rc.OffsetRect(nAlign - rc.left, -2);
+ else
+ rc.OffsetRect(nAlign - rc.left, 0);
+ pBar->MoveWindow(rc);
+ bNeedRecalc = TRUE;
+ }
+ nAlign += (bHorz ? rc.Width() : rc.Height()) - 2;
+ }
+
+ if (bNeedRecalc)
+ m_pDockSite->DelayRecalcLayout();
+}
+
+void CSizingControlBar::OnUpdateCmdUI(CFrameWnd* pTarget,
+ BOOL bDisableIfNoHndler)
+{
+ UNUSED_ALWAYS(bDisableIfNoHndler);
+ UNUSED_ALWAYS(pTarget);
+}
+
+void CSizingControlBar::LoadState(LPCTSTR lpszProfileName)
+{
+ ASSERT_VALID(this);
+ ASSERT(GetSafeHwnd()); // must be called after Create()
+
+#if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION)
+ // compensate the caption miscalculation in CFrameWnd::SetDockState()
+ CDockState state;
+ state.LoadState(lpszProfileName);
+
+ UINT nID = GetDlgCtrlID();
+ for (int i = 0; i < state.m_arrBarInfo.GetSize(); i++)
+ {
+ CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
+ ASSERT(pInfo != NULL);
+ if (!pInfo->m_bFloating)
+ continue;
+
+ // this is a floating dockbar - check the ID array
+ for (int j = 0; j < pInfo->m_arrBarID.GetSize(); j++)
+ if ((DWORD) pInfo->m_arrBarID[j] == nID)
+ {
+ // found this bar - offset origin and save settings
+ pInfo->m_pointPos.x++;
+ pInfo->m_pointPos.y +=
+ ::GetSystemMetrics(SM_CYSMCAPTION) + 1;
+ pInfo->SaveState(lpszProfileName, i);
+ }
+ }
+#endif //_SCB_REPLACE_MINIFRAME && !_SCB_MINIFRAME_CAPTION
+
+ CWinApp* pApp = AfxGetApp();
+
+ TCHAR szSection[256];
+ wsprintf(szSection, _T("%s-SCBar-%d"), lpszProfileName,
+ GetDlgCtrlID());
+
+ m_szHorz.cx = max(m_szMinHorz.cx, (int) pApp->GetProfileInt(
+ szSection, _T("sizeHorzCX"), m_szHorz.cx));
+ m_szHorz.cy = max(m_szMinHorz.cy, (int) pApp->GetProfileInt(
+ szSection, _T("sizeHorzCY"), m_szHorz.cy));
+
+ m_szVert.cx = max(m_szMinVert.cx, (int) pApp->GetProfileInt(
+ szSection, _T("sizeVertCX"), m_szVert.cx));
+ m_szVert.cy = max(m_szMinVert.cy, (int) pApp->GetProfileInt(
+ szSection, _T("sizeVertCY"), m_szVert.cy));
+
+ m_szFloat.cx = max(m_szMinFloat.cx, (int) pApp->GetProfileInt(
+ szSection, _T("sizeFloatCX"), m_szFloat.cx));
+ m_szFloat.cy = max(m_szMinFloat.cy, (int) pApp->GetProfileInt(
+ szSection, _T("sizeFloatCY"), m_szFloat.cy));
+}
+
+void CSizingControlBar::SaveState(LPCTSTR lpszProfileName)
+{
+ // place your SaveState or GlobalSaveState call in
+ // CMainFrame's OnClose() or DestroyWindow(), not in OnDestroy()
+ ASSERT_VALID(this);
+ ASSERT(GetSafeHwnd());
+
+ CWinApp* pApp = AfxGetApp();
+
+ TCHAR szSection[256];
+ wsprintf(szSection, _T("%s-SCBar-%d"), lpszProfileName,
+ GetDlgCtrlID());
+
+ pApp->WriteProfileInt(szSection, _T("sizeHorzCX"), m_szHorz.cx);
+ pApp->WriteProfileInt(szSection, _T("sizeHorzCY"), m_szHorz.cy);
+
+ pApp->WriteProfileInt(szSection, _T("sizeVertCX"), m_szVert.cx);
+ pApp->WriteProfileInt(szSection, _T("sizeVertCY"), m_szVert.cy);
+
+ pApp->WriteProfileInt(szSection, _T("sizeFloatCX"), m_szFloat.cx);
+ pApp->WriteProfileInt(szSection, _T("sizeFloatCY"), m_szFloat.cy);
+}
+
+void CSizingControlBar::GlobalLoadState(CFrameWnd* pFrame,
+ LPCTSTR lpszProfileName)
+{
+ POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
+ while (pos != NULL)
+ {
+ CSizingControlBar* pBar =
+ (CSizingControlBar*) pFrame->m_listControlBars.GetNext(pos);
+ ASSERT(pBar != NULL);
+ if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ pBar->LoadState(lpszProfileName);
+ }
+}
+
+void CSizingControlBar::GlobalSaveState(CFrameWnd* pFrame,
+ LPCTSTR lpszProfileName)
+{
+ POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
+ while (pos != NULL)
+ {
+ CSizingControlBar* pBar =
+ (CSizingControlBar*) pFrame->m_listControlBars.GetNext(pos);
+ ASSERT(pBar != NULL);
+ if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ pBar->SaveState(lpszProfileName);
+ }
+}
+
+#ifdef _SCB_REPLACE_MINIFRAME
+#ifndef _SCB_MINIFRAME_CAPTION
+/////////////////////////////////////////////////////////////////////////////
+// CSCBDockContext Drag Operations
+
+static void AdjustRectangle(CRect& rect, CPoint pt)
+{
+ int nXOffset = (pt.x < rect.left) ? (pt.x - rect.left) :
+ (pt.x > rect.right) ? (pt.x - rect.right) : 0;
+ int nYOffset = (pt.y < rect.top) ? (pt.y - rect.top) :
+ (pt.y > rect.bottom) ? (pt.y - rect.bottom) : 0;
+ rect.OffsetRect(nXOffset, nYOffset);
+}
+
+void CSCBDockContext::StartDrag(CPoint pt)
+{
+ ASSERT_VALID(m_pBar);
+ m_bDragging = TRUE;
+
+ InitLoop();
+
+ ASSERT((m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC) != 0);
+
+ // get true bar size (including borders)
+ CRect rect;
+ m_pBar->GetWindowRect(rect);
+ m_ptLast = pt;
+ CSize sizeHorz = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK);
+ CSize sizeVert = m_pBar->CalcDynamicLayout(0, LM_VERTDOCK);
+ CSize sizeFloat = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH);
+
+ m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz);
+ m_rectDragVert = CRect(rect.TopLeft(), sizeVert);
+
+ // calculate frame dragging rectangle
+ m_rectFrameDragHorz = CRect(rect.TopLeft(), sizeFloat);
+
+#ifdef _MAC
+ CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz,
+ WS_THICKFRAME, WS_EX_FORCESIZEBOX);
+#else
+ CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz, WS_THICKFRAME);
+#endif
+ m_rectFrameDragHorz.DeflateRect(2, 2);
+ m_rectFrameDragVert = m_rectFrameDragHorz;
+
+ // adjust rectangles so that point is inside
+ AdjustRectangle(m_rectDragHorz, pt);
+ AdjustRectangle(m_rectDragVert, pt);
+ AdjustRectangle(m_rectFrameDragHorz, pt);
+ AdjustRectangle(m_rectFrameDragVert, pt);
+
+ // initialize tracking state and enter tracking loop
+ m_dwOverDockStyle = CanDock();
+ Move(pt); // call it here to handle special keys
+ Track();
+}
+#endif //_SCB_MINIFRAME_CAPTION
+
+/////////////////////////////////////////////////////////////////////////////
+// CSCBMiniDockFrameWnd
+
+IMPLEMENT_DYNCREATE(CSCBMiniDockFrameWnd, baseCSCBMiniDockFrameWnd);
+
+BEGIN_MESSAGE_MAP(CSCBMiniDockFrameWnd, baseCSCBMiniDockFrameWnd)
+ //{{AFX_MSG_MAP(CSCBMiniDockFrameWnd)
+ ON_WM_NCLBUTTONDOWN()
+ ON_WM_GETMINMAXINFO()
+ ON_WM_WINDOWPOSCHANGING()
+ ON_WM_SIZE()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+BOOL CSCBMiniDockFrameWnd::Create(CWnd* pParent, DWORD dwBarStyle)
+{
+ // set m_bInRecalcLayout to avoid flashing during creation
+ // RecalcLayout will be called once something is docked
+ m_bInRecalcLayout = TRUE;
+
+ DWORD dwStyle = WS_POPUP|WS_CAPTION|WS_SYSMENU|MFS_MOVEFRAME|
+ MFS_4THICKFRAME|MFS_SYNCACTIVE|MFS_BLOCKSYSMENU|
+ FWS_SNAPTOBARS;
+
+ if (dwBarStyle & CBRS_SIZE_DYNAMIC)
+ dwStyle &= ~MFS_MOVEFRAME;
+
+ DWORD dwExStyle = 0;
+#ifdef _MAC
+ if (dwBarStyle & CBRS_SIZE_DYNAMIC)
+ dwExStyle |= WS_EX_FORCESIZEBOX;
+ else
+ dwStyle &= ~(MFS_MOVEFRAME|MFS_4THICKFRAME);
+#endif
+
+ if (!CMiniFrameWnd::CreateEx(dwExStyle,
+ NULL, &afxChNil, dwStyle, rectDefault, pParent))
+ {
+ m_bInRecalcLayout = FALSE;
+ return FALSE;
+ }
+ dwStyle = dwBarStyle & (CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT) ?
+ CBRS_ALIGN_LEFT : CBRS_ALIGN_TOP;
+ dwStyle |= dwBarStyle & CBRS_FLOAT_MULTI;
+ CMenu* pSysMenu = GetSystemMenu(FALSE);
+ //pSysMenu->DeleteMenu(SC_SIZE, MF_BYCOMMAND);
+ CString strHide;
+ if (strHide.LoadString(AFX_IDS_HIDE))
+ {
+ pSysMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);
+ pSysMenu->AppendMenu(MF_STRING|MF_ENABLED, SC_CLOSE, strHide);
+ }
+
+ // must initially create with parent frame as parent
+ if (!m_wndDockBar.Create(pParent, WS_CHILD | WS_VISIBLE | dwStyle,
+ AFX_IDW_DOCKBAR_FLOAT))
+ {
+ m_bInRecalcLayout = FALSE;
+ return FALSE;
+ }
+
+ // set parent to CMiniDockFrameWnd
+ m_wndDockBar.SetParent(this);
+ m_bInRecalcLayout = FALSE;
+
+ return TRUE;
+}
+
+void CSCBMiniDockFrameWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
+{
+ if (nHitTest == HTCAPTION || nHitTest == HTCLOSE)
+ {
+ baseCSCBMiniDockFrameWnd::OnNcLButtonDown(nHitTest, point);
+ return;
+ }
+
+ if (GetSizingControlBar() != NULL)
+ CMiniFrameWnd::OnNcLButtonDown(nHitTest, point);
+ else
+ baseCSCBMiniDockFrameWnd::OnNcLButtonDown(nHitTest, point);
+}
+
+CSizingControlBar* CSCBMiniDockFrameWnd::GetSizingControlBar()
+{
+ CWnd* pWnd = GetWindow(GW_CHILD); // get the dockbar
+ if (pWnd == NULL)
+ return NULL;
+
+ pWnd = pWnd->GetWindow(GW_CHILD); // get the controlbar
+ if (pWnd == NULL)
+ return NULL;
+
+ if (!pWnd->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
+ return NULL;
+
+ return (CSizingControlBar*) pWnd;
+}
+
+void CSCBMiniDockFrameWnd::OnSize(UINT nType, int cx, int cy)
+{
+ CSizingControlBar* pBar = GetSizingControlBar();
+ if ((pBar != NULL) && (GetStyle() & MFS_4THICKFRAME) == 0
+ && pBar->IsVisible())
+ pBar->m_szFloat = CSize(cx + 4, cy + 4);
+
+ baseCSCBMiniDockFrameWnd::OnSize(nType, cx, cy);
+}
+
+void CSCBMiniDockFrameWnd::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
+{
+ baseCSCBMiniDockFrameWnd::OnGetMinMaxInfo(lpMMI);
+
+ CSizingControlBar* pBar = GetSizingControlBar();
+ if (pBar != NULL)
+ {
+ CRect r(CPoint(0, 0), pBar->m_szMinFloat - CSize(4, 4));
+#ifndef _SCB_MINIFRAME_CAPTION
+ CMiniFrameWnd::CalcBorders(&r, WS_THICKFRAME);
+#else
+ CMiniFrameWnd::CalcBorders(&r, WS_THICKFRAME|WS_CAPTION);
+#endif //_SCB_MINIFRAME_CAPTION
+ lpMMI->ptMinTrackSize.x = r.Width();
+ lpMMI->ptMinTrackSize.y = r.Height();
+
+ if(pBar->m_bFixedFloat)
+ {
+ lpMMI->ptMinTrackSize.x = pBar->m_szFixedFloat.cx;
+ lpMMI->ptMinTrackSize.y = pBar->m_szFixedFloat.cy;
+ lpMMI->ptMaxTrackSize.x = pBar->m_szFixedFloat.cx;
+ lpMMI->ptMaxTrackSize.y = pBar->m_szFixedFloat.cy;
+ }
+ }
+}
+
+void CSCBMiniDockFrameWnd::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
+{
+ if ((GetStyle() & MFS_4THICKFRAME) != 0)
+ {
+ CSizingControlBar* pBar = GetSizingControlBar();
+ if (pBar != NULL)
+ {
+ lpwndpos->flags |= SWP_NOSIZE; // don't size this time
+ // prevents flicker
+ pBar->m_pDockBar->ModifyStyle(0, WS_CLIPCHILDREN);
+ // enable diagonal resizing
+ ModifyStyle(MFS_4THICKFRAME, 0);
+#ifndef _SCB_MINIFRAME_CAPTION
+ // remove caption
+ ModifyStyle(WS_SYSMENU|WS_CAPTION, 0);
+#endif
+ DelayRecalcLayout();
+ pBar->PostMessage(WM_NCPAINT);
+ }
+ }
+
+ CMiniFrameWnd::OnWindowPosChanging(lpwndpos);
+}
+
+#endif //_SCB_REPLACE_MINIFRAME
diff --git a/src/ui/sizecbar/sizecbar.h b/src/ui/sizecbar/sizecbar.h
new file mode 100644
index 000000000..5cfbd5221
--- /dev/null
+++ b/src/ui/sizecbar/sizecbar.h
@@ -0,0 +1,249 @@
+/////////////////////////////////////////////////////////////////////////
+//
+// CSizingControlBar Version 2.43
+//
+// Created: Jan 24, 1998 Last Modified: August 03, 2000
+//
+// See the official site at www.datamekanix.com for documentation and
+// the latest news.
+//
+/////////////////////////////////////////////////////////////////////////
+// Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
+//
+// This code is free for personal and commercial use, providing this
+// notice remains intact in the source files and all eventual changes are
+// clearly marked with comments.
+//
+// You must obtain the author's consent before you can include this code
+// in a software library.
+//
+// No warrantee of any kind, express or implied, is included with this
+// software; use at your own risk, responsibility for damages (if any) to
+// anyone resulting from the use of this software rests entirely with the
+// user.
+//
+// Send bug reports, bug fixes, enhancements, requests, flames, etc. to
+// cristi@datamekanix.com or post them at the message board at the site.
+/////////////////////////////////////////////////////////////////////////
+
+#if !defined(__SIZECBAR_H__)
+#define __SIZECBAR_H__
+
+#include <afxpriv.h> // for CDockContext
+#include <afxtempl.h> // for CTypedPtrArray
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+
+#if defined(_SCB_MINIFRAME_CAPTION) && !defined(_SCB_REPLACE_MINIFRAME)
+ #error "_SCB_MINIFRAME_CAPTION requires _SCB_REPLACE_MINIFRAME"
+#endif
+
+/////////////////////////////////////////////////////////////////////////
+// CSCBDockBar dummy class for access to protected members
+
+class CSCBDockBar : public CDockBar
+{
+ friend class CSizingControlBar;
+};
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBar control bar styles
+
+#define SCBS_EDGELEFT 0x00000001
+#define SCBS_EDGERIGHT 0x00000002
+#define SCBS_EDGETOP 0x00000004
+#define SCBS_EDGEBOTTOM 0x00000008
+#define SCBS_EDGEALL 0x0000000F
+#define SCBS_SHOWEDGES 0x00000010
+#define SCBS_SIZECHILD 0x00000020
+
+/////////////////////////////////////////////////////////////////////////
+// CSizingControlBar control bar
+
+#ifndef baseCSizingControlBar
+#define baseCSizingControlBar CControlBar
+#endif
+
+class CSizingControlBar;
+typedef CTypedPtrArray <CPtrArray, CSizingControlBar*> CSCBArray;
+
+class CSizingControlBar : public baseCSizingControlBar
+{
+ DECLARE_DYNAMIC(CSizingControlBar);
+
+// Construction
+public:
+ CSizingControlBar();
+
+ virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
+ CSize sizeDefault, BOOL bHasGripper,
+ UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
+ virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
+ UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
+
+// Attributes
+public:
+ const BOOL IsFloating() const;
+ const BOOL IsHorzDocked() const;
+ const BOOL IsVertDocked() const;
+ const BOOL IsSideTracking() const;
+ const BOOL GetSCBStyle() const {return m_dwSCBStyle;}
+
+// Operations
+public:
+#if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION)
+ void EnableDocking(DWORD dwDockStyle);
+#endif
+ virtual void LoadState(LPCTSTR lpszProfileName);
+ virtual void SaveState(LPCTSTR lpszProfileName);
+ static void GlobalLoadState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
+ static void GlobalSaveState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
+ void SetSCBStyle(DWORD dwSCBStyle)
+ {m_dwSCBStyle = (dwSCBStyle & ~SCBS_EDGEALL);}
+
+ void SetHeight(const int nHeight)
+ {
+ m_szFloat.cy = m_szHorz.cy = m_szVert.cy = nHeight;
+ m_pDockSite->DelayRecalcLayout();
+ }
+
+
+// Overridables
+ virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
+
+// Overrides
+public:
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CSizingControlBar)
+ public:
+ virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
+ virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ virtual ~CSizingControlBar();
+
+protected:
+ // implementation helpers
+ UINT GetEdgeHTCode(int nEdge);
+ BOOL GetEdgeRect(CRect rcWnd, UINT nHitTest, CRect& rcEdge);
+ virtual void StartTracking(UINT nHitTest, CPoint point);
+ virtual void StopTracking();
+ virtual void OnTrackUpdateSize(CPoint& point);
+ virtual void OnTrackInvertTracker();
+ virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
+ virtual void NcCalcClient(LPRECT pRc, UINT nDockBarID);
+
+ virtual void AlignControlBars();
+ void GetRowInfo(int& nFirst, int& nLast, int& nThis);
+ void GetRowSizingBars(CSCBArray& arrSCBars);
+ void GetRowSizingBars(CSCBArray& arrSCBars, int& nThis);
+ BOOL NegotiateSpace(int nLengthTotal, BOOL bHorz);
+
+protected:
+ DWORD m_dwSCBStyle;
+ UINT m_htEdge;
+
+ CSize m_szHorz;
+ CSize m_szVert;
+ CSize m_szFloat;
+ CSize m_szMinHorz;
+ CSize m_szMinVert;
+ CSize m_szMinFloat;
+ int m_nTrackPosMin;
+ int m_nTrackPosMax;
+ int m_nTrackPosOld;
+ int m_nTrackEdgeOfs;
+ BOOL m_bTracking;
+ BOOL m_bKeepSize;
+ BOOL m_bParentSizing;
+ BOOL m_bDragShowContent;
+ UINT m_nDockBarID;
+ int m_cxEdge;
+
+ BOOL m_bFixedFloat;
+ CSize m_szFixedFloat;
+
+// Generated message map functions
+protected:
+ //{{AFX_MSG(CSizingControlBar)
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnNcPaint();
+ afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
+ afx_msg UINT OnNcHitTest(CPoint point);
+ afx_msg void OnCaptureChanged(CWnd *pWnd);
+ afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
+ afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
+ afx_msg void OnMouseMove(UINT nFlags, CPoint point);
+ afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+ afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
+ afx_msg void OnPaint();
+ afx_msg void OnClose();
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ //}}AFX_MSG
+ afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
+
+ DECLARE_MESSAGE_MAP()
+
+#ifdef _SCB_REPLACE_MINIFRAME
+ friend class CSCBMiniDockFrameWnd;
+#endif //_SCB_REPLACE_MINIFRAME
+};
+
+#ifdef _SCB_REPLACE_MINIFRAME
+#ifndef _SCB_MINIFRAME_CAPTION
+/////////////////////////////////////////////////////////////////////////
+// CSCBDockContext dockcontext
+
+class CSCBDockContext : public CDockContext
+{
+public:
+// Construction
+ CSCBDockContext(CControlBar* pBar) : CDockContext(pBar) {}
+
+// Drag Operations
+ virtual void StartDrag(CPoint pt);
+};
+#endif //_SCB_MINIFRAME_CAPTION
+
+/////////////////////////////////////////////////////////////////////////
+// CSCBMiniDockFrameWnd miniframe
+
+#ifndef baseCSCBMiniDockFrameWnd
+#define baseCSCBMiniDockFrameWnd CMiniDockFrameWnd
+#endif
+
+class CSCBMiniDockFrameWnd : public baseCSCBMiniDockFrameWnd
+{
+ DECLARE_DYNCREATE(CSCBMiniDockFrameWnd)
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CSCBMiniDockFrameWnd)
+ public:
+ virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
+ //}}AFX_VIRTUAL
+
+// Implementation
+public:
+ CSizingControlBar* GetSizingControlBar();
+
+ //{{AFX_MSG(CSCBMiniDockFrameWnd)
+ afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
+ afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
+ afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+#endif //_SCB_REPLACE_MINIFRAME
+
+#endif // !defined(__SIZECBAR_H__)
+
diff --git a/src/ui/sizecbar/sizecbar.sln b/src/ui/sizecbar/sizecbar.sln
new file mode 100644
index 000000000..86888e812
--- /dev/null
+++ b/src/ui/sizecbar/sizecbar.sln
@@ -0,0 +1,27 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sizecbar", "sizecbar.vcproj", "{61E6EB4D-2F1A-443B-94B0-E8200B26E99F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug.ActiveCfg = Debug|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug.Build.0 = Debug|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release.ActiveCfg = Release|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release.Build.0 = Release|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/ui/sizecbar/sizecbar.vcproj b/src/ui/sizecbar/sizecbar.vcproj
new file mode 100644
index 000000000..8258c7d71
--- /dev/null
+++ b/src/ui/sizecbar/sizecbar.vcproj
@@ -0,0 +1,259 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="sizecbar"
+ ProjectGUID="{61E6EB4D-2F1A-443B-94B0-E8200B26E99F}"
+ SccProjectName=""
+ SccAuxPath=""
+ SccLocalPath=""
+ SccProvider=""
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../lib/sizecbarD.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../lib/sizecbarR.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Debug Unicode|Win32"
+ OutputDirectory="Debug Unicode"
+ IntermediateDirectory="Debug Unicode"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../lib/sizecbarDU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release Unicode|Win32"
+ OutputDirectory="Release Unicode"
+ IntermediateDirectory="Release Unicode"
+ ConfigurationType="4"
+ UseOfMFC="1"
+ CharacterSet="1">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ OmitFramePointers="TRUE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="3"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../../lib/sizecbarRU.lib"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
+ <File
+ RelativePath="scbarcf.cpp">
+ </File>
+ <File
+ RelativePath="scbarg.cpp">
+ </File>
+ <File
+ RelativePath="sizecbar.cpp">
+ </File>
+ <File
+ RelativePath="stdafx.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release Unicode|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc">
+ <File
+ RelativePath="scbarcf.h">
+ </File>
+ <File
+ RelativePath="scbarg.h">
+ </File>
+ <File
+ RelativePath="sizecbar.h">
+ </File>
+ <File
+ RelativePath="stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/ui/sizecbar/sizecbar.vcproj.vspscc b/src/ui/sizecbar/sizecbar.vcproj.vspscc
new file mode 100644
index 000000000..3d6a30885
--- /dev/null
+++ b/src/ui/sizecbar/sizecbar.vcproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:ui\\sizecbar"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/src/ui/sizecbar/stdafx.cpp b/src/ui/sizecbar/stdafx.cpp
new file mode 100644
index 000000000..a700e9aa4
--- /dev/null
+++ b/src/ui/sizecbar/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// sizecbar.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
diff --git a/src/ui/sizecbar/stdafx.h b/src/ui/sizecbar/stdafx.h
new file mode 100644
index 000000000..58101e98b
--- /dev/null
+++ b/src/ui/sizecbar/stdafx.h
@@ -0,0 +1,18 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include <afx.h>
+#include <afxwin.h> // MFC core and standard components
+
+// TODO: reference additional headers your program requires here
diff --git a/src/ui/ui.h b/src/ui/ui.h
new file mode 100644
index 000000000..dfca00217
--- /dev/null
+++ b/src/ui/ui.h
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "CmdUI\CmdUI.h"
+#include "ResizableLib\ResizableDialog.h"
+#include "ResizableLib\ResizablePage.h"
+#include "ResizableLib\ResizableSheet.h"
+#include "sizecbar\sizecbar.h"
+#include "sizecbar\scbarcf.h"
+#include "sizecbar\scbarg.h"
+#include "TreePropSheet\TreePropSheet.h"
diff --git a/src/ui/ui.sln b/src/ui/ui.sln
new file mode 100644
index 000000000..88e45311f
--- /dev/null
+++ b/src/ui/ui.sln
@@ -0,0 +1,63 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdUI", "CmdUI\CmdUI.vcproj", "{03208025-D5C2-426A-B0FA-251D4338F30C}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResizableLib", "ResizableLib\ResizableLib.vcproj", "{4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sizecbar", "sizecbar\sizecbar.vcproj", "{61E6EB4D-2F1A-443B-94B0-E8200B26E99F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TreePropSheet", "TreePropSheet\TreePropSheet.vcproj", "{AB494732-EF6D-44D0-BCF8-80FF04858D10}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Debug Unicode = Debug Unicode
+ Release = Release
+ Release Unicode = Release Unicode
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug.ActiveCfg = Debug|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug.Build.0 = Debug|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release.ActiveCfg = Release|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release.Build.0 = Release|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {03208025-D5C2-426A-B0FA-251D4338F30C}.Release Unicode.Build.0 = Release Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug.ActiveCfg = Debug|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug.Build.0 = Debug|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release.ActiveCfg = Release|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release.Build.0 = Release|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {4CC7AE86-3E0A-430A-BFF4-BF00204CAFB0}.Release Unicode.Build.0 = Release Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug.ActiveCfg = Debug|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug.Build.0 = Debug|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release.ActiveCfg = Release|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release.Build.0 = Release|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {61E6EB4D-2F1A-443B-94B0-E8200B26E99F}.Release Unicode.Build.0 = Release Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug.ActiveCfg = Debug|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug.Build.0 = Debug|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode.ActiveCfg = Debug Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Debug Unicode.Build.0 = Debug Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release.ActiveCfg = Release|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release.Build.0 = Release|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode.ActiveCfg = Release Unicode|Win32
+ {AB494732-EF6D-44D0-BCF8-80FF04858D10}.Release Unicode.Build.0 = Release Unicode|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/ui/ui.suo b/src/ui/ui.suo
new file mode 100644
index 000000000..48dcb6e2f
--- /dev/null
+++ b/src/ui/ui.suo
Binary files differ
diff --git a/src/zlib/ChangeLog.txt b/src/zlib/ChangeLog.txt
new file mode 100644
index 000000000..240655297
--- /dev/null
+++ b/src/zlib/ChangeLog.txt
@@ -0,0 +1,481 @@
+
+ ChangeLog file for zlib
+
+Changes in 1.1.4 (11 March 2002)
+- ZFREE was repeated on same allocation on some error conditions.
+ This creates a security problem described in
+ http://www.zlib.org/advisory-2002-03-11.txt
+- Returned incorrect error (Z_MEM_ERROR) on some invalid data
+- Avoid accesses before window for invalid distances with inflate window
+ less than 32K.
+- force windowBits > 8 to avoid a bug in the encoder for a window size
+ of 256 bytes. (A complete fix will be available in 1.1.5).
+
+Changes in 1.1.3 (9 July 1998)
+- fix "an inflate input buffer bug that shows up on rare but persistent
+ occasions" (Mark)
+- fix gzread and gztell for concatenated .gz files (Didier Le Botlan)
+- fix gzseek(..., SEEK_SET) in write mode
+- fix crc check after a gzeek (Frank Faubert)
+- fix miniunzip when the last entry in a zip file is itself a zip file
+ (J Lillge)
+- add contrib/asm586 and contrib/asm686 (Brian Raiter)
+ See http://www.muppetlabs.com/~breadbox/software/assembly.html
+- add support for Delphi 3 in contrib/delphi (Bob Dellaca)
+- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti)
+- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren)
+- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks)
+- added a FAQ file
+
+- Support gzdopen on Mac with Metrowerks (Jason Linhart)
+- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart)
+- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young)
+- avoid some warnings with Borland C (Tom Tanner)
+- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant)
+- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant)
+- allow several arguments to configure (Tim Mooney, Frodo Looijaard)
+- use libdir and includedir in Makefile.in (Tim Mooney)
+- support shared libraries on OSF1 V4 (Tim Mooney)
+- remove so_locations in "make clean" (Tim Mooney)
+- fix maketree.c compilation error (Glenn, Mark)
+- Python interface to zlib now in Python 1.5 (Jeremy Hylton)
+- new Makefile.riscos (Rich Walker)
+- initialize static descriptors in trees.c for embedded targets (Nick Smith)
+- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith)
+- add the OS/2 files in Makefile.in too (Andrew Zabolotny)
+- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane)
+- fix maketree.c to allow clean compilation of inffixed.h (Mark)
+- fix parameter check in deflateCopy (Gunther Nikl)
+- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler)
+- Many portability patches by Christian Spieler:
+ . zutil.c, zutil.h: added "const" for zmem*
+ . Make_vms.com: fixed some typos
+ . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists
+ . msdos/Makefile.msc: remove "default rtl link library" info from obj files
+ . msdos/Makefile.*: use model-dependent name for the built zlib library
+ . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc:
+ new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT)
+- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane)
+- replace __far with _far for better portability (Christian Spieler, Tom Lane)
+- fix test for errno.h in configure (Tim Newsham)
+
+Changes in 1.1.2 (19 March 98)
+- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant)
+ See http://www.winimage.com/zLibDll/unzip.html
+- preinitialize the inflate tables for fixed codes, to make the code
+ completely thread safe (Mark)
+- some simplifications and slight speed-up to the inflate code (Mark)
+- fix gzeof on non-compressed files (Allan Schrum)
+- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs)
+- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn)
+- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny)
+- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori)
+- do not wrap extern "C" around system includes (Tom Lane)
+- mention zlib binding for TCL in README (Andreas Kupries)
+- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert)
+- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson)
+- allow "configure --prefix $HOME" (Tim Mooney)
+- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson)
+- move Makefile.sas to amiga/Makefile.sas
+
+Changes in 1.1.1 (27 Feb 98)
+- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson)
+- remove block truncation heuristic which had very marginal effect for zlib
+ (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the
+ compression ratio on some files. This also allows inlining _tr_tally for
+ matches in deflate_slow.
+- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier)
+
+Changes in 1.1.0 (24 Feb 98)
+- do not return STREAM_END prematurely in inflate (John Bowler)
+- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler)
+- compile with -DFASTEST to get compression code optimized for speed only
+- in minigzip, try mmap'ing the input file first (Miguel Albrecht)
+- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain
+ on Sun but significant on HP)
+
+- add a pointer to experimental unzip library in README (Gilles Vollant)
+- initialize variable gcc in configure (Chris Herborth)
+
+Changes in 1.0.9 (17 Feb 1998)
+- added gzputs and gzgets functions
+- do not clear eof flag in gzseek (Mark Diekhans)
+- fix gzseek for files in transparent mode (Mark Diekhans)
+- do not assume that vsprintf returns the number of bytes written (Jens Krinke)
+- replace EXPORT with ZEXPORT to avoid conflict with other programs
+- added compress2 in zconf.h, zlib.def, zlib.dnt
+- new asm code from Gilles Vollant in contrib/asm386
+- simplify the inflate code (Mark):
+ . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new()
+ . ZALLOC the length list in inflate_trees_fixed() instead of using stack
+ . ZALLOC the value area for huft_build() instead of using stack
+ . Simplify Z_FINISH check in inflate()
+
+- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
+- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
+- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
+ the declaration of FAR (Gilles VOllant)
+- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
+- read_buf buf parameter of type Bytef* instead of charf*
+- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
+- do not redeclare unlink in minigzip.c for WIN32 (John Bowler)
+- fix check for presence of directories in "make install" (Ian Willis)
+
+Changes in 1.0.8 (27 Jan 1998)
+- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant)
+- fix gzgetc and gzputc for big endian systems (Markus Oberhumer)
+- added compress2() to allow setting the compression level
+- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong)
+- use constant arrays for the static trees in trees.c instead of computing
+ them at run time (thanks to Ken Raeburn for this suggestion). To create
+ trees.h, compile with GEN_TREES_H and run "make test".
+- check return code of example in "make test" and display result
+- pass minigzip command line options to file_compress
+- simplifying code of inflateSync to avoid gcc 2.8 bug
+
+- support CC="gcc -Wall" in configure -s (QingLong)
+- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn)
+- fix test for shared library support to avoid compiler warnings
+- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant)
+- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit)
+- do not use fdopen for Metrowerks on Mac (Brad Pettit))
+- add checks for gzputc and gzputc in example.c
+- avoid warnings in gzio.c and deflate.c (Andreas Kleinert)
+- use const for the CRC table (Ken Raeburn)
+- fixed "make uninstall" for shared libraries
+- use Tracev instead of Trace in infblock.c
+- in example.c use correct compressed length for test_sync
+- suppress +vnocompatwarnings in configure for HPUX (not always supported)
+
+Changes in 1.0.7 (20 Jan 1998)
+- fix gzseek which was broken in write mode
+- return error for gzseek to negative absolute position
+- fix configure for Linux (Chun-Chung Chen)
+- increase stack space for MSC (Tim Wegner)
+- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant)
+- define EXPORTVA for gzprintf (Gilles Vollant)
+- added man page zlib.3 (Rick Rodgers)
+- for contrib/untgz, fix makedir() and improve Makefile
+
+- check gzseek in write mode in example.c
+- allocate extra buffer for seeks only if gzseek is actually called
+- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant)
+- add inflateSyncPoint in zconf.h
+- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def
+
+Changes in 1.0.6 (19 Jan 1998)
+- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and
+ gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code)
+- Fix a deflate bug occuring only with compression level 0 (thanks to
+ Andy Buckler for finding this one).
+- In minigzip, pass transparently also the first byte for .Z files.
+- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress()
+- check Z_FINISH in inflate (thanks to Marc Schluper)
+- Implement deflateCopy (thanks to Adam Costello)
+- make static libraries by default in configure, add --shared option.
+- move MSDOS or Windows specific files to directory msdos
+- suppress the notion of partial flush to simplify the interface
+ (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4)
+- suppress history buffer provided by application to simplify the interface
+ (this feature was not implemented anyway in 1.0.4)
+- next_in and avail_in must be initialized before calling inflateInit or
+ inflateInit2
+- add EXPORT in all exported functions (for Windows DLL)
+- added Makefile.nt (thanks to Stephen Williams)
+- added the unsupported "contrib" directory:
+ contrib/asm386/ by Gilles Vollant <info@winimage.com>
+ 386 asm code replacing longest_match().
+ contrib/iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
+ A C++ I/O streams interface to the zlib gz* functions
+ contrib/iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
+ Another C++ I/O streams interface
+ contrib/untgz/ by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
+ A very simple tar.gz file extractor using zlib
+ contrib/visual-basic.txt by Carlos Rios <c_rios@sonda.cl>
+ How to use compress(), uncompress() and the gz* functions from VB.
+- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression
+ level) in minigzip (thanks to Tom Lane)
+
+- use const for rommable constants in deflate
+- added test for gzseek and gztell in example.c
+- add undocumented function inflateSyncPoint() (hack for Paul Mackerras)
+- add undocumented function zError to convert error code to string
+ (for Tim Smithers)
+- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code.
+- Use default memcpy for Symantec MSDOS compiler.
+- Add EXPORT keyword for check_func (needed for Windows DLL)
+- add current directory to LD_LIBRARY_PATH for "make test"
+- create also a link for libz.so.1
+- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura)
+- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX)
+- added -soname for Linux in configure (Chun-Chung Chen,
+- assign numbers to the exported functions in zlib.def (for Windows DLL)
+- add advice in zlib.h for best usage of deflateSetDictionary
+- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn)
+- allow compilation with ANSI keywords only enabled for TurboC in large model
+- avoid "versionString"[0] (Borland bug)
+- add NEED_DUMMY_RETURN for Borland
+- use variable z_verbose for tracing in debug mode (L. Peter Deutsch).
+- allow compilation with CC
+- defined STDC for OS/2 (David Charlap)
+- limit external names to 8 chars for MVS (Thomas Lund)
+- in minigzip.c, use static buffers only for 16-bit systems
+- fix suffix check for "minigzip -d foo.gz"
+- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee)
+- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau)
+- added makelcc.bat for lcc-win32 (Tom St Denis)
+- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe)
+- Avoid expanded $Id: ChangeLog.txt 126 2003-11-09 01:53:27Z gabest $. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion.
+- check for unistd.h in configure (for off_t)
+- remove useless check parameter in inflate_blocks_free
+- avoid useless assignment of s->check to itself in inflate_blocks_new
+- do not flush twice in gzclose (thanks to Ken Raeburn)
+- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h
+- use NO_ERRNO_H instead of enumeration of operating systems with errno.h
+- work around buggy fclose on pipes for HP/UX
+- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson)
+- fix configure if CC is already equal to gcc
+
+Changes in 1.0.5 (3 Jan 98)
+- Fix inflate to terminate gracefully when fed corrupted or invalid data
+- Use const for rommable constants in inflate
+- Eliminate memory leaks on error conditions in inflate
+- Removed some vestigial code in inflate
+- Update web address in README
+
+Changes in 1.0.4 (24 Jul 96)
+- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF
+ bit, so the decompressor could decompress all the correct data but went
+ on to attempt decompressing extra garbage data. This affected minigzip too.
+- zlibVersion and gzerror return const char* (needed for DLL)
+- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno)
+- use z_error only for DEBUG (avoid problem with DLLs)
+
+Changes in 1.0.3 (2 Jul 96)
+- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS
+ small and medium models; this makes the library incompatible with previous
+ versions for these models. (No effect in large model or on other systems.)
+- return OK instead of BUF_ERROR if previous deflate call returned with
+ avail_out as zero but there is nothing to do
+- added memcmp for non STDC compilers
+- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly)
+- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO)
+- better check for 16-bit mode MSC (avoids problem with Symantec)
+
+Changes in 1.0.2 (23 May 96)
+- added Windows DLL support
+- added a function zlibVersion (for the DLL support)
+- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model)
+- Bytef is define's instead of typedef'd only for Borland C
+- avoid reading uninitialized memory in example.c
+- mention in README that the zlib format is now RFC1950
+- updated Makefile.dj2
+- added algorithm.doc
+
+Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion]
+- fix array overlay in deflate.c which sometimes caused bad compressed data
+- fix inflate bug with empty stored block
+- fix MSDOS medium model which was broken in 0.99
+- fix deflateParams() which could generated bad compressed data.
+- Bytef is define'd instead of typedef'ed (work around Borland bug)
+- added an INDEX file
+- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32),
+ Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas)
+- speed up adler32 for modern machines without auto-increment
+- added -ansi for IRIX in configure
+- static_init_done in trees.c is an int
+- define unlink as delete for VMS
+- fix configure for QNX
+- add configure branch for SCO and HPUX
+- avoid many warnings (unused variables, dead assignments, etc...)
+- no fdopen for BeOS
+- fix the Watcom fix for 32 bit mode (define FAR as empty)
+- removed redefinition of Byte for MKWERKS
+- work around an MWKERKS bug (incorrect merge of all .h files)
+
+Changes in 0.99 (27 Jan 96)
+- allow preset dictionary shared between compressor and decompressor
+- allow compression level 0 (no compression)
+- add deflateParams in zlib.h: allow dynamic change of compression level
+ and compression strategy.
+- test large buffers and deflateParams in example.c
+- add optional "configure" to build zlib as a shared library
+- suppress Makefile.qnx, use configure instead
+- fixed deflate for 64-bit systems (detected on Cray)
+- fixed inflate_blocks for 64-bit systems (detected on Alpha)
+- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2)
+- always return Z_BUF_ERROR when deflate() has nothing to do
+- deflateInit and inflateInit are now macros to allow version checking
+- prefix all global functions and types with z_ with -DZ_PREFIX
+- make falloc completely reentrant (inftrees.c)
+- fixed very unlikely race condition in ct_static_init
+- free in reverse order of allocation to help memory manager
+- use zlib-1.0/* instead of zlib/* inside the tar.gz
+- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith
+ -Wconversion -Wstrict-prototypes -Wmissing-prototypes"
+- allow gzread on concatenated .gz files
+- deflateEnd now returns Z_DATA_ERROR if it was premature
+- deflate is finally (?) fully deterministic (no matches beyond end of input)
+- Document Z_SYNC_FLUSH
+- add uninstall in Makefile
+- Check for __cpluplus in zlib.h
+- Better test in ct_align for partial flush
+- avoid harmless warnings for Borland C++
+- initialize hash_head in deflate.c
+- avoid warning on fdopen (gzio.c) for HP cc -Aa
+- include stdlib.h for STDC compilers
+- include errno.h for Cray
+- ignore error if ranlib doesn't exist
+- call ranlib twice for NeXTSTEP
+- use exec_prefix instead of prefix for libz.a
+- renamed ct_* as _tr_* to avoid conflict with applications
+- clear z->msg in inflateInit2 before any error return
+- initialize opaque in example.c, gzio.c, deflate.c and inflate.c
+- fixed typo in zconf.h (_GNUC__ => __GNUC__)
+- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode)
+- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
+- in fcalloc, normalize pointer if size > 65520 bytes
+- don't use special fcalloc for 32 bit Borland C++
+- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
+- use Z_BINARY instead of BINARY
+- document that gzclose after gzdopen will close the file
+- allow "a" as mode in gzopen.
+- fix error checking in gzread
+- allow skipping .gz extra-field on pipes
+- added reference to Perl interface in README
+- put the crc table in FAR data (I dislike more and more the medium model :)
+- added get_crc_table
+- added a dimension to all arrays (Borland C can't count).
+- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast
+- guard against multiple inclusion of *.h (for precompiled header on Mac)
+- Watcom C pretends to be Microsoft C small model even in 32 bit mode.
+- don't use unsized arrays to avoid silly warnings by Visual C++:
+ warning C4746: 'inflate_mask' : unsized array treated as '__far'
+ (what's wrong with far data in far model?).
+- define enum out of inflate_blocks_state to allow compilation with C++
+
+Changes in 0.95 (16 Aug 95)
+- fix MSDOS small and medium model (now easier to adapt to any compiler)
+- inlined send_bits
+- fix the final (:-) bug for deflate with flush (output was correct but
+ not completely flushed in rare occasions).
+- default window size is same for compression and decompression
+ (it's now sufficient to set MAX_WBITS in zconf.h).
+- voidp -> voidpf and voidnp -> voidp (for consistency with other
+ typedefs and because voidnp was not near in large model).
+
+Changes in 0.94 (13 Aug 95)
+- support MSDOS medium model
+- fix deflate with flush (could sometimes generate bad output)
+- fix deflateReset (zlib header was incorrectly suppressed)
+- added support for VMS
+- allow a compression level in gzopen()
+- gzflush now calls fflush
+- For deflate with flush, flush even if no more input is provided.
+- rename libgz.a as libz.a
+- avoid complex expression in infcodes.c triggering Turbo C bug
+- work around a problem with gcc on Alpha (in INSERT_STRING)
+- don't use inline functions (problem with some gcc versions)
+- allow renaming of Byte, uInt, etc... with #define.
+- avoid warning about (unused) pointer before start of array in deflate.c
+- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c
+- avoid reserved word 'new' in trees.c
+
+Changes in 0.93 (25 June 95)
+- temporarily disable inline functions
+- make deflate deterministic
+- give enough lookahead for PARTIAL_FLUSH
+- Set binary mode for stdin/stdout in minigzip.c for OS/2
+- don't even use signed char in inflate (not portable enough)
+- fix inflate memory leak for segmented architectures
+
+Changes in 0.92 (3 May 95)
+- don't assume that char is signed (problem on SGI)
+- Clear bit buffer when starting a stored block
+- no memcpy on Pyramid
+- suppressed inftest.c
+- optimized fill_window, put longest_match inline for gcc
+- optimized inflate on stored blocks.
+- untabify all sources to simplify patches
+
+Changes in 0.91 (2 May 95)
+- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h
+- Document the memory requirements in zconf.h
+- added "make install"
+- fix sync search logic in inflateSync
+- deflate(Z_FULL_FLUSH) now works even if output buffer too short
+- after inflateSync, don't scare people with just "lo world"
+- added support for DJGPP
+
+Changes in 0.9 (1 May 95)
+- don't assume that zalloc clears the allocated memory (the TurboC bug
+ was Mark's bug after all :)
+- let again gzread copy uncompressed data unchanged (was working in 0.71)
+- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented
+- added a test of inflateSync in example.c
+- moved MAX_WBITS to zconf.h because users might want to change that.
+- document explicitly that zalloc(64K) on MSDOS must return a normalized
+ pointer (zero offset)
+- added Makefiles for Microsoft C, Turbo C, Borland C++
+- faster crc32()
+
+Changes in 0.8 (29 April 95)
+- added fast inflate (inffast.c)
+- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this
+ is incompatible with previous versions of zlib which returned Z_OK.
+- work around a TurboC compiler bug (bad code for b << 0, see infutil.h)
+ (actually that was not a compiler bug, see 0.81 above)
+- gzread no longer reads one extra byte in certain cases
+- In gzio destroy(), don't reference a freed structure
+- avoid many warnings for MSDOS
+- avoid the ERROR symbol which is used by MS Windows
+
+Changes in 0.71 (14 April 95)
+- Fixed more MSDOS compilation problems :( There is still a bug with
+ TurboC large model.
+
+Changes in 0.7 (14 April 95)
+- Added full inflate support.
+- Simplified the crc32() interface. The pre- and post-conditioning
+ (one's complement) is now done inside crc32(). WARNING: this is
+ incompatible with previous versions; see zlib.h for the new usage.
+
+Changes in 0.61 (12 April 95)
+- workaround for a bug in TurboC. example and minigzip now work on MSDOS.
+
+Changes in 0.6 (11 April 95)
+- added minigzip.c
+- added gzdopen to reopen a file descriptor as gzFile
+- added transparent reading of non-gziped files in gzread.
+- fixed bug in gzread (don't read crc as data)
+- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose).
+- don't allocate big arrays in the stack (for MSDOS)
+- fix some MSDOS compilation problems
+
+Changes in 0.5:
+- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but
+ not yet Z_FULL_FLUSH.
+- support decompression but only in a single step (forced Z_FINISH)
+- added opaque object for zalloc and zfree.
+- added deflateReset and inflateReset
+- added a variable zlib_version for consistency checking.
+- renamed the 'filter' parameter of deflateInit2 as 'strategy'.
+ Added Z_FILTERED and Z_HUFFMAN_ONLY constants.
+
+Changes in 0.4:
+- avoid "zip" everywhere, use zlib instead of ziplib.
+- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush
+ if compression method == 8.
+- added adler32 and crc32
+- renamed deflateOptions as deflateInit2, call one or the other but not both
+- added the method parameter for deflateInit2.
+- added inflateInit2
+- simplied considerably deflateInit and inflateInit by not supporting
+ user-provided history buffer. This is supported only in deflateInit2
+ and inflateInit2.
+
+Changes in 0.3:
+- prefix all macro names with Z_
+- use Z_FINISH instead of deflateEnd to finish compression.
+- added Z_HUFFMAN_ONLY
+- added gzerror()
diff --git a/src/zlib/Faq.txt b/src/zlib/Faq.txt
new file mode 100644
index 000000000..9ce6d9f32
--- /dev/null
+++ b/src/zlib/Faq.txt
@@ -0,0 +1,100 @@
+
+ Frequently Asked Questions about zlib
+
+
+If your question is not there, please check the zlib home page
+http://www.zlib.org which may have more recent information.
+The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
+
+
+ 1. Is zlib Y2K-compliant?
+
+ Yes. zlib doesn't handle dates.
+
+ 2. Where can I get a Windows DLL version?
+
+ The zlib sources can be compiled without change to produce a DLL. If you
+ want a precompiled DLL, see http://www.winimage.com/zLibDll/ . Questions
+ about the zlib DLL should be sent to Gilles Vollant (info@winimage.com).
+
+ 3. Where can I get a Visual Basic interface to zlib?
+
+ See
+ * http://www.winimage.com/zLibDll/cmp-z-it.zip
+ * http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm
+ * contrib/visual-basic.txt in the zlib distribution
+
+ 4. compress() returns Z_BUF_ERROR
+
+ Make sure that before the call of compress, the length of the compressed
+ buffer is equal to the total size of the compressed buffer and not
+ zero. For Visual Basic, check that this parameter is passed by reference
+ ("as any"), not by value ("as long").
+
+ 5. deflate() or inflate() returns Z_BUF_ERROR
+
+ Before making the call, make sure that avail_in and avail_out are not
+ zero. When setting the parameter flush equal to Z_FINISH, also make sure
+ that avail_out is big enough to allow processing all pending input.
+
+ 6. Where's the zlib documentation (man pages, etc.)?
+
+ It's in zlib.h for the moment, and Francis S. Lin has converted it to a
+ web page zlib.html. Volunteers to transform this to Unix-style man pages,
+ please contact Jean-loup Gailly (jloup@gzip.org). Examples of zlib usage
+ are in the files example.c and minigzip.c.
+
+ 7. Why don't you use GNU autoconf or libtool or ...?
+
+ Because we would like to keep zlib as a very small and simple
+ package. zlib is rather portable and doesn't need much configuration.
+
+ 8. I found a bug in zlib.
+
+ Most of the time, such problems are due to an incorrect usage of
+ zlib. Please try to reproduce the problem with a small program and send
+ the corresponding source to us at zlib@gzip.org . Do not send
+ multi-megabyte data files without prior agreement.
+
+ 9. Why do I get "undefined reference to gzputc"?
+
+ If "make test" produces something like
+
+ example.o(.text+0x154): undefined reference to `gzputc'
+
+ check that you don't have old files libz.* in /usr/lib, /usr/local/lib or
+ /usr/X11R6/lib. Remove any old versions, then do "make install".
+
+10. I need a Delphi interface to zlib.
+
+ See the directories contrib/delphi and contrib/delphi2 in the zlib
+ distribution.
+
+11. Can zlib handle .zip archives?
+
+ See the directory contrib/minizip in the zlib distribution.
+
+12. Can zlib handle .Z files?
+
+ No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
+ the code of uncompress on your own.
+
+13. How can I make a Unix shared library?
+
+ make clean
+ ./configure -s
+ make
+
+14. Why does "make test" fail on Mac OS X?
+
+ Mac OS X already includes zlib as a shared library, and so -lz links the
+ shared library instead of the one that the "make" compiled. For zlib
+ 1.1.3, the two are incompatible due to different compile-time
+ options. Simply change the -lz in the Makefile to libz.a, and it will use
+ the compiled library instead of the shared one and the "make test" will
+ succeed.
+
+15. I have a question about OttoPDF
+
+ We are not the authors of OttoPDF. The real author is on the OttoPDF web
+ site Joel Hainley jhainley@myndkryme.com.
diff --git a/src/zlib/Readme.txt b/src/zlib/Readme.txt
new file mode 100644
index 000000000..bd8c016b2
--- /dev/null
+++ b/src/zlib/Readme.txt
@@ -0,0 +1,147 @@
+zlib 1.1.4 is a general purpose data compression library. All the code
+is thread safe. The data format used by the zlib library
+is described by RFCs (Request for Comments) 1950 to 1952 in the files
+http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
+format) and rfc1952.txt (gzip format). These documents are also available in
+other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
+
+All functions of the compression library are documented in the file zlib.h
+(volunteer to write man pages welcome, contact jloup@gzip.org). A usage
+example of the library is given in the file example.c which also tests that
+the library is working correctly. Another example is given in the file
+minigzip.c. The compression library itself is composed of all source files
+except example.c and minigzip.c.
+
+To compile all files and run the test program, follow the instructions
+given at the top of Makefile. In short "make test; make install"
+should work for most machines. For Unix: "./configure; make test; make install"
+For MSDOS, use one of the special makefiles such as Makefile.msc.
+For VMS, use Make_vms.com or descrip.mms.
+
+Questions about zlib should be sent to <zlib@gzip.org>, or to
+Gilles Vollant <info@winimage.com> for the Windows DLL version.
+The zlib home page is http://www.zlib.org or http://www.gzip.org/zlib/
+Before reporting a problem, please check this site to verify that
+you have the latest version of zlib; otherwise get the latest version and
+check whether the problem still exists or not.
+
+PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html
+before asking for help.
+
+Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
+issue of Dr. Dobb's Journal; a copy of the article is available in
+http://dogma.net/markn/articles/zlibtool/zlibtool.htm
+
+The changes made in version 1.1.4 are documented in the file ChangeLog.
+The only changes made since 1.1.3 are bug corrections:
+
+- ZFREE was repeated on same allocation on some error conditions.
+ This creates a security problem described in
+ http://www.zlib.org/advisory-2002-03-11.txt
+- Returned incorrect error (Z_MEM_ERROR) on some invalid data
+- Avoid accesses before window for invalid distances with inflate window
+ less than 32K.
+- force windowBits > 8 to avoid a bug in the encoder for a window size
+ of 256 bytes. (A complete fix will be available in 1.1.5).
+
+The beta version 1.1.5beta includes many more changes. A new official
+version 1.1.5 will be released as soon as extensive testing has been
+completed on it.
+
+
+Unsupported third party contributions are provided in directory "contrib".
+
+A Java implementation of zlib is available in the Java Development Kit
+http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
+See the zlib home page http://www.zlib.org for details.
+
+A Perl interface to zlib written by Paul Marquess <pmarquess@bfsec.bt.co.uk>
+is in the CPAN (Comprehensive Perl Archive Network) sites
+http://www.cpan.org/modules/by-module/Compress/
+
+A Python interface to zlib written by A.M. Kuchling <amk@magnet.com>
+is available in Python 1.5 and later versions, see
+http://www.python.org/doc/lib/module-zlib.html
+
+A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com>
+is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html
+
+An experimental package to read and write files in .zip format,
+written on top of zlib by Gilles Vollant <info@winimage.com>, is
+available at http://www.winimage.com/zLibDll/unzip.html
+and also in the contrib/minizip directory of zlib.
+
+
+Notes for some targets:
+
+- To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc
+ and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL
+ The zlib DLL support was initially done by Alessandro Iacopetti and is
+ now maintained by Gilles Vollant <info@winimage.com>. Check the zlib DLL
+ home page at http://www.winimage.com/zLibDll
+
+ From Visual Basic, you can call the DLL functions which do not take
+ a structure as argument: compress, uncompress and all gz* functions.
+ See contrib/visual-basic.txt for more information, or get
+ http://www.tcfb.com/dowseware/cmp-z-it.zip
+
+- For 64-bit Irix, deflate.c must be compiled without any optimization.
+ With -O, one libpng test fails. The test works in 32 bit mode (with
+ the -n32 compiler flag). The compiler bug has been reported to SGI.
+
+- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1
+ it works when compiled with cc.
+
+- on Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1
+ is necessary to get gzprintf working correctly. This is done by configure.
+
+- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works
+ with other compilers. Use "make test" to check your compiler.
+
+- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
+
+- For Turbo C the small model is supported only with reduced performance to
+ avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
+
+- For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html
+ Per Harald Myrvang <perm@stud.cs.uit.no>
+
+
+Acknowledgments:
+
+ The deflate format used by zlib was defined by Phil Katz. The deflate
+ and zlib specifications were written by L. Peter Deutsch. Thanks to all the
+ people who reported problems and suggested various improvements in zlib;
+ they are too numerous to cite here.
+
+Copyright notice:
+
+ (C) 1995-2002 Jean-loup Gailly and Mark Adler
+
+ 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.
+
+ 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:
+
+ 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.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not*
+receiving lengthy legal documents to sign. The sources are provided
+for free but without warranty of any kind. The library has been
+entirely written by Jean-loup Gailly and Mark Adler; it does not
+include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include
+in the file ChangeLog history information documenting your changes.
diff --git a/src/zlib/ZLIB.DEF b/src/zlib/ZLIB.DEF
new file mode 100644
index 000000000..3fb7a4070
--- /dev/null
+++ b/src/zlib/ZLIB.DEF
@@ -0,0 +1,46 @@
+LIBRARY "zlib"
+
+DESCRIPTION '"""zlib data compression library"""'
+
+EXETYPE NT
+
+SUBSYSTEM WINDOWS
+
+STUB 'WINSTUB.EXE'
+
+VERSION 1.14
+
+CODE EXECUTE READ
+
+DATA READ WRITE
+
+HEAPSIZE 1048576,4096
+
+EXPORTS
+ zlibVersion
+ deflate
+ deflateEnd
+ inflate
+ inflateEnd
+ deflateSetDictionary
+ deflateCopy
+ deflateReset
+ deflateParams
+ inflateSetDictionary
+ inflateSync
+ inflateReset
+ compress
+ uncompress
+ gzopen
+ gzdopen
+ gzread
+ gzwrite
+ gzflush
+ gzclose
+ gzerror
+ adler32
+ crc32
+ deflateInit_
+ inflateInit_
+ deflateInit2_
+ inflateInit2_
diff --git a/src/zlib/ZLIB.RC b/src/zlib/ZLIB.RC
new file mode 100644
index 000000000..69f2155e0
--- /dev/null
+++ b/src/zlib/ZLIB.RC
@@ -0,0 +1,32 @@
+#include <windows.h>
+
+#define IDR_VERSION1 1
+IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
+ FILEVERSION 1,1,4,0
+ PRODUCTVERSION 1,1,4,0
+ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+ FILEFLAGS 0
+ FILEOS VOS_DOS_WINDOWS32
+ FILETYPE VFT_DLL
+ FILESUBTYPE 0 // not used
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ //language ID = U.S. English, char set = Windows, Multilingual
+
+ BEGIN
+ VALUE "FileDescription", "zlib data compression library\0"
+ VALUE "FileVersion", "1.1.4\0"
+ VALUE "InternalName", "zlib\0"
+ VALUE "OriginalFilename", "zlib.lib\0"
+ VALUE "ProductName", "ZLib.DLL\0"
+ VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
+ VALUE "LegalCopyright", "(C) 1995-2002 Jean-loup Gailly & Mark Adler\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 1252
+ END
+END
diff --git a/src/zlib/adler32.c b/src/zlib/adler32.c
new file mode 100644
index 000000000..89fade3f4
--- /dev/null
+++ b/src/zlib/adler32.c
@@ -0,0 +1,48 @@
+/* adler32.c -- compute the Adler-32 checksum of a data stream
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: adler32.c 126 2003-11-09 01:53:27Z gabest $ */
+
+#include "zlib.h"
+
+#define BASE 65521L /* largest prime smaller than 65536 */
+#define NMAX 5552
+/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
+
+#define DO1(buf,i) {s1 += buf[i]; s2 += s1;}
+#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
+#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
+#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
+#define DO16(buf) DO8(buf,0); DO8(buf,8);
+
+/* ========================================================================= */
+uLong ZEXPORT adler32(adler, buf, len)
+ uLong adler;
+ const Bytef *buf;
+ uInt len;
+{
+ unsigned long s1 = adler & 0xffff;
+ unsigned long s2 = (adler >> 16) & 0xffff;
+ int k;
+
+ if (buf == Z_NULL) return 1L;
+
+ while (len > 0) {
+ k = len < NMAX ? len : NMAX;
+ len -= k;
+ while (k >= 16) {
+ DO16(buf);
+ buf += 16;
+ k -= 16;
+ }
+ if (k != 0) do {
+ s1 += *buf++;
+ s2 += s1;
+ } while (--k);
+ s1 %= BASE;
+ s2 %= BASE;
+ }
+ return (s2 << 16) | s1;
+}
diff --git a/src/zlib/algorithm.txt b/src/zlib/algorithm.txt
new file mode 100644
index 000000000..f488cd1a9
--- /dev/null
+++ b/src/zlib/algorithm.txt
@@ -0,0 +1,213 @@
+1. Compression algorithm (deflate)
+
+The deflation algorithm used by gzip (also zip and zlib) is a variation of
+LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in
+the input data. The second occurrence of a string is replaced by a
+pointer to the previous string, in the form of a pair (distance,
+length). Distances are limited to 32K bytes, and lengths are limited
+to 258 bytes. When a string does not occur anywhere in the previous
+32K bytes, it is emitted as a sequence of literal bytes. (In this
+description, `string' must be taken as an arbitrary sequence of bytes,
+and is not restricted to printable characters.)
+
+Literals or match lengths are compressed with one Huffman tree, and
+match distances are compressed with another tree. The trees are stored
+in a compact form at the start of each block. The blocks can have any
+size (except that the compressed data for one block must fit in
+available memory). A block is terminated when deflate() determines that
+it would be useful to start another block with fresh trees. (This is
+somewhat similar to the behavior of LZW-based _compress_.)
+
+Duplicated strings are found using a hash table. All input strings of
+length 3 are inserted in the hash table. A hash index is computed for
+the next 3 bytes. If the hash chain for this index is not empty, all
+strings in the chain are compared with the current input string, and
+the longest match is selected.
+
+The hash chains are searched starting with the most recent strings, to
+favor small distances and thus take advantage of the Huffman encoding.
+The hash chains are singly linked. There are no deletions from the
+hash chains, the algorithm simply discards matches that are too old.
+
+To avoid a worst-case situation, very long hash chains are arbitrarily
+truncated at a certain length, determined by a runtime option (level
+parameter of deflateInit). So deflate() does not always find the longest
+possible match but generally finds a match which is long enough.
+
+deflate() also defers the selection of matches with a lazy evaluation
+mechanism. After a match of length N has been found, deflate() searches for
+a longer match at the next input byte. If a longer match is found, the
+previous match is truncated to a length of one (thus producing a single
+literal byte) and the process of lazy evaluation begins again. Otherwise,
+the original match is kept, and the next match search is attempted only N
+steps later.
+
+The lazy match evaluation is also subject to a runtime parameter. If
+the current match is long enough, deflate() reduces the search for a longer
+match, thus speeding up the whole process. If compression ratio is more
+important than speed, deflate() attempts a complete second search even if
+the first match is already long enough.
+
+The lazy match evaluation is not performed for the fastest compression
+modes (level parameter 1 to 3). For these fast modes, new strings
+are inserted in the hash table only when no match was found, or
+when the match is not too long. This degrades the compression ratio
+but saves time since there are both fewer insertions and fewer searches.
+
+
+2. Decompression algorithm (inflate)
+
+2.1 Introduction
+
+The real question is, given a Huffman tree, how to decode fast. The most
+important realization is that shorter codes are much more common than
+longer codes, so pay attention to decoding the short codes fast, and let
+the long codes take longer to decode.
+
+inflate() sets up a first level table that covers some number of bits of
+input less than the length of longest code. It gets that many bits from the
+stream, and looks it up in the table. The table will tell if the next
+code is that many bits or less and how many, and if it is, it will tell
+the value, else it will point to the next level table for which inflate()
+grabs more bits and tries to decode a longer code.
+
+How many bits to make the first lookup is a tradeoff between the time it
+takes to decode and the time it takes to build the table. If building the
+table took no time (and if you had infinite memory), then there would only
+be a first level table to cover all the way to the longest code. However,
+building the table ends up taking a lot longer for more bits since short
+codes are replicated many times in such a table. What inflate() does is
+simply to make the number of bits in the first table a variable, and set it
+for the maximum speed.
+
+inflate() sends new trees relatively often, so it is possibly set for a
+smaller first level table than an application that has only one tree for
+all the data. For inflate, which has 286 possible codes for the
+literal/length tree, the size of the first table is nine bits. Also the
+distance trees have 30 possible values, and the size of the first table is
+six bits. Note that for each of those cases, the table ended up one bit
+longer than the ``average'' code length, i.e. the code length of an
+approximately flat code which would be a little more than eight bits for
+286 symbols and a little less than five bits for 30 symbols. It would be
+interesting to see if optimizing the first level table for other
+applications gave values within a bit or two of the flat code size.
+
+
+2.2 More details on the inflate table lookup
+
+Ok, you want to know what this cleverly obfuscated inflate tree actually
+looks like. You are correct that it's not a Huffman tree. It is simply a
+lookup table for the first, let's say, nine bits of a Huffman symbol. The
+symbol could be as short as one bit or as long as 15 bits. If a particular
+symbol is shorter than nine bits, then that symbol's translation is duplicated
+in all those entries that start with that symbol's bits. For example, if the
+symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a
+symbol is nine bits long, it appears in the table once.
+
+If the symbol is longer than nine bits, then that entry in the table points
+to another similar table for the remaining bits. Again, there are duplicated
+entries as needed. The idea is that most of the time the symbol will be short
+and there will only be one table look up. (That's whole idea behind data
+compression in the first place.) For the less frequent long symbols, there
+will be two lookups. If you had a compression method with really long
+symbols, you could have as many levels of lookups as is efficient. For
+inflate, two is enough.
+
+So a table entry either points to another table (in which case nine bits in
+the above example are gobbled), or it contains the translation for the symbol
+and the number of bits to gobble. Then you start again with the next
+ungobbled bit.
+
+You may wonder: why not just have one lookup table for how ever many bits the
+longest symbol is? The reason is that if you do that, you end up spending
+more time filling in duplicate symbol entries than you do actually decoding.
+At least for deflate's output that generates new trees every several 10's of
+kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code
+would take too long if you're only decoding several thousand symbols. At the
+other extreme, you could make a new table for every bit in the code. In fact,
+that's essentially a Huffman tree. But then you spend two much time
+traversing the tree while decoding, even for short symbols.
+
+So the number of bits for the first lookup table is a trade of the time to
+fill out the table vs. the time spent looking at the second level and above of
+the table.
+
+Here is an example, scaled down:
+
+The code being decoded, with 10 symbols, from 1 to 6 bits long:
+
+A: 0
+B: 10
+C: 1100
+D: 11010
+E: 11011
+F: 11100
+G: 11101
+H: 11110
+I: 111110
+J: 111111
+
+Let's make the first table three bits long (eight entries):
+
+000: A,1
+001: A,1
+010: A,1
+011: A,1
+100: B,2
+101: B,2
+110: -> table X (gobble 3 bits)
+111: -> table Y (gobble 3 bits)
+
+Each entry is what the bits decode to and how many bits that is, i.e. how
+many bits to gobble. Or the entry points to another table, with the number of
+bits to gobble implicit in the size of the table.
+
+Table X is two bits long since the longest code starting with 110 is five bits
+long:
+
+00: C,1
+01: C,1
+10: D,2
+11: E,2
+
+Table Y is three bits long since the longest code starting with 111 is six
+bits long:
+
+000: F,2
+001: F,2
+010: G,2
+011: G,2
+100: H,2
+101: H,2
+110: I,3
+111: J,3
+
+So what we have here are three tables with a total of 20 entries that had to
+be constructed. That's compared to 64 entries for a single table. Or
+compared to 16 entries for a Huffman tree (six two entry tables and one four
+entry table). Assuming that the code ideally represents the probability of
+the symbols, it takes on the average 1.25 lookups per symbol. That's compared
+to one lookup for the single table, or 1.66 lookups per symbol for the
+Huffman tree.
+
+There, I think that gives you a picture of what's going on. For inflate, the
+meaning of a particular symbol is often more than just a letter. It can be a
+byte (a "literal"), or it can be either a length or a distance which
+indicates a base value and a number of bits to fetch after the code that is
+added to the base value. Or it might be the special end-of-block code. The
+data structures created in inftrees.c try to encode all that information
+compactly in the tables.
+
+
+Jean-loup Gailly Mark Adler
+jloup@gzip.org madler@alumni.caltech.edu
+
+
+References:
+
+[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data
+Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3,
+pp. 337-343.
+
+``DEFLATE Compressed Data Format Specification'' available in
+ftp://ds.internic.net/rfc/rfc1951.txt
diff --git a/src/zlib/compress.c b/src/zlib/compress.c
new file mode 100644
index 000000000..903dfd3bd
--- /dev/null
+++ b/src/zlib/compress.c
@@ -0,0 +1,68 @@
+/* compress.c -- compress a memory buffer
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: compress.c 126 2003-11-09 01:53:27Z gabest $ */
+
+#include "zlib.h"
+
+/* ===========================================================================
+ Compresses the source buffer into the destination buffer. The level
+ parameter has the same meaning as in deflateInit. sourceLen is the byte
+ length of the source buffer. Upon entry, destLen is the total size of the
+ destination buffer, which must be at least 0.1% larger than sourceLen plus
+ 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+ compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+ Z_STREAM_ERROR if the level parameter is invalid.
+*/
+int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
+ Bytef *dest;
+ uLongf *destLen;
+ const Bytef *source;
+ uLong sourceLen;
+ int level;
+{
+ z_stream stream;
+ int err;
+
+ stream.next_in = (Bytef*)source;
+ stream.avail_in = (uInt)sourceLen;
+#ifdef MAXSEG_64K
+ /* Check for source > 64K on 16-bit machine: */
+ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+#endif
+ stream.next_out = dest;
+ stream.avail_out = (uInt)*destLen;
+ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+ stream.opaque = (voidpf)0;
+
+ err = deflateInit(&stream, level);
+ if (err != Z_OK) return err;
+
+ err = deflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ deflateEnd(&stream);
+ return err == Z_OK ? Z_BUF_ERROR : err;
+ }
+ *destLen = stream.total_out;
+
+ err = deflateEnd(&stream);
+ return err;
+}
+
+/* ===========================================================================
+ */
+int ZEXPORT compress (dest, destLen, source, sourceLen)
+ Bytef *dest;
+ uLongf *destLen;
+ const Bytef *source;
+ uLong sourceLen;
+{
+ return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
+}
diff --git a/src/zlib/crc32.c b/src/zlib/crc32.c
new file mode 100644
index 000000000..ca0b30673
--- /dev/null
+++ b/src/zlib/crc32.c
@@ -0,0 +1,162 @@
+/* crc32.c -- compute the CRC-32 of a data stream
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: crc32.c 126 2003-11-09 01:53:27Z gabest $ */
+
+#include "zlib.h"
+
+#define local static
+
+#ifdef DYNAMIC_CRC_TABLE
+
+local int crc_table_empty = 1;
+local uLongf crc_table[256];
+local void make_crc_table OF((void));
+
+/*
+ Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
+ x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
+
+ Polynomials over GF(2) are represented in binary, one bit per coefficient,
+ with the lowest powers in the most significant bit. Then adding polynomials
+ is just exclusive-or, and multiplying a polynomial by x is a right shift by
+ one. If we call the above polynomial p, and represent a byte as the
+ polynomial q, also with the lowest power in the most significant bit (so the
+ byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
+ where a mod b means the remainder after dividing a by b.
+
+ This calculation is done using the shift-register method of multiplying and
+ taking the remainder. The register is initialized to zero, and for each
+ incoming bit, x^32 is added mod p to the register if the bit is a one (where
+ x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
+ x (which is shifting right by one and adding x^32 mod p if the bit shifted
+ out is a one). We start with the highest power (least significant bit) of
+ q and repeat for all eight bits of q.
+
+ The table is simply the CRC of all possible eight bit values. This is all
+ the information needed to generate CRC's on data a byte at a time for all
+ combinations of CRC register values and incoming bytes.
+*/
+local void make_crc_table()
+{
+ uLong c;
+ int n, k;
+ uLong poly; /* polynomial exclusive-or pattern */
+ /* terms of polynomial defining this crc (except x^32): */
+ static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
+
+ /* make exclusive-or pattern from polynomial (0xedb88320L) */
+ poly = 0L;
+ for (n = 0; n < sizeof(p)/sizeof(Byte); n++)
+ poly |= 1L << (31 - p[n]);
+
+ for (n = 0; n < 256; n++)
+ {
+ c = (uLong)n;
+ for (k = 0; k < 8; k++)
+ c = c & 1 ? poly ^ (c >> 1) : c >> 1;
+ crc_table[n] = c;
+ }
+ crc_table_empty = 0;
+}
+#else
+/* ========================================================================
+ * Table of CRC-32's of all single-byte values (made by make_crc_table)
+ */
+local const uLongf crc_table[256] = {
+ 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
+ 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
+ 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
+ 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
+ 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
+ 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
+ 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
+ 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
+ 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
+ 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
+ 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
+ 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
+ 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
+ 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
+ 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
+ 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
+ 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
+ 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
+ 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
+ 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
+ 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
+ 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
+ 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
+ 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
+ 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
+ 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
+ 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
+ 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
+ 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
+ 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
+ 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
+ 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
+ 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
+ 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
+ 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
+ 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
+ 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
+ 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
+ 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
+ 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
+ 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
+ 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
+ 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
+ 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
+ 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
+ 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
+ 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
+ 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
+ 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
+ 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
+ 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
+ 0x2d02ef8dL
+};
+#endif
+
+/* =========================================================================
+ * This function can be used by asm versions of crc32()
+ */
+const uLongf * ZEXPORT get_crc_table()
+{
+#ifdef DYNAMIC_CRC_TABLE
+ if (crc_table_empty) make_crc_table();
+#endif
+ return (const uLongf *)crc_table;
+}
+
+/* ========================================================================= */
+#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
+#define DO2(buf) DO1(buf); DO1(buf);
+#define DO4(buf) DO2(buf); DO2(buf);
+#define DO8(buf) DO4(buf); DO4(buf);
+
+/* ========================================================================= */
+uLong ZEXPORT crc32(crc, buf, len)
+ uLong crc;
+ const Bytef *buf;
+ uInt len;
+{
+ if (buf == Z_NULL) return 0L;
+#ifdef DYNAMIC_CRC_TABLE
+ if (crc_table_empty)
+ make_crc_table();
+#endif
+ crc = crc ^ 0xffffffffL;
+ while (len >= 8)
+ {
+ DO8(buf);
+ len -= 8;
+ }
+ if (len) do {
+ DO1(buf);
+ } while (--len);
+ return crc ^ 0xffffffffL;
+}
diff --git a/src/zlib/deflate.c b/src/zlib/deflate.c
new file mode 100644
index 000000000..75ddfbca7
--- /dev/null
+++ b/src/zlib/deflate.c
@@ -0,0 +1,1350 @@
+/* deflate.c -- compress data using the deflation algorithm
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ * ALGORITHM
+ *
+ * The "deflation" process depends on being able to identify portions
+ * of the input text which are identical to earlier input (within a
+ * sliding window trailing behind the input currently being processed).
+ *
+ * The most straightforward technique turns out to be the fastest for
+ * most input files: try all possible matches and select the longest.
+ * The key feature of this algorithm is that insertions into the string
+ * dictionary are very simple and thus fast, and deletions are avoided
+ * completely. Insertions are performed at each input character, whereas
+ * string matches are performed only when the previous match ends. So it
+ * is preferable to spend more time in matches to allow very fast string
+ * insertions and avoid deletions. The matching algorithm for small
+ * strings is inspired from that of Rabin & Karp. A brute force approach
+ * is used to find longer strings when a small match has been found.
+ * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
+ * (by Leonid Broukhis).
+ * A previous version of this file used a more sophisticated algorithm
+ * (by Fiala and Greene) which is guaranteed to run in linear amortized
+ * time, but has a larger average cost, uses more memory and is patented.
+ * However the F&G algorithm may be faster for some highly redundant
+ * files if the parameter max_chain_length (described below) is too large.
+ *
+ * ACKNOWLEDGEMENTS
+ *
+ * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
+ * I found it in 'freeze' written by Leonid Broukhis.
+ * Thanks to many people for bug reports and testing.
+ *
+ * REFERENCES
+ *
+ * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
+ * Available in ftp://ds.internic.net/rfc/rfc1951.txt
+ *
+ * A description of the Rabin and Karp algorithm is given in the book
+ * "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
+ *
+ * Fiala,E.R., and Greene,D.H.
+ * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
+ *
+ */
+
+/* @(#) $Id: deflate.c 126 2003-11-09 01:53:27Z gabest $ */
+
+#include "deflate.h"
+
+const char deflate_copyright[] =
+ " deflate 1.1.4 Copyright 1995-2002 Jean-loup Gailly ";
+/*
+ If you use the zlib library in a product, an acknowledgment is welcome
+ in the documentation of your product. If for some reason you cannot
+ include such an acknowledgment, I would appreciate that you keep this
+ copyright string in the executable of your product.
+ */
+
+/* ===========================================================================
+ * Function prototypes.
+ */
+typedef enum {
+ need_more, /* block not completed, need more input or more output */
+ block_done, /* block flush performed */
+ finish_started, /* finish started, need only more output at next deflate */
+ finish_done /* finish done, accept no more input or output */
+} block_state;
+
+typedef block_state (*compress_func) OF((deflate_state *s, int flush));
+/* Compression function. Returns the block state after the call. */
+
+local void fill_window OF((deflate_state *s));
+local block_state deflate_stored OF((deflate_state *s, int flush));
+local block_state deflate_fast OF((deflate_state *s, int flush));
+local block_state deflate_slow OF((deflate_state *s, int flush));
+local void lm_init OF((deflate_state *s));
+local void putShortMSB OF((deflate_state *s, uInt b));
+local void flush_pending OF((z_streamp strm));
+local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
+#ifdef ASMV
+ void match_init OF((void)); /* asm code initialization */
+ uInt longest_match OF((deflate_state *s, IPos cur_match));
+#else
+local uInt longest_match OF((deflate_state *s, IPos cur_match));
+#endif
+
+#ifdef DEBUG
+local void check_match OF((deflate_state *s, IPos start, IPos match,
+ int length));
+#endif
+
+/* ===========================================================================
+ * Local data
+ */
+
+#define NIL 0
+/* Tail of hash chains */
+
+#ifndef TOO_FAR
+# define TOO_FAR 4096
+#endif
+/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+/* Values for max_lazy_match, good_match and max_chain_length, depending on
+ * the desired pack level (0..9). The values given below have been tuned to
+ * exclude worst case performance for pathological files. Better values may be
+ * found for specific files.
+ */
+typedef struct config_s {
+ ush good_length; /* reduce lazy search above this match length */
+ ush max_lazy; /* do not perform lazy search above this match length */
+ ush nice_length; /* quit search above this match length */
+ ush max_chain;
+ compress_func func;
+} config;
+
+local const config configuration_table[10] = {
+/* good lazy nice chain */
+/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
+/* 1 */ {4, 4, 8, 4, deflate_fast}, /* maximum speed, no lazy matches */
+/* 2 */ {4, 5, 16, 8, deflate_fast},
+/* 3 */ {4, 6, 32, 32, deflate_fast},
+
+/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
+/* 5 */ {8, 16, 32, 32, deflate_slow},
+/* 6 */ {8, 16, 128, 128, deflate_slow},
+/* 7 */ {8, 32, 128, 256, deflate_slow},
+/* 8 */ {32, 128, 258, 1024, deflate_slow},
+/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */
+
+/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
+ * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
+ * meaning.
+ */
+
+#define EQUAL 0
+/* result of memcmp for equal strings */
+
+struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
+
+/* ===========================================================================
+ * Update a hash value with the given input byte
+ * IN assertion: all calls to to UPDATE_HASH are made with consecutive
+ * input characters, so that a running hash key can be computed from the
+ * previous key instead of complete recalculation each time.
+ */
+#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
+
+
+/* ===========================================================================
+ * Insert string str in the dictionary and set match_head to the previous head
+ * of the hash chain (the most recent string with same hash key). Return
+ * the previous length of the hash chain.
+ * If this file is compiled with -DFASTEST, the compression level is forced
+ * to 1, and no hash chains are maintained.
+ * IN assertion: all calls to to INSERT_STRING are made with consecutive
+ * input characters and the first MIN_MATCH bytes of str are valid
+ * (except for the last MIN_MATCH-1 bytes of the input file).
+ */
+#ifdef FASTEST
+#define INSERT_STRING(s, str, match_head) \
+ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+ match_head = s->head[s->ins_h], \
+ s->head[s->ins_h] = (Pos)(str))
+#else
+#define INSERT_STRING(s, str, match_head) \
+ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
+ s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \
+ s->head[s->ins_h] = (Pos)(str))
+#endif
+
+/* ===========================================================================
+ * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
+ * prev[] will be initialized on the fly.
+ */
+#define CLEAR_HASH(s) \
+ s->head[s->hash_size-1] = NIL; \
+ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
+
+/* ========================================================================= */
+int ZEXPORT deflateInit_(strm, level, version, stream_size)
+ z_streamp strm;
+ int level;
+ const char *version;
+ int stream_size;
+{
+ return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
+ Z_DEFAULT_STRATEGY, version, stream_size);
+ /* To do: ignore strm->next_in if we use it as window */
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
+ version, stream_size)
+ z_streamp strm;
+ int level;
+ int method;
+ int windowBits;
+ int memLevel;
+ int strategy;
+ const char *version;
+ int stream_size;
+{
+ deflate_state *s;
+ int noheader = 0;
+ static const char* my_version = ZLIB_VERSION;
+
+ ushf *overlay;
+ /* We overlay pending_buf and d_buf+l_buf. This works since the average
+ * output size for (length,distance) codes is <= 24 bits.
+ */
+
+ if (version == Z_NULL || version[0] != my_version[0] ||
+ stream_size != sizeof(z_stream)) {
+ return Z_VERSION_ERROR;
+ }
+ if (strm == Z_NULL) return Z_STREAM_ERROR;
+
+ strm->msg = Z_NULL;
+ if (strm->zalloc == Z_NULL) {
+ strm->zalloc = zcalloc;
+ strm->opaque = (voidpf)0;
+ }
+ if (strm->zfree == Z_NULL) strm->zfree = zcfree;
+
+ if (level == Z_DEFAULT_COMPRESSION) level = 6;
+#ifdef FASTEST
+ level = 1;
+#endif
+
+ if (windowBits < 0) { /* undocumented feature: suppress zlib header */
+ noheader = 1;
+ windowBits = -windowBits;
+ }
+ if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
+ windowBits < 9 || windowBits > 15 || level < 0 || level > 9 ||
+ strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
+ return Z_STREAM_ERROR;
+ }
+ s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
+ if (s == Z_NULL) return Z_MEM_ERROR;
+ strm->state = (struct internal_state FAR *)s;
+ s->strm = strm;
+
+ s->noheader = noheader;
+ s->w_bits = windowBits;
+ s->w_size = 1 << s->w_bits;
+ s->w_mask = s->w_size - 1;
+
+ s->hash_bits = memLevel + 7;
+ s->hash_size = 1 << s->hash_bits;
+ s->hash_mask = s->hash_size - 1;
+ s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
+
+ s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
+ s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
+ s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
+
+ s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
+
+ overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
+ s->pending_buf = (uchf *) overlay;
+ s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
+
+ if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
+ s->pending_buf == Z_NULL) {
+ strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
+ deflateEnd (strm);
+ return Z_MEM_ERROR;
+ }
+ s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
+ s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
+
+ s->level = level;
+ s->strategy = strategy;
+ s->method = (Byte)method;
+
+ return deflateReset(strm);
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
+ z_streamp strm;
+ const Bytef *dictionary;
+ uInt dictLength;
+{
+ deflate_state *s;
+ uInt length = dictLength;
+ uInt n;
+ IPos hash_head = 0;
+
+ if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
+ strm->state->status != INIT_STATE) return Z_STREAM_ERROR;
+
+ s = strm->state;
+ strm->adler = adler32(strm->adler, dictionary, dictLength);
+
+ if (length < MIN_MATCH) return Z_OK;
+ if (length > MAX_DIST(s)) {
+ length = MAX_DIST(s);
+#ifndef USE_DICT_HEAD
+ dictionary += dictLength - length; /* use the tail of the dictionary */
+#endif
+ }
+ zmemcpy(s->window, dictionary, length);
+ s->strstart = length;
+ s->block_start = (long)length;
+
+ /* Insert all strings in the hash table (except for the last two bytes).
+ * s->lookahead stays null, so s->ins_h will be recomputed at the next
+ * call of fill_window.
+ */
+ s->ins_h = s->window[0];
+ UPDATE_HASH(s, s->ins_h, s->window[1]);
+ for (n = 0; n <= length - MIN_MATCH; n++) {
+ INSERT_STRING(s, n, hash_head);
+ }
+ if (hash_head) hash_head = 0; /* to make compiler happy */
+ return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateReset (strm)
+ z_streamp strm;
+{
+ deflate_state *s;
+
+ if (strm == Z_NULL || strm->state == Z_NULL ||
+ strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR;
+
+ strm->total_in = strm->total_out = 0;
+ strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
+ strm->data_type = Z_UNKNOWN;
+
+ s = (deflate_state *)strm->state;
+ s->pending = 0;
+ s->pending_out = s->pending_buf;
+
+ if (s->noheader < 0) {
+ s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */
+ }
+ s->status = s->noheader ? BUSY_STATE : INIT_STATE;
+ strm->adler = 1;
+ s->last_flush = Z_NO_FLUSH;
+
+ _tr_init(s);
+ lm_init(s);
+
+ return Z_OK;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateParams(strm, level, strategy)
+ z_streamp strm;
+ int level;
+ int strategy;
+{
+ deflate_state *s;
+ compress_func func;
+ int err = Z_OK;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+ s = strm->state;
+
+ if (level == Z_DEFAULT_COMPRESSION) {
+ level = 6;
+ }
+ if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
+ return Z_STREAM_ERROR;
+ }
+ func = configuration_table[s->level].func;
+
+ if (func != configuration_table[level].func && strm->total_in != 0) {
+ /* Flush the last buffer: */
+ err = deflate(strm, Z_PARTIAL_FLUSH);
+ }
+ if (s->level != level) {
+ s->level = level;
+ s->max_lazy_match = configuration_table[level].max_lazy;
+ s->good_match = configuration_table[level].good_length;
+ s->nice_match = configuration_table[level].nice_length;
+ s->max_chain_length = configuration_table[level].max_chain;
+ }
+ s->strategy = strategy;
+ return err;
+}
+
+/* =========================================================================
+ * Put a short in the pending buffer. The 16-bit value is put in MSB order.
+ * IN assertion: the stream state is correct and there is enough room in
+ * pending_buf.
+ */
+local void putShortMSB (s, b)
+ deflate_state *s;
+ uInt b;
+{
+ put_byte(s, (Byte)(b >> 8));
+ put_byte(s, (Byte)(b & 0xff));
+}
+
+/* =========================================================================
+ * Flush as much pending output as possible. All deflate() output goes
+ * through this function so some applications may wish to modify it
+ * to avoid allocating a large strm->next_out buffer and copying into it.
+ * (See also read_buf()).
+ */
+local void flush_pending(strm)
+ z_streamp strm;
+{
+ unsigned len = strm->state->pending;
+
+ if (len > strm->avail_out) len = strm->avail_out;
+ if (len == 0) return;
+
+ zmemcpy(strm->next_out, strm->state->pending_out, len);
+ strm->next_out += len;
+ strm->state->pending_out += len;
+ strm->total_out += len;
+ strm->avail_out -= len;
+ strm->state->pending -= len;
+ if (strm->state->pending == 0) {
+ strm->state->pending_out = strm->state->pending_buf;
+ }
+}
+
+/* ========================================================================= */
+int ZEXPORT deflate (strm, flush)
+ z_streamp strm;
+ int flush;
+{
+ int old_flush; /* value of flush param for previous deflate call */
+ deflate_state *s;
+
+ if (strm == Z_NULL || strm->state == Z_NULL ||
+ flush > Z_FINISH || flush < 0) {
+ return Z_STREAM_ERROR;
+ }
+ s = strm->state;
+
+ if (strm->next_out == Z_NULL ||
+ (strm->next_in == Z_NULL && strm->avail_in != 0) ||
+ (s->status == FINISH_STATE && flush != Z_FINISH)) {
+ ERR_RETURN(strm, Z_STREAM_ERROR);
+ }
+ if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
+
+ s->strm = strm; /* just in case */
+ old_flush = s->last_flush;
+ s->last_flush = flush;
+
+ /* Write the zlib header */
+ if (s->status == INIT_STATE) {
+
+ uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
+ uInt level_flags = (s->level-1) >> 1;
+
+ if (level_flags > 3) level_flags = 3;
+ header |= (level_flags << 6);
+ if (s->strstart != 0) header |= PRESET_DICT;
+ header += 31 - (header % 31);
+
+ s->status = BUSY_STATE;
+ putShortMSB(s, header);
+
+ /* Save the adler32 of the preset dictionary: */
+ if (s->strstart != 0) {
+ putShortMSB(s, (uInt)(strm->adler >> 16));
+ putShortMSB(s, (uInt)(strm->adler & 0xffff));
+ }
+ strm->adler = 1L;
+ }
+
+ /* Flush as much pending output as possible */
+ if (s->pending != 0) {
+ flush_pending(strm);
+ if (strm->avail_out == 0) {
+ /* Since avail_out is 0, deflate will be called again with
+ * more output space, but possibly with both pending and
+ * avail_in equal to zero. There won't be anything to do,
+ * but this is not an error situation so make sure we
+ * return OK instead of BUF_ERROR at next call of deflate:
+ */
+ s->last_flush = -1;
+ return Z_OK;
+ }
+
+ /* Make sure there is something to do and avoid duplicate consecutive
+ * flushes. For repeated and useless calls with Z_FINISH, we keep
+ * returning Z_STREAM_END instead of Z_BUFF_ERROR.
+ */
+ } else if (strm->avail_in == 0 && flush <= old_flush &&
+ flush != Z_FINISH) {
+ ERR_RETURN(strm, Z_BUF_ERROR);
+ }
+
+ /* User must not provide more input after the first FINISH: */
+ if (s->status == FINISH_STATE && strm->avail_in != 0) {
+ ERR_RETURN(strm, Z_BUF_ERROR);
+ }
+
+ /* Start a new block or continue the current one.
+ */
+ if (strm->avail_in != 0 || s->lookahead != 0 ||
+ (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
+ block_state bstate;
+
+ bstate = (*(configuration_table[s->level].func))(s, flush);
+
+ if (bstate == finish_started || bstate == finish_done) {
+ s->status = FINISH_STATE;
+ }
+ if (bstate == need_more || bstate == finish_started) {
+ if (strm->avail_out == 0) {
+ s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
+ }
+ return Z_OK;
+ /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
+ * of deflate should use the same flush parameter to make sure
+ * that the flush is complete. So we don't have to output an
+ * empty block here, this will be done at next call. This also
+ * ensures that for a very small output buffer, we emit at most
+ * one empty block.
+ */
+ }
+ if (bstate == block_done) {
+ if (flush == Z_PARTIAL_FLUSH) {
+ _tr_align(s);
+ } else { /* FULL_FLUSH or SYNC_FLUSH */
+ _tr_stored_block(s, (char*)0, 0L, 0);
+ /* For a full flush, this empty block will be recognized
+ * as a special marker by inflate_sync().
+ */
+ if (flush == Z_FULL_FLUSH) {
+ CLEAR_HASH(s); /* forget history */
+ }
+ }
+ flush_pending(strm);
+ if (strm->avail_out == 0) {
+ s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
+ return Z_OK;
+ }
+ }
+ }
+ Assert(strm->avail_out > 0, "bug2");
+
+ if (flush != Z_FINISH) return Z_OK;
+ if (s->noheader) return Z_STREAM_END;
+
+ /* Write the zlib trailer (adler32) */
+ putShortMSB(s, (uInt)(strm->adler >> 16));
+ putShortMSB(s, (uInt)(strm->adler & 0xffff));
+ flush_pending(strm);
+ /* If avail_out is zero, the application will call deflate again
+ * to flush the rest.
+ */
+ s->noheader = -1; /* write the trailer only once! */
+ return s->pending != 0 ? Z_OK : Z_STREAM_END;
+}
+
+/* ========================================================================= */
+int ZEXPORT deflateEnd (strm)
+ z_streamp strm;
+{
+ int status;
+
+ if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
+
+ status = strm->state->status;
+ if (status != INIT_STATE && status != BUSY_STATE &&
+ status != FINISH_STATE) {
+ return Z_STREAM_ERROR;
+ }
+
+ /* Deallocate in reverse order of allocations: */
+ TRY_FREE(strm, strm->state->pending_buf);
+ TRY_FREE(strm, strm->state->head);
+ TRY_FREE(strm, strm->state->prev);
+ TRY_FREE(strm, strm->state->window);
+
+ ZFREE(strm, strm->state);
+ strm->state = Z_NULL;
+
+ return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
+}
+
+/* =========================================================================
+ * Copy the source state to the destination state.
+ * To simplify the source, this is not supported for 16-bit MSDOS (which
+ * doesn't have enough memory anyway to duplicate compression states).
+ */
+int ZEXPORT deflateCopy (dest, source)
+ z_streamp dest;
+ z_streamp source;
+{
+#ifdef MAXSEG_64K
+ return Z_STREAM_ERROR;
+#else
+ deflate_state *ds;
+ deflate_state *ss;
+ ushf *overlay;
+
+
+ if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
+ return Z_STREAM_ERROR;
+ }
+
+ ss = source->state;
+
+ *dest = *source;
+
+ ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
+ if (ds == Z_NULL) return Z_MEM_ERROR;
+ dest->state = (struct internal_state FAR *) ds;
+ *ds = *ss;
+ ds->strm = dest;
+
+ ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
+ ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
+ ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
+ overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
+ ds->pending_buf = (uchf *) overlay;
+
+ if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
+ ds->pending_buf == Z_NULL) {
+ deflateEnd (dest);
+ return Z_MEM_ERROR;
+ }
+ /* following zmemcpy do not work for 16-bit MSDOS */
+ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
+ zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos));
+ zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos));
+ zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+
+ ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
+ ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
+ ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
+
+ ds->l_desc.dyn_tree = ds->dyn_ltree;
+ ds->d_desc.dyn_tree = ds->dyn_dtree;
+ ds->bl_desc.dyn_tree = ds->bl_tree;
+
+ return Z_OK;
+#endif
+}
+
+/* ===========================================================================
+ * Read a new buffer from the current input stream, update the adler32
+ * and total number of bytes read. All deflate() input goes through
+ * this function so some applications may wish to modify it to avoid
+ * allocating a large strm->next_in buffer and copying from it.
+ * (See also flush_pending()).
+ */
+local int read_buf(strm, buf, size)
+ z_streamp strm;
+ Bytef *buf;
+ unsigned size;
+{
+ unsigned len = strm->avail_in;
+
+ if (len > size) len = size;
+ if (len == 0) return 0;
+
+ strm->avail_in -= len;
+
+ if (!strm->state->noheader) {
+ strm->adler = adler32(strm->adler, strm->next_in, len);
+ }
+ zmemcpy(buf, strm->next_in, len);
+ strm->next_in += len;
+ strm->total_in += len;
+
+ return (int)len;
+}
+
+/* ===========================================================================
+ * Initialize the "longest match" routines for a new zlib stream
+ */
+local void lm_init (s)
+ deflate_state *s;
+{
+ s->window_size = (ulg)2L*s->w_size;
+
+ CLEAR_HASH(s);
+
+ /* Set the default configuration parameters:
+ */
+ s->max_lazy_match = configuration_table[s->level].max_lazy;
+ s->good_match = configuration_table[s->level].good_length;
+ s->nice_match = configuration_table[s->level].nice_length;
+ s->max_chain_length = configuration_table[s->level].max_chain;
+
+ s->strstart = 0;
+ s->block_start = 0L;
+ s->lookahead = 0;
+ s->match_length = s->prev_length = MIN_MATCH-1;
+ s->match_available = 0;
+ s->ins_h = 0;
+#ifdef ASMV
+ match_init(); /* initialize the asm code */
+#endif
+}
+
+/* ===========================================================================
+ * Set match_start to the longest match starting at the given string and
+ * return its length. Matches shorter or equal to prev_length are discarded,
+ * in which case the result is equal to prev_length and match_start is
+ * garbage.
+ * IN assertions: cur_match is the head of the hash chain for the current
+ * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
+ * OUT assertion: the match length is not greater than s->lookahead.
+ */
+#ifndef ASMV
+/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
+ * match.S. The code will be functionally equivalent.
+ */
+#ifndef FASTEST
+local uInt longest_match(s, cur_match)
+ deflate_state *s;
+ IPos cur_match; /* current match */
+{
+ unsigned chain_length = s->max_chain_length;/* max hash chain length */
+ register Bytef *scan = s->window + s->strstart; /* current string */
+ register Bytef *match; /* matched string */
+ register int len; /* length of current match */
+ int best_len = s->prev_length; /* best match length so far */
+ int nice_match = s->nice_match; /* stop if match long enough */
+ IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+ s->strstart - (IPos)MAX_DIST(s) : NIL;
+ /* Stop when cur_match becomes <= limit. To simplify the code,
+ * we prevent matches with the string of window index 0.
+ */
+ Posf *prev = s->prev;
+ uInt wmask = s->w_mask;
+
+#ifdef UNALIGNED_OK
+ /* Compare two bytes at a time. Note: this is not always beneficial.
+ * Try with and without -DUNALIGNED_OK to check.
+ */
+ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
+ register ush scan_start = *(ushf*)scan;
+ register ush scan_end = *(ushf*)(scan+best_len-1);
+#else
+ register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+ register Byte scan_end1 = scan[best_len-1];
+ register Byte scan_end = scan[best_len];
+#endif
+
+ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+ * It is easy to get rid of this optimization if necessary.
+ */
+ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+
+ /* Do not waste too much time if we already have a good match: */
+ if (s->prev_length >= s->good_match) {
+ chain_length >>= 2;
+ }
+ /* Do not look for matches beyond the end of the input. This is necessary
+ * to make deflate deterministic.
+ */
+ if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+
+ Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+
+ do {
+ Assert(cur_match < s->strstart, "no future");
+ match = s->window + cur_match;
+
+ /* Skip to next match if the match length cannot increase
+ * or if the match length is less than 2:
+ */
+#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
+ /* This code assumes sizeof(unsigned short) == 2. Do not use
+ * UNALIGNED_OK if your compiler uses a different size.
+ */
+ if (*(ushf*)(match+best_len-1) != scan_end ||
+ *(ushf*)match != scan_start) continue;
+
+ /* It is not necessary to compare scan[2] and match[2] since they are
+ * always equal when the other bytes match, given that the hash keys
+ * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
+ * strstart+3, +5, ... up to strstart+257. We check for insufficient
+ * lookahead only every 4th comparison; the 128th check will be made
+ * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
+ * necessary to put more guard bytes at the end of the window, or
+ * to check more often for insufficient lookahead.
+ */
+ Assert(scan[2] == match[2], "scan[2]?");
+ scan++, match++;
+ do {
+ } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
+ scan < strend);
+ /* The funny "do {}" generates better code on most compilers */
+
+ /* Here, scan <= window+strstart+257 */
+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+ if (*scan == *match) scan++;
+
+ len = (MAX_MATCH - 1) - (int)(strend-scan);
+ scan = strend - (MAX_MATCH-1);
+
+#else /* UNALIGNED_OK */
+
+ if (match[best_len] != scan_end ||
+ match[best_len-1] != scan_end1 ||
+ *match != *scan ||
+ *++match != scan[1]) continue;
+
+ /* The check at best_len-1 can be removed because it will be made
+ * again later. (This heuristic is not always a win.)
+ * It is not necessary to compare scan[2] and match[2] since they
+ * are always equal when the other bytes match, given that
+ * the hash keys are equal and that HASH_BITS >= 8.
+ */
+ scan += 2, match++;
+ Assert(*scan == *match, "match[2]?");
+
+ /* We check for insufficient lookahead only every 8th comparison;
+ * the 256th check will be made at strstart+258.
+ */
+ do {
+ } while (*++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ scan < strend);
+
+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+
+ len = MAX_MATCH - (int)(strend - scan);
+ scan = strend - MAX_MATCH;
+
+#endif /* UNALIGNED_OK */
+
+ if (len > best_len) {
+ s->match_start = cur_match;
+ best_len = len;
+ if (len >= nice_match) break;
+#ifdef UNALIGNED_OK
+ scan_end = *(ushf*)(scan+best_len-1);
+#else
+ scan_end1 = scan[best_len-1];
+ scan_end = scan[best_len];
+#endif
+ }
+ } while ((cur_match = prev[cur_match & wmask]) > limit
+ && --chain_length != 0);
+
+ if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
+ return s->lookahead;
+}
+
+#else /* FASTEST */
+/* ---------------------------------------------------------------------------
+ * Optimized version for level == 1 only
+ */
+local uInt longest_match(s, cur_match)
+ deflate_state *s;
+ IPos cur_match; /* current match */
+{
+ register Bytef *scan = s->window + s->strstart; /* current string */
+ register Bytef *match; /* matched string */
+ register int len; /* length of current match */
+ register Bytef *strend = s->window + s->strstart + MAX_MATCH;
+
+ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
+ * It is easy to get rid of this optimization if necessary.
+ */
+ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
+
+ Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+
+ Assert(cur_match < s->strstart, "no future");
+
+ match = s->window + cur_match;
+
+ /* Return failure if the match length is less than 2:
+ */
+ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
+
+ /* The check at best_len-1 can be removed because it will be made
+ * again later. (This heuristic is not always a win.)
+ * It is not necessary to compare scan[2] and match[2] since they
+ * are always equal when the other bytes match, given that
+ * the hash keys are equal and that HASH_BITS >= 8.
+ */
+ scan += 2, match += 2;
+ Assert(*scan == *match, "match[2]?");
+
+ /* We check for insufficient lookahead only every 8th comparison;
+ * the 256th check will be made at strstart+258.
+ */
+ do {
+ } while (*++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ *++scan == *++match && *++scan == *++match &&
+ scan < strend);
+
+ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
+
+ len = MAX_MATCH - (int)(strend - scan);
+
+ if (len < MIN_MATCH) return MIN_MATCH - 1;
+
+ s->match_start = cur_match;
+ return len <= s->lookahead ? len : s->lookahead;
+}
+#endif /* FASTEST */
+#endif /* ASMV */
+
+#ifdef DEBUG
+/* ===========================================================================
+ * Check that the match at match_start is indeed a match.
+ */
+local void check_match(s, start, match, length)
+ deflate_state *s;
+ IPos start, match;
+ int length;
+{
+ /* check that the match is indeed a match */
+ if (zmemcmp(s->window + match,
+ s->window + start, length) != EQUAL) {
+ fprintf(stderr, " start %u, match %u, length %d\n",
+ start, match, length);
+ do {
+ fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
+ } while (--length != 0);
+ z_error("invalid match");
+ }
+ if (z_verbose > 1) {
+ fprintf(stderr,"\\[%d,%d]", start-match, length);
+ do { putc(s->window[start++], stderr); } while (--length != 0);
+ }
+}
+#else
+# define check_match(s, start, match, length)
+#endif
+
+/* ===========================================================================
+ * Fill the window when the lookahead becomes insufficient.
+ * Updates strstart and lookahead.
+ *
+ * IN assertion: lookahead < MIN_LOOKAHEAD
+ * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
+ * At least one byte has been read, or avail_in == 0; reads are
+ * performed for at least two bytes (required for the zip translate_eol
+ * option -- not supported here).
+ */
+local void fill_window(s)
+ deflate_state *s;
+{
+ register unsigned n, m;
+ register Posf *p;
+ unsigned more; /* Amount of free space at the end of the window. */
+ uInt wsize = s->w_size;
+
+ do {
+ more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+
+ /* Deal with !@#$% 64K limit: */
+ if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
+ more = wsize;
+
+ } else if (more == (unsigned)(-1)) {
+ /* Very unlikely, but possible on 16 bit machine if strstart == 0
+ * and lookahead == 1 (input done one byte at time)
+ */
+ more--;
+
+ /* If the window is almost full and there is insufficient lookahead,
+ * move the upper half to the lower one to make room in the upper half.
+ */
+ } else if (s->strstart >= wsize+MAX_DIST(s)) {
+
+ zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
+ s->match_start -= wsize;
+ s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
+ s->block_start -= (long) wsize;
+
+ /* Slide the hash table (could be avoided with 32 bit values
+ at the expense of memory usage). We slide even when level == 0
+ to keep the hash table consistent if we switch back to level > 0
+ later. (Using level 0 permanently is not an optimal usage of
+ zlib, so we don't care about this pathological case.)
+ */
+ n = s->hash_size;
+ p = &s->head[n];
+ do {
+ m = *--p;
+ *p = (Pos)(m >= wsize ? m-wsize : NIL);
+ } while (--n);
+
+ n = wsize;
+#ifndef FASTEST
+ p = &s->prev[n];
+ do {
+ m = *--p;
+ *p = (Pos)(m >= wsize ? m-wsize : NIL);
+ /* If n is not on any hash chain, prev[n] is garbage but
+ * its value will never be used.
+ */
+ } while (--n);
+#endif
+ more += wsize;
+ }
+ if (s->strm->avail_in == 0) return;
+
+ /* If there was no sliding:
+ * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+ * more == window_size - lookahead - strstart
+ * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+ * => more >= window_size - 2*WSIZE + 2
+ * In the BIG_MEM or MMAP case (not yet supported),
+ * window_size == input_size + MIN_LOOKAHEAD &&
+ * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+ * Otherwise, window_size == 2*WSIZE so more >= 2.
+ * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+ */
+ Assert(more >= 2, "more < 2");
+
+ n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+ s->lookahead += n;
+
+ /* Initialize the hash value now that we have some input: */
+ if (s->lookahead >= MIN_MATCH) {
+ s->ins_h = s->window[s->strstart];
+ UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+ Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+ }
+ /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+ * but this is not important since only literal bytes will be emitted.
+ */
+
+ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
+}
+
+/* ===========================================================================
+ * Flush the current block, with given end-of-file flag.
+ * IN assertion: strstart is set to the end of the current match.
+ */
+#define FLUSH_BLOCK_ONLY(s, eof) { \
+ _tr_flush_block(s, (s->block_start >= 0L ? \
+ (charf *)&s->window[(unsigned)s->block_start] : \
+ (charf *)Z_NULL), \
+ (ulg)((long)s->strstart - s->block_start), \
+ (eof)); \
+ s->block_start = s->strstart; \
+ flush_pending(s->strm); \
+ Tracev((stderr,"[FLUSH]")); \
+}
+
+/* Same but force premature exit if necessary. */
+#define FLUSH_BLOCK(s, eof) { \
+ FLUSH_BLOCK_ONLY(s, eof); \
+ if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
+}
+
+/* ===========================================================================
+ * Copy without compression as much as possible from the input stream, return
+ * the current block state.
+ * This function does not insert new strings in the dictionary since
+ * uncompressible data is probably not useful. This function is used
+ * only for the level=0 compression option.
+ * NOTE: this function should be optimized to avoid extra copying from
+ * window to pending_buf.
+ */
+local block_state deflate_stored(s, flush)
+ deflate_state *s;
+ int flush;
+{
+ /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
+ * to pending_buf_size, and each stored block has a 5 byte header:
+ */
+ ulg max_block_size = 0xffff;
+ ulg max_start;
+
+ if (max_block_size > s->pending_buf_size - 5) {
+ max_block_size = s->pending_buf_size - 5;
+ }
+
+ /* Copy as much as possible from input to output: */
+ for (;;) {
+ /* Fill the window as much as possible: */
+ if (s->lookahead <= 1) {
+
+ Assert(s->strstart < s->w_size+MAX_DIST(s) ||
+ s->block_start >= (long)s->w_size, "slide too late");
+
+ fill_window(s);
+ if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
+
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+ Assert(s->block_start >= 0L, "block gone");
+
+ s->strstart += s->lookahead;
+ s->lookahead = 0;
+
+ /* Emit a stored block if pending_buf will be full: */
+ max_start = s->block_start + max_block_size;
+ if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
+ /* strstart == 0 is possible when wraparound on 16-bit machine */
+ s->lookahead = (uInt)(s->strstart - max_start);
+ s->strstart = (uInt)max_start;
+ FLUSH_BLOCK(s, 0);
+ }
+ /* Flush if we may have to slide, otherwise block_start may become
+ * negative and the data will be gone:
+ */
+ if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
+ FLUSH_BLOCK(s, 0);
+ }
+ }
+ FLUSH_BLOCK(s, flush == Z_FINISH);
+ return flush == Z_FINISH ? finish_done : block_done;
+}
+
+/* ===========================================================================
+ * Compress as much as possible from the input stream, return the current
+ * block state.
+ * This function does not perform lazy evaluation of matches and inserts
+ * new strings in the dictionary only for unmatched strings or for short
+ * matches. It is used only for the fast compression options.
+ */
+local block_state deflate_fast(s, flush)
+ deflate_state *s;
+ int flush;
+{
+ IPos hash_head = NIL; /* head of the hash chain */
+ int bflush; /* set if current block must be flushed */
+
+ for (;;) {
+ /* Make sure that we always have enough lookahead, except
+ * at the end of the input file. We need MAX_MATCH bytes
+ * for the next match, plus MIN_MATCH bytes to insert the
+ * string following the next match.
+ */
+ if (s->lookahead < MIN_LOOKAHEAD) {
+ fill_window(s);
+ if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+ return need_more;
+ }
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+
+ /* Insert the string window[strstart .. strstart+2] in the
+ * dictionary, and set hash_head to the head of the hash chain:
+ */
+ if (s->lookahead >= MIN_MATCH) {
+ INSERT_STRING(s, s->strstart, hash_head);
+ }
+
+ /* Find the longest match, discarding those <= prev_length.
+ * At this point we have always match_length < MIN_MATCH
+ */
+ if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
+ /* To simplify the code, we prevent matches with the string
+ * of window index 0 (in particular we have to avoid a match
+ * of the string with itself at the start of the input file).
+ */
+ if (s->strategy != Z_HUFFMAN_ONLY) {
+ s->match_length = longest_match (s, hash_head);
+ }
+ /* longest_match() sets match_start */
+ }
+ if (s->match_length >= MIN_MATCH) {
+ check_match(s, s->strstart, s->match_start, s->match_length);
+
+ _tr_tally_dist(s, s->strstart - s->match_start,
+ s->match_length - MIN_MATCH, bflush);
+
+ s->lookahead -= s->match_length;
+
+ /* Insert new strings in the hash table only if the match length
+ * is not too large. This saves time but degrades compression.
+ */
+#ifndef FASTEST
+ if (s->match_length <= s->max_insert_length &&
+ s->lookahead >= MIN_MATCH) {
+ s->match_length--; /* string at strstart already in hash table */
+ do {
+ s->strstart++;
+ INSERT_STRING(s, s->strstart, hash_head);
+ /* strstart never exceeds WSIZE-MAX_MATCH, so there are
+ * always MIN_MATCH bytes ahead.
+ */
+ } while (--s->match_length != 0);
+ s->strstart++;
+ } else
+#endif
+ {
+ s->strstart += s->match_length;
+ s->match_length = 0;
+ s->ins_h = s->window[s->strstart];
+ UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
+#if MIN_MATCH != 3
+ Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+ /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
+ * matter since it will be recomputed at next deflate call.
+ */
+ }
+ } else {
+ /* No match, output a literal byte */
+ Tracevv((stderr,"%c", s->window[s->strstart]));
+ _tr_tally_lit (s, s->window[s->strstart], bflush);
+ s->lookahead--;
+ s->strstart++;
+ }
+ if (bflush) FLUSH_BLOCK(s, 0);
+ }
+ FLUSH_BLOCK(s, flush == Z_FINISH);
+ return flush == Z_FINISH ? finish_done : block_done;
+}
+
+/* ===========================================================================
+ * Same as above, but achieves better compression. We use a lazy
+ * evaluation for matches: a match is finally adopted only if there is
+ * no better match at the next window position.
+ */
+local block_state deflate_slow(s, flush)
+ deflate_state *s;
+ int flush;
+{
+ IPos hash_head = NIL; /* head of hash chain */
+ int bflush; /* set if current block must be flushed */
+
+ /* Process the input block. */
+ for (;;) {
+ /* Make sure that we always have enough lookahead, except
+ * at the end of the input file. We need MAX_MATCH bytes
+ * for the next match, plus MIN_MATCH bytes to insert the
+ * string following the next match.
+ */
+ if (s->lookahead < MIN_LOOKAHEAD) {
+ fill_window(s);
+ if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
+ return need_more;
+ }
+ if (s->lookahead == 0) break; /* flush the current block */
+ }
+
+ /* Insert the string window[strstart .. strstart+2] in the
+ * dictionary, and set hash_head to the head of the hash chain:
+ */
+ if (s->lookahead >= MIN_MATCH) {
+ INSERT_STRING(s, s->strstart, hash_head);
+ }
+
+ /* Find the longest match, discarding those <= prev_length.
+ */
+ s->prev_length = s->match_length, s->prev_match = s->match_start;
+ s->match_length = MIN_MATCH-1;
+
+ if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
+ s->strstart - hash_head <= MAX_DIST(s)) {
+ /* To simplify the code, we prevent matches with the string
+ * of window index 0 (in particular we have to avoid a match
+ * of the string with itself at the start of the input file).
+ */
+ if (s->strategy != Z_HUFFMAN_ONLY) {
+ s->match_length = longest_match (s, hash_head);
+ }
+ /* longest_match() sets match_start */
+
+ if (s->match_length <= 5 && (s->strategy == Z_FILTERED ||
+ (s->match_length == MIN_MATCH &&
+ s->strstart - s->match_start > TOO_FAR))) {
+
+ /* If prev_match is also MIN_MATCH, match_start is garbage
+ * but we will ignore the current match anyway.
+ */
+ s->match_length = MIN_MATCH-1;
+ }
+ }
+ /* If there was a match at the previous step and the current
+ * match is not better, output the previous match:
+ */
+ if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
+ uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
+ /* Do not insert strings in hash table beyond this. */
+
+ check_match(s, s->strstart-1, s->prev_match, s->prev_length);
+
+ _tr_tally_dist(s, s->strstart -1 - s->prev_match,
+ s->prev_length - MIN_MATCH, bflush);
+
+ /* Insert in hash table all strings up to the end of the match.
+ * strstart-1 and strstart are already inserted. If there is not
+ * enough lookahead, the last two strings are not inserted in
+ * the hash table.
+ */
+ s->lookahead -= s->prev_length-1;
+ s->prev_length -= 2;
+ do {
+ if (++s->strstart <= max_insert) {
+ INSERT_STRING(s, s->strstart, hash_head);
+ }
+ } while (--s->prev_length != 0);
+ s->match_available = 0;
+ s->match_length = MIN_MATCH-1;
+ s->strstart++;
+
+ if (bflush) FLUSH_BLOCK(s, 0);
+
+ } else if (s->match_available) {
+ /* If there was no match at the previous position, output a
+ * single literal. If there was a match but the current match
+ * is longer, truncate the previous match to a single literal.
+ */
+ Tracevv((stderr,"%c", s->window[s->strstart-1]));
+ _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ if (bflush) {
+ FLUSH_BLOCK_ONLY(s, 0);
+ }
+ s->strstart++;
+ s->lookahead--;
+ if (s->strm->avail_out == 0) return need_more;
+ } else {
+ /* There is no previous match to compare with, wait for
+ * the next step to decide.
+ */
+ s->match_available = 1;
+ s->strstart++;
+ s->lookahead--;
+ }
+ }
+ Assert (flush != Z_NO_FLUSH, "no flush?");
+ if (s->match_available) {
+ Tracevv((stderr,"%c", s->window[s->strstart-1]));
+ _tr_tally_lit(s, s->window[s->strstart-1], bflush);
+ s->match_available = 0;
+ }
+ FLUSH_BLOCK(s, flush == Z_FINISH);
+ return flush == Z_FINISH ? finish_done : block_done;
+}
diff --git a/src/zlib/deflate.h b/src/zlib/deflate.h
new file mode 100644
index 000000000..500d99954
--- /dev/null
+++ b/src/zlib/deflate.h
@@ -0,0 +1,318 @@
+/* deflate.h -- internal compression state
+ * Copyright (C) 1995-2002 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: deflate.h 126 2003-11-09 01:53:27Z gabest $ */
+
+#ifndef _DEFLATE_H
+#define _DEFLATE_H
+
+#include "zutil.h"
+
+/* ===========================================================================
+ * Internal compression state.
+ */
+
+#define LENGTH_CODES 29
+/* number of length codes, not counting the special END_BLOCK code */
+
+#define LITERALS 256
+/* number of literal bytes 0..255 */
+
+#define L_CODES (LITERALS+1+LENGTH_CODES)
+/* number of Literal or Length codes, including the END_BLOCK code */
+
+#define D_CODES 30
+/* number of distance codes */
+
+#define BL_CODES 19
+/* number of codes used to transfer the bit lengths */
+
+#define HEAP_SIZE (2*L_CODES+1)
+/* maximum heap size */
+
+#define MAX_BITS 15
+/* All codes must not exceed MAX_BITS bits */
+
+#define INIT_STATE 42
+#define BUSY_STATE 113
+#define FINISH_STATE 666
+/* Stream status */
+
+
+/* Data structure describing a single value and its code string. */
+typedef struct ct_data_s {
+ union {
+ ush freq; /* frequency count */
+ ush code; /* bit string */
+ } fc;
+ union {
+ ush dad; /* father node in Huffman tree */
+ ush len; /* length of bit string */
+ } dl;
+} FAR ct_data;
+
+#define Freq fc.freq
+#define Code fc.code
+#define Dad dl.dad
+#define Len dl.len
+
+typedef struct static_tree_desc_s static_tree_desc;
+
+typedef struct tree_desc_s {
+ ct_data *dyn_tree; /* the dynamic tree */
+ int max_code; /* largest code with non zero frequency */
+ static_tree_desc *stat_desc; /* the corresponding static tree */
+} FAR tree_desc;
+
+typedef ush Pos;
+typedef Pos FAR Posf;
+typedef unsigned IPos;
+
+/* A Pos is an index in the character window. We use short instead of int to
+ * save space in the various tables. IPos is used only for parameter passing.
+ */
+
+typedef struct internal_state {
+ z_streamp strm; /* pointer back to this zlib stream */
+ int status; /* as the name implies */
+ Bytef *pending_buf; /* output still pending */
+ ulg pending_buf_size; /* size of pending_buf */
+ Bytef *pending_out; /* next pending byte to output to the stream */
+ int pending; /* nb of bytes in the pending buffer */
+ int noheader; /* suppress zlib header and adler32 */
+ Byte data_type; /* UNKNOWN, BINARY or ASCII */
+ Byte method; /* STORED (for zip only) or DEFLATED */
+ int last_flush; /* value of flush param for previous deflate call */
+
+ /* used by deflate.c: */
+
+ uInt w_size; /* LZ77 window size (32K by default) */
+ uInt w_bits; /* log2(w_size) (8..16) */
+ uInt w_mask; /* w_size - 1 */
+
+ Bytef *window;
+ /* Sliding window. Input bytes are read into the second half of the window,
+ * and move to the first half later to keep a dictionary of at least wSize
+ * bytes. With this organization, matches are limited to a distance of
+ * wSize-MAX_MATCH bytes, but this ensures that IO is always
+ * performed with a length multiple of the block size. Also, it limits
+ * the window size to 64K, which is quite useful on MSDOS.
+ * To do: use the user input buffer as sliding window.
+ */
+
+ ulg window_size;
+ /* Actual size of window: 2*wSize, except when the user input buffer
+ * is directly used as sliding window.
+ */
+
+ Posf *prev;
+ /* Link to older string with same hash index. To limit the size of this
+ * array to 64K, this link is maintained only for the last 32K strings.
+ * An index in this array is thus a window index modulo 32K.
+ */
+
+ Posf *head; /* Heads of the hash chains or NIL. */
+
+ uInt ins_h; /* hash index of string to be inserted */
+ uInt hash_size; /* number of elements in hash table */
+ uInt hash_bits; /* log2(hash_size) */
+ uInt hash_mask; /* hash_size-1 */
+
+ uInt hash_shift;
+ /* Number of bits by which ins_h must be shifted at each input
+ * step. It must be such that after MIN_MATCH steps, the oldest
+ * byte no longer takes part in the hash key, that is:
+ * hash_shift * MIN_MATCH >= hash_bits
+ */
+
+ long block_start;
+ /* Window position at the beginning of the current output block. Gets
+ * negative when the window is moved backwards.
+ */
+
+ uInt match_length; /* length of best match */
+ IPos prev_match; /* previous match */
+ int match_available; /* set if previous match exists */
+ uInt strstart; /* start of string to insert */
+ uInt match_start; /* start of matching string */
+ uInt lookahead; /* number of valid bytes ahead in window */
+
+ uInt prev_length;
+ /* Length of the best match at previous step. Matches not greater than this
+ * are discarded. This is used in the lazy match evaluation.
+ */
+
+ uInt max_chain_length;
+ /* To speed up deflation, hash chains are never searched beyond this
+ * length. A higher limit improves compression ratio but degrades the
+ * speed.
+ */
+
+ uInt max_lazy_match;
+ /* Attempt to find a better match only when the current match is strictly
+ * smaller than this value. This mechanism is used only for compression
+ * levels >= 4.
+ */
+# define max_insert_length max_lazy_match
+ /* Insert new strings in the hash table only if the match length is not
+ * greater than this length. This saves time but degrades compression.
+ * max_insert_length is used only for compression levels <= 3.
+ */
+
+ int level; /* compression level (1..9) */
+ int strategy; /* favor or force Huffman coding*/
+
+ uInt good_match;
+ /* Use a faster search when the previous match is longer than this */
+
+ int nice_match; /* Stop searching when current match exceeds this */
+
+ /* used by trees.c: */
+ /* Didn't use ct_data typedef below to supress compiler warning */
+ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
+ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
+ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
+
+ struct tree_desc_s l_desc; /* desc. for literal tree */
+ struct tree_desc_s d_desc; /* desc. for distance tree */
+ struct tree_desc_s bl_desc; /* desc. for bit length tree */
+
+ ush bl_count[MAX_BITS+1];
+ /* number of codes at each bit length for an optimal tree */
+
+ int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
+ int heap_len; /* number of elements in the heap */
+ int heap_max; /* element of largest frequency */
+ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
+ * The same heap array is used to build all trees.
+ */
+
+ uch depth[2*L_CODES+1];
+ /* Depth of each subtree used as tie breaker for trees of equal frequency
+ */
+
+ uchf *l_buf; /* buffer for literals or lengths */
+
+ uInt lit_bufsize;
+ /* Size of match buffer for literals/lengths. There are 4 reasons for
+ * limiting lit_bufsize to 64K:
+ * - frequencies can be kept in 16 bit counters
+ * - if compression is not successful for the first block, all input
+ * data is still in the window so we can still emit a stored block even
+ * when input comes from standard input. (This can also be done for
+ * all blocks if lit_bufsize is not greater than 32K.)
+ * - if compression is not successful for a file smaller than 64K, we can
+ * even emit a stored file instead of a stored block (saving 5 bytes).
+ * This is applicable only for zip (not gzip or zlib).
+ * - creating new Huffman trees less frequently may not provide fast
+ * adaptation to changes in the input data statistics. (Take for
+ * example a binary file with poorly compressible code followed by
+ * a highly compressible string table.) Smaller buffer sizes give
+ * fast adaptation but have of course the overhead of transmitting
+ * trees more frequently.
+ * - I can't count above 4
+ */
+
+ uInt last_lit; /* running index in l_buf */
+
+ ushf *d_buf;
+ /* Buffer for distances. To simplify the code, d_buf and l_buf have
+ * the same number of elements. To use different lengths, an extra flag
+ * array would be necessary.
+ */
+
+ ulg opt_len; /* bit length of current block with optimal trees */
+ ulg static_len; /* bit length of current block with static trees */
+ uInt matches; /* number of string matches in current block */
+ int last_eob_len; /* bit length of EOB code for last block */
+
+#ifdef DEBUG
+ ulg compressed_len; /* total bit length of compressed file mod 2^32 */
+ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
+#endif
+
+ ush bi_buf;
+ /* Output buffer. bits are inserted starting at the bottom (least
+ * significant bits).
+ */
+ int bi_valid;
+ /* Number of valid bits in bi_buf. All bits above the last valid bit
+ * are always zero.
+ */
+
+} FAR deflate_state;
+
+/* Output a byte on the stream.
+ * IN assertion: there is enough room in pending_buf.
+ */
+#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
+
+
+#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
+/* Minimum amount of lookahead, except at the end of the input file.
+ * See deflate.c for comments about the MIN_MATCH+1.
+ */
+
+#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
+/* In order to simplify the code, particularly on 16 bit machines, match
+ * distances are limited to MAX_DIST instead of WSIZE.
+ */
+
+ /* in trees.c */
+void _tr_init OF((deflate_state *s));
+int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
+void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
+ int eof));
+void _tr_align OF((deflate_state *s));
+void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
+ int eof));
+
+#define d_code(dist) \
+ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
+/* Mapping from a distance to a distance code. dist is the distance - 1 and
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
+ * used.
+ */
+
+#ifndef DEBUG
+/* Inline versions of _tr_tally for speed: */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+ extern uch _length_code[];
+ extern uch _dist_code[];
+#else
+ extern const uch _length_code[];
+ extern const uch _dist_code[];
+#endif
+
+# define _tr_tally_lit(s, c, flush) \
+ { uch cc = (c); \
+ s->d_buf[s->last_lit] = 0; \
+ s->l_buf[s->last_lit++] = cc; \
+ s->dyn_ltree[cc].Freq++; \
+ flush = (s->last_lit == s->lit_bufsize-1); \
+ }
+# define _tr_tally_dist(s, distance, length, flush) \
+ { uch len = (length); \
+ ush dist = (distance); \
+ s->d_buf[s->last_lit] = dist; \
+ s->l_buf[s->last_lit++] = len; \
+ dist--; \
+ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+ s->dyn_dtree[d_code(dist)].Freq++; \
+ flush = (s->last_lit == s->lit_bufsize-1); \
+ }
+#else
+# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
+# define _tr_tally_dist(s, distance, length, flush) \
+ flush = _tr_tally(s, distance, length)
+#endif
+
+#endif
diff --git a/src/zlib/gzio.c b/src/zlib/gzio.c
new file mode 100644
index 000000000..b263008b0
--- /dev/null
+++ b/src/zlib/gzio.c
@@ -0,0 +1,875 @@
+/* gzio.c -- IO on .gz files
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * Compile this file with -DNO_DEFLATE to avoid the compression code.
+ */
+
+/* @(#) $Id: gzio.c 126 2003-11-09 01:53:27Z gabest $ */
+
+#include <stdio.h>
+
+#include "zutil.h"
+
+struct internal_state {int dummy;}; /* for buggy compilers */
+
+#ifndef Z_BUFSIZE
+# ifdef MAXSEG_64K
+# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
+# else
+# define Z_BUFSIZE 16384
+# endif
+#endif
+#ifndef Z_PRINTF_BUFSIZE
+# define Z_PRINTF_BUFSIZE 4096
+#endif
+
+#define ALLOC(size) malloc(size)
+#define TRYFREE(p) {if (p) free(p);}
+
+static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
+
+/* gzip flag byte */
+#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
+#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
+#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
+#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
+#define COMMENT 0x10 /* bit 4 set: file comment present */
+#define RESERVED 0xE0 /* bits 5..7: reserved */
+
+typedef struct gz_stream {
+ z_stream stream;
+ int z_err; /* error code for last stream operation */
+ int z_eof; /* set if end of input file */
+ FILE *file; /* .gz file */
+ Byte *inbuf; /* input buffer */
+ Byte *outbuf; /* output buffer */
+ uLong crc; /* crc32 of uncompressed data */
+ char *msg; /* error message */
+ char *path; /* path name for debugging only */
+ int transparent; /* 1 if input file is not a .gz file */
+ char mode; /* 'w' or 'r' */
+ long startpos; /* start of compressed data in file (header skipped) */
+} gz_stream;
+
+
+local gzFile gz_open OF((const char *path, const char *mode, int fd));
+local int do_flush OF((gzFile file, int flush));
+local int get_byte OF((gz_stream *s));
+local void check_header OF((gz_stream *s));
+local int destroy OF((gz_stream *s));
+local void putLong OF((FILE *file, uLong x));
+local uLong getLong OF((gz_stream *s));
+
+/* ===========================================================================
+ Opens a gzip (.gz) file for reading or writing. The mode parameter
+ is as in fopen ("rb" or "wb"). The file is given either by file descriptor
+ or path name (if fd == -1).
+ gz_open return NULL if the file could not be opened or if there was
+ insufficient memory to allocate the (de)compression state; errno
+ can be checked to distinguish the two cases (if errno is zero, the
+ zlib error is Z_MEM_ERROR).
+*/
+local gzFile gz_open (path, mode, fd)
+ const char *path;
+ const char *mode;
+ int fd;
+{
+ int err;
+ int level = Z_DEFAULT_COMPRESSION; /* compression level */
+ int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
+ char *p = (char*)mode;
+ gz_stream *s;
+ char fmode[80]; /* copy of mode, without the compression level */
+ char *m = fmode;
+
+ if (!path || !mode) return Z_NULL;
+
+ s = (gz_stream *)ALLOC(sizeof(gz_stream));
+ if (!s) return Z_NULL;
+
+ s->stream.zalloc = (alloc_func)0;
+ s->stream.zfree = (free_func)0;
+ s->stream.opaque = (voidpf)0;
+ s->stream.next_in = s->inbuf = Z_NULL;
+ s->stream.next_out = s->outbuf = Z_NULL;
+ s->stream.avail_in = s->stream.avail_out = 0;
+ s->file = NULL;
+ s->z_err = Z_OK;
+ s->z_eof = 0;
+ s->crc = crc32(0L, Z_NULL, 0);
+ s->msg = NULL;
+ s->transparent = 0;
+
+ s->path = (char*)ALLOC(strlen(path)+1);
+ if (s->path == NULL) {
+ return destroy(s), (gzFile)Z_NULL;
+ }
+ strcpy(s->path, path); /* do this early for debugging */
+
+ s->mode = '\0';
+ do {
+ if (*p == 'r') s->mode = 'r';
+ if (*p == 'w' || *p == 'a') s->mode = 'w';
+ if (*p >= '0' && *p <= '9') {
+ level = *p - '0';
+ } else if (*p == 'f') {
+ strategy = Z_FILTERED;
+ } else if (*p == 'h') {
+ strategy = Z_HUFFMAN_ONLY;
+ } else {
+ *m++ = *p; /* copy the mode */
+ }
+ } while (*p++ && m != fmode + sizeof(fmode));
+ if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
+
+ if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+ err = Z_STREAM_ERROR;
+#else
+ err = deflateInit2(&(s->stream), level,
+ Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
+ /* windowBits is passed < 0 to suppress zlib header */
+
+ s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+#endif
+ if (err != Z_OK || s->outbuf == Z_NULL) {
+ return destroy(s), (gzFile)Z_NULL;
+ }
+ } else {
+ s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
+
+ err = inflateInit2(&(s->stream), -MAX_WBITS);
+ /* windowBits is passed < 0 to tell that there is no zlib header.
+ * Note that in this case inflate *requires* an extra "dummy" byte
+ * after the compressed stream in order to complete decompression and
+ * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
+ * present after the compressed stream.
+ */
+ if (err != Z_OK || s->inbuf == Z_NULL) {
+ return destroy(s), (gzFile)Z_NULL;
+ }
+ }
+ s->stream.avail_out = Z_BUFSIZE;
+
+ errno = 0;
+ s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
+
+ if (s->file == NULL) {
+ return destroy(s), (gzFile)Z_NULL;
+ }
+ if (s->mode == 'w') {
+ /* Write a very simple .gz header:
+ */
+ fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
+ Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
+ s->startpos = 10L;
+ /* We use 10L instead of ftell(s->file) to because ftell causes an
+ * fflush on some systems. This version of the library doesn't use
+ * startpos anyway in write mode, so this initialization is not
+ * necessary.
+ */
+ } else {
+ check_header(s); /* skip the .gz header */
+ s->startpos = (ftell(s->file) - s->stream.avail_in);
+ }
+
+ return (gzFile)s;
+}
+
+/* ===========================================================================
+ Opens a gzip (.gz) file for reading or writing.
+*/
+gzFile ZEXPORT gzopen (path, mode)
+ const char *path;
+ const char *mode;
+{
+ return gz_open (path, mode, -1);
+}
+
+/* ===========================================================================
+ Associate a gzFile with the file descriptor fd. fd is not dup'ed here
+ to mimic the behavio(u)r of fdopen.
+*/
+gzFile ZEXPORT gzdopen (fd, mode)
+ int fd;
+ const char *mode;
+{
+ char name[20];
+
+ if (fd < 0) return (gzFile)Z_NULL;
+ sprintf(name, "<fd:%d>", fd); /* for debugging */
+
+ return gz_open (name, mode, fd);
+}
+
+/* ===========================================================================
+ * Update the compression level and strategy
+ */
+int ZEXPORT gzsetparams (file, level, strategy)
+ gzFile file;
+ int level;
+ int strategy;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+ /* Make room to allow flushing */
+ if (s->stream.avail_out == 0) {
+
+ s->stream.next_out = s->outbuf;
+ if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+ s->z_err = Z_ERRNO;
+ }
+ s->stream.avail_out = Z_BUFSIZE;
+ }
+
+ return deflateParams (&(s->stream), level, strategy);
+}
+
+/* ===========================================================================
+ Read a byte from a gz_stream; update next_in and avail_in. Return EOF
+ for end of file.
+ IN assertion: the stream s has been sucessfully opened for reading.
+*/
+local int get_byte(s)
+ gz_stream *s;
+{
+ if (s->z_eof) return EOF;
+ if (s->stream.avail_in == 0) {
+ errno = 0;
+ s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+ if (s->stream.avail_in == 0) {
+ s->z_eof = 1;
+ if (ferror(s->file)) s->z_err = Z_ERRNO;
+ return EOF;
+ }
+ s->stream.next_in = s->inbuf;
+ }
+ s->stream.avail_in--;
+ return *(s->stream.next_in)++;
+}
+
+/* ===========================================================================
+ Check the gzip header of a gz_stream opened for reading. Set the stream
+ mode to transparent if the gzip magic header is not present; set s->err
+ to Z_DATA_ERROR if the magic header is present but the rest of the header
+ is incorrect.
+ IN assertion: the stream s has already been created sucessfully;
+ s->stream.avail_in is zero for the first time, but may be non-zero
+ for concatenated .gz files.
+*/
+local void check_header(s)
+ gz_stream *s;
+{
+ int method; /* method byte */
+ int flags; /* flags byte */
+ uInt len;
+ int c;
+
+ /* Check the gzip magic header */
+ for (len = 0; len < 2; len++) {
+ c = get_byte(s);
+ if (c != gz_magic[len]) {
+ if (len != 0) s->stream.avail_in++, s->stream.next_in--;
+ if (c != EOF) {
+ s->stream.avail_in++, s->stream.next_in--;
+ s->transparent = 1;
+ }
+ s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END;
+ return;
+ }
+ }
+ method = get_byte(s);
+ flags = get_byte(s);
+ if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
+ s->z_err = Z_DATA_ERROR;
+ return;
+ }
+
+ /* Discard time, xflags and OS code: */
+ for (len = 0; len < 6; len++) (void)get_byte(s);
+
+ if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
+ len = (uInt)get_byte(s);
+ len += ((uInt)get_byte(s))<<8;
+ /* len is garbage if EOF but the loop below will quit anyway */
+ while (len-- != 0 && get_byte(s) != EOF) ;
+ }
+ if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
+ while ((c = get_byte(s)) != 0 && c != EOF) ;
+ }
+ if ((flags & COMMENT) != 0) { /* skip the .gz file comment */
+ while ((c = get_byte(s)) != 0 && c != EOF) ;
+ }
+ if ((flags & HEAD_CRC) != 0) { /* skip the header crc */
+ for (len = 0; len < 2; len++) (void)get_byte(s);
+ }
+ s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
+}
+
+ /* ===========================================================================
+ * Cleanup then free the given gz_stream. Return a zlib error code.
+ Try freeing in the reverse order of allocations.
+ */
+local int destroy (s)
+ gz_stream *s;
+{
+ int err = Z_OK;
+
+ if (!s) return Z_STREAM_ERROR;
+
+ TRYFREE(s->msg);
+
+ if (s->stream.state != NULL) {
+ if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+ err = Z_STREAM_ERROR;
+#else
+ err = deflateEnd(&(s->stream));
+#endif
+ } else if (s->mode == 'r') {
+ err = inflateEnd(&(s->stream));
+ }
+ }
+ if (s->file != NULL && fclose(s->file)) {
+#ifdef ESPIPE
+ if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
+#endif
+ err = Z_ERRNO;
+ }
+ if (s->z_err < 0) err = s->z_err;
+
+ TRYFREE(s->inbuf);
+ TRYFREE(s->outbuf);
+ TRYFREE(s->path);
+ TRYFREE(s);
+ return err;
+}
+
+/* ===========================================================================
+ Reads the given number of uncompressed bytes from the compressed file.
+ gzread returns the number of bytes actually read (0 for end of file).
+*/
+int ZEXPORT gzread (file, buf, len)
+ gzFile file;
+ voidp buf;
+ unsigned len;
+{
+ gz_stream *s = (gz_stream*)file;
+ Bytef *start = (Bytef*)buf; /* starting point for crc computation */
+ Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
+
+ if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
+
+ if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
+ if (s->z_err == Z_STREAM_END) return 0; /* EOF */
+
+ next_out = (Byte*)buf;
+ s->stream.next_out = (Bytef*)buf;
+ s->stream.avail_out = len;
+
+ while (s->stream.avail_out != 0) {
+
+ if (s->transparent) {
+ /* Copy first the lookahead bytes: */
+ uInt n = s->stream.avail_in;
+ if (n > s->stream.avail_out) n = s->stream.avail_out;
+ if (n > 0) {
+ zmemcpy(s->stream.next_out, s->stream.next_in, n);
+ next_out += n;
+ s->stream.next_out = next_out;
+ s->stream.next_in += n;
+ s->stream.avail_out -= n;
+ s->stream.avail_in -= n;
+ }
+ if (s->stream.avail_out > 0) {
+ s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out,
+ s->file);
+ }
+ len -= s->stream.avail_out;
+ s->stream.total_in += (uLong)len;
+ s->stream.total_out += (uLong)len;
+ if (len == 0) s->z_eof = 1;
+ return (int)len;
+ }
+ if (s->stream.avail_in == 0 && !s->z_eof) {
+
+ errno = 0;
+ s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
+ if (s->stream.avail_in == 0) {
+ s->z_eof = 1;
+ if (ferror(s->file)) {
+ s->z_err = Z_ERRNO;
+ break;
+ }
+ }
+ s->stream.next_in = s->inbuf;
+ }
+ s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
+
+ if (s->z_err == Z_STREAM_END) {
+ /* Check CRC and original size */
+ s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+ start = s->stream.next_out;
+
+ if (getLong(s) != s->crc) {
+ s->z_err = Z_DATA_ERROR;
+ } else {
+ (void)getLong(s);
+ /* The uncompressed length returned by above getlong() may
+ * be different from s->stream.total_out) in case of
+ * concatenated .gz files. Check for such files:
+ */
+ check_header(s);
+ if (s->z_err == Z_OK) {
+ uLong total_in = s->stream.total_in;
+ uLong total_out = s->stream.total_out;
+
+ inflateReset(&(s->stream));
+ s->stream.total_in = total_in;
+ s->stream.total_out = total_out;
+ s->crc = crc32(0L, Z_NULL, 0);
+ }
+ }
+ }
+ if (s->z_err != Z_OK || s->z_eof) break;
+ }
+ s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
+
+ return (int)(len - s->stream.avail_out);
+}
+
+
+/* ===========================================================================
+ Reads one byte from the compressed file. gzgetc returns this byte
+ or -1 in case of end of file or error.
+*/
+int ZEXPORT gzgetc(file)
+ gzFile file;
+{
+ unsigned char c;
+
+ return gzread(file, &c, 1) == 1 ? c : -1;
+}
+
+
+/* ===========================================================================
+ Reads bytes from the compressed file until len-1 characters are
+ read, or a newline character is read and transferred to buf, or an
+ end-of-file condition is encountered. The string is then terminated
+ with a null character.
+ gzgets returns buf, or Z_NULL in case of error.
+
+ The current implementation is not optimized at all.
+*/
+char * ZEXPORT gzgets(file, buf, len)
+ gzFile file;
+ char *buf;
+ int len;
+{
+ char *b = buf;
+ if (buf == Z_NULL || len <= 0) return Z_NULL;
+
+ while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
+ *buf = '\0';
+ return b == buf && len > 0 ? Z_NULL : b;
+}
+
+
+#ifndef NO_DEFLATE
+/* ===========================================================================
+ Writes the given number of uncompressed bytes into the compressed file.
+ gzwrite returns the number of bytes actually written (0 in case of error).
+*/
+int ZEXPORT gzwrite (file, buf, len)
+ gzFile file;
+ const voidp buf;
+ unsigned len;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+ s->stream.next_in = (Bytef*)buf;
+ s->stream.avail_in = len;
+
+ while (s->stream.avail_in != 0) {
+
+ if (s->stream.avail_out == 0) {
+
+ s->stream.next_out = s->outbuf;
+ if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
+ s->z_err = Z_ERRNO;
+ break;
+ }
+ s->stream.avail_out = Z_BUFSIZE;
+ }
+ s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
+ if (s->z_err != Z_OK) break;
+ }
+ s->crc = crc32(s->crc, (const Bytef *)buf, len);
+
+ return (int)(len - s->stream.avail_in);
+}
+
+/* ===========================================================================
+ Converts, formats, and writes the args to the compressed file under
+ control of the format string, as in fprintf. gzprintf returns the number of
+ uncompressed bytes actually written (0 in case of error).
+*/
+#ifdef STDC
+#include <stdarg.h>
+
+int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
+{
+ char buf[Z_PRINTF_BUFSIZE];
+ va_list va;
+ int len;
+
+ va_start(va, format);
+#ifdef HAS_vsnprintf
+ (void)vsnprintf(buf, sizeof(buf), format, va);
+#else
+ (void)vsprintf(buf, format, va);
+#endif
+ va_end(va);
+ len = strlen(buf); /* some *sprintf don't return the nb of bytes written */
+ if (len <= 0) return 0;
+
+ return gzwrite(file, buf, (unsigned)len);
+}
+#else /* not ANSI C */
+
+int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+ a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
+ gzFile file;
+ const char *format;
+ int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
+ a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
+{
+ char buf[Z_PRINTF_BUFSIZE];
+ int len;
+
+#ifdef HAS_snprintf
+ snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+#else
+ sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
+ a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+#endif
+ len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */
+ if (len <= 0) return 0;
+
+ return gzwrite(file, buf, len);
+}
+#endif
+
+/* ===========================================================================
+ Writes c, converted to an unsigned char, into the compressed file.
+ gzputc returns the value that was written, or -1 in case of error.
+*/
+int ZEXPORT gzputc(file, c)
+ gzFile file;
+ int c;
+{
+ unsigned char cc = (unsigned char) c; /* required for big endian systems */
+
+ return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
+}
+
+
+/* ===========================================================================
+ Writes the given null-terminated string to the compressed file, excluding
+ the terminating null character.
+ gzputs returns the number of characters written, or -1 in case of error.
+*/
+int ZEXPORT gzputs(file, s)
+ gzFile file;
+ const char *s;
+{
+ return gzwrite(file, (char*)s, (unsigned)strlen(s));
+}
+
+
+/* ===========================================================================
+ Flushes all pending output into the compressed file. The parameter
+ flush is as in the deflate() function.
+*/
+local int do_flush (file, flush)
+ gzFile file;
+ int flush;
+{
+ uInt len;
+ int done = 0;
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
+
+ s->stream.avail_in = 0; /* should be zero already anyway */
+
+ for (;;) {
+ len = Z_BUFSIZE - s->stream.avail_out;
+
+ if (len != 0) {
+ if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
+ s->z_err = Z_ERRNO;
+ return Z_ERRNO;
+ }
+ s->stream.next_out = s->outbuf;
+ s->stream.avail_out = Z_BUFSIZE;
+ }
+ if (done) break;
+ s->z_err = deflate(&(s->stream), flush);
+
+ /* Ignore the second of two consecutive flushes: */
+ if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
+
+ /* deflate has finished flushing only when it hasn't used up
+ * all the available space in the output buffer:
+ */
+ done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
+
+ if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
+ }
+ return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+}
+
+int ZEXPORT gzflush (file, flush)
+ gzFile file;
+ int flush;
+{
+ gz_stream *s = (gz_stream*)file;
+ int err = do_flush (file, flush);
+
+ if (err) return err;
+ fflush(s->file);
+ return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
+}
+#endif /* NO_DEFLATE */
+
+/* ===========================================================================
+ Sets the starting position for the next gzread or gzwrite on the given
+ compressed file. The offset represents a number of bytes in the
+ gzseek returns the resulting offset location as measured in bytes from
+ the beginning of the uncompressed stream, or -1 in case of error.
+ SEEK_END is not implemented, returns error.
+ In this version of the library, gzseek can be extremely slow.
+*/
+z_off_t ZEXPORT gzseek (file, offset, whence)
+ gzFile file;
+ z_off_t offset;
+ int whence;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || whence == SEEK_END ||
+ s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
+ return -1L;
+ }
+
+ if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+ return -1L;
+#else
+ if (whence == SEEK_SET) {
+ offset -= s->stream.total_in;
+ }
+ if (offset < 0) return -1L;
+
+ /* At this point, offset is the number of zero bytes to write. */
+ if (s->inbuf == Z_NULL) {
+ s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
+ zmemzero(s->inbuf, Z_BUFSIZE);
+ }
+ while (offset > 0) {
+ uInt size = Z_BUFSIZE;
+ if (offset < Z_BUFSIZE) size = (uInt)offset;
+
+ size = gzwrite(file, s->inbuf, size);
+ if (size == 0) return -1L;
+
+ offset -= size;
+ }
+ return (z_off_t)s->stream.total_in;
+#endif
+ }
+ /* Rest of function is for reading only */
+
+ /* compute absolute position */
+ if (whence == SEEK_CUR) {
+ offset += s->stream.total_out;
+ }
+ if (offset < 0) return -1L;
+
+ if (s->transparent) {
+ /* map to fseek */
+ s->stream.avail_in = 0;
+ s->stream.next_in = s->inbuf;
+ if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
+
+ s->stream.total_in = s->stream.total_out = (uLong)offset;
+ return offset;
+ }
+
+ /* For a negative seek, rewind and use positive seek */
+ if ((uLong)offset >= s->stream.total_out) {
+ offset -= s->stream.total_out;
+ } else if (gzrewind(file) < 0) {
+ return -1L;
+ }
+ /* offset is now the number of bytes to skip. */
+
+ if (offset != 0 && s->outbuf == Z_NULL) {
+ s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
+ }
+ while (offset > 0) {
+ int size = Z_BUFSIZE;
+ if (offset < Z_BUFSIZE) size = (int)offset;
+
+ size = gzread(file, s->outbuf, (uInt)size);
+ if (size <= 0) return -1L;
+ offset -= size;
+ }
+ return (z_off_t)s->stream.total_out;
+}
+
+/* ===========================================================================
+ Rewinds input file.
+*/
+int ZEXPORT gzrewind (file)
+ gzFile file;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL || s->mode != 'r') return -1;
+
+ s->z_err = Z_OK;
+ s->z_eof = 0;
+ s->stream.avail_in = 0;
+ s->stream.next_in = s->inbuf;
+ s->crc = crc32(0L, Z_NULL, 0);
+
+ if (s->startpos == 0) { /* not a compressed file */
+ rewind(s->file);
+ return 0;
+ }
+
+ (void) inflateReset(&s->stream);
+ return fseek(s->file, s->startpos, SEEK_SET);
+}
+
+/* ===========================================================================
+ Returns the starting position for the next gzread or gzwrite on the
+ given compressed file. This position represents a number of bytes in the
+ uncompressed data stream.
+*/
+z_off_t ZEXPORT gztell (file)
+ gzFile file;
+{
+ return gzseek(file, 0L, SEEK_CUR);
+}
+
+/* ===========================================================================
+ Returns 1 when EOF has previously been detected reading the given
+ input stream, otherwise zero.
+*/
+int ZEXPORT gzeof (file)
+ gzFile file;
+{
+ gz_stream *s = (gz_stream*)file;
+
+ return (s == NULL || s->mode != 'r') ? 0 : s->z_eof;
+}
+
+/* ===========================================================================
+ Outputs a long in LSB order to the given file
+*/
+local void putLong (file, x)
+ FILE *file;
+ uLong x;
+{
+ int n;
+ for (n = 0; n < 4; n++) {
+ fputc((int)(x & 0xff), file);
+ x >>= 8;
+ }
+}
+
+/* ===========================================================================
+ Reads a long in LSB order from the given gz_stream. Sets z_err in case
+ of error.
+*/
+local uLong getLong (s)
+ gz_stream *s;
+{
+ uLong x = (uLong)get_byte(s);
+ int c;
+
+ x += ((uLong)get_byte(s))<<8;
+ x += ((uLong)get_byte(s))<<16;
+ c = get_byte(s);
+ if (c == EOF) s->z_err = Z_DATA_ERROR;
+ x += ((uLong)c)<<24;
+ return x;
+}
+
+/* ===========================================================================
+ Flushes all pending output if necessary, closes the compressed file
+ and deallocates all the (de)compression state.
+*/
+int ZEXPORT gzclose (file)
+ gzFile file;
+{
+ int err;
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL) return Z_STREAM_ERROR;
+
+ if (s->mode == 'w') {
+#ifdef NO_DEFLATE
+ return Z_STREAM_ERROR;
+#else
+ err = do_flush (file, Z_FINISH);
+ if (err != Z_OK) return destroy((gz_stream*)file);
+
+ putLong (s->file, s->crc);
+ putLong (s->file, s->stream.total_in);
+#endif
+ }
+ return destroy((gz_stream*)file);
+}
+
+/* ===========================================================================
+ Returns the error message for the last error which occured on the
+ given compressed file. errnum is set to zlib error number. If an
+ error occured in the file system and not in the compression library,
+ errnum is set to Z_ERRNO and the application may consult errno
+ to get the exact error code.
+*/
+const char* ZEXPORT gzerror (file, errnum)
+ gzFile file;
+ int *errnum;
+{
+ char *m;
+ gz_stream *s = (gz_stream*)file;
+
+ if (s == NULL) {
+ *errnum = Z_STREAM_ERROR;
+ return (const char*)ERR_MSG(Z_STREAM_ERROR);
+ }
+ *errnum = s->z_err;
+ if (*errnum == Z_OK) return (const char*)"";
+
+ m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
+
+ if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
+
+ TRYFREE(s->msg);
+ s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
+ strcpy(s->msg, s->path);
+ strcat(s->msg, ": ");
+ strcat(s->msg, m);
+ return (const char*)s->msg;
+}
diff --git a/src/zlib/infblock.c b/src/zlib/infblock.c
new file mode 100644
index 000000000..943e8493c
--- /dev/null
+++ b/src/zlib/infblock.c
@@ -0,0 +1,403 @@
+/* infblock.c -- interpret and process block types to last block
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "infblock.h"
+#include "inftrees.h"
+#include "infcodes.h"
+#include "infutil.h"
+
+struct inflate_codes_state {int dummy;}; /* for buggy compilers */
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+/* Table for deflate from PKZIP's appnote.txt. */
+local const uInt border[] = { /* Order of the bit length code lengths */
+ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+
+/*
+ Notes beyond the 1.93a appnote.txt:
+
+ 1. Distance pointers never point before the beginning of the output
+ stream.
+ 2. Distance pointers can point back across blocks, up to 32k away.
+ 3. There is an implied maximum of 7 bits for the bit length table and
+ 15 bits for the actual data.
+ 4. If only one code exists, then it is encoded using one bit. (Zero
+ would be more efficient, but perhaps a little confusing.) If two
+ codes exist, they are coded using one bit each (0 and 1).
+ 5. There is no way of sending zero distance codes--a dummy must be
+ sent if there are none. (History: a pre 2.0 version of PKZIP would
+ store blocks with no distance codes, but this was discovered to be
+ too harsh a criterion.) Valid only for 1.93a. 2.04c does allow
+ zero distance codes, which is sent as one code of zero bits in
+ length.
+ 6. There are up to 286 literal/length codes. Code 256 represents the
+ end-of-block. Note however that the static length tree defines
+ 288 codes just to fill out the Huffman codes. Codes 286 and 287
+ cannot be used though, since there is no length base or extra bits
+ defined for them. Similarily, there are up to 30 distance codes.
+ However, static trees define 32 codes (all 5 bits) to fill out the
+ Huffman codes, but the last two had better not show up in the data.
+ 7. Unzip can check dynamic Huffman blocks for complete code sets.
+ The exception is that a single code would not be complete (see #4).
+ 8. The five bits following the block type is really the number of
+ literal codes sent minus 257.
+ 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits
+ (1+6+6). Therefore, to output three times the length, you output
+ three codes (1+1+1), whereas to output four times the same length,
+ you only need two codes (1+3). Hmm.
+ 10. In the tree reconstruction algorithm, Code = Code + Increment
+ only if BitLength(i) is not zero. (Pretty obvious.)
+ 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19)
+ 12. Note: length code 284 can represent 227-258, but length code 285
+ really is 258. The last length deserves its own, short code
+ since it gets used a lot in very redundant files. The length
+ 258 is special since 258 - 3 (the min match length) is 255.
+ 13. The literal/length and distance code bit lengths are read as a
+ single stream of lengths. It is possible (and advantageous) for
+ a repeat code (16, 17, or 18) to go across the boundary between
+ the two sets of lengths.
+ */
+
+
+void inflate_blocks_reset(s, z, c)
+inflate_blocks_statef *s;
+z_streamp z;
+uLongf *c;
+{
+ if (c != Z_NULL)
+ *c = s->check;
+ if (s->mode == BTREE || s->mode == DTREE)
+ ZFREE(z, s->sub.trees.blens);
+ if (s->mode == CODES)
+ inflate_codes_free(s->sub.decode.codes, z);
+ s->mode = TYPE;
+ s->bitk = 0;
+ s->bitb = 0;
+ s->read = s->write = s->window;
+ if (s->checkfn != Z_NULL)
+ z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
+ Tracev((stderr, "inflate: blocks reset\n"));
+}
+
+
+inflate_blocks_statef *inflate_blocks_new(z, c, w)
+z_streamp z;
+check_func c;
+uInt w;
+{
+ inflate_blocks_statef *s;
+
+ if ((s = (inflate_blocks_statef *)ZALLOC
+ (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
+ return s;
+ if ((s->hufts =
+ (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL)
+ {
+ ZFREE(z, s);
+ return Z_NULL;
+ }
+ if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
+ {
+ ZFREE(z, s->hufts);
+ ZFREE(z, s);
+ return Z_NULL;
+ }
+ s->end = s->window + w;
+ s->checkfn = c;
+ s->mode = TYPE;
+ Tracev((stderr, "inflate: blocks allocated\n"));
+ inflate_blocks_reset(s, z, Z_NULL);
+ return s;
+}
+
+
+int inflate_blocks(s, z, r)
+inflate_blocks_statef *s;
+z_streamp z;
+int r;
+{
+ uInt t; /* temporary storage */
+ uLong b; /* bit buffer */
+ uInt k; /* bits in bit buffer */
+ Bytef *p; /* input data pointer */
+ uInt n; /* bytes available there */
+ Bytef *q; /* output window write pointer */
+ uInt m; /* bytes to end of window or read pointer */
+
+ /* copy input/output information to locals (UPDATE macro restores) */
+ LOAD
+
+ /* process input based on current state */
+ while (1) switch (s->mode)
+ {
+ case TYPE:
+ NEEDBITS(3)
+ t = (uInt)b & 7;
+ s->last = t & 1;
+ switch (t >> 1)
+ {
+ case 0: /* stored */
+ Tracev((stderr, "inflate: stored block%s\n",
+ s->last ? " (last)" : ""));
+ DUMPBITS(3)
+ t = k & 7; /* go to byte boundary */
+ DUMPBITS(t)
+ s->mode = LENS; /* get length of stored block */
+ break;
+ case 1: /* fixed */
+ Tracev((stderr, "inflate: fixed codes block%s\n",
+ s->last ? " (last)" : ""));
+ {
+ uInt bl, bd;
+ inflate_huft *tl, *td;
+
+ inflate_trees_fixed(&bl, &bd, &tl, &td, z);
+ s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z);
+ if (s->sub.decode.codes == Z_NULL)
+ {
+ r = Z_MEM_ERROR;
+ LEAVE
+ }
+ }
+ DUMPBITS(3)
+ s->mode = CODES;
+ break;
+ case 2: /* dynamic */
+ Tracev((stderr, "inflate: dynamic codes block%s\n",
+ s->last ? " (last)" : ""));
+ DUMPBITS(3)
+ s->mode = TABLE;
+ break;
+ case 3: /* illegal */
+ DUMPBITS(3)
+ s->mode = BAD;
+ z->msg = (char*)"invalid block type";
+ r = Z_DATA_ERROR;
+ LEAVE
+ }
+ break;
+ case LENS:
+ NEEDBITS(32)
+ if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
+ {
+ s->mode = BAD;
+ z->msg = (char*)"invalid stored block lengths";
+ r = Z_DATA_ERROR;
+ LEAVE
+ }
+ s->sub.left = (uInt)b & 0xffff;
+ b = k = 0; /* dump bits */
+ Tracev((stderr, "inflate: stored length %u\n", s->sub.left));
+ s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
+ break;
+ case STORED:
+ if (n == 0)
+ LEAVE
+ NEEDOUT
+ t = s->sub.left;
+ if (t > n) t = n;
+ if (t > m) t = m;
+ zmemcpy(q, p, t);
+ p += t; n -= t;
+ q += t; m -= t;
+ if ((s->sub.left -= t) != 0)
+ break;
+ Tracev((stderr, "inflate: stored end, %lu total out\n",
+ z->total_out + (q >= s->read ? q - s->read :
+ (s->end - s->read) + (q - s->window))));
+ s->mode = s->last ? DRY : TYPE;
+ break;
+ case TABLE:
+ NEEDBITS(14)
+ s->sub.trees.table = t = (uInt)b & 0x3fff;
+#ifndef PKZIP_BUG_WORKAROUND
+ if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29)
+ {
+ s->mode = BAD;
+ z->msg = (char*)"too many length or distance symbols";
+ r = Z_DATA_ERROR;
+ LEAVE
+ }
+#endif
+ t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
+ if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL)
+ {
+ r = Z_MEM_ERROR;
+ LEAVE
+ }
+ DUMPBITS(14)
+ s->sub.trees.index = 0;
+ Tracev((stderr, "inflate: table sizes ok\n"));
+ s->mode = BTREE;
+ case BTREE:
+ while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
+ {
+ NEEDBITS(3)
+ s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7;
+ DUMPBITS(3)
+ }
+ while (s->sub.trees.index < 19)
+ s->sub.trees.blens[border[s->sub.trees.index++]] = 0;
+ s->sub.trees.bb = 7;
+ t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb,
+ &s->sub.trees.tb, s->hufts, z);
+ if (t != Z_OK)
+ {
+ r = t;
+ if (r == Z_DATA_ERROR)
+ {
+ ZFREE(z, s->sub.trees.blens);
+ s->mode = BAD;
+ }
+ LEAVE
+ }
+ s->sub.trees.index = 0;
+ Tracev((stderr, "inflate: bits tree ok\n"));
+ s->mode = DTREE;
+ case DTREE:
+ while (t = s->sub.trees.table,
+ s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
+ {
+ inflate_huft *h;
+ uInt i, j, c;
+
+ t = s->sub.trees.bb;
+ NEEDBITS(t)
+ h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]);
+ t = h->bits;
+ c = h->base;
+ if (c < 16)
+ {
+ DUMPBITS(t)
+ s->sub.trees.blens[s->sub.trees.index++] = c;
+ }
+ else /* c == 16..18 */
+ {
+ i = c == 18 ? 7 : c - 14;
+ j = c == 18 ? 11 : 3;
+ NEEDBITS(t + i)
+ DUMPBITS(t)
+ j += (uInt)b & inflate_mask[i];
+ DUMPBITS(i)
+ i = s->sub.trees.index;
+ t = s->sub.trees.table;
+ if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) ||
+ (c == 16 && i < 1))
+ {
+ ZFREE(z, s->sub.trees.blens);
+ s->mode = BAD;
+ z->msg = (char*)"invalid bit length repeat";
+ r = Z_DATA_ERROR;
+ LEAVE
+ }
+ c = c == 16 ? s->sub.trees.blens[i - 1] : 0;
+ do {
+ s->sub.trees.blens[i++] = c;
+ } while (--j);
+ s->sub.trees.index = i;
+ }
+ }
+ s->sub.trees.tb = Z_NULL;
+ {
+ uInt bl, bd;
+ inflate_huft *tl, *td;
+ inflate_codes_statef *c;
+
+ bl = 9; /* must be <= 9 for lookahead assumptions */
+ bd = 6; /* must be <= 9 for lookahead assumptions */
+ t = s->sub.trees.table;
+ t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
+ s->sub.trees.blens, &bl, &bd, &tl, &td,
+ s->hufts, z);
+ if (t != Z_OK)
+ {
+ if (t == (uInt)Z_DATA_ERROR)
+ {
+ ZFREE(z, s->sub.trees.blens);
+ s->mode = BAD;
+ }
+ r = t;
+ LEAVE
+ }
+ Tracev((stderr, "inflate: trees ok\n"));
+ if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
+ {
+ r = Z_MEM_ERROR;
+ LEAVE
+ }
+ s->sub.decode.codes = c;
+ }
+ ZFREE(z, s->sub.trees.blens);
+ s->mode = CODES;
+ case CODES:
+ UPDATE
+ if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
+ return inflate_flush(s, z, r);
+ r = Z_OK;
+ inflate_codes_free(s->sub.decode.codes, z);
+ LOAD
+ Tracev((stderr, "inflate: codes end, %lu total out\n",
+ z->total_out + (q >= s->read ? q - s->read :
+ (s->end - s->read) + (q - s->window))));
+ if (!s->last)
+ {
+ s->mode = TYPE;
+ break;
+ }
+ s->mode = DRY;
+ case DRY:
+ FLUSH
+ if (s->read != s->write)
+ LEAVE
+ s->mode = DONE;
+ case DONE:
+ r = Z_STREAM_END;
+ LEAVE
+ case BAD:
+ r = Z_DATA_ERROR;
+ LEAVE
+ default:
+ r = Z_STREAM_ERROR;
+ LEAVE
+ }
+}
+
+
+int inflate_blocks_free(s, z)
+inflate_blocks_statef *s;
+z_streamp z;
+{
+ inflate_blocks_reset(s, z, Z_NULL);
+ ZFREE(z, s->window);
+ ZFREE(z, s->hufts);
+ ZFREE(z, s);
+ Tracev((stderr, "inflate: blocks freed\n"));
+ return Z_OK;
+}
+
+
+void inflate_set_dictionary(s, d, n)
+inflate_blocks_statef *s;
+const Bytef *d;
+uInt n;
+{
+ zmemcpy(s->window, d, n);
+ s->read = s->write = s->window + n;
+}
+
+
+/* Returns true if inflate is currently at the end of a block generated
+ * by Z_SYNC_FLUSH or Z_FULL_FLUSH.
+ * IN assertion: s != Z_NULL
+ */
+int inflate_blocks_sync_point(s)
+inflate_blocks_statef *s;
+{
+ return s->mode == LENS;
+}
diff --git a/src/zlib/infblock.h b/src/zlib/infblock.h
new file mode 100644
index 000000000..4cf0fa969
--- /dev/null
+++ b/src/zlib/infblock.h
@@ -0,0 +1,39 @@
+/* infblock.h -- header to use infblock.c
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+struct inflate_blocks_state;
+typedef struct inflate_blocks_state FAR inflate_blocks_statef;
+
+extern inflate_blocks_statef * inflate_blocks_new OF((
+ z_streamp z,
+ check_func c, /* check function */
+ uInt w)); /* window size */
+
+extern int inflate_blocks OF((
+ inflate_blocks_statef *,
+ z_streamp ,
+ int)); /* initial return code */
+
+extern void inflate_blocks_reset OF((
+ inflate_blocks_statef *,
+ z_streamp ,
+ uLongf *)); /* check value on output */
+
+extern int inflate_blocks_free OF((
+ inflate_blocks_statef *,
+ z_streamp));
+
+extern void inflate_set_dictionary OF((
+ inflate_blocks_statef *s,
+ const Bytef *d, /* dictionary */
+ uInt n)); /* dictionary length */
+
+extern int inflate_blocks_sync_point OF((
+ inflate_blocks_statef *s));
diff --git a/src/zlib/infcodes.c b/src/zlib/infcodes.c
new file mode 100644
index 000000000..aa7b3a037
--- /dev/null
+++ b/src/zlib/infcodes.c
@@ -0,0 +1,251 @@
+/* infcodes.c -- process literals and length/distance pairs
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "infblock.h"
+#include "infcodes.h"
+#include "infutil.h"
+#include "inffast.h"
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+typedef enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
+ START, /* x: set up for LEN */
+ LEN, /* i: get length/literal/eob next */
+ LENEXT, /* i: getting length extra (have base) */
+ DIST, /* i: get distance next */
+ DISTEXT, /* i: getting distance extra */
+ COPY, /* o: copying bytes in window, waiting for space */
+ LIT, /* o: got literal, waiting for output space */
+ WASH, /* o: got eob, possibly still output waiting */
+ END, /* x: got eob and all data flushed */
+ BADCODE} /* x: got error */
+inflate_codes_mode;
+
+/* inflate codes private state */
+struct inflate_codes_state {
+
+ /* mode */
+ inflate_codes_mode mode; /* current inflate_codes mode */
+
+ /* mode dependent information */
+ uInt len;
+ union {
+ struct {
+ inflate_huft *tree; /* pointer into tree */
+ uInt need; /* bits needed */
+ } code; /* if LEN or DIST, where in tree */
+ uInt lit; /* if LIT, literal */
+ struct {
+ uInt get; /* bits to get for extra */
+ uInt dist; /* distance back to copy from */
+ } copy; /* if EXT or COPY, where and how much */
+ } sub; /* submode */
+
+ /* mode independent information */
+ Byte lbits; /* ltree bits decoded per branch */
+ Byte dbits; /* dtree bits decoder per branch */
+ inflate_huft *ltree; /* literal/length/eob tree */
+ inflate_huft *dtree; /* distance tree */
+
+};
+
+
+inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
+uInt bl, bd;
+inflate_huft *tl;
+inflate_huft *td; /* need separate declaration for Borland C++ */
+z_streamp z;
+{
+ inflate_codes_statef *c;
+
+ if ((c = (inflate_codes_statef *)
+ ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL)
+ {
+ c->mode = START;
+ c->lbits = (Byte)bl;
+ c->dbits = (Byte)bd;
+ c->ltree = tl;
+ c->dtree = td;
+ Tracev((stderr, "inflate: codes new\n"));
+ }
+ return c;
+}
+
+
+int inflate_codes(s, z, r)
+inflate_blocks_statef *s;
+z_streamp z;
+int r;
+{
+ uInt j; /* temporary storage */
+ inflate_huft *t; /* temporary pointer */
+ uInt e; /* extra bits or operation */
+ uLong b; /* bit buffer */
+ uInt k; /* bits in bit buffer */
+ Bytef *p; /* input data pointer */
+ uInt n; /* bytes available there */
+ Bytef *q; /* output window write pointer */
+ uInt m; /* bytes to end of window or read pointer */
+ Bytef *f; /* pointer to copy strings from */
+ inflate_codes_statef *c = s->sub.decode.codes; /* codes state */
+
+ /* copy input/output information to locals (UPDATE macro restores) */
+ LOAD
+
+ /* process input and output based on current state */
+ while (1) switch (c->mode)
+ { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */
+ case START: /* x: set up for LEN */
+#ifndef SLOW
+ if (m >= 258 && n >= 10)
+ {
+ UPDATE
+ r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z);
+ LOAD
+ if (r != Z_OK)
+ {
+ c->mode = r == Z_STREAM_END ? WASH : BADCODE;
+ break;
+ }
+ }
+#endif /* !SLOW */
+ c->sub.code.need = c->lbits;
+ c->sub.code.tree = c->ltree;
+ c->mode = LEN;
+ case LEN: /* i: get length/literal/eob next */
+ j = c->sub.code.need;
+ NEEDBITS(j)
+ t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
+ DUMPBITS(t->bits)
+ e = (uInt)(t->exop);
+ if (e == 0) /* literal */
+ {
+ c->sub.lit = t->base;
+ Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+ "inflate: literal '%c'\n" :
+ "inflate: literal 0x%02x\n", t->base));
+ c->mode = LIT;
+ break;
+ }
+ if (e & 16) /* length */
+ {
+ c->sub.copy.get = e & 15;
+ c->len = t->base;
+ c->mode = LENEXT;
+ break;
+ }
+ if ((e & 64) == 0) /* next table */
+ {
+ c->sub.code.need = e;
+ c->sub.code.tree = t + t->base;
+ break;
+ }
+ if (e & 32) /* end of block */
+ {
+ Tracevv((stderr, "inflate: end of block\n"));
+ c->mode = WASH;
+ break;
+ }
+ c->mode = BADCODE; /* invalid code */
+ z->msg = (char*)"invalid literal/length code";
+ r = Z_DATA_ERROR;
+ LEAVE
+ case LENEXT: /* i: getting length extra (have base) */
+ j = c->sub.copy.get;
+ NEEDBITS(j)
+ c->len += (uInt)b & inflate_mask[j];
+ DUMPBITS(j)
+ c->sub.code.need = c->dbits;
+ c->sub.code.tree = c->dtree;
+ Tracevv((stderr, "inflate: length %u\n", c->len));
+ c->mode = DIST;
+ case DIST: /* i: get distance next */
+ j = c->sub.code.need;
+ NEEDBITS(j)
+ t = c->sub.code.tree + ((uInt)b & inflate_mask[j]);
+ DUMPBITS(t->bits)
+ e = (uInt)(t->exop);
+ if (e & 16) /* distance */
+ {
+ c->sub.copy.get = e & 15;
+ c->sub.copy.dist = t->base;
+ c->mode = DISTEXT;
+ break;
+ }
+ if ((e & 64) == 0) /* next table */
+ {
+ c->sub.code.need = e;
+ c->sub.code.tree = t + t->base;
+ break;
+ }
+ c->mode = BADCODE; /* invalid code */
+ z->msg = (char*)"invalid distance code";
+ r = Z_DATA_ERROR;
+ LEAVE
+ case DISTEXT: /* i: getting distance extra */
+ j = c->sub.copy.get;
+ NEEDBITS(j)
+ c->sub.copy.dist += (uInt)b & inflate_mask[j];
+ DUMPBITS(j)
+ Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
+ c->mode = COPY;
+ case COPY: /* o: copying bytes in window, waiting for space */
+ f = q - c->sub.copy.dist;
+ while (f < s->window) /* modulo window size-"while" instead */
+ f += s->end - s->window; /* of "if" handles invalid distances */
+ while (c->len)
+ {
+ NEEDOUT
+ OUTBYTE(*f++)
+ if (f == s->end)
+ f = s->window;
+ c->len--;
+ }
+ c->mode = START;
+ break;
+ case LIT: /* o: got literal, waiting for output space */
+ NEEDOUT
+ OUTBYTE(c->sub.lit)
+ c->mode = START;
+ break;
+ case WASH: /* o: got eob, possibly more output */
+ if (k > 7) /* return unused byte, if any */
+ {
+ Assert(k < 16, "inflate_codes grabbed too many bytes")
+ k -= 8;
+ n++;
+ p--; /* can always return one */
+ }
+ FLUSH
+ if (s->read != s->write)
+ LEAVE
+ c->mode = END;
+ case END:
+ r = Z_STREAM_END;
+ LEAVE
+ case BADCODE: /* x: got error */
+ r = Z_DATA_ERROR;
+ LEAVE
+ default:
+ r = Z_STREAM_ERROR;
+ LEAVE
+ }
+#ifdef NEED_DUMMY_RETURN
+ return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
+#endif
+}
+
+
+void inflate_codes_free(c, z)
+inflate_codes_statef *c;
+z_streamp z;
+{
+ ZFREE(z, c);
+ Tracev((stderr, "inflate: codes free\n"));
+}
diff --git a/src/zlib/infcodes.h b/src/zlib/infcodes.h
new file mode 100644
index 000000000..531d41927
--- /dev/null
+++ b/src/zlib/infcodes.h
@@ -0,0 +1,27 @@
+/* infcodes.h -- header to use infcodes.c
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+struct inflate_codes_state;
+typedef struct inflate_codes_state FAR inflate_codes_statef;
+
+extern inflate_codes_statef *inflate_codes_new OF((
+ uInt, uInt,
+ inflate_huft *, inflate_huft *,
+ z_streamp ));
+
+extern int inflate_codes OF((
+ inflate_blocks_statef *,
+ z_streamp ,
+ int));
+
+extern void inflate_codes_free OF((
+ inflate_codes_statef *,
+ z_streamp ));
+
diff --git a/src/zlib/inffast.c b/src/zlib/inffast.c
new file mode 100644
index 000000000..655eaf0b8
--- /dev/null
+++ b/src/zlib/inffast.c
@@ -0,0 +1,183 @@
+/* inffast.c -- process literals and length/distance pairs fast
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+#include "infblock.h"
+#include "infcodes.h"
+#include "infutil.h"
+#include "inffast.h"
+
+struct inflate_codes_state {int dummy;}; /* for buggy compilers */
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+/* macros for bit input with no checking and for returning unused bytes */
+#define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<<k;k+=8;}}
+#define UNGRAB {c=z->avail_in-n;c=(k>>3)<c?k>>3:c;n+=c;p-=c;k-=c<<3;}
+
+/* Called with number of bytes left to write in window at least 258
+ (the maximum string length) and number of input bytes available
+ at least ten. The ten bytes are six bytes for the longest length/
+ distance pair plus four bytes for overloading the bit buffer. */
+
+int inflate_fast(bl, bd, tl, td, s, z)
+uInt bl, bd;
+inflate_huft *tl;
+inflate_huft *td; /* need separate declaration for Borland C++ */
+inflate_blocks_statef *s;
+z_streamp z;
+{
+ inflate_huft *t; /* temporary pointer */
+ uInt e; /* extra bits or operation */
+ uLong b; /* bit buffer */
+ uInt k; /* bits in bit buffer */
+ Bytef *p; /* input data pointer */
+ uInt n; /* bytes available there */
+ Bytef *q; /* output window write pointer */
+ uInt m; /* bytes to end of window or read pointer */
+ uInt ml; /* mask for literal/length tree */
+ uInt md; /* mask for distance tree */
+ uInt c; /* bytes to copy */
+ uInt d; /* distance back to copy from */
+ Bytef *r; /* copy source pointer */
+
+ /* load input, output, bit values */
+ LOAD
+
+ /* initialize masks */
+ ml = inflate_mask[bl];
+ md = inflate_mask[bd];
+
+ /* do until not enough input or output space for fast loop */
+ do { /* assume called with m >= 258 && n >= 10 */
+ /* get literal/length code */
+ GRABBITS(20) /* max bits for literal/length code */
+ if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
+ {
+ DUMPBITS(t->bits)
+ Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+ "inflate: * literal '%c'\n" :
+ "inflate: * literal 0x%02x\n", t->base));
+ *q++ = (Byte)t->base;
+ m--;
+ continue;
+ }
+ do {
+ DUMPBITS(t->bits)
+ if (e & 16)
+ {
+ /* get extra bits for length */
+ e &= 15;
+ c = t->base + ((uInt)b & inflate_mask[e]);
+ DUMPBITS(e)
+ Tracevv((stderr, "inflate: * length %u\n", c));
+
+ /* decode distance base of block to copy */
+ GRABBITS(15); /* max bits for distance code */
+ e = (t = td + ((uInt)b & md))->exop;
+ do {
+ DUMPBITS(t->bits)
+ if (e & 16)
+ {
+ /* get extra bits to add to distance base */
+ e &= 15;
+ GRABBITS(e) /* get extra bits (up to 13) */
+ d = t->base + ((uInt)b & inflate_mask[e]);
+ DUMPBITS(e)
+ Tracevv((stderr, "inflate: * distance %u\n", d));
+
+ /* do the copy */
+ m -= c;
+ r = q - d;
+ if (r < s->window) /* wrap if needed */
+ {
+ do {
+ r += s->end - s->window; /* force pointer in window */
+ } while (r < s->window); /* covers invalid distances */
+ e = s->end - r;
+ if (c > e)
+ {
+ c -= e; /* wrapped copy */
+ do {
+ *q++ = *r++;
+ } while (--e);
+ r = s->window;
+ do {
+ *q++ = *r++;
+ } while (--c);
+ }
+ else /* normal copy */
+ {
+ *q++ = *r++; c--;
+ *q++ = *r++; c--;
+ do {
+ *q++ = *r++;
+ } while (--c);
+ }
+ }
+ else /* normal copy */
+ {
+ *q++ = *r++; c--;
+ *q++ = *r++; c--;
+ do {
+ *q++ = *r++;
+ } while (--c);
+ }
+ break;
+ }
+ else if ((e & 64) == 0)
+ {
+ t += t->base;
+ e = (t += ((uInt)b & inflate_mask[e]))->exop;
+ }
+ else
+ {
+ z->msg = (char*)"invalid distance code";
+ UNGRAB
+ UPDATE
+ return Z_DATA_ERROR;
+ }
+ } while (1);
+ break;
+ }
+ if ((e & 64) == 0)
+ {
+ t += t->base;
+ if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0)
+ {
+ DUMPBITS(t->bits)
+ Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+ "inflate: * literal '%c'\n" :
+ "inflate: * literal 0x%02x\n", t->base));
+ *q++ = (Byte)t->base;
+ m--;
+ break;
+ }
+ }
+ else if (e & 32)
+ {
+ Tracevv((stderr, "inflate: * end of block\n"));
+ UNGRAB
+ UPDATE
+ return Z_STREAM_END;
+ }
+ else
+ {
+ z->msg = (char*)"invalid literal/length code";
+ UNGRAB
+ UPDATE
+ return Z_DATA_ERROR;
+ }
+ } while (1);
+ } while (m >= 258 && n >= 10);
+
+ /* not enough input or output--restore pointers and return */
+ UNGRAB
+ UPDATE
+ return Z_OK;
+}
diff --git a/src/zlib/inffast.h b/src/zlib/inffast.h
new file mode 100644
index 000000000..ac643b329
--- /dev/null
+++ b/src/zlib/inffast.h
@@ -0,0 +1,17 @@
+/* inffast.h -- header to use inffast.c
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+extern int inflate_fast OF((
+ uInt,
+ uInt,
+ inflate_huft *,
+ inflate_huft *,
+ inflate_blocks_statef *,
+ z_streamp ));
diff --git a/src/zlib/inffixed.h b/src/zlib/inffixed.h
new file mode 100644
index 000000000..e997507c3
--- /dev/null
+++ b/src/zlib/inffixed.h
@@ -0,0 +1,151 @@
+/* inffixed.h -- table for decoding fixed codes
+ * Generated automatically by the maketree.c program
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+local uInt fixed_bl = 9;
+local uInt fixed_bd = 5;
+local inflate_huft fixed_tl[] = {
+ {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
+ {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},
+ {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},
+ {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224},
+ {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144},
+ {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208},
+ {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176},
+ {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240},
+ {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
+ {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200},
+ {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168},
+ {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232},
+ {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152},
+ {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216},
+ {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184},
+ {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248},
+ {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
+ {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196},
+ {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164},
+ {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228},
+ {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148},
+ {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212},
+ {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180},
+ {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244},
+ {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
+ {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204},
+ {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172},
+ {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236},
+ {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156},
+ {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220},
+ {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188},
+ {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252},
+ {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
+ {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194},
+ {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162},
+ {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226},
+ {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146},
+ {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210},
+ {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178},
+ {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242},
+ {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
+ {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202},
+ {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170},
+ {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234},
+ {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154},
+ {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218},
+ {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186},
+ {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250},
+ {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
+ {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198},
+ {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166},
+ {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230},
+ {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150},
+ {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214},
+ {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182},
+ {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246},
+ {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
+ {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206},
+ {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174},
+ {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238},
+ {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158},
+ {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222},
+ {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190},
+ {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254},
+ {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
+ {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193},
+ {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161},
+ {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225},
+ {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145},
+ {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209},
+ {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177},
+ {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241},
+ {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
+ {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201},
+ {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169},
+ {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233},
+ {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153},
+ {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217},
+ {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185},
+ {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249},
+ {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
+ {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197},
+ {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165},
+ {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229},
+ {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149},
+ {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213},
+ {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181},
+ {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245},
+ {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
+ {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205},
+ {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173},
+ {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237},
+ {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157},
+ {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221},
+ {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189},
+ {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253},
+ {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
+ {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195},
+ {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163},
+ {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227},
+ {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147},
+ {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211},
+ {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179},
+ {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243},
+ {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
+ {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203},
+ {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171},
+ {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235},
+ {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155},
+ {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219},
+ {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187},
+ {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251},
+ {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
+ {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199},
+ {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167},
+ {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231},
+ {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151},
+ {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215},
+ {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183},
+ {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247},
+ {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
+ {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207},
+ {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175},
+ {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239},
+ {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159},
+ {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223},
+ {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},
+ {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}
+ };
+local inflate_huft fixed_td[] = {
+ {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},
+ {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},
+ {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},
+ {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577},
+ {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145},
+ {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577},
+ {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289},
+ {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}
+ };
diff --git a/src/zlib/inflate.c b/src/zlib/inflate.c
new file mode 100644
index 000000000..5577e0203
--- /dev/null
+++ b/src/zlib/inflate.c
@@ -0,0 +1,366 @@
+/* inflate.c -- zlib interface to inflate modules
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "infblock.h"
+
+struct inflate_blocks_state {int dummy;}; /* for buggy compilers */
+
+typedef enum {
+ METHOD, /* waiting for method byte */
+ FLAG, /* waiting for flag byte */
+ DICT4, /* four dictionary check bytes to go */
+ DICT3, /* three dictionary check bytes to go */
+ DICT2, /* two dictionary check bytes to go */
+ DICT1, /* one dictionary check byte to go */
+ DICT0, /* waiting for inflateSetDictionary */
+ BLOCKS, /* decompressing blocks */
+ CHECK4, /* four check bytes to go */
+ CHECK3, /* three check bytes to go */
+ CHECK2, /* two check bytes to go */
+ CHECK1, /* one check byte to go */
+ DONE, /* finished check, done */
+ BAD} /* got an error--stay here */
+inflate_mode;
+
+/* inflate private state */
+struct internal_state {
+
+ /* mode */
+ inflate_mode mode; /* current inflate mode */
+
+ /* mode dependent information */
+ union {
+ uInt method; /* if FLAGS, method byte */
+ struct {
+ uLong was; /* computed check value */
+ uLong need; /* stream check value */
+ } check; /* if CHECK, check values to compare */
+ uInt marker; /* if BAD, inflateSync's marker bytes count */
+ } sub; /* submode */
+
+ /* mode independent information */
+ int nowrap; /* flag for no wrapper */
+ uInt wbits; /* log2(window size) (8..15, defaults to 15) */
+ inflate_blocks_statef
+ *blocks; /* current inflate_blocks state */
+
+};
+
+
+int ZEXPORT inflateReset(z)
+z_streamp z;
+{
+ if (z == Z_NULL || z->state == Z_NULL)
+ return Z_STREAM_ERROR;
+ z->total_in = z->total_out = 0;
+ z->msg = Z_NULL;
+ z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
+ inflate_blocks_reset(z->state->blocks, z, Z_NULL);
+ Tracev((stderr, "inflate: reset\n"));
+ return Z_OK;
+}
+
+
+int ZEXPORT inflateEnd(z)
+z_streamp z;
+{
+ if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
+ return Z_STREAM_ERROR;
+ if (z->state->blocks != Z_NULL)
+ inflate_blocks_free(z->state->blocks, z);
+ ZFREE(z, z->state);
+ z->state = Z_NULL;
+ Tracev((stderr, "inflate: end\n"));
+ return Z_OK;
+}
+
+
+int ZEXPORT inflateInit2_(z, w, version, stream_size)
+z_streamp z;
+int w;
+const char *version;
+int stream_size;
+{
+ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
+ stream_size != sizeof(z_stream))
+ return Z_VERSION_ERROR;
+
+ /* initialize state */
+ if (z == Z_NULL)
+ return Z_STREAM_ERROR;
+ z->msg = Z_NULL;
+ if (z->zalloc == Z_NULL)
+ {
+ z->zalloc = zcalloc;
+ z->opaque = (voidpf)0;
+ }
+ if (z->zfree == Z_NULL) z->zfree = zcfree;
+ if ((z->state = (struct internal_state FAR *)
+ ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)
+ return Z_MEM_ERROR;
+ z->state->blocks = Z_NULL;
+
+ /* handle undocumented nowrap option (no zlib header or check) */
+ z->state->nowrap = 0;
+ if (w < 0)
+ {
+ w = - w;
+ z->state->nowrap = 1;
+ }
+
+ /* set window size */
+ if (w < 8 || w > 15)
+ {
+ inflateEnd(z);
+ return Z_STREAM_ERROR;
+ }
+ z->state->wbits = (uInt)w;
+
+ /* create inflate_blocks state */
+ if ((z->state->blocks =
+ inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w))
+ == Z_NULL)
+ {
+ inflateEnd(z);
+ return Z_MEM_ERROR;
+ }
+ Tracev((stderr, "inflate: allocated\n"));
+
+ /* reset state */
+ inflateReset(z);
+ return Z_OK;
+}
+
+
+int ZEXPORT inflateInit_(z, version, stream_size)
+z_streamp z;
+const char *version;
+int stream_size;
+{
+ return inflateInit2_(z, DEF_WBITS, version, stream_size);
+}
+
+
+#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
+#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
+
+int ZEXPORT inflate(z, f)
+z_streamp z;
+int f;
+{
+ int r;
+ uInt b;
+
+ if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL)
+ return Z_STREAM_ERROR;
+ f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK;
+ r = Z_BUF_ERROR;
+ while (1) switch (z->state->mode)
+ {
+ case METHOD:
+ NEEDBYTE
+ if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED)
+ {
+ z->state->mode = BAD;
+ z->msg = (char*)"unknown compression method";
+ z->state->sub.marker = 5; /* can't try inflateSync */
+ break;
+ }
+ if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
+ {
+ z->state->mode = BAD;
+ z->msg = (char*)"invalid window size";
+ z->state->sub.marker = 5; /* can't try inflateSync */
+ break;
+ }
+ z->state->mode = FLAG;
+ case FLAG:
+ NEEDBYTE
+ b = NEXTBYTE;
+ if (((z->state->sub.method << 8) + b) % 31)
+ {
+ z->state->mode = BAD;
+ z->msg = (char*)"incorrect header check";
+ z->state->sub.marker = 5; /* can't try inflateSync */
+ break;
+ }
+ Tracev((stderr, "inflate: zlib header ok\n"));
+ if (!(b & PRESET_DICT))
+ {
+ z->state->mode = BLOCKS;
+ break;
+ }
+ z->state->mode = DICT4;
+ case DICT4:
+ NEEDBYTE
+ z->state->sub.check.need = (uLong)NEXTBYTE << 24;
+ z->state->mode = DICT3;
+ case DICT3:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE << 16;
+ z->state->mode = DICT2;
+ case DICT2:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE << 8;
+ z->state->mode = DICT1;
+ case DICT1:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE;
+ z->adler = z->state->sub.check.need;
+ z->state->mode = DICT0;
+ return Z_NEED_DICT;
+ case DICT0:
+ z->state->mode = BAD;
+ z->msg = (char*)"need dictionary";
+ z->state->sub.marker = 0; /* can try inflateSync */
+ return Z_STREAM_ERROR;
+ case BLOCKS:
+ r = inflate_blocks(z->state->blocks, z, r);
+ if (r == Z_DATA_ERROR)
+ {
+ z->state->mode = BAD;
+ z->state->sub.marker = 0; /* can try inflateSync */
+ break;
+ }
+ if (r == Z_OK)
+ r = f;
+ if (r != Z_STREAM_END)
+ return r;
+ r = f;
+ inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was);
+ if (z->state->nowrap)
+ {
+ z->state->mode = DONE;
+ break;
+ }
+ z->state->mode = CHECK4;
+ case CHECK4:
+ NEEDBYTE
+ z->state->sub.check.need = (uLong)NEXTBYTE << 24;
+ z->state->mode = CHECK3;
+ case CHECK3:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE << 16;
+ z->state->mode = CHECK2;
+ case CHECK2:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE << 8;
+ z->state->mode = CHECK1;
+ case CHECK1:
+ NEEDBYTE
+ z->state->sub.check.need += (uLong)NEXTBYTE;
+
+ if (z->state->sub.check.was != z->state->sub.check.need)
+ {
+ z->state->mode = BAD;
+ z->msg = (char*)"incorrect data check";
+ z->state->sub.marker = 5; /* can't try inflateSync */
+ break;
+ }
+ Tracev((stderr, "inflate: zlib check ok\n"));
+ z->state->mode = DONE;
+ case DONE:
+ return Z_STREAM_END;
+ case BAD:
+ return Z_DATA_ERROR;
+ default:
+ return Z_STREAM_ERROR;
+ }
+#ifdef NEED_DUMMY_RETURN
+ return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
+#endif
+}
+
+
+int ZEXPORT inflateSetDictionary(z, dictionary, dictLength)
+z_streamp z;
+const Bytef *dictionary;
+uInt dictLength;
+{
+ uInt length = dictLength;
+
+ if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0)
+ return Z_STREAM_ERROR;
+
+ if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR;
+ z->adler = 1L;
+
+ if (length >= ((uInt)1<<z->state->wbits))
+ {
+ length = (1<<z->state->wbits)-1;
+ dictionary += dictLength - length;
+ }
+ inflate_set_dictionary(z->state->blocks, dictionary, length);
+ z->state->mode = BLOCKS;
+ return Z_OK;
+}
+
+
+int ZEXPORT inflateSync(z)
+z_streamp z;
+{
+ uInt n; /* number of bytes to look at */
+ Bytef *p; /* pointer to bytes */
+ uInt m; /* number of marker bytes found in a row */
+ uLong r, w; /* temporaries to save total_in and total_out */
+
+ /* set up */
+ if (z == Z_NULL || z->state == Z_NULL)
+ return Z_STREAM_ERROR;
+ if (z->state->mode != BAD)
+ {
+ z->state->mode = BAD;
+ z->state->sub.marker = 0;
+ }
+ if ((n = z->avail_in) == 0)
+ return Z_BUF_ERROR;
+ p = z->next_in;
+ m = z->state->sub.marker;
+
+ /* search */
+ while (n && m < 4)
+ {
+ static const Byte mark[4] = {0, 0, 0xff, 0xff};
+ if (*p == mark[m])
+ m++;
+ else if (*p)
+ m = 0;
+ else
+ m = 4 - m;
+ p++, n--;
+ }
+
+ /* restore */
+ z->total_in += p - z->next_in;
+ z->next_in = p;
+ z->avail_in = n;
+ z->state->sub.marker = m;
+
+ /* return no joy or set up to restart on a new block */
+ if (m != 4)
+ return Z_DATA_ERROR;
+ r = z->total_in; w = z->total_out;
+ inflateReset(z);
+ z->total_in = r; z->total_out = w;
+ z->state->mode = BLOCKS;
+ return Z_OK;
+}
+
+
+/* Returns true if inflate is currently at the end of a block generated
+ * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
+ * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH
+ * but removes the length bytes of the resulting empty stored block. When
+ * decompressing, PPP checks that at the end of input packet, inflate is
+ * waiting for these length bytes.
+ */
+int ZEXPORT inflateSyncPoint(z)
+z_streamp z;
+{
+ if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
+ return Z_STREAM_ERROR;
+ return inflate_blocks_sync_point(z->state->blocks);
+}
diff --git a/src/zlib/inftrees.c b/src/zlib/inftrees.c
new file mode 100644
index 000000000..f89e801f3
--- /dev/null
+++ b/src/zlib/inftrees.c
@@ -0,0 +1,454 @@
+/* inftrees.c -- generate Huffman trees for efficient decoding
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "inftrees.h"
+
+#if !defined(BUILDFIXED) && !defined(STDC)
+# define BUILDFIXED /* non ANSI compilers may not accept inffixed.h */
+#endif
+
+const char inflate_copyright[] =
+ " inflate 1.1.4 Copyright 1995-2002 Mark Adler ";
+/*
+ If you use the zlib library in a product, an acknowledgment is welcome
+ in the documentation of your product. If for some reason you cannot
+ include such an acknowledgment, I would appreciate that you keep this
+ copyright string in the executable of your product.
+ */
+struct internal_state {int dummy;}; /* for buggy compilers */
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+
+local int huft_build OF((
+ uIntf *, /* code lengths in bits */
+ uInt, /* number of codes */
+ uInt, /* number of "simple" codes */
+ const uIntf *, /* list of base values for non-simple codes */
+ const uIntf *, /* list of extra bits for non-simple codes */
+ inflate_huft * FAR*,/* result: starting table */
+ uIntf *, /* maximum lookup bits (returns actual) */
+ inflate_huft *, /* space for trees */
+ uInt *, /* hufts used in space */
+ uIntf * )); /* space for values */
+
+/* Tables for deflate from PKZIP's appnote.txt. */
+local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+ 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
+ /* see note #13 above about 258 */
+local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
+ 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */
+local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */
+ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
+ 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+ 8193, 12289, 16385, 24577};
+local const uInt cpdext[30] = { /* Extra bits for distance codes */
+ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
+ 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
+ 12, 12, 13, 13};
+
+/*
+ Huffman code decoding is performed using a multi-level table lookup.
+ The fastest way to decode is to simply build a lookup table whose
+ size is determined by the longest code. However, the time it takes
+ to build this table can also be a factor if the data being decoded
+ is not very long. The most common codes are necessarily the
+ shortest codes, so those codes dominate the decoding time, and hence
+ the speed. The idea is you can have a shorter table that decodes the
+ shorter, more probable codes, and then point to subsidiary tables for
+ the longer codes. The time it costs to decode the longer codes is
+ then traded against the time it takes to make longer tables.
+
+ This results of this trade are in the variables lbits and dbits
+ below. lbits is the number of bits the first level table for literal/
+ length codes can decode in one step, and dbits is the same thing for
+ the distance codes. Subsequent tables are also less than or equal to
+ those sizes. These values may be adjusted either when all of the
+ codes are shorter than that, in which case the longest code length in
+ bits is used, or when the shortest code is *longer* than the requested
+ table size, in which case the length of the shortest code in bits is
+ used.
+
+ There are two different values for the two tables, since they code a
+ different number of possibilities each. The literal/length table
+ codes 286 possible values, or in a flat code, a little over eight
+ bits. The distance table codes 30 possible values, or a little less
+ than five bits, flat. The optimum values for speed end up being
+ about one bit more than those, so lbits is 8+1 and dbits is 5+1.
+ The optimum values may differ though from machine to machine, and
+ possibly even between compilers. Your mileage may vary.
+ */
+
+
+/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
+#define BMAX 15 /* maximum bit length of any code */
+
+local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
+uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
+uInt n; /* number of codes (assumed <= 288) */
+uInt s; /* number of simple-valued codes (0..s-1) */
+const uIntf *d; /* list of base values for non-simple codes */
+const uIntf *e; /* list of extra bits for non-simple codes */
+inflate_huft * FAR *t; /* result: starting table */
+uIntf *m; /* maximum lookup bits, returns actual */
+inflate_huft *hp; /* space for trees */
+uInt *hn; /* hufts used in space */
+uIntf *v; /* working area: values in order of bit length */
+/* Given a list of code lengths and a maximum table size, make a set of
+ tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
+ if the given code set is incomplete (the tables are still built in this
+ case), or Z_DATA_ERROR if the input is invalid. */
+{
+
+ uInt a; /* counter for codes of length k */
+ uInt c[BMAX+1]; /* bit length count table */
+ uInt f; /* i repeats in table every f entries */
+ int g; /* maximum code length */
+ int h; /* table level */
+ register uInt i; /* counter, current code */
+ register uInt j; /* counter */
+ register int k; /* number of bits in current code */
+ int l; /* bits per table (returned in m) */
+ uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */
+ register uIntf *p; /* pointer into c[], b[], or v[] */
+ inflate_huft *q; /* points to current table */
+ struct inflate_huft_s r; /* table entry for structure assignment */
+ inflate_huft *u[BMAX]; /* table stack */
+ register int w; /* bits before this table == (l * h) */
+ uInt x[BMAX+1]; /* bit offsets, then code stack */
+ uIntf *xp; /* pointer into x */
+ int y; /* number of dummy codes added */
+ uInt z; /* number of entries in current table */
+
+
+ /* Generate counts for each bit length */
+ p = c;
+#define C0 *p++ = 0;
+#define C2 C0 C0 C0 C0
+#define C4 C2 C2 C2 C2
+ C4 /* clear c[]--assume BMAX+1 is 16 */
+ p = b; i = n;
+ do {
+ c[*p++]++; /* assume all entries <= BMAX */
+ } while (--i);
+ if (c[0] == n) /* null input--all zero length codes */
+ {
+ *t = (inflate_huft *)Z_NULL;
+ *m = 0;
+ return Z_OK;
+ }
+
+
+ /* Find minimum and maximum length, bound *m by those */
+ l = *m;
+ for (j = 1; j <= BMAX; j++)
+ if (c[j])
+ break;
+ k = j; /* minimum code length */
+ if ((uInt)l < j)
+ l = j;
+ for (i = BMAX; i; i--)
+ if (c[i])
+ break;
+ g = i; /* maximum code length */
+ if ((uInt)l > i)
+ l = i;
+ *m = l;
+
+
+ /* Adjust last length count to fill out codes, if needed */
+ for (y = 1 << j; j < i; j++, y <<= 1)
+ if ((y -= c[j]) < 0)
+ return Z_DATA_ERROR;
+ if ((y -= c[i]) < 0)
+ return Z_DATA_ERROR;
+ c[i] += y;
+
+
+ /* Generate starting offsets into the value table for each length */
+ x[1] = j = 0;
+ p = c + 1; xp = x + 2;
+ while (--i) { /* note that i == g from above */
+ *xp++ = (j += *p++);
+ }
+
+
+ /* Make a table of values in order of bit lengths */
+ p = b; i = 0;
+ do {
+ if ((j = *p++) != 0)
+ v[x[j]++] = i;
+ } while (++i < n);
+ n = x[g]; /* set n to length of v */
+
+
+ /* Generate the Huffman codes and for each, make the table entries */
+ x[0] = i = 0; /* first Huffman code is zero */
+ p = v; /* grab values in bit order */
+ h = -1; /* no tables yet--level -1 */
+ w = -l; /* bits decoded == (l * h) */
+ u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */
+ q = (inflate_huft *)Z_NULL; /* ditto */
+ z = 0; /* ditto */
+
+ /* go through the bit lengths (k already is bits in shortest code) */
+ for (; k <= g; k++)
+ {
+ a = c[k];
+ while (a--)
+ {
+ /* here i is the Huffman code of length k bits for value *p */
+ /* make tables up to required level */
+ while (k > w + l)
+ {
+ h++;
+ w += l; /* previous table always l bits */
+
+ /* compute minimum size table less than or equal to l bits */
+ z = g - w;
+ z = z > (uInt)l ? l : z; /* table size upper limit */
+ if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
+ { /* too few codes for k-w bit table */
+ f -= a + 1; /* deduct codes from patterns left */
+ xp = c + k;
+ if (j < z)
+ while (++j < z) /* try smaller tables up to z bits */
+ {
+ if ((f <<= 1) <= *++xp)
+ break; /* enough codes to use up j bits */
+ f -= *xp; /* else deduct codes from patterns */
+ }
+ }
+ z = 1 << j; /* table entries for j-bit table */
+
+ /* allocate new table */
+ if (*hn + z > MANY) /* (note: doesn't matter for fixed) */
+ return Z_DATA_ERROR; /* overflow of MANY */
+ u[h] = q = hp + *hn;
+ *hn += z;
+
+ /* connect to last table, if there is one */
+ if (h)
+ {
+ x[h] = i; /* save pattern for backing up */
+ r.bits = (Byte)l; /* bits to dump before this table */
+ r.exop = (Byte)j; /* bits in this table */
+ j = i >> (w - l);
+ r.base = (uInt)(q - u[h-1] - j); /* offset to this table */
+ u[h-1][j] = r; /* connect to last table */
+ }
+ else
+ *t = q; /* first table is returned result */
+ }
+
+ /* set up table entry in r */
+ r.bits = (Byte)(k - w);
+ if (p >= v + n)
+ r.exop = 128 + 64; /* out of values--invalid code */
+ else if (*p < s)
+ {
+ r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */
+ r.base = *p++; /* simple code is just the value */
+ }
+ else
+ {
+ r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */
+ r.base = d[*p++ - s];
+ }
+
+ /* fill code-like entries with r */
+ f = 1 << (k - w);
+ for (j = i >> w; j < z; j += f)
+ q[j] = r;
+
+ /* backwards increment the k-bit code i */
+ for (j = 1 << (k - 1); i & j; j >>= 1)
+ i ^= j;
+ i ^= j;
+
+ /* backup over finished tables */
+ mask = (1 << w) - 1; /* needed on HP, cc -O bug */
+ while ((i & mask) != x[h])
+ {
+ h--; /* don't need to update q */
+ w -= l;
+ mask = (1 << w) - 1;
+ }
+ }
+ }
+
+
+ /* Return Z_BUF_ERROR if we were given an incomplete table */
+ return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
+}
+
+
+int inflate_trees_bits(c, bb, tb, hp, z)
+uIntf *c; /* 19 code lengths */
+uIntf *bb; /* bits tree desired/actual depth */
+inflate_huft * FAR *tb; /* bits tree result */
+inflate_huft *hp; /* space for trees */
+z_streamp z; /* for messages */
+{
+ int r;
+ uInt hn = 0; /* hufts used in space */
+ uIntf *v; /* work area for huft_build */
+
+ if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL)
+ return Z_MEM_ERROR;
+ r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL,
+ tb, bb, hp, &hn, v);
+ if (r == Z_DATA_ERROR)
+ z->msg = (char*)"oversubscribed dynamic bit lengths tree";
+ else if (r == Z_BUF_ERROR || *bb == 0)
+ {
+ z->msg = (char*)"incomplete dynamic bit lengths tree";
+ r = Z_DATA_ERROR;
+ }
+ ZFREE(z, v);
+ return r;
+}
+
+
+int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
+uInt nl; /* number of literal/length codes */
+uInt nd; /* number of distance codes */
+uIntf *c; /* that many (total) code lengths */
+uIntf *bl; /* literal desired/actual bit depth */
+uIntf *bd; /* distance desired/actual bit depth */
+inflate_huft * FAR *tl; /* literal/length tree result */
+inflate_huft * FAR *td; /* distance tree result */
+inflate_huft *hp; /* space for trees */
+z_streamp z; /* for messages */
+{
+ int r;
+ uInt hn = 0; /* hufts used in space */
+ uIntf *v; /* work area for huft_build */
+
+ /* allocate work area */
+ if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
+ return Z_MEM_ERROR;
+
+ /* build literal/length tree */
+ r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v);
+ if (r != Z_OK || *bl == 0)
+ {
+ if (r == Z_DATA_ERROR)
+ z->msg = (char*)"oversubscribed literal/length tree";
+ else if (r != Z_MEM_ERROR)
+ {
+ z->msg = (char*)"incomplete literal/length tree";
+ r = Z_DATA_ERROR;
+ }
+ ZFREE(z, v);
+ return r;
+ }
+
+ /* build distance tree */
+ r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v);
+ if (r != Z_OK || (*bd == 0 && nl > 257))
+ {
+ if (r == Z_DATA_ERROR)
+ z->msg = (char*)"oversubscribed distance tree";
+ else if (r == Z_BUF_ERROR) {
+#ifdef PKZIP_BUG_WORKAROUND
+ r = Z_OK;
+ }
+#else
+ z->msg = (char*)"incomplete distance tree";
+ r = Z_DATA_ERROR;
+ }
+ else if (r != Z_MEM_ERROR)
+ {
+ z->msg = (char*)"empty distance tree with lengths";
+ r = Z_DATA_ERROR;
+ }
+ ZFREE(z, v);
+ return r;
+#endif
+ }
+
+ /* done */
+ ZFREE(z, v);
+ return Z_OK;
+}
+
+
+/* build fixed tables only once--keep them here */
+#ifdef BUILDFIXED
+local int fixed_built = 0;
+#define FIXEDH 544 /* number of hufts used by fixed tables */
+local inflate_huft fixed_mem[FIXEDH];
+local uInt fixed_bl;
+local uInt fixed_bd;
+local inflate_huft *fixed_tl;
+local inflate_huft *fixed_td;
+#else
+#include "inffixed.h"
+#endif
+
+
+int inflate_trees_fixed(bl, bd, tl, td, z)
+uIntf *bl; /* literal desired/actual bit depth */
+uIntf *bd; /* distance desired/actual bit depth */
+inflate_huft * FAR *tl; /* literal/length tree result */
+inflate_huft * FAR *td; /* distance tree result */
+z_streamp z; /* for memory allocation */
+{
+#ifdef BUILDFIXED
+ /* build fixed tables if not already */
+ if (!fixed_built)
+ {
+ int k; /* temporary variable */
+ uInt f = 0; /* number of hufts used in fixed_mem */
+ uIntf *c; /* length list for huft_build */
+ uIntf *v; /* work area for huft_build */
+
+ /* allocate memory */
+ if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
+ return Z_MEM_ERROR;
+ if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL)
+ {
+ ZFREE(z, c);
+ return Z_MEM_ERROR;
+ }
+
+ /* literal table */
+ for (k = 0; k < 144; k++)
+ c[k] = 8;
+ for (; k < 256; k++)
+ c[k] = 9;
+ for (; k < 280; k++)
+ c[k] = 7;
+ for (; k < 288; k++)
+ c[k] = 8;
+ fixed_bl = 9;
+ huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl,
+ fixed_mem, &f, v);
+
+ /* distance table */
+ for (k = 0; k < 30; k++)
+ c[k] = 5;
+ fixed_bd = 5;
+ huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd,
+ fixed_mem, &f, v);
+
+ /* done */
+ ZFREE(z, v);
+ ZFREE(z, c);
+ fixed_built = 1;
+ }
+#endif
+ *bl = fixed_bl;
+ *bd = fixed_bd;
+ *tl = fixed_tl;
+ *td = fixed_td;
+ return Z_OK;
+}
diff --git a/src/zlib/inftrees.h b/src/zlib/inftrees.h
new file mode 100644
index 000000000..affbb3b21
--- /dev/null
+++ b/src/zlib/inftrees.h
@@ -0,0 +1,58 @@
+/* inftrees.h -- header to use inftrees.c
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* Huffman code lookup table entry--this entry is four bytes for machines
+ that have 16-bit pointers (e.g. PC's in the small or medium model). */
+
+typedef struct inflate_huft_s FAR inflate_huft;
+
+struct inflate_huft_s {
+ union {
+ struct {
+ Byte Exop; /* number of extra bits or operation */
+ Byte Bits; /* number of bits in this code or subcode */
+ } what;
+ uInt pad; /* pad structure to a power of 2 (4 bytes for */
+ } word; /* 16-bit, 8 bytes for 32-bit int's) */
+ uInt base; /* literal, length base, distance base,
+ or table offset */
+};
+
+/* Maximum size of dynamic tree. The maximum found in a long but non-
+ exhaustive search was 1004 huft structures (850 for length/literals
+ and 154 for distances, the latter actually the result of an
+ exhaustive search). The actual maximum is not known, but the
+ value below is more than safe. */
+#define MANY 1440
+
+extern int inflate_trees_bits OF((
+ uIntf *, /* 19 code lengths */
+ uIntf *, /* bits tree desired/actual depth */
+ inflate_huft * FAR *, /* bits tree result */
+ inflate_huft *, /* space for trees */
+ z_streamp)); /* for messages */
+
+extern int inflate_trees_dynamic OF((
+ uInt, /* number of literal/length codes */
+ uInt, /* number of distance codes */
+ uIntf *, /* that many (total) code lengths */
+ uIntf *, /* literal desired/actual bit depth */
+ uIntf *, /* distance desired/actual bit depth */
+ inflate_huft * FAR *, /* literal/length tree result */
+ inflate_huft * FAR *, /* distance tree result */
+ inflate_huft *, /* space for trees */
+ z_streamp)); /* for messages */
+
+extern int inflate_trees_fixed OF((
+ uIntf *, /* literal desired/actual bit depth */
+ uIntf *, /* distance desired/actual bit depth */
+ inflate_huft * FAR *, /* literal/length tree result */
+ inflate_huft * FAR *, /* distance tree result */
+ z_streamp)); /* for memory allocation */
diff --git a/src/zlib/infutil.c b/src/zlib/infutil.c
new file mode 100644
index 000000000..976d5e521
--- /dev/null
+++ b/src/zlib/infutil.c
@@ -0,0 +1,87 @@
+/* inflate_util.c -- data and routines common to blocks and codes
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zutil.h"
+#include "infblock.h"
+#include "inftrees.h"
+#include "infcodes.h"
+#include "infutil.h"
+
+struct inflate_codes_state {int dummy;}; /* for buggy compilers */
+
+/* And'ing with mask[n] masks the lower n bits */
+uInt inflate_mask[17] = {
+ 0x0000,
+ 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
+ 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
+};
+
+
+/* copy as much as possible from the sliding window to the output area */
+int inflate_flush(s, z, r)
+inflate_blocks_statef *s;
+z_streamp z;
+int r;
+{
+ uInt n;
+ Bytef *p;
+ Bytef *q;
+
+ /* local copies of source and destination pointers */
+ p = z->next_out;
+ q = s->read;
+
+ /* compute number of bytes to copy as far as end of window */
+ n = (uInt)((q <= s->write ? s->write : s->end) - q);
+ if (n > z->avail_out) n = z->avail_out;
+ if (n && r == Z_BUF_ERROR) r = Z_OK;
+
+ /* update counters */
+ z->avail_out -= n;
+ z->total_out += n;
+
+ /* update check information */
+ if (s->checkfn != Z_NULL)
+ z->adler = s->check = (*s->checkfn)(s->check, q, n);
+
+ /* copy as far as end of window */
+ zmemcpy(p, q, n);
+ p += n;
+ q += n;
+
+ /* see if more to copy at beginning of window */
+ if (q == s->end)
+ {
+ /* wrap pointers */
+ q = s->window;
+ if (s->write == s->end)
+ s->write = s->window;
+
+ /* compute bytes to copy */
+ n = (uInt)(s->write - q);
+ if (n > z->avail_out) n = z->avail_out;
+ if (n && r == Z_BUF_ERROR) r = Z_OK;
+
+ /* update counters */
+ z->avail_out -= n;
+ z->total_out += n;
+
+ /* update check information */
+ if (s->checkfn != Z_NULL)
+ z->adler = s->check = (*s->checkfn)(s->check, q, n);
+
+ /* copy */
+ zmemcpy(p, q, n);
+ p += n;
+ q += n;
+ }
+
+ /* update pointers */
+ z->next_out = p;
+ s->read = q;
+
+ /* done */
+ return r;
+}
diff --git a/src/zlib/infutil.h b/src/zlib/infutil.h
new file mode 100644
index 000000000..0c0ace366
--- /dev/null
+++ b/src/zlib/infutil.h
@@ -0,0 +1,98 @@
+/* infutil.h -- types and macros common to blocks and codes
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+#ifndef _INFUTIL_H
+#define _INFUTIL_H
+
+typedef enum {
+ TYPE, /* get type bits (3, including end bit) */
+ LENS, /* get lengths for stored */
+ STORED, /* processing stored block */
+ TABLE, /* get table lengths */
+ BTREE, /* get bit lengths tree for a dynamic block */
+ DTREE, /* get length, distance trees for a dynamic block */
+ CODES, /* processing fixed or dynamic block */
+ DRY, /* output remaining window bytes */
+ DONE, /* finished last block, done */
+ BAD} /* got a data error--stuck here */
+inflate_block_mode;
+
+/* inflate blocks semi-private state */
+struct inflate_blocks_state {
+
+ /* mode */
+ inflate_block_mode mode; /* current inflate_block mode */
+
+ /* mode dependent information */
+ union {
+ uInt left; /* if STORED, bytes left to copy */
+ struct {
+ uInt table; /* table lengths (14 bits) */
+ uInt index; /* index into blens (or border) */
+ uIntf *blens; /* bit lengths of codes */
+ uInt bb; /* bit length tree depth */
+ inflate_huft *tb; /* bit length decoding tree */
+ } trees; /* if DTREE, decoding info for trees */
+ struct {
+ inflate_codes_statef
+ *codes;
+ } decode; /* if CODES, current state */
+ } sub; /* submode */
+ uInt last; /* true if this block is the last block */
+
+ /* mode independent information */
+ uInt bitk; /* bits in bit buffer */
+ uLong bitb; /* bit buffer */
+ inflate_huft *hufts; /* single malloc for tree space */
+ Bytef *window; /* sliding window */
+ Bytef *end; /* one byte after sliding window */
+ Bytef *read; /* window read pointer */
+ Bytef *write; /* window write pointer */
+ check_func checkfn; /* check function */
+ uLong check; /* check on output */
+
+};
+
+
+/* defines for inflate input/output */
+/* update pointers and return */
+#define UPDBITS {s->bitb=b;s->bitk=k;}
+#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;}
+#define UPDOUT {s->write=q;}
+#define UPDATE {UPDBITS UPDIN UPDOUT}
+#define LEAVE {UPDATE return inflate_flush(s,z,r);}
+/* get bytes and bits */
+#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;}
+#define NEEDBYTE {if(n)r=Z_OK;else LEAVE}
+#define NEXTBYTE (n--,*p++)
+#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}}
+#define DUMPBITS(j) {b>>=(j);k-=(j);}
+/* output bytes */
+#define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q)
+#define LOADOUT {q=s->write;m=(uInt)WAVAIL;}
+#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}}
+#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT}
+#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;}
+#define OUTBYTE(a) {*q++=(Byte)(a);m--;}
+/* load local pointers */
+#define LOAD {LOADIN LOADOUT}
+
+/* masks for lower bits (size given to avoid silly warnings with Visual C++) */
+extern uInt inflate_mask[17];
+
+/* copy as much as possible from the sliding window to the output area */
+extern int inflate_flush OF((
+ inflate_blocks_statef *,
+ z_streamp ,
+ int));
+
+struct internal_state {int dummy;}; /* for buggy compilers */
+
+#endif
diff --git a/src/zlib/maketree.c b/src/zlib/maketree.c
new file mode 100644
index 000000000..c64de51e3
--- /dev/null
+++ b/src/zlib/maketree.c
@@ -0,0 +1,85 @@
+/* maketree.c -- make inffixed.h table for decoding fixed codes
+ * Copyright (C) 1995-2002 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* This program is included in the distribution for completeness.
+ You do not need to compile or run this program since inffixed.h
+ is already included in the distribution. To use this program
+ you need to compile zlib with BUILDFIXED defined and then compile
+ and link this program with the zlib library. Then the output of
+ this program can be piped to inffixed.h. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "zutil.h"
+#include "inftrees.h"
+
+/* simplify the use of the inflate_huft type with some defines */
+#define exop word.what.Exop
+#define bits word.what.Bits
+
+/* generate initialization table for an inflate_huft structure array */
+void maketree(uInt b, inflate_huft *t)
+{
+ int i, e;
+
+ i = 0;
+ while (1)
+ {
+ e = t[i].exop;
+ if (e && (e & (16+64)) == 0) /* table pointer */
+ {
+ fprintf(stderr, "maketree: cannot initialize sub-tables!\n");
+ exit(1);
+ }
+ if (i % 4 == 0)
+ printf("\n ");
+ printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base);
+ if (++i == (1<<b))
+ break;
+ putchar(',');
+ }
+ puts("");
+}
+
+/* create the fixed tables in C initialization syntax */
+void main(void)
+{
+ int r;
+ uInt bl, bd;
+ inflate_huft *tl, *td;
+ z_stream z;
+
+ z.zalloc = zcalloc;
+ z.opaque = (voidpf)0;
+ z.zfree = zcfree;
+ r = inflate_trees_fixed(&bl, &bd, &tl, &td, &z);
+ if (r)
+ {
+ fprintf(stderr, "inflate_trees_fixed error %d\n", r);
+ return;
+ }
+ puts("/* inffixed.h -- table for decoding fixed codes");
+ puts(" * Generated automatically by the maketree.c program");
+ puts(" */");
+ puts("");
+ puts("/* WARNING: this file should *not* be used by applications. It is");
+ puts(" part of the implementation of the compression library and is");
+ puts(" subject to change. Applications should only use zlib.h.");
+ puts(" */");
+ puts("");
+ printf("local uInt fixed_bl = %d;\n", bl);
+ printf("local uInt fixed_bd = %d;\n", bd);
+ printf("local inflate_huft fixed_tl[] = {");
+ maketree(bl, tl);
+ puts(" };");
+ printf("local inflate_huft fixed_td[] = {");
+ maketree(bd, td);
+ puts(" };");
+}
diff --git a/src/zlib/minigzip.c b/src/zlib/minigzip.c
new file mode 100644
index 000000000..9449d4305
--- /dev/null
+++ b/src/zlib/minigzip.c
@@ -0,0 +1,320 @@
+/* minigzip.c -- simulate gzip using the zlib compression library
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ * minigzip is a minimal implementation of the gzip utility. This is
+ * only an example of using zlib and isn't meant to replace the
+ * full-featured gzip. No attempt is made to deal with file systems
+ * limiting names to 14 or 8+3 characters, etc... Error checking is
+ * very limited. So use minigzip only for testing; use gzip for the
+ * real thing. On MSDOS, use only on file names without extension
+ * or in pipe mode.
+ */
+
+/* @(#) $Id: minigzip.c 126 2003-11-09 01:53:27Z gabest $ */
+
+#include <stdio.h>
+#include "zlib.h"
+
+#ifdef STDC
+# include <string.h>
+# include <stdlib.h>
+#else
+ extern void exit OF((int));
+#endif
+
+#ifdef USE_MMAP
+# include <sys/types.h>
+# include <sys/mman.h>
+# include <sys/stat.h>
+#endif
+
+#if defined(MSDOS) || defined(OS2) || defined(WIN32)
+# include <fcntl.h>
+# include <io.h>
+# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
+#else
+# define SET_BINARY_MODE(file)
+#endif
+
+#ifdef VMS
+# define unlink delete
+# define GZ_SUFFIX "-gz"
+#endif
+#ifdef RISCOS
+# define unlink remove
+# define GZ_SUFFIX "-gz"
+# define fileno(file) file->__file
+#endif
+#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+# include <unix.h> /* for fileno */
+#endif
+
+#ifndef WIN32 /* unlink already in stdio.h for WIN32 */
+ extern int unlink OF((const char *));
+#endif
+
+#ifndef GZ_SUFFIX
+# define GZ_SUFFIX ".gz"
+#endif
+#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1)
+
+#define BUFLEN 16384
+#define MAX_NAME_LEN 1024
+
+#ifdef MAXSEG_64K
+# define local static
+ /* Needed for systems with limitation on stack size. */
+#else
+# define local
+#endif
+
+char *prog;
+
+void error OF((const char *msg));
+void gz_compress OF((FILE *in, gzFile out));
+#ifdef USE_MMAP
+int gz_compress_mmap OF((FILE *in, gzFile out));
+#endif
+void gz_uncompress OF((gzFile in, FILE *out));
+void file_compress OF((char *file, char *mode));
+void file_uncompress OF((char *file));
+int main OF((int argc, char *argv[]));
+
+/* ===========================================================================
+ * Display error message and exit
+ */
+void error(msg)
+ const char *msg;
+{
+ fprintf(stderr, "%s: %s\n", prog, msg);
+ exit(1);
+}
+
+/* ===========================================================================
+ * Compress input to output then close both files.
+ */
+
+void gz_compress(in, out)
+ FILE *in;
+ gzFile out;
+{
+ local char buf[BUFLEN];
+ int len;
+ int err;
+
+#ifdef USE_MMAP
+ /* Try first compressing with mmap. If mmap fails (minigzip used in a
+ * pipe), use the normal fread loop.
+ */
+ if (gz_compress_mmap(in, out) == Z_OK) return;
+#endif
+ for (;;) {
+ len = fread(buf, 1, sizeof(buf), in);
+ if (ferror(in)) {
+ perror("fread");
+ exit(1);
+ }
+ if (len == 0) break;
+
+ if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err));
+ }
+ fclose(in);
+ if (gzclose(out) != Z_OK) error("failed gzclose");
+}
+
+#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */
+
+/* Try compressing the input file at once using mmap. Return Z_OK if
+ * if success, Z_ERRNO otherwise.
+ */
+int gz_compress_mmap(in, out)
+ FILE *in;
+ gzFile out;
+{
+ int len;
+ int err;
+ int ifd = fileno(in);
+ caddr_t buf; /* mmap'ed buffer for the entire input file */
+ off_t buf_len; /* length of the input file */
+ struct stat sb;
+
+ /* Determine the size of the file, needed for mmap: */
+ if (fstat(ifd, &sb) < 0) return Z_ERRNO;
+ buf_len = sb.st_size;
+ if (buf_len <= 0) return Z_ERRNO;
+
+ /* Now do the actual mmap: */
+ buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
+ if (buf == (caddr_t)(-1)) return Z_ERRNO;
+
+ /* Compress the whole file at once: */
+ len = gzwrite(out, (char *)buf, (unsigned)buf_len);
+
+ if (len != (int)buf_len) error(gzerror(out, &err));
+
+ munmap(buf, buf_len);
+ fclose(in);
+ if (gzclose(out) != Z_OK) error("failed gzclose");
+ return Z_OK;
+}
+#endif /* USE_MMAP */
+
+/* ===========================================================================
+ * Uncompress input to output then close both files.
+ */
+void gz_uncompress(in, out)
+ gzFile in;
+ FILE *out;
+{
+ local char buf[BUFLEN];
+ int len;
+ int err;
+
+ for (;;) {
+ len = gzread(in, buf, sizeof(buf));
+ if (len < 0) error (gzerror(in, &err));
+ if (len == 0) break;
+
+ if ((int)fwrite(buf, 1, (unsigned)len, out) != len) {
+ error("failed fwrite");
+ }
+ }
+ if (fclose(out)) error("failed fclose");
+
+ if (gzclose(in) != Z_OK) error("failed gzclose");
+}
+
+
+/* ===========================================================================
+ * Compress the given file: create a corresponding .gz file and remove the
+ * original.
+ */
+void file_compress(file, mode)
+ char *file;
+ char *mode;
+{
+ local char outfile[MAX_NAME_LEN];
+ FILE *in;
+ gzFile out;
+
+ strcpy(outfile, file);
+ strcat(outfile, GZ_SUFFIX);
+
+ in = fopen(file, "rb");
+ if (in == NULL) {
+ perror(file);
+ exit(1);
+ }
+ out = gzopen(outfile, mode);
+ if (out == NULL) {
+ fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile);
+ exit(1);
+ }
+ gz_compress(in, out);
+
+ unlink(file);
+}
+
+
+/* ===========================================================================
+ * Uncompress the given file and remove the original.
+ */
+void file_uncompress(file)
+ char *file;
+{
+ local char buf[MAX_NAME_LEN];
+ char *infile, *outfile;
+ FILE *out;
+ gzFile in;
+ int len = strlen(file);
+
+ strcpy(buf, file);
+
+ if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) {
+ infile = file;
+ outfile = buf;
+ outfile[len-3] = '\0';
+ } else {
+ outfile = file;
+ infile = buf;
+ strcat(infile, GZ_SUFFIX);
+ }
+ in = gzopen(infile, "rb");
+ if (in == NULL) {
+ fprintf(stderr, "%s: can't gzopen %s\n", prog, infile);
+ exit(1);
+ }
+ out = fopen(outfile, "wb");
+ if (out == NULL) {
+ perror(file);
+ exit(1);
+ }
+
+ gz_uncompress(in, out);
+
+ unlink(infile);
+}
+
+
+/* ===========================================================================
+ * Usage: minigzip [-d] [-f] [-h] [-1 to -9] [files...]
+ * -d : decompress
+ * -f : compress with Z_FILTERED
+ * -h : compress with Z_HUFFMAN_ONLY
+ * -1 to -9 : compression level
+ */
+
+int main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ int uncompr = 0;
+ gzFile file;
+ char outmode[20];
+
+ strcpy(outmode, "wb6 ");
+
+ prog = argv[0];
+ argc--, argv++;
+
+ while (argc > 0) {
+ if (strcmp(*argv, "-d") == 0)
+ uncompr = 1;
+ else if (strcmp(*argv, "-f") == 0)
+ outmode[3] = 'f';
+ else if (strcmp(*argv, "-h") == 0)
+ outmode[3] = 'h';
+ else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' &&
+ (*argv)[2] == 0)
+ outmode[2] = (*argv)[1];
+ else
+ break;
+ argc--, argv++;
+ }
+ if (argc == 0) {
+ SET_BINARY_MODE(stdin);
+ SET_BINARY_MODE(stdout);
+ if (uncompr) {
+ file = gzdopen(fileno(stdin), "rb");
+ if (file == NULL) error("can't gzdopen stdin");
+ gz_uncompress(file, stdout);
+ } else {
+ file = gzdopen(fileno(stdout), outmode);
+ if (file == NULL) error("can't gzdopen stdout");
+ gz_compress(stdin, file);
+ }
+ } else {
+ do {
+ if (uncompr) {
+ file_uncompress(*argv);
+ } else {
+ file_compress(*argv, outmode);
+ }
+ } while (argv++, --argc);
+ }
+ exit(0);
+ return 0; /* to avoid warning */
+}
diff --git a/src/zlib/trees.c b/src/zlib/trees.c
new file mode 100644
index 000000000..ae832d631
--- /dev/null
+++ b/src/zlib/trees.c
@@ -0,0 +1,1214 @@
+/* trees.c -- output deflated data using Huffman coding
+ * Copyright (C) 1995-2002 Jean-loup Gailly
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/*
+ * ALGORITHM
+ *
+ * The "deflation" process uses several Huffman trees. The more
+ * common source values are represented by shorter bit sequences.
+ *
+ * Each code tree is stored in a compressed form which is itself
+ * a Huffman encoding of the lengths of all the code strings (in
+ * ascending order by source values). The actual code strings are
+ * reconstructed from the lengths in the inflate process, as described
+ * in the deflate specification.
+ *
+ * REFERENCES
+ *
+ * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
+ * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
+ *
+ * Storer, James A.
+ * Data Compression: Methods and Theory, pp. 49-50.
+ * Computer Science Press, 1988. ISBN 0-7167-8156-5.
+ *
+ * Sedgewick, R.
+ * Algorithms, p290.
+ * Addison-Wesley, 1983. ISBN 0-201-06672-6.
+ */
+
+/* @(#) $Id: trees.c 126 2003-11-09 01:53:27Z gabest $ */
+
+/* #define GEN_TREES_H */
+
+#include "deflate.h"
+
+#ifdef DEBUG
+# include <ctype.h>
+#endif
+
+/* ===========================================================================
+ * Constants
+ */
+
+#define MAX_BL_BITS 7
+/* Bit length codes must not exceed MAX_BL_BITS bits */
+
+#define END_BLOCK 256
+/* end of block literal code */
+
+#define REP_3_6 16
+/* repeat previous bit length 3-6 times (2 bits of repeat count) */
+
+#define REPZ_3_10 17
+/* repeat a zero length 3-10 times (3 bits of repeat count) */
+
+#define REPZ_11_138 18
+/* repeat a zero length 11-138 times (7 bits of repeat count) */
+
+local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
+ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
+
+local const int extra_dbits[D_CODES] /* extra bits for each distance code */
+ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
+
+local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
+ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
+
+local const uch bl_order[BL_CODES]
+ = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
+/* The lengths of the bit length codes are sent in order of decreasing
+ * probability, to avoid transmitting the lengths for unused bit length codes.
+ */
+
+#define Buf_size (8 * 2*sizeof(char))
+/* Number of bits used within bi_buf. (bi_buf might be implemented on
+ * more than 16 bits on some systems.)
+ */
+
+/* ===========================================================================
+ * Local data. These are initialized only once.
+ */
+
+#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
+
+#if defined(GEN_TREES_H) || !defined(STDC)
+/* non ANSI compilers may not accept trees.h */
+
+local ct_data static_ltree[L_CODES+2];
+/* The static literal tree. Since the bit lengths are imposed, there is no
+ * need for the L_CODES extra codes used during heap construction. However
+ * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
+ * below).
+ */
+
+local ct_data static_dtree[D_CODES];
+/* The static distance tree. (Actually a trivial tree since all codes use
+ * 5 bits.)
+ */
+
+uch _dist_code[DIST_CODE_LEN];
+/* Distance codes. The first 256 values correspond to the distances
+ * 3 .. 258, the last 256 values correspond to the top 8 bits of
+ * the 15 bit distances.
+ */
+
+uch _length_code[MAX_MATCH-MIN_MATCH+1];
+/* length code for each normalized match length (0 == MIN_MATCH) */
+
+local int base_length[LENGTH_CODES];
+/* First normalized length for each code (0 = MIN_MATCH) */
+
+local int base_dist[D_CODES];
+/* First normalized distance for each code (0 = distance of 1) */
+
+#else
+# include "trees.h"
+#endif /* GEN_TREES_H */
+
+struct static_tree_desc_s {
+ const ct_data *static_tree; /* static tree or NULL */
+ const intf *extra_bits; /* extra bits for each code or NULL */
+ int extra_base; /* base index for extra_bits */
+ int elems; /* max number of elements in the tree */
+ int max_length; /* max bit length for the codes */
+};
+
+local static_tree_desc static_l_desc =
+{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
+
+local static_tree_desc static_d_desc =
+{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
+
+local static_tree_desc static_bl_desc =
+{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
+
+/* ===========================================================================
+ * Local (static) routines in this file.
+ */
+
+local void tr_static_init OF((void));
+local void init_block OF((deflate_state *s));
+local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
+local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
+local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
+local void build_tree OF((deflate_state *s, tree_desc *desc));
+local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
+local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
+local int build_bl_tree OF((deflate_state *s));
+local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
+ int blcodes));
+local void compress_block OF((deflate_state *s, ct_data *ltree,
+ ct_data *dtree));
+local void set_data_type OF((deflate_state *s));
+local unsigned bi_reverse OF((unsigned value, int length));
+local void bi_windup OF((deflate_state *s));
+local void bi_flush OF((deflate_state *s));
+local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
+ int header));
+
+#ifdef GEN_TREES_H
+local void gen_trees_header OF((void));
+#endif
+
+#ifndef DEBUG
+# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
+ /* Send a code of the given tree. c and tree must not have side effects */
+
+#else /* DEBUG */
+# define send_code(s, c, tree) \
+ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
+ send_bits(s, tree[c].Code, tree[c].Len); }
+#endif
+
+/* ===========================================================================
+ * Output a short LSB first on the stream.
+ * IN assertion: there is enough room in pendingBuf.
+ */
+#define put_short(s, w) { \
+ put_byte(s, (uch)((w) & 0xff)); \
+ put_byte(s, (uch)((ush)(w) >> 8)); \
+}
+
+/* ===========================================================================
+ * Send a value on a given number of bits.
+ * IN assertion: length <= 16 and value fits in length bits.
+ */
+#ifdef DEBUG
+local void send_bits OF((deflate_state *s, int value, int length));
+
+local void send_bits(s, value, length)
+ deflate_state *s;
+ int value; /* value to send */
+ int length; /* number of bits */
+{
+ Tracevv((stderr," l %2d v %4x ", length, value));
+ Assert(length > 0 && length <= 15, "invalid length");
+ s->bits_sent += (ulg)length;
+
+ /* If not enough room in bi_buf, use (valid) bits from bi_buf and
+ * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
+ * unused bits in value.
+ */
+ if (s->bi_valid > (int)Buf_size - length) {
+ s->bi_buf |= (value << s->bi_valid);
+ put_short(s, s->bi_buf);
+ s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
+ s->bi_valid += length - Buf_size;
+ } else {
+ s->bi_buf |= value << s->bi_valid;
+ s->bi_valid += length;
+ }
+}
+#else /* !DEBUG */
+
+#define send_bits(s, value, length) \
+{ int len = length;\
+ if (s->bi_valid > (int)Buf_size - len) {\
+ int val = value;\
+ s->bi_buf |= (val << s->bi_valid);\
+ put_short(s, s->bi_buf);\
+ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
+ s->bi_valid += len - Buf_size;\
+ } else {\
+ s->bi_buf |= (value) << s->bi_valid;\
+ s->bi_valid += len;\
+ }\
+}
+#endif /* DEBUG */
+
+
+#define MAX(a,b) (a >= b ? a : b)
+/* the arguments must not have side effects */
+
+/* ===========================================================================
+ * Initialize the various 'constant' tables.
+ */
+local void tr_static_init()
+{
+#if defined(GEN_TREES_H) || !defined(STDC)
+ static int static_init_done = 0;
+ int n; /* iterates over tree elements */
+ int bits; /* bit counter */
+ int length; /* length value */
+ int code; /* code value */
+ int dist; /* distance index */
+ ush bl_count[MAX_BITS+1];
+ /* number of codes at each bit length for an optimal tree */
+
+ if (static_init_done) return;
+
+ /* For some embedded targets, global variables are not initialized: */
+ static_l_desc.static_tree = static_ltree;
+ static_l_desc.extra_bits = extra_lbits;
+ static_d_desc.static_tree = static_dtree;
+ static_d_desc.extra_bits = extra_dbits;
+ static_bl_desc.extra_bits = extra_blbits;
+
+ /* Initialize the mapping length (0..255) -> length code (0..28) */
+ length = 0;
+ for (code = 0; code < LENGTH_CODES-1; code++) {
+ base_length[code] = length;
+ for (n = 0; n < (1<<extra_lbits[code]); n++) {
+ _length_code[length++] = (uch)code;
+ }
+ }
+ Assert (length == 256, "tr_static_init: length != 256");
+ /* Note that the length 255 (match length 258) can be represented
+ * in two different ways: code 284 + 5 bits or code 285, so we
+ * overwrite length_code[255] to use the best encoding:
+ */
+ _length_code[length-1] = (uch)code;
+
+ /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
+ dist = 0;
+ for (code = 0 ; code < 16; code++) {
+ base_dist[code] = dist;
+ for (n = 0; n < (1<<extra_dbits[code]); n++) {
+ _dist_code[dist++] = (uch)code;
+ }
+ }
+ Assert (dist == 256, "tr_static_init: dist != 256");
+ dist >>= 7; /* from now on, all distances are divided by 128 */
+ for ( ; code < D_CODES; code++) {
+ base_dist[code] = dist << 7;
+ for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
+ _dist_code[256 + dist++] = (uch)code;
+ }
+ }
+ Assert (dist == 256, "tr_static_init: 256+dist != 512");
+
+ /* Construct the codes of the static literal tree */
+ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
+ n = 0;
+ while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
+ while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
+ while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
+ while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
+ /* Codes 286 and 287 do not exist, but we must include them in the
+ * tree construction to get a canonical Huffman tree (longest code
+ * all ones)
+ */
+ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
+
+ /* The static distance tree is trivial: */
+ for (n = 0; n < D_CODES; n++) {
+ static_dtree[n].Len = 5;
+ static_dtree[n].Code = bi_reverse((unsigned)n, 5);
+ }
+ static_init_done = 1;
+
+# ifdef GEN_TREES_H
+ gen_trees_header();
+# endif
+#endif /* defined(GEN_TREES_H) || !defined(STDC) */
+}
+
+/* ===========================================================================
+ * Genererate the file trees.h describing the static trees.
+ */
+#ifdef GEN_TREES_H
+# ifndef DEBUG
+# include <stdio.h>
+# endif
+
+# define SEPARATOR(i, last, width) \
+ ((i) == (last)? "\n};\n\n" : \
+ ((i) % (width) == (width)-1 ? ",\n" : ", "))
+
+void gen_trees_header()
+{
+ FILE *header = fopen("trees.h", "w");
+ int i;
+
+ Assert (header != NULL, "Can't open trees.h");
+ fprintf(header,
+ "/* header created automatically with -DGEN_TREES_H */\n\n");
+
+ fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
+ for (i = 0; i < L_CODES+2; i++) {
+ fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
+ static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
+ }
+
+ fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
+ for (i = 0; i < D_CODES; i++) {
+ fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
+ static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
+ }
+
+ fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
+ for (i = 0; i < DIST_CODE_LEN; i++) {
+ fprintf(header, "%2u%s", _dist_code[i],
+ SEPARATOR(i, DIST_CODE_LEN-1, 20));
+ }
+
+ fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
+ for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
+ fprintf(header, "%2u%s", _length_code[i],
+ SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
+ }
+
+ fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
+ for (i = 0; i < LENGTH_CODES; i++) {
+ fprintf(header, "%1u%s", base_length[i],
+ SEPARATOR(i, LENGTH_CODES-1, 20));
+ }
+
+ fprintf(header, "local const int base_dist[D_CODES] = {\n");
+ for (i = 0; i < D_CODES; i++) {
+ fprintf(header, "%5u%s", base_dist[i],
+ SEPARATOR(i, D_CODES-1, 10));
+ }
+
+ fclose(header);
+}
+#endif /* GEN_TREES_H */
+
+/* ===========================================================================
+ * Initialize the tree data structures for a new zlib stream.
+ */
+void _tr_init(s)
+ deflate_state *s;
+{
+ tr_static_init();
+
+ s->l_desc.dyn_tree = s->dyn_ltree;
+ s->l_desc.stat_desc = &static_l_desc;
+
+ s->d_desc.dyn_tree = s->dyn_dtree;
+ s->d_desc.stat_desc = &static_d_desc;
+
+ s->bl_desc.dyn_tree = s->bl_tree;
+ s->bl_desc.stat_desc = &static_bl_desc;
+
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+ s->last_eob_len = 8; /* enough lookahead for inflate */
+#ifdef DEBUG
+ s->compressed_len = 0L;
+ s->bits_sent = 0L;
+#endif
+
+ /* Initialize the first block of the first file: */
+ init_block(s);
+}
+
+/* ===========================================================================
+ * Initialize a new block.
+ */
+local void init_block(s)
+ deflate_state *s;
+{
+ int n; /* iterates over tree elements */
+
+ /* Initialize the trees. */
+ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
+ for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
+ for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
+
+ s->dyn_ltree[END_BLOCK].Freq = 1;
+ s->opt_len = s->static_len = 0L;
+ s->last_lit = s->matches = 0;
+}
+
+#define SMALLEST 1
+/* Index within the heap array of least frequent node in the Huffman tree */
+
+
+/* ===========================================================================
+ * Remove the smallest element from the heap and recreate the heap with
+ * one less element. Updates heap and heap_len.
+ */
+#define pqremove(s, tree, top) \
+{\
+ top = s->heap[SMALLEST]; \
+ s->heap[SMALLEST] = s->heap[s->heap_len--]; \
+ pqdownheap(s, tree, SMALLEST); \
+}
+
+/* ===========================================================================
+ * Compares to subtrees, using the tree depth as tie breaker when
+ * the subtrees have equal frequency. This minimizes the worst case length.
+ */
+#define smaller(tree, n, m, depth) \
+ (tree[n].Freq < tree[m].Freq || \
+ (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
+
+/* ===========================================================================
+ * Restore the heap property by moving down the tree starting at node k,
+ * exchanging a node with the smallest of its two sons if necessary, stopping
+ * when the heap property is re-established (each father smaller than its
+ * two sons).
+ */
+local void pqdownheap(s, tree, k)
+ deflate_state *s;
+ ct_data *tree; /* the tree to restore */
+ int k; /* node to move down */
+{
+ int v = s->heap[k];
+ int j = k << 1; /* left son of k */
+ while (j <= s->heap_len) {
+ /* Set j to the smallest of the two sons: */
+ if (j < s->heap_len &&
+ smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
+ j++;
+ }
+ /* Exit if v is smaller than both sons */
+ if (smaller(tree, v, s->heap[j], s->depth)) break;
+
+ /* Exchange v with the smallest son */
+ s->heap[k] = s->heap[j]; k = j;
+
+ /* And continue down the tree, setting j to the left son of k */
+ j <<= 1;
+ }
+ s->heap[k] = v;
+}
+
+/* ===========================================================================
+ * Compute the optimal bit lengths for a tree and update the total bit length
+ * for the current block.
+ * IN assertion: the fields freq and dad are set, heap[heap_max] and
+ * above are the tree nodes sorted by increasing frequency.
+ * OUT assertions: the field len is set to the optimal bit length, the
+ * array bl_count contains the frequencies for each bit length.
+ * The length opt_len is updated; static_len is also updated if stree is
+ * not null.
+ */
+local void gen_bitlen(s, desc)
+ deflate_state *s;
+ tree_desc *desc; /* the tree descriptor */
+{
+ ct_data *tree = desc->dyn_tree;
+ int max_code = desc->max_code;
+ const ct_data *stree = desc->stat_desc->static_tree;
+ const intf *extra = desc->stat_desc->extra_bits;
+ int base = desc->stat_desc->extra_base;
+ int max_length = desc->stat_desc->max_length;
+ int h; /* heap index */
+ int n, m; /* iterate over the tree elements */
+ int bits; /* bit length */
+ int xbits; /* extra bits */
+ ush f; /* frequency */
+ int overflow = 0; /* number of elements with bit length too large */
+
+ for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
+
+ /* In a first pass, compute the optimal bit lengths (which may
+ * overflow in the case of the bit length tree).
+ */
+ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
+
+ for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+ n = s->heap[h];
+ bits = tree[tree[n].Dad].Len + 1;
+ if (bits > max_length) bits = max_length, overflow++;
+ tree[n].Len = (ush)bits;
+ /* We overwrite tree[n].Dad which is no longer needed */
+
+ if (n > max_code) continue; /* not a leaf node */
+
+ s->bl_count[bits]++;
+ xbits = 0;
+ if (n >= base) xbits = extra[n-base];
+ f = tree[n].Freq;
+ s->opt_len += (ulg)f * (bits + xbits);
+ if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
+ }
+ if (overflow == 0) return;
+
+ Trace((stderr,"\nbit length overflow\n"));
+ /* This happens for example on obj2 and pic of the Calgary corpus */
+
+ /* Find the first bit length which could increase: */
+ do {
+ bits = max_length-1;
+ while (s->bl_count[bits] == 0) bits--;
+ s->bl_count[bits]--; /* move one leaf down the tree */
+ s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+ s->bl_count[max_length]--;
+ /* The brother of the overflow item also moves one step up,
+ * but this does not affect bl_count[max_length]
+ */
+ overflow -= 2;
+ } while (overflow > 0);
+
+ /* Now recompute all bit lengths, scanning in increasing frequency.
+ * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
+ * lengths instead of fixing only the wrong ones. This idea is taken
+ * from 'ar' written by Haruhiko Okumura.)
+ */
+ for (bits = max_length; bits != 0; bits--) {
+ n = s->bl_count[bits];
+ while (n != 0) {
+ m = s->heap[--h];
+ if (m > max_code) continue;
+ if (tree[m].Len != (unsigned) bits) {
+ Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
+ s->opt_len += ((long)bits - (long)tree[m].Len)
+ *(long)tree[m].Freq;
+ tree[m].Len = (ush)bits;
+ }
+ n--;
+ }
+ }
+}
+
+/* ===========================================================================
+ * Generate the codes for a given tree and bit counts (which need not be
+ * optimal).
+ * IN assertion: the array bl_count contains the bit length statistics for
+ * the given tree and the field len is set for all tree elements.
+ * OUT assertion: the field code is set for all tree elements of non
+ * zero code length.
+ */
+local void gen_codes (tree, max_code, bl_count)
+ ct_data *tree; /* the tree to decorate */
+ int max_code; /* largest code with non zero frequency */
+ ushf *bl_count; /* number of codes at each bit length */
+{
+ ush next_code[MAX_BITS+1]; /* next code value for each bit length */
+ ush code = 0; /* running code value */
+ int bits; /* bit index */
+ int n; /* code index */
+
+ /* The distribution counts are first used to generate the code values
+ * without bit reversal.
+ */
+ for (bits = 1; bits <= MAX_BITS; bits++) {
+ next_code[bits] = code = (code + bl_count[bits-1]) << 1;
+ }
+ /* Check that the bit counts in bl_count are consistent. The last code
+ * must be all ones.
+ */
+ Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
+ "inconsistent bit counts");
+ Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
+
+ for (n = 0; n <= max_code; n++) {
+ int len = tree[n].Len;
+ if (len == 0) continue;
+ /* Now reverse the bits */
+ tree[n].Code = bi_reverse(next_code[len]++, len);
+
+ Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
+ n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
+ }
+}
+
+/* ===========================================================================
+ * Construct one Huffman tree and assigns the code bit strings and lengths.
+ * Update the total bit length for the current block.
+ * IN assertion: the field freq is set for all tree elements.
+ * OUT assertions: the fields len and code are set to the optimal bit length
+ * and corresponding code. The length opt_len is updated; static_len is
+ * also updated if stree is not null. The field max_code is set.
+ */
+local void build_tree(s, desc)
+ deflate_state *s;
+ tree_desc *desc; /* the tree descriptor */
+{
+ ct_data *tree = desc->dyn_tree;
+ const ct_data *stree = desc->stat_desc->static_tree;
+ int elems = desc->stat_desc->elems;
+ int n, m; /* iterate over heap elements */
+ int max_code = -1; /* largest code with non zero frequency */
+ int node; /* new node being created */
+
+ /* Construct the initial heap, with least frequent element in
+ * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
+ * heap[0] is not used.
+ */
+ s->heap_len = 0, s->heap_max = HEAP_SIZE;
+
+ for (n = 0; n < elems; n++) {
+ if (tree[n].Freq != 0) {
+ s->heap[++(s->heap_len)] = max_code = n;
+ s->depth[n] = 0;
+ } else {
+ tree[n].Len = 0;
+ }
+ }
+
+ /* The pkzip format requires that at least one distance code exists,
+ * and that at least one bit should be sent even if there is only one
+ * possible code. So to avoid special checks later on we force at least
+ * two codes of non zero frequency.
+ */
+ while (s->heap_len < 2) {
+ node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
+ tree[node].Freq = 1;
+ s->depth[node] = 0;
+ s->opt_len--; if (stree) s->static_len -= stree[node].Len;
+ /* node is 0 or 1 so it does not have extra bits */
+ }
+ desc->max_code = max_code;
+
+ /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
+ * establish sub-heaps of increasing lengths:
+ */
+ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
+
+ /* Construct the Huffman tree by repeatedly combining the least two
+ * frequent nodes.
+ */
+ node = elems; /* next internal node of the tree */
+ do {
+ pqremove(s, tree, n); /* n = node of least frequency */
+ m = s->heap[SMALLEST]; /* m = node of next least frequency */
+
+ s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
+ s->heap[--(s->heap_max)] = m;
+
+ /* Create a new node father of n and m */
+ tree[node].Freq = tree[n].Freq + tree[m].Freq;
+ s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1);
+ tree[n].Dad = tree[m].Dad = (ush)node;
+#ifdef DUMP_BL_TREE
+ if (tree == s->bl_tree) {
+ fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
+ node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
+ }
+#endif
+ /* and insert the new node in the heap */
+ s->heap[SMALLEST] = node++;
+ pqdownheap(s, tree, SMALLEST);
+
+ } while (s->heap_len >= 2);
+
+ s->heap[--(s->heap_max)] = s->heap[SMALLEST];
+
+ /* At this point, the fields freq and dad are set. We can now
+ * generate the bit lengths.
+ */
+ gen_bitlen(s, (tree_desc *)desc);
+
+ /* The field len is now set, we can generate the bit codes */
+ gen_codes ((ct_data *)tree, max_code, s->bl_count);
+}
+
+/* ===========================================================================
+ * Scan a literal or distance tree to determine the frequencies of the codes
+ * in the bit length tree.
+ */
+local void scan_tree (s, tree, max_code)
+ deflate_state *s;
+ ct_data *tree; /* the tree to be scanned */
+ int max_code; /* and its largest code of non zero frequency */
+{
+ int n; /* iterates over all tree elements */
+ int prevlen = -1; /* last emitted length */
+ int curlen; /* length of current code */
+ int nextlen = tree[0].Len; /* length of next code */
+ int count = 0; /* repeat count of the current code */
+ int max_count = 7; /* max repeat count */
+ int min_count = 4; /* min repeat count */
+
+ if (nextlen == 0) max_count = 138, min_count = 3;
+ tree[max_code+1].Len = (ush)0xffff; /* guard */
+
+ for (n = 0; n <= max_code; n++) {
+ curlen = nextlen; nextlen = tree[n+1].Len;
+ if (++count < max_count && curlen == nextlen) {
+ continue;
+ } else if (count < min_count) {
+ s->bl_tree[curlen].Freq += count;
+ } else if (curlen != 0) {
+ if (curlen != prevlen) s->bl_tree[curlen].Freq++;
+ s->bl_tree[REP_3_6].Freq++;
+ } else if (count <= 10) {
+ s->bl_tree[REPZ_3_10].Freq++;
+ } else {
+ s->bl_tree[REPZ_11_138].Freq++;
+ }
+ count = 0; prevlen = curlen;
+ if (nextlen == 0) {
+ max_count = 138, min_count = 3;
+ } else if (curlen == nextlen) {
+ max_count = 6, min_count = 3;
+ } else {
+ max_count = 7, min_count = 4;
+ }
+ }
+}
+
+/* ===========================================================================
+ * Send a literal or distance tree in compressed form, using the codes in
+ * bl_tree.
+ */
+local void send_tree (s, tree, max_code)
+ deflate_state *s;
+ ct_data *tree; /* the tree to be scanned */
+ int max_code; /* and its largest code of non zero frequency */
+{
+ int n; /* iterates over all tree elements */
+ int prevlen = -1; /* last emitted length */
+ int curlen; /* length of current code */
+ int nextlen = tree[0].Len; /* length of next code */
+ int count = 0; /* repeat count of the current code */
+ int max_count = 7; /* max repeat count */
+ int min_count = 4; /* min repeat count */
+
+ /* tree[max_code+1].Len = -1; */ /* guard already set */
+ if (nextlen == 0) max_count = 138, min_count = 3;
+
+ for (n = 0; n <= max_code; n++) {
+ curlen = nextlen; nextlen = tree[n+1].Len;
+ if (++count < max_count && curlen == nextlen) {
+ continue;
+ } else if (count < min_count) {
+ do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
+
+ } else if (curlen != 0) {
+ if (curlen != prevlen) {
+ send_code(s, curlen, s->bl_tree); count--;
+ }
+ Assert(count >= 3 && count <= 6, " 3_6?");
+ send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
+
+ } else if (count <= 10) {
+ send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
+
+ } else {
+ send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
+ }
+ count = 0; prevlen = curlen;
+ if (nextlen == 0) {
+ max_count = 138, min_count = 3;
+ } else if (curlen == nextlen) {
+ max_count = 6, min_count = 3;
+ } else {
+ max_count = 7, min_count = 4;
+ }
+ }
+}
+
+/* ===========================================================================
+ * Construct the Huffman tree for the bit lengths and return the index in
+ * bl_order of the last bit length code to send.
+ */
+local int build_bl_tree(s)
+ deflate_state *s;
+{
+ int max_blindex; /* index of last bit length code of non zero freq */
+
+ /* Determine the bit length frequencies for literal and distance trees */
+ scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
+ scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
+
+ /* Build the bit length tree: */
+ build_tree(s, (tree_desc *)(&(s->bl_desc)));
+ /* opt_len now includes the length of the tree representations, except
+ * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
+ */
+
+ /* Determine the number of bit length codes to send. The pkzip format
+ * requires that at least 4 bit length codes be sent. (appnote.txt says
+ * 3 but the actual value used is 4.)
+ */
+ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
+ if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
+ }
+ /* Update opt_len to include the bit length tree and counts */
+ s->opt_len += 3*(max_blindex+1) + 5+5+4;
+ Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
+ s->opt_len, s->static_len));
+
+ return max_blindex;
+}
+
+/* ===========================================================================
+ * Send the header for a block using dynamic Huffman trees: the counts, the
+ * lengths of the bit length codes, the literal tree and the distance tree.
+ * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
+ */
+local void send_all_trees(s, lcodes, dcodes, blcodes)
+ deflate_state *s;
+ int lcodes, dcodes, blcodes; /* number of codes for each tree */
+{
+ int rank; /* index in bl_order */
+
+ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
+ Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
+ "too many codes");
+ Tracev((stderr, "\nbl counts: "));
+ send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
+ send_bits(s, dcodes-1, 5);
+ send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
+ for (rank = 0; rank < blcodes; rank++) {
+ Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
+ send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
+ }
+ Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
+
+ send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
+ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
+
+ send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
+ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
+}
+
+/* ===========================================================================
+ * Send a stored block
+ */
+void _tr_stored_block(s, buf, stored_len, eof)
+ deflate_state *s;
+ charf *buf; /* input block */
+ ulg stored_len; /* length of input block */
+ int eof; /* true if this is the last block for a file */
+{
+ send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
+#ifdef DEBUG
+ s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
+ s->compressed_len += (stored_len + 4) << 3;
+#endif
+ copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
+}
+
+/* ===========================================================================
+ * Send one empty static block to give enough lookahead for inflate.
+ * This takes 10 bits, of which 7 may remain in the bit buffer.
+ * The current inflate code requires 9 bits of lookahead. If the
+ * last two codes for the previous block (real code plus EOB) were coded
+ * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode
+ * the last real code. In this case we send two empty static blocks instead
+ * of one. (There are no problems if the previous block is stored or fixed.)
+ * To simplify the code, we assume the worst case of last real code encoded
+ * on one bit only.
+ */
+void _tr_align(s)
+ deflate_state *s;
+{
+ send_bits(s, STATIC_TREES<<1, 3);
+ send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+ s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
+#endif
+ bi_flush(s);
+ /* Of the 10 bits for the empty block, we have already sent
+ * (10 - bi_valid) bits. The lookahead for the last real code (before
+ * the EOB of the previous block) was thus at least one plus the length
+ * of the EOB plus what we have just sent of the empty static block.
+ */
+ if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
+ send_bits(s, STATIC_TREES<<1, 3);
+ send_code(s, END_BLOCK, static_ltree);
+#ifdef DEBUG
+ s->compressed_len += 10L;
+#endif
+ bi_flush(s);
+ }
+ s->last_eob_len = 7;
+}
+
+/* ===========================================================================
+ * Determine the best encoding for the current block: dynamic trees, static
+ * trees or store, and output the encoded block to the zip file.
+ */
+void _tr_flush_block(s, buf, stored_len, eof)
+ deflate_state *s;
+ charf *buf; /* input block, or NULL if too old */
+ ulg stored_len; /* length of input block */
+ int eof; /* true if this is the last block for a file */
+{
+ ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+ int max_blindex = 0; /* index of last bit length code of non zero freq */
+
+ /* Build the Huffman trees unless a stored block is forced */
+ if (s->level > 0) {
+
+ /* Check if the file is ascii or binary */
+ if (s->data_type == Z_UNKNOWN) set_data_type(s);
+
+ /* Construct the literal and distance trees */
+ build_tree(s, (tree_desc *)(&(s->l_desc)));
+ Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
+ s->static_len));
+
+ build_tree(s, (tree_desc *)(&(s->d_desc)));
+ Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
+ s->static_len));
+ /* At this point, opt_len and static_len are the total bit lengths of
+ * the compressed block data, excluding the tree representations.
+ */
+
+ /* Build the bit length tree for the above two trees, and get the index
+ * in bl_order of the last bit length code to send.
+ */
+ max_blindex = build_bl_tree(s);
+
+ /* Determine the best encoding. Compute first the block length in bytes*/
+ opt_lenb = (s->opt_len+3+7)>>3;
+ static_lenb = (s->static_len+3+7)>>3;
+
+ Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
+ opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
+ s->last_lit));
+
+ if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
+
+ } else {
+ Assert(buf != (char*)0, "lost buf");
+ opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
+ }
+
+#ifdef FORCE_STORED
+ if (buf != (char*)0) { /* force stored block */
+#else
+ if (stored_len+4 <= opt_lenb && buf != (char*)0) {
+ /* 4: two words for the lengths */
+#endif
+ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
+ * Otherwise we can't have processed more than WSIZE input bytes since
+ * the last block flush, because compression would have been
+ * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
+ * transform a block into a stored block.
+ */
+ _tr_stored_block(s, buf, stored_len, eof);
+
+#ifdef FORCE_STATIC
+ } else if (static_lenb >= 0) { /* force static trees */
+#else
+ } else if (static_lenb == opt_lenb) {
+#endif
+ send_bits(s, (STATIC_TREES<<1)+eof, 3);
+ compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
+#ifdef DEBUG
+ s->compressed_len += 3 + s->static_len;
+#endif
+ } else {
+ send_bits(s, (DYN_TREES<<1)+eof, 3);
+ send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
+ max_blindex+1);
+ compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
+#ifdef DEBUG
+ s->compressed_len += 3 + s->opt_len;
+#endif
+ }
+ Assert (s->compressed_len == s->bits_sent, "bad compressed size");
+ /* The above check is made mod 2^32, for files larger than 512 MB
+ * and uLong implemented on 32 bits.
+ */
+ init_block(s);
+
+ if (eof) {
+ bi_windup(s);
+#ifdef DEBUG
+ s->compressed_len += 7; /* align on byte boundary */
+#endif
+ }
+ Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
+ s->compressed_len-7*eof));
+}
+
+/* ===========================================================================
+ * Save the match info and tally the frequency counts. Return true if
+ * the current block must be flushed.
+ */
+int _tr_tally (s, dist, lc)
+ deflate_state *s;
+ unsigned dist; /* distance of matched string */
+ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
+{
+ s->d_buf[s->last_lit] = (ush)dist;
+ s->l_buf[s->last_lit++] = (uch)lc;
+ if (dist == 0) {
+ /* lc is the unmatched char */
+ s->dyn_ltree[lc].Freq++;
+ } else {
+ s->matches++;
+ /* Here, lc is the match length - MIN_MATCH */
+ dist--; /* dist = match distance - 1 */
+ Assert((ush)dist < (ush)MAX_DIST(s) &&
+ (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
+ (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
+
+ s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
+ s->dyn_dtree[d_code(dist)].Freq++;
+ }
+
+#ifdef TRUNCATE_BLOCK
+ /* Try to guess if it is profitable to stop the current block here */
+ if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
+ /* Compute an upper bound for the compressed length */
+ ulg out_length = (ulg)s->last_lit*8L;
+ ulg in_length = (ulg)((long)s->strstart - s->block_start);
+ int dcode;
+ for (dcode = 0; dcode < D_CODES; dcode++) {
+ out_length += (ulg)s->dyn_dtree[dcode].Freq *
+ (5L+extra_dbits[dcode]);
+ }
+ out_length >>= 3;
+ Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
+ s->last_lit, in_length, out_length,
+ 100L - out_length*100L/in_length));
+ if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
+ }
+#endif
+ return (s->last_lit == s->lit_bufsize-1);
+ /* We avoid equality with lit_bufsize because of wraparound at 64K
+ * on 16 bit machines and because stored blocks are restricted to
+ * 64K-1 bytes.
+ */
+}
+
+/* ===========================================================================
+ * Send the block data compressed using the given Huffman trees
+ */
+local void compress_block(s, ltree, dtree)
+ deflate_state *s;
+ ct_data *ltree; /* literal tree */
+ ct_data *dtree; /* distance tree */
+{
+ unsigned dist; /* distance of matched string */
+ int lc; /* match length or unmatched char (if dist == 0) */
+ unsigned lx = 0; /* running index in l_buf */
+ unsigned code; /* the code to send */
+ int extra; /* number of extra bits to send */
+
+ if (s->last_lit != 0) do {
+ dist = s->d_buf[lx];
+ lc = s->l_buf[lx++];
+ if (dist == 0) {
+ send_code(s, lc, ltree); /* send a literal byte */
+ Tracecv(isgraph(lc), (stderr," '%c' ", lc));
+ } else {
+ /* Here, lc is the match length - MIN_MATCH */
+ code = _length_code[lc];
+ send_code(s, code+LITERALS+1, ltree); /* send the length code */
+ extra = extra_lbits[code];
+ if (extra != 0) {
+ lc -= base_length[code];
+ send_bits(s, lc, extra); /* send the extra length bits */
+ }
+ dist--; /* dist is now the match distance - 1 */
+ code = d_code(dist);
+ Assert (code < D_CODES, "bad d_code");
+
+ send_code(s, code, dtree); /* send the distance code */
+ extra = extra_dbits[code];
+ if (extra != 0) {
+ dist -= base_dist[code];
+ send_bits(s, dist, extra); /* send the extra distance bits */
+ }
+ } /* literal or match pair ? */
+
+ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
+ Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
+
+ } while (lx < s->last_lit);
+
+ send_code(s, END_BLOCK, ltree);
+ s->last_eob_len = ltree[END_BLOCK].Len;
+}
+
+/* ===========================================================================
+ * Set the data type to ASCII or BINARY, using a crude approximation:
+ * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
+ * IN assertion: the fields freq of dyn_ltree are set and the total of all
+ * frequencies does not exceed 64K (to fit in an int on 16 bit machines).
+ */
+local void set_data_type(s)
+ deflate_state *s;
+{
+ int n = 0;
+ unsigned ascii_freq = 0;
+ unsigned bin_freq = 0;
+ while (n < 7) bin_freq += s->dyn_ltree[n++].Freq;
+ while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq;
+ while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq;
+ s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII);
+}
+
+/* ===========================================================================
+ * Reverse the first len bits of a code, using straightforward code (a faster
+ * method would use a table)
+ * IN assertion: 1 <= len <= 15
+ */
+local unsigned bi_reverse(code, len)
+ unsigned code; /* the value to invert */
+ int len; /* its bit length */
+{
+ register unsigned res = 0;
+ do {
+ res |= code & 1;
+ code >>= 1, res <<= 1;
+ } while (--len > 0);
+ return res >> 1;
+}
+
+/* ===========================================================================
+ * Flush the bit buffer, keeping at most 7 bits in it.
+ */
+local void bi_flush(s)
+ deflate_state *s;
+{
+ if (s->bi_valid == 16) {
+ put_short(s, s->bi_buf);
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+ } else if (s->bi_valid >= 8) {
+ put_byte(s, (Byte)s->bi_buf);
+ s->bi_buf >>= 8;
+ s->bi_valid -= 8;
+ }
+}
+
+/* ===========================================================================
+ * Flush the bit buffer and align the output on a byte boundary
+ */
+local void bi_windup(s)
+ deflate_state *s;
+{
+ if (s->bi_valid > 8) {
+ put_short(s, s->bi_buf);
+ } else if (s->bi_valid > 0) {
+ put_byte(s, (Byte)s->bi_buf);
+ }
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+#ifdef DEBUG
+ s->bits_sent = (s->bits_sent+7) & ~7;
+#endif
+}
+
+/* ===========================================================================
+ * Copy a stored block, storing first the length and its
+ * one's complement if requested.
+ */
+local void copy_block(s, buf, len, header)
+ deflate_state *s;
+ charf *buf; /* the input data */
+ unsigned len; /* its length */
+ int header; /* true if block header must be written */
+{
+ bi_windup(s); /* align on byte boundary */
+ s->last_eob_len = 8; /* enough lookahead for inflate */
+
+ if (header) {
+ put_short(s, (ush)len);
+ put_short(s, (ush)~len);
+#ifdef DEBUG
+ s->bits_sent += 2*16;
+#endif
+ }
+#ifdef DEBUG
+ s->bits_sent += (ulg)len<<3;
+#endif
+ while (len--) {
+ put_byte(s, *buf++);
+ }
+}
diff --git a/src/zlib/trees.h b/src/zlib/trees.h
new file mode 100644
index 000000000..1ca868b84
--- /dev/null
+++ b/src/zlib/trees.h
@@ -0,0 +1,128 @@
+/* header created automatically with -DGEN_TREES_H */
+
+local const ct_data static_ltree[L_CODES+2] = {
+{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
+{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
+{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
+{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
+{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
+{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
+{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
+{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
+{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
+{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
+{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
+{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
+{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
+{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
+{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
+{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
+{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
+{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
+{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
+{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
+{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
+{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
+{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
+{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
+{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
+{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
+{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
+{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
+{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
+{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
+{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
+{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
+{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
+{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
+{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
+{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
+{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
+{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
+{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
+{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
+{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
+{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
+{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
+{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
+{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
+{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
+{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
+{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
+{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
+{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
+{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
+{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
+{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
+{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
+{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
+{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
+{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
+{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
+};
+
+local const ct_data static_dtree[D_CODES] = {
+{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
+{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
+{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
+{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
+{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
+{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
+};
+
+const uch _dist_code[DIST_CODE_LEN] = {
+ 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
+ 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
+10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
+18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
+};
+
+const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
+13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
+17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
+19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
+22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
+23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
+26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
+};
+
+local const int base_length[LENGTH_CODES] = {
+0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
+64, 80, 96, 112, 128, 160, 192, 224, 0
+};
+
+local const int base_dist[D_CODES] = {
+ 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
+ 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
+ 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
+};
+
diff --git a/src/zlib/uncompr.c b/src/zlib/uncompr.c
new file mode 100644
index 000000000..0babbe664
--- /dev/null
+++ b/src/zlib/uncompr.c
@@ -0,0 +1,58 @@
+/* uncompr.c -- decompress a memory buffer
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: uncompr.c 126 2003-11-09 01:53:27Z gabest $ */
+
+#include "zlib.h"
+
+/* ===========================================================================
+ Decompresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be large enough to hold the
+ entire uncompressed data. (The size of the uncompressed data must have
+ been saved previously by the compressor and transmitted to the decompressor
+ by some mechanism outside the scope of this compression library.)
+ Upon exit, destLen is the actual size of the compressed buffer.
+ This function can be used to decompress a whole file at once if the
+ input file is mmap'ed.
+
+ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer, or Z_DATA_ERROR if the input data was corrupted.
+*/
+int ZEXPORT uncompress (dest, destLen, source, sourceLen)
+ Bytef *dest;
+ uLongf *destLen;
+ const Bytef *source;
+ uLong sourceLen;
+{
+ z_stream stream;
+ int err;
+
+ stream.next_in = (Bytef*)source;
+ stream.avail_in = (uInt)sourceLen;
+ /* Check for source > 64K on 16-bit machine: */
+ if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
+
+ stream.next_out = dest;
+ stream.avail_out = (uInt)*destLen;
+ if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
+
+ stream.zalloc = (alloc_func)0;
+ stream.zfree = (free_func)0;
+
+ err = inflateInit(&stream);
+ if (err != Z_OK) return err;
+
+ err = inflate(&stream, Z_FINISH);
+ if (err != Z_STREAM_END) {
+ inflateEnd(&stream);
+ return err == Z_OK ? Z_BUF_ERROR : err;
+ }
+ *destLen = stream.total_out;
+
+ err = inflateEnd(&stream);
+ return err;
+}
diff --git a/src/zlib/zconf.h b/src/zlib/zconf.h
new file mode 100644
index 000000000..9ea6e1faf
--- /dev/null
+++ b/src/zlib/zconf.h
@@ -0,0 +1,279 @@
+/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zconf.h 147 2004-01-04 23:55:18Z gabest $ */
+
+#ifndef _ZCONF_H
+#define _ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ */
+#ifdef Z_PREFIX
+# define deflateInit_ z_deflateInit_
+# define deflate z_deflate
+# define deflateEnd z_deflateEnd
+# define inflateInit_ z_inflateInit_
+# define inflate z_inflate
+# define inflateEnd z_inflateEnd
+# define deflateInit2_ z_deflateInit2_
+# define deflateSetDictionary z_deflateSetDictionary
+# define deflateCopy z_deflateCopy
+# define deflateReset z_deflateReset
+# define deflateParams z_deflateParams
+# define inflateInit2_ z_inflateInit2_
+# define inflateSetDictionary z_inflateSetDictionary
+# define inflateSync z_inflateSync
+# define inflateSyncPoint z_inflateSyncPoint
+# define inflateReset z_inflateReset
+# define compress z_compress
+# define compress2 z_compress2
+# define uncompress z_uncompress
+# define adler32 z_adler32
+# define crc32 z_crc32
+# define get_crc_table z_get_crc_table
+
+# define Byte z_Byte
+# define uInt z_uInt
+# define uLong z_uLong
+# define Bytef z_Bytef
+# define charf z_charf
+# define intf z_intf
+# define uIntf z_uIntf
+# define uLongf z_uLongf
+# define voidpf z_voidpf
+# define voidp z_voidp
+#endif
+
+#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
+# define WIN32
+#endif
+#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
+# ifndef __32BIT__
+# define __32BIT__
+# endif
+#endif
+#if defined(__MSDOS__) && !defined(MSDOS)
+# define MSDOS
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#if defined(MSDOS) && !defined(__32BIT__)
+# define MAXSEG_64K
+#endif
+#ifdef MSDOS
+# define UNALIGNED_OK
+#endif
+
+#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
+# define STDC
+#endif
+#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
+# ifndef STDC
+# define STDC
+# endif
+#endif
+
+#ifndef STDC
+# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+# define const
+# endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
+# define NO_DUMMY_DECL
+#endif
+
+/* Old Borland C incorrectly complains about missing returns: */
+#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
+# define NEED_DUMMY_RETURN
+#endif
+
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+# ifdef MAXSEG_64K
+# define MAX_MEM_LEVEL 8
+# else
+# define MAX_MEM_LEVEL 9
+# endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+# define MAX_WBITS 15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+ (1 << (windowBits+2)) + (1 << (memLevel+9))
+ that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+ make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+ The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+ /* Type declarations */
+
+#ifndef OF /* function prototypes */
+# ifdef STDC
+# define OF(args) args
+# else
+# define OF(args) ()
+# endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
+ /* MSC small or medium model */
+# define SMALL_MEDIUM
+# ifdef _MSC_VER
+# define FAR _far
+# else
+# define FAR far
+# endif
+#endif
+#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
+# ifndef __32BIT__
+# define SMALL_MEDIUM
+# define FAR _far
+# endif
+#endif
+
+/* Compile with -DZLIB_DLL for Windows DLL support */
+#if defined(ZLIB_DLL)
+# if defined(_WINDOWS) || defined(WINDOWS)
+# ifdef FAR
+# undef FAR
+# endif
+# include <windows.h>
+# define ZEXPORT WINAPI
+# ifdef WIN32
+# define ZEXPORTVA WINAPIV
+# else
+# define ZEXPORTVA FAR _cdecl _export
+# endif
+# endif
+# if defined (__BORLANDC__)
+# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
+# include <windows.h>
+# define ZEXPORT __declspec(dllexport) WINAPI
+# define ZEXPORTRVA __declspec(dllexport) WINAPIV
+# else
+# if defined (_Windows) && defined (__DLL__)
+# define ZEXPORT _export
+# define ZEXPORTVA _export
+# endif
+# endif
+# endif
+#endif
+
+#if defined (__BEOS__)
+# if defined (ZLIB_DLL)
+# define ZEXTERN extern __declspec(dllexport)
+# else
+# define ZEXTERN extern __declspec(dllimport)
+# endif
+#endif
+
+#ifndef ZEXPORT
+# define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+# define ZEXPORTVA
+#endif
+#ifndef ZEXTERN
+# define ZEXTERN extern
+#endif
+
+#ifndef FAR
+# define FAR
+#endif
+
+#if !defined(MACOS) && !defined(TARGET_OS_MAC)
+typedef unsigned char Byte; /* 8 bits */
+#endif
+typedef unsigned int uInt; /* 16 bits or more */
+typedef unsigned long uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+ /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+# define Bytef Byte FAR
+#else
+ typedef unsigned char FAR Bytef;
+#endif
+typedef char FAR charf;
+typedef int FAR intf;
+typedef uInt FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+ typedef void FAR *voidpf;
+ typedef void *voidp;
+#else
+ typedef Byte FAR *voidpf;
+ typedef Byte *voidp;
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <sys/types.h> /* for off_t */
+# include <unistd.h> /* for SEEK_* and off_t */
+# define z_off_t off_t
+#endif
+#ifndef SEEK_SET
+# define SEEK_SET 0 /* Seek from beginning of file. */
+# define SEEK_CUR 1 /* Seek from current position. */
+# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
+#endif
+#ifndef z_off_t
+# define z_off_t long
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+# pragma map(deflateInit_,"DEIN")
+# pragma map(deflateInit2_,"DEIN2")
+# pragma map(deflateEnd,"DEEND")
+# pragma map(inflateInit_,"ININ")
+# pragma map(inflateInit2_,"ININ2")
+# pragma map(inflateEnd,"INEND")
+# pragma map(inflateSync,"INSY")
+# pragma map(inflateSetDictionary,"INSEDI")
+# pragma map(inflate_blocks,"INBL")
+# pragma map(inflate_blocks_new,"INBLNE")
+# pragma map(inflate_blocks_free,"INBLFR")
+# pragma map(inflate_blocks_reset,"INBLRE")
+# pragma map(inflate_codes_free,"INCOFR")
+# pragma map(inflate_codes,"INCO")
+# pragma map(inflate_fast,"INFA")
+# pragma map(inflate_flush,"INFLU")
+# pragma map(inflate_mask,"INMA")
+# pragma map(inflate_set_dictionary,"INSEDI2")
+# pragma map(inflate_copyright,"INCOPY")
+# pragma map(inflate_trees_bits,"INTRBI")
+# pragma map(inflate_trees_dynamic,"INTRDY")
+# pragma map(inflate_trees_fixed,"INTRFI")
+# pragma map(inflate_trees_free,"INTRFR")
+#endif
+
+#endif /* _ZCONF_H */
diff --git a/src/zlib/zlib.h b/src/zlib/zlib.h
new file mode 100644
index 000000000..5979f040c
--- /dev/null
+++ b/src/zlib/zlib.h
@@ -0,0 +1,893 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+ version 1.1.4, March 11th, 2002
+
+ Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
+
+ 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.
+
+ 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:
+
+ 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.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+
+ The data format used by the zlib library is described by RFCs (Request for
+ Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
+ (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef _ZLIB_H
+#define _ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.1.4"
+
+/*
+ The 'zlib' compression library provides in-memory compression and
+ decompression functions, including integrity checks of the uncompressed
+ data. This version of the library supports only one compression method
+ (deflation) but other algorithms will be added later and will have the same
+ stream interface.
+
+ Compression can be done in a single step if the buffers are large
+ enough (for example if an input file is mmap'ed), or can be done by
+ repeated calls of the compression function. In the latter case, the
+ application must provide more input and/or consume the output
+ (providing more output space) before each call.
+
+ The library also supports reading and writing files in gzip (.gz) format
+ with an interface similar to that of stdio.
+
+ The library does not install any signal handler. The decoder checks
+ the consistency of the compressed data, so the library should never
+ crash even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void (*free_func) OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+ Bytef *next_in; /* next input byte */
+ uInt avail_in; /* number of bytes available at next_in */
+ uLong total_in; /* total nb of input bytes read so far */
+
+ Bytef *next_out; /* next output byte should be put there */
+ uInt avail_out; /* remaining free space at next_out */
+ uLong total_out; /* total nb of bytes output so far */
+
+ char *msg; /* last error message, NULL if no error */
+ struct internal_state FAR *state; /* not visible by applications */
+
+ alloc_func zalloc; /* used to allocate the internal state */
+ free_func zfree; /* used to free the internal state */
+ voidpf opaque; /* private data object passed to zalloc and zfree */
+
+ int data_type; /* best guess about the data type: ascii or binary */
+ uLong adler; /* adler32 value of the uncompressed data */
+ uLong reserved; /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+ The application must update next_in and avail_in when avail_in has
+ dropped to zero. It must update next_out and avail_out when avail_out
+ has dropped to zero. The application must initialize zalloc, zfree and
+ opaque before calling the init function. All other fields are set by the
+ compression library and must not be updated by the application.
+
+ The opaque value provided by the application will be passed as the first
+ parameter for calls of zalloc and zfree. This can be useful for custom
+ memory management. The compression library attaches no meaning to the
+ opaque value.
+
+ zalloc must return Z_NULL if there is not enough memory for the object.
+ If zlib is used in a multi-threaded application, zalloc and zfree must be
+ thread safe.
+
+ On 16-bit systems, the functions zalloc and zfree must be able to allocate
+ exactly 65536 bytes, but will not be required to allocate more than this
+ if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
+ pointers returned by zalloc for objects of exactly 65536 bytes *must*
+ have their offset normalized to zero. The default allocation function
+ provided by this library ensures this (see zutil.c). To reduce memory
+ requirements and avoid any allocation of 64K objects, at the expense of
+ compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
+
+ The fields total_in and total_out can be used for statistics or
+ progress reports. After compression, total_in holds the total size of
+ the uncompressed data and may be saved for use in the decompressor
+ (particularly if the decompressor wants to decompress everything in
+ a single step).
+*/
+
+ /* constants */
+
+#define Z_NO_FLUSH 0
+#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */
+#define Z_SYNC_FLUSH 2
+#define Z_FULL_FLUSH 3
+#define Z_FINISH 4
+/* Allowed flush values; see deflate() below for details */
+
+#define Z_OK 0
+#define Z_STREAM_END 1
+#define Z_NEED_DICT 2
+#define Z_ERRNO (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR (-3)
+#define Z_MEM_ERROR (-4)
+#define Z_BUF_ERROR (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative
+ * values are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION 0
+#define Z_BEST_SPEED 1
+#define Z_BEST_COMPRESSION 9
+#define Z_DEFAULT_COMPRESSION (-1)
+/* compression levels */
+
+#define Z_FILTERED 1
+#define Z_HUFFMAN_ONLY 2
+#define Z_DEFAULT_STRATEGY 0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY 0
+#define Z_ASCII 1
+#define Z_UNKNOWN 2
+/* Possible values of the data_type field */
+
+#define Z_DEFLATED 8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+ /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+ If the first character differs, the library code actually used is
+ not compatible with the zlib.h header file used by the application.
+ This check is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+ Initializes the internal stream state for compression. The fields
+ zalloc, zfree and opaque must be initialized before by the caller.
+ If zalloc and zfree are set to Z_NULL, deflateInit updates them to
+ use default allocation functions.
+
+ The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+ 1 gives best speed, 9 gives best compression, 0 gives no compression at
+ all (the input data is simply copied a block at a time).
+ Z_DEFAULT_COMPRESSION requests a default compromise between speed and
+ compression (currently equivalent to level 6).
+
+ deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if level is not a valid compression level,
+ Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+ with the version assumed by the caller (ZLIB_VERSION).
+ msg is set to null if there is no error message. deflateInit does not
+ perform any compression: this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+ deflate compresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may introduce some
+ output latency (reading input without producing any output) except when
+ forced to flush.
+
+ The detailed semantics are as follows. deflate performs one or both of the
+ following actions:
+
+ - Compress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in and avail_in are updated and
+ processing will resume at this point for the next call of deflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. This action is forced if the parameter flush is non zero.
+ Forcing flush frequently degrades the compression ratio, so this parameter
+ should be set only when necessary (in interactive applications).
+ Some output may be provided even if flush is not set.
+
+ Before the call of deflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating avail_in or avail_out accordingly; avail_out
+ should never be zero before the call. The application can consume the
+ compressed output when it wants, for example when the output buffer is full
+ (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
+ and with zero avail_out, it must be called again after making room in the
+ output buffer because there might be more output pending.
+
+ If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+ flushed to the output buffer and the output is aligned on a byte boundary, so
+ that the decompressor can get all input data available so far. (In particular
+ avail_in is zero after the call if enough output space has been provided
+ before the call.) Flushing may degrade compression for some compression
+ algorithms and so it should be used only when necessary.
+
+ If flush is set to Z_FULL_FLUSH, all output is flushed as with
+ Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+ restart from this point if previous compressed data has been damaged or if
+ random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
+ the compression.
+
+ If deflate returns with avail_out == 0, this function must be called again
+ with the same value of the flush parameter and more output space (updated
+ avail_out), until the flush is complete (deflate returns with non-zero
+ avail_out).
+
+ If the parameter flush is set to Z_FINISH, pending input is processed,
+ pending output is flushed and deflate returns with Z_STREAM_END if there
+ was enough output space; if deflate returns with Z_OK, this function must be
+ called again with Z_FINISH and more output space (updated avail_out) but no
+ more input data, until it returns with Z_STREAM_END or an error. After
+ deflate has returned Z_STREAM_END, the only possible operations on the
+ stream are deflateReset or deflateEnd.
+
+ Z_FINISH can be used immediately after deflateInit if all the compression
+ is to be done in a single step. In this case, avail_out must be at least
+ 0.1% larger than avail_in plus 12 bytes. If deflate does not return
+ Z_STREAM_END, then it must be called again as described above.
+
+ deflate() sets strm->adler to the adler32 checksum of all input read
+ so far (that is, total_in bytes).
+
+ deflate() may update data_type if it can make a good guess about
+ the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
+ binary. This field is only for information purposes and does not affect
+ the compression algorithm in any manner.
+
+ deflate() returns Z_OK if some progress has been made (more input
+ processed or more output produced), Z_STREAM_END if all input has been
+ consumed and all output has been produced (only when flush is set to
+ Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+ if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
+ (for example avail_in or avail_out was zero).
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+ stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+ prematurely (some input or output was discarded). In the error case,
+ msg may be set but then points to a static string (which must not be
+ deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+ Initializes the internal stream state for decompression. The fields
+ next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+ the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
+ value depends on the compression method), inflateInit determines the
+ compression method from the zlib header and allocates all data structures
+ accordingly; otherwise the allocation will be deferred to the first call of
+ inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+ use default allocation functions.
+
+ inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+ version assumed by the caller. msg is set to null if there is no error
+ message. inflateInit does not perform any decompression apart from reading
+ the zlib header if present: this will be done by inflate(). (So next_in and
+ avail_in may be modified, but next_out and avail_out are unchanged.)
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+ inflate decompresses as much data as possible, and stops when the input
+ buffer becomes empty or the output buffer becomes full. It may some
+ introduce some output latency (reading input without producing any output)
+ except when forced to flush.
+
+ The detailed semantics are as follows. inflate performs one or both of the
+ following actions:
+
+ - Decompress more input starting at next_in and update next_in and avail_in
+ accordingly. If not all input can be processed (because there is not
+ enough room in the output buffer), next_in is updated and processing
+ will resume at this point for the next call of inflate().
+
+ - Provide more output starting at next_out and update next_out and avail_out
+ accordingly. inflate() provides as much output as possible, until there
+ is no more input data or no more space in the output buffer (see below
+ about the flush parameter).
+
+ Before the call of inflate(), the application should ensure that at least
+ one of the actions is possible, by providing more input and/or consuming
+ more output, and updating the next_* and avail_* values accordingly.
+ The application can consume the uncompressed output when it wants, for
+ example when the output buffer is full (avail_out == 0), or after each
+ call of inflate(). If inflate returns Z_OK and with zero avail_out, it
+ must be called again after making room in the output buffer because there
+ might be more output pending.
+
+ If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much
+ output as possible to the output buffer. The flushing behavior of inflate is
+ not specified for values of the flush parameter other than Z_SYNC_FLUSH
+ and Z_FINISH, but the current implementation actually flushes as much output
+ as possible anyway.
+
+ inflate() should normally be called until it returns Z_STREAM_END or an
+ error. However if all decompression is to be performed in a single step
+ (a single call of inflate), the parameter flush should be set to
+ Z_FINISH. In this case all pending input is processed and all pending
+ output is flushed; avail_out must be large enough to hold all the
+ uncompressed data. (The size of the uncompressed data may have been saved
+ by the compressor for this purpose.) The next operation on this stream must
+ be inflateEnd to deallocate the decompression state. The use of Z_FINISH
+ is never required, but can be used to inform inflate that a faster routine
+ may be used for the single inflate() call.
+
+ If a preset dictionary is needed at this point (see inflateSetDictionary
+ below), inflate sets strm-adler to the adler32 checksum of the
+ dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
+ it sets strm->adler to the adler32 checksum of all output produced
+ so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
+ an error code as described below. At the end of the stream, inflate()
+ checks that its computed adler32 checksum is equal to that saved by the
+ compressor and returns Z_STREAM_END only if the checksum is correct.
+
+ inflate() returns Z_OK if some progress has been made (more input processed
+ or more output produced), Z_STREAM_END if the end of the compressed data has
+ been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+ preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+ corrupted (input stream not conforming to the zlib format or incorrect
+ adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent
+ (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if no progress is possible or if there was not
+ enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR
+ case, the application may then call inflateSync to look for a good
+ compression block.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+ All dynamically allocated data structures for this stream are freed.
+ This function discards any unprocessed input and does not flush any
+ pending output.
+
+ inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+ was inconsistent. In the error case, msg may be set but then points to a
+ static string (which must not be deallocated).
+*/
+
+ /* Advanced functions */
+
+/*
+ The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+ int level,
+ int method,
+ int windowBits,
+ int memLevel,
+ int strategy));
+
+ This is another version of deflateInit with more compression options. The
+ fields next_in, zalloc, zfree and opaque must be initialized before by
+ the caller.
+
+ The method parameter is the compression method. It must be Z_DEFLATED in
+ this version of the library.
+
+ The windowBits parameter is the base two logarithm of the window size
+ (the size of the history buffer). It should be in the range 8..15 for this
+ version of the library. Larger values of this parameter result in better
+ compression at the expense of memory usage. The default value is 15 if
+ deflateInit is used instead.
+
+ The memLevel parameter specifies how much memory should be allocated
+ for the internal compression state. memLevel=1 uses minimum memory but
+ is slow and reduces compression ratio; memLevel=9 uses maximum memory
+ for optimal speed. The default value is 8. See zconf.h for total memory
+ usage as a function of windowBits and memLevel.
+
+ The strategy parameter is used to tune the compression algorithm. Use the
+ value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+ filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
+ string match). Filtered data consists mostly of small values with a
+ somewhat random distribution. In this case, the compression algorithm is
+ tuned to compress them better. The effect of Z_FILTERED is to force more
+ Huffman coding and less string matching; it is somewhat intermediate
+ between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
+ the compression ratio but not the correctness of the compressed output even
+ if it is not set appropriately.
+
+ deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid
+ method). msg is set to null if there is no error message. deflateInit2 does
+ not perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the compression dictionary from the given byte sequence
+ without producing any compressed output. This function must be called
+ immediately after deflateInit, deflateInit2 or deflateReset, before any
+ call of deflate. The compressor and decompressor must use exactly the same
+ dictionary (see inflateSetDictionary).
+
+ The dictionary should consist of strings (byte sequences) that are likely
+ to be encountered later in the data to be compressed, with the most commonly
+ used strings preferably put towards the end of the dictionary. Using a
+ dictionary is most useful when the data to be compressed is short and can be
+ predicted with good accuracy; the data can then be compressed better than
+ with the default empty dictionary.
+
+ Depending on the size of the compression data structures selected by
+ deflateInit or deflateInit2, a part of the dictionary may in effect be
+ discarded, for example if the dictionary is larger than the window size in
+ deflate or deflate2. Thus the strings most likely to be useful should be
+ put at the end of the dictionary, not at the front.
+
+ Upon return of this function, strm->adler is set to the Adler32 value
+ of the dictionary; the decompressor may later use this value to determine
+ which dictionary has been used by the compressor. (The Adler32 value
+ applies to the whole dictionary even if only a subset of the dictionary is
+ actually used by the compressor.)
+
+ deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent (for example if deflate has already been called for this stream
+ or if the compression method is bsort). deflateSetDictionary does not
+ perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+ z_streamp source));
+/*
+ Sets the destination stream as a complete copy of the source stream.
+
+ This function can be useful when several compression strategies will be
+ tried, for example when there are several ways of pre-processing the input
+ data with a filter. The streams that will be discarded should then be freed
+ by calling deflateEnd. Note that deflateCopy duplicates the internal
+ compression state which can be quite large, so this strategy is slow and
+ can consume lots of memory.
+
+ deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+ (such as zalloc being NULL). msg is left unchanged in both source and
+ destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to deflateEnd followed by deflateInit,
+ but does not free and reallocate all the internal compression state.
+ The stream will keep the same compression level and any other attributes
+ that may have been set by deflateInit2.
+
+ deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+ int level,
+ int strategy));
+/*
+ Dynamically update the compression level and compression strategy. The
+ interpretation of level and strategy is as in deflateInit2. This can be
+ used to switch between compression and straight copy of the input data, or
+ to switch to a different kind of input data requiring a different
+ strategy. If the compression level is changed, the input available so far
+ is compressed with the old level (and may be flushed); the new level will
+ take effect only at the next call of deflate().
+
+ Before the call of deflateParams, the stream state must be set as for
+ a call of deflate(), since the currently available input may have to
+ be compressed and flushed. In particular, strm->avail_out must be non-zero.
+
+ deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+ stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
+ if strm->avail_out was zero.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+ int windowBits));
+
+ This is another version of inflateInit with an extra parameter. The
+ fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+ before by the caller.
+
+ The windowBits parameter is the base two logarithm of the maximum window
+ size (the size of the history buffer). It should be in the range 8..15 for
+ this version of the library. The default value is 15 if inflateInit is used
+ instead. If a compressed stream with a larger window size is given as
+ input, inflate() will return with the error code Z_DATA_ERROR instead of
+ trying to allocate a larger window.
+
+ inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative
+ memLevel). msg is set to null if there is no error message. inflateInit2
+ does not perform any decompression apart from reading the zlib header if
+ present: this will be done by inflate(). (So next_in and avail_in may be
+ modified, but next_out and avail_out are unchanged.)
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength));
+/*
+ Initializes the decompression dictionary from the given uncompressed byte
+ sequence. This function must be called immediately after a call of inflate
+ if this call returned Z_NEED_DICT. The dictionary chosen by the compressor
+ can be determined from the Adler32 value returned by this call of
+ inflate. The compressor and decompressor must use exactly the same
+ dictionary (see deflateSetDictionary).
+
+ inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+ parameter is invalid (such as NULL dictionary) or the stream state is
+ inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+ expected one (incorrect Adler32 value). inflateSetDictionary does not
+ perform any decompression: this will be done by subsequent calls of
+ inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+ Skips invalid compressed data until a full flush point (see above the
+ description of deflate with Z_FULL_FLUSH) can be found, or until all
+ available input is skipped. No output is provided.
+
+ inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+ if no more input was provided, Z_DATA_ERROR if no flush point has been found,
+ or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
+ case, the application may save the current current value of total_in which
+ indicates where valid compressed data was found. In the error case, the
+ application may repeatedly call inflateSync, providing more input each time,
+ until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+ This function is equivalent to inflateEnd followed by inflateInit,
+ but does not free and reallocate all the internal decompression state.
+ The stream will keep attributes that may have been set by inflateInit2.
+
+ inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+ stream state was inconsistent (such as zalloc or state being NULL).
+*/
+
+
+ /* utility functions */
+
+/*
+ The following utility functions are implemented on top of the
+ basic stream-oriented functions. To simplify the interface, some
+ default options are assumed (compression level and memory usage,
+ standard memory allocation functions). The source code of these
+ utility functions can easily be modified if you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Compresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be at least 0.1% larger than
+ sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
+ compressed buffer.
+ This function can be used to compress a whole file at once if the
+ input file is mmap'ed.
+ compress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen,
+ int level));
+/*
+ Compresses the source buffer into the destination buffer. The level
+ parameter has the same meaning as in deflateInit. sourceLen is the byte
+ length of the source buffer. Upon entry, destLen is the total size of the
+ destination buffer, which must be at least 0.1% larger than sourceLen plus
+ 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
+
+ compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+ memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+ Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen));
+/*
+ Decompresses the source buffer into the destination buffer. sourceLen is
+ the byte length of the source buffer. Upon entry, destLen is the total
+ size of the destination buffer, which must be large enough to hold the
+ entire uncompressed data. (The size of the uncompressed data must have
+ been saved previously by the compressor and transmitted to the decompressor
+ by some mechanism outside the scope of this compression library.)
+ Upon exit, destLen is the actual size of the compressed buffer.
+ This function can be used to decompress a whole file at once if the
+ input file is mmap'ed.
+
+ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+ enough memory, Z_BUF_ERROR if there was not enough room in the output
+ buffer, or Z_DATA_ERROR if the input data was corrupted.
+*/
+
+
+typedef voidp gzFile;
+
+ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+/*
+ Opens a gzip (.gz) file for reading or writing. The mode parameter
+ is as in fopen ("rb" or "wb") but can also include a compression level
+ ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
+ Huffman only compression as in "wb1h". (See the description
+ of deflateInit2 for more information about the strategy parameter.)
+
+ gzopen can be used to read a file which is not in gzip format; in this
+ case gzread will directly read from the file without decompression.
+
+ gzopen returns NULL if the file could not be opened or if there was
+ insufficient memory to allocate the (de)compression state; errno
+ can be checked to distinguish the two cases (if errno is zero, the
+ zlib error is Z_MEM_ERROR). */
+
+ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+/*
+ gzdopen() associates a gzFile with the file descriptor fd. File
+ descriptors are obtained from calls like open, dup, creat, pipe or
+ fileno (in the file has been previously opened with fopen).
+ The mode parameter is as in gzopen.
+ The next call of gzclose on the returned gzFile will also close the
+ file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
+ descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
+ gzdopen returns NULL if there was insufficient memory to allocate
+ the (de)compression state.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+ Dynamically update the compression level or strategy. See the description
+ of deflateInit2 for the meaning of these parameters.
+ gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+ opened for writing.
+*/
+
+ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+/*
+ Reads the given number of uncompressed bytes from the compressed file.
+ If the input file was not in gzip format, gzread copies the given number
+ of bytes into the buffer.
+ gzread returns the number of uncompressed bytes actually read (0 for
+ end of file, -1 for error). */
+
+ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
+ const voidp buf, unsigned len));
+/*
+ Writes the given number of uncompressed bytes into the compressed file.
+ gzwrite returns the number of uncompressed bytes actually written
+ (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+/*
+ Converts, formats, and writes the args to the compressed file under
+ control of the format string, as in fprintf. gzprintf returns the number of
+ uncompressed bytes actually written (0 in case of error).
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+ Writes the given null-terminated string to the compressed file, excluding
+ the terminating null character.
+ gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+ Reads bytes from the compressed file until len-1 characters are read, or
+ a newline character is read and transferred to buf, or an end-of-file
+ condition is encountered. The string is then terminated with a null
+ character.
+ gzgets returns buf, or Z_NULL in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+/*
+ Writes c, converted to an unsigned char, into the compressed file.
+ gzputc returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+/*
+ Reads one byte from the compressed file. gzgetc returns this byte
+ or -1 in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+/*
+ Flushes all pending output into the compressed file. The parameter
+ flush is as in the deflate() function. The return value is the zlib
+ error number (see function gzerror below). gzflush returns Z_OK if
+ the flush parameter is Z_FINISH and all output could be flushed.
+ gzflush should be called only when strictly necessary because it can
+ degrade compression.
+*/
+
+ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
+ z_off_t offset, int whence));
+/*
+ Sets the starting position for the next gzread or gzwrite on the
+ given compressed file. The offset represents a number of bytes in the
+ uncompressed data stream. The whence parameter is defined as in lseek(2);
+ the value SEEK_END is not supported.
+ If the file is opened for reading, this function is emulated but can be
+ extremely slow. If the file is opened for writing, only forward seeks are
+ supported; gzseek then compresses a sequence of zeroes up to the new
+ starting position.
+
+ gzseek returns the resulting offset location as measured in bytes from
+ the beginning of the uncompressed stream, or -1 in case of error, in
+ particular if the file is opened for writing and the new starting position
+ would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
+/*
+ Rewinds the given file. This function is supported only for reading.
+
+ gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
+/*
+ Returns the starting position for the next gzread or gzwrite on the
+ given compressed file. This position represents a number of bytes in the
+ uncompressed data stream.
+
+ gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+ Returns 1 when EOF has previously been detected reading the given
+ input stream, otherwise zero.
+*/
+
+ZEXTERN int ZEXPORT gzclose OF((gzFile file));
+/*
+ Flushes all pending output if necessary, closes the compressed file
+ and deallocates all the (de)compression state. The return value is the zlib
+ error number (see function gzerror below).
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+ Returns the error message for the last error which occurred on the
+ given compressed file. errnum is set to zlib error number. If an
+ error occurred in the file system and not in the compression library,
+ errnum is set to Z_ERRNO and the application may consult errno
+ to get the exact error code.
+*/
+
+ /* checksum functions */
+
+/*
+ These functions are not related to compression but are exported
+ anyway because they might be useful in applications using the
+ compression library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+
+/*
+ Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+ return the updated checksum. If buf is NULL, this function returns
+ the required initial value for the checksum.
+ An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+ much faster. Usage example:
+
+ uLong adler = adler32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ adler = adler32(adler, buffer, length);
+ }
+ if (adler != original_adler) error();
+*/
+
+ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
+/*
+ Update a running crc with the bytes buf[0..len-1] and return the updated
+ crc. If buf is NULL, this function returns the required initial value
+ for the crc. Pre- and post-conditioning (one's complement) is performed
+ within this function so it shouldn't be done by the application.
+ Usage example:
+
+ uLong crc = crc32(0L, Z_NULL, 0);
+
+ while (read_buffer(buffer, length) != EOF) {
+ crc = crc32(crc, buffer, length);
+ }
+ if (crc != original_crc) error();
+*/
+
+
+ /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+ const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
+ int windowBits, int memLevel,
+ int strategy, const char *version,
+ int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
+ const char *version, int stream_size));
+#define deflateInit(strm, level) \
+ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+ (strategy), ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+
+
+#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
+ struct internal_state {int dummy;}; /* hack for buggy compilers */
+#endif
+
+ZEXTERN const char * ZEXPORT zError OF((int err));
+ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
+ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _ZLIB_H */
diff --git a/src/zlib/zlib.sln b/src/zlib/zlib.sln
new file mode 100644
index 000000000..8cb011cba
--- /dev/null
+++ b/src/zlib/zlib.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcproj", "{935D4133-E17F-446E-A1D5-1ECB9EF68789}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {935D4133-E17F-446E-A1D5-1ECB9EF68789}.Debug.ActiveCfg = Debug|Win32
+ {935D4133-E17F-446E-A1D5-1ECB9EF68789}.Debug.Build.0 = Debug|Win32
+ {935D4133-E17F-446E-A1D5-1ECB9EF68789}.Release.ActiveCfg = Release|Win32
+ {935D4133-E17F-446E-A1D5-1ECB9EF68789}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/src/zlib/zlib.vcproj b/src/zlib/zlib.vcproj
new file mode 100644
index 000000000..b9c6fe457
--- /dev/null
+++ b/src/zlib/zlib.vcproj
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="zlib"
+ ProjectGUID="{2FCD4B66-9CF9-4C8F-BC70-37CD20002D49}"
+ SccProjectName=""
+ SccLocalPath=""
+ Keyword="MFCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+ RuntimeLibrary="3"
+ ForceConformanceInForLoopScope="TRUE"
+ PrecompiledHeaderFile=".\Debug/zlib.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/$(ProjectName)D.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ Culture="2057"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)"
+ ConfigurationType="4"
+ UseOfMFC="2"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="3"
+ GlobalOptimizations="TRUE"
+ InlineFunctionExpansion="1"
+ EnableIntrinsicFunctions="TRUE"
+ FavorSizeOrSpeed="1"
+ OmitFramePointers="TRUE"
+ EnableFiberSafeOptimizations="TRUE"
+ OptimizeForProcessor="1"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
+ StringPooling="TRUE"
+ RuntimeLibrary="0"
+ BufferSecurityCheck="FALSE"
+ EnableFunctionLevelLinking="TRUE"
+ ForceConformanceInForLoopScope="TRUE"
+ PrecompiledHeaderFile=".\Release/zlib.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="../../lib/$(ProjectName)R.lib"
+ SuppressStartupBanner="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ Culture="2057"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90">
+ <File
+ RelativePath=".\Adler32.c">
+ </File>
+ <File
+ RelativePath=".\Compress.c">
+ </File>
+ <File
+ RelativePath=".\Crc32.c">
+ </File>
+ <File
+ RelativePath=".\Deflate.c">
+ </File>
+ <File
+ RelativePath=".\Gzio.c">
+ </File>
+ <File
+ RelativePath=".\Infblock.c">
+ </File>
+ <File
+ RelativePath=".\Infcodes.c">
+ </File>
+ <File
+ RelativePath=".\Inffast.c">
+ </File>
+ <File
+ RelativePath=".\Inflate.c">
+ </File>
+ <File
+ RelativePath=".\Inftrees.c">
+ </File>
+ <File
+ RelativePath=".\Infutil.c">
+ </File>
+ <File
+ RelativePath=".\Trees.c">
+ </File>
+ <File
+ RelativePath=".\Uncompr.c">
+ </File>
+ <File
+ RelativePath=".\Zutil.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;fi;fd">
+ <File
+ RelativePath=".\deflate.h">
+ </File>
+ <File
+ RelativePath=".\infblock.h">
+ </File>
+ <File
+ RelativePath=".\infcodes.h">
+ </File>
+ <File
+ RelativePath=".\inffast.h">
+ </File>
+ <File
+ RelativePath=".\inftrees.h">
+ </File>
+ <File
+ RelativePath=".\infutil.h">
+ </File>
+ <File
+ RelativePath=".\zconf.h">
+ </File>
+ <File
+ RelativePath=".\zlib.h">
+ </File>
+ <File
+ RelativePath=".\zutil.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ <Global
+ Name="DevPartner_IsInstrumented"
+ Value="0"/>
+ </Globals>
+</VisualStudioProject>
diff --git a/src/zlib/zutil.c b/src/zlib/zutil.c
new file mode 100644
index 000000000..8d6f0f187
--- /dev/null
+++ b/src/zlib/zutil.c
@@ -0,0 +1,225 @@
+/* zutil.c -- target dependent utility functions for the compression library
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id: zutil.c 126 2003-11-09 01:53:27Z gabest $ */
+
+#include "zutil.h"
+
+struct internal_state {int dummy;}; /* for buggy compilers */
+
+#ifndef STDC
+extern void exit OF((int));
+#endif
+
+const char *z_errmsg[10] = {
+"need dictionary", /* Z_NEED_DICT 2 */
+"stream end", /* Z_STREAM_END 1 */
+"", /* Z_OK 0 */
+"file error", /* Z_ERRNO (-1) */
+"stream error", /* Z_STREAM_ERROR (-2) */
+"data error", /* Z_DATA_ERROR (-3) */
+"insufficient memory", /* Z_MEM_ERROR (-4) */
+"buffer error", /* Z_BUF_ERROR (-5) */
+"incompatible version",/* Z_VERSION_ERROR (-6) */
+""};
+
+
+const char * ZEXPORT zlibVersion()
+{
+ return ZLIB_VERSION;
+}
+
+#ifdef DEBUG
+
+# ifndef verbose
+# define verbose 0
+# endif
+int z_verbose = verbose;
+
+void z_error (m)
+ char *m;
+{
+ fprintf(stderr, "%s\n", m);
+ exit(1);
+}
+#endif
+
+/* exported to allow conversion of error code to string for compress() and
+ * uncompress()
+ */
+const char * ZEXPORT zError(err)
+ int err;
+{
+ return ERR_MSG(err);
+}
+
+
+#ifndef HAVE_MEMCPY
+
+void zmemcpy(dest, source, len)
+ Bytef* dest;
+ const Bytef* source;
+ uInt len;
+{
+ if (len == 0) return;
+ do {
+ *dest++ = *source++; /* ??? to be unrolled */
+ } while (--len != 0);
+}
+
+int zmemcmp(s1, s2, len)
+ const Bytef* s1;
+ const Bytef* s2;
+ uInt len;
+{
+ uInt j;
+
+ for (j = 0; j < len; j++) {
+ if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
+ }
+ return 0;
+}
+
+void zmemzero(dest, len)
+ Bytef* dest;
+ uInt len;
+{
+ if (len == 0) return;
+ do {
+ *dest++ = 0; /* ??? to be unrolled */
+ } while (--len != 0);
+}
+#endif
+
+#ifdef __TURBOC__
+#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
+/* Small and medium model in Turbo C are for now limited to near allocation
+ * with reduced MAX_WBITS and MAX_MEM_LEVEL
+ */
+# define MY_ZCALLOC
+
+/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
+ * and farmalloc(64K) returns a pointer with an offset of 8, so we
+ * must fix the pointer. Warning: the pointer must be put back to its
+ * original form in order to free it, use zcfree().
+ */
+
+#define MAX_PTR 10
+/* 10*64K = 640K */
+
+local int next_ptr = 0;
+
+typedef struct ptr_table_s {
+ voidpf org_ptr;
+ voidpf new_ptr;
+} ptr_table;
+
+local ptr_table table[MAX_PTR];
+/* This table is used to remember the original form of pointers
+ * to large buffers (64K). Such pointers are normalized with a zero offset.
+ * Since MSDOS is not a preemptive multitasking OS, this table is not
+ * protected from concurrent access. This hack doesn't work anyway on
+ * a protected system like OS/2. Use Microsoft C instead.
+ */
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+ voidpf buf = opaque; /* just to make some compilers happy */
+ ulg bsize = (ulg)items*size;
+
+ /* If we allocate less than 65520 bytes, we assume that farmalloc
+ * will return a usable pointer which doesn't have to be normalized.
+ */
+ if (bsize < 65520L) {
+ buf = farmalloc(bsize);
+ if (*(ush*)&buf != 0) return buf;
+ } else {
+ buf = farmalloc(bsize + 16L);
+ }
+ if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
+ table[next_ptr].org_ptr = buf;
+
+ /* Normalize the pointer to seg:0 */
+ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
+ *(ush*)&buf = 0;
+ table[next_ptr++].new_ptr = buf;
+ return buf;
+}
+
+void zcfree (voidpf opaque, voidpf ptr)
+{
+ int n;
+ if (*(ush*)&ptr != 0) { /* object < 64K */
+ farfree(ptr);
+ return;
+ }
+ /* Find the original pointer */
+ for (n = 0; n < next_ptr; n++) {
+ if (ptr != table[n].new_ptr) continue;
+
+ farfree(table[n].org_ptr);
+ while (++n < next_ptr) {
+ table[n-1] = table[n];
+ }
+ next_ptr--;
+ return;
+ }
+ ptr = opaque; /* just to make some compilers happy */
+ Assert(0, "zcfree: ptr not found");
+}
+#endif
+#endif /* __TURBOC__ */
+
+
+#if defined(M_I86) && !defined(__32BIT__)
+/* Microsoft C in 16-bit mode */
+
+# define MY_ZCALLOC
+
+#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
+# define _halloc halloc
+# define _hfree hfree
+#endif
+
+voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
+{
+ if (opaque) opaque = 0; /* to make compiler happy */
+ return _halloc((long)items, size);
+}
+
+void zcfree (voidpf opaque, voidpf ptr)
+{
+ if (opaque) opaque = 0; /* to make compiler happy */
+ _hfree(ptr);
+}
+
+#endif /* MSC */
+
+
+#ifndef MY_ZCALLOC /* Any system without a special alloc function */
+
+#ifndef STDC
+extern voidp calloc OF((uInt items, uInt size));
+extern void free OF((voidpf ptr));
+#endif
+
+voidpf zcalloc (opaque, items, size)
+ voidpf opaque;
+ unsigned items;
+ unsigned size;
+{
+ if (opaque) items += size - size; /* make compiler happy */
+ return (voidpf)calloc(items, size);
+}
+
+void zcfree (opaque, ptr)
+ voidpf opaque;
+ voidpf ptr;
+{
+ free(ptr);
+ if (opaque) return; /* make compiler happy */
+}
+
+#endif /* MY_ZCALLOC */
diff --git a/src/zlib/zutil.h b/src/zlib/zutil.h
new file mode 100644
index 000000000..2d5e97201
--- /dev/null
+++ b/src/zlib/zutil.h
@@ -0,0 +1,220 @@
+/* zutil.h -- internal interface and configuration of the compression library
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* WARNING: this file should *not* be used by applications. It is
+ part of the implementation of the compression library and is
+ subject to change. Applications should only use zlib.h.
+ */
+
+/* @(#) $Id: zutil.h 126 2003-11-09 01:53:27Z gabest $ */
+
+#ifndef _Z_UTIL_H
+#define _Z_UTIL_H
+
+#include "zlib.h"
+
+#ifdef STDC
+# include <stddef.h>
+# include <string.h>
+# include <stdlib.h>
+#endif
+#ifdef NO_ERRNO_H
+ extern int errno;
+#else
+# include <errno.h>
+#endif
+
+#ifndef local
+# define local static
+#endif
+/* compile with -Dlocal if your debugger can't find static symbols */
+
+typedef unsigned char uch;
+typedef uch FAR uchf;
+typedef unsigned short ush;
+typedef ush FAR ushf;
+typedef unsigned long ulg;
+
+extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
+/* (size given to avoid silly warnings with Visual C++) */
+
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+
+#define ERR_RETURN(strm,err) \
+ return (strm->msg = (char*)ERR_MSG(err), (err))
+/* To be used only when the state is known to be valid */
+
+ /* common constants */
+
+#ifndef DEF_WBITS
+# define DEF_WBITS MAX_WBITS
+#endif
+/* default windowBits for decompression. MAX_WBITS is for compression only */
+
+#if MAX_MEM_LEVEL >= 8
+# define DEF_MEM_LEVEL 8
+#else
+# define DEF_MEM_LEVEL MAX_MEM_LEVEL
+#endif
+/* default memLevel */
+
+#define STORED_BLOCK 0
+#define STATIC_TREES 1
+#define DYN_TREES 2
+/* The three kinds of block type */
+
+#define MIN_MATCH 3
+#define MAX_MATCH 258
+/* The minimum and maximum match lengths */
+
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
+
+ /* target dependencies */
+
+#ifdef MSDOS
+# define OS_CODE 0x00
+# if defined(__TURBOC__) || defined(__BORLANDC__)
+# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
+ /* Allow compilation with ANSI keywords only enabled */
+ void _Cdecl farfree( void *block );
+ void *_Cdecl farmalloc( unsigned long nbytes );
+# else
+# include <alloc.h>
+# endif
+# else /* MSC or DJGPP */
+# include <malloc.h>
+# endif
+#endif
+
+#ifdef OS2
+# define OS_CODE 0x06
+#endif
+
+#ifdef WIN32 /* Window 95 & Windows NT */
+# define OS_CODE 0x0b
+#endif
+
+#if defined(VAXC) || defined(VMS)
+# define OS_CODE 0x02
+# define F_OPEN(name, mode) \
+ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
+#endif
+
+#ifdef AMIGA
+# define OS_CODE 0x01
+#endif
+
+#if defined(ATARI) || defined(atarist)
+# define OS_CODE 0x05
+#endif
+
+#if defined(MACOS) || defined(TARGET_OS_MAC)
+# define OS_CODE 0x07
+# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
+# include <unix.h> /* for fdopen */
+# else
+# ifndef fdopen
+# define fdopen(fd,mode) NULL /* No fdopen() */
+# endif
+# endif
+#endif
+
+#ifdef __50SERIES /* Prime/PRIMOS */
+# define OS_CODE 0x0F
+#endif
+
+#ifdef TOPS20
+# define OS_CODE 0x0a
+#endif
+
+#if defined(_BEOS_) || defined(RISCOS)
+# define fdopen(fd,mode) NULL /* No fdopen() */
+#endif
+
+#if (defined(_MSC_VER) && (_MSC_VER > 600))
+# define fdopen(fd,type) _fdopen(fd,type)
+#endif
+
+
+ /* Common defaults */
+
+#ifndef OS_CODE
+# define OS_CODE 0x03 /* assume Unix */
+#endif
+
+#ifndef F_OPEN
+# define F_OPEN(name, mode) fopen((name), (mode))
+#endif
+
+ /* functions */
+
+#ifdef HAVE_STRERROR
+ extern char *strerror OF((int));
+# define zstrerror(errnum) strerror(errnum)
+#else
+# define zstrerror(errnum) ""
+#endif
+
+#if defined(pyr)
+# define NO_MEMCPY
+#endif
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
+ /* Use our own functions for small and medium model with MSC <= 5.0.
+ * You may have to use the same strategy for Borland C (untested).
+ * The __SC__ check is for Symantec.
+ */
+# define NO_MEMCPY
+#endif
+#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
+# define HAVE_MEMCPY
+#endif
+#ifdef HAVE_MEMCPY
+# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
+# define zmemcpy _fmemcpy
+# define zmemcmp _fmemcmp
+# define zmemzero(dest, len) _fmemset(dest, 0, len)
+# else
+# define zmemcpy memcpy
+# define zmemcmp memcmp
+# define zmemzero(dest, len) memset(dest, 0, len)
+# endif
+#else
+ extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
+ extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
+ extern void zmemzero OF((Bytef* dest, uInt len));
+#endif
+
+/* Diagnostic functions */
+#ifdef DEBUG
+# include <stdio.h>
+ extern int z_verbose;
+ extern void z_error OF((char *m));
+# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
+# define Trace(x) {if (z_verbose>=0) fprintf x ;}
+# define Tracev(x) {if (z_verbose>0) fprintf x ;}
+# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
+# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
+# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+#else
+# define Assert(cond,msg)
+# define Trace(x)
+# define Tracev(x)
+# define Tracevv(x)
+# define Tracec(c,x)
+# define Tracecv(c,x)
+#endif
+
+
+typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
+ uInt len));
+voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+void zcfree OF((voidpf opaque, voidpf ptr));
+
+#define ZALLOC(strm, items, size) \
+ (*((strm)->zalloc))((strm)->opaque, (items), (size))
+#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
+#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
+
+#endif /* _Z_UTIL_H */